From 00e612deed5d258adf7ac399740984dee7232673 Mon Sep 17 00:00:00 2001 From: "Matt.Wang" Date: Mon, 8 Sep 2025 15:04:20 +0800 Subject: [PATCH 01/28] chore: update script for 3.14 --- .github/workflows/ci.yml | 2 +- .github/workflows/deploy-gh-page.yml | 2 +- .../{py313-sync-cpython.yml => py314-sync-cpython.yml} | 8 ++++---- .scripts/summarize_progress/main.py | 2 +- Makefile | 2 +- README.rst | 8 ++++---- 6 files changed, 12 insertions(+), 12 deletions(-) rename .github/workflows/{py313-sync-cpython.yml => py314-sync-cpython.yml} (94%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index edcc0ba1019..5e7acfe52ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: "3.13" + python-version: "3.14" - name: Install Dependencies run: sudo apt-get install gettext diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml index 391bfc79024..12f0447fd89 100644 --- a/.github/workflows/deploy-gh-page.yml +++ b/.github/workflows/deploy-gh-page.yml @@ -3,7 +3,7 @@ name: deploy-gh-page on: push: branches: - - "3.13" + - "3.14" jobs: cd: diff --git a/.github/workflows/py313-sync-cpython.yml b/.github/workflows/py314-sync-cpython.yml similarity index 94% rename from .github/workflows/py313-sync-cpython.yml rename to .github/workflows/py314-sync-cpython.yml index ae9303b983f..2bb461d6b0f 100644 --- a/.github/workflows/py313-sync-cpython.yml +++ b/.github/workflows/py314-sync-cpython.yml @@ -1,9 +1,9 @@ -name: python-3.13-sync-with-cpython +name: python-3.14-sync-with-cpython on: push: branches: - - "3.13" + - "3.14" schedule: - cron: "0 0 * * *" @@ -11,8 +11,8 @@ jobs: sync: runs-on: ubuntu-latest env: - VERSION: "3.13" - BRANCH: "cron/sync/3.13" + VERSION: "3.14" + BRANCH: "cron/sync/3.14" steps: - uses: actions/checkout@v5 with: diff --git a/.scripts/summarize_progress/main.py b/.scripts/summarize_progress/main.py index f35f7bbd56a..b31624109c8 100644 --- a/.scripts/summarize_progress/main.py +++ b/.scripts/summarize_progress/main.py @@ -137,7 +137,7 @@ def format_line_po(filename: str, po_link: str, progress: str, num_entries: str, filedict_sorted = dict(sorted(filedict.items())) for filename, filedata in filedict_sorted.items(): file_path = f"{dirname}/{filename}" if dirname else filename - po_link = f"https://github.com/python/python-docs-zh-tw/tree/3.13/{file_path}" + po_link = f"https://github.com/python/python-docs-zh-tw/tree/3.14/{file_path}" issue_link = filedata['issue'] issue_number = f"#{issue_link.split('/')[-1]}" create_issue_link = f"https://github.com/python/python-docs-zh-tw/issues/new?title=Translate%20`{file_path}`" diff --git a/Makefile b/Makefile index c0da35f4af8..68604f26330 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ endef export PRINT_HELP_PYSCRIPT # End of python section CPYTHON_CLONE := ../cpython -VERSION := $(or $(VERSION), 3.13) +VERSION := $(or $(VERSION), 3.14) SPHINX_CONF := $(CPYTHON_CLONE)/Doc/conf.py LANGUAGE := zh_TW LC_MESSAGES := $(CPYTHON_CLONE)/Doc/locales/$(LANGUAGE)/LC_MESSAGES diff --git a/README.rst b/README.rst index 0fa98b4abcb..14ff6f6038e 100644 --- a/README.rst +++ b/README.rst @@ -6,7 +6,7 @@ Python 官方說明文件臺灣繁體中文翻譯計畫 :target: https://discord.gg/44XheGXhWH :alt: Join Chat on Discord -這是 Python 3.13 官方說明文件的臺灣繁體中文(zh_TW)翻譯。 +這是 Python 3.14 官方說明文件的臺灣繁體中文(zh_TW)翻譯。 翻譯之前,請務必詳讀並同意\ `授權與 License`_。參與方式請參考\ `參與翻譯`_。 @@ -133,13 +133,13 @@ the PSF for inclusion in the documentation. 接著在 terminal 裡按照以下步驟: -1. 基於最新版本的 ``upstream/3.13`` 開啟一個 branch,現在假設我們想要翻譯 library/math.po \ +1. 基於最新版本的 ``upstream/3.14`` 開啟一個 branch,現在假設我們想要翻譯 library/math.po \ 所以把這個 branch 叫做 ``library/math``: .. code-block:: bash git fetch upstream - git checkout -b library/math upstream/3.13 + git checkout -b library/math upstream/3.14 2. 接著就可以開始翻譯(翻譯時可參考\ `翻譯守則`_),你可以手動開啟 Poedit 應用程式再選 \ library/math.po 檔案打開 @@ -223,7 +223,7 @@ the PSF for inclusion in the documentation. - 從 upstream(我們的主要 GitHub repo)做 fetch 的動作 - 對 origin(你的 fork)做 push -- 永遠不對 ``3.13`` branch 進行修改,請保持讓這個 branch 唯讀,可以避免掉很多問題。 +- 永遠不對 ``3.14`` branch 進行修改,請保持讓這個 branch 唯讀,可以避免掉很多問題。 要翻譯哪些東西 -------------- From e01b66db8c03231f2288b6725ac30bf035c3e030 Mon Sep 17 00:00:00 2001 From: "Matt.Wang" Date: Mon, 8 Sep 2025 15:39:26 +0800 Subject: [PATCH 02/28] merge 3.14 source strings --- bugs.po | 92 +- c-api/allocation.po | 233 +- c-api/apiabiversion.po | 365 +- c-api/arg.po | 454 +- c-api/bytearray.po | 22 +- c-api/bytes.po | 29 +- c-api/code.po | 112 +- c-api/complex.po | 40 +- c-api/contextvars.po | 100 +- c-api/conversion.po | 31 +- c-api/dict.po | 51 +- c-api/exceptions.po | 456 +- c-api/extension-modules.po | 356 + c-api/float.po | 93 +- c-api/gcsupport.po | 236 +- c-api/hash.po | 36 +- c-api/import.po | 104 +- c-api/init.po | 1918 +++--- c-api/init_config.po | 2631 +++++-- c-api/intro.po | 836 +-- c-api/iter.po | 142 +- c-api/lifecycle.po | 365 + c-api/long.po | 616 +- c-api/marshal.po | 56 +- c-api/memory.po | 553 +- c-api/module.po | 596 +- c-api/monitoring.po | 134 +- c-api/object.po | 214 +- c-api/perfmaps.po | 34 +- c-api/refcounting.po | 185 +- c-api/reflection.po | 47 +- c-api/sequence.po | 67 +- c-api/stable.po | 71 +- c-api/structures.po | 483 +- c-api/sys.po | 212 +- c-api/time.po | 25 +- c-api/tuple.po | 63 +- c-api/type.po | 498 +- c-api/typeobj.po | 2409 ++++--- c-api/unicode.po | 1308 ++-- c-api/weakref.po | 22 +- copyright.po | 5 +- deprecations/c-api-pending-removal-in-3.14.po | 327 +- deprecations/c-api-pending-removal-in-3.15.po | 331 +- deprecations/c-api-pending-removal-in-3.18.po | 142 + .../c-api-pending-removal-in-future.po | 80 +- deprecations/index.po | 1598 +++-- deprecations/pending-removal-in-3.13.po | 5 +- deprecations/pending-removal-in-3.14.po | 34 +- deprecations/pending-removal-in-3.15.po | 95 +- deprecations/pending-removal-in-3.16.po | 129 +- deprecations/pending-removal-in-3.17.po | 36 + deprecations/pending-removal-in-3.19.po | 33 + deprecations/pending-removal-in-future.po | 302 +- extending/building.po | 151 +- extending/extending.po | 877 ++- extending/newtypes.po | 478 +- extending/newtypes_tutorial.po | 697 +- extending/windows.po | 104 +- faq/design.po | 7 +- faq/general.po | 48 +- faq/library.po | 100 +- faq/programming.po | 259 +- glossary.po | 1875 ++--- howto/annotations.po | 223 +- howto/descriptor.po | 263 +- howto/enum.po | 223 +- howto/free-threading-extensions.po | 416 +- howto/free-threading-python.po | 162 +- howto/index.po | 61 +- howto/logging-cookbook.po | 1162 ++-- howto/logging.po | 272 +- howto/regex.po | 475 +- howto/remote_debugging.po | 850 +++ howto/sockets.po | 22 +- howto/sorting.po | 291 +- library/__future__.po | 105 +- library/__main__.po | 87 +- library/_thread.po | 108 +- library/annotationlib.po | 949 +++ library/archiving.po | 9 +- library/argparse.po | 1244 ++-- library/ast.po | 1240 ++-- library/asyncio-dev.po | 173 +- library/asyncio-eventloop.po | 1536 +++-- library/asyncio-future.po | 211 +- library/asyncio-graph.po | 202 + library/asyncio-llapi-index.po | 79 +- library/asyncio-platforms.po | 87 +- library/asyncio-policy.po | 347 +- library/asyncio-queue.po | 111 +- library/asyncio-runner.po | 99 +- library/asyncio-subprocess.po | 91 +- library/asyncio-task.po | 780 ++- library/asyncio.po | 18 +- library/audit_events.po | 28 +- library/bdb.po | 317 +- library/bisect.po | 32 +- library/calendar.po | 183 +- library/cmath.po | 25 +- library/cmdline.po | 134 +- library/code.po | 100 +- library/codecs.po | 1388 ++-- library/collections.abc.po | 294 +- library/collections.po | 11 +- library/compression.po | 53 + library/compression.zstd.po | 1155 ++++ library/concurrency.po | 4 +- library/concurrent.futures.po | 661 +- library/concurrent.interpreters.po | 525 ++ library/concurrent.po | 14 +- library/configparser.po | 117 +- library/constants.po | 103 +- library/contextvars.po | 158 +- library/csv.po | 362 +- library/ctypes.po | 1747 +++-- library/curses.po | 1131 +-- library/dataclasses.po | 608 +- library/datetime.po | 1714 ++--- library/dbm.po | 349 +- library/decimal.po | 908 +-- library/dis.po | 999 +-- library/doctest.po | 1054 +-- library/email.utils.po | 147 +- library/enum.po | 665 +- library/errno.po | 154 +- library/exceptions.po | 783 ++- library/faulthandler.po | 243 +- library/fcntl.po | 156 +- library/fnmatch.po | 32 +- library/fractions.po | 179 +- library/functions.po | 1516 ++-- library/functools.po | 432 +- library/gc.po | 320 +- library/getopt.po | 150 +- library/getpass.po | 27 +- library/graphlib.po | 170 +- library/gzip.po | 129 +- library/heapq.po | 241 +- library/http.cookies.po | 137 +- library/http.server.po | 367 +- library/imaplib.po | 398 +- library/importlib.metadata.po | 200 +- library/importlib.po | 802 +-- library/importlib.resources.po | 159 +- library/inspect.po | 1084 +-- library/io.po | 1054 +-- library/ipaddress.po | 408 +- library/itertools.po | 107 +- library/json.po | 231 +- library/linecache.po | 23 +- library/locale.po | 370 +- library/logging.handlers.po | 582 +- library/logging.po | 307 +- library/marshal.po | 224 +- library/math.po | 85 +- library/mimetypes.po | 267 +- library/multiprocessing.po | 1935 +++--- library/numbers.po | 141 +- library/operator.po | 381 +- library/os.po | 3423 ++++----- library/pathlib.po | 1285 ++-- library/pdb.po | 468 +- library/pickle.po | 481 +- library/pickletools.po | 35 +- library/pkgutil.po | 253 +- library/platform.po | 61 +- library/pyexpat.po | 180 +- library/python.po | 8 +- library/queue.po | 173 +- library/re.po | 804 +-- library/readline.po | 135 +- library/select.po | 398 +- library/shutil.po | 556 +- library/site.po | 270 +- library/socket.po | 1323 ++-- library/socketserver.po | 284 +- library/sqlite3.po | 1170 ++-- library/ssl.po | 1609 ++--- library/stdtypes.po | 4691 +++++++------ library/string.po | 500 +- library/string.templatelib.po | 318 + library/struct.po | 209 +- library/subprocess.po | 654 +- library/symtable.po | 136 +- library/sys.monitoring.po | 457 +- library/sys.po | 1517 ++-- library/sys_path_init.po | 124 +- library/tarfile.po | 1072 +-- library/test.po | 869 +-- library/threading.po | 679 +- library/token.po | 108 +- library/tomllib.po | 134 +- library/traceback.po | 390 +- library/turtle.po | 1358 ++-- library/types.po | 137 +- library/typing.po | 1991 +++--- library/unicodedata.po | 302 +- library/unittest.mock.po | 1208 ++-- library/unittest.po | 1762 ++--- library/urllib.parse.po | 306 +- library/urllib.request.po | 1186 ++-- library/uuid.po | 362 +- library/venv.po | 412 +- library/warnings.po | 447 +- library/webbrowser.po | 188 +- library/winsound.po | 66 +- library/zipfile.po | 750 +- library/zlib.po | 124 +- license.po | 83 +- reference/compound_stmts.po | 1364 ++-- reference/datamodel.po | 3006 ++++---- reference/executionmodel.po | 211 +- reference/expressions.po | 1672 ++--- reference/grammar.po | 389 +- reference/import.po | 514 +- reference/introduction.po | 223 +- reference/lexical_analysis.po | 1917 ++++-- reference/simple_stmts.po | 570 +- reference/toplevel_components.po | 38 +- tutorial/classes.po | 199 +- tutorial/controlflow.po | 468 +- tutorial/datastructures.po | 118 +- tutorial/errors.po | 66 +- tutorial/inputoutput.po | 204 +- tutorial/interpreter.po | 14 +- tutorial/introduction.po | 37 +- tutorial/stdlib.po | 5 +- tutorial/stdlib2.po | 5 +- using/cmdline.po | 890 +-- using/configure.po | 1064 +-- using/ios.po | 137 +- using/mac.po | 115 +- using/windows.po | 3682 ++++++---- whatsnew/2.0.po | 208 +- whatsnew/2.6.po | 850 +-- whatsnew/3.0.po | 8 +- whatsnew/3.1.po | 5 +- whatsnew/3.10.po | 1468 ++-- whatsnew/3.11.po | 1529 ++-- whatsnew/3.12.po | 2747 ++++---- whatsnew/3.13.po | 3782 +++++----- whatsnew/3.14.po | 6127 +++++++++++++++++ whatsnew/3.3.po | 894 ++- whatsnew/3.5.po | 1010 +-- whatsnew/3.6.po | 871 +-- whatsnew/3.8.po | 831 +-- whatsnew/3.9.po | 871 +-- whatsnew/index.po | 4 +- 249 files changed, 81941 insertions(+), 56312 deletions(-) create mode 100644 c-api/extension-modules.po create mode 100644 c-api/lifecycle.po create mode 100644 deprecations/c-api-pending-removal-in-3.18.po create mode 100644 deprecations/pending-removal-in-3.17.po create mode 100644 deprecations/pending-removal-in-3.19.po create mode 100644 howto/remote_debugging.po create mode 100644 library/annotationlib.po create mode 100644 library/asyncio-graph.po create mode 100644 library/compression.po create mode 100644 library/compression.zstd.po create mode 100644 library/concurrent.interpreters.po create mode 100644 library/string.templatelib.po create mode 100644 whatsnew/3.14.po diff --git a/bugs.po b/bugs.po index 2837ebfc0a4..669b63a6744 100644 --- a/bugs.po +++ b/bugs.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-18 19:45+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-08-31 12:34+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,8 +41,8 @@ msgstr "" #: ../../bugs.rst:11 msgid "" "It can be sometimes faster to fix bugs yourself and contribute patches to " -"Python as it streamlines the process and involves less people. Learn how to :" -"ref:`contribute `." +"Python as it streamlines the process and involves less people. Learn how " +"to :ref:`contribute `." msgstr "" "有時候自己直接修復錯誤並且送出一個修正給 Python 會比較快,因為這樣會加速流程" "而且不會困擾到太多人。學習如何\\ :ref:`貢獻給 Python `. If you have a suggestion on how to fix it, include that as well." +"improvement, please submit a bug report on the :ref:`issue tracker `. If you have a suggestion on how to fix it, include that as " +"well." msgstr "" -"如果你在這份說明文件中發現了錯誤並想要幫助我們改進,請將錯誤報告提交到\\ :" -"ref:`追蹤系統 (tracker) `。如果你有相應的修正建議,請一併" -"提交。(譯者註:如果是繁體中文說明文件翻譯相關的錯誤,請提交到 https://" +"如果你在這份說明文件中發現了錯誤並想要幫助我們改進,請將錯誤報告提交到" +"\\ :ref:`追蹤系統 (tracker) `。如果你有相應的修正建議,請" +"一併提交。(譯者註:如果是繁體中文說明文件翻譯相關的錯誤,請提交到 https://" "github.com/python/python-docs-zh-tw/issues。)" #: ../../bugs.rst:22 @@ -74,41 +76,30 @@ msgstr "" #: ../../bugs.rst:25 msgid "" "If you find a bug in the theme (HTML / CSS / JavaScript) of the " -"documentation, please submit a bug report on the `python-doc-theme bug " +"documentation, please submit a bug report on the `python-doc-theme issue " "tracker `_." msgstr "" -#: ../../bugs.rst:29 -msgid "" -"If you're short on time, you can also email documentation bug reports to " -"docs@python.org (behavioral bugs can be sent to python-list@python.org). " -"'docs@' is a mailing list run by volunteers; your request will be noticed, " -"though it may take a while to be processed." -msgstr "" -"如果你的時間有限,也可以將說明文件的錯誤報告以電子郵件寄到 docs@python.org\\ " -"(程式碼執行的錯誤可以寄到 python-list@python.org)。「docs@」是一個由志工們" -"所運行的郵寄清單;你的請求會被注意到,但可能需要一些時間才會被處理。" - -#: ../../bugs.rst:36 +#: ../../bugs.rst:31 msgid "`Documentation bugs`_" msgstr "`說明文件錯誤`_" -#: ../../bugs.rst:37 +#: ../../bugs.rst:32 msgid "" "A list of documentation bugs that have been submitted to the Python issue " "tracker." msgstr "一系列已被提交至 Python 問題追蹤系統的有關說明文件的錯誤。" -#: ../../bugs.rst:39 +#: ../../bugs.rst:34 msgid "`Issue Tracking `_" msgstr "`問題追蹤系統 `_" -#: ../../bugs.rst:40 +#: ../../bugs.rst:35 msgid "" "Overview of the process involved in reporting an improvement on the tracker." msgstr "在追蹤系統上回報改進建議的過程簡介。" -#: ../../bugs.rst:42 +#: ../../bugs.rst:37 msgid "" "`Helping with Documentation `_" @@ -116,20 +107,20 @@ msgstr "" "`貢獻說明文件 `_" -#: ../../bugs.rst:43 +#: ../../bugs.rst:38 msgid "" "Comprehensive guide for individuals that are interested in contributing to " "Python documentation." msgstr "給有意成為 Python 說明文件貢獻者的綜合指南。" -#: ../../bugs.rst:45 +#: ../../bugs.rst:40 msgid "" "`Documentation Translations `_" msgstr "" "`說明文件翻譯 `_" -#: ../../bugs.rst:46 +#: ../../bugs.rst:41 msgid "" "A list of GitHub pages for documentation translation and their primary " "contacts." @@ -137,11 +128,11 @@ msgstr "" "一份 GitHub 網頁的清單,裡面有各個說明文件翻譯團隊的連結,以及他們的主要聯絡" "人。" -#: ../../bugs.rst:52 +#: ../../bugs.rst:47 msgid "Using the Python issue tracker" msgstr "使用 Python 問題追蹤系統" -#: ../../bugs.rst:54 +#: ../../bugs.rst:49 msgid "" "Issue reports for Python itself should be submitted via the GitHub issues " "tracker (https://github.com/python/cpython/issues). The GitHub issues " @@ -152,7 +143,7 @@ msgstr "" "python/cpython/issues) 提交。這個 GitHub 問題追蹤系統提供了一個網頁表單,可以" "輸入並提交相關資訊給開發者。" -#: ../../bugs.rst:59 +#: ../../bugs.rst:54 msgid "" "The first step in filing a report is to determine whether the problem has " "already been reported. The advantage in doing so, aside from saving the " @@ -167,7 +158,7 @@ msgstr "" "本中修正了這個問題,也有可能需要更詳細的資訊(在這種情況下,如果可以,非常歡" "迎你提供資訊!)。要確認是否重複回報,請使用頁面頂端的搜尋框來搜尋追蹤系統。" -#: ../../bugs.rst:66 +#: ../../bugs.rst:61 msgid "" "If the problem you're reporting is not already in the list, log in to " "GitHub. If you don't already have a GitHub account, create a new account " @@ -177,7 +168,7 @@ msgstr "" "如果你想回報的問題還沒有在問題列表出現過,請登入 GitHub。如果你還沒有 GitHub " "帳戶,請點選「Sign up」連結來建立一個新的帳戶。你無法以匿名方式提交錯誤報告。" -#: ../../bugs.rst:71 +#: ../../bugs.rst:66 msgid "" "Being now logged in, you can submit an issue. Click on the \"New issue\" " "button in the top bar to report a new issue." @@ -185,18 +176,18 @@ msgstr "" "如果已經登入,那你就可以提交問題了。請點選列表頂端區域的「New issue」按鈕,來" "回報一個新的問題。" -#: ../../bugs.rst:74 +#: ../../bugs.rst:69 msgid "The submission form has two fields, \"Title\" and \"Comment\"." msgstr "提交的表單中有兩個欄位,「Title」及「Comment」。" -#: ../../bugs.rst:76 +#: ../../bugs.rst:71 msgid "" "For the \"Title\" field, enter a *very* short description of the problem; " "fewer than ten words is good." msgstr "" "在「Title」欄位,輸入對該問題\\ *非常*\\ 簡短的描述;最好少於十個單字。" -#: ../../bugs.rst:79 +#: ../../bugs.rst:74 msgid "" "In the \"Comment\" field, describe the problem in detail, including what you " "expected to happen and what did happen. Be sure to include whether any " @@ -207,7 +198,7 @@ msgstr "" "確定說明中包含了涉及到的任何擴充模組,以及你當時所使用的硬體和軟體平台(視情" "況而定,可以附上版本資訊)。" -#: ../../bugs.rst:84 +#: ../../bugs.rst:79 msgid "" "Each issue report will be reviewed by a developer who will determine what " "needs to be done to correct the problem. You will receive an update each " @@ -216,15 +207,15 @@ msgstr "" "每一份問題報告都會被一位開發人員查核,並由他決定要做出什麼變更來修正這個問" "題。每當該問題有修正動作時,你會收到更新回報。" -#: ../../bugs.rst:91 +#: ../../bugs.rst:86 msgid "" "`How to Report Bugs Effectively `_" msgstr "" -"`如何有效地回報錯誤 `_" +"`如何有效地回報錯誤 `_" -#: ../../bugs.rst:92 +#: ../../bugs.rst:87 msgid "" "Article which goes into some detail about how to create a useful bug report. " "This describes what kind of information is useful and why it is useful." @@ -232,14 +223,14 @@ msgstr "" "這篇文章詳細說明如何建立一份有用的錯誤報告。它描述了什麼樣的資訊是有用的,以" "及這些資訊為什麼有用。" -#: ../../bugs.rst:95 +#: ../../bugs.rst:90 msgid "" "`Bug Writing Guidelines `_" msgstr "" "`錯誤撰寫指南 `_" -#: ../../bugs.rst:96 +#: ../../bugs.rst:91 msgid "" "Information about writing a good bug report. Some of this is specific to " "the Mozilla project, but describes general good practices." @@ -247,11 +238,11 @@ msgstr "" "撰寫一份優良錯誤報告的相關資訊。部分的文章內容是針對 Mozilla 專案,但它也描述" "了通用的好習慣。" -#: ../../bugs.rst:102 +#: ../../bugs.rst:97 msgid "Getting started contributing to Python yourself" msgstr "開始讓自己貢獻 Python" -#: ../../bugs.rst:104 +#: ../../bugs.rst:99 msgid "" "Beyond just reporting bugs that you find, you are also welcome to submit " "patches to fix them. You can find more information on how to get started " @@ -263,3 +254,14 @@ msgstr "" "你可以在 `Python 開發者指南`_\\ 中找到如何開始修補 Python 的更多資訊。如果你" "有任何問題,`核心導師郵寄清單`_\\ 是一個友善的地方,你可以在那裡得到,關於 " "Python 修正錯誤的過程中,所有問題的答案。" + +#~ msgid "" +#~ "If you're short on time, you can also email documentation bug reports to " +#~ "docs@python.org (behavioral bugs can be sent to python-list@python.org). " +#~ "'docs@' is a mailing list run by volunteers; your request will be " +#~ "noticed, though it may take a while to be processed." +#~ msgstr "" +#~ "如果你的時間有限,也可以將說明文件的錯誤報告以電子郵件寄到 " +#~ "docs@python.org\\ (程式碼執行的錯誤可以寄到 python-list@python.org)。" +#~ "「docs@」是一個由志工們所運行的郵寄清單;你的請求會被注意到,但可能需要一" +#~ "些時間才會被處理。" diff --git a/c-api/allocation.po b/c-api/allocation.po index d1b75248593..8eb4ca8b495 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -9,7 +9,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-09-08 15:25+0800\n" "PO-Revision-Date: 2022-10-16 15:35+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,84 +29,178 @@ msgstr "在 heap 上分配物件" msgid "" "Initialize a newly allocated object *op* with its type and initial " "reference. Returns the initialized object. Other fields of the object are " -"not affected." +"not initialized. Despite its name, this function is unrelated to the " +"object's :meth:`~object.__init__` method (:c:member:`~PyTypeObject.tp_init` " +"slot). Specifically, this function does **not** call the object's :meth:`!" +"__init__` method." msgstr "" -"用它的型別和初始參照來初始化新分配物件 *op*。已初始化的物件會被回傳。物件的其" -"他欄位不受影響。" #: ../../c-api/allocation.rst:24 msgid "" +"In general, consider this function to be a low-level routine. " +"Use :c:member:`~PyTypeObject.tp_alloc` where possible. For " +"implementing :c:member:`!tp_alloc` for your type, " +"prefer :c:func:`PyType_GenericAlloc` or :c:func:`PyObject_New`." +msgstr "" + +#: ../../c-api/allocation.rst:31 +msgid "" +"This function only initializes the object's memory corresponding to the " +"initial :c:type:`PyObject` structure. It does not zero the rest." +msgstr "" + +#: ../../c-api/allocation.rst:37 +msgid "" "This does everything :c:func:`PyObject_Init` does, and also initializes the " "length information for a variable-size object." msgstr "" "它會做到 :c:func:`PyObject_Init` 的所有功能,並且會初始化一個大小可變物件的長" "度資訊。" -#: ../../c-api/allocation.rst:30 +#: ../../c-api/allocation.rst:42 msgid "" -"Allocate a new Python object using the C structure type *TYPE* and the " -"Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the " -"Python object header are not initialized. The caller will own the only " -"reference to the object (i.e. its reference count will be one). The size of " -"the memory allocation is determined from the :c:member:`~PyTypeObject." -"tp_basicsize` field of the type object." +"This function only initializes some of the object's memory. It does not " +"zero the rest." +msgstr "" + +#: ../../c-api/allocation.rst:48 +#, fuzzy +msgid "" +"Allocates a new Python object using the C structure type *TYPE* and the " +"Python type object *typeobj* (``PyTypeObject*``) by " +"calling :c:func:`PyObject_Malloc` to allocate memory and initializing it " +"like :c:func:`PyObject_Init`. The caller will own the only reference to the " +"object (i.e. its reference count will be one)." msgstr "" "使用 C 結構型別 *TYPE* 和 Python 型別物件 *typeobj* (``PyTypeObject*``) 分配" "一個新的 Python 物件。未在該 Python 物件標頭 (header) 中定義的欄位不會被初始" "化;呼叫者會擁有那個對於物件的唯一參照(物件的參照計數為一)。記憶體分配大小" "由 type 物件的 :c:member:`~PyTypeObject.tp_basicsize` 欄位來指定。" -#: ../../c-api/allocation.rst:38 +#: ../../c-api/allocation.rst:54 ../../c-api/allocation.rst:107 +msgid "" +"Avoid calling this directly to allocate memory for an object; call the " +"type's :c:member:`~PyTypeObject.tp_alloc` slot instead." +msgstr "" + +#: ../../c-api/allocation.rst:57 ../../c-api/allocation.rst:110 +msgid "" +"When populating a type's :c:member:`~PyTypeObject.tp_alloc` " +"slot, :c:func:`PyType_GenericAlloc` is preferred over a custom function that " +"simply calls this macro." +msgstr "" + +#: ../../c-api/allocation.rst:61 msgid "" -"Note that this function is unsuitable if *typeobj* has :c:macro:" -"`Py_TPFLAGS_HAVE_GC` set. For such objects, use :c:func:`PyObject_GC_New` " +"This macro does not " +"call :c:member:`~PyTypeObject.tp_alloc`, :c:member:`~PyTypeObject.tp_new` " +"(:meth:`~object.__new__`), or :c:member:`~PyTypeObject.tp_init` " +"(:meth:`~object.__init__`)." +msgstr "" + +#: ../../c-api/allocation.rst:65 +#, fuzzy +msgid "" +"This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set " +"in :c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_New` " "instead." msgstr "" "注意,如果 *typeobj* 有 :c:macro:`Py_TPFLAGS_HAVE_GC` 設定,則此函式不適用。" "對於這種物件,請改用 :c:func:`PyObject_GC_New`。" -#: ../../c-api/allocation.rst:45 -msgid "" -"Allocate a new Python object using the C structure type *TYPE* and the " -"Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the " -"Python object header are not initialized. The allocated memory allows for " -"the *TYPE* structure plus *size* (``Py_ssize_t``) fields of the size given " -"by the :c:member:`~PyTypeObject.tp_itemsize` field of *typeobj*. This is " -"useful for implementing objects like tuples, which are able to determine " -"their size at construction time. Embedding the array of fields into the " -"same allocation decreases the number of allocations, improving the memory " -"management efficiency." -msgstr "" -"使用 C 的結構型別 *TYPE* 和 Python 的型別物件 *typeobj* (``PyTypeObject*``) " -"分配一個新的 Python 物件。未在該 Python 物件標頭中定義的欄位不會被初始化。記" -"憶體空間預留了 *TYPE* 結構大小再加上 *typeobj* 物件中 :c:member:" -"`~PyTypeObject.tp_itemsize` 欄位提供的 *size* (``Py_ssize_t``) 欄位的值。這對" -"於實現如 tuple 這種能夠在建立期間決定自己大小的物件是很實用的。將欄位的陣列嵌" -"入到相同的記憶體分配中可以減少記憶體分配的次數,這提高了記憶體管理的效率。" - -#: ../../c-api/allocation.rst:56 -msgid "" -"Note that this function is unsuitable if *typeobj* has :c:macro:" -"`Py_TPFLAGS_HAVE_GC` set. For such objects, use :c:func:`PyObject_GC_NewVar` " +#: ../../c-api/allocation.rst:68 +msgid "" +"Memory allocated by this macro must be freed with :c:func:`PyObject_Free` " +"(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." +msgstr "" + +#: ../../c-api/allocation.rst:73 ../../c-api/allocation.rst:123 +msgid "" +"The returned memory is not guaranteed to have been completely zeroed before " +"it was initialized." +msgstr "" + +#: ../../c-api/allocation.rst:78 ../../c-api/allocation.rst:128 +msgid "" +"This macro does not construct a fully initialized object of the given type; " +"it merely allocates memory and prepares it for further initialization " +"by :c:member:`~PyTypeObject.tp_init`. To construct a fully initialized " +"object, call *typeobj* instead. For example::" +msgstr "" + +#: ../../c-api/allocation.rst:83 +msgid "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);" +msgstr "" + +#: ../../c-api/allocation.rst:87 ../../c-api/allocation.rst:137 +msgid ":c:func:`PyObject_Free`" +msgstr "" + +#: ../../c-api/allocation.rst:88 +msgid ":c:macro:`PyObject_GC_New`" +msgstr "" + +#: ../../c-api/allocation.rst:89 ../../c-api/allocation.rst:139 +msgid ":c:func:`PyType_GenericAlloc`" +msgstr "" + +#: ../../c-api/allocation.rst:90 ../../c-api/allocation.rst:140 +msgid ":c:member:`~PyTypeObject.tp_alloc`" +msgstr "" + +#: ../../c-api/allocation.rst:95 +msgid "Like :c:macro:`PyObject_New` except:" +msgstr "" + +#: ../../c-api/allocation.rst:97 +msgid "" +"It allocates enough memory for the *TYPE* structure plus *size* " +"(``Py_ssize_t``) fields of the size given by " +"the :c:member:`~PyTypeObject.tp_itemsize` field of *typeobj*." +msgstr "" + +#: ../../c-api/allocation.rst:100 +msgid "The memory is initialized like :c:func:`PyObject_InitVar`." +msgstr "" + +#: ../../c-api/allocation.rst:102 +msgid "" +"This is useful for implementing objects like tuples, which are able to " +"determine their size at construction time. Embedding the array of fields " +"into the same allocation decreases the number of allocations, improving the " +"memory management efficiency." +msgstr "" + +#: ../../c-api/allocation.rst:114 +#, fuzzy +msgid "" +"This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set " +"in :c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_NewVar` " "instead." msgstr "" "注意,如果 *typeobj* 有 :c:macro:`Py_TPFLAGS_HAVE_GC` 設定,則此函式不適用。" "對於這種物件,請改用 :c:func:`PyObject_GC_NewVar`。" -#: ../../c-api/allocation.rst:63 +#: ../../c-api/allocation.rst:118 +msgid "" +"Memory allocated by this function must be freed with :c:func:`PyObject_Free` " +"(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." +msgstr "" + +#: ../../c-api/allocation.rst:133 msgid "" -"Releases memory allocated to an object using :c:macro:`PyObject_New` or :c:" -"macro:`PyObject_NewVar`. This is normally called from the :c:member:" -"`~PyTypeObject.tp_dealloc` handler specified in the object's type. The " -"fields of the object should not be accessed after this call as the memory is " -"no longer a valid Python object." +"PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);" msgstr "" -"釋放由 :c:macro:`PyObject_New` 或者 :c:macro:`PyObject_NewVar` 分配給物件的記" -"憶體。這通常是在物件型別所指定的 :c:member:`~PyTypeObject.tp_dealloc` " -"handler 中呼叫。呼叫這個函式以後,物件的各欄位都不可以被存取,因為原本分配的" -"記憶體已不再是一個有效的 Python 物件。" -#: ../../c-api/allocation.rst:72 +#: ../../c-api/allocation.rst:138 +msgid ":c:macro:`PyObject_GC_NewVar`" +msgstr "" + +#: ../../c-api/allocation.rst:145 +msgid "Same as :c:func:`PyObject_Free`." +msgstr "" + +#: ../../c-api/allocation.rst:149 msgid "" "Object which is visible in Python as ``None``. This should only be accessed " "using the :c:macro:`Py_None` macro, which evaluates to a pointer to this " @@ -115,10 +209,49 @@ msgstr "" "這個物件像是 Python 中的 ``None``。它只應該透過 :c:macro:`Py_None` 巨集來存" "取,該巨集的拿到指向該物件的指標。" -#: ../../c-api/allocation.rst:79 +#: ../../c-api/allocation.rst:156 msgid ":ref:`moduleobjects`" msgstr ":ref:`moduleobjects`" -#: ../../c-api/allocation.rst:80 +#: ../../c-api/allocation.rst:157 msgid "To allocate and create extension modules." msgstr "分配記憶體和建立擴充模組。" + +#~ msgid "" +#~ "Initialize a newly allocated object *op* with its type and initial " +#~ "reference. Returns the initialized object. Other fields of the object " +#~ "are not affected." +#~ msgstr "" +#~ "用它的型別和初始參照來初始化新分配物件 *op*。已初始化的物件會被回傳。物件" +#~ "的其他欄位不受影響。" + +#~ msgid "" +#~ "Allocate a new Python object using the C structure type *TYPE* and the " +#~ "Python type object *typeobj* (``PyTypeObject*``). Fields not defined by " +#~ "the Python object header are not initialized. The allocated memory " +#~ "allows for the *TYPE* structure plus *size* (``Py_ssize_t``) fields of " +#~ "the size given by the :c:member:`~PyTypeObject.tp_itemsize` field of " +#~ "*typeobj*. This is useful for implementing objects like tuples, which " +#~ "are able to determine their size at construction time. Embedding the " +#~ "array of fields into the same allocation decreases the number of " +#~ "allocations, improving the memory management efficiency." +#~ msgstr "" +#~ "使用 C 的結構型別 *TYPE* 和 Python 的型別物件 *typeobj* " +#~ "(``PyTypeObject*``) 分配一個新的 Python 物件。未在該 Python 物件標頭中定義" +#~ "的欄位不會被初始化。記憶體空間預留了 *TYPE* 結構大小再加上 *typeobj* 物件" +#~ "中 :c:member:`~PyTypeObject.tp_itemsize` 欄位提供的 *size* " +#~ "(``Py_ssize_t``) 欄位的值。這對於實現如 tuple 這種能夠在建立期間決定自己大" +#~ "小的物件是很實用的。將欄位的陣列嵌入到相同的記憶體分配中可以減少記憶體分配" +#~ "的次數,這提高了記憶體管理的效率。" + +#~ msgid "" +#~ "Releases memory allocated to an object using :c:macro:`PyObject_New` " +#~ "or :c:macro:`PyObject_NewVar`. This is normally called from " +#~ "the :c:member:`~PyTypeObject.tp_dealloc` handler specified in the " +#~ "object's type. The fields of the object should not be accessed after " +#~ "this call as the memory is no longer a valid Python object." +#~ msgstr "" +#~ "釋放由 :c:macro:`PyObject_New` 或者 :c:macro:`PyObject_NewVar` 分配給物件" +#~ "的記憶體。這通常是在物件型別所指定的 :c:member:`~PyTypeObject.tp_dealloc` " +#~ "handler 中呼叫。呼叫這個函式以後,物件的各欄位都不可以被存取,因為原本分配" +#~ "的記憶體已不再是一個有效的 Python 物件。" diff --git a/c-api/apiabiversion.po b/c-api/apiabiversion.po index 8b589303e89..5155b4fb0dd 100644 --- a/c-api/apiabiversion.po +++ b/c-api/apiabiversion.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-29 00:03+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-01-24 22:34+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,33 +24,38 @@ msgstr "" msgid "API and ABI Versioning" msgstr "API 和 ABI 版本管理" -#: ../../c-api/apiabiversion.rst:9 +#: ../../c-api/apiabiversion.rst:11 +msgid "Build-time version constants" +msgstr "" + +#: ../../c-api/apiabiversion.rst:13 +#, fuzzy msgid "" "CPython exposes its version number in the following macros. Note that these " -"correspond to the version code is **built** with, not necessarily the " -"version used at **run time**." +"correspond to the version code is **built** with. See :c:var:`Py_Version` " +"for the version used at **run time**." msgstr "" "CPython 透過以下巨集 (macro) 公開其版本號。請注意,對應到的是\\ **建置 " "(built)** 所用到的版本,並不一定是\\ **執行環境 (run time)** 所使用的版本。" -#: ../../c-api/apiabiversion.rst:13 +#: ../../c-api/apiabiversion.rst:17 msgid "" "See :ref:`stable` for a discussion of API and ABI stability across versions." msgstr "關於跨版本 API 和 ABI 穩定性的討論,請見 :ref:`stable`。" -#: ../../c-api/apiabiversion.rst:17 +#: ../../c-api/apiabiversion.rst:21 msgid "The ``3`` in ``3.4.1a2``." msgstr "在 ``3.4.1a2`` 中的 ``3``。" -#: ../../c-api/apiabiversion.rst:21 +#: ../../c-api/apiabiversion.rst:25 msgid "The ``4`` in ``3.4.1a2``." msgstr "在 ``3.4.1a2`` 中的 ``4``。" -#: ../../c-api/apiabiversion.rst:25 +#: ../../c-api/apiabiversion.rst:29 msgid "The ``1`` in ``3.4.1a2``." msgstr "在 ``3.4.1a2`` 中的 ``1``。" -#: ../../c-api/apiabiversion.rst:29 +#: ../../c-api/apiabiversion.rst:33 msgid "" "The ``a`` in ``3.4.1a2``. This can be ``0xA`` for alpha, ``0xB`` for beta, " "``0xC`` for release candidate or ``0xF`` for final." @@ -58,137 +63,311 @@ msgstr "" "在 ``3.4.1a2`` 中的 ``a``。``0xA`` 代表 alpha 版本、``0xB`` 代表 beta 版本、" "``0xC`` 為發布候選版本、``0xF`` 則為最終版。" -#: ../../c-api/apiabiversion.rst:35 +#: ../../c-api/apiabiversion.rst:39 msgid "The ``2`` in ``3.4.1a2``. Zero for final releases." msgstr "在 ``3.4.1a2`` 中的 ``2``。零則為最終發布版本。" -#: ../../c-api/apiabiversion.rst:39 -msgid "The Python version number encoded in a single integer." +#: ../../c-api/apiabiversion.rst:43 +#, fuzzy +msgid "" +"The Python version number encoded in a single integer. " +"See :c:func:`Py_PACK_FULL_VERSION` for the encoding details." msgstr "被編碼為單一整數的 Python 版本號。" -#: ../../c-api/apiabiversion.rst:41 +#: ../../c-api/apiabiversion.rst:46 +#, fuzzy +msgid "" +"Use this for numeric comparisons, for example, ``#if PY_VERSION_HEX >= ...``." +msgstr "使用它進行數值比較,例如 ``#if PY_VERSION_HEX >= ...``。" + +#: ../../c-api/apiabiversion.rst:51 +msgid "Run-time version" +msgstr "" + +#: ../../c-api/apiabiversion.rst:55 +#, fuzzy +msgid "" +"The Python runtime version number encoded in a single constant integer. " +"See :c:func:`Py_PACK_FULL_VERSION` for the encoding details. This contains " +"the Python version used at run time." +msgstr "" +"編碼為單個常數整數的 Python 執行環境版本號,格式與 :c:macro:`PY_VERSION_HEX` " +"巨集相同。這包含在執行環境使用的 Python 版本。" + +#: ../../c-api/apiabiversion.rst:59 +#, fuzzy +msgid "" +"Use this for numeric comparisons, for example, ``if (Py_Version >= ...)``." +msgstr "使用它進行數值比較,例如 ``#if PY_VERSION_HEX >= ...``。" + +#: ../../c-api/apiabiversion.rst:65 +msgid "Bit-packing macros" +msgstr "" + +#: ../../c-api/apiabiversion.rst:69 msgid "" -"The underlying version information can be found by treating it as a 32 bit " -"number in the following manner:" -msgstr "所代表的版本資訊可以用以下規則將其看做是一個 32 位元數字來獲得:" +"Return the given version, encoded as a single 32-bit integer with the " +"following structure:" +msgstr "" -#: ../../c-api/apiabiversion.rst:45 -msgid "Bytes" -msgstr "位元組串" +#: ../../c-api/apiabiversion.rst:75 +msgid "Argument" +msgstr "" -#: ../../c-api/apiabiversion.rst:45 -msgid "Bits (big endian order)" -msgstr "位元(大端位元組序 (big endian order))" +#: ../../c-api/apiabiversion.rst:73 +msgid "No. of bits" +msgstr "" -#: ../../c-api/apiabiversion.rst:45 -msgid "Meaning" -msgstr "意義" +#: ../../c-api/apiabiversion.rst:75 +msgid "Bit mask" +msgstr "" -#: ../../c-api/apiabiversion.rst:45 -msgid "Value for ``3.4.1a2``" +#: ../../c-api/apiabiversion.rst:75 +msgid "Bit shift" +msgstr "" + +#: ../../c-api/apiabiversion.rst:73 +msgid "Example values" +msgstr "" + +#: ../../c-api/apiabiversion.rst:75 ../../c-api/apiabiversion.rst:93 +#, fuzzy +msgid "``3.4.1a2``" msgstr "``3.4.1a2`` 中的值" -#: ../../c-api/apiabiversion.rst:47 -msgid "1" -msgstr "1" +#: ../../c-api/apiabiversion.rst:75 ../../c-api/apiabiversion.rst:95 +msgid "``3.10.0``" +msgstr "" + +#: ../../c-api/apiabiversion.rst:77 +msgid "*major*" +msgstr "" + +#: ../../c-api/apiabiversion.rst:77 ../../c-api/apiabiversion.rst:79 +#: ../../c-api/apiabiversion.rst:81 +msgid "8" +msgstr "" -#: ../../c-api/apiabiversion.rst:47 -msgid "1-8" -msgstr "1-8" +#: ../../c-api/apiabiversion.rst:77 +#, fuzzy +msgid "``0xFF000000``" +msgstr "``0x03``" -#: ../../c-api/apiabiversion.rst:47 -msgid "``PY_MAJOR_VERSION``" -msgstr "``PY_MAJOR_VERSION``" +#: ../../c-api/apiabiversion.rst:77 +#, fuzzy +msgid "24" +msgstr "2" -#: ../../c-api/apiabiversion.rst:47 +#: ../../c-api/apiabiversion.rst:77 msgid "``0x03``" msgstr "``0x03``" -#: ../../c-api/apiabiversion.rst:49 -msgid "2" -msgstr "2" +#: ../../c-api/apiabiversion.rst:79 +msgid "*minor*" +msgstr "" -#: ../../c-api/apiabiversion.rst:49 -msgid "9-16" -msgstr "9-16" +#: ../../c-api/apiabiversion.rst:79 +#, fuzzy +msgid "``0x00FF0000``" +msgstr "``0x03``" -#: ../../c-api/apiabiversion.rst:49 -msgid "``PY_MINOR_VERSION``" -msgstr "``PY_MINOR_VERSION``" +#: ../../c-api/apiabiversion.rst:79 +#, fuzzy +msgid "16" +msgstr "1" -#: ../../c-api/apiabiversion.rst:49 +#: ../../c-api/apiabiversion.rst:79 msgid "``0x04``" msgstr "``0x04``" -#: ../../c-api/apiabiversion.rst:51 -msgid "3" -msgstr "3" +#: ../../c-api/apiabiversion.rst:79 +#, fuzzy +msgid "``0x0A``" +msgstr "``0xA``" -#: ../../c-api/apiabiversion.rst:51 -msgid "17-24" -msgstr "17-24" +#: ../../c-api/apiabiversion.rst:81 +msgid "*micro*" +msgstr "" -#: ../../c-api/apiabiversion.rst:51 -msgid "``PY_MICRO_VERSION``" -msgstr "``PY_MICRO_VERSION``" +#: ../../c-api/apiabiversion.rst:81 +#, fuzzy +msgid "``0x0000FF00``" +msgstr "``0x03``" -#: ../../c-api/apiabiversion.rst:51 +#: ../../c-api/apiabiversion.rst:81 msgid "``0x01``" msgstr "``0x01``" -#: ../../c-api/apiabiversion.rst:53 +#: ../../c-api/apiabiversion.rst:81 +#, fuzzy +msgid "``0x00``" +msgstr "``0x03``" + +#: ../../c-api/apiabiversion.rst:83 +msgid "*release_level*" +msgstr "" + +#: ../../c-api/apiabiversion.rst:83 ../../c-api/apiabiversion.rst:85 msgid "4" msgstr "4" -#: ../../c-api/apiabiversion.rst:53 -msgid "25-28" -msgstr "25-28" - -#: ../../c-api/apiabiversion.rst:53 -msgid "``PY_RELEASE_LEVEL``" -msgstr "``PY_RELEASE_LEVEL``" +#: ../../c-api/apiabiversion.rst:83 +#, fuzzy +msgid "``0x000000F0``" +msgstr "``0x03``" -#: ../../c-api/apiabiversion.rst:53 +#: ../../c-api/apiabiversion.rst:83 msgid "``0xA``" msgstr "``0xA``" -#: ../../c-api/apiabiversion.rst:55 -msgid "29-32" -msgstr "29-32" +#: ../../c-api/apiabiversion.rst:83 +#, fuzzy +msgid "``0xF``" +msgstr "``0xA``" -#: ../../c-api/apiabiversion.rst:55 -msgid "``PY_RELEASE_SERIAL``" -msgstr "``PY_RELEASE_SERIAL``" +#: ../../c-api/apiabiversion.rst:85 +msgid "*release_serial*" +msgstr "" -#: ../../c-api/apiabiversion.rst:55 +#: ../../c-api/apiabiversion.rst:85 +#, fuzzy +msgid "``0x0000000F``" +msgstr "``0x03``" + +#: ../../c-api/apiabiversion.rst:85 +msgid "0" +msgstr "" + +#: ../../c-api/apiabiversion.rst:85 msgid "``0x2``" msgstr "``0x2``" -#: ../../c-api/apiabiversion.rst:58 +#: ../../c-api/apiabiversion.rst:85 +#, fuzzy +msgid "``0x0``" +msgstr "``0x03``" + +#: ../../c-api/apiabiversion.rst:88 +msgid "For example:" +msgstr "" + +#: ../../c-api/apiabiversion.rst:91 +msgid "Version" +msgstr "" + +#: ../../c-api/apiabiversion.rst:91 +msgid "``Py_PACK_FULL_VERSION`` arguments" +msgstr "" + +#: ../../c-api/apiabiversion.rst:91 +msgid "Encoded version" +msgstr "" + +#: ../../c-api/apiabiversion.rst:93 +msgid "``(3, 4, 1, 0xA, 2)``" +msgstr "" + +#: ../../c-api/apiabiversion.rst:93 +#, fuzzy +msgid "``0x030401a2``" +msgstr "``0x03``" + +#: ../../c-api/apiabiversion.rst:95 +msgid "``(3, 10, 0, 0xF, 0)``" +msgstr "" + +#: ../../c-api/apiabiversion.rst:95 +#, fuzzy +msgid "``0x030a00f0``" +msgstr "``0x03``" + +#: ../../c-api/apiabiversion.rst:98 msgid "" -"Thus ``3.4.1a2`` is hexversion ``0x030401a2`` and ``3.10.0`` is hexversion " -"``0x030a00f0``." +"Out-of range bits in the arguments are ignored. That is, the macro can be " +"defined as:" msgstr "" -"因此 ``3.4.1a2`` 代表 hexversion ``0x030401a2``、``3.10.0`` 代表 hexversion " -"``0x030a00f0``。" -#: ../../c-api/apiabiversion.rst:61 -msgid "Use this for numeric comparisons, e.g. ``#if PY_VERSION_HEX >= ...``." -msgstr "使用它進行數值比較,例如 ``#if PY_VERSION_HEX >= ...``。" +#: ../../c-api/apiabiversion.rst:101 +msgid "" +"#ifndef Py_PACK_FULL_VERSION\n" +"#define Py_PACK_FULL_VERSION(X, Y, Z, LEVEL, SERIAL) ( \\\n" +" (((X) & 0xff) << 24) | \\\n" +" (((Y) & 0xff) << 16) | \\\n" +" (((Z) & 0xff) << 8) | \\\n" +" (((LEVEL) & 0xf) << 4) | \\\n" +" (((SERIAL) & 0xf) << 0))\n" +"#endif" +msgstr "" -#: ../../c-api/apiabiversion.rst:63 -msgid "This version is also available via the symbol :c:var:`Py_Version`." -msgstr "該版本也可透過符號 :c:var:`Py_Version` 獲得。" +#: ../../c-api/apiabiversion.rst:112 +msgid "" +"``Py_PACK_FULL_VERSION`` is primarily a macro, intended for use in ``#if`` " +"directives, but it is also available as an exported function." +msgstr "" -#: ../../c-api/apiabiversion.rst:67 +#: ../../c-api/apiabiversion.rst:119 msgid "" -"The Python runtime version number encoded in a single constant integer, with " -"the same format as the :c:macro:`PY_VERSION_HEX` macro. This contains the " -"Python version used at run time." +"Equivalent to ``Py_PACK_FULL_VERSION(major, minor, 0, 0, 0)``. The result " +"does not correspond to any Python release, but is useful in numeric " +"comparisons." msgstr "" -"編碼為單個常數整數的 Python 執行環境版本號,格式與 :c:macro:`PY_VERSION_HEX` " -"巨集相同。這包含在執行環境使用的 Python 版本。" -#: ../../c-api/apiabiversion.rst:73 -msgid "All the given macros are defined in :source:`Include/patchlevel.h`." -msgstr "所有提到的巨集都定義在 :source:`Include/patchlevel.h`。" +#~ msgid "" +#~ "The underlying version information can be found by treating it as a 32 " +#~ "bit number in the following manner:" +#~ msgstr "所代表的版本資訊可以用以下規則將其看做是一個 32 位元數字來獲得:" + +#~ msgid "Bytes" +#~ msgstr "位元組串" + +#~ msgid "Bits (big endian order)" +#~ msgstr "位元(大端位元組序 (big endian order))" + +#~ msgid "Meaning" +#~ msgstr "意義" + +#~ msgid "1-8" +#~ msgstr "1-8" + +#~ msgid "``PY_MAJOR_VERSION``" +#~ msgstr "``PY_MAJOR_VERSION``" + +#~ msgid "9-16" +#~ msgstr "9-16" + +#~ msgid "``PY_MINOR_VERSION``" +#~ msgstr "``PY_MINOR_VERSION``" + +#~ msgid "3" +#~ msgstr "3" + +#~ msgid "17-24" +#~ msgstr "17-24" + +#~ msgid "``PY_MICRO_VERSION``" +#~ msgstr "``PY_MICRO_VERSION``" + +#~ msgid "25-28" +#~ msgstr "25-28" + +#~ msgid "``PY_RELEASE_LEVEL``" +#~ msgstr "``PY_RELEASE_LEVEL``" + +#~ msgid "29-32" +#~ msgstr "29-32" + +#~ msgid "``PY_RELEASE_SERIAL``" +#~ msgstr "``PY_RELEASE_SERIAL``" + +#~ msgid "" +#~ "Thus ``3.4.1a2`` is hexversion ``0x030401a2`` and ``3.10.0`` is " +#~ "hexversion ``0x030a00f0``." +#~ msgstr "" +#~ "因此 ``3.4.1a2`` 代表 hexversion ``0x030401a2``、``3.10.0`` 代表 " +#~ "hexversion ``0x030a00f0``。" + +#~ msgid "This version is also available via the symbol :c:var:`Py_Version`." +#~ msgstr "該版本也可透過符號 :c:var:`Py_Version` 獲得。" + +#~ msgid "All the given macros are defined in :source:`Include/patchlevel.h`." +#~ msgstr "所有提到的巨集都定義在 :source:`Include/patchlevel.h`。" diff --git a/c-api/arg.po b/c-api/arg.po index 921b3bae7fd..f532f43f222 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-06 05:40+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-10-16 03:21+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,17 +25,17 @@ msgstr "剖析引數與建置數值" #: ../../c-api/arg.rst:8 msgid "" "These functions are useful when creating your own extension functions and " -"methods. Additional information and examples are available in :ref:" -"`extending-index`." +"methods. Additional information and examples are available " +"in :ref:`extending-index`." msgstr "" #: ../../c-api/arg.rst:12 msgid "" -"The first three of these functions described, :c:func:`PyArg_ParseTuple`, :c:" -"func:`PyArg_ParseTupleAndKeywords`, and :c:func:`PyArg_Parse`, all use " -"*format strings* which are used to tell the function about the expected " -"arguments. The format strings use the same syntax for each of these " -"functions." +"The first three of these functions " +"described, :c:func:`PyArg_ParseTuple`, :c:func:`PyArg_ParseTupleAndKeywords`, " +"and :c:func:`PyArg_Parse`, all use *format strings* which are used to tell " +"the function about the expected arguments. The format strings use the same " +"syntax for each of these functions." msgstr "" #: ../../c-api/arg.rst:19 @@ -108,10 +108,10 @@ msgstr "" #: ../../c-api/arg.rst:70 msgid "" -"To ensure that the underlying buffer may be safely borrowed, the object's :c:" -"member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. This " -"disallows common mutable objects such as :class:`bytearray`, but also some " -"read-only objects such as :class:`memoryview` of :class:`bytes`." +"To ensure that the underlying buffer may be safely borrowed, the " +"object's :c:member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. " +"This disallows common mutable objects such as :class:`bytearray`, but also " +"some read-only objects such as :class:`memoryview` of :class:`bytes`." msgstr "" #: ../../c-api/arg.rst:76 @@ -139,8 +139,8 @@ msgstr "" msgid "" "This format does not accept :term:`bytes-like objects `. " "If you want to accept filesystem paths and convert them to C character " -"strings, it is preferable to use the ``O&`` format with :c:func:" -"`PyUnicode_FSConverter` as *converter*." +"strings, it is preferable to use the ``O&`` format " +"with :c:func:`PyUnicode_FSConverter` as *converter*." msgstr "" #: ../../c-api/arg.rst:96 @@ -163,11 +163,11 @@ msgstr "" #: ../../c-api/arg.rst:106 msgid "" -"``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char \\*, :" -"c:type:`Py_ssize_t`]" +"``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char " +"\\*, :c:type:`Py_ssize_t`]" msgstr "" -"``s#`` (:class:`str`、唯讀的 :term:`bytes-like object`) [const char \\*, :c:" -"type:`Py_ssize_t`]" +"``s#`` (:class:`str`、唯讀的 :term:`bytes-like object`) [const char " +"\\*, :c:type:`Py_ssize_t`]" #: ../../c-api/arg.rst:107 msgid "" @@ -178,7 +178,7 @@ msgid "" "encoding." msgstr "" -#: ../../c-api/arg.rst:113 ../../c-api/arg.rst:593 +#: ../../c-api/arg.rst:113 ../../c-api/arg.rst:614 msgid "``z`` (:class:`str` or ``None``) [const char \\*]" msgstr "``z`` (:class:`str` 或 ``None``) [const char \\*]" @@ -244,11 +244,11 @@ msgstr "" #: ../../c-api/arg.rst:141 msgid "" -"``y#`` (read-only :term:`bytes-like object`) [const char \\*, :c:type:" -"`Py_ssize_t`]" +"``y#`` (read-only :term:`bytes-like object`) [const char " +"\\*, :c:type:`Py_ssize_t`]" msgstr "" -"``y#`` (唯讀的 :term:`bytes-like object`) [const char \\*, :c:type:" -"`Py_ssize_t`]" +"``y#`` (唯讀的 :term:`bytes-like object`) [const char " +"\\*, :c:type:`Py_ssize_t`]" #: ../../c-api/arg.rst:142 msgid "" @@ -274,9 +274,9 @@ msgstr "``Y`` (:class:`bytearray`) [PyByteArrayObject \\*]" #: ../../c-api/arg.rst:151 msgid "" "Requires that the Python object is a :class:`bytearray` object, without " -"attempting any conversion. Raises :exc:`TypeError` if the object is not a :" -"class:`bytearray` object. The C variable may also be declared as :c:expr:" -"`PyObject*`." +"attempting any conversion. Raises :exc:`TypeError` if the object is not " +"a :class:`bytearray` object. The C variable may also be declared " +"as :c:expr:`PyObject*`." msgstr "" #: ../../c-api/arg.rst:155 @@ -298,8 +298,8 @@ msgstr "``w*`` (可讀寫 :term:`bytes-like object`) [Py_buffer]" msgid "" "This format accepts any object which implements the read-write buffer " "interface. It fills a :c:type:`Py_buffer` structure provided by the caller. " -"The buffer may contain embedded null bytes. The caller have to call :c:func:" -"`PyBuffer_Release` when it is done with the buffer." +"The buffer may contain embedded null bytes. The caller have to " +"call :c:func:`PyBuffer_Release` when it is done with the buffer." msgstr "" #: ../../c-api/arg.rst:166 @@ -327,8 +327,8 @@ msgstr "" msgid "" ":c:func:`PyArg_ParseTuple` will allocate a buffer of the needed size, copy " "the encoded data into this buffer and adjust *\\*buffer* to reference the " -"newly allocated storage. The caller is responsible for calling :c:func:" -"`PyMem_Free` to free the allocated buffer after use." +"newly allocated storage. The caller is responsible for " +"calling :c:func:`PyMem_Free` to free the allocated buffer after use." msgstr "" #: ../../c-api/arg.rst:183 @@ -348,11 +348,11 @@ msgstr "" #: ../../c-api/arg.rst:188 msgid "" -"``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" -"`Py_ssize_t` \\*buffer_length]" +"``es#`` (:class:`str`) [const char \\*encoding, char " +"\\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" msgstr "" -"``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" -"`Py_ssize_t` \\*buffer_length]" +"``es#`` (:class:`str`) [const char \\*encoding, char " +"\\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" #: ../../c-api/arg.rst:189 msgid "" @@ -428,10 +428,11 @@ msgstr "數字" #: ../../c-api/arg.rst:232 msgid "" "These formats allow representing Python numbers or single characters as C " -"numbers. Formats that require :class:`int`, :class:`float` or :class:" -"`complex` can also use the corresponding special methods :meth:`~object." -"__index__`, :meth:`~object.__float__` or :meth:`~object.__complex__` to " -"convert the Python object to the required type." +"numbers. Formats that require :class:`int`, :class:`float` " +"or :class:`complex` can also use the corresponding special " +"methods :meth:`~object.__index__`, :meth:`~object.__float__` " +"or :meth:`~object.__complex__` to convert the Python object to the required " +"type." msgstr "" #: ../../c-api/arg.rst:238 @@ -451,10 +452,10 @@ msgid "" "Convert a nonnegative Python integer to an unsigned tiny integer, stored in " "a C :c:expr:`unsigned char`." msgstr "" -"將一個 Python 非負整數轉換成無符號 tiny integer(小整數),儲存在 C 的 :c:" -"expr:`unsigned`" +"將一個 Python 非負整數轉換成無符號 tiny integer(小整數),儲存在 C " +"的 :c:expr:`unsigned`" -#: ../../c-api/arg.rst:248 ../../c-api/arg.rst:627 +#: ../../c-api/arg.rst:248 ../../c-api/arg.rst:648 msgid "``B`` (:class:`int`) [unsigned char]" msgstr "``B`` (:class:`int`) [unsigned char]" @@ -463,10 +464,10 @@ msgid "" "Convert a Python integer to a tiny integer without overflow checking, stored " "in a C :c:expr:`unsigned char`." msgstr "" -"將一個 Python 整數轉換成 tiny integer,轉換過程無溢位檢查,儲存在 C 的 :c:" -"expr:`unsigned char`。" +"將一個 Python 整數轉換成 tiny integer,轉換過程無溢位檢查,儲存在 C " +"的 :c:expr:`unsigned char`。" -#: ../../c-api/arg.rst:252 ../../c-api/arg.rst:621 +#: ../../c-api/arg.rst:252 ../../c-api/arg.rst:642 msgid "``h`` (:class:`int`) [short int]" msgstr "``h`` (:class:`int`) [short int]" @@ -474,7 +475,7 @@ msgstr "``h`` (:class:`int`) [short int]" msgid "Convert a Python integer to a C :c:expr:`short int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`short int`。" -#: ../../c-api/arg.rst:255 ../../c-api/arg.rst:630 +#: ../../c-api/arg.rst:255 ../../c-api/arg.rst:651 msgid "``H`` (:class:`int`) [unsigned short int]" msgstr "``H`` (:class:`int`) [unsigned short int]" @@ -486,7 +487,7 @@ msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned short int`,轉換過程無溢位檢" "查。" -#: ../../c-api/arg.rst:259 ../../c-api/arg.rst:615 +#: ../../c-api/arg.rst:259 ../../c-api/arg.rst:636 msgid "``i`` (:class:`int`) [int]" msgstr "``i`` (:class:`int`) [int]" @@ -494,7 +495,7 @@ msgstr "``i`` (:class:`int`) [int]" msgid "Convert a Python integer to a plain C :c:expr:`int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`int`。" -#: ../../c-api/arg.rst:262 ../../c-api/arg.rst:633 +#: ../../c-api/arg.rst:262 ../../c-api/arg.rst:654 msgid "``I`` (:class:`int`) [unsigned int]" msgstr "``I`` (:class:`int`) [unsigned int]" @@ -505,7 +506,7 @@ msgid "" msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned int`,轉換過程無溢位檢查。" -#: ../../c-api/arg.rst:266 ../../c-api/arg.rst:624 +#: ../../c-api/arg.rst:266 ../../c-api/arg.rst:645 msgid "``l`` (:class:`int`) [long int]" msgstr "``l`` (:class:`int`) [long int]" @@ -513,7 +514,7 @@ msgstr "``l`` (:class:`int`) [long int]" msgid "Convert a Python integer to a C :c:expr:`long int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`long int`。" -#: ../../c-api/arg.rst:269 ../../c-api/arg.rst:636 +#: ../../c-api/arg.rst:269 ../../c-api/arg.rst:657 msgid "``k`` (:class:`int`) [unsigned long]" msgstr "``k`` (:class:`int`) [unsigned long]" @@ -524,19 +525,23 @@ msgid "" msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned long`,轉換過程無溢位檢查。" -#: ../../c-api/arg.rst:273 ../../c-api/arg.rst:639 +#: ../../c-api/arg.rst:273 ../../c-api/arg.rst:283 +msgid "Use :meth:`~object.__index__` if available." +msgstr "" + +#: ../../c-api/arg.rst:276 ../../c-api/arg.rst:660 msgid "``L`` (:class:`int`) [long long]" msgstr "``L`` (:class:`int`) [long long]" -#: ../../c-api/arg.rst:274 +#: ../../c-api/arg.rst:277 msgid "Convert a Python integer to a C :c:expr:`long long`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`long long`。" -#: ../../c-api/arg.rst:276 ../../c-api/arg.rst:644 +#: ../../c-api/arg.rst:279 ../../c-api/arg.rst:665 msgid "``K`` (:class:`int`) [unsigned long long]" msgstr "``K`` (:class:`int`) [unsigned long long]" -#: ../../c-api/arg.rst:277 +#: ../../c-api/arg.rst:280 msgid "" "Convert a Python integer to a C :c:expr:`unsigned long long` without " "overflow checking." @@ -544,83 +549,83 @@ msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned long long`,轉換過程無溢位檢" "查。" -#: ../../c-api/arg.rst:280 ../../c-api/arg.rst:647 +#: ../../c-api/arg.rst:286 ../../c-api/arg.rst:668 msgid "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" msgstr "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:281 +#: ../../c-api/arg.rst:287 msgid "Convert a Python integer to a C :c:type:`Py_ssize_t`." msgstr "將一個 Python 整數轉換成 C 的 :c:type:`Py_ssize_t`。" -#: ../../c-api/arg.rst:283 +#: ../../c-api/arg.rst:289 msgid "``c`` (:class:`bytes` or :class:`bytearray` of length 1) [char]" msgstr "``c`` (:class:`bytes` 或長度為 1 的 :class:`bytearray`) [char]" -#: ../../c-api/arg.rst:284 +#: ../../c-api/arg.rst:290 msgid "" "Convert a Python byte, represented as a :class:`bytes` or :class:`bytearray` " "object of length 1, to a C :c:expr:`char`." msgstr "" -#: ../../c-api/arg.rst:287 +#: ../../c-api/arg.rst:293 msgid "Allow :class:`bytearray` objects." msgstr "允許 :class:`bytearray` 物件。" -#: ../../c-api/arg.rst:290 ../../c-api/arg.rst:654 +#: ../../c-api/arg.rst:296 ../../c-api/arg.rst:686 msgid "``C`` (:class:`str` of length 1) [int]" msgstr "``C`` (長度為 1 的 :class:`str`) [int]" -#: ../../c-api/arg.rst:291 +#: ../../c-api/arg.rst:297 msgid "" "Convert a Python character, represented as a :class:`str` object of length " "1, to a C :c:expr:`int`." msgstr "" -#: ../../c-api/arg.rst:294 ../../c-api/arg.rst:661 +#: ../../c-api/arg.rst:300 ../../c-api/arg.rst:693 msgid "``f`` (:class:`float`) [float]" msgstr "``f`` (:class:`float`) [float]" -#: ../../c-api/arg.rst:295 +#: ../../c-api/arg.rst:301 msgid "Convert a Python floating-point number to a C :c:expr:`float`." msgstr "將一個 Python 浮點數轉換成 C 的 :c:type::c:expr:`float`。" -#: ../../c-api/arg.rst:297 ../../c-api/arg.rst:658 +#: ../../c-api/arg.rst:303 ../../c-api/arg.rst:690 msgid "``d`` (:class:`float`) [double]" msgstr "``d`` (:class:`float`) [double]" -#: ../../c-api/arg.rst:298 +#: ../../c-api/arg.rst:304 msgid "Convert a Python floating-point number to a C :c:expr:`double`." msgstr "將一個 Python 浮點數轉換成 C 的 :c:type::c:expr:`double`。" -#: ../../c-api/arg.rst:300 +#: ../../c-api/arg.rst:306 msgid "``D`` (:class:`complex`) [Py_complex]" msgstr "``D`` (:class:`complex`) [Py_complex]" -#: ../../c-api/arg.rst:301 +#: ../../c-api/arg.rst:307 msgid "Convert a Python complex number to a C :c:type:`Py_complex` structure." msgstr "將一個 Python 複數轉換成 C 的 :c:type:`Py_complex` 結構。" -#: ../../c-api/arg.rst:304 +#: ../../c-api/arg.rst:310 msgid "Other objects" msgstr "其他物件" -#: ../../c-api/arg.rst:306 ../../c-api/arg.rst:667 +#: ../../c-api/arg.rst:312 ../../c-api/arg.rst:699 msgid "``O`` (object) [PyObject \\*]" msgstr "``O`` (object) [PyObject \\*]" -#: ../../c-api/arg.rst:307 +#: ../../c-api/arg.rst:313 msgid "" "Store a Python object (without any conversion) in a C object pointer. The C " -"program thus receives the actual object that was passed. A new :term:" -"`strong reference` to the object is not created (i.e. its reference count is " -"not increased). The pointer stored is not ``NULL``." +"program thus receives the actual object that was passed. A " +"new :term:`strong reference` to the object is not created (i.e. its " +"reference count is not increased). The pointer stored is not ``NULL``." msgstr "" -#: ../../c-api/arg.rst:313 +#: ../../c-api/arg.rst:319 msgid "``O!`` (object) [*typeobject*, PyObject \\*]" msgstr "``O!`` (object) [*typeobject*, PyObject \\*]" -#: ../../c-api/arg.rst:314 +#: ../../c-api/arg.rst:320 msgid "" "Store a Python object in a C object pointer. This is similar to ``O``, but " "takes two C arguments: the first is the address of a Python type object, the " @@ -629,11 +634,11 @@ msgid "" "required type, :exc:`TypeError` is raised." msgstr "" -#: ../../c-api/arg.rst:322 +#: ../../c-api/arg.rst:328 msgid "``O&`` (object) [*converter*, *address*]" msgstr "``O&`` (object) [*converter*, *address*]" -#: ../../c-api/arg.rst:323 +#: ../../c-api/arg.rst:329 msgid "" "Convert a Python object to a C variable through a *converter* function. " "This takes two arguments: the first is a function, the second is the address " @@ -641,21 +646,21 @@ msgid "" "*converter* function in turn is called as follows::" msgstr "" -#: ../../c-api/arg.rst:328 +#: ../../c-api/arg.rst:334 msgid "status = converter(object, address);" msgstr "status = converter(object, address);" -#: ../../c-api/arg.rst:330 +#: ../../c-api/arg.rst:336 msgid "" -"where *object* is the Python object to be converted and *address* is the :c:" -"expr:`void*` argument that was passed to the ``PyArg_Parse*`` function. The " -"returned *status* should be ``1`` for a successful conversion and ``0`` if " -"the conversion has failed. When the conversion fails, the *converter* " -"function should raise an exception and leave the content of *address* " -"unmodified." +"where *object* is the Python object to be converted and *address* is " +"the :c:expr:`void*` argument that was passed to the ``PyArg_Parse*`` " +"function. The returned *status* should be ``1`` for a successful conversion " +"and ``0`` if the conversion has failed. When the conversion fails, the " +"*converter* function should raise an exception and leave the content of " +"*address* unmodified." msgstr "" -#: ../../c-api/arg.rst:339 +#: ../../c-api/arg.rst:345 msgid "" "If the *converter* returns :c:macro:`!Py_CLEANUP_SUPPORTED`, it may get " "called a second time if the argument parsing eventually fails, giving the " @@ -664,21 +669,21 @@ msgid "" "have the same value as in the original call." msgstr "" -#: ../../c-api/arg.rst:345 +#: ../../c-api/arg.rst:351 msgid "" -"Examples of converters: :c:func:`PyUnicode_FSConverter` and :c:func:" -"`PyUnicode_FSDecoder`." +"Examples of converters: :c:func:`PyUnicode_FSConverter` " +"and :c:func:`PyUnicode_FSDecoder`." msgstr "" -#: ../../c-api/arg.rst:348 +#: ../../c-api/arg.rst:354 msgid ":c:macro:`!Py_CLEANUP_SUPPORTED` was added." msgstr "新增 :c:macro:`!Py_CLEANUP_SUPPORTED`。" -#: ../../c-api/arg.rst:351 +#: ../../c-api/arg.rst:357 ../../c-api/arg.rst:671 msgid "``p`` (:class:`bool`) [int]" msgstr "``p`` (:class:`bool`) [int]" -#: ../../c-api/arg.rst:352 +#: ../../c-api/arg.rst:358 msgid "" "Tests the value passed in for truth (a boolean **p**\\ redicate) and " "converts the result to its equivalent C true/false integer value. Sets the " @@ -687,28 +692,50 @@ msgid "" "how Python tests values for truth." msgstr "" -#: ../../c-api/arg.rst:360 ../../c-api/arg.rst:691 -msgid "``(items)`` (:class:`tuple`) [*matching-items*]" +#: ../../c-api/arg.rst:366 +#, fuzzy +msgid "``(items)`` (sequence) [*matching-items*]" msgstr "``(items)`` (:class:`tuple`) [*matching-items*]" -#: ../../c-api/arg.rst:361 +#: ../../c-api/arg.rst:367 +msgid "" +"The object must be a Python sequence (except :class:`str`, :class:`bytes` " +"or :class:`bytearray`) whose length is the number of format units in " +"*items*. The C arguments must correspond to the individual format units in " +"*items*. Format units for sequences may be nested." +msgstr "" + +#: ../../c-api/arg.rst:372 msgid "" -"The object must be a Python sequence whose length is the number of format " -"units in *items*. The C arguments must correspond to the individual format " -"units in *items*. Format units for sequences may be nested." +"If *items* contains format units which store a :ref:`borrowed buffer ` (``s``, ``s#``, ``z``, ``z#``, ``y``, or ``y#``) or " +"a :term:`borrowed reference` (``S``, ``Y``, ``U``, ``O``, or ``O!``), the " +"object must be a Python tuple. The *converter* for the ``O&`` format unit in " +"*items* must not store a borrowed buffer or a borrowed reference." msgstr "" -#: ../../c-api/arg.rst:365 +#: ../../c-api/arg.rst:379 +msgid "" +":class:`str` and :class:`bytearray` objects no longer accepted as a sequence." +msgstr "" + +#: ../../c-api/arg.rst:382 +msgid "" +"Non-tuple sequences are deprecated if *items* contains format units which " +"store a borrowed buffer or a borrowed reference." +msgstr "" + +#: ../../c-api/arg.rst:386 msgid "" "A few other characters have a meaning in a format string. These may not " "occur inside nested parentheses. They are:" msgstr "" -#: ../../c-api/arg.rst:368 +#: ../../c-api/arg.rst:389 msgid "``|``" msgstr "``|``" -#: ../../c-api/arg.rst:369 +#: ../../c-api/arg.rst:390 msgid "" "Indicates that the remaining arguments in the Python argument list are " "optional. The C variables corresponding to optional arguments should be " @@ -717,11 +744,11 @@ msgid "" "corresponding C variable(s)." msgstr "" -#: ../../c-api/arg.rst:375 +#: ../../c-api/arg.rst:396 msgid "``$``" msgstr "``$``" -#: ../../c-api/arg.rst:376 +#: ../../c-api/arg.rst:397 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` only: Indicates that the remaining " "arguments in the Python argument list are keyword-only. Currently, all " @@ -729,36 +756,36 @@ msgid "" "be specified before ``$`` in the format string." msgstr "" -#: ../../c-api/arg.rst:384 +#: ../../c-api/arg.rst:405 msgid "``:``" msgstr "``:``" -#: ../../c-api/arg.rst:385 +#: ../../c-api/arg.rst:406 msgid "" "The list of format units ends here; the string after the colon is used as " "the function name in error messages (the \"associated value\" of the " "exception that :c:func:`PyArg_ParseTuple` raises)." msgstr "" -#: ../../c-api/arg.rst:389 +#: ../../c-api/arg.rst:410 msgid "``;``" msgstr "``;``" -#: ../../c-api/arg.rst:390 +#: ../../c-api/arg.rst:411 msgid "" "The list of format units ends here; the string after the semicolon is used " -"as the error message *instead* of the default error message. ``:`` and ``;" -"`` mutually exclude each other." +"as the error message *instead* of the default error message. ``:`` and " +"``;`` mutually exclude each other." msgstr "" -#: ../../c-api/arg.rst:394 +#: ../../c-api/arg.rst:415 msgid "" "Note that any Python object references which are provided to the caller are " "*borrowed* references; do not release them (i.e. do not decrement their " "reference count)!" msgstr "" -#: ../../c-api/arg.rst:398 +#: ../../c-api/arg.rst:419 msgid "" "Additional arguments passed to these functions must be addresses of " "variables whose type is determined by the format string; these are used to " @@ -768,7 +795,7 @@ msgid "" "unit in that case." msgstr "" -#: ../../c-api/arg.rst:404 +#: ../../c-api/arg.rst:425 msgid "" "For the conversion to succeed, the *arg* object must match the format and " "the format must be exhausted. On success, the ``PyArg_Parse*`` functions " @@ -778,24 +805,24 @@ msgid "" "the following format units are left untouched." msgstr "" -#: ../../c-api/arg.rst:413 +#: ../../c-api/arg.rst:434 msgid "API Functions" msgstr "API 函式" -#: ../../c-api/arg.rst:417 +#: ../../c-api/arg.rst:438 msgid "" "Parse the parameters of a function that takes only positional parameters " "into local variables. Returns true on success; on failure, it returns false " "and raises the appropriate exception." msgstr "" -#: ../../c-api/arg.rst:424 +#: ../../c-api/arg.rst:445 msgid "" "Identical to :c:func:`PyArg_ParseTuple`, except that it accepts a va_list " "rather than a variable number of arguments." msgstr "" -#: ../../c-api/arg.rst:430 +#: ../../c-api/arg.rst:451 msgid "" "Parse the parameters of a function that takes both positional and keyword " "parameters into local variables. The *keywords* argument is a ``NULL``-" @@ -805,51 +832,51 @@ msgid "" "failure, it returns false and raises the appropriate exception." msgstr "" -#: ../../c-api/arg.rst:441 +#: ../../c-api/arg.rst:462 msgid "" -"The *keywords* parameter declaration is :c:expr:`char * const *` in C and :c:" -"expr:`const char * const *` in C++. This can be overridden with the :c:macro:" -"`PY_CXX_CONST` macro." +"The *keywords* parameter declaration is :c:expr:`char * const *` in C " +"and :c:expr:`const char * const *` in C++. This can be overridden with " +"the :c:macro:`PY_CXX_CONST` macro." msgstr "" -#: ../../c-api/arg.rst:445 +#: ../../c-api/arg.rst:466 msgid "" "Added support for :ref:`positional-only parameters `." msgstr "新增對\\ :ref:`僅限位置參數 `\\ 的支援。" -#: ../../c-api/arg.rst:449 +#: ../../c-api/arg.rst:470 msgid "" -"The *keywords* parameter has now type :c:expr:`char * const *` in C and :c:" -"expr:`const char * const *` in C++, instead of :c:expr:`char **`. Added " -"support for non-ASCII keyword parameter names." +"The *keywords* parameter has now type :c:expr:`char * const *` in C " +"and :c:expr:`const char * const *` in C++, instead of :c:expr:`char **`. " +"Added support for non-ASCII keyword parameter names." msgstr "" -#: ../../c-api/arg.rst:458 +#: ../../c-api/arg.rst:479 msgid "" "Identical to :c:func:`PyArg_ParseTupleAndKeywords`, except that it accepts a " "va_list rather than a variable number of arguments." msgstr "" -#: ../../c-api/arg.rst:464 +#: ../../c-api/arg.rst:485 msgid "" "Ensure that the keys in the keywords argument dictionary are strings. This " "is only needed if :c:func:`PyArg_ParseTupleAndKeywords` is not used, since " "the latter already does this check." msgstr "" -#: ../../c-api/arg.rst:473 +#: ../../c-api/arg.rst:494 msgid "" "Parse the parameter of a function that takes a single positional parameter " "into a local variable. Returns true on success; on failure, it returns " "false and raises the appropriate exception." msgstr "" -#: ../../c-api/arg.rst:477 +#: ../../c-api/arg.rst:498 msgid "Example::" msgstr "舉例來說: ::" -#: ../../c-api/arg.rst:479 +#: ../../c-api/arg.rst:500 msgid "" "// Function using METH_O calling convention\n" "static PyObject*\n" @@ -863,7 +890,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/arg.rst:493 +#: ../../c-api/arg.rst:514 msgid "" "A simpler form of parameter retrieval which does not use a format string to " "specify the types of the arguments. Functions which use this method to " @@ -881,13 +908,13 @@ msgid "" "if there was a failure." msgstr "" -#: ../../c-api/arg.rst:508 +#: ../../c-api/arg.rst:529 msgid "" "This is an example of the use of this function, taken from the sources for " "the :mod:`!_weakref` helper module for weak references::" msgstr "" -#: ../../c-api/arg.rst:511 +#: ../../c-api/arg.rst:532 msgid "" "static PyObject *\n" "weakref_ref(PyObject *self, PyObject *args)\n" @@ -915,17 +942,17 @@ msgstr "" " return result;\n" "}" -#: ../../c-api/arg.rst:524 +#: ../../c-api/arg.rst:545 msgid "" "The call to :c:func:`PyArg_UnpackTuple` in this example is entirely " "equivalent to this call to :c:func:`PyArg_ParseTuple`::" msgstr "" -#: ../../c-api/arg.rst:527 +#: ../../c-api/arg.rst:548 msgid "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" msgstr "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" -#: ../../c-api/arg.rst:531 +#: ../../c-api/arg.rst:552 msgid "" "The value to be inserted, if any, before :c:expr:`char * const *` in the " "*keywords* parameter declaration of :c:func:`PyArg_ParseTupleAndKeywords` " @@ -934,11 +961,11 @@ msgid "" "to the desired value before including :file:`Python.h`." msgstr "" -#: ../../c-api/arg.rst:545 +#: ../../c-api/arg.rst:566 msgid "Building values" msgstr "建置數值" -#: ../../c-api/arg.rst:549 +#: ../../c-api/arg.rst:570 msgid "" "Create a new value based on a format string similar to those accepted by the " "``PyArg_Parse*`` family of functions and a sequence of values. Returns the " @@ -946,7 +973,7 @@ msgid "" "``NULL`` is returned." msgstr "" -#: ../../c-api/arg.rst:554 +#: ../../c-api/arg.rst:575 msgid "" ":c:func:`Py_BuildValue` does not always build a tuple. It builds a tuple " "only if its format string contains two or more format units. If the format " @@ -955,18 +982,18 @@ msgid "" "it to return a tuple of size 0 or one, parenthesize the format string." msgstr "" -#: ../../c-api/arg.rst:560 +#: ../../c-api/arg.rst:581 msgid "" "When memory buffers are passed as parameters to supply data to build " "objects, as for the ``s`` and ``s#`` formats, the required data is copied. " "Buffers provided by the caller are never referenced by the objects created " -"by :c:func:`Py_BuildValue`. In other words, if your code invokes :c:func:" -"`malloc` and passes the allocated memory to :c:func:`Py_BuildValue`, your " -"code is responsible for calling :c:func:`free` for that memory once :c:func:" -"`Py_BuildValue` returns." +"by :c:func:`Py_BuildValue`. In other words, if your code " +"invokes :c:func:`malloc` and passes the allocated memory " +"to :c:func:`Py_BuildValue`, your code is responsible for " +"calling :c:func:`free` for that memory once :c:func:`Py_BuildValue` returns." msgstr "" -#: ../../c-api/arg.rst:568 +#: ../../c-api/arg.rst:589 msgid "" "In the following description, the quoted form is the format unit; the entry " "in (round) parentheses is the Python object type that the format unit will " @@ -974,261 +1001,278 @@ msgid "" "be passed." msgstr "" -#: ../../c-api/arg.rst:572 +#: ../../c-api/arg.rst:593 msgid "" "The characters space, tab, colon and comma are ignored in format strings " "(but not within format units such as ``s#``). This can be used to make long " "format strings a tad more readable." msgstr "" -#: ../../c-api/arg.rst:576 +#: ../../c-api/arg.rst:597 msgid "``s`` (:class:`str` or ``None``) [const char \\*]" msgstr "``s`` (:class:`str` 或 ``None``) [const char \\*]" -#: ../../c-api/arg.rst:577 +#: ../../c-api/arg.rst:598 msgid "" "Convert a null-terminated C string to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, ``None`` is used." msgstr "" -#: ../../c-api/arg.rst:580 +#: ../../c-api/arg.rst:601 msgid "" "``s#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" "``s#`` (:class:`str` 或 ``None``) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:581 +#: ../../c-api/arg.rst:602 msgid "" "Convert a C string and its length to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:585 +#: ../../c-api/arg.rst:606 msgid "``y`` (:class:`bytes`) [const char \\*]" msgstr "``y`` (:class:`bytes`) [const char \\*]" -#: ../../c-api/arg.rst:586 +#: ../../c-api/arg.rst:607 msgid "" "This converts a C string to a Python :class:`bytes` object. If the C string " "pointer is ``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:589 +#: ../../c-api/arg.rst:610 msgid "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:590 +#: ../../c-api/arg.rst:611 msgid "" "This converts a C string and its lengths to a Python object. If the C " "string pointer is ``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:594 ../../c-api/arg.rst:610 +#: ../../c-api/arg.rst:615 ../../c-api/arg.rst:631 msgid "Same as ``s``." msgstr "和 ``s`` 相同。" -#: ../../c-api/arg.rst:596 +#: ../../c-api/arg.rst:617 msgid "" "``z#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" "``z#`` (:class:`str` 或 ``None``) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:597 ../../c-api/arg.rst:613 +#: ../../c-api/arg.rst:618 ../../c-api/arg.rst:634 msgid "Same as ``s#``." msgstr "和 ``s#`` 相同。" -#: ../../c-api/arg.rst:599 +#: ../../c-api/arg.rst:620 msgid "``u`` (:class:`str`) [const wchar_t \\*]" msgstr "``u`` (:class:`str`) [const wchar_t \\*]" -#: ../../c-api/arg.rst:600 +#: ../../c-api/arg.rst:621 msgid "" "Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or " "UCS-4) data to a Python Unicode object. If the Unicode buffer pointer is " "``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:604 +#: ../../c-api/arg.rst:625 msgid "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" msgstr "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:605 +#: ../../c-api/arg.rst:626 msgid "" "Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python " "Unicode object. If the Unicode buffer pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:609 +#: ../../c-api/arg.rst:630 msgid "``U`` (:class:`str` or ``None``) [const char \\*]" msgstr "``U`` (:class:`str` 或 ``None``) [const char \\*]" -#: ../../c-api/arg.rst:612 +#: ../../c-api/arg.rst:633 msgid "" "``U#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" "``U#`` (:class:`str` 或 ``None``) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:616 +#: ../../c-api/arg.rst:637 msgid "Convert a plain C :c:expr:`int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:618 +#: ../../c-api/arg.rst:639 msgid "``b`` (:class:`int`) [char]" msgstr "``b`` (:class:`int`) [char]" -#: ../../c-api/arg.rst:619 +#: ../../c-api/arg.rst:640 msgid "Convert a plain C :c:expr:`char` to a Python integer object." msgstr "將一個 C 的 :c:expr:`char` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:622 +#: ../../c-api/arg.rst:643 msgid "Convert a plain C :c:expr:`short int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`short int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:625 +#: ../../c-api/arg.rst:646 msgid "Convert a C :c:expr:`long int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`long int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:628 +#: ../../c-api/arg.rst:649 msgid "Convert a C :c:expr:`unsigned char` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned char` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:631 +#: ../../c-api/arg.rst:652 msgid "Convert a C :c:expr:`unsigned short int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned short int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:634 +#: ../../c-api/arg.rst:655 msgid "Convert a C :c:expr:`unsigned int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:637 +#: ../../c-api/arg.rst:658 msgid "Convert a C :c:expr:`unsigned long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:640 +#: ../../c-api/arg.rst:661 msgid "Convert a C :c:expr:`long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:645 +#: ../../c-api/arg.rst:666 msgid "Convert a C :c:expr:`unsigned long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:648 +#: ../../c-api/arg.rst:669 msgid "Convert a C :c:type:`Py_ssize_t` to a Python integer." msgstr "將一個 C 的 :c:type:`Py_ssize_t` 轉換成 Python 整數。" -#: ../../c-api/arg.rst:650 +#: ../../c-api/arg.rst:672 +#, fuzzy +msgid "Convert a C :c:expr:`int` to a Python :class:`bool` object." +msgstr "將一個 C 的 :c:expr:`long int` 轉換成 Python 整數物件。" + +#: ../../c-api/arg.rst:674 +msgid "" +"Be aware that this format requires an ``int`` argument. Unlike most other " +"contexts in C, variadic arguments are not coerced to a suitable type " +"automatically. You can convert another type (for example, a pointer or a " +"float) to a suitable ``int`` value using ``(x) ? 1 : 0`` or ``!!x``." +msgstr "" + +#: ../../c-api/arg.rst:682 msgid "``c`` (:class:`bytes` of length 1) [char]" msgstr "``c`` (長度為 1 的 :class:`bytes`) [char]" -#: ../../c-api/arg.rst:651 +#: ../../c-api/arg.rst:683 msgid "" "Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` " "object of length 1." msgstr "" -"將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" -"`bytes`。" +"將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一" +"的 :class:`bytes`。" -#: ../../c-api/arg.rst:655 +#: ../../c-api/arg.rst:687 msgid "" "Convert a C :c:expr:`int` representing a character to Python :class:`str` " "object of length 1." msgstr "" -"將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" -"`str`。" +"將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一" +"的 :class:`str`。" -#: ../../c-api/arg.rst:659 +#: ../../c-api/arg.rst:691 msgid "Convert a C :c:expr:`double` to a Python floating-point number." msgstr "將一個 C 的 :c:expr:`double` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:662 +#: ../../c-api/arg.rst:694 msgid "Convert a C :c:expr:`float` to a Python floating-point number." msgstr "將一個 C 的 :c:expr:`float` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:664 +#: ../../c-api/arg.rst:696 msgid "``D`` (:class:`complex`) [Py_complex \\*]" msgstr "``D`` (:class:`complex`) [Py_complex \\*]" -#: ../../c-api/arg.rst:665 +#: ../../c-api/arg.rst:697 msgid "Convert a C :c:type:`Py_complex` structure to a Python complex number." msgstr "將一個 C 的 :c:type:`Py_complex` 結構轉換成 Python 複數。" -#: ../../c-api/arg.rst:668 +#: ../../c-api/arg.rst:700 msgid "" "Pass a Python object untouched but create a new :term:`strong reference` to " "it (i.e. its reference count is incremented by one). If the object passed in " "is a ``NULL`` pointer, it is assumed that this was caused because the call " -"producing the argument found an error and set an exception. Therefore, :c:" -"func:`Py_BuildValue` will return ``NULL`` but won't raise an exception. If " -"no exception has been raised yet, :exc:`SystemError` is set." +"producing the argument found an error and set an exception. " +"Therefore, :c:func:`Py_BuildValue` will return ``NULL`` but won't raise an " +"exception. If no exception has been raised yet, :exc:`SystemError` is set." msgstr "" -#: ../../c-api/arg.rst:677 +#: ../../c-api/arg.rst:709 msgid "``S`` (object) [PyObject \\*]" msgstr "``S`` (object) [PyObject \\*]" -#: ../../c-api/arg.rst:678 +#: ../../c-api/arg.rst:710 msgid "Same as ``O``." msgstr "和 ``O`` 相同。" -#: ../../c-api/arg.rst:680 +#: ../../c-api/arg.rst:712 msgid "``N`` (object) [PyObject \\*]" msgstr "``N`` (object) [PyObject \\*]" -#: ../../c-api/arg.rst:681 +#: ../../c-api/arg.rst:713 msgid "" "Same as ``O``, except it doesn't create a new :term:`strong reference`. " "Useful when the object is created by a call to an object constructor in the " "argument list." msgstr "" -#: ../../c-api/arg.rst:685 +#: ../../c-api/arg.rst:717 msgid "``O&`` (object) [*converter*, *anything*]" msgstr "``O&`` (object) [*converter*, *anything*]" -#: ../../c-api/arg.rst:686 +#: ../../c-api/arg.rst:718 msgid "" "Convert *anything* to a Python object through a *converter* function. The " -"function is called with *anything* (which should be compatible with :c:expr:" -"`void*`) as its argument and should return a \"new\" Python object, or " -"``NULL`` if an error occurred." +"function is called with *anything* (which should be compatible " +"with :c:expr:`void*`) as its argument and should return a \"new\" Python " +"object, or ``NULL`` if an error occurred." msgstr "" -#: ../../c-api/arg.rst:692 +#: ../../c-api/arg.rst:723 +msgid "``(items)`` (:class:`tuple`) [*matching-items*]" +msgstr "``(items)`` (:class:`tuple`) [*matching-items*]" + +#: ../../c-api/arg.rst:724 msgid "" "Convert a sequence of C values to a Python tuple with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:694 +#: ../../c-api/arg.rst:726 msgid "``[items]`` (:class:`list`) [*matching-items*]" msgstr "``[items]`` (:class:`list`) [*matching-items*]" -#: ../../c-api/arg.rst:695 +#: ../../c-api/arg.rst:727 msgid "" "Convert a sequence of C values to a Python list with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:697 +#: ../../c-api/arg.rst:729 msgid "``{items}`` (:class:`dict`) [*matching-items*]" msgstr "``{items}`` (:class:`dict`) [*matching-items*]" -#: ../../c-api/arg.rst:698 +#: ../../c-api/arg.rst:730 msgid "" "Convert a sequence of C values to a Python dictionary. Each pair of " "consecutive C values adds one item to the dictionary, serving as key and " "value, respectively." msgstr "" -#: ../../c-api/arg.rst:702 +#: ../../c-api/arg.rst:734 msgid "" "If there is an error in the format string, the :exc:`SystemError` exception " "is set and ``NULL`` returned." msgstr "" -#: ../../c-api/arg.rst:707 +#: ../../c-api/arg.rst:739 msgid "" "Identical to :c:func:`Py_BuildValue`, except that it accepts a va_list " "rather than a variable number of arguments." diff --git a/c-api/bytearray.po b/c-api/bytearray.po index 183f9f7fa0b..c8f8a7b9ad9 100644 --- a/c-api/bytearray.po +++ b/c-api/bytearray.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-04 00:03+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-08-12 11:42+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -62,8 +62,8 @@ msgstr "直接 API 函式" #: ../../c-api/bytearray.rst:42 msgid "" -"Return a new bytearray object from any object, *o*, that implements the :ref:" -"`buffer protocol `." +"Return a new bytearray object from any object, *o*, that implements " +"the :ref:`buffer protocol `." msgstr "" "由任意物件 *o* 回傳一個新的位元組陣列物件,並實作了\\ :ref:`緩衝協定 (buffer " "protocol) `。" @@ -95,22 +95,30 @@ msgstr "" "總是會多附加一個空位元組。" #: ../../c-api/bytearray.rst:76 -msgid "Resize the internal buffer of *bytearray* to *len*." +#, fuzzy +msgid "" +"Resize the internal buffer of *bytearray* to *len*. Failure is a ``-1`` " +"return with an exception set." msgstr "將 *bytearray* 的內部緩衝區大小調整為 *len*。" #: ../../c-api/bytearray.rst:79 +msgid "" +"A negative *len* will now result in an exception being set and -1 returned." +msgstr "" + +#: ../../c-api/bytearray.rst:84 msgid "Macros" msgstr "巨集" -#: ../../c-api/bytearray.rst:81 +#: ../../c-api/bytearray.rst:86 msgid "These macros trade safety for speed and they don't check pointers." msgstr "這些巨集犧牲了安全性以換取速度,並且它們不會檢查指標。" -#: ../../c-api/bytearray.rst:85 +#: ../../c-api/bytearray.rst:90 msgid "Similar to :c:func:`PyByteArray_AsString`, but without error checking." msgstr "與 :c:func:`PyByteArray_AsString` 類似,但沒有錯誤檢查。" -#: ../../c-api/bytearray.rst:90 +#: ../../c-api/bytearray.rst:95 msgid "Similar to :c:func:`PyByteArray_Size`, but without error checking." msgstr "與 :c:func:`PyByteArray_Size` 類似,但沒有錯誤檢查。" diff --git a/c-api/bytes.po b/c-api/bytes.po index 4cb4ac85455..473c26b43ef 100644 --- a/c-api/bytes.po +++ b/c-api/bytes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -261,8 +261,8 @@ msgid "" "buffer is always null, regardless of whether there are any other null " "bytes. The data must not be modified in any way, unless the object was just " "created using ``PyBytes_FromStringAndSize(NULL, size)``. It must not be " -"deallocated. If *o* is not a bytes object at all, :c:func:" -"`PyBytes_AsString` returns ``NULL`` and raises :exc:`TypeError`." +"deallocated. If *o* is not a bytes object at " +"all, :c:func:`PyBytes_AsString` returns ``NULL`` and raises :exc:`TypeError`." msgstr "" #: ../../c-api/bytes.rst:151 @@ -315,6 +315,29 @@ msgid "" msgstr "" #: ../../c-api/bytes.rst:194 +msgid "Similar to ``sep.join(iterable)`` in Python." +msgstr "" + +#: ../../c-api/bytes.rst:196 +msgid "" +"*sep* must be Python :class:`bytes` object. (Note " +"that :c:func:`PyUnicode_Join` accepts ``NULL`` separator and treats it as a " +"space, whereas :c:func:`PyBytes_Join` doesn't accept ``NULL`` separator.)" +msgstr "" + +#: ../../c-api/bytes.rst:201 +msgid "" +"*iterable* must be an iterable object yielding objects that implement " +"the :ref:`buffer protocol `." +msgstr "" + +#: ../../c-api/bytes.rst:204 +msgid "" +"On success, return a new :class:`bytes` object. On error, set an exception " +"and return ``NULL``." +msgstr "" + +#: ../../c-api/bytes.rst:212 msgid "" "Resize a bytes object. *newsize* will be the new length of the bytes object. " "You can think of it as creating a new bytes object and destroying the old " diff --git a/c-api/code.po b/c-api/code.po index 89118a2635b..154ccc88aee 100644 --- a/c-api/code.po +++ b/c-api/code.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-03 00:19+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,8 +37,8 @@ msgstr "" #: ../../c-api/code.rst:24 msgid "" -"This is an instance of :c:type:`PyTypeObject` representing the Python :ref:" -"`code object `." +"This is an instance of :c:type:`PyTypeObject` representing the " +"Python :ref:`code object `." msgstr "" #: ../../c-api/code.rst:30 @@ -74,8 +74,9 @@ msgstr "" #: ../../c-api/code.rst:54 msgid "" -"Since the definition of the bytecode changes often, calling :c:func:" -"`PyUnstable_Code_New` directly can bind you to a precise Python version." +"Since the definition of the bytecode changes often, " +"calling :c:func:`PyUnstable_Code_New` directly can bind you to a precise " +"Python version." msgstr "" #: ../../c-api/code.rst:57 @@ -132,8 +133,9 @@ msgstr "" #: ../../c-api/code.rst:101 msgid "" -"For efficiently iterating over the line numbers in a code object, use :pep:" -"`the API described in PEP 626 <0626#out-of-process-debuggers-and-profilers>`." +"For efficiently iterating over the line numbers in a code object, " +"use :pep:`the API described in PEP 626 <0626#out-of-process-debuggers-and-" +"profilers>`." msgstr "" #: ../../c-api/code.rst:106 @@ -179,9 +181,9 @@ msgstr "" #: ../../c-api/code.rst:147 msgid "" "Equivalent to the Python code ``getattr(co, 'co_freevars')``. Returns a new " -"reference to a :c:type:`PyTupleObject` containing the names of the :term:" -"`free (closure) variables `. On error, ``NULL`` is " -"returned and an exception is raised." +"reference to a :c:type:`PyTupleObject` containing the names of " +"the :term:`free (closure) variables `. On error, ``NULL`` " +"is returned and an exception is raised." msgstr "" #: ../../c-api/code.rst:156 @@ -194,10 +196,10 @@ msgstr "" #: ../../c-api/code.rst:165 msgid "" -"Clear watcher identified by *watcher_id* previously returned from :c:func:" -"`PyCode_AddWatcher` for the current interpreter. Return ``0`` on success, or " -"``-1`` and set an exception on error (e.g. if the given *watcher_id* was " -"never registered.)" +"Clear watcher identified by *watcher_id* previously returned " +"from :c:func:`PyCode_AddWatcher` for the current interpreter. Return ``0`` " +"on success, or ``-1`` and set an exception on error (e.g. if the given " +"*watcher_id* was never registered.)" msgstr "" #: ../../c-api/code.rst:174 @@ -239,8 +241,8 @@ msgstr "" #: ../../c-api/code.rst:201 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " -"will be printed as an unraisable exception using :c:func:" -"`PyErr_WriteUnraisable`. Otherwise it should return ``0``." +"will be printed as an unraisable exception " +"using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" #: ../../c-api/code.rst:205 @@ -258,18 +260,18 @@ msgstr "程式碼物件旗標" #: ../../c-api/code.rst:219 msgid "" -"Code objects contain a bit-field of flags, which can be retrieved as the :" -"attr:`~codeobject.co_flags` Python attribute (for example using :c:func:" -"`PyObject_GetAttrString`), and set using a *flags* argument to :c:func:" -"`PyUnstable_Code_New` and similar functions." +"Code objects contain a bit-field of flags, which can be retrieved as " +"the :attr:`~codeobject.co_flags` Python attribute (for example " +"using :c:func:`PyObject_GetAttrString`), and set using a *flags* argument " +"to :c:func:`PyUnstable_Code_New` and similar functions." msgstr "" #: ../../c-api/code.rst:224 msgid "" "Flags whose names start with ``CO_FUTURE_`` correspond to features normally " -"selectable by :ref:`future statements `. These flags can be used in :" -"c:member:`PyCompilerFlags.cf_flags`. Note that many ``CO_FUTURE_`` flags are " -"mandatory in current versions of Python, and setting them has no effect." +"selectable by :ref:`future statements `. These flags can be used " +"in :c:member:`PyCompilerFlags.cf_flags`. Note that many ``CO_FUTURE_`` flags " +"are mandatory in current versions of Python, and setting them has no effect." msgstr "" #: ../../c-api/code.rst:230 @@ -322,113 +324,123 @@ msgstr ":py:data:`inspect.CO_ITERABLE_COROUTINE`" msgid ":py:data:`inspect.CO_ASYNC_GENERATOR`" msgstr ":py:data:`inspect.CO_ASYNC_GENERATOR`" -#: ../../c-api/code.rst:260 +#: ../../c-api/code.rst:259 +#, fuzzy +msgid ":py:data:`inspect.CO_HAS_DOCSTRING`" +msgstr ":py:data:`inspect.CO_COROUTINE`" + +#: ../../c-api/code.rst:261 +#, fuzzy +msgid ":py:data:`inspect.CO_METHOD`" +msgstr ":py:data:`inspect.CO_NESTED`" + +#: ../../c-api/code.rst:264 msgid "no effect (:py:data:`__future__.division`)" msgstr "無效果(:py:data:`__future__.division`)" -#: ../../c-api/code.rst:262 +#: ../../c-api/code.rst:266 msgid "no effect (:py:data:`__future__.absolute_import`)" msgstr "無效果(:py:data:`__future__.absolute_import`)" -#: ../../c-api/code.rst:264 +#: ../../c-api/code.rst:268 msgid "no effect (:py:data:`__future__.with_statement`)" msgstr "無效果(:py:data:`__future__.with_statement`)" -#: ../../c-api/code.rst:266 +#: ../../c-api/code.rst:270 msgid "no effect (:py:data:`__future__.print_function`)" msgstr "無效果(:py:data:`__future__.print_function`)" -#: ../../c-api/code.rst:268 +#: ../../c-api/code.rst:272 msgid "no effect (:py:data:`__future__.unicode_literals`)" msgstr "無效果(:py:data:`__future__.unicode_literals`)" -#: ../../c-api/code.rst:270 +#: ../../c-api/code.rst:274 msgid "no effect (:py:data:`__future__.generator_stop`)" msgstr "無效果(:py:data:`__future__.generator_stop`)" -#: ../../c-api/code.rst:272 +#: ../../c-api/code.rst:276 msgid ":py:data:`__future__.annotations`" msgstr ":py:data:`__future__.annotations`" -#: ../../c-api/code.rst:276 +#: ../../c-api/code.rst:280 msgid "Extra information" msgstr "額外資訊" -#: ../../c-api/code.rst:278 +#: ../../c-api/code.rst:282 msgid "" "To support low-level extensions to frame evaluation, such as external just-" "in-time compilers, it is possible to attach arbitrary extra data to code " "objects." msgstr "" -#: ../../c-api/code.rst:282 +#: ../../c-api/code.rst:286 msgid "" "These functions are part of the unstable C API tier: this functionality is a " "CPython implementation detail, and the API may change without deprecation " "warnings." msgstr "" -#: ../../c-api/code.rst:288 +#: ../../c-api/code.rst:292 msgid "Return a new an opaque index value used to adding data to code objects." msgstr "" -#: ../../c-api/code.rst:290 +#: ../../c-api/code.rst:294 msgid "" "You generally call this function once (per interpreter) and use the result " "with ``PyCode_GetExtra`` and ``PyCode_SetExtra`` to manipulate data on " "individual code objects." msgstr "" -#: ../../c-api/code.rst:294 +#: ../../c-api/code.rst:298 msgid "" "If *free* is not ``NULL``: when a code object is deallocated, *free* will be " -"called on non-``NULL`` data stored under the new index. Use :c:func:" -"`Py_DecRef` when storing :c:type:`PyObject`." +"called on non-``NULL`` data stored under the new index. " +"Use :c:func:`Py_DecRef` when storing :c:type:`PyObject`." msgstr "" -#: ../../c-api/code.rst:300 +#: ../../c-api/code.rst:304 msgid "as ``_PyEval_RequestCodeExtraIndex``" msgstr "" -#: ../../c-api/code.rst:304 +#: ../../c-api/code.rst:308 msgid "" "Renamed to ``PyUnstable_Eval_RequestCodeExtraIndex``. The old private name " "is deprecated, but will be available until the API changes." msgstr "" -#: ../../c-api/code.rst:310 +#: ../../c-api/code.rst:314 msgid "" "Set *extra* to the extra data stored under the given index. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" -#: ../../c-api/code.rst:313 +#: ../../c-api/code.rst:317 msgid "" "If no data was set under the index, set *extra* to ``NULL`` and return 0 " "without setting an exception." msgstr "" -#: ../../c-api/code.rst:318 +#: ../../c-api/code.rst:322 msgid "as ``_PyCode_GetExtra``" msgstr "" -#: ../../c-api/code.rst:322 +#: ../../c-api/code.rst:326 msgid "" "Renamed to ``PyUnstable_Code_GetExtra``. The old private name is deprecated, " "but will be available until the API changes." msgstr "" -#: ../../c-api/code.rst:328 +#: ../../c-api/code.rst:332 msgid "" "Set the extra data stored under the given index to *extra*. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" -#: ../../c-api/code.rst:333 +#: ../../c-api/code.rst:337 msgid "as ``_PyCode_SetExtra``" msgstr "" -#: ../../c-api/code.rst:337 +#: ../../c-api/code.rst:341 msgid "" "Renamed to ``PyUnstable_Code_SetExtra``. The old private name is deprecated, " "but will be available until the API changes." @@ -454,14 +466,14 @@ msgstr "PyCode_New(C 函式)" msgid "PyCode_NewWithPosOnlyArgs (C function)" msgstr "PyCode_NewWithPosOnlyArgs(C 函式)" -#: ../../c-api/code.rst:298 +#: ../../c-api/code.rst:302 msgid "_PyEval_RequestCodeExtraIndex (C function)" msgstr "_PyEval_RequestCodeExtraIndex(C 函式)" -#: ../../c-api/code.rst:316 +#: ../../c-api/code.rst:320 msgid "_PyCode_GetExtra (C function)" msgstr "_PyCode_GetExtra(C 函式)" -#: ../../c-api/code.rst:331 +#: ../../c-api/code.rst:335 msgid "_PyCode_SetExtra (C function)" msgstr "_PyCode_SetExtra(C 函式)" diff --git a/c-api/complex.po b/c-api/complex.po index a22103f9b4e..c74dd1a358a 100644 --- a/c-api/complex.po +++ b/c-api/complex.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -127,16 +127,20 @@ msgstr "" "如果 *num* 為 null 且 *exp* 不是正實數,則此方法會回傳零並將 :c:data:`errno` " "設定為 :c:macro:`!EDOM`。" -#: ../../c-api/complex.rst:84 +#: ../../c-api/complex.rst:82 +msgid "Set :c:data:`errno` to :c:macro:`!ERANGE` on overflows." +msgstr "" + +#: ../../c-api/complex.rst:86 msgid "Complex Numbers as Python Objects" msgstr "作為 Python 物件的複數" -#: ../../c-api/complex.rst:89 +#: ../../c-api/complex.rst:91 msgid "" "This subtype of :c:type:`PyObject` represents a Python complex number object." msgstr "這個 :c:type:`PyObject` 的子型別代表一個 Python 複數物件。" -#: ../../c-api/complex.rst:94 +#: ../../c-api/complex.rst:96 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python complex number " "type. It is the same object as :class:`complex` in the Python layer." @@ -144,7 +148,7 @@ msgstr "" "這個 :c:type:`PyTypeObject` 的實例代表 Python 複數型別。它與 Python 層中" "的 :class:`complex` 是同一個物件。" -#: ../../c-api/complex.rst:100 +#: ../../c-api/complex.rst:102 msgid "" "Return true if its argument is a :c:type:`PyComplexObject` or a subtype " "of :c:type:`PyComplexObject`. This function always succeeds." @@ -152,7 +156,7 @@ msgstr "" "如果其引數是一個 :c:type:`PyComplexObject` 或者是 :c:type:`PyComplexObject` " "的子型別,則會回傳 true。這個函式不會失敗。" -#: ../../c-api/complex.rst:106 +#: ../../c-api/complex.rst:108 msgid "" "Return true if its argument is a :c:type:`PyComplexObject`, but not a " "subtype of :c:type:`PyComplexObject`. This function always succeeds." @@ -160,7 +164,7 @@ msgstr "" "如果其引數是一個 :c:type:`PyComplexObject`,但不是 :c:type:`PyComplexObject` " "的子型別,則會回傳 true。這個函式不會失敗。" -#: ../../c-api/complex.rst:112 +#: ../../c-api/complex.rst:114 msgid "" "Create a new Python complex number object from a C :c:type:`Py_complex` " "value. Return ``NULL`` with an exception set on error." @@ -168,7 +172,7 @@ msgstr "" "從 C 的 :c:type:`Py_complex` 值建立一個新的 Python 複數物件。在錯誤時回傳 " "``NULL`` 並設定例外。" -#: ../../c-api/complex.rst:118 +#: ../../c-api/complex.rst:120 msgid "" "Return a new :c:type:`PyComplexObject` object from *real* and *imag*. Return " "``NULL`` with an exception set on error." @@ -176,11 +180,11 @@ msgstr "" "從 *real* 和 *imag* 回傳一個新的 :c:type:`PyComplexObject` 物件。在錯誤時回" "傳 ``NULL`` 並設定例外。" -#: ../../c-api/complex.rst:124 +#: ../../c-api/complex.rst:126 msgid "Return the real part of *op* as a C :c:expr:`double`." msgstr "以 C 的 :c:expr:`double` 形式回傳 *op* 的實部。" -#: ../../c-api/complex.rst:126 +#: ../../c-api/complex.rst:128 msgid "" "If *op* is not a Python complex number object but has " "a :meth:`~object.__complex__` method, this method will first be called to " @@ -192,7 +196,7 @@ msgstr "" "首先會呼叫該方法將 *op* 轉換為 Python 複數物件。如果 :meth:`!__complex__` 並" "未定義,那麼它會回退到呼叫 :func:`PyFloat_AsDouble` 並回傳其結果。" -#: ../../c-api/complex.rst:132 ../../c-api/complex.rst:148 +#: ../../c-api/complex.rst:134 ../../c-api/complex.rst:150 msgid "" "Upon failure, this method returns ``-1.0`` with an exception set, so one " "should call :c:func:`PyErr_Occurred` to check for errors." @@ -200,15 +204,15 @@ msgstr "" "失敗時,此方法回傳 ``-1.0`` 並設定例外,因此應該呼" "叫 :c:func:`PyErr_Occurred` 來檢查錯誤。" -#: ../../c-api/complex.rst:135 ../../c-api/complex.rst:151 +#: ../../c-api/complex.rst:137 ../../c-api/complex.rst:153 msgid "Use :meth:`~object.__complex__` if available." msgstr "如果可用則使用 :meth:`~object.__complex__`。" -#: ../../c-api/complex.rst:140 +#: ../../c-api/complex.rst:142 msgid "Return the imaginary part of *op* as a C :c:expr:`double`." msgstr "將 *op* 的虛部作為 C 的 :c:expr:`double` 回傳。" -#: ../../c-api/complex.rst:142 +#: ../../c-api/complex.rst:144 msgid "" "If *op* is not a Python complex number object but has " "a :meth:`~object.__complex__` method, this method will first be called to " @@ -220,11 +224,11 @@ msgstr "" "首先會呼叫該方法將 *op* 轉換為 Python 複數物件。如果 :meth:`!__complex__` 並" "未定義,那麼它會回退到呼叫 :func:`PyFloat_AsDouble` 並於成功時回傳 ``0.0``。" -#: ../../c-api/complex.rst:156 +#: ../../c-api/complex.rst:158 msgid "Return the :c:type:`Py_complex` value of the complex number *op*." msgstr "回傳複數 *op* 的 :c:type:`Py_complex` 值。" -#: ../../c-api/complex.rst:158 +#: ../../c-api/complex.rst:160 msgid "" "If *op* is not a Python complex number object but has " "a :meth:`~object.__complex__` method, this method will first be called to " @@ -237,7 +241,7 @@ msgstr "" "未定義,那麼它會回退到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未" "定義,則它將繼續回退為 :meth:`~object.__index__`。" -#: ../../c-api/complex.rst:164 +#: ../../c-api/complex.rst:166 msgid "" "Upon failure, this method returns :c:type:`Py_complex` " "with :c:member:`~Py_complex.real` set to ``-1.0`` and with an exception set, " @@ -246,7 +250,7 @@ msgstr "" "失敗時,此方法回傳 :c:type:`Py_complex` 並將 :c:member:`~Py_complex.real` 設" "為 ``-1.0``,並設定例外,因此應該呼叫 :c:func:`PyErr_Occurred` 來檢查錯誤。" -#: ../../c-api/complex.rst:168 +#: ../../c-api/complex.rst:170 msgid "Use :meth:`~object.__index__` if available." msgstr "如果可用則使用 :meth:`~object.__index__`。" diff --git a/c-api/contextvars.po b/c-api/contextvars.po index 07a22f1e5f5..b634c911432 100644 --- a/c-api/contextvars.po +++ b/c-api/contextvars.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-06-27 00:11+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,12 +23,14 @@ msgstr "情境變數物件(Context Variables Objects)" #: ../../c-api/contextvars.rst:15 msgid "" "In Python 3.7.1 the signatures of all context variables C APIs were " -"**changed** to use :c:type:`PyObject` pointers instead of :c:type:" -"`PyContext`, :c:type:`PyContextVar`, and :c:type:`PyContextToken`, e.g.::" +"**changed** to use :c:type:`PyObject` pointers instead " +"of :c:type:`PyContext`, :c:type:`PyContextVar`, " +"and :c:type:`PyContextToken`, e.g.::" msgstr "" -"在 Python 3.7.1 中所有情境變數 C API 的簽名都被\\ **改為**\\ 使用 :c:type:" -"`PyObject` 指標,而不是 :c:type:`PyContext`、:c:type:`PyContextVar` 或 :c:" -"type:`PyContextToken`,例如:" +"在 Python 3.7.1 中所有情境變數 C API 的簽名都被\\ **改為**\\ 使" +"用 :c:type:`PyObject` 指標,而不" +"是 :c:type:`PyContext`、:c:type:`PyContextVar` 或 :c:type:`PyContextToken`," +"例如:" #: ../../c-api/contextvars.rst:20 msgid "" @@ -121,7 +123,9 @@ msgstr "建立一個新的空的情境物件。 如果發生錯誤,則回傳 ` msgid "" "Create a shallow copy of the passed *ctx* context object. Returns ``NULL`` " "if an error has occurred." -msgstr "建立傳入的 *ctx* 情境物件的淺層複製 (shallow copy)。如果發生錯誤,則回傳 ``NULL``。" +msgstr "" +"建立傳入的 *ctx* 情境物件的淺層複製 (shallow copy)。如果發生錯誤,則回傳 " +"``NULL``。" #: ../../c-api/contextvars.rst:90 msgid "" @@ -145,11 +149,61 @@ msgstr "" "關閉 *ctx* 情境,並將目前執行緒的目前情境設回之前的情境。 成功時回傳 ``0``," "錯誤時回傳 ``-1``。" -#: ../../c-api/contextvars.rst:105 +#: ../../c-api/contextvars.rst:106 +msgid "" +"Register *callback* as a context object watcher for the current interpreter. " +"Return an ID which may be passed to :c:func:`PyContext_ClearWatcher`. In " +"case of error (e.g. no more watcher IDs available), return ``-1`` and set an " +"exception." +msgstr "" + +#: ../../c-api/contextvars.rst:115 +msgid "" +"Clear watcher identified by *watcher_id* previously returned " +"from :c:func:`PyContext_AddWatcher` for the current interpreter. Return " +"``0`` on success, or ``-1`` and set an exception on error (e.g. if the given " +"*watcher_id* was never registered.)" +msgstr "" + +#: ../../c-api/contextvars.rst:124 +msgid "Enumeration of possible context object watcher events:" +msgstr "" + +#: ../../c-api/contextvars.rst:126 +msgid "" +"``Py_CONTEXT_SWITCHED``: The :term:`current context` has switched to a " +"different context. The object passed to the watch callback is the now-" +"current :class:`contextvars.Context` object, or None if no context is " +"current." +msgstr "" + +#: ../../c-api/contextvars.rst:135 +msgid "" +"Context object watcher callback function. The object passed to the callback " +"is event-specific; see :c:type:`PyContextEvent` for details." +msgstr "" + +#: ../../c-api/contextvars.rst:138 +msgid "" +"If the callback returns with an exception set, it must return ``-1``; this " +"exception will be printed as an unraisable exception " +"using :c:func:`PyErr_FormatUnraisable`. Otherwise it should return ``0``." +msgstr "" + +#: ../../c-api/contextvars.rst:142 +msgid "" +"There may already be a pending exception set on entry to the callback. In " +"this case, the callback should return ``0`` with the same exception still " +"set. This means the callback may not call any other API that can set an " +"exception unless it saves and clears the exception state first, and restores " +"it before returning." +msgstr "" + +#: ../../c-api/contextvars.rst:151 msgid "Context variable functions:" msgstr "情境變數函式:" -#: ../../c-api/contextvars.rst:109 +#: ../../c-api/contextvars.rst:155 msgid "" "Create a new ``ContextVar`` object. The *name* parameter is used for " "introspection and debug purposes. The *def* parameter specifies a default " @@ -160,7 +214,7 @@ msgstr "" "除錯目的。*def* 參數指定情境變數的預設值,亦可用 ``NULL`` 表示沒有預設值。 如" "果發生錯誤,此函式會回傳 ``NULL``。" -#: ../../c-api/contextvars.rst:116 +#: ../../c-api/contextvars.rst:162 msgid "" "Get the value of a context variable. Returns ``-1`` if an error has " "occurred during lookup, and ``0`` if no error occurred, whether or not a " @@ -169,7 +223,7 @@ msgstr "" "取得情境變數的值。如果在查找過程中發生錯誤則回傳 ``-1``,如果沒有發生錯誤則無" "論是否找到值都會回傳 ``0``。" -#: ../../c-api/contextvars.rst:120 +#: ../../c-api/contextvars.rst:166 msgid "" "If the context variable was found, *value* will be a pointer to it. If the " "context variable was *not* found, *value* will point to:" @@ -177,23 +231,23 @@ msgstr "" "如果找到情境變數,*value* 將會是指向它的指標。如果 *沒有* 找到情境變數," "*value* 將會指到:" -#: ../../c-api/contextvars.rst:123 +#: ../../c-api/contextvars.rst:169 msgid "*default_value*, if not ``NULL``;" msgstr "*default_value* 預設值,但前提是預設值不是 ``NULL``;" -#: ../../c-api/contextvars.rst:124 +#: ../../c-api/contextvars.rst:170 msgid "the default value of *var*, if not ``NULL``;" msgstr "*var* 的預設值,但前提是預設值不是 ``NULL``;" -#: ../../c-api/contextvars.rst:125 +#: ../../c-api/contextvars.rst:171 msgid "``NULL``" msgstr "``NULL``" -#: ../../c-api/contextvars.rst:127 +#: ../../c-api/contextvars.rst:173 msgid "Except for ``NULL``, the function returns a new reference." msgstr "除了 ``NULL`` 之外,此函式會回傳一個新的參照(reference)。" -#: ../../c-api/contextvars.rst:131 +#: ../../c-api/contextvars.rst:177 msgid "" "Set the value of *var* to *value* in the current context. Returns a new " "token object for this change, or ``NULL`` if an error has occurred." @@ -201,12 +255,12 @@ msgstr "" "在目前的情境中將 *var* 的值設為 *value*。會回傳一個用來代表此變更的新 token " "物件,如果發生錯誤則回傳 ``NULL``。" -#: ../../c-api/contextvars.rst:136 +#: ../../c-api/contextvars.rst:182 msgid "" -"Reset the state of the *var* context variable to that it was in before :c:" -"func:`PyContextVar_Set` that returned the *token* was called. This function " -"returns ``0`` on success and ``-1`` on error." +"Reset the state of the *var* context variable to that it was in " +"before :c:func:`PyContextVar_Set` that returned the *token* was called. This " +"function returns ``0`` on success and ``-1`` on error." msgstr "" -"將 *var* 情境變數的狀態設回之前的狀態,亦即上一次回傳 token 的 :c:func:" -"`PyContextVar_Set` 被呼叫前的狀態。此函式在成功時回傳 ``0``,錯誤時回傳 " -"``-1``。" +"將 *var* 情境變數的狀態設回之前的狀態,亦即上一次回傳 token " +"的 :c:func:`PyContextVar_Set` 被呼叫前的狀態。此函式在成功時回傳 ``0``,錯誤" +"時回傳 ``-1``。" diff --git a/c-api/conversion.po b/c-api/conversion.po index a8c2e006996..633c29b437a 100644 --- a/c-api/conversion.po +++ b/c-api/conversion.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-27 00:03+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-12-11 18:26+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "用於數字轉換和格式化字串輸出的函式。" #: ../../c-api/conversion.rst:13 msgid "" "Output not more than *size* bytes to *str* according to the format string " -"*format* and the extra arguments. See the Unix man page :manpage:" -"`snprintf(3)`." +"*format* and the extra arguments. See the Unix man " +"page :manpage:`snprintf(3)`." msgstr "" "根據格式字串 *format* 和額外引數,輸出不超過 *size* 位元組給 *str*。請參閱 " "Unix 手冊頁面 :manpage:`snprintf(3)`。" @@ -40,8 +40,8 @@ msgstr "" #: ../../c-api/conversion.rst:19 msgid "" "Output not more than *size* bytes to *str* according to the format string " -"*format* and the variable argument list *va*. Unix man page :manpage:" -"`vsnprintf(3)`." +"*format* and the variable argument list *va*. Unix man " +"page :manpage:`vsnprintf(3)`." msgstr "" "根據格式字串 *format* 和變數引數串列 *va*,輸出不超過 *size* 位元組給 *str*。" "Unix 手冊頁面 :manpage:`vsnprintf(3)`。" @@ -53,9 +53,9 @@ msgid "" "is to guarantee consistent behavior in corner cases, which the Standard C " "functions do not." msgstr "" -":c:func:`PyOS_snprintf` 和 :c:func:`PyOS_vsnprintf` 包裝標準 C 函式庫函式 :c:" -"func:`snprintf` 和 :c:func:`vsnprintf`。它們的目的是確保邊角案例 (corner " -"case) 下的行為一致,而標準 C 函式則不然。" +":c:func:`PyOS_snprintf` 和 :c:func:`PyOS_vsnprintf` 包裝標準 C 函式庫函" +"式 :c:func:`snprintf` 和 :c:func:`vsnprintf`。它們的目的是確保邊角案例 " +"(corner case) 下的行為一致,而標準 C 函式則不然。" #: ../../c-api/conversion.rst:28 msgid "" @@ -129,9 +129,9 @@ msgstr "" #: ../../c-api/conversion.rst:63 msgid "" "If the converted value falls out of range of corresponding return type, " -"range error occurs (:c:data:`errno` is set to :c:macro:`!ERANGE`) and :c:" -"macro:`!ULONG_MAX` is returned. If no conversion can be performed, ``0`` is " -"returned." +"range error occurs (:c:data:`errno` is set to :c:macro:`!ERANGE`) " +"and :c:macro:`!ULONG_MAX` is returned. If no conversion can be performed, " +"``0`` is returned." msgstr "" #: ../../c-api/conversion.rst:68 @@ -169,9 +169,9 @@ msgstr "" #: ../../c-api/conversion.rst:95 msgid "" -"If ``endptr`` is ``NULL``, convert the whole string. Raise :exc:" -"`ValueError` and return ``-1.0`` if the string is not a valid representation " -"of a floating-point number." +"If ``endptr`` is ``NULL``, convert the whole string. " +"Raise :exc:`ValueError` and return ``-1.0`` if the string is not a valid " +"representation of a floating-point number." msgstr "" "如果 ``endptr`` 為 ``NULL``,則轉換整個字串。如果字串不是浮點數的有效表示,則" "引發 :exc:`ValueError` 並回傳 ``-1.0``。" @@ -189,10 +189,11 @@ msgstr "" "指向字串的開頭,引發 ValueError 並回傳 ``-1.0``。" #: ../../c-api/conversion.rst:106 +#, fuzzy msgid "" "If ``s`` represents a value that is too large to store in a float (for " "example, ``\"1e500\"`` is such a string on many platforms) then if " -"``overflow_exception`` is ``NULL`` return ``Py_HUGE_VAL`` (with an " +"``overflow_exception`` is ``NULL`` return ``Py_INFINITY`` (with an " "appropriate sign) and don't set any exception. Otherwise, " "``overflow_exception`` must point to a Python exception object; raise that " "exception and return ``-1.0``. In both cases, set ``*endptr`` to point to " diff --git a/c-api/dict.po b/c-api/dict.po index b11b75f7753..c0e86e7f564 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-21 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -156,8 +156,8 @@ msgstr "" #: ../../c-api/dict.rst:129 msgid "" -"Calling this API without :term:`GIL` held had been allowed for historical " -"reason. It is no longer allowed." +"Calling this API without an :term:`attached thread state` had been allowed " +"for historical reason. It is no longer allowed." msgstr "" #: ../../c-api/dict.rst:136 @@ -368,7 +368,18 @@ msgstr "" "}\n" "Py_END_CRITICAL_SECTION();" -#: ../../c-api/dict.rst:307 +#: ../../c-api/dict.rst:306 +msgid "" +"On the free-threaded build, this function can be used safely inside a " +"critical section. However, the references returned for *pkey* and *pvalue* " +"are :term:`borrowed ` and are only valid while the " +"critical section is held. If you need to use these objects outside the " +"critical section or when the critical section can be suspended, create " +"a :term:`strong reference ` (for example, " +"using :c:func:`Py_NewRef`)." +msgstr "" + +#: ../../c-api/dict.rst:316 msgid "" "Iterate over mapping object *b* adding key-value pairs to dictionary *a*. " "*b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` " @@ -378,7 +389,7 @@ msgid "" "or ``-1`` if an exception was raised." msgstr "" -#: ../../c-api/dict.rst:317 +#: ../../c-api/dict.rst:326 msgid "" "This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to " "``a.update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall " @@ -387,7 +398,7 @@ msgid "" "exception was raised." msgstr "" -#: ../../c-api/dict.rst:326 +#: ../../c-api/dict.rst:335 msgid "" "Update or merge into dictionary *a*, from the key-value pairs in *seq2*. " "*seq2* must be an iterable object producing iterable objects of length 2, " @@ -396,7 +407,7 @@ msgid "" "if an exception was raised. Equivalent Python (except for the return value)::" msgstr "" -#: ../../c-api/dict.rst:333 +#: ../../c-api/dict.rst:342 msgid "" "def PyDict_MergeFromSeq2(a, seq2, override):\n" " for key, value in seq2:\n" @@ -408,7 +419,7 @@ msgstr "" " if override or key not in a:\n" " a[key] = value" -#: ../../c-api/dict.rst:340 +#: ../../c-api/dict.rst:349 msgid "" "Register *callback* as a dictionary watcher. Return a non-negative integer " "id which must be passed to future calls to :c:func:`PyDict_Watch`. In case " @@ -416,21 +427,21 @@ msgid "" "exception." msgstr "" -#: ../../c-api/dict.rst:349 +#: ../../c-api/dict.rst:358 msgid "" "Clear watcher identified by *watcher_id* previously returned " "from :c:func:`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error " "(e.g. if the given *watcher_id* was never registered.)" msgstr "" -#: ../../c-api/dict.rst:357 +#: ../../c-api/dict.rst:366 msgid "" "Mark dictionary *dict* as watched. The callback granted *watcher_id* " "by :c:func:`PyDict_AddWatcher` will be called when *dict* is modified or " "deallocated. Return ``0`` on success or ``-1`` on error." msgstr "" -#: ../../c-api/dict.rst:365 +#: ../../c-api/dict.rst:374 msgid "" "Mark dictionary *dict* as no longer watched. The callback granted " "*watcher_id* by :c:func:`PyDict_AddWatcher` will no longer be called when " @@ -438,7 +449,7 @@ msgid "" "watched by this watcher. Return ``0`` on success or ``-1`` on error." msgstr "" -#: ../../c-api/dict.rst:374 +#: ../../c-api/dict.rst:383 msgid "" "Enumeration of possible dictionary watcher events: ``PyDict_EVENT_ADDED``, " "``PyDict_EVENT_MODIFIED``, ``PyDict_EVENT_DELETED``, " @@ -446,11 +457,11 @@ msgid "" "``PyDict_EVENT_DEALLOCATED``." msgstr "" -#: ../../c-api/dict.rst:382 +#: ../../c-api/dict.rst:391 msgid "Type of a dict watcher callback function." msgstr "" -#: ../../c-api/dict.rst:384 +#: ../../c-api/dict.rst:393 msgid "" "If *event* is ``PyDict_EVENT_CLEARED`` or ``PyDict_EVENT_DEALLOCATED``, both " "*key* and *new_value* will be ``NULL``. If *event* is ``PyDict_EVENT_ADDED`` " @@ -459,7 +470,7 @@ msgid "" "dictionary and *new_value* will be ``NULL``." msgstr "" -#: ../../c-api/dict.rst:390 +#: ../../c-api/dict.rst:399 msgid "" "``PyDict_EVENT_CLONED`` occurs when *dict* was previously empty and another " "dict is merged into it. To maintain efficiency of this operation, per-key " @@ -467,14 +478,14 @@ msgid "" "``PyDict_EVENT_CLONED`` is issued, and *key* will be the source dictionary." msgstr "" -#: ../../c-api/dict.rst:396 +#: ../../c-api/dict.rst:405 msgid "" "The callback may inspect but must not modify *dict*; doing so could have " "unpredictable effects, including infinite recursion. Do not trigger Python " "code execution in the callback, as it could modify the dict as a side effect." msgstr "" -#: ../../c-api/dict.rst:400 +#: ../../c-api/dict.rst:409 msgid "" "If *event* is ``PyDict_EVENT_DEALLOCATED``, taking a new reference in the " "callback to the about-to-be-destroyed dictionary will resurrect it and " @@ -483,20 +494,20 @@ msgid "" "again." msgstr "" -#: ../../c-api/dict.rst:406 +#: ../../c-api/dict.rst:415 msgid "" "Callbacks occur before the notified modification to *dict* takes place, so " "the prior state of *dict* can be inspected." msgstr "" -#: ../../c-api/dict.rst:409 +#: ../../c-api/dict.rst:418 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " "will be printed as an unraisable exception " "using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -#: ../../c-api/dict.rst:413 +#: ../../c-api/dict.rst:422 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " diff --git a/c-api/exceptions.po b/c-api/exceptions.po index 4dd9f8c9151..03fb297eac7 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-11 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -93,9 +93,9 @@ msgstr "" msgid "" "If *set_sys_last_vars* is nonzero, the variable :data:`sys.last_exc` is set " "to the printed exception. For backwards compatibility, the deprecated " -"variables :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys." -"last_traceback` are also set to the type, value and traceback of this " -"exception, respectively." +"variables :data:`sys.last_type`, :data:`sys.last_value` " +"and :data:`sys.last_traceback` are also set to the type, value and traceback " +"of this exception, respectively." msgstr "" #: ../../c-api/exceptions.rst:69 @@ -185,8 +185,8 @@ msgstr "" msgid "" "This function sets the error indicator and returns ``NULL``. *exception* " "should be a Python exception class. The *format* and subsequent parameters " -"help format the error message; they have the same meaning and values as in :" -"c:func:`PyUnicode_FromFormat`. *format* is an ASCII-encoded string." +"help format the error message; they have the same meaning and values as " +"in :c:func:`PyUnicode_FromFormat`. *format* is an ASCII-encoded string." msgstr "" #: ../../c-api/exceptions.rst:156 @@ -218,13 +218,14 @@ msgid "" "This is a convenience function to raise an exception when a C library " "function has returned an error and set the C variable :c:data:`errno`. It " "constructs a tuple object whose first item is the integer :c:data:`errno` " -"value and whose second item is the corresponding error message (gotten from :" -"c:func:`!strerror`), and then calls ``PyErr_SetObject(type, object)``. On " -"Unix, when the :c:data:`errno` value is :c:macro:`!EINTR`, indicating an " -"interrupted system call, this calls :c:func:`PyErr_CheckSignals`, and if " -"that set the error indicator, leaves it set to that. The function always " -"returns ``NULL``, so a wrapper function around a system call can write " -"``return PyErr_SetFromErrno(type);`` when the system call returns an error." +"value and whose second item is the corresponding error message (gotten " +"from :c:func:`!strerror`), and then calls ``PyErr_SetObject(type, " +"object)``. On Unix, when the :c:data:`errno` value is :c:macro:`!EINTR`, " +"indicating an interrupted system call, this " +"calls :c:func:`PyErr_CheckSignals`, and if that set the error indicator, " +"leaves it set to that. The function always returns ``NULL``, so a wrapper " +"function around a system call can write ``return PyErr_SetFromErrno(type);`` " +"when the system call returns an error." msgstr "" #: ../../c-api/exceptions.rst:199 @@ -279,9 +280,9 @@ msgstr "" msgid "" "Similar to :c:func:`PyErr_SetFromWindowsErr`, with the additional behavior " "that if *filename* is not ``NULL``, it is decoded from the filesystem " -"encoding (:func:`os.fsdecode`) and passed to the constructor of :exc:" -"`OSError` as a third parameter to be used to define the :attr:`!filename` " -"attribute of the exception instance." +"encoding (:func:`os.fsdecode`) and passed to the constructor " +"of :exc:`OSError` as a third parameter to be used to define the :attr:`!" +"filename` attribute of the exception instance." msgstr "" #: ../../c-api/exceptions.rst:258 @@ -372,53 +373,55 @@ msgid "" "below) or ``NULL``; the *message* argument is a UTF-8 encoded string. " "*stack_level* is a positive number giving a number of stack frames; the " "warning will be issued from the currently executing line of code in that " -"stack frame. A *stack_level* of 1 is the function calling :c:func:" -"`PyErr_WarnEx`, 2 is the function above that, and so forth." +"stack frame. A *stack_level* of 1 is the function " +"calling :c:func:`PyErr_WarnEx`, 2 is the function above that, and so forth." msgstr "" #: ../../c-api/exceptions.rst:359 msgid "" -"Warning categories must be subclasses of :c:data:`PyExc_Warning`; :c:data:" -"`PyExc_Warning` is a subclass of :c:data:`PyExc_Exception`; the default " -"warning category is :c:data:`PyExc_RuntimeWarning`. The standard Python " -"warning categories are available as global variables whose names are " -"enumerated at :ref:`standardwarningcategories`." +"Warning categories must be subclasses " +"of :c:data:`PyExc_Warning`; :c:data:`PyExc_Warning` is a subclass " +"of :c:data:`PyExc_Exception`; the default warning category " +"is :c:data:`PyExc_RuntimeWarning`. The standard Python warning categories " +"are available as global variables whose names are enumerated " +"at :ref:`standardwarningcategories`." msgstr "" #: ../../c-api/exceptions.rst:365 msgid "" -"For information about warning control, see the documentation for the :mod:" -"`warnings` module and the :option:`-W` option in the command line " +"For information about warning control, see the documentation for " +"the :mod:`warnings` module and the :option:`-W` option in the command line " "documentation. There is no C API for warning control." msgstr "" #: ../../c-api/exceptions.rst:372 msgid "" "Issue a warning message with explicit control over all warning attributes. " -"This is a straightforward wrapper around the Python function :func:`warnings." -"warn_explicit`; see there for more information. The *module* and *registry* " -"arguments may be set to ``NULL`` to get the default effect described there." +"This is a straightforward wrapper around the Python " +"function :func:`warnings.warn_explicit`; see there for more information. " +"The *module* and *registry* arguments may be set to ``NULL`` to get the " +"default effect described there." msgstr "" #: ../../c-api/exceptions.rst:383 msgid "" "Similar to :c:func:`PyErr_WarnExplicitObject` except that *message* and " -"*module* are UTF-8 encoded strings, and *filename* is decoded from the :term:" -"`filesystem encoding and error handler`." +"*module* are UTF-8 encoded strings, and *filename* is decoded from " +"the :term:`filesystem encoding and error handler`." msgstr "" #: ../../c-api/exceptions.rst:390 msgid "" -"Function similar to :c:func:`PyErr_WarnEx`, but use :c:func:" -"`PyUnicode_FromFormat` to format the warning message. *format* is an ASCII-" -"encoded string." +"Function similar to :c:func:`PyErr_WarnEx`, but " +"use :c:func:`PyUnicode_FromFormat` to format the warning message. *format* " +"is an ASCII-encoded string." msgstr "" #: ../../c-api/exceptions.rst:399 msgid "" -"Function similar to :c:func:`PyErr_WarnFormat`, but *category* is :exc:" -"`ResourceWarning` and it passes *source* to :class:`!warnings." -"WarningMessage`." +"Function similar to :c:func:`PyErr_WarnFormat`, but *category* " +"is :exc:`ResourceWarning` and it passes *source* to :class:`!" +"warnings.WarningMessage`." msgstr "" #: ../../c-api/exceptions.rst:406 @@ -430,20 +433,21 @@ msgid "" "Test whether the error indicator is set. If set, return the exception " "*type* (the first argument to the last call to one of the ``PyErr_Set*`` " "functions or to :c:func:`PyErr_Restore`). If not set, return ``NULL``. You " -"do not own a reference to the return value, so you do not need to :c:func:" -"`Py_DECREF` it." +"do not own a reference to the return value, so you do not need " +"to :c:func:`Py_DECREF` it." msgstr "" #: ../../c-api/exceptions.rst:416 -msgid "The caller must hold the GIL." -msgstr "呼叫者必須持有 GIL。" +msgid "The caller must have an :term:`attached thread state`." +msgstr "" #: ../../c-api/exceptions.rst:420 msgid "" -"Do not compare the return value to a specific exception; use :c:func:" -"`PyErr_ExceptionMatches` instead, shown below. (The comparison could easily " -"fail since the exception may be an instance instead of a class, in the case " -"of a class exception, or it may be a subclass of the expected exception.)" +"Do not compare the return value to a specific exception; " +"use :c:func:`PyErr_ExceptionMatches` instead, shown below. (The comparison " +"could easily fail since the exception may be an instance instead of a class, " +"in the case of a class exception, or it may be a subclass of the expected " +"exception.)" msgstr "" #: ../../c-api/exceptions.rst:428 @@ -592,9 +596,10 @@ msgstr "" #: ../../c-api/exceptions.rst:545 msgid "" -"This function *does not* implicitly set the :attr:`~BaseException." -"__traceback__` attribute on the exception value. If setting the traceback " -"appropriately is desired, the following additional snippet is needed::" +"This function *does not* implicitly set " +"the :attr:`~BaseException.__traceback__` attribute on the exception value. " +"If setting the traceback appropriately is desired, the following additional " +"snippet is needed::" msgstr "" #: ../../c-api/exceptions.rst:550 @@ -609,10 +614,11 @@ msgstr "" #: ../../c-api/exceptions.rst:557 msgid "" -"Retrieve the active exception instance, as would be returned by :func:`sys." -"exception`. This refers to an exception that was *already caught*, not to an " -"exception that was freshly raised. Returns a new reference to the exception " -"or ``NULL``. Does not modify the interpreter's exception state." +"Retrieve the active exception instance, as would be returned " +"by :func:`sys.exception`. This refers to an exception that was *already " +"caught*, not to an exception that was freshly raised. Returns a new " +"reference to the exception or ``NULL``. Does not modify the interpreter's " +"exception state." msgstr "" #: ../../c-api/exceptions.rst:564 @@ -640,12 +646,12 @@ msgstr "" #: ../../c-api/exceptions.rst:589 msgid "" -"Retrieve the old-style representation of the exception info, as known from :" -"func:`sys.exc_info`. This refers to an exception that was *already caught*, " -"not to an exception that was freshly raised. Returns new references for the " -"three objects, any of which may be ``NULL``. Does not modify the exception " -"info state. This function is kept for backwards compatibility. Prefer " -"using :c:func:`PyErr_GetHandledException`." +"Retrieve the old-style representation of the exception info, as known " +"from :func:`sys.exc_info`. This refers to an exception that was *already " +"caught*, not to an exception that was freshly raised. Returns new " +"references for the three objects, any of which may be ``NULL``. Does not " +"modify the exception info state. This function is kept for backwards " +"compatibility. Prefer using :c:func:`PyErr_GetHandledException`." msgstr "" #: ../../c-api/exceptions.rst:598 @@ -662,8 +668,8 @@ msgid "" "exception that was *already caught*, not to an exception that was freshly " "raised. This function steals the references of the arguments. To clear the " "exception state, pass ``NULL`` for all three arguments. This function is " -"kept for backwards compatibility. Prefer using :c:func:" -"`PyErr_SetHandledException`." +"kept for backwards compatibility. Prefer " +"using :c:func:`PyErr_SetHandledException`." msgstr "" #: ../../c-api/exceptions.rst:617 @@ -702,8 +708,8 @@ msgid "" "The function attempts to handle all pending signals, and then returns ``0``. " "However, if a Python signal handler raises an exception, the error indicator " "is set and the function returns ``-1`` immediately (such that other pending " -"signals may not have been handled yet: they will be on the next :c:func:" -"`PyErr_CheckSignals()` invocation)." +"signals may not have been handled yet: they will be on the " +"next :c:func:`PyErr_CheckSignals()` invocation)." msgstr "" #: ../../c-api/exceptions.rst:655 @@ -720,8 +726,8 @@ msgstr "" #: ../../c-api/exceptions.rst:662 msgid "" -"The default Python signal handler for :c:macro:`!SIGINT` raises the :exc:" -"`KeyboardInterrupt` exception." +"The default Python signal handler for :c:macro:`!SIGINT` raises " +"the :exc:`KeyboardInterrupt` exception." msgstr "" #: ../../c-api/exceptions.rst:673 @@ -732,15 +738,15 @@ msgstr "" #: ../../c-api/exceptions.rst:677 ../../c-api/exceptions.rst:704 msgid "" -"This function is async-signal-safe. It can be called without the :term:" -"`GIL` and from a C signal handler." +"This function is async-signal-safe. It can be called without " +"an :term:`attached thread state` and from a C signal handler." msgstr "" #: ../../c-api/exceptions.rst:687 msgid "" -"Simulate the effect of a signal arriving. The next time :c:func:" -"`PyErr_CheckSignals` is called, the Python signal handler for the given " -"signal number will be called." +"Simulate the effect of a signal arriving. The next " +"time :c:func:`PyErr_CheckSignals` is called, the Python signal handler for " +"the given signal number will be called." msgstr "" #: ../../c-api/exceptions.rst:691 @@ -753,8 +759,9 @@ msgstr "" #: ../../c-api/exceptions.rst:696 msgid "" -"If the given signal isn't handled by Python (it was set to :py:const:`signal." -"SIG_DFL` or :py:const:`signal.SIG_IGN`), it will be ignored." +"If the given signal isn't handled by Python (it was set " +"to :py:const:`signal.SIG_DFL` or :py:const:`signal.SIG_IGN`), it will be " +"ignored." msgstr "" #: ../../c-api/exceptions.rst:699 @@ -889,11 +896,11 @@ msgid "" "Implement part of the interpreter's implementation of :keyword:`!except*`. " "*orig* is the original exception that was caught, and *excs* is the list of " "the exceptions that need to be raised. This list contains the unhandled part " -"of *orig*, if any, as well as the exceptions that were raised from the :" -"keyword:`!except*` clauses (so they have a different traceback from *orig*) " -"and those that were reraised (and have the same traceback as *orig*). Return " -"the :exc:`ExceptionGroup` that needs to be reraised in the end, or ``None`` " -"if there is nothing to reraise." +"of *orig*, if any, as well as the exceptions that were raised from " +"the :keyword:`!except*` clauses (so they have a different traceback from " +"*orig*) and those that were reraised (and have the same traceback as " +"*orig*). Return the :exc:`ExceptionGroup` that needs to be reraised in the " +"end, or ``None`` if there is nothing to reraise." msgstr "" #: ../../c-api/exceptions.rst:837 @@ -928,40 +935,68 @@ msgid "" "on failure." msgstr "" -#: ../../c-api/exceptions.rst:870 +#: ../../c-api/exceptions.rst:866 +msgid "" +"If the :attr:`UnicodeError.object` is an empty sequence, the resulting " +"*start* is ``0``. Otherwise, it is clipped to ``[0, len(object) - 1]``." +msgstr "" + +#: ../../c-api/exceptions.rst:869 +#, fuzzy +msgid ":attr:`UnicodeError.start`" +msgstr ":exc:`UnicodeError`" + +#: ../../c-api/exceptions.rst:875 msgid "" -"Set the *start* attribute of the given exception object to *start*. Return " +"Set the *start* attribute of the given exception object to *start*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:877 +#: ../../c-api/exceptions.rst:880 +msgid "" +"While passing a negative *start* does not raise an exception, the " +"corresponding getters will not consider it as a relative offset." +msgstr "" + +#: ../../c-api/exceptions.rst:888 msgid "" "Get the *end* attribute of the given exception object and place it into " "*\\*end*. *end* must not be ``NULL``. Return ``0`` on success, ``-1`` on " "failure." msgstr "" -#: ../../c-api/exceptions.rst:885 +#: ../../c-api/exceptions.rst:892 +msgid "" +"If the :attr:`UnicodeError.object` is an empty sequence, the resulting *end* " +"is ``0``. Otherwise, it is clipped to ``[1, len(object)]``." +msgstr "" + +#: ../../c-api/exceptions.rst:899 msgid "" "Set the *end* attribute of the given exception object to *end*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:892 +#: ../../c-api/exceptions.rst:902 +#, fuzzy +msgid ":attr:`UnicodeError.end`" +msgstr ":exc:`UnicodeError`" + +#: ../../c-api/exceptions.rst:908 msgid "Return the *reason* attribute of the given exception object." msgstr "回傳給定例外物件的 *reason* 屬性。" -#: ../../c-api/exceptions.rst:898 +#: ../../c-api/exceptions.rst:914 msgid "" "Set the *reason* attribute of the given exception object to *reason*. " "Return ``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:905 +#: ../../c-api/exceptions.rst:921 msgid "Recursion Control" msgstr "遞迴控制" -#: ../../c-api/exceptions.rst:907 +#: ../../c-api/exceptions.rst:923 msgid "" "These two functions provide a way to perform safe recursive calls at the C " "level, both in the core and in extension modules. They are needed if the " @@ -971,454 +1006,436 @@ msgid "" "recursion handling." msgstr "" -#: ../../c-api/exceptions.rst:916 +#: ../../c-api/exceptions.rst:932 msgid "Marks a point where a recursive C-level call is about to be performed." msgstr "" -#: ../../c-api/exceptions.rst:918 +#: ../../c-api/exceptions.rst:934 msgid "" -"If :c:macro:`!USE_STACKCHECK` is defined, this function checks if the OS " -"stack overflowed using :c:func:`PyOS_CheckStack`. If this is the case, it " -"sets a :exc:`MemoryError` and returns a nonzero value." -msgstr "" - -#: ../../c-api/exceptions.rst:922 -msgid "" -"The function then checks if the recursion limit is reached. If this is the " +"The function then checks if the stack limit is reached. If this is the " "case, a :exc:`RecursionError` is set and a nonzero value is returned. " "Otherwise, zero is returned." msgstr "" -#: ../../c-api/exceptions.rst:926 +#: ../../c-api/exceptions.rst:938 msgid "" "*where* should be a UTF-8 encoded string such as ``\" in instance check\"`` " "to be concatenated to the :exc:`RecursionError` message caused by the " "recursion depth limit." msgstr "" -#: ../../c-api/exceptions.rst:930 ../../c-api/exceptions.rst:938 +#: ../../c-api/exceptions.rst:942 ../../c-api/exceptions.rst:950 msgid "" "This function is now also available in the :ref:`limited API `." msgstr "" -#: ../../c-api/exceptions.rst:935 +#: ../../c-api/exceptions.rst:947 msgid "" "Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each " "*successful* invocation of :c:func:`Py_EnterRecursiveCall`." msgstr "" -#: ../../c-api/exceptions.rst:941 +#: ../../c-api/exceptions.rst:953 msgid "" "Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types " -"requires special recursion handling. In addition to protecting the stack, :" -"c:member:`~PyTypeObject.tp_repr` also needs to track objects to prevent " -"cycles. The following two functions facilitate this functionality. " +"requires special recursion handling. In addition to protecting the " +"stack, :c:member:`~PyTypeObject.tp_repr` also needs to track objects to " +"prevent cycles. The following two functions facilitate this functionality. " "Effectively, these are the C equivalent to :func:`reprlib.recursive_repr`." msgstr "" -#: ../../c-api/exceptions.rst:949 +#: ../../c-api/exceptions.rst:961 msgid "" "Called at the beginning of the :c:member:`~PyTypeObject.tp_repr` " "implementation to detect cycles." msgstr "" -#: ../../c-api/exceptions.rst:952 +#: ../../c-api/exceptions.rst:964 msgid "" "If the object has already been processed, the function returns a positive " "integer. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " -"should return a string object indicating a cycle. As examples, :class:" -"`dict` objects return ``{...}`` and :class:`list` objects return ``[...]``." +"should return a string object indicating a cycle. As " +"examples, :class:`dict` objects return ``{...}`` and :class:`list` objects " +"return ``[...]``." msgstr "" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:970 msgid "" "The function will return a negative integer if the recursion limit is " "reached. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " "should typically return ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:962 +#: ../../c-api/exceptions.rst:974 msgid "" -"Otherwise, the function returns zero and the :c:member:`~PyTypeObject." -"tp_repr` implementation can continue normally." +"Otherwise, the function returns zero and " +"the :c:member:`~PyTypeObject.tp_repr` implementation can continue normally." msgstr "" -#: ../../c-api/exceptions.rst:967 +#: ../../c-api/exceptions.rst:979 msgid "" -"Ends a :c:func:`Py_ReprEnter`. Must be called once for each invocation of :" -"c:func:`Py_ReprEnter` that returns zero." +"Ends a :c:func:`Py_ReprEnter`. Must be called once for each invocation " +"of :c:func:`Py_ReprEnter` that returns zero." msgstr "" -#: ../../c-api/exceptions.rst:974 +#: ../../c-api/exceptions.rst:986 msgid "Exception and warning types" msgstr "例外和警告型別" -#: ../../c-api/exceptions.rst:976 +#: ../../c-api/exceptions.rst:988 msgid "" "All standard Python exceptions and warning categories are available as " "global variables whose names are ``PyExc_`` followed by the Python exception " "name. These have the type :c:expr:`PyObject*`; they are all class objects." msgstr "" -#: ../../c-api/exceptions.rst:980 +#: ../../c-api/exceptions.rst:992 msgid "For completeness, here are all the variables:" msgstr "" -#: ../../c-api/exceptions.rst:983 +#: ../../c-api/exceptions.rst:995 msgid "Exception types" msgstr "例外型別" -#: ../../c-api/exceptions.rst:990 ../../c-api/exceptions.rst:1136 -#: ../../c-api/exceptions.rst:1166 +#: ../../c-api/exceptions.rst:1002 ../../c-api/exceptions.rst:1148 +#: ../../c-api/exceptions.rst:1178 msgid "C name" msgstr "C 名稱" -#: ../../c-api/exceptions.rst:991 ../../c-api/exceptions.rst:1137 -#: ../../c-api/exceptions.rst:1167 +#: ../../c-api/exceptions.rst:1003 ../../c-api/exceptions.rst:1149 +#: ../../c-api/exceptions.rst:1179 msgid "Python name" msgstr "Python 名稱" -#: ../../c-api/exceptions.rst:993 +#: ../../c-api/exceptions.rst:1005 msgid ":exc:`BaseException`" msgstr ":exc:`BaseException`" -#: ../../c-api/exceptions.rst:995 +#: ../../c-api/exceptions.rst:1007 msgid ":exc:`BaseExceptionGroup`" msgstr ":exc:`BaseExceptionGroup`" -#: ../../c-api/exceptions.rst:997 +#: ../../c-api/exceptions.rst:1009 msgid ":exc:`Exception`" msgstr ":exc:`Exception`" -#: ../../c-api/exceptions.rst:999 +#: ../../c-api/exceptions.rst:1011 msgid ":exc:`ArithmeticError`" msgstr ":exc:`ArithmeticError`" -#: ../../c-api/exceptions.rst:1001 +#: ../../c-api/exceptions.rst:1013 msgid ":exc:`AssertionError`" msgstr ":exc:`AssertionError`" -#: ../../c-api/exceptions.rst:1003 +#: ../../c-api/exceptions.rst:1015 msgid ":exc:`AttributeError`" msgstr ":exc:`AttributeError`" -#: ../../c-api/exceptions.rst:1005 +#: ../../c-api/exceptions.rst:1017 msgid ":exc:`BlockingIOError`" msgstr ":exc:`BlockingIOError`" -#: ../../c-api/exceptions.rst:1007 +#: ../../c-api/exceptions.rst:1019 msgid ":exc:`BrokenPipeError`" msgstr ":exc:`BrokenPipeError`" -#: ../../c-api/exceptions.rst:1009 +#: ../../c-api/exceptions.rst:1021 msgid ":exc:`BufferError`" msgstr ":exc:`BufferError`" -#: ../../c-api/exceptions.rst:1011 +#: ../../c-api/exceptions.rst:1023 msgid ":exc:`ChildProcessError`" msgstr ":exc:`ChildProcessError`" -#: ../../c-api/exceptions.rst:1013 +#: ../../c-api/exceptions.rst:1025 msgid ":exc:`ConnectionAbortedError`" msgstr ":exc:`ConnectionAbortedError`" -#: ../../c-api/exceptions.rst:1015 +#: ../../c-api/exceptions.rst:1027 msgid ":exc:`ConnectionError`" msgstr ":exc:`ConnectionError`" -#: ../../c-api/exceptions.rst:1017 +#: ../../c-api/exceptions.rst:1029 msgid ":exc:`ConnectionRefusedError`" msgstr ":exc:`ConnectionRefusedError`" -#: ../../c-api/exceptions.rst:1019 +#: ../../c-api/exceptions.rst:1031 msgid ":exc:`ConnectionResetError`" msgstr ":exc:`ConnectionResetError`" -#: ../../c-api/exceptions.rst:1021 +#: ../../c-api/exceptions.rst:1033 msgid ":exc:`EOFError`" msgstr ":exc:`EOFError`" -#: ../../c-api/exceptions.rst:1023 +#: ../../c-api/exceptions.rst:1035 msgid ":exc:`FileExistsError`" msgstr ":exc:`FileExistsError`" -#: ../../c-api/exceptions.rst:1025 +#: ../../c-api/exceptions.rst:1037 msgid ":exc:`FileNotFoundError`" msgstr ":exc:`FileNotFoundError`" -#: ../../c-api/exceptions.rst:1027 +#: ../../c-api/exceptions.rst:1039 msgid ":exc:`FloatingPointError`" msgstr ":exc:`FloatingPointError`" -#: ../../c-api/exceptions.rst:1029 +#: ../../c-api/exceptions.rst:1041 msgid ":exc:`GeneratorExit`" msgstr ":exc:`GeneratorExit`" -#: ../../c-api/exceptions.rst:1031 +#: ../../c-api/exceptions.rst:1043 msgid ":exc:`ImportError`" msgstr ":exc:`ImportError`" -#: ../../c-api/exceptions.rst:1033 +#: ../../c-api/exceptions.rst:1045 msgid ":exc:`IndentationError`" msgstr ":exc:`IndentationError`" -#: ../../c-api/exceptions.rst:1035 +#: ../../c-api/exceptions.rst:1047 msgid ":exc:`IndexError`" msgstr ":exc:`IndexError`" -#: ../../c-api/exceptions.rst:1037 +#: ../../c-api/exceptions.rst:1049 msgid ":exc:`InterruptedError`" msgstr ":exc:`InterruptedError`" -#: ../../c-api/exceptions.rst:1039 +#: ../../c-api/exceptions.rst:1051 msgid ":exc:`IsADirectoryError`" msgstr ":exc:`IsADirectoryError`" -#: ../../c-api/exceptions.rst:1041 +#: ../../c-api/exceptions.rst:1053 msgid ":exc:`KeyError`" msgstr ":exc:`KeyError`" -#: ../../c-api/exceptions.rst:1043 +#: ../../c-api/exceptions.rst:1055 msgid ":exc:`KeyboardInterrupt`" msgstr ":exc:`KeyboardInterrupt`" -#: ../../c-api/exceptions.rst:1045 +#: ../../c-api/exceptions.rst:1057 msgid ":exc:`LookupError`" msgstr ":exc:`LookupError`" -#: ../../c-api/exceptions.rst:1047 +#: ../../c-api/exceptions.rst:1059 msgid ":exc:`MemoryError`" msgstr ":exc:`MemoryError`" -#: ../../c-api/exceptions.rst:1049 +#: ../../c-api/exceptions.rst:1061 msgid ":exc:`ModuleNotFoundError`" msgstr ":exc:`ModuleNotFoundError`" -#: ../../c-api/exceptions.rst:1051 +#: ../../c-api/exceptions.rst:1063 msgid ":exc:`NameError`" msgstr ":exc:`NameError`" -#: ../../c-api/exceptions.rst:1053 +#: ../../c-api/exceptions.rst:1065 msgid ":exc:`NotADirectoryError`" msgstr ":exc:`NotADirectoryError`" -#: ../../c-api/exceptions.rst:1055 +#: ../../c-api/exceptions.rst:1067 msgid ":exc:`NotImplementedError`" msgstr ":exc:`NotImplementedError`" -#: ../../c-api/exceptions.rst:1057 ../../c-api/exceptions.rst:1140 -#: ../../c-api/exceptions.rst:1143 ../../c-api/exceptions.rst:1146 +#: ../../c-api/exceptions.rst:1069 ../../c-api/exceptions.rst:1152 +#: ../../c-api/exceptions.rst:1155 ../../c-api/exceptions.rst:1158 msgid ":exc:`OSError`" msgstr ":exc:`OSError`" -#: ../../c-api/exceptions.rst:1059 +#: ../../c-api/exceptions.rst:1071 msgid ":exc:`OverflowError`" msgstr ":exc:`OverflowError`" -#: ../../c-api/exceptions.rst:1061 +#: ../../c-api/exceptions.rst:1073 msgid ":exc:`PermissionError`" msgstr ":exc:`PermissionError`" -#: ../../c-api/exceptions.rst:1063 +#: ../../c-api/exceptions.rst:1075 msgid ":exc:`ProcessLookupError`" msgstr ":exc:`ProcessLookupError`" -#: ../../c-api/exceptions.rst:1065 +#: ../../c-api/exceptions.rst:1077 msgid ":exc:`PythonFinalizationError`" msgstr ":exc:`PythonFinalizationError`" -#: ../../c-api/exceptions.rst:1067 +#: ../../c-api/exceptions.rst:1079 msgid ":exc:`RecursionError`" msgstr ":exc:`RecursionError`" -#: ../../c-api/exceptions.rst:1069 +#: ../../c-api/exceptions.rst:1081 msgid ":exc:`ReferenceError`" msgstr ":exc:`ReferenceError`" -#: ../../c-api/exceptions.rst:1071 +#: ../../c-api/exceptions.rst:1083 msgid ":exc:`RuntimeError`" msgstr ":exc:`RuntimeError`" -#: ../../c-api/exceptions.rst:1073 +#: ../../c-api/exceptions.rst:1085 msgid ":exc:`StopAsyncIteration`" msgstr ":exc:`StopAsyncIteration`" -#: ../../c-api/exceptions.rst:1075 +#: ../../c-api/exceptions.rst:1087 msgid ":exc:`StopIteration`" msgstr ":exc:`StopIteration`" -#: ../../c-api/exceptions.rst:1077 +#: ../../c-api/exceptions.rst:1089 msgid ":exc:`SyntaxError`" msgstr ":exc:`SyntaxError`" -#: ../../c-api/exceptions.rst:1079 +#: ../../c-api/exceptions.rst:1091 msgid ":exc:`SystemError`" msgstr ":exc:`SystemError`" -#: ../../c-api/exceptions.rst:1081 +#: ../../c-api/exceptions.rst:1093 msgid ":exc:`SystemExit`" msgstr ":exc:`SystemExit`" -#: ../../c-api/exceptions.rst:1083 +#: ../../c-api/exceptions.rst:1095 msgid ":exc:`TabError`" msgstr ":exc:`TabError`" -#: ../../c-api/exceptions.rst:1085 +#: ../../c-api/exceptions.rst:1097 msgid ":exc:`TimeoutError`" msgstr ":exc:`TimeoutError`" -#: ../../c-api/exceptions.rst:1087 +#: ../../c-api/exceptions.rst:1099 msgid ":exc:`TypeError`" msgstr ":exc:`TypeError`" -#: ../../c-api/exceptions.rst:1089 +#: ../../c-api/exceptions.rst:1101 msgid ":exc:`UnboundLocalError`" msgstr ":exc:`UnboundLocalError`" -#: ../../c-api/exceptions.rst:1091 +#: ../../c-api/exceptions.rst:1103 msgid ":exc:`UnicodeDecodeError`" msgstr ":exc:`UnicodeDecodeError`" -#: ../../c-api/exceptions.rst:1093 +#: ../../c-api/exceptions.rst:1105 msgid ":exc:`UnicodeEncodeError`" msgstr ":exc:`UnicodeEncodeError`" -#: ../../c-api/exceptions.rst:1095 +#: ../../c-api/exceptions.rst:1107 msgid ":exc:`UnicodeError`" msgstr ":exc:`UnicodeError`" -#: ../../c-api/exceptions.rst:1097 +#: ../../c-api/exceptions.rst:1109 msgid ":exc:`UnicodeTranslateError`" msgstr ":exc:`UnicodeTranslateError`" -#: ../../c-api/exceptions.rst:1099 +#: ../../c-api/exceptions.rst:1111 msgid ":exc:`ValueError`" msgstr ":exc:`ValueError`" -#: ../../c-api/exceptions.rst:1101 +#: ../../c-api/exceptions.rst:1113 msgid ":exc:`ZeroDivisionError`" msgstr ":exc:`ZeroDivisionError`" -#: ../../c-api/exceptions.rst:1103 +#: ../../c-api/exceptions.rst:1115 msgid "" -":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:" -"`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:" -"`PyExc_ConnectionAbortedError`, :c:data:`PyExc_ConnectionRefusedError`, :c:" -"data:`PyExc_ConnectionResetError`, :c:data:`PyExc_FileExistsError`, :c:data:" -"`PyExc_FileNotFoundError`, :c:data:`PyExc_InterruptedError`, :c:data:" -"`PyExc_IsADirectoryError`, :c:data:`PyExc_NotADirectoryError`, :c:data:" -"`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` and :c:data:" -"`PyExc_TimeoutError` were introduced following :pep:`3151`." -msgstr "" -":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:" -"`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:" -"`PyExc_ConnectionAbortedError`, :c:data:`PyExc_ConnectionRefusedError`, :c:" -"data:`PyExc_ConnectionResetError`, :c:data:`PyExc_FileExistsError`, :c:data:" -"`PyExc_FileNotFoundError`, :c:data:`PyExc_InterruptedError`, :c:data:" -"`PyExc_IsADirectoryError`, :c:data:`PyExc_NotADirectoryError`, :c:data:" -"`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` 和 :c:data:" -"`PyExc_TimeoutError` 是在 :pep:`3151` 被引入。" +":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:`PyExc_ConnectionAbortedError`, :c:data:`PyExc_ConnectionRefusedError`, :c:data:`PyExc_ConnectionResetError`, :c:data:`PyExc_FileExistsError`, :c:data:`PyExc_FileNotFoundError`, :c:data:`PyExc_InterruptedError`, :c:data:`PyExc_IsADirectoryError`, :c:data:`PyExc_NotADirectoryError`, :c:data:`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` " +"and :c:data:`PyExc_TimeoutError` were introduced following :pep:`3151`." +msgstr "" +":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:`PyExc_ConnectionAbortedError`, :c:data:`PyExc_ConnectionRefusedError`, :c:data:`PyExc_ConnectionResetError`, :c:data:`PyExc_FileExistsError`, :c:data:`PyExc_FileNotFoundError`, :c:data:`PyExc_InterruptedError`, :c:data:`PyExc_IsADirectoryError`, :c:data:`PyExc_NotADirectoryError`, :c:data:`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` " +"和 :c:data:`PyExc_TimeoutError` 是在 :pep:`3151` 被引入。" -#: ../../c-api/exceptions.rst:1113 +#: ../../c-api/exceptions.rst:1125 msgid ":c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`." msgstr ":c:data:`PyExc_StopAsyncIteration` 和 :c:data:`PyExc_RecursionError`。" -#: ../../c-api/exceptions.rst:1116 +#: ../../c-api/exceptions.rst:1128 msgid ":c:data:`PyExc_ModuleNotFoundError`." msgstr ":c:data:`PyExc_ModuleNotFoundError`。" -#: ../../c-api/exceptions.rst:1119 +#: ../../c-api/exceptions.rst:1131 msgid ":c:data:`PyExc_BaseExceptionGroup`." msgstr ":c:data:`PyExc_BaseExceptionGroup`" -#: ../../c-api/exceptions.rst:1124 +#: ../../c-api/exceptions.rst:1136 msgid "OSError aliases" msgstr "OSError 別名" -#: ../../c-api/exceptions.rst:1126 +#: ../../c-api/exceptions.rst:1138 msgid "The following are a compatibility aliases to :c:data:`PyExc_OSError`." msgstr "" -#: ../../c-api/exceptions.rst:1128 +#: ../../c-api/exceptions.rst:1140 msgid "These aliases used to be separate exception types." msgstr "" -#: ../../c-api/exceptions.rst:1138 +#: ../../c-api/exceptions.rst:1150 msgid "Notes" msgstr "註解" -#: ../../c-api/exceptions.rst:1147 +#: ../../c-api/exceptions.rst:1159 msgid "[win]_" msgstr "[win]_" -#: ../../c-api/exceptions.rst:1149 +#: ../../c-api/exceptions.rst:1161 msgid "Notes:" msgstr "註解:" -#: ../../c-api/exceptions.rst:1152 +#: ../../c-api/exceptions.rst:1164 msgid "" ":c:var:`!PyExc_WindowsError` is only defined on Windows; protect code that " "uses this by testing that the preprocessor macro ``MS_WINDOWS`` is defined." msgstr "" -#: ../../c-api/exceptions.rst:1159 +#: ../../c-api/exceptions.rst:1171 msgid "Warning types" msgstr "警告型別" -#: ../../c-api/exceptions.rst:1169 +#: ../../c-api/exceptions.rst:1181 msgid ":exc:`Warning`" msgstr ":exc:`Warning`" -#: ../../c-api/exceptions.rst:1171 +#: ../../c-api/exceptions.rst:1183 msgid ":exc:`BytesWarning`" msgstr ":exc:`BytesWarning`" -#: ../../c-api/exceptions.rst:1173 +#: ../../c-api/exceptions.rst:1185 msgid ":exc:`DeprecationWarning`" msgstr ":exc:`DeprecationWarning`" -#: ../../c-api/exceptions.rst:1175 +#: ../../c-api/exceptions.rst:1187 msgid ":exc:`EncodingWarning`" msgstr ":exc:`EncodingWarning`" -#: ../../c-api/exceptions.rst:1177 +#: ../../c-api/exceptions.rst:1189 msgid ":exc:`FutureWarning`" msgstr ":exc:`FutureWarning`" -#: ../../c-api/exceptions.rst:1179 +#: ../../c-api/exceptions.rst:1191 msgid ":exc:`ImportWarning`" msgstr ":exc:`ImportWarning`" -#: ../../c-api/exceptions.rst:1181 +#: ../../c-api/exceptions.rst:1193 msgid ":exc:`PendingDeprecationWarning`" msgstr ":exc:`PendingDeprecationWarning`" -#: ../../c-api/exceptions.rst:1183 +#: ../../c-api/exceptions.rst:1195 msgid ":exc:`ResourceWarning`" msgstr ":exc:`ResourceWarning`" -#: ../../c-api/exceptions.rst:1185 +#: ../../c-api/exceptions.rst:1197 msgid ":exc:`RuntimeWarning`" msgstr ":exc:`RuntimeWarning`" -#: ../../c-api/exceptions.rst:1187 +#: ../../c-api/exceptions.rst:1199 msgid ":exc:`SyntaxWarning`" msgstr ":exc:`SyntaxWarning`" -#: ../../c-api/exceptions.rst:1189 +#: ../../c-api/exceptions.rst:1201 msgid ":exc:`UnicodeWarning`" msgstr ":exc:`UnicodeWarning`" -#: ../../c-api/exceptions.rst:1191 +#: ../../c-api/exceptions.rst:1203 msgid ":exc:`UserWarning`" msgstr ":exc:`UserWarning`" -#: ../../c-api/exceptions.rst:1193 +#: ../../c-api/exceptions.rst:1205 msgid ":c:data:`PyExc_ResourceWarning`." msgstr ":c:data:`PyExc_ResourceWarning`。" -#: ../../c-api/exceptions.rst:1196 +#: ../../c-api/exceptions.rst:1208 msgid ":c:data:`PyExc_EncodingWarning`." msgstr ":c:data:`PyExc_EncodingWarning`。" @@ -1444,3 +1461,6 @@ msgstr "SIGINT(C 巨集)" #: ../../c-api/exceptions.rst:683 msgid "KeyboardInterrupt (built-in exception)" msgstr "KeyboardInterrupt(內建例外)" + +#~ msgid "The caller must hold the GIL." +#~ msgstr "呼叫者必須持有 GIL。" diff --git a/c-api/extension-modules.po b/c-api/extension-modules.po new file mode 100644 index 00000000000..1260e7dc5a9 --- /dev/null +++ b/c-api/extension-modules.po @@ -0,0 +1,356 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../c-api/extension-modules.rst:6 +msgid "Defining extension modules" +msgstr "" + +#: ../../c-api/extension-modules.rst:8 +msgid "" +"A C extension for CPython is a shared library (for example, a ``.so`` file " +"on Linux, ``.pyd`` DLL on Windows), which is loadable into the Python " +"process (for example, it is compiled with compatible compiler settings), and " +"which exports an :ref:`initialization function `." +msgstr "" + +#: ../../c-api/extension-modules.rst:13 +msgid "" +"To be importable by default (that is, " +"by :py:class:`importlib.machinery.ExtensionFileLoader`), the shared library " +"must be available on :py:attr:`sys.path`, and must be named after the module " +"name plus an extension listed " +"in :py:attr:`importlib.machinery.EXTENSION_SUFFIXES`." +msgstr "" + +#: ../../c-api/extension-modules.rst:21 +msgid "" +"Building, packaging and distributing extension modules is best done with " +"third-party tools, and is out of scope of this document. One suitable tool " +"is Setuptools, whose documentation can be found at https://" +"setuptools.pypa.io/en/latest/setuptools.html." +msgstr "" + +#: ../../c-api/extension-modules.rst:26 +msgid "" +"Normally, the initialization function returns a module definition " +"initialized using :c:func:`PyModuleDef_Init`. This allows splitting the " +"creation process into several phases:" +msgstr "" + +#: ../../c-api/extension-modules.rst:30 +msgid "" +"Before any substantial code is executed, Python can determine which " +"capabilities the module supports, and it can adjust the environment or " +"refuse loading an incompatible extension." +msgstr "" + +#: ../../c-api/extension-modules.rst:33 +msgid "" +"By default, Python itself creates the module object -- that is, it does the " +"equivalent of :py:meth:`object.__new__` for classes. It also sets initial " +"attributes like :attr:`~module.__package__` and :attr:`~module.__loader__`." +msgstr "" + +#: ../../c-api/extension-modules.rst:37 +msgid "" +"Afterwards, the module object is initialized using extension-specific code " +"-- the equivalent of :py:meth:`~object.__init__` on classes." +msgstr "" + +#: ../../c-api/extension-modules.rst:40 +msgid "" +"This is called *multi-phase initialization* to distinguish it from the " +"legacy (but still supported) *single-phase initialization* scheme, where the " +"initialization function returns a fully constructed module. See " +"the :ref:`single-phase-initialization section below ` for details." +msgstr "" + +#: ../../c-api/extension-modules.rst:48 +msgid "Added support for multi-phase initialization (:pep:`489`)." +msgstr "" + +#: ../../c-api/extension-modules.rst:52 +msgid "Multiple module instances" +msgstr "" + +#: ../../c-api/extension-modules.rst:54 +msgid "" +"By default, extension modules are not singletons. For example, if " +"the :py:attr:`sys.modules` entry is removed and the module is re-imported, a " +"new module object is created, and typically populated with fresh method and " +"type objects. The old module is subject to normal garbage collection. This " +"mirrors the behavior of pure-Python modules." +msgstr "" + +#: ../../c-api/extension-modules.rst:61 +msgid "" +"Additional module instances may be created in :ref:`sub-interpreters ` or after Python runtime reinitialization " +"(:c:func:`Py_Finalize` and :c:func:`Py_Initialize`). In these cases, sharing " +"Python objects between module instances would likely cause crashes or " +"undefined behavior." +msgstr "" + +#: ../../c-api/extension-modules.rst:68 +msgid "" +"To avoid such issues, each instance of an extension module should be " +"*isolated*: changes to one instance should not implicitly affect the others, " +"and all state owned by the module, including references to Python objects, " +"should be specific to a particular module instance. See :ref:`isolating-" +"extensions-howto` for more details and a practical guide." +msgstr "" + +#: ../../c-api/extension-modules.rst:74 +msgid "" +"A simpler way to avoid these issues is :ref:`raising an error on repeated " +"initialization `." +msgstr "" + +#: ../../c-api/extension-modules.rst:77 +msgid "" +"All modules are expected to support :ref:`sub-interpreters `, or otherwise explicitly signal a lack of support. This is usually " +"achieved by isolation or blocking repeated initialization, as above. A " +"module may also be limited to the main interpreter using " +"the :c:data:`Py_mod_multiple_interpreters` slot." +msgstr "" + +#: ../../c-api/extension-modules.rst:89 +msgid "Initialization function" +msgstr "" + +#: ../../c-api/extension-modules.rst:91 +msgid "" +"The initialization function defined by an extension module has the following " +"signature:" +msgstr "" + +#: ../../c-api/extension-modules.rst:96 +msgid "" +"Its name should be :samp:`PyInit_{}`, with ```` replaced by the " +"name of the module." +msgstr "" + +#: ../../c-api/extension-modules.rst:99 +msgid "" +"For modules with ASCII-only names, the function must instead be " +"named :samp:`PyInit_{}`, with ```` replaced by the name of the " +"module. When using :ref:`multi-phase-initialization`, non-ASCII module names " +"are allowed. In this case, the initialization function name " +"is :samp:`PyInitU_{}`, with ```` encoded using Python's " +"*punycode* encoding with hyphens replaced by underscores. In Python:" +msgstr "" + +#: ../../c-api/extension-modules.rst:106 +msgid "" +"def initfunc_name(name):\n" +" try:\n" +" suffix = b'_' + name.encode('ascii')\n" +" except UnicodeEncodeError:\n" +" suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" +" return b'PyInit' + suffix" +msgstr "" + +#: ../../c-api/extension-modules.rst:115 +msgid "" +"It is recommended to define the initialization function using a helper macro:" +msgstr "" + +#: ../../c-api/extension-modules.rst:119 +msgid "Declare an extension module initialization function. This macro:" +msgstr "" + +#: ../../c-api/extension-modules.rst:122 +msgid "specifies the :c:expr:`PyObject*` return type," +msgstr "" + +#: ../../c-api/extension-modules.rst:123 +msgid "adds any special linkage declarations required by the platform, and" +msgstr "" + +#: ../../c-api/extension-modules.rst:124 +msgid "for C++, declares the function as ``extern \"C\"``." +msgstr "" + +#: ../../c-api/extension-modules.rst:126 +msgid "For example, a module called ``spam`` would be defined like this::" +msgstr "" + +#: ../../c-api/extension-modules.rst:128 +msgid "" +"static struct PyModuleDef spam_module = {\n" +" .m_base = PyModuleDef_HEAD_INIT,\n" +" .m_name = \"spam\",\n" +" ...\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_spam(void)\n" +"{\n" +" return PyModuleDef_Init(&spam_module);\n" +"}" +msgstr "" + +#: ../../c-api/extension-modules.rst:140 +msgid "" +"It is possible to export multiple modules from a single shared library by " +"defining multiple initialization functions. However, importing them requires " +"using symbolic links or a custom importer, because by default only the " +"function corresponding to the filename is found. See the `Multiple modules " +"in one library `__ section in :pep:`489` for details." +msgstr "" + +#: ../../c-api/extension-modules.rst:147 +msgid "" +"The initialization function is typically the only non-\\ ``static`` item " +"defined in the module's C source." +msgstr "" + +#: ../../c-api/extension-modules.rst:154 +msgid "Multi-phase initialization" +msgstr "" + +#: ../../c-api/extension-modules.rst:156 +msgid "" +"Normally, the :ref:`initialization function ` " +"(``PyInit_modulename``) returns a :c:type:`PyModuleDef` instance with non-" +"``NULL`` :c:member:`~PyModuleDef.m_slots`. Before it is returned, the " +"``PyModuleDef`` instance must be initialized using the following function:" +msgstr "" + +#: ../../c-api/extension-modules.rst:165 +msgid "" +"Ensure a module definition is a properly initialized Python object that " +"correctly reports its type and a reference count." +msgstr "" + +#: ../../c-api/extension-modules.rst:168 +msgid "Return *def* cast to ``PyObject*``, or ``NULL`` if an error occurred." +msgstr "" + +#: ../../c-api/extension-modules.rst:170 +msgid "" +"Calling this function is required for :ref:`multi-phase-initialization`. It " +"should not be used in other contexts." +msgstr "" + +#: ../../c-api/extension-modules.rst:173 +msgid "" +"Note that Python assumes that ``PyModuleDef`` structures are statically " +"allocated. This function may return either a new reference or a borrowed " +"one; this reference must not be released." +msgstr "" + +#: ../../c-api/extension-modules.rst:184 +msgid "Legacy single-phase initialization" +msgstr "" + +#: ../../c-api/extension-modules.rst:187 +msgid "" +"Single-phase initialization is a legacy mechanism to initialize extension " +"modules, with known drawbacks and design flaws. Extension module authors are " +"encouraged to use multi-phase initialization instead." +msgstr "" + +#: ../../c-api/extension-modules.rst:191 +msgid "" +"In single-phase initialization, the :ref:`initialization function ` (``PyInit_modulename``) should create, populate and return a " +"module object. This is typically done using :c:func:`PyModule_Create` and " +"functions like :c:func:`PyModule_AddObjectRef`." +msgstr "" + +#: ../../c-api/extension-modules.rst:197 +msgid "" +"Single-phase initialization differs from the :ref:`default ` in the following ways:" +msgstr "" + +#: ../../c-api/extension-modules.rst:200 +msgid "Single-phase modules are, or rather *contain*, “singletons”." +msgstr "" + +#: ../../c-api/extension-modules.rst:202 +msgid "" +"When the module is first initialized, Python saves the contents of the " +"module's ``__dict__`` (that is, typically, the module's functions and types)." +msgstr "" + +#: ../../c-api/extension-modules.rst:206 +msgid "" +"For subsequent imports, Python does not call the initialization function " +"again. Instead, it creates a new module object with a new ``__dict__``, and " +"copies the saved contents to it. For example, given a single-phase module " +"``_testsinglephase`` [#testsinglephase]_ that defines a function ``sum`` and " +"an exception class ``error``:" +msgstr "" + +#: ../../c-api/extension-modules.rst:214 +msgid "" +">>> import sys\n" +">>> import _testsinglephase as one\n" +">>> del sys.modules['_testsinglephase']\n" +">>> import _testsinglephase as two\n" +">>> one is two\n" +"False\n" +">>> one.__dict__ is two.__dict__\n" +"False\n" +">>> one.sum is two.sum\n" +"True\n" +">>> one.error is two.error\n" +"True" +msgstr "" + +#: ../../c-api/extension-modules.rst:229 +msgid "" +"The exact behavior should be considered a CPython implementation detail." +msgstr "" + +#: ../../c-api/extension-modules.rst:231 +msgid "" +"To work around the fact that ``PyInit_modulename`` does not take a *spec* " +"argument, some state of the import machinery is saved and applied to the " +"first suitable module created during the ``PyInit_modulename`` call. " +"Specifically, when a sub-module is imported, this mechanism prepends the " +"parent package name to the name of the module." +msgstr "" + +#: ../../c-api/extension-modules.rst:237 +msgid "" +"A single-phase ``PyInit_modulename`` function should create “its” module " +"object as soon as possible, before any other module objects can be created." +msgstr "" + +#: ../../c-api/extension-modules.rst:240 +msgid "Non-ASCII module names (``PyInitU_modulename``) are not supported." +msgstr "" + +#: ../../c-api/extension-modules.rst:242 +msgid "" +"Single-phase modules support module lookup functions " +"like :c:func:`PyState_FindModule`." +msgstr "" + +#: ../../c-api/extension-modules.rst:245 +msgid "" +"``_testsinglephase`` is an internal module used in CPython's self-test " +"suite; your installation may or may not include it." +msgstr "" diff --git a/c-api/float.po b/c-api/float.po index 3c2eff7ff26..03d7378c58b 100644 --- a/c-api/float.po +++ b/c-api/float.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,8 +37,8 @@ msgstr "" #: ../../c-api/float.rst:24 msgid "" -"Return true if its argument is a :c:type:`PyFloatObject` or a subtype of :c:" -"type:`PyFloatObject`. This function always succeeds." +"Return true if its argument is a :c:type:`PyFloatObject` or a subtype " +"of :c:type:`PyFloatObject`. This function always succeeds." msgstr "" #: ../../c-api/float.rst:30 @@ -61,11 +61,11 @@ msgstr "" #: ../../c-api/float.rst:47 msgid "" "Return a C :c:expr:`double` representation of the contents of *pyfloat*. If " -"*pyfloat* is not a Python floating-point object but has a :meth:`~object." -"__float__` method, this method will first be called to convert *pyfloat* " -"into a float. If :meth:`!__float__` is not defined then it falls back to :" -"meth:`~object.__index__`. This method returns ``-1.0`` upon failure, so one " -"should call :c:func:`PyErr_Occurred` to check for errors." +"*pyfloat* is not a Python floating-point object but has " +"a :meth:`~object.__float__` method, this method will first be called to " +"convert *pyfloat* into a float. If :meth:`!__float__` is not defined then it " +"falls back to :meth:`~object.__index__`. This method returns ``-1.0`` upon " +"failure, so one should call :c:func:`PyErr_Occurred` to check for errors." msgstr "" #: ../../c-api/float.rst:54 @@ -87,8 +87,8 @@ msgstr "" #: ../../c-api/float.rst:73 msgid "" -"Return the maximum representable finite float *DBL_MAX* as C :c:expr:" -"`double`." +"Return the maximum representable finite float *DBL_MAX* as " +"C :c:expr:`double`." msgstr "" #: ../../c-api/float.rst:78 @@ -104,9 +104,9 @@ msgstr "" msgid "" "The pack and unpack functions provide an efficient platform-independent way " "to store floating-point values as byte strings. The Pack routines produce a " -"bytes string from a C :c:expr:`double`, and the Unpack routines produce a C :" -"c:expr:`double` from such a bytes string. The suffix (2, 4 or 8) specifies " -"the number of bytes in the bytes string." +"bytes string from a C :c:expr:`double`, and the Unpack routines produce a " +"C :c:expr:`double` from such a bytes string. The suffix (2, 4 or 8) " +"specifies the number of bytes in the bytes string." msgstr "" #: ../../c-api/float.rst:90 @@ -123,92 +123,99 @@ msgstr "" #: ../../c-api/float.rst:99 msgid "" +"Note that NaNs type may not be preserved on IEEE platforms (silent NaN " +"become quiet), for example on x86 systems in 32-bit mode." +msgstr "" + +#: ../../c-api/float.rst:102 +msgid "" "On non-IEEE platforms with more precision, or larger dynamic range, than " "IEEE 754 supports, not all values can be packed; on non-IEEE platforms with " "less precision, or smaller dynamic range, not all values can be unpacked. " "What happens in such cases is partly accidental (alas)." msgstr "" -#: ../../c-api/float.rst:107 +#: ../../c-api/float.rst:110 msgid "Pack functions" msgstr "" -#: ../../c-api/float.rst:109 +#: ../../c-api/float.rst:112 msgid "" -"The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is an :c:expr:" -"`int` argument, non-zero if you want the bytes string in little-endian " -"format (exponent last, at ``p+1``, ``p+3``, or ``p+6`` ``p+7``), zero if you " -"want big-endian format (exponent first, at *p*). The :c:macro:" -"`PY_BIG_ENDIAN` constant can be used to use the native endian: it is equal " -"to ``1`` on big endian processor, or ``0`` on little endian processor." +"The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is " +"an :c:expr:`int` argument, non-zero if you want the bytes string in little-" +"endian format (exponent last, at ``p+1``, ``p+3``, or ``p+6`` ``p+7``), zero " +"if you want big-endian format (exponent first, at *p*). " +"The :c:macro:`PY_BIG_ENDIAN` constant can be used to use the native endian: " +"it is equal to ``1`` on big endian processor, or ``0`` on little endian " +"processor." msgstr "" -#: ../../c-api/float.rst:116 +#: ../../c-api/float.rst:119 msgid "" "Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set, " "most likely :exc:`OverflowError`)." msgstr "" -#: ../../c-api/float.rst:119 +#: ../../c-api/float.rst:122 msgid "There are two problems on non-IEEE platforms:" msgstr "" -#: ../../c-api/float.rst:121 +#: ../../c-api/float.rst:124 msgid "What this does is undefined if *x* is a NaN or infinity." msgstr "" -#: ../../c-api/float.rst:122 +#: ../../c-api/float.rst:125 msgid "``-0.0`` and ``+0.0`` produce the same bytes string." msgstr "``-0.0`` 和 ``+0.0`` 會產生同樣的位元組字串。" -#: ../../c-api/float.rst:126 +#: ../../c-api/float.rst:129 msgid "Pack a C double as the IEEE 754 binary16 half-precision format." msgstr "" -#: ../../c-api/float.rst:130 +#: ../../c-api/float.rst:133 msgid "Pack a C double as the IEEE 754 binary32 single precision format." msgstr "" -#: ../../c-api/float.rst:134 +#: ../../c-api/float.rst:137 msgid "Pack a C double as the IEEE 754 binary64 double precision format." msgstr "" -#: ../../c-api/float.rst:138 +#: ../../c-api/float.rst:141 msgid "Unpack functions" msgstr "" -#: ../../c-api/float.rst:140 +#: ../../c-api/float.rst:143 msgid "" -"The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is an :c:" -"expr:`int` argument, non-zero if the bytes string is in little-endian format " -"(exponent last, at ``p+1``, ``p+3`` or ``p+6`` and ``p+7``), zero if big-" -"endian (exponent first, at *p*). The :c:macro:`PY_BIG_ENDIAN` constant can " -"be used to use the native endian: it is equal to ``1`` on big endian " +"The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is " +"an :c:expr:`int` argument, non-zero if the bytes string is in little-endian " +"format (exponent last, at ``p+1``, ``p+3`` or ``p+6`` and ``p+7``), zero if " +"big-endian (exponent first, at *p*). The :c:macro:`PY_BIG_ENDIAN` constant " +"can be used to use the native endian: it is equal to ``1`` on big endian " "processor, or ``0`` on little endian processor." msgstr "" -#: ../../c-api/float.rst:147 +#: ../../c-api/float.rst:150 msgid "" -"Return value: The unpacked double. On error, this is ``-1.0`` and :c:func:" -"`PyErr_Occurred` is true (and an exception is set, most likely :exc:" -"`OverflowError`)." +"Return value: The unpacked double. On error, this is ``-1.0`` " +"and :c:func:`PyErr_Occurred` is true (and an exception is set, most " +"likely :exc:`OverflowError`)." msgstr "" -#: ../../c-api/float.rst:151 +#: ../../c-api/float.rst:154 msgid "" "Note that on a non-IEEE platform this will refuse to unpack a bytes string " "that represents a NaN or infinity." msgstr "" -#: ../../c-api/float.rst:156 +#: ../../c-api/float.rst:159 msgid "Unpack the IEEE 754 binary16 half-precision format as a C double." msgstr "" -#: ../../c-api/float.rst:160 +#: ../../c-api/float.rst:163 msgid "Unpack the IEEE 754 binary32 single precision format as a C double." msgstr "" -#: ../../c-api/float.rst:164 +#: ../../c-api/float.rst:167 msgid "Unpack the IEEE 754 binary64 double precision format as a C double." msgstr "" diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index 8ad9b1c6a12..74fd2d5c1f8 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -7,7 +7,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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:31+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -76,8 +76,8 @@ msgstr "" #: ../../c-api/gcsupport.rst:37 msgid "" -"Before fields which refer to other containers are invalidated, :c:func:" -"`PyObject_GC_UnTrack` must be called." +"Before fields which refer to other containers are " +"invalidated, :c:func:`PyObject_GC_UnTrack` must be called." msgstr "" #: ../../c-api/gcsupport.rst:40 @@ -87,35 +87,75 @@ msgstr "" #: ../../c-api/gcsupport.rst:43 msgid "" -"If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least a :" -"c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from its " -"subclass or subclasses." +"If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least " +"a :c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from " +"its subclass or subclasses." msgstr "" #: ../../c-api/gcsupport.rst:47 msgid "" "When calling :c:func:`PyType_Ready` or some of the APIs that indirectly call " "it like :c:func:`PyType_FromSpecWithBases` or :c:func:`PyType_FromSpec` the " -"interpreter will automatically populate the :c:member:`~PyTypeObject." -"tp_flags`, :c:member:`~PyTypeObject.tp_traverse` and :c:member:" -"`~PyTypeObject.tp_clear` fields if the type inherits from a class that " -"implements the garbage collector protocol and the child class does *not* " -"include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." +"interpreter will automatically populate " +"the :c:member:`~PyTypeObject.tp_flags`, :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields if the type inherits from a " +"class that implements the garbage collector protocol and the child class " +"does *not* include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" #: ../../c-api/gcsupport.rst:57 msgid "" -"Analogous to :c:macro:`PyObject_New` but for container objects with the :c:" -"macro:`Py_TPFLAGS_HAVE_GC` flag set." +"Analogous to :c:macro:`PyObject_New` but for container objects with " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set." msgstr "" -#: ../../c-api/gcsupport.rst:62 +#: ../../c-api/gcsupport.rst:60 ../../c-api/gcsupport.rst:84 msgid "" -"Analogous to :c:macro:`PyObject_NewVar` but for container objects with the :" -"c:macro:`Py_TPFLAGS_HAVE_GC` flag set." +"Do not call this directly to allocate memory for an object; call the " +"type's :c:member:`~PyTypeObject.tp_alloc` slot instead." msgstr "" -#: ../../c-api/gcsupport.rst:67 +#: ../../c-api/gcsupport.rst:63 ../../c-api/gcsupport.rst:87 +msgid "" +"When populating a type's :c:member:`~PyTypeObject.tp_alloc` " +"slot, :c:func:`PyType_GenericAlloc` is preferred over a custom function that " +"simply calls this macro." +msgstr "" + +#: ../../c-api/gcsupport.rst:67 ../../c-api/gcsupport.rst:91 +msgid "" +"Memory allocated by this macro must be freed with :c:func:`PyObject_GC_Del` " +"(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." +msgstr "" + +#: ../../c-api/gcsupport.rst:73 ../../c-api/gcsupport.rst:97 +msgid ":c:func:`PyObject_GC_Del`" +msgstr "" + +#: ../../c-api/gcsupport.rst:74 +msgid ":c:macro:`PyObject_New`" +msgstr "" + +#: ../../c-api/gcsupport.rst:75 ../../c-api/gcsupport.rst:99 +#: ../../c-api/gcsupport.rst:193 +msgid ":c:func:`PyType_GenericAlloc`" +msgstr "" + +#: ../../c-api/gcsupport.rst:76 ../../c-api/gcsupport.rst:100 +msgid ":c:member:`~PyTypeObject.tp_alloc`" +msgstr "" + +#: ../../c-api/gcsupport.rst:81 +msgid "" +"Analogous to :c:macro:`PyObject_NewVar` but for container objects with " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set." +msgstr "" + +#: ../../c-api/gcsupport.rst:98 +msgid ":c:macro:`PyObject_NewVar`" +msgstr "" + +#: ../../c-api/gcsupport.rst:105 msgid "" "Analogous to :c:macro:`PyObject_GC_New` but allocates *extra_size* bytes at " "the end of the object (at offset :c:member:`~PyTypeObject.tp_basicsize`). " @@ -123,34 +163,41 @@ msgid "" "object header `." msgstr "" -#: ../../c-api/gcsupport.rst:73 +#: ../../c-api/gcsupport.rst:111 msgid "" "The extra data will be deallocated with the object, but otherwise it is not " "managed by Python." msgstr "" -#: ../../c-api/gcsupport.rst:77 +#: ../../c-api/gcsupport.rst:114 +msgid "" +"Memory allocated by this function must be freed " +"with :c:func:`PyObject_GC_Del` (usually called via the " +"object's :c:member:`~PyTypeObject.tp_free` slot)." +msgstr "" + +#: ../../c-api/gcsupport.rst:119 msgid "" "The function is marked as unstable because the final mechanism for reserving " "extra data after an instance is not yet decided. For allocating a variable " -"number of fields, prefer using :c:type:`PyVarObject` and :c:member:" -"`~PyTypeObject.tp_itemsize` instead." +"number of fields, prefer using :c:type:`PyVarObject` " +"and :c:member:`~PyTypeObject.tp_itemsize` instead." msgstr "" -#: ../../c-api/gcsupport.rst:88 +#: ../../c-api/gcsupport.rst:130 msgid "" "Resize an object allocated by :c:macro:`PyObject_NewVar`. Returns the " "resized object of type ``TYPE*`` (refers to any C type) or ``NULL`` on " "failure." msgstr "" -#: ../../c-api/gcsupport.rst:92 +#: ../../c-api/gcsupport.rst:134 msgid "" "*op* must be of type :c:expr:`PyVarObject *` and must not be tracked by the " "collector yet. *newsize* must be of type :c:type:`Py_ssize_t`." msgstr "" -#: ../../c-api/gcsupport.rst:99 +#: ../../c-api/gcsupport.rst:141 msgid "" "Adds the object *op* to the set of container objects tracked by the " "collector. The collector can run at unexpected times so objects must be " @@ -159,83 +206,112 @@ msgid "" "usually near the end of the constructor." msgstr "" -#: ../../c-api/gcsupport.rst:108 +#: ../../c-api/gcsupport.rst:150 msgid "" "Returns non-zero if the object implements the garbage collector protocol, " "otherwise returns 0." msgstr "" -#: ../../c-api/gcsupport.rst:111 +#: ../../c-api/gcsupport.rst:153 msgid "" "The object cannot be tracked by the garbage collector if this function " "returns 0." msgstr "" -#: ../../c-api/gcsupport.rst:116 +#: ../../c-api/gcsupport.rst:158 msgid "" "Returns 1 if the object type of *op* implements the GC protocol and *op* is " "being currently tracked by the garbage collector and 0 otherwise." msgstr "" -#: ../../c-api/gcsupport.rst:119 +#: ../../c-api/gcsupport.rst:161 msgid "This is analogous to the Python function :func:`gc.is_tracked`." msgstr "" -#: ../../c-api/gcsupport.rst:126 +#: ../../c-api/gcsupport.rst:168 msgid "" "Returns 1 if the object type of *op* implements the GC protocol and *op* has " "been already finalized by the garbage collector and 0 otherwise." msgstr "" -#: ../../c-api/gcsupport.rst:129 +#: ../../c-api/gcsupport.rst:171 msgid "This is analogous to the Python function :func:`gc.is_finalized`." msgstr "" -#: ../../c-api/gcsupport.rst:136 +#: ../../c-api/gcsupport.rst:178 msgid "" -"Releases memory allocated to an object using :c:macro:`PyObject_GC_New` or :" -"c:macro:`PyObject_GC_NewVar`." +"Releases memory allocated to an object using :c:macro:`PyObject_GC_New` " +"or :c:macro:`PyObject_GC_NewVar`." msgstr "" -#: ../../c-api/gcsupport.rst:142 +#: ../../c-api/gcsupport.rst:181 +msgid "" +"Do not call this directly to free an object's memory; call the " +"type's :c:member:`~PyTypeObject.tp_free` slot instead." +msgstr "" + +#: ../../c-api/gcsupport.rst:184 +msgid "" +"Do not use this for memory allocated " +"by :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, or related " +"allocation functions; use :c:func:`PyObject_Free` instead." +msgstr "" + +#: ../../c-api/gcsupport.rst:190 +msgid ":c:func:`PyObject_Free` is the non-GC equivalent of this function." +msgstr "" + +#: ../../c-api/gcsupport.rst:191 +msgid ":c:macro:`PyObject_GC_New`" +msgstr "" + +#: ../../c-api/gcsupport.rst:192 +msgid ":c:macro:`PyObject_GC_NewVar`" +msgstr "" + +#: ../../c-api/gcsupport.rst:194 +msgid ":c:member:`~PyTypeObject.tp_free`" +msgstr "" + +#: ../../c-api/gcsupport.rst:199 msgid "" "Remove the object *op* from the set of container objects tracked by the " "collector. Note that :c:func:`PyObject_GC_Track` can be called again on " -"this object to add it back to the set of tracked objects. The deallocator (:" -"c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the object " -"before any of the fields used by the :c:member:`~PyTypeObject.tp_traverse` " -"handler become invalid." +"this object to add it back to the set of tracked objects. The deallocator " +"(:c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the " +"object before any of the fields used by " +"the :c:member:`~PyTypeObject.tp_traverse` handler become invalid." msgstr "" -#: ../../c-api/gcsupport.rst:151 +#: ../../c-api/gcsupport.rst:208 msgid "" "The :c:func:`!_PyObject_GC_TRACK` and :c:func:`!_PyObject_GC_UNTRACK` macros " "have been removed from the public C API." msgstr "" -#: ../../c-api/gcsupport.rst:154 +#: ../../c-api/gcsupport.rst:211 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` handler accepts a function " "parameter of this type:" msgstr "" -#: ../../c-api/gcsupport.rst:159 +#: ../../c-api/gcsupport.rst:216 msgid "" -"Type of the visitor function passed to the :c:member:`~PyTypeObject." -"tp_traverse` handler. The function should be called with an object to " -"traverse as *object* and the third parameter to the :c:member:`~PyTypeObject." -"tp_traverse` handler as *arg*. The Python core uses several visitor " -"functions to implement cyclic garbage detection; it's not expected that " -"users will need to write their own visitor functions." +"Type of the visitor function passed to " +"the :c:member:`~PyTypeObject.tp_traverse` handler. The function should be " +"called with an object to traverse as *object* and the third parameter to " +"the :c:member:`~PyTypeObject.tp_traverse` handler as *arg*. The Python core " +"uses several visitor functions to implement cyclic garbage detection; it's " +"not expected that users will need to write their own visitor functions." msgstr "" -#: ../../c-api/gcsupport.rst:166 +#: ../../c-api/gcsupport.rst:223 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` handler must have the following " "type:" msgstr "" -#: ../../c-api/gcsupport.rst:171 +#: ../../c-api/gcsupport.rst:228 msgid "" "Traversal function for a container object. Implementations must call the " "*visit* function for each object directly contained by *self*, with the " @@ -245,15 +321,15 @@ msgid "" "returned immediately." msgstr "" -#: ../../c-api/gcsupport.rst:178 +#: ../../c-api/gcsupport.rst:235 msgid "" -"To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, a :c:" -"func:`Py_VISIT` macro is provided. In order to use this macro, the :c:" -"member:`~PyTypeObject.tp_traverse` implementation must name its arguments " -"exactly *visit* and *arg*:" +"To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, " +"a :c:func:`Py_VISIT` macro is provided. In order to use this macro, " +"the :c:member:`~PyTypeObject.tp_traverse` implementation must name its " +"arguments exactly *visit* and *arg*:" msgstr "" -#: ../../c-api/gcsupport.rst:185 +#: ../../c-api/gcsupport.rst:242 msgid "" "If the :c:expr:`PyObject *` *o* is not ``NULL``, call the *visit* callback, " "with arguments *o* and *arg*. If *visit* returns a non-zero value, then " @@ -261,7 +337,7 @@ msgid "" "look like::" msgstr "" -#: ../../c-api/gcsupport.rst:190 +#: ../../c-api/gcsupport.rst:247 msgid "" "static int\n" "my_traverse(Noddy *self, visitproc visit, void *arg)\n" @@ -279,13 +355,13 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/gcsupport.rst:198 +#: ../../c-api/gcsupport.rst:255 msgid "" -"The :c:member:`~PyTypeObject.tp_clear` handler must be of the :c:type:" -"`inquiry` type, or ``NULL`` if the object is immutable." +"The :c:member:`~PyTypeObject.tp_clear` handler must be of " +"the :c:type:`inquiry` type, or ``NULL`` if the object is immutable." msgstr "" -#: ../../c-api/gcsupport.rst:204 +#: ../../c-api/gcsupport.rst:261 msgid "" "Drop references that may have created reference cycles. Immutable objects " "do not have to define this method since they can never directly create " @@ -295,82 +371,82 @@ msgid "" "in a reference cycle." msgstr "" -#: ../../c-api/gcsupport.rst:213 +#: ../../c-api/gcsupport.rst:270 msgid "Controlling the Garbage Collector State" msgstr "" -#: ../../c-api/gcsupport.rst:215 +#: ../../c-api/gcsupport.rst:272 msgid "" "The C-API provides the following functions for controlling garbage " "collection runs." msgstr "" -#: ../../c-api/gcsupport.rst:220 +#: ../../c-api/gcsupport.rst:277 msgid "" "Perform a full garbage collection, if the garbage collector is enabled. " "(Note that :func:`gc.collect` runs it unconditionally.)" msgstr "" -#: ../../c-api/gcsupport.rst:223 +#: ../../c-api/gcsupport.rst:280 msgid "" "Returns the number of collected + unreachable objects which cannot be " "collected. If the garbage collector is disabled or already collecting, " -"returns ``0`` immediately. Errors during garbage collection are passed to :" -"data:`sys.unraisablehook`. This function does not raise exceptions." +"returns ``0`` immediately. Errors during garbage collection are passed " +"to :data:`sys.unraisablehook`. This function does not raise exceptions." msgstr "" -#: ../../c-api/gcsupport.rst:233 +#: ../../c-api/gcsupport.rst:290 msgid "" "Enable the garbage collector: similar to :func:`gc.enable`. Returns the " "previous state, 0 for disabled and 1 for enabled." msgstr "" -#: ../../c-api/gcsupport.rst:241 +#: ../../c-api/gcsupport.rst:298 msgid "" "Disable the garbage collector: similar to :func:`gc.disable`. Returns the " "previous state, 0 for disabled and 1 for enabled." msgstr "" -#: ../../c-api/gcsupport.rst:249 +#: ../../c-api/gcsupport.rst:306 msgid "" "Query the state of the garbage collector: similar to :func:`gc.isenabled`. " "Returns the current state, 0 for disabled and 1 for enabled." msgstr "" -#: ../../c-api/gcsupport.rst:256 +#: ../../c-api/gcsupport.rst:313 msgid "Querying Garbage Collector State" msgstr "" -#: ../../c-api/gcsupport.rst:258 +#: ../../c-api/gcsupport.rst:315 msgid "" "The C-API provides the following interface for querying information about " "the garbage collector." msgstr "" -#: ../../c-api/gcsupport.rst:263 +#: ../../c-api/gcsupport.rst:320 msgid "" "Run supplied *callback* on all live GC-capable objects. *arg* is passed " "through to all invocations of *callback*." msgstr "" -#: ../../c-api/gcsupport.rst:267 +#: ../../c-api/gcsupport.rst:324 msgid "" "If new objects are (de)allocated by the callback it is undefined if they " "will be visited." msgstr "" -#: ../../c-api/gcsupport.rst:270 +#: ../../c-api/gcsupport.rst:327 msgid "" "Garbage collection is disabled during operation. Explicitly running a " "collection in the callback may lead to undefined behaviour e.g. visiting the " "same objects multiple times or not at all." msgstr "" -#: ../../c-api/gcsupport.rst:278 +#: ../../c-api/gcsupport.rst:335 msgid "" -"Type of the visitor function to be passed to :c:func:" -"`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* passed to " -"``PyUnstable_GC_VisitObjects``. Return ``1`` to continue iteration, return " -"``0`` to stop iteration. Other return values are reserved for now so " -"behavior on returning anything else is undefined." +"Type of the visitor function to be passed " +"to :c:func:`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* " +"passed to ``PyUnstable_GC_VisitObjects``. Return ``1`` to continue " +"iteration, return ``0`` to stop iteration. Other return values are reserved " +"for now so behavior on returning anything else is undefined." msgstr "" diff --git a/c-api/hash.po b/c-api/hash.po index bd50f539c26..87d5bc0a8e3 100644 --- a/c-api/hash.po +++ b/c-api/hash.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-12 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-04-30 00:20+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -62,10 +62,6 @@ msgstr "用於複數虛數部分的乘數。" msgid "Hash function definition used by :c:func:`PyHash_GetFuncDef`." msgstr ":c:func:`PyHash_GetFuncDef` 所使用的雜湊函式定義。" -#: ../../c-api/hash.rst:56 -msgid "Hash function." -msgstr "雜湊函式。" - #: ../../c-api/hash.rst:60 msgid "Hash function name (UTF-8 encoded string)." msgstr "雜湊函式名稱(UTF-8 編碼字串)。" @@ -100,7 +96,30 @@ msgstr "" msgid "The function cannot fail: it cannot return ``-1``." msgstr "此函式不會失敗:它不會回傳 ``-1``。" -#: ../../c-api/hash.rst:94 +#: ../../c-api/hash.rst:95 +msgid "" +"Compute and return the hash value of a buffer of *len* bytes starting at " +"address *ptr*. The hash is guaranteed to match that " +"of :class:`bytes`, :class:`memoryview`, and other built-in objects that " +"implement the :ref:`buffer protocol `." +msgstr "" + +#: ../../c-api/hash.rst:100 +msgid "" +"Use this function to implement hashing for immutable objects " +"whose :c:member:`~PyTypeObject.tp_richcompare` function compares to another " +"object's buffer." +msgstr "" + +#: ../../c-api/hash.rst:104 +msgid "*len* must be greater than or equal to ``0``." +msgstr "" + +#: ../../c-api/hash.rst:106 +msgid "This function always succeeds." +msgstr "" + +#: ../../c-api/hash.rst:113 msgid "" "Generic hashing function that is meant to be put into a type object's " "``tp_hash`` slot. Its result only depends on the object's identity." @@ -108,6 +127,9 @@ msgstr "" "泛用雜湊函式,旨在放入型別物件的 ``tp_hash`` 插槽中。其結果僅取決於物件的識別" "性。" -#: ../../c-api/hash.rst:99 +#: ../../c-api/hash.rst:118 msgid "In CPython, it is equivalent to :c:func:`Py_HashPointer`." msgstr "在 CPython 中,它等價於 :c:func:`Py_HashPointer`。" + +#~ msgid "Hash function." +#~ msgstr "雜湊函式。" diff --git a/c-api/import.po b/c-api/import.po index 8f830d9e96d..72d0365616b 100644 --- a/c-api/import.po +++ b/c-api/import.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,8 +25,8 @@ msgstr "引入模組" #: ../../c-api/import.rst:16 msgid "" -"This is a wrapper around :c:func:`PyImport_Import()` which takes a :c:expr:" -"`const char *` as an argument instead of a :c:expr:`PyObject *`." +"This is a wrapper around :c:func:`PyImport_Import()` which takes " +"a :c:expr:`const char *` as an argument instead of a :c:expr:`PyObject *`." msgstr "" #: ../../c-api/import.rst:21 @@ -54,15 +54,16 @@ msgstr "" #: ../../c-api/import.rst:40 ../../c-api/import.rst:56 msgid "" "The return value is a new reference to the imported module or top-level " -"package, or ``NULL`` with an exception set on failure. Like for :func:" -"`__import__`, the return value when a submodule of a package was requested " -"is normally the top-level package, unless a non-empty *fromlist* was given." +"package, or ``NULL`` with an exception set on failure. Like " +"for :func:`__import__`, the return value when a submodule of a package was " +"requested is normally the top-level package, unless a non-empty *fromlist* " +"was given." msgstr "" #: ../../c-api/import.rst:46 msgid "" -"Failing imports remove incomplete module objects, like with :c:func:" -"`PyImport_ImportModule`." +"Failing imports remove incomplete module objects, like " +"with :c:func:`PyImport_ImportModule`." msgstr "" #: ../../c-api/import.rst:52 @@ -125,10 +126,10 @@ msgstr "" #: ../../c-api/import.rst:102 msgid "" "This function does not load or import the module; if the module wasn't " -"already loaded, you will get an empty module object. Use :c:func:" -"`PyImport_ImportModule` or one of its variants to import a module. Package " -"structures implied by a dotted name for *name* are not created if not " -"already present." +"already loaded, you will get an empty module object. " +"Use :c:func:`PyImport_ImportModule` or one of its variants to import a " +"module. Package structures implied by a dotted name for *name* are not " +"created if not already present." msgstr "" #: ../../c-api/import.rst:113 @@ -150,11 +151,11 @@ msgid "" "function :func:`compile`, load the module. Return a new reference to the " "module object, or ``NULL`` with an exception set if an error occurred. " "*name* is removed from :data:`sys.modules` in error cases, even if *name* " -"was already in :data:`sys.modules` on entry to :c:func:" -"`PyImport_ExecCodeModule`. Leaving incompletely initialized modules in :" -"data:`sys.modules` is dangerous, as imports of such modules have no way to " -"know that the module object is an unknown (and probably damaged with respect " -"to the module author's intents) state." +"was already in :data:`sys.modules` on entry " +"to :c:func:`PyImport_ExecCodeModule`. Leaving incompletely initialized " +"modules in :data:`sys.modules` is dangerous, as imports of such modules have " +"no way to know that the module object is an unknown (and probably damaged " +"with respect to the module author's intents) state." msgstr "" #: ../../c-api/import.rst:139 @@ -168,14 +169,14 @@ msgstr "" #: ../../c-api/import.rst:144 msgid "" "The module's :attr:`~module.__file__` attribute will be set to the code " -"object's :attr:`~codeobject.co_filename`. If applicable, :attr:`~module." -"__cached__` will also be set." +"object's :attr:`~codeobject.co_filename`. If " +"applicable, :attr:`~module.__cached__` will also be set." msgstr "" #: ../../c-api/import.rst:148 msgid "" -"This function will reload the module if it was already imported. See :c:" -"func:`PyImport_ReloadModule` for the intended way to reload a module." +"This function will reload the module if it was already imported. " +"See :c:func:`PyImport_ReloadModule` for the intended way to reload a module." msgstr "" #: ../../c-api/import.rst:151 @@ -186,8 +187,8 @@ msgstr "" #: ../../c-api/import.rst:154 msgid "" -"See also :c:func:`PyImport_ExecCodeModuleEx` and :c:func:" -"`PyImport_ExecCodeModuleWithPathnames`." +"See also :c:func:`PyImport_ExecCodeModuleEx` " +"and :c:func:`PyImport_ExecCodeModuleWithPathnames`." msgstr "" #: ../../c-api/import.rst:157 @@ -215,8 +216,8 @@ msgstr "" #: ../../c-api/import.rst:179 msgid "" -"Setting :attr:`~module.__cached__` is deprecated. See :class:`~importlib." -"machinery.ModuleSpec` for alternatives." +"Setting :attr:`~module.__cached__` is deprecated. " +"See :class:`~importlib.machinery.ModuleSpec` for alternatives." msgstr "" #: ../../c-api/import.rst:186 @@ -257,8 +258,8 @@ msgstr "" #: ../../c-api/import.rst:219 msgid "" -"Return the dictionary used for the module administration (a.k.a. ``sys." -"modules``). Note that this is a per-interpreter variable." +"Return the dictionary used for the module administration (a.k.a. " +"``sys.modules``). Note that this is a per-interpreter variable." msgstr "" #: ../../c-api/import.rst:224 @@ -275,17 +276,18 @@ msgid "" "dict. If it wasn't yet cached, traverse :data:`sys.path_hooks` until a hook " "is found that can handle the path item. Return ``None`` if no hook could; " "this tells our caller that the :term:`path based finder` could not find a " -"finder for this path item. Cache the result in :data:`sys." -"path_importer_cache`. Return a new reference to the finder object." +"finder for this path item. Cache the result " +"in :data:`sys.path_importer_cache`. Return a new reference to the finder " +"object." msgstr "" #: ../../c-api/import.rst:243 msgid "" "Load a frozen module named *name*. Return ``1`` for success, ``0`` if the " "module is not found, and ``-1`` with an exception set if the initialization " -"failed. To access the imported module on a successful load, use :c:func:" -"`PyImport_ImportModule`. (Note the misnomer --- this function would reload " -"the module if it was already imported.)" +"failed. To access the imported module on a successful load, " +"use :c:func:`PyImport_ImportModule`. (Note the misnomer --- this function " +"would reload the module if it was already imported.)" msgstr "" #: ../../c-api/import.rst:251 @@ -302,8 +304,8 @@ msgstr "" msgid "" "This is the structure type definition for frozen module descriptors, as " "generated by the :program:`freeze` utility (see :file:`Tools/freeze/` in the " -"Python source distribution). Its definition, found in :file:`Include/import." -"h`, is::" +"Python source distribution). Its definition, found in :file:`Include/" +"import.h`, is::" msgstr "" #: ../../c-api/import.rst:270 @@ -366,12 +368,12 @@ msgstr "" #: ../../c-api/import.rst:318 msgid "" "Add a collection of modules to the table of built-in modules. The *newtab* " -"array must end with a sentinel entry which contains ``NULL`` for the :c:" -"member:`~_inittab.name` field; failure to provide the sentinel value can " -"result in a memory fault. Returns ``0`` on success or ``-1`` if insufficient " -"memory could be allocated to extend the internal table. In the event of " -"failure, no modules are added to the internal table. This must be called " -"before :c:func:`Py_Initialize`." +"array must end with a sentinel entry which contains ``NULL`` for " +"the :c:member:`~_inittab.name` field; failure to provide the sentinel value " +"can result in a memory fault. Returns ``0`` on success or ``-1`` if " +"insufficient memory could be allocated to extend the internal table. In the " +"event of failure, no modules are added to the internal table. This must be " +"called before :c:func:`Py_Initialize`." msgstr "" #: ../../c-api/import.rst:325 @@ -381,6 +383,28 @@ msgid "" "initialization." msgstr "" +#: ../../c-api/import.rst:332 +msgid "Import the module *mod_name* and get its attribute *attr_name*." +msgstr "" + +#: ../../c-api/import.rst:334 +msgid "Names must be Python :class:`str` objects." +msgstr "" + +#: ../../c-api/import.rst:336 +msgid "" +"Helper function combining :c:func:`PyImport_Import` " +"and :c:func:`PyObject_GetAttr`. For example, it can raise :exc:`ImportError` " +"if the module is not found, and :exc:`AttributeError` if the attribute " +"doesn't exist." +msgstr "" + +#: ../../c-api/import.rst:345 +msgid "" +"Similar to :c:func:`PyImport_ImportModuleAttr`, but names are UTF-8 encoded " +"strings instead of Python :class:`str` objects." +msgstr "" + #: ../../c-api/import.rst:11 msgid "package variable" msgstr "package variable(套件變數)" diff --git a/c-api/init.po b/c-api/init.po index cc5d9d5c5f8..cf945d75b91 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-27 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -205,10 +205,8 @@ msgstr ":c:func:`PyMutex_Unlock`" msgid "" "Despite their apparent similarity to some of the functions listed above, the " "following functions **should not be called** before the interpreter has been " -"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:" -"`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:" -"`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:" -"`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, and :c:func:`Py_RunMain`." +"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, " +"and :c:func:`Py_RunMain`." msgstr "" #: ../../c-api/init.rst:90 @@ -218,30 +216,30 @@ msgstr "" #: ../../c-api/init.rst:92 msgid "" "Python has variables for the global configuration to control different " -"features and options. By default, these flags are controlled by :ref:" -"`command line options `." +"features and options. By default, these flags are controlled " +"by :ref:`command line options `." msgstr "" #: ../../c-api/init.rst:96 msgid "" "When a flag is set by an option, the value of the flag is the number of " -"times that the option was set. For example, ``-b`` sets :c:data:" -"`Py_BytesWarningFlag` to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to " -"2." +"times that the option was set. For example, ``-b`` " +"sets :c:data:`Py_BytesWarningFlag` to 1 and ``-bb`` " +"sets :c:data:`Py_BytesWarningFlag` to 2." msgstr "" #: ../../c-api/init.rst:102 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"bytes_warning` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.bytes_warning` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:106 msgid "" -"Issue a warning when comparing :class:`bytes` or :class:`bytearray` with :" -"class:`str` or :class:`bytes` with :class:`int`. Issue an error if greater " -"or equal to ``2``." +"Issue a warning when comparing :class:`bytes` or :class:`bytearray` " +"with :class:`str` or :class:`bytes` with :class:`int`. Issue an error if " +"greater or equal to ``2``." msgstr "" #: ../../c-api/init.rst:110 @@ -250,9 +248,9 @@ msgstr "由 :option:`-b` 選項設定。" #: ../../c-api/init.rst:116 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"parser_debug` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.parser_debug` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:120 @@ -269,9 +267,9 @@ msgstr "由 :option:`-d` 選項與 :envvar:`PYTHONDEBUG` 環境變數設定。" #: ../../c-api/init.rst:130 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"write_bytecode` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.write_bytecode` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:134 @@ -289,15 +287,15 @@ msgstr "" #: ../../c-api/init.rst:144 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"pathconfig_warnings` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.pathconfig_warnings` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:148 msgid "" -"Suppress error messages when calculating the module search path in :c:func:" -"`Py_GetPath`." +"Suppress error messages when calculating the module search path " +"in :c:func:`Py_GetPath`." msgstr "" #: ../../c-api/init.rst:151 @@ -306,8 +304,9 @@ msgstr "" #: ../../c-api/init.rst:157 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"hash_seed` and :c:member:`PyConfig.use_hash_seed` should be used instead, " +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.hash_seed` " +"and :c:member:`PyConfig.use_hash_seed` should be used instead, " "see :ref:`Python Initialization Configuration `." msgstr "" @@ -326,15 +325,15 @@ msgstr "" #: ../../c-api/init.rst:172 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"use_environment` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.use_environment` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:176 msgid "" -"Ignore all :envvar:`!PYTHON*` environment variables, e.g. :envvar:" -"`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." +"Ignore all :envvar:`!PYTHON*` environment variables, " +"e.g. :envvar:`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." msgstr "" "忽略所有可能被設定的 :envvar:`!PYTHON*` 環境變數,例如 :envvar:`PYTHONPATH` " "與 :envvar:`PYTHONHOME`。" @@ -345,9 +344,9 @@ msgstr "由 :option:`-E` 與 :option:`-I` 選項設定。" #: ../../c-api/init.rst:185 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"inspect` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.inspect` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:189 @@ -365,9 +364,9 @@ msgstr "由 :option:`-i` 選項與 :envvar:`PYTHONINSPECT` 環境變數設定。 #: ../../c-api/init.rst:200 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"interactive` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.interactive` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:204 @@ -376,9 +375,9 @@ msgstr "由 :option:`-i` 選項設定。" #: ../../c-api/init.rst:210 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"isolated` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.isolated` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:214 @@ -393,9 +392,9 @@ msgstr "由 :option:`-i` 選項設定。" #: ../../c-api/init.rst:225 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyPreConfig." -"legacy_windows_fs_encoding` should be used instead, see :ref:`Python " -"Initialization Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyPreConfig.legacy_windows_fs_encoding` should be used " +"instead, see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:229 @@ -423,15 +422,15 @@ msgstr "可用性" #: ../../c-api/init.rst:244 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"legacy_windows_stdio` should be used instead, see :ref:`Python " -"Initialization Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.legacy_windows_stdio` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:248 msgid "" -"If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!io." -"_WindowsConsoleIO` for :mod:`sys` standard streams." +"If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!" +"io._WindowsConsoleIO` for :mod:`sys` standard streams." msgstr "" #: ../../c-api/init.rst:251 @@ -446,17 +445,17 @@ msgstr "更多詳情請見 :pep:`528`。" #: ../../c-api/init.rst:262 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"site_import` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.site_import` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:266 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " -"manipulations if :mod:`site` is explicitly imported later (call :func:`site." -"main` if you want them to be triggered)." +"manipulations if :mod:`site` is explicitly imported later " +"(call :func:`site.main` if you want them to be triggered)." msgstr "" #: ../../c-api/init.rst:271 @@ -465,30 +464,30 @@ msgstr "由 :option:`-S` 選項設定。" #: ../../c-api/init.rst:277 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"user_site_directory` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.user_site_directory` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:281 msgid "" -"Don't add the :data:`user site-packages directory ` to :data:" -"`sys.path`." +"Don't add the :data:`user site-packages directory ` " +"to :data:`sys.path`." msgstr "" #: ../../c-api/init.rst:284 msgid "" -"Set by the :option:`-s` and :option:`-I` options, and the :envvar:" -"`PYTHONNOUSERSITE` environment variable." +"Set by the :option:`-s` and :option:`-I` options, and " +"the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" "由 :option:`-s` 選項、:option:`-I` 選項與 :envvar:`PYTHONNOUSERSITE` 環境變數" "設定。" #: ../../c-api/init.rst:291 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"optimization_level` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.optimization_level` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:295 @@ -499,9 +498,9 @@ msgstr "由 :option:`-O` 選項與 :envvar:`PYTHONOPTIMIZE` 環境變數設定 #: ../../c-api/init.rst:302 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"quiet` should be used instead, see :ref:`Python Initialization Configuration " -"`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.quiet` should be used instead, see :ref:`Python " +"Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:306 @@ -515,9 +514,9 @@ msgstr "由 :option:`-q` 選項設定。" #: ../../c-api/init.rst:316 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"buffered_stdio` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.buffered_stdio` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:320 @@ -532,9 +531,9 @@ msgstr "由 :option:`-u` 選項與 :envvar:`PYTHONUNBUFFERED` 環境變數設定 #: ../../c-api/init.rst:329 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"verbose` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.verbose` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:333 @@ -558,8 +557,9 @@ msgstr "" #: ../../c-api/init.rst:360 msgid "" "Initialize the Python interpreter. In an application embedding Python, " -"this should be called before using any other Python/C API functions; see :" -"ref:`Before Python Initialization ` for the few exceptions." +"this should be called before using any other Python/C API functions; " +"see :ref:`Before Python Initialization ` for the few " +"exceptions." msgstr "" #: ../../c-api/init.rst:364 @@ -622,28 +622,37 @@ msgstr "" #: ../../c-api/init.rst:417 msgid "" "Undo all initializations made by :c:func:`Py_Initialize` and subsequent use " -"of Python/C API functions, and destroy all sub-interpreters (see :c:func:" -"`Py_NewInterpreter` below) that were created and not yet destroyed since the " -"last call to :c:func:`Py_Initialize`. Ideally, this frees all memory " -"allocated by the Python interpreter. This is a no-op when called for a " -"second time (without calling :c:func:`Py_Initialize` again first)." +"of Python/C API functions, and destroy all sub-interpreters " +"(see :c:func:`Py_NewInterpreter` below) that were created and not yet " +"destroyed since the last call to :c:func:`Py_Initialize`. This is a no-op " +"when called for a second time (without calling :c:func:`Py_Initialize` again " +"first)." msgstr "" -#: ../../c-api/init.rst:424 +#: ../../c-api/init.rst:423 msgid "" "Since this is the reverse of :c:func:`Py_Initialize`, it should be called in " "the same thread with the same interpreter active. That means the main " -"thread and the main interpreter. This should never be called while :c:func:" -"`Py_RunMain` is running." +"thread and the main interpreter. This should never be called " +"while :c:func:`Py_RunMain` is running." msgstr "" -#: ../../c-api/init.rst:429 +#: ../../c-api/init.rst:428 msgid "" "Normally the return value is ``0``. If there were errors during finalization " "(flushing buffered data), ``-1`` is returned." msgstr "" -#: ../../c-api/init.rst:433 +#: ../../c-api/init.rst:432 +msgid "" +"Note that Python will do a best effort at freeing all memory allocated by " +"the Python interpreter. Therefore, any C-Extension should make sure to " +"correctly clean up all of the preveiously allocated PyObjects before using " +"them in subsequent calls to :c:func:`Py_Initialize`. Otherwise it could " +"introduce vulnerabilities and incorrect behavior." +msgstr "" + +#: ../../c-api/init.rst:438 msgid "" "This function is provided for a number of reasons. An embedding application " "might want to restart Python without having to restart the application " @@ -654,7 +663,7 @@ msgid "" "Python before exiting from the application." msgstr "" -#: ../../c-api/init.rst:441 +#: ../../c-api/init.rst:446 msgid "" "**Bugs and caveats:** The destruction of modules and objects in modules is " "done in random order; this may cause destructors (:meth:`~object.__del__` " @@ -662,7 +671,8 @@ msgid "" "modules. Dynamically loaded extension modules loaded by Python are not " "unloaded. Small amounts of memory allocated by the Python interpreter may " "not be freed (if you find a leak, please report it). Memory tied up in " -"circular references between objects is not freed. Some memory allocated by " +"circular references between objects is not freed. Interned strings will all " +"be deallocated regardless of their reference count. Some memory allocated by " "extension modules may not be freed. Some extensions may not work properly " "if their initialization routine is called more than once; this can happen if " "an application calls :c:func:`Py_Initialize` and :c:func:`Py_FinalizeEx` " @@ -673,28 +683,28 @@ msgid "" "stdout and stderr files." msgstr "" -#: ../../c-api/init.rst:456 +#: ../../c-api/init.rst:462 msgid "" -"Raises an :ref:`auditing event ` ``cpython." -"_PySys_ClearAuditHooks`` with no arguments." +"Raises an :ref:`auditing event ` " +"``cpython._PySys_ClearAuditHooks`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." -"_PySys_ClearAuditHooks``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` " +"``cpython._PySys_ClearAuditHooks``。" -#: ../../c-api/init.rst:463 +#: ../../c-api/init.rst:469 msgid "" "This is a backwards-compatible version of :c:func:`Py_FinalizeEx` that " "disregards the return value." msgstr "" -#: ../../c-api/init.rst:469 +#: ../../c-api/init.rst:475 msgid "" "Similar to :c:func:`Py_Main` but *argv* is an array of bytes strings, " "allowing the calling application to delegate the text decoding step to the " "CPython runtime." msgstr "" -#: ../../c-api/init.rst:478 +#: ../../c-api/init.rst:484 msgid "" "The main program for the standard interpreter, encapsulating a full " "initialization/finalization cycle, as well as additional behaviour to " @@ -703,14 +713,14 @@ msgid "" "cmdline`." msgstr "" -#: ../../c-api/init.rst:484 +#: ../../c-api/init.rst:490 msgid "" "This is made available for programs which wish to support the full CPython " "command line interface, rather than just embedding a Python runtime in a " "larger application." msgstr "" -#: ../../c-api/init.rst:488 +#: ../../c-api/init.rst:494 msgid "" "The *argc* and *argv* parameters are similar to those which are passed to a " "C program's :c:func:`main` function, except that the *argv* entries are " @@ -720,20 +730,20 @@ msgid "" "pointed to by the argument list are not modified)." msgstr "" -#: ../../c-api/init.rst:495 +#: ../../c-api/init.rst:501 msgid "" "The return value is ``2`` if the argument list does not represent a valid " "Python command line, and otherwise the same as :c:func:`Py_RunMain`." msgstr "" -#: ../../c-api/init.rst:498 +#: ../../c-api/init.rst:504 msgid "" -"In terms of the CPython runtime configuration APIs documented in the :ref:" -"`runtime configuration ` section (and without accounting for " -"error handling), ``Py_Main`` is approximately equivalent to::" +"In terms of the CPython runtime configuration APIs documented in " +"the :ref:`runtime configuration ` section (and without " +"accounting for error handling), ``Py_Main`` is approximately equivalent to::" msgstr "" -#: ../../c-api/init.rst:502 +#: ../../c-api/init.rst:508 msgid "" "PyConfig config;\n" "PyConfig_InitPythonConfig(&config);\n" @@ -744,33 +754,33 @@ msgid "" "Py_RunMain();" msgstr "" -#: ../../c-api/init.rst:510 +#: ../../c-api/init.rst:516 msgid "" "In normal usage, an embedding application will call this function *instead* " -"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` or :c:func:" -"`Py_InitializeFromConfig` directly, and all settings will be applied as " -"described elsewhere in this documentation. If this function is instead " -"called *after* a preceding runtime initialization API call, then exactly " -"which environmental and command line configuration settings will be updated " -"is version dependent (as it depends on which settings correctly support " -"being modified after they have already been set once when the runtime was " -"first initialized)." +"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` " +"or :c:func:`Py_InitializeFromConfig` directly, and all settings will be " +"applied as described elsewhere in this documentation. If this function is " +"instead called *after* a preceding runtime initialization API call, then " +"exactly which environmental and command line configuration settings will be " +"updated is version dependent (as it depends on which settings correctly " +"support being modified after they have already been set once when the " +"runtime was first initialized)." msgstr "" -#: ../../c-api/init.rst:523 +#: ../../c-api/init.rst:529 msgid "Executes the main module in a fully configured CPython runtime." msgstr "" -#: ../../c-api/init.rst:525 +#: ../../c-api/init.rst:531 msgid "" -"Executes the command (:c:member:`PyConfig.run_command`), the script (:c:" -"member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig." -"run_module`) specified on the command line or in the configuration. If none " -"of these values are set, runs the interactive Python prompt (REPL) using the " -"``__main__`` module's global namespace." +"Executes the command (:c:member:`PyConfig.run_command`), the script " +"(:c:member:`PyConfig.run_filename`) or the module " +"(:c:member:`PyConfig.run_module`) specified on the command line or in the " +"configuration. If none of these values are set, runs the interactive Python " +"prompt (REPL) using the ``__main__`` module's global namespace." msgstr "" -#: ../../c-api/init.rst:531 +#: ../../c-api/init.rst:537 msgid "" "If :c:member:`PyConfig.inspect` is not set (the default), the return value " "will be ``0`` if the interpreter exits normally (that is, without raising an " @@ -778,7 +788,7 @@ msgid "" "any other unhandled exception." msgstr "" -#: ../../c-api/init.rst:536 +#: ../../c-api/init.rst:542 msgid "" "If :c:member:`PyConfig.inspect` is set (such as when the :option:`-i` option " "is used), rather than returning when the interpreter exits, execution will " @@ -789,41 +799,41 @@ msgid "" "status of a :exc:`SystemExit`, as specified above." msgstr "" -#: ../../c-api/init.rst:544 +#: ../../c-api/init.rst:550 msgid "" "This function always finalizes the Python interpreter before it returns." msgstr "" -#: ../../c-api/init.rst:546 +#: ../../c-api/init.rst:552 msgid "" "See :ref:`Python Configuration ` for an example of a " -"customized Python that always runs in isolated mode using :c:func:" -"`Py_RunMain`." +"customized Python that always runs in isolated mode " +"using :c:func:`Py_RunMain`." msgstr "" -#: ../../c-api/init.rst:552 +#: ../../c-api/init.rst:558 msgid "" "Register an :mod:`atexit` callback for the target interpreter *interp*. This " "is similar to :c:func:`Py_AtExit`, but takes an explicit interpreter and " "data pointer for the callback." msgstr "" -#: ../../c-api/init.rst:556 -msgid "The :term:`GIL` must be held for *interp*." +#: ../../c-api/init.rst:562 +msgid "There must be an :term:`attached thread state` for *interp*." msgstr "" -#: ../../c-api/init.rst:561 +#: ../../c-api/init.rst:567 msgid "Process-wide parameters" msgstr "" -#: ../../c-api/init.rst:571 +#: ../../c-api/init.rst:577 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"program_name` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.program_name` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:575 +#: ../../c-api/init.rst:581 msgid "" "This function should be called before :c:func:`Py_Initialize` is called for " "the first time, if it is called at all. It tells the interpreter the value " @@ -837,37 +847,39 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:586 ../../c-api/init.rst:828 ../../c-api/init.rst:864 -#: ../../c-api/init.rst:890 +#: ../../c-api/init.rst:592 ../../c-api/init.rst:840 ../../c-api/init.rst:876 +#: ../../c-api/init.rst:902 msgid "" -"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" -"`wchar_t*` string." +"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get " +"a :c:expr:`wchar_t*` string." msgstr "" -#: ../../c-api/init.rst:594 +#: ../../c-api/init.rst:600 msgid "" "Return the program name set with :c:member:`PyConfig.program_name`, or the " "default. The returned string points into static storage; the caller should " "not modify its value." msgstr "" -#: ../../c-api/init.rst:598 ../../c-api/init.rst:620 ../../c-api/init.rst:666 -#: ../../c-api/init.rst:688 ../../c-api/init.rst:714 ../../c-api/init.rst:902 +#: ../../c-api/init.rst:604 ../../c-api/init.rst:627 ../../c-api/init.rst:675 +#: ../../c-api/init.rst:699 ../../c-api/init.rst:726 ../../c-api/init.rst:914 msgid "" "This function should not be called before :c:func:`Py_Initialize`, otherwise " "it returns ``NULL``." msgstr "此函式不應該在 :c:func:`Py_Initialize` 之前呼叫,否則會回傳 ``NULL``。" -#: ../../c-api/init.rst:601 ../../c-api/init.rst:623 ../../c-api/init.rst:669 -#: ../../c-api/init.rst:691 ../../c-api/init.rst:719 ../../c-api/init.rst:905 +#: ../../c-api/init.rst:607 ../../c-api/init.rst:630 ../../c-api/init.rst:678 +#: ../../c-api/init.rst:702 ../../c-api/init.rst:731 ../../c-api/init.rst:917 msgid "It now returns ``NULL`` if called before :c:func:`Py_Initialize`." msgstr "如果在 :c:func:`Py_Initialize` 之前呼叫,現在會回傳 ``NULL``。" -#: ../../c-api/init.rst:604 ../../c-api/init.rst:694 -msgid "Get :data:`sys.executable` instead." +#: ../../c-api/init.rst:610 ../../c-api/init.rst:705 +msgid "" +"Use :c:func:`PyConfig_Get(\"executable\") ` " +"(:data:`sys.executable`) instead." msgstr "" -#: ../../c-api/init.rst:610 +#: ../../c-api/init.rst:617 msgid "" "Return the *prefix* for installed platform-independent files. This is " "derived through a number of complicated rules from the program name set " @@ -881,27 +893,29 @@ msgid "" "See also the next function." msgstr "" -#: ../../c-api/init.rst:626 +#: ../../c-api/init.rst:633 msgid "" -"Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if :ref:`virtual " -"environments ` need to be handled." +"Use :c:func:`PyConfig_Get(\"base_prefix\") ` " +"(:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get(\"prefix\") " +"` (:data:`sys.prefix`) if :ref:`virtual environments ` need to be handled." msgstr "" -#: ../../c-api/init.rst:633 +#: ../../c-api/init.rst:642 msgid "" "Return the *exec-prefix* for installed platform-*dependent* files. This is " "derived through a number of complicated rules from the program name set " "with :c:member:`PyConfig.program_name` and some environment variables; for " "example, if the program name is ``'/usr/local/bin/python'``, the exec-prefix " "is ``'/usr/local'``. The returned string points into static storage; the " -"caller should not modify its value. This corresponds to the :makevar:" -"`exec_prefix` variable in the top-level :file:`Makefile` and the ``--exec-" -"prefix`` argument to the :program:`configure` script at build time. The " -"value is available to Python code as ``sys.base_exec_prefix``. It is only " -"useful on Unix." +"caller should not modify its value. This corresponds to " +"the :makevar:`exec_prefix` variable in the top-level :file:`Makefile` and " +"the ``--exec-prefix`` argument to the :program:`configure` script at build " +"time. The value is available to Python code as ``sys.base_exec_prefix``. " +"It is only useful on Unix." msgstr "" -#: ../../c-api/init.rst:644 +#: ../../c-api/init.rst:653 msgid "" "Background: The exec-prefix differs from the prefix when platform dependent " "files (such as executables and shared libraries) are installed in a " @@ -910,7 +924,7 @@ msgid "" "independent may be installed in :file:`/usr/local`." msgstr "" -#: ../../c-api/init.rst:650 +#: ../../c-api/init.rst:659 msgid "" "Generally speaking, a platform is a combination of hardware and software " "families, e.g. Sparc machines running the Solaris 2.x operating system are " @@ -924,21 +938,24 @@ msgid "" "independent from the Python version by which they were compiled!)." msgstr "" -#: ../../c-api/init.rst:661 +#: ../../c-api/init.rst:670 msgid "" -"System administrators will know how to configure the :program:`mount` or :" -"program:`automount` programs to share :file:`/usr/local` between platforms " -"while having :file:`/usr/local/plat` be a different filesystem for each " -"platform." +"System administrators will know how to configure the :program:`mount` " +"or :program:`automount` programs to share :file:`/usr/local` between " +"platforms while having :file:`/usr/local/plat` be a different filesystem for " +"each platform." msgstr "" -#: ../../c-api/init.rst:672 +#: ../../c-api/init.rst:681 msgid "" -"Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if :ref:" -"`virtual environments ` need to be handled." +"Use :c:func:`PyConfig_Get(\"base_exec_prefix\") ` " +"(:data:`sys.base_exec_prefix`) instead. " +"Use :c:func:`PyConfig_Get(\"exec_prefix\") ` " +"(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " +"be handled." msgstr "" -#: ../../c-api/init.rst:682 +#: ../../c-api/init.rst:693 msgid "" "Return the full program name of the Python executable; this is computed as " "a side-effect of deriving the default module search path from the program " @@ -947,7 +964,7 @@ msgid "" "available to Python code as ``sys.executable``." msgstr "" -#: ../../c-api/init.rst:704 +#: ../../c-api/init.rst:716 msgid "" "Return the default module search path; this is computed from the program " "name (set by :c:member:`PyConfig.program_name`) and some environment " @@ -960,34 +977,36 @@ msgid "" "for loading modules." msgstr "" -#: ../../c-api/init.rst:722 -msgid "Get :data:`sys.path` instead." +#: ../../c-api/init.rst:734 +msgid "" +"Use :c:func:`PyConfig_Get(\"module_search_paths\") ` " +"(:data:`sys.path`) instead." msgstr "" -#: ../../c-api/init.rst:728 +#: ../../c-api/init.rst:740 msgid "" "Return the version of this Python interpreter. This is a string that looks " "something like ::" msgstr "" -#: ../../c-api/init.rst:731 +#: ../../c-api/init.rst:743 msgid "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" msgstr "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" -#: ../../c-api/init.rst:735 +#: ../../c-api/init.rst:747 msgid "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " "period. The returned string points into static storage; the caller should " -"not modify its value. The value is available to Python code as :data:`sys." -"version`." +"not modify its value. The value is available to Python code " +"as :data:`sys.version`." msgstr "" -#: ../../c-api/init.rst:740 +#: ../../c-api/init.rst:752 msgid "See also the :c:var:`Py_Version` constant." msgstr "另請參閱 :c:var:`Py_Version` 常數。" -#: ../../c-api/init.rst:747 +#: ../../c-api/init.rst:759 msgid "" "Return the platform identifier for the current platform. On Unix, this is " "formed from the \"official\" name of the operating system, converted to " @@ -998,58 +1017,58 @@ msgid "" "available to Python code as ``sys.platform``." msgstr "" -#: ../../c-api/init.rst:758 +#: ../../c-api/init.rst:770 msgid "" "Return the official copyright string for the current Python version, for " "example" msgstr "" -#: ../../c-api/init.rst:760 +#: ../../c-api/init.rst:772 msgid "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" msgstr "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" -#: ../../c-api/init.rst:764 +#: ../../c-api/init.rst:776 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as ``sys.copyright``." msgstr "" -#: ../../c-api/init.rst:770 +#: ../../c-api/init.rst:782 msgid "" "Return an indication of the compiler used to build the current Python " "version, in square brackets, for example::" msgstr "" -#: ../../c-api/init.rst:773 +#: ../../c-api/init.rst:785 msgid "\"[GCC 2.7.2.2]\"" msgstr "\"[GCC 2.7.2.2]\"" -#: ../../c-api/init.rst:777 ../../c-api/init.rst:791 +#: ../../c-api/init.rst:789 ../../c-api/init.rst:803 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as part of the variable " "``sys.version``." msgstr "" -#: ../../c-api/init.rst:784 +#: ../../c-api/init.rst:796 msgid "" "Return information about the sequence number and build date and time of the " "current Python interpreter instance, for example ::" msgstr "" -#: ../../c-api/init.rst:787 +#: ../../c-api/init.rst:799 msgid "\"#67, Aug 1 1997, 22:34:28\"" msgstr "\"#67, Aug 1 1997, 22:34:28\"" -#: ../../c-api/init.rst:803 +#: ../../c-api/init.rst:815 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " -"should be used instead, see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.argv`, :c:member:`PyConfig.parse_argv` " +"and :c:member:`PyConfig.safe_path` should be used instead, see :ref:`Python " +"Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:808 +#: ../../c-api/init.rst:820 msgid "" "Set :data:`sys.argv` based on *argc* and *argv*. These parameters are " "similar to those passed to the program's :c:func:`main` function with the " @@ -1060,84 +1079,85 @@ msgid "" "fatal condition is signalled using :c:func:`Py_FatalError`." msgstr "" -#: ../../c-api/init.rst:816 +#: ../../c-api/init.rst:828 msgid "" "If *updatepath* is zero, this is all the function does. If *updatepath* is " "non-zero, the function also modifies :data:`sys.path` according to the " "following algorithm:" msgstr "" -#: ../../c-api/init.rst:820 +#: ../../c-api/init.rst:832 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " -"path of the directory where the script is located is prepended to :data:`sys." -"path`." +"path of the directory where the script is located is prepended " +"to :data:`sys.path`." msgstr "" -#: ../../c-api/init.rst:823 +#: ../../c-api/init.rst:835 msgid "" "Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point to an " "existing file name), an empty string is prepended to :data:`sys.path`, which " "is the same as prepending the current working directory (``\".\"``)." msgstr "" -#: ../../c-api/init.rst:831 ../../c-api/init.rst:867 +#: ../../c-api/init.rst:843 ../../c-api/init.rst:879 msgid "" "See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` " "members of the :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:835 +#: ../../c-api/init.rst:847 msgid "" "It is recommended that applications embedding the Python interpreter for " "purposes other than executing a single script pass ``0`` as *updatepath*, " "and update :data:`sys.path` themselves if desired. See :cve:`2008-5983`." msgstr "" -#: ../../c-api/init.rst:840 +#: ../../c-api/init.rst:852 msgid "" "On versions before 3.1.3, you can achieve the same effect by manually " -"popping the first :data:`sys.path` element after having called :c:func:" -"`PySys_SetArgv`, for example using::" +"popping the first :data:`sys.path` element after having " +"called :c:func:`PySys_SetArgv`, for example using::" msgstr "" -#: ../../c-api/init.rst:844 +#: ../../c-api/init.rst:856 msgid "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" msgstr "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" -#: ../../c-api/init.rst:856 +#: ../../c-api/init.rst:868 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" -"`Python Initialization Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` should " +"be used instead, see :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:860 +#: ../../c-api/init.rst:872 msgid "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " -"``1`` unless the :program:`python` interpreter was started with the :option:" -"`-I`." +"``1`` unless the :program:`python` interpreter was started with " +"the :option:`-I`." msgstr "" -#: ../../c-api/init.rst:870 +#: ../../c-api/init.rst:882 msgid "The *updatepath* value depends on :option:`-I`." msgstr "" -#: ../../c-api/init.rst:877 +#: ../../c-api/init.rst:889 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"home` should be used instead, see :ref:`Python Initialization Configuration " -"`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.home` should be used instead, see :ref:`Python " +"Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:881 +#: ../../c-api/init.rst:893 msgid "" "Set the default \"home\" directory, that is, the location of the standard " "Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument " "string." msgstr "" -#: ../../c-api/init.rst:885 +#: ../../c-api/init.rst:897 msgid "" "The argument should point to a zero-terminated character string in static " "storage whose contents will not change for the duration of the program's " @@ -1145,26 +1165,28 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:898 +#: ../../c-api/init.rst:910 msgid "" -"Return the default \"home\", that is, the value set by :c:member:`PyConfig." -"home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " -"is set." +"Return the default \"home\", that is, the value set " +"by :c:member:`PyConfig.home`, or the value of the :envvar:`PYTHONHOME` " +"environment variable if it is set." msgstr "" -#: ../../c-api/init.rst:908 +#: ../../c-api/init.rst:920 +#, fuzzy msgid "" -"Get :c:member:`PyConfig.home` or :envvar:`PYTHONHOME` environment variable " -"instead." +"Use :c:func:`PyConfig_Get(\"home\") ` or " +"the :envvar:`PYTHONHOME` environment variable instead." msgstr "改為取得 :c:member:`PyConfig.home` 或 :envvar:`PYTHONHOME` 環境變數。" -#: ../../c-api/init.rst:916 +#: ../../c-api/init.rst:928 msgid "Thread State and the Global Interpreter Lock" msgstr "" -#: ../../c-api/init.rst:923 +#: ../../c-api/init.rst:935 msgid "" -"The Python interpreter is not fully thread-safe. In order to support multi-" +"Unless on a :term:`free-threaded ` build of :term:`CPython`, " +"the Python interpreter is not fully thread-safe. In order to support multi-" "threaded Python programs, there's a global lock, called the :term:`global " "interpreter lock` or :term:`GIL`, that must be held by the current thread " "before it can safely access Python objects. Without the lock, even the " @@ -1174,66 +1196,86 @@ msgid "" "once instead of twice." msgstr "" -#: ../../c-api/init.rst:933 +#: ../../c-api/init.rst:946 msgid "" -"Therefore, the rule exists that only the thread that has acquired the :term:" -"`GIL` may operate on Python objects or call Python/C API functions. In order " -"to emulate concurrency of execution, the interpreter regularly tries to " -"switch threads (see :func:`sys.setswitchinterval`). The lock is also " -"released around potentially blocking I/O operations like reading or writing " -"a file, so that other Python threads can run in the meantime." +"Therefore, the rule exists that only the thread that has acquired " +"the :term:`GIL` may operate on Python objects or call Python/C API " +"functions. In order to emulate concurrency of execution, the interpreter " +"regularly tries to switch threads (see :func:`sys.setswitchinterval`). The " +"lock is also released around potentially blocking I/O operations like " +"reading or writing a file, so that other Python threads can run in the " +"meantime." msgstr "" -#: ../../c-api/init.rst:943 +#: ../../c-api/init.rst:956 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " -"inside a data structure called :c:type:`PyThreadState`. There's also one " -"global variable pointing to the current :c:type:`PyThreadState`: it can be " -"retrieved using :c:func:`PyThreadState_Get`." +"inside a data structure called :c:type:`PyThreadState`, known as " +"a :term:`thread state`. Each OS thread has a thread-local pointer to " +"a :c:type:`PyThreadState`; a thread state referenced by this pointer is " +"considered to be :term:`attached `." msgstr "" -#: ../../c-api/init.rst:949 -msgid "Releasing the GIL from extension code" +#: ../../c-api/init.rst:961 +msgid "" +"A thread can only have one :term:`attached thread state` at a time. An " +"attached thread state is typically analogous with holding the :term:`GIL`, " +"except on :term:`free-threaded ` builds. On builds with " +"the :term:`GIL` enabled, :term:`attaching ` a thread " +"state will block until the :term:`GIL` can be acquired. However, even on " +"builds with the :term:`GIL` disabled, it is still required to have an " +"attached thread state to call most of the C API." msgstr "" -#: ../../c-api/init.rst:951 +#: ../../c-api/init.rst:968 msgid "" -"Most extension code manipulating the :term:`GIL` has the following simple " -"structure::" +"In general, there will always be an :term:`attached thread state` when using " +"Python's C API. Only in some specific cases (such as in " +"a :c:macro:`Py_BEGIN_ALLOW_THREADS` block) will the thread not have an " +"attached thread state. If uncertain, check " +"if :c:func:`PyThreadState_GetUnchecked` returns ``NULL``." +msgstr "" + +#: ../../c-api/init.rst:974 +msgid "Detaching the thread state from extension code" msgstr "" -#: ../../c-api/init.rst:954 +#: ../../c-api/init.rst:976 +msgid "" +"Most extension code manipulating the :term:`thread state` has the following " +"simple structure::" +msgstr "" + +#: ../../c-api/init.rst:979 msgid "" "Save the thread state in a local variable.\n" -"Release the global interpreter lock.\n" "... Do some blocking I/O operation ...\n" -"Reacquire the global interpreter lock.\n" "Restore the thread state from the local variable." msgstr "" -#: ../../c-api/init.rst:960 +#: ../../c-api/init.rst:983 msgid "This is so common that a pair of macros exists to simplify it::" msgstr "" -#: ../../c-api/init.rst:962 +#: ../../c-api/init.rst:985 msgid "" "Py_BEGIN_ALLOW_THREADS\n" "... Do some blocking I/O operation ...\n" "Py_END_ALLOW_THREADS" msgstr "" -#: ../../c-api/init.rst:970 +#: ../../c-api/init.rst:993 msgid "" "The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a " "hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the " "block." msgstr "" -#: ../../c-api/init.rst:974 +#: ../../c-api/init.rst:997 msgid "The block above expands to the following code::" msgstr "" -#: ../../c-api/init.rst:976 +#: ../../c-api/init.rst:999 msgid "" "PyThreadState *_save;\n" "\n" @@ -1242,60 +1284,78 @@ msgid "" "PyEval_RestoreThread(_save);" msgstr "" -#: ../../c-api/init.rst:986 +#: ../../c-api/init.rst:1009 +msgid "Here is how these functions work:" +msgstr "" + +#: ../../c-api/init.rst:1011 +msgid "" +"The :term:`attached thread state` holds the :term:`GIL` for the entire " +"interpreter. When detaching the :term:`attached thread state`, " +"the :term:`GIL` is released, allowing other threads to attach a thread state " +"to their own thread, thus getting the :term:`GIL` and can start executing. " +"The pointer to the prior :term:`attached thread state` is stored as a local " +"variable. Upon reaching :c:macro:`Py_END_ALLOW_THREADS`, the thread state " +"that was previously :term:`attached ` is passed " +"to :c:func:`PyEval_RestoreThread`. This function will block until another " +"releases its :term:`thread state `, thus allowing the " +"old :term:`thread state ` to get re-attached and the " +"C API can be called again." +msgstr "" + +#: ../../c-api/init.rst:1021 msgid "" -"Here is how these functions work: the global interpreter lock is used to " -"protect the pointer to the current thread state. When releasing the lock " -"and saving the thread state, the current thread state pointer must be " -"retrieved before the lock is released (since another thread could " -"immediately acquire the lock and store its own thread state in the global " -"variable). Conversely, when acquiring the lock and restoring the thread " -"state, the lock must be acquired before storing the thread state pointer." +"For :term:`free-threaded ` builds, the :term:`GIL` is " +"normally out of the question, but detaching the :term:`thread state " +"` is still required for blocking I/O and long " +"operations. The difference is that threads don't have to wait for " +"the :term:`GIL` to be released to attach their thread state, allowing true " +"multi-core parallelism." msgstr "" -#: ../../c-api/init.rst:995 +#: ../../c-api/init.rst:1027 msgid "" -"Calling system I/O functions is the most common use case for releasing the " -"GIL, but it can also be useful before calling long-running computations " -"which don't need access to Python objects, such as compression or " -"cryptographic functions operating over memory buffers. For example, the " -"standard :mod:`zlib` and :mod:`hashlib` modules release the GIL when " +"Calling system I/O functions is the most common use case for detaching " +"the :term:`thread state `, but it can also be useful " +"before calling long-running computations which don't need access to Python " +"objects, such as compression or cryptographic functions operating over " +"memory buffers. For example, the standard :mod:`zlib` and :mod:`hashlib` " +"modules detach the :term:`thread state ` when " "compressing or hashing data." msgstr "" -#: ../../c-api/init.rst:1006 +#: ../../c-api/init.rst:1038 msgid "Non-Python created threads" msgstr "" -#: ../../c-api/init.rst:1008 +#: ../../c-api/init.rst:1040 msgid "" -"When threads are created using the dedicated Python APIs (such as the :mod:" -"`threading` module), a thread state is automatically associated to them and " -"the code showed above is therefore correct. However, when threads are " -"created from C (for example by a third-party library with its own thread " -"management), they don't hold the GIL, nor is there a thread state structure " -"for them." +"When threads are created using the dedicated Python APIs (such as " +"the :mod:`threading` module), a thread state is automatically associated to " +"them and the code showed above is therefore correct. However, when threads " +"are created from C (for example by a third-party library with its own thread " +"management), they don't hold the :term:`GIL`, because they don't have " +"an :term:`attached thread state`." msgstr "" -#: ../../c-api/init.rst:1015 +#: ../../c-api/init.rst:1047 msgid "" "If you need to call Python code from these threads (often this will be part " "of a callback API provided by the aforementioned third-party library), you " -"must first register these threads with the interpreter by creating a thread " -"state data structure, then acquiring the GIL, and finally storing their " -"thread state pointer, before you can start using the Python/C API. When you " -"are done, you should reset the thread state pointer, release the GIL, and " -"finally free the thread state data structure." +"must first register these threads with the interpreter by creating " +"an :term:`attached thread state` before you can start using the Python/C " +"API. When you are done, you should detach the :term:`thread state `, and finally free it." msgstr "" -#: ../../c-api/init.rst:1023 +#: ../../c-api/init.rst:1054 msgid "" "The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions " "do all of the above automatically. The typical idiom for calling into " "Python from a C thread is::" msgstr "" -#: ../../c-api/init.rst:1027 +#: ../../c-api/init.rst:1058 msgid "" "PyGILState_STATE gstate;\n" "gstate = PyGILState_Ensure();\n" @@ -1308,20 +1368,60 @@ msgid "" "PyGILState_Release(gstate);" msgstr "" -#: ../../c-api/init.rst:1037 +#: ../../c-api/init.rst:1068 msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " -"supports the creation of additional interpreters (using :c:func:" -"`Py_NewInterpreter`), but mixing multiple interpreters and the " -"``PyGILState_*`` API is unsupported." +"supports the creation of additional interpreters " +"(using :c:func:`Py_NewInterpreter`), but mixing multiple interpreters and " +"the ``PyGILState_*`` API is unsupported. This is " +"because :c:func:`PyGILState_Ensure` and similar functions default " +"to :term:`attaching ` a :term:`thread state` for the " +"main interpreter, meaning that the thread can't safely interact with the " +"calling subinterpreter." msgstr "" -#: ../../c-api/init.rst:1047 +#: ../../c-api/init.rst:1078 +msgid "Supporting subinterpreters in non-Python threads" +msgstr "" + +#: ../../c-api/init.rst:1080 +msgid "" +"If you would like to support subinterpreters with non-Python created " +"threads, you must use the ``PyThreadState_*`` API instead of the traditional " +"``PyGILState_*`` API." +msgstr "" + +#: ../../c-api/init.rst:1084 +msgid "" +"In particular, you must store the interpreter state from the calling " +"function and pass it to :c:func:`PyThreadState_New`, which will ensure that " +"the :term:`thread state` is targeting the correct interpreter::" +msgstr "" + +#: ../../c-api/init.rst:1088 +msgid "" +"/* The return value of PyInterpreterState_Get() from the\n" +" function that created this thread. */\n" +"PyInterpreterState *interp = ThreadData->interp;\n" +"PyThreadState *tstate = PyThreadState_New(interp);\n" +"PyThreadState_Swap(tstate);\n" +"\n" +"/* GIL of the subinterpreter is now held.\n" +" Perform Python actions here. */\n" +"result = CallSomeFunction();\n" +"/* evaluate result or handle exception */\n" +"\n" +"/* Destroy the thread state. No Python API allowed beyond this point. */\n" +"PyThreadState_Clear(tstate);\n" +"PyThreadState_DeleteCurrent();" +msgstr "" + +#: ../../c-api/init.rst:1106 msgid "Cautions about fork()" msgstr "" -#: ../../c-api/init.rst:1049 +#: ../../c-api/init.rst:1108 msgid "" "Another important thing to note about threads is their behaviour in the face " "of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a " @@ -1330,7 +1430,7 @@ msgid "" "CPython's runtime." msgstr "" -#: ../../c-api/init.rst:1055 +#: ../../c-api/init.rst:1114 msgid "" "The fact that only the \"current\" thread remains means any locks held by " "other threads will never be released. Python solves this for :func:`os.fork` " @@ -1340,14 +1440,14 @@ msgid "" "of additional (non-Python) locks that need to be acquired before or reset " "after a fork. OS facilities such as :c:func:`!pthread_atfork` would need to " "be used to accomplish the same thing. Additionally, when extending or " -"embedding Python, calling :c:func:`fork` directly rather than through :func:" -"`os.fork` (and returning to or calling into Python) may result in a deadlock " -"by one of Python's internal locks being held by a thread that is defunct " -"after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the necessary " -"locks, but is not always able to." +"embedding Python, calling :c:func:`fork` directly rather than " +"through :func:`os.fork` (and returning to or calling into Python) may result " +"in a deadlock by one of Python's internal locks being held by a thread that " +"is defunct after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the " +"necessary locks, but is not always able to." msgstr "" -#: ../../c-api/init.rst:1070 +#: ../../c-api/init.rst:1129 msgid "" "The fact that all other threads go away also means that CPython's runtime " "state there must be cleaned up properly, which :func:`os.fork` does. This " @@ -1360,56 +1460,54 @@ msgid "" "called immediately after." msgstr "" -#: ../../c-api/init.rst:1084 +#: ../../c-api/init.rst:1143 msgid "Cautions regarding runtime finalization" msgstr "" -#: ../../c-api/init.rst:1086 +#: ../../c-api/init.rst:1145 msgid "" "In the late stage of :term:`interpreter shutdown`, after attempting to wait " -"for non-daemon threads to exit (though this can be interrupted by :class:" -"`KeyboardInterrupt`) and running the :mod:`atexit` functions, the runtime is " -"marked as *finalizing*: :c:func:`Py_IsFinalizing` and :func:`sys." -"is_finalizing` return true. At this point, only the *finalization thread* " -"that initiated finalization (typically the main thread) is allowed to " -"acquire the :term:`GIL`." +"for non-daemon threads to exit (though this can be interrupted " +"by :class:`KeyboardInterrupt`) and running the :mod:`atexit` functions, the " +"runtime is marked as *finalizing*: :c:func:`Py_IsFinalizing` " +"and :func:`sys.is_finalizing` return true. At this point, only the " +"*finalization thread* that initiated finalization (typically the main " +"thread) is allowed to acquire the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:1094 +#: ../../c-api/init.rst:1153 msgid "" -"If any thread, other than the finalization thread, attempts to acquire the " -"GIL during finalization, either explicitly via :c:func:`PyGILState_Ensure`, :" -"c:macro:`Py_END_ALLOW_THREADS`, :c:func:`PyEval_AcquireThread`, or :c:func:" -"`PyEval_AcquireLock`, or implicitly when the interpreter attempts to " -"reacquire it after having yielded it, the thread enters **a permanently " -"blocked state** where it remains until the program exits. In most cases " -"this is harmless, but this can result in deadlock if a later stage of " -"finalization attempts to acquire a lock owned by the blocked thread, or " -"otherwise waits on the blocked thread." +"If any thread, other than the finalization thread, attempts to attach " +"a :term:`thread state` during finalization, either explicitly or implicitly, " +"the thread enters **a permanently blocked state** where it remains until the " +"program exits. In most cases this is harmless, but this can result in " +"deadlock if a later stage of finalization attempts to acquire a lock owned " +"by the blocked thread, or otherwise waits on the blocked thread." msgstr "" -#: ../../c-api/init.rst:1104 +#: ../../c-api/init.rst:1160 msgid "" "Gross? Yes. This prevents random crashes and/or unexpectedly skipped C++ " "finalizations further up the call stack when such threads were forcibly " -"exited here in CPython 3.13.7 and earlier. The CPython runtime GIL acquiring " -"C APIs have never had any error reporting or handling expectations at GIL " -"acquisition time that would've allowed for graceful exit from this " -"situation. Changing that would require new stable C APIs and rewriting the " -"majority of C code in the CPython ecosystem to use those with error handling." +"exited here in CPython 3.13 and earlier. The CPython runtime :term:`thread " +"state` C APIs have never had any error reporting or handling expectations " +"at :term:`thread state` attachment time that would've allowed for graceful " +"exit from this situation. Changing that would require new stable C APIs and " +"rewriting the majority of C code in the CPython ecosystem to use those with " +"error handling." msgstr "" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1170 msgid "High-level API" msgstr "高階 API" -#: ../../c-api/init.rst:1116 +#: ../../c-api/init.rst:1172 msgid "" "These are the most commonly used types and functions when writing C " "extension code, or when embedding the Python interpreter:" msgstr "" -#: ../../c-api/init.rst:1121 +#: ../../c-api/init.rst:1177 msgid "" "This data structure represents the state shared by a number of cooperating " "threads. Threads belonging to the same interpreter share their module " @@ -1417,7 +1515,7 @@ msgid "" "in this structure." msgstr "" -#: ../../c-api/init.rst:1126 +#: ../../c-api/init.rst:1182 msgid "" "Threads belonging to different interpreters initially share nothing, except " "process state like available memory, open file descriptors and such. The " @@ -1425,58 +1523,54 @@ msgid "" "which interpreter they belong." msgstr "" -#: ../../c-api/init.rst:1134 +#: ../../c-api/init.rst:1190 msgid "" "This data structure represents the state of a single thread. The only " "public data member is:" msgstr "" -#: ../../c-api/init.rst:1139 +#: ../../c-api/init.rst:1195 msgid "This thread's interpreter state." msgstr "" -#: ../../c-api/init.rst:1150 +#: ../../c-api/init.rst:1206 msgid "Deprecated function which does nothing." msgstr "" -#: ../../c-api/init.rst:1152 +#: ../../c-api/init.rst:1208 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" -#: ../../c-api/init.rst:1154 +#: ../../c-api/init.rst:1210 msgid "The function now does nothing." msgstr "此函式現在不會做任何事情。" -#: ../../c-api/init.rst:1157 +#: ../../c-api/init.rst:1213 msgid "" "This function is now called by :c:func:`Py_Initialize()`, so you don't have " "to call it yourself anymore." msgstr "" -#: ../../c-api/init.rst:1161 +#: ../../c-api/init.rst:1217 msgid "" "This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -#: ../../c-api/init.rst:1171 +#: ../../c-api/init.rst:1227 msgid "" -"Release the global interpreter lock (if it has been created) and reset the " -"thread state to ``NULL``, returning the previous thread state (which is not " -"``NULL``). If the lock has been created, the current thread must have " -"acquired it." +"Detach the :term:`attached thread state` and return it. The thread will have " +"no :term:`thread state` upon returning." msgstr "" -#: ../../c-api/init.rst:1179 +#: ../../c-api/init.rst:1233 msgid "" -"Acquire the global interpreter lock (if it has been created) and set the " -"thread state to *tstate*, which must not be ``NULL``. If the lock has been " -"created, the current thread must not have acquired it, otherwise deadlock " -"ensues." +"Set the :term:`attached thread state` to *tstate*. The passed :term:`thread " +"state` **should not** be :term:`attached `, otherwise " +"deadlock ensues. *tstate* will be attached upon returning." msgstr "" -#: ../../c-api/init.rst:1185 ../../c-api/init.rst:1248 -#: ../../c-api/init.rst:1547 +#: ../../c-api/init.rst:1238 ../../c-api/init.rst:1609 msgid "" "Calling this function from a thread when the runtime is finalizing will hang " "the thread until the program exits, even if the thread was not created by " @@ -1484,425 +1578,466 @@ msgid "" "details." msgstr "" -#: ../../c-api/init.rst:1190 ../../c-api/init.rst:1253 -#: ../../c-api/init.rst:1557 +#: ../../c-api/init.rst:1243 ../../c-api/init.rst:1314 +#: ../../c-api/init.rst:1619 msgid "" "Hangs the current thread, rather than terminating it, if called while the " "interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1196 +#: ../../c-api/init.rst:1249 msgid "" -"Return the current thread state. The global interpreter lock must be held. " -"When the current thread state is ``NULL``, this issues a fatal error (so " -"that the caller needn't check for ``NULL``)." +"Return the :term:`attached thread state`. If the thread has no attached " +"thread state, (such as when inside of :c:macro:`Py_BEGIN_ALLOW_THREADS` " +"block), then this issues a fatal error (so that the caller needn't check for " +"``NULL``)." msgstr "" -#: ../../c-api/init.rst:1200 +#: ../../c-api/init.rst:1254 msgid "See also :c:func:`PyThreadState_GetUnchecked`." msgstr "也請見 :c:func:`PyThreadState_GetUnchecked`。" -#: ../../c-api/init.rst:1205 +#: ../../c-api/init.rst:1258 msgid "" "Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a " "fatal error if it is NULL. The caller is responsible to check if the result " "is NULL." msgstr "" -#: ../../c-api/init.rst:1209 +#: ../../c-api/init.rst:1262 msgid "" "In Python 3.5 to 3.12, the function was private and known as " "``_PyThreadState_UncheckedGet()``." msgstr "" -#: ../../c-api/init.rst:1216 +#: ../../c-api/init.rst:1269 msgid "" -"Swap the current thread state with the thread state given by the argument " -"*tstate*, which may be ``NULL``." +"Set the :term:`attached thread state` to *tstate*, and return " +"the :term:`thread state` that was attached prior to calling." msgstr "" -#: ../../c-api/init.rst:1219 +#: ../../c-api/init.rst:1272 msgid "" -"The :term:`GIL` does not need to be held, but will be held upon returning if " -"*tstate* is non-``NULL``." +"This function is safe to call without an :term:`attached thread state`; it " +"will simply return ``NULL`` indicating that there was no prior thread state." msgstr "" -#: ../../c-api/init.rst:1222 +#: ../../c-api/init.rst:1279 +msgid "" +"Similar to :c:func:`PyGILState_Ensure`, this function will hang the thread " +"if the runtime is finalizing." +msgstr "" + +#: ../../c-api/init.rst:1283 msgid "" "The following functions use thread-local storage, and are not compatible " "with sub-interpreters:" msgstr "" -#: ../../c-api/init.rst:1227 +#: ../../c-api/init.rst:1288 msgid "" "Ensure that the current thread is ready to call the Python C API regardless " -"of the current state of Python, or of the global interpreter lock. This may " -"be called as many times as desired by a thread as long as each call is " -"matched with a call to :c:func:`PyGILState_Release`. In general, other " -"thread-related APIs may be used between :c:func:`PyGILState_Ensure` and :c:" -"func:`PyGILState_Release` calls as long as the thread state is restored to " -"its previous state before the Release(). For example, normal usage of the :" -"c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS` macros " -"is acceptable." +"of the current state of Python, or of the :term:`attached thread state`. " +"This may be called as many times as desired by a thread as long as each call " +"is matched with a call to :c:func:`PyGILState_Release`. In general, other " +"thread-related APIs may be used between :c:func:`PyGILState_Ensure` " +"and :c:func:`PyGILState_Release` calls as long as the thread state is " +"restored to its previous state before the Release(). For example, normal " +"usage of the :c:macro:`Py_BEGIN_ALLOW_THREADS` " +"and :c:macro:`Py_END_ALLOW_THREADS` macros is acceptable." +msgstr "" + +#: ../../c-api/init.rst:1298 +msgid "" +"The return value is an opaque \"handle\" to the :term:`attached thread " +"state` when :c:func:`PyGILState_Ensure` was called, and must be passed " +"to :c:func:`PyGILState_Release` to ensure Python is left in the same state. " +"Even though recursive calls are allowed, these handles *cannot* be shared - " +"each unique call to :c:func:`PyGILState_Ensure` must save the handle for its " +"call to :c:func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1237 +#: ../../c-api/init.rst:1305 msgid "" -"The return value is an opaque \"handle\" to the thread state when :c:func:" -"`PyGILState_Ensure` was called, and must be passed to :c:func:" -"`PyGILState_Release` to ensure Python is left in the same state. Even though " -"recursive calls are allowed, these handles *cannot* be shared - each unique " -"call to :c:func:`PyGILState_Ensure` must save the handle for its call to :c:" -"func:`PyGILState_Release`." +"When the function returns, there will be an :term:`attached thread state` " +"and the thread will be able to call arbitrary Python code. Failure is a " +"fatal error." msgstr "" -#: ../../c-api/init.rst:1244 +#: ../../c-api/init.rst:1309 msgid "" -"When the function returns, the current thread will hold the GIL and be able " -"to call arbitrary Python code. Failure is a fatal error." +"Calling this function when the runtime is finalizing is unsafe. Doing so " +"will either hang the thread until the program ends, or fully crash the " +"interpreter in rare cases. Refer to :ref:`cautions-regarding-runtime-" +"finalization` for more details." msgstr "" -#: ../../c-api/init.rst:1259 +#: ../../c-api/init.rst:1320 msgid "" "Release any resources previously acquired. After this call, Python's state " -"will be the same as it was prior to the corresponding :c:func:" -"`PyGILState_Ensure` call (but generally this state will be unknown to the " -"caller, hence the use of the GILState API)." +"will be the same as it was prior to the " +"corresponding :c:func:`PyGILState_Ensure` call (but generally this state " +"will be unknown to the caller, hence the use of the GILState API)." +msgstr "" + +#: ../../c-api/init.rst:1325 +msgid "" +"Every call to :c:func:`PyGILState_Ensure` must be matched by a call " +"to :c:func:`PyGILState_Release` on the same thread." msgstr "" -#: ../../c-api/init.rst:1264 +#: ../../c-api/init.rst:1330 msgid "" -"Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" -"func:`PyGILState_Release` on the same thread." +"Get the :term:`attached thread state` for this thread. May return ``NULL`` " +"if no GILState API has been used on the current thread. Note that the main " +"thread always has such a thread-state, even if no auto-thread-state call has " +"been made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1270 +#: ../../c-api/init.rst:1336 msgid "" -"Get the current thread state for this thread. May return ``NULL`` if no " -"GILState API has been used on the current thread. Note that the main thread " -"always has such a thread-state, even if no auto-thread-state call has been " -"made on the main thread. This is mainly a helper/diagnostic function." +"This function does not account for :term:`thread states ` " +"created by something other than :c:func:`PyGILState_Ensure` (such " +"as :c:func:`PyThreadState_New`). Prefer :c:func:`PyThreadState_Get` " +"or :c:func:`PyThreadState_GetUnchecked` for most cases." msgstr "" -#: ../../c-api/init.rst:1278 +#: ../../c-api/init.rst:1345 msgid "" -"Return ``1`` if the current thread is holding the GIL and ``0`` otherwise. " -"This function can be called from any thread at any time. Only if it has had " -"its Python thread state initialized and currently is holding the GIL will it " -"return ``1``. This is mainly a helper/diagnostic function. It can be useful " -"for example in callback contexts or memory allocation functions when knowing " -"that the GIL is locked can allow the caller to perform sensitive actions or " -"otherwise behave differently." +"Return ``1`` if the current thread is holding the :term:`GIL` and ``0`` " +"otherwise. This function can be called from any thread at any time. Only if " +"it has had its :term:`thread state ` initialized " +"via :c:func:`PyGILState_Ensure` will it return ``1``. This is mainly a " +"helper/diagnostic function. It can be useful for example in callback " +"contexts or memory allocation functions when knowing that the :term:`GIL` is " +"locked can allow the caller to perform sensitive actions or otherwise behave " +"differently." msgstr "" -#: ../../c-api/init.rst:1290 +#: ../../c-api/init.rst:1355 +msgid "" +"If the current Python process has ever created a subinterpreter, this " +"function will *always* return ``1``. " +"Prefer :c:func:`PyThreadState_GetUnchecked` for most cases." +msgstr "" + +#: ../../c-api/init.rst:1362 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: ../../c-api/init.rst:1296 +#: ../../c-api/init.rst:1368 msgid "" -"This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" -"``. Note that it contains an opening brace; it must be matched with a " -"following :c:macro:`Py_END_ALLOW_THREADS` macro. See above for further " -"discussion of this macro." +"This macro expands to ``{ PyThreadState *_save; _save = " +"PyEval_SaveThread();``. Note that it contains an opening brace; it must be " +"matched with a following :c:macro:`Py_END_ALLOW_THREADS` macro. See above " +"for further discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1304 +#: ../../c-api/init.rst:1376 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " -"contains a closing brace; it must be matched with an earlier :c:macro:" -"`Py_BEGIN_ALLOW_THREADS` macro. See above for further discussion of this " -"macro." +"contains a closing brace; it must be matched with an " +"earlier :c:macro:`Py_BEGIN_ALLOW_THREADS` macro. See above for further " +"discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1312 +#: ../../c-api/init.rst:1384 msgid "" -"This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" -"c:macro:`Py_END_ALLOW_THREADS` without the closing brace." +"This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent " +"to :c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: ../../c-api/init.rst:1318 +#: ../../c-api/init.rst:1390 msgid "" -"This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" -"c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " +"This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent " +"to :c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: ../../c-api/init.rst:1324 +#: ../../c-api/init.rst:1396 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1326 +#: ../../c-api/init.rst:1398 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1328 -msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL`." +#: ../../c-api/init.rst:1400 +msgid "" +":c:func:`Py_Initialize()` now initializes the :term:`GIL` and sets " +"an :term:`attached thread state`." msgstr "" -#: ../../c-api/init.rst:1334 +#: ../../c-api/init.rst:1407 msgid "" -"Create a new interpreter state object. The global interpreter lock need not " -"be held, but may be held if it is necessary to serialize calls to this " -"function." +"Create a new interpreter state object. An :term:`attached thread state` is " +"not needed, but may optionally exist if it is necessary to serialize calls " +"to this function." msgstr "" -#: ../../c-api/init.rst:1338 +#: ../../c-api/init.rst:1411 msgid "" -"Raises an :ref:`auditing event ` ``cpython." -"PyInterpreterState_New`` with no arguments." +"Raises an :ref:`auditing event ` " +"``cpython.PyInterpreterState_New`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." -"PyInterpreterState_New``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` " +"``cpython.PyInterpreterState_New``。" -#: ../../c-api/init.rst:1343 +#: ../../c-api/init.rst:1416 msgid "" -"Reset all information in an interpreter state object. The global " -"interpreter lock must be held." +"Reset all information in an interpreter state object. There must be " +"an :term:`attached thread state` for the interpreter." msgstr "" -#: ../../c-api/init.rst:1346 +#: ../../c-api/init.rst:1419 msgid "" -"Raises an :ref:`auditing event ` ``cpython." -"PyInterpreterState_Clear`` with no arguments." +"Raises an :ref:`auditing event ` " +"``cpython.PyInterpreterState_Clear`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." -"PyInterpreterState_Clear``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` " +"``cpython.PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1351 +#: ../../c-api/init.rst:1424 msgid "" -"Destroy an interpreter state object. The global interpreter lock need not " -"be held. The interpreter state must have been reset with a previous call " +"Destroy an interpreter state object. There **should not** be " +"an :term:`attached thread state` for the target interpreter. The interpreter " +"state must have been reset with a previous call " "to :c:func:`PyInterpreterState_Clear`." msgstr "" -#: ../../c-api/init.rst:1358 +#: ../../c-api/init.rst:1431 msgid "" "Create a new thread state object belonging to the given interpreter object. " -"The global interpreter lock need not be held, but may be held if it is " -"necessary to serialize calls to this function." +"An :term:`attached thread state` is not needed." msgstr "" -#: ../../c-api/init.rst:1365 +#: ../../c-api/init.rst:1436 msgid "" -"Reset all information in a thread state object. The global interpreter lock " -"must be held." +"Reset all information in a :term:`thread state` object. *tstate* must " +"be :term:`attached `" msgstr "" -#: ../../c-api/init.rst:1368 +#: ../../c-api/init.rst:1439 msgid "" "This function now calls the :c:member:`PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1372 +#: ../../c-api/init.rst:1443 msgid "The :c:member:`PyThreadState.on_delete` callback was removed." msgstr ":c:member:`PyThreadState.on_delete` 回呼已被移除。" -#: ../../c-api/init.rst:1378 +#: ../../c-api/init.rst:1449 +msgid "" +"Destroy a :term:`thread state` object. *tstate* should not " +"be :term:`attached ` to any thread. *tstate* must " +"have been reset with a previous call to :c:func:`PyThreadState_Clear`." +msgstr "" + +#: ../../c-api/init.rst:1457 msgid "" -"Destroy a thread state object. The global interpreter lock need not be " -"held. The thread state must have been reset with a previous call to :c:func:" -"`PyThreadState_Clear`." +"Detach the :term:`attached thread state` (which must have been reset with a " +"previous call to :c:func:`PyThreadState_Clear`) and then destroy it." msgstr "" -#: ../../c-api/init.rst:1385 +#: ../../c-api/init.rst:1460 msgid "" -"Destroy the current thread state and release the global interpreter lock. " -"Like :c:func:`PyThreadState_Delete`, the global interpreter lock must be " -"held. The thread state must have been reset with a previous call to :c:func:" -"`PyThreadState_Clear`." +"No :term:`thread state` will be :term:`attached ` " +"upon returning." msgstr "" -#: ../../c-api/init.rst:1393 +#: ../../c-api/init.rst:1465 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1395 +#: ../../c-api/init.rst:1467 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1398 +#: ../../c-api/init.rst:1470 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1400 ../../c-api/init.rst:1409 -#: ../../c-api/init.rst:1418 -msgid "*tstate* must not be ``NULL``." -msgstr "*tstate* 不可為 ``NULL``。" +#: ../../c-api/init.rst:1472 ../../c-api/init.rst:1481 +#: ../../c-api/init.rst:1490 +msgid "" +"*tstate* must not be ``NULL``, and must be :term:`attached `." +msgstr "" -#: ../../c-api/init.rst:1407 +#: ../../c-api/init.rst:1479 msgid "" -"Get the unique thread state identifier of the Python thread state *tstate*." +"Get the unique :term:`thread state` identifier of the Python thread state " +"*tstate*." msgstr "" -#: ../../c-api/init.rst:1416 +#: ../../c-api/init.rst:1488 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1425 +#: ../../c-api/init.rst:1497 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1427 +#: ../../c-api/init.rst:1499 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1434 +#: ../../c-api/init.rst:1506 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1437 +#: ../../c-api/init.rst:1509 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1445 +#: ../../c-api/init.rst:1517 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1447 +#: ../../c-api/init.rst:1519 msgid "" -"Issue a fatal error if there no current Python thread state or no current " -"interpreter. It cannot return NULL." -msgstr "" - -#: ../../c-api/init.rst:1450 ../../c-api/init.rst:1460 -#: ../../c-api/init.rst:1482 -msgid "The caller must hold the GIL." +"Issue a fatal error if there no :term:`attached thread state`. It cannot " +"return NULL." msgstr "" -#: ../../c-api/init.rst:1457 +#: ../../c-api/init.rst:1527 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1467 +#: ../../c-api/init.rst:1530 ../../c-api/init.rst:2117 +#: ../../c-api/init.rst:2124 ../../c-api/init.rst:2143 +#: ../../c-api/init.rst:2150 +#, fuzzy +msgid "The caller must have an :term:`attached thread state`." +msgstr "呼叫者必須持有 :term:`GIL`。" + +#: ../../c-api/init.rst:1537 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1471 +#: ../../c-api/init.rst:1541 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1479 -msgid "" -"Return a :term:`strong reference` to the ``__main__`` :ref:`module object " -"` for the given interpreter." -msgstr "" - -#: ../../c-api/init.rst:1489 +#: ../../c-api/init.rst:1549 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1491 +#: ../../c-api/init.rst:1551 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1494 +#: ../../c-api/init.rst:1554 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1497 +#: ../../c-api/init.rst:1557 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1502 +#: ../../c-api/init.rst:1562 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1504 ../../c-api/init.rst:1512 +#: ../../c-api/init.rst:1564 ../../c-api/init.rst:1572 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1510 +#: ../../c-api/init.rst:1570 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1519 +#: ../../c-api/init.rst:1579 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " -"in the dictionary. It is okay to call this function when no current thread " -"state is available. If this function returns ``NULL``, no exception has been " -"raised and the caller should assume no current thread state is available." +"in the dictionary. It is okay to call this function when no :term:`thread " +"state` is :term:`attached `. If this function returns " +"``NULL``, no exception has been raised and the caller should assume no " +"thread state is attached." msgstr "" -#: ../../c-api/init.rst:1528 +#: ../../c-api/init.rst:1589 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " "This function does not steal any references to *exc*. To prevent naive " "misuse, you must write your own C extension to call this. Must be called " -"with the GIL held. Returns the number of thread states modified; this is " -"normally one, but will be zero if the thread id isn't found. If *exc* is " -"``NULL``, the pending exception (if any) for the thread is cleared. This " -"raises no exceptions." +"with an :term:`attached thread state`. Returns the number of thread states " +"modified; this is normally one, but will be zero if the thread id isn't " +"found. If *exc* is ``NULL``, the pending exception (if any) for the thread " +"is cleared. This raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1536 +#: ../../c-api/init.rst:1597 msgid "" -"The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" -"`unsigned long`." +"The type of the *id* parameter changed from :c:expr:`long` " +"to :c:expr:`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1542 +#: ../../c-api/init.rst:1603 msgid "" -"Acquire the global interpreter lock and set the current thread state to " -"*tstate*, which must not be ``NULL``. The lock must have been created " -"earlier. If this thread already has the lock, deadlock ensues." +":term:`Attach ` *tstate* to the current thread, which " +"must not be ``NULL`` or already :term:`attached `." msgstr "" -#: ../../c-api/init.rst:1552 +#: ../../c-api/init.rst:1606 msgid "" -"Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" -"`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " -"current thread if called while the interpreter is finalizing." +"The calling thread must not already have an :term:`attached thread state`." msgstr "" -#: ../../c-api/init.rst:1561 +#: ../../c-api/init.rst:1614 +msgid "" +"Updated to be consistent " +"with :c:func:`PyEval_RestoreThread`, :c:func:`Py_END_ALLOW_THREADS`, " +"and :c:func:`PyGILState_Ensure`, and terminate the current thread if called " +"while the interpreter is finalizing." +msgstr "" + +#: ../../c-api/init.rst:1623 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1567 +#: ../../c-api/init.rst:1629 msgid "" -"Reset the current thread state to ``NULL`` and release the global " -"interpreter lock. The lock must have been created earlier and must be held " -"by the current thread. The *tstate* argument, which must not be ``NULL``, " -"is only used to check that it represents the current thread state --- if it " -"isn't, a fatal error is reported." +"Detach the :term:`attached thread state`. The *tstate* argument, which must " +"not be ``NULL``, is only used to check that it represents " +"the :term:`attached thread state` --- if it isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1573 +#: ../../c-api/init.rst:1634 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1580 +#: ../../c-api/init.rst:1641 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1582 +#: ../../c-api/init.rst:1643 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -1910,7 +2045,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1587 +#: ../../c-api/init.rst:1648 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1921,163 +2056,164 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1594 +#: ../../c-api/init.rst:1655 msgid "" -"You can switch between sub-interpreters using the :c:func:" -"`PyThreadState_Swap` function. You can create and destroy them using the " -"following functions:" +"You can switch between sub-interpreters using " +"the :c:func:`PyThreadState_Swap` function. You can create and destroy them " +"using the following functions:" msgstr "" -#: ../../c-api/init.rst:1600 +#: ../../c-api/init.rst:1661 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1606 +#: ../../c-api/init.rst:1667 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1610 +#: ../../c-api/init.rst:1671 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1614 +#: ../../c-api/init.rst:1675 msgid "" -"If this is ``0`` then :c:member:`~PyInterpreterConfig." -"check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " -"then :c:member:`~PyInterpreterConfig.gil` must not be :c:macro:" -"`PyInterpreterConfig_OWN_GIL`." +"If this is ``0`` " +"then :c:member:`~PyInterpreterConfig.check_multi_interp_extensions` must be " +"``1`` (non-zero). If this is ``1`` then :c:member:`~PyInterpreterConfig.gil` " +"must not be :c:macro:`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1622 +#: ../../c-api/init.rst:1683 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1626 +#: ../../c-api/init.rst:1687 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1631 +#: ../../c-api/init.rst:1692 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1636 +#: ../../c-api/init.rst:1697 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1641 +#: ../../c-api/init.rst:1702 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1647 +#: ../../c-api/init.rst:1708 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " -"create daemon threads. Otherwise daemon threads are allowed (as long as :c:" -"member:`~PyInterpreterConfig.allow_threads` is non-zero)." +"create daemon threads. Otherwise daemon threads are allowed (as long " +"as :c:member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1654 +#: ../../c-api/init.rst:1715 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " -"is currently active. Otherwise only multi-phase init extension modules (see :" -"pep:`489`) may be imported. (Also see :c:macro:" -"`Py_mod_multiple_interpreters`.)" +"is currently active. Otherwise only multi-phase init extension modules " +"(see :pep:`489`) may be imported. (Also " +"see :c:macro:`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1661 +#: ../../c-api/init.rst:1722 msgid "" -"This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." -"use_main_obmalloc` is ``0``." +"This must be ``1`` (non-zero) " +"if :c:member:`~PyInterpreterConfig.use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1666 +#: ../../c-api/init.rst:1727 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1673 +#: ../../c-api/init.rst:1734 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1677 +#: ../../c-api/init.rst:1738 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1681 +#: ../../c-api/init.rst:1742 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1683 +#: ../../c-api/init.rst:1744 msgid "" -"If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" -"`PyInterpreterConfig.use_main_obmalloc` must be ``0``." +"If this is :c:macro:`PyInterpreterConfig_OWN_GIL` " +"then :c:member:`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1697 +#: ../../c-api/init.rst:1758 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " "interpreter has separate, independent versions of all imported modules, " -"including the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:" -"`sys`. The table of loaded modules (``sys.modules``) and the module search " -"path (``sys.path``) are also separate. The new environment has no ``sys." -"argv`` variable. It has new standard I/O stream file objects ``sys.stdin``, " -"``sys.stdout`` and ``sys.stderr`` (however these refer to the same " -"underlying file descriptors)." +"including the fundamental modules :mod:`builtins`, :mod:`__main__` " +"and :mod:`sys`. The table of loaded modules (``sys.modules``) and the " +"module search path (``sys.path``) are also separate. The new environment " +"has no ``sys.argv`` variable. It has new standard I/O stream file objects " +"``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` (however these refer to the " +"same underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1707 +#: ../../c-api/init.rst:1768 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1710 +#: ../../c-api/init.rst:1771 msgid "" -"Upon success, *tstate_p* will be set to the first thread state created in " -"the new sub-interpreter. This thread state is made in the current thread " -"state. Note that no actual thread is created; see the discussion of thread " -"states below. If creation of the new interpreter is unsuccessful, " -"*tstate_p* is set to ``NULL``; no exception is set since the exception state " -"is stored in the current thread state and there may not be a current thread " -"state." +"Upon success, *tstate_p* will be set to the first :term:`thread state` " +"created in the new sub-interpreter. This thread state is :term:`attached " +"`. Note that no actual thread is created; see the " +"discussion of thread states below. If creation of the new interpreter is " +"unsuccessful, *tstate_p* is set to ``NULL``; no exception is set since the " +"exception state is stored in the :term:`attached thread state`, which might " +"not exist." msgstr "" -#: ../../c-api/init.rst:1719 +#: ../../c-api/init.rst:1780 msgid "" -"Like all other Python/C API functions, the global interpreter lock must be " -"held before calling this function and is still held when it returns. " -"Likewise a current thread state must be set on entry. On success, the " -"returned thread state will be set as current. If the sub-interpreter is " -"created with its own GIL then the GIL of the calling interpreter will be " -"released. When the function returns, the new interpreter's GIL will be held " -"by the current thread and the previously interpreter's GIL will remain " -"released here." +"Like all other Python/C API functions, an :term:`attached thread state` must " +"be present before calling this function, but it might be detached upon " +"returning. On success, the returned thread state will be :term:`attached " +"`. If the sub-interpreter is created with its " +"own :term:`GIL` then the :term:`attached thread state` of the calling " +"interpreter will be detached. When the function returns, the new " +"interpreter's :term:`thread state` will be :term:`attached ` to the current thread and the previous interpreter's :term:`attached " +"thread state` will remain detached." msgstr "" -#: ../../c-api/init.rst:1730 +#: ../../c-api/init.rst:1791 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1733 +#: ../../c-api/init.rst:1794 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2109,78 +2245,77 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init.rst:1748 +#: ../../c-api/init.rst:1809 msgid "" "Note that the config is used only briefly and does not get modified. During " -"initialization the config's values are converted into various :c:type:" -"`PyInterpreterState` values. A read-only copy of the config may be stored " -"internally on the :c:type:`PyInterpreterState`." +"initialization the config's values are converted into " +"various :c:type:`PyInterpreterState` values. A read-only copy of the config " +"may be stored internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1757 +#: ../../c-api/init.rst:1818 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1759 +#: ../../c-api/init.rst:1820 msgid "" -"For modules using multi-phase initialization, e.g. :c:func:" -"`PyModule_FromDefAndSpec`, a separate module object is created and " -"initialized for each interpreter. Only C-level static and global variables " -"are shared between these module objects." +"For modules using multi-phase initialization, " +"e.g. :c:func:`PyModule_FromDefAndSpec`, a separate module object is created " +"and initialized for each interpreter. Only C-level static and global " +"variables are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1765 +#: ../../c-api/init.rst:1826 msgid "" -"For modules using single-phase initialization, e.g. :c:func:" -"`PyModule_Create`, the first time a particular extension is imported, it is " -"initialized normally, and a (shallow) copy of its module's dictionary is " -"squirreled away. When the same extension is imported by another " -"(sub-)interpreter, a new module is initialized and filled with the contents " -"of this copy; the extension's ``init`` function is not called. Objects in " -"the module's dictionary thus end up shared across (sub-)interpreters, which " -"might cause unwanted behavior (see `Bugs and caveats`_ below)." +"For modules using single-phase initialization, " +"e.g. :c:func:`PyModule_Create`, the first time a particular extension is " +"imported, it is initialized normally, and a (shallow) copy of its module's " +"dictionary is squirreled away. When the same extension is imported by " +"another (sub-)interpreter, a new module is initialized and filled with the " +"contents of this copy; the extension's ``init`` function is not called. " +"Objects in the module's dictionary thus end up shared across " +"(sub-)interpreters, which might cause unwanted behavior (see `Bugs and " +"caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1776 +#: ../../c-api/init.rst:1837 msgid "" "Note that this is different from what happens when an extension is imported " -"after the interpreter has been completely re-initialized by calling :c:func:" -"`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, the extension's " -"``initmodule`` function *is* called again. As with multi-phase " -"initialization, this means that only C-level static and global variables are " -"shared between these modules." +"after the interpreter has been completely re-initialized by " +"calling :c:func:`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, " +"the extension's ``initmodule`` function *is* called again. As with multi-" +"phase initialization, this means that only C-level static and global " +"variables are shared between these modules." msgstr "" -#: ../../c-api/init.rst:1796 +#: ../../c-api/init.rst:1857 msgid "" -"Create a new sub-interpreter. This is essentially just a wrapper around :c:" -"func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " -"behavior. The result is an unisolated sub-interpreter that shares the main " -"interpreter's GIL, allows fork/exec, allows daemon threads, and allows " -"single-phase init modules." +"Create a new sub-interpreter. This is essentially just a wrapper " +"around :c:func:`Py_NewInterpreterFromConfig` with a config that preserves " +"the existing behavior. The result is an unisolated sub-interpreter that " +"shares the main interpreter's GIL, allows fork/exec, allows daemon threads, " +"and allows single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1808 +#: ../../c-api/init.rst:1869 msgid "" -"Destroy the (sub-)interpreter represented by the given thread state. The " -"given thread state must be the current thread state. See the discussion of " -"thread states below. When the call returns, the current thread state is " -"``NULL``. All thread states associated with this interpreter are " -"destroyed. The global interpreter lock used by the target interpreter must " -"be held before calling this function. No GIL is held when it returns." +"Destroy the (sub-)interpreter represented by the given :term:`thread state`. " +"The given thread state must be :term:`attached `. " +"When the call returns, there will be no :term:`attached thread state`. All " +"thread states associated with this interpreter are destroyed." msgstr "" -#: ../../c-api/init.rst:1816 +#: ../../c-api/init.rst:1874 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1821 +#: ../../c-api/init.rst:1879 msgid "A Per-Interpreter GIL" msgstr "直譯器各別持有的 GIL" -#: ../../c-api/init.rst:1823 +#: ../../c-api/init.rst:1881 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2192,7 +2327,7 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1833 +#: ../../c-api/init.rst:1891 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2206,7 +2341,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1844 +#: ../../c-api/init.rst:1902 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2214,7 +2349,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1849 +#: ../../c-api/init.rst:1907 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2224,11 +2359,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1860 +#: ../../c-api/init.rst:1918 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1862 +#: ../../c-api/init.rst:1920 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2241,7 +2376,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1872 +#: ../../c-api/init.rst:1930 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2250,37 +2385,37 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1878 +#: ../../c-api/init.rst:1936 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " "and OS-level threads, an assumption broken by the presence of sub-" "interpreters. It is highly recommended that you don't switch sub-" -"interpreters between a pair of matching :c:func:`PyGILState_Ensure` and :c:" -"func:`PyGILState_Release` calls. Furthermore, extensions (such as :mod:" -"`ctypes`) using these APIs to allow calling of Python code from non-Python " -"created threads will probably be broken when using sub-interpreters." +"interpreters between a pair of matching :c:func:`PyGILState_Ensure` " +"and :c:func:`PyGILState_Release` calls. Furthermore, extensions (such " +"as :mod:`ctypes`) using these APIs to allow calling of Python code from non-" +"Python created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1889 +#: ../../c-api/init.rst:1947 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1891 +#: ../../c-api/init.rst:1949 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1898 +#: ../../c-api/init.rst:1956 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1902 +#: ../../c-api/init.rst:1960 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2288,48 +2423,43 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1907 +#: ../../c-api/init.rst:1965 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1908 +#: ../../c-api/init.rst:1966 msgid "" -"with the main thread holding the :term:`global interpreter lock` (*func* can " +"with the main thread holding an :term:`attached thread state` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1911 +#: ../../c-api/init.rst:1969 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " "notification recursively, but it can still be interrupted to switch threads " -"if the global interpreter lock is released." -msgstr "" - -#: ../../c-api/init.rst:1916 -msgid "" -"This function doesn't need a current thread state to run, and it doesn't " -"need the global interpreter lock." +"if the :term:`thread state ` is detached." msgstr "" -#: ../../c-api/init.rst:1919 +#: ../../c-api/init.rst:1974 msgid "" -"To call this function in a subinterpreter, the caller must hold the GIL. " -"Otherwise, the function *func* can be scheduled to be called from the wrong " -"interpreter." +"This function doesn't need an :term:`attached thread state`. However, to " +"call this function in a subinterpreter, the caller must have " +"an :term:`attached thread state`. Otherwise, the function *func* can be " +"scheduled to be called from the wrong interpreter." msgstr "" -#: ../../c-api/init.rst:1924 +#: ../../c-api/init.rst:1979 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " "thread is busy executing a system call, *func* won't be called before the " "system call returns. This function is generally **not** suitable for " -"calling Python code from arbitrary C threads. Instead, use the :ref:" -"`PyGILState API`." +"calling Python code from arbitrary C threads. Instead, use " +"the :ref:`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1933 +#: ../../c-api/init.rst:1988 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2337,18 +2467,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1942 +#: ../../c-api/init.rst:1997 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1947 +#: ../../c-api/init.rst:2002 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:1951 +#: ../../c-api/init.rst:2006 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2358,78 +2488,76 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1961 +#: ../../c-api/init.rst:2016 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " "the registration function as *obj*, *frame* is the frame object to which the " -"event pertains, *what* is one of the constants :c:data:`PyTrace_CALL`, :c:" -"data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, :c:data:`PyTrace_RETURN`, :" -"c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION`, :c:data:" -"`PyTrace_C_RETURN`, or :c:data:`PyTrace_OPCODE`, and *arg* depends on the " -"value of *what*:" +"event pertains, *what* is one of the " +"constants :c:data:`PyTrace_CALL`, :c:data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, :c:data:`PyTrace_RETURN`, :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION`, :c:data:`PyTrace_C_RETURN`, " +"or :c:data:`PyTrace_OPCODE`, and *arg* depends on the value of *what*:" msgstr "" -#: ../../c-api/init.rst:1970 +#: ../../c-api/init.rst:2025 msgid "Value of *what*" msgstr "*what* 的值" -#: ../../c-api/init.rst:1970 +#: ../../c-api/init.rst:2025 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:1972 +#: ../../c-api/init.rst:2027 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:1972 ../../c-api/init.rst:1977 -#: ../../c-api/init.rst:1988 +#: ../../c-api/init.rst:2027 ../../c-api/init.rst:2032 +#: ../../c-api/init.rst:2043 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1974 +#: ../../c-api/init.rst:2029 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1974 +#: ../../c-api/init.rst:2029 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1977 +#: ../../c-api/init.rst:2032 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:1979 +#: ../../c-api/init.rst:2034 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1979 +#: ../../c-api/init.rst:2034 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1982 +#: ../../c-api/init.rst:2037 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1982 ../../c-api/init.rst:1984 -#: ../../c-api/init.rst:1986 +#: ../../c-api/init.rst:2037 ../../c-api/init.rst:2039 +#: ../../c-api/init.rst:2041 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:1984 +#: ../../c-api/init.rst:2039 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1986 +#: ../../c-api/init.rst:2041 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1988 +#: ../../c-api/init.rst:2043 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1993 +#: ../../c-api/init.rst:2048 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2438,7 +2566,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:2002 +#: ../../c-api/init.rst:2057 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2450,133 +2578,129 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:2013 +#: ../../c-api/init.rst:2068 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " -"reported. It may be disabled for a frame by setting :attr:`~frame." -"f_trace_lines` to *0* on that frame." +"reported. It may be disabled for a frame by " +"setting :attr:`~frame.f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:2021 +#: ../../c-api/init.rst:2076 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:2027 +#: ../../c-api/init.rst:2082 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:2033 +#: ../../c-api/init.rst:2088 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:2039 +#: ../../c-api/init.rst:2094 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:2045 +#: ../../c-api/init.rst:2100 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " -"event is not emitted by default: it must be explicitly requested by setting :" -"attr:`~frame.f_trace_opcodes` to *1* on the frame." +"event is not emitted by default: it must be explicitly requested by " +"setting :attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:2053 +#: ../../c-api/init.rst:2108 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " "If the profile function needs to maintain state, using a different value for " "*obj* for each thread provides a convenient and thread-safe place to store " -"it. The profile function is called for all monitored events except :c:data:" -"`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." +"it. The profile function is called for all monitored events " +"except :c:data:`PyTrace_LINE` :c:data:`PyTrace_OPCODE` " +"and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:2060 +#: ../../c-api/init.rst:2115 msgid "See also the :func:`sys.setprofile` function." msgstr "另請參閱 :func:`sys.setprofile` 函式。" -#: ../../c-api/init.rst:2062 ../../c-api/init.rst:2069 -#: ../../c-api/init.rst:2088 ../../c-api/init.rst:2095 -msgid "The caller must hold the :term:`GIL`." -msgstr "呼叫者必須持有 :term:`GIL`。" - -#: ../../c-api/init.rst:2066 +#: ../../c-api/init.rst:2121 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:2071 +#: ../../c-api/init.rst:2126 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:2079 +#: ../../c-api/init.rst:2134 msgid "" -"Set the tracing function to *func*. This is similar to :c:func:" -"`PyEval_SetProfile`, except the tracing function does receive line-number " -"events and per-opcode events, but does not receive any event related to C " -"function objects being called. Any trace function registered using :c:func:" -"`PyEval_SetTrace` will not receive :c:data:`PyTrace_C_CALL`, :c:data:" -"`PyTrace_C_EXCEPTION` or :c:data:`PyTrace_C_RETURN` as a value for the " -"*what* parameter." +"Set the tracing function to *func*. This is similar " +"to :c:func:`PyEval_SetProfile`, except the tracing function does receive " +"line-number events and per-opcode events, but does not receive any event " +"related to C function objects being called. Any trace function registered " +"using :c:func:`PyEval_SetTrace` will not " +"receive :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION` " +"or :c:data:`PyTrace_C_RETURN` as a value for the *what* parameter." msgstr "" -#: ../../c-api/init.rst:2086 +#: ../../c-api/init.rst:2141 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:2092 +#: ../../c-api/init.rst:2147 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:2097 +#: ../../c-api/init.rst:2152 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:2103 +#: ../../c-api/init.rst:2158 msgid "Reference tracing" msgstr "" -#: ../../c-api/init.rst:2109 +#: ../../c-api/init.rst:2164 msgid "" -"The type of the trace function registered using :c:func:" -"`PyRefTracer_SetTracer`. The first parameter is a Python object that has " -"been just created (when **event** is set to :c:data:`PyRefTracer_CREATE`) or " -"about to be destroyed (when **event** is set to :c:data:" -"`PyRefTracer_DESTROY`). The **data** argument is the opaque pointer that was " -"provided when :c:func:`PyRefTracer_SetTracer` was called." +"The type of the trace function registered " +"using :c:func:`PyRefTracer_SetTracer`. The first parameter is a Python " +"object that has been just created (when **event** is set " +"to :c:data:`PyRefTracer_CREATE`) or about to be destroyed (when **event** is " +"set to :c:data:`PyRefTracer_DESTROY`). The **data** argument is the opaque " +"pointer that was provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -#: ../../c-api/init.rst:2119 +#: ../../c-api/init.rst:2174 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" -#: ../../c-api/init.rst:2124 +#: ../../c-api/init.rst:2179 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been destroyed." msgstr "" -#: ../../c-api/init.rst:2129 +#: ../../c-api/init.rst:2184 msgid "" "Register a reference tracer function. The function will be called when a new " "Python has been created or when an object is going to be destroyed. If " @@ -2585,19 +2709,20 @@ msgid "" "return ``-1`` on error." msgstr "" -#: ../../c-api/init.rst:2135 +#: ../../c-api/init.rst:2190 msgid "" "Not that tracer functions **must not** create Python objects inside or " "otherwise the call will be re-entrant. The tracer also **must not** clear " -"any existing exception or set an exception. The GIL will be held every time " -"the tracer function is called." +"any existing exception or set an exception. A :term:`thread state` will be " +"active every time the tracer function is called." msgstr "" -#: ../../c-api/init.rst:2140 ../../c-api/init.rst:2151 -msgid "The GIL must be held when calling this function." +#: ../../c-api/init.rst:2195 ../../c-api/init.rst:2206 +msgid "" +"There must be an :term:`attached thread state` when calling this function." msgstr "" -#: ../../c-api/init.rst:2146 +#: ../../c-api/init.rst:2201 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " @@ -2605,48 +2730,48 @@ msgid "" "set the **data** pointer to NULL." msgstr "" -#: ../../c-api/init.rst:2158 +#: ../../c-api/init.rst:2213 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2163 +#: ../../c-api/init.rst:2218 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2168 +#: ../../c-api/init.rst:2223 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2173 +#: ../../c-api/init.rst:2228 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2178 +#: ../../c-api/init.rst:2233 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2184 +#: ../../c-api/init.rst:2239 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2190 +#: ../../c-api/init.rst:2245 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2197 +#: ../../c-api/init.rst:2252 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2201 +#: ../../c-api/init.rst:2256 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2656,42 +2781,42 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2208 +#: ../../c-api/init.rst:2263 msgid "" -"The GIL does *not* need to be held when calling these functions; they supply " -"their own locking." +"A :term:`thread state` does *not* need to be :term:`attached ` when calling these functions; they suppl their own locking." msgstr "" -#: ../../c-api/init.rst:2211 +#: ../../c-api/init.rst:2266 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2215 +#: ../../c-api/init.rst:2270 msgid "" -"None of these API functions handle memory management on behalf of the :c:" -"expr:`void*` values. You need to allocate and deallocate them yourself. If " -"the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, these functions " -"don't do refcount operations on them either." +"None of these API functions handle memory management on behalf of " +"the :c:expr:`void*` values. You need to allocate and deallocate them " +"yourself. If the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, " +"these functions don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2223 +#: ../../c-api/init.rst:2278 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2225 +#: ../../c-api/init.rst:2280 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2231 +#: ../../c-api/init.rst:2286 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2236 +#: ../../c-api/init.rst:2291 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2699,66 +2824,67 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2241 +#: ../../c-api/init.rst:2296 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2247 +#: ../../c-api/init.rst:2302 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: ../../c-api/init.rst:2252 +#: ../../c-api/init.rst:2307 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2254 +#: ../../c-api/init.rst:2309 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2261 +#: ../../c-api/init.rst:2316 msgid "" -"Return a value which is the same state as a value initialized with :c:macro:" -"`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." +"Return a value which is the same state as a value initialized " +"with :c:macro:`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic " +"allocation failure." msgstr "" -#: ../../c-api/init.rst:2268 +#: ../../c-api/init.rst:2323 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2274 +#: ../../c-api/init.rst:2329 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2279 +#: ../../c-api/init.rst:2334 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2281 +#: ../../c-api/init.rst:2336 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " -"undefined if the given :c:type:`Py_tss_t` has not been initialized by :c:" -"func:`PyThread_tss_create`." +"undefined if the given :c:type:`Py_tss_t` has not been initialized " +"by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2289 +#: ../../c-api/init.rst:2344 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2295 +#: ../../c-api/init.rst:2350 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2767,40 +2893,40 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2304 +#: ../../c-api/init.rst:2359 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " -"destroyed key is able to be initialized again by :c:func:" -"`PyThread_tss_create`. This function can be called repeatedly on the same " -"key -- calling it on an already destroyed key is a no-op." +"destroyed key is able to be initialized again " +"by :c:func:`PyThread_tss_create`. This function can be called repeatedly on " +"the same key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2313 +#: ../../c-api/init.rst:2368 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2320 +#: ../../c-api/init.rst:2375 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2328 +#: ../../c-api/init.rst:2383 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2330 +#: ../../c-api/init.rst:2385 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2335 +#: ../../c-api/init.rst:2390 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2809,62 +2935,74 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2340 +#: ../../c-api/init.rst:2395 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:2351 +#: ../../c-api/init.rst:2406 msgid "Synchronization Primitives" msgstr "" -#: ../../c-api/init.rst:2353 +#: ../../c-api/init.rst:2408 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -#: ../../c-api/init.rst:2357 +#: ../../c-api/init.rst:2412 msgid "" "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " "zero to represent the unlocked state. For example::" msgstr "" -#: ../../c-api/init.rst:2360 +#: ../../c-api/init.rst:2415 msgid "PyMutex mutex = {0};" msgstr "PyMutex mutex = {0};" -#: ../../c-api/init.rst:2362 +#: ../../c-api/init.rst:2417 msgid "" "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " "contents and address of a :c:type:`!PyMutex` are meaningful, and it must " "remain at a fixed, writable location in memory." msgstr "" -#: ../../c-api/init.rst:2368 +#: ../../c-api/init.rst:2423 msgid "" "A :c:type:`!PyMutex` currently occupies one byte, but the size should be " "considered unstable. The size may change in future Python releases without " "a deprecation period." msgstr "" -#: ../../c-api/init.rst:2376 +#: ../../c-api/init.rst:2431 msgid "" "Lock mutex *m*. If another thread has already locked it, the calling thread " "will block until the mutex is unlocked. While blocked, the thread will " -"temporarily release the :term:`GIL` if it is held." +"temporarily detach the :term:`thread state ` if one " +"exists." msgstr "" -#: ../../c-api/init.rst:2384 +#: ../../c-api/init.rst:2439 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" -#: ../../c-api/init.rst:2392 +#: ../../c-api/init.rst:2446 +msgid "Returns non-zero if the mutex *m* is currently locked, zero otherwise." +msgstr "" + +#: ../../c-api/init.rst:2450 +msgid "" +"This function is intended for use in assertions and debugging only and " +"should not be used to make concurrency control decisions, as the lock state " +"may change immediately after the check." +msgstr "" + +#: ../../c-api/init.rst:2459 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2394 +#: ../../c-api/init.rst:2461 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded ` CPython. They are " @@ -2872,16 +3010,17 @@ msgid "" "no-ops in versions of Python with the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:2399 +#: ../../c-api/init.rst:2466 msgid "" "Critical sections are intended to be used for custom types implemented in C-" -"API extensions. They should generally not be used with built-in types like :" -"class:`list` and :class:`dict` because their public C-APIs already use " -"critical sections internally, with the notable exception of :c:func:" -"`PyDict_Next`, which requires critical section to be acquired externally." +"API extensions. They should generally not be used with built-in types " +"like :class:`list` and :class:`dict` because their public C-APIs already use " +"critical sections internally, with the notable exception " +"of :c:func:`PyDict_Next`, which requires critical section to be acquired " +"externally." msgstr "" -#: ../../c-api/init.rst:2406 +#: ../../c-api/init.rst:2473 msgid "" "Critical sections avoid deadlocks by implicitly suspending active critical " "sections, hence, they do not provide exclusive access such as provided by " @@ -2892,7 +3031,16 @@ msgid "" "threads can acquire the per-object lock for the same object." msgstr "" -#: ../../c-api/init.rst:2414 +#: ../../c-api/init.rst:2481 +msgid "" +"Variants that accept :c:type:`PyMutex` pointers rather than Python objects " +"are also available. Use these variants to start a critical section in a " +"situation where there is no :c:type:`PyObject` -- for example, when working " +"with a C type that does not extend or wrap :c:type:`PyObject` but still " +"needs to call into the C API in a manner that might lead to deadlocks." +msgstr "" + +#: ../../c-api/init.rst:2487 msgid "" "The functions and structs used by the macros are exposed for cases where C " "macros are not available. They should only be used as in the given macro " @@ -2900,20 +3048,20 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2421 +#: ../../c-api/init.rst:2494 msgid "" -"Operations that need to lock two objects at once must use :c:macro:" -"`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " -"lock more than one object at once, because the inner critical section may " -"suspend the outer critical sections. This API does not provide a way to " -"lock more than two objects at once." +"Operations that need to lock two objects at once must " +"use :c:macro:`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical " +"sections to lock more than one object at once, because the inner critical " +"section may suspend the outer critical sections. This API does not provide " +"a way to lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2427 +#: ../../c-api/init.rst:2500 msgid "Example usage::" msgstr "範例用法: ::" -#: ../../c-api/init.rst:2429 +#: ../../c-api/init.rst:2502 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -2933,28 +3081,29 @@ msgstr "" " Py_RETURN_NONE;\n" "}" -#: ../../c-api/init.rst:2438 +#: ../../c-api/init.rst:2511 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " "critical section API avoids potential deadlocks due to reentrancy and lock " "ordering by allowing the runtime to temporarily suspend the critical section " -"if the code triggered by the finalizer blocks and calls :c:func:" -"`PyEval_SaveThread`." +"if the code triggered by the finalizer blocks and " +"calls :c:func:`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2446 +#: ../../c-api/init.rst:2519 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2449 ../../c-api/init.rst:2463 -#: ../../c-api/init.rst:2478 ../../c-api/init.rst:2492 +#: ../../c-api/init.rst:2522 ../../c-api/init.rst:2536 +#: ../../c-api/init.rst:2553 ../../c-api/init.rst:2568 +#: ../../c-api/init.rst:2582 ../../c-api/init.rst:2599 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2451 +#: ../../c-api/init.rst:2524 msgid "" "{\n" " PyCriticalSection _py_cs;\n" @@ -2964,15 +3113,40 @@ msgstr "" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" -#: ../../c-api/init.rst:2455 ../../c-api/init.rst:2484 +#: ../../c-api/init.rst:2528 ../../c-api/init.rst:2574 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2461 +#: ../../c-api/init.rst:2534 +msgid "Locks the mutex *m* and begins a critical section." +msgstr "" + +#: ../../c-api/init.rst:2538 +#, fuzzy +msgid "" +"{\n" +" PyCriticalSection _py_cs;\n" +" PyCriticalSection_BeginMutex(&_py_cs, m)" +msgstr "" +"{\n" +" PyCriticalSection _py_cs;\n" +" PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" + +#: ../../c-api/init.rst:2542 +msgid "" +"Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION`, there is no cast for " +"the argument of the macro - it must be a :c:type:`PyMutex` pointer." +msgstr "" + +#: ../../c-api/init.rst:2545 ../../c-api/init.rst:2591 +msgid "On the default build, this macro expands to ``{``." +msgstr "" + +#: ../../c-api/init.rst:2551 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2465 +#: ../../c-api/init.rst:2555 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" @@ -2980,18 +3154,18 @@ msgstr "" " PyCriticalSection_End(&_py_cs);\n" "}" -#: ../../c-api/init.rst:2468 ../../c-api/init.rst:2497 +#: ../../c-api/init.rst:2558 ../../c-api/init.rst:2604 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2474 +#: ../../c-api/init.rst:2564 msgid "" "Acquires the per-objects locks for the objects *a* and *b* and begins a " "critical section. The locks are acquired in a consistent order (lowest " "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2480 +#: ../../c-api/init.rst:2570 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" @@ -3001,11 +3175,32 @@ msgstr "" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" -#: ../../c-api/init.rst:2490 +#: ../../c-api/init.rst:2580 +msgid "Locks the mutexes *m1* and *m2* and begins a critical section." +msgstr "" + +#: ../../c-api/init.rst:2584 +#, fuzzy +msgid "" +"{\n" +" PyCriticalSection2 _py_cs2;\n" +" PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2)" +msgstr "" +"{\n" +" PyCriticalSection _py_cs;\n" +" PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" + +#: ../../c-api/init.rst:2588 +msgid "" +"Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, there is no cast for " +"the arguments of the macro - they must be :c:type:`PyMutex` pointers." +msgstr "" + +#: ../../c-api/init.rst:2597 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2494 +#: ../../c-api/init.rst:2601 msgid "" " PyCriticalSection2_End(&_py_cs2);\n" "}" @@ -3021,147 +3216,150 @@ msgstr "PyEval_InitThreads()" msgid "modules (in module sys)" msgstr "modules(sys 模組中)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:700 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:712 msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:700 ../../c-api/init.rst:1166 -#: ../../c-api/init.rst:1689 ../../c-api/init.rst:1788 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:712 ../../c-api/init.rst:1222 +#: ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1689 ../../c-api/init.rst:1788 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1689 ../../c-api/init.rst:1788 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1689 ../../c-api/init.rst:1788 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 msgid "sys" msgstr "sys" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:700 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:712 msgid "search" msgstr "search(搜尋)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:700 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:712 msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1753 ../../c-api/init.rst:1806 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1814 ../../c-api/init.rst:1867 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" -#: ../../c-api/init.rst:566 +#: ../../c-api/init.rst:572 msgid "Py_Initialize()" msgstr "Py_Initialize()" -#: ../../c-api/init.rst:566 ../../c-api/init.rst:798 +#: ../../c-api/init.rst:572 ../../c-api/init.rst:810 msgid "main()" msgstr "main()" -#: ../../c-api/init.rst:566 +#: ../../c-api/init.rst:572 msgid "Py_GetPath()" msgstr "Py_GetPath()" -#: ../../c-api/init.rst:679 +#: ../../c-api/init.rst:690 msgid "executable (in module sys)" msgstr "executable(sys 模組中)" -#: ../../c-api/init.rst:733 ../../c-api/init.rst:775 ../../c-api/init.rst:789 +#: ../../c-api/init.rst:745 ../../c-api/init.rst:787 ../../c-api/init.rst:801 msgid "version (in module sys)" msgstr "version(sys 模組中)" -#: ../../c-api/init.rst:745 +#: ../../c-api/init.rst:757 msgid "platform (in module sys)" msgstr "platform(sys 模組中)" -#: ../../c-api/init.rst:762 +#: ../../c-api/init.rst:774 msgid "copyright (in module sys)" msgstr "copyright(sys 模組中)" -#: ../../c-api/init.rst:798 +#: ../../c-api/init.rst:810 msgid "Py_FatalError()" msgstr "Py_FatalError()" -#: ../../c-api/init.rst:798 +#: ../../c-api/init.rst:810 msgid "argv (in module sys)" msgstr "argv(sys 模組中)" -#: ../../c-api/init.rst:918 +#: ../../c-api/init.rst:930 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../c-api/init.rst:918 +#: ../../c-api/init.rst:930 msgid "interpreter lock" msgstr "interpreter lock(直譯器鎖)" -#: ../../c-api/init.rst:918 +#: ../../c-api/init.rst:930 msgid "lock, interpreter" msgstr "lock, interpreter(鎖、直譯器)" -#: ../../c-api/init.rst:931 +#: ../../c-api/init.rst:944 msgid "setswitchinterval (in module sys)" msgstr "setswitchinterval (sys 模組中)" -#: ../../c-api/init.rst:940 +#: ../../c-api/init.rst:953 msgid "PyThreadState (C type)" msgstr "PyThreadState(C 型別)" -#: ../../c-api/init.rst:966 +#: ../../c-api/init.rst:989 msgid "Py_BEGIN_ALLOW_THREADS (C macro)" msgstr "Py_BEGIN_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:966 +#: ../../c-api/init.rst:989 msgid "Py_END_ALLOW_THREADS (C macro)" msgstr "Py_END_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:982 +#: ../../c-api/init.rst:1005 msgid "PyEval_RestoreThread (C function)" msgstr "PyEval_RestoreThread(C 函式)" -#: ../../c-api/init.rst:982 +#: ../../c-api/init.rst:1005 msgid "PyEval_SaveThread (C function)" msgstr "PyEval_SaveThread(C 函式)" -#: ../../c-api/init.rst:1144 +#: ../../c-api/init.rst:1200 msgid "PyEval_AcquireThread()" msgstr "PyEval_AcquireThread()" -#: ../../c-api/init.rst:1144 +#: ../../c-api/init.rst:1200 msgid "PyEval_ReleaseThread()" msgstr "PyEval_ReleaseThread()" -#: ../../c-api/init.rst:1144 +#: ../../c-api/init.rst:1200 msgid "PyEval_SaveThread()" msgstr "PyEval_SaveThread()" -#: ../../c-api/init.rst:1144 +#: ../../c-api/init.rst:1200 msgid "PyEval_RestoreThread()" msgstr "PyEval_RestoreThread()" -#: ../../c-api/init.rst:1166 +#: ../../c-api/init.rst:1222 msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1689 ../../c-api/init.rst:1788 +#: ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1689 ../../c-api/init.rst:1788 +#: ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1689 ../../c-api/init.rst:1788 +#: ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1753 +#: ../../c-api/init.rst:1814 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1783 +#: ../../c-api/init.rst:1844 msgid "close (in module os)" msgstr "close(os 模組中)" + +#~ msgid "*tstate* must not be ``NULL``." +#~ msgstr "*tstate* 不可為 ``NULL``。" diff --git a/c-api/init_config.po b/c-api/init_config.po index 434dd0394e1..abd8231ebaf 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-14 00:14+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,18 +22,1160 @@ msgstr "" msgid "Python Initialization Configuration" msgstr "Python 初始化設定" -#: ../../c-api/init_config.rst:11 +#: ../../c-api/init_config.rst:13 +#, fuzzy +msgid "PyInitConfig C API" +msgstr "PyConfig" + +#: ../../c-api/init_config.rst:17 +msgid "Python can be initialized with :c:func:`Py_InitializeFromInitConfig`." +msgstr "" + +#: ../../c-api/init_config.rst:19 ../../c-api/init_config.rst:650 +msgid "" +"The :c:func:`Py_RunMain` function can be used to write a customized Python " +"program." +msgstr "" + +#: ../../c-api/init_config.rst:22 ../../c-api/init_config.rst:653 +msgid "" +"See also :ref:`Initialization, Finalization, and Threads `." +msgstr "" + +#: ../../c-api/init_config.rst:25 +msgid ":pep:`741` \"Python Configuration C API\"." +msgstr "" + +#: ../../c-api/init_config.rst:29 ../../c-api/init_config.rst:660 +msgid "Example" +msgstr "範例" + +#: ../../c-api/init_config.rst:31 +msgid "" +"Example of customized Python always running with the :ref:`Python " +"Development Mode ` enabled; return ``-1`` on error:" +msgstr "" + +#: ../../c-api/init_config.rst:34 +msgid "" +"int init_python(void)\n" +"{\n" +" PyInitConfig *config = PyInitConfig_Create();\n" +" if (config == NULL) {\n" +" printf(\"PYTHON INIT ERROR: memory allocation failed\\n\");\n" +" return -1;\n" +" }\n" +"\n" +" // Enable the Python Development Mode\n" +" if (PyInitConfig_SetInt(config, \"dev_mode\", 1) < 0) {\n" +" goto error;\n" +" }\n" +"\n" +" // Initialize Python with the configuration\n" +" if (Py_InitializeFromInitConfig(config) < 0) {\n" +" goto error;\n" +" }\n" +" PyInitConfig_Free(config);\n" +" return 0;\n" +"\n" +"error:\n" +" {\n" +" // Display the error message.\n" +" //\n" +" // This uncommon braces style is used, because you cannot make\n" +" // goto targets point to variable declarations.\n" +" const char *err_msg;\n" +" (void)PyInitConfig_GetError(config, &err_msg);\n" +" printf(\"PYTHON INIT ERROR: %s\\n\", err_msg);\n" +" PyInitConfig_Free(config);\n" +" return -1;\n" +" }\n" +"}" +msgstr "" + +#: ../../c-api/init_config.rst:71 +#, fuzzy +msgid "Create Config" +msgstr "PyPreConfig" + +#: ../../c-api/init_config.rst:75 +msgid "Opaque structure to configure the Python initialization." +msgstr "" + +#: ../../c-api/init_config.rst:80 +msgid "" +"Create a new initialization configuration using :ref:`Isolated Configuration " +"` default values." +msgstr "" + +#: ../../c-api/init_config.rst:83 +msgid "It must be freed by :c:func:`PyInitConfig_Free`." +msgstr "" + +#: ../../c-api/init_config.rst:85 +msgid "Return ``NULL`` on memory allocation failure." +msgstr "" + +#: ../../c-api/init_config.rst:90 +#, fuzzy +msgid "Free memory of the initialization configuration *config*." +msgstr "Python 初始化設定" + +#: ../../c-api/init_config.rst:92 +msgid "If *config* is ``NULL``, no operation is performed." +msgstr "" + +#: ../../c-api/init_config.rst:96 +msgid "Error Handling" +msgstr "" + +#: ../../c-api/init_config.rst:100 +msgid "Get the *config* error message." +msgstr "" + +#: ../../c-api/init_config.rst:102 +msgid "Set *\\*err_msg* and return ``1`` if an error is set." +msgstr "" + +#: ../../c-api/init_config.rst:103 +msgid "Set *\\*err_msg* to ``NULL`` and return ``0`` otherwise." +msgstr "" + +#: ../../c-api/init_config.rst:105 +msgid "An error message is an UTF-8 encoded string." +msgstr "" + +#: ../../c-api/init_config.rst:107 +msgid "If *config* has an exit code, format the exit code as an error message." +msgstr "" + +#: ../../c-api/init_config.rst:110 +msgid "" +"The error message remains valid until another ``PyInitConfig`` function is " +"called with *config*. The caller doesn't have to free the error message." +msgstr "" + +#: ../../c-api/init_config.rst:117 +msgid "Get the *config* exit code." +msgstr "" + +#: ../../c-api/init_config.rst:119 +msgid "Set *\\*exitcode* and return ``1`` if *config* has an exit code set." +msgstr "" + +#: ../../c-api/init_config.rst:120 +msgid "Return ``0`` if *config* has no exit code set." +msgstr "" + +#: ../../c-api/init_config.rst:122 +msgid "" +"Only the ``Py_InitializeFromInitConfig()`` function can set an exit code if " +"the ``parse_argv`` option is non-zero." +msgstr "" + +#: ../../c-api/init_config.rst:125 +msgid "" +"An exit code can be set when parsing the command line failed (exit code " +"``2``) or when a command line option asks to display the command line help " +"(exit code ``0``)." +msgstr "" + +#: ../../c-api/init_config.rst:131 +msgid "Get Options" +msgstr "" + +#: ../../c-api/init_config.rst:133 ../../c-api/init_config.rst:187 +#: ../../c-api/init_config.rst:559 +msgid "" +"The configuration option *name* parameter must be a non-NULL null-terminated " +"UTF-8 encoded string. See :ref:`Configuration Options `." +msgstr "" + +#: ../../c-api/init_config.rst:138 +msgid "Test if the configuration has an option called *name*." +msgstr "" + +#: ../../c-api/init_config.rst:140 +msgid "Return ``1`` if the option exists, or return ``0`` otherwise." +msgstr "" + +#: ../../c-api/init_config.rst:145 +msgid "Get an integer configuration option." +msgstr "" + +#: ../../c-api/init_config.rst:147 ../../c-api/init_config.rst:156 +msgid "Set *\\*value*, and return ``0`` on success." +msgstr "" + +#: ../../c-api/init_config.rst:148 ../../c-api/init_config.rst:157 +#: ../../c-api/init_config.rst:172 ../../c-api/init_config.rst:200 +#: ../../c-api/init_config.rst:209 ../../c-api/init_config.rst:218 +#: ../../c-api/init_config.rst:233 ../../c-api/init_config.rst:249 +msgid "Set an error in *config* and return ``-1`` on error." +msgstr "" + +#: ../../c-api/init_config.rst:153 +msgid "" +"Get a string configuration option as a null-terminated UTF-8 encoded string." +msgstr "" + +#: ../../c-api/init_config.rst:159 +msgid "" +"*\\*value* can be set to ``NULL`` if the option is an optional string and " +"the option is unset." +msgstr "" + +#: ../../c-api/init_config.rst:162 +msgid "" +"On success, the string must be released with ``free(value)`` if it's not " +"``NULL``." +msgstr "" + +#: ../../c-api/init_config.rst:168 +msgid "" +"Get a string list configuration option as an array of null-terminated UTF-8 " +"encoded strings." +msgstr "" + +#: ../../c-api/init_config.rst:171 +msgid "Set *\\*length* and *\\*value*, and return ``0`` on success." +msgstr "" + +#: ../../c-api/init_config.rst:174 +msgid "" +"On success, the string list must be released with " +"``PyInitConfig_FreeStrList(length, items)``." +msgstr "" + +#: ../../c-api/init_config.rst:180 +msgid "Free memory of a string list created by ``PyInitConfig_GetStrList()``." +msgstr "" + +#: ../../c-api/init_config.rst:185 +msgid "Set Options" +msgstr "" + +#: ../../c-api/init_config.rst:190 +msgid "" +"Some configuration options have side effects on other options. This logic is " +"only implemented when ``Py_InitializeFromInitConfig()`` is called, not by " +"the \"Set\" functions below. For example, setting ``dev_mode`` to ``1`` does " +"not set ``faulthandler`` to ``1``." +msgstr "" + +#: ../../c-api/init_config.rst:197 +msgid "Set an integer configuration option." +msgstr "" + +#: ../../c-api/init_config.rst:199 ../../c-api/init_config.rst:208 +#: ../../c-api/init_config.rst:217 ../../c-api/init_config.rst:232 +#: ../../c-api/init_config.rst:248 ../../c-api/init_config.rst:591 +msgid "Return ``0`` on success." +msgstr "" + +#: ../../c-api/init_config.rst:205 +msgid "" +"Set a string configuration option from a null-terminated UTF-8 encoded " +"string. The string is copied." +msgstr "" + +#: ../../c-api/init_config.rst:214 +msgid "" +"Set a string list configuration option from an array of null-terminated " +"UTF-8 encoded strings. The string list is copied." +msgstr "" + +#: ../../c-api/init_config.rst:222 +msgid "Module" +msgstr "" + +#: ../../c-api/init_config.rst:226 +msgid "Add a built-in extension module to the table of built-in modules." +msgstr "" + +#: ../../c-api/init_config.rst:228 +msgid "" +"The new module can be imported by the name *name*, and uses the function " +"*initfunc* as the initialization function called on the first attempted " +"import." +msgstr "" + +#: ../../c-api/init_config.rst:235 +msgid "" +"If Python is initialized multiple times, ``PyInitConfig_AddModule()`` must " +"be called at each Python initialization." +msgstr "" + +#: ../../c-api/init_config.rst:238 +msgid "Similar to the :c:func:`PyImport_AppendInittab` function." +msgstr "" + +#: ../../c-api/init_config.rst:242 +msgid "Initialize Python" +msgstr "" + +#: ../../c-api/init_config.rst:246 +#, fuzzy +msgid "Initialize Python from the initialization configuration." +msgstr "Python 初始化設定" + +#: ../../c-api/init_config.rst:250 +msgid "Set an exit code in *config* and return ``-1`` if Python wants to exit." +msgstr "" + +#: ../../c-api/init_config.rst:253 +msgid "See ``PyInitConfig_GetExitcode()`` for the exit code case." +msgstr "" + +#: ../../c-api/init_config.rst:259 +msgid "Configuration Options" +msgstr "" + +#: ../../c-api/init_config.rst:264 +msgid "Option" +msgstr "" + +#: ../../c-api/init_config.rst:265 +msgid "PyConfig/PyPreConfig member" +msgstr "" + +#: ../../c-api/init_config.rst:266 +msgid "Type" +msgstr "" + +#: ../../c-api/init_config.rst:267 +msgid "Visibility" +msgstr "" + +#: ../../c-api/init_config.rst:268 +msgid "``\"allocator\"``" +msgstr "" + +#: ../../c-api/init_config.rst:269 +#, fuzzy +msgid ":c:member:`allocator `" +msgstr ":c:member:`PyConfig.platlibdir`" + +#: ../../c-api/init_config.rst:270 ../../c-api/init_config.rst:294 +#: ../../c-api/init_config.rst:322 ../../c-api/init_config.rst:358 +#: ../../c-api/init_config.rst:366 ../../c-api/init_config.rst:378 +#: ../../c-api/init_config.rst:406 ../../c-api/init_config.rst:494 +#: ../../c-api/init_config.rst:522 ../../c-api/init_config.rst:576 +msgid "``int``" +msgstr "" + +#: ../../c-api/init_config.rst:271 ../../c-api/init_config.rst:291 +#: ../../c-api/init_config.rst:299 ../../c-api/init_config.rst:303 +#: ../../c-api/init_config.rst:307 ../../c-api/init_config.rst:311 +#: ../../c-api/init_config.rst:315 ../../c-api/init_config.rst:319 +#: ../../c-api/init_config.rst:327 ../../c-api/init_config.rst:331 +#: ../../c-api/init_config.rst:335 ../../c-api/init_config.rst:347 +#: ../../c-api/init_config.rst:351 ../../c-api/init_config.rst:355 +#: ../../c-api/init_config.rst:359 ../../c-api/init_config.rst:363 +#: ../../c-api/init_config.rst:367 ../../c-api/init_config.rst:375 +#: ../../c-api/init_config.rst:387 ../../c-api/init_config.rst:391 +#: ../../c-api/init_config.rst:395 ../../c-api/init_config.rst:399 +#: ../../c-api/init_config.rst:411 ../../c-api/init_config.rst:415 +#: ../../c-api/init_config.rst:423 ../../c-api/init_config.rst:427 +#: ../../c-api/init_config.rst:439 ../../c-api/init_config.rst:451 +#: ../../c-api/init_config.rst:455 ../../c-api/init_config.rst:459 +#: ../../c-api/init_config.rst:463 ../../c-api/init_config.rst:467 +#: ../../c-api/init_config.rst:471 ../../c-api/init_config.rst:475 +#: ../../c-api/init_config.rst:479 ../../c-api/init_config.rst:483 +#: ../../c-api/init_config.rst:487 ../../c-api/init_config.rst:495 +#: ../../c-api/init_config.rst:503 ../../c-api/init_config.rst:507 +#: ../../c-api/init_config.rst:511 ../../c-api/init_config.rst:515 +#: ../../c-api/init_config.rst:519 ../../c-api/init_config.rst:527 +#: ../../c-api/init_config.rst:543 +msgid "Read-only" +msgstr "" + +#: ../../c-api/init_config.rst:272 +msgid "``\"argv\"``" +msgstr "" + +#: ../../c-api/init_config.rst:273 +#, fuzzy +msgid ":c:member:`argv `" +msgstr ":c:member:`PyConfig.parse_argv`" + +#: ../../c-api/init_config.rst:274 ../../c-api/init_config.rst:402 +#: ../../c-api/init_config.rst:410 ../../c-api/init_config.rst:530 +#: ../../c-api/init_config.rst:578 +msgid "``list[str]``" +msgstr "" + +#: ../../c-api/init_config.rst:275 ../../c-api/init_config.rst:279 +#: ../../c-api/init_config.rst:283 ../../c-api/init_config.rst:287 +#: ../../c-api/init_config.rst:295 ../../c-api/init_config.rst:323 +#: ../../c-api/init_config.rst:339 ../../c-api/init_config.rst:343 +#: ../../c-api/init_config.rst:371 ../../c-api/init_config.rst:379 +#: ../../c-api/init_config.rst:383 ../../c-api/init_config.rst:403 +#: ../../c-api/init_config.rst:407 ../../c-api/init_config.rst:419 +#: ../../c-api/init_config.rst:431 ../../c-api/init_config.rst:435 +#: ../../c-api/init_config.rst:443 ../../c-api/init_config.rst:447 +#: ../../c-api/init_config.rst:491 ../../c-api/init_config.rst:499 +#: ../../c-api/init_config.rst:523 ../../c-api/init_config.rst:531 +#: ../../c-api/init_config.rst:535 ../../c-api/init_config.rst:539 +msgid "Public" +msgstr "" + +#: ../../c-api/init_config.rst:276 +#, fuzzy +msgid "``\"base_exec_prefix\"``" +msgstr ":data:`sys.base_exec_prefix`。" + +#: ../../c-api/init_config.rst:277 +#, fuzzy +msgid ":c:member:`base_exec_prefix `" +msgstr ":c:member:`PyConfig.base_exec_prefix`" + +#: ../../c-api/init_config.rst:278 ../../c-api/init_config.rst:282 +#: ../../c-api/init_config.rst:286 ../../c-api/init_config.rst:298 +#: ../../c-api/init_config.rst:334 ../../c-api/init_config.rst:338 +#: ../../c-api/init_config.rst:342 ../../c-api/init_config.rst:350 +#: ../../c-api/init_config.rst:354 ../../c-api/init_config.rst:362 +#: ../../c-api/init_config.rst:430 ../../c-api/init_config.rst:434 +#: ../../c-api/init_config.rst:438 ../../c-api/init_config.rst:442 +#: ../../c-api/init_config.rst:450 ../../c-api/init_config.rst:454 +#: ../../c-api/init_config.rst:458 ../../c-api/init_config.rst:462 +#: ../../c-api/init_config.rst:482 ../../c-api/init_config.rst:486 +#: ../../c-api/init_config.rst:490 ../../c-api/init_config.rst:577 +msgid "``str``" +msgstr "" + +#: ../../c-api/init_config.rst:280 +msgid "``\"base_executable\"``" +msgstr "" + +#: ../../c-api/init_config.rst:281 +#, fuzzy +msgid ":c:member:`base_executable `" +msgstr ":c:member:`PyConfig.base_executable`" + +#: ../../c-api/init_config.rst:284 +#, fuzzy +msgid "``\"base_prefix\"``" +msgstr ":data:`sys.base_prefix`。" + +#: ../../c-api/init_config.rst:285 +#, fuzzy +msgid ":c:member:`base_prefix `" +msgstr ":c:member:`PyConfig.base_prefix`" + +#: ../../c-api/init_config.rst:288 +msgid "``\"buffered_stdio\"``" +msgstr "" + +#: ../../c-api/init_config.rst:289 +#, fuzzy +msgid ":c:member:`buffered_stdio `" +msgstr ":c:member:`PyConfig.base_prefix`" + +#: ../../c-api/init_config.rst:290 ../../c-api/init_config.rst:302 +#: ../../c-api/init_config.rst:306 ../../c-api/init_config.rst:310 +#: ../../c-api/init_config.rst:314 ../../c-api/init_config.rst:318 +#: ../../c-api/init_config.rst:326 ../../c-api/init_config.rst:330 +#: ../../c-api/init_config.rst:346 ../../c-api/init_config.rst:370 +#: ../../c-api/init_config.rst:374 ../../c-api/init_config.rst:382 +#: ../../c-api/init_config.rst:386 ../../c-api/init_config.rst:390 +#: ../../c-api/init_config.rst:394 ../../c-api/init_config.rst:398 +#: ../../c-api/init_config.rst:414 ../../c-api/init_config.rst:418 +#: ../../c-api/init_config.rst:422 ../../c-api/init_config.rst:426 +#: ../../c-api/init_config.rst:446 ../../c-api/init_config.rst:466 +#: ../../c-api/init_config.rst:470 ../../c-api/init_config.rst:474 +#: ../../c-api/init_config.rst:478 ../../c-api/init_config.rst:498 +#: ../../c-api/init_config.rst:502 ../../c-api/init_config.rst:506 +#: ../../c-api/init_config.rst:510 ../../c-api/init_config.rst:514 +#: ../../c-api/init_config.rst:518 ../../c-api/init_config.rst:526 +#: ../../c-api/init_config.rst:534 ../../c-api/init_config.rst:542 +#: ../../c-api/init_config.rst:575 +msgid "``bool``" +msgstr "" + +#: ../../c-api/init_config.rst:292 +msgid "``\"bytes_warning\"``" +msgstr "" + +#: ../../c-api/init_config.rst:293 +#, fuzzy +msgid ":c:member:`bytes_warning `" +msgstr ":c:member:`PyConfig.pathconfig_warnings`" + +#: ../../c-api/init_config.rst:296 +msgid "``\"check_hash_pycs_mode\"``" +msgstr "" + +#: ../../c-api/init_config.rst:297 +msgid ":c:member:`check_hash_pycs_mode `" +msgstr "" + +#: ../../c-api/init_config.rst:300 +msgid "``\"code_debug_ranges\"``" +msgstr "" + +#: ../../c-api/init_config.rst:301 +msgid ":c:member:`code_debug_ranges `" +msgstr "" + +#: ../../c-api/init_config.rst:304 +msgid "``\"coerce_c_locale\"``" +msgstr "" + +#: ../../c-api/init_config.rst:305 +#, fuzzy +msgid ":c:member:`coerce_c_locale `" +msgstr ":c:member:`PyConfig.executable`" + +#: ../../c-api/init_config.rst:308 +msgid "``\"coerce_c_locale_warn\"``" +msgstr "" + +#: ../../c-api/init_config.rst:309 +msgid ":c:member:`coerce_c_locale_warn `" +msgstr "" + +#: ../../c-api/init_config.rst:312 +msgid "``\"configure_c_stdio\"``" +msgstr "" + +#: ../../c-api/init_config.rst:313 +msgid ":c:member:`configure_c_stdio `" +msgstr "" + +#: ../../c-api/init_config.rst:316 +msgid "``\"configure_locale\"``" +msgstr "" + +#: ../../c-api/init_config.rst:317 +msgid ":c:member:`configure_locale `" +msgstr "" + +#: ../../c-api/init_config.rst:320 +msgid "``\"cpu_count\"``" +msgstr "" + +#: ../../c-api/init_config.rst:321 +#, fuzzy +msgid ":c:member:`cpu_count `" +msgstr ":c:member:`PyConfig.use_environment`" + +#: ../../c-api/init_config.rst:324 +msgid "``\"dev_mode\"``" +msgstr "" + +#: ../../c-api/init_config.rst:325 +#, fuzzy +msgid ":c:member:`dev_mode `" +msgstr ":c:member:`PyConfig.dev_mode`" + +#: ../../c-api/init_config.rst:328 +msgid "``\"dump_refs\"``" +msgstr "" + +#: ../../c-api/init_config.rst:329 +#, fuzzy +msgid ":c:member:`dump_refs `" +msgstr ":c:member:`PyConfig.prefix`" + +#: ../../c-api/init_config.rst:332 +msgid "``\"dump_refs_file\"``" +msgstr "" + +#: ../../c-api/init_config.rst:333 +#, fuzzy +msgid ":c:member:`dump_refs_file `" +msgstr ":c:member:`PyConfig.prefix`" + +#: ../../c-api/init_config.rst:336 +msgid "``\"exec_prefix\"``" +msgstr "" + +#: ../../c-api/init_config.rst:337 +#, fuzzy +msgid ":c:member:`exec_prefix `" +msgstr ":c:member:`PyConfig.exec_prefix`" + +#: ../../c-api/init_config.rst:340 +msgid "``\"executable\"``" +msgstr "" + +#: ../../c-api/init_config.rst:341 +#, fuzzy +msgid ":c:member:`executable `" +msgstr ":c:member:`PyConfig.executable`" + +#: ../../c-api/init_config.rst:344 +msgid "``\"faulthandler\"``" +msgstr "" + +#: ../../c-api/init_config.rst:345 +#, fuzzy +msgid ":c:member:`faulthandler `" +msgstr ":c:member:`PyConfig.executable`" + +#: ../../c-api/init_config.rst:348 +msgid "``\"filesystem_encoding\"``" +msgstr "" + +#: ../../c-api/init_config.rst:349 +#, fuzzy +msgid ":c:member:`filesystem_encoding `" +msgstr "將 :c:member:`PyConfig.filesystem_encoding` 設為 ``\"mbcs\"``、" + +#: ../../c-api/init_config.rst:352 +msgid "``\"filesystem_errors\"``" +msgstr "" + +#: ../../c-api/init_config.rst:353 +#, fuzzy +msgid ":c:member:`filesystem_errors `" +msgstr "將 :c:member:`PyConfig.filesystem_errors` 設為 ``\"replace\"``。" + +#: ../../c-api/init_config.rst:356 +msgid "``\"hash_seed\"``" +msgstr "" + +#: ../../c-api/init_config.rst:357 +#, fuzzy +msgid ":c:member:`hash_seed `" +msgstr ":c:member:`PyConfig.home`" + +#: ../../c-api/init_config.rst:360 +msgid "``\"home\"``" +msgstr "" + +#: ../../c-api/init_config.rst:361 +#, fuzzy +msgid ":c:member:`home `" +msgstr ":c:member:`PyConfig.home`" + +#: ../../c-api/init_config.rst:364 +msgid "``\"import_time\"``" +msgstr "" + +#: ../../c-api/init_config.rst:365 +#, fuzzy +msgid ":c:member:`import_time `" +msgstr ":c:member:`PyConfig.program_name`" + +#: ../../c-api/init_config.rst:368 +#, fuzzy +msgid "``\"inspect\"``" +msgstr "``\"strict\"``" + +#: ../../c-api/init_config.rst:369 +#, fuzzy +msgid ":c:member:`inspect `" +msgstr ":c:member:`PyConfig.isolated`" + +#: ../../c-api/init_config.rst:372 +msgid "``\"install_signal_handlers\"``" +msgstr "" + +#: ../../c-api/init_config.rst:373 +msgid ":c:member:`install_signal_handlers `" +msgstr "" + +#: ../../c-api/init_config.rst:376 +msgid "``\"int_max_str_digits\"``" +msgstr "" + +#: ../../c-api/init_config.rst:377 +msgid ":c:member:`int_max_str_digits `" +msgstr "" + +#: ../../c-api/init_config.rst:380 +msgid "``\"interactive\"``" +msgstr "" + +#: ../../c-api/init_config.rst:381 +#, fuzzy +msgid ":c:member:`interactive `" +msgstr ":c:member:`PyConfig.isolated`" + +#: ../../c-api/init_config.rst:384 +msgid "``\"isolated\"``" +msgstr "" + +#: ../../c-api/init_config.rst:385 +#, fuzzy +msgid ":c:member:`isolated `" +msgstr ":c:member:`PyConfig.isolated`" + +#: ../../c-api/init_config.rst:388 +msgid "``\"legacy_windows_fs_encoding\"``" +msgstr "" + +#: ../../c-api/init_config.rst:389 +#, fuzzy +msgid "" +":c:member:`legacy_windows_fs_encoding " +"`" +msgstr "也請見 :c:member:`PyConfig.legacy_windows_stdio`。" + +#: ../../c-api/init_config.rst:392 +msgid "``\"legacy_windows_stdio\"``" +msgstr "" + +#: ../../c-api/init_config.rst:393 +#, fuzzy +msgid ":c:member:`legacy_windows_stdio `" +msgstr "也請見 :c:member:`PyConfig.legacy_windows_stdio`。" + +#: ../../c-api/init_config.rst:396 +msgid "``\"malloc_stats\"``" +msgstr "" + +#: ../../c-api/init_config.rst:397 +#, fuzzy +msgid ":c:member:`malloc_stats `" +msgstr ":c:member:`PyConfig.isolated`" + +#: ../../c-api/init_config.rst:400 +msgid "``\"module_search_paths\"``" +msgstr "" + +#: ../../c-api/init_config.rst:401 +#, fuzzy +msgid ":c:member:`module_search_paths `" +msgstr ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig.module_search_paths`" + +#: ../../c-api/init_config.rst:404 +msgid "``\"optimization_level\"``" +msgstr "" + +#: ../../c-api/init_config.rst:405 +msgid ":c:member:`optimization_level `" +msgstr "" + +#: ../../c-api/init_config.rst:408 +msgid "``\"orig_argv\"``" +msgstr "" + +#: ../../c-api/init_config.rst:409 +#, fuzzy +msgid ":c:member:`orig_argv `" +msgstr ":c:member:`PyConfig.parse_argv`" + +#: ../../c-api/init_config.rst:412 +msgid "``\"parse_argv\"``" +msgstr "" + +#: ../../c-api/init_config.rst:413 +#, fuzzy +msgid ":c:member:`parse_argv `" +msgstr ":c:member:`PyConfig.parse_argv`" + +#: ../../c-api/init_config.rst:416 +msgid "``\"parser_debug\"``" +msgstr "" + +#: ../../c-api/init_config.rst:417 +#, fuzzy +msgid ":c:member:`parser_debug `" +msgstr ":c:member:`PyConfig.parse_argv`" + +#: ../../c-api/init_config.rst:420 +#, fuzzy +msgid "``\"pathconfig_warnings\"``" +msgstr ":c:member:`PyConfig.pathconfig_warnings`" + +#: ../../c-api/init_config.rst:421 +#, fuzzy +msgid ":c:member:`pathconfig_warnings `" +msgstr ":c:member:`PyConfig.pathconfig_warnings`" + +#: ../../c-api/init_config.rst:424 +msgid "``\"perf_profiling\"``" +msgstr "" + +#: ../../c-api/init_config.rst:425 +#, fuzzy +msgid ":c:member:`perf_profiling `" +msgstr ":c:member:`PyConfig.base_prefix`" + +#: ../../c-api/init_config.rst:428 +msgid "``\"platlibdir\"``" +msgstr "" + +#: ../../c-api/init_config.rst:429 +#, fuzzy +msgid ":c:member:`platlibdir `" +msgstr ":c:member:`PyConfig.platlibdir`" + +#: ../../c-api/init_config.rst:432 +msgid "``\"prefix\"``" +msgstr "" + +#: ../../c-api/init_config.rst:433 +#, fuzzy +msgid ":c:member:`prefix `" +msgstr ":c:member:`PyConfig.prefix`" + +#: ../../c-api/init_config.rst:436 +#, fuzzy +msgid "``\"program_name\"``" +msgstr "``\"surrogateescape\"``" + +#: ../../c-api/init_config.rst:437 +#, fuzzy +msgid ":c:member:`program_name `" +msgstr ":c:member:`PyConfig.program_name`" + +#: ../../c-api/init_config.rst:440 +msgid "``\"pycache_prefix\"``" +msgstr "" + +#: ../../c-api/init_config.rst:441 +#, fuzzy +msgid ":c:member:`pycache_prefix `" +msgstr ":c:member:`PyConfig.base_prefix`" + +#: ../../c-api/init_config.rst:444 +#, fuzzy +msgid "``\"quiet\"``" +msgstr "``\"strict\"``" + +#: ../../c-api/init_config.rst:445 +#, fuzzy +msgid ":c:member:`quiet `" +msgstr ":c:member:`PyConfig.home`" + +#: ../../c-api/init_config.rst:448 +msgid "``\"run_command\"``" +msgstr "" + +#: ../../c-api/init_config.rst:449 +#, fuzzy +msgid ":c:member:`run_command `" +msgstr ":c:member:`PyConfig.home`" + +#: ../../c-api/init_config.rst:452 +msgid "``\"run_filename\"``" +msgstr "" + +#: ../../c-api/init_config.rst:453 +#, fuzzy +msgid ":c:member:`run_filename `" +msgstr ":c:member:`PyConfig.program_name`" + +#: ../../c-api/init_config.rst:456 +msgid "``\"run_module\"``" +msgstr "" + +#: ../../c-api/init_config.rst:457 +#, fuzzy +msgid ":c:member:`run_module `" +msgstr ":c:member:`PyConfig.dev_mode`" + +#: ../../c-api/init_config.rst:460 +msgid "``\"run_presite\"``" +msgstr "" + +#: ../../c-api/init_config.rst:461 +#, fuzzy +msgid ":c:member:`run_presite `" +msgstr ":c:member:`PyConfig.prefix`" + +#: ../../c-api/init_config.rst:464 +msgid "``\"safe_path\"``" +msgstr "" + +#: ../../c-api/init_config.rst:465 +#, fuzzy +msgid ":c:member:`safe_path `" +msgstr "將 :c:member:`~PyConfig.safe_path` 設定為 ``1``。" + +#: ../../c-api/init_config.rst:468 +#, fuzzy +msgid "``\"show_ref_count\"``" +msgstr "``\"strict\"``" + +#: ../../c-api/init_config.rst:469 +#, fuzzy +msgid ":c:member:`show_ref_count `" +msgstr ":c:member:`PyConfig.home`" + +#: ../../c-api/init_config.rst:472 +#, fuzzy +msgid "``\"site_import\"``" +msgstr "``\"strict\"``" + +#: ../../c-api/init_config.rst:473 +#, fuzzy +msgid ":c:member:`site_import `" +msgstr "將 :c:member:`~PyConfig.site_import` 設定為 ``0``。" + +#: ../../c-api/init_config.rst:476 +msgid "``\"skip_source_first_line\"``" +msgstr "" + +#: ../../c-api/init_config.rst:477 +#, fuzzy +msgid ":c:member:`skip_source_first_line `" +msgstr "也請見 :c:member:`PyConfig.skip_source_first_line` 選項。" + +#: ../../c-api/init_config.rst:480 +#, fuzzy +msgid "``\"stdio_encoding\"``" +msgstr "``\"strict\"``" + +#: ../../c-api/init_config.rst:481 +#, fuzzy +msgid ":c:member:`stdio_encoding `" +msgstr ":c:member:`PyConfig.dev_mode`" + +#: ../../c-api/init_config.rst:484 +#, fuzzy +msgid "``\"stdio_errors\"``" +msgstr "``\"strict\"``" + +#: ../../c-api/init_config.rst:485 +#, fuzzy +msgid ":c:member:`stdio_errors `" +msgstr ":c:member:`PyConfig.platlibdir`" + +#: ../../c-api/init_config.rst:488 +#, fuzzy +msgid "``\"stdlib_dir\"``" +msgstr "``\"strict\"``" + +#: ../../c-api/init_config.rst:489 +#, fuzzy +msgid ":c:member:`stdlib_dir `" +msgstr ":c:member:`PyConfig.platlibdir`" + +#: ../../c-api/init_config.rst:492 +msgid "``\"tracemalloc\"``" +msgstr "" + +#: ../../c-api/init_config.rst:493 +#, fuzzy +msgid ":c:member:`tracemalloc `" +msgstr ":c:member:`PyConfig.dev_mode`" + +#: ../../c-api/init_config.rst:496 +msgid "``\"use_environment\"``" +msgstr "" + +#: ../../c-api/init_config.rst:497 +#, fuzzy +msgid ":c:member:`use_environment `" +msgstr ":c:member:`PyConfig.use_environment`" + +#: ../../c-api/init_config.rst:500 +msgid "``\"use_frozen_modules\"``" +msgstr "" + +#: ../../c-api/init_config.rst:501 +#, fuzzy +msgid ":c:member:`use_frozen_modules `" +msgstr ":c:member:`PyConfig.use_environment`" + +#: ../../c-api/init_config.rst:504 +msgid "``\"use_hash_seed\"``" +msgstr "" + +#: ../../c-api/init_config.rst:505 +#, fuzzy +msgid ":c:member:`use_hash_seed `" +msgstr ":c:member:`PyConfig.isolated`" + +#: ../../c-api/init_config.rst:508 +msgid "``\"use_system_logger\"``" +msgstr "" + +#: ../../c-api/init_config.rst:509 +msgid ":c:member:`use_system_logger `" +msgstr "" + +#: ../../c-api/init_config.rst:512 +msgid "``\"user_site_directory\"``" +msgstr "" + +#: ../../c-api/init_config.rst:513 +#, fuzzy +msgid ":c:member:`user_site_directory `" +msgstr ":c:member:`PyConfig.use_environment`" + +#: ../../c-api/init_config.rst:516 +msgid "``\"utf8_mode\"``" +msgstr "" + +#: ../../c-api/init_config.rst:517 +#, fuzzy +msgid ":c:member:`utf8_mode `" +msgstr "將 :c:member:`PyPreConfig.utf8_mode` 設為 ``0``、" + +#: ../../c-api/init_config.rst:520 +msgid "``\"verbose\"``" +msgstr "" + +#: ../../c-api/init_config.rst:521 +#, fuzzy +msgid ":c:member:`verbose `" +msgstr ":c:member:`PyConfig.home`" + +#: ../../c-api/init_config.rst:524 +msgid "``\"warn_default_encoding\"``" +msgstr "" + +#: ../../c-api/init_config.rst:525 +msgid ":c:member:`warn_default_encoding `" +msgstr "" + +#: ../../c-api/init_config.rst:528 +msgid "``\"warnoptions\"``" +msgstr "" + +#: ../../c-api/init_config.rst:529 +#, fuzzy +msgid ":c:member:`warnoptions `" +msgstr ":c:member:`PyConfig.pathconfig_warnings`" + +#: ../../c-api/init_config.rst:532 +msgid "``\"write_bytecode\"``" +msgstr "" + +#: ../../c-api/init_config.rst:533 +#, fuzzy +msgid ":c:member:`write_bytecode `" +msgstr ":c:member:`PyConfig.dev_mode`" + +#: ../../c-api/init_config.rst:536 +msgid "``\"xoptions\"``" +msgstr "" + +#: ../../c-api/init_config.rst:537 +#, fuzzy +msgid ":c:member:`xoptions `" +msgstr ":c:member:`PyConfig.prefix`" + +#: ../../c-api/init_config.rst:538 ../../c-api/init_config.rst:579 +msgid "``dict[str, str]``" +msgstr "" + +#: ../../c-api/init_config.rst:540 +msgid "``\"_pystats\"``" +msgstr "" + +#: ../../c-api/init_config.rst:541 +#, fuzzy +msgid ":c:member:`_pystats `" +msgstr ":c:member:`PyConfig.isolated`" + +#: ../../c-api/init_config.rst:545 +msgid "Visibility:" +msgstr "" + +#: ../../c-api/init_config.rst:547 +msgid "" +"Public: Can by get by :c:func:`PyConfig_Get` and set " +"by :c:func:`PyConfig_Set`." +msgstr "" + +#: ../../c-api/init_config.rst:549 +msgid "" +"Read-only: Can by get by :c:func:`PyConfig_Get`, but cannot be set " +"by :c:func:`PyConfig_Set`." +msgstr "" + +#: ../../c-api/init_config.rst:554 +msgid "Runtime Python configuration API" +msgstr "" + +#: ../../c-api/init_config.rst:556 +msgid "" +"At runtime, it's possible to get and set configuration options " +"using :c:func:`PyConfig_Get` and :c:func:`PyConfig_Set` functions." +msgstr "" + +#: ../../c-api/init_config.rst:562 +msgid "" +"Some options are read from the :mod:`sys` attributes. For example, the " +"option ``\"argv\"`` is read from :data:`sys.argv`." +msgstr "" + +#: ../../c-api/init_config.rst:568 +msgid "" +"Get the current runtime value of a configuration option as a Python object." +msgstr "" + +#: ../../c-api/init_config.rst:570 ../../c-api/init_config.rst:601 +msgid "Return a new reference on success." +msgstr "" + +#: ../../c-api/init_config.rst:571 ../../c-api/init_config.rst:602 +msgid "Set an exception and return ``NULL`` on error." +msgstr "" + +#: ../../c-api/init_config.rst:573 +msgid "The object type depends on the configuration option. It can be:" +msgstr "" + +#: ../../c-api/init_config.rst:581 ../../c-api/init_config.rst:604 +#: ../../c-api/init_config.rst:619 +msgid "" +"The caller must have an :term:`attached thread state`. The function cannot " +"be called before Python initialization nor after Python finalization." +msgstr "" + +#: ../../c-api/init_config.rst:589 +msgid "Similar to :c:func:`PyConfig_Get`, but get the value as a C int." +msgstr "" + +#: ../../c-api/init_config.rst:592 +msgid "Set an exception and return ``-1`` on error." +msgstr "" + +#: ../../c-api/init_config.rst:599 +msgid "Get all configuration option names as a ``frozenset``." +msgstr "" + +#: ../../c-api/init_config.rst:612 +msgid "Set the current runtime value of a configuration option." +msgstr "" + +#: ../../c-api/init_config.rst:614 +msgid "Raise a :exc:`ValueError` if there is no option *name*." +msgstr "" + +#: ../../c-api/init_config.rst:615 +msgid "Raise a :exc:`ValueError` if *value* is an invalid value." +msgstr "" + +#: ../../c-api/init_config.rst:616 +msgid "Raise a :exc:`ValueError` if the option is read-only (cannot be set)." +msgstr "" + +#: ../../c-api/init_config.rst:617 +msgid "Raise a :exc:`TypeError` if *value* has not the proper type." +msgstr "" + +#: ../../c-api/init_config.rst:622 +msgid "" +"Raises an :ref:`auditing event ` ``cpython.PyConfig_Set`` with " +"arguments ``name``, ``value``." +msgstr "" + +#: ../../c-api/init_config.rst:630 +#, fuzzy +msgid "PyConfig C API" +msgstr "PyConfig" + +#: ../../c-api/init_config.rst:634 msgid "" -"Python can be initialized with :c:func:`Py_InitializeFromConfig` and the :c:" -"type:`PyConfig` structure. It can be preinitialized with :c:func:" -"`Py_PreInitialize` and the :c:type:`PyPreConfig` structure." +"Python can be initialized with :c:func:`Py_InitializeFromConfig` and " +"the :c:type:`PyConfig` structure. It can be preinitialized " +"with :c:func:`Py_PreInitialize` and the :c:type:`PyPreConfig` structure." msgstr "" -#: ../../c-api/init_config.rst:15 +#: ../../c-api/init_config.rst:638 msgid "There are two kinds of configuration:" msgstr "" -#: ../../c-api/init_config.rst:17 +#: ../../c-api/init_config.rst:640 msgid "" "The :ref:`Python Configuration ` can be used to build a " "customized Python which behaves as the regular Python. For example, " @@ -41,7 +1183,7 @@ msgid "" "Python." msgstr "" -#: ../../c-api/init_config.rst:22 +#: ../../c-api/init_config.rst:645 msgid "" "The :ref:`Isolated Configuration ` can be used to embed " "Python into an application. It isolates Python from the system. For example, " @@ -49,30 +1191,15 @@ msgid "" "no signal handler is registered." msgstr "" -#: ../../c-api/init_config.rst:27 -msgid "" -"The :c:func:`Py_RunMain` function can be used to write a customized Python " -"program." -msgstr "" - -#: ../../c-api/init_config.rst:30 -msgid "" -"See also :ref:`Initialization, Finalization, and Threads `." -msgstr "" - -#: ../../c-api/init_config.rst:33 +#: ../../c-api/init_config.rst:656 msgid ":pep:`587` \"Python Initialization Configuration\"." msgstr "" -#: ../../c-api/init_config.rst:37 -msgid "Example" -msgstr "範例" - -#: ../../c-api/init_config.rst:39 +#: ../../c-api/init_config.rst:662 msgid "Example of customized Python always running in isolated mode::" msgstr "" -#: ../../c-api/init_config.rst:41 +#: ../../c-api/init_config.rst:664 msgid "" "int main(int argc, char **argv)\n" "{\n" @@ -108,144 +1235,144 @@ msgid "" "}" msgstr "" -#: ../../c-api/init_config.rst:76 +#: ../../c-api/init_config.rst:699 msgid "PyWideStringList" msgstr "PyWideStringList" -#: ../../c-api/init_config.rst:80 +#: ../../c-api/init_config.rst:703 msgid "List of ``wchar_t*`` strings." msgstr "``wchar_t*`` 字串串列。" -#: ../../c-api/init_config.rst:82 +#: ../../c-api/init_config.rst:705 msgid "" "If *length* is non-zero, *items* must be non-``NULL`` and all strings must " "be non-``NULL``." msgstr "" -#: ../../c-api/init_config.rst:87 +#: ../../c-api/init_config.rst:710 msgid "Methods:" msgstr "方法:" -#: ../../c-api/init_config.rst:91 +#: ../../c-api/init_config.rst:714 msgid "Append *item* to *list*." msgstr "" -#: ../../c-api/init_config.rst:93 ../../c-api/init_config.rst:104 +#: ../../c-api/init_config.rst:716 ../../c-api/init_config.rst:727 msgid "Python must be preinitialized to call this function." msgstr "" -#: ../../c-api/init_config.rst:97 +#: ../../c-api/init_config.rst:720 msgid "Insert *item* into *list* at *index*." msgstr "" -#: ../../c-api/init_config.rst:99 +#: ../../c-api/init_config.rst:722 msgid "" "If *index* is greater than or equal to *list* length, append *item* to " "*list*." msgstr "" -#: ../../c-api/init_config.rst:102 +#: ../../c-api/init_config.rst:725 msgid "*index* must be greater than or equal to ``0``." msgstr "" -#: ../../c-api/init_config.rst:108 ../../c-api/init_config.rst:128 -#: ../../c-api/init_config.rst:235 ../../c-api/init_config.rst:554 +#: ../../c-api/init_config.rst:731 ../../c-api/init_config.rst:751 +#: ../../c-api/init_config.rst:858 ../../c-api/init_config.rst:1177 msgid "Structure fields:" msgstr "" -#: ../../c-api/init_config.rst:112 +#: ../../c-api/init_config.rst:735 msgid "List length." msgstr "串列長度。" -#: ../../c-api/init_config.rst:116 +#: ../../c-api/init_config.rst:739 msgid "List items." msgstr "" -#: ../../c-api/init_config.rst:119 +#: ../../c-api/init_config.rst:742 msgid "PyStatus" msgstr "PyStatus" -#: ../../c-api/init_config.rst:123 +#: ../../c-api/init_config.rst:746 msgid "" "Structure to store an initialization function status: success, error or exit." msgstr "" -#: ../../c-api/init_config.rst:126 +#: ../../c-api/init_config.rst:749 msgid "For an error, it can store the C function name which created the error." msgstr "" -#: ../../c-api/init_config.rst:132 +#: ../../c-api/init_config.rst:755 msgid "Exit code. Argument passed to ``exit()``." msgstr "" -#: ../../c-api/init_config.rst:136 +#: ../../c-api/init_config.rst:759 msgid "Error message." msgstr "錯誤訊息。" -#: ../../c-api/init_config.rst:140 +#: ../../c-api/init_config.rst:763 msgid "Name of the function which created an error, can be ``NULL``." msgstr "" -#: ../../c-api/init_config.rst:144 +#: ../../c-api/init_config.rst:767 msgid "Functions to create a status:" msgstr "" -#: ../../c-api/init_config.rst:148 +#: ../../c-api/init_config.rst:771 msgid "Success." msgstr "" -#: ../../c-api/init_config.rst:152 +#: ../../c-api/init_config.rst:775 msgid "Initialization error with a message." msgstr "" -#: ../../c-api/init_config.rst:154 +#: ../../c-api/init_config.rst:777 msgid "*err_msg* must not be ``NULL``." msgstr "*err_msg* 不可為 ``NULL``。" -#: ../../c-api/init_config.rst:158 +#: ../../c-api/init_config.rst:781 msgid "Memory allocation failure (out of memory)." msgstr "" -#: ../../c-api/init_config.rst:162 +#: ../../c-api/init_config.rst:785 msgid "Exit Python with the specified exit code." msgstr "" -#: ../../c-api/init_config.rst:164 +#: ../../c-api/init_config.rst:787 msgid "Functions to handle a status:" msgstr "" -#: ../../c-api/init_config.rst:168 +#: ../../c-api/init_config.rst:791 msgid "" "Is the status an error or an exit? If true, the exception must be handled; " "by calling :c:func:`Py_ExitStatusException` for example." msgstr "" -#: ../../c-api/init_config.rst:173 +#: ../../c-api/init_config.rst:796 msgid "Is the result an error?" msgstr "" -#: ../../c-api/init_config.rst:177 +#: ../../c-api/init_config.rst:800 msgid "Is the result an exit?" msgstr "" -#: ../../c-api/init_config.rst:181 +#: ../../c-api/init_config.rst:804 msgid "" "Call ``exit(exitcode)`` if *status* is an exit. Print the error message and " "exit with a non-zero exit code if *status* is an error. Must only be called " "if ``PyStatus_Exception(status)`` is non-zero." msgstr "" -#: ../../c-api/init_config.rst:186 +#: ../../c-api/init_config.rst:809 msgid "" "Internally, Python uses macros which set ``PyStatus.func``, whereas " "functions to create a status set ``func`` to ``NULL``." msgstr "" -#: ../../c-api/init_config.rst:189 +#: ../../c-api/init_config.rst:812 msgid "Example::" msgstr "範例: ::" -#: ../../c-api/init_config.rst:191 +#: ../../c-api/init_config.rst:814 msgid "" "PyStatus alloc(void **ptr, size_t size)\n" "{\n" @@ -287,317 +1414,317 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/init_config.rst:213 +#: ../../c-api/init_config.rst:836 msgid "PyPreConfig" msgstr "PyPreConfig" -#: ../../c-api/init_config.rst:217 +#: ../../c-api/init_config.rst:840 msgid "Structure used to preinitialize Python." msgstr "" -#: ../../c-api/init_config.rst:221 +#: ../../c-api/init_config.rst:844 msgid "Function to initialize a preconfiguration:" msgstr "" -#: ../../c-api/init_config.rst:225 +#: ../../c-api/init_config.rst:848 msgid "" "Initialize the preconfiguration with :ref:`Python Configuration `." msgstr "" -#: ../../c-api/init_config.rst:230 +#: ../../c-api/init_config.rst:853 msgid "" "Initialize the preconfiguration with :ref:`Isolated Configuration `." msgstr "" -#: ../../c-api/init_config.rst:239 +#: ../../c-api/init_config.rst:862 msgid "Name of the Python memory allocators:" msgstr "" -#: ../../c-api/init_config.rst:241 +#: ../../c-api/init_config.rst:864 msgid "" "``PYMEM_ALLOCATOR_NOT_SET`` (``0``): don't change memory allocators (use " "defaults)." msgstr "" -#: ../../c-api/init_config.rst:243 +#: ../../c-api/init_config.rst:866 msgid "" "``PYMEM_ALLOCATOR_DEFAULT`` (``1``): :ref:`default memory allocators " "`." msgstr "" -#: ../../c-api/init_config.rst:245 +#: ../../c-api/init_config.rst:868 msgid "" "``PYMEM_ALLOCATOR_DEBUG`` (``2``): :ref:`default memory allocators ` with :ref:`debug hooks `." msgstr "" -#: ../../c-api/init_config.rst:248 +#: ../../c-api/init_config.rst:871 msgid "``PYMEM_ALLOCATOR_MALLOC`` (``3``): use ``malloc()`` of the C library." msgstr "" -#: ../../c-api/init_config.rst:249 +#: ../../c-api/init_config.rst:872 msgid "" -"``PYMEM_ALLOCATOR_MALLOC_DEBUG`` (``4``): force usage of ``malloc()`` with :" -"ref:`debug hooks `." +"``PYMEM_ALLOCATOR_MALLOC_DEBUG`` (``4``): force usage of ``malloc()`` " +"with :ref:`debug hooks `." msgstr "" -#: ../../c-api/init_config.rst:251 +#: ../../c-api/init_config.rst:874 msgid "" "``PYMEM_ALLOCATOR_PYMALLOC`` (``5``): :ref:`Python pymalloc memory allocator " "`." msgstr "" -#: ../../c-api/init_config.rst:253 +#: ../../c-api/init_config.rst:876 msgid "" "``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` (``6``): :ref:`Python pymalloc memory " "allocator ` with :ref:`debug hooks `." msgstr "" -#: ../../c-api/init_config.rst:256 +#: ../../c-api/init_config.rst:879 msgid "" "``PYMEM_ALLOCATOR_MIMALLOC`` (``6``): use ``mimalloc``, a fast malloc " "replacement." msgstr "" -#: ../../c-api/init_config.rst:258 +#: ../../c-api/init_config.rst:881 msgid "" "``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` (``7``): use ``mimalloc``, a fast malloc " "replacement with :ref:`debug hooks `." msgstr "" -#: ../../c-api/init_config.rst:262 +#: ../../c-api/init_config.rst:885 msgid "" "``PYMEM_ALLOCATOR_PYMALLOC`` and ``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` are not " "supported if Python is :option:`configured using --without-pymalloc <--" "without-pymalloc>`." msgstr "" -#: ../../c-api/init_config.rst:266 +#: ../../c-api/init_config.rst:889 msgid "" "``PYMEM_ALLOCATOR_MIMALLOC`` and ``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` are not " "supported if Python is :option:`configured using --without-mimalloc <--" "without-mimalloc>` or if the underlying atomic support isn't available." msgstr "" -#: ../../c-api/init_config.rst:271 +#: ../../c-api/init_config.rst:894 msgid "See :ref:`Memory Management `." msgstr "請見\\ :ref:`記憶體管理 `。" -#: ../../c-api/init_config.rst:273 +#: ../../c-api/init_config.rst:896 msgid "Default: ``PYMEM_ALLOCATOR_NOT_SET``." msgstr "預設:``PYMEM_ALLOCATOR_NOT_SET``。" -#: ../../c-api/init_config.rst:277 +#: ../../c-api/init_config.rst:900 msgid "Set the LC_CTYPE locale to the user preferred locale." msgstr "" -#: ../../c-api/init_config.rst:279 +#: ../../c-api/init_config.rst:902 msgid "" -"If equals to ``0``, set :c:member:`~PyPreConfig.coerce_c_locale` and :c:" -"member:`~PyPreConfig.coerce_c_locale_warn` members to ``0``." +"If equals to ``0``, set :c:member:`~PyPreConfig.coerce_c_locale` " +"and :c:member:`~PyPreConfig.coerce_c_locale_warn` members to ``0``." msgstr "" -#: ../../c-api/init_config.rst:282 ../../c-api/init_config.rst:293 +#: ../../c-api/init_config.rst:905 ../../c-api/init_config.rst:916 msgid "See the :term:`locale encoding`." msgstr "請見 :term:`locale encoding`。" -#: ../../c-api/init_config.rst:284 ../../c-api/init_config.rst:339 -#: ../../c-api/init_config.rst:710 +#: ../../c-api/init_config.rst:907 ../../c-api/init_config.rst:962 +#: ../../c-api/init_config.rst:1333 msgid "Default: ``1`` in Python config, ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:288 +#: ../../c-api/init_config.rst:911 msgid "If equals to ``2``, coerce the C locale." msgstr "" -#: ../../c-api/init_config.rst:290 +#: ../../c-api/init_config.rst:913 msgid "" "If equals to ``1``, read the LC_CTYPE locale to decide if it should be " "coerced." msgstr "" -#: ../../c-api/init_config.rst:295 ../../c-api/init_config.rst:301 +#: ../../c-api/init_config.rst:918 ../../c-api/init_config.rst:924 msgid "Default: ``-1`` in Python config, ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:299 +#: ../../c-api/init_config.rst:922 msgid "If non-zero, emit a warning if the C locale is coerced." msgstr "" -#: ../../c-api/init_config.rst:305 +#: ../../c-api/init_config.rst:928 msgid "" ":ref:`Python Development Mode `: see :c:member:`PyConfig.dev_mode`." msgstr "" -#: ../../c-api/init_config.rst:308 ../../c-api/init_config.rst:719 -#: ../../c-api/init_config.rst:765 ../../c-api/init_config.rst:1244 +#: ../../c-api/init_config.rst:931 ../../c-api/init_config.rst:1342 +#: ../../c-api/init_config.rst:1398 ../../c-api/init_config.rst:1892 msgid "Default: ``-1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:312 +#: ../../c-api/init_config.rst:935 msgid "Isolated mode: see :c:member:`PyConfig.isolated`." msgstr "" -#: ../../c-api/init_config.rst:314 ../../c-api/init_config.rst:921 +#: ../../c-api/init_config.rst:937 ../../c-api/init_config.rst:1569 msgid "Default: ``0`` in Python mode, ``1`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:318 +#: ../../c-api/init_config.rst:941 msgid "If non-zero:" msgstr "如果不為 0:" -#: ../../c-api/init_config.rst:320 +#: ../../c-api/init_config.rst:943 msgid "Set :c:member:`PyPreConfig.utf8_mode` to ``0``," msgstr "將 :c:member:`PyPreConfig.utf8_mode` 設為 ``0``、" -#: ../../c-api/init_config.rst:321 +#: ../../c-api/init_config.rst:944 msgid "Set :c:member:`PyConfig.filesystem_encoding` to ``\"mbcs\"``," msgstr "將 :c:member:`PyConfig.filesystem_encoding` 設為 ``\"mbcs\"``、" -#: ../../c-api/init_config.rst:322 +#: ../../c-api/init_config.rst:945 msgid "Set :c:member:`PyConfig.filesystem_errors` to ``\"replace\"``." msgstr "將 :c:member:`PyConfig.filesystem_errors` 設為 ``\"replace\"``。" -#: ../../c-api/init_config.rst:324 +#: ../../c-api/init_config.rst:947 msgid "" "Initialized from the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment " "variable value." msgstr "" -#: ../../c-api/init_config.rst:327 ../../c-api/init_config.rst:935 +#: ../../c-api/init_config.rst:950 ../../c-api/init_config.rst:1583 msgid "" "Only available on Windows. ``#ifdef MS_WINDOWS`` macro can be used for " "Windows specific code." msgstr "" -#: ../../c-api/init_config.rst:330 ../../c-api/init_config.rst:658 -#: ../../c-api/init_config.rst:665 ../../c-api/init_config.rst:732 -#: ../../c-api/init_config.rst:843 ../../c-api/init_config.rst:857 -#: ../../c-api/init_config.rst:871 ../../c-api/init_config.rst:938 -#: ../../c-api/init_config.rst:952 ../../c-api/init_config.rst:1012 -#: ../../c-api/init_config.rst:1064 ../../c-api/init_config.rst:1126 -#: ../../c-api/init_config.rst:1180 ../../c-api/init_config.rst:1209 -#: ../../c-api/init_config.rst:1298 +#: ../../c-api/init_config.rst:953 ../../c-api/init_config.rst:1281 +#: ../../c-api/init_config.rst:1288 ../../c-api/init_config.rst:1355 +#: ../../c-api/init_config.rst:1487 ../../c-api/init_config.rst:1505 +#: ../../c-api/init_config.rst:1519 ../../c-api/init_config.rst:1586 +#: ../../c-api/init_config.rst:1600 ../../c-api/init_config.rst:1660 +#: ../../c-api/init_config.rst:1712 ../../c-api/init_config.rst:1774 +#: ../../c-api/init_config.rst:1828 ../../c-api/init_config.rst:1857 +#: ../../c-api/init_config.rst:1971 ../../c-api/init_config.rst:2018 msgid "Default: ``0``." msgstr "預設:``0``。" -#: ../../c-api/init_config.rst:334 +#: ../../c-api/init_config.rst:957 msgid "" -"If non-zero, :c:func:`Py_PreInitializeFromArgs` and :c:func:" -"`Py_PreInitializeFromBytesArgs` parse their ``argv`` argument the same way " -"the regular Python parses command line arguments: see :ref:`Command Line " -"Arguments `." +"If non-zero, :c:func:`Py_PreInitializeFromArgs` " +"and :c:func:`Py_PreInitializeFromBytesArgs` parse their ``argv`` argument " +"the same way the regular Python parses command line arguments: " +"see :ref:`Command Line Arguments `." msgstr "" -#: ../../c-api/init_config.rst:343 +#: ../../c-api/init_config.rst:966 msgid "" -"Use :ref:`environment variables `? See :c:member:`PyConfig." -"use_environment`." +"Use :ref:`environment variables `? " +"See :c:member:`PyConfig.use_environment`." msgstr "" -#: ../../c-api/init_config.rst:346 ../../c-api/init_config.rst:1272 +#: ../../c-api/init_config.rst:969 ../../c-api/init_config.rst:1933 msgid "Default: ``1`` in Python config and ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:350 +#: ../../c-api/init_config.rst:973 msgid "If non-zero, enable the :ref:`Python UTF-8 Mode `." msgstr "" -#: ../../c-api/init_config.rst:352 +#: ../../c-api/init_config.rst:975 msgid "" "Set to ``0`` or ``1`` by the :option:`-X utf8 <-X>` command line option and " "the :envvar:`PYTHONUTF8` environment variable." msgstr "" -#: ../../c-api/init_config.rst:355 +#: ../../c-api/init_config.rst:978 msgid "Also set to ``1`` if the ``LC_CTYPE`` locale is ``C`` or ``POSIX``." msgstr "" -#: ../../c-api/init_config.rst:357 +#: ../../c-api/init_config.rst:980 msgid "Default: ``-1`` in Python config and ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:363 +#: ../../c-api/init_config.rst:986 msgid "Preinitialize Python with PyPreConfig" msgstr "" -#: ../../c-api/init_config.rst:365 +#: ../../c-api/init_config.rst:988 msgid "The preinitialization of Python:" msgstr "" -#: ../../c-api/init_config.rst:367 +#: ../../c-api/init_config.rst:990 msgid "Set the Python memory allocators (:c:member:`PyPreConfig.allocator`)" msgstr "" -#: ../../c-api/init_config.rst:368 +#: ../../c-api/init_config.rst:991 msgid "Configure the LC_CTYPE locale (:term:`locale encoding`)" msgstr "" -#: ../../c-api/init_config.rst:369 +#: ../../c-api/init_config.rst:992 msgid "" -"Set the :ref:`Python UTF-8 Mode ` (:c:member:`PyPreConfig." -"utf8_mode`)" +"Set the :ref:`Python UTF-8 Mode ` " +"(:c:member:`PyPreConfig.utf8_mode`)" msgstr "" -#: ../../c-api/init_config.rst:372 +#: ../../c-api/init_config.rst:995 msgid "" "The current preconfiguration (``PyPreConfig`` type) is stored in " "``_PyRuntime.preconfig``." msgstr "" -#: ../../c-api/init_config.rst:375 +#: ../../c-api/init_config.rst:998 msgid "Functions to preinitialize Python:" msgstr "" -#: ../../c-api/init_config.rst:379 ../../c-api/init_config.rst:385 -#: ../../c-api/init_config.rst:394 +#: ../../c-api/init_config.rst:1002 ../../c-api/init_config.rst:1008 +#: ../../c-api/init_config.rst:1017 msgid "Preinitialize Python from *preconfig* preconfiguration." msgstr "" -#: ../../c-api/init_config.rst:381 ../../c-api/init_config.rst:390 -#: ../../c-api/init_config.rst:399 +#: ../../c-api/init_config.rst:1004 ../../c-api/init_config.rst:1013 +#: ../../c-api/init_config.rst:1022 msgid "*preconfig* must not be ``NULL``." msgstr "*preconfig* 不可為 ``NULL``。" -#: ../../c-api/init_config.rst:387 +#: ../../c-api/init_config.rst:1010 msgid "" -"Parse *argv* command line arguments (bytes strings) if :c:member:" -"`~PyPreConfig.parse_argv` of *preconfig* is non-zero." +"Parse *argv* command line arguments (bytes strings) " +"if :c:member:`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: ../../c-api/init_config.rst:396 +#: ../../c-api/init_config.rst:1019 msgid "" -"Parse *argv* command line arguments (wide strings) if :c:member:" -"`~PyPreConfig.parse_argv` of *preconfig* is non-zero." +"Parse *argv* command line arguments (wide strings) " +"if :c:member:`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: ../../c-api/init_config.rst:401 ../../c-api/init_config.rst:1359 +#: ../../c-api/init_config.rst:1024 ../../c-api/init_config.rst:2041 msgid "" -"The caller is responsible to handle exceptions (error or exit) using :c:func:" -"`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." +"The caller is responsible to handle exceptions (error or exit) " +"using :c:func:`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." msgstr "" -#: ../../c-api/init_config.rst:404 +#: ../../c-api/init_config.rst:1027 msgid "" -"For :ref:`Python Configuration ` (:c:func:" -"`PyPreConfig_InitPythonConfig`), if Python is initialized with command line " -"arguments, the command line arguments must also be passed to preinitialize " -"Python, since they have an effect on the pre-configuration like encodings. " -"For example, the :option:`-X utf8 <-X>` command line option enables the :ref:" -"`Python UTF-8 Mode `." +"For :ref:`Python Configuration ` " +"(:c:func:`PyPreConfig_InitPythonConfig`), if Python is initialized with " +"command line arguments, the command line arguments must also be passed to " +"preinitialize Python, since they have an effect on the pre-configuration " +"like encodings. For example, the :option:`-X utf8 <-X>` command line option " +"enables the :ref:`Python UTF-8 Mode `." msgstr "" -#: ../../c-api/init_config.rst:411 +#: ../../c-api/init_config.rst:1034 msgid "" "``PyMem_SetAllocator()`` can be called after :c:func:`Py_PreInitialize` and " "before :c:func:`Py_InitializeFromConfig` to install a custom memory " -"allocator. It can be called before :c:func:`Py_PreInitialize` if :c:member:" -"`PyPreConfig.allocator` is set to ``PYMEM_ALLOCATOR_NOT_SET``." +"allocator. It can be called before :c:func:`Py_PreInitialize` " +"if :c:member:`PyPreConfig.allocator` is set to ``PYMEM_ALLOCATOR_NOT_SET``." msgstr "" -#: ../../c-api/init_config.rst:416 +#: ../../c-api/init_config.rst:1039 msgid "" "Python memory allocation functions like :c:func:`PyMem_RawMalloc` must not " "be used before the Python preinitialization, whereas calling directly " @@ -605,13 +1732,13 @@ msgid "" "not be called before the Python preinitialization." msgstr "" -#: ../../c-api/init_config.rst:421 +#: ../../c-api/init_config.rst:1044 msgid "" "Example using the preinitialization to enable the :ref:`Python UTF-8 Mode " "`::" msgstr "" -#: ../../c-api/init_config.rst:424 +#: ../../c-api/init_config.rst:1047 msgid "" "PyStatus status;\n" "PyPreConfig preconfig;\n" @@ -631,572 +1758,608 @@ msgid "" "Py_Finalize();" msgstr "" -#: ../../c-api/init_config.rst:443 +#: ../../c-api/init_config.rst:1066 msgid "PyConfig" msgstr "PyConfig" -#: ../../c-api/init_config.rst:447 +#: ../../c-api/init_config.rst:1070 msgid "Structure containing most parameters to configure Python." msgstr "" -#: ../../c-api/init_config.rst:449 +#: ../../c-api/init_config.rst:1072 msgid "" "When done, the :c:func:`PyConfig_Clear` function must be used to release the " "configuration memory." msgstr "" -#: ../../c-api/init_config.rst:454 +#: ../../c-api/init_config.rst:1077 msgid "Structure methods:" msgstr "" -#: ../../c-api/init_config.rst:458 +#: ../../c-api/init_config.rst:1081 msgid "" "Initialize configuration with the :ref:`Python Configuration `." msgstr "" -#: ../../c-api/init_config.rst:463 +#: ../../c-api/init_config.rst:1086 msgid "" "Initialize configuration with the :ref:`Isolated Configuration `." msgstr "" -#: ../../c-api/init_config.rst:468 +#: ../../c-api/init_config.rst:1091 msgid "Copy the wide character string *str* into ``*config_str``." msgstr "" -#: ../../c-api/init_config.rst:470 ../../c-api/init_config.rst:477 -#: ../../c-api/init_config.rst:484 ../../c-api/init_config.rst:492 -#: ../../c-api/init_config.rst:498 ../../c-api/init_config.rst:515 +#: ../../c-api/init_config.rst:1093 ../../c-api/init_config.rst:1100 +#: ../../c-api/init_config.rst:1107 ../../c-api/init_config.rst:1115 +#: ../../c-api/init_config.rst:1121 ../../c-api/init_config.rst:1138 msgid ":ref:`Preinitialize Python ` if needed." msgstr "" -#: ../../c-api/init_config.rst:474 +#: ../../c-api/init_config.rst:1097 msgid "" "Decode *str* using :c:func:`Py_DecodeLocale` and set the result into " "``*config_str``." msgstr "" -#: ../../c-api/init_config.rst:481 +#: ../../c-api/init_config.rst:1104 msgid "" "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " "from the *argv* list of wide character strings." msgstr "" -#: ../../c-api/init_config.rst:488 +#: ../../c-api/init_config.rst:1111 msgid "" "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " -"from the *argv* list of bytes strings. Decode bytes using :c:func:" -"`Py_DecodeLocale`." +"from the *argv* list of bytes strings. Decode bytes " +"using :c:func:`Py_DecodeLocale`." msgstr "" -#: ../../c-api/init_config.rst:496 +#: ../../c-api/init_config.rst:1119 msgid "Set the list of wide strings *list* to *length* and *items*." msgstr "" -#: ../../c-api/init_config.rst:502 +#: ../../c-api/init_config.rst:1125 msgid "Read all Python configuration." msgstr "" -#: ../../c-api/init_config.rst:504 +#: ../../c-api/init_config.rst:1127 msgid "Fields which are already initialized are left unchanged." msgstr "" -#: ../../c-api/init_config.rst:506 +#: ../../c-api/init_config.rst:1129 msgid "" "Fields for :ref:`path configuration ` are no longer " "calculated or modified when calling this function, as of Python 3.11." msgstr "" -#: ../../c-api/init_config.rst:509 ../../c-api/init_config.rst:1041 +#: ../../c-api/init_config.rst:1132 ../../c-api/init_config.rst:1689 msgid "" "The :c:func:`PyConfig_Read` function only parses :c:member:`PyConfig.argv` " "arguments once: :c:member:`PyConfig.parse_argv` is set to ``2`` after " -"arguments are parsed. Since Python arguments are stripped from :c:member:" -"`PyConfig.argv`, parsing arguments twice would parse the application options " -"as Python options." +"arguments are parsed. Since Python arguments are stripped " +"from :c:member:`PyConfig.argv`, parsing arguments twice would parse the " +"application options as Python options." msgstr "" -#: ../../c-api/init_config.rst:517 +#: ../../c-api/init_config.rst:1140 msgid "" -"The :c:member:`PyConfig.argv` arguments are now only parsed once, :c:member:" -"`PyConfig.parse_argv` is set to ``2`` after arguments are parsed, and " -"arguments are only parsed if :c:member:`PyConfig.parse_argv` equals ``1``." +"The :c:member:`PyConfig.argv` arguments are now only parsed " +"once, :c:member:`PyConfig.parse_argv` is set to ``2`` after arguments are " +"parsed, and arguments are only parsed if :c:member:`PyConfig.parse_argv` " +"equals ``1``." msgstr "" -#: ../../c-api/init_config.rst:523 +#: ../../c-api/init_config.rst:1146 msgid "" ":c:func:`PyConfig_Read` no longer calculates all paths, and so fields listed " "under :ref:`Python Path Configuration ` may no longer be " "updated until :c:func:`Py_InitializeFromConfig` is called." msgstr "" -#: ../../c-api/init_config.rst:531 +#: ../../c-api/init_config.rst:1154 msgid "Release configuration memory." msgstr "" -#: ../../c-api/init_config.rst:533 +#: ../../c-api/init_config.rst:1156 msgid "" "Most ``PyConfig`` methods :ref:`preinitialize Python ` if needed. " -"In that case, the Python preinitialization configuration (:c:type:" -"`PyPreConfig`) in based on the :c:type:`PyConfig`. If configuration fields " -"which are in common with :c:type:`PyPreConfig` are tuned, they must be set " -"before calling a :c:type:`PyConfig` method:" +"In that case, the Python preinitialization configuration " +"(:c:type:`PyPreConfig`) in based on the :c:type:`PyConfig`. If configuration " +"fields which are in common with :c:type:`PyPreConfig` are tuned, they must " +"be set before calling a :c:type:`PyConfig` method:" msgstr "" -#: ../../c-api/init_config.rst:539 +#: ../../c-api/init_config.rst:1162 msgid ":c:member:`PyConfig.dev_mode`" msgstr ":c:member:`PyConfig.dev_mode`" -#: ../../c-api/init_config.rst:540 +#: ../../c-api/init_config.rst:1163 msgid ":c:member:`PyConfig.isolated`" msgstr ":c:member:`PyConfig.isolated`" -#: ../../c-api/init_config.rst:541 +#: ../../c-api/init_config.rst:1164 msgid ":c:member:`PyConfig.parse_argv`" msgstr ":c:member:`PyConfig.parse_argv`" -#: ../../c-api/init_config.rst:542 +#: ../../c-api/init_config.rst:1165 msgid ":c:member:`PyConfig.use_environment`" msgstr ":c:member:`PyConfig.use_environment`" -#: ../../c-api/init_config.rst:544 +#: ../../c-api/init_config.rst:1167 msgid "" "Moreover, if :c:func:`PyConfig_SetArgv` or :c:func:`PyConfig_SetBytesArgv` " "is used, this method must be called before other methods, since the " -"preinitialization configuration depends on command line arguments (if :c:" -"member:`~PyConfig.parse_argv` is non-zero)." +"preinitialization configuration depends on command line arguments " +"(if :c:member:`~PyConfig.parse_argv` is non-zero)." msgstr "" -#: ../../c-api/init_config.rst:549 +#: ../../c-api/init_config.rst:1172 msgid "" "The caller of these methods is responsible to handle exceptions (error or " "exit) using ``PyStatus_Exception()`` and ``Py_ExitStatusException()``." msgstr "" -#: ../../c-api/init_config.rst:562 +#: ../../c-api/init_config.rst:1185 msgid "" -"Set :data:`sys.argv` command line arguments based on :c:member:`~PyConfig." -"argv`. These parameters are similar to those passed to the program's :c:" -"func:`main` function with the difference that the first entry should refer " -"to the script file to be executed rather than the executable hosting the " -"Python interpreter. If there isn't a script that will be run, the first " -"entry in :c:member:`~PyConfig.argv` can be an empty string." +"Set :data:`sys.argv` command line arguments based " +"on :c:member:`~PyConfig.argv`. These parameters are similar to those passed " +"to the program's :c:func:`main` function with the difference that the first " +"entry should refer to the script file to be executed rather than the " +"executable hosting the Python interpreter. If there isn't a script that " +"will be run, the first entry in :c:member:`~PyConfig.argv` can be an empty " +"string." msgstr "" -#: ../../c-api/init_config.rst:570 +#: ../../c-api/init_config.rst:1193 msgid "" -"Set :c:member:`~PyConfig.parse_argv` to ``1`` to parse :c:member:`~PyConfig." -"argv` the same way the regular Python parses Python command line arguments " -"and then to strip Python arguments from :c:member:`~PyConfig.argv`." +"Set :c:member:`~PyConfig.parse_argv` to ``1`` to " +"parse :c:member:`~PyConfig.argv` the same way the regular Python parses " +"Python command line arguments and then to strip Python arguments " +"from :c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:575 +#: ../../c-api/init_config.rst:1198 msgid "" "If :c:member:`~PyConfig.argv` is empty, an empty string is added to ensure " "that :data:`sys.argv` always exists and is never empty." msgstr "" -#: ../../c-api/init_config.rst:578 ../../c-api/init_config.rst:605 -#: ../../c-api/init_config.rst:619 ../../c-api/init_config.rst:629 -#: ../../c-api/init_config.rst:739 ../../c-api/init_config.rst:750 -#: ../../c-api/init_config.rst:832 ../../c-api/init_config.rst:982 -#: ../../c-api/init_config.rst:1083 ../../c-api/init_config.rst:1102 -#: ../../c-api/init_config.rst:1117 ../../c-api/init_config.rst:1134 -#: ../../c-api/init_config.rst:1147 ../../c-api/init_config.rst:1155 -#: ../../c-api/init_config.rst:1169 +#: ../../c-api/init_config.rst:1201 ../../c-api/init_config.rst:1228 +#: ../../c-api/init_config.rst:1242 ../../c-api/init_config.rst:1252 +#: ../../c-api/init_config.rst:1363 ../../c-api/init_config.rst:1372 +#: ../../c-api/init_config.rst:1383 ../../c-api/init_config.rst:1474 +#: ../../c-api/init_config.rst:1630 ../../c-api/init_config.rst:1731 +#: ../../c-api/init_config.rst:1750 ../../c-api/init_config.rst:1765 +#: ../../c-api/init_config.rst:1782 ../../c-api/init_config.rst:1795 +#: ../../c-api/init_config.rst:1803 ../../c-api/init_config.rst:1817 +#: ../../c-api/init_config.rst:1920 msgid "Default: ``NULL``." msgstr "預設值:``NULL``。" -#: ../../c-api/init_config.rst:580 +#: ../../c-api/init_config.rst:1203 msgid "See also the :c:member:`~PyConfig.orig_argv` member." msgstr "另請參閱 :c:member:`~PyConfig.orig_argv` 成員。" -#: ../../c-api/init_config.rst:584 +#: ../../c-api/init_config.rst:1207 msgid "" -"If equals to zero, ``Py_RunMain()`` prepends a potentially unsafe path to :" -"data:`sys.path` at startup:" +"If equals to zero, ``Py_RunMain()`` prepends a potentially unsafe path " +"to :data:`sys.path` at startup:" msgstr "" -#: ../../c-api/init_config.rst:587 +#: ../../c-api/init_config.rst:1210 msgid "" "If :c:member:`argv[0] ` is equal to ``L\"-m\"`` (``python -m " "module``), prepend the current working directory." msgstr "" -#: ../../c-api/init_config.rst:589 +#: ../../c-api/init_config.rst:1212 msgid "" "If running a script (``python script.py``), prepend the script's directory. " "If it's a symbolic link, resolve symbolic links." msgstr "" -#: ../../c-api/init_config.rst:591 +#: ../../c-api/init_config.rst:1214 msgid "" "Otherwise (``python -c code`` and ``python``), prepend an empty string, " "which means the current working directory." msgstr "" -#: ../../c-api/init_config.rst:594 +#: ../../c-api/init_config.rst:1217 msgid "" -"Set to ``1`` by the :option:`-P` command line option and the :envvar:" -"`PYTHONSAFEPATH` environment variable." +"Set to ``1`` by the :option:`-P` command line option and " +"the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" -#: ../../c-api/init_config.rst:597 +#: ../../c-api/init_config.rst:1220 msgid "Default: ``0`` in Python config, ``1`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:603 +#: ../../c-api/init_config.rst:1226 msgid ":data:`sys.base_exec_prefix`." msgstr ":data:`sys.base_exec_prefix`。" -#: ../../c-api/init_config.rst:607 ../../c-api/init_config.rst:621 -#: ../../c-api/init_config.rst:631 ../../c-api/init_config.rst:741 -#: ../../c-api/init_config.rst:752 ../../c-api/init_config.rst:999 -#: ../../c-api/init_config.rst:1085 +#: ../../c-api/init_config.rst:1230 ../../c-api/init_config.rst:1244 +#: ../../c-api/init_config.rst:1254 ../../c-api/init_config.rst:1374 +#: ../../c-api/init_config.rst:1385 ../../c-api/init_config.rst:1647 +#: ../../c-api/init_config.rst:1733 msgid "Part of the :ref:`Python Path Configuration ` output." msgstr "" -#: ../../c-api/init_config.rst:609 +#: ../../c-api/init_config.rst:1232 msgid "See also :c:member:`PyConfig.exec_prefix`." msgstr "也請見 :c:member:`PyConfig.exec_prefix`" -#: ../../c-api/init_config.rst:613 +#: ../../c-api/init_config.rst:1236 msgid "Python base executable: :data:`sys._base_executable`." msgstr "" -#: ../../c-api/init_config.rst:615 +#: ../../c-api/init_config.rst:1238 msgid "Set by the :envvar:`__PYVENV_LAUNCHER__` environment variable." msgstr "" -#: ../../c-api/init_config.rst:617 +#: ../../c-api/init_config.rst:1240 msgid "Set from :c:member:`PyConfig.executable` if ``NULL``." msgstr "" -#: ../../c-api/init_config.rst:623 +#: ../../c-api/init_config.rst:1246 msgid "See also :c:member:`PyConfig.executable`." msgstr "也請見 :c:member:`PyConfig.executable`" -#: ../../c-api/init_config.rst:627 +#: ../../c-api/init_config.rst:1250 msgid ":data:`sys.base_prefix`." msgstr ":data:`sys.base_prefix`。" -#: ../../c-api/init_config.rst:633 +#: ../../c-api/init_config.rst:1256 msgid "See also :c:member:`PyConfig.prefix`." msgstr "也請見 :c:member:`PyConfig.prefix`" -#: ../../c-api/init_config.rst:637 +#: ../../c-api/init_config.rst:1260 msgid "" "If equals to ``0`` and :c:member:`~PyConfig.configure_c_stdio` is non-zero, " "disable buffering on the C streams stdout and stderr." msgstr "" -#: ../../c-api/init_config.rst:640 +#: ../../c-api/init_config.rst:1263 msgid "" -"Set to ``0`` by the :option:`-u` command line option and the :envvar:" -"`PYTHONUNBUFFERED` environment variable." +"Set to ``0`` by the :option:`-u` command line option and " +"the :envvar:`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../c-api/init_config.rst:643 +#: ../../c-api/init_config.rst:1266 msgid "stdin is always opened in buffered mode." msgstr "" -#: ../../c-api/init_config.rst:645 ../../c-api/init_config.rst:678 -#: ../../c-api/init_config.rst:1197 ../../c-api/init_config.rst:1330 +#: ../../c-api/init_config.rst:1268 ../../c-api/init_config.rst:1301 +#: ../../c-api/init_config.rst:1845 ../../c-api/init_config.rst:2003 msgid "Default: ``1``." msgstr "預設值:``1``。" -#: ../../c-api/init_config.rst:649 +#: ../../c-api/init_config.rst:1272 msgid "" -"If equals to ``1``, issue a warning when comparing :class:`bytes` or :class:" -"`bytearray` with :class:`str`, or comparing :class:`bytes` with :class:`int`." +"If equals to ``1``, issue a warning when comparing :class:`bytes` " +"or :class:`bytearray` with :class:`str`, or comparing :class:`bytes` " +"with :class:`int`." msgstr "" -#: ../../c-api/init_config.rst:653 +#: ../../c-api/init_config.rst:1276 msgid "" "If equal or greater to ``2``, raise a :exc:`BytesWarning` exception in these " "cases." msgstr "" -#: ../../c-api/init_config.rst:656 +#: ../../c-api/init_config.rst:1279 msgid "Incremented by the :option:`-b` command line option." msgstr "" -#: ../../c-api/init_config.rst:662 +#: ../../c-api/init_config.rst:1285 msgid "" -"If non-zero, emit a :exc:`EncodingWarning` warning when :class:`io." -"TextIOWrapper` uses its default encoding. See :ref:`io-encoding-warning` for " -"details." +"If non-zero, emit a :exc:`EncodingWarning` warning " +"when :class:`io.TextIOWrapper` uses its default encoding. See :ref:`io-" +"encoding-warning` for details." msgstr "" -#: ../../c-api/init_config.rst:671 +#: ../../c-api/init_config.rst:1294 msgid "" "If equals to ``0``, disables the inclusion of the end line and column " "mappings in code objects. Also disables traceback printing carets to " "specific error locations." msgstr "" -#: ../../c-api/init_config.rst:675 +#: ../../c-api/init_config.rst:1298 msgid "" "Set to ``0`` by the :envvar:`PYTHONNODEBUGRANGES` environment variable and " "by the :option:`-X no_debug_ranges <-X>` command line option." msgstr "" -#: ../../c-api/init_config.rst:684 +#: ../../c-api/init_config.rst:1307 msgid "" -"Control the validation behavior of hash-based ``.pyc`` files: value of the :" -"option:`--check-hash-based-pycs` command line option." +"Control the validation behavior of hash-based ``.pyc`` files: value of " +"the :option:`--check-hash-based-pycs` command line option." msgstr "" -#: ../../c-api/init_config.rst:687 +#: ../../c-api/init_config.rst:1310 msgid "Valid values:" msgstr "" -#: ../../c-api/init_config.rst:689 +#: ../../c-api/init_config.rst:1312 msgid "" "``L\"always\"``: Hash the source file for invalidation regardless of value " "of the 'check_source' flag." msgstr "" -#: ../../c-api/init_config.rst:691 +#: ../../c-api/init_config.rst:1314 msgid "``L\"never\"``: Assume that hash-based pycs always are valid." msgstr "" -#: ../../c-api/init_config.rst:692 +#: ../../c-api/init_config.rst:1315 msgid "" "``L\"default\"``: The 'check_source' flag in hash-based pycs determines " "invalidation." msgstr "" -#: ../../c-api/init_config.rst:695 +#: ../../c-api/init_config.rst:1318 msgid "Default: ``L\"default\"``." msgstr "預設:``L\"default\"``。" -#: ../../c-api/init_config.rst:697 +#: ../../c-api/init_config.rst:1320 msgid "See also :pep:`552` \"Deterministic pycs\"." msgstr "" -#: ../../c-api/init_config.rst:701 +#: ../../c-api/init_config.rst:1324 msgid "If non-zero, configure C standard streams:" msgstr "" -#: ../../c-api/init_config.rst:703 +#: ../../c-api/init_config.rst:1326 msgid "" "On Windows, set the binary mode (``O_BINARY``) on stdin, stdout and stderr." msgstr "" -#: ../../c-api/init_config.rst:705 +#: ../../c-api/init_config.rst:1328 msgid "" "If :c:member:`~PyConfig.buffered_stdio` equals zero, disable buffering of " "stdin, stdout and stderr streams." msgstr "" -#: ../../c-api/init_config.rst:707 +#: ../../c-api/init_config.rst:1330 msgid "" "If :c:member:`~PyConfig.interactive` is non-zero, enable stream buffering on " "stdin and stdout (only stdout on Windows)." msgstr "" -#: ../../c-api/init_config.rst:714 +#: ../../c-api/init_config.rst:1337 msgid "If non-zero, enable the :ref:`Python Development Mode `." msgstr "" -#: ../../c-api/init_config.rst:716 +#: ../../c-api/init_config.rst:1339 msgid "" -"Set to ``1`` by the :option:`-X dev <-X>` option and the :envvar:" -"`PYTHONDEVMODE` environment variable." +"Set to ``1`` by the :option:`-X dev <-X>` option and " +"the :envvar:`PYTHONDEVMODE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:723 +#: ../../c-api/init_config.rst:1346 msgid "Dump Python references?" msgstr "" -#: ../../c-api/init_config.rst:725 +#: ../../c-api/init_config.rst:1348 msgid "If non-zero, dump all objects which are still alive at exit." msgstr "" -#: ../../c-api/init_config.rst:727 +#: ../../c-api/init_config.rst:1350 msgid "Set to ``1`` by the :envvar:`PYTHONDUMPREFS` environment variable." msgstr "" -#: ../../c-api/init_config.rst:729 +#: ../../c-api/init_config.rst:1352 msgid "" "Needs a special build of Python with the ``Py_TRACE_REFS`` macro defined: " "see the :option:`configure --with-trace-refs option <--with-trace-refs>`." msgstr "" -#: ../../c-api/init_config.rst:736 +#: ../../c-api/init_config.rst:1359 +msgid "Filename where to dump Python references." +msgstr "" + +#: ../../c-api/init_config.rst:1361 +#, fuzzy +msgid "Set by the :envvar:`PYTHONDUMPREFSFILE` environment variable." +msgstr "由 :envvar:`PYTHONHOME` 環境變數設定。" + +#: ../../c-api/init_config.rst:1369 msgid "" "The site-specific directory prefix where the platform-dependent Python files " "are installed: :data:`sys.exec_prefix`." msgstr "" -#: ../../c-api/init_config.rst:743 +#: ../../c-api/init_config.rst:1376 msgid "See also :c:member:`PyConfig.base_exec_prefix`." msgstr "也請見 :c:member:`PyConfig.base_exec_prefix`" -#: ../../c-api/init_config.rst:747 +#: ../../c-api/init_config.rst:1380 msgid "" -"The absolute path of the executable binary for the Python interpreter: :data:" -"`sys.executable`." +"The absolute path of the executable binary for the Python " +"interpreter: :data:`sys.executable`." msgstr "" -#: ../../c-api/init_config.rst:754 +#: ../../c-api/init_config.rst:1387 msgid "See also :c:member:`PyConfig.base_executable`." msgstr "也請見 :c:member:`PyConfig.base_executable`" -#: ../../c-api/init_config.rst:758 +#: ../../c-api/init_config.rst:1391 msgid "Enable faulthandler?" msgstr "" -#: ../../c-api/init_config.rst:760 +#: ../../c-api/init_config.rst:1393 msgid "If non-zero, call :func:`faulthandler.enable` at startup." msgstr "" -#: ../../c-api/init_config.rst:762 +#: ../../c-api/init_config.rst:1395 msgid "" -"Set to ``1`` by :option:`-X faulthandler <-X>` and the :envvar:" -"`PYTHONFAULTHANDLER` environment variable." +"Set to ``1`` by :option:`-X faulthandler <-X>` and " +"the :envvar:`PYTHONFAULTHANDLER` environment variable." msgstr "" -#: ../../c-api/init_config.rst:769 +#: ../../c-api/init_config.rst:1402 msgid "" -":term:`Filesystem encoding `: :func:" -"`sys.getfilesystemencoding`." +":term:`Filesystem encoding `: :func:`sys.getfilesystemencoding`." msgstr "" -#: ../../c-api/init_config.rst:772 +#: ../../c-api/init_config.rst:1405 msgid "On macOS, Android and VxWorks: use ``\"utf-8\"`` by default." msgstr "" -#: ../../c-api/init_config.rst:774 +#: ../../c-api/init_config.rst:1407 msgid "" -"On Windows: use ``\"utf-8\"`` by default, or ``\"mbcs\"`` if :c:member:" -"`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is non-" -"zero." +"On Windows: use ``\"utf-8\"`` by default, or ``\"mbcs\"`` " +"if :c:member:`~PyPreConfig.legacy_windows_fs_encoding` " +"of :c:type:`PyPreConfig` is non-zero." msgstr "" -#: ../../c-api/init_config.rst:778 +#: ../../c-api/init_config.rst:1411 msgid "Default encoding on other platforms:" msgstr "" -#: ../../c-api/init_config.rst:780 +#: ../../c-api/init_config.rst:1413 msgid "``\"utf-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." msgstr "" -#: ../../c-api/init_config.rst:781 +#: ../../c-api/init_config.rst:1414 msgid "" "``\"ascii\"`` if Python detects that ``nl_langinfo(CODESET)`` announces the " "ASCII encoding, whereas the ``mbstowcs()`` function decodes from a different " "encoding (usually Latin1)." msgstr "" -#: ../../c-api/init_config.rst:784 +#: ../../c-api/init_config.rst:1417 msgid "``\"utf-8\"`` if ``nl_langinfo(CODESET)`` returns an empty string." msgstr "" -#: ../../c-api/init_config.rst:785 +#: ../../c-api/init_config.rst:1418 msgid "" "Otherwise, use the :term:`locale encoding`: ``nl_langinfo(CODESET)`` result." msgstr "" -#: ../../c-api/init_config.rst:788 +#: ../../c-api/init_config.rst:1421 msgid "" "At Python startup, the encoding name is normalized to the Python codec name. " "For example, ``\"ANSI_X3.4-1968\"`` is replaced with ``\"ascii\"``." msgstr "" -#: ../../c-api/init_config.rst:791 +#: ../../c-api/init_config.rst:1424 msgid "See also the :c:member:`~PyConfig.filesystem_errors` member." msgstr "另請參閱 :c:member:`~PyConfig.filesystem_errors` 成員。" -#: ../../c-api/init_config.rst:795 +#: ../../c-api/init_config.rst:1428 msgid "" -":term:`Filesystem error handler `: :" -"func:`sys.getfilesystemencodeerrors`." +":term:`Filesystem error handler `: :func:`sys.getfilesystemencodeerrors`." msgstr "" -#: ../../c-api/init_config.rst:798 +#: ../../c-api/init_config.rst:1431 msgid "" -"On Windows: use ``\"surrogatepass\"`` by default, or ``\"replace\"`` if :c:" -"member:`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is " -"non-zero." +"On Windows: use ``\"surrogatepass\"`` by default, or ``\"replace\"`` " +"if :c:member:`~PyPreConfig.legacy_windows_fs_encoding` " +"of :c:type:`PyPreConfig` is non-zero." msgstr "" -#: ../../c-api/init_config.rst:802 +#: ../../c-api/init_config.rst:1435 msgid "On other platforms: use ``\"surrogateescape\"`` by default." msgstr "" -#: ../../c-api/init_config.rst:804 +#: ../../c-api/init_config.rst:1437 msgid "Supported error handlers:" msgstr "" -#: ../../c-api/init_config.rst:806 +#: ../../c-api/init_config.rst:1439 msgid "``\"strict\"``" msgstr "``\"strict\"``" -#: ../../c-api/init_config.rst:807 +#: ../../c-api/init_config.rst:1440 msgid "``\"surrogateescape\"``" msgstr "``\"surrogateescape\"``" -#: ../../c-api/init_config.rst:808 +#: ../../c-api/init_config.rst:1441 msgid "``\"surrogatepass\"`` (only supported with the UTF-8 encoding)" msgstr "``\"surrogatepass\"``\\ (僅支援 UTF-8 編碼)" -#: ../../c-api/init_config.rst:810 +#: ../../c-api/init_config.rst:1443 msgid "See also the :c:member:`~PyConfig.filesystem_encoding` member." msgstr "另請參閱 :c:member:`~PyConfig.filesystem_encoding` 成員。" -#: ../../c-api/init_config.rst:815 +#: ../../c-api/init_config.rst:1447 +msgid "If non-zero, use frozen modules." +msgstr "" + +#: ../../c-api/init_config.rst:1449 +#, fuzzy +msgid "Set by the :envvar:`PYTHON_FROZEN_MODULES` environment variable." +msgstr "由 :envvar:`PYTHONHOME` 環境變數設定。" + +#: ../../c-api/init_config.rst:1451 +msgid "" +"Default: ``1`` in a release build, or ``0`` in a :ref:`debug build `." +msgstr "" + +#: ../../c-api/init_config.rst:1457 msgid "Randomized hash function seed." msgstr "" -#: ../../c-api/init_config.rst:817 +#: ../../c-api/init_config.rst:1459 msgid "" "If :c:member:`~PyConfig.use_hash_seed` is zero, a seed is chosen randomly at " "Python startup, and :c:member:`~PyConfig.hash_seed` is ignored." msgstr "" -#: ../../c-api/init_config.rst:820 +#: ../../c-api/init_config.rst:1462 msgid "Set by the :envvar:`PYTHONHASHSEED` environment variable." msgstr "由 :envvar:`PYTHONHASHSEED` 環境變數設定。" -#: ../../c-api/init_config.rst:822 +#: ../../c-api/init_config.rst:1464 msgid "" "Default *use_hash_seed* value: ``-1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:827 +#: ../../c-api/init_config.rst:1469 msgid "" "Set the default Python \"home\" directory, that is, the location of the " "standard Python libraries (see :envvar:`PYTHONHOME`)." msgstr "" -#: ../../c-api/init_config.rst:830 +#: ../../c-api/init_config.rst:1472 msgid "Set by the :envvar:`PYTHONHOME` environment variable." msgstr "由 :envvar:`PYTHONHOME` 環境變數設定。" -#: ../../c-api/init_config.rst:834 ../../c-api/init_config.rst:964 -#: ../../c-api/init_config.rst:984 ../../c-api/init_config.rst:1073 -#: ../../c-api/init_config.rst:1104 +#: ../../c-api/init_config.rst:1476 ../../c-api/init_config.rst:1612 +#: ../../c-api/init_config.rst:1632 ../../c-api/init_config.rst:1721 +#: ../../c-api/init_config.rst:1752 msgid "Part of the :ref:`Python Path Configuration ` input." msgstr "" -#: ../../c-api/init_config.rst:838 -msgid "If non-zero, profile import time." +#: ../../c-api/init_config.rst:1480 +msgid "" +"If ``1``, profile import time. If ``2``, include additional output that " +"indicates when an imported module has already been loaded." msgstr "" -#: ../../c-api/init_config.rst:840 +#: ../../c-api/init_config.rst:1484 +#, fuzzy msgid "" -"Set the ``1`` by the :option:`-X importtime <-X>` option and the :envvar:" -"`PYTHONPROFILEIMPORTTIME` environment variable." +"Set by the :option:`-X importtime <-X>` option and " +"the :envvar:`PYTHONPROFILEIMPORTTIME` environment variable." +msgstr "由 :envvar:`PYTHONHOME` 環境變數設定。" + +#: ../../c-api/init_config.rst:1491 +msgid "Added support for ``import_time = 2``" msgstr "" -#: ../../c-api/init_config.rst:847 +#: ../../c-api/init_config.rst:1495 msgid "Enter interactive mode after executing a script or a command." msgstr "" -#: ../../c-api/init_config.rst:849 +#: ../../c-api/init_config.rst:1497 msgid "" "If greater than ``0``, enable inspect: when a script is passed as first " "argument or the -c option is used, enter interactive mode after executing " @@ -1204,80 +2367,82 @@ msgid "" "a terminal." msgstr "" -#: ../../c-api/init_config.rst:854 +#: ../../c-api/init_config.rst:1502 msgid "" -"Incremented by the :option:`-i` command line option. Set to ``1`` if the :" -"envvar:`PYTHONINSPECT` environment variable is non-empty." +"Incremented by the :option:`-i` command line option. Set to ``1`` if " +"the :envvar:`PYTHONINSPECT` environment variable is non-empty." msgstr "" -#: ../../c-api/init_config.rst:861 +#: ../../c-api/init_config.rst:1509 msgid "Install Python signal handlers?" msgstr "" -#: ../../c-api/init_config.rst:863 ../../c-api/init_config.rst:1047 -#: ../../c-api/init_config.rst:1071 ../../c-api/init_config.rst:1282 +#: ../../c-api/init_config.rst:1511 ../../c-api/init_config.rst:1695 +#: ../../c-api/init_config.rst:1719 ../../c-api/init_config.rst:1955 msgid "Default: ``1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:867 +#: ../../c-api/init_config.rst:1515 msgid "If greater than ``0``, enable the interactive mode (REPL)." msgstr "" -#: ../../c-api/init_config.rst:869 +#: ../../c-api/init_config.rst:1517 msgid "Incremented by the :option:`-i` command line option." msgstr "" -#: ../../c-api/init_config.rst:875 +#: ../../c-api/init_config.rst:1523 msgid "" "Configures the :ref:`integer string conversion length limitation " "`. An initial value of ``-1`` means the value will be " -"taken from the command line or environment or otherwise default to 4300 (:" -"data:`sys.int_info.default_max_str_digits`). A value of ``0`` disables the " -"limitation. Values greater than zero but less than 640 (:data:`sys.int_info." -"str_digits_check_threshold`) are unsupported and will produce an error." +"taken from the command line or environment or otherwise default to 4300 " +"(:data:`sys.int_info.default_max_str_digits`). A value of ``0`` disables " +"the limitation. Values greater than zero but less than 640 " +"(:data:`sys.int_info.str_digits_check_threshold`) are unsupported and will " +"produce an error." msgstr "" -#: ../../c-api/init_config.rst:883 +#: ../../c-api/init_config.rst:1531 msgid "" "Configured by the :option:`-X int_max_str_digits <-X>` command line flag or " "the :envvar:`PYTHONINTMAXSTRDIGITS` environment variable." msgstr "" -#: ../../c-api/init_config.rst:886 +#: ../../c-api/init_config.rst:1534 msgid "" -"Default: ``-1`` in Python mode. 4300 (:data:`sys.int_info." -"default_max_str_digits`) in isolated mode." +"Default: ``-1`` in Python mode. 4300 " +"(:data:`sys.int_info.default_max_str_digits`) in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:893 +#: ../../c-api/init_config.rst:1541 msgid "" "If the value of :c:member:`~PyConfig.cpu_count` is not ``-1`` then it will " -"override the return values of :func:`os.cpu_count`, :func:`os." -"process_cpu_count`, and :func:`multiprocessing.cpu_count`." +"override the return values " +"of :func:`os.cpu_count`, :func:`os.process_cpu_count`, " +"and :func:`multiprocessing.cpu_count`." msgstr "" -#: ../../c-api/init_config.rst:897 +#: ../../c-api/init_config.rst:1545 msgid "" -"Configured by the :samp:`-X cpu_count={n|default}` command line flag or the :" -"envvar:`PYTHON_CPU_COUNT` environment variable." +"Configured by the :samp:`-X cpu_count={n|default}` command line flag or " +"the :envvar:`PYTHON_CPU_COUNT` environment variable." msgstr "" -#: ../../c-api/init_config.rst:900 ../../c-api/init_config.rst:1259 +#: ../../c-api/init_config.rst:1548 ../../c-api/init_config.rst:1909 msgid "Default: ``-1``." msgstr "預設值:``1``。" -#: ../../c-api/init_config.rst:906 +#: ../../c-api/init_config.rst:1554 msgid "If greater than ``0``, enable isolated mode:" msgstr "" -#: ../../c-api/init_config.rst:908 +#: ../../c-api/init_config.rst:1556 msgid "" "Set :c:member:`~PyConfig.safe_path` to ``1``: don't prepend a potentially " "unsafe path to :data:`sys.path` at Python startup, such as the current " "directory, the script's directory or an empty string." msgstr "" -#: ../../c-api/init_config.rst:912 +#: ../../c-api/init_config.rst:1560 msgid "" "Set :c:member:`~PyConfig.use_environment` to ``0``: ignore ``PYTHON`` " "environment variables." @@ -1285,77 +2450,77 @@ msgstr "" "將 :c:member:`~PyConfig.use_environment` 設定為 ``0``:忽略 ``PYTHON`` 環境變" "數。" -#: ../../c-api/init_config.rst:914 +#: ../../c-api/init_config.rst:1562 msgid "" "Set :c:member:`~PyConfig.user_site_directory` to ``0``: don't add the user " "site directory to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:916 +#: ../../c-api/init_config.rst:1564 msgid "" "Python REPL doesn't import :mod:`readline` nor enable default readline " "configuration on interactive prompts." msgstr "" -#: ../../c-api/init_config.rst:919 +#: ../../c-api/init_config.rst:1567 msgid "Set to ``1`` by the :option:`-I` command line option." msgstr "" -#: ../../c-api/init_config.rst:923 +#: ../../c-api/init_config.rst:1571 msgid "" -"See also the :ref:`Isolated Configuration ` and :c:" -"member:`PyPreConfig.isolated`." +"See also the :ref:`Isolated Configuration ` " +"and :c:member:`PyPreConfig.isolated`." msgstr "" -#: ../../c-api/init_config.rst:928 +#: ../../c-api/init_config.rst:1576 msgid "" -"If non-zero, use :class:`io.FileIO` instead of :class:`!io." -"_WindowsConsoleIO` for :data:`sys.stdin`, :data:`sys.stdout` and :data:`sys." -"stderr`." +"If non-zero, use :class:`io.FileIO` instead of :class:`!" +"io._WindowsConsoleIO` for :data:`sys.stdin`, :data:`sys.stdout` " +"and :data:`sys.stderr`." msgstr "" -#: ../../c-api/init_config.rst:932 +#: ../../c-api/init_config.rst:1580 msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment variable " "is set to a non-empty string." msgstr "" -#: ../../c-api/init_config.rst:940 +#: ../../c-api/init_config.rst:1588 msgid "See also the :pep:`528` (Change Windows console encoding to UTF-8)." msgstr "" -#: ../../c-api/init_config.rst:944 +#: ../../c-api/init_config.rst:1592 msgid "" "If non-zero, dump statistics on :ref:`Python pymalloc memory allocator " "` at exit." msgstr "" -#: ../../c-api/init_config.rst:947 +#: ../../c-api/init_config.rst:1595 msgid "Set to ``1`` by the :envvar:`PYTHONMALLOCSTATS` environment variable." msgstr "" -#: ../../c-api/init_config.rst:949 +#: ../../c-api/init_config.rst:1597 msgid "" "The option is ignored if Python is :option:`configured using the --without-" "pymalloc option <--without-pymalloc>`." msgstr "" -#: ../../c-api/init_config.rst:956 +#: ../../c-api/init_config.rst:1604 msgid "Platform library directory name: :data:`sys.platlibdir`." msgstr "" -#: ../../c-api/init_config.rst:958 +#: ../../c-api/init_config.rst:1606 msgid "Set by the :envvar:`PYTHONPLATLIBDIR` environment variable." msgstr "" -#: ../../c-api/init_config.rst:960 +#: ../../c-api/init_config.rst:1608 msgid "" -"Default: value of the ``PLATLIBDIR`` macro which is set by the :option:" -"`configure --with-platlibdir option <--with-platlibdir>` (default: " -"``\"lib\"``, or ``\"DLLs\"`` on Windows)." +"Default: value of the ``PLATLIBDIR`` macro which is set by " +"the :option:`configure --with-platlibdir option <--with-platlibdir>` " +"(default: ``\"lib\"``, or ``\"DLLs\"`` on Windows)." msgstr "" -#: ../../c-api/init_config.rst:968 +#: ../../c-api/init_config.rst:1616 msgid "" "This macro is now used on Windows to locate the standard library extension " "modules, typically under ``DLLs``. However, for compatibility, note that " @@ -1363,512 +2528,555 @@ msgid "" "and virtual environments." msgstr "" -#: ../../c-api/init_config.rst:977 +#: ../../c-api/init_config.rst:1625 msgid "" -"Module search paths (:data:`sys.path`) as a string separated by ``DELIM`` (:" -"data:`os.pathsep`)." +"Module search paths (:data:`sys.path`) as a string separated by ``DELIM`` " +"(:data:`os.pathsep`)." msgstr "" -#: ../../c-api/init_config.rst:980 +#: ../../c-api/init_config.rst:1628 msgid "Set by the :envvar:`PYTHONPATH` environment variable." msgstr "" -#: ../../c-api/init_config.rst:989 +#: ../../c-api/init_config.rst:1637 msgid "Module search paths: :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:991 +#: ../../c-api/init_config.rst:1639 msgid "" -"If :c:member:`~PyConfig.module_search_paths_set` is equal to ``0``, :c:func:" -"`Py_InitializeFromConfig` will replace :c:member:`~PyConfig." -"module_search_paths` and sets :c:member:`~PyConfig.module_search_paths_set` " -"to ``1``." +"If :c:member:`~PyConfig.module_search_paths_set` is equal to " +"``0``, :c:func:`Py_InitializeFromConfig` will " +"replace :c:member:`~PyConfig.module_search_paths` and " +"sets :c:member:`~PyConfig.module_search_paths_set` to ``1``." msgstr "" -#: ../../c-api/init_config.rst:996 +#: ../../c-api/init_config.rst:1644 msgid "" "Default: empty list (``module_search_paths``) and ``0`` " "(``module_search_paths_set``)." msgstr "" -#: ../../c-api/init_config.rst:1003 +#: ../../c-api/init_config.rst:1651 msgid "Compilation optimization level:" msgstr "" -#: ../../c-api/init_config.rst:1005 +#: ../../c-api/init_config.rst:1653 msgid "``0``: Peephole optimizer, set ``__debug__`` to ``True``." msgstr "" -#: ../../c-api/init_config.rst:1006 +#: ../../c-api/init_config.rst:1654 msgid "``1``: Level 0, remove assertions, set ``__debug__`` to ``False``." msgstr "" -#: ../../c-api/init_config.rst:1007 +#: ../../c-api/init_config.rst:1655 msgid "``2``: Level 1, strip docstrings." msgstr "" -#: ../../c-api/init_config.rst:1009 +#: ../../c-api/init_config.rst:1657 msgid "" -"Incremented by the :option:`-O` command line option. Set to the :envvar:" -"`PYTHONOPTIMIZE` environment variable value." +"Incremented by the :option:`-O` command line option. Set to " +"the :envvar:`PYTHONOPTIMIZE` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:1016 +#: ../../c-api/init_config.rst:1664 msgid "" "The list of the original command line arguments passed to the Python " "executable: :data:`sys.orig_argv`." msgstr "" -#: ../../c-api/init_config.rst:1019 +#: ../../c-api/init_config.rst:1667 msgid "" -"If :c:member:`~PyConfig.orig_argv` list is empty and :c:member:`~PyConfig." -"argv` is not a list only containing an empty string, :c:func:`PyConfig_Read` " -"copies :c:member:`~PyConfig.argv` into :c:member:`~PyConfig.orig_argv` " -"before modifying :c:member:`~PyConfig.argv` (if :c:member:`~PyConfig." -"parse_argv` is non-zero)." +"If :c:member:`~PyConfig.orig_argv` list is empty " +"and :c:member:`~PyConfig.argv` is not a list only containing an empty " +"string, :c:func:`PyConfig_Read` copies :c:member:`~PyConfig.argv` " +"into :c:member:`~PyConfig.orig_argv` before " +"modifying :c:member:`~PyConfig.argv` (if :c:member:`~PyConfig.parse_argv` is " +"non-zero)." msgstr "" -#: ../../c-api/init_config.rst:1026 +#: ../../c-api/init_config.rst:1674 msgid "" -"See also the :c:member:`~PyConfig.argv` member and the :c:func:" -"`Py_GetArgcArgv` function." +"See also the :c:member:`~PyConfig.argv` member and " +"the :c:func:`Py_GetArgcArgv` function." msgstr "" -#: ../../c-api/init_config.rst:1029 ../../c-api/init_config.rst:1317 -#: ../../c-api/init_config.rst:1336 +#: ../../c-api/init_config.rst:1677 ../../c-api/init_config.rst:1990 +#: ../../c-api/init_config.rst:2009 msgid "Default: empty list." msgstr "" -#: ../../c-api/init_config.rst:1035 +#: ../../c-api/init_config.rst:1683 msgid "Parse command line arguments?" msgstr "" -#: ../../c-api/init_config.rst:1037 +#: ../../c-api/init_config.rst:1685 msgid "" "If equals to ``1``, parse :c:member:`~PyConfig.argv` the same way the " "regular Python parses :ref:`command line arguments `, and " "strip Python arguments from :c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:1049 +#: ../../c-api/init_config.rst:1697 msgid "" -"The :c:member:`PyConfig.argv` arguments are now only parsed if :c:member:" -"`PyConfig.parse_argv` equals to ``1``." +"The :c:member:`PyConfig.argv` arguments are now only parsed " +"if :c:member:`PyConfig.parse_argv` equals to ``1``." msgstr "" -#: ../../c-api/init_config.rst:1055 +#: ../../c-api/init_config.rst:1703 msgid "" "Parser debug mode. If greater than ``0``, turn on parser debugging output " "(for expert only, depending on compilation options)." msgstr "" -#: ../../c-api/init_config.rst:1058 +#: ../../c-api/init_config.rst:1706 msgid "" -"Incremented by the :option:`-d` command line option. Set to the :envvar:" -"`PYTHONDEBUG` environment variable value." +"Incremented by the :option:`-d` command line option. Set to " +"the :envvar:`PYTHONDEBUG` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:1061 ../../c-api/init_config.rst:1166 +#: ../../c-api/init_config.rst:1709 ../../c-api/init_config.rst:1814 msgid "" "Needs a :ref:`debug build of Python ` (the ``Py_DEBUG`` macro " "must be defined)." msgstr "" -#: ../../c-api/init_config.rst:1068 +#: ../../c-api/init_config.rst:1716 msgid "" "If non-zero, calculation of path configuration is allowed to log warnings " "into ``stderr``. If equals to ``0``, suppress these warnings." msgstr "" -#: ../../c-api/init_config.rst:1075 +#: ../../c-api/init_config.rst:1723 msgid "Now also applies on Windows." msgstr "" -#: ../../c-api/init_config.rst:1080 +#: ../../c-api/init_config.rst:1728 msgid "" "The site-specific directory prefix where the platform independent Python " "files are installed: :data:`sys.prefix`." msgstr "" -#: ../../c-api/init_config.rst:1087 +#: ../../c-api/init_config.rst:1735 msgid "See also :c:member:`PyConfig.base_prefix`." msgstr "也請見 :c:member:`PyConfig.base_prefix`" -#: ../../c-api/init_config.rst:1091 +#: ../../c-api/init_config.rst:1739 msgid "" "Program name used to initialize :c:member:`~PyConfig.executable` and in " "early error messages during Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1094 +#: ../../c-api/init_config.rst:1742 msgid "On macOS, use :envvar:`PYTHONEXECUTABLE` environment variable if set." msgstr "" -#: ../../c-api/init_config.rst:1095 +#: ../../c-api/init_config.rst:1743 msgid "" -"If the ``WITH_NEXT_FRAMEWORK`` macro is defined, use :envvar:" -"`__PYVENV_LAUNCHER__` environment variable if set." +"If the ``WITH_NEXT_FRAMEWORK`` macro is defined, " +"use :envvar:`__PYVENV_LAUNCHER__` environment variable if set." msgstr "" -#: ../../c-api/init_config.rst:1097 +#: ../../c-api/init_config.rst:1745 msgid "" "Use ``argv[0]`` of :c:member:`~PyConfig.argv` if available and non-empty." msgstr "" -#: ../../c-api/init_config.rst:1099 +#: ../../c-api/init_config.rst:1747 msgid "" "Otherwise, use ``L\"python\"`` on Windows, or ``L\"python3\"`` on other " "platforms." msgstr "" -#: ../../c-api/init_config.rst:1108 +#: ../../c-api/init_config.rst:1756 msgid "" -"Directory where cached ``.pyc`` files are written: :data:`sys." -"pycache_prefix`." +"Directory where cached ``.pyc`` files are " +"written: :data:`sys.pycache_prefix`." msgstr "" -#: ../../c-api/init_config.rst:1111 +#: ../../c-api/init_config.rst:1759 msgid "" "Set by the :option:`-X pycache_prefix=PATH <-X>` command line option and " "the :envvar:`PYTHONPYCACHEPREFIX` environment variable. The command-line " "option takes precedence." msgstr "" -#: ../../c-api/init_config.rst:1115 +#: ../../c-api/init_config.rst:1763 msgid "If ``NULL``, :data:`sys.pycache_prefix` is set to ``None``." msgstr "" -#: ../../c-api/init_config.rst:1121 +#: ../../c-api/init_config.rst:1769 msgid "" "Quiet mode. If greater than ``0``, don't display the copyright and version " "at Python startup in interactive mode." msgstr "" -#: ../../c-api/init_config.rst:1124 +#: ../../c-api/init_config.rst:1772 msgid "Incremented by the :option:`-q` command line option." msgstr "" -#: ../../c-api/init_config.rst:1130 +#: ../../c-api/init_config.rst:1778 msgid "Value of the :option:`-c` command line option." msgstr "" -#: ../../c-api/init_config.rst:1132 ../../c-api/init_config.rst:1153 +#: ../../c-api/init_config.rst:1780 ../../c-api/init_config.rst:1801 msgid "Used by :c:func:`Py_RunMain`." msgstr "" -#: ../../c-api/init_config.rst:1138 +#: ../../c-api/init_config.rst:1786 msgid "" -"Filename passed on the command line: trailing command line argument without :" -"option:`-c` or :option:`-m`. It is used by the :c:func:`Py_RunMain` function." +"Filename passed on the command line: trailing command line argument " +"without :option:`-c` or :option:`-m`. It is used by the :c:func:`Py_RunMain` " +"function." msgstr "" -#: ../../c-api/init_config.rst:1142 +#: ../../c-api/init_config.rst:1790 msgid "" "For example, it is set to ``script.py`` by the ``python3 script.py arg`` " "command line." msgstr "" -#: ../../c-api/init_config.rst:1145 +#: ../../c-api/init_config.rst:1793 msgid "See also the :c:member:`PyConfig.skip_source_first_line` option." msgstr "也請見 :c:member:`PyConfig.skip_source_first_line` 選項。" -#: ../../c-api/init_config.rst:1151 +#: ../../c-api/init_config.rst:1799 msgid "Value of the :option:`-m` command line option." msgstr "" -#: ../../c-api/init_config.rst:1159 +#: ../../c-api/init_config.rst:1807 msgid "" "``package.module`` path to module that should be imported before ``site.py`` " "is run." msgstr "" -#: ../../c-api/init_config.rst:1162 +#: ../../c-api/init_config.rst:1810 msgid "" "Set by the :option:`-X presite=package.module <-X>` command-line option and " "the :envvar:`PYTHON_PRESITE` environment variable. The command-line option " "takes precedence." msgstr "" -#: ../../c-api/init_config.rst:1173 +#: ../../c-api/init_config.rst:1821 msgid "" "Show total reference count at exit (excluding :term:`immortal` objects)?" msgstr "" -#: ../../c-api/init_config.rst:1175 +#: ../../c-api/init_config.rst:1823 msgid "Set to ``1`` by :option:`-X showrefcount <-X>` command line option." msgstr "" -#: ../../c-api/init_config.rst:1177 +#: ../../c-api/init_config.rst:1825 msgid "" "Needs a :ref:`debug build of Python ` (the ``Py_REF_DEBUG`` " "macro must be defined)." msgstr "" -#: ../../c-api/init_config.rst:1184 +#: ../../c-api/init_config.rst:1832 msgid "Import the :mod:`site` module at startup?" msgstr "" -#: ../../c-api/init_config.rst:1186 +#: ../../c-api/init_config.rst:1834 msgid "" "If equal to zero, disable the import of the module site and the site-" "dependent manipulations of :data:`sys.path` that it entails." msgstr "" -#: ../../c-api/init_config.rst:1189 +#: ../../c-api/init_config.rst:1837 msgid "" "Also disable these manipulations if the :mod:`site` module is explicitly " "imported later (call :func:`site.main` if you want them to be triggered)." msgstr "" -#: ../../c-api/init_config.rst:1192 +#: ../../c-api/init_config.rst:1840 msgid "Set to ``0`` by the :option:`-S` command line option." msgstr "" -#: ../../c-api/init_config.rst:1194 +#: ../../c-api/init_config.rst:1842 msgid "" -":data:`sys.flags.no_site ` is set to the inverted value of :c:" -"member:`~PyConfig.site_import`." +":data:`sys.flags.no_site ` is set to the inverted value " +"of :c:member:`~PyConfig.site_import`." msgstr "" -#: ../../c-api/init_config.rst:1201 +#: ../../c-api/init_config.rst:1849 msgid "" "If non-zero, skip the first line of the :c:member:`PyConfig.run_filename` " "source." msgstr "" -#: ../../c-api/init_config.rst:1204 +#: ../../c-api/init_config.rst:1852 msgid "" "It allows the usage of non-Unix forms of ``#!cmd``. This is intended for a " "DOS specific hack only." msgstr "" -#: ../../c-api/init_config.rst:1207 +#: ../../c-api/init_config.rst:1855 msgid "Set to ``1`` by the :option:`-x` command line option." msgstr "" -#: ../../c-api/init_config.rst:1214 +#: ../../c-api/init_config.rst:1862 msgid "" -"Encoding and encoding errors of :data:`sys.stdin`, :data:`sys.stdout` and :" -"data:`sys.stderr` (but :data:`sys.stderr` always uses " +"Encoding and encoding errors of :data:`sys.stdin`, :data:`sys.stdout` " +"and :data:`sys.stderr` (but :data:`sys.stderr` always uses " "``\"backslashreplace\"`` error handler)." msgstr "" -#: ../../c-api/init_config.rst:1218 +#: ../../c-api/init_config.rst:1866 msgid "" "Use the :envvar:`PYTHONIOENCODING` environment variable if it is non-empty." msgstr "" -#: ../../c-api/init_config.rst:1221 +#: ../../c-api/init_config.rst:1869 msgid "Default encoding:" msgstr "" -#: ../../c-api/init_config.rst:1223 +#: ../../c-api/init_config.rst:1871 msgid "``\"UTF-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." msgstr "" -#: ../../c-api/init_config.rst:1224 +#: ../../c-api/init_config.rst:1872 msgid "Otherwise, use the :term:`locale encoding`." msgstr "" -#: ../../c-api/init_config.rst:1226 +#: ../../c-api/init_config.rst:1874 msgid "Default error handler:" msgstr "" -#: ../../c-api/init_config.rst:1228 +#: ../../c-api/init_config.rst:1876 msgid "On Windows: use ``\"surrogateescape\"``." msgstr "" -#: ../../c-api/init_config.rst:1229 +#: ../../c-api/init_config.rst:1877 msgid "" "``\"surrogateescape\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero, or " "if the LC_CTYPE locale is \"C\" or \"POSIX\"." msgstr "" -#: ../../c-api/init_config.rst:1231 +#: ../../c-api/init_config.rst:1879 msgid "``\"strict\"`` otherwise." msgstr "" -#: ../../c-api/init_config.rst:1233 +#: ../../c-api/init_config.rst:1881 msgid "See also :c:member:`PyConfig.legacy_windows_stdio`." msgstr "也請見 :c:member:`PyConfig.legacy_windows_stdio`。" -#: ../../c-api/init_config.rst:1237 +#: ../../c-api/init_config.rst:1885 msgid "Enable tracemalloc?" msgstr "" -#: ../../c-api/init_config.rst:1239 +#: ../../c-api/init_config.rst:1887 msgid "If non-zero, call :func:`tracemalloc.start` at startup." msgstr "" -#: ../../c-api/init_config.rst:1241 +#: ../../c-api/init_config.rst:1889 msgid "" -"Set by :option:`-X tracemalloc=N <-X>` command line option and by the :" -"envvar:`PYTHONTRACEMALLOC` environment variable." +"Set by :option:`-X tracemalloc=N <-X>` command line option and by " +"the :envvar:`PYTHONTRACEMALLOC` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1248 -msgid "Enable compatibility mode with the perf profiler?" +#: ../../c-api/init_config.rst:1896 +msgid "Enable the Linux ``perf`` profiler support?" msgstr "" -#: ../../c-api/init_config.rst:1250 +#: ../../c-api/init_config.rst:1898 +msgid "If equals to ``1``, enable support for the Linux ``perf`` profiler." +msgstr "" + +#: ../../c-api/init_config.rst:1900 msgid "" -"If non-zero, initialize the perf trampoline. See :ref:`perf_profiling` for " -"more information." +"If equals to ``2``, enable support for the Linux ``perf`` profiler with " +"DWARF JIT support." msgstr "" -#: ../../c-api/init_config.rst:1253 +#: ../../c-api/init_config.rst:1903 msgid "" -"Set by :option:`-X perf <-X>` command-line option and by the :envvar:" -"`PYTHON_PERF_JIT_SUPPORT` environment variable for perf support with stack " -"pointers and :option:`-X perf_jit <-X>` command-line option and by the :" -"envvar:`PYTHON_PERF_JIT_SUPPORT` environment variable for perf support with " -"DWARF JIT information." +"Set to ``1`` by :option:`-X perf <-X>` command-line option and " +"the :envvar:`PYTHONPERFSUPPORT` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1265 +#: ../../c-api/init_config.rst:1906 +msgid "" +"Set to ``2`` by the :option:`-X perf_jit <-X>` command-line option and " +"the :envvar:`PYTHON_PERF_JIT_SUPPORT` environment variable." +msgstr "" + +#: ../../c-api/init_config.rst:1912 +msgid "See :ref:`perf_profiling` for more information." +msgstr "" + +#: ../../c-api/init_config.rst:1918 +msgid "Directory of the Python standard library." +msgstr "" + +#: ../../c-api/init_config.rst:1926 msgid "Use :ref:`environment variables `?" msgstr "" -#: ../../c-api/init_config.rst:1267 +#: ../../c-api/init_config.rst:1928 msgid "" "If equals to zero, ignore the :ref:`environment variables `." msgstr "" -#: ../../c-api/init_config.rst:1270 +#: ../../c-api/init_config.rst:1931 msgid "Set to ``0`` by the :option:`-E` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1276 +#: ../../c-api/init_config.rst:1937 +msgid "" +"If non-zero, ``stdout`` and ``stderr`` will be redirected to the system log." +msgstr "" + +#: ../../c-api/init_config.rst:1940 +msgid "Only available on macOS 10.12 and later, and on iOS." +msgstr "" + +#: ../../c-api/init_config.rst:1942 +msgid "" +"Default: ``0`` (don't use the system log) on macOS; ``1`` on iOS (use the " +"system log)." +msgstr "" + +#: ../../c-api/init_config.rst:1949 msgid "If non-zero, add the user site directory to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1278 +#: ../../c-api/init_config.rst:1951 msgid "Set to ``0`` by the :option:`-s` and :option:`-I` command line options." msgstr "" -#: ../../c-api/init_config.rst:1280 +#: ../../c-api/init_config.rst:1953 msgid "Set to ``0`` by the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1286 +#: ../../c-api/init_config.rst:1959 msgid "" "Verbose mode. If greater than ``0``, print a message each time a module is " "imported, showing the place (filename or built-in module) from which it is " "loaded." msgstr "" -#: ../../c-api/init_config.rst:1290 +#: ../../c-api/init_config.rst:1963 msgid "" "If greater than or equal to ``2``, print a message for each file that is " "checked for when searching for a module. Also provides information on module " "cleanup at exit." msgstr "" -#: ../../c-api/init_config.rst:1294 +#: ../../c-api/init_config.rst:1967 msgid "Incremented by the :option:`-v` command line option." msgstr "" -#: ../../c-api/init_config.rst:1296 +#: ../../c-api/init_config.rst:1969 msgid "Set by the :envvar:`PYTHONVERBOSE` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:1302 +#: ../../c-api/init_config.rst:1975 msgid "" "Options of the :mod:`warnings` module to build warnings filters, lowest to " "highest priority: :data:`sys.warnoptions`." msgstr "" -#: ../../c-api/init_config.rst:1305 +#: ../../c-api/init_config.rst:1978 msgid "" "The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse " "order: the last :c:member:`PyConfig.warnoptions` item becomes the first item " "of :data:`warnings.filters` which is checked first (highest priority)." msgstr "" -#: ../../c-api/init_config.rst:1310 +#: ../../c-api/init_config.rst:1983 msgid "" -"The :option:`-W` command line options adds its value to :c:member:`~PyConfig." -"warnoptions`, it can be used multiple times." +"The :option:`-W` command line options adds its value " +"to :c:member:`~PyConfig.warnoptions`, it can be used multiple times." msgstr "" -#: ../../c-api/init_config.rst:1313 +#: ../../c-api/init_config.rst:1986 msgid "" "The :envvar:`PYTHONWARNINGS` environment variable can also be used to add " -"warning options. Multiple options can be specified, separated by commas (``," -"``)." +"warning options. Multiple options can be specified, separated by commas " +"(``,``)." msgstr "" -#: ../../c-api/init_config.rst:1321 +#: ../../c-api/init_config.rst:1994 msgid "" "If equal to ``0``, Python won't try to write ``.pyc`` files on the import of " "source modules." msgstr "" -#: ../../c-api/init_config.rst:1324 +#: ../../c-api/init_config.rst:1997 msgid "" -"Set to ``0`` by the :option:`-B` command line option and the :envvar:" -"`PYTHONDONTWRITEBYTECODE` environment variable." +"Set to ``0`` by the :option:`-B` command line option and " +"the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1327 +#: ../../c-api/init_config.rst:2000 msgid "" -":data:`sys.dont_write_bytecode` is initialized to the inverted value of :c:" -"member:`~PyConfig.write_bytecode`." +":data:`sys.dont_write_bytecode` is initialized to the inverted value " +"of :c:member:`~PyConfig.write_bytecode`." msgstr "" -#: ../../c-api/init_config.rst:1334 +#: ../../c-api/init_config.rst:2007 msgid "Values of the :option:`-X` command line options: :data:`sys._xoptions`." msgstr "" -#: ../../c-api/init_config.rst:1338 +#: ../../c-api/init_config.rst:2013 +msgid "If non-zero, write performance statistics at Python exit." +msgstr "" + +#: ../../c-api/init_config.rst:2015 +msgid "" +"Need a special build with the ``Py_STATS`` macro: see :option:`--enable-" +"pystats`." +msgstr "" + +#: ../../c-api/init_config.rst:2020 msgid "" "If :c:member:`~PyConfig.parse_argv` is non-zero, :c:member:`~PyConfig.argv` " "arguments are parsed the same way the regular Python parses :ref:`command " -"line arguments `, and Python arguments are stripped from :" -"c:member:`~PyConfig.argv`." +"line arguments `, and Python arguments are stripped " +"from :c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:1343 +#: ../../c-api/init_config.rst:2025 msgid "" "The :c:member:`~PyConfig.xoptions` options are parsed to set other options: " "see the :option:`-X` command line option." msgstr "" -#: ../../c-api/init_config.rst:1348 +#: ../../c-api/init_config.rst:2030 msgid "The ``show_alloc_count`` field has been removed." msgstr "" -#: ../../c-api/init_config.rst:1354 +#: ../../c-api/init_config.rst:2036 msgid "Initialization with PyConfig" msgstr "" -#: ../../c-api/init_config.rst:1356 +#: ../../c-api/init_config.rst:2038 msgid "" "Initializing the interpreter from a populated configuration struct is " "handled by calling :c:func:`Py_InitializeFromConfig`." msgstr "" -#: ../../c-api/init_config.rst:1362 +#: ../../c-api/init_config.rst:2044 msgid "" -"If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` or :c:" -"func:`PyImport_ExtendInittab` are used, they must be set or called after " -"Python preinitialization and before the Python initialization. If Python is " -"initialized multiple times, :c:func:`PyImport_AppendInittab` or :c:func:" -"`PyImport_ExtendInittab` must be called before each Python initialization." +"If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` " +"or :c:func:`PyImport_ExtendInittab` are used, they must be set or called " +"after Python preinitialization and before the Python initialization. If " +"Python is initialized multiple times, :c:func:`PyImport_AppendInittab` " +"or :c:func:`PyImport_ExtendInittab` must be called before each Python " +"initialization." msgstr "" -#: ../../c-api/init_config.rst:1369 +#: ../../c-api/init_config.rst:2051 msgid "" "The current configuration (``PyConfig`` type) is stored in " "``PyInterpreterState.config``." msgstr "" -#: ../../c-api/init_config.rst:1372 +#: ../../c-api/init_config.rst:2054 msgid "Example setting the program name::" msgstr "" -#: ../../c-api/init_config.rst:1374 +#: ../../c-api/init_config.rst:2056 msgid "" "void init_python(void)\n" "{\n" @@ -1922,7 +3130,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init_config.rst:1400 +#: ../../c-api/init_config.rst:2082 msgid "" "More complete example modifying the default configuration, read the " "configuration, and then override some parameters. Note that since 3.11, many " @@ -1931,7 +3139,7 @@ msgid "" "called will be left unchanged by initialization::" msgstr "" -#: ../../c-api/init_config.rst:1407 +#: ../../c-api/init_config.rst:2089 msgid "" "PyStatus init_python(const char *program_name)\n" "{\n" @@ -1986,18 +3194,19 @@ msgid "" "}" msgstr "" -#: ../../c-api/init_config.rst:1463 +#: ../../c-api/init_config.rst:2145 msgid "Isolated Configuration" msgstr "" -#: ../../c-api/init_config.rst:1465 +#: ../../c-api/init_config.rst:2147 msgid "" -":c:func:`PyPreConfig_InitIsolatedConfig` and :c:func:" -"`PyConfig_InitIsolatedConfig` functions create a configuration to isolate " -"Python from the system. For example, to embed Python into an application." +":c:func:`PyPreConfig_InitIsolatedConfig` " +"and :c:func:`PyConfig_InitIsolatedConfig` functions create a configuration " +"to isolate Python from the system. For example, to embed Python into an " +"application." msgstr "" -#: ../../c-api/init_config.rst:1470 +#: ../../c-api/init_config.rst:2152 msgid "" "This configuration ignores global configuration variables, environment " "variables, command line arguments (:c:member:`PyConfig.argv` is not parsed) " @@ -2005,136 +3214,133 @@ msgid "" "LC_CTYPE locale are left unchanged. Signal handlers are not installed." msgstr "" -#: ../../c-api/init_config.rst:1475 +#: ../../c-api/init_config.rst:2157 msgid "" "Configuration files are still used with this configuration to determine " "paths that are unspecified. Ensure :c:member:`PyConfig.home` is specified to " "avoid computing the default path configuration." msgstr "" -#: ../../c-api/init_config.rst:1483 +#: ../../c-api/init_config.rst:2165 msgid "Python Configuration" msgstr "" -#: ../../c-api/init_config.rst:1485 +#: ../../c-api/init_config.rst:2167 msgid "" -":c:func:`PyPreConfig_InitPythonConfig` and :c:func:" -"`PyConfig_InitPythonConfig` functions create a configuration to build a " -"customized Python which behaves as the regular Python." +":c:func:`PyPreConfig_InitPythonConfig` " +"and :c:func:`PyConfig_InitPythonConfig` functions create a configuration to " +"build a customized Python which behaves as the regular Python." msgstr "" -#: ../../c-api/init_config.rst:1489 +#: ../../c-api/init_config.rst:2171 msgid "" "Environments variables and command line arguments are used to configure " "Python, whereas global configuration variables are ignored." msgstr "" -#: ../../c-api/init_config.rst:1492 +#: ../../c-api/init_config.rst:2174 msgid "" "This function enables C locale coercion (:pep:`538`) and :ref:`Python UTF-8 " -"Mode ` (:pep:`540`) depending on the LC_CTYPE locale, :envvar:" -"`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment variables." +"Mode ` (:pep:`540`) depending on the LC_CTYPE " +"locale, :envvar:`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment " +"variables." msgstr "" -#: ../../c-api/init_config.rst:1501 +#: ../../c-api/init_config.rst:2183 msgid "Python Path Configuration" msgstr "" -#: ../../c-api/init_config.rst:1503 +#: ../../c-api/init_config.rst:2185 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1505 +#: ../../c-api/init_config.rst:2187 msgid "Path configuration inputs:" msgstr "" -#: ../../c-api/init_config.rst:1507 +#: ../../c-api/init_config.rst:2189 msgid ":c:member:`PyConfig.home`" msgstr ":c:member:`PyConfig.home`" -#: ../../c-api/init_config.rst:1508 +#: ../../c-api/init_config.rst:2190 msgid ":c:member:`PyConfig.platlibdir`" msgstr ":c:member:`PyConfig.platlibdir`" -#: ../../c-api/init_config.rst:1509 +#: ../../c-api/init_config.rst:2191 msgid ":c:member:`PyConfig.pathconfig_warnings`" msgstr ":c:member:`PyConfig.pathconfig_warnings`" -#: ../../c-api/init_config.rst:1510 +#: ../../c-api/init_config.rst:2192 msgid ":c:member:`PyConfig.program_name`" msgstr ":c:member:`PyConfig.program_name`" -#: ../../c-api/init_config.rst:1511 +#: ../../c-api/init_config.rst:2193 msgid ":c:member:`PyConfig.pythonpath_env`" msgstr ":c:member:`PyConfig.pythonpath_env`" -#: ../../c-api/init_config.rst:1512 +#: ../../c-api/init_config.rst:2194 msgid "current working directory: to get absolute paths" msgstr "" -#: ../../c-api/init_config.rst:1513 +#: ../../c-api/init_config.rst:2195 msgid "" -"``PATH`` environment variable to get the program full path (from :c:member:" -"`PyConfig.program_name`)" +"``PATH`` environment variable to get the program full path " +"(from :c:member:`PyConfig.program_name`)" msgstr "" -#: ../../c-api/init_config.rst:1515 +#: ../../c-api/init_config.rst:2197 msgid "``__PYVENV_LAUNCHER__`` environment variable" msgstr "``__PYVENV_LAUNCHER__`` 環境變數" -#: ../../c-api/init_config.rst:1516 +#: ../../c-api/init_config.rst:2198 msgid "" "(Windows only) Application paths in the registry under " "\"Software\\Python\\PythonCore\\X.Y\\PythonPath\" of HKEY_CURRENT_USER and " "HKEY_LOCAL_MACHINE (where X.Y is the Python version)." msgstr "" -#: ../../c-api/init_config.rst:1520 +#: ../../c-api/init_config.rst:2202 msgid "Path configuration output fields:" msgstr "" -#: ../../c-api/init_config.rst:1522 +#: ../../c-api/init_config.rst:2204 msgid ":c:member:`PyConfig.base_exec_prefix`" msgstr ":c:member:`PyConfig.base_exec_prefix`" -#: ../../c-api/init_config.rst:1523 +#: ../../c-api/init_config.rst:2205 msgid ":c:member:`PyConfig.base_executable`" msgstr ":c:member:`PyConfig.base_executable`" -#: ../../c-api/init_config.rst:1524 +#: ../../c-api/init_config.rst:2206 msgid ":c:member:`PyConfig.base_prefix`" msgstr ":c:member:`PyConfig.base_prefix`" -#: ../../c-api/init_config.rst:1525 +#: ../../c-api/init_config.rst:2207 msgid ":c:member:`PyConfig.exec_prefix`" msgstr ":c:member:`PyConfig.exec_prefix`" -#: ../../c-api/init_config.rst:1526 +#: ../../c-api/init_config.rst:2208 msgid ":c:member:`PyConfig.executable`" msgstr ":c:member:`PyConfig.executable`" -#: ../../c-api/init_config.rst:1527 -msgid "" -":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." -"module_search_paths`" -msgstr "" -":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." -"module_search_paths`" +#: ../../c-api/init_config.rst:2209 +msgid ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig.module_search_paths`" +msgstr ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig.module_search_paths`" -#: ../../c-api/init_config.rst:1529 +#: ../../c-api/init_config.rst:2211 msgid ":c:member:`PyConfig.prefix`" msgstr ":c:member:`PyConfig.prefix`" -#: ../../c-api/init_config.rst:1531 +#: ../../c-api/init_config.rst:2213 msgid "" "If at least one \"output field\" is not set, Python calculates the path " -"configuration to fill unset fields. If :c:member:`~PyConfig." -"module_search_paths_set` is equal to ``0``, :c:member:`~PyConfig." -"module_search_paths` is overridden and :c:member:`~PyConfig." -"module_search_paths_set` is set to ``1``." +"configuration to fill unset fields. " +"If :c:member:`~PyConfig.module_search_paths_set` is equal to " +"``0``, :c:member:`~PyConfig.module_search_paths` is overridden " +"and :c:member:`~PyConfig.module_search_paths_set` is set to ``1``." msgstr "" -#: ../../c-api/init_config.rst:1537 +#: ../../c-api/init_config.rst:2219 msgid "" "It is possible to completely ignore the function calculating the default " "path configuration by setting explicitly all path configuration output " @@ -2144,267 +3350,164 @@ msgid "" "modification." msgstr "" -#: ../../c-api/init_config.rst:1544 +#: ../../c-api/init_config.rst:2226 msgid "" "Set :c:member:`~PyConfig.pathconfig_warnings` to ``0`` to suppress warnings " "when calculating the path configuration (Unix only, Windows does not log any " "warning)." msgstr "" -#: ../../c-api/init_config.rst:1547 +#: ../../c-api/init_config.rst:2229 msgid "" -"If :c:member:`~PyConfig.base_prefix` or :c:member:`~PyConfig." -"base_exec_prefix` fields are not set, they inherit their value from :c:" -"member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` respectively." +"If :c:member:`~PyConfig.base_prefix` " +"or :c:member:`~PyConfig.base_exec_prefix` fields are not set, they inherit " +"their value from :c:member:`~PyConfig.prefix` " +"and :c:member:`~PyConfig.exec_prefix` respectively." msgstr "" -#: ../../c-api/init_config.rst:1551 +#: ../../c-api/init_config.rst:2233 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" msgstr "" -#: ../../c-api/init_config.rst:1553 +#: ../../c-api/init_config.rst:2235 msgid "" "If :c:member:`~PyConfig.run_filename` is set and is a directory which " -"contains a ``__main__.py`` script, prepend :c:member:`~PyConfig." -"run_filename` to :data:`sys.path`." +"contains a ``__main__.py`` script, " +"prepend :c:member:`~PyConfig.run_filename` to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1556 +#: ../../c-api/init_config.rst:2238 msgid "If :c:member:`~PyConfig.isolated` is zero:" msgstr "如果 :c:member:`~PyConfig.isolated` 為零:" -#: ../../c-api/init_config.rst:1558 +#: ../../c-api/init_config.rst:2240 msgid "" "If :c:member:`~PyConfig.run_module` is set, prepend the current directory " "to :data:`sys.path`. Do nothing if the current directory cannot be read." msgstr "" -#: ../../c-api/init_config.rst:1560 +#: ../../c-api/init_config.rst:2242 msgid "" "If :c:member:`~PyConfig.run_filename` is set, prepend the directory of the " "filename to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1562 +#: ../../c-api/init_config.rst:2244 msgid "Otherwise, prepend an empty string to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1564 +#: ../../c-api/init_config.rst:2246 msgid "" "If :c:member:`~PyConfig.site_import` is non-zero, :data:`sys.path` can be " -"modified by the :mod:`site` module. If :c:member:`~PyConfig." -"user_site_directory` is non-zero and the user's site-package directory " -"exists, the :mod:`site` module appends the user's site-package directory to :" -"data:`sys.path`." +"modified by the :mod:`site` module. " +"If :c:member:`~PyConfig.user_site_directory` is non-zero and the user's site-" +"package directory exists, the :mod:`site` module appends the user's site-" +"package directory to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1570 +#: ../../c-api/init_config.rst:2252 msgid "The following configuration files are used by the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1572 +#: ../../c-api/init_config.rst:2254 msgid "``pyvenv.cfg``" msgstr "``pyvenv.cfg``" -#: ../../c-api/init_config.rst:1573 +#: ../../c-api/init_config.rst:2255 msgid "``._pth`` file (ex: ``python._pth``)" msgstr "" -#: ../../c-api/init_config.rst:1574 +#: ../../c-api/init_config.rst:2256 msgid "``pybuilddir.txt`` (Unix only)" msgstr "``pybuilddir.txt``\\ (僅限 Unix)" -#: ../../c-api/init_config.rst:1576 +#: ../../c-api/init_config.rst:2258 msgid "If a ``._pth`` file is present:" msgstr "" -#: ../../c-api/init_config.rst:1578 +#: ../../c-api/init_config.rst:2260 msgid "Set :c:member:`~PyConfig.isolated` to ``1``." msgstr "將 :c:member:`~PyConfig.isolated` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1579 +#: ../../c-api/init_config.rst:2261 msgid "Set :c:member:`~PyConfig.use_environment` to ``0``." msgstr "將 :c:member:`~PyConfig.use_environment` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1580 +#: ../../c-api/init_config.rst:2262 msgid "Set :c:member:`~PyConfig.site_import` to ``0``." msgstr "將 :c:member:`~PyConfig.site_import` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1581 +#: ../../c-api/init_config.rst:2263 msgid "Set :c:member:`~PyConfig.safe_path` to ``1``." msgstr "將 :c:member:`~PyConfig.safe_path` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1583 -msgid "" -"The ``__PYVENV_LAUNCHER__`` environment variable is used to set :c:member:" -"`PyConfig.base_executable`." -msgstr "" - -#: ../../c-api/init_config.rst:1588 -msgid "Py_GetArgcArgv()" -msgstr "Py_GetArgcArgv()" - -#: ../../c-api/init_config.rst:1592 -msgid "Get the original command line arguments, before Python modified them." -msgstr "" - -#: ../../c-api/init_config.rst:1594 -msgid "See also :c:member:`PyConfig.orig_argv` member." -msgstr "也請參與 :c:member:`PyConfig.orig_argv` 成員。" - -#: ../../c-api/init_config.rst:1598 -msgid "Multi-Phase Initialization Private Provisional API" -msgstr "" - -#: ../../c-api/init_config.rst:1600 -msgid "" -"This section is a private provisional API introducing multi-phase " -"initialization, the core feature of :pep:`432`:" -msgstr "" - -#: ../../c-api/init_config.rst:1603 -msgid "\"Core\" initialization phase, \"bare minimum Python\":" -msgstr "" - -#: ../../c-api/init_config.rst:1605 -msgid "Builtin types;" -msgstr "內建型別;" - -#: ../../c-api/init_config.rst:1606 -msgid "Builtin exceptions;" -msgstr "內建例外;" - -#: ../../c-api/init_config.rst:1607 -msgid "Builtin and frozen modules;" -msgstr "" - -#: ../../c-api/init_config.rst:1608 -msgid "" -"The :mod:`sys` module is only partially initialized (ex: :data:`sys.path` " -"doesn't exist yet)." -msgstr "" - -#: ../../c-api/init_config.rst:1611 -msgid "\"Main\" initialization phase, Python is fully initialized:" -msgstr "" - -#: ../../c-api/init_config.rst:1613 -msgid "Install and configure :mod:`importlib`;" -msgstr "" - -#: ../../c-api/init_config.rst:1614 -msgid "Apply the :ref:`Path Configuration `;" -msgstr "" - -#: ../../c-api/init_config.rst:1615 -msgid "Install signal handlers;" -msgstr "" - -#: ../../c-api/init_config.rst:1616 +#: ../../c-api/init_config.rst:2265 msgid "" -"Finish :mod:`sys` module initialization (ex: create :data:`sys.stdout` and :" -"data:`sys.path`);" +"If :c:member:`~PyConfig.home` is not set and a ``pyvenv.cfg`` file is " +"present in the same directory as :c:member:`~PyConfig.executable`, or its " +"parent, :c:member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` " +"are set that location. When this happens, :c:member:`~PyConfig.base_prefix` " +"and :c:member:`~PyConfig.base_exec_prefix` still keep their value, pointing " +"to the base installation. See :ref:`sys-path-init-virtual-environments` for " +"more information." msgstr "" -#: ../../c-api/init_config.rst:1618 +#: ../../c-api/init_config.rst:2273 msgid "" -"Enable optional features like :mod:`faulthandler` and :mod:`tracemalloc`;" -msgstr "" - -#: ../../c-api/init_config.rst:1619 -msgid "Import the :mod:`site` module;" -msgstr "引入 :mod:`site` 模組;" - -#: ../../c-api/init_config.rst:1620 -msgid "etc." -msgstr "" - -#: ../../c-api/init_config.rst:1622 -msgid "Private provisional API:" +"The ``__PYVENV_LAUNCHER__`` environment variable is used to " +"set :c:member:`PyConfig.base_executable`." msgstr "" -#: ../../c-api/init_config.rst:1624 +#: ../../c-api/init_config.rst:2278 msgid "" -":c:member:`PyConfig._init_main`: if set to ``0``, :c:func:" -"`Py_InitializeFromConfig` stops at the \"Core\" initialization phase." +":c:member:`~PyConfig.prefix`, and :c:member:`~PyConfig.exec_prefix`, are now " +"set to the ``pyvenv.cfg`` directory. This was previously done " +"by :mod:`site`, therefore affected by :option:`-S`." msgstr "" -#: ../../c-api/init_config.rst:1629 -msgid "" -"Move to the \"Main\" initialization phase, finish the Python initialization." -msgstr "" +#: ../../c-api/init_config.rst:2284 +msgid "Py_GetArgcArgv()" +msgstr "Py_GetArgcArgv()" -#: ../../c-api/init_config.rst:1631 -msgid "" -"No module is imported during the \"Core\" phase and the ``importlib`` module " -"is not configured: the :ref:`Path Configuration ` is only " -"applied during the \"Main\" phase. It may allow to customize Python in " -"Python to override or tune the :ref:`Path Configuration `, " -"maybe install a custom :data:`sys.meta_path` importer or an import hook, etc." +#: ../../c-api/init_config.rst:2288 +msgid "Get the original command line arguments, before Python modified them." msgstr "" -#: ../../c-api/init_config.rst:1637 -msgid "" -"It may become possible to calculate the :ref:`Path Configuration ` in Python, after the Core phase and before the Main phase, which is " -"one of the :pep:`432` motivation." -msgstr "" +#: ../../c-api/init_config.rst:2290 +msgid "See also :c:member:`PyConfig.orig_argv` member." +msgstr "也請參與 :c:member:`PyConfig.orig_argv` 成員。" -#: ../../c-api/init_config.rst:1641 -msgid "" -"The \"Core\" phase is not properly defined: what should be and what should " -"not be available at this phase is not specified yet. The API is marked as " -"private and provisional: the API can be modified or even be removed anytime " -"until a proper public API is designed." +#: ../../c-api/init_config.rst:2293 +msgid "Delaying main module execution" msgstr "" -#: ../../c-api/init_config.rst:1646 +#: ../../c-api/init_config.rst:2295 msgid "" -"Example running Python code between \"Core\" and \"Main\" initialization " -"phases::" +"In some embedding use cases, it may be desirable to separate interpreter " +"initialization from the execution of the main module." msgstr "" -#: ../../c-api/init_config.rst:1649 +#: ../../c-api/init_config.rst:2298 msgid "" -"void init_python(void)\n" -"{\n" -" PyStatus status;\n" -"\n" -" PyConfig config;\n" -" PyConfig_InitPythonConfig(&config);\n" -" config._init_main = 0;\n" -"\n" -" /* ... customize 'config' configuration ... */\n" -"\n" -" status = Py_InitializeFromConfig(&config);\n" -" PyConfig_Clear(&config);\n" -" if (PyStatus_Exception(status)) {\n" -" Py_ExitStatusException(status);\n" -" }\n" -"\n" -" /* Use sys.stderr because sys.stdout is only created\n" -" by _Py_InitializeMain() */\n" -" int res = PyRun_SimpleString(\n" -" \"import sys; \"\n" -" \"print('Run Python code before _Py_InitializeMain', \"\n" -" \"file=sys.stderr)\");\n" -" if (res < 0) {\n" -" exit(1);\n" -" }\n" -"\n" -" /* ... put more configuration code here ... */\n" -"\n" -" status = _Py_InitializeMain();\n" -" if (PyStatus_Exception(status)) {\n" -" Py_ExitStatusException(status);\n" -" }\n" -"}" +"This separation can be achieved by setting ``PyConfig.run_command`` to the " +"empty string during initialization (to prevent the interpreter from dropping " +"into the interactive prompt), and then subsequently executing the desired " +"main module code using ``__main__.__dict__`` as the global namespace." msgstr "" -#: ../../c-api/init_config.rst:558 +#: ../../c-api/init_config.rst:1181 msgid "main()" msgstr "main()" -#: ../../c-api/init_config.rst:558 +#: ../../c-api/init_config.rst:1181 msgid "argv (in module sys)" msgstr "" + +#~ msgid "Builtin types;" +#~ msgstr "內建型別;" + +#~ msgid "Builtin exceptions;" +#~ msgstr "內建例外;" + +#~ msgid "Import the :mod:`site` module;" +#~ msgstr "引入 :mod:`site` 模組;" diff --git a/c-api/intro.po b/c-api/intro.po index 4c39517d629..0a7c66966a9 100644 --- a/c-api/intro.po +++ b/c-api/intro.po @@ -7,7 +7,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-09-08 15:25+0800\n" "PO-Revision-Date: 2023-04-25 18:01+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,8 +32,8 @@ msgid "" "API. The first reason is to write *extension modules* for specific purposes; " "these are C modules that extend the Python interpreter. This is probably " "the most common use. The second reason is to use Python as a component in a " -"larger application; this technique is generally referred to as :dfn:" -"`embedding` Python in an application." +"larger application; this technique is generally referred to " +"as :dfn:`embedding` Python in an application." msgstr "" "對於 Python 的應用程式開發介面使得 C 和 C++ 開發者能夠在各種層級存取 Python " "直譯器。該 API 同樣可用於 C++,但為簡潔起見,通常將其稱為 Python/C API。使用 " @@ -67,10 +67,24 @@ msgstr "" "式之前熟悉編寫擴充可能是個好主意。" #: ../../c-api/intro.rst:34 +msgid "Language version compatibility" +msgstr "" + +#: ../../c-api/intro.rst:36 +msgid "Python's C API is compatible with C11 and C++11 versions of C and C++." +msgstr "" + +#: ../../c-api/intro.rst:38 +msgid "" +"This is a lower limit: the C API does not require features from later C/C++ " +"versions. You do *not* need to enable your compiler's \"c11 mode\"." +msgstr "" + +#: ../../c-api/intro.rst:44 msgid "Coding standards" msgstr "編寫標準" -#: ../../c-api/intro.rst:36 +#: ../../c-api/intro.rst:46 msgid "" "If you're writing C code for inclusion in CPython, you **must** follow the " "guidelines and standards defined in :PEP:`7`. These guidelines apply " @@ -82,11 +96,11 @@ msgstr "" "中定義的指南和標準。無論你貢獻的 Python 版本如何,這些指南都適用。對於你自己" "的第三方擴充模組,則不必遵循這些約定,除非你希望最終將它們貢獻給 Python。" -#: ../../c-api/intro.rst:46 +#: ../../c-api/intro.rst:56 msgid "Include Files" msgstr "引入檔案 (include files)" -#: ../../c-api/intro.rst:48 +#: ../../c-api/intro.rst:58 msgid "" "All function, type and macro definitions needed to use the Python/C API are " "included in your code by the following line::" @@ -94,7 +108,7 @@ msgstr "" "使用 Python/C API 所需的所有函式、型別和巨集的定義都透過以下這幾行來在你的程" "式碼中引入:" -#: ../../c-api/intro.rst:51 +#: ../../c-api/intro.rst:61 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include " @@ -102,16 +116,16 @@ msgstr "" "#define PY_SSIZE_T_CLEAN\n" "#include " -#: ../../c-api/intro.rst:54 +#: ../../c-api/intro.rst:64 msgid "" "This implies inclusion of the following standard headers: ````, " -"````, ````, ````, ```` and ```` (if available)." +"````, ````, ````, ```` and " +"```` (if available)." msgstr "" "這意味著會引入以下標準標頭:````、````、````、" "````、```` 和 ````\\ (如果可用)。" -#: ../../c-api/intro.rst:60 +#: ../../c-api/intro.rst:70 msgid "" "Since Python may define some pre-processor definitions which affect the " "standard headers on some systems, you *must* include :file:`Python.h` before " @@ -120,7 +134,7 @@ msgstr "" "由於 Python 可能會定義一些會影響某些系統上標準標頭檔的預處理器 (pre-" "processor),因此你\\ *必須*\\ 在引入任何標準標頭檔之前引入 :file:`Python.h`。" -#: ../../c-api/intro.rst:64 +#: ../../c-api/intro.rst:74 msgid "" "It is recommended to always define ``PY_SSIZE_T_CLEAN`` before including " "``Python.h``. See :ref:`arg-parsing` for a description of this macro." @@ -128,7 +142,7 @@ msgstr "" "建議在引入 ``Python.h`` 之前都要定義 ``PY_SSIZE_T_CLEAN``。有關此巨集的說明," "請參閱\\ :ref:`arg-parsing`。" -#: ../../c-api/intro.rst:67 +#: ../../c-api/intro.rst:77 msgid "" "All user visible names defined by Python.h (except those defined by the " "included standard headers) have one of the prefixes ``Py`` or ``_Py``. " @@ -140,7 +154,7 @@ msgstr "" "有 ``Py`` 或 ``_Py`` 前綴。以 ``_Py`` 開頭的名稱供 Python 實作內部使用,擴充" "編寫者不應使用。結構成員名稱沒有保留前綴。" -#: ../../c-api/intro.rst:74 +#: ../../c-api/intro.rst:84 msgid "" "User code should never define names that begin with ``Py`` or ``_Py``. This " "confuses the reader, and jeopardizes the portability of the user code to " @@ -151,39 +165,39 @@ msgstr "" "並危及使用者程式碼在未來 Python 版本上的可移植性,這些版本可能會定義以這些前" "綴之一開頭的其他名稱。" -#: ../../c-api/intro.rst:79 +#: ../../c-api/intro.rst:89 msgid "" "The header files are typically installed with Python. On Unix, these are " -"located in the directories :file:`{prefix}/include/pythonversion/` and :file:" -"`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--prefix>` " -"and :option:`exec_prefix <--exec-prefix>` are defined by the corresponding " -"parameters to Python's :program:`configure` script and *version* is ``'%d." -"%d' % sys.version_info[:2]``. On Windows, the headers are installed in :" -"file:`{prefix}/include`, where ``prefix`` is the installation directory " -"specified to the installer." +"located in the directories :file:`{prefix}/include/pythonversion/` " +"and :file:`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--" +"prefix>` and :option:`exec_prefix <--exec-prefix>` are defined by the " +"corresponding parameters to Python's :program:`configure` script and " +"*version* is ``'%d.%d' % sys.version_info[:2]``. On Windows, the headers " +"are installed in :file:`{prefix}/include`, where ``prefix`` is the " +"installation directory specified to the installer." msgstr "" "標頭檔通常隨 Python 一起安裝。在 Unix 上它們位於目錄 :file:`{prefix}/include/" -"pythonversion/` 和 :file:`{exec_prefix}/include/pythonversion/`,其中 :" -"option:`prefix <--prefix>` 和 :option:`exec_prefix <--exec-prefix>` 由 " +"pythonversion/` 和 :file:`{exec_prefix}/include/pythonversion/`,其" +"中 :option:`prefix <--prefix>` 和 :option:`exec_prefix <--exec-prefix>` 由 " "Python 的 :program:`configure` 腳本的相應參數定義,*version* 是 ``'%d.%d' % " "sys.version_info[:2]``。在 Windows 上,標頭安裝在 :file:`{prefix}/include` " "中,其中 ``prefix`` 是指定給安裝程式 (installer) 用的安裝目錄。" -#: ../../c-api/intro.rst:88 +#: ../../c-api/intro.rst:98 msgid "" "To include the headers, place both directories (if different) on your " "compiler's search path for includes. Do *not* place the parent directories " "on the search path and then use ``#include ``; this will " -"break on multi-platform builds since the platform independent headers under :" -"option:`prefix <--prefix>` include the platform specific headers from :" -"option:`exec_prefix <--exec-prefix>`." +"break on multi-platform builds since the platform independent headers " +"under :option:`prefix <--prefix>` include the platform specific headers " +"from :option:`exec_prefix <--exec-prefix>`." msgstr "" "要引入標頭,請將兩個(如果不同)目錄放在編譯器的引入搜尋路徑 (search path) " -"中。*不要*\\ 將父目錄放在搜尋路徑上,然後使用 ``#include ``;這會在多平台建置上壞掉,因為 :option:`prefix <--prefix>` 下獨立於平台的" -"標頭包括來自 :option:`exec_prefix <--exec-prefix>` 的平台特定標頭。" +"中。*不要*\\ 將父目錄放在搜尋路徑上,然後使用 ``#include ``;這會在多平台建置上壞掉,因為 :option:`prefix <--prefix>` 下獨立" +"於平台的標頭包括來自 :option:`exec_prefix <--exec-prefix>` 的平台特定標頭。" -#: ../../c-api/intro.rst:95 +#: ../../c-api/intro.rst:105 msgid "" "C++ users should note that although the API is defined entirely using C, the " "header files properly declare the entry points to be ``extern \"C\"``. As a " @@ -192,66 +206,28 @@ msgstr "" "C++ 使用者應注意,儘管 API 完全使用 C 來定義,但標頭檔適當地將入口點聲明為 " "``extern \"C\"``。因此,無需執行任何特殊操作即可使用 C++ 中的 API。" -#: ../../c-api/intro.rst:101 +#: ../../c-api/intro.rst:111 msgid "Useful macros" msgstr "有用的巨集" -#: ../../c-api/intro.rst:103 +#: ../../c-api/intro.rst:113 +#, fuzzy msgid "" "Several useful macros are defined in the Python header files. Many are " -"defined closer to where they are useful (e.g. :c:macro:`Py_RETURN_NONE`). " -"Others of a more general utility are defined here. This is not necessarily " -"a complete listing." -msgstr "" -"Python 標頭檔中定義了幾個有用的巨集,大多被定義在它們有用的地方附近(例如 :c:" -"macro:`Py_RETURN_NONE`),其他是更通用的工具程式。以下並不一定是完整的列表。" - -#: ../../c-api/intro.rst:110 -msgid "" -"Declare an extension module ``PyInit`` initialization function. The function " -"return type is :c:expr:`PyObject*`. The macro declares any special linkage " -"declarations required by the platform, and for C++ declares the function as " -"``extern \"C\"``." -msgstr "" - -#: ../../c-api/intro.rst:115 -msgid "" -"The initialization function must be named :samp:`PyInit_{name}`, where " -"*name* is the name of the module, and should be the only non-\\ ``static`` " -"item defined in the module file. Example::" +"defined closer to where they are useful (for " +"example, :c:macro:`Py_RETURN_NONE`, :c:macro:`PyMODINIT_FUNC`). Others of a " +"more general utility are defined here. This is not necessarily a complete " +"listing." msgstr "" +"Python 標頭檔中定義了幾個有用的巨集,大多被定義在它們有用的地方附近(例" +"如 :c:macro:`Py_RETURN_NONE`),其他是更通用的工具程式。以下並不一定是完整的" +"列表。" -#: ../../c-api/intro.rst:119 -msgid "" -"static struct PyModuleDef spam_module = {\n" -" .m_base = PyModuleDef_HEAD_INIT,\n" -" .m_name = \"spam\",\n" -" ...\n" -"};\n" -"\n" -"PyMODINIT_FUNC\n" -"PyInit_spam(void)\n" -"{\n" -" return PyModuleDef_Init(&spam_module);\n" -"}" -msgstr "" -"static struct PyModuleDef spam_module = {\n" -" .m_base = PyModuleDef_HEAD_INIT,\n" -" .m_name = \"spam\",\n" -" ...\n" -"};\n" -"\n" -"PyMODINIT_FUNC\n" -"PyInit_spam(void)\n" -"{\n" -" return PyModuleDef_Init(&spam_module);\n" -"}" - -#: ../../c-api/intro.rst:134 +#: ../../c-api/intro.rst:122 msgid "Return the absolute value of ``x``." msgstr "回傳 ``x`` 的絕對值。" -#: ../../c-api/intro.rst:140 +#: ../../c-api/intro.rst:128 msgid "" "Ask the compiler to always inline a static inline function. The compiler can " "ignore it and decide to not inline the function." @@ -259,7 +235,7 @@ msgstr "" "要求編譯器總是嵌入靜態行內函式 (static inline function),編譯器可以忽略它並決" "定不嵌入該函式。" -#: ../../c-api/intro.rst:143 +#: ../../c-api/intro.rst:131 msgid "" "It can be used to inline performance critical static inline functions when " "building Python in debug mode with function inlining disabled. For example, " @@ -268,7 +244,7 @@ msgstr "" "在禁用函式嵌入的除錯模式下建置 Python 時,它可用於嵌入有性能要求的靜態行內函" "式。例如,MSC 在除錯模式下建置時禁用函式嵌入。" -#: ../../c-api/intro.rst:147 +#: ../../c-api/intro.rst:135 msgid "" "Marking blindly a static inline function with Py_ALWAYS_INLINE can result in " "worse performances (due to increased code size for example). The compiler is " @@ -277,24 +253,25 @@ msgstr "" "盲目地使用 Py_ALWAYS_INLINE 標記靜態行內函式可能會導致更差的性能(例如程式碼" "大小增加)。在成本/收益分析方面,編譯器通常比開發人員更聰明。" -#: ../../c-api/intro.rst:151 +#: ../../c-api/intro.rst:139 msgid "" -"If Python is :ref:`built in debug mode ` (if the :c:macro:" -"`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` macro does " -"nothing." +"If Python is :ref:`built in debug mode ` (if " +"the :c:macro:`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` " +"macro does nothing." msgstr "" -"如果 Python 是\\ :ref:`在除錯模式下建置 `\\ (如果 :c:macro:" -"`Py_DEBUG` 巨集有被定義),:c:macro:`Py_ALWAYS_INLINE` 巨集就什麼都不會做。" +"如果 Python 是\\ :ref:`在除錯模式下建置 `\\ (如" +"果 :c:macro:`Py_DEBUG` 巨集有被定義),:c:macro:`Py_ALWAYS_INLINE` 巨集就什麼" +"都不會做。" -#: ../../c-api/intro.rst:154 +#: ../../c-api/intro.rst:142 msgid "It must be specified before the function return type. Usage::" msgstr "它必須在函式回傳型別之前被指定。用法: ::" -#: ../../c-api/intro.rst:156 +#: ../../c-api/intro.rst:144 msgid "static inline Py_ALWAYS_INLINE int random(void) { return 4; }" msgstr "static inline Py_ALWAYS_INLINE int random(void) { return 4; }" -#: ../../c-api/intro.rst:162 +#: ../../c-api/intro.rst:150 msgid "" "Argument must be a character or an integer in the range [-128, 127] or [0, " "255]. This macro returns ``c`` cast to an ``unsigned char``." @@ -302,26 +279,26 @@ msgstr "" "引數必須是 [-128, 127] 或 [0, 255] 範圍內的字元或整數。這個巨集會將 ``c`` 轉" "換為 ``unsigned char`` 並回傳。" -#: ../../c-api/intro.rst:167 +#: ../../c-api/intro.rst:155 msgid "" "Use this for deprecated declarations. The macro must be placed before the " "symbol name." msgstr "將其用於已棄用的聲明。巨集必須放在符號名稱之前。" -#: ../../c-api/intro.rst:170 ../../c-api/intro.rst:256 -#: ../../c-api/intro.rst:274 +#: ../../c-api/intro.rst:158 ../../c-api/intro.rst:244 +#: ../../c-api/intro.rst:262 msgid "Example::" msgstr "範例: ::" -#: ../../c-api/intro.rst:172 +#: ../../c-api/intro.rst:160 msgid "Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);" msgstr "Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);" -#: ../../c-api/intro.rst:174 +#: ../../c-api/intro.rst:162 msgid "MSVC support was added." msgstr "新增了 MSVC 支援。" -#: ../../c-api/intro.rst:179 +#: ../../c-api/intro.rst:167 msgid "" "Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the " "command line (see :c:member:`PyConfig.use_environment`)." @@ -329,42 +306,42 @@ msgstr "" "類似於 ``getenv(s)``,但如果在命令列上傳遞了 :option:`-E` 則回傳 ``NULL`` " "(請見 :c:member:`PyConfig.use_environment`)。" -#: ../../c-api/intro.rst:184 +#: ../../c-api/intro.rst:172 msgid "Return the maximum value between ``x`` and ``y``." msgstr "回傳 ``x`` 和 ``y`` 之間的最大值。" -#: ../../c-api/intro.rst:190 +#: ../../c-api/intro.rst:178 msgid "Return the size of a structure (``type``) ``member`` in bytes." msgstr "以位元組為單位回傳結構 (``type``) ``member`` 的大小。" -#: ../../c-api/intro.rst:196 +#: ../../c-api/intro.rst:184 msgid "Return the minimum value between ``x`` and ``y``." msgstr "回傳 ``x`` 和 ``y`` 之間的最小值。" -#: ../../c-api/intro.rst:202 +#: ../../c-api/intro.rst:190 msgid "" "Disable inlining on a function. For example, it reduces the C stack " -"consumption: useful on LTO+PGO builds which heavily inline code (see :issue:" -"`33720`)." +"consumption: useful on LTO+PGO builds which heavily inline code " +"(see :issue:`33720`)." msgstr "" "禁用函式的嵌入。例如,它減少了 C 堆疊的消耗:對大量嵌入程式碼的 LTO+PGO 建置" "很有用(請參閱 :issue:`33720`)。" -#: ../../c-api/intro.rst:206 +#: ../../c-api/intro.rst:194 msgid "Usage::" msgstr "用法: ::" -#: ../../c-api/intro.rst:208 +#: ../../c-api/intro.rst:196 msgid "Py_NO_INLINE static int random(void) { return 4; }" msgstr "Py_NO_INLINE static int random(void) { return 4; }" -#: ../../c-api/intro.rst:214 +#: ../../c-api/intro.rst:202 msgid "" "Convert ``x`` to a C string. E.g. ``Py_STRINGIFY(123)`` returns ``\"123\"``." msgstr "" "將 ``x`` 轉換為 C 字串。例如 ``Py_STRINGIFY(123)`` 會回傳 ``\"123\"``。" -#: ../../c-api/intro.rst:221 +#: ../../c-api/intro.rst:209 msgid "" "Use this when you have a code path that cannot be reached by design. For " "example, in the ``default:`` clause in a ``switch`` statement for which all " @@ -375,7 +352,7 @@ msgstr "" "蓋了所有可能值的 ``switch`` 陳述式中的 ``default:`` 子句。在你可能想要呼叫 " "``assert(0)`` 或 ``abort()`` 的地方使用它。" -#: ../../c-api/intro.rst:226 +#: ../../c-api/intro.rst:214 msgid "" "In release mode, the macro helps the compiler to optimize the code, and " "avoids a warning about unreachable code. For example, the macro is " @@ -385,15 +362,15 @@ msgstr "" "程式碼的警告。例如該巨集是在發布模式下於 GCC 使用 " "``__builtin_unreachable()`` 來實作。" -#: ../../c-api/intro.rst:230 +#: ../../c-api/intro.rst:218 msgid "" "A use for ``Py_UNREACHABLE()`` is following a call a function that never " "returns but that is not declared :c:macro:`_Py_NO_RETURN`." msgstr "" -"``Py_UNREACHABLE()`` 的一個用途是,在對一個永不回傳但並未聲明為 :c:macro:" -"`_Py_NO_RETURN` 的函式之呼叫後使用。" +"``Py_UNREACHABLE()`` 的一個用途是,在對一個永不回傳但並未聲明" +"為 :c:macro:`_Py_NO_RETURN` 的函式之呼叫後使用。" -#: ../../c-api/intro.rst:233 +#: ../../c-api/intro.rst:221 msgid "" "If a code path is very unlikely code but can be reached under exceptional " "case, this macro must not be used. For example, under low memory condition " @@ -405,7 +382,7 @@ msgstr "" "憶體條件下或系統呼叫回傳了超出預期範圍的值。在這種情況下,最好將錯誤回報給呼" "叫者。如果無法回報錯誤則可以使用 :c:func:`Py_FatalError`。" -#: ../../c-api/intro.rst:243 +#: ../../c-api/intro.rst:231 msgid "" "Use this for unused arguments in a function definition to silence compiler " "warnings. Example: ``int func(int a, int Py_UNUSED(b)) { return a; }``." @@ -413,7 +390,7 @@ msgstr "" "將此用於函式定義中未使用的參數以消除編譯器警告。例如:``int func(int a, int " "Py_UNUSED(b)) { return a; }``。" -#: ../../c-api/intro.rst:250 +#: ../../c-api/intro.rst:238 msgid "" "Creates a variable with name ``name`` that can be used in docstrings. If " "Python is built without docstrings, the value will be empty." @@ -421,7 +398,7 @@ msgstr "" "建立一個名為 ``name`` 的變數,可以在文件字串中使用。如果 Python 是在沒有文件" "字串的情況下建置,則該值將為空。" -#: ../../c-api/intro.rst:253 +#: ../../c-api/intro.rst:241 msgid "" "Use :c:macro:`PyDoc_STRVAR` for docstrings to support building Python " "without docstrings, as specified in :pep:`7`." @@ -429,7 +406,7 @@ msgstr "" "如 :pep:`7` 中所指明,使用 :c:macro:`PyDoc_STRVAR` 作為文件字串可以支援在沒有" "文件字串的情況下建置 Python。" -#: ../../c-api/intro.rst:258 +#: ../../c-api/intro.rst:246 msgid "" "PyDoc_STRVAR(pop_doc, \"Remove and return the rightmost element.\");\n" "\n" @@ -440,13 +417,13 @@ msgid "" "}" msgstr "" -#: ../../c-api/intro.rst:268 +#: ../../c-api/intro.rst:256 msgid "" "Creates a docstring for the given input string or an empty string if " "docstrings are disabled." msgstr "為給定的輸入字串建立一個文件字串,如果文件字串被禁用則建立空字串。" -#: ../../c-api/intro.rst:271 +#: ../../c-api/intro.rst:259 msgid "" "Use :c:macro:`PyDoc_STR` in specifying docstrings to support building Python " "without docstrings, as specified in :pep:`7`." @@ -454,7 +431,7 @@ msgstr "" "如 :pep:`7` 中所指明,使用 :c:macro:`PyDoc_STR` 指定文件字串以支援在沒有文件" "字串下建置 Python。" -#: ../../c-api/intro.rst:276 +#: ../../c-api/intro.rst:264 msgid "" "static PyMethodDef pysqlite_row_methods[] = {\n" " {\"keys\", (PyCFunction)pysqlite_row_keys, METH_NOARGS,\n" @@ -463,11 +440,11 @@ msgid "" "};" msgstr "" -#: ../../c-api/intro.rst:286 +#: ../../c-api/intro.rst:274 msgid "Objects, Types and Reference Counts" msgstr "物件、型別和參照計數" -#: ../../c-api/intro.rst:290 +#: ../../c-api/intro.rst:278 msgid "" "Most Python/C API functions have one or more arguments as well as a return " "value of type :c:expr:`PyObject*`. This type is a pointer to an opaque data " @@ -475,9 +452,9 @@ msgid "" "are treated the same way by the Python language in most situations (e.g., " "assignments, scope rules, and argument passing), it is only fitting that " "they should be represented by a single C type. Almost all Python objects " -"live on the heap: you never declare an automatic or static variable of type :" -"c:type:`PyObject`, only pointer variables of type :c:expr:`PyObject*` can " -"be declared. The sole exception are the type objects; since these must " +"live on the heap: you never declare an automatic or static variable of " +"type :c:type:`PyObject`, only pointer variables of type :c:expr:`PyObject*` " +"can be declared. The sole exception are the type objects; since these must " "never be deallocated, they are typically static :c:type:`PyTypeObject` " "objects." msgstr "" @@ -490,27 +467,28 @@ msgstr "" "別物件;由於它們絕不能被釋放,因此它們通常是靜態 :c:type:`PyTypeObject` 物" "件。" -#: ../../c-api/intro.rst:301 +#: ../../c-api/intro.rst:289 msgid "" -"All Python objects (even Python integers) have a :dfn:`type` and a :dfn:" -"`reference count`. An object's type determines what kind of object it is (e." -"g., an integer, a list, or a user-defined function; there are many more as " -"explained in :ref:`types`). For each of the well-known types there is a " -"macro to check whether an object is of that type; for instance, " +"All Python objects (even Python integers) have a :dfn:`type` and " +"a :dfn:`reference count`. An object's type determines what kind of object " +"it is (e.g., an integer, a list, or a user-defined function; there are many " +"more as explained in :ref:`types`). For each of the well-known types there " +"is a macro to check whether an object is of that type; for instance, " "``PyList_Check(a)`` is true if (and only if) the object pointed to by *a* is " "a Python list." msgstr "" "所有 Python 物件(甚至是 Python 整數)都有一個型別 (:dfn:`type`) 和一個參照計" "數 (:dfn:`reference count`)。一個物件的型別決定了它是什麼種類的物件(例如一個" -"整數、一個 list 或一個使用者定義的函式;還有更多型別,請見\\ :ref:" -"`types`\\ )。對於每個眾所周知的型別,都有一個巨集來檢查物件是否屬於該型別;" -"例如,若(且唯若)*a* 指向的物件是 Python list 時,``PyList_Check(a)`` 為真。" +"整數、一個 list 或一個使用者定義的函式;還有更多型別,請見" +"\\ :ref:`types`\\ )。對於每個眾所周知的型別,都有一個巨集來檢查物件是否屬於" +"該型別;例如,若(且唯若)*a* 指向的物件是 Python list 時," +"``PyList_Check(a)`` 為真。" -#: ../../c-api/intro.rst:312 +#: ../../c-api/intro.rst:300 msgid "Reference Counts" msgstr "參照計數" -#: ../../c-api/intro.rst:314 +#: ../../c-api/intro.rst:302 msgid "" "The reference count is important because today's computers have a finite " "(and often severely limited) memory size; it counts how many different " @@ -533,23 +511,23 @@ msgstr "" "則可以依次為那些其他物件解除配置,依此類推。(此處相互參照物件的存在是個明顯" "的問題;目前,解決方案是「就不要那樣做」。)" -#: ../../c-api/intro.rst:331 +#: ../../c-api/intro.rst:319 msgid "" "Reference counts are always manipulated explicitly. The normal way is to " "use the macro :c:func:`Py_INCREF` to take a new reference to an object (i.e. " "increment its reference count by one), and :c:func:`Py_DECREF` to release " -"that reference (i.e. decrement the reference count by one). The :c:func:" -"`Py_DECREF` macro is considerably more complex than the incref one, since it " -"must check whether the reference count becomes zero and then cause the " -"object's deallocator to be called. The deallocator is a function pointer " -"contained in the object's type structure. The type-specific deallocator " -"takes care of releasing references for other objects contained in the object " -"if this is a compound object type, such as a list, as well as performing any " -"additional finalization that's needed. There's no chance that the reference " -"count can overflow; at least as many bits are used to hold the reference " -"count as there are distinct memory locations in virtual memory (assuming " -"``sizeof(Py_ssize_t) >= sizeof(void*)``). Thus, the reference count " -"increment is a simple operation." +"that reference (i.e. decrement the reference count by one). " +"The :c:func:`Py_DECREF` macro is considerably more complex than the incref " +"one, since it must check whether the reference count becomes zero and then " +"cause the object's deallocator to be called. The deallocator is a function " +"pointer contained in the object's type structure. The type-specific " +"deallocator takes care of releasing references for other objects contained " +"in the object if this is a compound object type, such as a list, as well as " +"performing any additional finalization that's needed. There's no chance " +"that the reference count can overflow; at least as many bits are used to " +"hold the reference count as there are distinct memory locations in virtual " +"memory (assuming ``sizeof(Py_ssize_t) >= sizeof(void*)``). Thus, the " +"reference count increment is a simple operation." msgstr "" "參照計數總是被明確地操作。正常的方法是使用巨集 :c:func:`Py_INCREF` 來取得對於" "物件的參照(即參照計數加一),並使用巨集 :c:func:`Py_DECREF` 來釋放參照(即將" @@ -561,7 +539,7 @@ msgstr "" "元會被使用(假設 ``sizeof(Py_ssize_t) >= sizeof(void*)``)。因此參照計數增加" "是一個簡單的操作。" -#: ../../c-api/intro.rst:347 +#: ../../c-api/intro.rst:335 msgid "" "It is not necessary to hold a :term:`strong reference` (i.e. increment the " "reference count) for every local variable that contains a pointer to an " @@ -587,15 +565,15 @@ msgstr "" "種情況的一個重要情況是在從 Python 呼叫的擴充模組中作為引數傳遞給 C 函式的物" "件;呼叫機制保證在呼叫期間保持對每個參數的參照。" -#: ../../c-api/intro.rst:363 +#: ../../c-api/intro.rst:351 msgid "" "However, a common pitfall is to extract an object from a list and hold on to " "it for a while without taking a new reference. Some other operation might " "conceivably remove the object from the list, releasing that reference, and " "possibly deallocating it. The real danger is that innocent-looking " "operations may invoke arbitrary Python code which could do this; there is a " -"code path which allows control to flow back to the user from a :c:func:" -"`Py_DECREF`, so almost any operation is potentially dangerous." +"code path which allows control to flow back to the user from " +"a :c:func:`Py_DECREF`, so almost any operation is potentially dangerous." msgstr "" "然而,一個常見的陷阱是從一個 list 中提取一個物件並保留它一段時間而不取得其參" "照。某些其他操作可能會從列表中刪除該物件,減少其參照計數並可能取消分配它。真" @@ -603,7 +581,7 @@ msgstr "" "程式碼路徑允許控制權從 :c:func:`Py_DECREF` 回歸使用者,因此幾乎任何操作都有潛" "在危險。" -#: ../../c-api/intro.rst:371 +#: ../../c-api/intro.rst:359 msgid "" "A safe approach is to always use the generic operations (functions whose " "name begins with ``PyObject_``, ``PyNumber_``, ``PySequence_`` or " @@ -618,11 +596,11 @@ msgstr "" "計數)。這讓呼叫者有責任在處理完結果後呼叫 :c:func:`Py_DECREF`;這就成為第二" "本質。" -#: ../../c-api/intro.rst:382 +#: ../../c-api/intro.rst:370 msgid "Reference Count Details" msgstr "參照計數詳細資訊" -#: ../../c-api/intro.rst:384 +#: ../../c-api/intro.rst:372 msgid "" "The reference count behavior of functions in the Python/C API is best " "explained in terms of *ownership of references*. Ownership pertains to " @@ -630,24 +608,24 @@ msgid "" "shared). \"Owning a reference\" means being responsible for calling " "Py_DECREF on it when the reference is no longer needed. Ownership can also " "be transferred, meaning that the code that receives ownership of the " -"reference then becomes responsible for eventually releasing it by calling :c:" -"func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer needed---or " -"passing on this responsibility (usually to its caller). When a function " -"passes ownership of a reference on to its caller, the caller is said to " -"receive a *new* reference. When no ownership is transferred, the caller is " -"said to *borrow* the reference. Nothing needs to be done for a :term:" -"`borrowed reference`." +"reference then becomes responsible for eventually releasing it by " +"calling :c:func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer " +"needed---or passing on this responsibility (usually to its caller). When a " +"function passes ownership of a reference on to its caller, the caller is " +"said to receive a *new* reference. When no ownership is transferred, the " +"caller is said to *borrow* the reference. Nothing needs to be done for " +"a :term:`borrowed reference`." msgstr "" "Python/C API 中函式的參照計數行為最好用\\ *參照的所有權*\\ 來解釋。所有權附屬" "於參照而非物件(物件並非被擁有,它們總是共享的)。「擁有參照」意味著當不再需" "要該參照時,負責在其上呼叫 Py_DECREF。所有權也可以轉移,這意味著接收參照所有" -"權的程式碼最終會負責在不需要參照時透過呼叫 :c:func:`Py_DECREF` 或 :c:func:" -"`Py_XDECREF` 釋放參照 --- 或者將這個責任再傳遞出去(通常是給它的呼叫者)。當" -"一個函式將參照的所有權傳遞給它的呼叫者時,呼叫者被稱為接收到一個\\ *新*\\ 參" -"照。當沒有所有權轉移時,呼叫者被稱為\\ *借用*\\ 參照。如果是\\ :term:`借用參" -"照 `\\ 就不需要做任何事情。" +"權的程式碼最終會負責在不需要參照時透過呼叫 :c:func:`Py_DECREF` " +"或 :c:func:`Py_XDECREF` 釋放參照 --- 或者將這個責任再傳遞出去(通常是給它的呼" +"叫者)。當一個函式將參照的所有權傳遞給它的呼叫者時,呼叫者被稱為接收到一個\\ " +"*新*\\ 參照。當沒有所有權轉移時,呼叫者被稱為\\ *借用*\\ 參照。如果是" +"\\ :term:`借用參照 `\\ 就不需要做任何事情。" -#: ../../c-api/intro.rst:397 +#: ../../c-api/intro.rst:385 msgid "" "Conversely, when a calling function passes in a reference to an object, " "there are two possibilities: the function *steals* a reference to the " @@ -659,24 +637,24 @@ msgstr "" "物件的參照,或者沒有。 *竊取參照*\\ 意味著當你將參照傳遞給函式時,該函式假定" "它現在擁有該參照,並且你不再對它負責。" -#: ../../c-api/intro.rst:407 +#: ../../c-api/intro.rst:395 msgid "" -"Few functions steal references; the two notable exceptions are :c:func:" -"`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a reference to " -"the item (but not to the tuple or list into which the item is put!). These " -"functions were designed to steal a reference because of a common idiom for " -"populating a tuple or list with newly created objects; for example, the code " -"to create the tuple ``(1, 2, \"three\")`` could look like this (forgetting " -"about error handling for the moment; a better way to code this is shown " -"below)::" +"Few functions steal references; the two notable exceptions " +"are :c:func:`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a " +"reference to the item (but not to the tuple or list into which the item is " +"put!). These functions were designed to steal a reference because of a " +"common idiom for populating a tuple or list with newly created objects; for " +"example, the code to create the tuple ``(1, 2, \"three\")`` could look like " +"this (forgetting about error handling for the moment; a better way to code " +"this is shown below)::" msgstr "" -"很少有函式會竊取參照;兩個值得注意的例外是 :c:func:`PyList_SetItem` 和 :c:" -"func:`PyTuple_SetItem`,它們竊取了對項目的參照(但不是對項目所在的 tuple 或 " -"list 的參照!)。因為有著使用新建立的物件來增加 (populate) tuple 或 list 的習" -"慣,這些函式旨在竊取參照;例如,建立 tuple ``(1, 2, \"three\")`` 的程式碼可以" -"如下所示(先暫時忘記錯誤處理;更好的編寫方式如下所示):" +"很少有函式會竊取參照;兩個值得注意的例外是 :c:func:`PyList_SetItem` " +"和 :c:func:`PyTuple_SetItem`,它們竊取了對項目的參照(但不是對項目所在的 " +"tuple 或 list 的參照!)。因為有著使用新建立的物件來增加 (populate) tuple 或 " +"list 的習慣,這些函式旨在竊取參照;例如,建立 tuple ``(1, 2, \"three\")`` 的" +"程式碼可以如下所示(先暫時忘記錯誤處理;更好的編寫方式如下所示):" -#: ../../c-api/intro.rst:415 +#: ../../c-api/intro.rst:403 msgid "" "PyObject *t;\n" "\n" @@ -692,51 +670,52 @@ msgstr "" "PyTuple_SetItem(t, 1, PyLong_FromLong(2L));\n" "PyTuple_SetItem(t, 2, PyUnicode_FromString(\"three\"));" -#: ../../c-api/intro.rst:422 +#: ../../c-api/intro.rst:410 msgid "" "Here, :c:func:`PyLong_FromLong` returns a new reference which is immediately " "stolen by :c:func:`PyTuple_SetItem`. When you want to keep using an object " "although the reference to it will be stolen, use :c:func:`Py_INCREF` to grab " "another reference before calling the reference-stealing function." msgstr "" -"這裡 :c:func:`PyLong_FromLong` 會回傳一個新的參照,它立即被 :c:func:" -"`PyTuple_SetItem` 竊取。如果你想繼續使用一個物件,儘管對它的參照將被竊取,請" -"在呼叫參照竊取函式之前使用 :c:func:`Py_INCREF` 來取得另一個參照。" +"這裡 :c:func:`PyLong_FromLong` 會回傳一個新的參照,它立即" +"被 :c:func:`PyTuple_SetItem` 竊取。如果你想繼續使用一個物件,儘管對它的參照將" +"被竊取,請在呼叫參照竊取函式之前使用 :c:func:`Py_INCREF` 來取得另一個參照。" -#: ../../c-api/intro.rst:427 +#: ../../c-api/intro.rst:415 msgid "" "Incidentally, :c:func:`PyTuple_SetItem` is the *only* way to set tuple " "items; :c:func:`PySequence_SetItem` and :c:func:`PyObject_SetItem` refuse to " -"do this since tuples are an immutable data type. You should only use :c:" -"func:`PyTuple_SetItem` for tuples that you are creating yourself." +"do this since tuples are an immutable data type. You should only " +"use :c:func:`PyTuple_SetItem` for tuples that you are creating yourself." msgstr "" -"附帶地說,:c:func:`PyTuple_SetItem` 是設定 tuple 項目的\\ *唯一*\\ 方法; :c:" -"func:`PySequence_SetItem` 和 :c:func:`PyObject_SetItem` 拒絕這樣做,因為 " -"tuple 是一種不可變 (immutable) 的資料型別。你應該只對你自己建立的 tuple 使" -"用 :c:func:`PyTuple_SetItem`。" +"附帶地說,:c:func:`PyTuple_SetItem` 是設定 tuple 項目的\\ *唯一*\\ 方" +"法; :c:func:`PySequence_SetItem` 和 :c:func:`PyObject_SetItem` 拒絕這樣做," +"因為 tuple 是一種不可變 (immutable) 的資料型別。你應該只對你自己建立的 tuple " +"使用 :c:func:`PyTuple_SetItem`。" -#: ../../c-api/intro.rst:432 +#: ../../c-api/intro.rst:420 msgid "" -"Equivalent code for populating a list can be written using :c:func:" -"`PyList_New` and :c:func:`PyList_SetItem`." +"Equivalent code for populating a list can be written " +"using :c:func:`PyList_New` and :c:func:`PyList_SetItem`." msgstr "" "可以使用 :c:func:`PyList_New` 和 :c:func:`PyList_SetItem` 編寫用於填充列表的" "等效程式碼。" -#: ../../c-api/intro.rst:435 +#: ../../c-api/intro.rst:423 msgid "" "However, in practice, you will rarely use these ways of creating and " -"populating a tuple or list. There's a generic function, :c:func:" -"`Py_BuildValue`, that can create most common objects from C values, directed " -"by a :dfn:`format string`. For example, the above two blocks of code could " -"be replaced by the following (which also takes care of the error checking)::" +"populating a tuple or list. There's a generic " +"function, :c:func:`Py_BuildValue`, that can create most common objects from " +"C values, directed by a :dfn:`format string`. For example, the above two " +"blocks of code could be replaced by the following (which also takes care of " +"the error checking)::" msgstr "" "但是在實際操作中你很少會使用這些方法來建立和增加 tuple 和 list。有一個通用函" "式 :c:func:`Py_BuildValue` 可以從 C 值建立最常見的物件,由 :dfn:`format " "string` 引導。例如上面的兩個程式碼可以用以下程式碼替換(它還負責了錯誤檢" "查): ::" -#: ../../c-api/intro.rst:441 +#: ../../c-api/intro.rst:429 msgid "" "PyObject *tuple, *list;\n" "\n" @@ -748,7 +727,7 @@ msgstr "" "tuple = Py_BuildValue(\"(iis)\", 1, 2, \"three\");\n" "list = Py_BuildValue(\"[iis]\", 1, 2, \"three\");" -#: ../../c-api/intro.rst:446 +#: ../../c-api/intro.rst:434 msgid "" "It is much more common to use :c:func:`PyObject_SetItem` and friends with " "items whose references you are only borrowing, like arguments that were " @@ -763,7 +742,7 @@ msgstr "" "穩健,因為你不取得新的一個參照就可以放棄參照(「讓它被竊取」)。例如,此函式" "將 list(實際上是任何可變序列)的所有項目設定於給定項目:" -#: ../../c-api/intro.rst:453 +#: ../../c-api/intro.rst:441 msgid "" "int\n" "set_all(PyObject *target, PyObject *item)\n" @@ -807,7 +786,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/intro.rst:476 +#: ../../c-api/intro.rst:464 msgid "" "The situation is slightly different for function return values. While " "passing a reference to most functions does not change your ownership " @@ -825,7 +804,7 @@ msgstr "" "照的通用函式,如 :c:func:`PyObject_GetItem` 和 :c:func:`PySequence_GetItem`," "總是回傳一個新的參照(呼叫者成為參照的所有者)。" -#: ../../c-api/intro.rst:485 +#: ../../c-api/intro.rst:473 msgid "" "It is important to realize that whether you own a reference returned by a " "function depends on which function you call only --- *the plumage* (the type " @@ -841,16 +820,16 @@ msgstr "" "如果你使用 :c:func:`PySequence_GetItem` 從同一 list 中取得相同的項目(且恰好" "使用完全相同的引數),你確實會擁有對回傳物件的參照。" -#: ../../c-api/intro.rst:497 +#: ../../c-api/intro.rst:485 msgid "" "Here is an example of how you could write a function that computes the sum " "of the items in a list of integers; once using :c:func:`PyList_GetItem`, " "and once using :c:func:`PySequence_GetItem`. ::" msgstr "" -"以下是一個範例,說明如何編寫函式來計算一個整數 list 中項目的總和;一次使用 :" -"c:func:`PyList_GetItem`,一次使用 :c:func:`PySequence_GetItem`: ::" +"以下是一個範例,說明如何編寫函式來計算一個整數 list 中項目的總和;一次使" +"用 :c:func:`PyList_GetItem`,一次使用 :c:func:`PySequence_GetItem`: ::" -#: ../../c-api/intro.rst:501 +#: ../../c-api/intro.rst:489 msgid "" "long\n" "sum_list(PyObject *list)\n" @@ -875,7 +854,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/intro.rst:527 +#: ../../c-api/intro.rst:515 msgid "" "long\n" "sum_sequence(PyObject *sequence)\n" @@ -906,26 +885,26 @@ msgid "" "}" msgstr "" -#: ../../c-api/intro.rst:561 +#: ../../c-api/intro.rst:549 msgid "Types" msgstr "型別" -#: ../../c-api/intro.rst:563 +#: ../../c-api/intro.rst:551 msgid "" "There are few other data types that play a significant role in the Python/C " -"API; most are simple C types such as :c:expr:`int`, :c:expr:`long`, :c:expr:" -"`double` and :c:expr:`char*`. A few structure types are used to describe " -"static tables used to list the functions exported by a module or the data " -"attributes of a new object type, and another is used to describe the value " -"of a complex number. These will be discussed together with the functions " -"that use them." +"API; most are simple C types such " +"as :c:expr:`int`, :c:expr:`long`, :c:expr:`double` and :c:expr:`char*`. A " +"few structure types are used to describe static tables used to list the " +"functions exported by a module or the data attributes of a new object type, " +"and another is used to describe the value of a complex number. These will " +"be discussed together with the functions that use them." msgstr "" "有少數幾個其他的資料型別在 Python/C API 中發揮重要作用;大多數是簡單的 C 型" "別,例如 :c:expr:`int`、:c:expr:`long`、:c:expr:`double` 和 :c:expr:`char*`。" "一些結構型別被用於描述用於列出模組所匯出的函式或新物件型別的資料屬性的靜態" "表,其他則用於描述複數的值。這些將與使用它們的函式一起討論。" -#: ../../c-api/intro.rst:573 +#: ../../c-api/intro.rst:561 msgid "" "A signed integral type such that ``sizeof(Py_ssize_t) == sizeof(size_t)``. " "C99 doesn't define such a thing directly (size_t is an unsigned integral " @@ -933,14 +912,14 @@ msgid "" "positive value of type :c:type:`Py_ssize_t`." msgstr "" "一個帶符號的整數型別,使得 ``sizeof(Py_ssize_t) == sizeof(size_t)``。 C99 沒" -"有直接定義這樣的東西(size_t 是無符號整數型別)。有關詳細資訊,請參閱 :pep:" -"`353`。 ``PY_SSIZE_T_MAX`` 是 :c:type:`Py_ssize_t` 型別的最大正值。" +"有直接定義這樣的東西(size_t 是無符號整數型別)。有關詳細資訊,請參" +"閱 :pep:`353`。 ``PY_SSIZE_T_MAX`` 是 :c:type:`Py_ssize_t` 型別的最大正值。" -#: ../../c-api/intro.rst:582 +#: ../../c-api/intro.rst:570 msgid "Exceptions" msgstr "例外" -#: ../../c-api/intro.rst:584 +#: ../../c-api/intro.rst:572 msgid "" "The Python programmer only needs to deal with exceptions if specific error " "handling is required; unhandled exceptions are automatically propagated to " @@ -952,7 +931,7 @@ msgstr "" "給呼叫者,然後傳遞給呼叫者的呼叫者,依此類推,直到它們到達頂層直譯器,在那裡" "它們透過堆疊回溯 (stack trace) 回報給使用者。" -#: ../../c-api/intro.rst:592 +#: ../../c-api/intro.rst:580 msgid "" "For C programmers, however, error checking always has to be explicit. All " "functions in the Python/C API can raise exceptions, unless an explicit claim " @@ -974,36 +953,36 @@ msgstr "" "確的錯誤指示器或者有不明確的回傳值,而需要使用 :c:func:`PyErr_Occurred` 明確" "測試錯誤。這些例外都會被明確地記錄於文件。" -#: ../../c-api/intro.rst:607 +#: ../../c-api/intro.rst:595 msgid "" "Exception state is maintained in per-thread storage (this is equivalent to " "using global storage in an unthreaded application). A thread can be in one " -"of two states: an exception has occurred, or not. The function :c:func:" -"`PyErr_Occurred` can be used to check for this: it returns a borrowed " -"reference to the exception type object when an exception has occurred, and " -"``NULL`` otherwise. There are a number of functions to set the exception " -"state: :c:func:`PyErr_SetString` is the most common (though not the most " -"general) function to set the exception state, and :c:func:`PyErr_Clear` " -"clears the exception state." +"of two states: an exception has occurred, or not. The " +"function :c:func:`PyErr_Occurred` can be used to check for this: it returns " +"a borrowed reference to the exception type object when an exception has " +"occurred, and ``NULL`` otherwise. There are a number of functions to set " +"the exception state: :c:func:`PyErr_SetString` is the most common (though " +"not the most general) function to set the exception state, " +"and :c:func:`PyErr_Clear` clears the exception state." msgstr "" "例外的狀態會在個別執行緒的儲存空間 (per-thread storage) 中維護(這相當於在非" "執行緒應用程式中使用全域儲存空間)。執行緒可以處於兩種狀態之一:發生例外或未" "發生例外。函式 :c:func:`PyErr_Occurred` 可用於檢查這一點:當例外發生時,它回" -"傳對例外型別物件的借用參照,否則回傳 ``NULL``。設定例外狀態的函式有很多::c:" -"func:`PyErr_SetString` 是最常見的(儘管不是最通用的)設定例外狀態的函式,而 :" -"c:func:`PyErr_Clear` 是用來清除例外狀態。" +"傳對例外型別物件的借用參照,否則回傳 ``NULL``。設定例外狀態的函式有很" +"多::c:func:`PyErr_SetString` 是最常見的(儘管不是最通用的)設定例外狀態的函" +"式,而 :c:func:`PyErr_Clear` 是用來清除例外狀態。" -#: ../../c-api/intro.rst:617 +#: ../../c-api/intro.rst:605 msgid "" "The full exception state consists of three objects (all of which can be " "``NULL``): the exception type, the corresponding exception value, and the " -"traceback. These have the same meanings as the Python result of ``sys." -"exc_info()``; however, they are not the same: the Python objects represent " -"the last exception being handled by a Python :keyword:`try` ... :keyword:" -"`except` statement, while the C level exception state only exists while an " -"exception is being passed on between C functions until it reaches the Python " -"bytecode interpreter's main loop, which takes care of transferring it to " -"``sys.exc_info()`` and friends." +"traceback. These have the same meanings as the Python result of " +"``sys.exc_info()``; however, they are not the same: the Python objects " +"represent the last exception being handled by a " +"Python :keyword:`try` ... :keyword:`except` statement, while the C level " +"exception state only exists while an exception is being passed on between C " +"functions until it reaches the Python bytecode interpreter's main loop, " +"which takes care of transferring it to ``sys.exc_info()`` and friends." msgstr "" "完整的例外狀態由三個(都可以為 ``NULL`` 的)物件組成:例外型別、對應的例外值" "和回溯。這些與 ``sys.exc_info()`` 的 Python 結果具有相同的含義;但是它們並不" @@ -1012,18 +991,18 @@ msgstr "" "達 Python 位元組碼直譯器的主迴圈,該迴圈負責將它傳遞給 ``sys.exc_info()`` 和" "其系列函式。" -#: ../../c-api/intro.rst:629 +#: ../../c-api/intro.rst:617 msgid "" "Note that starting with Python 1.5, the preferred, thread-safe way to access " -"the exception state from Python code is to call the function :func:`sys." -"exc_info`, which returns the per-thread exception state for Python code. " -"Also, the semantics of both ways to access the exception state have changed " -"so that a function which catches an exception will save and restore its " -"thread's exception state so as to preserve the exception state of its " -"caller. This prevents common bugs in exception handling code caused by an " -"innocent-looking function overwriting the exception being handled; it also " -"reduces the often unwanted lifetime extension for objects that are " -"referenced by the stack frames in the traceback." +"the exception state from Python code is to call the " +"function :func:`sys.exc_info`, which returns the per-thread exception state " +"for Python code. Also, the semantics of both ways to access the exception " +"state have changed so that a function which catches an exception will save " +"and restore its thread's exception state so as to preserve the exception " +"state of its caller. This prevents common bugs in exception handling code " +"caused by an innocent-looking function overwriting the exception being " +"handled; it also reduces the often unwanted lifetime extension for objects " +"that are referenced by the stack frames in the traceback." msgstr "" "請注意,從 Python 1.5 開始,從 Python 程式碼存取例外狀態的首選且支援執行緒安" "全的方法是呼叫 :func:`sys.exc_info` 函式,它回傳 Python 程式碼的個別執行緒例" @@ -1032,7 +1011,7 @@ msgstr "" "式碼中的常見錯誤,這些錯誤是由看似無辜的函式覆蓋了正在處理的例外而引起的;它" "還替回溯中被堆疊幀 (stack frame) 參照的物件減少了通常不需要的生命週期延長。" -#: ../../c-api/intro.rst:640 +#: ../../c-api/intro.rst:628 msgid "" "As a general principle, a function that calls another function to perform " "some task should check whether the called function raised an exception, and " @@ -1047,7 +1026,7 @@ msgstr "" "並回傳一個錯誤指示符,但它\\ *不應該*\\ 設定另一個例外 --- 這將覆蓋剛剛引發的" "例外,並丟失關於錯誤確切原因的重要資訊。" -#: ../../c-api/intro.rst:649 +#: ../../c-api/intro.rst:637 msgid "" "A simple example of detecting exceptions and passing them on is shown in " "the :c:func:`!sum_sequence` example above. It so happens that this example " @@ -1059,7 +1038,7 @@ msgstr "" "巧這個例子在檢測到錯誤時不需要清理任何擁有的參照。以下範例函式展示了一些錯誤" "清理。首先,為了提醒你為什麼喜歡 Python,我們展示了等效的 Python 程式碼: ::" -#: ../../c-api/intro.rst:655 +#: ../../c-api/intro.rst:643 msgid "" "def incr_item(dict, key):\n" " try:\n" @@ -1069,11 +1048,11 @@ msgid "" " dict[key] = item + 1" msgstr "" -#: ../../c-api/intro.rst:664 +#: ../../c-api/intro.rst:652 msgid "Here is the corresponding C code, in all its glory::" msgstr "這是相應的 C 程式碼:" -#: ../../c-api/intro.rst:666 +#: ../../c-api/intro.rst:654 msgid "" "int\n" "incr_item(PyObject *dict, PyObject *key)\n" @@ -1119,30 +1098,31 @@ msgid "" "}" msgstr "" -#: ../../c-api/intro.rst:716 +#: ../../c-api/intro.rst:704 msgid "" "This example represents an endorsed use of the ``goto`` statement in C! It " -"illustrates the use of :c:func:`PyErr_ExceptionMatches` and :c:func:" -"`PyErr_Clear` to handle specific exceptions, and the use of :c:func:" -"`Py_XDECREF` to dispose of owned references that may be ``NULL`` (note the " -"``'X'`` in the name; :c:func:`Py_DECREF` would crash when confronted with a " -"``NULL`` reference). It is important that the variables used to hold owned " -"references are initialized to ``NULL`` for this to work; likewise, the " -"proposed return value is initialized to ``-1`` (failure) and only set to " -"success after the final call made is successful." -msgstr "" -"這個例子代表了在 C 語言中對使用 ``goto`` 陳述句的認同!它闡述了以 :c:func:" -"`PyErr_ExceptionMatches` 和 :c:func:`PyErr_Clear` 來處理特定的例外,以及以 :" -"c:func:`Py_XDECREF` 來配置其所擁有且可能為 ``NULL`` 的參照(注意名稱中的 " -"``'X'``\\ ;:c:func:`Py_DECREF` 在遇到 ``NULL`` 參照時會崩潰)。重要的是,用" -"於保存擁有的參照的變數被初始化為 ``NULL`` 以使其能夠順利作用;同樣地,回傳值" -"被初始化為 ``-1``\\ (失敗),並且僅在最後一次呼叫成功後才設定為成功。" - -#: ../../c-api/intro.rst:730 +"illustrates the use of :c:func:`PyErr_ExceptionMatches` " +"and :c:func:`PyErr_Clear` to handle specific exceptions, and the use " +"of :c:func:`Py_XDECREF` to dispose of owned references that may be ``NULL`` " +"(note the ``'X'`` in the name; :c:func:`Py_DECREF` would crash when " +"confronted with a ``NULL`` reference). It is important that the variables " +"used to hold owned references are initialized to ``NULL`` for this to work; " +"likewise, the proposed return value is initialized to ``-1`` (failure) and " +"only set to success after the final call made is successful." +msgstr "" +"這個例子代表了在 C 語言中對使用 ``goto`` 陳述句的認同!它闡述了" +"以 :c:func:`PyErr_ExceptionMatches` 和 :c:func:`PyErr_Clear` 來處理特定的例" +"外,以及以 :c:func:`Py_XDECREF` 來配置其所擁有且可能為 ``NULL`` 的參照(注意" +"名稱中的 ``'X'``\\ ;:c:func:`Py_DECREF` 在遇到 ``NULL`` 參照時會崩潰)。重要" +"的是,用於保存擁有的參照的變數被初始化為 ``NULL`` 以使其能夠順利作用;同樣" +"地,回傳值被初始化為 ``-1``\\ (失敗),並且僅在最後一次呼叫成功後才設定為成" +"功。" + +#: ../../c-api/intro.rst:718 msgid "Embedding Python" msgstr "嵌入式Python" -#: ../../c-api/intro.rst:732 +#: ../../c-api/intro.rst:720 msgid "" "The one important task that only embedders (as opposed to extension writers) " "of the Python interpreter have to worry about is the initialization, and " @@ -1152,7 +1132,7 @@ msgstr "" "只有 Python 直譯器的嵌入者(而不是擴充編寫者)需要擔心的一項重要任務是 " "Python 直譯器的初始化與完成階段。直譯器的大部分功能只能在直譯器初始化後使用。" -#: ../../c-api/intro.rst:745 +#: ../../c-api/intro.rst:733 msgid "" "The basic initialization function is :c:func:`Py_Initialize`. This " "initializes the table of loaded modules, and creates the fundamental " @@ -1163,19 +1143,20 @@ msgstr "" "立基礎模組 :mod:`builtins`、:mod:`__main__` 和 :mod:`sys`。它還會初始化模組搜" "索路徑 (``sys.path``)。" -#: ../../c-api/intro.rst:750 +#: ../../c-api/intro.rst:738 msgid "" -":c:func:`Py_Initialize` does not set the \"script argument list\" (``sys." -"argv``). If this variable is needed by Python code that will be executed " -"later, setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` " -"must be set: see :ref:`Python Initialization Configuration `." +":c:func:`Py_Initialize` does not set the \"script argument list\" " +"(``sys.argv``). If this variable is needed by Python code that will be " +"executed later, setting :c:member:`PyConfig.argv` " +"and :c:member:`PyConfig.parse_argv` must be set: see :ref:`Python " +"Initialization Configuration `." msgstr "" -":c:func:`Py_Initialize` 不設定「腳本引數列表 (script argument list)」 (``sys." -"argv``)。如果稍後將要執行的 Python 程式碼需要此變數,則必須設定 :c:member:" -"`PyConfig.argv` 和 :c:member:`PyConfig.parse_argv`,請見 :ref:`Python 初始化" -"配置 `。" +":c:func:`Py_Initialize` 不設定「腳本引數列表 (script argument list)」 " +"(``sys.argv``)。如果稍後將要執行的 Python 程式碼需要此變數,則必須設" +"定 :c:member:`PyConfig.argv` 和 :c:member:`PyConfig.parse_argv`,請" +"見 :ref:`Python 初始化配置 `。" -#: ../../c-api/intro.rst:755 +#: ../../c-api/intro.rst:743 msgid "" "On most systems (in particular, on Unix and Windows, although the details " "are slightly different), :c:func:`Py_Initialize` calculates the module " @@ -1186,73 +1167,75 @@ msgid "" "to the parent directory where the executable named :file:`python` is found " "on the shell command search path (the environment variable :envvar:`PATH`)." msgstr "" -"在大多數系統上(特別是在 Unix 和 Windows 上,儘管細節略有不同),:c:func:" -"`Py_Initialize` 會假設Python 函式庫相對於 Python 直譯器可執行檔案的位置固定," -"並根據其對標準 Python 直譯器可執行檔案位置的最佳猜測來計算模組搜尋路徑。或者" -"更詳細地說,它會在 shell 命令搜尋路徑(環境變數 :envvar:`PATH`)中找到名為 :" -"file:`python` 的可執行檔案,並在其父目錄中查找一個名為 :file:`lib/python{X.Y}" -"` 的目錄的相對位置。" +"在大多數系統上(特別是在 Unix 和 Windows 上,儘管細節略有不" +"同),:c:func:`Py_Initialize` 會假設Python 函式庫相對於 Python 直譯器可執行檔" +"案的位置固定,並根據其對標準 Python 直譯器可執行檔案位置的最佳猜測來計算模組" +"搜尋路徑。或者更詳細地說,它會在 shell 命令搜尋路徑(環境變" +"數 :envvar:`PATH`)中找到名為 :file:`python` 的可執行檔案,並在其父目錄中查找" +"一個名為 :file:`lib/python{X.Y}` 的目錄的相對位置。" -#: ../../c-api/intro.rst:764 +#: ../../c-api/intro.rst:752 msgid "" "For instance, if the Python executable is found in :file:`/usr/local/bin/" "python`, it will assume that the libraries are in :file:`/usr/local/lib/" "python{X.Y}`. (In fact, this particular path is also the \"fallback\" " -"location, used when no executable file named :file:`python` is found along :" -"envvar:`PATH`.) The user can override this behavior by setting the " +"location, used when no executable file named :file:`python` is found " +"along :envvar:`PATH`.) The user can override this behavior by setting the " "environment variable :envvar:`PYTHONHOME`, or insert additional directories " "in front of the standard path by setting :envvar:`PYTHONPATH`." msgstr "" "例如,如果在 :file:`/usr/local/bin/python` 中找到 Python 可執行檔案,它將假定" "函式庫位於 :file:`/usr/local/lib/python{X.Y}` 中。(事實上這個特定的路徑也是" "「後備 (fallback)」位置,當在 :envvar:`PATH` 中找不到名為 :file:`python` 的可" -"執行檔案時使用。)使用者可以透過設定環境變數來覆蓋此行為 :envvar:" -"`PYTHONHOME`,或者透過設定 :envvar:`PYTHONPATH` 在標準路徑前面插入額外的目" -"錄。" - -#: ../../c-api/intro.rst:778 -msgid "" -"The embedding application can steer the search by setting :c:member:" -"`PyConfig.program_name` *before* calling :c:func:`Py_InitializeFromConfig`. " -"Note that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` " -"is still inserted in front of the standard path. An application that " -"requires total control has to provide its own implementation of :c:func:" -"`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, and :c:" -"func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`)." -msgstr "" -"嵌入的應用程式可以透過在呼叫 :c:func:`Py_InitializeFromConfig` *之前*\\ 設定 " -":c:member:`PyConfig.program_name` 來引導搜尋。請注意 :envvar:`PYTHONHOME` 仍然覆蓋" -"它並且 :envvar:`PYTHONPATH` 仍然插入在標準路徑的前面。需要完全控制權的應用程" -"式必須實作自己的 :c:func:`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:" -"`Py_GetExecPrefix` 和 :c:func:`Py_GetProgramFullPath`\\(全部定義在 :file:" -"`Modules/getpath.c`)。" - -#: ../../c-api/intro.rst:789 +"執行檔案時使用。)使用者可以透過設定環境變數來覆蓋此行" +"為 :envvar:`PYTHONHOME`,或者透過設定 :envvar:`PYTHONPATH` 在標準路徑前面插入" +"額外的目錄。" + +#: ../../c-api/intro.rst:766 +msgid "" +"The embedding application can steer the search by " +"setting :c:member:`PyConfig.program_name` *before* " +"calling :c:func:`Py_InitializeFromConfig`. Note that :envvar:`PYTHONHOME` " +"still overrides this and :envvar:`PYTHONPATH` is still inserted in front of " +"the standard path. An application that requires total control has to " +"provide its own implementation " +"of :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, " +"and :c:func:`Py_GetProgramFullPath` (all defined in :file:`Modules/" +"getpath.c`)." +msgstr "" +"嵌入的應用程式可以透過在呼叫 :c:func:`Py_InitializeFromConfig` *之前*\\ 設" +"定 :c:member:`PyConfig.program_name` 來引導搜尋。請注意 :envvar:`PYTHONHOME` " +"仍然覆蓋它並且 :envvar:`PYTHONPATH` 仍然插入在標準路徑的前面。需要完全控制權" +"的應用程式必須實作自己" +"的 :c:func:`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:`Py_GetExecPrefix` " +"和 :c:func:`Py_GetProgramFullPath`\\(全部定義在 :file:`Modules/getpath.c`)。" + +#: ../../c-api/intro.rst:777 msgid "" "Sometimes, it is desirable to \"uninitialize\" Python. For instance, the " -"application may want to start over (make another call to :c:func:" -"`Py_Initialize`) or the application is simply done with its use of Python " -"and wants to free memory allocated by Python. This can be accomplished by " -"calling :c:func:`Py_FinalizeEx`. The function :c:func:`Py_IsInitialized` " -"returns true if Python is currently in the initialized state. More " -"information about these functions is given in a later chapter. Notice that :" -"c:func:`Py_FinalizeEx` does *not* free all memory allocated by the Python " -"interpreter, e.g. memory allocated by extension modules currently cannot be " -"released." +"application may want to start over (make another call " +"to :c:func:`Py_Initialize`) or the application is simply done with its use " +"of Python and wants to free memory allocated by Python. This can be " +"accomplished by calling :c:func:`Py_FinalizeEx`. The " +"function :c:func:`Py_IsInitialized` returns true if Python is currently in " +"the initialized state. More information about these functions is given in a " +"later chapter. Notice that :c:func:`Py_FinalizeEx` does *not* free all " +"memory allocated by the Python interpreter, e.g. memory allocated by " +"extension modules currently cannot be released." msgstr "" "有時會希望能夠「取消初始化 (uninitialize)」Python。例如,應用程式可能想要重新" "開始(再次呼叫 :c:func:`Py_Initialize`)或者應用程式簡單地完成了對 Python 的" "使用並想要釋放 Python 分配的記憶體。這可以透過呼叫 :c:func:`Py_FinalizeEx` 來" "完成。如果 Python 目前處於初始化狀態,函式 :c:func:`Py_IsInitialized` 會回傳 " -"true。有關這些功能的更多資訊將在後面的章節中給出。請注意 :c:func:" -"`Py_FinalizeEx` *不會*\\ 釋放由 Python 直譯器分配的所有記憶體,例如目前無法釋" -"放被擴充模組所分配的記憶體。" +"true。有關這些功能的更多資訊將在後面的章節中給出。請注" +"意 :c:func:`Py_FinalizeEx` *不會*\\ 釋放由 Python 直譯器分配的所有記憶體,例" +"如目前無法釋放被擴充模組所分配的記憶體。" -#: ../../c-api/intro.rst:803 +#: ../../c-api/intro.rst:791 msgid "Debugging Builds" msgstr "除錯建置" -#: ../../c-api/intro.rst:805 +#: ../../c-api/intro.rst:793 msgid "" "Python can be built with several macros to enable extra checks of the " "interpreter and extension modules. These checks tend to add a large amount " @@ -1261,36 +1244,36 @@ msgstr "" "Python 可以在建置時使用多個巨集來啟用對直譯器和擴充模組的額外檢查,這些檢查往" "往會在執行環境 (runtime) 增加大量開銷 (overhead),因此預設情況下不啟用它們。" -#: ../../c-api/intro.rst:809 +#: ../../c-api/intro.rst:797 msgid "" -"A full list of the various types of debugging builds is in the file :file:" -"`Misc/SpecialBuilds.txt` in the Python source distribution. Builds are " -"available that support tracing of reference counts, debugging the memory " -"allocator, or low-level profiling of the main interpreter loop. Only the " -"most frequently used builds will be described in the remainder of this " +"A full list of the various types of debugging builds is in the " +"file :file:`Misc/SpecialBuilds.txt` in the Python source distribution. " +"Builds are available that support tracing of reference counts, debugging the " +"memory allocator, or low-level profiling of the main interpreter loop. Only " +"the most frequently used builds will be described in the remainder of this " "section." msgstr "" "Python 原始碼發佈版本中的 :file:`Misc/SpecialBuilds.txt` 檔案有一份包含多種除" "錯構置的完整列表,為支援追蹤參照計數、為記憶體分配器除錯或對主直譯器迴圈進行" "低階分析的建置。本節的其餘部分將僅描述最常用的建置。" -#: ../../c-api/intro.rst:817 +#: ../../c-api/intro.rst:805 msgid "" "Compiling the interpreter with the :c:macro:`!Py_DEBUG` macro defined " "produces what is generally meant by :ref:`a debug build of Python `. :c:macro:`!Py_DEBUG` is enabled in the Unix build by adding :option:" -"`--with-pydebug` to the :file:`./configure` command. It is also implied by " -"the presence of the not-Python-specific :c:macro:`!_DEBUG` macro. When :c:" -"macro:`!Py_DEBUG` is enabled in the Unix build, compiler optimization is " -"disabled." +"build>`. :c:macro:`!Py_DEBUG` is enabled in the Unix build by " +"adding :option:`--with-pydebug` to the :file:`./configure` command. It is " +"also implied by the presence of the not-Python-specific :c:macro:`!_DEBUG` " +"macro. When :c:macro:`!Py_DEBUG` is enabled in the Unix build, compiler " +"optimization is disabled." msgstr "" "使用定義的 :c:macro:`!Py_DEBUG` 巨集編譯直譯器會生成 :ref:`Python 的除錯建置 " "`。 :c:macro:`!Py_DEBUG` 在 Unix 建置中要透過在 :file:`./" -"configure` 命令中加入 :option:`--with-pydebug` 來啟用。非 Python 限定的 :c:" -"macro:`!_DEBUG` 巨集的存在也暗示了這一點。當 :c:macro:`!Py_DEBUG` 在 Unix 建" -"置中啟用時,編譯器最佳化會被禁用。" +"configure` 命令中加入 :option:`--with-pydebug` 來啟用。非 Python 限定" +"的 :c:macro:`!_DEBUG` 巨集的存在也暗示了這一點。當 :c:macro:`!Py_DEBUG` 在 " +"Unix 建置中啟用時,編譯器最佳化會被禁用。" -#: ../../c-api/intro.rst:825 +#: ../../c-api/intro.rst:813 msgid "" "In addition to the reference count debugging described below, extra checks " "are performed, see :ref:`Python Debug Build `." @@ -1298,72 +1281,72 @@ msgstr "" "除了下面描述的參照計數除錯之外,還會執行額外的檢查,請參閱 :ref:`Python 除錯" "建置 `。" -#: ../../c-api/intro.rst:828 +#: ../../c-api/intro.rst:816 msgid "" -"Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see the :option:" -"`configure --with-trace-refs option <--with-trace-refs>`). When defined, a " -"circular doubly linked list of active objects is maintained by adding two " -"extra fields to every :c:type:`PyObject`. Total allocations are tracked as " -"well. Upon exit, all existing references are printed. (In interactive mode " -"this happens after every statement run by the interpreter.)" +"Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see " +"the :option:`configure --with-trace-refs option <--with-trace-refs>`). When " +"defined, a circular doubly linked list of active objects is maintained by " +"adding two extra fields to every :c:type:`PyObject`. Total allocations are " +"tracked as well. Upon exit, all existing references are printed. (In " +"interactive mode this happens after every statement run by the interpreter.)" msgstr "" "定義 :c:macro:`Py_TRACE_REFS` 來啟用參照追蹤(參見\\ :option:`設定 --with-" -"trace-refs 選項 <--with-trace-refs>`)。當有定義時,透過向每個 :c:type:" -"`PyObject` 新增兩個額外欄位來維護有效物件的循環雙向鍊表 (circular doubly " -"linked list)。全體分配也有被追蹤。退出時將印出所有現行參照。(在交互模式下," -"這發生在直譯器運行的每個陳述句之後。)" +"trace-refs 選項 <--with-trace-refs>`)。當有定義時,透過向每" +"個 :c:type:`PyObject` 新增兩個額外欄位來維護有效物件的循環雙向鍊表 (circular " +"doubly linked list)。全體分配也有被追蹤。退出時將印出所有現行參照。(在交互模" +"式下,這發生在直譯器運行的每個陳述句之後。)" -#: ../../c-api/intro.rst:835 +#: ../../c-api/intro.rst:823 msgid "" "Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source " "distribution for more detailed information." msgstr "" -"有關更多詳細資訊,請參閱 Python 原始碼發布版中的 :file:`Misc/SpecialBuilds." -"txt`。" +"有關更多詳細資訊,請參閱 Python 原始碼發布版中的 :file:`Misc/" +"SpecialBuilds.txt`。" -#: ../../c-api/intro.rst:842 +#: ../../c-api/intro.rst:830 msgid "Recommended third party tools" msgstr "" -#: ../../c-api/intro.rst:844 +#: ../../c-api/intro.rst:832 msgid "" "The following third party tools offer both simpler and more sophisticated " "approaches to creating C, C++ and Rust extensions for Python:" msgstr "" -#: ../../c-api/intro.rst:847 +#: ../../c-api/intro.rst:835 msgid "`Cython `_" msgstr "" -#: ../../c-api/intro.rst:848 +#: ../../c-api/intro.rst:836 msgid "`cffi `_" msgstr "" -#: ../../c-api/intro.rst:849 +#: ../../c-api/intro.rst:837 msgid "`HPy `_" msgstr "" -#: ../../c-api/intro.rst:850 +#: ../../c-api/intro.rst:838 msgid "`nanobind `_ (C++)" msgstr "" -#: ../../c-api/intro.rst:851 +#: ../../c-api/intro.rst:839 msgid "`Numba `_" msgstr "" -#: ../../c-api/intro.rst:852 +#: ../../c-api/intro.rst:840 msgid "`pybind11 `_ (C++)" msgstr "" -#: ../../c-api/intro.rst:853 +#: ../../c-api/intro.rst:841 msgid "`PyO3 `_ (Rust)" msgstr "" -#: ../../c-api/intro.rst:854 +#: ../../c-api/intro.rst:842 msgid "`SWIG `_" msgstr "" -#: ../../c-api/intro.rst:856 +#: ../../c-api/intro.rst:844 msgid "" "Using tools such as these can help avoid writing code that is tightly bound " "to a particular version of CPython, avoid reference counting errors, and " @@ -1374,7 +1357,7 @@ msgid "" "sources." msgstr "" -#: ../../c-api/intro.rst:863 +#: ../../c-api/intro.rst:851 msgid "" "These projects are not supported by the same people who maintain Python, and " "issues need to be raised with the projects directly. Remember to check that " @@ -1382,142 +1365,167 @@ msgid "" "outdated." msgstr "" -#: ../../c-api/intro.rst:870 +#: ../../c-api/intro.rst:858 msgid "" -"`Python Packaging User Guide: Binary Extensions `_" +"`Python Packaging User Guide: Binary Extensions `_" msgstr "" -#: ../../c-api/intro.rst:871 +#: ../../c-api/intro.rst:859 msgid "" "The Python Packaging User Guide not only covers several available tools that " "simplify the creation of binary extensions, but also discusses the various " "reasons why creating an extension module may be desirable in the first place." msgstr "" -#: ../../c-api/intro.rst:288 +#: ../../c-api/intro.rst:276 msgid "object" msgstr "object(物件)" -#: ../../c-api/intro.rst:288 +#: ../../c-api/intro.rst:276 msgid "type" msgstr "type(型別)" -#: ../../c-api/intro.rst:327 +#: ../../c-api/intro.rst:315 msgid "Py_INCREF (C function)" msgstr "Py_INCREF(C 函式)" -#: ../../c-api/intro.rst:327 +#: ../../c-api/intro.rst:315 msgid "Py_DECREF (C function)" msgstr "Py_DECREF(C 函式)" -#: ../../c-api/intro.rst:403 +#: ../../c-api/intro.rst:391 msgid "PyList_SetItem (C function)" msgstr "PyList_SetItem(C 函式)" -#: ../../c-api/intro.rst:403 +#: ../../c-api/intro.rst:391 msgid "PyTuple_SetItem (C function)" msgstr "PyTuple_SetItem(C 函式)" -#: ../../c-api/intro.rst:474 +#: ../../c-api/intro.rst:462 msgid "set_all()" msgstr "set_all()" -#: ../../c-api/intro.rst:493 +#: ../../c-api/intro.rst:481 msgid "PyList_GetItem (C function)" msgstr "PyList_GetItem(C 函式)" -#: ../../c-api/intro.rst:493 +#: ../../c-api/intro.rst:481 msgid "PySequence_GetItem (C function)" msgstr "PySequence_GetItem(C 函式)" -#: ../../c-api/intro.rst:523 +#: ../../c-api/intro.rst:511 msgid "sum_list()" msgstr "sum_list()" -#: ../../c-api/intro.rst:555 ../../c-api/intro.rst:647 +#: ../../c-api/intro.rst:543 ../../c-api/intro.rst:635 msgid "sum_sequence()" msgstr "sum_sequence()" -#: ../../c-api/intro.rst:590 +#: ../../c-api/intro.rst:578 msgid "PyErr_Occurred (C function)" msgstr "PyErr_Occurred(C 函式)" -#: ../../c-api/intro.rst:603 +#: ../../c-api/intro.rst:591 msgid "PyErr_SetString (C function)" msgstr "PyErr_SetString(C 函式)" -#: ../../c-api/intro.rst:603 ../../c-api/intro.rst:711 +#: ../../c-api/intro.rst:591 ../../c-api/intro.rst:699 msgid "PyErr_Clear (C function)" msgstr "PyErr_Clear(C 函式)" -#: ../../c-api/intro.rst:627 +#: ../../c-api/intro.rst:615 msgid "exc_info (in module sys)" msgstr "exc_info (sys 模組中)" -#: ../../c-api/intro.rst:662 ../../c-api/intro.rst:709 +#: ../../c-api/intro.rst:650 ../../c-api/intro.rst:697 msgid "incr_item()" msgstr "incr_item()" -#: ../../c-api/intro.rst:711 +#: ../../c-api/intro.rst:699 msgid "PyErr_ExceptionMatches (C function)" msgstr "PyErr_ExceptionMatches(C 函式)" -#: ../../c-api/intro.rst:711 +#: ../../c-api/intro.rst:699 msgid "Py_XDECREF (C function)" msgstr "Py_XDECREF(C 函式)" -#: ../../c-api/intro.rst:737 +#: ../../c-api/intro.rst:725 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/intro.rst:737 +#: ../../c-api/intro.rst:725 msgid "module" msgstr "module(模組)" -#: ../../c-api/intro.rst:737 +#: ../../c-api/intro.rst:725 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/intro.rst:737 +#: ../../c-api/intro.rst:725 msgid "__main__" msgstr "__main__" -#: ../../c-api/intro.rst:737 +#: ../../c-api/intro.rst:725 msgid "sys" msgstr "sys" -#: ../../c-api/intro.rst:737 +#: ../../c-api/intro.rst:725 msgid "search" msgstr "search(搜尋)" -#: ../../c-api/intro.rst:737 +#: ../../c-api/intro.rst:725 msgid "path" msgstr "path(路徑)" -#: ../../c-api/intro.rst:737 +#: ../../c-api/intro.rst:725 msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/intro.rst:772 +#: ../../c-api/intro.rst:760 msgid "Py_GetPath (C function)" msgstr "Py_GetPath(C 函式)" -#: ../../c-api/intro.rst:772 +#: ../../c-api/intro.rst:760 msgid "Py_GetPrefix (C function)" msgstr "Py_GetPrefix(C 函式)" -#: ../../c-api/intro.rst:772 +#: ../../c-api/intro.rst:760 msgid "Py_GetExecPrefix (C function)" msgstr "Py_GetExecPrefix(C 函式)" -#: ../../c-api/intro.rst:772 +#: ../../c-api/intro.rst:760 msgid "Py_GetProgramFullPath (C function)" msgstr "Py_GetProgramFullPath(C 函式)" -#: ../../c-api/intro.rst:787 +#: ../../c-api/intro.rst:775 msgid "Py_IsInitialized (C function)" msgstr "Py_IsInitialized(C 函式)" +#~ msgid "" +#~ "static struct PyModuleDef spam_module = {\n" +#~ " .m_base = PyModuleDef_HEAD_INIT,\n" +#~ " .m_name = \"spam\",\n" +#~ " ...\n" +#~ "};\n" +#~ "\n" +#~ "PyMODINIT_FUNC\n" +#~ "PyInit_spam(void)\n" +#~ "{\n" +#~ " return PyModuleDef_Init(&spam_module);\n" +#~ "}" +#~ msgstr "" +#~ "static struct PyModuleDef spam_module = {\n" +#~ " .m_base = PyModuleDef_HEAD_INIT,\n" +#~ " .m_name = \"spam\",\n" +#~ " ...\n" +#~ "};\n" +#~ "\n" +#~ "PyMODINIT_FUNC\n" +#~ "PyInit_spam(void)\n" +#~ "{\n" +#~ " return PyModuleDef_Init(&spam_module);\n" +#~ "}" + #~ msgid "Py_SetProgramName (C function)" #~ msgstr "Py_SetProgramName(C 函式)" diff --git a/c-api/iter.po b/c-api/iter.po index 71d9e97f69d..fe89d62ab93 100644 --- a/c-api/iter.po +++ b/c-api/iter.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-07-01 03:44+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,14 +29,16 @@ msgid "There are two functions specifically for working with iterators." msgstr "有兩個專門用於疊代器的函式。" #: ../../c-api/iter.rst:12 +#, fuzzy msgid "" -"Return non-zero if the object *o* can be safely passed to :c:func:" -"`PyIter_Next`, and ``0`` otherwise. This function always succeeds." +"Return non-zero if the object *o* can be safely passed " +"to :c:func:`PyIter_NextItem` and ``0`` otherwise. This function always " +"succeeds." msgstr "" "如果物件 *o* 可以安全地傳遞給 :c:func:`PyIter_Next` 則回傳非零 (non-zero),否" "則回傳 0。這個函式一定會執行成功。" -#: ../../c-api/iter.rst:17 +#: ../../c-api/iter.rst:18 msgid "" "Return non-zero if the object *o* provides the :class:`AsyncIterator` " "protocol, and ``0`` otherwise. This function always succeeds." @@ -44,7 +46,21 @@ msgstr "" "如果物件 *o* 有提供 :class:`AsyncIterator` 協定,則回傳非零,否則回傳 0。這個" "函式一定會執行成功。" -#: ../../c-api/iter.rst:24 +#: ../../c-api/iter.rst:25 +msgid "" +"Return ``1`` and set *item* to a :term:`strong reference` of the next value " +"of the iterator *iter* on success. Return ``0`` and set *item* to ``NULL`` " +"if there are no remaining values. Return ``-1``, set *item* to ``NULL`` and " +"set an exception on error." +msgstr "" + +#: ../../c-api/iter.rst:34 +msgid "" +"This is an older version of :c:func:`!PyIter_NextItem`, which is retained " +"for backwards compatibility. Prefer :c:func:`PyIter_NextItem`." +msgstr "" + +#: ../../c-api/iter.rst:38 msgid "" "Return the next value from the iterator *o*. The object must be an iterator " "according to :c:func:`PyIter_Check` (it is up to the caller to check this). " @@ -56,82 +72,80 @@ msgstr "" "器(由呼叫者檢查)。如果沒有剩餘值,則回傳 ``NULL`` 且不設定例外。如果檢索項" "目時發生錯誤,則回傳 ``NULL`` 並傳遞例外。" -#: ../../c-api/iter.rst:30 -msgid "" -"To write a loop which iterates over an iterator, the C code should look " -"something like this::" -msgstr "要編寫一個疊代於疊代器的迴圈,C 程式碼應該會像這樣:" - -#: ../../c-api/iter.rst:33 -msgid "" -"PyObject *iterator = PyObject_GetIter(obj);\n" -"PyObject *item;\n" -"\n" -"if (iterator == NULL) {\n" -" /* propagate error */\n" -"}\n" -"\n" -"while ((item = PyIter_Next(iterator))) {\n" -" /* do something with item */\n" -" ...\n" -" /* release reference when done */\n" -" Py_DECREF(item);\n" -"}\n" -"\n" -"Py_DECREF(iterator);\n" -"\n" -"if (PyErr_Occurred()) {\n" -" /* propagate error */\n" -"}\n" -"else {\n" -" /* 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 +#: ../../c-api/iter.rst:46 msgid "" "The enum value used to represent different results of :c:func:`PyIter_Send`." msgstr "用於表示 :c:func:`PyIter_Send` 不同結果的列舉 (enum) 值。" -#: ../../c-api/iter.rst:66 +#: ../../c-api/iter.rst:53 msgid "Sends the *arg* value into the iterator *iter*. Returns:" msgstr "將 *arg* 值發送到疊代器 *iter* 中。回傳:" -#: ../../c-api/iter.rst:68 +#: ../../c-api/iter.rst:55 msgid "" "``PYGEN_RETURN`` if iterator returns. Return value is returned via *presult*." msgstr "如果疊代器有回傳則為 ``PYGEN_RETURN``。回傳值透過 *presult* 回傳。" -#: ../../c-api/iter.rst:69 +#: ../../c-api/iter.rst:56 msgid "" "``PYGEN_NEXT`` if iterator yields. Yielded value is returned via *presult*." msgstr "" "如果疊代器有產生 (yield) 則為 ``PYGEN_NEXT``。產生值透過 *presult* 回傳。" -#: ../../c-api/iter.rst:70 +#: ../../c-api/iter.rst:57 msgid "" "``PYGEN_ERROR`` if iterator has raised and exception. *presult* is set to " "``NULL``." msgstr "如果疊代器引發例外則為 ``PYGEN_ERROR``。 *presult* 被設定為 ``NULL``。" + +#~ msgid "" +#~ "To write a loop which iterates over an iterator, the C code should look " +#~ "something like this::" +#~ msgstr "要編寫一個疊代於疊代器的迴圈,C 程式碼應該會像這樣:" + +#~ msgid "" +#~ "PyObject *iterator = PyObject_GetIter(obj);\n" +#~ "PyObject *item;\n" +#~ "\n" +#~ "if (iterator == NULL) {\n" +#~ " /* propagate error */\n" +#~ "}\n" +#~ "\n" +#~ "while ((item = PyIter_Next(iterator))) {\n" +#~ " /* do something with item */\n" +#~ " ...\n" +#~ " /* release reference when done */\n" +#~ " Py_DECREF(item);\n" +#~ "}\n" +#~ "\n" +#~ "Py_DECREF(iterator);\n" +#~ "\n" +#~ "if (PyErr_Occurred()) {\n" +#~ " /* propagate error */\n" +#~ "}\n" +#~ "else {\n" +#~ " /* 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" +#~ "}" diff --git a/c-api/lifecycle.po b/c-api/lifecycle.po new file mode 100644 index 00000000000..cb4d6221aa9 --- /dev/null +++ b/c-api/lifecycle.po @@ -0,0 +1,365 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../c-api/lifecycle.rst:6 +msgid "Object Life Cycle" +msgstr "" + +#: ../../c-api/lifecycle.rst:8 +msgid "" +"This section explains how a type's slots relate to each other throughout the " +"life of an object. It is not intended to be a complete canonical reference " +"for the slots; instead, refer to the slot-specific documentation " +"in :ref:`type-structs` for details about a particular slot." +msgstr "" + +#: ../../c-api/lifecycle.rst:15 +msgid "Life Events" +msgstr "" + +#: ../../c-api/lifecycle.rst:17 +msgid "" +"The figure below illustrates the order of events that can occur throughout " +"an object's life. An arrow from *A* to *B* indicates that event *B* can " +"occur after event *A* has occurred, with the arrow's label indicating the " +"condition that must be true for *B* to occur after *A*." +msgstr "" + +#: ../../c-api/lifecycle.rst:55 ../../c-api/lifecycle.rst:62 +msgid "Diagram showing events in an object's life. Explained in detail below." +msgstr "" + +#: ../../c-api/lifecycle.rst:70 +msgid "Explanation:" +msgstr "" + +#: ../../c-api/lifecycle.rst:72 +msgid "When a new object is constructed by calling its type:" +msgstr "" + +#: ../../c-api/lifecycle.rst:74 +msgid ":c:member:`~PyTypeObject.tp_new` is called to create a new object." +msgstr "" + +#: ../../c-api/lifecycle.rst:75 +msgid "" +":c:member:`~PyTypeObject.tp_alloc` is directly called " +"by :c:member:`~PyTypeObject.tp_new` to allocate the memory for the new " +"object." +msgstr "" + +#: ../../c-api/lifecycle.rst:78 +msgid "" +":c:member:`~PyTypeObject.tp_init` initializes the newly created " +"object. :c:member:`!tp_init` can be called again to re-initialize an object, " +"if desired. The :c:member:`!tp_init` call can also be skipped entirely, for " +"example by Python code calling :py:meth:`~object.__new__`." +msgstr "" + +#: ../../c-api/lifecycle.rst:83 +msgid "After :c:member:`!tp_init` completes, the object is ready to use." +msgstr "" + +#: ../../c-api/lifecycle.rst:84 +msgid "Some time after the last reference to an object is removed:" +msgstr "" + +#: ../../c-api/lifecycle.rst:86 +msgid "" +"If an object is not marked as *finalized*, it might be finalized by marking " +"it as *finalized* and calling its :c:member:`~PyTypeObject.tp_finalize` " +"function. Python does *not* finalize an object when the last reference to " +"it is deleted; use :c:func:`PyObject_CallFinalizerFromDealloc` to ensure " +"that :c:member:`~PyTypeObject.tp_finalize` is always called." +msgstr "" + +#: ../../c-api/lifecycle.rst:92 +msgid "" +"If the object is marked as finalized, :c:member:`~PyTypeObject.tp_clear` " +"might be called by the garbage collector to clear references held by the " +"object. It is *not* called when the object's reference count reaches zero." +msgstr "" + +#: ../../c-api/lifecycle.rst:96 +msgid "" +":c:member:`~PyTypeObject.tp_dealloc` is called to destroy the object. To " +"avoid code duplication, :c:member:`~PyTypeObject.tp_dealloc` typically calls " +"into :c:member:`~PyTypeObject.tp_clear` to free up the object's references." +msgstr "" + +#: ../../c-api/lifecycle.rst:100 +msgid "" +"When :c:member:`~PyTypeObject.tp_dealloc` finishes object destruction, it " +"directly calls :c:member:`~PyTypeObject.tp_free` (usually set " +"to :c:func:`PyObject_Free` or :c:func:`PyObject_GC_Del` automatically as " +"appropriate for the type) to deallocate the memory." +msgstr "" + +#: ../../c-api/lifecycle.rst:105 +msgid "" +"The :c:member:`~PyTypeObject.tp_finalize` function is permitted to add a " +"reference to the object if desired. If it does, the object is " +"*resurrected*, preventing its pending destruction. (Only :c:member:`!" +"tp_finalize` is allowed to resurrect an " +"object; :c:member:`~PyTypeObject.tp_clear` " +"and :c:member:`~PyTypeObject.tp_dealloc` cannot without calling " +"into :c:member:`!tp_finalize`.) Resurrecting an object may or may not cause " +"the object's *finalized* mark to be removed. Currently, Python does not " +"remove the *finalized* mark from a resurrected object if it supports garbage " +"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set) but does " +"remove the mark if the object does not support garbage collection; either or " +"both of these behaviors may change in the future." +msgstr "" + +#: ../../c-api/lifecycle.rst:118 +msgid "" +":c:member:`~PyTypeObject.tp_dealloc` can optionally " +"call :c:member:`~PyTypeObject.tp_finalize` " +"via :c:func:`PyObject_CallFinalizerFromDealloc` if it wishes to reuse that " +"code to help with object destruction. This is recommended because it " +"guarantees that :c:member:`!tp_finalize` is always called before " +"destruction. See the :c:member:`~PyTypeObject.tp_dealloc` documentation for " +"example code." +msgstr "" + +#: ../../c-api/lifecycle.rst:125 +msgid "" +"If the object is a member of a :term:`cyclic isolate` and " +"either :c:member:`~PyTypeObject.tp_clear` fails to break the reference cycle " +"or the cyclic isolate is not detected (perhaps :func:`gc.disable` was " +"called, or the :c:macro:`Py_TPFLAGS_HAVE_GC` flag was erroneously omitted in " +"one of the involved types), the objects remain indefinitely uncollectable " +"(they \"leak\"). See :data:`gc.garbage`." +msgstr "" + +#: ../../c-api/lifecycle.rst:132 +msgid "" +"If the object is marked as supporting garbage collection " +"(the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set " +"in :c:member:`~PyTypeObject.tp_flags`), the following events are also " +"possible:" +msgstr "" + +#: ../../c-api/lifecycle.rst:136 +msgid "" +"The garbage collector occasionally " +"calls :c:member:`~PyTypeObject.tp_traverse` to identify :term:`cyclic " +"isolates `." +msgstr "" + +#: ../../c-api/lifecycle.rst:139 +msgid "" +"When the garbage collector discovers a :term:`cyclic isolate`, it finalizes " +"one of the objects in the group by marking it as *finalized* and calling " +"its :c:member:`~PyTypeObject.tp_finalize` function, if it has one. This " +"repeats until the cyclic isolate doesn't exist or all of the objects have " +"been finalized." +msgstr "" + +#: ../../c-api/lifecycle.rst:144 +msgid "" +":c:member:`~PyTypeObject.tp_finalize` is permitted to resurrect the object " +"by adding a reference from outside the :term:`cyclic isolate`. The new " +"reference causes the group of objects to no longer form a cyclic isolate " +"(the reference cycle may still exist, but if it does the objects are no " +"longer isolated)." +msgstr "" + +#: ../../c-api/lifecycle.rst:149 +msgid "" +"When the garbage collector discovers a :term:`cyclic isolate` and all of the " +"objects in the group have already been marked as *finalized*, the garbage " +"collector clears one or more of the uncleared objects in the group (possibly " +"concurrently) by calling each's :c:member:`~PyTypeObject.tp_clear` " +"function. This repeats as long as the cyclic isolate still exists and not " +"all of the objects have been cleared." +msgstr "" + +#: ../../c-api/lifecycle.rst:158 +msgid "Cyclic Isolate Destruction" +msgstr "" + +#: ../../c-api/lifecycle.rst:160 +msgid "" +"Listed below are the stages of life of a hypothetical :term:`cyclic isolate` " +"that continues to exist after each member object is finalized or cleared. " +"It is a memory leak if a cyclic isolate progresses through all of these " +"stages; it should vanish once all objects are cleared, if not sooner. A " +"cyclic isolate can vanish either because the reference cycle is broken or " +"because the objects are no longer isolated due to finalizer resurrection " +"(see :c:member:`~PyTypeObject.tp_finalize`)." +msgstr "" + +#: ../../c-api/lifecycle.rst:168 +msgid "" +"**Reachable** (not yet a cyclic isolate): All objects are in their normal, " +"reachable state. A reference cycle could exist, but an external reference " +"means the objects are not yet isolated." +msgstr "" + +#: ../../c-api/lifecycle.rst:171 +msgid "" +"**Unreachable but consistent:** The final reference from outside the cyclic " +"group of objects has been removed, causing the objects to become isolated " +"(thus a cyclic isolate is born). None of the group's objects have been " +"finalized or cleared yet. The cyclic isolate remains at this stage until " +"some future run of the garbage collector (not necessarily the next run " +"because the next run might not scan every object)." +msgstr "" + +#: ../../c-api/lifecycle.rst:177 +msgid "" +"**Mix of finalized and not finalized:** Objects in a cyclic isolate are " +"finalized one at a time, which means that there is a period of time when the " +"cyclic isolate is composed of a mix of finalized and non-finalized objects. " +"Finalization order is unspecified, so it can appear random. A finalized " +"object must behave in a sane manner when non-finalized objects interact with " +"it, and a non-finalized object must be able to tolerate the finalization of " +"an arbitrary subset of its referents." +msgstr "" + +#: ../../c-api/lifecycle.rst:184 +msgid "" +"**All finalized:** All objects in a cyclic isolate are finalized before any " +"of them are cleared." +msgstr "" + +#: ../../c-api/lifecycle.rst:186 +msgid "" +"**Mix of finalized and cleared:** The objects can be cleared serially or " +"concurrently (but with the :term:`GIL` held); either way, some will finish " +"before others. A finalized object must be able to tolerate the clearing of " +"a subset of its referents. :pep:`442` calls this stage \"cyclic trash\"." +msgstr "" + +#: ../../c-api/lifecycle.rst:190 +msgid "" +"**Leaked:** If a cyclic isolate still exists after all objects in the group " +"have been finalized and cleared, then the objects remain indefinitely " +"uncollectable (see :data:`gc.garbage`). It is a bug if a cyclic isolate " +"reaches this stage---it means the :c:member:`~PyTypeObject.tp_clear` methods " +"of the participating objects have failed to break the reference cycle as " +"required." +msgstr "" + +#: ../../c-api/lifecycle.rst:197 +msgid "" +"If :c:member:`~PyTypeObject.tp_clear` did not exist, then Python would have " +"no way to safely break a reference cycle. Simply destroying an object in a " +"cyclic isolate would result in a dangling pointer, triggering undefined " +"behavior when an object referencing the destroyed object is itself " +"destroyed. The clearing step makes object destruction a two-phase process: " +"first :c:member:`~PyTypeObject.tp_clear` is called to partially destroy the " +"objects enough to detangle them from each other, " +"then :c:member:`~PyTypeObject.tp_dealloc` is called to complete the " +"destruction." +msgstr "" + +#: ../../c-api/lifecycle.rst:206 +msgid "" +"Unlike clearing, finalization is not a phase of destruction. A finalized " +"object must still behave properly by continuing to fulfill its design " +"contracts. An object's finalizer is allowed to execute arbitrary Python " +"code, and is even allowed to prevent the impending destruction by adding a " +"reference. The finalizer is only related to destruction by call order---if " +"it runs, it runs before destruction, which starts " +"with :c:member:`~PyTypeObject.tp_clear` (if called) and concludes " +"with :c:member:`~PyTypeObject.tp_dealloc`." +msgstr "" + +#: ../../c-api/lifecycle.rst:214 +msgid "" +"The finalization step is not necessary to safely reclaim the objects in a " +"cyclic isolate, but its existence makes it easier to design types that " +"behave in a sane manner when objects are cleared. Clearing an object might " +"necessarily leave it in a broken, partially destroyed state---it might be " +"unsafe to call any of the cleared object's methods or access any of its " +"attributes. With finalization, only finalized objects can possibly interact " +"with cleared objects; non-finalized objects are guaranteed to interact with " +"only non-cleared (but potentially finalized) objects." +msgstr "" + +#: ../../c-api/lifecycle.rst:223 +msgid "To summarize the possible interactions:" +msgstr "" + +#: ../../c-api/lifecycle.rst:225 +msgid "" +"A non-finalized object might have references to or from non-finalized and " +"finalized objects, but not to or from cleared objects." +msgstr "" + +#: ../../c-api/lifecycle.rst:227 +msgid "" +"A finalized object might have references to or from non-finalized, " +"finalized, and cleared objects." +msgstr "" + +#: ../../c-api/lifecycle.rst:229 +msgid "" +"A cleared object might have references to or from finalized and cleared " +"objects, but not to or from non-finalized objects." +msgstr "" + +#: ../../c-api/lifecycle.rst:232 +msgid "" +"Without any reference cycles, an object can be simply destroyed once its " +"last reference is deleted; the finalization and clearing steps are not " +"necessary to safely reclaim unused objects. However, it can be useful to " +"automatically call :c:member:`~PyTypeObject.tp_finalize` " +"and :c:member:`~PyTypeObject.tp_clear` before destruction anyway because " +"type design is simplified when all objects always experience the same series " +"of events regardless of whether they participated in a cyclic isolate. " +"Python currently only calls :c:member:`~PyTypeObject.tp_finalize` " +"and :c:member:`~PyTypeObject.tp_clear` as needed to destroy a cyclic " +"isolate; this may change in a future version." +msgstr "" + +#: ../../c-api/lifecycle.rst:244 +msgid "Functions" +msgstr "" + +#: ../../c-api/lifecycle.rst:246 +msgid "To allocate and free memory, see :ref:`allocating-objects`." +msgstr "" + +#: ../../c-api/lifecycle.rst:251 +msgid "" +"Finalizes the object as described in :c:member:`~PyTypeObject.tp_finalize`. " +"Call this function (or :c:func:`PyObject_CallFinalizerFromDealloc`) instead " +"of calling :c:member:`~PyTypeObject.tp_finalize` directly because this " +"function may deduplicate multiple calls to :c:member:`!tp_finalize`. " +"Currently, calls are only deduplicated if the type supports garbage " +"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set); this may " +"change in the future." +msgstr "" + +#: ../../c-api/lifecycle.rst:262 +msgid "" +"Same as :c:func:`PyObject_CallFinalizer` but meant to be called at the " +"beginning of the object's destructor (:c:member:`~PyTypeObject.tp_dealloc`). " +"There must not be any references to the object. If the object's finalizer " +"resurrects the object, this function returns -1; no further destruction " +"should happen. Otherwise, this function returns 0 and destruction can " +"continue normally." +msgstr "" + +#: ../../c-api/lifecycle.rst:271 +msgid ":c:member:`~PyTypeObject.tp_dealloc` for example code." +msgstr "" diff --git a/c-api/long.po b/c-api/long.po index a32b953e3ec..dd65775f51d 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -7,7 +7,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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,8 +46,8 @@ msgstr "" #: ../../c-api/long.rst:29 msgid "" -"Return true if its argument is a :c:type:`PyLongObject` or a subtype of :c:" -"type:`PyLongObject`. This function always succeeds." +"Return true if its argument is a :c:type:`PyLongObject` or a subtype " +"of :c:type:`PyLongObject`. This function always succeeds." msgstr "" #: ../../c-api/long.rst:35 @@ -92,19 +92,32 @@ msgid "" "``NULL`` on failure." msgstr "" -#: ../../c-api/long.rst:74 +#: ../../c-api/long.rst:75 +msgid "" +"Return a new :c:type:`PyLongObject` object from a signed C :c:expr:`int32_t` " +"or :c:expr:`int64_t`, or ``NULL`` with an exception set on failure." +msgstr "" + +#: ../../c-api/long.rst:84 msgid "" "Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long " "long`, or ``NULL`` on failure." msgstr "" -#: ../../c-api/long.rst:80 +#: ../../c-api/long.rst:91 +msgid "" +"Return a new :c:type:`PyLongObject` object from an unsigned " +"C :c:expr:`uint32_t` or :c:expr:`uint64_t`, or ``NULL`` with an exception " +"set on failure." +msgstr "" + +#: ../../c-api/long.rst:100 msgid "" "Return a new :c:type:`PyLongObject` object from the integer part of *v*, or " "``NULL`` on failure." msgstr "" -#: ../../c-api/long.rst:86 +#: ../../c-api/long.rst:106 msgid "" "Return a new :c:type:`PyLongObject` based on the string value in *str*, " "which is interpreted according to the radix in *base*, or ``NULL`` on " @@ -119,32 +132,32 @@ msgid "" "whitespace, :exc:`ValueError` will be raised." msgstr "" -#: ../../c-api/long.rst:97 +#: ../../c-api/long.rst:117 msgid "" -"Python methods :meth:`int.to_bytes` and :meth:`int.from_bytes` to convert a :" -"c:type:`PyLongObject` to/from an array of bytes in base ``256``. You can " -"call those from C using :c:func:`PyObject_CallMethod`." +":c:func:`PyLong_AsNativeBytes()` and :c:func:`PyLong_FromNativeBytes()` " +"functions can be used to convert a :c:type:`PyLongObject` to/from an array " +"of bytes in base ``256``." msgstr "" -#: ../../c-api/long.rst:104 +#: ../../c-api/long.rst:124 msgid "" "Convert a sequence of Unicode digits in the string *u* to a Python integer " "value." msgstr "" -#: ../../c-api/long.rst:112 +#: ../../c-api/long.rst:132 msgid "" "Create a Python integer from the pointer *p*. The pointer value can be " "retrieved from the resulting value using :c:func:`PyLong_AsVoidPtr`." msgstr "" -#: ../../c-api/long.rst:118 +#: ../../c-api/long.rst:138 msgid "" "Create a Python integer from the value contained in the first *n_bytes* of " "*buffer*, interpreted as a two's-complement signed number." msgstr "" -#: ../../c-api/long.rst:121 +#: ../../c-api/long.rst:141 msgid "" "*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " "select the native endian that CPython was compiled with and assume that the " @@ -153,254 +166,295 @@ msgid "" "calling :c:func:`PyLong_FromUnsignedNativeBytes`. Other flags are ignored." msgstr "" -#: ../../c-api/long.rst:132 +#: ../../c-api/long.rst:152 msgid "" "Create a Python integer from the value contained in the first *n_bytes* of " "*buffer*, interpreted as an unsigned number." msgstr "" -#: ../../c-api/long.rst:135 +#: ../../c-api/long.rst:155 msgid "" "*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " "select the native endian that CPython was compiled with and assume that the " "most-significant bit is not a sign bit. Flags other than endian are ignored." msgstr "" -#: ../../c-api/long.rst:148 ../../c-api/long.rst:184 +#: ../../c-api/long.rst:168 ../../c-api/long.rst:204 msgid "" "Return a C :c:expr:`long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:152 +#: ../../c-api/long.rst:172 msgid "" -"Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" -"expr:`long`." +"Raise :exc:`OverflowError` if the value of *obj* is out of range for " +"a :c:expr:`long`." msgstr "" -#: ../../c-api/long.rst:155 ../../c-api/long.rst:193 ../../c-api/long.rst:214 -#: ../../c-api/long.rst:234 ../../c-api/long.rst:257 +#: ../../c-api/long.rst:175 ../../c-api/long.rst:213 ../../c-api/long.rst:234 +#: ../../c-api/long.rst:254 ../../c-api/long.rst:277 msgid "Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:157 ../../c-api/long.rst:195 ../../c-api/long.rst:216 -#: ../../c-api/long.rst:238 ../../c-api/long.rst:322 ../../c-api/long.rst:342 +#: ../../c-api/long.rst:177 ../../c-api/long.rst:215 ../../c-api/long.rst:236 +#: ../../c-api/long.rst:258 ../../c-api/long.rst:342 ../../c-api/long.rst:362 msgid "Use :meth:`~object.__index__` if available." msgstr "" -#: ../../c-api/long.rst:160 ../../c-api/long.rst:198 ../../c-api/long.rst:219 -#: ../../c-api/long.rst:241 ../../c-api/long.rst:325 ../../c-api/long.rst:345 +#: ../../c-api/long.rst:180 ../../c-api/long.rst:218 ../../c-api/long.rst:239 +#: ../../c-api/long.rst:261 ../../c-api/long.rst:345 ../../c-api/long.rst:365 msgid "This function will no longer use :meth:`~object.__int__`." msgstr "" -#: ../../c-api/long.rst:167 +#: ../../c-api/long.rst:187 msgid "" "A :term:`soft deprecated` alias. Exactly equivalent to the preferred " "``PyLong_AsLong``. In particular, it can fail with :exc:`OverflowError` or " "another exception." msgstr "" -#: ../../c-api/long.rst:171 +#: ../../c-api/long.rst:191 msgid "The function is soft deprecated." msgstr "" -#: ../../c-api/long.rst:176 +#: ../../c-api/long.rst:196 msgid "" -"Similar to :c:func:`PyLong_AsLong`, but store the result in a C :c:expr:" -"`int` instead of a C :c:expr:`long`." +"Similar to :c:func:`PyLong_AsLong`, but store the result in a " +"C :c:expr:`int` instead of a C :c:expr:`long`." msgstr "" -#: ../../c-api/long.rst:188 +#: ../../c-api/long.rst:208 msgid "" -"If the value of *obj* is greater than :c:macro:`LONG_MAX` or less than :c:" -"macro:`LONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " -"return ``-1``; otherwise, set *\\*overflow* to ``0``. If any other " -"exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." +"If the value of *obj* is greater than :c:macro:`LONG_MAX` or less " +"than :c:macro:`LONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, " +"respectively, and return ``-1``; otherwise, set *\\*overflow* to ``0``. If " +"any other exception occurs set *\\*overflow* to ``0`` and return ``-1`` as " +"usual." msgstr "" -#: ../../c-api/long.rst:207 ../../c-api/long.rst:225 +#: ../../c-api/long.rst:227 ../../c-api/long.rst:245 msgid "" "Return a C :c:expr:`long long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:211 +#: ../../c-api/long.rst:231 msgid "" -"Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" -"expr:`long long`." +"Raise :exc:`OverflowError` if the value of *obj* is out of range for " +"a :c:expr:`long long`." msgstr "" -#: ../../c-api/long.rst:229 +#: ../../c-api/long.rst:249 msgid "" -"If the value of *obj* is greater than :c:macro:`LLONG_MAX` or less than :c:" -"macro:`LLONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " -"return ``-1``; otherwise, set *\\*overflow* to ``0``. If any other " -"exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." +"If the value of *obj* is greater than :c:macro:`LLONG_MAX` or less " +"than :c:macro:`LLONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, " +"respectively, and return ``-1``; otherwise, set *\\*overflow* to ``0``. If " +"any other exception occurs set *\\*overflow* to ``0`` and return ``-1`` as " +"usual." msgstr "" -#: ../../c-api/long.rst:251 +#: ../../c-api/long.rst:271 msgid "" "Return a C :c:type:`Py_ssize_t` representation of *pylong*. *pylong* must " "be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:254 +#: ../../c-api/long.rst:274 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" -"type:`Py_ssize_t`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"a :c:type:`Py_ssize_t`." msgstr "" -#: ../../c-api/long.rst:266 +#: ../../c-api/long.rst:286 msgid "" "Return a C :c:expr:`unsigned long` representation of *pylong*. *pylong* " "must be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:269 +#: ../../c-api/long.rst:289 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" -"expr:`unsigned long`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"a :c:expr:`unsigned long`." msgstr "" -#: ../../c-api/long.rst:272 +#: ../../c-api/long.rst:292 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:282 +#: ../../c-api/long.rst:302 msgid "" "Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:285 +#: ../../c-api/long.rst:305 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" -"type:`size_t`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"a :c:type:`size_t`." msgstr "" -#: ../../c-api/long.rst:288 +#: ../../c-api/long.rst:308 msgid "" "Returns ``(size_t)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:297 +#: ../../c-api/long.rst:317 msgid "" "Return a C :c:expr:`unsigned long long` representation of *pylong*. " "*pylong* must be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:300 +#: ../../c-api/long.rst:320 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for an :" -"c:expr:`unsigned long long`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"an :c:expr:`unsigned long long`." msgstr "" -#: ../../c-api/long.rst:303 +#: ../../c-api/long.rst:323 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:306 +#: ../../c-api/long.rst:326 msgid "" "A negative *pylong* now raises :exc:`OverflowError`, not :exc:`TypeError`." msgstr "" -#: ../../c-api/long.rst:312 +#: ../../c-api/long.rst:332 msgid "" "Return a C :c:expr:`unsigned long` representation of *obj*. If *obj* is not " -"an instance of :c:type:`PyLongObject`, first call its :meth:`~object." -"__index__` method (if present) to convert it to a :c:type:`PyLongObject`." +"an instance of :c:type:`PyLongObject`, first call " +"its :meth:`~object.__index__` method (if present) to convert it to " +"a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:316 +#: ../../c-api/long.rst:336 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long`, return " "the reduction of that value modulo ``ULONG_MAX + 1``." msgstr "" -#: ../../c-api/long.rst:319 +#: ../../c-api/long.rst:339 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:331 +#: ../../c-api/long.rst:351 msgid "" "Return a C :c:expr:`unsigned long long` representation of *obj*. If *obj* " -"is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object." -"__index__` method (if present) to convert it to a :c:type:`PyLongObject`." +"is not an instance of :c:type:`PyLongObject`, first call " +"its :meth:`~object.__index__` method (if present) to convert it to " +"a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:336 +#: ../../c-api/long.rst:356 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long long`, " "return the reduction of that value modulo ``ULLONG_MAX + 1``." msgstr "" -#: ../../c-api/long.rst:339 +#: ../../c-api/long.rst:359 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` " "to disambiguate." msgstr "" -#: ../../c-api/long.rst:351 +#: ../../c-api/long.rst:372 +msgid "" +"Set *\\*value* to a signed C :c:expr:`int32_t` or :c:expr:`int64_t` " +"representation of *obj*." +msgstr "" + +#: ../../c-api/long.rst:375 ../../c-api/long.rst:396 +msgid "If the *obj* value is out of range, raise an :exc:`OverflowError`." +msgstr "" + +#: ../../c-api/long.rst:377 ../../c-api/long.rst:398 +msgid "" +"Set *\\*value* and return ``0`` on success. Set an exception and return " +"``-1`` on error." +msgstr "" + +#: ../../c-api/long.rst:380 ../../c-api/long.rst:401 +msgid "*value* must not be ``NULL``." +msgstr "" + +#: ../../c-api/long.rst:388 +msgid "" +"Set *\\*value* to an unsigned C :c:expr:`uint32_t` or :c:expr:`uint64_t` " +"representation of *obj*." +msgstr "" + +#: ../../c-api/long.rst:391 +msgid "" +"If *obj* is not an instance of :c:type:`PyLongObject`, first call " +"its :meth:`~object.__index__` method (if present) to convert it to " +"a :c:type:`PyLongObject`." +msgstr "" + +#: ../../c-api/long.rst:395 +msgid "If *obj* is negative, raise a :exc:`ValueError`." +msgstr "" + +#: ../../c-api/long.rst:408 msgid "" "Return a C :c:expr:`double` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:354 +#: ../../c-api/long.rst:411 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" -"expr:`double`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"a :c:expr:`double`." msgstr "" -#: ../../c-api/long.rst:357 +#: ../../c-api/long.rst:414 msgid "" "Returns ``-1.0`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:362 +#: ../../c-api/long.rst:419 msgid "" "Convert a Python integer *pylong* to a C :c:expr:`void` pointer. If *pylong* " "cannot be converted, an :exc:`OverflowError` will be raised. This is only " -"assured to produce a usable :c:expr:`void` pointer for values created with :" -"c:func:`PyLong_FromVoidPtr`." +"assured to produce a usable :c:expr:`void` pointer for values created " +"with :c:func:`PyLong_FromVoidPtr`." msgstr "" -#: ../../c-api/long.rst:367 +#: ../../c-api/long.rst:424 msgid "" "Returns ``NULL`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:372 +#: ../../c-api/long.rst:429 msgid "" "Copy the Python integer value *pylong* to a native *buffer* of size " "*n_bytes*. The *flags* can be set to ``-1`` to behave similarly to a C cast, " "or to values documented below to control the behavior." msgstr "" -#: ../../c-api/long.rst:376 +#: ../../c-api/long.rst:433 msgid "" "Returns ``-1`` with an exception raised on error. This may happen if " "*pylong* cannot be interpreted as an integer, or if *pylong* was negative " "and the ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` flag was set." msgstr "" -#: ../../c-api/long.rst:380 +#: ../../c-api/long.rst:437 msgid "" "Otherwise, returns the number of bytes required to store the value. If this " "is equal to or less than *n_bytes*, the entire value was copied. All " "*n_bytes* of the buffer are written: large buffers are padded with zeroes." msgstr "" -#: ../../c-api/long.rst:385 +#: ../../c-api/long.rst:442 msgid "" "If the returned value is greater than *n_bytes*, the value was truncated: as " "many of the lowest bits of the value as could fit are written, and the " @@ -408,25 +462,25 @@ msgid "" "downcast." msgstr "" -#: ../../c-api/long.rst:392 +#: ../../c-api/long.rst:449 msgid "" "Overflow is not considered an error. If the returned value is larger than " "*n_bytes*, most significant bits were discarded." msgstr "" -#: ../../c-api/long.rst:395 +#: ../../c-api/long.rst:452 msgid "``0`` will never be returned." msgstr "``0`` 將永不被回傳。" -#: ../../c-api/long.rst:397 +#: ../../c-api/long.rst:454 msgid "Values are always copied as two's-complement." msgstr "" -#: ../../c-api/long.rst:399 +#: ../../c-api/long.rst:456 msgid "Usage example::" msgstr "使用範例: ::" -#: ../../c-api/long.rst:401 +#: ../../c-api/long.rst:458 msgid "" "int32_t value;\n" "Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);\n" @@ -443,26 +497,26 @@ msgid "" "}" msgstr "" -#: ../../c-api/long.rst:415 +#: ../../c-api/long.rst:472 msgid "" "Passing zero to *n_bytes* will return the size of a buffer that would be " "large enough to hold the value. This may be larger than technically " "necessary, but not unreasonably so. If *n_bytes=0*, *buffer* may be ``NULL``." msgstr "" -#: ../../c-api/long.rst:422 +#: ../../c-api/long.rst:479 msgid "" "Passing *n_bytes=0* to this function is not an accurate way to determine the " "bit length of the value." msgstr "" -#: ../../c-api/long.rst:425 +#: ../../c-api/long.rst:482 msgid "" "To get at the entire Python value of an unknown size, the function can be " "called twice: first to determine the buffer size, then to fill it::" msgstr "" -#: ../../c-api/long.rst:428 +#: ../../c-api/long.rst:485 msgid "" "// Ask how much space we need.\n" "Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);\n" @@ -493,69 +547,69 @@ msgid "" "free(bignum);" msgstr "" -#: ../../c-api/long.rst:456 +#: ../../c-api/long.rst:513 msgid "" "*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults " "that behave most like a C cast, or a combination of the other flags in the " "table below. Note that ``-1`` cannot be combined with other flags." msgstr "" -#: ../../c-api/long.rst:461 +#: ../../c-api/long.rst:518 msgid "" "Currently, ``-1`` corresponds to ``Py_ASNATIVEBYTES_NATIVE_ENDIAN | " "Py_ASNATIVEBYTES_UNSIGNED_BUFFER``." msgstr "" -#: ../../c-api/long.rst:467 +#: ../../c-api/long.rst:524 msgid "Flag" msgstr "旗標" -#: ../../c-api/long.rst:467 +#: ../../c-api/long.rst:524 msgid "Value" msgstr "數值" -#: ../../c-api/long.rst:469 +#: ../../c-api/long.rst:526 msgid "``-1``" msgstr "``-1``" -#: ../../c-api/long.rst:470 +#: ../../c-api/long.rst:527 msgid "``0``" msgstr "``0``" -#: ../../c-api/long.rst:471 +#: ../../c-api/long.rst:528 msgid "``1``" msgstr "``1``" -#: ../../c-api/long.rst:472 +#: ../../c-api/long.rst:529 msgid "``3``" msgstr "``3``" -#: ../../c-api/long.rst:473 +#: ../../c-api/long.rst:530 msgid "``4``" msgstr "``4``" -#: ../../c-api/long.rst:474 +#: ../../c-api/long.rst:531 msgid "``8``" msgstr "``8``" -#: ../../c-api/long.rst:475 +#: ../../c-api/long.rst:532 msgid "``16``" msgstr "``16``" -#: ../../c-api/long.rst:478 +#: ../../c-api/long.rst:535 msgid "" "Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian " "flags. Passing ``2`` is reserved." msgstr "" -#: ../../c-api/long.rst:481 +#: ../../c-api/long.rst:538 msgid "" "By default, sufficient buffer will be requested to include a sign bit. For " "example, when converting 128 with *n_bytes=1*, the function will return 2 " "(or more) in order to store a zero sign bit." msgstr "" -#: ../../c-api/long.rst:485 +#: ../../c-api/long.rst:542 msgid "" "If ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` is specified, a zero sign bit will " "be omitted from size calculations. This allows, for example, 128 to fit in a " @@ -565,7 +619,7 @@ msgid "" "requested." msgstr "" -#: ../../c-api/long.rst:492 +#: ../../c-api/long.rst:549 msgid "" "Specifying ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` causes an exception to be " "set if *pylong* is negative. Without this flag, negative values will be " @@ -573,17 +627,17 @@ msgid "" "of whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified." msgstr "" -#: ../../c-api/long.rst:497 +#: ../../c-api/long.rst:554 msgid "" "If ``Py_ASNATIVEBYTES_ALLOW_INDEX`` is specified and a non-integer value is " "passed, its :meth:`~object.__index__` method will be called first. This may " "result in Python code executing and other threads being allowed to run, " "which could cause changes to other objects or values in use. When *flags* is " -"``-1``, this option is not set, and non-integer values will raise :exc:" -"`TypeError`." +"``-1``, this option is not set, and non-integer values will " +"raise :exc:`TypeError`." msgstr "" -#: ../../c-api/long.rst:506 +#: ../../c-api/long.rst:563 msgid "" "With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without " "*REJECT_NEGATIVE*), multiple Python integers can map to a single value " @@ -591,49 +645,345 @@ msgid "" "buffer and set all its bits. This matches typical C cast behavior." msgstr "" -#: ../../c-api/long.rst:517 +#: ../../c-api/long.rst:574 +msgid "Get the sign of the integer object *obj*." +msgstr "" + +#: ../../c-api/long.rst:576 +msgid "" +"On success, set *\\*sign* to the integer sign (0, -1 or +1 for zero, " +"negative or positive integer, respectively) and return 0." +msgstr "" + +#: ../../c-api/long.rst:579 +msgid "" +"On failure, return -1 with an exception set. This function always succeeds " +"if *obj* is a :c:type:`PyLongObject` or its subtype." +msgstr "" + +#: ../../c-api/long.rst:587 +msgid "Check if the integer object *obj* is positive (``obj > 0``)." +msgstr "" + +#: ../../c-api/long.rst:589 +msgid "" +"If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " +"``1`` when it's positive and ``0`` otherwise. Else set an exception and " +"return ``-1``." +msgstr "" + +#: ../../c-api/long.rst:598 +msgid "Check if the integer object *obj* is negative (``obj < 0``)." +msgstr "" + +#: ../../c-api/long.rst:600 +msgid "" +"If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " +"``1`` when it's negative and ``0`` otherwise. Else set an exception and " +"return ``-1``." +msgstr "" + +#: ../../c-api/long.rst:609 +msgid "Check if the integer object *obj* is zero." +msgstr "" + +#: ../../c-api/long.rst:611 +msgid "" +"If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " +"``1`` when it's zero and ``0`` otherwise. Else set an exception and return " +"``-1``." +msgstr "" + +#: ../../c-api/long.rst:620 msgid "" "On success, return a read only :term:`named tuple`, that holds information " "about Python's internal representation of integers. See :data:`sys.int_info` " "for description of individual fields." msgstr "" -#: ../../c-api/long.rst:521 +#: ../../c-api/long.rst:624 msgid "On failure, return ``NULL`` with an exception set." msgstr "在失敗時,會回傳 ``NULL`` 並設定例外。" -#: ../../c-api/long.rst:528 +#: ../../c-api/long.rst:631 msgid "Return 1 if *op* is compact, 0 otherwise." msgstr "" -#: ../../c-api/long.rst:530 +#: ../../c-api/long.rst:633 msgid "" "This function makes it possible for performance-critical code to implement a " -"“fast path” for small integers. For compact values use :c:func:" -"`PyUnstable_Long_CompactValue`; for others fall back to a :c:func:" -"`PyLong_As* ` function or :c:func:`PyLong_AsNativeBytes`." +"“fast path” for small integers. For compact values " +"use :c:func:`PyUnstable_Long_CompactValue`; for others fall back to " +"a :c:func:`PyLong_As* ` function " +"or :c:func:`PyLong_AsNativeBytes`." msgstr "" -#: ../../c-api/long.rst:536 +#: ../../c-api/long.rst:639 msgid "The speedup is expected to be negligible for most users." msgstr "" -#: ../../c-api/long.rst:538 +#: ../../c-api/long.rst:641 msgid "" "Exactly what values are considered compact is an implementation detail and " "is subject to change." msgstr "" -#: ../../c-api/long.rst:546 +#: ../../c-api/long.rst:649 msgid "" "If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, " "return its value." msgstr "" -#: ../../c-api/long.rst:549 +#: ../../c-api/long.rst:652 msgid "Otherwise, the return value is undefined." msgstr "" +#: ../../c-api/long.rst:658 +msgid "Export API" +msgstr "" + +#: ../../c-api/long.rst:664 +msgid "" +"Layout of an array of \"digits\" (\"limbs\" in the GMP terminology), used to " +"represent absolute value for arbitrary precision integers." +msgstr "" + +#: ../../c-api/long.rst:667 +msgid "" +"Use :c:func:`PyLong_GetNativeLayout` to get the native layout of " +"Python :class:`int` objects, used internally for integers with \"big " +"enough\" absolute value." +msgstr "" + +#: ../../c-api/long.rst:671 +msgid "" +"See also :data:`sys.int_info` which exposes similar information in Python." +msgstr "" + +#: ../../c-api/long.rst:675 +msgid "" +"Bits per digit. For example, a 15 bit digit means that bits 0-14 contain " +"meaningful information." +msgstr "" + +#: ../../c-api/long.rst:680 +msgid "" +"Digit size in bytes. For example, a 15 bit digit will require at least 2 " +"bytes." +msgstr "" + +#: ../../c-api/long.rst:685 +msgid "Digits order:" +msgstr "" + +#: ../../c-api/long.rst:687 +msgid "``1`` for most significant digit first" +msgstr "" + +#: ../../c-api/long.rst:688 +msgid "``-1`` for least significant digit first" +msgstr "" + +#: ../../c-api/long.rst:692 +msgid "Digit endianness:" +msgstr "" + +#: ../../c-api/long.rst:694 +msgid "``1`` for most significant byte first (big endian)" +msgstr "" + +#: ../../c-api/long.rst:695 +msgid "``-1`` for least significant byte first (little endian)" +msgstr "" + +#: ../../c-api/long.rst:700 +msgid "Get the native layout of Python :class:`int` objects." +msgstr "" + +#: ../../c-api/long.rst:702 +msgid "See the :c:struct:`PyLongLayout` structure." +msgstr "" + +#: ../../c-api/long.rst:704 +msgid "" +"The function must not be called before Python initialization nor after " +"Python finalization. The returned layout is valid until Python is finalized. " +"The layout is the same for all Python sub-interpreters in a process, and so " +"it can be cached." +msgstr "" + +#: ../../c-api/long.rst:712 +msgid "Export of a Python :class:`int` object." +msgstr "" + +#: ../../c-api/long.rst:714 +msgid "There are two cases:" +msgstr "" + +#: ../../c-api/long.rst:716 +msgid "" +"If :c:member:`digits` is ``NULL``, only use the :c:member:`value` member." +msgstr "" + +#: ../../c-api/long.rst:717 +msgid "" +"If :c:member:`digits` is not ``NULL``, " +"use :c:member:`negative`, :c:member:`ndigits` and :c:member:`digits` members." +msgstr "" + +#: ../../c-api/long.rst:722 +msgid "" +"The native integer value of the exported :class:`int` object. Only valid " +"if :c:member:`digits` is ``NULL``." +msgstr "" + +#: ../../c-api/long.rst:727 +msgid "" +"``1`` if the number is negative, ``0`` otherwise. Only valid " +"if :c:member:`digits` is not ``NULL``." +msgstr "" + +#: ../../c-api/long.rst:732 +msgid "" +"Number of digits in :c:member:`digits` array. Only valid " +"if :c:member:`digits` is not ``NULL``." +msgstr "" + +#: ../../c-api/long.rst:737 +msgid "Read-only array of unsigned digits. Can be ``NULL``." +msgstr "" + +#: ../../c-api/long.rst:742 +msgid "Export a Python :class:`int` object." +msgstr "" + +#: ../../c-api/long.rst:744 +msgid "" +"*export_long* must point to a :c:struct:`PyLongExport` structure allocated " +"by the caller. It must not be ``NULL``." +msgstr "" + +#: ../../c-api/long.rst:747 +msgid "" +"On success, fill in *\\*export_long* and return ``0``. On error, set an " +"exception and return ``-1``." +msgstr "" + +#: ../../c-api/long.rst:750 +msgid "" +":c:func:`PyLong_FreeExport` must be called when the export is no longer " +"needed." +msgstr "" + +#: ../../c-api/long.rst:754 +msgid "" +"This function always succeeds if *obj* is a Python :class:`int` object or a " +"subclass." +msgstr "" + +#: ../../c-api/long.rst:760 +msgid "Release the export *export_long* created by :c:func:`PyLong_Export`." +msgstr "" + +#: ../../c-api/long.rst:763 +msgid "" +"Calling :c:func:`PyLong_FreeExport` is optional if *export_long->digits* is " +"``NULL``." +msgstr "" + +#: ../../c-api/long.rst:768 +msgid "PyLongWriter API" +msgstr "" + +#: ../../c-api/long.rst:770 +msgid "The :c:type:`PyLongWriter` API can be used to import an integer." +msgstr "" + +#: ../../c-api/long.rst:776 +msgid "A Python :class:`int` writer instance." +msgstr "" + +#: ../../c-api/long.rst:778 +msgid "" +"The instance must be destroyed by :c:func:`PyLongWriter_Finish` " +"or :c:func:`PyLongWriter_Discard`." +msgstr "" + +#: ../../c-api/long.rst:784 +msgid "Create a :c:type:`PyLongWriter`." +msgstr "" + +#: ../../c-api/long.rst:786 +msgid "" +"On success, allocate *\\*digits* and return a writer. On error, set an " +"exception and return ``NULL``." +msgstr "" + +#: ../../c-api/long.rst:789 +msgid "*negative* is ``1`` if the number is negative, or ``0`` otherwise." +msgstr "" + +#: ../../c-api/long.rst:791 +msgid "" +"*ndigits* is the number of digits in the *digits* array. It must be greater " +"than 0." +msgstr "" + +#: ../../c-api/long.rst:794 +msgid "*digits* must not be NULL." +msgstr "" + +#: ../../c-api/long.rst:796 +msgid "" +"After a successful call to this function, the caller should fill in the " +"array of digits *digits* and then call :c:func:`PyLongWriter_Finish` to get " +"a Python :class:`int`. The layout of *digits* is described " +"by :c:func:`PyLong_GetNativeLayout`." +msgstr "" + +#: ../../c-api/long.rst:801 +msgid "" +"Digits must be in the range [``0``; ``(1 << bits_per_digit) - 1``] (where " +"the :c:struct:`~PyLongLayout.bits_per_digit` is the number of bits per " +"digit). Any unused most significant digits must be set to ``0``." +msgstr "" + +#: ../../c-api/long.rst:806 +msgid "" +"Alternately, call :c:func:`PyLongWriter_Discard` to destroy the writer " +"instance without creating an :class:`~int` object." +msgstr "" + +#: ../../c-api/long.rst:812 +msgid "" +"Finish a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." +msgstr "" + +#: ../../c-api/long.rst:814 +msgid "" +"On success, return a Python :class:`int` object. On error, set an exception " +"and return ``NULL``." +msgstr "" + +#: ../../c-api/long.rst:817 +msgid "" +"The function takes care of normalizing the digits and converts the object to " +"a compact integer if needed." +msgstr "" + +#: ../../c-api/long.rst:820 ../../c-api/long.rst:829 +msgid "The writer instance and the *digits* array are invalid after the call." +msgstr "" + +#: ../../c-api/long.rst:825 +msgid "" +"Discard a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." +msgstr "" + +#: ../../c-api/long.rst:827 +msgid "If *writer* is ``NULL``, no operation is performed." +msgstr "" + #: ../../c-api/long.rst:8 msgid "object" msgstr "object(物件)" @@ -646,23 +996,23 @@ msgstr "long integer(長整數)" msgid "integer" msgstr "integer(整數)" -#: ../../c-api/long.rst:144 +#: ../../c-api/long.rst:164 msgid "LONG_MAX (C macro)" msgstr "LONG_MAX(C 巨集)" -#: ../../c-api/long.rst:144 ../../c-api/long.rst:204 ../../c-api/long.rst:247 -#: ../../c-api/long.rst:262 ../../c-api/long.rst:278 ../../c-api/long.rst:294 +#: ../../c-api/long.rst:164 ../../c-api/long.rst:224 ../../c-api/long.rst:267 +#: ../../c-api/long.rst:282 ../../c-api/long.rst:298 ../../c-api/long.rst:314 msgid "OverflowError (built-in exception)" msgstr "OverflowError(內建例外)" -#: ../../c-api/long.rst:247 +#: ../../c-api/long.rst:267 msgid "PY_SSIZE_T_MAX (C macro)" msgstr "PY_SSIZE_T_MAX(C 巨集)" -#: ../../c-api/long.rst:262 +#: ../../c-api/long.rst:282 msgid "ULONG_MAX (C macro)" msgstr "ULONG_MAX(C 巨集)" -#: ../../c-api/long.rst:278 +#: ../../c-api/long.rst:298 msgid "SIZE_MAX (C macro)" msgstr "SIZE_MAX(C 巨集)" diff --git a/c-api/marshal.po b/c-api/marshal.po index 88d77fe2c1d..17d79cf0436 100644 --- a/c-api/marshal.po +++ b/c-api/marshal.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-06-28 02:44+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,26 +42,25 @@ msgstr "數值會以最低有效位元組 (the least significant byte) 優先的 #: ../../c-api/marshal.rst:16 msgid "" -"The module supports two versions of the data format: version 0 is the " -"historical version, version 1 shares interned strings in the file, and upon " -"unmarshalling. Version 2 uses a binary format for floating-point numbers. " -"``Py_MARSHAL_VERSION`` indicates the current file format (currently 2)." +"The module supports several versions of the data format; see " +"the :py:mod:`Python module documentation ` for details." msgstr "" -"這個模組支援兩個版本的資料格式:版本 0 是歷史版本,版本 1 在檔案中共享駐留字" -"串 (interned strings),並在 unmarshal 時使用。版本 2 使用二進位格式來儲存浮點" -"數。``Py_MARSHAL_VERSION`` 表示目前的檔案格式(目前為 2)。" -#: ../../c-api/marshal.rst:24 +#: ../../c-api/marshal.rst:21 +msgid "The current format version. See :py:data:`marshal.version`." +msgstr "" + +#: ../../c-api/marshal.rst:25 msgid "" "Marshal a :c:expr:`long` integer, *value*, to *file*. This will only write " "the least-significant 32 bits of *value*; regardless of the size of the " "native :c:expr:`long` type. *version* indicates the file format." msgstr "" "將一個 :c:expr:`long` 整數 *value* marshal 為 *file*。這只會寫入 *value* 的最" -"低有效 32 位元;無論原生 :c:expr:`long` 型別的大小如何。*version* 表示檔案的格" -"式。" +"低有效 32 位元;無論原生 :c:expr:`long` 型別的大小如何。*version* 表示檔案的" +"格式。" -#: ../../c-api/marshal.rst:28 ../../c-api/marshal.rst:36 +#: ../../c-api/marshal.rst:29 ../../c-api/marshal.rst:37 msgid "" "This function can fail, in which case it sets the error indicator. " "Use :c:func:`PyErr_Occurred` to check for that." @@ -69,25 +68,25 @@ msgstr "" "這個函式可能會失敗,這時會設定錯誤指示器。使用 :c:func:`PyErr_Occurred` 來檢" "查是否發生錯誤。" -#: ../../c-api/marshal.rst:33 +#: ../../c-api/marshal.rst:34 msgid "" "Marshal a Python object, *value*, to *file*. *version* indicates the file " "format." msgstr "" "將一個 Python 物件 *value* marshal 為 *file*。*version* 表示檔案的格式。" -#: ../../c-api/marshal.rst:41 +#: ../../c-api/marshal.rst:42 msgid "" "Return a bytes object containing the marshalled representation of *value*. " "*version* indicates the file format." msgstr "" "回傳一個位元組物件,包含 *value* 的 marshal 表示。*version* 為檔案的格式。" -#: ../../c-api/marshal.rst:45 +#: ../../c-api/marshal.rst:46 msgid "The following functions allow marshalled values to be read back in." msgstr "以下函式允許將 marshal 過後的值讀取回來。" -#: ../../c-api/marshal.rst:50 +#: ../../c-api/marshal.rst:51 msgid "" "Return a C :c:expr:`long` from the data stream in a :c:expr:`FILE*` opened " "for reading. Only a 32-bit value can be read in using this function, " @@ -96,13 +95,13 @@ msgstr "" "從一個為讀取而開啟的 :c:expr:`FILE*` 中的資料串流回傳一個 C :c:expr:`long`。" "無論 :c:expr:`long` 的原生大小如何,這個函式只能讀取 32 位元的值。" -#: ../../c-api/marshal.rst:54 ../../c-api/marshal.rst:64 +#: ../../c-api/marshal.rst:55 ../../c-api/marshal.rst:65 msgid "" "On error, sets the appropriate exception (:exc:`EOFError`) and returns " "``-1``." msgstr "在錯誤發生時,會設定合適的例外(:exc:`EOFError`)並回傳 ``-1``。" -#: ../../c-api/marshal.rst:60 +#: ../../c-api/marshal.rst:61 msgid "" "Return a C :c:expr:`short` from the data stream in a :c:expr:`FILE*` opened " "for reading. Only a 16-bit value can be read in using this function, " @@ -111,15 +110,15 @@ msgstr "" "從一個為讀取而開啟的 :c:expr:`FILE*` 中的資料串流回傳一個 C :c:expr:`short`。" "無論 :c:expr:`short` 的原生大小如何,這個函式只能讀取 16 位元的值。" -#: ../../c-api/marshal.rst:70 +#: ../../c-api/marshal.rst:71 msgid "" "Return a Python object from the data stream in a :c:expr:`FILE*` opened for " "reading." msgstr "" "從一個為讀取而開啟的 :c:expr:`FILE*` 中的資料串流回傳一個 Python 物件。" -#: ../../c-api/marshal.rst:73 ../../c-api/marshal.rst:87 -#: ../../c-api/marshal.rst:96 +#: ../../c-api/marshal.rst:74 ../../c-api/marshal.rst:88 +#: ../../c-api/marshal.rst:97 msgid "" "On error, sets the appropriate exception (:exc:`EOFError`, :exc:`ValueError` " "or :exc:`TypeError`) and returns ``NULL``." @@ -127,7 +126,7 @@ msgstr "" "在錯誤發生時,會設定合適的例外(:exc:`EOFError`、:exc:`ValueError` " "或 :exc:`TypeError`)並回傳 ``NULL``。" -#: ../../c-api/marshal.rst:79 +#: ../../c-api/marshal.rst:80 msgid "" "Return a Python object from the data stream in a :c:expr:`FILE*` opened for " "reading. Unlike :c:func:`PyMarshal_ReadObjectFromFile`, this function " @@ -143,10 +142,21 @@ msgstr "" "操作,而不是從檔案中逐位元組讀取。只有在確定不會從檔案中讀取其他內容時,才使" "用這個變體。" -#: ../../c-api/marshal.rst:93 +#: ../../c-api/marshal.rst:94 msgid "" "Return a Python object from the data stream in a byte buffer containing " "*len* bytes pointed to by *data*." msgstr "" "從一個包含 *len* 位元組、被 *data* 指向的位元組緩衝區中的資料串流回傳一個 " "Python 物件。" + +#~ msgid "" +#~ "The module supports two versions of the data format: version 0 is the " +#~ "historical version, version 1 shares interned strings in the file, and " +#~ "upon unmarshalling. Version 2 uses a binary format for floating-point " +#~ "numbers. ``Py_MARSHAL_VERSION`` indicates the current file format " +#~ "(currently 2)." +#~ msgstr "" +#~ "這個模組支援兩個版本的資料格式:版本 0 是歷史版本,版本 1 在檔案中共享駐留" +#~ "字串 (interned strings),並在 unmarshal 時使用。版本 2 使用二進位格式來儲" +#~ "存浮點數。``Py_MARSHAL_VERSION`` 表示目前的檔案格式(目前為 2)。" diff --git a/c-api/memory.po b/c-api/memory.po index 0b7ee268d03..b9a444d9d60 100644 --- a/c-api/memory.po +++ b/c-api/memory.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-21 00:18+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -63,13 +63,14 @@ msgstr "" #: ../../c-api/memory.rst:49 msgid "" "To avoid memory corruption, extension writers should never try to operate on " -"Python objects with the functions exported by the C library: :c:func:" -"`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`. This will " -"result in mixed calls between the C allocator and the Python memory manager " -"with fatal consequences, because they implement different algorithms and " -"operate on different heaps. However, one may safely allocate and release " -"memory blocks with the C library allocator for individual purposes, as shown " -"in the following example::" +"Python objects with the functions exported by the C " +"library: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` " +"and :c:func:`free`. This will result in mixed calls between the C " +"allocator and the Python memory manager with fatal consequences, because " +"they implement different algorithms and operate on different heaps. " +"However, one may safely allocate and release memory blocks with the C " +"library allocator for individual purposes, as shown in the following " +"example::" msgstr "" #: ../../c-api/memory.rst:58 @@ -148,8 +149,8 @@ msgstr "" msgid "" "Raw domain: intended for allocating memory for general-purpose memory " "buffers where the allocation *must* go to the system allocator or where the " -"allocator can operate without the :term:`GIL`. The memory is requested " -"directly from the system. See :ref:`Raw Memory Interface `." msgstr "" @@ -157,8 +158,8 @@ msgstr "" msgid "" "\"Mem\" domain: intended for allocating memory for Python buffers and " "general-purpose memory buffers where the allocation must be performed with " -"the :term:`GIL` held. The memory is taken from the Python private heap. See :" -"ref:`Memory Interface `." +"an :term:`attached thread state`. The memory is taken from the Python " +"private heap. See :ref:`Memory Interface `." msgstr "" #: ../../c-api/memory.rst:121 @@ -178,9 +179,9 @@ msgstr "" #: ../../c-api/memory.rst:130 msgid "" -"For example, buffers (non-Python objects) should be allocated using :c:func:" -"`PyMem_Malloc`, :c:func:`PyMem_RawMalloc`, or :c:func:`malloc`, but not :c:" -"func:`PyObject_Malloc`." +"For example, buffers (non-Python objects) should be allocated " +"using :c:func:`PyMem_Malloc`, :c:func:`PyMem_RawMalloc`, " +"or :c:func:`malloc`, but not :c:func:`PyObject_Malloc`." msgstr "" #: ../../c-api/memory.rst:133 @@ -194,8 +195,8 @@ msgstr "" #: ../../c-api/memory.rst:141 msgid "" "The following function sets are wrappers to the system allocator. These " -"functions are thread-safe, the :term:`GIL ` does " -"not need to be held." +"functions are thread-safe, so a :term:`thread state` does not need to " +"be :term:`attached `." msgstr "" #: ../../c-api/memory.rst:145 @@ -206,8 +207,8 @@ msgid "" "requesting zero bytes." msgstr "" -#: ../../c-api/memory.rst:154 ../../c-api/memory.rst:225 -#: ../../c-api/memory.rst:335 +#: ../../c-api/memory.rst:154 ../../c-api/memory.rst:224 +#: ../../c-api/memory.rst:333 msgid "" "Allocates *n* bytes and returns a pointer of type :c:expr:`void*` to the " "allocated memory, or ``NULL`` if the request fails." @@ -220,8 +221,8 @@ msgid "" "have been initialized in any way." msgstr "" -#: ../../c-api/memory.rst:164 ../../c-api/memory.rst:235 -#: ../../c-api/memory.rst:345 +#: ../../c-api/memory.rst:164 ../../c-api/memory.rst:234 +#: ../../c-api/memory.rst:343 msgid "" "Allocates *nelem* elements each whose size in bytes is *elsize* and returns " "a pointer of type :c:expr:`void*` to the allocated memory, or ``NULL`` if " @@ -235,8 +236,8 @@ msgid "" "called instead." msgstr "" -#: ../../c-api/memory.rst:177 ../../c-api/memory.rst:248 -#: ../../c-api/memory.rst:358 +#: ../../c-api/memory.rst:177 ../../c-api/memory.rst:247 +#: ../../c-api/memory.rst:356 msgid "" "Resizes the memory block pointed to by *p* to *n* bytes. The contents will " "be unchanged to the minimum of the old and the new sizes." @@ -251,9 +252,9 @@ msgstr "" #: ../../c-api/memory.rst:184 msgid "" -"Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" -"func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:func:" -"`PyMem_RawCalloc`." +"Unless *p* is ``NULL``, it must have been returned by a previous call " +"to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` " +"or :c:func:`PyMem_RawCalloc`." msgstr "" #: ../../c-api/memory.rst:188 @@ -265,13 +266,13 @@ msgstr "" #: ../../c-api/memory.rst:194 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " -"previous call to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:" -"func:`PyMem_RawCalloc`. Otherwise, or if ``PyMem_RawFree(p)`` has been " -"called before, undefined behavior occurs." +"previous call to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` " +"or :c:func:`PyMem_RawCalloc`. Otherwise, or if ``PyMem_RawFree(p)`` has " +"been called before, undefined behavior occurs." msgstr "" -#: ../../c-api/memory.rst:199 ../../c-api/memory.rst:269 -#: ../../c-api/memory.rst:379 +#: ../../c-api/memory.rst:199 ../../c-api/memory.rst:268 +#: ../../c-api/memory.rst:377 msgid "If *p* is ``NULL``, no operation is performed." msgstr "" @@ -279,7 +280,7 @@ msgstr "" msgid "Memory Interface" msgstr "記憶體介面" -#: ../../c-api/memory.rst:207 ../../c-api/memory.rst:315 +#: ../../c-api/memory.rst:207 ../../c-api/memory.rst:314 msgid "" "The following function sets, modeled after the ANSI C standard, but " "specifying behavior when requesting zero bytes, are available for allocating " @@ -288,76 +289,75 @@ msgstr "" #: ../../c-api/memory.rst:211 msgid "" -"The :ref:`default memory allocator ` uses the :" -"ref:`pymalloc memory allocator `." +"The :ref:`default memory allocator ` uses " +"the :ref:`pymalloc memory allocator `." msgstr "" -#: ../../c-api/memory.rst:216 ../../c-api/memory.rst:330 +#: ../../c-api/memory.rst:216 ../../c-api/memory.rst:329 msgid "" -"The :term:`GIL ` must be held when using these " -"functions." +"There must be an :term:`attached thread state` when using these functions." msgstr "" -#: ../../c-api/memory.rst:221 +#: ../../c-api/memory.rst:220 msgid "" "The default allocator is now pymalloc instead of system :c:func:`malloc`." msgstr "" -#: ../../c-api/memory.rst:228 +#: ../../c-api/memory.rst:227 msgid "" "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " "as if ``PyMem_Malloc(1)`` had been called instead. The memory will not have " "been initialized in any way." msgstr "" -#: ../../c-api/memory.rst:239 +#: ../../c-api/memory.rst:238 msgid "" "Requesting zero elements or elements of size zero bytes returns a distinct " "non-``NULL`` pointer if possible, as if ``PyMem_Calloc(1, 1)`` had been " "called instead." msgstr "" -#: ../../c-api/memory.rst:251 +#: ../../c-api/memory.rst:250 msgid "" "If *p* is ``NULL``, the call is equivalent to ``PyMem_Malloc(n)``; else if " "*n* is equal to zero, the memory block is resized but is not freed, and the " "returned pointer is non-``NULL``." msgstr "" -#: ../../c-api/memory.rst:255 +#: ../../c-api/memory.rst:254 msgid "" -"Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" -"func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:`PyMem_Calloc`." +"Unless *p* is ``NULL``, it must have been returned by a previous call " +"to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:`PyMem_Calloc`." msgstr "" -#: ../../c-api/memory.rst:258 +#: ../../c-api/memory.rst:257 msgid "" "If the request fails, :c:func:`PyMem_Realloc` returns ``NULL`` and *p* " "remains a valid pointer to the previous memory area." msgstr "" -#: ../../c-api/memory.rst:264 +#: ../../c-api/memory.rst:263 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " -"previous call to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:" -"`PyMem_Calloc`. Otherwise, or if ``PyMem_Free(p)`` has been called before, " -"undefined behavior occurs." +"previous call to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` " +"or :c:func:`PyMem_Calloc`. Otherwise, or if ``PyMem_Free(p)`` has been " +"called before, undefined behavior occurs." msgstr "" -#: ../../c-api/memory.rst:271 +#: ../../c-api/memory.rst:270 msgid "" "The following type-oriented macros are provided for convenience. Note that " "*TYPE* refers to any C type." msgstr "" -#: ../../c-api/memory.rst:277 +#: ../../c-api/memory.rst:276 msgid "" "Same as :c:func:`PyMem_Malloc`, but allocates ``(n * sizeof(TYPE))`` bytes " "of memory. Returns a pointer cast to ``TYPE*``. The memory will not have " "been initialized in any way." msgstr "" -#: ../../c-api/memory.rst:284 +#: ../../c-api/memory.rst:283 msgid "" "Same as :c:func:`PyMem_Realloc`, but the memory block is resized to ``(n * " "sizeof(TYPE))`` bytes. Returns a pointer cast to ``TYPE*``. On return, *p* " @@ -365,17 +365,17 @@ msgid "" "failure." msgstr "" -#: ../../c-api/memory.rst:289 +#: ../../c-api/memory.rst:288 msgid "" "This is a C preprocessor macro; *p* is always reassigned. Save the original " "value of *p* to avoid losing memory when handling errors." msgstr "" -#: ../../c-api/memory.rst:295 +#: ../../c-api/memory.rst:294 msgid "Same as :c:func:`PyMem_Free`." msgstr "和 :c:func:`PyMem_Free` 相同。" -#: ../../c-api/memory.rst:297 +#: ../../c-api/memory.rst:296 msgid "" "In addition, the following macro sets are provided for calling the Python " "memory allocator directly, without involving the C API functions listed " @@ -383,35 +383,35 @@ msgid "" "across Python versions and is therefore deprecated in extension modules." msgstr "" -#: ../../c-api/memory.rst:302 +#: ../../c-api/memory.rst:301 msgid "``PyMem_MALLOC(size)``" msgstr "``PyMem_MALLOC(size)``" -#: ../../c-api/memory.rst:303 +#: ../../c-api/memory.rst:302 msgid "``PyMem_NEW(type, size)``" msgstr "``PyMem_NEW(type, size)``" -#: ../../c-api/memory.rst:304 +#: ../../c-api/memory.rst:303 msgid "``PyMem_REALLOC(ptr, size)``" msgstr "``PyMem_REALLOC(ptr, size)``" -#: ../../c-api/memory.rst:305 +#: ../../c-api/memory.rst:304 msgid "``PyMem_RESIZE(ptr, type, size)``" msgstr "``PyMem_RESIZE(ptr, type, size)``" -#: ../../c-api/memory.rst:306 +#: ../../c-api/memory.rst:305 msgid "``PyMem_FREE(ptr)``" msgstr "``PyMem_FREE(ptr)``" -#: ../../c-api/memory.rst:307 +#: ../../c-api/memory.rst:306 msgid "``PyMem_DEL(ptr)``" msgstr "``PyMem_DEL(ptr)``" -#: ../../c-api/memory.rst:313 +#: ../../c-api/memory.rst:312 msgid "Object allocators" msgstr "" -#: ../../c-api/memory.rst:320 +#: ../../c-api/memory.rst:319 msgid "" "There is no guarantee that the memory returned by these allocators can be " "successfully cast to a Python object when intercepting the allocating " @@ -419,383 +419,423 @@ msgid "" "Memory Allocators ` section." msgstr "" -#: ../../c-api/memory.rst:325 +#: ../../c-api/memory.rst:324 msgid "" -"The :ref:`default object allocator ` uses the :" -"ref:`pymalloc memory allocator `." +"The :ref:`default object allocator ` uses " +"the :ref:`pymalloc memory allocator `." msgstr "" -#: ../../c-api/memory.rst:338 +#: ../../c-api/memory.rst:336 msgid "" "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " "as if ``PyObject_Malloc(1)`` had been called instead. The memory will not " "have been initialized in any way." msgstr "" -#: ../../c-api/memory.rst:349 +#: ../../c-api/memory.rst:347 msgid "" "Requesting zero elements or elements of size zero bytes returns a distinct " "non-``NULL`` pointer if possible, as if ``PyObject_Calloc(1, 1)`` had been " "called instead." msgstr "" -#: ../../c-api/memory.rst:361 +#: ../../c-api/memory.rst:359 msgid "" "If *p* is ``NULL``, the call is equivalent to ``PyObject_Malloc(n)``; else " "if *n* is equal to zero, the memory block is resized but is not freed, and " "the returned pointer is non-``NULL``." msgstr "" -#: ../../c-api/memory.rst:365 +#: ../../c-api/memory.rst:363 msgid "" -"Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" -"func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:func:" -"`PyObject_Calloc`." +"Unless *p* is ``NULL``, it must have been returned by a previous call " +"to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` " +"or :c:func:`PyObject_Calloc`." msgstr "" -#: ../../c-api/memory.rst:368 +#: ../../c-api/memory.rst:366 msgid "" "If the request fails, :c:func:`PyObject_Realloc` returns ``NULL`` and *p* " "remains a valid pointer to the previous memory area." msgstr "" -#: ../../c-api/memory.rst:374 +#: ../../c-api/memory.rst:372 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " -"previous call to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:" -"func:`PyObject_Calloc`. Otherwise, or if ``PyObject_Free(p)`` has been " -"called before, undefined behavior occurs." +"previous call to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` " +"or :c:func:`PyObject_Calloc`. Otherwise, or if ``PyObject_Free(p)`` has " +"been called before, undefined behavior occurs." msgstr "" -#: ../../c-api/memory.rst:385 -msgid "Default Memory Allocators" +#: ../../c-api/memory.rst:379 +msgid "" +"Do not call this directly to free an object's memory; call the " +"type's :c:member:`~PyTypeObject.tp_free` slot instead." +msgstr "" + +#: ../../c-api/memory.rst:382 +msgid "" +"Do not use this for memory allocated by :c:macro:`PyObject_GC_New` " +"or :c:macro:`PyObject_GC_NewVar`; use :c:func:`PyObject_GC_Del` instead." msgstr "" #: ../../c-api/memory.rst:387 +msgid "" +":c:func:`PyObject_GC_Del` is the equivalent of this function for memory " +"allocated by types that support garbage collection." +msgstr "" + +#: ../../c-api/memory.rst:389 ../../c-api/memory.rst:486 +msgid ":c:func:`PyObject_Malloc`" +msgstr ":c:func:`PyObject_Malloc`" + +#: ../../c-api/memory.rst:390 ../../c-api/memory.rst:487 +msgid ":c:func:`PyObject_Realloc`" +msgstr ":c:func:`PyObject_Realloc`" + +#: ../../c-api/memory.rst:391 ../../c-api/memory.rst:488 +msgid ":c:func:`PyObject_Calloc`" +msgstr ":c:func:`PyObject_Calloc`" + +#: ../../c-api/memory.rst:392 +#, fuzzy +msgid ":c:macro:`PyObject_New`" +msgstr ":c:func:`PyObject_Free`" + +#: ../../c-api/memory.rst:393 +#, fuzzy +msgid ":c:macro:`PyObject_NewVar`" +msgstr ":c:func:`PyObject_Free`" + +#: ../../c-api/memory.rst:394 +#, fuzzy +msgid ":c:func:`PyType_GenericAlloc`" +msgstr ":c:func:`PyMem_Realloc`" + +#: ../../c-api/memory.rst:395 +#, fuzzy +msgid ":c:member:`~PyTypeObject.tp_free`" +msgstr ":c:func:`PyObject_Free`" + +#: ../../c-api/memory.rst:401 +msgid "Default Memory Allocators" +msgstr "" + +#: ../../c-api/memory.rst:403 msgid "Default memory allocators:" msgstr "" -#: ../../c-api/memory.rst:390 +#: ../../c-api/memory.rst:406 msgid "Configuration" msgstr "配置" -#: ../../c-api/memory.rst:390 +#: ../../c-api/memory.rst:406 msgid "Name" msgstr "名稱" -#: ../../c-api/memory.rst:390 +#: ../../c-api/memory.rst:406 msgid "PyMem_RawMalloc" msgstr "PyMem_RawMalloc" -#: ../../c-api/memory.rst:390 +#: ../../c-api/memory.rst:406 msgid "PyMem_Malloc" msgstr "PyMem_Malloc" -#: ../../c-api/memory.rst:390 +#: ../../c-api/memory.rst:406 msgid "PyObject_Malloc" msgstr "PyObject_Malloc" -#: ../../c-api/memory.rst:392 +#: ../../c-api/memory.rst:408 msgid "Release build" msgstr "" -#: ../../c-api/memory.rst:392 +#: ../../c-api/memory.rst:408 msgid "``\"pymalloc\"``" msgstr "``\"pymalloc\"``" -#: ../../c-api/memory.rst:392 ../../c-api/memory.rst:394 +#: ../../c-api/memory.rst:408 ../../c-api/memory.rst:410 msgid "``malloc``" msgstr "``malloc``" -#: ../../c-api/memory.rst:392 +#: ../../c-api/memory.rst:408 msgid "``pymalloc``" msgstr "``pymalloc``" -#: ../../c-api/memory.rst:393 +#: ../../c-api/memory.rst:409 msgid "Debug build" msgstr "" -#: ../../c-api/memory.rst:393 +#: ../../c-api/memory.rst:409 msgid "``\"pymalloc_debug\"``" msgstr "``\"pymalloc_debug\"``" -#: ../../c-api/memory.rst:393 ../../c-api/memory.rst:395 +#: ../../c-api/memory.rst:409 ../../c-api/memory.rst:411 msgid "``malloc`` + debug" msgstr "" -#: ../../c-api/memory.rst:393 +#: ../../c-api/memory.rst:409 msgid "``pymalloc`` + debug" msgstr "" -#: ../../c-api/memory.rst:394 +#: ../../c-api/memory.rst:410 msgid "Release build, without pymalloc" msgstr "" -#: ../../c-api/memory.rst:394 +#: ../../c-api/memory.rst:410 msgid "``\"malloc\"``" msgstr "``\"malloc\"``" -#: ../../c-api/memory.rst:395 +#: ../../c-api/memory.rst:411 msgid "Debug build, without pymalloc" msgstr "" -#: ../../c-api/memory.rst:395 +#: ../../c-api/memory.rst:411 msgid "``\"malloc_debug\"``" msgstr "``\"malloc_debug\"``" -#: ../../c-api/memory.rst:398 +#: ../../c-api/memory.rst:414 msgid "Legend:" msgstr "" -#: ../../c-api/memory.rst:400 +#: ../../c-api/memory.rst:416 msgid "Name: value for :envvar:`PYTHONMALLOC` environment variable." msgstr "" -#: ../../c-api/memory.rst:401 +#: ../../c-api/memory.rst:417 msgid "" -"``malloc``: system allocators from the standard C library, C functions: :c:" -"func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`." +"``malloc``: system allocators from the standard C library, C " +"functions: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` " +"and :c:func:`free`." msgstr "" -#: ../../c-api/memory.rst:403 +#: ../../c-api/memory.rst:419 msgid "``pymalloc``: :ref:`pymalloc memory allocator `." msgstr "" -#: ../../c-api/memory.rst:404 +#: ../../c-api/memory.rst:420 msgid "" "``mimalloc``: :ref:`mimalloc memory allocator `. The pymalloc " "allocator will be used if mimalloc support isn't available." msgstr "" -#: ../../c-api/memory.rst:406 +#: ../../c-api/memory.rst:422 msgid "" "\"+ debug\": with :ref:`debug hooks on the Python memory allocators `." msgstr "" -#: ../../c-api/memory.rst:408 +#: ../../c-api/memory.rst:424 msgid "\"Debug build\": :ref:`Python build in debug mode `." msgstr "" -#: ../../c-api/memory.rst:413 +#: ../../c-api/memory.rst:429 msgid "Customize Memory Allocators" msgstr "" -#: ../../c-api/memory.rst:419 +#: ../../c-api/memory.rst:435 msgid "" "Structure used to describe a memory block allocator. The structure has the " "following fields:" msgstr "" -#: ../../c-api/memory.rst:423 ../../c-api/memory.rst:674 +#: ../../c-api/memory.rst:439 ../../c-api/memory.rst:690 msgid "Field" msgstr "欄位" -#: ../../c-api/memory.rst:423 ../../c-api/memory.rst:674 +#: ../../c-api/memory.rst:439 ../../c-api/memory.rst:690 msgid "Meaning" msgstr "意義" -#: ../../c-api/memory.rst:425 ../../c-api/memory.rst:676 +#: ../../c-api/memory.rst:441 ../../c-api/memory.rst:692 msgid "``void *ctx``" msgstr "``void *ctx``" -#: ../../c-api/memory.rst:425 ../../c-api/memory.rst:676 +#: ../../c-api/memory.rst:441 ../../c-api/memory.rst:692 msgid "user context passed as first argument" msgstr "" -#: ../../c-api/memory.rst:427 +#: ../../c-api/memory.rst:443 msgid "``void* malloc(void *ctx, size_t size)``" msgstr "``void* malloc(void *ctx, size_t size)``" -#: ../../c-api/memory.rst:427 +#: ../../c-api/memory.rst:443 msgid "allocate a memory block" msgstr "" -#: ../../c-api/memory.rst:429 +#: ../../c-api/memory.rst:445 msgid "``void* calloc(void *ctx, size_t nelem, size_t elsize)``" msgstr "``void* calloc(void *ctx, size_t nelem, size_t elsize)``" -#: ../../c-api/memory.rst:429 +#: ../../c-api/memory.rst:445 msgid "allocate a memory block initialized with zeros" msgstr "" -#: ../../c-api/memory.rst:432 +#: ../../c-api/memory.rst:448 msgid "``void* realloc(void *ctx, void *ptr, size_t new_size)``" msgstr "``void* realloc(void *ctx, void *ptr, size_t new_size)``" -#: ../../c-api/memory.rst:432 +#: ../../c-api/memory.rst:448 msgid "allocate or resize a memory block" msgstr "" -#: ../../c-api/memory.rst:434 +#: ../../c-api/memory.rst:450 msgid "``void free(void *ctx, void *ptr)``" msgstr "``void free(void *ctx, void *ptr)``" -#: ../../c-api/memory.rst:434 +#: ../../c-api/memory.rst:450 msgid "free a memory block" msgstr "" -#: ../../c-api/memory.rst:437 +#: ../../c-api/memory.rst:453 msgid "" -"The :c:type:`!PyMemAllocator` structure was renamed to :c:type:" -"`PyMemAllocatorEx` and a new ``calloc`` field was added." +"The :c:type:`!PyMemAllocator` structure was renamed " +"to :c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "" -#: ../../c-api/memory.rst:444 +#: ../../c-api/memory.rst:460 msgid "Enum used to identify an allocator domain. Domains:" msgstr "" -#: ../../c-api/memory.rst:450 ../../c-api/memory.rst:459 -#: ../../c-api/memory.rst:468 +#: ../../c-api/memory.rst:466 ../../c-api/memory.rst:475 +#: ../../c-api/memory.rst:484 msgid "Functions:" msgstr "函式:" -#: ../../c-api/memory.rst:452 +#: ../../c-api/memory.rst:468 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../c-api/memory.rst:453 +#: ../../c-api/memory.rst:469 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../c-api/memory.rst:454 +#: ../../c-api/memory.rst:470 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../c-api/memory.rst:455 +#: ../../c-api/memory.rst:471 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../c-api/memory.rst:461 +#: ../../c-api/memory.rst:477 msgid ":c:func:`PyMem_Malloc`," msgstr ":c:func:`PyMem_Malloc`," -#: ../../c-api/memory.rst:462 +#: ../../c-api/memory.rst:478 msgid ":c:func:`PyMem_Realloc`" msgstr ":c:func:`PyMem_Realloc`" -#: ../../c-api/memory.rst:463 +#: ../../c-api/memory.rst:479 msgid ":c:func:`PyMem_Calloc`" msgstr ":c:func:`PyMem_Calloc`" -#: ../../c-api/memory.rst:464 +#: ../../c-api/memory.rst:480 msgid ":c:func:`PyMem_Free`" msgstr ":c:func:`PyMem_Free`" -#: ../../c-api/memory.rst:470 -msgid ":c:func:`PyObject_Malloc`" -msgstr ":c:func:`PyObject_Malloc`" - -#: ../../c-api/memory.rst:471 -msgid ":c:func:`PyObject_Realloc`" -msgstr ":c:func:`PyObject_Realloc`" - -#: ../../c-api/memory.rst:472 -msgid ":c:func:`PyObject_Calloc`" -msgstr ":c:func:`PyObject_Calloc`" - -#: ../../c-api/memory.rst:473 +#: ../../c-api/memory.rst:489 msgid ":c:func:`PyObject_Free`" msgstr ":c:func:`PyObject_Free`" -#: ../../c-api/memory.rst:477 +#: ../../c-api/memory.rst:493 msgid "Get the memory block allocator of the specified domain." msgstr "" -#: ../../c-api/memory.rst:482 +#: ../../c-api/memory.rst:498 msgid "Set the memory block allocator of the specified domain." msgstr "" -#: ../../c-api/memory.rst:484 +#: ../../c-api/memory.rst:500 msgid "" "The new allocator must return a distinct non-``NULL`` pointer when " "requesting zero bytes." msgstr "" -#: ../../c-api/memory.rst:487 +#: ../../c-api/memory.rst:503 msgid "" "For the :c:macro:`PYMEM_DOMAIN_RAW` domain, the allocator must be thread-" -"safe: the :term:`GIL ` is not held when the " -"allocator is called." +"safe: a :term:`thread state` is not :term:`attached ` " +"when the allocator is called." msgstr "" -#: ../../c-api/memory.rst:491 +#: ../../c-api/memory.rst:507 msgid "" "For the remaining domains, the allocator must also be thread-safe: the " -"allocator may be called in different interpreters that do not share a " -"``GIL``." +"allocator may be called in different interpreters that do not share " +"a :term:`GIL`." msgstr "" -#: ../../c-api/memory.rst:495 +#: ../../c-api/memory.rst:511 msgid "" "If the new allocator is not a hook (does not call the previous allocator), " "the :c:func:`PyMem_SetupDebugHooks` function must be called to reinstall the " "debug hooks on top on the new allocator." msgstr "" -#: ../../c-api/memory.rst:499 +#: ../../c-api/memory.rst:515 msgid "" "See also :c:member:`PyPreConfig.allocator` and :ref:`Preinitialize Python " "with PyPreConfig `." msgstr "" -#: ../../c-api/memory.rst:504 +#: ../../c-api/memory.rst:520 msgid ":c:func:`PyMem_SetAllocator` does have the following contract:" msgstr "" -#: ../../c-api/memory.rst:506 +#: ../../c-api/memory.rst:522 msgid "" -"It can be called after :c:func:`Py_PreInitialize` and before :c:func:" -"`Py_InitializeFromConfig` to install a custom memory allocator. There are no " -"restrictions over the installed allocator other than the ones imposed by the " -"domain (for instance, the Raw Domain allows the allocator to be called " -"without the GIL held). See :ref:`the section on allocator domains ` for more information." +"It can be called after :c:func:`Py_PreInitialize` and " +"before :c:func:`Py_InitializeFromConfig` to install a custom memory " +"allocator. There are no restrictions over the installed allocator other than " +"the ones imposed by the domain (for instance, the Raw Domain allows the " +"allocator to be called without an :term:`attached thread state`). " +"See :ref:`the section on allocator domains ` for more " +"information." msgstr "" -#: ../../c-api/memory.rst:514 +#: ../../c-api/memory.rst:530 msgid "" -"If called after Python has finish initializing (after :c:func:" -"`Py_InitializeFromConfig` has been called) the allocator **must** wrap the " -"existing allocator. Substituting the current allocator for some other " -"arbitrary one is **not supported**." +"If called after Python has finish initializing " +"(after :c:func:`Py_InitializeFromConfig` has been called) the allocator " +"**must** wrap the existing allocator. Substituting the current allocator for " +"some other arbitrary one is **not supported**." msgstr "" -#: ../../c-api/memory.rst:519 +#: ../../c-api/memory.rst:535 msgid "All allocators must be thread-safe." msgstr "" -#: ../../c-api/memory.rst:525 +#: ../../c-api/memory.rst:541 msgid "" "Setup :ref:`debug hooks in the Python memory allocators ` " "to detect memory errors." msgstr "" -#: ../../c-api/memory.rst:532 +#: ../../c-api/memory.rst:548 msgid "Debug hooks on the Python memory allocators" msgstr "" -#: ../../c-api/memory.rst:534 +#: ../../c-api/memory.rst:550 msgid "" -"When :ref:`Python is built in debug mode `, the :c:func:" -"`PyMem_SetupDebugHooks` function is called at the :ref:`Python " +"When :ref:`Python is built in debug mode `, " +"the :c:func:`PyMem_SetupDebugHooks` function is called at the :ref:`Python " "preinitialization ` to setup debug hooks on Python memory " "allocators to detect memory errors." msgstr "" -#: ../../c-api/memory.rst:539 +#: ../../c-api/memory.rst:555 msgid "" "The :envvar:`PYTHONMALLOC` environment variable can be used to install debug " "hooks on a Python compiled in release mode (ex: ``PYTHONMALLOC=debug``)." msgstr "" -#: ../../c-api/memory.rst:542 +#: ../../c-api/memory.rst:558 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function can be used to set debug hooks " "after calling :c:func:`PyMem_SetAllocator`." msgstr "" -#: ../../c-api/memory.rst:545 +#: ../../c-api/memory.rst:561 msgid "" "These debug hooks fill dynamically allocated memory blocks with special, " "recognizable bit patterns. Newly allocated memory is filled with the byte " @@ -805,33 +845,33 @@ msgid "" "these bytes are unlikely to be valid addresses, floats, or ASCII strings." msgstr "" -#: ../../c-api/memory.rst:552 +#: ../../c-api/memory.rst:568 msgid "Runtime checks:" msgstr "Runtime 檢查:" -#: ../../c-api/memory.rst:554 +#: ../../c-api/memory.rst:570 msgid "" "Detect API violations. For example, detect if :c:func:`PyObject_Free` is " "called on a memory block allocated by :c:func:`PyMem_Malloc`." msgstr "" -#: ../../c-api/memory.rst:556 +#: ../../c-api/memory.rst:572 msgid "Detect write before the start of the buffer (buffer underflow)." msgstr "" -#: ../../c-api/memory.rst:557 +#: ../../c-api/memory.rst:573 msgid "Detect write after the end of the buffer (buffer overflow)." msgstr "" -#: ../../c-api/memory.rst:558 +#: ../../c-api/memory.rst:574 msgid "" -"Check that the :term:`GIL ` is held when allocator " +"Check that there is an :term:`attached thread state` when allocator " "functions of :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) " "and :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) domains are " "called." msgstr "" -#: ../../c-api/memory.rst:563 +#: ../../c-api/memory.rst:579 msgid "" "On error, the debug hooks use the :mod:`tracemalloc` module to get the " "traceback where a memory block was allocated. The traceback is only " @@ -839,7 +879,7 @@ msgid "" "memory block was traced." msgstr "" -#: ../../c-api/memory.rst:568 +#: ../../c-api/memory.rst:584 msgid "" "Let *S* = ``sizeof(size_t)``. ``2*S`` bytes are added at each end of each " "block of *N* bytes requested. The memory layout is like so, where p " @@ -849,49 +889,49 @@ msgid "" "from a Python slice):" msgstr "" -#: ../../c-api/memory.rst:574 +#: ../../c-api/memory.rst:590 msgid "``p[-2*S:-S]``" msgstr "``p[-2*S:-S]``" -#: ../../c-api/memory.rst:575 +#: ../../c-api/memory.rst:591 msgid "" "Number of bytes originally asked for. This is a size_t, big-endian (easier " "to read in a memory dump)." msgstr "" -#: ../../c-api/memory.rst:577 +#: ../../c-api/memory.rst:593 msgid "``p[-S]``" msgstr "``p[-S]``" -#: ../../c-api/memory.rst:578 +#: ../../c-api/memory.rst:594 msgid "API identifier (ASCII character):" msgstr "" -#: ../../c-api/memory.rst:580 +#: ../../c-api/memory.rst:596 msgid "``'r'`` for :c:macro:`PYMEM_DOMAIN_RAW`." msgstr "" -#: ../../c-api/memory.rst:581 +#: ../../c-api/memory.rst:597 msgid "``'m'`` for :c:macro:`PYMEM_DOMAIN_MEM`." msgstr "" -#: ../../c-api/memory.rst:582 +#: ../../c-api/memory.rst:598 msgid "``'o'`` for :c:macro:`PYMEM_DOMAIN_OBJ`." msgstr "" -#: ../../c-api/memory.rst:584 +#: ../../c-api/memory.rst:600 msgid "``p[-S+1:0]``" msgstr "``p[-S+1:0]``" -#: ../../c-api/memory.rst:585 +#: ../../c-api/memory.rst:601 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch under- writes and reads." msgstr "" -#: ../../c-api/memory.rst:587 +#: ../../c-api/memory.rst:603 msgid "``p[0:N]``" msgstr "``p[0:N]``" -#: ../../c-api/memory.rst:588 +#: ../../c-api/memory.rst:604 msgid "" "The requested memory, filled with copies of PYMEM_CLEANBYTE, used to catch " "reference to uninitialized memory. When a realloc-like function is called " @@ -902,25 +942,25 @@ msgid "" "bytes are also filled with PYMEM_DEADBYTE." msgstr "" -#: ../../c-api/memory.rst:596 +#: ../../c-api/memory.rst:612 msgid "``p[N:N+S]``" msgstr "``p[N:N+S]``" -#: ../../c-api/memory.rst:597 +#: ../../c-api/memory.rst:613 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch over- writes and reads." msgstr "" -#: ../../c-api/memory.rst:599 +#: ../../c-api/memory.rst:615 msgid "``p[N+S:N+2*S]``" msgstr "``p[N+S:N+2*S]``" -#: ../../c-api/memory.rst:600 +#: ../../c-api/memory.rst:616 msgid "" "Only used if the ``PYMEM_DEBUG_SERIALNO`` macro is defined (not defined by " "default)." msgstr "" -#: ../../c-api/memory.rst:603 +#: ../../c-api/memory.rst:619 msgid "" "A serial number, incremented by 1 on each call to a malloc-like or realloc-" "like function. Big-endian :c:type:`size_t`. If \"bad memory\" is detected " @@ -930,7 +970,7 @@ msgid "" "number is incremented, and exists so you can set such a breakpoint easily." msgstr "" -#: ../../c-api/memory.rst:610 +#: ../../c-api/memory.rst:626 msgid "" "A realloc-like or free-like function first checks that the " "PYMEM_FORBIDDENBYTE bytes at each end are intact. If they've been altered, " @@ -943,16 +983,17 @@ msgid "" "getting used)." msgstr "" -#: ../../c-api/memory.rst:619 +#: ../../c-api/memory.rst:635 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function now also works on Python " -"compiled in release mode. On error, the debug hooks now use :mod:" -"`tracemalloc` to get the traceback where a memory block was allocated. The " -"debug hooks now also check if the GIL is held when functions of :c:macro:" -"`PYMEM_DOMAIN_OBJ` and :c:macro:`PYMEM_DOMAIN_MEM` domains are called." +"compiled in release mode. On error, the debug hooks now " +"use :mod:`tracemalloc` to get the traceback where a memory block was " +"allocated. The debug hooks now also check if there is an :term:`attached " +"thread state` when functions of :c:macro:`PYMEM_DOMAIN_OBJ` " +"and :c:macro:`PYMEM_DOMAIN_MEM` domains are called." msgstr "" -#: ../../c-api/memory.rst:627 +#: ../../c-api/memory.rst:643 msgid "" "Byte patterns ``0xCB`` (``PYMEM_CLEANBYTE``), ``0xDB`` (``PYMEM_DEADBYTE``) " "and ``0xFB`` (``PYMEM_FORBIDDENBYTE``) have been replaced with ``0xCD``, " @@ -960,95 +1001,96 @@ msgid "" "``malloc()`` and ``free()``." msgstr "" -#: ../../c-api/memory.rst:637 +#: ../../c-api/memory.rst:653 msgid "The pymalloc allocator" msgstr "" -#: ../../c-api/memory.rst:639 +#: ../../c-api/memory.rst:655 msgid "" "Python has a *pymalloc* allocator optimized for small objects (smaller or " "equal to 512 bytes) with a short lifetime. It uses memory mappings called " "\"arenas\" with a fixed size of either 256 KiB on 32-bit platforms or 1 MiB " -"on 64-bit platforms. It falls back to :c:func:`PyMem_RawMalloc` and :c:func:" -"`PyMem_RawRealloc` for allocations larger than 512 bytes." +"on 64-bit platforms. It falls back to :c:func:`PyMem_RawMalloc` " +"and :c:func:`PyMem_RawRealloc` for allocations larger than 512 bytes." msgstr "" -#: ../../c-api/memory.rst:645 +#: ../../c-api/memory.rst:661 msgid "" "*pymalloc* is the :ref:`default allocator ` of " -"the :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) and :c:macro:" -"`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) domains." +"the :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) " +"and :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) domains." msgstr "" -#: ../../c-api/memory.rst:649 +#: ../../c-api/memory.rst:665 msgid "The arena allocator uses the following functions:" msgstr "" -#: ../../c-api/memory.rst:651 +#: ../../c-api/memory.rst:667 msgid ":c:func:`!VirtualAlloc` and :c:func:`!VirtualFree` on Windows," msgstr "" -#: ../../c-api/memory.rst:652 +#: ../../c-api/memory.rst:668 msgid ":c:func:`!mmap` and :c:func:`!munmap` if available," msgstr "" -#: ../../c-api/memory.rst:653 +#: ../../c-api/memory.rst:669 msgid ":c:func:`malloc` and :c:func:`free` otherwise." msgstr "" -#: ../../c-api/memory.rst:655 +#: ../../c-api/memory.rst:671 msgid "" "This allocator is disabled if Python is configured with the :option:`--" -"without-pymalloc` option. It can also be disabled at runtime using the :" -"envvar:`PYTHONMALLOC` environment variable (ex: ``PYTHONMALLOC=malloc``)." +"without-pymalloc` option. It can also be disabled at runtime using " +"the :envvar:`PYTHONMALLOC` environment variable (ex: " +"``PYTHONMALLOC=malloc``)." msgstr "" -#: ../../c-api/memory.rst:659 +#: ../../c-api/memory.rst:675 msgid "" "Typically, it makes sense to disable the pymalloc allocator when building " "Python with AddressSanitizer (:option:`--with-address-sanitizer`) which " "helps uncover low level bugs within the C code." msgstr "" -#: ../../c-api/memory.rst:664 +#: ../../c-api/memory.rst:680 msgid "Customize pymalloc Arena Allocator" msgstr "" -#: ../../c-api/memory.rst:670 +#: ../../c-api/memory.rst:686 msgid "" "Structure used to describe an arena allocator. The structure has three " "fields:" msgstr "" -#: ../../c-api/memory.rst:678 +#: ../../c-api/memory.rst:694 msgid "``void* alloc(void *ctx, size_t size)``" msgstr "``void* alloc(void *ctx, size_t size)``" -#: ../../c-api/memory.rst:678 +#: ../../c-api/memory.rst:694 msgid "allocate an arena of size bytes" msgstr "" -#: ../../c-api/memory.rst:680 +#: ../../c-api/memory.rst:696 msgid "``void free(void *ctx, void *ptr, size_t size)``" msgstr "``void free(void *ctx, void *ptr, size_t size)``" -#: ../../c-api/memory.rst:680 +#: ../../c-api/memory.rst:696 msgid "free an arena" msgstr "" -#: ../../c-api/memory.rst:685 +#: ../../c-api/memory.rst:701 msgid "Get the arena allocator." msgstr "" -#: ../../c-api/memory.rst:689 +#: ../../c-api/memory.rst:705 msgid "Set the arena allocator." msgstr "" -#: ../../c-api/memory.rst:694 +#: ../../c-api/memory.rst:710 msgid "The mimalloc allocator" msgstr "" -#: ../../c-api/memory.rst:698 +#: ../../c-api/memory.rst:714 msgid "" "Python supports the mimalloc allocator when the underlying platform support " "is available. mimalloc \"is a general purpose allocator with excellent " @@ -1056,46 +1098,46 @@ msgid "" "runtime systems of the Koka and Lean languages.\"" msgstr "" -#: ../../c-api/memory.rst:703 +#: ../../c-api/memory.rst:719 msgid "tracemalloc C API" msgstr "" -#: ../../c-api/memory.rst:709 +#: ../../c-api/memory.rst:725 msgid "Track an allocated memory block in the :mod:`tracemalloc` module." msgstr "" -#: ../../c-api/memory.rst:711 +#: ../../c-api/memory.rst:727 msgid "" "Return ``0`` on success, return ``-1`` on error (failed to allocate memory " "to store the trace). Return ``-2`` if tracemalloc is disabled." msgstr "" -#: ../../c-api/memory.rst:714 +#: ../../c-api/memory.rst:730 msgid "If memory block is already tracked, update the existing trace." msgstr "" -#: ../../c-api/memory.rst:718 +#: ../../c-api/memory.rst:734 msgid "" "Untrack an allocated memory block in the :mod:`tracemalloc` module. Do " "nothing if the block was not tracked." msgstr "" -#: ../../c-api/memory.rst:721 +#: ../../c-api/memory.rst:737 msgid "Return ``-2`` if tracemalloc is disabled, otherwise return ``0``." msgstr "" -#: ../../c-api/memory.rst:727 +#: ../../c-api/memory.rst:743 msgid "Examples" msgstr "範例" -#: ../../c-api/memory.rst:729 +#: ../../c-api/memory.rst:745 msgid "" "Here is the example from section :ref:`memoryoverview`, rewritten so that " "the I/O buffer is allocated from the Python heap by using the first function " "set::" msgstr "" -#: ../../c-api/memory.rst:732 +#: ../../c-api/memory.rst:748 msgid "" "PyObject *res;\n" "char *buf = (char *) PyMem_Malloc(BUFSIZ); /* for I/O */\n" @@ -1108,11 +1150,11 @@ msgid "" "return res;" msgstr "" -#: ../../c-api/memory.rst:742 +#: ../../c-api/memory.rst:758 msgid "The same code using the type-oriented function set::" msgstr "" -#: ../../c-api/memory.rst:744 +#: ../../c-api/memory.rst:760 msgid "" "PyObject *res;\n" "char *buf = PyMem_New(char, BUFSIZ); /* for I/O */\n" @@ -1121,11 +1163,11 @@ msgid "" " return PyErr_NoMemory();\n" "/* ...Do some I/O operation involving buf... */\n" "res = PyBytes_FromString(buf);\n" -"PyMem_Del(buf); /* allocated with PyMem_New */\n" +"PyMem_Free(buf); /* allocated with PyMem_New */\n" "return res;" msgstr "" -#: ../../c-api/memory.rst:754 +#: ../../c-api/memory.rst:770 msgid "" "Note that in the two examples above, the buffer is always manipulated via " "functions belonging to the same set. Indeed, it is required to use the same " @@ -1135,7 +1177,7 @@ msgid "" "different allocators operating on different heaps. ::" msgstr "" -#: ../../c-api/memory.rst:761 +#: ../../c-api/memory.rst:777 msgid "" "char *buf1 = PyMem_New(char, BUFSIZ);\n" "char *buf2 = (char *) malloc(BUFSIZ);\n" @@ -1143,17 +1185,18 @@ msgid "" "...\n" "PyMem_Del(buf3); /* Wrong -- should be PyMem_Free() */\n" "free(buf2); /* Right -- allocated via malloc() */\n" -"free(buf1); /* Fatal -- should be PyMem_Del() */" +"free(buf1); /* Fatal -- should be PyMem_Free() */" msgstr "" -#: ../../c-api/memory.rst:769 +#: ../../c-api/memory.rst:785 msgid "" "In addition to the functions aimed at handling raw memory blocks from the " -"Python heap, objects in Python are allocated and released with :c:macro:" -"`PyObject_New`, :c:macro:`PyObject_NewVar` and :c:func:`PyObject_Del`." +"Python heap, objects in Python are allocated and released " +"with :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar` " +"and :c:func:`PyObject_Free`." msgstr "" -#: ../../c-api/memory.rst:773 +#: ../../c-api/memory.rst:789 msgid "" "These will be explained in the next chapter on defining and implementing new " "object types in C." diff --git a/c-api/module.po b/c-api/module.po index 16304cac163..9da989c9f84 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -7,7 +7,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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,21 +36,22 @@ msgstr "" #: ../../c-api/module.rst:27 msgid "" -"Return true if *p* is a module object, but not a subtype of :c:data:" -"`PyModule_Type`. This function always succeeds." +"Return true if *p* is a module object, but not a subtype " +"of :c:data:`PyModule_Type`. This function always succeeds." msgstr "" #: ../../c-api/module.rst:40 msgid "" "Return a new module object with :attr:`module.__name__` set to *name*. The " -"module's :attr:`!__name__`, :attr:`~module.__doc__`, :attr:`~module." -"__package__` and :attr:`~module.__loader__` attributes are filled in (all " -"but :attr:`!__name__` are set to ``None``). The caller is responsible for " -"setting a :attr:`~module.__file__` attribute." +"module's :attr:`!" +"__name__`, :attr:`~module.__doc__`, :attr:`~module.__package__` " +"and :attr:`~module.__loader__` attributes are filled in (all but :attr:`!" +"__name__` are set to ``None``). The caller is responsible for setting " +"a :attr:`~module.__file__` attribute." msgstr "" -#: ../../c-api/module.rst:46 ../../c-api/module.rst:272 -#: ../../c-api/module.rst:492 +#: ../../c-api/module.rst:46 ../../c-api/module.rst:416 +#: ../../c-api/module.rst:443 msgid "Return ``NULL`` with an exception set on error." msgstr "在失敗時回傳 ``NULL`` 並設定例外。" @@ -79,8 +80,8 @@ msgstr "" #: ../../c-api/module.rst:70 msgid "" "It is recommended extensions use other ``PyModule_*`` and ``PyObject_*`` " -"functions rather than directly manipulate a module's :attr:`~object." -"__dict__`." +"functions rather than directly manipulate a " +"module's :attr:`~object.__dict__`." msgstr "" #: ../../c-api/module.rst:81 @@ -99,8 +100,8 @@ msgstr "" #: ../../c-api/module.rst:95 msgid "" "Return the \"state\" of the module, that is, a pointer to the block of " -"memory allocated at module creation time, or ``NULL``. See :c:member:" -"`PyModuleDef.m_size`." +"memory allocated at module creation time, or ``NULL``. " +"See :c:member:`PyModuleDef.m_size`." msgstr "" #: ../../c-api/module.rst:102 @@ -111,10 +112,10 @@ msgstr "" #: ../../c-api/module.rst:112 msgid "" -"Return the name of the file from which *module* was loaded using *module*'s :" -"attr:`~module.__file__` attribute. If this is not defined, or if it is not " -"a string, raise :exc:`SystemError` and return ``NULL``; otherwise return a " -"reference to a Unicode object." +"Return the name of the file from which *module* was loaded using " +"*module*'s :attr:`~module.__file__` attribute. If this is not defined, or " +"if it is not a string, raise :exc:`SystemError` and return ``NULL``; " +"otherwise return a reference to a Unicode object." msgstr "" #: ../../c-api/module.rst:122 @@ -130,125 +131,143 @@ msgid "" msgstr "" #: ../../c-api/module.rst:133 -msgid "Initializing C modules" -msgstr "初始化 C 模組" +#, fuzzy +msgid "Module definitions" +msgstr "模組物件" #: ../../c-api/module.rst:135 msgid "" -"Modules objects are usually created from extension modules (shared libraries " -"which export an initialization function), or compiled-in modules (where the " -"initialization function is added using :c:func:`PyImport_AppendInittab`). " -"See :ref:`building` or :ref:`extending-with-embedding` for details." +"The functions in the previous section work on any module object, including " +"modules imported from Python code." +msgstr "" + +#: ../../c-api/module.rst:138 +msgid "" +"Modules defined using the C API typically use a *module " +"definition*, :c:type:`PyModuleDef` -- a statically allocated, constant " +"“description\" of how a module should be created." +msgstr "" + +#: ../../c-api/module.rst:142 +msgid "" +"The definition is usually used to define an extension's “main” module object " +"(see :ref:`extension-modules` for details). It is also used to :ref:`create " +"extension modules dynamically `." msgstr "" -#: ../../c-api/module.rst:140 +#: ../../c-api/module.rst:147 msgid "" -"The initialization function can either pass a module definition instance to :" -"c:func:`PyModule_Create`, and return the resulting module object, or request " -"\"multi-phase initialization\" by returning the definition struct itself." +"Unlike :c:func:`PyModule_New`, the definition allows management of *module " +"state* -- a piece of memory that is allocated and cleared together with the " +"module object. Unlike the module's Python attributes, Python code cannot " +"replace or delete data stored in module state." msgstr "" -#: ../../c-api/module.rst:146 +#: ../../c-api/module.rst:155 msgid "" "The module definition struct, which holds all information needed to create a " -"module object. There is usually only one statically initialized variable of " -"this type for each module." +"module object. This structure must be statically allocated (or be otherwise " +"guaranteed to be valid while any modules created from it exist). Usually, " +"there is only one variable of this type for each extension module." msgstr "" -#: ../../c-api/module.rst:152 +#: ../../c-api/module.rst:163 msgid "Always initialize this member to :c:macro:`PyModuleDef_HEAD_INIT`." msgstr "" -#: ../../c-api/module.rst:156 +#: ../../c-api/module.rst:167 msgid "Name for the new module." msgstr "" -#: ../../c-api/module.rst:160 +#: ../../c-api/module.rst:171 msgid "" -"Docstring for the module; usually a docstring variable created with :c:macro:" -"`PyDoc_STRVAR` is used." +"Docstring for the module; usually a docstring variable created " +"with :c:macro:`PyDoc_STRVAR` is used." msgstr "" -#: ../../c-api/module.rst:165 +#: ../../c-api/module.rst:176 msgid "" "Module state may be kept in a per-module memory area that can be retrieved " "with :c:func:`PyModule_GetState`, rather than in static globals. This makes " "modules safe for use in multiple sub-interpreters." msgstr "" -#: ../../c-api/module.rst:169 +#: ../../c-api/module.rst:180 msgid "" "This memory area is allocated based on *m_size* on module creation, and " -"freed when the module object is deallocated, after the :c:member:" -"`~PyModuleDef.m_free` function has been called, if present." +"freed when the module object is deallocated, after " +"the :c:member:`~PyModuleDef.m_free` function has been called, if present." msgstr "" -#: ../../c-api/module.rst:173 +#: ../../c-api/module.rst:184 msgid "" -"Setting ``m_size`` to ``-1`` means that the module does not support sub-" -"interpreters, because it has global state." +"Setting it to a non-negative value means that the module can be re-" +"initialized and specifies the additional amount of memory it requires for " +"its state." msgstr "" -#: ../../c-api/module.rst:176 +#: ../../c-api/module.rst:188 msgid "" -"Setting it to a non-negative value means that the module can be re-" -"initialized and specifies the additional amount of memory it requires for " -"its state. Non-negative ``m_size`` is required for multi-phase " -"initialization." +"Setting ``m_size`` to ``-1`` means that the module does not support sub-" +"interpreters, because it has global state. Negative ``m_size`` is only " +"allowed when using :ref:`legacy single-phase initialization ` or when :ref:`creating modules dynamically `." msgstr "" -#: ../../c-api/module.rst:181 +#: ../../c-api/module.rst:194 msgid "See :PEP:`3121` for more details." msgstr "更多詳情請見 :pep:`3121`。" -#: ../../c-api/module.rst:185 +#: ../../c-api/module.rst:198 msgid "" -"A pointer to a table of module-level functions, described by :c:type:" -"`PyMethodDef` values. Can be ``NULL`` if no functions are present." +"A pointer to a table of module-level functions, described " +"by :c:type:`PyMethodDef` values. Can be ``NULL`` if no functions are " +"present." msgstr "" -#: ../../c-api/module.rst:190 +#: ../../c-api/module.rst:203 msgid "" "An array of slot definitions for multi-phase initialization, terminated by a " -"``{0, NULL}`` entry. When using single-phase initialization, *m_slots* must " -"be ``NULL``." +"``{0, NULL}`` entry. When using legacy single-phase initialization, " +"*m_slots* must be ``NULL``." msgstr "" -#: ../../c-api/module.rst:196 +#: ../../c-api/module.rst:209 msgid "" "Prior to version 3.5, this member was always set to ``NULL``, and was " "defined as:" msgstr "" -#: ../../c-api/module.rst:203 +#: ../../c-api/module.rst:216 msgid "" "A traversal function to call during GC traversal of the module object, or " "``NULL`` if not needed." msgstr "" -#: ../../c-api/module.rst:206 ../../c-api/module.rst:221 -#: ../../c-api/module.rst:242 +#: ../../c-api/module.rst:219 ../../c-api/module.rst:234 +#: ../../c-api/module.rst:255 msgid "" "This function is not called if the module state was requested but is not " "allocated yet. This is the case immediately after the module is created and " "before the module is executed (:c:data:`Py_mod_exec` function). More " "precisely, this function is not called if :c:member:`~PyModuleDef.m_size` is " -"greater than 0 and the module state (as returned by :c:func:" -"`PyModule_GetState`) is ``NULL``." +"greater than 0 and the module state (as returned " +"by :c:func:`PyModule_GetState`) is ``NULL``." msgstr "" -#: ../../c-api/module.rst:213 ../../c-api/module.rst:234 -#: ../../c-api/module.rst:249 +#: ../../c-api/module.rst:226 ../../c-api/module.rst:247 +#: ../../c-api/module.rst:262 msgid "No longer called before the module state is allocated." msgstr "" -#: ../../c-api/module.rst:218 +#: ../../c-api/module.rst:231 msgid "" "A clear function to call during GC clearing of the module object, or " "``NULL`` if not needed." msgstr "" -#: ../../c-api/module.rst:228 +#: ../../c-api/module.rst:241 msgid "" "Like :c:member:`PyTypeObject.tp_clear`, this function is not *always* called " "before a module is deallocated. For example, when reference counting is " @@ -257,174 +276,56 @@ msgid "" "directly." msgstr "" -#: ../../c-api/module.rst:239 +#: ../../c-api/module.rst:252 msgid "" "A function to call during deallocation of the module object, or ``NULL`` if " "not needed." msgstr "" -#: ../../c-api/module.rst:253 -msgid "Single-phase initialization" -msgstr "" - -#: ../../c-api/module.rst:255 -msgid "" -"The module initialization function may create and return the module object " -"directly. This is referred to as \"single-phase initialization\", and uses " -"one of the following two module creation functions:" -msgstr "" - -#: ../../c-api/module.rst:261 -msgid "" -"Create a new module object, given the definition in *def*. This behaves " -"like :c:func:`PyModule_Create2` with *module_api_version* set to :c:macro:" -"`PYTHON_API_VERSION`." -msgstr "" - -#: ../../c-api/module.rst:268 -msgid "" -"Create a new module object, given the definition in *def*, assuming the API " -"version *module_api_version*. If that version does not match the version of " -"the running interpreter, a :exc:`RuntimeWarning` is emitted." -msgstr "" - -#: ../../c-api/module.rst:276 -msgid "" -"Most uses of this function should be using :c:func:`PyModule_Create` " -"instead; only use this if you are sure you need it." -msgstr "" - -#: ../../c-api/module.rst:279 -msgid "" -"Before it is returned from in the initialization function, the resulting " -"module object is typically populated using functions like :c:func:" -"`PyModule_AddObjectRef`." -msgstr "" - -#: ../../c-api/module.rst:285 -msgid "Multi-phase initialization" -msgstr "" - -#: ../../c-api/module.rst:287 -msgid "" -"An alternate way to specify extensions is to request \"multi-phase " -"initialization\". Extension modules created this way behave more like Python " -"modules: the initialization is split between the *creation phase*, when the " -"module object is created, and the *execution phase*, when it is populated. " -"The distinction is similar to the :py:meth:`~object.__new__` and :py:meth:" -"`~object.__init__` methods of classes." -msgstr "" - -#: ../../c-api/module.rst:294 -msgid "" -"Unlike modules created using single-phase initialization, these modules are " -"not singletons. For example, if the :py:attr:`sys.modules` entry is removed " -"and the module is re-imported, a new module object is created, and typically " -"populated with fresh method and type objects. The old module is subject to " -"normal garbage collection. This mirrors the behavior of pure-Python modules." -msgstr "" - -#: ../../c-api/module.rst:302 -msgid "" -"Additional module instances may be created in :ref:`sub-interpreters ` or after after Python runtime reinitialization (:c:" -"func:`Py_Finalize` and :c:func:`Py_Initialize`). In these cases, sharing " -"Python objects between module instances would likely cause crashes or " -"undefined behavior." -msgstr "" - -#: ../../c-api/module.rst:309 -msgid "" -"To avoid such issues, each instance of an extension module should be " -"*isolated*: changes to one instance should not implicitly affect the others, " -"and all state, including references to Python objects, should be specific to " -"a particular module instance. See :ref:`isolating-extensions-howto` for more " -"details and a practical guide." -msgstr "" - -#: ../../c-api/module.rst:315 -msgid "" -"A simpler way to avoid these issues is :ref:`raising an error on repeated " -"initialization `." -msgstr "" - -#: ../../c-api/module.rst:318 -msgid "" -"All modules created using multi-phase initialization are expected to " -"support :ref:`sub-interpreters `, or otherwise " -"explicitly signal a lack of support. This is usually achieved by isolation " -"or blocking repeated initialization, as above. A module may also be limited " -"to the main interpreter using the :c:data:`Py_mod_multiple_interpreters` " -"slot." -msgstr "" - -#: ../../c-api/module.rst:326 -msgid "" -"To request multi-phase initialization, the initialization function " -"(PyInit_modulename) returns a :c:type:`PyModuleDef` instance with non-empty :" -"c:member:`~PyModuleDef.m_slots`. Before it is returned, the ``PyModuleDef`` " -"instance must be initialized with the following function:" -msgstr "" - -#: ../../c-api/module.rst:333 -msgid "" -"Ensures a module definition is a properly initialized Python object that " -"correctly reports its type and reference count." -msgstr "" - -#: ../../c-api/module.rst:336 -msgid "Returns *def* cast to ``PyObject*``, or ``NULL`` if an error occurred." -msgstr "" - -#: ../../c-api/module.rst:340 -msgid "" -"The *m_slots* member of the module definition must point to an array of " -"``PyModuleDef_Slot`` structures:" -msgstr "" +#: ../../c-api/module.rst:267 +#, fuzzy +msgid "Module slots" +msgstr "模組查找" -#: ../../c-api/module.rst:347 +#: ../../c-api/module.rst:273 msgid "A slot ID, chosen from the available values explained below." msgstr "" -#: ../../c-api/module.rst:351 +#: ../../c-api/module.rst:277 msgid "Value of the slot, whose meaning depends on the slot ID." msgstr "" -#: ../../c-api/module.rst:355 -msgid "The *m_slots* array must be terminated by a slot with id 0." -msgstr "" - -#: ../../c-api/module.rst:357 +#: ../../c-api/module.rst:281 msgid "The available slot types are:" msgstr "" -#: ../../c-api/module.rst:361 +#: ../../c-api/module.rst:285 msgid "" "Specifies a function that is called to create the module object itself. The " "*value* pointer of this slot must point to a function of the signature:" msgstr "" -#: ../../c-api/module.rst:368 +#: ../../c-api/module.rst:292 msgid "" "The function receives a :py:class:`~importlib.machinery.ModuleSpec` " "instance, as defined in :PEP:`451`, and the module definition. It should " "return a new module object, or set an error and return ``NULL``." msgstr "" -#: ../../c-api/module.rst:373 +#: ../../c-api/module.rst:297 msgid "" "This function should be kept minimal. In particular, it should not call " "arbitrary Python code, as trying to import the same module again may result " "in an infinite loop." msgstr "" -#: ../../c-api/module.rst:377 +#: ../../c-api/module.rst:301 msgid "" "Multiple ``Py_mod_create`` slots may not be specified in one module " "definition." msgstr "" -#: ../../c-api/module.rst:380 +#: ../../c-api/module.rst:304 msgid "" "If ``Py_mod_create`` is not specified, the import machinery will create a " "normal module object using :c:func:`PyModule_New`. The name is taken from " @@ -433,17 +334,17 @@ msgid "" "through symlinks, all while sharing a single module definition." msgstr "" -#: ../../c-api/module.rst:386 +#: ../../c-api/module.rst:310 msgid "" -"There is no requirement for the returned object to be an instance of :c:type:" -"`PyModule_Type`. Any type can be used, as long as it supports setting and " -"getting import-related attributes. However, only ``PyModule_Type`` instances " -"may be returned if the ``PyModuleDef`` has non-``NULL`` ``m_traverse``, " -"``m_clear``, ``m_free``; non-zero ``m_size``; or slots other than " -"``Py_mod_create``." +"There is no requirement for the returned object to be an instance " +"of :c:type:`PyModule_Type`. Any type can be used, as long as it supports " +"setting and getting import-related attributes. However, only " +"``PyModule_Type`` instances may be returned if the ``PyModuleDef`` has non-" +"``NULL`` ``m_traverse``, ``m_clear``, ``m_free``; non-zero ``m_size``; or " +"slots other than ``Py_mod_create``." msgstr "" -#: ../../c-api/module.rst:395 +#: ../../c-api/module.rst:319 msgid "" "Specifies a function that is called to *execute* the module. This is " "equivalent to executing the code of a Python module: typically, this " @@ -451,61 +352,61 @@ msgid "" "function is:" msgstr "" -#: ../../c-api/module.rst:404 +#: ../../c-api/module.rst:328 msgid "" "If multiple ``Py_mod_exec`` slots are specified, they are processed in the " "order they appear in the *m_slots* array." msgstr "" -#: ../../c-api/module.rst:409 ../../c-api/module.rst:442 +#: ../../c-api/module.rst:333 ../../c-api/module.rst:366 msgid "Specifies one of the following values:" msgstr "" -#: ../../c-api/module.rst:415 +#: ../../c-api/module.rst:339 msgid "The module does not support being imported in subinterpreters." msgstr "" -#: ../../c-api/module.rst:419 +#: ../../c-api/module.rst:343 msgid "" "The module supports being imported in subinterpreters, but only when they " "share the main interpreter's GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: ../../c-api/module.rst:425 +#: ../../c-api/module.rst:349 msgid "" "The module supports being imported in subinterpreters, even when they have " "their own GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: ../../c-api/module.rst:429 +#: ../../c-api/module.rst:353 msgid "" "This slot determines whether or not importing this module in a " "subinterpreter will fail." msgstr "" -#: ../../c-api/module.rst:432 +#: ../../c-api/module.rst:356 msgid "" "Multiple ``Py_mod_multiple_interpreters`` slots may not be specified in one " "module definition." msgstr "" -#: ../../c-api/module.rst:435 +#: ../../c-api/module.rst:359 msgid "" "If ``Py_mod_multiple_interpreters`` is not specified, the import machinery " "defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``." msgstr "" -#: ../../c-api/module.rst:448 +#: ../../c-api/module.rst:372 msgid "" "The module depends on the presence of the global interpreter lock (GIL), and " "may access global state without synchronization." msgstr "" -#: ../../c-api/module.rst:453 +#: ../../c-api/module.rst:377 msgid "The module is safe to run without an active GIL." msgstr "" -#: ../../c-api/module.rst:455 +#: ../../c-api/module.rst:379 msgid "" "This slot is ignored by Python builds not configured with :option:`--disable-" "gil`. Otherwise, it determines whether or not importing this module will " @@ -513,41 +414,65 @@ msgid "" "threaded-cpython` for more detail." msgstr "" -#: ../../c-api/module.rst:460 +#: ../../c-api/module.rst:384 msgid "" "Multiple ``Py_mod_gil`` slots may not be specified in one module definition." msgstr "" -#: ../../c-api/module.rst:462 +#: ../../c-api/module.rst:386 msgid "" "If ``Py_mod_gil`` is not specified, the import machinery defaults to " "``Py_MOD_GIL_USED``." msgstr "" -#: ../../c-api/module.rst:467 -msgid "See :PEP:`489` for more details on multi-phase initialization." -msgstr "更多關於多階段初始化的詳細資訊,請參閱 :pep:`489`。" +#: ../../c-api/module.rst:395 +msgid "Creating extension modules dynamically" +msgstr "" -#: ../../c-api/module.rst:470 -msgid "Low-level module creation functions" +#: ../../c-api/module.rst:397 +msgid "" +"The following functions may be used to create a module outside of an " +"extension's :ref:`initialization function `. They are " +"also used in :ref:`single-phase initialization `." msgstr "" -#: ../../c-api/module.rst:472 +#: ../../c-api/module.rst:404 msgid "" -"The following functions are called under the hood when using multi-phase " -"initialization. They can be used directly, for example when creating module " -"objects dynamically. Note that both ``PyModule_FromDefAndSpec`` and " -"``PyModule_ExecDef`` must be called to fully initialize a module." +"Create a new module object, given the definition in *def*. This is a macro " +"that calls :c:func:`PyModule_Create2` with *module_api_version* set " +"to :c:macro:`PYTHON_API_VERSION`, or to :c:macro:`PYTHON_ABI_VERSION` if " +"using the :ref:`limited API `." msgstr "" -#: ../../c-api/module.rst:479 +#: ../../c-api/module.rst:412 msgid "" -"Create a new module object, given the definition in *def* and the ModuleSpec " -"*spec*. This behaves like :c:func:`PyModule_FromDefAndSpec2` with " -"*module_api_version* set to :c:macro:`PYTHON_API_VERSION`." +"Create a new module object, given the definition in *def*, assuming the API " +"version *module_api_version*. If that version does not match the version of " +"the running interpreter, a :exc:`RuntimeWarning` is emitted." +msgstr "" + +#: ../../c-api/module.rst:418 +msgid "" +"This function does not support slots. The :c:member:`~PyModuleDef.m_slots` " +"member of *def* must be ``NULL``." +msgstr "" + +#: ../../c-api/module.rst:424 +msgid "" +"Most uses of this function should be using :c:func:`PyModule_Create` " +"instead; only use this if you are sure you need it." +msgstr "" + +#: ../../c-api/module.rst:429 +msgid "" +"This macro calls :c:func:`PyModule_FromDefAndSpec2` with " +"*module_api_version* set to :c:macro:`PYTHON_API_VERSION`, or " +"to :c:macro:`PYTHON_ABI_VERSION` if using the :ref:`limited API `." msgstr "" -#: ../../c-api/module.rst:487 +#: ../../c-api/module.rst:438 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*, assuming the API version *module_api_version*. If that version does " @@ -555,64 +480,66 @@ msgid "" "emitted." msgstr "" -#: ../../c-api/module.rst:496 +#: ../../c-api/module.rst:445 +msgid "" +"Note that this does not process execution slots (:c:data:`Py_mod_exec`). " +"Both ``PyModule_FromDefAndSpec`` and ``PyModule_ExecDef`` must be called to " +"fully initialize a module." +msgstr "" + +#: ../../c-api/module.rst:451 msgid "" "Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:503 +#: ../../c-api/module.rst:458 msgid "Process any execution slots (:c:data:`Py_mod_exec`) given in *def*." msgstr "" -#: ../../c-api/module.rst:509 -msgid "" -"Set the docstring for *module* to *docstring*. This function is called " -"automatically when creating a module from ``PyModuleDef``, using either " -"``PyModule_Create`` or ``PyModule_FromDefAndSpec``." +#: ../../c-api/module.rst:464 +msgid "The C API version. Defined for backwards compatibility." msgstr "" -#: ../../c-api/module.rst:518 +#: ../../c-api/module.rst:466 ../../c-api/module.rst:473 msgid "" -"Add the functions from the ``NULL`` terminated *functions* array to " -"*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " -"individual entries (due to the lack of a shared module namespace, module " -"level \"functions\" implemented in C typically receive the module as their " -"first parameter, making them similar to instance methods on Python classes). " -"This function is called automatically when creating a module from " -"``PyModuleDef``, using either ``PyModule_Create`` or " -"``PyModule_FromDefAndSpec``." +"Currently, this constant is not updated in new Python versions, and is not " +"useful for versioning. This may change in the future." +msgstr "" + +#: ../../c-api/module.rst:471 +msgid "Defined as ``3`` for backwards compatibility." msgstr "" -#: ../../c-api/module.rst:530 +#: ../../c-api/module.rst:478 msgid "Support functions" msgstr "支援的函式" -#: ../../c-api/module.rst:532 +#: ../../c-api/module.rst:480 msgid "" -"The module initialization function (if using single phase initialization) or " -"a function called from a module execution slot (if using multi-phase " -"initialization), can use the following functions to help initialize the " -"module state:" +"The following functions are provided to help initialize a module state. They " +"are intended for a module's execution slots (:c:data:`Py_mod_exec`), the " +"initialization function for legacy :ref:`single-phase initialization `, or code that creates modules dynamically." msgstr "" -#: ../../c-api/module.rst:539 +#: ../../c-api/module.rst:488 msgid "" "Add an object to *module* as *name*. This is a convenience function which " "can be used from the module's initialization function." msgstr "" -#: ../../c-api/module.rst:542 +#: ../../c-api/module.rst:491 msgid "" "On success, return ``0``. On error, raise an exception and return ``-1``." msgstr "" -#: ../../c-api/module.rst:544 ../../c-api/module.rst:595 -#: ../../c-api/module.rst:622 +#: ../../c-api/module.rst:493 ../../c-api/module.rst:544 +#: ../../c-api/module.rst:571 msgid "Example usage::" msgstr "用法範例: ::" -#: ../../c-api/module.rst:546 +#: ../../c-api/module.rst:495 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -638,20 +565,20 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:558 +#: ../../c-api/module.rst:507 msgid "" "To be convenient, the function accepts ``NULL`` *value* with an exception " "set. In this case, return ``-1`` and just leave the raised exception " "unchanged." msgstr "" -#: ../../c-api/module.rst:562 +#: ../../c-api/module.rst:511 msgid "" "The example can also be written without checking explicitly if *obj* is " "``NULL``::" msgstr "" -#: ../../c-api/module.rst:565 +#: ../../c-api/module.rst:514 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -671,23 +598,23 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:574 +#: ../../c-api/module.rst:523 msgid "" "Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this " "case, since *obj* can be ``NULL``." msgstr "" -#: ../../c-api/module.rst:577 +#: ../../c-api/module.rst:526 msgid "" "The number of different *name* strings passed to this function should be " "kept small, usually by only using statically allocated strings as *name*. " -"For names that aren't known at compile time, prefer calling :c:func:" -"`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For more " -"details, see :c:func:`PyUnicode_InternFromString`, which may be used " -"internally to create a key object." +"For names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` " +"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " +"may be used internally to create a key object." msgstr "" -#: ../../c-api/module.rst:590 +#: ../../c-api/module.rst:539 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but \"steals\" a reference to " "*value*. It can be called with a result of function that returns a new " @@ -695,39 +622,39 @@ msgid "" "variable." msgstr "" -#: ../../c-api/module.rst:597 +#: ../../c-api/module.rst:546 msgid "" "if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" " goto error;\n" "}" msgstr "" -#: ../../c-api/module.rst:606 +#: ../../c-api/module.rst:555 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to " "*value* on success (if it returns ``0``)." msgstr "" -#: ../../c-api/module.rst:609 +#: ../../c-api/module.rst:558 msgid "" "The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions " "are recommended, since it is easy to introduce reference leaks by misusing " "the :c:func:`PyModule_AddObject` function." msgstr "" -#: ../../c-api/module.rst:616 +#: ../../c-api/module.rst:565 msgid "" "Unlike other functions that steal references, ``PyModule_AddObject()`` only " "releases the reference to *value* **on success**." msgstr "" -#: ../../c-api/module.rst:619 +#: ../../c-api/module.rst:568 msgid "" -"This means that its return value must be checked, and calling code must :c:" -"func:`Py_XDECREF` *value* manually on error." +"This means that its return value must be checked, and calling code " +"must :c:func:`Py_XDECREF` *value* manually on error." msgstr "" -#: ../../c-api/module.rst:624 +#: ../../c-api/module.rst:573 msgid "" "PyObject *obj = PyBytes_FromString(value);\n" "if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" @@ -741,24 +668,24 @@ msgid "" "// Py_XDECREF(obj) is not needed here." msgstr "" -#: ../../c-api/module.rst:637 +#: ../../c-api/module.rst:586 msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." msgstr "" -#: ../../c-api/module.rst:642 +#: ../../c-api/module.rst:591 msgid "" "Add an integer constant to *module* as *name*. This convenience function " "can be used from the module's initialization function. Return ``-1`` with an " "exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:646 +#: ../../c-api/module.rst:595 msgid "" -"This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:" -"func:`PyModule_AddObjectRef`; see their documentation for details." +"This is a convenience function that calls :c:func:`PyLong_FromLong` " +"and :c:func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" -#: ../../c-api/module.rst:652 +#: ../../c-api/module.rst:601 msgid "" "Add a string constant to *module* as *name*. This convenience function can " "be used from the module's initialization function. The string *value* must " @@ -766,14 +693,14 @@ msgid "" "on success." msgstr "" -#: ../../c-api/module.rst:657 +#: ../../c-api/module.rst:606 msgid "" -"This is a convenience function that calls :c:func:" -"`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their " -"documentation for details." +"This is a convenience function that " +"calls :c:func:`PyUnicode_InternFromString` " +"and :c:func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" -#: ../../c-api/module.rst:664 +#: ../../c-api/module.rst:613 msgid "" "Add an int constant to *module*. The name and the value are taken from " "*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int " @@ -781,11 +708,11 @@ msgid "" "with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:672 +#: ../../c-api/module.rst:621 msgid "Add a string constant to *module*." msgstr "將字串常數加入到 *module* 中。" -#: ../../c-api/module.rst:676 +#: ../../c-api/module.rst:625 msgid "" "Add a type object to *module*. The type object is finalized by calling " "internally :c:func:`PyType_Ready`. The name of the type object is taken from " @@ -793,36 +720,64 @@ msgid "" "``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:686 +#: ../../c-api/module.rst:635 +msgid "" +"Add the functions from the ``NULL`` terminated *functions* array to " +"*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " +"individual entries (due to the lack of a shared module namespace, module " +"level \"functions\" implemented in C typically receive the module as their " +"first parameter, making them similar to instance methods on Python classes)." +msgstr "" + +#: ../../c-api/module.rst:641 +msgid "" +"This function is called automatically when creating a module from " +"``PyModuleDef`` (such as when using :ref:`multi-phase-initialization`, " +"``PyModule_Create``, or ``PyModule_FromDefAndSpec``). Some module authors " +"may prefer defining functions in multiple :c:type:`PyMethodDef` arrays; in " +"that case they should call this function directly." +msgstr "" + +#: ../../c-api/module.rst:652 +msgid "" +"Set the docstring for *module* to *docstring*. This function is called " +"automatically when creating a module from ``PyModuleDef`` (such as when " +"using :ref:`multi-phase-initialization`, ``PyModule_Create``, or " +"``PyModule_FromDefAndSpec``)." +msgstr "" + +#: ../../c-api/module.rst:661 msgid "" "Indicate that *module* does or does not support running without the global " "interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. " -"It must be called during *module*'s initialization function. If this " -"function is not called during module initialization, the import machinery " -"assumes the module does not support running without the GIL. This function " -"is only available in Python builds configured with :option:`--disable-gil`. " -"Return ``-1`` with an exception set on error, ``0`` on success." +"It must be called during *module*'s initialization function when " +"using :ref:`single-phase-initialization`. If this function is not called " +"during module initialization, the import machinery assumes the module does " +"not support running without the GIL. This function is only available in " +"Python builds configured with :option:`--disable-gil`. Return ``-1`` with an " +"exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:699 -msgid "Module lookup" -msgstr "模組查找" +#: ../../c-api/module.rst:675 +msgid "Module lookup (single-phase initialization)" +msgstr "" -#: ../../c-api/module.rst:701 +#: ../../c-api/module.rst:677 msgid "" -"Single-phase initialization creates singleton modules that can be looked up " -"in the context of the current interpreter. This allows the module object to " -"be retrieved later with only a reference to the module definition." +"The legacy :ref:`single-phase initialization ` " +"initialization scheme creates singleton modules that can be looked up in the " +"context of the current interpreter. This allows the module object to be " +"retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:705 +#: ../../c-api/module.rst:682 msgid "" "These functions will not work on modules created using multi-phase " "initialization, since multiple such modules can be created from a single " "definition." msgstr "" -#: ../../c-api/module.rst:710 +#: ../../c-api/module.rst:687 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -831,20 +786,21 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:717 +#: ../../c-api/module.rst:694 msgid "" "Attaches the module object passed to the function to the interpreter state. " -"This allows the module object to be accessible via :c:func:" -"`PyState_FindModule`." +"This allows the module object to be accessible " +"via :c:func:`PyState_FindModule`." msgstr "" -#: ../../c-api/module.rst:720 +#: ../../c-api/module.rst:697 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:722 +#: ../../c-api/module.rst:699 msgid "" -"Python calls ``PyState_AddModule`` automatically after importing a module, " +"Python calls ``PyState_AddModule`` automatically after importing a module " +"that uses :ref:`single-phase initialization `, " "so it is unnecessary (but harmless) to call it from module initialization " "code. An explicit call is needed only if the module's own init code " "subsequently calls ``PyState_FindModule``. The function is mainly intended " @@ -853,15 +809,21 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:730 ../../c-api/module.rst:741 -msgid "The caller must hold the GIL." +#: ../../c-api/module.rst:708 +msgid "" +"If a module was attached previously using the same *def*, it is replaced by " +"the new *module*." msgstr "" -#: ../../c-api/module.rst:732 +#: ../../c-api/module.rst:711 ../../c-api/module.rst:722 +msgid "The caller must have an :term:`attached thread state`." +msgstr "" + +#: ../../c-api/module.rst:713 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:738 +#: ../../c-api/module.rst:719 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." @@ -906,3 +868,9 @@ msgstr "__dict__(模組屬性)" #: ../../c-api/module.rst:77 ../../c-api/module.rst:108 msgid "SystemError (built-in exception)" msgstr "SystemError(內建例外)" + +#~ msgid "Initializing C modules" +#~ msgstr "初始化 C 模組" + +#~ msgid "See :PEP:`489` for more details on multi-phase initialization." +#~ msgstr "更多關於多階段初始化的詳細資訊,請參閱 :pep:`489`。" diff --git a/c-api/monitoring.po b/c-api/monitoring.po index ac7e58b853e..c038e4ee306 100644 --- a/c-api/monitoring.po +++ b/c-api/monitoring.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-20 00:14+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,10 +42,10 @@ msgid "" "accepts a ``PyMonitoringState`` struct which contains concise information " "about the activation state of events, as well as the event arguments, which " "include a ``PyObject*`` representing the code object, the instruction offset " -"and sometimes additional, event-specific arguments (see :mod:`sys." -"monitoring` for details about the signatures of the different event " -"callbacks). The ``codelike`` argument should be an instance of :class:`types." -"CodeType` or of a type that emulates it." +"and sometimes additional, event-specific arguments " +"(see :mod:`sys.monitoring` for details about the signatures of the different " +"event callbacks). The ``codelike`` argument should be an instance " +"of :class:`types.CodeType` or of a type that emulates it." msgstr "" #: ../../c-api/monitoring.rst:27 @@ -106,80 +106,86 @@ msgid "Fire a ``JUMP`` event." msgstr "發出一個 ``JUMP`` 事件。" #: ../../c-api/monitoring.rst:80 -msgid "Fire a ``BRANCH`` event." +#, fuzzy +msgid "Fire a ``BRANCH_LEFT`` event." msgstr "發出一個 ``BRANCH`` 事件。" #: ../../c-api/monitoring.rst:85 +#, fuzzy +msgid "Fire a ``BRANCH_RIGHT`` event." +msgstr "發出一個 ``BRANCH`` 事件。" + +#: ../../c-api/monitoring.rst:90 msgid "Fire a ``C_RETURN`` event." msgstr "發出一個 ``C_RETURN`` 事件。" -#: ../../c-api/monitoring.rst:90 +#: ../../c-api/monitoring.rst:95 msgid "" -"Fire a ``PY_THROW`` event with the current exception (as returned by :c:func:" -"`PyErr_GetRaisedException`)." +"Fire a ``PY_THROW`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." msgstr "" -#: ../../c-api/monitoring.rst:96 +#: ../../c-api/monitoring.rst:101 msgid "" -"Fire a ``RAISE`` event with the current exception (as returned by :c:func:" -"`PyErr_GetRaisedException`)." +"Fire a ``RAISE`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." msgstr "" -#: ../../c-api/monitoring.rst:102 +#: ../../c-api/monitoring.rst:107 msgid "" -"Fire a ``C_RAISE`` event with the current exception (as returned by :c:func:" -"`PyErr_GetRaisedException`)." +"Fire a ``C_RAISE`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." msgstr "" -#: ../../c-api/monitoring.rst:108 +#: ../../c-api/monitoring.rst:113 msgid "" -"Fire a ``RERAISE`` event with the current exception (as returned by :c:func:" -"`PyErr_GetRaisedException`)." +"Fire a ``RERAISE`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." msgstr "" -#: ../../c-api/monitoring.rst:114 +#: ../../c-api/monitoring.rst:119 msgid "" "Fire an ``EXCEPTION_HANDLED`` event with the current exception (as returned " "by :c:func:`PyErr_GetRaisedException`)." msgstr "" -#: ../../c-api/monitoring.rst:120 +#: ../../c-api/monitoring.rst:125 msgid "" -"Fire a ``PY_UNWIND`` event with the current exception (as returned by :c:" -"func:`PyErr_GetRaisedException`)." +"Fire a ``PY_UNWIND`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." msgstr "" -#: ../../c-api/monitoring.rst:126 +#: ../../c-api/monitoring.rst:131 msgid "" -"Fire a ``STOP_ITERATION`` event. If ``value`` is an instance of :exc:" -"`StopIteration`, it is used. Otherwise, a new :exc:`StopIteration` instance " -"is created with ``value`` as its argument." +"Fire a ``STOP_ITERATION`` event. If ``value`` is an instance " +"of :exc:`StopIteration`, it is used. Otherwise, a new :exc:`StopIteration` " +"instance is created with ``value`` as its argument." msgstr "" -#: ../../c-api/monitoring.rst:131 +#: ../../c-api/monitoring.rst:136 msgid "Managing the Monitoring State" msgstr "" -#: ../../c-api/monitoring.rst:133 +#: ../../c-api/monitoring.rst:138 msgid "" "Monitoring states can be managed with the help of monitoring scopes. A scope " "would typically correspond to a python function." msgstr "" -#: ../../c-api/monitoring.rst:138 +#: ../../c-api/monitoring.rst:143 msgid "" "Enter a monitored scope. ``event_types`` is an array of the event IDs for " "events that may be fired from the scope. For example, the ID of a " "``PY_START`` event is the value ``PY_MONITORING_EVENT_PY_START``, which is " -"numerically equal to the base-2 logarithm of ``sys.monitoring.events." -"PY_START``. ``state_array`` is an array with a monitoring state entry for " -"each event in ``event_types``, it is allocated by the user but populated by :" -"c:func:`!PyMonitoring_EnterScope` with information about the activation " -"state of the event. The size of ``event_types`` (and hence also of " -"``state_array``) is given in ``length``." +"numerically equal to the base-2 logarithm of " +"``sys.monitoring.events.PY_START``. ``state_array`` is an array with a " +"monitoring state entry for each event in ``event_types``, it is allocated by " +"the user but populated by :c:func:`!PyMonitoring_EnterScope` with " +"information about the activation state of the event. The size of " +"``event_types`` (and hence also of ``state_array``) is given in ``length``." msgstr "" -#: ../../c-api/monitoring.rst:148 +#: ../../c-api/monitoring.rst:153 msgid "" "The ``version`` argument is a pointer to a value which should be allocated " "by the user together with ``state_array`` and initialized to 0, and then set " @@ -188,7 +194,7 @@ msgid "" "to return quickly if they have not." msgstr "" -#: ../../c-api/monitoring.rst:154 +#: ../../c-api/monitoring.rst:159 msgid "" "The scopes referred to here are lexical scopes: a function, class or " "method. :c:func:`!PyMonitoring_EnterScope` should be called whenever the " @@ -198,97 +204,103 @@ msgid "" "emulating a generator, the scope needs to be exited and re-entered." msgstr "" -#: ../../c-api/monitoring.rst:161 +#: ../../c-api/monitoring.rst:166 msgid "The macros for *event_types* are:" msgstr "*event_types* 的巨集有:" -#: ../../c-api/monitoring.rst:169 +#: ../../c-api/monitoring.rst:174 msgid "Macro" msgstr "巨集" -#: ../../c-api/monitoring.rst:169 +#: ../../c-api/monitoring.rst:174 msgid "Event" msgstr "事件" -#: ../../c-api/monitoring.rst:171 -msgid ":monitoring-event:`BRANCH`" +#: ../../c-api/monitoring.rst:176 +#, fuzzy +msgid ":monitoring-event:`BRANCH_LEFT`" +msgstr ":monitoring-event:`BRANCH`" + +#: ../../c-api/monitoring.rst:177 +#, fuzzy +msgid ":monitoring-event:`BRANCH_RIGHT`" msgstr ":monitoring-event:`BRANCH`" -#: ../../c-api/monitoring.rst:172 +#: ../../c-api/monitoring.rst:178 msgid ":monitoring-event:`CALL`" msgstr ":monitoring-event:`CALL`" -#: ../../c-api/monitoring.rst:173 +#: ../../c-api/monitoring.rst:179 msgid ":monitoring-event:`C_RAISE`" msgstr ":monitoring-event:`C_RAISE`" -#: ../../c-api/monitoring.rst:174 +#: ../../c-api/monitoring.rst:180 msgid ":monitoring-event:`C_RETURN`" msgstr ":monitoring-event:`C_RETURN`" -#: ../../c-api/monitoring.rst:175 +#: ../../c-api/monitoring.rst:181 msgid ":monitoring-event:`EXCEPTION_HANDLED`" msgstr ":monitoring-event:`EXCEPTION_HANDLED`" -#: ../../c-api/monitoring.rst:176 +#: ../../c-api/monitoring.rst:182 msgid ":monitoring-event:`INSTRUCTION`" msgstr ":monitoring-event:`INSTRUCTION`" -#: ../../c-api/monitoring.rst:177 +#: ../../c-api/monitoring.rst:183 msgid ":monitoring-event:`JUMP`" msgstr ":monitoring-event:`JUMP`" -#: ../../c-api/monitoring.rst:178 +#: ../../c-api/monitoring.rst:184 msgid ":monitoring-event:`LINE`" msgstr ":monitoring-event:`LINE`" -#: ../../c-api/monitoring.rst:179 +#: ../../c-api/monitoring.rst:185 msgid ":monitoring-event:`PY_RESUME`" msgstr ":monitoring-event:`PY_RESUME`" -#: ../../c-api/monitoring.rst:180 +#: ../../c-api/monitoring.rst:186 msgid ":monitoring-event:`PY_RETURN`" msgstr ":monitoring-event:`PY_RETURN`" -#: ../../c-api/monitoring.rst:181 +#: ../../c-api/monitoring.rst:187 msgid ":monitoring-event:`PY_START`" msgstr ":monitoring-event:`PY_START`" -#: ../../c-api/monitoring.rst:182 +#: ../../c-api/monitoring.rst:188 msgid ":monitoring-event:`PY_THROW`" msgstr ":monitoring-event:`PY_THROW`" -#: ../../c-api/monitoring.rst:183 +#: ../../c-api/monitoring.rst:189 msgid ":monitoring-event:`PY_UNWIND`" msgstr ":monitoring-event:`PY_UNWIND`" -#: ../../c-api/monitoring.rst:184 +#: ../../c-api/monitoring.rst:190 msgid ":monitoring-event:`PY_YIELD`" msgstr ":monitoring-event:`PY_YIELD`" -#: ../../c-api/monitoring.rst:185 +#: ../../c-api/monitoring.rst:191 msgid ":monitoring-event:`RAISE`" msgstr ":monitoring-event:`RAISE`" -#: ../../c-api/monitoring.rst:186 +#: ../../c-api/monitoring.rst:192 msgid ":monitoring-event:`RERAISE`" msgstr ":monitoring-event:`RERAISE`" -#: ../../c-api/monitoring.rst:187 +#: ../../c-api/monitoring.rst:193 msgid ":monitoring-event:`STOP_ITERATION`" msgstr ":monitoring-event:`STOP_ITERATION`" -#: ../../c-api/monitoring.rst:192 +#: ../../c-api/monitoring.rst:198 msgid "" "Exit the last scope that was entered with :c:func:`!PyMonitoring_EnterScope`." msgstr "" -#: ../../c-api/monitoring.rst:197 +#: ../../c-api/monitoring.rst:203 msgid "" "Return true if the event corresponding to the event ID *ev* is a :ref:`local " "event `." msgstr "" -#: ../../c-api/monitoring.rst:204 +#: ../../c-api/monitoring.rst:210 msgid "This function is :term:`soft deprecated`." msgstr "" diff --git a/c-api/object.po b/c-api/object.po index 85e8adfd099..14cfc4164c2 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-05 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -715,6 +715,218 @@ msgstr "" msgid "Clear the managed dictionary of *obj*." msgstr "" +#: ../../c-api/object.rst:595 +msgid "" +"Enable `deferred reference counting `_ on *obj*, if supported by the runtime. In " +"the :term:`free-threaded ` build, this allows the " +"interpreter to avoid reference count adjustments to *obj*, which may improve " +"multi-threaded performance. The tradeoff is that *obj* will only be " +"deallocated by the tracing garbage collector, and not when the interpreter " +"no longer has any references to it." +msgstr "" + +#: ../../c-api/object.rst:602 +msgid "" +"This function returns ``1`` if deferred reference counting is enabled on " +"*obj*, and ``0`` if deferred reference counting is not supported or if the " +"hint was ignored by the interpreter, such as when deferred reference " +"counting is already enabled on *obj*. This function is thread-safe, and " +"cannot fail." +msgstr "" + +#: ../../c-api/object.rst:607 +msgid "" +"This function does nothing on builds with the :term:`GIL` enabled, which do " +"not support deferred reference counting. This also does nothing if *obj* is " +"not an object tracked by the garbage collector (see :func:`gc.is_tracked` " +"and :c:func:`PyObject_GC_IsTracked`)." +msgstr "" + +#: ../../c-api/object.rst:612 +msgid "" +"This function is intended to be used soon after *obj* is created, by the " +"code that creates it, such as in the " +"object's :c:member:`~PyTypeObject.tp_new` slot." +msgstr "" + +#: ../../c-api/object.rst:620 +msgid "" +"Check if *obj* is a unique temporary object. Returns ``1`` if *obj* is known " +"to be a unique temporary object, and ``0`` otherwise. This function cannot " +"fail, but the check is conservative, and may return ``0`` in some cases even " +"if *obj* is a unique temporary object." +msgstr "" + +#: ../../c-api/object.rst:626 +msgid "" +"If an object is a unique temporary, it is guaranteed that the current code " +"has the only reference to the object. For arguments to C functions, this " +"should be used instead of checking if the reference count is ``1``. Starting " +"with Python 3.14, the interpreter internally avoids some reference count " +"modifications when loading objects onto the operands stack " +"by :term:`borrowing ` references when possible, which " +"means that a reference count of ``1`` by itself does not guarantee that a " +"function argument uniquely referenced." +msgstr "" + +#: ../../c-api/object.rst:635 +msgid "" +"In the example below, ``my_func`` is called with a unique temporary object " +"as its argument::" +msgstr "" + +#: ../../c-api/object.rst:638 +msgid "my_func([1, 2, 3])" +msgstr "" + +#: ../../c-api/object.rst:640 +msgid "" +"In the example below, ``my_func`` is **not** called with a unique temporary " +"object as its argument, even if its refcount is ``1``::" +msgstr "" + +#: ../../c-api/object.rst:643 +msgid "" +"my_list = [1, 2, 3]\n" +"my_func(my_list)" +msgstr "" + +#: ../../c-api/object.rst:646 +msgid "See also the function :c:func:`Py_REFCNT`." +msgstr "" + +#: ../../c-api/object.rst:652 +msgid "" +"This function returns non-zero if *obj* is :term:`immortal`, and zero " +"otherwise. This function cannot fail." +msgstr "" + +#: ../../c-api/object.rst:657 +msgid "" +"Objects that are immortal in one CPython version are not guaranteed to be " +"immortal in another." +msgstr "" + +#: ../../c-api/object.rst:664 +msgid "" +"Increments the reference count of *obj* if it is not zero. Returns ``1`` if " +"the object's reference count was successfully incremented. Otherwise, this " +"function returns ``0``." +msgstr "" + +#: ../../c-api/object.rst:668 +msgid "" +":c:func:`PyUnstable_EnableTryIncRef` must have been called earlier on *obj* " +"or this function may spuriously return ``0`` in the :term:`free threading` " +"build." +msgstr "" + +#: ../../c-api/object.rst:672 +msgid "" +"This function is logically equivalent to the following C code, except that " +"it behaves atomically in the :term:`free threading` build::" +msgstr "" + +#: ../../c-api/object.rst:675 +msgid "" +"if (Py_REFCNT(op) > 0) {\n" +" Py_INCREF(op);\n" +" return 1;\n" +"}\n" +"return 0;" +msgstr "" + +#: ../../c-api/object.rst:681 +msgid "" +"This is intended as a building block for managing weak references without " +"the overhead of a Python :ref:`weak reference object `." +msgstr "" + +#: ../../c-api/object.rst:684 +msgid "" +"Typically, correct use of this function requires support from *obj*'s " +"deallocator (:c:member:`~PyTypeObject.tp_dealloc`). For example, the " +"following sketch could be adapted to implement a \"weakmap\" that works like " +"a :py:class:`~weakref.WeakValueDictionary` for a specific type:" +msgstr "" + +#: ../../c-api/object.rst:690 +msgid "" +"PyMutex mutex;\n" +"\n" +"PyObject *\n" +"add_entry(weakmap_key_type *key, PyObject *value)\n" +"{\n" +" PyUnstable_EnableTryIncRef(value);\n" +" weakmap_type weakmap = ...;\n" +" PyMutex_Lock(&mutex);\n" +" weakmap_add_entry(weakmap, key, value);\n" +" PyMutex_Unlock(&mutex);\n" +" Py_RETURN_NONE;\n" +"}\n" +"\n" +"PyObject *\n" +"get_value(weakmap_key_type *key)\n" +"{\n" +" weakmap_type weakmap = ...;\n" +" PyMutex_Lock(&mutex);\n" +" PyObject *result = weakmap_find(weakmap, key);\n" +" if (PyUnstable_TryIncRef(result)) {\n" +" // `result` is safe to use\n" +" PyMutex_Unlock(&mutex);\n" +" return result;\n" +" }\n" +" // if we get here, `result` is starting to be garbage-collected,\n" +" // but has not been removed from the weakmap yet\n" +" PyMutex_Unlock(&mutex);\n" +" return NULL;\n" +"}\n" +"\n" +"// tp_dealloc function for weakmap values\n" +"void\n" +"value_dealloc(PyObject *value)\n" +"{\n" +" weakmap_type weakmap = ...;\n" +" PyMutex_Lock(&mutex);\n" +" weakmap_remove_value(weakmap, value);\n" +"\n" +" ...\n" +" PyMutex_Unlock(&mutex);\n" +"}" +msgstr "" + +#: ../../c-api/object.rst:738 +msgid "" +"Enables subsequent uses of :c:func:`PyUnstable_TryIncRef` on *obj*. The " +"caller must hold a :term:`strong reference` to *obj* when calling this." +msgstr "" + +#: ../../c-api/object.rst:745 +msgid "Determine if *op* only has one reference." +msgstr "" + +#: ../../c-api/object.rst:747 +msgid "" +"On GIL-enabled builds, this function is equivalent to :c:expr:`Py_REFCNT(op) " +"== 1`." +msgstr "" + +#: ../../c-api/object.rst:750 +msgid "" +"On a :term:`free threaded ` build, this checks if " +"*op*'s :term:`reference count` is equal to one and additionally checks if " +"*op* is only used by this thread. :c:expr:`Py_REFCNT(op) == 1` is **not** " +"thread-safe on free threaded builds; prefer this function." +msgstr "" + +#: ../../c-api/object.rst:755 +msgid "" +"The caller must hold an :term:`attached thread state`, despite the fact that " +"this function doesn't call into the Python interpreter. This function cannot " +"fail." +msgstr "" + #: ../../c-api/object.rst:316 ../../c-api/object.rst:328 #: ../../c-api/object.rst:353 ../../c-api/object.rst:404 #: ../../c-api/object.rst:438 ../../c-api/object.rst:459 diff --git a/c-api/perfmaps.po b/c-api/perfmaps.po index ee98fd31d11..c5be72a4b78 100644 --- a/c-api/perfmaps.po +++ b/c-api/perfmaps.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-17 17:39+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-05-11 14:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,12 +25,12 @@ msgstr "對 Perf Map 的支援" msgid "" "On supported platforms (as of this writing, only Linux), the runtime can " "take advantage of *perf map files* to make Python functions visible to an " -"external profiling tool (such as `perf `_). A running process may create a file in the ``/tmp`` " +"external profiling tool (such as `perf `_). A running process may create a file in the ``/tmp`` " "directory, which contains entries that can map a section of executable code " "to a name. This interface is described in the `documentation of the Linux " -"Perf tool `_." +"Perf tool `_." msgstr "" "在支援的平台上(截至撰寫本文時,僅限 Linux),runtime 可以利用 *perf map 檔案" "*\\ 使得外部分析工具(例如 `perf \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,51 +37,66 @@ msgstr "取得物件 *o* 的參照計數。" #: ../../c-api/refcounting.rst:18 msgid "" "Note that the returned value may not actually reflect how many references to " -"the object are actually held. For example, some objects are :term:" -"`immortal` and have a very high refcount that does not reflect the actual " -"number of references. Consequently, do not rely on the returned value to be " -"accurate, other than a value of 0 or 1." +"the object are actually held. For example, some objects " +"are :term:`immortal` and have a very high refcount that does not reflect the " +"actual number of references. Consequently, do not rely on the returned " +"value to be accurate, other than a value of 0 or 1." msgstr "" "請注意,回傳的值可能實際上並不反映實際保存了多少對該物件的參照。例如,某些物" -"件是「:term:`不滅的 (immortal) `」,並且具有非常高的參照計" -"數,不能反映實際的參照數量。因此,除了 0 或 1 以外,不要依賴回傳值的準確性。" +"件是「:term:`不滅的 (immortal) `」,並且具有非常高的參照計數,不能" +"反映實際的參照數量。因此,除了 0 或 1 以外,不要依賴回傳值的準確性。" #: ../../c-api/refcounting.rst:24 msgid "" "Use the :c:func:`Py_SET_REFCNT()` function to set an object reference count." msgstr "使用 :c:func:`Py_SET_REFCNT()` 函式設定物件參照計數。" -#: ../../c-api/refcounting.rst:26 +#: ../../c-api/refcounting.rst:28 +msgid "" +"On :term:`free threaded ` builds of Python, returning 1 " +"isn't sufficient to determine if it's safe to treat *o* as having no access " +"by other threads. Use :c:func:`PyUnstable_Object_IsUniquelyReferenced` for " +"that instead." +msgstr "" + +#: ../../c-api/refcounting.rst:33 +msgid "" +"See also the " +"function :c:func:`PyUnstable_Object_IsUniqueReferencedTemporary()`." +msgstr "" + +#: ../../c-api/refcounting.rst:35 msgid ":c:func:`Py_REFCNT()` is changed to the inline static function." msgstr ":c:func:`Py_REFCNT()` 更改為行內靜態函式 (inline static function)。" -#: ../../c-api/refcounting.rst:29 +#: ../../c-api/refcounting.rst:38 msgid "The parameter type is no longer :c:expr:`const PyObject*`." msgstr "參數型別不再是 :c:expr:`const PyObject*`。" -#: ../../c-api/refcounting.rst:35 +#: ../../c-api/refcounting.rst:44 msgid "Set the object *o* reference counter to *refcnt*." msgstr "設定物件 *o* 的參照計數。" -#: ../../c-api/refcounting.rst:37 +#: ../../c-api/refcounting.rst:46 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) `。" +"*refcnt* 大於 ``UINT32_MAX``,則該物件會被設為\\ :term:`不滅的 (immortal) " +"`。" -#: ../../c-api/refcounting.rst:40 ../../c-api/refcounting.rst:53 -#: ../../c-api/refcounting.rst:119 +#: ../../c-api/refcounting.rst:49 ../../c-api/refcounting.rst:62 +#: ../../c-api/refcounting.rst:128 msgid "This function has no effect on :term:`immortal` objects." msgstr "請注意,此函式對\\ :term:`不滅的 `\\ 物件沒有影響。" -#: ../../c-api/refcounting.rst:44 ../../c-api/refcounting.rst:68 -#: ../../c-api/refcounting.rst:147 +#: ../../c-api/refcounting.rst:53 ../../c-api/refcounting.rst:77 +#: ../../c-api/refcounting.rst:156 msgid "Immortal objects are not modified." msgstr "不滅的物件不會被修改。" -#: ../../c-api/refcounting.rst:50 +#: ../../c-api/refcounting.rst:59 msgid "" "Indicate taking a new :term:`strong reference` to object *o*, indicating it " "is in use and should not be destroyed." @@ -89,37 +104,37 @@ msgstr "" "代表取得對於物件 *o* 的新\\ :term:`強參照 `,即它正在使用且" "不應被銷毀。" -#: ../../c-api/refcounting.rst:55 +#: ../../c-api/refcounting.rst:64 msgid "" -"This function is usually used to convert a :term:`borrowed reference` to a :" -"term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be " +"This function is usually used to convert a :term:`borrowed reference` to " +"a :term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be " "used to create a new :term:`strong reference`." msgstr "" "此函式通常用於將\\ :term:`借用參照 `\\ 原地 (in-place) 轉" "換為\\ :term:`強參照 `。:c:func:`Py_NewRef` 函式可用於建立" "新的\\ :term:`強參照 `。" -#: ../../c-api/refcounting.rst:59 +#: ../../c-api/refcounting.rst:68 msgid "When done using the object, release is by calling :c:func:`Py_DECREF`." msgstr "使用完該物件後,透過呼叫 :c:func:`Py_DECREF` 來釋放它。" -#: ../../c-api/refcounting.rst:61 +#: ../../c-api/refcounting.rst:70 msgid "" "The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, " "use :c:func:`Py_XINCREF`." msgstr "" -"該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請使用 :c:func:" -"`Py_XINCREF`。" +"該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請使" +"用 :c:func:`Py_XINCREF`。" -#: ../../c-api/refcounting.rst:64 +#: ../../c-api/refcounting.rst:73 msgid "" -"Do not expect this function to actually modify *o* in any way. For at least :" -"pep:`some objects <0683>`, this function has no effect." +"Do not expect this function to actually modify *o* in any way. For at " +"least :pep:`some objects <0683>`, this function has no effect." msgstr "" "不要期望此函式會以任何方式實際修改 *o*,至少對於\\ :pep:`某些物件 <0683>`\\ " "來說,此函式沒有任何效果。" -#: ../../c-api/refcounting.rst:74 +#: ../../c-api/refcounting.rst:83 msgid "" "Similar to :c:func:`Py_INCREF`, but the object *o* can be ``NULL``, in which " "case this has no effect." @@ -127,39 +142,39 @@ msgstr "" "與 :c:func:`Py_INCREF` 類似,但物件 *o* 可以為 ``NULL``,在這種情況下這就不會" "有任何效果。" -#: ../../c-api/refcounting.rst:77 +#: ../../c-api/refcounting.rst:86 msgid "See also :c:func:`Py_XNewRef`." msgstr "另請見 :c:func:`Py_XNewRef`。" -#: ../../c-api/refcounting.rst:82 +#: ../../c-api/refcounting.rst:91 msgid "" "Create a new :term:`strong reference` to an object: call :c:func:`Py_INCREF` " "on *o* and return the object *o*." msgstr "" -"建立對物件的新\\ :term:`強參照 `:於 *o* 呼叫 :c:func:" -"`Py_INCREF` 並回傳物件 *o*。" +"建立對物件的新\\ :term:`強參照 `:於 *o* 呼" +"叫 :c:func:`Py_INCREF` 並回傳物件 *o*。" -#: ../../c-api/refcounting.rst:85 +#: ../../c-api/refcounting.rst:94 msgid "" "When the :term:`strong reference` is no longer needed, :c:func:`Py_DECREF` " "should be called on it to release the reference." msgstr "" -"當不再需要\\ :term:`強參照 `\\ 時,應對其呼叫 :c:func:" -"`Py_DECREF` 以釋放該參照。" +"當不再需要\\ :term:`強參照 `\\ 時,應對其呼" +"叫 :c:func:`Py_DECREF` 以釋放該參照。" -#: ../../c-api/refcounting.rst:88 +#: ../../c-api/refcounting.rst:97 msgid "" "The object *o* must not be ``NULL``; use :c:func:`Py_XNewRef` if *o* can be " "``NULL``." msgstr "" -"物件 *o* 不能為 ``NULL``;如果 *o* 可以為 ``NULL``,則使用 :c:func:" -"`Py_XNewRef`。" +"物件 *o* 不能為 ``NULL``;如果 *o* 可以為 ``NULL``,則使" +"用 :c:func:`Py_XNewRef`。" -#: ../../c-api/refcounting.rst:91 +#: ../../c-api/refcounting.rst:100 msgid "For example::" msgstr "舉例來說: ::" -#: ../../c-api/refcounting.rst:93 +#: ../../c-api/refcounting.rst:102 msgid "" "Py_INCREF(obj);\n" "self->attr = obj;" @@ -167,27 +182,27 @@ msgstr "" "Py_INCREF(obj);\n" "self->attr = obj;" -#: ../../c-api/refcounting.rst:96 +#: ../../c-api/refcounting.rst:105 msgid "can be written as::" msgstr "可以寫成: ::" -#: ../../c-api/refcounting.rst:98 +#: ../../c-api/refcounting.rst:107 msgid "self->attr = Py_NewRef(obj);" msgstr "self->attr = Py_NewRef(obj);" -#: ../../c-api/refcounting.rst:100 +#: ../../c-api/refcounting.rst:109 msgid "See also :c:func:`Py_INCREF`." msgstr "另請參閱 :c:func:`Py_INCREF`。" -#: ../../c-api/refcounting.rst:107 +#: ../../c-api/refcounting.rst:116 msgid "Similar to :c:func:`Py_NewRef`, but the object *o* can be NULL." msgstr "與 :c:func:`Py_NewRef` 類似,但物件 *o* 可以為 NULL。" -#: ../../c-api/refcounting.rst:109 +#: ../../c-api/refcounting.rst:118 msgid "If the object *o* is ``NULL``, the function just returns ``NULL``." msgstr "如果物件 *o* 為 ``NULL``,則該函式僅回傳 ``NULL``。" -#: ../../c-api/refcounting.rst:116 +#: ../../c-api/refcounting.rst:125 msgid "" "Release a :term:`strong reference` to object *o*, indicating the reference " "is no longer used." @@ -195,7 +210,7 @@ msgstr "" "釋放一個對物件 *o* 的\\ :term:`強參照 `,代表該參照不會再被" "使用。" -#: ../../c-api/refcounting.rst:121 +#: ../../c-api/refcounting.rst:130 msgid "" "Once the last :term:`strong reference` is released (i.e. the object's " "reference count reaches 0), the object's type's deallocation function (which " @@ -205,33 +220,33 @@ msgstr "" "到零),則觸發物件之型別的釋放函式 (deallocation function)(不得為 " "``NULL``\\ )。" -#: ../../c-api/refcounting.rst:126 +#: ../../c-api/refcounting.rst:135 msgid "" "This function is usually used to delete a :term:`strong reference` before " "exiting its scope." msgstr "" "此函式通常用於在退出作用域之前刪除\\ :term:`強參照 `。" -#: ../../c-api/refcounting.rst:129 +#: ../../c-api/refcounting.rst:138 msgid "" "The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, " "use :c:func:`Py_XDECREF`." msgstr "" -"該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請改用 :c:func:" -"`Py_XDECREF`。" +"該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請改" +"用 :c:func:`Py_XDECREF`。" -#: ../../c-api/refcounting.rst:132 +#: ../../c-api/refcounting.rst:141 msgid "" -"Do not expect this function to actually modify *o* in any way. For at least :" -"pep:`some objects <683>`, this function has no effect." +"Do not expect this function to actually modify *o* in any way. For at " +"least :pep:`some objects <683>`, this function has no effect." msgstr "" "不要期望此函式會以任何方式實際修改 *o*,至少對於\\ :pep:`某些物件 <683>`\\ 來" "說,此函式沒有任何效果。" -#: ../../c-api/refcounting.rst:138 +#: ../../c-api/refcounting.rst:147 msgid "" -"The deallocation function can cause arbitrary Python code to be invoked (e." -"g. when a class instance with a :meth:`~object.__del__` method is " +"The deallocation function can cause arbitrary Python code to be invoked " +"(e.g. when a class instance with a :meth:`~object.__del__` method is " "deallocated). While exceptions in such code are not propagated, the " "executed code has free access to all Python global variables. This means " "that any object that is reachable from a global variable should be in a " @@ -240,14 +255,14 @@ msgid "" "object in a temporary variable, update the list data structure, and then " "call :c:func:`Py_DECREF` for the temporary variable." msgstr "" -"釋放函式可以導致任意 Python 程式碼被叫用(例如,當釋放具有 :meth:`~object." -"__del__` 方法的類別實例時)。雖然此類程式碼中的例外不會被傳遞出來,但​​執行的程" -"式碼可以自由存取所有 Python 全域變數。這意味著在叫用 :c:func:`Py_DECREF` 之" -"前,可從全域變數存取的任何物件都應處於一致狀態。例如,從 list 中刪除物件的程" -"式碼應將已刪除物件的參照複製到臨時變數中,更新 list 資料結構,然後為臨時變數" -"呼叫 :c:func:`Py_DECREF`。" - -#: ../../c-api/refcounting.rst:153 +"釋放函式可以導致任意 Python 程式碼被叫用(例如,當釋放具" +"有 :meth:`~object.__del__` 方法的類別實例時)。雖然此類程式碼中的例外不會被傳" +"遞出來,但​​執行的程式碼可以自由存取所有 Python 全域變數。這意味著在叫" +"用 :c:func:`Py_DECREF` 之前,可從全域變數存取的任何物件都應處於一致狀態。例" +"如,從 list 中刪除物件的程式碼應將已刪除物件的參照複製到臨時變數中,更新 " +"list 資料結構,然後為臨時變數呼叫 :c:func:`Py_DECREF`。" + +#: ../../c-api/refcounting.rst:162 msgid "" "Similar to :c:func:`Py_DECREF`, but the object *o* can be ``NULL``, in which " "case this has no effect. The same warning from :c:func:`Py_DECREF` applies " @@ -256,7 +271,7 @@ msgstr "" "和 :c:func:`Py_DECREF` 類似,但該物件可以是 ``NULL``,在這種情況下巨集不起作" "用。在這裡也會出現與 :c:func:`Py_DECREF` 相同的警告。" -#: ../../c-api/refcounting.rst:160 +#: ../../c-api/refcounting.rst:169 msgid "" "Release a :term:`strong reference` for object *o*. The object may be " "``NULL``, in which case the macro has no effect; otherwise the effect is the " @@ -270,7 +285,7 @@ msgstr "" "非引數也設定為 ``NULL``。:c:func:`Py_DECREF` 的警告不適用於傳遞的物件,因為巨" "集在釋放其參照之前小心地使用臨時變數並將引數設定為 ``NULL``。" -#: ../../c-api/refcounting.rst:168 +#: ../../c-api/refcounting.rst:177 msgid "" "It is a good idea to use this macro whenever releasing a reference to an " "object that might be traversed during garbage collection." @@ -278,7 +293,7 @@ msgstr "" "每當要釋放垃圾回收 (garbage collection) 期間可能被遍歷到之對於物件的參照時," "使用此巨集是個好主意。" -#: ../../c-api/refcounting.rst:171 +#: ../../c-api/refcounting.rst:180 msgid "" "The macro argument is now only evaluated once. If the argument has side " "effects, these are no longer duplicated." @@ -286,24 +301,26 @@ msgstr "" "巨集引數現在僅會被求值 (evaluate) 一次。如果引數有其他副作用,則不再重複作" "用。" -#: ../../c-api/refcounting.rst:178 +#: ../../c-api/refcounting.rst:187 msgid "" "Indicate taking a new :term:`strong reference` to object *o*. A function " "version of :c:func:`Py_XINCREF`. It can be used for runtime dynamic " "embedding of Python." msgstr "" -"代表取得對於物件 *o* 的\\ :term:`強參照 `。:c:func:" -"`Py_XINCREF` 的函式版本。它可用於 Python 的 runtime 動態嵌入。" +"代表取得對於物件 *o* 的\\ :term:`強參照 `。:c:func:`Py_XINCREF` 的函式版本。它可用於 Python 的 runtime 動態" +"嵌入。" -#: ../../c-api/refcounting.rst:185 +#: ../../c-api/refcounting.rst:194 msgid "" -"Release a :term:`strong reference` to object *o*. A function version of :c:" -"func:`Py_XDECREF`. It can be used for runtime dynamic embedding of Python." +"Release a :term:`strong reference` to object *o*. A function version " +"of :c:func:`Py_XDECREF`. It can be used for runtime dynamic embedding of " +"Python." msgstr "" "釋放對物件 *o* 的\\ :term:`強參照 `。:c:func:`Py_XDECREF` " "的函式版本。它可用於 Python 的 runtime 動態嵌入。" -#: ../../c-api/refcounting.rst:192 +#: ../../c-api/refcounting.rst:201 msgid "" "Macro safely releasing a :term:`strong reference` to object *dst* and " "setting *dst* to *src*." @@ -311,11 +328,11 @@ msgstr "" "巨集安全地釋放對於物件 *dst* 的\\ :term:`強參照 `\\ 並將 " "*dst* 設定為 *src*。" -#: ../../c-api/refcounting.rst:195 +#: ../../c-api/refcounting.rst:204 msgid "As in case of :c:func:`Py_CLEAR`, \"the obvious\" code can be deadly::" msgstr "與 :c:func:`Py_CLEAR` 的情況一樣,「明顯的」程式碼可能是致命的: ::" -#: ../../c-api/refcounting.rst:197 +#: ../../c-api/refcounting.rst:206 msgid "" "Py_DECREF(dst);\n" "dst = src;" @@ -323,15 +340,15 @@ msgstr "" "Py_DECREF(dst);\n" "dst = src;" -#: ../../c-api/refcounting.rst:200 +#: ../../c-api/refcounting.rst:209 msgid "The safe way is::" msgstr "安全的方法是: ::" -#: ../../c-api/refcounting.rst:202 +#: ../../c-api/refcounting.rst:211 msgid "Py_SETREF(dst, src);" msgstr "Py_SETREF(dst, src);" -#: ../../c-api/refcounting.rst:204 +#: ../../c-api/refcounting.rst:213 msgid "" "That arranges to set *dst* to *src* *before* releasing the reference to the " "old value of *dst*, so that any code triggered as a side-effect of *dst* " @@ -341,16 +358,16 @@ msgstr "" "被拆除而觸發的任何副作用 (side-effect) 之程式碼不會相信 *dst* 是指向一個有效" "物件。" -#: ../../c-api/refcounting.rst:211 ../../c-api/refcounting.rst:223 +#: ../../c-api/refcounting.rst:220 ../../c-api/refcounting.rst:232 msgid "" "The macro arguments are now only evaluated once. If an argument has side " "effects, these are no longer duplicated." msgstr "巨集引數現在僅會被求值一次。如果引數有其他副作用,則不再重複作用。" -#: ../../c-api/refcounting.rst:218 +#: ../../c-api/refcounting.rst:227 msgid "" "Variant of :c:macro:`Py_SETREF` macro that uses :c:func:`Py_XDECREF` instead " "of :c:func:`Py_DECREF`." msgstr "" -":c:macro:`Py_SETREF` 巨集的變體,請改用 :c:func:`Py_XDECREF` 而非 :c:func:" -"`Py_DECREF`。" +":c:macro:`Py_SETREF` 巨集的變體,請改用 :c:func:`Py_XDECREF` 而" +"非 :c:func:`Py_DECREF`。" diff --git a/c-api/reflection.po b/c-api/reflection.po index 6854e16e934..458793da311 100644 --- a/c-api/reflection.po +++ b/c-api/reflection.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,9 +35,10 @@ msgstr "" #: ../../c-api/reflection.rst:22 msgid "" "Use either :c:func:`PyEval_GetFrameLocals` to obtain the same behaviour as " -"calling :func:`locals` in Python code, or else call :c:func:" -"`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame` to access " -"the :attr:`~frame.f_locals` attribute of the currently executing frame." +"calling :func:`locals` in Python code, or else " +"call :c:func:`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame` " +"to access the :attr:`~frame.f_locals` attribute of the currently executing " +"frame." msgstr "" #: ../../c-api/reflection.rst:27 @@ -56,19 +57,19 @@ msgstr "" msgid "" "As this function returns a :term:`borrowed reference`, the dictionary " "returned for :term:`optimized scopes ` is cached on the " -"frame object and will remain alive as long as the frame object does. Unlike :" -"c:func:`PyEval_GetFrameLocals` and :func:`locals`, subsequent calls to this " -"function in the same frame will update the contents of the cached dictionary " -"to reflect changes in the state of the local variables rather than returning " -"a new snapshot." +"frame object and will remain alive as long as the frame object does. " +"Unlike :c:func:`PyEval_GetFrameLocals` and :func:`locals`, subsequent calls " +"to this function in the same frame will update the contents of the cached " +"dictionary to reflect changes in the state of the local variables rather " +"than returning a new snapshot." msgstr "" #: ../../c-api/reflection.rst:39 msgid "" -"As part of :pep:`667`, :c:func:`PyFrame_GetLocals`, :func:`locals`, and :" -"attr:`FrameType.f_locals ` no longer make use of the shared " -"cache dictionary. Refer to the :ref:`What's New entry ` for additional details." +"As part of :pep:`667`, :c:func:`PyFrame_GetLocals`, :func:`locals`, " +"and :attr:`FrameType.f_locals ` no longer make use of the " +"shared cache dictionary. Refer to the :ref:`What's New entry ` for additional details." msgstr "" #: ../../c-api/reflection.rst:50 @@ -83,8 +84,8 @@ msgstr "" #: ../../c-api/reflection.rst:58 msgid "" -"Return the current thread state's frame, which is ``NULL`` if no frame is " -"currently executing." +"Return the :term:`attached thread state`'s frame, which is ``NULL`` if no " +"frame is currently executing." msgstr "" #: ../../c-api/reflection.rst:61 @@ -94,22 +95,22 @@ msgstr "另請見 :c:func:`PyThreadState_GetFrame`。" #: ../../c-api/reflection.rst:74 msgid "" "Return a dictionary of the local variables in the current execution frame, " -"or ``NULL`` if no frame is currently executing. Equivalent to calling :func:" -"`locals` in Python code." +"or ``NULL`` if no frame is currently executing. Equivalent to " +"calling :func:`locals` in Python code." msgstr "" #: ../../c-api/reflection.rst:78 msgid "" "To access :attr:`~frame.f_locals` on the current frame without making an " -"independent snapshot in :term:`optimized scopes `, call :c:" -"func:`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame`." +"independent snapshot in :term:`optimized scopes `, " +"call :c:func:`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame`." msgstr "" #: ../../c-api/reflection.rst:87 msgid "" "Return a dictionary of the global variables in the current execution frame, " -"or ``NULL`` if no frame is currently executing. Equivalent to calling :func:" -"`globals` in Python code." +"or ``NULL`` if no frame is currently executing. Equivalent to " +"calling :func:`globals` in Python code." msgstr "" #: ../../c-api/reflection.rst:96 @@ -122,8 +123,8 @@ msgstr "" msgid "" "Return a description string, depending on the type of *func*. Return values " "include \"()\" for functions and methods, \" constructor\", \" instance\", " -"and \" object\". Concatenated with the result of :c:func:" -"`PyEval_GetFuncName`, the result will be a description of *func*." +"and \" object\". Concatenated with the result " +"of :c:func:`PyEval_GetFuncName`, the result will be a description of *func*." msgstr "" #~ msgid "*frame* must not be ``NULL``." diff --git a/c-api/sequence.po b/c-api/sequence.po index 88d5a0d4fa4..36140ff4d95 100644 --- a/c-api/sequence.po +++ b/c-api/sequence.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-24 00:03+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,10 +25,10 @@ msgstr "序列協定" #: ../../c-api/sequence.rst:11 msgid "" "Return ``1`` if the object provides the sequence protocol, and ``0`` " -"otherwise. Note that it returns ``1`` for Python classes with a :meth:" -"`~object.__getitem__` method, unless they are :class:`dict` subclasses, " -"since in general it is impossible to determine what type of keys the class " -"supports. This function always succeeds." +"otherwise. Note that it returns ``1`` for Python classes with " +"a :meth:`~object.__getitem__` method, unless they are :class:`dict` " +"subclasses, since in general it is impossible to determine what type of keys " +"the class supports. This function always succeeds." msgstr "" #: ../../c-api/sequence.rst:23 @@ -123,19 +123,29 @@ msgid "" msgstr "" #: ../../c-api/sequence.rst:110 +msgid "Alias for :c:func:`PySequence_Contains`." +msgstr "" + +#: ../../c-api/sequence.rst:112 +msgid "" +"The function is :term:`soft deprecated` and should no longer be used to " +"write new code." +msgstr "" + +#: ../../c-api/sequence.rst:119 msgid "" "Return the first index *i* for which ``o[i] == value``. On error, return " "``-1``. This is equivalent to the Python expression ``o.index(value)``." msgstr "" -#: ../../c-api/sequence.rst:116 +#: ../../c-api/sequence.rst:125 msgid "" "Return a list object with the same contents as the sequence or iterable *o*, " "or ``NULL`` on failure. The returned list is guaranteed to be new. This is " "equivalent to the Python expression ``list(o)``." msgstr "" -#: ../../c-api/sequence.rst:125 +#: ../../c-api/sequence.rst:134 msgid "" "Return a tuple object with the same contents as the sequence or iterable " "*o*, or ``NULL`` on failure. If *o* is a tuple, a new reference will be " @@ -143,7 +153,7 @@ msgid "" "contents. This is equivalent to the Python expression ``tuple(o)``." msgstr "" -#: ../../c-api/sequence.rst:133 +#: ../../c-api/sequence.rst:142 msgid "" "Return the sequence or iterable *o* as an object usable by the other " "``PySequence_Fast*`` family of functions. If the object is not a sequence or " @@ -151,56 +161,57 @@ msgid "" "``NULL`` on failure." msgstr "" -#: ../../c-api/sequence.rst:138 +#: ../../c-api/sequence.rst:147 msgid "" "The ``PySequence_Fast*`` functions are thus named because they assume *o* is " "a :c:type:`PyTupleObject` or a :c:type:`PyListObject` and access the data " "fields of *o* directly." msgstr "" -#: ../../c-api/sequence.rst:142 +#: ../../c-api/sequence.rst:151 msgid "" "As a CPython implementation detail, if *o* is already a sequence or list, it " "will be returned." msgstr "" -#: ../../c-api/sequence.rst:148 +#: ../../c-api/sequence.rst:157 msgid "" -"Returns the length of *o*, assuming that *o* was returned by :c:func:" -"`PySequence_Fast` and that *o* is not ``NULL``. The size can also be " -"retrieved by calling :c:func:`PySequence_Size` on *o*, but :c:func:" -"`PySequence_Fast_GET_SIZE` is faster because it can assume *o* is a list or " -"tuple." +"Returns the length of *o*, assuming that *o* was returned " +"by :c:func:`PySequence_Fast` and that *o* is not ``NULL``. The size can " +"also be retrieved by calling :c:func:`PySequence_Size` on *o*, " +"but :c:func:`PySequence_Fast_GET_SIZE` is faster because it can assume *o* " +"is a list or tuple." msgstr "" -#: ../../c-api/sequence.rst:157 +#: ../../c-api/sequence.rst:166 msgid "" -"Return the *i*\\ th element of *o*, assuming that *o* was returned by :c:" -"func:`PySequence_Fast`, *o* is not ``NULL``, and that *i* is within bounds." +"Return the *i*\\ th element of *o*, assuming that *o* was returned " +"by :c:func:`PySequence_Fast`, *o* is not ``NULL``, and that *i* is within " +"bounds." msgstr "" -#: ../../c-api/sequence.rst:163 +#: ../../c-api/sequence.rst:172 msgid "" "Return the underlying array of PyObject pointers. Assumes that *o* was " "returned by :c:func:`PySequence_Fast` and *o* is not ``NULL``." msgstr "" -#: ../../c-api/sequence.rst:166 +#: ../../c-api/sequence.rst:175 msgid "" "Note, if a list gets resized, the reallocation may relocate the items array. " "So, only use the underlying array pointer in contexts where the sequence " "cannot change." msgstr "" -#: ../../c-api/sequence.rst:173 +#: ../../c-api/sequence.rst:182 msgid "" -"Return the *i*\\ th element of *o* or ``NULL`` on failure. Faster form of :c:" -"func:`PySequence_GetItem` but without checking that :c:func:" -"`PySequence_Check` on *o* is true and without adjustment for negative " -"indices." +"Return the *i*\\ th element of *o* or ``NULL`` on failure. Faster form " +"of :c:func:`PySequence_GetItem` but without checking " +"that :c:func:`PySequence_Check` on *o* is true and without adjustment for " +"negative indices." msgstr "" -#: ../../c-api/sequence.rst:21 ../../c-api/sequence.rst:123 +#: ../../c-api/sequence.rst:21 ../../c-api/sequence.rst:132 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -208,6 +219,6 @@ msgstr "built-in function(內建函式)" msgid "len" msgstr "len" -#: ../../c-api/sequence.rst:123 +#: ../../c-api/sequence.rst:132 msgid "tuple" msgstr "tuple(元組)" diff --git a/c-api/stable.po b/c-api/stable.po index 54ff032f045..58abc22d741 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-04 00:14+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-01-24 21:07+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -113,11 +113,11 @@ msgstr "" "使用此 API 的專案應該要遵循 CPython 開發細節,並花費額外的力氣來針對這些變動" "來做調整。" -#: ../../c-api/stable.rst:56 +#: ../../c-api/stable.rst:57 msgid "Stable Application Binary Interface" msgstr "穩定的應用程式二進位介面" -#: ../../c-api/stable.rst:58 +#: ../../c-api/stable.rst:59 msgid "" "For simplicity, this document talks about *extensions*, but the Limited API " "and Stable ABI work the same way for all uses of the API – for example, " @@ -127,11 +127,11 @@ msgstr "" "API 使用方式中都以相同的方式運作 -- 例如在嵌入式 Python (embedding Python) " "中。" -#: ../../c-api/stable.rst:65 +#: ../../c-api/stable.rst:66 msgid "Limited C API" msgstr "受限 C API" -#: ../../c-api/stable.rst:67 +#: ../../c-api/stable.rst:68 msgid "" "Python 3.2 introduced the *Limited API*, a subset of Python's C API. " "Extensions that only use the Limited API can be compiled once and be loaded " @@ -142,14 +142,14 @@ msgstr "" "僅使用受限 API 的擴充可以只編譯一次就被載入於多個版本的 Python。受限 API 的內" "容\\ :ref:`列在下方 `。" -#: ../../c-api/stable.rst:74 +#: ../../c-api/stable.rst:75 msgid "" "Define this macro before including ``Python.h`` to opt in to only use the " "Limited API, and to select the Limited API version." msgstr "" "在包含 ``Python.h`` 之前定義此巨集以選擇只使用受限 API,並挑選受限 API 版本。" -#: ../../c-api/stable.rst:77 +#: ../../c-api/stable.rst:78 msgid "" "Define ``Py_LIMITED_API`` to the value of :c:macro:`PY_VERSION_HEX` " "corresponding to the lowest Python version your extension supports. The " @@ -160,7 +160,7 @@ msgstr "" "的 :c:macro:`PY_VERSION_HEX` 值。該擴充與從指定版本開始的所有 Python 3 版本" "之 ABI 相容,並且可以使用過去版本有引入的受限 API。" -#: ../../c-api/stable.rst:83 +#: ../../c-api/stable.rst:84 msgid "" "Rather than using the ``PY_VERSION_HEX`` macro directly, hardcode a minimum " "minor version (e.g. ``0x030A0000`` for Python 3.10) for stability when " @@ -170,7 +170,7 @@ msgstr "" "代表 Python 3.10 的 ``0x030A0000``\\ ),以便在使用未來的 Python 版本進行編譯" "時仍保持穩定性。" -#: ../../c-api/stable.rst:87 +#: ../../c-api/stable.rst:88 msgid "" "You can also define ``Py_LIMITED_API`` to ``3``. This works the same as " "``0x03020000`` (Python 3.2, the version that introduced Limited API)." @@ -178,11 +178,11 @@ msgstr "" "你還可以將 ``Py_LIMITED_API`` 定義為 ``3``,這與 ``0x03020000``\\ (Python " "3.2,引入了受限 API 的版本)相同。" -#: ../../c-api/stable.rst:94 +#: ../../c-api/stable.rst:95 msgid "Stable ABI" msgstr "穩定 ABI" -#: ../../c-api/stable.rst:96 +#: ../../c-api/stable.rst:97 msgid "" "To enable this, Python provides a *Stable ABI*: a set of symbols that will " "remain ABI-compatible across Python 3.x versions." @@ -190,7 +190,7 @@ msgstr "" "為了實現它,Python 提供了一個\\ *穩定 ABI (Stable ABI)*:一組將在各個 Python " "3.x 版本之間保持 ABI 相容的符號。" -#: ../../c-api/stable.rst:101 +#: ../../c-api/stable.rst:102 msgid "" "The Stable ABI prevents ABI issues, like linker errors due to missing " "symbols or data corruption due to changes in structure layouts or function " @@ -198,10 +198,11 @@ msgid "" "extensions. See Python's Backwards Compatibility Policy (:pep:`387`) for " "details." msgstr "" -"穩定 ABI 可以防止 ABI 問題,例如由於結構布局或函式簽名變化導致缺少符號或數據損壞的鏈接器 (linker) 錯誤。" -"然而,Python 的其他變化可能會改變 *行為* 的擴充。有關詳細信息,請參閱 Python 的向後相容性政策 (:pep:`387`)。" +"穩定 ABI 可以防止 ABI 問題,例如由於結構布局或函式簽名變化導致缺少符號或數據" +"損壞的鏈接器 (linker) 錯誤。然而,Python 的其他變化可能會改變 *行為* 的擴充。" +"有關詳細信息,請參閱 Python 的向後相容性政策 (:pep:`387`)。" -#: ../../c-api/stable.rst:107 +#: ../../c-api/stable.rst:108 msgid "" "The Stable ABI contains symbols exposed in the :ref:`Limited API `, but also other ones – for example, functions necessary to support " @@ -210,7 +211,7 @@ msgstr "" "穩定 ABI 被包含在\\ :ref:`受限 API ` 中開放的符號,但也包含其" "他符號 - 例如,支援舊版受限 API 所必需的函式。" -#: ../../c-api/stable.rst:111 +#: ../../c-api/stable.rst:112 msgid "" "On Windows, extensions that use the Stable ABI should be linked against " "``python3.dll`` rather than a version-specific library such as " @@ -219,7 +220,7 @@ msgstr "" "在 Windows 上,使用穩定 ABI 的擴充應該連接到 ``python3.dll`` 而不是特定版本的" "函式庫,例如 ``python39.dll``。" -#: ../../c-api/stable.rst:115 +#: ../../c-api/stable.rst:116 msgid "" "On some platforms, Python will look for and load shared library files named " "with the ``abi3`` tag (e.g. ``mymodule.abi3.so``). It does not check if such " @@ -232,7 +233,7 @@ msgstr "" "用者(或者打包工具)身上,例如使用 3.10+ 受限 API 建置的擴充不會為較低版本的 " "Python 所安裝。" -#: ../../c-api/stable.rst:122 +#: ../../c-api/stable.rst:123 msgid "" "All functions in the Stable ABI are present as functions in Python's shared " "library, not solely as macros. This makes them usable from languages that " @@ -241,18 +242,18 @@ msgstr "" "穩定 ABI 中的所有函式都作為函式存在於 Python 的共享函式庫中,而不僅是作為巨" "集。這使得它們可被用於不使用 C 預處理器 (preprocessor) 的語言。" -#: ../../c-api/stable.rst:128 +#: ../../c-api/stable.rst:129 msgid "Limited API Scope and Performance" msgstr "受限 API 範圍和性能" -#: ../../c-api/stable.rst:130 +#: ../../c-api/stable.rst:131 msgid "" "The goal for the Limited API is to allow everything that is possible with " "the full C API, but possibly with a performance penalty." msgstr "" "受限 API 的目標是允許使用完整的 C API 進行所有可能的操作,但可能會降低性能。" -#: ../../c-api/stable.rst:133 +#: ../../c-api/stable.rst:134 msgid "" "For example, while :c:func:`PyList_GetItem` is available, its “unsafe” macro " "variant :c:func:`PyList_GET_ITEM` is not. The macro can be faster because it " @@ -262,7 +263,7 @@ msgstr "" "體 :c:func:`PyList_GET_ITEM` 為不可用。巨集運行可以更快,因為它可以依賴 list " "物件的特定版本實作細節。" -#: ../../c-api/stable.rst:138 +#: ../../c-api/stable.rst:139 msgid "" "Without ``Py_LIMITED_API`` defined, some C API functions are inlined or " "replaced by macros. Defining ``Py_LIMITED_API`` disables this inlining, " @@ -273,7 +274,7 @@ msgstr "" "``Py_LIMITED_API`` 會禁用嵌入,從而隨著 Python 資料結構的改進而提高穩定性,但" "可能會降低性能。" -#: ../../c-api/stable.rst:143 +#: ../../c-api/stable.rst:144 msgid "" "By leaving out the ``Py_LIMITED_API`` definition, it is possible to compile " "a Limited API extension with a version-specific ABI. This can improve " @@ -287,11 +288,11 @@ msgstr "" "將產生一個擴充,可以在特定版本的擴充不可用的地方發布 — 例如,用於即將發布的 " "Python 版本的預發布版本 (prerelease)。" -#: ../../c-api/stable.rst:152 +#: ../../c-api/stable.rst:153 msgid "Limited API Caveats" msgstr "受限 API 注意事項" -#: ../../c-api/stable.rst:154 +#: ../../c-api/stable.rst:155 msgid "" "Note that compiling with ``Py_LIMITED_API`` is *not* a complete guarantee " "that code conforms to the :ref:`Limited API ` or " @@ -304,7 +305,7 @@ msgstr "" "``Py_LIMITED_API`` 僅涵蓋定義,但 API 還包括其他議題,例如預期的語義 " "(semantic)。" -#: ../../c-api/stable.rst:159 +#: ../../c-api/stable.rst:160 msgid "" "One issue that ``Py_LIMITED_API`` does not guard against is calling a " "function with arguments that are invalid in a lower Python version. For " @@ -318,7 +319,7 @@ msgstr "" "現在代表選擇預設行為,但在 Python 3.8 中,引數將被直接使用,導致 ``NULL`` 取" "消參照 (dereference) 且崩潰 (crash)。類似的引數適用於結構 (struct) 的欄位。" -#: ../../c-api/stable.rst:166 +#: ../../c-api/stable.rst:167 msgid "" "Another issue is that some struct fields are currently not hidden when " "``Py_LIMITED_API`` is defined, even though they're part of the Limited API." @@ -326,7 +327,7 @@ msgstr "" "另一個問題是,當有定義 ``Py_LIMITED_API`` 時,一些結構欄位目前不會被隱藏,即" "使它們是受限 API 的一部分。" -#: ../../c-api/stable.rst:169 +#: ../../c-api/stable.rst:170 msgid "" "For these reasons, we recommend testing an extension with *all* minor Python " "versions it supports, and preferably to build with the *lowest* such version." @@ -334,7 +335,7 @@ msgstr "" "出於這些原因,我們建議要以它支援的\\ *所有*\\ 次要 Python 版本來測試擴充,並" "且最好使用\\ *最低*\\ 版本進行建置。" -#: ../../c-api/stable.rst:172 +#: ../../c-api/stable.rst:173 msgid "" "We also recommend reviewing documentation of all used API to check if it is " "explicitly part of the Limited API. Even with ``Py_LIMITED_API`` defined, a " @@ -345,7 +346,7 @@ msgstr "" "義 ``Py_LIMITED_API``,一些私有聲明也會因為技術原因(或者甚至是無意地,例如臭" "蟲)而被公開出來。" -#: ../../c-api/stable.rst:177 +#: ../../c-api/stable.rst:178 msgid "" "Also note that the Limited API is not necessarily stable: compiling with " "``Py_LIMITED_API`` with Python 3.8 means that the extension will run with " @@ -357,11 +358,11 @@ msgstr "" "行編譯意味著擴充將能以 Python 3.12 運行,但不一定能以 Python 3.12 *編譯*。特" "別是如果穩定 ABI 保持穩定,部分受限 API 可能會被棄用和刪除。" -#: ../../c-api/stable.rst:187 +#: ../../c-api/stable.rst:188 msgid "Platform Considerations" msgstr "平台注意事項" -#: ../../c-api/stable.rst:189 +#: ../../c-api/stable.rst:190 msgid "" "ABI stability depends not only on Python, but also on the compiler used, " "lower-level libraries and compiler options. For the purposes of " @@ -372,7 +373,7 @@ msgstr "" "於\\ :ref:`穩定 ABI ` 的目的,這些細節定義了一個「平台」。它們通" "常取決於作業系統種類和處理器架構" -#: ../../c-api/stable.rst:194 +#: ../../c-api/stable.rst:195 msgid "" "It is the responsibility of each particular distributor of Python to ensure " "that all Python versions on a particular platform are built in a way that " @@ -383,11 +384,11 @@ msgstr "" "定 ABI 的方式建置。``python.org`` 和許多第三方發布者發布的 Windows 和 macOS " "版本就是這種情況。" -#: ../../c-api/stable.rst:204 +#: ../../c-api/stable.rst:205 msgid "Contents of Limited API" msgstr "受限 API 的內容" -#: ../../c-api/stable.rst:207 +#: ../../c-api/stable.rst:208 msgid "" "Currently, the :ref:`Limited API ` includes the following " "items:" diff --git a/c-api/structures.po b/c-api/structures.po index eacbf76707f..5c7f00a97f3 100644 --- a/c-api/structures.po +++ b/c-api/structures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-11 00:14+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,129 +51,197 @@ msgid "" "In a normal \"release\" build, it contains only the object's reference count " "and a pointer to the corresponding type object. Nothing is actually declared " "to be a :c:type:`PyObject`, but every pointer to a Python object can be cast " -"to a :c:expr:`PyObject*`. Access to the members must be done by using the " -"macros :c:macro:`Py_REFCNT` and :c:macro:`Py_TYPE`." +"to a :c:expr:`PyObject*`." +msgstr "" + +#: ../../c-api/structures.rst:33 +msgid "" +"The members must not be accessed directly; instead use macros such " +"as :c:macro:`Py_REFCNT` and :c:macro:`Py_TYPE`." msgstr "" #: ../../c-api/structures.rst:38 msgid "" -"This is an extension of :c:type:`PyObject` that adds " -"the :c:member:`~PyVarObject.ob_size` field. This is only used for objects " -"that have some notion of *length*. This type does not often appear in the " -"Python/C API. Access to the members must be done by using the " -"macros :c:macro:`Py_REFCNT`, :c:macro:`Py_TYPE`, and :c:macro:`Py_SIZE`." +"The object's reference count, as returned by :c:macro:`Py_REFCNT`. Do not " +"use this field directly; instead use functions and macros such as :c:macro:`!" +"Py_REFCNT`, :c:func:`Py_INCREF` and :c:func:`Py_DecRef`." +msgstr "" + +#: ../../c-api/structures.rst:42 +msgid "" +"The field type may be different from ``Py_ssize_t``, depending on build " +"configuration and platform." msgstr "" #: ../../c-api/structures.rst:47 msgid "" +"The object's type. Do not use this field directly; use :c:macro:`Py_TYPE` " +"and :c:func:`Py_SET_TYPE` instead." +msgstr "" + +#: ../../c-api/structures.rst:54 +msgid "" +"An extension of :c:type:`PyObject` that adds " +"the :c:member:`~PyVarObject.ob_size` field. This is intended for objects " +"that have some notion of *length*." +msgstr "" + +#: ../../c-api/structures.rst:58 +msgid "" +"As with :c:type:`!PyObject`, the members must not be accessed directly; " +"instead use macros such as :c:macro:`Py_SIZE`, :c:macro:`Py_REFCNT` " +"and :c:macro:`Py_TYPE`." +msgstr "" + +#: ../../c-api/structures.rst:64 +msgid "" +"A size field, whose contents should be considered an object's internal " +"implementation detail." +msgstr "" + +#: ../../c-api/structures.rst:67 +msgid "Do not use this field directly; use :c:macro:`Py_SIZE` instead." +msgstr "" + +#: ../../c-api/structures.rst:69 +msgid "" +"Object creation functions such as :c:func:`PyObject_NewVar` will generally " +"set this field to the requested size (number of items). After creation, " +"arbitrary values can be stored in :c:member:`!ob_size` " +"using :c:macro:`Py_SET_SIZE`." +msgstr "" + +#: ../../c-api/structures.rst:74 +msgid "" +"To get an object's publicly exposed length, as returned by the Python " +"function :py:func:`len`, use :c:func:`PyObject_Length` instead." +msgstr "" + +#: ../../c-api/structures.rst:81 +msgid "" "This is a macro used when declaring new types which represent objects " "without a varying length. The PyObject_HEAD macro expands to::" msgstr "" -#: ../../c-api/structures.rst:50 +#: ../../c-api/structures.rst:84 msgid "PyObject ob_base;" msgstr "PyObject ob_base;" -#: ../../c-api/structures.rst:52 +#: ../../c-api/structures.rst:86 msgid "See documentation of :c:type:`PyObject` above." msgstr "" -#: ../../c-api/structures.rst:57 +#: ../../c-api/structures.rst:91 msgid "" "This is a macro used when declaring new types which represent objects with a " "length that varies from instance to instance. The PyObject_VAR_HEAD macro " "expands to::" msgstr "" -#: ../../c-api/structures.rst:61 +#: ../../c-api/structures.rst:95 msgid "PyVarObject ob_base;" msgstr "PyVarObject ob_base;" -#: ../../c-api/structures.rst:63 +#: ../../c-api/structures.rst:97 msgid "See documentation of :c:type:`PyVarObject` above." msgstr "請見上面 :c:type:`PyVarObject` 的文件。" -#: ../../c-api/structures.rst:68 +#: ../../c-api/structures.rst:102 msgid "" "The base class of all other objects, the same as :class:`object` in Python." msgstr "" -#: ../../c-api/structures.rst:73 +#: ../../c-api/structures.rst:107 msgid "" "Test if the *x* object is the *y* object, the same as ``x is y`` in Python." msgstr "" -#: ../../c-api/structures.rst:80 +#: ../../c-api/structures.rst:114 msgid "" "Test if an object is the ``None`` singleton, the same as ``x is None`` in " "Python." msgstr "" -#: ../../c-api/structures.rst:88 +#: ../../c-api/structures.rst:122 msgid "" "Test if an object is the ``True`` singleton, the same as ``x is True`` in " "Python." msgstr "" -#: ../../c-api/structures.rst:96 +#: ../../c-api/structures.rst:130 msgid "" "Test if an object is the ``False`` singleton, the same as ``x is False`` in " "Python." msgstr "" -#: ../../c-api/structures.rst:104 +#: ../../c-api/structures.rst:138 msgid "Get the type of the Python object *o*." msgstr "" -#: ../../c-api/structures.rst:106 -msgid "Return a :term:`borrowed reference`." -msgstr "" - -#: ../../c-api/structures.rst:108 -msgid "Use the :c:func:`Py_SET_TYPE` function to set an object type." +#: ../../c-api/structures.rst:140 +msgid "" +"The returned reference is :term:`borrowed ` from *o*. Do " +"not release it with :c:func:`Py_DECREF` or similar." msgstr "" -#: ../../c-api/structures.rst:110 +#: ../../c-api/structures.rst:143 msgid "" ":c:func:`Py_TYPE()` is changed to an inline static function. The parameter " "type is no longer :c:expr:`const PyObject*`." msgstr "" -#: ../../c-api/structures.rst:117 +#: ../../c-api/structures.rst:150 msgid "" "Return non-zero if the object *o* type is *type*. Return zero otherwise. " "Equivalent to: ``Py_TYPE(o) == type``." msgstr "" -#: ../../c-api/structures.rst:125 -msgid "Set the object *o* type to *type*." -msgstr "將物件 *o* 的型別設為 *type*。" +#: ../../c-api/structures.rst:158 +msgid "" +"Set the type of object *o* to *type*, without any checking or reference " +"counting." +msgstr "" -#: ../../c-api/structures.rst:132 -msgid "Get the size of the Python object *o*." -msgstr "取得 Python 物件 *o* 的大小。" +#: ../../c-api/structures.rst:161 +msgid "" +"This is a very low-level operation. Consider instead setting the Python " +"attribute :attr:`~object.__class__` using :c:func:`PyObject_SetAttrString` " +"or similar." +msgstr "" -#: ../../c-api/structures.rst:134 -msgid "Use the :c:func:`Py_SET_SIZE` function to set an object size." +#: ../../c-api/structures.rst:165 +msgid "" +"Note that assigning an incompatible type can lead to undefined behavior." msgstr "" -#: ../../c-api/structures.rst:136 +#: ../../c-api/structures.rst:167 +msgid "" +"If *type* is a :ref:`heap type `, the caller must create a new " +"reference to it. Similarly, if the old type of *o* is a heap type, the " +"caller must release a reference to that type." +msgstr "" + +#: ../../c-api/structures.rst:177 +msgid "Get the :c:member:`~PyVarObject.ob_size` field of *o*." +msgstr "" + +#: ../../c-api/structures.rst:179 msgid "" ":c:func:`Py_SIZE()` is changed to an inline static function. The parameter " "type is no longer :c:expr:`const PyVarObject*`." msgstr "" -#: ../../c-api/structures.rst:143 -msgid "Set the object *o* size to *size*." -msgstr "將物件 *o* 的大小設為 *size*。" +#: ../../c-api/structures.rst:186 +msgid "Set the :c:member:`~PyVarObject.ob_size` field of *o* to *size*." +msgstr "" -#: ../../c-api/structures.rst:150 +#: ../../c-api/structures.rst:193 msgid "" "This is a macro which expands to initialization values for a " "new :c:type:`PyObject` type. This macro expands to::" msgstr "" -#: ../../c-api/structures.rst:153 +#: ../../c-api/structures.rst:196 msgid "" "_PyObject_EXTRA_INIT\n" "1, type," @@ -181,14 +249,14 @@ msgstr "" "_PyObject_EXTRA_INIT\n" "1, type," -#: ../../c-api/structures.rst:159 +#: ../../c-api/structures.rst:202 msgid "" "This is a macro which expands to initialization values for a " "new :c:type:`PyVarObject` type, including " "the :c:member:`~PyVarObject.ob_size` field. This macro expands to::" msgstr "" -#: ../../c-api/structures.rst:163 +#: ../../c-api/structures.rst:206 msgid "" "_PyObject_EXTRA_INIT\n" "1, type, size," @@ -196,11 +264,11 @@ msgstr "" "_PyObject_EXTRA_INIT\n" "1, type, size," -#: ../../c-api/structures.rst:168 +#: ../../c-api/structures.rst:211 msgid "Implementing functions and methods" msgstr "實作函式與方法" -#: ../../c-api/structures.rst:172 +#: ../../c-api/structures.rst:215 msgid "" "Type of the functions used to implement most Python callables in C. " "Functions of this type take two :c:expr:`PyObject*` parameters and return " @@ -210,11 +278,11 @@ msgid "" "reference." msgstr "" -#: ../../c-api/structures.rst:179 +#: ../../c-api/structures.rst:222 msgid "The function signature is::" msgstr "" -#: ../../c-api/structures.rst:181 +#: ../../c-api/structures.rst:224 msgid "" "PyObject *PyCFunction(PyObject *self,\n" " PyObject *args);" @@ -222,14 +290,14 @@ msgstr "" "PyObject *PyCFunction(PyObject *self,\n" " PyObject *args);" -#: ../../c-api/structures.rst:186 +#: ../../c-api/structures.rst:229 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_VARARGS | METH_KEYWORDS `. " "The function signature is::" msgstr "" -#: ../../c-api/structures.rst:190 +#: ../../c-api/structures.rst:233 msgid "" "PyObject *PyCFunctionWithKeywords(PyObject *self,\n" " PyObject *args,\n" @@ -239,13 +307,13 @@ msgstr "" " PyObject *args,\n" " PyObject *kwargs);" -#: ../../c-api/structures.rst:197 +#: ../../c-api/structures.rst:240 msgid "" "Type of the functions used to implement Python callables in C with " "signature :c:macro:`METH_FASTCALL`. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:201 +#: ../../c-api/structures.rst:244 msgid "" "PyObject *PyCFunctionFast(PyObject *self,\n" " PyObject *const *args,\n" @@ -255,14 +323,14 @@ msgstr "" " PyObject *const *args,\n" " Py_ssize_t nargs);" -#: ../../c-api/structures.rst:207 +#: ../../c-api/structures.rst:250 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_FASTCALL | METH_KEYWORDS `. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:211 +#: ../../c-api/structures.rst:254 msgid "" "PyObject *PyCFunctionFastWithKeywords(PyObject *self,\n" " PyObject *const *args,\n" @@ -274,14 +342,14 @@ msgstr "" " Py_ssize_t nargs,\n" " PyObject *kwnames);" -#: ../../c-api/structures.rst:218 +#: ../../c-api/structures.rst:261 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:222 +#: ../../c-api/structures.rst:265 msgid "" "PyObject *PyCMethod(PyObject *self,\n" " PyTypeObject *defining_class,\n" @@ -295,29 +363,29 @@ msgstr "" " Py_ssize_t nargs,\n" " PyObject *kwnames)" -#: ../../c-api/structures.rst:233 +#: ../../c-api/structures.rst:276 msgid "" "Structure used to describe a method of an extension type. This structure " "has four fields:" msgstr "" -#: ../../c-api/structures.rst:238 +#: ../../c-api/structures.rst:281 msgid "Name of the method." msgstr "" -#: ../../c-api/structures.rst:242 +#: ../../c-api/structures.rst:285 msgid "Pointer to the C implementation." msgstr "" -#: ../../c-api/structures.rst:246 +#: ../../c-api/structures.rst:289 msgid "Flags bits indicating how the call should be constructed." msgstr "" -#: ../../c-api/structures.rst:250 +#: ../../c-api/structures.rst:293 msgid "Points to the contents of the docstring." msgstr "" -#: ../../c-api/structures.rst:252 +#: ../../c-api/structures.rst:295 msgid "" "The :c:member:`~PyMethodDef.ml_meth` is a C function pointer. The functions " "may be of different types, but they always return :c:expr:`PyObject*`. If " @@ -327,18 +395,18 @@ msgid "" "implementation uses the specific C type of the *self* object." msgstr "" -#: ../../c-api/structures.rst:260 +#: ../../c-api/structures.rst:303 msgid "" "The :c:member:`~PyMethodDef.ml_flags` field is a bitfield which can include " "the following flags. The individual flags indicate either a calling " "convention or a binding convention." msgstr "" -#: ../../c-api/structures.rst:265 +#: ../../c-api/structures.rst:308 msgid "There are these calling conventions:" msgstr "" -#: ../../c-api/structures.rst:269 +#: ../../c-api/structures.rst:312 msgid "" "This is the typical calling convention, where the methods have the " "type :c:type:`PyCFunction`. The function expects two :c:expr:`PyObject*` " @@ -349,7 +417,7 @@ msgid "" "or :c:func:`PyArg_UnpackTuple`." msgstr "" -#: ../../c-api/structures.rst:279 +#: ../../c-api/structures.rst:322 msgid "" "Can only be used in certain combinations with other " "flags: :ref:`METH_VARARGS | METH_KEYWORDS `." msgstr "" -#: ../../c-api/structures.rst:287 +#: ../../c-api/structures.rst:330 msgid ":c:expr:`METH_VARARGS | METH_KEYWORDS`" msgstr ":c:expr:`METH_VARARGS | METH_KEYWORDS`" -#: ../../c-api/structures.rst:288 +#: ../../c-api/structures.rst:331 msgid "" "Methods with these flags must be of type :c:type:`PyCFunctionWithKeywords`. " "The function expects three parameters: *self*, *args*, *kwargs* where " @@ -371,7 +439,7 @@ msgid "" "using :c:func:`PyArg_ParseTupleAndKeywords`." msgstr "" -#: ../../c-api/structures.rst:297 +#: ../../c-api/structures.rst:340 msgid "" "Fast calling convention supporting only positional arguments. The methods " "have the type :c:type:`PyCFunctionFast`. The first parameter is *self*, the " @@ -380,15 +448,15 @@ msgid "" "the array)." msgstr "" -#: ../../c-api/structures.rst:307 +#: ../../c-api/structures.rst:350 msgid "``METH_FASTCALL`` is now part of the :ref:`stable ABI `." msgstr "" -#: ../../c-api/structures.rst:312 +#: ../../c-api/structures.rst:355 msgid ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" msgstr ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" -#: ../../c-api/structures.rst:313 +#: ../../c-api/structures.rst:356 msgid "" "Extension of :c:macro:`METH_FASTCALL` supporting also keyword arguments, " "with methods of type :c:type:`PyCFunctionFastWithKeywords`. Keyword " @@ -400,17 +468,17 @@ msgid "" "the positional arguments." msgstr "" -#: ../../c-api/structures.rst:328 +#: ../../c-api/structures.rst:371 msgid "" "Can only be used in the combination with other flags: :ref:`METH_METHOD | " "METH_FASTCALL | METH_KEYWORDS `." msgstr "" -#: ../../c-api/structures.rst:334 +#: ../../c-api/structures.rst:377 msgid ":c:expr:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`" msgstr ":c:expr:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`" -#: ../../c-api/structures.rst:335 +#: ../../c-api/structures.rst:378 msgid "" "Extension of :ref:`METH_FASTCALL | METH_KEYWORDS ` supporting the *defining class*, that is, the class that " @@ -418,14 +486,14 @@ msgid "" "``Py_TYPE(self)``." msgstr "" -#: ../../c-api/structures.rst:340 +#: ../../c-api/structures.rst:383 msgid "" "The method needs to be of type :c:type:`PyCMethod`, the same as for " "``METH_FASTCALL | METH_KEYWORDS`` with ``defining_class`` argument added " "after ``self``." msgstr "" -#: ../../c-api/structures.rst:349 +#: ../../c-api/structures.rst:392 msgid "" "Methods without parameters don't need to check whether arguments are given " "if they are listed with the :c:macro:`METH_NOARGS` flag. They need to be of " @@ -434,13 +502,13 @@ msgid "" "the second parameter will be ``NULL``." msgstr "" -#: ../../c-api/structures.rst:355 +#: ../../c-api/structures.rst:398 msgid "" "The function must have 2 parameters. Since the second parameter is " "unused, :c:macro:`Py_UNUSED` can be used to prevent a compiler warning." msgstr "" -#: ../../c-api/structures.rst:361 +#: ../../c-api/structures.rst:404 msgid "" "Methods with a single object argument can be listed with " "the :c:macro:`METH_O` flag, instead of invoking :c:func:`PyArg_ParseTuple` " @@ -449,7 +517,7 @@ msgid "" "single argument." msgstr "" -#: ../../c-api/structures.rst:367 +#: ../../c-api/structures.rst:410 msgid "" "These two constants are not used to indicate the calling convention but the " "binding when use with methods of classes. These may not be used for " @@ -457,27 +525,27 @@ msgid "" "any given method." msgstr "" -#: ../../c-api/structures.rst:377 +#: ../../c-api/structures.rst:420 msgid "" "The method will be passed the type object as the first parameter rather than " "an instance of the type. This is used to create *class methods*, similar to " "what is created when using the :func:`classmethod` built-in function." msgstr "" -#: ../../c-api/structures.rst:387 +#: ../../c-api/structures.rst:430 msgid "" "The method will be passed ``NULL`` as the first parameter rather than an " "instance of the type. This is used to create *static methods*, similar to " "what is created when using the :func:`staticmethod` built-in function." msgstr "" -#: ../../c-api/structures.rst:391 +#: ../../c-api/structures.rst:434 msgid "" "One other constant controls whether a method is loaded in place of another " "definition with the same method name." msgstr "" -#: ../../c-api/structures.rst:397 +#: ../../c-api/structures.rst:440 msgid "" "The method will be loaded in place of existing definitions. Without " "*METH_COEXIST*, the default is to skip repeated definitions. Since slot " @@ -490,20 +558,20 @@ msgid "" "more than wrapper object calls." msgstr "" -#: ../../c-api/structures.rst:409 +#: ../../c-api/structures.rst:452 msgid "" "Turn *ml* into a Python :term:`callable` object. The caller must ensure that " "*ml* outlives the :term:`callable`. Typically, *ml* is defined as a static " "variable." msgstr "" -#: ../../c-api/structures.rst:413 +#: ../../c-api/structures.rst:456 msgid "" "The *self* parameter will be passed as the *self* argument to the C function " "in ``ml->ml_meth`` when invoked. *self* can be ``NULL``." msgstr "" -#: ../../c-api/structures.rst:417 +#: ../../c-api/structures.rst:460 msgid "" "The :term:`callable` object's ``__module__`` attribute can be set from the " "given *module* argument. *module* should be a Python string, which will be " @@ -511,71 +579,71 @@ msgid "" "can be set to :const:`None` or ``NULL``." msgstr "" -#: ../../c-api/structures.rst:423 +#: ../../c-api/structures.rst:466 msgid ":attr:`function.__module__`" msgstr ":attr:`function.__module__`" -#: ../../c-api/structures.rst:425 +#: ../../c-api/structures.rst:468 msgid "" "The *cls* parameter will be passed as the *defining_class* argument to the C " "function. Must be set if :c:macro:`METH_METHOD` is set on ``ml->ml_flags``." msgstr "" -#: ../../c-api/structures.rst:434 +#: ../../c-api/structures.rst:477 msgid "Equivalent to ``PyCMethod_New(ml, self, module, NULL)``." msgstr "等價於 ``PyCMethod_New(ml, self, module, NULL)``。" -#: ../../c-api/structures.rst:439 +#: ../../c-api/structures.rst:482 msgid "Equivalent to ``PyCMethod_New(ml, self, NULL, NULL)``." msgstr "等價於 ``PyCMethod_New(ml, self, NULL, NULL)``。" -#: ../../c-api/structures.rst:443 +#: ../../c-api/structures.rst:486 msgid "Accessing attributes of extension types" msgstr "" -#: ../../c-api/structures.rst:447 +#: ../../c-api/structures.rst:490 msgid "" "Structure which describes an attribute of a type which corresponds to a C " "struct member. When defining a class, put a NULL-terminated array of these " "structures in the :c:member:`~PyTypeObject.tp_members` slot." msgstr "" -#: ../../c-api/structures.rst:452 +#: ../../c-api/structures.rst:495 msgid "Its fields are, in order:" msgstr "" -#: ../../c-api/structures.rst:456 +#: ../../c-api/structures.rst:499 msgid "" "Name of the member. A NULL value marks the end of a ``PyMemberDef[]`` array." msgstr "" -#: ../../c-api/structures.rst:459 +#: ../../c-api/structures.rst:502 msgid "The string should be static, no copy is made of it." msgstr "" -#: ../../c-api/structures.rst:463 +#: ../../c-api/structures.rst:506 msgid "" "The type of the member in the C struct. See :ref:`PyMemberDef-types` for the " "possible values." msgstr "" -#: ../../c-api/structures.rst:468 +#: ../../c-api/structures.rst:511 msgid "" "The offset in bytes that the member is located on the type’s object struct." msgstr "" -#: ../../c-api/structures.rst:472 +#: ../../c-api/structures.rst:515 msgid "" "Zero or more of the :ref:`PyMemberDef-flags`, combined using bitwise OR." msgstr "" -#: ../../c-api/structures.rst:476 +#: ../../c-api/structures.rst:519 msgid "" "The docstring, or NULL. The string should be static, no copy is made of it. " "Typically, it is defined using :c:macro:`PyDoc_STR`." msgstr "" -#: ../../c-api/structures.rst:480 +#: ../../c-api/structures.rst:523 msgid "" "By default (when :c:member:`~PyMemberDef.flags` is ``0``), members allow " "both read and write access. Use the :c:macro:`Py_READONLY` flag for read-" @@ -584,16 +652,17 @@ msgid "" "legacy :c:macro:`T_OBJECT`) members can be deleted." msgstr "" -#: ../../c-api/structures.rst:489 +#: ../../c-api/structures.rst:532 msgid "" "For heap-allocated types (created using :c:func:`PyType_FromSpec` or " "similar), ``PyMemberDef`` may contain a definition for the special member " "``\"__vectorcalloffset__\"``, corresponding " -"to :c:member:`~PyTypeObject.tp_vectorcall_offset` in type objects. These " -"must be defined with ``Py_T_PYSSIZET`` and ``Py_READONLY``, for example::" +"to :c:member:`~PyTypeObject.tp_vectorcall_offset` in type objects. This " +"member must be defined with ``Py_T_PYSSIZET``, and either ``Py_READONLY`` or " +"``Py_READONLY | Py_RELATIVE_OFFSET``. For example::" msgstr "" -#: ../../c-api/structures.rst:495 +#: ../../c-api/structures.rst:539 msgid "" "static PyMemberDef spam_type_members[] = {\n" " {\"__vectorcalloffset__\", Py_T_PYSSIZET,\n" @@ -607,11 +676,11 @@ msgstr "" " {NULL} /* Sentinel */\n" "};" -#: ../../c-api/structures.rst:501 +#: ../../c-api/structures.rst:545 msgid "(You may need to ``#include `` for :c:func:`!offsetof`.)" msgstr "" -#: ../../c-api/structures.rst:503 +#: ../../c-api/structures.rst:547 msgid "" "The legacy offsets :c:member:`~PyTypeObject.tp_dictoffset` " "and :c:member:`~PyTypeObject.tp_weaklistoffset` can be defined similarly " @@ -620,63 +689,70 @@ msgid "" "and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead." msgstr "" -#: ../../c-api/structures.rst:511 +#: ../../c-api/structures.rst:555 msgid "" "``PyMemberDef`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: ../../c-api/structures.rst:516 +#: ../../c-api/structures.rst:560 +msgid "" +":c:macro:`Py_RELATIVE_OFFSET` is now allowed for " +"``\"__vectorcalloffset__\"``, ``\"__dictoffset__\"`` and " +"``\"__weaklistoffset__\"``." +msgstr "" + +#: ../../c-api/structures.rst:566 msgid "" "Get an attribute belonging to the object at address *obj_addr*. The " "attribute is described by ``PyMemberDef`` *m*. Returns ``NULL`` on error." msgstr "" -#: ../../c-api/structures.rst:522 +#: ../../c-api/structures.rst:572 msgid "" "``PyMember_GetOne`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: ../../c-api/structures.rst:527 +#: ../../c-api/structures.rst:577 msgid "" "Set an attribute belonging to the object at address *obj_addr* to object " "*o*. The attribute to set is described by ``PyMemberDef`` *m*. Returns " "``0`` if successful and a negative value on failure." msgstr "" -#: ../../c-api/structures.rst:533 +#: ../../c-api/structures.rst:583 msgid "" "``PyMember_SetOne`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: ../../c-api/structures.rst:539 +#: ../../c-api/structures.rst:589 msgid "Member flags" msgstr "" -#: ../../c-api/structures.rst:541 +#: ../../c-api/structures.rst:591 msgid "The following flags can be used with :c:member:`PyMemberDef.flags`:" msgstr "" -#: ../../c-api/structures.rst:545 +#: ../../c-api/structures.rst:595 msgid "Not writable." msgstr "不可寫入。" -#: ../../c-api/structures.rst:549 +#: ../../c-api/structures.rst:599 msgid "" "Emit an ``object.__getattr__`` :ref:`audit event ` before " "reading." msgstr "" -#: ../../c-api/structures.rst:554 +#: ../../c-api/structures.rst:604 msgid "" "Indicates that the :c:member:`~PyMemberDef.offset` of this ``PyMemberDef`` " "entry indicates an offset from the subclass-specific data, rather than from " "``PyObject``." msgstr "" -#: ../../c-api/structures.rst:558 +#: ../../c-api/structures.rst:608 msgid "" "Can only be used as part of :c:member:`Py_tp_members " "` :c:type:`slot ` when creating a " @@ -684,7 +760,7 @@ msgid "" "that case." msgstr "" -#: ../../c-api/structures.rst:563 +#: ../../c-api/structures.rst:613 msgid "" "This flag is only used in :c:type:`PyType_Slot`. When " "setting :c:member:`~PyTypeObject.tp_members` during class creation, Python " @@ -692,7 +768,7 @@ msgid "" "``PyObject`` struct." msgstr "" -#: ../../c-api/structures.rst:575 +#: ../../c-api/structures.rst:625 msgid "" "The :c:macro:`!RESTRICTED`, :c:macro:`!READ_RESTRICTED` and :c:macro:`!" "WRITE_RESTRICTED` macros available with ``#include \"structmember.h\"`` are " @@ -701,7 +777,7 @@ msgid "" "nothing." msgstr "" -#: ../../c-api/structures.rst:586 +#: ../../c-api/structures.rst:636 msgid "" "The :c:macro:`!READONLY` macro was renamed to :c:macro:`Py_READONLY`. " "The :c:macro:`!PY_AUDIT_READ` macro was renamed with the ``Py_`` prefix. The " @@ -710,11 +786,11 @@ msgid "" "names." msgstr "" -#: ../../c-api/structures.rst:595 +#: ../../c-api/structures.rst:645 msgid "Member types" msgstr "" -#: ../../c-api/structures.rst:597 +#: ../../c-api/structures.rst:647 msgid "" ":c:member:`PyMemberDef.type` can be one of the following macros " "corresponding to various C types. When the member is accessed in Python, it " @@ -723,147 +799,147 @@ msgid "" "exception such as :exc:`TypeError` or :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/structures.rst:605 +#: ../../c-api/structures.rst:655 msgid "" "Unless marked (D), attributes defined this way cannot be deleted using " "e.g. :keyword:`del` or :py:func:`delattr`." msgstr "" -#: ../../c-api/structures.rst:609 +#: ../../c-api/structures.rst:659 msgid "Macro name" msgstr "巨集名稱" -#: ../../c-api/structures.rst:609 +#: ../../c-api/structures.rst:659 msgid "C type" msgstr "" -#: ../../c-api/structures.rst:609 +#: ../../c-api/structures.rst:659 msgid "Python type" msgstr "" -#: ../../c-api/structures.rst:611 +#: ../../c-api/structures.rst:661 msgid ":c:expr:`char`" msgstr ":c:expr:`char`" -#: ../../c-api/structures.rst:611 ../../c-api/structures.rst:612 -#: ../../c-api/structures.rst:613 ../../c-api/structures.rst:614 -#: ../../c-api/structures.rst:615 ../../c-api/structures.rst:616 -#: ../../c-api/structures.rst:617 ../../c-api/structures.rst:618 -#: ../../c-api/structures.rst:619 ../../c-api/structures.rst:620 -#: ../../c-api/structures.rst:621 +#: ../../c-api/structures.rst:661 ../../c-api/structures.rst:662 +#: ../../c-api/structures.rst:663 ../../c-api/structures.rst:664 +#: ../../c-api/structures.rst:665 ../../c-api/structures.rst:666 +#: ../../c-api/structures.rst:667 ../../c-api/structures.rst:668 +#: ../../c-api/structures.rst:669 ../../c-api/structures.rst:670 +#: ../../c-api/structures.rst:671 msgid ":py:class:`int`" msgstr ":py:class:`int`" -#: ../../c-api/structures.rst:612 +#: ../../c-api/structures.rst:662 msgid ":c:expr:`short`" msgstr ":c:expr:`short`" -#: ../../c-api/structures.rst:613 +#: ../../c-api/structures.rst:663 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../c-api/structures.rst:614 +#: ../../c-api/structures.rst:664 msgid ":c:expr:`long`" msgstr ":c:expr:`long`" -#: ../../c-api/structures.rst:615 +#: ../../c-api/structures.rst:665 msgid ":c:expr:`long long`" msgstr ":c:expr:`long long`" -#: ../../c-api/structures.rst:616 +#: ../../c-api/structures.rst:666 msgid ":c:expr:`unsigned char`" msgstr ":c:expr:`unsigned char`" -#: ../../c-api/structures.rst:617 +#: ../../c-api/structures.rst:667 msgid ":c:expr:`unsigned int`" msgstr ":c:expr:`unsigned int`" -#: ../../c-api/structures.rst:618 +#: ../../c-api/structures.rst:668 msgid ":c:expr:`unsigned short`" msgstr ":c:expr:`unsigned short`" -#: ../../c-api/structures.rst:619 +#: ../../c-api/structures.rst:669 msgid ":c:expr:`unsigned long`" msgstr ":c:expr:`unsigned long`" -#: ../../c-api/structures.rst:620 +#: ../../c-api/structures.rst:670 msgid ":c:expr:`unsigned long long`" msgstr ":c:expr:`unsigned long long`" -#: ../../c-api/structures.rst:621 +#: ../../c-api/structures.rst:671 msgid ":c:expr:`Py_ssize_t`" msgstr ":c:expr:`Py_ssize_t`" -#: ../../c-api/structures.rst:622 +#: ../../c-api/structures.rst:672 msgid ":c:expr:`float`" msgstr ":c:expr:`float`" -#: ../../c-api/structures.rst:622 ../../c-api/structures.rst:623 +#: ../../c-api/structures.rst:672 ../../c-api/structures.rst:673 msgid ":py:class:`float`" msgstr ":py:class:`float`" -#: ../../c-api/structures.rst:623 +#: ../../c-api/structures.rst:673 msgid ":c:expr:`double`" msgstr ":c:expr:`double`" -#: ../../c-api/structures.rst:624 +#: ../../c-api/structures.rst:674 msgid ":c:expr:`char` (written as 0 or 1)" msgstr ":c:expr:`char` (寫成 0 或 1)" -#: ../../c-api/structures.rst:624 +#: ../../c-api/structures.rst:674 msgid ":py:class:`bool`" msgstr ":py:class:`bool`" -#: ../../c-api/structures.rst:626 +#: ../../c-api/structures.rst:676 msgid ":c:expr:`const char *` (*)" msgstr ":c:expr:`const char *` (*)" -#: ../../c-api/structures.rst:626 ../../c-api/structures.rst:627 +#: ../../c-api/structures.rst:676 ../../c-api/structures.rst:677 msgid ":py:class:`str` (RO)" msgstr ":py:class:`str` (RO)" -#: ../../c-api/structures.rst:627 +#: ../../c-api/structures.rst:677 msgid ":c:expr:`const char[]` (*)" msgstr ":c:expr:`const char[]` (*)" -#: ../../c-api/structures.rst:628 +#: ../../c-api/structures.rst:678 msgid ":c:expr:`char` (0-127)" msgstr ":c:expr:`char` (0-127)" -#: ../../c-api/structures.rst:628 +#: ../../c-api/structures.rst:678 msgid ":py:class:`str` (**)" msgstr ":py:class:`str` (**)" -#: ../../c-api/structures.rst:629 +#: ../../c-api/structures.rst:679 msgid ":c:expr:`PyObject *`" msgstr ":c:expr:`PyObject *`" -#: ../../c-api/structures.rst:629 +#: ../../c-api/structures.rst:679 msgid ":py:class:`object` (D)" msgstr ":py:class:`object` (D)" -#: ../../c-api/structures.rst:632 +#: ../../c-api/structures.rst:682 msgid "" "(*): Zero-terminated, UTF8-encoded C string. With :c:macro:`!Py_T_STRING` " "the C representation is a pointer; with :c:macro:`!Py_T_STRING_INPLACE` the " "string is stored directly in the structure." msgstr "" -#: ../../c-api/structures.rst:637 +#: ../../c-api/structures.rst:687 msgid "(**): String of length 1. Only ASCII is accepted." msgstr "" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:689 msgid "(RO): Implies :c:macro:`Py_READONLY`." msgstr "" -#: ../../c-api/structures.rst:641 +#: ../../c-api/structures.rst:691 msgid "" "(D): Can be deleted, in which case the pointer is set to ``NULL``. Reading a " "``NULL`` pointer raises :py:exc:`AttributeError`." msgstr "" -#: ../../c-api/structures.rst:667 +#: ../../c-api/structures.rst:717 msgid "" "In previous versions, the macros were only available with ``#include " "\"structmember.h\"`` and were named without the ``Py_`` prefix (e.g. as " @@ -871,174 +947,183 @@ msgid "" "with the following deprecated types:" msgstr "" -#: ../../c-api/structures.rst:675 +#: ../../c-api/structures.rst:725 msgid "" "Like ``Py_T_OBJECT_EX``, but ``NULL`` is converted to ``None``. This results " "in surprising behavior in Python: deleting the attribute effectively sets it " "to ``None``." msgstr "" -#: ../../c-api/structures.rst:681 +#: ../../c-api/structures.rst:731 msgid "Always ``None``. Must be used with :c:macro:`Py_READONLY`." msgstr "" -#: ../../c-api/structures.rst:684 +#: ../../c-api/structures.rst:734 msgid "Defining Getters and Setters" msgstr "" -#: ../../c-api/structures.rst:688 +#: ../../c-api/structures.rst:738 msgid "" "Structure to define property-like access for a type. See also description of " "the :c:member:`PyTypeObject.tp_getset` slot." msgstr "" -#: ../../c-api/structures.rst:693 +#: ../../c-api/structures.rst:743 msgid "attribute name" msgstr "屬性名稱" -#: ../../c-api/structures.rst:697 +#: ../../c-api/structures.rst:747 msgid "C function to get the attribute." msgstr "" -#: ../../c-api/structures.rst:701 +#: ../../c-api/structures.rst:751 msgid "" "Optional C function to set or delete the attribute. If ``NULL``, the " "attribute is read-only." msgstr "" -#: ../../c-api/structures.rst:706 +#: ../../c-api/structures.rst:756 msgid "optional docstring" msgstr "可選的文件字串" -#: ../../c-api/structures.rst:710 +#: ../../c-api/structures.rst:760 msgid "" "Optional user data pointer, providing additional data for getter and setter." msgstr "" -#: ../../c-api/structures.rst:714 +#: ../../c-api/structures.rst:764 msgid "" "The ``get`` function takes one :c:expr:`PyObject*` parameter (the instance) " "and a user data pointer (the associated ``closure``):" msgstr "" -#: ../../c-api/structures.rst:717 +#: ../../c-api/structures.rst:767 msgid "" "It should return a new reference on success or ``NULL`` with a set exception " "on failure." msgstr "" -#: ../../c-api/structures.rst:722 +#: ../../c-api/structures.rst:772 msgid "" "``set`` functions take two :c:expr:`PyObject*` parameters (the instance and " "the value to be set) and a user data pointer (the associated ``closure``):" msgstr "" -#: ../../c-api/structures.rst:725 +#: ../../c-api/structures.rst:775 msgid "" "In case the attribute should be deleted the second parameter is ``NULL``. " "Should return ``0`` on success or ``-1`` with a set exception on failure." msgstr "" -#: ../../c-api/structures.rst:375 ../../c-api/structures.rst:385 +#: ../../c-api/structures.rst:418 ../../c-api/structures.rst:428 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/structures.rst:375 +#: ../../c-api/structures.rst:418 msgid "classmethod" msgstr "classmethod" -#: ../../c-api/structures.rst:385 +#: ../../c-api/structures.rst:428 msgid "staticmethod" msgstr "staticmethod" -#: ../../c-api/structures.rst:568 +#: ../../c-api/structures.rst:618 msgid "READ_RESTRICTED (C macro)" msgstr "READ_RESTRICTED(C 巨集)" -#: ../../c-api/structures.rst:568 +#: ../../c-api/structures.rst:618 msgid "WRITE_RESTRICTED (C macro)" msgstr "WRITE_RESTRICTED(C 巨集)" -#: ../../c-api/structures.rst:568 +#: ../../c-api/structures.rst:618 msgid "RESTRICTED (C macro)" msgstr "RESTRICTED(C 巨集)" -#: ../../c-api/structures.rst:581 +#: ../../c-api/structures.rst:631 msgid "READONLY (C macro)" msgstr "READONLY(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_BYTE (C macro)" msgstr "T_BYTE(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_SHORT (C macro)" msgstr "T_SHORT(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_INT (C macro)" msgstr "T_INT(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_LONG (C macro)" msgstr "T_LONG(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_LONGLONG (C macro)" msgstr "T_LONGLONG(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_UBYTE (C macro)" msgstr "T_UBYTE(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_USHORT (C macro)" msgstr "T_USHORT(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_UINT (C macro)" msgstr "T_UINT(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_ULONG (C macro)" msgstr "T_ULONG(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_ULONGULONG (C macro)" msgstr "T_ULONGULONG(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_PYSSIZET (C macro)" msgstr "T_PYSSIZET(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_FLOAT (C macro)" msgstr "T_FLOAT(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_DOUBLE (C macro)" msgstr "T_DOUBLE(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_BOOL (C macro)" msgstr "T_BOOL(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_CHAR (C macro)" msgstr "T_CHAR(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_STRING (C macro)" msgstr "T_STRING(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_STRING_INPLACE (C macro)" msgstr "T_STRING_INPLACE(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "T_OBJECT_EX (C macro)" msgstr "T_OBJECT_EX(C 巨集)" -#: ../../c-api/structures.rst:644 +#: ../../c-api/structures.rst:694 msgid "structmember.h" msgstr "structmember.h" + +#~ msgid "Set the object *o* type to *type*." +#~ msgstr "將物件 *o* 的型別設為 *type*。" + +#~ msgid "Get the size of the Python object *o*." +#~ msgstr "取得 Python 物件 *o* 的大小。" + +#~ msgid "Set the object *o* size to *size*." +#~ msgstr "將物件 *o* 的大小設為 *size*。" diff --git a/c-api/sys.po b/c-api/sys.po index 79a6fb3f3f5..0b6eca8780a 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-12 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,12 +27,12 @@ msgstr "作業系統工具" #: ../../c-api/sys.rst:11 msgid "" -"Return the file system representation for *path*. If the object is a :class:" -"`str` or :class:`bytes` object, then a new :term:`strong reference` is " -"returned. If the object implements the :class:`os.PathLike` interface, then :" -"meth:`~os.PathLike.__fspath__` is returned as long as it is a :class:`str` " -"or :class:`bytes` object. Otherwise :exc:`TypeError` is raised and ``NULL`` " -"is returned." +"Return the file system representation for *path*. If the object is " +"a :class:`str` or :class:`bytes` object, then a new :term:`strong reference` " +"is returned. If the object implements the :class:`os.PathLike` interface, " +"then :meth:`~os.PathLike.__fspath__` is returned as long as it is " +"a :class:`str` or :class:`bytes` object. Otherwise :exc:`TypeError` is " +"raised and ``NULL`` is returned." msgstr "" #: ../../c-api/sys.rst:24 @@ -99,8 +99,8 @@ msgstr "" #: ../../c-api/sys.rst:83 msgid "" ":func:`os.register_at_fork` allows registering custom Python functions to be " -"called by :c:func:`PyOS_BeforeFork()`, :c:func:`PyOS_AfterFork_Parent` and :" -"c:func:`PyOS_AfterFork_Child`." +"called by :c:func:`PyOS_BeforeFork()`, :c:func:`PyOS_AfterFork_Parent` " +"and :c:func:`PyOS_AfterFork_Child`." msgstr "" #: ../../c-api/sys.rst:90 @@ -134,22 +134,22 @@ msgstr "" #: ../../c-api/sys.rst:122 msgid "" "Set the signal handler for signal *i* to be *h*; return the old signal " -"handler. This is a thin wrapper around either :c:func:`!sigaction` or :c:" -"func:`!signal`. Do not call those functions directly!" +"handler. This is a thin wrapper around either :c:func:`!sigaction` " +"or :c:func:`!signal`. Do not call those functions directly!" msgstr "" #: ../../c-api/sys.rst:129 msgid "" "This function should not be called directly: use the :c:type:`PyConfig` API " -"with the :c:func:`PyConfig_SetBytesString` function which ensures that :ref:" -"`Python is preinitialized `." +"with the :c:func:`PyConfig_SetBytesString` function which ensures " +"that :ref:`Python is preinitialized `." msgstr "" #: ../../c-api/sys.rst:133 ../../c-api/sys.rst:200 msgid "" "This function must not be called before :ref:`Python is preinitialized ` and so that the LC_CTYPE locale is properly configured: see the :c:" -"func:`Py_PreInitialize` function." +"preinit>` and so that the LC_CTYPE locale is properly configured: see " +"the :c:func:`Py_PreInitialize` function." msgstr "" #: ../../c-api/sys.rst:137 @@ -164,9 +164,10 @@ msgstr "" #: ../../c-api/sys.rst:144 msgid "" -"Return a pointer to a newly allocated wide character string, use :c:func:" -"`PyMem_RawFree` to free the memory. If size is not ``NULL``, write the " -"number of wide characters excluding the null character into ``*size``" +"Return a pointer to a newly allocated wide character string, " +"use :c:func:`PyMem_RawFree` to free the memory. If size is not ``NULL``, " +"write the number of wide characters excluding the null character into " +"``*size``" msgstr "" #: ../../c-api/sys.rst:148 @@ -178,9 +179,9 @@ msgstr "" #: ../../c-api/sys.rst:152 ../../c-api/sys.rst:192 msgid "" -"The :term:`filesystem encoding and error handler` are selected by :c:func:" -"`PyConfig_Read`: see :c:member:`~PyConfig.filesystem_encoding` and :c:member:" -"`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." +"The :term:`filesystem encoding and error handler` are selected " +"by :c:func:`PyConfig_Read`: see :c:member:`~PyConfig.filesystem_encoding` " +"and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." msgstr "" #: ../../c-api/sys.rst:156 @@ -196,8 +197,8 @@ msgstr "" #: ../../c-api/sys.rst:164 msgid "" -"The :c:func:`PyUnicode_DecodeFSDefaultAndSize` and :c:func:" -"`PyUnicode_DecodeLocaleAndSize` functions." +"The :c:func:`PyUnicode_DecodeFSDefaultAndSize` " +"and :c:func:`PyUnicode_DecodeLocaleAndSize` functions." msgstr "" #: ../../c-api/sys.rst:169 ../../c-api/sys.rst:211 @@ -208,8 +209,8 @@ msgstr "" #: ../../c-api/sys.rst:173 msgid "" -"The function now uses the UTF-8 encoding on Windows if :c:member:" -"`PyPreConfig.legacy_windows_fs_encoding` is zero;" +"The function now uses the UTF-8 encoding on Windows " +"if :c:member:`PyPreConfig.legacy_windows_fs_encoding` is zero;" msgstr "" #: ../../c-api/sys.rst:180 @@ -247,15 +248,58 @@ msgstr "" #: ../../c-api/sys.rst:215 msgid "" -"The function now uses the UTF-8 encoding on Windows if :c:member:" -"`PyPreConfig.legacy_windows_fs_encoding` is zero." +"The function now uses the UTF-8 encoding on Windows " +"if :c:member:`PyPreConfig.legacy_windows_fs_encoding` is zero." msgstr "" -#: ../../c-api/sys.rst:223 +#: ../../c-api/sys.rst:221 +msgid "" +"Similar to :c:func:`!fopen`, but *path* is a Python object and an exception " +"is set on error." +msgstr "" + +#: ../../c-api/sys.rst:224 +msgid "" +"*path* must be a :class:`str` object, a :class:`bytes` object, or " +"a :term:`path-like object`." +msgstr "" + +#: ../../c-api/sys.rst:227 +msgid "" +"On success, return the new file pointer. On error, set an exception and " +"return ``NULL``." +msgstr "" + +#: ../../c-api/sys.rst:230 +msgid "" +"The file must be closed by :c:func:`Py_fclose` rather than calling " +"directly :c:func:`!fclose`." +msgstr "" + +#: ../../c-api/sys.rst:233 +msgid "The file descriptor is created non-inheritable (:pep:`446`)." +msgstr "" + +#: ../../c-api/sys.rst:235 +msgid "The caller must have an :term:`attached thread state`." +msgstr "" + +#: ../../c-api/sys.rst:242 +msgid "Close a file that was opened by :c:func:`Py_fopen`." +msgstr "" + +#: ../../c-api/sys.rst:244 +msgid "" +"On success, return ``0``. On error, return ``EOF`` and ``errno`` is set to " +"indicate the error. In either case, any further access (including another " +"call to :c:func:`Py_fclose`) to the stream results in undefined behavior." +msgstr "" + +#: ../../c-api/sys.rst:255 msgid "System Functions" msgstr "系統函式" -#: ../../c-api/sys.rst:225 +#: ../../c-api/sys.rst:257 msgid "" "These are utility functions that make functionality from the :mod:`sys` " "module accessible to C code. They all work with the current interpreter " @@ -263,36 +307,36 @@ msgid "" "state structure." msgstr "" -#: ../../c-api/sys.rst:231 +#: ../../c-api/sys.rst:263 msgid "" "Return the object *name* from the :mod:`sys` module or ``NULL`` if it does " "not exist, without setting an exception." msgstr "" -#: ../../c-api/sys.rst:236 +#: ../../c-api/sys.rst:268 msgid "" "Set *name* in the :mod:`sys` module to *v* unless *v* is ``NULL``, in which " "case *name* is deleted from the sys module. Returns ``0`` on success, ``-1`` " "on error." msgstr "" -#: ../../c-api/sys.rst:242 +#: ../../c-api/sys.rst:274 msgid "" "Reset :data:`sys.warnoptions` to an empty list. This function may be called " "prior to :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/sys.rst:245 +#: ../../c-api/sys.rst:277 msgid "Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead." msgstr "" -#: ../../c-api/sys.rst:250 +#: ../../c-api/sys.rst:282 msgid "" "Write the output string described by *format* to :data:`sys.stdout`. No " "exceptions are raised, even if truncation occurs (see below)." msgstr "" -#: ../../c-api/sys.rst:253 +#: ../../c-api/sys.rst:285 msgid "" "*format* should limit the total size of the formatted output string to 1000 " "bytes or less -- after 1000 bytes, the output string is truncated. In " @@ -303,48 +347,49 @@ msgid "" "of digits for very large numbers." msgstr "" -#: ../../c-api/sys.rst:261 +#: ../../c-api/sys.rst:293 msgid "" "If a problem occurs, or :data:`sys.stdout` is unset, the formatted message " "is written to the real (C level) *stdout*." msgstr "" -#: ../../c-api/sys.rst:266 +#: ../../c-api/sys.rst:298 msgid "" "As :c:func:`PySys_WriteStdout`, but write to :data:`sys.stderr` or *stderr* " "instead." msgstr "" -#: ../../c-api/sys.rst:271 +#: ../../c-api/sys.rst:303 msgid "" -"Function similar to PySys_WriteStdout() but format the message using :c:func:" -"`PyUnicode_FromFormatV` and don't truncate the message to an arbitrary " -"length." +"Function similar to PySys_WriteStdout() but format the message " +"using :c:func:`PyUnicode_FromFormatV` and don't truncate the message to an " +"arbitrary length." msgstr "" -#: ../../c-api/sys.rst:279 +#: ../../c-api/sys.rst:311 msgid "" "As :c:func:`PySys_FormatStdout`, but write to :data:`sys.stderr` or *stderr* " "instead." msgstr "" -#: ../../c-api/sys.rst:286 +#: ../../c-api/sys.rst:318 msgid "" -"Return the current dictionary of :option:`-X` options, similarly to :data:" -"`sys._xoptions`. On error, ``NULL`` is returned and an exception is set." +"Return the current dictionary of :option:`-X` options, similarly " +"to :data:`sys._xoptions`. On error, ``NULL`` is returned and an exception " +"is set." msgstr "" -#: ../../c-api/sys.rst:295 +#: ../../c-api/sys.rst:327 msgid "" "Raise an auditing event with any active hooks. Return zero for success and " "non-zero with an exception set on failure." msgstr "" -#: ../../c-api/sys.rst:298 +#: ../../c-api/sys.rst:330 msgid "The *event* string argument must not be *NULL*." msgstr "" -#: ../../c-api/sys.rst:300 +#: ../../c-api/sys.rst:332 msgid "" "If any hooks have been added, *format* and other arguments will be used to " "construct a tuple to pass. Apart from ``N``, the same format characters as " @@ -352,40 +397,41 @@ msgid "" "tuple, it will be added into a single-element tuple." msgstr "" -#: ../../c-api/sys.rst:305 +#: ../../c-api/sys.rst:337 msgid "" "The ``N`` format option must not be used. It consumes a reference, but since " "there is no way to know whether arguments to this function will be consumed, " "using it may cause reference leaks." msgstr "" -#: ../../c-api/sys.rst:309 +#: ../../c-api/sys.rst:341 msgid "" -"Note that ``#`` format characters should always be treated as :c:type:" -"`Py_ssize_t`, regardless of whether ``PY_SSIZE_T_CLEAN`` was defined." +"Note that ``#`` format characters should always be treated " +"as :c:type:`Py_ssize_t`, regardless of whether ``PY_SSIZE_T_CLEAN`` was " +"defined." msgstr "" -#: ../../c-api/sys.rst:312 +#: ../../c-api/sys.rst:344 msgid ":func:`sys.audit` performs the same function from Python code." msgstr "" -#: ../../c-api/sys.rst:314 +#: ../../c-api/sys.rst:346 msgid "See also :c:func:`PySys_AuditTuple`." msgstr "請參閱 :c:func:`PySys_AuditTuple`。" -#: ../../c-api/sys.rst:320 +#: ../../c-api/sys.rst:352 msgid "" "Require :c:type:`Py_ssize_t` for ``#`` format characters. Previously, an " "unavoidable deprecation warning was raised." msgstr "" -#: ../../c-api/sys.rst:326 +#: ../../c-api/sys.rst:358 msgid "" "Similar to :c:func:`PySys_Audit`, but pass arguments as a Python object. " "*args* must be a :class:`tuple`. To pass no arguments, *args* can be *NULL*." msgstr "" -#: ../../c-api/sys.rst:334 +#: ../../c-api/sys.rst:366 msgid "" "Append the callable *hook* to the list of active auditing hooks. Return zero " "on success and non-zero on failure. If the runtime has been initialized, " @@ -393,35 +439,35 @@ msgid "" "all interpreters created by the runtime." msgstr "" -#: ../../c-api/sys.rst:340 +#: ../../c-api/sys.rst:372 msgid "" "The *userData* pointer is passed into the hook function. Since hook " "functions may be called from different runtimes, this pointer should not " "refer directly to Python state." msgstr "" -#: ../../c-api/sys.rst:344 +#: ../../c-api/sys.rst:376 msgid "" "This function is safe to call before :c:func:`Py_Initialize`. When called " "after runtime initialization, existing audit hooks are notified and may " -"silently abort the operation by raising an error subclassed from :class:" -"`Exception` (other errors will not be silenced)." +"silently abort the operation by raising an error subclassed " +"from :class:`Exception` (other errors will not be silenced)." msgstr "" -#: ../../c-api/sys.rst:349 +#: ../../c-api/sys.rst:381 msgid "" -"The hook function is always called with the GIL held by the Python " -"interpreter that raised the event." +"The hook function is always called with an :term:`attached thread state` by " +"the Python interpreter that raised the event." msgstr "" -#: ../../c-api/sys.rst:352 +#: ../../c-api/sys.rst:384 msgid "" "See :pep:`578` for a detailed description of auditing. Functions in the " "runtime and standard library that raise events are listed in the :ref:`audit " "events table `. Details are in each function's documentation." msgstr "" -#: ../../c-api/sys.rst:357 ../../c-api/sys.rst:359 +#: ../../c-api/sys.rst:389 ../../c-api/sys.rst:391 msgid "" "If the interpreter is initialized, this function raises an auditing event " "``sys.addaudithook`` with no arguments. If any existing hooks raise an " @@ -430,7 +476,7 @@ msgid "" "hook has been added unless they control all existing hooks." msgstr "" -#: ../../c-api/sys.rst:368 +#: ../../c-api/sys.rst:400 msgid "" "The type of the hook function. *event* is the C string event argument passed " "to :c:func:`PySys_Audit` or :c:func:`PySys_AuditTuple`. *args* is guaranteed " @@ -438,43 +484,43 @@ msgid "" "PySys_AddAuditHook()." msgstr "" -#: ../../c-api/sys.rst:380 +#: ../../c-api/sys.rst:412 msgid "Process Control" msgstr "行程控制" -#: ../../c-api/sys.rst:387 +#: ../../c-api/sys.rst:419 msgid "" "Print a fatal error message and kill the process. No cleanup is performed. " "This function should only be invoked when a condition is detected that would " "make it dangerous to continue using the Python interpreter; e.g., when the " "object administration appears to be corrupted. On Unix, the standard C " -"library function :c:func:`!abort` is called which will attempt to produce a :" -"file:`core` file." +"library function :c:func:`!abort` is called which will attempt to produce " +"a :file:`core` file." msgstr "" -#: ../../c-api/sys.rst:394 +#: ../../c-api/sys.rst:426 msgid "" "The ``Py_FatalError()`` function is replaced with a macro which logs " "automatically the name of the current function, unless the " "``Py_LIMITED_API`` macro is defined." msgstr "" -#: ../../c-api/sys.rst:398 +#: ../../c-api/sys.rst:430 msgid "Log the function name automatically." msgstr "" -#: ../../c-api/sys.rst:408 +#: ../../c-api/sys.rst:440 msgid "" "Exit the current process. This calls :c:func:`Py_FinalizeEx` and then calls " -"the standard C library function ``exit(status)``. If :c:func:" -"`Py_FinalizeEx` indicates an error, the exit status is set to 120." +"the standard C library function ``exit(status)``. " +"If :c:func:`Py_FinalizeEx` indicates an error, the exit status is set to 120." msgstr "" -#: ../../c-api/sys.rst:412 +#: ../../c-api/sys.rst:444 msgid "Errors from finalization no longer ignored." msgstr "" -#: ../../c-api/sys.rst:422 +#: ../../c-api/sys.rst:454 msgid "" "Register a cleanup function to be called by :c:func:`Py_FinalizeEx`. The " "cleanup function will be called with no arguments and should return no " @@ -486,7 +532,7 @@ msgid "" "should be called by *func*." msgstr "" -#: ../../c-api/sys.rst:432 +#: ../../c-api/sys.rst:464 msgid ":c:func:`PyUnstable_AtExit` for passing a ``void *data`` argument." msgstr "" @@ -494,18 +540,18 @@ msgstr "" msgid "USE_STACKCHECK (C macro)" msgstr "USE_STACKCHECK(C 巨集)" -#: ../../c-api/sys.rst:385 +#: ../../c-api/sys.rst:417 msgid "abort (C function)" msgstr "abort(C 函式)" -#: ../../c-api/sys.rst:404 ../../c-api/sys.rst:418 +#: ../../c-api/sys.rst:436 ../../c-api/sys.rst:450 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" -#: ../../c-api/sys.rst:404 +#: ../../c-api/sys.rst:436 msgid "exit (C function)" msgstr "exit(C 函式)" -#: ../../c-api/sys.rst:418 +#: ../../c-api/sys.rst:450 msgid "cleanup functions" msgstr "cleanup functions(清理函式)" diff --git a/c-api/time.po b/c-api/time.po index 401edfe3890..cfd6272fe08 100644 --- a/c-api/time.po +++ b/c-api/time.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-05-25 04:26+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -100,9 +100,10 @@ msgstr "" "統上,整數溢位很可能是由於錯誤設定的系統時間所造成。)" #: ../../c-api/time.rst:58 +#, fuzzy msgid "" "As any other C API (unless otherwise specified), the functions must be " -"called with the :term:`GIL` held." +"called with an :term:`attached thread state`." msgstr "" "如同任何其他 C API(除非另有指定),必須在持有 :term:`GIL` 的情況下呼叫函式。" @@ -132,9 +133,10 @@ msgid "Raw Clock Functions" msgstr "原始時鐘函式" #: ../../c-api/time.rst:80 +#, fuzzy msgid "" "Similar to clock functions, but don't set an exception on error and don't " -"require the caller to hold the GIL." +"require the caller to have an :term:`attached thread state`." msgstr "類似於時鐘函式,但不會在出錯時設定例外,也不需要讓呼叫者持有 GIL。" #: ../../c-api/time.rst:83 @@ -142,35 +144,40 @@ msgid "On success, the functions return ``0``." msgstr "成功時函式會回傳 ``0``。" #: ../../c-api/time.rst:85 +#, fuzzy msgid "" "On failure, they set ``*result`` to ``0`` and return ``-1``, *without* " -"setting an exception. To get the cause of the error, acquire the GIL and " -"call the regular (non-``Raw``) function. Note that the regular function may " -"succeed after the ``Raw`` one failed." +"setting an exception. To get the cause of the error, :term:`attach ` a :term:`thread state`, and call the regular (non-``Raw``) " +"function. Note that the regular function may succeed after the ``Raw`` one " +"failed." msgstr "" "失敗時,它們會將 ``*result`` 設為 ``0`` 並回傳 ``-1``, 而\\ *不*\\ 設定例外。" "要取得錯誤原因,請取得 GIL 並呼叫常規(非 ``Raw``)函式。請注意,常規函式可能" "會在 ``Raw`` 的函式失敗後成功。" #: ../../c-api/time.rst:92 +#, fuzzy msgid "" "Similar to :c:func:`PyTime_Monotonic`, but don't set an exception on error " -"and don't require holding the GIL." +"and don't require an :term:`attached thread state`." msgstr "" "類似於 :c:func:`PyTime_Monotonic`,但不會在出錯時設定例外,也不需要持有 GIL。" #: ../../c-api/time.rst:97 +#, fuzzy msgid "" "Similar to :c:func:`PyTime_PerfCounter`, but don't set an exception on error " -"and don't require holding the GIL." +"and don't require an :term:`attached thread state`." msgstr "" "類似於 :c:func:`PyTime_PerfCounter`,但不會在出錯時設定例外,也不需要持有 " "GIL。" #: ../../c-api/time.rst:102 +#, fuzzy msgid "" "Similar to :c:func:`PyTime_Time`, but don't set an exception on error and " -"don't require holding the GIL." +"don't require an :term:`attached thread state`." msgstr "" "類似於 :c:func:`PyTime_Time`,但不會在出錯時設定例外,也不需要持有 GIL。" diff --git a/c-api/tuple.po b/c-api/tuple.po index d70d49e9677..070a3ed7de3 100644 --- a/c-api/tuple.po +++ b/c-api/tuple.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-08 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -119,8 +119,8 @@ msgid "" "*only* be used to fill in brand new tuples." msgstr "" -#: ../../c-api/tuple.rst:102 ../../c-api/tuple.rst:218 -#: ../../c-api/tuple.rst:236 +#: ../../c-api/tuple.rst:102 ../../c-api/tuple.rst:224 +#: ../../c-api/tuple.rst:242 msgid "" "Bounds checking is performed as an assertion if Python is built " "in :ref:`debug mode ` or :option:`with assertions <--with-" @@ -135,7 +135,14 @@ msgid "" "leaked." msgstr "" -#: ../../c-api/tuple.rst:115 +#: ../../c-api/tuple.rst:114 +msgid "" +"This macro should *only* be used on tuples that are newly created. Using " +"this macro on a tuple that is already in use (or in other words, has a " +"refcount > 1) could lead to undefined behavior." +msgstr "" + +#: ../../c-api/tuple.rst:121 msgid "" "Can be used to resize a tuple. *newsize* will be the new length of the " "tuple. Because tuples are *supposed* to be immutable, this should only be " @@ -150,11 +157,11 @@ msgid "" "or :exc:`SystemError`." msgstr "" -#: ../../c-api/tuple.rst:130 +#: ../../c-api/tuple.rst:136 msgid "Struct Sequence Objects" msgstr "" -#: ../../c-api/tuple.rst:132 +#: ../../c-api/tuple.rst:138 msgid "" "Struct sequence objects are the C equivalent " "of :func:`~collections.namedtuple` objects, i.e. a sequence whose items can " @@ -162,50 +169,50 @@ msgid "" "have to create a specific struct sequence type." msgstr "" -#: ../../c-api/tuple.rst:139 +#: ../../c-api/tuple.rst:145 msgid "" "Create a new struct sequence type from the data in *desc*, described below. " "Instances of the resulting type can be created " "with :c:func:`PyStructSequence_New`." msgstr "" -#: ../../c-api/tuple.rst:142 ../../c-api/tuple.rst:211 +#: ../../c-api/tuple.rst:148 ../../c-api/tuple.rst:217 msgid "Return ``NULL`` with an exception set on failure." msgstr "失敗時回傳 ``NULL`` 並設定例外。" -#: ../../c-api/tuple.rst:147 +#: ../../c-api/tuple.rst:153 msgid "Initializes a struct sequence type *type* from *desc* in place." msgstr "" -#: ../../c-api/tuple.rst:152 +#: ../../c-api/tuple.rst:158 msgid "" "Like :c:func:`PyStructSequence_InitType`, but returns ``0`` on success and " "``-1`` with an exception set on failure." msgstr "" -#: ../../c-api/tuple.rst:160 +#: ../../c-api/tuple.rst:166 msgid "Contains the meta information of a struct sequence type to create." msgstr "" -#: ../../c-api/tuple.rst:164 +#: ../../c-api/tuple.rst:170 msgid "" "Fully qualified name of the type; null-terminated UTF-8 encoded. The name " "must contain the module name." msgstr "" -#: ../../c-api/tuple.rst:169 +#: ../../c-api/tuple.rst:175 msgid "Pointer to docstring for the type or ``NULL`` to omit." msgstr "" -#: ../../c-api/tuple.rst:173 +#: ../../c-api/tuple.rst:179 msgid "Pointer to ``NULL``-terminated array with field names of the new type." msgstr "" -#: ../../c-api/tuple.rst:177 +#: ../../c-api/tuple.rst:183 msgid "Number of fields visible to the Python side (if used as tuple)." msgstr "" -#: ../../c-api/tuple.rst:182 +#: ../../c-api/tuple.rst:188 msgid "" "Describes a field of a struct sequence. As a struct sequence is modeled as a " "tuple, all fields are typed as :c:expr:`PyObject*`. The index in " @@ -214,59 +221,59 @@ msgid "" "sequence is described." msgstr "" -#: ../../c-api/tuple.rst:190 +#: ../../c-api/tuple.rst:196 msgid "" "Name for the field or ``NULL`` to end the list of named fields, set " "to :c:data:`PyStructSequence_UnnamedField` to leave unnamed." msgstr "" -#: ../../c-api/tuple.rst:195 +#: ../../c-api/tuple.rst:201 msgid "Field docstring or ``NULL`` to omit." msgstr "" -#: ../../c-api/tuple.rst:200 +#: ../../c-api/tuple.rst:206 msgid "Special value for a field name to leave it unnamed." msgstr "" -#: ../../c-api/tuple.rst:202 +#: ../../c-api/tuple.rst:208 msgid "The type was changed from ``char *``." msgstr "" -#: ../../c-api/tuple.rst:208 +#: ../../c-api/tuple.rst:214 msgid "" "Creates an instance of *type*, which must have been created " "with :c:func:`PyStructSequence_NewType`." msgstr "" -#: ../../c-api/tuple.rst:216 +#: ../../c-api/tuple.rst:222 msgid "" "Return the object at position *pos* in the struct sequence pointed to by *p*." msgstr "" -#: ../../c-api/tuple.rst:224 +#: ../../c-api/tuple.rst:230 msgid "Alias to :c:func:`PyStructSequence_GetItem`." msgstr "" -#: ../../c-api/tuple.rst:226 +#: ../../c-api/tuple.rst:232 msgid "Now implemented as an alias to :c:func:`PyStructSequence_GetItem`." msgstr "" -#: ../../c-api/tuple.rst:232 +#: ../../c-api/tuple.rst:238 msgid "" "Sets the field at index *pos* of the struct sequence *p* to value *o*. " "Like :c:func:`PyTuple_SET_ITEM`, this should only be used to fill in brand " "new instances." msgstr "" -#: ../../c-api/tuple.rst:241 +#: ../../c-api/tuple.rst:247 msgid "This function \"steals\" a reference to *o*." msgstr "" -#: ../../c-api/tuple.rst:246 +#: ../../c-api/tuple.rst:252 msgid "Alias to :c:func:`PyStructSequence_SetItem`." msgstr "" -#: ../../c-api/tuple.rst:248 +#: ../../c-api/tuple.rst:254 msgid "Now implemented as an alias to :c:func:`PyStructSequence_SetItem`." msgstr "" diff --git a/c-api/type.po b/c-api/type.po index 3ddebe9e5cf..949784ee9e7 100644 --- a/c-api/type.po +++ b/c-api/type.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-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,8 +27,8 @@ msgstr "" #: ../../c-api/type.rst:18 msgid "" -"This is the type object for type objects; it is the same object as :class:" -"`type` in the Python layer." +"This is the type object for type objects; it is the same object " +"as :class:`type` in the Python layer." msgstr "" #: ../../c-api/type.rst:24 @@ -53,9 +53,9 @@ msgstr "" msgid "" "Return the :c:member:`~PyTypeObject.tp_flags` member of *type*. This " "function is primarily meant for use with ``Py_LIMITED_API``; the individual " -"flag bits are guaranteed to be stable across Python releases, but access to :" -"c:member:`~PyTypeObject.tp_flags` itself is not part of the :ref:`limited " -"API `." +"flag bits are guaranteed to be stable across Python releases, but access " +"to :c:member:`~PyTypeObject.tp_flags` itself is not part of " +"the :ref:`limited API `." msgstr "" #: ../../c-api/type.rst:49 @@ -106,26 +106,26 @@ msgstr "" #: ../../c-api/type.rst:93 msgid "" -"Clear watcher identified by *watcher_id* (previously returned from :c:func:" -"`PyType_AddWatcher`). Return ``0`` on success, ``-1`` on error (e.g. if " -"*watcher_id* was never registered.)" +"Clear watcher identified by *watcher_id* (previously returned " +"from :c:func:`PyType_AddWatcher`). Return ``0`` on success, ``-1`` on error " +"(e.g. if *watcher_id* was never registered.)" msgstr "" #: ../../c-api/type.rst:97 msgid "" "An extension should never call ``PyType_ClearWatcher`` with a *watcher_id* " -"that was not returned to it by a previous call to :c:func:" -"`PyType_AddWatcher`." +"that was not returned to it by a previous call " +"to :c:func:`PyType_AddWatcher`." msgstr "" #: ../../c-api/type.rst:106 msgid "" -"Mark *type* as watched. The callback granted *watcher_id* by :c:func:" -"`PyType_AddWatcher` will be called whenever :c:func:`PyType_Modified` " -"reports a change to *type*. (The callback may be called only once for a " -"series of consecutive modifications to *type*, if :c:func:`!_PyType_Lookup` " -"is not called on *type* between the modifications; this is an implementation " -"detail and subject to change.)" +"Mark *type* as watched. The callback granted *watcher_id* " +"by :c:func:`PyType_AddWatcher` will be called " +"whenever :c:func:`PyType_Modified` reports a change to *type*. (The callback " +"may be called only once for a series of consecutive modifications to *type*, " +"if :c:func:`!_PyType_Lookup` is not called on *type* between the " +"modifications; this is an implementation detail and subject to change.)" msgstr "" #: ../../c-api/type.rst:113 @@ -163,26 +163,48 @@ msgstr "" #: ../../c-api/type.rst:146 msgid "" -"This function only checks for actual subtypes, which means that :meth:`~type." -"__subclasscheck__` is not called on *b*. Call :c:func:`PyObject_IsSubclass` " -"to do the same check that :func:`issubclass` would do." +"This function only checks for actual subtypes, which means " +"that :meth:`~type.__subclasscheck__` is not called on *b*. " +"Call :c:func:`PyObject_IsSubclass` to do the same check " +"that :func:`issubclass` would do." msgstr "" #: ../../c-api/type.rst:154 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_alloc` slot of a type " -"object. Use Python's default memory allocation mechanism to allocate a new " -"instance and initialize all its contents to ``NULL``." +"object. Uses Python's default memory allocation mechanism to allocate " +"memory for a new instance, zeros the memory, then initializes the memory as " +"if by calling :c:func:`PyObject_Init` or :c:func:`PyObject_InitVar`." msgstr "" -#: ../../c-api/type.rst:160 +#: ../../c-api/type.rst:159 +msgid "" +"Do not call this directly to allocate memory for an object; call the " +"type's :c:member:`~PyTypeObject.tp_alloc` slot instead." +msgstr "" + +#: ../../c-api/type.rst:162 +msgid "" +"For types that support garbage collection (i.e., " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set), this function behaves " +"like :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar` (except the " +"memory is guaranteed to be zeroed before initialization), and should be " +"paired with :c:func:`PyObject_GC_Del` in :c:member:`~PyTypeObject.tp_free`. " +"Otherwise, it behaves like :c:macro:`PyObject_New` " +"or :c:macro:`PyObject_NewVar` (except the memory is guaranteed to be zeroed " +"before initialization) and should be paired with :c:func:`PyObject_Free` " +"in :c:member:`~PyTypeObject.tp_free`." +msgstr "" + +#: ../../c-api/type.rst:174 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_new` slot of a type " -"object. Create a new instance using the type's :c:member:`~PyTypeObject." -"tp_alloc` slot." +"object. Creates a new instance using the " +"type's :c:member:`~PyTypeObject.tp_alloc` slot and returns the resulting " +"object." msgstr "" -#: ../../c-api/type.rst:165 +#: ../../c-api/type.rst:180 msgid "" "Finalize a type object. This should be called on all type objects to finish " "their initialization. This function is responsible for adding inherited " @@ -190,43 +212,43 @@ msgid "" "and sets an exception on error." msgstr "" -#: ../../c-api/type.rst:171 +#: ../../c-api/type.rst:186 msgid "" "If some of the base classes implements the GC protocol and the provided type " "does not include the :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags, then the GC " "protocol will be automatically implemented from its parents. On the " -"contrary, if the type being created does include :c:macro:" -"`Py_TPFLAGS_HAVE_GC` in its flags then it **must** implement the GC protocol " -"itself by at least implementing the :c:member:`~PyTypeObject.tp_traverse` " -"handle." +"contrary, if the type being created does " +"include :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags then it **must** " +"implement the GC protocol itself by at least implementing " +"the :c:member:`~PyTypeObject.tp_traverse` handle." msgstr "" -#: ../../c-api/type.rst:181 +#: ../../c-api/type.rst:196 msgid "" -"Return the type's name. Equivalent to getting the type's :attr:`~type." -"__name__` attribute." +"Return the type's name. Equivalent to getting the " +"type's :attr:`~type.__name__` attribute." msgstr "" -#: ../../c-api/type.rst:188 +#: ../../c-api/type.rst:203 msgid "" -"Return the type's qualified name. Equivalent to getting the type's :attr:" -"`~type.__qualname__` attribute." +"Return the type's qualified name. Equivalent to getting the " +"type's :attr:`~type.__qualname__` attribute." msgstr "" -#: ../../c-api/type.rst:195 +#: ../../c-api/type.rst:210 msgid "" "Return the type's fully qualified name. Equivalent to ``f\"{type.__module__}." -"{type.__qualname__}\"``, or :attr:`type.__qualname__` if :attr:`type." -"__module__` is not a string or is equal to ``\"builtins\"``." +"{type.__qualname__}\"``, or :attr:`type.__qualname__` " +"if :attr:`type.__module__` is not a string or is equal to ``\"builtins\"``." msgstr "" -#: ../../c-api/type.rst:203 +#: ../../c-api/type.rst:218 msgid "" -"Return the type's module name. Equivalent to getting the :attr:`type." -"__module__` attribute." +"Return the type's module name. Equivalent to getting " +"the :attr:`type.__module__` attribute." msgstr "" -#: ../../c-api/type.rst:210 +#: ../../c-api/type.rst:225 msgid "" "Return the function pointer stored in the given slot. If the result is " "``NULL``, this indicates that either the slot is ``NULL``, or that the " @@ -234,123 +256,153 @@ msgid "" "result pointer into the appropriate function type." msgstr "" -#: ../../c-api/type.rst:216 +#: ../../c-api/type.rst:231 msgid "" "See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument." msgstr "" -#: ../../c-api/type.rst:220 +#: ../../c-api/type.rst:235 msgid "" ":c:func:`PyType_GetSlot` can now accept all types. Previously, it was " "limited to :ref:`heap types `." msgstr "" -#: ../../c-api/type.rst:226 +#: ../../c-api/type.rst:241 msgid "" "Return the module object associated with the given type when the type was " "created using :c:func:`PyType_FromModuleAndSpec`." msgstr "" -#: ../../c-api/type.rst:229 ../../c-api/type.rst:249 +#: ../../c-api/type.rst:244 ../../c-api/type.rst:264 msgid "" "If no module is associated with the given type, sets :py:class:`TypeError` " "and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:232 +#: ../../c-api/type.rst:247 msgid "" "This function is usually used to get the module in which a method is " "defined. Note that in such a method, ``PyType_GetModule(Py_TYPE(self))`` may " "not return the intended result. ``Py_TYPE(self)`` may be a *subclass* of the " "intended class, and subclasses are not necessarily defined in the same " "module as their superclass. See :c:type:`PyCMethod` to get the class that " -"defines the method. See :c:func:`PyType_GetModuleByDef` for cases when :c:" -"type:`!PyCMethod` cannot be used." +"defines the method. See :c:func:`PyType_GetModuleByDef` for cases " +"when :c:type:`!PyCMethod` cannot be used." msgstr "" -#: ../../c-api/type.rst:245 +#: ../../c-api/type.rst:260 msgid "" "Return the state of the module object associated with the given type. This " -"is a shortcut for calling :c:func:`PyModule_GetState()` on the result of :c:" -"func:`PyType_GetModule`." +"is a shortcut for calling :c:func:`PyModule_GetState()` on the result " +"of :c:func:`PyType_GetModule`." msgstr "" -#: ../../c-api/type.rst:252 +#: ../../c-api/type.rst:267 msgid "" "If the *type* has an associated module but its state is ``NULL``, returns " "``NULL`` without setting an exception." msgstr "" -#: ../../c-api/type.rst:259 +#: ../../c-api/type.rst:274 msgid "" -"Find the first superclass whose module was created from the given :c:type:" -"`PyModuleDef` *def*, and return that module." +"Find the first superclass whose module was created from the " +"given :c:type:`PyModuleDef` *def*, and return that module." msgstr "" -#: ../../c-api/type.rst:262 +#: ../../c-api/type.rst:277 msgid "" "If no module is found, raises a :py:class:`TypeError` and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:264 +#: ../../c-api/type.rst:279 msgid "" -"This function is intended to be used together with :c:func:" -"`PyModule_GetState()` to get module state from slot methods (such as :c:" -"member:`~PyTypeObject.tp_init` or :c:member:`~PyNumberMethods.nb_add`) and " -"other places where a method's defining class cannot be passed using the :c:" -"type:`PyCMethod` calling convention." +"This function is intended to be used together " +"with :c:func:`PyModule_GetState()` to get module state from slot methods " +"(such as :c:member:`~PyTypeObject.tp_init` " +"or :c:member:`~PyNumberMethods.nb_add`) and other places where a method's " +"defining class cannot be passed using the :c:type:`PyCMethod` calling " +"convention." msgstr "" -#: ../../c-api/type.rst:270 +#: ../../c-api/type.rst:285 msgid "" "The returned reference is :term:`borrowed ` from *type*, " "and will be valid as long as you hold a reference to *type*. Do not release " "it with :c:func:`Py_DECREF` or similar." msgstr "" -#: ../../c-api/type.rst:278 +#: ../../c-api/type.rst:293 +msgid "" +"Find the first superclass in *type*'s :term:`method resolution order` " +"whose :c:macro:`Py_tp_token` token is equal to the given one." +msgstr "" + +#: ../../c-api/type.rst:296 +msgid "" +"If found, set *\\*result* to a new :term:`strong reference` to it and return " +"``1``." +msgstr "" + +#: ../../c-api/type.rst:298 +msgid "If not found, set *\\*result* to ``NULL`` and return ``0``." +msgstr "" + +#: ../../c-api/type.rst:299 +msgid "" +"On error, set *\\*result* to ``NULL`` and return ``-1`` with an exception " +"set." +msgstr "" + +#: ../../c-api/type.rst:302 +msgid "" +"The *result* argument may be ``NULL``, in which case *\\*result* is not set. " +"Use this if you need only the return value." +msgstr "" + +#: ../../c-api/type.rst:305 +msgid "The *token* argument may not be ``NULL``." +msgstr "" + +#: ../../c-api/type.rst:311 msgid "Attempt to assign a version tag to the given type." msgstr "" -#: ../../c-api/type.rst:280 +#: ../../c-api/type.rst:313 msgid "" "Returns 1 if the type already had a valid version tag or a new one was " "assigned, or 0 if a new tag could not be assigned." msgstr "" -#: ../../c-api/type.rst:287 +#: ../../c-api/type.rst:320 msgid "Creating Heap-Allocated Types" msgstr "" -#: ../../c-api/type.rst:289 +#: ../../c-api/type.rst:322 msgid "" "The following functions and structs are used to create :ref:`heap types " "`." msgstr "" -#: ../../c-api/type.rst:294 +#: ../../c-api/type.rst:327 msgid "" -"Create and return a :ref:`heap type ` from the *spec* (see :c:" -"macro:`Py_TPFLAGS_HEAPTYPE`)." +"Create and return a :ref:`heap type ` from the *spec* " +"(see :c:macro:`Py_TPFLAGS_HEAPTYPE`)." msgstr "" -#: ../../c-api/type.rst:297 +#: ../../c-api/type.rst:330 msgid "" "The metaclass *metaclass* is used to construct the resulting type object. " "When *metaclass* is ``NULL``, the metaclass is derived from *bases* (or " "*Py_tp_base[s]* slots if *bases* is ``NULL``, see below)." msgstr "" -#: ../../c-api/type.rst:301 +#: ../../c-api/type.rst:334 msgid "" "Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not " -"supported, except if ``tp_new`` is ``NULL``. (For backwards compatibility, " -"other ``PyType_From*`` functions allow such metaclasses. They ignore " -"``tp_new``, which may result in incomplete initialization. This is " -"deprecated and in Python 3.14+ such metaclasses will not be supported.)" +"supported, except if ``tp_new`` is ``NULL``." msgstr "" -#: ../../c-api/type.rst:308 +#: ../../c-api/type.rst:337 msgid "" "The *bases* argument can be used to specify base classes; it can either be " "only one class or a tuple of classes. If *bases* is ``NULL``, the " @@ -359,126 +411,151 @@ msgid "" "derives from :class:`object`." msgstr "" -#: ../../c-api/type.rst:314 +#: ../../c-api/type.rst:343 msgid "" "The *module* argument can be used to record the module in which the new " "class is defined. It must be a module object or ``NULL``. If not ``NULL``, " -"the module is associated with the new type and can later be retrieved with :" -"c:func:`PyType_GetModule`. The associated module is not inherited by " +"the module is associated with the new type and can later be retrieved " +"with :c:func:`PyType_GetModule`. The associated module is not inherited by " "subclasses; it must be specified for each class individually." msgstr "" -#: ../../c-api/type.rst:321 +#: ../../c-api/type.rst:350 msgid "This function calls :c:func:`PyType_Ready` on the new type." msgstr "" -#: ../../c-api/type.rst:323 +#: ../../c-api/type.rst:352 msgid "" -"Note that this function does *not* fully match the behavior of calling :py:" -"class:`type() ` or using the :keyword:`class` statement. With user-" -"provided base types or metaclasses, prefer :ref:`calling ` :py:" -"class:`type` (or the metaclass) over ``PyType_From*`` functions. " +"Note that this function does *not* fully match the behavior of " +"calling :py:class:`type() ` or using the :keyword:`class` statement. " +"With user-provided base types or metaclasses, prefer :ref:`calling ` :py:class:`type` (or the metaclass) over ``PyType_From*`` functions. " "Specifically:" msgstr "" -#: ../../c-api/type.rst:330 +#: ../../c-api/type.rst:359 msgid "" ":py:meth:`~object.__new__` is not called on the new class (and it must be " "set to ``type.__new__``)." msgstr "" -#: ../../c-api/type.rst:332 +#: ../../c-api/type.rst:361 msgid ":py:meth:`~object.__init__` is not called on the new class." msgstr "" -#: ../../c-api/type.rst:333 +#: ../../c-api/type.rst:362 msgid ":py:meth:`~object.__init_subclass__` is not called on any bases." msgstr "" -#: ../../c-api/type.rst:334 +#: ../../c-api/type.rst:363 msgid ":py:meth:`~object.__set_name__` is not called on new descriptors." msgstr "" -#: ../../c-api/type.rst:340 +#: ../../c-api/type.rst:369 msgid "Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, module, spec, bases)``。" -#: ../../c-api/type.rst:346 +#: ../../c-api/type.rst:375 msgid "" "The function now accepts a single class as the *bases* argument and ``NULL`` " "as the ``tp_doc`` slot." msgstr "" -#: ../../c-api/type.rst:351 ../../c-api/type.rst:368 +#: ../../c-api/type.rst:380 ../../c-api/type.rst:401 msgid "" "The function now finds and uses a metaclass corresponding to the provided " "base classes. Previously, only :class:`type` instances were returned." msgstr "" -#: ../../c-api/type.rst:354 ../../c-api/type.rst:371 ../../c-api/type.rst:387 +#: ../../c-api/type.rst:383 ../../c-api/type.rst:404 ../../c-api/type.rst:424 msgid "" "The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*. which " "may result in incomplete initialization. Creating classes whose metaclass " -"overrides :c:member:`~PyTypeObject.tp_new` is deprecated and in Python 3.14+ " -"it will be no longer allowed." +"overrides :c:member:`~PyTypeObject.tp_new` is deprecated." msgstr "" -#: ../../c-api/type.rst:362 +#: ../../c-api/type.rst:390 ../../c-api/type.rst:411 ../../c-api/type.rst:431 +msgid "" +"Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` " +"is no longer allowed." +msgstr "" + +#: ../../c-api/type.rst:395 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, bases)``。" -#: ../../c-api/type.rst:379 +#: ../../c-api/type.rst:416 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``。" -#: ../../c-api/type.rst:383 +#: ../../c-api/type.rst:420 msgid "" "The function now finds and uses a metaclass corresponding to the base " "classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` " "instances were returned." msgstr "" -#: ../../c-api/type.rst:404 +#: ../../c-api/type.rst:436 +msgid "" +"Make a type immutable: set the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag." +msgstr "" + +#: ../../c-api/type.rst:438 +msgid "All base classes of *type* must be immutable." +msgstr "" + +#: ../../c-api/type.rst:440 +msgid "On success, return ``0``. On error, set an exception and return ``-1``." +msgstr "" + +#: ../../c-api/type.rst:443 +msgid "" +"The type must not be used before it's made immutable. For example, type " +"instances must not be created before the type is made immutable." +msgstr "" + +#: ../../c-api/type.rst:459 msgid "Structure defining a type's behavior." msgstr "" -#: ../../c-api/type.rst:408 +#: ../../c-api/type.rst:463 msgid "Name of the type, used to set :c:member:`PyTypeObject.tp_name`." msgstr "" -#: ../../c-api/type.rst:412 +#: ../../c-api/type.rst:467 msgid "" -"If positive, specifies the size of the instance in bytes. It is used to set :" -"c:member:`PyTypeObject.tp_basicsize`." +"If positive, specifies the size of the instance in bytes. It is used to " +"set :c:member:`PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/type.rst:415 +#: ../../c-api/type.rst:470 msgid "" "If zero, specifies that :c:member:`~PyTypeObject.tp_basicsize` should be " "inherited." msgstr "" -#: ../../c-api/type.rst:418 +#: ../../c-api/type.rst:473 msgid "" "If negative, the absolute value specifies how much space instances of the " -"class need *in addition* to the superclass. Use :c:func:" -"`PyObject_GetTypeData` to get a pointer to subclass-specific memory reserved " -"this way. For negative :c:member:`!basicsize`, Python will insert padding " -"when needed to meet :c:member:`~PyTypeObject.tp_basicsize`'s alignment " -"requirements." +"class need *in addition* to the superclass. " +"Use :c:func:`PyObject_GetTypeData` to get a pointer to subclass-specific " +"memory reserved this way. For negative :c:member:`!basicsize`, Python will " +"insert padding when needed to meet :c:member:`~PyTypeObject.tp_basicsize`'s " +"alignment requirements." msgstr "" -#: ../../c-api/type.rst:428 +#: ../../c-api/type.rst:483 msgid "Previously, this field could not be negative." msgstr "" -#: ../../c-api/type.rst:432 +#: ../../c-api/type.rst:487 msgid "" -"Size of one element of a variable-size type, in bytes. Used to set :c:member:" -"`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation for caveats." +"Size of one element of a variable-size type, in bytes. Used to " +"set :c:member:`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation " +"for caveats." msgstr "" -#: ../../c-api/type.rst:436 +#: ../../c-api/type.rst:491 msgid "" "If zero, :c:member:`~PyTypeObject.tp_itemsize` is inherited. Extending " "arbitrary variable-sized classes is dangerous, since some types use a fixed " @@ -487,97 +564,106 @@ msgid "" "only possible in the following situations:" msgstr "" -#: ../../c-api/type.rst:443 +#: ../../c-api/type.rst:498 msgid "" "The base is not variable-sized (its :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -#: ../../c-api/type.rst:445 +#: ../../c-api/type.rst:500 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is positive, suggesting that " "the memory layout of the base class is known." msgstr "" -#: ../../c-api/type.rst:447 +#: ../../c-api/type.rst:502 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is zero, suggesting that the " "subclass does not access the instance's memory directly." msgstr "" -#: ../../c-api/type.rst:450 +#: ../../c-api/type.rst:505 msgid "With the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag." msgstr "" -#: ../../c-api/type.rst:454 +#: ../../c-api/type.rst:509 msgid "Type flags, used to set :c:member:`PyTypeObject.tp_flags`." msgstr "" -#: ../../c-api/type.rst:456 +#: ../../c-api/type.rst:511 msgid "" -"If the ``Py_TPFLAGS_HEAPTYPE`` flag is not set, :c:func:" -"`PyType_FromSpecWithBases` sets it automatically." +"If the ``Py_TPFLAGS_HEAPTYPE`` flag is not " +"set, :c:func:`PyType_FromSpecWithBases` sets it automatically." msgstr "" -#: ../../c-api/type.rst:461 +#: ../../c-api/type.rst:516 msgid "" "Array of :c:type:`PyType_Slot` structures. Terminated by the special slot " "value ``{0, NULL}``." msgstr "" -#: ../../c-api/type.rst:464 +#: ../../c-api/type.rst:519 msgid "Each slot ID should be specified at most once." msgstr "" -#: ../../c-api/type.rst:474 +#: ../../c-api/type.rst:529 msgid "" "Structure defining optional functionality of a type, containing a slot ID " "and a value pointer." msgstr "" -#: ../../c-api/type.rst:479 +#: ../../c-api/type.rst:534 msgid "A slot ID." msgstr "" -#: ../../c-api/type.rst:481 +#: ../../c-api/type.rst:536 msgid "" -"Slot IDs are named like the field names of the structures :c:type:" -"`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:" -"type:`PyMappingMethods` and :c:type:`PyAsyncMethods` with an added ``Py_`` " -"prefix. For example, use:" +"Slot IDs are named like the field names of the " +"structures :c:type:`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:type:`PyMappingMethods` " +"and :c:type:`PyAsyncMethods` with an added ``Py_`` prefix. For example, use:" msgstr "" -#: ../../c-api/type.rst:487 +#: ../../c-api/type.rst:542 msgid "``Py_tp_dealloc`` to set :c:member:`PyTypeObject.tp_dealloc`" msgstr "" -#: ../../c-api/type.rst:488 +#: ../../c-api/type.rst:543 msgid "``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`" msgstr "" -#: ../../c-api/type.rst:489 +#: ../../c-api/type.rst:544 msgid "``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`" msgstr "" -#: ../../c-api/type.rst:491 +#: ../../c-api/type.rst:546 +msgid "" +"An additional slot is supported that does not correspond to a :c:type:`!" +"PyTypeObject` struct field:" +msgstr "" + +#: ../../c-api/type.rst:549 +msgid ":c:data:`Py_tp_token`" +msgstr "" + +#: ../../c-api/type.rst:551 msgid "" "The following “offset” fields cannot be set using :c:type:`PyType_Slot`:" msgstr "" -#: ../../c-api/type.rst:493 +#: ../../c-api/type.rst:553 msgid "" -":c:member:`~PyTypeObject.tp_weaklistoffset` (use :c:macro:" -"`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)" +":c:member:`~PyTypeObject.tp_weaklistoffset` " +"(use :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)" msgstr "" -#: ../../c-api/type.rst:495 +#: ../../c-api/type.rst:555 msgid "" -":c:member:`~PyTypeObject.tp_dictoffset` (use :c:macro:" -"`Py_TPFLAGS_MANAGED_DICT` instead if possible)" +":c:member:`~PyTypeObject.tp_dictoffset` " +"(use :c:macro:`Py_TPFLAGS_MANAGED_DICT` instead if possible)" msgstr "" -":c:member:`~PyTypeObject.tp_dictoffset`\\ (如果可能,請改用 :c:macro:" -"`Py_TPFLAGS_MANAGED_DICT`)" +":c:member:`~PyTypeObject.tp_dictoffset`\\ (如果可能,請改" +"用 :c:macro:`Py_TPFLAGS_MANAGED_DICT`)" -#: ../../c-api/type.rst:497 +#: ../../c-api/type.rst:557 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall_offset` (use " "``\"__vectorcalloffset__\"`` in :ref:`PyMemberDef `)" @@ -585,57 +671,119 @@ msgstr "" ":c:member:`~PyTypeObject.tp_vectorcall_offset`\\ (請用 :ref:`PyMemberDef " "` 中的 ``\"__vectorcalloffset__\"``)" -#: ../../c-api/type.rst:501 +#: ../../c-api/type.rst:561 msgid "" "If it is not possible to switch to a ``MANAGED`` flag (for example, for " -"vectorcall or to support Python older than 3.12), specify the offset in :c:" -"member:`Py_tp_members `. See :ref:`PyMemberDef " -"documentation ` for details." -msgstr "" - -#: ../../c-api/type.rst:507 -msgid "The following fields cannot be set at all when creating a heap type:" +"vectorcall or to support Python older than 3.12), specify the offset " +"in :c:member:`Py_tp_members `. " +"See :ref:`PyMemberDef documentation ` for details." msgstr "" -#: ../../c-api/type.rst:509 +#: ../../c-api/type.rst:567 msgid "" -":c:member:`~PyTypeObject.tp_vectorcall` (use :c:member:`~PyTypeObject." -"tp_new` and/or :c:member:`~PyTypeObject.tp_init`)" +"The following internal fields cannot be set at all when creating a heap type:" msgstr "" -#: ../../c-api/type.rst:513 +#: ../../c-api/type.rst:570 msgid "" -"Internal fields: :c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject." -"tp_mro`, :c:member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject." -"tp_subclasses`, and :c:member:`~PyTypeObject.tp_weaklist`." +":c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject.tp_mro`, :c:member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject.tp_subclasses`, " +"and :c:member:`~PyTypeObject.tp_weaklist`." msgstr "" -#: ../../c-api/type.rst:520 +#: ../../c-api/type.rst:576 msgid "" "Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on " -"some platforms. To avoid issues, use the *bases* argument of :c:func:" -"`PyType_FromSpecWithBases` instead." +"some platforms. To avoid issues, use the *bases* argument " +"of :c:func:`PyType_FromSpecWithBases` instead." msgstr "" -#: ../../c-api/type.rst:525 +#: ../../c-api/type.rst:581 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" -#: ../../c-api/type.rst:528 +#: ../../c-api/type.rst:584 +msgid "" +":c:member:`~PyBufferProcs.bf_getbuffer` " +"and :c:member:`~PyBufferProcs.bf_releasebuffer` are now available under " +"the :ref:`limited API `." +msgstr "" + +#: ../../c-api/type.rst:589 msgid "" -":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." -"bf_releasebuffer` are now available under the :ref:`limited API `." +"The field :c:member:`~PyTypeObject.tp_vectorcall` can now set using " +"``Py_tp_vectorcall``. See the field's documentation for details." msgstr "" -#: ../../c-api/type.rst:535 +#: ../../c-api/type.rst:596 msgid "" "The desired value of the slot. In most cases, this is a pointer to a " "function." msgstr "" -#: ../../c-api/type.rst:538 -msgid "Slots other than ``Py_tp_doc`` may not be ``NULL``." +#: ../../c-api/type.rst:599 +msgid "*pfunc* values may not be ``NULL``, except for the following slots:" +msgstr "" + +#: ../../c-api/type.rst:601 +msgid "``Py_tp_doc``" +msgstr "" + +#: ../../c-api/type.rst:602 +msgid "" +":c:data:`Py_tp_token` (for clarity, prefer :c:data:`Py_TP_USE_SPEC` rather " +"than ``NULL``)" +msgstr "" + +#: ../../c-api/type.rst:607 +msgid "" +"A :c:member:`~PyType_Slot.slot` that records a static memory layout ID for a " +"class." +msgstr "" + +#: ../../c-api/type.rst:610 +msgid "" +"If the :c:type:`PyType_Spec` of the class is statically allocated, the token " +"can be set to the spec using the special value :c:data:`Py_TP_USE_SPEC`:" +msgstr "" + +#: ../../c-api/type.rst:614 +msgid "" +"static PyType_Slot foo_slots[] = {\n" +" {Py_tp_token, Py_TP_USE_SPEC}," +msgstr "" + +#: ../../c-api/type.rst:619 +msgid "It can also be set to an arbitrary pointer, but you must ensure that:" +msgstr "" + +#: ../../c-api/type.rst:621 +msgid "" +"The pointer outlives the class, so it's not reused for something else while " +"the class exists." +msgstr "" + +#: ../../c-api/type.rst:623 +msgid "" +"It \"belongs\" to the extension module where the class lives, so it will not " +"clash with other extensions." +msgstr "" + +#: ../../c-api/type.rst:626 +msgid "" +"Use :c:func:`PyType_GetBaseByToken` to check if a class's superclass has a " +"given token -- that is, check whether the memory layout is compatible." +msgstr "" + +#: ../../c-api/type.rst:629 +msgid "" +"To get the token for a given class (without considering superclasses), " +"use :c:func:`PyType_GetSlot` with ``Py_tp_token``." +msgstr "" + +#: ../../c-api/type.rst:638 +msgid "" +"Used as a value with :c:data:`Py_tp_token` to set the token to the " +"class's :c:type:`PyType_Spec`. Expands to ``NULL``." msgstr "" #: ../../c-api/type.rst:8 diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 7751ec68cef..a95f2923a2e 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,8 +45,8 @@ msgstr "" #: ../../c-api/typeobj.rst:23 msgid "" "In addition to the following quick reference, the :ref:`typedef-examples` " -"section provides at-a-glance insight into the meaning and use of :c:type:" -"`PyTypeObject`." +"section provides at-a-glance insight into the meaning and use " +"of :c:type:`PyTypeObject`." msgstr "" #: ../../c-api/typeobj.rst:29 @@ -1181,9 +1181,9 @@ msgstr "" #: ../../c-api/typeobj.rst:476 msgid "" -"The structure definition for :c:type:`PyTypeObject` can be found in :file:" -"`Include/cpython/object.h`. For convenience of reference, this repeats the " -"definition found there:" +"The structure definition for :c:type:`PyTypeObject` can be found " +"in :file:`Include/cpython/object.h`. For convenience of reference, this " +"repeats the definition found there:" msgstr "" #: ../../c-api/typeobj.rst:482 @@ -1244,11 +1244,11 @@ msgid "" " iternextfunc tp_iternext;\n" "\n" " /* Attribute descriptor and subclassing stuff */\n" -" struct PyMethodDef *tp_methods;\n" -" struct PyMemberDef *tp_members;\n" -" struct PyGetSetDef *tp_getset;\n" +" PyMethodDef *tp_methods;\n" +" PyMemberDef *tp_members;\n" +" PyGetSetDef *tp_getset;\n" " // Strong reference on a heap type, borrowed reference on a static type\n" -" struct _typeobject *tp_base;\n" +" PyTypeObject *tp_base;\n" " PyObject *tp_dict;\n" " descrgetfunc tp_descr_get;\n" " descrsetfunc tp_descr_set;\n" @@ -1260,12 +1260,14 @@ msgid "" " inquiry tp_is_gc; /* For PyObject_IS_GC */\n" " PyObject *tp_bases;\n" " PyObject *tp_mro; /* method resolution order */\n" -" PyObject *tp_cache;\n" -" PyObject *tp_subclasses;\n" -" PyObject *tp_weaklist;\n" +" PyObject *tp_cache; /* no longer used */\n" +" void *tp_subclasses; /* for static builtin types this is an index */\n" +" PyObject *tp_weaklist; /* not used for static builtin types */\n" " destructor tp_del;\n" "\n" -" /* Type attribute cache version tag. Added in version 2.6 */\n" +" /* Type attribute cache version tag. Added in version 2.6.\n" +" * If zero, the cache is invalid and must be initialized.\n" +" */\n" " unsigned int tp_version_tag;\n" "\n" " destructor tp_finalize;\n" @@ -1273,6 +1275,13 @@ msgid "" "\n" " /* bitset of which type-watchers care about this type */\n" " unsigned char tp_watched;\n" +"\n" +" /* Number of tp_version_tag values used.\n" +" * Set to _Py_ATTR_CACHE_UNUSED if the attribute cache is\n" +" * disabled for this type (e.g. due to custom MRO entries).\n" +" * Otherwise, limited to MAX_VERSIONS_PER_CLASS (defined elsewhere).\n" +" */\n" +" uint16_t tp_versions_used;\n" "} PyTypeObject;\n" msgstr "" @@ -1282,64 +1291,75 @@ msgstr "" #: ../../c-api/typeobj.rst:488 msgid "" -"The type object structure extends the :c:type:`PyVarObject` structure. The :" -"c:member:`~PyVarObject.ob_size` field is used for dynamic types (created by :" -"c:func:`!type_new`, usually called from a class statement). Note that :c:" -"data:`PyType_Type` (the metatype) initializes :c:member:`~PyTypeObject." -"tp_itemsize`, which means that its instances (i.e. type objects) *must* have " +"The type object structure extends the :c:type:`PyVarObject` structure. " +"The :c:member:`~PyVarObject.ob_size` field is used for dynamic types " +"(created by :c:func:`!type_new`, usually called from a class statement). " +"Note that :c:data:`PyType_Type` (the metatype) " +"initializes :c:member:`~PyTypeObject.tp_itemsize`, which means that its " +"instances (i.e. type objects) *must* have " "the :c:member:`~PyVarObject.ob_size` field." msgstr "" +#: ../../c-api/typeobj.rst:495 +#, fuzzy +msgid ":c:member:`PyObject.ob_refcnt`" +msgstr ":c:member:`~PyTypeObject.tp_repr`" + #: ../../c-api/typeobj.rst:497 msgid "" -"This is the type object's reference count, initialized to ``1`` by the " +"The type object's reference count is initialized to ``1`` by the " "``PyObject_HEAD_INIT`` macro. Note that for :ref:`statically allocated type " -"objects `, the type's instances (objects whose :c:member:" -"`~PyObject.ob_type` points back to the type) do *not* count as references. " -"But for :ref:`dynamically allocated type objects `, the " -"instances *do* count as references." +"objects `, the type's instances (objects " +"whose :c:member:`~PyObject.ob_type` points back to the type) do *not* count " +"as references. But for :ref:`dynamically allocated type objects `, the instances *do* count as references." msgstr "" #: ../../c-api/typeobj.rst:504 ../../c-api/typeobj.rst:527 -#: ../../c-api/typeobj.rst:544 ../../c-api/typeobj.rst:588 -#: ../../c-api/typeobj.rst:666 ../../c-api/typeobj.rst:742 -#: ../../c-api/typeobj.rst:783 ../../c-api/typeobj.rst:800 -#: ../../c-api/typeobj.rst:817 ../../c-api/typeobj.rst:835 -#: ../../c-api/typeobj.rst:859 ../../c-api/typeobj.rst:876 -#: ../../c-api/typeobj.rst:888 ../../c-api/typeobj.rst:900 -#: ../../c-api/typeobj.rst:933 ../../c-api/typeobj.rst:955 -#: ../../c-api/typeobj.rst:975 ../../c-api/typeobj.rst:996 -#: ../../c-api/typeobj.rst:1022 ../../c-api/typeobj.rst:1041 -#: ../../c-api/typeobj.rst:1057 ../../c-api/typeobj.rst:1096 -#: ../../c-api/typeobj.rst:1107 ../../c-api/typeobj.rst:1117 -#: ../../c-api/typeobj.rst:1127 ../../c-api/typeobj.rst:1141 -#: ../../c-api/typeobj.rst:1159 ../../c-api/typeobj.rst:1182 -#: ../../c-api/typeobj.rst:1200 ../../c-api/typeobj.rst:1213 -#: ../../c-api/typeobj.rst:1235 ../../c-api/typeobj.rst:1279 -#: ../../c-api/typeobj.rst:1300 ../../c-api/typeobj.rst:1319 -#: ../../c-api/typeobj.rst:1349 ../../c-api/typeobj.rst:1371 -#: ../../c-api/typeobj.rst:1397 ../../c-api/typeobj.rst:1482 -#: ../../c-api/typeobj.rst:1556 ../../c-api/typeobj.rst:1617 -#: ../../c-api/typeobj.rst:1653 ../../c-api/typeobj.rst:1678 -#: ../../c-api/typeobj.rst:1701 ../../c-api/typeobj.rst:1714 -#: ../../c-api/typeobj.rst:1729 ../../c-api/typeobj.rst:1743 -#: ../../c-api/typeobj.rst:1773 ../../c-api/typeobj.rst:1805 -#: ../../c-api/typeobj.rst:1831 ../../c-api/typeobj.rst:1849 -#: ../../c-api/typeobj.rst:1878 ../../c-api/typeobj.rst:1922 -#: ../../c-api/typeobj.rst:1939 ../../c-api/typeobj.rst:1980 -#: ../../c-api/typeobj.rst:2002 ../../c-api/typeobj.rst:2034 -#: ../../c-api/typeobj.rst:2062 ../../c-api/typeobj.rst:2075 -#: ../../c-api/typeobj.rst:2085 ../../c-api/typeobj.rst:2102 -#: ../../c-api/typeobj.rst:2119 ../../c-api/typeobj.rst:2133 -#: ../../c-api/typeobj.rst:2166 ../../c-api/typeobj.rst:2189 +#: ../../c-api/typeobj.rst:543 ../../c-api/typeobj.rst:587 +#: ../../c-api/typeobj.rst:665 ../../c-api/typeobj.rst:807 +#: ../../c-api/typeobj.rst:852 ../../c-api/typeobj.rst:869 +#: ../../c-api/typeobj.rst:886 ../../c-api/typeobj.rst:904 +#: ../../c-api/typeobj.rst:928 ../../c-api/typeobj.rst:945 +#: ../../c-api/typeobj.rst:957 ../../c-api/typeobj.rst:969 +#: ../../c-api/typeobj.rst:1002 ../../c-api/typeobj.rst:1024 +#: ../../c-api/typeobj.rst:1044 ../../c-api/typeobj.rst:1065 +#: ../../c-api/typeobj.rst:1091 ../../c-api/typeobj.rst:1110 +#: ../../c-api/typeobj.rst:1126 ../../c-api/typeobj.rst:1166 +#: ../../c-api/typeobj.rst:1177 ../../c-api/typeobj.rst:1187 +#: ../../c-api/typeobj.rst:1197 ../../c-api/typeobj.rst:1211 +#: ../../c-api/typeobj.rst:1229 ../../c-api/typeobj.rst:1252 +#: ../../c-api/typeobj.rst:1270 ../../c-api/typeobj.rst:1283 +#: ../../c-api/typeobj.rst:1305 ../../c-api/typeobj.rst:1349 +#: ../../c-api/typeobj.rst:1370 ../../c-api/typeobj.rst:1389 +#: ../../c-api/typeobj.rst:1419 ../../c-api/typeobj.rst:1441 +#: ../../c-api/typeobj.rst:1467 ../../c-api/typeobj.rst:1558 +#: ../../c-api/typeobj.rst:1702 ../../c-api/typeobj.rst:1767 +#: ../../c-api/typeobj.rst:1803 ../../c-api/typeobj.rst:1828 +#: ../../c-api/typeobj.rst:1851 ../../c-api/typeobj.rst:1864 +#: ../../c-api/typeobj.rst:1879 ../../c-api/typeobj.rst:1893 +#: ../../c-api/typeobj.rst:1923 ../../c-api/typeobj.rst:1955 +#: ../../c-api/typeobj.rst:1981 ../../c-api/typeobj.rst:1999 +#: ../../c-api/typeobj.rst:2028 ../../c-api/typeobj.rst:2072 +#: ../../c-api/typeobj.rst:2089 ../../c-api/typeobj.rst:2129 +#: ../../c-api/typeobj.rst:2152 ../../c-api/typeobj.rst:2190 +#: ../../c-api/typeobj.rst:2218 ../../c-api/typeobj.rst:2231 +#: ../../c-api/typeobj.rst:2241 ../../c-api/typeobj.rst:2258 +#: ../../c-api/typeobj.rst:2275 ../../c-api/typeobj.rst:2289 +#: ../../c-api/typeobj.rst:2431 ../../c-api/typeobj.rst:2489 msgid "**Inheritance:**" msgstr "" -#: ../../c-api/typeobj.rst:506 ../../c-api/typeobj.rst:546 -#: ../../c-api/typeobj.rst:590 +#: ../../c-api/typeobj.rst:506 ../../c-api/typeobj.rst:545 +#: ../../c-api/typeobj.rst:589 msgid "This field is not inherited by subtypes." msgstr "" +#: ../../c-api/typeobj.rst:509 +#, fuzzy +msgid ":c:member:`PyObject.ob_type`" +msgstr ":c:member:`~PyTypeObject.tp_new`" + #: ../../c-api/typeobj.rst:511 msgid "" "This is the type's type, in other words its metatype. It is initialized by " @@ -1358,18 +1378,19 @@ msgstr "Foo_Type.ob_type = &PyType_Type;" #: ../../c-api/typeobj.rst:522 msgid "" -"This should be done before any instances of the type are created. :c:func:" -"`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is ``NULL``, and if " -"so, initializes it to the :c:member:`~PyObject.ob_type` field of the base " -"class. :c:func:`PyType_Ready` will not change this field if it is non-zero." +"This should be done before any instances of the type are " +"created. :c:func:`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is " +"``NULL``, and if so, initializes it to the :c:member:`~PyObject.ob_type` " +"field of the base class. :c:func:`PyType_Ready` will not change this field " +"if it is non-zero." msgstr "" -#: ../../c-api/typeobj.rst:529 ../../c-api/typeobj.rst:744 -#: ../../c-api/typeobj.rst:861 ../../c-api/typeobj.rst:957 -#: ../../c-api/typeobj.rst:977 ../../c-api/typeobj.rst:1680 -#: ../../c-api/typeobj.rst:1703 ../../c-api/typeobj.rst:1833 -#: ../../c-api/typeobj.rst:1851 ../../c-api/typeobj.rst:1924 -#: ../../c-api/typeobj.rst:2036 ../../c-api/typeobj.rst:2168 +#: ../../c-api/typeobj.rst:529 ../../c-api/typeobj.rst:809 +#: ../../c-api/typeobj.rst:930 ../../c-api/typeobj.rst:1026 +#: ../../c-api/typeobj.rst:1046 ../../c-api/typeobj.rst:1830 +#: ../../c-api/typeobj.rst:1853 ../../c-api/typeobj.rst:1983 +#: ../../c-api/typeobj.rst:2001 ../../c-api/typeobj.rst:2074 +#: ../../c-api/typeobj.rst:2192 ../../c-api/typeobj.rst:2433 msgid "This field is inherited by subtypes." msgstr "" @@ -1377,6 +1398,11 @@ msgstr "" msgid "PyVarObject Slots" msgstr "" +#: ../../c-api/typeobj.rst:535 +#, fuzzy +msgid ":c:member:`PyVarObject.ob_size`" +msgstr ":c:member:`~PyTypeObject.tp_itemsize`" + #: ../../c-api/typeobj.rst:537 msgid "" "For :ref:`statically allocated type objects `, this should be " @@ -1385,43 +1411,42 @@ msgid "" msgstr "" #: ../../c-api/typeobj.rst:541 -msgid "" -"This field should be accessed using the :c:func:`Py_SIZE()` and :c:func:" -"`Py_SET_SIZE()` macros." +msgid "This field should be accessed using the :c:func:`Py_SIZE()` macro." msgstr "" -#: ../../c-api/typeobj.rst:550 +#: ../../c-api/typeobj.rst:549 msgid "PyTypeObject Slots" msgstr "" -#: ../../c-api/typeobj.rst:552 +#: ../../c-api/typeobj.rst:551 msgid "" "Each slot has a section describing inheritance. If :c:func:`PyType_Ready` " "may set a value when the field is set to ``NULL`` then there will also be a " -"\"Default\" section. (Note that many fields set on :c:data:" -"`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as defaults.)" +"\"Default\" section. (Note that many fields set " +"on :c:data:`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as " +"defaults.)" msgstr "" -#: ../../c-api/typeobj.rst:559 +#: ../../c-api/typeobj.rst:558 msgid "" "Pointer to a NUL-terminated string containing the name of the type. For " "types that are accessible as module globals, the string should be the full " "module name, followed by a dot, followed by the type name; for built-in " "types, it should be just the type name. If the module is a submodule of a " "package, the full package name is part of the full module name. For " -"example, a type named :class:`!T` defined in module :mod:`!M` in subpackage :" -"mod:`!Q` in package :mod:`!P` should have the :c:member:`~PyTypeObject." -"tp_name` initializer ``\"P.Q.M.T\"``." +"example, a type named :class:`!T` defined in module :mod:`!M` in " +"subpackage :mod:`!Q` in package :mod:`!P` should have " +"the :c:member:`~PyTypeObject.tp_name` initializer ``\"P.Q.M.T\"``." msgstr "" -#: ../../c-api/typeobj.rst:567 +#: ../../c-api/typeobj.rst:566 msgid "" "For :ref:`dynamically allocated type objects `, this should just " "be the type name, and the module name explicitly stored in the type dict as " "the value for key ``'__module__'``." msgstr "" -#: ../../c-api/typeobj.rst:572 +#: ../../c-api/typeobj.rst:571 msgid "" "For :ref:`statically allocated type objects `, the *tp_name* " "field should contain a dot. Everything before the last dot is made " @@ -1429,114 +1454,115 @@ msgid "" "the last dot is made accessible as the :attr:`~type.__name__` attribute." msgstr "" -#: ../../c-api/typeobj.rst:578 +#: ../../c-api/typeobj.rst:577 msgid "" "If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is " -"made accessible as the :attr:`~type.__name__` attribute, and the :attr:" -"`~type.__module__` attribute is undefined (unless explicitly set in the " -"dictionary, as explained above). This means your type will be impossible to " -"pickle. Additionally, it will not be listed in module documentations " -"created with pydoc." +"made accessible as the :attr:`~type.__name__` attribute, and " +"the :attr:`~type.__module__` attribute is undefined (unless explicitly set " +"in the dictionary, as explained above). This means your type will be " +"impossible to pickle. Additionally, it will not be listed in module " +"documentations created with pydoc." msgstr "" -#: ../../c-api/typeobj.rst:584 +#: ../../c-api/typeobj.rst:583 msgid "" -"This field must not be ``NULL``. It is the only required field in :c:func:" -"`PyTypeObject` (other than potentially :c:member:`~PyTypeObject." -"tp_itemsize`)." +"This field must not be ``NULL``. It is the only required field " +"in :c:func:`PyTypeObject` (other than " +"potentially :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -#: ../../c-api/typeobj.rst:596 +#: ../../c-api/typeobj.rst:595 msgid "" "These fields allow calculating the size in bytes of instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:598 +#: ../../c-api/typeobj.rst:597 msgid "" -"There are two kinds of types: types with fixed-length instances have a zero :" -"c:member:`!tp_itemsize` field, types with variable-length instances have a " -"non-zero :c:member:`!tp_itemsize` field. For a type with fixed-length " -"instances, all instances have the same size, given in :c:member:`!" -"tp_basicsize`. (Exceptions to this rule can be made using :c:func:" -"`PyUnstable_Object_GC_NewWithExtraData`.)" +"There are two kinds of types: types with fixed-length instances have a " +"zero :c:member:`!tp_itemsize` field, types with variable-length instances " +"have a non-zero :c:member:`!tp_itemsize` field. For a type with fixed-" +"length instances, all instances have the same size, given in :c:member:`!" +"tp_basicsize`. (Exceptions to this rule can be made " +"using :c:func:`PyUnstable_Object_GC_NewWithExtraData`.)" msgstr "" -#: ../../c-api/typeobj.rst:605 +#: ../../c-api/typeobj.rst:604 msgid "" -"For a type with variable-length instances, the instances must have an :c:" -"member:`~PyVarObject.ob_size` field, and the instance size is :c:member:`!" -"tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N is the " -"\"length\" of the object." +"For a type with variable-length instances, the instances must have " +"an :c:member:`~PyVarObject.ob_size` field, and the instance size " +"is :c:member:`!tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N " +"is the \"length\" of the object." msgstr "" -#: ../../c-api/typeobj.rst:610 +#: ../../c-api/typeobj.rst:609 msgid "" "Functions like :c:func:`PyObject_NewVar` will take the value of N as an " "argument, and store in the instance's :c:member:`~PyVarObject.ob_size` " "field. Note that the :c:member:`~PyVarObject.ob_size` field may later be " "used for other purposes. For example, :py:type:`int` instances use the bits " "of :c:member:`~PyVarObject.ob_size` in an implementation-defined way; the " -"underlying storage and its size should be accessed using :c:func:" -"`PyLong_Export`." +"underlying storage and its size should be accessed " +"using :c:func:`PyLong_Export`." msgstr "" -#: ../../c-api/typeobj.rst:620 +#: ../../c-api/typeobj.rst:619 msgid "" -"The :c:member:`~PyVarObject.ob_size` field should be accessed using the :c:" -"func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." +"The :c:member:`~PyVarObject.ob_size` field should be accessed using " +"the :c:func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." msgstr "" -#: ../../c-api/typeobj.rst:623 +#: ../../c-api/typeobj.rst:622 msgid "" "Also, the presence of an :c:member:`~PyVarObject.ob_size` field in the " "instance layout doesn't mean that the instance structure is variable-length. " "For example, the :py:type:`list` type has fixed-length instances, yet those " -"instances have a :c:member:`~PyVarObject.ob_size` field. (As with :py:type:" -"`int`, avoid reading lists' :c:member:`!ob_size` directly. Call :c:func:" -"`PyList_Size` instead.)" +"instances have a :c:member:`~PyVarObject.ob_size` field. (As " +"with :py:type:`int`, avoid reading lists' :c:member:`!ob_size` directly. " +"Call :c:func:`PyList_Size` instead.)" msgstr "" -#: ../../c-api/typeobj.rst:630 +#: ../../c-api/typeobj.rst:629 msgid "" -"The :c:member:`!tp_basicsize` includes size needed for data of the type's :c:" -"member:`~PyTypeObject.tp_base`, plus any extra data needed by each instance." +"The :c:member:`!tp_basicsize` includes size needed for data of the " +"type's :c:member:`~PyTypeObject.tp_base`, plus any extra data needed by each " +"instance." msgstr "" -#: ../../c-api/typeobj.rst:634 +#: ../../c-api/typeobj.rst:633 msgid "" "The correct way to set :c:member:`!tp_basicsize` is to use the ``sizeof`` " "operator on the struct used to declare the instance layout. This struct must " -"include the struct used to declare the base type. In other words, :c:member:" -"`!tp_basicsize` must be greater than or equal to the base's :c:member:`!" -"tp_basicsize`." +"include the struct used to declare the base type. In other " +"words, :c:member:`!tp_basicsize` must be greater than or equal to the " +"base's :c:member:`!tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:640 +#: ../../c-api/typeobj.rst:639 msgid "" "Since every type is a subtype of :py:type:`object`, this struct must " -"include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on whether :c:" -"member:`~PyVarObject.ob_size` should be included). These are usually defined " -"by the macro :c:macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD`, " -"respectively." +"include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on " +"whether :c:member:`~PyVarObject.ob_size` should be included). These are " +"usually defined by the macro :c:macro:`PyObject_HEAD` " +"or :c:macro:`PyObject_VAR_HEAD`, respectively." msgstr "" -#: ../../c-api/typeobj.rst:646 +#: ../../c-api/typeobj.rst:645 msgid "" "The basic size does not include the GC header size, as that header is not " "part of :c:macro:`PyObject_HEAD`." msgstr "" -#: ../../c-api/typeobj.rst:649 +#: ../../c-api/typeobj.rst:648 msgid "" -"For cases where struct used to declare the base type is unknown, see :c:" -"member:`PyType_Spec.basicsize` and :c:func:`PyType_FromMetaclass`." +"For cases where struct used to declare the base type is unknown, " +"see :c:member:`PyType_Spec.basicsize` and :c:func:`PyType_FromMetaclass`." msgstr "" -#: ../../c-api/typeobj.rst:652 +#: ../../c-api/typeobj.rst:651 msgid "Notes about alignment:" msgstr "" -#: ../../c-api/typeobj.rst:654 +#: ../../c-api/typeobj.rst:653 msgid "" ":c:member:`!tp_basicsize` must be a multiple of ``_Alignof(PyObject)``. When " "using ``sizeof`` on a ``struct`` that includes :c:macro:`PyObject_HEAD`, as " @@ -1545,7 +1571,7 @@ msgid "" "you." msgstr "" -#: ../../c-api/typeobj.rst:659 +#: ../../c-api/typeobj.rst:658 msgid "" "If the variable items require a particular alignment, :c:member:`!" "tp_basicsize` and :c:member:`!tp_itemsize` must each be a multiple of that " @@ -1553,14 +1579,14 @@ msgid "" "your responsibility that both fields are a multiple of ``_Alignof(double)``." msgstr "" -#: ../../c-api/typeobj.rst:668 +#: ../../c-api/typeobj.rst:667 msgid "" "These fields are inherited separately by subtypes. (That is, if the field is " "set to zero, :c:func:`PyType_Ready` will copy the value from the base type, " "indicating that the instances do not need additional storage.)" msgstr "" -#: ../../c-api/typeobj.rst:673 +#: ../../c-api/typeobj.rst:672 msgid "" "If the base type has a non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is " "generally not safe to set :c:member:`~PyTypeObject.tp_itemsize` to a " @@ -1568,49 +1594,116 @@ msgid "" "implementation of the base type)." msgstr "" -#: ../../c-api/typeobj.rst:680 +#: ../../c-api/typeobj.rst:679 msgid "" -"A pointer to the instance destructor function. This function must be " -"defined unless the type guarantees that its instances will never be " -"deallocated (as is the case for the singletons ``None`` and ``Ellipsis``). " -"The function signature is::" +"A pointer to the instance destructor function. The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:684 +#: ../../c-api/typeobj.rst:681 msgid "void tp_dealloc(PyObject *self);" msgstr "void tp_dealloc(PyObject *self);" -#: ../../c-api/typeobj.rst:686 +#: ../../c-api/typeobj.rst:683 msgid "" -"The destructor function is called by the :c:func:`Py_DECREF` and :c:func:" -"`Py_XDECREF` macros when the new reference count is zero. At this point, " -"the instance is still in existence, but there are no references to it. The " -"destructor function should free all references which the instance owns, free " -"all memory buffers owned by the instance (using the freeing function " -"corresponding to the allocation function used to allocate the buffer), and " -"call the type's :c:member:`~PyTypeObject.tp_free` function. If the type is " -"not subtypable (doesn't have the :c:macro:`Py_TPFLAGS_BASETYPE` flag bit " -"set), it is permissible to call the object deallocator directly instead of " -"via :c:member:`~PyTypeObject.tp_free`. The object deallocator should be the " -"one used to allocate the instance; this is normally :c:func:`PyObject_Del` " -"if the instance was allocated using :c:macro:`PyObject_New` or :c:macro:" -"`PyObject_NewVar`, or :c:func:`PyObject_GC_Del` if the instance was " -"allocated using :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar`." +"The destructor function should remove all references which the instance owns " +"(e.g., call :c:func:`Py_CLEAR`), free all memory buffers owned by the " +"instance, and call the type's :c:member:`~PyTypeObject.tp_free` function to " +"free the object itself." msgstr "" -#: ../../c-api/typeobj.rst:701 +#: ../../c-api/typeobj.rst:688 msgid "" -"If the type supports garbage collection (has the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit set), the destructor should call :c:func:" -"`PyObject_GC_UnTrack` before clearing any member fields." +"If you may call functions that may set the error indicator, you must " +"use :c:func:`PyErr_GetRaisedException` " +"and :c:func:`PyErr_SetRaisedException` to ensure you don't clobber a " +"preexisting error indicator (the deallocation could have occurred while " +"processing a different error):" msgstr "" -#: ../../c-api/typeobj.rst:705 +#: ../../c-api/typeobj.rst:693 msgid "" -"static void foo_dealloc(foo_object *self) {\n" -" PyObject_GC_UnTrack(self);\n" -" Py_CLEAR(self->ref);\n" -" Py_TYPE(self)->tp_free((PyObject *)self);\n" +"static void\n" +"foo_dealloc(foo_object *self)\n" +"{\n" +" PyObject *et, *ev, *etb;\n" +" PyObject *exc = PyErr_GetRaisedException();\n" +" ...\n" +" PyErr_SetRaisedException(exc);\n" +"}" +msgstr "" + +#: ../../c-api/typeobj.rst:704 +msgid "" +"The dealloc handler itself must not raise an exception; if it hits an error " +"case it should call :c:func:`PyErr_FormatUnraisable` to log (and clear) an " +"unraisable exception." +msgstr "" + +#: ../../c-api/typeobj.rst:708 +msgid "No guarantees are made about when an object is destroyed, except:" +msgstr "" + +#: ../../c-api/typeobj.rst:710 +msgid "" +"Python will destroy an object immediately or some time after the final " +"reference to the object is deleted, unless its finalizer " +"(:c:member:`~PyTypeObject.tp_finalize`) subsequently resurrects the object." +msgstr "" + +#: ../../c-api/typeobj.rst:714 +msgid "" +"An object will not be destroyed while it is being automatically finalized " +"(:c:member:`~PyTypeObject.tp_finalize`) or automatically cleared " +"(:c:member:`~PyTypeObject.tp_clear`)." +msgstr "" + +#: ../../c-api/typeobj.rst:718 +msgid "" +"CPython currently destroys an object immediately from :c:func:`Py_DECREF` " +"when the new reference count is zero, but this may change in a future " +"version." +msgstr "" + +#: ../../c-api/typeobj.rst:722 +msgid "" +"It is recommended to call :c:func:`PyObject_CallFinalizerFromDealloc` at the " +"beginning of :c:member:`!tp_dealloc` to guarantee that the object is always " +"finalized before destruction." +msgstr "" + +#: ../../c-api/typeobj.rst:726 +msgid "" +"If the type supports garbage collection (the :c:macro:`Py_TPFLAGS_HAVE_GC` " +"flag is set), the destructor should call :c:func:`PyObject_GC_UnTrack` " +"before clearing any member fields." +msgstr "" + +#: ../../c-api/typeobj.rst:730 +msgid "" +"It is permissible to call :c:member:`~PyTypeObject.tp_clear` " +"from :c:member:`!tp_dealloc` to reduce code duplication and to guarantee " +"that the object is always cleared before destruction. Beware " +"that :c:member:`!tp_clear` might have already been called." +msgstr "" + +#: ../../c-api/typeobj.rst:735 +msgid "" +"If the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " +"deallocator should release the owned reference to its type object " +"(via :c:func:`Py_DECREF`) after calling the type deallocator. See the " +"example code below.::" +msgstr "" + +#: ../../c-api/typeobj.rst:740 +#, fuzzy +msgid "" +"static void\n" +"foo_dealloc(PyObject *op)\n" +"{\n" +" foo_object *self = (foo_object *) op;\n" +" PyObject_GC_UnTrack(self);\n" +" Py_CLEAR(self->ref);\n" +" Py_TYPE(self)->tp_free(self);\n" "}" msgstr "" "static void foo_dealloc(foo_object *self) {\n" @@ -1619,95 +1712,138 @@ msgstr "" " Py_TYPE(self)->tp_free((PyObject *)self);\n" "}" -#: ../../c-api/typeobj.rst:713 +#: ../../c-api/typeobj.rst:749 msgid "" -"Finally, if the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " -"deallocator should release the owned reference to its type object (via :c:" -"func:`Py_DECREF`) after calling the type deallocator. In order to avoid " -"dangling pointers, the recommended way to achieve this is:" +":c:member:`!tp_dealloc` must leave the exception status unchanged. If it " +"needs to call something that might raise an exception, the exception state " +"must be backed up first and restored later (after logging any exceptions " +"with :c:func:`PyErr_WriteUnraisable`)." msgstr "" -#: ../../c-api/typeobj.rst:719 +#: ../../c-api/typeobj.rst:754 +#, fuzzy +msgid "Example::" +msgstr "範例" + +#: ../../c-api/typeobj.rst:756 msgid "" -"static void foo_dealloc(foo_object *self) {\n" +"static void\n" +"foo_dealloc(PyObject *self)\n" +"{\n" +" PyObject *exc = PyErr_GetRaisedException();\n" +"\n" +" if (PyObject_CallFinalizerFromDealloc(self) < 0) {\n" +" // self was resurrected.\n" +" goto done;\n" +" }\n" +"\n" " PyTypeObject *tp = Py_TYPE(self);\n" -" // free references and buffers here\n" +"\n" +" if (tp->tp_flags & Py_TPFLAGS_HAVE_GC) {\n" +" PyObject_GC_UnTrack(self);\n" +" }\n" +"\n" +" // Optional, but convenient to avoid code duplication.\n" +" if (tp->tp_clear && tp->tp_clear(self) < 0) {\n" +" PyErr_WriteUnraisable(self);\n" +" }\n" +"\n" +" // Any additional destruction goes here.\n" +"\n" " tp->tp_free(self);\n" -" Py_DECREF(tp);\n" +" self = NULL; // In case PyErr_WriteUnraisable() is called below.\n" +"\n" +" if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE) {\n" +" Py_CLEAR(tp);\n" +" }\n" +"\n" +"done:\n" +" // Optional, if something was called that might have raised an\n" +" // exception.\n" +" if (PyErr_Occurred()) {\n" +" PyErr_WriteUnraisable(self);\n" +" }\n" +" PyErr_SetRaisedException(exc);\n" "}" msgstr "" -#: ../../c-api/typeobj.rst:730 +#: ../../c-api/typeobj.rst:795 msgid "" -"In a garbage collected Python, :c:member:`!tp_dealloc` may be called from " -"any Python thread, not just the thread which created the object (if the " -"object becomes part of a refcount cycle, that cycle might be collected by a " -"garbage collection on any thread). This is not a problem for Python API " -"calls, since the thread on which :c:member:`!tp_dealloc` is called will own " -"the Global Interpreter Lock (GIL). However, if the object being destroyed " -"in turn destroys objects from some other C or C++ library, care should be " -"taken to ensure that destroying those objects on the thread which called :c:" -"member:`!tp_dealloc` will not violate any assumptions of the library." +":c:member:`!tp_dealloc` may be called from any Python thread, not just the " +"thread which created the object (if the object becomes part of a refcount " +"cycle, that cycle might be collected by a garbage collection on any " +"thread). This is not a problem for Python API calls, since the thread on " +"which :c:member:`!tp_dealloc` is called with an :term:`attached thread " +"state`. However, if the object being destroyed in turn destroys objects " +"from some other C library, care should be taken to ensure that destroying " +"those objects on the thread which called :c:member:`!tp_dealloc` will not " +"violate any assumptions of the library." msgstr "" -#: ../../c-api/typeobj.rst:749 +#: ../../c-api/typeobj.rst:813 ../../c-api/typeobj.rst:1713 +#: ../../c-api/typeobj.rst:2446 +msgid "" +":ref:`life-cycle` for details about how this slot relates to other slots." +msgstr "" + +#: ../../c-api/typeobj.rst:818 msgid "" "An optional offset to a per-instance function that implements calling the " "object using the :ref:`vectorcall protocol `, a more efficient " "alternative of the simpler :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:754 +#: ../../c-api/typeobj.rst:823 msgid "" "This field is only used if the flag :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` is " "set. If so, this must be a positive integer containing the offset in the " "instance of a :c:type:`vectorcallfunc` pointer." msgstr "" -#: ../../c-api/typeobj.rst:758 +#: ../../c-api/typeobj.rst:827 msgid "" "The *vectorcallfunc* pointer may be ``NULL``, in which case the instance " "behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the " "instance falls back to :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:762 +#: ../../c-api/typeobj.rst:831 msgid "" -"Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also set :c:member:" -"`~PyTypeObject.tp_call` and make sure its behaviour is consistent with the " -"*vectorcallfunc* function. This can be done by setting *tp_call* to :c:func:" -"`PyVectorcall_Call`." +"Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also " +"set :c:member:`~PyTypeObject.tp_call` and make sure its behaviour is " +"consistent with the *vectorcallfunc* function. This can be done by setting " +"*tp_call* to :c:func:`PyVectorcall_Call`." msgstr "" -#: ../../c-api/typeobj.rst:769 +#: ../../c-api/typeobj.rst:838 msgid "" "Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was " "used for printing to a file. In Python 3.0 to 3.7, it was unused." msgstr "" -#: ../../c-api/typeobj.rst:775 +#: ../../c-api/typeobj.rst:844 msgid "" "Before version 3.12, it was not recommended for :ref:`mutable heap types " -"` to implement the vectorcall protocol. When a user sets :attr:" -"`~object.__call__` in Python code, only *tp_call* is updated, likely making " -"it inconsistent with the vectorcall function. Since 3.12, setting " -"``__call__`` will disable vectorcall optimization by clearing the :c:macro:" -"`Py_TPFLAGS_HAVE_VECTORCALL` flag." +"` to implement the vectorcall protocol. When a user " +"sets :attr:`~object.__call__` in Python code, only *tp_call* is updated, " +"likely making it inconsistent with the vectorcall function. Since 3.12, " +"setting ``__call__`` will disable vectorcall optimization by clearing " +"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" -#: ../../c-api/typeobj.rst:785 +#: ../../c-api/typeobj.rst:854 msgid "" -"This field is always inherited. However, the :c:macro:" -"`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, " -"then the subclass won't use :ref:`vectorcall `, except when :c:" -"func:`PyVectorcall_Call` is explicitly called." +"This field is always inherited. However, " +"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If " +"it's not set, then the subclass won't use :ref:`vectorcall `, " +"except when :c:func:`PyVectorcall_Call` is explicitly called." msgstr "" -#: ../../c-api/typeobj.rst:794 +#: ../../c-api/typeobj.rst:863 msgid "An optional pointer to the get-attribute-string function." msgstr "" -#: ../../c-api/typeobj.rst:796 +#: ../../c-api/typeobj.rst:865 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, " @@ -1715,29 +1851,28 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:802 ../../c-api/typeobj.rst:998 -msgid "" -"Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject." -"tp_getattro`" +#: ../../c-api/typeobj.rst:871 ../../c-api/typeobj.rst:1067 +msgid "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject.tp_getattro`" msgstr "" -"群組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject." -"tp_getattro`" +"群" +"組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject.tp_getattro`" -#: ../../c-api/typeobj.rst:804 +#: ../../c-api/typeobj.rst:873 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_getattro`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." -"tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` " +"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:811 ../../c-api/typeobj.rst:1011 +#: ../../c-api/typeobj.rst:880 ../../c-api/typeobj.rst:1080 msgid "" "An optional pointer to the function for setting and deleting attributes." msgstr "" -#: ../../c-api/typeobj.rst:813 +#: ../../c-api/typeobj.rst:882 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, " @@ -1745,55 +1880,54 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:819 ../../c-api/typeobj.rst:1024 -msgid "" -"Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject." -"tp_setattro`" +#: ../../c-api/typeobj.rst:888 ../../c-api/typeobj.rst:1093 +msgid "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject.tp_setattro`" msgstr "" -"群組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject." -"tp_setattro`" +"群" +"組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject.tp_setattro`" -#: ../../c-api/typeobj.rst:821 +#: ../../c-api/typeobj.rst:890 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_setattro`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." -"tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` " +"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:828 +#: ../../c-api/typeobj.rst:897 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement :term:`awaitable` and :term:`asynchronous iterator` " "protocols at the C-level. See :ref:`async-structs` for details." msgstr "" -#: ../../c-api/typeobj.rst:832 +#: ../../c-api/typeobj.rst:901 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." msgstr "" -#: ../../c-api/typeobj.rst:837 +#: ../../c-api/typeobj.rst:906 msgid "" "The :c:member:`~PyTypeObject.tp_as_async` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:845 +#: ../../c-api/typeobj.rst:914 msgid "" -"An optional pointer to a function that implements the built-in function :" -"func:`repr`." +"An optional pointer to a function that implements the built-in " +"function :func:`repr`." msgstr "" -#: ../../c-api/typeobj.rst:848 +#: ../../c-api/typeobj.rst:917 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" msgstr "" -#: ../../c-api/typeobj.rst:850 +#: ../../c-api/typeobj.rst:919 msgid "PyObject *tp_repr(PyObject *self);" msgstr "PyObject *tp_repr(PyObject *self);" -#: ../../c-api/typeobj.rst:852 +#: ../../c-api/typeobj.rst:921 msgid "" "The function must return a string or a Unicode object. Ideally, this " "function should return a string that, when passed to :func:`eval`, given a " @@ -1802,153 +1936,152 @@ msgid "" "``'>'`` from which both the type and the value of the object can be deduced." msgstr "" -#: ../../c-api/typeobj.rst:863 ../../c-api/typeobj.rst:942 -#: ../../c-api/typeobj.rst:979 ../../c-api/typeobj.rst:1004 -#: ../../c-api/typeobj.rst:1030 ../../c-api/typeobj.rst:1071 -#: ../../c-api/typeobj.rst:1626 ../../c-api/typeobj.rst:1660 -#: ../../c-api/typeobj.rst:1777 ../../c-api/typeobj.rst:1810 -#: ../../c-api/typeobj.rst:1885 ../../c-api/typeobj.rst:1926 -#: ../../c-api/typeobj.rst:1944 ../../c-api/typeobj.rst:1986 -#: ../../c-api/typeobj.rst:2007 ../../c-api/typeobj.rst:2038 +#: ../../c-api/typeobj.rst:932 ../../c-api/typeobj.rst:1011 +#: ../../c-api/typeobj.rst:1048 ../../c-api/typeobj.rst:1073 +#: ../../c-api/typeobj.rst:1099 ../../c-api/typeobj.rst:1141 +#: ../../c-api/typeobj.rst:1776 ../../c-api/typeobj.rst:1810 +#: ../../c-api/typeobj.rst:1927 ../../c-api/typeobj.rst:1960 +#: ../../c-api/typeobj.rst:2035 ../../c-api/typeobj.rst:2076 +#: ../../c-api/typeobj.rst:2096 ../../c-api/typeobj.rst:2135 +#: ../../c-api/typeobj.rst:2163 ../../c-api/typeobj.rst:2194 msgid "**Default:**" msgstr "**預設:**" -#: ../../c-api/typeobj.rst:865 +#: ../../c-api/typeobj.rst:934 msgid "" "When this field is not set, a string of the form ``<%s object at %p>`` is " "returned, where ``%s`` is replaced by the type name, and ``%p`` by the " "object's memory address." msgstr "" -#: ../../c-api/typeobj.rst:872 +#: ../../c-api/typeobj.rst:941 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the number protocol. These fields are documented " "in :ref:`number-structs`." msgstr "" -#: ../../c-api/typeobj.rst:878 +#: ../../c-api/typeobj.rst:947 msgid "" "The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:884 +#: ../../c-api/typeobj.rst:953 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the sequence protocol. These fields are documented " "in :ref:`sequence-structs`." msgstr "" -#: ../../c-api/typeobj.rst:890 +#: ../../c-api/typeobj.rst:959 msgid "" "The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:896 +#: ../../c-api/typeobj.rst:965 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the mapping protocol. These fields are documented " "in :ref:`mapping-structs`." msgstr "" -#: ../../c-api/typeobj.rst:902 +#: ../../c-api/typeobj.rst:971 msgid "" "The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:910 +#: ../../c-api/typeobj.rst:979 msgid "" -"An optional pointer to a function that implements the built-in function :" -"func:`hash`." +"An optional pointer to a function that implements the built-in " +"function :func:`hash`." msgstr "" -#: ../../c-api/typeobj.rst:913 +#: ../../c-api/typeobj.rst:982 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" msgstr "" -#: ../../c-api/typeobj.rst:915 +#: ../../c-api/typeobj.rst:984 msgid "Py_hash_t tp_hash(PyObject *);" msgstr "Py_hash_t tp_hash(PyObject *);" -#: ../../c-api/typeobj.rst:917 +#: ../../c-api/typeobj.rst:986 msgid "" "The value ``-1`` should not be returned as a normal return value; when an " "error occurs during the computation of the hash value, the function should " "set an exception and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:921 +#: ../../c-api/typeobj.rst:990 msgid "" "When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` " -"is not set), an attempt to take the hash of the object raises :exc:" -"`TypeError`. This is the same as setting it to :c:func:" -"`PyObject_HashNotImplemented`." +"is not set), an attempt to take the hash of the object " +"raises :exc:`TypeError`. This is the same as setting it " +"to :c:func:`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:925 +#: ../../c-api/typeobj.rst:994 msgid "" "This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to " "block inheritance of the hash method from a parent type. This is interpreted " "as the equivalent of ``__hash__ = None`` at the Python level, causing " "``isinstance(o, collections.Hashable)`` to correctly return ``False``. Note " "that the converse is also true - setting ``__hash__ = None`` on a class at " -"the Python level will result in the ``tp_hash`` slot being set to :c:func:" -"`PyObject_HashNotImplemented`." +"the Python level will result in the ``tp_hash`` slot being set " +"to :c:func:`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:935 ../../c-api/typeobj.rst:1619 -msgid "" -"Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." -"tp_richcompare`" +#: ../../c-api/typeobj.rst:1004 ../../c-api/typeobj.rst:1769 +msgid "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject.tp_richcompare`" msgstr "" -"群組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject." -"tp_richcompare`" +"群" +"組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject.tp_richcompare`" -#: ../../c-api/typeobj.rst:937 +#: ../../c-api/typeobj.rst:1006 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." -"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash`, when the subtype's :c:" -"member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` " -"are both ``NULL``." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_richcompare`: a subtype inherits both " +"of :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash`, when the " +"subtype's :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:944 +#: ../../c-api/typeobj.rst:1013 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." msgstr "" -#: ../../c-api/typeobj.rst:949 +#: ../../c-api/typeobj.rst:1018 msgid "" "An optional pointer to a function that implements calling the object. This " "should be ``NULL`` if the object is not callable. The signature is the same " "as for :c:func:`PyObject_Call`::" msgstr "" -#: ../../c-api/typeobj.rst:953 +#: ../../c-api/typeobj.rst:1022 msgid "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" msgstr "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" -#: ../../c-api/typeobj.rst:962 +#: ../../c-api/typeobj.rst:1031 msgid "" -"An optional pointer to a function that implements the built-in operation :" -"func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls " -"the constructor for that type. This constructor calls :c:func:" -"`PyObject_Str` to do the actual work, and :c:func:`PyObject_Str` will call " -"this handler.)" +"An optional pointer to a function that implements the built-in " +"operation :func:`str`. (Note that :class:`str` is a type now, " +"and :func:`str` calls the constructor for that type. This constructor " +"calls :c:func:`PyObject_Str` to do the actual work, " +"and :c:func:`PyObject_Str` will call this handler.)" msgstr "" -#: ../../c-api/typeobj.rst:967 +#: ../../c-api/typeobj.rst:1036 msgid "The signature is the same as for :c:func:`PyObject_Str`::" msgstr "" -#: ../../c-api/typeobj.rst:969 +#: ../../c-api/typeobj.rst:1038 msgid "PyObject *tp_str(PyObject *self);" msgstr "PyObject *tp_str(PyObject *self);" -#: ../../c-api/typeobj.rst:971 +#: ../../c-api/typeobj.rst:1040 msgid "" "The function must return a string or a Unicode object. It should be a " "\"friendly\" string representation of the object, as this is the " @@ -1956,99 +2089,101 @@ msgid "" "function." msgstr "" -#: ../../c-api/typeobj.rst:981 +#: ../../c-api/typeobj.rst:1050 msgid "" "When this field is not set, :c:func:`PyObject_Repr` is called to return a " "string representation." msgstr "" -#: ../../c-api/typeobj.rst:987 +#: ../../c-api/typeobj.rst:1056 msgid "An optional pointer to the get-attribute function." msgstr "" -#: ../../c-api/typeobj.rst:989 +#: ../../c-api/typeobj.rst:1058 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:991 +#: ../../c-api/typeobj.rst:1060 msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" msgstr "PyObject *tp_getattro(PyObject *self, PyObject *attr);" -#: ../../c-api/typeobj.rst:993 +#: ../../c-api/typeobj.rst:1062 msgid "" -"It is usually convenient to set this field to :c:func:" -"`PyObject_GenericGetAttr`, which implements the normal way of looking for " -"object attributes." +"It is usually convenient to set this field " +"to :c:func:`PyObject_GenericGetAttr`, which implements the normal way of " +"looking for object attributes." msgstr "" -#: ../../c-api/typeobj.rst:1000 +#: ../../c-api/typeobj.rst:1069 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_getattr`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." -"tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` " +"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1006 +#: ../../c-api/typeobj.rst:1075 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1013 +#: ../../c-api/typeobj.rst:1082 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:1015 +#: ../../c-api/typeobj.rst:1084 msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" msgstr "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" -#: ../../c-api/typeobj.rst:1017 +#: ../../c-api/typeobj.rst:1086 msgid "" "In addition, setting *value* to ``NULL`` to delete an attribute must be " -"supported. It is usually convenient to set this field to :c:func:" -"`PyObject_GenericSetAttr`, which implements the normal way of setting object " -"attributes." +"supported. It is usually convenient to set this field " +"to :c:func:`PyObject_GenericSetAttr`, which implements the normal way of " +"setting object attributes." msgstr "" -#: ../../c-api/typeobj.rst:1026 +#: ../../c-api/typeobj.rst:1095 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_setattr`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." -"tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` " +"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1032 +#: ../../c-api/typeobj.rst:1101 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1037 +#: ../../c-api/typeobj.rst:1106 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the buffer interface. These fields are documented " "in :ref:`buffer-structs`." msgstr "" -#: ../../c-api/typeobj.rst:1043 +#: ../../c-api/typeobj.rst:1112 msgid "" "The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:1049 +#: ../../c-api/typeobj.rst:1118 msgid "" "This field is a bit mask of various flags. Some flags indicate variant " "semantics for certain situations; others are used to indicate that certain " -"fields in the type object (or in the extension structures referenced via :c:" -"member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject." -"tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, and :c:member:" -"`~PyTypeObject.tp_as_buffer`) that were historically not always present are " -"valid; if such a flag bit is clear, the type fields it guards must not be " -"accessed and must be considered to have a zero or ``NULL`` value instead." +"fields in the type object (or in the extension structures referenced " +"via :c:member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject.tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, " +"and :c:member:`~PyTypeObject.tp_as_buffer`) that were historically not " +"always present are valid; if such a flag bit is clear, the type fields it " +"guards must not be accessed and must be considered to have a zero or " +"``NULL`` value instead." msgstr "" -#: ../../c-api/typeobj.rst:1059 +#: ../../c-api/typeobj.rst:1128 msgid "" "Inheritance of this field is complicated. Most flag bits are inherited " "individually, i.e. if the base type has a flag bit set, the subtype inherits " @@ -2057,14 +2192,14 @@ msgid "" "type's value of the flag bit is copied into the subtype together with a " "pointer to the extension structure. The :c:macro:`Py_TPFLAGS_HAVE_GC` flag " "bit is inherited together with the :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and the :c:member:" -"`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields in " -"the subtype exist and have ``NULL`` values. .. XXX are most flag bits " -"*really* inherited individually?" +"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " +"the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " +"``NULL`` values." msgstr "" -#: ../../c-api/typeobj.rst:1073 +#: ../../c-api/typeobj.rst:1143 msgid "" ":c:data:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``." @@ -2072,20 +2207,20 @@ msgstr "" ":c:data:`PyBaseObject_Type` 使用 ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``。" -#: ../../c-api/typeobj.rst:1076 +#: ../../c-api/typeobj.rst:1146 msgid "**Bit Masks:**" msgstr "" -#: ../../c-api/typeobj.rst:1080 +#: ../../c-api/typeobj.rst:1150 msgid "" "The following bit masks are currently defined; these can be ORed together " -"using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." -"tp_flags` field. The macro :c:func:`PyType_HasFeature` takes a type and a " -"flags value, *tp* and *f*, and checks whether ``tp->tp_flags & f`` is non-" -"zero." +"using the ``|`` operator to form the value of " +"the :c:member:`~PyTypeObject.tp_flags` field. The " +"macro :c:func:`PyType_HasFeature` takes a type and a flags value, *tp* and " +"*f*, and checks whether ``tp->tp_flags & f`` is non-zero." msgstr "" -#: ../../c-api/typeobj.rst:1087 +#: ../../c-api/typeobj.rst:1157 msgid "" "This bit is set when the type object itself is allocated on the heap, for " "example, types created dynamically using :c:func:`PyType_FromSpec`. In this " @@ -2093,256 +2228,258 @@ msgid "" "a reference to the type, and the type object is INCREF'ed when a new " "instance is created, and DECREF'ed when an instance is destroyed (this does " "not apply to instances of subtypes; only the type referenced by the " -"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should also :ref:" -"`support garbage collection ` as they can form a " -"reference cycle with their own module object." +"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should " +"also :ref:`support garbage collection ` as they " +"can form a reference cycle with their own module object." msgstr "" -#: ../../c-api/typeobj.rst:1098 ../../c-api/typeobj.rst:1109 -#: ../../c-api/typeobj.rst:1119 ../../c-api/typeobj.rst:1129 -#: ../../c-api/typeobj.rst:1161 +#: ../../c-api/typeobj.rst:1168 ../../c-api/typeobj.rst:1179 +#: ../../c-api/typeobj.rst:1189 ../../c-api/typeobj.rst:1199 +#: ../../c-api/typeobj.rst:1231 msgid "???" msgstr "???" -#: ../../c-api/typeobj.rst:1103 +#: ../../c-api/typeobj.rst:1173 msgid "" "This bit is set when the type can be used as the base type of another type. " "If this bit is clear, the type cannot be subtyped (similar to a \"final\" " "class in Java)." msgstr "" -#: ../../c-api/typeobj.rst:1114 +#: ../../c-api/typeobj.rst:1184 msgid "" -"This bit is set when the type object has been fully initialized by :c:func:" -"`PyType_Ready`." +"This bit is set when the type object has been fully initialized " +"by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1124 +#: ../../c-api/typeobj.rst:1194 msgid "" "This bit is set while :c:func:`PyType_Ready` is in the process of " "initializing the type object." msgstr "" -#: ../../c-api/typeobj.rst:1134 +#: ../../c-api/typeobj.rst:1204 msgid "" "This bit is set when the object supports garbage collection. If this bit is " -"set, instances must be created using :c:macro:`PyObject_GC_New` and " -"destroyed using :c:func:`PyObject_GC_Del`. More information in section :ref:" -"`supporting-cycle-detection`. This bit also implies that the GC-related " -"fields :c:member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject." -"tp_clear` are present in the type object." +"set, memory for new instances (see :c:member:`~PyTypeObject.tp_alloc`) must " +"be allocated using :c:macro:`PyObject_GC_New` " +"or :c:func:`PyType_GenericAlloc` and deallocated " +"(see :c:member:`~PyTypeObject.tp_free`) using :c:func:`PyObject_GC_Del`. " +"More information in section :ref:`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1143 ../../c-api/typeobj.rst:1484 -#: ../../c-api/typeobj.rst:1558 -msgid "" -"Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." -"tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" +#: ../../c-api/typeobj.rst:1213 ../../c-api/typeobj.rst:1560 +#: ../../c-api/typeobj.rst:1704 +msgid "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject.tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" -#: ../../c-api/typeobj.rst:1145 +#: ../../c-api/typeobj.rst:1215 msgid "" -"The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:" -"member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` " -"fields, i.e. if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the " -"subtype and the :c:member:`~PyTypeObject.tp_traverse` and :c:member:" -"`~PyTypeObject.tp_clear` fields in the subtype exist and have ``NULL`` " -"values." +"The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with " +"the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " +"the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " +"``NULL`` values." msgstr "" -#: ../../c-api/typeobj.rst:1155 +#: ../../c-api/typeobj.rst:1225 msgid "" "This is a bitmask of all the bits that pertain to the existence of certain " "fields in the type object and its extension structures. Currently, it " "includes the following bits: :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." msgstr "" -#: ../../c-api/typeobj.rst:1166 +#: ../../c-api/typeobj.rst:1236 msgid "This bit indicates that objects behave like unbound methods." msgstr "" -#: ../../c-api/typeobj.rst:1168 +#: ../../c-api/typeobj.rst:1238 msgid "If this flag is set for ``type(meth)``, then:" msgstr "" -#: ../../c-api/typeobj.rst:1170 +#: ../../c-api/typeobj.rst:1240 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1173 +#: ../../c-api/typeobj.rst:1243 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1176 +#: ../../c-api/typeobj.rst:1246 msgid "" -"This flag enables an optimization for typical method calls like ``obj." -"meth()``: it avoids creating a temporary \"bound method\" object for ``obj." -"meth``." +"This flag enables an optimization for typical method calls like " +"``obj.meth()``: it avoids creating a temporary \"bound method\" object for " +"``obj.meth``." msgstr "" -#: ../../c-api/typeobj.rst:1184 +#: ../../c-api/typeobj.rst:1254 msgid "" -"This flag is never inherited by types without the :c:macro:" -"`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited " -"whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." +"This flag is never inherited by types without " +"the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it " +"is inherited whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1190 +#: ../../c-api/typeobj.rst:1260 msgid "" -"This bit indicates that instances of the class have a :attr:`~object." -"__dict__` attribute, and that the space for the dictionary is managed by the " -"VM." +"This bit indicates that instances of the class have " +"a :attr:`~object.__dict__` attribute, and that the space for the dictionary " +"is managed by the VM." msgstr "" -#: ../../c-api/typeobj.rst:1193 +#: ../../c-api/typeobj.rst:1263 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." msgstr "" -#: ../../c-api/typeobj.rst:1195 +#: ../../c-api/typeobj.rst:1265 msgid "" "The type traverse function must call :c:func:`PyObject_VisitManagedDict` and " "its clear function must call :c:func:`PyObject_ClearManagedDict`." msgstr "" -#: ../../c-api/typeobj.rst:1202 +#: ../../c-api/typeobj.rst:1272 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject.tp_dictoffset` " "field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1208 +#: ../../c-api/typeobj.rst:1278 msgid "" "This bit indicates that instances of the class should be weakly " "referenceable." msgstr "" -#: ../../c-api/typeobj.rst:1215 +#: ../../c-api/typeobj.rst:1285 msgid "" -"This flag is inherited unless the :c:member:`~PyTypeObject." -"tp_weaklistoffset` field is set in a superclass." +"This flag is inherited unless " +"the :c:member:`~PyTypeObject.tp_weaklistoffset` field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1221 +#: ../../c-api/typeobj.rst:1291 msgid "" -"Only usable with variable-size types, i.e. ones with non-zero :c:member:" -"`~PyTypeObject.tp_itemsize`." +"Only usable with variable-size types, i.e. ones with non-" +"zero :c:member:`~PyTypeObject.tp_itemsize`." msgstr "" -#: ../../c-api/typeobj.rst:1224 +#: ../../c-api/typeobj.rst:1294 msgid "" "Indicates that the variable-sized portion of an instance of this type is at " "the end of the instance's memory area, at an offset of ``Py_TYPE(obj)-" ">tp_basicsize`` (which may be different in each subclass)." msgstr "" -#: ../../c-api/typeobj.rst:1229 +#: ../../c-api/typeobj.rst:1299 msgid "" "When setting this flag, be sure that all superclasses either use this memory " "layout, or are not variable-sized. Python does not check this." msgstr "" -#: ../../c-api/typeobj.rst:1237 +#: ../../c-api/typeobj.rst:1307 msgid "This flag is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1251 +#: ../../c-api/typeobj.rst:1321 msgid "" "These flags are used by functions such as :c:func:`PyLong_Check` to quickly " "determine if a type is a subclass of a built-in type; such specific checks " "are faster than a generic check, like :c:func:`PyObject_IsInstance`. Custom " -"types that inherit from built-ins should have their :c:member:`~PyTypeObject." -"tp_flags` set appropriately, or the code that interacts with such types will " -"behave differently depending on what kind of check is used." +"types that inherit from built-ins should have " +"their :c:member:`~PyTypeObject.tp_flags` set appropriately, or the code that " +"interacts with such types will behave differently depending on what kind of " +"check is used." msgstr "" -#: ../../c-api/typeobj.rst:1262 +#: ../../c-api/typeobj.rst:1332 msgid "" "This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is " "present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1267 +#: ../../c-api/typeobj.rst:1337 msgid "" -"This flag isn't necessary anymore, as the interpreter assumes the :c:member:" -"`~PyTypeObject.tp_finalize` slot is always present in the type structure." +"This flag isn't necessary anymore, as the interpreter assumes " +"the :c:member:`~PyTypeObject.tp_finalize` slot is always present in the type " +"structure." msgstr "" -#: ../../c-api/typeobj.rst:1275 +#: ../../c-api/typeobj.rst:1345 msgid "" "This bit is set when the class implements the :ref:`vectorcall protocol " "`. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for " "details." msgstr "" -#: ../../c-api/typeobj.rst:1281 +#: ../../c-api/typeobj.rst:1351 msgid "" "This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also inherited." msgstr "" -#: ../../c-api/typeobj.rst:1288 +#: ../../c-api/typeobj.rst:1358 msgid "" -"This flag is now removed from a class when the class's :py:meth:`~object." -"__call__` method is reassigned." +"This flag is now removed from a class when the " +"class's :py:meth:`~object.__call__` method is reassigned." msgstr "" -#: ../../c-api/typeobj.rst:1291 +#: ../../c-api/typeobj.rst:1361 msgid "This flag can now be inherited by mutable classes." msgstr "" -#: ../../c-api/typeobj.rst:1295 +#: ../../c-api/typeobj.rst:1365 msgid "" "This bit is set for type objects that are immutable: type attributes cannot " "be set nor deleted." msgstr "" -#: ../../c-api/typeobj.rst:1297 +#: ../../c-api/typeobj.rst:1367 msgid "" ":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types " "`." msgstr "" -#: ../../c-api/typeobj.rst:1302 +#: ../../c-api/typeobj.rst:1372 msgid "This flag is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:1308 +#: ../../c-api/typeobj.rst:1378 msgid "" -"Disallow creating instances of the type: set :c:member:`~PyTypeObject." -"tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." +"Disallow creating instances of the type: " +"set :c:member:`~PyTypeObject.tp_new` to NULL and don't create the " +"``__new__`` key in the type dictionary." msgstr "" -#: ../../c-api/typeobj.rst:1312 +#: ../../c-api/typeobj.rst:1382 msgid "" "The flag must be set before creating the type, not after. For example, it " "must be set before :c:func:`PyType_Ready` is called on the type." msgstr "" -#: ../../c-api/typeobj.rst:1315 +#: ../../c-api/typeobj.rst:1385 msgid "" -"The flag is set automatically on :ref:`static types ` if :c:" -"member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:" -"member:`~PyTypeObject.tp_new` is NULL." +"The flag is set automatically on :ref:`static types ` " +"if :c:member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` " +"and :c:member:`~PyTypeObject.tp_new` is NULL." msgstr "" -#: ../../c-api/typeobj.rst:1321 +#: ../../c-api/typeobj.rst:1391 msgid "" "This flag is not inherited. However, subclasses will not be instantiable " "unless they provide a non-NULL :c:member:`~PyTypeObject.tp_new` (which is " "only possible via the C API)." msgstr "" -#: ../../c-api/typeobj.rst:1328 +#: ../../c-api/typeobj.rst:1398 msgid "" "To disallow instantiating a class directly but allow instantiating its " "subclasses (e.g. for an :term:`abstract base class`), do not use this flag. " "Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1339 +#: ../../c-api/typeobj.rst:1409 msgid "" "This bit indicates that instances of the class may match mapping patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2350,23 +2487,23 @@ msgid "" "unset when registering :class:`collections.abc.Sequence`." msgstr "" -#: ../../c-api/typeobj.rst:1346 ../../c-api/typeobj.rst:1368 +#: ../../c-api/typeobj.rst:1416 ../../c-api/typeobj.rst:1438 msgid "" ":c:macro:`Py_TPFLAGS_MAPPING` and :c:macro:`Py_TPFLAGS_SEQUENCE` are " "mutually exclusive; it is an error to enable both flags simultaneously." msgstr "" -#: ../../c-api/typeobj.rst:1351 +#: ../../c-api/typeobj.rst:1421 msgid "" -"This flag is inherited by types that do not already set :c:macro:" -"`Py_TPFLAGS_SEQUENCE`." +"This flag is inherited by types that do not already " +"set :c:macro:`Py_TPFLAGS_SEQUENCE`." msgstr "" -#: ../../c-api/typeobj.rst:1354 ../../c-api/typeobj.rst:1376 +#: ../../c-api/typeobj.rst:1424 ../../c-api/typeobj.rst:1446 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../c-api/typeobj.rst:1361 +#: ../../c-api/typeobj.rst:1431 msgid "" "This bit indicates that instances of the class may match sequence patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2374,67 +2511,69 @@ msgid "" "unset when registering :class:`collections.abc.Mapping`." msgstr "" -#: ../../c-api/typeobj.rst:1373 +#: ../../c-api/typeobj.rst:1443 msgid "" -"This flag is inherited by types that do not already set :c:macro:" -"`Py_TPFLAGS_MAPPING`." +"This flag is inherited by types that do not already " +"set :c:macro:`Py_TPFLAGS_MAPPING`." msgstr "" -#: ../../c-api/typeobj.rst:1383 +#: ../../c-api/typeobj.rst:1453 msgid "" "Internal. Do not set or unset this flag. To indicate that a class has " "changed call :c:func:`PyType_Modified`" msgstr "" -#: ../../c-api/typeobj.rst:1387 +#: ../../c-api/typeobj.rst:1457 msgid "" "This flag is present in header files, but is not be used. It will be removed " "in a future version of CPython" msgstr "" -#: ../../c-api/typeobj.rst:1393 +#: ../../c-api/typeobj.rst:1463 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " "this type object. This is exposed as the :attr:`~type.__doc__` attribute on " "the type and instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:1399 +#: ../../c-api/typeobj.rst:1469 msgid "This field is *not* inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:1404 +#: ../../c-api/typeobj.rst:1474 msgid "" "An optional pointer to a traversal function for the garbage collector. This " "is only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1407 +#: ../../c-api/typeobj.rst:1477 msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" msgstr "int tp_traverse(PyObject *self, visitproc visit, void *arg);" -#: ../../c-api/typeobj.rst:1409 ../../c-api/typeobj.rst:1553 +#: ../../c-api/typeobj.rst:1479 ../../c-api/typeobj.rst:1699 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1412 +#: ../../c-api/typeobj.rst:1482 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " -"collector to detect reference cycles. A typical implementation of a :c:" -"member:`~PyTypeObject.tp_traverse` function simply calls :c:func:`Py_VISIT` " -"on each of the instance's members that are Python objects that the instance " -"owns. For example, this is function :c:func:`!local_traverse` from the :mod:" -"`!_thread` extension module::" +"collector to detect reference cycles. A typical implementation of " +"a :c:member:`~PyTypeObject.tp_traverse` function simply " +"calls :c:func:`Py_VISIT` on each of the instance's members that are Python " +"objects that the instance owns. For example, this is function :c:func:`!" +"local_traverse` from the :mod:`!_thread` extension module::" msgstr "" -#: ../../c-api/typeobj.rst:1418 +#: ../../c-api/typeobj.rst:1488 +#, fuzzy msgid "" "static int\n" -"local_traverse(localobject *self, visitproc visit, void *arg)\n" +"local_traverse(PyObject *op, visitproc visit, void *arg)\n" "{\n" +" localobject *self = (localobject *) op;\n" " Py_VISIT(self->args);\n" " Py_VISIT(self->kw);\n" " Py_VISIT(self->dict);\n" @@ -2450,7 +2589,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1427 +#: ../../c-api/typeobj.rst:1498 msgid "" "Note that :c:func:`Py_VISIT` is called only on those members that can " "participate in reference cycles. Although there is also a ``self->key`` " @@ -2458,29 +2597,29 @@ msgid "" "part of a reference cycle." msgstr "" -#: ../../c-api/typeobj.rst:1431 +#: ../../c-api/typeobj.rst:1502 msgid "" "On the other hand, even if you know a member can never be part of a cycle, " "as a debugging aid you may want to visit it anyway just so the :mod:`gc` " "module's :func:`~gc.get_referents` function will include it." msgstr "" -#: ../../c-api/typeobj.rst:1435 +#: ../../c-api/typeobj.rst:1506 msgid "" "Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" msgstr "" -#: ../../c-api/typeobj.rst:1437 +#: ../../c-api/typeobj.rst:1508 msgid "Py_VISIT(Py_TYPE(self));" msgstr "Py_VISIT(Py_TYPE(self));" -#: ../../c-api/typeobj.rst:1439 +#: ../../c-api/typeobj.rst:1510 msgid "" "It is only needed since Python 3.9. To support Python 3.8 and older, this " "line must be conditional::" msgstr "" -#: ../../c-api/typeobj.rst:1442 +#: ../../c-api/typeobj.rst:1513 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " Py_VISIT(Py_TYPE(self));\n" @@ -2490,18 +2629,18 @@ msgstr "" " Py_VISIT(Py_TYPE(self));\n" "#endif" -#: ../../c-api/typeobj.rst:1446 +#: ../../c-api/typeobj.rst:1517 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" -"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" -"`PyObject_VisitManagedDict` like this::" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, the traverse function must " +"call :c:func:`PyObject_VisitManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1450 +#: ../../c-api/typeobj.rst:1521 msgid "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" msgstr "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" -#: ../../c-api/typeobj.rst:1453 +#: ../../c-api/typeobj.rst:1524 msgid "" "When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members " "that the instance *owns* (by having :term:`strong references ` hold a reference to " -"their type. Their traversal function must therefore either visit :c:func:" -"`Py_TYPE(self) `, or delegate this responsibility by calling " -"``tp_traverse`` of another heap-allocated type (such as a heap-allocated " -"superclass). If they do not, the type object may not be garbage-collected." +"their type. Their traversal function must therefore either " +"visit :c:func:`Py_TYPE(self) `, or delegate this responsibility by " +"calling ``tp_traverse`` of another heap-allocated type (such as a heap-" +"allocated superclass). If they do not, the type object may not be garbage-" +"collected." msgstr "" -#: ../../c-api/typeobj.rst:1477 +#: ../../c-api/typeobj.rst:1548 +#, fuzzy +msgid "" +"The :c:member:`~PyTypeObject.tp_traverse` function can be called from any " +"thread." +msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" + +#: ../../c-api/typeobj.rst:1553 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1486 +#: ../../c-api/typeobj.rst:1562 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" -"member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " -"are all inherited from the base type if they are all zero in the subtype." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_clear` and " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag " +"bit, :c:member:`~PyTypeObject.tp_traverse`, " +"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " +"if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1494 -msgid "" -"An optional pointer to a clear function for the garbage collector. This is " -"only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " -"signature is::" +#: ../../c-api/typeobj.rst:1570 +msgid "An optional pointer to a clear function. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1497 +#: ../../c-api/typeobj.rst:1572 msgid "int tp_clear(PyObject *);" msgstr "int tp_clear(PyObject *);" -#: ../../c-api/typeobj.rst:1499 +#: ../../c-api/typeobj.rst:1574 +msgid "" +"The purpose of this function is to break reference cycles that are causing " +"a :term:`cyclic isolate` so that the objects can be safely destroyed. A " +"cleared object is a partially destroyed object; the object is not obligated " +"to satisfy design invariants held during normal use." +msgstr "" + +#: ../../c-api/typeobj.rst:1579 +msgid "" +":c:member:`!tp_clear` does not need to delete references to objects that " +"can't participate in reference cycles, such as Python strings or Python " +"integers. However, it may be convenient to clear all references, and write " +"the type's :c:member:`~PyTypeObject.tp_dealloc` function to " +"invoke :c:member:`!tp_clear` to avoid code duplication. (Beware " +"that :c:member:`!tp_clear` might have already been called. Prefer calling " +"idempotent functions like :c:func:`Py_CLEAR`.)" +msgstr "" + +#: ../../c-api/typeobj.rst:1587 +msgid "" +"Any non-trivial cleanup should be performed " +"in :c:member:`~PyTypeObject.tp_finalize` instead of :c:member:`!tp_clear`." +msgstr "" + +#: ../../c-api/typeobj.rst:1592 +msgid "" +"If :c:member:`!tp_clear` fails to break a reference cycle then the objects " +"in the :term:`cyclic isolate` may remain indefinitely uncollectable " +"(\"leak\"). See :data:`gc.garbage`." +msgstr "" + +#: ../../c-api/typeobj.rst:1598 +msgid "" +"Referents (direct and indirect) might have already been cleared; they are " +"not guaranteed to be in a consistent state." +msgstr "" + +#: ../../c-api/typeobj.rst:1603 +#, fuzzy +msgid "" +"The :c:member:`~PyTypeObject.tp_clear` function can be called from any " +"thread." +msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" + +#: ../../c-api/typeobj.rst:1608 +msgid "" +"An object is not guaranteed to be automatically cleared before its " +"destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called." +msgstr "" + +#: ../../c-api/typeobj.rst:1611 +msgid "" +"This function differs from the destructor " +"(:c:member:`~PyTypeObject.tp_dealloc`) in the following ways:" +msgstr "" + +#: ../../c-api/typeobj.rst:1614 +msgid "" +"The purpose of clearing an object is to remove references to other objects " +"that might participate in a reference cycle. The purpose of the destructor, " +"on the other hand, is a superset: it must release *all* resources it owns, " +"including references to objects that cannot participate in a reference cycle " +"(e.g., integers) as well as the object's own memory (by " +"calling :c:member:`~PyTypeObject.tp_free`)." +msgstr "" + +#: ../../c-api/typeobj.rst:1620 +msgid "" +"When :c:member:`!tp_clear` is called, other objects might still hold " +"references to the object being cleared. Because of this, :c:member:`!" +"tp_clear` must not deallocate the object's own memory " +"(:c:member:`~PyTypeObject.tp_free`). The destructor, on the other hand, is " +"only called when no (strong) references exist, and as such, must safely " +"destroy the object itself by deallocating it." +msgstr "" + +#: ../../c-api/typeobj.rst:1626 +msgid "" +":c:member:`!tp_clear` might never be automatically called. An object's " +"destructor, on the other hand, will be automatically called some time after " +"the object becomes unreachable (i.e., either there are no references to the " +"object or the object is a member of a :term:`cyclic isolate`)." +msgstr "" + +#: ../../c-api/typeobj.rst:1631 +msgid "" +"No guarantees are made about when, if, or how often Python automatically " +"clears an object, except:" +msgstr "" + +#: ../../c-api/typeobj.rst:1634 +msgid "" +"Python will not automatically clear an object if it is reachable, i.e., " +"there is a reference to it and it is not a member of a :term:`cyclic " +"isolate`." +msgstr "" + +#: ../../c-api/typeobj.rst:1637 +msgid "" +"Python will not automatically clear an object if it has not been " +"automatically finalized (see :c:member:`~PyTypeObject.tp_finalize`). (If " +"the finalizer resurrected the object, the object may or may not be " +"automatically finalized again before it is cleared.)" +msgstr "" + +#: ../../c-api/typeobj.rst:1641 +msgid "" +"If an object is a member of a :term:`cyclic isolate`, Python will not " +"automatically clear it if any member of the cyclic isolate has not yet been " +"automatically finalized (:c:member:`~PyTypeObject.tp_finalize`)." +msgstr "" + +#: ../../c-api/typeobj.rst:1644 +msgid "" +"Python will not destroy an object until after any automatic calls to " +"its :c:member:`!tp_clear` function have returned. This ensures that the act " +"of breaking a reference cycle does not invalidate the ``self`` pointer " +"while :c:member:`!tp_clear` is still executing." +msgstr "" + +#: ../../c-api/typeobj.rst:1648 +msgid "" +"Python will not automatically call :c:member:`!tp_clear` multiple times " +"concurrently." +msgstr "" + +#: ../../c-api/typeobj.rst:1651 +msgid "" +"CPython currently only automatically clears objects as needed to break " +"reference cycles in a :term:`cyclic isolate`, but future versions might " +"clear objects regularly before their destruction." +msgstr "" + +#: ../../c-api/typeobj.rst:1655 msgid "" -"The :c:member:`~PyTypeObject.tp_clear` member function is used to break " -"reference cycles in cyclic garbage detected by the garbage collector. Taken " -"together, all :c:member:`~PyTypeObject.tp_clear` functions in the system " -"must combine to break all reference cycles. This is subtle, and if in any " -"doubt supply a :c:member:`~PyTypeObject.tp_clear` function. For example, " -"the tuple type does not implement a :c:member:`~PyTypeObject.tp_clear` " -"function, because it's possible to prove that no reference cycle can be " -"composed entirely of tuples. Therefore the :c:member:`~PyTypeObject." -"tp_clear` functions of other types must be sufficient to break any cycle " -"containing a tuple. This isn't immediately obvious, and there's rarely a " -"good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." +"Taken together, all :c:member:`~PyTypeObject.tp_clear` functions in the " +"system must combine to break all reference cycles. This is subtle, and if " +"in any doubt supply a :c:member:`~PyTypeObject.tp_clear` function. For " +"example, the tuple type does not implement " +"a :c:member:`~PyTypeObject.tp_clear` function, because it's possible to " +"prove that no reference cycle can be composed entirely of tuples. Therefore " +"the :c:member:`~PyTypeObject.tp_clear` functions of other types are " +"responsible for breaking any cycle containing a tuple. This isn't " +"immediately obvious, and there's rarely a good reason to avoid " +"implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1509 +#: ../../c-api/typeobj.rst:1666 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2579,11 +2858,13 @@ msgid "" "example::" msgstr "" -#: ../../c-api/typeobj.rst:1513 +#: ../../c-api/typeobj.rst:1670 +#, fuzzy msgid "" "static int\n" -"local_clear(localobject *self)\n" +"local_clear(PyObject *op)\n" "{\n" +" localobject *self = (localobject *) op;\n" " Py_CLEAR(self->key);\n" " Py_CLEAR(self->args);\n" " Py_CLEAR(self->kw);\n" @@ -2601,12 +2882,12 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1523 +#: ../../c-api/typeobj.rst:1681 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " -"delicate: the reference to the contained object must not be released (via :" -"c:func:`Py_DECREF`) until after the pointer to the contained object is set " -"to ``NULL``. This is because releasing the reference may cause the " +"delicate: the reference to the contained object must not be released " +"(via :c:func:`Py_DECREF`) until after the pointer to the contained object is " +"set to ``NULL``. This is because releasing the reference may cause the " "contained object to become trash, triggering a chain of reclamation activity " "that may include invoking arbitrary Python code (due to finalizers, or " "weakref callbacks, associated with the contained object). If it's possible " @@ -2616,59 +2897,43 @@ msgid "" "performs the operations in a safe order." msgstr "" -#: ../../c-api/typeobj.rst:1535 +#: ../../c-api/typeobj.rst:1693 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" -"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" -"`PyObject_ClearManagedDict` like this::" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, the traverse function must " +"call :c:func:`PyObject_ClearManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1539 +#: ../../c-api/typeobj.rst:1697 msgid "PyObject_ClearManagedDict((PyObject*)self);" msgstr "PyObject_ClearManagedDict((PyObject*)self);" -#: ../../c-api/typeobj.rst:1541 -msgid "" -"Note that :c:member:`~PyTypeObject.tp_clear` is not *always* called before " -"an instance is deallocated. For example, when reference counting is enough " -"to determine that an object is no longer used, the cyclic garbage collector " -"is not involved and :c:member:`~PyTypeObject.tp_dealloc` is called directly." -msgstr "" - -#: ../../c-api/typeobj.rst:1547 -msgid "" -"Because the goal of :c:member:`~PyTypeObject.tp_clear` functions is to break " -"reference cycles, it's not necessary to clear contained objects like Python " -"strings or Python integers, which can't participate in reference cycles. On " -"the other hand, it may be convenient to clear all contained Python objects, " -"and write the type's :c:member:`~PyTypeObject.tp_dealloc` function to " -"invoke :c:member:`~PyTypeObject.tp_clear`." -msgstr "" - -#: ../../c-api/typeobj.rst:1560 +#: ../../c-api/typeobj.rst:1706 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" -"c:member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " -"are all inherited from the base type if they are all zero in the subtype." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_traverse` and " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag " +"bit, :c:member:`~PyTypeObject.tp_traverse`, " +"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " +"if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1568 +#: ../../c-api/typeobj.rst:1718 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1570 +#: ../../c-api/typeobj.rst:1720 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" msgstr "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -#: ../../c-api/typeobj.rst:1572 +#: ../../c-api/typeobj.rst:1722 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" -#: ../../c-api/typeobj.rst:1575 +#: ../../c-api/typeobj.rst:1725 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2676,50 +2941,51 @@ msgid "" "set an exception condition." msgstr "" -#: ../../c-api/typeobj.rst:1580 +#: ../../c-api/typeobj.rst:1730 msgid "" -"The following constants are defined to be used as the third argument for :c:" -"member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" +"The following constants are defined to be used as the third argument " +"for :c:member:`~PyTypeObject.tp_richcompare` and " +"for :c:func:`PyObject_RichCompare`:" msgstr "" -#: ../../c-api/typeobj.rst:1586 +#: ../../c-api/typeobj.rst:1736 msgid "Constant" msgstr "常數" -#: ../../c-api/typeobj.rst:1586 +#: ../../c-api/typeobj.rst:1736 msgid "Comparison" msgstr "" -#: ../../c-api/typeobj.rst:1588 +#: ../../c-api/typeobj.rst:1738 msgid "``<``" msgstr "``<``" -#: ../../c-api/typeobj.rst:1590 +#: ../../c-api/typeobj.rst:1740 msgid "``<=``" msgstr "``<=``" -#: ../../c-api/typeobj.rst:1592 +#: ../../c-api/typeobj.rst:1742 msgid "``==``" msgstr "``==``" -#: ../../c-api/typeobj.rst:1594 +#: ../../c-api/typeobj.rst:1744 msgid "``!=``" msgstr "``!=``" -#: ../../c-api/typeobj.rst:1596 +#: ../../c-api/typeobj.rst:1746 msgid "``>``" msgstr "``>``" -#: ../../c-api/typeobj.rst:1598 +#: ../../c-api/typeobj.rst:1748 msgid "``>=``" msgstr "``>=``" -#: ../../c-api/typeobj.rst:1601 +#: ../../c-api/typeobj.rst:1751 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: ../../c-api/typeobj.rst:1605 +#: ../../c-api/typeobj.rst:1755 msgid "" "Return ``Py_True`` or ``Py_False`` from the function, depending on the " "result of a comparison. VAL_A and VAL_B must be orderable by C comparison " @@ -2727,60 +2993,62 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: ../../c-api/typeobj.rst:1611 +#: ../../c-api/typeobj.rst:1761 msgid "The returned value is a new :term:`strong reference`." msgstr "" -#: ../../c-api/typeobj.rst:1613 +#: ../../c-api/typeobj.rst:1763 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: ../../c-api/typeobj.rst:1621 +#: ../../c-api/typeobj.rst:1771 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" -"member:`~PyTypeObject.tp_hash` when the subtype's :c:member:`~PyTypeObject." -"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_hash`: a subtype " +"inherits :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` when the " +"subtype's :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1628 +#: ../../c-api/typeobj.rst:1778 msgid "" -":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." -"tp_richcompare` implementation, which may be inherited. However, if only :c:" -"member:`~PyTypeObject.tp_hash` is defined, not even the inherited function " -"is used and instances of the type will not be able to participate in any " -"comparisons." +":c:data:`PyBaseObject_Type` provides " +"a :c:member:`~PyTypeObject.tp_richcompare` implementation, which may be " +"inherited. However, if only :c:member:`~PyTypeObject.tp_hash` is defined, " +"not even the inherited function is used and instances of the type will not " +"be able to participate in any comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1637 +#: ../../c-api/typeobj.rst:1787 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1640 +#: ../../c-api/typeobj.rst:1790 msgid "" "If the instances of this type are weakly referenceable, this field is " "greater than zero and contains the offset in the instance structure of the " "weak reference list head (ignoring the GC header, if present); this offset " "is used by :c:func:`PyObject_ClearWeakRefs` and the ``PyWeakref_*`` " -"functions. The instance structure needs to include a field of type :c:expr:" -"`PyObject*` which is initialized to ``NULL``." +"functions. The instance structure needs to include a field of " +"type :c:expr:`PyObject*` which is initialized to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1647 +#: ../../c-api/typeobj.rst:1797 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " "is the list head for weak references to the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1650 +#: ../../c-api/typeobj.rst:1800 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1655 +#: ../../c-api/typeobj.rst:1805 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype uses a " @@ -2789,115 +3057,116 @@ msgid "" "not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1662 +#: ../../c-api/typeobj.rst:1812 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" -"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." -"tp_weaklistoffset` will be set to a negative value, to indicate that it is " -"unsafe to use this field." +"If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, " +"then :c:member:`~PyTypeObject.tp_weaklistoffset` will be set to a negative " +"value, to indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1670 +#: ../../c-api/typeobj.rst:1820 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " -"object. Its presence normally signals that the instances of this type are :" -"term:`iterable` (although sequences may be iterable without this function)." +"object. Its presence normally signals that the instances of this type " +"are :term:`iterable` (although sequences may be iterable without this " +"function)." msgstr "" -#: ../../c-api/typeobj.rst:1674 +#: ../../c-api/typeobj.rst:1824 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: ../../c-api/typeobj.rst:1676 +#: ../../c-api/typeobj.rst:1826 msgid "PyObject *tp_iter(PyObject *self);" msgstr "PyObject *tp_iter(PyObject *self);" -#: ../../c-api/typeobj.rst:1685 +#: ../../c-api/typeobj.rst:1835 msgid "" -"An optional pointer to a function that returns the next item in an :term:" -"`iterator`. The signature is::" +"An optional pointer to a function that returns the next item in " +"an :term:`iterator`. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1688 +#: ../../c-api/typeobj.rst:1838 msgid "PyObject *tp_iternext(PyObject *self);" msgstr "PyObject *tp_iternext(PyObject *self);" -#: ../../c-api/typeobj.rst:1690 +#: ../../c-api/typeobj.rst:1840 msgid "" -"When the iterator is exhausted, it must return ``NULL``; a :exc:" -"`StopIteration` exception may or may not be set. When another error occurs, " -"it must return ``NULL`` too. Its presence signals that the instances of " -"this type are iterators." +"When the iterator is exhausted, it must return ``NULL``; " +"a :exc:`StopIteration` exception may or may not be set. When another error " +"occurs, it must return ``NULL`` too. Its presence signals that the " +"instances of this type are iterators." msgstr "" -#: ../../c-api/typeobj.rst:1695 +#: ../../c-api/typeobj.rst:1845 msgid "" "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " "function, and that function should return the iterator instance itself (not " "a new iterator instance)." msgstr "" -#: ../../c-api/typeobj.rst:1699 +#: ../../c-api/typeobj.rst:1849 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: ../../c-api/typeobj.rst:1708 +#: ../../c-api/typeobj.rst:1858 msgid "" -"An optional pointer to a static ``NULL``-terminated array of :c:type:" -"`PyMethodDef` structures, declaring regular methods of this type." +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -#: ../../c-api/typeobj.rst:1711 +#: ../../c-api/typeobj.rst:1861 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1716 +#: ../../c-api/typeobj.rst:1866 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1722 +#: ../../c-api/typeobj.rst:1872 msgid "" -"An optional pointer to a static ``NULL``-terminated array of :c:type:" -"`PyMemberDef` structures, declaring regular data members (fields or slots) " -"of instances of this type." +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyMemberDef` structures, declaring regular data members (fields " +"or slots) of instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1726 +#: ../../c-api/typeobj.rst:1876 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1731 +#: ../../c-api/typeobj.rst:1881 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1737 +#: ../../c-api/typeobj.rst:1887 msgid "" -"An optional pointer to a static ``NULL``-terminated array of :c:type:" -"`PyGetSetDef` structures, declaring computed attributes of instances of this " -"type." +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyGetSetDef` structures, declaring computed attributes of " +"instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1740 +#: ../../c-api/typeobj.rst:1890 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1745 +#: ../../c-api/typeobj.rst:1895 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1751 +#: ../../c-api/typeobj.rst:1901 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -2905,7 +3174,7 @@ msgid "" "metatype." msgstr "" -#: ../../c-api/typeobj.rst:1759 +#: ../../c-api/typeobj.rst:1909 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -2913,173 +3182,176 @@ msgid "" "valid C99 address constants." msgstr "" -#: ../../c-api/typeobj.rst:1764 +#: ../../c-api/typeobj.rst:1914 msgid "" -"However, the unary '&' operator applied to a non-static variable like :c:" -"data:`PyBaseObject_Type` is not required to produce an address constant. " -"Compilers may support this (gcc does), MSVC does not. Both compilers are " -"strictly standard conforming in this particular behavior." +"However, the unary '&' operator applied to a non-static variable " +"like :c:data:`PyBaseObject_Type` is not required to produce an address " +"constant. Compilers may support this (gcc does), MSVC does not. Both " +"compilers are strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1770 +#: ../../c-api/typeobj.rst:1920 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: ../../c-api/typeobj.rst:1775 +#: ../../c-api/typeobj.rst:1925 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: ../../c-api/typeobj.rst:1779 +#: ../../c-api/typeobj.rst:1929 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: ../../c-api/typeobj.rst:1785 +#: ../../c-api/typeobj.rst:1935 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1787 +#: ../../c-api/typeobj.rst:1937 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " "attributes for the type. Once :c:func:`PyType_Ready` has initialized the " "type, extra attributes for the type may be added to this dictionary only if " -"they don't correspond to overloaded operations (like :meth:`~object." -"__add__`). Once initialization for the type has finished, this field should " -"be treated as read-only." +"they don't correspond to overloaded operations " +"(like :meth:`~object.__add__`). Once initialization for the type has " +"finished, this field should be treated as read-only." msgstr "" -#: ../../c-api/typeobj.rst:1795 +#: ../../c-api/typeobj.rst:1945 msgid "" -"Some types may not store their dictionary in this slot. Use :c:func:" -"`PyType_GetDict` to retrieve the dictionary for an arbitrary type." +"Some types may not store their dictionary in this slot. " +"Use :c:func:`PyType_GetDict` to retrieve the dictionary for an arbitrary " +"type." msgstr "" -#: ../../c-api/typeobj.rst:1801 +#: ../../c-api/typeobj.rst:1951 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " -"Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" -"func:`PyType_GetDict` to get the dict for an arbitrary type." +"Instead, the dict for such types is stored on ``PyInterpreterState``. " +"Use :c:func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1807 +#: ../../c-api/typeobj.rst:1957 msgid "" "This field is not inherited by subtypes (though the attributes defined in " "here are inherited through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1812 +#: ../../c-api/typeobj.rst:1962 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: ../../c-api/typeobj.rst:1817 +#: ../../c-api/typeobj.rst:1967 msgid "" -"It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" -"member:`~PyTypeObject.tp_dict` with the dictionary C-API." +"It is not safe to use :c:func:`PyDict_SetItem` on or otherwise " +"modify :c:member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" -#: ../../c-api/typeobj.rst:1823 +#: ../../c-api/typeobj.rst:1973 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: ../../c-api/typeobj.rst:1825 ../../c-api/typeobj.rst:1841 -#: ../../c-api/typeobj.rst:1905 ../../c-api/typeobj.rst:1935 -#: ../../c-api/typeobj.rst:1959 +#: ../../c-api/typeobj.rst:1975 ../../c-api/typeobj.rst:1991 +#: ../../c-api/typeobj.rst:2055 ../../c-api/typeobj.rst:2085 +#: ../../c-api/typeobj.rst:2108 msgid "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1827 +#: ../../c-api/typeobj.rst:1977 msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" msgstr "" "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" -#: ../../c-api/typeobj.rst:1838 +#: ../../c-api/typeobj.rst:1988 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: ../../c-api/typeobj.rst:1843 +#: ../../c-api/typeobj.rst:1993 msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" msgstr "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" -#: ../../c-api/typeobj.rst:1845 +#: ../../c-api/typeobj.rst:1995 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: ../../c-api/typeobj.rst:1856 +#: ../../c-api/typeobj.rst:2006 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1859 +#: ../../c-api/typeobj.rst:2009 msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " -"of the type of the instance variable dictionary; this offset is used by :c:" -"func:`PyObject_GenericGetAttr`." +"of the type of the instance variable dictionary; this offset is used " +"by :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1864 +#: ../../c-api/typeobj.rst:2014 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " "the dictionary for attributes of the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1867 +#: ../../c-api/typeobj.rst:2017 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." msgstr "" -#: ../../c-api/typeobj.rst:1869 +#: ../../c-api/typeobj.rst:2019 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" -"only. To get the pointer to the dictionary call :c:func:" -"`PyObject_GenericGetDict`. Calling :c:func:`PyObject_GenericGetDict` may " -"need to allocate memory for the dictionary, so it is may be more efficient " -"to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." +"only. To get the pointer to the dictionary " +"call :c:func:`PyObject_GenericGetDict`. " +"Calling :c:func:`PyObject_GenericGetDict` may need to allocate memory for " +"the dictionary, so it is may be more efficient to " +"call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: ../../c-api/typeobj.rst:1875 +#: ../../c-api/typeobj.rst:2025 msgid "" -"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit and :c:" -"member:`~PyTypeObject.tp_dictoffset`." +"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit " +"and :c:member:`~PyTypeObject.tp_dictoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1880 +#: ../../c-api/typeobj.rst:2030 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " -"at the previous offset. To properly support inheritance, use :c:macro:" -"`Py_TPFLAGS_MANAGED_DICT`." +"at the previous offset. To properly support inheritance, " +"use :c:macro:`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -#: ../../c-api/typeobj.rst:1887 +#: ../../c-api/typeobj.rst:2037 msgid "" "This slot has no default. For :ref:`static types `, if the " "field is ``NULL`` then no :attr:`~object.__dict__` gets created for " "instances." msgstr "" -#: ../../c-api/typeobj.rst:1890 +#: ../../c-api/typeobj.rst:2040 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" -"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " -"will be set to ``-1``, to indicate that it is unsafe to use this field." +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, " +"then :c:member:`~PyTypeObject.tp_dictoffset` will be set to ``-1``, to " +"indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1898 +#: ../../c-api/typeobj.rst:2048 msgid "An optional pointer to an instance initialization function." msgstr "" -#: ../../c-api/typeobj.rst:1900 +#: ../../c-api/typeobj.rst:2050 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " @@ -3087,110 +3359,111 @@ msgid "" "instance by calling its :meth:`!__init__` method again." msgstr "" -#: ../../c-api/typeobj.rst:1907 +#: ../../c-api/typeobj.rst:2057 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1909 +#: ../../c-api/typeobj.rst:2059 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " -"arguments represent positional and keyword arguments of the call to :meth:" -"`~object.__init__`." +"arguments represent positional and keyword arguments of the call " +"to :meth:`~object.__init__`." msgstr "" -#: ../../c-api/typeobj.rst:1913 +#: ../../c-api/typeobj.rst:2063 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " -"when an instance is created normally by calling its type, after the type's :" -"c:member:`~PyTypeObject.tp_new` function has returned an instance of the " -"type. If the :c:member:`~PyTypeObject.tp_new` function returns an instance " -"of some other type that is not a subtype of the original type, no :c:member:" -"`~PyTypeObject.tp_init` function is called; if :c:member:`~PyTypeObject." -"tp_new` returns an instance of a subtype of the original type, the " -"subtype's :c:member:`~PyTypeObject.tp_init` is called." +"when an instance is created normally by calling its type, after the " +"type's :c:member:`~PyTypeObject.tp_new` function has returned an instance of " +"the type. If the :c:member:`~PyTypeObject.tp_new` function returns an " +"instance of some other type that is not a subtype of the original type, " +"no :c:member:`~PyTypeObject.tp_init` function is called; " +"if :c:member:`~PyTypeObject.tp_new` returns an instance of a subtype of the " +"original type, the subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: ../../c-api/typeobj.rst:1920 +#: ../../c-api/typeobj.rst:2070 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: ../../c-api/typeobj.rst:1928 +#: ../../c-api/typeobj.rst:2078 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" -#: ../../c-api/typeobj.rst:1933 +#: ../../c-api/typeobj.rst:2083 msgid "An optional pointer to an instance allocation function." msgstr "" -#: ../../c-api/typeobj.rst:1937 +#: ../../c-api/typeobj.rst:2087 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -#: ../../c-api/typeobj.rst:1941 +#: ../../c-api/typeobj.rst:2091 msgid "" -"This field is inherited by static subtypes, but not by dynamic subtypes " -"(subtypes created by a class statement)." +"Static subtypes inherit this slot, which will " +"be :c:func:`PyType_GenericAlloc` if inherited from :class:`object`." msgstr "" -#: ../../c-api/typeobj.rst:1946 -msgid "" -"For dynamic subtypes, this field is always set to :c:func:" -"`PyType_GenericAlloc`, to force a standard heap allocation strategy." +#: ../../c-api/typeobj.rst:2094 ../../c-api/typeobj.rst:2161 +msgid ":ref:`Heap subtypes ` do not inherit this slot." msgstr "" -#: ../../c-api/typeobj.rst:1950 +#: ../../c-api/typeobj.rst:2098 msgid "" -"For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:" -"`PyType_GenericAlloc`. That is the recommended value for all statically " -"defined types." +"For heap subtypes, this field is always set to :c:func:`PyType_GenericAlloc`." msgstr "" -#: ../../c-api/typeobj.rst:1957 +#: ../../c-api/typeobj.rst:2101 ../../c-api/typeobj.rst:2169 +msgid "For static subtypes, this slot is inherited (see above)." +msgstr "" + +#: ../../c-api/typeobj.rst:2106 msgid "An optional pointer to an instance creation function." msgstr "" -#: ../../c-api/typeobj.rst:1961 +#: ../../c-api/typeobj.rst:2110 msgid "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1963 +#: ../../c-api/typeobj.rst:2112 msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " -"to the type. Note that *subtype* doesn't have to equal the type whose :c:" -"member:`~PyTypeObject.tp_new` function is called; it may be a subtype of " -"that type (but not an unrelated type)." +"to the type. Note that *subtype* doesn't have to equal the type " +"whose :c:member:`~PyTypeObject.tp_new` function is called; it may be a " +"subtype of that type (but not an unrelated type)." msgstr "" -#: ../../c-api/typeobj.rst:1969 +#: ../../c-api/typeobj.rst:2118 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " "only as much further initialization as is absolutely necessary. " "Initialization that can safely be ignored or repeated should be placed in " "the :c:member:`~PyTypeObject.tp_init` handler. A good rule of thumb is that " -"for immutable types, all initialization should take place in :c:member:" -"`~PyTypeObject.tp_new`, while for mutable types, most initialization should " -"be deferred to :c:member:`~PyTypeObject.tp_init`." +"for immutable types, all initialization should take place " +"in :c:member:`~PyTypeObject.tp_new`, while for mutable types, most " +"initialization should be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: ../../c-api/typeobj.rst:1977 +#: ../../c-api/typeobj.rst:2126 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" -#: ../../c-api/typeobj.rst:1982 +#: ../../c-api/typeobj.rst:2131 msgid "" -"This field is inherited by subtypes, except it is not inherited by :ref:" -"`static types ` whose :c:member:`~PyTypeObject.tp_base` is " -"``NULL`` or ``&PyBaseObject_Type``." +"This field is inherited by subtypes, except it is not inherited " +"by :ref:`static types ` " +"whose :c:member:`~PyTypeObject.tp_base` is ``NULL`` or " +"``&PyBaseObject_Type``." msgstr "" -#: ../../c-api/typeobj.rst:1988 +#: ../../c-api/typeobj.rst:2137 msgid "" "For :ref:`static types ` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " @@ -3198,142 +3471,141 @@ msgid "" "factory function." msgstr "" -#: ../../c-api/typeobj.rst:1996 +#: ../../c-api/typeobj.rst:2145 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1998 +#: ../../c-api/typeobj.rst:2147 msgid "void tp_free(void *self);" msgstr "void tp_free(void *self);" -#: ../../c-api/typeobj.rst:2000 +#: ../../c-api/typeobj.rst:2149 msgid "" -"An initializer that is compatible with this signature is :c:func:" -"`PyObject_Free`." +"This function must free the memory allocated " +"by :c:member:`~PyTypeObject.tp_alloc`." msgstr "" -#: ../../c-api/typeobj.rst:2004 -msgid "" -"This field is inherited by static subtypes, but not by dynamic subtypes " -"(subtypes created by a class statement)" -msgstr "" - -#: ../../c-api/typeobj.rst:2009 +#: ../../c-api/typeobj.rst:2154 msgid "" -"In dynamic subtypes, this field is set to a deallocator suitable to match :c:" -"func:`PyType_GenericAlloc` and the value of the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit." +"Static subtypes inherit this slot, which will be :c:func:`PyObject_Free` if " +"inherited from :class:`object`. Exception: If the type supports garbage " +"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set " +"in :c:member:`~PyTypeObject.tp_flags`) and it would " +"inherit :c:func:`PyObject_Free`, then this slot is not inherited but instead " +"defaults to :c:func:`PyObject_GC_Del`." msgstr "" -#: ../../c-api/typeobj.rst:2013 +#: ../../c-api/typeobj.rst:2165 msgid "" -"For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_Del`." +"For :ref:`heap subtypes `, this slot defaults to a deallocator " +"suitable to match :c:func:`PyType_GenericAlloc` and the value of " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" -#: ../../c-api/typeobj.rst:2018 +#: ../../c-api/typeobj.rst:2174 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: ../../c-api/typeobj.rst:2020 +#: ../../c-api/typeobj.rst:2176 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " -"type's :c:member:`~PyTypeObject.tp_flags` field, and check the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture of statically " -"and dynamically allocated instances, and the statically allocated instances " -"are not collectible. Such types should define this function; it should " -"return ``1`` for a collectible instance, and ``0`` for a non-collectible " -"instance. The signature is::" +"type's :c:member:`~PyTypeObject.tp_flags` field, and check " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture " +"of statically and dynamically allocated instances, and the statically " +"allocated instances are not collectible. Such types should define this " +"function; it should return ``1`` for a collectible instance, and ``0`` for a " +"non-collectible instance. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2028 +#: ../../c-api/typeobj.rst:2184 msgid "int tp_is_gc(PyObject *self);" msgstr "int tp_is_gc(PyObject *self);" -#: ../../c-api/typeobj.rst:2030 +#: ../../c-api/typeobj.rst:2186 msgid "" -"(The only example of this are types themselves. The metatype, :c:data:" -"`PyType_Type`, defines this function to distinguish between statically and :" -"ref:`dynamically allocated types `.)" +"(The only example of this are types themselves. The " +"metatype, :c:data:`PyType_Type`, defines this function to distinguish " +"between statically and :ref:`dynamically allocated types `.)" msgstr "" -#: ../../c-api/typeobj.rst:2040 +#: ../../c-api/typeobj.rst:2196 msgid "" -"This slot has no default. If this field is ``NULL``, :c:macro:" -"`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." +"This slot has no default. If this field is " +"``NULL``, :c:macro:`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" -#: ../../c-api/typeobj.rst:2046 +#: ../../c-api/typeobj.rst:2202 msgid "Tuple of base types." msgstr "" -#: ../../c-api/typeobj.rst:2048 ../../c-api/typeobj.rst:2072 +#: ../../c-api/typeobj.rst:2204 ../../c-api/typeobj.rst:2228 msgid "" "This field should be set to ``NULL`` and treated as read-only. Python will " "fill it in when the type is :c:func:`initialized `." msgstr "" -#: ../../c-api/typeobj.rst:2051 +#: ../../c-api/typeobj.rst:2207 msgid "" "For dynamically created classes, the ``Py_tp_bases`` :c:type:`slot " -"` can be used instead of the *bases* argument of :c:func:" -"`PyType_FromSpecWithBases`. The argument form is preferred." +"` can be used instead of the *bases* argument " +"of :c:func:`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: ../../c-api/typeobj.rst:2058 +#: ../../c-api/typeobj.rst:2214 msgid "" "Multiple inheritance does not work well for statically defined types. If you " "set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " "will only be inherited from the first base." msgstr "" -#: ../../c-api/typeobj.rst:2064 ../../c-api/typeobj.rst:2087 -#: ../../c-api/typeobj.rst:2104 ../../c-api/typeobj.rst:2121 -#: ../../c-api/typeobj.rst:2135 +#: ../../c-api/typeobj.rst:2220 ../../c-api/typeobj.rst:2243 +#: ../../c-api/typeobj.rst:2260 ../../c-api/typeobj.rst:2277 +#: ../../c-api/typeobj.rst:2291 msgid "This field is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:2069 +#: ../../c-api/typeobj.rst:2225 msgid "" "Tuple containing the expanded set of base types, starting with the type " "itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -#: ../../c-api/typeobj.rst:2077 +#: ../../c-api/typeobj.rst:2233 msgid "" -"This field is not inherited; it is calculated fresh by :c:func:" -"`PyType_Ready`." +"This field is not inherited; it is calculated fresh " +"by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2083 +#: ../../c-api/typeobj.rst:2239 msgid "Unused. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2092 +#: ../../c-api/typeobj.rst:2248 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -#: ../../c-api/typeobj.rst:2094 +#: ../../c-api/typeobj.rst:2250 msgid "" -"To get a list of subclasses, call the Python method :py:meth:`~type." -"__subclasses__`." +"To get a list of subclasses, call the Python " +"method :py:meth:`~type.__subclasses__`." msgstr "" -#: ../../c-api/typeobj.rst:2099 +#: ../../c-api/typeobj.rst:2255 msgid "" "For some types, this field does not hold a valid :c:expr:`PyObject*`. The " "type was changed to :c:expr:`void*` to indicate this." msgstr "" -#: ../../c-api/typeobj.rst:2109 +#: ../../c-api/typeobj.rst:2265 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2114 +#: ../../c-api/typeobj.rst:2270 msgid "" "Internals detail: For the static builtin types this is always ``NULL``, even " "if weakrefs are added. Instead, the weakrefs for each are stored on " @@ -3341,164 +3613,385 @@ msgid "" "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -#: ../../c-api/typeobj.rst:2126 +#: ../../c-api/typeobj.rst:2282 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "" -#: ../../c-api/typeobj.rst:2131 +#: ../../c-api/typeobj.rst:2287 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2140 +#: ../../c-api/typeobj.rst:2296 msgid "" -"An optional pointer to an instance finalization function. Its signature is::" +"An optional pointer to an instance finalization function. This is the C " +"implementation of the :meth:`~object.__del__` special method. Its signature " +"is::" msgstr "" -#: ../../c-api/typeobj.rst:2142 +#: ../../c-api/typeobj.rst:2300 msgid "void tp_finalize(PyObject *self);" msgstr "void tp_finalize(PyObject *self);" -#: ../../c-api/typeobj.rst:2144 +#: ../../c-api/typeobj.rst:2302 msgid "" -"If :c:member:`~PyTypeObject.tp_finalize` is set, the interpreter calls it " -"once when finalizing an instance. It is called either from the garbage " -"collector (if the instance is part of an isolated reference cycle) or just " -"before the object is deallocated. Either way, it is guaranteed to be called " -"before attempting to break reference cycles, ensuring that it finds the " -"object in a sane state." +"The primary purpose of finalization is to perform any non-trivial cleanup " +"that must be performed before the object is destroyed, while the object and " +"any other objects it directly or indirectly references are still in a " +"consistent state. The finalizer is allowed to execute arbitrary Python code." msgstr "" -#: ../../c-api/typeobj.rst:2151 +#: ../../c-api/typeobj.rst:2308 msgid "" -":c:member:`~PyTypeObject.tp_finalize` should not mutate the current " -"exception status; therefore, a recommended way to write a non-trivial " -"finalizer is::" +"Before Python automatically finalizes an object, some of the object's direct " +"or indirect referents might have themselves been automatically finalized. " +"However, none of the referents will have been automatically cleared " +"(:c:member:`~PyTypeObject.tp_clear`) yet." msgstr "" -#: ../../c-api/typeobj.rst:2154 +#: ../../c-api/typeobj.rst:2313 +msgid "" +"Other non-finalized objects might still be using a finalized object, so the " +"finalizer must leave the object in a sane state (e.g., invariants are still " +"met)." +msgstr "" + +#: ../../c-api/typeobj.rst:2319 +msgid "" +"After Python automatically finalizes an object, Python might start " +"automatically clearing (:c:member:`~PyTypeObject.tp_clear`) the object and " +"its referents (direct and indirect). Cleared objects are not guaranteed to " +"be in a consistent state; a finalized object must be able to tolerate " +"cleared referents." +msgstr "" + +#: ../../c-api/typeobj.rst:2327 +msgid "" +"An object is not guaranteed to be automatically finalized before its " +"destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called. It is " +"recommended to call :c:func:`PyObject_CallFinalizerFromDealloc` at the " +"beginning of :c:member:`!tp_dealloc` to guarantee that the object is always " +"finalized before destruction." +msgstr "" + +#: ../../c-api/typeobj.rst:2335 +msgid "" +"The :c:member:`~PyTypeObject.tp_finalize` function can be called from any " +"thread, although the :term:`GIL` will be held." +msgstr "" + +#: ../../c-api/typeobj.rst:2340 +msgid "" +"The :c:member:`!tp_finalize` function can be called during shutdown, after " +"some global variables have been deleted. See the documentation of " +"the :meth:`~object.__del__` method for details." +msgstr "" + +#: ../../c-api/typeobj.rst:2344 +msgid "" +"When Python finalizes an object, it behaves like the following algorithm:" +msgstr "" + +#: ../../c-api/typeobj.rst:2346 +msgid "" +"Python might mark the object as *finalized*. Currently, Python always marks " +"objects whose type supports garbage collection (i.e., " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set " +"in :c:member:`~PyTypeObject.tp_flags`) and never marks other types of " +"objects; this might change in a future version." +msgstr "" + +#: ../../c-api/typeobj.rst:2351 +msgid "" +"If the object is not marked as *finalized* and its :c:member:`!tp_finalize` " +"finalizer function is non-``NULL``, the finalizer function is called." +msgstr "" + +#: ../../c-api/typeobj.rst:2354 +msgid "" +"If the finalizer function was called and the finalizer made the object " +"reachable (i.e., there is a reference to the object and it is not a member " +"of a :term:`cyclic isolate`), then the finalizer is said to have " +"*resurrected* the object. It is unspecified whether the finalizer can also " +"resurrect the object by adding a new reference to the object that does not " +"make it reachable, i.e., the object is (still) a member of a cyclic isolate." +msgstr "" + +#: ../../c-api/typeobj.rst:2361 +msgid "" +"If the finalizer resurrected the object, the object's pending destruction is " +"canceled and the object's *finalized* mark might be removed if present. " +"Currently, Python never removes the *finalized* mark; this might change in a " +"future version." +msgstr "" + +#: ../../c-api/typeobj.rst:2366 +msgid "" +"*Automatic finalization* refers to any finalization performed by Python " +"except via calls to :c:func:`PyObject_CallFinalizer` " +"or :c:func:`PyObject_CallFinalizerFromDealloc`. No guarantees are made " +"about when, if, or how often an object is automatically finalized, except:" +msgstr "" + +#: ../../c-api/typeobj.rst:2371 +msgid "" +"Python will not automatically finalize an object if it is reachable, i.e., " +"there is a reference to it and it is not a member of a :term:`cyclic " +"isolate`." +msgstr "" + +#: ../../c-api/typeobj.rst:2374 +msgid "" +"Python will not automatically finalize an object if finalizing it would not " +"mark the object as *finalized*. Currently, this applies to objects whose " +"type does not support garbage collection, i.e., " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is not set. Such objects can still " +"be manually finalized by calling :c:func:`PyObject_CallFinalizer` " +"or :c:func:`PyObject_CallFinalizerFromDealloc`." +msgstr "" + +#: ../../c-api/typeobj.rst:2380 +msgid "" +"Python will not automatically finalize any two members of a :term:`cyclic " +"isolate` concurrently." +msgstr "" + +#: ../../c-api/typeobj.rst:2382 +msgid "" +"Python will not automatically finalize an object after it has automatically " +"cleared (:c:member:`~PyTypeObject.tp_clear`) the object." +msgstr "" + +#: ../../c-api/typeobj.rst:2384 +msgid "" +"If an object is a member of a :term:`cyclic isolate`, Python will not " +"automatically finalize it after automatically clearing " +"(see :c:member:`~PyTypeObject.tp_clear`) any other member." +msgstr "" + +#: ../../c-api/typeobj.rst:2387 +msgid "" +"Python will automatically finalize every member of a :term:`cyclic isolate` " +"before it automatically clears (see :c:member:`~PyTypeObject.tp_clear`) any " +"of them." +msgstr "" + +#: ../../c-api/typeobj.rst:2390 +msgid "" +"If Python is going to automatically clear an object " +"(:c:member:`~PyTypeObject.tp_clear`), it will automatically finalize the " +"object first." +msgstr "" + +#: ../../c-api/typeobj.rst:2394 +msgid "" +"Python currently only automatically finalizes objects that are members of " +"a :term:`cyclic isolate`, but future versions might finalize objects " +"regularly before their destruction." +msgstr "" + +#: ../../c-api/typeobj.rst:2398 +msgid "" +"To manually finalize an object, do not call this function directly; " +"call :c:func:`PyObject_CallFinalizer` " +"or :c:func:`PyObject_CallFinalizerFromDealloc` instead." +msgstr "" + +#: ../../c-api/typeobj.rst:2402 +msgid "" +":c:member:`~PyTypeObject.tp_finalize` should leave the current exception " +"status unchanged. The recommended way to write a non-trivial finalizer is " +"to back up the exception at the beginning by " +"calling :c:func:`PyErr_GetRaisedException` and restore the exception at the " +"end by calling :c:func:`PyErr_SetRaisedException`. If an exception is " +"encountered in the middle of the finalizer, log and clear it " +"with :c:func:`PyErr_WriteUnraisable` or :c:func:`PyErr_FormatUnraisable`. " +"For example::" +msgstr "" + +#: ../../c-api/typeobj.rst:2411 msgid "" "static void\n" -"local_finalize(PyObject *self)\n" +"foo_finalize(PyObject *self)\n" "{\n" -" /* Save the current exception, if any. */\n" +" // Save the current exception, if any.\n" " PyObject *exc = PyErr_GetRaisedException();\n" "\n" -" /* ... */\n" +" // ...\n" +"\n" +" if (do_something_that_might_raise() != success_indicator) {\n" +" PyErr_WriteUnraisable(self);\n" +" goto done;\n" +" }\n" "\n" -" /* Restore the saved exception. */\n" +"done:\n" +" // Restore the saved exception. This silently discards any exception\n" +" // raised above, so be sure to call PyErr_WriteUnraisable first if\n" +" // necessary.\n" " PyErr_SetRaisedException(exc);\n" "}" msgstr "" -#: ../../c-api/typeobj.rst:2174 +#: ../../c-api/typeobj.rst:2439 +msgid "" +"Before version 3.8 it was necessary to set " +"the :c:macro:`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to " +"be used. This is no longer required." +msgstr "" + +#: ../../c-api/typeobj.rst:2445 +msgid ":pep:`442`: \"Safe object finalization\"" +msgstr "" + +#: ../../c-api/typeobj.rst:2448 +#, fuzzy +msgid ":c:func:`PyObject_CallFinalizer`" +msgstr ":c:member:`~PyTypeObject.tp_finalize`" + +#: ../../c-api/typeobj.rst:2449 +msgid ":c:func:`PyObject_CallFinalizerFromDealloc`" +msgstr "" + +#: ../../c-api/typeobj.rst:2454 +msgid "" +"A :ref:`vectorcall function ` to use for calls of this type " +"object (rather than instances). In other words, ``tp_vectorcall`` can be " +"used to optimize ``type.__call__``, which typically returns a new instance " +"of *type*." +msgstr "" + +#: ../../c-api/typeobj.rst:2459 +msgid "" +"As with any vectorcall function, if ``tp_vectorcall`` is ``NULL``, the " +"*tp_call* protocol (``Py_TYPE(type)->tp_call``) is used instead." +msgstr "" + +#: ../../c-api/typeobj.rst:2464 +msgid "" +"The :ref:`vectorcall protocol ` requires that the vectorcall " +"function has the same behavior as the corresponding ``tp_call``. This means " +"that ``type->tp_vectorcall`` must match the behavior of ``Py_TYPE(type)-" +">tp_call``." +msgstr "" + +#: ../../c-api/typeobj.rst:2469 +msgid "" +"Specifically, if *type* uses the default metaclass, ``type->tp_vectorcall`` " +"must behave the same as :c:expr:`PyType_Type->tp_call`, which:" +msgstr "" + +#: ../../c-api/typeobj.rst:2473 +msgid "calls ``type->tp_new``," +msgstr "" + +#: ../../c-api/typeobj.rst:2475 msgid "" -"Before version 3.8 it was necessary to set the :c:macro:" -"`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " -"This is no longer required." +"if the result is a subclass of *type*, calls ``type->tp_init`` on the result " +"of ``tp_new``, and" msgstr "" -#: ../../c-api/typeobj.rst:2178 -msgid "\"Safe object finalization\" (:pep:`442`)" +#: ../../c-api/typeobj.rst:2478 +msgid "returns the result of ``tp_new``." msgstr "" -#: ../../c-api/typeobj.rst:2183 +#: ../../c-api/typeobj.rst:2480 msgid "" -"Vectorcall function to use for calls of this type object. In other words, it " -"is used to implement :ref:`vectorcall ` for ``type.__call__``. " -"If ``tp_vectorcall`` is ``NULL``, the default call implementation using :" -"meth:`~object.__new__` and :meth:`~object.__init__` is used." +"Typically, ``tp_vectorcall`` is overridden to optimize this process for " +"specific :c:member:`~PyTypeObject.tp_new` " +"and :c:member:`~PyTypeObject.tp_init`. When doing this for user-subclassable " +"types, note that both can be overridden (using :py:func:`~object.__new__` " +"and :py:func:`~object.__init__`, respectively)." msgstr "" -#: ../../c-api/typeobj.rst:2191 +#: ../../c-api/typeobj.rst:2491 msgid "This field is never inherited." msgstr "" -#: ../../c-api/typeobj.rst:2193 +#: ../../c-api/typeobj.rst:2493 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: ../../c-api/typeobj.rst:2198 +#: ../../c-api/typeobj.rst:2498 msgid "Internal. Do not use." msgstr "" -#: ../../c-api/typeobj.rst:2206 +#: ../../c-api/typeobj.rst:2506 msgid "Static Types" msgstr "" -#: ../../c-api/typeobj.rst:2208 +#: ../../c-api/typeobj.rst:2508 msgid "" -"Traditionally, types defined in C code are *static*, that is, a static :c:" -"type:`PyTypeObject` structure is defined directly in code and initialized " -"using :c:func:`PyType_Ready`." +"Traditionally, types defined in C code are *static*, that is, a " +"static :c:type:`PyTypeObject` structure is defined directly in code and " +"initialized using :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2212 +#: ../../c-api/typeobj.rst:2512 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: ../../c-api/typeobj.rst:2214 +#: ../../c-api/typeobj.rst:2514 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: ../../c-api/typeobj.rst:2216 +#: ../../c-api/typeobj.rst:2516 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" -#: ../../c-api/typeobj.rst:2218 +#: ../../c-api/typeobj.rst:2518 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" -#: ../../c-api/typeobj.rst:2222 +#: ../../c-api/typeobj.rst:2522 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "` as an opaque struct, any extension modules using static " "types must be compiled for a specific Python minor version." msgstr "" -#: ../../c-api/typeobj.rst:2230 +#: ../../c-api/typeobj.rst:2530 msgid "Heap Types" msgstr "" -#: ../../c-api/typeobj.rst:2232 +#: ../../c-api/typeobj.rst:2532 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " -"created by Python's ``class`` statement. Heap types have the :c:macro:" -"`Py_TPFLAGS_HEAPTYPE` flag set." +"created by Python's ``class`` statement. Heap types have " +"the :c:macro:`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: ../../c-api/typeobj.rst:2237 +#: ../../c-api/typeobj.rst:2537 msgid "" -"This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" -"func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" -"`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." +"This is done by filling a :c:type:`PyType_Spec` structure and " +"calling :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:`PyType_FromModuleAndSpec`, " +"or :c:func:`PyType_FromMetaclass`." msgstr "" -#: ../../c-api/typeobj.rst:2245 +#: ../../c-api/typeobj.rst:2545 msgid "Number Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2252 +#: ../../c-api/typeobj.rst:2552 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the number protocol. Each function is used by the function of " "similar name documented in the :ref:`number` section." msgstr "" -#: ../../c-api/typeobj.rst:2258 ../../c-api/typeobj.rst:2582 +#: ../../c-api/typeobj.rst:2558 ../../c-api/typeobj.rst:2882 msgid "Here is the structure definition::" msgstr "" -#: ../../c-api/typeobj.rst:2260 +#: ../../c-api/typeobj.rst:2560 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -3586,7 +4079,7 @@ msgstr "" " binaryfunc nb_inplace_matrix_multiply;\n" "} PyNumberMethods;" -#: ../../c-api/typeobj.rst:2305 +#: ../../c-api/typeobj.rst:2605 msgid "" "Binary and ternary functions must check the type of all their operands, and " "implement the necessary conversions (at least one of the operands is an " @@ -3596,81 +4089,82 @@ msgid "" "and set an exception." msgstr "" -#: ../../c-api/typeobj.rst:2314 +#: ../../c-api/typeobj.rst:2614 msgid "" "The :c:member:`~PyNumberMethods.nb_reserved` field should always be " "``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " "Python 3.0.1." msgstr "" -#: ../../c-api/typeobj.rst:2359 +#: ../../c-api/typeobj.rst:2659 msgid "Mapping Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2366 +#: ../../c-api/typeobj.rst:2666 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the mapping protocol. It has three members:" msgstr "" -#: ../../c-api/typeobj.rst:2371 +#: ../../c-api/typeobj.rst:2671 msgid "" -"This function is used by :c:func:`PyMapping_Size` and :c:func:" -"`PyObject_Size`, and has the same signature. This slot may be set to " -"``NULL`` if the object has no defined length." +"This function is used by :c:func:`PyMapping_Size` " +"and :c:func:`PyObject_Size`, and has the same signature. This slot may be " +"set to ``NULL`` if the object has no defined length." msgstr "" -#: ../../c-api/typeobj.rst:2377 +#: ../../c-api/typeobj.rst:2677 msgid "" -"This function is used by :c:func:`PyObject_GetItem` and :c:func:" -"`PySequence_GetSlice`, and has the same signature as :c:func:`!" -"PyObject_GetItem`. This slot must be filled for the :c:func:" -"`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." +"This function is used by :c:func:`PyObject_GetItem` " +"and :c:func:`PySequence_GetSlice`, and has the same signature as :c:func:`!" +"PyObject_GetItem`. This slot must be filled for " +"the :c:func:`PyMapping_Check` function to return ``1``, it can be ``NULL`` " +"otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2385 +#: ../../c-api/typeobj.rst:2685 msgid "" -"This function is used by :c:func:`PyObject_SetItem`, :c:func:" -"`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" -"`PySequence_DelSlice`. It has the same signature as :c:func:`!" +"This function is used " +"by :c:func:`PyObject_SetItem`, :c:func:`PyObject_DelItem`, :c:func:`PySequence_SetSlice` " +"and :c:func:`PySequence_DelSlice`. It has the same signature as :c:func:`!" "PyObject_SetItem`, but *v* can also be set to ``NULL`` to delete an item. " "If this slot is ``NULL``, the object does not support item assignment and " "deletion." msgstr "" -#: ../../c-api/typeobj.rst:2396 +#: ../../c-api/typeobj.rst:2696 msgid "Sequence Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2403 +#: ../../c-api/typeobj.rst:2703 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: ../../c-api/typeobj.rst:2408 +#: ../../c-api/typeobj.rst:2708 msgid "" -"This function is used by :c:func:`PySequence_Size` and :c:func:" -"`PyObject_Size`, and has the same signature. It is also used for handling " -"negative indices via the :c:member:`~PySequenceMethods.sq_item` and the :c:" -"member:`~PySequenceMethods.sq_ass_item` slots." +"This function is used by :c:func:`PySequence_Size` " +"and :c:func:`PyObject_Size`, and has the same signature. It is also used " +"for handling negative indices via the :c:member:`~PySequenceMethods.sq_item` " +"and the :c:member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: ../../c-api/typeobj.rst:2415 +#: ../../c-api/typeobj.rst:2715 msgid "" "This function is used by :c:func:`PySequence_Concat` and has the same " "signature. It is also used by the ``+`` operator, after trying the numeric " "addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2421 +#: ../../c-api/typeobj.rst:2721 msgid "" "This function is used by :c:func:`PySequence_Repeat` and has the same " "signature. It is also used by the ``*`` operator, after trying numeric " "multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2427 +#: ../../c-api/typeobj.rst:2727 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -3679,42 +4173,43 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2433 +#: ../../c-api/typeobj.rst:2733 msgid "" -"Negative indexes are handled as follows: if the :c:member:" -"`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " -"length is used to compute a positive index which is passed to :c:member:" -"`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is ``NULL``, the " -"index is passed as is to the function." +"Negative indexes are handled as follows: if " +"the :c:member:`~PySequenceMethods.sq_length` slot is filled, it is called " +"and the sequence length is used to compute a positive index which is passed " +"to :c:member:`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is " +"``NULL``, the index is passed as is to the function." msgstr "" -#: ../../c-api/typeobj.rst:2440 +#: ../../c-api/typeobj.rst:2740 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " -"signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" -"`PyObject_DelItem`, after trying the item assignment and deletion via the :c:" -"member:`~PyMappingMethods.mp_ass_subscript` slot. This slot may be left to " -"``NULL`` if the object does not support item assignment and deletion." +"signature. It is also used by :c:func:`PyObject_SetItem` " +"and :c:func:`PyObject_DelItem`, after trying the item assignment and " +"deletion via the :c:member:`~PyMappingMethods.mp_ass_subscript` slot. This " +"slot may be left to ``NULL`` if the object does not support item assignment " +"and deletion." msgstr "" -#: ../../c-api/typeobj.rst:2449 +#: ../../c-api/typeobj.rst:2749 msgid "" "This function may be used by :c:func:`PySequence_Contains` and has the same " "signature. This slot may be left to ``NULL``, in this case :c:func:`!" "PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -#: ../../c-api/typeobj.rst:2456 +#: ../../c-api/typeobj.rst:2756 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " "may be left to ``NULL``, in this case :c:func:`!PySequence_InPlaceConcat` " "will fall back to :c:func:`PySequence_Concat`. It is also used by the " -"augmented assignment ``+=``, after trying numeric in-place addition via the :" -"c:member:`~PyNumberMethods.nb_inplace_add` slot." +"augmented assignment ``+=``, after trying numeric in-place addition via " +"the :c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2465 +#: ../../c-api/typeobj.rst:2765 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3724,76 +4219,76 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2476 +#: ../../c-api/typeobj.rst:2776 msgid "Buffer Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2484 +#: ../../c-api/typeobj.rst:2784 msgid "" "This structure holds pointers to the functions required by the :ref:`Buffer " "protocol `. The protocol defines how an exporter object can " "expose its internal data to consumer objects." msgstr "" -#: ../../c-api/typeobj.rst:2490 ../../c-api/typeobj.rst:2539 -#: ../../c-api/typeobj.rst:2593 ../../c-api/typeobj.rst:2604 -#: ../../c-api/typeobj.rst:2616 ../../c-api/typeobj.rst:2626 +#: ../../c-api/typeobj.rst:2790 ../../c-api/typeobj.rst:2839 +#: ../../c-api/typeobj.rst:2893 ../../c-api/typeobj.rst:2904 +#: ../../c-api/typeobj.rst:2916 ../../c-api/typeobj.rst:2926 msgid "The signature of this function is::" msgstr "" -#: ../../c-api/typeobj.rst:2492 +#: ../../c-api/typeobj.rst:2792 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" msgstr "int (PyObject *exporter, Py_buffer *view, int flags);" -#: ../../c-api/typeobj.rst:2494 +#: ../../c-api/typeobj.rst:2794 msgid "" "Handle a request to *exporter* to fill in *view* as specified by *flags*. " "Except for point (3), an implementation of this function MUST take these " "steps:" msgstr "" -#: ../../c-api/typeobj.rst:2498 +#: ../../c-api/typeobj.rst:2798 msgid "" -"Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" -"expr:`view->obj` to ``NULL`` and return ``-1``." +"Check if the request can be met. If not, raise :exc:`BufferError`, " +"set :c:expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:2501 +#: ../../c-api/typeobj.rst:2801 msgid "Fill in the requested fields." msgstr "" -#: ../../c-api/typeobj.rst:2503 +#: ../../c-api/typeobj.rst:2803 msgid "Increment an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2505 +#: ../../c-api/typeobj.rst:2805 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: ../../c-api/typeobj.rst:2507 +#: ../../c-api/typeobj.rst:2807 msgid "Return ``0``." msgstr "回傳 ``0``。" -#: ../../c-api/typeobj.rst:2509 +#: ../../c-api/typeobj.rst:2809 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: ../../c-api/typeobj.rst:2512 +#: ../../c-api/typeobj.rst:2812 msgid "" -"Re-export: Each member of the tree acts as the exporting object and sets :c:" -"expr:`view->obj` to a new reference to itself." +"Re-export: Each member of the tree acts as the exporting object and " +"sets :c:expr:`view->obj` to a new reference to itself." msgstr "" -#: ../../c-api/typeobj.rst:2515 +#: ../../c-api/typeobj.rst:2815 msgid "" "Redirect: The buffer request is redirected to the root object of the tree. " "Here, :c:expr:`view->obj` will be a new reference to the root object." msgstr "" -#: ../../c-api/typeobj.rst:2519 +#: ../../c-api/typeobj.rst:2819 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure `, the rules how an exporter must react to " @@ -3801,32 +4296,31 @@ msgid "" "types>`." msgstr "" -#: ../../c-api/typeobj.rst:2524 +#: ../../c-api/typeobj.rst:2824 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " -"exporter and must remain valid until there are no consumers left. :c:member:" -"`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer." -"strides`, :c:member:`~Py_buffer.suboffsets` and :c:member:`~Py_buffer." -"internal` are read-only for the consumer." +"exporter and must remain valid until there are no consumers " +"left. :c:member:`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides`, :c:member:`~Py_buffer.suboffsets` " +"and :c:member:`~Py_buffer.internal` are read-only for the consumer." msgstr "" -#: ../../c-api/typeobj.rst:2531 +#: ../../c-api/typeobj.rst:2831 msgid "" ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " "buffer while dealing correctly with all request types." msgstr "" -#: ../../c-api/typeobj.rst:2534 +#: ../../c-api/typeobj.rst:2834 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: ../../c-api/typeobj.rst:2541 +#: ../../c-api/typeobj.rst:2841 msgid "void (PyObject *exporter, Py_buffer *view);" msgstr "void (PyObject *exporter, Py_buffer *view);" -#: ../../c-api/typeobj.rst:2543 +#: ../../c-api/typeobj.rst:2843 msgid "" "Handle a request to release the resources of the buffer. If no resources " "need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " @@ -3834,15 +4328,15 @@ msgid "" "these optional steps:" msgstr "" -#: ../../c-api/typeobj.rst:2548 +#: ../../c-api/typeobj.rst:2848 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2550 +#: ../../c-api/typeobj.rst:2850 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: ../../c-api/typeobj.rst:2552 +#: ../../c-api/typeobj.rst:2852 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " @@ -3850,30 +4344,30 @@ msgid "" "*view* argument." msgstr "" -#: ../../c-api/typeobj.rst:2558 +#: ../../c-api/typeobj.rst:2858 msgid "" "This function MUST NOT decrement :c:expr:`view->obj`, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" -#: ../../c-api/typeobj.rst:2563 +#: ../../c-api/typeobj.rst:2863 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: ../../c-api/typeobj.rst:2571 +#: ../../c-api/typeobj.rst:2871 msgid "Async Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2579 +#: ../../c-api/typeobj.rst:2879 msgid "" -"This structure holds pointers to the functions required to implement :term:" -"`awaitable` and :term:`asynchronous iterator` objects." +"This structure holds pointers to the functions required to " +"implement :term:`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: ../../c-api/typeobj.rst:2584 +#: ../../c-api/typeobj.rst:2884 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -3889,149 +4383,150 @@ msgstr "" " sendfunc am_send;\n" "} PyAsyncMethods;" -#: ../../c-api/typeobj.rst:2595 +#: ../../c-api/typeobj.rst:2895 msgid "PyObject *am_await(PyObject *self);" msgstr "" -#: ../../c-api/typeobj.rst:2597 +#: ../../c-api/typeobj.rst:2897 msgid "" "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " "must return ``1`` for it." msgstr "" -#: ../../c-api/typeobj.rst:2600 +#: ../../c-api/typeobj.rst:2900 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: ../../c-api/typeobj.rst:2606 +#: ../../c-api/typeobj.rst:2906 msgid "PyObject *am_aiter(PyObject *self);" msgstr "PyObject *am_aiter(PyObject *self);" -#: ../../c-api/typeobj.rst:2608 +#: ../../c-api/typeobj.rst:2908 msgid "" -"Must return an :term:`asynchronous iterator` object. See :meth:`~object." -"__anext__` for details." +"Must return an :term:`asynchronous iterator` object. " +"See :meth:`~object.__anext__` for details." msgstr "" -#: ../../c-api/typeobj.rst:2611 +#: ../../c-api/typeobj.rst:2911 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: ../../c-api/typeobj.rst:2618 +#: ../../c-api/typeobj.rst:2918 msgid "PyObject *am_anext(PyObject *self);" msgstr "PyObject *am_anext(PyObject *self);" -#: ../../c-api/typeobj.rst:2620 +#: ../../c-api/typeobj.rst:2920 msgid "" "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " "details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2628 +#: ../../c-api/typeobj.rst:2928 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" -#: ../../c-api/typeobj.rst:2630 +#: ../../c-api/typeobj.rst:2930 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2639 +#: ../../c-api/typeobj.rst:2939 msgid "Slot Type typedefs" msgstr "" -#: ../../c-api/typeobj.rst:2643 +#: ../../c-api/typeobj.rst:2943 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " "length for the instance, suitably aligned, and initialized to zeros, but " -"with :c:member:`~PyObject.ob_refcnt` set to ``1`` and :c:member:`~PyObject." -"ob_type` set to the type argument. If the type's :c:member:`~PyTypeObject." -"tp_itemsize` is non-zero, the object's :c:member:`~PyVarObject.ob_size` " -"field should be initialized to *nitems* and the length of the allocated " -"memory block should be ``tp_basicsize + nitems*tp_itemsize``, rounded up to " -"a multiple of ``sizeof(void*)``; otherwise, *nitems* is not used and the " -"length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." +"with :c:member:`~PyObject.ob_refcnt` set to ``1`` " +"and :c:member:`~PyObject.ob_type` set to the type argument. If the " +"type's :c:member:`~PyTypeObject.tp_itemsize` is non-zero, the " +"object's :c:member:`~PyVarObject.ob_size` field should be initialized to " +"*nitems* and the length of the allocated memory block should be " +"``tp_basicsize + nitems*tp_itemsize``, rounded up to a multiple of " +"``sizeof(void*)``; otherwise, *nitems* is not used and the length of the " +"block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:2653 +#: ../../c-api/typeobj.rst:2953 msgid "" "This function should not do any other instance initialization, not even to " -"allocate additional memory; that should be done by :c:member:`~PyTypeObject." -"tp_new`." +"allocate additional memory; that should be done " +"by :c:member:`~PyTypeObject.tp_new`." msgstr "" -#: ../../c-api/typeobj.rst:2660 +#: ../../c-api/typeobj.rst:2960 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "請見 :c:member:`~PyTypeObject.tp_free`。" -#: ../../c-api/typeobj.rst:2664 +#: ../../c-api/typeobj.rst:2964 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "請見 :c:member:`~PyTypeObject.tp_new`。" -#: ../../c-api/typeobj.rst:2668 +#: ../../c-api/typeobj.rst:2968 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "請見 :c:member:`~PyTypeObject.tp_init`。" -#: ../../c-api/typeobj.rst:2672 +#: ../../c-api/typeobj.rst:2972 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "請見 :c:member:`~PyTypeObject.tp_repr`。" -#: ../../c-api/typeobj.rst:2676 ../../c-api/typeobj.rst:2685 +#: ../../c-api/typeobj.rst:2976 ../../c-api/typeobj.rst:2985 msgid "Return the value of the named attribute for the object." msgstr "" -#: ../../c-api/typeobj.rst:2680 ../../c-api/typeobj.rst:2691 +#: ../../c-api/typeobj.rst:2980 ../../c-api/typeobj.rst:2991 msgid "" "Set the value of the named attribute for the object. The value argument is " "set to ``NULL`` to delete the attribute." msgstr "" -#: ../../c-api/typeobj.rst:2687 +#: ../../c-api/typeobj.rst:2987 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_getattro`。" -#: ../../c-api/typeobj.rst:2694 +#: ../../c-api/typeobj.rst:2994 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_setattro`。" -#: ../../c-api/typeobj.rst:2698 +#: ../../c-api/typeobj.rst:2998 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_get`。" -#: ../../c-api/typeobj.rst:2702 +#: ../../c-api/typeobj.rst:3002 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_set`。" -#: ../../c-api/typeobj.rst:2706 +#: ../../c-api/typeobj.rst:3006 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "請見 :c:member:`~PyTypeObject.tp_hash`。" -#: ../../c-api/typeobj.rst:2710 +#: ../../c-api/typeobj.rst:3010 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" -#: ../../c-api/typeobj.rst:2714 +#: ../../c-api/typeobj.rst:3014 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "請見 :c:member:`~PyTypeObject.tp_iter`。" -#: ../../c-api/typeobj.rst:2718 +#: ../../c-api/typeobj.rst:3018 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "請見 :c:member:`~PyTypeObject.tp_iternext`。" -#: ../../c-api/typeobj.rst:2732 +#: ../../c-api/typeobj.rst:3032 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "請見 :c:member:`~PyAsyncMethods.am_send`。" -#: ../../c-api/typeobj.rst:2748 +#: ../../c-api/typeobj.rst:3048 msgid "Examples" msgstr "範例" -#: ../../c-api/typeobj.rst:2750 +#: ../../c-api/typeobj.rst:3050 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -4039,11 +4534,11 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: ../../c-api/typeobj.rst:2755 +#: ../../c-api/typeobj.rst:3055 msgid "A basic :ref:`static type `::" msgstr "" -#: ../../c-api/typeobj.rst:2757 +#: ../../c-api/typeobj.rst:3057 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4061,13 +4556,13 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2772 +#: ../../c-api/typeobj.rst:3072 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: ../../c-api/typeobj.rst:2775 +#: ../../c-api/typeobj.rst:3075 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4151,11 +4646,11 @@ msgstr "" " myobj_new, /* tp_new */\n" "};" -#: ../../c-api/typeobj.rst:2816 +#: ../../c-api/typeobj.rst:3116 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: ../../c-api/typeobj.rst:2818 +#: ../../c-api/typeobj.rst:3118 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4181,14 +4676,14 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2841 +#: ../../c-api/typeobj.rst:3141 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " -"instances (e.g. uses a separate factory func) using :c:macro:" -"`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" +"instances (e.g. uses a separate factory func) " +"using :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" -#: ../../c-api/typeobj.rst:2845 +#: ../../c-api/typeobj.rst:3145 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -4206,12 +4701,12 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2860 +#: ../../c-api/typeobj.rst:3160 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" -#: ../../c-api/typeobj.rst:2862 +#: ../../c-api/typeobj.rst:3162 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4231,13 +4726,13 @@ msgstr "" " .tp_name = \"mymod.MyObject\",\n" "};" -#: ../../c-api/typeobj.rst:2871 +#: ../../c-api/typeobj.rst:3171 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" msgstr "" -#: ../../c-api/typeobj.rst:2873 +#: ../../c-api/typeobj.rst:3173 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n" @@ -4263,14 +4758,14 @@ msgstr "" " .tp_itemsize = sizeof(char *),\n" "};" -#: ../../c-api/typeobj.rst:843 ../../c-api/typeobj.rst:908 +#: ../../c-api/typeobj.rst:912 ../../c-api/typeobj.rst:977 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/typeobj.rst:843 +#: ../../c-api/typeobj.rst:912 msgid "repr" msgstr "repr" -#: ../../c-api/typeobj.rst:908 +#: ../../c-api/typeobj.rst:977 msgid "hash" msgstr "hash(雜湊)" diff --git a/c-api/unicode.po b/c-api/unicode.po index 71b90e9650a..31444c21c29 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-27 07:36+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -61,94 +61,73 @@ msgid "" "in Python:" msgstr "這些是 Python 中用於 Unicode 實作的基本 Unicode 物件型別:" -#: ../../c-api/unicode.rst:38 +#: ../../c-api/unicode.rst:36 msgid "" -"These types are typedefs for unsigned integer types wide enough to contain " -"characters of 32 bits, 16 bits and 8 bits, respectively. When dealing with " -"single Unicode characters, use :c:type:`Py_UCS4`." +"This instance of :c:type:`PyTypeObject` represents the Python Unicode type. " +"It is exposed to Python code as :py:class:`str`." msgstr "" -#: ../../c-api/unicode.rst:47 +#: ../../c-api/unicode.rst:42 msgid "" -"This is a typedef of :c:type:`wchar_t`, which is a 16-bit type or 32-bit " -"type depending on the platform." +"This instance of :c:type:`PyTypeObject` represents the Python Unicode " +"iterator type. It is used to iterate over Unicode string objects." msgstr "" #: ../../c-api/unicode.rst:50 msgid "" -"In previous versions, this was a 16-bit type or a 32-bit type depending on " -"whether you selected a \"narrow\" or \"wide\" Unicode version of Python at " -"build time." +"These types are typedefs for unsigned integer types wide enough to contain " +"characters of 32 bits, 16 bits and 8 bits, respectively. When dealing with " +"single Unicode characters, use :c:type:`Py_UCS4`." msgstr "" -#: ../../c-api/unicode.rst:62 +#: ../../c-api/unicode.rst:61 msgid "" "These subtypes of :c:type:`PyObject` represent a Python Unicode object. In " "almost all cases, they shouldn't be used directly, since all API functions " "that deal with Unicode objects take and return :c:type:`PyObject` pointers." msgstr "" -#: ../../c-api/unicode.rst:71 -msgid "" -"This instance of :c:type:`PyTypeObject` represents the Python Unicode type. " -"It is exposed to Python code as ``str``." -msgstr "" - -#: ../../c-api/unicode.rst:77 -msgid "" -"This instance of :c:type:`PyTypeObject` represents the Python Unicode " -"iterator type. It is used to iterate over Unicode string objects." -msgstr "" - -#: ../../c-api/unicode.rst:81 +#: ../../c-api/unicode.rst:68 msgid "" "The following APIs are C macros and static inlined functions for fast checks " "and access to internal read-only data of Unicode objects:" msgstr "" -#: ../../c-api/unicode.rst:86 +#: ../../c-api/unicode.rst:73 msgid "" "Return true if the object *obj* is a Unicode object or an instance of a " "Unicode subtype. This function always succeeds." msgstr "" -#: ../../c-api/unicode.rst:92 +#: ../../c-api/unicode.rst:79 msgid "" "Return true if the object *obj* is a Unicode object, but not an instance of " "a subtype. This function always succeeds." msgstr "" -#: ../../c-api/unicode.rst:98 -msgid "Returns ``0``. This API is kept only for backward compatibility." -msgstr "回傳 ``0``。此 API 僅保留以維持向後相容性。" - -#: ../../c-api/unicode.rst:102 -msgid "This API does nothing since Python 3.12." -msgstr "自 Python 3.12 起,此 API 不再執行任何動作。" - -#: ../../c-api/unicode.rst:108 +#: ../../c-api/unicode.rst:85 msgid "" "Return the length of the Unicode string, in code points. *unicode* has to " "be a Unicode object in the \"canonical\" representation (not checked)." msgstr "" -#: ../../c-api/unicode.rst:118 +#: ../../c-api/unicode.rst:95 msgid "" "Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 " "integer types for direct character access. No checks are performed if the " -"canonical representation has the correct character size; use :c:func:" -"`PyUnicode_KIND` to select the right function." +"canonical representation has the correct character size; " +"use :c:func:`PyUnicode_KIND` to select the right function." msgstr "" -#: ../../c-api/unicode.rst:130 +#: ../../c-api/unicode.rst:107 msgid "Return values of the :c:func:`PyUnicode_KIND` macro." msgstr "" -#: ../../c-api/unicode.rst:134 +#: ../../c-api/unicode.rst:111 msgid "``PyUnicode_WCHAR_KIND`` has been removed." msgstr "``PyUnicode_WCHAR_KIND`` 已被移除。" -#: ../../c-api/unicode.rst:140 +#: ../../c-api/unicode.rst:117 msgid "" "Return one of the PyUnicode kind constants (see above) that indicate how " "many bytes per character this Unicode object uses to store its data. " @@ -156,113 +135,129 @@ msgid "" "(not checked)." msgstr "" -#: ../../c-api/unicode.rst:149 +#: ../../c-api/unicode.rst:126 msgid "" "Return a void pointer to the raw Unicode buffer. *unicode* has to be a " "Unicode object in the \"canonical\" representation (not checked)." msgstr "" -#: ../../c-api/unicode.rst:158 +#: ../../c-api/unicode.rst:135 +msgid "" +"Write the code point *value* to the given zero-based *index* in a string." +msgstr "" + +#: ../../c-api/unicode.rst:137 msgid "" -"Write into a canonical representation *data* (as obtained with :c:func:" -"`PyUnicode_DATA`). This function performs no sanity checks, and is intended " -"for usage in loops. The caller should cache the *kind* value and *data* " -"pointer as obtained from other calls. *index* is the index in the string " -"(starts at 0) and *value* is the new code point value which should be " -"written to that location." +"The *kind* value and *data* pointer must have been obtained from a string " +"using :c:func:`PyUnicode_KIND` and :c:func:`PyUnicode_DATA` respectively. " +"You must hold a reference to that string while calling :c:func:`!" +"PyUnicode_WRITE`. All requirements of :c:func:`PyUnicode_WriteChar` also " +"apply." msgstr "" -#: ../../c-api/unicode.rst:171 +#: ../../c-api/unicode.rst:143 msgid "" -"Read a code point from a canonical representation *data* (as obtained with :" -"c:func:`PyUnicode_DATA`). No checks or ready calls are performed." +"The function performs no checks for any of its requirements, and is intended " +"for usage in loops." msgstr "" -#: ../../c-api/unicode.rst:179 +#: ../../c-api/unicode.rst:152 +msgid "" +"Read a code point from a canonical representation *data* (as obtained " +"with :c:func:`PyUnicode_DATA`). No checks or ready calls are performed." +msgstr "" + +#: ../../c-api/unicode.rst:160 msgid "" "Read a character from a Unicode object *unicode*, which must be in the " -"\"canonical\" representation. This is less efficient than :c:func:" -"`PyUnicode_READ` if you do multiple consecutive reads." +"\"canonical\" representation. This is less efficient " +"than :c:func:`PyUnicode_READ` if you do multiple consecutive reads." msgstr "" -#: ../../c-api/unicode.rst:188 +#: ../../c-api/unicode.rst:169 msgid "" "Return the maximum code point that is suitable for creating another string " "based on *unicode*, which must be in the \"canonical\" representation. This " "is always an approximation but more efficient than iterating over the string." msgstr "" -#: ../../c-api/unicode.rst:197 +#: ../../c-api/unicode.rst:178 msgid "" "Return ``1`` if the string is a valid identifier according to the language " "definition, section :ref:`identifiers`. Return ``0`` otherwise." msgstr "" -#: ../../c-api/unicode.rst:200 +#: ../../c-api/unicode.rst:181 msgid "" "The function does not call :c:func:`Py_FatalError` anymore if the string is " "not ready." msgstr "" -#: ../../c-api/unicode.rst:206 +#: ../../c-api/unicode.rst:188 +msgid "" +"Return true if the string only contains ASCII characters. Equivalent " +"to :py:meth:`str.isascii`." +msgstr "" + +#: ../../c-api/unicode.rst:195 msgid "Unicode Character Properties" msgstr "" -#: ../../c-api/unicode.rst:208 +#: ../../c-api/unicode.rst:197 msgid "" "Unicode provides many different character properties. The most often needed " "ones are available through these macros which are mapped to C functions " "depending on the Python configuration." msgstr "" -#: ../../c-api/unicode.rst:215 +#: ../../c-api/unicode.rst:204 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a whitespace character." msgstr "根據 *ch* 是否為空白字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:220 +#: ../../c-api/unicode.rst:209 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a lowercase character." msgstr "根據 *ch* 是否為小寫字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:225 +#: ../../c-api/unicode.rst:214 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an uppercase character." msgstr "根據 *ch* 是否為大寫字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:230 +#: ../../c-api/unicode.rst:219 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a titlecase character." msgstr "根據 *ch* 是否為首字大寫字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:235 +#: ../../c-api/unicode.rst:224 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a linebreak character." msgstr "根據 *ch* 是否為換行字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:240 +#: ../../c-api/unicode.rst:229 msgid "Return ``1`` or ``0`` depending on whether *ch* is a decimal character." msgstr "根據 *ch* 是否為十進位字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:245 +#: ../../c-api/unicode.rst:234 msgid "Return ``1`` or ``0`` depending on whether *ch* is a digit character." msgstr "根據 *ch* 是否為數字 (digit) 字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:250 +#: ../../c-api/unicode.rst:239 msgid "Return ``1`` or ``0`` depending on whether *ch* is a numeric character." msgstr "根據 *ch* 是否為數值 (numeric) 字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:255 +#: ../../c-api/unicode.rst:244 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphabetic character." msgstr "根據 *ch* 是否為字母字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:260 +#: ../../c-api/unicode.rst:249 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphanumeric character." msgstr "根據 *ch* 是否為字母數字 (alphanumeric) 字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:265 +#: ../../c-api/unicode.rst:254 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a printable character, in " "the sense of :meth:`str.isprintable`." @@ -270,23 +265,23 @@ msgstr "" "根據 *ch* 是否為可列印字元(如 :meth:`str.isprintable` 所定義)來回傳 ``1`` " "或 ``0``。" -#: ../../c-api/unicode.rst:269 +#: ../../c-api/unicode.rst:258 msgid "These APIs can be used for fast direct character conversions:" msgstr "這些 API 可用於快速直接字元轉換:" -#: ../../c-api/unicode.rst:274 +#: ../../c-api/unicode.rst:263 msgid "Return the character *ch* converted to lower case." msgstr "回傳轉換為小寫的 *ch* 字元。" -#: ../../c-api/unicode.rst:279 +#: ../../c-api/unicode.rst:268 msgid "Return the character *ch* converted to upper case." msgstr "回傳轉換為大寫的 *ch* 字元。" -#: ../../c-api/unicode.rst:284 +#: ../../c-api/unicode.rst:273 msgid "Return the character *ch* converted to title case." msgstr "回傳轉換為首字大寫的 *ch* 字元。" -#: ../../c-api/unicode.rst:289 +#: ../../c-api/unicode.rst:278 msgid "" "Return the character *ch* converted to a decimal positive integer. Return " "``-1`` if this is not possible. This function does not raise exceptions." @@ -294,7 +289,7 @@ msgstr "" "回傳轉換為十進位正整數的 *ch* 字元,若無法轉換則回傳 ``-1``。此函式不會引發例" "外。" -#: ../../c-api/unicode.rst:295 +#: ../../c-api/unicode.rst:284 msgid "" "Return the character *ch* converted to a single digit integer. Return ``-1`` " "if this is not possible. This function does not raise exceptions." @@ -302,7 +297,7 @@ msgstr "" "回傳轉換為單一數字整數的 *ch* 字元,若無法轉換則回傳 ``-1``。此函式不會引發例" "外。" -#: ../../c-api/unicode.rst:301 +#: ../../c-api/unicode.rst:290 msgid "" "Return the character *ch* converted to a double. Return ``-1.0`` if this is " "not possible. This function does not raise exceptions." @@ -310,25 +305,25 @@ msgstr "" "回傳轉換為雙精度浮點數 (double) 的 *ch* 字元,若無法轉換則回傳 ``-1.0``。此函" "式不會引發例外。" -#: ../../c-api/unicode.rst:305 +#: ../../c-api/unicode.rst:294 msgid "These APIs can be used to work with surrogates:" msgstr "這些 API 可用於處理代理字元:" -#: ../../c-api/unicode.rst:309 +#: ../../c-api/unicode.rst:298 msgid "Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``)." msgstr "檢查 *ch* 是否為代理字元 (surrogate, ``0xD800 <= ch <= 0xDFFF``)。" -#: ../../c-api/unicode.rst:313 +#: ../../c-api/unicode.rst:302 msgid "Check if *ch* is a high surrogate (``0xD800 <= ch <= 0xDBFF``)." msgstr "" "檢查 *ch* 是否為高代理字元 (high surrogate, ``0xD800 <= ch <= 0xDBFF``)。" -#: ../../c-api/unicode.rst:317 +#: ../../c-api/unicode.rst:306 msgid "Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``)." msgstr "" "檢查 *ch* 是否為低代理字元 (low surrogate, ``0xDC00 <= ch <= 0xDFFF``)。" -#: ../../c-api/unicode.rst:321 +#: ../../c-api/unicode.rst:310 msgid "" "Join two surrogate code points and return a single :c:type:`Py_UCS4` value. " "*high* and *low* are respectively the leading and trailing surrogates in a " @@ -336,50 +331,86 @@ msgid "" "be in the range [0xDC00; 0xDFFF]." msgstr "" -#: ../../c-api/unicode.rst:328 +#: ../../c-api/unicode.rst:317 msgid "Creating and accessing Unicode strings" msgstr "" -#: ../../c-api/unicode.rst:330 +#: ../../c-api/unicode.rst:319 msgid "" "To create Unicode objects and access their basic sequence properties, use " "these APIs:" msgstr "" -#: ../../c-api/unicode.rst:335 +#: ../../c-api/unicode.rst:324 msgid "" "Create a new Unicode object. *maxchar* should be the true maximum code " "point to be placed in the string. As an approximation, it can be rounded up " "to the nearest value in the sequence 127, 255, 65535, 1114111." msgstr "" -#: ../../c-api/unicode.rst:339 +#: ../../c-api/unicode.rst:328 +msgid "On error, set an exception and return ``NULL``." +msgstr "" + +#: ../../c-api/unicode.rst:330 msgid "" -"This is the recommended way to allocate a new Unicode object. Objects " -"created using this function are not resizable." +"After creation, the string can be filled " +"by :c:func:`PyUnicode_WriteChar`, :c:func:`PyUnicode_CopyCharacters`, :c:func:`PyUnicode_Fill`, :c:func:`PyUnicode_WRITE` " +"or similar. Since strings are supposed to be immutable, take care to not " +"“use” the result while it is being modified. In particular, before it's " +"filled with its final contents, a string:" msgstr "" -#: ../../c-api/unicode.rst:342 -msgid "On error, set an exception and return ``NULL``." +#: ../../c-api/unicode.rst:337 +#, fuzzy +msgid "must not be hashed," +msgstr "*sep* 不得為空。" + +#: ../../c-api/unicode.rst:338 +msgid "" +"must not be :c:func:`converted to UTF-8 `, or " +"another non-\"canonical\" representation," +msgstr "" + +#: ../../c-api/unicode.rst:340 +msgid "must not have its reference count changed," +msgstr "" + +#: ../../c-api/unicode.rst:341 +msgid "must not be shared with code that might do one of the above." +msgstr "" + +#: ../../c-api/unicode.rst:343 +msgid "" +"This list is not exhaustive. Avoiding these uses is your responsibility; " +"Python does not always check these requirements." msgstr "" -#: ../../c-api/unicode.rst:350 +#: ../../c-api/unicode.rst:346 msgid "" -"Create a new Unicode object with the given *kind* (possible values are :c:" -"macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" -"`PyUnicode_KIND`). The *buffer* must point to an array of *size* units of " -"1, 2 or 4 bytes per character, as given by the kind." +"To avoid accidentally exposing a partially-written string object, prefer " +"using the :c:type:`PyUnicodeWriter` API, or one of the ``PyUnicode_From*`` " +"functions below." msgstr "" -#: ../../c-api/unicode.rst:355 +#: ../../c-api/unicode.rst:357 +msgid "" +"Create a new Unicode object with the given *kind* (possible values " +"are :c:macro:`PyUnicode_1BYTE_KIND` etc., as returned " +"by :c:func:`PyUnicode_KIND`). The *buffer* must point to an array of *size* " +"units of 1, 2 or 4 bytes per character, as given by the kind." +msgstr "" + +#: ../../c-api/unicode.rst:362 msgid "" "If necessary, the input *buffer* is copied and transformed into the " -"canonical representation. For example, if the *buffer* is a UCS4 string (:c:" -"macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the UCS1 " -"range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." +"canonical representation. For example, if the *buffer* is a UCS4 string " +"(:c:macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the " +"UCS1 range, it will be transformed into UCS1 " +"(:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" -#: ../../c-api/unicode.rst:366 +#: ../../c-api/unicode.rst:373 msgid "" "Create a Unicode object from the char buffer *str*. The bytes will be " "interpreted as being UTF-8 encoded. The buffer is copied into the new " @@ -387,29 +418,29 @@ msgid "" "data is not allowed." msgstr "" -#: ../../c-api/unicode.rst:372 +#: ../../c-api/unicode.rst:379 msgid "This function raises :exc:`SystemError` when:" msgstr "此函式在以下情況下會引發 :exc:`SystemError`:" -#: ../../c-api/unicode.rst:374 +#: ../../c-api/unicode.rst:381 msgid "*size* < 0," msgstr "*size* < 0," -#: ../../c-api/unicode.rst:375 +#: ../../c-api/unicode.rst:382 msgid "*str* is ``NULL`` and *size* > 0" msgstr "*str* 為 ``NULL`` 且 *size* > 0" -#: ../../c-api/unicode.rst:377 +#: ../../c-api/unicode.rst:384 msgid "*str* == ``NULL`` with *size* > 0 is not allowed anymore." msgstr "*str* == ``NULL`` 且 *size* > 0 不再被允許。" -#: ../../c-api/unicode.rst:383 +#: ../../c-api/unicode.rst:390 msgid "" "Create a Unicode object from a UTF-8 encoded null-terminated char buffer " "*str*." msgstr "" -#: ../../c-api/unicode.rst:389 +#: ../../c-api/unicode.rst:396 msgid "" "Take a C :c:func:`printf`\\ -style *format* string and a variable number of " "arguments, calculate the size of the resulting Python Unicode string and " @@ -418,31 +449,31 @@ msgid "" "*format* ASCII-encoded string." msgstr "" -#: ../../c-api/unicode.rst:395 +#: ../../c-api/unicode.rst:402 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../c-api/unicode.rst:398 +#: ../../c-api/unicode.rst:405 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../c-api/unicode.rst:400 +#: ../../c-api/unicode.rst:407 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../c-api/unicode.rst:403 +#: ../../c-api/unicode.rst:410 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " -"actual width is given in the next argument, which must be of type :c:expr:" -"`int`, and the object to convert comes after the minimum field width and " -"optional precision." +"actual width is given in the next argument, which must be of " +"type :c:expr:`int`, and the object to convert comes after the minimum field " +"width and optional precision." msgstr "" -#: ../../c-api/unicode.rst:408 +#: ../../c-api/unicode.rst:415 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. If " "specified as ``'*'`` (an asterisk), the actual precision is given in the " @@ -450,316 +481,316 @@ msgid "" "comes after the precision." msgstr "" -#: ../../c-api/unicode.rst:413 +#: ../../c-api/unicode.rst:420 msgid "Length modifier (optional)." msgstr "" -#: ../../c-api/unicode.rst:415 +#: ../../c-api/unicode.rst:422 msgid "Conversion type." msgstr "" -#: ../../c-api/unicode.rst:417 +#: ../../c-api/unicode.rst:424 msgid "The conversion flag characters are:" msgstr "" -#: ../../c-api/unicode.rst:422 +#: ../../c-api/unicode.rst:429 msgid "Flag" msgstr "旗標" -#: ../../c-api/unicode.rst:422 +#: ../../c-api/unicode.rst:429 msgid "Meaning" msgstr "含義" -#: ../../c-api/unicode.rst:424 +#: ../../c-api/unicode.rst:431 msgid "``0``" msgstr "``0``" -#: ../../c-api/unicode.rst:424 +#: ../../c-api/unicode.rst:431 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../c-api/unicode.rst:426 +#: ../../c-api/unicode.rst:433 msgid "``-``" msgstr "``-``" -#: ../../c-api/unicode.rst:426 +#: ../../c-api/unicode.rst:433 msgid "" "The converted value is left adjusted (overrides the ``0`` flag if both are " "given)." msgstr "" -#: ../../c-api/unicode.rst:430 +#: ../../c-api/unicode.rst:437 msgid "" "The length modifiers for following integer conversions (``d``, ``i``, ``o``, " "``u``, ``x``, or ``X``) specify the type of the argument (:c:expr:`int` by " "default):" msgstr "" -#: ../../c-api/unicode.rst:437 +#: ../../c-api/unicode.rst:444 msgid "Modifier" msgstr "" -#: ../../c-api/unicode.rst:437 +#: ../../c-api/unicode.rst:444 msgid "Types" msgstr "" -#: ../../c-api/unicode.rst:439 +#: ../../c-api/unicode.rst:446 msgid "``l``" msgstr "``l``" -#: ../../c-api/unicode.rst:439 +#: ../../c-api/unicode.rst:446 msgid ":c:expr:`long` or :c:expr:`unsigned long`" msgstr ":c:expr:`long` 或 :c:expr:`unsigned long`" -#: ../../c-api/unicode.rst:441 +#: ../../c-api/unicode.rst:448 msgid "``ll``" msgstr "``ll``" -#: ../../c-api/unicode.rst:441 +#: ../../c-api/unicode.rst:448 msgid ":c:expr:`long long` or :c:expr:`unsigned long long`" msgstr ":c:expr:`long long` 或 :c:expr:`unsigned long long`" -#: ../../c-api/unicode.rst:443 +#: ../../c-api/unicode.rst:450 msgid "``j``" msgstr "``j``" -#: ../../c-api/unicode.rst:443 +#: ../../c-api/unicode.rst:450 msgid ":c:type:`intmax_t` or :c:type:`uintmax_t`" msgstr ":c:type:`intmax_t` 或 :c:type:`uintmax_t`" -#: ../../c-api/unicode.rst:445 +#: ../../c-api/unicode.rst:452 msgid "``z``" msgstr "``z``" -#: ../../c-api/unicode.rst:445 +#: ../../c-api/unicode.rst:452 msgid ":c:type:`size_t` or :c:type:`ssize_t`" msgstr ":c:type:`size_t` 或 :c:type:`ssize_t`" -#: ../../c-api/unicode.rst:447 +#: ../../c-api/unicode.rst:454 msgid "``t``" msgstr "``t``" -#: ../../c-api/unicode.rst:447 +#: ../../c-api/unicode.rst:454 msgid ":c:type:`ptrdiff_t`" msgstr ":c:type:`ptrdiff_t`" -#: ../../c-api/unicode.rst:450 +#: ../../c-api/unicode.rst:457 msgid "" "The length modifier ``l`` for following conversions ``s`` or ``V`` specify " "that the type of the argument is :c:expr:`const wchar_t*`." msgstr "" -#: ../../c-api/unicode.rst:453 +#: ../../c-api/unicode.rst:460 msgid "The conversion specifiers are:" msgstr "" -#: ../../c-api/unicode.rst:459 +#: ../../c-api/unicode.rst:466 msgid "Conversion Specifier" msgstr "" -#: ../../c-api/unicode.rst:460 +#: ../../c-api/unicode.rst:467 msgid "Type" msgstr "" -#: ../../c-api/unicode.rst:461 +#: ../../c-api/unicode.rst:468 msgid "Comment" msgstr "" -#: ../../c-api/unicode.rst:463 +#: ../../c-api/unicode.rst:470 msgid "``%``" msgstr "``%``" -#: ../../c-api/unicode.rst:464 +#: ../../c-api/unicode.rst:471 msgid "*n/a*" msgstr "*n/a*" -#: ../../c-api/unicode.rst:465 +#: ../../c-api/unicode.rst:472 msgid "The literal ``%`` character." msgstr "字面 ``%`` 字元。" -#: ../../c-api/unicode.rst:467 +#: ../../c-api/unicode.rst:474 msgid "``d``, ``i``" msgstr "``d``, ``i``" -#: ../../c-api/unicode.rst:468 ../../c-api/unicode.rst:472 -#: ../../c-api/unicode.rst:476 ../../c-api/unicode.rst:480 -#: ../../c-api/unicode.rst:484 +#: ../../c-api/unicode.rst:475 ../../c-api/unicode.rst:479 +#: ../../c-api/unicode.rst:483 ../../c-api/unicode.rst:487 +#: ../../c-api/unicode.rst:491 msgid "Specified by the length modifier" msgstr "" -#: ../../c-api/unicode.rst:469 +#: ../../c-api/unicode.rst:476 msgid "The decimal representation of a signed C integer." msgstr "一個有符號 C 整數的十進位表示法。" -#: ../../c-api/unicode.rst:471 +#: ../../c-api/unicode.rst:478 msgid "``u``" msgstr "``u``" -#: ../../c-api/unicode.rst:473 +#: ../../c-api/unicode.rst:480 msgid "The decimal representation of an unsigned C integer." msgstr "一個無符號 C 整數的十進位表示法。" -#: ../../c-api/unicode.rst:475 +#: ../../c-api/unicode.rst:482 msgid "``o``" msgstr "``o``" -#: ../../c-api/unicode.rst:477 +#: ../../c-api/unicode.rst:484 msgid "The octal representation of an unsigned C integer." msgstr "一個無符號 C 整數的八進位表示法。" -#: ../../c-api/unicode.rst:479 +#: ../../c-api/unicode.rst:486 msgid "``x``" msgstr "``x``" -#: ../../c-api/unicode.rst:481 +#: ../../c-api/unicode.rst:488 msgid "The hexadecimal representation of an unsigned C integer (lowercase)." msgstr "一個無符號 C 整數的十六進位表示法(小寫)。" -#: ../../c-api/unicode.rst:483 +#: ../../c-api/unicode.rst:490 msgid "``X``" msgstr "``X``" -#: ../../c-api/unicode.rst:485 +#: ../../c-api/unicode.rst:492 msgid "The hexadecimal representation of an unsigned C integer (uppercase)." msgstr "一個無符號 C 整數的十六進位表示法(大寫)。" -#: ../../c-api/unicode.rst:487 +#: ../../c-api/unicode.rst:494 msgid "``c``" msgstr "``c``" -#: ../../c-api/unicode.rst:488 +#: ../../c-api/unicode.rst:495 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../c-api/unicode.rst:489 +#: ../../c-api/unicode.rst:496 msgid "A single character." msgstr "一個單一字元。" -#: ../../c-api/unicode.rst:491 +#: ../../c-api/unicode.rst:498 msgid "``s``" msgstr "``s``" -#: ../../c-api/unicode.rst:492 +#: ../../c-api/unicode.rst:499 msgid ":c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:493 +#: ../../c-api/unicode.rst:500 msgid "A null-terminated C character array." msgstr "一個以 null 結尾的 C 字元陣列。" -#: ../../c-api/unicode.rst:495 +#: ../../c-api/unicode.rst:502 msgid "``p``" msgstr "``p``" -#: ../../c-api/unicode.rst:496 +#: ../../c-api/unicode.rst:503 msgid ":c:expr:`const void*`" msgstr ":c:expr:`const void*`" -#: ../../c-api/unicode.rst:497 +#: ../../c-api/unicode.rst:504 msgid "" "The hex representation of a C pointer. Mostly equivalent to " "``printf(\"%p\")`` except that it is guaranteed to start with the literal " "``0x`` regardless of what the platform's ``printf`` yields." msgstr "" -#: ../../c-api/unicode.rst:502 +#: ../../c-api/unicode.rst:509 msgid "``A``" msgstr "``A``" -#: ../../c-api/unicode.rst:503 ../../c-api/unicode.rst:507 -#: ../../c-api/unicode.rst:517 ../../c-api/unicode.rst:521 -#: ../../c-api/unicode.rst:525 ../../c-api/unicode.rst:530 +#: ../../c-api/unicode.rst:510 ../../c-api/unicode.rst:514 +#: ../../c-api/unicode.rst:524 ../../c-api/unicode.rst:528 +#: ../../c-api/unicode.rst:532 ../../c-api/unicode.rst:537 msgid ":c:expr:`PyObject*`" msgstr ":c:expr:`PyObject*`" -#: ../../c-api/unicode.rst:504 +#: ../../c-api/unicode.rst:511 msgid "The result of calling :func:`ascii`." msgstr "呼叫 :func:`ascii` 的結果。" -#: ../../c-api/unicode.rst:506 +#: ../../c-api/unicode.rst:513 msgid "``U``" msgstr "``U``" -#: ../../c-api/unicode.rst:508 +#: ../../c-api/unicode.rst:515 msgid "A Unicode object." msgstr "一個 Unicode 物件。" -#: ../../c-api/unicode.rst:510 +#: ../../c-api/unicode.rst:517 msgid "``V``" msgstr "``V``" -#: ../../c-api/unicode.rst:511 +#: ../../c-api/unicode.rst:518 msgid ":c:expr:`PyObject*`, :c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`PyObject*`、:c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:512 +#: ../../c-api/unicode.rst:519 msgid "" "A Unicode object (which may be ``NULL``) and a null-terminated C character " "array as a second parameter (which will be used, if the first parameter is " "``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:516 +#: ../../c-api/unicode.rst:523 msgid "``S``" msgstr "``S``" -#: ../../c-api/unicode.rst:518 +#: ../../c-api/unicode.rst:525 msgid "The result of calling :c:func:`PyObject_Str`." msgstr "呼叫 :c:func:`PyObject_Str` 的結果。" -#: ../../c-api/unicode.rst:520 +#: ../../c-api/unicode.rst:527 msgid "``R``" msgstr "``R``" -#: ../../c-api/unicode.rst:522 +#: ../../c-api/unicode.rst:529 msgid "The result of calling :c:func:`PyObject_Repr`." msgstr "呼叫 :c:func:`PyObject_Repr` 的結果。" -#: ../../c-api/unicode.rst:524 +#: ../../c-api/unicode.rst:531 msgid "``T``" msgstr "``T``" -#: ../../c-api/unicode.rst:526 +#: ../../c-api/unicode.rst:533 msgid "" -"Get the fully qualified name of an object type; call :c:func:" -"`PyType_GetFullyQualifiedName`." +"Get the fully qualified name of an object type; " +"call :c:func:`PyType_GetFullyQualifiedName`." msgstr "" -#: ../../c-api/unicode.rst:529 +#: ../../c-api/unicode.rst:536 msgid "``#T``" msgstr "``#T``" -#: ../../c-api/unicode.rst:531 +#: ../../c-api/unicode.rst:538 msgid "" "Similar to ``T`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" -#: ../../c-api/unicode.rst:534 +#: ../../c-api/unicode.rst:541 msgid "``N``" msgstr "``N``" -#: ../../c-api/unicode.rst:535 ../../c-api/unicode.rst:540 +#: ../../c-api/unicode.rst:542 ../../c-api/unicode.rst:547 msgid ":c:expr:`PyTypeObject*`" msgstr ":c:expr:`PyTypeObject*`" -#: ../../c-api/unicode.rst:536 +#: ../../c-api/unicode.rst:543 msgid "" -"Get the fully qualified name of a type; call :c:func:" -"`PyType_GetFullyQualifiedName`." +"Get the fully qualified name of a type; " +"call :c:func:`PyType_GetFullyQualifiedName`." msgstr "" -#: ../../c-api/unicode.rst:539 +#: ../../c-api/unicode.rst:546 msgid "``#N``" msgstr "``#N``" -#: ../../c-api/unicode.rst:541 +#: ../../c-api/unicode.rst:548 msgid "" "Similar to ``N`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" -#: ../../c-api/unicode.rst:545 +#: ../../c-api/unicode.rst:552 msgid "" "The width formatter unit is number of characters rather than bytes. The " "precision formatter unit is number of bytes or :c:type:`wchar_t` items (if " @@ -769,22 +800,22 @@ msgid "" "``PyObject*`` argument is not ``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:553 +#: ../../c-api/unicode.rst:560 msgid "" "Unlike to C :c:func:`printf` the ``0`` flag has effect even when a precision " "is given for integer conversions (``d``, ``i``, ``u``, ``o``, ``x``, or " "``X``)." msgstr "" -#: ../../c-api/unicode.rst:557 +#: ../../c-api/unicode.rst:564 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." msgstr "新增對 ``\"%lld\"`` 和 ``\"%llu\"`` 的支援。" -#: ../../c-api/unicode.rst:560 +#: ../../c-api/unicode.rst:567 msgid "Support for ``\"%li\"``, ``\"%lli\"`` and ``\"%zi\"`` added." msgstr "新增對 ``\"%li\"``、``\"%lli\"`` 和 ``\"%zi\"`` 的支援。" -#: ../../c-api/unicode.rst:563 +#: ../../c-api/unicode.rst:570 msgid "" "Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, " "``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." @@ -792,7 +823,7 @@ msgstr "" "新增對 ``\"%s\"``、``\"%A\"``、``\"%U\"``、``\"%V\"``、``\"%S\"``、" "``\"%R\"`` 的寬度和精確度格式化支援。" -#: ../../c-api/unicode.rst:567 +#: ../../c-api/unicode.rst:574 msgid "" "Support for conversion specifiers ``o`` and ``X``. Support for length " "modifiers ``j`` and ``t``. Length modifiers are now applied to all integer " @@ -801,50 +832,50 @@ msgid "" "flag ``-``." msgstr "" -#: ../../c-api/unicode.rst:575 +#: ../../c-api/unicode.rst:582 msgid "" "An unrecognized format character now sets a :exc:`SystemError`. In previous " "versions it caused all the rest of the format string to be copied as-is to " "the result string, and any extra arguments discarded." msgstr "" -#: ../../c-api/unicode.rst:579 +#: ../../c-api/unicode.rst:586 msgid "Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added." msgstr "新增對 ``%T``、``%#T``、``%N`` 和 ``%#N`` 格式的支援。" -#: ../../c-api/unicode.rst:585 +#: ../../c-api/unicode.rst:592 msgid "" "Identical to :c:func:`PyUnicode_FromFormat` except that it takes exactly two " "arguments." msgstr "" -#: ../../c-api/unicode.rst:591 +#: ../../c-api/unicode.rst:598 msgid "" "Copy an instance of a Unicode subtype to a new true Unicode object if " "necessary. If *obj* is already a true Unicode object (not a subtype), return " "a new :term:`strong reference` to the object." msgstr "" -#: ../../c-api/unicode.rst:595 +#: ../../c-api/unicode.rst:602 msgid "" "Objects other than Unicode or its subtypes will cause a :exc:`TypeError`." msgstr "" -#: ../../c-api/unicode.rst:600 +#: ../../c-api/unicode.rst:607 msgid "Create a Unicode Object from the given Unicode code point *ordinal*." msgstr "" -#: ../../c-api/unicode.rst:602 +#: ../../c-api/unicode.rst:609 msgid "" "The ordinal must be in ``range(0x110000)``. A :exc:`ValueError` is raised in " "the case it is not." msgstr "" -#: ../../c-api/unicode.rst:609 +#: ../../c-api/unicode.rst:616 msgid "Decode an encoded object *obj* to a Unicode object." msgstr "" -#: ../../c-api/unicode.rst:611 +#: ../../c-api/unicode.rst:618 msgid "" ":class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects " "` are decoded according to the given *encoding* and using " @@ -852,48 +883,70 @@ msgid "" "interface use the default values (see :ref:`builtincodecs` for details)." msgstr "" -#: ../../c-api/unicode.rst:617 +#: ../../c-api/unicode.rst:624 msgid "" "All other objects, including Unicode objects, cause a :exc:`TypeError` to be " "set." msgstr "" -#: ../../c-api/unicode.rst:620 +#: ../../c-api/unicode.rst:627 msgid "" "The API returns ``NULL`` if there was an error. The caller is responsible " "for decref'ing the returned objects." msgstr "" -#: ../../c-api/unicode.rst:626 +#: ../../c-api/unicode.rst:633 +msgid "" +"Append the string *right* to the end of *p_left*. *p_left* must point to " +"a :term:`strong reference` to a Unicode object; :c:func:`!PyUnicode_Append` " +"releases (\"steals\") this reference." +msgstr "" + +#: ../../c-api/unicode.rst:637 +#, fuzzy +msgid "On error, set *\\*p_left* to ``NULL`` and set an exception." +msgstr "於錯誤發生時回傳 ``NULL`` 並設定例外。" + +#: ../../c-api/unicode.rst:639 +msgid "On success, set *\\*p_left* to a new strong reference to the result." +msgstr "" + +#: ../../c-api/unicode.rst:644 +msgid "" +"The function is similar to :c:func:`PyUnicode_Append`, with the only " +"difference being that it decrements the reference count of *right* by one." +msgstr "" + +#: ../../c-api/unicode.rst:650 msgid "" "Return a mapping suitable for decoding a custom single-byte encoding. Given " "a Unicode string *string* of up to 256 characters representing an encoding " "table, returns either a compact internal mapping object or a dictionary " "mapping character ordinals to byte values. Raises a :exc:`TypeError` and " -"return ``NULL`` on invalid input. .. versionadded:: 3.2" +"return ``NULL`` on invalid input." msgstr "" -#: ../../c-api/unicode.rst:636 +#: ../../c-api/unicode.rst:661 msgid "" -"Return the name of the default string encoding, ``\"utf-8\"``. See :func:" -"`sys.getdefaultencoding`." +"Return the name of the default string encoding, ``\"utf-8\"``. " +"See :func:`sys.getdefaultencoding`." msgstr "" -#: ../../c-api/unicode.rst:639 +#: ../../c-api/unicode.rst:664 msgid "" "The returned string does not need to be freed, and is valid until " "interpreter shutdown." msgstr "" -#: ../../c-api/unicode.rst:645 +#: ../../c-api/unicode.rst:670 msgid "Return the length of the Unicode object, in code points." msgstr "" -#: ../../c-api/unicode.rst:647 +#: ../../c-api/unicode.rst:672 msgid "On error, set an exception and return ``-1``." msgstr "發生錯誤時,設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:658 +#: ../../c-api/unicode.rst:683 msgid "" "Copy characters from one Unicode object into another. This function " "performs character conversion when necessary and falls back to :c:func:`!" @@ -901,61 +954,89 @@ msgid "" "otherwise returns the number of copied characters." msgstr "" -#: ../../c-api/unicode.rst:669 +#: ../../c-api/unicode.rst:688 ../../c-api/unicode.rst:718 +#: ../../c-api/unicode.rst:738 msgid "" -"Fill a string with a character: write *fill_char* into ``unicode[start:" -"start+length]``." +"The string must not have been “used” yet. See :c:func:`PyUnicode_New` for " +"details." msgstr "" -#: ../../c-api/unicode.rst:672 +#: ../../c-api/unicode.rst:696 +msgid "" +"Resize a Unicode object *\\*unicode* to the new *length* in code points." +msgstr "" + +#: ../../c-api/unicode.rst:698 +msgid "" +"Try to resize the string in place (which is usually faster than allocating a " +"new string and copying characters), or create a new string." +msgstr "" + +#: ../../c-api/unicode.rst:701 +msgid "" +"*\\*unicode* is modified to point to the new (resized) object and ``0`` is " +"returned on success. Otherwise, ``-1`` is returned and an exception is set, " +"and *\\*unicode* is left untouched." +msgstr "" + +#: ../../c-api/unicode.rst:705 +msgid "" +"The function doesn't check string content, the result may not be a string in " +"canonical representation." +msgstr "" + +#: ../../c-api/unicode.rst:712 +msgid "" +"Fill a string with a character: write *fill_char* into " +"``unicode[start:start+length]``." +msgstr "" + +#: ../../c-api/unicode.rst:715 msgid "" "Fail if *fill_char* is bigger than the string maximum character, or if the " "string has more than 1 reference." msgstr "" -#: ../../c-api/unicode.rst:675 +#: ../../c-api/unicode.rst:721 msgid "" "Return the number of written character, or return ``-1`` and raise an " "exception on error." msgstr "" -#: ../../c-api/unicode.rst:684 +#: ../../c-api/unicode.rst:730 +#, fuzzy msgid "" -"Write a character to a string. The string must have been created through :c:" -"func:`PyUnicode_New`. Since Unicode strings are supposed to be immutable, " -"the string must not be shared, or have been hashed yet." -msgstr "" +"Write a *character* to the string *unicode* at the zero-based *index*. " +"Return ``0`` on success, ``-1`` on error with an exception set." +msgstr "成功時回傳 ``0``,發生錯誤時設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:688 +#: ../../c-api/unicode.rst:733 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " -"not out of bounds, and that the object can be modified safely (i.e. that it " -"its reference count is one)." +"not out of bounds, and that the object's reference count is one). " +"See :c:func:`PyUnicode_WRITE` for a version that skips these checks, making " +"them your responsibility." msgstr "" -#: ../../c-api/unicode.rst:692 -msgid "Return ``0`` on success, ``-1`` on error with an exception set." -msgstr "成功時回傳 ``0``,發生錯誤時設定例外並回傳 ``-1``。" - -#: ../../c-api/unicode.rst:699 +#: ../../c-api/unicode.rst:746 msgid "" "Read a character from a string. This function checks that *unicode* is a " -"Unicode object and the index is not out of bounds, in contrast to :c:func:" -"`PyUnicode_READ_CHAR`, which performs no error checking." +"Unicode object and the index is not out of bounds, in contrast " +"to :c:func:`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" -#: ../../c-api/unicode.rst:703 +#: ../../c-api/unicode.rst:750 msgid "Return character on success, ``-1`` on error with an exception set." msgstr "成功時回傳字元,發生錯誤時設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:711 +#: ../../c-api/unicode.rst:758 msgid "" "Return a substring of *unicode*, from character index *start* (included) to " "character index *end* (excluded). Negative indices are not supported. On " "error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:721 +#: ../../c-api/unicode.rst:768 msgid "" "Copy the string *unicode* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " @@ -963,25 +1044,25 @@ msgid "" "*unicode*). *buffer* is returned on success." msgstr "" -#: ../../c-api/unicode.rst:731 +#: ../../c-api/unicode.rst:778 msgid "" -"Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" -"func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" -"`MemoryError` set. The returned buffer always has an extra null code point " -"appended." +"Copy the string *unicode* into a new UCS4 buffer that is allocated " +"using :c:func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with " +"a :exc:`MemoryError` set. The returned buffer always has an extra null code " +"point appended." msgstr "" -#: ../../c-api/unicode.rst:740 +#: ../../c-api/unicode.rst:787 msgid "Locale Encoding" msgstr "" -#: ../../c-api/unicode.rst:742 +#: ../../c-api/unicode.rst:789 msgid "" "The current locale encoding can be used to decode text from the operating " "system." msgstr "" -#: ../../c-api/unicode.rst:749 +#: ../../c-api/unicode.rst:796 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are " @@ -990,29 +1071,29 @@ msgid "" "null character but cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:756 +#: ../../c-api/unicode.rst:803 msgid "" -"Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" -"term:`filesystem encoding and error handler`." +"Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from " +"the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:759 ../../c-api/unicode.rst:794 +#: ../../c-api/unicode.rst:806 ../../c-api/unicode.rst:841 msgid "This function ignores the :ref:`Python UTF-8 Mode `." msgstr "此函式會忽略 :ref:`Python UTF-8 模式 `。" -#: ../../c-api/unicode.rst:763 ../../c-api/unicode.rst:879 +#: ../../c-api/unicode.rst:810 ../../c-api/unicode.rst:926 msgid "The :c:func:`Py_DecodeLocale` function." msgstr ":c:func:`Py_DecodeLocale` 函式。" -#: ../../c-api/unicode.rst:767 +#: ../../c-api/unicode.rst:814 msgid "" "The function now also uses the current locale encoding for the " -"``surrogateescape`` error handler, except on Android. Previously, :c:func:" -"`Py_DecodeLocale` was used for the ``surrogateescape``, and the current " -"locale encoding was used for ``strict``." +"``surrogateescape`` error handler, except on Android. " +"Previously, :c:func:`Py_DecodeLocale` was used for the ``surrogateescape``, " +"and the current locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:776 +#: ../../c-api/unicode.rst:823 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." @@ -1020,55 +1101,55 @@ msgstr "" "類似於 :c:func:`PyUnicode_DecodeLocaleAndSize`,但使用 :c:func:`!strlen` 計算" "字串長度。" -#: ../../c-api/unicode.rst:784 +#: ../../c-api/unicode.rst:831 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " "``\"strict\"`` and ``\"surrogateescape\"`` (:pep:`383`). The encoder uses " -"``\"strict\"`` error handler if *errors* is ``NULL``. Return a :class:" -"`bytes` object. *unicode* cannot contain embedded null characters." +"``\"strict\"`` error handler if *errors* is ``NULL``. Return " +"a :class:`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:791 +#: ../../c-api/unicode.rst:838 msgid "" -"Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" -"`filesystem encoding and error handler`." +"Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to " +"the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:798 ../../c-api/unicode.rst:910 +#: ../../c-api/unicode.rst:845 ../../c-api/unicode.rst:957 msgid "The :c:func:`Py_EncodeLocale` function." msgstr ":c:func:`Py_EncodeLocale` 函式。" -#: ../../c-api/unicode.rst:802 +#: ../../c-api/unicode.rst:849 msgid "" "The function now also uses the current locale encoding for the " -"``surrogateescape`` error handler, except on Android. Previously, :c:func:" -"`Py_EncodeLocale` was used for the ``surrogateescape``, and the current " -"locale encoding was used for ``strict``." +"``surrogateescape`` error handler, except on Android. " +"Previously, :c:func:`Py_EncodeLocale` was used for the ``surrogateescape``, " +"and the current locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:811 +#: ../../c-api/unicode.rst:858 msgid "File System Encoding" msgstr "檔案系統編碼" -#: ../../c-api/unicode.rst:813 +#: ../../c-api/unicode.rst:860 msgid "" "Functions encoding to and decoding from the :term:`filesystem encoding and " "error handler` (:pep:`383` and :pep:`529`)." msgstr "" -#: ../../c-api/unicode.rst:816 +#: ../../c-api/unicode.rst:863 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " "``\"O&\"`` converter should be used, passing :c:func:`!" "PyUnicode_FSConverter` as the conversion function:" msgstr "" -#: ../../c-api/unicode.rst:822 +#: ../../c-api/unicode.rst:869 msgid "" ":ref:`PyArg_Parse\\* converter `: encode :class:`str` objects " -"-- obtained directly or through the :class:`os.PathLike` interface -- to :" -"class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " +"-- obtained directly or through the :class:`os.PathLike` interface -- " +"to :class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " "objects are output as-is. *result* must be an address of a C variable of " "type :c:expr:`PyObject*` (or :c:expr:`PyBytesObject*`). On success, set the " "variable to a new :term:`strong reference` to a :ref:`bytes object " @@ -1077,94 +1158,95 @@ msgid "" "not allowed in the result. On failure, return ``0`` with an exception set." msgstr "" -#: ../../c-api/unicode.rst:834 +#: ../../c-api/unicode.rst:881 msgid "" "If *obj* is ``NULL``, the function releases a strong reference stored in the " "variable referred by *result* and returns ``1``." msgstr "" -#: ../../c-api/unicode.rst:839 ../../c-api/unicode.rst:866 +#: ../../c-api/unicode.rst:886 ../../c-api/unicode.rst:913 msgid "Accepts a :term:`path-like object`." msgstr "接受一個 :term:`path-like object`。" -#: ../../c-api/unicode.rst:842 +#: ../../c-api/unicode.rst:889 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " "converter should be used, passing :c:func:`!PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" -#: ../../c-api/unicode.rst:848 +#: ../../c-api/unicode.rst:895 msgid "" ":ref:`PyArg_Parse\\* converter `: decode :class:`bytes` objects " "-- obtained either directly or indirectly through the :class:`os.PathLike` " -"interface -- to :class:`str` using :c:func:" -"`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are output as-is. " -"*result* must be an address of a C variable of type :c:expr:`PyObject*` (or :" -"c:expr:`PyUnicodeObject*`). On success, set the variable to a new :term:" -"`strong reference` to a :ref:`Unicode object ` which must be " -"released when it is no longer used and return a non-zero value (:c:macro:" -"`Py_CLEANUP_SUPPORTED`). Embedded null characters are not allowed in the " -"result. On failure, return ``0`` with an exception set." +"interface -- to :class:`str` " +"using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are " +"output as-is. *result* must be an address of a C variable of " +"type :c:expr:`PyObject*` (or :c:expr:`PyUnicodeObject*`). On success, set " +"the variable to a new :term:`strong reference` to a :ref:`Unicode object " +"` which must be released when it is no longer used and " +"return a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null " +"characters are not allowed in the result. On failure, return ``0`` with an " +"exception set." msgstr "" -#: ../../c-api/unicode.rst:861 +#: ../../c-api/unicode.rst:908 msgid "" "If *obj* is ``NULL``, release the strong reference to the object referred to " "by *result* and return ``1``." msgstr "" -#: ../../c-api/unicode.rst:872 +#: ../../c-api/unicode.rst:919 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:874 +#: ../../c-api/unicode.rst:921 msgid "" -"If you need to decode a string from the current locale encoding, use :c:func:" -"`PyUnicode_DecodeLocaleAndSize`." +"If you need to decode a string from the current locale encoding, " +"use :c:func:`PyUnicode_DecodeLocaleAndSize`." msgstr "" -#: ../../c-api/unicode.rst:881 ../../c-api/unicode.rst:894 -#: ../../c-api/unicode.rst:914 +#: ../../c-api/unicode.rst:928 ../../c-api/unicode.rst:941 +#: ../../c-api/unicode.rst:961 msgid "" "The :term:`filesystem error handler ` " "is now used." msgstr "" -#: ../../c-api/unicode.rst:888 +#: ../../c-api/unicode.rst:935 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" -#: ../../c-api/unicode.rst:891 +#: ../../c-api/unicode.rst:938 msgid "" -"If the string length is known, use :c:func:" -"`PyUnicode_DecodeFSDefaultAndSize`." +"If the string length is known, " +"use :c:func:`PyUnicode_DecodeFSDefaultAndSize`." msgstr "如果字串長度已知,請使用 :c:func:`PyUnicode_DecodeFSDefaultAndSize`。" -#: ../../c-api/unicode.rst:901 +#: ../../c-api/unicode.rst:948 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" -#: ../../c-api/unicode.rst:905 +#: ../../c-api/unicode.rst:952 msgid "" -"If you need to encode a string to the current locale encoding, use :c:func:" -"`PyUnicode_EncodeLocale`." +"If you need to encode a string to the current locale encoding, " +"use :c:func:`PyUnicode_EncodeLocale`." msgstr "" -#: ../../c-api/unicode.rst:919 +#: ../../c-api/unicode.rst:966 msgid "wchar_t Support" msgstr "wchar_t 支援" -#: ../../c-api/unicode.rst:921 +#: ../../c-api/unicode.rst:968 msgid ":c:type:`wchar_t` support for platforms which support it:" msgstr "對支援 :c:type:`wchar_t` 的平台提供支援:" -#: ../../c-api/unicode.rst:925 +#: ../../c-api/unicode.rst:972 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " @@ -1172,72 +1254,73 @@ msgid "" "failure." msgstr "" -#: ../../c-api/unicode.rst:933 +#: ../../c-api/unicode.rst:980 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " -"trailing null termination character). Return the number of :c:type:" -"`wchar_t` characters copied or ``-1`` in case of an error." +"trailing null termination character). Return the number " +"of :c:type:`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" -#: ../../c-api/unicode.rst:938 +#: ../../c-api/unicode.rst:985 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" -#: ../../c-api/unicode.rst:941 +#: ../../c-api/unicode.rst:988 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" -"terminated. It is the responsibility of the caller to make sure that the :c:" -"expr:`wchar_t*` string is null-terminated in case this is required by the " -"application. Also, note that the :c:expr:`wchar_t*` string might contain " +"terminated. It is the responsibility of the caller to make sure that " +"the :c:expr:`wchar_t*` string is null-terminated in case this is required by " +"the application. Also, note that the :c:expr:`wchar_t*` string might contain " "null characters, which would cause the string to be truncated when used with " "most C functions." msgstr "" -#: ../../c-api/unicode.rst:951 +#: ../../c-api/unicode.rst:998 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " "number of wide characters (excluding the trailing null termination " "character) into *\\*size*. Note that the resulting :c:type:`wchar_t` string " "might contain null characters, which would cause the string to be truncated " -"when used with most C functions. If *size* is ``NULL`` and the :c:expr:" -"`wchar_t*` string contains null characters a :exc:`ValueError` is raised." +"when used with most C functions. If *size* is ``NULL`` and " +"the :c:expr:`wchar_t*` string contains null characters a :exc:`ValueError` " +"is raised." msgstr "" -#: ../../c-api/unicode.rst:959 +#: ../../c-api/unicode.rst:1006 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" -#: ../../c-api/unicode.rst:966 +#: ../../c-api/unicode.rst:1013 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" -#: ../../c-api/unicode.rst:974 +#: ../../c-api/unicode.rst:1021 msgid "Built-in Codecs" msgstr "內建編解碼器" -#: ../../c-api/unicode.rst:976 +#: ../../c-api/unicode.rst:1023 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" -#: ../../c-api/unicode.rst:979 +#: ../../c-api/unicode.rst:1026 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" -#: ../../c-api/unicode.rst:983 +#: ../../c-api/unicode.rst:1030 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " @@ -1245,28 +1328,42 @@ msgid "" "handler` internally." msgstr "" -#: ../../c-api/unicode.rst:988 +#: ../../c-api/unicode.rst:1035 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -#: ../../c-api/unicode.rst:992 +#: ../../c-api/unicode.rst:1039 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" -#: ../../c-api/unicode.rst:997 +#: ../../c-api/unicode.rst:1044 msgid "Generic Codecs" msgstr "泛用編解碼器" -#: ../../c-api/unicode.rst:999 +#: ../../c-api/unicode.rst:1046 +msgid "The following macro is provided:" +msgstr "" + +#: ../../c-api/unicode.rst:1051 +msgid "The Unicode code point ``U+FFFD`` (replacement character)." +msgstr "" + +#: ../../c-api/unicode.rst:1053 +msgid "" +"This Unicode character is used as the replacement character during decoding " +"if the *errors* argument is set to \"replace\"." +msgstr "" + +#: ../../c-api/unicode.rst:1057 msgid "These are the generic codec APIs:" msgstr "這些是泛用編解碼器的 API:" -#: ../../c-api/unicode.rst:1005 +#: ../../c-api/unicode.rst:1063 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " @@ -1275,7 +1372,7 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1015 +#: ../../c-api/unicode.rst:1073 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1284,21 +1381,21 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1023 +#: ../../c-api/unicode.rst:1081 msgid "UTF-8 Codecs" msgstr "UTF-8 編解碼器" -#: ../../c-api/unicode.rst:1025 +#: ../../c-api/unicode.rst:1083 msgid "These are the UTF-8 codec APIs:" msgstr "這些是 UTF-8 編解碼器的 API:" -#: ../../c-api/unicode.rst:1030 +#: ../../c-api/unicode.rst:1088 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1037 +#: ../../c-api/unicode.rst:1095 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " @@ -1306,20 +1403,20 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1045 +#: ../../c-api/unicode.rst:1103 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1049 ../../c-api/unicode.rst:1064 +#: ../../c-api/unicode.rst:1107 ../../c-api/unicode.rst:1122 msgid "" "The function fails if the string contains surrogate code points (``U+D800`` " "- ``U+DFFF``)." msgstr "" -#: ../../c-api/unicode.rst:1055 +#: ../../c-api/unicode.rst:1113 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " @@ -1328,7 +1425,7 @@ msgid "" "regardless of whether there are any other null code points." msgstr "" -#: ../../c-api/unicode.rst:1061 +#: ../../c-api/unicode.rst:1119 msgid "" "On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " "return ``NULL``." @@ -1336,7 +1433,7 @@ msgstr "" "發生錯誤時,設定例外並將 *size* 設為 ``-1``\\ (如果不是 NULL),並回傳 " "``NULL``。" -#: ../../c-api/unicode.rst:1067 +#: ../../c-api/unicode.rst:1125 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1345,57 +1442,57 @@ msgid "" "collected." msgstr "" -#: ../../c-api/unicode.rst:1074 ../../c-api/unicode.rst:1096 +#: ../../c-api/unicode.rst:1132 ../../c-api/unicode.rst:1154 msgid "The return type is now ``const char *`` rather of ``char *``." msgstr "回傳型別現在是 ``const char *`` 而不是 ``char *``。" -#: ../../c-api/unicode.rst:1077 +#: ../../c-api/unicode.rst:1135 msgid "This function is a part of the :ref:`limited API `." msgstr "" -#: ../../c-api/unicode.rst:1083 +#: ../../c-api/unicode.rst:1141 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "與 :c:func:`PyUnicode_AsUTF8AndSize` 類似,但不儲存大小。" -#: ../../c-api/unicode.rst:1087 +#: ../../c-api/unicode.rst:1145 msgid "" "This function does not have any special behavior for `null characters " "`_ embedded within *unicode*. " "As a result, strings containing null characters will remain in the returned " "string, which some C functions might interpret as the end of the string, " -"leading to truncation. If truncation is an issue, it is recommended to use :" -"c:func:`PyUnicode_AsUTF8AndSize` instead." +"leading to truncation. If truncation is an issue, it is recommended to " +"use :c:func:`PyUnicode_AsUTF8AndSize` instead." msgstr "" -#: ../../c-api/unicode.rst:1101 +#: ../../c-api/unicode.rst:1159 msgid "UTF-32 Codecs" msgstr "UTF-32 編解碼器" -#: ../../c-api/unicode.rst:1103 +#: ../../c-api/unicode.rst:1161 msgid "These are the UTF-32 codec APIs:" msgstr "這些是 UTF-32 編解碼器的 API:" -#: ../../c-api/unicode.rst:1109 +#: ../../c-api/unicode.rst:1167 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1113 ../../c-api/unicode.rst:1163 +#: ../../c-api/unicode.rst:1171 ../../c-api/unicode.rst:1221 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" -#: ../../c-api/unicode.rst:1116 ../../c-api/unicode.rst:1166 +#: ../../c-api/unicode.rst:1174 ../../c-api/unicode.rst:1224 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" -#: ../../c-api/unicode.rst:1120 +#: ../../c-api/unicode.rst:1178 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1403,21 +1500,21 @@ msgid "" "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -#: ../../c-api/unicode.rst:1125 +#: ../../c-api/unicode.rst:1183 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1128 ../../c-api/unicode.rst:1179 +#: ../../c-api/unicode.rst:1186 ../../c-api/unicode.rst:1237 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" -#: ../../c-api/unicode.rst:1130 ../../c-api/unicode.rst:1181 +#: ../../c-api/unicode.rst:1188 ../../c-api/unicode.rst:1239 msgid "Return ``NULL`` if an exception was raised by the codec." msgstr "如果編解碼器引發例外則回傳 ``NULL``。" -#: ../../c-api/unicode.rst:1136 +#: ../../c-api/unicode.rst:1194 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " @@ -1426,29 +1523,29 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1145 +#: ../../c-api/unicode.rst:1203 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1151 +#: ../../c-api/unicode.rst:1209 msgid "UTF-16 Codecs" msgstr "UTF-16 編解碼器" -#: ../../c-api/unicode.rst:1153 +#: ../../c-api/unicode.rst:1211 msgid "These are the UTF-16 codec APIs:" msgstr "這些是 UTF-16 編解碼器的 API:" -#: ../../c-api/unicode.rst:1159 +#: ../../c-api/unicode.rst:1217 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1170 +#: ../../c-api/unicode.rst:1228 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1457,13 +1554,13 @@ msgid "" "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -#: ../../c-api/unicode.rst:1176 +#: ../../c-api/unicode.rst:1234 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1187 +#: ../../c-api/unicode.rst:1245 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " @@ -1473,28 +1570,28 @@ msgid "" "*consumed*." msgstr "" -#: ../../c-api/unicode.rst:1196 +#: ../../c-api/unicode.rst:1254 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1202 +#: ../../c-api/unicode.rst:1260 msgid "UTF-7 Codecs" msgstr "UTF-7 編解碼器" -#: ../../c-api/unicode.rst:1204 +#: ../../c-api/unicode.rst:1262 msgid "These are the UTF-7 codec APIs:" msgstr "這些是 UTF-7 編解碼器的 API:" -#: ../../c-api/unicode.rst:1209 +#: ../../c-api/unicode.rst:1267 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1216 +#: ../../c-api/unicode.rst:1274 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " @@ -1502,101 +1599,101 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1223 +#: ../../c-api/unicode.rst:1281 msgid "Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1225 +#: ../../c-api/unicode.rst:1283 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1231 +#: ../../c-api/unicode.rst:1289 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1237 +#: ../../c-api/unicode.rst:1295 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1243 +#: ../../c-api/unicode.rst:1301 msgid "Raw-Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1245 +#: ../../c-api/unicode.rst:1303 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1251 +#: ../../c-api/unicode.rst:1309 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1257 +#: ../../c-api/unicode.rst:1315 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1263 +#: ../../c-api/unicode.rst:1321 msgid "Latin-1 Codecs" msgstr "Latin-1 編解碼器" -#: ../../c-api/unicode.rst:1265 +#: ../../c-api/unicode.rst:1323 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -#: ../../c-api/unicode.rst:1271 +#: ../../c-api/unicode.rst:1329 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1277 +#: ../../c-api/unicode.rst:1335 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1283 +#: ../../c-api/unicode.rst:1341 msgid "ASCII Codecs" msgstr "ASCII 編解碼器" -#: ../../c-api/unicode.rst:1285 +#: ../../c-api/unicode.rst:1343 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" -#: ../../c-api/unicode.rst:1291 +#: ../../c-api/unicode.rst:1349 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1297 +#: ../../c-api/unicode.rst:1355 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1303 +#: ../../c-api/unicode.rst:1361 msgid "Character Map Codecs" msgstr "" -#: ../../c-api/unicode.rst:1305 +#: ../../c-api/unicode.rst:1363 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " @@ -1606,18 +1703,18 @@ msgid "" "sequences work well." msgstr "" -#: ../../c-api/unicode.rst:1311 +#: ../../c-api/unicode.rst:1369 msgid "These are the mapping codec APIs:" msgstr "這些是對映編解碼器的 API:" -#: ../../c-api/unicode.rst:1316 +#: ../../c-api/unicode.rst:1374 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *str* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1320 +#: ../../c-api/unicode.rst:1378 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1627,14 +1724,14 @@ msgid "" "treated as undefined mappings and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1331 +#: ../../c-api/unicode.rst:1389 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1335 +#: ../../c-api/unicode.rst:1393 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " @@ -1642,41 +1739,41 @@ msgid "" "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1341 +#: ../../c-api/unicode.rst:1399 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -#: ../../c-api/unicode.rst:1345 +#: ../../c-api/unicode.rst:1403 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" -#: ../../c-api/unicode.rst:1349 +#: ../../c-api/unicode.rst:1407 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" -#: ../../c-api/unicode.rst:1352 +#: ../../c-api/unicode.rst:1410 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -#: ../../c-api/unicode.rst:1356 +#: ../../c-api/unicode.rst:1414 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" -#: ../../c-api/unicode.rst:1361 +#: ../../c-api/unicode.rst:1419 msgid "MBCS codecs for Windows" msgstr "Windows 的 MBCS 編解碼器" -#: ../../c-api/unicode.rst:1363 +#: ../../c-api/unicode.rst:1421 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " @@ -1684,13 +1781,13 @@ msgid "" "is defined by the user settings on the machine running the codec." msgstr "" -#: ../../c-api/unicode.rst:1370 +#: ../../c-api/unicode.rst:1428 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1377 +#: ../../c-api/unicode.rst:1435 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " @@ -1698,46 +1795,46 @@ msgid "" "will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1386 +#: ../../c-api/unicode.rst:1444 msgid "" "Similar to :c:func:`PyUnicode_DecodeMBCSStateful`, except uses the code page " "specified by *code_page*." msgstr "" -#: ../../c-api/unicode.rst:1392 +#: ../../c-api/unicode.rst:1450 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1399 +#: ../../c-api/unicode.rst:1457 msgid "" "Encode the Unicode object using the specified code page and return a Python " -"bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" -"c:macro:`!CP_ACP` code page to get the MBCS encoder." +"bytes object. Return ``NULL`` if an exception was raised by the codec. " +"Use :c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" -#: ../../c-api/unicode.rst:1409 +#: ../../c-api/unicode.rst:1467 msgid "Methods and Slot Functions" msgstr "" -#: ../../c-api/unicode.rst:1411 +#: ../../c-api/unicode.rst:1469 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" -#: ../../c-api/unicode.rst:1415 +#: ../../c-api/unicode.rst:1473 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." msgstr "如果發生例外,則回傳 ``NULL`` 或 ``-1``。" -#: ../../c-api/unicode.rst:1420 +#: ../../c-api/unicode.rst:1478 msgid "Concat two strings giving a new Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1425 +#: ../../c-api/unicode.rst:1483 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -1746,33 +1843,33 @@ msgid "" "list." msgstr "" -#: ../../c-api/unicode.rst:1430 ../../c-api/unicode.rst:1440 -#: ../../c-api/unicode.rst:1461 ../../c-api/unicode.rst:1474 +#: ../../c-api/unicode.rst:1488 ../../c-api/unicode.rst:1498 +#: ../../c-api/unicode.rst:1519 ../../c-api/unicode.rst:1532 msgid "On error, return ``NULL`` with an exception set." msgstr "於錯誤發生時回傳 ``NULL`` 並設定例外。" -#: ../../c-api/unicode.rst:1432 +#: ../../c-api/unicode.rst:1490 msgid "Equivalent to :py:meth:`str.split`." msgstr "等價於 :py:meth:`str.split`。" -#: ../../c-api/unicode.rst:1437 +#: ../../c-api/unicode.rst:1495 msgid "" "Similar to :c:func:`PyUnicode_Split`, but splitting will be done beginning " "at the end of the string." msgstr "" -#: ../../c-api/unicode.rst:1442 +#: ../../c-api/unicode.rst:1500 msgid "Equivalent to :py:meth:`str.rsplit`." msgstr "等價於 :py:meth:`str.rsplit`。" -#: ../../c-api/unicode.rst:1447 +#: ../../c-api/unicode.rst:1505 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" -#: ../../c-api/unicode.rst:1454 +#: ../../c-api/unicode.rst:1512 msgid "" "Split a Unicode string at the first occurrence of *sep*, and return a 3-" "tuple containing the part before the separator, the separator itself, and " @@ -1780,39 +1877,39 @@ msgid "" "tuple containing the string itself, followed by two empty strings." msgstr "" -#: ../../c-api/unicode.rst:1459 ../../c-api/unicode.rst:1472 +#: ../../c-api/unicode.rst:1517 ../../c-api/unicode.rst:1530 msgid "*sep* must not be empty." msgstr "*sep* 不得為空。" -#: ../../c-api/unicode.rst:1463 +#: ../../c-api/unicode.rst:1521 msgid "Equivalent to :py:meth:`str.partition`." msgstr "等價於 :py:meth:`str.partition`。" -#: ../../c-api/unicode.rst:1468 +#: ../../c-api/unicode.rst:1526 msgid "" "Similar to :c:func:`PyUnicode_Partition`, but split a Unicode string at the " "last occurrence of *sep*. If the separator is not found, return a 3-tuple " "containing two empty strings, followed by the string itself." msgstr "" -#: ../../c-api/unicode.rst:1476 +#: ../../c-api/unicode.rst:1534 msgid "Equivalent to :py:meth:`str.rpartition`." msgstr "等價於 :py:meth:`str.rpartition`。" -#: ../../c-api/unicode.rst:1481 +#: ../../c-api/unicode.rst:1539 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1488 +#: ../../c-api/unicode.rst:1546 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1496 +#: ../../c-api/unicode.rst:1554 msgid "" "Return the first position of *substr* in ``unicode[start:end]`` using the " "given *direction* (*direction* == ``1`` means to do a forward search, " @@ -1821,7 +1918,7 @@ msgid "" "``-2`` indicates that an error occurred and an exception has been set." msgstr "" -#: ../../c-api/unicode.rst:1506 +#: ../../c-api/unicode.rst:1564 msgid "" "Return the first position of the character *ch* in ``unicode[start:end]`` " "using the given *direction* (*direction* == ``1`` means to do a forward " @@ -1831,37 +1928,75 @@ msgid "" "set." msgstr "" -#: ../../c-api/unicode.rst:1514 +#: ../../c-api/unicode.rst:1572 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" -#: ../../c-api/unicode.rst:1521 +#: ../../c-api/unicode.rst:1579 msgid "" "Return the number of non-overlapping occurrences of *substr* in " "``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1528 +#: ../../c-api/unicode.rst:1586 msgid "" "Replace at most *maxcount* occurrences of *substr* in *unicode* with " "*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " "means replace all occurrences." msgstr "" -#: ../../c-api/unicode.rst:1535 +#: ../../c-api/unicode.rst:1593 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" -#: ../../c-api/unicode.rst:1538 +#: ../../c-api/unicode.rst:1596 +msgid "" +"This function returns ``-1`` upon failure, so one should " +"call :c:func:`PyErr_Occurred` to check for errors." +msgstr "" + +#: ../../c-api/unicode.rst:1601 +#, fuzzy +msgid "The :c:func:`PyUnicode_Equal` function." +msgstr ":c:func:`Py_EncodeLocale` 函式。" + +#: ../../c-api/unicode.rst:1606 +msgid "Test if two strings are equal:" +msgstr "" + +#: ../../c-api/unicode.rst:1608 +msgid "Return ``1`` if *a* is equal to *b*." +msgstr "" + +#: ../../c-api/unicode.rst:1609 +msgid "Return ``0`` if *a* is not equal to *b*." +msgstr "" + +#: ../../c-api/unicode.rst:1610 msgid "" -"This function returns ``-1`` upon failure, so one should call :c:func:" -"`PyErr_Occurred` to check for errors." +"Set a :exc:`TypeError` exception and return ``-1`` if *a* or *b* is not " +"a :class:`str` object." msgstr "" -#: ../../c-api/unicode.rst:1544 +#: ../../c-api/unicode.rst:1613 +msgid "The function always succeeds if *a* and *b* are :class:`str` objects." +msgstr "" + +#: ../../c-api/unicode.rst:1615 +msgid "" +"The function works for :class:`str` subclasses, but does not honor custom " +"``__eq__()`` method." +msgstr "" + +#: ../../c-api/unicode.rst:1620 +#, fuzzy +msgid "The :c:func:`PyUnicode_Compare` function." +msgstr ":c:func:`Py_EncodeLocale` 函式。" + +#: ../../c-api/unicode.rst:1627 msgid "" "Compare a Unicode object with a char buffer which is interpreted as being " "UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " @@ -1870,18 +2005,18 @@ msgid "" "is returned." msgstr "" -#: ../../c-api/unicode.rst:1551 ../../c-api/unicode.rst:1572 +#: ../../c-api/unicode.rst:1634 ../../c-api/unicode.rst:1655 msgid "This function does not raise exceptions." msgstr "此函式不會引發例外。" -#: ../../c-api/unicode.rst:1558 +#: ../../c-api/unicode.rst:1641 msgid "" "Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " "length using :c:func:`!strlen`. If the Unicode object contains null " "characters, false (``0``) is returned." msgstr "" -#: ../../c-api/unicode.rst:1567 +#: ../../c-api/unicode.rst:1650 msgid "" "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " @@ -1889,58 +2024,59 @@ msgid "" "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" -#: ../../c-api/unicode.rst:1577 +#: ../../c-api/unicode.rst:1660 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" -#: ../../c-api/unicode.rst:1579 +#: ../../c-api/unicode.rst:1662 msgid "``NULL`` in case an exception was raised" msgstr "" -#: ../../c-api/unicode.rst:1580 +#: ../../c-api/unicode.rst:1663 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" -#: ../../c-api/unicode.rst:1581 +#: ../../c-api/unicode.rst:1664 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -#: ../../c-api/unicode.rst:1583 +#: ../../c-api/unicode.rst:1666 msgid "" -"Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" -"`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." +"Possible values for *op* " +"are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, " +"and :c:macro:`Py_LE`." msgstr "" -#: ../../c-api/unicode.rst:1589 +#: ../../c-api/unicode.rst:1672 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" -#: ../../c-api/unicode.rst:1595 +#: ../../c-api/unicode.rst:1678 msgid "" "Check whether *substr* is contained in *unicode* and return true or false " "accordingly." msgstr "" -#: ../../c-api/unicode.rst:1598 +#: ../../c-api/unicode.rst:1681 msgid "" "*substr* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" -#: ../../c-api/unicode.rst:1604 +#: ../../c-api/unicode.rst:1687 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " -"If there is an existing interned string that is the same as :c:expr:" -"`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the reference to " -"the old string object and creating a new :term:`strong reference` to the " -"interned string object), otherwise it leaves :c:expr:`*p_unicode` alone and " -"interns it." +"If there is an existing interned string that is the same " +"as :c:expr:`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the " +"reference to the old string object and creating a new :term:`strong " +"reference` to the interned string object), otherwise it " +"leaves :c:expr:`*p_unicode` alone and interns it." msgstr "" -#: ../../c-api/unicode.rst:1611 +#: ../../c-api/unicode.rst:1694 msgid "" "(Clarification: even though there is a lot of talk about references, think " "of this function as reference-neutral. You must own the object you pass in; " @@ -1948,43 +2084,281 @@ msgid "" "the result.)" msgstr "" -#: ../../c-api/unicode.rst:1616 +#: ../../c-api/unicode.rst:1699 msgid "" "This function never raises an exception. On error, it leaves its argument " "unchanged without interning it." msgstr "" -#: ../../c-api/unicode.rst:1619 +#: ../../c-api/unicode.rst:1702 msgid "" -"Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" -"expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " -"as with any other error -- the argument is left unchanged." +"Instances of subclasses of :py:class:`str` may not be interned, that " +"is, :c:expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, " +"then -- as with any other error -- the argument is left unchanged." msgstr "" -#: ../../c-api/unicode.rst:1623 +#: ../../c-api/unicode.rst:1706 msgid "" "Note that interned strings are not “immortal”. You must keep a reference to " "the result to benefit from interning." msgstr "" -#: ../../c-api/unicode.rst:1629 +#: ../../c-api/unicode.rst:1712 msgid "" -"A combination of :c:func:`PyUnicode_FromString` and :c:func:" -"`PyUnicode_InternInPlace`, meant for statically allocated strings." +"A combination of :c:func:`PyUnicode_FromString` " +"and :c:func:`PyUnicode_InternInPlace`, meant for statically allocated " +"strings." msgstr "" -#: ../../c-api/unicode.rst:1632 +#: ../../c-api/unicode.rst:1715 msgid "" "Return a new (\"owned\") reference to either a new Unicode string object " "that has been interned, or an earlier interned string object with the same " "value." msgstr "" -#: ../../c-api/unicode.rst:1636 +#: ../../c-api/unicode.rst:1719 msgid "" "Python may keep a reference to the result, or make it :term:`immortal`, " "preventing it from being garbage-collected promptly. For interning an " "unbounded number of different strings, such as ones coming from user input, " -"prefer calling :c:func:`PyUnicode_FromString` and :c:func:" -"`PyUnicode_InternInPlace` directly." +"prefer calling :c:func:`PyUnicode_FromString` " +"and :c:func:`PyUnicode_InternInPlace` directly." +msgstr "" + +#: ../../c-api/unicode.rst:1728 +msgid "" +"Return a non-zero value if *str* is interned, zero if not. The *str* " +"argument must be a string; this is not checked. This function always " +"succeeds." +msgstr "" + +#: ../../c-api/unicode.rst:1734 +msgid "" +"A non-zero return value may carry additional information about *how* the " +"string is interned. The meaning of such non-zero values, as well as each " +"specific string's intern-related details, may change between CPython " +"versions." +msgstr "" + +#: ../../c-api/unicode.rst:1741 +msgid "PyUnicodeWriter" +msgstr "" + +#: ../../c-api/unicode.rst:1743 +msgid "" +"The :c:type:`PyUnicodeWriter` API can be used to create a " +"Python :class:`str` object." +msgstr "" + +#: ../../c-api/unicode.rst:1750 +#, fuzzy +msgid "A Unicode writer instance." +msgstr "一個 Unicode 物件。" + +#: ../../c-api/unicode.rst:1752 +msgid "" +"The instance must be destroyed by :c:func:`PyUnicodeWriter_Finish` on " +"success, or :c:func:`PyUnicodeWriter_Discard` on error." +msgstr "" + +#: ../../c-api/unicode.rst:1757 +msgid "Create a Unicode writer instance." +msgstr "" + +#: ../../c-api/unicode.rst:1759 +msgid "*length* must be greater than or equal to ``0``." +msgstr "" + +#: ../../c-api/unicode.rst:1761 +msgid "" +"If *length* is greater than ``0``, preallocate an internal buffer of " +"*length* characters." +msgstr "" + +#: ../../c-api/unicode.rst:1764 ../../c-api/unicode.rst:1770 +#, fuzzy +msgid "Set an exception and return ``NULL`` on error." +msgstr "發生錯誤時,設定例外並回傳 ``-1``。" + +#: ../../c-api/unicode.rst:1768 +msgid "" +"Return the final Python :class:`str` object and destroy the writer instance." +msgstr "" + +#: ../../c-api/unicode.rst:1772 ../../c-api/unicode.rst:1780 +msgid "The writer instance is invalid after this call." msgstr "" + +#: ../../c-api/unicode.rst:1776 +msgid "Discard the internal Unicode buffer and destroy the writer instance." +msgstr "" + +#: ../../c-api/unicode.rst:1778 +msgid "If *writer* is ``NULL``, no operation is performed." +msgstr "" + +#: ../../c-api/unicode.rst:1784 +msgid "Write the single Unicode character *ch* into *writer*." +msgstr "" + +#: ../../c-api/unicode.rst:1786 ../../c-api/unicode.rst:1796 +#: ../../c-api/unicode.rst:1811 ../../c-api/unicode.rst:1823 +#: ../../c-api/unicode.rst:1832 ../../c-api/unicode.rst:1839 +#: ../../c-api/unicode.rst:1846 ../../c-api/unicode.rst:1857 +#: ../../c-api/unicode.rst:1864 ../../c-api/unicode.rst:1883 +#, fuzzy +msgid "" +"On success, return ``0``. On error, set an exception, leave the writer " +"unchanged, and return ``-1``." +msgstr "發生錯誤時,設定例外並回傳 ``-1``。" + +#: ../../c-api/unicode.rst:1791 +msgid "" +"Decode the string *str* from UTF-8 in strict mode and write the output into " +"*writer*." +msgstr "" + +#: ../../c-api/unicode.rst:1793 ../../c-api/unicode.rst:1805 +#: ../../c-api/unicode.rst:1872 +msgid "" +"*size* is the string length in bytes. If *size* is equal to ``-1``, call " +"``strlen(str)`` to get the string length." +msgstr "" + +#: ../../c-api/unicode.rst:1799 +msgid "See also :c:func:`PyUnicodeWriter_DecodeUTF8Stateful`." +msgstr "" + +#: ../../c-api/unicode.rst:1803 +msgid "Write the ASCII string *str* into *writer*." +msgstr "" + +#: ../../c-api/unicode.rst:1808 +msgid "" +"*str* must only contain ASCII characters. The behavior is undefined if *str* " +"contains non-ASCII characters." +msgstr "" + +#: ../../c-api/unicode.rst:1818 +msgid "Write the wide string *str* into *writer*." +msgstr "" + +#: ../../c-api/unicode.rst:1820 +msgid "" +"*size* is a number of wide characters. If *size* is equal to ``-1``, call " +"``wcslen(str)`` to get the string length." +msgstr "" + +#: ../../c-api/unicode.rst:1828 +msgid "Writer the UCS4 string *str* into *writer*." +msgstr "" + +#: ../../c-api/unicode.rst:1830 +msgid "*size* is a number of UCS4 characters." +msgstr "" + +#: ../../c-api/unicode.rst:1837 +msgid "" +"Call :c:func:`PyObject_Str` on *obj* and write the output into *writer*." +msgstr "" + +#: ../../c-api/unicode.rst:1844 +msgid "" +"Call :c:func:`PyObject_Repr` on *obj* and write the output into *writer*." +msgstr "" + +#: ../../c-api/unicode.rst:1851 +msgid "Write the substring ``str[start:end]`` into *writer*." +msgstr "" + +#: ../../c-api/unicode.rst:1853 +msgid "" +"*str* must be Python :class:`str` object. *start* must be greater than or " +"equal to 0, and less than or equal to *end*. *end* must be less than or " +"equal to *str* length." +msgstr "" + +#: ../../c-api/unicode.rst:1862 +#, fuzzy +msgid "" +"Similar to :c:func:`PyUnicode_FromFormat`, but write the output directly " +"into *writer*." +msgstr "" +"類似於 :c:func:`PyUnicode_DecodeLocaleAndSize`,但使用 :c:func:`!strlen` 計算" +"字串長度。" + +#: ../../c-api/unicode.rst:1869 +msgid "" +"Decode the string *str* from UTF-8 with *errors* error handler and write the " +"output into *writer*." +msgstr "" + +#: ../../c-api/unicode.rst:1875 +msgid "" +"*errors* is an :ref:`error handler ` name, such as " +"``\"replace\"``. If *errors* is ``NULL``, use the strict error handler." +msgstr "" + +#: ../../c-api/unicode.rst:1878 +msgid "" +"If *consumed* is not ``NULL``, set *\\*consumed* to the number of decoded " +"bytes on success. If *consumed* is ``NULL``, treat trailing incomplete UTF-8 " +"byte sequences as an error." +msgstr "" + +#: ../../c-api/unicode.rst:1886 +msgid "See also :c:func:`PyUnicodeWriter_WriteUTF8`." +msgstr "" + +#: ../../c-api/unicode.rst:1889 +msgid "Deprecated API" +msgstr "" + +#: ../../c-api/unicode.rst:1891 +msgid "The following API is deprecated." +msgstr "" + +#: ../../c-api/unicode.rst:1895 +msgid "" +"This is a typedef of :c:type:`wchar_t`, which is a 16-bit type or 32-bit " +"type depending on the platform. Please use :c:type:`wchar_t` directly " +"instead." +msgstr "" + +#: ../../c-api/unicode.rst:1899 +msgid "" +"In previous versions, this was a 16-bit type or a 32-bit type depending on " +"whether you selected a \"narrow\" or \"wide\" Unicode version of Python at " +"build time." +msgstr "" + +#: ../../c-api/unicode.rst:1909 +#, fuzzy +msgid "" +"Do nothing and return ``0``. This API is kept only for backward " +"compatibility, but there are no plans to remove it." +msgstr "回傳 ``0``。此 API 僅保留以維持向後相容性。" + +#: ../../c-api/unicode.rst:1915 +msgid "" +"This API does nothing since Python 3.12. Previously, this needed to be " +"called for each string created using the old API (:c:func:`!" +"PyUnicode_FromUnicode` or similar)." +msgstr "" + +#: ../../c-api/unicode.rst:1923 +#, fuzzy +msgid "" +"Do nothing and return ``1``. This API is kept only for backward " +"compatibility, but there are no plans to remove it." +msgstr "回傳 ``0``。此 API 僅保留以維持向後相容性。" + +#: ../../c-api/unicode.rst:1929 +msgid "" +"This API does nothing since Python 3.12. Previously, this could be called to " +"check if :c:func:`PyUnicode_READY` is necessary." +msgstr "" + +#~ msgid "This API does nothing since Python 3.12." +#~ msgstr "自 Python 3.12 起,此 API 不再執行任何動作。" diff --git a/c-api/weakref.po b/c-api/weakref.po index 7bbbcb9f449..441c3b57644 100644 --- a/c-api/weakref.po +++ b/c-api/weakref.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -116,22 +116,29 @@ msgstr "" #: ../../c-api/weakref.rst:93 msgid "" +"Test if the weak reference *ref* is dead. Returns 1 if the reference is " +"dead, 0 if it is alive, and -1 with an error set if *ref* is not a weak " +"reference object." +msgstr "" + +#: ../../c-api/weakref.rst:102 +msgid "" "This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler " "to clear weak references." msgstr "" -#: ../../c-api/weakref.rst:96 +#: ../../c-api/weakref.rst:105 msgid "" "This iterates through the weak references for *object* and calls callbacks " "for those references which have one. It returns when all callbacks have been " "attempted." msgstr "" -#: ../../c-api/weakref.rst:103 +#: ../../c-api/weakref.rst:112 msgid "Clears the weakrefs for *object* without calling the callbacks." msgstr "" -#: ../../c-api/weakref.rst:105 +#: ../../c-api/weakref.rst:114 msgid "" "This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler " "for types with finalizers (i.e., :meth:`~object.__del__`). The handler for " @@ -140,8 +147,9 @@ msgid "" "clear any weakrefs that may have been created by the finalizer." msgstr "" -#: ../../c-api/weakref.rst:111 +#: ../../c-api/weakref.rst:120 msgid "" -"In most circumstances, it's more appropriate to use :c:func:" -"`PyObject_ClearWeakRefs` to clear weakrefs instead of this function." +"In most circumstances, it's more appropriate to " +"use :c:func:`PyObject_ClearWeakRefs` to clear weakrefs instead of this " +"function." msgstr "" diff --git a/copyright.po b/copyright.po index 50a39fdee2a..446dbefebfa 100644 --- a/copyright.po +++ b/copyright.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2021-06-25 20:17+0800\n" "Last-Translator: meowmeowcat \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,7 +32,8 @@ msgid "Python and this documentation is:" msgstr "Python 和這份說明文件的版權:" #: ../../copyright.rst:7 -msgid "Copyright © 2001-2024 Python Software Foundation. All rights reserved." +#, fuzzy +msgid "Copyright © 2001 Python Software Foundation. All rights reserved." msgstr "Copyright © 2001-2024 Python Software Foundation. All rights reserved." #: ../../copyright.rst:9 diff --git a/deprecations/c-api-pending-removal-in-3.14.po b/deprecations/c-api-pending-removal-in-3.14.po index 85417537877..795792b32c0 100644 --- a/deprecations/c-api-pending-removal-in-3.14.po +++ b/deprecations/c-api-pending-removal-in-3.14.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -16,7 +16,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 -msgid "Pending Removal in Python 3.14" +#, fuzzy +msgid "Pending removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 @@ -35,174 +36,154 @@ msgstr "" "使用可變基底建立\\ :c:data:`不可變型別 ` " "(:gh:`95388`)。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 -msgid "" -"Functions to configure Python's initialization, deprecated in Python 3.11:" -msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:12 -msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." -msgstr ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:14 -msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." -msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:16 -msgid "" -":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " -"instead." -msgstr "" -":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設" -"定。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:18 -msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." -msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 -msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead." -msgstr "" -":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 -msgid "Global configuration variables:" -msgstr "全域設定變數:" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 -msgid ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` instead." -msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 -msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` instead." -msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 -msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` instead." -msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 -msgid "" -":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` instead." -msgstr ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 -msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` instead." -msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:36 -msgid "" -":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " -"instead." -msgstr "" -":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 -msgid ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` instead." -msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 -msgid "" -":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` instead." -msgstr "" -":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 -msgid "" -":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` instead." -msgstr "" -":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:44 -msgid "" -":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " -"instead." -msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 -msgid "" -":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " -"instead." -msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改" -"用 :c:member:`PyConfig.write_bytecode`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 -msgid "" -":c:var:`Py_NoUserSiteDirectory`: " -"Use :c:member:`PyConfig.user_site_directory` instead." -msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 -msgid "" -":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " -"instead." -msgstr "" -":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:52 -msgid "" -":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " -"and :c:member:`PyConfig.hash_seed` instead." -msgstr "" -":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " -"和 :c:member:`PyConfig.hash_seed`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:55 -msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` instead." -msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 -msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` instead." -msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 -msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"Use :c:member:`PyConfig.legacy_windows_stdio` instead." -msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 -msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` instead." -msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 -msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` instead." -msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 -msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"Use :c:member:`PyConfig.filesystem_errors` instead." -msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors`。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 -msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. " -"(see :c:func:`Py_PreInitialize`)" -msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" -"見 :c:func:`Py_PreInitialize`)" +#~ msgid "" +#~ "Functions to configure Python's initialization, deprecated in Python 3.11:" +#~ msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" + +#~ msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +#~ msgstr "" +#~ ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" + +#~ msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +#~ msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" + +#~ msgid "" +#~ ":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +#~ "instead." +#~ msgstr "" +#~ ":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` " +#~ "設定。" + +#~ msgid "" +#~ ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +#~ msgstr "" +#~ ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" + +#~ msgid "" +#~ "The :c:func:`Py_InitializeFromConfig` API should be used " +#~ "with :c:type:`PyConfig` instead." +#~ msgstr "" +#~ ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" + +#~ msgid "Global configuration variables:" +#~ msgstr "全域設定變數:" + +#~ msgid "" +#~ ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` instead." +#~ msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" + +#~ msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` instead." +#~ msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" + +#~ msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` instead." +#~ msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" + +#~ msgid "" +#~ ":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` instead." +#~ msgstr "" +#~ ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" + +#~ msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` instead." +#~ msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" + +#~ msgid "" +#~ ":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " +#~ "instead." +#~ msgstr "" +#~ ":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" + +#~ msgid "" +#~ ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` instead." +#~ msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" + +#~ msgid "" +#~ ":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " +#~ "instead." +#~ msgstr "" +#~ ":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" + +#~ msgid "" +#~ ":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " +#~ "instead." +#~ msgstr "" +#~ ":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" + +#~ msgid "" +#~ ":c:var:`Py_IgnoreEnvironmentFlag`: " +#~ "Use :c:member:`PyConfig.use_environment` instead." +#~ msgstr "" +#~ ":c:var:`Py_IgnoreEnvironmentFlag`:請改" +#~ "用 :c:member:`PyConfig.use_environment`。" + +#~ msgid "" +#~ ":c:var:`Py_DontWriteBytecodeFlag`: " +#~ "Use :c:member:`PyConfig.write_bytecode` instead." +#~ msgstr "" +#~ ":c:var:`Py_DontWriteBytecodeFlag`:請改" +#~ "用 :c:member:`PyConfig.write_bytecode`。" + +#~ msgid "" +#~ ":c:var:`Py_NoUserSiteDirectory`: " +#~ "Use :c:member:`PyConfig.user_site_directory` instead." +#~ msgstr "" +#~ ":c:var:`Py_NoUserSiteDirectory`:請改" +#~ "用 :c:member:`PyConfig.user_site_directory`。" + +#~ msgid "" +#~ ":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " +#~ "instead." +#~ msgstr "" +#~ ":c:var:`Py_UnbufferedStdioFlag`:請改" +#~ "用 :c:member:`PyConfig.buffered_stdio`。" + +#~ msgid "" +#~ ":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " +#~ "and :c:member:`PyConfig.hash_seed` instead." +#~ msgstr "" +#~ ":c:var:`Py_HashRandomizationFlag`:請改" +#~ "用 :c:member:`PyConfig.use_hash_seed` 和 :c:member:`PyConfig.hash_seed`。" + +#~ msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` instead." +#~ msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" + +#~ msgid "" +#~ ":c:var:`Py_LegacyWindowsFSEncodingFlag`: " +#~ "Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` instead." +#~ msgstr "" +#~ ":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" +#~ "用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" + +#~ msgid "" +#~ ":c:var:`Py_LegacyWindowsStdioFlag`: " +#~ "Use :c:member:`PyConfig.legacy_windows_stdio` instead." +#~ msgstr "" +#~ ":c:var:`Py_LegacyWindowsStdioFlag`:請改" +#~ "用 :c:member:`PyConfig.legacy_windows_stdio`。" + +#~ msgid "" +#~ ":c:var:`!Py_FileSystemDefaultEncoding`: " +#~ "Use :c:member:`PyConfig.filesystem_encoding` instead." +#~ msgstr "" +#~ ":c:var:`!Py_FileSystemDefaultEncoding`:請改" +#~ "用 :c:member:`PyConfig.filesystem_encoding`。" + +#~ msgid "" +#~ ":c:var:`!Py_HasFileSystemDefaultEncoding`: " +#~ "Use :c:member:`PyConfig.filesystem_encoding` instead." +#~ msgstr "" +#~ ":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" +#~ "用 :c:member:`PyConfig.filesystem_encoding`。" + +#~ msgid "" +#~ ":c:var:`!Py_FileSystemDefaultEncodeErrors`: " +#~ "Use :c:member:`PyConfig.filesystem_errors` instead." +#~ msgstr "" +#~ ":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" +#~ "用 :c:member:`PyConfig.filesystem_errors`。" + +#~ msgid "" +#~ ":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. " +#~ "(see :c:func:`Py_PreInitialize`)" +#~ msgstr "" +#~ ":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" +#~ "見 :c:func:`Py_PreInitialize`)" diff --git a/deprecations/c-api-pending-removal-in-3.15.po b/deprecations/c-api-pending-removal-in-3.15.po index 362a44992bc..39e99973edc 100644 --- a/deprecations/c-api-pending-removal-in-3.15.po +++ b/deprecations/c-api-pending-removal-in-3.15.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-03 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -16,77 +16,322 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:2 -msgid "Pending Removal in Python 3.15" +#, fuzzy +msgid "Pending removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" -"`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: " +"Use :c:func:`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" -"`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改" +"用 :c:func:`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" -"func:`PyWeakref_GetRef` instead." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " +"Use :c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project " +"`__ can be used to " +"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" -"func:`PyWeakref_GetRef`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:8 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" -"type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " +"Use :c:type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" -"`wchar_t`。" - -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 -msgid "Python initialization functions:" -msgstr "Python 初始化函式:" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" +"用 :c:type:`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 +#, fuzzy msgid "" -":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" -"warnings.filters` instead." +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" -"data:`!warnings.filters`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改" +"用 :c:func:`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 msgid "" -":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." -"exec_prefix` instead." +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`str`, such as :class:`bytes`." msgstr "" -":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" -"`sys.exec_prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:16 -msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 +#, fuzzy +msgid "" +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." +msgstr "" +":c:func:`PyImport_ImportModuleNoBlock`:請改" +"用 :c:func:`PyImport_ImportModule`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid "" +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`bytes`, such as :class:`str`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 +#, fuzzy +msgid "Python initialization functions, deprecated in Python 3.13:" +msgstr "Python 初始化函式:" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:24 +#, fuzzy +msgid "" +":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`) instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:18 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:27 msgid "" -":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " -"instead." +":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`) instead. " +"Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) " +"if :ref:`virtual environments ` need to be handled." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:32 +msgid "" +":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") " +"` (:data:`sys.base_exec_prefix`) instead. " +"Use :c:func:`PyConfig_Get(\"exec_prefix\") ` " +"(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " +"be handled." msgstr "" -":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." -"prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:20 -msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:38 +#, fuzzy +msgid "" +":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 -msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:41 +#, fuzzy +msgid "" +":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:24 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:44 +#, fuzzy +msgid "" +":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " +"` or the :envvar:`PYTHONHOME` environment variable instead." +msgstr "" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " +"或 :envvar:`PYTHONHOME` 環境變數。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:48 +msgid "" +"The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:52 +msgid "" +"Functions to configure Python's initialization, deprecated in Python 3.11:" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:54 +#, fuzzy +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:56 +#, fuzzy +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:58 +#, fuzzy +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." +msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:60 +#, fuzzy +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr "" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " +"或 :envvar:`PYTHONHOME` 環境變數。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:62 +msgid "" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" +"warnings.filters` instead." +msgstr "" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " +"和 :data:`!warnings.filters`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:65 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:68 +msgid "Global configuration variables:" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:70 +msgid "" +":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` " +"or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:73 +msgid "" +":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` " +"or :c:func:`PyConfig_Get(\"verbose\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:76 +msgid "" +":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` " +"or :c:func:`PyConfig_Get(\"quiet\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:79 +msgid "" +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` " +"or :c:func:`PyConfig_Get(\"interactive\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:82 +msgid "" +":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` " +"or :c:func:`PyConfig_Get(\"inspect\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:85 +msgid "" +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " +"or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:88 +msgid "" +":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` " +"or :c:func:`PyConfig_Get(\"site_import\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:91 +msgid "" +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " +"or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:94 msgid "" -":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" -"`PYTHONHOME` environment variable instead." +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " +"or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" -"`PYTHONHOME` 環境變數。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:97 +msgid "" +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " +"or :c:func:`PyConfig_Get(\"use_environment\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:100 +msgid "" +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " +"or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:103 +msgid "" +":c:var:`Py_NoUserSiteDirectory`: " +"Use :c:member:`PyConfig.user_site_directory` " +"or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:106 +msgid "" +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " +"or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:109 +msgid "" +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " +"and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " +"` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:113 +msgid "" +":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` " +"or :c:func:`PyConfig_Get(\"isolated\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:116 +msgid "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: " +"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` " +"or :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") ` " +"instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:119 +msgid "" +":c:var:`Py_LegacyWindowsStdioFlag`: " +"Use :c:member:`PyConfig.legacy_windows_stdio` " +"or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:122 +msgid "" +":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" +"Py_HasFileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` " +"or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:125 +msgid "" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: " +"Use :c:member:`PyConfig.filesystem_errors` " +"or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:128 +msgid "" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` " +"or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. " +"(see :c:func:`Py_PreInitialize`)" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:133 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can " +"be used to get these options at runtime." +msgstr "" + +#~ msgid "" +#~ ":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " +#~ "Use :c:func:`PyWeakref_GetRef` instead." +#~ msgstr "" +#~ ":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" +#~ "用 :c:func:`PyWeakref_GetRef`。" + +#~ msgid "" +#~ ":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " +#~ "and :data:`sys.exec_prefix` instead." +#~ msgstr "" +#~ ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " +#~ "與 :data:`sys.exec_prefix`。" + +#~ msgid "" +#~ ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` " +#~ "and :data:`sys.prefix` instead." +#~ msgstr "" +#~ ":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " +#~ "與 :data:`sys.prefix`。" diff --git a/deprecations/c-api-pending-removal-in-3.18.po b/deprecations/c-api-pending-removal-in-3.18.po new file mode 100644 index 00000000000..686c89004ab --- /dev/null +++ b/deprecations/c-api-pending-removal-in-3.18.po @@ -0,0 +1,142 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:2 +msgid "Pending removal in Python 3.18" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:4 +msgid "Deprecated private functions (:gh:`128863`):" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:6 +msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 +msgid "" +":c:func:`!_PyDict_GetItemStringWithError`: " +"use :c:func:`PyDict_GetItemStringRef`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 +msgid ":c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 +msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 +msgid "" +":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: " +"use :c:func:`PyLongWriter_Create`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:12 +msgid "" +":c:func:`!_PyThreadState_UncheckedGet`: " +"use :c:func:`PyThreadState_GetUnchecked`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 +msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 +msgid "" +":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " +"with :c:func:`writer = PyUnicodeWriter_Create(0) `." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:17 +msgid "" +":c:func:`!_PyUnicodeWriter_Finish`: replace " +"``_PyUnicodeWriter_Finish(&writer)`` " +"with :c:func:`PyUnicodeWriter_Finish(writer) `." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:20 +msgid "" +":c:func:`!_PyUnicodeWriter_Dealloc`: replace " +"``_PyUnicodeWriter_Dealloc(&writer)`` " +"with :c:func:`PyUnicodeWriter_Discard(writer) `." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:23 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteChar`: replace " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` " +"with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " +"`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:26 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteStr`: replace " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` " +"with :c:func:`PyUnicodeWriter_WriteStr(writer, str) " +"`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:29 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` " +"with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:32 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` " +"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:35 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` " +"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:38 +msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 +msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 +msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 +msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:43 +msgid "" +"The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older." +msgstr "" diff --git a/deprecations/c-api-pending-removal-in-future.po b/deprecations/c-api-pending-removal-in-future.po index a9930288d2e..f1cab235508 100644 --- a/deprecations/c-api-pending-removal-in-future.po +++ b/deprecations/c-api-pending-removal-in-future.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -16,7 +16,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/c-api-pending-removal-in-future.rst:2 -msgid "Pending Removal in Future Versions" +#, fuzzy +msgid "Pending removal in future versions" msgstr "未來版本中的待移除項目" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 @@ -66,45 +67,21 @@ msgstr "" "和 :c:func:`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 -msgid "" -":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." -msgstr "" -":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" - -#: ../../deprecations/c-api-pending-removal-in-future.rst:23 -msgid "" -":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead." -msgstr "" -":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" - -#: ../../deprecations/c-api-pending-removal-in-future.rst:25 -msgid "" -":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." -msgstr "" -":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" - -#: ../../deprecations/c-api-pending-removal-in-future.rst:27 -msgid "" -":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead." -msgstr "" -":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" - -#: ../../deprecations/c-api-pending-removal-in-future.rst:29 msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" msgstr ":c:func:`PyUnicode_READY`:自 Python 3.12 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:31 +#: ../../deprecations/c-api-pending-removal-in-future.rst:23 msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." msgstr ":c:func:`!PyErr_Display`:請改用 :c:func:`PyErr_DisplayException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:33 +#: ../../deprecations/c-api-pending-removal-in-future.rst:25 msgid "" ":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " "instead." msgstr "" ":c:func:`!_PyErr_ChainExceptions`:請改用 ``_PyErr_ChainExceptions1``。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:35 +#: ../../deprecations/c-api-pending-removal-in-future.rst:27 msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." @@ -112,40 +89,63 @@ msgstr "" ":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" "叫 :c:func:`PyObject_Hash`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:37 -msgid ":c:member:`!PyDictObject.ma_version_tag` member." -msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" - -#: ../../deprecations/c-api-pending-removal-in-future.rst:38 +#: ../../deprecations/c-api-pending-removal-in-future.rst:29 msgid "Thread Local Storage (TLS) API:" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../deprecations/c-api-pending-removal-in-future.rst:40 +#: ../../deprecations/c-api-pending-removal-in-future.rst:31 msgid "" ":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." msgstr ":c:func:`PyThread_create_key`:請改用 :c:func:`PyThread_tss_alloc`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:42 +#: ../../deprecations/c-api-pending-removal-in-future.rst:33 msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." msgstr ":c:func:`PyThread_delete_key`:請改用 :c:func:`PyThread_tss_free`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:44 +#: ../../deprecations/c-api-pending-removal-in-future.rst:35 msgid "" ":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." msgstr ":c:func:`PyThread_set_key_value`:請改用 :c:func:`PyThread_tss_set`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:46 +#: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid "" ":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." msgstr ":c:func:`PyThread_get_key_value`:請改用 :c:func:`PyThread_tss_get`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:48 +#: ../../deprecations/c-api-pending-removal-in-future.rst:39 msgid "" ":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " "instead." msgstr "" ":c:func:`PyThread_delete_key_value`:請改用 :c:func:`PyThread_tss_delete`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:50 +#: ../../deprecations/c-api-pending-removal-in-future.rst:41 msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" + +#~ msgid "" +#~ ":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` " +#~ "instead." +#~ msgstr "" +#~ ":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" + +#~ msgid "" +#~ ":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` " +#~ "instead." +#~ msgstr "" +#~ ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" + +#~ msgid "" +#~ ":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` " +#~ "instead." +#~ msgstr "" +#~ ":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" + +#~ msgid "" +#~ ":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` " +#~ "instead." +#~ msgstr "" +#~ ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" + +#~ msgid ":c:member:`!PyDictObject.ma_version_tag` member." +#~ msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" diff --git a/deprecations/index.po b/deprecations/index.po index 0b75d471905..6cc906f99d5 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-03 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -19,246 +19,11 @@ msgstr "" msgid "Deprecations" msgstr "已棄用項目" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 -#: ../../deprecations/pending-removal-in-3.14.rst:2 -msgid "Pending Removal in Python 3.14" -msgstr "Python 3.14 中待移除的項目" - -#: ../../deprecations/pending-removal-in-3.14.rst:4 -msgid "" -":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" -"argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " -"(Contributed by Nikita Sobolev in :gh:`92248`.)" -msgstr "" -":mod:`argparse`::class:`!argparse.BooleanOptionalAction` 的 *type*、" -"*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " -"於 :gh:`92248` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:9 -msgid "" -":mod:`ast`: The following features have been deprecated in documentation " -"since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " -"runtime when they are accessed or used, and will be removed in Python 3.14:" -msgstr "" -":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" -"於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" - -#: ../../deprecations/pending-removal-in-3.14.rst:13 -msgid ":class:`!ast.Num`" -msgstr ":class:`!ast.Num`" - -#: ../../deprecations/pending-removal-in-3.14.rst:14 -msgid ":class:`!ast.Str`" -msgstr ":class:`!ast.Str`" - -#: ../../deprecations/pending-removal-in-3.14.rst:15 -msgid ":class:`!ast.Bytes`" -msgstr ":class:`!ast.Bytes`" - -#: ../../deprecations/pending-removal-in-3.14.rst:16 -msgid ":class:`!ast.NameConstant`" -msgstr ":class:`!ast.NameConstant`" - -#: ../../deprecations/pending-removal-in-3.14.rst:17 -msgid ":class:`!ast.Ellipsis`" -msgstr ":class:`!ast.Ellipsis`" - -#: ../../deprecations/pending-removal-in-3.14.rst:19 -msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" -"`90953`.)" -msgstr "" -"請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:22 -#: ../../deprecations/pending-removal-in-3.16.rst:19 -msgid ":mod:`asyncio`:" -msgstr ":mod:`asyncio`:" - -#: ../../deprecations/pending-removal-in-3.14.rst:24 -msgid "" -"The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" -"`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" -"class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " -"Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" -msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`~asyncio." -"MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio." -"AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " -"Aditya 於 :gh:`94597` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:30 -msgid "" -":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" -"`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." -"AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " -"removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" -msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:" -"`asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`asyncio." -"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" -"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:36 -msgid "" -"The :meth:`~asyncio.get_event_loop` method of the default event loop policy " -"now emits a :exc:`DeprecationWarning` if there is no current event loop set " -"and it decides to create one. (Contributed by Serhiy Storchaka and Guido van " -"Rossum in :gh:`100160`.)" -msgstr "" -"預設事件迴圈策略的 :meth:`~asyncio.get_event_loop` 方法現在會在沒有設定目前事" -"件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " -"和 Guido van Rossum 於 :gh:`100160` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:41 -msgid "" -":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " -"Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." -"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" -msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改用 :" -"class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用時,請" -"改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " -"Shantanu Jain 於 :gh:`91896` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:47 -msgid "" -":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." -"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" -msgstr "" -":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " -"Alan Williams 於 :gh:`72346` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:50 -msgid ":mod:`importlib.abc` deprecated classes:" -msgstr ":mod:`importlib.abc` 的已棄用類別:" - -#: ../../deprecations/pending-removal-in-3.14.rst:52 -msgid ":class:`!importlib.abc.ResourceReader`" -msgstr ":class:`!importlib.abc.ResourceReader`" - -#: ../../deprecations/pending-removal-in-3.14.rst:53 -msgid ":class:`!importlib.abc.Traversable`" -msgstr ":class:`!importlib.abc.Traversable`" - -#: ../../deprecations/pending-removal-in-3.14.rst:54 -msgid ":class:`!importlib.abc.TraversableResources`" -msgstr ":class:`!importlib.abc.TraversableResources`" - -#: ../../deprecations/pending-removal-in-3.14.rst:56 -msgid "Use :mod:`importlib.resources.abc` classes instead:" -msgstr "請改用 :mod:`importlib.resources.abc` 類別:" - -#: ../../deprecations/pending-removal-in-3.14.rst:58 -msgid ":class:`importlib.resources.abc.Traversable`" -msgstr ":class:`importlib.resources.abc.Traversable`" - -#: ../../deprecations/pending-removal-in-3.14.rst:59 -msgid ":class:`importlib.resources.abc.TraversableResources`" -msgstr ":class:`importlib.resources.abc.TraversableResources`" - -#: ../../deprecations/pending-removal-in-3.14.rst:61 -msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" -msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:63 -msgid "" -":mod:`itertools` had undocumented, inefficient, historically buggy, and " -"inconsistent support for copy, deepcopy, and pickle operations. This will be " -"removed in 3.14 for a significant reduction in code volume and maintenance " -"burden. (Contributed by Raymond Hettinger in :gh:`101588`.)" -msgstr "" -":mod:`itertools` 有不以文件記錄、效率低下、過去常有 bug 且不一致的 copy、" -"deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " -"(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:69 -msgid "" -":mod:`multiprocessing`: The default start method will change to a safer one " -"on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " -"currently the default (:gh:`84559`). Adding a runtime warning about this was " -"deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." -"set_start_method` APIs to explicitly specify when your code *requires* " -"``'fork'``. See :ref:`multiprocessing-start-methods`." -msgstr "" -":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" -"台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" -"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " -"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" -"`multiprocessing-start-methods`。" - -#: ../../deprecations/pending-removal-in-3.14.rst:77 -msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." -"PurePath.relative_to`: passing additional arguments is deprecated." -msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" -"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" - -#: ../../deprecations/pending-removal-in-3.14.rst:81 -msgid "" -":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " -"now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " -"instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" -msgstr "" -":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." -"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:86 -msgid ":mod:`pty`:" -msgstr ":mod:`pty`:" - -#: ../../deprecations/pending-removal-in-3.14.rst:88 -msgid "``master_open()``: use :func:`pty.openpty`." -msgstr "``master_open()``:請用 :func:`pty.openpty`。" - -#: ../../deprecations/pending-removal-in-3.14.rst:89 -msgid "``slave_open()``: use :func:`pty.openpty`." -msgstr "``slave_open()``:請用 :func:`pty.openpty`。" - -#: ../../deprecations/pending-removal-in-3.14.rst:91 -msgid ":mod:`sqlite3`:" -msgstr ":mod:`sqlite3`:" - -#: ../../deprecations/pending-removal-in-3.14.rst:93 -msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." -msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" - -#: ../../deprecations/pending-removal-in-3.14.rst:95 -msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" -"ref:`named placeholders ` are used and *parameters* is " -"a sequence instead of a :class:`dict`." -msgstr "" -":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" -"使用 :ref:`named placeholders ` 且 *parameters* 是序列" -"而不是 :class:`dict`。" - -#: ../../deprecations/pending-removal-in-3.14.rst:99 -msgid "" -":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " -"causes a :exc:`DeprecationWarning` to be emitted when it is used." -msgstr "" -":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" -"使用時會發出 :exc:`DeprecationWarning`。" - -#: ../../deprecations/pending-removal-in-3.14.rst:102 -msgid "" -":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" -"`88168`.)" -msgstr "" -":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" -"(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" - #: ../../deprecations/c-api-pending-removal-in-3.15.rst:2 #: ../../deprecations/pending-removal-in-3.15.rst:2 -msgid "Pending Removal in Python 3.15" -msgstr "Python 3.15 中待移除的項目" +#, fuzzy +msgid "Pending removal in Python 3.15" +msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:4 #: ../../deprecations/pending-removal-in-3.16.rst:4 @@ -267,10 +32,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" -"`__spec__.cached ` is deprecated. In " -"Python 3.15, :attr:`!__cached__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to " +"set :attr:`__spec__.cached ` is " +"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " +"into consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "` 的做法已被棄用。在 Python 3.15 中," @@ -278,16 +43,18 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to set :attr:" -"`__spec__.parent ` is deprecated. In " -"Python 3.15, :attr:`!__package__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to " +"set :attr:`__spec__.parent ` is " +"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " +"take into consideration by the import system or standard library. " +"(:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "` 的做法已被棄用。在 Python 3.15 中," "引入系統或標準函式庫將不再設定或考慮 :attr:`!__package__`。(:gh:`97879`)" #: ../../deprecations/pending-removal-in-3.15.rst:16 +#: ../../deprecations/pending-removal-in-3.19.rst:4 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" @@ -321,7 +88,7 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 -#: ../../deprecations/pending-removal-in-future.rst:56 +#: ../../deprecations/pending-removal-in-future.rst:64 msgid ":mod:`importlib`:" msgstr ":mod:`importlib`:" @@ -336,15 +103,17 @@ msgstr ":class:`locale`:" #: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" -"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." -"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " -"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 " +"(:gh:`90817`), but has been postponed to Python 3.15. " +"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " +"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " +"in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" -"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." -"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" +"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " +"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" @@ -352,11 +121,11 @@ msgstr ":mod:`pathlib`:" #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" -"func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " +"Use :func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." -"isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" +"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" @@ -372,6 +141,7 @@ msgstr "" "援有用,具有令人困惑的 API,基本上未經測試。" #: ../../deprecations/pending-removal-in-3.15.rst:58 +#: ../../deprecations/pending-removal-in-3.16.rst:96 msgid ":mod:`sysconfig`:" msgstr ":mod:`sysconfig`:" @@ -410,20 +180,22 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" +"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " +"於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:80 +#: ../../deprecations/pending-removal-in-3.17.rst:4 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" #: ../../deprecations/pending-removal-in-3.15.rst:82 +#, fuzzy msgid "" -"The undocumented keyword argument syntax for creating :class:`~typing." -"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " -"has been deprecated since Python 3.13. Use the class-based syntax or the " -"functional syntax instead." +"The undocumented keyword argument syntax for " +"creating :class:`~typing.NamedTuple` classes (for example, ``Point = " +"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " +"3.13. Use the class-based syntax or the functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" @@ -458,13 +230,29 @@ msgstr ":mod:`wave`:" #: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." -"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" -"`~wave.Wave_write` classes have been deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " +"and :meth:`~wave.Wave_read.getmarkers` methods of " +"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " +"deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" -"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." -"getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" +"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " +"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:107 +#, fuzzy +msgid ":mod:`zipimport`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:109 +#, fuzzy +msgid "" +":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python " +"3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " +"by Jiahao Li in :gh:`125746`.)" +msgstr "" +":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" +"用 :meth:`~zipimport.zipimporter.exec_module`。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" @@ -472,10 +260,10 @@ msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader ` is deprecated. In " -"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to " +"set :attr:`__spec__.loader ` is " +"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " +"taken into consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "` 的做法將於 Python 3.16 被棄用。在 " @@ -495,22 +283,81 @@ msgstr "" "Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " "來取代 Unicode 字元。" +#: ../../deprecations/pending-removal-in-3.16.rst:19 +msgid ":mod:`asyncio`:" +msgstr ":mod:`asyncio`:" + #: ../../deprecations/pending-removal-in-3.16.rst:21 +#, fuzzy msgid "" ":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " -"Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" -"gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " +"於 :gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 -#: ../../deprecations/pending-removal-in-future.rst:10 +msgid "" +":mod:`asyncio` policy system is deprecated and will be removed in Python " +"3.16. In particular, the following classes and functions are deprecated:" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:29 +msgid ":class:`asyncio.AbstractEventLoopPolicy`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:30 +msgid ":class:`asyncio.DefaultEventLoopPolicy`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:31 +msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:32 +msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:33 +msgid ":func:`asyncio.get_event_loop_policy`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:34 +msgid ":func:`asyncio.set_event_loop_policy`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:36 +msgid "" +"Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " +"*loop_factory* to use the desired event loop implementation." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:39 +msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:41 +msgid "" +"import asyncio\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:48 +msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:50 +#: ../../deprecations/pending-removal-in-future.rst:16 msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" -#: ../../deprecations/pending-removal-in-3.16.rst:28 +#: ../../deprecations/pending-removal-in-3.16.rst:52 msgid "" "Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " "deprecated since Python 3.12, as it produces surprising and unintuitive " @@ -523,11 +370,48 @@ msgstr "" "邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " "``~int(x)`` (``~int(x)``)。" -#: ../../deprecations/pending-removal-in-3.16.rst:35 +#: ../../deprecations/pending-removal-in-3.16.rst:59 +#, fuzzy +msgid ":mod:`functools`:" +msgstr ":mod:`ctypes`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:61 +msgid "" +"Calling the Python implementation of :func:`functools.reduce` with " +"*function* or *sequence* as keyword arguments has been deprecated since " +"Python 3.14." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:64 +#, fuzzy +msgid ":mod:`logging`:" +msgstr ":mod:`typing`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:66 +msgid "" +"Support for custom logging handlers with the *strm* argument is deprecated " +"and scheduled for removal in Python 3.16. Define handlers with the *stream* " +"argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:70 +#, fuzzy +msgid ":mod:`mimetypes`:" +msgstr ":mod:`types`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:72 +msgid "" +"Valid extensions start with a '.' or are empty " +"for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated " +"and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " +"Kemenade in :gh:`75223`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:78 msgid ":mod:`shutil`:" msgstr ":mod:`shutil`:" -#: ../../deprecations/pending-removal-in-3.16.rst:37 +#: ../../deprecations/pending-removal-in-3.16.rst:80 msgid "" "The :class:`!ExecError` exception has been deprecated since Python 3.14. It " "has not been used by any function in :mod:`!shutil` since Python 3.4, and is " @@ -536,11 +420,11 @@ msgstr "" "自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" "未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" -#: ../../deprecations/pending-removal-in-3.16.rst:42 +#: ../../deprecations/pending-removal-in-3.16.rst:85 msgid ":mod:`symtable`:" msgstr ":mod:`symtable`:" -#: ../../deprecations/pending-removal-in-3.16.rst:44 +#: ../../deprecations/pending-removal-in-3.16.rst:87 msgid "" "The :meth:`Class.get_methods ` method has been " "deprecated since Python 3.14." @@ -548,11 +432,11 @@ msgstr "" "自 Python 3.14 起,:meth:`Class.get_methods ` 方" "法已被棄用。" -#: ../../deprecations/pending-removal-in-3.16.rst:47 +#: ../../deprecations/pending-removal-in-3.16.rst:90 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../deprecations/pending-removal-in-3.16.rst:49 +#: ../../deprecations/pending-removal-in-3.16.rst:92 msgid "" "The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " "since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " @@ -561,11 +445,21 @@ msgstr "" "自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" -#: ../../deprecations/pending-removal-in-3.16.rst:53 +#: ../../deprecations/pending-removal-in-3.16.rst:98 +#, fuzzy +msgid "" +"The :func:`!sysconfig.expand_makefile_vars` function has been deprecated " +"since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " +"instead." +msgstr "" +"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" +"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" + +#: ../../deprecations/pending-removal-in-3.16.rst:102 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../deprecations/pending-removal-in-3.16.rst:55 +#: ../../deprecations/pending-removal-in-3.16.rst:104 msgid "" "The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " "deprecated since Python 3.13." @@ -573,9 +467,37 @@ msgstr "" "自 Python 3.13 起,未以文件記錄和未被使用的 :attr:`!TarFile.tarfile` 屬性已被" "棄用。" +#: ../../deprecations/pending-removal-in-3.17.rst:2 +#, fuzzy +msgid "Pending removal in Python 3.17" +msgstr "Python 3.16 中待移除的項目" + +#: ../../deprecations/pending-removal-in-3.17.rst:6 +msgid "" +"Before Python 3.14, old-style unions were implemented using the private " +"class ``typing._UnionGenericAlias``. This class is no longer needed for the " +"implementation, but it has been retained for backward compatibility, with " +"removal scheduled for Python 3.17. Users should use documented introspection " +"helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " +"of relying on private implementation details." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.19.rst:2 +#, fuzzy +msgid "Pending removal in Python 3.19" +msgstr "Python 3.16 中待移除的項目" + +#: ../../deprecations/pending-removal-in-3.19.rst:6 +msgid "" +"Implicitly switching to the MSVC-compatible struct layout by " +"setting :attr:`~ctypes.Structure._pack_` but " +"not :attr:`~ctypes.Structure._layout_` on non-Windows platforms." +msgstr "" + #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 -msgid "Pending Removal in Future Versions" +#, fuzzy +msgid "Pending removal in future versions" msgstr "未來版本中的待移除項目" #: ../../deprecations/pending-removal-in-future.rst:4 @@ -585,16 +507,31 @@ msgid "" msgstr "以下 API 將在未來被移除,雖然目前尚未安排移除日期。" #: ../../deprecations/pending-removal-in-future.rst:7 +#, fuzzy +msgid ":mod:`argparse`:" +msgstr ":mod:`array`:" + +#: ../../deprecations/pending-removal-in-future.rst:9 +#, fuzzy msgid "" -":mod:`argparse`: Nesting argument groups and nesting mutually exclusive " -"groups are deprecated." +"Nesting argument groups and nesting mutually exclusive groups are deprecated." msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" -#: ../../deprecations/pending-removal-in-future.rst:12 +#: ../../deprecations/pending-removal-in-future.rst:11 +msgid "" +"Passing the undocumented keyword argument *prefix_chars* " +"to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:14 +msgid "The :class:`argparse.FileType` type converter is deprecated." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:18 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" -#: ../../deprecations/pending-removal-in-future.rst:13 +#: ../../deprecations/pending-removal-in-future.rst:19 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -603,25 +540,25 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:16 +#: ../../deprecations/pending-removal-in-future.rst:22 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of keywords :keyword:" -"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" -"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " -"syntax error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of " +"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " +"and :keyword:`or`. In a future release it will be changed to a syntax " +"error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" -"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" -"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" -"本中,它將被更改為語法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" +"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " +"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" +"法錯誤。(:gh:`87999`)" -#: ../../deprecations/pending-removal-in-future.rst:24 +#: ../../deprecations/pending-removal-in-future.rst:30 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -630,80 +567,87 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:27 +#: ../../deprecations/pending-removal-in-future.rst:33 msgid "" -"Support for ``__float__()`` method returning a strict subclass of :class:" -"`float`: these methods will be required to return an instance of :class:" -"`float`." +"Support for ``__float__()`` method returning a strict subclass " +"of :class:`float`: these methods will be required to return an instance " +"of :class:`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:30 +#: ../../deprecations/pending-removal-in-future.rst:36 msgid "" -"Support for ``__complex__()`` method returning a strict subclass of :class:" -"`complex`: these methods will be required to return an instance of :class:" -"`complex`." +"Support for ``__complex__()`` method returning a strict subclass " +"of :class:`complex`: these methods will be required to return an instance " +"of :class:`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:33 +#: ../../deprecations/pending-removal-in-future.rst:39 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:34 +#: ../../deprecations/pending-removal-in-future.rst:40 msgid "" -"Passing a complex number as the *real* or *imag* argument in the :func:" -"`complex` constructor is now deprecated; it should only be passed as a " -"single positional argument. (Contributed by Serhiy Storchaka in :gh:" -"`109218`.)" +"Passing a complex number as the *real* or *imag* argument in " +"the :func:`complex` constructor is now deprecated; it should only be passed " +"as a single positional argument. (Contributed by Serhiy Storchaka " +"in :gh:`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:39 +#: ../../deprecations/pending-removal-in-future.rst:45 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." -"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` " +"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " +"in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:44 +#: ../../deprecations/pending-removal-in-future.rst:50 +msgid "" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " +"(:gh:`133038`)" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:52 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:47 +#: ../../deprecations/pending-removal-in-future.rst:55 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:49 +#: ../../deprecations/pending-removal-in-future.rst:57 msgid "" -":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." -"UTC)``." +":meth:`~datetime.datetime.utcnow`: use " +"``datetime.datetime.now(tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." -"now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 " +"``datetime.datetime.now(tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:51 +#: ../../deprecations/pending-removal-in-future.rst:59 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." -"fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." -"fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:54 +#: ../../deprecations/pending-removal-in-future.rst:62 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" -#: ../../deprecations/pending-removal-in-future.rst:58 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -711,39 +655,39 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:61 +#: ../../deprecations/pending-removal-in-future.rst:69 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:63 +#: ../../deprecations/pending-removal-in-future.rst:71 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:72 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" -"`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" +"用 :meth:`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:80 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:74 +#: ../../deprecations/pending-removal-in-future.rst:82 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -751,7 +695,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:85 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -763,12 +707,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:84 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:86 +#: ../../deprecations/pending-removal-in-future.rst:94 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -776,108 +720,116 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:91 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" -"`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " +"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" -"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " +"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:96 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:97 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:111 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:108 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid "" -":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." -"notify_all`." +":meth:`!threading.Condition.notifyAll`: " +"use :meth:`~threading.Condition.notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." -"notify_all`。" +":meth:`!threading.Condition.notifyAll`:請" +"用 :meth:`~threading.Condition.notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:109 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:110 +#: ../../deprecations/pending-removal-in-future.rst:118 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" -"attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " +"use :attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:120 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" -"attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " +"use :attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" -"attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" +"用 :attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:123 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:117 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:119 +#: ../../deprecations/pending-removal-in-future.rst:127 +msgid "" +"The internal class ``typing._UnionGenericAlias`` is no longer used to " +"implement :class:`typing.Union`. To preserve compatibility with users using " +"this private class, a compatibility shim will be provided until at least " +"Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -885,126 +837,207 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:122 +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:124 +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:126 +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:127 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:141 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:129 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:144 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:145 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:146 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:147 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:136 -msgid "" -":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" -"`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " -"Use newer :func:`~urllib.request.urlopen` functions and methods." -msgstr "" -":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` 和 :" -"class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" -"`~urllib.request.urlopen` 函式和方法。" - -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:149 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:143 +#: ../../deprecations/pending-removal-in-future.rst:152 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." -"etree.ElementTree.Element` is deprecated. In a future release it will always " -"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " -"instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of " +"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " +"release it will always return ``True``. Prefer explicit ``len(elem)`` or " +"``elem is not None`` tests instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." -"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " -"``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用" +"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" +"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:148 +#: ../../deprecations/pending-removal-in-future.rst:157 msgid "" -":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" -"`~zipimport.zipimporter.exec_module` instead." +":func:`sys._clear_type_cache` is deprecated: " +"use :func:`sys._clear_internal_caches` instead." msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." -"zipimporter.exec_module`。" -#: ../../deprecations/index.rst:13 -msgid "C API Deprecations" +#: ../../deprecations/index.rst:15 +#, fuzzy +msgid "C API deprecations" msgstr "C API 的棄用項目" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 +msgid "" +"The :c:func:`PyImport_ImportModuleNoBlock`: " +"Use :c:func:`PyImport_ImportModule` instead." +msgstr "" +":c:func:`PyImport_ImportModuleNoBlock`:請改" +"用 :c:func:`PyImport_ImportModule`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 msgid "" -"The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " -"(:pep:`699`; :gh:`101193`)." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " +"Use :c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project " +"`__ can be used to " +"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." msgstr "" -":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" -"`699`;:gh:`101193`)。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 msgid "" -"Creating :c:data:`immutable types ` with mutable " -"bases (:gh:`95388`)." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " +"Use :c:type:`wchar_t` instead." msgstr "" -"使用可變基底建立\\ :c:data:`不可變型別 ` (:gh:" -"`95388`)。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" +"用 :c:type:`wchar_t`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 +msgid "" +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." +msgstr "" +":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 +msgid "" +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`str`, such as :class:`bytes`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid "" +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." +msgstr "" +":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid "" +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`bytes`, such as :class:`str`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 +#, fuzzy +msgid "Python initialization functions, deprecated in Python 3.13:" +msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:24 +#, fuzzy +msgid "" +":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`) instead." +msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:27 +msgid "" +":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`) instead. " +"Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) " +"if :ref:`virtual environments ` need to be handled." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:32 +msgid "" +":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") " +"` (:data:`sys.base_exec_prefix`) instead. " +"Use :c:func:`PyConfig_Get(\"exec_prefix\") ` " +"(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " +"be handled." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:38 +#, fuzzy +msgid "" +":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." +msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:41 +#, fuzzy +msgid "" +":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." +msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:44 +#, fuzzy +msgid "" +":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " +"` or the :envvar:`PYTHONHOME` environment variable instead." +msgstr "" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " +"或 :envvar:`PYTHONHOME` 環境變數。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:48 +msgid "" +"The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:52 msgid "" "Functions to configure Python's initialization, deprecated in Python 3.11:" msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:12 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:54 msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." msgstr ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:14 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:56 msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:16 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:58 msgid "" ":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " "instead." @@ -1012,228 +1045,341 @@ msgstr "" ":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設" "定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:18 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:60 msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:62 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" -"`PyConfig` instead." +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" +"warnings.filters` instead." +msgstr "" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " +"和 :data:`!warnings.filters`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:65 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:68 msgid "Global configuration variables:" msgstr "全域設定變數:" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 -msgid ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:70 +#, fuzzy +msgid "" +":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` " +"or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 -msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:73 +#, fuzzy +msgid "" +":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` " +"or :c:func:`PyConfig_Get(\"verbose\") ` instead." msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 -msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:76 +#, fuzzy +msgid "" +":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` " +"or :c:func:`PyConfig_Get(\"quiet\") ` instead." msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:79 +#, fuzzy msgid "" -":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` instead." +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` " +"or :c:func:`PyConfig_Get(\"interactive\") ` instead." msgstr ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 -msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:82 +#, fuzzy +msgid "" +":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` " +"or :c:func:`PyConfig_Get(\"inspect\") ` instead." msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:36 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:85 +#, fuzzy msgid "" ":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " -"instead." +"or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." msgstr "" ":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 -msgid ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:88 +#, fuzzy +msgid "" +":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` " +"or :c:func:`PyConfig_Get(\"site_import\") ` instead." msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:91 +#, fuzzy msgid "" -":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` instead." +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " +"or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." msgstr "" ":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:94 +#, fuzzy msgid "" -":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` instead." +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " +"or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" ":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:44 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:97 +#, fuzzy msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " -"instead." +"or :c:func:`PyConfig_Get(\"use_environment\") ` instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." -"use_environment`。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改" +"用 :c:member:`PyConfig.use_environment`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:100 +#, fuzzy msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " -"instead." +"or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." -"write_bytecode`。" +":c:var:`Py_DontWriteBytecodeFlag`:請改" +"用 :c:member:`PyConfig.write_bytecode`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:103 +#, fuzzy msgid "" -":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." -"user_site_directory` instead." +":c:var:`Py_NoUserSiteDirectory`: " +"Use :c:member:`PyConfig.user_site_directory` " +"or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." -"user_site_directory`。" +":c:var:`Py_NoUserSiteDirectory`:請改" +"用 :c:member:`PyConfig.user_site_directory`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:106 +#, fuzzy msgid "" ":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " -"instead." +"or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." msgstr "" ":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:52 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:109 +#, fuzzy msgid "" ":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " -"and :c:member:`PyConfig.hash_seed` instead." +"and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " +"` instead." msgstr "" ":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:55 -msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:113 +#, fuzzy +msgid "" +":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` " +"or :c:func:`PyConfig_Get(\"isolated\") ` instead." msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:116 +#, fuzzy msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." -"legacy_windows_fs_encoding` instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: " +"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` " +"or :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") ` " +"instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." -"legacy_windows_fs_encoding`。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" +"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:119 +#, fuzzy msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." -"legacy_windows_stdio` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: " +"Use :c:member:`PyConfig.legacy_windows_stdio` " +"or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." -"legacy_windows_stdio`。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改" +"用 :c:member:`PyConfig.legacy_windows_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:122 +#, fuzzy msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." -"filesystem_encoding` instead." +":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" +"Py_HasFileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` " +"or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." -"filesystem_encoding`。" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:125 +#, fuzzy msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." -"filesystem_encoding` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: " +"Use :c:member:`PyConfig.filesystem_errors` " +"or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." -"filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" +"用 :c:member:`PyConfig.filesystem_errors`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:128 +#, fuzzy msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." -"filesystem_errors` instead." +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` " +"or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. " +"(see :c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." -"filesystem_errors`。" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" +"見 :c:func:`Py_PreInitialize`)" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:133 +#, fuzzy msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" -"c:func:`Py_PreInitialize`)" +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can " +"be used to get these options at runtime." msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" -"func:`Py_PreInitialize`)" +":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:2 +#, fuzzy +msgid "Pending removal in Python 3.18" +msgstr "Python 3.16 中待移除的項目" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:4 +msgid "Deprecated private functions (:gh:`128863`):" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:6 +#, fuzzy +msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." +msgstr ":c:func:`PyThread_create_key`:請改用 :c:func:`PyThread_tss_alloc`。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" -"`PyImport_ImportModule` instead." +":c:func:`!_PyDict_GetItemStringWithError`: " +"use :c:func:`PyDict_GetItemStringRef`." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" -"`PyImport_ImportModule`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 +#, fuzzy +msgid ":c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`." +msgstr ":c:func:`!PyErr_Display`:請改用 :c:func:`PyErr_DisplayException`。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 +msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" -"func:`PyWeakref_GetRef` instead." +":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: " +"use :c:func:`PyLongWriter_Create`." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" -"func:`PyWeakref_GetRef`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:8 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:12 +#, fuzzy msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" -"type:`wchar_t` instead." +":c:func:`!_PyThreadState_UncheckedGet`: " +"use :c:func:`PyThreadState_GetUnchecked`." +msgstr ":c:func:`PyThread_set_key_value`:請改用 :c:func:`PyThread_tss_set`。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 +#, fuzzy +msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" -"`wchar_t`。" +":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 -msgid "Python initialization functions:" -msgstr "Python 初始化函式:" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 +msgid "" +":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " +"with :c:func:`writer = PyUnicodeWriter_Create(0) `." +msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:17 msgid "" -":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" -"warnings.filters` instead." +":c:func:`!_PyUnicodeWriter_Finish`: replace " +"``_PyUnicodeWriter_Finish(&writer)`` " +"with :c:func:`PyUnicodeWriter_Finish(writer) `." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" -"data:`!warnings.filters`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:20 msgid "" -":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." -"exec_prefix` instead." +":c:func:`!_PyUnicodeWriter_Dealloc`: replace " +"``_PyUnicodeWriter_Dealloc(&writer)`` " +"with :c:func:`PyUnicodeWriter_Discard(writer) `." msgstr "" -":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" -"`sys.exec_prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:16 -msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." -msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:23 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteChar`: replace " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` " +"with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " +"`." +msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:18 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:26 msgid "" -":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " -"instead." +":c:func:`!_PyUnicodeWriter_WriteStr`: replace " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` " +"with :c:func:`PyUnicodeWriter_WriteStr(writer, str) " +"`." msgstr "" -":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." -"prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:20 -msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." -msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:29 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` " +"with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`." +msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 -msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." -msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:32 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` " +"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`." +msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:24 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:35 msgid "" -":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" -"`PYTHONHOME` environment variable instead." +":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` " +"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:38 +msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 +msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 +#, fuzzy +msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." +msgstr ":c:func:`PyErr_Restore`:請改用 :c:func:`PyErr_SetRaisedException`。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 +#, fuzzy +msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." +msgstr "" +":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:43 +msgid "" +"The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" -"`PYTHONHOME` 環境變數。" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -1254,8 +1400,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改用 :c:func:" -"`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改" +"用 :c:func:`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -1275,97 +1421,347 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" -"`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " +"和 :c:func:`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 -msgid "" -":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." -msgstr "" -":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" - -#: ../../deprecations/c-api-pending-removal-in-future.rst:23 -msgid "" -":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead." -msgstr "" -":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" - -#: ../../deprecations/c-api-pending-removal-in-future.rst:25 -msgid "" -":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." -msgstr "" -":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" - -#: ../../deprecations/c-api-pending-removal-in-future.rst:27 -msgid "" -":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead." -msgstr "" -":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" - -#: ../../deprecations/c-api-pending-removal-in-future.rst:29 msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" msgstr ":c:func:`PyUnicode_READY`:自 Python 3.12 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:31 +#: ../../deprecations/c-api-pending-removal-in-future.rst:23 msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." msgstr ":c:func:`!PyErr_Display`:請改用 :c:func:`PyErr_DisplayException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:33 +#: ../../deprecations/c-api-pending-removal-in-future.rst:25 msgid "" ":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " "instead." msgstr "" ":c:func:`!_PyErr_ChainExceptions`:請改用 ``_PyErr_ChainExceptions1``。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:35 +#: ../../deprecations/c-api-pending-removal-in-future.rst:27 msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" -"`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" +"叫 :c:func:`PyObject_Hash`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:37 -msgid ":c:member:`!PyDictObject.ma_version_tag` member." -msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" - -#: ../../deprecations/c-api-pending-removal-in-future.rst:38 +#: ../../deprecations/c-api-pending-removal-in-future.rst:29 msgid "Thread Local Storage (TLS) API:" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../deprecations/c-api-pending-removal-in-future.rst:40 +#: ../../deprecations/c-api-pending-removal-in-future.rst:31 msgid "" ":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." msgstr ":c:func:`PyThread_create_key`:請改用 :c:func:`PyThread_tss_alloc`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:42 +#: ../../deprecations/c-api-pending-removal-in-future.rst:33 msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." msgstr ":c:func:`PyThread_delete_key`:請改用 :c:func:`PyThread_tss_free`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:44 +#: ../../deprecations/c-api-pending-removal-in-future.rst:35 msgid "" ":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." msgstr ":c:func:`PyThread_set_key_value`:請改用 :c:func:`PyThread_tss_set`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:46 +#: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid "" ":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." msgstr ":c:func:`PyThread_get_key_value`:請改用 :c:func:`PyThread_tss_get`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:48 +#: ../../deprecations/c-api-pending-removal-in-future.rst:39 msgid "" ":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " "instead." msgstr "" ":c:func:`PyThread_delete_key_value`:請改用 :c:func:`PyThread_tss_delete`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:50 +#: ../../deprecations/c-api-pending-removal-in-future.rst:41 msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" +#~ msgid "Pending Removal in Python 3.14" +#~ msgstr "Python 3.14 中待移除的項目" + +#~ msgid "" +#~ ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters " +#~ "of :class:`!argparse.BooleanOptionalAction` are deprecated and will be " +#~ "removed in 3.14. (Contributed by Nikita Sobolev in :gh:`92248`.)" +#~ msgstr "" +#~ ":mod:`argparse`::class:`!argparse.BooleanOptionalAction` 的 *type*、" +#~ "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita " +#~ "Sobolev 於 :gh:`92248` 貢獻。)" + +#~ msgid "" +#~ ":mod:`ast`: The following features have been deprecated in documentation " +#~ "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " +#~ "runtime when they are accessed or used, and will be removed in Python " +#~ "3.14:" +#~ msgstr "" +#~ ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時" +#~ "會於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" + +#~ msgid ":class:`!ast.Num`" +#~ msgstr ":class:`!ast.Num`" + +#~ msgid ":class:`!ast.Str`" +#~ msgstr ":class:`!ast.Str`" + +#~ msgid ":class:`!ast.Bytes`" +#~ msgstr ":class:`!ast.Bytes`" + +#~ msgid ":class:`!ast.NameConstant`" +#~ msgstr ":class:`!ast.NameConstant`" + +#~ msgid ":class:`!ast.Ellipsis`" +#~ msgstr ":class:`!ast.Ellipsis`" + +#~ msgid "" +#~ "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " +#~ "in :gh:`90953`.)" +#~ msgstr "" +#~ "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢" +#~ "獻。)" + +#~ msgid "" +#~ "The child watcher " +#~ "classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` " +#~ "and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed " +#~ "in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +#~ msgstr "" +#~ "已棄用並將在 Python 3.14 中移除的 child watcher 類" +#~ "別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " +#~ "和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" +#~ "獻。)" + +#~ msgid "" +#~ ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " +#~ "and :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are " +#~ "deprecated and will be removed in Python 3.14. (Contributed by Kumar " +#~ "Aditya in :gh:`94597`.)" +#~ msgstr "" +#~ ":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " +#~ "和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將" +#~ "在 Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" + +#~ msgid "" +#~ "The :meth:`~asyncio.get_event_loop` method of the default event loop " +#~ "policy now emits a :exc:`DeprecationWarning` if there is no current event " +#~ "loop set and it decides to create one. (Contributed by Serhiy Storchaka " +#~ "and Guido van Rossum in :gh:`100160`.)" +#~ msgstr "" +#~ "預設事件迴圈策略的 :meth:`~asyncio.get_event_loop` 方法現在會在沒有設定目" +#~ "前事件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy " +#~ "Storchaka 和 Guido van Rossum 於 :gh:`100160` 貢獻。)" + +#~ msgid "" +#~ ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " +#~ "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " +#~ "typing, prefer a union, like ``bytes | bytearray``, " +#~ "or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " +#~ "in :gh:`91896`.)" +#~ msgstr "" +#~ ":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" +#~ "用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使" +#~ "用時,請改用聯集,如 ``bytes | bytearray``," +#~ "或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" +#~ "獻。)" + +#~ msgid "" +#~ ":mod:`email`: Deprecated the *isdst* parameter " +#~ "in :func:`email.utils.localtime`. (Contributed by Alan Williams " +#~ "in :gh:`72346`.)" +#~ msgstr "" +#~ ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。" +#~ "(由 Alan Williams 於 :gh:`72346` 貢獻。)" + +#~ msgid ":mod:`importlib.abc` deprecated classes:" +#~ msgstr ":mod:`importlib.abc` 的已棄用類別:" + +#~ msgid ":class:`!importlib.abc.ResourceReader`" +#~ msgstr ":class:`!importlib.abc.ResourceReader`" + +#~ msgid ":class:`!importlib.abc.Traversable`" +#~ msgstr ":class:`!importlib.abc.Traversable`" + +#~ msgid ":class:`!importlib.abc.TraversableResources`" +#~ msgstr ":class:`!importlib.abc.TraversableResources`" + +#~ msgid "Use :mod:`importlib.resources.abc` classes instead:" +#~ msgstr "請改用 :mod:`importlib.resources.abc` 類別:" + +#~ msgid ":class:`importlib.resources.abc.Traversable`" +#~ msgstr ":class:`importlib.resources.abc.Traversable`" + +#~ msgid ":class:`importlib.resources.abc.TraversableResources`" +#~ msgstr ":class:`importlib.resources.abc.TraversableResources`" + +#~ msgid "" +#~ "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" +#~ msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" + +#~ msgid "" +#~ ":mod:`itertools` had undocumented, inefficient, historically buggy, and " +#~ "inconsistent support for copy, deepcopy, and pickle operations. This will " +#~ "be removed in 3.14 for a significant reduction in code volume and " +#~ "maintenance burden. (Contributed by Raymond Hettinger in :gh:`101588`.)" +#~ msgstr "" +#~ ":mod:`itertools` 有不以文件記錄、效率低下、過去常有 bug 且不一致的 copy、" +#~ "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負" +#~ "擔。 (由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" + +#~ msgid "" +#~ ":mod:`multiprocessing`: The default start method will change to a safer " +#~ "one on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` " +#~ "is currently the default (:gh:`84559`). Adding a runtime warning about " +#~ "this was deemed too disruptive as the majority of code is not expected to " +#~ "care. Use the :func:`~multiprocessing.get_context` " +#~ "or :func:`~multiprocessing.set_start_method` APIs to explicitly specify " +#~ "when your code *requires* ``'fork'``. See :ref:`multiprocessing-start-" +#~ "methods`." +#~ msgstr "" +#~ ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS " +#~ "POSIX 平台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。" +#~ "對此增加一個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" +#~ "用 :func:`~multiprocessing.get_context` " +#~ "或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時" +#~ "\\ *需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" + +#~ msgid "" +#~ ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " +#~ "and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments " +#~ "is deprecated." +#~ msgstr "" +#~ ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " +#~ "和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" + +#~ msgid "" +#~ ":mod:`pkgutil`: :func:`~pkgutil.find_loader` " +#~ "and :func:`~pkgutil.get_loader` now raise :exc:`DeprecationWarning`; " +#~ "use :func:`importlib.util.find_spec` instead. (Contributed by Nikita " +#~ "Sobolev in :gh:`97850`.)" +#~ msgstr "" +#~ ":mod:`pkgutil`::func:`~pkgutil.find_loader` " +#~ "和 :func:`~pkgutil.get_loader` 現在會引發 :exc:`DeprecationWarning`;請改" +#~ "用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" +#~ "獻。)" + +#~ msgid ":mod:`pty`:" +#~ msgstr ":mod:`pty`:" + +#~ msgid "``master_open()``: use :func:`pty.openpty`." +#~ msgstr "``master_open()``:請用 :func:`pty.openpty`。" + +#~ msgid "``slave_open()``: use :func:`pty.openpty`." +#~ msgstr "``slave_open()``:請用 :func:`pty.openpty`。" + +#~ msgid ":mod:`sqlite3`:" +#~ msgstr ":mod:`sqlite3`:" + +#~ msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." +#~ msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" + +#~ msgid "" +#~ ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " +#~ "if :ref:`named placeholders ` are used and " +#~ "*parameters* is a sequence instead of a :class:`dict`." +#~ msgstr "" +#~ ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如" +#~ "果使用 :ref:`named placeholders ` 且 *parameters* 是" +#~ "序列而不是 :class:`dict`。" + +#~ msgid "" +#~ ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, " +#~ "now causes a :exc:`DeprecationWarning` to be emitted when it is used." +#~ msgstr "" +#~ ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在" +#~ "在使用時會發出 :exc:`DeprecationWarning`。" + +#~ msgid "" +#~ ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " +#~ "intended to be a public API. (Contributed by Gregory P. Smith " +#~ "in :gh:`88168`.)" +#~ msgstr "" +#~ ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 " +#~ "API。(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" + +#~ msgid "Pending Removal in Python 3.15" +#~ msgstr "Python 3.15 中待移除的項目" + +#~ msgid "" +#~ ":mod:`urllib.request`: :class:`~urllib.request.URLopener` " +#~ "and :class:`~urllib.request.FancyURLopener` style of invoking requests is " +#~ "deprecated. Use newer :func:`~urllib.request.urlopen` functions and " +#~ "methods." +#~ msgstr "" +#~ ":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " +#~ "和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" +#~ "的 :func:`~urllib.request.urlopen` 函式和方法。" + +#~ msgid "" +#~ "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension " +#~ "modules (:pep:`699`; :gh:`101193`)." +#~ msgstr "" +#~ ":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " +#~ "(:pep:`699`;:gh:`101193`)。" + +#~ msgid "" +#~ "Creating :c:data:`immutable types ` with " +#~ "mutable bases (:gh:`95388`)." +#~ msgstr "" +#~ "使用可變基底建立\\ :c:data:`不可變型別 ` " +#~ "(:gh:`95388`)。" + +#~ msgid "" +#~ ":c:var:`!Py_FileSystemDefaultEncoding`: " +#~ "Use :c:member:`PyConfig.filesystem_encoding` instead." +#~ msgstr "" +#~ ":c:var:`!Py_FileSystemDefaultEncoding`:請改" +#~ "用 :c:member:`PyConfig.filesystem_encoding`。" + +#~ msgid "" +#~ ":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " +#~ "Use :c:func:`PyWeakref_GetRef` instead." +#~ msgstr "" +#~ ":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" +#~ "用 :c:func:`PyWeakref_GetRef`。" + +#~ msgid "Python initialization functions:" +#~ msgstr "Python 初始化函式:" + +#~ msgid "" +#~ ":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " +#~ "and :data:`sys.exec_prefix` instead." +#~ msgstr "" +#~ ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " +#~ "與 :data:`sys.exec_prefix`。" + +#~ msgid "" +#~ ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` " +#~ "and :data:`sys.prefix` instead." +#~ msgstr "" +#~ ":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " +#~ "與 :data:`sys.prefix`。" + +#~ msgid "" +#~ ":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` " +#~ "instead." +#~ msgstr "" +#~ ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" + +#~ msgid "" +#~ ":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` " +#~ "instead." +#~ msgstr "" +#~ ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" + +#~ msgid ":c:member:`!PyDictObject.ma_version_tag` member." +#~ msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" + #~ msgid "The bundled copy of ``libmpdecimal``." #~ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" diff --git a/deprecations/pending-removal-in-3.13.po b/deprecations/pending-removal-in-3.13.po index 6e382beeb8d..cd7fdaa63be 100644 --- a/deprecations/pending-removal-in-3.13.po +++ b/deprecations/pending-removal-in-3.13.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -16,7 +16,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/pending-removal-in-3.13.rst:2 -msgid "Pending Removal in Python 3.13" +#, fuzzy +msgid "Pending removal in Python 3.13" msgstr "Python 3.13 中待移除的項目" #: ../../deprecations/pending-removal-in-3.13.rst:4 diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index bd8e164bd38..4e30f36fbf2 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-10 17:21+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -16,7 +16,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/pending-removal-in-3.14.rst:2 -msgid "Pending Removal in Python 3.14" +#, fuzzy +msgid "Pending removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/pending-removal-in-3.14.rst:4 @@ -70,10 +71,11 @@ msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.14.rst:24 +#, fuzzy msgid "" -"The child watcher " -"classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` " -"and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " +"The child watcher classes :class:`!asyncio.MultiLoopChildWatcher`, :class:`!" +"asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` " +"and :class:`!asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" "已棄用並將在 Python 3.14 中移除的 child watcher 類" @@ -82,11 +84,13 @@ msgstr "" "獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:30 +#, fuzzy msgid "" -":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"and :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated " -"and will be removed in Python 3.14. (Contributed by Kumar Aditya " -"in :gh:`94597`.)" +":func:`!asyncio.set_child_watcher`, :func:`!" +"asyncio.get_child_watcher`, :meth:`!" +"asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`!" +"asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated and will " +"be removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" ":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " "和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " @@ -104,8 +108,9 @@ msgstr "" "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:41 +#, fuzzy msgid "" -":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " +":mod:`collections.abc`: Deprecated :class:`!collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " "typing, prefer a union, like ``bytes | bytearray``, " "or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " @@ -196,8 +201,9 @@ msgstr "" "和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 +#, fuzzy msgid "" -":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " +":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" @@ -223,7 +229,8 @@ msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" #: ../../deprecations/pending-removal-in-3.14.rst:93 -msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." +#, fuzzy +msgid ":data:`!version` and :data:`!version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 @@ -237,8 +244,9 @@ msgstr "" "而不是 :class:`dict`。" #: ../../deprecations/pending-removal-in-3.14.rst:99 +#, fuzzy msgid "" -":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " +":mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index 345db845e3c..60fcf80232e 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-27 07:36+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -16,7 +16,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/pending-removal-in-3.15.rst:2 -msgid "Pending Removal in Python 3.15" +#, fuzzy +msgid "Pending removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:4 @@ -25,10 +26,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" -"`__spec__.cached ` is deprecated. In " -"Python 3.15, :attr:`!__cached__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to " +"set :attr:`__spec__.cached ` is " +"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " +"into consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "` 的做法已被棄用。在 Python 3.15 中," @@ -36,10 +37,11 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to set :attr:" -"`__spec__.parent ` is deprecated. In " -"Python 3.15, :attr:`!__package__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to " +"set :attr:`__spec__.parent ` is " +"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " +"take into consideration by the import system or standard library. " +"(:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "` 的做法已被棄用。在 Python 3.15 中," @@ -93,15 +95,17 @@ msgstr ":class:`locale`:" #: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" -"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." -"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " -"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 " +"(:gh:`90817`), but has been postponed to Python 3.15. " +"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " +"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " +"in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" -"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." -"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" +"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " +"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" @@ -109,11 +113,11 @@ msgstr ":mod:`pathlib`:" #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" -"func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " +"Use :func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." -"isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" +"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" @@ -167,20 +171,21 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" +"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " +"於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" #: ../../deprecations/pending-removal-in-3.15.rst:82 +#, fuzzy msgid "" -"The undocumented keyword argument syntax for creating :class:`~typing." -"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " -"has been deprecated since Python 3.13. Use the class-based syntax or the " -"functional syntax instead." +"The undocumented keyword argument syntax for " +"creating :class:`~typing.NamedTuple` classes (for example, ``Point = " +"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " +"3.13. Use the class-based syntax or the functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" @@ -194,11 +199,10 @@ msgid "" "since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " "TypedDict(\"TD\", {})`` to create a TypedDict with zero field." msgstr "" -"當使用 :class:`~typing.TypedDict` 的函式語法時,未傳遞值給 *fields* " -"參數 (``TD = TypedDict(\"TD\")``) 或傳遞 ``None`` (``TD = " -"TypedDict(\"TD\", None)``) 的做法自 Python 3.13 起已被棄用。請" -"使用 ``class TD(TypedDict): pass`` 或 ``TD = " -"TypedDict(\"TD\", {})`` 來建立具有零個欄位的 TypedDict。" +"當使用 :class:`~typing.TypedDict` 的函式語法時,未傳遞值給 *fields* 參數 " +"(``TD = TypedDict(\"TD\")``) 或傳遞 ``None`` (``TD = TypedDict(\"TD\", " +"None)``) 的做法自 Python 3.13 起已被棄用。請使用 ``class TD(TypedDict): " +"pass`` 或 ``TD = TypedDict(\"TD\", {})`` 來建立具有零個欄位的 TypedDict。" #: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" @@ -216,10 +220,23 @@ msgstr ":mod:`wave`:" #: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." -"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" -"`~wave.Wave_write` classes have been deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " +"and :meth:`~wave.Wave_read.getmarkers` methods of " +"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " +"deprecated since Python 3.13." +msgstr "" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" +"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " +"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:107 +#, fuzzy +msgid ":mod:`zipimport`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:109 +msgid "" +":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python " +"3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " +"by Jiahao Li in :gh:`125746`.)" msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" -"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." -"getmarkers` 方法自 Python 3.13 被棄用。" diff --git a/deprecations/pending-removal-in-3.16.po b/deprecations/pending-removal-in-3.16.po index 168f04617f5..ba516174a94 100644 --- a/deprecations/pending-removal-in-3.16.po +++ b/deprecations/pending-removal-in-3.16.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-10 17:21+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -53,9 +53,10 @@ msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.16.rst:21 +#, fuzzy msgid "" ":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " -"Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" @@ -63,10 +64,64 @@ msgstr "" "於 :gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 +msgid "" +":mod:`asyncio` policy system is deprecated and will be removed in Python " +"3.16. In particular, the following classes and functions are deprecated:" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:29 +msgid ":class:`asyncio.AbstractEventLoopPolicy`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:30 +msgid ":class:`asyncio.DefaultEventLoopPolicy`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:31 +msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:32 +msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:33 +msgid ":func:`asyncio.get_event_loop_policy`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:34 +msgid ":func:`asyncio.set_event_loop_policy`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:36 +msgid "" +"Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " +"*loop_factory* to use the desired event loop implementation." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:39 +msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:41 +msgid "" +"import asyncio\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:48 +msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:50 msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" -#: ../../deprecations/pending-removal-in-3.16.rst:28 +#: ../../deprecations/pending-removal-in-3.16.rst:52 msgid "" "Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " "deprecated since Python 3.12, as it produces surprising and unintuitive " @@ -79,11 +134,48 @@ msgstr "" "邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " "``~int(x)`` (``~int(x)``)。" -#: ../../deprecations/pending-removal-in-3.16.rst:35 +#: ../../deprecations/pending-removal-in-3.16.rst:59 +#, fuzzy +msgid ":mod:`functools`:" +msgstr ":mod:`shutil`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:61 +msgid "" +"Calling the Python implementation of :func:`functools.reduce` with " +"*function* or *sequence* as keyword arguments has been deprecated since " +"Python 3.14." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:64 +#, fuzzy +msgid ":mod:`logging`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:66 +msgid "" +"Support for custom logging handlers with the *strm* argument is deprecated " +"and scheduled for removal in Python 3.16. Define handlers with the *stream* " +"argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:70 +#, fuzzy +msgid ":mod:`mimetypes`:" +msgstr ":mod:`sys`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:72 +msgid "" +"Valid extensions start with a '.' or are empty " +"for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated " +"and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " +"Kemenade in :gh:`75223`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:78 msgid ":mod:`shutil`:" msgstr ":mod:`shutil`:" -#: ../../deprecations/pending-removal-in-3.16.rst:37 +#: ../../deprecations/pending-removal-in-3.16.rst:80 msgid "" "The :class:`!ExecError` exception has been deprecated since Python 3.14. It " "has not been used by any function in :mod:`!shutil` since Python 3.4, and is " @@ -92,11 +184,11 @@ msgstr "" "自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" "未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" -#: ../../deprecations/pending-removal-in-3.16.rst:42 +#: ../../deprecations/pending-removal-in-3.16.rst:85 msgid ":mod:`symtable`:" msgstr ":mod:`symtable`:" -#: ../../deprecations/pending-removal-in-3.16.rst:44 +#: ../../deprecations/pending-removal-in-3.16.rst:87 msgid "" "The :meth:`Class.get_methods ` method has been " "deprecated since Python 3.14." @@ -104,11 +196,11 @@ msgstr "" "自 Python 3.14 起,:meth:`Class.get_methods ` 方" "法已被棄用。" -#: ../../deprecations/pending-removal-in-3.16.rst:47 +#: ../../deprecations/pending-removal-in-3.16.rst:90 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../deprecations/pending-removal-in-3.16.rst:49 +#: ../../deprecations/pending-removal-in-3.16.rst:92 msgid "" "The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " "since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " @@ -117,11 +209,26 @@ msgstr "" "自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" -#: ../../deprecations/pending-removal-in-3.16.rst:53 +#: ../../deprecations/pending-removal-in-3.16.rst:96 +#, fuzzy +msgid ":mod:`sysconfig`:" +msgstr ":mod:`sys`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:98 +#, fuzzy +msgid "" +"The :func:`!sysconfig.expand_makefile_vars` function has been deprecated " +"since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " +"instead." +msgstr "" +"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" +"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" + +#: ../../deprecations/pending-removal-in-3.16.rst:102 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../deprecations/pending-removal-in-3.16.rst:55 +#: ../../deprecations/pending-removal-in-3.16.rst:104 msgid "" "The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " "deprecated since Python 3.13." diff --git a/deprecations/pending-removal-in-3.17.po b/deprecations/pending-removal-in-3.17.po new file mode 100644 index 00000000000..a9a9e110993 --- /dev/null +++ b/deprecations/pending-removal-in-3.17.po @@ -0,0 +1,36 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../deprecations/pending-removal-in-3.17.rst:2 +msgid "Pending removal in Python 3.17" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.17.rst:4 +msgid ":mod:`typing`:" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.17.rst:6 +msgid "" +"Before Python 3.14, old-style unions were implemented using the private " +"class ``typing._UnionGenericAlias``. This class is no longer needed for the " +"implementation, but it has been retained for backward compatibility, with " +"removal scheduled for Python 3.17. Users should use documented introspection " +"helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " +"of relying on private implementation details." +msgstr "" diff --git a/deprecations/pending-removal-in-3.19.po b/deprecations/pending-removal-in-3.19.po new file mode 100644 index 00000000000..920a3d29431 --- /dev/null +++ b/deprecations/pending-removal-in-3.19.po @@ -0,0 +1,33 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../deprecations/pending-removal-in-3.19.rst:2 +msgid "Pending removal in Python 3.19" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.19.rst:4 +msgid ":mod:`ctypes`:" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.19.rst:6 +msgid "" +"Implicitly switching to the MSVC-compatible struct layout by " +"setting :attr:`~ctypes.Structure._pack_` but " +"not :attr:`~ctypes.Structure._layout_` on non-Windows platforms." +msgstr "" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po index 230bd84669c..d69ef44f022 100644 --- a/deprecations/pending-removal-in-future.po +++ b/deprecations/pending-removal-in-future.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-30 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -17,7 +17,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/pending-removal-in-future.rst:2 -msgid "Pending Removal in Future Versions" +#, fuzzy +msgid "Pending removal in future versions" msgstr "未來版本中的待移除項目" #: ../../deprecations/pending-removal-in-future.rst:4 @@ -27,20 +28,35 @@ msgid "" msgstr "以下 API 將在未來被移除,雖然目前尚未安排移除日期。" #: ../../deprecations/pending-removal-in-future.rst:7 +#, fuzzy +msgid ":mod:`argparse`:" +msgstr ":mod:`datetime`:" + +#: ../../deprecations/pending-removal-in-future.rst:9 +#, fuzzy msgid "" -":mod:`argparse`: Nesting argument groups and nesting mutually exclusive " -"groups are deprecated." +"Nesting argument groups and nesting mutually exclusive groups are deprecated." msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" -#: ../../deprecations/pending-removal-in-future.rst:10 +#: ../../deprecations/pending-removal-in-future.rst:11 +msgid "" +"Passing the undocumented keyword argument *prefix_chars* " +"to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:14 +msgid "The :class:`argparse.FileType` type converter is deprecated." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:16 msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" -#: ../../deprecations/pending-removal-in-future.rst:12 +#: ../../deprecations/pending-removal-in-future.rst:18 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" -#: ../../deprecations/pending-removal-in-future.rst:13 +#: ../../deprecations/pending-removal-in-future.rst:19 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -49,25 +65,25 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:16 +#: ../../deprecations/pending-removal-in-future.rst:22 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of keywords :keyword:" -"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" -"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " -"syntax error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of " +"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " +"and :keyword:`or`. In a future release it will be changed to a syntax " +"error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" -"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" -"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" -"本中,它將被更改為語法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" +"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " +"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" +"法錯誤。(:gh:`87999`)" -#: ../../deprecations/pending-removal-in-future.rst:24 +#: ../../deprecations/pending-removal-in-future.rst:30 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -76,84 +92,91 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:27 +#: ../../deprecations/pending-removal-in-future.rst:33 msgid "" -"Support for ``__float__()`` method returning a strict subclass of :class:" -"`float`: these methods will be required to return an instance of :class:" -"`float`." +"Support for ``__float__()`` method returning a strict subclass " +"of :class:`float`: these methods will be required to return an instance " +"of :class:`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:30 +#: ../../deprecations/pending-removal-in-future.rst:36 msgid "" -"Support for ``__complex__()`` method returning a strict subclass of :class:" -"`complex`: these methods will be required to return an instance of :class:" -"`complex`." +"Support for ``__complex__()`` method returning a strict subclass " +"of :class:`complex`: these methods will be required to return an instance " +"of :class:`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:33 +#: ../../deprecations/pending-removal-in-future.rst:39 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:34 +#: ../../deprecations/pending-removal-in-future.rst:40 msgid "" -"Passing a complex number as the *real* or *imag* argument in the :func:" -"`complex` constructor is now deprecated; it should only be passed as a " -"single positional argument. (Contributed by Serhiy Storchaka in :gh:" -"`109218`.)" +"Passing a complex number as the *real* or *imag* argument in " +"the :func:`complex` constructor is now deprecated; it should only be passed " +"as a single positional argument. (Contributed by Serhiy Storchaka " +"in :gh:`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:39 +#: ../../deprecations/pending-removal-in-future.rst:45 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." -"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` " +"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " +"in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:44 +#: ../../deprecations/pending-removal-in-future.rst:50 +msgid "" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " +"(:gh:`133038`)" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:52 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:47 +#: ../../deprecations/pending-removal-in-future.rst:55 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:49 +#: ../../deprecations/pending-removal-in-future.rst:57 msgid "" -":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." -"UTC)``." +":meth:`~datetime.datetime.utcnow`: use " +"``datetime.datetime.now(tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." -"now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 " +"``datetime.datetime.now(tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:51 +#: ../../deprecations/pending-removal-in-future.rst:59 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." -"fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." -"fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:54 +#: ../../deprecations/pending-removal-in-future.rst:62 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" -#: ../../deprecations/pending-removal-in-future.rst:56 +#: ../../deprecations/pending-removal-in-future.rst:64 msgid ":mod:`importlib`:" msgstr ":mod:`importlib`:" -#: ../../deprecations/pending-removal-in-future.rst:58 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -161,39 +184,39 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:61 +#: ../../deprecations/pending-removal-in-future.rst:69 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:63 +#: ../../deprecations/pending-removal-in-future.rst:71 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:72 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" -"`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" +"用 :meth:`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:80 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:74 +#: ../../deprecations/pending-removal-in-future.rst:82 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -201,7 +224,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:85 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -213,12 +236,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:84 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:86 +#: ../../deprecations/pending-removal-in-future.rst:94 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -226,108 +249,116 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:91 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" -"`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " +"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" -"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " +"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:96 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:97 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:111 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:108 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid "" -":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." -"notify_all`." +":meth:`!threading.Condition.notifyAll`: " +"use :meth:`~threading.Condition.notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." -"notify_all`。" +":meth:`!threading.Condition.notifyAll`:請" +"用 :meth:`~threading.Condition.notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:109 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:110 +#: ../../deprecations/pending-removal-in-future.rst:118 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" -"attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " +"use :attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:120 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" -"attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " +"use :attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" -"attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" +"用 :attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:123 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:117 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:119 +#: ../../deprecations/pending-removal-in-future.rst:127 +msgid "" +"The internal class ``typing._UnionGenericAlias`` is no longer used to " +"implement :class:`typing.Union`. To preserve compatibility with users using " +"this private class, a compatibility shim will be provided until at least " +"Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -335,91 +366,96 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:122 +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:124 +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:126 +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:127 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:141 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:129 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:144 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:145 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:146 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:147 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:136 -msgid "" -":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" -"`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " -"Use newer :func:`~urllib.request.urlopen` functions and methods." -msgstr "" -":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` 和 :" -"class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" -"`~urllib.request.urlopen` 函式和方法。" - -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:149 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:143 +#: ../../deprecations/pending-removal-in-future.rst:152 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." -"etree.ElementTree.Element` is deprecated. In a future release it will always " -"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " -"instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of " +"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " +"release it will always return ``True``. Prefer explicit ``len(elem)`` or " +"``elem is not None`` tests instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." -"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " -"``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用" +"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" +"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:148 +#: ../../deprecations/pending-removal-in-future.rst:157 msgid "" -":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" -"`~zipimport.zipimporter.exec_module` instead." +":func:`sys._clear_type_cache` is deprecated: " +"use :func:`sys._clear_internal_caches` instead." msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." -"zipimporter.exec_module`。" + +#~ msgid "" +#~ ":mod:`urllib.request`: :class:`~urllib.request.URLopener` " +#~ "and :class:`~urllib.request.FancyURLopener` style of invoking requests is " +#~ "deprecated. Use newer :func:`~urllib.request.urlopen` functions and " +#~ "methods." +#~ msgstr "" +#~ ":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " +#~ "和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" +#~ "的 :func:`~urllib.request.urlopen` 函式和方法。" + +#~ msgid "" +#~ ":meth:`zipimport.zipimporter.load_module` is deprecated: " +#~ "use :meth:`~zipimport.zipimporter.exec_module` instead." +#~ msgstr "" +#~ ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" +#~ "用 :meth:`~zipimport.zipimporter.exec_module`。" #~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" #~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" diff --git a/extending/building.po b/extending/building.po index 9285c3baeaf..da70bd607f2 100644 --- a/extending/building.po +++ b/extending/building.po @@ -8,7 +8,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-09-08 15:25+0800\n" "PO-Revision-Date: 2025-02-07 14:09+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,89 +24,102 @@ msgid "Building C and C++ Extensions" msgstr "建立 C 與 C++ 擴充套件" #: ../../extending/building.rst:9 +#, fuzzy msgid "" -"A C extension for CPython is a shared library (e.g. a ``.so`` file on Linux, " -"``.pyd`` on Windows), which exports an *initialization function*." +"A C extension for CPython is a shared library (for example, a ``.so`` file " +"on Linux, ``.pyd`` on Windows), which exports an *initialization function*." msgstr "" "一個 CPython 的 C 擴充套件是一個共用函式庫(例如在 Linux 上的 ``.so`` 檔案," "在 Windows 上的 ``.pyd``),會匯出一個\\ *初始化函式*。" #: ../../extending/building.rst:12 -msgid "" -"To be importable, the shared library must be available on :envvar:" -"`PYTHONPATH`, and must be named after the module name, with an appropriate " -"extension. When using setuptools, the correct filename is generated " -"automatically." +msgid "See :ref:`extension-modules` for details." msgstr "" -"要能夠被引入,共用函式庫必須在 :envvar:`PYTHONPATH` 上可用,並且必須以模組名" -"稱命名,並且必須有適當的副檔名。使用 setuptools 時,正確的檔名會自動產生。" -#: ../../extending/building.rst:16 -msgid "The initialization function has the signature:" -msgstr "初始化函式具有簽名:" +#: ../../extending/building.rst:21 +msgid "Building C and C++ Extensions with setuptools" +msgstr "用 setuptools 建置 C 與 C++ 擴充套件" -#: ../../extending/building.rst:20 +#: ../../extending/building.rst:24 msgid "" -"It returns either a fully initialized module, or a :c:type:`PyModuleDef` " -"instance. See :ref:`initializing-modules` for details." +"Building, packaging and distributing extension modules is best done with " +"third-party tools, and is out of scope of this document. One suitable tool " +"is Setuptools, whose documentation can be found at https://" +"setuptools.pypa.io/en/latest/setuptools.html." msgstr "" -"它回傳一個完全初始化的模組,或一個 :c:type:`PyModuleDef` 實例。詳細資訊請參" -"見 :ref:`initializing-modules`。" -#: ../../extending/building.rst:25 +#: ../../extending/building.rst:29 msgid "" -"For modules with ASCII-only names, the function must be named :samp:" -"`PyInit_{}`, with ```` replaced by the name of the module. When " -"using :ref:`multi-phase-initialization`, non-ASCII module names are allowed. " -"In this case, the initialization function name is :samp:`PyInitU_{}`, " -"with ```` encoded using Python's *punycode* encoding with hyphens " -"replaced by underscores. In Python::" +"The :mod:`distutils` module, which was included in the standard library " +"until Python 3.12, is now maintained as part of Setuptools." msgstr "" -"對於僅包含 ASCII 名稱的模組,函式必須以 :samp:`PyInit_{}` 命名,其中 " -"```` 要替換為模組的名稱。當使用 :ref:`multi-phase-" -"initialization` 時,允許非 ASCII 模組名稱。在這種情況下,初始化函式名稱是 " -":samp:`PyInitU_{}`,其中 ```` 使用 Python 的 *punycode* 編" -"碼,並將連字符號替換為底線。在 Python 中: ::" -#: ../../extending/building.rst:32 -msgid "" -"def initfunc_name(name):\n" -" try:\n" -" suffix = b'_' + name.encode('ascii')\n" -" except UnicodeEncodeError:\n" -" suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" -" return b'PyInit' + suffix" -msgstr "" -"def initfunc_name(name):\n" -" try:\n" -" suffix = b'_' + name.encode('ascii')\n" -" except UnicodeEncodeError:\n" -" suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" -" return b'PyInit' + suffix" +#~ msgid "" +#~ "To be importable, the shared library must be available " +#~ "on :envvar:`PYTHONPATH`, and must be named after the module name, with an " +#~ "appropriate extension. When using setuptools, the correct filename is " +#~ "generated automatically." +#~ msgstr "" +#~ "要能夠被引入,共用函式庫必須在 :envvar:`PYTHONPATH` 上可用,並且必須以模組" +#~ "名稱命名,並且必須有適當的副檔名。使用 setuptools 時,正確的檔名會自動產" +#~ "生。" -#: ../../extending/building.rst:39 -msgid "" -"It is possible to export multiple modules from a single shared library by " -"defining multiple initialization functions. However, importing them requires " -"using symbolic links or a custom importer, because by default only the " -"function corresponding to the filename is found. See the *\"Multiple modules " -"in one library\"* section in :pep:`489` for details." -msgstr "" -"可以透過定義多個初始化函式,來從單一共用函式庫中匯出多個模組。然而要引入它們" -"需要使用符號連結或自訂引入器,因為預設只會找到對應於檔名的函式。詳細資訊請參" -"見 :pep:`489` 中的 *\"Multiple modules in one library\"* 部分。" +#~ msgid "The initialization function has the signature:" +#~ msgstr "初始化函式具有簽名:" -#: ../../extending/building.rst:52 -msgid "Building C and C++ Extensions with setuptools" -msgstr "用 setuptools 建置 C 與 C++ 擴充套件" +#~ msgid "" +#~ "It returns either a fully initialized module, or a :c:type:`PyModuleDef` " +#~ "instance. See :ref:`initializing-modules` for details." +#~ msgstr "" +#~ "它回傳一個完全初始化的模組,或一個 :c:type:`PyModuleDef` 實例。詳細資訊請" +#~ "參見 :ref:`initializing-modules`。" -#: ../../extending/building.rst:54 -msgid "" -"Python 3.12 and newer no longer come with distutils. Please refer to the " -"``setuptools`` documentation at https://setuptools.readthedocs.io/en/latest/" -"setuptools.html to learn more about how build and distribute C/C++ " -"extensions with setuptools." -msgstr "" -"Python 3.12 與之後的版本不再帶有 distutils。請在 https://setuptools." -"readthedocs.io/en/latest/setuptools.html 上參閱 ``setuptools`` 文件,以了解如" -"何使用 setuptools 建置和發佈 C/C++ 擴充套件。" +#~ msgid "" +#~ "For modules with ASCII-only names, the function must be " +#~ "named :samp:`PyInit_{}`, with ```` replaced by the name of " +#~ "the module. When using :ref:`multi-phase-initialization`, non-ASCII " +#~ "module names are allowed. In this case, the initialization function name " +#~ "is :samp:`PyInitU_{}`, with ```` encoded using Python's " +#~ "*punycode* encoding with hyphens replaced by underscores. In Python::" +#~ msgstr "" +#~ "對於僅包含 ASCII 名稱的模組,函式必須以 :samp:`PyInit_{}` 命名,其" +#~ "中 ```` 要替換為模組的名稱。當使用 :ref:`multi-phase-" +#~ "initialization` 時,允許非 ASCII 模組名稱。在這種情況下,初始化函式名稱" +#~ "是 :samp:`PyInitU_{}`,其中 ```` 使用 Python 的 *punycode* 編" +#~ "碼,並將連字符號替換為底線。在 Python 中: ::" + +#~ msgid "" +#~ "def initfunc_name(name):\n" +#~ " try:\n" +#~ " suffix = b'_' + name.encode('ascii')\n" +#~ " except UnicodeEncodeError:\n" +#~ " suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" +#~ " return b'PyInit' + suffix" +#~ msgstr "" +#~ "def initfunc_name(name):\n" +#~ " try:\n" +#~ " suffix = b'_' + name.encode('ascii')\n" +#~ " except UnicodeEncodeError:\n" +#~ " suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" +#~ " return b'PyInit' + suffix" + +#~ msgid "" +#~ "It is possible to export multiple modules from a single shared library by " +#~ "defining multiple initialization functions. However, importing them " +#~ "requires using symbolic links or a custom importer, because by default " +#~ "only the function corresponding to the filename is found. See the " +#~ "*\"Multiple modules in one library\"* section in :pep:`489` for details." +#~ msgstr "" +#~ "可以透過定義多個初始化函式,來從單一共用函式庫中匯出多個模組。然而要引入它" +#~ "們需要使用符號連結或自訂引入器,因為預設只會找到對應於檔名的函式。詳細資訊" +#~ "請參見 :pep:`489` 中的 *\"Multiple modules in one library\"* 部分。" + +#~ msgid "" +#~ "Python 3.12 and newer no longer come with distutils. Please refer to the " +#~ "``setuptools`` documentation at https://setuptools.readthedocs.io/en/" +#~ "latest/setuptools.html to learn more about how build and distribute C/C++ " +#~ "extensions with setuptools." +#~ msgstr "" +#~ "Python 3.12 與之後的版本不再帶有 distutils。請在 https://" +#~ "setuptools.readthedocs.io/en/latest/setuptools.html 上參閱 ``setuptools`` " +#~ "文件,以了解如何使用 setuptools 建置和發佈 C/C++ 擴充套件。" diff --git a/extending/extending.po b/extending/extending.po index 8fed1eb0757..808fb602376 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-04 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-02-17 14:34+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -101,9 +101,9 @@ msgstr "" #: ../../extending/extending.rst:53 msgid "" "Begin by creating a file :file:`spammodule.c`. (Historically, if a module " -"is called ``spam``, the C file containing its implementation is called :file:" -"`spammodule.c`; if the module name is very long, like ``spammify``, the " -"module name can be just :file:`spammify.c`.)" +"is called ``spam``, the C file containing its implementation is " +"called :file:`spammodule.c`; if the module name is very long, like " +"``spammify``, the module name can be just :file:`spammify.c`.)" msgstr "" "首先建立一個檔案 :file:`spammodule.c`。(從過去歷史來看,如果一個模組叫做 " "``spam``,包含其實作的 C 檔案就會叫做 :file:`spammodule.c`;如果模組名稱很" @@ -113,7 +113,7 @@ msgstr "" msgid "The first two lines of our file can be::" msgstr "我們檔案的前兩列可以為: ::" -#: ../../extending/extending.rst:60 ../../extending/extending.rst:706 +#: ../../extending/extending.rst:60 ../../extending/extending.rst:681 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include " @@ -152,96 +152,25 @@ msgstr "" #: ../../extending/extending.rst:77 msgid "" "All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` " -"or ``PY``, except those defined in standard header files." +"or ``PY``, except those defined in standard header files. For convenience, " +"and since they are used extensively by the Python interpreter, " +"``\"Python.h\"`` includes a few standard header files: ````, " +"````, ````, and ````. If the latter header " +"file does not exist on your system, it declares the " +"functions :c:func:`malloc`, :c:func:`free` and :c:func:`realloc` directly." msgstr "" -#: ../../extending/extending.rst:82 -msgid "" -"For backward compatibility, :file:`Python.h` includes several standard " -"header files. C extensions should include the standard headers that they " -"use, and should not rely on these implicit includes. If using the limited C " -"API version 3.13 or newer, the implicit includes are:" -msgstr "" - -#: ../../extending/extending.rst:87 -msgid "````" -msgstr "````" - -#: ../../extending/extending.rst:88 -msgid "```` (on Windows)" -msgstr "````\\ (在 Windows 上)" - -#: ../../extending/extending.rst:89 -msgid "````" -msgstr "````" - -#: ../../extending/extending.rst:90 -msgid "````" -msgstr "````" - -#: ../../extending/extending.rst:91 -msgid "````" -msgstr "````" - -#: ../../extending/extending.rst:92 -msgid "````" -msgstr "````" - -#: ../../extending/extending.rst:93 -msgid "````" -msgstr "````" - -#: ../../extending/extending.rst:94 -msgid "```` (if present)" -msgstr "````\\ (如果存在)" - -#: ../../extending/extending.rst:96 -msgid "" -"If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.12 or " -"older, the headers below are also included:" -msgstr "" - -#: ../../extending/extending.rst:99 -msgid "````" -msgstr "````" - -#: ../../extending/extending.rst:100 -msgid "```` (on POSIX)" -msgstr "````\\ (在 POSIX 上)" - -#: ../../extending/extending.rst:102 -msgid "" -"If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.10 or " -"older, the headers below are also included:" -msgstr "" - -#: ../../extending/extending.rst:105 -msgid "````" -msgstr "````" - -#: ../../extending/extending.rst:106 -msgid "````" -msgstr "````" - -#: ../../extending/extending.rst:107 -msgid "````" -msgstr "````" - -#: ../../extending/extending.rst:108 -msgid "````" -msgstr "````" - -#: ../../extending/extending.rst:110 +#: ../../extending/extending.rst:85 msgid "" "The next thing we add to our module file is the C function that will be " "called when the Python expression ``spam.system(string)`` is evaluated " "(we'll see shortly how it ends up being called)::" msgstr "" -"接下來我們要加入到模組檔案的是 C 函式,當 Python 運算式 ``spam." -"system(string)`` 要被求值 (evaluated) 時就會被呼叫(我們很快就會看到它最後是" -"如何被呼叫的): ::" +"接下來我們要加入到模組檔案的是 C 函式,當 Python 運算式 " +"``spam.system(string)`` 要被求值 (evaluated) 時就會被呼叫(我們很快就會看到它" +"最後是如何被呼叫的): ::" -#: ../../extending/extending.rst:114 +#: ../../extending/extending.rst:89 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -267,7 +196,7 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:126 +#: ../../extending/extending.rst:101 msgid "" "There is a straightforward translation from the argument list in Python (for " "example, the single expression ``\"ls -l\"``) to the arguments passed to the " @@ -277,7 +206,7 @@ msgstr "" "可以很直觀地從 Python 的引數串列(例如單一的運算式 ``\"ls -l\"``)直接轉換成" "傳給 C 函式的引數。C 函式總是有兩個引數,習慣上會命名為 *self* 和 *args*。" -#: ../../extending/extending.rst:131 +#: ../../extending/extending.rst:106 msgid "" "The *self* argument points to the module object for module-level functions; " "for a method it would point to the object instance." @@ -285,7 +214,7 @@ msgstr "" "對於模組層級的函式,*self* 引數會指向模組物件;而對於方法來說則是指向物件的實" "例。" -#: ../../extending/extending.rst:134 +#: ../../extending/extending.rst:109 msgid "" "The *args* argument will be a pointer to a Python tuple object containing " "the arguments. Each item of the tuple corresponds to an argument in the " @@ -298,11 +227,11 @@ msgid "" msgstr "" "*args* 引數會是一個指向包含引數的 Python 元組物件的指標。元組中的每一項都對應" "於呼叫的引數串列中的一個引數。引數是 Python 物件 --- 為了在我們的 C 函式中對" -"它們做任何事情,我們必須先將它們轉換成 C 值。Python API 中的 :c:func:" -"`PyArg_ParseTuple` 函式能夠檢查引數型別並將他們轉換為 C 值。它使用模板字串來" -"決定所需的引數型別以及儲存轉換值的 C 變數型別。稍後會再詳細說明。" +"它們做任何事情,我們必須先將它們轉換成 C 值。Python API 中" +"的 :c:func:`PyArg_ParseTuple` 函式能夠檢查引數型別並將他們轉換為 C 值。它使用" +"模板字串來決定所需的引數型別以及儲存轉換值的 C 變數型別。稍後會再詳細說明。" -#: ../../extending/extending.rst:143 +#: ../../extending/extending.rst:118 msgid "" ":c:func:`PyArg_ParseTuple` returns true (nonzero) if all arguments have the " "right type and its components have been stored in the variables whose " @@ -311,16 +240,16 @@ msgid "" "the calling function can return ``NULL`` immediately (as we saw in the " "example)." msgstr "" -"如果所有的引數都有正確的型別,且其元件已儲存在傳入位址的變數中,則 :c:func:" -"`PyArg_ParseTuple` 會回傳 true(非零)。如果傳入的是無效引數串列則回傳 false" -"(零)。在後者情況下,它也會產生適當的例外,因此呼叫函式可以立即回傳 " -"``NULL``\\ (就像我們在範例中所看到的)。" +"如果所有的引數都有正確的型別,且其元件已儲存在傳入位址的變數中," +"則 :c:func:`PyArg_ParseTuple` 會回傳 true(非零)。如果傳入的是無效引數串列則" +"回傳 false(零)。在後者情況下,它也會產生適當的例外,因此呼叫函式可以立即回" +"傳 ``NULL``\\ (就像我們在範例中所看到的)。" -#: ../../extending/extending.rst:153 +#: ../../extending/extending.rst:128 msgid "Intermezzo: Errors and Exceptions" msgstr "插曲:錯誤與例外" -#: ../../extending/extending.rst:155 +#: ../../extending/extending.rst:130 msgid "" "An important convention throughout the Python interpreter is the following: " "when a function fails, it should set an exception condition and return an " @@ -337,13 +266,13 @@ msgstr "" "們是由 :meth:`sys.exc_info` 所回傳的 Python 元組中的 C 等效元組。它們是例外型" "別、例外實例和回溯物件。了解它們對於理解錯誤是如何傳遞是很重要的。" -#: ../../extending/extending.rst:164 +#: ../../extending/extending.rst:139 msgid "" "The Python API defines a number of functions to set various types of " "exceptions." msgstr "Python API 定義了許多能夠設定各種類型例外的函式。" -#: ../../extending/extending.rst:166 +#: ../../extending/extending.rst:141 msgid "" "The most common one is :c:func:`PyErr_SetString`. Its arguments are an " "exception object and a C string. The exception object is usually a " @@ -356,33 +285,34 @@ msgstr "" "指出錯誤的原因,並被轉換為 Python 字串物件且被儲存為例外的「關聯值 " "(associated value)」。" -#: ../../extending/extending.rst:172 +#: ../../extending/extending.rst:147 msgid "" "Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an " "exception argument and constructs the associated value by inspection of the " -"global variable :c:data:`errno`. The most general function is :c:func:" -"`PyErr_SetObject`, which takes two object arguments, the exception and its " -"associated value. You don't need to :c:func:`Py_INCREF` the objects passed " -"to any of these functions." +"global variable :c:data:`errno`. The most general function " +"is :c:func:`PyErr_SetObject`, which takes two object arguments, the " +"exception and its associated value. You don't need to :c:func:`Py_INCREF` " +"the objects passed to any of these functions." msgstr "" "另一個有用的函式是 :c:func:`PyErr_SetFromErrno`,它只接受一個例外引數,並透過" -"檢查全域變數 :c:data:`errno` 來建立關聯值。最一般的函式是 :c:func:" -"`PyErr_SetObject`,它接受兩個物件引數,即例外和它的關聯值。你不需要對傳給任何" -"這些函式的物件呼叫 :c:func:`Py_INCREF`。" +"檢查全域變數 :c:data:`errno` 來建立關聯值。最一般的函式" +"是 :c:func:`PyErr_SetObject`,它接受兩個物件引數,即例外和它的關聯值。你不需" +"要對傳給任何這些函式的物件呼叫 :c:func:`Py_INCREF`。" -#: ../../extending/extending.rst:179 +#: ../../extending/extending.rst:154 msgid "" -"You can test non-destructively whether an exception has been set with :c:" -"func:`PyErr_Occurred`. This returns the current exception object, or " -"``NULL`` if no exception has occurred. You normally don't need to call :c:" -"func:`PyErr_Occurred` to see whether an error occurred in a function call, " -"since you should be able to tell from the return value." +"You can test non-destructively whether an exception has been set " +"with :c:func:`PyErr_Occurred`. This returns the current exception object, " +"or ``NULL`` if no exception has occurred. You normally don't need to " +"call :c:func:`PyErr_Occurred` to see whether an error occurred in a function " +"call, since you should be able to tell from the return value." msgstr "" "你可以使用 :c:func:`PyErr_Occurred` 來不具破壞性地測試例外是否已被設定。這會" -"回傳目前的例外物件,如果沒有例外發生則回傳 ``NULL``。你通常不需要呼叫 :c:" -"func:`PyErr_Occurred` 來查看函式呼叫是否發生錯誤,因為你應可從回傳值就得知。" +"回傳目前的例外物件,如果沒有例外發生則回傳 ``NULL``。你通常不需要呼" +"叫 :c:func:`PyErr_Occurred` 來查看函式呼叫是否發生錯誤,因為你應可從回傳值就" +"得知。" -#: ../../extending/extending.rst:185 +#: ../../extending/extending.rst:160 msgid "" "When a function *f* that calls another function *g* detects that the latter " "fails, *f* should itself return an error value (usually ``NULL`` or " @@ -401,7 +331,7 @@ msgstr "" "首先檢測到它的函式回報了。一旦錯誤到達 Python 直譯器的主要迴圈,這會中止目前" "執行的 Python 程式碼,並嘗試尋找 Python 程式設計者指定的例外處理程式。" -#: ../../extending/extending.rst:195 +#: ../../extending/extending.rst:170 msgid "" "(There are situations where a module can actually give a more detailed error " "message by calling another ``PyErr_*`` function, and in such cases it is " @@ -413,7 +343,7 @@ msgstr "" "息,在這種情況下這樣做是沒問題的。然而這一般來說並非必要,而且可能會導致錯誤" "原因資訊的遺失:大多數的操作都可能因為各種原因而失敗。)" -#: ../../extending/extending.rst:201 +#: ../../extending/extending.rst:176 msgid "" "To ignore an exception set by a function call that failed, the exception " "condition must be cleared explicitly by calling :c:func:`PyErr_Clear`. The " @@ -426,21 +356,22 @@ msgstr "" "給直譯器而想要完全是自己來處理它時(可能是要再嘗試其他東西,或者假裝什麼都沒" "出錯)。" -#: ../../extending/extending.rst:207 +#: ../../extending/extending.rst:182 msgid "" "Every failing :c:func:`malloc` call must be turned into an exception --- the " -"direct caller of :c:func:`malloc` (or :c:func:`realloc`) must call :c:func:" -"`PyErr_NoMemory` and return a failure indicator itself. All the object-" -"creating functions (for example, :c:func:`PyLong_FromLong`) already do this, " -"so this note is only relevant to those who call :c:func:`malloc` directly." +"direct caller of :c:func:`malloc` (or :c:func:`realloc`) must " +"call :c:func:`PyErr_NoMemory` and return a failure indicator itself. All " +"the object-creating functions (for example, :c:func:`PyLong_FromLong`) " +"already do this, so this note is only relevant to those who " +"call :c:func:`malloc` directly." msgstr "" -"每個失敗的 :c:func:`malloc` 呼叫都必須被轉換成一個例外 --- :c:func:" -"`malloc`\\ (或 :c:func:`realloc`)的直接呼叫者必須呼叫 :c:func:" -"`PyErr_NoMemory` 並回傳一個失敗指示器。所有建立物件的函式(例如 :c:func:" -"`PyLong_FromLong`)都已經這麼做了,所以這個注意事項只和那些直接呼叫 :c:func:" -"`malloc` 的函式有關。" +"每個失敗的 :c:func:`malloc` 呼叫都必須被轉換成一個例外 " +"--- :c:func:`malloc`\\ (或 :c:func:`realloc`)的直接呼叫者必須呼" +"叫 :c:func:`PyErr_NoMemory` 並回傳一個失敗指示器。所有建立物件的函式(例" +"如 :c:func:`PyLong_FromLong`)都已經這麼做了,所以這個注意事項只和那些直接呼" +"叫 :c:func:`malloc` 的函式有關。" -#: ../../extending/extending.rst:213 +#: ../../extending/extending.rst:188 msgid "" "Also note that, with the important exception of :c:func:`PyArg_ParseTuple` " "and friends, functions that return an integer status usually return a " @@ -451,36 +382,37 @@ msgstr "" "整數狀態的函式通常會回傳一個正值或 0 表示成功、回傳 ``-1`` 表示失敗,就像 " "Unix 系統呼叫一樣。" -#: ../../extending/extending.rst:217 +#: ../../extending/extending.rst:192 msgid "" -"Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or :" -"c:func:`Py_DECREF` calls for objects you have already created) when you " +"Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` " +"or :c:func:`Py_DECREF` calls for objects you have already created) when you " "return an error indicator!" msgstr "" -"最後,在回傳錯誤指示器時要注意垃圾清理(透過對你已經建立的物件呼叫 :c:func:" -"`Py_XDECREF` 或 :c:func:`Py_DECREF`)!" +"最後,在回傳錯誤指示器時要注意垃圾清理(透過對你已經建立的物件呼" +"叫 :c:func:`Py_XDECREF` 或 :c:func:`Py_DECREF`)!" -#: ../../extending/extending.rst:221 +#: ../../extending/extending.rst:196 msgid "" "The choice of which exception to raise is entirely yours. There are " "predeclared C objects corresponding to all built-in Python exceptions, such " "as :c:data:`PyExc_ZeroDivisionError`, which you can use directly. Of course, " "you should choose exceptions wisely --- don't use :c:data:`PyExc_TypeError` " -"to mean that a file couldn't be opened (that should probably be :c:data:" -"`PyExc_OSError`). If something's wrong with the argument list, the :c:func:" -"`PyArg_ParseTuple` function usually raises :c:data:`PyExc_TypeError`. If " -"you have an argument whose value must be in a particular range or must " -"satisfy other conditions, :c:data:`PyExc_ValueError` is appropriate." +"to mean that a file couldn't be opened (that should probably " +"be :c:data:`PyExc_OSError`). If something's wrong with the argument list, " +"the :c:func:`PyArg_ParseTuple` function usually " +"raises :c:data:`PyExc_TypeError`. If you have an argument whose value must " +"be in a particular range or must satisfy other " +"conditions, :c:data:`PyExc_ValueError` is appropriate." msgstr "" "你完全可以自行選擇要產生的例外。有一些預先宣告的 C 物件會對應到所有內建的 " "Python 例外,例如 :c:data:`PyExc_ZeroDivisionError`,你可以直接使用它們。當" "然,你應該明智地選擇例外,像是不要使用 :c:data:`PyExc_TypeError` 來表示檔案無" -"法打開(應該是 :c:data:`PyExc_OSError`)。如果引數串列有問題,:c:func:" -"`PyArg_ParseTuple` 函式通常會引發 :c:data:`PyExc_TypeError`。如果你有一個引數" -"的值必須在一個特定的範圍內或必須滿足其他條件,則可以使用 :c:data:" -"`PyExc_ValueError`。" +"法打開(應該是 :c:data:`PyExc_OSError`)。如果引數串列有問" +"題,:c:func:`PyArg_ParseTuple` 函式通常會引發 :c:data:`PyExc_TypeError`。如果" +"你有一個引數的值必須在一個特定的範圍內或必須滿足其他條件,則可以使" +"用 :c:data:`PyExc_ValueError`。" -#: ../../extending/extending.rst:231 +#: ../../extending/extending.rst:206 msgid "" "You can also define a new exception that is unique to your module. The " "simplest way to do this is to declare a static global object variable at the " @@ -489,34 +421,34 @@ msgstr "" "你也可以定義一個你的模組特有的新例外。最簡單的方式是在檔案的開頭宣告一個靜態" "全域物件變數: ::" -#: ../../extending/extending.rst:235 +#: ../../extending/extending.rst:210 msgid "static PyObject *SpamError = NULL;" msgstr "static PyObject *SpamError = NULL;" -#: ../../extending/extending.rst:237 +#: ../../extending/extending.rst:212 msgid "" -"and initialize it by calling :c:func:`PyErr_NewException` in the module's :c:" -"data:`Py_mod_exec` function (:c:func:`!spam_module_exec`)::" +"and initialize it by calling :c:func:`PyErr_NewException` in the " +"module's :c:data:`Py_mod_exec` function (:c:func:`!spam_module_exec`)::" msgstr "" -#: ../../extending/extending.rst:240 +#: ../../extending/extending.rst:215 msgid "SpamError = PyErr_NewException(\"spam.error\", NULL, NULL);" msgstr "" -#: ../../extending/extending.rst:242 +#: ../../extending/extending.rst:217 msgid "" -"Since :c:data:`!SpamError` is a global variable, it will be overwritten " -"every time the module is reinitialized, when the :c:data:`Py_mod_exec` " -"function is called." +"Since :c:data:`!SpamError` is a global variable, it will be overwitten every " +"time the module is reinitialized, when the :c:data:`Py_mod_exec` function is " +"called." msgstr "" -#: ../../extending/extending.rst:245 +#: ../../extending/extending.rst:220 msgid "" "For now, let's avoid the issue: we will block repeated initialization by " "raising an :py:exc:`ImportError`::" msgstr "" -#: ../../extending/extending.rst:248 +#: ../../extending/extending.rst:223 msgid "" "static PyObject *SpamError = NULL;\n" "\n" @@ -555,7 +487,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:284 +#: ../../extending/extending.rst:259 msgid "" "Note that the Python name for the exception object is :exc:`!spam.error`. " "The :c:func:`PyErr_NewException` function may create a class with the base " @@ -566,7 +498,7 @@ msgstr "" "exceptions`\\ 所述,:c:func:`PyErr_NewException` 函式可能會建立一個基底類別" "為 :exc:`Exception` 的類別(除非傳入另一個類別來代替 ``NULL``)。" -#: ../../extending/extending.rst:289 +#: ../../extending/extending.rst:264 msgid "" "Note also that the :c:data:`!SpamError` variable retains a reference to the " "newly created exception class; this is intentional! Since the exception " @@ -582,7 +514,7 @@ msgstr "" "如果它變成迷途指標,那產生例外的 C 程式碼可能會導致核心轉儲 (core dump) 或其" "他不預期的 side effect。" -#: ../../extending/extending.rst:296 +#: ../../extending/extending.rst:271 msgid "" "For now, the :c:func:`Py_DECREF` call to remove this reference is missing. " "Even when the Python interpreter shuts down, the global :c:data:`!SpamError` " @@ -590,13 +522,13 @@ msgid "" "ensure that this will happen at most once per process." msgstr "" -#: ../../extending/extending.rst:301 +#: ../../extending/extending.rst:276 msgid "" "We discuss the use of :c:macro:`PyMODINIT_FUNC` as a function return type " "later in this sample." msgstr "我們稍後會討論 :c:macro:`PyMODINIT_FUNC` 作為函式回傳型別的用法。" -#: ../../extending/extending.rst:304 +#: ../../extending/extending.rst:279 msgid "" "The :exc:`!spam.error` exception can be raised in your extension module " "using a call to :c:func:`PyErr_SetString` as shown below::" @@ -604,7 +536,7 @@ msgstr "" "可以在你的擴充模組中呼叫 :c:func:`PyErr_SetString` 來引發 :exc:`!spam.error` " "例外,如下所示: ::" -#: ../../extending/extending.rst:307 +#: ../../extending/extending.rst:282 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -638,17 +570,17 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:327 +#: ../../extending/extending.rst:302 msgid "Back to the Example" msgstr "回到範例" -#: ../../extending/extending.rst:329 +#: ../../extending/extending.rst:304 msgid "" "Going back to our example function, you should now be able to understand " "this statement::" msgstr "回到我們的範例函式,現在你應該可以理解這個陳述式了: ::" -#: ../../extending/extending.rst:332 +#: ../../extending/extending.rst:307 msgid "" "if (!PyArg_ParseTuple(args, \"s\", &command))\n" " return NULL;" @@ -656,7 +588,7 @@ msgstr "" "if (!PyArg_ParseTuple(args, \"s\", &command))\n" " return NULL;" -#: ../../extending/extending.rst:335 +#: ../../extending/extending.rst:310 msgid "" "It returns ``NULL`` (the error indicator for functions returning object " "pointers) if an error is detected in the argument list, relying on the " @@ -672,32 +604,32 @@ msgstr "" "的字串(所以在標準 C 中,:c:data:`!command` 變數應該正確地被宣告為 ``const " "char *command``)。" -#: ../../extending/extending.rst:343 +#: ../../extending/extending.rst:318 msgid "" "The next statement is a call to the Unix function :c:func:`system`, passing " "it the string we just got from :c:func:`PyArg_ParseTuple`::" msgstr "" -"接下來的陳述式會呼叫 Unix 函式 :c:func:`system`,並將剛才從 :c:func:" -"`PyArg_ParseTuple` 得到的字串傳給它:" +"接下來的陳述式會呼叫 Unix 函式 :c:func:`system`,並將剛才" +"從 :c:func:`PyArg_ParseTuple` 得到的字串傳給它:" -#: ../../extending/extending.rst:346 +#: ../../extending/extending.rst:321 msgid "sts = system(command);" msgstr "sts = system(command);" -#: ../../extending/extending.rst:348 +#: ../../extending/extending.rst:323 msgid "" "Our :func:`!spam.system` function must return the value of :c:data:`!sts` as " -"a Python object. This is done using the function :c:func:" -"`PyLong_FromLong`. ::" +"a Python object. This is done using the " +"function :c:func:`PyLong_FromLong`. ::" msgstr "" "我們的 :func:`!spam.system` 函式必須以 Python 物件的形式來回傳 :c:data:`!" "sts` 的值。這是透過 :c:func:`PyLong_FromLong` 函式來達成。 ::" -#: ../../extending/extending.rst:351 +#: ../../extending/extending.rst:326 msgid "return PyLong_FromLong(sts);" msgstr "return PyLong_FromLong(sts);" -#: ../../extending/extending.rst:353 +#: ../../extending/extending.rst:328 msgid "" "In this case, it will return an integer object. (Yes, even integers are " "objects on the heap in Python!)" @@ -705,18 +637,18 @@ msgstr "" "在這種情況下它會回傳一個整數物件。(是的,在 Python 中連整數也是堆積 (heap) 上" "的物件!)" -#: ../../extending/extending.rst:356 +#: ../../extending/extending.rst:331 msgid "" "If you have a C function that returns no useful argument (a function " "returning :c:expr:`void`), the corresponding Python function must return " -"``None``. You need this idiom to do so (which is implemented by the :c:" -"macro:`Py_RETURN_NONE` macro)::" +"``None``. You need this idiom to do so (which is implemented by " +"the :c:macro:`Py_RETURN_NONE` macro)::" msgstr "" "如果你有一個不回傳任何有用引數的 C 函式(一個回傳 :c:expr:`void` 的函式),對" -"應的 Python 函式必須回傳 ``None``。你需要以下這個慣例來達成(由 :c:macro:" -"`Py_RETURN_NONE` 巨集實作): ::" +"應的 Python 函式必須回傳 ``None``。你需要以下這個慣例來達成" +"(由 :c:macro:`Py_RETURN_NONE` 巨集實作): ::" -#: ../../extending/extending.rst:361 +#: ../../extending/extending.rst:336 msgid "" "Py_INCREF(Py_None);\n" "return Py_None;" @@ -724,7 +656,7 @@ msgstr "" "Py_INCREF(Py_None);\n" "return Py_None;" -#: ../../extending/extending.rst:364 +#: ../../extending/extending.rst:339 msgid "" ":c:data:`Py_None` is the C name for the special Python object ``None``. It " "is a genuine Python object rather than a ``NULL`` pointer, which means " @@ -734,11 +666,11 @@ msgstr "" "Python 物件而不是一個 ``NULL`` 指標,在大多數的情況下它的意思是「錯誤」,如我" "們所見過的那樣。" -#: ../../extending/extending.rst:372 +#: ../../extending/extending.rst:347 msgid "The Module's Method Table and Initialization Function" msgstr "模組的方法表和初始化函式" -#: ../../extending/extending.rst:374 +#: ../../extending/extending.rst:349 msgid "" "I promised to show how :c:func:`!spam_system` is called from Python " "programs. First, we need to list its name and address in a \"method table\"::" @@ -746,7 +678,7 @@ msgstr "" "我承諾過要展示 :c:func:`!spam_system` 是如何從 Python 程式中呼叫的。首先,我" "們需要在「方法表」中列出它的名稱和位址: ::" -#: ../../extending/extending.rst:377 +#: ../../extending/extending.rst:352 msgid "" "static PyMethodDef spam_methods[] = {\n" " ...\n" @@ -764,7 +696,7 @@ msgstr "" " {NULL, NULL, 0, NULL} /* Sentinel */\n" "};" -#: ../../extending/extending.rst:385 +#: ../../extending/extending.rst:360 msgid "" "Note the third entry (``METH_VARARGS``). This is a flag telling the " "interpreter the calling convention to be used for the C function. It should " @@ -776,17 +708,18 @@ msgstr "" "標。通常應該是 ``METH_VARARGS`` 或 ``METH_VARARGS | METH_KEYWORDS``;``0`` 表" "示是使用 :c:func:`PyArg_ParseTuple` 的一個過時變體。" -#: ../../extending/extending.rst:390 +#: ../../extending/extending.rst:365 msgid "" "When using only ``METH_VARARGS``, the function should expect the Python-" -"level parameters to be passed in as a tuple acceptable for parsing via :c:" -"func:`PyArg_ParseTuple`; more information on this function is provided below." +"level parameters to be passed in as a tuple acceptable for parsing " +"via :c:func:`PyArg_ParseTuple`; more information on this function is " +"provided below." msgstr "" "當只使用 ``METH_VARARGS`` 時,函式應預期 Python 層級的參數是以元組形式傳入且" "能夠接受以 :c:func:`PyArg_ParseTuple` 進行剖析;有關此函式的更多資訊將在下面" "提供。" -#: ../../extending/extending.rst:394 +#: ../../extending/extending.rst:369 msgid "" "The :c:macro:`METH_KEYWORDS` bit may be set in the third field if keyword " "arguments should be passed to the function. In this case, the C function " @@ -799,12 +732,12 @@ msgstr "" "是關鍵字的字典。可使用 :c:func:`PyArg_ParseTupleAndKeywords` 來剖析這種函式的" "引數。" -#: ../../extending/extending.rst:400 +#: ../../extending/extending.rst:375 msgid "" "The method table must be referenced in the module definition structure::" msgstr "方法表必須在模組定義結構中被參照: ::" -#: ../../extending/extending.rst:402 +#: ../../extending/extending.rst:377 msgid "" "static struct PyModuleDef spam_module = {\n" " ...\n" @@ -813,18 +746,18 @@ msgid "" "};" msgstr "" -#: ../../extending/extending.rst:408 +#: ../../extending/extending.rst:383 msgid "" "This structure, in turn, must be passed to the interpreter in the module's " -"initialization function. The initialization function must be named :c:func:" -"`!PyInit_name`, where *name* is the name of the module, and should be the " -"only non-\\ ``static`` item defined in the module file::" +"initialization function. The initialization function must be " +"named :c:func:`!PyInit_name`, where *name* is the name of the module, and " +"should be the only non-\\ ``static`` item defined in the module file::" msgstr "" "反過來說,這個結構必須在模組的初始化函式中被傳給直譯器。初始化函式必須被命名" "為 :c:func:`!PyInit_name`,其中 *name* 是模組的名稱,且應該是模組檔案中唯一定" "義的非「靜態 (``static``)」項目: ::" -#: ../../extending/extending.rst:413 +#: ../../extending/extending.rst:388 msgid "" "PyMODINIT_FUNC\n" "PyInit_spam(void)\n" @@ -838,7 +771,7 @@ msgstr "" " return PyModuleDef_Init(&spam_module);\n" "}" -#: ../../extending/extending.rst:419 +#: ../../extending/extending.rst:394 msgid "" "Note that :c:macro:`PyMODINIT_FUNC` declares the function as ``PyObject *`` " "return type, declares any special linkage declarations required by the " @@ -847,27 +780,28 @@ msgstr "" "請注意,:c:macro:`PyMODINIT_FUNC` 宣告函式的回傳型別為 ``PyObject *``、宣告平" "台所需的任何特殊連結宣告、並針對 C++ 宣告函式為 ``extern \"C\"``。" -#: ../../extending/extending.rst:423 +#: ../../extending/extending.rst:398 msgid "" -":c:func:`!PyInit_spam` is called when each interpreter imports its module :" -"mod:`!spam` for the first time. (See below for comments about embedding " -"Python.) A pointer to the module definition must be returned via :c:func:" -"`PyModuleDef_Init`, so that the import machinery can create the module and " -"store it in ``sys.modules``." +":c:func:`!PyInit_spam` is called when each interpreter imports its " +"module :mod:`!spam` for the first time. (See below for comments about " +"embedding Python.) A pointer to the module definition must be returned " +"via :c:func:`PyModuleDef_Init`, so that the import machinery can create the " +"module and store it in ``sys.modules``." msgstr "" -#: ../../extending/extending.rst:428 +#: ../../extending/extending.rst:403 msgid "" "When embedding Python, the :c:func:`!PyInit_spam` function is not called " "automatically unless there's an entry in the :c:data:`!PyImport_Inittab` " -"table. To add the module to the initialization table, use :c:func:" -"`PyImport_AppendInittab`, optionally followed by an import of the module::" +"table. To add the module to the initialization table, " +"use :c:func:`PyImport_AppendInittab`, optionally followed by an import of " +"the module::" msgstr "" "嵌入 Python 時,除非在 :c:data:`!PyImport_Inittab` 表中有相關條目,否則不會自" -"動呼叫 :c:func:`!PyInit_spam` 函式。要將模組加入初始化表,請使用 :c:func:" -"`PyImport_AppendInittab` 並在隨後選擇性地將該模組引入: ::" +"動呼叫 :c:func:`!PyInit_spam` 函式。要將模組加入初始化表,請使" +"用 :c:func:`PyImport_AppendInittab` 並在隨後選擇性地將該模組引入: ::" -#: ../../extending/extending.rst:433 +#: ../../extending/extending.rst:408 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -969,42 +903,43 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../extending/extending.rst:483 +#: ../../extending/extending.rst:458 msgid "" "If you declare a global variable or a local static one, the module may " "experience unintended side-effects on re-initialisation, for example when " "removing entries from ``sys.modules`` or importing compiled modules into " "multiple interpreters within a process (or following a :c:func:`fork` " -"without an intervening :c:func:`exec`). If module state is not yet fully :" -"ref:`isolated `, authors should consider marking " -"the module as having no support for subinterpreters (via :c:macro:" -"`Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED`)." +"without an intervening :c:func:`exec`). If module state is not yet " +"fully :ref:`isolated `, authors should consider " +"marking the module as having no support for subinterpreters " +"(via :c:macro:`Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED`)." msgstr "" -#: ../../extending/extending.rst:492 +#: ../../extending/extending.rst:467 msgid "" "A more substantial example module is included in the Python source " "distribution as :file:`Modules/xxlimited.c`. This file may be used as a " "template or simply read as an example." msgstr "" -"Python 原始碼發行版本中包含了一個更實質的範例模組 :file:`Modules/xxlimited." -"c`。這個檔案可以當作模板使用,也可以簡單地當作範例來閱讀。" +"Python 原始碼發行版本中包含了一個更實質的範例模組 :file:`Modules/" +"xxlimited.c`。這個檔案可以當作模板使用,也可以簡單地當作範例來閱讀。" -#: ../../extending/extending.rst:500 +#: ../../extending/extending.rst:475 msgid "Compilation and Linkage" msgstr "" -#: ../../extending/extending.rst:502 +#: ../../extending/extending.rst:477 msgid "" "There are two more things to do before you can use your new extension: " "compiling and linking it with the Python system. If you use dynamic " "loading, the details may depend on the style of dynamic loading your system " -"uses; see the chapters about building extension modules (chapter :ref:" -"`building`) and additional information that pertains only to building on " -"Windows (chapter :ref:`building-on-windows`) for more information about this." +"uses; see the chapters about building extension modules " +"(chapter :ref:`building`) and additional information that pertains only to " +"building on Windows (chapter :ref:`building-on-windows`) for more " +"information about this." msgstr "" -#: ../../extending/extending.rst:509 +#: ../../extending/extending.rst:484 msgid "" "If you can't use dynamic loading, or if you want to make your module a " "permanent part of the Python interpreter, you will have to change the " @@ -1014,11 +949,11 @@ msgid "" "line to the file :file:`Modules/Setup.local` describing your file:" msgstr "" -#: ../../extending/extending.rst:516 +#: ../../extending/extending.rst:491 msgid "spam spammodule.o" msgstr "spam spammodule.o" -#: ../../extending/extending.rst:520 +#: ../../extending/extending.rst:495 msgid "" "and rebuild the interpreter by running :program:`make` in the toplevel " "directory. You can also run :program:`make` in the :file:`Modules/` " @@ -1027,21 +962,21 @@ msgid "" "the :file:`Setup` file.)" msgstr "" -#: ../../extending/extending.rst:526 +#: ../../extending/extending.rst:501 msgid "" "If your module requires additional libraries to link with, these can be " "listed on the line in the configuration file as well, for instance:" msgstr "" -#: ../../extending/extending.rst:529 +#: ../../extending/extending.rst:504 msgid "spam spammodule.o -lX11" msgstr "spam spammodule.o -lX11" -#: ../../extending/extending.rst:537 +#: ../../extending/extending.rst:512 msgid "Calling Python Functions from C" msgstr "" -#: ../../extending/extending.rst:539 +#: ../../extending/extending.rst:514 msgid "" "So far we have concentrated on making C functions callable from Python. The " "reverse is also useful: calling Python functions from C. This is especially " @@ -1052,7 +987,7 @@ msgid "" "uses are also imaginable." msgstr "" -#: ../../extending/extending.rst:547 +#: ../../extending/extending.rst:522 msgid "" "Fortunately, the Python interpreter is easily called recursively, and there " "is a standard interface to call a Python function. (I won't dwell on how to " @@ -1061,7 +996,7 @@ msgid "" "line option in :file:`Modules/main.c` from the Python source code.)" msgstr "" -#: ../../extending/extending.rst:553 +#: ../../extending/extending.rst:528 msgid "" "Calling a Python function is easy. First, the Python program must somehow " "pass you the Python function object. You should provide a function (or some " @@ -1071,7 +1006,7 @@ msgid "" "function might be part of a module definition::" msgstr "" -#: ../../extending/extending.rst:560 +#: ../../extending/extending.rst:535 msgid "" "static PyObject *my_callback = NULL;\n" "\n" @@ -1098,15 +1033,15 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:583 +#: ../../extending/extending.rst:558 msgid "" -"This function must be registered with the interpreter using the :c:macro:" -"`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The :" -"c:func:`PyArg_ParseTuple` function and its arguments are documented in " -"section :ref:`parsetuple`." +"This function must be registered with the interpreter using " +"the :c:macro:`METH_VARARGS` flag; this is described in " +"section :ref:`methodtable`. The :c:func:`PyArg_ParseTuple` function and its " +"arguments are documented in section :ref:`parsetuple`." msgstr "" -#: ../../extending/extending.rst:588 +#: ../../extending/extending.rst:563 msgid "" "The macros :c:func:`Py_XINCREF` and :c:func:`Py_XDECREF` increment/decrement " "the reference count of an object and are safe in the presence of ``NULL`` " @@ -1114,19 +1049,20 @@ msgid "" "info on them in section :ref:`refcounts`." msgstr "" -#: ../../extending/extending.rst:595 +#: ../../extending/extending.rst:570 msgid "" -"Later, when it is time to call the function, you call the C function :c:func:" -"`PyObject_CallObject`. This function has two arguments, both pointers to " -"arbitrary Python objects: the Python function, and the argument list. The " -"argument list must always be a tuple object, whose length is the number of " -"arguments. To call the Python function with no arguments, pass in ``NULL``, " -"or an empty tuple; to call it with one argument, pass a singleton tuple. :c:" -"func:`Py_BuildValue` returns a tuple when its format string consists of zero " -"or more format codes between parentheses. For example::" +"Later, when it is time to call the function, you call the C " +"function :c:func:`PyObject_CallObject`. This function has two arguments, " +"both pointers to arbitrary Python objects: the Python function, and the " +"argument list. The argument list must always be a tuple object, whose " +"length is the number of arguments. To call the Python function with no " +"arguments, pass in ``NULL``, or an empty tuple; to call it with one " +"argument, pass a singleton tuple. :c:func:`Py_BuildValue` returns a tuple " +"when its format string consists of zero or more format codes between " +"parentheses. For example::" msgstr "" -#: ../../extending/extending.rst:604 +#: ../../extending/extending.rst:579 msgid "" "int arg;\n" "PyObject *arglist;\n" @@ -1140,16 +1076,17 @@ msgid "" "Py_DECREF(arglist);" msgstr "" -#: ../../extending/extending.rst:615 +#: ../../extending/extending.rst:590 msgid "" ":c:func:`PyObject_CallObject` returns a Python object pointer: this is the " "return value of the Python function. :c:func:`PyObject_CallObject` is " "\"reference-count-neutral\" with respect to its arguments. In the example a " -"new tuple was created to serve as the argument list, which is :c:func:" -"`Py_DECREF`\\ -ed immediately after the :c:func:`PyObject_CallObject` call." +"new tuple was created to serve as the argument list, which " +"is :c:func:`Py_DECREF`\\ -ed immediately after " +"the :c:func:`PyObject_CallObject` call." msgstr "" -#: ../../extending/extending.rst:622 +#: ../../extending/extending.rst:597 msgid "" "The return value of :c:func:`PyObject_CallObject` is \"new\": either it is a " "brand new object, or it is an existing object whose reference count has been " @@ -1158,7 +1095,7 @@ msgid "" "not interested in its value." msgstr "" -#: ../../extending/extending.rst:628 +#: ../../extending/extending.rst:603 msgid "" "Before you do this, however, it is important to check that the return value " "isn't ``NULL``. If it is, the Python function terminated by raising an " @@ -1169,7 +1106,7 @@ msgid "" "should be cleared by calling :c:func:`PyErr_Clear`. For example::" msgstr "" -#: ../../extending/extending.rst:636 +#: ../../extending/extending.rst:611 msgid "" "if (result == NULL)\n" " return NULL; /* Pass error back */\n" @@ -1177,7 +1114,7 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:641 +#: ../../extending/extending.rst:616 msgid "" "Depending on the desired interface to the Python callback function, you may " "also have to provide an argument list to :c:func:`PyObject_CallObject`. In " @@ -1189,7 +1126,7 @@ msgid "" "you want to pass an integral event code, you might use the following code::" msgstr "" -#: ../../extending/extending.rst:650 +#: ../../extending/extending.rst:625 msgid "" "PyObject *arglist;\n" "...\n" @@ -1202,7 +1139,7 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:660 +#: ../../extending/extending.rst:635 msgid "" "Note the placement of ``Py_DECREF(arglist)`` immediately after the call, " "before the error check! Also note that strictly speaking this code is not " @@ -1210,14 +1147,15 @@ msgid "" "checked." msgstr "" -#: ../../extending/extending.rst:664 +#: ../../extending/extending.rst:639 msgid "" -"You may also call a function with keyword arguments by using :c:func:" -"`PyObject_Call`, which supports arguments and keyword arguments. As in the " -"above example, we use :c:func:`Py_BuildValue` to construct the dictionary. ::" +"You may also call a function with keyword arguments by " +"using :c:func:`PyObject_Call`, which supports arguments and keyword " +"arguments. As in the above example, we use :c:func:`Py_BuildValue` to " +"construct the dictionary. ::" msgstr "" -#: ../../extending/extending.rst:668 +#: ../../extending/extending.rst:643 msgid "" "PyObject *dict;\n" "...\n" @@ -1230,19 +1168,19 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:682 +#: ../../extending/extending.rst:657 msgid "Extracting Parameters in Extension Functions" msgstr "" -#: ../../extending/extending.rst:686 +#: ../../extending/extending.rst:661 msgid "The :c:func:`PyArg_ParseTuple` function is declared as follows::" msgstr "" -#: ../../extending/extending.rst:688 +#: ../../extending/extending.rst:663 msgid "int PyArg_ParseTuple(PyObject *arg, const char *format, ...);" msgstr "" -#: ../../extending/extending.rst:690 +#: ../../extending/extending.rst:665 msgid "" "The *arg* argument must be a tuple object containing an argument list passed " "from Python to a C function. The *format* argument must be a format string, " @@ -1251,7 +1189,7 @@ msgid "" "whose type is determined by the format string." msgstr "" -#: ../../extending/extending.rst:696 +#: ../../extending/extending.rst:671 msgid "" "Note that while :c:func:`PyArg_ParseTuple` checks that the Python arguments " "have the required types, it cannot check the validity of the addresses of C " @@ -1259,17 +1197,17 @@ msgid "" "probably crash or at least overwrite random bits in memory. So be careful!" msgstr "" -#: ../../extending/extending.rst:701 +#: ../../extending/extending.rst:676 msgid "" "Note that any Python object references which are provided to the caller are " "*borrowed* references; do not decrement their reference count!" msgstr "" -#: ../../extending/extending.rst:704 +#: ../../extending/extending.rst:679 msgid "Some example calls::" msgstr "一些呼叫範例: ::" -#: ../../extending/extending.rst:711 +#: ../../extending/extending.rst:686 msgid "" "int ok;\n" "int i, j;\n" @@ -1289,27 +1227,27 @@ msgstr "" "ok = PyArg_ParseTuple(args, \"\"); /* 沒有引數 */\n" " /* Python 呼叫:f() */" -#: ../../extending/extending.rst:722 +#: ../../extending/extending.rst:697 msgid "" "ok = PyArg_ParseTuple(args, \"s\", &s); /* A string */\n" " /* Possible Python call: f('whoops!') */" msgstr "" -#: ../../extending/extending.rst:727 +#: ../../extending/extending.rst:702 msgid "" "ok = PyArg_ParseTuple(args, \"lls\", &k, &l, &s); /* Two longs and a string " "*/\n" " /* Possible Python call: f(1, 2, 'three') */" msgstr "" -#: ../../extending/extending.rst:732 +#: ../../extending/extending.rst:707 msgid "" "ok = PyArg_ParseTuple(args, \"(ii)s#\", &i, &j, &s, &size);\n" " /* A pair of ints and a string, whose size is also returned */\n" " /* Possible Python call: f((1, 2), 'three') */" msgstr "" -#: ../../extending/extending.rst:738 +#: ../../extending/extending.rst:713 msgid "" "{\n" " const char *file;\n" @@ -1324,7 +1262,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:752 +#: ../../extending/extending.rst:727 msgid "" "{\n" " int left, top, right, bottom, h, v;\n" @@ -1336,7 +1274,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:763 +#: ../../extending/extending.rst:738 msgid "" "{\n" " Py_complex c;\n" @@ -1346,16 +1284,16 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:774 +#: ../../extending/extending.rst:749 msgid "Keyword Parameters for Extension Functions" msgstr "" -#: ../../extending/extending.rst:778 +#: ../../extending/extending.rst:753 msgid "" "The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::" msgstr "" -#: ../../extending/extending.rst:780 +#: ../../extending/extending.rst:755 msgid "" "int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" " const char *format, char * const " @@ -1365,32 +1303,32 @@ msgstr "" " const char *format, char * const " "*kwlist, ...);" -#: ../../extending/extending.rst:783 +#: ../../extending/extending.rst:758 msgid "" -"The *arg* and *format* parameters are identical to those of the :c:func:" -"`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of " -"keywords received as the third parameter from the Python runtime. The " -"*kwlist* parameter is a ``NULL``-terminated list of strings which identify " -"the parameters; the names are matched with the type information from " -"*format* from left to right. On success, :c:func:" -"`PyArg_ParseTupleAndKeywords` returns true, otherwise it returns false and " -"raises an appropriate exception." +"The *arg* and *format* parameters are identical to those of " +"the :c:func:`PyArg_ParseTuple` function. The *kwdict* parameter is the " +"dictionary of keywords received as the third parameter from the Python " +"runtime. The *kwlist* parameter is a ``NULL``-terminated list of strings " +"which identify the parameters; the names are matched with the type " +"information from *format* from left to right. On " +"success, :c:func:`PyArg_ParseTupleAndKeywords` returns true, otherwise it " +"returns false and raises an appropriate exception." msgstr "" -#: ../../extending/extending.rst:793 +#: ../../extending/extending.rst:768 msgid "" "Nested tuples cannot be parsed when using keyword arguments! Keyword " -"parameters passed in which are not present in the *kwlist* will cause :exc:" -"`TypeError` to be raised." +"parameters passed in which are not present in the *kwlist* will " +"cause :exc:`TypeError` to be raised." msgstr "" -#: ../../extending/extending.rst:799 +#: ../../extending/extending.rst:774 msgid "" "Here is an example module which uses keywords, based on an example by Geoff " "Philbrick (philbrick@hks.com)::" msgstr "" -#: ../../extending/extending.rst:802 +#: ../../extending/extending.rst:777 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -1443,29 +1381,29 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:853 +#: ../../extending/extending.rst:828 msgid "Building Arbitrary Values" msgstr "" -#: ../../extending/extending.rst:855 +#: ../../extending/extending.rst:830 msgid "" "This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is " "declared as follows::" msgstr "" -#: ../../extending/extending.rst:858 +#: ../../extending/extending.rst:833 msgid "PyObject *Py_BuildValue(const char *format, ...);" msgstr "PyObject *Py_BuildValue(const char *format, ...);" -#: ../../extending/extending.rst:860 +#: ../../extending/extending.rst:835 msgid "" -"It recognizes a set of format units similar to the ones recognized by :c:" -"func:`PyArg_ParseTuple`, but the arguments (which are input to the function, " -"not output) must not be pointers, just values. It returns a new Python " -"object, suitable for returning from a C function called from Python." +"It recognizes a set of format units similar to the ones recognized " +"by :c:func:`PyArg_ParseTuple`, but the arguments (which are input to the " +"function, not output) must not be pointers, just values. It returns a new " +"Python object, suitable for returning from a C function called from Python." msgstr "" -#: ../../extending/extending.rst:865 +#: ../../extending/extending.rst:840 msgid "" "One difference with :c:func:`PyArg_ParseTuple`: while the latter requires " "its first argument to be a tuple (since Python argument lists are always " @@ -1477,12 +1415,12 @@ msgid "" "parenthesize the format string." msgstr "" -#: ../../extending/extending.rst:873 +#: ../../extending/extending.rst:848 msgid "" "Examples (to the left the call, to the right the resulting Python value):" msgstr "" -#: ../../extending/extending.rst:875 +#: ../../extending/extending.rst:850 msgid "" "Py_BuildValue(\"\") None\n" "Py_BuildValue(\"i\", 123) 123\n" @@ -1520,11 +1458,11 @@ msgstr "" "Py_BuildValue(\"((ii)(ii)) (ii)\",\n" " 1, 2, 3, 4, 5, 6) (((1, 2), (3, 4)), (5, 6))" -#: ../../extending/extending.rst:899 +#: ../../extending/extending.rst:874 msgid "Reference Counts" msgstr "參照計數" -#: ../../extending/extending.rst:901 +#: ../../extending/extending.rst:876 msgid "" "In languages like C or C++, the programmer is responsible for dynamic " "allocation and deallocation of memory on the heap. In C, this is done using " @@ -1533,22 +1471,22 @@ msgid "" "restrict the following discussion to the C case." msgstr "" -#: ../../extending/extending.rst:907 +#: ../../extending/extending.rst:882 msgid "" "Every block of memory allocated with :c:func:`malloc` should eventually be " -"returned to the pool of available memory by exactly one call to :c:func:" -"`free`. It is important to call :c:func:`free` at the right time. If a " -"block's address is forgotten but :c:func:`free` is not called for it, the " -"memory it occupies cannot be reused until the program terminates. This is " -"called a :dfn:`memory leak`. On the other hand, if a program calls :c:func:" -"`free` for a block and then continues to use the block, it creates a " -"conflict with reuse of the block through another :c:func:`malloc` call. " -"This is called :dfn:`using freed memory`. It has the same bad consequences " -"as referencing uninitialized data --- core dumps, wrong results, mysterious " -"crashes." +"returned to the pool of available memory by exactly one call " +"to :c:func:`free`. It is important to call :c:func:`free` at the right " +"time. If a block's address is forgotten but :c:func:`free` is not called " +"for it, the memory it occupies cannot be reused until the program " +"terminates. This is called a :dfn:`memory leak`. On the other hand, if a " +"program calls :c:func:`free` for a block and then continues to use the " +"block, it creates a conflict with reuse of the block through " +"another :c:func:`malloc` call. This is called :dfn:`using freed memory`. It " +"has the same bad consequences as referencing uninitialized data --- core " +"dumps, wrong results, mysterious crashes." msgstr "" -#: ../../extending/extending.rst:918 +#: ../../extending/extending.rst:893 msgid "" "Common causes of memory leaks are unusual paths through the code. For " "instance, a function may allocate a block of memory, do some calculation, " @@ -1565,7 +1503,7 @@ msgid "" "of errors." msgstr "" -#: ../../extending/extending.rst:931 +#: ../../extending/extending.rst:906 msgid "" "Since Python makes heavy use of :c:func:`malloc` and :c:func:`free`, it " "needs a strategy to avoid memory leaks as well as the use of freed memory. " @@ -1576,7 +1514,7 @@ msgid "" "reference to the object has been deleted and the object is freed." msgstr "" -#: ../../extending/extending.rst:939 +#: ../../extending/extending.rst:914 msgid "" "An alternative strategy is called :dfn:`automatic garbage collection`. " "(Sometimes, reference counting is also referred to as a garbage collection " @@ -1592,7 +1530,7 @@ msgid "" "with reference counts." msgstr "" -#: ../../extending/extending.rst:951 +#: ../../extending/extending.rst:926 msgid "" "While Python uses the traditional reference counting implementation, it also " "offers a cycle detector that works to detect reference cycles. This allows " @@ -1606,30 +1544,30 @@ msgid "" "though there are no further references to the cycle itself." msgstr "" -#: ../../extending/extending.rst:962 +#: ../../extending/extending.rst:937 msgid "" "The cycle detector is able to detect garbage cycles and can reclaim them. " -"The :mod:`gc` module exposes a way to run the detector (the :func:`~gc." -"collect` function), as well as configuration interfaces and the ability to " -"disable the detector at runtime." +"The :mod:`gc` module exposes a way to run the detector " +"(the :func:`~gc.collect` function), as well as configuration interfaces and " +"the ability to disable the detector at runtime." msgstr "" -#: ../../extending/extending.rst:971 +#: ../../extending/extending.rst:946 msgid "Reference Counting in Python" msgstr "Python 中的參照計數" -#: ../../extending/extending.rst:973 +#: ../../extending/extending.rst:948 msgid "" "There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle " -"the incrementing and decrementing of the reference count. :c:func:" -"`Py_DECREF` also frees the object when the count reaches zero. For " -"flexibility, it doesn't call :c:func:`free` directly --- rather, it makes a " -"call through a function pointer in the object's :dfn:`type object`. For " -"this purpose (and others), every object also contains a pointer to its type " -"object." +"the incrementing and decrementing of the reference " +"count. :c:func:`Py_DECREF` also frees the object when the count reaches " +"zero. For flexibility, it doesn't call :c:func:`free` directly --- rather, " +"it makes a call through a function pointer in the object's :dfn:`type " +"object`. For this purpose (and others), every object also contains a " +"pointer to its type object." msgstr "" -#: ../../extending/extending.rst:980 +#: ../../extending/extending.rst:955 msgid "" "The big question now remains: when to use ``Py_INCREF(x)`` and " "``Py_DECREF(x)``? Let's first introduce some terms. Nobody \"owns\" an " @@ -1642,7 +1580,7 @@ msgid "" "reference creates a memory leak." msgstr "" -#: ../../extending/extending.rst:989 +#: ../../extending/extending.rst:964 msgid "" "It is also possible to :dfn:`borrow` [#]_ a reference to an object. The " "borrower of a reference should not call :c:func:`Py_DECREF`. The borrower " @@ -1651,7 +1589,7 @@ msgid "" "risks using freed memory and should be avoided completely [#]_." msgstr "" -#: ../../extending/extending.rst:995 +#: ../../extending/extending.rst:970 msgid "" "The advantage of borrowing over owning a reference is that you don't need to " "take care of disposing of the reference on all possible paths through the " @@ -1662,67 +1600,68 @@ msgid "" "borrowed has in fact disposed of it." msgstr "" -#: ../../extending/extending.rst:1003 +#: ../../extending/extending.rst:978 msgid "" -"A borrowed reference can be changed into an owned reference by calling :c:" -"func:`Py_INCREF`. This does not affect the status of the owner from which " -"the reference was borrowed --- it creates a new owned reference, and gives " -"full owner responsibilities (the new owner must dispose of the reference " -"properly, as well as the previous owner)." +"A borrowed reference can be changed into an owned reference by " +"calling :c:func:`Py_INCREF`. This does not affect the status of the owner " +"from which the reference was borrowed --- it creates a new owned reference, " +"and gives full owner responsibilities (the new owner must dispose of the " +"reference properly, as well as the previous owner)." msgstr "" -#: ../../extending/extending.rst:1013 +#: ../../extending/extending.rst:988 msgid "Ownership Rules" msgstr "" -#: ../../extending/extending.rst:1015 +#: ../../extending/extending.rst:990 msgid "" "Whenever an object reference is passed into or out of a function, it is part " "of the function's interface specification whether ownership is transferred " "with the reference or not." msgstr "" -#: ../../extending/extending.rst:1019 +#: ../../extending/extending.rst:994 msgid "" "Most functions that return a reference to an object pass on ownership with " "the reference. In particular, all functions whose function it is to create " "a new object, such as :c:func:`PyLong_FromLong` and :c:func:`Py_BuildValue`, " "pass ownership to the receiver. Even if the object is not actually new, you " -"still receive ownership of a new reference to that object. For instance, :c:" -"func:`PyLong_FromLong` maintains a cache of popular values and can return a " -"reference to a cached item." +"still receive ownership of a new reference to that object. For " +"instance, :c:func:`PyLong_FromLong` maintains a cache of popular values and " +"can return a reference to a cached item." msgstr "" -#: ../../extending/extending.rst:1027 +#: ../../extending/extending.rst:1002 msgid "" "Many functions that extract objects from other objects also transfer " -"ownership with the reference, for instance :c:func:" -"`PyObject_GetAttrString`. The picture is less clear, here, however, since a " -"few common routines are exceptions: :c:func:`PyTuple_GetItem`, :c:func:" -"`PyList_GetItem`, :c:func:`PyDict_GetItem`, and :c:func:" -"`PyDict_GetItemString` all return references that you borrow from the tuple, " -"list or dictionary." +"ownership with the reference, for " +"instance :c:func:`PyObject_GetAttrString`. The picture is less clear, here, " +"however, since a few common routines are " +"exceptions: :c:func:`PyTuple_GetItem`, :c:func:`PyList_GetItem`, :c:func:`PyDict_GetItem`, " +"and :c:func:`PyDict_GetItemString` all return references that you borrow " +"from the tuple, list or dictionary." msgstr "" -#: ../../extending/extending.rst:1034 +#: ../../extending/extending.rst:1009 msgid "" "The function :c:func:`PyImport_AddModule` also returns a borrowed reference, " "even though it may actually create the object it returns: this is possible " "because an owned reference to the object is stored in ``sys.modules``." msgstr "" -#: ../../extending/extending.rst:1038 +#: ../../extending/extending.rst:1013 msgid "" "When you pass an object reference into another function, in general, the " "function borrows the reference from you --- if it needs to store it, it will " "use :c:func:`Py_INCREF` to become an independent owner. There are exactly " -"two important exceptions to this rule: :c:func:`PyTuple_SetItem` and :c:func:" -"`PyList_SetItem`. These functions take over ownership of the item passed to " -"them --- even if they fail! (Note that :c:func:`PyDict_SetItem` and friends " -"don't take over ownership --- they are \"normal.\")" +"two important exceptions to this rule: :c:func:`PyTuple_SetItem` " +"and :c:func:`PyList_SetItem`. These functions take over ownership of the " +"item passed to them --- even if they fail! (Note " +"that :c:func:`PyDict_SetItem` and friends don't take over ownership --- they " +"are \"normal.\")" msgstr "" -#: ../../extending/extending.rst:1046 +#: ../../extending/extending.rst:1021 msgid "" "When a C function is called from Python, it borrows references to its " "arguments from the caller. The caller owns a reference to the object, so " @@ -1731,18 +1670,18 @@ msgid "" "turned into an owned reference by calling :c:func:`Py_INCREF`." msgstr "" -#: ../../extending/extending.rst:1052 +#: ../../extending/extending.rst:1027 msgid "" "The object reference returned from a C function that is called from Python " "must be an owned reference --- ownership is transferred from the function to " "its caller." msgstr "" -#: ../../extending/extending.rst:1060 +#: ../../extending/extending.rst:1035 msgid "Thin Ice" msgstr "" -#: ../../extending/extending.rst:1062 +#: ../../extending/extending.rst:1037 msgid "" "There are a few situations where seemingly harmless use of a borrowed " "reference can lead to problems. These all have to do with implicit " @@ -1750,14 +1689,14 @@ msgid "" "dispose of it." msgstr "" -#: ../../extending/extending.rst:1066 +#: ../../extending/extending.rst:1041 msgid "" "The first and most important case to know about is using :c:func:`Py_DECREF` " "on an unrelated object while borrowing a reference to a list item. For " "instance::" msgstr "" -#: ../../extending/extending.rst:1069 +#: ../../extending/extending.rst:1044 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1777,14 +1716,14 @@ msgstr "" " PyObject_Print(item, stdout, 0); /* BUG! */\n" "}" -#: ../../extending/extending.rst:1078 +#: ../../extending/extending.rst:1053 msgid "" "This function first borrows a reference to ``list[0]``, then replaces " "``list[1]`` with the value ``0``, and finally prints the borrowed reference. " "Looks harmless, right? But it's not!" msgstr "" -#: ../../extending/extending.rst:1082 +#: ../../extending/extending.rst:1057 msgid "" "Let's follow the control flow into :c:func:`PyList_SetItem`. The list owns " "references to all its items, so when item 1 is replaced, it has to dispose " @@ -1793,15 +1732,15 @@ msgid "" "defined a :meth:`!__del__` method. If this class instance has a reference " "count of 1, disposing of it will call its :meth:`!__del__` method. " "Internally, :c:func:`PyList_SetItem` calls :c:func:`Py_DECREF` on the " -"replaced item, which invokes replaced item's corresponding :c:member:" -"`~PyTypeObject.tp_dealloc` function. During deallocation, :c:member:" -"`~PyTypeObject.tp_dealloc` calls :c:member:`~PyTypeObject.tp_finalize`, " -"which is mapped to the :meth:`!__del__` method for class instances (see :pep:" -"`442`). This entire sequence happens synchronously within the :c:func:" -"`PyList_SetItem` call." +"replaced item, which invokes replaced item's " +"corresponding :c:member:`~PyTypeObject.tp_dealloc` function. During " +"deallocation, :c:member:`~PyTypeObject.tp_dealloc` " +"calls :c:member:`~PyTypeObject.tp_finalize`, which is mapped to the :meth:`!" +"__del__` method for class instances (see :pep:`442`). This entire sequence " +"happens synchronously within the :c:func:`PyList_SetItem` call." msgstr "" -#: ../../extending/extending.rst:1096 +#: ../../extending/extending.rst:1071 msgid "" "Since it is written in Python, the :meth:`!__del__` method can execute " "arbitrary Python code. Could it perhaps do something to invalidate the " @@ -1812,13 +1751,13 @@ msgid "" "associated with it, thereby invalidating ``item``." msgstr "" -#: ../../extending/extending.rst:1104 +#: ../../extending/extending.rst:1079 msgid "" "The solution, once you know the source of the problem, is easy: temporarily " "increment the reference count. The correct version of the function reads::" msgstr "" -#: ../../extending/extending.rst:1107 +#: ../../extending/extending.rst:1082 msgid "" "void\n" "no_bug(PyObject *list)\n" @@ -1842,27 +1781,28 @@ msgstr "" " Py_DECREF(item);\n" "}" -#: ../../extending/extending.rst:1118 +#: ../../extending/extending.rst:1093 msgid "" "This is a true story. An older version of Python contained variants of this " "bug and someone spent a considerable amount of time in a C debugger to " "figure out why his :meth:`!__del__` methods would fail..." msgstr "" -#: ../../extending/extending.rst:1122 +#: ../../extending/extending.rst:1097 msgid "" "The second case of problems with a borrowed reference is a variant involving " "threads. Normally, multiple threads in the Python interpreter can't get in " "each other's way, because there is a :term:`global lock ` protecting Python's entire object space. However, it is possible to " -"temporarily release this lock using the macro :c:macro:" -"`Py_BEGIN_ALLOW_THREADS`, and to re-acquire it using :c:macro:" -"`Py_END_ALLOW_THREADS`. This is common around blocking I/O calls, to let " -"other threads use the processor while waiting for the I/O to complete. " -"Obviously, the following function has the same problem as the previous one::" +"temporarily release this lock using the " +"macro :c:macro:`Py_BEGIN_ALLOW_THREADS`, and to re-acquire it " +"using :c:macro:`Py_END_ALLOW_THREADS`. This is common around blocking I/O " +"calls, to let other threads use the processor while waiting for the I/O to " +"complete. Obviously, the following function has the same problem as the " +"previous one::" msgstr "" -#: ../../extending/extending.rst:1132 +#: ../../extending/extending.rst:1107 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1875,11 +1815,11 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1146 +#: ../../extending/extending.rst:1121 msgid "NULL Pointers" msgstr "NULL 指標" -#: ../../extending/extending.rst:1148 +#: ../../extending/extending.rst:1123 msgid "" "In general, functions that take object references as arguments do not expect " "you to pass them ``NULL`` pointers, and will dump core (or cause later core " @@ -1891,21 +1831,21 @@ msgid "" "more slowly." msgstr "" -#: ../../extending/extending.rst:1156 +#: ../../extending/extending.rst:1131 msgid "" "It is better to test for ``NULL`` only at the \"source:\" when a pointer " "that may be ``NULL`` is received, for example, from :c:func:`malloc` or from " "a function that may raise an exception." msgstr "" -#: ../../extending/extending.rst:1160 +#: ../../extending/extending.rst:1135 msgid "" "The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " -"``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and :c:" -"func:`Py_XDECREF` do." +"``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` " +"and :c:func:`Py_XDECREF` do." msgstr "" -#: ../../extending/extending.rst:1164 +#: ../../extending/extending.rst:1139 msgid "" "The macros for checking for a particular object type (``Pytype_Check()``) " "don't check for ``NULL`` pointers --- again, there is much code that calls " @@ -1914,24 +1854,24 @@ msgid "" "variants with ``NULL`` checking." msgstr "" -#: ../../extending/extending.rst:1170 +#: ../../extending/extending.rst:1145 msgid "" "The C function calling mechanism guarantees that the argument list passed to " "C functions (``args`` in the examples) is never ``NULL`` --- in fact it " "guarantees that it is always a tuple [#]_." msgstr "" -#: ../../extending/extending.rst:1174 +#: ../../extending/extending.rst:1149 msgid "" "It is a severe error to ever let a ``NULL`` pointer \"escape\" to the Python " "user." msgstr "" -#: ../../extending/extending.rst:1185 +#: ../../extending/extending.rst:1160 msgid "Writing Extensions in C++" msgstr "" -#: ../../extending/extending.rst:1187 +#: ../../extending/extending.rst:1162 msgid "" "It is possible to write extension modules in C++. Some restrictions apply. " "If the main program (the Python interpreter) is compiled and linked by the C " @@ -1944,11 +1884,11 @@ msgid "" "(all recent C++ compilers define this symbol)." msgstr "" -#: ../../extending/extending.rst:1201 +#: ../../extending/extending.rst:1176 msgid "Providing a C API for an Extension Module" msgstr "" -#: ../../extending/extending.rst:1206 +#: ../../extending/extending.rst:1181 msgid "" "Many extension modules just provide new functions and types to be used from " "Python, but sometimes the code in an extension module can be useful for " @@ -1959,7 +1899,7 @@ msgid "" "functions for direct manipulation from other extension modules." msgstr "" -#: ../../extending/extending.rst:1214 +#: ../../extending/extending.rst:1189 msgid "" "At first sight this seems easy: just write the functions (without declaring " "them ``static``, of course), provide an appropriate header file, and " @@ -1975,7 +1915,7 @@ msgid "" "call might not have been loaded yet!" msgstr "" -#: ../../extending/extending.rst:1226 +#: ../../extending/extending.rst:1201 msgid "" "Portability therefore requires not to make any assumptions about symbol " "visibility. This means that all symbols in extension modules should be " @@ -1985,7 +1925,7 @@ msgid "" "accessible from other extension modules must be exported in a different way." msgstr "" -#: ../../extending/extending.rst:1233 +#: ../../extending/extending.rst:1208 msgid "" "Python provides a special mechanism to pass C-level information (pointers) " "from one extension module to another one: Capsules. A Capsule is a Python " @@ -1997,7 +1937,7 @@ msgid "" "the Capsule." msgstr "" -#: ../../extending/extending.rst:1241 +#: ../../extending/extending.rst:1216 msgid "" "There are many ways in which Capsules can be used to export the C API of an " "extension module. Each function could get its own Capsule, or all C API " @@ -2007,7 +1947,7 @@ msgid "" "client modules." msgstr "" -#: ../../extending/extending.rst:1247 +#: ../../extending/extending.rst:1222 msgid "" "Whichever method you choose, it's important to name your Capsules properly. " "The function :c:func:`PyCapsule_New` takes a name parameter (:c:expr:`const " @@ -2017,17 +1957,17 @@ msgid "" "from another." msgstr "" -#: ../../extending/extending.rst:1254 +#: ../../extending/extending.rst:1229 msgid "" "In particular, Capsules used to expose C APIs should be given a name " "following this convention::" msgstr "" -#: ../../extending/extending.rst:1257 +#: ../../extending/extending.rst:1232 msgid "modulename.attributename" msgstr "modulename.attributename" -#: ../../extending/extending.rst:1259 +#: ../../extending/extending.rst:1234 msgid "" "The convenience function :c:func:`PyCapsule_Import` makes it easy to load a " "C API provided via a Capsule, but only if the Capsule's name matches this " @@ -2035,7 +1975,7 @@ msgid "" "the Capsule they load contains the correct C API." msgstr "" -#: ../../extending/extending.rst:1264 +#: ../../extending/extending.rst:1239 msgid "" "The following example demonstrates an approach that puts most of the burden " "on the writer of the exporting module, which is appropriate for commonly " @@ -2046,7 +1986,7 @@ msgid "" "modules only have to call this macro before accessing the C API." msgstr "" -#: ../../extending/extending.rst:1272 +#: ../../extending/extending.rst:1247 msgid "" "The exporting module is a modification of the :mod:`!spam` module from " "section :ref:`extending-simpleexample`. The function :func:`!spam.system` " @@ -2057,13 +1997,13 @@ msgid "" "modules." msgstr "" -#: ../../extending/extending.rst:1279 +#: ../../extending/extending.rst:1254 msgid "" "The function :c:func:`!PySpam_System` is a plain C function, declared " "``static`` like everything else::" msgstr "" -#: ../../extending/extending.rst:1282 +#: ../../extending/extending.rst:1257 msgid "" "static int\n" "PySpam_System(const char *command)\n" @@ -2077,11 +2017,11 @@ msgstr "" " return system(command);\n" "}" -#: ../../extending/extending.rst:1288 +#: ../../extending/extending.rst:1263 msgid "The function :c:func:`!spam_system` is modified in a trivial way::" msgstr "" -#: ../../extending/extending.rst:1290 +#: ../../extending/extending.rst:1265 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -2107,19 +2047,19 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:1302 +#: ../../extending/extending.rst:1277 msgid "In the beginning of the module, right after the line ::" msgstr "" -#: ../../extending/extending.rst:1304 +#: ../../extending/extending.rst:1279 msgid "#include " msgstr "#include " -#: ../../extending/extending.rst:1306 +#: ../../extending/extending.rst:1281 msgid "two more lines must be added::" msgstr "" -#: ../../extending/extending.rst:1308 +#: ../../extending/extending.rst:1283 msgid "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" @@ -2127,15 +2067,15 @@ msgstr "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" -#: ../../extending/extending.rst:1311 +#: ../../extending/extending.rst:1286 msgid "" "The ``#define`` is used to tell the header file that it is being included in " -"the exporting module, not a client module. Finally, the module's :c:data:" -"`mod_exec ` function must take care of initializing the C API " -"pointer array::" +"the exporting module, not a client module. Finally, the " +"module's :c:data:`mod_exec ` function must take care of " +"initializing the C API pointer array::" msgstr "" -#: ../../extending/extending.rst:1315 +#: ../../extending/extending.rst:1290 msgid "" "static int\n" "spam_module_exec(PyObject *m)\n" @@ -2158,19 +2098,19 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1334 +#: ../../extending/extending.rst:1309 msgid "" "Note that ``PySpam_API`` is declared ``static``; otherwise the pointer array " "would disappear when :c:func:`!PyInit_spam` terminates!" msgstr "" -#: ../../extending/extending.rst:1337 +#: ../../extending/extending.rst:1312 msgid "" "The bulk of the work is in the header file :file:`spammodule.h`, which looks " "like this::" msgstr "" -#: ../../extending/extending.rst:1340 +#: ../../extending/extending.rst:1315 msgid "" "#ifndef Py_SPAMMODULE_H\n" "#define Py_SPAMMODULE_H\n" @@ -2222,14 +2162,15 @@ msgid "" "#endif /* !defined(Py_SPAMMODULE_H) */" msgstr "" -#: ../../extending/extending.rst:1388 +#: ../../extending/extending.rst:1363 msgid "" -"All that a client module must do in order to have access to the function :c:" -"func:`!PySpam_System` is to call the function (or rather macro) :c:func:`!" -"import_spam` in its :c:data:`mod_exec ` function::" +"All that a client module must do in order to have access to the " +"function :c:func:`!PySpam_System` is to call the function (or rather " +"macro) :c:func:`!import_spam` in its :c:data:`mod_exec ` " +"function::" msgstr "" -#: ../../extending/extending.rst:1392 +#: ../../extending/extending.rst:1367 msgid "" "static int\n" "client_module_exec(PyObject *m)\n" @@ -2242,14 +2183,14 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1402 +#: ../../extending/extending.rst:1377 msgid "" "The main disadvantage of this approach is that the file :file:`spammodule.h` " "is rather complicated. However, the basic structure is the same for each " "function that is exported, so it has to be learned only once." msgstr "" -#: ../../extending/extending.rst:1406 +#: ../../extending/extending.rst:1381 msgid "" "Finally it should be mentioned that Capsules offer additional functionality, " "which is especially useful for memory allocation and deallocation of the " @@ -2259,47 +2200,89 @@ msgid "" "in the Python source code distribution)." msgstr "" -#: ../../extending/extending.rst:1414 +#: ../../extending/extending.rst:1389 msgid "Footnotes" msgstr "註腳" -#: ../../extending/extending.rst:1415 +#: ../../extending/extending.rst:1390 msgid "" -"An interface for this function already exists in the standard module :mod:" -"`os` --- it was chosen as a simple and straightforward example." +"An interface for this function already exists in the standard " +"module :mod:`os` --- it was chosen as a simple and straightforward example." msgstr "" -#: ../../extending/extending.rst:1418 +#: ../../extending/extending.rst:1393 msgid "" "The metaphor of \"borrowing\" a reference is not completely correct: the " "owner still has a copy of the reference." msgstr "" -#: ../../extending/extending.rst:1421 +#: ../../extending/extending.rst:1396 msgid "" "Checking that the reference count is at least 1 **does not work** --- the " "reference count itself could be in freed memory and may thus be reused for " "another object!" msgstr "" -#: ../../extending/extending.rst:1425 +#: ../../extending/extending.rst:1400 msgid "" "These guarantees don't hold when you use the \"old\" style calling " "convention --- this is still found in much existing code." msgstr "" -#: ../../extending/extending.rst:593 +#: ../../extending/extending.rst:568 msgid "PyObject_CallObject (C function)" msgstr "PyObject_CallObject(C 函式)" -#: ../../extending/extending.rst:684 +#: ../../extending/extending.rst:659 msgid "PyArg_ParseTuple (C function)" msgstr "PyArg_ParseTuple(C 函式)" -#: ../../extending/extending.rst:776 +#: ../../extending/extending.rst:751 msgid "PyArg_ParseTupleAndKeywords (C function)" msgstr "PyArg_ParseTupleAndKeywords(C 函式)" -#: ../../extending/extending.rst:797 +#: ../../extending/extending.rst:772 msgid "Philbrick, Geoff" msgstr "Philbrick, Geoff" + +#~ msgid "````" +#~ msgstr "````" + +#~ msgid "```` (on Windows)" +#~ msgstr "````\\ (在 Windows 上)" + +#~ msgid "````" +#~ msgstr "````" + +#~ msgid "````" +#~ msgstr "````" + +#~ msgid "````" +#~ msgstr "````" + +#~ msgid "````" +#~ msgstr "````" + +#~ msgid "````" +#~ msgstr "````" + +#~ msgid "```` (if present)" +#~ msgstr "````\\ (如果存在)" + +#~ msgid "````" +#~ msgstr "````" + +#~ msgid "```` (on POSIX)" +#~ msgstr "````\\ (在 POSIX 上)" + +#~ msgid "````" +#~ msgstr "````" + +#~ msgid "````" +#~ msgstr "````" + +#~ msgid "````" +#~ msgstr "````" + +#~ msgid "````" +#~ msgstr "````" diff --git a/extending/newtypes.po b/extending/newtypes.po index 7029e57821b..f3524b065d5 100644 --- a/extending/newtypes.po +++ b/extending/newtypes.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:34+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -93,11 +93,11 @@ msgid "" " iternextfunc tp_iternext;\n" "\n" " /* Attribute descriptor and subclassing stuff */\n" -" struct PyMethodDef *tp_methods;\n" -" struct PyMemberDef *tp_members;\n" -" struct PyGetSetDef *tp_getset;\n" +" PyMethodDef *tp_methods;\n" +" PyMemberDef *tp_members;\n" +" PyGetSetDef *tp_getset;\n" " // Strong reference on a heap type, borrowed reference on a static type\n" -" struct _typeobject *tp_base;\n" +" PyTypeObject *tp_base;\n" " PyObject *tp_dict;\n" " descrgetfunc tp_descr_get;\n" " descrsetfunc tp_descr_set;\n" @@ -109,12 +109,14 @@ msgid "" " inquiry tp_is_gc; /* For PyObject_IS_GC */\n" " PyObject *tp_bases;\n" " PyObject *tp_mro; /* method resolution order */\n" -" PyObject *tp_cache;\n" -" PyObject *tp_subclasses;\n" -" PyObject *tp_weaklist;\n" +" PyObject *tp_cache; /* no longer used */\n" +" void *tp_subclasses; /* for static builtin types this is an index */\n" +" PyObject *tp_weaklist; /* not used for static builtin types */\n" " destructor tp_del;\n" "\n" -" /* Type attribute cache version tag. Added in version 2.6 */\n" +" /* Type attribute cache version tag. Added in version 2.6.\n" +" * If zero, the cache is invalid and must be initialized.\n" +" */\n" " unsigned int tp_version_tag;\n" "\n" " destructor tp_finalize;\n" @@ -122,6 +124,13 @@ msgid "" "\n" " /* bitset of which type-watchers care about this type */\n" " unsigned char tp_watched;\n" +"\n" +" /* Number of tp_version_tag values used.\n" +" * Set to _Py_ATTR_CACHE_UNUSED if the attribute cache is\n" +" * disabled for this type (e.g. due to custom MRO entries).\n" +" * Otherwise, limited to MAX_VERSIONS_PER_CLASS (defined elsewhere).\n" +" */\n" +" uint16_t tp_versions_used;\n" "} PyTypeObject;\n" msgstr "" @@ -161,9 +170,9 @@ msgstr "" msgid "" "These fields tell the runtime how much memory to allocate when new objects " "of this type are created. Python has some built-in support for variable " -"length structures (think: strings, tuples) which is where the :c:member:" -"`~PyTypeObject.tp_itemsize` field comes in. This will be dealt with " -"later. ::" +"length structures (think: strings, tuples) which is where " +"the :c:member:`~PyTypeObject.tp_itemsize` field comes in. This will be " +"dealt with later. ::" msgstr "" #: ../../extending/newtypes.rst:44 @@ -200,12 +209,14 @@ msgid "" msgstr "" #: ../../extending/newtypes.rst:72 +#, fuzzy msgid "" "static void\n" -"newdatatype_dealloc(newdatatypeobject *obj)\n" +"newdatatype_dealloc(PyObject *op)\n" "{\n" -" free(obj->obj_UnderlyingDatatypePtr);\n" -" Py_TYPE(obj)->tp_free((PyObject *)obj);\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" free(self->obj_UnderlyingDatatypePtr);\n" +" Py_TYPE(self)->tp_free(self);\n" "}" msgstr "" "static void\n" @@ -215,21 +226,23 @@ msgstr "" " Py_TYPE(obj)->tp_free((PyObject *)obj);\n" "}" -#: ../../extending/newtypes.rst:79 +#: ../../extending/newtypes.rst:80 msgid "" -"If your type supports garbage collection, the destructor should call :c:func:" -"`PyObject_GC_UnTrack` before clearing any member fields::" +"If your type supports garbage collection, the destructor should " +"call :c:func:`PyObject_GC_UnTrack` before clearing any member fields::" msgstr "" -#: ../../extending/newtypes.rst:82 +#: ../../extending/newtypes.rst:83 +#, fuzzy msgid "" "static void\n" -"newdatatype_dealloc(newdatatypeobject *obj)\n" +"newdatatype_dealloc(PyObject *op)\n" "{\n" -" PyObject_GC_UnTrack(obj);\n" -" Py_CLEAR(obj->other_obj);\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" PyObject_GC_UnTrack(op);\n" +" Py_CLEAR(self->other_obj);\n" " ...\n" -" Py_TYPE(obj)->tp_free((PyObject *)obj);\n" +" Py_TYPE(self)->tp_free(self);\n" "}" msgstr "" "static void\n" @@ -241,7 +254,7 @@ msgstr "" " Py_TYPE(obj)->tp_free((PyObject *)obj);\n" "}" -#: ../../extending/newtypes.rst:95 +#: ../../extending/newtypes.rst:97 msgid "" "One important requirement of the deallocator function is that it leaves any " "pending exceptions alone. This is important since deallocators are " @@ -252,11 +265,11 @@ msgid "" "additional Python code to be executed may detect that an exception has been " "set. This can lead to misleading errors from the interpreter. The proper " "way to protect against this is to save a pending exception before performing " -"the unsafe action, and restoring it when done. This can be done using the :" -"c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` functions::" +"the unsafe action, and restoring it when done. This can be done using " +"the :c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` functions::" msgstr "" -#: ../../extending/newtypes.rst:107 +#: ../../extending/newtypes.rst:109 msgid "" "static void\n" "my_dealloc(PyObject *obj)\n" @@ -271,56 +284,61 @@ msgid "" " PyErr_Fetch(&err_type, &err_value, &err_traceback);\n" "\n" " cbresult = PyObject_CallNoArgs(self->my_callback);\n" -" if (cbresult == NULL)\n" -" PyErr_WriteUnraisable(self->my_callback);\n" -" else\n" +" if (cbresult == NULL) {\n" +" PyErr_WriteUnraisable(self->my_callback);\n" +" }\n" +" else {\n" " Py_DECREF(cbresult);\n" +" }\n" "\n" " /* This restores the saved exception state */\n" " PyErr_Restore(err_type, err_value, err_traceback);\n" "\n" " Py_DECREF(self->my_callback);\n" " }\n" -" Py_TYPE(obj)->tp_free((PyObject*)self);\n" +" Py_TYPE(self)->tp_free(self);\n" "}" msgstr "" -#: ../../extending/newtypes.rst:134 +#: ../../extending/newtypes.rst:138 msgid "" "There are limitations to what you can safely do in a deallocator function. " -"First, if your type supports garbage collection (using :c:member:" -"`~PyTypeObject.tp_traverse` and/or :c:member:`~PyTypeObject.tp_clear`), some " -"of the object's members can have been cleared or finalized by the time :c:" -"member:`~PyTypeObject.tp_dealloc` is called. Second, in :c:member:" -"`~PyTypeObject.tp_dealloc`, your object is in an unstable state: its " -"reference count is equal to zero. Any call to a non-trivial object or API " -"(as in the example above) might end up calling :c:member:`~PyTypeObject." -"tp_dealloc` again, causing a double free and a crash." +"First, if your type supports garbage collection " +"(using :c:member:`~PyTypeObject.tp_traverse` and/" +"or :c:member:`~PyTypeObject.tp_clear`), some of the object's members can " +"have been cleared or finalized by the " +"time :c:member:`~PyTypeObject.tp_dealloc` is called. Second, " +"in :c:member:`~PyTypeObject.tp_dealloc`, your object is in an unstable " +"state: its reference count is equal to zero. Any call to a non-trivial " +"object or API (as in the example above) might end up " +"calling :c:member:`~PyTypeObject.tp_dealloc` again, causing a double free " +"and a crash." msgstr "" -#: ../../extending/newtypes.rst:143 +#: ../../extending/newtypes.rst:147 msgid "" "Starting with Python 3.4, it is recommended not to put any complex " "finalization code in :c:member:`~PyTypeObject.tp_dealloc`, and instead use " "the new :c:member:`~PyTypeObject.tp_finalize` type method." msgstr "" -#: ../../extending/newtypes.rst:148 +#: ../../extending/newtypes.rst:152 msgid ":pep:`442` explains the new finalization scheme." msgstr "" -#: ../../extending/newtypes.rst:155 +#: ../../extending/newtypes.rst:159 msgid "Object Presentation" msgstr "" -#: ../../extending/newtypes.rst:157 +#: ../../extending/newtypes.rst:161 msgid "" "In Python, there are two ways to generate a textual representation of an " -"object: the :func:`repr` function, and the :func:`str` function. (The :func:" -"`print` function just calls :func:`str`.) These handlers are both optional." +"object: the :func:`repr` function, and the :func:`str` function. " +"(The :func:`print` function just calls :func:`str`.) These handlers are " +"both optional." msgstr "" -#: ../../extending/newtypes.rst:163 +#: ../../extending/newtypes.rst:167 msgid "" "reprfunc tp_repr;\n" "reprfunc tp_str;" @@ -328,20 +346,22 @@ msgstr "" "reprfunc tp_repr;\n" "reprfunc tp_str;" -#: ../../extending/newtypes.rst:166 +#: ../../extending/newtypes.rst:170 msgid "" "The :c:member:`~PyTypeObject.tp_repr` handler should return a string object " "containing a representation of the instance for which it is called. Here is " "a simple example::" msgstr "" -#: ../../extending/newtypes.rst:170 +#: ../../extending/newtypes.rst:174 +#, fuzzy msgid "" "static PyObject *\n" -"newdatatype_repr(newdatatypeobject *obj)\n" +"newdatatype_repr(PyObject *op)\n" "{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" " return PyUnicode_FromFormat(\"Repr-ified_newdatatype{{size:%d}}\",\n" -" obj->obj_UnderlyingDatatypePtr->size);\n" +" self->obj_UnderlyingDatatypePtr->size);\n" "}" msgstr "" "static PyObject *\n" @@ -351,35 +371,38 @@ msgstr "" " obj->obj_UnderlyingDatatypePtr->size);\n" "}" -#: ../../extending/newtypes.rst:177 +#: ../../extending/newtypes.rst:182 msgid "" "If no :c:member:`~PyTypeObject.tp_repr` handler is specified, the " -"interpreter will supply a representation that uses the type's :c:member:" -"`~PyTypeObject.tp_name` and a uniquely identifying value for the object." +"interpreter will supply a representation that uses the " +"type's :c:member:`~PyTypeObject.tp_name` and a uniquely identifying value " +"for the object." msgstr "" -#: ../../extending/newtypes.rst:181 +#: ../../extending/newtypes.rst:186 msgid "" -"The :c:member:`~PyTypeObject.tp_str` handler is to :func:`str` what the :c:" -"member:`~PyTypeObject.tp_repr` handler described above is to :func:`repr`; " -"that is, it is called when Python code calls :func:`str` on an instance of " -"your object. Its implementation is very similar to the :c:member:" -"`~PyTypeObject.tp_repr` function, but the resulting string is intended for " -"human consumption. If :c:member:`~PyTypeObject.tp_str` is not specified, " -"the :c:member:`~PyTypeObject.tp_repr` handler is used instead." +"The :c:member:`~PyTypeObject.tp_str` handler is to :func:`str` what " +"the :c:member:`~PyTypeObject.tp_repr` handler described above is " +"to :func:`repr`; that is, it is called when Python code calls :func:`str` on " +"an instance of your object. Its implementation is very similar to " +"the :c:member:`~PyTypeObject.tp_repr` function, but the resulting string is " +"intended for human consumption. If :c:member:`~PyTypeObject.tp_str` is not " +"specified, the :c:member:`~PyTypeObject.tp_repr` handler is used instead." msgstr "" -#: ../../extending/newtypes.rst:188 +#: ../../extending/newtypes.rst:193 msgid "Here is a simple example::" msgstr "以下是個簡單的範例: ::" -#: ../../extending/newtypes.rst:190 +#: ../../extending/newtypes.rst:195 +#, fuzzy msgid "" "static PyObject *\n" -"newdatatype_str(newdatatypeobject *obj)\n" +"newdatatype_str(PyObject *op)\n" "{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" " return PyUnicode_FromFormat(\"Stringified_newdatatype{{size:%d}}\",\n" -" obj->obj_UnderlyingDatatypePtr->size);\n" +" self->obj_UnderlyingDatatypePtr->size);\n" "}" msgstr "" "static PyObject *\n" @@ -389,11 +412,11 @@ msgstr "" " obj->obj_UnderlyingDatatypePtr->size);\n" "}" -#: ../../extending/newtypes.rst:200 +#: ../../extending/newtypes.rst:206 msgid "Attribute Management" msgstr "" -#: ../../extending/newtypes.rst:202 +#: ../../extending/newtypes.rst:208 msgid "" "For every object which can support attributes, the corresponding type must " "provide the functions that control how the attributes are resolved. There " @@ -403,16 +426,17 @@ msgid "" "handler is ``NULL``." msgstr "" -#: ../../extending/newtypes.rst:208 +#: ../../extending/newtypes.rst:214 msgid "" "Python supports two pairs of attribute handlers; a type that supports " "attributes only needs to implement the functions for one pair. The " -"difference is that one pair takes the name of the attribute as a :c:expr:" -"`char\\*`, while the other accepts a :c:expr:`PyObject*`. Each type can use " -"whichever pair makes more sense for the implementation's convenience. ::" +"difference is that one pair takes the name of the attribute as " +"a :c:expr:`char\\*`, while the other accepts a :c:expr:`PyObject*`. Each " +"type can use whichever pair makes more sense for the implementation's " +"convenience. ::" msgstr "" -#: ../../extending/newtypes.rst:214 +#: ../../extending/newtypes.rst:220 msgid "" "getattrfunc tp_getattr; /* char * version */\n" "setattrfunc tp_setattr;\n" @@ -426,7 +450,7 @@ msgstr "" "getattrofunc tp_getattro; /* PyObject * version */\n" "setattrofunc tp_setattro;" -#: ../../extending/newtypes.rst:220 +#: ../../extending/newtypes.rst:226 msgid "" "If accessing attributes of an object is always a simple operation (this will " "be explained shortly), there are generic implementations which can be used " @@ -437,51 +461,52 @@ msgid "" "mechanism that is available." msgstr "" -#: ../../extending/newtypes.rst:231 +#: ../../extending/newtypes.rst:237 msgid "Generic Attribute Management" msgstr "" -#: ../../extending/newtypes.rst:233 +#: ../../extending/newtypes.rst:239 msgid "" "Most extension types only use *simple* attributes. So, what makes the " "attributes simple? There are only a couple of conditions that must be met:" msgstr "" -#: ../../extending/newtypes.rst:236 +#: ../../extending/newtypes.rst:242 msgid "" "The name of the attributes must be known when :c:func:`PyType_Ready` is " "called." msgstr "" -#: ../../extending/newtypes.rst:239 +#: ../../extending/newtypes.rst:245 msgid "" "No special processing is needed to record that an attribute was looked up or " "set, nor do actions need to be taken based on the value." msgstr "" -#: ../../extending/newtypes.rst:242 +#: ../../extending/newtypes.rst:248 msgid "" "Note that this list does not place any restrictions on the values of the " "attributes, when the values are computed, or how relevant data is stored." msgstr "" -#: ../../extending/newtypes.rst:245 +#: ../../extending/newtypes.rst:251 msgid "" "When :c:func:`PyType_Ready` is called, it uses three tables referenced by " "the type object to create :term:`descriptor`\\s which are placed in the " "dictionary of the type object. Each descriptor controls access to one " "attribute of the instance object. Each of the tables is optional; if all " "three are ``NULL``, instances of the type will only have attributes that are " -"inherited from their base type, and should leave the :c:member:" -"`~PyTypeObject.tp_getattro` and :c:member:`~PyTypeObject.tp_setattro` fields " -"``NULL`` as well, allowing the base type to handle attributes." +"inherited from their base type, and should leave " +"the :c:member:`~PyTypeObject.tp_getattro` " +"and :c:member:`~PyTypeObject.tp_setattro` fields ``NULL`` as well, allowing " +"the base type to handle attributes." msgstr "" -#: ../../extending/newtypes.rst:253 +#: ../../extending/newtypes.rst:259 msgid "The tables are declared as three fields of the type object::" msgstr "" -#: ../../extending/newtypes.rst:255 +#: ../../extending/newtypes.rst:261 msgid "" "struct PyMethodDef *tp_methods;\n" "struct PyMemberDef *tp_members;\n" @@ -491,14 +516,14 @@ msgstr "" "struct PyMemberDef *tp_members;\n" "struct PyGetSetDef *tp_getset;" -#: ../../extending/newtypes.rst:259 +#: ../../extending/newtypes.rst:265 msgid "" "If :c:member:`~PyTypeObject.tp_methods` is not ``NULL``, it must refer to an " "array of :c:type:`PyMethodDef` structures. Each entry in the table is an " "instance of this structure::" msgstr "" -#: ../../extending/newtypes.rst:263 +#: ../../extending/newtypes.rst:269 msgid "" "typedef struct PyMethodDef {\n" " const char *ml_name; /* method name */\n" @@ -508,15 +533,15 @@ msgid "" "} PyMethodDef;" msgstr "" -#: ../../extending/newtypes.rst:270 +#: ../../extending/newtypes.rst:276 msgid "" "One entry should be defined for each method provided by the type; no entries " "are needed for methods inherited from a base type. One additional entry is " -"needed at the end; it is a sentinel that marks the end of the array. The :c:" -"member:`~PyMethodDef.ml_name` field of the sentinel must be ``NULL``." +"needed at the end; it is a sentinel that marks the end of the array. " +"The :c:member:`~PyMethodDef.ml_name` field of the sentinel must be ``NULL``." msgstr "" -#: ../../extending/newtypes.rst:275 +#: ../../extending/newtypes.rst:281 msgid "" "The second table is used to define attributes which map directly to data " "stored in the instance. A variety of primitive C types are supported, and " @@ -524,7 +549,7 @@ msgid "" "defined as::" msgstr "" -#: ../../extending/newtypes.rst:279 +#: ../../extending/newtypes.rst:285 msgid "" "typedef struct PyMemberDef {\n" " const char *name;\n" @@ -542,114 +567,115 @@ msgstr "" " const char *doc;\n" "} PyMemberDef;" -#: ../../extending/newtypes.rst:287 +#: ../../extending/newtypes.rst:293 msgid "" "For each entry in the table, a :term:`descriptor` will be constructed and " "added to the type which will be able to extract a value from the instance " "structure. The :c:member:`~PyMemberDef.type` field should contain a type " "code like :c:macro:`Py_T_INT` or :c:macro:`Py_T_DOUBLE`; the value will be " -"used to determine how to convert Python values to and from C values. The :c:" -"member:`~PyMemberDef.flags` field is used to store flags which control how " -"the attribute can be accessed: you can set it to :c:macro:`Py_READONLY` to " -"prevent Python code from setting it." +"used to determine how to convert Python values to and from C values. " +"The :c:member:`~PyMemberDef.flags` field is used to store flags which " +"control how the attribute can be accessed: you can set it " +"to :c:macro:`Py_READONLY` to prevent Python code from setting it." msgstr "" -#: ../../extending/newtypes.rst:295 +#: ../../extending/newtypes.rst:301 msgid "" "An interesting advantage of using the :c:member:`~PyTypeObject.tp_members` " "table to build descriptors that are used at runtime is that any attribute " "defined this way can have an associated doc string simply by providing the " "text in the table. An application can use the introspection API to retrieve " -"the descriptor from the class object, and get the doc string using its :attr:" -"`~type.__doc__` attribute." +"the descriptor from the class object, and get the doc string using " +"its :attr:`~type.__doc__` attribute." msgstr "" -#: ../../extending/newtypes.rst:301 +#: ../../extending/newtypes.rst:307 msgid "" "As with the :c:member:`~PyTypeObject.tp_methods` table, a sentinel entry " "with a :c:member:`~PyMethodDef.ml_name` value of ``NULL`` is required." msgstr "" -#: ../../extending/newtypes.rst:315 +#: ../../extending/newtypes.rst:321 msgid "Type-specific Attribute Management" msgstr "" -#: ../../extending/newtypes.rst:317 +#: ../../extending/newtypes.rst:323 msgid "" "For simplicity, only the :c:expr:`char\\*` version will be demonstrated " -"here; the type of the name parameter is the only difference between the :c:" -"expr:`char\\*` and :c:expr:`PyObject*` flavors of the interface. This " +"here; the type of the name parameter is the only difference between " +"the :c:expr:`char\\*` and :c:expr:`PyObject*` flavors of the interface. This " "example effectively does the same thing as the generic example above, but " "does not use the generic support added in Python 2.2. It explains how the " "handler functions are called, so that if you do need to extend their " "functionality, you'll understand what needs to be done." msgstr "" -#: ../../extending/newtypes.rst:325 +#: ../../extending/newtypes.rst:331 msgid "" "The :c:member:`~PyTypeObject.tp_getattr` handler is called when the object " "requires an attribute look-up. It is called in the same situations where " "the :meth:`~object.__getattr__` method of a class would be called." msgstr "" -#: ../../extending/newtypes.rst:329 +#: ../../extending/newtypes.rst:335 msgid "Here is an example::" msgstr "舉例來說: ::" -#: ../../extending/newtypes.rst:331 +#: ../../extending/newtypes.rst:337 msgid "" "static PyObject *\n" -"newdatatype_getattr(newdatatypeobject *obj, char *name)\n" +"newdatatype_getattr(PyObject *op, char *name)\n" "{\n" -" if (strcmp(name, \"data\") == 0)\n" -" {\n" -" return PyLong_FromLong(obj->data);\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" if (strcmp(name, \"data\") == 0) {\n" +" return PyLong_FromLong(self->data);\n" " }\n" "\n" " PyErr_Format(PyExc_AttributeError,\n" " \"'%.100s' object has no attribute '%.400s'\",\n" -" Py_TYPE(obj)->tp_name, name);\n" +" Py_TYPE(self)->tp_name, name);\n" " return NULL;\n" "}" msgstr "" -#: ../../extending/newtypes.rst:345 +#: ../../extending/newtypes.rst:351 msgid "" -"The :c:member:`~PyTypeObject.tp_setattr` handler is called when the :meth:" -"`~object.__setattr__` or :meth:`~object.__delattr__` method of a class " -"instance would be called. When an attribute should be deleted, the third " -"parameter will be ``NULL``. Here is an example that simply raises an " -"exception; if this were really all you wanted, the :c:member:`~PyTypeObject." -"tp_setattr` handler should be set to ``NULL``. ::" +"The :c:member:`~PyTypeObject.tp_setattr` handler is called when " +"the :meth:`~object.__setattr__` or :meth:`~object.__delattr__` method of a " +"class instance would be called. When an attribute should be deleted, the " +"third parameter will be ``NULL``. Here is an example that simply raises an " +"exception; if this were really all you wanted, " +"the :c:member:`~PyTypeObject.tp_setattr` handler should be set to " +"``NULL``. ::" msgstr "" -#: ../../extending/newtypes.rst:351 +#: ../../extending/newtypes.rst:357 msgid "" "static int\n" -"newdatatype_setattr(newdatatypeobject *obj, char *name, PyObject *v)\n" +"newdatatype_setattr(PyObject *op, char *name, PyObject *v)\n" "{\n" " PyErr_Format(PyExc_RuntimeError, \"Read-only attribute: %s\", name);\n" " return -1;\n" "}" msgstr "" -#: ../../extending/newtypes.rst:359 +#: ../../extending/newtypes.rst:365 msgid "Object Comparison" msgstr "" -#: ../../extending/newtypes.rst:363 +#: ../../extending/newtypes.rst:369 msgid "richcmpfunc tp_richcompare;" msgstr "richcmpfunc tp_richcompare;" -#: ../../extending/newtypes.rst:365 +#: ../../extending/newtypes.rst:371 msgid "" "The :c:member:`~PyTypeObject.tp_richcompare` handler is called when " "comparisons are needed. It is analogous to the :ref:`rich comparison " -"methods `, like :meth:`!__lt__`, and also called by :c:func:" -"`PyObject_RichCompare` and :c:func:`PyObject_RichCompareBool`." +"methods `, like :meth:`!__lt__`, and also called " +"by :c:func:`PyObject_RichCompare` and :c:func:`PyObject_RichCompareBool`." msgstr "" -#: ../../extending/newtypes.rst:370 +#: ../../extending/newtypes.rst:376 msgid "" "This function is called with two Python objects and the operator as " "arguments, where the operator is one of ``Py_EQ``, ``Py_NE``, ``Py_LE``, " @@ -660,18 +686,19 @@ msgid "" "should be tried, or ``NULL`` if an exception was set." msgstr "" -#: ../../extending/newtypes.rst:378 +#: ../../extending/newtypes.rst:384 msgid "" "Here is a sample implementation, for a datatype that is considered equal if " "the size of an internal pointer is equal::" msgstr "" -#: ../../extending/newtypes.rst:381 +#: ../../extending/newtypes.rst:387 msgid "" "static PyObject *\n" -"newdatatype_richcmp(newdatatypeobject *obj1, newdatatypeobject *obj2, int " -"op)\n" +"newdatatype_richcmp(PyObject *lhs, PyObject *rhs, int op)\n" "{\n" +" newdatatypeobject *obj1 = (newdatatypeobject *) lhs;\n" +" newdatatypeobject *obj2 = (newdatatypeobject *) rhs;\n" " PyObject *result;\n" " int c, size1, size2;\n" "\n" @@ -690,22 +717,21 @@ msgid "" " case Py_GE: c = size1 >= size2; break;\n" " }\n" " result = c ? Py_True : Py_False;\n" -" Py_INCREF(result);\n" -" return result;\n" +" return Py_NewRef(result);\n" " }" msgstr "" -#: ../../extending/newtypes.rst:408 +#: ../../extending/newtypes.rst:415 msgid "Abstract Protocol Support" msgstr "" -#: ../../extending/newtypes.rst:410 +#: ../../extending/newtypes.rst:417 msgid "" "Python supports a variety of *abstract* 'protocols;' the specific interfaces " "provided to use these interfaces are documented in :ref:`abstract`." msgstr "" -#: ../../extending/newtypes.rst:414 +#: ../../extending/newtypes.rst:421 msgid "" "A number of these abstract interfaces were defined early in the development " "of the Python implementation. In particular, the number, mapping, and " @@ -720,7 +746,7 @@ msgid "" "slot, but a slot may still be unfilled.) ::" msgstr "" -#: ../../extending/newtypes.rst:425 +#: ../../extending/newtypes.rst:432 msgid "" "PyNumberMethods *tp_as_number;\n" "PySequenceMethods *tp_as_sequence;\n" @@ -730,36 +756,39 @@ msgstr "" "PySequenceMethods *tp_as_sequence;\n" "PyMappingMethods *tp_as_mapping;" -#: ../../extending/newtypes.rst:429 +#: ../../extending/newtypes.rst:436 msgid "" "If you wish your object to be able to act like a number, a sequence, or a " "mapping object, then you place the address of a structure that implements " -"the C type :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, or :c:" -"type:`PyMappingMethods`, respectively. It is up to you to fill in this " +"the C type :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, " +"or :c:type:`PyMappingMethods`, respectively. It is up to you to fill in this " "structure with appropriate values. You can find examples of the use of each " "of these in the :file:`Objects` directory of the Python source " "distribution. ::" msgstr "" -#: ../../extending/newtypes.rst:436 +#: ../../extending/newtypes.rst:443 msgid "hashfunc tp_hash;" msgstr "hashfunc tp_hash;" -#: ../../extending/newtypes.rst:438 +#: ../../extending/newtypes.rst:445 msgid "" "This function, if you choose to provide it, should return a hash number for " "an instance of your data type. Here is a simple example::" msgstr "" -#: ../../extending/newtypes.rst:441 +#: ../../extending/newtypes.rst:448 +#, fuzzy msgid "" "static Py_hash_t\n" -"newdatatype_hash(newdatatypeobject *obj)\n" +"newdatatype_hash(PyObject *op)\n" "{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" " Py_hash_t result;\n" -" result = obj->some_size + 32767 * obj->some_number;\n" -" if (result == -1)\n" -" result = -2;\n" +" result = self->some_size + 32767 * self->some_number;\n" +" if (result == -1) {\n" +" result = -2;\n" +" }\n" " return result;\n" "}" msgstr "" @@ -773,7 +802,7 @@ msgstr "" " return result;\n" "}" -#: ../../extending/newtypes.rst:451 +#: ../../extending/newtypes.rst:460 msgid "" ":c:type:`Py_hash_t` is a signed integer type with a platform-varying width. " "Returning ``-1`` from :c:member:`~PyTypeObject.tp_hash` indicates an error, " @@ -781,11 +810,11 @@ msgid "" "computation is successful, as seen above." msgstr "" -#: ../../extending/newtypes.rst:458 +#: ../../extending/newtypes.rst:467 msgid "ternaryfunc tp_call;" msgstr "ternaryfunc tp_call;" -#: ../../extending/newtypes.rst:460 +#: ../../extending/newtypes.rst:469 msgid "" "This function is called when an instance of your data type is \"called\", " "for example, if ``obj1`` is an instance of your data type and the Python " @@ -793,40 +822,43 @@ msgid "" "handler is invoked." msgstr "" -#: ../../extending/newtypes.rst:464 +#: ../../extending/newtypes.rst:473 msgid "This function takes three arguments:" msgstr "" -#: ../../extending/newtypes.rst:466 +#: ../../extending/newtypes.rst:475 msgid "" "*self* is the instance of the data type which is the subject of the call. If " "the call is ``obj1('hello')``, then *self* is ``obj1``." msgstr "" -#: ../../extending/newtypes.rst:469 +#: ../../extending/newtypes.rst:478 msgid "" -"*args* is a tuple containing the arguments to the call. You can use :c:func:" -"`PyArg_ParseTuple` to extract the arguments." +"*args* is a tuple containing the arguments to the call. You can " +"use :c:func:`PyArg_ParseTuple` to extract the arguments." msgstr "" -#: ../../extending/newtypes.rst:472 +#: ../../extending/newtypes.rst:481 msgid "" "*kwds* is a dictionary of keyword arguments that were passed. If this is non-" -"``NULL`` and you support keyword arguments, use :c:func:" -"`PyArg_ParseTupleAndKeywords` to extract the arguments. If you do not want " -"to support keyword arguments and this is non-``NULL``, raise a :exc:" -"`TypeError` with a message saying that keyword arguments are not supported." +"``NULL`` and you support keyword arguments, " +"use :c:func:`PyArg_ParseTupleAndKeywords` to extract the arguments. If you " +"do not want to support keyword arguments and this is non-``NULL``, raise " +"a :exc:`TypeError` with a message saying that keyword arguments are not " +"supported." msgstr "" -#: ../../extending/newtypes.rst:478 +#: ../../extending/newtypes.rst:487 msgid "Here is a toy ``tp_call`` implementation::" msgstr "" -#: ../../extending/newtypes.rst:480 +#: ../../extending/newtypes.rst:489 +#, fuzzy msgid "" "static PyObject *\n" -"newdatatype_call(newdatatypeobject *obj, PyObject *args, PyObject *kwds)\n" +"newdatatype_call(PyObject *op, PyObject *args, PyObject *kwds)\n" "{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" " PyObject *result;\n" " const char *arg1;\n" " const char *arg2;\n" @@ -837,7 +869,7 @@ msgid "" " }\n" " result = PyUnicode_FromFormat(\n" " \"Returning -- value: [%d] arg1: [%s] arg2: [%s] arg3: [%s]\\n\",\n" -" obj->obj_UnderlyingDatatypePtr->size,\n" +" self->obj_UnderlyingDatatypePtr->size,\n" " arg1, arg2, arg3);\n" " return result;\n" "}" @@ -860,7 +892,7 @@ msgstr "" " return result;\n" "}" -#: ../../extending/newtypes.rst:500 +#: ../../extending/newtypes.rst:510 msgid "" "/* Iterators */\n" "getiterfunc tp_iter;\n" @@ -870,70 +902,74 @@ msgstr "" "getiterfunc tp_iter;\n" "iternextfunc tp_iternext;" -#: ../../extending/newtypes.rst:504 +#: ../../extending/newtypes.rst:514 msgid "" "These functions provide support for the iterator protocol. Both handlers " "take exactly one parameter, the instance for which they are being called, " "and return a new reference. In the case of an error, they should set an " "exception and return ``NULL``. :c:member:`~PyTypeObject.tp_iter` " -"corresponds to the Python :meth:`~object.__iter__` method, while :c:member:" -"`~PyTypeObject.tp_iternext` corresponds to the Python :meth:`~iterator." -"__next__` method." +"corresponds to the Python :meth:`~object.__iter__` method, " +"while :c:member:`~PyTypeObject.tp_iternext` corresponds to the " +"Python :meth:`~iterator.__next__` method." msgstr "" -#: ../../extending/newtypes.rst:511 +#: ../../extending/newtypes.rst:521 msgid "" -"Any :term:`iterable` object must implement the :c:member:`~PyTypeObject." -"tp_iter` handler, which must return an :term:`iterator` object. Here the " -"same guidelines apply as for Python classes:" +"Any :term:`iterable` object must implement " +"the :c:member:`~PyTypeObject.tp_iter` handler, which must return " +"an :term:`iterator` object. Here the same guidelines apply as for Python " +"classes:" msgstr "" -#: ../../extending/newtypes.rst:515 +#: ../../extending/newtypes.rst:525 msgid "" "For collections (such as lists and tuples) which can support multiple " "independent iterators, a new iterator should be created and returned by each " "call to :c:member:`~PyTypeObject.tp_iter`." msgstr "" -#: ../../extending/newtypes.rst:518 +#: ../../extending/newtypes.rst:528 msgid "" "Objects which can only be iterated over once (usually due to side effects of " -"iteration, such as file objects) can implement :c:member:`~PyTypeObject." -"tp_iter` by returning a new reference to themselves -- and should also " -"therefore implement the :c:member:`~PyTypeObject.tp_iternext` handler." -msgstr "" - -#: ../../extending/newtypes.rst:523 -msgid "" -"Any :term:`iterator` object should implement both :c:member:`~PyTypeObject." -"tp_iter` and :c:member:`~PyTypeObject.tp_iternext`. An iterator's :c:member:" -"`~PyTypeObject.tp_iter` handler should return a new reference to the " -"iterator. Its :c:member:`~PyTypeObject.tp_iternext` handler should return a " -"new reference to the next object in the iteration, if there is one. If the " -"iteration has reached the end, :c:member:`~PyTypeObject.tp_iternext` may " -"return ``NULL`` without setting an exception, or it may set :exc:" -"`StopIteration` *in addition* to returning ``NULL``; avoiding the exception " -"can yield slightly better performance. If an actual error occurs, :c:member:" -"`~PyTypeObject.tp_iternext` should always set an exception and return " -"``NULL``." -msgstr "" - -#: ../../extending/newtypes.rst:539 +"iteration, such as file objects) can " +"implement :c:member:`~PyTypeObject.tp_iter` by returning a new reference to " +"themselves -- and should also therefore implement " +"the :c:member:`~PyTypeObject.tp_iternext` handler." +msgstr "" + +#: ../../extending/newtypes.rst:533 +msgid "" +"Any :term:`iterator` object should implement " +"both :c:member:`~PyTypeObject.tp_iter` " +"and :c:member:`~PyTypeObject.tp_iternext`. An " +"iterator's :c:member:`~PyTypeObject.tp_iter` handler should return a new " +"reference to the iterator. Its :c:member:`~PyTypeObject.tp_iternext` " +"handler should return a new reference to the next object in the iteration, " +"if there is one. If the iteration has reached the " +"end, :c:member:`~PyTypeObject.tp_iternext` may return ``NULL`` without " +"setting an exception, or it may set :exc:`StopIteration` *in addition* to " +"returning ``NULL``; avoiding the exception can yield slightly better " +"performance. If an actual error " +"occurs, :c:member:`~PyTypeObject.tp_iternext` should always set an exception " +"and return ``NULL``." +msgstr "" + +#: ../../extending/newtypes.rst:549 msgid "Weak Reference Support" msgstr "" -#: ../../extending/newtypes.rst:541 +#: ../../extending/newtypes.rst:551 msgid "" "One of the goals of Python's weak reference implementation is to allow any " "type to participate in the weak reference mechanism without incurring the " "overhead on performance-critical objects (such as numbers)." msgstr "" -#: ../../extending/newtypes.rst:546 +#: ../../extending/newtypes.rst:556 msgid "Documentation for the :mod:`weakref` module." msgstr "" -#: ../../extending/newtypes.rst:548 +#: ../../extending/newtypes.rst:558 msgid "" "For an object to be weakly referenceable, the extension type must set the " "``Py_TPFLAGS_MANAGED_WEAKREF`` bit of the :c:member:`~PyTypeObject.tp_flags` " @@ -941,12 +977,12 @@ msgid "" "be left as zero." msgstr "" -#: ../../extending/newtypes.rst:553 +#: ../../extending/newtypes.rst:563 msgid "" "Concretely, here is how the statically declared type object would look::" msgstr "" -#: ../../extending/newtypes.rst:555 +#: ../../extending/newtypes.rst:565 msgid "" "static PyTypeObject TrivialType = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -955,29 +991,29 @@ msgid "" "};" msgstr "" -#: ../../extending/newtypes.rst:562 +#: ../../extending/newtypes.rst:572 msgid "" "The only further addition is that ``tp_dealloc`` needs to clear any weak " "references (by calling :c:func:`PyObject_ClearWeakRefs`)::" msgstr "" -#: ../../extending/newtypes.rst:565 +#: ../../extending/newtypes.rst:575 msgid "" "static void\n" -"Trivial_dealloc(TrivialObject *self)\n" +"Trivial_dealloc(PyObject *op)\n" "{\n" " /* Clear weakrefs first before calling any destructors */\n" -" PyObject_ClearWeakRefs((PyObject *) self);\n" +" PyObject_ClearWeakRefs(op);\n" " /* ... remainder of destruction code omitted for brevity ... */\n" -" Py_TYPE(self)->tp_free((PyObject *) self);\n" +" Py_TYPE(op)->tp_free(op);\n" "}" msgstr "" -#: ../../extending/newtypes.rst:576 +#: ../../extending/newtypes.rst:586 msgid "More Suggestions" msgstr "" -#: ../../extending/newtypes.rst:578 +#: ../../extending/newtypes.rst:588 msgid "" "In order to learn how to implement any specific method for your new data " "type, get the :term:`CPython` source code. Go to the :file:`Objects` " @@ -986,14 +1022,14 @@ msgid "" "function you want to implement." msgstr "" -#: ../../extending/newtypes.rst:584 +#: ../../extending/newtypes.rst:594 msgid "" "When you need to verify that an object is a concrete instance of the type " "you are implementing, use the :c:func:`PyObject_TypeCheck` function. A " "sample of its use might be something like the following::" msgstr "" -#: ../../extending/newtypes.rst:588 +#: ../../extending/newtypes.rst:598 msgid "" "if (!PyObject_TypeCheck(some_object, &MyType)) {\n" " PyErr_SetString(PyExc_TypeError, \"arg #1 not a mything\");\n" @@ -1001,20 +1037,20 @@ msgid "" "}" msgstr "" -#: ../../extending/newtypes.rst:594 +#: ../../extending/newtypes.rst:604 msgid "Download CPython source releases." msgstr "" -#: ../../extending/newtypes.rst:595 +#: ../../extending/newtypes.rst:605 msgid "https://www.python.org/downloads/source/" msgstr "https://www.python.org/downloads/source/" -#: ../../extending/newtypes.rst:597 +#: ../../extending/newtypes.rst:607 msgid "" "The CPython project on GitHub, where the CPython source code is developed." msgstr "" -#: ../../extending/newtypes.rst:598 +#: ../../extending/newtypes.rst:608 msgid "https://github.com/python/cpython" msgstr "https://github.com/python/cpython" @@ -1038,26 +1074,26 @@ msgstr "" msgid "finalization, of objects" msgstr "" -#: ../../extending/newtypes.rst:91 +#: ../../extending/newtypes.rst:93 msgid "PyErr_Fetch (C function)" msgstr "PyErr_Fetch(C 函式)" -#: ../../extending/newtypes.rst:91 +#: ../../extending/newtypes.rst:93 msgid "PyErr_Restore (C function)" msgstr "PyErr_Restore(C 函式)" -#: ../../extending/newtypes.rst:150 +#: ../../extending/newtypes.rst:154 msgid "string" msgstr "string(字串)" -#: ../../extending/newtypes.rst:150 +#: ../../extending/newtypes.rst:154 msgid "object representation" msgstr "object representation(物件表示)" -#: ../../extending/newtypes.rst:150 +#: ../../extending/newtypes.rst:154 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../extending/newtypes.rst:150 +#: ../../extending/newtypes.rst:154 msgid "repr" msgstr "repr" diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index 4f6a0caec2f..cf1a681eaaa 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -4,7 +4,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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -33,14 +33,14 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:26 msgid "" -"The :term:`CPython` runtime sees all Python objects as variables of type :c:" -"expr:`PyObject*`, which serves as a \"base type\" for all Python objects. " -"The :c:type:`PyObject` structure itself only contains the object's :term:" -"`reference count` and a pointer to the object's \"type object\". This is " -"where the action is; the type object determines which (C) functions get " -"called by the interpreter when, for instance, an attribute gets looked up on " -"an object, a method called, or it is multiplied by another object. These C " -"functions are called \"type methods\"." +"The :term:`CPython` runtime sees all Python objects as variables of " +"type :c:expr:`PyObject*`, which serves as a \"base type\" for all Python " +"objects. The :c:type:`PyObject` structure itself only contains the " +"object's :term:`reference count` and a pointer to the object's \"type " +"object\". This is where the action is; the type object determines which (C) " +"functions get called by the interpreter when, for instance, an attribute " +"gets looked up on an object, a method called, or it is multiplied by another " +"object. These C functions are called \"type methods\"." msgstr "" #: ../../extending/newtypes_tutorial.rst:35 @@ -60,8 +60,8 @@ msgstr "" msgid "" "What we're showing here is the traditional way of defining *static* " "extension types. It should be adequate for most uses. The C API also " -"allows defining heap-allocated extension types using the :c:func:" -"`PyType_FromSpec` function, which isn't covered in this tutorial." +"allows defining heap-allocated extension types using " +"the :c:func:`PyType_FromSpec` function, which isn't covered in this tutorial." msgstr "" #: ../../extending/newtypes_tutorial.rst:48 @@ -276,9 +276,10 @@ msgstr "" msgid "" "Note that the name is a dotted name that includes both the module name and " "the name of the type within the module. The module in this case is :mod:`!" -"custom` and the type is :class:`!Custom`, so we set the type name to :class:" -"`!custom.Custom`. Using the real dotted import path is important to make " -"your type compatible with the :mod:`pydoc` and :mod:`pickle` modules. ::" +"custom` and the type is :class:`!Custom`, so we set the type name " +"to :class:`!custom.Custom`. Using the real dotted import path is important " +"to make your type compatible with the :mod:`pydoc` and :mod:`pickle` " +"modules. ::" msgstr "" #: ../../extending/newtypes_tutorial.rst:137 @@ -291,9 +292,9 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:140 msgid "" -"This is so that Python knows how much memory to allocate when creating new :" -"class:`!Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is only " -"used for variable-sized objects and should otherwise be zero." +"This is so that Python knows how much memory to allocate when creating " +"new :class:`!Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is " +"only used for variable-sized objects and should otherwise be zero." msgstr "" #: ../../extending/newtypes_tutorial.rst:146 @@ -336,11 +337,11 @@ msgstr ".tp_doc = PyDoc_STR(\"Custom objects\")," #: ../../extending/newtypes_tutorial.rst:168 msgid "" -"To enable object creation, we have to provide a :c:member:`~PyTypeObject." -"tp_new` handler. This is the equivalent of the Python method :meth:`~object." -"__new__`, but has to be specified explicitly. In this case, we can just use " -"the default implementation provided by the API function :c:func:" -"`PyType_GenericNew`. ::" +"To enable object creation, we have to provide " +"a :c:member:`~PyTypeObject.tp_new` handler. This is the equivalent of the " +"Python method :meth:`~object.__new__`, but has to be specified explicitly. " +"In this case, we can just use the default implementation provided by the API " +"function :c:func:`PyType_GenericNew`. ::" msgstr "" #: ../../extending/newtypes_tutorial.rst:173 @@ -349,8 +350,8 @@ msgstr ".tp_new = PyType_GenericNew," #: ../../extending/newtypes_tutorial.rst:175 msgid "" -"Everything else in the file should be familiar, except for some code in :c:" -"func:`!custom_module_exec`::" +"Everything else in the file should be familiar, except for some code " +"in :c:func:`!custom_module_exec`::" msgstr "" #: ../../extending/newtypes_tutorial.rst:178 @@ -382,8 +383,8 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:190 msgid "" -"This adds the type to the module dictionary. This allows us to create :" -"class:`!Custom` instances by calling the :class:`!Custom` class:" +"This adds the type to the module dictionary. This allows us to " +"create :class:`!Custom` instances by calling the :class:`!Custom` class:" msgstr "" #: ../../extending/newtypes_tutorial.rst:193 @@ -435,7 +436,7 @@ msgid "in a file called :file:`setup.py`; then typing" msgstr "" #: ../../extending/newtypes_tutorial.rst:212 -#: ../../extending/newtypes_tutorial.rst:527 +#: ../../extending/newtypes_tutorial.rst:550 msgid "$ python -m pip install ." msgstr "$ python -m pip install ." @@ -481,11 +482,12 @@ msgid "" "} CustomObject;\n" "\n" "static void\n" -"Custom_dealloc(CustomObject *self)\n" +"Custom_dealloc(PyObject *op)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " Py_XDECREF(self->first);\n" " Py_XDECREF(self->last);\n" -" Py_TYPE(self)->tp_free((PyObject *) self);\n" +" Py_TYPE(self)->tp_free(self);\n" "}\n" "\n" "static PyObject *\n" @@ -494,12 +496,12 @@ msgid "" " CustomObject *self;\n" " self = (CustomObject *) type->tp_alloc(type, 0);\n" " if (self != NULL) {\n" -" self->first = PyUnicode_FromString(\"\");\n" +" self->first = Py_GetConstant(Py_CONSTANT_EMPTY_STR);\n" " if (self->first == NULL) {\n" " Py_DECREF(self);\n" " return NULL;\n" " }\n" -" self->last = PyUnicode_FromString(\"\");\n" +" self->last = Py_GetConstant(Py_CONSTANT_EMPTY_STR);\n" " if (self->last == NULL) {\n" " Py_DECREF(self);\n" " return NULL;\n" @@ -510,8 +512,9 @@ msgid "" "}\n" "\n" "static int\n" -"Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" " PyObject *first = NULL, *last = NULL;\n" "\n" @@ -540,8 +543,9 @@ msgid "" "};\n" "\n" "static PyObject *\n" -"Custom_name(CustomObject *self, PyObject *Py_UNUSED(ignored))\n" +"Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " if (self->first == NULL) {\n" " PyErr_SetString(PyExc_AttributeError, \"first\");\n" " return NULL;\n" @@ -554,7 +558,7 @@ msgid "" "}\n" "\n" "static PyMethodDef Custom_methods[] = {\n" -" {\"name\", (PyCFunction) Custom_name, METH_NOARGS,\n" +" {\"name\", Custom_name, METH_NOARGS,\n" " \"Return the name, combining the first and last name\"\n" " },\n" " {NULL} /* Sentinel */\n" @@ -568,8 +572,8 @@ msgid "" " .tp_itemsize = 0,\n" " .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,\n" " .tp_new = Custom_new,\n" -" .tp_init = (initproc) Custom_init,\n" -" .tp_dealloc = (destructor) Custom_dealloc,\n" +" .tp_init = Custom_init,\n" +" .tp_dealloc = Custom_dealloc,\n" " .tp_members = Custom_members,\n" " .tp_methods = Custom_methods,\n" "};\n" @@ -650,13 +654,15 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:254 +#, fuzzy msgid "" "static void\n" -"Custom_dealloc(CustomObject *self)\n" +"Custom_dealloc(PyObject *op)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " Py_XDECREF(self->first);\n" " Py_XDECREF(self->last);\n" -" Py_TYPE(self)->tp_free((PyObject *) self);\n" +" Py_TYPE(self)->tp_free(self);\n" "}" msgstr "" "static void\n" @@ -667,41 +673,76 @@ msgstr "" " Py_TYPE(self)->tp_free((PyObject *) self);\n" "}" -#: ../../extending/newtypes_tutorial.rst:262 +#: ../../extending/newtypes_tutorial.rst:263 msgid "which is assigned to the :c:member:`~PyTypeObject.tp_dealloc` member::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:264 -msgid ".tp_dealloc = (destructor) Custom_dealloc," +#: ../../extending/newtypes_tutorial.rst:265 +#, fuzzy +msgid ".tp_dealloc = Custom_dealloc," msgstr ".tp_dealloc = (destructor) Custom_dealloc," -#: ../../extending/newtypes_tutorial.rst:266 +#: ../../extending/newtypes_tutorial.rst:267 +msgid "" +"This method first clears the reference counts of the two Python " +"attributes. :c:func:`Py_XDECREF` correctly handles the case where its " +"argument is ``NULL`` (which might happen here if ``tp_new`` failed midway). " +"It then calls the :c:member:`~PyTypeObject.tp_free` member of the object's " +"type (computed by ``Py_TYPE(self)``) to free the object's memory. Note that " +"the object's type might not be :class:`!CustomType`, because the object may " +"be an instance of a subclass." +msgstr "" + +#: ../../extending/newtypes_tutorial.rst:277 msgid "" -"This method first clears the reference counts of the two Python attributes. :" -"c:func:`Py_XDECREF` correctly handles the case where its argument is " -"``NULL`` (which might happen here if ``tp_new`` failed midway). It then " -"calls the :c:member:`~PyTypeObject.tp_free` member of the object's type " -"(computed by ``Py_TYPE(self)``) to free the object's memory. Note that the " -"object's type might not be :class:`!CustomType`, because the object may be " -"an instance of a subclass." +"The explicit cast to ``CustomObject *`` above is needed because we defined " +"``Custom_dealloc`` to take a ``PyObject *`` argument, as the ``tp_dealloc`` " +"function pointer expects to receive a ``PyObject *`` argument. By assigning " +"to the ``tp_dealloc`` slot of a type, we declare that it can only be called " +"with instances of our ``CustomObject`` class, so the cast to ``(CustomObject " +"*)`` is safe. This is object-oriented polymorphism, in C!" msgstr "" -#: ../../extending/newtypes_tutorial.rst:275 +#: ../../extending/newtypes_tutorial.rst:285 msgid "" -"The explicit cast to ``destructor`` above is needed because we defined " -"``Custom_dealloc`` to take a ``CustomObject *`` argument, but the " -"``tp_dealloc`` function pointer expects to receive a ``PyObject *`` " -"argument. Otherwise, the compiler will emit a warning. This is object-" -"oriented polymorphism, in C!" +"In existing code, or in previous versions of this tutorial, you might see " +"similar functions take a pointer to the subtype object structure " +"(``CustomObject*``) directly, like this::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:281 +#: ../../extending/newtypes_tutorial.rst:289 +#, fuzzy +msgid "" +"Custom_dealloc(CustomObject *self)\n" +"{\n" +" Py_XDECREF(self->first);\n" +" Py_XDECREF(self->last);\n" +" Py_TYPE(self)->tp_free((PyObject *) self);\n" +"}\n" +"...\n" +".tp_dealloc = (destructor) Custom_dealloc," +msgstr "" +"static void\n" +"Custom_dealloc(CustomObject *self)\n" +"{\n" +" Py_XDECREF(self->first);\n" +" Py_XDECREF(self->last);\n" +" Py_TYPE(self)->tp_free((PyObject *) self);\n" +"}" + +#: ../../extending/newtypes_tutorial.rst:298 +msgid "" +"This does the same thing on all architectures that CPython supports, but " +"according to the C standard, it invokes undefined behavior." +msgstr "" + +#: ../../extending/newtypes_tutorial.rst:302 msgid "" "We want to make sure that the first and last names are initialized to empty " "strings, so we provide a ``tp_new`` implementation::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:284 +#: ../../extending/newtypes_tutorial.rst:305 msgid "" "static PyObject *\n" "Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n" @@ -745,58 +786,60 @@ msgstr "" " return (PyObject *) self;\n" "}" -#: ../../extending/newtypes_tutorial.rst:305 +#: ../../extending/newtypes_tutorial.rst:326 msgid "and install it in the :c:member:`~PyTypeObject.tp_new` member::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:307 +#: ../../extending/newtypes_tutorial.rst:328 msgid ".tp_new = Custom_new," msgstr ".tp_new = Custom_new," -#: ../../extending/newtypes_tutorial.rst:309 +#: ../../extending/newtypes_tutorial.rst:330 msgid "" "The ``tp_new`` handler is responsible for creating (as opposed to " -"initializing) objects of the type. It is exposed in Python as the :meth:" -"`~object.__new__` method. It is not required to define a ``tp_new`` member, " -"and indeed many extension types will simply reuse :c:func:" -"`PyType_GenericNew` as done in the first version of the :class:`!Custom` " -"type above. In this case, we use the ``tp_new`` handler to initialize the " -"``first`` and ``last`` attributes to non-``NULL`` default values." +"initializing) objects of the type. It is exposed in Python as " +"the :meth:`~object.__new__` method. It is not required to define a " +"``tp_new`` member, and indeed many extension types will simply " +"reuse :c:func:`PyType_GenericNew` as done in the first version of " +"the :class:`!Custom` type above. In this case, we use the ``tp_new`` " +"handler to initialize the ``first`` and ``last`` attributes to non-``NULL`` " +"default values." msgstr "" -#: ../../extending/newtypes_tutorial.rst:317 +#: ../../extending/newtypes_tutorial.rst:338 msgid "" "``tp_new`` is passed the type being instantiated (not necessarily " "``CustomType``, if a subclass is instantiated) and any arguments passed when " "the type was called, and is expected to return the instance created. " "``tp_new`` handlers always accept positional and keyword arguments, but they " -"often ignore the arguments, leaving the argument handling to initializer (a." -"k.a. ``tp_init`` in C or ``__init__`` in Python) methods." +"often ignore the arguments, leaving the argument handling to initializer " +"(a.k.a. ``tp_init`` in C or ``__init__`` in Python) methods." msgstr "" -#: ../../extending/newtypes_tutorial.rst:325 +#: ../../extending/newtypes_tutorial.rst:346 msgid "" "``tp_new`` shouldn't call ``tp_init`` explicitly, as the interpreter will do " "it itself." msgstr "" -#: ../../extending/newtypes_tutorial.rst:328 +#: ../../extending/newtypes_tutorial.rst:349 msgid "" "The ``tp_new`` implementation calls the :c:member:`~PyTypeObject.tp_alloc` " "slot to allocate memory::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:331 +#: ../../extending/newtypes_tutorial.rst:352 msgid "self = (CustomObject *) type->tp_alloc(type, 0);" msgstr "self = (CustomObject *) type->tp_alloc(type, 0);" -#: ../../extending/newtypes_tutorial.rst:333 +#: ../../extending/newtypes_tutorial.rst:354 msgid "" -"Since memory allocation may fail, we must check the :c:member:`~PyTypeObject." -"tp_alloc` result against ``NULL`` before proceeding." +"Since memory allocation may fail, we must check " +"the :c:member:`~PyTypeObject.tp_alloc` result against ``NULL`` before " +"proceeding." msgstr "" -#: ../../extending/newtypes_tutorial.rst:337 +#: ../../extending/newtypes_tutorial.rst:358 msgid "" "We didn't fill the :c:member:`~PyTypeObject.tp_alloc` slot ourselves. " "Rather :c:func:`PyType_Ready` fills it for us by inheriting it from our base " @@ -804,30 +847,33 @@ msgid "" "allocation strategy." msgstr "" -#: ../../extending/newtypes_tutorial.rst:343 +#: ../../extending/newtypes_tutorial.rst:364 msgid "" "If you are creating a co-operative :c:member:`~PyTypeObject.tp_new` (one " -"that calls a base type's :c:member:`~PyTypeObject.tp_new` or :meth:`~object." -"__new__`), you must *not* try to determine what method to call using method " -"resolution order at runtime. Always statically determine what type you are " -"going to call, and call its :c:member:`~PyTypeObject.tp_new` directly, or " -"via ``type->tp_base->tp_new``. If you do not do this, Python subclasses of " -"your type that also inherit from other Python-defined classes may not work " -"correctly. (Specifically, you may not be able to create instances of such " -"subclasses without getting a :exc:`TypeError`.)" +"that calls a base type's :c:member:`~PyTypeObject.tp_new` " +"or :meth:`~object.__new__`), you must *not* try to determine what method to " +"call using method resolution order at runtime. Always statically determine " +"what type you are going to call, and call " +"its :c:member:`~PyTypeObject.tp_new` directly, or via ``type->tp_base-" +">tp_new``. If you do not do this, Python subclasses of your type that also " +"inherit from other Python-defined classes may not work correctly. " +"(Specifically, you may not be able to create instances of such subclasses " +"without getting a :exc:`TypeError`.)" msgstr "" -#: ../../extending/newtypes_tutorial.rst:353 +#: ../../extending/newtypes_tutorial.rst:374 msgid "" "We also define an initialization function which accepts arguments to provide " "initial values for our instance::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:356 +#: ../../extending/newtypes_tutorial.rst:377 +#, fuzzy msgid "" "static int\n" -"Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" " PyObject *first = NULL, *last = NULL, *tmp;\n" "\n" @@ -877,23 +923,24 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:382 +#: ../../extending/newtypes_tutorial.rst:404 msgid "by filling the :c:member:`~PyTypeObject.tp_init` slot. ::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:384 -msgid ".tp_init = (initproc) Custom_init," +#: ../../extending/newtypes_tutorial.rst:406 +#, fuzzy +msgid ".tp_init = Custom_init," msgstr ".tp_init = (initproc) Custom_init," -#: ../../extending/newtypes_tutorial.rst:386 +#: ../../extending/newtypes_tutorial.rst:408 msgid "" -"The :c:member:`~PyTypeObject.tp_init` slot is exposed in Python as the :meth:" -"`~object.__init__` method. It is used to initialize an object after it's " -"created. Initializers always accept positional and keyword arguments, and " -"they should return either ``0`` on success or ``-1`` on error." +"The :c:member:`~PyTypeObject.tp_init` slot is exposed in Python as " +"the :meth:`~object.__init__` method. It is used to initialize an object " +"after it's created. Initializers always accept positional and keyword " +"arguments, and they should return either ``0`` on success or ``-1`` on error." msgstr "" -#: ../../extending/newtypes_tutorial.rst:391 +#: ../../extending/newtypes_tutorial.rst:413 msgid "" "Unlike the ``tp_new`` handler, there is no guarantee that ``tp_init`` is " "called at all (for example, the :mod:`pickle` module by default doesn't " @@ -904,7 +951,7 @@ msgid "" "``first`` member like this::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:399 +#: ../../extending/newtypes_tutorial.rst:421 msgid "" "if (first) {\n" " Py_XDECREF(self->first);\n" @@ -918,47 +965,48 @@ msgstr "" " self->first = first;\n" "}" -#: ../../extending/newtypes_tutorial.rst:405 +#: ../../extending/newtypes_tutorial.rst:427 msgid "" "But this would be risky. Our type doesn't restrict the type of the " "``first`` member, so it could be any kind of object. It could have a " "destructor that causes code to be executed that tries to access the " -"``first`` member; or that destructor could release the :term:`Global " -"interpreter Lock ` and let arbitrary code run in other threads that " +"``first`` member; or that destructor could detach the :term:`thread state " +"` and let arbitrary code run in other threads that " "accesses and modifies our object." msgstr "" -#: ../../extending/newtypes_tutorial.rst:412 +#: ../../extending/newtypes_tutorial.rst:434 msgid "" "To be paranoid and protect ourselves against this possibility, we almost " "always reassign members before decrementing their reference counts. When " "don't we have to do this?" msgstr "" -#: ../../extending/newtypes_tutorial.rst:416 +#: ../../extending/newtypes_tutorial.rst:438 msgid "when we absolutely know that the reference count is greater than 1;" msgstr "" -#: ../../extending/newtypes_tutorial.rst:418 +#: ../../extending/newtypes_tutorial.rst:440 msgid "" -"when we know that deallocation of the object [#]_ will neither release the :" -"term:`GIL` nor cause any calls back into our type's code;" +"when we know that deallocation of the object [#]_ will neither detach " +"the :term:`thread state ` nor cause any calls back " +"into our type's code;" msgstr "" -#: ../../extending/newtypes_tutorial.rst:421 +#: ../../extending/newtypes_tutorial.rst:443 msgid "" -"when decrementing a reference count in a :c:member:`~PyTypeObject." -"tp_dealloc` handler on a type which doesn't support cyclic garbage " -"collection [#]_." +"when decrementing a reference count in " +"a :c:member:`~PyTypeObject.tp_dealloc` handler on a type which doesn't " +"support cyclic garbage collection [#]_." msgstr "" -#: ../../extending/newtypes_tutorial.rst:424 +#: ../../extending/newtypes_tutorial.rst:446 msgid "" "We want to expose our instance variables as attributes. There are a number " "of ways to do that. The simplest way is to define member definitions::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:427 +#: ../../extending/newtypes_tutorial.rst:449 msgid "" "static PyMemberDef Custom_members[] = {\n" " {\"first\", Py_T_OBJECT_EX, offsetof(CustomObject, first), 0,\n" @@ -971,23 +1019,23 @@ msgid "" "};" msgstr "" -#: ../../extending/newtypes_tutorial.rst:437 +#: ../../extending/newtypes_tutorial.rst:459 msgid "" "and put the definitions in the :c:member:`~PyTypeObject.tp_members` slot::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:439 +#: ../../extending/newtypes_tutorial.rst:461 msgid ".tp_members = Custom_members," msgstr ".tp_members = Custom_members," -#: ../../extending/newtypes_tutorial.rst:441 +#: ../../extending/newtypes_tutorial.rst:463 msgid "" "Each member definition has a member name, type, offset, access flags and " "documentation string. See the :ref:`Generic-Attribute-Management` section " "below for details." msgstr "" -#: ../../extending/newtypes_tutorial.rst:445 +#: ../../extending/newtypes_tutorial.rst:467 msgid "" "A disadvantage of this approach is that it doesn't provide a way to restrict " "the types of objects that can be assigned to the Python attributes. We " @@ -998,17 +1046,19 @@ msgid "" "deleted." msgstr "" -#: ../../extending/newtypes_tutorial.rst:452 +#: ../../extending/newtypes_tutorial.rst:474 msgid "" "We define a single method, :meth:`!Custom.name`, that outputs the objects " "name as the concatenation of the first and last names. ::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:455 +#: ../../extending/newtypes_tutorial.rst:477 +#, fuzzy msgid "" "static PyObject *\n" -"Custom_name(CustomObject *self, PyObject *Py_UNUSED(ignored))\n" +"Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " if (self->first == NULL) {\n" " PyErr_SetString(PyExc_AttributeError, \"first\");\n" " return NULL;\n" @@ -1034,17 +1084,17 @@ msgstr "" " return PyUnicode_FromFormat(\"%S %S\", self->first, self->last);\n" "}" -#: ../../extending/newtypes_tutorial.rst:469 +#: ../../extending/newtypes_tutorial.rst:492 msgid "" -"The method is implemented as a C function that takes a :class:`!Custom` (or :" -"class:`!Custom` subclass) instance as the first argument. Methods always " -"take an instance as the first argument. Methods often take positional and " -"keyword arguments as well, but in this case we don't take any and don't need " -"to accept a positional argument tuple or keyword argument dictionary. This " -"method is equivalent to the Python method:" +"The method is implemented as a C function that takes a :class:`!Custom` " +"(or :class:`!Custom` subclass) instance as the first argument. Methods " +"always take an instance as the first argument. Methods often take positional " +"and keyword arguments as well, but in this case we don't take any and don't " +"need to accept a positional argument tuple or keyword argument dictionary. " +"This method is equivalent to the Python method:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:476 +#: ../../extending/newtypes_tutorial.rst:499 msgid "" "def name(self):\n" " return \"%s %s\" % (self.first, self.last)" @@ -1052,46 +1102,46 @@ msgstr "" "def name(self):\n" " return \"%s %s\" % (self.first, self.last)" -#: ../../extending/newtypes_tutorial.rst:481 +#: ../../extending/newtypes_tutorial.rst:504 msgid "" -"Note that we have to check for the possibility that our :attr:`!first` and :" -"attr:`!last` members are ``NULL``. This is because they can be deleted, in " -"which case they are set to ``NULL``. It would be better to prevent deletion " -"of these attributes and to restrict the attribute values to be strings. " -"We'll see how to do that in the next section." +"Note that we have to check for the possibility that our :attr:`!first` " +"and :attr:`!last` members are ``NULL``. This is because they can be " +"deleted, in which case they are set to ``NULL``. It would be better to " +"prevent deletion of these attributes and to restrict the attribute values to " +"be strings. We'll see how to do that in the next section." msgstr "" -#: ../../extending/newtypes_tutorial.rst:487 +#: ../../extending/newtypes_tutorial.rst:510 msgid "" "Now that we've defined the method, we need to create an array of method " "definitions::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:490 +#: ../../extending/newtypes_tutorial.rst:513 msgid "" "static PyMethodDef Custom_methods[] = {\n" -" {\"name\", (PyCFunction) Custom_name, METH_NOARGS,\n" +" {\"name\", Custom_name, METH_NOARGS,\n" " \"Return the name, combining the first and last name\"\n" " },\n" " {NULL} /* Sentinel */\n" "};" msgstr "" -#: ../../extending/newtypes_tutorial.rst:497 +#: ../../extending/newtypes_tutorial.rst:520 msgid "" "(note that we used the :c:macro:`METH_NOARGS` flag to indicate that the " "method is expecting no arguments other than *self*)" msgstr "" -#: ../../extending/newtypes_tutorial.rst:500 +#: ../../extending/newtypes_tutorial.rst:523 msgid "and assign it to the :c:member:`~PyTypeObject.tp_methods` slot::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:502 +#: ../../extending/newtypes_tutorial.rst:525 msgid ".tp_methods = Custom_methods," msgstr ".tp_methods = Custom_methods," -#: ../../extending/newtypes_tutorial.rst:504 +#: ../../extending/newtypes_tutorial.rst:527 msgid "" "Finally, we'll make our type usable as a base class for subclassing. We've " "written our methods carefully so far so that they don't make any assumptions " @@ -1099,22 +1149,22 @@ msgid "" "to add the :c:macro:`Py_TPFLAGS_BASETYPE` to our class flag definition::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:509 +#: ../../extending/newtypes_tutorial.rst:532 msgid ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE," msgstr ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE," -#: ../../extending/newtypes_tutorial.rst:511 +#: ../../extending/newtypes_tutorial.rst:534 msgid "" "We rename :c:func:`!PyInit_custom` to :c:func:`!PyInit_custom2`, update the " "module name in the :c:type:`PyModuleDef` struct, and update the full class " "name in the :c:type:`PyTypeObject` struct." msgstr "" -#: ../../extending/newtypes_tutorial.rst:515 +#: ../../extending/newtypes_tutorial.rst:538 msgid "Finally, we update our :file:`setup.py` file to include the new module," msgstr "" -#: ../../extending/newtypes_tutorial.rst:517 +#: ../../extending/newtypes_tutorial.rst:540 msgid "" "from setuptools import Extension, setup\n" "setup(ext_modules=[\n" @@ -1128,24 +1178,24 @@ msgstr "" " Extension(\"custom2\", [\"custom2.c\"]),\n" "])" -#: ../../extending/newtypes_tutorial.rst:525 +#: ../../extending/newtypes_tutorial.rst:548 msgid "and then we re-install so that we can ``import custom2``:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:532 +#: ../../extending/newtypes_tutorial.rst:555 msgid "Providing finer control over data attributes" msgstr "" -#: ../../extending/newtypes_tutorial.rst:534 +#: ../../extending/newtypes_tutorial.rst:557 msgid "" "In this section, we'll provide finer control over how the :attr:`!first` " "and :attr:`!last` attributes are set in the :class:`!Custom` example. In the " -"previous version of our module, the instance variables :attr:`!first` and :" -"attr:`!last` could be set to non-string values or even deleted. We want to " -"make sure that these attributes always contain strings." +"previous version of our module, the instance variables :attr:`!first` " +"and :attr:`!last` could be set to non-string values or even deleted. We want " +"to make sure that these attributes always contain strings." msgstr "" -#: ../../extending/newtypes_tutorial.rst:540 +#: ../../extending/newtypes_tutorial.rst:563 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -1159,11 +1209,12 @@ msgid "" "} CustomObject;\n" "\n" "static void\n" -"Custom_dealloc(CustomObject *self)\n" +"Custom_dealloc(PyObject *op)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " Py_XDECREF(self->first);\n" " Py_XDECREF(self->last);\n" -" Py_TYPE(self)->tp_free((PyObject *) self);\n" +" Py_TYPE(self)->tp_free(self);\n" "}\n" "\n" "static PyObject *\n" @@ -1172,12 +1223,12 @@ msgid "" " CustomObject *self;\n" " self = (CustomObject *) type->tp_alloc(type, 0);\n" " if (self != NULL) {\n" -" self->first = PyUnicode_FromString(\"\");\n" +" self->first = Py_GetConstant(Py_CONSTANT_EMPTY_STR);\n" " if (self->first == NULL) {\n" " Py_DECREF(self);\n" " return NULL;\n" " }\n" -" self->last = PyUnicode_FromString(\"\");\n" +" self->last = Py_GetConstant(Py_CONSTANT_EMPTY_STR);\n" " if (self->last == NULL) {\n" " Py_DECREF(self);\n" " return NULL;\n" @@ -1188,8 +1239,9 @@ msgid "" "}\n" "\n" "static int\n" -"Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" " PyObject *first = NULL, *last = NULL;\n" "\n" @@ -1214,14 +1266,16 @@ msgid "" "};\n" "\n" "static PyObject *\n" -"Custom_getfirst(CustomObject *self, void *closure)\n" +"Custom_getfirst(PyObject *op, void *closure)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " return Py_NewRef(self->first);\n" "}\n" "\n" "static int\n" -"Custom_setfirst(CustomObject *self, PyObject *value, void *closure)\n" +"Custom_setfirst(PyObject *op, PyObject *value, void *closure)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " if (value == NULL) {\n" " PyErr_SetString(PyExc_TypeError, \"Cannot delete the first " "attribute\");\n" @@ -1237,14 +1291,16 @@ msgid "" "}\n" "\n" "static PyObject *\n" -"Custom_getlast(CustomObject *self, void *closure)\n" +"Custom_getlast(PyObject *op, void *closure)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " return Py_NewRef(self->last);\n" "}\n" "\n" "static int\n" -"Custom_setlast(CustomObject *self, PyObject *value, void *closure)\n" +"Custom_setlast(PyObject *op, PyObject *value, void *closure)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " if (value == NULL) {\n" " PyErr_SetString(PyExc_TypeError, \"Cannot delete the last " "attribute\");\n" @@ -1260,21 +1316,22 @@ msgid "" "}\n" "\n" "static PyGetSetDef Custom_getsetters[] = {\n" -" {\"first\", (getter) Custom_getfirst, (setter) Custom_setfirst,\n" +" {\"first\", Custom_getfirst, Custom_setfirst,\n" " \"first name\", NULL},\n" -" {\"last\", (getter) Custom_getlast, (setter) Custom_setlast,\n" +" {\"last\", Custom_getlast, Custom_setlast,\n" " \"last name\", NULL},\n" " {NULL} /* Sentinel */\n" "};\n" "\n" "static PyObject *\n" -"Custom_name(CustomObject *self, PyObject *Py_UNUSED(ignored))\n" +"Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " return PyUnicode_FromFormat(\"%S %S\", self->first, self->last);\n" "}\n" "\n" "static PyMethodDef Custom_methods[] = {\n" -" {\"name\", (PyCFunction) Custom_name, METH_NOARGS,\n" +" {\"name\", Custom_name, METH_NOARGS,\n" " \"Return the name, combining the first and last name\"\n" " },\n" " {NULL} /* Sentinel */\n" @@ -1288,8 +1345,8 @@ msgid "" " .tp_itemsize = 0,\n" " .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,\n" " .tp_new = Custom_new,\n" -" .tp_init = (initproc) Custom_init,\n" -" .tp_dealloc = (destructor) Custom_dealloc,\n" +" .tp_init = Custom_init,\n" +" .tp_dealloc = Custom_dealloc,\n" " .tp_members = Custom_members,\n" " .tp_methods = Custom_methods,\n" " .tp_getset = Custom_getsetters,\n" @@ -1332,25 +1389,27 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:543 +#: ../../extending/newtypes_tutorial.rst:566 msgid "" "To provide greater control, over the :attr:`!first` and :attr:`!last` " "attributes, we'll use custom getter and setter functions. Here are the " "functions for getting and setting the :attr:`!first` attribute::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:547 +#: ../../extending/newtypes_tutorial.rst:570 msgid "" "static PyObject *\n" -"Custom_getfirst(CustomObject *self, void *closure)\n" +"Custom_getfirst(PyObject *op, void *closure)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " Py_INCREF(self->first);\n" " return self->first;\n" "}\n" "\n" "static int\n" -"Custom_setfirst(CustomObject *self, PyObject *value, void *closure)\n" +"Custom_setfirst(PyObject *op, PyObject *value, void *closure)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " PyObject *tmp;\n" " if (value == NULL) {\n" " PyErr_SetString(PyExc_TypeError, \"Cannot delete the first " @@ -1370,7 +1429,7 @@ msgid "" "}" msgstr "" -#: ../../extending/newtypes_tutorial.rst:574 +#: ../../extending/newtypes_tutorial.rst:599 msgid "" "The getter function is passed a :class:`!Custom` object and a \"closure\", " "which is a void pointer. In this case, the closure is ignored. (The " @@ -1380,7 +1439,7 @@ msgid "" "data in the closure.)" msgstr "" -#: ../../extending/newtypes_tutorial.rst:580 +#: ../../extending/newtypes_tutorial.rst:605 msgid "" "The setter function is passed the :class:`!Custom` object, the new value, " "and the closure. The new value may be ``NULL``, in which case the attribute " @@ -1388,41 +1447,41 @@ msgid "" "deleted or if its new value is not a string." msgstr "" -#: ../../extending/newtypes_tutorial.rst:585 +#: ../../extending/newtypes_tutorial.rst:610 msgid "We create an array of :c:type:`PyGetSetDef` structures::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:587 +#: ../../extending/newtypes_tutorial.rst:612 msgid "" "static PyGetSetDef Custom_getsetters[] = {\n" -" {\"first\", (getter) Custom_getfirst, (setter) Custom_setfirst,\n" +" {\"first\", Custom_getfirst, Custom_setfirst,\n" " \"first name\", NULL},\n" -" {\"last\", (getter) Custom_getlast, (setter) Custom_setlast,\n" +" {\"last\", Custom_getlast, Custom_setlast,\n" " \"last name\", NULL},\n" " {NULL} /* Sentinel */\n" "};" msgstr "" -#: ../../extending/newtypes_tutorial.rst:595 +#: ../../extending/newtypes_tutorial.rst:620 msgid "and register it in the :c:member:`~PyTypeObject.tp_getset` slot::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:597 +#: ../../extending/newtypes_tutorial.rst:622 msgid ".tp_getset = Custom_getsetters," msgstr ".tp_getset = Custom_getsetters," -#: ../../extending/newtypes_tutorial.rst:599 +#: ../../extending/newtypes_tutorial.rst:624 msgid "" "The last item in a :c:type:`PyGetSetDef` structure is the \"closure\" " "mentioned above. In this case, we aren't using a closure, so we just pass " "``NULL``." msgstr "" -#: ../../extending/newtypes_tutorial.rst:602 +#: ../../extending/newtypes_tutorial.rst:627 msgid "We also remove the member definitions for these attributes::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:604 +#: ../../extending/newtypes_tutorial.rst:629 msgid "" "static PyMemberDef Custom_members[] = {\n" " {\"number\", Py_T_INT, offsetof(CustomObject, number), 0,\n" @@ -1431,17 +1490,19 @@ msgid "" "};" msgstr "" -#: ../../extending/newtypes_tutorial.rst:610 +#: ../../extending/newtypes_tutorial.rst:635 msgid "" "We also need to update the :c:member:`~PyTypeObject.tp_init` handler to only " "allow strings [#]_ to be passed::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:613 +#: ../../extending/newtypes_tutorial.rst:638 +#, fuzzy msgid "" "static int\n" -"Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" " PyObject *first = NULL, *last = NULL, *tmp;\n" "\n" @@ -1465,8 +1526,33 @@ msgid "" " return 0;\n" "}" msgstr "" +"static int\n" +"Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)\n" +"{\n" +" static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" +" PyObject *first = NULL, *last = NULL, *tmp;\n" +"\n" +" if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|OOi\", kwlist,\n" +" &first, &last,\n" +" &self->number))\n" +" return -1;\n" +"\n" +" if (first) {\n" +" tmp = self->first;\n" +" Py_INCREF(first);\n" +" self->first = first;\n" +" Py_XDECREF(tmp);\n" +" }\n" +" if (last) {\n" +" tmp = self->last;\n" +" Py_INCREF(last);\n" +" self->last = last;\n" +" Py_XDECREF(tmp);\n" +" }\n" +" return 0;\n" +"}" -#: ../../extending/newtypes_tutorial.rst:639 +#: ../../extending/newtypes_tutorial.rst:665 msgid "" "With these changes, we can assure that the ``first`` and ``last`` members " "are never ``NULL`` so we can remove checks for ``NULL`` values in almost all " @@ -1476,25 +1562,25 @@ msgid "" "possibility that the initialization of these members failed in ``tp_new``." msgstr "" -#: ../../extending/newtypes_tutorial.rst:646 +#: ../../extending/newtypes_tutorial.rst:672 msgid "" "We also rename the module initialization function and module name in the " "initialization function, as we did before, and we add an extra definition to " "the :file:`setup.py` file." msgstr "" -#: ../../extending/newtypes_tutorial.rst:652 +#: ../../extending/newtypes_tutorial.rst:678 msgid "Supporting cyclic garbage collection" msgstr "" -#: ../../extending/newtypes_tutorial.rst:654 +#: ../../extending/newtypes_tutorial.rst:680 msgid "" "Python has a :term:`cyclic garbage collector (GC) ` that " "can identify unneeded objects even when their reference counts are not zero. " "This can happen when objects are involved in cycles. For example, consider:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:658 +#: ../../extending/newtypes_tutorial.rst:684 msgid "" ">>> l = []\n" ">>> l.append(l)\n" @@ -1504,7 +1590,7 @@ msgstr "" ">>> l.append(l)\n" ">>> del l" -#: ../../extending/newtypes_tutorial.rst:664 +#: ../../extending/newtypes_tutorial.rst:690 msgid "" "In this example, we create a list that contains itself. When we delete it, " "it still has a reference from itself. Its reference count doesn't drop to " @@ -1512,16 +1598,17 @@ msgid "" "out that the list is garbage and free it." msgstr "" -#: ../../extending/newtypes_tutorial.rst:669 +#: ../../extending/newtypes_tutorial.rst:695 msgid "" "In the second version of the :class:`!Custom` example, we allowed any kind " "of object to be stored in the :attr:`!first` or :attr:`!last` attributes " -"[#]_. Besides, in the second and third versions, we allowed subclassing :" -"class:`!Custom`, and subclasses may add arbitrary attributes. For any of " -"those two reasons, :class:`!Custom` objects can participate in cycles:" +"[#]_. Besides, in the second and third versions, we allowed " +"subclassing :class:`!Custom`, and subclasses may add arbitrary attributes. " +"For any of those two reasons, :class:`!Custom` objects can participate in " +"cycles:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:675 +#: ../../extending/newtypes_tutorial.rst:701 msgid "" ">>> import custom3\n" ">>> class Derived(custom3.Custom): pass\n" @@ -1535,7 +1622,7 @@ msgstr "" ">>> n = Derived()\n" ">>> n.some_attribute = n" -#: ../../extending/newtypes_tutorial.rst:683 +#: ../../extending/newtypes_tutorial.rst:709 msgid "" "To allow a :class:`!Custom` instance participating in a reference cycle to " "be properly detected and collected by the cyclic GC, our :class:`!Custom` " @@ -1543,7 +1630,7 @@ msgid "" "these slots:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:687 +#: ../../extending/newtypes_tutorial.rst:713 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -1557,27 +1644,29 @@ msgid "" "} CustomObject;\n" "\n" "static int\n" -"Custom_traverse(CustomObject *self, visitproc visit, void *arg)\n" +"Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " Py_VISIT(self->first);\n" " Py_VISIT(self->last);\n" " return 0;\n" "}\n" "\n" "static int\n" -"Custom_clear(CustomObject *self)\n" +"Custom_clear(PyObject *op)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " Py_CLEAR(self->first);\n" " Py_CLEAR(self->last);\n" " return 0;\n" "}\n" "\n" "static void\n" -"Custom_dealloc(CustomObject *self)\n" +"Custom_dealloc(PyObject *op)\n" "{\n" -" PyObject_GC_UnTrack(self);\n" -" Custom_clear(self);\n" -" Py_TYPE(self)->tp_free((PyObject *) self);\n" +" PyObject_GC_UnTrack(op);\n" +" (void)Custom_clear(op);\n" +" Py_TYPE(op)->tp_free(op);\n" "}\n" "\n" "static PyObject *\n" @@ -1586,12 +1675,12 @@ msgid "" " CustomObject *self;\n" " self = (CustomObject *) type->tp_alloc(type, 0);\n" " if (self != NULL) {\n" -" self->first = PyUnicode_FromString(\"\");\n" +" self->first = Py_GetConstant(Py_CONSTANT_EMPTY_STR);\n" " if (self->first == NULL) {\n" " Py_DECREF(self);\n" " return NULL;\n" " }\n" -" self->last = PyUnicode_FromString(\"\");\n" +" self->last = Py_GetConstant(Py_CONSTANT_EMPTY_STR);\n" " if (self->last == NULL) {\n" " Py_DECREF(self);\n" " return NULL;\n" @@ -1602,8 +1691,9 @@ msgid "" "}\n" "\n" "static int\n" -"Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" " PyObject *first = NULL, *last = NULL;\n" "\n" @@ -1628,14 +1718,16 @@ msgid "" "};\n" "\n" "static PyObject *\n" -"Custom_getfirst(CustomObject *self, void *closure)\n" +"Custom_getfirst(PyObject *op, void *closure)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " return Py_NewRef(self->first);\n" "}\n" "\n" "static int\n" -"Custom_setfirst(CustomObject *self, PyObject *value, void *closure)\n" +"Custom_setfirst(PyObject *op, PyObject *value, void *closure)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " if (value == NULL) {\n" " PyErr_SetString(PyExc_TypeError, \"Cannot delete the first " "attribute\");\n" @@ -1651,14 +1743,16 @@ msgid "" "}\n" "\n" "static PyObject *\n" -"Custom_getlast(CustomObject *self, void *closure)\n" +"Custom_getlast(PyObject *op, void *closure)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " return Py_NewRef(self->last);\n" "}\n" "\n" "static int\n" -"Custom_setlast(CustomObject *self, PyObject *value, void *closure)\n" +"Custom_setlast(PyObject *op, PyObject *value, void *closure)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " if (value == NULL) {\n" " PyErr_SetString(PyExc_TypeError, \"Cannot delete the last " "attribute\");\n" @@ -1674,21 +1768,22 @@ msgid "" "}\n" "\n" "static PyGetSetDef Custom_getsetters[] = {\n" -" {\"first\", (getter) Custom_getfirst, (setter) Custom_setfirst,\n" +" {\"first\", Custom_getfirst, Custom_setfirst,\n" " \"first name\", NULL},\n" -" {\"last\", (getter) Custom_getlast, (setter) Custom_setlast,\n" +" {\"last\", Custom_getlast, Custom_setlast,\n" " \"last name\", NULL},\n" " {NULL} /* Sentinel */\n" "};\n" "\n" "static PyObject *\n" -"Custom_name(CustomObject *self, PyObject *Py_UNUSED(ignored))\n" +"Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " return PyUnicode_FromFormat(\"%S %S\", self->first, self->last);\n" "}\n" "\n" "static PyMethodDef Custom_methods[] = {\n" -" {\"name\", (PyCFunction) Custom_name, METH_NOARGS,\n" +" {\"name\", Custom_name, METH_NOARGS,\n" " \"Return the name, combining the first and last name\"\n" " },\n" " {NULL} /* Sentinel */\n" @@ -1703,10 +1798,10 @@ msgid "" " .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | " "Py_TPFLAGS_HAVE_GC,\n" " .tp_new = Custom_new,\n" -" .tp_init = (initproc) Custom_init,\n" -" .tp_dealloc = (destructor) Custom_dealloc,\n" -" .tp_traverse = (traverseproc) Custom_traverse,\n" -" .tp_clear = (inquiry) Custom_clear,\n" +" .tp_init = Custom_init,\n" +" .tp_dealloc = Custom_dealloc,\n" +" .tp_traverse = Custom_traverse,\n" +" .tp_clear = Custom_clear,\n" " .tp_members = Custom_members,\n" " .tp_methods = Custom_methods,\n" " .tp_getset = Custom_getsetters,\n" @@ -1749,17 +1844,19 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:690 +#: ../../extending/newtypes_tutorial.rst:716 msgid "" "First, the traversal method lets the cyclic GC know about subobjects that " "could participate in cycles::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:693 +#: ../../extending/newtypes_tutorial.rst:719 +#, fuzzy msgid "" "static int\n" -"Custom_traverse(CustomObject *self, visitproc visit, void *arg)\n" +"Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " int vret;\n" " if (self->first) {\n" " vret = visit(self->first, arg);\n" @@ -1791,27 +1888,29 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:710 +#: ../../extending/newtypes_tutorial.rst:737 msgid "" -"For each subobject that can participate in cycles, we need to call the :c:" -"func:`!visit` function, which is passed to the traversal method. The :c:func:" -"`!visit` function takes as arguments the subobject and the extra argument " -"*arg* passed to the traversal method. It returns an integer value that must " -"be returned if it is non-zero." +"For each subobject that can participate in cycles, we need to call " +"the :c:func:`!visit` function, which is passed to the traversal method. " +"The :c:func:`!visit` function takes as arguments the subobject and the extra " +"argument *arg* passed to the traversal method. It returns an integer value " +"that must be returned if it is non-zero." msgstr "" -#: ../../extending/newtypes_tutorial.rst:716 +#: ../../extending/newtypes_tutorial.rst:743 msgid "" "Python provides a :c:func:`Py_VISIT` macro that automates calling visit " "functions. With :c:func:`Py_VISIT`, we can minimize the amount of " "boilerplate in ``Custom_traverse``::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:720 +#: ../../extending/newtypes_tutorial.rst:747 +#, fuzzy msgid "" "static int\n" -"Custom_traverse(CustomObject *self, visitproc visit, void *arg)\n" +"Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " Py_VISIT(self->first);\n" " Py_VISIT(self->last);\n" " return 0;\n" @@ -1825,23 +1924,25 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:729 +#: ../../extending/newtypes_tutorial.rst:757 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` implementation must name its " "arguments exactly *visit* and *arg* in order to use :c:func:`Py_VISIT`." msgstr "" -#: ../../extending/newtypes_tutorial.rst:732 +#: ../../extending/newtypes_tutorial.rst:760 msgid "" "Second, we need to provide a method for clearing any subobjects that can " "participate in cycles::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:735 +#: ../../extending/newtypes_tutorial.rst:763 +#, fuzzy msgid "" "static int\n" -"Custom_clear(CustomObject *self)\n" +"Custom_clear(PyObject *op)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " Py_CLEAR(self->first);\n" " Py_CLEAR(self->last);\n" " return 0;\n" @@ -1855,7 +1956,7 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:743 +#: ../../extending/newtypes_tutorial.rst:772 msgid "" "Notice the use of the :c:func:`Py_CLEAR` macro. It is the recommended and " "safe way to clear data attributes of arbitrary types while decrementing " @@ -1865,11 +1966,11 @@ msgid "" "again (*especially* if there is a reference cycle)." msgstr "" -#: ../../extending/newtypes_tutorial.rst:751 +#: ../../extending/newtypes_tutorial.rst:780 msgid "You could emulate :c:func:`Py_CLEAR` by writing::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:753 +#: ../../extending/newtypes_tutorial.rst:782 msgid "" "PyObject *tmp;\n" "tmp = self->first;\n" @@ -1881,31 +1982,32 @@ msgstr "" "self->first = NULL;\n" "Py_XDECREF(tmp);" -#: ../../extending/newtypes_tutorial.rst:758 +#: ../../extending/newtypes_tutorial.rst:787 msgid "" -"Nevertheless, it is much easier and less error-prone to always use :c:func:" -"`Py_CLEAR` when deleting an attribute. Don't try to micro-optimize at the " -"expense of robustness!" +"Nevertheless, it is much easier and less error-prone to always " +"use :c:func:`Py_CLEAR` when deleting an attribute. Don't try to micro-" +"optimize at the expense of robustness!" msgstr "" -#: ../../extending/newtypes_tutorial.rst:762 +#: ../../extending/newtypes_tutorial.rst:791 msgid "" "The deallocator ``Custom_dealloc`` may call arbitrary code when clearing " "attributes. It means the circular GC can be triggered inside the function. " "Since the GC assumes reference count is not zero, we need to untrack the " "object from the GC by calling :c:func:`PyObject_GC_UnTrack` before clearing " -"members. Here is our reimplemented deallocator using :c:func:" -"`PyObject_GC_UnTrack` and ``Custom_clear``::" +"members. Here is our reimplemented deallocator " +"using :c:func:`PyObject_GC_UnTrack` and ``Custom_clear``::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:769 +#: ../../extending/newtypes_tutorial.rst:798 +#, fuzzy msgid "" "static void\n" -"Custom_dealloc(CustomObject *self)\n" +"Custom_dealloc(PyObject *op)\n" "{\n" -" PyObject_GC_UnTrack(self);\n" -" Custom_clear(self);\n" -" Py_TYPE(self)->tp_free((PyObject *) self);\n" +" PyObject_GC_UnTrack(op);\n" +" (void)Custom_clear(op);\n" +" Py_TYPE(op)->tp_free(op);\n" "}" msgstr "" "static void\n" @@ -1916,30 +2018,31 @@ msgstr "" " Py_TYPE(self)->tp_free((PyObject *) self);\n" "}" -#: ../../extending/newtypes_tutorial.rst:777 +#: ../../extending/newtypes_tutorial.rst:806 msgid "" "Finally, we add the :c:macro:`Py_TPFLAGS_HAVE_GC` flag to the class flags::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:779 +#: ../../extending/newtypes_tutorial.rst:808 msgid "" ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC," msgstr "" ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC," -#: ../../extending/newtypes_tutorial.rst:781 +#: ../../extending/newtypes_tutorial.rst:810 msgid "" -"That's pretty much it. If we had written custom :c:member:`~PyTypeObject." -"tp_alloc` or :c:member:`~PyTypeObject.tp_free` handlers, we'd need to modify " -"them for cyclic garbage collection. Most extensions will use the versions " +"That's pretty much it. If we had written " +"custom :c:member:`~PyTypeObject.tp_alloc` " +"or :c:member:`~PyTypeObject.tp_free` handlers, we'd need to modify them for " +"cyclic garbage collection. Most extensions will use the versions " "automatically provided." msgstr "" -#: ../../extending/newtypes_tutorial.rst:787 +#: ../../extending/newtypes_tutorial.rst:816 msgid "Subclassing other types" msgstr "" -#: ../../extending/newtypes_tutorial.rst:789 +#: ../../extending/newtypes_tutorial.rst:818 msgid "" "It is possible to create new extension types that are derived from existing " "types. It is easiest to inherit from the built in types, since an extension " @@ -1947,7 +2050,7 @@ msgid "" "share these :c:type:`PyTypeObject` structures between extension modules." msgstr "" -#: ../../extending/newtypes_tutorial.rst:794 +#: ../../extending/newtypes_tutorial.rst:823 msgid "" "In this example we will create a :class:`!SubList` type that inherits from " "the built-in :class:`list` type. The new type will be completely compatible " @@ -1955,7 +2058,7 @@ msgid "" "that increases an internal counter:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:799 +#: ../../extending/newtypes_tutorial.rst:828 msgid "" ">>> import sublist\n" ">>> s = sublist.SubList(range(3))\n" @@ -1977,7 +2080,7 @@ msgstr "" ">>> print(s.increment())\n" "2" -#: ../../extending/newtypes_tutorial.rst:811 +#: ../../extending/newtypes_tutorial.rst:840 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -1988,22 +2091,24 @@ msgid "" "} SubListObject;\n" "\n" "static PyObject *\n" -"SubList_increment(SubListObject *self, PyObject *unused)\n" +"SubList_increment(PyObject *op, PyObject *Py_UNUSED(dummy))\n" "{\n" +" SubListObject *self = (SubListObject *) op;\n" " self->state++;\n" " return PyLong_FromLong(self->state);\n" "}\n" "\n" "static PyMethodDef SubList_methods[] = {\n" -" {\"increment\", (PyCFunction) SubList_increment, METH_NOARGS,\n" +" {\"increment\", SubList_increment, METH_NOARGS,\n" " PyDoc_STR(\"increment state counter\")},\n" " {NULL},\n" "};\n" "\n" "static int\n" -"SubList_init(SubListObject *self, PyObject *args, PyObject *kwds)\n" +"SubList_init(PyObject *op, PyObject *args, PyObject *kwds)\n" "{\n" -" if (PyList_Type.tp_init((PyObject *) self, args, kwds) < 0)\n" +" SubListObject *self = (SubListObject *) op;\n" +" if (PyList_Type.tp_init(op, args, kwds) < 0)\n" " return -1;\n" " self->state = 0;\n" " return 0;\n" @@ -2016,7 +2121,7 @@ msgid "" " .tp_basicsize = sizeof(SubListObject),\n" " .tp_itemsize = 0,\n" " .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,\n" -" .tp_init = (initproc) SubList_init,\n" +" .tp_init = SubList_init,\n" " .tp_methods = SubList_methods,\n" "};\n" "\n" @@ -2058,14 +2163,14 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:814 +#: ../../extending/newtypes_tutorial.rst:843 msgid "" "As you can see, the source code closely resembles the :class:`!Custom` " "examples in previous sections. We will break down the main differences " "between them. ::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:817 +#: ../../extending/newtypes_tutorial.rst:846 msgid "" "typedef struct {\n" " PyListObject list;\n" @@ -2077,26 +2182,28 @@ msgstr "" " int state;\n" "} SubListObject;" -#: ../../extending/newtypes_tutorial.rst:822 +#: ../../extending/newtypes_tutorial.rst:851 msgid "" "The primary difference for derived type objects is that the base type's " "object structure must be the first value. The base type will already " "include the :c:func:`PyObject_HEAD` at the beginning of its structure." msgstr "" -#: ../../extending/newtypes_tutorial.rst:826 +#: ../../extending/newtypes_tutorial.rst:855 msgid "" "When a Python object is a :class:`!SubList` instance, its ``PyObject *`` " "pointer can be safely cast to both ``PyListObject *`` and ``SubListObject " "*``::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:829 +#: ../../extending/newtypes_tutorial.rst:858 +#, fuzzy msgid "" "static int\n" -"SubList_init(SubListObject *self, PyObject *args, PyObject *kwds)\n" +"SubList_init(PyObject *op, PyObject *args, PyObject *kwds)\n" "{\n" -" if (PyList_Type.tp_init((PyObject *) self, args, kwds) < 0)\n" +" SubListObject *self = (SubListObject *) op;\n" +" if (PyList_Type.tp_init(op, args, kwds) < 0)\n" " return -1;\n" " self->state = 0;\n" " return 0;\n" @@ -2111,30 +2218,32 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:838 +#: ../../extending/newtypes_tutorial.rst:868 msgid "" "We see above how to call through to the :meth:`~object.__init__` method of " "the base type." msgstr "" -#: ../../extending/newtypes_tutorial.rst:841 +#: ../../extending/newtypes_tutorial.rst:871 msgid "" -"This pattern is important when writing a type with custom :c:member:" -"`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_dealloc` members. " +"This pattern is important when writing a type with " +"custom :c:member:`~PyTypeObject.tp_new` " +"and :c:member:`~PyTypeObject.tp_dealloc` members. " "The :c:member:`~PyTypeObject.tp_new` handler should not actually create the " "memory for the object with its :c:member:`~PyTypeObject.tp_alloc`, but let " "the base class handle it by calling its own :c:member:`~PyTypeObject.tp_new`." msgstr "" -#: ../../extending/newtypes_tutorial.rst:847 +#: ../../extending/newtypes_tutorial.rst:877 msgid "" -"The :c:type:`PyTypeObject` struct supports a :c:member:`~PyTypeObject." -"tp_base` specifying the type's concrete base class. Due to cross-platform " -"compiler issues, you can't fill that field directly with a reference to :c:" -"type:`PyList_Type`; it should be done in the :c:data:`Py_mod_exec` function::" +"The :c:type:`PyTypeObject` struct supports " +"a :c:member:`~PyTypeObject.tp_base` specifying the type's concrete base " +"class. Due to cross-platform compiler issues, you can't fill that field " +"directly with a reference to :c:type:`PyList_Type`; it should be done in " +"the :c:data:`Py_mod_exec` function::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:853 +#: ../../extending/newtypes_tutorial.rst:883 msgid "" "static int\n" "sublist_module_exec(PyObject *m)\n" @@ -2168,38 +2277,38 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:868 +#: ../../extending/newtypes_tutorial.rst:898 msgid "" -"Before calling :c:func:`PyType_Ready`, the type structure must have the :c:" -"member:`~PyTypeObject.tp_base` slot filled in. When we are deriving an " -"existing type, it is not necessary to fill out the :c:member:`~PyTypeObject." -"tp_alloc` slot with :c:func:`PyType_GenericNew` -- the allocation function " -"from the base type will be inherited." +"Before calling :c:func:`PyType_Ready`, the type structure must have " +"the :c:member:`~PyTypeObject.tp_base` slot filled in. When we are deriving " +"an existing type, it is not necessary to fill out " +"the :c:member:`~PyTypeObject.tp_alloc` slot with :c:func:`PyType_GenericNew` " +"-- the allocation function from the base type will be inherited." msgstr "" -#: ../../extending/newtypes_tutorial.rst:874 +#: ../../extending/newtypes_tutorial.rst:904 msgid "" "After that, calling :c:func:`PyType_Ready` and adding the type object to the " "module is the same as with the basic :class:`!Custom` examples." msgstr "" -#: ../../extending/newtypes_tutorial.rst:879 +#: ../../extending/newtypes_tutorial.rst:909 msgid "Footnotes" msgstr "註腳" -#: ../../extending/newtypes_tutorial.rst:880 +#: ../../extending/newtypes_tutorial.rst:910 msgid "" "This is true when we know that the object is a basic type, like a string or " "a float." msgstr "" -#: ../../extending/newtypes_tutorial.rst:883 +#: ../../extending/newtypes_tutorial.rst:913 msgid "" "We relied on this in the :c:member:`~PyTypeObject.tp_dealloc` handler in " "this example, because our type doesn't support garbage collection." msgstr "" -#: ../../extending/newtypes_tutorial.rst:886 +#: ../../extending/newtypes_tutorial.rst:916 msgid "" "We now know that the first and last members are strings, so perhaps we could " "be less careful about decrementing their reference counts, however, we " @@ -2209,7 +2318,7 @@ msgid "" "objects." msgstr "" -#: ../../extending/newtypes_tutorial.rst:892 +#: ../../extending/newtypes_tutorial.rst:922 msgid "" "Also, even with our attributes restricted to strings instances, the user " "could pass arbitrary :class:`str` subclasses and therefore still create " diff --git a/extending/windows.po b/extending/windows.po index a85d0b62fa3..a98c46d3b49 100644 --- a/extending/windows.po +++ b/extending/windows.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -110,15 +110,15 @@ msgstr "" #: ../../extending/windows.rst:76 msgid "" "In Windows, there are two types of library, a static library and an import " -"library (both called :file:`.lib`). A static library is like a Unix :file:`." -"a` file; it contains code to be included as necessary. An import library is " -"basically used only to reassure the linker that a certain identifier is " -"legal, and will be present in the program when the DLL is loaded. So the " -"linker uses the information from the import library to build the lookup " -"table for using identifiers that are not included in the DLL. When an " -"application or a DLL is linked, an import library may be generated, which " -"will need to be used for all future DLLs that depend on the symbols in the " -"application or DLL." +"library (both called :file:`.lib`). A static library is like a " +"Unix :file:`.a` file; it contains code to be included as necessary. An " +"import library is basically used only to reassure the linker that a certain " +"identifier is legal, and will be present in the program when the DLL is " +"loaded. So the linker uses the information from the import library to build " +"the lookup table for using identifiers that are not included in the DLL. " +"When an application or a DLL is linked, an import library may be generated, " +"which will need to be used for all future DLLs that depend on the symbols in " +"the application or DLL." msgstr "" #: ../../extending/windows.rst:86 @@ -127,9 +127,10 @@ msgid "" "share another block of code A. On Unix, you would *not* pass :file:`A.a` to " "the linker for :file:`B.so` and :file:`C.so`; that would cause it to be " "included twice, so that B and C would each have their own copy. In Windows, " -"building :file:`A.dll` will also build :file:`A.lib`. You *do* pass :file:" -"`A.lib` to the linker for B and C. :file:`A.lib` does not contain code; it " -"just contains information which will be used at runtime to access A's code." +"building :file:`A.dll` will also build :file:`A.lib`. You *do* " +"pass :file:`A.lib` to the linker for B and C. :file:`A.lib` does not " +"contain code; it just contains information which will be used at runtime to " +"access A's code." msgstr "" #: ../../extending/windows.rst:94 @@ -140,47 +141,90 @@ msgid "" "create a separate copy." msgstr "" -#: ../../extending/windows.rst:103 +#: ../../extending/windows.rst:101 +msgid "" +"Turn off the implicit, ``#pragma``-based linkage with the Python library, " +"performed inside CPython header files." +msgstr "" + +#: ../../extending/windows.rst:110 msgid "Using DLLs in Practice" msgstr "" -#: ../../extending/windows.rst:108 +#: ../../extending/windows.rst:115 msgid "" "Windows Python is built in Microsoft Visual C++; using other compilers may " "or may not work. The rest of this section is MSVC++ specific." msgstr "" -#: ../../extending/windows.rst:111 +#: ../../extending/windows.rst:118 msgid "" -"When creating DLLs in Windows, you must pass :file:`pythonXY.lib` to the " -"linker. To build two DLLs, spam and ni (which uses C functions found in " -"spam), you could use these commands::" +"When creating DLLs in Windows, you can use the CPython library in two ways:" msgstr "" -#: ../../extending/windows.rst:115 +#: ../../extending/windows.rst:120 msgid "" -"cl /LD /I/python/include spam.c ../libs/pythonXY.lib\n" -"cl /LD /I/python/include ni.c spam.lib ../libs/pythonXY.lib" +"By default, inclusion of :file:`PC/pyconfig.h` directly or " +"via :file:`Python.h` triggers an implicit, configure-aware link with the " +"library. The header file chooses :file:`pythonXY_d.lib` for " +"Debug, :file:`pythonXY.lib` for Release, and :file:`pythonX.lib` for Release " +"with the :ref:`Limited API ` enabled." +msgstr "" + +#: ../../extending/windows.rst:126 ../../extending/windows.rst:144 +msgid "" +"To build two DLLs, spam and ni (which uses C functions found in spam), you " +"could use these commands::" +msgstr "" + +#: ../../extending/windows.rst:129 +#, fuzzy +msgid "" +"cl /LD /I/python/include spam.c\n" +"cl /LD /I/python/include ni.c spam.lib" msgstr "" "cl /LD /I/python/include spam.c ../libs/pythonXY.lib\n" "cl /LD /I/python/include ni.c spam.lib ../libs/pythonXY.lib" -#: ../../extending/windows.rst:118 +#: ../../extending/windows.rst:132 msgid "" "The first command created three files: :file:`spam.obj`, :file:`spam.dll` " "and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python " "functions (such as :c:func:`PyArg_ParseTuple`), but it does know how to find " -"the Python code thanks to :file:`pythonXY.lib`." +"the Python code thanks to the implicitly linked :file:`pythonXY.lib`." msgstr "" -#: ../../extending/windows.rst:123 +#: ../../extending/windows.rst:137 ../../extending/windows.rst:155 msgid "" -"The second command created :file:`ni.dll` (and :file:`.obj` and :file:`." -"lib`), which knows how to find the necessary functions from spam, and also " -"from the Python executable." +"The second command created :file:`ni.dll` (and :file:`.obj` " +"and :file:`.lib`), which knows how to find the necessary functions from " +"spam, and also from the Python executable." msgstr "" -#: ../../extending/windows.rst:127 +#: ../../extending/windows.rst:141 +msgid "" +"Manually by defining :c:macro:`Py_NO_LINK_LIB` macro before " +"including :file:`Python.h`. You must pass :file:`pythonXY.lib` to the linker." +msgstr "" + +#: ../../extending/windows.rst:147 +#, fuzzy +msgid "" +"cl /LD /DPy_NO_LINK_LIB /I/python/include spam.c ../libs/pythonXY.lib\n" +"cl /LD /DPy_NO_LINK_LIB /I/python/include ni.c spam.lib ../libs/pythonXY.lib" +msgstr "" +"cl /LD /I/python/include spam.c ../libs/pythonXY.lib\n" +"cl /LD /I/python/include ni.c spam.lib ../libs/pythonXY.lib" + +#: ../../extending/windows.rst:150 +msgid "" +"The first command created three files: :file:`spam.obj`, :file:`spam.dll` " +"and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python " +"functions (such as :c:func:`PyArg_ParseTuple`), but it does know how to find " +"the Python code thanks to :file:`pythonXY.lib`." +msgstr "" + +#: ../../extending/windows.rst:159 msgid "" "Not every identifier is exported to the lookup table. If you want any other " "modules (including Python) to be able to see your identifiers, you have to " @@ -188,7 +232,7 @@ msgid "" "initspam(void)`` or ``PyObject _declspec(dllexport) *NiGetSpamData(void)``." msgstr "" -#: ../../extending/windows.rst:132 +#: ../../extending/windows.rst:164 msgid "" "Developer Studio will throw in a lot of import libraries that you do not " "really need, adding about 100K to your executable. To get rid of them, use " diff --git a/faq/design.po b/faq/design.po index caed4b8892a..daaf57a38be 100644 --- a/faq/design.po +++ b/faq/design.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-08-31 11:34+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1172,13 +1172,14 @@ msgstr "" "用來建構詳盡徹底的測試套件來測試模組裡的每一行程式碼。" #: ../../faq/design.rst:589 +#, fuzzy msgid "" "An appropriate testing discipline can help build large complex applications " "in Python as well as having interface specifications would. In fact, it can " "be better because an interface specification cannot test certain properties " -"of a program. For example, the :meth:`!list.append` method is expected to " +"of a program. For example, the :meth:`list.append` method is expected to " "add new elements to the end of some internal list; an interface " -"specification cannot test that your :meth:`!list.append` implementation will " +"specification cannot test that your :meth:`list.append` implementation will " "actually do this correctly, but it's trivial to check this property in a " "test suite." msgstr "" diff --git a/faq/general.po b/faq/general.po index ac684d513b3..f32417f5f03 100644 --- a/faq/general.po +++ b/faq/general.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-19 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-06-23 16:56+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -627,17 +627,17 @@ msgstr "" "downloads/>`_\\ 上找到。Python 3.x 是推薦的版本,並且被大多數廣泛使用的函式庫" "所支援。Python 2.x :pep:`已不再被維護 <0373>`。" -#: ../../faq/general.rst:318 +#: ../../faq/general.rst:317 msgid "How many people are using Python?" msgstr "有多少人在使用 Python?" -#: ../../faq/general.rst:320 +#: ../../faq/general.rst:319 msgid "" "There are probably millions of users, though it's difficult to obtain an " "exact count." msgstr "可能有幾百萬個使用者,但實際的數量是難以確定的。" -#: ../../faq/general.rst:323 +#: ../../faq/general.rst:322 msgid "" "Python is available for free download, so there are no sales figures, and " "it's available from many different sites and packaged with many Linux " @@ -646,7 +646,7 @@ msgstr "" "Python 是可以免費下載的,所以不會有銷售數據,而且它可以從許多不同的網站取得," "並與許多 Linux 發行版套裝在一起,所以下載次數的統計也無法反映完整的情況。" -#: ../../faq/general.rst:327 +#: ../../faq/general.rst:326 msgid "" "The comp.lang.python newsgroup is very active, but not all Python users post " "to the group or even read it." @@ -654,11 +654,11 @@ msgstr "" "comp.lang.python 新聞群組非常活躍,但並非所有 Python 使用者都會在該群組發表文" "章或甚至閱讀它。" -#: ../../faq/general.rst:332 +#: ../../faq/general.rst:331 msgid "Have any significant projects been done in Python?" msgstr "有沒有任何重要的專案使用 Python 完成開發?" -#: ../../faq/general.rst:334 +#: ../../faq/general.rst:333 msgid "" "See https://www.python.org/about/success for a list of projects that use " "Python. Consulting the proceedings for `past Python conferences `_\\ 可以看見來自許多不同公司和組織的貢獻。" -#: ../../faq/general.rst:339 +#: ../../faq/general.rst:338 msgid "" "High-profile Python projects include `the Mailman mailing list manager " "`_ and `the Zope application server `_." @@ -709,11 +709,11 @@ msgstr "" "新的開發會在 `python-dev 郵件討論群 `_\\ 中討論。" -#: ../../faq/general.rst:361 +#: ../../faq/general.rst:360 msgid "Is it reasonable to propose incompatible changes to Python?" msgstr "對 Python 提出不相容的變更建議是否適當?" -#: ../../faq/general.rst:363 +#: ../../faq/general.rst:362 msgid "" "In general, no. There are already millions of lines of Python code around " "the world, so any change in the language that invalidates more than a very " @@ -727,7 +727,7 @@ msgstr "" "式,仍然會有需要更新全部說明文件的問題;市面上已經有很多介紹 Python 的書,而" "我們不想一下子就把它們都變為無效。" -#: ../../faq/general.rst:370 +#: ../../faq/general.rst:369 msgid "" "Providing a gradual upgrade path is necessary if a feature has to be " "changed. :pep:`5` describes the procedure followed for introducing backward-" @@ -737,15 +737,15 @@ msgstr "" "向不相容 (backward-incompatible) 的變更,同時也要對使用者的擾亂最小化,所需遵" "循的程序。" -#: ../../faq/general.rst:376 +#: ../../faq/general.rst:375 msgid "Is Python a good language for beginning programmers?" msgstr "Python 對於入門的程式設計師而言是否為好的語言?" -#: ../../faq/general.rst:378 +#: ../../faq/general.rst:377 msgid "Yes." msgstr "是的。" -#: ../../faq/general.rst:380 +#: ../../faq/general.rst:379 msgid "" "It is still common to start students with a procedural and statically typed " "language such as Pascal, C, or a subset of C++ or Java. Students may be " @@ -765,7 +765,7 @@ msgstr "" "速地向學生介紹基本觀念,例如迴圈和程序。他們甚至可能在第一堂課中就學到使用者" "自訂的物件。" -#: ../../faq/general.rst:390 +#: ../../faq/general.rst:389 msgid "" "For a student who has never programmed before, using a statically typed " "language seems unnatural. It presents additional complexity that the " @@ -781,7 +781,7 @@ msgstr "" "考、分解問題、設計一致的介面,並封裝資料。雖然從長遠來看,學習使用靜態型別語" "言很重要,但在學生的第一堂程式設計課程中,它不一定是最好的課程主題。" -#: ../../faq/general.rst:398 +#: ../../faq/general.rst:397 msgid "" "Many other aspects of Python make it a good first language. Like Java, " "Python has a large standard library so that students can be assigned " @@ -800,7 +800,7 @@ msgstr "" "用程式的滿足感。使用標準函式庫還可以教導學生程式碼再使用 (code reuse) 的課" "題。像是 PyGame 等第三方模組也有助於延伸學生的學習領域。" -#: ../../faq/general.rst:407 +#: ../../faq/general.rst:406 msgid "" "Python's interactive interpreter enables students to test language features " "while they're programming. They can keep a window with the interpreter " @@ -811,7 +811,7 @@ msgstr "" "行直譯器的視窗,同時在另一個視窗中輸入他們的程式原始碼。如果他們不記得 list" "(串列)的 method(方法),他們可以像這樣做: ::" -#: ../../faq/general.rst:412 +#: ../../faq/general.rst:411 msgid "" ">>> L = []\n" ">>> dir(L)\n" @@ -863,13 +863,13 @@ msgstr "" ">>> L\n" "[1]" -#: ../../faq/general.rst:436 +#: ../../faq/general.rst:435 msgid "" "With the interpreter, documentation is never far from the student as they " "are programming." msgstr "有了直譯器,當學生正在程式設計時,說明文件永遠都不會遠離他們。" -#: ../../faq/general.rst:439 +#: ../../faq/general.rst:438 msgid "" "There are also good IDEs for Python. IDLE is a cross-platform IDE for " "Python that is written in Python using Tkinter. Emacs users will be happy to " @@ -885,7 +885,7 @@ msgstr "" "式時存取互動式直譯器。要查看 Python 編輯環境的完整清單,請參閱 `Python wiki " "`_。" -#: ../../faq/general.rst:447 +#: ../../faq/general.rst:446 msgid "" "If you want to discuss Python's use in education, you may be interested in " "joining `the edu-sig mailing list \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -997,38 +997,38 @@ msgstr "" "型別相同。因此,要從使用 :func:`os.popen` 建立的管道 *p* 中讀取 *n* 個位元" "組,你需要使用 ``p.read(n)``。" -#: ../../faq/library.rst:623 +#: ../../faq/library.rst:545 msgid "How do I access the serial (RS232) port?" msgstr "如何存取序列 (RS232) 連接埠?" -#: ../../faq/library.rst:625 +#: ../../faq/library.rst:547 msgid "For Win32, OSX, Linux, BSD, Jython, IronPython:" msgstr "對於 Win32、OSX、Linux、BSD、Jython、IronPython:" -#: ../../faq/library.rst:627 +#: ../../faq/library.rst:549 msgid ":pypi:`pyserial`" msgstr ":pypi:`pyserial`" -#: ../../faq/library.rst:629 +#: ../../faq/library.rst:551 msgid "For Unix, see a Usenet post by Mitch Chapman:" msgstr "對於 Unix,請參閱 Mitch Chapman 的 Usenet 貼文:" -#: ../../faq/library.rst:631 +#: ../../faq/library.rst:553 msgid "https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com" msgstr "https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com" -#: ../../faq/library.rst:635 +#: ../../faq/library.rst:557 msgid "Why doesn't closing sys.stdout (stdin, stderr) really close it?" msgstr "為什麼關閉 sys.stdout (stdin, stderr) 並沒有真正關閉它?" -#: ../../faq/library.rst:637 +#: ../../faq/library.rst:559 msgid "" "Python :term:`file objects ` are a high-level layer of " "abstraction on low-level C file descriptors." msgstr "" "Python :term:`檔案物件 `\\ 是低階 C 檔案描述器的高階抽象層。" -#: ../../faq/library.rst:640 +#: ../../faq/library.rst:562 #, fuzzy msgid "" "For most file objects you create in Python via the built-in :func:`open` " @@ -1041,7 +1041,7 @@ msgstr "" "``f.close()`` 從 Python 的角度將 Python 檔案物件標記為已關閉,並安排關閉底層 " "C 檔案描述器。當 ``f`` 變成垃圾時,這也會自動發生在 ``f`` 的析構函式中。" -#: ../../faq/library.rst:646 +#: ../../faq/library.rst:568 #, fuzzy msgid "" "But stdin, stdout and stderr are treated specially by Python, because of the " @@ -1053,7 +1053,7 @@ msgstr "" "態。運行 ``sys.stdout.close()`` 將 Python 級檔案物件標記為已關閉,但是 * " "not* 關閉關聯的 C 檔案描述器。" -#: ../../faq/library.rst:651 +#: ../../faq/library.rst:573 #, fuzzy msgid "" "To close the underlying C file descriptor for one of these three, you should " @@ -1063,7 +1063,7 @@ msgstr "" "要關閉這三個之一的底層 C 檔案描述器,你應該首先確定這是你真正想要做的(例如," "你可能會混淆試圖執行 I/O 的擴充模組)。如果是,使用 :func:`os.close`: ::" -#: ../../faq/library.rst:655 +#: ../../faq/library.rst:577 msgid "" "os.close(stdin.fileno())\n" "os.close(stdout.fileno())\n" @@ -1073,19 +1073,19 @@ msgstr "" "os.close(stdout.fileno())\n" "os.close(stderr.fileno())" -#: ../../faq/library.rst:659 +#: ../../faq/library.rst:581 msgid "Or you can use the numeric constants 0, 1 and 2, respectively." msgstr "或者你可以分別使用數字常數 0、1 和 2。" -#: ../../faq/library.rst:663 +#: ../../faq/library.rst:585 msgid "Network/Internet Programming" msgstr "網路 (Network)/網際網路 (Internet) 程式" -#: ../../faq/library.rst:666 +#: ../../faq/library.rst:588 msgid "What WWW tools are there for Python?" msgstr "Python 有哪些 WWW 工具?" -#: ../../faq/library.rst:668 +#: ../../faq/library.rst:590 #, fuzzy msgid "" "See the chapters titled :ref:`internet` and :ref:`netdata` in the Library " @@ -1095,7 +1095,7 @@ msgstr "" "請參閱函式庫參考手冊中標題為 :ref:`internet` 和 :ref:`netdata` 的章節。 " "Python 有許多模組可以幫助你構建伺服器端和用戶端 Web 系統。" -#: ../../faq/library.rst:674 +#: ../../faq/library.rst:596 #, fuzzy msgid "" "A summary of available frameworks is maintained by Paul Boddie at https://" @@ -1104,11 +1104,11 @@ msgstr "" "可用框架的摘要由 Paul Boddie 在 https://wiki.python.org/moin/" "WebProgramming\\ 維護。" -#: ../../faq/library.rst:679 +#: ../../faq/library.rst:601 msgid "What module should I use to help with generating HTML?" msgstr "我應該使用什麼模組來輔助產生 HTML?" -#: ../../faq/library.rst:683 +#: ../../faq/library.rst:605 #, fuzzy msgid "" "You can find a collection of useful links on the `Web Programming wiki page " @@ -1117,15 +1117,15 @@ msgstr "" "你可以在 \"Web 編寫程式維基頁面 \" 上找到一組有用的鏈接。" -#: ../../faq/library.rst:688 +#: ../../faq/library.rst:610 msgid "How do I send mail from a Python script?" msgstr "如何從 Python 腳本發送郵件?" -#: ../../faq/library.rst:690 +#: ../../faq/library.rst:612 msgid "Use the standard library module :mod:`smtplib`." msgstr "使用標準函式庫模組 :mod:`smtplib`。" -#: ../../faq/library.rst:692 +#: ../../faq/library.rst:614 #, fuzzy msgid "" "Here's a very simple interactive mail sender that uses it. This method will " @@ -1134,7 +1134,7 @@ msgstr "" "這是一個使用它的非常簡單的交互式郵件發件人。此方法適用於任何支援 SMTP 偵聽器" "的主機。: ::" -#: ../../faq/library.rst:695 +#: ../../faq/library.rst:617 msgid "" "import sys, smtplib\n" "\n" @@ -1170,7 +1170,7 @@ msgstr "" "server.sendmail(fromaddr, toaddrs, msg)\n" "server.quit()" -#: ../../faq/library.rst:712 +#: ../../faq/library.rst:634 #, fuzzy msgid "" "A Unix-only alternative uses sendmail. The location of the sendmail program " @@ -1182,7 +1182,7 @@ msgstr "" "時是 \"/usr/lib/sendmail\" ,有時是 \"/usr/sbin/sendmail\" 。 sendmail 手冊頁" "將幫助你。這是一些示例程式碼: ::" -#: ../../faq/library.rst:717 +#: ../../faq/library.rst:639 msgid "" "import os\n" "\n" @@ -1198,18 +1198,18 @@ msgid "" " print(\"Sendmail exit status\", sts)" msgstr "" -#: ../../faq/library.rst:732 +#: ../../faq/library.rst:654 #, fuzzy msgid "How do I avoid blocking in the connect() method of a socket?" msgstr "如何避免阻塞 socket 的 connect() 方法?" -#: ../../faq/library.rst:734 +#: ../../faq/library.rst:656 msgid "" "The :mod:`select` module is commonly used to help with asynchronous I/O on " "sockets." msgstr ":mod:`select` 模組通常用於幫助處理 socket 上的非同步 I/O。" -#: ../../faq/library.rst:737 +#: ../../faq/library.rst:659 #, fuzzy msgid "" "To prevent the TCP connect from blocking, you can set the socket to non-" @@ -1225,7 +1225,7 @@ msgstr "" "其中包含錯誤號 ``.errno``。 ``errno.EINPROGRESS`` 表示連接正在進行中,但尚未" "完成。不同的作業系統將回傳不同的值,因此你將不得不檢查系統回傳的內容。" -#: ../../faq/library.rst:745 +#: ../../faq/library.rst:667 #, fuzzy msgid "" "You can use the :meth:`~socket.socket.connect_ex` method to avoid creating " @@ -1239,7 +1239,7 @@ msgstr "" "``errno.EISCONN`` 表示你已連接 - 或者你可以將此 socket 傳遞" "給 :meth:`select.select` 檢查它是否可寫。" -#: ../../faq/library.rst:753 +#: ../../faq/library.rst:675 msgid "" "The :mod:`asyncio` module provides a general purpose single-threaded and " "concurrent asynchronous library, which can be used for writing non-blocking " @@ -1250,19 +1250,19 @@ msgstr "" "網路程式碼。第三方 `Twisted `_ 函式庫是一種流行且功能豐" "富的替代方案。" -#: ../../faq/library.rst:761 +#: ../../faq/library.rst:683 msgid "Databases" msgstr "資料庫" -#: ../../faq/library.rst:764 +#: ../../faq/library.rst:686 msgid "Are there any interfaces to database packages in Python?" msgstr "Python 中是否有任何資料庫套件的介面?" -#: ../../faq/library.rst:766 +#: ../../faq/library.rst:688 msgid "Yes." msgstr "有的。" -#: ../../faq/library.rst:768 +#: ../../faq/library.rst:690 #, fuzzy msgid "" "Interfaces to disk-based hashes such as :mod:`DBM ` and :mod:`GDBM " @@ -1274,7 +1274,7 @@ msgstr "" "含在標準 Python 中。還有 :mod:`sqlite3` 模組,它提供了一個輕量級的基於磁盤的" "關係資料庫。" -#: ../../faq/library.rst:773 +#: ../../faq/library.rst:695 #, fuzzy msgid "" "Support for most relational databases is available. See the " @@ -1284,11 +1284,11 @@ msgstr "" "支援大多數關係資料庫。有關詳細資訊,請參閱 `DatabaseProgramming 維基頁面 " "`_。" -#: ../../faq/library.rst:779 +#: ../../faq/library.rst:701 msgid "How do you implement persistent objects in Python?" msgstr "你如何在 Python 中實作持久性物件?" -#: ../../faq/library.rst:781 +#: ../../faq/library.rst:703 #, fuzzy msgid "" "The :mod:`pickle` library module solves this in a very general way (though " @@ -1300,21 +1300,21 @@ msgstr "" "儲諸如打開的檔案、socket 或窗口之類的東西),而 :mod:`shelve` 函式庫模組使用 " "pickle 和 (g) dbm 建立包含任意 Python 物件的持久對映。" -#: ../../faq/library.rst:788 +#: ../../faq/library.rst:710 msgid "Mathematics and Numerics" msgstr "數學和數值" -#: ../../faq/library.rst:791 +#: ../../faq/library.rst:713 msgid "How do I generate random numbers in Python?" msgstr "如何在 Python 中生成隨機數?" -#: ../../faq/library.rst:793 +#: ../../faq/library.rst:715 msgid "" "The standard module :mod:`random` implements a random number generator. " "Usage is simple::" msgstr "標準模組 :mod:`random` 實作了一個隨機數生成器。用法很簡單: ::" -#: ../../faq/library.rst:796 +#: ../../faq/library.rst:718 msgid "" "import random\n" "random.random()" @@ -1322,41 +1322,41 @@ msgstr "" "import random\n" "random.random()" -#: ../../faq/library.rst:799 +#: ../../faq/library.rst:721 msgid "This returns a random floating-point number in the range [0, 1)." msgstr "這將回傳 [0, 1) 範圍內的隨機浮點數。" -#: ../../faq/library.rst:801 +#: ../../faq/library.rst:723 msgid "" "There are also many other specialized generators in this module, such as:" msgstr "該模組中還有許多其他專用生成器,例如:" -#: ../../faq/library.rst:803 +#: ../../faq/library.rst:725 msgid "``randrange(a, b)`` chooses an integer in the range [a, b)." msgstr "``randrange(a, b)`` 會選擇 [a, b) 範圍內的一個整數。" -#: ../../faq/library.rst:804 +#: ../../faq/library.rst:726 msgid "``uniform(a, b)`` chooses a floating-point number in the range [a, b)." msgstr "``uniform(a, b)`` 會選擇 [a, b) 範圍內的浮點數。" -#: ../../faq/library.rst:805 +#: ../../faq/library.rst:727 msgid "" "``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution." msgstr "``normalvariate(mean, sdev)`` 對常態(高斯)分佈進行取樣 (sample)。" -#: ../../faq/library.rst:807 +#: ../../faq/library.rst:729 msgid "Some higher-level functions operate on sequences directly, such as:" msgstr "一些更高階的函式會直接對序列進行操作,例如:" -#: ../../faq/library.rst:809 +#: ../../faq/library.rst:731 msgid "``choice(S)`` chooses a random element from a given sequence." msgstr "``choice(S)`` 會從給定序列中選擇一個隨機元素。" -#: ../../faq/library.rst:810 +#: ../../faq/library.rst:732 msgid "``shuffle(L)`` shuffles a list in-place, i.e. permutes it randomly." msgstr "``shuffle(L)`` 會原地 (in-place) 打亂 list,即隨機排列它。" -#: ../../faq/library.rst:812 +#: ../../faq/library.rst:734 msgid "" "There's also a ``Random`` class you can instantiate to create independent " "multiple random number generators." diff --git a/faq/programming.po b/faq/programming.po index 33bec77f43e..d06dc53f9ec 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-06 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-04-25 14:17+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,8 +45,8 @@ msgstr "有的。" #: ../../faq/programming.rst:19 msgid "" -"Several debuggers for Python are described below, and the built-in function :" -"func:`breakpoint` allows you to drop into any of them." +"Several debuggers for Python are described below, and the built-in " +"function :func:`breakpoint` allows you to drop into any of them." msgstr "" "下面描述了幾個 Python 除錯器,內建函式 :func:`breakpoint` 允許你進入其中任何" "一個。" @@ -340,10 +340,11 @@ msgid "" "a component of an imported module. This clutter would defeat the usefulness " "of the ``global`` declaration for identifying side-effects." msgstr "" -"雖然起初有點令人驚訝,但稍加考慮就可以解釋這一點。一方面,要求 :keyword:" -"`global` 分配的變數可以防止意外的副作用。另一方面,如果所有全域參照都需要 " -"``global``,那麼你將一直使用 ``global``。你必須將對內建函式或引入模組的組件的" -"每個參照聲明為全域。這種混亂會破壞用於識別副作用的 ``global`` 聲明的有用性。" +"雖然起初有點令人驚訝,但稍加考慮就可以解釋這一點。一方面,要" +"求 :keyword:`global` 分配的變數可以防止意外的副作用。另一方面,如果所有全域參" +"照都需要 ``global``,那麼你將一直使用 ``global``。你必須將對內建函式或引入模" +"組的組件的每個參照聲明為全域。這種混亂會破壞用於識別副作用的 ``global`` 聲明" +"的有用性。" #: ../../faq/programming.rst:208 msgid "" @@ -556,8 +557,8 @@ msgstr "如果你按以下順序引入模組,這是一個很好的做法:" #: ../../faq/programming.rst:301 msgid "" -"standard library modules -- e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, :" -"mod:`re`" +"standard library modules -- " +"e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, :mod:`re`" msgstr "" "標準函式庫模組 —— 例如 :mod:`sys`、:mod:`os`、:mod:`argparse`、:mod:`re`" @@ -637,8 +638,8 @@ msgstr "" "入移動到局部範圍內,例如在函式定義內。如果根據程式的執行方式,許多引入是不必" "要的,則此技術特別有用。如果模組僅在該函式中使用,你可能還想將引入移動到該函" "式中。請注意,由於模組的一次性初始化,第一次載入模組可能很昂貴,但多次載入模" -"組實際上是免費的,只需幾次字典查詢。即使模組名稱超出範圍,該模組也可能在 :" -"data:`sys.modules` 中可用。" +"組實際上是免費的,只需幾次字典查詢。即使模組名稱超出範圍,該模組也可能" +"在 :data:`sys.modules` 中可用。" #: ../../faq/programming.rst:338 msgid "Why are default values shared between objects?" @@ -809,13 +810,13 @@ msgstr "引數 (arguments) 和參數 (parameters) 有什麼區別?" msgid "" ":term:`Parameters ` are defined by the names that appear in a " "function definition, whereas :term:`arguments ` are the values " -"actually passed to a function when calling it. Parameters define what :term:" -"`kind of arguments ` a function can accept. For example, given " -"the function definition::" +"actually passed to a function when calling it. Parameters define " +"what :term:`kind of arguments ` a function can accept. For " +"example, given the function definition::" msgstr "" ":term:`參數 `\\ 由出現在函式定義中的名稱定義,而\\ :term:`引數 " -"`\\ 是呼叫函式時實際傳遞給函式的值。參數定義函式可以接受的\\ :term:" -"`引數種類 `。例如,給定以下函式定義: ::" +"`\\ 是呼叫函式時實際傳遞給函式的值。參數定義函式可以接受的" +"\\ :term:`引數種類 `。例如,給定以下函式定義: ::" #: ../../faq/programming.rst:423 msgid "" @@ -894,10 +895,11 @@ msgid "" msgstr "list 是 :term:`mutable`,這意味著你可以變更它們的內容。" #: ../../faq/programming.rst:457 +#, fuzzy msgid "" -"After the call to :meth:`!append`, the content of the mutable object has " -"changed from ``[]`` to ``[10]``. Since both the variables refer to the same " -"object, using either name accesses the modified value ``[10]``." +"After the call to :meth:`~sequence.append`, the content of the mutable " +"object has changed from ``[]`` to ``[10]``. Since both the variables refer " +"to the same object, using either name accesses the modified value ``[10]``." msgstr "" "在呼叫 :meth:`!append` 之後,可變物件的內容從 ``[]`` 變成了 ``[10]``。由於這" "兩個變數都參照同一個物件,因此使用任一名稱都可以存取修改後的值 ``[10]``。" @@ -956,9 +958,9 @@ msgstr "" "一些操作(例如 ``y.append(10)`` 和 ``y.sort()``)會改變物件,而表面上相似的操" "作(例如 ``y = y + [10]`` 和: func:`sorted(y) `) 建立一個新物件。通" "常在 Python 中(以及在標準函式庫中的所有情況下)改變物件的方法將回傳 " -"``None`` 以幫助避免混淆這兩種型別的操作。因此,如果你錯誤地編寫了 ``y." -"sort()``,認為它會為你提供 ``y`` 的排序副本,那麼你最終會得到 ``None``,這可" -"能會導致你的程式生成一個容易診斷的錯誤。" +"``None`` 以幫助避免混淆這兩種型別的操作。因此,如果你錯誤地編寫了 " +"``y.sort()``,認為它會為你提供 ``y`` 的排序副本,那麼你最終會得到 ``None``," +"這可能會導致你的程式生成一個容易診斷的錯誤。" #: ../../faq/programming.rst:488 #, fuzzy @@ -1292,8 +1294,8 @@ msgstr "" #: ../../faq/programming.rst:641 #, fuzzy msgid "" -"Some objects can be copied more easily. Dictionaries have a :meth:`~dict." -"copy` method::" +"Some objects can be copied more easily. Dictionaries have " +"a :meth:`~dict.copy` method::" msgstr "可以更輕鬆地複製某些物件。字典有一個 :meth:`~dict.copy` 方法: ::" #: ../../faq/programming.rst:644 @@ -1562,8 +1564,8 @@ msgid "" "only parameters. Its documentation looks like this::" msgstr "" "函式引數list中的斜線表示它前面的參數是位置參數。僅位置參數是沒有外部可用名稱" -"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例如,:" -"func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" +"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例" +"如,:func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" #: ../../faq/programming.rst:786 msgid "" @@ -1585,8 +1587,8 @@ msgid "" "positional-only. Thus, calling :func:`divmod` with keyword arguments would " "lead to an error::" msgstr "" -"參數串列最後的斜線表示兩個參數都是僅限位置參數。因此使用關鍵字引數呼叫 :func:" -"`divmod` 會導致錯誤: ::" +"參數串列最後的斜線表示兩個參數都是僅限位置參數。因此使用關鍵字引數呼" +"叫 :func:`divmod` 會導致錯誤: ::" #: ../../faq/programming.rst:796 msgid "" @@ -1701,8 +1703,8 @@ msgstr "如何取得 int 文字屬性而不是 SyntaxError?" #: ../../faq/programming.rst:850 msgid "" -"Trying to lookup an ``int`` literal attribute in the normal manner gives a :" -"exc:`SyntaxError` because the period is seen as a decimal point::" +"Trying to lookup an ``int`` literal attribute in the normal manner gives " +"a :exc:`SyntaxError` because the period is seen as a decimal point::" msgstr "" "嘗試以正常方式查找 ``int`` 字面值屬性會給出一個 :exc:`SyntaxError`,因為句點" "被視為小數點: ::" @@ -1738,8 +1740,8 @@ msgid "" "``int('144') == 144``. Similarly, :func:`float` converts to a floating-" "point number, e.g. ``float('144') == 144.0``." msgstr "" -"對於整數,使用內建的 int 型別建構函式,例如``int('144') == 144``。同樣,:" -"func:`float` 轉換為浮點數,例如``浮動('144')== 144.0``。" +"對於整數,使用內建的 int 型別建構函式,例如``int('144') == 144``。同" +"樣,:func:`float` 轉換為浮點數,例如``浮動('144')== 144.0``。" #: ../../faq/programming.rst:875 #, fuzzy @@ -1793,14 +1795,14 @@ msgid "" "in type constructor :func:`str`. If you want a hexadecimal or octal " "representation, use the built-in functions :func:`hex` or :func:`oct`. For " "fancy formatting, see the :ref:`f-strings` and :ref:`formatstrings` " -"sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}\"." -"format(1.0/3.0)`` yields ``'0.333'``." +"sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}" +"\".format(1.0/3.0)`` yields ``'0.333'``." msgstr "" -"例如,要將數字 ``144`` 轉換為字串 ``'144'``,請使用內建型別建構函式 :func:" -"`str`。如果你想要十六進製或八進製表示,請使用內建函式 :func:`hex` 或 :func:" -"`oct`。對於精美的格式,請參閱:ref:`f-strings` 和:ref:`formatstrings` 部分,例" -"如``\"{:04d}\".format(144)`` 產生 ``'0144'`` 和 ``\"{:.3f}\"." -"format(1.0/3.0)`` 產生 ``'0.333'`` ." +"例如,要將數字 ``144`` 轉換為字串 ``'144'``,請使用內建型別建構函" +"式 :func:`str`。如果你想要十六進製或八進製表示,請使用內建函式 :func:`hex` " +"或 :func:`oct`。對於精美的格式,請參閱:ref:`f-strings` " +"和:ref:`formatstrings` 部分,例如``\"{:04d}\".format(144)`` 產生 ``'0144'`` " +"和 ``\"{:.3f}\".format(1.0/3.0)`` 產生 ``'0.333'`` ." #: ../../faq/programming.rst:906 msgid "How do I modify a string in place?" @@ -2017,15 +2019,15 @@ msgstr "不是這樣的。" msgid "" "For simple input parsing, the easiest approach is usually to split the line " "into whitespace-delimited words using the :meth:`~str.split` method of " -"string objects and then convert decimal strings to numeric values using :" -"func:`int` or :func:`float`. :meth:`!split` supports an optional \"sep\" " -"parameter which is useful if the line uses something other than whitespace " -"as a separator." +"string objects and then convert decimal strings to numeric values " +"using :func:`int` or :func:`float`. :meth:`!split` supports an optional " +"\"sep\" parameter which is useful if the line uses something other than " +"whitespace as a separator." msgstr "" "對於簡單的輸入解析,最簡單的方法通常是使用字串物件的 :meth:`~str.split` 方法" -"將行拆分為以空格分隔的單詞,然後使用 :func:`int` 或將十進製字串轉換為數值:" -"func:`浮動`。 :meth:`!split` 支援可選的 \"sep\" 參數,如果該行使用空格以外的" -"其他內容作為分隔符,該參數很有用。" +"將行拆分為以空格分隔的單詞,然後使用 :func:`int` 或將十進製字串轉換為數" +"值:func:`浮動`。 :meth:`!split` 支援可選的 \"sep\" 參數,如果該行使用空格以外" +"的其他內容作為分隔符,該參數很有用。" #: ../../faq/programming.rst:1019 #, fuzzy @@ -2175,8 +2177,8 @@ msgid "" "You should always find the hot spots in your program *before* attempting to " "optimize any code (see the :mod:`profile` module)." msgstr "" -"在嘗試最佳化任何程式碼\\ *之前*,你應該始終找到程式中的熱點(請參閱 :mod:" -"`profile` 模組)。" +"在嘗試最佳化任何程式碼\\ *之前*,你應該始終找到程式中的熱點(請參" +"閱 :mod:`profile` 模組)。" #: ../../faq/programming.rst:1084 #, fuzzy @@ -2231,9 +2233,9 @@ msgid "" "When the standard library provides a primitive for doing something, it is " "likely (although not guaranteed) to be faster than any alternative you may " "come up with. This is doubly true for primitives written in C, such as " -"builtins and some extension types. For example, be sure to use either the :" -"meth:`list.sort` built-in method or the related :func:`sorted` function to " -"do sorting (and see the :ref:`sortinghowto` for examples of moderately " +"builtins and some extension types. For example, be sure to use either " +"the :meth:`list.sort` built-in method or the related :func:`sorted` function " +"to do sorting (and see the :ref:`sortinghowto` for examples of moderately " "advanced usage)." msgstr "" "當標準函式庫提供用於執行某些操作的原語時,它很可能(儘管不能保證)比你可能想" @@ -2269,8 +2271,8 @@ msgstr "" "如果你已經達到純 Python 所能允許的極限,可以使用一些工具讓你走得更遠。例如," "`Cython `_ 可以將稍微修改過的 Python 程式碼編譯成 C 擴" "充,並且可以在許多不同的平台上使用。Cython 可以利用編譯(和可選的型別註釋)使" -"你的程式碼比解釋時快得多。如果你對自己的 C 程式設計技能有信心,你也可以\\ :" -"ref:`自己編寫一個 C 擴充模組 `。" +"你的程式碼比解釋時快得多。如果你對自己的 C 程式設計技能有信心,你也可以" +"\\ :ref:`自己編寫一個 C 擴充模組 `。" #: ../../faq/programming.rst:1125 msgid "" @@ -2303,8 +2305,8 @@ msgid "" "To accumulate many :class:`str` objects, the recommended idiom is to place " "them into a list and call :meth:`str.join` at the end::" msgstr "" -"要累積許多 :class:`str` 物件,推薦的習慣用法是將它們放入list中並在末尾呼叫 :" -"meth:`str.join`: ::" +"要累積許多 :class:`str` 物件,推薦的習慣用法是將它們放入list中並在末尾呼" +"叫 :meth:`str.join`: ::" #: ../../faq/programming.rst:1141 msgid "" @@ -2476,8 +2478,8 @@ msgstr "" #: ../../faq/programming.rst:1220 msgid "" -"If all elements of the list may be used as set keys (i.e. they are all :term:" -"`hashable`) this is often faster ::" +"If all elements of the list may be used as set keys (i.e. they are " +"all :term:`hashable`) this is often faster ::" msgstr "" "如果串列的所有元素都可以做為集合的鍵(即它們都必須是 :term:`hashable`),那這" "通常會更快: ::" @@ -2673,8 +2675,8 @@ msgstr "如何將方法或函式應用於物件序列?" #: ../../faq/programming.rst:1327 #, fuzzy msgid "" -"To call a method or function and accumulate the return values is a list, a :" -"term:`list comprehension` is an elegant solution::" +"To call a method or function and accumulate the return values is a list, " +"a :term:`list comprehension` is an elegant solution::" msgstr "" "呼叫一個方法或函式並累積回傳值是一個list,一個 :term:`list comprehension` 是" "一個優雅的解決方案: ::" @@ -2829,14 +2831,15 @@ msgid "" "an :meth:`~object.__iadd__` magic method, it gets called when the ``+=`` " "augmented assignment is executed, and its return value is what gets used in " "the assignment statement; and (b) for lists, :meth:`!__iadd__` is equivalent " -"to calling :meth:`!extend` on the list and returning the list. That's why " -"we say that for lists, ``+=`` is a \"shorthand\" for :meth:`!list.extend`::" +"to calling :meth:`~sequence.extend` on the list and returning the list. " +"That's why we say that for lists, ``+=`` is a \"shorthand\" " +"for :meth:`list.extend`::" msgstr "" -"要了解為什麼會發生這種情況,你需要知道 (a) 如果一個物件實作了一個 :meth:" -"`~object.__iadd__` 魔術方法,它會在執行 ``+=`` 增廣賦值時被呼叫,並且它的回傳" -"value 是賦值陳述式中使用的值; (b) 對於list,:meth:`!__iadd__` 相當於在list上" -"呼叫 :meth:`!extend` 並回傳list。這就是為什麼我們說對於list,``+=`` 是 :meth:" -"`!list.extend` 的「簡寫」: ::" +"要了解為什麼會發生這種情況,你需要知道 (a) 如果一個物件實作了一" +"個 :meth:`~object.__iadd__` 魔術方法,它會在執行 ``+=`` 增廣賦值時被呼叫,並" +"且它的回傳value 是賦值陳述式中使用的值; (b) 對於list,:meth:`!__iadd__` 相當" +"於在list上呼叫 :meth:`!extend` 並回傳list。這就是為什麼我們說對於list," +"``+=`` 是 :meth:`!list.extend` 的「簡寫」: ::" #: ../../faq/programming.rst:1404 msgid "" @@ -3007,8 +3010,8 @@ msgstr "什麼是方法 (method)?" #: ../../faq/programming.rst:1481 #, fuzzy msgid "" -"A method is a function on some object ``x`` that you normally call as ``x." -"name(arguments...)``. Methods are defined as functions inside the class " +"A method is a function on some object ``x`` that you normally call as " +"``x.name(arguments...)``. Methods are defined as functions inside the class " "definition::" msgstr "" "方法是一些物件 ``x`` 上的函式,你通常將其稱為 ``x.name(arguments...)`` 。方法" @@ -3067,15 +3070,15 @@ msgstr "" #: ../../faq/programming.rst:1511 msgid "" -"Note that :func:`isinstance` also checks for virtual inheritance from an :" -"term:`abstract base class`. So, the test will return ``True`` for a " +"Note that :func:`isinstance` also checks for virtual inheritance from " +"an :term:`abstract base class`. So, the test will return ``True`` for a " "registered class even if hasn't directly or indirectly inherited from it. " "To test for \"true inheritance\", scan the :term:`MRO` of the class:" msgstr "" "請注意,:func:`isinstance` 還會檢查來自\\ :term:`抽象基底類別 (abstract base " "class) ` 的虛擬繼承。因此對已註冊類別的檢驗會回傳 " -"``True``,即使沒有直接或間接繼承自它。要測試「真正繼承」,請掃描該類別的 :" -"term:`MRO`:" +"``True``,即使沒有直接或間接繼承自它。要測試「真正繼承」,請掃描該類別" +"的 :term:`MRO`:" #: ../../faq/programming.rst:1516 msgid "" @@ -3244,29 +3247,29 @@ msgstr "" #, fuzzy msgid "" "Here the ``UpperOut`` class redefines the ``write()`` method to convert the " -"argument string to uppercase before calling the underlying ``self._outfile." -"write()`` method. All other methods are delegated to the underlying ``self." -"_outfile`` object. The delegation is accomplished via the :meth:`~object." -"__getattr__` method; consult :ref:`the language reference ` for more information about controlling attribute access." +"argument string to uppercase before calling the underlying " +"``self._outfile.write()`` method. All other methods are delegated to the " +"underlying ``self._outfile`` object. The delegation is accomplished via " +"the :meth:`~object.__getattr__` method; consult :ref:`the language reference " +"` for more information about controlling attribute access." msgstr "" -"這裡的 ``UpperOut`` 類別重新定義了``write()`` 方法,在呼叫底層的``self." -"_outfile.write()`` 方法之前將引數字串轉換為大寫。所有其他方法都委託給底層的 " -"``self._outfile`` 物件。委託是透過 :meth:`~object.__getattr__` 方法完成的;有" -"關控制屬性存取的更多資訊,請參閱語言參考 。" +"這裡的 ``UpperOut`` 類別重新定義了``write()`` 方法,在呼叫底層的" +"``self._outfile.write()`` 方法之前將引數字串轉換為大寫。所有其他方法都委託給" +"底層的 ``self._outfile`` 物件。委託是透過 :meth:`~object.__getattr__` 方法完" +"成的;有關控制屬性存取的更多資訊,請參閱語言參考 。" #: ../../faq/programming.rst:1605 #, fuzzy msgid "" "Note that for more general cases delegation can get trickier. When " -"attributes must be set as well as retrieved, the class must define a :meth:" -"`~object.__setattr__` method too, and it must do so carefully. The basic " -"implementation of :meth:`!__setattr__` is roughly equivalent to the " +"attributes must be set as well as retrieved, the class must define " +"a :meth:`~object.__setattr__` method too, and it must do so carefully. The " +"basic implementation of :meth:`!__setattr__` is roughly equivalent to the " "following::" msgstr "" "請注意,對於更一般的情況,委託可能會變得更加棘手。當必須設定和檢索屬性時,該" -"類別也必須定義一個 :meth:`~object.__setattr__` 方法,而且必須小心謹慎。 :" -"meth:`!__setattr__` 的基本實作大致等同於以下: ::" +"類別也必須定義一個 :meth:`~object.__setattr__` 方法,而且必須小心謹" +"慎。 :meth:`!__setattr__` 的基本實作大致等同於以下: ::" #: ../../faq/programming.rst:1610 msgid "" @@ -3284,8 +3287,9 @@ msgstr "" #: ../../faq/programming.rst:1616 msgid "" -"Many :meth:`~object.__setattr__` implementations call :meth:`!object." -"__setattr__` to set an attribute on self without causing infinite recursion::" +"Many :meth:`~object.__setattr__` implementations call :meth:`!" +"object.__setattr__` to set an attribute on self without causing infinite " +"recursion::" msgstr "" "許多 :meth:`~object.__setattr__` 的實作會呼叫 :meth:`!object.__setattr__` 以" "設定 self 的屬性,而不會導致無限遞迴。" @@ -3304,8 +3308,8 @@ msgstr "" #: ../../faq/programming.rst:1624 msgid "" -"Alternatively, it is possible to set attributes by inserting entries into :" -"attr:`self.__dict__ ` directly." +"Alternatively, it is possible to set attributes by inserting entries " +"into :attr:`self.__dict__ ` directly." msgstr "" #: ../../faq/programming.rst:1629 @@ -3624,9 +3628,9 @@ msgstr "這有幾個可能的原因。" #: ../../faq/programming.rst:1782 msgid "" -"The :keyword:`del` statement does not necessarily call :meth:`~object." -"__del__` -- it simply decrements the object's reference count, and if this " -"reaches zero :meth:`!__del__` is called." +"The :keyword:`del` statement does not necessarily " +"call :meth:`~object.__del__` -- it simply decrements the object's reference " +"count, and if this reaches zero :meth:`!__del__` is called." msgstr "" ":keyword:`del` 陳述式不一定會呼叫 :meth:`~object.__del__` -- 它只是減少物件的" "參照計數,如果達到零則呼叫 :meth:`!__del__`。" @@ -3685,8 +3689,8 @@ msgid "" "Finally, if your :meth:`!__del__` method raises an exception, a warning " "message is printed to :data:`sys.stderr`." msgstr "" -"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告訊息印出到 :data:" -"`sys.stderr`。" +"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告訊息印出" +"到 :data:`sys.stderr`。" #: ../../faq/programming.rst:1822 msgid "How do I get a list of all instances of a given class?" @@ -3865,8 +3869,8 @@ msgid "" "implement a method that behaves like :meth:`dict.pop`:" msgstr "" "當 ``None`` 是有效輸入值時,檢測可選引數可能會很棘手。在這些情況下,你可以建" -"立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似於 :" -"meth:`dict.pop` 的方法:" +"立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似" +"於 :meth:`dict.pop` 的方法:" #: ../../faq/programming.rst:1917 msgid "" @@ -3903,8 +3907,8 @@ msgstr "" #: ../../faq/programming.rst:1934 msgid "" -"For example, here is the implementation of :meth:`!collections.abc.Sequence." -"__contains__`::" +"For example, here is the implementation of :meth:`!" +"collections.abc.Sequence.__contains__`::" msgstr "" "例如,以下是 :meth:`!collections.abc.Sequence.__contains__` 的實作: ::" @@ -3935,9 +3939,9 @@ msgid "" "*after* an instance is created, which is too late to alter data in an " "immutable instance." msgstr "" -"當對不可變型別進行子類別化時,覆蓋 :meth:`~object.__new__` 方法而不是 :meth:" -"`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法更改不可變" -"實例中的資料。" +"當對不可變型別進行子類別化時,覆蓋 :meth:`~object.__new__` 方法而不" +"是 :meth:`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法" +"更改不可變實例中的資料。" #: ../../faq/programming.rst:1952 msgid "" @@ -4020,12 +4024,14 @@ msgstr "如何快取方法呼叫?" #: ../../faq/programming.rst:1997 #, fuzzy msgid "" -"The two principal tools for caching methods are :func:`functools." -"cached_property` and :func:`functools.lru_cache`. The former stores results " -"at the instance level and the latter at the class level." +"The two principal tools for caching methods " +"are :func:`functools.cached_property` and :func:`functools.lru_cache`. The " +"former stores results at the instance level and the latter at the class " +"level." msgstr "" -"快取方法的兩個主要工具是 func:`functools.cached_property` 和 :func:" -"`functools.lru_cache`。前者在實例級別儲存結果,後者在類別級別儲存結果。" +"快取方法的兩個主要工具是 func:`functools.cached_property` " +"和 :func:`functools.lru_cache`。前者在實例級別儲存結果,後者在類別級別儲存結" +"果。" #: ../../faq/programming.rst:2002 #, fuzzy @@ -4110,12 +4116,13 @@ msgstr "" #, fuzzy msgid "" "To make the *lru_cache* approach work when the *station_id* is mutable, the " -"class needs to define the :meth:`~object.__eq__` and :meth:`~object." -"__hash__` methods so that the cache can detect relevant attribute updates::" +"class needs to define the :meth:`~object.__eq__` " +"and :meth:`~object.__hash__` methods so that the cache can detect relevant " +"attribute updates::" msgstr "" -"要在 *station_id* 可變時使 *lru_cache* 方法起作用,該類別需要定義 :meth:" -"`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測相關屬性更" -"新: ::" +"要在 *station_id* 可變時使 *lru_cache* 方法起作用,該類別需要定" +"義 :meth:`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測" +"相關屬性更新: ::" #: ../../faq/programming.rst:2053 msgid "" @@ -4162,8 +4169,8 @@ msgstr "" "第一次引入模組時(或者源檔案自建立目前編譯檔案後發生更改時)應在 " "``__pycache__`` 的子目錄中建立包含編譯程式碼的 ``.pyc`` 檔案包含 .py 檔案的目" "錄。 ``.pyc`` 檔案的檔案名以與``.py`` 檔案相同的名稱開頭,以``.pyc`` 結尾,中" -"間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參閱 :" -"pep:`3147`。)" +"間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參" +"閱 :pep:`3147`。)" #: ../../faq/programming.rst:2088 #, fuzzy @@ -4194,10 +4201,10 @@ msgstr "" #: ../../faq/programming.rst:2098 #, fuzzy msgid "" -"Running Python on a top level script is not considered an import and no ``." -"pyc`` will be created. For example, if you have a top-level module ``foo." -"py`` that imports another module ``xyz.py``, when you run ``foo`` (by typing " -"``python foo.py`` as a shell command), a ``.pyc`` will be created for " +"Running Python on a top level script is not considered an import and no " +"``.pyc`` will be created. For example, if you have a top-level module " +"``foo.py`` that imports another module ``xyz.py``, when you run ``foo`` (by " +"typing ``python foo.py`` as a shell command), a ``.pyc`` will be created for " "``xyz`` because ``xyz`` is imported, but no ``.pyc`` file will be created " "for ``foo`` since ``foo.py`` isn't being imported." msgstr "" @@ -4208,9 +4215,9 @@ msgstr "" #: ../../faq/programming.rst:2105 msgid "" -"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." -"pyc`` file for a module that is not imported -- you can, using the :mod:" -"`py_compile` and :mod:`compileall` modules." +"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a " +"``.pyc`` file for a module that is not imported -- you can, using " +"the :mod:`py_compile` and :mod:`compileall` modules." msgstr "" "如果你需要為 ``foo`` 建立一個 ``.pyc`` 檔案 —— 也就是說,要為一個未引入的模組" "建立一個 ``.pyc`` 檔案 —— 你可以使用 :mod:`py_compile` 和 :mod:`compileall` " @@ -4388,11 +4395,11 @@ msgstr "此問題有(至少)三種可能的解決方法。" #: ../../faq/programming.rst:2178 #, fuzzy msgid "" -"Guido van Rossum recommends avoiding all uses of ``from import ..." -"``, and placing all code inside functions. Initializations of global " -"variables and class variables should use constants or built-in functions " -"only. This means everything from an imported module is referenced as " -"``.``." +"Guido van Rossum recommends avoiding all uses of ``from " +"import ...``, and placing all code inside functions. Initializations of " +"global variables and class variables should use constants or built-in " +"functions only. This means everything from an imported module is referenced " +"as ``.``." msgstr "" "Guido van Rossum 建議避免使用``from import ...``,並將所有程式碼放在" "函式中。全域變數和類別變數的初始化應該只使用常數或內建函式。這意味著來自引入" diff --git a/glossary.po b/glossary.po index 4a87b00ac99..5b32ce95462 100644 --- a/glossary.po +++ b/glossary.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-27 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -68,61 +68,79 @@ msgid "" "define interfaces when other techniques like :func:`hasattr` would be clumsy " "or subtly wrong (for example with :ref:`magic methods `). " "ABCs introduce virtual subclasses, which are classes that don't inherit from " -"a class but are still recognized by :func:`isinstance` and :func:" -"`issubclass`; see the :mod:`abc` module documentation. Python comes with " -"many built-in ABCs for data structures (in the :mod:`collections.abc` " -"module), numbers (in the :mod:`numbers` module), streams (in the :mod:`io` " -"module), import finders and loaders (in the :mod:`importlib.abc` module). " -"You can create your own ABCs with the :mod:`abc` module." +"a class but are still recognized by :func:`isinstance` " +"and :func:`issubclass`; see the :mod:`abc` module documentation. Python " +"comes with many built-in ABCs for data structures (in " +"the :mod:`collections.abc` module), numbers (in the :mod:`numbers` module), " +"streams (in the :mod:`io` module), import finders and loaders (in " +"the :mod:`importlib.abc` module). You can create your own ABCs with " +"the :mod:`abc` module." msgstr "" "抽象基底類別(又稱為 ABC)提供了一種定義介面的方法,作為 :term:`duck-" "typing`\\ (鴨子型別)的補充。其他類似的技術,像是 :func:`hasattr`,則顯得笨" "拙或是帶有細微的錯誤(例如使用\\ :ref:`魔術方法 (magic method) `\\ )。ABC 採用虛擬的 subclass(子類別),它們並不繼承自另一個 class" -"(類別),但仍可被 :func:`isinstance` 及 :func:`issubclass` 辨識;請參閱 :" -"mod:`abc` 模組的說明文件。Python 有許多內建的 ABC,用於資料結構(在 :mod:" -"`collections.abc` 模組)、數字(在 :mod:`numbers` 模組)、串流(在 :mod:`io` " -"模組)及 import 尋檢器和載入器(在 :mod:`importlib.abc` 模組)。你可以使用 :" -"mod:`abc` 模組建立自己的 ABC。" +"(類別),但仍可被 :func:`isinstance` 及 :func:`issubclass` 辨識;請參" +"閱 :mod:`abc` 模組的說明文件。Python 有許多內建的 ABC,用於資料結構" +"(在 :mod:`collections.abc` 模組)、數字(在 :mod:`numbers` 模組)、串流" +"(在 :mod:`io` 模組)及 import 尋檢器和載入器(在 :mod:`importlib.abc` 模" +"組)。你可以使用 :mod:`abc` 模組建立自己的 ABC。" #: ../../glossary.rst:38 -msgid "annotation" +#, fuzzy +msgid "annotate function" msgstr "annotation(註釋)" #: ../../glossary.rst:40 msgid "" +"A function that can be called to retrieve the :term:`annotations " +"` of an object. This function is accessible as " +"the :attr:`~object.__annotate__` attribute of functions, classes, and " +"modules. Annotate functions are a subset of :term:`evaluate functions " +"`." +msgstr "" + +#: ../../glossary.rst:44 +msgid "annotation" +msgstr "annotation(註釋)" + +#: ../../glossary.rst:46 +msgid "" "A label associated with a variable, a class attribute or a function " "parameter or return value, used by convention as a :term:`type hint`." msgstr "" "一個與變數、class 屬性、函式的參數或回傳值相關聯的標籤。照慣例,它被用來作" "為 :term:`type hint`\\ (型別提示)。" -#: ../../glossary.rst:44 +#: ../../glossary.rst:50 +#, fuzzy msgid "" "Annotations of local variables cannot be accessed at runtime, but " -"annotations of global variables, class attributes, and functions are stored " -"in the :attr:`__annotations__` special attribute of modules, classes, and " -"functions, respectively." +"annotations of global variables, class attributes, and functions can be " +"retrieved by calling :func:`annotationlib.get_annotations` on modules, " +"classes, and functions, respectively." msgstr "" "在執行環境 (runtime),區域變數的註釋無法被存取,但全域變數、class 屬性和函式" "的註解,會分別被儲存在模組、class 和函式的 :attr:`__annotations__` 特殊屬性" "中。" -#: ../../glossary.rst:50 +#: ../../glossary.rst:55 +#, fuzzy msgid "" -"See :term:`variable annotation`, :term:`function annotation`, :pep:`484` " -"and :pep:`526`, which describe this functionality. Also see :ref:" -"`annotations-howto` for best practices on working with annotations." +"See :term:`variable annotation`, :term:`function " +"annotation`, :pep:`484`, :pep:`526`, and :pep:`649`, which describe this " +"functionality. Also see :ref:`annotations-howto` for best practices on " +"working with annotations." msgstr "" "請參閱 :term:`variable annotation`、:term:`function annotation`、:pep:`484` " -"和 :pep:`526`,這些章節皆有此功能的說明。關於註釋的最佳實踐方法也請參閱 :ref:" -"`annotations-howto`。" +"和 :pep:`526`,這些章節皆有此功能的說明。關於註釋的最佳實踐方法也請參" +"閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:54 +#: ../../glossary.rst:59 msgid "argument" msgstr "argument(引數)" -#: ../../glossary.rst:56 +#: ../../glossary.rst:61 msgid "" "A value passed to a :term:`function` (or :term:`method`) when calling the " "function. There are two kinds of argument:" @@ -130,7 +148,7 @@ msgstr "" "呼叫函式時被傳遞給 :term:`function`\\ (或 :term:`method`\\ )的值。引數有兩" "種:" -#: ../../glossary.rst:59 +#: ../../glossary.rst:64 msgid "" ":dfn:`keyword argument`: an argument preceded by an identifier (e.g. " "``name=``) in a function call or passed as a value in a dictionary preceded " @@ -142,7 +160,7 @@ msgstr "" "遞的引數。例如,``3`` 和 ``5`` 都是以下 :func:`complex` 呼叫中的關鍵字引" "數: ::" -#: ../../glossary.rst:64 +#: ../../glossary.rst:69 msgid "" "complex(real=3, imag=5)\n" "complex(**{'real': 3, 'imag': 5})" @@ -150,7 +168,7 @@ msgstr "" "complex(real=3, imag=5)\n" "complex(**{'real': 3, 'imag': 5})" -#: ../../glossary.rst:67 +#: ../../glossary.rst:72 msgid "" ":dfn:`positional argument`: an argument that is not a keyword argument. " "Positional arguments can appear at the beginning of an argument list and/or " @@ -161,7 +179,7 @@ msgstr "" "引數列表的起始處出現,和(或)作為 ``*`` 之後的 :term:`iterable`\\ (可疊代物" "件)中的元素被傳遞。例如,``3`` 和 ``5`` 都是以下呼叫中的位置引數: ::" -#: ../../glossary.rst:73 +#: ../../glossary.rst:78 msgid "" "complex(3, 5)\n" "complex(*(3, 5))" @@ -169,7 +187,7 @@ msgstr "" "complex(3, 5)\n" "complex(*(3, 5))" -#: ../../glossary.rst:76 +#: ../../glossary.rst:81 msgid "" "Arguments are assigned to the named local variables in a function body. See " "the :ref:`calls` section for the rules governing this assignment. " @@ -180,7 +198,7 @@ msgstr "" "\\ :ref:`calls`\\ 章節。在語法上,任何運算式都可以被用來表示一個引數;其評估" "值會被指定給區域變數。" -#: ../../glossary.rst:81 +#: ../../glossary.rst:86 msgid "" "See also the :term:`parameter` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " @@ -189,25 +207,25 @@ msgstr "" "另請參閱術語表的 :term:`parameter`\\ (參數)條目、常見問題中的\\ :ref:`引數" "和參數之間的差異 `,以及 :pep:`362`。" -#: ../../glossary.rst:84 +#: ../../glossary.rst:89 msgid "asynchronous context manager" msgstr "asynchronous context manager(非同步情境管理器)" -#: ../../glossary.rst:86 +#: ../../glossary.rst:91 msgid "" "An object which controls the environment seen in an :keyword:`async with` " -"statement by defining :meth:`~object.__aenter__` and :meth:`~object." -"__aexit__` methods. Introduced by :pep:`492`." +"statement by defining :meth:`~object.__aenter__` " +"and :meth:`~object.__aexit__` methods. Introduced by :pep:`492`." msgstr "" -"一個可以控制 :keyword:`async with` 陳述式中所見環境的物件,而它是透過定義 :" -"meth:`~object.__aenter__` 和 :meth:`~object.__aexit__` method(方法)來控制" -"的。由 :pep:`492` 引入。" +"一個可以控制 :keyword:`async with` 陳述式中所見環境的物件,而它是透過定" +"義 :meth:`~object.__aenter__` 和 :meth:`~object.__aexit__` method(方法)來控" +"制的。由 :pep:`492` 引入。" -#: ../../glossary.rst:89 +#: ../../glossary.rst:94 msgid "asynchronous generator" msgstr "asynchronous generator(非同步產生器)" -#: ../../glossary.rst:91 +#: ../../glossary.rst:96 msgid "" "A function which returns an :term:`asynchronous generator iterator`. It " "looks like a coroutine function defined with :keyword:`async def` except " @@ -216,10 +234,10 @@ msgid "" msgstr "" "一個會回傳 :term:`asynchronous generator iterator`\\ (非同步產生器疊代器)的" "函式。它看起來像一個以 :keyword:`async def` 定義的協程函式 (coroutine " -"function),但不同的是它包含了 :keyword:`yield` 運算式,能生成一系列可用於 :" -"keyword:`async for` 迴圈的值。" +"function),但不同的是它包含了 :keyword:`yield` 運算式,能生成一系列可用" +"於 :keyword:`async for` 迴圈的值。" -#: ../../glossary.rst:96 +#: ../../glossary.rst:101 msgid "" "Usually refers to an asynchronous generator function, but may refer to an " "*asynchronous generator iterator* in some contexts. In cases where the " @@ -229,7 +247,7 @@ msgstr "" "同步產生器疊代器 (asynchronous generator iterator)*。萬一想表達的意思不夠清" "楚,那就使用完整的術語,以避免歧義。" -#: ../../glossary.rst:100 +#: ../../glossary.rst:105 msgid "" "An asynchronous generator function may contain :keyword:`await` expressions " "as well as :keyword:`async for`, and :keyword:`async with` statements." @@ -237,28 +255,28 @@ msgstr "" "一個非同步產生器函式可能包含 :keyword:`await` 運算式,以及 :keyword:`async " "for` 和 :keyword:`async with` 陳述式。" -#: ../../glossary.rst:103 +#: ../../glossary.rst:108 msgid "asynchronous generator iterator" msgstr "asynchronous generator iterator(非同步產生器疊代器)" -#: ../../glossary.rst:105 +#: ../../glossary.rst:110 msgid "An object created by an :term:`asynchronous generator` function." msgstr "" "一個由 :term:`asynchronous generator`\\ (非同步產生器)函式所建立的物件。" -#: ../../glossary.rst:107 +#: ../../glossary.rst:112 msgid "" -"This is an :term:`asynchronous iterator` which when called using the :meth:" -"`~object.__anext__` method returns an awaitable object which will execute " -"the body of the asynchronous generator function until the next :keyword:" -"`yield` expression." +"This is an :term:`asynchronous iterator` which when called using " +"the :meth:`~object.__anext__` method returns an awaitable object which will " +"execute the body of the asynchronous generator function until the " +"next :keyword:`yield` expression." msgstr "" -"這是一個 :term:`asynchronous iterator`\\ (非同步疊代器),當它以 :meth:" -"`~object.__anext__` method 被呼叫時,會回傳一個可等待物件 (awaitable " -"object),該物件將執行非同步產生器的函式主體,直到遇到下一個 :keyword:`yield` " -"運算式。" +"這是一個 :term:`asynchronous iterator`\\ (非同步疊代器),當它" +"以 :meth:`~object.__anext__` method 被呼叫時,會回傳一個可等待物件 " +"(awaitable object),該物件將執行非同步產生器的函式主體,直到遇到下一" +"個 :keyword:`yield` 運算式。" -#: ../../glossary.rst:112 +#: ../../glossary.rst:117 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "execution state (including local variables and pending try-statements). " @@ -267,47 +285,81 @@ msgid "" "off. See :pep:`492` and :pep:`525`." msgstr "" "每個 :keyword:`yield` 會暫停處理程序,並記住執行狀態(包括區域變數及擱置中的 " -"try 陳述式)。當\\ *非同步產生器疊代器*\\ 以另一個被 :meth:`~object." -"__anext__` 回傳的可等待物件有效地回復時,它會從停止的地方繼續執行。請參閱 :" -"pep:`492` 和 :pep:`525`。" +"try 陳述式)。當\\ *非同步產生器疊代器*\\ 以另一個" +"被 :meth:`~object.__anext__` 回傳的可等待物件有效地回復時,它會從停止的地方繼" +"續執行。請參閱 :pep:`492` 和 :pep:`525`。" -#: ../../glossary.rst:117 +#: ../../glossary.rst:122 msgid "asynchronous iterable" msgstr "asynchronous iterable(非同步可疊代物件)" -#: ../../glossary.rst:119 +#: ../../glossary.rst:124 msgid "" "An object, that can be used in an :keyword:`async for` statement. Must " "return an :term:`asynchronous iterator` from its :meth:`~object.__aiter__` " "method. Introduced by :pep:`492`." msgstr "" -"一個物件,它可以在 :keyword:`async for` 陳述式中被使用。必須從它的 :meth:" -"`~object.__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ (非同步" -"疊代器)。由 :pep:`492` 引入。" +"一個物件,它可以在 :keyword:`async for` 陳述式中被使用。必須從它" +"的 :meth:`~object.__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ " +"(非同步疊代器)。由 :pep:`492` 引入。" -#: ../../glossary.rst:122 +#: ../../glossary.rst:127 msgid "asynchronous iterator" msgstr "asynchronous iterator(非同步疊代器)" -#: ../../glossary.rst:124 +#: ../../glossary.rst:129 msgid "" -"An object that implements the :meth:`~object.__aiter__` and :meth:`~object." -"__anext__` methods. :meth:`~object.__anext__` must return an :term:" -"`awaitable` object. :keyword:`async for` resolves the awaitables returned by " -"an asynchronous iterator's :meth:`~object.__anext__` method until it raises " -"a :exc:`StopAsyncIteration` exception. Introduced by :pep:`492`." +"An object that implements the :meth:`~object.__aiter__` " +"and :meth:`~object.__anext__` methods. :meth:`~object.__anext__` must " +"return an :term:`awaitable` object. :keyword:`async for` resolves the " +"awaitables returned by an asynchronous iterator's :meth:`~object.__anext__` " +"method until it raises a :exc:`StopAsyncIteration` exception. Introduced " +"by :pep:`492`." msgstr "" "一個實作 :meth:`~object.__aiter__` 和 :meth:`~object.__anext__` method 的物" "件。:meth:`~object.__anext__` 必須回傳一個 :term:`awaitable`\\ (可等待物" "件)。:keyword:`async for` 會解析非同步疊代器的 :meth:`~object.__anext__` " -"method 所回傳的可等待物件,直到它引發 :exc:`StopAsyncIteration` 例外。由 :" -"pep:`492` 引入。" +"method 所回傳的可等待物件,直到它引發 :exc:`StopAsyncIteration` 例外。" +"由 :pep:`492` 引入。" -#: ../../glossary.rst:129 +#: ../../glossary.rst:134 +msgid "attached thread state" +msgstr "" + +#: ../../glossary.rst:137 +msgid "A :term:`thread state` that is active for the current OS thread." +msgstr "" + +#: ../../glossary.rst:139 +msgid "" +"When a :term:`thread state` is attached, the OS thread has access to the " +"full Python C API and can safely invoke the bytecode interpreter." +msgstr "" + +#: ../../glossary.rst:143 +msgid "" +"Unless a function explicitly notes otherwise, attempting to call the C API " +"without an attached thread state will result in a fatal error or undefined " +"behavior. A thread state can be attached and detached explicitly by the " +"user through the C API, or implicitly by the runtime, including during " +"blocking C calls and by the bytecode interpreter in between calls." +msgstr "" + +#: ../../glossary.rst:150 +msgid "" +"On most builds of Python, having an attached thread state implies that the " +"caller holds the :term:`GIL` for the current interpreter, so only one OS " +"thread can have an attached thread state at a given moment. In :term:`free-" +"threaded ` builds of Python, threads can concurrently hold " +"an attached thread state, allowing for true parallelism of the bytecode " +"interpreter." +msgstr "" + +#: ../../glossary.rst:156 msgid "attribute" msgstr "attribute(屬性)" -#: ../../glossary.rst:131 +#: ../../glossary.rst:158 msgid "" "A value associated with an object which is usually referenced by name using " "dotted expressions. For example, if an object *o* has an attribute *a* it " @@ -316,75 +368,75 @@ msgstr "" "一個與某物件相關聯的值,該值大多能透過使用點分隔運算式 (dotted expression) 的" "名稱被參照。例如,如果物件 *o* 有一個屬性 *a*,則該屬性能以 *o.a* 被參照。" -#: ../../glossary.rst:136 +#: ../../glossary.rst:163 msgid "" "It is possible to give an object an attribute whose name is not an " -"identifier as defined by :ref:`identifiers`, for example using :func:" -"`setattr`, if the object allows it. Such an attribute will not be accessible " -"using a dotted expression, and would instead need to be retrieved with :func:" -"`getattr`." +"identifier as defined by :ref:`identifiers`, for example " +"using :func:`setattr`, if the object allows it. Such an attribute will not " +"be accessible using a dotted expression, and would instead need to be " +"retrieved with :func:`getattr`." msgstr "" "如果一個物件允許,給予該物件一個名稱不是由\\ :ref:`identifiers`\\ 所定義之識" "別符 (identifier) 的屬性是有可能的,例如使用 :func:`setattr`。像這樣的屬性將" "無法使用點分隔運算式來存取,而是需要使用 :func:`getattr` 來取得它。" -#: ../../glossary.rst:141 +#: ../../glossary.rst:168 msgid "awaitable" msgstr "awaitable(可等待物件)" -#: ../../glossary.rst:143 +#: ../../glossary.rst:170 msgid "" -"An object that can be used in an :keyword:`await` expression. Can be a :" -"term:`coroutine` or an object with an :meth:`~object.__await__` method. See " -"also :pep:`492`." +"An object that can be used in an :keyword:`await` expression. Can be " +"a :term:`coroutine` or an object with an :meth:`~object.__await__` method. " +"See also :pep:`492`." msgstr "" -"一個可以在 :keyword:`await` 運算式中被使用的物件。它可以是一個 :term:" -"`coroutine`\\ (協程),或是一個有 :meth:`~object.__await__` method 的物件。" -"另請參閱 :pep:`492`。" +"一個可以在 :keyword:`await` 運算式中被使用的物件。它可以是一" +"個 :term:`coroutine`\\ (協程),或是一個有 :meth:`~object.__await__` method " +"的物件。另請參閱 :pep:`492`。" -#: ../../glossary.rst:146 +#: ../../glossary.rst:173 msgid "BDFL" msgstr "BDFL" -#: ../../glossary.rst:148 +#: ../../glossary.rst:175 msgid "" -"Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." +"Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." msgstr "" "Benevolent Dictator For Life(終身仁慈獨裁者),又名 `Guido van Rossum " "`_,Python 的創造者。" -#: ../../glossary.rst:150 +#: ../../glossary.rst:177 msgid "binary file" msgstr "binary file(二進位檔案)" -#: ../../glossary.rst:152 +#: ../../glossary.rst:179 msgid "" "A :term:`file object` able to read and write :term:`bytes-like objects " "`. Examples of binary files are files opened in binary " -"mode (``'rb'``, ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer `, :data:`sys.stdout.buffer `, and instances of :class:`io." -"BytesIO` and :class:`gzip.GzipFile`." +"mode (``'rb'``, ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer " +"`, :data:`sys.stdout.buffer `, and instances " +"of :class:`io.BytesIO` and :class:`gzip.GzipFile`." msgstr "" "一個能夠讀取和寫入 :term:`bytes-like objects `\\ (類位元" "組串物件)的 :term:`file object`\\ (檔案物件)。二進位檔案的例子有:以二進位" "模式(``'rb'``、``'wb'`` 或 ``'rb+'``)開啟的檔案、:data:`sys.stdin.buffer " -"`、:data:`sys.stdout.buffer `,以及 :class:`io." -"BytesIO` 和 :class:`gzip.GzipFile` 實例。" +"`、:data:`sys.stdout.buffer `,以" +"及 :class:`io.BytesIO` 和 :class:`gzip.GzipFile` 實例。" -#: ../../glossary.rst:159 +#: ../../glossary.rst:186 msgid "" -"See also :term:`text file` for a file object able to read and write :class:" -"`str` objects." +"See also :term:`text file` for a file object able to read and " +"write :class:`str` objects." msgstr "" -"另請參閱 :term:`text file`\\ (文字檔案),它是一個能夠讀取和寫入 :class:" -"`str` 物件的檔案物件。" +"另請參閱 :term:`text file`\\ (文字檔案),它是一個能夠讀取和寫" +"入 :class:`str` 物件的檔案物件。" -#: ../../glossary.rst:161 +#: ../../glossary.rst:188 msgid "borrowed reference" msgstr "borrowed reference(借用參照)" -#: ../../glossary.rst:163 +#: ../../glossary.rst:190 msgid "" "In Python's C API, a borrowed reference is a reference to an object, where " "the code using the object does not own the reference. It becomes a dangling " @@ -396,12 +448,12 @@ msgstr "" "如,一次垃圾回收 (garbage collection) 可以移除對物件的最後一個 :term:`strong " "reference`\\ (強參照),而將該物件銷毀。" -#: ../../glossary.rst:169 +#: ../../glossary.rst:196 msgid "" "Calling :c:func:`Py_INCREF` on the :term:`borrowed reference` is recommended " "to convert it to a :term:`strong reference` in-place, except when the object " -"cannot be destroyed before the last usage of the borrowed reference. The :c:" -"func:`Py_NewRef` function can be used to create a new :term:`strong " +"cannot be destroyed before the last usage of the borrowed reference. " +"The :c:func:`Py_NewRef` function can be used to create a new :term:`strong " "reference`." msgstr "" "對 :term:`borrowed reference` 呼叫 :c:func:`Py_INCREF` 以將它原地 (in-place) " @@ -409,31 +461,31 @@ msgstr "" "借用參照之前被銷毀。:c:func:`Py_NewRef` 函式可用於建立一個新的 :term:`strong " "reference`。" -#: ../../glossary.rst:174 +#: ../../glossary.rst:201 msgid "bytes-like object" msgstr "bytes-like object(類位元組串物件)" -#: ../../glossary.rst:176 +#: ../../glossary.rst:203 msgid "" -"An object that supports the :ref:`bufferobjects` and can export a C-:term:" -"`contiguous` buffer. This includes all :class:`bytes`, :class:`bytearray`, " -"and :class:`array.array` objects, as well as many common :class:`memoryview` " -"objects. Bytes-like objects can be used for various operations that work " -"with binary data; these include compression, saving to a binary file, and " -"sending over a socket." +"An object that supports the :ref:`bufferobjects` and can export a " +"C-:term:`contiguous` buffer. This includes " +"all :class:`bytes`, :class:`bytearray`, and :class:`array.array` objects, as " +"well as many common :class:`memoryview` objects. Bytes-like objects can be " +"used for various operations that work with binary data; these include " +"compression, saving to a binary file, and sending over a socket." msgstr "" "一個支援\\ :ref:`bufferobjects`\\ 且能夠匯出 C-:term:`contiguous` 緩衝區的物" "件。這包括所有的 :class:`bytes`、:class:`bytearray` 和 :class:`array.array` " "物件,以及許多常見的 :class:`memoryview` 物件。類位元組串物件可用於處理二進位" "資料的各種運算;這些運算包括壓縮、儲存至二進位檔案和透過 socket(插座)發送。" -#: ../../glossary.rst:183 +#: ../../glossary.rst:210 msgid "" "Some operations need the binary data to be mutable. The documentation often " "refers to these as \"read-write bytes-like objects\". Example mutable " -"buffer objects include :class:`bytearray` and a :class:`memoryview` of a :" -"class:`bytearray`. Other operations require the binary data to be stored in " -"immutable objects (\"read-only bytes-like objects\"); examples of these " +"buffer objects include :class:`bytearray` and a :class:`memoryview` of " +"a :class:`bytearray`. Other operations require the binary data to be stored " +"in immutable objects (\"read-only bytes-like objects\"); examples of these " "include :class:`bytes` and a :class:`memoryview` of a :class:`bytes` object." msgstr "" "有些運算需要二進位資料是可變的。說明文件通常會將這些物件稱為「可讀寫的類位元" @@ -442,11 +494,11 @@ msgstr "" "的類位元組串物件」)中;這些物件包括 :class:`bytes`,以及 :class:`bytes` 物件" "的 :class:`memoryview`。" -#: ../../glossary.rst:191 +#: ../../glossary.rst:218 msgid "bytecode" msgstr "bytecode(位元組碼)" -#: ../../glossary.rst:193 +#: ../../glossary.rst:220 msgid "" "Python source code is compiled into bytecode, the internal representation of " "a Python program in the CPython interpreter. The bytecode is also cached in " @@ -465,54 +517,54 @@ msgstr "" "上是無法在不同的 Python 虛擬機器之間運作的,也不能在不同版本的 Python 之間保" "持穩定。" -#: ../../glossary.rst:203 +#: ../../glossary.rst:230 msgid "" -"A list of bytecode instructions can be found in the documentation for :ref:" -"`the dis module `." +"A list of bytecode instructions can be found in the documentation " +"for :ref:`the dis module `." msgstr "" "位元組碼的指令列表可以在 :ref:`dis 模組 `\\ 的說明文件中找到。" -#: ../../glossary.rst:205 +#: ../../glossary.rst:232 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../glossary.rst:207 +#: ../../glossary.rst:234 msgid "" "A callable is an object that can be called, possibly with a set of arguments " "(see :term:`argument`), with the following syntax::" msgstr "" -"一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請見 :" -"term:`argument`): ::" +"一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請" +"見 :term:`argument`): ::" -#: ../../glossary.rst:210 +#: ../../glossary.rst:237 msgid "callable(argument1, argument2, argumentN)" msgstr "callable(argument1, argument2, argumentN)" -#: ../../glossary.rst:212 +#: ../../glossary.rst:239 msgid "" "A :term:`function`, and by extension a :term:`method`, is a callable. An " "instance of a class that implements the :meth:`~object.__call__` method is " "also a callable." msgstr "" -"一個 :term:`function` 與其延伸的 :term:`method` 都是 callable。一個有實作 :" -"meth:`~object.__call__` 方法的 class 之實例也是個 callable。" +"一個 :term:`function` 與其延伸的 :term:`method` 都是 callable。一個有實" +"作 :meth:`~object.__call__` 方法的 class 之實例也是個 callable。" -#: ../../glossary.rst:215 +#: ../../glossary.rst:242 msgid "callback" msgstr "callback(回呼)" -#: ../../glossary.rst:217 +#: ../../glossary.rst:244 msgid "" "A subroutine function which is passed as an argument to be executed at some " "point in the future." msgstr "" "作為引數被傳遞的一個副程式 (subroutine) 函式,會在未來的某個時間點被執行。" -#: ../../glossary.rst:219 +#: ../../glossary.rst:246 msgid "class" msgstr "class(類別)" -#: ../../glossary.rst:221 +#: ../../glossary.rst:248 msgid "" "A template for creating user-defined objects. Class definitions normally " "contain method definitions which operate on instances of the class." @@ -520,11 +572,11 @@ msgstr "" "一個用於建立使用者定義物件的模板。Class 的定義通常會包含 method 的定義,這些 " "method 可以在 class 的實例上進行操作。" -#: ../../glossary.rst:224 +#: ../../glossary.rst:251 msgid "class variable" msgstr "class variable(類別變數)" -#: ../../glossary.rst:226 +#: ../../glossary.rst:253 msgid "" "A variable defined in a class and intended to be modified only at class " "level (i.e., not in an instance of the class)." @@ -532,24 +584,24 @@ msgstr "" "一個在 class 中被定義,且應該只能在 class 層次(意即不是在 class 的實例中)被" "修改的變數。" -#: ../../glossary.rst:228 +#: ../../glossary.rst:255 msgid "closure variable" msgstr "closure variable(閉包變數)" -#: ../../glossary.rst:230 +#: ../../glossary.rst:257 msgid "" "A :term:`free variable` referenced from a :term:`nested scope` that is " "defined in an outer scope rather than being resolved at runtime from the " -"globals or builtin namespaces. May be explicitly defined with the :keyword:" -"`nonlocal` keyword to allow write access, or implicitly defined if the " -"variable is only being read." +"globals or builtin namespaces. May be explicitly defined with " +"the :keyword:`nonlocal` keyword to allow write access, or implicitly defined " +"if the variable is only being read." msgstr "" "從外部作用域中定義且從\\ :term:`巢狀作用域 `\\ 參照的\\ :term:`" "自由變數 `,不是於 runtime 從全域或內建命名空間解析。可以使" "用 :keyword:`nonlocal` 關鍵字明確定義以允許寫入存取,或者如果僅需讀取變數則隱" "式定義即可。" -#: ../../glossary.rst:235 +#: ../../glossary.rst:262 msgid "" "For example, in the ``inner`` function in the following code, both ``x`` and " "``print`` are :term:`free variables `, but only ``x`` is a " @@ -558,7 +610,7 @@ msgstr "" "例如在下面程式碼中的 ``inner`` 函式中,``x`` 和 ``print`` 都是\\ :term:`自由" "變數 `,但只有 ``x`` 是\\ *閉包變數*: ::" -#: ../../glossary.rst:238 +#: ../../glossary.rst:265 msgid "" "def outer():\n" " x = 0\n" @@ -576,7 +628,7 @@ msgstr "" " print(x)\n" " return inner" -#: ../../glossary.rst:246 +#: ../../glossary.rst:273 msgid "" "Due to the :attr:`codeobject.co_freevars` attribute (which, despite its " "name, only includes the names of closure variables rather than listing all " @@ -588,11 +640,11 @@ msgstr "" "名稱,而不是列出所有參照的自由變數),當預期含義是特指閉包變數時,有時候甚至" "也會使用更通用的\\ :term:`自由變數 `\\ 一詞。" -#: ../../glossary.rst:250 +#: ../../glossary.rst:277 msgid "complex number" msgstr "complex number(複數)" -#: ../../glossary.rst:252 +#: ../../glossary.rst:279 msgid "" "An extension of the familiar real number system in which all numbers are " "expressed as a sum of a real part and an imaginary part. Imaginary numbers " @@ -607,68 +659,69 @@ msgstr "" "一個我們熟悉的實數系統的擴充,在此所有數字都會被表示為一個實部和一個虛部之" "和。虛數就是虛數單位(``-1`` 的平方根)的實數倍,此單位通常在數學中被寫為 " "``i``,在工程學中被寫為 ``j``。Python 內建了對複數的支援,它是用後者的記法來" -"表示複數;虛部會帶著一個後綴的 ``j`` 被編寫,例如 ``3+1j``。若要將 :mod:" -"`math` 模組內的工具等效地用於複數,請使用 :mod:`cmath` 模組。複數的使用是一個" -"相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可以安全地" -"忽略它們。" +"表示複數;虛部會帶著一個後綴的 ``j`` 被編寫,例如 ``3+1j``。若要" +"將 :mod:`math` 模組內的工具等效地用於複數,請使用 :mod:`cmath` 模組。複數的使" +"用是一個相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可" +"以安全地忽略它們。" -#: ../../glossary.rst:262 +#: ../../glossary.rst:289 msgid "context" msgstr "context(情境)" -#: ../../glossary.rst:264 +#: ../../glossary.rst:291 msgid "" "This term has different meanings depending on where and how it is used. Some " "common meanings:" msgstr "" -#: ../../glossary.rst:267 +#: ../../glossary.rst:294 msgid "" "The temporary state or environment established by a :term:`context manager` " "via a :keyword:`with` statement." msgstr "" -#: ../../glossary.rst:269 +#: ../../glossary.rst:296 msgid "" -"The collection of key­value bindings associated with a particular :class:" -"`contextvars.Context` object and accessed via :class:`~contextvars." -"ContextVar` objects. Also see :term:`context variable`." +"The collection of key­value bindings associated with a " +"particular :class:`contextvars.Context` object and accessed " +"via :class:`~contextvars.ContextVar` objects. Also see :term:`context " +"variable`." msgstr "" -#: ../../glossary.rst:273 +#: ../../glossary.rst:300 msgid "" "A :class:`contextvars.Context` object. Also see :term:`current context`." msgstr "" "一個 :class:`contextvars.Context` 物件。另請參閱 :term:`current context`。" -#: ../../glossary.rst:275 +#: ../../glossary.rst:302 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../glossary.rst:277 +#: ../../glossary.rst:304 msgid "" "The :meth:`~object.__enter__` and :meth:`~object.__exit__` methods called by " "the :keyword:`with` statement. See :pep:`343`." msgstr "" -"由 :keyword:`with` 陳述式所呼叫的 :meth:`~object.__enter__` 和 :meth:" -"`~object.__exit__` 方法。另請參閱 :pep:`343`。" +"由 :keyword:`with` 陳述式所呼叫的 :meth:`~object.__enter__` " +"和 :meth:`~object.__exit__` 方法。另請參閱 :pep:`343`。" -#: ../../glossary.rst:279 +#: ../../glossary.rst:306 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../glossary.rst:281 +#: ../../glossary.rst:308 msgid "" "An object which implements the :term:`context management protocol` and " -"controls the environment seen in a :keyword:`with` statement. See :pep:" -"`343`." +"controls the environment seen in a :keyword:`with` statement. " +"See :pep:`343`." msgstr "" -#: ../../glossary.rst:284 +#: ../../glossary.rst:311 msgid "context variable" msgstr "context variable(情境變數)" -#: ../../glossary.rst:286 +#: ../../glossary.rst:313 msgid "" "A variable whose value depends on which context is the :term:`current " "context`. Values are accessed via :class:`contextvars.ContextVar` objects. " @@ -676,11 +729,11 @@ msgid "" "asynchronous tasks." msgstr "" -#: ../../glossary.rst:290 +#: ../../glossary.rst:317 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../glossary.rst:294 +#: ../../glossary.rst:321 msgid "" "A buffer is considered contiguous exactly if it is either *C-contiguous* or " "*Fortran contiguous*. Zero-dimensional buffers are C and Fortran " @@ -697,11 +750,11 @@ msgstr "" "的順序瀏覽各個項目時,最後一個索引的變化最快。然而,在 Fortran contiguous 陣" "列中,第一個索引的變化最快。" -#: ../../glossary.rst:302 +#: ../../glossary.rst:329 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../glossary.rst:304 +#: ../../glossary.rst:331 msgid "" "Coroutines are a more generalized form of subroutines. Subroutines are " "entered at one point and exited at another point. Coroutines can be " @@ -712,26 +765,27 @@ msgstr "" "在另一個時間點被退出。協程可以在許多不同的時間點被進入、退出和回復。它們能夠" "以 :keyword:`async def` 陳述式被實作。另請參閱 :pep:`492`。" -#: ../../glossary.rst:309 +#: ../../glossary.rst:336 msgid "coroutine function" msgstr "coroutine function(協程函式)" -#: ../../glossary.rst:311 +#: ../../glossary.rst:338 msgid "" "A function which returns a :term:`coroutine` object. A coroutine function " -"may be defined with the :keyword:`async def` statement, and may contain :" -"keyword:`await`, :keyword:`async for`, and :keyword:`async with` keywords. " -"These were introduced by :pep:`492`." +"may be defined with the :keyword:`async def` statement, and may " +"contain :keyword:`await`, :keyword:`async for`, and :keyword:`async with` " +"keywords. These were introduced by :pep:`492`." msgstr "" -"一個回傳 :term:`coroutine`\\ (協程)物件的函式。一個協程函式能以 :keyword:" -"`async def` 陳述式被定義,並可能會包含 :keyword:`await`、:keyword:`async " -"for` 和 :keyword:`async with` 關鍵字。這些關鍵字由 :pep:`492` 引入。" +"一個回傳 :term:`coroutine`\\ (協程)物件的函式。一個協程函式能" +"以 :keyword:`async def` 陳述式被定義,並可能會包" +"含 :keyword:`await`、:keyword:`async for` 和 :keyword:`async with` 關鍵字。這" +"些關鍵字由 :pep:`492` 引入。" -#: ../../glossary.rst:316 +#: ../../glossary.rst:343 msgid "CPython" msgstr "CPython" -#: ../../glossary.rst:318 +#: ../../glossary.rst:345 msgid "" "The canonical implementation of the Python programming language, as " "distributed on `python.org `_. The term \"CPython\" " @@ -742,25 +796,38 @@ msgstr "" "`_ 上。「CPython」這個術語在必要時被使用,以區分此實" "作與其它語言的實作,例如 Jython 或 IronPython。" -#: ../../glossary.rst:322 +#: ../../glossary.rst:349 msgid "current context" msgstr "" -#: ../../glossary.rst:324 +#: ../../glossary.rst:351 msgid "" "The :term:`context` (:class:`contextvars.Context` object) that is currently " "used by :class:`~contextvars.ContextVar` objects to access (get or set) the " "values of :term:`context variables `. Each thread has its " -"own current context. Frameworks for executing asynchronous tasks (see :mod:" -"`asyncio`) associate each task with a context which becomes the current " -"context whenever the task starts or resumes execution." +"own current context. Frameworks for executing asynchronous tasks " +"(see :mod:`asyncio`) associate each task with a context which becomes the " +"current context whenever the task starts or resumes execution." +msgstr "" + +#: ../../glossary.rst:357 +msgid "cyclic isolate" +msgstr "" + +#: ../../glossary.rst:359 +msgid "" +"A subgroup of one or more objects that reference each other in a reference " +"cycle, but are not referenced by objects outside the group. The goal of " +"the :term:`cyclic garbage collector ` is to identify " +"these groups and break the reference cycles so that the memory can be " +"reclaimed." msgstr "" -#: ../../glossary.rst:330 +#: ../../glossary.rst:363 msgid "decorator" msgstr "decorator(裝飾器)" -#: ../../glossary.rst:332 +#: ../../glossary.rst:365 msgid "" "A function returning another function, usually applied as a function " "transformation using the ``@wrapper`` syntax. Common examples for " @@ -770,13 +837,13 @@ msgstr "" "式的變換 (function transformation)。裝飾器的常見範例是 :func:`classmethod` " "和 :func:`staticmethod`。" -#: ../../glossary.rst:336 +#: ../../glossary.rst:369 msgid "" "The decorator syntax is merely syntactic sugar, the following two function " "definitions are semantically equivalent::" msgstr "裝飾器語法只是語法糖。以下兩個函式定義在語義上是等效的: ::" -#: ../../glossary.rst:339 +#: ../../glossary.rst:372 msgid "" "def f(arg):\n" " ...\n" @@ -794,40 +861,41 @@ msgstr "" "def f(arg):\n" " ..." -#: ../../glossary.rst:347 +#: ../../glossary.rst:380 msgid "" "The same concept exists for classes, but is less commonly used there. See " "the documentation for :ref:`function definitions ` and :ref:`class " "definitions ` for more about decorators." msgstr "" -"Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱\\ :" -"ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" +"Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱" +"\\ :ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" -#: ../../glossary.rst:350 +#: ../../glossary.rst:383 msgid "descriptor" msgstr "descriptor(描述器)" -#: ../../glossary.rst:352 -msgid "" -"Any object which defines the methods :meth:`~object.__get__`, :meth:`~object." -"__set__`, or :meth:`~object.__delete__`. When a class attribute is a " -"descriptor, its special binding behavior is triggered upon attribute " -"lookup. Normally, using *a.b* to get, set or delete an attribute looks up " -"the object named *b* in the class dictionary for *a*, but if *b* is a " -"descriptor, the respective descriptor method gets called. Understanding " -"descriptors is a key to a deep understanding of Python because they are the " -"basis for many features including functions, methods, properties, class " -"methods, static methods, and reference to super classes." -msgstr "" -"任何定義了 :meth:`~object.__get__`、:meth:`~object.__set__` 或 :meth:" -"`~object.__delete__` method 的物件。當一個 class 屬性是一個描述器時,它的特殊" -"連結行為會在屬性查找時被觸發。通常,使用 *a.b* 來取得、設定或刪除某個屬性時," -"會在 *a* 的 class 字典中查找名稱為 *b* 的物件,但如果 *b* 是一個描述器,則相" -"對應的描述器 method 會被呼叫。對描述器的理解是深入理解 Python 的關鍵,因為它" -"們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、class method、" -"靜態 method,以及對 super class(父類別)的參照。" - -#: ../../glossary.rst:363 +#: ../../glossary.rst:385 +msgid "" +"Any object which defines the " +"methods :meth:`~object.__get__`, :meth:`~object.__set__`, " +"or :meth:`~object.__delete__`. When a class attribute is a descriptor, its " +"special binding behavior is triggered upon attribute lookup. Normally, " +"using *a.b* to get, set or delete an attribute looks up the object named *b* " +"in the class dictionary for *a*, but if *b* is a descriptor, the respective " +"descriptor method gets called. Understanding descriptors is a key to a deep " +"understanding of Python because they are the basis for many features " +"including functions, methods, properties, class methods, static methods, and " +"reference to super classes." +msgstr "" +"任何定義了 :meth:`~object.__get__`、:meth:`~object.__set__` " +"或 :meth:`~object.__delete__` method 的物件。當一個 class 屬性是一個描述器" +"時,它的特殊連結行為會在屬性查找時被觸發。通常,使用 *a.b* 來取得、設定或刪除" +"某個屬性時,會在 *a* 的 class 字典中查找名稱為 *b* 的物件,但如果 *b* 是一個" +"描述器,則相對應的描述器 method 會被呼叫。對描述器的理解是深入理解 Python 的" +"關鍵,因為它們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、" +"class method、靜態 method,以及對 super class(父類別)的參照。" + +#: ../../glossary.rst:396 msgid "" "For more information about descriptors' methods, see :ref:`descriptors` or " "the :ref:`Descriptor How To Guide `." @@ -835,11 +903,11 @@ msgstr "" "關於描述器 method 的更多資訊,請參閱\\ :ref:`descriptors`\\ 或\\ :ref:`描述器" "使用指南 `。" -#: ../../glossary.rst:365 +#: ../../glossary.rst:398 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../glossary.rst:367 +#: ../../glossary.rst:400 msgid "" "An associative array, where arbitrary keys are mapped to values. The keys " "can be any object with :meth:`~object.__hash__` and :meth:`~object.__eq__` " @@ -849,11 +917,11 @@ msgstr "" "有 :meth:`~object.__hash__` 和 :meth:`~object.__eq__` method 的物件。在 Perl " "中被稱為雜湊 (hash)。" -#: ../../glossary.rst:371 +#: ../../glossary.rst:404 msgid "dictionary comprehension" msgstr "dictionary comprehension(字典綜合運算)" -#: ../../glossary.rst:373 +#: ../../glossary.rst:406 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a dictionary with the results. ``results = {n: n ** 2 for n in " @@ -864,28 +932,28 @@ msgstr "" "字典回傳。``results = {n: n ** 2 for n in range(10)}`` 會產生一個字典,它包含" "了鍵 ``n`` 對映到值 ``n ** 2``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:377 +#: ../../glossary.rst:410 msgid "dictionary view" msgstr "dictionary view(字典檢視)" -#: ../../glossary.rst:379 +#: ../../glossary.rst:412 msgid "" -"The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:" -"`dict.items` are called dictionary views. They provide a dynamic view on the " -"dictionary’s entries, which means that when the dictionary changes, the view " -"reflects these changes. To force the dictionary view to become a full list " -"use ``list(dictview)``. See :ref:`dict-views`." +"The objects returned from :meth:`dict.keys`, :meth:`dict.values`, " +"and :meth:`dict.items` are called dictionary views. They provide a dynamic " +"view on the dictionary’s entries, which means that when the dictionary " +"changes, the view reflects these changes. To force the dictionary view to " +"become a full list use ``list(dictview)``. See :ref:`dict-views`." msgstr "" "從 :meth:`dict.keys`、:meth:`dict.values` 及 :meth:`dict.items` 回傳的物件被" "稱為字典檢視。它們提供了字典中項目的動態檢視,這表示當字典有變動時,該檢視會" "反映這些變動。若要強制將字典檢視轉為完整的 list(串列),須使用 " "``list(dictview)``。請參閱\\ :ref:`dict-views`。" -#: ../../glossary.rst:385 +#: ../../glossary.rst:418 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../glossary.rst:387 +#: ../../glossary.rst:420 msgid "" "A string literal which appears as the first expression in a class, function " "or module. While ignored when the suite is executed, it is recognized by " @@ -894,25 +962,25 @@ msgid "" "introspection, it is the canonical place for documentation of the object." msgstr "" "一個在 class、函式或模組中,作為第一個運算式出現的字串文本。雖然它在套件執行" -"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組的 :attr:" -"`~definition.__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏" -"覽,因此它是物件的說明文件存放的標準位置。" +"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組" +"的 :attr:`~definition.__doc__` 屬性中。由於說明字串可以透過內省 " +"(introspection) 來瀏覽,因此它是物件的說明文件存放的標準位置。" -#: ../../glossary.rst:393 +#: ../../glossary.rst:426 msgid "duck-typing" msgstr "duck-typing(鴨子型別)" -#: ../../glossary.rst:395 +#: ../../glossary.rst:428 msgid "" "A programming style which does not look at an object's type to determine if " "it has the right interface; instead, the method or attribute is simply " "called or used (\"If it looks like a duck and quacks like a duck, it must be " "a duck.\") By emphasizing interfaces rather than specific types, well-" "designed code improves its flexibility by allowing polymorphic " -"substitution. Duck-typing avoids tests using :func:`type` or :func:" -"`isinstance`. (Note, however, that duck-typing can be complemented with :" -"term:`abstract base classes `.) Instead, it typically " -"employs :func:`hasattr` tests or :term:`EAFP` programming." +"substitution. Duck-typing avoids tests using :func:`type` " +"or :func:`isinstance`. (Note, however, that duck-typing can be complemented " +"with :term:`abstract base classes `.) Instead, it " +"typically employs :func:`hasattr` tests or :term:`EAFP` programming." msgstr "" "一種程式設計風格,它不是藉由檢查一個物件的型別來確定它是否具有正確的介面;取" "而代之的是,method 或屬性會單純地被呼叫或使用。(「如果它看起來像一隻鴨子而且" @@ -923,25 +991,25 @@ msgstr "" "來補充。)然而,它通常會採用 :func:`hasattr` 測試,或是 :term:`EAFP` 程式設計" "風格。" -#: ../../glossary.rst:404 +#: ../../glossary.rst:437 msgid "dunder" msgstr "dunder(雙底線)" -#: ../../glossary.rst:406 +#: ../../glossary.rst:439 msgid "" -"An informal short-hand for \"double underscore\", used when talking about a :" -"term:`special method`. For example, ``__init__`` is often pronounced " +"An informal short-hand for \"double underscore\", used when talking about " +"a :term:`special method`. For example, ``__init__`` is often pronounced " "\"dunder init\"." msgstr "" "一個非正式的縮寫,代表「雙底線 (double underscore)」,當談論到\\ :term:`特殊" "方法 `\\ 時使用。例如,``__init__`` 通常被叫做 \"dunder " "init\"。" -#: ../../glossary.rst:409 +#: ../../glossary.rst:442 msgid "EAFP" msgstr "EAFP" -#: ../../glossary.rst:411 +#: ../../glossary.rst:444 msgid "" "Easier to ask for forgiveness than permission. This common Python coding " "style assumes the existence of valid keys or attributes and catches " @@ -952,15 +1020,27 @@ msgid "" msgstr "" "Easier to ask for forgiveness than permission.(請求寬恕比請求許可更容易。)" "這種常見的 Python 編碼風格會先假設有效的鍵或屬性的存在,並在該假設被推翻時再" -"捕獲例外。這種乾淨且快速的風格,其特色是存在許多的 :keyword:`try` 和 :" -"keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見的 :term:`LBYL` 風" -"格形成了對比。" +"捕獲例外。這種乾淨且快速的風格,其特色是存在許多的 :keyword:`try` " +"和 :keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見" +"的 :term:`LBYL` 風格形成了對比。" + +#: ../../glossary.rst:450 +#, fuzzy +msgid "evaluate function" +msgstr "key function(鍵函式)" -#: ../../glossary.rst:417 +#: ../../glossary.rst:452 +msgid "" +"A function that can be called to evaluate a lazily evaluated attribute of an " +"object, such as the value of type aliases created with the :keyword:`type` " +"statement." +msgstr "" + +#: ../../glossary.rst:455 msgid "expression" msgstr "expression(運算式)" -#: ../../glossary.rst:419 +#: ../../glossary.rst:457 msgid "" "A piece of syntax which can be evaluated to some value. In other words, an " "expression is an accumulation of expression elements like literals, names, " @@ -976,11 +1056,11 @@ msgstr "" "(陳述式)不能被用作運算式,例如 :keyword:`while`。賦值 (assignment) 也是陳述" "式,而不是運算式。" -#: ../../glossary.rst:426 +#: ../../glossary.rst:464 msgid "extension module" msgstr "extension module(擴充模組)" -#: ../../glossary.rst:428 +#: ../../glossary.rst:466 msgid "" "A module written in C or C++, using Python's C API to interact with the core " "and with user code." @@ -988,24 +1068,30 @@ msgstr "" "一個以 C 或 C++ 編寫的模組,它使用 Python 的 C API 來與核心及使用者程式碼進行" "互動。" -#: ../../glossary.rst:430 +#: ../../glossary.rst:468 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../glossary.rst:432 +#: ../../glossary.rst:469 +#, fuzzy +msgid "f-strings" +msgstr "f-string(f 字串)" + +#: ../../glossary.rst:471 +#, fuzzy msgid "" -"String literals prefixed with ``'f'`` or ``'F'`` are commonly called \"f-" +"String literals prefixed with ``f`` or ``F`` are commonly called \"f-" "strings\" which is short for :ref:`formatted string literals `. " "See also :pep:`498`." msgstr "" "以 ``'f'`` 或 ``'F'`` 為前綴的字串文本通常被稱為「f 字串」,它是\\ :ref:`格式" "化的字串文本 `\\ 的縮寫。另請參閱 :pep:`498`。" -#: ../../glossary.rst:435 +#: ../../glossary.rst:474 msgid "file object" msgstr "file object(檔案物件)" -#: ../../glossary.rst:437 +#: ../../glossary.rst:476 msgid "" "An object exposing a file-oriented API (with methods such as :meth:`!read` " "or :meth:`!write`) to an underlying resource. Depending on the way it was " @@ -1020,7 +1106,7 @@ msgstr "" "衝區、socket(插座)、管線 (pipe) 等)的存取。檔案物件也被稱為\\ :dfn:`類檔案" "物件 (file-like object)` 或\\ :dfn:`串流 (stream)`。" -#: ../../glossary.rst:445 +#: ../../glossary.rst:484 msgid "" "There are actually three categories of file objects: raw :term:`binary files " "`, buffered :term:`binary files ` and :term:`text " @@ -1028,23 +1114,24 @@ msgid "" "The canonical way to create a file object is by using the :func:`open` " "function." msgstr "" -"實際上,有三種檔案物件:原始的\\ :term:`二進位檔案 `、緩衝的\\ :" -"term:`二進位檔案 `\\ 和\\ :term:`文字檔案 `。它們的介" -"面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函式。" +"實際上,有三種檔案物件:原始的\\ :term:`二進位檔案 `、緩衝的" +"\\ :term:`二進位檔案 `\\ 和\\ :term:`文字檔案 `。它們" +"的介面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函" +"式。" -#: ../../glossary.rst:450 +#: ../../glossary.rst:489 msgid "file-like object" msgstr "file-like object(類檔案物件)" -#: ../../glossary.rst:452 +#: ../../glossary.rst:491 msgid "A synonym for :term:`file object`." msgstr ":term:`file object`\\ (檔案物件)的同義字。" -#: ../../glossary.rst:453 +#: ../../glossary.rst:492 msgid "filesystem encoding and error handler" msgstr "filesystem encoding and error handler(檔案系統編碼和錯誤處理函式)" -#: ../../glossary.rst:455 +#: ../../glossary.rst:494 msgid "" "Encoding and error handler used by Python to decode bytes from the operating " "system and encode Unicode to the operating system." @@ -1052,7 +1139,7 @@ msgstr "" "Python 所使用的一種編碼和錯誤處理函式,用來解碼來自作業系統的位元組,以及將 " "Unicode 編碼到作業系統。" -#: ../../glossary.rst:458 +#: ../../glossary.rst:497 msgid "" "The filesystem encoding must guarantee to successfully decode all bytes " "below 128. If the file system encoding fails to provide this guarantee, API " @@ -1061,43 +1148,43 @@ msgstr "" "檔案系統編碼必須保證能成功解碼所有小於 128 的位元組。如果檔案系統編碼無法提供" "此保證,則 API 函式會引發 :exc:`UnicodeError`。" -#: ../../glossary.rst:462 +#: ../../glossary.rst:501 msgid "" -"The :func:`sys.getfilesystemencoding` and :func:`sys." -"getfilesystemencodeerrors` functions can be used to get the filesystem " -"encoding and error handler." +"The :func:`sys.getfilesystemencoding` " +"and :func:`sys.getfilesystemencodeerrors` functions can be used to get the " +"filesystem encoding and error handler." msgstr "" ":func:`sys.getfilesystemencoding` 和 :func:`sys.getfilesystemencodeerrors` 函" "式可用於取得檔案系統編碼和錯誤處理函式。" -#: ../../glossary.rst:466 +#: ../../glossary.rst:505 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " -"startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." -"filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :" -"c:type:`PyConfig`." +"startup by the :c:func:`PyConfig_Read` function: " +"see :c:member:`~PyConfig.filesystem_encoding` " +"and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." msgstr "" ":term:`filesystem encoding and error handler`\\ (檔案系統編碼和錯誤處理函" -"式)會在 Python 啟動時由 :c:func:`PyConfig_Read` 函式來配置:請參閱 :c:" -"member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成員 :c:" -"member:`~PyConfig.filesystem_errors`。" +"式)會在 Python 啟動時由 :c:func:`PyConfig_Read` 函式來配置:請參" +"閱 :c:member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成" +"員 :c:member:`~PyConfig.filesystem_errors`。" -#: ../../glossary.rst:471 +#: ../../glossary.rst:510 msgid "See also the :term:`locale encoding`." msgstr "另請參閱 :term:`locale encoding`\\ (區域編碼)。" -#: ../../glossary.rst:472 +#: ../../glossary.rst:511 msgid "finder" msgstr "finder(尋檢器)" -#: ../../glossary.rst:474 +#: ../../glossary.rst:513 msgid "" "An object that tries to find the :term:`loader` for a module that is being " "imported." msgstr "" "一個物件,它會嘗試為正在被 import 的模組尋找 :term:`loader`\\ (載入器)。" -#: ../../glossary.rst:477 +#: ../../glossary.rst:516 msgid "" "There are two types of finder: :term:`meta path finders ` " "for use with :data:`sys.meta_path`, and :term:`path entry finders ` 會使用 :data:`sys.meta_path`,而\\ :term:`路徑項目尋檢器 (path " "entry finder) ` 會使用 :data:`sys.path_hooks`。" -#: ../../glossary.rst:481 +#: ../../glossary.rst:520 msgid "" "See :ref:`finders-and-loaders` and :mod:`importlib` for much more detail." msgstr "請參閱 :ref:`finders-and-loaders` 和 :mod:`importlib` 以了解更多細節。" -#: ../../glossary.rst:482 +#: ../../glossary.rst:521 msgid "floor division" msgstr "floor division(向下取整除法)" -#: ../../glossary.rst:484 +#: ../../glossary.rst:523 msgid "" "Mathematical division that rounds down to nearest integer. The floor " "division operator is ``//``. For example, the expression ``11 // 4`` " @@ -1129,26 +1216,26 @@ msgstr "" "``2.75`` 不同。請注意,``(-11) // 4`` 的結果是 ``-3``,因為是 ``-2.75`` 被\\ " "*向下*\\ 無條件捨去。請參閱 :pep:`238`。" -#: ../../glossary.rst:489 +#: ../../glossary.rst:528 msgid "free threading" msgstr "free threading(自由執行緒)" -#: ../../glossary.rst:491 +#: ../../glossary.rst:530 msgid "" "A threading model where multiple threads can run Python bytecode " -"simultaneously within the same interpreter. This is in contrast to the :" -"term:`global interpreter lock` which allows only one thread to execute " +"simultaneously within the same interpreter. This is in contrast to " +"the :term:`global interpreter lock` which allows only one thread to execute " "Python bytecode at a time. See :pep:`703`." msgstr "" "為一種執行緒模型,多個執行緒可以在同一直譯器中同時運行 Python 位元組碼。這與" "\\ :term:`全域直譯器鎖 `\\ 形成對比,後者一次只允許" "一個執行緒執行 Python 位元組碼。請參閱 :pep:`703`。" -#: ../../glossary.rst:495 +#: ../../glossary.rst:534 msgid "free variable" msgstr "free variable(自由變數)" -#: ../../glossary.rst:497 +#: ../../glossary.rst:536 msgid "" "Formally, as defined in the :ref:`language execution model `, a " "free variable is any variable used in a namespace which is not a local " @@ -1158,31 +1245,31 @@ msgid "" "variable`." msgstr "" -#: ../../glossary.rst:502 +#: ../../glossary.rst:541 msgid "function" msgstr "function(函式)" -#: ../../glossary.rst:504 +#: ../../glossary.rst:543 msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments ` which may be used in the " -"execution of the body. See also :term:`parameter`, :term:`method`, and the :" -"ref:`function` section." +"execution of the body. See also :term:`parameter`, :term:`method`, and " +"the :ref:`function` section." msgstr "" "一連串的陳述式,它能夠向呼叫者回傳一些值。它也可以被傳遞零個或多個\\ :term:`" -"引數 `,這些引數可被使用於函式本體的執行。另請參閱 :term:" -"`parameter`\\ (參數)、:term:`method`\\ (方法),以及\\ :ref:`function`\\ " -"章節。" +"引數 `,這些引數可被使用於函式本體的執行。另請參" +"閱 :term:`parameter`\\ (參數)、:term:`method`\\ (方法),以及" +"\\ :ref:`function`\\ 章節。" -#: ../../glossary.rst:508 +#: ../../glossary.rst:547 msgid "function annotation" msgstr "function annotation(函式註釋)" -#: ../../glossary.rst:510 +#: ../../glossary.rst:549 msgid "An :term:`annotation` of a function parameter or return value." msgstr "函式參數或回傳值的一個 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:512 +#: ../../glossary.rst:551 msgid "" "Function annotations are usually used for :term:`type hints `: " "for example, this function is expected to take two :class:`int` arguments " @@ -1191,7 +1278,7 @@ msgstr "" "函式註釋通常被使用於\\ :term:`型別提示 `:例如,這個函式預期會得到" "兩個 :class:`int` 引數,並會有一個 :class:`int` 回傳值: ::" -#: ../../glossary.rst:517 +#: ../../glossary.rst:556 msgid "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" @@ -1199,11 +1286,11 @@ msgstr "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" -#: ../../glossary.rst:520 +#: ../../glossary.rst:559 msgid "Function annotation syntax is explained in section :ref:`function`." msgstr "函式註釋的語法在\\ :ref:`function`\\ 章節有詳細解釋。" -#: ../../glossary.rst:522 +#: ../../glossary.rst:561 msgid "" "See :term:`variable annotation` and :pep:`484`, which describe this " "functionality. Also see :ref:`annotations-howto` for best practices on " @@ -1212,16 +1299,16 @@ msgstr "" "請參閱 :term:`variable annotation` 和 :pep:`484`,皆有此功能的描述。關於註釋" "的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:526 +#: ../../glossary.rst:565 msgid "__future__" msgstr "__future__" -#: ../../glossary.rst:528 +#: ../../glossary.rst:567 msgid "" "A :ref:`future statement `, ``from __future__ import ``, " "directs the compiler to compile the current module using syntax or semantics " -"that will become standard in a future release of Python. The :mod:" -"`__future__` module documents the possible values of *feature*. By " +"that will become standard in a future release of Python. " +"The :mod:`__future__` module documents the possible values of *feature*. By " "importing this module and evaluating its variables, you can see when a new " "feature was first added to the language and when it will (or did) become the " "default::" @@ -1232,7 +1319,7 @@ msgstr "" "import 此模組並對其變數求值,你可以看見一個新的功能是何時首次被新增到此語言" "中,以及它何時將會(或已經)成為預設的功能: ::" -#: ../../glossary.rst:536 +#: ../../glossary.rst:575 msgid "" ">>> import __future__\n" ">>> __future__.division\n" @@ -1242,11 +1329,11 @@ msgstr "" ">>> __future__.division\n" "_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)" -#: ../../glossary.rst:539 +#: ../../glossary.rst:578 msgid "garbage collection" msgstr "garbage collection(垃圾回收)" -#: ../../glossary.rst:541 +#: ../../glossary.rst:580 msgid "" "The process of freeing memory when it is not used anymore. Python performs " "garbage collection via reference counting and a cyclic garbage collector " @@ -1258,11 +1345,11 @@ msgstr "" "垃圾回收器 (cyclic garbage collector) 來完成。垃圾回收器可以使用 :mod:`gc` 模" "組對其進行控制。" -#: ../../glossary.rst:546 ../../glossary.rst:547 +#: ../../glossary.rst:585 ../../glossary.rst:586 msgid "generator" msgstr "generator(產生器)" -#: ../../glossary.rst:549 +#: ../../glossary.rst:588 msgid "" "A function which returns a :term:`generator iterator`. It looks like a " "normal function except that it contains :keyword:`yield` expressions for " @@ -1273,7 +1360,7 @@ msgstr "" "個正常的函式,但不同的是它包含了 :keyword:`yield` 運算式,能產生一系列的值," "這些值可用於 for 迴圈,或是以 :func:`next` 函式,每次檢索其中的一個值。" -#: ../../glossary.rst:554 +#: ../../glossary.rst:593 msgid "" "Usually refers to a generator function, but may refer to a *generator " "iterator* in some contexts. In cases where the intended meaning isn't " @@ -1282,15 +1369,15 @@ msgstr "" "這個術語通常用來表示一個產生器函式,但在某些情境中,也可能是表示\\ *產生器疊" "代器*。萬一想表達的意思不夠清楚,那就使用完整的術語,以避免歧義。" -#: ../../glossary.rst:557 +#: ../../glossary.rst:596 msgid "generator iterator" msgstr "generator iterator(產生器疊代器)" -#: ../../glossary.rst:559 +#: ../../glossary.rst:598 msgid "An object created by a :term:`generator` function." msgstr "一個由 :term:`generator`\\ (產生器)函式所建立的物件。" -#: ../../glossary.rst:561 +#: ../../glossary.rst:600 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "execution state (including local variables and pending try-statements). " @@ -1301,11 +1388,11 @@ msgstr "" "try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與那些" "每次呼叫時都要重新開始的函式有所不同)。" -#: ../../glossary.rst:567 ../../glossary.rst:568 +#: ../../glossary.rst:606 ../../glossary.rst:607 msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../glossary.rst:570 +#: ../../glossary.rst:609 msgid "" "An :term:`expression` that returns an :term:`iterator`. It looks like a " "normal expression followed by a :keyword:`!for` clause defining a loop " @@ -1317,7 +1404,7 @@ msgstr "" "變數、範圍以及一個選擇性的 :keyword:`!if` 子句。該組合運算式會為外層函式產生" "多個值: ::" -#: ../../glossary.rst:575 +#: ../../glossary.rst:614 msgid "" ">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" "285" @@ -1325,11 +1412,11 @@ msgstr "" ">>> sum(i*i for i in range(10)) # 平方之和 0, 1, 4, ... 81\n" "285" -#: ../../glossary.rst:577 +#: ../../glossary.rst:616 msgid "generic function" msgstr "generic function(泛型函式)" -#: ../../glossary.rst:579 +#: ../../glossary.rst:618 msgid "" "A function composed of multiple functions implementing the same operation " "for different types. Which implementation should be used during a call is " @@ -1338,49 +1425,50 @@ msgstr "" "一個由多個函式組成的函式,該函式會對不同的型別實作相同的運算。呼叫期間應該使" "用哪種實作,是由調度演算法 (dispatch algorithm) 來決定。" -#: ../../glossary.rst:583 +#: ../../glossary.rst:622 msgid "" -"See also the :term:`single dispatch` glossary entry, the :func:`functools." -"singledispatch` decorator, and :pep:`443`." +"See also the :term:`single dispatch` glossary entry, " +"the :func:`functools.singledispatch` decorator, and :pep:`443`." msgstr "" -"另請參閱 :term:`single dispatch`\\ (單一調度)術語表條目、:func:`functools." -"singledispatch` 裝飾器和 :pep:`443`。" +"另請參閱 :term:`single dispatch`\\ (單一調度)術語表條" +"目、:func:`functools.singledispatch` 裝飾器和 :pep:`443`。" -#: ../../glossary.rst:585 +#: ../../glossary.rst:624 msgid "generic type" msgstr "generic type(泛型型別)" -#: ../../glossary.rst:587 +#: ../../glossary.rst:626 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " -"class` such as :class:`list` or :class:`dict`. Used for :" -"term:`type hints ` and :term:`annotations `." +"class` such as :class:`list` or :class:`dict`. Used " +"for :term:`type hints ` and :term:`annotations `." msgstr "" -"一個能夠被參數化 (parameterized) 的 :term:`type`\\ (型別);通常是一個 :ref:" -"`容器型別 `,像是 :class:`list` 和 :class:`dict`。它被用於" -"\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" +"一個能夠被參數化 (parameterized) 的 :term:`type`\\ (型別);通常是一" +"個 :ref:`容器型別 `,像是 :class:`list` 和 :class:`dict`。它" +"被用於\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" -#: ../../glossary.rst:592 +#: ../../glossary.rst:631 msgid "" -"For more details, see :ref:`generic alias types`, :pep:" -"`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." +"For more details, see :ref:`generic alias types`, :pep:`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` " +"module." msgstr "" -"詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:" -"`484`、:pep:`585` 和 :mod:`typing` 模組。" +"詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:`484`、:pep:`585` 和 :mod:`typing` 模組。" -#: ../../glossary.rst:594 +#: ../../glossary.rst:633 msgid "GIL" msgstr "GIL" -#: ../../glossary.rst:596 +#: ../../glossary.rst:635 msgid "See :term:`global interpreter lock`." msgstr "請參閱 :term:`global interpreter lock`\\ (全域直譯器鎖)。" -#: ../../glossary.rst:597 +#: ../../glossary.rst:636 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../glossary.rst:599 +#: ../../glossary.rst:638 msgid "" "The mechanism used by the :term:`CPython` interpreter to assure that only " "one thread executes Python :term:`bytecode` at a time. This simplifies the " @@ -1397,7 +1485,7 @@ msgstr "" "(multi-threaded),但代價是會犧牲掉多處理器的機器能夠提供的一大部分平行性 " "(parallelism)。" -#: ../../glossary.rst:608 +#: ../../glossary.rst:647 msgid "" "However, some extension modules, either standard or third-party, are " "designed so as to release the GIL when doing computationally intensive tasks " @@ -1408,7 +1496,7 @@ msgstr "" "計算密集 (computationally intensive) 的任務時,可以解除 GIL。另外,在執行 I/" "O 時,GIL 總是會被解除。" -#: ../../glossary.rst:613 +#: ../../glossary.rst:652 msgid "" "As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil` " "build configuration. After building Python with this option, code must be " @@ -1423,11 +1511,18 @@ msgstr "" "多執行緒應用程式的效能,並使多核心 CPU 的高效使用變得更加容易。有關更多詳細資" "訊,請參閱 :pep:`703`。" -#: ../../glossary.rst:619 +#: ../../glossary.rst:659 +msgid "" +"In prior versions of Python's C API, a function might declare that it " +"requires the GIL to be held in order to use it. This refers to having " +"an :term:`attached thread state`." +msgstr "" + +#: ../../glossary.rst:662 msgid "hash-based pyc" msgstr "hash-based pyc(雜湊架構的 pyc)" -#: ../../glossary.rst:621 +#: ../../glossary.rst:664 msgid "" "A bytecode cache file that uses the hash rather than the last-modified time " "of the corresponding source file to determine its validity. See :ref:`pyc-" @@ -1436,23 +1531,23 @@ msgstr "" "一個位元組碼 (bytecode) 暫存檔,它使用雜湊值而不是對應原始檔案的最後修改時" "間,來確定其有效性。請參閱\\ :ref:`pyc-invalidation`。" -#: ../../glossary.rst:624 +#: ../../glossary.rst:667 msgid "hashable" msgstr "hashable(可雜湊的)" -#: ../../glossary.rst:626 +#: ../../glossary.rst:669 msgid "" "An object is *hashable* if it has a hash value which never changes during " "its lifetime (it needs a :meth:`~object.__hash__` method), and can be " "compared to other objects (it needs an :meth:`~object.__eq__` method). " "Hashable objects which compare equal must have the same hash value." msgstr "" -"如果一個物件有一個雜湊值,該值在其生命週期中永不改變(它需要一個 :meth:" -"`~object.__hash__` method),且可與其他物件互相比較(它需要一個 :meth:" -"`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結果為相等的" -"多個可雜湊物件,它們必須擁有相同的雜湊值。" +"如果一個物件有一個雜湊值,該值在其生命週期中永不改變(它需要一" +"個 :meth:`~object.__hash__` method),且可與其他物件互相比較(它需要一" +"個 :meth:`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結" +"果為相等的多個可雜湊物件,它們必須擁有相同的雜湊值。" -#: ../../glossary.rst:632 +#: ../../glossary.rst:675 msgid "" "Hashability makes an object usable as a dictionary key and a set member, " "because these data structures use the hash value internally." @@ -1460,7 +1555,7 @@ msgstr "" "可雜湊性 (hashability) 使一個物件可用作 dictionary(字典)的鍵和 set(集合)" "的成員,因為這些資料結構都在其內部使用了雜湊值。" -#: ../../glossary.rst:635 +#: ../../glossary.rst:678 msgid "" "Most of Python's immutable built-in objects are hashable; mutable containers " "(such as lists or dictionaries) are not; immutable containers (such as " @@ -1475,11 +1570,11 @@ msgstr "" "則這些物件會被預設為可雜湊的。它們在互相比較時都是不相等的(除非它們與自己比" "較),而它們的雜湊值則是衍生自它們的 :func:`id`。" -#: ../../glossary.rst:642 +#: ../../glossary.rst:685 msgid "IDLE" msgstr "IDLE" -#: ../../glossary.rst:644 +#: ../../glossary.rst:687 msgid "" "An Integrated Development and Learning Environment for Python. :ref:`idle` " "is a basic editor and interpreter environment which ships with the standard " @@ -1489,31 +1584,37 @@ msgstr "" "境)。:ref:`idle` 是一個基本的編輯器和直譯器環境,它和 Python 的標準發行版本" "一起被提供。" -#: ../../glossary.rst:647 +#: ../../glossary.rst:690 msgid "immortal" msgstr "immortal(不滅)" -#: ../../glossary.rst:649 +#: ../../glossary.rst:692 msgid "" -"*Immortal objects* are a CPython implementation detail introduced in :pep:" -"`683`." +"*Immortal objects* are a CPython implementation detail introduced " +"in :pep:`683`." msgstr "*不滅物件 (Immortal objects)* 是 :pep:`683` 引入的 CPython 實作細節。" -#: ../../glossary.rst:652 +#: ../../glossary.rst:695 msgid "" "If an object is immortal, its :term:`reference count` is never modified, and " "therefore it is never deallocated while the interpreter is running. For " "example, :const:`True` and :const:`None` are immortal in CPython." msgstr "" "如果一個物件是不滅的,它的\\ :term:`參照計數 `\\ 永遠不會被" -"修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` 和 :const:" -"`None` 在 CPython 中是不滅的。" +"修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` " +"和 :const:`None` 在 CPython 中是不滅的。" -#: ../../glossary.rst:655 +#: ../../glossary.rst:699 +msgid "" +"Immortal objects can be identified via :func:`sys._is_immortal`, or " +"via :c:func:`PyUnstable_IsImmortal` in the C API." +msgstr "" + +#: ../../glossary.rst:701 msgid "immutable" msgstr "immutable(不可變物件)" -#: ../../glossary.rst:657 +#: ../../glossary.rst:703 msgid "" "An object with a fixed value. Immutable objects include numbers, strings " "and tuples. Such an object cannot be altered. A new object has to be " @@ -1525,11 +1626,11 @@ msgstr "" "能被改變的。如果一個不同的值必須被儲存,則必須建立一個新的物件。它們在需要恆" "定雜湊值的地方,扮演重要的角色,例如 dictionary(字典)中的一個鍵。" -#: ../../glossary.rst:662 +#: ../../glossary.rst:708 msgid "import path" msgstr "import path(引入路徑)" -#: ../../glossary.rst:664 +#: ../../glossary.rst:710 msgid "" "A list of locations (or :term:`path entries `) that are searched " "by the :term:`path based finder` for modules to import. During import, this " @@ -1541,11 +1642,11 @@ msgstr "" "的位置。在 import 期間,此位置列表通常是來自 :data:`sys.path`,但對於子套件 " "(subpackage) 而言,它也可能是來自父套件的 ``__path__`` 屬性。" -#: ../../glossary.rst:669 +#: ../../glossary.rst:715 msgid "importing" msgstr "importing(引入)" -#: ../../glossary.rst:671 +#: ../../glossary.rst:717 msgid "" "The process by which Python code in one module is made available to Python " "code in another module." @@ -1553,23 +1654,23 @@ msgstr "" "一個過程。一個模組中的 Python 程式碼可以透過此過程,被另一個模組中的 Python " "程式碼使用。" -#: ../../glossary.rst:673 +#: ../../glossary.rst:719 msgid "importer" msgstr "importer(引入器)" -#: ../../glossary.rst:675 +#: ../../glossary.rst:721 msgid "" -"An object that both finds and loads a module; both a :term:`finder` and :" -"term:`loader` object." +"An object that both finds and loads a module; both a :term:`finder` " +"and :term:`loader` object." msgstr "" -"一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也是 :term:" -"`loader`\\ (載入器)物件。" +"一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也" +"是 :term:`loader`\\ (載入器)物件。" -#: ../../glossary.rst:677 +#: ../../glossary.rst:723 msgid "interactive" msgstr "interactive(互動的)" -#: ../../glossary.rst:679 +#: ../../glossary.rst:725 msgid "" "Python has an interactive interpreter which means you can enter statements " "and expressions at the interpreter prompt, immediately execute them and see " @@ -1583,11 +1684,11 @@ msgstr "" "從你的電腦的主選單選擇它)。這是測試新想法或檢查模組和包的非常強大的方法(請" "記住help(x))。更多互動式模式相關資訊請見 :ref:`tut-interac`。" -#: ../../glossary.rst:686 +#: ../../glossary.rst:732 msgid "interpreted" msgstr "interpreted(直譯的)" -#: ../../glossary.rst:688 +#: ../../glossary.rst:734 msgid "" "Python is an interpreted language, as opposed to a compiled one, though the " "distinction can be blurry because of the presence of the bytecode compiler. " @@ -1601,20 +1702,20 @@ msgstr "" "一個執行檔,然後再執行它。直譯語言通常比編譯語言有更短的開發/除錯週期,不過" "它們的程式通常也運行得較慢。另請參閱 :term:`interactive`\\ (互動的)。" -#: ../../glossary.rst:695 +#: ../../glossary.rst:741 msgid "interpreter shutdown" msgstr "interpreter shutdown(直譯器關閉)" -#: ../../glossary.rst:697 +#: ../../glossary.rst:743 msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " -"critical internal structures. It also makes several calls to the :term:" -"`garbage collector `. This can trigger the execution of " -"code in user-defined destructors or weakref callbacks. Code executed during " -"the shutdown phase can encounter various exceptions as the resources it " -"relies on may not function anymore (common examples are library modules or " -"the warnings machinery)." +"critical internal structures. It also makes several calls to " +"the :term:`garbage collector `. This can trigger the " +"execution of code in user-defined destructors or weakref callbacks. Code " +"executed during the shutdown phase can encounter various exceptions as the " +"resources it relies on may not function anymore (common examples are library " +"modules or the warnings machinery)." msgstr "" "當 Python 直譯器被要求關閉時,它會進入一個特殊階段,在此它逐漸釋放所有被配置" "的資源,例如模組和各種關鍵內部結構。它也會多次呼叫\\ :term:`垃圾回收器 " @@ -1623,104 +1724,109 @@ msgstr "" "段被執行的程式碼會遇到各種例外,因為它所依賴的資源可能不再有作用了(常見的例" "子是函式庫模組或是警告機制)。" -#: ../../glossary.rst:706 +#: ../../glossary.rst:752 msgid "" "The main reason for interpreter shutdown is that the ``__main__`` module or " "the script being run has finished executing." msgstr "" "直譯器關閉的主要原因,是 ``__main__`` 模組或正被運行的腳本已經執行完成。" -#: ../../glossary.rst:708 +#: ../../glossary.rst:754 msgid "iterable" msgstr "iterable(可疊代物件)" -#: ../../glossary.rst:710 +#: ../../glossary.rst:756 msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " -"and :class:`tuple`) and some non-sequence types like :class:`dict`, :term:" -"`file objects `, and objects of any classes you define with an :" -"meth:`~object.__iter__` method or with a :meth:`~object.__getitem__` method " -"that implements :term:`sequence` semantics." +"and :class:`tuple`) and some non-sequence types " +"like :class:`dict`, :term:`file objects `, and objects of any " +"classes you define with an :meth:`~object.__iter__` method or with " +"a :meth:`~object.__getitem__` method that implements :term:`sequence` " +"semantics." msgstr "" "一種能夠一次回傳一個其中成員的物件。可疊代物件的例子包括所有的序列型別(像" -"是 :class:`list`、:class:`str` 和 :class:`tuple`\\ )和某些非序列型別,像是 :" -"class:`dict`、:term:`檔案物件 `,以及你所定義的任何 class 物件," -"只要那些 class 有實作 :term:`sequence`\\ (序列)語意的 :meth:`~object." -"__iter__` 或是 :meth:`~object.__getitem__` method,該物件就是可疊代物件。" +"是 :class:`list`、:class:`str` 和 :class:`tuple`\\ )和某些非序列型別,像" +"是 :class:`dict`、:term:`檔案物件 `,以及你所定義的任何 class 物" +"件,只要那些 class 有實作 :term:`sequence`\\ (序列)語意" +"的 :meth:`~object.__iter__` 或是 :meth:`~object.__getitem__` method,該物件就" +"是可疊代物件。" -#: ../../glossary.rst:718 +#: ../../glossary.rst:764 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " -"iterable object is passed as an argument to the built-in function :func:" -"`iter`, it returns an iterator for the object. This iterator is good for " -"one pass over the set of values. When using iterables, it is usually not " -"necessary to call :func:`iter` or deal with iterator objects yourself. The :" -"keyword:`for` statement does that automatically for you, creating a " -"temporary unnamed variable to hold the iterator for the duration of the " -"loop. See also :term:`iterator`, :term:`sequence`, and :term:`generator`." -msgstr "" -"可疊代物件可用於 :keyword:`for` 迴圈和許多其他需要一個序列的地方 (:func:" -"`zip`、:func:`map`\\ ...)。當一個可疊代物件作為引數被傳遞給內建函式 :func:" -"`iter` 時,它會為該物件回傳一個疊代器。此疊代器適用於針對一組值進行一遍 (one " -"pass) 運算。使用疊代器時,通常不一定要呼叫 :func:`iter` 或自行處理疊代器物" -"件。:keyword:`for` 陳述式會自動地為你處理這些事,它會建立一個暫時性的未命名變" -"數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代器)、:" -"term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" - -#: ../../glossary.rst:728 +"iterable object is passed as an argument to the built-in " +"function :func:`iter`, it returns an iterator for the object. This iterator " +"is good for one pass over the set of values. When using iterables, it is " +"usually not necessary to call :func:`iter` or deal with iterator objects " +"yourself. The :keyword:`for` statement does that automatically for you, " +"creating a temporary unnamed variable to hold the iterator for the duration " +"of the loop. See also :term:`iterator`, :term:`sequence`, " +"and :term:`generator`." +msgstr "" +"可疊代物件可用於 :keyword:`for` 迴圈和許多其他需要一個序列的地方 " +"(:func:`zip`、:func:`map`\\ ...)。當一個可疊代物件作為引數被傳遞給內建函" +"式 :func:`iter` 時,它會為該物件回傳一個疊代器。此疊代器適用於針對一組值進行" +"一遍 (one pass) 運算。使用疊代器時,通常不一定要呼叫 :func:`iter` 或自行處理" +"疊代器物件。:keyword:`for` 陳述式會自動地為你處理這些事,它會建立一個暫時性的" +"未命名變數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代" +"器)、:term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" + +#: ../../glossary.rst:774 msgid "iterator" msgstr "iterator(疊代器)" -#: ../../glossary.rst:730 -msgid "" -"An object representing a stream of data. Repeated calls to the iterator's :" -"meth:`~iterator.__next__` method (or passing it to the built-in function :" -"func:`next`) return successive items in the stream. When no more data are " -"available a :exc:`StopIteration` exception is raised instead. At this " -"point, the iterator object is exhausted and any further calls to its :meth:`!" -"__next__` method just raise :exc:`StopIteration` again. Iterators are " -"required to have an :meth:`~iterator.__iter__` method that returns the " -"iterator object itself so every iterator is also iterable and may be used in " -"most places where other iterables are accepted. One notable exception is " -"code which attempts multiple iteration passes. A container object (such as " -"a :class:`list`) produces a fresh new iterator each time you pass it to the :" -"func:`iter` function or use it in a :keyword:`for` loop. Attempting this " -"with an iterator will just return the same exhausted iterator object used in " -"the previous iteration pass, making it appear like an empty container." +#: ../../glossary.rst:776 +msgid "" +"An object representing a stream of data. Repeated calls to the " +"iterator's :meth:`~iterator.__next__` method (or passing it to the built-in " +"function :func:`next`) return successive items in the stream. When no more " +"data are available a :exc:`StopIteration` exception is raised instead. At " +"this point, the iterator object is exhausted and any further calls to " +"its :meth:`!__next__` method just raise :exc:`StopIteration` again. " +"Iterators are required to have an :meth:`~iterator.__iter__` method that " +"returns the iterator object itself so every iterator is also iterable and " +"may be used in most places where other iterables are accepted. One notable " +"exception is code which attempts multiple iteration passes. A container " +"object (such as a :class:`list`) produces a fresh new iterator each time you " +"pass it to the :func:`iter` function or use it in a :keyword:`for` loop. " +"Attempting this with an iterator will just return the same exhausted " +"iterator object used in the previous iteration pass, making it appear like " +"an empty container." msgstr "" "一個表示資料流的物件。重複地呼叫疊代器的 :meth:`~iterator.__next__` method" "(或是將它傳遞給內建函式 :func:`next`\\ )會依序回傳資料流中的各項目。當不再" "有資料時,則會引發 :exc:`StopIteration` 例外。此時,該疊代器物件已被用盡,而" -"任何對其 :meth:`!__next__` method 的進一步呼叫,都只會再次引發 :exc:" -"`StopIteration`。疊代器必須有一個 :meth:`~iterator.__iter__` method,它會回傳" -"疊代器物件本身,所以每個疊代器也都是可疊代物件,且可以用於大多數適用其他可疊" -"代物件的場合。一個明顯的例外,是嘗試多遍疊代 (multiple iteration passes) 的程" -"式碼。一個容器物件(像是 :class:`list`)在每次你將它傳遞給 :func:`iter` 函式" -"或在 :keyword:`for` 迴圈中使用它時,都會產生一個全新的疊代器。使用疊代器嘗試" -"此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一個已被用盡的疊代器物" -"件,使其看起來就像一個空的容器。" - -#: ../../glossary.rst:745 +"任何對其 :meth:`!__next__` method 的進一步呼叫,都只會再次引" +"發 :exc:`StopIteration`。疊代器必須有一個 :meth:`~iterator.__iter__` method," +"它會回傳疊代器物件本身,所以每個疊代器也都是可疊代物件,且可以用於大多數適用" +"其他可疊代物件的場合。一個明顯的例外,是嘗試多遍疊代 (multiple iteration " +"passes) 的程式碼。一個容器物件(像是 :class:`list`)在每次你將它傳遞" +"給 :func:`iter` 函式或在 :keyword:`for` 迴圈中使用它時,都會產生一個全新的疊" +"代器。使用疊代器嘗試此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一" +"個已被用盡的疊代器物件,使其看起來就像一個空的容器。" + +#: ../../glossary.rst:791 msgid "More information can be found in :ref:`typeiter`." msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" -#: ../../glossary.rst:749 +#: ../../glossary.rst:795 msgid "" -"CPython does not consistently apply the requirement that an iterator define :" -"meth:`~iterator.__iter__`. And also please note that the free-threading " -"CPython does not guarantee the thread-safety of iterator operations." +"CPython does not consistently apply the requirement that an iterator " +"define :meth:`~iterator.__iter__`. And also please note that the free-" +"threading CPython does not guarantee the thread-safety of iterator " +"operations." msgstr "" -"CPython 並不是始終如一地都會檢查「疊代器有定義 :meth:`~iterator." -"__iter__`\\ 」這個規定。另請注意,free-threading(自由執行緒)CPython 不保證" -"疊代器操作的執行緒安全。" +"CPython 並不是始終如一地都會檢查「疊代器有定" +"義 :meth:`~iterator.__iter__`\\ 」這個規定。另請注意,free-threading(自由執" +"行緒)CPython 不保證疊代器操作的執行緒安全。" -#: ../../glossary.rst:754 +#: ../../glossary.rst:800 msgid "key function" msgstr "key function(鍵函式)" -#: ../../glossary.rst:756 +#: ../../glossary.rst:802 msgid "" "A key function or collation function is a callable that returns a value used " "for sorting or ordering. For example, :func:`locale.strxfrm` is used to " @@ -1730,48 +1836,48 @@ msgstr "" "一個用於排序 (sorting) 或定序 (ordering) 的值。例如,:func:`locale.strxfrm` " "被用來產生一個了解區域特定排序慣例的排序鍵。" -#: ../../glossary.rst:761 +#: ../../glossary.rst:807 msgid "" "A number of tools in Python accept key functions to control how elements are " -"ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" -"meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq." -"nlargest`, and :func:`itertools.groupby`." +"ordered or grouped. They " +"include :func:`min`, :func:`max`, :func:`sorted`, :meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq.nlargest`, " +"and :func:`itertools.groupby`." msgstr "" -"Python 中的許多工具,都接受以鍵函式來控制元素被定序或分組的方式。它們包括 :" -"func:`min`、:func:`max`、:func:`sorted`、:meth:`list.sort`、:func:`heapq." -"merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` 和 :func:`itertools." -"groupby`。" +"Python 中的許多工具,都接受以鍵函式來控制元素被定序或分組的方式。它們包" +"括 :func:`min`、:func:`max`、:func:`sorted`、:meth:`list.sort`、:func:`heapq.merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` " +"和 :func:`itertools.groupby`。" -#: ../../glossary.rst:767 +#: ../../glossary.rst:813 msgid "" -"There are several ways to create a key function. For example. the :meth:" -"`str.lower` method can serve as a key function for case insensitive sorts. " -"Alternatively, a key function can be built from a :keyword:`lambda` " -"expression such as ``lambda r: (r[0], r[2])``. Also, :func:`operator." -"attrgetter`, :func:`operator.itemgetter`, and :func:`operator.methodcaller` " -"are three key function constructors. See the :ref:`Sorting HOW TO " -"` for examples of how to create and use key functions." +"There are several ways to create a key function. For example. " +"the :meth:`str.lower` method can serve as a key function for case " +"insensitive sorts. Alternatively, a key function can be built from " +"a :keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``. " +"Also, :func:`operator.attrgetter`, :func:`operator.itemgetter`, " +"and :func:`operator.methodcaller` are three key function constructors. See " +"the :ref:`Sorting HOW TO ` for examples of how to create and " +"use key functions." msgstr "" "有幾種方法可以建立一個鍵函式。例如,:meth:`str.lower` method 可以作為不分大小" "寫排序的鍵函式。或者,一個鍵函式也可以從 :keyword:`lambda` 運算式被建造,例" -"如 ``lambda r: (r[0], r[2])``。另外,:func:`operator.attrgetter`、:func:" -"`operator.itemgetter` 和 :func:`operator.methodcaller` 為三個鍵函式的建構函" -"式 (constructor)。關於如何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 " -"`。" +"如 ``lambda r: (r[0], r[2])``。另" +"外,:func:`operator.attrgetter`、:func:`operator.itemgetter` " +"和 :func:`operator.methodcaller` 為三個鍵函式的建構函式 (constructor)。關於如" +"何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 `。" -#: ../../glossary.rst:774 +#: ../../glossary.rst:820 msgid "keyword argument" msgstr "keyword argument(關鍵字引數)" -#: ../../glossary.rst:776 ../../glossary.rst:1091 +#: ../../glossary.rst:822 ../../glossary.rst:1137 msgid "See :term:`argument`." msgstr "請參閱 :term:`argument`\\ (引數)。" -#: ../../glossary.rst:777 +#: ../../glossary.rst:823 msgid "lambda" msgstr "lambda" -#: ../../glossary.rst:779 +#: ../../glossary.rst:825 msgid "" "An anonymous inline function consisting of a single :term:`expression` which " "is evaluated when the function is called. The syntax to create a lambda " @@ -1781,11 +1887,11 @@ msgstr "" "function),於該函式被呼叫時求值。建立 lambda 函式的語法是 ``lambda " "[parameters]: expression``" -#: ../../glossary.rst:782 +#: ../../glossary.rst:828 msgid "LBYL" msgstr "LBYL" -#: ../../glossary.rst:784 +#: ../../glossary.rst:830 msgid "" "Look before you leap. This coding style explicitly tests for pre-conditions " "before making calls or lookups. This style contrasts with the :term:`EAFP` " @@ -1793,10 +1899,10 @@ msgid "" "statements." msgstr "" "Look before you leap.(三思而後行。)這種編碼風格會在進行呼叫或查找之前,明確" -"地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許多 :" -"keyword:`if` 陳述式的存在。" +"地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許" +"多 :keyword:`if` 陳述式的存在。" -#: ../../glossary.rst:789 +#: ../../glossary.rst:835 msgid "" "In a multi-threaded environment, the LBYL approach can risk introducing a " "race condition between \"the looking\" and \"the leaping\". For example, " @@ -1810,19 +1916,19 @@ msgstr "" "了 *key*,則該程式碼就會失效。這個問題可以用鎖 (lock) 或使用 EAFP 編碼方式來" "解決。" -#: ../../glossary.rst:794 +#: ../../glossary.rst:840 msgid "lexical analyzer" msgstr "lexical analyzer(詞法分析器)" -#: ../../glossary.rst:797 +#: ../../glossary.rst:843 msgid "Formal name for the *tokenizer*; see :term:`token`." msgstr "tokenizer 的正式名稱;請參閱 :term:`token`。" -#: ../../glossary.rst:798 +#: ../../glossary.rst:844 msgid "list" msgstr "list(串列)" -#: ../../glossary.rst:800 +#: ../../glossary.rst:846 msgid "" "A built-in Python :term:`sequence`. Despite its name it is more akin to an " "array in other languages than to a linked list since access to elements is " @@ -1832,11 +1938,11 @@ msgstr "" "似其他語言中的一個陣列 (array) 而較不像一個鏈結串列 (linked list),因為存取元" "素的時間複雜度是 *O*\\ (1)。" -#: ../../glossary.rst:803 +#: ../../glossary.rst:849 msgid "list comprehension" msgstr "list comprehension(串列綜合運算)" -#: ../../glossary.rst:805 +#: ../../glossary.rst:851 msgid "" "A compact way to process all or part of the elements in a sequence and " "return a list with the results. ``result = ['{:#04x}'.format(x) for x in " @@ -1846,98 +1952,101 @@ msgid "" msgstr "" "一種用來處理一個序列中的全部或部分元素,並將處理結果以一個 list 回傳的簡要方" "法。``result = ['{:#04x}'.format(x) for x in range(256) if x % 2 == 0]`` 會產" -"生一個字串 list,其中包含 0 到 255 範圍內,所有偶數的十六進位數 (0x..)。:" -"keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有元素都會被" -"處理。" +"生一個字串 list,其中包含 0 到 255 範圍內,所有偶數的十六進位數 " +"(0x..)。:keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有" +"元素都會被處理。" -#: ../../glossary.rst:811 +#: ../../glossary.rst:857 msgid "loader" msgstr "loader(載入器)" -#: ../../glossary.rst:813 +#: ../../glossary.rst:859 msgid "" -"An object that loads a module. It must define the :meth:`!exec_module` and :" -"meth:`!create_module` methods to implement the :class:`~importlib.abc." -"Loader` interface. A loader is typically returned by a :term:`finder`. See " -"also:" +"An object that loads a module. It must define the :meth:`!exec_module` " +"and :meth:`!create_module` methods to implement " +"the :class:`~importlib.abc.Loader` interface. A loader is typically returned " +"by a :term:`finder`. See also:" msgstr "" "一個能夠載入模組的物件。它必須定義 :meth:`!exec_module` 和 :meth:`!" "create_module` 方法以實作 :class:`~importlib.abc.Loader` 介面。載入器通常是" "被 :term:`finder`\\ (尋檢器)回傳。更多細節請參閱:" -#: ../../glossary.rst:819 +#: ../../glossary.rst:865 msgid ":ref:`finders-and-loaders`" msgstr ":ref:`finders-and-loaders`" -#: ../../glossary.rst:820 +#: ../../glossary.rst:866 msgid ":class:`importlib.abc.Loader`" msgstr ":class:`importlib.abc.Loader`" -#: ../../glossary.rst:821 +#: ../../glossary.rst:867 msgid ":pep:`302`" msgstr ":pep:`302`" -#: ../../glossary.rst:822 +#: ../../glossary.rst:868 msgid "locale encoding" msgstr "locale encoding(區域編碼)" -#: ../../glossary.rst:824 +#: ../../glossary.rst:870 msgid "" -"On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" -"`locale.setlocale(locale.LC_CTYPE, new_locale) `." +"On Unix, it is the encoding of the LC_CTYPE locale. It can be set " +"with :func:`locale.setlocale(locale.LC_CTYPE, new_locale) " +"`." msgstr "" -"在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以用 :func:`locale." -"setlocale(locale.LC_CTYPE, new_locale) ` 來設定。" +"在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以" +"用 :func:`locale.setlocale(locale.LC_CTYPE, new_locale) ` " +"來設定。" -#: ../../glossary.rst:827 +#: ../../glossary.rst:873 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." msgstr "在 Windows 上,它是 ANSI 碼頁(code page,例如 ``\"cp1252\"``\\ )。" -#: ../../glossary.rst:829 +#: ../../glossary.rst:875 msgid "" "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "在 Android 和 VxWorks 上,Python 使用 ``\"utf-8\"`` 作為區域編碼。" -#: ../../glossary.rst:831 +#: ../../glossary.rst:877 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr ":func:`locale.getencoding` 可以用來取得區域編碼。" -#: ../../glossary.rst:833 +#: ../../glossary.rst:879 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "也請參考 :term:`filesystem encoding and error handler`。" -#: ../../glossary.rst:834 +#: ../../glossary.rst:880 msgid "magic method" msgstr "magic method(魔術方法)" -#: ../../glossary.rst:838 +#: ../../glossary.rst:884 msgid "An informal synonym for :term:`special method`." msgstr ":term:`special method`\\ (特殊方法)的一個非正式同義詞。" -#: ../../glossary.rst:839 +#: ../../glossary.rst:885 msgid "mapping" msgstr "mapping(對映)" -#: ../../glossary.rst:841 +#: ../../glossary.rst:887 msgid "" "A container object that supports arbitrary key lookups and implements the " -"methods specified in the :class:`collections.abc.Mapping` or :class:" -"`collections.abc.MutableMapping` :ref:`abstract base classes `. Examples include :class:`dict`, :class:" -"`collections.defaultdict`, :class:`collections.OrderedDict` and :class:" -"`collections.Counter`." +"methods specified in the :class:`collections.abc.Mapping` " +"or :class:`collections.abc.MutableMapping` :ref:`abstract base classes " +"`. Examples " +"include :class:`dict`, :class:`collections.defaultdict`, :class:`collections.OrderedDict` " +"and :class:`collections.Counter`." msgstr "" "一個容器物件,它支援任意鍵的查找,且能實作 :ref:`abstract base classes(抽象" -"基底類別) `\\ 中,:class:`collections." -"abc.Mapping` 或 :class:`collections.abc.MutableMapping` 所指定的 method。範例" -"包括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections." -"OrderedDict` 和 :class:`collections.Counter`。" +"基底類別) `\\ " +"中,:class:`collections.abc.Mapping` " +"或 :class:`collections.abc.MutableMapping` 所指定的 method。範例包" +"括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections.OrderedDict` " +"和 :class:`collections.Counter`。" -#: ../../glossary.rst:847 +#: ../../glossary.rst:893 msgid "meta path finder" msgstr "meta path finder(元路徑尋檢器)" -#: ../../glossary.rst:849 +#: ../../glossary.rst:895 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders ` " "相關但是不同。" -#: ../../glossary.rst:853 +#: ../../glossary.rst:899 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." msgstr "" "關於元路徑尋檢器實作的 method,請參閱 :class:`importlib.abc.MetaPathFinder`。" -#: ../../glossary.rst:855 +#: ../../glossary.rst:901 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../glossary.rst:857 +#: ../../glossary.rst:903 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -1978,31 +2087,31 @@ msgstr "" "性存取、增加執行緒安全性、追蹤物件建立、實作單例模式 (singleton),以及許多其" "他的任務。" -#: ../../glossary.rst:867 +#: ../../glossary.rst:913 msgid "More information can be found in :ref:`metaclasses`." msgstr "更多資訊可以在\\ :ref:`metaclasses`\\ 章節中找到。" -#: ../../glossary.rst:836 ../../glossary.rst:868 ../../glossary.rst:1241 +#: ../../glossary.rst:882 ../../glossary.rst:914 ../../glossary.rst:1288 msgid "method" msgstr "method(方法)" -#: ../../glossary.rst:870 +#: ../../glossary.rst:916 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " -"first :term:`argument` (which is usually called ``self``). See :term:" -"`function` and :term:`nested scope`." +"first :term:`argument` (which is usually called ``self``). " +"See :term:`function` and :term:`nested scope`." msgstr "" "一個在 class 本體內被定義的函式。如果 method 作為其 class 實例的一個屬性被呼" "叫,則它將會得到該實例物件成為它的第一個 :term:`argument`\\ (引數)(此引數" "通常被稱為 ``self``)。請參閱 :term:`function`\\ (函式)和 :term:`nested " "scope`\\ (巢狀作用域)。" -#: ../../glossary.rst:874 +#: ../../glossary.rst:920 msgid "method resolution order" msgstr "method resolution order(方法解析順序)" -#: ../../glossary.rst:876 +#: ../../glossary.rst:922 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See :ref:`python_2.3_mro` for details of the " @@ -2011,11 +2120,11 @@ msgstr "" "方法解析順序是在查找某個成員的過程中,base class(基底類別)被搜尋的順序。關" "於 Python 自 2.3 版直譯器所使用的演算法細節,請參閱 :ref:`python_2.3_mro`。" -#: ../../glossary.rst:879 +#: ../../glossary.rst:925 msgid "module" msgstr "module(模組)" -#: ../../glossary.rst:881 +#: ../../glossary.rst:927 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -2025,51 +2134,51 @@ msgstr "" "空間,它包含任意的 Python 物件。模組是藉由 :term:`importing` 的過程,被載入" "至 Python。" -#: ../../glossary.rst:885 +#: ../../glossary.rst:931 msgid "See also :term:`package`." msgstr "另請參閱 :term:`package`\\ (套件)。" -#: ../../glossary.rst:886 +#: ../../glossary.rst:932 msgid "module spec" msgstr "module spec(模組規格)" -#: ../../glossary.rst:888 +#: ../../glossary.rst:934 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." msgstr "" -"一個命名空間,它包含用於載入模組的 import 相關資訊。它是 :class:`importlib." -"machinery.ModuleSpec` 的一個實例。" +"一個命名空間,它包含用於載入模組的 import 相關資訊。它" +"是 :class:`importlib.machinery.ModuleSpec` 的一個實例。" -#: ../../glossary.rst:891 +#: ../../glossary.rst:937 msgid "See also :ref:`module-specs`." msgstr "另請參閱 :ref:`module-specs`。" -#: ../../glossary.rst:892 +#: ../../glossary.rst:938 msgid "MRO" msgstr "MRO" -#: ../../glossary.rst:894 +#: ../../glossary.rst:940 msgid "See :term:`method resolution order`." msgstr "請參閱 :term:`method resolution order`\\ (方法解析順序)。" -#: ../../glossary.rst:895 +#: ../../glossary.rst:941 msgid "mutable" msgstr "mutable(可變物件)" -#: ../../glossary.rst:897 +#: ../../glossary.rst:943 msgid "" -"Mutable objects can change their value but keep their :func:`id`. See also :" -"term:`immutable`." +"Mutable objects can change their value but keep their :func:`id`. See " +"also :term:`immutable`." msgstr "" -"可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參閱 :term:" -"`immutable`\\ (不可變物件)。" +"可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參" +"閱 :term:`immutable`\\ (不可變物件)。" -#: ../../glossary.rst:899 +#: ../../glossary.rst:945 msgid "named tuple" msgstr "named tuple(附名元組)" -#: ../../glossary.rst:901 +#: ../../glossary.rst:947 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -2079,16 +2188,16 @@ msgstr "" "索引 (indexable) 元素也可以用附名屬性來存取。這些型別或 class 也可以具有其他" "的特性。" -#: ../../glossary.rst:905 +#: ../../glossary.rst:951 msgid "" -"Several built-in types are named tuples, including the values returned by :" -"func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." -"float_info`::" +"Several built-in types are named tuples, including the values returned " +"by :func:`time.localtime` and :func:`os.stat`. Another example " +"is :data:`sys.float_info`::" msgstr "" "有些內建型別是 named tuple,包括由 :func:`time.localtime` 和 :func:`os.stat` " "回傳的值。另一個例子是 :data:`sys.float_info`: ::" -#: ../../glossary.rst:909 +#: ../../glossary.rst:955 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -2104,52 +2213,54 @@ msgstr "" ">>> isinstance(sys.float_info, tuple) # 屬於 tuple 型別\n" "True" -#: ../../glossary.rst:916 +#: ../../glossary.rst:962 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " "that inherits from :class:`tuple` and that defines named fields. Such a " -"class can be written by hand, or it can be created by inheriting :class:" -"`typing.NamedTuple`, or with the factory function :func:`collections." -"namedtuple`. The latter techniques also add some extra methods that may not " -"be found in hand-written or built-in named tuples." +"class can be written by hand, or it can be created by " +"inheriting :class:`typing.NamedTuple`, or with the factory " +"function :func:`collections.namedtuple`. The latter techniques also add " +"some extra methods that may not be found in hand-written or built-in named " +"tuples." msgstr "" "有些 named tuple 是內建型別(如上例)。或者,一個 named tuple 也可以從一個正" "規的 class 定義來建立,只要該 class 是繼承自 :class:`tuple`,且定義了附名欄" -"位 (named field) 即可。這類的 class 可以手工編寫、可以繼承自 :class:`typing." -"NamedTuple` 來建立,也可以使用工廠函式 (factory function) :func:`collections." -"namedtuple` 來建立。後者技術也增加了一些額外的 method,這些 method 可能是在手" -"寫或內建的 named tuple 中,無法找到的。" +"位 (named field) 即可。這類的 class 可以手工編寫、可以繼承" +"自 :class:`typing.NamedTuple` 來建立,也可以使用工廠函式 (factory " +"function) :func:`collections.namedtuple` 來建立。後者技術也增加了一些額外的 " +"method,這些 method 可能是在手寫或內建的 named tuple 中,無法找到的。" -#: ../../glossary.rst:924 +#: ../../glossary.rst:970 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../glossary.rst:926 +#: ../../glossary.rst:972 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " "as nested namespaces in objects (in methods). Namespaces support modularity " -"by preventing naming conflicts. For instance, the functions :func:`builtins." -"open <.open>` and :func:`os.open` are distinguished by their namespaces. " -"Namespaces also aid readability and maintainability by making it clear which " -"module implements a function. For instance, writing :func:`random.seed` or :" -"func:`itertools.islice` makes it clear that those functions are implemented " -"by the :mod:`random` and :mod:`itertools` modules, respectively." +"by preventing naming conflicts. For instance, the " +"functions :func:`builtins.open <.open>` and :func:`os.open` are " +"distinguished by their namespaces. Namespaces also aid readability and " +"maintainability by making it clear which module implements a function. For " +"instance, writing :func:`random.seed` or :func:`itertools.islice` makes it " +"clear that those functions are implemented by the :mod:`random` " +"and :mod:`itertools` modules, respectively." msgstr "" "變數被儲存的地方。命名空間是以 dictionary(字典)被實作。有區域的、全域的及內" "建的命名空間,而在物件中(在 method 中)也有巢狀的命名空間。命名空間藉由防止" -"命名衝突,來支援模組化。例如,函式 :func:`builtins.open <.open>` 和 :func:" -"`os.open` 是透過它們的命名空間來區分彼此。命名空間也藉由明確地區分是哪個模組" -"在實作一個函式,來增進可讀性及可維護性。例如,寫出 :func:`random.seed` 或 :" -"func:`itertools.islice` 明確地表示,這些函式分別是由 :mod:`random` 和 :mod:" -"`itertools` 模組在實作。" +"命名衝突,來支援模組化。例如,函式 :func:`builtins.open <.open>` " +"和 :func:`os.open` 是透過它們的命名空間來區分彼此。命名空間也藉由明確地區分是" +"哪個模組在實作一個函式,來增進可讀性及可維護性。例如,寫" +"出 :func:`random.seed` 或 :func:`itertools.islice` 明確地表示,這些函式分別是" +"由 :mod:`random` 和 :mod:`itertools` 模組在實作。" -#: ../../glossary.rst:936 +#: ../../glossary.rst:982 msgid "namespace package" msgstr "namespace package(命名空間套件)" -#: ../../glossary.rst:938 +#: ../../glossary.rst:984 msgid "" "A :term:`package` which serves only as a container for subpackages. " "Namespace packages may have no physical representation, and specifically are " @@ -2159,7 +2270,7 @@ msgstr "" "名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:`regular " "package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" -#: ../../glossary.rst:943 +#: ../../glossary.rst:989 msgid "" "Namespace packages allow several individually installable packages to have a " "common parent package. Otherwise, it is recommended to use a :term:`regular " @@ -2168,20 +2279,20 @@ msgstr "" "命名空間套件允許數個可獨立安裝的套件擁有一個共同的父套件。除此之外,建議使" "用 :term:`regular package`。" -#: ../../glossary.rst:946 +#: ../../glossary.rst:992 msgid "" "For more information, see :pep:`420` and :ref:`reference-namespace-package`." msgstr "更多資訊,請參閱 :pep:`420` 和 :ref:`reference-namespace-package`。" -#: ../../glossary.rst:948 +#: ../../glossary.rst:994 msgid "See also :term:`module`." msgstr "另請參閱 :term:`module`\\ (模組)。" -#: ../../glossary.rst:949 +#: ../../glossary.rst:995 msgid "nested scope" msgstr "nested scope(巢狀作用域)" -#: ../../glossary.rst:951 +#: ../../glossary.rst:997 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -2196,39 +2307,41 @@ msgstr "" "寫入。同樣地,全域變數是在全域命名空間中讀取及寫入。:keyword:`nonlocal` 容許" "對外層作用域進行寫入。" -#: ../../glossary.rst:958 +#: ../../glossary.rst:1004 msgid "new-style class" msgstr "new-style class(新式類別)" -#: ../../glossary.rst:960 +#: ../../glossary.rst:1006 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " -"versatile features like :attr:`~object.__slots__`, descriptors, properties, :" -"meth:`~object.__getattribute__`, class methods, and static methods." +"versatile features like :attr:`~object.__slots__`, descriptors, " +"properties, :meth:`~object.__getattribute__`, class methods, and static " +"methods." msgstr "" "一個舊名,它是指現在所有的 class 物件所使用的 class 風格。在早期的 Python 版" -"本中,只有新式 class 才能使用 Python 較新的、多樣的功能,像是 :attr:`~object." -"__slots__`、描述器 (descriptor)、屬性 (property)、:meth:`~object." -"__getattribute__`、class method(類別方法)和 static method(靜態方法)。" +"本中,只有新式 class 才能使用 Python 較新的、多樣的功能,像" +"是 :attr:`~object.__slots__`、描述器 (descriptor)、屬性 " +"(property)、:meth:`~object.__getattribute__`、class method(類別方法)和 " +"static method(靜態方法)。" -#: ../../glossary.rst:965 +#: ../../glossary.rst:1011 msgid "object" msgstr "object(物件)" -#: ../../glossary.rst:967 +#: ../../glossary.rst:1013 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." msgstr "" -"具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任何 :term:" -"`new-style class`\\ (新式類別)的最終 base class(基底類別)。" +"具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任" +"何 :term:`new-style class`\\ (新式類別)的最終 base class(基底類別)。" -#: ../../glossary.rst:970 +#: ../../glossary.rst:1016 msgid "optimized scope" msgstr "optimized scope(最佳化作用域)" -#: ../../glossary.rst:972 +#: ../../glossary.rst:1018 msgid "" "A scope where target local variable names are reliably known to the compiler " "when the code is compiled, allowing optimization of read and write access to " @@ -2239,11 +2352,11 @@ msgid "" "to optimized scopes." msgstr "" -#: ../../glossary.rst:979 +#: ../../glossary.rst:1025 msgid "package" msgstr "package(套件)" -#: ../../glossary.rst:981 +#: ../../glossary.rst:1027 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " @@ -2253,17 +2366,17 @@ msgstr "" "迴的子套件 (subpackage)。技術上而言,套件就是具有 ``__path__`` 屬性的一個 " "Python 模組。" -#: ../../glossary.rst:985 +#: ../../glossary.rst:1031 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "" "另請參閱 :term:`regular package`\\ (正規套件)和 :term:`namespace " "package`\\ (命名空間套件)。" -#: ../../glossary.rst:986 +#: ../../glossary.rst:1032 msgid "parameter" msgstr "parameter(參數)" -#: ../../glossary.rst:988 +#: ../../glossary.rst:1034 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2273,7 +2386,7 @@ msgstr "" "它指明該函式能夠接受的一個 :term:`argument`\\ (引數),或在某些情況下指示多" "個引數。共有有五種不同的參數類型:" -#: ../../glossary.rst:992 +#: ../../glossary.rst:1038 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally ` or as a :term:`keyword argument " @@ -2284,11 +2397,11 @@ msgstr "" "置 `\\ 或是作為\\ :term:`關鍵字引數 `\\ 被傳遞的引數。這" "是參數的預設類型,例如以下的 *foo* 和 *bar*: ::" -#: ../../glossary.rst:997 +#: ../../glossary.rst:1043 msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." -#: ../../glossary.rst:1001 +#: ../../glossary.rst:1047 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2299,11 +2412,11 @@ msgstr "" "式定義的參數列表中包含一個 ``/`` 字元,就可以在該字元前面定義僅限位置參數,例" "如以下的 *posonly1* 和 *posonly2*: ::" -#: ../../glossary.rst:1006 +#: ../../glossary.rst:1052 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." -#: ../../glossary.rst:1010 +#: ../../glossary.rst:1056 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2316,11 +2429,11 @@ msgstr "" "單純的 ``*`` 字元,就可以在其後方定義僅限關鍵字參數,例如以下的 *kw_only1* " "和 *kw_only2*: ::" -#: ../../glossary.rst:1016 +#: ../../glossary.rst:1062 msgid "def func(arg, *, kw_only1, kw_only2): ..." msgstr "def func(arg, *, kw_only1, kw_only2): ..." -#: ../../glossary.rst:1018 +#: ../../glossary.rst:1064 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2332,11 +2445,11 @@ msgstr "" "數(在已被其他參數接受的任何位置引數之外)。這類參數是透過在其參數名稱字首加" "上 ``*`` 來定義的,例如以下的 *args*: ::" -#: ../../glossary.rst:1024 +#: ../../glossary.rst:1070 msgid "def func(*args, **kwargs): ..." msgstr "def func(*args, **kwargs): ..." -#: ../../glossary.rst:1026 +#: ../../glossary.rst:1072 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2347,29 +2460,29 @@ msgstr "" "已被其他參數接受的任何關鍵字引數之外)。這類參數是透過在其參數名稱字首加上 " "``**`` 來定義的,例如上面範例中的 *kwargs*。" -#: ../../glossary.rst:1032 +#: ../../glossary.rst:1078 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." msgstr "" "參數可以指明引數是選擇性的或必需的,也可以為一些選擇性的引數指定預設值。" -#: ../../glossary.rst:1035 +#: ../../glossary.rst:1081 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " -"the :class:`inspect.Parameter` class, the :ref:`function` section, and :pep:" -"`362`." +"the :class:`inspect.Parameter` class, the :ref:`function` section, " +"and :pep:`362`." msgstr "" "另請參閱術語表的 :term:`argument`\\ (引數)條目、常見問題中的\\ :ref:`引數和" "參數之間的差異 `、:class:`inspect.Parameter` " "class、:ref:`function`\\ 章節,以及 :pep:`362`。" -#: ../../glossary.rst:1039 +#: ../../glossary.rst:1085 msgid "path entry" msgstr "path entry(路徑項目)" -#: ../../glossary.rst:1041 +#: ../../glossary.rst:1087 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2377,33 +2490,33 @@ msgstr "" "在 :term:`import path`\\ (引入路徑)中的一個位置,而 :term:`path based " "finder` (基於路徑的尋檢器)會參考該位置來尋找要 import 的模組。" -#: ../../glossary.rst:1043 +#: ../../glossary.rst:1089 msgid "path entry finder" msgstr "path entry finder(路徑項目尋檢器)" -#: ../../glossary.rst:1045 +#: ../../glossary.rst:1091 msgid "" -"A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" -"term:`path entry hook`) which knows how to locate modules given a :term:" -"`path entry`." +"A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. " +"a :term:`path entry hook`) which knows how to locate modules given " +"a :term:`path entry`." msgstr "" -"被 :data:`sys.path_hooks` 中的一個可呼叫物件 (callable)(意即一個 :term:" -"`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一個 :term:" -"`path entry`\\ 定位模組。" +"被 :data:`sys.path_hooks` 中的一個可呼叫物件 (callable)(意即一" +"個 :term:`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一" +"個 :term:`path entry`\\ 定位模組。" -#: ../../glossary.rst:1049 +#: ../../glossary.rst:1095 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." msgstr "" -"關於路徑項目尋檢器實作的 method,請參閱 :class:`importlib.abc." -"PathEntryFinder`。" +"關於路徑項目尋檢器實作的 method,請參" +"閱 :class:`importlib.abc.PathEntryFinder`。" -#: ../../glossary.rst:1051 +#: ../../glossary.rst:1097 msgid "path entry hook" msgstr "path entry hook(路徑項目鉤)" -#: ../../glossary.rst:1053 +#: ../../glossary.rst:1099 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2413,11 +2526,11 @@ msgstr "" "個特定的 :term:`path entry` 中尋找模組,則會回傳一個 :term:`path entry " "finder`\\ (路徑項目尋檢器)。" -#: ../../glossary.rst:1056 +#: ../../glossary.rst:1102 msgid "path based finder" msgstr "path based finder(基於路徑的尋檢器)" -#: ../../glossary.rst:1058 +#: ../../glossary.rst:1104 msgid "" "One of the default :term:`meta path finders ` which " "searches an :term:`import path` for modules." @@ -2425,33 +2538,33 @@ msgstr "" "預設的\\ :term:`元路徑尋檢器 (meta path finder) ` 之一,它" "會在一個 :term:`import path` 中搜尋模組。" -#: ../../glossary.rst:1060 +#: ../../glossary.rst:1106 msgid "path-like object" msgstr "path-like object(類路徑物件)" -#: ../../glossary.rst:1062 -msgid "" -"An object representing a file system path. A path-like object is either a :" -"class:`str` or :class:`bytes` object representing a path, or an object " -"implementing the :class:`os.PathLike` protocol. An object that supports the :" -"class:`os.PathLike` protocol can be converted to a :class:`str` or :class:" -"`bytes` file system path by calling the :func:`os.fspath` function; :func:" -"`os.fsdecode` and :func:`os.fsencode` can be used to guarantee a :class:" -"`str` or :class:`bytes` result instead, respectively. Introduced by :pep:" -"`519`." -msgstr "" -"一個表示檔案系統路徑的物件。類路徑物件可以是一個表示路徑的 :class:`str` 或 :" -"class:`bytes` 物件,或是一個實作 :class:`os.PathLike` 協定的物件。透過呼叫 :" -"func:`os.fspath` 函式,一個支援 :class:`os.PathLike` 協定的物件可以被轉換為 :" -"class:`str` 或 :class:`bytes` 檔案系統路徑;而 :func:`os.fsdecode` 及 :func:" -"`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結果。由 :" -"pep:`519` 引入。" - -#: ../../glossary.rst:1070 +#: ../../glossary.rst:1108 +msgid "" +"An object representing a file system path. A path-like object is either " +"a :class:`str` or :class:`bytes` object representing a path, or an object " +"implementing the :class:`os.PathLike` protocol. An object that supports " +"the :class:`os.PathLike` protocol can be converted to a :class:`str` " +"or :class:`bytes` file system path by calling the :func:`os.fspath` " +"function; :func:`os.fsdecode` and :func:`os.fsencode` can be used to " +"guarantee a :class:`str` or :class:`bytes` result instead, respectively. " +"Introduced by :pep:`519`." +msgstr "" +"一個表示檔案系統路徑的物件。類路徑物件可以是一個表示路徑的 :class:`str` " +"或 :class:`bytes` 物件,或是一個實作 :class:`os.PathLike` 協定的物件。透過呼" +"叫 :func:`os.fspath` 函式,一個支援 :class:`os.PathLike` 協定的物件可以被轉換" +"為 :class:`str` 或 :class:`bytes` 檔案系統路徑;而 :func:`os.fsdecode` " +"及 :func:`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結" +"果。由 :pep:`519` 引入。" + +#: ../../glossary.rst:1116 msgid "PEP" msgstr "PEP" -#: ../../glossary.rst:1072 +#: ../../glossary.rst:1118 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2462,7 +2575,7 @@ msgstr "" "為 Python 社群提供資訊,或是描述 Python 的一個新功能或該功能的程序和環境。" "PEP 應該要提供簡潔的技術規範以及被提案功能的運作原理。" -#: ../../glossary.rst:1078 +#: ../../glossary.rst:1124 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2474,15 +2587,15 @@ msgstr "" "已納入 Python 的設計決策的記錄,這些過程的主要機制。PEP 的作者要負責在社群內" "建立共識並記錄反對意見。" -#: ../../glossary.rst:1084 +#: ../../glossary.rst:1130 msgid "See :pep:`1`." msgstr "請參閱 :pep:`1`。" -#: ../../glossary.rst:1085 +#: ../../glossary.rst:1131 msgid "portion" msgstr "portion(部分)" -#: ../../glossary.rst:1087 +#: ../../glossary.rst:1133 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2490,15 +2603,15 @@ msgstr "" "在單一目錄中的一組檔案(也可能儲存在一個 zip 檔中),這些檔案能對一個命名空間" "套件 (namespace package) 有所貢獻,如同 :pep:`420` 中的定義。" -#: ../../glossary.rst:1089 +#: ../../glossary.rst:1135 msgid "positional argument" msgstr "positional argument(位置引數)" -#: ../../glossary.rst:1092 +#: ../../glossary.rst:1138 msgid "provisional API" msgstr "provisional API(暫行 API)" -#: ../../glossary.rst:1094 +#: ../../glossary.rst:1140 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2514,7 +2627,7 @@ msgstr "" "該介面)。這種變更並不會無端地產生——只有 API 被納入之前未察覺的嚴重基本缺陷被" "揭露時,它們才會發生。" -#: ../../glossary.rst:1103 +#: ../../glossary.rst:1149 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2523,7 +2636,7 @@ msgstr "" "即使對於暫行 API,向後不相容的變更也會被視為「最後的解決方案」——對於任何被發" "現的問題,仍然會盡可能找出一個向後相容的解決方案。" -#: ../../glossary.rst:1107 +#: ../../glossary.rst:1153 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2532,19 +2645,19 @@ msgstr "" "這個過程使得標準函式庫能隨著時間不斷進化,而避免耗費過長的時間去鎖定有問題的" "設計錯誤。請參閱 :pep:`411` 了解更多細節。" -#: ../../glossary.rst:1110 +#: ../../glossary.rst:1156 msgid "provisional package" msgstr "provisional package(暫行套件)" -#: ../../glossary.rst:1112 +#: ../../glossary.rst:1158 msgid "See :term:`provisional API`." msgstr "請參閱 :term:`provisional API`\\ (暫行 API)。" -#: ../../glossary.rst:1113 +#: ../../glossary.rst:1159 msgid "Python 3000" msgstr "Python 3000" -#: ../../glossary.rst:1115 +#: ../../glossary.rst:1161 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2553,11 +2666,11 @@ msgstr "" "Python 3.x 系列版本的暱稱(很久以前創造的,當時第 3 版的發布是在遙遠的未" "來。)也可以縮寫為「Py3k」。" -#: ../../glossary.rst:1118 +#: ../../glossary.rst:1164 msgid "Pythonic" msgstr "Pythonic(Python 風格的)" -#: ../../glossary.rst:1120 +#: ../../glossary.rst:1166 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2567,11 +2680,11 @@ msgid "" "Python sometimes use a numerical counter instead::" msgstr "" "一個想法或一段程式碼,它應用了 Python 語言最常見的慣用語,而不是使用其他語言" -"常見的概念來實作程式碼。例如,Python 中常見的一種習慣用法,是使用一個 :" -"keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並沒有" -"這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" +"常見的概念來實作程式碼。例如,Python 中常見的一種習慣用法,是使用一" +"個 :keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並" +"沒有這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" -#: ../../glossary.rst:1127 +#: ../../glossary.rst:1173 msgid "" "for i in range(len(food)):\n" " print(food[i])" @@ -2579,11 +2692,11 @@ msgstr "" "for i in range(len(food)):\n" " print(food[i])" -#: ../../glossary.rst:1130 +#: ../../glossary.rst:1176 msgid "As opposed to the cleaner, Pythonic method::" msgstr "相較之下,以下方法更簡潔、更具有 Python 風格: ::" -#: ../../glossary.rst:1132 +#: ../../glossary.rst:1178 msgid "" "for piece in food:\n" " print(piece)" @@ -2591,11 +2704,11 @@ msgstr "" "for piece in food:\n" " print(piece)" -#: ../../glossary.rst:1134 +#: ../../glossary.rst:1180 msgid "qualified name" msgstr "qualified name(限定名稱)" -#: ../../glossary.rst:1136 +#: ../../glossary.rst:1182 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2606,7 +2719,7 @@ msgstr "" "或 method 的「路徑」,如 :pep:`3155` 中的定義。對於頂層的函式和 class 而言," "限定名稱與其物件名稱相同: ::" -#: ../../glossary.rst:1141 +#: ../../glossary.rst:1187 msgid "" ">>> class C:\n" "... class D:\n" @@ -2632,16 +2745,16 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../glossary.rst:1153 +#: ../../glossary.rst:1199 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " -"dotted path to the module, including any parent packages, e.g. ``email.mime." -"text``::" +"dotted path to the module, including any parent packages, e.g. " +"``email.mime.text``::" msgstr "" "當用於引用模組時,*完全限定名稱 (fully qualified name)* 是表示該模組的完整點" "分隔路徑,包括任何的父套件,例如 ``email.mime.text``: ::" -#: ../../glossary.rst:1157 +#: ../../glossary.rst:1203 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" @@ -2651,11 +2764,11 @@ msgstr "" ">>> email.mime.text.__name__\n" "'email.mime.text'" -#: ../../glossary.rst:1160 +#: ../../glossary.rst:1206 msgid "reference count" msgstr "reference count(參照計數)" -#: ../../glossary.rst:1162 +#: ../../glossary.rst:1208 msgid "" "The number of references to an object. When the reference count of an " "object drops to zero, it is deallocated. Some objects are :term:`immortal` " @@ -2668,10 +2781,10 @@ msgstr "" "對於一個物件的參照次數。當一個物件的參照計數下降到零時,它會被解除配置 " "(deallocated)。有些物件是「\\ :term:`不滅的 ` (immortal)」並擁有不" "會被改變的參照計數,也因此永遠不會被解除配置。參照計數通常在 Python 程式碼中" -"看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :" -"func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" +"看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼" +"叫 :func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" -#: ../../glossary.rst:1171 +#: ../../glossary.rst:1217 msgid "" "In :term:`CPython`, reference counts are not considered to be stable or well-" "defined values; the number of references to an object, and how that number " @@ -2680,39 +2793,39 @@ msgstr "" "在 :term:`CPython` 中,參照計數不被視為穩定或明確定義的值;對物件的參照數量," "以及該數量如何受到 Python 程式碼的影響,在不同版本之間可能會有所不同。" -#: ../../glossary.rst:1175 +#: ../../glossary.rst:1221 msgid "regular package" msgstr "regular package(正規套件)" -#: ../../glossary.rst:1177 +#: ../../glossary.rst:1223 msgid "" -"A traditional :term:`package`, such as a directory containing an ``__init__." -"py`` file." +"A traditional :term:`package`, such as a directory containing an " +"``__init__.py`` file." msgstr "" "一個傳統的 :term:`package`\\ (套件),例如一個包含 ``__init__.py`` 檔案的目" "錄。" -#: ../../glossary.rst:1180 +#: ../../glossary.rst:1226 msgid "See also :term:`namespace package`." msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" -#: ../../glossary.rst:1181 +#: ../../glossary.rst:1227 msgid "REPL" msgstr "REPL" -#: ../../glossary.rst:1183 +#: ../../glossary.rst:1229 msgid "" -"An acronym for the \"read–eval–print loop\", another name for the :term:" -"`interactive` interpreter shell." +"An acronym for the \"read–eval–print loop\", another name for " +"the :term:`interactive` interpreter shell." msgstr "" "「read-eval-print 迴圈 (read–eval–print loop)」的縮寫,是\\ :term:`互動式 " "`\\ 直譯器 shell 的另一個名稱。" -#: ../../glossary.rst:1185 +#: ../../glossary.rst:1231 msgid "__slots__" msgstr "__slots__" -#: ../../glossary.rst:1187 +#: ../../glossary.rst:1233 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -2725,66 +2838,68 @@ msgstr "" "最好保留給那種在一個記憶體關鍵 (memory-critical) 的應用程式中存在大量實例的罕" "見情況。" -#: ../../glossary.rst:1192 +#: ../../glossary.rst:1238 msgid "sequence" msgstr "sequence(序列)" -#: ../../glossary.rst:1194 +#: ../../glossary.rst:1240 msgid "" "An :term:`iterable` which supports efficient element access using integer " -"indices via the :meth:`~object.__getitem__` special method and defines a :" -"meth:`~object.__len__` method that returns the length of the sequence. Some " -"built-in sequence types are :class:`list`, :class:`str`, :class:`tuple`, " -"and :class:`bytes`. Note that :class:`dict` also supports :meth:`~object." -"__getitem__` and :meth:`!__len__`, but is considered a mapping rather than a " -"sequence because the lookups use arbitrary :term:`hashable` keys rather than " -"integers." +"indices via the :meth:`~object.__getitem__` special method and defines " +"a :meth:`~object.__len__` method that returns the length of the sequence. " +"Some built-in sequence types " +"are :class:`list`, :class:`str`, :class:`tuple`, and :class:`bytes`. Note " +"that :class:`dict` also supports :meth:`~object.__getitem__` and :meth:`!" +"__len__`, but is considered a mapping rather than a sequence because the " +"lookups use arbitrary :term:`hashable` keys rather than integers." msgstr "" "一個 :term:`iterable`\\ (可疊代物件),它透過 :meth:`~object.__getitem__` " "special method(特殊方法),使用整數索引來支援高效率的元素存取,並定義了一" -"個 :meth:`~object.__len__` method 來回傳該序列的長度。一些內建序列型別包括 :" -"class:`list`、:class:`str`、:class:`tuple` 和 :class:`bytes`。請注意,雖然 :" -"class:`dict` 也支援 :meth:`~object.__getitem__` 和 :meth:`!__len__`,但它被視" -"為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` 鍵," -"而不是整數。" +"個 :meth:`~object.__len__` method 來回傳該序列的長度。一些內建序列型別包" +"括 :class:`list`、:class:`str`、:class:`tuple` 和 :class:`bytes`。請注意,雖" +"然 :class:`dict` 也支援 :meth:`~object.__getitem__` 和 :meth:`!__len__`,但它" +"被視為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` " +"鍵,而不是整數。" -#: ../../glossary.rst:1203 +#: ../../glossary.rst:1249 +#, fuzzy msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " -"richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:" -"`~object.__len__`, adding :meth:`!count`, :meth:`!index`, :meth:`~object." -"__contains__`, and :meth:`~object.__reversed__`. Types that implement this " -"expanded interface can be registered explicitly using :func:`~abc.ABCMeta." -"register`. For more documentation on sequence methods generally, see :ref:" -"`Common Sequence Operations `." +"richer interface that goes beyond just :meth:`~object.__getitem__` " +"and :meth:`~object.__len__`, " +"adding :meth:`~sequence.count`, :meth:`~sequence.index`, :meth:`~object.__contains__`, " +"and :meth:`~object.__reversed__`. Types that implement this expanded " +"interface can be registered explicitly using :func:`~abc.ABCMeta.register`. " +"For more documentation on sequence methods generally, see :ref:`Common " +"Sequence Operations `." msgstr "" "抽象基底類別 (abstract base class) :class:`collections.abc.Sequence` 定義了一" -"個更加豐富的介面,並不僅止於 :meth:`~object.__getitem__` 和 :meth:`~object." -"__len__`,還增加了 :meth:`!count`、:meth:`!index`、:meth:`~object." -"__contains__` 和 :meth:`~object.__reversed__`。實作此擴充介面的型別,可以使" -"用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於序列方法的文件,請見" -"\\ :ref:`常見序列操作 `。" +"個更加豐富的介面,並不僅止於 :meth:`~object.__getitem__` " +"和 :meth:`~object.__len__`,還增加了 :meth:`!count`、:meth:`!" +"index`、:meth:`~object.__contains__` 和 :meth:`~object.__reversed__`。實作此" +"擴充介面的型別,可以使用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於" +"序列方法的文件,請見\\ :ref:`常見序列操作 `。" -#: ../../glossary.rst:1212 +#: ../../glossary.rst:1259 msgid "set comprehension" msgstr "set comprehension(集合綜合運算)" -#: ../../glossary.rst:1214 +#: ../../glossary.rst:1261 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " -"not in 'abc'}`` generates the set of strings ``{'r', 'd'}``. See :ref:" -"`comprehensions`." +"not in 'abc'}`` generates the set of strings ``{'r', 'd'}``. " +"See :ref:`comprehensions`." msgstr "" "一種緊密的方法,用來處理一個可疊代物件中的全部或部分元素,並將處理結果以一個 " "set 回傳。``results = {c for c in 'abracadabra' if c not in 'abc'}`` 會產生一" "個字串 set:``{'r', 'd'}``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:1218 +#: ../../glossary.rst:1265 msgid "single dispatch" msgstr "single dispatch(單一調度)" -#: ../../glossary.rst:1220 +#: ../../glossary.rst:1267 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -2792,11 +2907,11 @@ msgstr "" ":term:`generic function`\\ (泛型函式)調度的一種形式,在此,實作的選擇是基於" "單一引數的型別。" -#: ../../glossary.rst:1222 +#: ../../glossary.rst:1269 msgid "slice" msgstr "slice(切片)" -#: ../../glossary.rst:1224 +#: ../../glossary.rst:1271 msgid "" "An object usually containing a portion of a :term:`sequence`. A slice is " "created using the subscript notation, ``[]`` with colons between numbers " @@ -2808,11 +2923,11 @@ msgstr "" "之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內部,會使" "用 :class:`slice` 物件。" -#: ../../glossary.rst:1228 +#: ../../glossary.rst:1275 msgid "soft deprecated" msgstr "soft deprecated(軟性棄用)" -#: ../../glossary.rst:1230 +#: ../../glossary.rst:1277 msgid "" "A soft deprecated API should not be used in new code, but it is safe for " "already existing code to use it. The API remains documented and tested, but " @@ -2821,13 +2936,13 @@ msgstr "" "被軟性棄用的 API 代表不應再用於新程式碼中,但在現有程式碼中繼續使用它仍會是安" "全的。API 仍會以文件記錄並會被測試,但不會被繼續改進。" -#: ../../glossary.rst:1234 +#: ../../glossary.rst:1281 msgid "" "Soft deprecation, unlike normal deprecation, does not plan on removing the " "API and will not emit warnings." msgstr "與正常棄用不同,軟性棄用沒有刪除 API 的規劃,也不會發出警告。" -#: ../../glossary.rst:1237 +#: ../../glossary.rst:1284 msgid "" "See `PEP 387: Soft Deprecation `_." @@ -2835,39 +2950,39 @@ msgstr "" "請參閱 `PEP 387:軟性棄用 `_。" -#: ../../glossary.rst:1239 +#: ../../glossary.rst:1286 msgid "special method" msgstr "special method(特殊方法)" -#: ../../glossary.rst:1243 +#: ../../glossary.rst:1290 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " -"with double underscores. Special methods are documented in :ref:" -"`specialnames`." +"with double underscores. Special methods are documented " +"in :ref:`specialnames`." msgstr "" "一種會被 Python 自動呼叫的 method,用於對某種型別執行某種運算,例如加法。這" -"種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在\\ :ref:" -"`specialnames`\\ 中有詳細說明。" +"種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在" +"\\ :ref:`specialnames`\\ 中有詳細說明。" -#: ../../glossary.rst:1247 +#: ../../glossary.rst:1294 msgid "standard library" msgstr "標準函式庫" -#: ../../glossary.rst:1249 +#: ../../glossary.rst:1296 msgid "" -"The collection of :term:`packages `, :term:`modules ` and :" -"term:`extension modules ` distributed as a part of the " -"official Python interpreter package. The exact membership of the collection " -"may vary based on platform, available system libraries, or other criteria. " -"Documentation can be found at :ref:`library-index`." +"The collection of :term:`packages `, :term:`modules ` " +"and :term:`extension modules ` distributed as a part of " +"the official Python interpreter package. The exact membership of the " +"collection may vary based on platform, available system libraries, or other " +"criteria. Documentation can be found at :ref:`library-index`." msgstr "" "包含\\ :term:`套件 `、:term:`模組 `\\ 和\\ :term:`擴充模組 " "`\\ 的集合,它們是作為官方 Python 直譯器套件的一部分來發" "行。該集合的成員可能會因平台、可用的系統函式庫或其他條件而有所不同。相關文件" "可以在 :ref:`library-index` 中找到。" -#: ../../glossary.rst:1255 +#: ../../glossary.rst:1302 msgid "" "See also :data:`sys.stdlib_module_names` for a list of all possible standard " "library module names." @@ -2875,58 +2990,58 @@ msgstr "" "請參閱 :data:`sys.stdlib_module_names` 以取得所有可能的標準函式庫模組名稱的列" "表。" -#: ../../glossary.rst:1257 +#: ../../glossary.rst:1304 msgid "statement" msgstr "statement(陳述式)" -#: ../../glossary.rst:1259 +#: ../../glossary.rst:1306 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " -"an :term:`expression` or one of several constructs with a keyword, such as :" -"keyword:`if`, :keyword:`while` or :keyword:`for`." +"an :term:`expression` or one of several constructs with a keyword, such " +"as :keyword:`if`, :keyword:`while` or :keyword:`for`." msgstr "" -"陳述式是一個套組(suite,一個程式碼「區塊」)中的一部分。陳述式可以是一個 :" -"term:`expression`\\ (運算式),或是含有關鍵字(例如 :keyword:`if`、:keyword:" -"`while` 或 :keyword:`for`\\ )的多種結構之一。" +"陳述式是一個套組(suite,一個程式碼「區塊」)中的一部分。陳述式可以是一" +"個 :term:`expression`\\ (運算式),或是含有關鍵字(例" +"如 :keyword:`if`、:keyword:`while` 或 :keyword:`for`\\ )的多種結構之一。" -#: ../../glossary.rst:1262 +#: ../../glossary.rst:1309 msgid "static type checker" msgstr "static type checker(靜態型別檢查器)" -#: ../../glossary.rst:1264 +#: ../../glossary.rst:1311 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " -"such as incorrect types. See also :term:`type hints ` and the :" -"mod:`typing` module." +"such as incorrect types. See also :term:`type hints ` and " +"the :mod:`typing` module." msgstr "" "會讀取 Python 程式碼並分析的外部工具,能夠找出錯誤,像是使用了不正確的型別。" "另請參閱\\ :term:`型別提示 (type hints) ` 以及 :mod:`typing` 模" "組。" -#: ../../glossary.rst:1267 +#: ../../glossary.rst:1314 msgid "stdlib" msgstr "stdlib(標準函式庫)" -#: ../../glossary.rst:1269 +#: ../../glossary.rst:1316 msgid "An abbreviation of :term:`standard library`." msgstr ":term:`standard library` 的縮寫。" -#: ../../glossary.rst:1270 +#: ../../glossary.rst:1317 msgid "strong reference" msgstr "strong reference(強參照)" -#: ../../glossary.rst:1272 +#: ../../glossary.rst:1319 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " -"calling :c:func:`Py_INCREF` when the reference is created and released with :" -"c:func:`Py_DECREF` when the reference is deleted." +"calling :c:func:`Py_INCREF` when the reference is created and released " +"with :c:func:`Py_DECREF` when the reference is deleted." msgstr "" "在 Python 的 C API 中,強參照是對物件的參照,該物件為持有該參照的程式碼所擁" -"有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透過 :c:" -"func:`Py_DECREF` 釋放強參照。" +"有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透" +"過 :c:func:`Py_DECREF` 釋放強參照。" -#: ../../glossary.rst:1278 +#: ../../glossary.rst:1325 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -2936,15 +3051,34 @@ msgstr "" ":c:func:`Py_NewRef` 函式可用於建立一個對物件的強參照。通常,在退出強參照的作" "用域之前,必須在該強參照上呼叫 :c:func:`Py_DECREF` 函式,以避免洩漏一個參照。" -#: ../../glossary.rst:1283 +#: ../../glossary.rst:1330 msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" -#: ../../glossary.rst:1284 +#: ../../glossary.rst:1331 +#, fuzzy +msgid "t-string" +msgstr "f-string(f 字串)" + +#: ../../glossary.rst:1332 +#, fuzzy +msgid "t-strings" +msgstr "f-string(f 字串)" + +#: ../../glossary.rst:1334 +#, fuzzy +msgid "" +"String literals prefixed with ``t`` or ``T`` are commonly called \"t-" +"strings\" which is short for :ref:`template string literals `." +msgstr "" +"以 ``'f'`` 或 ``'F'`` 為前綴的字串文本通常被稱為「f 字串」,它是\\ :ref:`格式" +"化的字串文本 `\\ 的縮寫。另請參閱 :pep:`498`。" + +#: ../../glossary.rst:1337 msgid "text encoding" msgstr "text encoding(文字編碼)" -#: ../../glossary.rst:1286 +#: ../../glossary.rst:1339 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " @@ -2953,7 +3087,7 @@ msgstr "" "Python 中的字串是一個 Unicode 碼點 (code point) 的序列(範圍在 ``U+0000`` -- " "``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一個位元組序列。" -#: ../../glossary.rst:1290 +#: ../../glossary.rst:1343 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -2961,7 +3095,7 @@ msgstr "" "將一個字串序列化為位元組序列,稱為「編碼」,而從位元組序列重新建立該字串則稱" "為「解碼 (decoding)」。" -#: ../../glossary.rst:1293 +#: ../../glossary.rst:1346 msgid "" "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." @@ -2969,37 +3103,79 @@ msgstr "" "有多種不同的文字序列化編解碼器 (:ref:`codecs `),它們被統" "稱為「文字編碼」。" -#: ../../glossary.rst:1296 +#: ../../glossary.rst:1349 msgid "text file" msgstr "text file(文字檔案)" -#: ../../glossary.rst:1298 +#: ../../glossary.rst:1351 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " -"text file actually accesses a byte-oriented datastream and handles the :term:" -"`text encoding` automatically. Examples of text files are files opened in " -"text mode (``'r'`` or ``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and " -"instances of :class:`io.StringIO`." +"text file actually accesses a byte-oriented datastream and handles " +"the :term:`text encoding` automatically. Examples of text files are files " +"opened in text mode (``'r'`` or " +"``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and instances " +"of :class:`io.StringIO`." msgstr "" "一個能夠讀取和寫入 :class:`str` 物件的一個 :term:`file object`\\ (檔案物" "件)。通常,文字檔案實際上是存取位元組導向的資料流 (byte-oriented " "datastream) 並會自動處理 :term:`text encoding`\\ (文字編碼)。文字檔案的例子" -"有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔案、:data:`sys.stdin`、:data:" -"`sys.stdout` 以及 :class:`io.StringIO` 的實例。" +"有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔" +"案、:data:`sys.stdin`、:data:`sys.stdout` 以及 :class:`io.StringIO` 的實例。" + +#: ../../glossary.rst:1358 +msgid "" +"See also :term:`binary file` for a file object able to read and " +"write :term:`bytes-like objects `." +msgstr "" +"另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入" +"\\ :term:`類位元組串物件 (bytes-like object) ` 的檔案物" +"件。" + +#: ../../glossary.rst:1360 +msgid "thread state" +msgstr "" + +#: ../../glossary.rst:1363 +msgid "" +"The information used by the :term:`CPython` runtime to run in an OS thread. " +"For example, this includes the current exception, if any, and the state of " +"the bytecode interpreter." +msgstr "" + +#: ../../glossary.rst:1367 +msgid "" +"Each thread state is bound to a single OS thread, but threads may have many " +"thread states available. At most, one of them may be :term:`attached " +"` at once." +msgstr "" -#: ../../glossary.rst:1305 +#: ../../glossary.rst:1371 msgid "" -"See also :term:`binary file` for a file object able to read and write :term:" -"`bytes-like objects `." +"An :term:`attached thread state` is required to call most of Python's C API, " +"unless a function explicitly documents otherwise. The bytecode interpreter " +"only runs under an attached thread state." msgstr "" -"另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入\\ :" -"term:`類位元組串物件 (bytes-like object) ` 的檔案物件。" -#: ../../glossary.rst:1307 +#: ../../glossary.rst:1375 +msgid "" +"Each thread state belongs to a single interpreter, but each interpreter may " +"have many thread states, including multiple for the same OS thread. Thread " +"states from multiple interpreters may be bound to the same thread, but only " +"one can be :term:`attached ` in that thread at any " +"given moment." +msgstr "" + +#: ../../glossary.rst:1381 +msgid "" +"See :ref:`Thread State and the Global Interpreter Lock ` for more " +"information." +msgstr "" + +#: ../../glossary.rst:1383 msgid "token" msgstr "token" -#: ../../glossary.rst:1310 +#: ../../glossary.rst:1386 msgid "" "A small unit of source code, generated by the :ref:`lexical analyzer " "` (also called the *tokenizer*). Names, numbers, strings, " @@ -3008,19 +3184,19 @@ msgstr "" "原始碼的小單位,由 :ref:`詞法分析器 ` (也稱為 *tokenizer*)產生。名" "稱、數字、字串、運算子、換行符號等都以 token 表示。" -#: ../../glossary.rst:1315 +#: ../../glossary.rst:1391 msgid "" -"The :mod:`tokenize` module exposes Python's lexical analyzer. The :mod:" -"`token` module contains information on the various types of tokens." +"The :mod:`tokenize` module exposes Python's lexical analyzer. " +"The :mod:`token` module contains information on the various types of tokens." msgstr "" ":mod:`tokenize` 模組公開了 Python 的詞法分析器。:mod:`token` 模組包含各種 " "token 類型的資訊。" -#: ../../glossary.rst:1318 +#: ../../glossary.rst:1394 msgid "triple-quoted string" msgstr "triple-quoted string(三引號內字串)" -#: ../../glossary.rst:1320 +#: ../../glossary.rst:1396 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -3035,36 +3211,37 @@ msgstr "" "中包含未跳脫 (unescaped) 的單引號和雙引號,而且它們不需使用連續字元 " "(continuation character) 就可以跨越多行,這使得它們在編寫說明字串時特別有用。" -#: ../../glossary.rst:1327 +#: ../../glossary.rst:1403 msgid "type" msgstr "type(型別)" -#: ../../glossary.rst:1329 +#: ../../glossary.rst:1405 msgid "" "The type of a Python object determines what kind of object it is; every " -"object has a type. An object's type is accessible as its :attr:`~object." -"__class__` attribute or can be retrieved with ``type(obj)``." +"object has a type. An object's type is accessible as " +"its :attr:`~object.__class__` attribute or can be retrieved with " +"``type(obj)``." msgstr "" "一個 Python 物件的型別決定了它是什麼類型的物件;每個物件都有一個型別。一個物" "件的型別可以用它的 :attr:`~object.__class__` 屬性來存取,或以 ``type(obj)`` " "來檢索。" -#: ../../glossary.rst:1333 +#: ../../glossary.rst:1409 msgid "type alias" msgstr "type alias(型別別名)" -#: ../../glossary.rst:1335 +#: ../../glossary.rst:1411 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "一個型別的同義詞,透過將型別指定給一個識別符 (identifier) 來建立。" -#: ../../glossary.rst:1337 +#: ../../glossary.rst:1413 msgid "" "Type aliases are useful for simplifying :term:`type hints `. For " "example::" msgstr "" "型別別名對於簡化\\ :term:`型別提示 (type hint) ` 很有用。例如: ::" -#: ../../glossary.rst:1340 +#: ../../glossary.rst:1416 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" @@ -3074,11 +3251,11 @@ msgstr "" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" -#: ../../glossary.rst:1344 +#: ../../glossary.rst:1420 msgid "could be made more readable like this::" msgstr "可以寫成這樣,更具有可讀性: ::" -#: ../../glossary.rst:1346 +#: ../../glossary.rst:1422 msgid "" "Color = tuple[int, int, int]\n" "\n" @@ -3090,15 +3267,15 @@ msgstr "" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" -#: ../../glossary.rst:1351 ../../glossary.rst:1365 +#: ../../glossary.rst:1427 ../../glossary.rst:1441 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "請參閱 :mod:`typing` 和 :pep:`484`,有此功能的描述。" -#: ../../glossary.rst:1352 +#: ../../glossary.rst:1428 msgid "type hint" msgstr "type hint(型別提示)" -#: ../../glossary.rst:1354 +#: ../../glossary.rst:1430 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -3106,7 +3283,7 @@ msgstr "" "一種 :term:`annotation`\\ (註釋),它指定一個變數、一個 class 屬性或一個函式" "的參數或回傳值的預期型別。" -#: ../../glossary.rst:1357 +#: ../../glossary.rst:1433 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers `. They can also aid " @@ -3116,45 +3293,45 @@ msgstr "" "(static type checkers) `\\ 很有用,並能協助 IDE 完成程式" "碼的補全 (completion) 和重構 (refactoring)。" -#: ../../glossary.rst:1361 +#: ../../glossary.rst:1437 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." msgstr "" -"全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使用 :func:" -"`typing.get_type_hints` 來存取。" +"全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使" +"用 :func:`typing.get_type_hints` 來存取。" -#: ../../glossary.rst:1366 +#: ../../glossary.rst:1442 msgid "universal newlines" msgstr "universal newlines(通用換行字元)" -#: ../../glossary.rst:1368 +#: ../../glossary.rst:1444 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " "Windows convention ``'\\r\\n'``, and the old Macintosh convention " -"``'\\r'``. See :pep:`278` and :pep:`3116`, as well as :func:`bytes." -"splitlines` for an additional use." +"``'\\r'``. See :pep:`278` and :pep:`3116`, as well " +"as :func:`bytes.splitlines` for an additional use." msgstr "" "一種解譯文字流 (text stream) 的方式,會將以下所有的情況識別為一行的結束:" "Unix 行尾慣例 ``'\\n'``、Windows 慣例 ``'\\r\\n'`` 和舊的 Macintosh 慣例 " -"``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用於 :func:`bytes." -"splitlines` 的附加用途。" +"``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用" +"於 :func:`bytes.splitlines` 的附加用途。" -#: ../../glossary.rst:1373 +#: ../../glossary.rst:1449 msgid "variable annotation" msgstr "variable annotation(變數註釋)" -#: ../../glossary.rst:1375 +#: ../../glossary.rst:1451 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "一個變數或 class 屬性的 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:1377 +#: ../../glossary.rst:1453 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "註釋變數或 class 屬性時,賦值是選擇性的: ::" -#: ../../glossary.rst:1379 +#: ../../glossary.rst:1455 msgid "" "class C:\n" " field: 'annotation'" @@ -3162,7 +3339,7 @@ msgstr "" "class C:\n" " field: 'annotation'" -#: ../../glossary.rst:1382 +#: ../../glossary.rst:1458 msgid "" "Variable annotations are usually used for :term:`type hints `: " "for example this variable is expected to take :class:`int` values::" @@ -3170,15 +3347,15 @@ msgstr "" "變數註釋通常用於\\ :term:`型別提示 (type hint) `:例如,這個變數預" "期會取得 :class:`int`\\ (整數)值: ::" -#: ../../glossary.rst:1386 +#: ../../glossary.rst:1462 msgid "count: int = 0" msgstr "count: int = 0" -#: ../../glossary.rst:1388 +#: ../../glossary.rst:1464 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "變數註釋的語法在\\ :ref:`annassign`\\ 章節有詳細的解釋。" -#: ../../glossary.rst:1390 +#: ../../glossary.rst:1466 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -3187,11 +3364,11 @@ msgstr "" "請參閱 :term:`function annotation`\\ (函式註釋)、:pep:`484` 和 :pep:`526`," "皆有此功能的描述。關於註釋的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:1394 +#: ../../glossary.rst:1470 msgid "virtual environment" msgstr "virtual environment(虛擬環境)" -#: ../../glossary.rst:1396 +#: ../../glossary.rst:1472 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -3202,38 +3379,38 @@ msgstr "" "程式得以安裝和升級 Python 發佈套件,而不會對同一個系統上運行的其他 Python 應" "用程式的行為產生干擾。" -#: ../../glossary.rst:1401 +#: ../../glossary.rst:1477 msgid "See also :mod:`venv`." msgstr "另請參閱 :mod:`venv`。" -#: ../../glossary.rst:1402 +#: ../../glossary.rst:1478 msgid "virtual machine" msgstr "virtual machine(虛擬機器)" -#: ../../glossary.rst:1404 +#: ../../glossary.rst:1480 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." msgstr "" -"一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行由 :term:" -"`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" +"一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行" +"由 :term:`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" -#: ../../glossary.rst:1406 +#: ../../glossary.rst:1482 msgid "walrus operator" msgstr "walrus operator(海象運算子)" -#: ../../glossary.rst:1408 +#: ../../glossary.rst:1484 msgid "" "A light-hearted way to refer to the :ref:`assignment expression ` operator ``:=`` because it looks a bit like a walrus if you " "turn your head." msgstr "" -#: ../../glossary.rst:1411 +#: ../../glossary.rst:1487 msgid "Zen of Python" msgstr "Zen of Python(Python 之禪)" -#: ../../glossary.rst:1413 +#: ../../glossary.rst:1489 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -3242,30 +3419,30 @@ msgstr "" "Python 設計原則與哲學的列表,其內容有助於理解和使用此語言。此列表可以透過在互" "動式提式字元後輸入「``import this``」來找到它。" -#: ../../glossary.rst:292 +#: ../../glossary.rst:319 msgid "C-contiguous" msgstr "C-contiguous(C 連續的)" -#: ../../glossary.rst:292 +#: ../../glossary.rst:319 msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" -#: ../../glossary.rst:836 +#: ../../glossary.rst:882 msgid "magic" msgstr "magic" -#: ../../glossary.rst:1241 +#: ../../glossary.rst:1288 msgid "special" msgstr "special" #~ msgid "" #~ "An object which controls the environment seen in a :keyword:`with` " -#~ "statement by defining :meth:`~object.__enter__` and :meth:`~object." -#~ "__exit__` methods. See :pep:`343`." +#~ "statement by defining :meth:`~object.__enter__` " +#~ "and :meth:`~object.__exit__` methods. See :pep:`343`." #~ msgstr "" -#~ "一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定義 :meth:" -#~ "`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。請參閱 :" -#~ "pep:`343`。" +#~ "一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定" +#~ "義 :meth:`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。" +#~ "請參閱 :pep:`343`。" #~ msgid "" #~ "A variable which can have different values depending on its context. This " diff --git a/howto/annotations.po b/howto/annotations.po index 67acc522c35..76796e10bf4 100644 --- a/howto/annotations.po +++ b/howto/annotations.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-11-08 23:11+0800\n" "Last-Translator: rockleon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -61,8 +61,8 @@ msgstr "" msgid "" "Note that this document is specifically about working with " "``__annotations__``, not uses *for* annotations. If you're looking for " -"information on how to use \"type hints\" in your code, please see the :mod:" -"`typing` module." +"information on how to use \"type hints\" in your code, please see " +"the :mod:`typing` module." msgstr "" "請注意,本文件是特別說明 ``__annotations__`` 的使用,而非\\ *如何使用*\\ 註" "釋。如果你正在尋找如何在你的程式碼中使用「型別提示 (type hint)」的資訊,請查" @@ -73,12 +73,13 @@ msgid "Accessing The Annotations Dict Of An Object In Python 3.10 And Newer" msgstr "在 Python 3.10 及更高版本中存取物件的註釋字典" #: ../../howto/annotations.rst:35 +#, fuzzy msgid "" -"Python 3.10 adds a new function to the standard library: :func:`inspect." -"get_annotations`. In Python versions 3.10 and newer, calling this function " -"is the best practice for accessing the annotations dict of any object that " -"supports annotations. This function can also \"un-stringize\" stringized " -"annotations for you." +"Python 3.10 adds a new function to the standard " +"library: :func:`inspect.get_annotations`. In Python versions 3.10 through " +"3.13, calling this function is the best practice for accessing the " +"annotations dict of any object that supports annotations. This function can " +"also \"un-stringize\" stringized annotations for you." msgstr "" "Python 3.10 在標準函式庫中新增了一個新函式::func:`inspect.get_annotations`。" "在 Python 3.10 及更高版本中,呼叫此函式是存取任何支援註釋的物件的註釋字典的最" @@ -86,10 +87,18 @@ msgstr "" #: ../../howto/annotations.rst:42 msgid "" +"In Python 3.14, there is a new :mod:`annotationlib` module with " +"functionality for working with annotations. This includes " +"a :func:`annotationlib.get_annotations` function, which " +"supersedes :func:`inspect.get_annotations`." +msgstr "" + +#: ../../howto/annotations.rst:47 +msgid "" "If for some reason :func:`inspect.get_annotations` isn't viable for your use " "case, you may access the ``__annotations__`` data member manually. Best " -"practice for this changed in Python 3.10 as well: as of Python 3.10, ``o." -"__annotations__`` is guaranteed to *always* work on Python functions, " +"practice for this changed in Python 3.10 as well: as of Python 3.10, " +"``o.__annotations__`` is guaranteed to *always* work on Python functions, " "classes, and modules. If you're certain the object you're examining is one " "of these three *specific* objects, you may simply use ``o.__annotations__`` " "to get at the object's annotations dict." @@ -100,13 +109,14 @@ msgstr "" "類別 (class) 和模組。如果你確定正在檢查的物件是這三個\\ *特定*\\ 物件之一,你" "可以簡單地使用 ``o.__annotations__`` 來取得物件的註釋字典。" -#: ../../howto/annotations.rst:52 +#: ../../howto/annotations.rst:57 msgid "" -"However, other types of callables--for example, callables created by :func:" -"`functools.partial`--may not have an ``__annotations__`` attribute defined. " -"When accessing the ``__annotations__`` of a possibly unknown object, best " -"practice in Python versions 3.10 and newer is to call :func:`getattr` with " -"three arguments, for example ``getattr(o, '__annotations__', None)``." +"However, other types of callables--for example, callables created " +"by :func:`functools.partial`--may not have an ``__annotations__`` attribute " +"defined. When accessing the ``__annotations__`` of a possibly unknown " +"object, best practice in Python versions 3.10 and newer is to " +"call :func:`getattr` with three arguments, for example ``getattr(o, " +"'__annotations__', None)``." msgstr "" "但是,其他型別的 callable(可呼叫物件)(例如,由 :func:`functools.partial` " "建立的 callable)可能沒有定義 ``__annotations__`` 屬性 (attribute)。當存取可" @@ -114,7 +124,7 @@ msgstr "" "用三個參數呼叫 :func:`getattr`,例如 ``getattr(o, '__annotations__', " "None)``。" -#: ../../howto/annotations.rst:60 +#: ../../howto/annotations.rst:65 msgid "" "Before Python 3.10, accessing ``__annotations__`` on a class that defines no " "annotations but that has a parent class with annotations would return the " @@ -125,11 +135,11 @@ msgstr "" "``__annotations__`` 將傳回父類別的 ``__annotations__``。在 Python 3.10 及更高" "版本中,子類別的註釋將會是一個空字典。" -#: ../../howto/annotations.rst:68 +#: ../../howto/annotations.rst:73 msgid "Accessing The Annotations Dict Of An Object In Python 3.9 And Older" msgstr "在 Python 3.9 及更早版本中存取物件的註釋字典" -#: ../../howto/annotations.rst:70 +#: ../../howto/annotations.rst:75 msgid "" "In Python 3.9 and older, accessing the annotations dict of an object is much " "more complicated than in newer versions. The problem is a design flaw in " @@ -138,7 +148,7 @@ msgstr "" "在 Python 3.9 及更早版本中,存取物件的註釋字典比新版本複雜得多。問題出在於這" "些舊版 Python 中有設計缺陷,特別是與類別註釋有關的設計缺陷。" -#: ../../howto/annotations.rst:75 +#: ../../howto/annotations.rst:80 msgid "" "Best practice for accessing the annotations dict of other objects--" "functions, other callables, and modules--is the same as best practice for " @@ -150,7 +160,7 @@ msgstr "" "佳實踐相同,假設你沒有呼叫 :func:`inspect.get_annotations`:你應該使用三個:" "參數 :func:`getattr` 來存取物件的 ``__annotations__`` 屬性。" -#: ../../howto/annotations.rst:82 +#: ../../howto/annotations.rst:87 msgid "" "Unfortunately, this isn't best practice for classes. The problem is that, " "since ``__annotations__`` is optional on classes, and because classes can " @@ -163,7 +173,7 @@ msgstr "" "類別的 ``__annotations__`` 屬性可能會無意中回傳\\ *基底類別的註釋字典。*\\ 舉" "例來說: ::" -#: ../../howto/annotations.rst:89 +#: ../../howto/annotations.rst:94 msgid "" "class Base:\n" " a: int = 3\n" @@ -183,11 +193,11 @@ msgstr "" "\n" "print(Derived.__annotations__)" -#: ../../howto/annotations.rst:98 +#: ../../howto/annotations.rst:103 msgid "This will print the annotations dict from ``Base``, not ``Derived``." msgstr "這將印出 (print) 來自 ``Base`` 的註釋字典,而不是 ``Derived``。" -#: ../../howto/annotations.rst:101 +#: ../../howto/annotations.rst:106 msgid "" "Your code will have to have a separate code path if the object you're " "examining is a class (``isinstance(o, type)``). In that case, best practice " @@ -198,11 +208,11 @@ msgid "" msgstr "" "如果你正在檢查的物件是一個類別 (``isinstance(o, type)``),你的程式碼將必須有" "一個單獨的程式碼路徑。在這種情況下,最佳實踐依賴 Python 3.9 及之前版本的實作" -"細節 (implementation detail):如果一個類別定義了註釋,它們將儲存在該類別的 :" -"attr:`~type.__dict__` 字典中。由於類別可能定義了註釋,也可能沒有定義,因此最" -"佳實踐是在類別字典上呼叫 :meth:`~dict.get` 方法。" +"細節 (implementation detail):如果一個類別定義了註釋,它們將儲存在該類別" +"的 :attr:`~type.__dict__` 字典中。由於類別可能定義了註釋,也可能沒有定義,因" +"此最佳實踐是在類別字典上呼叫 :meth:`~dict.get` 方法。" -#: ../../howto/annotations.rst:109 +#: ../../howto/annotations.rst:114 msgid "" "To put it all together, here is some sample code that safely accesses the " "``__annotations__`` attribute on an arbitrary object in Python 3.9 and " @@ -211,7 +221,7 @@ msgstr "" "總而言之,以下是一些範例程式碼,可以安全地存取 Python 3.9 及先前版本中任意物" "件上的 ``__annotations__`` 屬性:" -#: ../../howto/annotations.rst:113 +#: ../../howto/annotations.rst:118 msgid "" "if isinstance(o, type):\n" " ann = o.__dict__.get('__annotations__', None)\n" @@ -223,30 +233,30 @@ msgstr "" "else:\n" " ann = getattr(o, '__annotations__', None)" -#: ../../howto/annotations.rst:118 +#: ../../howto/annotations.rst:123 msgid "" "After running this code, ``ann`` should be either a dictionary or ``None``. " -"You're encouraged to double-check the type of ``ann`` using :func:" -"`isinstance` before further examination." +"You're encouraged to double-check the type of ``ann`` " +"using :func:`isinstance` before further examination." msgstr "" "運行此程式碼後,``ann`` 應該是字典或 ``None``。我們鼓勵你在進一步檢查之前使" "用 :func:`isinstance` 仔細檢查 ``ann`` 的型別。" -#: ../../howto/annotations.rst:123 +#: ../../howto/annotations.rst:128 msgid "" -"Note that some exotic or malformed type objects may not have a :attr:`~type." -"__dict__` attribute, so for extra safety you may also wish to use :func:" -"`getattr` to access :attr:`!__dict__`." +"Note that some exotic or malformed type objects may not have " +"a :attr:`~type.__dict__` attribute, so for extra safety you may also wish to " +"use :func:`getattr` to access :attr:`!__dict__`." msgstr "" -"請注意,某些外來 (exotic) 或格式錯誤 (malform) 的型別物件可能沒有 :attr:" -"`~type.__dict__` 屬性,因此為了額外的安全,你可能還希望使用 :func:`getattr` " -"來存取 :attr:`!__dict__`。" +"請注意,某些外來 (exotic) 或格式錯誤 (malform) 的型別物件可能沒" +"有 :attr:`~type.__dict__` 屬性,因此為了額外的安全,你可能還希望使" +"用 :func:`getattr` 來存取 :attr:`!__dict__`。" -#: ../../howto/annotations.rst:129 +#: ../../howto/annotations.rst:134 msgid "Manually Un-Stringizing Stringized Annotations" msgstr "手動取消字串化註釋" -#: ../../howto/annotations.rst:131 +#: ../../howto/annotations.rst:136 msgid "" "In situations where some annotations may be \"stringized\", and you wish to " "evaluate those strings to produce the Python values they represent, it " @@ -256,61 +266,63 @@ msgstr "" "在某些註釋可能被「字串化」的情況下,並且你希望評估這些字串以產生它們表示的 " "Python 值,最好呼叫 :func:`inspect.get_annotations` 來為你完成這項工作。" -#: ../../howto/annotations.rst:137 +#: ../../howto/annotations.rst:142 msgid "" -"If you're using Python 3.9 or older, or if for some reason you can't use :" -"func:`inspect.get_annotations`, you'll need to duplicate its logic. You're " -"encouraged to examine the implementation of :func:`inspect.get_annotations` " -"in the current Python version and follow a similar approach." +"If you're using Python 3.9 or older, or if for some reason you can't " +"use :func:`inspect.get_annotations`, you'll need to duplicate its logic. " +"You're encouraged to examine the implementation " +"of :func:`inspect.get_annotations` in the current Python version and follow " +"a similar approach." msgstr "" -"如果你使用的是 Python 3.9 或更早版本,或者由於某種原因你無法使用 :func:" -"`inspect.get_annotations`,則需要複製其邏輯。我們鼓勵你檢查目前 Python 版本" -"中 :func:`inspect.get_annotations` 的實作並遵循類似的方法。" +"如果你使用的是 Python 3.9 或更早版本,或者由於某種原因你無法使" +"用 :func:`inspect.get_annotations`,則需要複製其邏輯。我們鼓勵你檢查目前 " +"Python 版本中 :func:`inspect.get_annotations` 的實作並遵循類似的方法。" -#: ../../howto/annotations.rst:143 +#: ../../howto/annotations.rst:148 msgid "" "In a nutshell, if you wish to evaluate a stringized annotation on an " "arbitrary object ``o``:" msgstr "簡而言之,如果你希望評估任意物件 ``o`` 上的字串化註釋: ::" -#: ../../howto/annotations.rst:146 +#: ../../howto/annotations.rst:151 msgid "" -"If ``o`` is a module, use ``o.__dict__`` as the ``globals`` when calling :" -"func:`eval`." +"If ``o`` is a module, use ``o.__dict__`` as the ``globals`` when " +"calling :func:`eval`." msgstr "" "如果 ``o`` 是一個模組,則在呼叫 :func:`eval` 時使用 ``o.__dict__`` 作為\\ ``" "全域變數``。" -#: ../../howto/annotations.rst:148 +#: ../../howto/annotations.rst:153 msgid "" "If ``o`` is a class, use ``sys.modules[o.__module__].__dict__`` as the " -"``globals``, and ``dict(vars(o))`` as the ``locals``, when calling :func:" -"`eval`." +"``globals``, and ``dict(vars(o))`` as the ``locals``, when " +"calling :func:`eval`." msgstr "" -"如果 ``o`` 是一個類別,當呼叫 :func:`eval` 時,則使用 ``sys.modules[o." -"__module__].__dict__`` 作為\\ ``全域變數``,使用 ``dict(vars(o))`` 作為\\ ``" -"區域變數``。" +"如果 ``o`` 是一個類別,當呼叫 :func:`eval` 時,則使用 " +"``sys.modules[o.__module__].__dict__`` 作為\\ ``全域變數``,使用 " +"``dict(vars(o))`` 作為\\ ``區域變數``。" -#: ../../howto/annotations.rst:151 +#: ../../howto/annotations.rst:156 msgid "" -"If ``o`` is a wrapped callable using :func:`functools.update_wrapper`, :func:" -"`functools.wraps`, or :func:`functools.partial`, iteratively unwrap it by " -"accessing either ``o.__wrapped__`` or ``o.func`` as appropriate, until you " -"have found the root unwrapped function." +"If ``o`` is a wrapped callable " +"using :func:`functools.update_wrapper`, :func:`functools.wraps`, " +"or :func:`functools.partial`, iteratively unwrap it by accessing either " +"``o.__wrapped__`` or ``o.func`` as appropriate, until you have found the " +"root unwrapped function." msgstr "" "如果 ``o`` 是使用 :func:`functools.update_wrapper`、:func:`functools.wraps` " -"或 :func:`functools.partial` 包裝的 callable ,請依據需求,透過存取 ``o." -"__wrapped__`` 或 ``o.func`` 來疊代解開它,直到找到根解包函式。" +"或 :func:`functools.partial` 包裝的 callable ,請依據需求,透過存取 " +"``o.__wrapped__`` 或 ``o.func`` 來疊代解開它,直到找到根解包函式。" -#: ../../howto/annotations.rst:155 +#: ../../howto/annotations.rst:160 msgid "" -"If ``o`` is a callable (but not a class), use :attr:`o.__globals__ ` as the globals when calling :func:`eval`." +"If ``o`` is a callable (but not a class), use :attr:`o.__globals__ " +"` as the globals when calling :func:`eval`." msgstr "" -"如果 ``o`` 是 callable(但不是類別),則在呼叫 :func:`eval` 時使用 :attr:`o." -"__globals__ ` 作為全域變數。" +"如果 ``o`` 是 callable(但不是類別),則在呼叫 :func:`eval` 時使" +"用 :attr:`o.__globals__ ` 作為全域變數。" -#: ../../howto/annotations.rst:159 +#: ../../howto/annotations.rst:164 msgid "" "However, not all string values used as annotations can be successfully " "turned into Python values by :func:`eval`. String values could theoretically " @@ -322,21 +334,21 @@ msgstr "" "理論上,字串值可以包含任何有效的字串,並且在實踐中,型別提示存在有效的用例," "需要使用特定「無法」評估的字串值進行註釋。例如: ::" -#: ../../howto/annotations.rst:166 +#: ../../howto/annotations.rst:171 msgid "" ":pep:`604` union types using ``|``, before support for this was added to " "Python 3.10." msgstr "" "在 Python 3.10 支援 :pep:`604` 聯合型別 (union type) ``|`` 之前使用它。" -#: ../../howto/annotations.rst:168 +#: ../../howto/annotations.rst:173 msgid "" -"Definitions that aren't needed at runtime, only imported when :const:`typing." -"TYPE_CHECKING` is true." +"Definitions that aren't needed at runtime, only imported " +"when :const:`typing.TYPE_CHECKING` is true." msgstr "" "Runtime 中不需要的定義,僅在 :const:`typing.TYPE_CHECKING` 為 true 時匯入。" -#: ../../howto/annotations.rst:171 +#: ../../howto/annotations.rst:176 msgid "" "If :func:`eval` attempts to evaluate such values, it will fail and raise an " "exception. So, when designing a library API that works with annotations, " @@ -346,11 +358,11 @@ msgstr "" "如果 :func:`eval` 嘗試計算這類型的值,它將失敗並引發例外。因此,在設計使用註" "釋的函式庫 API 時,建議僅在呼叫者 (caller) 明確請求時嘗試評估字串值。" -#: ../../howto/annotations.rst:179 +#: ../../howto/annotations.rst:184 msgid "Best Practices For ``__annotations__`` In Any Python Version" msgstr "任何 Python 版本中 ``__annotations__`` 的最佳實踐" -#: ../../howto/annotations.rst:181 +#: ../../howto/annotations.rst:186 msgid "" "You should avoid assigning to the ``__annotations__`` member of objects " "directly. Let Python manage setting ``__annotations__``." @@ -358,7 +370,7 @@ msgstr "" "你應該避免直接指派給物件的 ``__annotations__`` 成員。讓 Python 管理設定 " "``__annotations__``。" -#: ../../howto/annotations.rst:184 +#: ../../howto/annotations.rst:189 msgid "" "If you do assign directly to the ``__annotations__`` member of an object, " "you should always set it to a ``dict`` object." @@ -366,29 +378,37 @@ msgstr "" "如果你直接指派給物件的 ``__annotations__`` 成員,則應始終將其設為 ``dict`` 物" "件。" -#: ../../howto/annotations.rst:187 +#: ../../howto/annotations.rst:192 msgid "" -"If you directly access the ``__annotations__`` member of an object, you " +"You should avoid accessing ``__annotations__`` directly on any object. " +"Instead, use :func:`annotationlib.get_annotations` (Python 3.14+) " +"or :func:`inspect.get_annotations` (Python 3.10+)." +msgstr "" + +#: ../../howto/annotations.rst:196 +#, fuzzy +msgid "" +"If you do directly access the ``__annotations__`` member of an object, you " "should ensure that it's a dictionary before attempting to examine its " "contents." msgstr "" "如果直接存取物件的 ``__annotations__`` 成員,則應在嘗試檢查其內容之前確保它是" "字典。" -#: ../../howto/annotations.rst:191 +#: ../../howto/annotations.rst:200 msgid "You should avoid modifying ``__annotations__`` dicts." msgstr "你應該避免修改 ``__annotations__`` 字典。" -#: ../../howto/annotations.rst:193 +#: ../../howto/annotations.rst:202 msgid "" "You should avoid deleting the ``__annotations__`` attribute of an object." msgstr "你應該避免刪除物件的 ``__annotations__`` 屬性。" -#: ../../howto/annotations.rst:198 +#: ../../howto/annotations.rst:207 msgid "``__annotations__`` Quirks" msgstr "``__annotations__`` 奇異之處" -#: ../../howto/annotations.rst:200 +#: ../../howto/annotations.rst:209 msgid "" "In all versions of Python 3, function objects lazy-create an annotations " "dict if no annotations are defined on that object. You can delete the " @@ -406,13 +426,13 @@ msgstr "" "上的註釋將拋出 ``AttributeError``;連續兩次使用 ``del fn.__annotations__`` 保" "證總是拋出 ``AttributeError`` 。" -#: ../../howto/annotations.rst:210 +#: ../../howto/annotations.rst:219 msgid "" "Everything in the above paragraph also applies to class and module objects " "in Python 3.10 and newer." msgstr "上一段的所有內容也適用於 Python 3.10 及更高版本中的類別和模組物件。" -#: ../../howto/annotations.rst:213 +#: ../../howto/annotations.rst:222 msgid "" "In all versions of Python 3, you can set ``__annotations__`` on a function " "object to ``None``. However, subsequently accessing the annotations on that " @@ -428,7 +448,7 @@ msgstr "" "\\ *並非如此*\\;這些物件允許將 ``__annotations__`` 設定為任何 Python 值,並" "且將保留設定的任何值。" -#: ../../howto/annotations.rst:221 +#: ../../howto/annotations.rst:230 msgid "" "If Python stringizes your annotations for you (using ``from __future__ " "import annotations``), and you specify a string as an annotation, the string " @@ -439,7 +459,7 @@ msgstr "" "annotations``),並且你指定一個字串作為註釋,則該字串本身將被引用。實際上,註" "釋被引用了\\ *兩次。*\\ 例如: ::" -#: ../../howto/annotations.rst:227 +#: ../../howto/annotations.rst:236 msgid "" "from __future__ import annotations\n" "def foo(a: \"str\"): pass\n" @@ -451,10 +471,31 @@ msgstr "" "\n" "print(foo.__annotations__)" -#: ../../howto/annotations.rst:232 +#: ../../howto/annotations.rst:241 msgid "" "This prints ``{'a': \"'str'\"}``. This shouldn't really be considered a " "\"quirk\"; it's mentioned here simply because it might be surprising." msgstr "" "這會印出 ``{'a': \"'str'\"}``。這不應該被認為是一個「奇異的事」,他在這裡被簡" "單提及,因為他可能會讓人意想不到。" + +#: ../../howto/annotations.rst:244 +msgid "" +"If you use a class with a custom metaclass and access ``__annotations__`` on " +"the class, you may observe unexpected behavior; see :pep:`749 <749#pep749-" +"metaclasses>` for some examples. You can avoid these quirks by " +"using :func:`annotationlib.get_annotations` on Python 3.14+ " +"or :func:`inspect.get_annotations` on Python 3.10+. On earlier versions of " +"Python, you can avoid these bugs by accessing the annotations from the " +"class's :attr:`~type.__dict__` (for example, " +"``cls.__dict__.get('__annotations__', None)``)." +msgstr "" + +#: ../../howto/annotations.rst:253 +msgid "" +"In some versions of Python, instances of classes may have an " +"``__annotations__`` attribute. However, this is not supported functionality. " +"If you need the annotations of an instance, you can use :func:`type` to " +"access its class (for example, " +"``annotationlib.get_annotations(type(myinstance))`` on Python 3.14+)." +msgstr "" diff --git a/howto/descriptor.po b/howto/descriptor.po index 955ed73e512..be80d2835dd 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-01 00:19+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -75,8 +75,9 @@ msgstr "" msgid "" "The last section has pure Python equivalents for built-in descriptors that " "are written in C. Read this if you're curious about how functions turn into " -"bound methods or about the implementation of common tools like :func:" -"`classmethod`, :func:`staticmethod`, :func:`property`, and :term:`__slots__`." +"bound methods or about the implementation of common tools " +"like :func:`classmethod`, :func:`staticmethod`, :func:`property`, " +"and :term:`__slots__`." msgstr "" #: ../../howto/descriptor.rst:36 @@ -230,8 +231,9 @@ msgid "" "A popular use for descriptors is managing access to instance data. The " "descriptor is assigned to a public attribute in the class dictionary while " "the actual data is stored as a private attribute in the instance " -"dictionary. The descriptor's :meth:`~object.__get__` and :meth:`~object." -"__set__` methods are triggered when the public attribute is accessed." +"dictionary. The descriptor's :meth:`~object.__get__` " +"and :meth:`~object.__set__` methods are triggered when the public attribute " +"is accessed." msgstr "" #: ../../howto/descriptor.rst:139 @@ -369,9 +371,10 @@ msgstr "" #: ../../howto/descriptor.rst:256 msgid "" -"An interactive session shows that the :class:`!Person` class has called :" -"meth:`~object.__set_name__` so that the field names would be recorded. Here " -"we call :func:`vars` to look up the descriptor without triggering it:" +"An interactive session shows that the :class:`!Person` class has " +"called :meth:`~object.__set_name__` so that the field names would be " +"recorded. Here we call :func:`vars` to look up the descriptor without " +"triggering it:" msgstr "" #: ../../howto/descriptor.rst:260 @@ -428,8 +431,9 @@ msgstr "" #: ../../howto/descriptor.rst:297 msgid "" -"A :term:`descriptor` is what we call any object that defines :meth:`~object." -"__get__`, :meth:`~object.__set__`, or :meth:`~object.__delete__`." +"A :term:`descriptor` is what we call any object that " +"defines :meth:`~object.__get__`, :meth:`~object.__set__`, " +"or :meth:`~object.__delete__`." msgstr "" #: ../../howto/descriptor.rst:300 @@ -469,9 +473,9 @@ msgstr "" #: ../../howto/descriptor.rst:319 msgid "" "Descriptors are used throughout the language. It is how functions turn into " -"bound methods. Common tools like :func:`classmethod`, :func:" -"`staticmethod`, :func:`property`, and :func:`functools.cached_property` are " -"all implemented as descriptors." +"bound methods. Common tools " +"like :func:`classmethod`, :func:`staticmethod`, :func:`property`, " +"and :func:`functools.cached_property` are all implemented as descriptors." msgstr "" #: ../../howto/descriptor.rst:326 @@ -561,9 +565,9 @@ msgstr "" #: ../../howto/descriptor.rst:374 msgid "" -":class:`!Number` verifies that a value is either an :class:`int` or :class:" -"`float`. Optionally, it verifies that a value is between a given minimum or " -"maximum." +":class:`!Number` verifies that a value is either an :class:`int` " +"or :class:`float`. Optionally, it verifies that a value is between a given " +"minimum or maximum." msgstr "" #: ../../howto/descriptor.rst:378 @@ -614,7 +618,7 @@ msgid "" "\n" " def validate(self, value):\n" " if not isinstance(value, str):\n" -" raise TypeError(f'Expected {value!r} to be a str')\n" +" raise TypeError(f'Expected {value!r} to be an str')\n" " if self.minsize is not None and len(value) < self.minsize:\n" " raise ValueError(\n" " f'Expected {value!r} to be no smaller than {self.minsize!" @@ -716,9 +720,10 @@ msgstr "" #: ../../howto/descriptor.rst:503 msgid "" "In general, a descriptor is an attribute value that has one of the methods " -"in the descriptor protocol. Those methods are :meth:`~object.__get__`, :" -"meth:`~object.__set__`, and :meth:`~object.__delete__`. If any of those " -"methods are defined for an attribute, it is said to be a :term:`descriptor`." +"in the descriptor protocol. Those methods " +"are :meth:`~object.__get__`, :meth:`~object.__set__`, " +"and :meth:`~object.__delete__`. If any of those methods are defined for an " +"attribute, it is said to be a :term:`descriptor`." msgstr "" #: ../../howto/descriptor.rst:508 @@ -736,10 +741,10 @@ msgstr "" #: ../../howto/descriptor.rst:517 msgid "" "Descriptors are a powerful, general purpose protocol. They are the " -"mechanism behind properties, methods, static methods, class methods, and :" -"func:`super`. They are used throughout Python itself. Descriptors simplify " -"the underlying C code and offer a flexible set of new tools for everyday " -"Python programs." +"mechanism behind properties, methods, static methods, class methods, " +"and :func:`super`. They are used throughout Python itself. Descriptors " +"simplify the underlying C code and offer a flexible set of new tools for " +"everyday Python programs." msgstr "" #: ../../howto/descriptor.rst:525 @@ -768,9 +773,9 @@ msgstr "" #: ../../howto/descriptor.rst:537 msgid "" "If an object defines :meth:`~object.__set__` or :meth:`~object.__delete__`, " -"it is considered a data descriptor. Descriptors that only define :meth:" -"`~object.__get__` are called non-data descriptors (they are often used for " -"methods but other uses are possible)." +"it is considered a data descriptor. Descriptors that only " +"define :meth:`~object.__get__` are called non-data descriptors (they are " +"often used for methods but other uses are possible)." msgstr "" #: ../../howto/descriptor.rst:542 @@ -785,9 +790,10 @@ msgstr "" #: ../../howto/descriptor.rst:548 msgid "" "To make a read-only data descriptor, define both :meth:`~object.__get__` " -"and :meth:`~object.__set__` with the :meth:`~object.__set__` raising an :exc:" -"`AttributeError` when called. Defining the :meth:`~object.__set__` method " -"with an exception raising placeholder is enough to make it a data descriptor." +"and :meth:`~object.__set__` with the :meth:`~object.__set__` raising " +"an :exc:`AttributeError` when called. Defining the :meth:`~object.__set__` " +"method with an exception raising placeholder is enough to make it a data " +"descriptor." msgstr "" #: ../../howto/descriptor.rst:555 @@ -796,8 +802,8 @@ msgstr "" #: ../../howto/descriptor.rst:557 msgid "" -"A descriptor can be called directly with ``desc.__get__(obj)`` or ``desc." -"__get__(None, cls)``." +"A descriptor can be called directly with ``desc.__get__(obj)`` or " +"``desc.__get__(None, cls)``." msgstr "" #: ../../howto/descriptor.rst:560 @@ -834,8 +840,8 @@ msgstr "" #: ../../howto/descriptor.rst:580 msgid "" -"If a descriptor is found for ``a.x``, then it is invoked with: ``desc." -"__get__(a, type(a))``." +"If a descriptor is found for ``a.x``, then it is invoked with: " +"``desc.__get__(a, type(a))``." msgstr "" #: ../../howto/descriptor.rst:583 @@ -875,18 +881,19 @@ msgstr "" #: ../../howto/descriptor.rst:722 msgid "" -"Note, there is no :meth:`~object.__getattr__` hook in the :meth:`~object." -"__getattribute__` code. That is why calling :meth:`~object." -"__getattribute__` directly or with ``super().__getattribute__`` will bypass :" -"meth:`~object.__getattr__` entirely." +"Note, there is no :meth:`~object.__getattr__` hook in " +"the :meth:`~object.__getattribute__` code. That is why " +"calling :meth:`~object.__getattribute__` directly or with " +"``super().__getattribute__`` will bypass :meth:`~object.__getattr__` " +"entirely." msgstr "" #: ../../howto/descriptor.rst:726 msgid "" "Instead, it is the dot operator and the :func:`getattr` function that are " -"responsible for invoking :meth:`~object.__getattr__` whenever :meth:`~object." -"__getattribute__` raises an :exc:`AttributeError`. Their logic is " -"encapsulated in a helper function:" +"responsible for invoking :meth:`~object.__getattr__` " +"whenever :meth:`~object.__getattribute__` raises an :exc:`AttributeError`. " +"Their logic is encapsulated in a helper function:" msgstr "" #: ../../howto/descriptor.rst:731 @@ -915,10 +922,10 @@ msgstr "" #: ../../howto/descriptor.rst:778 msgid "" -"The logic for a dotted lookup such as ``A.x`` is in :meth:`!type." -"__getattribute__`. The steps are similar to those for :meth:`!object." -"__getattribute__` but the instance dictionary lookup is replaced by a search " -"through the class's :term:`method resolution order`." +"The logic for a dotted lookup such as ``A.x`` is in :meth:`!" +"type.__getattribute__`. The steps are similar to those for :meth:`!" +"object.__getattribute__` but the instance dictionary lookup is replaced by a " +"search through the class's :term:`method resolution order`." msgstr "" #: ../../howto/descriptor.rst:783 @@ -927,8 +934,8 @@ msgstr "" #: ../../howto/descriptor.rst:785 msgid "" -"The full C implementation can be found in :c:func:`!type_getattro` and :c:" -"func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." +"The full C implementation can be found in :c:func:`!type_getattro` " +"and :c:func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." msgstr "" #: ../../howto/descriptor.rst:790 @@ -937,22 +944,23 @@ msgstr "" #: ../../howto/descriptor.rst:792 msgid "" -"The logic for super's dotted lookup is in the :meth:`~object." -"__getattribute__` method for object returned by :func:`super`." +"The logic for super's dotted lookup is in " +"the :meth:`~object.__getattribute__` method for object returned " +"by :func:`super`." msgstr "" #: ../../howto/descriptor.rst:795 msgid "" -"A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__." -"__mro__`` for the base class ``B`` immediately following ``A`` and then " -"returns ``B.__dict__['m'].__get__(obj, A)``. If not a descriptor, ``m`` is " -"returned unchanged." +"A dotted lookup such as ``super(A, obj).m`` searches " +"``obj.__class__.__mro__`` for the base class ``B`` immediately following " +"``A`` and then returns ``B.__dict__['m'].__get__(obj, A)``. If not a " +"descriptor, ``m`` is returned unchanged." msgstr "" #: ../../howto/descriptor.rst:800 msgid "" -"The full C implementation can be found in :c:func:`!super_getattro` in :" -"source:`Objects/typeobject.c`. A pure Python equivalent can be found in " +"The full C implementation can be found in :c:func:`!super_getattro` " +"in :source:`Objects/typeobject.c`. A pure Python equivalent can be found in " "`Guido's Tutorial `_." msgstr "" @@ -963,9 +971,9 @@ msgstr "" #: ../../howto/descriptor.rst:809 msgid "" -"The mechanism for descriptors is embedded in the :meth:`~object." -"__getattribute__` methods for :class:`object`, :class:`type`, and :func:" -"`super`." +"The mechanism for descriptors is embedded in " +"the :meth:`~object.__getattribute__` methods " +"for :class:`object`, :class:`type`, and :func:`super`." msgstr "" #: ../../howto/descriptor.rst:812 @@ -978,8 +986,8 @@ msgstr "" #: ../../howto/descriptor.rst:816 msgid "" -"Classes inherit this machinery from :class:`object`, :class:`type`, or :func:" -"`super`." +"Classes inherit this machinery from :class:`object`, :class:`type`, " +"or :func:`super`." msgstr "" #: ../../howto/descriptor.rst:819 @@ -1038,8 +1046,8 @@ msgstr "ORM 範例" #: ../../howto/descriptor.rst:853 msgid "" "The following code is a simplified skeleton showing how data descriptors " -"could be used to implement an `object relational mapping `_." +"could be used to implement an `object relational mapping `_." msgstr "" #: ../../howto/descriptor.rst:857 @@ -1083,9 +1091,9 @@ msgstr "" #: ../../howto/descriptor.rst:876 msgid "" -"We can use the :class:`!Field` class to define `models `_ that describe the schema for each table in a " -"database:" +"We can use the :class:`!Field` class to define `models `_ that describe the schema for each " +"table in a database:" msgstr "" #: ../../howto/descriptor.rst:880 @@ -1342,10 +1350,10 @@ msgstr "" #: ../../howto/descriptor.rst:1189 msgid "" -"To support automatic creation of methods, functions include the :meth:" -"`~object.__get__` method for binding methods during attribute access. This " -"means that functions are non-data descriptors that return bound methods " -"during dotted lookup from an instance. Here's how it works:" +"To support automatic creation of methods, functions include " +"the :meth:`~object.__get__` method for binding methods during attribute " +"access. This means that functions are non-data descriptors that return " +"bound methods during dotted lookup from an instance. Here's how it works:" msgstr "" #: ../../howto/descriptor.rst:1194 @@ -1397,8 +1405,9 @@ msgstr "" #: ../../howto/descriptor.rst:1233 msgid "" -"Accessing the function through the class dictionary does not invoke :meth:" -"`~object.__get__`. Instead, it just returns the underlying function object::" +"Accessing the function through the class dictionary does not " +"invoke :meth:`~object.__get__`. Instead, it just returns the underlying " +"function object::" msgstr "" #: ../../howto/descriptor.rst:1236 @@ -1535,10 +1544,10 @@ msgstr "" #: ../../howto/descriptor.rst:1293 msgid "" "Static methods return the underlying function without changes. Calling " -"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into ``object." -"__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, \"f\")``. As a " -"result, the function becomes identically accessible from either an object or " -"a class." +"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into " +"``object.__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, " +"\"f\")``. As a result, the function becomes identically accessible from " +"either an object or a class." msgstr "" #: ../../howto/descriptor.rst:1299 @@ -1591,8 +1600,8 @@ msgstr "" #: ../../howto/descriptor.rst:1328 msgid "" -"Using the non-data descriptor protocol, a pure Python version of :func:" -"`staticmethod` would look like this:" +"Using the non-data descriptor protocol, a pure Python version " +"of :func:`staticmethod` would look like this:" msgstr "" #: ../../howto/descriptor.rst:1331 @@ -1610,30 +1619,34 @@ msgid "" " return self.f\n" "\n" " def __call__(self, *args, **kwds):\n" -" return self.f(*args, **kwds)" +" return self.f(*args, **kwds)\n" +"\n" +" @property\n" +" def __annotations__(self):\n" +" return self.f.__annotations__" msgstr "" -#: ../../howto/descriptor.rst:1348 +#: ../../howto/descriptor.rst:1352 msgid "" "The :func:`functools.update_wrapper` call adds a ``__wrapped__`` attribute " "that refers to the underlying function. Also it carries forward the " -"attributes necessary to make the wrapper look like the wrapped function: :" -"attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function." -"__doc__`, and :attr:`~function.__annotations__`." +"attributes necessary to make the wrapper look like the wrapped function, " +"including :attr:`~function.__name__`, :attr:`~function.__qualname__`, " +"and :attr:`~function.__doc__`." msgstr "" -#: ../../howto/descriptor.rst:1417 +#: ../../howto/descriptor.rst:1421 msgid "Class methods" msgstr "" -#: ../../howto/descriptor.rst:1419 +#: ../../howto/descriptor.rst:1423 msgid "" "Unlike static methods, class methods prepend the class reference to the " "argument list before calling the function. This format is the same for " "whether the caller is an object or a class:" msgstr "" -#: ../../howto/descriptor.rst:1423 +#: ../../howto/descriptor.rst:1427 msgid "" "class F:\n" " @classmethod\n" @@ -1645,7 +1658,7 @@ msgstr "" " def f(cls, x):\n" " return cls.__name__, x" -#: ../../howto/descriptor.rst:1430 +#: ../../howto/descriptor.rst:1434 msgid "" ">>> F.f(3)\n" "('F', 3)\n" @@ -1657,7 +1670,7 @@ msgstr "" ">>> F().f(3)\n" "('F', 3)" -#: ../../howto/descriptor.rst:1437 +#: ../../howto/descriptor.rst:1441 msgid "" "This behavior is useful whenever the method only needs to have a class " "reference and does not rely on data stored in a specific instance. One use " @@ -1666,7 +1679,7 @@ msgid "" "of keys. The pure Python equivalent is:" msgstr "" -#: ../../howto/descriptor.rst:1443 +#: ../../howto/descriptor.rst:1447 msgid "" "class Dict(dict):\n" " @classmethod\n" @@ -1678,11 +1691,11 @@ msgid "" " return d" msgstr "" -#: ../../howto/descriptor.rst:1454 +#: ../../howto/descriptor.rst:1458 msgid "Now a new dictionary of unique keys can be constructed like this:" msgstr "" -#: ../../howto/descriptor.rst:1456 +#: ../../howto/descriptor.rst:1460 msgid "" ">>> d = Dict.fromkeys('abracadabra')\n" ">>> type(d) is Dict\n" @@ -1696,13 +1709,13 @@ msgstr "" ">>> d\n" "{'a': None, 'b': None, 'r': None, 'c': None, 'd': None}" -#: ../../howto/descriptor.rst:1464 +#: ../../howto/descriptor.rst:1468 msgid "" -"Using the non-data descriptor protocol, a pure Python version of :func:" -"`classmethod` would look like this:" +"Using the non-data descriptor protocol, a pure Python version " +"of :func:`classmethod` would look like this:" msgstr "" -#: ../../howto/descriptor.rst:1467 +#: ../../howto/descriptor.rst:1471 msgid "" "import functools\n" "\n" @@ -1719,34 +1732,34 @@ msgid "" " return MethodType(self.f, cls)" msgstr "" -#: ../../howto/descriptor.rst:1529 +#: ../../howto/descriptor.rst:1533 msgid "" "The :func:`functools.update_wrapper` call in ``ClassMethod`` adds a " "``__wrapped__`` attribute that refers to the underlying function. Also it " "carries forward the attributes necessary to make the wrapper look like the " -"wrapped function: :attr:`~function.__name__`, :attr:`~function." -"__qualname__`, :attr:`~function.__doc__`, and :attr:`~function." -"__annotations__`." +"wrapped " +"function: :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__`, " +"and :attr:`~function.__annotations__`." msgstr "" -#: ../../howto/descriptor.rst:1538 +#: ../../howto/descriptor.rst:1542 msgid "Member objects and __slots__" msgstr "" -#: ../../howto/descriptor.rst:1540 +#: ../../howto/descriptor.rst:1544 msgid "" "When a class defines ``__slots__``, it replaces instance dictionaries with a " "fixed-length array of slot values. From a user point of view that has " "several effects:" msgstr "" -#: ../../howto/descriptor.rst:1544 +#: ../../howto/descriptor.rst:1548 msgid "" "1. Provides immediate detection of bugs due to misspelled attribute " "assignments. Only attribute names specified in ``__slots__`` are allowed:" msgstr "" -#: ../../howto/descriptor.rst:1547 +#: ../../howto/descriptor.rst:1551 msgid "" "class Vehicle:\n" " __slots__ = ('id_number', 'make', 'model')" @@ -1754,7 +1767,7 @@ msgstr "" "class Vehicle:\n" " __slots__ = ('id_number', 'make', 'model')" -#: ../../howto/descriptor.rst:1552 +#: ../../howto/descriptor.rst:1556 msgid "" ">>> auto = Vehicle()\n" ">>> auto.id_nubmer = 'VYE483814LQEX'\n" @@ -1768,13 +1781,13 @@ msgstr "" " ...\n" "AttributeError: 'Vehicle' object has no attribute 'id_nubmer'" -#: ../../howto/descriptor.rst:1560 +#: ../../howto/descriptor.rst:1564 msgid "" "2. Helps create immutable objects where descriptors manage access to private " "attributes stored in ``__slots__``:" msgstr "" -#: ../../howto/descriptor.rst:1563 +#: ../../howto/descriptor.rst:1567 msgid "" "class Immutable:\n" "\n" @@ -1794,7 +1807,7 @@ msgid "" " return self._name" msgstr "" -#: ../../howto/descriptor.rst:1581 +#: ../../howto/descriptor.rst:1585 msgid "" ">>> mark = Immutable('Botany', 'Mark Watney')\n" ">>> mark.dept\n" @@ -1820,7 +1833,7 @@ msgstr "" " ...\n" "AttributeError: 'Immutable' object has no attribute 'location'" -#: ../../howto/descriptor.rst:1595 +#: ../../howto/descriptor.rst:1599 msgid "" "3. Saves memory. On a 64-bit Linux build, an instance with two attributes " "takes 48 bytes with ``__slots__`` and 152 bytes without. This `flyweight " @@ -1828,19 +1841,19 @@ msgid "" "only matters when a large number of instances are going to be created." msgstr "" -#: ../../howto/descriptor.rst:1600 +#: ../../howto/descriptor.rst:1604 msgid "" "4. Improves speed. Reading instance variables is 35% faster with " "``__slots__`` (as measured with Python 3.10 on an Apple M1 processor)." msgstr "" -#: ../../howto/descriptor.rst:1603 +#: ../../howto/descriptor.rst:1607 msgid "" "5. Blocks tools like :func:`functools.cached_property` which require an " "instance dictionary to function correctly:" msgstr "" -#: ../../howto/descriptor.rst:1606 +#: ../../howto/descriptor.rst:1610 msgid "" "from functools import cached_property\n" "\n" @@ -1853,7 +1866,7 @@ msgid "" " for n in reversed(range(100_000)))" msgstr "" -#: ../../howto/descriptor.rst:1618 +#: ../../howto/descriptor.rst:1622 msgid "" ">>> CP().pi\n" "Traceback (most recent call last):\n" @@ -1865,7 +1878,7 @@ msgstr "" " ...\n" "TypeError: No '__dict__' attribute on 'CP' instance to cache 'pi' property." -#: ../../howto/descriptor.rst:1625 +#: ../../howto/descriptor.rst:1629 msgid "" "It is not possible to create an exact drop-in pure Python version of " "``__slots__`` because it requires direct access to C structures and control " @@ -1875,7 +1888,7 @@ msgid "" "managed by member descriptors:" msgstr "" -#: ../../howto/descriptor.rst:1632 +#: ../../howto/descriptor.rst:1636 msgid "" "null = object()\n" "\n" @@ -1914,13 +1927,13 @@ msgid "" " return f''" msgstr "" -#: ../../howto/descriptor.rst:1670 +#: ../../howto/descriptor.rst:1674 msgid "" "The :meth:`!type.__new__` method takes care of adding member objects to " "class variables:" msgstr "" -#: ../../howto/descriptor.rst:1673 +#: ../../howto/descriptor.rst:1677 msgid "" "class Type(type):\n" " 'Simulate how the type metaclass adds member objects for slots'\n" @@ -1934,14 +1947,14 @@ msgid "" " return type.__new__(mcls, clsname, bases, mapping, **kwargs)" msgstr "" -#: ../../howto/descriptor.rst:1686 +#: ../../howto/descriptor.rst:1690 msgid "" "The :meth:`object.__new__` method takes care of creating instances that have " "slots instead of an instance dictionary. Here is a rough simulation in pure " "Python:" msgstr "" -#: ../../howto/descriptor.rst:1690 +#: ../../howto/descriptor.rst:1694 msgid "" "class Object:\n" " 'Simulate how object.__new__() allocates memory for __slots__'\n" @@ -1973,13 +1986,13 @@ msgid "" " super().__delattr__(name)" msgstr "" -#: ../../howto/descriptor.rst:1721 +#: ../../howto/descriptor.rst:1725 msgid "" "To use the simulation in a real class, just inherit from :class:`!Object` " "and set the :term:`metaclass` to :class:`Type`:" msgstr "" -#: ../../howto/descriptor.rst:1724 +#: ../../howto/descriptor.rst:1728 msgid "" "class H(Object, metaclass=Type):\n" " 'Instance variables stored in slots'\n" @@ -1991,12 +2004,12 @@ msgid "" " self.y = y" msgstr "" -#: ../../howto/descriptor.rst:1735 +#: ../../howto/descriptor.rst:1739 msgid "" "At this point, the metaclass has loaded member objects for *x* and *y*::" msgstr "" -#: ../../howto/descriptor.rst:1737 +#: ../../howto/descriptor.rst:1741 msgid "" ">>> from pprint import pp\n" ">>> pp(dict(vars(H)))\n" @@ -2016,13 +2029,13 @@ msgstr "" " 'x': ,\n" " 'y': }" -#: ../../howto/descriptor.rst:1756 +#: ../../howto/descriptor.rst:1760 msgid "" "When instances are created, they have a ``slot_values`` list where the " "attributes are stored:" msgstr "" -#: ../../howto/descriptor.rst:1759 +#: ../../howto/descriptor.rst:1763 msgid "" ">>> h = H(10, 20)\n" ">>> vars(h)\n" @@ -2038,11 +2051,11 @@ msgstr "" ">>> vars(h)\n" "{'_slotvalues': [55, 20]}" -#: ../../howto/descriptor.rst:1768 +#: ../../howto/descriptor.rst:1772 msgid "Misspelled or unassigned attributes will raise an exception:" msgstr "" -#: ../../howto/descriptor.rst:1770 +#: ../../howto/descriptor.rst:1774 msgid "" ">>> h.xz\n" "Traceback (most recent call last):\n" diff --git a/howto/enum.po b/howto/enum.po index 31233ba9023..8898d65b1a2 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-13 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -315,15 +315,15 @@ msgstr "" #: ../../howto/enum.rst:154 msgid "" ">>> chores_for_ethan = {\n" -"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." -"FRIDAY,\n" +"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | " +"Weekday.FRIDAY,\n" "... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" msgstr "" ">>> chores_for_ethan = {\n" -"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." -"FRIDAY,\n" +"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | " +"Weekday.FRIDAY,\n" "... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" @@ -386,8 +386,8 @@ msgstr "" #: ../../howto/enum.rst:191 msgid "" -"Sometimes it's useful to access members in enumerations programmatically (i." -"e. situations where ``Color.RED`` won't do because the exact color is not " +"Sometimes it's useful to access members in enumerations programmatically " +"(i.e. situations where ``Color.RED`` won't do because the exact color is not " "known at program-writing time). ``Enum`` allows such access::" msgstr "" @@ -627,16 +627,16 @@ msgid "" ">>> list(Shape)\n" "[, , ]\n" ">>> list(Weekday)\n" -"[, , , , , , ]" +"[, , , " +", , , " +"]" msgstr "" ">>> list(Shape)\n" "[, , ]\n" ">>> list(Weekday)\n" -"[, , , , , , ]" +"[, , , " +", , , " +"]" #: ../../howto/enum.rst:319 msgid "" @@ -839,24 +839,25 @@ msgid "" "The rules for what is allowed are as follows: names that start and end with " "a single underscore are reserved by enum and cannot be used; all other " "attributes defined within an enumeration will become members of this " -"enumeration, with the exception of special methods (:meth:`~object." -"__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also " -"descriptors), and variable names listed in :attr:`~Enum._ignore_`." +"enumeration, with the exception of special methods " +"(:meth:`~object.__str__`, :meth:`~object.__add__`, etc.), descriptors " +"(methods are also descriptors), and variable names listed " +"in :attr:`~Enum._ignore_`." msgstr "" #: ../../howto/enum.rst:432 msgid "" -"Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:" -"`~object.__init__`, any value(s) given to the enum member will be passed " -"into those methods. See `Planet`_ for an example." +"Note: if your enumeration defines :meth:`~object.__new__` and/" +"or :meth:`~object.__init__`, any value(s) given to the enum member will be " +"passed into those methods. See `Planet`_ for an example." msgstr "" #: ../../howto/enum.rst:438 msgid "" "The :meth:`~object.__new__` method, if defined, is used during creation of " "the Enum members; it is then replaced by Enum's :meth:`~object.__new__` " -"which is used after class creation for lookup of existing members. See :ref:" -"`new-vs-init` for more details." +"which is used after class creation for lookup of existing members. " +"See :ref:`new-vs-init` for more details." msgstr "" #: ../../howto/enum.rst:445 @@ -938,8 +939,8 @@ msgstr "" #: ../../howto/enum.rst:486 msgid "" -"When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum." -"__repr__` omits the inherited class' name. For example::" +"When inheriting from a :class:`~dataclasses.dataclass`, " +"the :meth:`~Enum.__repr__` omits the inherited class' name. For example::" msgstr "" #: ../../howto/enum.rst:489 @@ -1040,9 +1041,10 @@ msgstr "" #: ../../howto/enum.rst:547 msgid "" -"It is possible to modify how enum members are pickled/unpickled by defining :" -"meth:`~object.__reduce_ex__` in the enumeration class. The default method " -"is by-value, but enums with complicated values may want to use by-name::" +"It is possible to modify how enum members are pickled/unpickled by " +"defining :meth:`~object.__reduce_ex__` in the enumeration class. The " +"default method is by-value, but enums with complicated values may want to " +"use by-name::" msgstr "" #: ../../howto/enum.rst:551 @@ -1151,10 +1153,10 @@ msgstr "" #: ../../howto/enum.rst:611 msgid "" -"The new pickle protocol 4 also, in some circumstances, relies on :attr:" -"`~type.__qualname__` being set to the location where pickle will be able to " -"find the class. For example, if the class was made available in class " -"SomeData in the global scope::" +"The new pickle protocol 4 also, in some circumstances, relies " +"on :attr:`~type.__qualname__` being set to the location where pickle will be " +"able to find the class. For example, if the class was made available in " +"class SomeData in the global scope::" msgstr "" #: ../../howto/enum.rst:616 @@ -1257,10 +1259,10 @@ msgstr "IntEnum" #: ../../howto/enum.rst:667 msgid "" -"The first variation of :class:`Enum` that is provided is also a subclass of :" -"class:`int`. Members of an :class:`IntEnum` can be compared to integers; by " -"extension, integer enumerations of different types can also be compared to " -"each other::" +"The first variation of :class:`Enum` that is provided is also a subclass " +"of :class:`int`. Members of an :class:`IntEnum` can be compared to " +"integers; by extension, integer enumerations of different types can also be " +"compared to each other::" msgstr "" #: ../../howto/enum.rst:672 @@ -1369,9 +1371,9 @@ msgid "" "The next variation of :class:`Enum` provided, :class:`IntFlag`, is also " "based on :class:`int`. The difference being :class:`IntFlag` members can be " "combined using the bitwise operators (&, \\|, ^, ~) and the result is still " -"an :class:`IntFlag` member, if possible. Like :class:`IntEnum`, :class:" -"`IntFlag` members are also integers and can be used wherever an :class:`int` " -"is used." +"an :class:`IntFlag` member, if possible. " +"Like :class:`IntEnum`, :class:`IntFlag` members are also integers and can be " +"used wherever an :class:`int` is used." msgstr "" #: ../../howto/enum.rst:733 @@ -1461,8 +1463,8 @@ msgstr "" #: ../../howto/enum.rst:781 msgid "" "Another important difference between :class:`IntFlag` and :class:`Enum` is " -"that if no flags are set (the value is 0), its boolean evaluation is :data:" -"`False`::" +"that if no flags are set (the value is 0), its boolean evaluation " +"is :data:`False`::" msgstr "" #: ../../howto/enum.rst:784 @@ -1530,10 +1532,10 @@ msgstr "Flag" #: ../../howto/enum.rst:817 msgid "" "The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` " -"members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :" -"class:`IntFlag`, they cannot be combined with, nor compared against, any " -"other :class:`Flag` enumeration, nor :class:`int`. While it is possible to " -"specify the values directly it is recommended to use :class:`auto` as the " +"members can be combined using the bitwise operators (&, \\|, ^, ~). " +"Unlike :class:`IntFlag`, they cannot be combined with, nor compared against, " +"any other :class:`Flag` enumeration, nor :class:`int`. While it is possible " +"to specify the values directly it is recommended to use :class:`auto` as the " "value and let :class:`Flag` select an appropriate value." msgstr "" @@ -1642,10 +1644,10 @@ msgid "" "For the majority of new code, :class:`Enum` and :class:`Flag` are strongly " "recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic " "promises of an enumeration (by being comparable to integers, and thus by " -"transitivity to other unrelated enumerations). :class:`IntEnum` and :class:" -"`IntFlag` should be used only in cases where :class:`Enum` and :class:`Flag` " -"will not do; for example, when integer constants are replaced with " -"enumerations, or for interoperability with other systems." +"transitivity to other unrelated enumerations). :class:`IntEnum` " +"and :class:`IntFlag` should be used only in cases where :class:`Enum` " +"and :class:`Flag` will not do; for example, when integer constants are " +"replaced with enumerations, or for interoperability with other systems." msgstr "" #: ../../howto/enum.rst:886 @@ -1669,8 +1671,8 @@ msgstr "" #: ../../howto/enum.rst:894 msgid "" "This demonstrates how similar derived enumerations can be defined; for " -"example a :class:`!FloatEnum` that mixes in :class:`float` instead of :class:" -"`int`." +"example a :class:`!FloatEnum` that mixes in :class:`float` instead " +"of :class:`int`." msgstr "" #: ../../howto/enum.rst:897 @@ -1679,24 +1681,24 @@ msgstr "一些規則:" #: ../../howto/enum.rst:899 msgid "" -"When subclassing :class:`Enum`, mix-in types must appear before the :class:" -"`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` " -"example above." +"When subclassing :class:`Enum`, mix-in types must appear before " +"the :class:`Enum` class itself in the sequence of bases, as in " +"the :class:`IntEnum` example above." msgstr "" #: ../../howto/enum.rst:902 msgid "" -"Mix-in types must be subclassable. For example, :class:`bool` and :class:" -"`range` are not subclassable and will throw an error during Enum creation if " -"used as the mix-in type." +"Mix-in types must be subclassable. For example, :class:`bool` " +"and :class:`range` are not subclassable and will throw an error during Enum " +"creation if used as the mix-in type." msgstr "" #: ../../howto/enum.rst:905 msgid "" "While :class:`Enum` can have members of any type, once you mix in an " -"additional type, all the members must have values of that type, e.g. :class:" -"`int` above. This restriction does not apply to mix-ins which only add " -"methods and don't specify another type." +"additional type, all the members must have values of that type, " +"e.g. :class:`int` above. This restriction does not apply to mix-ins which " +"only add methods and don't specify another type." msgstr "" #: ../../howto/enum.rst:909 @@ -1708,30 +1710,30 @@ msgstr "" #: ../../howto/enum.rst:912 msgid "" -"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or a :class:" -"`~dataclasses.dataclass`" +"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or " +"a :class:`~dataclasses.dataclass`" msgstr "" #: ../../howto/enum.rst:914 msgid "" -"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's :meth:" -"`~object.__str__` and :meth:`~object.__repr__` respectively; other codes " -"(such as ``%i`` or ``%h`` for IntEnum) treat the enum member as its mixed-in " -"type." +"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` " +"class's :meth:`~object.__str__` and :meth:`~object.__repr__` respectively; " +"other codes (such as ``%i`` or ``%h`` for IntEnum) treat the enum member as " +"its mixed-in type." msgstr "" #: ../../howto/enum.rst:917 msgid "" -":ref:`Formatted string literals `, :meth:`str.format`, and :func:" -"`format` will use the enum's :meth:`~object.__str__` method." +":ref:`Formatted string literals `, :meth:`str.format`, " +"and :func:`format` will use the enum's :meth:`~object.__str__` method." msgstr "" #: ../../howto/enum.rst:922 msgid "" "Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are " -"designed to be drop-in replacements for existing constants, their :meth:" -"`~object.__str__` method has been reset to their data types' :meth:`~object." -"__str__` method." +"designed to be drop-in replacements for existing constants, " +"their :meth:`~object.__str__` method has been reset to their data " +"types' :meth:`~object.__str__` method." msgstr "" #: ../../howto/enum.rst:930 @@ -1742,8 +1744,8 @@ msgstr "" msgid "" ":meth:`~object.__new__` must be used whenever you want to customize the " "actual value of the :class:`Enum` member. Any other modifications may go in " -"either :meth:`~object.__new__` or :meth:`~object.__init__`, with :meth:" -"`~object.__init__` being preferred." +"either :meth:`~object.__new__` or :meth:`~object.__init__`, " +"with :meth:`~object.__init__` being preferred." msgstr "" #: ../../howto/enum.rst:936 @@ -1800,9 +1802,9 @@ msgstr "" #: ../../howto/enum.rst:976 msgid "" ":meth:`~object.__new__`, if specified, must create and return the enum " -"members; it is also a very good idea to set the member's :attr:`~Enum." -"_value_` appropriately. Once all the members are created it is no longer " -"used." +"members; it is also a very good idea to set the " +"member's :attr:`~Enum._value_` appropriately. Once all the members are " +"created it is no longer used." msgstr "" #: ../../howto/enum.rst:982 @@ -1825,9 +1827,9 @@ msgstr "" #: ../../howto/enum.rst:988 msgid "" -":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" -"class:`str`, that will not be transformed into members, and will be removed " -"from the final class" +":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or " +"a :class:`str`, that will not be transformed into members, and will be " +"removed from the final class" msgstr "" #: ../../howto/enum.rst:991 @@ -1838,13 +1840,13 @@ msgstr "" #: ../../howto/enum.rst:993 msgid "" -":meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing " +":meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing " "member." msgstr "" #: ../../howto/enum.rst:995 msgid "" -":meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an " +":meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an " "existing member. See `MultiValueEnum`_ for an example." msgstr "" @@ -1971,11 +1973,11 @@ msgstr "" #: ../../howto/enum.rst:1074 msgid "" -"Enum classes that are mixed with non-:class:`Enum` types (such as :class:" -"`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's " -"rules; otherwise, all members evaluate as :data:`True`. To make your own " -"enum's boolean evaluation depend on the member's value add the following to " -"your class::" +"Enum classes that are mixed with non-:class:`Enum` types (such " +"as :class:`int`, :class:`str`, etc.) are evaluated according to the mixed-in " +"type's rules; otherwise, all members evaluate as :data:`True`. To make your " +"own enum's boolean evaluation depend on the member's value add the following " +"to your class::" msgstr "" #: ../../howto/enum.rst:1080 @@ -2228,8 +2230,8 @@ msgstr "" #: ../../howto/enum.rst:1202 msgid "" "The default for Flag is ``STRICT``, the default for ``IntFlag`` is " -"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl." -"Options`` for an example of when ``KEEP`` is needed)." +"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see " +"``ssl.Options`` for an example of when ``KEEP`` is needed)." msgstr "" #: ../../howto/enum.rst:1210 @@ -2238,8 +2240,8 @@ msgstr "Enums 和 Flags 有何不同?" #: ../../howto/enum.rst:1212 msgid "" -"Enums have a custom metaclass that affects many aspects of both derived :" -"class:`Enum` classes and their instances (members)." +"Enums have a custom metaclass that affects many aspects of both " +"derived :class:`Enum` classes and their instances (members)." msgstr "" #: ../../howto/enum.rst:1217 @@ -2248,14 +2250,14 @@ msgstr "Enum 類別" #: ../../howto/enum.rst:1219 msgid "" -"The :class:`EnumType` metaclass is responsible for providing the :meth:" -"`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " +"The :class:`EnumType` metaclass is responsible for providing " +"the :meth:`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " "and other methods that allow one to do things with an :class:`Enum` class " "that fail on a typical class, such as ``list(Color)`` or ``some_enum_var in " "Color``. :class:`EnumType` is responsible for ensuring that various other " -"methods on the final :class:`Enum` class are correct (such as :meth:`~object." -"__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` and :meth:" -"`~object.__repr__`)." +"methods on the final :class:`Enum` class are correct (such " +"as :meth:`~object.__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` " +"and :meth:`~object.__repr__`)." msgstr "" #: ../../howto/enum.rst:1228 @@ -2266,8 +2268,8 @@ msgstr "Flag 類別" msgid "" "Flags have an expanded view of aliasing: to be canonical, the value of a " "flag needs to be a power-of-two value, and not a duplicate name. So, in " -"addition to the :class:`Enum` definition of alias, a flag with no value (a.k." -"a. ``0``) or with more than one power-of-two value (e.g. ``3``) is " +"addition to the :class:`Enum` definition of alias, a flag with no value " +"(a.k.a. ``0``) or with more than one power-of-two value (e.g. ``3``) is " "considered an alias." msgstr "" @@ -2277,11 +2279,11 @@ msgstr "" #: ../../howto/enum.rst:1238 msgid "" -"The most interesting thing about enum members is that they are singletons. :" -"class:`EnumType` creates them all while it is creating the enum class " -"itself, and then puts a custom :meth:`~object.__new__` in place to ensure " -"that no new ones are ever instantiated by returning only the existing member " -"instances." +"The most interesting thing about enum members is that they are " +"singletons. :class:`EnumType` creates them all while it is creating the enum " +"class itself, and then puts a custom :meth:`~object.__new__` in place to " +"ensure that no new ones are ever instantiated by returning only the existing " +"member instances." msgstr "" #: ../../howto/enum.rst:1244 @@ -2340,10 +2342,11 @@ msgstr "" #: ../../howto/enum.rst:1273 msgid "" -"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :" -"class:`IntFlag` are expected to cover the majority of use-cases, they cannot " -"cover them all. Here are recipes for some different types of enumerations " -"that can be used directly, or as examples for creating one's own." +"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, " +"and :class:`IntFlag` are expected to cover the majority of use-cases, they " +"cannot cover them all. Here are recipes for some different types of " +"enumerations that can be used directly, or as examples for creating one's " +"own." msgstr "" #: ../../howto/enum.rst:1280 @@ -2435,8 +2438,8 @@ msgstr "" #: ../../howto/enum.rst:1323 msgid "" -"This is also a good example of why you might want to write your own :meth:" -"`~object.__repr__`::" +"This is also a good example of why you might want to write your " +"own :meth:`~object.__repr__`::" msgstr "" #: ../../howto/enum.rst:1326 @@ -2777,11 +2780,11 @@ msgid "" "... Period['day_%d' % i] = i\n" "...\n" ">>> list(Period)[:2]\n" -"[, ]\n" +"[, ]\n" ">>> list(Period)[-2:]\n" -"[, ]" +"[, ]" msgstr "" #: ../../howto/enum.rst:1558 diff --git a/howto/free-threading-extensions.po b/howto/free-threading-extensions.po index 42af41a8d97..3c0d6333244 100644 --- a/howto/free-threading-extensions.po +++ b/howto/free-threading-extensions.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-24 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,8 +22,8 @@ msgstr "支援自由執行緒的 C API 擴充" #: ../../howto/free-threading-extensions.rst:9 msgid "" -"Starting with the 3.13 release, CPython has experimental support for running " -"with the :term:`global interpreter lock` (GIL) disabled in a configuration " +"Starting with the 3.13 release, CPython has support for running with " +"the :term:`global interpreter lock` (GIL) disabled in a configuration " "called :term:`free threading`. This document describes how to adapt C API " "extensions to support free threading." msgstr "" @@ -79,10 +79,10 @@ msgstr "" #: ../../howto/free-threading-extensions.rst:48 msgid "" -"Extensions that use multi-phase initialization (i.e., :c:func:" -"`PyModuleDef_Init`) should add a :c:data:`Py_mod_gil` slot in the module " -"definition. If your extension supports older versions of CPython, you " -"should guard the slot with a :c:data:`PY_VERSION_HEX` check." +"Extensions that use multi-phase initialization " +"(i.e., :c:func:`PyModuleDef_Init`) should add a :c:data:`Py_mod_gil` slot in " +"the module definition. If your extension supports older versions of " +"CPython, you should guard the slot with a :c:data:`PY_VERSION_HEX` check." msgstr "" #: ../../howto/free-threading-extensions.rst:55 @@ -121,11 +121,12 @@ msgstr "單一階段初始化 (Single-Phase Initialization)" #: ../../howto/free-threading-extensions.rst:73 msgid "" -"Extensions that use single-phase initialization (i.e., :c:func:" -"`PyModule_Create`) should call :c:func:`PyUnstable_Module_SetGIL` to " -"indicate that they support running with the GIL disabled. The function is " -"only defined in the free-threaded build, so you should guard the call with " -"``#ifdef Py_GIL_DISABLED`` to avoid compilation errors in the regular build." +"Extensions that use single-phase initialization " +"(i.e., :c:func:`PyModule_Create`) should " +"call :c:func:`PyUnstable_Module_SetGIL` to indicate that they support " +"running with the GIL disabled. The function is only defined in the free-" +"threaded build, so you should guard the call with ``#ifdef Py_GIL_DISABLED`` " +"to avoid compilation errors in the regular build." msgstr "" #: ../../howto/free-threading-extensions.rst:81 @@ -182,12 +183,15 @@ msgstr "" #: ../../howto/free-threading-extensions.rst:107 msgid "" -"**Macros**: Accessor macros like :c:macro:`PyList_GET_ITEM` and :c:macro:" -"`PyList_SET_ITEM` do not perform any error checking or locking. These macros " -"are not thread-safe if the container object may be modified concurrently." +"**Macros**: Accessor macros " +"like :c:macro:`PyList_GET_ITEM`, :c:macro:`PyList_SET_ITEM`, and macros " +"like :c:macro:`PySequence_Fast_GET_SIZE` that use the object returned " +"by :c:func:`PySequence_Fast` do not perform any error checking or locking. " +"These macros are not thread-safe if the container object may be modified " +"concurrently." msgstr "" -#: ../../howto/free-threading-extensions.rst:111 +#: ../../howto/free-threading-extensions.rst:113 msgid "" "**Borrowed References**: C API functions that return :term:`borrowed " "references ` may not be thread-safe if the containing " @@ -195,23 +199,23 @@ msgid "" "references ` for more information." msgstr "" -#: ../../howto/free-threading-extensions.rst:118 +#: ../../howto/free-threading-extensions.rst:120 msgid "Container Thread Safety" msgstr "容器執行緒安全性" -#: ../../howto/free-threading-extensions.rst:120 +#: ../../howto/free-threading-extensions.rst:122 msgid "" -"Containers like :c:struct:`PyListObject`, :c:struct:`PyDictObject`, and :c:" -"struct:`PySetObject` perform internal locking in the free-threaded build. " -"For example, the :c:func:`PyList_Append` will lock the list before appending " -"an item." +"Containers like :c:struct:`PyListObject`, :c:struct:`PyDictObject`, " +"and :c:struct:`PySetObject` perform internal locking in the free-threaded " +"build. For example, the :c:func:`PyList_Append` will lock the list before " +"appending an item." msgstr "" -#: ../../howto/free-threading-extensions.rst:128 +#: ../../howto/free-threading-extensions.rst:130 msgid "``PyDict_Next``" msgstr "``PyDict_Next``" -#: ../../howto/free-threading-extensions.rst:130 +#: ../../howto/free-threading-extensions.rst:132 msgid "" "A notable exception is :c:func:`PyDict_Next`, which does not lock the " "dictionary. You should use :c:macro:`Py_BEGIN_CRITICAL_SECTION` to protect " @@ -219,7 +223,7 @@ msgid "" "modified::" msgstr "" -#: ../../howto/free-threading-extensions.rst:135 +#: ../../howto/free-threading-extensions.rst:137 msgid "" "Py_BEGIN_CRITICAL_SECTION(dict);\n" "PyObject *key, *value;\n" @@ -237,165 +241,177 @@ msgstr "" "}\n" "Py_END_CRITICAL_SECTION();" -#: ../../howto/free-threading-extensions.rst:145 +#: ../../howto/free-threading-extensions.rst:147 msgid "Borrowed References" msgstr "借用參照" -#: ../../howto/free-threading-extensions.rst:149 +#: ../../howto/free-threading-extensions.rst:151 msgid "" "Some C API functions return :term:`borrowed references `. These APIs are not thread-safe if the containing object is " -"modified concurrently. For example, it's not safe to use :c:func:" -"`PyList_GetItem` if the list may be modified concurrently." +"modified concurrently. For example, it's not safe to " +"use :c:func:`PyList_GetItem` if the list may be modified concurrently." msgstr "" -#: ../../howto/free-threading-extensions.rst:154 +#: ../../howto/free-threading-extensions.rst:156 msgid "" "The following table lists some borrowed reference APIs and their " "replacements that return :term:`strong references `." msgstr "" -#: ../../howto/free-threading-extensions.rst:158 +#: ../../howto/free-threading-extensions.rst:160 msgid "Borrowed reference API" msgstr "借用參照 API" -#: ../../howto/free-threading-extensions.rst:158 +#: ../../howto/free-threading-extensions.rst:160 msgid "Strong reference API" msgstr "強參照 API" -#: ../../howto/free-threading-extensions.rst:160 +#: ../../howto/free-threading-extensions.rst:162 msgid ":c:func:`PyList_GetItem`" msgstr ":c:func:`PyList_GetItem`" -#: ../../howto/free-threading-extensions.rst:160 #: ../../howto/free-threading-extensions.rst:162 +#: ../../howto/free-threading-extensions.rst:164 msgid ":c:func:`PyList_GetItemRef`" msgstr ":c:func:`PyList_GetItemRef`" -#: ../../howto/free-threading-extensions.rst:162 +#: ../../howto/free-threading-extensions.rst:164 msgid ":c:func:`PyList_GET_ITEM`" msgstr ":c:func:`PyList_GET_ITEM`" -#: ../../howto/free-threading-extensions.rst:164 +#: ../../howto/free-threading-extensions.rst:166 msgid ":c:func:`PyDict_GetItem`" msgstr ":c:func:`PyDict_GetItem`" -#: ../../howto/free-threading-extensions.rst:164 #: ../../howto/free-threading-extensions.rst:166 +#: ../../howto/free-threading-extensions.rst:168 msgid ":c:func:`PyDict_GetItemRef`" msgstr ":c:func:`PyDict_GetItemRef`" -#: ../../howto/free-threading-extensions.rst:166 +#: ../../howto/free-threading-extensions.rst:168 msgid ":c:func:`PyDict_GetItemWithError`" msgstr ":c:func:`PyDict_GetItemWithError`" -#: ../../howto/free-threading-extensions.rst:168 +#: ../../howto/free-threading-extensions.rst:170 msgid ":c:func:`PyDict_GetItemString`" msgstr ":c:func:`PyDict_GetItemString`" -#: ../../howto/free-threading-extensions.rst:168 +#: ../../howto/free-threading-extensions.rst:170 msgid ":c:func:`PyDict_GetItemStringRef`" msgstr ":c:func:`PyDict_GetItemStringRef`" -#: ../../howto/free-threading-extensions.rst:170 +#: ../../howto/free-threading-extensions.rst:172 msgid ":c:func:`PyDict_SetDefault`" msgstr ":c:func:`PyDict_SetDefault`" -#: ../../howto/free-threading-extensions.rst:170 +#: ../../howto/free-threading-extensions.rst:172 msgid ":c:func:`PyDict_SetDefaultRef`" msgstr ":c:func:`PyDict_SetDefaultRef`" -#: ../../howto/free-threading-extensions.rst:172 +#: ../../howto/free-threading-extensions.rst:174 msgid ":c:func:`PyDict_Next`" msgstr ":c:func:`PyDict_Next`" -#: ../../howto/free-threading-extensions.rst:172 +#: ../../howto/free-threading-extensions.rst:174 msgid "none (see :ref:`PyDict_Next`)" msgstr "" -#: ../../howto/free-threading-extensions.rst:174 +#: ../../howto/free-threading-extensions.rst:176 msgid ":c:func:`PyWeakref_GetObject`" msgstr ":c:func:`PyWeakref_GetObject`" -#: ../../howto/free-threading-extensions.rst:174 #: ../../howto/free-threading-extensions.rst:176 +#: ../../howto/free-threading-extensions.rst:178 msgid ":c:func:`PyWeakref_GetRef`" msgstr ":c:func:`PyWeakref_GetRef`" -#: ../../howto/free-threading-extensions.rst:176 +#: ../../howto/free-threading-extensions.rst:178 msgid ":c:func:`PyWeakref_GET_OBJECT`" msgstr ":c:func:`PyWeakref_GET_OBJECT`" -#: ../../howto/free-threading-extensions.rst:178 +#: ../../howto/free-threading-extensions.rst:180 msgid ":c:func:`PyImport_AddModule`" msgstr ":c:func:`PyImport_AddModule`" -#: ../../howto/free-threading-extensions.rst:178 +#: ../../howto/free-threading-extensions.rst:180 msgid ":c:func:`PyImport_AddModuleRef`" msgstr ":c:func:`PyImport_AddModuleRef`" -#: ../../howto/free-threading-extensions.rst:181 +#: ../../howto/free-threading-extensions.rst:182 +#, fuzzy +msgid ":c:func:`PyCell_GET`" +msgstr ":c:func:`PyList_GET_ITEM`" + +#: ../../howto/free-threading-extensions.rst:182 +#, fuzzy +msgid ":c:func:`PyCell_Get`" +msgstr ":c:func:`PyWeakref_GetRef`" + +#: ../../howto/free-threading-extensions.rst:185 msgid "" -"Not all APIs that return borrowed references are problematic. For example, :" -"c:func:`PyTuple_GetItem` is safe because tuples are immutable. Similarly, " -"not all uses of the above APIs are problematic. For example, :c:func:" -"`PyDict_GetItem` is often used for parsing keyword argument dictionaries in " -"function calls; those keyword argument dictionaries are effectively private " -"(not accessible by other threads), so using borrowed references in that " -"context is safe." +"Not all APIs that return borrowed references are problematic. For " +"example, :c:func:`PyTuple_GetItem` is safe because tuples are immutable. " +"Similarly, not all uses of the above APIs are problematic. For " +"example, :c:func:`PyDict_GetItem` is often used for parsing keyword argument " +"dictionaries in function calls; those keyword argument dictionaries are " +"effectively private (not accessible by other threads), so using borrowed " +"references in that context is safe." msgstr "" -#: ../../howto/free-threading-extensions.rst:189 +#: ../../howto/free-threading-extensions.rst:193 msgid "" "Some of these functions were added in Python 3.13. You can use the " "`pythoncapi-compat `_ package " "to provide implementations of these functions for older Python versions." msgstr "" -#: ../../howto/free-threading-extensions.rst:197 +#: ../../howto/free-threading-extensions.rst:201 msgid "Memory Allocation APIs" msgstr "" -#: ../../howto/free-threading-extensions.rst:199 +#: ../../howto/free-threading-extensions.rst:203 msgid "" -"Python's memory management C API provides functions in three different :ref:" -"`allocation domains `: \"raw\", \"mem\", and \"object\". " -"For thread-safety, the free-threaded build requires that only Python objects " -"are allocated using the object domain, and that all Python object are " -"allocated using that domain. This differs from the prior Python versions, " -"where this was only a best practice and not a hard requirement." +"Python's memory management C API provides functions in three " +"different :ref:`allocation domains `: \"raw\", \"mem\", " +"and \"object\". For thread-safety, the free-threaded build requires that " +"only Python objects are allocated using the object domain, and that all " +"Python object are allocated using that domain. This differs from the prior " +"Python versions, where this was only a best practice and not a hard " +"requirement." msgstr "" -#: ../../howto/free-threading-extensions.rst:208 +#: ../../howto/free-threading-extensions.rst:212 msgid "" "Search for uses of :c:func:`PyObject_Malloc` in your extension and check " -"that the allocated memory is used for Python objects. Use :c:func:" -"`PyMem_Malloc` to allocate buffers instead of :c:func:`PyObject_Malloc`." +"that the allocated memory is used for Python objects. " +"Use :c:func:`PyMem_Malloc` to allocate buffers instead " +"of :c:func:`PyObject_Malloc`." msgstr "" -#: ../../howto/free-threading-extensions.rst:215 +#: ../../howto/free-threading-extensions.rst:219 msgid "Thread State and GIL APIs" msgstr "" -#: ../../howto/free-threading-extensions.rst:217 +#: ../../howto/free-threading-extensions.rst:221 msgid "" "Python provides a set of functions and macros to manage thread state and the " "GIL, such as:" msgstr "" -#: ../../howto/free-threading-extensions.rst:220 +#: ../../howto/free-threading-extensions.rst:224 msgid ":c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`" msgstr ":c:func:`PyGILState_Ensure` 和 :c:func:`PyGILState_Release`" -#: ../../howto/free-threading-extensions.rst:221 +#: ../../howto/free-threading-extensions.rst:225 msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`" msgstr ":c:func:`PyEval_SaveThread` 和 :c:func:`PyEval_RestoreThread`" -#: ../../howto/free-threading-extensions.rst:222 +#: ../../howto/free-threading-extensions.rst:226 msgid ":c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS`" msgstr ":c:macro:`Py_BEGIN_ALLOW_THREADS` 和 :c:macro:`Py_END_ALLOW_THREADS`" -#: ../../howto/free-threading-extensions.rst:224 +#: ../../howto/free-threading-extensions.rst:228 msgid "" "These functions should still be used in the free-threaded build to manage " "thread state even when the :term:`GIL` is disabled. For example, if you " @@ -404,33 +420,33 @@ msgid "" "Python thread state." msgstr "" -#: ../../howto/free-threading-extensions.rst:230 +#: ../../howto/free-threading-extensions.rst:234 msgid "" -"You should continue to call :c:func:`PyEval_SaveThread` or :c:macro:" -"`Py_BEGIN_ALLOW_THREADS` around blocking operations, such as I/O or lock " -"acquisitions, to allow other threads to run the :term:`cyclic garbage " -"collector `." +"You should continue to call :c:func:`PyEval_SaveThread` " +"or :c:macro:`Py_BEGIN_ALLOW_THREADS` around blocking operations, such as I/O " +"or lock acquisitions, to allow other threads to run the :term:`cyclic " +"garbage collector `." msgstr "" -#: ../../howto/free-threading-extensions.rst:237 +#: ../../howto/free-threading-extensions.rst:241 msgid "Protecting Internal Extension State" msgstr "" -#: ../../howto/free-threading-extensions.rst:239 +#: ../../howto/free-threading-extensions.rst:243 msgid "" "Your extension may have internal state that was previously protected by the " "GIL. You may need to add locking to protect this state. The approach will " "depend on your extension, but some common patterns include:" msgstr "" -#: ../../howto/free-threading-extensions.rst:243 +#: ../../howto/free-threading-extensions.rst:247 msgid "" "**Caches**: global caches are a common source of shared state. Consider " "using a lock to protect the cache or disabling it in the free-threaded build " "if the cache is not critical for performance." msgstr "" -#: ../../howto/free-threading-extensions.rst:246 +#: ../../howto/free-threading-extensions.rst:250 msgid "" "**Global State**: global state may need to be protected by a lock or moved " "to thread local storage. C11 and C++11 provide the ``thread_local`` or " @@ -438,34 +454,246 @@ msgid "" "language/storage_duration>`_." msgstr "" -#: ../../howto/free-threading-extensions.rst:253 +#: ../../howto/free-threading-extensions.rst:257 +msgid "Critical Sections" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:261 +msgid "" +"In the free-threaded build, CPython provides a mechanism called \"critical " +"sections\" to protect data that would otherwise be protected by the GIL. " +"While extension authors may not interact with the internal critical section " +"implementation directly, understanding their behavior is crucial when using " +"certain C API functions or managing shared state in the free-threaded build." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:268 +msgid "What Are Critical Sections?" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:270 +msgid "" +"Conceptually, critical sections act as a deadlock avoidance layer built on " +"top of simple mutexes. Each thread maintains a stack of active critical " +"sections. When a thread needs to acquire a lock associated with a critical " +"section (e.g., implicitly when calling a thread-safe C API function " +"like :c:func:`PyDict_SetItem`, or explicitly using macros), it attempts to " +"acquire the underlying mutex." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:278 +msgid "Using Critical Sections" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:280 +msgid "The primary APIs for using critical sections are:" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:282 +msgid "" +":c:macro:`Py_BEGIN_CRITICAL_SECTION` and :c:macro:`Py_END_CRITICAL_SECTION` " +"- For locking a single object" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:285 +msgid "" +":c:macro:`Py_BEGIN_CRITICAL_SECTION2` " +"and :c:macro:`Py_END_CRITICAL_SECTION2` - For locking two objects " +"simultaneously" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:288 +msgid "" +"These macros must be used in matching pairs and must appear in the same C " +"scope, since they establish a new local scope. These macros are no-ops in " +"non-free-threaded builds, so they can be safely added to code that needs to " +"support both build types." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:293 +msgid "" +"A common use of a critical section would be to lock an object while " +"accessing an internal attribute of it. For example, if an extension type " +"has an internal count field, you could use a critical section while reading " +"or writing that field::" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:298 +msgid "" +"// read the count, returns new reference to internal count value\n" +"PyObject *result;\n" +"Py_BEGIN_CRITICAL_SECTION(obj);\n" +"result = Py_NewRef(obj->count);\n" +"Py_END_CRITICAL_SECTION();\n" +"return result;\n" +"\n" +"// write the count, consumes reference from new_count\n" +"Py_BEGIN_CRITICAL_SECTION(obj);\n" +"obj->count = new_count;\n" +"Py_END_CRITICAL_SECTION();" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:312 +msgid "How Critical Sections Work" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:314 +msgid "" +"Unlike traditional locks, critical sections do not guarantee exclusive " +"access throughout their entire duration. If a thread would block while " +"holding a critical section (e.g., by acquiring another lock or performing I/" +"O), the critical section is temporarily suspended—all locks are released—and " +"then resumed when the blocking operation completes." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:320 +msgid "" +"This behavior is similar to what happens with the GIL when a thread makes a " +"blocking call. The key differences are:" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:323 +msgid "Critical sections operate on a per-object basis rather than globally" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:325 +msgid "" +"Critical sections follow a stack discipline within each thread (the " +"\"begin\" and \"end\" macros enforce this since they must be paired and " +"within the same scope)" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:328 +msgid "" +"Critical sections automatically release and reacquire locks around potential " +"blocking operations" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:332 +msgid "Deadlock Avoidance" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:334 +msgid "Critical sections help avoid deadlocks in two ways:" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:336 +msgid "" +"If a thread tries to acquire a lock that's already held by another thread, " +"it first suspends all of its active critical sections, temporarily releasing " +"their locks" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:340 +msgid "" +"When the blocking operation completes, only the top-most critical section is " +"reacquired first" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:343 +msgid "" +"This means you cannot rely on nested critical sections to lock multiple " +"objects at once, as the inner critical section may suspend the outer ones. " +"Instead, use :c:macro:`Py_BEGIN_CRITICAL_SECTION2` to lock two objects " +"simultaneously." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:347 +msgid "" +"Note that the locks described above are only :c:type:`!PyMutex` based locks. " +"The critical section implementation does not know about or affect other " +"locking mechanisms that might be in use, like POSIX mutexes. Also note that " +"while blocking on any :c:type:`!PyMutex` causes the critical sections to be " +"suspended, only the mutexes that are part of the critical sections are " +"released. If :c:type:`!PyMutex` is used without a critical section, it will " +"not be released and therefore does not get the same deadlock avoidance." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:356 +msgid "Important Considerations" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:358 +msgid "" +"Critical sections may temporarily release their locks, allowing other " +"threads to modify the protected data. Be careful about making assumptions " +"about the state of the data after operations that might block." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:362 +msgid "" +"Because locks can be temporarily released (suspended), entering a critical " +"section does not guarantee exclusive access to the protected resource " +"throughout the section's duration. If code within a critical section calls " +"another function that blocks (e.g., acquires another lock, performs blocking " +"I/O), all locks held by the thread via critical sections will be released. " +"This is similar to how the GIL can be released during blocking calls." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:369 +msgid "" +"Only the lock(s) associated with the most recently entered (top-most) " +"critical section are guaranteed to be held at any given time. Locks for " +"outer, nested critical sections might have been suspended." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:373 +msgid "" +"You can lock at most two objects simultaneously with these APIs. If you need " +"to lock more objects, you'll need to restructure your code." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:376 +msgid "" +"While critical sections will not deadlock if you attempt to lock the same " +"object twice, they are less efficient than purpose-built reentrant locks for " +"this use case." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:380 +msgid "" +"When using :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, the order of the objects " +"doesn't affect correctness (the implementation handles deadlock avoidance), " +"but it's good practice to always lock objects in a consistent order." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:384 +msgid "" +"Remember that the critical section macros are primarily for protecting " +"access to *Python objects* that might be involved in internal CPython " +"operations susceptible to the deadlock scenarios described above. For " +"protecting purely internal extension state, standard mutexes or other " +"synchronization primitives might be more appropriate." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:392 msgid "Building Extensions for the Free-Threaded Build" msgstr "" -#: ../../howto/free-threading-extensions.rst:255 +#: ../../howto/free-threading-extensions.rst:394 msgid "" "C API extensions need to be built specifically for the free-threaded build. " "The wheels, shared libraries, and binaries are indicated by a ``t`` suffix." msgstr "" -#: ../../howto/free-threading-extensions.rst:258 +#: ../../howto/free-threading-extensions.rst:397 msgid "" "`pypa/manylinux `_ supports the free-" "threaded build, with the ``t`` suffix, such as ``python3.13t``." msgstr "" -#: ../../howto/free-threading-extensions.rst:260 +#: ../../howto/free-threading-extensions.rst:399 msgid "" "`pypa/cibuildwheel `_ supports the " "free-threaded build if you set `CIBW_ENABLE to cpython-freethreading " "`_." msgstr "" -#: ../../howto/free-threading-extensions.rst:265 +#: ../../howto/free-threading-extensions.rst:404 msgid "Limited C API and Stable ABI" msgstr "" -#: ../../howto/free-threading-extensions.rst:267 +#: ../../howto/free-threading-extensions.rst:406 msgid "" "The free-threaded build does not currently support the :ref:`Limited C API " "` or the stable ABI. If you use `setuptools `_: A community-maintained porting guide for " diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po index ada1b6f51fb..e6b91d1f28f 100644 --- a/howto/free-threading-python.po +++ b/howto/free-threading-python.po @@ -7,7 +7,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-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -18,76 +18,80 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../howto/free-threading-python.rst:5 -msgid "Python experimental support for free threading" +#, fuzzy +msgid "Python support for free threading" msgstr "Python 自由執行緒的實驗性支援" #: ../../howto/free-threading-python.rst:7 msgid "" -"Starting with the 3.13 release, CPython has experimental support for a build " -"of Python called :term:`free threading` where the :term:`global interpreter " -"lock` (GIL) is disabled. Free-threaded execution allows for full " -"utilization of the available processing power by running threads in parallel " -"on available CPU cores. While not all software will benefit from this " -"automatically, programs designed with threading in mind will run faster on " -"multi-core hardware." +"Starting with the 3.13 release, CPython has support for a build of Python " +"called :term:`free threading` where the :term:`global interpreter lock` " +"(GIL) is disabled. Free-threaded execution allows for full utilization of " +"the available processing power by running threads in parallel on available " +"CPU cores. While not all software will benefit from this automatically, " +"programs designed with threading in mind will run faster on multi-core " +"hardware." msgstr "" #: ../../howto/free-threading-python.rst:14 msgid "" -"**The free-threaded mode is experimental** and work is ongoing to improve " -"it: expect some bugs and a substantial single-threaded performance hit." +"The free-threaded mode is working and continues to be improved, but there is " +"some additional overhead in single-threaded workloads compared to the " +"regular build. Additionally, third-party packages, in particular ones with " +"an :term:`extension module`, may not be ready for use in a free-threaded " +"build, and will re-enable the :term:`GIL`." msgstr "" -#: ../../howto/free-threading-python.rst:17 +#: ../../howto/free-threading-python.rst:20 msgid "" "This document describes the implications of free threading for Python code. " "See :ref:`freethreading-extensions-howto` for information on how to write C " "extensions that support the free-threaded build." msgstr "" -#: ../../howto/free-threading-python.rst:23 +#: ../../howto/free-threading-python.rst:26 msgid "" ":pep:`703` – Making the Global Interpreter Lock Optional in CPython for an " "overall description of free-threaded Python." msgstr "" -#: ../../howto/free-threading-python.rst:28 +#: ../../howto/free-threading-python.rst:31 msgid "Installation" msgstr "安裝" -#: ../../howto/free-threading-python.rst:30 +#: ../../howto/free-threading-python.rst:33 msgid "" "Starting with Python 3.13, the official macOS and Windows installers " "optionally support installing free-threaded Python binaries. The installers " "are available at https://www.python.org/downloads/." msgstr "" -#: ../../howto/free-threading-python.rst:34 +#: ../../howto/free-threading-python.rst:37 msgid "" "For information on other platforms, see the `Installing a Free-Threaded " "Python `_, a " "community-maintained installation guide for installing free-threaded Python." msgstr "" -#: ../../howto/free-threading-python.rst:38 +#: ../../howto/free-threading-python.rst:41 msgid "" "When building CPython from source, the :option:`--disable-gil` configure " "option should be used to build a free-threaded Python interpreter." msgstr "" -#: ../../howto/free-threading-python.rst:43 +#: ../../howto/free-threading-python.rst:46 msgid "Identifying free-threaded Python" msgstr "" -#: ../../howto/free-threading-python.rst:45 +#: ../../howto/free-threading-python.rst:48 msgid "" "To check if the current interpreter supports free-threading, :option:`python " -"-VV <-V>` and :data:`sys.version` contain \"experimental free-threading " -"build\". The new :func:`sys._is_gil_enabled` function can be used to check " -"whether the GIL is actually disabled in the running process." +"-VV <-V>` and :data:`sys.version` contain \"free-threading build\". The " +"new :func:`sys._is_gil_enabled` function can be used to check whether the " +"GIL is actually disabled in the running process." msgstr "" -#: ../../howto/free-threading-python.rst:50 +#: ../../howto/free-threading-python.rst:53 msgid "" "The ``sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` configuration variable " "can be used to determine whether the build supports free threading. If the " @@ -95,43 +99,43 @@ msgid "" "the recommended mechanism for decisions related to the build configuration." msgstr "" -#: ../../howto/free-threading-python.rst:57 +#: ../../howto/free-threading-python.rst:60 msgid "The global interpreter lock in free-threaded Python" msgstr "" -#: ../../howto/free-threading-python.rst:59 +#: ../../howto/free-threading-python.rst:62 msgid "" "Free-threaded builds of CPython support optionally running with the GIL " "enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or " "the command-line option :option:`-X gil`." msgstr "" -#: ../../howto/free-threading-python.rst:63 +#: ../../howto/free-threading-python.rst:66 msgid "" "The GIL may also automatically be enabled when importing a C-API extension " "module that is not explicitly marked as supporting free threading. A " "warning will be printed in this case." msgstr "" -#: ../../howto/free-threading-python.rst:67 +#: ../../howto/free-threading-python.rst:70 msgid "" "In addition to individual package documentation, the following websites " "track the status of popular packages support for free threading:" msgstr "" -#: ../../howto/free-threading-python.rst:70 +#: ../../howto/free-threading-python.rst:73 msgid "https://py-free-threading.github.io/tracking/" msgstr "https://py-free-threading.github.io/tracking/" -#: ../../howto/free-threading-python.rst:71 +#: ../../howto/free-threading-python.rst:74 msgid "https://hugovk.github.io/free-threaded-wheels/" msgstr "https://hugovk.github.io/free-threaded-wheels/" -#: ../../howto/free-threading-python.rst:75 +#: ../../howto/free-threading-python.rst:78 msgid "Thread safety" msgstr "執行緒安全" -#: ../../howto/free-threading-python.rst:77 +#: ../../howto/free-threading-python.rst:80 msgid "" "The free-threaded build of CPython aims to provide similar thread-safety " "behavior at the Python level to the default GIL-enabled build. Built-in " @@ -143,106 +147,106 @@ msgid "" "current or future behavior." msgstr "" -#: ../../howto/free-threading-python.rst:88 +#: ../../howto/free-threading-python.rst:91 msgid "" "It's recommended to use the :class:`threading.Lock` or other synchronization " "primitives instead of relying on the internal locks of built-in types, when " "possible." msgstr "" -#: ../../howto/free-threading-python.rst:94 +#: ../../howto/free-threading-python.rst:97 msgid "Known limitations" msgstr "已知限制" -#: ../../howto/free-threading-python.rst:96 +#: ../../howto/free-threading-python.rst:99 msgid "" "This section describes known limitations of the free-threaded CPython build." msgstr "" -#: ../../howto/free-threading-python.rst:99 +#: ../../howto/free-threading-python.rst:102 msgid "Immortalization" msgstr "不滅化 (Immortalization)" -#: ../../howto/free-threading-python.rst:101 +#: ../../howto/free-threading-python.rst:104 msgid "" -"The free-threaded build of the 3.13 release makes some objects :term:" -"`immortal`. Immortal objects are not deallocated and have reference counts " -"that are never modified. This is done to avoid reference count contention " -"that would prevent efficient multi-threaded scaling." +"The free-threaded build of the 3.13 release makes some " +"objects :term:`immortal`. Immortal objects are not deallocated and have " +"reference counts that are never modified. This is done to avoid reference " +"count contention that would prevent efficient multi-threaded scaling." msgstr "" -#: ../../howto/free-threading-python.rst:106 +#: ../../howto/free-threading-python.rst:109 msgid "" "An object will be made immortal when a new thread is started for the first " "time after the main thread is running. The following objects are " "immortalized:" msgstr "" -#: ../../howto/free-threading-python.rst:109 +#: ../../howto/free-threading-python.rst:112 msgid "" ":ref:`function ` objects declared at the module level" msgstr "在模組層級宣告的\\ :ref:`函式 `\\ 物件" -#: ../../howto/free-threading-python.rst:110 +#: ../../howto/free-threading-python.rst:113 msgid ":ref:`method ` descriptors" msgstr ":ref:`方法 `\\ 描述器" -#: ../../howto/free-threading-python.rst:111 +#: ../../howto/free-threading-python.rst:114 msgid ":ref:`code ` objects" msgstr ":ref:`程式碼 `\\ 物件" -#: ../../howto/free-threading-python.rst:112 +#: ../../howto/free-threading-python.rst:115 msgid ":term:`module` objects and their dictionaries" msgstr ":term:`模組 `\\ 物件及其字典" -#: ../../howto/free-threading-python.rst:113 +#: ../../howto/free-threading-python.rst:116 msgid ":ref:`classes ` (type objects)" msgstr ":ref:`類別 `\\ (型別物件)" -#: ../../howto/free-threading-python.rst:115 +#: ../../howto/free-threading-python.rst:118 msgid "" "Because immortal objects are never deallocated, applications that create " "many objects of these types may see increased memory usage. This is " "expected to be addressed in the 3.14 release." msgstr "" -#: ../../howto/free-threading-python.rst:119 +#: ../../howto/free-threading-python.rst:122 msgid "" "Additionally, numeric and string literals in the code as well as strings " "returned by :func:`sys.intern` are also immortalized. This behavior is " "expected to remain in the 3.14 free-threaded build." msgstr "" -#: ../../howto/free-threading-python.rst:125 +#: ../../howto/free-threading-python.rst:128 msgid "Frame objects" msgstr "" -#: ../../howto/free-threading-python.rst:127 +#: ../../howto/free-threading-python.rst:130 msgid "" "It is not safe to access :ref:`frame ` objects from other " -"threads and doing so may cause your program to crash . This means that :" -"func:`sys._current_frames` is generally not safe to use in a free-threaded " -"build. Functions like :func:`inspect.currentframe` and :func:`sys." -"_getframe` are generally safe as long as the resulting frame object is not " -"passed to another thread." +"threads and doing so may cause your program to crash . This means " +"that :func:`sys._current_frames` is generally not safe to use in a free-" +"threaded build. Functions like :func:`inspect.currentframe` " +"and :func:`sys._getframe` are generally safe as long as the resulting frame " +"object is not passed to another thread." msgstr "" -#: ../../howto/free-threading-python.rst:135 +#: ../../howto/free-threading-python.rst:138 msgid "Iterators" msgstr "疊代器" -#: ../../howto/free-threading-python.rst:137 +#: ../../howto/free-threading-python.rst:140 msgid "" "Sharing the same iterator object between multiple threads is generally not " "safe and threads may see duplicate or missing elements when iterating or " "crash the interpreter." msgstr "" -#: ../../howto/free-threading-python.rst:143 +#: ../../howto/free-threading-python.rst:146 msgid "Single-threaded performance" msgstr "單執行緒效能" -#: ../../howto/free-threading-python.rst:145 +#: ../../howto/free-threading-python.rst:148 msgid "" "The free-threaded build has additional overhead when executing Python code " "compared to the default GIL-enabled build. In 3.13, this overhead is about " @@ -255,3 +259,43 @@ msgid "" "overhead of 10% or less on the pyperformance suite compared to the default " "GIL-enabled build." msgstr "" + +#: ../../howto/free-threading-python.rst:161 +msgid "Behavioral changes" +msgstr "" + +#: ../../howto/free-threading-python.rst:163 +msgid "" +"This section describes CPython behavioural changes with the free-threaded " +"build." +msgstr "" + +#: ../../howto/free-threading-python.rst:168 +msgid "Context variables" +msgstr "" + +#: ../../howto/free-threading-python.rst:170 +msgid "" +"In the free-threaded build, the " +"flag :data:`~sys.flags.thread_inherit_context` is set to true by default " +"which causes threads created with :class:`threading.Thread` to start with a " +"copy of the :class:`~contextvars.Context()` of the caller " +"of :meth:`~threading.Thread.start`. In the default GIL-enabled build, the " +"flag defaults to false so threads start with an " +"empty :class:`~contextvars.Context()`." +msgstr "" + +#: ../../howto/free-threading-python.rst:180 +msgid "Warning filters" +msgstr "" + +#: ../../howto/free-threading-python.rst:182 +msgid "" +"In the free-threaded build, the " +"flag :data:`~sys.flags.context_aware_warnings` is set to true by default. " +"In the default GIL-enabled build, the flag defaults to false. If the flag " +"is true then the :class:`warnings.catch_warnings` context manager uses a " +"context variable for warning filters. If the flag is false " +"then :class:`~warnings.catch_warnings` modifies the global filters list, " +"which is not thread-safe. See the :mod:`warnings` module for more details." +msgstr "" diff --git a/howto/index.po b/howto/index.po index 1405805e943..7dd04cc3afb 100644 --- a/howto/index.po +++ b/howto/index.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-10 00:19+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2021-07-05 12:45+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,110 +34,115 @@ msgstr "" "定的主題。以 Linux 說明文件專案的 HOWTO 系列為模範,本系列的目標是提供比 " "Python 函式庫參考手冊更實用的說明文件。" -#: ../../howto/index.rst:41 +#: ../../howto/index.rst:42 msgid "General:" msgstr "一般:" -#: ../../howto/index.rst:43 +#: ../../howto/index.rst:44 msgid ":ref:`a-conceptual-overview-of-asyncio`" msgstr ":ref:`a-conceptual-overview-of-asyncio`" -#: ../../howto/index.rst:44 +#: ../../howto/index.rst:45 msgid ":ref:`annotations-howto`" msgstr ":ref:`annotations-howto`" -#: ../../howto/index.rst:45 +#: ../../howto/index.rst:46 msgid ":ref:`argparse-tutorial`" msgstr ":ref:`argparse-tutorial`" -#: ../../howto/index.rst:46 +#: ../../howto/index.rst:47 msgid ":ref:`descriptorhowto`" msgstr ":ref:`descriptorhowto`" -#: ../../howto/index.rst:47 +#: ../../howto/index.rst:48 msgid ":ref:`enum-howto`" msgstr ":ref:`enum-howto`" -#: ../../howto/index.rst:48 +#: ../../howto/index.rst:49 msgid ":ref:`functional-howto`" msgstr ":ref:`functional-howto`" -#: ../../howto/index.rst:49 +#: ../../howto/index.rst:50 msgid ":ref:`ipaddress-howto`" msgstr ":ref:`ipaddress-howto`" -#: ../../howto/index.rst:50 +#: ../../howto/index.rst:51 msgid ":ref:`logging-howto`" msgstr ":ref:`logging-howto`" -#: ../../howto/index.rst:51 +#: ../../howto/index.rst:52 msgid ":ref:`logging-cookbook`" msgstr ":ref:`logging-cookbook`" -#: ../../howto/index.rst:52 +#: ../../howto/index.rst:53 msgid ":ref:`regex-howto`" msgstr ":ref:`regex-howto`" -#: ../../howto/index.rst:53 +#: ../../howto/index.rst:54 msgid ":ref:`sortinghowto`" msgstr ":ref:`sortinghowto`" -#: ../../howto/index.rst:54 +#: ../../howto/index.rst:55 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../howto/index.rst:55 +#: ../../howto/index.rst:56 msgid ":ref:`urllib-howto`" msgstr ":ref:`urllib-howto`" -#: ../../howto/index.rst:57 +#: ../../howto/index.rst:58 msgid "Advanced development:" msgstr "進階開發:" -#: ../../howto/index.rst:59 +#: ../../howto/index.rst:60 msgid ":ref:`curses-howto`" msgstr ":ref:`curses-howto`" -#: ../../howto/index.rst:60 +#: ../../howto/index.rst:61 msgid ":ref:`freethreading-python-howto`" msgstr ":ref:`freethreading-python-howto`" -#: ../../howto/index.rst:61 +#: ../../howto/index.rst:62 msgid ":ref:`freethreading-extensions-howto`" msgstr ":ref:`freethreading-extensions-howto`" -#: ../../howto/index.rst:62 +#: ../../howto/index.rst:63 msgid ":ref:`isolating-extensions-howto`" msgstr ":ref:`isolating-extensions-howto`" -#: ../../howto/index.rst:63 +#: ../../howto/index.rst:64 msgid ":ref:`python_2.3_mro`" msgstr ":ref:`python_2.3_mro`" -#: ../../howto/index.rst:64 +#: ../../howto/index.rst:65 msgid ":ref:`socket-howto`" msgstr ":ref:`socket-howto`" -#: ../../howto/index.rst:65 +#: ../../howto/index.rst:66 msgid ":ref:`timerfd-howto`" msgstr ":ref:`timerfd-howto`" -#: ../../howto/index.rst:66 +#: ../../howto/index.rst:67 msgid ":ref:`cporting-howto`" msgstr ":ref:`cporting-howto`" -#: ../../howto/index.rst:68 +#: ../../howto/index.rst:69 msgid "Debugging and profiling:" msgstr "偵錯與效能分析:" -#: ../../howto/index.rst:70 +#: ../../howto/index.rst:71 msgid ":ref:`gdb`" msgstr ":ref:`gdb`" -#: ../../howto/index.rst:71 +#: ../../howto/index.rst:72 msgid ":ref:`instrumentation`" msgstr ":ref:`instrumentation`" -#: ../../howto/index.rst:72 +#: ../../howto/index.rst:73 msgid ":ref:`perf_profiling`" msgstr ":ref:`perf_profiling`" + +#: ../../howto/index.rst:74 +#, fuzzy +msgid ":ref:`remote-debugging`" +msgstr ":ref:`logging-howto`" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index d4055b489d2..1b408fc9f1c 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -7,7 +7,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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -68,8 +68,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " -"%(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "fh.setFormatter(formatter)\n" "ch.setFormatter(formatter)\n" "# add the handlers to the logger\n" @@ -100,8 +100,8 @@ msgid "" "\n" "class Auxiliary:\n" " def __init__(self):\n" -" self.logger = logging.getLogger('spam_application.auxiliary." -"Auxiliary')\n" +" self.logger = " +"logging.getLogger('spam_application.auxiliary.Auxiliary')\n" " self.logger.info('creating an instance of Auxiliary')\n" "\n" " def do_something(self):\n" @@ -163,8 +163,8 @@ msgid "" " time.sleep(0.5)\n" "\n" "def main():\n" -" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d " -"%(threadName)s %(message)s')\n" +" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d %" +"(threadName)s %(message)s')\n" " info = {'stop': False}\n" " thread = threading.Thread(target=worker, args=(info,))\n" " thread.start()\n" @@ -241,8 +241,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " -"%(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "ch.setFormatter(formatter)\n" "fh.setFormatter(formatter)\n" "# add the handlers to logger\n" @@ -295,8 +295,8 @@ msgid "" "\n" "# set up logging to file - see previous section for more details\n" "logging.basicConfig(level=logging.DEBUG,\n" -" format='%(asctime)s %(name)-12s %(levelname)-8s " -"%(message)s',\n" +" format='%(asctime)s %(name)-12s %(levelname)-8s %" +"(message)s',\n" " datefmt='%m-%d %H:%M',\n" " filename='/tmp/myapp.log',\n" " filemode='w')\n" @@ -504,9 +504,9 @@ msgid "" "a function which only returns ``True`` if the level of the passed in record " "is at or below the specified level. Note that in this example I have defined " "the ``filter_maker`` in a test script ``main.py`` that I run from the " -"command line, so its module will be ``__main__`` - hence the ``__main__." -"filter_maker`` in the filter configuration. You will need to change that if " -"you define it in a different module." +"command line, so its module will be ``__main__`` - hence the " +"``__main__.filter_maker`` in the filter configuration. You will need to " +"change that if you define it in a different module." msgstr "" #: ../../howto/logging-cookbook.rst:387 @@ -713,13 +713,13 @@ msgstr "" #: ../../howto/logging-cookbook.rst:555 msgid "" -"A common culprit which demonstrates sluggish behaviour is the :class:" -"`SMTPHandler`: sending emails can take a long time, for a number of reasons " -"outside the developer's control (for example, a poorly performing mail or " -"network infrastructure). But almost any network-based handler can block: " -"Even a :class:`SocketHandler` operation may do a DNS query under the hood " -"which is too slow (and this query can be deep in the socket library code, " -"below the Python layer, and outside your control)." +"A common culprit which demonstrates sluggish behaviour is " +"the :class:`SMTPHandler`: sending emails can take a long time, for a number " +"of reasons outside the developer's control (for example, a poorly performing " +"mail or network infrastructure). But almost any network-based handler can " +"block: Even a :class:`SocketHandler` operation may do a DNS query under the " +"hood which is too slow (and this query can be deep in the socket library " +"code, below the Python layer, and outside your control)." msgstr "" #: ../../howto/logging-cookbook.rst:563 @@ -739,12 +739,12 @@ msgstr "" #: ../../howto/logging-cookbook.rst:574 msgid "" "The second part of the solution is :class:`QueueListener`, which has been " -"designed as the counterpart to :class:`QueueHandler`. A :class:" -"`QueueListener` is very simple: it's passed a queue and some handlers, and " -"it fires up an internal thread which listens to its queue for LogRecords " -"sent from ``QueueHandlers`` (or any other source of ``LogRecords``, for that " -"matter). The ``LogRecords`` are removed from the queue and passed to the " -"handlers for processing." +"designed as the counterpart to :class:`QueueHandler`. " +"A :class:`QueueListener` is very simple: it's passed a queue and some " +"handlers, and it fires up an internal thread which listens to its queue for " +"LogRecords sent from ``QueueHandlers`` (or any other source of " +"``LogRecords``, for that matter). The ``LogRecords`` are removed from the " +"queue and passed to the handlers for processing." msgstr "" #: ../../howto/logging-cookbook.rst:582 @@ -792,10 +792,10 @@ msgid "" "Although the earlier discussion wasn't specifically talking about async " "code, but rather about slow logging handlers, it should be noted that when " "logging from async code, network and even file handlers could lead to " -"problems (blocking the event loop) because some logging is done from :mod:" -"`asyncio` internals. It might be best, if any async code is used in an " -"application, to use the above approach for logging, so that any blocking " -"code runs only in the ``QueueListener`` thread." +"problems (blocking the event loop) because some logging is done " +"from :mod:`asyncio` internals. It might be best, if any async code is used " +"in an application, to use the above approach for logging, so that any " +"blocking code runs only in the ``QueueListener`` thread." msgstr "" #: ../../howto/logging-cookbook.rst:619 @@ -810,18 +810,34 @@ msgid "" "handler if it's appropriate to do so." msgstr "" -#: ../../howto/logging-cookbook.rst:632 +#: ../../howto/logging-cookbook.rst:629 +msgid "" +"The :class:`QueueListener` can be started (and stopped) via " +"the :keyword:`with` statement. For example:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:633 +msgid "" +"with QueueListener(que, handler) as listener:\n" +" # The queue listener automatically starts\n" +" # when the 'with' block is entered.\n" +" pass\n" +"# The queue listener automatically stops once\n" +"# the 'with' block is exited." +msgstr "" + +#: ../../howto/logging-cookbook.rst:645 msgid "Sending and receiving logging events across a network" msgstr "" -#: ../../howto/logging-cookbook.rst:634 +#: ../../howto/logging-cookbook.rst:647 msgid "" "Let's say you want to send logging events across a network, and handle them " -"at the receiving end. A simple way of doing this is attaching a :class:" -"`SocketHandler` instance to the root logger at the sending end::" +"at the receiving end. A simple way of doing this is attaching " +"a :class:`SocketHandler` instance to the root logger at the sending end::" msgstr "" -#: ../../howto/logging-cookbook.rst:638 +#: ../../howto/logging-cookbook.rst:651 msgid "" "import logging, logging.handlers\n" "\n" @@ -849,13 +865,13 @@ msgid "" "logger2.error('The five boxing wizards jump quickly.')" msgstr "" -#: ../../howto/logging-cookbook.rst:662 +#: ../../howto/logging-cookbook.rst:675 msgid "" -"At the receiving end, you can set up a receiver using the :mod:" -"`socketserver` module. Here is a basic working example::" +"At the receiving end, you can set up a receiver using " +"the :mod:`socketserver` module. Here is a basic working example::" msgstr "" -#: ../../howto/logging-cookbook.rst:665 +#: ../../howto/logging-cookbook.rst:678 msgid "" "import pickle\n" "import logging\n" @@ -936,8 +952,8 @@ msgid "" "\n" "def main():\n" " logging.basicConfig(\n" -" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s " -"%(message)s')\n" +" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s %" +"(message)s')\n" " tcpserver = LogRecordSocketReceiver()\n" " print('About to start TCP server...')\n" " tcpserver.serve_until_stopped()\n" @@ -946,13 +962,13 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:750 +#: ../../howto/logging-cookbook.rst:763 msgid "" "First run the server, and then the client. On the client side, nothing is " "printed on the console; on the server side, you should see something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:753 +#: ../../howto/logging-cookbook.rst:766 msgid "" "About to start TCP server...\n" " 59 root INFO Jackdaws love my big sphinx of quartz.\n" @@ -962,7 +978,7 @@ msgid "" " 69 myapp.area2 ERROR The five boxing wizards jump quickly." msgstr "" -#: ../../howto/logging-cookbook.rst:762 +#: ../../howto/logging-cookbook.rst:775 msgid "" "Note that there are some security issues with pickle in some scenarios. If " "these affect you, you can use an alternative serialization scheme by " @@ -971,11 +987,11 @@ msgid "" "alternative serialization." msgstr "" -#: ../../howto/logging-cookbook.rst:770 +#: ../../howto/logging-cookbook.rst:783 msgid "Running a logging socket listener in production" msgstr "" -#: ../../howto/logging-cookbook.rst:774 +#: ../../howto/logging-cookbook.rst:787 msgid "" "To run a logging listener in production, you may need to use a process-" "management tool such as `Supervisor `_. `Here is a " @@ -983,79 +999,79 @@ msgid "" "the above functionality using Supervisor. It consists of the following files:" msgstr "" -#: ../../howto/logging-cookbook.rst:781 +#: ../../howto/logging-cookbook.rst:794 msgid "File" msgstr "檔案" -#: ../../howto/logging-cookbook.rst:781 +#: ../../howto/logging-cookbook.rst:794 msgid "Purpose" msgstr "目的" -#: ../../howto/logging-cookbook.rst:783 +#: ../../howto/logging-cookbook.rst:796 msgid ":file:`prepare.sh`" msgstr ":file:`prepare.sh`" -#: ../../howto/logging-cookbook.rst:783 +#: ../../howto/logging-cookbook.rst:796 msgid "A Bash script to prepare the environment for testing" msgstr "" -#: ../../howto/logging-cookbook.rst:786 +#: ../../howto/logging-cookbook.rst:799 msgid ":file:`supervisor.conf`" msgstr ":file:`supervisor.conf`" -#: ../../howto/logging-cookbook.rst:786 +#: ../../howto/logging-cookbook.rst:799 msgid "" "The Supervisor configuration file, which has entries for the listener and a " "multi-process web application" msgstr "" -#: ../../howto/logging-cookbook.rst:790 +#: ../../howto/logging-cookbook.rst:803 msgid ":file:`ensure_app.sh`" msgstr ":file:`ensure_app.sh`" -#: ../../howto/logging-cookbook.rst:790 +#: ../../howto/logging-cookbook.rst:803 msgid "" "A Bash script to ensure that Supervisor is running with the above " "configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:793 +#: ../../howto/logging-cookbook.rst:806 msgid ":file:`log_listener.py`" msgstr ":file:`log_listener.py`" -#: ../../howto/logging-cookbook.rst:793 +#: ../../howto/logging-cookbook.rst:806 msgid "" "The socket listener program which receives log events and records them to a " "file" msgstr "" -#: ../../howto/logging-cookbook.rst:796 +#: ../../howto/logging-cookbook.rst:809 msgid ":file:`main.py`" msgstr ":file:`main.py`" -#: ../../howto/logging-cookbook.rst:796 +#: ../../howto/logging-cookbook.rst:809 msgid "" "A simple web application which performs logging via a socket connected to " "the listener" msgstr "" -#: ../../howto/logging-cookbook.rst:799 +#: ../../howto/logging-cookbook.rst:812 msgid ":file:`webapp.json`" msgstr ":file:`webapp.json`" -#: ../../howto/logging-cookbook.rst:799 +#: ../../howto/logging-cookbook.rst:812 msgid "A JSON configuration file for the web application" msgstr "" -#: ../../howto/logging-cookbook.rst:801 +#: ../../howto/logging-cookbook.rst:814 msgid ":file:`client.py`" msgstr ":file:`client.py`" -#: ../../howto/logging-cookbook.rst:801 +#: ../../howto/logging-cookbook.rst:814 msgid "A Python script to exercise the web application" msgstr "" -#: ../../howto/logging-cookbook.rst:804 +#: ../../howto/logging-cookbook.rst:817 msgid "" "The web application uses `Gunicorn `_, which is a " "popular web application server that starts multiple worker processes to " @@ -1064,21 +1080,21 @@ msgid "" "the socket listener." msgstr "" -#: ../../howto/logging-cookbook.rst:809 +#: ../../howto/logging-cookbook.rst:822 msgid "To test these files, do the following in a POSIX environment:" msgstr "" -#: ../../howto/logging-cookbook.rst:811 +#: ../../howto/logging-cookbook.rst:824 msgid "" -"Download `the Gist `__ as a ZIP archive using the :" -"guilabel:`Download ZIP` button." +"Download `the Gist `__ as a ZIP archive using " +"the :guilabel:`Download ZIP` button." msgstr "" -#: ../../howto/logging-cookbook.rst:814 +#: ../../howto/logging-cookbook.rst:827 msgid "Unzip the above files from the archive into a scratch directory." msgstr "" -#: ../../howto/logging-cookbook.rst:816 +#: ../../howto/logging-cookbook.rst:829 msgid "" "In the scratch directory, run ``bash prepare.sh`` to get things ready. This " "creates a :file:`run` subdirectory to contain Supervisor-related and log " @@ -1086,19 +1102,19 @@ msgid "" "which ``bottle``, ``gunicorn`` and ``supervisor`` are installed." msgstr "" -#: ../../howto/logging-cookbook.rst:821 +#: ../../howto/logging-cookbook.rst:834 msgid "" "Run ``bash ensure_app.sh`` to ensure that Supervisor is running with the " "above configuration." msgstr "" -#: ../../howto/logging-cookbook.rst:824 +#: ../../howto/logging-cookbook.rst:837 msgid "" "Run ``venv/bin/python client.py`` to exercise the web application, which " "will lead to records being written to the log." msgstr "" -#: ../../howto/logging-cookbook.rst:827 +#: ../../howto/logging-cookbook.rst:840 msgid "" "Inspect the log files in the :file:`run` subdirectory. You should see the " "most recent log lines in files matching the pattern :file:`app.log*`. They " @@ -1106,25 +1122,25 @@ msgid "" "by different worker processes in a non-deterministic way." msgstr "" -#: ../../howto/logging-cookbook.rst:832 +#: ../../howto/logging-cookbook.rst:845 msgid "" "You can shut down the listener and the web application by running ``venv/bin/" "supervisorctl -c supervisor.conf shutdown``." msgstr "" -#: ../../howto/logging-cookbook.rst:835 +#: ../../howto/logging-cookbook.rst:848 msgid "" "You may need to tweak the configuration files in the unlikely event that the " "configured ports clash with something else in your test environment." msgstr "" -#: ../../howto/logging-cookbook.rst:838 +#: ../../howto/logging-cookbook.rst:851 msgid "" "The default configuration uses a TCP socket on port 9020. You can use a Unix " "Domain socket instead of a TCP socket by doing the following:" msgstr "" -#: ../../howto/logging-cookbook.rst:841 +#: ../../howto/logging-cookbook.rst:854 msgid "" "In :file:`listener.json`, add a ``socket`` key with the path to the domain " "socket you want to use. If this key is present, the listener listens on the " @@ -1132,18 +1148,18 @@ msgid "" "ignored)." msgstr "" -#: ../../howto/logging-cookbook.rst:846 +#: ../../howto/logging-cookbook.rst:859 msgid "" "In :file:`webapp.json`, change the socket handler configuration dictionary " "so that the ``host`` value is the path to the domain socket, and set the " "``port`` value to ``null``." msgstr "" -#: ../../howto/logging-cookbook.rst:856 +#: ../../howto/logging-cookbook.rst:869 msgid "Adding contextual information to your logging output" msgstr "" -#: ../../howto/logging-cookbook.rst:858 +#: ../../howto/logging-cookbook.rst:871 msgid "" "Sometimes you want logging output to contain contextual information in " "addition to the parameters passed to the logging call. For example, in a " @@ -1155,37 +1171,37 @@ msgid "" "is not a good idea because these instances are not garbage collected. While " "this is not a problem in practice, when the number of :class:`Logger` " "instances is dependent on the level of granularity you want to use in " -"logging an application, it could be hard to manage if the number of :class:" -"`Logger` instances becomes effectively unbounded." +"logging an application, it could be hard to manage if the number " +"of :class:`Logger` instances becomes effectively unbounded." msgstr "" -#: ../../howto/logging-cookbook.rst:873 +#: ../../howto/logging-cookbook.rst:886 msgid "Using LoggerAdapters to impart contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:875 +#: ../../howto/logging-cookbook.rst:888 msgid "" "An easy way in which you can pass contextual information to be output along " "with logging event information is to use the :class:`LoggerAdapter` class. " -"This class is designed to look like a :class:`Logger`, so that you can call :" -"meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:" -"`exception`, :meth:`critical` and :meth:`log`. These methods have the same " -"signatures as their counterparts in :class:`Logger`, so you can use the two " -"types of instances interchangeably." +"This class is designed to look like a :class:`Logger`, so that you can " +"call :meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:`exception`, :meth:`critical` " +"and :meth:`log`. These methods have the same signatures as their " +"counterparts in :class:`Logger`, so you can use the two types of instances " +"interchangeably." msgstr "" -#: ../../howto/logging-cookbook.rst:883 +#: ../../howto/logging-cookbook.rst:896 msgid "" -"When you create an instance of :class:`LoggerAdapter`, you pass it a :class:" -"`Logger` instance and a dict-like object which contains your contextual " -"information. When you call one of the logging methods on an instance of :" -"class:`LoggerAdapter`, it delegates the call to the underlying instance of :" -"class:`Logger` passed to its constructor, and arranges to pass the " -"contextual information in the delegated call. Here's a snippet from the code " -"of :class:`LoggerAdapter`::" +"When you create an instance of :class:`LoggerAdapter`, you pass it " +"a :class:`Logger` instance and a dict-like object which contains your " +"contextual information. When you call one of the logging methods on an " +"instance of :class:`LoggerAdapter`, it delegates the call to the underlying " +"instance of :class:`Logger` passed to its constructor, and arranges to pass " +"the contextual information in the delegated call. Here's a snippet from the " +"code of :class:`LoggerAdapter`::" msgstr "" -#: ../../howto/logging-cookbook.rst:891 +#: ../../howto/logging-cookbook.rst:904 msgid "" "def debug(self, msg, /, *args, **kwargs):\n" " \"\"\"\n" @@ -1196,7 +1212,7 @@ msgid "" " self.logger.debug(msg, *args, **kwargs)" msgstr "" -#: ../../howto/logging-cookbook.rst:899 +#: ../../howto/logging-cookbook.rst:912 msgid "" "The :meth:`~LoggerAdapter.process` method of :class:`LoggerAdapter` is where " "the contextual information is added to the logging output. It's passed the " @@ -1209,18 +1225,19 @@ msgid "" "be silently overwritten." msgstr "" -#: ../../howto/logging-cookbook.rst:908 +#: ../../howto/logging-cookbook.rst:921 msgid "" "The advantage of using 'extra' is that the values in the dict-like object " "are merged into the :class:`LogRecord` instance's __dict__, allowing you to " "use customized strings with your :class:`Formatter` instances which know " "about the keys of the dict-like object. If you need a different method, e.g. " "if you want to prepend or append the contextual information to the message " -"string, you just need to subclass :class:`LoggerAdapter` and override :meth:" -"`~LoggerAdapter.process` to do what you need. Here is a simple example::" +"string, you just need to subclass :class:`LoggerAdapter` and " +"override :meth:`~LoggerAdapter.process` to do what you need. Here is a " +"simple example::" msgstr "" -#: ../../howto/logging-cookbook.rst:916 +#: ../../howto/logging-cookbook.rst:929 msgid "" "class CustomAdapter(logging.LoggerAdapter):\n" " \"\"\"\n" @@ -1231,27 +1248,27 @@ msgid "" " return '[%s] %s' % (self.extra['connid'], msg), kwargs" msgstr "" -#: ../../howto/logging-cookbook.rst:924 +#: ../../howto/logging-cookbook.rst:937 msgid "which you can use like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:926 +#: ../../howto/logging-cookbook.rst:939 msgid "" "logger = logging.getLogger(__name__)\n" "adapter = CustomAdapter(logger, {'connid': some_conn_id})" msgstr "" -#: ../../howto/logging-cookbook.rst:929 +#: ../../howto/logging-cookbook.rst:942 msgid "" "Then any events that you log to the adapter will have the value of " "``some_conn_id`` prepended to the log messages." msgstr "" -#: ../../howto/logging-cookbook.rst:933 +#: ../../howto/logging-cookbook.rst:946 msgid "Using objects other than dicts to pass contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:935 +#: ../../howto/logging-cookbook.rst:948 msgid "" "You don't need to pass an actual dict to a :class:`LoggerAdapter` - you " "could pass an instance of a class which implements ``__getitem__`` and " @@ -1260,32 +1277,32 @@ msgid "" "would be constant)." msgstr "" -#: ../../howto/logging-cookbook.rst:944 +#: ../../howto/logging-cookbook.rst:957 msgid "Using Filters to impart contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:946 +#: ../../howto/logging-cookbook.rst:959 msgid "" -"You can also add contextual information to log output using a user-defined :" -"class:`Filter`. ``Filter`` instances are allowed to modify the " +"You can also add contextual information to log output using a user-" +"defined :class:`Filter`. ``Filter`` instances are allowed to modify the " "``LogRecords`` passed to them, including adding additional attributes which " -"can then be output using a suitable format string, or if needed a custom :" -"class:`Formatter`." +"can then be output using a suitable format string, or if needed a " +"custom :class:`Formatter`." msgstr "" -#: ../../howto/logging-cookbook.rst:951 +#: ../../howto/logging-cookbook.rst:964 msgid "" "For example in a web application, the request being processed (or at least, " -"the interesting parts of it) can be stored in a threadlocal (:class:" -"`threading.local`) variable, and then accessed from a ``Filter`` to add, " -"say, information from the request - say, the remote IP address and remote " -"user's username - to the ``LogRecord``, using the attribute names 'ip' and " -"'user' as in the ``LoggerAdapter`` example above. In that case, the same " -"format string can be used to get similar output to that shown above. Here's " -"an example script::" +"the interesting parts of it) can be stored in a threadlocal " +"(:class:`threading.local`) variable, and then accessed from a ``Filter`` to " +"add, say, information from the request - say, the remote IP address and " +"remote user's username - to the ``LogRecord``, using the attribute names " +"'ip' and 'user' as in the ``LoggerAdapter`` example above. In that case, the " +"same format string can be used to get similar output to that shown above. " +"Here's an example script::" msgstr "" -#: ../../howto/logging-cookbook.rst:960 +#: ../../howto/logging-cookbook.rst:973 msgid "" "import logging\n" "from random import choice\n" @@ -1328,11 +1345,11 @@ msgid "" "'parameters')" msgstr "" -#: ../../howto/logging-cookbook.rst:997 +#: ../../howto/logging-cookbook.rst:1010 msgid "which, when run, produces something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:999 +#: ../../howto/logging-cookbook.rst:1012 msgid "" "2010-09-06 22:38:15,292 a.b.c DEBUG IP: 123.231.231.123 User: fred A " "debug message\n" @@ -1360,11 +1377,11 @@ msgid "" "message at INFO level with 2 parameters" msgstr "" -#: ../../howto/logging-cookbook.rst:1015 +#: ../../howto/logging-cookbook.rst:1028 msgid "Use of ``contextvars``" msgstr "" -#: ../../howto/logging-cookbook.rst:1017 +#: ../../howto/logging-cookbook.rst:1030 msgid "" "Since Python 3.7, the :mod:`contextvars` module has provided context-local " "storage which works for both :mod:`threading` and :mod:`asyncio` processing " @@ -1374,7 +1391,7 @@ msgid "" "attributes handled by web applications." msgstr "" -#: ../../howto/logging-cookbook.rst:1023 +#: ../../howto/logging-cookbook.rst:1036 msgid "" "For the purposes of illustration, say that you have different web " "applications, each independent of the other but running in the same Python " @@ -1385,11 +1402,11 @@ msgid "" "information such as client IP, HTTP request method and client username?" msgstr "" -#: ../../howto/logging-cookbook.rst:1030 +#: ../../howto/logging-cookbook.rst:1043 msgid "Let's assume that the library can be simulated by the following code:" msgstr "" -#: ../../howto/logging-cookbook.rst:1032 +#: ../../howto/logging-cookbook.rst:1045 msgid "" "# webapplib.py\n" "import logging\n" @@ -1404,14 +1421,14 @@ msgid "" " time.sleep(0.01)" msgstr "" -#: ../../howto/logging-cookbook.rst:1046 +#: ../../howto/logging-cookbook.rst:1059 msgid "" "We can simulate the multiple web applications by means of two simple " "classes, ``Request`` and ``WebApp``. These simulate how real threaded web " "applications work - each request is handled by a thread:" msgstr "" -#: ../../howto/logging-cookbook.rst:1050 +#: ../../howto/logging-cookbook.rst:1063 msgid "" "# main.py\n" "import argparse\n" @@ -1439,8 +1456,8 @@ msgid "" "\n" "# A dummy set of requests which will be used in the simulation - we'll just " "pick\n" -"# from this list randomly. Note that all GET requests are from 192.168.2." -"XXX\n" +"# from this list randomly. Note that all GET requests are from " +"192.168.2.XXX\n" "# addresses, whereas POST requests are from 192.16.3.XXX addresses. Three " "users\n" "# are represented in the sample requests.\n" @@ -1458,8 +1475,8 @@ msgid "" "information\n" "# such as HTTP method, client IP and username\n" "\n" -"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s " -"%(user)-6s %(ip)s %(method)-4s %(message)s')\n" +"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s %" +"(user)-6s %(ip)s %(method)-4s %(message)s')\n" "\n" "# Create our context variables. These will be filled at the start of " "request\n" @@ -1566,7 +1583,7 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1190 +#: ../../howto/logging-cookbook.rst:1203 msgid "" "If you run the above, you should find that roughly half the requests go " "into :file:`app1.log` and the rest into :file:`app2.log`, and the all the " @@ -1577,7 +1594,7 @@ msgid "" "illustrated by the following shell output:" msgstr "" -#: ../../howto/logging-cookbook.rst:1197 +#: ../../howto/logging-cookbook.rst:1210 msgid "" "~/logging-contextual-webapp$ python main.py\n" "app1 processed 51 requests\n" @@ -1632,11 +1649,11 @@ msgid "" "147" msgstr "" -#: ../../howto/logging-cookbook.rst:1237 +#: ../../howto/logging-cookbook.rst:1250 msgid "Imparting contextual information in handlers" msgstr "" -#: ../../howto/logging-cookbook.rst:1239 +#: ../../howto/logging-cookbook.rst:1252 msgid "" "Each :class:`~Handler` has its own chain of filters. If you want to add " "contextual information to a :class:`LogRecord` without leaking it to other " @@ -1644,7 +1661,7 @@ msgid "" "instead of modifying it in-place, as shown in the following script::" msgstr "" -#: ../../howto/logging-cookbook.rst:1244 +#: ../../howto/logging-cookbook.rst:1257 msgid "" "import copy\n" "import logging\n" @@ -1684,11 +1701,11 @@ msgstr "" "\n" " logger.info('A log message')" -#: ../../howto/logging-cookbook.rst:1266 +#: ../../howto/logging-cookbook.rst:1279 msgid "Logging to a single file from multiple processes" msgstr "" -#: ../../howto/logging-cookbook.rst:1268 +#: ../../howto/logging-cookbook.rst:1281 msgid "" "Although logging is thread-safe, and logging to a single file from multiple " "threads in a single process *is* supported, logging to a single file from " @@ -1698,21 +1715,22 @@ msgid "" "this is to have all the processes log to a :class:`~handlers.SocketHandler`, " "and have a separate process which implements a socket server which reads " "from the socket and logs to file. (If you prefer, you can dedicate one " -"thread in one of the existing processes to perform this function.) :ref:" -"`This section ` documents this approach in more detail and " -"includes a working socket receiver which can be used as a starting point for " -"you to adapt in your own applications." +"thread in one of the existing processes to perform this " +"function.) :ref:`This section ` documents this approach in " +"more detail and includes a working socket receiver which can be used as a " +"starting point for you to adapt in your own applications." msgstr "" -#: ../../howto/logging-cookbook.rst:1281 +#: ../../howto/logging-cookbook.rst:1294 msgid "" -"You could also write your own handler which uses the :class:" -"`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to " -"serialize access to the file from your processes. The stdlib :class:" -"`FileHandler` and subclasses do not make use of :mod:`multiprocessing`." +"You could also write your own handler which uses " +"the :class:`~multiprocessing.Lock` class from the :mod:`multiprocessing` " +"module to serialize access to the file from your processes. The " +"stdlib :class:`FileHandler` and subclasses do not make use " +"of :mod:`multiprocessing`." msgstr "" -#: ../../howto/logging-cookbook.rst:1288 +#: ../../howto/logging-cookbook.rst:1301 msgid "" "Alternatively, you can use a ``Queue`` and a :class:`QueueHandler` to send " "all logging events to one of the processes in your multi-process " @@ -1727,7 +1745,7 @@ msgid "" "requirements::" msgstr "" -#: ../../howto/logging-cookbook.rst:1299 +#: ../../howto/logging-cookbook.rst:1312 msgid "" "# You'll need these imports in your own code\n" "import logging\n" @@ -1760,8 +1778,8 @@ msgid "" "def listener_configurer():\n" " root = logging.getLogger()\n" " h = logging.handlers.RotatingFileHandler('mptest.log', 'a', 300, 10)\n" -" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s " -"%(levelname)-8s %(message)s')\n" +" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s %" +"(levelname)-8s %(message)s')\n" " h.setFormatter(f)\n" " root.addHandler(h)\n" "\n" @@ -1847,13 +1865,13 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1404 +#: ../../howto/logging-cookbook.rst:1417 msgid "" "A variant of the above script keeps the logging in the main process, in a " "separate thread::" msgstr "" -#: ../../howto/logging-cookbook.rst:1407 +#: ../../howto/logging-cookbook.rst:1420 msgid "" "import logging\n" "import logging.config\n" @@ -1893,8 +1911,8 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " -"%(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" +"(processName)-10s %(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -1950,7 +1968,7 @@ msgid "" " lp.join()" msgstr "" -#: ../../howto/logging-cookbook.rst:1499 +#: ../../howto/logging-cookbook.rst:1512 msgid "" "This variant shows how you can e.g. apply configuration for particular " "loggers - e.g. the ``foo`` logger has a special handler which stores all " @@ -1960,36 +1978,36 @@ msgid "" "appropriate destinations." msgstr "" -#: ../../howto/logging-cookbook.rst:1506 +#: ../../howto/logging-cookbook.rst:1519 msgid "Using concurrent.futures.ProcessPoolExecutor" msgstr "使用 concurrent.futures.ProcessPoolExecutor" -#: ../../howto/logging-cookbook.rst:1508 +#: ../../howto/logging-cookbook.rst:1521 msgid "" "If you want to use :class:`concurrent.futures.ProcessPoolExecutor` to start " "your worker processes, you need to create the queue slightly differently. " "Instead of" msgstr "" -#: ../../howto/logging-cookbook.rst:1512 +#: ../../howto/logging-cookbook.rst:1525 msgid "queue = multiprocessing.Queue(-1)" msgstr "queue = multiprocessing.Queue(-1)" -#: ../../howto/logging-cookbook.rst:1516 +#: ../../howto/logging-cookbook.rst:1529 msgid "you should use" msgstr "" -#: ../../howto/logging-cookbook.rst:1518 +#: ../../howto/logging-cookbook.rst:1531 msgid "" "queue = multiprocessing.Manager().Queue(-1) # also works with the examples " "above" msgstr "" -#: ../../howto/logging-cookbook.rst:1522 +#: ../../howto/logging-cookbook.rst:1535 msgid "and you can then replace the worker creation from this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1524 +#: ../../howto/logging-cookbook.rst:1537 msgid "" "workers = []\n" "for i in range(10):\n" @@ -2001,22 +2019,22 @@ msgid "" " w.join()" msgstr "" -#: ../../howto/logging-cookbook.rst:1533 +#: ../../howto/logging-cookbook.rst:1546 msgid "to this (remembering to first import :mod:`concurrent.futures`)::" msgstr "" -#: ../../howto/logging-cookbook.rst:1535 +#: ../../howto/logging-cookbook.rst:1548 msgid "" "with concurrent.futures.ProcessPoolExecutor(max_workers=10) as executor:\n" " for i in range(10):\n" " executor.submit(worker_process, queue, worker_configurer)" msgstr "" -#: ../../howto/logging-cookbook.rst:1540 +#: ../../howto/logging-cookbook.rst:1553 msgid "Deploying Web applications using Gunicorn and uWSGI" msgstr "" -#: ../../howto/logging-cookbook.rst:1542 +#: ../../howto/logging-cookbook.rst:1555 msgid "" "When deploying Web applications using `Gunicorn `_ or " "`uWSGI `_ (or similar), " @@ -2028,11 +2046,11 @@ msgid "" "listener in production`_ for more details." msgstr "" -#: ../../howto/logging-cookbook.rst:1552 +#: ../../howto/logging-cookbook.rst:1565 msgid "Using file rotation" msgstr "" -#: ../../howto/logging-cookbook.rst:1557 +#: ../../howto/logging-cookbook.rst:1570 msgid "" "Sometimes you want to let a log file grow to a certain size, then open a new " "file and log to that. You may want to keep a certain number of these files, " @@ -2041,7 +2059,7 @@ msgid "" "usage pattern, the logging package provides a :class:`RotatingFileHandler`::" msgstr "" -#: ../../howto/logging-cookbook.rst:1563 +#: ../../howto/logging-cookbook.rst:1576 msgid "" "import glob\n" "import logging\n" @@ -2070,13 +2088,13 @@ msgid "" " print(filename)" msgstr "" -#: ../../howto/logging-cookbook.rst:1589 +#: ../../howto/logging-cookbook.rst:1602 msgid "" "The result should be 6 separate files, each with part of the log history for " "the application:" msgstr "" -#: ../../howto/logging-cookbook.rst:1592 +#: ../../howto/logging-cookbook.rst:1605 msgid "" "logging_rotatingfile_example.out\n" "logging_rotatingfile_example.out.1\n" @@ -2086,7 +2104,7 @@ msgid "" "logging_rotatingfile_example.out.5" msgstr "" -#: ../../howto/logging-cookbook.rst:1601 +#: ../../howto/logging-cookbook.rst:1614 msgid "" "The most current file is always :file:`logging_rotatingfile_example.out`, " "and each time it reaches the size limit it is renamed with the suffix " @@ -2094,26 +2112,26 @@ msgid "" "(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased." msgstr "" -#: ../../howto/logging-cookbook.rst:1606 +#: ../../howto/logging-cookbook.rst:1619 msgid "" "Obviously this example sets the log length much too small as an extreme " "example. You would want to set *maxBytes* to an appropriate value." msgstr "" -#: ../../howto/logging-cookbook.rst:1614 +#: ../../howto/logging-cookbook.rst:1627 msgid "Use of alternative formatting styles" msgstr "" -#: ../../howto/logging-cookbook.rst:1616 +#: ../../howto/logging-cookbook.rst:1629 msgid "" "When logging was added to the Python standard library, the only way of " "formatting messages with variable content was to use the %-formatting " -"method. Since then, Python has gained two new formatting approaches: :class:" -"`string.Template` (added in Python 2.4) and :meth:`str.format` (added in " -"Python 2.6)." +"method. Since then, Python has gained two new formatting " +"approaches: :class:`string.Template` (added in Python 2.4) " +"and :meth:`str.format` (added in Python 2.6)." msgstr "" -#: ../../howto/logging-cookbook.rst:1622 +#: ../../howto/logging-cookbook.rst:1635 msgid "" "Logging (as of 3.2) provides improved support for these two additional " "formatting styles. The :class:`Formatter` class been enhanced to take an " @@ -2121,12 +2139,12 @@ msgid "" "``'%'``, but other possible values are ``'{'`` and ``'$'``, which correspond " "to the other two formatting styles. Backwards compatibility is maintained by " "default (as you would expect), but by explicitly specifying a style " -"parameter, you get the ability to specify format strings which work with :" -"meth:`str.format` or :class:`string.Template`. Here's an example console " -"session to show the possibilities:" +"parameter, you get the ability to specify format strings which work " +"with :meth:`str.format` or :class:`string.Template`. Here's an example " +"console session to show the possibilities:" msgstr "" -#: ../../howto/logging-cookbook.rst:1632 +#: ../../howto/logging-cookbook.rst:1645 msgid "" ">>> import logging\n" ">>> root = logging.getLogger()\n" @@ -2151,21 +2169,21 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1656 +#: ../../howto/logging-cookbook.rst:1669 msgid "" "Note that the formatting of logging messages for final output to logs is " "completely independent of how an individual logging message is constructed. " "That can still use %-formatting, as shown here::" msgstr "" -#: ../../howto/logging-cookbook.rst:1660 +#: ../../howto/logging-cookbook.rst:1673 msgid "" ">>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message')\n" "2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1664 +#: ../../howto/logging-cookbook.rst:1677 msgid "" "Logging calls (``logger.debug()``, ``logger.info()`` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -2173,15 +2191,15 @@ msgid "" "logging call (e.g. the ``exc_info`` keyword parameter to indicate that " "traceback information should be logged, or the ``extra`` keyword parameter " "to indicate additional contextual information to be added to the log). So " -"you cannot directly make logging calls using :meth:`str.format` or :class:" -"`string.Template` syntax, because internally the logging package uses %-" -"formatting to merge the format string and the variable arguments. There " -"would be no changing this while preserving backward compatibility, since all " -"logging calls which are out there in existing code will be using %-format " -"strings." +"you cannot directly make logging calls using :meth:`str.format` " +"or :class:`string.Template` syntax, because internally the logging package " +"uses %-formatting to merge the format string and the variable arguments. " +"There would be no changing this while preserving backward compatibility, " +"since all logging calls which are out there in existing code will be using %-" +"format strings." msgstr "" -#: ../../howto/logging-cookbook.rst:1677 +#: ../../howto/logging-cookbook.rst:1690 msgid "" "There is, however, a way that you can use {}- and $- formatting to construct " "your individual log messages. Recall that for a message you can use an " @@ -2190,7 +2208,7 @@ msgid "" "the following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:1683 ../../howto/logging-cookbook.rst:2771 +#: ../../howto/logging-cookbook.rst:1696 ../../howto/logging-cookbook.rst:2784 msgid "" "class BraceMessage:\n" " def __init__(self, fmt, /, *args, **kwargs):\n" @@ -2228,7 +2246,7 @@ msgstr "" " from string import Template\n" " return Template(self.fmt).substitute(**self.kwargs)" -#: ../../howto/logging-cookbook.rst:1701 +#: ../../howto/logging-cookbook.rst:1714 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -2239,14 +2257,14 @@ msgid "" "used as a synonym/alias for :func:`gettext.gettext` or its brethren)." msgstr "" -#: ../../howto/logging-cookbook.rst:1709 +#: ../../howto/logging-cookbook.rst:1722 msgid "" "The above classes are not included in Python, though they're easy enough to " "copy and paste into your own code. They can be used as follows (assuming " "that they're declared in a module called ``wherever``):" msgstr "" -#: ../../howto/logging-cookbook.rst:1713 +#: ../../howto/logging-cookbook.rst:1726 msgid "" ">>> from wherever import BraceMessage as __\n" ">>> print(__('Message with {0} {name}', 2, name='placeholders'))\n" @@ -2265,14 +2283,14 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1731 +#: ../../howto/logging-cookbook.rst:1744 msgid "" "While the above examples use ``print()`` to show how the formatting works, " "you would of course use ``logger.debug()`` or similar to actually log using " "this approach." msgstr "" -#: ../../howto/logging-cookbook.rst:1735 +#: ../../howto/logging-cookbook.rst:1748 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -2283,13 +2301,13 @@ msgid "" "sugar for a constructor call to one of the :samp:`{XXX}Message` classes." msgstr "" -#: ../../howto/logging-cookbook.rst:1743 +#: ../../howto/logging-cookbook.rst:1756 msgid "" "If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar " "effect to the above, as in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1746 +#: ../../howto/logging-cookbook.rst:1759 msgid "" "import logging\n" "\n" @@ -2318,63 +2336,64 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1772 +#: ../../howto/logging-cookbook.rst:1785 msgid "" "The above script should log the message ``Hello, world!`` when run with " "Python 3.8 or later." msgstr "" -#: ../../howto/logging-cookbook.rst:1781 +#: ../../howto/logging-cookbook.rst:1794 msgid "Customizing ``LogRecord``" msgstr "" -#: ../../howto/logging-cookbook.rst:1783 +#: ../../howto/logging-cookbook.rst:1796 msgid "" "Every logging event is represented by a :class:`LogRecord` instance. When an " -"event is logged and not filtered out by a logger's level, a :class:" -"`LogRecord` is created, populated with information about the event and then " -"passed to the handlers for that logger (and its ancestors, up to and " -"including the logger where further propagation up the hierarchy is " +"event is logged and not filtered out by a logger's level, " +"a :class:`LogRecord` is created, populated with information about the event " +"and then passed to the handlers for that logger (and its ancestors, up to " +"and including the logger where further propagation up the hierarchy is " "disabled). Before Python 3.2, there were only two places where this creation " "was done:" msgstr "" -#: ../../howto/logging-cookbook.rst:1790 +#: ../../howto/logging-cookbook.rst:1803 msgid "" ":meth:`Logger.makeRecord`, which is called in the normal process of logging " "an event. This invoked :class:`LogRecord` directly to create an instance." msgstr "" -#: ../../howto/logging-cookbook.rst:1793 +#: ../../howto/logging-cookbook.rst:1806 msgid "" ":func:`makeLogRecord`, which is called with a dictionary containing " "attributes to be added to the LogRecord. This is typically invoked when a " "suitable dictionary has been received over the network (e.g. in pickle form " -"via a :class:`~handlers.SocketHandler`, or in JSON form via an :class:" -"`~handlers.HTTPHandler`)." +"via a :class:`~handlers.SocketHandler`, or in JSON form via " +"an :class:`~handlers.HTTPHandler`)." msgstr "" -#: ../../howto/logging-cookbook.rst:1799 +#: ../../howto/logging-cookbook.rst:1812 msgid "" -"This has usually meant that if you need to do anything special with a :class:" -"`LogRecord`, you've had to do one of the following." +"This has usually meant that if you need to do anything special with " +"a :class:`LogRecord`, you've had to do one of the following." msgstr "" -#: ../../howto/logging-cookbook.rst:1802 +#: ../../howto/logging-cookbook.rst:1815 msgid "" -"Create your own :class:`Logger` subclass, which overrides :meth:`Logger." -"makeRecord`, and set it using :func:`~logging.setLoggerClass` before any " -"loggers that you care about are instantiated." +"Create your own :class:`Logger` subclass, which " +"overrides :meth:`Logger.makeRecord`, and set it " +"using :func:`~logging.setLoggerClass` before any loggers that you care about " +"are instantiated." msgstr "" -#: ../../howto/logging-cookbook.rst:1805 +#: ../../howto/logging-cookbook.rst:1818 msgid "" "Add a :class:`Filter` to a logger or handler, which does the necessary " "special manipulation you need when its :meth:`~Filter.filter` method is " "called." msgstr "" -#: ../../howto/logging-cookbook.rst:1809 +#: ../../howto/logging-cookbook.rst:1822 msgid "" "The first approach would be a little unwieldy in the scenario where (say) " "several different libraries wanted to do different things. Each would " @@ -2382,7 +2401,7 @@ msgid "" "last would win." msgstr "" -#: ../../howto/logging-cookbook.rst:1814 +#: ../../howto/logging-cookbook.rst:1827 msgid "" "The second approach works reasonably well for many cases, but does not allow " "you to e.g. use a specialized subclass of :class:`LogRecord`. Library " @@ -2391,11 +2410,11 @@ msgid "" "would do simply by adding new packages or modules and doing ::" msgstr "" -#: ../../howto/logging-cookbook.rst:1820 +#: ../../howto/logging-cookbook.rst:1833 msgid "logger = logging.getLogger(__name__)" msgstr "logger = logging.getLogger(__name__)" -#: ../../howto/logging-cookbook.rst:1822 +#: ../../howto/logging-cookbook.rst:1835 msgid "" "at module level). It's probably one too many things to think about. " "Developers could also add the filter to a :class:`~logging.NullHandler` " @@ -2405,17 +2424,17 @@ msgid "" "developer." msgstr "" -#: ../../howto/logging-cookbook.rst:1828 +#: ../../howto/logging-cookbook.rst:1841 msgid "" "In Python 3.2 and later, :class:`~logging.LogRecord` creation is done " "through a factory, which you can specify. The factory is just a callable you " -"can set with :func:`~logging.setLogRecordFactory`, and interrogate with :" -"func:`~logging.getLogRecordFactory`. The factory is invoked with the same " -"signature as the :class:`~logging.LogRecord` constructor, as :class:" -"`LogRecord` is the default setting for the factory." +"can set with :func:`~logging.setLogRecordFactory`, and interrogate " +"with :func:`~logging.getLogRecordFactory`. The factory is invoked with the " +"same signature as the :class:`~logging.LogRecord` constructor, " +"as :class:`LogRecord` is the default setting for the factory." msgstr "" -#: ../../howto/logging-cookbook.rst:1835 +#: ../../howto/logging-cookbook.rst:1848 msgid "" "This approach allows a custom factory to control all aspects of LogRecord " "creation. For example, you could return a subclass, or just add some " @@ -2423,7 +2442,7 @@ msgid "" "this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1839 +#: ../../howto/logging-cookbook.rst:1852 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -2435,7 +2454,7 @@ msgid "" "logging.setLogRecordFactory(record_factory)" msgstr "" -#: ../../howto/logging-cookbook.rst:1848 +#: ../../howto/logging-cookbook.rst:1861 msgid "" "This pattern allows different libraries to chain factories together, and as " "long as they don't overwrite each other's attributes or unintentionally " @@ -2445,22 +2464,22 @@ msgid "" "used when the use of a :class:`Filter` does not provide the desired result." msgstr "" -#: ../../howto/logging-cookbook.rst:1860 +#: ../../howto/logging-cookbook.rst:1873 msgid "Subclassing QueueHandler and QueueListener- a ZeroMQ example" msgstr "" -#: ../../howto/logging-cookbook.rst:1863 ../../howto/logging-cookbook.rst:1996 +#: ../../howto/logging-cookbook.rst:1876 ../../howto/logging-cookbook.rst:2009 msgid "Subclass ``QueueHandler``" msgstr "" -#: ../../howto/logging-cookbook.rst:1865 +#: ../../howto/logging-cookbook.rst:1878 msgid "" "You can use a :class:`QueueHandler` subclass to send messages to other kinds " "of queues, for example a ZeroMQ 'publish' socket. In the example below,the " "socket is created separately and passed to the handler (as its 'queue')::" msgstr "" -#: ../../howto/logging-cookbook.rst:1869 +#: ../../howto/logging-cookbook.rst:1882 msgid "" "import zmq # using pyzmq, the Python binding for ZeroMQ\n" "import json # for serializing records portably\n" @@ -2477,13 +2496,13 @@ msgid "" "handler = ZeroMQSocketHandler(sock)" msgstr "" -#: ../../howto/logging-cookbook.rst:1884 +#: ../../howto/logging-cookbook.rst:1897 msgid "" "Of course there are other ways of organizing this, for example passing in " "the data needed by the handler to create the socket::" msgstr "" -#: ../../howto/logging-cookbook.rst:1887 +#: ../../howto/logging-cookbook.rst:1900 msgid "" "class ZeroMQSocketHandler(QueueHandler):\n" " def __init__(self, uri, socktype=zmq.PUB, ctx=None):\n" @@ -2499,17 +2518,17 @@ msgid "" " self.queue.close()" msgstr "" -#: ../../howto/logging-cookbook.rst:1902 ../../howto/logging-cookbook.rst:1932 +#: ../../howto/logging-cookbook.rst:1915 ../../howto/logging-cookbook.rst:1945 msgid "Subclass ``QueueListener``" msgstr "" -#: ../../howto/logging-cookbook.rst:1904 +#: ../../howto/logging-cookbook.rst:1917 msgid "" "You can also subclass :class:`QueueListener` to get messages from other " "kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1907 +#: ../../howto/logging-cookbook.rst:1920 msgid "" "class ZeroMQSocketListener(QueueListener):\n" " def __init__(self, uri, /, *handlers, **kwargs):\n" @@ -2525,20 +2544,20 @@ msgid "" " return logging.makeLogRecord(msg)" msgstr "" -#: ../../howto/logging-cookbook.rst:1922 +#: ../../howto/logging-cookbook.rst:1935 msgid "Subclassing QueueHandler and QueueListener- a ``pynng`` example" msgstr "" -#: ../../howto/logging-cookbook.rst:1924 +#: ../../howto/logging-cookbook.rst:1937 msgid "" "In a similar way to the above section, we can implement a listener and " -"handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The following " -"snippets illustrate -- you can test them in an environment which has " -"``pynng`` installed. Just for variety, we present the listener first." +"handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The " +"following snippets illustrate -- you can test them in an environment which " +"has ``pynng`` installed. Just for variety, we present the listener first." msgstr "" -#: ../../howto/logging-cookbook.rst:1934 +#: ../../howto/logging-cookbook.rst:1947 msgid "" "# listener.py\n" "import json\n" @@ -2600,7 +2619,7 @@ msgid "" " listener.stop()" msgstr "" -#: ../../howto/logging-cookbook.rst:2000 +#: ../../howto/logging-cookbook.rst:2013 msgid "" "# sender.py\n" "import json\n" @@ -2633,8 +2652,8 @@ msgid "" "# Make sure the process ID is in the output\n" "logging.basicConfig(level=logging.DEBUG,\n" " handlers=[logging.StreamHandler(), handler],\n" -" format='%(levelname)-8s %(name)10s %(process)6s " -"%(message)s')\n" +" format='%(levelname)-8s %(name)10s %(process)6s %" +"(message)s')\n" "levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\n" " logging.CRITICAL)\n" "logger_names = ('myapp', 'myapp.lib1', 'myapp.lib2')\n" @@ -2649,14 +2668,14 @@ msgid "" " time.sleep(delay)" msgstr "" -#: ../../howto/logging-cookbook.rst:2047 +#: ../../howto/logging-cookbook.rst:2060 msgid "" "You can run the above two snippets in separate command shells. If we run the " "listener in one shell and run the sender in two separate shells, we should " "see something like the following. In the first sender shell:" msgstr "" -#: ../../howto/logging-cookbook.rst:2051 +#: ../../howto/logging-cookbook.rst:2064 msgid "" "$ python sender.py\n" "DEBUG myapp 613 Message no. 1\n" @@ -2670,11 +2689,11 @@ msgid "" "(and so on)" msgstr "" -#: ../../howto/logging-cookbook.rst:2064 +#: ../../howto/logging-cookbook.rst:2077 msgid "In the second sender shell:" msgstr "" -#: ../../howto/logging-cookbook.rst:2066 +#: ../../howto/logging-cookbook.rst:2079 msgid "" "$ python sender.py\n" "INFO myapp.lib2 657 Message no. 1\n" @@ -2688,11 +2707,11 @@ msgid "" "(and so on)" msgstr "" -#: ../../howto/logging-cookbook.rst:2079 +#: ../../howto/logging-cookbook.rst:2092 msgid "In the listener shell:" msgstr "" -#: ../../howto/logging-cookbook.rst:2081 +#: ../../howto/logging-cookbook.rst:2094 msgid "" "$ python listener.py\n" "Press Ctrl-C to stop.\n" @@ -2715,25 +2734,25 @@ msgid "" "(and so on)" msgstr "" -#: ../../howto/logging-cookbook.rst:2103 +#: ../../howto/logging-cookbook.rst:2116 msgid "" "As you can see, the logging from the two sender processes is interleaved in " "the listener's output." msgstr "" -#: ../../howto/logging-cookbook.rst:2108 +#: ../../howto/logging-cookbook.rst:2121 msgid "An example dictionary-based configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:2110 +#: ../../howto/logging-cookbook.rst:2123 msgid "" "Below is an example of a logging configuration dictionary - it's taken from " "the `documentation on the Django project `_. This dictionary is passed to :" -"func:`~config.dictConfig` to put the configuration into effect::" +"stable/topics/logging/#configuring-logging>`_. This dictionary is passed " +"to :func:`~config.dictConfig` to put the configuration into effect::" msgstr "" -#: ../../howto/logging-cookbook.rst:2114 +#: ../../howto/logging-cookbook.rst:2127 msgid "" "LOGGING = {\n" " 'version': 1,\n" @@ -2835,24 +2854,24 @@ msgstr "" " }\n" "}" -#: ../../howto/logging-cookbook.rst:2163 +#: ../../howto/logging-cookbook.rst:2176 msgid "" "For more information about this configuration, you can see the `relevant " "section `_ of the Django documentation." msgstr "" -#: ../../howto/logging-cookbook.rst:2170 +#: ../../howto/logging-cookbook.rst:2183 msgid "Using a rotator and namer to customize log rotation processing" msgstr "" -#: ../../howto/logging-cookbook.rst:2172 +#: ../../howto/logging-cookbook.rst:2185 msgid "" "An example of how you can define a namer and rotator is given in the " "following runnable script, which shows gzip compression of the log file::" msgstr "" -#: ../../howto/logging-cookbook.rst:2175 +#: ../../howto/logging-cookbook.rst:2188 msgid "" "import gzip\n" "import logging\n" @@ -2912,12 +2931,12 @@ msgstr "" "for i in range(1000):\n" " root.info(f'Message no. {i + 1}')" -#: ../../howto/logging-cookbook.rst:2203 +#: ../../howto/logging-cookbook.rst:2216 msgid "" "After running this, you will see six new files, five of which are compressed:" msgstr "" -#: ../../howto/logging-cookbook.rst:2205 +#: ../../howto/logging-cookbook.rst:2218 msgid "" "$ ls rotated.log*\n" "rotated.log rotated.log.2.gz rotated.log.4.gz\n" @@ -2935,11 +2954,11 @@ msgstr "" "2023-01-20 02:28:17,767 Message no. 997\n" "2023-01-20 02:28:17,767 Message no. 998" -#: ../../howto/logging-cookbook.rst:2216 +#: ../../howto/logging-cookbook.rst:2229 msgid "A more elaborate multiprocessing example" msgstr "" -#: ../../howto/logging-cookbook.rst:2218 +#: ../../howto/logging-cookbook.rst:2231 msgid "" "The following working example shows how logging can be used with " "multiprocessing using configuration files. The configurations are fairly " @@ -2947,7 +2966,7 @@ msgid "" "in a real multiprocessing scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:2223 +#: ../../howto/logging-cookbook.rst:2236 msgid "" "In the example, the main process spawns a listener process and some worker " "processes. Each of the main process, the listener and the workers have three " @@ -2960,13 +2979,13 @@ msgid "" "own scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:2233 +#: ../../howto/logging-cookbook.rst:2246 msgid "" "Here's the script - the docstrings and the comments hopefully explain how it " "works::" msgstr "" -#: ../../howto/logging-cookbook.rst:2236 +#: ../../howto/logging-cookbook.rst:2249 msgid "" "import logging\n" "import logging.config\n" @@ -3111,13 +3130,13 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " -"%(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" +"(processName)-10s %(message)s'\n" " },\n" " 'simple': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s " -"%(message)s'\n" +" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s %" +"(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -3189,11 +3208,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2445 +#: ../../howto/logging-cookbook.rst:2458 msgid "Inserting a BOM into messages sent to a SysLogHandler" msgstr "" -#: ../../howto/logging-cookbook.rst:2447 +#: ../../howto/logging-cookbook.rst:2460 msgid "" ":rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a " "set of bytes which have the following structure: an optional pure-ASCII " @@ -3202,7 +3221,7 @@ msgid "" "<5424#section-6>`.)" msgstr "" -#: ../../howto/logging-cookbook.rst:2453 +#: ../../howto/logging-cookbook.rst:2466 msgid "" "In Python 3.1, code was added to :class:`~logging.handlers.SysLogHandler` to " "insert a BOM into the message, but unfortunately, it was implemented " @@ -3210,7 +3229,7 @@ msgid "" "hence not allowing any pure-ASCII component to appear before it." msgstr "" -#: ../../howto/logging-cookbook.rst:2459 +#: ../../howto/logging-cookbook.rst:2472 msgid "" "As this behaviour is broken, the incorrect BOM insertion code is being " "removed from Python 3.2.4 and later. However, it is not being replaced, and " @@ -3219,37 +3238,38 @@ msgid "" "encoded using UTF-8, then you need to do the following:" msgstr "" -#: ../../howto/logging-cookbook.rst:2465 +#: ../../howto/logging-cookbook.rst:2478 msgid "" -"Attach a :class:`~logging.Formatter` instance to your :class:`~logging." -"handlers.SysLogHandler` instance, with a format string such as::" +"Attach a :class:`~logging.Formatter` instance to " +"your :class:`~logging.handlers.SysLogHandler` instance, with a format string " +"such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2469 +#: ../../howto/logging-cookbook.rst:2482 msgid "'ASCII section\\ufeffUnicode section'" msgstr "" -#: ../../howto/logging-cookbook.rst:2471 +#: ../../howto/logging-cookbook.rst:2484 msgid "" "The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as " "a UTF-8 BOM -- the byte-string ``b'\\xef\\xbb\\xbf'``." msgstr "" -#: ../../howto/logging-cookbook.rst:2474 +#: ../../howto/logging-cookbook.rst:2487 msgid "" "Replace the ASCII section with whatever placeholders you like, but make sure " "that the data that appears in there after substitution is always ASCII (that " "way, it will remain unchanged after UTF-8 encoding)." msgstr "" -#: ../../howto/logging-cookbook.rst:2478 +#: ../../howto/logging-cookbook.rst:2491 msgid "" "Replace the Unicode section with whatever placeholders you like; if the data " "which appears there after substitution contains characters outside the ASCII " "range, that's fine -- it will be encoded using UTF-8." msgstr "" -#: ../../howto/logging-cookbook.rst:2482 +#: ../../howto/logging-cookbook.rst:2495 msgid "" "The formatted message *will* be encoded using UTF-8 encoding by " "``SysLogHandler``. If you follow the above rules, you should be able to " @@ -3258,11 +3278,11 @@ msgid "" "daemon may complain." msgstr "" -#: ../../howto/logging-cookbook.rst:2489 +#: ../../howto/logging-cookbook.rst:2502 msgid "Implementing structured logging" msgstr "" -#: ../../howto/logging-cookbook.rst:2491 +#: ../../howto/logging-cookbook.rst:2504 msgid "" "Although most logging messages are intended for reading by humans, and thus " "not readily machine-parseable, there might be circumstances where you want " @@ -3274,7 +3294,7 @@ msgid "" "machine-parseable manner::" msgstr "" -#: ../../howto/logging-cookbook.rst:2499 +#: ../../howto/logging-cookbook.rst:2512 msgid "" "import json\n" "import logging\n" @@ -3293,11 +3313,11 @@ msgid "" "logging.info(_('message 1', foo='bar', bar='baz', num=123, fnum=123.456))" msgstr "" -#: ../../howto/logging-cookbook.rst:2515 +#: ../../howto/logging-cookbook.rst:2528 msgid "If the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2517 +#: ../../howto/logging-cookbook.rst:2530 msgid "" "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " "\"bar\"}" @@ -3305,19 +3325,19 @@ msgstr "" "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " "\"bar\"}" -#: ../../howto/logging-cookbook.rst:2521 ../../howto/logging-cookbook.rst:2563 +#: ../../howto/logging-cookbook.rst:2534 ../../howto/logging-cookbook.rst:2576 msgid "" "Note that the order of items might be different according to the version of " "Python used." msgstr "" -#: ../../howto/logging-cookbook.rst:2524 +#: ../../howto/logging-cookbook.rst:2537 msgid "" "If you need more specialised processing, you can use a custom JSON encoder, " "as in the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2527 +#: ../../howto/logging-cookbook.rst:2540 msgid "" "import json\n" "import logging\n" @@ -3350,19 +3370,19 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2557 +#: ../../howto/logging-cookbook.rst:2570 msgid "When the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2559 +#: ../../howto/logging-cookbook.rst:2572 msgid "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" msgstr "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" -#: ../../howto/logging-cookbook.rst:2572 +#: ../../howto/logging-cookbook.rst:2585 msgid "Customizing handlers with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2574 +#: ../../howto/logging-cookbook.rst:2587 msgid "" "There are times when you want to customize logging handlers in particular " "ways, and if you use :func:`dictConfig` you may be able to do this without " @@ -3372,7 +3392,7 @@ msgid "" "customize handler creation using a plain function such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2581 +#: ../../howto/logging-cookbook.rst:2594 msgid "" "def owned_file_handler(filename, mode='a', encoding=None, owner=None):\n" " if owner:\n" @@ -3388,13 +3408,14 @@ msgstr "" " shutil.chown(filename, *owner)\n" " return logging.FileHandler(filename, mode, encoding)" -#: ../../howto/logging-cookbook.rst:2588 +#: ../../howto/logging-cookbook.rst:2601 msgid "" -"You can then specify, in a logging configuration passed to :func:" -"`dictConfig`, that a logging handler be created by calling this function::" +"You can then specify, in a logging configuration passed " +"to :func:`dictConfig`, that a logging handler be created by calling this " +"function::" msgstr "" -#: ../../howto/logging-cookbook.rst:2591 +#: ../../howto/logging-cookbook.rst:2604 msgid "" "LOGGING = {\n" " 'version': 1,\n" @@ -3427,14 +3448,14 @@ msgid "" "}" msgstr "" -#: ../../howto/logging-cookbook.rst:2621 +#: ../../howto/logging-cookbook.rst:2634 msgid "" "In this example I am setting the ownership using the ``pulse`` user and " "group, just for the purposes of illustration. Putting it together into a " "working script, ``chowntest.py``::" msgstr "" -#: ../../howto/logging-cookbook.rst:2625 +#: ../../howto/logging-cookbook.rst:2638 msgid "" "import logging, logging.config, os, shutil\n" "\n" @@ -3480,11 +3501,11 @@ msgid "" "logger.debug('A debug message')" msgstr "" -#: ../../howto/logging-cookbook.rst:2668 +#: ../../howto/logging-cookbook.rst:2681 msgid "To run this, you will probably need to run as ``root``:" msgstr "" -#: ../../howto/logging-cookbook.rst:2670 +#: ../../howto/logging-cookbook.rst:2683 msgid "" "$ sudo python3.3 chowntest.py\n" "$ cat chowntest.log\n" @@ -3493,34 +3514,34 @@ msgid "" "-rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log" msgstr "" -#: ../../howto/logging-cookbook.rst:2678 +#: ../../howto/logging-cookbook.rst:2691 msgid "" -"Note that this example uses Python 3.3 because that's where :func:`shutil." -"chown` makes an appearance. This approach should work with any Python " -"version that supports :func:`dictConfig` - namely, Python 2.7, 3.2 or later. " -"With pre-3.3 versions, you would need to implement the actual ownership " -"change using e.g. :func:`os.chown`." +"Note that this example uses Python 3.3 because that's " +"where :func:`shutil.chown` makes an appearance. This approach should work " +"with any Python version that supports :func:`dictConfig` - namely, Python " +"2.7, 3.2 or later. With pre-3.3 versions, you would need to implement the " +"actual ownership change using e.g. :func:`os.chown`." msgstr "" -#: ../../howto/logging-cookbook.rst:2684 +#: ../../howto/logging-cookbook.rst:2697 msgid "" "In practice, the handler-creating function may be in a utility module " "somewhere in your project. Instead of the line in the configuration::" msgstr "" -#: ../../howto/logging-cookbook.rst:2687 +#: ../../howto/logging-cookbook.rst:2700 msgid "'()': owned_file_handler," msgstr "'()': owned_file_handler," -#: ../../howto/logging-cookbook.rst:2689 +#: ../../howto/logging-cookbook.rst:2702 msgid "you could use e.g.::" msgstr "" -#: ../../howto/logging-cookbook.rst:2691 +#: ../../howto/logging-cookbook.rst:2704 msgid "'()': 'ext://project.util.owned_file_handler'," msgstr "'()': 'ext://project.util.owned_file_handler'," -#: ../../howto/logging-cookbook.rst:2693 +#: ../../howto/logging-cookbook.rst:2706 msgid "" "where ``project.util`` can be replaced with the actual name of the package " "where the function resides. In the above working script, using ``'ext://" @@ -3528,25 +3549,25 @@ msgid "" "resolved by :func:`dictConfig` from the ``ext://`` specification." msgstr "" -#: ../../howto/logging-cookbook.rst:2698 +#: ../../howto/logging-cookbook.rst:2711 msgid "" "This example hopefully also points the way to how you could implement other " "types of file change - e.g. setting specific POSIX permission bits - in the " "same way, using :func:`os.chmod`." msgstr "" -#: ../../howto/logging-cookbook.rst:2702 +#: ../../howto/logging-cookbook.rst:2715 msgid "" "Of course, the approach could also be extended to types of handler other " "than a :class:`~logging.FileHandler` - for example, one of the rotating file " "handlers, or a different type of handler altogether." msgstr "" -#: ../../howto/logging-cookbook.rst:2712 +#: ../../howto/logging-cookbook.rst:2725 msgid "Using particular formatting styles throughout your application" msgstr "" -#: ../../howto/logging-cookbook.rst:2714 +#: ../../howto/logging-cookbook.rst:2727 msgid "" "In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword " "parameter which, while defaulting to ``%`` for backward compatibility, " @@ -3557,7 +3578,7 @@ msgid "" "is constructed." msgstr "" -#: ../../howto/logging-cookbook.rst:2721 +#: ../../howto/logging-cookbook.rst:2734 msgid "" "Logging calls (:meth:`~Logger.debug`, :meth:`~Logger.info` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -3565,14 +3586,15 @@ msgid "" "call (e.g. the ``exc_info`` keyword parameter to indicate that traceback " "information should be logged, or the ``extra`` keyword parameter to indicate " "additional contextual information to be added to the log). So you cannot " -"directly make logging calls using :meth:`str.format` or :class:`string." -"Template` syntax, because internally the logging package uses %-formatting " -"to merge the format string and the variable arguments. There would be no " -"changing this while preserving backward compatibility, since all logging " -"calls which are out there in existing code will be using %-format strings." +"directly make logging calls using :meth:`str.format` " +"or :class:`string.Template` syntax, because internally the logging package " +"uses %-formatting to merge the format string and the variable arguments. " +"There would be no changing this while preserving backward compatibility, " +"since all logging calls which are out there in existing code will be using %-" +"format strings." msgstr "" -#: ../../howto/logging-cookbook.rst:2733 +#: ../../howto/logging-cookbook.rst:2746 msgid "" "There have been suggestions to associate format styles with specific " "loggers, but that approach also runs into backward compatibility problems " @@ -3580,7 +3602,7 @@ msgid "" "formatting." msgstr "" -#: ../../howto/logging-cookbook.rst:2737 +#: ../../howto/logging-cookbook.rst:2750 msgid "" "For logging to work interoperably between any third-party libraries and your " "code, decisions about formatting need to be made at the level of the " @@ -3588,11 +3610,11 @@ msgid "" "formatting styles can be accommodated." msgstr "" -#: ../../howto/logging-cookbook.rst:2744 +#: ../../howto/logging-cookbook.rst:2757 msgid "Using LogRecord factories" msgstr "" -#: ../../howto/logging-cookbook.rst:2746 +#: ../../howto/logging-cookbook.rst:2759 msgid "" "In Python 3.2, along with the :class:`~logging.Formatter` changes mentioned " "above, the logging package gained the ability to allow users to set their " @@ -3607,27 +3629,27 @@ msgid "" "implementation does." msgstr "" -#: ../../howto/logging-cookbook.rst:2757 +#: ../../howto/logging-cookbook.rst:2770 msgid "" -"Refer to the reference documentation on :func:`setLogRecordFactory` and :" -"class:`LogRecord` for more information." +"Refer to the reference documentation on :func:`setLogRecordFactory` " +"and :class:`LogRecord` for more information." msgstr "" -#: ../../howto/logging-cookbook.rst:2762 +#: ../../howto/logging-cookbook.rst:2775 msgid "Using custom message objects" msgstr "" -#: ../../howto/logging-cookbook.rst:2764 +#: ../../howto/logging-cookbook.rst:2777 msgid "" "There is another, perhaps simpler way that you can use {}- and $- formatting " -"to construct your individual log messages. You may recall (from :ref:" -"`arbitrary-object-messages`) that when logging you can use an arbitrary " -"object as a message format string, and that the logging package will call :" -"func:`str` on that object to get the actual format string. Consider the " -"following two classes::" +"to construct your individual log messages. You may recall " +"(from :ref:`arbitrary-object-messages`) that when logging you can use an " +"arbitrary object as a message format string, and that the logging package " +"will call :func:`str` on that object to get the actual format string. " +"Consider the following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:2789 +#: ../../howto/logging-cookbook.rst:2802 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -3638,13 +3660,13 @@ msgid "" "using ``_`` for localization)." msgstr "" -#: ../../howto/logging-cookbook.rst:2797 +#: ../../howto/logging-cookbook.rst:2810 msgid "" -"Examples of this approach are given below. Firstly, formatting with :meth:" -"`str.format`::" +"Examples of this approach are given below. Firstly, formatting " +"with :meth:`str.format`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2800 +#: ../../howto/logging-cookbook.rst:2813 msgid "" ">>> __ = BraceMessage\n" ">>> print(__('Message with {0} {1}', 2, 'placeholders'))\n" @@ -3659,11 +3681,11 @@ msgid "" "Message with coordinates: (0.50, 0.50)" msgstr "" -#: ../../howto/logging-cookbook.rst:2811 +#: ../../howto/logging-cookbook.rst:2824 msgid "Secondly, formatting with :class:`string.Template`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2813 +#: ../../howto/logging-cookbook.rst:2826 msgid "" ">>> __ = DollarMessage\n" ">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" @@ -3671,7 +3693,7 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:2818 +#: ../../howto/logging-cookbook.rst:2831 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -3683,26 +3705,26 @@ msgid "" "shown above." msgstr "" -#: ../../howto/logging-cookbook.rst:2832 +#: ../../howto/logging-cookbook.rst:2845 msgid "Configuring filters with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2834 +#: ../../howto/logging-cookbook.rst:2847 msgid "" "You *can* configure filters using :func:`~logging.config.dictConfig`, though " "it might not be obvious at first glance how to do it (hence this recipe). " "Since :class:`~logging.Filter` is the only filter class included in the " "standard library, and it is unlikely to cater to many requirements (it's " -"only there as a base class), you will typically need to define your own :" -"class:`~logging.Filter` subclass with an overridden :meth:`~logging.Filter." -"filter` method. To do this, specify the ``()`` key in the configuration " -"dictionary for the filter, specifying a callable which will be used to " -"create the filter (a class is the most obvious, but you can provide any " -"callable which returns a :class:`~logging.Filter` instance). Here is a " -"complete example::" +"only there as a base class), you will typically need to define your " +"own :class:`~logging.Filter` subclass with an " +"overridden :meth:`~logging.Filter.filter` method. To do this, specify the " +"``()`` key in the configuration dictionary for the filter, specifying a " +"callable which will be used to create the filter (a class is the most " +"obvious, but you can provide any callable which returns " +"a :class:`~logging.Filter` instance). Here is a complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2845 +#: ../../howto/logging-cookbook.rst:2858 msgid "" "import logging\n" "import logging.config\n" @@ -3788,26 +3810,26 @@ msgstr "" " logging.debug('hello')\n" " logging.debug('hello - noshow')" -#: ../../howto/logging-cookbook.rst:2887 +#: ../../howto/logging-cookbook.rst:2900 msgid "" "This example shows how you can pass configuration data to the callable which " "constructs the instance, in the form of keyword parameters. When run, the " "above script will print:" msgstr "" -#: ../../howto/logging-cookbook.rst:2891 +#: ../../howto/logging-cookbook.rst:2904 msgid "changed: hello" msgstr "changed: hello" -#: ../../howto/logging-cookbook.rst:2895 +#: ../../howto/logging-cookbook.rst:2908 msgid "which shows that the filter is working as configured." msgstr "" -#: ../../howto/logging-cookbook.rst:2897 +#: ../../howto/logging-cookbook.rst:2910 msgid "A couple of extra points to note:" msgstr "" -#: ../../howto/logging-cookbook.rst:2899 +#: ../../howto/logging-cookbook.rst:2912 msgid "" "If you can't refer to the callable directly in the configuration (e.g. if it " "lives in a different module, and you can't import it directly where the " @@ -3817,7 +3839,7 @@ msgid "" "the above example." msgstr "" -#: ../../howto/logging-cookbook.rst:2906 +#: ../../howto/logging-cookbook.rst:2919 msgid "" "As well as for filters, this technique can also be used to configure custom " "handlers and formatters. See :ref:`logging-config-dict-userdef` for more " @@ -3826,11 +3848,11 @@ msgid "" "above." msgstr "" -#: ../../howto/logging-cookbook.rst:2915 +#: ../../howto/logging-cookbook.rst:2928 msgid "Customized exception formatting" msgstr "" -#: ../../howto/logging-cookbook.rst:2917 +#: ../../howto/logging-cookbook.rst:2930 msgid "" "There might be times when you want to do customized exception formatting - " "for argument's sake, let's say you want exactly one line per logged event, " @@ -3838,7 +3860,7 @@ msgid "" "formatter class, as shown in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2922 +#: ../../howto/logging-cookbook.rst:2935 msgid "" "import logging\n" "\n" @@ -3877,17 +3899,17 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2958 +#: ../../howto/logging-cookbook.rst:2971 msgid "When run, this produces a file with exactly two lines:" msgstr "" -#: ../../howto/logging-cookbook.rst:2960 +#: ../../howto/logging-cookbook.rst:2973 +#, fuzzy msgid "" "28/01/2015 07:21:23|INFO|Sample message|\n" -"28/01/2015 07:21:23|ERROR|ZeroDivisionError: integer division or modulo by " -"zero|'Traceback (most recent call last):\\n File \"logtest7.py\", line 30, " -"in main\\n x = 1 / 0\\nZeroDivisionError: integer division or modulo by " -"zero'|" +"28/01/2015 07:21:23|ERROR|ZeroDivisionError: division by zero|'Traceback " +"(most recent call last):\\n File \"logtest7.py\", line 30, in main\\n x " +"= 1 / 0\\nZeroDivisionError: division by zero'|" msgstr "" "28/01/2015 07:21:23|INFO|Sample message|\n" "28/01/2015 07:21:23|ERROR|ZeroDivisionError: integer division or modulo by " @@ -3895,35 +3917,35 @@ msgstr "" "in main\\n x = 1 / 0\\nZeroDivisionError: integer division or modulo by " "zero'|" -#: ../../howto/logging-cookbook.rst:2965 +#: ../../howto/logging-cookbook.rst:2978 msgid "" "While the above treatment is simplistic, it points the way to how exception " "information can be formatted to your liking. The :mod:`traceback` module may " "be helpful for more specialized needs." msgstr "" -#: ../../howto/logging-cookbook.rst:2972 +#: ../../howto/logging-cookbook.rst:2985 msgid "Speaking logging messages" msgstr "" -#: ../../howto/logging-cookbook.rst:2974 +#: ../../howto/logging-cookbook.rst:2987 msgid "" "There might be situations when it is desirable to have logging messages " "rendered in an audible rather than a visible format. This is easy to do if " "you have text-to-speech (TTS) functionality available in your system, even " "if it doesn't have a Python binding. Most TTS systems have a command line " -"program you can run, and this can be invoked from a handler using :mod:" -"`subprocess`. It's assumed here that TTS command line programs won't expect " -"to interact with users or take a long time to complete, and that the " -"frequency of logged messages will be not so high as to swamp the user with " -"messages, and that it's acceptable to have the messages spoken one at a time " -"rather than concurrently, The example implementation below waits for one " -"message to be spoken before the next is processed, and this might cause " -"other handlers to be kept waiting. Here is a short example showing the " +"program you can run, and this can be invoked from a handler " +"using :mod:`subprocess`. It's assumed here that TTS command line programs " +"won't expect to interact with users or take a long time to complete, and " +"that the frequency of logged messages will be not so high as to swamp the " +"user with messages, and that it's acceptable to have the messages spoken one " +"at a time rather than concurrently, The example implementation below waits " +"for one message to be spoken before the next is processed, and this might " +"cause other handlers to be kept waiting. Here is a short example showing the " "approach, which assumes that the ``espeak`` TTS package is available::" msgstr "" -#: ../../howto/logging-cookbook.rst:2987 +#: ../../howto/logging-cookbook.rst:3000 msgid "" "import logging\n" "import subprocess\n" @@ -3955,24 +3977,24 @@ msgid "" " sys.exit(main())" msgstr "" -#: ../../howto/logging-cookbook.rst:3016 +#: ../../howto/logging-cookbook.rst:3029 msgid "" "When run, this script should say \"Hello\" and then \"Goodbye\" in a female " "voice." msgstr "" -#: ../../howto/logging-cookbook.rst:3018 +#: ../../howto/logging-cookbook.rst:3031 msgid "" "The above approach can, of course, be adapted to other TTS systems and even " "other systems altogether which can process messages via external programs " "run from a command line." msgstr "" -#: ../../howto/logging-cookbook.rst:3026 +#: ../../howto/logging-cookbook.rst:3039 msgid "Buffering logging messages and outputting them conditionally" msgstr "" -#: ../../howto/logging-cookbook.rst:3028 +#: ../../howto/logging-cookbook.rst:3041 msgid "" "There might be situations where you want to log messages in a temporary area " "and only output them if a certain condition occurs. For example, you may " @@ -3982,7 +4004,7 @@ msgid "" "debug information to be output as well as the error." msgstr "" -#: ../../howto/logging-cookbook.rst:3035 +#: ../../howto/logging-cookbook.rst:3048 msgid "" "Here is an example which shows how you could do this using a decorator for " "your functions where you want logging to behave this way. It makes use of " @@ -3995,7 +4017,7 @@ msgid "" "subclass of ``MemoryHandler`` if you want custom flushing behavior." msgstr "" -#: ../../howto/logging-cookbook.rst:3045 +#: ../../howto/logging-cookbook.rst:3058 msgid "" "The example script has a simple function, ``foo``, which just cycles through " "all the logging levels, writing to ``sys.stderr`` to say what level it's " @@ -4004,23 +4026,23 @@ msgid "" "levels - otherwise, it only logs at DEBUG, INFO and WARNING levels." msgstr "" -#: ../../howto/logging-cookbook.rst:3051 +#: ../../howto/logging-cookbook.rst:3064 msgid "" "The script just arranges to decorate ``foo`` with a decorator which will do " "the conditional logging that's required. The decorator takes a logger as a " "parameter and attaches a memory handler for the duration of the call to the " "decorated function. The decorator can be additionally parameterised using a " "target handler, a level at which flushing should occur, and a capacity for " -"the buffer (number of records buffered). These default to a :class:`~logging." -"StreamHandler` which writes to ``sys.stderr``, ``logging.ERROR`` and ``100`` " -"respectively." +"the buffer (number of records buffered). These default to " +"a :class:`~logging.StreamHandler` which writes to ``sys.stderr``, " +"``logging.ERROR`` and ``100`` respectively." msgstr "" -#: ../../howto/logging-cookbook.rst:3059 +#: ../../howto/logging-cookbook.rst:3072 msgid "Here's the script::" msgstr "" -#: ../../howto/logging-cookbook.rst:3061 +#: ../../howto/logging-cookbook.rst:3074 msgid "" "import logging\n" "from logging.handlers import MemoryHandler\n" @@ -4086,11 +4108,11 @@ msgid "" " assert decorated_foo(True)" msgstr "" -#: ../../howto/logging-cookbook.rst:3122 +#: ../../howto/logging-cookbook.rst:3135 msgid "When this script is run, the following output should be observed:" msgstr "" -#: ../../howto/logging-cookbook.rst:3124 +#: ../../howto/logging-cookbook.rst:3137 msgid "" "Calling undecorated foo with False\n" "about to log at DEBUG ...\n" @@ -4119,40 +4141,41 @@ msgid "" "Actually logged at CRITICAL" msgstr "" -#: ../../howto/logging-cookbook.rst:3152 +#: ../../howto/logging-cookbook.rst:3165 msgid "" "As you can see, actual logging output only occurs when an event is logged " "whose severity is ERROR or greater, but in that case, any previous events at " "lower severities are also logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3156 +#: ../../howto/logging-cookbook.rst:3169 msgid "You can of course use the conventional means of decoration::" msgstr "" -#: ../../howto/logging-cookbook.rst:3158 +#: ../../howto/logging-cookbook.rst:3171 msgid "" "@log_if_errors(logger)\n" "def foo(fail=False):\n" " ..." msgstr "" -#: ../../howto/logging-cookbook.rst:3166 +#: ../../howto/logging-cookbook.rst:3179 msgid "Sending logging messages to email, with buffering" msgstr "" -#: ../../howto/logging-cookbook.rst:3168 +#: ../../howto/logging-cookbook.rst:3181 msgid "" "To illustrate how you can send log messages via email, so that a set number " -"of messages are sent per email, you can subclass :class:`~logging.handlers." -"BufferingHandler`. In the following example, which you can adapt to suit " -"your specific needs, a simple test harness is provided which allows you to " -"run the script with command line arguments specifying what you typically " -"need to send things via SMTP. (Run the downloaded script with the ``-h`` " -"argument to see the required and optional arguments.)" +"of messages are sent per email, you can " +"subclass :class:`~logging.handlers.BufferingHandler`. In the following " +"example, which you can adapt to suit your specific needs, a simple test " +"harness is provided which allows you to run the script with command line " +"arguments specifying what you typically need to send things via SMTP. (Run " +"the downloaded script with the ``-h`` argument to see the required and " +"optional arguments.)" msgstr "" -#: ../../howto/logging-cookbook.rst:3176 +#: ../../howto/logging-cookbook.rst:3189 msgid "" "import logging\n" "import logging.handlers\n" @@ -4172,8 +4195,8 @@ msgid "" " toaddrs = [toaddrs]\n" " self.toaddrs = toaddrs\n" " self.subject = subject\n" -" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s " -"%(message)s\"))\n" +" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s %" +"(message)s\"))\n" "\n" " def flush(self):\n" " if len(self.buffer) > 0:\n" @@ -4220,7 +4243,7 @@ msgid "" " h.close()" msgstr "" -#: ../../howto/logging-cookbook.rst:3240 +#: ../../howto/logging-cookbook.rst:3253 msgid "" "If you run this script and your SMTP server is correctly set up, you should " "find that it sends eleven emails to the addressee you specify. The first ten " @@ -4228,17 +4251,17 @@ msgid "" "messages. That makes up 102 messages as specified in the script." msgstr "" -#: ../../howto/logging-cookbook.rst:3248 +#: ../../howto/logging-cookbook.rst:3261 msgid "Formatting times using UTC (GMT) via configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:3250 +#: ../../howto/logging-cookbook.rst:3263 msgid "" "Sometimes you want to format times using UTC, which can be done using a " "class such as ``UTCFormatter``, shown below::" msgstr "" -#: ../../howto/logging-cookbook.rst:3253 +#: ../../howto/logging-cookbook.rst:3266 msgid "" "import logging\n" "import time\n" @@ -4247,15 +4270,15 @@ msgid "" " converter = time.gmtime" msgstr "" -#: ../../howto/logging-cookbook.rst:3259 +#: ../../howto/logging-cookbook.rst:3272 msgid "" -"and you can then use the ``UTCFormatter`` in your code instead of :class:" -"`~logging.Formatter`. If you want to do that via configuration, you can use " -"the :func:`~logging.config.dictConfig` API with an approach illustrated by " -"the following complete example::" +"and you can then use the ``UTCFormatter`` in your code instead " +"of :class:`~logging.Formatter`. If you want to do that via configuration, " +"you can use the :func:`~logging.config.dictConfig` API with an approach " +"illustrated by the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:3264 +#: ../../howto/logging-cookbook.rst:3277 msgid "" "import logging\n" "import logging.config\n" @@ -4296,11 +4319,11 @@ msgid "" " logging.warning('The local time is %s', time.asctime())" msgstr "" -#: ../../howto/logging-cookbook.rst:3302 +#: ../../howto/logging-cookbook.rst:3315 msgid "When this script is run, it should print something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:3304 +#: ../../howto/logging-cookbook.rst:3317 msgid "" "2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" "2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" @@ -4308,17 +4331,17 @@ msgstr "" "2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" "2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" -#: ../../howto/logging-cookbook.rst:3309 +#: ../../howto/logging-cookbook.rst:3322 msgid "" "showing how the time is formatted both as local time and UTC, one for each " "handler." msgstr "" -#: ../../howto/logging-cookbook.rst:3316 +#: ../../howto/logging-cookbook.rst:3329 msgid "Using a context manager for selective logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3318 +#: ../../howto/logging-cookbook.rst:3331 msgid "" "There are times when it would be useful to temporarily change the logging " "configuration and revert it back after doing something. For this, a context " @@ -4328,7 +4351,7 @@ msgid "" "scope of the context manager::" msgstr "" -#: ../../howto/logging-cookbook.rst:3325 +#: ../../howto/logging-cookbook.rst:3338 msgid "" "import logging\n" "import sys\n" @@ -4357,7 +4380,7 @@ msgid "" " # implicit return of None => don't swallow exceptions" msgstr "" -#: ../../howto/logging-cookbook.rst:3351 +#: ../../howto/logging-cookbook.rst:3364 msgid "" "If you specify a level value, the logger's level is set to that value in the " "scope of the with block covered by the context manager. If you specify a " @@ -4366,13 +4389,13 @@ msgid "" "block exit - you could do this if you don't need the handler any more." msgstr "" -#: ../../howto/logging-cookbook.rst:3357 +#: ../../howto/logging-cookbook.rst:3370 msgid "" "To illustrate how it works, we can add the following block of code to the " "above::" msgstr "" -#: ../../howto/logging-cookbook.rst:3360 +#: ../../howto/logging-cookbook.rst:3373 msgid "" "if __name__ == '__main__':\n" " logger = logging.getLogger('foo')\n" @@ -4392,7 +4415,7 @@ msgid "" " logger.debug('7. This should not appear.')" msgstr "" -#: ../../howto/logging-cookbook.rst:3375 +#: ../../howto/logging-cookbook.rst:3388 msgid "" "We initially set the logger's level to ``INFO``, so message #1 appears and " "message #2 doesn't. We then change the level to ``DEBUG`` temporarily in the " @@ -4405,11 +4428,11 @@ msgid "" "(like message #1) whereas message #7 doesn't (just like message #2)." msgstr "" -#: ../../howto/logging-cookbook.rst:3385 +#: ../../howto/logging-cookbook.rst:3398 msgid "If we run the resulting script, the result is as follows:" msgstr "" -#: ../../howto/logging-cookbook.rst:3387 +#: ../../howto/logging-cookbook.rst:3400 msgid "" "$ python logctx.py\n" "1. This should appear just once on stderr.\n" @@ -4419,23 +4442,23 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -#: ../../howto/logging-cookbook.rst:3396 +#: ../../howto/logging-cookbook.rst:3409 msgid "" "If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the " "following, which is the only message written to ``stdout``:" msgstr "" -#: ../../howto/logging-cookbook.rst:3399 +#: ../../howto/logging-cookbook.rst:3412 msgid "" "$ python logctx.py 2>/dev/null\n" "5. This should appear twice - once on stderr and once on stdout." msgstr "" -#: ../../howto/logging-cookbook.rst:3404 +#: ../../howto/logging-cookbook.rst:3417 msgid "Once again, but piping ``stdout`` to ``/dev/null``, we get:" msgstr "" -#: ../../howto/logging-cookbook.rst:3406 +#: ../../howto/logging-cookbook.rst:3419 msgid "" "$ python logctx.py >/dev/null\n" "1. This should appear just once on stderr.\n" @@ -4444,53 +4467,53 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -#: ../../howto/logging-cookbook.rst:3414 +#: ../../howto/logging-cookbook.rst:3427 msgid "" "In this case, the message #5 printed to ``stdout`` doesn't appear, as " "expected." msgstr "" -#: ../../howto/logging-cookbook.rst:3416 +#: ../../howto/logging-cookbook.rst:3429 msgid "" "Of course, the approach described here can be generalised, for example to " "attach logging filters temporarily. Note that the above code works in Python " "2 as well as Python 3." msgstr "" -#: ../../howto/logging-cookbook.rst:3424 +#: ../../howto/logging-cookbook.rst:3437 msgid "A CLI application starter template" msgstr "" -#: ../../howto/logging-cookbook.rst:3426 +#: ../../howto/logging-cookbook.rst:3439 msgid "Here's an example which shows how you can:" msgstr "" -#: ../../howto/logging-cookbook.rst:3428 +#: ../../howto/logging-cookbook.rst:3441 msgid "Use a logging level based on command-line arguments" msgstr "" -#: ../../howto/logging-cookbook.rst:3429 +#: ../../howto/logging-cookbook.rst:3442 msgid "" "Dispatch to multiple subcommands in separate files, all logging at the same " "level in a consistent way" msgstr "" -#: ../../howto/logging-cookbook.rst:3431 +#: ../../howto/logging-cookbook.rst:3444 msgid "Make use of simple, minimal configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:3433 +#: ../../howto/logging-cookbook.rst:3446 msgid "" "Suppose we have a command-line application whose job is to stop, start or " "restart some services. This could be organised for the purposes of " "illustration as a file ``app.py`` that is the main script for the " -"application, with individual commands implemented in ``start.py``, ``stop." -"py`` and ``restart.py``. Suppose further that we want to control the " +"application, with individual commands implemented in ``start.py``, " +"``stop.py`` and ``restart.py``. Suppose further that we want to control the " "verbosity of the application via a command-line argument, defaulting to " "``logging.INFO``. Here's one way that ``app.py`` could be written::" msgstr "" -#: ../../howto/logging-cookbook.rst:3441 +#: ../../howto/logging-cookbook.rst:3454 msgid "" "import argparse\n" "import importlib\n" @@ -4525,8 +4548,8 @@ msgid "" " mod = importlib.import_module(options.command)\n" " cmd = getattr(mod, 'command')\n" " except (ImportError, AttributeError):\n" -" print('Unable to find the code for command \\'%s\\'' % options." -"command)\n" +" print('Unable to find the code for command \\'%s\\'' % " +"options.command)\n" " return 1\n" " # Could get fancy here and load configuration from file or dictionary\n" " logging.basicConfig(level=options.log_level,\n" @@ -4537,13 +4560,13 @@ msgid "" " sys.exit(main())" msgstr "" -#: ../../howto/logging-cookbook.rst:3482 +#: ../../howto/logging-cookbook.rst:3495 msgid "" "And the ``start``, ``stop`` and ``restart`` commands can be implemented in " "separate modules, like so for starting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3485 +#: ../../howto/logging-cookbook.rst:3498 msgid "" "# start.py\n" "import logging\n" @@ -4556,11 +4579,11 @@ msgid "" " logger.info('Started the \\'%s\\' service.', options.name)" msgstr "" -#: ../../howto/logging-cookbook.rst:3495 +#: ../../howto/logging-cookbook.rst:3508 msgid "and thus for stopping::" msgstr "" -#: ../../howto/logging-cookbook.rst:3497 +#: ../../howto/logging-cookbook.rst:3510 msgid "" "# stop.py\n" "import logging\n" @@ -4582,11 +4605,11 @@ msgid "" " logger.info('Stopped the %s service%s.', services, plural)" msgstr "" -#: ../../howto/logging-cookbook.rst:3516 +#: ../../howto/logging-cookbook.rst:3529 msgid "and similarly for restarting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3518 +#: ../../howto/logging-cookbook.rst:3531 msgid "" "# restart.py\n" "import logging\n" @@ -4608,13 +4631,13 @@ msgid "" " logger.info('Restarted the %s service%s.', services, plural)" msgstr "" -#: ../../howto/logging-cookbook.rst:3537 +#: ../../howto/logging-cookbook.rst:3550 msgid "" "If we run this application with the default log level, we get output like " "this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3539 +#: ../../howto/logging-cookbook.rst:3552 msgid "" "$ python app.py start foo\n" "INFO start Started the 'foo' service.\n" @@ -4626,19 +4649,19 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" -#: ../../howto/logging-cookbook.rst:3550 +#: ../../howto/logging-cookbook.rst:3563 msgid "" "The first word is the logging level, and the second word is the module or " "package name of the place where the event was logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3553 +#: ../../howto/logging-cookbook.rst:3566 msgid "" "If we change the logging level, then we can change the information sent to " "the log. For example, if we want more information:" msgstr "" -#: ../../howto/logging-cookbook.rst:3556 +#: ../../howto/logging-cookbook.rst:3569 msgid "" "$ python app.py --log-level DEBUG start foo\n" "DEBUG start About to start foo\n" @@ -4653,36 +4676,36 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" -#: ../../howto/logging-cookbook.rst:3570 +#: ../../howto/logging-cookbook.rst:3583 msgid "And if we want less:" msgstr "" -#: ../../howto/logging-cookbook.rst:3572 +#: ../../howto/logging-cookbook.rst:3585 msgid "" "$ python app.py --log-level WARNING start foo\n" "$ python app.py --log-level WARNING stop foo bar\n" "$ python app.py --log-level WARNING restart foo bar baz" msgstr "" -#: ../../howto/logging-cookbook.rst:3578 +#: ../../howto/logging-cookbook.rst:3591 msgid "" "In this case, the commands don't print anything to the console, since " "nothing at ``WARNING`` level or above is logged by them." msgstr "" -#: ../../howto/logging-cookbook.rst:3584 +#: ../../howto/logging-cookbook.rst:3597 msgid "A Qt GUI for logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3586 +#: ../../howto/logging-cookbook.rst:3599 msgid "" "A question that comes up from time to time is about how to log to a GUI " "application. The `Qt `_ framework is a popular cross-" -"platform UI framework with Python bindings using :pypi:`PySide2` or :pypi:" -"`PyQt5` libraries." +"platform UI framework with Python bindings using :pypi:`PySide2` " +"or :pypi:`PyQt5` libraries." msgstr "" -#: ../../howto/logging-cookbook.rst:3591 +#: ../../howto/logging-cookbook.rst:3604 msgid "" "The following example shows how to log to a Qt GUI. This introduces a simple " "``QtHandler`` class which takes a callable, which should be a slot in the " @@ -4692,14 +4715,14 @@ msgid "" "logging messages at random levels with random short delays in between)." msgstr "" -#: ../../howto/logging-cookbook.rst:3598 +#: ../../howto/logging-cookbook.rst:3611 msgid "" "The worker thread is implemented using Qt's ``QThread`` class rather than " "the :mod:`threading` module, as there are circumstances where one has to use " "``QThread``, which offers better integration with other ``Qt`` components." msgstr "" -#: ../../howto/logging-cookbook.rst:3602 +#: ../../howto/logging-cookbook.rst:3615 msgid "" "The code should work with recent releases of any of ``PySide6``, ``PyQt6``, " "``PySide2`` or ``PyQt5``. You should be able to adapt the approach to " @@ -4707,7 +4730,7 @@ msgid "" "more detailed information." msgstr "" -#: ../../howto/logging-cookbook.rst:3607 +#: ../../howto/logging-cookbook.rst:3620 msgid "" "import datetime\n" "import logging\n" @@ -4890,8 +4913,8 @@ msgid "" " self.start_thread()\n" " self.work_button.clicked.connect(self.worker.start)\n" " # Once started, the button should be disabled\n" -" self.work_button.clicked.connect(lambda : self.work_button." -"setEnabled(False))\n" +" self.work_button.clicked.connect(lambda : " +"self.work_button.setEnabled(False))\n" "\n" " def start_thread(self):\n" " self.worker = Worker()\n" @@ -4958,28 +4981,29 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:3839 +#: ../../howto/logging-cookbook.rst:3852 msgid "Logging to syslog with RFC5424 support" msgstr "" -#: ../../howto/logging-cookbook.rst:3841 +#: ../../howto/logging-cookbook.rst:3854 msgid "" "Although :rfc:`5424` dates from 2009, most syslog servers are configured by " "default to use the older :rfc:`3164`, which hails from 2001. When " "``logging`` was added to Python in 2003, it supported the earlier (and only " "existing) protocol at the time. Since RFC5424 came out, as there has not " -"been widespread deployment of it in syslog servers, the :class:`~logging." -"handlers.SysLogHandler` functionality has not been updated." +"been widespread deployment of it in syslog servers, " +"the :class:`~logging.handlers.SysLogHandler` functionality has not been " +"updated." msgstr "" -#: ../../howto/logging-cookbook.rst:3848 +#: ../../howto/logging-cookbook.rst:3861 msgid "" "RFC 5424 contains some useful features such as support for structured data, " "and if you need to be able to log to a syslog server with support for it, " "you can do so with a subclassed handler which looks something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3852 +#: ../../howto/logging-cookbook.rst:3865 msgid "" "import datetime\n" "import logging.handlers\n" @@ -4999,8 +5023,8 @@ msgid "" "\n" " def format(self, record):\n" " version = 1\n" -" asctime = datetime.datetime.fromtimestamp(record.created)." -"isoformat()\n" +" asctime = " +"datetime.datetime.fromtimestamp(record.created).isoformat()\n" " m = self.tz_offset.match(time.strftime('%z'))\n" " has_offset = False\n" " if m and time.timezone:\n" @@ -5049,7 +5073,7 @@ msgid "" "{sdata} {msg}'" msgstr "" -#: ../../howto/logging-cookbook.rst:3914 +#: ../../howto/logging-cookbook.rst:3927 msgid "" "You'll need to be familiar with RFC 5424 to fully understand the above code, " "and it may be that you have slightly different needs (e.g. for how you pass " @@ -5058,7 +5082,7 @@ msgid "" "using something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3919 +#: ../../howto/logging-cookbook.rst:3932 msgid "" "sd = {\n" " 'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n" @@ -5076,11 +5100,11 @@ msgstr "" "i = 1\n" "logger.debug('Message %d', i, extra=extra)" -#: ../../howto/logging-cookbook.rst:3928 +#: ../../howto/logging-cookbook.rst:3941 msgid "How to treat a logger like an output stream" msgstr "" -#: ../../howto/logging-cookbook.rst:3930 +#: ../../howto/logging-cookbook.rst:3943 msgid "" "Sometimes, you need to interface to a third-party API which expects a file-" "like object to write to, but you want to direct the API's output to a " @@ -5088,7 +5112,7 @@ msgid "" "API. Here's a short script illustrating such a class:" msgstr "" -#: ../../howto/logging-cookbook.rst:3935 +#: ../../howto/logging-cookbook.rst:3948 msgid "" "import logging\n" "\n" @@ -5126,11 +5150,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:3970 +#: ../../howto/logging-cookbook.rst:3983 msgid "When this script is run, it prints" msgstr "" -#: ../../howto/logging-cookbook.rst:3972 +#: ../../howto/logging-cookbook.rst:3985 msgid "" "INFO:demo:An INFO message\n" "DEBUG:demo:A DEBUG message" @@ -5138,13 +5162,13 @@ msgstr "" "INFO:demo:An INFO message\n" "DEBUG:demo:A DEBUG message" -#: ../../howto/logging-cookbook.rst:3977 +#: ../../howto/logging-cookbook.rst:3990 msgid "" -"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and ``sys." -"stderr`` by doing something like this:" +"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and " +"``sys.stderr`` by doing something like this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3980 +#: ../../howto/logging-cookbook.rst:3993 msgid "" "import sys\n" "\n" @@ -5156,15 +5180,15 @@ msgstr "" "sys.stdout = LoggerWriter(logger, logging.INFO)\n" "sys.stderr = LoggerWriter(logger, logging.WARNING)" -#: ../../howto/logging-cookbook.rst:3987 +#: ../../howto/logging-cookbook.rst:4000 msgid "" "You should do this *after* configuring logging for your needs. In the above " -"example, the :func:`~logging.basicConfig` call does this (using the ``sys." -"stderr`` value *before* it is overwritten by a ``LoggerWriter`` instance). " -"Then, you'd get this kind of result:" +"example, the :func:`~logging.basicConfig` call does this (using the " +"``sys.stderr`` value *before* it is overwritten by a ``LoggerWriter`` " +"instance). Then, you'd get this kind of result:" msgstr "" -#: ../../howto/logging-cookbook.rst:3992 +#: ../../howto/logging-cookbook.rst:4005 msgid "" ">>> print('Foo')\n" "INFO:demo:Foo\n" @@ -5178,31 +5202,31 @@ msgstr "" "WARNING:demo:Bar\n" ">>>" -#: ../../howto/logging-cookbook.rst:4000 +#: ../../howto/logging-cookbook.rst:4013 msgid "" -"Of course, the examples above show output according to the format used by :" -"func:`~logging.basicConfig`, but you can use a different formatter when you " -"configure logging." +"Of course, the examples above show output according to the format used " +"by :func:`~logging.basicConfig`, but you can use a different formatter when " +"you configure logging." msgstr "" -#: ../../howto/logging-cookbook.rst:4004 +#: ../../howto/logging-cookbook.rst:4017 msgid "" "Note that with the above scheme, you are somewhat at the mercy of buffering " "and the sequence of write calls which you are intercepting. For example, " "with the definition of ``LoggerWriter`` above, if you have the snippet" msgstr "" -#: ../../howto/logging-cookbook.rst:4008 +#: ../../howto/logging-cookbook.rst:4021 msgid "" "sys.stderr = LoggerWriter(logger, logging.WARNING)\n" "1 / 0" msgstr "" -#: ../../howto/logging-cookbook.rst:4013 +#: ../../howto/logging-cookbook.rst:4026 msgid "then running the script results in" msgstr "" -#: ../../howto/logging-cookbook.rst:4015 +#: ../../howto/logging-cookbook.rst:4028 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "\n" @@ -5221,7 +5245,7 @@ msgid "" "WARNING:demo:division by zero" msgstr "" -#: ../../howto/logging-cookbook.rst:4031 +#: ../../howto/logging-cookbook.rst:4044 msgid "" "As you can see, this output isn't ideal. That's because the underlying code " "which writes to ``sys.stderr`` makes multiple writes, each of which results " @@ -5231,7 +5255,7 @@ msgid "" "``LoggerWriter``:" msgstr "" -#: ../../howto/logging-cookbook.rst:4037 +#: ../../howto/logging-cookbook.rst:4050 msgid "" "class BufferingLoggerWriter(LoggerWriter):\n" " def __init__(self, logger, level):\n" @@ -5267,13 +5291,13 @@ msgstr "" " for part in parts:\n" " self.logger.log(self.level, part)" -#: ../../howto/logging-cookbook.rst:4056 +#: ../../howto/logging-cookbook.rst:4069 msgid "" "This just buffers up stuff until a newline is seen, and then logs complete " "lines. With this approach, you get better output:" msgstr "" -#: ../../howto/logging-cookbook.rst:4059 +#: ../../howto/logging-cookbook.rst:4072 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, " @@ -5293,11 +5317,11 @@ msgstr "" "WARNING:demo: 1/0\n" "WARNING:demo:ZeroDivisionError: division by zero" -#: ../../howto/logging-cookbook.rst:4069 +#: ../../howto/logging-cookbook.rst:4082 msgid "How to uniformly handle newlines in logging output" msgstr "" -#: ../../howto/logging-cookbook.rst:4071 +#: ../../howto/logging-cookbook.rst:4084 msgid "" "Usually, messages that are logged (say to console or file) consist of a " "single line of text. However, sometimes there is a need to handle messages " @@ -5308,7 +5332,7 @@ msgid "" "handler mixin, as in the following snippet:" msgstr "" -#: ../../howto/logging-cookbook.rst:4079 +#: ../../howto/logging-cookbook.rst:4092 msgid "" "# Assume this is in a module mymixins.py\n" "import copy\n" @@ -5327,11 +5351,11 @@ msgid "" " super().emit(rec)" msgstr "" -#: ../../howto/logging-cookbook.rst:4097 +#: ../../howto/logging-cookbook.rst:4110 msgid "You can use the mixin as in the following script:" msgstr "" -#: ../../howto/logging-cookbook.rst:4099 +#: ../../howto/logging-cookbook.rst:4112 msgid "" "import logging\n" "\n" @@ -5343,8 +5367,8 @@ msgid "" " pass\n" "\n" "if __name__ == '__main__':\n" -" logging.basicConfig(level=logging.DEBUG, format='%(asctime)s " -"%(levelname)-9s %(message)s',\n" +" logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %" +"(levelname)-9s %(message)s',\n" " handlers = [StreamHandler()])\n" " logger.debug('Single line')\n" " logger.debug('Multiple lines:\\nfool me once ...')\n" @@ -5353,11 +5377,11 @@ msgid "" "again')" msgstr "" -#: ../../howto/logging-cookbook.rst:4118 +#: ../../howto/logging-cookbook.rst:4131 msgid "The script, when run, prints something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:4120 +#: ../../howto/logging-cookbook.rst:4133 msgid "" "2025-07-02 13:54:47,234 DEBUG Single line\n" "2025-07-02 13:54:47,234 DEBUG Multiple lines:\n" @@ -5368,14 +5392,14 @@ msgid "" "2025-07-02 13:54:47,234 DEBUG can't get fooled again" msgstr "" -#: ../../howto/logging-cookbook.rst:4130 +#: ../../howto/logging-cookbook.rst:4143 msgid "" -"If, on the other hand, you are concerned about `log injection `_, you can use a formatter which " -"escapes newlines, as per the following example:" +"If, on the other hand, you are concerned about `log injection `_, you can use a formatter " +"which escapes newlines, as per the following example:" msgstr "" -#: ../../howto/logging-cookbook.rst:4134 +#: ../../howto/logging-cookbook.rst:4147 msgid "" "import logging\n" "\n" @@ -5388,8 +5412,8 @@ msgid "" "\n" "if __name__ == '__main__':\n" " h = logging.StreamHandler()\n" -" h.setFormatter(EscapingFormatter('%(asctime)s %(levelname)-9s " -"%(message)s'))\n" +" h.setFormatter(EscapingFormatter('%(asctime)s %(levelname)-9s %" +"(message)s'))\n" " logging.basicConfig(level=logging.DEBUG, handlers = [h])\n" " logger.debug('Single line')\n" " logger.debug('Multiple lines:\\nfool me once ...')\n" @@ -5398,13 +5422,13 @@ msgid "" "again')" msgstr "" -#: ../../howto/logging-cookbook.rst:4154 +#: ../../howto/logging-cookbook.rst:4167 msgid "" "You can, of course, use whatever escaping scheme makes the most sense for " "you. The script, when run, should produce output like this:" msgstr "" -#: ../../howto/logging-cookbook.rst:4157 +#: ../../howto/logging-cookbook.rst:4170 msgid "" "2025-07-09 06:47:33,783 DEBUG Single line\n" "2025-07-09 06:47:33,783 DEBUG Multiple lines:\\nfool me once ...\n" @@ -5413,17 +5437,17 @@ msgid "" "fooled again" msgstr "" -#: ../../howto/logging-cookbook.rst:4164 +#: ../../howto/logging-cookbook.rst:4177 msgid "" "Escaping behaviour can't be the stdlib default , as it would break backwards " "compatibility." msgstr "" -#: ../../howto/logging-cookbook.rst:4170 +#: ../../howto/logging-cookbook.rst:4183 msgid "Patterns to avoid" msgstr "" -#: ../../howto/logging-cookbook.rst:4172 +#: ../../howto/logging-cookbook.rst:4185 msgid "" "Although the preceding sections have described ways of doing things you " "might need to do or deal with, it is worth mentioning some usage patterns " @@ -5431,11 +5455,11 @@ msgid "" "The following sections are in no particular order." msgstr "" -#: ../../howto/logging-cookbook.rst:4178 +#: ../../howto/logging-cookbook.rst:4191 msgid "Opening the same log file multiple times" msgstr "" -#: ../../howto/logging-cookbook.rst:4180 +#: ../../howto/logging-cookbook.rst:4193 msgid "" "On Windows, you will generally not be able to open the same file multiple " "times as this will lead to a \"file is in use by another process\" error. " @@ -5443,32 +5467,32 @@ msgid "" "file multiple times. This could be done accidentally, for example by:" msgstr "" -#: ../../howto/logging-cookbook.rst:4185 +#: ../../howto/logging-cookbook.rst:4198 msgid "" "Adding a file handler more than once which references the same file (e.g. by " "a copy/paste/forget-to-change error)." msgstr "" -#: ../../howto/logging-cookbook.rst:4188 +#: ../../howto/logging-cookbook.rst:4201 msgid "" "Opening two files that look different, as they have different names, but are " "the same because one is a symbolic link to the other." msgstr "" -#: ../../howto/logging-cookbook.rst:4191 +#: ../../howto/logging-cookbook.rst:4204 msgid "" "Forking a process, following which both parent and child have a reference to " "the same file. This might be through use of the :mod:`multiprocessing` " "module, for example." msgstr "" -#: ../../howto/logging-cookbook.rst:4195 +#: ../../howto/logging-cookbook.rst:4208 msgid "" "Opening a file multiple times might *appear* to work most of the time, but " "can lead to a number of problems in practice:" msgstr "" -#: ../../howto/logging-cookbook.rst:4198 +#: ../../howto/logging-cookbook.rst:4211 msgid "" "Logging output can be garbled because multiple threads or processes try to " "write to the same file. Although logging guards against concurrent use of " @@ -5477,7 +5501,7 @@ msgid "" "different handler instances which happen to point to the same file." msgstr "" -#: ../../howto/logging-cookbook.rst:4204 +#: ../../howto/logging-cookbook.rst:4217 msgid "" "An attempt to delete a file (e.g. during file rotation) silently fails, " "because there is another reference pointing to it. This can lead to " @@ -5487,17 +5511,17 @@ msgid "" "being supposedly in place." msgstr "" -#: ../../howto/logging-cookbook.rst:4211 +#: ../../howto/logging-cookbook.rst:4224 msgid "" "Use the techniques outlined in :ref:`multiple-processes` to circumvent such " "issues." msgstr "" -#: ../../howto/logging-cookbook.rst:4215 +#: ../../howto/logging-cookbook.rst:4228 msgid "Using loggers as attributes in a class or passing them as parameters" msgstr "" -#: ../../howto/logging-cookbook.rst:4217 +#: ../../howto/logging-cookbook.rst:4230 msgid "" "While there might be unusual cases where you'll need to do this, in general " "there is no point because loggers are singletons. Code can always access a " @@ -5508,13 +5532,13 @@ msgid "" "module (and not the class) is the unit of software decomposition." msgstr "" -#: ../../howto/logging-cookbook.rst:4226 +#: ../../howto/logging-cookbook.rst:4239 msgid "" "Adding handlers other than :class:`~logging.NullHandler` to a logger in a " "library" msgstr "" -#: ../../howto/logging-cookbook.rst:4228 +#: ../../howto/logging-cookbook.rst:4241 msgid "" "Configuring logging by adding handlers, formatters and filters is the " "responsibility of the application developer, not the library developer. If " @@ -5522,11 +5546,11 @@ msgid "" "your loggers other than a :class:`~logging.NullHandler` instance." msgstr "" -#: ../../howto/logging-cookbook.rst:4234 +#: ../../howto/logging-cookbook.rst:4247 msgid "Creating a lot of loggers" msgstr "" -#: ../../howto/logging-cookbook.rst:4236 +#: ../../howto/logging-cookbook.rst:4249 msgid "" "Loggers are singletons that are never freed during a script execution, and " "so creating lots of loggers will use up memory which can't then be freed. " @@ -5537,38 +5561,38 @@ msgid "" "occasionally slightly more fine-grained than that)." msgstr "" -#: ../../howto/logging-cookbook.rst:4247 +#: ../../howto/logging-cookbook.rst:4260 msgid "Other resources" msgstr "其他資源" -#: ../../howto/logging-cookbook.rst:4251 +#: ../../howto/logging-cookbook.rst:4264 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../howto/logging-cookbook.rst:4252 +#: ../../howto/logging-cookbook.rst:4265 msgid "API reference for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4254 +#: ../../howto/logging-cookbook.rst:4267 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../howto/logging-cookbook.rst:4255 +#: ../../howto/logging-cookbook.rst:4268 msgid "Configuration API for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4257 +#: ../../howto/logging-cookbook.rst:4270 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../howto/logging-cookbook.rst:4258 +#: ../../howto/logging-cookbook.rst:4271 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4260 +#: ../../howto/logging-cookbook.rst:4273 msgid ":ref:`Basic Tutorial `" msgstr ":ref:`基礎教學 `" -#: ../../howto/logging-cookbook.rst:4262 +#: ../../howto/logging-cookbook.rst:4275 msgid ":ref:`Advanced Tutorial `" msgstr ":ref:`進階教學 `" diff --git a/howto/logging.po b/howto/logging.po index 42a56983bca..20dd6141011 100644 --- a/howto/logging.po +++ b/howto/logging.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-22 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -63,10 +63,10 @@ msgstr "什麼時候使用 logging" #: ../../howto/logging.rst:30 msgid "" "You can access logging functionality by creating a logger via ``logger = " -"getLogger(__name__)``, and then calling the logger's :meth:`~Logger.debug`, :" -"meth:`~Logger.info`, :meth:`~Logger.warning`, :meth:`~Logger.error` and :" -"meth:`~Logger.critical` methods. To determine when to use logging, and to " -"see which logger methods to use when, see the table below. It states, for " +"getLogger(__name__)``, and then calling the " +"logger's :meth:`~Logger.debug`, :meth:`~Logger.info`, :meth:`~Logger.warning`, :meth:`~Logger.error` " +"and :meth:`~Logger.critical` methods. To determine when to use logging, and " +"to see which logger methods to use when, see the table below. It states, for " "each of a set of common tasks, the best tool to use for that task." msgstr "" @@ -131,8 +131,8 @@ msgstr "" #: ../../howto/logging.rst:63 msgid "" -"A logger's :meth:`~Logger.error`, :meth:`~Logger.exception` or :meth:" -"`~Logger.critical` method as appropriate for the specific error and " +"A logger's :meth:`~Logger.error`, :meth:`~Logger.exception` " +"or :meth:`~Logger.critical` method as appropriate for the specific error and " "application domain" msgstr "" @@ -243,8 +243,8 @@ msgstr "WARNING:root:Watch out!" msgid "" "printed out on the console. The ``INFO`` message doesn't appear because the " "default level is ``WARNING``. The printed message includes the indication of " -"the level and the description of the event provided in the logging call, i." -"e. 'Watch out!'. The actual output can be formatted quite flexibly if you " +"the level and the description of the event provided in the logging call, " +"i.e. 'Watch out!'. The actual output can be formatted quite flexibly if you " "need that; formatting options will also be explained later." msgstr "" @@ -252,7 +252,7 @@ msgstr "" msgid "" "Notice that in this example, we use functions directly on the ``logging`` " "module, like ``logging.debug``, rather than creating a logger and calling " -"functions on it. These functions operation on the root logger, but can be " +"functions on it. These functions operate on the root logger, but can be " "useful as they will call :func:`~logging.basicConfig` for you if it has not " "been called yet, like in this example. In larger programs you'll usually " "want to control the logging configuration explicitly however - so for that " @@ -276,8 +276,8 @@ msgstr "" msgid "" "import logging\n" "logger = logging.getLogger(__name__)\n" -"logging.basicConfig(filename='example.log', encoding='utf-8', level=logging." -"DEBUG)\n" +"logging.basicConfig(filename='example.log', encoding='utf-8', " +"level=logging.DEBUG)\n" "logger.debug('This message should go to the log file')\n" "logger.info('So should this')\n" "logger.warning('And this, too')\n" @@ -368,11 +368,11 @@ msgstr "" #: ../../howto/logging.rst:204 msgid "" -"logging.basicConfig(filename='example.log', filemode='w', level=logging." -"DEBUG)" +"logging.basicConfig(filename='example.log', filemode='w', " +"level=logging.DEBUG)" msgstr "" -"logging.basicConfig(filename='example.log', filemode='w', level=logging." -"DEBUG)" +"logging.basicConfig(filename='example.log', filemode='w', " +"level=logging.DEBUG)" #: ../../howto/logging.rst:206 msgid "" @@ -429,8 +429,8 @@ msgstr "" #: ../../howto/logging.rst:239 msgid "" "import logging\n" -"logging.basicConfig(format='%(levelname)s:%(message)s', level=logging." -"DEBUG)\n" +"logging.basicConfig(format='%(levelname)s:%(message)s', " +"level=logging.DEBUG)\n" "logging.debug('This message should appear on the console')\n" "logging.info('So should this')\n" "logging.warning('And this, too')" @@ -484,9 +484,9 @@ msgstr "" #: ../../howto/logging.rst:277 msgid "" -"The default format for date/time display (shown above) is like ISO8601 or :" -"rfc:`3339`. If you need more control over the formatting of the date/time, " -"provide a *datefmt* argument to ``basicConfig``, as in this example::" +"The default format for date/time display (shown above) is like ISO8601 " +"or :rfc:`3339`. If you need more control over the formatting of the date/" +"time, provide a *datefmt* argument to ``basicConfig``, as in this example::" msgstr "" #: ../../howto/logging.rst:281 @@ -507,8 +507,8 @@ msgstr "" #: ../../howto/logging.rst:291 msgid "" -"The format of the *datefmt* argument is the same as supported by :func:`time." -"strftime`." +"The format of the *datefmt* argument is the same as supported " +"by :func:`time.strftime`." msgstr "" #: ../../howto/logging.rst:296 @@ -606,10 +606,11 @@ msgstr "" #: ../../howto/logging.rst:348 msgid "" "The root of the hierarchy of loggers is called the root logger. That's the " -"logger used by the functions :func:`debug`, :func:`info`, :func:`warning`, :" -"func:`error` and :func:`critical`, which just call the same-named method of " -"the root logger. The functions and the methods have the same signatures. The " -"root logger's name is printed as 'root' in the logged output." +"logger used by the " +"functions :func:`debug`, :func:`info`, :func:`warning`, :func:`error` " +"and :func:`critical`, which just call the same-named method of the root " +"logger. The functions and the methods have the same signatures. The root " +"logger's name is printed as 'root' in the logged output." msgstr "" #: ../../howto/logging.rst:354 @@ -627,12 +628,12 @@ msgstr "" msgid "" "By default, no destination is set for any logging messages. You can specify " "a destination (such as console or file) by using :func:`basicConfig` as in " -"the tutorial examples. If you call the functions :func:`debug`, :func:" -"`info`, :func:`warning`, :func:`error` and :func:`critical`, they will check " -"to see if no destination is set; and if one is not set, they will set a " -"destination of the console (``sys.stderr``) and a default format for the " -"displayed message before delegating to the root logger to do the actual " -"message output." +"the tutorial examples. If you call the " +"functions :func:`debug`, :func:`info`, :func:`warning`, :func:`error` " +"and :func:`critical`, they will check to see if no destination is set; and " +"if one is not set, they will set a destination of the console " +"(``sys.stderr``) and a default format for the displayed message before " +"delegating to the root logger to do the actual message output." msgstr "" #: ../../howto/logging.rst:369 @@ -720,22 +721,23 @@ msgstr "" #: ../../howto/logging.rst:465 msgid "" -":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:" -"`Logger.error`, and :meth:`Logger.critical` all create log records with a " -"message and a level that corresponds to their respective method names. The " -"message is actually a format string, which may contain the standard string " -"substitution syntax of ``%s``, ``%d``, ``%f``, and so on. The rest of their " -"arguments is a list of objects that correspond with the substitution fields " -"in the message. With regard to ``**kwargs``, the logging methods care only " -"about a keyword of ``exc_info`` and use it to determine whether to log " -"exception information." +":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:`Logger.error`, " +"and :meth:`Logger.critical` all create log records with a message and a " +"level that corresponds to their respective method names. The message is " +"actually a format string, which may contain the standard string substitution " +"syntax of ``%s``, ``%d``, ``%f``, and so on. The rest of their arguments is " +"a list of objects that correspond with the substitution fields in the " +"message. With regard to ``**kwargs``, the logging methods care only about a " +"keyword of ``exc_info`` and use it to determine whether to log exception " +"information." msgstr "" #: ../../howto/logging.rst:475 msgid "" -":meth:`Logger.exception` creates a log message similar to :meth:`Logger." -"error`. The difference is that :meth:`Logger.exception` dumps a stack trace " -"along with it. Call this method only from an exception handler." +":meth:`Logger.exception` creates a log message similar " +"to :meth:`Logger.error`. The difference is that :meth:`Logger.exception` " +"dumps a stack trace along with it. Call this method only from an exception " +"handler." msgstr "" #: ../../howto/logging.rst:479 @@ -800,8 +802,8 @@ msgstr "" #: ../../howto/logging.rst:522 msgid "" "The standard library includes quite a few handler types (see :ref:`useful-" -"handlers`); the tutorials use mainly :class:`StreamHandler` and :class:" -"`FileHandler` in its examples." +"handlers`); the tutorials use mainly :class:`StreamHandler` " +"and :class:`FileHandler` in its examples." msgstr "" #: ../../howto/logging.rst:526 @@ -836,10 +838,10 @@ msgstr "" #: ../../howto/logging.rst:543 msgid "" -"Application code should not directly instantiate and use instances of :class:" -"`Handler`. Instead, the :class:`Handler` class is a base class that defines " -"the interface that all handlers should have and establishes some default " -"behavior that child classes can use (or override)." +"Application code should not directly instantiate and use instances " +"of :class:`Handler`. Instead, the :class:`Handler` class is a base class " +"that defines the interface that all handlers should have and establishes " +"some default behavior that child classes can use (or override)." msgstr "" #: ../../howto/logging.rst:550 @@ -876,8 +878,8 @@ msgstr "" #: ../../howto/logging.rst:571 msgid "" "If the ``style`` is ``'%'``, the message format string uses ``%()s`` styled string substitution; the possible keys are documented in :" -"ref:`logrecord-attributes`. If the style is ``'{'``, the message format " +"key>)s`` styled string substitution; the possible keys are documented " +"in :ref:`logrecord-attributes`. If the style is ``'{'``, the message format " "string is assumed to be compatible with :meth:`str.format` (using keyword " "arguments), while if the style is ``'$'`` then the message format string " "should conform to what is expected by :meth:`string.Template.substitute`." @@ -931,8 +933,8 @@ msgstr "" #: ../../howto/logging.rst:607 msgid "" -"Creating a dictionary of configuration information and passing it to the :" -"func:`dictConfig` function." +"Creating a dictionary of configuration information and passing it to " +"the :func:`dictConfig` function." msgstr "" #: ../../howto/logging.rst:610 @@ -955,8 +957,8 @@ msgid "" "ch.setLevel(logging.DEBUG)\n" "\n" "# create formatter\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " -"%(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "\n" "# add formatter to ch\n" "ch.setFormatter(formatter)\n" @@ -1093,11 +1095,11 @@ msgstr "" msgid "" "Note that the class names referenced in config files need to be either " "relative to the logging module, or absolute values which can be resolved " -"using normal import mechanisms. Thus, you could use either :class:`~logging." -"handlers.WatchedFileHandler` (relative to the logging module) or ``mypackage." -"mymodule.MyHandler`` (for a class defined in package ``mypackage`` and " -"module ``mymodule``, where ``mypackage`` is available on the Python import " -"path)." +"using normal import mechanisms. Thus, you could use " +"either :class:`~logging.handlers.WatchedFileHandler` (relative to the " +"logging module) or ``mypackage.mymodule.MyHandler`` (for a class defined in " +"package ``mypackage`` and module ``mymodule``, where ``mypackage`` is " +"available on the Python import path)." msgstr "" #: ../../howto/logging.rst:743 @@ -1162,10 +1164,10 @@ msgstr "" #: ../../howto/logging.rst:789 msgid "" -"The event is output using a 'handler of last resort', stored in :data:" -"`lastResort`. This internal handler is not associated with any logger, and " -"acts like a :class:`~logging.StreamHandler` which writes the event " -"description message to the current value of ``sys.stderr`` (therefore " +"The event is output using a 'handler of last resort', stored " +"in :data:`lastResort`. This internal handler is not associated with any " +"logger, and acts like a :class:`~logging.StreamHandler` which writes the " +"event description message to the current value of ``sys.stderr`` (therefore " "respecting any redirections which may be in effect). No formatting is done " "on the message - just the bare event description message is printed. The " "handler's level is set to ``WARNING``, so all events at this and greater " @@ -1222,13 +1224,13 @@ msgstr "" #: ../../howto/logging.rst:833 msgid "" -"A do-nothing handler is included in the logging package: :class:`~logging." -"NullHandler` (since Python 3.1). An instance of this handler could be added " -"to the top-level logger of the logging namespace used by the library (*if* " -"you want to prevent your library's logged events being output to ``sys." -"stderr`` in the absence of logging configuration). If all logging by a " -"library *foo* is done using loggers with names matching 'foo.x', 'foo.x.y', " -"etc. then the code::" +"A do-nothing handler is included in the logging " +"package: :class:`~logging.NullHandler` (since Python 3.1). An instance of " +"this handler could be added to the top-level logger of the logging namespace " +"used by the library (*if* you want to prevent your library's logged events " +"being output to ``sys.stderr`` in the absence of logging configuration). If " +"all logging by a library *foo* is done using loggers with names matching " +"'foo.x', 'foo.x.y', etc. then the code::" msgstr "" #: ../../howto/logging.rst:841 @@ -1256,13 +1258,14 @@ msgstr "" #: ../../howto/logging.rst:855 msgid "" -"It is strongly advised that you *do not add any handlers other than* :class:" -"`~logging.NullHandler` *to your library's loggers*. This is because the " -"configuration of handlers is the prerogative of the application developer " -"who uses your library. The application developer knows their target audience " -"and what handlers are most appropriate for their application: if you add " -"handlers 'under the hood', you might well interfere with their ability to " -"carry out unit tests and deliver logs which suit their requirements." +"It is strongly advised that you *do not add any handlers other " +"than* :class:`~logging.NullHandler` *to your library's loggers*. This is " +"because the configuration of handlers is the prerogative of the application " +"developer who uses your library. The application developer knows their " +"target audience and what handlers are most appropriate for their " +"application: if you add handlers 'under the hood', you might well interfere " +"with their ability to carry out unit tests and deliver logs which suit their " +"requirements." msgstr "" #: ../../howto/logging.rst:866 @@ -1323,35 +1326,35 @@ msgstr "" #: ../../howto/logging.rst:897 msgid "" "Logging messages are encoded as instances of the :class:`~logging.LogRecord` " -"class. When a logger decides to actually log an event, a :class:`~logging." -"LogRecord` instance is created from the logging message." +"class. When a logger decides to actually log an event, " +"a :class:`~logging.LogRecord` instance is created from the logging message." msgstr "" #: ../../howto/logging.rst:901 msgid "" -"Logging messages are subjected to a dispatch mechanism through the use of :" -"dfn:`handlers`, which are instances of subclasses of the :class:`Handler` " -"class. Handlers are responsible for ensuring that a logged message (in the " -"form of a :class:`LogRecord`) ends up in a particular location (or set of " -"locations) which is useful for the target audience for that message (such as " -"end users, support desk staff, system administrators, developers). Handlers " -"are passed :class:`LogRecord` instances intended for particular " -"destinations. Each logger can have zero, one or more handlers associated " -"with it (via the :meth:`~Logger.addHandler` method of :class:`Logger`). In " -"addition to any handlers directly associated with a logger, *all handlers " -"associated with all ancestors of the logger* are called to dispatch the " -"message (unless the *propagate* flag for a logger is set to a false value, " -"at which point the passing to ancestor handlers stops)." +"Logging messages are subjected to a dispatch mechanism through the use " +"of :dfn:`handlers`, which are instances of subclasses of " +"the :class:`Handler` class. Handlers are responsible for ensuring that a " +"logged message (in the form of a :class:`LogRecord`) ends up in a particular " +"location (or set of locations) which is useful for the target audience for " +"that message (such as end users, support desk staff, system administrators, " +"developers). Handlers are passed :class:`LogRecord` instances intended for " +"particular destinations. Each logger can have zero, one or more handlers " +"associated with it (via the :meth:`~Logger.addHandler` method " +"of :class:`Logger`). In addition to any handlers directly associated with a " +"logger, *all handlers associated with all ancestors of the logger* are " +"called to dispatch the message (unless the *propagate* flag for a logger is " +"set to a false value, at which point the passing to ancestor handlers stops)." msgstr "" #: ../../howto/logging.rst:915 msgid "" "Just as for loggers, handlers can have levels associated with them. A " "handler's level acts as a filter in the same way as a logger's level does. " -"If a handler decides to actually dispatch an event, the :meth:`~Handler." -"emit` method is used to send the message to its destination. Most user-" -"defined subclasses of :class:`Handler` will need to override this :meth:" -"`~Handler.emit`." +"If a handler decides to actually dispatch an event, " +"the :meth:`~Handler.emit` method is used to send the message to its " +"destination. Most user-defined subclasses of :class:`Handler` will need to " +"override this :meth:`~Handler.emit`." msgstr "" #: ../../howto/logging.rst:924 @@ -1395,8 +1398,8 @@ msgstr "" msgid "" ":class:`~handlers.BaseRotatingHandler` is the base class for handlers that " "rotate log files at a certain point. It is not meant to be instantiated " -"directly. Instead, use :class:`~handlers.RotatingFileHandler` or :class:" -"`~handlers.TimedRotatingFileHandler`." +"directly. Instead, use :class:`~handlers.RotatingFileHandler` " +"or :class:`~handlers.TimedRotatingFileHandler`." msgstr "" #: ../../howto/logging.rst:954 @@ -1437,8 +1440,8 @@ msgstr "" #: ../../howto/logging.rst:972 msgid "" -":class:`~handlers.NTEventLogHandler` instances send messages to a Windows " -"NT/2000/XP event log." +":class:`~handlers.NTEventLogHandler` instances send messages to a Windows NT/" +"2000/XP event log." msgstr "" #: ../../howto/logging.rst:975 @@ -1494,27 +1497,27 @@ msgstr "" #: ../../howto/logging.rst:1006 msgid "" -"Logged messages are formatted for presentation through instances of the :" -"class:`Formatter` class. They are initialized with a format string suitable " -"for use with the % operator and a dictionary." +"Logged messages are formatted for presentation through instances of " +"the :class:`Formatter` class. They are initialized with a format string " +"suitable for use with the % operator and a dictionary." msgstr "" #: ../../howto/logging.rst:1010 msgid "" -"For formatting multiple messages in a batch, instances of :class:" -"`BufferingFormatter` can be used. In addition to the format string (which is " -"applied to each message in the batch), there is provision for header and " -"trailer format strings." +"For formatting multiple messages in a batch, instances " +"of :class:`BufferingFormatter` can be used. In addition to the format string " +"(which is applied to each message in the batch), there is provision for " +"header and trailer format strings." msgstr "" #: ../../howto/logging.rst:1015 msgid "" "When filtering based on logger level and/or handler level is not enough, " -"instances of :class:`Filter` can be added to both :class:`Logger` and :class:" -"`Handler` instances (through their :meth:`~Handler.addFilter` method). " -"Before deciding to process a message further, both loggers and handlers " -"consult all their filters for permission. If any filter returns a false " -"value, the message is not processed further." +"instances of :class:`Filter` can be added to both :class:`Logger` " +"and :class:`Handler` instances (through their :meth:`~Handler.addFilter` " +"method). Before deciding to process a message further, both loggers and " +"handlers consult all their filters for permission. If any filter returns a " +"false value, the message is not processed further." msgstr "" #: ../../howto/logging.rst:1022 @@ -1540,16 +1543,16 @@ msgstr "" msgid "" ":class:`SystemExit` and :class:`KeyboardInterrupt` exceptions are never " "swallowed. Other exceptions which occur during the :meth:`~Handler.emit` " -"method of a :class:`Handler` subclass are passed to its :meth:`~Handler." -"handleError` method." +"method of a :class:`Handler` subclass are passed to " +"its :meth:`~Handler.handleError` method." msgstr "" #: ../../howto/logging.rst:1042 msgid "" -"The default implementation of :meth:`~Handler.handleError` in :class:" -"`Handler` checks to see if a module-level variable, :data:`raiseExceptions`, " -"is set. If set, a traceback is printed to :data:`sys.stderr`. If not set, " -"the exception is swallowed." +"The default implementation of :meth:`~Handler.handleError` " +"in :class:`Handler` checks to see if a module-level " +"variable, :data:`raiseExceptions`, is set. If set, a traceback is printed " +"to :data:`sys.stderr`. If not set, the exception is swallowed." msgstr "" #: ../../howto/logging.rst:1048 @@ -1568,12 +1571,12 @@ msgstr "" msgid "" "In the preceding sections and examples, it has been assumed that the message " "passed when logging the event is a string. However, this is not the only " -"possibility. You can pass an arbitrary object as a message, and its :meth:" -"`~object.__str__` method will be called when the logging system needs to " -"convert it to a string representation. In fact, if you want to, you can " -"avoid computing a string representation altogether - for example, the :class:" -"`~handlers.SocketHandler` emits an event by pickling it and sending it over " -"the wire." +"possibility. You can pass an arbitrary object as a message, and " +"its :meth:`~object.__str__` method will be called when the logging system " +"needs to convert it to a string representation. In fact, if you want to, you " +"can avoid computing a string representation altogether - for example, " +"the :class:`~handlers.SocketHandler` emits an event by pickling it and " +"sending it over the wire." msgstr "" #: ../../howto/logging.rst:1071 @@ -1585,10 +1588,10 @@ msgid "" "Formatting of message arguments is deferred until it cannot be avoided. " "However, computing the arguments passed to the logging method can also be " "expensive, and you may want to avoid doing it if the logger will just throw " -"away your event. To decide what to do, you can call the :meth:`~Logger." -"isEnabledFor` method which takes a level argument and returns true if the " -"event would be created by the Logger for that level of call. You can write " -"code like this::" +"away your event. To decide what to do, you can call " +"the :meth:`~Logger.isEnabledFor` method which takes a level argument and " +"returns true if the event would be created by the Logger for that level of " +"call. You can write code like this::" msgstr "" #: ../../howto/logging.rst:1081 @@ -1638,9 +1641,10 @@ msgstr "" #: ../../howto/logging.rst:1105 msgid "" -"Set ``logging._srcfile`` to ``None``. This avoids calling :func:`sys." -"_getframe`, which may help to speed up your code in environments like PyPy " -"(which can't speed up code that uses :func:`sys._getframe`)." +"Set ``logging._srcfile`` to ``None``. This avoids " +"calling :func:`sys._getframe`, which may help to speed up your code in " +"environments like PyPy (which can't speed up code that " +"uses :func:`sys._getframe`)." msgstr "" #: ../../howto/logging.rst:1111 diff --git a/howto/regex.po b/howto/regex.po index 782ee533c40..46d4aa1e615 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -8,7 +8,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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -120,12 +120,12 @@ msgstr "" #: ../../howto/regex.rst:70 msgid "" -"There are exceptions to this rule; some characters are special :dfn:" -"`metacharacters`, and don't match themselves. Instead, they signal that " -"some out-of-the-ordinary thing should be matched, or they affect other " -"portions of the RE by repeating them or changing their meaning. Much of " -"this document is devoted to discussing various metacharacters and what they " -"do." +"There are exceptions to this rule; some characters are " +"special :dfn:`metacharacters`, and don't match themselves. Instead, they " +"signal that some out-of-the-ordinary thing should be matched, or they affect " +"other portions of the RE by repeating them or changing their meaning. Much " +"of this document is devoted to discussing various metacharacters and what " +"they do." msgstr "" #: ../../howto/regex.rst:76 @@ -160,12 +160,12 @@ msgstr "" #: ../../howto/regex.rst:97 msgid "" -"You can match the characters not listed within the class by :dfn:" -"`complementing` the set. This is indicated by including a ``'^'`` as the " -"first character of the class. For example, ``[^5]`` will match any character " -"except ``'5'``. If the caret appears elsewhere in a character class, it " -"does not have special meaning. For example: ``[5^]`` will match either a " -"``'5'`` or a ``'^'``." +"You can match the characters not listed within the class " +"by :dfn:`complementing` the set. This is indicated by including a ``'^'`` " +"as the first character of the class. For example, ``[^5]`` will match any " +"character except ``'5'``. If the caret appears elsewhere in a character " +"class, it does not have special meaning. For example: ``[5^]`` will match " +"either a ``'5'`` or a ``'^'``." msgstr "" #: ../../howto/regex.rst:103 @@ -190,10 +190,10 @@ msgid "" "Let's take an example: ``\\w`` matches any alphanumeric character. If the " "regex pattern is expressed in bytes, this is equivalent to the class ``[a-zA-" "Z0-9_]``. If the regex pattern is a string, ``\\w`` will match all the " -"characters marked as letters in the Unicode database provided by the :mod:" -"`unicodedata` module. You can use the more restricted definition of ``\\w`` " -"in a string pattern by supplying the :const:`re.ASCII` flag when compiling " -"the regular expression." +"characters marked as letters in the Unicode database provided by " +"the :mod:`unicodedata` module. You can use the more restricted definition " +"of ``\\w`` in a string pattern by supplying the :const:`re.ASCII` flag when " +"compiling the regular expression." msgstr "" #: ../../howto/regex.rst:123 @@ -272,9 +272,9 @@ msgstr "" #: ../../howto/regex.rst:156 msgid "" "The final metacharacter in this section is ``.``. It matches anything " -"except a newline character, and there's an alternate mode (:const:`re." -"DOTALL`) where it will match even a newline. ``.`` is often used where you " -"want to match \"any character\"." +"except a newline character, and there's an alternate mode " +"(:const:`re.DOTALL`) where it will match even a newline. ``.`` is often " +"used where you want to match \"any character\"." msgstr "" #: ../../howto/regex.rst:163 @@ -524,8 +524,8 @@ msgid "" "and no special syntax was created for expressing them. (There are " "applications that don't need REs at all, so there's no need to bloat the " "language specification by including them.) Instead, the :mod:`re` module is " -"simply a C extension module included with Python, just like the :mod:" -"`socket` or :mod:`zlib` modules." +"simply a C extension module included with Python, just like " +"the :mod:`socket` or :mod:`zlib` modules." msgstr "" #: ../../howto/regex.rst:292 @@ -612,10 +612,10 @@ msgstr "" #: ../../howto/regex.rst:336 msgid "" "In addition, special escape sequences that are valid in regular expressions, " -"but not valid as Python string literals, now result in a :exc:" -"`DeprecationWarning` and will eventually become a :exc:`SyntaxError`, which " -"means the sequences will be invalid if raw string notation or escaping the " -"backslashes isn't used." +"but not valid as Python string literals, now result in " +"a :exc:`DeprecationWarning` and will eventually become a :exc:`SyntaxError`, " +"which means the sequences will be invalid if raw string notation or escaping " +"the backslashes isn't used." msgstr "" #: ../../howto/regex.rst:344 @@ -659,12 +659,12 @@ msgid "" msgstr "" #: ../../howto/regex.rst:363 ../../howto/regex.rst:417 -#: ../../howto/regex.rst:1069 +#: ../../howto/regex.rst:1072 msgid "Method/Attribute" msgstr "方法/屬性" #: ../../howto/regex.rst:363 ../../howto/regex.rst:417 -#: ../../howto/regex.rst:1069 +#: ../../howto/regex.rst:1072 msgid "Purpose" msgstr "" @@ -698,8 +698,8 @@ msgstr "``finditer()``" #: ../../howto/regex.rst:374 msgid "" -"Find all substrings where the RE matches, and returns them as an :term:" -"`iterator`." +"Find all substrings where the RE matches, and returns them as " +"an :term:`iterator`." msgstr "" #: ../../howto/regex.rst:378 @@ -831,11 +831,11 @@ msgstr "" #: ../../howto/regex.rst:438 msgid "" -":meth:`~re.Match.group` returns the substring that was matched by the RE. :" -"meth:`~re.Match.start` and :meth:`~re.Match.end` return the starting and " -"ending index of the match. :meth:`~re.Match.span` returns both start and end " -"indexes in a single tuple. Since the :meth:`~re.Pattern.match` method only " -"checks if the RE matches at the start of a string, :meth:`!start` will " +":meth:`~re.Match.group` returns the substring that was matched by the " +"RE. :meth:`~re.Match.start` and :meth:`~re.Match.end` return the starting " +"and ending index of the match. :meth:`~re.Match.span` returns both start and " +"end indexes in a single tuple. Since the :meth:`~re.Pattern.match` method " +"only checks if the RE matches at the start of a string, :meth:`!start` will " "always be zero. However, the :meth:`~re.Pattern.search` method of patterns " "scans through the string, so the match may not start at zero in that " "case. ::" @@ -886,8 +886,8 @@ msgstr "" #: ../../howto/regex.rst:466 msgid "" -"Two pattern methods return all of the matches for a pattern. :meth:`~re." -"Pattern.findall` returns a list of matching strings::" +"Two pattern methods return all of the matches for a " +"pattern. :meth:`~re.Pattern.findall` returns a list of matching strings::" msgstr "" #: ../../howto/regex.rst:469 @@ -905,16 +905,16 @@ msgid "" "The ``r`` prefix, making the literal a raw string literal, is needed in this " "example because escape sequences in a normal \"cooked\" string literal that " "are not recognized by Python, as opposed to regular expressions, now result " -"in a :exc:`DeprecationWarning` and will eventually become a :exc:" -"`SyntaxError`. See :ref:`the-backslash-plague`." +"in a :exc:`DeprecationWarning` and will eventually become " +"a :exc:`SyntaxError`. See :ref:`the-backslash-plague`." msgstr "" #: ../../howto/regex.rst:479 msgid "" ":meth:`~re.Pattern.findall` has to create the entire list before it can be " "returned as the result. The :meth:`~re.Pattern.finditer` method returns a " -"sequence of :ref:`match object ` instances as an :term:" -"`iterator`::" +"sequence of :ref:`match object ` instances as " +"an :term:`iterator`::" msgstr "" #: ../../howto/regex.rst:483 @@ -945,12 +945,12 @@ msgstr "模組層級函式" #: ../../howto/regex.rst:497 msgid "" -"You don't have to create a pattern object and call its methods; the :mod:" -"`re` module also provides top-level functions called :func:`~re.match`, :" -"func:`~re.search`, :func:`~re.findall`, :func:`~re.sub`, and so forth. " -"These functions take the same arguments as the corresponding pattern method " -"with the RE string added as the first argument, and still return either " -"``None`` or a :ref:`match object ` instance. ::" +"You don't have to create a pattern object and call its methods; " +"the :mod:`re` module also provides top-level functions " +"called :func:`~re.match`, :func:`~re.search`, :func:`~re.findall`, :func:`~re.sub`, " +"and so forth. These functions take the same arguments as the corresponding " +"pattern method with the RE string added as the first argument, and still " +"return either ``None`` or a :ref:`match object ` instance. ::" msgstr "" #: ../../howto/regex.rst:504 @@ -989,12 +989,12 @@ msgstr "" msgid "" "Compilation flags let you modify some aspects of how regular expressions " "work. Flags are available in the :mod:`re` module under two names, a long " -"name such as :const:`IGNORECASE` and a short, one-letter form such as :const:" -"`I`. (If you're familiar with Perl's pattern modifiers, the one-letter " -"forms use the same letters; the short form of :const:`re.VERBOSE` is :const:" -"`re.X`, for example.) Multiple flags can be specified by bitwise OR-ing " -"them; ``re.I | re.M`` sets both the :const:`I` and :const:`M` flags, for " -"example." +"name such as :const:`IGNORECASE` and a short, one-letter form such " +"as :const:`I`. (If you're familiar with Perl's pattern modifiers, the one-" +"letter forms use the same letters; the short form of :const:`re.VERBOSE` " +"is :const:`re.X`, for example.) Multiple flags can be specified by bitwise " +"OR-ing them; ``re.I | re.M`` sets both the :const:`I` and :const:`M` flags, " +"for example." msgstr "" #: ../../howto/regex.rst:534 @@ -1069,13 +1069,13 @@ msgid "" "letters, too. Full Unicode matching also works unless the :const:`ASCII` " "flag is used to disable non-ASCII matches. When the Unicode patterns ``[a-" "z]`` or ``[A-Z]`` are used in combination with the :const:`IGNORECASE` flag, " -"they will match the 52 ASCII letters and 4 additional non-ASCII letters: " -"'İ' (U+0130, Latin capital letter I with dot above), 'ı' (U+0131, Latin " -"small letter dotless i), 'ſ' (U+017F, Latin small letter long s) and " -"'K' (U+212A, Kelvin sign). ``Spam`` will match ``'Spam'``, ``'spam'``, " -"``'spAM'``, or ``'ſpam'`` (the latter is matched only in Unicode mode). This " -"lowercasing doesn't take the current locale into account; it will if you " -"also set the :const:`LOCALE` flag." +"they will match the 52 ASCII letters and 4 additional non-ASCII letters: 'İ' " +"(U+0130, Latin capital letter I with dot above), 'ı' (U+0131, Latin small " +"letter dotless i), 'ſ' (U+017F, Latin small letter long s) and 'K' (U+212A, " +"Kelvin sign). ``Spam`` will match ``'Spam'``, ``'spam'``, ``'spAM'``, or " +"``'ſpam'`` (the latter is matched only in Unicode mode). This lowercasing " +"doesn't take the current locale into account; it will if you also set " +"the :const:`LOCALE` flag." msgstr "" #: ../../howto/regex.rst:581 @@ -1245,9 +1245,9 @@ msgstr "``^``" #: ../../howto/regex.rst:707 msgid "" "Matches at the beginning of lines. Unless the :const:`MULTILINE` flag has " -"been set, this will only match at the beginning of the string. In :const:" -"`MULTILINE` mode, this also matches immediately after each newline within " -"the string." +"been set, this will only match at the beginning of the string. " +"In :const:`MULTILINE` mode, this also matches immediately after each newline " +"within the string." msgstr "" #: ../../howto/regex.rst:711 @@ -1318,18 +1318,26 @@ msgid "" msgstr "" #: ../../howto/regex.rst:741 -msgid "``\\Z``" -msgstr "``\\Z``" +msgid "``\\z``" +msgstr "" #: ../../howto/regex.rst:742 msgid "Matches only at the end of the string." msgstr "" #: ../../howto/regex.rst:744 +msgid "``\\Z``" +msgstr "``\\Z``" + +#: ../../howto/regex.rst:745 +msgid "The same as ``\\z``. For compatibility with old Python versions." +msgstr "" + +#: ../../howto/regex.rst:747 msgid "``\\b``" msgstr "``\\b``" -#: ../../howto/regex.rst:745 +#: ../../howto/regex.rst:748 msgid "" "Word boundary. This is a zero-width assertion that matches only at the " "beginning or end of a word. A word is defined as a sequence of alphanumeric " @@ -1337,13 +1345,13 @@ msgid "" "alphanumeric character." msgstr "" -#: ../../howto/regex.rst:750 +#: ../../howto/regex.rst:753 msgid "" "The following example matches ``class`` only when it's a complete word; it " "won't match when it's contained inside another word. ::" msgstr "" -#: ../../howto/regex.rst:753 +#: ../../howto/regex.rst:756 msgid "" ">>> p = re.compile(r'\\bclass\\b')\n" ">>> print(p.search('no class at all'))\n" @@ -1361,7 +1369,7 @@ msgstr "" ">>> print(p.search('one subclass is'))\n" "None" -#: ../../howto/regex.rst:761 +#: ../../howto/regex.rst:764 msgid "" "There are two subtleties you should remember when using this special " "sequence. First, this is the worst collision between Python's string " @@ -1372,7 +1380,7 @@ msgid "" "previous RE, but omits the ``'r'`` in front of the RE string. ::" msgstr "" -#: ../../howto/regex.rst:769 +#: ../../howto/regex.rst:772 msgid "" ">>> p = re.compile('\\bclass\\b')\n" ">>> print(p.search('no class at all'))\n" @@ -1386,28 +1394,28 @@ msgstr "" ">>> print(p.search('\\b' + 'class' + '\\b'))\n" "" -#: ../../howto/regex.rst:775 +#: ../../howto/regex.rst:778 msgid "" "Second, inside a character class, where there's no use for this assertion, " "``\\b`` represents the backspace character, for compatibility with Python's " "string literals." msgstr "" -#: ../../howto/regex.rst:779 +#: ../../howto/regex.rst:782 msgid "``\\B``" msgstr "``\\B``" -#: ../../howto/regex.rst:780 +#: ../../howto/regex.rst:783 msgid "" "Another zero-width assertion, this is the opposite of ``\\b``, only matching " "when the current position is not at a word boundary." msgstr "" -#: ../../howto/regex.rst:785 +#: ../../howto/regex.rst:788 msgid "Grouping" msgstr "" -#: ../../howto/regex.rst:787 +#: ../../howto/regex.rst:790 msgid "" "Frequently you need to obtain more information than just whether the RE " "matched or not. Regular expressions are often used to dissect strings by " @@ -1416,7 +1424,7 @@ msgid "" "name and a value, separated by a ``':'``, like this:" msgstr "" -#: ../../howto/regex.rst:793 +#: ../../howto/regex.rst:796 msgid "" "From: author@example.com\n" "User-Agent: Thunderbird 1.5.0.9 (X11/20061227)\n" @@ -1428,14 +1436,14 @@ msgstr "" "MIME-Version: 1.0\n" "To: editor@example.com" -#: ../../howto/regex.rst:800 +#: ../../howto/regex.rst:803 msgid "" "This can be handled by writing a regular expression which matches an entire " "header line, and has one group which matches the header name, and another " "group which matches the header's value." msgstr "" -#: ../../howto/regex.rst:804 +#: ../../howto/regex.rst:807 msgid "" "Groups are marked by the ``'('``, ``')'`` metacharacters. ``'('`` and " "``')'`` have much the same meaning as they do in mathematical expressions; " @@ -1445,7 +1453,7 @@ msgid "" "repetitions of ``ab``. ::" msgstr "" -#: ../../howto/regex.rst:811 +#: ../../howto/regex.rst:814 msgid "" ">>> p = re.compile('(ab)*')\n" ">>> print(p.match('ababababab').span())\n" @@ -1455,19 +1463,19 @@ msgstr "" ">>> print(p.match('ababababab').span())\n" "(0, 10)" -#: ../../howto/regex.rst:815 +#: ../../howto/regex.rst:818 msgid "" "Groups indicated with ``'('``, ``')'`` also capture the starting and ending " "index of the text that they match; this can be retrieved by passing an " -"argument to :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:`~re." -"Match.end`, and :meth:`~re.Match.span`. Groups are numbered starting with " -"0. Group 0 is always present; it's the whole RE, so :ref:`match object " -"` methods all have group 0 as their default argument. Later " -"we'll see how to express groups that don't capture the span of text that " -"they match. ::" +"argument " +"to :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:`~re.Match.end`, " +"and :meth:`~re.Match.span`. Groups are numbered starting with 0. Group 0 " +"is always present; it's the whole RE, so :ref:`match object ` " +"methods all have group 0 as their default argument. Later we'll see how to " +"express groups that don't capture the span of text that they match. ::" msgstr "" -#: ../../howto/regex.rst:824 +#: ../../howto/regex.rst:827 msgid "" ">>> p = re.compile('(a)b')\n" ">>> m = p.match('ab')\n" @@ -1483,14 +1491,14 @@ msgstr "" ">>> m.group(0)\n" "'ab'" -#: ../../howto/regex.rst:831 +#: ../../howto/regex.rst:834 msgid "" "Subgroups are numbered from left to right, from 1 upward. Groups can be " "nested; to determine the number, just count the opening parenthesis " "characters, going from left to right. ::" msgstr "" -#: ../../howto/regex.rst:835 +#: ../../howto/regex.rst:838 msgid "" ">>> p = re.compile('(a(b)c)d')\n" ">>> m = p.match('abcd')\n" @@ -1510,14 +1518,14 @@ msgstr "" ">>> m.group(2)\n" "'b'" -#: ../../howto/regex.rst:844 +#: ../../howto/regex.rst:847 msgid "" ":meth:`~re.Match.group` can be passed multiple group numbers at a time, in " "which case it will return a tuple containing the corresponding values for " "those groups. ::" msgstr "" -#: ../../howto/regex.rst:847 +#: ../../howto/regex.rst:850 msgid "" ">>> m.group(2,1,2)\n" "('b', 'abc', 'b')" @@ -1525,13 +1533,13 @@ msgstr "" ">>> m.group(2,1,2)\n" "('b', 'abc', 'b')" -#: ../../howto/regex.rst:850 +#: ../../howto/regex.rst:853 msgid "" "The :meth:`~re.Match.groups` method returns a tuple containing the strings " "for all the subgroups, from 1 up to however many there are. ::" msgstr "" -#: ../../howto/regex.rst:853 +#: ../../howto/regex.rst:856 msgid "" ">>> m.groups()\n" "('abc', 'b')" @@ -1539,7 +1547,7 @@ msgstr "" ">>> m.groups()\n" "('abc', 'b')" -#: ../../howto/regex.rst:856 +#: ../../howto/regex.rst:859 msgid "" "Backreferences in a pattern allow you to specify that the contents of an " "earlier capturing group must also be found at the current location in the " @@ -1550,11 +1558,11 @@ msgid "" "when incorporating backreferences in a RE." msgstr "" -#: ../../howto/regex.rst:864 +#: ../../howto/regex.rst:867 msgid "For example, the following RE detects doubled words in a string. ::" msgstr "" -#: ../../howto/regex.rst:866 +#: ../../howto/regex.rst:869 msgid "" ">>> p = re.compile(r'\\b(\\w+)\\s+\\1\\b')\n" ">>> p.search('Paris in the the spring').group()\n" @@ -1564,7 +1572,7 @@ msgstr "" ">>> p.search('Paris in the the spring').group()\n" "'the the'" -#: ../../howto/regex.rst:870 +#: ../../howto/regex.rst:873 msgid "" "Backreferences like this aren't often useful for just searching through a " "string --- there are few text formats which repeat data in this way --- but " @@ -1572,11 +1580,11 @@ msgid "" "substitutions." msgstr "" -#: ../../howto/regex.rst:876 +#: ../../howto/regex.rst:879 msgid "Non-capturing and Named Groups" msgstr "" -#: ../../howto/regex.rst:878 +#: ../../howto/regex.rst:881 msgid "" "Elaborate REs may use many groups, both to capture substrings of interest, " "and to group and structure the RE itself. In complex REs, it becomes " @@ -1585,7 +1593,7 @@ msgid "" "expression extensions, so we'll look at that first." msgstr "" -#: ../../howto/regex.rst:884 +#: ../../howto/regex.rst:887 msgid "" "Perl 5 is well known for its powerful additions to standard regular " "expressions. For these new features the Perl developers couldn't choose new " @@ -1596,7 +1604,7 @@ msgid "" "wouldn't have escaped it by writing ``\\&`` or ``[&]``." msgstr "" -#: ../../howto/regex.rst:891 +#: ../../howto/regex.rst:894 msgid "" "The solution chosen by the Perl developers was to use ``(?...)`` as the " "extension syntax. ``?`` immediately after a parenthesis was a syntax error " @@ -1607,20 +1615,20 @@ msgid "" "capturing group containing the subexpression ``foo``)." msgstr "" -#: ../../howto/regex.rst:899 +#: ../../howto/regex.rst:902 msgid "" "Python supports several of Perl's extensions and adds an extension syntax to " "Perl's extension syntax. If the first character after the question mark is " "a ``P``, you know that it's an extension that's specific to Python." msgstr "" -#: ../../howto/regex.rst:904 +#: ../../howto/regex.rst:907 msgid "" "Now that we've looked at the general extension syntax, we can return to the " "features that simplify working with groups in complex REs." msgstr "" -#: ../../howto/regex.rst:907 +#: ../../howto/regex.rst:910 msgid "" "Sometimes you'll want to use a group to denote a part of a regular " "expression, but aren't interested in retrieving the group's contents. You " @@ -1628,7 +1636,7 @@ msgid "" "where you can replace the ``...`` with any other regular expression. ::" msgstr "" -#: ../../howto/regex.rst:912 +#: ../../howto/regex.rst:915 msgid "" ">>> m = re.match(\"([abc])+\", \"abc\")\n" ">>> m.groups()\n" @@ -1644,7 +1652,7 @@ msgstr "" ">>> m.groups()\n" "()" -#: ../../howto/regex.rst:919 +#: ../../howto/regex.rst:922 msgid "" "Except for the fact that you can't retrieve the contents of what the group " "matched, a non-capturing group behaves exactly the same as a capturing " @@ -1657,13 +1665,13 @@ msgid "" "groups; neither form is any faster than the other." msgstr "" -#: ../../howto/regex.rst:928 +#: ../../howto/regex.rst:931 msgid "" "A more significant feature is named groups: instead of referring to them by " "numbers, groups can be referenced by a name." msgstr "" -#: ../../howto/regex.rst:931 +#: ../../howto/regex.rst:934 msgid "" "The syntax for a named group is one of the Python-specific extensions: ``(?" "P...)``. *name* is, obviously, the name of the group. Named groups " @@ -1675,7 +1683,7 @@ msgid "" "ways::" msgstr "" -#: ../../howto/regex.rst:939 +#: ../../howto/regex.rst:942 msgid "" ">>> p = re.compile(r'(?P\\b\\w+\\b)')\n" ">>> m = p.search( '(((( Lots of punctuation )))' )\n" @@ -1691,13 +1699,13 @@ msgstr "" ">>> m.group(1)\n" "'Lots'" -#: ../../howto/regex.rst:946 +#: ../../howto/regex.rst:949 msgid "" -"Additionally, you can retrieve named groups as a dictionary with :meth:`~re." -"Match.groupdict`::" +"Additionally, you can retrieve named groups as a dictionary " +"with :meth:`~re.Match.groupdict`::" msgstr "" -#: ../../howto/regex.rst:949 +#: ../../howto/regex.rst:952 msgid "" ">>> m = re.match(r'(?P\\w+) (?P\\w+)', 'Jane Doe')\n" ">>> m.groupdict()\n" @@ -1707,14 +1715,14 @@ msgstr "" ">>> m.groupdict()\n" "{'first': 'Jane', 'last': 'Doe'}" -#: ../../howto/regex.rst:953 +#: ../../howto/regex.rst:956 msgid "" "Named groups are handy because they let you use easily remembered names, " -"instead of having to remember numbers. Here's an example RE from the :mod:" -"`imaplib` module::" +"instead of having to remember numbers. Here's an example RE from " +"the :mod:`imaplib` module::" msgstr "" -#: ../../howto/regex.rst:957 +#: ../../howto/regex.rst:960 msgid "" "InternalDate = re.compile(r'INTERNALDATE \"'\n" " r'(?P[ 123][0-9])-(?P[A-Z][a-z][a-z])-'\n" @@ -1730,24 +1738,24 @@ msgstr "" " r' (?P[-+])(?P[0-9][0-9])(?P[0-9][0-9])'\n" " r'\"')" -#: ../../howto/regex.rst:964 +#: ../../howto/regex.rst:967 msgid "" "It's obviously much easier to retrieve ``m.group('zonem')``, instead of " "having to remember to retrieve group 9." msgstr "" -#: ../../howto/regex.rst:967 +#: ../../howto/regex.rst:970 msgid "" "The syntax for backreferences in an expression such as ``(...)\\1`` refers " "to the number of the group. There's naturally a variant that uses the group " "name instead of the number. This is another Python extension: ``(?P=name)`` " "indicates that the contents of the group called *name* should again be " "matched at the current point. The regular expression for finding doubled " -"words, ``\\b(\\w+)\\s+\\1\\b`` can also be written as ``\\b(?" -"P\\w+)\\s+(?P=word)\\b``::" +"words, ``\\b(\\w+)\\s+\\1\\b`` can also be written as ``\\b(?P\\w+)\\s+" +"(?P=word)\\b``::" msgstr "" -#: ../../howto/regex.rst:974 +#: ../../howto/regex.rst:977 msgid "" ">>> p = re.compile(r'\\b(?P\\w+)\\s+(?P=word)\\b')\n" ">>> p.search('Paris in the the spring').group()\n" @@ -1757,22 +1765,22 @@ msgstr "" ">>> p.search('Paris in the the spring').group()\n" "'the the'" -#: ../../howto/regex.rst:980 +#: ../../howto/regex.rst:983 msgid "Lookahead Assertions" msgstr "" -#: ../../howto/regex.rst:982 +#: ../../howto/regex.rst:985 msgid "" "Another zero-width assertion is the lookahead assertion. Lookahead " "assertions are available in both positive and negative form, and look like " "this:" msgstr "" -#: ../../howto/regex.rst:985 +#: ../../howto/regex.rst:988 msgid "``(?=...)``" msgstr "``(?=...)``" -#: ../../howto/regex.rst:986 +#: ../../howto/regex.rst:989 msgid "" "Positive lookahead assertion. This succeeds if the contained regular " "expression, represented here by ``...``, successfully matches at the current " @@ -1781,18 +1789,18 @@ msgid "" "is tried right where the assertion started." msgstr "" -#: ../../howto/regex.rst:992 +#: ../../howto/regex.rst:995 msgid "``(?!...)``" msgstr "``(?!...)``" -#: ../../howto/regex.rst:993 +#: ../../howto/regex.rst:996 msgid "" "Negative lookahead assertion. This is the opposite of the positive " "assertion; it succeeds if the contained expression *doesn't* match at the " "current position in the string." msgstr "" -#: ../../howto/regex.rst:997 +#: ../../howto/regex.rst:1000 msgid "" "To make this concrete, let's look at a case where a lookahead is useful. " "Consider a simple pattern to match a filename and split it apart into a base " @@ -1800,15 +1808,15 @@ msgid "" "``news`` is the base name, and ``rc`` is the filename's extension." msgstr "" -#: ../../howto/regex.rst:1002 +#: ../../howto/regex.rst:1005 msgid "The pattern to match this is quite simple:" msgstr "" -#: ../../howto/regex.rst:1004 +#: ../../howto/regex.rst:1007 msgid "``.*[.].*$``" msgstr "``.*[.].*$``" -#: ../../howto/regex.rst:1006 +#: ../../howto/regex.rst:1009 msgid "" "Notice that the ``.`` needs to be treated specially because it's a " "metacharacter, so it's inside a character class to only match that specific " @@ -1818,50 +1826,50 @@ msgid "" "``printers.conf``." msgstr "" -#: ../../howto/regex.rst:1013 +#: ../../howto/regex.rst:1016 msgid "" "Now, consider complicating the problem a bit; what if you want to match " "filenames where the extension is not ``bat``? Some incorrect attempts:" msgstr "" -#: ../../howto/regex.rst:1016 +#: ../../howto/regex.rst:1019 msgid "``.*[.][^b].*$``" msgstr "``.*[.][^b].*$``" -#: ../../howto/regex.rst:1018 +#: ../../howto/regex.rst:1021 msgid "" "The first attempt above tries to exclude ``bat`` by requiring that the first " "character of the extension is not a ``b``. This is wrong, because the " "pattern also doesn't match ``foo.bar``." msgstr "" -#: ../../howto/regex.rst:1022 +#: ../../howto/regex.rst:1025 msgid "``.*[.]([^b]..|.[^a].|..[^t])$``" msgstr "``.*[.]([^b]..|.[^a].|..[^t])$``" -#: ../../howto/regex.rst:1024 +#: ../../howto/regex.rst:1027 msgid "" "The expression gets messier when you try to patch up the first solution by " "requiring one of the following cases to match: the first character of the " "extension isn't ``b``; the second character isn't ``a``; or the third " -"character isn't ``t``. This accepts ``foo.bar`` and rejects ``autoexec." -"bat``, but it requires a three-letter extension and won't accept a filename " -"with a two-letter extension such as ``sendmail.cf``. We'll complicate the " -"pattern again in an effort to fix it." +"character isn't ``t``. This accepts ``foo.bar`` and rejects " +"``autoexec.bat``, but it requires a three-letter extension and won't accept " +"a filename with a two-letter extension such as ``sendmail.cf``. We'll " +"complicate the pattern again in an effort to fix it." msgstr "" -#: ../../howto/regex.rst:1032 +#: ../../howto/regex.rst:1035 msgid "``.*[.]([^b].?.?|.[^a]?.?|..?[^t]?)$``" msgstr "``.*[.]([^b].?.?|.[^a]?.?|..?[^t]?)$``" -#: ../../howto/regex.rst:1034 +#: ../../howto/regex.rst:1037 msgid "" "In the third attempt, the second and third letters are all made optional in " "order to allow matching extensions shorter than three characters, such as " "``sendmail.cf``." msgstr "" -#: ../../howto/regex.rst:1038 +#: ../../howto/regex.rst:1041 msgid "" "The pattern's getting really complicated now, which makes it hard to read " "and understand. Worse, if the problem changes and you want to exclude both " @@ -1869,15 +1877,15 @@ msgid "" "complicated and confusing." msgstr "" -#: ../../howto/regex.rst:1043 +#: ../../howto/regex.rst:1046 msgid "A negative lookahead cuts through all this confusion:" msgstr "" -#: ../../howto/regex.rst:1045 +#: ../../howto/regex.rst:1048 msgid "``.*[.](?!bat$)[^.]*$``" msgstr "``.*[.](?!bat$)[^.]*$``" -#: ../../howto/regex.rst:1047 +#: ../../howto/regex.rst:1050 msgid "" "The negative lookahead means: if the expression ``bat`` doesn't match at " "this point, try the rest of the pattern; if ``bat$`` does match, the whole " @@ -1887,61 +1895,61 @@ msgid "" "multiple dots in the filename." msgstr "" -#: ../../howto/regex.rst:1054 +#: ../../howto/regex.rst:1057 msgid "" "Excluding another filename extension is now easy; simply add it as an " "alternative inside the assertion. The following pattern excludes filenames " "that end in either ``bat`` or ``exe``:" msgstr "" -#: ../../howto/regex.rst:1058 +#: ../../howto/regex.rst:1061 msgid "``.*[.](?!bat$|exe$)[^.]*$``" msgstr "``.*[.](?!bat$|exe$)[^.]*$``" -#: ../../howto/regex.rst:1062 +#: ../../howto/regex.rst:1065 msgid "Modifying Strings" msgstr "" -#: ../../howto/regex.rst:1064 +#: ../../howto/regex.rst:1067 msgid "" "Up to this point, we've simply performed searches against a static string. " "Regular expressions are also commonly used to modify strings in various " "ways, using the following pattern methods:" msgstr "" -#: ../../howto/regex.rst:1071 +#: ../../howto/regex.rst:1074 msgid "``split()``" msgstr "``split()``" -#: ../../howto/regex.rst:1071 +#: ../../howto/regex.rst:1074 msgid "Split the string into a list, splitting it wherever the RE matches" msgstr "" -#: ../../howto/regex.rst:1074 +#: ../../howto/regex.rst:1077 msgid "``sub()``" msgstr "``sub()``" -#: ../../howto/regex.rst:1074 +#: ../../howto/regex.rst:1077 msgid "" "Find all substrings where the RE matches, and replace them with a different " "string" msgstr "" -#: ../../howto/regex.rst:1077 +#: ../../howto/regex.rst:1080 msgid "``subn()``" msgstr "``subn()``" -#: ../../howto/regex.rst:1077 +#: ../../howto/regex.rst:1080 msgid "" "Does the same thing as :meth:`!sub`, but returns the new string and the " "number of replacements" msgstr "" -#: ../../howto/regex.rst:1084 +#: ../../howto/regex.rst:1087 msgid "Splitting Strings" msgstr "" -#: ../../howto/regex.rst:1086 +#: ../../howto/regex.rst:1089 msgid "" "The :meth:`~re.Pattern.split` method of a pattern splits a string apart " "wherever the RE matches, returning a list of the pieces. It's similar to " @@ -1951,7 +1959,7 @@ msgid "" "module-level :func:`re.split` function, too." msgstr "" -#: ../../howto/regex.rst:1097 +#: ../../howto/regex.rst:1100 msgid "" "Split *string* by the matches of the regular expression. If capturing " "parentheses are used in the RE, then their contents will also be returned as " @@ -1959,7 +1967,7 @@ msgid "" "splits are performed." msgstr "" -#: ../../howto/regex.rst:1102 +#: ../../howto/regex.rst:1105 msgid "" "You can limit the number of splits made, by passing a value for *maxsplit*. " "When *maxsplit* is nonzero, at most *maxsplit* splits will be made, and the " @@ -1968,7 +1976,7 @@ msgid "" "characters. ::" msgstr "" -#: ../../howto/regex.rst:1108 +#: ../../howto/regex.rst:1111 msgid "" ">>> p = re.compile(r'\\W+')\n" ">>> p.split('This is a test, short and sweet, of split().')\n" @@ -1982,7 +1990,7 @@ msgstr "" ">>> p.split('This is a test, short and sweet, of split().', 3)\n" "['This', 'is', 'a', 'test, short and sweet, of split().']" -#: ../../howto/regex.rst:1114 +#: ../../howto/regex.rst:1117 msgid "" "Sometimes you're not only interested in what the text between delimiters is, " "but also need to know what the delimiter was. If capturing parentheses are " @@ -1990,7 +1998,7 @@ msgid "" "Compare the following calls::" msgstr "" -#: ../../howto/regex.rst:1119 +#: ../../howto/regex.rst:1122 msgid "" ">>> p = re.compile(r'\\W+')\n" ">>> p2 = re.compile(r'(\\W+)')\n" @@ -2006,13 +2014,13 @@ msgstr "" ">>> p2.split('This... is a test.')\n" "['This', '... ', 'is', ' ', 'a', ' ', 'test', '.', '']" -#: ../../howto/regex.rst:1126 +#: ../../howto/regex.rst:1129 msgid "" "The module-level function :func:`re.split` adds the RE to be used as the " "first argument, but is otherwise the same. ::" msgstr "" -#: ../../howto/regex.rst:1129 +#: ../../howto/regex.rst:1132 msgid "" ">>> re.split(r'[\\W]+', 'Words, words, words.')\n" "['Words', 'words', 'words', '']\n" @@ -2028,11 +2036,11 @@ msgstr "" ">>> re.split(r'[\\W]+', 'Words, words, words.', 1)\n" "['Words', 'words, words.']" -#: ../../howto/regex.rst:1138 +#: ../../howto/regex.rst:1141 msgid "Search and Replace" msgstr "" -#: ../../howto/regex.rst:1140 +#: ../../howto/regex.rst:1143 msgid "" "Another common task is to find all the matches for a pattern, and replace " "them with a different string. The :meth:`~re.Pattern.sub` method takes a " @@ -2040,27 +2048,27 @@ msgid "" "string to be processed." msgstr "" -#: ../../howto/regex.rst:1147 +#: ../../howto/regex.rst:1150 msgid "" "Returns the string obtained by replacing the leftmost non-overlapping " "occurrences of the RE in *string* by the replacement *replacement*. If the " "pattern isn't found, *string* is returned unchanged." msgstr "" -#: ../../howto/regex.rst:1151 +#: ../../howto/regex.rst:1154 msgid "" "The optional argument *count* is the maximum number of pattern occurrences " "to be replaced; *count* must be a non-negative integer. The default value " "of 0 means to replace all occurrences." msgstr "" -#: ../../howto/regex.rst:1155 +#: ../../howto/regex.rst:1158 msgid "" "Here's a simple example of using the :meth:`~re.Pattern.sub` method. It " "replaces colour names with the word ``colour``::" msgstr "" -#: ../../howto/regex.rst:1158 +#: ../../howto/regex.rst:1161 msgid "" ">>> p = re.compile('(blue|white|red)')\n" ">>> p.sub('colour', 'blue socks and red shoes')\n" @@ -2074,14 +2082,14 @@ msgstr "" ">>> p.sub('colour', 'blue socks and red shoes', count=1)\n" "'colour socks and red shoes'" -#: ../../howto/regex.rst:1164 +#: ../../howto/regex.rst:1167 msgid "" "The :meth:`~re.Pattern.subn` method does the same work, but returns a 2-" "tuple containing the new string value and the number of replacements that " "were performed::" msgstr "" -#: ../../howto/regex.rst:1167 +#: ../../howto/regex.rst:1170 msgid "" ">>> p = re.compile('(blue|white|red)')\n" ">>> p.subn('colour', 'blue socks and red shoes')\n" @@ -2095,13 +2103,13 @@ msgstr "" ">>> p.subn('colour', 'no colours at all')\n" "('no colours at all', 0)" -#: ../../howto/regex.rst:1173 +#: ../../howto/regex.rst:1176 msgid "" "Empty matches are replaced only when they're not adjacent to a previous " "empty match. ::" msgstr "" -#: ../../howto/regex.rst:1176 +#: ../../howto/regex.rst:1179 msgid "" ">>> p = re.compile('x*')\n" ">>> p.sub('-', 'abxd')\n" @@ -2111,7 +2119,7 @@ msgstr "" ">>> p.sub('-', 'abxd')\n" "'-a-b--d-'" -#: ../../howto/regex.rst:1180 +#: ../../howto/regex.rst:1183 msgid "" "If *replacement* is a string, any backslash escapes in it are processed. " "That is, ``\\n`` is converted to a single newline character, ``\\r`` is " @@ -2122,13 +2130,13 @@ msgid "" "string." msgstr "" -#: ../../howto/regex.rst:1187 +#: ../../howto/regex.rst:1190 msgid "" "This example matches the word ``section`` followed by a string enclosed in " "``{``, ``}``, and changes ``section`` to ``subsection``::" msgstr "" -#: ../../howto/regex.rst:1190 +#: ../../howto/regex.rst:1193 msgid "" ">>> p = re.compile('section{ ( [^}]* ) }', re.VERBOSE)\n" ">>> p.sub(r'subsection{\\1}','section{First} section{second}')\n" @@ -2138,7 +2146,7 @@ msgstr "" ">>> p.sub(r'subsection{\\1}','section{First} section{second}')\n" "'subsection{First} subsection{second}'" -#: ../../howto/regex.rst:1194 +#: ../../howto/regex.rst:1197 msgid "" "There's also a syntax for referring to named groups as defined by the ``(?" "P...)`` syntax. ``\\g`` will use the substring matched by the " @@ -2150,7 +2158,7 @@ msgid "" "but use all three variations of the replacement string. ::" msgstr "" -#: ../../howto/regex.rst:1203 +#: ../../howto/regex.rst:1206 msgid "" ">>> p = re.compile('section{ (?P [^}]* ) }', re.VERBOSE)\n" ">>> p.sub(r'subsection{\\1}','section{First}')\n" @@ -2168,7 +2176,7 @@ msgstr "" ">>> p.sub(r'subsection{\\g}','section{First}')\n" "'subsection{First}'" -#: ../../howto/regex.rst:1211 +#: ../../howto/regex.rst:1214 msgid "" "*replacement* can also be a function, which gives you even more control. If " "*replacement* is a function, the function is called for every non-" @@ -2177,13 +2185,13 @@ msgid "" "this information to compute the desired replacement string and return it." msgstr "" -#: ../../howto/regex.rst:1217 +#: ../../howto/regex.rst:1220 msgid "" "In the following example, the replacement function translates decimals into " "hexadecimal::" msgstr "" -#: ../../howto/regex.rst:1220 +#: ../../howto/regex.rst:1223 msgid "" ">>> def hexrepl(match):\n" "... \"Return the hex string for a decimal number\"\n" @@ -2195,7 +2203,7 @@ msgid "" "'Call 0xffd2 for printing, 0xc000 for user code.'" msgstr "" -#: ../../howto/regex.rst:1229 +#: ../../howto/regex.rst:1232 msgid "" "When using the module-level :func:`re.sub` function, the pattern is passed " "as the first argument. The pattern may be provided as an object or as a " @@ -2205,11 +2213,11 @@ msgid "" "x'``." msgstr "" -#: ../../howto/regex.rst:1237 +#: ../../howto/regex.rst:1240 msgid "Common Problems" msgstr "" -#: ../../howto/regex.rst:1239 +#: ../../howto/regex.rst:1242 msgid "" "Regular expressions are a powerful tool for some applications, but in some " "ways their behaviour isn't intuitive and at times they don't behave the way " @@ -2217,23 +2225,23 @@ msgid "" "pitfalls." msgstr "" -#: ../../howto/regex.rst:1245 +#: ../../howto/regex.rst:1248 msgid "Use String Methods" msgstr "" -#: ../../howto/regex.rst:1247 +#: ../../howto/regex.rst:1250 msgid "" "Sometimes using the :mod:`re` module is a mistake. If you're matching a " -"fixed string, or a single character class, and you're not using any :mod:" -"`re` features such as the :const:`~re.IGNORECASE` flag, then the full power " -"of regular expressions may not be required. Strings have several methods for " -"performing operations with fixed strings and they're usually much faster, " -"because the implementation is a single small C loop that's been optimized " -"for the purpose, instead of the large, more generalized regular expression " -"engine." +"fixed string, or a single character class, and you're not using " +"any :mod:`re` features such as the :const:`~re.IGNORECASE` flag, then the " +"full power of regular expressions may not be required. Strings have several " +"methods for performing operations with fixed strings and they're usually " +"much faster, because the implementation is a single small C loop that's been " +"optimized for the purpose, instead of the large, more generalized regular " +"expression engine." msgstr "" -#: ../../howto/regex.rst:1255 +#: ../../howto/regex.rst:1258 msgid "" "One example might be replacing a single fixed string with another one; for " "example, you might replace ``word`` with ``deed``. :func:`re.sub` seems " @@ -2242,11 +2250,11 @@ msgid "" "turning ``swordfish`` into ``sdeedfish``, but the naive RE ``word`` would " "have done that, too. (To avoid performing the substitution on parts of " "words, the pattern would have to be ``\\bword\\b``, in order to require that " -"``word`` have a word boundary on either side. This takes the job beyond :" -"meth:`!replace`'s abilities.)" +"``word`` have a word boundary on either side. This takes the job " +"beyond :meth:`!replace`'s abilities.)" msgstr "" -#: ../../howto/regex.rst:1264 +#: ../../howto/regex.rst:1267 msgid "" "Another common task is deleting every occurrence of a single character from " "a string or replacing it with another single character. You might do this " @@ -2255,17 +2263,17 @@ msgid "" "operation can be." msgstr "" -#: ../../howto/regex.rst:1270 +#: ../../howto/regex.rst:1273 msgid "" "In short, before turning to the :mod:`re` module, consider whether your " "problem can be solved with a faster and simpler string method." msgstr "" -#: ../../howto/regex.rst:1275 +#: ../../howto/regex.rst:1278 msgid "match() versus search()" msgstr "" -#: ../../howto/regex.rst:1277 +#: ../../howto/regex.rst:1280 msgid "" "The :func:`~re.match` function only checks if the RE matches at the " "beginning of the string while :func:`~re.search` will scan forward through " @@ -2275,7 +2283,7 @@ msgid "" "report it. ::" msgstr "" -#: ../../howto/regex.rst:1283 +#: ../../howto/regex.rst:1286 msgid "" ">>> print(re.match('super', 'superstition').span())\n" "(0, 5)\n" @@ -2287,13 +2295,13 @@ msgstr "" ">>> print(re.match('super', 'insuperable'))\n" "None" -#: ../../howto/regex.rst:1288 +#: ../../howto/regex.rst:1291 msgid "" "On the other hand, :func:`~re.search` will scan forward through the string, " "reporting the first match it finds. ::" msgstr "" -#: ../../howto/regex.rst:1291 +#: ../../howto/regex.rst:1294 msgid "" ">>> print(re.search('super', 'superstition').span())\n" "(0, 5)\n" @@ -2305,30 +2313,31 @@ msgstr "" ">>> print(re.search('super', 'insuperable').span())\n" "(2, 7)" -#: ../../howto/regex.rst:1296 +#: ../../howto/regex.rst:1299 msgid "" -"Sometimes you'll be tempted to keep using :func:`re.match`, and just add ``." -"*`` to the front of your RE. Resist this temptation and use :func:`re." -"search` instead. The regular expression compiler does some analysis of REs " -"in order to speed up the process of looking for a match. One such analysis " -"figures out what the first character of a match must be; for example, a " -"pattern starting with ``Crow`` must match starting with a ``'C'``. The " -"analysis lets the engine quickly scan through the string looking for the " -"starting character, only trying the full match if a ``'C'`` is found." +"Sometimes you'll be tempted to keep using :func:`re.match`, and just add " +"``.*`` to the front of your RE. Resist this temptation and " +"use :func:`re.search` instead. The regular expression compiler does some " +"analysis of REs in order to speed up the process of looking for a match. " +"One such analysis figures out what the first character of a match must be; " +"for example, a pattern starting with ``Crow`` must match starting with a " +"``'C'``. The analysis lets the engine quickly scan through the string " +"looking for the starting character, only trying the full match if a ``'C'`` " +"is found." msgstr "" -#: ../../howto/regex.rst:1305 +#: ../../howto/regex.rst:1308 msgid "" "Adding ``.*`` defeats this optimization, requiring scanning to the end of " "the string and then backtracking to find a match for the rest of the RE. " "Use :func:`re.search` instead." msgstr "" -#: ../../howto/regex.rst:1311 +#: ../../howto/regex.rst:1314 msgid "Greedy versus Non-Greedy" msgstr "" -#: ../../howto/regex.rst:1313 +#: ../../howto/regex.rst:1316 msgid "" "When repeating a regular expression, as in ``a*``, the resulting action is " "to consume as much of the pattern as possible. This fact often bites you " @@ -2337,7 +2346,7 @@ msgid "" "HTML tag doesn't work because of the greedy nature of ``.*``. ::" msgstr "" -#: ../../howto/regex.rst:1319 +#: ../../howto/regex.rst:1322 msgid "" ">>> s = 'Title'\n" ">>> len(s)\n" @@ -2355,7 +2364,7 @@ msgstr "" ">>> print(re.match('<.*>', s).group())\n" "Title" -#: ../../howto/regex.rst:1327 +#: ../../howto/regex.rst:1330 msgid "" "The RE matches the ``'<'`` in ``''``, and the ``.*`` consumes the rest " "of the string. There's still more left in the RE, though, and the ``>`` " @@ -2365,7 +2374,7 @@ msgid "" "``''``, which isn't what you want." msgstr "" -#: ../../howto/regex.rst:1334 +#: ../../howto/regex.rst:1337 msgid "" "In this case, the solution is to use the non-greedy quantifiers ``*?``, ``+?" "``, ``??``, or ``{m,n}?``, which match as *little* text as possible. In the " @@ -2374,7 +2383,7 @@ msgid "" "retrying the ``'>'`` at every step. This produces just the right result::" msgstr "" -#: ../../howto/regex.rst:1340 +#: ../../howto/regex.rst:1343 msgid "" ">>> print(re.match('<.*?>', s).group())\n" "" @@ -2382,7 +2391,7 @@ msgstr "" ">>> print(re.match('<.*?>', s).group())\n" "" -#: ../../howto/regex.rst:1343 +#: ../../howto/regex.rst:1346 msgid "" "(Note that parsing HTML or XML with regular expressions is painful. Quick-" "and-dirty patterns will handle common cases, but HTML and XML have special " @@ -2392,11 +2401,11 @@ msgid "" "such tasks.)" msgstr "" -#: ../../howto/regex.rst:1351 +#: ../../howto/regex.rst:1354 msgid "Using re.VERBOSE" msgstr "" -#: ../../howto/regex.rst:1353 +#: ../../howto/regex.rst:1356 msgid "" "By now you've probably noticed that regular expressions are a very compact " "notation, but they're not terribly readable. REs of moderate complexity can " @@ -2404,14 +2413,14 @@ msgid "" "making them difficult to read and understand." msgstr "" -#: ../../howto/regex.rst:1358 +#: ../../howto/regex.rst:1361 msgid "" "For such REs, specifying the :const:`re.VERBOSE` flag when compiling the " "regular expression can be helpful, because it allows you to format the " "regular expression more clearly." msgstr "" -#: ../../howto/regex.rst:1362 +#: ../../howto/regex.rst:1365 msgid "" "The ``re.VERBOSE`` flag has several effects. Whitespace in the regular " "expression that *isn't* inside a character class is ignored. This means " @@ -2422,7 +2431,7 @@ msgid "" "quoted strings, this enables REs to be formatted more neatly::" msgstr "" -#: ../../howto/regex.rst:1370 +#: ../../howto/regex.rst:1373 msgid "" "pat = re.compile(r\"\"\"\n" " \\s* # Skip leading whitespace\n" @@ -2434,19 +2443,19 @@ msgid "" "\"\"\", re.VERBOSE)" msgstr "" -#: ../../howto/regex.rst:1379 +#: ../../howto/regex.rst:1382 msgid "This is far more readable than::" msgstr "" -#: ../../howto/regex.rst:1381 +#: ../../howto/regex.rst:1384 msgid "pat = re.compile(r\"\\s*(?P
[^:]+)\\s*:(?P.*?)\\s*$\")" msgstr "pat = re.compile(r\"\\s*(?P
[^:]+)\\s*:(?P.*?)\\s*$\")" -#: ../../howto/regex.rst:1385 +#: ../../howto/regex.rst:1388 msgid "Feedback" msgstr "" -#: ../../howto/regex.rst:1387 +#: ../../howto/regex.rst:1390 msgid "" "Regular expressions are a complicated topic. Did this document help you " "understand them? Were there parts that were unclear, or Problems you " @@ -2454,7 +2463,7 @@ msgid "" "improvements to the author." msgstr "" -#: ../../howto/regex.rst:1392 +#: ../../howto/regex.rst:1395 msgid "" "The most complete book on regular expressions is almost certainly Jeffrey " "Friedl's Mastering Regular Expressions, published by O'Reilly. " diff --git a/howto/remote_debugging.po b/howto/remote_debugging.po new file mode 100644 index 00000000000..2d3c169e1b1 --- /dev/null +++ b/howto/remote_debugging.po @@ -0,0 +1,850 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../howto/remote_debugging.rst:4 +msgid "Remote debugging attachment protocol" +msgstr "" + +#: ../../howto/remote_debugging.rst:6 +msgid "" +"This section describes the low-level protocol that enables external tools to " +"inject and execute a Python script within a running CPython process." +msgstr "" + +#: ../../howto/remote_debugging.rst:9 +msgid "" +"This mechanism forms the basis of the :func:`sys.remote_exec` function, " +"which instructs a remote Python process to execute a ``.py`` file. However, " +"this section does not document the usage of that function. Instead, it " +"provides a detailed explanation of the underlying protocol, which takes as " +"input the ``pid`` of a target Python process and the path to a Python source " +"file to be executed. This information supports independent reimplementation " +"of the protocol, regardless of programming language." +msgstr "" + +#: ../../howto/remote_debugging.rst:19 +msgid "" +"The execution of the injected script depends on the interpreter reaching a " +"safe evaluation point. As a result, execution may be delayed depending on " +"the runtime state of the target process." +msgstr "" + +#: ../../howto/remote_debugging.rst:23 +msgid "" +"Once injected, the script is executed by the interpreter within the target " +"process the next time a safe evaluation point is reached. This approach " +"enables remote execution capabilities without modifying the behavior or " +"structure of the running Python application." +msgstr "" + +#: ../../howto/remote_debugging.rst:28 +msgid "" +"Subsequent sections provide a step-by-step description of the protocol, " +"including techniques for locating interpreter structures in memory, safely " +"accessing internal fields, and triggering code execution. Platform-specific " +"variations are noted where applicable, and example implementations are " +"included to clarify each operation." +msgstr "" + +#: ../../howto/remote_debugging.rst:35 +msgid "Locating the PyRuntime structure" +msgstr "" + +#: ../../howto/remote_debugging.rst:37 +msgid "" +"CPython places the ``PyRuntime`` structure in a dedicated binary section to " +"help external tools find it at runtime. The name and format of this section " +"vary by platform. For example, ``.PyRuntime`` is used on ELF systems, and " +"``__DATA,__PyRuntime`` is used on macOS. Tools can find the offset of this " +"structure by examining the binary on disk." +msgstr "" + +#: ../../howto/remote_debugging.rst:43 +msgid "" +"The ``PyRuntime`` structure contains CPython’s global interpreter state and " +"provides access to other internal data, including the list of interpreters, " +"thread states, and debugger support fields." +msgstr "" + +#: ../../howto/remote_debugging.rst:47 +msgid "" +"To work with a remote Python process, a debugger must first find the memory " +"address of the ``PyRuntime`` structure in the target process. This address " +"can’t be hardcoded or calculated from a symbol name, because it depends on " +"where the operating system loaded the binary." +msgstr "" + +#: ../../howto/remote_debugging.rst:52 +msgid "" +"The method for finding ``PyRuntime`` depends on the platform, but the steps " +"are the same in general:" +msgstr "" + +#: ../../howto/remote_debugging.rst:55 +msgid "" +"Find the base address where the Python binary or shared library was loaded " +"in the target process." +msgstr "" + +#: ../../howto/remote_debugging.rst:57 +msgid "" +"Use the on-disk binary to locate the offset of the ``.PyRuntime`` section." +msgstr "" + +#: ../../howto/remote_debugging.rst:58 +msgid "" +"Add the section offset to the base address to compute the address in memory." +msgstr "" + +#: ../../howto/remote_debugging.rst:60 +msgid "" +"The sections below explain how to do this on each supported platform and " +"include example code." +msgstr "" + +#: ../../howto/remote_debugging.rst:64 +msgid "Linux (ELF)" +msgstr "" + +#: ../../howto/remote_debugging.rst:65 +msgid "To find the ``PyRuntime`` structure on Linux:" +msgstr "" + +#: ../../howto/remote_debugging.rst:67 +msgid "" +"Read the process’s memory map (for example, ``/proc//maps``) to find " +"the address where the Python executable or ``libpython`` was loaded." +msgstr "" + +#: ../../howto/remote_debugging.rst:69 +msgid "" +"Parse the ELF section headers in the binary to get the offset of the " +"``.PyRuntime`` section." +msgstr "" + +#: ../../howto/remote_debugging.rst:71 +msgid "" +"Add that offset to the base address from step 1 to get the memory address of " +"``PyRuntime``." +msgstr "" + +#: ../../howto/remote_debugging.rst:74 ../../howto/remote_debugging.rst:136 +#: ../../howto/remote_debugging.rst:206 ../../howto/remote_debugging.rst:475 +msgid "The following is an example implementation::" +msgstr "" + +#: ../../howto/remote_debugging.rst:76 +msgid "" +"def find_py_runtime_linux(pid: int) -> int:\n" +" # Step 1: Try to find the Python executable in memory\n" +" binary_path, base_address = find_mapped_binary(\n" +" pid, name_contains=\"python\"\n" +" )\n" +"\n" +" # Step 2: Fallback to shared library if executable is not found\n" +" if binary_path is None:\n" +" binary_path, base_address = find_mapped_binary(\n" +" pid, name_contains=\"libpython\"\n" +" )\n" +"\n" +" # Step 3: Parse ELF headers to get .PyRuntime section offset\n" +" section_offset = parse_elf_section_offset(\n" +" binary_path, \".PyRuntime\"\n" +" )\n" +"\n" +" # Step 4: Compute PyRuntime address in memory\n" +" return base_address + section_offset" +msgstr "" + +#: ../../howto/remote_debugging.rst:97 +msgid "" +"On Linux systems, there are two main approaches to read memory from another " +"process. The first is through the ``/proc`` filesystem, specifically by " +"reading from ``/proc/[pid]/mem`` which provides direct access to the " +"process's memory. This requires appropriate permissions - either being the " +"same user as the target process or having root access. The second approach " +"is using the ``process_vm_readv()`` system call which provides a more " +"efficient way to copy memory between processes. While ptrace's " +"``PTRACE_PEEKTEXT`` operation can also be used to read memory, it is " +"significantly slower as it only reads one word at a time and requires " +"multiple context switches between the tracer and tracee processes." +msgstr "" + +#: ../../howto/remote_debugging.rst:108 +msgid "" +"For parsing ELF sections, the process involves reading and interpreting the " +"ELF file format structures from the binary file on disk. The ELF header " +"contains a pointer to the section header table. Each section header contains " +"metadata about a section including its name (stored in a separate string " +"table), offset, and size. To find a specific section like .PyRuntime, you " +"need to walk through these headers and match the section name. The section " +"header then provides the offset where that section exists in the file, which " +"can be used to calculate its runtime address when the binary is loaded into " +"memory." +msgstr "" + +#: ../../howto/remote_debugging.rst:117 +msgid "" +"You can read more about the ELF file format in the `ELF specification " +"`_." +msgstr "" + +#: ../../howto/remote_debugging.rst:122 +msgid "macOS (Mach-O)" +msgstr "" + +#: ../../howto/remote_debugging.rst:123 +msgid "To find the ``PyRuntime`` structure on macOS:" +msgstr "" + +#: ../../howto/remote_debugging.rst:125 +msgid "" +"Call ``task_for_pid()`` to get the ``mach_port_t`` task port for the target " +"process. This handle is needed to read memory using APIs like " +"``mach_vm_read_overwrite`` and ``mach_vm_region``." +msgstr "" + +#: ../../howto/remote_debugging.rst:128 +msgid "" +"Scan the memory regions to find the one containing the Python executable or " +"``libpython``." +msgstr "" + +#: ../../howto/remote_debugging.rst:130 +msgid "" +"Load the binary file from disk and parse the Mach-O headers to find the " +"section named ``PyRuntime`` in the ``__DATA`` segment. On macOS, symbol " +"names are automatically prefixed with an underscore, so the ``PyRuntime`` " +"symbol appears as ``_PyRuntime`` in the symbol table, but the section name " +"is not affected." +msgstr "" + +#: ../../howto/remote_debugging.rst:138 +msgid "" +"def find_py_runtime_macos(pid: int) -> int:\n" +" # Step 1: Get access to the process's memory\n" +" handle = get_memory_access_handle(pid)\n" +"\n" +" # Step 2: Try to find the Python executable in memory\n" +" binary_path, base_address = find_mapped_binary(\n" +" handle, name_contains=\"python\"\n" +" )\n" +"\n" +" # Step 3: Fallback to libpython if the executable is not found\n" +" if binary_path is None:\n" +" binary_path, base_address = find_mapped_binary(\n" +" handle, name_contains=\"libpython\"\n" +" )\n" +"\n" +" # Step 4: Parse Mach-O headers to get __DATA,__PyRuntime section offset\n" +" section_offset = parse_macho_section_offset(\n" +" binary_path, \"__DATA\", \"__PyRuntime\"\n" +" )\n" +"\n" +" # Step 5: Compute the PyRuntime address in memory\n" +" return base_address + section_offset" +msgstr "" + +#: ../../howto/remote_debugging.rst:161 +msgid "" +"On macOS, accessing another process's memory requires using Mach-O specific " +"APIs and file formats. The first step is obtaining a ``task_port`` handle " +"via ``task_for_pid()``, which provides access to the target process's memory " +"space. This handle enables memory operations through APIs like " +"``mach_vm_read_overwrite()``." +msgstr "" + +#: ../../howto/remote_debugging.rst:167 +msgid "" +"The process memory can be examined using ``mach_vm_region()`` to scan " +"through the virtual memory space, while ``proc_regionfilename()`` helps " +"identify which binary files are loaded at each memory region. When the " +"Python binary or library is found, its Mach-O headers need to be parsed to " +"locate the ``PyRuntime`` structure." +msgstr "" + +#: ../../howto/remote_debugging.rst:172 +msgid "" +"The Mach-O format organizes code and data into segments and sections. The " +"``PyRuntime`` structure lives in a section named ``__PyRuntime`` within the " +"``__DATA`` segment. The actual runtime address calculation involves finding " +"the ``__TEXT`` segment which serves as the binary's base address, then " +"locating the ``__DATA`` segment containing our target section. The final " +"address is computed by combining the base address with the appropriate " +"section offsets from the Mach-O headers." +msgstr "" + +#: ../../howto/remote_debugging.rst:180 +msgid "" +"Note that accessing another process's memory on macOS typically requires " +"elevated privileges - either root access or special security entitlements " +"granted to the debugging process." +msgstr "" + +#: ../../howto/remote_debugging.rst:186 +msgid "Windows (PE)" +msgstr "" + +#: ../../howto/remote_debugging.rst:187 +msgid "To find the ``PyRuntime`` structure on Windows:" +msgstr "" + +#: ../../howto/remote_debugging.rst:189 +msgid "" +"Use the ToolHelp API to enumerate all modules loaded in the target process. " +"This is done using functions such as `CreateToolhelp32Snapshot `_, `Module32First `_, and " +"`Module32Next `_." +msgstr "" + +#: ../../howto/remote_debugging.rst:196 +msgid "" +"Identify the module corresponding to :file:`python.exe` " +"or :file:`python{XY}.dll`, where ``X`` and ``Y`` are the major and minor " +"version numbers of the Python version, and record its base address." +msgstr "" + +#: ../../howto/remote_debugging.rst:199 +msgid "" +"Locate the ``PyRuntim`` section. Due to the PE format's 8-character limit on " +"section names (defined as ``IMAGE_SIZEOF_SHORT_NAME``), the original name " +"``PyRuntime`` is truncated. This section contains the ``PyRuntime`` " +"structure." +msgstr "" + +#: ../../howto/remote_debugging.rst:203 +msgid "" +"Retrieve the section’s relative virtual address (RVA) and add it to the base " +"address of the module." +msgstr "" + +#: ../../howto/remote_debugging.rst:208 +msgid "" +"def find_py_runtime_windows(pid: int) -> int:\n" +" # Step 1: Try to find the Python executable in memory\n" +" binary_path, base_address = find_loaded_module(\n" +" pid, name_contains=\"python\"\n" +" )\n" +"\n" +" # Step 2: Fallback to shared pythonXY.dll if the executable is not\n" +" # found\n" +" if binary_path is None:\n" +" binary_path, base_address = find_loaded_module(\n" +" pid, name_contains=\"python3\"\n" +" )\n" +"\n" +" # Step 3: Parse PE section headers to get the RVA of the PyRuntime\n" +" # section. The section name appears as \"PyRuntim\" due to the\n" +" # 8-character limit defined by the PE format (IMAGE_SIZEOF_SHORT_NAME).\n" +" section_rva = parse_pe_section_offset(binary_path, \"PyRuntim\")\n" +"\n" +" # Step 4: Compute PyRuntime address in memory\n" +" return base_address + section_rva" +msgstr "" + +#: ../../howto/remote_debugging.rst:230 +msgid "" +"On Windows, accessing another process's memory requires using the Windows " +"API functions like ``CreateToolhelp32Snapshot()`` and ``Module32First()/" +"Module32Next()`` to enumerate loaded modules. The ``OpenProcess()`` function " +"provides a handle to access the target process's memory space, enabling " +"memory operations through ``ReadProcessMemory()``." +msgstr "" + +#: ../../howto/remote_debugging.rst:236 +msgid "" +"The process memory can be examined by enumerating loaded modules to find the " +"Python binary or DLL. When found, its PE headers need to be parsed to locate " +"the ``PyRuntime`` structure." +msgstr "" + +#: ../../howto/remote_debugging.rst:240 +msgid "" +"The PE format organizes code and data into sections. The ``PyRuntime`` " +"structure lives in a section named \"PyRuntim\" (truncated from " +"\"PyRuntime\" due to PE's 8-character name limit). The actual runtime " +"address calculation involves finding the module's base address from the " +"module entry, then locating our target section in the PE headers. The final " +"address is computed by combining the base address with the section's virtual " +"address from the PE section headers." +msgstr "" + +#: ../../howto/remote_debugging.rst:247 +msgid "" +"Note that accessing another process's memory on Windows typically requires " +"appropriate privileges - either administrative access or the " +"``SeDebugPrivilege`` privilege granted to the debugging process." +msgstr "" + +#: ../../howto/remote_debugging.rst:253 +msgid "Reading _Py_DebugOffsets" +msgstr "" + +#: ../../howto/remote_debugging.rst:255 +msgid "" +"Once the address of the ``PyRuntime`` structure has been determined, the " +"next step is to read the ``_Py_DebugOffsets`` structure located at the " +"beginning of the ``PyRuntime`` block." +msgstr "" + +#: ../../howto/remote_debugging.rst:259 +msgid "" +"This structure provides version-specific field offsets that are needed to " +"safely read interpreter and thread state memory. These offsets vary between " +"CPython versions and must be checked before use to ensure they are " +"compatible." +msgstr "" + +#: ../../howto/remote_debugging.rst:263 +msgid "To read and check the debug offsets, follow these steps:" +msgstr "" + +#: ../../howto/remote_debugging.rst:265 +msgid "" +"Read memory from the target process starting at the ``PyRuntime`` address, " +"covering the same number of bytes as the ``_Py_DebugOffsets`` structure. " +"This structure is located at the very start of the ``PyRuntime`` memory " +"block. Its layout is defined in CPython’s internal headers and stays the " +"same within a given minor version, but may change in major versions." +msgstr "" + +#: ../../howto/remote_debugging.rst:271 +msgid "Check that the structure contains valid data:" +msgstr "" + +#: ../../howto/remote_debugging.rst:273 +msgid "The ``cookie`` field must match the expected debug marker." +msgstr "" + +#: ../../howto/remote_debugging.rst:274 +msgid "" +"The ``version`` field must match the version of the Python interpreter used " +"by the debugger." +msgstr "" + +#: ../../howto/remote_debugging.rst:276 +msgid "" +"If either the debugger or the target process is using a pre-release version " +"(for example, an alpha, beta, or release candidate), the versions must match " +"exactly." +msgstr "" + +#: ../../howto/remote_debugging.rst:279 +msgid "" +"The ``free_threaded`` field must have the same value in both the debugger " +"and the target process." +msgstr "" + +#: ../../howto/remote_debugging.rst:282 +msgid "" +"If the structure is valid, the offsets it contains can be used to locate " +"fields in memory. If any check fails, the debugger should stop the operation " +"to avoid reading memory in the wrong format." +msgstr "" + +#: ../../howto/remote_debugging.rst:286 +msgid "" +"The following is an example implementation that reads and checks " +"``_Py_DebugOffsets``::" +msgstr "" + +#: ../../howto/remote_debugging.rst:289 +msgid "" +"def read_debug_offsets(pid: int, py_runtime_addr: int) -> DebugOffsets:\n" +" # Step 1: Read memory from the target process at the PyRuntime address\n" +" data = read_process_memory(\n" +" pid, address=py_runtime_addr, size=DEBUG_OFFSETS_SIZE\n" +" )\n" +"\n" +" # Step 2: Deserialize the raw bytes into a _Py_DebugOffsets structure\n" +" debug_offsets = parse_debug_offsets(data)\n" +"\n" +" # Step 3: Validate the contents of the structure\n" +" if debug_offsets.cookie != EXPECTED_COOKIE:\n" +" raise RuntimeError(\"Invalid or missing debug cookie\")\n" +" if debug_offsets.version != LOCAL_PYTHON_VERSION:\n" +" raise RuntimeError(\n" +" \"Mismatch between caller and target Python versions\"\n" +" )\n" +" if debug_offsets.free_threaded != LOCAL_FREE_THREADED:\n" +" raise RuntimeError(\"Mismatch in free-threaded configuration\")\n" +"\n" +" return debug_offsets" +msgstr "" + +#: ../../howto/remote_debugging.rst:314 +msgid "**Process suspension recommended**" +msgstr "" + +#: ../../howto/remote_debugging.rst:316 +msgid "" +"To avoid race conditions and ensure memory consistency, it is strongly " +"recommended that the target process be suspended before performing any " +"operations that read or write internal interpreter state. The Python runtime " +"may concurrently mutate interpreter data structures—such as creating or " +"destroying threads—during normal execution. This can result in invalid " +"memory reads or writes." +msgstr "" + +#: ../../howto/remote_debugging.rst:323 +msgid "" +"A debugger may suspend execution by attaching to the process with ``ptrace`` " +"or by sending a ``SIGSTOP`` signal. Execution should only be resumed after " +"debugger-side memory operations are complete." +msgstr "" + +#: ../../howto/remote_debugging.rst:329 +msgid "" +"Some tools, such as profilers or sampling-based debuggers, may operate on a " +"running process without suspension. In such cases, tools must be explicitly " +"designed to handle partially updated or inconsistent memory. For most " +"debugger implementations, suspending the process remains the safest and most " +"robust approach." +msgstr "" + +#: ../../howto/remote_debugging.rst:337 +msgid "Locating the interpreter and thread state" +msgstr "" + +#: ../../howto/remote_debugging.rst:339 +msgid "" +"Before code can be injected and executed in a remote Python process, the " +"debugger must choose a thread in which to schedule execution. This is " +"necessary because the control fields used to perform remote code injection " +"are located in the ``_PyRemoteDebuggerSupport`` structure, which is embedded " +"in a ``PyThreadState`` object. These fields are modified by the debugger to " +"request execution of injected scripts." +msgstr "" + +#: ../../howto/remote_debugging.rst:346 +msgid "" +"The ``PyThreadState`` structure represents a thread running inside a Python " +"interpreter. It maintains the thread’s evaluation context and contains the " +"fields required for debugger coordination. Locating a valid " +"``PyThreadState`` is therefore a key prerequisite for triggering execution " +"remotely." +msgstr "" + +#: ../../howto/remote_debugging.rst:351 +msgid "" +"A thread is typically selected based on its role or ID. In most cases, the " +"main thread is used, but some tools may target a specific thread by its " +"native thread ID. Once the target thread is chosen, the debugger must locate " +"both the interpreter and the associated thread state structures in memory." +msgstr "" + +#: ../../howto/remote_debugging.rst:356 +msgid "The relevant internal structures are defined as follows:" +msgstr "" + +#: ../../howto/remote_debugging.rst:358 +msgid "" +"``PyInterpreterState`` represents an isolated Python interpreter instance. " +"Each interpreter maintains its own set of imported modules, built-in state, " +"and thread state list. Although most Python applications use a single " +"interpreter, CPython supports multiple interpreters in the same process." +msgstr "" + +#: ../../howto/remote_debugging.rst:363 +msgid "" +"``PyThreadState`` represents a thread running within an interpreter. It " +"contains execution state and the control fields used by the debugger." +msgstr "" + +#: ../../howto/remote_debugging.rst:366 +msgid "To locate a thread:" +msgstr "" + +#: ../../howto/remote_debugging.rst:368 +msgid "" +"Use the offset ``runtime_state.interpreters_head`` to obtain the address of " +"the first interpreter in the ``PyRuntime`` structure. This is the entry " +"point to the linked list of active interpreters." +msgstr "" + +#: ../../howto/remote_debugging.rst:372 +msgid "" +"Use the offset ``interpreter_state.threads_main`` to access the main thread " +"state associated with the selected interpreter. This is typically the most " +"reliable thread to target." +msgstr "" + +#: ../../howto/remote_debugging.rst:376 +msgid "" +"3. Optionally, use the offset ``interpreter_state.threads_head`` to iterate " +"through the linked list of all thread states. Each ``PyThreadState`` " +"structure contains a ``native_thread_id`` field, which may be compared to a " +"target thread ID to find a specific thread." +msgstr "" + +#: ../../howto/remote_debugging.rst:381 +msgid "" +"1. Once a valid ``PyThreadState`` has been found, its address can be used in " +"later steps of the protocol, such as writing debugger control fields and " +"scheduling execution." +msgstr "" + +#: ../../howto/remote_debugging.rst:385 +msgid "" +"The following is an example implementation that locates the main thread " +"state::" +msgstr "" + +#: ../../howto/remote_debugging.rst:387 +msgid "" +"def find_main_thread_state(\n" +" pid: int, py_runtime_addr: int, debug_offsets: DebugOffsets,\n" +") -> int:\n" +" # Step 1: Read interpreters_head from PyRuntime\n" +" interp_head_ptr = (\n" +" py_runtime_addr + debug_offsets.runtime_state.interpreters_head\n" +" )\n" +" interp_addr = read_pointer(pid, interp_head_ptr)\n" +" if interp_addr == 0:\n" +" raise RuntimeError(\"No interpreter found in the target process\")\n" +"\n" +" # Step 2: Read the threads_main pointer from the interpreter\n" +" threads_main_ptr = (\n" +" interp_addr + debug_offsets.interpreter_state.threads_main\n" +" )\n" +" thread_state_addr = read_pointer(pid, threads_main_ptr)\n" +" if thread_state_addr == 0:\n" +" raise RuntimeError(\"Main thread state is not available\")\n" +"\n" +" return thread_state_addr" +msgstr "" + +#: ../../howto/remote_debugging.rst:408 +msgid "" +"The following example demonstrates how to locate a thread by its native " +"thread ID::" +msgstr "" + +#: ../../howto/remote_debugging.rst:411 +msgid "" +"def find_thread_by_id(\n" +" pid: int,\n" +" interp_addr: int,\n" +" debug_offsets: DebugOffsets,\n" +" target_tid: int,\n" +") -> int:\n" +" # Start at threads_head and walk the linked list\n" +" thread_ptr = read_pointer(\n" +" pid,\n" +" interp_addr + debug_offsets.interpreter_state.threads_head\n" +" )\n" +"\n" +" while thread_ptr:\n" +" native_tid_ptr = (\n" +" thread_ptr + debug_offsets.thread_state.native_thread_id\n" +" )\n" +" native_tid = read_int(pid, native_tid_ptr)\n" +" if native_tid == target_tid:\n" +" return thread_ptr\n" +" thread_ptr = read_pointer(\n" +" pid,\n" +" thread_ptr + debug_offsets.thread_state.next\n" +" )\n" +"\n" +" raise RuntimeError(\"Thread with the given ID was not found\")" +msgstr "" + +#: ../../howto/remote_debugging.rst:438 +msgid "" +"Once a valid thread state has been located, the debugger can proceed with " +"modifying its control fields and scheduling execution, as described in the " +"next section." +msgstr "" + +#: ../../howto/remote_debugging.rst:443 +msgid "Writing control information" +msgstr "" + +#: ../../howto/remote_debugging.rst:445 +msgid "" +"Once a valid ``PyThreadState`` structure has been identified, the debugger " +"may modify control fields within it to schedule the execution of a specified " +"Python script. These control fields are checked periodically by the " +"interpreter, and when set correctly, they trigger the execution of remote " +"code at a safe point in the evaluation loop." +msgstr "" + +#: ../../howto/remote_debugging.rst:451 +msgid "" +"Each ``PyThreadState`` contains a ``_PyRemoteDebuggerSupport`` structure " +"used for communication between the debugger and the interpreter. The " +"locations of its fields are defined by the ``_Py_DebugOffsets`` structure " +"and include the following:" +msgstr "" + +#: ../../howto/remote_debugging.rst:456 +msgid "" +"``debugger_script_path``: A fixed-size buffer that holds the full path to a" +msgstr "" + +#: ../../howto/remote_debugging.rst:457 +msgid "" +"Python source file (``.py``). This file must be accessible and readable by " +"the target process when execution is triggered." +msgstr "" + +#: ../../howto/remote_debugging.rst:460 +msgid "" +"``debugger_pending_call``: An integer flag. Setting this to ``1`` tells the" +msgstr "" + +#: ../../howto/remote_debugging.rst:461 +msgid "interpreter that a script is ready to be executed." +msgstr "" + +#: ../../howto/remote_debugging.rst:463 +msgid "``eval_breaker``: A field checked by the interpreter during execution." +msgstr "" + +#: ../../howto/remote_debugging.rst:464 +msgid "" +"Setting bit 5 (``_PY_EVAL_PLEASE_STOP_BIT``, value ``1U << 5``) in this " +"field causes the interpreter to pause and check for debugger activity." +msgstr "" + +#: ../../howto/remote_debugging.rst:467 +msgid "" +"To complete the injection, the debugger must perform the following steps:" +msgstr "" + +#: ../../howto/remote_debugging.rst:469 +msgid "Write the full script path into the ``debugger_script_path`` buffer." +msgstr "" + +#: ../../howto/remote_debugging.rst:470 +msgid "Set ``debugger_pending_call`` to ``1``." +msgstr "" + +#: ../../howto/remote_debugging.rst:471 +msgid "" +"Read the current value of ``eval_breaker``, set bit 5 " +"(``_PY_EVAL_PLEASE_STOP_BIT``), and write the updated value back. This " +"signals the interpreter to check for debugger activity." +msgstr "" + +#: ../../howto/remote_debugging.rst:477 +msgid "" +"def inject_script(\n" +" pid: int,\n" +" thread_state_addr: int,\n" +" debug_offsets: DebugOffsets,\n" +" script_path: str\n" +") -> None:\n" +" # Compute the base offset of _PyRemoteDebuggerSupport\n" +" support_base = (\n" +" thread_state_addr +\n" +" debug_offsets.debugger_support.remote_debugger_support\n" +" )\n" +"\n" +" # Step 1: Write the script path into debugger_script_path\n" +" script_path_ptr = (\n" +" support_base +\n" +" debug_offsets.debugger_support.debugger_script_path\n" +" )\n" +" write_string(pid, script_path_ptr, script_path)\n" +"\n" +" # Step 2: Set debugger_pending_call to 1\n" +" pending_ptr = (\n" +" support_base +\n" +" debug_offsets.debugger_support.debugger_pending_call\n" +" )\n" +" write_int(pid, pending_ptr, 1)\n" +"\n" +" # Step 3: Set _PY_EVAL_PLEASE_STOP_BIT (bit 5, value 1 << 5) in\n" +" # eval_breaker\n" +" eval_breaker_ptr = (\n" +" thread_state_addr +\n" +" debug_offsets.debugger_support.eval_breaker\n" +" )\n" +" breaker = read_int(pid, eval_breaker_ptr)\n" +" breaker |= (1 << 5)\n" +" write_int(pid, eval_breaker_ptr, breaker)" +msgstr "" + +#: ../../howto/remote_debugging.rst:514 +msgid "" +"Once these fields are set, the debugger may resume the process (if it was " +"suspended). The interpreter will process the request at the next safe " +"evaluation point, load the script from disk, and execute it." +msgstr "" + +#: ../../howto/remote_debugging.rst:518 +msgid "" +"It is the responsibility of the debugger to ensure that the script file " +"remains present and accessible to the target process during execution." +msgstr "" + +#: ../../howto/remote_debugging.rst:523 +msgid "" +"Script execution is asynchronous. The script file cannot be deleted " +"immediately after injection. The debugger should wait until the injected " +"script has produced an observable effect before removing the file. This " +"effect depends on what the script is designed to do. For example, a debugger " +"might wait until the remote process connects back to a socket before " +"removing the script. Once such an effect is observed, it is safe to assume " +"the file is no longer needed." +msgstr "" + +#: ../../howto/remote_debugging.rst:532 +msgid "Summary" +msgstr "" + +#: ../../howto/remote_debugging.rst:534 +msgid "To inject and execute a Python script in a remote process:" +msgstr "" + +#: ../../howto/remote_debugging.rst:536 +msgid "Locate the ``PyRuntime`` structure in the target process’s memory." +msgstr "" + +#: ../../howto/remote_debugging.rst:537 +msgid "" +"Read and validate the ``_Py_DebugOffsets`` structure at the beginning of " +"``PyRuntime``." +msgstr "" + +#: ../../howto/remote_debugging.rst:539 +msgid "Use the offsets to locate a valid ``PyThreadState``." +msgstr "" + +#: ../../howto/remote_debugging.rst:540 +msgid "Write the path to a Python script into ``debugger_script_path``." +msgstr "" + +#: ../../howto/remote_debugging.rst:541 +msgid "Set the ``debugger_pending_call`` flag to ``1``." +msgstr "" + +#: ../../howto/remote_debugging.rst:542 +msgid "Set ``_PY_EVAL_PLEASE_STOP_BIT`` in the ``eval_breaker`` field." +msgstr "" + +#: ../../howto/remote_debugging.rst:543 +msgid "" +"Resume the process (if suspended). The script will execute at the next safe " +"evaluation point." +msgstr "" diff --git a/howto/sockets.po b/howto/sockets.po index 0d6717fa742..b9a3acd4d5b 100644 --- a/howto/sockets.po +++ b/howto/sockets.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-08-12 15:16+0800\n" "Last-Translator: Jay \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -165,16 +165,16 @@ msgstr "" #: ../../howto/sockets.rst:80 msgid "" "A couple things to notice: we used ``socket.gethostname()`` so that the " -"socket would be visible to the outside world. If we had used ``s." -"bind(('localhost', 80))`` or ``s.bind(('127.0.0.1', 80))`` we would still " -"have a \"server\" socket, but one that was only visible within the same " -"machine. ``s.bind(('', 80))`` specifies that the socket is reachable by any " -"address the machine happens to have." +"socket would be visible to the outside world. If we had used " +"``s.bind(('localhost', 80))`` or ``s.bind(('127.0.0.1', 80))`` we would " +"still have a \"server\" socket, but one that was only visible within the " +"same machine. ``s.bind(('', 80))`` specifies that the socket is reachable " +"by any address the machine happens to have." msgstr "" "有幾件事需要注意:我們使用了 ``socket.gethostname()``,這樣 socket 才能對外部" -"網路可見。如果我們使用了 ``s.bind(('localhost', 80))`` 或 ``s." -"bind(('127.0.0.1', 80))``,我們會得到一個「伺服器端」socket,但是只能在同一台" -"機器內可見。``s.bind(('', 80))`` 指定 socket 可以透過機器的任何地址存取。" +"網路可見。如果我們使用了 ``s.bind(('localhost', 80))`` 或 " +"``s.bind(('127.0.0.1', 80))``,我們會得到一個「伺服器端」socket,但是只能在同" +"一台機器內可見。``s.bind(('', 80))`` 指定 socket 可以透過機器的任何地址存取。" #: ../../howto/sockets.rst:87 msgid "" @@ -211,8 +211,8 @@ msgid "" " (clientsocket, address) = serversocket.accept()\n" " # now do something with the clientsocket\n" " # in this case, we'll pretend this is a threaded server\n" -" ct = client_thread(clientsocket)\n" -" ct.run()" +" ct = make_client_thread(clientsocket)\n" +" ct.start()" msgstr "" #: ../../howto/sockets.rst:106 diff --git a/howto/sorting.po b/howto/sorting.po index dcdc529f4e5..7b3038d4b0a 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-12-20 19:16+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -111,19 +111,25 @@ msgid "Key Functions" msgstr "鍵函式 (key functions)" #: ../../howto/sorting.rst:50 +#, fuzzy msgid "" -"Both :meth:`list.sort` and :func:`sorted` have a *key* parameter to specify " -"a function (or other callable) to be called on each list element prior to " -"making comparisons." +"The :meth:`list.sort` method and the " +"functions :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nsmallest`, " +"and :func:`heapq.nlargest` have a *key* parameter to specify a function (or " +"other callable) to be called on each list element prior to making " +"comparisons." msgstr "" ":meth:`list.sort` 和 :func:`sorted` 都有一個參數 *key* 可以指定一個函式(或其" "它可呼叫物件 (callable)),這個函式會在每個串列元素做比較前被呼叫。" -#: ../../howto/sorting.rst:54 -msgid "For example, here's a case-insensitive string comparison:" +#: ../../howto/sorting.rst:56 +#, fuzzy +msgid "" +"For example, here's a case-insensitive string comparison " +"using :meth:`str.casefold`:" msgstr "例如這裡有一個不區分大小寫的字串比對:" -#: ../../howto/sorting.rst:56 +#: ../../howto/sorting.rst:59 msgid "" ">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n" "['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']" @@ -131,7 +137,7 @@ msgstr "" ">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n" "['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']" -#: ../../howto/sorting.rst:61 +#: ../../howto/sorting.rst:64 msgid "" "The value of the *key* parameter should be a function (or other callable) " "that takes a single argument and returns a key to use for sorting purposes. " @@ -142,14 +148,14 @@ msgstr "" "傳一個用來排序的鍵。因為對每個輸入來說鍵函式只會被呼叫一次,所以這個做法是快" "速的。" -#: ../../howto/sorting.rst:66 +#: ../../howto/sorting.rst:69 msgid "" "A common pattern is to sort complex objects using some of the object's " "indices as keys. For example:" msgstr "" "一個常見的模式是在排序複雜物件的時候使用一部分物件的索引值當作鍵,例如:" -#: ../../howto/sorting.rst:69 +#: ../../howto/sorting.rst:72 msgid "" ">>> student_tuples = [\n" "... ('john', 'A', 15),\n" @@ -167,12 +173,12 @@ msgstr "" ">>> sorted(student_tuples, key=lambda student: student[2]) # 依照年齡排序\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" -#: ../../howto/sorting.rst:79 +#: ../../howto/sorting.rst:82 msgid "" "The same technique works for objects with named attributes. For example:" msgstr "相同的做法也適用在有命名屬性的物件,例如:" -#: ../../howto/sorting.rst:81 +#: ../../howto/sorting.rst:84 msgid "" ">>> class Student:\n" "... def __init__(self, name, grade, age):\n" @@ -208,36 +214,37 @@ msgstr "" "序\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" -#: ../../howto/sorting.rst:99 +#: ../../howto/sorting.rst:102 msgid "" "Objects with named attributes can be made by a regular class as shown above, " -"or they can be instances of :class:`~dataclasses.dataclass` or a :term:" -"`named tuple`." +"or they can be instances of :class:`~dataclasses.dataclass` or " +"a :term:`named tuple`." msgstr "" -"具有命名屬性的物件可以如上方的方式使用一個常規的類別建立,或是他們可以是 :" -"class:`~dataclasses.dataclass` 的實例或是一個 :term:`named tuple`。" +"具有命名屬性的物件可以如上方的方式使用一個常規的類別建立,或是他們可以" +"是 :class:`~dataclasses.dataclass` 的實例或是一個 :term:`named tuple`。" -#: ../../howto/sorting.rst:104 +#: ../../howto/sorting.rst:107 msgid "Operator Module Functions and Partial Function Evaluation" msgstr "Operator 模組函式以及部份函式 (partial function) 評估" -#: ../../howto/sorting.rst:106 +#: ../../howto/sorting.rst:109 msgid "" "The :term:`key function` patterns shown above are very common, so Python " "provides convenience functions to make accessor functions easier and faster. " -"The :mod:`operator` module has :func:`~operator.itemgetter`, :func:" -"`~operator.attrgetter`, and a :func:`~operator.methodcaller` function." +"The :mod:`operator` module " +"has :func:`~operator.itemgetter`, :func:`~operator.attrgetter`, and " +"a :func:`~operator.methodcaller` function." msgstr "" "上述的\\ :term:`鍵函式 `\\ 模式非常常見,所以 Python 提供了方便" -"的函式讓物件存取更簡單且快速。:mod:`operator` 模組裡有 :func:`~operator." -"itemgetter`、:func:`~operator.attrgetter` 及 :func:`~operator.methodcaller` " -"函式可以使用。" +"的函式讓物件存取更簡單且快速。:mod:`operator` 模組裡" +"有 :func:`~operator.itemgetter`、:func:`~operator.attrgetter` " +"及 :func:`~operator.methodcaller` 函式可以使用。" -#: ../../howto/sorting.rst:111 +#: ../../howto/sorting.rst:114 msgid "Using those functions, the above examples become simpler and faster:" msgstr "使用這些函式讓上面的範例變得更簡單且快速:" -#: ../../howto/sorting.rst:113 +#: ../../howto/sorting.rst:116 msgid "" ">>> from operator import itemgetter, attrgetter\n" "\n" @@ -255,14 +262,14 @@ msgstr "" ">>> sorted(student_objects, key=attrgetter('age'))\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" -#: ../../howto/sorting.rst:123 +#: ../../howto/sorting.rst:126 msgid "" "The operator module functions allow multiple levels of sorting. For example, " "to sort by *grade* then by *age*:" msgstr "" "operator 模組的函式允許多層的排序,例如先用 *grade* 排序再用 *age* 排序:" -#: ../../howto/sorting.rst:126 +#: ../../howto/sorting.rst:129 msgid "" ">>> sorted(student_tuples, key=itemgetter(1,2))\n" "[('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]\n" @@ -276,18 +283,18 @@ msgstr "" ">>> sorted(student_objects, key=attrgetter('grade', 'age'))\n" "[('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]" -#: ../../howto/sorting.rst:134 +#: ../../howto/sorting.rst:137 msgid "" "The :mod:`functools` module provides another helpful tool for making key-" "functions. The :func:`~functools.partial` function can reduce the `arity " "`_ of a multi-argument function making " "it suitable for use as a key-function." msgstr "" -"模組 :mod:`functools` 提供了另一個製作鍵函式的好用工具。:func:`~functools." -"partial` 函式可以減少多引數函式的\\ `引數數目 `_,使其更適合作為鍵函式使用。" +"模組 :mod:`functools` 提供了另一個製作鍵函式的好用工" +"具。:func:`~functools.partial` 函式可以減少多引數函式的\\ `引數數目 `_,使其更適合作為鍵函式使用。" -#: ../../howto/sorting.rst:139 +#: ../../howto/sorting.rst:142 msgid "" ">>> from functools import partial\n" ">>> from unicodedata import normalize\n" @@ -311,11 +318,11 @@ msgstr "" ">>> sorted(names, key=partial(normalize, 'NFC'))\n" "['Abe', 'Eloise', 'Nubia', 'Núñez', 'Zeke', 'Zoë', 'Åbjørn', 'Élana']" -#: ../../howto/sorting.rst:153 +#: ../../howto/sorting.rst:156 msgid "Ascending and Descending" msgstr "升冪與降冪" -#: ../../howto/sorting.rst:155 +#: ../../howto/sorting.rst:158 msgid "" "Both :meth:`list.sort` and :func:`sorted` accept a *reverse* parameter with " "a boolean value. This is used to flag descending sorts. For example, to get " @@ -324,7 +331,7 @@ msgstr "" ":meth:`list.sort` 和 :func:`sorted` 都有一個 boolean 參數 *reverse* 用來表示" "是否要降冪排序。例如將學生資料依據 *age* 做降冪排序:" -#: ../../howto/sorting.rst:159 +#: ../../howto/sorting.rst:162 msgid "" ">>> sorted(student_tuples, key=itemgetter(2), reverse=True)\n" "[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]\n" @@ -338,11 +345,11 @@ msgstr "" ">>> sorted(student_objects, key=attrgetter('age'), reverse=True)\n" "[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" -#: ../../howto/sorting.rst:168 +#: ../../howto/sorting.rst:171 msgid "Sort Stability and Complex Sorts" msgstr "排序穩定性與複合排序" -#: ../../howto/sorting.rst:170 +#: ../../howto/sorting.rst:173 msgid "" "Sorts are guaranteed to be `stable `_\\. That means that when multiple records have " @@ -352,7 +359,7 @@ msgstr "" "Sorting_algorithm#Stability>`_,意思是當有多筆資料有相同的鍵,它們會維持原來" "的順序。" -#: ../../howto/sorting.rst:174 +#: ../../howto/sorting.rst:177 msgid "" ">>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]\n" ">>> sorted(data, key=itemgetter(0))\n" @@ -362,7 +369,7 @@ msgstr "" ">>> sorted(data, key=itemgetter(0))\n" "[('blue', 1), ('blue', 2), ('red', 1), ('red', 2)]" -#: ../../howto/sorting.rst:180 +#: ../../howto/sorting.rst:183 msgid "" "Notice how the two records for *blue* retain their original order so that " "``('blue', 1)`` is guaranteed to precede ``('blue', 2)``." @@ -370,7 +377,7 @@ msgstr "" "可以注意到有兩筆資料的鍵都是 *blue*,它們會維持本來的順序,即 ``('blue', " "1)`` 保證在 ``('blue', 2)`` 前面。" -#: ../../howto/sorting.rst:183 +#: ../../howto/sorting.rst:186 msgid "" "This wonderful property lets you build complex sorts in a series of sorting " "steps. For example, to sort the student data by descending *grade* and then " @@ -380,7 +387,7 @@ msgstr "" "做降冪排序再用 *age* 做升冪排序,你可以先用 *age* 排序一遍再用 *grade* 排序一" "遍:" -#: ../../howto/sorting.rst:187 +#: ../../howto/sorting.rst:190 msgid "" ">>> s = sorted(student_objects, key=attrgetter('age')) # sort on " "secondary key\n" @@ -393,7 +400,7 @@ msgstr "" "冪排序\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" -#: ../../howto/sorting.rst:193 +#: ../../howto/sorting.rst:196 msgid "" "This can be abstracted out into a wrapper function that can take a list and " "tuples of field and order to sort them on multiple passes." @@ -401,7 +408,7 @@ msgstr "" "這可以抽出一個包裝函式 (wrapper function),接受一個串列及多個欄位及升降冪的元" "組為引數,來對這個串列排序多遍。" -#: ../../howto/sorting.rst:196 +#: ../../howto/sorting.rst:199 msgid "" ">>> def multisort(xs, specs):\n" "... for key, reverse in reversed(specs):\n" @@ -419,7 +426,7 @@ msgstr "" ">>> multisort(list(student_objects), (('grade', True), ('age', False)))\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" -#: ../../howto/sorting.rst:206 +#: ../../howto/sorting.rst:209 msgid "" "The `Timsort `_ algorithm used in " "Python does multiple sorts efficiently because it can take advantage of any " @@ -428,36 +435,36 @@ msgstr "" "Python 裡使用的 `Timsort `_ 演算法,因" "為能利用資料集裡已經有的順序,可以有效率地做多次排序。" -#: ../../howto/sorting.rst:211 +#: ../../howto/sorting.rst:214 msgid "Decorate-Sort-Undecorate" msgstr "裝飾-排序-移除裝飾 (decorate-sort-undecorate)" -#: ../../howto/sorting.rst:213 +#: ../../howto/sorting.rst:216 msgid "This idiom is called Decorate-Sort-Undecorate after its three steps:" msgstr "這個用語的來源是因為它做了以下三件事情:" -#: ../../howto/sorting.rst:215 +#: ../../howto/sorting.rst:218 msgid "" "First, the initial list is decorated with new values that control the sort " "order." msgstr "首先,原始串列會裝飾 (decorated) 上新的值用來控制排序的順序。" -#: ../../howto/sorting.rst:217 +#: ../../howto/sorting.rst:220 msgid "Second, the decorated list is sorted." msgstr "接下來,排序裝飾過的串列。" -#: ../../howto/sorting.rst:219 +#: ../../howto/sorting.rst:222 msgid "" "Finally, the decorations are removed, creating a list that contains only the " "initial values in the new order." msgstr "最後,裝飾會被移除,並以新的順序產生一個只包含原始值的串列。" -#: ../../howto/sorting.rst:222 +#: ../../howto/sorting.rst:225 msgid "" "For example, to sort the student data by *grade* using the DSU approach:" msgstr "例如用上面說的方式來以 *grade* 排序學生資料:" -#: ../../howto/sorting.rst:224 +#: ../../howto/sorting.rst:227 msgid "" ">>> decorated = [(student.grade, i, student) for i, student in " "enumerate(student_objects)]\n" @@ -471,7 +478,7 @@ msgstr "" ">>> [student for grade, i, student in decorated] # 移除裝飾\n" "[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" -#: ../../howto/sorting.rst:231 +#: ../../howto/sorting.rst:234 msgid "" "This idiom works because tuples are compared lexicographically; the first " "items are compared; if they are the same then the second items are compared, " @@ -480,7 +487,7 @@ msgstr "" "這個方式會有效是因為元組是依照字典順序 (lexicographically) 來比較,先比較第一" "個項目,如果一樣再比較第二個項目,並依此類推。" -#: ../../howto/sorting.rst:235 +#: ../../howto/sorting.rst:238 msgid "" "It is not strictly necessary in all cases to include the index *i* in the " "decorated list, but including it gives two benefits:" @@ -488,7 +495,7 @@ msgstr "" "在所有情況下都把索引 *i* 加入已裝飾的串列並不是絕對需要的,但這樣做會有兩個好" "處:" -#: ../../howto/sorting.rst:238 +#: ../../howto/sorting.rst:241 msgid "" "The sort is stable -- if two items have the same key, their order will be " "preserved in the sorted list." @@ -496,7 +503,7 @@ msgstr "" "排序會是穩定的 -- 如果兩個項目有相同的鍵,它們在排序好的串列中會保持原來的順" "序。" -#: ../../howto/sorting.rst:241 +#: ../../howto/sorting.rst:244 msgid "" "The original items do not have to be comparable because the ordering of the " "decorated tuples will be determined by at most the first two items. So for " @@ -506,33 +513,33 @@ msgstr "" "原始項目不需要是可以比較的,因為最多只會用到前兩個項目就能決定裝飾過的元組的" "順序。例如原始串列可以包含不能直接用來排序的複數。" -#: ../../howto/sorting.rst:246 +#: ../../howto/sorting.rst:249 msgid "" -"Another name for this idiom is `Schwartzian transform `_\\, after Randal L. Schwartz, who " -"popularized it among Perl programmers." +"Another name for this idiom is `Schwartzian transform `_\\, after Randal L. Schwartz, " +"who popularized it among Perl programmers." msgstr "" "這個用語的另一個名字是 `Schwartzian transform `_,是由於 Randal L. Schwartz 讓這個方法在 Perl 程式設" "計師間普及。" -#: ../../howto/sorting.rst:250 +#: ../../howto/sorting.rst:253 msgid "" "Now that Python sorting provides key-functions, this technique is not often " "needed." msgstr "而因為 Python 的排序提供了鍵函式,已經不太需要用到這個方法了。" -#: ../../howto/sorting.rst:253 +#: ../../howto/sorting.rst:256 msgid "Comparison Functions" msgstr "比較函式 (comparison functions)" -#: ../../howto/sorting.rst:255 +#: ../../howto/sorting.rst:258 msgid "" "Unlike key functions that return an absolute value for sorting, a comparison " "function computes the relative ordering for two inputs." msgstr "不像鍵函式回傳一個用來排序的值,比較函式計算兩個輸入間的相對順序。" -#: ../../howto/sorting.rst:258 +#: ../../howto/sorting.rst:261 msgid "" "For example, a `balance scale `_ compares two samples giving a " @@ -545,7 +552,7 @@ msgstr "" "重。同樣地,像是 ``cmp(a, b)`` 這樣的比較函式會回傳負數代表小於、0 代表輸入相" "同或正數代表大於。" -#: ../../howto/sorting.rst:265 +#: ../../howto/sorting.rst:268 msgid "" "It is common to encounter comparison functions when translating algorithms " "from other languages. Also, some libraries provide comparison functions as " @@ -555,35 +562,130 @@ msgstr "" "當從其它語言翻譯演算法的時候常看到比較函式。有些函式庫也會提供比較函式作為其 " "API 的一部份,例如 :func:`locale.strcoll` 就是一個比較函式。" -#: ../../howto/sorting.rst:269 +#: ../../howto/sorting.rst:272 msgid "" -"To accommodate those situations, Python provides :class:`functools." -"cmp_to_key` to wrap the comparison function to make it usable as a key " -"function::" +"To accommodate those situations, Python " +"provides :class:`functools.cmp_to_key` to wrap the comparison function to " +"make it usable as a key function::" msgstr "" "為了滿足這些情境,Python 提供 :class:`functools.cmp_to_key` 來包裝比較函式," "讓其可以當作鍵函式來使用: ::" -#: ../../howto/sorting.rst:273 +#: ../../howto/sorting.rst:276 msgid "sorted(words, key=cmp_to_key(strcoll)) # locale-aware sort order" msgstr "sorted(words, key=cmp_to_key(strcoll)) # 理解語系的排序順序" -#: ../../howto/sorting.rst:276 +#: ../../howto/sorting.rst:279 +msgid "Strategies For Unorderable Types and Values" +msgstr "" + +#: ../../howto/sorting.rst:281 +msgid "" +"A number of type and value issues can arise when sorting. Here are some " +"strategies that can help:" +msgstr "" + +#: ../../howto/sorting.rst:284 +msgid "Convert non-comparable input types to strings prior to sorting:" +msgstr "" + +#: ../../howto/sorting.rst:286 +msgid "" +">>> data = ['twelve', '11', 10]\n" +">>> sorted(map(str, data))\n" +"['10', '11', 'twelve']" +msgstr "" + +#: ../../howto/sorting.rst:292 +msgid "" +"This is needed because most cross-type comparisons raise a :exc:`TypeError`." +msgstr "" + +#: ../../howto/sorting.rst:295 +msgid "Remove special values prior to sorting:" +msgstr "" + +#: ../../howto/sorting.rst:297 +msgid "" +">>> from math import isnan\n" +">>> from itertools import filterfalse\n" +">>> data = [3.3, float('nan'), 1.1, 2.2]\n" +">>> sorted(filterfalse(isnan, data))\n" +"[1.1, 2.2, 3.3]" +msgstr "" + +#: ../../howto/sorting.rst:305 +msgid "" +"This is needed because the `IEEE-754 standard `_ specifies that, \"Every NaN shall compare unordered with " +"everything, including itself.\"" +msgstr "" + +#: ../../howto/sorting.rst:309 +msgid "Likewise, ``None`` can be stripped from datasets as well:" +msgstr "" + +#: ../../howto/sorting.rst:311 +msgid "" +">>> data = [3.3, None, 1.1, 2.2]\n" +">>> sorted(x for x in data if x is not None)\n" +"[1.1, 2.2, 3.3]" +msgstr "" + +#: ../../howto/sorting.rst:317 +msgid "This is needed because ``None`` is not comparable to other types." +msgstr "" + +#: ../../howto/sorting.rst:319 +msgid "Convert mapping types into sorted item lists before sorting:" +msgstr "" + +#: ../../howto/sorting.rst:321 +msgid "" +">>> data = [{'a': 1}, {'b': 2}]\n" +">>> sorted(data, key=lambda d: sorted(d.items()))\n" +"[{'a': 1}, {'b': 2}]" +msgstr "" + +#: ../../howto/sorting.rst:327 +msgid "" +"This is needed because dict-to-dict comparisons raise a :exc:`TypeError`." +msgstr "" + +#: ../../howto/sorting.rst:330 +msgid "Convert set types into sorted lists before sorting:" +msgstr "" + +#: ../../howto/sorting.rst:332 +msgid "" +">>> data = [{'a', 'b', 'c'}, {'b', 'c', 'd'}]\n" +">>> sorted(map(sorted, data))\n" +"[['a', 'b', 'c'], ['b', 'c', 'd']]" +msgstr "" + +#: ../../howto/sorting.rst:338 +msgid "" +"This is needed because the elements contained in set types do not have a " +"deterministic order. For example, ``list({'a', 'b'})`` may produce either " +"``['a', 'b']`` or ``['b', 'a']``." +msgstr "" + +#: ../../howto/sorting.rst:343 msgid "Odds and Ends" msgstr "雜項說明" -#: ../../howto/sorting.rst:278 +#: ../../howto/sorting.rst:345 msgid "" -"For locale aware sorting, use :func:`locale.strxfrm` for a key function or :" -"func:`locale.strcoll` for a comparison function. This is necessary because " -"\"alphabetical\" sort orderings can vary across cultures even if the " +"For locale aware sorting, use :func:`locale.strxfrm` for a key function " +"or :func:`locale.strcoll` for a comparison function. This is necessary " +"because \"alphabetical\" sort orderings can vary across cultures even if the " "underlying alphabet is the same." msgstr "" "要處理能理解本地語系 (locale aware) 的排序可以使用 :func:`locale.strxfrm` 當" "作鍵函式,或 :func:`locale.strcoll` 當作比較函式。這樣做是必要的,因為在不同" "文化中就算是相同的字母,按「字母順序」排序的結果也各不相同。" -#: ../../howto/sorting.rst:283 +#: ../../howto/sorting.rst:350 msgid "" "The *reverse* parameter still maintains sort stability (so that records with " "equal keys retain the original order). Interestingly, that effect can be " @@ -594,7 +696,7 @@ msgstr "" "是,不加這個參數也可以模擬這個效果,只要使用內建的 :func:`reversed` 函式兩" "次:" -#: ../../howto/sorting.rst:288 +#: ../../howto/sorting.rst:355 msgid "" ">>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]\n" ">>> standard_way = sorted(data, key=itemgetter(0), reverse=True)\n" @@ -612,16 +714,16 @@ msgstr "" ">>> standard_way\n" "[('red', 1), ('red', 2), ('blue', 1), ('blue', 2)]" -#: ../../howto/sorting.rst:297 +#: ../../howto/sorting.rst:364 msgid "" "The sort routines use ``<`` when making comparisons between two objects. So, " -"it is easy to add a standard sort order to a class by defining an :meth:" -"`~object.__lt__` method:" +"it is easy to add a standard sort order to a class by defining " +"an :meth:`~object.__lt__` method:" msgstr "" "排序時會使用 ``<`` 來比較兩個物件,因此要在類別裡面加入排序順序比較規則是簡單" "的,只要透過定義 :meth:`~object.__lt__` 方法:" -#: ../../howto/sorting.rst:301 +#: ../../howto/sorting.rst:368 msgid "" ">>> Student.__lt__ = lambda self, other: self.age < other.age\n" ">>> sorted(student_objects)\n" @@ -631,20 +733,21 @@ msgstr "" ">>> sorted(student_objects)\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" -#: ../../howto/sorting.rst:307 +#: ../../howto/sorting.rst:374 msgid "" -"However, note that ``<`` can fall back to using :meth:`~object.__gt__` if :" -"meth:`~object.__lt__` is not implemented (see :func:`object.__lt__` for " +"However, note that ``<`` can fall back to using :meth:`~object.__gt__` " +"if :meth:`~object.__lt__` is not implemented (see :func:`object.__lt__` for " "details on the mechanics). To avoid surprises, :pep:`8` recommends that all " "six comparison methods be implemented. The :func:`~functools.total_ordering` " "decorator is provided to make that task easier." msgstr "" "然而,請注意,當 :meth:`~object.__lt__` 沒有被實作時,``<`` 可以回退 (fall " -"back) 使用 :meth:`~object.__gt__`\\ (有關技術上的細節資訊請看 :func:`object." -"__lt__` )。為了避免意外發生,:pep:`8` 建議所有六種的比較函式都需要被實作。裝" -"飾器 :func:`~functools.total_ordering` 被提供用來讓任務更為簡單。" +"back) 使用 :meth:`~object.__gt__`\\ (有關技術上的細節資訊請" +"看 :func:`object.__lt__` )。為了避免意外發生,:pep:`8` 建議所有六種的比較函" +"式都需要被實作。裝飾器 :func:`~functools.total_ordering` 被提供用來讓任務更為" +"簡單。" -#: ../../howto/sorting.rst:314 +#: ../../howto/sorting.rst:381 msgid "" "Key functions need not depend directly on the objects being sorted. A key " "function can also access external resources. For instance, if the student " @@ -654,7 +757,7 @@ msgstr "" "鍵函式不需要直接依賴用來排序的物件。鍵函式也可以存取外部資源,例如如果學生成" "績儲存在字典裡,它可以用來排序一個單獨的學生姓名串列:" -#: ../../howto/sorting.rst:319 +#: ../../howto/sorting.rst:386 msgid "" ">>> students = ['dave', 'john', 'jane']\n" ">>> newgrades = {'john': 'F', 'jane':'A', 'dave': 'C'}\n" @@ -666,11 +769,11 @@ msgstr "" ">>> sorted(students, key=newgrades.__getitem__)\n" "['jane', 'dave', 'john']" -#: ../../howto/sorting.rst:327 +#: ../../howto/sorting.rst:394 msgid "Partial Sorts" msgstr "部份排序" -#: ../../howto/sorting.rst:329 +#: ../../howto/sorting.rst:396 msgid "" "Some applications require only some of the data to be ordered. The standard " "library provides several tools that do less work than a full sort:" @@ -678,7 +781,7 @@ msgstr "" "有些應用程式只需要排序部份的資料。基礎函式庫提供相較做完整排序更為輕鬆的多項" "工具:" -#: ../../howto/sorting.rst:332 +#: ../../howto/sorting.rst:399 msgid "" ":func:`min` and :func:`max` return the smallest and largest values, " "respectively. These functions make a single pass over the input data and " @@ -687,7 +790,7 @@ msgstr "" ":func:`min` 以及 :func:`max` 會分別回傳最小值及最大值。這些函式會將輸入資料進" "行一次傳遞且幾乎無須輔助記憶體。" -#: ../../howto/sorting.rst:336 +#: ../../howto/sorting.rst:403 msgid "" ":func:`heapq.nsmallest` and :func:`heapq.nlargest` return the *n* smallest " "and largest values, respectively. These functions make a single pass over " @@ -699,7 +802,7 @@ msgstr "" "最大值。這些函式會將資料進行一次傳遞且一次只會保留 *n* 個元素在記憶體中。對於" "相對於輸入數量較小的 *n* 個值,這些函式進行的比較比完整排序要少得多。" -#: ../../howto/sorting.rst:342 +#: ../../howto/sorting.rst:409 msgid "" ":func:`heapq.heappush` and :func:`heapq.heappop` create and maintain a " "partially sorted arrangement of data that keeps the smallest element at " diff --git a/library/__future__.po b/library/__future__.po index 30cc1abfa56..ab72c73d7db 100644 --- a/library/__future__.po +++ b/library/__future__.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-03 00:19+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-02-06 02:12+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,10 +28,11 @@ msgstr "**原始碼:**\\ :source:`Lib/__future__.py`" #: ../../library/__future__.rst:11 msgid "" -"Imports of the form ``from __future__ import feature`` are called :ref:" -"`future statements `. These are special-cased by the Python compiler " -"to allow the use of new Python features in modules containing the future " -"statement before the release in which the feature becomes standard." +"Imports of the form ``from __future__ import feature`` are " +"called :ref:`future statements `. These are special-cased by the " +"Python compiler to allow the use of new Python features in modules " +"containing the future statement before the release in which the feature " +"becomes standard." msgstr "" "``from __future__ import feature`` 形式的引入被稱為 :ref:`future 陳述式 " "`。這些是 Python 編譯器的特殊情況,允許在該功能成為標準版本之前在包" @@ -67,9 +68,9 @@ msgstr "" #: ../../library/__future__.rst:29 msgid "" "To ensure that :ref:`future statements ` run under releases prior to " -"Python 2.1 at least yield runtime exceptions (the import of :mod:" -"`__future__` will fail, because there was no module of that name prior to " -"2.1)." +"Python 2.1 at least yield runtime exceptions (the import " +"of :mod:`__future__` will fail, because there was no module of that name " +"prior to 2.1)." msgstr "" "確保 :ref:`future 陳述式 `\\ 在 Python 2.1 之前的版本中運行至少會產" "生 runtime 例外(\\ :mod:`__future__` 的引入將會失敗,因為 2.1 之前沒有該名稱" @@ -195,14 +196,16 @@ msgid "Never [1]_" msgstr "從未 [1]_" #: ../../library/__future__.rst:84 -msgid ":pep:`563`: *Postponed evaluation of annotations*" -msgstr ":pep:`563`: *推遲對註釋的求值 (Postponed evaluation of annotations)*" +msgid "" +":pep:`563`: *Postponed evaluation of annotations*, :pep:`649`: *Deferred " +"evaluation of annotations using descriptors*" +msgstr "" -#: ../../library/__future__.rst:92 +#: ../../library/__future__.rst:93 msgid "Each statement in :file:`__future__.py` is of the form::" msgstr ":file:`__future__.py` 中的每個陳述式的形式如下: ::" -#: ../../library/__future__.rst:94 +#: ../../library/__future__.rst:95 msgid "" "FeatureName = _Feature(OptionalRelease, MandatoryRelease,\n" " CompilerFlag)" @@ -210,15 +213,15 @@ msgstr "" "FeatureName = _Feature(OptionalRelease, MandatoryRelease,\n" " CompilerFlag)" -#: ../../library/__future__.rst:97 +#: ../../library/__future__.rst:98 msgid "" "where, normally, *OptionalRelease* is less than *MandatoryRelease*, and both " "are 5-tuples of the same form as :data:`sys.version_info`::" msgstr "" -"通常,*OptionalRelease* 會小於 *MandatoryRelease*,且兩者都是與 :data:`sys." -"version_info` 形式相同的 5 元組 (5-tuple): ::" +"通常,*OptionalRelease* 會小於 *MandatoryRelease*,且兩者都是" +"與 :data:`sys.version_info` 形式相同的 5 元組 (5-tuple): ::" -#: ../../library/__future__.rst:100 +#: ../../library/__future__.rst:101 msgid "" "(PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int\n" " PY_MINOR_VERSION, # the 1; an int\n" @@ -231,18 +234,18 @@ msgstr "" "(PY_MAJOR_VERSION, # 2.1.0a3 裡面的 2;為一整數\n" " PY_MINOR_VERSION, # 1;為一整數\n" " PY_MICRO_VERSION, # 0;為一整數\n" -" PY_RELEASE_LEVEL, # \"alpha\"、\"beta\"、\"candidate\" 或 \"final\"; " -";為一字串\n" +" PY_RELEASE_LEVEL, # \"alpha\"、\"beta\"、\"candidate\" 或 \"final\"; ;為一" +"字串\n" " PY_RELEASE_SERIAL # 3;為一整數\n" ")" -#: ../../library/__future__.rst:109 +#: ../../library/__future__.rst:110 msgid "" "*OptionalRelease* records the first release in which the feature was " "accepted." msgstr "*OptionalRelease* 記錄該功能首次發布時的 Python 版本。" -#: ../../library/__future__.rst:113 +#: ../../library/__future__.rst:114 msgid "" "In the case of a *MandatoryRelease* that has not yet occurred, " "*MandatoryRelease* predicts the release in which the feature will become " @@ -251,7 +254,7 @@ msgstr "" "如果 *MandatoryRelease* 尚未發布,*MandatoryRelease* 會預測該功能將成為該語言" "一部分的版本。" -#: ../../library/__future__.rst:117 +#: ../../library/__future__.rst:118 msgid "" "Else *MandatoryRelease* records when the feature became part of the " "language; in releases at or after that, modules no longer need a future " @@ -261,7 +264,7 @@ msgstr "" "否則 *MandatoryRelease* 會記錄該功能是何時成為語言的一部分;在該版本或之後的" "版本中,模組不再需要 future 聲明來使用相關功能,但可以繼續使用此種引入方式。" -#: ../../library/__future__.rst:121 +#: ../../library/__future__.rst:122 msgid "" "*MandatoryRelease* may also be ``None``, meaning that a planned feature got " "dropped or that it is not yet decided." @@ -269,47 +272,59 @@ msgstr "" "*MandatoryRelease* 也可能是 ``None``,這意味著計劃中的功能被丟棄或者仍未決" "定。" -#: ../../library/__future__.rst:126 +#: ../../library/__future__.rst:127 msgid "" "*CompilerFlag* is the (bitfield) flag that should be passed in the fourth " "argument to the built-in function :func:`compile` to enable the feature in " -"dynamically compiled code. This flag is stored in the :attr:`_Feature." -"compiler_flag` attribute on :class:`_Feature` instances." +"dynamically compiled code. This flag is stored in " +"the :attr:`_Feature.compiler_flag` attribute on :class:`_Feature` instances." msgstr "" "*CompilerFlag* 是(位元欄位 (bitfield))旗標,應在第四個引數中傳遞給內建函" -"式 :func:`compile` 以在動態編譯的程式碼中啟用該功能。此旗標儲存在 :class:" -"`_Feature` 實例上的 :attr:`_Feature.compiler_flag` 屬性中。" +"式 :func:`compile` 以在動態編譯的程式碼中啟用該功能。此旗標儲存" +"在 :class:`_Feature` 實例上的 :attr:`_Feature.compiler_flag` 屬性中。" -#: ../../library/__future__.rst:132 +#: ../../library/__future__.rst:133 msgid "" "``from __future__ import annotations`` was previously scheduled to become " -"mandatory in Python 3.10, but the Python Steering Council twice decided to " -"delay the change (`announcement for Python 3.10 `__; `announcement for Python 3.11 `__). No " -"final decision has been made yet. See also :pep:`563` and :pep:`649`." +"mandatory in Python 3.10, but the change was delayed and ultimately " +"canceled. This feature will eventually be deprecated and removed. " +"See :pep:`649` and :pep:`749`." msgstr "" -"之前原本計劃在 Python 3.10 中強制使用 ``from __future__ import " -"annotations``,但 Python 指導委員會 (Python Steering Council) 兩次決議推遲這" -"一變動(`Python 3.10 的公告 `__;`Python 3.11 的" -"公告 `__)。目前還尚未做出決定。另請參閱 :pep:" -"`563` 和 :pep:`649`。" -#: ../../library/__future__.rst:142 +#: ../../library/__future__.rst:141 msgid ":ref:`future`" msgstr ":ref:`future`" -#: ../../library/__future__.rst:143 +#: ../../library/__future__.rst:142 msgid "How the compiler treats future imports." msgstr "編譯器如何處理 future 引入。" -#: ../../library/__future__.rst:145 +#: ../../library/__future__.rst:144 msgid ":pep:`236` - Back to the __future__" msgstr ":pep:`236` - 回到 __future__" -#: ../../library/__future__.rst:146 +#: ../../library/__future__.rst:145 msgid "The original proposal for the __future__ mechanism." msgstr "__future__ 機制的原始提案。" + +#~ msgid ":pep:`563`: *Postponed evaluation of annotations*" +#~ msgstr "" +#~ ":pep:`563`: *推遲對註釋的求值 (Postponed evaluation of annotations)*" + +#~ msgid "" +#~ "``from __future__ import annotations`` was previously scheduled to become " +#~ "mandatory in Python 3.10, but the Python Steering Council twice decided " +#~ "to delay the change (`announcement for Python 3.10 `__; `announcement for Python 3.11 " +#~ "`__). No final decision has been made " +#~ "yet. See also :pep:`563` and :pep:`649`." +#~ msgstr "" +#~ "之前原本計劃在 Python 3.10 中強制使用 ``from __future__ import " +#~ "annotations``,但 Python 指導委員會 (Python Steering Council) 兩次決議推遲" +#~ "這一變動(`Python 3.10 的公告 `__;" +#~ "`Python 3.11 的公告 `__)。目前還尚未" +#~ "做出決定。另請參閱 :pep:`563` 和 :pep:`649`。" diff --git a/library/__main__.po b/library/__main__.po index ff81f21bf65..76d8492ec26 100644 --- a/library/__main__.po +++ b/library/__main__.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-12-21 14:49+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,8 +43,8 @@ msgstr "在 Python 套件中的 ``__main__.py`` 檔案。" msgid "" "Both of these mechanisms are related to Python modules; how users interact " "with them and how they interact with each other. They are explained in " -"detail below. If you're new to Python modules, see the tutorial section :" -"ref:`tut-modules` for an introduction." +"detail below. If you're new to Python modules, see the tutorial " +"section :ref:`tut-modules` for an introduction." msgstr "" "這兩種機制都與 Python 模組有關;使用者如何與它們互動以及它們如何彼此互動。下" "面會詳細解釋它們。如果你不熟悉 Python 模組,請參閱教學章節 :ref:`tut-" @@ -145,8 +145,8 @@ msgstr "" #: ../../library/__main__.rst:67 msgid "" -"the Python module or package passed to the Python interpreter with the :" -"option:`-m` argument:" +"the Python module or package passed to the Python interpreter with " +"the :option:`-m` argument:" msgstr "使用 :option:`-m` 引數傳遞給 Python 直譯器的 Python 模組或套件:" #: ../../library/__main__.rst:70 @@ -334,9 +334,9 @@ msgstr "sys.exit(main())" #: ../../library/__main__.rst:175 msgid "" "Since the call to ``main`` is wrapped in :func:`sys.exit`, the expectation " -"is that your function will return some value acceptable as an input to :func:" -"`sys.exit`; typically, an integer or ``None`` (which is implicitly returned " -"if your function does not have a return statement)." +"is that your function will return some value acceptable as an input " +"to :func:`sys.exit`; typically, an integer or ``None`` (which is implicitly " +"returned if your function does not have a return statement)." msgstr "" "由於對 ``main`` 的呼叫包含在 :func:`sys.exit` 中,因此期望你的函式將傳回一些" "可接受作為 :func:`sys.exit` 輸入的值;通常來說,會是一個整數或 ``None``\\(如" @@ -357,14 +357,14 @@ msgid "" "In particular, be careful about returning strings from your ``main`` " "function. :func:`sys.exit` will interpret a string argument as a failure " "message, so your program will have an exit code of ``1``, indicating " -"failure, and the string will be written to :data:`sys.stderr`. The ``echo." -"py`` example from earlier exemplifies using the ``sys.exit(main())`` " +"failure, and the string will be written to :data:`sys.stderr`. The " +"``echo.py`` example from earlier exemplifies using the ``sys.exit(main())`` " "convention." msgstr "" "特別是,要謹慎處理從 ``main`` 函式回傳字串。:func:`sys.exit` 會將字串引數直譯" "為失敗訊息,因此你的程式將有一個表示失敗的結束代碼 ``1``,並且該字串將被寫" -"入 :data:`sys.stderr`。前面的 ``echo.py`` 範例使用慣例的 ``sys." -"exit(main())`` 進行示範。" +"入 :data:`sys.stderr`。前面的 ``echo.py`` 範例使用慣例的 " +"``sys.exit(main())`` 進行示範。" #: ../../library/__main__.rst:193 msgid "" @@ -486,8 +486,8 @@ msgstr "" #: ../../library/__main__.rst:254 msgid "" -"This won't work for ``__main__.py`` files in the root directory of a ``." -"zip`` file though. Hence, for consistency, a minimal ``__main__.py`` " +"This won't work for ``__main__.py`` files in the root directory of a " +"``.zip`` file though. Hence, for consistency, a minimal ``__main__.py`` " "without a ``__name__`` check is preferred." msgstr "" "但這對於 ``.zip`` 檔案根目錄中的 ``__main__.py`` 檔案不起作用。因此,為了保持" @@ -541,6 +541,7 @@ msgid "Here is an example module that consumes the ``__main__`` namespace::" msgstr "這是一個使用 ``__main__`` 命名空間的範例模組:" #: ../../library/__main__.rst:284 +#, fuzzy msgid "" "# namely.py\n" "\n" @@ -553,10 +554,7 @@ msgid "" " if not did_user_define_their_name():\n" " raise ValueError('Define the variable `my_name`!')\n" "\n" -" if '__file__' in dir(__main__):\n" -" print(__main__.my_name, \"found in file\", __main__.__file__)\n" -" else:\n" -" print(__main__.my_name)" +" print(__main__.my_name)" msgstr "" "# namely.py\n" "\n" @@ -574,11 +572,11 @@ msgstr "" " else:\n" " print(__main__.my_name)" -#: ../../library/__main__.rst:300 +#: ../../library/__main__.rst:297 msgid "Example usage of this module could be as follows::" msgstr "該模組的範例用法如下: ::" -#: ../../library/__main__.rst:302 +#: ../../library/__main__.rst:299 msgid "" "# start.py\n" "\n" @@ -614,11 +612,11 @@ msgstr "" "if __name__ == \"__main__\":\n" " sys.exit(main())" -#: ../../library/__main__.rst:319 +#: ../../library/__main__.rst:316 msgid "Now, if we started our program, the result would look like this:" msgstr "現在,如果我們啟動程式,結果將如下所示:" -#: ../../library/__main__.rst:321 +#: ../../library/__main__.rst:318 msgid "" "$ python start.py\n" "Define the variable `my_name`!" @@ -626,7 +624,7 @@ msgstr "" "$ python start.py\n" "Define the variable `my_name`!" -#: ../../library/__main__.rst:326 +#: ../../library/__main__.rst:323 msgid "" "The exit code of the program would be 1, indicating an error. Uncommenting " "the line with ``my_name = \"Dinsdale\"`` fixes the program and now it exits " @@ -635,15 +633,16 @@ msgstr "" "程式的結束代碼將為 1,表示出現錯誤。取消註解 ``my_name = \"Dinsdale\"`` 而修" "復程式後,現在它以狀態碼 0 結束,表示成功:" -#: ../../library/__main__.rst:330 +#: ../../library/__main__.rst:327 +#, fuzzy msgid "" "$ python start.py\n" -"Dinsdale found in file /path/to/start.py" +"Dinsdale" msgstr "" "$ python start.py\n" -"Dinsdale found in file /path/to/start.py" +"Define the variable `my_name`!" -#: ../../library/__main__.rst:335 +#: ../../library/__main__.rst:332 msgid "" "Note that importing ``__main__`` doesn't cause any issues with " "unintentionally running top-level code meant for script use which is put in " @@ -654,7 +653,7 @@ msgstr "" "__name__ == \"__main__\"`` 區塊的頂層程式碼(本來是給腳本使用的)而造成任何問" "題。為什麼這樣做會如預期運作?" -#: ../../library/__main__.rst:339 +#: ../../library/__main__.rst:336 msgid "" "Python inserts an empty ``__main__`` module in :data:`sys.modules` at " "interpreter startup, and populates it by running top-level code. In our " @@ -674,7 +673,7 @@ msgstr "" "文件中的\\ :ref:`關於 __main__ 的特別考量 `\\ 了解其工作" "原理的詳細資訊。" -#: ../../library/__main__.rst:348 +#: ../../library/__main__.rst:345 msgid "" "The Python REPL is another example of a \"top-level environment\", so " "anything defined in the REPL becomes part of the ``__main__`` scope::" @@ -682,7 +681,7 @@ msgstr "" "Python REPL 是「頂層環境」的另一個範例,因此 REPL 中定義的任何內容都成為 作域" "的一部分: ::" -#: ../../library/__main__.rst:351 +#: ../../library/__main__.rst:348 msgid "" ">>> import namely\n" ">>> namely.did_user_define_their_name()\n" @@ -710,16 +709,22 @@ msgstr "" ">>> namely.print_user_name()\n" "Jabberwocky" -#: ../../library/__main__.rst:364 +#: ../../library/__main__.rst:361 msgid "" -"Note that in this case the ``__main__`` scope doesn't contain a ``__file__`` " -"attribute as it's interactive." -msgstr "" -"請注意,在這種情況下, ``__main__`` 作用域不包含 ``__file__`` 屬性,因為它是" -"互動式的。" - -#: ../../library/__main__.rst:367 -msgid "" -"The ``__main__`` scope is used in the implementation of :mod:`pdb` and :mod:" -"`rlcompleter`." +"The ``__main__`` scope is used in the implementation of :mod:`pdb` " +"and :mod:`rlcompleter`." msgstr "``__main__`` 作用域用於 :mod:`pdb` 和 :mod:`rlcompleter` 的實作。" + +#~ msgid "" +#~ "$ python start.py\n" +#~ "Dinsdale found in file /path/to/start.py" +#~ msgstr "" +#~ "$ python start.py\n" +#~ "Dinsdale found in file /path/to/start.py" + +#~ msgid "" +#~ "Note that in this case the ``__main__`` scope doesn't contain a " +#~ "``__file__`` attribute as it's interactive." +#~ msgstr "" +#~ "請注意,在這種情況下, ``__main__`` 作用域不包含 ``__file__`` 屬性,因為它" +#~ "是互動式的。" diff --git a/library/_thread.po b/library/_thread.po index 1f52f9ef12e..56330b261ed 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-12 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,8 +32,9 @@ msgid "" msgstr "" "這個模組提供了與多個執行緒(也稱為:dfn:`輕量級行程` 或 :dfn: `任務`)一起工作" "的低階原始物件 --- 多個控制執行緒分享其全域資料空間。為了處理同步問題,也提供" -"了簡單的鎖 (lock) 機制(也稱為:dfn:`互斥鎖` 或 :dfn:`二進位號誌`)。 :mod:" -"`threading` 模組提供了一個建立在這個模組之上的更易於使用和高階的執行緒 API。" +"了簡單的鎖 (lock) 機制(也稱為:dfn:`互斥鎖` 或 :dfn:`二進位號誌" +"`)。 :mod:`threading` 模組提供了一個建立在這個模組之上的更易於使用和高階的執" +"行緒 API。" #: ../../library/_thread.rst:26 msgid "This module used to be optional, it is now always available." @@ -71,10 +72,11 @@ msgstr "當函式回傳時,執行緒會靜默退出。" #: ../../library/_thread.rst:52 msgid "" -"When the function terminates with an unhandled exception, :func:`sys." -"unraisablehook` is called to handle the exception. The *object* attribute of " -"the hook argument is *function*. By default, a stack trace is printed and " -"then the thread exits (but other threads continue to run)." +"When the function terminates with an unhandled " +"exception, :func:`sys.unraisablehook` is called to handle the exception. The " +"*object* attribute of the hook argument is *function*. By default, a stack " +"trace is printed and then the thread exits (but other threads continue to " +"run)." msgstr "" "當函式因未處理的例外終止時,將呼叫 :func:`sys.unraisablehook` 來處理該例外。" "鉤子引數的 *object* 屬性是 *function*。預設情況下,會列印堆疊跟蹤,然後執行緒" @@ -112,16 +114,17 @@ msgid "" "If given, *signum* is the number of the signal to simulate. If *signum* is " "not given, :const:`signal.SIGINT` is simulated." msgstr "" -"如果提供了 *signum*,則模擬指定的訊號編號。如果未提供 *signum*,則模擬 :" -"const:`signal.SIGINT` 訊號。" +"如果提供了 *signum*,則模擬指定的訊號編號。如果未提供 *signum*,則模" +"擬 :const:`signal.SIGINT` 訊號。" #: ../../library/_thread.rst:75 msgid "" -"If the given signal isn't handled by Python (it was set to :const:`signal." -"SIG_DFL` or :const:`signal.SIG_IGN`), this function does nothing." +"If the given signal isn't handled by Python (it was set " +"to :const:`signal.SIG_DFL` or :const:`signal.SIG_IGN`), this function does " +"nothing." msgstr "" -"如果給定的訊號在 Python 中未被處理(即設置為 :const:`signal.SIG_DFL` 或 :" -"const:`signal.SIG_IGN`),此函式不做任何操作。" +"如果給定的訊號在 Python 中未被處理(即設置為 :const:`signal.SIG_DFL` " +"或 :const:`signal.SIG_IGN`),此函式不做任何操作。" #: ../../library/_thread.rst:79 msgid "The *signum* argument is added to customize the signal number." @@ -185,9 +188,9 @@ msgid "" "*size* argument specifies the stack size to be used for subsequently created " "threads, and must be 0 (use platform or configured default) or a positive " "integer value of at least 32,768 (32 KiB). If *size* is not specified, 0 is " -"used. If changing the thread stack size is unsupported, a :exc:" -"`RuntimeError` is raised. If the specified stack size is invalid, a :exc:" -"`ValueError` is raised and the stack size is unmodified. 32 KiB is " +"used. If changing the thread stack size is unsupported, " +"a :exc:`RuntimeError` is raised. If the specified stack size is invalid, " +"a :exc:`ValueError` is raised and the stack size is unmodified. 32 KiB is " "currently the minimum supported stack size value to guarantee sufficient " "stack space for the interpreter itself. Note that some platforms may have " "particular restrictions on values for the stack size, such as requiring a " @@ -200,12 +203,12 @@ msgstr "" "回傳在建立新執行緒時使用的執行緒堆疊大小。可選的 *size* 引數指定了隨後建立的" "執行緒要使用的堆疊大小,必須是 0(使用平台或配置的預設值)或至少 32,768(32 " "KiB)的正整數值。如果未指定 *size*,則使用 0。如果不支持更改執行緒堆疊大小," -"則會引發 :exc:`RuntimeError` 錯誤。如果指定的堆疊大小無效,則會引發 :exc:" -"`ValueError` 錯誤,並且堆疊大小不會被修改。目前,32 KiB 是保證解譯器本身具有" -"足夠堆疊空間所支持的最小堆疊大小值。請注意,某些平台對於堆疊大小的值可能有特" -"定的限制,例如要求最小堆疊大小 > 32 KiB,或要求按系統記憶體頁面大小的倍數進行" -"分配。應參考平台文件以取得更多訊息(4 KiB 頁面是比較普遍的;在缺乏更具體訊息" -"的情況下,建議使用 4096 的倍數作為堆疊大小)。" +"則會引發 :exc:`RuntimeError` 錯誤。如果指定的堆疊大小無效,則會引" +"發 :exc:`ValueError` 錯誤,並且堆疊大小不會被修改。目前,32 KiB 是保證解譯器" +"本身具有足夠堆疊空間所支持的最小堆疊大小值。請注意,某些平台對於堆疊大小的值" +"可能有特定的限制,例如要求最小堆疊大小 > 32 KiB,或要求按系統記憶體頁面大小的" +"倍數進行分配。應參考平台文件以取得更多訊息(4 KiB 頁面是比較普遍的;在缺乏更" +"具體訊息的情況下,建議使用 4096 的倍數作為堆疊大小)。" #: ../../library/_thread.rst:150 msgid "Unix platforms with POSIX threads support." @@ -269,26 +272,31 @@ msgstr "新增的 *timeout* 參數。" msgid "Lock acquires can now be interrupted by signals on POSIX." msgstr "現在取得鎖的操作可以被 POSIX 訊號中斷。" -#: ../../library/_thread.rst:193 +#: ../../library/_thread.rst:190 +#, fuzzy +msgid "Lock acquires can now be interrupted by signals on Windows." +msgstr "現在取得鎖的操作可以被 POSIX 訊號中斷。" + +#: ../../library/_thread.rst:196 msgid "" "Releases the lock. The lock must have been acquired earlier, but not " "necessarily by the same thread." msgstr "釋放鎖。鎖必須先前被取得,但不一定是由同一個執行緒取得的。" -#: ../../library/_thread.rst:199 +#: ../../library/_thread.rst:202 msgid "" "Return the status of the lock: ``True`` if it has been acquired by some " "thread, ``False`` if not." msgstr "" "回傳鎖的狀態:如果鎖已被某個執行緒取得,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/_thread.rst:202 +#: ../../library/_thread.rst:205 msgid "" -"In addition to these methods, lock objects can also be used via the :keyword:" -"`with` statement, e.g.::" +"In addition to these methods, lock objects can also be used via " +"the :keyword:`with` statement, e.g.::" msgstr "除了這些方法之外,鎖物件還可以透過 :keyword:`with` 語句來使用,例如:" -#: ../../library/_thread.rst:205 +#: ../../library/_thread.rst:208 msgid "" "import _thread\n" "\n" @@ -304,41 +312,30 @@ msgstr "" "with a_lock:\n" " print(\"a_lock 在執行這裡時被鎖定\")" -#: ../../library/_thread.rst:212 +#: ../../library/_thread.rst:215 msgid "**Caveats:**" msgstr "**注意事項:**" -#: ../../library/_thread.rst:216 +#: ../../library/_thread.rst:219 msgid "" "Interrupts always go to the main thread (the :exc:`KeyboardInterrupt` " "exception will be received by that thread.)" msgstr "中斷總會跳到主執行緒(該執行緒將接收 :exc:`KeyboardInterrupt` 例外。)" -#: ../../library/_thread.rst:219 +#: ../../library/_thread.rst:222 msgid "" "Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is " "equivalent to calling :func:`_thread.exit`." msgstr "" -"呼叫 :func:`sys.exit` 函式或引發 :exc:`SystemExit` 例外等同於呼叫 :func:" -"`_thread.exit` 函式。" +"呼叫 :func:`sys.exit` 函式或引發 :exc:`SystemExit` 例外等同於呼" +"叫 :func:`_thread.exit` 函式。" -#: ../../library/_thread.rst:222 -msgid "" -"It is platform-dependent whether the :meth:`~threading.Lock.acquire` method " -"on a lock can be interrupted (so that the :exc:`KeyboardInterrupt` exception " -"will happen immediately, rather than only after the lock has been acquired " -"or the operation has timed out). It can be interrupted on POSIX, but not on " -"Windows." -msgstr "" -"鎖的 :meth:`~threading.Lock.acquire` 方法是否可以中斷(如此一來 :exc:" -"`KeyboardInterrupt` 例外會立即發生,而不是僅在取得鎖或操作逾時後)是取決於平" -"台的。在 POSIX 上可以中斷,但在 Windows 上則不行。" - -#: ../../library/_thread.rst:228 +#: ../../library/_thread.rst:225 msgid "" "When the main thread exits, it is system defined whether the other threads " -"survive. On most systems, they are killed without executing :keyword:" -"`try` ... :keyword:`finally` clauses or executing object destructors." +"survive. On most systems, they are killed without " +"executing :keyword:`try` ... :keyword:`finally` clauses or executing object " +"destructors." msgstr "" "當主執行緒退出時,其他執行緒是否保留是由系統決定的。在大多數系統上,它們將被" "終止,而不會執行 :keyword:`try` ... :keyword:`finally` 子句或執行物件的解構函" @@ -372,10 +369,21 @@ msgstr "threads(執行緒)" msgid "POSIX" msgstr "POSIX" -#: ../../library/_thread.rst:214 +#: ../../library/_thread.rst:217 msgid "module" msgstr "module(模組)" -#: ../../library/_thread.rst:214 +#: ../../library/_thread.rst:217 msgid "signal" msgstr "signal(訊號)" + +#~ msgid "" +#~ "It is platform-dependent whether the :meth:`~threading.Lock.acquire` " +#~ "method on a lock can be interrupted (so that the :exc:`KeyboardInterrupt` " +#~ "exception will happen immediately, rather than only after the lock has " +#~ "been acquired or the operation has timed out). It can be interrupted on " +#~ "POSIX, but not on Windows." +#~ msgstr "" +#~ "鎖的 :meth:`~threading.Lock.acquire` 方法是否可以中斷(如此一" +#~ "來 :exc:`KeyboardInterrupt` 例外會立即發生,而不是僅在取得鎖或操作逾時後)" +#~ "是取決於平台的。在 POSIX 上可以中斷,但在 Windows 上則不行。" diff --git a/library/annotationlib.po b/library/annotationlib.po new file mode 100644 index 00000000000..b201ca0b504 --- /dev/null +++ b/library/annotationlib.po @@ -0,0 +1,949 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/annotationlib.rst:2 +msgid ":mod:`!annotationlib` --- Functionality for introspecting annotations" +msgstr "" + +#: ../../library/annotationlib.rst:9 +msgid "**Source code:** :source:`Lib/annotationlib.py`" +msgstr "" + +#: ../../library/annotationlib.rst:18 +msgid "" +"The :mod:`!annotationlib` module provides tools for " +"introspecting :term:`annotations ` on modules, classes, and " +"functions." +msgstr "" + +#: ../../library/annotationlib.rst:21 +msgid "" +"Annotations are :ref:`lazily evaluated ` and often contain " +"forward references to objects that are not yet defined when the annotation " +"is created. This module provides a set of low-level tools that can be used " +"to retrieve annotations in a reliable way, even in the presence of forward " +"references and other edge cases." +msgstr "" + +#: ../../library/annotationlib.rst:26 +msgid "" +"This module supports retrieving annotations in three main formats " +"(see :class:`Format`), each of which works best for different use cases:" +msgstr "" + +#: ../../library/annotationlib.rst:29 +msgid "" +":attr:`~Format.VALUE` evaluates the annotations and returns their value. " +"This is most straightforward to work with, but it may raise errors, for " +"example if the annotations contain references to undefined names." +msgstr "" + +#: ../../library/annotationlib.rst:32 +msgid "" +":attr:`~Format.FORWARDREF` returns :class:`ForwardRef` objects for " +"annotations that cannot be resolved, allowing you to inspect the annotations " +"without evaluating them. This is useful when you need to work with " +"annotations that may contain unresolved forward references." +msgstr "" + +#: ../../library/annotationlib.rst:36 +msgid "" +":attr:`~Format.STRING` returns the annotations as a string, similar to how " +"it would appear in the source file. This is useful for documentation " +"generators that want to display annotations in a readable way." +msgstr "" + +#: ../../library/annotationlib.rst:40 +msgid "" +"The :func:`get_annotations` function is the main entry point for retrieving " +"annotations. Given a function, class, or module, it returns an annotations " +"dictionary in the requested format. This module also provides functionality " +"for working directly with the :term:`annotate function` that is used to " +"evaluate annotations, such as :func:`get_annotate_from_class_namespace` " +"and :func:`call_annotate_function`, as well as " +"the :func:`call_evaluate_function` function for working with :term:`evaluate " +"functions `." +msgstr "" + +#: ../../library/annotationlib.rst:52 +msgid "" +":pep:`649` proposed the current model for how annotations work in Python." +msgstr "" + +#: ../../library/annotationlib.rst:54 +msgid "" +":pep:`749` expanded on various aspects of :pep:`649` and introduced " +"the :mod:`!annotationlib` module." +msgstr "" + +#: ../../library/annotationlib.rst:57 +msgid "" +":ref:`annotations-howto` provides best practices for working with " +"annotations." +msgstr "" + +#: ../../library/annotationlib.rst:60 +msgid "" +":pypi:`typing-extensions` provides a backport of :func:`get_annotations` " +"that works on earlier versions of Python." +msgstr "" + +#: ../../library/annotationlib.rst:64 +msgid "Annotation semantics" +msgstr "" + +#: ../../library/annotationlib.rst:66 +msgid "" +"The way annotations are evaluated has changed over the history of Python 3, " +"and currently still depends on a :ref:`future import `. There have " +"been execution models for annotations:" +msgstr "" + +#: ../../library/annotationlib.rst:70 +msgid "" +"*Stock semantics* (default in Python 3.0 through 3.13; see :pep:`3107` " +"and :pep:`526`): Annotations are evaluated eagerly, as they are encountered " +"in the source code." +msgstr "" + +#: ../../library/annotationlib.rst:73 +msgid "" +"*Stringified annotations* (used with ``from __future__ import annotations`` " +"in Python 3.7 and newer; see :pep:`563`): Annotations are stored as strings " +"only." +msgstr "" + +#: ../../library/annotationlib.rst:76 +msgid "" +"*Deferred evaluation* (default in Python 3.14 and newer; see :pep:`649` " +"and :pep:`749`): Annotations are evaluated lazily, only when they are " +"accessed." +msgstr "" + +#: ../../library/annotationlib.rst:79 +msgid "As an example, consider the following program::" +msgstr "" + +#: ../../library/annotationlib.rst:81 +msgid "" +"def func(a: Cls) -> None:\n" +" print(a)\n" +"\n" +"class Cls: pass\n" +"\n" +"print(func.__annotations__)" +msgstr "" + +#: ../../library/annotationlib.rst:88 +msgid "This will behave as follows:" +msgstr "" + +#: ../../library/annotationlib.rst:90 +msgid "" +"Under stock semantics (Python 3.13 and earlier), it will throw " +"a :exc:`NameError` at the line where ``func`` is defined, because ``Cls`` is " +"an undefined name at that point." +msgstr "" + +#: ../../library/annotationlib.rst:93 +msgid "" +"Under stringified annotations (if ``from __future__ import annotations`` is " +"used), it will print ``{'a': 'Cls', 'return': 'None'}``." +msgstr "" + +#: ../../library/annotationlib.rst:95 +msgid "" +"Under deferred evaluation (Python 3.14 and later), it will print ``{'a': " +", 'return': None}``." +msgstr "" + +#: ../../library/annotationlib.rst:98 +msgid "" +"Stock semantics were used when function annotations were first introduced in " +"Python 3.0 (by :pep:`3107`) because this was the simplest, most obvious way " +"to implement annotations. The same execution model was used when variable " +"annotations were introduced in Python 3.6 (by :pep:`526`). However, stock " +"semantics caused problems when using annotations as type hints, such as a " +"need to refer to names that are not yet defined when the annotation is " +"encountered. In addition, there were performance problems with executing " +"annotations at module import time. Therefore, in Python 3.7, :pep:`563` " +"introduced the ability to store annotations as strings using the ``from " +"__future__ import annotations`` syntax. The plan at the time was to " +"eventually make this behavior the default, but a problem appeared: " +"stringified annotations are more difficult to process for those who " +"introspect annotations at runtime. An alternative proposal, :pep:`649`, " +"introduced the third execution model, deferred evaluation, and was " +"implemented in Python 3.14. Stringified annotations are still used if ``from " +"__future__ import annotations`` is present, but this behavior will " +"eventually be removed." +msgstr "" + +#: ../../library/annotationlib.rst:117 +msgid "Classes" +msgstr "" + +#: ../../library/annotationlib.rst:121 +msgid "" +"An :class:`~enum.IntEnum` describing the formats in which annotations can be " +"returned. Members of the enum, or their equivalent integer values, can be " +"passed to :func:`get_annotations` and other functions in this module, as " +"well as to :attr:`~object.__annotate__` functions." +msgstr "" + +#: ../../library/annotationlib.rst:129 +msgid "Values are the result of evaluating the annotation expressions." +msgstr "" + +#: ../../library/annotationlib.rst:134 +msgid "" +"Special value used to signal that an annotate function is being evaluated in " +"a special environment with fake globals. When passed this value, annotate " +"functions should either return the same value as for " +"the :attr:`Format.VALUE` format, or raise :exc:`NotImplementedError` to " +"signal that they do not support execution in this environment. This format " +"is only used internally and should not be passed to the functions in this " +"module." +msgstr "" + +#: ../../library/annotationlib.rst:145 +msgid "" +"Values are real annotation values (as per :attr:`Format.VALUE` format) for " +"defined values, and :class:`ForwardRef` proxies for undefined values. Real " +"objects may contain references to :class:`ForwardRef` proxy objects." +msgstr "" + +#: ../../library/annotationlib.rst:153 +msgid "" +"Values are the text string of the annotation as it appears in the source " +"code, up to modifications including, but not restricted to, whitespace " +"normalizations and constant values optimizations." +msgstr "" + +#: ../../library/annotationlib.rst:157 +msgid "" +"The exact values of these strings may change in future versions of Python." +msgstr "" + +#: ../../library/annotationlib.rst:163 +msgid "A proxy object for forward references in annotations." +msgstr "" + +#: ../../library/annotationlib.rst:165 +msgid "" +"Instances of this class are returned when the :attr:`~Format.FORWARDREF` " +"format is used and annotations contain a name that cannot be resolved. This " +"can happen when a forward reference is used in an annotation, such as when a " +"class is referenced before it is defined." +msgstr "" + +#: ../../library/annotationlib.rst:172 +msgid "" +"A string containing the code that was evaluated to produce " +"the :class:`~ForwardRef`. The string may not be exactly equivalent to the " +"original source." +msgstr "" + +#: ../../library/annotationlib.rst:178 +msgid "Evaluate the forward reference, returning its value." +msgstr "" + +#: ../../library/annotationlib.rst:180 +msgid "" +"If the *format* argument is :attr:`~Format.VALUE` (the default), this method " +"may throw an exception, such as :exc:`NameError`, if the forward reference " +"refers to a name that cannot be resolved. The arguments to this method can " +"be used to provide bindings for names that would otherwise be undefined. If " +"the *format* argument is :attr:`~Format.FORWARDREF`, the method will never " +"throw an exception, but may return a :class:`~ForwardRef` instance. For " +"example, if the forward reference object contains the code " +"``list[undefined]``, where ``undefined`` is a name that is not defined, " +"evaluating it with the :attr:`~Format.FORWARDREF` format will return " +"``list[ForwardRef('undefined')]``. If the *format* argument " +"is :attr:`~Format.STRING`, the method will " +"return :attr:`~ForwardRef.__forward_arg__`." +msgstr "" + +#: ../../library/annotationlib.rst:192 +msgid "" +"The *owner* parameter provides the preferred mechanism for passing scope " +"information to this method. The owner of a :class:`~ForwardRef` is the " +"object that contains the annotation from which the :class:`~ForwardRef` " +"derives, such as a module object, type object, or function object." +msgstr "" + +#: ../../library/annotationlib.rst:197 +msgid "" +"The *globals*, *locals*, and *type_params* parameters provide a more precise " +"mechanism for influencing the names that are available when " +"the :class:`~ForwardRef` is evaluated. *globals* and *locals* are passed " +"to :func:`eval`, representing the global and local namespaces in which the " +"name is evaluated. The *type_params* parameter is relevant for objects " +"created using the native syntax for :ref:`generic classes ` " +"and :ref:`functions `. It is a tuple of :ref:`type " +"parameters ` that are in scope while the forward reference is " +"being evaluated. For example, if evaluating a :class:`~ForwardRef` retrieved " +"from an annotation found in the class namespace of a generic class ``C``, " +"*type_params* should be set to ``C.__type_params__``." +msgstr "" + +#: ../../library/annotationlib.rst:208 +msgid "" +":class:`~ForwardRef` instances returned by :func:`get_annotations` retain " +"references to information about the scope they originated from, so calling " +"this method with no further arguments may be sufficient to evaluate such " +"objects. :class:`~ForwardRef` instances created by other means may not have " +"any information about their scope, so passing arguments to this method may " +"be necessary to evaluate them successfully." +msgstr "" + +#: ../../library/annotationlib.rst:215 +msgid "" +"If no *owner*, *globals*, *locals*, or *type_params* are provided and " +"the :class:`~ForwardRef` does not contain information about its origin, " +"empty globals and locals dictionaries are used." +msgstr "" + +#: ../../library/annotationlib.rst:223 +msgid "Functions" +msgstr "" + +#: ../../library/annotationlib.rst:227 +msgid "" +"Convert an annotations dict containing runtime values to a dict containing " +"only strings. If the values are not already strings, they are converted " +"using :func:`type_repr`. This is meant as a helper for user-provided " +"annotate functions that support the :attr:`~Format.STRING` format but do not " +"have access to the code creating the annotations." +msgstr "" + +#: ../../library/annotationlib.rst:234 +msgid "" +"For example, this is used to implement the :attr:`~Format.STRING` " +"for :class:`typing.TypedDict` classes created through the functional syntax:" +msgstr "" + +#: ../../library/annotationlib.rst:237 +msgid "" +">>> from typing import TypedDict\n" +">>> Movie = TypedDict(\"movie\", {\"name\": str, \"year\": int})\n" +">>> get_annotations(Movie, format=Format.STRING)\n" +"{'name': 'str', 'year': 'int'}" +msgstr "" + +#: ../../library/annotationlib.rst:248 +msgid "" +"Call the :term:`annotate function` *annotate* with the given *format*, a " +"member of the :class:`Format` enum, and return the annotations dictionary " +"produced by the function." +msgstr "" + +#: ../../library/annotationlib.rst:252 +msgid "" +"This helper function is required because annotate functions generated by the " +"compiler for functions, classes, and modules only support " +"the :attr:`~Format.VALUE` format when called directly. To support other " +"formats, this function calls the annotate function in a special environment " +"that allows it to produce annotations in the other formats. This is a useful " +"building block when implementing functionality that needs to partially " +"evaluate annotations while a class is being constructed." +msgstr "" + +#: ../../library/annotationlib.rst:261 +msgid "" +"*owner* is the object that owns the annotation function, usually a function, " +"class, or module. If provided, it is used in the :attr:`~Format.FORWARDREF` " +"format to produce a :class:`ForwardRef` object that carries more information." +msgstr "" + +#: ../../library/annotationlib.rst:268 +msgid "" +":PEP:`PEP 649 <649#the-stringizer-and-the-fake-globals-environment>` " +"contains an explanation of the implementation technique used by this " +"function." +msgstr "" + +#: ../../library/annotationlib.rst:276 +msgid "" +"Call the :term:`evaluate function` *evaluate* with the given *format*, a " +"member of the :class:`Format` enum, and return the value produced by the " +"function. This is similar to :func:`call_annotate_function`, but the latter " +"always returns a dictionary mapping strings to annotations, while this " +"function returns a single value." +msgstr "" + +#: ../../library/annotationlib.rst:282 +msgid "" +"This is intended for use with the evaluate functions generated for lazily " +"evaluated elements related to type aliases and type parameters:" +msgstr "" + +#: ../../library/annotationlib.rst:285 +msgid ":meth:`typing.TypeAliasType.evaluate_value`, the value of type aliases" +msgstr "" + +#: ../../library/annotationlib.rst:286 +msgid ":meth:`typing.TypeVar.evaluate_bound`, the bound of type variables" +msgstr "" + +#: ../../library/annotationlib.rst:287 +msgid "" +":meth:`typing.TypeVar.evaluate_constraints`, the constraints of type " +"variables" +msgstr "" + +#: ../../library/annotationlib.rst:289 +msgid "" +":meth:`typing.TypeVar.evaluate_default`, the default value of type variables" +msgstr "" + +#: ../../library/annotationlib.rst:291 +msgid "" +":meth:`typing.ParamSpec.evaluate_default`, the default value of parameter " +"specifications" +msgstr "" + +#: ../../library/annotationlib.rst:293 +msgid "" +":meth:`typing.TypeVarTuple.evaluate_default`, the default value of type " +"variable tuples" +msgstr "" + +#: ../../library/annotationlib.rst:296 +msgid "" +"*owner* is the object that owns the evaluate function, such as the type " +"alias or type variable object." +msgstr "" + +#: ../../library/annotationlib.rst:299 +msgid "" +"*format* can be used to control the format in which the value is returned:" +msgstr "" + +#: ../../library/annotationlib.rst:301 +msgid "" +">>> type Alias = undefined\n" +">>> call_evaluate_function(Alias.evaluate_value, Format.VALUE)\n" +"Traceback (most recent call last):\n" +"...\n" +"NameError: name 'undefined' is not defined\n" +">>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)\n" +"ForwardRef('undefined')\n" +">>> call_evaluate_function(Alias.evaluate_value, Format.STRING)\n" +"'undefined'" +msgstr "" + +#: ../../library/annotationlib.rst:317 +msgid "" +"Retrieve the :term:`annotate function` from a class namespace dictionary " +"*namespace*. Return :const:`!None` if the namespace does not contain an " +"annotate function. This is primarily useful before the class has been fully " +"created (e.g., in a metaclass); after the class exists, the annotate " +"function can be retrieved with ``cls.__annotate__``. See :ref:`below " +"` for an example using this function in a metaclass." +msgstr "" + +#: ../../library/annotationlib.rst:327 +msgid "Compute the annotations dict for an object." +msgstr "" + +#: ../../library/annotationlib.rst:329 +msgid "" +"*obj* may be a callable, class, module, or other object " +"with :attr:`~object.__annotate__` or :attr:`~object.__annotations__` " +"attributes. Passing any other object raises :exc:`TypeError`." +msgstr "" + +#: ../../library/annotationlib.rst:333 +msgid "" +"The *format* parameter controls the format in which annotations are " +"returned, and must be a member of the :class:`Format` enum or its integer " +"equivalent. The different formats work as follows:" +msgstr "" + +#: ../../library/annotationlib.rst:337 +msgid "" +"VALUE: :attr:`!object.__annotations__` is tried first; if that does not " +"exist, the :attr:`!object.__annotate__` function is called if it exists." +msgstr "" + +#: ../../library/annotationlib.rst:339 +msgid "" +"FORWARDREF: If :attr:`!object.__annotations__` exists and can be evaluated " +"successfully, it is used; otherwise, the :attr:`!object.__annotate__` " +"function is called. If it does not exist either, :attr:`!" +"object.__annotations__` is tried again and any error from accessing it is re-" +"raised." +msgstr "" + +#: ../../library/annotationlib.rst:343 +msgid "" +"STRING: If :attr:`!object.__annotate__` exists, it is called first; " +"otherwise, :attr:`!object.__annotations__` is used and stringified " +"using :func:`annotations_to_string`." +msgstr "" + +#: ../../library/annotationlib.rst:347 +msgid "" +"Returns a dict. :func:`!get_annotations` returns a new dict every time it's " +"called; calling it twice on the same object will return two different but " +"equivalent dicts." +msgstr "" + +#: ../../library/annotationlib.rst:351 +msgid "This function handles several details for you:" +msgstr "" + +#: ../../library/annotationlib.rst:353 +msgid "" +"If *eval_str* is true, values of type :class:`!str` will be un-stringized " +"using :func:`eval`. This is intended for use with stringized annotations " +"(``from __future__ import annotations``). It is an error to set *eval_str* " +"to true with formats other than :attr:`Format.VALUE`." +msgstr "" + +#: ../../library/annotationlib.rst:358 +msgid "" +"If *obj* doesn't have an annotations dict, returns an empty dict. (Functions " +"and methods always have an annotations dict; classes, modules, and other " +"types of callables may not.)" +msgstr "" + +#: ../../library/annotationlib.rst:362 +msgid "" +"Ignores inherited annotations on classes, as well as annotations on " +"metaclasses. If a class doesn't have its own annotations dict, returns an " +"empty dict." +msgstr "" + +#: ../../library/annotationlib.rst:365 +msgid "" +"All accesses to object members and dict values are done using ``getattr()`` " +"and ``dict.get()`` for safety." +msgstr "" + +#: ../../library/annotationlib.rst:368 +msgid "" +"*eval_str* controls whether or not values of type :class:`!str` are replaced " +"with the result of calling :func:`eval` on those values:" +msgstr "" + +#: ../../library/annotationlib.rst:371 +msgid "" +"If eval_str is true, :func:`eval` is called on values of type :class:`!str`. " +"(Note that :func:`!get_annotations` doesn't catch exceptions; " +"if :func:`eval` raises an exception, it will unwind the stack past " +"the :func:`!get_annotations` call.)" +msgstr "" + +#: ../../library/annotationlib.rst:375 +msgid "" +"If *eval_str* is false (the default), values of type :class:`!str` are " +"unchanged." +msgstr "" + +#: ../../library/annotationlib.rst:378 +msgid "" +"*globals* and *locals* are passed in to :func:`eval`; see the documentation " +"for :func:`eval` for more information. If *globals* or *locals* is :const:`!" +"None`, this function may replace that value with a context-specific default, " +"contingent on ``type(obj)``:" +msgstr "" + +#: ../../library/annotationlib.rst:383 +msgid "If *obj* is a module, *globals* defaults to ``obj.__dict__``." +msgstr "" + +#: ../../library/annotationlib.rst:384 +msgid "" +"If *obj* is a class, *globals* defaults to " +"``sys.modules[obj.__module__].__dict__`` and *locals* defaults to the *obj* " +"class namespace." +msgstr "" + +#: ../../library/annotationlib.rst:387 +msgid "" +"If *obj* is a callable, *globals* defaults to :attr:`obj.__globals__ " +"`, although if *obj* is a wrapped function " +"(using :func:`functools.update_wrapper`) or a :class:`functools.partial` " +"object, it is unwrapped until a non-wrapped function is found." +msgstr "" + +#: ../../library/annotationlib.rst:393 +msgid "" +"Calling :func:`!get_annotations` is best practice for accessing the " +"annotations dict of any object. See :ref:`annotations-howto` for more " +"information on annotations best practices." +msgstr "" + +#: ../../library/annotationlib.rst:397 +msgid "" +">>> def f(a: int, b: str) -> float:\n" +"... pass\n" +">>> get_annotations(f)\n" +"{'a': , 'b': , 'return': }" +msgstr "" + +#: ../../library/annotationlib.rst:408 +msgid "" +"Convert an arbitrary Python value to a format suitable for use by " +"the :attr:`~Format.STRING` format. This calls :func:`repr` for most objects, " +"but has special handling for some objects, such as type objects." +msgstr "" + +#: ../../library/annotationlib.rst:412 +msgid "" +"This is meant as a helper for user-provided annotate functions that support " +"the :attr:`~Format.STRING` format but do not have access to the code " +"creating the annotations. It can also be used to provide a user-friendly " +"string representation for other objects that contain values that are " +"commonly encountered in annotations." +msgstr "" + +#: ../../library/annotationlib.rst:422 +msgid "Recipes" +msgstr "" + +#: ../../library/annotationlib.rst:427 +msgid "Using annotations in a metaclass" +msgstr "" + +#: ../../library/annotationlib.rst:429 +msgid "" +"A :ref:`metaclass ` may want to inspect or even modify the " +"annotations in a class body during class creation. Doing so requires " +"retrieving annotations from the class namespace dictionary. For classes " +"created with ``from __future__ import annotations``, the annotations will be " +"in the ``__annotations__`` key of the dictionary. For other classes with " +"annotations, :func:`get_annotate_from_class_namespace` can be used to get " +"the annotate function, and :func:`call_annotate_function` can be used to " +"call it and retrieve the annotations. Using the :attr:`~Format.FORWARDREF` " +"format will usually be best, because this allows the annotations to refer to " +"names that cannot yet be resolved when the class is created." +msgstr "" + +#: ../../library/annotationlib.rst:440 +msgid "" +"To modify the annotations, it is best to create a wrapper annotate function " +"that calls the original annotate function, makes any necessary adjustments, " +"and returns the result." +msgstr "" + +#: ../../library/annotationlib.rst:444 +msgid "" +"Below is an example of a metaclass that filters out " +"all :class:`typing.ClassVar` annotations from the class and puts them in a " +"separate attribute:" +msgstr "" + +#: ../../library/annotationlib.rst:447 +msgid "" +"import annotationlib\n" +"import typing\n" +"\n" +"class ClassVarSeparator(type):\n" +" def __new__(mcls, name, bases, ns):\n" +" if \"__annotations__\" in ns: # from __future__ import annotations\n" +" annotations = ns[\"__annotations__\"]\n" +" classvar_keys = {\n" +" key for key, value in annotations.items()\n" +" # Use string comparison for simplicity; a more robust solution\n" +" # could use annotationlib.ForwardRef.evaluate\n" +" if value.startswith(\"ClassVar\")\n" +" }\n" +" classvars = {key: annotations[key] for key in classvar_keys}\n" +" ns[\"__annotations__\"] = {\n" +" key: value for key, value in annotations.items()\n" +" if key not in classvar_keys\n" +" }\n" +" wrapped_annotate = None\n" +" elif annotate := annotationlib.get_annotate_from_class_namespace(ns):\n" +" annotations = annotationlib.call_annotate_function(\n" +" annotate, format=annotationlib.Format.FORWARDREF\n" +" )\n" +" classvar_keys = {\n" +" key for key, value in annotations.items()\n" +" if typing.get_origin(value) is typing.ClassVar\n" +" }\n" +" classvars = {key: annotations[key] for key in classvar_keys}\n" +"\n" +" def wrapped_annotate(format):\n" +" annos = annotationlib.call_annotate_function(annotate, format, " +"owner=typ)\n" +" return {key: value for key, value in annos.items() if key not in " +"classvar_keys}\n" +"\n" +" else: # no annotations\n" +" classvars = {}\n" +" wrapped_annotate = None\n" +" typ = super().__new__(mcls, name, bases, ns)\n" +"\n" +" if wrapped_annotate is not None:\n" +" # Wrap the original __annotate__ with a wrapper that removes " +"ClassVars\n" +" typ.__annotate__ = wrapped_annotate\n" +" typ.classvars = classvars # Store the ClassVars in a separate " +"attribute\n" +" return typ" +msgstr "" + +#: ../../library/annotationlib.rst:495 +msgid "Limitations of the ``STRING`` format" +msgstr "" + +#: ../../library/annotationlib.rst:497 +msgid "" +"The :attr:`~Format.STRING` format is meant to approximate the source code of " +"the annotation, but the implementation strategy used means that it is not " +"always possible to recover the exact source code." +msgstr "" + +#: ../../library/annotationlib.rst:501 +msgid "" +"First, the stringifier of course cannot recover any information that is not " +"present in the compiled code, including comments, whitespace, " +"parenthesization, and operations that get simplified by the compiler." +msgstr "" + +#: ../../library/annotationlib.rst:505 +msgid "" +"Second, the stringifier can intercept almost all operations that involve " +"names looked up in some scope, but it cannot intercept operations that " +"operate fully on constants. As a corollary, this also means it is not safe " +"to request the ``STRING`` format on untrusted code: Python is powerful " +"enough that it is possible to achieve arbitrary code execution even with no " +"access to any globals or builtins. For example:" +msgstr "" + +#: ../../library/annotationlib.rst:511 +msgid "" +">>> def f(x: (1).__class__.__base__.__subclasses__()" +"[-1].__init__.__builtins__[\"print\"](\"Hello world\")): pass\n" +"...\n" +">>> annotationlib.get_annotations(f, format=annotationlib.Format.STRING)\n" +"Hello world\n" +"{'x': 'None'}" +msgstr "" + +#: ../../library/annotationlib.rst:520 +msgid "" +"This particular example works as of the time of writing, but it relies on " +"implementation details and is not guaranteed to work in the future." +msgstr "" + +#: ../../library/annotationlib.rst:523 +msgid "" +"Among the different kinds of expressions that exist in Python, as " +"represented by the :mod:`ast` module, some expressions are supported, " +"meaning that the ``STRING`` format can generally recover the original source " +"code; others are unsupported, meaning that they may result in incorrect " +"output or an error." +msgstr "" + +#: ../../library/annotationlib.rst:528 +msgid "The following are supported (sometimes with caveats):" +msgstr "" + +#: ../../library/annotationlib.rst:530 +msgid ":class:`ast.BinOp`" +msgstr "" + +#: ../../library/annotationlib.rst:531 +msgid ":class:`ast.UnaryOp`" +msgstr "" + +#: ../../library/annotationlib.rst:533 +msgid "" +":class:`ast.Invert` (``~``), :class:`ast.UAdd` (``+``), " +"and :class:`ast.USub` (``-``) are supported" +msgstr "" + +#: ../../library/annotationlib.rst:534 +msgid ":class:`ast.Not` (``not``) is not supported" +msgstr "" + +#: ../../library/annotationlib.rst:536 +msgid ":class:`ast.Dict` (except when using ``**`` unpacking)" +msgstr "" + +#: ../../library/annotationlib.rst:537 +msgid ":class:`ast.Set`" +msgstr "" + +#: ../../library/annotationlib.rst:538 +msgid ":class:`ast.Compare`" +msgstr "" + +#: ../../library/annotationlib.rst:540 +msgid ":class:`ast.Eq` and :class:`ast.NotEq` are supported" +msgstr "" + +#: ../../library/annotationlib.rst:541 +msgid "" +":class:`ast.Lt`, :class:`ast.LtE`, :class:`ast.Gt`, and :class:`ast.GtE` are " +"supported, but the operand may be flipped" +msgstr "" + +#: ../../library/annotationlib.rst:542 +msgid "" +":class:`ast.Is`, :class:`ast.IsNot`, :class:`ast.In`, and :class:`ast.NotIn` " +"are not supported" +msgstr "" + +#: ../../library/annotationlib.rst:544 +msgid ":class:`ast.Call` (except when using ``**`` unpacking)" +msgstr "" + +#: ../../library/annotationlib.rst:545 +msgid "" +":class:`ast.Constant` (though not the exact representation of the constant; " +"for example, escape sequences in strings are lost; hexadecimal numbers are " +"converted to decimal)" +msgstr "" + +#: ../../library/annotationlib.rst:547 +msgid ":class:`ast.Attribute` (assuming the value is not a constant)" +msgstr "" + +#: ../../library/annotationlib.rst:548 +msgid ":class:`ast.Subscript` (assuming the value is not a constant)" +msgstr "" + +#: ../../library/annotationlib.rst:549 +msgid ":class:`ast.Starred` (``*`` unpacking)" +msgstr "" + +#: ../../library/annotationlib.rst:550 +msgid ":class:`ast.Name`" +msgstr "" + +#: ../../library/annotationlib.rst:551 +msgid ":class:`ast.List`" +msgstr "" + +#: ../../library/annotationlib.rst:552 +msgid ":class:`ast.Tuple`" +msgstr "" + +#: ../../library/annotationlib.rst:553 +msgid ":class:`ast.Slice`" +msgstr "" + +#: ../../library/annotationlib.rst:555 +msgid "" +"The following are unsupported, but throw an informative error when " +"encountered by the stringifier:" +msgstr "" + +#: ../../library/annotationlib.rst:558 +msgid "" +":class:`ast.FormattedValue` (f-strings; error is not detected if conversion " +"specifiers like ``!r`` are used)" +msgstr "" + +#: ../../library/annotationlib.rst:560 +msgid ":class:`ast.JoinedStr` (f-strings)" +msgstr "" + +#: ../../library/annotationlib.rst:562 +msgid "The following are unsupported and result in incorrect output:" +msgstr "" + +#: ../../library/annotationlib.rst:564 +msgid ":class:`ast.BoolOp` (``and`` and ``or``)" +msgstr "" + +#: ../../library/annotationlib.rst:565 +msgid ":class:`ast.IfExp`" +msgstr "" + +#: ../../library/annotationlib.rst:566 +msgid ":class:`ast.Lambda`" +msgstr "" + +#: ../../library/annotationlib.rst:567 +msgid ":class:`ast.ListComp`" +msgstr "" + +#: ../../library/annotationlib.rst:568 +msgid ":class:`ast.SetComp`" +msgstr "" + +#: ../../library/annotationlib.rst:569 +msgid ":class:`ast.DictComp`" +msgstr "" + +#: ../../library/annotationlib.rst:570 +msgid ":class:`ast.GeneratorExp`" +msgstr "" + +#: ../../library/annotationlib.rst:572 +msgid "" +"The following are disallowed in annotation scopes and therefore not relevant:" +msgstr "" + +#: ../../library/annotationlib.rst:574 +msgid ":class:`ast.NamedExpr` (``:=``)" +msgstr "" + +#: ../../library/annotationlib.rst:575 +msgid ":class:`ast.Await`" +msgstr "" + +#: ../../library/annotationlib.rst:576 +msgid ":class:`ast.Yield`" +msgstr "" + +#: ../../library/annotationlib.rst:577 +msgid ":class:`ast.YieldFrom`" +msgstr "" + +#: ../../library/annotationlib.rst:581 +msgid "Limitations of the ``FORWARDREF`` format" +msgstr "" + +#: ../../library/annotationlib.rst:583 +msgid "" +"The :attr:`~Format.FORWARDREF` format aims to produce real values as much as " +"possible, with anything that cannot be resolved replaced " +"with :class:`ForwardRef` objects. It is affected by broadly the same " +"Limitations as the :attr:`~Format.STRING` format: annotations that perform " +"operations on literals or that use unsupported expression types may raise " +"exceptions when evaluated using the :attr:`~Format.FORWARDREF` format." +msgstr "" + +#: ../../library/annotationlib.rst:590 +msgid "Below are a few examples of the behavior with unsupported expressions:" +msgstr "" + +#: ../../library/annotationlib.rst:592 +msgid "" +">>> from annotationlib import get_annotations, Format\n" +">>> def zerodiv(x: 1 / 0): ...\n" +">>> get_annotations(zerodiv, format=Format.STRING)\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero\n" +">>> get_annotations(zerodiv, format=Format.FORWARDREF)\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero\n" +">>> def ifexp(x: 1 if y else 0): ...\n" +">>> get_annotations(ifexp, format=Format.STRING)\n" +"{'x': '1'}" +msgstr "" diff --git a/library/archiving.po b/library/archiving.po index c42e38f29a4..2a6622b8716 100644 --- a/library/archiving.po +++ b/library/archiving.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-02-18 14:22+0800\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,11 +25,12 @@ msgid "Data Compression and Archiving" msgstr "資料壓縮與保存" #: ../../library/archiving.rst:7 +#, fuzzy msgid "" "The modules described in this chapter support data compression with the " -"zlib, gzip, bzip2 and lzma algorithms, and the creation of ZIP- and tar-" -"format archives. See also :ref:`archiving-operations` provided by the :mod:" -"`shutil` module." +"zlib, gzip, bzip2, lzma, and zstd algorithms, and the creation of ZIP- and " +"tar-format archives. See also :ref:`archiving-operations` provided by " +"the :mod:`shutil` module." msgstr "" "本章中描述的模組支援使用 zlib、gzip、bzip2 和 lzma 演算法進行資料壓縮,以及建" "立 ZIP 和 tar 格式的存檔。另請參閱 :mod:`shutil` 模組提供的 :ref:`archiving-" diff --git a/library/argparse.po b/library/argparse.po index 7c9a382be06..2b6b092ccca 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-20 00:19+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -47,16 +47,16 @@ msgstr "教學" #: ../../library/argparse.rst:30 msgid "" "This page contains the API reference information. For a more gentle " -"introduction to Python command-line parsing, have a look at the :ref:" -"`argparse tutorial `." +"introduction to Python command-line parsing, have a look at " +"the :ref:`argparse tutorial `." msgstr "" #: ../../library/argparse.rst:34 msgid "" "The :mod:`!argparse` module makes it easy to write user-friendly command-" "line interfaces. The program defines what arguments it requires, and :mod:`!" -"argparse` will figure out how to parse those out of :data:`sys.argv`. The :" -"mod:`!argparse` module also automatically generates help and usage " +"argparse` will figure out how to parse those out of :data:`sys.argv`. " +"The :mod:`!argparse` module also automatically generates help and usage " "messages. The module will also issue errors when users give the program " "invalid arguments." msgstr "" @@ -116,8 +116,8 @@ msgstr "" #: ../../library/argparse.rst:65 msgid "" -"If you're looking for a guide about how to upgrade :mod:`optparse` code to :" -"mod:`!argparse`, see :ref:`Upgrading Optparse Code `." msgstr "" @@ -125,131 +125,148 @@ msgstr "" msgid "ArgumentParser objects" msgstr "ArgumentParser 物件" -#: ../../library/argparse.rst:78 +#: ../../library/argparse.rst:79 msgid "" "Create a new :class:`ArgumentParser` object. All parameters should be passed " "as keyword arguments. Each parameter has its own more detailed description " "below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:82 +#: ../../library/argparse.rst:83 +#, fuzzy msgid "" -"prog_ - The name of the program (default: ``os.path.basename(sys.argv[0])``)" +"prog_ - The name of the program (default: generated from the ``__main__`` " +"module attributes and ``sys.argv[0]``)" msgstr "prog_ - 程式的名稱(預設值:``os.path.basename(sys.argv[0])``)" -#: ../../library/argparse.rst:85 +#: ../../library/argparse.rst:86 msgid "" "usage_ - The string describing the program usage (default: generated from " "arguments added to parser)" msgstr "usage_ - 描述程式用法的字串(預設值:從新增到剖析器的引數產生)" -#: ../../library/argparse.rst:88 +#: ../../library/argparse.rst:89 msgid "" "description_ - Text to display before the argument help (by default, no text)" msgstr "description_ - 引數說明之前要顯示的文字(預設值:無文字)" -#: ../../library/argparse.rst:91 +#: ../../library/argparse.rst:92 msgid "epilog_ - Text to display after the argument help (by default, no text)" msgstr "epilog_ - 引數說明之後要顯示的文字(預設值:無文字)" -#: ../../library/argparse.rst:93 +#: ../../library/argparse.rst:94 msgid "" "parents_ - A list of :class:`ArgumentParser` objects whose arguments should " "also be included" msgstr "parents_ - 一個 :class:`ArgumentParser` 物件的串列,其引數也應該被包含" -#: ../../library/argparse.rst:96 +#: ../../library/argparse.rst:97 msgid "formatter_class_ - A class for customizing the help output" msgstr "formatter_class_ - 用於自訂說明輸出的類別" -#: ../../library/argparse.rst:98 +#: ../../library/argparse.rst:99 msgid "" "prefix_chars_ - The set of characters that prefix optional arguments " "(default: '-')" msgstr "prefix_chars_ - 前綴可選引數的字元集合(預設值:'-')" -#: ../../library/argparse.rst:101 +#: ../../library/argparse.rst:102 msgid "" "fromfile_prefix_chars_ - The set of characters that prefix files from which " "additional arguments should be read (default: ``None``)" msgstr "" -#: ../../library/argparse.rst:104 +#: ../../library/argparse.rst:105 msgid "" "argument_default_ - The global default value for arguments (default: " "``None``)" msgstr "" -#: ../../library/argparse.rst:107 +#: ../../library/argparse.rst:108 msgid "" "conflict_handler_ - The strategy for resolving conflicting optionals " "(usually unnecessary)" msgstr "" -#: ../../library/argparse.rst:110 +#: ../../library/argparse.rst:111 msgid "" "add_help_ - Add a ``-h/--help`` option to the parser (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:112 +#: ../../library/argparse.rst:113 msgid "" "allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is " -"unambiguous. (default: ``True``)" +"unambiguous (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:115 +#: ../../library/argparse.rst:116 msgid "" "exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits " "with error info when an error occurs. (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:118 +#: ../../library/argparse.rst:119 +msgid "" +"suggest_on_error_ - Enables suggestions for mistyped argument choices and " +"subparser names (default: ``False``)" +msgstr "" + +#: ../../library/argparse.rst:122 +msgid "color_ - Allow color output (default: ``True``)" +msgstr "" + +#: ../../library/argparse.rst:124 msgid "*allow_abbrev* parameter was added." msgstr "新增 *allow_abbrev* 參數。" -#: ../../library/argparse.rst:121 +#: ../../library/argparse.rst:127 msgid "" "In previous versions, *allow_abbrev* also disabled grouping of short flags " "such as ``-vv`` to mean ``-v -v``." msgstr "" -#: ../../library/argparse.rst:125 +#: ../../library/argparse.rst:131 msgid "*exit_on_error* parameter was added." msgstr "新增 *exit_on_error* 參數。" -#: ../../library/argparse.rst:128 ../../library/argparse.rst:616 +#: ../../library/argparse.rst:134 +#, fuzzy +msgid "*suggest_on_error* and *color* parameters were added." +msgstr "新增 *exit_on_error* 參數。" + +#: ../../library/argparse.rst:137 ../../library/argparse.rst:684 msgid "The following sections describe how each of these are used." msgstr "" -#: ../../library/argparse.rst:134 +#: ../../library/argparse.rst:143 msgid "prog" msgstr "prog" -#: ../../library/argparse.rst:137 +#: ../../library/argparse.rst:146 msgid "" "By default, :class:`ArgumentParser` calculates the name of the program to " "display in help messages depending on the way the Python interpreter was run:" msgstr "" -#: ../../library/argparse.rst:140 +#: ../../library/argparse.rst:149 msgid "" "The :func:`base name ` of ``sys.argv[0]`` if a file was " "passed as argument." msgstr "" -#: ../../library/argparse.rst:142 +#: ../../library/argparse.rst:151 msgid "" "The Python interpreter name followed by ``sys.argv[0]`` if a directory or a " "zipfile was passed as argument." msgstr "" -#: ../../library/argparse.rst:144 +#: ../../library/argparse.rst:153 msgid "" "The Python interpreter name followed by ``-m`` followed by the module or " "package name if the :option:`-m` option was used." msgstr "" -#: ../../library/argparse.rst:147 +#: ../../library/argparse.rst:156 msgid "" "This default is almost always desirable because it will make the help " "messages match the string that was used to invoke the program on the command " @@ -257,7 +274,7 @@ msgid "" "supplied using the ``prog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:152 +#: ../../library/argparse.rst:161 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.print_help()\n" @@ -273,14 +290,14 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:159 +#: ../../library/argparse.rst:168 msgid "" -"Note that the program name, whether determined from ``sys.argv[0]`` or from " -"the ``prog=`` argument, is available to help messages using the ``%(prog)s`` " -"format specifier." +"Note that the program name, whether determined from ``sys.argv[0]``, from " +"the ``__main__`` module attributes or from the ``prog=`` argument, is " +"available to help messages using the ``%(prog)s`` format specifier." msgstr "" -#: ../../library/argparse.rst:165 +#: ../../library/argparse.rst:175 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.add_argument('--foo', help='foo of the %(prog)s program')\n" @@ -300,18 +317,24 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO foo of the myprogram program" -#: ../../library/argparse.rst:176 +#: ../../library/argparse.rst:184 +msgid "" +"The default ``prog`` value now reflects how ``__main__`` was actually " +"executed, rather than always being ``os.path.basename(sys.argv[0])``." +msgstr "" + +#: ../../library/argparse.rst:189 msgid "usage" msgstr "usage" -#: ../../library/argparse.rst:178 +#: ../../library/argparse.rst:191 msgid "" "By default, :class:`ArgumentParser` calculates the usage message from the " "arguments it contains. The default message can be overridden with the " "``usage=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:182 +#: ../../library/argparse.rst:195 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s " "[options]')\n" @@ -341,17 +364,26 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo [FOO] foo help" -#: ../../library/argparse.rst:195 +#: ../../library/argparse.rst:208 msgid "" "The ``%(prog)s`` format specifier is available to fill in the program name " "in your usage messages." msgstr "" -#: ../../library/argparse.rst:202 +#: ../../library/argparse.rst:211 +msgid "" +"When a custom usage message is specified for the main parser, you may also " +"want to consider passing the ``prog`` argument " +"to :meth:`~ArgumentParser.add_subparsers` or the ``prog`` and the ``usage`` " +"arguments to :meth:`~_SubParsersAction.add_parser`, to ensure consistent " +"command prefixes and usage information across subparsers." +msgstr "" + +#: ../../library/argparse.rst:221 msgid "description" msgstr "description" -#: ../../library/argparse.rst:204 +#: ../../library/argparse.rst:223 msgid "" "Most calls to the :class:`ArgumentParser` constructor will use the " "``description=`` keyword argument. This argument gives a brief description " @@ -360,24 +392,24 @@ msgid "" "messages for the various arguments." msgstr "" -#: ../../library/argparse.rst:210 +#: ../../library/argparse.rst:229 msgid "" "By default, the description will be line-wrapped so that it fits within the " "given space. To change this behavior, see the formatter_class_ argument." msgstr "" -#: ../../library/argparse.rst:215 +#: ../../library/argparse.rst:234 msgid "epilog" msgstr "epilog" -#: ../../library/argparse.rst:217 +#: ../../library/argparse.rst:236 msgid "" "Some programs like to display additional description of the program after " "the description of the arguments. Such text can be specified using the " "``epilog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:221 +#: ../../library/argparse.rst:240 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... description='A foo that bars',\n" @@ -405,29 +437,29 @@ msgstr "" "\n" "And that's how you'd foo a bar" -#: ../../library/argparse.rst:234 +#: ../../library/argparse.rst:253 msgid "" "As with the description_ argument, the ``epilog=`` text is by default line-" "wrapped, but this behavior can be adjusted with the formatter_class_ " "argument to :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:240 +#: ../../library/argparse.rst:259 msgid "parents" msgstr "parents" -#: ../../library/argparse.rst:242 +#: ../../library/argparse.rst:261 msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " -"shared arguments and passed to ``parents=`` argument to :class:" -"`ArgumentParser` can be used. The ``parents=`` argument takes a list of :" -"class:`ArgumentParser` objects, collects all the positional and optional " -"actions from them, and adds these actions to the :class:`ArgumentParser` " -"object being constructed::" +"shared arguments and passed to ``parents=`` argument " +"to :class:`ArgumentParser` can be used. The ``parents=`` argument takes a " +"list of :class:`ArgumentParser` objects, collects all the positional and " +"optional actions from them, and adds these actions to " +"the :class:`ArgumentParser` object being constructed::" msgstr "" -#: ../../library/argparse.rst:249 +#: ../../library/argparse.rst:268 msgid "" ">>> parent_parser = argparse.ArgumentParser(add_help=False)\n" ">>> parent_parser.add_argument('--parent', type=int)\n" @@ -455,40 +487,40 @@ msgstr "" ">>> bar_parser.parse_args(['--bar', 'YYY'])\n" "Namespace(bar='YYY', parent=None)" -#: ../../library/argparse.rst:262 +#: ../../library/argparse.rst:281 msgid "" "Note that most parent parsers will specify ``add_help=False``. Otherwise, " "the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the " "parent and one in the child) and raise an error." msgstr "" -#: ../../library/argparse.rst:267 +#: ../../library/argparse.rst:286 msgid "" "You must fully initialize the parsers before passing them via ``parents=``. " "If you change the parent parsers after the child parser, those changes will " "not be reflected in the child." msgstr "" -#: ../../library/argparse.rst:275 +#: ../../library/argparse.rst:294 msgid "formatter_class" msgstr "formatter_class" -#: ../../library/argparse.rst:277 +#: ../../library/argparse.rst:296 msgid "" ":class:`ArgumentParser` objects allow the help formatting to be customized " "by specifying an alternate formatting class. Currently, there are four such " "classes:" msgstr "" -#: ../../library/argparse.rst:286 +#: ../../library/argparse.rst:305 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " -"more control over how textual descriptions are displayed. By default, :class:" -"`ArgumentParser` objects line-wrap the description_ and epilog_ texts in " -"command-line help messages::" +"more control over how textual descriptions are displayed. By " +"default, :class:`ArgumentParser` objects line-wrap the description_ and " +"epilog_ texts in command-line help messages::" msgstr "" -#: ../../library/argparse.rst:291 +#: ../../library/argparse.rst:310 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -512,14 +544,14 @@ msgid "" "will be wrapped across a couple lines" msgstr "" -#: ../../library/argparse.rst:311 +#: ../../library/argparse.rst:330 msgid "" "Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` " "indicates that description_ and epilog_ are already correctly formatted and " "should not be line-wrapped::" msgstr "" -#: ../../library/argparse.rst:315 +#: ../../library/argparse.rst:334 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -565,7 +597,7 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:337 +#: ../../library/argparse.rst:356 msgid "" ":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help " "text, including argument descriptions. However, multiple newlines are " @@ -573,13 +605,13 @@ msgid "" "between the newlines." msgstr "" -#: ../../library/argparse.rst:342 +#: ../../library/argparse.rst:361 msgid "" ":class:`ArgumentDefaultsHelpFormatter` automatically adds information about " "default values to each of the argument help messages::" msgstr "" -#: ../../library/argparse.rst:345 +#: ../../library/argparse.rst:364 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -611,14 +643,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO FOO! (default: 42)" -#: ../../library/argparse.rst:360 +#: ../../library/argparse.rst:379 msgid "" ":class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for " "each argument as the display name for its values (rather than using the " "dest_ as the regular formatter does)::" msgstr "" -#: ../../library/argparse.rst:364 +#: ../../library/argparse.rst:383 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -650,11 +682,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo int" -#: ../../library/argparse.rst:381 +#: ../../library/argparse.rst:400 msgid "prefix_chars" msgstr "prefix_chars" -#: ../../library/argparse.rst:383 +#: ../../library/argparse.rst:402 msgid "" "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " "Parsers that need to support different or additional prefix characters, e.g. " @@ -662,7 +694,7 @@ msgid "" "``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::" msgstr "" -#: ../../library/argparse.rst:389 +#: ../../library/argparse.rst:408 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')\n" ">>> parser.add_argument('+f')\n" @@ -676,18 +708,18 @@ msgstr "" ">>> parser.parse_args('+f X ++bar Y'.split())\n" "Namespace(bar='Y', f='X')" -#: ../../library/argparse.rst:395 +#: ../../library/argparse.rst:414 msgid "" "The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of " "characters that does not include ``-`` will cause ``-f/--foo`` options to be " "disallowed." msgstr "" -#: ../../library/argparse.rst:401 +#: ../../library/argparse.rst:420 msgid "fromfile_prefix_chars" msgstr "fromfile_prefix_chars" -#: ../../library/argparse.rst:403 +#: ../../library/argparse.rst:422 msgid "" "Sometimes, when dealing with a particularly long argument list, it may make " "sense to keep the list of arguments in a file rather than typing it out at " @@ -697,7 +729,7 @@ msgid "" "by the arguments they contain. For example::" msgstr "" -#: ../../library/argparse.rst:410 +#: ../../library/argparse.rst:429 msgid "" ">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" "... fp.write('-f\\nbar')\n" @@ -715,61 +747,62 @@ msgstr "" ">>> parser.parse_args(['-f', 'foo', '@args.txt'])\n" "Namespace(f='bar')" -#: ../../library/argparse.rst:418 +#: ../../library/argparse.rst:437 msgid "" -"Arguments read from a file must be one per line by default (but see also :" -"meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " -"were in the same place as the original file referencing argument on the " +"Arguments read from a file must be one per line by default (but see " +"also :meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if " +"they were in the same place as the original file referencing argument on the " "command line. So in the example above, the expression ``['-f', 'foo', " "'@args.txt']`` is considered equivalent to the expression ``['-f', 'foo', '-" "f', 'bar']``." msgstr "" -#: ../../library/argparse.rst:426 +#: ../../library/argparse.rst:445 msgid "" "Empty lines are treated as empty strings (``''``), which are allowed as " "values but not as arguments. Empty lines that are read as arguments will " "result in an \"unrecognized arguments\" error." msgstr "" -#: ../../library/argparse.rst:430 +#: ../../library/argparse.rst:449 msgid "" ":class:`ArgumentParser` uses :term:`filesystem encoding and error handler` " "to read the file containing arguments." msgstr "" -#: ../../library/argparse.rst:433 +#: ../../library/argparse.rst:452 msgid "" "The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that " "arguments will never be treated as file references." msgstr "" -#: ../../library/argparse.rst:436 +#: ../../library/argparse.rst:455 msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " -"from default (e.g. :func:`locale.getpreferredencoding(False) ` and ``\"strict\"``) to the :term:`filesystem encoding " -"and error handler`. Arguments file should be encoded in UTF-8 instead of " -"ANSI Codepage on Windows." +"from default (e.g. :func:`locale.getpreferredencoding(False) " +"` and ``\"strict\"``) to the :term:`filesystem " +"encoding and error handler`. Arguments file should be encoded in UTF-8 " +"instead of ANSI Codepage on Windows." msgstr "" -#: ../../library/argparse.rst:444 +#: ../../library/argparse.rst:463 msgid "argument_default" msgstr "argument_default" -#: ../../library/argparse.rst:446 +#: ../../library/argparse.rst:465 msgid "" -"Generally, argument defaults are specified either by passing a default to :" -"meth:`~ArgumentParser.add_argument` or by calling the :meth:`~ArgumentParser." -"set_defaults` methods with a specific set of name-value pairs. Sometimes " -"however, it may be useful to specify a single parser-wide default for " -"arguments. This can be accomplished by passing the ``argument_default=`` " -"keyword argument to :class:`ArgumentParser`. For example, to globally " -"suppress attribute creation on :meth:`~ArgumentParser.parse_args` calls, we " -"supply ``argument_default=SUPPRESS``::" +"Generally, argument defaults are specified either by passing a default " +"to :meth:`~ArgumentParser.add_argument` or by calling " +"the :meth:`~ArgumentParser.set_defaults` methods with a specific set of name-" +"value pairs. Sometimes however, it may be useful to specify a single parser-" +"wide default for arguments. This can be accomplished by passing the " +"``argument_default=`` keyword argument to :class:`ArgumentParser`. For " +"example, to globally suppress attribute creation " +"on :meth:`~ArgumentParser.parse_args` calls, we supply " +"``argument_default=SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:455 +#: ../../library/argparse.rst:474 msgid "" ">>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" ">>> parser.add_argument('--foo')\n" @@ -787,22 +820,22 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace()" -#: ../../library/argparse.rst:466 +#: ../../library/argparse.rst:485 msgid "allow_abbrev" msgstr "allow_abbrev" -#: ../../library/argparse.rst:468 +#: ../../library/argparse.rst:487 msgid "" -"Normally, when you pass an argument list to the :meth:`~ArgumentParser." -"parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " -"abbreviations ` of long options." +"Normally, when you pass an argument list to " +"the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " +"it :ref:`recognizes abbreviations ` of long options." msgstr "" -#: ../../library/argparse.rst:472 +#: ../../library/argparse.rst:491 msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:474 +#: ../../library/argparse.rst:493 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" ">>> parser.add_argument('--foobar', action='store_true')\n" @@ -818,11 +851,11 @@ msgstr "" "usage: PROG [-h] [--foobar] [--foonley]\n" "PROG: error: unrecognized arguments: --foon" -#: ../../library/argparse.rst:485 +#: ../../library/argparse.rst:504 msgid "conflict_handler" msgstr "conflict_handler" -#: ../../library/argparse.rst:487 +#: ../../library/argparse.rst:506 msgid "" ":class:`ArgumentParser` objects do not allow two actions with the same " "option string. By default, :class:`ArgumentParser` objects raise an " @@ -830,7 +863,7 @@ msgid "" "that is already in use::" msgstr "" -#: ../../library/argparse.rst:492 +#: ../../library/argparse.rst:511 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo', help='old foo help')\n" @@ -846,7 +879,7 @@ msgstr "" " ..\n" "ArgumentError: argument --foo: conflicting option string(s): --foo" -#: ../../library/argparse.rst:499 +#: ../../library/argparse.rst:518 msgid "" "Sometimes (e.g. when using parents_) it may be useful to simply override any " "older arguments with the same option string. To get this behavior, the " @@ -854,7 +887,7 @@ msgid "" "of :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:504 +#: ../../library/argparse.rst:523 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', " "conflict_handler='resolve')\n" @@ -880,7 +913,7 @@ msgstr "" " -f FOO old foo help\n" " --foo FOO new foo help" -#: ../../library/argparse.rst:515 +#: ../../library/argparse.rst:534 msgid "" "Note that :class:`ArgumentParser` objects only remove an action if all of " "its option strings are overridden. So, in the example above, the old ``-f/--" @@ -888,25 +921,25 @@ msgid "" "option string was overridden." msgstr "" -#: ../../library/argparse.rst:522 +#: ../../library/argparse.rst:541 msgid "add_help" msgstr "add_help" -#: ../../library/argparse.rst:524 +#: ../../library/argparse.rst:543 msgid "" "By default, :class:`ArgumentParser` objects add an option which simply " "displays the parser's help message. If ``-h`` or ``--help`` is supplied at " "the command line, the :class:`!ArgumentParser` help will be printed." msgstr "" -#: ../../library/argparse.rst:528 +#: ../../library/argparse.rst:547 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " -"This can be achieved by passing ``False`` as the ``add_help=`` argument to :" -"class:`ArgumentParser`::" +"This can be achieved by passing ``False`` as the ``add_help=`` argument " +"to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:532 +#: ../../library/argparse.rst:551 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> parser.add_argument('--foo', help='foo help')\n" @@ -924,7 +957,7 @@ msgstr "" "options:\n" " --foo FOO foo help" -#: ../../library/argparse.rst:540 +#: ../../library/argparse.rst:559 msgid "" "The help option is typically ``-h/--help``. The exception to this is if the " "``prefix_chars=`` is specified and does not include ``-``, in which case ``-" @@ -932,7 +965,7 @@ msgid "" "in ``prefix_chars`` is used to prefix the help options::" msgstr "" -#: ../../library/argparse.rst:546 +#: ../../library/argparse.rst:565 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')\n" ">>> parser.print_help()\n" @@ -948,24 +981,25 @@ msgstr "" "options:\n" " +h, ++help show this help message and exit" -#: ../../library/argparse.rst:555 +#: ../../library/argparse.rst:574 msgid "exit_on_error" msgstr "exit_on_error" -#: ../../library/argparse.rst:557 +#: ../../library/argparse.rst:576 msgid "" -"Normally, when you pass an invalid argument list to the :meth:" -"`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " -"print a *message* to :data:`sys.stderr` and exit with a status code of 2." +"Normally, when you pass an invalid argument list to " +"the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " +"it will print a *message* to :data:`sys.stderr` and exit with a status code " +"of 2." msgstr "" -#: ../../library/argparse.rst:561 +#: ../../library/argparse.rst:580 msgid "" "If the user would like to catch errors manually, the feature can be enabled " "by setting ``exit_on_error`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:564 +#: ../../library/argparse.rst:583 msgid "" ">>> parser = argparse.ArgumentParser(exit_on_error=False)\n" ">>> parser.add_argument('--integers', type=int)\n" @@ -991,113 +1025,183 @@ msgstr "" "...\n" "Catching an argumentError" -#: ../../library/argparse.rst:578 +#: ../../library/argparse.rst:596 +#, fuzzy +msgid "suggest_on_error" +msgstr "exit_on_error" + +#: ../../library/argparse.rst:598 +msgid "" +"By default, when a user passes an invalid argument choice or subparser " +"name, :class:`ArgumentParser` will exit with error info and list the " +"permissible argument choices (if specified) or subparser names as part of " +"the error message." +msgstr "" + +#: ../../library/argparse.rst:602 +msgid "" +"If the user would like to enable suggestions for mistyped argument choices " +"and subparser names, the feature can be enabled by setting " +"``suggest_on_error`` to ``True``. Note that this only applies for arguments " +"when the choices specified are strings::" +msgstr "" + +#: ../../library/argparse.rst:607 +msgid "" +">>> parser = argparse.ArgumentParser(description='Process some integers.',\n" +" suggest_on_error=True)\n" +">>> parser.add_argument('--action', choices=['sum', 'max'])\n" +">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" +"... help='an integer for the accumulator')\n" +">>> parser.parse_args(['--action', 'sumn', 1, 2, 3])\n" +"tester.py: error: argument --action: invalid choice: 'sumn', maybe you meant " +"'sum'? (choose from 'sum', 'max')" +msgstr "" + +#: ../../library/argparse.rst:615 +msgid "" +"If you're writing code that needs to be compatible with older Python " +"versions and want to opportunistically use ``suggest_on_error`` when it's " +"available, you can set it as an attribute after initializing the parser " +"instead of using the keyword argument::" +msgstr "" + +#: ../../library/argparse.rst:620 +msgid "" +">>> parser = argparse.ArgumentParser(description='Process some integers.')\n" +">>> parser.suggest_on_error = True" +msgstr "" + +#: ../../library/argparse.rst:627 +msgid "color" +msgstr "" + +#: ../../library/argparse.rst:629 +msgid "" +"By default, the help message is printed in color using `ANSI escape " +"sequences `__. If you want " +"plain text help messages, you can disable this :ref:`in your local " +"environment `, or in the argument parser itself " +"by setting ``color`` to ``False``::" +msgstr "" + +#: ../../library/argparse.rst:635 +msgid "" +">>> parser = argparse.ArgumentParser(description='Process some integers.',\n" +"... color=False)\n" +">>> parser.add_argument('--action', choices=['sum', 'max'])\n" +">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" +"... help='an integer for the accumulator')\n" +">>> parser.parse_args(['--help'])" +msgstr "" + +#: ../../library/argparse.rst:646 msgid "The add_argument() method" msgstr "add_argument() 方法" -#: ../../library/argparse.rst:584 +#: ../../library/argparse.rst:652 msgid "" "Define how a single command-line argument should be parsed. Each parameter " "has its own more detailed description below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:587 +#: ../../library/argparse.rst:655 msgid "" "`name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` " "or ``'-f', '--foo'``." msgstr "" -#: ../../library/argparse.rst:590 +#: ../../library/argparse.rst:658 msgid "" "action_ - The basic type of action to be taken when this argument is " "encountered at the command line." msgstr "" -#: ../../library/argparse.rst:593 +#: ../../library/argparse.rst:661 msgid "nargs_ - The number of command-line arguments that should be consumed." msgstr "" -#: ../../library/argparse.rst:595 +#: ../../library/argparse.rst:663 msgid "" "const_ - A constant value required by some action_ and nargs_ selections." msgstr "" -#: ../../library/argparse.rst:597 +#: ../../library/argparse.rst:665 msgid "" "default_ - The value produced if the argument is absent from the command " "line and if it is absent from the namespace object." msgstr "" -#: ../../library/argparse.rst:600 +#: ../../library/argparse.rst:668 msgid "" "type_ - The type to which the command-line argument should be converted." msgstr "" -#: ../../library/argparse.rst:602 +#: ../../library/argparse.rst:670 msgid "choices_ - A sequence of the allowable values for the argument." msgstr "" -#: ../../library/argparse.rst:604 +#: ../../library/argparse.rst:672 msgid "" "required_ - Whether or not the command-line option may be omitted (optionals " "only)." msgstr "" -#: ../../library/argparse.rst:607 +#: ../../library/argparse.rst:675 msgid "help_ - A brief description of what the argument does." msgstr "" -#: ../../library/argparse.rst:609 +#: ../../library/argparse.rst:677 msgid "metavar_ - A name for the argument in usage messages." msgstr "" -#: ../../library/argparse.rst:611 +#: ../../library/argparse.rst:679 msgid "" -"dest_ - The name of the attribute to be added to the object returned by :" -"meth:`parse_args`." +"dest_ - The name of the attribute to be added to the object returned " +"by :meth:`parse_args`." msgstr "" -#: ../../library/argparse.rst:614 +#: ../../library/argparse.rst:682 msgid "deprecated_ - Whether or not use of the argument is deprecated." msgstr "" -#: ../../library/argparse.rst:622 +#: ../../library/argparse.rst:690 msgid "name or flags" msgstr "name or flags" -#: ../../library/argparse.rst:624 +#: ../../library/argparse.rst:692 msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " -"a list of filenames, is expected. The first arguments passed to :meth:" -"`~ArgumentParser.add_argument` must therefore be either a series of flags, " -"or a simple argument name." +"a list of filenames, is expected. The first arguments passed " +"to :meth:`~ArgumentParser.add_argument` must therefore be either a series of " +"flags, or a simple argument name." msgstr "" -#: ../../library/argparse.rst:630 +#: ../../library/argparse.rst:698 msgid "For example, an optional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:632 +#: ../../library/argparse.rst:700 msgid ">>> parser.add_argument('-f', '--foo')" msgstr ">>> parser.add_argument('-f', '--foo')" -#: ../../library/argparse.rst:634 +#: ../../library/argparse.rst:702 msgid "while a positional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:636 +#: ../../library/argparse.rst:704 msgid ">>> parser.add_argument('bar')" msgstr ">>> parser.add_argument('bar')" -#: ../../library/argparse.rst:638 +#: ../../library/argparse.rst:706 msgid "" "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " "be identified by the ``-`` prefix, and the remaining arguments will be " "assumed to be positional::" msgstr "" -#: ../../library/argparse.rst:642 +#: ../../library/argparse.rst:710 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo')\n" @@ -1121,11 +1225,50 @@ msgstr "" "usage: PROG [-h] [-f FOO] bar\n" "PROG: error: the following arguments are required: bar" -#: ../../library/argparse.rst:657 +#: ../../library/argparse.rst:721 +msgid "" +"By default, :mod:`!argparse` automatically handles the internal naming and " +"display names of arguments, simplifying the process without requiring " +"additional configuration. As such, you do not need to specify the dest_ and " +"metavar_ parameters. The dest_ parameter defaults to the argument name with " +"underscores ``_`` replacing hyphens ``-`` . The metavar_ parameter defaults " +"to the upper-cased name. For example::" +msgstr "" + +#: ../../library/argparse.rst:729 +#, fuzzy +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('--foo-bar')\n" +">>> parser.parse_args(['--foo-bar', 'FOO-BAR']\n" +"Namespace(foo_bar='FOO-BAR')\n" +">>> parser.print_help()\n" +"usage: [-h] [--foo-bar FOO-BAR]\n" +"\n" +"optional arguments:\n" +" -h, --help show this help message and exit\n" +" --foo-bar FOO-BAR" +msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo')\n" +">>> parser.add_argument('bar')\n" +">>> parser.parse_args('X --foo Y'.split())\n" +"Namespace(bar='X', foo='Y')\n" +">>> parser.print_help()\n" +"usage: [-h] [--foo FOO] bar\n" +"\n" +"positional arguments:\n" +" bar\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo FOO" + +#: ../../library/argparse.rst:744 msgid "action" msgstr "action" -#: ../../library/argparse.rst:659 +#: ../../library/argparse.rst:746 msgid "" ":class:`ArgumentParser` objects associate command-line arguments with " "actions. These actions can do just about anything with the command-line " @@ -1135,13 +1278,13 @@ msgid "" "be handled. The supplied actions are:" msgstr "" -#: ../../library/argparse.rst:665 +#: ../../library/argparse.rst:752 msgid "" "``'store'`` - This just stores the argument's value. This is the default " "action." msgstr "" -#: ../../library/argparse.rst:668 +#: ../../library/argparse.rst:755 msgid "" "``'store_const'`` - This stores the value specified by the const_ keyword " "argument; note that the const_ keyword argument defaults to ``None``. The " @@ -1149,7 +1292,7 @@ msgid "" "specify some sort of flag. For example::" msgstr "" -#: ../../library/argparse.rst:673 +#: ../../library/argparse.rst:760 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_const', const=42)\n" @@ -1161,7 +1304,7 @@ msgstr "" ">>> parser.parse_args(['--foo'])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:678 +#: ../../library/argparse.rst:765 msgid "" "``'store_true'`` and ``'store_false'`` - These are special cases of " "``'store_const'`` used for storing the values ``True`` and ``False`` " @@ -1169,7 +1312,7 @@ msgid "" "``True`` respectively::" msgstr "" -#: ../../library/argparse.rst:683 +#: ../../library/argparse.rst:770 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -1185,7 +1328,7 @@ msgstr "" ">>> parser.parse_args('--foo --bar'.split())\n" "Namespace(foo=True, bar=False, baz=True)" -#: ../../library/argparse.rst:690 +#: ../../library/argparse.rst:777 msgid "" "``'append'`` - This stores a list, and appends each argument value to the " "list. It is useful to allow an option to be specified multiple times. If the " @@ -1194,7 +1337,7 @@ msgid "" "after those default values. Example usage::" msgstr "" -#: ../../library/argparse.rst:696 +#: ../../library/argparse.rst:783 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='append')\n" @@ -1206,7 +1349,7 @@ msgstr "" ">>> parser.parse_args('--foo 1 --foo 2'.split())\n" "Namespace(foo=['1', '2'])" -#: ../../library/argparse.rst:701 +#: ../../library/argparse.rst:788 msgid "" "``'append_const'`` - This stores a list, and appends the value specified by " "the const_ keyword argument to the list; note that the const_ keyword " @@ -1215,7 +1358,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:707 +#: ../../library/argparse.rst:794 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--str', dest='types', action='append_const', " @@ -1233,7 +1376,7 @@ msgstr "" ">>> parser.parse_args('--str --int'.split())\n" "Namespace(types=[, ])" -#: ../../library/argparse.rst:713 +#: ../../library/argparse.rst:800 msgid "" "``'extend'`` - This stores a list and appends each item from the multi-value " "argument list to it. The ``'extend'`` action is typically used with the " @@ -1242,7 +1385,7 @@ msgid "" "will be appended to the list. Example usage::" msgstr "" -#: ../../library/argparse.rst:721 +#: ../../library/argparse.rst:808 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " @@ -1258,13 +1401,13 @@ msgstr "" "\"f4\"])\n" "Namespace(foo=['f1', 'f2', 'f3', 'f4'])" -#: ../../library/argparse.rst:728 +#: ../../library/argparse.rst:815 msgid "" "``'count'`` - This counts the number of times a keyword argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" -#: ../../library/argparse.rst:731 +#: ../../library/argparse.rst:818 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='count', default=0)\n" @@ -1272,11 +1415,11 @@ msgid "" "Namespace(verbose=3)" msgstr "" -#: ../../library/argparse.rst:736 +#: ../../library/argparse.rst:823 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -#: ../../library/argparse.rst:738 +#: ../../library/argparse.rst:825 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " @@ -1284,14 +1427,14 @@ msgid "" "output is created." msgstr "" -#: ../../library/argparse.rst:743 +#: ../../library/argparse.rst:830 msgid "" -"``'version'`` - This expects a ``version=`` keyword argument in the :meth:" -"`~ArgumentParser.add_argument` call, and prints version information and " -"exits when invoked::" +"``'version'`` - This expects a ``version=`` keyword argument in " +"the :meth:`~ArgumentParser.add_argument` call, and prints version " +"information and exits when invoked::" msgstr "" -#: ../../library/argparse.rst:747 +#: ../../library/argparse.rst:834 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1307,7 +1450,7 @@ msgstr "" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" -#: ../../library/argparse.rst:753 +#: ../../library/argparse.rst:840 msgid "" "You may also specify an arbitrary action by passing an :class:`Action` " "subclass (e.g. :class:`BooleanOptionalAction`) or other object that " @@ -1315,12 +1458,12 @@ msgid "" "arguments (e.g. ``'store'``, ``'append'``, ``'extend'``, or custom actions " "with non-zero ``nargs``) can be used with positional arguments." msgstr "" -"你也可以傳遞一個 :class:`Action` 子類別(例如 :class:" -"`BooleanOptionalAction`)或實作相同介面的其他物件。只有會消耗命令列引數的 " -"action(例如 ``'store'``、``'append'``、``'extend'`` 或 ``nargs`` 不為零的自" -"定義 action)可以被用於位置引數。" +"你也可以傳遞一個 :class:`Action` 子類別(例" +"如 :class:`BooleanOptionalAction`)或實作相同介面的其他物件。只有會消耗命令列" +"引數的 action(例如 ``'store'``、``'append'``、``'extend'`` 或 ``nargs`` 不為" +"零的自定義 action)可以被用於位置引數。" -#: ../../library/argparse.rst:759 +#: ../../library/argparse.rst:846 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` " @@ -1329,11 +1472,11 @@ msgid "" "their registered name." msgstr "" -#: ../../library/argparse.rst:764 +#: ../../library/argparse.rst:851 msgid "An example of a custom action::" msgstr "" -#: ../../library/argparse.rst:766 +#: ../../library/argparse.rst:853 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1354,15 +1497,15 @@ msgid "" "Namespace(bar='1', foo='2')" msgstr "" -#: ../../library/argparse.rst:784 +#: ../../library/argparse.rst:871 msgid "For more details, see :class:`Action`." msgstr "更多詳情請見 :class:`Action`。" -#: ../../library/argparse.rst:790 +#: ../../library/argparse.rst:877 msgid "nargs" msgstr "nargs" -#: ../../library/argparse.rst:792 +#: ../../library/argparse.rst:879 msgid "" ":class:`ArgumentParser` objects usually associate a single command-line " "argument with a single action to be taken. The ``nargs`` keyword argument " @@ -1371,13 +1514,13 @@ msgid "" "are:" msgstr "" -#: ../../library/argparse.rst:797 +#: ../../library/argparse.rst:884 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: ../../library/argparse.rst:800 +#: ../../library/argparse.rst:887 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1391,13 +1534,13 @@ msgstr "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" -#: ../../library/argparse.rst:806 +#: ../../library/argparse.rst:893 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" -#: ../../library/argparse.rst:811 +#: ../../library/argparse.rst:898 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -1407,7 +1550,7 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: ../../library/argparse.rst:818 +#: ../../library/argparse.rst:905 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1429,39 +1572,36 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:828 +#: ../../library/argparse.rst:915 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: ../../library/argparse.rst:831 +#: ../../library/argparse.rst:918 +#, fuzzy msgid "" ">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument('infile', nargs='?', type=argparse.FileType('r'),\n" -"... default=sys.stdin)\n" -">>> parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'),\n" -"... default=sys.stdout)\n" +">>> parser.add_argument('infile', nargs='?')\n" +">>> parser.add_argument('outfile', nargs='?')\n" ">>> parser.parse_args(['input.txt', 'output.txt'])\n" -"Namespace(infile=<_io.TextIOWrapper name='input.txt' encoding='UTF-8'>,\n" -" outfile=<_io.TextIOWrapper name='output.txt' encoding='UTF-8'>)\n" +"Namespace(infile='input.txt', outfile='output.txt')\n" +">>> parser.parse_args(['input.txt'])\n" +"Namespace(infile='input.txt', outfile=None)\n" ">>> parser.parse_args([])\n" -"Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>,\n" -" outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" +"Namespace(infile=None, outfile=None)" msgstr "" ">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument('infile', nargs='?', type=argparse.FileType('r'),\n" -"... default=sys.stdin)\n" -">>> parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'),\n" -"... default=sys.stdout)\n" -">>> parser.parse_args(['input.txt', 'output.txt'])\n" -"Namespace(infile=<_io.TextIOWrapper name='input.txt' encoding='UTF-8'>,\n" -" outfile=<_io.TextIOWrapper name='output.txt' encoding='UTF-8'>)\n" +">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" +">>> parser.add_argument('bar', nargs='?', default='d')\n" +">>> parser.parse_args(['XX', '--foo', 'YY'])\n" +"Namespace(bar='XX', foo='YY')\n" +">>> parser.parse_args(['XX', '--foo'])\n" +"Namespace(bar='XX', foo='c')\n" ">>> parser.parse_args([])\n" -"Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>,\n" -" outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" +"Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:845 +#: ../../library/argparse.rst:930 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -1469,7 +1609,7 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: ../../library/argparse.rst:850 +#: ../../library/argparse.rst:935 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1485,14 +1625,14 @@ msgstr "" ">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" -#: ../../library/argparse.rst:859 +#: ../../library/argparse.rst:944 msgid "" "``'+'``. Just like ``'*'``, all command-line arguments present are gathered " "into a list. Additionally, an error message will be generated if there " "wasn't at least one command-line argument present. For example::" msgstr "" -#: ../../library/argparse.rst:863 +#: ../../library/argparse.rst:948 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1510,7 +1650,7 @@ msgstr "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:871 +#: ../../library/argparse.rst:956 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -1519,11 +1659,11 @@ msgid "" "``'store_const'``) set ``nargs=0``." msgstr "" -#: ../../library/argparse.rst:881 +#: ../../library/argparse.rst:966 msgid "const" msgstr "const" -#: ../../library/argparse.rst:883 +#: ../../library/argparse.rst:968 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -1531,17 +1671,18 @@ msgid "" "common uses of it are:" msgstr "" -#: ../../library/argparse.rst:887 +#: ../../library/argparse.rst:972 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='store_const'`` or ``action='append_const'``. These actions add " -"the ``const`` value to one of the attributes of the object returned by :meth:" -"`~ArgumentParser.parse_args`. See the action_ description for examples. If " -"``const`` is not provided to :meth:`~ArgumentParser.add_argument`, it will " -"receive a default value of ``None``." +"the ``const`` value to one of the attributes of the object returned " +"by :meth:`~ArgumentParser.parse_args`. See the action_ description for " +"examples. If ``const`` is not provided " +"to :meth:`~ArgumentParser.add_argument`, it will receive a default value of " +"``None``." msgstr "" -#: ../../library/argparse.rst:895 +#: ../../library/argparse.rst:980 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " @@ -1551,27 +1692,27 @@ msgid "" "to be ``None`` instead. See the nargs_ description for examples." msgstr "" -#: ../../library/argparse.rst:902 +#: ../../library/argparse.rst:987 msgid "" "``const=None`` by default, including when ``action='append_const'`` or " "``action='store_const'``." msgstr "" -#: ../../library/argparse.rst:909 +#: ../../library/argparse.rst:994 msgid "default" msgstr "default" -#: ../../library/argparse.rst:911 +#: ../../library/argparse.rst:996 msgid "" "All optional arguments and some positional arguments may be omitted at the " -"command line. The ``default`` keyword argument of :meth:`~ArgumentParser." -"add_argument`, whose value defaults to ``None``, specifies what value should " -"be used if the command-line argument is not present. For optional arguments, " -"the ``default`` value is used when the option string was not present at the " -"command line::" +"command line. The ``default`` keyword argument " +"of :meth:`~ArgumentParser.add_argument`, whose value defaults to ``None``, " +"specifies what value should be used if the command-line argument is not " +"present. For optional arguments, the ``default`` value is used when the " +"option string was not present at the command line::" msgstr "" -#: ../../library/argparse.rst:918 +#: ../../library/argparse.rst:1003 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1587,13 +1728,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:925 +#: ../../library/argparse.rst:1010 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not overwrite it::" msgstr "" -#: ../../library/argparse.rst:928 +#: ../../library/argparse.rst:1013 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1605,15 +1746,16 @@ msgstr "" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" -#: ../../library/argparse.rst:933 +#: ../../library/argparse.rst:1018 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " -"conversion argument, if provided, before setting the attribute on the :class:" -"`Namespace` return value. Otherwise, the parser uses the value as is::" +"conversion argument, if provided, before setting the attribute on " +"the :class:`Namespace` return value. Otherwise, the parser uses the value " +"as is::" msgstr "" -#: ../../library/argparse.rst:938 +#: ../../library/argparse.rst:1023 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -1627,13 +1769,13 @@ msgstr "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" -#: ../../library/argparse.rst:944 +#: ../../library/argparse.rst:1029 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" -#: ../../library/argparse.rst:947 +#: ../../library/argparse.rst:1032 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -1649,20 +1791,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:954 +#: ../../library/argparse.rst:1039 msgid "" "For required_ arguments, the ``default`` value is ignored. For example, this " "applies to positional arguments with nargs_ values other than ``?`` or " "``*``, or optional arguments marked as ``required=True``." msgstr "" -#: ../../library/argparse.rst:958 +#: ../../library/argparse.rst:1043 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: ../../library/argparse.rst:961 +#: ../../library/argparse.rst:1046 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -1678,11 +1820,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:972 +#: ../../library/argparse.rst:1057 msgid "type" msgstr "type" -#: ../../library/argparse.rst:974 +#: ../../library/argparse.rst:1059 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -1691,26 +1833,27 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: ../../library/argparse.rst:980 +#: ../../library/argparse.rst:1065 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -#: ../../library/argparse.rst:983 +#: ../../library/argparse.rst:1068 msgid "" "The argument to ``type`` can be a callable that accepts a single string or " "the name of a registered type (see :meth:`~ArgumentParser.register`) If the " -"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" -"`ValueError`, the exception is caught and a nicely formatted error message " -"is displayed. Other exception types are not handled." +"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, " +"or :exc:`ValueError`, the exception is caught and a nicely formatted error " +"message is displayed. Other exception types are not handled." msgstr "" -#: ../../library/argparse.rst:989 +#: ../../library/argparse.rst:1074 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: ../../library/argparse.rst:991 +#: ../../library/argparse.rst:1076 +#, fuzzy msgid "" "import argparse\n" "import pathlib\n" @@ -1720,8 +1863,6 @@ msgid "" "parser.add_argument('distance', type=float)\n" "parser.add_argument('street', type=ascii)\n" "parser.add_argument('code_point', type=ord)\n" -"parser.add_argument('dest_file', type=argparse.FileType('w', " -"encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" msgstr "" "import argparse\n" @@ -1736,11 +1877,11 @@ msgstr "" "encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" -#: ../../library/argparse.rst:1004 +#: ../../library/argparse.rst:1088 msgid "User defined functions can be used as well:" msgstr "" -#: ../../library/argparse.rst:1006 +#: ../../library/argparse.rst:1090 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -1758,14 +1899,14 @@ msgstr "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" -#: ../../library/argparse.rst:1016 +#: ../../library/argparse.rst:1100 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" -#: ../../library/argparse.rst:1020 +#: ../../library/argparse.rst:1104 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -1773,15 +1914,15 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: ../../library/argparse.rst:1025 +#: ../../library/argparse.rst:1109 msgid "" "For example, JSON or YAML conversions have complex error cases that require " -"better reporting than can be given by the ``type`` keyword. A :exc:`~json." -"JSONDecodeError` would not be well formatted and a :exc:`FileNotFoundError` " -"exception would not be handled at all." +"better reporting than can be given by the ``type`` keyword. " +"A :exc:`~json.JSONDecodeError` would not be well formatted and " +"a :exc:`FileNotFoundError` exception would not be handled at all." msgstr "" -#: ../../library/argparse.rst:1030 +#: ../../library/argparse.rst:1114 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses :class:`~argparse.FileType` and then " @@ -1791,17 +1932,17 @@ msgid "" "files." msgstr "" -#: ../../library/argparse.rst:1037 +#: ../../library/argparse.rst:1121 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: ../../library/argparse.rst:1044 +#: ../../library/argparse.rst:1128 msgid "choices" msgstr "choices" -#: ../../library/argparse.rst:1046 +#: ../../library/argparse.rst:1130 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a sequence object as the *choices* " @@ -1810,7 +1951,7 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: ../../library/argparse.rst:1052 +#: ../../library/argparse.rst:1136 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -1830,26 +1971,26 @@ msgstr "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" -#: ../../library/argparse.rst:1061 +#: ../../library/argparse.rst:1145 msgid "" "Note that inclusion in the *choices* sequence is checked after any type_ " "conversions have been performed, so the type of the objects in the *choices* " "sequence should match the type_ specified." msgstr "" -#: ../../library/argparse.rst:1065 +#: ../../library/argparse.rst:1149 msgid "" "Any sequence can be passed as the *choices* value, so :class:`list` " "objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" -#: ../../library/argparse.rst:1068 +#: ../../library/argparse.rst:1152 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: ../../library/argparse.rst:1071 +#: ../../library/argparse.rst:1155 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -1857,11 +1998,11 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1080 +#: ../../library/argparse.rst:1164 msgid "required" msgstr "required" -#: ../../library/argparse.rst:1082 +#: ../../library/argparse.rst:1166 msgid "" "In general, the :mod:`!argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " @@ -1869,7 +2010,7 @@ msgid "" "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1087 +#: ../../library/argparse.rst:1171 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -1887,24 +2028,24 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1095 +#: ../../library/argparse.rst:1179 msgid "" -"As the example shows, if an option is marked as ``required``, :meth:" -"`~ArgumentParser.parse_args` will report an error if that option is not " -"present at the command line." +"As the example shows, if an option is marked as " +"``required``, :meth:`~ArgumentParser.parse_args` will report an error if " +"that option is not present at the command line." msgstr "" -#: ../../library/argparse.rst:1101 +#: ../../library/argparse.rst:1185 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: ../../library/argparse.rst:1108 +#: ../../library/argparse.rst:1192 msgid "help" msgstr "help" -#: ../../library/argparse.rst:1110 +#: ../../library/argparse.rst:1194 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " @@ -1912,16 +2053,16 @@ msgid "" "each argument." msgstr "" -#: ../../library/argparse.rst:1115 +#: ../../library/argparse.rst:1199 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " "available specifiers include the program name, ``%(prog)s`` and most keyword " -"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, " -"``%(type)s``, etc.::" +"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, ``%" +"(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1120 +#: ../../library/argparse.rst:1204 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -1947,19 +2088,19 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1132 +#: ../../library/argparse.rst:1216 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: ../../library/argparse.rst:1135 +#: ../../library/argparse.rst:1219 msgid "" ":mod:`!argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1138 +#: ../../library/argparse.rst:1222 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -1977,11 +2118,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1150 +#: ../../library/argparse.rst:1234 msgid "metavar" msgstr "metavar" -#: ../../library/argparse.rst:1152 +#: ../../library/argparse.rst:1236 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, :class:`!ArgumentParser` " @@ -1993,7 +2134,7 @@ msgid "" "command-line argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1161 +#: ../../library/argparse.rst:1245 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2025,11 +2166,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1176 +#: ../../library/argparse.rst:1260 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1178 +#: ../../library/argparse.rst:1262 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2061,21 +2202,21 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1193 +#: ../../library/argparse.rst:1277 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: ../../library/argparse.rst:1197 +#: ../../library/argparse.rst:1281 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: ../../library/argparse.rst:1201 +#: ../../library/argparse.rst:1285 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2099,21 +2240,21 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1216 +#: ../../library/argparse.rst:1300 msgid "dest" msgstr "dest" -#: ../../library/argparse.rst:1218 +#: ../../library/argparse.rst:1302 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " -"attribute is determined by the ``dest`` keyword argument of :meth:" -"`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` " -"is normally supplied as the first argument to :meth:`~ArgumentParser." -"add_argument`::" +"attribute is determined by the ``dest`` keyword argument " +"of :meth:`~ArgumentParser.add_argument`. For positional argument actions, " +"``dest`` is normally supplied as the first argument " +"to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1225 +#: ../../library/argparse.rst:1309 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2125,7 +2266,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1230 +#: ../../library/argparse.rst:1314 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2137,7 +2278,7 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1239 +#: ../../library/argparse.rst:1323 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2155,11 +2296,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1247 +#: ../../library/argparse.rst:1331 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1249 +#: ../../library/argparse.rst:1333 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2171,11 +2312,11 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1258 +#: ../../library/argparse.rst:1342 msgid "deprecated" msgstr "deprecated" -#: ../../library/argparse.rst:1260 +#: ../../library/argparse.rst:1344 msgid "" "During a project's lifetime, some arguments may need to be removed from the " "command line. Before removing them, you should inform your users that the " @@ -2186,7 +2327,7 @@ msgid "" "will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" -#: ../../library/argparse.rst:1270 +#: ../../library/argparse.rst:1354 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='snake.py')\n" @@ -2206,28 +2347,28 @@ msgstr "" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" -#: ../../library/argparse.rst:1283 +#: ../../library/argparse.rst:1367 msgid "Action classes" msgstr "Action 類別" -#: ../../library/argparse.rst:1285 +#: ../../library/argparse.rst:1369 msgid "" ":class:`!Action` classes implement the Action API, a callable which returns " "a callable which processes arguments from the command-line. Any object which " -"follows this API may be passed as the ``action`` parameter to :meth:" -"`~ArgumentParser.add_argument`." +"follows this API may be passed as the ``action`` parameter " +"to :meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1294 +#: ../../library/argparse.rst:1378 msgid "" ":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " "the information needed to parse a single argument from one or more strings " "from the command line. The :class:`!Action` class must accept the two " -"positional arguments plus any keyword arguments passed to :meth:" -"`ArgumentParser.add_argument` except for the ``action`` itself." +"positional arguments plus any keyword arguments passed " +"to :meth:`ArgumentParser.add_argument` except for the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1300 +#: ../../library/argparse.rst:1384 msgid "" "Instances of :class:`!Action` (or return value of any callable to the " "``action`` parameter) should have attributes :attr:`!dest`, :attr:`!" @@ -2236,46 +2377,46 @@ msgid "" "is to call :meth:`!Action.__init__`." msgstr "" -#: ../../library/argparse.rst:1308 +#: ../../library/argparse.rst:1392 msgid "" ":class:`!Action` instances should be callable, so subclasses must override " "the :meth:`!__call__` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1311 +#: ../../library/argparse.rst:1395 msgid "" "*parser* - The :class:`ArgumentParser` object which contains this action." msgstr "" -#: ../../library/argparse.rst:1313 +#: ../../library/argparse.rst:1397 msgid "" -"*namespace* - The :class:`Namespace` object that will be returned by :meth:" -"`~ArgumentParser.parse_args`. Most actions add an attribute to this object " -"using :func:`setattr`." +"*namespace* - The :class:`Namespace` object that will be returned " +"by :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to " +"this object using :func:`setattr`." msgstr "" -#: ../../library/argparse.rst:1317 +#: ../../library/argparse.rst:1401 msgid "" "*values* - The associated command-line arguments, with any type conversions " -"applied. Type conversions are specified with the type_ keyword argument to :" -"meth:`~ArgumentParser.add_argument`." +"applied. Type conversions are specified with the type_ keyword argument " +"to :meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1321 +#: ../../library/argparse.rst:1405 msgid "" "*option_string* - The option string that was used to invoke this action. The " "``option_string`` argument is optional, and will be absent if the action is " "associated with a positional argument." msgstr "" -#: ../../library/argparse.rst:1325 +#: ../../library/argparse.rst:1409 msgid "" "The :meth:`!__call__` method may perform arbitrary actions, but will " "typically set attributes on the ``namespace`` based on ``dest`` and " "``values``." msgstr "" -#: ../../library/argparse.rst:1330 +#: ../../library/argparse.rst:1414 msgid "" ":class:`!Action` subclasses can define a :meth:`!format_usage` method that " "takes no argument and return a string which will be used when printing the " @@ -2283,7 +2424,7 @@ msgid "" "will be used." msgstr "" -#: ../../library/argparse.rst:1336 +#: ../../library/argparse.rst:1420 msgid "" "A subclass of :class:`Action` for handling boolean flags with positive and " "negative options. Adding a single argument such as ``--foo`` automatically " @@ -2291,7 +2432,7 @@ msgid "" "``False`` respectively::" msgstr "" -#: ../../library/argparse.rst:1341 +#: ../../library/argparse.rst:1425 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -2305,47 +2446,47 @@ msgstr "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" -#: ../../library/argparse.rst:1351 +#: ../../library/argparse.rst:1435 msgid "The parse_args() method" msgstr "parse_args() 方法" -#: ../../library/argparse.rst:1355 +#: ../../library/argparse.rst:1439 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1358 +#: ../../library/argparse.rst:1442 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:`!" "add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1362 +#: ../../library/argparse.rst:1446 msgid "" -"args_ - List of strings to parse. The default is taken from :data:`sys." -"argv`." +"args_ - List of strings to parse. The default is taken " +"from :data:`sys.argv`." msgstr "" -#: ../../library/argparse.rst:1365 +#: ../../library/argparse.rst:1449 msgid "" -"namespace_ - An object to take the attributes. The default is a new empty :" -"class:`Namespace` object." +"namespace_ - An object to take the attributes. The default is a new " +"empty :class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1370 +#: ../../library/argparse.rst:1454 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1372 +#: ../../library/argparse.rst:1456 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: ../../library/argparse.rst:1376 +#: ../../library/argparse.rst:1460 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2363,14 +2504,14 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1384 +#: ../../library/argparse.rst:1468 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: ../../library/argparse.rst:1388 +#: ../../library/argparse.rst:1472 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2378,13 +2519,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1391 +#: ../../library/argparse.rst:1475 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1394 +#: ../../library/argparse.rst:1478 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2392,13 +2533,13 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1397 +#: ../../library/argparse.rst:1481 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: ../../library/argparse.rst:1400 +#: ../../library/argparse.rst:1484 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='store_true')\n" @@ -2414,11 +2555,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1409 +#: ../../library/argparse.rst:1493 msgid "Invalid arguments" msgstr "無效引數" -#: ../../library/argparse.rst:1411 +#: ../../library/argparse.rst:1495 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -2426,7 +2567,7 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1416 +#: ../../library/argparse.rst:1500 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -2466,11 +2607,11 @@ msgstr "" "usage: PROG [-h] [--foo FOO] [bar]\n" "PROG: error: extra arguments found: badger" -#: ../../library/argparse.rst:1437 +#: ../../library/argparse.rst:1521 msgid "Arguments containing ``-``" msgstr "包含 ``-`` 的引數" -#: ../../library/argparse.rst:1439 +#: ../../library/argparse.rst:1523 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -2482,7 +2623,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1447 +#: ../../library/argparse.rst:1531 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2515,7 +2656,7 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -#: ../../library/argparse.rst:1477 +#: ../../library/argparse.rst:1561 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -2523,7 +2664,7 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1482 +#: ../../library/argparse.rst:1566 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -2531,24 +2672,24 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1485 +#: ../../library/argparse.rst:1569 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" -#: ../../library/argparse.rst:1491 +#: ../../library/argparse.rst:1575 msgid "Argument abbreviations (prefix matching)" msgstr "引數縮寫 (前綴匹配)" -#: ../../library/argparse.rst:1493 +#: ../../library/argparse.rst:1577 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: ../../library/argparse.rst:1497 +#: ../../library/argparse.rst:1581 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2572,17 +2713,17 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1508 +#: ../../library/argparse.rst:1592 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: ../../library/argparse.rst:1514 +#: ../../library/argparse.rst:1598 msgid "Beyond ``sys.argv``" msgstr "" -#: ../../library/argparse.rst:1516 +#: ../../library/argparse.rst:1600 msgid "" "Sometimes it may be useful to have an :class:`ArgumentParser` parse " "arguments other than those of :data:`sys.argv`. This can be accomplished by " @@ -2590,7 +2731,7 @@ msgid "" "useful for testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1521 +#: ../../library/argparse.rst:1605 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -2616,24 +2757,24 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1536 +#: ../../library/argparse.rst:1620 msgid "The Namespace object" msgstr "命名空間物件" -#: ../../library/argparse.rst:1540 +#: ../../library/argparse.rst:1624 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1543 +#: ../../library/argparse.rst:1627 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: ../../library/argparse.rst:1547 +#: ../../library/argparse.rst:1631 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2647,14 +2788,14 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1553 +#: ../../library/argparse.rst:1637 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:1557 +#: ../../library/argparse.rst:1641 msgid "" ">>> class C:\n" "... pass\n" @@ -2676,92 +2817,93 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1569 +#: ../../library/argparse.rst:1653 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1572 +#: ../../library/argparse.rst:1656 msgid "Sub-commands" msgstr "子命令" -#: ../../library/argparse.rst:1579 +#: ../../library/argparse.rst:1663 msgid "" "Many programs split up their functionality into a number of subcommands, for " "example, the ``svn`` program can invoke subcommands like ``svn checkout``, " "``svn update``, and ``svn commit``. Splitting up functionality this way can " "be a particularly good idea when a program performs several different " -"functions which require different kinds of command-line arguments. :class:" -"`ArgumentParser` supports the creation of such subcommands with the :meth:`!" -"add_subparsers` method. The :meth:`!add_subparsers` method is normally " -"called with no arguments and returns a special action object. This object " -"has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a " -"command name and any :class:`!ArgumentParser` constructor arguments, and " -"returns an :class:`!ArgumentParser` object that can be modified as usual." +"functions which require different kinds of command-line " +"arguments. :class:`ArgumentParser` supports the creation of such subcommands " +"with the :meth:`!add_subparsers` method. The :meth:`!add_subparsers` method " +"is normally called with no arguments and returns a special action object. " +"This object has a single method, :meth:`~_SubParsersAction.add_parser`, " +"which takes a command name and any :class:`!ArgumentParser` constructor " +"arguments, and returns an :class:`!ArgumentParser` object that can be " +"modified as usual." msgstr "" -#: ../../library/argparse.rst:1591 +#: ../../library/argparse.rst:1675 msgid "Description of parameters:" msgstr "參數的解釋:" -#: ../../library/argparse.rst:1593 +#: ../../library/argparse.rst:1677 msgid "" "*title* - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: ../../library/argparse.rst:1597 +#: ../../library/argparse.rst:1681 msgid "" "*description* - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1600 +#: ../../library/argparse.rst:1684 msgid "" "*prog* - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1604 +#: ../../library/argparse.rst:1688 msgid "" "*parser_class* - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. :class:`ArgumentParser`)" msgstr "" -#: ../../library/argparse.rst:1607 +#: ../../library/argparse.rst:1691 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1610 +#: ../../library/argparse.rst:1694 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1613 +#: ../../library/argparse.rst:1697 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1616 +#: ../../library/argparse.rst:1700 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1618 +#: ../../library/argparse.rst:1702 msgid "" "metavar_ - string presenting available subcommands in help; by default it is " "``None`` and presents subcommands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1621 +#: ../../library/argparse.rst:1705 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1623 +#: ../../library/argparse.rst:1707 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -2784,7 +2926,7 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -#: ../../library/argparse.rst:1642 +#: ../../library/argparse.rst:1726 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -2794,7 +2936,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1649 +#: ../../library/argparse.rst:1733 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -2803,7 +2945,7 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1657 +#: ../../library/argparse.rst:1741 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -2861,14 +3003,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1685 +#: ../../library/argparse.rst:1769 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: ../../library/argparse.rst:1689 +#: ../../library/argparse.rst:1773 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -2904,7 +3046,7 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1706 +#: ../../library/argparse.rst:1790 msgid "" "Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " "*aliases* argument, which allows multiple strings to refer to the same " @@ -2912,7 +3054,7 @@ msgid "" "``checkout``::" msgstr "" -#: ../../library/argparse.rst:1711 +#: ../../library/argparse.rst:1795 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -2928,13 +3070,13 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1718 +#: ../../library/argparse.rst:1802 msgid "" ":meth:`~_SubParsersAction.add_parser` supports also an additional " "*deprecated* argument, which allows to deprecate the subparser." msgstr "" -#: ../../library/argparse.rst:1732 +#: ../../library/argparse.rst:1816 msgid "" "One particularly effective way of handling subcommands is to combine the use " "of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so " @@ -2942,7 +3084,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1737 +#: ../../library/argparse.rst:1821 msgid "" ">>> # subcommand functions\n" ">>> def foo(args):\n" @@ -2977,7 +3119,7 @@ msgid "" "((XYZYX))" msgstr "" -#: ../../library/argparse.rst:1769 +#: ../../library/argparse.rst:1853 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -2987,7 +3129,7 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1776 +#: ../../library/argparse.rst:1860 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -3007,24 +3149,30 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1785 +#: ../../library/argparse.rst:1869 msgid "New *required* keyword-only parameter." msgstr "" -#: ../../library/argparse.rst:1790 +#: ../../library/argparse.rst:1872 +msgid "" +"Subparser's *prog* is no longer affected by a custom usage message in the " +"main parser." +msgstr "" + +#: ../../library/argparse.rst:1878 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1794 +#: ../../library/argparse.rst:1882 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " -"argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" -"`FileType` objects as their type will open command-line arguments as files " -"with the requested modes, buffer sizes, encodings and error handling (see " -"the :func:`open` function for more details)::" +"argument of :meth:`ArgumentParser.add_argument`. Arguments that " +"have :class:`FileType` objects as their type will open command-line " +"arguments as files with the requested modes, buffer sizes, encodings and " +"error handling (see the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1800 +#: ../../library/argparse.rst:1888 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -3042,14 +3190,14 @@ msgstr "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" -#: ../../library/argparse.rst:1806 +#: ../../library/argparse.rst:1894 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -#: ../../library/argparse.rst:1810 +#: ../../library/argparse.rst:1898 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -3061,15 +3209,24 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1815 +#: ../../library/argparse.rst:1905 +msgid "" +"If one argument uses *FileType* and then a subsequent argument fails, an " +"error is reported but the file is not automatically closed. This can also " +"clobber the output files. In this case, it would be better to wait until " +"after the parser has run and then use the :keyword:`with`-statement to " +"manage the files." +msgstr "" + +#: ../../library/argparse.rst:1911 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: ../../library/argparse.rst:1820 +#: ../../library/argparse.rst:1918 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1825 +#: ../../library/argparse.rst:1923 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " @@ -3078,7 +3235,7 @@ msgid "" "method::" msgstr "" -#: ../../library/argparse.rst:1831 +#: ../../library/argparse.rst:1929 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3102,18 +3259,18 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:1842 +#: ../../library/argparse.rst:1940 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " -"has an :meth:`~ArgumentParser.add_argument` method just like a regular :" -"class:`ArgumentParser`. When an argument is added to the group, the parser " -"treats it just like a normal argument, but displays the argument in a " -"separate group for help messages. The :meth:`!add_argument_group` method " -"accepts *title* and *description* arguments which can be used to customize " -"this display::" +"has an :meth:`~ArgumentParser.add_argument` method just like a " +"regular :class:`ArgumentParser`. When an argument is added to the group, " +"the parser treats it just like a normal argument, but displays the argument " +"in a separate group for help messages. The :meth:`!add_argument_group` " +"method accepts *title* and *description* arguments which can be used to " +"customize this display::" msgstr "" -#: ../../library/argparse.rst:1850 +#: ../../library/argparse.rst:1948 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3151,41 +3308,44 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1868 +#: ../../library/argparse.rst:1966 msgid "" "The optional, keyword-only parameters argument_default_ and " "conflict_handler_ allow for finer-grained control of the behavior of the " -"argument group. These parameters have the same meaning as in the :class:" -"`ArgumentParser` constructor, but apply specifically to the argument group " -"rather than the entire parser." +"argument group. These parameters have the same meaning as in " +"the :class:`ArgumentParser` constructor, but apply specifically to the " +"argument group rather than the entire parser." msgstr "" -#: ../../library/argparse.rst:1873 +#: ../../library/argparse.rst:1971 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: ../../library/argparse.rst:1876 +#: ../../library/argparse.rst:1974 msgid "" -"Calling :meth:`add_argument_group` on an argument group is deprecated. This " -"feature was never supported and does not always work correctly. The function " -"exists on the API by accident through inheritance and will be removed in the " -"future." +"Calling :meth:`add_argument_group` on an argument group now raises an " +"exception. This nesting was never supported, often failed to work correctly, " +"and was unintentionally exposed through inheritance." msgstr "" -#: ../../library/argparse.rst:1884 +#: ../../library/argparse.rst:1979 +msgid "Passing prefix_chars_ to :meth:`add_argument_group` is now deprecated." +msgstr "" + +#: ../../library/argparse.rst:1985 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:1888 +#: ../../library/argparse.rst:1989 msgid "" "Create a mutually exclusive group. :mod:`!argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: ../../library/argparse.rst:1892 +#: ../../library/argparse.rst:1993 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3211,14 +3371,14 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:1904 +#: ../../library/argparse.rst:2005 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: ../../library/argparse.rst:1908 +#: ../../library/argparse.rst:2009 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3236,15 +3396,16 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:1916 +#: ../../library/argparse.rst:2017 msgid "" "Note that currently mutually exclusive argument groups do not support the " -"*title* and *description* arguments of :meth:`~ArgumentParser." -"add_argument_group`. However, a mutually exclusive group can be added to an " -"argument group that has a title and description. For example::" +"*title* and *description* arguments " +"of :meth:`~ArgumentParser.add_argument_group`. However, a mutually exclusive " +"group can be added to an argument group that has a title and description. " +"For example::" msgstr "" -#: ../../library/argparse.rst:1922 +#: ../../library/argparse.rst:2023 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3280,28 +3441,28 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1939 +#: ../../library/argparse.rst:2040 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " -"on a mutually exclusive group is deprecated. These features were never " -"supported and do not always work correctly. The functions exist on the API " -"by accident through inheritance and will be removed in the future." +"on a mutually exclusive group now raises an exception. This nesting was " +"never supported, often failed to work correctly, and was unintentionally " +"exposed through inheritance." msgstr "" -#: ../../library/argparse.rst:1947 +#: ../../library/argparse.rst:2048 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:1951 +#: ../../library/argparse.rst:2052 msgid "" -"Most of the time, the attributes of the object returned by :meth:" -"`parse_args` will be fully determined by inspecting the command-line " -"arguments and the argument actions. :meth:`set_defaults` allows some " +"Most of the time, the attributes of the object returned " +"by :meth:`parse_args` will be fully determined by inspecting the command-" +"line arguments and the argument actions. :meth:`set_defaults` allows some " "additional attributes that are determined without any inspection of the " "command line to be added::" msgstr "" -#: ../../library/argparse.rst:1957 +#: ../../library/argparse.rst:2058 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3315,12 +3476,12 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:1963 +#: ../../library/argparse.rst:2064 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" -#: ../../library/argparse.rst:1965 +#: ../../library/argparse.rst:2066 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3334,20 +3495,21 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:1971 +#: ../../library/argparse.rst:2072 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: ../../library/argparse.rst:1977 +#: ../../library/argparse.rst:2078 msgid "" -"Get the default value for a namespace attribute, as set by either :meth:" -"`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" +"Get the default value for a namespace attribute, as set by " +"either :meth:`~ArgumentParser.add_argument` or " +"by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: ../../library/argparse.rst:1981 +#: ../../library/argparse.rst:2082 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -3359,54 +3521,54 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:1988 +#: ../../library/argparse.rst:2089 msgid "Printing help" msgstr "印出幫助訊息" -#: ../../library/argparse.rst:1990 +#: ../../library/argparse.rst:2091 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: ../../library/argparse.rst:1996 +#: ../../library/argparse.rst:2097 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: ../../library/argparse.rst:2002 +#: ../../library/argparse.rst:2103 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: ../../library/argparse.rst:2006 +#: ../../library/argparse.rst:2107 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:2011 +#: ../../library/argparse.rst:2112 msgid "" -"Return a string containing a brief description of how the :class:" -"`ArgumentParser` should be invoked on the command line." +"Return a string containing a brief description of how " +"the :class:`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:2016 +#: ../../library/argparse.rst:2117 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:2021 +#: ../../library/argparse.rst:2122 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:2025 +#: ../../library/argparse.rst:2126 msgid "" "Sometimes a script only needs to handle a specific set of command-line " "arguments, leaving any unrecognized arguments for another script or program. " @@ -3414,7 +3576,7 @@ msgid "" "useful." msgstr "" -#: ../../library/argparse.rst:2030 +#: ../../library/argparse.rst:2131 msgid "" "This method works similarly to :meth:`~ArgumentParser.parse_args`, but it " "does not raise an error for extra, unrecognized arguments. Instead, it " @@ -3422,7 +3584,7 @@ msgid "" "populated namespace and the list of any unrecognized arguments." msgstr "" -#: ../../library/argparse.rst:2037 +#: ../../library/argparse.rst:2138 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -3436,19 +3598,19 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2044 +#: ../../library/argparse.rst:2145 msgid "" -":ref:`Prefix matching ` rules apply to :meth:" -"`~ArgumentParser.parse_known_args`. The parser may consume an option even if " -"it's just a prefix of one of its known options, instead of leaving it in the " -"remaining arguments list." +":ref:`Prefix matching ` rules apply " +"to :meth:`~ArgumentParser.parse_known_args`. The parser may consume an " +"option even if it's just a prefix of one of its known options, instead of " +"leaving it in the remaining arguments list." msgstr "" -#: ../../library/argparse.rst:2051 +#: ../../library/argparse.rst:2152 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2055 +#: ../../library/argparse.rst:2156 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -3456,20 +3618,20 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2060 +#: ../../library/argparse.rst:2161 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: ../../library/argparse.rst:2064 +#: ../../library/argparse.rst:2165 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: ../../library/argparse.rst:2067 +#: ../../library/argparse.rst:2168 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -3479,18 +3641,18 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2073 +#: ../../library/argparse.rst:2174 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2077 +#: ../../library/argparse.rst:2178 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* to :data:`sys.stderr` before that. The user " "can override this method to handle these steps differently::" msgstr "" -#: ../../library/argparse.rst:2081 +#: ../../library/argparse.rst:2182 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3504,17 +3666,17 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2089 +#: ../../library/argparse.rst:2190 msgid "" -"This method prints a usage message, including the *message*, to :data:`sys." -"stderr` and terminates the program with a status code of 2." +"This method prints a usage message, including the *message*, " +"to :data:`sys.stderr` and terminates the program with a status code of 2." msgstr "" -#: ../../library/argparse.rst:2094 +#: ../../library/argparse.rst:2195 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2099 +#: ../../library/argparse.rst:2200 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -3522,7 +3684,7 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2104 +#: ../../library/argparse.rst:2205 msgid "" "These parsers do not support all the :mod:`!argparse` features, and will " "raise exceptions if unsupported features are used. In particular, " @@ -3530,15 +3692,16 @@ msgid "" "positionals are not supported." msgstr "" -#: ../../library/argparse.rst:2109 +#: ../../library/argparse.rst:2210 msgid "" -"The following example shows the difference between :meth:`~ArgumentParser." -"parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " -"former returns ``['2', '3']`` as unparsed arguments, while the latter " -"collects all the positionals into ``rest``. ::" +"The following example shows the difference " +"between :meth:`~ArgumentParser.parse_known_args` " +"and :meth:`~ArgumentParser.parse_intermixed_args`: the former returns " +"``['2', '3']`` as unparsed arguments, while the latter collects all the " +"positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2115 +#: ../../library/argparse.rst:2216 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3558,7 +3721,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2124 +#: ../../library/argparse.rst:2225 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -3566,11 +3729,11 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2133 +#: ../../library/argparse.rst:2234 msgid "Registering custom types or actions" msgstr "" -#: ../../library/argparse.rst:2137 +#: ../../library/argparse.rst:2238 msgid "" "Sometimes it's desirable to use a custom string in error messages to provide " "more user-friendly output. In these cases, :meth:`!register` can be used to " @@ -3578,7 +3741,7 @@ msgid "" "the type by their registered name instead of their callable name." msgstr "" -#: ../../library/argparse.rst:2142 +#: ../../library/argparse.rst:2243 msgid "" "The :meth:`!register` method accepts three arguments - a *registry_name*, " "specifying the internal registry where the object will be stored (e.g., " @@ -3586,12 +3749,12 @@ msgid "" "be registered, and object, the callable to be registered." msgstr "" -#: ../../library/argparse.rst:2147 +#: ../../library/argparse.rst:2248 msgid "" "The following example shows how to register a custom type with a parser::" msgstr "" -#: ../../library/argparse.rst:2149 +#: ../../library/argparse.rst:2250 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -3607,42 +3770,73 @@ msgid "" "PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" msgstr "" -#: ../../library/argparse.rst:2161 +#: ../../library/argparse.rst:2262 msgid "Exceptions" msgstr "例外" -#: ../../library/argparse.rst:2165 +#: ../../library/argparse.rst:2266 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: ../../library/argparse.rst:2167 +#: ../../library/argparse.rst:2268 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: ../../library/argparse.rst:2172 +#: ../../library/argparse.rst:2273 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: ../../library/argparse.rst:2176 +#: ../../library/argparse.rst:2277 msgid "Guides and Tutorials" msgstr "" -#: ../../library/argparse.rst:809 +#: ../../library/argparse.rst:896 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/argparse.rst:809 ../../library/argparse.rst:843 -#: ../../library/argparse.rst:857 +#: ../../library/argparse.rst:896 ../../library/argparse.rst:928 +#: ../../library/argparse.rst:942 msgid "in argparse module" msgstr "於 argparse 模組中" -#: ../../library/argparse.rst:843 +#: ../../library/argparse.rst:928 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/argparse.rst:857 +#: ../../library/argparse.rst:942 msgid "+ (plus)" msgstr "+ (加號)" + +#~ msgid "" +#~ ">>> parser = argparse.ArgumentParser()\n" +#~ ">>> parser.add_argument('infile', nargs='?', " +#~ "type=argparse.FileType('r'),\n" +#~ "... default=sys.stdin)\n" +#~ ">>> parser.add_argument('outfile', nargs='?', " +#~ "type=argparse.FileType('w'),\n" +#~ "... default=sys.stdout)\n" +#~ ">>> parser.parse_args(['input.txt', 'output.txt'])\n" +#~ "Namespace(infile=<_io.TextIOWrapper name='input.txt' encoding='UTF-8'>,\n" +#~ " outfile=<_io.TextIOWrapper name='output.txt' " +#~ "encoding='UTF-8'>)\n" +#~ ">>> parser.parse_args([])\n" +#~ "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>,\n" +#~ " outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" +#~ msgstr "" +#~ ">>> parser = argparse.ArgumentParser()\n" +#~ ">>> parser.add_argument('infile', nargs='?', " +#~ "type=argparse.FileType('r'),\n" +#~ "... default=sys.stdin)\n" +#~ ">>> parser.add_argument('outfile', nargs='?', " +#~ "type=argparse.FileType('w'),\n" +#~ "... default=sys.stdout)\n" +#~ ">>> parser.parse_args(['input.txt', 'output.txt'])\n" +#~ "Namespace(infile=<_io.TextIOWrapper name='input.txt' encoding='UTF-8'>,\n" +#~ " outfile=<_io.TextIOWrapper name='output.txt' " +#~ "encoding='UTF-8'>)\n" +#~ ">>> parser.parse_args([])\n" +#~ "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>,\n" +#~ " outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" diff --git a/library/ast.po b/library/ast.po index 5d46b5bc4c6..1ee0a5780ee 100644 --- a/library/ast.po +++ b/library/ast.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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -18,7 +18,8 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../library/ast.rst:2 -msgid ":mod:`!ast` --- Abstract Syntax Trees" +#, fuzzy +msgid ":mod:`!ast` --- Abstract syntax trees" msgstr ":mod:`!ast` --- 抽象語法樹 (Abstract Syntax Trees)" #: ../../library/ast.rst:14 @@ -38,12 +39,12 @@ msgstr "" #: ../../library/ast.rst:23 msgid "" -"An abstract syntax tree can be generated by passing :data:`ast." -"PyCF_ONLY_AST` as a flag to the :func:`compile` built-in function, or using " -"the :func:`parse` helper provided in this module. The result will be a tree " -"of objects whose classes all inherit from :class:`ast.AST`. An abstract " -"syntax tree can be compiled into a Python code object using the built-in :" -"func:`compile` function." +"An abstract syntax tree can be generated by " +"passing :data:`ast.PyCF_ONLY_AST` as a flag to the :func:`compile` built-in " +"function, or using the :func:`parse` helper provided in this module. The " +"result will be a tree of objects whose classes all inherit " +"from :class:`ast.AST`. An abstract syntax tree can be compiled into a " +"Python code object using the built-in :func:`compile` function." msgstr "" "要生成抽象語法樹,可以透過將 :data:`ast.PyCF_ONLY_AST` 作為旗標傳遞給內建函" "式 :func:`compile` 或使用此模組所提供的 :func:`parse` 輔助函式。結果將會是一" @@ -51,7 +52,8 @@ msgstr "" "函式將抽象語法樹編譯成 Python 程式碼物件。" #: ../../library/ast.rst:33 -msgid "Abstract Grammar" +#, fuzzy +msgid "Abstract grammar" msgstr "抽象文法 (Abstract Grammar)" #: ../../library/ast.rst:35 @@ -133,7 +135,7 @@ msgid "" " | UnaryOp(unaryop op, expr operand)\n" " | Lambda(arguments args, expr body)\n" " | IfExp(expr test, expr body, expr orelse)\n" -" | Dict(expr* keys, expr* values)\n" +" | Dict(expr?* keys, expr* values)\n" " | Set(expr* elts)\n" " | ListComp(expr elt, comprehension* generators)\n" " | SetComp(expr elt, comprehension* generators)\n" @@ -148,7 +150,10 @@ msgid "" " | Compare(expr left, cmpop* ops, expr* comparators)\n" " | Call(expr func, expr* args, keyword* keywords)\n" " | FormattedValue(expr value, int conversion, expr? format_spec)\n" +" | Interpolation(expr value, constant str, int conversion, expr? " +"format_spec)\n" " | JoinedStr(expr* values)\n" +" | TemplateStr(expr* values)\n" " | Constant(constant value, string? kind)\n" "\n" " -- the following expression can appear in assignment context\n" @@ -239,13 +244,13 @@ msgstr "節點 (Node) 類別" #: ../../library/ast.rst:46 msgid "" "This is the base of all AST node classes. The actual node classes are " -"derived from the :file:`Parser/Python.asdl` file, which is reproduced :ref:" -"`above `. They are defined in the :mod:`!_ast` C module " -"and re-exported in :mod:`ast`." +"derived from the :file:`Parser/Python.asdl` file, which is " +"reproduced :ref:`above `. They are defined in the :mod:`!" +"_ast` C module and re-exported in :mod:`ast`." msgstr "" -"這是所有 AST 節點類別的基礎。實際的節點類別是衍生自 :file:`Parser/Python." -"asdl` 檔案,該檔案在\\ :ref:`上方 ` 重現。它們被定義於 :" -"mod:`!_ast` 的 C 模組中,並於 :mod:`ast` 中重新匯出。" +"這是所有 AST 節點類別的基礎。實際的節點類別是衍生自 :file:`Parser/" +"Python.asdl` 檔案,該檔案在\\ :ref:`上方 ` 重現。它們被定義" +"於 :mod:`!_ast` 的 C 模組中,並於 :mod:`ast` 中重新匯出。" #: ../../library/ast.rst:51 msgid "" @@ -257,11 +262,11 @@ msgid "" "rules with alternatives (aka \"sums\"), the left-hand side class is " "abstract: only instances of specific constructor nodes are ever created." msgstr "" -"抽象文法中為每個左側符號定義了一個類別(例如 :class:`ast.stmt` 或 :class:" -"`ast.expr`\\ )。此外,也為每個右側的建構函式 (constructor) 定義了一個類別;" -"這些類別繼承自左側樹的類別。例如,:class:`ast.BinOp` 繼承自 :class:`ast." -"expr`。對於具有替代方案(即為「和 (sums)」)的生產規則,左側類別是抽象的:僅" -"有特定建構函式節點的實例會被建立。" +"抽象文法中為每個左側符號定義了一個類別(例如 :class:`ast.stmt` " +"或 :class:`ast.expr`\\ )。此外,也為每個右側的建構函式 (constructor) 定義了" +"一個類別;這些類別繼承自左側樹的類別。例如,:class:`ast.BinOp` 繼承" +"自 :class:`ast.expr`。對於具有替代方案(即為「和 (sums)」)的生產規則,左側類" +"別是抽象的:僅有特定建構函式節點的實例會被建立。" #: ../../library/ast.rst:64 msgid "" @@ -275,8 +280,8 @@ msgid "" "the type as defined in the grammar. For example, :class:`ast.BinOp` " "instances have an attribute :attr:`left` of type :class:`ast.expr`." msgstr "" -"具體類別的每個實例對於每個子節點都有一個屬性,其型別如文法中所定義。例如,:" -"class:`ast.BinOp` 實例具有型別為 :class:`ast.expr` 的屬性 :attr:`left`。" +"具體類別的每個實例對於每個子節點都有一個屬性,其型別如文法中所定義。例" +"如,:class:`ast.BinOp` 實例具有型別為 :class:`ast.expr` 的屬性 :attr:`left`。" #: ../../library/ast.rst:71 msgid "" @@ -287,16 +292,16 @@ msgid "" "compiling an AST with :func:`compile`." msgstr "" "如果這些屬性在文法中被標記為可選(使用問號),則該值可能為 ``None``。如果屬性" -"可以有零個或多個值(用星號標記),則這些值將表示為 Python 串列。使用 :func:" -"`compile` 編譯 AST 時,所有可能的屬性都必須存在並且具有有效值。" +"可以有零個或多個值(用星號標記),則這些值將表示為 Python 串列。使" +"用 :func:`compile` 編譯 AST 時,所有可能的屬性都必須存在並且具有有效值。" #: ../../library/ast.rst:79 msgid "" "The :attr:`!_field_types` attribute on each concrete class is a dictionary " "mapping field names (as also listed in :attr:`_fields`) to their types." msgstr "" -"每個具體類別上的 :attr:`!_field_types` 屬性是將欄位名稱(也在 :attr:" -"`_fields` 中列出)對映到其型別的字典。" +"每個具體類別上的 :attr:`!_field_types` 屬性是將欄位名稱(也" +"在 :attr:`_fields` 中列出)對映到其型別的字典。" #: ../../library/ast.rst:82 msgid "" @@ -310,21 +315,22 @@ msgstr "" #: ../../library/ast.rst:94 msgid "" -"Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have :attr:" -"`lineno`, :attr:`col_offset`, :attr:`end_lineno`, and :attr:`end_col_offset` " -"attributes. The :attr:`lineno` and :attr:`end_lineno` are the first and " -"last line numbers of source text span (1-indexed so the first line is line " -"1) and the :attr:`col_offset` and :attr:`end_col_offset` are the " -"corresponding UTF-8 byte offsets of the first and last tokens that generated " -"the node. The UTF-8 offset is recorded because the parser uses UTF-8 " -"internally." -msgstr "" -":class:`ast.expr` 和 :class:`ast.stmt` 子類別的實例具有 :attr:`lineno`、:" -"attr:`col_offset`、:attr:`end_lineno` 和 :attr:`end_col_offset` 屬性。:attr:" -"`lineno` 和 :attr:`end_lineno` 是原始文本跨度 (source text span) 的第一個和最" -"後一個列號(1-indexed,因此第一列號是 1)以及 :attr:`col_offset` 和 :attr:" -"`end_col_offset` 是生成節點的第一個和最後一個標記對應的 UTF-8 位元組偏移量。" -"會記錄 UTF-8 偏移量是因為剖析器 (parser) 內部使用 UTF-8。" +"Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses " +"have :attr:`lineno`, :attr:`col_offset`, :attr:`end_lineno`, " +"and :attr:`end_col_offset` attributes. The :attr:`lineno` " +"and :attr:`end_lineno` are the first and last line numbers of source text " +"span (1-indexed so the first line is line 1) and the :attr:`col_offset` " +"and :attr:`end_col_offset` are the corresponding UTF-8 byte offsets of the " +"first and last tokens that generated the node. The UTF-8 offset is recorded " +"because the parser uses UTF-8 internally." +msgstr "" +":class:`ast.expr` 和 :class:`ast.stmt` 子類別的實例具" +"有 :attr:`lineno`、:attr:`col_offset`、:attr:`end_lineno` " +"和 :attr:`end_col_offset` 屬性。:attr:`lineno` 和 :attr:`end_lineno` 是原始文" +"本跨度 (source text span) 的第一個和最後一個列號(1-indexed,因此第一列號是 " +"1)以及 :attr:`col_offset` 和 :attr:`end_col_offset` 是生成節點的第一個和最後" +"一個標記對應的 UTF-8 位元組偏移量。會記錄 UTF-8 偏移量是因為剖析器 (parser) " +"內部使用 UTF-8。" #: ../../library/ast.rst:103 msgid "" @@ -376,15 +382,15 @@ msgid "" "If a field that is optional in the grammar is omitted from the constructor, " "it defaults to ``None``. If a list field is omitted, it defaults to the " "empty list. If a field of type :class:`!ast.expr_context` is omitted, it " -"defaults to :class:`Load() `. If any other field is omitted, a :" -"exc:`DeprecationWarning` is raised and the AST node will not have this " +"defaults to :class:`Load() `. If any other field is omitted, " +"a :exc:`DeprecationWarning` is raised and the AST node will not have this " "field. In Python 3.15, this condition will raise an error." msgstr "" "如果建構函式中省略了文法中可選的欄位,則它預設為 ``None``。如果省略串列欄位," -"則預設為空串列。如果省略 :class:`!ast.expr_context` 型別的欄位,則預設為 :" -"class:`Load() `。如果省略任何其他欄位,則會引發 :exc:" -"`DeprecationWarning`,且 AST 節點將沒有此欄位。在 Python 3.15 中,這種情況會" -"引發錯誤。" +"則預設為空串列。如果省略 :class:`!ast.expr_context` 型別的欄位,則預設" +"為 :class:`Load() `。如果省略任何其他欄位,則會引" +"發 :exc:`DeprecationWarning`,且 AST 節點將沒有此欄位。在 Python 3.15 中,這" +"種情況會引發錯誤。" #: ../../library/ast.rst:130 msgid "Class :class:`ast.Constant` is now used for all constants." @@ -398,16 +404,22 @@ msgstr "以它們的值表示簡單索引,擴充切片 (slice) 則以元組 (t #: ../../library/ast.rst:139 msgid "" -"Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`, :" -"class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still available, " -"but they will be removed in future Python releases. In the meantime, " -"instantiating them will return an instance of a different class." +"The :meth:`~object.__repr__` output of :class:`~ast.AST` nodes includes the " +"values of the node fields." +msgstr "" + +#: ../../library/ast.rst:144 +msgid "" +"Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!" +"ast.Bytes`, :class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still " +"available, but they will be removed in future Python releases. In the " +"meantime, instantiating them will return an instance of a different class." msgstr "" "舊的類別 :class:`!ast.Num`、:class:`!ast.Str`、:class:`!ast.Bytes`、:class:`!" "ast.NameConstant` 和 :class:`!ast.Ellipsis` 仍然可用,但它們將在未來的 " "Python 釋出版本中移除。與此同時,實例化它們將回傳不同類別的實例。" -#: ../../library/ast.rst:146 +#: ../../library/ast.rst:151 msgid "" "Old classes :class:`!ast.Index` and :class:`!ast.ExtSlice` are still " "available, but they will be removed in future Python releases. In the " @@ -416,7 +428,7 @@ msgstr "" "舊的類別 :class:`!ast.Index` 和 :class:`!ast.ExtSlice` 仍然可用,但它們將在未" "來的 Python 版本中刪除。同時,實例化它們會回傳不同類別的實例。" -#: ../../library/ast.rst:153 +#: ../../library/ast.rst:158 msgid "" "Previous versions of Python allowed the creation of AST nodes that were " "missing required fields. Similarly, AST node constructors allowed arbitrary " @@ -428,33 +440,34 @@ msgstr "" "許將任意關鍵字引數設為 AST 節點的屬性,即使它們與 AST 節點的任何欄位都不匹" "配。此行為已被棄用,並將在 Python 3.15 中刪除。" -#: ../../library/ast.rst:160 +#: ../../library/ast.rst:165 msgid "" "The descriptions of the specific node classes displayed here were initially " -"adapted from the fantastic `Green Tree Snakes `__ project and all its contributors." +"adapted from the fantastic `Green Tree Snakes `__ project and all its " +"contributors." msgstr "" "這裡顯示的特定節點類別的描述最初是從出色的 `Green Tree Snakes `__ 專案和所有貢獻者那裡改編而來" "的。" -#: ../../library/ast.rst:169 +#: ../../library/ast.rst:174 msgid "Root nodes" msgstr "根節點" -#: ../../library/ast.rst:173 +#: ../../library/ast.rst:178 msgid "" "A Python module, as with :ref:`file input `. Node type generated " "by :func:`ast.parse` in the default ``\"exec\"`` *mode*." msgstr "" -"一個 Python 模組,與\\ :ref:`檔案輸入 ` 一樣。由 :func:`ast." -"parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" +"一個 Python 模組,與\\ :ref:`檔案輸入 ` 一樣。" +"由 :func:`ast.parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" -#: ../../library/ast.rst:176 +#: ../../library/ast.rst:181 msgid "``body`` is a :class:`list` of the module's :ref:`ast-statements`." msgstr "``body`` 是模組的\\ :ref:`ast-statements` 的一個 :class:`list`。" -#: ../../library/ast.rst:178 +#: ../../library/ast.rst:183 msgid "" "``type_ignores`` is a :class:`list` of the module's type ignore comments; " "see :func:`ast.parse` for more details." @@ -462,7 +475,7 @@ msgstr "" "``type_ignores`` 是模組的忽略型別註解的 :class:`list`;有關更多詳細資訊,請參" "閱 :func:`ast.parse`。" -#: ../../library/ast.rst:181 +#: ../../library/ast.rst:186 msgid "" ">>> print(ast.dump(ast.parse('x = 1'), indent=4))\n" "Module(\n" @@ -480,7 +493,7 @@ msgstr "" " Name(id='x', ctx=Store())],\n" " value=Constant(value=1))])" -#: ../../library/ast.rst:194 +#: ../../library/ast.rst:199 msgid "" "A single Python :ref:`expression input `. Node type " "generated by :func:`ast.parse` when *mode* is ``\"eval\"``." @@ -488,14 +501,14 @@ msgstr "" "單個 Python :ref:`運算式輸入 `。當 *mode* 是 ``\"eval\"`` " "時節點型別由 :func:`ast.parse` 生成。" -#: ../../library/ast.rst:197 +#: ../../library/ast.rst:202 msgid "" "``body`` is a single node, one of the :ref:`expression types `." msgstr "" "``body`` 是單個節點,是\\ :ref:`運算式型別 `\\ 的其中之一。" -#: ../../library/ast.rst:200 ../../library/ast.rst:270 +#: ../../library/ast.rst:205 ../../library/ast.rst:275 msgid "" ">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n" "Expression(\n" @@ -505,7 +518,7 @@ msgstr "" "Expression(\n" " body=Constant(value=123))" -#: ../../library/ast.rst:209 +#: ../../library/ast.rst:214 msgid "" "A single :ref:`interactive input `, like in :ref:`tut-interac`. " "Node type generated by :func:`ast.parse` when *mode* is ``\"single\"``." @@ -513,13 +526,13 @@ msgstr "" "單個\\ :ref:`互動式輸入 `,和\\ :ref:`tut-interac`\\ 中所述的相" "似。當 *mode* 是 ``\"single\"`` 時節點型別由 :func:`ast.parse` 生成。" -#: ../../library/ast.rst:212 +#: ../../library/ast.rst:217 msgid "``body`` is a :class:`list` of :ref:`statement nodes `." msgstr "" -"``body`` 是\\ :ref:`陳述式節點 (statement nodes) ` 的 :class:" -"`list`。" +"``body`` 是\\ :ref:`陳述式節點 (statement nodes) ` " +"的 :class:`list`。" -#: ../../library/ast.rst:214 +#: ../../library/ast.rst:219 msgid "" ">>> print(ast.dump(ast.parse('x = 1; y = 2', mode='single'), indent=4))\n" "Interactive(\n" @@ -545,7 +558,7 @@ msgstr "" " Name(id='y', ctx=Store())],\n" " value=Constant(value=2))])" -#: ../../library/ast.rst:231 +#: ../../library/ast.rst:236 msgid "" "A representation of an old-style type comments for functions, as Python " "versions prior to 3.5 didn't support :pep:`484` annotations. Node type " @@ -554,11 +567,11 @@ msgstr "" "函式的舊式型別註解的表示法,因為 3.5 之前的 Python 版本不支援 :pep:`484` 註" "釋。當 *mode* 是 ``\"func_type\"`` 時節點型別由 :func:`ast.parse` 生成。" -#: ../../library/ast.rst:235 +#: ../../library/ast.rst:240 msgid "Such type comments would look like this::" msgstr "這種型別的註解看起來像這樣: ::" -#: ../../library/ast.rst:237 +#: ../../library/ast.rst:242 msgid "" "def sum_two_number(a, b):\n" " # type: (int, int) -> int\n" @@ -568,17 +581,17 @@ msgstr "" " # type: (int, int) -> int\n" " return a + b" -#: ../../library/ast.rst:241 +#: ../../library/ast.rst:246 msgid "" "``argtypes`` is a :class:`list` of :ref:`expression nodes `." msgstr "" "``argtypes`` 是\\ :ref:`運算式節點 `\\ 的 :class:`list`。" -#: ../../library/ast.rst:243 +#: ../../library/ast.rst:248 msgid "``returns`` is a single :ref:`expression node `." msgstr "``returns`` 是單個\\ :ref:`運算式節點 `。" -#: ../../library/ast.rst:245 +#: ../../library/ast.rst:250 msgid "" ">>> print(ast.dump(ast.parse('(int, str) -> List[int]', mode='func_type'), " "indent=4))\n" @@ -602,24 +615,24 @@ msgstr "" " slice=Name(id='int', ctx=Load()),\n" " ctx=Load()))" -#: ../../library/ast.rst:261 +#: ../../library/ast.rst:266 msgid "Literals" msgstr "文本 (Literals)" -#: ../../library/ast.rst:265 +#: ../../library/ast.rst:270 msgid "" "A constant value. The ``value`` attribute of the ``Constant`` literal " "contains the Python object it represents. The values represented can be " -"instances of :class:`str`, :class:`bytes`, :class:`int`, :class:`float`, :" -"class:`complex`, and :class:`bool`, and the constants :data:`None` and :data:" -"`Ellipsis`." +"instances " +"of :class:`str`, :class:`bytes`, :class:`int`, :class:`float`, :class:`complex`, " +"and :class:`bool`, and the constants :data:`None` and :data:`Ellipsis`." msgstr "" "一個常數值。``Constant`` 文本的 ``value`` 屬性包含它所代表的 Python 物件。表" -"示的值可以是 :class:`str`、:class:`bytes`、:class:`int`、:class:`float`、:" -"class:`complex` 和 :class:`bool` 的實例,以及常數 :data:`None` 和 :" -"data:`Ellipsis`。" +"示的值可以" +"是 :class:`str`、:class:`bytes`、:class:`int`、:class:`float`、:class:`complex` " +"和 :class:`bool` 的實例,以及常數 :data:`None` 和 :data:`Ellipsis`。" -#: ../../library/ast.rst:279 +#: ../../library/ast.rst:284 msgid "" "Node representing a single formatting field in an f-string. If the string " "contains a single formatting field and nothing else the node can be isolated " @@ -629,33 +642,36 @@ msgstr "" "沒有其他內容,則可以隔離 (isolate) 該節點,否則它將出現在 :class:`JoinedStr` " "中。" -#: ../../library/ast.rst:283 +#: ../../library/ast.rst:288 msgid "" "``value`` is any expression node (such as a literal, a variable, or a " "function call)." msgstr "``value`` 為任何運算式節點(例如文字、變數或函式呼叫)。" -#: ../../library/ast.rst:285 +#: ../../library/ast.rst:290 ../../library/ast.rst:367 msgid "``conversion`` is an integer:" msgstr "``conversion`` 是一個整數:" -#: ../../library/ast.rst:287 +#: ../../library/ast.rst:292 msgid "-1: no formatting" msgstr "-1: 無格式化" -#: ../../library/ast.rst:288 -msgid "115: ``!s`` string formatting" -msgstr "115: ``!s`` 字串格式化" +#: ../../library/ast.rst:293 +#, fuzzy +msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` formatting" +msgstr "97: ``!a`` ascii 格式化" -#: ../../library/ast.rst:289 -msgid "114: ``!r`` repr formatting" +#: ../../library/ast.rst:294 +#, fuzzy +msgid "114 (``ord('r')``): ``!r`` :func:`repr` formatting" msgstr "114:``!r`` 重複格式化化" -#: ../../library/ast.rst:290 -msgid "97: ``!a`` ascii formatting" -msgstr "97: ``!a`` ascii 格式化" +#: ../../library/ast.rst:295 +#, fuzzy +msgid "115 (``ord('s')``): ``!s`` :func:`string ` formatting" +msgstr "115: ``!s`` 字串格式化" -#: ../../library/ast.rst:292 +#: ../../library/ast.rst:297 msgid "" "``format_spec`` is a :class:`JoinedStr` node representing the formatting of " "the value, or ``None`` if no format was specified. Both ``conversion`` and " @@ -664,14 +680,14 @@ msgstr "" "``format_spec`` 是一個 :class:`JoinedStr` 節點,表示值的格式,若未指定格式則" "為 ``None``。``conversion`` 和 ``format_spec`` 可以同時設定。" -#: ../../library/ast.rst:299 +#: ../../library/ast.rst:304 msgid "" -"An f-string, comprising a series of :class:`FormattedValue` and :class:" -"`Constant` nodes." +"An f-string, comprising a series of :class:`FormattedValue` " +"and :class:`Constant` nodes." msgstr "" "一個 f 字串,包含一系列 :class:`FormattedValue` 和 :class:`Constant` 節點。" -#: ../../library/ast.rst:302 +#: ../../library/ast.rst:307 msgid "" ">>> print(ast.dump(ast.parse('f\"sin({a}) is {sin(a):.3}\"', mode='eval'), " "indent=4))\n" @@ -713,16 +729,113 @@ msgstr "" " values=[\n" " Constant(value='.3')]))]))" -#: ../../library/ast.rst:327 +#: ../../library/ast.rst:333 +msgid "" +"Node representing a template string literal, comprising a series " +"of :class:`Interpolation` and :class:`Constant` nodes. These nodes may be " +"any order, and do not need to be interleaved." +msgstr "" + +#: ../../library/ast.rst:337 +#, fuzzy +msgid "" +">>> expr = ast.parse('t\"{name} finished {place:ordinal}\"', mode='eval')\n" +">>> print(ast.dump(expr, indent=4))\n" +"Expression(\n" +" body=TemplateStr(\n" +" values=[\n" +" Interpolation(\n" +" value=Name(id='name', ctx=Load()),\n" +" str='name',\n" +" conversion=-1),\n" +" Constant(value=' finished '),\n" +" Interpolation(\n" +" value=Name(id='place', ctx=Load()),\n" +" str='place',\n" +" conversion=-1,\n" +" format_spec=JoinedStr(\n" +" values=[\n" +" Constant(value='ordinal')]))]))" +msgstr "" +">>> print(ast.dump(ast.parse('f\"sin({a}) is {sin(a):.3}\"', mode='eval'), " +"indent=4))\n" +"Expression(\n" +" body=JoinedStr(\n" +" values=[\n" +" Constant(value='sin('),\n" +" FormattedValue(\n" +" value=Name(id='a', ctx=Load()),\n" +" conversion=-1),\n" +" Constant(value=') is '),\n" +" FormattedValue(\n" +" value=Call(\n" +" func=Name(id='sin', ctx=Load()),\n" +" args=[\n" +" Name(id='a', ctx=Load())]),\n" +" conversion=-1,\n" +" format_spec=JoinedStr(\n" +" values=[\n" +" Constant(value='.3')]))]))" + +#: ../../library/ast.rst:361 +msgid "" +"Node representing a single interpolation field in a template string literal." +msgstr "" + +#: ../../library/ast.rst:363 +#, fuzzy +msgid "" +"``value`` is any expression node (such as a literal, a variable, or a " +"function call). This has the same meaning as ``FormattedValue.value``." +msgstr "``value`` 為任何運算式節點(例如文字、變數或函式呼叫)。" + +#: ../../library/ast.rst:366 +msgid "" +"``str`` is a constant containing the text of the interpolation expression." +msgstr "" + +#: ../../library/ast.rst:369 +#, fuzzy +msgid "-1: no conversion" +msgstr "-1: 無格式化" + +#: ../../library/ast.rst:370 +msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` conversion" +msgstr "" + +#: ../../library/ast.rst:371 +msgid "114 (``ord('r')``): ``!r`` :func:`repr` conversion" +msgstr "" + +#: ../../library/ast.rst:372 +msgid "115 (``ord('s')``): ``!s`` :func:`string ` conversion" +msgstr "" + +#: ../../library/ast.rst:374 +msgid "This has the same meaning as ``FormattedValue.conversion``." +msgstr "" + +#: ../../library/ast.rst:375 +#, fuzzy +msgid "" +"``format_spec`` is a :class:`JoinedStr` node representing the formatting of " +"the value, or ``None`` if no format was specified. Both ``conversion`` and " +"``format_spec`` can be set at the same time. This has the same meaning as " +"``FormattedValue.format_spec``." +msgstr "" +"``format_spec`` 是一個 :class:`JoinedStr` 節點,表示值的格式,若未指定格式則" +"為 ``None``。``conversion`` 和 ``format_spec`` 可以同時設定。" + +#: ../../library/ast.rst:384 msgid "" "A list or tuple. ``elts`` holds a list of nodes representing the elements. " "``ctx`` is :class:`Store` if the container is an assignment target (i.e. " "``(x,y)=something``), and :class:`Load` otherwise." msgstr "" -"串列或元組。``elts`` 保存表示元素的節點串列。如果容器是賦值目標(即 ``(x," -"y)=something`` ),則 ``ctx`` 是 :class:`Store`,否則是 :class:`Load`。" +"串列或元組。``elts`` 保存表示元素的節點串列。如果容器是賦值目標(即 " +"``(x,y)=something`` ),則 ``ctx`` 是 :class:`Store`,否則是 :class:`Load`。" -#: ../../library/ast.rst:331 +#: ../../library/ast.rst:388 msgid "" ">>> print(ast.dump(ast.parse('[1, 2, 3]', mode='eval'), indent=4))\n" "Expression(\n" @@ -758,11 +871,11 @@ msgstr "" " Constant(value=3)],\n" " ctx=Load()))" -#: ../../library/ast.rst:353 +#: ../../library/ast.rst:410 msgid "A set. ``elts`` holds a list of nodes representing the set's elements." msgstr "一個集合。``elts`` 保存表示集合之元素的節點串列。" -#: ../../library/ast.rst:355 +#: ../../library/ast.rst:412 msgid "" ">>> print(ast.dump(ast.parse('{1, 2, 3}', mode='eval'), indent=4))\n" "Expression(\n" @@ -780,7 +893,7 @@ msgstr "" " Constant(value=2),\n" " Constant(value=3)]))" -#: ../../library/ast.rst:368 +#: ../../library/ast.rst:425 msgid "" "A dictionary. ``keys`` and ``values`` hold lists of nodes representing the " "keys and the values respectively, in matching order (what would be returned " @@ -790,7 +903,7 @@ msgstr "" "節點串列(為呼叫 :code:`dictionary.keys()` 和 :code:`dictionary.values()` 時" "將回傳的內容)。" -#: ../../library/ast.rst:372 +#: ../../library/ast.rst:429 msgid "" "When doing dictionary unpacking using dictionary literals the expression to " "be expanded goes in the ``values`` list, with a ``None`` at the " @@ -799,7 +912,7 @@ msgstr "" "當使用字典文本進行字典解包 (unpack) 時,要擴充的運算式位於 ``values`` 串列" "中,在 ``keys`` 中的相應位置有一個 ``None``。" -#: ../../library/ast.rst:376 +#: ../../library/ast.rst:433 msgid "" ">>> print(ast.dump(ast.parse('{\"a\":1, **d}', mode='eval'), indent=4))\n" "Expression(\n" @@ -821,17 +934,17 @@ msgstr "" " Constant(value=1),\n" " Name(id='d', ctx=Load())]))" -#: ../../library/ast.rst:390 +#: ../../library/ast.rst:447 msgid "Variables" msgstr "變數" -#: ../../library/ast.rst:394 +#: ../../library/ast.rst:451 msgid "" "A variable name. ``id`` holds the name as a string, and ``ctx`` is one of " "the following types." msgstr "一個變數名稱。``id`` 將名稱以字串形式保存,且 ``ctx`` 是以下型別之一。" -#: ../../library/ast.rst:402 +#: ../../library/ast.rst:459 msgid "" "Variable references can be used to load the value of a variable, to assign a " "new value to it, or to delete it. Variable references are given a context to " @@ -840,7 +953,7 @@ msgstr "" "變數參照可用於載入變數的值、為其分配新值或刪除它。變數參照被賦予情境 " "(context) 來區分這些情況。" -#: ../../library/ast.rst:406 +#: ../../library/ast.rst:463 msgid "" ">>> print(ast.dump(ast.parse('a'), indent=4))\n" "Module(\n" @@ -884,16 +997,16 @@ msgstr "" " targets=[\n" " Name(id='a', ctx=Del())])])" -#: ../../library/ast.rst:432 +#: ../../library/ast.rst:489 msgid "" -"A ``*var`` variable reference. ``value`` holds the variable, typically a :" -"class:`Name` node. This type must be used when building a :class:`Call` node " -"with ``*args``." +"A ``*var`` variable reference. ``value`` holds the variable, typically " +"a :class:`Name` node. This type must be used when building a :class:`Call` " +"node with ``*args``." msgstr "" "一個 ``*var`` 變數參照。``value`` 保存變數,通常是一個 :class:`Name` 節點。在" "使用 ``*args`` 建置 :class:`Call` 節點時必須使用此型別。" -#: ../../library/ast.rst:436 +#: ../../library/ast.rst:493 msgid "" ">>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\n" "Module(\n" @@ -923,24 +1036,24 @@ msgstr "" " ctx=Store())],\n" " value=Name(id='it', ctx=Load()))])" -#: ../../library/ast.rst:456 +#: ../../library/ast.rst:513 msgid "Expressions" msgstr "運算式" -#: ../../library/ast.rst:460 +#: ../../library/ast.rst:517 msgid "" "When an expression, such as a function call, appears as a statement by " "itself with its return value not used or stored, it is wrapped in this " -"container. ``value`` holds one of the other nodes in this section, a :class:" -"`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` or :class:" -"`YieldFrom` node." +"container. ``value`` holds one of the other nodes in this section, " +"a :class:`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` " +"or :class:`YieldFrom` node." msgstr "" "當運算式(例如函式呼叫)本身作為陳述式出現且未使用或儲存其回傳值時,它將被包" -"裝在此容器中。``value`` 保存此區段 (section) 中的一個其他節點::class:" -"`Constant`、:class:`Name`、:class:`Lambda`、:class:`Yield` 或 :class:" -"`YieldFrom`" +"裝在此容器中。``value`` 保存此區段 (section) 中的一個其他節" +"點::class:`Constant`、:class:`Name`、:class:`Lambda`、:class:`Yield` " +"或 :class:`YieldFrom`" -#: ../../library/ast.rst:465 +#: ../../library/ast.rst:522 msgid "" ">>> print(ast.dump(ast.parse('-a'), indent=4))\n" "Module(\n" @@ -958,14 +1071,14 @@ msgstr "" " op=USub(),\n" " operand=Name(id='a', ctx=Load())))])" -#: ../../library/ast.rst:478 +#: ../../library/ast.rst:535 msgid "" "A unary operation. ``op`` is the operator, and ``operand`` any expression " "node." msgstr "" "一元運算 (unary operation)。``op`` 是運算子,``operand`` 是任何運算式節點。" -#: ../../library/ast.rst:487 +#: ../../library/ast.rst:544 msgid "" "Unary operator tokens. :class:`Not` is the ``not`` keyword, :class:`Invert` " "is the ``~`` operator." @@ -973,7 +1086,7 @@ msgstr "" "一元運算子標記。 :class:`Not` 是 ``not`` 關鍵字、:class:`Invert` 是 ``~`` 運" "算子。" -#: ../../library/ast.rst:490 +#: ../../library/ast.rst:547 msgid "" ">>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4))\n" "Expression(\n" @@ -987,7 +1100,7 @@ msgstr "" " op=Not(),\n" " operand=Name(id='x', ctx=Load())))" -#: ../../library/ast.rst:501 +#: ../../library/ast.rst:558 msgid "" "A binary operation (like addition or division). ``op`` is the operator, and " "``left`` and ``right`` are any expression nodes." @@ -995,7 +1108,7 @@ msgstr "" "二元運算 (binary operation)(如加法或除法)。 ``op`` 是運算子、``left`` 和 " "``right`` 是任意運算式節點。" -#: ../../library/ast.rst:504 +#: ../../library/ast.rst:561 msgid "" ">>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4))\n" "Expression(\n" @@ -1011,11 +1124,11 @@ msgstr "" " op=Add(),\n" " right=Name(id='y', ctx=Load())))" -#: ../../library/ast.rst:528 +#: ../../library/ast.rst:585 msgid "Binary operator tokens." msgstr "二元運算子 token。" -#: ../../library/ast.rst:533 +#: ../../library/ast.rst:590 msgid "" "A boolean operation, 'or' or 'and'. ``op`` is :class:`Or` or :class:`And`. " "``values`` are the values involved. Consecutive operations with the same " @@ -1026,11 +1139,11 @@ msgstr "" "有所涉及的值。使用同一運算子的連續操作(例如 ``a or b or c``\\ )會被折疊為具" "有多個值的一個節點。" -#: ../../library/ast.rst:538 +#: ../../library/ast.rst:595 msgid "This doesn't include ``not``, which is a :class:`UnaryOp`." msgstr "這不包括 ``not``,它是一個 :class:`UnaryOp`。" -#: ../../library/ast.rst:540 +#: ../../library/ast.rst:597 msgid "" ">>> print(ast.dump(ast.parse('x or y', mode='eval'), indent=4))\n" "Expression(\n" @@ -1048,11 +1161,11 @@ msgstr "" " Name(id='x', ctx=Load()),\n" " Name(id='y', ctx=Load())]))" -#: ../../library/ast.rst:554 +#: ../../library/ast.rst:611 msgid "Boolean operator tokens." msgstr "布林運算子 token。" -#: ../../library/ast.rst:559 +#: ../../library/ast.rst:616 msgid "" "A comparison of two or more values. ``left`` is the first value in the " "comparison, ``ops`` the list of operators, and ``comparators`` the list of " @@ -1061,7 +1174,7 @@ msgstr "" "兩個或多個值的比較。``left`` 是比較中的第一個值、``ops`` 是運算子串列、" "``comparators`` 是要比較的第一個元素之後值的串列。" -#: ../../library/ast.rst:563 +#: ../../library/ast.rst:620 msgid "" ">>> print(ast.dump(ast.parse('1 <= a < 10', mode='eval'), indent=4))\n" "Expression(\n" @@ -1085,36 +1198,36 @@ msgstr "" " Name(id='a', ctx=Load()),\n" " Constant(value=10)]))" -#: ../../library/ast.rst:588 +#: ../../library/ast.rst:645 msgid "Comparison operator tokens." msgstr "比較運算子 token。" -#: ../../library/ast.rst:593 +#: ../../library/ast.rst:650 msgid "" -"A function call. ``func`` is the function, which will often be a :class:" -"`Name` or :class:`Attribute` object. Of the arguments:" +"A function call. ``func`` is the function, which will often be " +"a :class:`Name` or :class:`Attribute` object. Of the arguments:" msgstr "" -"一個函式呼叫。``func`` 是該函式,通常是一個 :class:`Name` 或 :class:" -"`Attribute` 物件。而在引數中:" +"一個函式呼叫。``func`` 是該函式,通常是一個 :class:`Name` " +"或 :class:`Attribute` 物件。而在引數中:" -#: ../../library/ast.rst:596 +#: ../../library/ast.rst:653 msgid "``args`` holds a list of the arguments passed by position." msgstr "``args`` 保存按位置傳遞的引數串列。" -#: ../../library/ast.rst:597 +#: ../../library/ast.rst:654 msgid "" "``keywords`` holds a list of :class:`.keyword` objects representing " "arguments passed by keyword." msgstr "" "``keywords`` 保存一個 :class:`.keyword` 物件串列,表示透過關鍵字傳遞的引數。" -#: ../../library/ast.rst:600 +#: ../../library/ast.rst:657 msgid "" "The ``args`` and ``keywords`` arguments are optional and default to empty " "lists." msgstr "``args`` 和 ``keywords`` 引數是可選的,預設為空串列。" -#: ../../library/ast.rst:602 +#: ../../library/ast.rst:659 msgid "" ">>> print(ast.dump(ast.parse('func(a, b=c, *d, **e)', mode='eval'), " "indent=4))\n" @@ -1150,7 +1263,7 @@ msgstr "" " keyword(\n" " value=Name(id='e', ctx=Load()))]))" -#: ../../library/ast.rst:623 +#: ../../library/ast.rst:680 msgid "" "A keyword argument to a function call or class definition. ``arg`` is a raw " "string of the parameter name, ``value`` is a node to pass in." @@ -1158,7 +1271,7 @@ msgstr "" "函式呼叫或類別定義的關鍵字引數。``arg`` 是參數名稱的原始字串,``value`` 是要" "傳入的節點。" -#: ../../library/ast.rst:629 +#: ../../library/ast.rst:686 msgid "" "An expression such as ``a if b else c``. Each field holds a single node, so " "in the following example, all three are :class:`Name` nodes." @@ -1166,7 +1279,7 @@ msgstr "" "像是 ``a if b else c`` 之類的運算式。每個欄位都保存一個節點,因此在以下範例" "中,所有三個都是 :class:`Name` 節點。" -#: ../../library/ast.rst:632 +#: ../../library/ast.rst:689 msgid "" ">>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4))\n" "Expression(\n" @@ -1182,18 +1295,18 @@ msgstr "" " body=Name(id='a', ctx=Load()),\n" " orelse=Name(id='c', ctx=Load())))" -#: ../../library/ast.rst:644 +#: ../../library/ast.rst:701 msgid "" -"Attribute access, e.g. ``d.keys``. ``value`` is a node, typically a :class:" -"`Name`. ``attr`` is a bare string giving the name of the attribute, and " -"``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to how " -"the attribute is acted on." +"Attribute access, e.g. ``d.keys``. ``value`` is a node, typically " +"a :class:`Name`. ``attr`` is a bare string giving the name of the attribute, " +"and ``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to " +"how the attribute is acted on." msgstr "" "屬性的存取,例如 ``d.keys``。``value`` 是一個節點,通常是一個 :class:`Name`。" -"``attr`` 是一個屬性名稱的字串,``ctx`` 根據屬性的作用方式可能是 :class:" -"`Load`、:class:`Store` 或 :class:`Del`。" +"``attr`` 是一個屬性名稱的字串,``ctx`` 根據屬性的作用方式可能" +"是 :class:`Load`、:class:`Store` 或 :class:`Del`。" -#: ../../library/ast.rst:649 +#: ../../library/ast.rst:706 msgid "" ">>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4))\n" "Expression(\n" @@ -1209,18 +1322,18 @@ msgstr "" " attr='colour',\n" " ctx=Load()))" -#: ../../library/ast.rst:661 +#: ../../library/ast.rst:718 msgid "" "A named expression. This AST node is produced by the assignment expressions " -"operator (also known as the walrus operator). As opposed to the :class:" -"`Assign` node in which the first argument can be multiple nodes, in this " -"case both ``target`` and ``value`` must be single nodes." +"operator (also known as the walrus operator). As opposed to " +"the :class:`Assign` node in which the first argument can be multiple nodes, " +"in this case both ``target`` and ``value`` must be single nodes." msgstr "" "一個附名運算式 (named expression)。該 AST 節點由賦值運算式運算子(也稱為海象" "運算子)產生。相對於 :class:`Assign` 節點之第一個引數可為多個節點,在這種情況" "下 ``target`` 和 ``value`` 都必須是單個節點。" -#: ../../library/ast.rst:666 +#: ../../library/ast.rst:723 msgid "" ">>> print(ast.dump(ast.parse('(x := 4)', mode='eval'), indent=4))\n" "Expression(\n" @@ -1234,23 +1347,24 @@ msgstr "" " target=Name(id='x', ctx=Store()),\n" " value=Constant(value=4)))" -#: ../../library/ast.rst:677 +#: ../../library/ast.rst:734 msgid "Subscripting" msgstr "下標 (Subscripting)" -#: ../../library/ast.rst:681 +#: ../../library/ast.rst:738 msgid "" "A subscript, such as ``l[1]``. ``value`` is the subscripted object (usually " -"sequence or mapping). ``slice`` is an index, slice or key. It can be a :" -"class:`Tuple` and contain a :class:`Slice`. ``ctx`` is :class:`Load`, :class:" -"`Store` or :class:`Del` according to the action performed with the subscript." +"sequence or mapping). ``slice`` is an index, slice or key. It can be " +"a :class:`Tuple` and contain a :class:`Slice`. ``ctx`` " +"is :class:`Load`, :class:`Store` or :class:`Del` according to the action " +"performed with the subscript." msgstr "" "一個下標,例如 ``l[1]``。``value`` 是下標物件(通常是序列或對映)。``slice`` " "是索引、切片或鍵。它可以是一個 :class:`Tuple` 並包含一個 :class:`Slice`。根據" -"下標執行的操作不同,``ctx`` 可以是 :class:`Load`、:class:`Store` 或 :class:" -"`Del`。" +"下標執行的操作不同,``ctx`` 可以是 :class:`Load`、:class:`Store` " +"或 :class:`Del`。" -#: ../../library/ast.rst:687 +#: ../../library/ast.rst:744 msgid "" ">>> print(ast.dump(ast.parse('l[1:2, 3]', mode='eval'), indent=4))\n" "Expression(\n" @@ -1278,7 +1392,7 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))" -#: ../../library/ast.rst:705 +#: ../../library/ast.rst:762 msgid "" "Regular slicing (on the form ``lower:upper`` or ``lower:upper:step``). Can " "occur only inside the *slice* field of :class:`Subscript`, either directly " @@ -1287,7 +1401,7 @@ msgstr "" "常規切片(形式為 ``lower:upper`` 或 ``lower:upper:step``\\ )。只能直接或者或" "者作為 :class:`Tuple` 的元素出現在 :class:`Subscript` 的 *slice* 欄位內。" -#: ../../library/ast.rst:709 +#: ../../library/ast.rst:766 msgid "" ">>> print(ast.dump(ast.parse('l[1:2]', mode='eval'), indent=4))\n" "Expression(\n" @@ -1307,11 +1421,11 @@ msgstr "" " upper=Constant(value=2)),\n" " ctx=Load()))" -#: ../../library/ast.rst:722 +#: ../../library/ast.rst:779 msgid "Comprehensions" msgstr "綜合運算式 (comprehensions)" -#: ../../library/ast.rst:729 +#: ../../library/ast.rst:786 msgid "" "List and set comprehensions, generator expressions, and dictionary " "comprehensions. ``elt`` (or ``key`` and ``value``) is a single node " @@ -1320,11 +1434,11 @@ msgstr "" "串列和集合綜合運算、生成器運算式和字典綜合運算。``elt``\\ (或 ``key`` 和 " "``value``\\ )是單個節點,表示各個項目會被求值 (evaluate) 的部分。" -#: ../../library/ast.rst:733 +#: ../../library/ast.rst:790 msgid "``generators`` is a list of :class:`comprehension` nodes." msgstr "``generators`` 是一個 :class:`comprehension` 節點的串列。" -#: ../../library/ast.rst:735 +#: ../../library/ast.rst:792 msgid "" ">>> print(ast.dump(\n" "... ast.parse('[x for x in numbers]', mode='eval'),\n" @@ -1408,18 +1522,18 @@ msgstr "" " iter=Name(id='numbers', ctx=Load()),\n" " is_async=0)]))" -#: ../../library/ast.rst:781 +#: ../../library/ast.rst:838 msgid "" "One ``for`` clause in a comprehension. ``target`` is the reference to use " "for each element - typically a :class:`Name` or :class:`Tuple` node. " "``iter`` is the object to iterate over. ``ifs`` is a list of test " "expressions: each ``for`` clause can have multiple ``ifs``." msgstr "" -"綜合運算中的一個 ``for`` 子句。``target`` 是用於每個元素的參照 - 通常是 :" -"class:`Name` 或 :class:`Tuple` 節點。``iter`` 是要疊代的物件。``ifs`` 是測試" -"運算式的串列:每個 ``for`` 子句可以有多個 ``ifs``。" +"綜合運算中的一個 ``for`` 子句。``target`` 是用於每個元素的參照 - 通常" +"是 :class:`Name` 或 :class:`Tuple` 節點。``iter`` 是要疊代的物件。``ifs`` 是" +"測試運算式的串列:每個 ``for`` 子句可以有多個 ``ifs``。" -#: ../../library/ast.rst:786 +#: ../../library/ast.rst:843 msgid "" "``is_async`` indicates a comprehension is asynchronous (using an ``async " "for`` instead of ``for``). The value is an integer (0 or 1)." @@ -1427,7 +1541,7 @@ msgstr "" "``is_async`` 表示綜合運算式是非同步的(使用 ``async for`` 而不是 ``for`` )。" "該值為整數(0 或 1)。" -#: ../../library/ast.rst:789 +#: ../../library/ast.rst:846 msgid "" ">>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', " "mode='eval'),\n" @@ -1545,17 +1659,17 @@ msgstr "" " iter=Name(id='soc', ctx=Load()),\n" " is_async=1)]))" -#: ../../library/ast.rst:851 +#: ../../library/ast.rst:908 msgid "Statements" msgstr "陳述式" -#: ../../library/ast.rst:855 +#: ../../library/ast.rst:912 msgid "" "An assignment. ``targets`` is a list of nodes, and ``value`` is a single " "node." msgstr "一個賦值。``targets`` 是節點串列,``value`` 是單個節點。" -#: ../../library/ast.rst:857 +#: ../../library/ast.rst:914 msgid "" "Multiple nodes in ``targets`` represents assigning the same value to each. " "Unpacking is represented by putting a :class:`Tuple` or :class:`List` within " @@ -1564,13 +1678,13 @@ msgstr "" "``targets`` 中的多個節點表示為每個節點分配相同的值。解包是透過在 ``targets`` " "中放置一個 :class:`Tuple` 或 :class:`List` 來表示的。" -#: ../../library/ast.rst:863 ../../library/ast.rst:1158 -#: ../../library/ast.rst:1352 ../../library/ast.rst:1918 +#: ../../library/ast.rst:920 ../../library/ast.rst:1215 +#: ../../library/ast.rst:1409 ../../library/ast.rst:1975 msgid "" "``type_comment`` is an optional string with the type annotation as a comment." msgstr "``type_comment`` 是一個可選字串,其中的註解為型別註釋。" -#: ../../library/ast.rst:865 +#: ../../library/ast.rst:922 msgid "" ">>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment\n" "Module(\n" @@ -1614,31 +1728,32 @@ msgstr "" " ctx=Store())],\n" " value=Name(id='c', ctx=Load()))])" -#: ../../library/ast.rst:891 +#: ../../library/ast.rst:948 msgid "" "An assignment with a type annotation. ``target`` is a single node and can be " "a :class:`Name`, an :class:`Attribute` or a :class:`Subscript`. " -"``annotation`` is the annotation, such as a :class:`Constant` or :class:" -"`Name` node. ``value`` is a single optional node." +"``annotation`` is the annotation, such as a :class:`Constant` " +"or :class:`Name` node. ``value`` is a single optional node." msgstr "" -"帶有型別註釋的賦值。``target`` 是單個節點,可以是 :class:`Name`、:class:" -"`Attribute` 或 :class:`Subscript`。``annotation`` 是註釋,例如 :class:" -"`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節點。" +"帶有型別註釋的賦值。``target`` 是單個節點,可以" +"是 :class:`Name`、:class:`Attribute` 或 :class:`Subscript`。``annotation`` 是" +"註釋,例如 :class:`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節" +"點。" -#: ../../library/ast.rst:896 +#: ../../library/ast.rst:953 msgid "" "``simple`` is always either 0 (indicating a \"complex\" target) or 1 " -"(indicating a \"simple\" target). A \"simple\" target consists solely of a :" -"class:`Name` node that does not appear between parentheses; all other " -"targets are considered complex. Only simple targets appear in the :attr:" -"`~object.__annotations__` dictionary of modules and classes." +"(indicating a \"simple\" target). A \"simple\" target consists solely of " +"a :class:`Name` node that does not appear between parentheses; all other " +"targets are considered complex. Only simple targets appear in " +"the :attr:`~object.__annotations__` dictionary of modules and classes." msgstr "" "``simple`` 總會是 0(表示一個「複雜」目標)或 1(表示一個「簡單」目標)。一個" "「簡單」目標僅包含一個 :class:`Name` 節點,且不出現在括號之間;所有其他目標都" -"被視為是複雜的。只有簡單目標會出現在模組和類別的 :attr:`~object." -"__annotations__` 字典中。" +"被視為是複雜的。只有簡單目標會出現在模組和類別" +"的 :attr:`~object.__annotations__` 字典中。" -#: ../../library/ast.rst:902 +#: ../../library/ast.rst:959 msgid "" ">>> print(ast.dump(ast.parse('c: int'), indent=4))\n" "Module(\n" @@ -1722,7 +1837,7 @@ msgstr "" " annotation=Name(id='int', ctx=Load()),\n" " simple=0)])" -#: ../../library/ast.rst:946 +#: ../../library/ast.rst:1003 msgid "" "Augmented assignment, such as ``a += 1``. In the following example, " "``target`` is a :class:`Name` node for ``x`` (with the :class:`Store` " @@ -1730,18 +1845,18 @@ msgid "" "value for 1." msgstr "" "增加賦值 (augmented assignment),例如 ``a += 1``。在下面的範例中,``target`` " -"是 ``x`` 的 :class:`Name` 節點(帶有 :class:`Store` 情境),``op`` 是 :class:" -"`Add`,``value`` 是一個值為 1 的 :class:`Constant`。" +"是 ``x`` 的 :class:`Name` 節點(帶有 :class:`Store` 情境),``op`` " +"是 :class:`Add`,``value`` 是一個值為 1 的 :class:`Constant`。" -#: ../../library/ast.rst:951 +#: ../../library/ast.rst:1008 msgid "" "The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, " "unlike the targets of :class:`Assign`." msgstr "" -"與 :class:`Assign` 的目標不同,``target`` 屬性不能屬於 :class:`Tuple` 或 :" -"class:`List` 類別。" +"與 :class:`Assign` 的目標不同,``target`` 屬性不能屬於 :class:`Tuple` " +"或 :class:`List` 類別。" -#: ../../library/ast.rst:954 +#: ../../library/ast.rst:1011 msgid "" ">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" "Module(\n" @@ -1759,17 +1874,17 @@ msgstr "" " op=Add(),\n" " value=Constant(value=2))])" -#: ../../library/ast.rst:967 +#: ../../library/ast.rst:1024 msgid "" "A ``raise`` statement. ``exc`` is the exception object to be raised, " "normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone " "``raise``. ``cause`` is the optional part for ``y`` in ``raise x from y``." msgstr "" -"一個 ``raise`` 陳述式。``exc`` 是要引發的例外物件,通常是 :class:`Call` 或 :" -"class:`Name`,若是獨立的 ``raise`` 則為 ``None``。``cause`` 是 ``raise x " +"一個 ``raise`` 陳述式。``exc`` 是要引發的例外物件,通常是 :class:`Call` " +"或 :class:`Name`,若是獨立的 ``raise`` 則為 ``None``。``cause`` 是 ``raise x " "from y`` 中的可選部分 ``y``。" -#: ../../library/ast.rst:971 +#: ../../library/ast.rst:1028 msgid "" ">>> print(ast.dump(ast.parse('raise x from y'), indent=4))\n" "Module(\n" @@ -1785,7 +1900,7 @@ msgstr "" " exc=Name(id='x', ctx=Load()),\n" " cause=Name(id='y', ctx=Load()))])" -#: ../../library/ast.rst:983 +#: ../../library/ast.rst:1040 msgid "" "An assertion. ``test`` holds the condition, such as a :class:`Compare` node. " "``msg`` holds the failure message." @@ -1793,7 +1908,7 @@ msgstr "" "一個斷言 (assertion)。``test`` 保存條件,例如 :class:`Compare` 節點。``msg`` " "保存失敗訊息。" -#: ../../library/ast.rst:986 +#: ../../library/ast.rst:1043 msgid "" ">>> print(ast.dump(ast.parse('assert x,y'), indent=4))\n" "Module(\n" @@ -1809,15 +1924,15 @@ msgstr "" " test=Name(id='x', ctx=Load()),\n" " msg=Name(id='y', ctx=Load()))])" -#: ../../library/ast.rst:998 +#: ../../library/ast.rst:1055 msgid "" -"Represents a ``del`` statement. ``targets`` is a list of nodes, such as :" -"class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." +"Represents a ``del`` statement. ``targets`` is a list of nodes, such " +"as :class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." msgstr "" -"代表一個 ``del`` 陳述式。``targets`` 是節點串列,例如 :class:`Name`、:class:" -"`Attribute` 或 :class:`Subscript` 節點。" +"代表一個 ``del`` 陳述式。``targets`` 是節點串列,例" +"如 :class:`Name`、:class:`Attribute` 或 :class:`Subscript` 節點。" -#: ../../library/ast.rst:1001 +#: ../../library/ast.rst:1058 msgid "" ">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" "Module(\n" @@ -1837,11 +1952,11 @@ msgstr "" " Name(id='y', ctx=Del()),\n" " Name(id='z', ctx=Del())])])" -#: ../../library/ast.rst:1015 +#: ../../library/ast.rst:1072 msgid "A ``pass`` statement." msgstr "一個 ``pass`` 陳述式。" -#: ../../library/ast.rst:1017 +#: ../../library/ast.rst:1074 msgid "" ">>> print(ast.dump(ast.parse('pass'), indent=4))\n" "Module(\n" @@ -1853,18 +1968,18 @@ msgstr "" " body=[\n" " Pass()])" -#: ../../library/ast.rst:1027 +#: ../../library/ast.rst:1084 msgid "" "A :ref:`type alias ` created through the :keyword:`type` " -"statement. ``name`` is the name of the alias, ``type_params`` is a list of :" -"ref:`type parameters `, and ``value`` is the value of the " -"type alias." +"statement. ``name`` is the name of the alias, ``type_params`` is a list " +"of :ref:`type parameters `, and ``value`` is the value of " +"the type alias." msgstr "" "透過 :keyword:`type` 陳述式建立的\\ :ref:`型別別名 (type alias) `。``name`` 是別名的名稱、``type_params`` 是\\ :ref:`型別參數 (type " "parameter) ` 的串列、``value`` 是型別別名的值。" -#: ../../library/ast.rst:1032 +#: ../../library/ast.rst:1089 msgid "" ">>> print(ast.dump(ast.parse('type Alias = int'), indent=4))\n" "Module(\n" @@ -1880,21 +1995,21 @@ msgstr "" " name=Name(id='Alias', ctx=Store()),\n" " value=Name(id='int', ctx=Load()))])" -#: ../../library/ast.rst:1043 +#: ../../library/ast.rst:1100 msgid "" "Other statements which are only applicable inside functions or loops are " "described in other sections." msgstr "其他僅適用於函式或迴圈內部的陳述式將在其他部分中描述。" -#: ../../library/ast.rst:1047 +#: ../../library/ast.rst:1104 msgid "Imports" msgstr "引入 (imports)" -#: ../../library/ast.rst:1051 +#: ../../library/ast.rst:1108 msgid "An import statement. ``names`` is a list of :class:`alias` nodes." msgstr "一個 import 陳述式。``names`` 是 :class:`alias` 節點的串列。" -#: ../../library/ast.rst:1053 +#: ../../library/ast.rst:1110 msgid "" ">>> print(ast.dump(ast.parse('import x,y,z'), indent=4))\n" "Module(\n" @@ -1914,7 +2029,7 @@ msgstr "" " alias(name='y'),\n" " alias(name='z')])])" -#: ../../library/ast.rst:1067 +#: ../../library/ast.rst:1124 msgid "" "Represents ``from x import y``. ``module`` is a raw string of the 'from' " "name, without any leading dots, or ``None`` for statements such as ``from . " @@ -1925,7 +2040,7 @@ msgstr "" "點 (dot),或者對於諸如 ``from . import foo`` 之類的陳述式則為 ``None``。" "``level`` 是一個整數,保存相對引入的級別(0 表示絕對引入)。" -#: ../../library/ast.rst:1072 +#: ../../library/ast.rst:1129 msgid "" ">>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))\n" "Module(\n" @@ -1949,7 +2064,7 @@ msgstr "" " alias(name='z')],\n" " level=0)])" -#: ../../library/ast.rst:1088 +#: ../../library/ast.rst:1145 msgid "" "Both parameters are raw strings of the names. ``asname`` can be ``None`` if " "the regular name is to be used." @@ -1957,7 +2072,7 @@ msgstr "" "這兩個參數都是名稱的原始字串。如果要使用常規名稱,``asname`` 可以為 " "``None``。" -#: ../../library/ast.rst:1091 +#: ../../library/ast.rst:1148 msgid "" ">>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))\n" "Module(\n" @@ -1979,25 +2094,25 @@ msgstr "" " alias(name='c')],\n" " level=2)])" -#: ../../library/ast.rst:1104 +#: ../../library/ast.rst:1161 msgid "Control flow" msgstr "流程控制" -#: ../../library/ast.rst:1107 +#: ../../library/ast.rst:1164 msgid "" "Optional clauses such as ``else`` are stored as an empty list if they're not " "present." msgstr "諸如 ``else`` 之類的可選子句如果不存在,則將被儲存為空串列。" -#: ../../library/ast.rst:1112 +#: ../../library/ast.rst:1169 msgid "" -"An ``if`` statement. ``test`` holds a single node, such as a :class:" -"`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." +"An ``if`` statement. ``test`` holds a single node, such as " +"a :class:`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." msgstr "" "一個 ``if`` 陳述式。``test`` 保存單個節點,例如 :class:`Compare` 節點。" "``body`` 和 ``orelse`` 各自保存一個節點串列。" -#: ../../library/ast.rst:1115 +#: ../../library/ast.rst:1172 msgid "" "``elif`` clauses don't have a special representation in the AST, but rather " "appear as extra :class:`If` nodes within the ``orelse`` section of the " @@ -2006,7 +2121,7 @@ msgstr "" "``elif`` 子句在 AST 中沒有特殊表示,而是在前一個子句的 ``orelse`` 部分中作為" "額外的 :class:`If` 節點出現。" -#: ../../library/ast.rst:1119 +#: ../../library/ast.rst:1176 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... if x:\n" @@ -2058,22 +2173,22 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1149 +#: ../../library/ast.rst:1206 msgid "" "A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a " -"single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` or :" -"class:`Subscript` node. ``iter`` holds the item to be looped over, again as " -"a single node. ``body`` and ``orelse`` contain lists of nodes to execute. " +"single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` " +"or :class:`Subscript` node. ``iter`` holds the item to be looped over, again " +"as a single node. ``body`` and ``orelse`` contain lists of nodes to execute. " "Those in ``orelse`` are executed if the loop finishes normally, rather than " "via a ``break`` statement." msgstr "" -"一個 ``for`` 迴圈。 ``target`` 保存迴圈賦予的變數,為單個 :class:`Name`、:" -"class:`Tuple`、:class:`List`、:class:`Attribute` 或 :class:`Subscript` 節點。" -"``iter`` 保存要迴圈跑過的項目,也為單個節點。``body`` 和 ``orelse`` 包含要執" -"行的節點串列。如果迴圈正常完成,則執行 ``orelse`` 中的內容,而不是透過 " -"``break`` 陳述式執行。" +"一個 ``for`` 迴圈。 ``target`` 保存迴圈賦予的變數,為單" +"個 :class:`Name`、:class:`Tuple`、:class:`List`、:class:`Attribute` " +"或 :class:`Subscript` 節點。``iter`` 保存要迴圈跑過的項目,也為單個節點。" +"``body`` 和 ``orelse`` 包含要執行的節點串列。如果迴圈正常完成,則執行 " +"``orelse`` 中的內容,而不是透過 ``break`` 陳述式執行。" -#: ../../library/ast.rst:1160 +#: ../../library/ast.rst:1217 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... for x in y:\n" @@ -2111,13 +2226,13 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])" -#: ../../library/ast.rst:1183 +#: ../../library/ast.rst:1240 msgid "" "A ``while`` loop. ``test`` holds the condition, such as a :class:`Compare` " "node." msgstr "一個 ``while`` 迴圈。``test`` 保存條件,例如 :class:`Compare` 節點。" -#: ../../library/ast.rst:1186 +#: ../../library/ast.rst:1243 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" @@ -2153,11 +2268,11 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])" -#: ../../library/ast.rst:1209 +#: ../../library/ast.rst:1266 msgid "The ``break`` and ``continue`` statements." msgstr "``break`` 和 ``continue`` 陳述式。" -#: ../../library/ast.rst:1211 +#: ../../library/ast.rst:1268 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... for a in b:\n" @@ -2211,7 +2326,7 @@ msgstr "" " orelse=[\n" " Continue()])])])" -#: ../../library/ast.rst:1242 +#: ../../library/ast.rst:1299 msgid "" "``try`` blocks. All attributes are list of nodes to execute, except for " "``handlers``, which is a list of :class:`ExceptHandler` nodes." @@ -2219,7 +2334,7 @@ msgstr "" "``try`` 區塊。除 ``handlers`` 是 :class:`ExceptHandler` 節點的串列外,其他所" "有屬性都是要執行之節點的串列。" -#: ../../library/ast.rst:1245 +#: ../../library/ast.rst:1302 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2295,7 +2410,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])" -#: ../../library/ast.rst:1287 +#: ../../library/ast.rst:1344 msgid "" "``try`` blocks which are followed by ``except*`` clauses. The attributes are " "the same as for :class:`Try` but the :class:`ExceptHandler` nodes in " @@ -2305,7 +2420,7 @@ msgstr "" "``handlers`` 中的 :class:`ExceptHandler` 節點被直譯 (interpret) 為 " "``except*`` 區塊而不是 ``except``。" -#: ../../library/ast.rst:1291 +#: ../../library/ast.rst:1348 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2345,19 +2460,19 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1316 +#: ../../library/ast.rst:1373 msgid "" "A single ``except`` clause. ``type`` is the exception type it will match, " "typically a :class:`Name` node (or ``None`` for a catch-all ``except:`` " "clause). ``name`` is a raw string for the name to hold the exception, or " "``None`` if the clause doesn't have ``as foo``. ``body`` is a list of nodes." msgstr "" -"單個 ``except`` 子句。``type`` 是會被匹配的例外型別,通常是一個 :class:" -"`Name` 節點(或者 ``None`` 表示會捕捉到所有例外的 ``except:`` 子句)。" -"``name`` 是用於保存例外的名稱之原始字串,如果子句沒有 ``as foo`` ,則為 " -"``None``。``body`` 是節點串列。" +"單個 ``except`` 子句。``type`` 是會被匹配的例外型別,通常是一" +"個 :class:`Name` 節點(或者 ``None`` 表示會捕捉到所有例外的 ``except:`` 子" +"句)。``name`` 是用於保存例外的名稱之原始字串,如果子句沒有 ``as foo`` ,則" +"為 ``None``。``body`` 是節點串列。" -#: ../../library/ast.rst:1321 +#: ../../library/ast.rst:1378 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... try:\n" @@ -2401,7 +2516,7 @@ msgstr "" " body=[\n" " Pass()])])])" -#: ../../library/ast.rst:1347 +#: ../../library/ast.rst:1404 msgid "" "A ``with`` block. ``items`` is a list of :class:`withitem` nodes " "representing the context managers, and ``body`` is the indented block inside " @@ -2410,18 +2525,19 @@ msgstr "" "一個 ``with`` 區塊。``items`` 是表示情境管理器的 :class:`withitem` 節點串列," "``body`` 是情境內的縮進區塊。" -#: ../../library/ast.rst:1357 +#: ../../library/ast.rst:1414 msgid "" "A single context manager in a ``with`` block. ``context_expr`` is the " -"context manager, often a :class:`Call` node. ``optional_vars`` is a :class:" -"`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or ``None`` " -"if that isn't used." +"context manager, often a :class:`Call` node. ``optional_vars`` is " +"a :class:`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or " +"``None`` if that isn't used." msgstr "" -"``with`` 區塊中的單個情境管理器。``context_expr`` 是情境管理器,通常是一個 :" -"class:`Call` 節點。``Optional_vars`` 是 ``as foo`` 部分的 :class:`Name`、:" -"class:`Tuple` 或 :class:`List`,或者如果不使用則為 ``None`` 。" +"``with`` 區塊中的單個情境管理器。``context_expr`` 是情境管理器,通常是一" +"個 :class:`Call` 節點。``Optional_vars`` 是 ``as foo`` 部分" +"的 :class:`Name`、:class:`Tuple` 或 :class:`List`,或者如果不使用則為 " +"``None`` 。" -#: ../../library/ast.rst:1362 +#: ../../library/ast.rst:1419 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... with a as b, c as d:\n" @@ -2467,11 +2583,11 @@ msgstr "" " Name(id='b', ctx=Load()),\n" " Name(id='d', ctx=Load())]))])])" -#: ../../library/ast.rst:1388 +#: ../../library/ast.rst:1445 msgid "Pattern matching" msgstr "模式匹配 (pattern matching)" -#: ../../library/ast.rst:1393 +#: ../../library/ast.rst:1450 msgid "" "A ``match`` statement. ``subject`` holds the subject of the match (the " "object that is being matched against the cases) and ``cases`` contains an " @@ -2480,24 +2596,24 @@ msgstr "" "一個 ``match`` 陳述式。``subject`` 保存匹配的主題(與案例匹配的物件)," "``cases`` 包含具有不同案例的 :class:`match_case` 節點的可疊代物件。" -#: ../../library/ast.rst:1401 +#: ../../library/ast.rst:1458 msgid "" "A single case pattern in a ``match`` statement. ``pattern`` contains the " -"match pattern that the subject will be matched against. Note that the :class:" -"`AST` nodes produced for patterns differ from those produced for " +"match pattern that the subject will be matched against. Note that " +"the :class:`AST` nodes produced for patterns differ from those produced for " "expressions, even when they share the same syntax." msgstr "" "``match`` 陳述式中的單個案例模式。``pattern`` 包含主題將與之匹配的匹配模式。" "請注意,為模式生成的 :class:`AST` 節點與為運算式生成的節點不同,即使它們共享" "相同的語法。" -#: ../../library/ast.rst:1406 +#: ../../library/ast.rst:1463 msgid "" "The ``guard`` attribute contains an expression that will be evaluated if the " "pattern matches the subject." msgstr "``guard`` 屬性包含一個運算式,如果模式與主題匹配,則將對該運算式求值。" -#: ../../library/ast.rst:1409 +#: ../../library/ast.rst:1466 msgid "" "``body`` contains a list of nodes to execute if the pattern matches and the " "result of evaluating the guard expression is true." @@ -2505,7 +2621,7 @@ msgstr "" "``body`` 包含一個節點串列,如果模式匹配並且為防護運算式 (guard expression) 的" "求值 (evaluate) 結果為真,則會執行該節點串列。" -#: ../../library/ast.rst:1412 +#: ../../library/ast.rst:1469 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2571,7 +2687,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1450 +#: ../../library/ast.rst:1507 msgid "" "A match literal or value pattern that compares by equality. ``value`` is an " "expression node. Permitted value nodes are restricted as described in the " @@ -2581,7 +2697,7 @@ msgstr "" "以相等性進行比較的匹配文本或值的模式。``value`` 是一個運算式節點。允許值節點" "受到匹配陳述式文件中所述的限制。如果匹配主題等於求出值,則此模式成功。" -#: ../../library/ast.rst:1455 +#: ../../library/ast.rst:1512 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2617,7 +2733,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1478 +#: ../../library/ast.rst:1535 msgid "" "A match literal pattern that compares by identity. ``value`` is the " "singleton to be compared against: ``None``, ``True``, or ``False``. This " @@ -2627,7 +2743,7 @@ msgstr "" "``True`` 或 ``False`` 進行比較的單例 (singleton)。如果匹配主題是給定的常數," "則此模式成功。" -#: ../../library/ast.rst:1482 +#: ../../library/ast.rst:1539 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2661,7 +2777,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1504 +#: ../../library/ast.rst:1561 msgid "" "A match sequence pattern. ``patterns`` contains the patterns to be matched " "against the subject elements if the subject is a sequence. Matches a " @@ -2671,7 +2787,7 @@ msgstr "" "匹配序列模式。如果主題是一個序列,``patterns`` 包含與主題元素匹配的模式。如果" "子模式之一是 ``MatchStar`` 節點,則匹配可變長度序列,否則匹配固定長度序列。" -#: ../../library/ast.rst:1509 +#: ../../library/ast.rst:1566 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2715,7 +2831,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1536 +#: ../../library/ast.rst:1593 msgid "" "Matches the rest of the sequence in a variable length match sequence " "pattern. If ``name`` is not ``None``, a list containing the remaining " @@ -2725,7 +2841,7 @@ msgstr "" "以可變長度匹配序列模式匹配序列的其餘部分。如果 ``name`` 不是 ``None``,則如果" "整體序列模式成功,則包含其餘序列元素的串列將綁定到該名稱。" -#: ../../library/ast.rst:1540 +#: ../../library/ast.rst:1597 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2789,7 +2905,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1577 +#: ../../library/ast.rst:1634 msgid "" "A match mapping pattern. ``keys`` is a sequence of expression nodes. " "``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an " @@ -2801,7 +2917,7 @@ msgstr "" "列。``rest`` 是一個可選名稱,可以指定它來捕獲剩餘的對映元素。允許的鍵運算式受" "到匹配陳述式文件中所述的限制。" -#: ../../library/ast.rst:1583 +#: ../../library/ast.rst:1640 msgid "" "This pattern succeeds if the subject is a mapping, all evaluated key " "expressions are present in the mapping, and the value corresponding to each " @@ -2813,7 +2929,7 @@ msgstr "" "應的子模式匹配,則此模式成功。如果 ``rest`` 不是 ``None``,則如果整體對映模式" "成功,則包含其餘對映元素的字典將綁定到該名稱。" -#: ../../library/ast.rst:1589 +#: ../../library/ast.rst:1646 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2873,7 +2989,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1624 +#: ../../library/ast.rst:1681 msgid "" "A match class pattern. ``cls`` is an expression giving the nominal class to " "be matched. ``patterns`` is a sequence of pattern nodes to be matched " @@ -2888,7 +3004,7 @@ msgstr "" "``kwd_attrs`` 是要匹配的附加屬性序列(在類別模式中指定為關鍵字引數)," "``kwd_patterns`` 是相應的模式(在類別模式中指定為關鍵字的值)。" -#: ../../library/ast.rst:1631 +#: ../../library/ast.rst:1688 msgid "" "This pattern succeeds if the subject is an instance of the nominated class, " "all positional patterns match the corresponding class-defined attributes, " @@ -2897,7 +3013,7 @@ msgstr "" "如果主題是指定類別的實例,所有位置模式都與相應的類別定義屬性匹配,並且任何指" "定的關鍵字屬性與其相應模式匹配,則此模式成功。" -#: ../../library/ast.rst:1635 +#: ../../library/ast.rst:1692 msgid "" "Note: classes may define a property that returns self in order to match a " "pattern node against the instance being matched. Several builtin types are " @@ -2906,7 +3022,7 @@ msgstr "" "注意:類別可以定義一個回傳 self 的特性 (property),以便將模式節點與正在匹配的" "實例進行匹配。一些內建型別也以這種方式匹配,如同匹配陳述式文件中所述。" -#: ../../library/ast.rst:1639 +#: ../../library/ast.rst:1696 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2990,7 +3106,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1686 +#: ../../library/ast.rst:1743 msgid "" "A match \"as-pattern\", capture pattern or wildcard pattern. ``pattern`` " "contains the match pattern that the subject will be matched against. If the " @@ -3001,7 +3117,7 @@ msgstr "" "(wildcard pattern)。``pattern`` 包含主題將與之匹配的匹配模式。如果模式為 " "``None``,則該節點代表捕獲模式(即裸名 (bare name))並且始終會成功。" -#: ../../library/ast.rst:1691 +#: ../../library/ast.rst:1748 msgid "" "The ``name`` attribute contains the name that will be bound if the pattern " "is successful. If ``name`` is ``None``, ``pattern`` must also be ``None`` " @@ -3010,7 +3126,7 @@ msgstr "" "``name`` 屬性包含模式成功時將綁定的名稱。如果 ``name`` 為 ``None``,則 " "``pattern`` 也必須為 ``None``,並且節點代表通配模式。" -#: ../../library/ast.rst:1695 +#: ../../library/ast.rst:1752 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3066,7 +3182,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1728 +#: ../../library/ast.rst:1785 msgid "" "A match \"or-pattern\". An or-pattern matches each of its subpatterns in " "turn to the subject, until one succeeds. The or-pattern is then deemed to " @@ -3078,7 +3194,7 @@ msgstr "" "到成功為止,然後 or 模式就會被認為是成功的。如果沒有一個子模式成功,則 or 模" "式將失敗。 ``patterns`` 屬性包含將與主題進行匹配的匹配模式節點串列。" -#: ../../library/ast.rst:1734 +#: ../../library/ast.rst:1791 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3122,17 +3238,17 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1761 +#: ../../library/ast.rst:1818 msgid "Type annotations" msgstr "" -#: ../../library/ast.rst:1765 +#: ../../library/ast.rst:1822 msgid "" "A ``# type: ignore`` comment located at *lineno*. *tag* is the optional tag " "specified by the form ``# type: ignore ``." msgstr "" -#: ../../library/ast.rst:1768 +#: ../../library/ast.rst:1825 msgid "" ">>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), " "indent=4))\n" @@ -3178,37 +3294,37 @@ msgstr "" " type_ignores=[\n" " TypeIgnore(lineno=1, tag='[assignment]')])" -#: ../../library/ast.rst:1791 +#: ../../library/ast.rst:1848 msgid "" ":class:`!TypeIgnore` nodes are not generated when the *type_comments* " "parameter is set to ``False`` (default). See :func:`ast.parse` for more " "details." msgstr "" -#: ../../library/ast.rst:1799 +#: ../../library/ast.rst:1856 msgid "Type parameters" msgstr "型別參數 (type parameters)" -#: ../../library/ast.rst:1801 +#: ../../library/ast.rst:1858 msgid "" ":ref:`Type parameters ` can exist on classes, functions, and " "type aliases." msgstr ":ref:`型別參數 `\\ 可以存在於類別、函式和型別別名上。" -#: ../../library/ast.rst:1806 +#: ../../library/ast.rst:1863 msgid "" "A :class:`typing.TypeVar`. ``name`` is the name of the type variable. " -"``bound`` is the bound or constraints, if any. If ``bound`` is a :class:" -"`Tuple`, it represents constraints; otherwise it represents the bound. " -"``default_value`` is the default value; if the :class:`!TypeVar` has no " -"default, this attribute will be set to ``None``." +"``bound`` is the bound or constraints, if any. If ``bound`` is " +"a :class:`Tuple`, it represents constraints; otherwise it represents the " +"bound. ``default_value`` is the default value; if the :class:`!TypeVar` has " +"no default, this attribute will be set to ``None``." msgstr "" "一個 :class:`typing.TypeVar`。``name`` 是型別變數的名稱。``bound`` 是(如果有" -"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一個 :class:" -"`Tuple`,它代表約束;否則它代表界限。``default_value`` 為預設值;如果 :class:" -"`!TypeVar` 沒有預設值,那此屬性會被設為 ``None``。" +"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一" +"個 :class:`Tuple`,它代表約束;否則它代表界限。``default_value`` 為預設值;如" +"果 :class:`!TypeVar` 沒有預設值,那此屬性會被設為 ``None``。" -#: ../../library/ast.rst:1812 +#: ../../library/ast.rst:1869 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), " "indent=4))\n" @@ -3242,12 +3358,12 @@ msgstr "" " slice=Name(id='T', ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1831 ../../library/ast.rst:1866 -#: ../../library/ast.rst:1898 +#: ../../library/ast.rst:1888 ../../library/ast.rst:1923 +#: ../../library/ast.rst:1955 msgid "Added the *default_value* parameter." msgstr "新增 *default_value* 參數。" -#: ../../library/ast.rst:1836 +#: ../../library/ast.rst:1893 msgid "" "A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " "specification. ``default_value`` is the default value; if the :class:`!" @@ -3256,7 +3372,7 @@ msgstr "" "一個 :class:`typing.ParamSpec`。``name`` 是參數規範的名稱。``default_value`` " "是預設值;如果 :class:`!ParamSpec` 沒有預設值,則該屬性將設定為 ``None``。" -#: ../../library/ast.rst:1840 +#: ../../library/ast.rst:1897 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, " "int]\"), indent=4))\n" @@ -3304,7 +3420,7 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1871 +#: ../../library/ast.rst:1928 msgid "" "A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " "tuple. ``default_value`` is the default value; if the :class:`!TypeVarTuple` " @@ -3314,7 +3430,7 @@ msgstr "" "``default_value`` 為預設值;如果 :class:`!TypeVarTuple` 沒有預設值,那此屬性" "會被設為 ``None``。" -#: ../../library/ast.rst:1875 +#: ../../library/ast.rst:1932 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), " "indent=4))\n" @@ -3356,27 +3472,27 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1902 +#: ../../library/ast.rst:1959 msgid "Function and class definitions" msgstr "函式和類別定義" -#: ../../library/ast.rst:1906 +#: ../../library/ast.rst:1963 msgid "A function definition." msgstr "一個函式定義。" -#: ../../library/ast.rst:1908 +#: ../../library/ast.rst:1965 msgid "``name`` is a raw string of the function name." msgstr "``name`` 是函式名稱的原始字串。" -#: ../../library/ast.rst:1909 +#: ../../library/ast.rst:1966 msgid "``args`` is an :class:`arguments` node." msgstr "``args`` 是一個 :class:`arguments` 節點。" -#: ../../library/ast.rst:1910 +#: ../../library/ast.rst:1967 msgid "``body`` is the list of nodes inside the function." msgstr "``body`` 是函式內節點的串列。" -#: ../../library/ast.rst:1911 +#: ../../library/ast.rst:1968 msgid "" "``decorator_list`` is the list of decorators to be applied, stored outermost " "first (i.e. the first in the list will be applied last)." @@ -3384,20 +3500,20 @@ msgstr "" "``decorator_list`` 是要應用的裝飾器串列,在最外層者會被儲存在首位(即串列中首" "位將會是最後一個被應用的那個)。" -#: ../../library/ast.rst:1913 +#: ../../library/ast.rst:1970 msgid "``returns`` is the return annotation." msgstr "``returns`` 是回傳註釋。" -#: ../../library/ast.rst:1914 ../../library/ast.rst:2077 +#: ../../library/ast.rst:1971 ../../library/ast.rst:2134 msgid "``type_params`` is a list of :ref:`type parameters `." msgstr "``type_params`` 是\\ :ref:`型別參數 `\\ 的串列。" -#: ../../library/ast.rst:1920 ../../library/ast.rst:2104 -#: ../../library/ast.rst:2115 +#: ../../library/ast.rst:1977 ../../library/ast.rst:2161 +#: ../../library/ast.rst:2172 msgid "Added ``type_params``." msgstr "新增了 ``type_params``。" -#: ../../library/ast.rst:1926 +#: ../../library/ast.rst:1983 msgid "" "``lambda`` is a minimal function definition that can be used inside an " "expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." @@ -3405,7 +3521,7 @@ msgstr "" "``lambda`` 是可以在運算式內使用的最小函式定義。與 :class:`FunctionDef` 不同," "``body`` 保存單個節點。" -#: ../../library/ast.rst:1929 +#: ../../library/ast.rst:1986 msgid "" ">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" "Module(\n" @@ -3429,17 +3545,17 @@ msgstr "" " arg(arg='y')]),\n" " body=Constant(value=Ellipsis)))])" -#: ../../library/ast.rst:1945 +#: ../../library/ast.rst:2002 msgid "The arguments for a function." msgstr "函式的引數。" -#: ../../library/ast.rst:1947 +#: ../../library/ast.rst:2004 msgid "" "``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." msgstr "" "``posonlyargs``、``args`` 和 ``kwonlyargs`` 是 :class:`arg` 節點的串列。" -#: ../../library/ast.rst:1948 +#: ../../library/ast.rst:2005 msgid "" "``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the " "``*args, **kwargs`` parameters." @@ -3447,7 +3563,7 @@ msgstr "" "``vararg`` 和 ``kwarg`` 是單個 :class:`arg` 節點,指的是 ``*args, **kwargs`` " "參數。" -#: ../../library/ast.rst:1950 +#: ../../library/ast.rst:2007 msgid "" "``kw_defaults`` is a list of default values for keyword-only arguments. If " "one is ``None``, the corresponding argument is required." @@ -3455,7 +3571,7 @@ msgstr "" "``kw_defaults`` 是僅限關鍵字引數的預設值串列。如果其中某個為 ``None``,則相應" "參數就會是必要的。" -#: ../../library/ast.rst:1952 +#: ../../library/ast.rst:2009 msgid "" "``defaults`` is a list of default values for arguments that can be passed " "positionally. If there are fewer defaults, they correspond to the last n " @@ -3464,7 +3580,7 @@ msgstr "" "``defaults`` 是可以按位置傳遞的引數的預設值串列。如果預設值較少,則它們對應於" "最後 n 個引數。" -#: ../../library/ast.rst:1959 +#: ../../library/ast.rst:2016 msgid "" "A single argument in a list. ``arg`` is a raw string of the argument name; " "``annotation`` is its annotation, such as a :class:`Name` node." @@ -3472,12 +3588,12 @@ msgstr "" "串列中的單個引數。``arg`` 是引數名稱的原始字串,``annotation`` 是它的註釋,例" "如 :class:`Name` 節點。" -#: ../../library/ast.rst:1964 +#: ../../library/ast.rst:2021 msgid "" "``type_comment`` is an optional string with the type annotation as a comment" msgstr "``type_comment`` 是一個可選字串,其註解為型別註釋" -#: ../../library/ast.rst:1966 +#: ../../library/ast.rst:2023 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3551,11 +3667,11 @@ msgstr "" " Name(id='decorator2', ctx=Load())],\n" " returns=Constant(value='return annotation'))])" -#: ../../library/ast.rst:2006 +#: ../../library/ast.rst:2063 msgid "A ``return`` statement." msgstr "一個 ``return`` 陳述式。" -#: ../../library/ast.rst:2008 +#: ../../library/ast.rst:2065 msgid "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" @@ -3569,7 +3685,7 @@ msgstr "" " Return(\n" " value=Constant(value=4))])" -#: ../../library/ast.rst:2020 +#: ../../library/ast.rst:2077 msgid "" "A ``yield`` or ``yield from`` expression. Because these are expressions, " "they must be wrapped in an :class:`Expr` node if the value sent back is not " @@ -3578,7 +3694,7 @@ msgstr "" "一個 ``yield`` 或 ``yield from`` 運算式。因為這些是運算式,所以如果不使用發送" "回來的值,則必須將它們包裝在 :class:`Expr` 節點中。" -#: ../../library/ast.rst:2023 +#: ../../library/ast.rst:2080 msgid "" ">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" "Module(\n" @@ -3608,12 +3724,12 @@ msgstr "" " value=YieldFrom(\n" " value=Name(id='x', ctx=Load())))])" -#: ../../library/ast.rst:2043 +#: ../../library/ast.rst:2100 msgid "" "``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." msgstr "``global`` 和 ``nonlocal`` 陳述式。``names`` 是原始字串的串列。" -#: ../../library/ast.rst:2045 +#: ../../library/ast.rst:2102 msgid "" ">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" "Module(\n" @@ -3651,38 +3767,38 @@ msgstr "" " 'y',\n" " 'z'])])" -#: ../../library/ast.rst:2068 +#: ../../library/ast.rst:2125 msgid "A class definition." msgstr "一個類別定義。" -#: ../../library/ast.rst:2070 +#: ../../library/ast.rst:2127 msgid "``name`` is a raw string for the class name" msgstr "``name`` 是類別名稱的原始字串" -#: ../../library/ast.rst:2071 +#: ../../library/ast.rst:2128 msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "``bases`` 是被顯式指定的基底類別節點串列。" -#: ../../library/ast.rst:2072 +#: ../../library/ast.rst:2129 msgid "" "``keywords`` is a list of :class:`.keyword` nodes, principally for " -"'metaclass'. Other keywords will be passed to the metaclass, as per :pep:" -"`3115`." +"'metaclass'. Other keywords will be passed to the metaclass, as " +"per :pep:`3115`." msgstr "" "``keywords`` 是一個 :class:`.keyword` 節點的串列,主要用於 'metaclass'(元類" "別)。如 :pep:`3115` 所述,其他關鍵字將被傳遞到 metaclass。" -#: ../../library/ast.rst:2074 +#: ../../library/ast.rst:2131 msgid "" "``body`` is a list of nodes representing the code within the class " "definition." msgstr "``body`` 是表示類別定義中程式碼的節點串列。" -#: ../../library/ast.rst:2076 +#: ../../library/ast.rst:2133 msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "``decorator_list`` 是一個節點串列,如 :class:`FunctionDef` 中所示。" -#: ../../library/ast.rst:2079 +#: ../../library/ast.rst:2136 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3730,25 +3846,25 @@ msgstr "" " Name(id='decorator1', ctx=Load()),\n" " Name(id='decorator2', ctx=Load())])])" -#: ../../library/ast.rst:2108 +#: ../../library/ast.rst:2165 msgid "Async and await" msgstr "async 和 await" -#: ../../library/ast.rst:2112 +#: ../../library/ast.rst:2169 msgid "" -"An ``async def`` function definition. Has the same fields as :class:" -"`FunctionDef`." +"An ``async def`` function definition. Has the same fields " +"as :class:`FunctionDef`." msgstr "一個 ``async def`` 函式定義。與 :class:`FunctionDef` 具有相同的欄位。" -#: ../../library/ast.rst:2121 +#: ../../library/ast.rst:2178 msgid "" "An ``await`` expression. ``value`` is what it waits for. Only valid in the " "body of an :class:`AsyncFunctionDef`." msgstr "" -"一個 ``await`` 運算式。``value`` 是它等待的東西。僅在 :class:" -"`AsyncFunctionDef` 主體 (body) 中有效。" +"一個 ``await`` 運算式。``value`` 是它等待的東西。僅" +"在 :class:`AsyncFunctionDef` 主體 (body) 中有效。" -#: ../../library/ast.rst:2124 +#: ../../library/ast.rst:2181 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -3780,7 +3896,7 @@ msgstr "" " value=Call(\n" " func=Name(id='other_func', ctx=Load()))))])])" -#: ../../library/ast.rst:2145 +#: ../../library/ast.rst:2202 msgid "" "``async for`` loops and ``async with`` context managers. They have the same " "fields as :class:`For` and :class:`With`, respectively. Only valid in the " @@ -3789,24 +3905,26 @@ msgstr "" "``async for`` 迴圈和 ``async with`` 情境管理器。它們分別具有與 :class:`For` " "和 :class:`With` 相同的欄位。僅在 :class:`AsyncFunctionDef` 主體中有效。" -#: ../../library/ast.rst:2150 +#: ../../library/ast.rst:2207 +#, fuzzy msgid "" -"When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :" -"class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast." -"boolop` and :class:`ast.expr_context`) on the returned tree will be " -"singletons. Changes to one will be reflected in all other occurrences of the " -"same value (e.g. :class:`ast.Add`)." +"When a string is parsed by :func:`ast.parse`, operator nodes (subclasses " +"of :class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast.boolop` " +"and :class:`ast.expr_context`) on the returned tree will be singletons. " +"Changes to one will be reflected in all other occurrences of the same value " +"(for example, :class:`ast.Add`)." msgstr "" -"當字串被 :func:`ast.parse` 剖析時,回傳樹的運算子節點(\\ :class:`ast." -"operator`、:class:`ast.unaryop`、:class:`ast.cmpop`、:class: :class:`ast." -"boolop` 和 :class:`ast.expr_context`\\ )將是單例。對其中之一的更改將反映在所" -"有其他出現的相同值中(例如 :class:`ast.Add`\\ )。" +"當字串被 :func:`ast.parse` 剖析時,回傳樹的運算子節點" +"(\\ :class:`ast.operator`、:class:`ast.unaryop`、:class:`ast.cmpop`、:class: :class:`ast.boolop` " +"和 :class:`ast.expr_context`\\ )將是單例。對其中之一的更改將反映在所有其他出" +"現的相同值中(例如 :class:`ast.Add`\\ )。" -#: ../../library/ast.rst:2158 -msgid ":mod:`ast` Helpers" +#: ../../library/ast.rst:2215 +#, fuzzy +msgid ":mod:`ast` helpers" msgstr ":mod:`ast` 輔助程式" -#: ../../library/ast.rst:2160 +#: ../../library/ast.rst:2217 msgid "" "Apart from the node classes, the :mod:`ast` module defines these utility " "functions and classes for traversing abstract syntax trees:" @@ -3814,37 +3932,37 @@ msgstr "" "除了節點類別之外,:mod:`ast` 模組還定義了這些用於遍歷 (traverse) 抽象語法樹的" "實用函式和類別:" -#: ../../library/ast.rst:2165 +#: ../../library/ast.rst:2222 msgid "" "Parse the source into an AST node. Equivalent to ``compile(source, " "filename, mode, flags=FLAGS_VALUE, optimize=optimize)``, where " -"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and ``ast." -"PyCF_OPTIMIZED_AST`` otherwise." +"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and " +"``ast.PyCF_OPTIMIZED_AST`` otherwise." msgstr "" "將原始碼剖析為 AST 節點,相當於 ``compile(source, filename, mode, " "flags=FLAGS_VALUE, optimize=optimize)``,其中 ``FLAGS_VALUE`` 在 ``optimize " "<= 0`` 時為 ``ast.PyCF_ONLY_AST``,否則為 ``ast.PyCF_OPTIMIZED_AST``。" -#: ../../library/ast.rst:2170 +#: ../../library/ast.rst:2227 msgid "" "If ``type_comments=True`` is given, the parser is modified to check and " "return type comments as specified by :pep:`484` and :pep:`526`. This is " -"equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed to :" -"func:`compile`. This will report syntax errors for misplaced type " +"equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed " +"to :func:`compile`. This will report syntax errors for misplaced type " "comments. Without this flag, type comments will be ignored, and the " "``type_comment`` field on selected AST nodes will always be ``None``. In " "addition, the locations of ``# type: ignore`` comments will be returned as " "the ``type_ignores`` attribute of :class:`Module` (otherwise it is always an " "empty list)." msgstr "" -"如果給定 ``type_comments=True``,剖析器將被修改為檢查並回傳 :pep:`484` 和 :" -"pep:`526` 指定的型別註釋。這相當於將 :data:`ast.PyCF_TYPE_COMMENTS` 新增到傳" -"遞給 :func:`compile` 的旗標中。這將報告錯誤型別註釋的語法錯誤。如果沒有此旗" -"標,型別註釋將被忽略,並且所選 AST 節點上的 ``type_comment`` 欄位將始終為 " +"如果給定 ``type_comments=True``,剖析器將被修改為檢查並回傳 :pep:`484` " +"和 :pep:`526` 指定的型別註釋。這相當於將 :data:`ast.PyCF_TYPE_COMMENTS` 新增" +"到傳遞給 :func:`compile` 的旗標中。這將報告錯誤型別註釋的語法錯誤。如果沒有此" +"旗標,型別註釋將被忽略,並且所選 AST 節點上的 ``type_comment`` 欄位將始終為 " "``None``。此外,``# type: ignore`` 註釋的位置將作為 :class:`Module` 的 " "``type_ignores`` 屬性回傳(否則它始終是一個空串列)。" -#: ../../library/ast.rst:2180 +#: ../../library/ast.rst:2237 msgid "" "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to " "correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> " @@ -3854,7 +3972,7 @@ msgstr "" "名型別註解 (signature type comments)」而被修改,例如 ``(str, int) -> " "List[str]``。" -#: ../../library/ast.rst:2184 +#: ../../library/ast.rst:2241 msgid "" "Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a " "\"best-effort\" attempt to parse using that Python version's grammar. For " @@ -3874,12 +3992,12 @@ msgstr "" "能保證剖析(或剖析的成功)與在與 ``feature_version`` 對應的 Python 版本上運行" "時相同。" -#: ../../library/ast.rst:2194 +#: ../../library/ast.rst:2251 msgid "" "If source contains a null character (``\\0``), :exc:`ValueError` is raised." msgstr "如果來源包含 null 字元 (``\\0``),則會引發 :exc:`ValueError`。" -#: ../../library/ast.rst:2197 +#: ../../library/ast.rst:2254 msgid "" "Note that successfully parsing source code into an AST object doesn't " "guarantee that the source code provided is valid Python code that can be " @@ -3893,14 +4011,14 @@ msgstr "" "原始的 ``return 42`` 為 return 陳述式生成一個有效的 AST 節點,但它不能單獨編" "譯(它需要位於函式節點內)。" -#: ../../library/ast.rst:2204 +#: ../../library/ast.rst:2261 msgid "" "In particular, :func:`ast.parse` won't do any scoping checks, which the " "compilation step does." msgstr "" "特別是 :func:`ast.parse` 不會執行任何範圍檢查,而編譯步驟才會執行此操作。" -#: ../../library/ast.rst:2208 +#: ../../library/ast.rst:2265 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string due to stack depth limitations in Python's AST compiler." @@ -3908,11 +4026,11 @@ msgstr "" "由於 Python AST 編譯器中的堆疊 (stack) 深度限制,太大或太複雜的字串可能會導" "致 Python 直譯器崩潰。" -#: ../../library/ast.rst:2212 +#: ../../library/ast.rst:2269 msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "新增 ``type_comments``、``mode='func_type'`` 與 ``feature_version``。" -#: ../../library/ast.rst:2215 +#: ../../library/ast.rst:2272 msgid "" "The minimum supported version for ``feature_version`` is now ``(3, 7)``. The " "``optimize`` argument was added." @@ -3920,16 +4038,16 @@ msgstr "" "``feature_version`` 的最低支援版本現在是 ``(3, 7)``。新增了 ``optimize`` 引" "數。" -#: ../../library/ast.rst:2222 +#: ../../library/ast.rst:2279 msgid "" "Unparse an :class:`ast.AST` object and generate a string with code that " -"would produce an equivalent :class:`ast.AST` object if parsed back with :" -"func:`ast.parse`." +"would produce an equivalent :class:`ast.AST` object if parsed back " +"with :func:`ast.parse`." msgstr "" -"反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使用 :func:`ast." -"parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" +"反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使" +"用 :func:`ast.parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" -#: ../../library/ast.rst:2227 +#: ../../library/ast.rst:2284 msgid "" "The produced code string will not necessarily be equal to the original code " "that generated the :class:`ast.AST` object (without any compiler " @@ -3938,13 +4056,13 @@ msgstr "" "生成的程式碼字串不一定等於生成 :class:`ast.AST` 物件的原始程式碼(沒有任何編" "譯器最佳化,例如常數元組/凍結集合)。" -#: ../../library/ast.rst:2232 +#: ../../library/ast.rst:2289 msgid "" -"Trying to unparse a highly complex expression would result with :exc:" -"`RecursionError`." +"Trying to unparse a highly complex expression would result " +"with :exc:`RecursionError`." msgstr "嘗試剖析高度複雜的運算式會導致 :exc:`RecursionError`。" -#: ../../library/ast.rst:2240 +#: ../../library/ast.rst:2297 msgid "" "Evaluate an expression node or a string containing only a Python literal or " "container display. The string or node provided may only consist of the " @@ -3955,7 +4073,7 @@ msgstr "" "能包含以下 Python 文本結構:字串、位元組、數字、元組、串列、字典、集合、布林" "值、``None`` 和 ``Ellipsis``。" -#: ../../library/ast.rst:2245 +#: ../../library/ast.rst:2302 msgid "" "This can be used for evaluating strings containing Python values without the " "need to parse the values oneself. It is not capable of evaluating " @@ -3964,7 +4082,7 @@ msgstr "" "這可用於為包含 Python 值的字串求值,而無需自己剖析這些值。它無法計算任意複雜" "的運算式,例如涉及運算子或索引。" -#: ../../library/ast.rst:2250 +#: ../../library/ast.rst:2307 msgid "" "This function had been documented as \"safe\" in the past without defining " "what that meant. That was misleading. This is specifically designed not to " @@ -3981,60 +4099,62 @@ msgstr "" "盡或 C 堆疊耗盡,從而導致行程崩潰。某些輸入也可能會出現 CPU 消耗過多而導致拒" "絕服務的情況。因此不建議在不受信任的資料上呼叫它。" -#: ../../library/ast.rst:2260 +#: ../../library/ast.rst:2317 msgid "" "It is possible to crash the Python interpreter due to stack depth " "limitations in Python's AST compiler." msgstr "由於 Python AST 編譯器的堆疊深度限制,Python 直譯器可能會崩潰。" -#: ../../library/ast.rst:2263 +#: ../../library/ast.rst:2320 msgid "" -"It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:" -"`MemoryError` and :exc:`RecursionError` depending on the malformed input." +"It can " +"raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:`MemoryError` " +"and :exc:`RecursionError` depending on the malformed input." msgstr "" -"它可能會引發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:" -"`MemoryError` 和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" +"它可能會引" +"發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:`MemoryError` " +"和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" -#: ../../library/ast.rst:2267 +#: ../../library/ast.rst:2324 msgid "Now allows bytes and set literals." msgstr "現在允許位元組和集合文本 (set literal)。" -#: ../../library/ast.rst:2270 +#: ../../library/ast.rst:2327 msgid "Now supports creating empty sets with ``'set()'``." msgstr "現在支援使用 ``'set()'`` 建立空集合。" -#: ../../library/ast.rst:2273 +#: ../../library/ast.rst:2330 msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "對於字串輸入,前導空格和定位字元 (tab) 現在已被去除。" -#: ../../library/ast.rst:2279 +#: ../../library/ast.rst:2336 msgid "" -"Return the docstring of the given *node* (which must be a :class:" -"`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:" -"`Module` node), or ``None`` if it has no docstring. If *clean* is true, " -"clean up the docstring's indentation with :func:`inspect.cleandoc`." +"Return the docstring of the given *node* (which must be " +"a :class:`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, " +"or :class:`Module` node), or ``None`` if it has no docstring. If *clean* is " +"true, clean up the docstring's indentation with :func:`inspect.cleandoc`." msgstr "" -"回傳給定 *node* 的文件字串 (docstring)(必須是 :class:`FunctionDef`、:class:" -"`AsyncFunctionDef`、:class:`ClassDef` 或 :class:`Module` 節點)或如果它沒有文" -"件字串則為 ``None``。如果 *clean* 為 true,則使用 :func:`inspect.cleandoc` 清" -"理文件字串的縮排。" +"回傳給定 *node* 的文件字串 (docstring)(必須" +"是 :class:`FunctionDef`、:class:`AsyncFunctionDef`、:class:`ClassDef` " +"或 :class:`Module` 節點)或如果它沒有文件字串則為 ``None``。如果 *clean* 為 " +"true,則使用 :func:`inspect.cleandoc` 清理文件字串的縮排。" -#: ../../library/ast.rst:2285 +#: ../../library/ast.rst:2342 msgid ":class:`AsyncFunctionDef` is now supported." msgstr "目前已支援 :class:`AsyncFunctionDef`。" -#: ../../library/ast.rst:2291 +#: ../../library/ast.rst:2348 msgid "" "Get source code segment of the *source* that generated *node*. If some " -"location information (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :" -"attr:`~ast.AST.col_offset`, or :attr:`~ast.AST.end_col_offset`) is missing, " -"return ``None``." +"location information " +"(:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :attr:`~ast.AST.col_offset`, " +"or :attr:`~ast.AST.end_col_offset`) is missing, return ``None``." msgstr "" -"取得生成 *node* 的 *source* 的原始碼片段。如果某些位置資訊(:attr:`~ast.AST." -"lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` 或 :attr:" -"`~ast.AST.end_col_offset`\\ )遺漏,則回傳 ``None``。" +"取得生成 *node* 的 *source* 的原始碼片段。如果某些位置資訊" +"(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` " +"或 :attr:`~ast.AST.end_col_offset`\\ )遺漏,則回傳 ``None``。" -#: ../../library/ast.rst:2295 +#: ../../library/ast.rst:2352 msgid "" "If *padded* is ``True``, the first line of a multi-line statement will be " "padded with spaces to match its original position." @@ -4042,21 +4162,22 @@ msgstr "" "如果 *padded* 為 ``True``,則多列陳述式的第一列將用空格填充 (padded) 以匹配其" "原始位置。" -#: ../../library/ast.rst:2303 +#: ../../library/ast.rst:2360 msgid "" -"When you compile a node tree with :func:`compile`, the compiler expects :" -"attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes for every " -"node that supports them. This is rather tedious to fill in for generated " -"nodes, so this helper adds these attributes recursively where not already " -"set, by setting them to the values of the parent node. It works recursively " -"starting at *node*." +"When you compile a node tree with :func:`compile`, the compiler " +"expects :attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes " +"for every node that supports them. This is rather tedious to fill in for " +"generated nodes, so this helper adds these attributes recursively where not " +"already set, by setting them to the values of the parent node. It works " +"recursively starting at *node*." msgstr "" -"當你使用 :func:`compile` 編譯節點樹時,對於每個有支援 :attr:`~ast.AST." -"lineno` 和 :attr:`~ast.AST.col_offset` 屬性之節點,編譯器預期他們的這些屬性都" -"要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些屬性設定為父節點的" -"值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞迴地作用。" +"當你使用 :func:`compile` 編譯節點樹時,對於每個有支" +"援 :attr:`~ast.AST.lineno` 和 :attr:`~ast.AST.col_offset` 屬性之節點,編譯器" +"預期他們的這些屬性都要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些" +"屬性設定為父節點的值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞" +"迴地作用。" -#: ../../library/ast.rst:2312 +#: ../../library/ast.rst:2369 msgid "" "Increment the line number and end line number of each node in the tree " "starting at *node* by *n*. This is useful to \"move code\" to a different " @@ -4065,17 +4186,19 @@ msgstr "" "將樹中從 *node* 開始的每個節點的列號和結束列號增加 *n*。這對於「移動程式碼」" "到檔案中的不同位置很有用。" -#: ../../library/ast.rst:2319 +#: ../../library/ast.rst:2376 msgid "" -"Copy source location (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :" -"attr:`~ast.AST.end_lineno`, and :attr:`~ast.AST.end_col_offset`) from " -"*old_node* to *new_node* if possible, and return *new_node*." +"Copy source location " +"(:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :attr:`~ast.AST.end_lineno`, " +"and :attr:`~ast.AST.end_col_offset`) from *old_node* to *new_node* if " +"possible, and return *new_node*." msgstr "" -"如果可行,將原始位置(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.col_offset`、:" -"attr:`~ast.AST.end_lineno` 和 :attr:`~ast.AST.end_col_offset` )從 " -"*old_node* 複製到 *new_node*,並回傳 *new_node* 。" +"如果可行,將原始位置" +"(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.col_offset`、:attr:`~ast.AST.end_lineno` " +"和 :attr:`~ast.AST.end_col_offset` )從 *old_node* 複製到 *new_node*,並回傳 " +"*new_node* 。" -#: ../../library/ast.rst:2326 +#: ../../library/ast.rst:2383 msgid "" "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` " "that is present on *node*." @@ -4083,7 +4206,7 @@ msgstr "" "為 *node* 上存在的 ``node._fields`` 中的每個欄位生成一個 ``(fieldname, " "value)`` 元組。" -#: ../../library/ast.rst:2332 +#: ../../library/ast.rst:2389 msgid "" "Yield all direct child nodes of *node*, that is, all fields that are nodes " "and all items of fields that are lists of nodes." @@ -4091,7 +4214,7 @@ msgstr "" "生成 *node* 的所有直接子節點,即作為節點的所有欄位以及作為節點串列欄位的所有" "項目。" -#: ../../library/ast.rst:2338 +#: ../../library/ast.rst:2395 msgid "" "Recursively yield all descendant nodes in the tree starting at *node* " "(including *node* itself), in no specified order. This is useful if you " @@ -4100,7 +4223,7 @@ msgstr "" "遞迴地生成樹中從 *node* 開始的所有後代節點(包括 *node* 本身),不按指定順" "序。如果你只想就地修改節點而不關心情境,這非常有用。" -#: ../../library/ast.rst:2345 +#: ../../library/ast.rst:2402 msgid "" "A node visitor base class that walks the abstract syntax tree and calls a " "visitor function for every node found. This function may return a value " @@ -4109,27 +4232,27 @@ msgstr "" "節點瀏覽者基底類別,它遍歷抽象語法樹並為找到的每個節點呼叫瀏覽者函式。該函式" "可能會回傳一個由 :meth:`visit` 方法轉發的值。" -#: ../../library/ast.rst:2349 +#: ../../library/ast.rst:2406 msgid "" "This class is meant to be subclassed, with the subclass adding visitor " "methods." msgstr "這個類別應該被子類別化,子類別新增瀏覽者方法。" -#: ../../library/ast.rst:2354 +#: ../../library/ast.rst:2411 msgid "" -"Visit a node. The default implementation calls the method called :samp:" -"`self.visit_{classname}` where *classname* is the name of the node class, " -"or :meth:`generic_visit` if that method doesn't exist." +"Visit a node. The default implementation calls the method " +"called :samp:`self.visit_{classname}` where *classname* is the name of the " +"node class, or :meth:`generic_visit` if that method doesn't exist." msgstr "" "瀏覽一個節點。預設實作呼叫名為 :samp:`self.visit_{classname}` 的方法,其中 " -"*classname* 是節點類別的名稱,或者在該方法不存在時呼叫 :meth:" -"`generic_visit`。" +"*classname* 是節點類別的名稱,或者在該方法不存在時呼" +"叫 :meth:`generic_visit`。" -#: ../../library/ast.rst:2360 +#: ../../library/ast.rst:2417 msgid "This visitor calls :meth:`visit` on all children of the node." msgstr "該瀏覽者對該節點的所有子節點呼叫 :meth:`visit`。" -#: ../../library/ast.rst:2362 +#: ../../library/ast.rst:2419 msgid "" "Note that child nodes of nodes that have a custom visitor method won't be " "visited unless the visitor calls :meth:`generic_visit` or visits them itself." @@ -4137,38 +4260,38 @@ msgstr "" "請注意,除非瀏覽者呼叫 :meth:`generic_visit` 或瀏覽它們本身,否則不會瀏覽具有" "自定義瀏覽者方法的節點之子節點。" -#: ../../library/ast.rst:2368 +#: ../../library/ast.rst:2425 msgid "Handles all constant nodes." msgstr "處理所有常數節點。" -#: ../../library/ast.rst:2370 +#: ../../library/ast.rst:2427 msgid "" "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " -"during traversal. For this a special visitor exists (:class:" -"`NodeTransformer`) that allows modifications." +"during traversal. For this a special visitor exists " +"(:class:`NodeTransformer`) that allows modifications." msgstr "" -"如果你想在遍歷期間將變更應用 (apply) 於節點,請不要使用 :class:" -"`NodeVisitor`。為此,有個允許修改的特殊遍歷瀏覽者工具 :class:" -"`NodeTransformer`。" +"如果你想在遍歷期間將變更應用 (apply) 於節點,請不要使" +"用 :class:`NodeVisitor`。為此,有個允許修改的特殊遍歷瀏覽者工" +"具 :class:`NodeTransformer`。" -#: ../../library/ast.rst:2376 +#: ../../library/ast.rst:2433 msgid "" -"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`, :meth:" -"`!visit_NameConstant` and :meth:`!visit_Ellipsis` are deprecated now and " -"will not be called in future Python versions. Add the :meth:" -"`visit_Constant` method to handle all constant nodes." +"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!" +"visit_Bytes`, :meth:`!visit_NameConstant` and :meth:`!visit_Ellipsis` are " +"deprecated now and will not be called in future Python versions. Add " +"the :meth:`visit_Constant` method to handle all constant nodes." msgstr "" ":meth:`!visit_Num`、:meth:`!visit_Str`、:meth:`!visit_Bytes`、:meth:`!" "visit_NameConstant` 和 :meth:`!visit_Ellipsis` 方法現已棄用,並且不會在未來的" "Python 版本中被呼叫。新增 :meth:`visit_Constant` 方法來處理所有常數節點。" -#: ../../library/ast.rst:2384 +#: ../../library/ast.rst:2441 msgid "" "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and " "allows modification of nodes." msgstr "一個 :class:`NodeVisitor` 子類別,它會遍歷抽象語法樹並允許修改節點。" -#: ../../library/ast.rst:2387 +#: ../../library/ast.rst:2444 msgid "" "The :class:`NodeTransformer` will walk the AST and use the return value of " "the visitor methods to replace or remove the old node. If the return value " @@ -4180,7 +4303,7 @@ msgstr "" "點。如果瀏覽者方法的回傳值為 ``None``,則該節點將從其位置中刪除,否則將被替換" "為回傳值。回傳值可能是原始節點,在這種情況下不會發生替換。" -#: ../../library/ast.rst:2393 +#: ../../library/ast.rst:2450 msgid "" "Here is an example transformer that rewrites all occurrences of name lookups " "(``foo``) to ``data['foo']``::" @@ -4188,7 +4311,7 @@ msgstr "" "下面是一個示範用的 transformer,它將查找所有出現名稱 (``foo``) 並改寫為 " "``data['foo']``: ::" -#: ../../library/ast.rst:2396 +#: ../../library/ast.rst:2453 msgid "" "class RewriteName(NodeTransformer):\n" "\n" @@ -4208,16 +4331,16 @@ msgstr "" " ctx=node.ctx\n" " )" -#: ../../library/ast.rst:2405 +#: ../../library/ast.rst:2462 msgid "" "Keep in mind that if the node you're operating on has child nodes you must " -"either transform the child nodes yourself or call the :meth:`~ast." -"NodeVisitor.generic_visit` method for the node first." +"either transform the child nodes yourself or call " +"the :meth:`~ast.NodeVisitor.generic_visit` method for the node first." msgstr "" -"請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點的 :" -"meth:`~ast.NodeVisitor.generic_visit` 方法。" +"請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點" +"的 :meth:`~ast.NodeVisitor.generic_visit` 方法。" -#: ../../library/ast.rst:2409 +#: ../../library/ast.rst:2466 msgid "" "For nodes that were part of a collection of statements (that applies to all " "statement nodes), the visitor may also return a list of nodes rather than " @@ -4226,18 +4349,18 @@ msgstr "" "對於屬於陳述式總集 (collection) 一部分的節點(適用於所有陳述式節點),瀏覽者" "還可以回傳節點串列,而不僅僅是單個節點。" -#: ../../library/ast.rst:2413 +#: ../../library/ast.rst:2470 msgid "" "If :class:`NodeTransformer` introduces new nodes (that weren't part of " -"original tree) without giving them location information (such as :attr:`~ast." -"AST.lineno`), :func:`fix_missing_locations` should be called with the new " -"sub-tree to recalculate the location information::" +"original tree) without giving them location information (such " +"as :attr:`~ast.AST.lineno`), :func:`fix_missing_locations` should be called " +"with the new sub-tree to recalculate the location information::" msgstr "" "如果 :class:`NodeTransformer` 引進了新節點(不屬於原始樹的一部分),但沒有給" -"它們提供位置資訊(例如 :attr:`~ast.AST.lineno`\\ ),則應使用新的子樹呼叫 :" -"func:`fix_missing_locations` 以重新計算位置資訊: ::" +"它們提供位置資訊(例如 :attr:`~ast.AST.lineno`\\ ),則應使用新的子樹呼" +"叫 :func:`fix_missing_locations` 以重新計算位置資訊: ::" -#: ../../library/ast.rst:2418 +#: ../../library/ast.rst:2475 msgid "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" @@ -4245,15 +4368,15 @@ msgstr "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" -#: ../../library/ast.rst:2421 +#: ../../library/ast.rst:2478 msgid "Usually you use the transformer like this::" msgstr "你通常會像這樣使用 transformer: ::" -#: ../../library/ast.rst:2423 +#: ../../library/ast.rst:2480 msgid "node = YourTransformer().visit(node)" msgstr "node = YourTransformer().visit(node)" -#: ../../library/ast.rst:2428 +#: ../../library/ast.rst:2485 msgid "" "Return a formatted dump of the tree in *node*. This is mainly useful for " "debugging purposes. If *annotate_fields* is true (by default), the returned " @@ -4269,7 +4392,7 @@ msgstr "" "潔。預設情況下,不會傾印列號和行偏移量等屬性。如果需要,可以設定 " "*include_attributes* 為 true。" -#: ../../library/ast.rst:2436 +#: ../../library/ast.rst:2493 msgid "" "If *indent* is a non-negative integer or string, then the tree will be " "pretty-printed with that indent level. An indent level of 0, negative, or " @@ -4283,23 +4406,23 @@ msgstr "" "(預設值)代表選擇單列表示。使用正整數縮排可以在每個級別縮排相同數量的空格。" "如果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個級別。" -#: ../../library/ast.rst:2443 +#: ../../library/ast.rst:2500 msgid "" "If *show_empty* is false (the default), optional empty lists will be omitted " "from the output. Optional ``None`` values are always omitted." msgstr "" -"如果 *show_empty* 為 false(預設值),則輸出中將省略可選的空串列。" -"可選的 ``None`` 值總是會被省略。" +"如果 *show_empty* 為 false(預設值),則輸出中將省略可選的空串列。可選的 " +"``None`` 值總是會被省略。" -#: ../../library/ast.rst:2447 +#: ../../library/ast.rst:2504 msgid "Added the *indent* option." msgstr "新增 *indent* 選項。" -#: ../../library/ast.rst:2450 +#: ../../library/ast.rst:2507 msgid "Added the *show_empty* option." msgstr "新增 *show_empty* 選項。" -#: ../../library/ast.rst:2453 +#: ../../library/ast.rst:2510 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -4351,17 +4474,18 @@ msgstr "" " type_params=[])],\n" " type_ignores=[])" -#: ../../library/ast.rst:2484 -msgid "Compiler Flags" +#: ../../library/ast.rst:2541 +#, fuzzy +msgid "Compiler flags" msgstr "編譯器旗標" -#: ../../library/ast.rst:2486 +#: ../../library/ast.rst:2543 msgid "" "The following flags may be passed to :func:`compile` in order to change " "effects on the compilation of a program:" msgstr "可以將以下旗標傳遞給 :func:`compile` 以變更對程式的編譯效果:" -#: ../../library/ast.rst:2491 +#: ../../library/ast.rst:2548 msgid "" "Enables support for top-level ``await``, ``async for``, ``async with`` and " "async comprehensions." @@ -4369,21 +4493,21 @@ msgstr "" "啟用對最高階 ``await``、``async for``、``async with`` 和非同步綜合運算的支" "援。" -#: ../../library/ast.rst:2498 +#: ../../library/ast.rst:2555 msgid "" "Generates and returns an abstract syntax tree instead of returning a " "compiled code object." msgstr "生成並回傳抽象語法樹,而不是回傳已編譯的程式碼物件。" -#: ../../library/ast.rst:2503 +#: ../../library/ast.rst:2560 msgid "" -"The returned AST is optimized according to the *optimize* argument in :func:" -"`compile` or :func:`ast.parse`." +"The returned AST is optimized according to the *optimize* argument " +"in :func:`compile` or :func:`ast.parse`." msgstr "" "回傳的 AST 會根據 :func:`compile` 或 :func:`ast.parse` 中的 *optimize* 引數進" "行最佳化。" -#: ../../library/ast.rst:2510 +#: ../../library/ast.rst:2567 msgid "" "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: " "``, ``# type: ignore ``)." @@ -4391,47 +4515,77 @@ msgstr "" "啟用對 :pep:`484` 和 :pep:`526` 樣式型別註釋的支援 (``# type: ``, ``# " "type: ignore ``)。" -#: ../../library/ast.rst:2519 -msgid "Command-Line Usage" +#: ../../library/ast.rst:2575 +msgid "Recursively compares two ASTs." +msgstr "" + +#: ../../library/ast.rst:2577 +msgid "" +"*compare_attributes* affects whether AST attributes are considered in the " +"comparison. If *compare_attributes* is ``False`` (default), then attributes " +"are ignored. Otherwise they must all be equal. This option is useful to " +"check whether the ASTs are structurally equal but differ in whitespace or " +"similar details. Attributes include line numbers and column offsets." +msgstr "" + +#: ../../library/ast.rst:2590 +#, fuzzy +msgid "Command-line usage" msgstr "命令列用法" -#: ../../library/ast.rst:2523 +#: ../../library/ast.rst:2594 msgid "" "The :mod:`ast` module can be executed as a script from the command line. It " "is as simple as:" msgstr ":mod:`ast` 模組可以作為腳本從命令列執行,可以像這樣簡單地做到:" -#: ../../library/ast.rst:2526 +#: ../../library/ast.rst:2597 msgid "python -m ast [-m ] [-a] [infile]" msgstr "python -m ast [-m ] [-a] [infile]" -#: ../../library/ast.rst:2530 +#: ../../library/ast.rst:2601 msgid "The following options are accepted:" msgstr "以下選項可被接受:" -#: ../../library/ast.rst:2536 +#: ../../library/ast.rst:2607 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/ast.rst:2541 +#: ../../library/ast.rst:2612 msgid "" -"Specify what kind of code must be compiled, like the *mode* argument in :" -"func:`parse`." +"Specify what kind of code must be compiled, like the *mode* argument " +"in :func:`parse`." msgstr "指定必須編譯哪種類型的程式碼,像是 :func:`parse` 中的 *mode* 引數。" -#: ../../library/ast.rst:2546 +#: ../../library/ast.rst:2617 msgid "Don't parse type comments." msgstr "不要剖析型別註解。" -#: ../../library/ast.rst:2550 +#: ../../library/ast.rst:2621 msgid "Include attributes such as line numbers and column offsets." msgstr "包括列號和行偏移量等屬性。" -#: ../../library/ast.rst:2555 +#: ../../library/ast.rst:2626 msgid "Indentation of nodes in AST (number of spaces)." msgstr "AST 中節點的縮進(空格數)。" -#: ../../library/ast.rst:2557 +#: ../../library/ast.rst:2630 +msgid "" +"Python version in the format 3.x (for example, 3.10). Defaults to the " +"current version of the interpreter." +msgstr "" + +#: ../../library/ast.rst:2638 +msgid "Optimization level for parser. Defaults to no optimization." +msgstr "" + +#: ../../library/ast.rst:2644 +msgid "" +"Show empty lists and fields that are ``None``. Defaults to not showing empty " +"objects." +msgstr "" + +#: ../../library/ast.rst:2650 msgid "" "If :file:`infile` is specified its contents are parsed to AST and dumped to " "stdout. Otherwise, the content is read from stdin." @@ -4439,7 +4593,7 @@ msgstr "" "如果指定了 :file:`infile`,則其內容將被剖析為 AST 並傾印 (dump) 到 stdout。否" "則會從 stdin 讀取內容。" -#: ../../library/ast.rst:2563 +#: ../../library/ast.rst:2656 msgid "" "`Green Tree Snakes `_, an external " "documentation resource, has good details on working with Python ASTs." @@ -4447,7 +4601,7 @@ msgstr "" "`Green Tree Snakes `_ 是一個外部文件" "資源,提供了有關使用 Python AST 的詳細資訊。" -#: ../../library/ast.rst:2566 +#: ../../library/ast.rst:2659 msgid "" "`ASTTokens `_ " "annotates Python ASTs with the positions of tokens and text in the source " @@ -4458,7 +4612,7 @@ msgstr "" "用生成它們的原始碼中的標記和文本的位置來註釋 Python AST。這對於進行原始碼轉換" "的工具很有幫助。" -#: ../../library/ast.rst:2571 +#: ../../library/ast.rst:2664 msgid "" "`leoAst.py `_ unifies the token-based and parse-tree-based views of python programs " @@ -4468,7 +4622,7 @@ msgstr "" "py>`_ 透過在 token 和 ast 節點之間插入雙向鏈結,統一了 python 程式的基於 " "token 和基於剖析樹的視圖。" -#: ../../library/ast.rst:2576 +#: ../../library/ast.rst:2669 msgid "" "`LibCST `_ parses code as a Concrete Syntax " "Tree that looks like an ast tree and keeps all formatting details. It's " @@ -4478,7 +4632,7 @@ msgstr "" "(Concrete Syntax Tree),看起來像 ast 樹並保留所有格式詳細資訊。它對於建置自動" "重構 (codemod) 應用程式和 linter 非常有用。" -#: ../../library/ast.rst:2581 +#: ../../library/ast.rst:2674 msgid "" "`Parso `_ is a Python parser that supports " "error recovery and round-trip parsing for different Python versions (in " diff --git a/library/asyncio-dev.po b/library/asyncio-dev.po index ca430f72257..2b6078527fd 100644 --- a/library/asyncio-dev.po +++ b/library/asyncio-dev.po @@ -8,7 +8,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-09-08 15:25+0800\n" "PO-Revision-Date: 2023-02-18 14:17+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -75,12 +75,12 @@ msgstr "除了啟用除錯模式外,還要考慮:" #: ../../library/asyncio-dev.rst:36 msgid "" -"setting the log level of the :ref:`asyncio logger ` to :py:" -"const:`logging.DEBUG`, for example the following snippet of code can be run " -"at startup of the application::" +"setting the log level of the :ref:`asyncio logger ` " +"to :py:const:`logging.DEBUG`, for example the following snippet of code can " +"be run at startup of the application::" msgstr "" -"將 :ref:`asyncio logger(日誌記錄器) `\\ 的日誌級别設置為 :" -"py:const:`logging.DEBUG`,例如下面的程式片段可以在應用程式啟動時運行: ::" +"將 :ref:`asyncio logger(日誌記錄器) `\\ 的日誌級别設置" +"為 :py:const:`logging.DEBUG`,例如下面的程式片段可以在應用程式啟動時運行: ::" #: ../../library/asyncio-dev.rst:40 msgid "logging.basicConfig(level=logging.DEBUG)" @@ -92,8 +92,8 @@ msgid "" "warnings. One way of doing that is by using the :option:`-W` ``default`` " "command line option." msgstr "" -"配置 :mod:`warnings` 模組以顯示 :exc:`ResourceWarning` 警告。一種方法是使用 :" -"option:`-W` ``default`` 命令列選項。" +"配置 :mod:`warnings` 模組以顯示 :exc:`ResourceWarning` 警告。一種方法是使" +"用 :option:`-W` ``default`` 命令列選項。" #: ../../library/asyncio-dev.rst:47 msgid "When the debug mode is enabled:" @@ -101,13 +101,13 @@ msgstr "啟用除錯模式時:" #: ../../library/asyncio-dev.rst:49 msgid "" -"Many non-threadsafe asyncio APIs (such as :meth:`loop.call_soon` and :meth:" -"`loop.call_at` methods) raise an exception if they are called from a wrong " -"thread." +"Many non-threadsafe asyncio APIs (such as :meth:`loop.call_soon` " +"and :meth:`loop.call_at` methods) raise an exception if they are called from " +"a wrong thread." msgstr "" -"許多非執行緒安全 (non-threadsafe) 的 asyncio APIs(例如 :meth:`loop." -"call_soon` 和 :meth:`loop.call_at` 方法),如果從錯誤的執行緒呼叫就會引發例" -"外。" +"許多非執行緒安全 (non-threadsafe) 的 asyncio APIs(例" +"如 :meth:`loop.call_soon` 和 :meth:`loop.call_at` 方法),如果從錯誤的執行緒" +"呼叫就會引發例外。" #: ../../library/asyncio-dev.rst:53 msgid "" @@ -119,13 +119,13 @@ msgstr "" #: ../../library/asyncio-dev.rst:56 msgid "" -"Callbacks taking longer than 100 milliseconds are logged. The :attr:`loop." -"slow_callback_duration` attribute can be used to set the minimum execution " -"duration in seconds that is considered \"slow\"." +"Callbacks taking longer than 100 milliseconds are logged. " +"The :attr:`loop.slow_callback_duration` attribute can be used to set the " +"minimum execution duration in seconds that is considered \"slow\"." msgstr "" -"執行時間超過 100 毫秒的回呼 (callback) 將會被記錄於日誌。屬性 :attr:`loop." -"slow_callback_duration` 可用於設定以秒為單位的最小執行持續時間,超過這個值執" -"行時間就會被視為\"緩慢\"。" +"執行時間超過 100 毫秒的回呼 (callback) 將會被記錄於日誌。屬" +"性 :attr:`loop.slow_callback_duration` 可用於設定以秒為單位的最小執行持續時" +"間,超過這個值執行時間就會被視為\"緩慢\"。" #: ../../library/asyncio-dev.rst:64 msgid "Concurrency and Multithreading" @@ -146,11 +146,11 @@ msgstr "" #: ../../library/asyncio-dev.rst:72 msgid "" -"To schedule a :term:`callback` from another OS thread, the :meth:`loop." -"call_soon_threadsafe` method should be used. Example::" +"To schedule a :term:`callback` from another OS thread, " +"the :meth:`loop.call_soon_threadsafe` method should be used. Example::" msgstr "" -"要從不同的 OS 執行緒為一個 :term:`callback` 排程,應該使用 :meth:`loop." -"call_soon_threadsafe` 方法。例如: ::" +"要從不同的 OS 執行緒為一個 :term:`callback` 排程,應該使" +"用 :meth:`loop.call_soon_threadsafe` 方法。例如: ::" #: ../../library/asyncio-dev.rst:75 msgid "loop.call_soon_threadsafe(callback, *args)" @@ -173,13 +173,13 @@ msgstr "loop.call_soon_threadsafe(fut.cancel)" #: ../../library/asyncio-dev.rst:85 msgid "" -"To schedule a coroutine object from a different OS thread, the :func:" -"`run_coroutine_threadsafe` function should be used. It returns a :class:" -"`concurrent.futures.Future` to access the result::" +"To schedule a coroutine object from a different OS thread, " +"the :func:`run_coroutine_threadsafe` function should be used. It returns " +"a :class:`concurrent.futures.Future` to access the result::" msgstr "" -"要從不同的 OS 執行緒為一個協程物件排程,應該使用 :func:" -"`run_coroutine_threadsafe` 函式。它會回傳一個 :class:`concurrent.futures." -"Future` 以存取結果: ::" +"要從不同的 OS 執行緒為一個協程物件排程,應該使" +"用 :func:`run_coroutine_threadsafe` 函式。它會回傳一" +"個 :class:`concurrent.futures.Future` 以存取結果: ::" #: ../../library/asyncio-dev.rst:89 msgid "" @@ -198,41 +198,44 @@ msgid "To handle signals the event loop must be run in the main thread." msgstr "為了能夠處理訊號,事件迴圈必須於主執行緒中運行。" #: ../../library/asyncio-dev.rst:101 +#, fuzzy msgid "" -"The :meth:`loop.run_in_executor` method can be used with a :class:" -"`concurrent.futures.ThreadPoolExecutor` to execute blocking code in a " -"different OS thread without blocking the OS thread that the event loop runs " -"in." +"The :meth:`loop.run_in_executor` method can be used with " +"a :class:`concurrent.futures.ThreadPoolExecutor` " +"or :class:`~concurrent.futures.InterpreterPoolExecutor` to execute blocking " +"code in a different OS thread without blocking the OS thread that the event " +"loop runs in." msgstr "" -":meth:`loop.run_in_executor` 方法可以和 :class:`concurrent.futures." -"ThreadPoolExecutor` 一起使用,這能夠在作業系統上另一個不同的執行緒中執行阻塞" -"程式,且避免阻塞執行事件迴圈的執行緒。" +":meth:`loop.run_in_executor` 方法可以" +"和 :class:`concurrent.futures.ThreadPoolExecutor` 一起使用,這能夠在作業系統" +"上另一個不同的執行緒中執行阻塞程式,且避免阻塞執行事件迴圈的執行緒。" -#: ../../library/asyncio-dev.rst:106 +#: ../../library/asyncio-dev.rst:107 msgid "" "There is currently no way to schedule coroutines or callbacks directly from " -"a different process (such as one started with :mod:`multiprocessing`). The :" -"ref:`asyncio-event-loop-methods` section lists APIs that can read from pipes " -"and watch file descriptors without blocking the event loop. In addition, " -"asyncio's :ref:`Subprocess ` APIs provide a way to start " -"a process and communicate with it from the event loop. Lastly, the " -"aforementioned :meth:`loop.run_in_executor` method can also be used with a :" -"class:`concurrent.futures.ProcessPoolExecutor` to execute code in a " +"a different process (such as one started with :mod:`multiprocessing`). " +"The :ref:`asyncio-event-loop-methods` section lists APIs that can read from " +"pipes and watch file descriptors without blocking the event loop. In " +"addition, asyncio's :ref:`Subprocess ` APIs provide a " +"way to start a process and communicate with it from the event loop. Lastly, " +"the aforementioned :meth:`loop.run_in_executor` method can also be used with " +"a :class:`concurrent.futures.ProcessPoolExecutor` to execute code in a " "different process." msgstr "" "目前沒有什麼辦法能直接從另一個行程(例如透過 :mod:`multiprocessing` 啟動的程" "序)來為協程或回呼排程。:ref:`asyncio-event-loop-methods`\\ 小節列出了可以從 " "pipes(管道)讀取並監視 file descriptor(檔案描述器)而不會阻塞事件迴圈的 " "API。此外,asyncio 的\\ :ref:`子行程 ` API 提供了一種啟動" -"行程並從事件迴圈與其通訊的辦法。最後,之前提到的 :meth:`loop." -"run_in_executor` 方法也可和 :class:`concurrent.futures.ProcessPoolExecutor` " -"搭配使用,以在另一個行程中執行程式。" +"行程並從事件迴圈與其通訊的辦法。最後,之前提到" +"的 :meth:`loop.run_in_executor` 方法也可" +"和 :class:`concurrent.futures.ProcessPoolExecutor` 搭配使用,以在另一個行程中" +"執行程式。" -#: ../../library/asyncio-dev.rst:120 +#: ../../library/asyncio-dev.rst:121 msgid "Running Blocking Code" msgstr "執行阻塞的程式" -#: ../../library/asyncio-dev.rst:122 +#: ../../library/asyncio-dev.rst:123 msgid "" "Blocking (CPU-bound) code should not be called directly. For example, if a " "function performs a CPU-intensive calculation for 1 second, all concurrent " @@ -241,21 +244,23 @@ msgstr "" "不應該直接呼叫阻塞(CPU 密集型)程式。例如一個執行 1 秒 CPU 密集型計算的函" "式,那麼所有並行非同步 Tasks 和 IO 操作都會被延遲 1 秒。" -#: ../../library/asyncio-dev.rst:127 +#: ../../library/asyncio-dev.rst:128 +#, fuzzy msgid "" -"An executor can be used to run a task in a different thread or even in a " -"different process to avoid blocking the OS thread with the event loop. See " -"the :meth:`loop.run_in_executor` method for more details." +"An executor can be used to run a task in a different thread, including in a " +"different interpreter, or even in a different process to avoid blocking the " +"OS thread with the event loop. See the :meth:`loop.run_in_executor` method " +"for more details." msgstr "" "一個 executor(執行器)可以被用來在不同的執行緒、或甚至不同的行程中執行任務," "以避免使用事件迴圈阻塞 OS 執行緒。詳情請見 :meth:`loop.run_in_executor` 方" "法。" -#: ../../library/asyncio-dev.rst:136 +#: ../../library/asyncio-dev.rst:138 msgid "Logging" msgstr "日誌記錄" -#: ../../library/asyncio-dev.rst:138 +#: ../../library/asyncio-dev.rst:140 msgid "" "asyncio uses the :mod:`logging` module and all logging is performed via the " "``\"asyncio\"`` logger." @@ -263,40 +268,40 @@ msgstr "" "asyncio 使用 :mod:`logging` 模組,所有日誌記錄都是透過 ``\"asyncio\"`` " "logger 執行的。" -#: ../../library/asyncio-dev.rst:141 +#: ../../library/asyncio-dev.rst:143 msgid "" "The default log level is :py:const:`logging.INFO`, which can be easily " "adjusted::" msgstr "日誌級別被預設為 :py:const:`logging.INFO`,它可以很容易地被調整: ::" -#: ../../library/asyncio-dev.rst:144 +#: ../../library/asyncio-dev.rst:146 msgid "logging.getLogger(\"asyncio\").setLevel(logging.WARNING)" msgstr "logging.getLogger(\"asyncio\").setLevel(logging.WARNING)" -#: ../../library/asyncio-dev.rst:147 +#: ../../library/asyncio-dev.rst:149 msgid "" "Network logging can block the event loop. It is recommended to use a " -"separate thread for handling logs or use non-blocking IO. For example, see :" -"ref:`blocking-handlers`." +"separate thread for handling logs or use non-blocking IO. For example, " +"see :ref:`blocking-handlers`." msgstr "" "網路日誌記錄可能會阻塞事件迴圈。建議使用獨立的執行緒來處理日誌或使用非阻塞 " "IO,範例請參見 :ref:`blocking-handlers`。" -#: ../../library/asyncio-dev.rst:155 +#: ../../library/asyncio-dev.rst:157 msgid "Detect never-awaited coroutines" msgstr "偵測從未被等待的 (never-awaited) 協程" -#: ../../library/asyncio-dev.rst:157 +#: ../../library/asyncio-dev.rst:159 msgid "" "When a coroutine function is called, but not awaited (e.g. ``coro()`` " -"instead of ``await coro()``) or the coroutine is not scheduled with :meth:" -"`asyncio.create_task`, asyncio will emit a :exc:`RuntimeWarning`::" +"instead of ``await coro()``) or the coroutine is not scheduled " +"with :meth:`asyncio.create_task`, asyncio will emit a :exc:`RuntimeWarning`::" msgstr "" "當協程函式被呼叫而不是被等待時(即執行 ``coro()`` 而不是 ``await coro()``)或" -"者協程沒有透過 :meth:`asyncio.create_task` 被排程,asyncio 將會發出 :exc:" -"`RuntimeWarning`: ::" +"者協程沒有透過 :meth:`asyncio.create_task` 被排程,asyncio 將會發" +"出 :exc:`RuntimeWarning`: ::" -#: ../../library/asyncio-dev.rst:162 +#: ../../library/asyncio-dev.rst:164 msgid "" "import asyncio\n" "\n" @@ -309,11 +314,11 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-dev.rst:172 ../../library/asyncio-dev.rst:217 +#: ../../library/asyncio-dev.rst:174 ../../library/asyncio-dev.rst:219 msgid "Output::" msgstr "輸出: ::" -#: ../../library/asyncio-dev.rst:174 +#: ../../library/asyncio-dev.rst:176 msgid "" "test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" " test()" @@ -321,11 +326,11 @@ msgstr "" "test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" " test()" -#: ../../library/asyncio-dev.rst:177 ../../library/asyncio-dev.rst:233 +#: ../../library/asyncio-dev.rst:179 ../../library/asyncio-dev.rst:235 msgid "Output in debug mode::" msgstr "除錯模式中的輸出: ::" -#: ../../library/asyncio-dev.rst:179 +#: ../../library/asyncio-dev.rst:181 msgid "" "test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" "Coroutine created at (most recent call last)\n" @@ -349,14 +354,14 @@ msgstr "" " test()\n" " test()" -#: ../../library/asyncio-dev.rst:190 +#: ../../library/asyncio-dev.rst:192 msgid "" -"The usual fix is to either await the coroutine or call the :meth:`asyncio." -"create_task` function::" +"The usual fix is to either await the coroutine or call " +"the :meth:`asyncio.create_task` function::" msgstr "" "常用的修復方法是去等待協程或者呼叫 :meth:`asyncio.create_task` 函式: ::" -#: ../../library/asyncio-dev.rst:193 +#: ../../library/asyncio-dev.rst:195 msgid "" "async def main():\n" " await test()" @@ -364,11 +369,11 @@ msgstr "" "async def main():\n" " await test()" -#: ../../library/asyncio-dev.rst:198 +#: ../../library/asyncio-dev.rst:200 msgid "Detect never-retrieved exceptions" msgstr "偵測從未被取得的 (never-retrieved) 例外" -#: ../../library/asyncio-dev.rst:200 +#: ../../library/asyncio-dev.rst:202 msgid "" "If a :meth:`Future.set_exception` is called but the Future object is never " "awaited on, the exception would never be propagated to the user code. In " @@ -379,11 +384,11 @@ msgstr "" "傳播 (propagate) 到使用者程式。在這種情況下,當 Future 物件被垃圾回收 " "(garbage collected) 時,asyncio 將發出一則日誌訊息。" -#: ../../library/asyncio-dev.rst:205 +#: ../../library/asyncio-dev.rst:207 msgid "Example of an unhandled exception::" msgstr "未處理例外的例子: ::" -#: ../../library/asyncio-dev.rst:207 +#: ../../library/asyncio-dev.rst:209 msgid "" "import asyncio\n" "\n" @@ -405,7 +410,7 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../library/asyncio-dev.rst:219 +#: ../../library/asyncio-dev.rst:221 msgid "" "Task exception was never retrieved\n" "future: \n" @@ -425,7 +430,7 @@ msgstr "" " raise Exception(\"not consumed\")\n" "Exception: not consumed" -#: ../../library/asyncio-dev.rst:228 +#: ../../library/asyncio-dev.rst:230 msgid "" ":ref:`Enable the debug mode ` to get the traceback where " "the task was created::" @@ -433,11 +438,11 @@ msgstr "" ":ref:`啟用除錯模式 `\\ 以取得任務建立處的追蹤資訊 " "(traceback): ::" -#: ../../library/asyncio-dev.rst:231 +#: ../../library/asyncio-dev.rst:233 msgid "asyncio.run(main(), debug=True)" msgstr "asyncio.run(main(), debug=True)" -#: ../../library/asyncio-dev.rst:235 +#: ../../library/asyncio-dev.rst:237 msgid "" "Task exception was never retrieved\n" "future: \n" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index 76a0099f80e..0e7e3a5aa7c 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-20 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -94,8 +94,8 @@ msgid "" "If there is no running event loop set, the function will return the result " "of the ``get_event_loop_policy().get_event_loop()`` call." msgstr "" -"如果沒有設定正在運行的事件迴圈,該函式將回傳 ``get_event_loop_policy()." -"get_event_loop()`` 呼叫的結果。" +"如果沒有設定正在運行的事件迴圈,該函式將回傳 " +"``get_event_loop_policy().get_event_loop()`` 呼叫的結果。" #: ../../library/asyncio-eventloop.rst:53 msgid "" @@ -104,8 +104,8 @@ msgid "" "is preferred to :func:`get_event_loop` in coroutines and callbacks." msgstr "" "由於此函式具有相當複雜的行為(尤其是在使用自訂事件迴圈策略時),在協程和回呼" -"函式中,建議使用 :func:`get_running_loop` 函式,而不是 :func:" -"`get_event_loop`。" +"函式中,建議使用 :func:`get_running_loop` 函式,而不" +"是 :func:`get_event_loop`。" #: ../../library/asyncio-eventloop.rst:58 msgid "" @@ -117,110 +117,115 @@ msgstr "" "函式手動建立和關閉事件迴圈。" #: ../../library/asyncio-eventloop.rst:62 +#, fuzzy +msgid "Raises a :exc:`RuntimeError` if there is no current event loop." +msgstr "如果沒有運行的事件迴圈,則引發 :exc:`RuntimeError`。" + +#: ../../library/asyncio-eventloop.rst:67 msgid "" -"Deprecation warning is emitted if there is no current event loop. In some " -"future Python release this will become an error." +"The :mod:`!asyncio` policy system is deprecated and will be removed in " +"Python 3.16; from there on, this function will return the current running " +"event loop if present else it will return the loop set " +"by :func:`set_event_loop`." msgstr "" -"如果沒有目前事件迴圈,則會發出棄用警告。在未來的某個 Python 發行版中,這將變" -"成錯誤。" -#: ../../library/asyncio-eventloop.rst:68 +#: ../../library/asyncio-eventloop.rst:74 msgid "Set *loop* as the current event loop for the current OS thread." msgstr "將 *loop* 設置為目前 OS 執行緒的目前事件迴圈。" -#: ../../library/asyncio-eventloop.rst:72 +#: ../../library/asyncio-eventloop.rst:78 msgid "Create and return a new event loop object." msgstr "建立並回傳新的事件迴圈物件。" -#: ../../library/asyncio-eventloop.rst:74 +#: ../../library/asyncio-eventloop.rst:80 msgid "" "Note that the behaviour of :func:`get_event_loop`, :func:`set_event_loop`, " "and :func:`new_event_loop` functions can be altered by :ref:`setting a " "custom event loop policy `." msgstr "" -"請注意 :func:`get_event_loop`、:func:`set_event_loop` 和 :func:" -"`new_event_loop` 函式的行為可以透過\\ :ref:`設定自訂事件迴圈策略 `\\ 進行調整。" +"請注意 :func:`get_event_loop`、:func:`set_event_loop` " +"和 :func:`new_event_loop` 函式的行為可以透過\\ :ref:`設定自訂事件迴圈策略 " +"`\\ 進行調整。" -#: ../../library/asyncio-eventloop.rst:80 +#: ../../library/asyncio-eventloop.rst:86 msgid "Contents" msgstr "目錄" -#: ../../library/asyncio-eventloop.rst:81 +#: ../../library/asyncio-eventloop.rst:87 msgid "This documentation page contains the following sections:" msgstr "本頁文件包含以下章節:" -#: ../../library/asyncio-eventloop.rst:83 +#: ../../library/asyncio-eventloop.rst:89 msgid "" "The `Event Loop Methods`_ section is the reference documentation of the " "event loop APIs;" msgstr "" "`事件迴圈方法 `_\\ 章節是事件迴圈 API 們的參照文件;" -#: ../../library/asyncio-eventloop.rst:86 +#: ../../library/asyncio-eventloop.rst:92 msgid "" -"The `Callback Handles`_ section documents the :class:`Handle` and :class:" -"`TimerHandle` instances which are returned from scheduling methods such as :" -"meth:`loop.call_soon` and :meth:`loop.call_later`;" +"The `Callback Handles`_ section documents the :class:`Handle` " +"and :class:`TimerHandle` instances which are returned from scheduling " +"methods such as :meth:`loop.call_soon` and :meth:`loop.call_later`;" msgstr "" -"`回呼處理 `_\\ 章節記錄了從排程方法(如 :meth:`loop." -"call_soon` 和 :meth:`loop.call_later`)回傳的 :class:`Handle` 和 :class:" -"`TimerHandle` 實例;" +"`回呼處理 `_\\ 章節記錄了從排程方法" +"(如 :meth:`loop.call_soon` 和 :meth:`loop.call_later`)回傳" +"的 :class:`Handle` 和 :class:`TimerHandle` 實例;" -#: ../../library/asyncio-eventloop.rst:90 +#: ../../library/asyncio-eventloop.rst:96 msgid "" "The `Server Objects`_ section documents types returned from event loop " "methods like :meth:`loop.create_server`;" msgstr "" -"`Server 物件 `_\\ 章節記錄了從事件迴圈方法(如 :meth:`loop." -"create_server`)回傳的資料型別;" +"`Server 物件 `_\\ 章節記錄了從事件迴圈方法" +"(如 :meth:`loop.create_server`)回傳的資料型別;" -#: ../../library/asyncio-eventloop.rst:93 +#: ../../library/asyncio-eventloop.rst:99 msgid "" -"The `Event Loop Implementations`_ section documents the :class:" -"`SelectorEventLoop` and :class:`ProactorEventLoop` classes;" +"The `Event Loop Implementations`_ section documents " +"the :class:`SelectorEventLoop` and :class:`ProactorEventLoop` classes;" msgstr "" -"`事件迴圈實作 `_\\ 章節記錄了 :class:" -"`SelectorEventLoop` 和 :class:`ProactorEventLoop` 類別;" +"`事件迴圈實作 `_\\ 章節記錄" +"了 :class:`SelectorEventLoop` 和 :class:`ProactorEventLoop` 類別;" -#: ../../library/asyncio-eventloop.rst:96 +#: ../../library/asyncio-eventloop.rst:102 msgid "" "The `Examples`_ section showcases how to work with some event loop APIs." msgstr "`範例 `_\\ 章節展示了如何使用一些事件迴圈 API。" -#: ../../library/asyncio-eventloop.rst:103 +#: ../../library/asyncio-eventloop.rst:109 msgid "Event Loop Methods" msgstr "事件迴圈方法" -#: ../../library/asyncio-eventloop.rst:105 +#: ../../library/asyncio-eventloop.rst:111 msgid "Event loops have **low-level** APIs for the following:" msgstr "事件迴圈提供以下\\ **低階** API:" -#: ../../library/asyncio-eventloop.rst:113 +#: ../../library/asyncio-eventloop.rst:119 msgid "Running and stopping the loop" msgstr "啟動和停止迴圈" -#: ../../library/asyncio-eventloop.rst:117 +#: ../../library/asyncio-eventloop.rst:123 msgid "Run until the *future* (an instance of :class:`Future`) has completed." msgstr "運行直到 *future* (一個 :class:`Future` 實例)完成。" -#: ../../library/asyncio-eventloop.rst:120 +#: ../../library/asyncio-eventloop.rst:126 msgid "" "If the argument is a :ref:`coroutine object ` it is implicitly " "scheduled to run as a :class:`asyncio.Task`." msgstr "" -"如果引數是\\ :ref:`協程物件 `,則它將被隱式排程為 :class:`asyncio." -"Task` 運行。" +"如果引數是\\ :ref:`協程物件 `,則它將被隱式排程" +"為 :class:`asyncio.Task` 運行。" -#: ../../library/asyncio-eventloop.rst:123 +#: ../../library/asyncio-eventloop.rst:129 msgid "Return the Future's result or raise its exception." msgstr "回傳 Future 的結果或引發其例外。" -#: ../../library/asyncio-eventloop.rst:127 +#: ../../library/asyncio-eventloop.rst:133 msgid "Run the event loop until :meth:`stop` is called." msgstr "運行事件迴圈直到 :meth:`stop` 被呼叫。" -#: ../../library/asyncio-eventloop.rst:129 +#: ../../library/asyncio-eventloop.rst:135 msgid "" "If :meth:`stop` is called before :meth:`run_forever` is called, the loop " "will poll the I/O selector once with a timeout of zero, run all callbacks " @@ -231,7 +236,7 @@ msgstr "" "方式輪詢 I/O 選擇器,運行所有回應 I/O 事件(以及已經排程的事件)的回呼,然後" "退出。" -#: ../../library/asyncio-eventloop.rst:134 +#: ../../library/asyncio-eventloop.rst:140 msgid "" "If :meth:`stop` is called while :meth:`run_forever` is running, the loop " "will run the current batch of callbacks and then exit. Note that new " @@ -243,41 +248,41 @@ msgstr "" "呼函式,然後退出。請注意,由回呼函式排程的新回呼在此情況下不會運行;而是在下" "次呼叫 :meth:`run_forever` 或 :meth:`run_until_complete` 時運行。" -#: ../../library/asyncio-eventloop.rst:142 +#: ../../library/asyncio-eventloop.rst:148 msgid "Stop the event loop." msgstr "停止事件迴圈。" -#: ../../library/asyncio-eventloop.rst:146 +#: ../../library/asyncio-eventloop.rst:152 msgid "Return ``True`` if the event loop is currently running." msgstr "如果事件迴圈目前正在運行,則回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:150 +#: ../../library/asyncio-eventloop.rst:156 msgid "Return ``True`` if the event loop was closed." msgstr "如果事件迴圈已關閉,則回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:154 +#: ../../library/asyncio-eventloop.rst:160 msgid "Close the event loop." msgstr "關閉事件迴圈。" -#: ../../library/asyncio-eventloop.rst:156 +#: ../../library/asyncio-eventloop.rst:162 msgid "" "The loop must not be running when this function is called. Any pending " "callbacks will be discarded." msgstr "不得於迴圈運行中呼叫此函式。將丟棄任何待處理的回呼。" -#: ../../library/asyncio-eventloop.rst:159 +#: ../../library/asyncio-eventloop.rst:165 msgid "" "This method clears all queues and shuts down the executor, but does not wait " "for the executor to finish." msgstr "此方法清除所有佇列並關閉執行器,但不等待執行器完成。" -#: ../../library/asyncio-eventloop.rst:162 +#: ../../library/asyncio-eventloop.rst:168 msgid "" "This method is idempotent and irreversible. No other methods should be " "called after the event loop is closed." msgstr "此方法是冪等且不可逆的。在事件迴圈關閉後不應呼叫其他方法。" -#: ../../library/asyncio-eventloop.rst:168 +#: ../../library/asyncio-eventloop.rst:174 msgid "" "Schedule all currently open :term:`asynchronous generator` objects to close " "with an :meth:`~agen.aclose` call. After calling this method, the event " @@ -288,19 +293,19 @@ msgstr "" "用 :meth:`~agen.aclose` 呼叫來關閉。呼叫此方法後,如果疊代新的非同步產生器," "事件迴圈將發出警告。應該使用此方法可靠地完成所有已排程的非同步產生器。" -#: ../../library/asyncio-eventloop.rst:174 +#: ../../library/asyncio-eventloop.rst:180 msgid "" "Note that there is no need to call this function when :func:`asyncio.run` is " "used." msgstr "請注意,使用 :func:`asyncio.run` 時不需要呼叫此函式。" -#: ../../library/asyncio-eventloop.rst:177 -#: ../../library/asyncio-eventloop.rst:1338 -#: ../../library/asyncio-eventloop.rst:1787 +#: ../../library/asyncio-eventloop.rst:183 +#: ../../library/asyncio-eventloop.rst:1354 +#: ../../library/asyncio-eventloop.rst:1810 msgid "Example::" msgstr "範例: ::" -#: ../../library/asyncio-eventloop.rst:179 +#: ../../library/asyncio-eventloop.rst:185 msgid "" "try:\n" " loop.run_forever()\n" @@ -314,18 +319,19 @@ msgstr "" " loop.run_until_complete(loop.shutdown_asyncgens())\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:190 +#: ../../library/asyncio-eventloop.rst:196 msgid "" "Schedule the closure of the default executor and wait for it to join all of " "the threads in the :class:`~concurrent.futures.ThreadPoolExecutor`. Once " -"this method has been called, using the default executor with :meth:`loop." -"run_in_executor` will raise a :exc:`RuntimeError`." +"this method has been called, using the default executor " +"with :meth:`loop.run_in_executor` will raise a :exc:`RuntimeError`." msgstr "" -"排程預設執行器的關閉,並等待它加入 :class:`~concurrent.futures." -"ThreadPoolExecutor` 中的所有執行緒。一旦呼叫了此方法,使用預設執行器與 :meth:" -"`loop.run_in_executor` 將引發 :exc:`RuntimeError`。" +"排程預設執行器的關閉,並等待它加" +"入 :class:`~concurrent.futures.ThreadPoolExecutor` 中的所有執行緒。一旦呼叫了" +"此方法,使用預設執行器與 :meth:`loop.run_in_executor` 將引" +"發 :exc:`RuntimeError`。" -#: ../../library/asyncio-eventloop.rst:196 +#: ../../library/asyncio-eventloop.rst:202 msgid "" "The *timeout* parameter specifies the amount of time (in :class:`float` " "seconds) the executor will be given to finish joining. With the default, " @@ -334,7 +340,7 @@ msgstr "" "*timeout* 參數指定執行器完成加入所需的時間(以 :class:`float` 秒為單位)。預" "設情況下為 ``None``,不會限制執行器所花費的時間。" -#: ../../library/asyncio-eventloop.rst:201 +#: ../../library/asyncio-eventloop.rst:207 msgid "" "If the *timeout* is reached, a :exc:`RuntimeWarning` is emitted and the " "default executor is terminated without waiting for its threads to finish " @@ -343,7 +349,7 @@ msgstr "" "如果達到 *timeout*,將發出 :exc:`RuntimeWarning` 警告,預設執行器將立即終止," "不等待其執行緒完成加入。" -#: ../../library/asyncio-eventloop.rst:207 +#: ../../library/asyncio-eventloop.rst:213 msgid "" "Do not call this method when using :func:`asyncio.run`, as the latter " "handles default executor shutdown automatically." @@ -351,47 +357,48 @@ msgstr "" "使用 :func:`asyncio.run` 時請勿呼叫此方法,因為後者會自動處理預設執行器的關" "閉。" -#: ../../library/asyncio-eventloop.rst:212 +#: ../../library/asyncio-eventloop.rst:218 msgid "Added the *timeout* parameter." msgstr "加入 *timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:216 +#: ../../library/asyncio-eventloop.rst:222 msgid "Scheduling callbacks" msgstr "排程回呼函式" -#: ../../library/asyncio-eventloop.rst:220 +#: ../../library/asyncio-eventloop.rst:226 msgid "" "Schedule the *callback* :term:`callback` to be called with *args* arguments " "at the next iteration of the event loop." msgstr "" "在事件迴圈的下一次疊代中排程以 *args* 引數呼叫 *callback* :term:`callback`。" -#: ../../library/asyncio-eventloop.rst:223 +#: ../../library/asyncio-eventloop.rst:229 msgid "" "Return an instance of :class:`asyncio.Handle`, which can be used later to " "cancel the callback." msgstr "回傳 :class:`asyncio.Handle` 的實例,稍後可以用於取消回呼函式。" -#: ../../library/asyncio-eventloop.rst:226 +#: ../../library/asyncio-eventloop.rst:232 msgid "" "Callbacks are called in the order in which they are registered. Each " "callback will be called exactly once." msgstr "回呼函式按照其註冊的順序呼叫。每個回呼函式將被呼叫恰好一次。" -#: ../../library/asyncio-eventloop.rst:229 +#: ../../library/asyncio-eventloop.rst:235 msgid "" -"The optional keyword-only *context* argument specifies a custom :class:" -"`contextvars.Context` for the *callback* to run in. Callbacks use the " -"current context when no *context* is provided." +"The optional keyword-only *context* argument specifies a " +"custom :class:`contextvars.Context` for the *callback* to run in. Callbacks " +"use the current context when no *context* is provided." msgstr "" -"選用的僅限關鍵字引數 *context* 指定了要給 *callback* 執行的自定義 :class:" -"`contextvars.Context`。當未提供 *context* 時,回呼函式使用目前情境。" +"選用的僅限關鍵字引數 *context* 指定了要給 *callback* 執行的自定" +"義 :class:`contextvars.Context`。當未提供 *context* 時,回呼函式使用目前情" +"境。" -#: ../../library/asyncio-eventloop.rst:233 +#: ../../library/asyncio-eventloop.rst:239 msgid "Unlike :meth:`call_soon_threadsafe`, this method is not thread-safe." msgstr "與 :meth:`call_soon_threadsafe` 不同,此方法不是執行緒安全的。" -#: ../../library/asyncio-eventloop.rst:237 +#: ../../library/asyncio-eventloop.rst:243 msgid "" "A thread-safe variant of :meth:`call_soon`. When scheduling callbacks from " "another thread, this function *must* be used, since :meth:`call_soon` is not " @@ -400,14 +407,14 @@ msgstr "" "這是 :meth:`call_soon` 的執行緒安全變體。當從另一個執行緒排程回呼函式時,*必" "須*\\ 使用此函式,因為 :meth:`call_soon` 不是執行緒安全的。" -#: ../../library/asyncio-eventloop.rst:241 +#: ../../library/asyncio-eventloop.rst:247 msgid "" "This function is safe to be called from a reentrant context or signal " "handler, however, it is not safe or fruitful to use the returned handle in " "such contexts." msgstr "" -#: ../../library/asyncio-eventloop.rst:244 +#: ../../library/asyncio-eventloop.rst:250 msgid "" "Raises :exc:`RuntimeError` if called on a loop that's been closed. This can " "happen on a secondary thread when the main application is shutting down." @@ -415,21 +422,21 @@ msgstr "" "如果在已關閉的迴圈上呼叫,則引發 :exc:`RuntimeError`。在主應用程式關閉時,這" "可能發生在次要執行緒上。" -#: ../../library/asyncio-eventloop.rst:248 +#: ../../library/asyncio-eventloop.rst:254 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "請參閱文件的\\ :ref:`並行和多執行緒 `\\ 部分。" -#: ../../library/asyncio-eventloop.rst:251 -#: ../../library/asyncio-eventloop.rst:307 -#: ../../library/asyncio-eventloop.rst:333 +#: ../../library/asyncio-eventloop.rst:257 +#: ../../library/asyncio-eventloop.rst:313 +#: ../../library/asyncio-eventloop.rst:339 msgid "" "The *context* keyword-only parameter was added. See :pep:`567` for more " "details." msgstr "新增了 *context* 僅限關鍵字參數。詳細資訊請參閱 :pep:`567`。" -#: ../../library/asyncio-eventloop.rst:259 +#: ../../library/asyncio-eventloop.rst:265 msgid "" "Most :mod:`asyncio` scheduling functions don't allow passing keyword " "arguments. To do that, use :func:`functools.partial`::" @@ -437,7 +444,7 @@ msgstr "" "大多數 :mod:`asyncio` 排程函式不允許傳遞關鍵字引數。要傳遞關鍵字引數,請使" "用 :func:`functools.partial`: ::" -#: ../../library/asyncio-eventloop.rst:262 +#: ../../library/asyncio-eventloop.rst:268 msgid "" "# will schedule \"print(\"Hello\", flush=True)\"\n" "loop.call_soon(\n" @@ -447,7 +454,7 @@ msgstr "" "loop.call_soon(\n" " functools.partial(print, \"Hello\", flush=True))" -#: ../../library/asyncio-eventloop.rst:266 +#: ../../library/asyncio-eventloop.rst:272 msgid "" "Using partial objects is usually more convenient than using lambdas, as " "asyncio can render partial objects better in debug and error messages." @@ -455,11 +462,11 @@ msgstr "" "通常使用 partial 物件比使用 lambda 更方便,因為 asyncio 可以在除錯和錯誤訊息" "中更好地呈現 partial 物件。" -#: ../../library/asyncio-eventloop.rst:274 +#: ../../library/asyncio-eventloop.rst:280 msgid "Scheduling delayed callbacks" msgstr "排程延遲的回呼函式" -#: ../../library/asyncio-eventloop.rst:276 +#: ../../library/asyncio-eventloop.rst:282 msgid "" "Event loop provides mechanisms to schedule callback functions to be called " "at some point in the future. Event loop uses monotonic clocks to track time." @@ -467,20 +474,20 @@ msgstr "" "事件迴圈提供為回呼函式排程在將來某個時間點才呼叫的機制。事件迴圈使用了單調時" "鐘來追蹤時間。" -#: ../../library/asyncio-eventloop.rst:283 +#: ../../library/asyncio-eventloop.rst:289 msgid "" "Schedule *callback* to be called after the given *delay* number of seconds " "(can be either an int or a float)." msgstr "排程 *callback* 在給定的 *delay* 秒數後呼叫(可以是整數或浮點數)。" -#: ../../library/asyncio-eventloop.rst:286 -#: ../../library/asyncio-eventloop.rst:324 +#: ../../library/asyncio-eventloop.rst:292 +#: ../../library/asyncio-eventloop.rst:330 msgid "" "An instance of :class:`asyncio.TimerHandle` is returned which can be used to " "cancel the callback." msgstr "回傳 :class:`asyncio.TimerHandle` 的實例,可用於取消回呼函式。" -#: ../../library/asyncio-eventloop.rst:289 +#: ../../library/asyncio-eventloop.rst:295 msgid "" "*callback* will be called exactly once. If two callbacks are scheduled for " "exactly the same time, the order in which they are called is undefined." @@ -488,32 +495,33 @@ msgstr "" "*callback* 將只被呼叫恰好一次。如果有兩個回呼函式被排程在完全相同的時間,則其" "呼叫順序是不定的。" -#: ../../library/asyncio-eventloop.rst:293 +#: ../../library/asyncio-eventloop.rst:299 msgid "" "The optional positional *args* will be passed to the callback when it is " -"called. If you want the callback to be called with keyword arguments use :" -"func:`functools.partial`." +"called. If you want the callback to be called with keyword arguments " +"use :func:`functools.partial`." msgstr "" "可選的位置引數 *args* 將在呼叫回呼函式時傳遞。如果要使用關鍵字引數呼叫回呼函" "數,請使用 :func:`functools.partial`。" -#: ../../library/asyncio-eventloop.rst:297 +#: ../../library/asyncio-eventloop.rst:303 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *callback* to run in. The current " -"context is used when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *callback* to run in. The " +"current context is used when no *context* is provided." msgstr "" -"可選的僅限關鍵字 *context* 引數允許為 *callback* 指定自定義的 :class:" -"`contextvars.Context` 以提供運行。當未提供 *context* 時,將使用目前情境。" +"可選的僅限關鍵字 *context* 引數允許為 *callback* 指定自定義" +"的 :class:`contextvars.Context` 以提供運行。當未提供 *context* 時,將使用目前" +"情境。" -#: ../../library/asyncio-eventloop.rst:303 +#: ../../library/asyncio-eventloop.rst:309 msgid "" "For performance, callbacks scheduled with :meth:`loop.call_later` may run up " -"to one clock-resolution early (see ``time.get_clock_info('monotonic')." -"resolution``)." +"to one clock-resolution early (see " +"``time.get_clock_info('monotonic').resolution``)." msgstr "" -#: ../../library/asyncio-eventloop.rst:311 +#: ../../library/asyncio-eventloop.rst:317 msgid "" "In Python 3.7 and earlier with the default event loop implementation, the " "*delay* could not exceed one day. This has been fixed in Python 3.8." @@ -521,26 +529,26 @@ msgstr "" "在 Python 3.7 及更早版本中,使用預設事件迴圈實作時,*delay* 不能超過一天。這" "在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:318 +#: ../../library/asyncio-eventloop.rst:324 msgid "" "Schedule *callback* to be called at the given absolute timestamp *when* (an " "int or a float), using the same time reference as :meth:`loop.time`." msgstr "" -"排程 *callback* 在給定的絕對時間戳 *when* (整數或浮點數)處呼叫,使用與 :" -"meth:`loop.time` 相同的時間參照。" +"排程 *callback* 在給定的絕對時間戳 *when* (整數或浮點數)處呼叫,使用" +"與 :meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:322 +#: ../../library/asyncio-eventloop.rst:328 msgid "This method's behavior is the same as :meth:`call_later`." msgstr "此方法的行為與 :meth:`call_later` 相同。" -#: ../../library/asyncio-eventloop.rst:329 +#: ../../library/asyncio-eventloop.rst:335 msgid "" "For performance, callbacks scheduled with :meth:`loop.call_at` may run up to " -"one clock-resolution early (see ``time.get_clock_info('monotonic')." -"resolution``)." +"one clock-resolution early (see " +"``time.get_clock_info('monotonic').resolution``)." msgstr "" -#: ../../library/asyncio-eventloop.rst:337 +#: ../../library/asyncio-eventloop.rst:343 msgid "" "In Python 3.7 and earlier with the default event loop implementation, the " "difference between *when* and the current time could not exceed one day. " @@ -549,13 +557,13 @@ msgstr "" "在 Python 3.7 及更早版本中,使用預設事件迴圈實作時,*when* 和目前時間之間的差" "值不能超過一天。這在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:344 +#: ../../library/asyncio-eventloop.rst:350 msgid "" "Return the current time, as a :class:`float` value, according to the event " "loop's internal monotonic clock." msgstr "根據事件迴圈的內部單調時鐘,回傳目前時間,以 :class:`float` 值表示。" -#: ../../library/asyncio-eventloop.rst:348 +#: ../../library/asyncio-eventloop.rst:354 msgid "" "In Python 3.7 and earlier timeouts (relative *delay* or absolute *when*) " "should not exceed one day. This has been fixed in Python 3.8." @@ -563,19 +571,19 @@ msgstr "" "在 Python 3.7 及更早版本中,超時(相對 *delay* 或絕對 *when*)不應超過一天。" "這在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:354 +#: ../../library/asyncio-eventloop.rst:360 msgid "The :func:`asyncio.sleep` function." msgstr "函式 :func:`asyncio.sleep`。" -#: ../../library/asyncio-eventloop.rst:358 +#: ../../library/asyncio-eventloop.rst:364 msgid "Creating Futures and Tasks" msgstr "建立 Futures 和 Tasks" -#: ../../library/asyncio-eventloop.rst:362 +#: ../../library/asyncio-eventloop.rst:368 msgid "Create an :class:`asyncio.Future` object attached to the event loop." msgstr "建立附加到事件迴圈的 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:364 +#: ../../library/asyncio-eventloop.rst:370 msgid "" "This is the preferred way to create Futures in asyncio. This lets third-" "party event loops provide alternative implementations of the Future object " @@ -584,73 +592,86 @@ msgstr "" "這是在 asyncio 中建立 Futures 的首選方式。這允許第三方事件迴圈提供 Future 物" "件的替代實作(具有更好的性能或儀器計測表現)。" -#: ../../library/asyncio-eventloop.rst:372 +#: ../../library/asyncio-eventloop.rst:378 msgid "" -"Schedule the execution of :ref:`coroutine ` *coro*. Return a :" -"class:`Task` object." +"Schedule the execution of :ref:`coroutine ` *coro*. Return " +"a :class:`Task` object." msgstr "排程執行\\ :ref:`協程 ` *coro*。回傳 :class:`Task` 物件。" -#: ../../library/asyncio-eventloop.rst:375 +#: ../../library/asyncio-eventloop.rst:381 msgid "" "Third-party event loops can use their own subclass of :class:`Task` for " -"interoperability. In this case, the result type is a subclass of :class:" -"`Task`." +"interoperability. In this case, the result type is a subclass " +"of :class:`Task`." msgstr "" "第三方事件迴圈可以使用其自己的 :class:`Task` 子類別以實現互操作性" "(interoperability)。在這種情況下,結果類型是 :class:`Task` 的子類別。" -#: ../../library/asyncio-eventloop.rst:379 +#: ../../library/asyncio-eventloop.rst:385 msgid "" "The full function signature is largely the same as that of the :class:`Task` " "constructor (or factory) - all of the keyword arguments to this function are " -"passed through to that interface, except *name*, or *context* if it is " -"``None``." +"passed through to that interface." msgstr "" -#: ../../library/asyncio-eventloop.rst:384 +#: ../../library/asyncio-eventloop.rst:389 msgid "" "If the *name* argument is provided and not ``None``, it is set as the name " "of the task using :meth:`Task.set_name`." msgstr "" -"如果提供了 *name* 引數且不為 ``None``,則將其設置為任務的名稱,使用 :meth:" -"`Task.set_name`。" +"如果提供了 *name* 引數且不為 ``None``,則將其設置為任務的名稱,使" +"用 :meth:`Task.set_name`。" -#: ../../library/asyncio-eventloop.rst:387 +#: ../../library/asyncio-eventloop.rst:392 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *coro* to run in. The current context " -"copy is created when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. The current " +"context copy is created when no *context* is provided." msgstr "" -"可選的僅限關鍵字 *context* 引數允許為 *coro* 指定自定義的 :class:" -"`contextvars.Context` 以提供運行。當未提供 *context* 時,將建立目前情境的副" -"本。" +"可選的僅限關鍵字 *context* 引數允許為 *coro* 指定自定義" +"的 :class:`contextvars.Context` 以提供運行。當未提供 *context* 時,將建立目前" +"情境的副本。" -#: ../../library/asyncio-eventloop.rst:391 +#: ../../library/asyncio-eventloop.rst:396 +msgid "" +"An optional keyword-only *eager_start* argument allows specifying if the " +"task should execute eagerly during the call to create_task, or be scheduled " +"later. If *eager_start* is not passed the mode set " +"by :meth:`loop.set_task_factory` will be used." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:401 msgid "Added the *name* parameter." msgstr "加入 *name* 參數。" -#: ../../library/asyncio-eventloop.rst:394 +#: ../../library/asyncio-eventloop.rst:404 msgid "Added the *context* parameter." msgstr "加入 *context* 參數。" -#: ../../library/asyncio-eventloop.rst:397 +#: ../../library/asyncio-eventloop.rst:407 msgid "" "Added ``kwargs`` which passes on arbitrary extra parameters, including " "``name`` and ``context``." msgstr "" -#: ../../library/asyncio-eventloop.rst:400 +#: ../../library/asyncio-eventloop.rst:410 msgid "" "Rolled back the change that passes on *name* and *context* (if it is None), " "while still passing on other arbitrary keyword arguments (to avoid breaking " "backwards compatibility with 3.13.3)." msgstr "" -#: ../../library/asyncio-eventloop.rst:406 +#: ../../library/asyncio-eventloop.rst:414 +msgid "" +"All *kwargs* are now passed on. The *eager_start* parameter works with eager " +"task factories." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:419 msgid "Set a task factory that will be used by :meth:`loop.create_task`." msgstr "設置將由 :meth:`loop.create_task` 使用的任務工廠。" -#: ../../library/asyncio-eventloop.rst:409 +#: ../../library/asyncio-eventloop.rst:422 msgid "" "If *factory* is ``None`` the default task factory will be set. Otherwise, " "*factory* must be a *callable* with the signature matching ``(loop, coro, " @@ -663,46 +684,52 @@ msgstr "" "迴圈的參照、*coro* 是一個協程物件。該可呼叫物件必須傳遞所有 *kwargs* 並回傳一" "個與 :class:`asyncio.Task` 相容的物件。" -#: ../../library/asyncio-eventloop.rst:415 +#: ../../library/asyncio-eventloop.rst:428 msgid "Required that all *kwargs* are passed on to :class:`asyncio.Task`." msgstr "" -#: ../../library/asyncio-eventloop.rst:418 +#: ../../library/asyncio-eventloop.rst:431 msgid "" "*name* is no longer passed to task factories. *context* is no longer passed " "to task factories if it is ``None``." msgstr "" -#: ../../library/asyncio-eventloop.rst:424 +#: ../../library/asyncio-eventloop.rst:435 +msgid "" +"*name* and *context* are now unconditionally passed on to task factories " +"again." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:440 msgid "Return a task factory or ``None`` if the default one is in use." msgstr "回傳任務工廠,如果使用預設任務工廠則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:428 +#: ../../library/asyncio-eventloop.rst:444 msgid "Opening network connections" msgstr "打開網路連線" -#: ../../library/asyncio-eventloop.rst:440 +#: ../../library/asyncio-eventloop.rst:456 msgid "" "Open a streaming transport connection to a given address specified by *host* " "and *port*." msgstr "打開以 *host* 和 *port* 指定之給定地址的串流傳輸連線。" -#: ../../library/asyncio-eventloop.rst:443 +#: ../../library/asyncio-eventloop.rst:459 msgid "" -"The socket family can be either :py:const:`~socket.AF_INET` or :py:const:" -"`~socket.AF_INET6` depending on *host* (or the *family* argument, if " -"provided)." +"The socket family can be either :py:const:`~socket.AF_INET` " +"or :py:const:`~socket.AF_INET6` depending on *host* (or the *family* " +"argument, if provided)." msgstr "" -"根據 *host*(或提供的 *family* 引數)的情況,socket 家族可以是 :py:const:" -"`~socket.AF_INET` 或 :py:const:`~socket.AF_INET6`。" +"根據 *host*(或提供的 *family* 引數)的情況,socket 家族可以" +"是 :py:const:`~socket.AF_INET` 或 :py:const:`~socket.AF_INET6`。" -#: ../../library/asyncio-eventloop.rst:447 +#: ../../library/asyncio-eventloop.rst:463 msgid "The socket type will be :py:const:`~socket.SOCK_STREAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_STREAM`。" -#: ../../library/asyncio-eventloop.rst:449 -#: ../../library/asyncio-eventloop.rst:1248 -#: ../../library/asyncio-eventloop.rst:1265 +#: ../../library/asyncio-eventloop.rst:465 +#: ../../library/asyncio-eventloop.rst:1264 +#: ../../library/asyncio-eventloop.rst:1281 msgid "" "*protocol_factory* must be a callable returning an :ref:`asyncio protocol " "` implementation." @@ -710,70 +737,70 @@ msgstr "" "*protocol_factory* 必須是一個回傳 :ref:`asyncio protocol ` " "實作的可呼叫函式。" -#: ../../library/asyncio-eventloop.rst:452 +#: ../../library/asyncio-eventloop.rst:468 msgid "" "This method will try to establish the connection in the background. When " "successful, it returns a ``(transport, protocol)`` pair." msgstr "" "此方法將嘗試在背景建立連線。成功時,它將回傳一對 ``(transport, protocol)``。" -#: ../../library/asyncio-eventloop.rst:455 +#: ../../library/asyncio-eventloop.rst:471 msgid "The chronological synopsis of the underlying operation is as follows:" msgstr "底層操作的時間軸簡介如下:" -#: ../../library/asyncio-eventloop.rst:457 +#: ../../library/asyncio-eventloop.rst:473 msgid "" "The connection is established and a :ref:`transport ` is " "created for it." msgstr "建立連線並為其建立\\ :ref:`傳輸 `。" -#: ../../library/asyncio-eventloop.rst:460 +#: ../../library/asyncio-eventloop.rst:476 msgid "" -"*protocol_factory* is called without arguments and is expected to return a :" -"ref:`protocol ` instance." +"*protocol_factory* is called without arguments and is expected to return " +"a :ref:`protocol ` instance." msgstr "" "*protocol_factory* 在無引數的情況下被呼叫,並且預計回傳一個 :ref:`協定 " "` 實例。" -#: ../../library/asyncio-eventloop.rst:463 +#: ../../library/asyncio-eventloop.rst:479 msgid "" -"The protocol instance is coupled with the transport by calling its :meth:" -"`~BaseProtocol.connection_made` method." +"The protocol instance is coupled with the transport by calling " +"its :meth:`~BaseProtocol.connection_made` method." msgstr "" "通過呼叫其 :meth:`~BaseProtocol.connection_made` 方法,將協定實例與傳輸連線在" "一起。" -#: ../../library/asyncio-eventloop.rst:466 +#: ../../library/asyncio-eventloop.rst:482 msgid "A ``(transport, protocol)`` tuple is returned on success." msgstr "成功時回傳一個 ``(transport, protocol)`` 元組。" -#: ../../library/asyncio-eventloop.rst:468 +#: ../../library/asyncio-eventloop.rst:484 msgid "" "The created transport is an implementation-dependent bidirectional stream." msgstr "建立的傳輸是一個依賴實作的雙向串流。" -#: ../../library/asyncio-eventloop.rst:471 -#: ../../library/asyncio-eventloop.rst:604 +#: ../../library/asyncio-eventloop.rst:487 +#: ../../library/asyncio-eventloop.rst:620 msgid "Other arguments:" msgstr "其他引數:" -#: ../../library/asyncio-eventloop.rst:473 +#: ../../library/asyncio-eventloop.rst:489 msgid "" "*ssl*: if given and not false, a SSL/TLS transport is created (by default a " "plain TCP transport is created). If *ssl* is a :class:`ssl.SSLContext` " -"object, this context is used to create the transport; if *ssl* is :const:" -"`True`, a default context returned from :func:`ssl.create_default_context` " -"is used." +"object, this context is used to create the transport; if *ssl* " +"is :const:`True`, a default context returned " +"from :func:`ssl.create_default_context` is used." msgstr "" "若有給定 *ssl* 且非 false,將建立 SSL/TLS 傳輸(預設建立普通 TCP 傳輸)。如" "果 *ssl* 為 :class:`ssl.SSLContext` 物件,則使用該情境來建立傳輸;如果 *ssl* " "為 :const:`True`,則使用 :func:`ssl.create_default_context` 回傳的預設情境。" -#: ../../library/asyncio-eventloop.rst:479 +#: ../../library/asyncio-eventloop.rst:495 msgid ":ref:`SSL/TLS security considerations `" msgstr ":ref:`SSL/TLS 安全考量 `" -#: ../../library/asyncio-eventloop.rst:481 +#: ../../library/asyncio-eventloop.rst:497 msgid "" "*server_hostname* sets or overrides the hostname that the target server's " "certificate will be matched against. Should only be passed if *ssl* is not " @@ -788,7 +815,7 @@ msgstr "" "預設值,必須傳遞 *server_hostname* 的值。若 *server_hostname* 為空字串,將停" "用主機名稱匹配(這是一個嚴重的安全風險,可能導致中間人攻擊)。" -#: ../../library/asyncio-eventloop.rst:489 +#: ../../library/asyncio-eventloop.rst:505 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to getaddrinfo() for *host* resolution. If given, " @@ -799,7 +826,7 @@ msgstr "" "getaddrinfo() 進行 *host* 解析。若有給定這些應該都是相應 :mod:`socket` 模組常" "數的整數。" -#: ../../library/asyncio-eventloop.rst:494 +#: ../../library/asyncio-eventloop.rst:510 msgid "" "*happy_eyeballs_delay*, if given, enables Happy Eyeballs for this " "connection. It should be a floating-point number representing the amount of " @@ -809,11 +836,11 @@ msgid "" "the RFC is ``0.25`` (250 milliseconds)." msgstr "" "若有給定,*happy_eyeballs_delay* 會啟用此連線的 Happy Eyeballs。它應該是一個" -"浮點數,表示等待連線嘗試完成的秒數,然後在並行啟動下一次嘗試。這是 :rfc:" -"`8305` 中定義的「連線嘗試延遲」。RFC 建議的合理預設值為 ``0.25`` 秒(250 毫" -"秒)。" +"浮點數,表示等待連線嘗試完成的秒數,然後在並行啟動下一次嘗試。這" +"是 :rfc:`8305` 中定義的「連線嘗試延遲」。RFC 建議的合理預設值為 ``0.25`` 秒" +"(250 毫秒)。" -#: ../../library/asyncio-eventloop.rst:502 +#: ../../library/asyncio-eventloop.rst:518 msgid "" "*interleave* controls address reordering when a host name resolves to " "multiple IP addresses. If ``0`` or unspecified, no reordering is done, and " @@ -829,29 +856,29 @@ msgstr "" "族計數」。如果未指定 *happy_eyeballs_delay*,則預設值為 ``0``,如果指定則為 " "``1``。" -#: ../../library/asyncio-eventloop.rst:511 +#: ../../library/asyncio-eventloop.rst:527 msgid "" -"*sock*, if given, should be an existing, already connected :class:`socket." -"socket` object to be used by the transport. If *sock* is given, none of " -"*host*, *port*, *family*, *proto*, *flags*, *happy_eyeballs_delay*, " -"*interleave* and *local_addr* should be specified." +"*sock*, if given, should be an existing, already " +"connected :class:`socket.socket` object to be used by the transport. If " +"*sock* is given, none of *host*, *port*, *family*, *proto*, *flags*, " +"*happy_eyeballs_delay*, *interleave* and *local_addr* should be specified." msgstr "" "若有給定 *sock* 則其應為已存在且已連線的 :class:`socket.socket` 物件,可供傳" "輸使用。如果提供了 *sock*,則不應指定 *host*、*port*、*family*、*proto*、" "*flags*、*happy_eyeballs_delay*、*interleave* 和 *local_addr* 中的任何一項。" -#: ../../library/asyncio-eventloop.rst:519 -#: ../../library/asyncio-eventloop.rst:641 -#: ../../library/asyncio-eventloop.rst:889 +#: ../../library/asyncio-eventloop.rst:535 +#: ../../library/asyncio-eventloop.rst:657 +#: ../../library/asyncio-eventloop.rst:905 msgid "" "The *sock* argument transfers ownership of the socket to the transport " -"created. To close the socket, call the transport's :meth:`~asyncio." -"BaseTransport.close` method." +"created. To close the socket, call the " +"transport's :meth:`~asyncio.BaseTransport.close` method." msgstr "" -"引數 *sock* 將 socket 所有權轉移給所建立的傳輸 socket,請呼叫傳輸的 :meth:" -"`~asyncio.BaseTransport.close` 方法。" +"引數 *sock* 將 socket 所有權轉移給所建立的傳輸 socket,請呼叫傳輸" +"的 :meth:`~asyncio.BaseTransport.close` 方法。" -#: ../../library/asyncio-eventloop.rst:523 +#: ../../library/asyncio-eventloop.rst:539 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " "the socket locally. The *local_host* and *local_port* are looked up using " @@ -861,8 +888,8 @@ msgstr "" "地綁定 socket。將使用 ``getaddrinfo()`` 查找 *local_host* 和 *local_port*,方" "式類似於 *host* 和 *port*。" -#: ../../library/asyncio-eventloop.rst:527 -#: ../../library/asyncio-eventloop.rst:985 +#: ../../library/asyncio-eventloop.rst:543 +#: ../../library/asyncio-eventloop.rst:1001 msgid "" "*ssl_handshake_timeout* is (for a TLS connection) the time in seconds to " "wait for the TLS handshake to complete before aborting the connection. " @@ -872,10 +899,10 @@ msgstr "" "在那之前若未完成則會中斷連線。如果為 ``None`` (預設值),則會等待 ``60.0`` " "秒。" -#: ../../library/asyncio-eventloop.rst:531 -#: ../../library/asyncio-eventloop.rst:796 -#: ../../library/asyncio-eventloop.rst:900 -#: ../../library/asyncio-eventloop.rst:989 +#: ../../library/asyncio-eventloop.rst:547 +#: ../../library/asyncio-eventloop.rst:812 +#: ../../library/asyncio-eventloop.rst:916 +#: ../../library/asyncio-eventloop.rst:1005 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " @@ -884,7 +911,7 @@ msgstr "" "*ssl_shutdown_timeout* 是等待 SSL 關閉完成以前中斷連線的時間,以秒為單位。如" "果為 ``None`` (預設值),則會等待 ``30.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:535 +#: ../../library/asyncio-eventloop.rst:551 msgid "" "*all_errors* determines what exceptions are raised when a connection cannot " "be created. By default, only a single ``Exception`` is raised: the first " @@ -898,12 +925,12 @@ msgstr "" "包含所有錯誤訊息的單一 ``OSError``。當 ``all_errors`` 為 ``True`` 時,將引發" "包含所有例外的 ``ExceptionGroup`` (即使只有一個例外)。" -#: ../../library/asyncio-eventloop.rst:545 -#: ../../library/asyncio-eventloop.rst:808 +#: ../../library/asyncio-eventloop.rst:561 +#: ../../library/asyncio-eventloop.rst:824 msgid "Added support for SSL/TLS in :class:`ProactorEventLoop`." msgstr "新增 :class:`ProactorEventLoop` 中的 SSL/TLS 支援。" -#: ../../library/asyncio-eventloop.rst:549 +#: ../../library/asyncio-eventloop.rst:565 msgid "" "The socket option :ref:`socket.TCP_NODELAY ` is set " "by default for all TCP connections." @@ -911,16 +938,16 @@ msgstr "" "所有 TCP 連線都預設有 :ref:`socket.TCP_NODELAY ` " "socket 選項。" -#: ../../library/asyncio-eventloop.rst:554 -#: ../../library/asyncio-eventloop.rst:910 +#: ../../library/asyncio-eventloop.rst:570 +#: ../../library/asyncio-eventloop.rst:926 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "增加 *ssl_handshake_timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:558 +#: ../../library/asyncio-eventloop.rst:574 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "加入 *happy_eyeballs_delay* 和 *interleave* 參數。" -#: ../../library/asyncio-eventloop.rst:560 +#: ../../library/asyncio-eventloop.rst:576 msgid "" "Happy Eyeballs Algorithm: Success with Dual-Stack Hosts. When a server's " "IPv4 path and protocol are working, but the server's IPv6 path and protocol " @@ -936,53 +963,55 @@ msgstr "" "用戶端的使用者體驗變差。本文件具體說明了減少此用戶可見延遲的演算法要求並提供" "了一種演算法。" -#: ../../library/asyncio-eventloop.rst:569 +#: ../../library/asyncio-eventloop.rst:585 msgid "For more information: https://datatracker.ietf.org/doc/html/rfc6555" msgstr "更多資訊請見: https://datatracker.ietf.org/doc/html/rfc6555" -#: ../../library/asyncio-eventloop.rst:573 -#: ../../library/asyncio-eventloop.rst:705 -#: ../../library/asyncio-eventloop.rst:822 -#: ../../library/asyncio-eventloop.rst:862 -#: ../../library/asyncio-eventloop.rst:914 -#: ../../library/asyncio-eventloop.rst:997 +#: ../../library/asyncio-eventloop.rst:589 +#: ../../library/asyncio-eventloop.rst:721 +#: ../../library/asyncio-eventloop.rst:838 +#: ../../library/asyncio-eventloop.rst:878 +#: ../../library/asyncio-eventloop.rst:930 +#: ../../library/asyncio-eventloop.rst:1013 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "增加 *ssl_shutdown_timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:575 +#: ../../library/asyncio-eventloop.rst:591 msgid "*all_errors* was added." msgstr "已新增 *all_errors*。" -#: ../../library/asyncio-eventloop.rst:580 +#: ../../library/asyncio-eventloop.rst:596 msgid "" "The :func:`open_connection` function is a high-level alternative API. It " "returns a pair of (:class:`StreamReader`, :class:`StreamWriter`) that can be " "used directly in async/await code." msgstr "" -"函式 :func:`open_connection` 是高階的替代 API。它回傳一對 (:class:" -"`StreamReader`, :class:`StreamWriter`) 可直接在 async/await 程式碼中使用。" +"函式 :func:`open_connection` 是高階的替代 API。它回傳一對 " +"(:class:`StreamReader`, :class:`StreamWriter`) 可直接在 async/await 程式碼中" +"使用。" -#: ../../library/asyncio-eventloop.rst:591 +#: ../../library/asyncio-eventloop.rst:607 msgid "Create a datagram connection." msgstr "建立一個資料報連線。" -#: ../../library/asyncio-eventloop.rst:593 +#: ../../library/asyncio-eventloop.rst:609 msgid "" -"The socket family can be either :py:const:`~socket.AF_INET`, :py:const:" -"`~socket.AF_INET6`, or :py:const:`~socket.AF_UNIX`, depending on *host* (or " -"the *family* argument, if provided)." +"The socket family can be " +"either :py:const:`~socket.AF_INET`, :py:const:`~socket.AF_INET6`, " +"or :py:const:`~socket.AF_UNIX`, depending on *host* (or the *family* " +"argument, if provided)." msgstr "" "Socket 家族可以是 :py:const:`~socket.AF_INET`、:py:const:`~socket.AF_INET6` " "或 :py:const:`~socket.AF_UNIX`,視乎 *host*\\ (或提供的 *family* 引數)而" "定。" -#: ../../library/asyncio-eventloop.rst:597 +#: ../../library/asyncio-eventloop.rst:613 msgid "The socket type will be :py:const:`~socket.SOCK_DGRAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_DGRAM`。" -#: ../../library/asyncio-eventloop.rst:599 -#: ../../library/asyncio-eventloop.rst:732 -#: ../../library/asyncio-eventloop.rst:881 +#: ../../library/asyncio-eventloop.rst:615 +#: ../../library/asyncio-eventloop.rst:748 +#: ../../library/asyncio-eventloop.rst:897 msgid "" "*protocol_factory* must be a callable returning a :ref:`protocol ` implementation." @@ -990,37 +1019,38 @@ msgstr "" "*protocol_factory* 必須是可呼叫的函式,回傳 :ref:`protocol ` 實作。" -#: ../../library/asyncio-eventloop.rst:602 -#: ../../library/asyncio-eventloop.rst:687 +#: ../../library/asyncio-eventloop.rst:618 +#: ../../library/asyncio-eventloop.rst:703 msgid "A tuple of ``(transport, protocol)`` is returned on success." msgstr "成功時回傳 ``(transport, protocol)`` 元組。" -#: ../../library/asyncio-eventloop.rst:606 +#: ../../library/asyncio-eventloop.rst:622 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " -"the socket locally. The *local_host* and *local_port* are looked up using :" -"meth:`getaddrinfo`." +"the socket locally. The *local_host* and *local_port* are looked up " +"using :meth:`getaddrinfo`." msgstr "" "*local_addr*,如果提供,是一個 ``(local_host, local_port)`` 元組,用於在本地" "綁定 socket。*local_host* 和 *local_port* 使用 :meth:`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:612 +#: ../../library/asyncio-eventloop.rst:628 msgid "" -"On Windows, when using the proactor event loop with ``local_addr=None``, an :" -"exc:`OSError` with :attr:`!errno.WSAEINVAL` will be raised when running it." +"On Windows, when using the proactor event loop with ``local_addr=None``, " +"an :exc:`OSError` with :attr:`!errno.WSAEINVAL` will be raised when running " +"it." msgstr "" -#: ../../library/asyncio-eventloop.rst:616 +#: ../../library/asyncio-eventloop.rst:632 msgid "" "*remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used to " "connect the socket to a remote address. The *remote_host* and *remote_port* " "are looked up using :meth:`getaddrinfo`." msgstr "" "*remote_addr*,如果提供,是一個 ``(remote_host, remote_port)`` 元組,用於將 " -"socket 連線到遠端位址。 *remote_host* 和 *remote_port* 使用 :meth:" -"`getaddrinfo` 來查找。" +"socket 連線到遠端位址。 *remote_host* 和 *remote_port* 使" +"用 :meth:`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:620 +#: ../../library/asyncio-eventloop.rst:636 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to :meth:`getaddrinfo` for *host* resolution. If " @@ -1031,7 +1061,7 @@ msgstr "" "的可選地址家族、協定和旗標。如果提供,這些應該都是來自相應的 :mod:`socket` 模" "組常數的整數。" -#: ../../library/asyncio-eventloop.rst:625 +#: ../../library/asyncio-eventloop.rst:641 msgid "" "*reuse_port* tells the kernel to allow this endpoint to be bound to the same " "port as other existing endpoints are bound to, so long as they all set this " @@ -1040,35 +1070,36 @@ msgid "" "is not defined then this capability is unsupported." msgstr "" "*reuse_port* 告訴核心允許將此端點綁定到與其他現有端點相同的埠,只要它們在建立" -"時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定義 :py:" -"const:`~socket.SO_REUSEPORT` 常數,則不支援此功能。" +"時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定" +"義 :py:const:`~socket.SO_REUSEPORT` 常數,則不支援此功能。" -#: ../../library/asyncio-eventloop.rst:631 +#: ../../library/asyncio-eventloop.rst:647 msgid "" "*allow_broadcast* tells the kernel to allow this endpoint to send messages " "to the broadcast address." msgstr "*allow_broadcast* 告訴核心允許此端點向廣播位址發送訊息。" -#: ../../library/asyncio-eventloop.rst:634 +#: ../../library/asyncio-eventloop.rst:650 msgid "" "*sock* can optionally be specified in order to use a preexisting, already " "connected, :class:`socket.socket` object to be used by the transport. If " -"specified, *local_addr* and *remote_addr* should be omitted (must be :const:" -"`None`)." +"specified, *local_addr* and *remote_addr* should be omitted (must " +"be :const:`None`)." msgstr "" "*sock* 可以選擇性地指定,以使用預先存在且已連線的 :class:`socket.socket` 物件" -"供傳輸使用。如果指定,*local_addr* 和 *remote_addr* 應省略(必須是 :const:" -"`None`\\ )。" +"供傳輸使用。如果指定,*local_addr* 和 *remote_addr* 應省略(必須" +"是 :const:`None`\\ )。" -#: ../../library/asyncio-eventloop.rst:645 +#: ../../library/asyncio-eventloop.rst:661 msgid "" -"See :ref:`UDP echo client protocol ` and :" -"ref:`UDP echo server protocol ` examples." +"See :ref:`UDP echo client protocol ` " +"and :ref:`UDP echo server protocol ` " +"examples." msgstr "" -"請參閱 :ref:`UDP 回應用戶端協定 ` 和 :ref:" -"`UDP 回應伺服器協定 ` 範例。" +"請參閱 :ref:`UDP 回應用戶端協定 ` " +"和 :ref:`UDP 回應伺服器協定 ` 範例。" -#: ../../library/asyncio-eventloop.rst:648 +#: ../../library/asyncio-eventloop.rst:664 msgid "" "The *family*, *proto*, *flags*, *reuse_address*, *reuse_port*, " "*allow_broadcast*, and *sock* parameters were added." @@ -1076,20 +1107,21 @@ msgstr "" "新增 *family*、*proto*、*flags*、*reuse_address*、*reuse_port*、" "*allow_broadcast* 和 *sock* 參數。" -#: ../../library/asyncio-eventloop.rst:652 +#: ../../library/asyncio-eventloop.rst:668 msgid "Added support for Windows." msgstr "新增對於 Windows 的支援。" -#: ../../library/asyncio-eventloop.rst:655 +#: ../../library/asyncio-eventloop.rst:671 msgid "" -"The *reuse_address* parameter is no longer supported, as using :ref:`socket." -"SO_REUSEADDR ` poses a significant security concern " -"for UDP. Explicitly passing ``reuse_address=True`` will raise an exception." +"The *reuse_address* parameter is no longer supported, as " +"using :ref:`socket.SO_REUSEADDR ` poses a significant " +"security concern for UDP. Explicitly passing ``reuse_address=True`` will " +"raise an exception." msgstr "" "不再支援 *reuse_address* 參數,因為使用 :py:const:`~sockets.SO_REUSEADDR` 對" "於 UDP 存有重大的安全疑慮。明確傳遞 ``reuse_address=True`` 將引發例外。" -#: ../../library/asyncio-eventloop.rst:661 +#: ../../library/asyncio-eventloop.rst:677 msgid "" "When multiple processes with differing UIDs assign sockets to an identical " "UDP socket address with ``SO_REUSEADDR``, incoming packets can become " @@ -1098,7 +1130,7 @@ msgstr "" "當具有不同 UID 的多個行程使用 ``SO_REUSEADDR`` 將 socket 分配給相同的 UDP " "socket 地址時,傳入的封包可能會在 socket 之間隨機分佈。" -#: ../../library/asyncio-eventloop.rst:665 +#: ../../library/asyncio-eventloop.rst:681 msgid "" "For supported platforms, *reuse_port* can be used as a replacement for " "similar functionality. With *reuse_port*, :ref:`socket.SO_REUSEPORT ` is set by default " "for all TCP connections." msgstr "" -"新增 *ssl_handshake_timeout* 與 *start_serving* 參數。所有 TCP 連線都預設有 :" -"ref:`socket.TCP_NODELAY ` socket 選項。" +"新增 *ssl_handshake_timeout* 與 *start_serving* 參數。所有 TCP 連線都預設" +"有 :ref:`socket.TCP_NODELAY ` socket 選項。" -#: ../../library/asyncio-eventloop.rst:826 +#: ../../library/asyncio-eventloop.rst:842 msgid "" "The :func:`start_server` function is a higher-level alternative API that " "returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can " "be used in an async/await code." msgstr "" -":func:`start_server` 函式是一個更高階的替代 API,它回傳一對 :class:" -"`StreamReader` 和 :class:`StreamWriter`,可以在 async/await 程式碼中使用。" +":func:`start_server` 函式是一個更高階的替代 API,它回傳一" +"對 :class:`StreamReader` 和 :class:`StreamWriter`,可以在 async/await 程式碼" +"中使用。" -#: ../../library/asyncio-eventloop.rst:838 +#: ../../library/asyncio-eventloop.rst:854 msgid "" -"Similar to :meth:`loop.create_server` but works with the :py:const:`~socket." -"AF_UNIX` socket family." +"Similar to :meth:`loop.create_server` but works with " +"the :py:const:`~socket.AF_UNIX` socket family." msgstr "" "類似 :meth:`loop.create_server`,但適用於 :py:const:`~socket.AF_UNIX` socket " "家族。" -#: ../../library/asyncio-eventloop.rst:841 +#: ../../library/asyncio-eventloop.rst:857 msgid "" "*path* is the name of a Unix domain socket, and is required, unless a *sock* " "argument is provided. Abstract Unix sockets, :class:`str`, :class:`bytes`, " @@ -1351,7 +1386,7 @@ msgstr "" "象 Unix sockets、:class:`str`、:class:`bytes` 和 :class:`~pathlib.Path` 路" "徑。" -#: ../../library/asyncio-eventloop.rst:846 +#: ../../library/asyncio-eventloop.rst:862 msgid "" "If *cleanup_socket* is true then the Unix socket will automatically be " "removed from the filesystem when the server is closed, unless the socket has " @@ -1360,13 +1395,13 @@ msgstr "" "如果 *cleanup_socket* 為真,則 Unix socket 將在伺服器關閉時自動從檔案系統中刪" "除,除非在建立伺服器後替換了 socket。" -#: ../../library/asyncio-eventloop.rst:850 +#: ../../library/asyncio-eventloop.rst:866 msgid "" "See the documentation of the :meth:`loop.create_server` method for " "information about arguments to this method." msgstr "有關此方法的引數資訊,請參閱 :meth:`loop.create_server` 方法的文件。" -#: ../../library/asyncio-eventloop.rst:857 +#: ../../library/asyncio-eventloop.rst:873 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :class:`~pathlib.Path` object." @@ -1374,26 +1409,26 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。*path* 參數現在可為一" "個 :class:`~pathlib.Path` 物件。" -#: ../../library/asyncio-eventloop.rst:866 +#: ../../library/asyncio-eventloop.rst:882 msgid "Added the *cleanup_socket* parameter." msgstr "加入 *cleanup_socket* 參數。" -#: ../../library/asyncio-eventloop.rst:874 +#: ../../library/asyncio-eventloop.rst:890 msgid "Wrap an already accepted connection into a transport/protocol pair." msgstr "將已接受的連線包裝成傳輸層/協定對。" -#: ../../library/asyncio-eventloop.rst:876 +#: ../../library/asyncio-eventloop.rst:892 msgid "" "This method can be used by servers that accept connections outside of " "asyncio but that use asyncio to handle them." msgstr "此方法可以由在 asyncio 外接受連線但使用 asyncio 處理連線的伺服器使用。" -#: ../../library/asyncio-eventloop.rst:879 -#: ../../library/asyncio-eventloop.rst:971 +#: ../../library/asyncio-eventloop.rst:895 +#: ../../library/asyncio-eventloop.rst:987 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-eventloop.rst:884 +#: ../../library/asyncio-eventloop.rst:900 msgid "" "*sock* is a preexisting socket object returned from :meth:`socket.accept " "`." @@ -1401,13 +1436,13 @@ msgstr "" "*sock* 是從 :meth:`socket.accept ` 回傳的預先存在的 " "socket 物件。" -#: ../../library/asyncio-eventloop.rst:893 +#: ../../library/asyncio-eventloop.rst:909 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the " "accepted connections." msgstr "*ssl* 可以設置為 :class:`~ssl.SSLContext` 以在已接受的連線上啟用 SSL。" -#: ../../library/asyncio-eventloop.rst:896 +#: ../../library/asyncio-eventloop.rst:912 msgid "" "*ssl_handshake_timeout* is (for an SSL connection) the time in seconds to " "wait for the SSL handshake to complete before aborting the connection. " @@ -1416,29 +1451,29 @@ msgstr "" "(對於 SSL 連線)\\ *ssl_handshake_timeout* 是在中斷連線之前等待 SSL 握手完成" "的時間(以秒為單位)。如果為 ``None``\\ (預設),則為 ``60.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:904 +#: ../../library/asyncio-eventloop.rst:920 msgid "Returns a ``(transport, protocol)`` pair." msgstr "回傳 ``(transport, protocol)`` 對。" -#: ../../library/asyncio-eventloop.rst:918 +#: ../../library/asyncio-eventloop.rst:934 msgid "Transferring files" msgstr "傳輸檔案" -#: ../../library/asyncio-eventloop.rst:924 +#: ../../library/asyncio-eventloop.rst:940 msgid "" "Send a *file* over a *transport*. Return the total number of bytes sent." msgstr "通過 *transport* 發送 *file*。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:927 +#: ../../library/asyncio-eventloop.rst:943 msgid "The method uses high-performance :meth:`os.sendfile` if available." msgstr "如果可用,該方法使用高性能 :meth:`os.sendfile`。" -#: ../../library/asyncio-eventloop.rst:929 +#: ../../library/asyncio-eventloop.rst:945 msgid "*file* must be a regular file object opened in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:931 -#: ../../library/asyncio-eventloop.rst:1192 +#: ../../library/asyncio-eventloop.rst:947 +#: ../../library/asyncio-eventloop.rst:1208 msgid "" "*offset* tells from where to start reading the file. If specified, *count* " "is the total number of bytes to transmit as opposed to sending the file " @@ -1450,7 +1485,7 @@ msgstr "" "不是發送檔案直到達到 EOF。即使此方法引發錯誤時,檔案位置也始終更新,可以使" "用 :meth:`file.tell() ` 取得實際發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:938 +#: ../../library/asyncio-eventloop.rst:954 msgid "" "*fallback* set to ``True`` makes asyncio to manually read and send the file " "when the platform does not support the sendfile system call (e.g. Windows or " @@ -1459,23 +1494,23 @@ msgstr "" "將 *fallback* 設置為 ``True`` 會使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:942 +#: ../../library/asyncio-eventloop.rst:958 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support the " "*sendfile* syscall and *fallback* is ``False``." msgstr "" -"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,則引發 :exc:" -"`SendfileNotAvailableError`。" +"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,則引" +"發 :exc:`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:949 +#: ../../library/asyncio-eventloop.rst:965 msgid "TLS Upgrade" msgstr "TLS 升級" -#: ../../library/asyncio-eventloop.rst:957 +#: ../../library/asyncio-eventloop.rst:973 msgid "Upgrade an existing transport-based connection to TLS." msgstr "將基於傳輸的現有連線升級到 TLS。" -#: ../../library/asyncio-eventloop.rst:959 +#: ../../library/asyncio-eventloop.rst:975 msgid "" "Create a TLS coder/decoder instance and insert it between the *transport* " "and the *protocol*. The coder/decoder implements both *transport*-facing " @@ -1484,7 +1519,7 @@ msgstr "" "建立 TLS 編解碼器實例並在 *transport* 和 *protocol* 之間插入它。編解碼器既實" "作了對於 *transport* 的協定,也實作了對於 *protocol* 的傳輸。" -#: ../../library/asyncio-eventloop.rst:963 +#: ../../library/asyncio-eventloop.rst:979 msgid "" "Return the created two-interface instance. After *await*, the *protocol* " "must stop using the original *transport* and communicate with the returned " @@ -1495,25 +1530,25 @@ msgstr "" "*transport*,僅與回傳的物件通信,因為編碼器快取了 *protocol* 端的資料,並且" "與 *transport* 間歇性地交換額外的 TLS session 封包。" -#: ../../library/asyncio-eventloop.rst:968 +#: ../../library/asyncio-eventloop.rst:984 msgid "" "In some situations (e.g. when the passed transport is already closing) this " "may return ``None``." msgstr "在某些情況下(例如傳入的傳輸已經關閉),此函式可能回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:973 +#: ../../library/asyncio-eventloop.rst:989 msgid "" -"*transport* and *protocol* instances that methods like :meth:`~loop." -"create_server` and :meth:`~loop.create_connection` return." +"*transport* and *protocol* instances that methods " +"like :meth:`~loop.create_server` and :meth:`~loop.create_connection` return." msgstr "" -"*transport* 和 *protocol* 實例,由像 :meth:`~loop.create_server` 和 :meth:" -"`~loop.create_connection` 等方法回傳。" +"*transport* 和 *protocol* 實例,由像 :meth:`~loop.create_server` " +"和 :meth:`~loop.create_connection` 等方法回傳。" -#: ../../library/asyncio-eventloop.rst:977 +#: ../../library/asyncio-eventloop.rst:993 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:配置好的 :class:`~ssl.SSLContext` 實例。" -#: ../../library/asyncio-eventloop.rst:979 +#: ../../library/asyncio-eventloop.rst:995 msgid "" "*server_side* pass ``True`` when a server-side connection is being upgraded " "(like the one created by :meth:`~loop.create_server`)." @@ -1521,17 +1556,17 @@ msgstr "" "當升級伺服器端連線時(像由 :meth:`~loop.create_server` 建立的那樣)傳遞 " "``True``。" -#: ../../library/asyncio-eventloop.rst:982 +#: ../../library/asyncio-eventloop.rst:998 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "*server_hostname*:設置或覆蓋將用於匹配目標伺服器憑證的主機名。" -#: ../../library/asyncio-eventloop.rst:1002 +#: ../../library/asyncio-eventloop.rst:1018 msgid "Watching file descriptors" msgstr "監視檔案描述器" -#: ../../library/asyncio-eventloop.rst:1006 +#: ../../library/asyncio-eventloop.rst:1022 msgid "" "Start monitoring the *fd* file descriptor for read availability and invoke " "*callback* with the specified arguments once *fd* is available for reading." @@ -1539,14 +1574,14 @@ msgstr "" "開始監視 *fd* 檔案描述器的讀取可用性,一但 *fd* 可讀取,使用指定引數叫用 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:1010 -#: ../../library/asyncio-eventloop.rst:1024 +#: ../../library/asyncio-eventloop.rst:1026 +#: ../../library/asyncio-eventloop.rst:1040 msgid "" "Any preexisting callback registered for *fd* is cancelled and replaced by " "*callback*." msgstr "任何預先存在、為 *fd* 註冊的回呼函式將被取消並替換為 *callback*。" -#: ../../library/asyncio-eventloop.rst:1015 +#: ../../library/asyncio-eventloop.rst:1031 msgid "" "Stop monitoring the *fd* file descriptor for read availability. Returns " "``True`` if *fd* was previously being monitored for reads." @@ -1554,7 +1589,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的讀取可用性。如果 *fd* 之前正在監視讀取,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:1020 +#: ../../library/asyncio-eventloop.rst:1036 msgid "" "Start monitoring the *fd* file descriptor for write availability and invoke " "*callback* with the specified arguments once *fd* is available for writing." @@ -1562,8 +1597,8 @@ msgstr "" "開始監視 *fd* 檔案描述器的寫入可用性,一旦 *fd* 可寫入,使用指定引數叫用 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:1027 -#: ../../library/asyncio-eventloop.rst:1305 +#: ../../library/asyncio-eventloop.rst:1043 +#: ../../library/asyncio-eventloop.rst:1321 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." @@ -1571,7 +1606,7 @@ msgstr "" "使用 :func:`functools.partial` 向 *callback* :ref:`傳送關鍵字引數 `。" -#: ../../library/asyncio-eventloop.rst:1032 +#: ../../library/asyncio-eventloop.rst:1048 msgid "" "Stop monitoring the *fd* file descriptor for write availability. Returns " "``True`` if *fd* was previously being monitored for writes." @@ -1579,7 +1614,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的寫入可用性。如果 *fd* 之前正在監視寫入,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:1035 +#: ../../library/asyncio-eventloop.rst:1051 msgid "" "See also :ref:`Platform Support ` section for some " "limitations of these methods." @@ -1587,47 +1622,47 @@ msgstr "" "另請參閱\\ :ref:`平台支援 `\\ 部分以了解這些方法的" "一些限制。" -#: ../../library/asyncio-eventloop.rst:1040 +#: ../../library/asyncio-eventloop.rst:1056 msgid "Working with socket objects directly" msgstr "直接使用 socket 物件" -#: ../../library/asyncio-eventloop.rst:1042 +#: ../../library/asyncio-eventloop.rst:1058 msgid "" -"In general, protocol implementations that use transport-based APIs such as :" -"meth:`loop.create_connection` and :meth:`loop.create_server` are faster than " -"implementations that work with sockets directly. However, there are some use " -"cases when performance is not critical, and working with :class:`~socket." -"socket` objects directly is more convenient." +"In general, protocol implementations that use transport-based APIs such " +"as :meth:`loop.create_connection` and :meth:`loop.create_server` are faster " +"than implementations that work with sockets directly. However, there are " +"some use cases when performance is not critical, and working " +"with :class:`~socket.socket` objects directly is more convenient." msgstr "" -"一般情況下,使用基於傳輸的 API(如 :meth:`loop.create_connection` 和 :meth:" -"`loop.create_server`)的協定實作比直接使用 socket 的實作更快。然而在某些情況" -"下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" +"一般情況下,使用基於傳輸的 API(如 :meth:`loop.create_connection` " +"和 :meth:`loop.create_server`)的協定實作比直接使用 socket 的實作更快。然而在" +"某些情況下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" -#: ../../library/asyncio-eventloop.rst:1052 +#: ../../library/asyncio-eventloop.rst:1068 msgid "" -"Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket." -"recv() `." +"Receive up to *nbytes* from *sock*. Asynchronous version " +"of :meth:`socket.recv() `." msgstr "" "從 *sock* 接收最多 *nbytes*。:meth:`socket.recv() ` 的非" "同步版本。" -#: ../../library/asyncio-eventloop.rst:1055 +#: ../../library/asyncio-eventloop.rst:1071 msgid "Return the received data as a bytes object." msgstr "將接收到的資料作為 bytes 物件回傳。" -#: ../../library/asyncio-eventloop.rst:1057 -#: ../../library/asyncio-eventloop.rst:1072 -#: ../../library/asyncio-eventloop.rst:1084 -#: ../../library/asyncio-eventloop.rst:1097 +#: ../../library/asyncio-eventloop.rst:1073 +#: ../../library/asyncio-eventloop.rst:1088 +#: ../../library/asyncio-eventloop.rst:1100 #: ../../library/asyncio-eventloop.rst:1113 #: ../../library/asyncio-eventloop.rst:1129 -#: ../../library/asyncio-eventloop.rst:1140 -#: ../../library/asyncio-eventloop.rst:1167 -#: ../../library/asyncio-eventloop.rst:1206 +#: ../../library/asyncio-eventloop.rst:1145 +#: ../../library/asyncio-eventloop.rst:1156 +#: ../../library/asyncio-eventloop.rst:1183 +#: ../../library/asyncio-eventloop.rst:1222 msgid "*sock* must be a non-blocking socket." msgstr "*sock* 必須是非阻塞 socket。" -#: ../../library/asyncio-eventloop.rst:1059 +#: ../../library/asyncio-eventloop.rst:1075 msgid "" "Even though this method was always documented as a coroutine method, " "releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this " @@ -1636,51 +1671,52 @@ msgstr "" "儘管此方法一直記錄為協程方法,但 Python 3.7 之前的版本回傳 :class:`Future`。" "自 Python 3.7 起,這是 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1067 +#: ../../library/asyncio-eventloop.rst:1083 msgid "" -"Receive data from *sock* into the *buf* buffer. Modeled after the blocking :" -"meth:`socket.recv_into() ` method." +"Receive data from *sock* into the *buf* buffer. Modeled after the " +"blocking :meth:`socket.recv_into() ` method." msgstr "" "從 *sock* 接收資料到 *buf* 緩衝區。仿照阻塞 :meth:`socket.recv_into() " "` 方法。" -#: ../../library/asyncio-eventloop.rst:1070 +#: ../../library/asyncio-eventloop.rst:1086 msgid "Return the number of bytes written to the buffer." msgstr "回傳寫入緩衝區位元組的數目。" -#: ../../library/asyncio-eventloop.rst:1079 +#: ../../library/asyncio-eventloop.rst:1095 msgid "" -"Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :" -"meth:`socket.recvfrom() `." +"Receive a datagram of up to *bufsize* from *sock*. Asynchronous version " +"of :meth:`socket.recvfrom() `." msgstr "" "從 *sock* 接收最多 *bufsize* 大小的資料單元。:meth:`socket.recvfrom() " "` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1082 +#: ../../library/asyncio-eventloop.rst:1098 msgid "Return a tuple of (received data, remote address)." msgstr "回傳一個元組 (received data, remote address)。" -#: ../../library/asyncio-eventloop.rst:1091 +#: ../../library/asyncio-eventloop.rst:1107 msgid "" "Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " "version of :meth:`socket.recvfrom_into() `." msgstr "" -"從 *sock* 接收最多 *nbytes* 大小的資料單元到 *buf*。:meth:`socket." -"recvfrom_into() ` 的非同步版本。" +"從 *sock* 接收最多 *nbytes* 大小的資料單元到 " +"*buf*。:meth:`socket.recvfrom_into() ` 的非同步" +"版本。" -#: ../../library/asyncio-eventloop.rst:1095 +#: ../../library/asyncio-eventloop.rst:1111 msgid "Return a tuple of (number of bytes received, remote address)." msgstr "回傳一個元組 (number of bytes received, remote address)。" -#: ../../library/asyncio-eventloop.rst:1104 +#: ../../library/asyncio-eventloop.rst:1120 msgid "" -"Send *data* to the *sock* socket. Asynchronous version of :meth:`socket." -"sendall() `." +"Send *data* to the *sock* socket. Asynchronous version " +"of :meth:`socket.sendall() `." msgstr "" -"將 *data* 發送到 *sock* socket。:meth:`socket.sendall() ` 的非同步版本。" +"將 *data* 發送到 *sock* socket。:meth:`socket.sendall() " +"` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1107 +#: ../../library/asyncio-eventloop.rst:1123 msgid "" "This method continues to send to the socket until either all data in *data* " "has been sent or an error occurs. ``None`` is returned on success. On " @@ -1692,8 +1728,8 @@ msgstr "" "回傳 ``None``。錯誤時引發例外。此外,沒有辦法確定接收端成功處理了多少資料(如" "果有的話)。" -#: ../../library/asyncio-eventloop.rst:1115 -#: ../../library/asyncio-eventloop.rst:1169 +#: ../../library/asyncio-eventloop.rst:1131 +#: ../../library/asyncio-eventloop.rst:1185 msgid "" "Even though the method was always documented as a coroutine method, before " "Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " @@ -1702,39 +1738,39 @@ msgstr "" "儘管該方法一直被記錄為協程方法,但在 Python 3.7 之前它回傳 :class:`Future`。" "從 Python 3.7 開始,這是一個 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1123 +#: ../../library/asyncio-eventloop.rst:1139 msgid "" -"Send a datagram from *sock* to *address*. Asynchronous version of :meth:" -"`socket.sendto() `." +"Send a datagram from *sock* to *address*. Asynchronous version " +"of :meth:`socket.sendto() `." msgstr "" -"從 *sock* 向 *address* 發送一個資料單元。:meth:`socket.sendto() ` 的非同步版本。" +"從 *sock* 向 *address* 發送一個資料單元。:meth:`socket.sendto() " +"` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1127 +#: ../../library/asyncio-eventloop.rst:1143 msgid "Return the number of bytes sent." msgstr "回傳發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:1136 +#: ../../library/asyncio-eventloop.rst:1152 msgid "Connect *sock* to a remote socket at *address*." msgstr "將 *sock* 連線到位於 *address* 的遠端 socket。" -#: ../../library/asyncio-eventloop.rst:1138 +#: ../../library/asyncio-eventloop.rst:1154 msgid "" "Asynchronous version of :meth:`socket.connect() `." msgstr ":meth:`socket.connect() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1142 +#: ../../library/asyncio-eventloop.rst:1158 msgid "" "``address`` no longer needs to be resolved. ``sock_connect`` will try to " -"check if the *address* is already resolved by calling :func:`socket." -"inet_pton`. If not, :meth:`loop.getaddrinfo` will be used to resolve the " -"*address*." +"check if the *address* is already resolved by " +"calling :func:`socket.inet_pton`. If not, :meth:`loop.getaddrinfo` will be " +"used to resolve the *address*." msgstr "" -"不再需要解析 ``address``。``sock_connect`` 將嘗試透過呼叫 :func:`socket." -"inet_pton` 檢查 *address* 是否已解析。如果沒有,將使用 :meth:`loop." -"getaddrinfo` 解析 *address*。" +"不再需要解析 ``address``。``sock_connect`` 將嘗試透過呼" +"叫 :func:`socket.inet_pton` 檢查 *address* 是否已解析。如果沒有,將使" +"用 :meth:`loop.getaddrinfo` 解析 *address*。" -#: ../../library/asyncio-eventloop.rst:1151 +#: ../../library/asyncio-eventloop.rst:1167 msgid "" ":meth:`loop.create_connection` and :func:`asyncio.open_connection() " "`." @@ -1742,7 +1778,7 @@ msgstr "" ":meth:`loop.create_connection` 和 :func:`asyncio.open_connection() " "`。" -#: ../../library/asyncio-eventloop.rst:1158 +#: ../../library/asyncio-eventloop.rst:1174 msgid "" "Accept a connection. Modeled after the blocking :meth:`socket.accept() " "` method." @@ -1750,7 +1786,7 @@ msgstr "" "接受一個連線。模擬阻塞的 :meth:`socket.accept() ` 方" "法。" -#: ../../library/asyncio-eventloop.rst:1161 +#: ../../library/asyncio-eventloop.rst:1177 msgid "" "The socket must be bound to an address and listening for connections. The " "return value is a pair ``(conn, address)`` where *conn* is a *new* socket " @@ -1761,34 +1797,34 @@ msgstr "" "中 *conn* 是一個 *新* socket 物件,可在連線上發送和接收資料,*address* 是連接" "另一端對應的 socket 地址。" -#: ../../library/asyncio-eventloop.rst:1176 +#: ../../library/asyncio-eventloop.rst:1192 msgid ":meth:`loop.create_server` and :func:`start_server`." msgstr ":meth:`loop.create_server` 和 :func:`start_server`。" -#: ../../library/asyncio-eventloop.rst:1182 +#: ../../library/asyncio-eventloop.rst:1198 msgid "" "Send a file using high-performance :mod:`os.sendfile` if possible. Return " "the total number of bytes sent." msgstr "" "如果可行,使用高性能 :mod:`os.sendfile` 發送檔案。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:1185 +#: ../../library/asyncio-eventloop.rst:1201 msgid "" "Asynchronous version of :meth:`socket.sendfile() `." msgstr ":meth:`socket.sendfile() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1187 +#: ../../library/asyncio-eventloop.rst:1203 msgid "" -"*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket." -"socket`." +"*sock* must be a non-" +"blocking :const:`socket.SOCK_STREAM` :class:`~socket.socket`." msgstr "" "*sock* 必須是非阻塞的 :const:`socket.SOCK_STREAM` :class:`~socket.socket`。" -#: ../../library/asyncio-eventloop.rst:1190 +#: ../../library/asyncio-eventloop.rst:1206 msgid "*file* must be a regular file object open in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:1199 +#: ../../library/asyncio-eventloop.rst:1215 msgid "" "*fallback*, when set to ``True``, makes asyncio manually read and send the " "file when the platform does not support the sendfile syscall (e.g. Windows " @@ -1797,27 +1833,27 @@ msgstr "" "當設置為 ``True`` 時,*fallback* 使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:1203 +#: ../../library/asyncio-eventloop.rst:1219 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support " "*sendfile* syscall and *fallback* is ``False``." msgstr "" -"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,引發 :exc:" -"`SendfileNotAvailableError`。" +"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,引" +"發 :exc:`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:1212 +#: ../../library/asyncio-eventloop.rst:1228 msgid "DNS" msgstr "DNS" -#: ../../library/asyncio-eventloop.rst:1218 +#: ../../library/asyncio-eventloop.rst:1234 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr ":meth:`socket.getaddrinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1223 +#: ../../library/asyncio-eventloop.rst:1239 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr ":meth:`socket.getnameinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1226 +#: ../../library/asyncio-eventloop.rst:1242 msgid "" "Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous " "versions through the loop's default thread pool executor. When this executor " @@ -1827,84 +1863,86 @@ msgid "" "executor with a larger number of workers." msgstr "" -#: ../../library/asyncio-eventloop.rst:1233 +#: ../../library/asyncio-eventloop.rst:1249 msgid "" "Both *getaddrinfo* and *getnameinfo* methods were always documented to " -"return a coroutine, but prior to Python 3.7 they were, in fact, returning :" -"class:`asyncio.Future` objects. Starting with Python 3.7 both methods are " -"coroutines." +"return a coroutine, but prior to Python 3.7 they were, in fact, " +"returning :class:`asyncio.Future` objects. Starting with Python 3.7 both " +"methods are coroutines." msgstr "" "*getaddrinfo* 和 *getnameinfo* 方法一直被記錄為回傳協程,但在 Python 3.7 之前" "它們實際上回傳 :class:`asyncio.Future` 物件。從 Python 3.7 開始,兩個方法都是" "協程。" -#: ../../library/asyncio-eventloop.rst:1241 +#: ../../library/asyncio-eventloop.rst:1257 msgid "Working with pipes" msgstr "使用管道" -#: ../../library/asyncio-eventloop.rst:1246 +#: ../../library/asyncio-eventloop.rst:1262 msgid "Register the read end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的讀取端。" -#: ../../library/asyncio-eventloop.rst:1251 +#: ../../library/asyncio-eventloop.rst:1267 msgid "*pipe* is a :term:`file-like object `." msgstr "*pipe* 是 :term:`類檔案物件 `。" -#: ../../library/asyncio-eventloop.rst:1253 +#: ../../library/asyncio-eventloop.rst:1269 msgid "" -"Return pair ``(transport, protocol)``, where *transport* supports the :class:" -"`ReadTransport` interface and *protocol* is an object instantiated by the " -"*protocol_factory*." +"Return pair ``(transport, protocol)``, where *transport* supports " +"the :class:`ReadTransport` interface and *protocol* is an object " +"instantiated by the *protocol_factory*." msgstr "" -"回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" -"`ReadTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" +"回傳 ``(transport, protocol)`` 對,其中 *transport* 支" +"援 :class:`ReadTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物" +"件。" -#: ../../library/asyncio-eventloop.rst:1257 -#: ../../library/asyncio-eventloop.rst:1274 +#: ../../library/asyncio-eventloop.rst:1273 +#: ../../library/asyncio-eventloop.rst:1290 msgid "" "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" "blocking mode." msgstr "使用 :class:`SelectorEventLoop` 事件迴圈時,*pipe* 設置為非阻塞模式。" -#: ../../library/asyncio-eventloop.rst:1263 +#: ../../library/asyncio-eventloop.rst:1279 msgid "Register the write end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的寫入端。" -#: ../../library/asyncio-eventloop.rst:1268 +#: ../../library/asyncio-eventloop.rst:1284 msgid "*pipe* is :term:`file-like object `." msgstr "*pipe* 是 :term:`file-like object `。" -#: ../../library/asyncio-eventloop.rst:1270 +#: ../../library/asyncio-eventloop.rst:1286 msgid "" -"Return pair ``(transport, protocol)``, where *transport* supports :class:" -"`WriteTransport` interface and *protocol* is an object instantiated by the " -"*protocol_factory*." +"Return pair ``(transport, protocol)``, where *transport* " +"supports :class:`WriteTransport` interface and *protocol* is an object " +"instantiated by the *protocol_factory*." msgstr "" -"回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" -"`WriteTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" +"回傳 ``(transport, protocol)`` 對,其中 *transport* 支" +"援 :class:`WriteTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的" +"物件。" -#: ../../library/asyncio-eventloop.rst:1279 +#: ../../library/asyncio-eventloop.rst:1295 msgid "" ":class:`SelectorEventLoop` does not support the above methods on Windows. " "Use :class:`ProactorEventLoop` instead for Windows." msgstr "" -":class:`SelectorEventLoop` 在 Windows 上不支援上述方法。對於 Windows 請使用 :" -"class:`ProactorEventLoop`。" +":class:`SelectorEventLoop` 在 Windows 上不支援上述方法。對於 Windows 請使" +"用 :class:`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1284 +#: ../../library/asyncio-eventloop.rst:1300 msgid "" "The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." msgstr ":meth:`loop.subprocess_exec` 和 :meth:`loop.subprocess_shell` 方法。" -#: ../../library/asyncio-eventloop.rst:1289 +#: ../../library/asyncio-eventloop.rst:1305 msgid "Unix signals" msgstr "Unix 訊號" -#: ../../library/asyncio-eventloop.rst:1295 +#: ../../library/asyncio-eventloop.rst:1311 msgid "Set *callback* as the handler for the *signum* signal." msgstr "將 *callback* 設置為 *signum* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1297 +#: ../../library/asyncio-eventloop.rst:1313 msgid "" "The callback will be invoked by *loop*, along with other queued callbacks " "and runnable coroutines of that event loop. Unlike signal handlers " @@ -1915,7 +1953,7 @@ msgstr "" "用 :func:`signal.signal` 註冊的訊號處理程式不同,使用此函式註冊的回呼允許與事" "件迴圈進行互動。" -#: ../../library/asyncio-eventloop.rst:1302 +#: ../../library/asyncio-eventloop.rst:1318 msgid "" "Raise :exc:`ValueError` if the signal number is invalid or uncatchable. " "Raise :exc:`RuntimeError` if there is a problem setting up the handler." @@ -1923,16 +1961,16 @@ msgstr "" "如果訊號號無效或不可捕獲,引發 :exc:`ValueError`。如果設定處理程序有問題,拋" "出 :exc:`RuntimeError`。" -#: ../../library/asyncio-eventloop.rst:1308 +#: ../../library/asyncio-eventloop.rst:1324 msgid "" "Like :func:`signal.signal`, this function must be invoked in the main thread." msgstr "像 :func:`signal.signal` 一樣,此函式必須在主執行緒中叫用。" -#: ../../library/asyncio-eventloop.rst:1313 +#: ../../library/asyncio-eventloop.rst:1329 msgid "Remove the handler for the *sig* signal." msgstr "移除 *sig* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1315 +#: ../../library/asyncio-eventloop.rst:1331 msgid "" "Return ``True`` if the signal handler was removed, or ``False`` if no " "handler was set for the given signal." @@ -1940,19 +1978,19 @@ msgstr "" "如果訊號處理程式被移除,回傳 ``True``;如果給定訊號沒有設置處理程式,回傳 " "``False``。" -#: ../../library/asyncio-eventloop.rst:1322 +#: ../../library/asyncio-eventloop.rst:1338 msgid "The :mod:`signal` module." msgstr ":mod:`signal` 模組。" -#: ../../library/asyncio-eventloop.rst:1326 +#: ../../library/asyncio-eventloop.rst:1342 msgid "Executing code in thread or process pools" msgstr "在執行緒池或行程池中執行程式碼" -#: ../../library/asyncio-eventloop.rst:1330 +#: ../../library/asyncio-eventloop.rst:1346 msgid "Arrange for *func* to be called in the specified executor." msgstr "安排在指定的執行器中呼叫 *func*。" -#: ../../library/asyncio-eventloop.rst:1332 +#: ../../library/asyncio-eventloop.rst:1348 msgid "" "The *executor* argument should be an :class:`concurrent.futures.Executor` " "instance. The default executor is used if *executor* is ``None``. The " @@ -1961,7 +1999,7 @@ msgid "" "and used by :func:`run_in_executor` if needed." msgstr "" -#: ../../library/asyncio-eventloop.rst:1340 +#: ../../library/asyncio-eventloop.rst:1356 msgid "" "import asyncio\n" "import concurrent.futures\n" @@ -2000,27 +2038,33 @@ msgid "" " pool, cpu_bound)\n" " print('custom process pool', result)\n" "\n" +" # 4. Run in a custom interpreter pool:\n" +" with concurrent.futures.InterpreterPoolExecutor() as pool:\n" +" result = await loop.run_in_executor(\n" +" pool, cpu_bound)\n" +" print('custom interpreter pool', result)\n" +"\n" "if __name__ == '__main__':\n" " asyncio.run(main())" msgstr "" -#: ../../library/asyncio-eventloop.rst:1380 +#: ../../library/asyncio-eventloop.rst:1402 msgid "" "Note that the entry point guard (``if __name__ == '__main__'``) is required " "for option 3 due to the peculiarities of :mod:`multiprocessing`, which is " "used by :class:`~concurrent.futures.ProcessPoolExecutor`. See :ref:`Safe " "importing of main module `." msgstr "" -"請注意,由於 :mod:`multiprocessing`\\ (由 :class:`~concurrent.futures." -"ProcessPoolExecutor` 使用)的特殊性,選項 3 需要進入點保護(\\ ``if __name__ " -"== '__main__'``\\ )。請參閱\\ :ref:`主模組的安全引入 `。" +"請注意,由於 :mod:`multiprocessing`\\ " +"(由 :class:`~concurrent.futures.ProcessPoolExecutor` 使用)的特殊性,選項 3 " +"需要進入點保護(\\ ``if __name__ == '__main__'``\\ )。請參閱\\ :ref:`主模組" +"的安全引入 `。" -#: ../../library/asyncio-eventloop.rst:1385 +#: ../../library/asyncio-eventloop.rst:1407 msgid "This method returns a :class:`asyncio.Future` object." msgstr "此方法回傳 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:1387 +#: ../../library/asyncio-eventloop.rst:1409 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." @@ -2028,7 +2072,7 @@ msgstr "" "使用 :func:`functools.partial` 將來\\ :ref:`關鍵字引數傳遞 `\\ 給 *func*。" -#: ../../library/asyncio-eventloop.rst:1390 +#: ../../library/asyncio-eventloop.rst:1412 msgid "" ":meth:`loop.run_in_executor` no longer configures the ``max_workers`` of the " "thread pool executor it creates, instead leaving it up to the thread pool " @@ -2036,38 +2080,40 @@ msgid "" "default." msgstr "" ":meth:`loop.run_in_executor` 不再配置它建立的執行緒池執行器的 " -"``max_workers``,而是讓執行緒池執行器(\\ :class:`~concurrent.futures." -"ThreadPoolExecutor`)設定預設值。" +"``max_workers``,而是讓執行緒池執行器" +"(\\ :class:`~concurrent.futures.ThreadPoolExecutor`)設定預設值。" -#: ../../library/asyncio-eventloop.rst:1399 +#: ../../library/asyncio-eventloop.rst:1421 +#, fuzzy msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " -"*executor* must be an instance of :class:`~concurrent.futures." -"ThreadPoolExecutor`." +"*executor* must be an instance " +"of :class:`~concurrent.futures.ThreadPoolExecutor`, which " +"includes :class:`~concurrent.futures.InterpreterPoolExecutor`." msgstr "" "將 *executor* 設置為 :meth:`run_in_executor` 使用的預設執行器。*executor* 必" "須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1403 +#: ../../library/asyncio-eventloop.rst:1426 msgid "" -"*executor* must be an instance of :class:`~concurrent.futures." -"ThreadPoolExecutor`." +"*executor* must be an instance " +"of :class:`~concurrent.futures.ThreadPoolExecutor`." msgstr "" "*executor* 必須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1409 +#: ../../library/asyncio-eventloop.rst:1432 msgid "Error Handling API" msgstr "錯誤處理 API" -#: ../../library/asyncio-eventloop.rst:1411 +#: ../../library/asyncio-eventloop.rst:1434 msgid "Allows customizing how exceptions are handled in the event loop." msgstr "允許自定義事件迴圈中的例外處理方式。" -#: ../../library/asyncio-eventloop.rst:1415 +#: ../../library/asyncio-eventloop.rst:1438 msgid "Set *handler* as the new event loop exception handler." msgstr "將 *handler* 設定為新的事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1417 +#: ../../library/asyncio-eventloop.rst:1440 msgid "" "If *handler* is ``None``, the default exception handler will be set. " "Otherwise, *handler* must be a callable with the signature matching ``(loop, " @@ -2080,16 +2126,16 @@ msgstr "" "圈的,``context`` 是包含例外詳細資訊的 ``dict`` 物件(有關情境的詳細資訊,請" "參閱 :meth:`call_exception_handler` 文件)。" -#: ../../library/asyncio-eventloop.rst:1425 +#: ../../library/asyncio-eventloop.rst:1448 msgid "" -"If the handler is called on behalf of a :class:`~asyncio.Task` or :class:" -"`~asyncio.Handle`, it is run in the :class:`contextvars.Context` of that " -"task or callback handle." +"If the handler is called on behalf of a :class:`~asyncio.Task` " +"or :class:`~asyncio.Handle`, it is run in the :class:`contextvars.Context` " +"of that task or callback handle." msgstr "" "如果代表 :class:`~asyncio.Task` 或 :class:`~asyncio.Handle` 呼叫處理程式,它" "將在該任務或回呼處理程式的 :class:`contextvars.Context` 中運行。" -#: ../../library/asyncio-eventloop.rst:1431 +#: ../../library/asyncio-eventloop.rst:1454 msgid "" "The handler may be called in the :class:`~contextvars.Context` of the task " "or handle where the exception originated." @@ -2097,18 +2143,18 @@ msgstr "" "處理程式可能在引發例外的任務或處理程式的 :class:`~contextvars.Context` 中被呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1436 +#: ../../library/asyncio-eventloop.rst:1459 msgid "" "Return the current exception handler, or ``None`` if no custom exception " "handler was set." msgstr "" "回傳目前的例外處理程式,如果未設置自定義例外處理程式,則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:1443 +#: ../../library/asyncio-eventloop.rst:1466 msgid "Default exception handler." msgstr "預設例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1445 +#: ../../library/asyncio-eventloop.rst:1468 msgid "" "This is called when an exception occurs and no exception handler is set. " "This can be called by a custom exception handler that wants to defer to the " @@ -2117,17 +2163,17 @@ msgstr "" "當發生例外且未設置例外處理程式時呼叫此函式。自定義例外處理程式可以呼叫此函式" "以轉由預設處理程式處理。" -#: ../../library/asyncio-eventloop.rst:1449 +#: ../../library/asyncio-eventloop.rst:1472 msgid "" -"*context* parameter has the same meaning as in :meth:" -"`call_exception_handler`." +"*context* parameter has the same meaning as " +"in :meth:`call_exception_handler`." msgstr "*context* 參數與 :meth:`call_exception_handler` 中的意思相同。" -#: ../../library/asyncio-eventloop.rst:1454 +#: ../../library/asyncio-eventloop.rst:1477 msgid "Call the current event loop exception handler." msgstr "呼叫目前事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1456 +#: ../../library/asyncio-eventloop.rst:1479 msgid "" "*context* is a ``dict`` object containing the following keys (new keys may " "be introduced in future Python versions):" @@ -2135,149 +2181,151 @@ msgstr "" "*context* 是一個包含以下鍵的 ``dict`` 物件(未來的 Python 版本中可能會引入新" "的鍵):" -#: ../../library/asyncio-eventloop.rst:1459 +#: ../../library/asyncio-eventloop.rst:1482 msgid "'message': Error message;" msgstr "'message':錯誤訊息;" -#: ../../library/asyncio-eventloop.rst:1460 +#: ../../library/asyncio-eventloop.rst:1483 msgid "'exception' (optional): Exception object;" msgstr "'exception'(可選):例外物件;" -#: ../../library/asyncio-eventloop.rst:1461 +#: ../../library/asyncio-eventloop.rst:1484 msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "'future'(可選): :class:`asyncio.Future` 實例;" -#: ../../library/asyncio-eventloop.rst:1462 +#: ../../library/asyncio-eventloop.rst:1485 msgid "'task' (optional): :class:`asyncio.Task` instance;" msgstr "'task'(可選): :class:`asyncio.Task` 實例;" -#: ../../library/asyncio-eventloop.rst:1463 +#: ../../library/asyncio-eventloop.rst:1486 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" msgstr "'handle'(可選): :class:`asyncio.Handle` 實例;" -#: ../../library/asyncio-eventloop.rst:1464 +#: ../../library/asyncio-eventloop.rst:1487 msgid "'protocol' (optional): :ref:`Protocol ` instance;" msgstr "'protocol'(可選): :ref:`Protocol ` 實例;" -#: ../../library/asyncio-eventloop.rst:1465 +#: ../../library/asyncio-eventloop.rst:1488 msgid "'transport' (optional): :ref:`Transport ` instance;" msgstr "'transport'(可選): :ref:`Transport ` 實例;" -#: ../../library/asyncio-eventloop.rst:1466 +#: ../../library/asyncio-eventloop.rst:1489 msgid "'socket' (optional): :class:`socket.socket` instance;" msgstr "'socket'(可選): :class:`socket.socket` 實例;" -#: ../../library/asyncio-eventloop.rst:1467 +#: ../../library/asyncio-eventloop.rst:1490 msgid "'source_traceback' (optional): Traceback of the source;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1468 +#: ../../library/asyncio-eventloop.rst:1491 msgid "'handle_traceback' (optional): Traceback of the handle;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1469 +#: ../../library/asyncio-eventloop.rst:1492 msgid "'asyncgen' (optional): Asynchronous generator that caused" msgstr "'asyncgen'(可選): 非同步產生器引發" -#: ../../library/asyncio-eventloop.rst:1470 +#: ../../library/asyncio-eventloop.rst:1493 msgid "the exception." msgstr "例外。" -#: ../../library/asyncio-eventloop.rst:1474 +#: ../../library/asyncio-eventloop.rst:1497 msgid "" "This method should not be overloaded in subclassed event loops. For custom " "exception handling, use the :meth:`set_exception_handler` method." msgstr "" -"此方法不應在子類別事件迴圈中被覆寫。為了自定義例外處理,請使用 :meth:" -"`set_exception_handler` 方法。" +"此方法不應在子類別事件迴圈中被覆寫。為了自定義例外處理,請使" +"用 :meth:`set_exception_handler` 方法。" -#: ../../library/asyncio-eventloop.rst:1479 +#: ../../library/asyncio-eventloop.rst:1502 msgid "Enabling debug mode" msgstr "啟用除錯模式" -#: ../../library/asyncio-eventloop.rst:1483 +#: ../../library/asyncio-eventloop.rst:1506 msgid "Get the debug mode (:class:`bool`) of the event loop." msgstr "取得事件迴圈的除錯模式(\\ :class:`bool`\\ )。" -#: ../../library/asyncio-eventloop.rst:1485 +#: ../../library/asyncio-eventloop.rst:1508 msgid "" -"The default value is ``True`` if the environment variable :envvar:" -"`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." +"The default value is ``True`` if the environment " +"variable :envvar:`PYTHONASYNCIODEBUG` is set to a non-empty string, " +"``False`` otherwise." msgstr "" "如果環境變數 :envvar:`PYTHONASYNCIODEBUG` 被設定為非空字串,則預設值為 " "``True``,否則為 ``False``。" -#: ../../library/asyncio-eventloop.rst:1491 +#: ../../library/asyncio-eventloop.rst:1514 msgid "Set the debug mode of the event loop." msgstr "設定事件迴圈的除錯模式。" -#: ../../library/asyncio-eventloop.rst:1495 +#: ../../library/asyncio-eventloop.rst:1518 msgid "" "The new :ref:`Python Development Mode ` can now also be used to " "enable the debug mode." msgstr "現在也可以使用新的 :ref:`Python 開發模式 ` 啟用除錯模式。" -#: ../../library/asyncio-eventloop.rst:1500 +#: ../../library/asyncio-eventloop.rst:1523 msgid "" "This attribute can be used to set the minimum execution duration in seconds " "that is considered \"slow\". When debug mode is enabled, \"slow\" callbacks " "are logged." msgstr "" -"此屬性可用於設定被視為\"慢\"的最短執行時間(以秒為單位)。啟用偵錯模式" -"後,\"慢\"回呼將被記錄。" +"此屬性可用於設定被視為\"慢\"的最短執行時間(以秒為單位)。啟用偵錯模式後," +"\"慢\"回呼將被記錄。" -#: ../../library/asyncio-eventloop.rst:1504 +#: ../../library/asyncio-eventloop.rst:1527 msgid "Default value is 100 milliseconds." msgstr "預設值為 100 毫秒" -#: ../../library/asyncio-eventloop.rst:1508 +#: ../../library/asyncio-eventloop.rst:1531 msgid "The :ref:`debug mode of asyncio `." msgstr ":ref:`asyncio 的除錯模式 `。" -#: ../../library/asyncio-eventloop.rst:1512 +#: ../../library/asyncio-eventloop.rst:1535 msgid "Running Subprocesses" msgstr "運行子行程" -#: ../../library/asyncio-eventloop.rst:1514 +#: ../../library/asyncio-eventloop.rst:1537 msgid "" "Methods described in this subsections are low-level. In regular async/await " "code consider using the high-level :func:`asyncio.create_subprocess_shell` " "and :func:`asyncio.create_subprocess_exec` convenience functions instead." msgstr "" -"本小節描述的方法是低階的。在常規的 async/await 程式碼中,請考慮使用高階 :" -"func:`asyncio.create_subprocess_shell` 和 :func:`asyncio." -"create_subprocess_exec` 輔助功能而不是。" +"本小節描述的方法是低階的。在常規的 async/await 程式碼中,請考慮使用高" +"階 :func:`asyncio.create_subprocess_shell` " +"和 :func:`asyncio.create_subprocess_exec` 輔助功能而不是。" -#: ../../library/asyncio-eventloop.rst:1521 +#: ../../library/asyncio-eventloop.rst:1544 msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " -"subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:" -"`Subprocess Support on Windows ` for details." +"subprocesses, whereas :class:`SelectorEventLoop` does not. " +"See :ref:`Subprocess Support on Windows ` for " +"details." msgstr "" -"在 Windows 上,預設事件迴圈 :class:`ProactorEventLoop` 支援子行程,而 :class:" -"`SelectorEventLoop` 不支援。詳細資訊請參見 :ref:`Windows 上對於子行程的支援 " -"`。" +"在 Windows 上,預設事件迴圈 :class:`ProactorEventLoop` 支援子行程," +"而 :class:`SelectorEventLoop` 不支援。詳細資訊請參見 :ref:`Windows 上對於子行" +"程的支援 `。" -#: ../../library/asyncio-eventloop.rst:1533 +#: ../../library/asyncio-eventloop.rst:1556 msgid "" "Create a subprocess from one or more string arguments specified by *args*." msgstr "從 *args* 指定的一個或多個字串引數建立子行程。" -#: ../../library/asyncio-eventloop.rst:1536 +#: ../../library/asyncio-eventloop.rst:1559 msgid "*args* must be a list of strings represented by:" msgstr "*args* 必須是由以下項表示的字串串列:" -#: ../../library/asyncio-eventloop.rst:1538 +#: ../../library/asyncio-eventloop.rst:1561 msgid ":class:`str`;" msgstr ":class:`str`;" -#: ../../library/asyncio-eventloop.rst:1539 +#: ../../library/asyncio-eventloop.rst:1562 msgid "" "or :class:`bytes`, encoded to the :ref:`filesystem encoding `." msgstr "或 :class:`bytes`,編碼為 :ref:`檔案系統編碼 `。" -#: ../../library/asyncio-eventloop.rst:1542 +#: ../../library/asyncio-eventloop.rst:1565 msgid "" "The first string specifies the program executable, and the remaining strings " "specify the arguments. Together, string arguments form the ``argv`` of the " @@ -2286,7 +2334,7 @@ msgstr "" "第一個字串指定程序可執行檔案,其餘字串指定引數。字串引數一起組成程序的 " "``argv``。" -#: ../../library/asyncio-eventloop.rst:1546 +#: ../../library/asyncio-eventloop.rst:1569 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=False`` and the list of strings passed as the first " @@ -2297,75 +2345,75 @@ msgstr "" "字串串列作為第一個引數傳遞;然而,:class:`~subprocess.Popen` 接受單個字串串列" "引數,*subprocess_exec* 接受多個字串引數。" -#: ../../library/asyncio-eventloop.rst:1552 +#: ../../library/asyncio-eventloop.rst:1575 msgid "" -"The *protocol_factory* must be a callable returning a subclass of the :class:" -"`asyncio.SubprocessProtocol` class." +"The *protocol_factory* must be a callable returning a subclass of " +"the :class:`asyncio.SubprocessProtocol` class." msgstr "" "*protocol_factory* 必須是回傳 :class:`asyncio.SubprocessProtocol` 子類別的可" "呼叫物件。" -#: ../../library/asyncio-eventloop.rst:1555 +#: ../../library/asyncio-eventloop.rst:1578 msgid "Other parameters:" msgstr "其他參數:" -#: ../../library/asyncio-eventloop.rst:1557 +#: ../../library/asyncio-eventloop.rst:1580 msgid "*stdin* can be any of these:" msgstr "*stdin* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1559 -#: ../../library/asyncio-eventloop.rst:1570 -#: ../../library/asyncio-eventloop.rst:1580 +#: ../../library/asyncio-eventloop.rst:1582 +#: ../../library/asyncio-eventloop.rst:1593 +#: ../../library/asyncio-eventloop.rst:1603 msgid "a file-like object" msgstr "類檔案物件" -#: ../../library/asyncio-eventloop.rst:1560 +#: ../../library/asyncio-eventloop.rst:1583 msgid "" "an existing file descriptor (a positive integer), for example those created " "with :meth:`os.pipe`" msgstr "現有的檔案描述器(正整數),例如用 :meth:`os.pipe` 建立的" -#: ../../library/asyncio-eventloop.rst:1561 -#: ../../library/asyncio-eventloop.rst:1571 -#: ../../library/asyncio-eventloop.rst:1581 +#: ../../library/asyncio-eventloop.rst:1584 +#: ../../library/asyncio-eventloop.rst:1594 +#: ../../library/asyncio-eventloop.rst:1604 msgid "" "the :const:`subprocess.PIPE` constant (default) which will create a new pipe " "and connect it," msgstr ":const:`subprocess.PIPE` 常數(預設),它將建立一個新的管道並連線," -#: ../../library/asyncio-eventloop.rst:1563 -#: ../../library/asyncio-eventloop.rst:1573 -#: ../../library/asyncio-eventloop.rst:1583 +#: ../../library/asyncio-eventloop.rst:1586 +#: ../../library/asyncio-eventloop.rst:1596 +#: ../../library/asyncio-eventloop.rst:1606 msgid "" "the value ``None`` which will make the subprocess inherit the file " "descriptor from this process" msgstr "值 ``None`` 將使子行程從此行程繼承檔案描述器" -#: ../../library/asyncio-eventloop.rst:1565 -#: ../../library/asyncio-eventloop.rst:1575 -#: ../../library/asyncio-eventloop.rst:1585 +#: ../../library/asyncio-eventloop.rst:1588 +#: ../../library/asyncio-eventloop.rst:1598 +#: ../../library/asyncio-eventloop.rst:1608 msgid "" -"the :const:`subprocess.DEVNULL` constant which indicates that the special :" -"data:`os.devnull` file will be used" +"the :const:`subprocess.DEVNULL` constant which indicates that the " +"special :data:`os.devnull` file will be used" msgstr "" ":const:`subprocess.DEVNULL` 常數,表示將使用特殊的 :data:`os.devnull` 檔案" -#: ../../library/asyncio-eventloop.rst:1568 +#: ../../library/asyncio-eventloop.rst:1591 msgid "*stdout* can be any of these:" msgstr "*stdout* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1578 +#: ../../library/asyncio-eventloop.rst:1601 msgid "*stderr* can be any of these:" msgstr "*stderr* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1587 +#: ../../library/asyncio-eventloop.rst:1610 msgid "" "the :const:`subprocess.STDOUT` constant which will connect the standard " "error stream to the process' standard output stream" msgstr "" ":const:`subprocess.STDOUT` 常數,它將標準錯誤串流連線到行程的標準輸出串流" -#: ../../library/asyncio-eventloop.rst:1590 +#: ../../library/asyncio-eventloop.rst:1613 msgid "" "All other keyword arguments are passed to :class:`subprocess.Popen` without " "interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " @@ -2375,7 +2423,7 @@ msgstr "" "*bufsize*、*universal_newlines*、*shell*、*text*、*encoding* 和 *errors* 除" "外,這些不應該指定。" -#: ../../library/asyncio-eventloop.rst:1595 +#: ../../library/asyncio-eventloop.rst:1618 msgid "" "The ``asyncio`` subprocess API does not support decoding the streams as " "text. :func:`bytes.decode` can be used to convert the bytes returned from " @@ -2384,43 +2432,43 @@ msgstr "" "``asyncio`` 子行程 API 不支援將串流解碼為文本。可以使用 :func:`bytes.decode` " "將從串流回傳的位元組轉換為文本。" -#: ../../library/asyncio-eventloop.rst:1599 +#: ../../library/asyncio-eventloop.rst:1622 msgid "" "If a file-like object passed as *stdin*, *stdout* or *stderr* represents a " -"pipe, then the other side of this pipe should be registered with :meth:" -"`~loop.connect_write_pipe` or :meth:`~loop.connect_read_pipe` for use with " -"the event loop." +"pipe, then the other side of this pipe should be registered " +"with :meth:`~loop.connect_write_pipe` or :meth:`~loop.connect_read_pipe` for " +"use with the event loop." msgstr "" "如果傳遞給 *stdin*、*stdout* 或 *stderr* 的類檔案物件表示管道,則該管道的另一" -"端應該使用 :meth:`~loop.connect_write_pipe` 或 :meth:`~loop." -"connect_read_pipe` 註冊到事件迴圈中。" +"端應該使用 :meth:`~loop.connect_write_pipe` " +"或 :meth:`~loop.connect_read_pipe` 註冊到事件迴圈中。" -#: ../../library/asyncio-eventloop.rst:1604 +#: ../../library/asyncio-eventloop.rst:1627 msgid "" "See the constructor of the :class:`subprocess.Popen` class for documentation " "on other arguments." msgstr "有關其他引數的文件,請參閱 :class:`subprocess.Popen` 類別的建構函式。" -#: ../../library/asyncio-eventloop.rst:1607 +#: ../../library/asyncio-eventloop.rst:1630 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " "object instantiated by the *protocol_factory*." msgstr "" -"回傳 ``(transport, protocol)`` 對,其中 *transport* 符合 :class:`asyncio." -"SubprocessTransport` 基底類別,*protocol* 是由 *protocol_factory* 實例化的物" -"件。" +"回傳 ``(transport, protocol)`` 對,其中 *transport* 符" +"合 :class:`asyncio.SubprocessTransport` 基底類別,*protocol* 是由 " +"*protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1616 +#: ../../library/asyncio-eventloop.rst:1639 msgid "" -"Create a subprocess from *cmd*, which can be a :class:`str` or a :class:" -"`bytes` string encoded to the :ref:`filesystem encoding `, using the platform's \"shell\" syntax." msgstr "" "使用平台的 \"shell\" 語法從 *cmd* 建立子行程,*cmd* 可以是 :class:`str` 或編" "碼為 :ref:`檔案系統編碼 ` 的 :class:`bytes` 字串。" -#: ../../library/asyncio-eventloop.rst:1621 +#: ../../library/asyncio-eventloop.rst:1644 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=True``." @@ -2428,31 +2476,31 @@ msgstr "" "這類似於標準函式庫中的 :class:`subprocess.Popen` 類別,使用 ``shell=True`` 呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1624 +#: ../../library/asyncio-eventloop.rst:1647 msgid "" -"The *protocol_factory* must be a callable returning a subclass of the :class:" -"`SubprocessProtocol` class." +"The *protocol_factory* must be a callable returning a subclass of " +"the :class:`SubprocessProtocol` class." msgstr "" "*protocol_factory* 必須是回傳 :class:`SubprocessProtocol` 子類別的可呼叫物" "件。" -#: ../../library/asyncio-eventloop.rst:1627 +#: ../../library/asyncio-eventloop.rst:1650 msgid "" "See :meth:`~loop.subprocess_exec` for more details about the remaining " "arguments." msgstr "有關其餘引數的更多詳細資訊,請參閱 :meth:`~loop.subprocess_exec`。" -#: ../../library/asyncio-eventloop.rst:1630 +#: ../../library/asyncio-eventloop.rst:1653 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`SubprocessTransport` base class and *protocol* is an object " "instantiated by the *protocol_factory*." msgstr "" -"回傳一對 ``(transport, protocol)``,其中 *transport* 符合 :class:" -"`SubprocessTransport` 基底類別,而 *protocol* 是由 *protocol_factory* 實例化" -"的物件。" +"回傳一對 ``(transport, protocol)``,其中 *transport* 符" +"合 :class:`SubprocessTransport` 基底類別,而 *protocol* 是由 " +"*protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1635 +#: ../../library/asyncio-eventloop.rst:1658 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -2461,76 +2509,77 @@ msgid "" "escape whitespace and special characters in strings that are going to be " "used to construct shell commands." msgstr "" -"由應用程式負責確保適當引用所有空白和特殊字元,以避免 `shell 注入 `_\\ 風險。可以使用 :func:" -"`shlex.quote` 函式來正確跳脫用於構建 shell 命令的字串中的空白和特殊字元。" +"由應用程式負責確保適當引用所有空白和特殊字元,以避免 `shell 注入 `_\\ 風險。可以使" +"用 :func:`shlex.quote` 函式來正確跳脫用於構建 shell 命令的字串中的空白和特殊" +"字元。" -#: ../../library/asyncio-eventloop.rst:1644 +#: ../../library/asyncio-eventloop.rst:1667 msgid "Callback Handles" msgstr "回呼處理" -#: ../../library/asyncio-eventloop.rst:1648 +#: ../../library/asyncio-eventloop.rst:1671 msgid "" -"A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop." -"call_soon_threadsafe`." +"A callback wrapper object returned " +"by :meth:`loop.call_soon`, :meth:`loop.call_soon_threadsafe`." msgstr "" "由 :meth:`loop.call_soon` 和 :meth:`loop.call_soon_threadsafe` 回傳的回呼包裝" "器。" -#: ../../library/asyncio-eventloop.rst:1653 +#: ../../library/asyncio-eventloop.rst:1676 msgid "" "Return the :class:`contextvars.Context` object associated with the handle." msgstr "回傳與處理相關聯的 :class:`contextvars.Context` 物件。" -#: ../../library/asyncio-eventloop.rst:1660 +#: ../../library/asyncio-eventloop.rst:1683 msgid "" "Cancel the callback. If the callback has already been canceled or executed, " "this method has no effect." msgstr "取消回呼。如果回呼已被取消或執行,此方法將不起作用。" -#: ../../library/asyncio-eventloop.rst:1665 +#: ../../library/asyncio-eventloop.rst:1688 msgid "Return ``True`` if the callback was cancelled." msgstr "如果回呼已被取消,回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1671 +#: ../../library/asyncio-eventloop.rst:1694 msgid "" -"A callback wrapper object returned by :meth:`loop.call_later`, and :meth:" -"`loop.call_at`." +"A callback wrapper object returned by :meth:`loop.call_later`, " +"and :meth:`loop.call_at`." msgstr "由 :meth:`loop.call_later` 和 :meth:`loop.call_at` 回傳的回呼包裝器。" -#: ../../library/asyncio-eventloop.rst:1674 +#: ../../library/asyncio-eventloop.rst:1697 msgid "This class is a subclass of :class:`Handle`." msgstr "這個類別是 :class:`Handle` 的子類別。" -#: ../../library/asyncio-eventloop.rst:1678 +#: ../../library/asyncio-eventloop.rst:1701 msgid "Return a scheduled callback time as :class:`float` seconds." msgstr "回傳預定的回呼時間,以 :class:`float` 秒為單位。" -#: ../../library/asyncio-eventloop.rst:1680 +#: ../../library/asyncio-eventloop.rst:1703 msgid "" -"The time is an absolute timestamp, using the same time reference as :meth:" -"`loop.time`." +"The time is an absolute timestamp, using the same time reference " +"as :meth:`loop.time`." msgstr "時間是一個絕對的時間戳,使用與 :meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:1687 +#: ../../library/asyncio-eventloop.rst:1710 msgid "Server Objects" msgstr "Server 物件" -#: ../../library/asyncio-eventloop.rst:1689 +#: ../../library/asyncio-eventloop.rst:1712 msgid "" -"Server objects are created by :meth:`loop.create_server`, :meth:`loop." -"create_unix_server`, :func:`start_server`, and :func:`start_unix_server` " -"functions." +"Server objects are created " +"by :meth:`loop.create_server`, :meth:`loop.create_unix_server`, :func:`start_server`, " +"and :func:`start_unix_server` functions." msgstr "" -"Server 物件是由 :meth:`loop.create_server`、:meth:`loop." -"create_unix_server`、:func:`start_server` 和 :func:`start_unix_server` 函式所" -"建立。" +"Server 物件是" +"由 :meth:`loop.create_server`、:meth:`loop.create_unix_server`、:func:`start_server` " +"和 :func:`start_unix_server` 函式所建立。" -#: ../../library/asyncio-eventloop.rst:1693 +#: ../../library/asyncio-eventloop.rst:1716 msgid "Do not instantiate the :class:`Server` class directly." msgstr "請勿直接實例化 :class:`Server` 類別。" -#: ../../library/asyncio-eventloop.rst:1697 +#: ../../library/asyncio-eventloop.rst:1720 msgid "" "*Server* objects are asynchronous context managers. When used in an ``async " "with`` statement, it's guaranteed that the Server object is closed and not " @@ -2539,7 +2588,7 @@ msgstr "" "*Server* 物件是非同步情境管理器。當在 ``async with`` 陳述中使用時,可以保證在" "完成 ``async with`` 陳述時,Server 物件將會關閉並停止接受新的連線: ::" -#: ../../library/asyncio-eventloop.rst:1702 +#: ../../library/asyncio-eventloop.rst:1725 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -2555,30 +2604,30 @@ msgstr "" "\n" "# 此時 srv 已關閉,不再接受新的連線。" -#: ../../library/asyncio-eventloop.rst:1710 +#: ../../library/asyncio-eventloop.rst:1733 msgid "Server object is an asynchronous context manager since Python 3.7." msgstr "自 Python 3.7 起,Server 物件是非同步情境管理器。" -#: ../../library/asyncio-eventloop.rst:1713 +#: ../../library/asyncio-eventloop.rst:1736 msgid "" "This class was exposed publicly as ``asyncio.Server`` in Python 3.9.11, " "3.10.3 and 3.11." msgstr "" "此類別在 Python 3.9.11、3.10.3 和 3.11 中以 ``asyncio.Server`` 的形式被公開。" -#: ../../library/asyncio-eventloop.rst:1718 +#: ../../library/asyncio-eventloop.rst:1741 msgid "" "Stop serving: close listening sockets and set the :attr:`sockets` attribute " "to ``None``." msgstr "停止服務:關閉監聽的 sockets 並將 :attr:`sockets` 屬性設為 ``None``。" -#: ../../library/asyncio-eventloop.rst:1721 +#: ../../library/asyncio-eventloop.rst:1744 msgid "" "The sockets that represent existing incoming client connections are left " "open." msgstr "代表現有傳入用戶端連線的 sockets 仍然保持開啟。" -#: ../../library/asyncio-eventloop.rst:1724 +#: ../../library/asyncio-eventloop.rst:1747 msgid "" "The server is closed asynchronously; use the :meth:`wait_closed` coroutine " "to wait until the server is closed (and no more connections are active)." @@ -2586,53 +2635,53 @@ msgstr "" "伺服器以非同步方式關閉;使用 :meth:`wait_close` 協程等待伺服器關閉(不再有活" "躍連線)。" -#: ../../library/asyncio-eventloop.rst:1730 +#: ../../library/asyncio-eventloop.rst:1753 msgid "Close all existing incoming client connections." msgstr "關閉所有現有的傳入用戶端連線。" -#: ../../library/asyncio-eventloop.rst:1732 +#: ../../library/asyncio-eventloop.rst:1755 msgid "" "Calls :meth:`~asyncio.BaseTransport.close` on all associated transports." msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1735 +#: ../../library/asyncio-eventloop.rst:1758 msgid "" ":meth:`close` should be called before :meth:`close_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1742 +#: ../../library/asyncio-eventloop.rst:1765 msgid "" "Close all existing incoming client connections immediately, without waiting " "for pending operations to complete." msgstr "立即關閉所有現有的傳入用戶端連線,而不等待待定操作完成。" -#: ../../library/asyncio-eventloop.rst:1745 +#: ../../library/asyncio-eventloop.rst:1768 msgid "" "Calls :meth:`~asyncio.WriteTransport.abort` on all associated transports." msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1748 +#: ../../library/asyncio-eventloop.rst:1771 msgid "" ":meth:`close` should be called before :meth:`abort_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1755 +#: ../../library/asyncio-eventloop.rst:1778 msgid "Return the event loop associated with the server object." msgstr "回傳與伺服器物件關聯的事件迴圈。" -#: ../../library/asyncio-eventloop.rst:1762 +#: ../../library/asyncio-eventloop.rst:1785 msgid "Start accepting connections." msgstr "開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1764 +#: ../../library/asyncio-eventloop.rst:1787 msgid "" "This method is idempotent, so it can be called when the server is already " "serving." msgstr "此方法是幂等的,因此可以在伺服器已經運行時呼叫。" -#: ../../library/asyncio-eventloop.rst:1767 +#: ../../library/asyncio-eventloop.rst:1790 msgid "" "The *start_serving* keyword-only parameter to :meth:`loop.create_server` " "and :meth:`asyncio.start_server` allows creating a Server object that is not " @@ -2640,19 +2689,19 @@ msgid "" "or :meth:`Server.serve_forever` can be used to make the Server start " "accepting connections." msgstr "" -"*start_serving* 僅限關鍵字參數只能在 :meth:`loop.create_server` 和 :meth:" -"`asyncio.start_server` 中使用,允許建立一個最初不接受連線的 Server 物件。在這" -"種情況下,可以使用 ``Server.start_serving()`` 或 :meth:`Server." -"serve_forever` 來使 Server 開始接受連線。" +"*start_serving* 僅限關鍵字參數只能在 :meth:`loop.create_server` " +"和 :meth:`asyncio.start_server` 中使用,允許建立一個最初不接受連線的 Server " +"物件。在這種情況下,可以使用 ``Server.start_serving()`` " +"或 :meth:`Server.serve_forever` 來使 Server 開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1779 +#: ../../library/asyncio-eventloop.rst:1802 msgid "" "Start accepting connections until the coroutine is cancelled. Cancellation " "of ``serve_forever`` task causes the server to be closed." msgstr "" "開始接受連線,直到協程被取消。取消 ``serve_forever`` 任務會導致伺服器關閉。" -#: ../../library/asyncio-eventloop.rst:1783 +#: ../../library/asyncio-eventloop.rst:1806 msgid "" "This method can be called if the server is already accepting connections. " "Only one ``serve_forever`` task can exist per one *Server* object." @@ -2660,7 +2709,7 @@ msgstr "" "如果伺服器已經接受連線,則可以呼叫此方法。每個 *Server* 物件只能存在一個 " "``serve_forever`` 任務。" -#: ../../library/asyncio-eventloop.rst:1789 +#: ../../library/asyncio-eventloop.rst:1812 msgid "" "async def client_connected(reader, writer):\n" " # Communicate with the client with\n" @@ -2686,24 +2735,24 @@ msgstr "" "\n" "asyncio.run(main('127.0.0.1', 0))" -#: ../../library/asyncio-eventloop.rst:1805 +#: ../../library/asyncio-eventloop.rst:1828 msgid "Return ``True`` if the server is accepting new connections." msgstr "如果伺服器正在接受新連線,則回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1812 +#: ../../library/asyncio-eventloop.rst:1835 msgid "" "Wait until the :meth:`close` method completes and all active connections " "have finished." msgstr "等待 :meth:`close` 方法完成且所有活動連線都已結束。" -#: ../../library/asyncio-eventloop.rst:1817 +#: ../../library/asyncio-eventloop.rst:1840 msgid "" "List of socket-like objects, ``asyncio.trsock.TransportSocket``, which the " "server is listening on." msgstr "" "伺服器正在監聽的類似 socket 的物件串列,``asyncio.trsock.TransportSocket``。" -#: ../../library/asyncio-eventloop.rst:1820 +#: ../../library/asyncio-eventloop.rst:1843 msgid "" "Prior to Python 3.7 ``Server.sockets`` used to return an internal list of " "server sockets directly. In 3.7 a copy of that list is returned." @@ -2711,29 +2760,29 @@ msgstr "" "在 Python 3.7 之前,``Server.sockets`` 曾經直接回傳內部伺服器 sockets 的串" "列。在 3.7 中回傳了該串列的副本。" -#: ../../library/asyncio-eventloop.rst:1830 +#: ../../library/asyncio-eventloop.rst:1853 msgid "Event Loop Implementations" msgstr "事件迴圈實作" -#: ../../library/asyncio-eventloop.rst:1832 +#: ../../library/asyncio-eventloop.rst:1855 msgid "" -"asyncio ships with two different event loop implementations: :class:" -"`SelectorEventLoop` and :class:`ProactorEventLoop`." +"asyncio ships with two different event loop " +"implementations: :class:`SelectorEventLoop` and :class:`ProactorEventLoop`." msgstr "" -"asyncio 內附兩個不同的事件迴圈實作::class:`SelectorEventLoop` 和 :class:" -"`ProactorEventLoop`。" +"asyncio 內附兩個不同的事件迴圈實作::class:`SelectorEventLoop` " +"和 :class:`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1835 +#: ../../library/asyncio-eventloop.rst:1858 msgid "By default asyncio is configured to use :class:`EventLoop`." msgstr "預設情況下,asyncio 被配置為要使用 :class:`EventLoop`。" -#: ../../library/asyncio-eventloop.rst:1840 +#: ../../library/asyncio-eventloop.rst:1863 msgid "" "A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` " "module." msgstr "基於 :mod:`selectors` 模組的一個 :class:`AbstractEventLoop` 子類別。" -#: ../../library/asyncio-eventloop.rst:1843 +#: ../../library/asyncio-eventloop.rst:1866 msgid "" "Uses the most efficient *selector* available for the given platform. It is " "also possible to manually configure the exact selector implementation to be " @@ -2742,29 +2791,20 @@ msgstr "" "使用特定平台上最有效的 *selector*。也可以手動配置要使用的確切 selector 實" "作: ::" -#: ../../library/asyncio-eventloop.rst:1847 +#: ../../library/asyncio-eventloop.rst:1870 msgid "" "import asyncio\n" "import selectors\n" "\n" -"class MyPolicy(asyncio.DefaultEventLoopPolicy):\n" -" def new_event_loop(self):\n" -" selector = selectors.SelectSelector()\n" -" return asyncio.SelectorEventLoop(selector)\n" +"async def main():\n" +" ...\n" "\n" -"asyncio.set_event_loop_policy(MyPolicy())" +"loop_factory = lambda: " +"asyncio.SelectorEventLoop(selectors.SelectSelector())\n" +"asyncio.run(main(), loop_factory=loop_factory)" msgstr "" -"import asyncio\n" -"import selectors\n" -"\n" -"class MyPolicy(asyncio.DefaultEventLoopPolicy):\n" -" def new_event_loop(self):\n" -" selector = selectors.SelectSelector()\n" -" return asyncio.SelectorEventLoop(selector)\n" -"\n" -"asyncio.set_event_loop_policy(MyPolicy())" -#: ../../library/asyncio-eventloop.rst:1863 +#: ../../library/asyncio-eventloop.rst:1885 msgid "" "A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O " "Completion Ports\" (IOCP)." @@ -2772,7 +2812,7 @@ msgstr "" "用於 Windows 的 :class:`AbstractEventLoop` 子類別,使用「I/O 完成埠 (IOCP, I/" "O Completion Ports)」。" -#: ../../library/asyncio-eventloop.rst:1869 +#: ../../library/asyncio-eventloop.rst:1891 msgid "" "`MSDN documentation on I/O Completion Ports `_." @@ -2780,25 +2820,25 @@ msgstr "" "`I/O 完成埠的 MSDN 文件 `_。" -#: ../../library/asyncio-eventloop.rst:1874 +#: ../../library/asyncio-eventloop.rst:1896 msgid "" -"An alias to the most efficient available subclass of :class:" -"`AbstractEventLoop` for the given platform." +"An alias to the most efficient available subclass " +"of :class:`AbstractEventLoop` for the given platform." msgstr "" -#: ../../library/asyncio-eventloop.rst:1877 +#: ../../library/asyncio-eventloop.rst:1899 msgid "" -"It is an alias to :class:`SelectorEventLoop` on Unix and :class:" -"`ProactorEventLoop` on Windows." +"It is an alias to :class:`SelectorEventLoop` on Unix " +"and :class:`ProactorEventLoop` on Windows." msgstr "" -"在 Unix 上是 :class:`SelectorEventLoop` 的別名,在 Windows 上是 :class:" -"`ProactorEventLoop` 的別名。" +"在 Unix 上是 :class:`SelectorEventLoop` 的別名,在 Windows 上" +"是 :class:`ProactorEventLoop` 的別名。" -#: ../../library/asyncio-eventloop.rst:1883 +#: ../../library/asyncio-eventloop.rst:1905 msgid "Abstract base class for asyncio-compliant event loops." msgstr "為符合 asyncio 標準的事件迴圈的抽象基礎類別。" -#: ../../library/asyncio-eventloop.rst:1885 +#: ../../library/asyncio-eventloop.rst:1907 msgid "" "The :ref:`asyncio-event-loop-methods` section lists all methods that an " "alternative implementation of ``AbstractEventLoop`` should have defined." @@ -2806,26 +2846,27 @@ msgstr "" ":ref:`asyncio-event-loop-methods` 部分列出了替代 ``AbstractEventLoop`` 實作應" "該定義的所有方法。" -#: ../../library/asyncio-eventloop.rst:1891 +#: ../../library/asyncio-eventloop.rst:1913 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-eventloop.rst:1893 +#: ../../library/asyncio-eventloop.rst:1915 msgid "" "Note that all examples in this section **purposefully** show how to use the " -"low-level event loop APIs, such as :meth:`loop.run_forever` and :meth:`loop." -"call_soon`. Modern asyncio applications rarely need to be written this way; " -"consider using the high-level functions like :func:`asyncio.run`." +"low-level event loop APIs, such as :meth:`loop.run_forever` " +"and :meth:`loop.call_soon`. Modern asyncio applications rarely need to be " +"written this way; consider using the high-level functions " +"like :func:`asyncio.run`." msgstr "" -"請注意,本節中的所有範例都 **故意** 展示如何使用低階事件迴圈 API,如 :meth:" -"`loop.run_forever` 和 :meth:`loop.call_soon`。現代 asyncio 應用程式很少需要這" -"種方式撰寫;請考慮使用高階的函式,如 :func:`asyncio.run`。" +"請注意,本節中的所有範例都 **故意** 展示如何使用低階事件迴圈 API," +"如 :meth:`loop.run_forever` 和 :meth:`loop.call_soon`。現代 asyncio 應用程式" +"很少需要這種方式撰寫;請考慮使用高階的函式,如 :func:`asyncio.run`。" -#: ../../library/asyncio-eventloop.rst:1903 +#: ../../library/asyncio-eventloop.rst:1925 msgid "Hello World with call_soon()" msgstr "使用 call_soon() 的 Hello World 範例" -#: ../../library/asyncio-eventloop.rst:1905 +#: ../../library/asyncio-eventloop.rst:1927 msgid "" "An example using the :meth:`loop.call_soon` method to schedule a callback. " "The callback displays ``\"Hello World\"`` and then stops the event loop::" @@ -2833,7 +2874,7 @@ msgstr "" "使用 :meth:`loop.call_soon` 方法排程回呼的範例。回呼會顯示 ``\"Hello " "World\"``,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1909 +#: ../../library/asyncio-eventloop.rst:1931 msgid "" "import asyncio\n" "\n" @@ -2871,18 +2912,18 @@ msgstr "" "finally:\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1929 +#: ../../library/asyncio-eventloop.rst:1951 msgid "" "A similar :ref:`Hello World ` example created with a coroutine " "and the :func:`run` function." msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`Hello World ` 範例。" -#: ../../library/asyncio-eventloop.rst:1936 +#: ../../library/asyncio-eventloop.rst:1958 msgid "Display the current date with call_later()" msgstr "使用 call_later() 顯示目前日期" -#: ../../library/asyncio-eventloop.rst:1938 +#: ../../library/asyncio-eventloop.rst:1960 msgid "" "An example of a callback displaying the current date every second. The " "callback uses the :meth:`loop.call_later` method to reschedule itself after " @@ -2891,7 +2932,7 @@ msgstr "" "一個回呼的範例,每秒顯示目前日期。回呼使用 :meth:`loop.call_later` 方法在 5 " "秒後重新排程自己,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1942 +#: ../../library/asyncio-eventloop.rst:1964 msgid "" "import asyncio\n" "import datetime\n" @@ -2937,7 +2978,7 @@ msgstr "" "finally:\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1966 +#: ../../library/asyncio-eventloop.rst:1988 msgid "" "A similar :ref:`current date ` example created with a " "coroutine and the :func:`run` function." @@ -2945,19 +2986,19 @@ msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`current date " "` 範例。" -#: ../../library/asyncio-eventloop.rst:1973 +#: ../../library/asyncio-eventloop.rst:1995 msgid "Watch a file descriptor for read events" msgstr "監聽檔案描述器以進行讀取事件" -#: ../../library/asyncio-eventloop.rst:1975 +#: ../../library/asyncio-eventloop.rst:1997 msgid "" -"Wait until a file descriptor received some data using the :meth:`loop." -"add_reader` method and then close the event loop::" +"Wait until a file descriptor received some data using " +"the :meth:`loop.add_reader` method and then close the event loop::" msgstr "" "使用 :meth:`loop.add_reader` 方法等待檔案描述器接收到某些資料,然後關閉事件迴" "圈: ::" -#: ../../library/asyncio-eventloop.rst:1978 +#: ../../library/asyncio-eventloop.rst:2000 msgid "" "import asyncio\n" "from socket import socketpair\n" @@ -3025,7 +3066,7 @@ msgstr "" " wsock.close()\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:2013 +#: ../../library/asyncio-eventloop.rst:2035 msgid "" "A similar :ref:`example ` using " "transports, protocols, and the :meth:`loop.create_connection` method." @@ -3033,7 +3074,7 @@ msgstr "" "使用傳輸、協定和 :meth:`loop.create_connection` 方法的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:2017 +#: ../../library/asyncio-eventloop.rst:2039 msgid "" "Another similar :ref:`example ` " "using the high-level :func:`asyncio.open_connection` function and streams." @@ -3041,23 +3082,24 @@ msgstr "" "另一個使用高階 :func:`asyncio.open_connection` 函式和串流的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:2025 +#: ../../library/asyncio-eventloop.rst:2047 msgid "Set signal handlers for SIGINT and SIGTERM" msgstr "設定 SIGINT 和 SIGTERM 的訊號處理程式" -#: ../../library/asyncio-eventloop.rst:2027 +#: ../../library/asyncio-eventloop.rst:2049 msgid "(This ``signals`` example only works on Unix.)" msgstr "(此 ``signals`` 範例僅在 Unix 上運作。)" -#: ../../library/asyncio-eventloop.rst:2029 +#: ../../library/asyncio-eventloop.rst:2051 msgid "" -"Register handlers for signals :const:`~signal.SIGINT` and :const:`~signal." -"SIGTERM` using the :meth:`loop.add_signal_handler` method::" +"Register handlers for signals :const:`~signal.SIGINT` " +"and :const:`~signal.SIGTERM` using the :meth:`loop.add_signal_handler` " +"method::" msgstr "" -"使用 :meth:`loop.add_signal_handler` 方法註冊訊號 :py:data:`SIGINT` 和 :py:" -"data:`SIGTERM` 的處理程式: ::" +"使用 :meth:`loop.add_signal_handler` 方法註冊訊號 :py:data:`SIGINT` " +"和 :py:data:`SIGTERM` 的處理程式: ::" -#: ../../library/asyncio-eventloop.rst:2032 +#: ../../library/asyncio-eventloop.rst:2054 msgid "" "import asyncio\n" "import functools\n" @@ -3106,3 +3148,31 @@ msgstr "" "print(f\"pid {os.getpid()}: send SIGINT or SIGTERM to exit.\")\n" "\n" "asyncio.run(main())" + +#~ msgid "" +#~ "Deprecation warning is emitted if there is no current event loop. In some " +#~ "future Python release this will become an error." +#~ msgstr "" +#~ "如果沒有目前事件迴圈,則會發出棄用警告。在未來的某個 Python 發行版中,這將" +#~ "變成錯誤。" + +#~ msgid "" +#~ "import asyncio\n" +#~ "import selectors\n" +#~ "\n" +#~ "class MyPolicy(asyncio.DefaultEventLoopPolicy):\n" +#~ " def new_event_loop(self):\n" +#~ " selector = selectors.SelectSelector()\n" +#~ " return asyncio.SelectorEventLoop(selector)\n" +#~ "\n" +#~ "asyncio.set_event_loop_policy(MyPolicy())" +#~ msgstr "" +#~ "import asyncio\n" +#~ "import selectors\n" +#~ "\n" +#~ "class MyPolicy(asyncio.DefaultEventLoopPolicy):\n" +#~ " def new_event_loop(self):\n" +#~ " selector = selectors.SelectSelector()\n" +#~ " return asyncio.SelectorEventLoop(selector)\n" +#~ "\n" +#~ "asyncio.set_event_loop_policy(MyPolicy())" diff --git a/library/asyncio-future.po b/library/asyncio-future.po index 4d8e563a853..0b0c496481d 100644 --- a/library/asyncio-future.po +++ b/library/asyncio-future.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-10 00:19+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-01-25 01:29+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -72,9 +72,9 @@ msgstr "" #: ../../library/asyncio-future.rst:42 msgid "" -"a :class:`Task` object wrapping *obj*, if *obj* is a coroutine (:func:" -"`iscoroutine` is used for the test); in this case the coroutine will be " -"scheduled by ``ensure_future()``." +"a :class:`Task` object wrapping *obj*, if *obj* is a coroutine " +"(:func:`iscoroutine` is used for the test); in this case the coroutine will " +"be scheduled by ``ensure_future()``." msgstr "" "包裝 (wrap) 了 *obj* 的 :class:`Task` 物件,如果 *obj* 是一個協程 " "(coroutine) (可以用 :func:`iscoroutine` 來進行檢查);在此情況下該協程將透過 " @@ -82,11 +82,11 @@ msgstr "" #: ../../library/asyncio-future.rst:47 msgid "" -"a :class:`Task` object that would await on *obj*, if *obj* is an awaitable (:" -"func:`inspect.isawaitable` is used for the test.)" +"a :class:`Task` object that would await on *obj*, if *obj* is an awaitable " +"(:func:`inspect.isawaitable` is used for the test.)" msgstr "" -"一個會等待 *obj* 的 :class:`Task` 物件,*obj* 須為一個可等待物件(\\ :func:" -"`inspect.isawaitable` 用於測試。)" +"一個會等待 *obj* 的 :class:`Task` 物件,*obj* 須為一個可等待物件" +"(\\ :func:`inspect.isawaitable` 用於測試。)" #: ../../library/asyncio-future.rst:50 msgid "If *obj* is neither of the above a :exc:`TypeError` is raised." @@ -94,21 +94,23 @@ msgstr "如果 *obj* 不是上述物件的話會引發一個 :exc:`TypeError` #: ../../library/asyncio-future.rst:54 msgid "" -"See also the :func:`create_task` function which is the preferred way for " -"creating new Tasks." -msgstr "請見 :func:`create_task` 函式,它是建立新 Task 的推薦方法。" - -#: ../../library/asyncio-future.rst:57 -msgid "" "Save a reference to the result of this function, to avoid a task " "disappearing mid-execution." msgstr "將參照 (reference) 儲存至此函式的結果,用以防止任務在執行中消失。" -#: ../../library/asyncio-future.rst:60 +#: ../../library/asyncio-future.rst:57 +#, fuzzy +msgid "" +"See also the :func:`create_task` function which is the preferred way for " +"creating new tasks or use :class:`asyncio.TaskGroup` which keeps reference " +"to the task internally." +msgstr "請見 :func:`create_task` 函式,它是建立新 Task 的推薦方法。" + +#: ../../library/asyncio-future.rst:61 msgid "The function accepts any :term:`awaitable` object." msgstr "這個函式接受任意 :term:`awaitable` 物件。" -#: ../../library/asyncio-future.rst:63 +#: ../../library/asyncio-future.rst:64 msgid "" "Deprecation warning is emitted if *obj* is not a Future-like object and " "*loop* is not specified and there is no running event loop." @@ -116,15 +118,15 @@ msgstr "" "如果 *obj* 不是類 Future 物件且 *loop* 並未被指定,同時沒有正在執行的事件迴" "圈 (event loop),則會發出棄用警告。" -#: ../../library/asyncio-future.rst:70 +#: ../../library/asyncio-future.rst:71 msgid "" -"Wrap a :class:`concurrent.futures.Future` object in a :class:`asyncio." -"Future` object." +"Wrap a :class:`concurrent.futures.Future` object in " +"a :class:`asyncio.Future` object." msgstr "" "將一個 :class:`concurrent.futures.Future` 物件包裝到 :class:`asyncio.Future` " "物件中。" -#: ../../library/asyncio-future.rst:73 +#: ../../library/asyncio-future.rst:74 msgid "" "Deprecation warning is emitted if *future* is not a Future-like object and " "*loop* is not specified and there is no running event loop." @@ -132,18 +134,18 @@ msgstr "" "如果 *future* 不是類 Future 物件且 *loop* 未被指定,同時沒有正在執行的事件迴" "圈,則會發出棄用警告。" -#: ../../library/asyncio-future.rst:80 +#: ../../library/asyncio-future.rst:81 msgid "Future Object" msgstr "Future 物件" -#: ../../library/asyncio-future.rst:84 +#: ../../library/asyncio-future.rst:85 msgid "" "A Future represents an eventual result of an asynchronous operation. Not " "thread-safe." msgstr "" "一個 Future 代表一個非同步運算的最終結果。並不支援執行緒安全 (thread-safe)。" -#: ../../library/asyncio-future.rst:87 +#: ../../library/asyncio-future.rst:88 msgid "" "Future is an :term:`awaitable` object. Coroutines can await on Future " "objects until they either have a result or an exception set, or until they " @@ -152,42 +154,43 @@ msgstr "" "Future 是一個 :term:`awaitable` 物件。協程可以等待 Future 物件直到它們有結果" "或例外被設置、或者被取消。一個 Future 可被多次等待而結果都會是相同的。" -#: ../../library/asyncio-future.rst:92 +#: ../../library/asyncio-future.rst:93 msgid "" "Typically Futures are used to enable low-level callback-based code (e.g. in " "protocols implemented using asyncio :ref:`transports `) to interoperate with high-level async/await code." msgstr "" -"Future 通常用於讓低階基於回呼的程式(例如在協定實作中使用 asyncio :ref:" -"`transports `\\ )能夠與高階 async/await 程式互" -"動。" +"Future 通常用於讓低階基於回呼的程式(例如在協定實作中使用 " +"asyncio :ref:`transports `\\ )能夠與高階 " +"async/await 程式互動。" -#: ../../library/asyncio-future.rst:97 +#: ../../library/asyncio-future.rst:98 msgid "" "The rule of thumb is to never expose Future objects in user-facing APIs, and " -"the recommended way to create a Future object is to call :meth:`loop." -"create_future`. This way alternative event loop implementations can inject " -"their own optimized implementations of a Future object." +"the recommended way to create a Future object is to " +"call :meth:`loop.create_future`. This way alternative event loop " +"implementations can inject their own optimized implementations of a Future " +"object." msgstr "" -"經驗法則為永遠不要在提供給使用者的 API 中公開 Future 物件,同時建議使用 :" -"meth:`loop.create_future` 來建立 Future 物件。如此一來,不同實作的事件迴圈可" -"以注入自己最佳化實作的 Future 物件。" +"經驗法則為永遠不要在提供給使用者的 API 中公開 Future 物件,同時建議使" +"用 :meth:`loop.create_future` 來建立 Future 物件。如此一來,不同實作的事件迴" +"圈可以注入自己最佳化實作的 Future 物件。" -#: ../../library/asyncio-future.rst:103 +#: ../../library/asyncio-future.rst:104 msgid "Added support for the :mod:`contextvars` module." msgstr "加入對 :mod:`contextvars` 模組的支援。" -#: ../../library/asyncio-future.rst:106 +#: ../../library/asyncio-future.rst:107 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "如果未指定 *loop* 並且沒有正在執行的事件迴圈則會發出棄用警告。" -#: ../../library/asyncio-future.rst:112 +#: ../../library/asyncio-future.rst:113 msgid "Return the result of the Future." msgstr "回傳 Future 的結果。" -#: ../../library/asyncio-future.rst:114 +#: ../../library/asyncio-future.rst:115 msgid "" "If the Future is *done* and has a result set by the :meth:`set_result` " "method, the result value is returned." @@ -195,66 +198,66 @@ msgstr "" "如果 Future 狀態為 *done*\\ (完成),並擁有 :meth:`set_result` 方法設定的一" "個結果,則回傳該結果之值。" -#: ../../library/asyncio-future.rst:117 +#: ../../library/asyncio-future.rst:118 msgid "" -"If the Future is *done* and has an exception set by the :meth:" -"`set_exception` method, this method raises the exception." +"If the Future is *done* and has an exception set by " +"the :meth:`set_exception` method, this method raises the exception." msgstr "" "如果 Future 狀態為 *done*,並擁有 :meth:`set_exception` 方法設定的一個例外," "那麼這個方法會引發該例外。" -#: ../../library/asyncio-future.rst:120 ../../library/asyncio-future.rst:208 +#: ../../library/asyncio-future.rst:121 ../../library/asyncio-future.rst:209 msgid "" -"If the Future has been *cancelled*, this method raises a :exc:" -"`CancelledError` exception." +"If the Future has been *cancelled*, this method raises " +"a :exc:`CancelledError` exception." msgstr "" -"如果 Future 已被 *cancelled*\\ (取消),此方法會引發一個 :exc:" -"`CancelledError` 例外。" +"如果 Future 已被 *cancelled*\\ (取消),此方法會引發一" +"個 :exc:`CancelledError` 例外。" -#: ../../library/asyncio-future.rst:123 +#: ../../library/asyncio-future.rst:124 msgid "" -"If the Future's result isn't yet available, this method raises an :exc:" -"`InvalidStateError` exception." +"If the Future's result isn't yet available, this method raises " +"an :exc:`InvalidStateError` exception." msgstr "" "如果 Future 的結果還不可用,此方法會引發一個 :exc:`InvalidStateError` 例外。" -#: ../../library/asyncio-future.rst:128 +#: ../../library/asyncio-future.rst:129 msgid "Mark the Future as *done* and set its result." msgstr "將 Future 標記為 *done* 並設定其結果。" -#: ../../library/asyncio-future.rst:130 ../../library/asyncio-future.rst:137 +#: ../../library/asyncio-future.rst:131 ../../library/asyncio-future.rst:138 msgid "" "Raises an :exc:`InvalidStateError` error if the Future is already *done*." msgstr "如果 Future 已經 *done* 則引發一個 :exc:`InvalidStateError` 錯誤。" -#: ../../library/asyncio-future.rst:135 +#: ../../library/asyncio-future.rst:136 msgid "Mark the Future as *done* and set an exception." msgstr "將 Future 標記為 *done* 並設定一個例外。" -#: ../../library/asyncio-future.rst:142 +#: ../../library/asyncio-future.rst:143 msgid "Return ``True`` if the Future is *done*." msgstr "如果 Future 已為 *done* 則回傳 ``True``。" -#: ../../library/asyncio-future.rst:144 +#: ../../library/asyncio-future.rst:145 msgid "" "A Future is *done* if it was *cancelled* or if it has a result or an " "exception set with :meth:`set_result` or :meth:`set_exception` calls." msgstr "" -"如果 Future 有被 *cancelled*、:meth:`set_result` 有被呼叫來為其設定結果、或 :" -"meth:`set_exception` 有被呼叫為其設定例外,那麼它就是 *done*。" +"如果 Future 有被 *cancelled*、:meth:`set_result` 有被呼叫來為其設定結果、" +"或 :meth:`set_exception` 有被呼叫為其設定例外,那麼它就是 *done*。" -#: ../../library/asyncio-future.rst:150 +#: ../../library/asyncio-future.rst:151 msgid "Return ``True`` if the Future was *cancelled*." msgstr "如果 Future 已經被 *cancelled* 則回傳 ``True``。" -#: ../../library/asyncio-future.rst:152 +#: ../../library/asyncio-future.rst:153 msgid "" "The method is usually used to check if a Future is not *cancelled* before " "setting a result or an exception for it::" msgstr "" "這個方法通常在為 Future 設定結果或例外前用來確認它還沒被 *cancelled*: ::" -#: ../../library/asyncio-future.rst:155 +#: ../../library/asyncio-future.rst:156 msgid "" "if not fut.cancelled():\n" " fut.set_result(42)" @@ -262,15 +265,15 @@ msgstr "" "if not fut.cancelled():\n" " fut.set_result(42)" -#: ../../library/asyncio-future.rst:160 +#: ../../library/asyncio-future.rst:161 msgid "Add a callback to be run when the Future is *done*." msgstr "新增一個在 Future 為 *done* 時執行的回呼函式。" -#: ../../library/asyncio-future.rst:162 +#: ../../library/asyncio-future.rst:163 msgid "The *callback* is called with the Future object as its only argument." msgstr "呼叫 *callback* 並附帶做為唯一引數的 Future 物件。" -#: ../../library/asyncio-future.rst:165 +#: ../../library/asyncio-future.rst:166 msgid "" "If the Future is already *done* when this method is called, the callback is " "scheduled with :meth:`loop.call_soon`." @@ -278,49 +281,50 @@ msgstr "" "如果呼叫這個方法時 Future 已經為 *done*,回呼函式會被 :meth:`loop.call_soon` " "排程。" -#: ../../library/asyncio-future.rst:168 +#: ../../library/asyncio-future.rst:169 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *callback* to run in. The current " -"context is used when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *callback* to run in. The " +"current context is used when no *context* is provided." msgstr "" -"可選僅限關鍵字引數 *context* 用來指定一個讓 *callback* 執行於其中的客製化 :" -"class:`contextvars.Context` 物件。如果沒有提供 *context*,則使用目前情境。" +"可選僅限關鍵字引數 *context* 用來指定一個讓 *callback* 執行於其中的客製" +"化 :class:`contextvars.Context` 物件。如果沒有提供 *context*,則使用目前情" +"境。" -#: ../../library/asyncio-future.rst:172 +#: ../../library/asyncio-future.rst:173 msgid "" -":func:`functools.partial` can be used to pass parameters to the callback, e." -"g.::" +":func:`functools.partial` can be used to pass parameters to the callback, " +"e.g.::" msgstr "可以用 :func:`functools.partial` 傳遞引數給回呼函式,例如: ::" -#: ../../library/asyncio-future.rst:175 +#: ../../library/asyncio-future.rst:176 msgid "" "# Call 'print(\"Future:\", fut)' when \"fut\" is done.\n" "fut.add_done_callback(\n" " functools.partial(print, \"Future:\"))" msgstr "" -#: ../../library/asyncio-future.rst:179 +#: ../../library/asyncio-future.rst:180 msgid "" "The *context* keyword-only parameter was added. See :pep:`567` for more " "details." msgstr "加入僅限關鍵字參數 *context*。更多細節請參閱 :pep:`567`。" -#: ../../library/asyncio-future.rst:185 +#: ../../library/asyncio-future.rst:186 msgid "Remove *callback* from the callbacks list." msgstr "從回呼列表中移除 *callback*。" -#: ../../library/asyncio-future.rst:187 +#: ../../library/asyncio-future.rst:188 msgid "" "Returns the number of callbacks removed, which is typically 1, unless a " "callback was added more than once." msgstr "回傳被移除的回呼函式數量,通常為 1,除非一個回呼函式被多次加入。" -#: ../../library/asyncio-future.rst:192 +#: ../../library/asyncio-future.rst:193 msgid "Cancel the Future and schedule callbacks." msgstr "取消 Future 並為回呼函式排程。" -#: ../../library/asyncio-future.rst:194 +#: ../../library/asyncio-future.rst:195 msgid "" "If the Future is already *done* or *cancelled*, return ``False``. Otherwise, " "change the Future's state to *cancelled*, schedule the callbacks, and return " @@ -329,33 +333,33 @@ msgstr "" "如果 Future 已經是 *done* 或 *cancelled*,回傳 ``False``。否則將 Future 狀態" "改為 *cancelled* 並在為回呼函式排程後回傳 ``True``。" -#: ../../library/asyncio-future.rst:198 +#: ../../library/asyncio-future.rst:199 msgid "Added the *msg* parameter." msgstr "新增 *msg* 參數。" -#: ../../library/asyncio-future.rst:203 +#: ../../library/asyncio-future.rst:204 msgid "Return the exception that was set on this Future." msgstr "回傳被設定於此 Future 的例外。" -#: ../../library/asyncio-future.rst:205 +#: ../../library/asyncio-future.rst:206 msgid "" "The exception (or ``None`` if no exception was set) is returned only if the " "Future is *done*." msgstr "" "只有 Future 在 *done* 時才回傳例外(如果沒有設定例外則回傳 ``None``\\ )。" -#: ../../library/asyncio-future.rst:211 +#: ../../library/asyncio-future.rst:212 msgid "" -"If the Future isn't *done* yet, this method raises an :exc:" -"`InvalidStateError` exception." +"If the Future isn't *done* yet, this method raises " +"an :exc:`InvalidStateError` exception." msgstr "" "如果 Future 還不為 *done*,此方法會引發一個 :exc:`InvalidStateError` 例外。" -#: ../../library/asyncio-future.rst:216 +#: ../../library/asyncio-future.rst:217 msgid "Return the event loop the Future object is bound to." msgstr "回傳已被 Future 物件繫結 (bind) 的事件迴圈。" -#: ../../library/asyncio-future.rst:223 +#: ../../library/asyncio-future.rst:224 msgid "" "This example creates a Future object, creates and schedules an asynchronous " "Task to set result for the Future, and waits until the Future has a result::" @@ -363,7 +367,7 @@ msgstr "" "這個例子建立一個 Future 物件,建立一個非同步 Task 並為其排程以設定 Future 結" "果,然後等待 Future 結果出現: ::" -#: ../../library/asyncio-future.rst:227 +#: ../../library/asyncio-future.rst:228 msgid "" "async def set_after(fut, delay, value):\n" " # Sleep for *delay* seconds.\n" @@ -394,7 +398,7 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-future.rst:258 +#: ../../library/asyncio-future.rst:259 msgid "" "The Future object was designed to mimic :class:`concurrent.futures.Future`. " "Key differences include:" @@ -402,7 +406,7 @@ msgstr "" "該 Future 物件是為了模仿 :class:`concurrent.futures.Future` 而設計。主要差異" "包含:" -#: ../../library/asyncio-future.rst:261 +#: ../../library/asyncio-future.rst:262 msgid "" "unlike asyncio Futures, :class:`concurrent.futures.Future` instances cannot " "be awaited." @@ -410,7 +414,7 @@ msgstr "" "與 asyncio 的 Future 不同,:class:`concurrent.futures.Future` 實例不可被等" "待。" -#: ../../library/asyncio-future.rst:264 +#: ../../library/asyncio-future.rst:265 msgid "" ":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` do not " "accept the *timeout* argument." @@ -418,15 +422,16 @@ msgstr "" ":meth:`asyncio.Future.result` 和 :meth:`asyncio.Future.exception` 不接受 " "*timeout* 引數。" -#: ../../library/asyncio-future.rst:267 +#: ../../library/asyncio-future.rst:268 msgid "" -":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` raise an :" -"exc:`InvalidStateError` exception when the Future is not *done*." +":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` raise " +"an :exc:`InvalidStateError` exception when the Future is not *done*." msgstr "" -"Future 不為 *done* 時 :meth:`asyncio.Future.result` 和 :meth:`asyncio.Future." -"exception` 會引發一個 :exc:`InvalidStateError` 例外。" +"Future 不為 *done* 時 :meth:`asyncio.Future.result` " +"和 :meth:`asyncio.Future.exception` 會引發一個 :exc:`InvalidStateError` 例" +"外。" -#: ../../library/asyncio-future.rst:271 +#: ../../library/asyncio-future.rst:272 msgid "" "Callbacks registered with :meth:`asyncio.Future.add_done_callback` are not " "called immediately. They are scheduled with :meth:`loop.call_soon` instead." @@ -434,18 +439,18 @@ msgstr "" "使用 :meth:`asyncio.Future.add_done_callback` 註冊的回呼函式不會立即呼叫,而" "是被 :meth:`loop.call_soon` 排程。" -#: ../../library/asyncio-future.rst:275 +#: ../../library/asyncio-future.rst:276 msgid "" "asyncio Future is not compatible with the :func:`concurrent.futures.wait` " "and :func:`concurrent.futures.as_completed` functions." msgstr "" -"asyncio Future 不能與 :func:`concurrent.futures.wait` 和 :func:`concurrent." -"futures.as_completed` 函式相容。" +"asyncio Future 不能與 :func:`concurrent.futures.wait` " +"和 :func:`concurrent.futures.as_completed` 函式相容。" -#: ../../library/asyncio-future.rst:279 +#: ../../library/asyncio-future.rst:280 msgid "" -":meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument, but :" -"meth:`concurrent.futures.Future.cancel` does not." +":meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument, " +"but :meth:`concurrent.futures.Future.cancel` does not." msgstr "" -":meth:`asyncio.Future.cancel` 接受一個可選的 ``msg`` 引數,但 :func:" -"`concurrent.futures.Future.cancel` 無此引數。" +":meth:`asyncio.Future.cancel` 接受一個可選的 ``msg`` 引數," +"但 :func:`concurrent.futures.Future.cancel` 無此引數。" diff --git a/library/asyncio-graph.po b/library/asyncio-graph.po new file mode 100644 index 00000000000..ce9e8e24336 --- /dev/null +++ b/library/asyncio-graph.po @@ -0,0 +1,202 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/asyncio-graph.rst:8 +msgid "Call Graph Introspection" +msgstr "" + +#: ../../library/asyncio-graph.rst:10 +msgid "**Source code:** :source:`Lib/asyncio/graph.py`" +msgstr "" + +#: ../../library/asyncio-graph.rst:14 +msgid "" +"asyncio has powerful runtime call graph introspection utilities to trace the " +"entire call graph of a running *coroutine* or *task*, or a suspended " +"*future*. These utilities and the underlying machinery can be used from " +"within a Python program or by external profilers and debuggers." +msgstr "" + +#: ../../library/asyncio-graph.rst:25 +msgid "" +"Print the async call graph for the current task or the " +"provided :class:`Task` or :class:`Future`." +msgstr "" + +#: ../../library/asyncio-graph.rst:28 +msgid "" +"This function prints entries starting from the top frame and going down " +"towards the invocation point." +msgstr "" + +#: ../../library/asyncio-graph.rst:31 +msgid "" +"The function receives an optional *future* argument. If not passed, the " +"current running task will be used." +msgstr "" + +#: ../../library/asyncio-graph.rst:34 ../../library/asyncio-graph.rst:93 +msgid "" +"If the function is called on *the current task*, the optional keyword-only " +"*depth* argument can be used to skip the specified number of frames from top " +"of the stack." +msgstr "" + +#: ../../library/asyncio-graph.rst:38 +msgid "" +"If the optional keyword-only *limit* argument is provided, each call stack " +"in the resulting graph is truncated to include at most ``abs(limit)`` " +"entries. If *limit* is positive, the entries left are the closest to the " +"invocation point. If *limit* is negative, the topmost entries are left. If " +"*limit* is omitted or ``None``, all entries are present. If *limit* is " +"``0``, the call stack is not printed at all, only \"awaited by\" information " +"is printed." +msgstr "" + +#: ../../library/asyncio-graph.rst:46 +msgid "" +"If *file* is omitted or ``None``, the function will print " +"to :data:`sys.stdout`." +msgstr "" + +#: ../../library/asyncio-graph.rst:49 +msgid "**Example:**" +msgstr "" + +#: ../../library/asyncio-graph.rst:51 +msgid "The following Python code:" +msgstr "" + +#: ../../library/asyncio-graph.rst:53 +msgid "" +"import asyncio\n" +"\n" +"async def test():\n" +" asyncio.print_call_graph()\n" +"\n" +"async def main():\n" +" async with asyncio.TaskGroup() as g:\n" +" g.create_task(test(), name='test')\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: ../../library/asyncio-graph.rst:66 +msgid "will print::" +msgstr "" + +#: ../../library/asyncio-graph.rst:68 +msgid "" +"* Task(name='test', id=0x1039f0fe0)\n" +"+ Call stack:\n" +"| File 't2.py', line 4, in async test()\n" +"+ Awaited by:\n" +" * Task(name='Task-1', id=0x103a5e060)\n" +" + Call stack:\n" +" | File 'taskgroups.py', line 107, in async TaskGroup.__aexit__()\n" +" | File 't2.py', line 7, in async main()" +msgstr "" + +#: ../../library/asyncio-graph.rst:79 +msgid "" +"Like :func:`print_call_graph`, but returns a string. If *future* is ``None`` " +"and there's no current task, the function returns an empty string." +msgstr "" + +#: ../../library/asyncio-graph.rst:86 +msgid "" +"Capture the async call graph for the current task or the " +"provided :class:`Task` or :class:`Future`." +msgstr "" + +#: ../../library/asyncio-graph.rst:89 +msgid "" +"The function receives an optional *future* argument. If not passed, the " +"current running task will be used. If there's no current task, the function " +"returns ``None``." +msgstr "" + +#: ../../library/asyncio-graph.rst:97 +msgid "Returns a ``FutureCallGraph`` data class object:" +msgstr "" + +#: ../../library/asyncio-graph.rst:99 +msgid "``FutureCallGraph(future, call_stack, awaited_by)``" +msgstr "" + +#: ../../library/asyncio-graph.rst:101 +msgid "" +"Where *future* is a reference to a :class:`Future` or a :class:`Task` (or " +"their subclasses.)" +msgstr "" + +#: ../../library/asyncio-graph.rst:104 +msgid "``call_stack`` is a tuple of ``FrameCallGraphEntry`` objects." +msgstr "" + +#: ../../library/asyncio-graph.rst:106 +msgid "``awaited_by`` is a tuple of ``FutureCallGraph`` objects." +msgstr "" + +#: ../../library/asyncio-graph.rst:108 +msgid "``FrameCallGraphEntry(frame)``" +msgstr "" + +#: ../../library/asyncio-graph.rst:110 +msgid "" +"Where *frame* is a frame object of a regular Python function in the call " +"stack." +msgstr "" + +#: ../../library/asyncio-graph.rst:115 +msgid "Low level utility functions" +msgstr "" + +#: ../../library/asyncio-graph.rst:117 +msgid "" +"To introspect an async call graph asyncio requires cooperation from control " +"flow structures, such as :func:`shield` or :class:`TaskGroup`. Any time an " +"intermediate :class:`Future` object with low-level APIs " +"like :meth:`Future.add_done_callback() ` " +"is involved, the following two functions should be used to inform asyncio " +"about how exactly such intermediate future objects are connected with the " +"tasks they wrap or control." +msgstr "" + +#: ../../library/asyncio-graph.rst:128 +msgid "Record that *future* is awaited on by *waiter*." +msgstr "" + +#: ../../library/asyncio-graph.rst:130 ../../library/asyncio-graph.rst:143 +msgid "" +"Both *future* and *waiter* must be instances of :class:`Future` " +"or :class:`Task` or their subclasses, otherwise the call would have no " +"effect." +msgstr "" + +#: ../../library/asyncio-graph.rst:134 +msgid "" +"A call to ``future_add_to_awaited_by()`` must be followed by an eventual " +"call to the :func:`future_discard_from_awaited_by` function with the same " +"arguments." +msgstr "" + +#: ../../library/asyncio-graph.rst:141 +msgid "Record that *future* is no longer awaited on by *waiter*." +msgstr "" diff --git a/library/asyncio-llapi-index.po b/library/asyncio-llapi-index.po index 22a41d34ecc..555d9dd6d5f 100644 --- a/library/asyncio-llapi-index.po +++ b/library/asyncio-llapi-index.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-10-11 17:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-10-12 11:27+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -199,7 +199,8 @@ msgid "Invoke a callback *at* the given time." msgstr "在給定時間\\ *當下*\\ 呼叫回呼函式。" #: ../../library/asyncio-llapi-index.rst:99 -msgid "Thread/Process Pool" +#, fuzzy +msgid "Thread/Interpreter/Process Pool" msgstr "執行緒 (Thread)/行程池 (Process Pool)" #: ../../library/asyncio-llapi-index.rst:104 @@ -649,12 +650,13 @@ msgstr "回傳目前協定。" #: ../../library/asyncio-llapi-index.rst:314 msgid "" "Transports that can receive data (TCP and Unix connections, pipes, etc). " -"Returned from methods like :meth:`loop.create_connection`, :meth:`loop." -"create_unix_connection`, :meth:`loop.connect_read_pipe`, etc:" +"Returned from methods " +"like :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_read_pipe`, " +"etc:" msgstr "" -"可以接收資料(TCP 和 Unix 連線、pipe 等)的傳輸。它由 :meth:`loop." -"create_connection`、:meth:`loop.create_unix_connection`、:meth:`loop." -"connect_read_pipe` 等方法回傳:" +"可以接收資料(TCP 和 Unix 連線、pipe 等)的傳輸。它" +"由 :meth:`loop.create_connection`、:meth:`loop.create_unix_connection`、:meth:`loop.connect_read_pipe` " +"等方法回傳:" #: ../../library/asyncio-llapi-index.rst:319 msgid "Read Transports" @@ -687,12 +689,13 @@ msgstr "繼續接收。" #: ../../library/asyncio-llapi-index.rst:334 msgid "" "Transports that can Send data (TCP and Unix connections, pipes, etc). " -"Returned from methods like :meth:`loop.create_connection`, :meth:`loop." -"create_unix_connection`, :meth:`loop.connect_write_pipe`, etc:" +"Returned from methods " +"like :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_write_pipe`, " +"etc:" msgstr "" -"可以傳送資料(TCP 和 Unix 連線、pipe 等)的傳輸。它由 :meth:`loop." -"create_connection`、:meth:`loop.create_unix_connection`、:meth:`loop." -"connect_write_pipe` 等方法回傳:" +"可以傳送資料(TCP 和 Unix 連線、pipe 等)的傳輸。它" +"由 :meth:`loop.create_connection`、:meth:`loop.create_unix_connection`、:meth:`loop.connect_write_pipe` " +"等方法回傳:" #: ../../library/asyncio-llapi-index.rst:339 msgid "Write Transports" @@ -741,11 +744,11 @@ msgstr "立即關閉傳輸。" #: ../../library/asyncio-llapi-index.rst:359 msgid "" -":meth:`transport.get_write_buffer_size() `" +":meth:`transport.get_write_buffer_size() " +"`" msgstr "" -":meth:`transport.get_write_buffer_size() `" +":meth:`transport.get_write_buffer_size() " +"`" #: ../../library/asyncio-llapi-index.rst:361 msgid "Return the current size of the output buffer." @@ -753,11 +756,11 @@ msgstr "回傳目前輸出緩衝區的大小。" #: ../../library/asyncio-llapi-index.rst:363 msgid "" -":meth:`transport.get_write_buffer_limits() `" +":meth:`transport.get_write_buffer_limits() " +"`" msgstr "" -":meth:`transport.get_write_buffer_limits() `" +":meth:`transport.get_write_buffer_limits() " +"`" #: ../../library/asyncio-llapi-index.rst:365 msgid "Return high and low water marks for write flow control." @@ -767,11 +770,11 @@ msgstr "" #: ../../library/asyncio-llapi-index.rst:367 msgid "" -":meth:`transport.set_write_buffer_limits() `" +":meth:`transport.set_write_buffer_limits() " +"`" msgstr "" -":meth:`transport.set_write_buffer_limits() `" +":meth:`transport.set_write_buffer_limits() " +"`" #: ../../library/asyncio-llapi-index.rst:369 msgid "Set new high and low water marks for write flow control." @@ -799,11 +802,11 @@ msgstr ":meth:`transport.abort() `" #: ../../library/asyncio-llapi-index.rst:386 msgid "" -"Low-level transport abstraction over subprocesses. Returned by :meth:`loop." -"subprocess_exec` and :meth:`loop.subprocess_shell`:" +"Low-level transport abstraction over subprocesses. Returned " +"by :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell`:" msgstr "" -"基於子行程的低階傳輸抽象,它會由 :meth:`loop.subprocess_exec` 和 :meth:`loop." -"subprocess_shell` 所回傳:" +"基於子行程的低階傳輸抽象,它會由 :meth:`loop.subprocess_exec` " +"和 :meth:`loop.subprocess_shell` 所回傳:" #: ../../library/asyncio-llapi-index.rst:390 msgid "Subprocess Transports" @@ -819,11 +822,11 @@ msgstr "回傳子行程的行程 id。" #: ../../library/asyncio-llapi-index.rst:398 msgid "" -":meth:`transport.get_pipe_transport() `" +":meth:`transport.get_pipe_transport() " +"`" msgstr "" -":meth:`transport.get_pipe_transport() `" +":meth:`transport.get_pipe_transport() " +"`" #: ../../library/asyncio-llapi-index.rst:400 msgid "" @@ -1012,9 +1015,9 @@ msgstr "" #: ../../library/asyncio-llapi-index.rst:497 msgid "" -"Called when the child process has exited. It can be called before :meth:" -"`~SubprocessProtocol.pipe_data_received` and :meth:`~SubprocessProtocol." -"pipe_connection_lost` methods." +"Called when the child process has exited. It can be called " +"before :meth:`~SubprocessProtocol.pipe_data_received` " +"and :meth:`~SubprocessProtocol.pipe_connection_lost` methods." msgstr "" "在子行程退出時呼叫。它可以在 :meth:`~SubprocessProtocol.pipe_data_received` " "和 :meth:`~SubprocessProtocol.pipe_connection_lost` 方法之前呼叫。" @@ -1025,9 +1028,9 @@ msgstr "事件迴圈 Policies" #: ../../library/asyncio-llapi-index.rst:505 msgid "" -"Policies is a low-level mechanism to alter the behavior of functions like :" -"func:`asyncio.get_event_loop`. See also the main :ref:`policies section " -"` for more details." +"Policies is a low-level mechanism to alter the behavior of functions " +"like :func:`asyncio.get_event_loop`. See also the main :ref:`policies " +"section ` for more details." msgstr "" "Policy 是改變 :func:`asyncio.get_event_loop` 這類函式行為的一個低階機制。更多" "細節請見 :ref:`Policy 相關段落 `。" diff --git a/library/asyncio-platforms.po b/library/asyncio-platforms.po index cc9f8570c66..8f1332f00a0 100644 --- a/library/asyncio-platforms.po +++ b/library/asyncio-platforms.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-01-17 11:37+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -70,17 +70,17 @@ msgid "" ":meth:`loop.create_unix_connection` and :meth:`loop.create_unix_server` are " "not supported. The :const:`socket.AF_UNIX` socket family is specific to Unix." msgstr "" -"不支援 :meth:`loop.create_unix_connection` 和 :meth:`loop." -"create_unix_server`。:const:`socket.AF_UNIX` socket 系列常數僅限於 Unix 上使" -"用。" +"不支援 :meth:`loop.create_unix_connection` " +"和 :meth:`loop.create_unix_server`。:const:`socket.AF_UNIX` socket 系列常數僅" +"限於 Unix 上使用。" #: ../../library/asyncio-platforms.rst:42 msgid "" ":meth:`loop.add_signal_handler` and :meth:`loop.remove_signal_handler` are " "not supported." msgstr "" -"不支援 :meth:`loop.add_signal_handler` 和 :meth:`loop." -"remove_signal_handler`。" +"不支援 :meth:`loop.add_signal_handler` " +"和 :meth:`loop.remove_signal_handler`。" #: ../../library/asyncio-platforms.rst:45 msgid ":class:`SelectorEventLoop` has the following limitations:" @@ -104,21 +104,21 @@ msgstr "" #: ../../library/asyncio-platforms.rst:53 msgid "" -"Pipes are not supported, so the :meth:`loop.connect_read_pipe` and :meth:" -"`loop.connect_write_pipe` methods are not implemented." +"Pipes are not supported, so the :meth:`loop.connect_read_pipe` " +"and :meth:`loop.connect_write_pipe` methods are not implemented." msgstr "" -"因為不支援 pipe,所以 :meth:`loop.connect_read_pipe` 和 :meth:`loop." -"connect_write_pipe` method 沒有被實作出來。" +"因為不支援 pipe,所以 :meth:`loop.connect_read_pipe` " +"和 :meth:`loop.connect_write_pipe` method 沒有被實作出來。" #: ../../library/asyncio-platforms.rst:56 msgid "" -":ref:`Subprocesses ` are not supported, i.e. :meth:`loop." -"subprocess_exec` and :meth:`loop.subprocess_shell` methods are not " -"implemented." +":ref:`Subprocesses ` are not supported, " +"i.e. :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods " +"are not implemented." msgstr "" -"不支援\\ :ref:`子行程 (subprocess) `,也就是說 :meth:" -"`loop.subprocess_exec` 和 :meth:`loop.subprocess_shell` method 沒有被實作出" -"來。" +"不支援\\ :ref:`子行程 (subprocess) `,也就是" +"說 :meth:`loop.subprocess_exec` 和 :meth:`loop.subprocess_shell` method 沒有" +"被實作出來。" #: ../../library/asyncio-platforms.rst:60 msgid ":class:`ProactorEventLoop` has the following limitations:" @@ -150,46 +150,37 @@ msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " "subprocesses, whereas :class:`SelectorEventLoop` does not." msgstr "" -"在 Windows 上,預設的事件迴圈 :class:`ProactorEventLoop` 支援子行程,而 :" -"class:`SelectorEventLoop` 則不支援。" +"在 Windows 上,預設的事件迴圈 :class:`ProactorEventLoop` 支援子行程," +"而 :class:`SelectorEventLoop` 則不支援。" -#: ../../library/asyncio-platforms.rst:80 -msgid "" -"The :meth:`policy.set_child_watcher() ` function is also not supported, as :class:" -"`ProactorEventLoop` has a different mechanism to watch child processes." -msgstr "" -"也不支援 :meth:`policy.set_child_watcher() ` 函式,:class:`ProactorEventLoop` 在監視子行程上有不同的機" -"制。" - -#: ../../library/asyncio-platforms.rst:87 +#: ../../library/asyncio-platforms.rst:82 msgid "macOS" msgstr "macOS" -#: ../../library/asyncio-platforms.rst:89 +#: ../../library/asyncio-platforms.rst:84 msgid "Modern macOS versions are fully supported." msgstr "完整支援現在普遍流行的 macOS 版本。" -#: ../../library/asyncio-platforms.rst:92 +#: ../../library/asyncio-platforms.rst:87 msgid "macOS <= 10.8" msgstr "macOS <= 10.8" -#: ../../library/asyncio-platforms.rst:93 +#: ../../library/asyncio-platforms.rst:88 msgid "" -"On macOS 10.6, 10.7 and 10.8, the default event loop uses :class:`selectors." -"KqueueSelector`, which does not support character devices on these " -"versions. The :class:`SelectorEventLoop` can be manually configured to use :" -"class:`~selectors.SelectSelector` or :class:`~selectors.PollSelector` to " -"support character devices on these older versions of macOS. Example::" +"On macOS 10.6, 10.7 and 10.8, the default event loop " +"uses :class:`selectors.KqueueSelector`, which does not support character " +"devices on these versions. The :class:`SelectorEventLoop` can be manually " +"configured to use :class:`~selectors.SelectSelector` " +"or :class:`~selectors.PollSelector` to support character devices on these " +"older versions of macOS. Example::" msgstr "" -"在 macOS 10.6、10.7 和 10.8 上,預設的事件迴圈是使用 :class:`selectors." -"KqueueSelector`,在這些版本上它並不支援字元裝置 (character device)。可以手工" -"設置 :class:`SelectorEventLoop` 來使用 :class:`~selectors.SelectSelector` " -"或 :class:`~selectors.PollSelector` 以在這些舊版 macOS 上支援字元裝置。例" -"如: ::" +"在 macOS 10.6、10.7 和 10.8 上,預設的事件迴圈是使" +"用 :class:`selectors.KqueueSelector`,在這些版本上它並不支援字元裝置 " +"(character device)。可以手工設置 :class:`SelectorEventLoop` 來使" +"用 :class:`~selectors.SelectSelector` 或 :class:`~selectors.PollSelector` 以" +"在這些舊版 macOS 上支援字元裝置。例如: ::" -#: ../../library/asyncio-platforms.rst:100 +#: ../../library/asyncio-platforms.rst:95 msgid "" "import asyncio\n" "import selectors\n" @@ -204,3 +195,13 @@ msgstr "" "selector = selectors.SelectSelector()\n" "loop = asyncio.SelectorEventLoop(selector)\n" "asyncio.set_event_loop(loop)" + +#~ msgid "" +#~ "The :meth:`policy.set_child_watcher() " +#~ "` function is also not " +#~ "supported, as :class:`ProactorEventLoop` has a different mechanism to " +#~ "watch child processes." +#~ msgstr "" +#~ "也不支援 :meth:`policy.set_child_watcher() " +#~ "` 函" +#~ "式,:class:`ProactorEventLoop` 在監視子行程上有不同的機制。" diff --git a/library/asyncio-policy.po b/library/asyncio-policy.po index 41fd70c5a6f..459eb052ef2 100644 --- a/library/asyncio-policy.po +++ b/library/asyncio-policy.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,371 +22,190 @@ msgstr "" msgid "Policies" msgstr "" -#: ../../library/asyncio-policy.rst:10 +#: ../../library/asyncio-policy.rst:12 msgid "" -"An event loop policy is a global object used to get and set the current :ref:" -"`event loop `, as well as create new event loops. The " -"default policy can be :ref:`replaced ` with :ref:" -"`built-in alternatives ` to use different event loop " -"implementations, or substituted by a :ref:`custom policy ` that can override these behaviors." +"Policies are deprecated and will be removed in Python 3.16. Users are " +"encouraged to use the :func:`asyncio.run` function or " +"the :class:`asyncio.Runner` with *loop_factory* to use the desired loop " +"implementation." msgstr "" -#: ../../library/asyncio-policy.rst:19 +#: ../../library/asyncio-policy.rst:18 +msgid "" +"An event loop policy is a global object used to get and set the " +"current :ref:`event loop `, as well as create new event " +"loops. The default policy can be :ref:`replaced ` " +"with :ref:`built-in alternatives ` to use different " +"event loop implementations, or substituted by a :ref:`custom policy ` that can override these behaviors." +msgstr "" + +#: ../../library/asyncio-policy.rst:27 msgid "" "The :ref:`policy object ` gets and sets a separate " "event loop per *context*. This is per-thread by default, though custom " "policies could define *context* differently." msgstr "" -#: ../../library/asyncio-policy.rst:24 +#: ../../library/asyncio-policy.rst:32 msgid "" -"Custom event loop policies can control the behavior of :func:" -"`get_event_loop`, :func:`set_event_loop`, and :func:`new_event_loop`." +"Custom event loop policies can control the behavior " +"of :func:`get_event_loop`, :func:`set_event_loop`, " +"and :func:`new_event_loop`." msgstr "" -#: ../../library/asyncio-policy.rst:27 +#: ../../library/asyncio-policy.rst:35 msgid "" -"Policy objects should implement the APIs defined in the :class:" -"`AbstractEventLoopPolicy` abstract base class." +"Policy objects should implement the APIs defined in " +"the :class:`AbstractEventLoopPolicy` abstract base class." msgstr "" -#: ../../library/asyncio-policy.rst:34 +#: ../../library/asyncio-policy.rst:42 msgid "Getting and Setting the Policy" msgstr "" -#: ../../library/asyncio-policy.rst:36 +#: ../../library/asyncio-policy.rst:44 msgid "" "The following functions can be used to get and set the policy for the " "current process:" msgstr "" -#: ../../library/asyncio-policy.rst:41 +#: ../../library/asyncio-policy.rst:49 msgid "Return the current process-wide policy." msgstr "" -#: ../../library/asyncio-policy.rst:45 +#: ../../library/asyncio-policy.rst:51 +msgid "" +"The :func:`get_event_loop_policy` function is deprecated and will be removed " +"in Python 3.16." +msgstr "" + +#: ../../library/asyncio-policy.rst:57 msgid "Set the current process-wide policy to *policy*." msgstr "" -#: ../../library/asyncio-policy.rst:47 +#: ../../library/asyncio-policy.rst:59 msgid "If *policy* is set to ``None``, the default policy is restored." msgstr "" -#: ../../library/asyncio-policy.rst:53 +#: ../../library/asyncio-policy.rst:61 +msgid "" +"The :func:`set_event_loop_policy` function is deprecated and will be removed " +"in Python 3.16." +msgstr "" + +#: ../../library/asyncio-policy.rst:69 msgid "Policy Objects" msgstr "" -#: ../../library/asyncio-policy.rst:55 +#: ../../library/asyncio-policy.rst:71 msgid "The abstract event loop policy base class is defined as follows:" msgstr "" -#: ../../library/asyncio-policy.rst:59 +#: ../../library/asyncio-policy.rst:75 msgid "An abstract base class for asyncio policies." msgstr "" -#: ../../library/asyncio-policy.rst:63 +#: ../../library/asyncio-policy.rst:79 msgid "Get the event loop for the current context." msgstr "" -#: ../../library/asyncio-policy.rst:65 +#: ../../library/asyncio-policy.rst:81 msgid "" "Return an event loop object implementing the :class:`AbstractEventLoop` " "interface." msgstr "" -#: ../../library/asyncio-policy.rst:68 ../../library/asyncio-policy.rst:80 +#: ../../library/asyncio-policy.rst:84 ../../library/asyncio-policy.rst:96 msgid "This method should never return ``None``." msgstr "" -#: ../../library/asyncio-policy.rst:74 +#: ../../library/asyncio-policy.rst:90 msgid "Set the event loop for the current context to *loop*." msgstr "" -#: ../../library/asyncio-policy.rst:78 +#: ../../library/asyncio-policy.rst:94 msgid "Create and return a new event loop object." msgstr "" -#: ../../library/asyncio-policy.rst:84 -msgid "Get a child process watcher object." -msgstr "" - -#: ../../library/asyncio-policy.rst:86 +#: ../../library/asyncio-policy.rst:98 msgid "" -"Return a watcher object implementing the :class:`AbstractChildWatcher` " -"interface." -msgstr "" - -#: ../../library/asyncio-policy.rst:89 ../../library/asyncio-policy.rst:97 -msgid "This function is Unix specific." +"The :class:`AbstractEventLoopPolicy` class is deprecated and will be removed " +"in Python 3.16." msgstr "" -#: ../../library/asyncio-policy.rst:95 -msgid "Set the current child process watcher to *watcher*." -msgstr "" - -#: ../../library/asyncio-policy.rst:104 +#: ../../library/asyncio-policy.rst:105 msgid "asyncio ships with the following built-in policies:" msgstr "" -#: ../../library/asyncio-policy.rst:109 +#: ../../library/asyncio-policy.rst:110 msgid "" -"The default asyncio policy. Uses :class:`SelectorEventLoop` on Unix and :" -"class:`ProactorEventLoop` on Windows." +"The default asyncio policy. Uses :class:`SelectorEventLoop` on Unix " +"and :class:`ProactorEventLoop` on Windows." msgstr "" -#: ../../library/asyncio-policy.rst:112 +#: ../../library/asyncio-policy.rst:113 msgid "" "There is no need to install the default policy manually. asyncio is " "configured to use the default policy automatically." msgstr "" -#: ../../library/asyncio-policy.rst:117 +#: ../../library/asyncio-policy.rst:118 msgid "On Windows, :class:`ProactorEventLoop` is now used by default." msgstr "" -#: ../../library/asyncio-policy.rst:119 +#: ../../library/asyncio-policy.rst:120 +msgid "" +"The :meth:`get_event_loop` method of the default asyncio policy now raises " +"a :exc:`RuntimeError` if there is no set event loop." +msgstr "" + +#: ../../library/asyncio-policy.rst:124 msgid "" -"The :meth:`get_event_loop` method of the default asyncio policy now emits a :" -"exc:`DeprecationWarning` if there is no current event loop set and it " -"decides to create one. In some future Python release this will become an " -"error." +"The :class:`DefaultEventLoopPolicy` class is deprecated and will be removed " +"in Python 3.16." msgstr "" -#: ../../library/asyncio-policy.rst:128 +#: ../../library/asyncio-policy.rst:131 msgid "" "An alternative event loop policy that uses the :class:`SelectorEventLoop` " "event loop implementation." msgstr "" -#: ../../library/asyncio-policy.rst:131 ../../library/asyncio-policy.rst:139 +#: ../../library/asyncio-policy.rst:134 ../../library/asyncio-policy.rst:146 msgid "Availability" msgstr "可用性" #: ../../library/asyncio-policy.rst:136 msgid "" -"An alternative event loop policy that uses the :class:`ProactorEventLoop` " -"event loop implementation." -msgstr "" - -#: ../../library/asyncio-policy.rst:145 -msgid "Process Watchers" -msgstr "" - -#: ../../library/asyncio-policy.rst:147 -msgid "" -"A process watcher allows customization of how an event loop monitors child " -"processes on Unix. Specifically, the event loop needs to know when a child " -"process has exited." -msgstr "" - -#: ../../library/asyncio-policy.rst:151 -msgid "" -"In asyncio, child processes are created with :func:`create_subprocess_exec` " -"and :meth:`loop.subprocess_exec` functions." -msgstr "" - -#: ../../library/asyncio-policy.rst:155 -msgid "" -"asyncio defines the :class:`AbstractChildWatcher` abstract base class, which " -"child watchers should implement, and has four different implementations: :" -"class:`ThreadedChildWatcher` (configured to be used by default), :class:" -"`MultiLoopChildWatcher`, :class:`SafeChildWatcher`, and :class:" -"`FastChildWatcher`." -msgstr "" - -#: ../../library/asyncio-policy.rst:161 -msgid "" -"See also the :ref:`Subprocess and Threads ` " -"section." -msgstr "" - -#: ../../library/asyncio-policy.rst:164 -msgid "" -"The following two functions can be used to customize the child process " -"watcher implementation used by the asyncio event loop:" -msgstr "" - -#: ../../library/asyncio-policy.rst:169 -msgid "Return the current child watcher for the current policy." -msgstr "" - -#: ../../library/asyncio-policy.rst:175 -msgid "" -"Set the current child watcher to *watcher* for the current policy. " -"*watcher* must implement methods defined in the :class:" -"`AbstractChildWatcher` base class." -msgstr "" - -#: ../../library/asyncio-policy.rst:182 -msgid "" -"Third-party event loops implementations might not support custom child " -"watchers. For such event loops, using :func:`set_child_watcher` might be " -"prohibited or have no effect." -msgstr "" - -#: ../../library/asyncio-policy.rst:190 -msgid "Register a new child handler." -msgstr "" - -#: ../../library/asyncio-policy.rst:192 -msgid "" -"Arrange for ``callback(pid, returncode, *args)`` to be called when a process " -"with PID equal to *pid* terminates. Specifying another callback for the " -"same process replaces the previous handler." -msgstr "" - -#: ../../library/asyncio-policy.rst:197 -msgid "The *callback* callable must be thread-safe." -msgstr "" - -#: ../../library/asyncio-policy.rst:201 -msgid "Removes the handler for process with PID equal to *pid*." -msgstr "" - -#: ../../library/asyncio-policy.rst:203 -msgid "" -"The function returns ``True`` if the handler was successfully removed, " -"``False`` if there was nothing to remove." -msgstr "" - -#: ../../library/asyncio-policy.rst:208 -msgid "Attach the watcher to an event loop." -msgstr "" - -#: ../../library/asyncio-policy.rst:210 -msgid "" -"If the watcher was previously attached to an event loop, then it is first " -"detached before attaching to the new loop." -msgstr "" - -#: ../../library/asyncio-policy.rst:213 -msgid "Note: loop may be ``None``." -msgstr "" - -#: ../../library/asyncio-policy.rst:217 -msgid "Return ``True`` if the watcher is ready to use." -msgstr "" - -#: ../../library/asyncio-policy.rst:219 -msgid "" -"Spawning a subprocess with *inactive* current child watcher raises :exc:" -"`RuntimeError`." -msgstr "" - -#: ../../library/asyncio-policy.rst:226 -msgid "Close the watcher." -msgstr "" - -#: ../../library/asyncio-policy.rst:228 -msgid "" -"This method has to be called to ensure that underlying resources are cleaned-" -"up." -msgstr "" - -#: ../../library/asyncio-policy.rst:236 -msgid "" -"This implementation starts a new waiting thread for every subprocess spawn." -msgstr "" - -#: ../../library/asyncio-policy.rst:238 -msgid "" -"It works reliably even when the asyncio event loop is run in a non-main OS " -"thread." -msgstr "" - -#: ../../library/asyncio-policy.rst:240 -msgid "" -"There is no noticeable overhead when handling a big number of children " -"(*O*\\ (1) each time a child terminates), but starting a thread per process " -"requires extra memory." -msgstr "" - -#: ../../library/asyncio-policy.rst:243 -msgid "This watcher is used by default." -msgstr "" - -#: ../../library/asyncio-policy.rst:249 -msgid "" -"This implementation registers a :py:data:`SIGCHLD` signal handler on " -"instantiation. That can break third-party code that installs a custom " -"handler for :py:data:`SIGCHLD` signal." -msgstr "" - -#: ../../library/asyncio-policy.rst:253 ../../library/asyncio-policy.rst:273 -msgid "" -"The watcher avoids disrupting other code spawning processes by polling every " -"process explicitly on a :py:data:`SIGCHLD` signal." -msgstr "" - -#: ../../library/asyncio-policy.rst:256 -msgid "" -"There is no limitation for running subprocesses from different threads once " -"the watcher is installed." -msgstr "" - -#: ../../library/asyncio-policy.rst:259 -msgid "" -"The solution is safe but it has a significant overhead when handling a big " -"number of processes (*O*\\ (*n*) each time a :py:data:`SIGCHLD` is received)." +"The :class:`WindowsSelectorEventLoopPolicy` class is deprecated and will be " +"removed in Python 3.16." msgstr "" -#: ../../library/asyncio-policy.rst:269 +#: ../../library/asyncio-policy.rst:143 msgid "" -"This implementation uses active event loop from the main thread to handle :" -"py:data:`SIGCHLD` signal. If the main thread has no running event loop " -"another thread cannot spawn a subprocess (:exc:`RuntimeError` is raised)." -msgstr "" - -#: ../../library/asyncio-policy.rst:276 -msgid "" -"This solution is as safe as :class:`MultiLoopChildWatcher` and has the same " -"*O*\\ (*n*) complexity but requires a running event loop in the main thread " -"to work." -msgstr "" - -#: ../../library/asyncio-policy.rst:283 -msgid "" -"This implementation reaps every terminated processes by calling ``os." -"waitpid(-1)`` directly, possibly breaking other code spawning processes and " -"waiting for their termination." -msgstr "" - -#: ../../library/asyncio-policy.rst:287 -msgid "" -"There is no noticeable overhead when handling a big number of children " -"(*O*\\ (1) each time a child terminates)." -msgstr "" - -#: ../../library/asyncio-policy.rst:290 -msgid "" -"This solution requires a running event loop in the main thread to work, as :" -"class:`SafeChildWatcher`." +"An alternative event loop policy that uses the :class:`ProactorEventLoop` " +"event loop implementation." msgstr "" -#: ../../library/asyncio-policy.rst:297 +#: ../../library/asyncio-policy.rst:148 msgid "" -"This implementation polls process file descriptors (pidfds) to await child " -"process termination. In some respects, :class:`PidfdChildWatcher` is a " -"\"Goldilocks\" child watcher implementation. It doesn't require signals or " -"threads, doesn't interfere with any processes launched outside the event " -"loop, and scales linearly with the number of subprocesses launched by the " -"event loop. The main disadvantage is that pidfds are specific to Linux, and " -"only work on recent (5.3+) kernels." +"The :class:`WindowsProactorEventLoopPolicy` class is deprecated and will be " +"removed in Python 3.16." msgstr "" -#: ../../library/asyncio-policy.rst:311 +#: ../../library/asyncio-policy.rst:156 msgid "Custom Policies" msgstr "" -#: ../../library/asyncio-policy.rst:313 +#: ../../library/asyncio-policy.rst:158 msgid "" -"To implement a new event loop policy, it is recommended to subclass :class:" -"`DefaultEventLoopPolicy` and override the methods for which custom behavior " -"is wanted, e.g.::" +"To implement a new event loop policy, it is recommended to " +"subclass :class:`DefaultEventLoopPolicy` and override the methods for which " +"custom behavior is wanted, e.g.::" msgstr "" -#: ../../library/asyncio-policy.rst:317 +#: ../../library/asyncio-policy.rst:162 msgid "" "class MyEventLoopPolicy(asyncio.DefaultEventLoopPolicy):\n" "\n" diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index c12c90e6e04..03c675e1b18 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-26 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-02-20 18:34+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -39,8 +39,8 @@ msgstr "" #: ../../library/asyncio-queue.rst:17 msgid "" -"Note that methods of asyncio queues don't have a *timeout* parameter; use :" -"func:`asyncio.wait_for` function to do queue operations with a timeout." +"Note that methods of asyncio queues don't have a *timeout* parameter; " +"use :func:`asyncio.wait_for` function to do queue operations with a timeout." msgstr "" "注意 asyncio 的佇列沒有 *timeout* 參數;請使用 :func:`asyncio.wait_for` 函式" "來為佇列新增具有超時 (timeout) 設定的操作。" @@ -64,8 +64,8 @@ msgid "" "queue reaches *maxsize* until an item is removed by :meth:`get`." msgstr "" "如果 *maxsize* 小於或等於零,則佇列大小是無限制的。如果是大於 ``0`` 的整數," -"則當佇列達到 *maxsize* 時,``await put()`` 將會阻塞 (block),直到某個元素被 :" -"meth:`get` 取出。" +"則當佇列達到 *maxsize* 時,``await put()`` 將會阻塞 (block),直到某個元素" +"被 :meth:`get` 取出。" #: ../../library/asyncio-queue.rst:35 msgid "" @@ -97,8 +97,8 @@ msgstr "如果有 :attr:`maxsize` 個條目在佇列中,則回傳 ``True``。" #: ../../library/asyncio-queue.rst:57 msgid "" -"If the queue was initialized with ``maxsize=0`` (the default), then :meth:" -"`full` never returns ``True``." +"If the queue was initialized with ``maxsize=0`` (the default), " +"then :meth:`full` never returns ``True``." msgstr "" "如果佇列用 ``maxsize=0`` (預設)初始化,則 :meth:`full` 永遠不會回傳 " "``True``。" @@ -127,10 +127,10 @@ msgstr "持續阻塞直到佇列中所有的元素都被接收和處理完畢。 #: ../../library/asyncio-queue.rst:79 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " -"queue. The count goes down whenever a consumer coroutine calls :meth:" -"`task_done` to indicate that the item was retrieved and all work on it is " -"complete. When the count of unfinished tasks drops to zero, :meth:`join` " -"unblocks." +"queue. The count goes down whenever a consumer coroutine " +"calls :meth:`task_done` to indicate that the item was retrieved and all work " +"on it is complete. When the count of unfinished tasks drops to " +"zero, :meth:`join` unblocks." msgstr "" "當條目新增到佇列的時候,未完成任務的計數就會增加。每當一個消耗者 (consumer) " "協程呼叫 :meth:`task_done`,表示這個條目已經被取回且被它包含的所有工作都已完" @@ -162,65 +162,40 @@ msgid "Return the number of items in the queue." msgstr "回傳佇列中的元素數量。" #: ../../library/asyncio-queue.rst:105 -msgid "Put a :class:`Queue` instance into a shutdown mode." -msgstr "" - -#: ../../library/asyncio-queue.rst:107 msgid "" -"The queue can no longer grow. Future calls to :meth:`~Queue.put` raise :exc:" -"`QueueShutDown`. Currently blocked callers of :meth:`~Queue.put` will be " -"unblocked and will raise :exc:`QueueShutDown` in the formerly blocked thread." +"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` " +"raise :exc:`QueueShutDown`." msgstr "" -#: ../../library/asyncio-queue.rst:112 +#: ../../library/asyncio-queue.rst:108 msgid "" -"If *immediate* is false (the default), the queue can be wound down normally " -"with :meth:`~Queue.get` calls to extract tasks that have already been loaded." +"By default, :meth:`~Queue.get` on a shut down queue will only raise once the " +"queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise " +"immediately instead." msgstr "" -#: ../../library/asyncio-queue.rst:116 -msgid "" -"And if :meth:`~Queue.task_done` is called for each remaining task, a " -"pending :meth:`~Queue.join` will be unblocked normally." -msgstr "" - -#: ../../library/asyncio-queue.rst:119 -msgid "" -"Once the queue is empty, future calls to :meth:`~Queue.get` will raise :exc:" -"`QueueShutDown`." -msgstr "" - -#: ../../library/asyncio-queue.rst:122 -msgid "" -"If *immediate* is true, the queue is terminated immediately. The queue is " -"drained to be completely empty and the count of unfinished tasks is reduced " -"by the number of tasks drained. If unfinished tasks is zero, callers of :" -"meth:`~Queue.join` are unblocked. Also, blocked callers of :meth:`~Queue." -"get` are unblocked and will raise :exc:`QueueShutDown` because the queue is " -"empty." -msgstr "" - -#: ../../library/asyncio-queue.rst:130 +#: ../../library/asyncio-queue.rst:112 msgid "" -"Use caution when using :meth:`~Queue.join` with *immediate* set to true. " -"This unblocks the join even when no work has been done on the tasks, " -"violating the usual invariant for joining a queue." +"All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " +"unblocked. If *immediate* is true, a task will be marked as done for each " +"remaining item in the queue, which may unblock callers " +"of :meth:`~Queue.join`." msgstr "" -#: ../../library/asyncio-queue.rst:138 +#: ../../library/asyncio-queue.rst:121 msgid "Indicate that a formerly enqueued work item is complete." msgstr "表示前面一個排隊的工作項目已經完成。" -#: ../../library/asyncio-queue.rst:140 +#: ../../library/asyncio-queue.rst:123 msgid "" "Used by queue consumers. For each :meth:`~Queue.get` used to fetch a work " "item, a subsequent call to :meth:`task_done` tells the queue that the " "processing on the work item is complete." msgstr "" -"由佇列消耗者使用。對於每個用於取得一個工作項目的 :meth:`~Queue.get`,接續的 :" -"meth:`task_done` 呼叫會告訴佇列這個工作項目的處理已經完成。" +"由佇列消耗者使用。對於每個用於取得一個工作項目的 :meth:`~Queue.get`,接續" +"的 :meth:`task_done` 呼叫會告訴佇列這個工作項目的處理已經完成。" -#: ../../library/asyncio-queue.rst:144 +#: ../../library/asyncio-queue.rst:127 msgid "" "If a :meth:`join` is currently blocking, it will resume when all items have " "been processed (meaning that a :meth:`task_done` call was received for every " @@ -229,47 +204,53 @@ msgstr "" "如果 :meth:`join` 目前正在阻塞,在所有項目都被處理後會解除阻塞(意味著每個" "以 :meth:`~Queue.put` 放進佇列的條目都會收到一個 :meth:`task_done`)。" -#: ../../library/asyncio-queue.rst:149 +#: ../../library/asyncio-queue.rst:132 +msgid "" +"``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining item " +"in the queue." +msgstr "" + +#: ../../library/asyncio-queue.rst:135 msgid "" "Raises :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "如果被呼叫的次數多於放入佇列中的項目數量,將引發 :exc:`ValueError`。" -#: ../../library/asyncio-queue.rst:154 +#: ../../library/asyncio-queue.rst:140 msgid "Priority Queue" msgstr "Priority Queue(優先佇列)" -#: ../../library/asyncio-queue.rst:158 +#: ../../library/asyncio-queue.rst:144 msgid "" "A variant of :class:`Queue`; retrieves entries in priority order (lowest " "first)." msgstr ":class:`Queue` 的變形;按優先順序取出條目 (最小的先取出)。" -#: ../../library/asyncio-queue.rst:161 +#: ../../library/asyncio-queue.rst:147 msgid "Entries are typically tuples of the form ``(priority_number, data)``." msgstr "條目通常是 ``(priority_number, data)`` 形式的 tuple(元組)。" -#: ../../library/asyncio-queue.rst:166 +#: ../../library/asyncio-queue.rst:152 msgid "LIFO Queue" msgstr "LIFO Queue" -#: ../../library/asyncio-queue.rst:170 +#: ../../library/asyncio-queue.rst:156 msgid "" "A variant of :class:`Queue` that retrieves most recently added entries first " "(last in, first out)." msgstr ":class:`Queue` 的變形,先取出最近新增的條目(後進先出)。" -#: ../../library/asyncio-queue.rst:175 +#: ../../library/asyncio-queue.rst:161 msgid "Exceptions" msgstr "例外" -#: ../../library/asyncio-queue.rst:179 +#: ../../library/asyncio-queue.rst:165 msgid "" "This exception is raised when the :meth:`~Queue.get_nowait` method is called " "on an empty queue." msgstr "當佇列為空的時候,呼叫 :meth:`~Queue.get_nowait` 方法會引發這個例外。" -#: ../../library/asyncio-queue.rst:185 +#: ../../library/asyncio-queue.rst:171 msgid "" "Exception raised when the :meth:`~Queue.put_nowait` method is called on a " "queue that has reached its *maxsize*." @@ -277,22 +258,22 @@ msgstr "" "當佇列中條目數量已經達到它的 *maxsize* 時,呼叫 :meth:`~Queue.put_nowait` 方" "法會引發這個例外。" -#: ../../library/asyncio-queue.rst:191 +#: ../../library/asyncio-queue.rst:177 msgid "" "Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " "a queue which has been shut down." msgstr "" -#: ../../library/asyncio-queue.rst:198 +#: ../../library/asyncio-queue.rst:184 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-queue.rst:202 +#: ../../library/asyncio-queue.rst:188 msgid "" "Queues can be used to distribute workload between several concurrent tasks::" msgstr "佇列能被用於多個並行任務的工作分配:" -#: ../../library/asyncio-queue.rst:205 +#: ../../library/asyncio-queue.rst:191 msgid "" "import asyncio\n" "import random\n" diff --git a/library/asyncio-runner.po b/library/asyncio-runner.po index edf75f6778e..31d811354f0 100644 --- a/library/asyncio-runner.po +++ b/library/asyncio-runner.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,24 +43,30 @@ msgid "Running an asyncio Program" msgstr "運行一個 asyncio 程式" #: ../../library/asyncio-runner.rst:27 -msgid "Execute the :term:`coroutine` *coro* and return the result." +#, fuzzy +msgid "Execute *coro* in an asyncio event loop and return the result." msgstr "執行\\ :term:`協程 (coroutine) ` *coro* 並回傳結果。" -#: ../../library/asyncio-runner.rst:29 +#: ../../library/asyncio-runner.rst:29 ../../library/asyncio-runner.rst:121 +msgid "The argument can be any awaitable object." +msgstr "" + +#: ../../library/asyncio-runner.rst:31 +#, fuzzy msgid "" -"This function runs the passed coroutine, taking care of managing the asyncio " -"event loop, *finalizing asynchronous generators*, and closing the executor." +"This function runs the awaitable, taking care of managing the asyncio event " +"loop, *finalizing asynchronous generators*, and closing the executor." msgstr "" "這個函式負責運行被傳入的協程、管理 asyncio 的事件迴圈、*終結非同步產生器*,以" "及關閉執行器。" -#: ../../library/asyncio-runner.rst:33 ../../library/asyncio-runner.rst:115 +#: ../../library/asyncio-runner.rst:35 ../../library/asyncio-runner.rst:131 msgid "" "This function cannot be called when another asyncio event loop is running in " "the same thread." msgstr "當另一個非同步事件迴圈在同一執行緒中執行時,無法呼叫此函式。" -#: ../../library/asyncio-runner.rst:36 ../../library/asyncio-runner.rst:85 +#: ../../library/asyncio-runner.rst:38 ../../library/asyncio-runner.rst:97 msgid "" "If *debug* is ``True``, the event loop will be run in debug mode. ``False`` " "disables debug mode explicitly. ``None`` is used to respect the " @@ -70,7 +76,7 @@ msgstr "" "式。``None`` 則會優先使用\\ :ref:`除錯模式 `\\ 的全域設" "定。" -#: ../../library/asyncio-runner.rst:40 +#: ../../library/asyncio-runner.rst:42 msgid "" "If *loop_factory* is not ``None``, it is used to create a new event loop; " "otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at the " @@ -86,18 +92,18 @@ msgstr "" "設定事件迴圈時而不是使用 policies(政策)。傳遞 :class:`asyncio.EventLoop` 可" "以讓 asyncio 在沒有政策系統的情況下運行。" -#: ../../library/asyncio-runner.rst:48 +#: ../../library/asyncio-runner.rst:50 msgid "" "The executor is given a timeout duration of 5 minutes to shutdown. If the " "executor hasn't finished within that duration, a warning is emitted and the " "executor is closed." msgstr "" -#: ../../library/asyncio-runner.rst:52 +#: ../../library/asyncio-runner.rst:54 msgid "Example::" msgstr "範例: ::" -#: ../../library/asyncio-runner.rst:54 +#: ../../library/asyncio-runner.rst:56 msgid "" "async def main():\n" " await asyncio.sleep(1)\n" @@ -111,36 +117,47 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../library/asyncio-runner.rst:62 +#: ../../library/asyncio-runner.rst:64 msgid "Updated to use :meth:`loop.shutdown_default_executor`." msgstr "" -#: ../../library/asyncio-runner.rst:67 +#: ../../library/asyncio-runner.rst:69 msgid "" "*debug* is ``None`` by default to respect the global debug mode settings." msgstr "" -#: ../../library/asyncio-runner.rst:71 +#: ../../library/asyncio-runner.rst:73 msgid "Added *loop_factory* parameter." msgstr "新增 *loop_factory* 參數。" -#: ../../library/asyncio-runner.rst:75 +#: ../../library/asyncio-runner.rst:77 ../../library/asyncio-runner.rst:136 +msgid "*coro* can be any awaitable object." +msgstr "" + +#: ../../library/asyncio-runner.rst:81 +msgid "" +"The :mod:`!asyncio` policy system is deprecated and will be removed in " +"Python 3.16; from there on, an explicit *loop_factory* is needed to " +"configure the event loop." +msgstr "" + +#: ../../library/asyncio-runner.rst:87 msgid "Runner context manager" msgstr "" -#: ../../library/asyncio-runner.rst:79 +#: ../../library/asyncio-runner.rst:91 msgid "" "A context manager that simplifies *multiple* async function calls in the " "same context." msgstr "" -#: ../../library/asyncio-runner.rst:82 +#: ../../library/asyncio-runner.rst:94 msgid "" "Sometimes several top-level async functions should be called in the " "same :ref:`event loop ` and :class:`contextvars.Context`." msgstr "" -#: ../../library/asyncio-runner.rst:89 +#: ../../library/asyncio-runner.rst:101 msgid "" "*loop_factory* could be used for overriding the loop creation. It is the " "responsibility of the *loop_factory* to set the created loop as the current " @@ -148,13 +165,13 @@ msgid "" "event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``." msgstr "" -#: ../../library/asyncio-runner.rst:94 +#: ../../library/asyncio-runner.rst:106 msgid "" "Basically, :func:`asyncio.run` example can be rewritten with the runner " "usage::" msgstr "" -#: ../../library/asyncio-runner.rst:96 +#: ../../library/asyncio-runner.rst:108 msgid "" "async def main():\n" " await asyncio.sleep(1)\n" @@ -170,52 +187,56 @@ msgstr "" "with asyncio.Runner() as runner:\n" " runner.run(main())" -#: ../../library/asyncio-runner.rst:107 -msgid "Run a :term:`coroutine ` *coro* in the embedded loop." +#: ../../library/asyncio-runner.rst:119 +msgid "Execute *coro* in the embedded event loop." msgstr "" -#: ../../library/asyncio-runner.rst:109 -msgid "Return the coroutine's result or raise its exception." +#: ../../library/asyncio-runner.rst:123 +msgid "If the argument is a coroutine, it is wrapped in a Task." msgstr "" -#: ../../library/asyncio-runner.rst:111 +#: ../../library/asyncio-runner.rst:125 msgid "" "An optional keyword-only *context* argument allows specifying a " -"custom :class:`contextvars.Context` for the *coro* to run in. The runner's " -"default context is used if ``None``." +"custom :class:`contextvars.Context` for the code to run in. The runner's " +"default context is used if context is ``None``." msgstr "" -#: ../../library/asyncio-runner.rst:120 +#: ../../library/asyncio-runner.rst:129 +msgid "Returns the awaitable's result or raises an exception." +msgstr "" + +#: ../../library/asyncio-runner.rst:140 msgid "Close the runner." msgstr "" -#: ../../library/asyncio-runner.rst:122 +#: ../../library/asyncio-runner.rst:142 msgid "" "Finalize asynchronous generators, shutdown default executor, close the event " "loop and release embedded :class:`contextvars.Context`." msgstr "" -#: ../../library/asyncio-runner.rst:127 +#: ../../library/asyncio-runner.rst:147 msgid "Return the event loop associated with the runner instance." msgstr "" -#: ../../library/asyncio-runner.rst:131 +#: ../../library/asyncio-runner.rst:151 msgid "" ":class:`Runner` uses the lazy initialization strategy, its constructor " "doesn't initialize underlying low-level structures." msgstr "" -#: ../../library/asyncio-runner.rst:134 +#: ../../library/asyncio-runner.rst:154 msgid "" "Embedded *loop* and *context* are created at the :keyword:`with` body " "entering or the first call of :meth:`run` or :meth:`get_loop`." msgstr "" -#: ../../library/asyncio-runner.rst:139 +#: ../../library/asyncio-runner.rst:159 msgid "Handling Keyboard Interruption" msgstr "" -#: ../../library/asyncio-runner.rst:143 +#: ../../library/asyncio-runner.rst:163 msgid "" "When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-" "C`, :exc:`KeyboardInterrupt` exception is raised in the main thread by " @@ -223,26 +244,26 @@ msgid "" "interrupt asyncio internals and can hang the program from exiting." msgstr "" -#: ../../library/asyncio-runner.rst:148 +#: ../../library/asyncio-runner.rst:168 msgid "" "To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as " "follows:" msgstr "" -#: ../../library/asyncio-runner.rst:150 +#: ../../library/asyncio-runner.rst:170 msgid "" ":meth:`asyncio.Runner.run` installs a custom :const:`signal.SIGINT` handler " "before any user code is executed and removes it when exiting from the " "function." msgstr "" -#: ../../library/asyncio-runner.rst:152 +#: ../../library/asyncio-runner.rst:172 msgid "" "The :class:`~asyncio.Runner` creates the main task for the passed coroutine " "for its execution." msgstr "" -#: ../../library/asyncio-runner.rst:154 +#: ../../library/asyncio-runner.rst:174 msgid "" "When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, the custom signal " "handler cancels the main task by calling :meth:`asyncio.Task.cancel` which " @@ -252,7 +273,7 @@ msgid "" "cancelled, :meth:`asyncio.Runner.run` raises :exc:`KeyboardInterrupt`." msgstr "" -#: ../../library/asyncio-runner.rst:160 +#: ../../library/asyncio-runner.rst:180 msgid "" "A user could write a tight loop which cannot be interrupted " "by :meth:`asyncio.Task.cancel`, in which case the second " diff --git a/library/asyncio-subprocess.po b/library/asyncio-subprocess.po index 8669d045c3d..621d063238d 100644 --- a/library/asyncio-subprocess.po +++ b/library/asyncio-subprocess.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-12 00:14+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -135,9 +135,9 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:89 msgid "" "The *limit* argument sets the buffer limit for :class:`StreamReader` " -"wrappers for :attr:`~asyncio.subprocess.Process.stdout` and :attr:`~asyncio." -"subprocess.Process.stderr` (if :const:`subprocess.PIPE` is passed to " -"*stdout* and *stderr* arguments)." +"wrappers for :attr:`~asyncio.subprocess.Process.stdout` " +"and :attr:`~asyncio.subprocess.Process.stderr` (if :const:`subprocess.PIPE` " +"is passed to *stdout* and *stderr* arguments)." msgstr "" #: ../../library/asyncio-subprocess.rst:74 @@ -183,11 +183,10 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:118 msgid "" -"asyncio also has the following *low-level* APIs to work with subprocesses: :" -"meth:`loop.subprocess_exec`, :meth:`loop.subprocess_shell`, :meth:`loop." -"connect_read_pipe`, :meth:`loop.connect_write_pipe`, as well as the :ref:" -"`Subprocess Transports ` and :ref:`Subprocess " -"Protocols `." +"asyncio also has the following *low-level* APIs to work with " +"subprocesses: :meth:`loop.subprocess_exec`, :meth:`loop.subprocess_shell`, :meth:`loop.connect_read_pipe`, :meth:`loop.connect_write_pipe`, " +"as well as the :ref:`Subprocess Transports ` " +"and :ref:`Subprocess Protocols `." msgstr "" #: ../../library/asyncio-subprocess.rst:126 @@ -200,17 +199,17 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:133 msgid "" -"If *PIPE* is passed to *stdin* argument, the :attr:`Process.stdin ` attribute will point to a :class:`~asyncio." -"StreamWriter` instance." +"If *PIPE* is passed to *stdin* argument, the :attr:`Process.stdin " +"` attribute will point to " +"a :class:`~asyncio.StreamWriter` instance." msgstr "" #: ../../library/asyncio-subprocess.rst:137 msgid "" -"If *PIPE* is passed to *stdout* or *stderr* arguments, the :attr:`Process." -"stdout ` and :attr:`Process.stderr " -"` attributes will point to :class:" -"`~asyncio.StreamReader` instances." +"If *PIPE* is passed to *stdout* or *stderr* arguments, " +"the :attr:`Process.stdout ` " +"and :attr:`Process.stderr ` attributes " +"will point to :class:`~asyncio.StreamReader` instances." msgstr "" #: ../../library/asyncio-subprocess.rst:145 @@ -222,8 +221,8 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:151 msgid "" "Special value that can be used as the *stdin*, *stdout* or *stderr* argument " -"to process creation functions. It indicates that the special file :data:`os." -"devnull` will be used for the corresponding subprocess stream." +"to process creation functions. It indicates that the special " +"file :data:`os.devnull` will be used for the corresponding subprocess stream." msgstr "" #: ../../library/asyncio-subprocess.rst:157 @@ -240,28 +239,28 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:167 msgid "" -"An object that wraps OS processes created by the :func:`~asyncio." -"create_subprocess_exec` and :func:`~asyncio.create_subprocess_shell` " -"functions." +"An object that wraps OS processes created by " +"the :func:`~asyncio.create_subprocess_exec` " +"and :func:`~asyncio.create_subprocess_shell` functions." msgstr "" #: ../../library/asyncio-subprocess.rst:171 msgid "" -"This class is designed to have a similar API to the :class:`subprocess." -"Popen` class, but there are some notable differences:" +"This class is designed to have a similar API to " +"the :class:`subprocess.Popen` class, but there are some notable differences:" msgstr "" #: ../../library/asyncio-subprocess.rst:175 msgid "" -"unlike Popen, Process instances do not have an equivalent to the :meth:" -"`~subprocess.Popen.poll` method;" +"unlike Popen, Process instances do not have an equivalent to " +"the :meth:`~subprocess.Popen.poll` method;" msgstr "" #: ../../library/asyncio-subprocess.rst:178 msgid "" -"the :meth:`~asyncio.subprocess.Process.communicate` and :meth:`~asyncio." -"subprocess.Process.wait` methods don't have a *timeout* parameter: use the :" -"func:`~asyncio.wait_for` function;" +"the :meth:`~asyncio.subprocess.Process.communicate` " +"and :meth:`~asyncio.subprocess.Process.wait` methods don't have a *timeout* " +"parameter: use the :func:`~asyncio.wait_for` function;" msgstr "" #: ../../library/asyncio-subprocess.rst:182 @@ -430,9 +429,9 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:299 msgid "" -"Note that for processes created by the :func:`~asyncio." -"create_subprocess_shell` function, this attribute is the PID of the spawned " -"shell." +"Note that for processes created by " +"the :func:`~asyncio.create_subprocess_shell` function, this attribute is the " +"PID of the spawned shell." msgstr "" #: ../../library/asyncio-subprocess.rst:304 @@ -467,51 +466,33 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:323 msgid "" -"On UNIX *child watchers* are used for subprocess finish waiting, see :ref:" -"`asyncio-watchers` for more info." -msgstr "" - -#: ../../library/asyncio-subprocess.rst:329 -msgid "" -"UNIX switched to use :class:`ThreadedChildWatcher` for spawning subprocesses " -"from different threads without any limitation." -msgstr "" - -#: ../../library/asyncio-subprocess.rst:332 -msgid "" -"Spawning a subprocess with *inactive* current child watcher raises :exc:" -"`RuntimeError`." -msgstr "" - -#: ../../library/asyncio-subprocess.rst:335 -msgid "" "Note that alternative event loop implementations might have own limitations; " "please refer to their documentation." msgstr "" -#: ../../library/asyncio-subprocess.rst:340 +#: ../../library/asyncio-subprocess.rst:328 msgid "" "The :ref:`Concurrency and multithreading in asyncio ` section." msgstr "" -#: ../../library/asyncio-subprocess.rst:345 +#: ../../library/asyncio-subprocess.rst:333 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-subprocess.rst:347 +#: ../../library/asyncio-subprocess.rst:335 msgid "" "An example using the :class:`~asyncio.subprocess.Process` class to control a " "subprocess and the :class:`StreamReader` class to read from its standard " "output." msgstr "" -#: ../../library/asyncio-subprocess.rst:353 +#: ../../library/asyncio-subprocess.rst:341 msgid "" "The subprocess is created by the :func:`create_subprocess_exec` function::" msgstr "" -#: ../../library/asyncio-subprocess.rst:356 +#: ../../library/asyncio-subprocess.rst:344 msgid "" "import asyncio\n" "import sys\n" @@ -537,7 +518,7 @@ msgid "" "print(f\"Current date: {date}\")" msgstr "" -#: ../../library/asyncio-subprocess.rst:380 +#: ../../library/asyncio-subprocess.rst:368 msgid "" "See also the :ref:`same example ` written " "using low-level APIs." diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 07925812b0f..69da550c629 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-10 00:19+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -199,8 +199,8 @@ msgstr "" #: ../../library/asyncio-task.rst:110 msgid "" -"The :class:`asyncio.TaskGroup` class provides a more modern alternative to :" -"func:`create_task`. Using this API, the last example becomes::" +"The :class:`asyncio.TaskGroup` class provides a more modern alternative " +"to :func:`create_task`. Using this API, the last example becomes::" msgstr "" #: ../../library/asyncio-task.rst:114 @@ -234,8 +234,8 @@ msgstr "" #: ../../library/asyncio-task.rst:139 msgid "" -"We say that an object is an **awaitable** object if it can be used in an :" -"keyword:`await` expression. Many asyncio APIs are designed to accept " +"We say that an object is an **awaitable** object if it can be used in " +"an :keyword:`await` expression. Many asyncio APIs are designed to accept " "awaitables." msgstr "" @@ -295,8 +295,9 @@ msgstr "" #: ../../library/asyncio-task.rst:183 msgid "" -"When a coroutine is wrapped into a *Task* with functions like :func:`asyncio." -"create_task` the coroutine is automatically scheduled to run soon::" +"When a coroutine is wrapped into a *Task* with functions " +"like :func:`asyncio.create_task` the coroutine is automatically scheduled to " +"run soon::" msgstr "" #: ../../library/asyncio-task.rst:187 @@ -366,8 +367,8 @@ msgstr "" #: ../../library/asyncio-task.rst:230 msgid "" -"A good example of a low-level function that returns a Future object is :meth:" -"`loop.run_in_executor`." +"A good example of a low-level function that returns a Future object " +"is :meth:`loop.run_in_executor`." msgstr "" #: ../../library/asyncio-task.rst:235 @@ -386,31 +387,41 @@ msgstr "" #: ../../library/asyncio-task.rst:246 msgid "" -"If *name* is not ``None``, it is set as the name of the task using :meth:" -"`Task.set_name`." +"The full function signature is largely the same as that of the :class:`Task` " +"constructor (or factory) - all of the keyword arguments to this function are " +"passed through to that interface." msgstr "" -#: ../../library/asyncio-task.rst:249 +#: ../../library/asyncio-task.rst:250 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *coro* to run in. The current context " -"copy is created when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. The current " +"context copy is created when no *context* is provided." msgstr "" -#: ../../library/asyncio-task.rst:253 +#: ../../library/asyncio-task.rst:254 msgid "" -"The task is executed in the loop returned by :func:`get_running_loop`, :exc:" -"`RuntimeError` is raised if there is no running loop in current thread." +"An optional keyword-only *eager_start* argument allows specifying if the " +"task should execute eagerly during the call to create_task, or be scheduled " +"later. If *eager_start* is not passed the mode set " +"by :meth:`loop.set_task_factory` will be used." msgstr "" #: ../../library/asyncio-task.rst:259 msgid "" +"The task is executed in the loop returned " +"by :func:`get_running_loop`, :exc:`RuntimeError` is raised if there is no " +"running loop in current thread." +msgstr "" + +#: ../../library/asyncio-task.rst:265 +msgid "" ":meth:`asyncio.TaskGroup.create_task` is a new alternative leveraging " "structural concurrency; it allows for waiting for a group of related tasks " "with strong safety guarantees." msgstr "" -#: ../../library/asyncio-task.rst:265 +#: ../../library/asyncio-task.rst:271 msgid "" "Save a reference to the result of this function, to avoid a task " "disappearing mid-execution. The event loop only keeps weak references to " @@ -419,7 +430,7 @@ msgid "" "tasks, gather them in a collection::" msgstr "" -#: ../../library/asyncio-task.rst:272 +#: ../../library/asyncio-task.rst:278 msgid "" "background_tasks = set()\n" "\n" @@ -435,90 +446,101 @@ msgid "" " task.add_done_callback(background_tasks.discard)" msgstr "" -#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1193 +#: ../../library/asyncio-task.rst:293 ../../library/asyncio-task.rst:1251 msgid "Added the *name* parameter." msgstr "新增 *name* 參數。" -#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1200 +#: ../../library/asyncio-task.rst:296 ../../library/asyncio-task.rst:1258 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" -#: ../../library/asyncio-task.rst:295 +#: ../../library/asyncio-task.rst:299 +#, fuzzy +msgid "Added the *eager_start* parameter by passing on all *kwargs*." +msgstr "新增 *eager_start* 參數。" + +#: ../../library/asyncio-task.rst:304 msgid "Task Cancellation" msgstr "" -#: ../../library/asyncio-task.rst:297 +#: ../../library/asyncio-task.rst:306 msgid "" -"Tasks can easily and safely be cancelled. When a task is cancelled, :exc:" -"`asyncio.CancelledError` will be raised in the task at the next opportunity." +"Tasks can easily and safely be cancelled. When a task is " +"cancelled, :exc:`asyncio.CancelledError` will be raised in the task at the " +"next opportunity." msgstr "" -#: ../../library/asyncio-task.rst:301 +#: ../../library/asyncio-task.rst:310 msgid "" "It is recommended that coroutines use ``try/finally`` blocks to robustly " "perform clean-up logic. In case :exc:`asyncio.CancelledError` is explicitly " -"caught, it should generally be propagated when clean-up is complete. :exc:" -"`asyncio.CancelledError` directly subclasses :exc:`BaseException` so most " -"code will not need to be aware of it." +"caught, it should generally be propagated when clean-up is " +"complete. :exc:`asyncio.CancelledError` directly " +"subclasses :exc:`BaseException` so most code will not need to be aware of it." msgstr "" -#: ../../library/asyncio-task.rst:307 +#: ../../library/asyncio-task.rst:316 msgid "" -"The asyncio components that enable structured concurrency, like :class:" -"`asyncio.TaskGroup` and :func:`asyncio.timeout`, are implemented using " -"cancellation internally and might misbehave if a coroutine swallows :exc:" -"`asyncio.CancelledError`. Similarly, user code should not generally call :" -"meth:`uncancel `. However, in cases when suppressing :" -"exc:`asyncio.CancelledError` is truly desired, it is necessary to also call " -"``uncancel()`` to completely remove the cancellation state." +"The asyncio components that enable structured concurrency, " +"like :class:`asyncio.TaskGroup` and :func:`asyncio.timeout`, are implemented " +"using cancellation internally and might misbehave if a coroutine " +"swallows :exc:`asyncio.CancelledError`. Similarly, user code should not " +"generally call :meth:`uncancel `. However, in cases " +"when suppressing :exc:`asyncio.CancelledError` is truly desired, it is " +"necessary to also call ``uncancel()`` to completely remove the cancellation " +"state." msgstr "" -#: ../../library/asyncio-task.rst:319 +#: ../../library/asyncio-task.rst:328 msgid "Task Groups" msgstr "" -#: ../../library/asyncio-task.rst:321 +#: ../../library/asyncio-task.rst:330 msgid "" "Task groups combine a task creation API with a convenient and reliable way " "to wait for all tasks in the group to finish." msgstr "" -#: ../../library/asyncio-task.rst:326 +#: ../../library/asyncio-task.rst:335 msgid "" "An :ref:`asynchronous context manager ` holding a " "group of tasks. Tasks can be added to the group using :meth:`create_task`. " "All tasks are awaited when the context manager exits." msgstr "" -#: ../../library/asyncio-task.rst:335 +#: ../../library/asyncio-task.rst:344 msgid "" -"Create a task in this task group. The signature matches that of :func:" -"`asyncio.create_task`. If the task group is inactive (e.g. not yet entered, " -"already finished, or in the process of shutting down), we will close the " -"given ``coro``." +"Create a task in this task group. The signature matches that " +"of :func:`asyncio.create_task`. If the task group is inactive (e.g. not yet " +"entered, already finished, or in the process of shutting down), we will " +"close the given ``coro``." msgstr "" -#: ../../library/asyncio-task.rst:343 +#: ../../library/asyncio-task.rst:352 msgid "Close the given coroutine if the task group is not active." msgstr "" -#: ../../library/asyncio-task.rst:345 ../../library/asyncio-task.rst:551 -#: ../../library/asyncio-task.rst:724 ../../library/asyncio-task.rst:782 -#: ../../library/asyncio-task.rst:808 ../../library/asyncio-task.rst:849 +#: ../../library/asyncio-task.rst:356 +msgid "Passes on all *kwargs* to :meth:`loop.create_task`" +msgstr "" + +#: ../../library/asyncio-task.rst:358 ../../library/asyncio-task.rst:564 +#: ../../library/asyncio-task.rst:737 ../../library/asyncio-task.rst:795 +#: ../../library/asyncio-task.rst:821 ../../library/asyncio-task.rst:862 msgid "Example::" msgstr "範例: ::" -#: ../../library/asyncio-task.rst:347 +#: ../../library/asyncio-task.rst:360 msgid "" "async def main():\n" " async with asyncio.TaskGroup() as tg:\n" " task1 = tg.create_task(some_coro(...))\n" " task2 = tg.create_task(another_coro(...))\n" -" print(f\"Both tasks have completed now: {task1.result()}, {task2." -"result()}\")" +" print(f\"Both tasks have completed now: {task1.result()}, " +"{task2.result()}\")" msgstr "" -#: ../../library/asyncio-task.rst:353 +#: ../../library/asyncio-task.rst:366 msgid "" "The ``async with`` statement will wait for all tasks in the group to finish. " "While waiting, new tasks may still be added to the group (for example, by " @@ -527,19 +549,19 @@ msgid "" "block is exited, no new tasks may be added to the group." msgstr "" -#: ../../library/asyncio-task.rst:360 +#: ../../library/asyncio-task.rst:373 msgid "" "The first time any of the tasks belonging to the group fails with an " "exception other than :exc:`asyncio.CancelledError`, the remaining tasks in " "the group are cancelled. No further tasks can then be added to the group. At " -"this point, if the body of the ``async with`` statement is still active (i." -"e., :meth:`~object.__aexit__` hasn't been called yet), the task directly " -"containing the ``async with`` statement is also cancelled. The resulting :" -"exc:`asyncio.CancelledError` will interrupt an ``await``, but it will not " -"bubble out of the containing ``async with`` statement." +"this point, if the body of the ``async with`` statement is still active " +"(i.e., :meth:`~object.__aexit__` hasn't been called yet), the task directly " +"containing the ``async with`` statement is also cancelled. The " +"resulting :exc:`asyncio.CancelledError` will interrupt an ``await``, but it " +"will not bubble out of the containing ``async with`` statement." msgstr "" -#: ../../library/asyncio-task.rst:370 +#: ../../library/asyncio-task.rst:383 msgid "" "Once all tasks have finished, if any tasks have failed with an exception " "other than :exc:`asyncio.CancelledError`, those exceptions are combined in " @@ -547,28 +569,29 @@ msgid "" "their documentation) which is then raised." msgstr "" -#: ../../library/asyncio-task.rst:377 +#: ../../library/asyncio-task.rst:390 msgid "" -"Two base exceptions are treated specially: If any task fails with :exc:" -"`KeyboardInterrupt` or :exc:`SystemExit`, the task group still cancels the " -"remaining tasks and waits for them, but then the initial :exc:" -"`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead of :exc:" -"`ExceptionGroup` or :exc:`BaseExceptionGroup`." +"Two base exceptions are treated specially: If any task fails " +"with :exc:`KeyboardInterrupt` or :exc:`SystemExit`, the task group still " +"cancels the remaining tasks and waits for them, but then the " +"initial :exc:`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead " +"of :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup`." msgstr "" -#: ../../library/asyncio-task.rst:383 +#: ../../library/asyncio-task.rst:396 msgid "" -"If the body of the ``async with`` statement exits with an exception (so :" -"meth:`~object.__aexit__` is called with an exception set), this is treated " -"the same as if one of the tasks failed: the remaining tasks are cancelled " -"and then waited for, and non-cancellation exceptions are grouped into an " -"exception group and raised. The exception passed into :meth:`~object." -"__aexit__`, unless it is :exc:`asyncio.CancelledError`, is also included in " -"the exception group. The same special case is made for :exc:" -"`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph." +"If the body of the ``async with`` statement exits with an exception " +"(so :meth:`~object.__aexit__` is called with an exception set), this is " +"treated the same as if one of the tasks failed: the remaining tasks are " +"cancelled and then waited for, and non-cancellation exceptions are grouped " +"into an exception group and raised. The exception passed " +"into :meth:`~object.__aexit__`, unless it is :exc:`asyncio.CancelledError`, " +"is also included in the exception group. The same special case is made " +"for :exc:`KeyboardInterrupt` and :exc:`SystemExit` as in the previous " +"paragraph." msgstr "" -#: ../../library/asyncio-task.rst:395 +#: ../../library/asyncio-task.rst:408 msgid "" "Task groups are careful not to mix up the internal cancellation used to " "\"wake up\" their :meth:`~object.__aexit__` with cancellation requests for " @@ -579,38 +602,39 @@ msgid "" "receive another cancellation and process its own exceptions." msgstr "" -#: ../../library/asyncio-task.rst:403 +#: ../../library/asyncio-task.rst:416 msgid "" "In the case where a task group is cancelled externally and also must raise " -"an :exc:`ExceptionGroup`, it will call the parent task's :meth:`~asyncio." -"Task.cancel` method. This ensures that a :exc:`asyncio.CancelledError` will " -"be raised at the next :keyword:`await`, so the cancellation is not lost." +"an :exc:`ExceptionGroup`, it will call the parent " +"task's :meth:`~asyncio.Task.cancel` method. This ensures that " +"a :exc:`asyncio.CancelledError` will be raised at the next :keyword:`await`, " +"so the cancellation is not lost." msgstr "" -#: ../../library/asyncio-task.rst:409 +#: ../../library/asyncio-task.rst:422 msgid "" -"Task groups preserve the cancellation count reported by :meth:`asyncio.Task." -"cancelling`." +"Task groups preserve the cancellation count reported " +"by :meth:`asyncio.Task.cancelling`." msgstr "" -#: ../../library/asyncio-task.rst:414 +#: ../../library/asyncio-task.rst:427 msgid "" "Improved handling of simultaneous internal and external cancellations and " "correct preservation of cancellation counts." msgstr "" -#: ../../library/asyncio-task.rst:418 +#: ../../library/asyncio-task.rst:431 msgid "Terminating a Task Group" msgstr "" -#: ../../library/asyncio-task.rst:420 +#: ../../library/asyncio-task.rst:433 msgid "" "While terminating a task group is not natively supported by the standard " "library, termination can be achieved by adding an exception-raising task to " "the task group and ignoring the raised exception:" msgstr "" -#: ../../library/asyncio-task.rst:424 +#: ../../library/asyncio-task.rst:437 msgid "" "import asyncio\n" "from asyncio import TaskGroup\n" @@ -643,49 +667,49 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-task.rst:456 +#: ../../library/asyncio-task.rst:469 msgid "Expected output:" msgstr "預期的輸出: ::" -#: ../../library/asyncio-task.rst:458 +#: ../../library/asyncio-task.rst:471 msgid "" "Task 1: start\n" "Task 2: start\n" "Task 1: done" msgstr "" -#: ../../library/asyncio-task.rst:465 +#: ../../library/asyncio-task.rst:478 msgid "Sleeping" msgstr "" -#: ../../library/asyncio-task.rst:470 +#: ../../library/asyncio-task.rst:483 msgid "Block for *delay* seconds." msgstr "" -#: ../../library/asyncio-task.rst:472 +#: ../../library/asyncio-task.rst:485 msgid "" "If *result* is provided, it is returned to the caller when the coroutine " "completes." msgstr "" -#: ../../library/asyncio-task.rst:475 +#: ../../library/asyncio-task.rst:488 msgid "" "``sleep()`` always suspends the current task, allowing other tasks to run." msgstr "" -#: ../../library/asyncio-task.rst:478 +#: ../../library/asyncio-task.rst:491 msgid "" "Setting the delay to 0 provides an optimized path to allow other tasks to " "run. This can be used by long-running functions to avoid blocking the event " "loop for the full duration of the function call." msgstr "" -#: ../../library/asyncio-task.rst:484 +#: ../../library/asyncio-task.rst:497 msgid "" "Example of coroutine displaying the current date every second for 5 seconds::" msgstr "" -#: ../../library/asyncio-task.rst:487 +#: ../../library/asyncio-task.rst:500 msgid "" "import asyncio\n" "import datetime\n" @@ -715,40 +739,40 @@ msgstr "" "\n" "asyncio.run(display_date())" -#: ../../library/asyncio-task.rst:502 ../../library/asyncio-task.rst:600 -#: ../../library/asyncio-task.rst:699 ../../library/asyncio-task.rst:874 -#: ../../library/asyncio-task.rst:929 ../../library/asyncio-task.rst:986 +#: ../../library/asyncio-task.rst:515 ../../library/asyncio-task.rst:613 +#: ../../library/asyncio-task.rst:712 ../../library/asyncio-task.rst:887 +#: ../../library/asyncio-task.rst:942 ../../library/asyncio-task.rst:999 msgid "Removed the *loop* parameter." msgstr "移除 *loop* 參數。" -#: ../../library/asyncio-task.rst:505 +#: ../../library/asyncio-task.rst:518 msgid "Raises :exc:`ValueError` if *delay* is :data:`~math.nan`." msgstr "" -#: ../../library/asyncio-task.rst:510 +#: ../../library/asyncio-task.rst:523 msgid "Running Tasks Concurrently" msgstr "" -#: ../../library/asyncio-task.rst:514 +#: ../../library/asyncio-task.rst:527 msgid "" "Run :ref:`awaitable objects ` in the *aws* sequence " "*concurrently*." msgstr "" -#: ../../library/asyncio-task.rst:517 +#: ../../library/asyncio-task.rst:530 msgid "" "If any awaitable in *aws* is a coroutine, it is automatically scheduled as a " "Task." msgstr "" -#: ../../library/asyncio-task.rst:520 +#: ../../library/asyncio-task.rst:533 msgid "" "If all awaitables are completed successfully, the result is an aggregate " "list of returned values. The order of result values corresponds to the " "order of awaitables in *aws*." msgstr "" -#: ../../library/asyncio-task.rst:524 +#: ../../library/asyncio-task.rst:537 msgid "" "If *return_exceptions* is ``False`` (default), the first raised exception is " "immediately propagated to the task that awaits on ``gather()``. Other " @@ -756,19 +780,19 @@ msgid "" "run." msgstr "" -#: ../../library/asyncio-task.rst:529 +#: ../../library/asyncio-task.rst:542 msgid "" "If *return_exceptions* is ``True``, exceptions are treated the same as " "successful results, and aggregated in the result list." msgstr "" -#: ../../library/asyncio-task.rst:532 +#: ../../library/asyncio-task.rst:545 msgid "" "If ``gather()`` is *cancelled*, all submitted awaitables (that have not " "completed yet) are also *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:535 +#: ../../library/asyncio-task.rst:548 msgid "" "If any Task or Future from the *aws* sequence is *cancelled*, it is treated " "as if it raised :exc:`CancelledError` -- the ``gather()`` call is **not** " @@ -776,7 +800,7 @@ msgid "" "submitted Task/Future to cause other Tasks/Futures to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:542 +#: ../../library/asyncio-task.rst:555 msgid "" "A new alternative to create and run tasks concurrently and wait for their " "completion is :class:`asyncio.TaskGroup`. *TaskGroup* provides stronger " @@ -786,7 +810,7 @@ msgid "" "tasks)." msgstr "" -#: ../../library/asyncio-task.rst:553 +#: ../../library/asyncio-task.rst:566 msgid "" "import asyncio\n" "\n" @@ -825,7 +849,7 @@ msgid "" "# [2, 6, 24]" msgstr "" -#: ../../library/asyncio-task.rst:589 +#: ../../library/asyncio-task.rst:602 msgid "" "If *return_exceptions* is false, cancelling gather() after it has been " "marked done won't cancel any submitted awaitables. For instance, gather can " @@ -834,44 +858,44 @@ msgid "" "the awaitables) from gather won't cancel any other awaitables." msgstr "" -#: ../../library/asyncio-task.rst:596 +#: ../../library/asyncio-task.rst:609 msgid "" "If the *gather* itself is cancelled, the cancellation is propagated " "regardless of *return_exceptions*." msgstr "" -#: ../../library/asyncio-task.rst:603 +#: ../../library/asyncio-task.rst:616 msgid "" "Deprecation warning is emitted if no positional arguments are provided or " "not all positional arguments are Future-like objects and there is no running " "event loop." msgstr "" -#: ../../library/asyncio-task.rst:612 +#: ../../library/asyncio-task.rst:625 msgid "Eager Task Factory" msgstr "" -#: ../../library/asyncio-task.rst:616 +#: ../../library/asyncio-task.rst:629 msgid "A task factory for eager task execution." msgstr "" -#: ../../library/asyncio-task.rst:618 +#: ../../library/asyncio-task.rst:631 msgid "" -"When using this factory (via :meth:`loop.set_task_factory(asyncio." -"eager_task_factory) `), coroutines begin execution " -"synchronously during :class:`Task` construction. Tasks are only scheduled on " -"the event loop if they block. This can be a performance improvement as the " -"overhead of loop scheduling is avoided for coroutines that complete " -"synchronously." +"When using this factory " +"(via :meth:`loop.set_task_factory(asyncio.eager_task_factory) " +"`), coroutines begin execution synchronously " +"during :class:`Task` construction. Tasks are only scheduled on the event " +"loop if they block. This can be a performance improvement as the overhead of " +"loop scheduling is avoided for coroutines that complete synchronously." msgstr "" -#: ../../library/asyncio-task.rst:624 +#: ../../library/asyncio-task.rst:637 msgid "" "A common example where this is beneficial is coroutines which employ caching " "or memoization to avoid actual I/O when possible." msgstr "" -#: ../../library/asyncio-task.rst:629 +#: ../../library/asyncio-task.rst:642 msgid "" "Immediate execution of the coroutine is a semantic change. If the coroutine " "returns or raises, the task is never scheduled to the event loop. If the " @@ -880,46 +904,46 @@ msgid "" "the application's task execution order is likely to change." msgstr "" -#: ../../library/asyncio-task.rst:640 +#: ../../library/asyncio-task.rst:653 msgid "" "Create an eager task factory, similar to :func:`eager_task_factory`, using " "the provided *custom_task_constructor* when creating a new task instead of " "the default :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:644 +#: ../../library/asyncio-task.rst:657 msgid "" "*custom_task_constructor* must be a *callable* with the signature matching " -"the signature of :class:`Task.__init__ `. The callable must return a :" -"class:`asyncio.Task`-compatible object." +"the signature of :class:`Task.__init__ `. The callable must return " +"a :class:`asyncio.Task`-compatible object." msgstr "" -#: ../../library/asyncio-task.rst:648 +#: ../../library/asyncio-task.rst:661 msgid "" "This function returns a *callable* intended to be used as a task factory of " -"an event loop via :meth:`loop.set_task_factory(factory) `)." +"an event loop via :meth:`loop.set_task_factory(factory) " +"`)." msgstr "" -#: ../../library/asyncio-task.rst:655 +#: ../../library/asyncio-task.rst:668 msgid "Shielding From Cancellation" msgstr "" -#: ../../library/asyncio-task.rst:659 +#: ../../library/asyncio-task.rst:672 msgid "" -"Protect an :ref:`awaitable object ` from being :meth:" -"`cancelled `." +"Protect an :ref:`awaitable object ` from " +"being :meth:`cancelled `." msgstr "" -#: ../../library/asyncio-task.rst:662 ../../library/asyncio-task.rst:829 +#: ../../library/asyncio-task.rst:675 ../../library/asyncio-task.rst:842 msgid "If *aw* is a coroutine it is automatically scheduled as a Task." msgstr "" -#: ../../library/asyncio-task.rst:664 +#: ../../library/asyncio-task.rst:677 msgid "The statement::" msgstr "" -#: ../../library/asyncio-task.rst:666 +#: ../../library/asyncio-task.rst:679 msgid "" "task = asyncio.create_task(something())\n" "res = await shield(task)" @@ -927,37 +951,37 @@ msgstr "" "task = asyncio.create_task(something())\n" "res = await shield(task)" -#: ../../library/asyncio-task.rst:669 +#: ../../library/asyncio-task.rst:682 msgid "is equivalent to::" msgstr "" -#: ../../library/asyncio-task.rst:671 +#: ../../library/asyncio-task.rst:684 msgid "res = await something()" msgstr "res = await something()" -#: ../../library/asyncio-task.rst:673 +#: ../../library/asyncio-task.rst:686 msgid "" "*except* that if the coroutine containing it is cancelled, the Task running " "in ``something()`` is not cancelled. From the point of view of " "``something()``, the cancellation did not happen. Although its caller is " -"still cancelled, so the \"await\" expression still raises a :exc:" -"`CancelledError`." +"still cancelled, so the \"await\" expression still raises " +"a :exc:`CancelledError`." msgstr "" -#: ../../library/asyncio-task.rst:679 +#: ../../library/asyncio-task.rst:692 msgid "" "If ``something()`` is cancelled by other means (i.e. from within itself) " "that would also cancel ``shield()``." msgstr "" -#: ../../library/asyncio-task.rst:682 +#: ../../library/asyncio-task.rst:695 msgid "" "If it is desired to completely ignore cancellation (not recommended) the " "``shield()`` function should be combined with a try/except clause, as " "follows::" msgstr "" -#: ../../library/asyncio-task.rst:686 +#: ../../library/asyncio-task.rst:699 msgid "" "task = asyncio.create_task(something())\n" "try:\n" @@ -971,7 +995,7 @@ msgstr "" "except CancelledError:\n" " res = None" -#: ../../library/asyncio-task.rst:694 +#: ../../library/asyncio-task.rst:707 msgid "" "Save a reference to tasks passed to this function, to avoid a task " "disappearing mid-execution. The event loop only keeps weak references to " @@ -979,36 +1003,36 @@ msgid "" "any time, even before it's done." msgstr "" -#: ../../library/asyncio-task.rst:702 +#: ../../library/asyncio-task.rst:715 msgid "" "Deprecation warning is emitted if *aw* is not Future-like object and there " "is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:708 +#: ../../library/asyncio-task.rst:721 msgid "Timeouts" msgstr "" -#: ../../library/asyncio-task.rst:712 +#: ../../library/asyncio-task.rst:725 msgid "" "Return an :ref:`asynchronous context manager ` that " "can be used to limit the amount of time spent waiting on something." msgstr "" -#: ../../library/asyncio-task.rst:716 +#: ../../library/asyncio-task.rst:729 msgid "" "*delay* can either be ``None``, or a float/int number of seconds to wait. If " "*delay* is ``None``, no time limit will be applied; this can be useful if " "the delay is unknown when the context manager is created." msgstr "" -#: ../../library/asyncio-task.rst:721 +#: ../../library/asyncio-task.rst:734 msgid "" -"In either case, the context manager can be rescheduled after creation using :" -"meth:`Timeout.reschedule`." +"In either case, the context manager can be rescheduled after creation " +"using :meth:`Timeout.reschedule`." msgstr "" -#: ../../library/asyncio-task.rst:726 +#: ../../library/asyncio-task.rst:739 msgid "" "async def main():\n" " async with asyncio.timeout(10):\n" @@ -1018,26 +1042,26 @@ msgstr "" " async with asyncio.timeout(10):\n" " await long_running_task()" -#: ../../library/asyncio-task.rst:730 +#: ../../library/asyncio-task.rst:743 msgid "" "If ``long_running_task`` takes more than 10 seconds to complete, the context " -"manager will cancel the current task and handle the resulting :exc:`asyncio." -"CancelledError` internally, transforming it into a :exc:`TimeoutError` which " -"can be caught and handled." +"manager will cancel the current task and handle the " +"resulting :exc:`asyncio.CancelledError` internally, transforming it into " +"a :exc:`TimeoutError` which can be caught and handled." msgstr "" -#: ../../library/asyncio-task.rst:737 +#: ../../library/asyncio-task.rst:750 msgid "" -"The :func:`asyncio.timeout` context manager is what transforms the :exc:" -"`asyncio.CancelledError` into a :exc:`TimeoutError`, which means the :exc:" -"`TimeoutError` can only be caught *outside* of the context manager." +"The :func:`asyncio.timeout` context manager is what transforms " +"the :exc:`asyncio.CancelledError` into a :exc:`TimeoutError`, which means " +"the :exc:`TimeoutError` can only be caught *outside* of the context manager." msgstr "" -#: ../../library/asyncio-task.rst:742 +#: ../../library/asyncio-task.rst:755 msgid "Example of catching :exc:`TimeoutError`::" msgstr "" -#: ../../library/asyncio-task.rst:744 +#: ../../library/asyncio-task.rst:757 msgid "" "async def main():\n" " try:\n" @@ -1049,48 +1073,48 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:753 +#: ../../library/asyncio-task.rst:766 msgid "" "The context manager produced by :func:`asyncio.timeout` can be rescheduled " "to a different deadline and inspected." msgstr "" -#: ../../library/asyncio-task.rst:758 +#: ../../library/asyncio-task.rst:771 msgid "" "An :ref:`asynchronous context manager ` for " "cancelling overdue coroutines." msgstr "" -#: ../../library/asyncio-task.rst:761 +#: ../../library/asyncio-task.rst:774 msgid "" "``when`` should be an absolute time at which the context should time out, as " "measured by the event loop's clock:" msgstr "" -#: ../../library/asyncio-task.rst:764 +#: ../../library/asyncio-task.rst:777 msgid "If ``when`` is ``None``, the timeout will never trigger." msgstr "" -#: ../../library/asyncio-task.rst:765 +#: ../../library/asyncio-task.rst:778 msgid "" "If ``when < loop.time()``, the timeout will trigger on the next iteration of " "the event loop." msgstr "" -#: ../../library/asyncio-task.rst:770 +#: ../../library/asyncio-task.rst:783 msgid "" "Return the current deadline, or ``None`` if the current deadline is not set." msgstr "" -#: ../../library/asyncio-task.rst:775 +#: ../../library/asyncio-task.rst:788 msgid "Reschedule the timeout." msgstr "" -#: ../../library/asyncio-task.rst:779 +#: ../../library/asyncio-task.rst:792 msgid "Return whether the context manager has exceeded its deadline (expired)." msgstr "" -#: ../../library/asyncio-task.rst:784 +#: ../../library/asyncio-task.rst:797 msgid "" "async def main():\n" " try:\n" @@ -1108,17 +1132,17 @@ msgid "" " print(\"Looks like we haven't finished on time.\")" msgstr "" -#: ../../library/asyncio-task.rst:799 +#: ../../library/asyncio-task.rst:812 msgid "Timeout context managers can be safely nested." msgstr "" -#: ../../library/asyncio-task.rst:805 +#: ../../library/asyncio-task.rst:818 msgid "" "Similar to :func:`asyncio.timeout`, except *when* is the absolute time to " "stop waiting, or ``None``." msgstr "" -#: ../../library/asyncio-task.rst:810 +#: ../../library/asyncio-task.rst:823 msgid "" "async def main():\n" " loop = get_running_loop()\n" @@ -1132,41 +1156,41 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:826 +#: ../../library/asyncio-task.rst:839 msgid "" "Wait for the *aw* :ref:`awaitable ` to complete with a " "timeout." msgstr "" -#: ../../library/asyncio-task.rst:831 +#: ../../library/asyncio-task.rst:844 msgid "" "*timeout* can either be ``None`` or a float or int number of seconds to wait " "for. If *timeout* is ``None``, block until the future completes." msgstr "" -#: ../../library/asyncio-task.rst:835 +#: ../../library/asyncio-task.rst:848 msgid "" "If a timeout occurs, it cancels the task and raises :exc:`TimeoutError`." msgstr "" -#: ../../library/asyncio-task.rst:838 +#: ../../library/asyncio-task.rst:851 msgid "" -"To avoid the task :meth:`cancellation `, wrap it in :func:" -"`shield`." +"To avoid the task :meth:`cancellation `, wrap it " +"in :func:`shield`." msgstr "" -#: ../../library/asyncio-task.rst:841 +#: ../../library/asyncio-task.rst:854 msgid "" "The function will wait until the future is actually cancelled, so the total " "wait time may exceed the *timeout*. If an exception happens during " "cancellation, it is propagated." msgstr "" -#: ../../library/asyncio-task.rst:845 +#: ../../library/asyncio-task.rst:858 msgid "If the wait is cancelled, the future *aw* is also cancelled." msgstr "" -#: ../../library/asyncio-task.rst:851 +#: ../../library/asyncio-task.rst:864 msgid "" "async def eternity():\n" " # Sleep for one hour\n" @@ -1187,116 +1211,116 @@ msgid "" "# timeout!" msgstr "" -#: ../../library/asyncio-task.rst:869 +#: ../../library/asyncio-task.rst:882 msgid "" "When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be " "cancelled. Previously, it raised :exc:`TimeoutError` immediately." msgstr "" -#: ../../library/asyncio-task.rst:877 +#: ../../library/asyncio-task.rst:890 msgid "Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`." msgstr "引發 :exc:`TimeoutError` 而不是 :exc:`asyncio.TimeoutError`。" -#: ../../library/asyncio-task.rst:882 +#: ../../library/asyncio-task.rst:895 msgid "Waiting Primitives" msgstr "" -#: ../../library/asyncio-task.rst:887 +#: ../../library/asyncio-task.rst:900 msgid "" "Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the " "*aws* iterable concurrently and block until the condition specified by " "*return_when*." msgstr "" -#: ../../library/asyncio-task.rst:891 +#: ../../library/asyncio-task.rst:904 msgid "The *aws* iterable must not be empty." msgstr "" -#: ../../library/asyncio-task.rst:893 +#: ../../library/asyncio-task.rst:906 msgid "Returns two sets of Tasks/Futures: ``(done, pending)``." msgstr "" -#: ../../library/asyncio-task.rst:895 +#: ../../library/asyncio-task.rst:908 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-task.rst:897 +#: ../../library/asyncio-task.rst:910 msgid "done, pending = await asyncio.wait(aws)" msgstr "done, pending = await asyncio.wait(aws)" -#: ../../library/asyncio-task.rst:899 +#: ../../library/asyncio-task.rst:912 msgid "" "*timeout* (a float or int), if specified, can be used to control the maximum " "number of seconds to wait before returning." msgstr "" -#: ../../library/asyncio-task.rst:902 +#: ../../library/asyncio-task.rst:915 msgid "" "Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks " "that aren't done when the timeout occurs are simply returned in the second " "set." msgstr "" -#: ../../library/asyncio-task.rst:906 +#: ../../library/asyncio-task.rst:919 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: ../../library/asyncio-task.rst:912 +#: ../../library/asyncio-task.rst:925 msgid "Constant" msgstr "常數" -#: ../../library/asyncio-task.rst:913 +#: ../../library/asyncio-task.rst:926 msgid "Description" msgstr "描述" -#: ../../library/asyncio-task.rst:916 +#: ../../library/asyncio-task.rst:929 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: ../../library/asyncio-task.rst:919 +#: ../../library/asyncio-task.rst:932 msgid "" "The function will return when any future finishes by raising an exception. " -"If no future raises an exception then it is equivalent to :const:" -"`ALL_COMPLETED`." +"If no future raises an exception then it is equivalent " +"to :const:`ALL_COMPLETED`." msgstr "" -#: ../../library/asyncio-task.rst:924 +#: ../../library/asyncio-task.rst:937 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: ../../library/asyncio-task.rst:926 +#: ../../library/asyncio-task.rst:939 msgid "" "Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the futures " "when a timeout occurs." msgstr "" -#: ../../library/asyncio-task.rst:932 +#: ../../library/asyncio-task.rst:945 msgid "Passing coroutine objects to ``wait()`` directly is forbidden." msgstr "" -#: ../../library/asyncio-task.rst:935 ../../library/asyncio-task.rst:993 +#: ../../library/asyncio-task.rst:948 ../../library/asyncio-task.rst:1006 msgid "Added support for generators yielding tasks." msgstr "" -#: ../../library/asyncio-task.rst:941 +#: ../../library/asyncio-task.rst:954 msgid "" "Run :ref:`awaitable objects ` in the *aws* iterable " "concurrently. The returned object can be iterated to obtain the results of " "the awaitables as they finish." msgstr "" -#: ../../library/asyncio-task.rst:945 +#: ../../library/asyncio-task.rst:958 msgid "" -"The object returned by ``as_completed()`` can be iterated as an :term:" -"`asynchronous iterator` or a plain :term:`iterator`. When asynchronous " -"iteration is used, the originally-supplied awaitables are yielded if they " -"are tasks or futures. This makes it easy to correlate previously-scheduled " -"tasks with their results. Example::" +"The object returned by ``as_completed()`` can be iterated as " +"an :term:`asynchronous iterator` or a plain :term:`iterator`. When " +"asynchronous iteration is used, the originally-supplied awaitables are " +"yielded if they are tasks or futures. This makes it easy to correlate " +"previously-scheduled tasks with their results. Example::" msgstr "" -#: ../../library/asyncio-task.rst:951 +#: ../../library/asyncio-task.rst:964 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1313,20 +1337,20 @@ msgid "" " print(\"IPv4 connection established.\")" msgstr "" -#: ../../library/asyncio-task.rst:965 +#: ../../library/asyncio-task.rst:978 msgid "" "During asynchronous iteration, implicitly-created tasks will be yielded for " "supplied awaitables that aren't tasks or futures." msgstr "" -#: ../../library/asyncio-task.rst:968 +#: ../../library/asyncio-task.rst:981 msgid "" "When used as a plain iterator, each iteration yields a new coroutine that " "returns the result or raises the exception of the next completed awaitable. " "This pattern is compatible with Python versions older than 3.13::" msgstr "" -#: ../../library/asyncio-task.rst:972 +#: ../../library/asyncio-task.rst:985 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1339,34 +1363,34 @@ msgid "" " reader, writer = await next_connect" msgstr "" -#: ../../library/asyncio-task.rst:982 +#: ../../library/asyncio-task.rst:995 msgid "" "A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables " "are done. This is raised by the ``async for`` loop during asynchronous " "iteration or by the coroutines yielded during plain iteration." msgstr "" -#: ../../library/asyncio-task.rst:989 +#: ../../library/asyncio-task.rst:1002 msgid "" "Deprecation warning is emitted if not all awaitable objects in the *aws* " "iterable are Future-like objects and there is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:996 +#: ../../library/asyncio-task.rst:1009 msgid "" "The result can now be used as either an :term:`asynchronous iterator` or as " "a plain :term:`iterator` (previously it was only a plain iterator)." msgstr "" -#: ../../library/asyncio-task.rst:1002 +#: ../../library/asyncio-task.rst:1015 msgid "Running in Threads" msgstr "" -#: ../../library/asyncio-task.rst:1007 +#: ../../library/asyncio-task.rst:1020 msgid "Asynchronously run function *func* in a separate thread." msgstr "" -#: ../../library/asyncio-task.rst:1009 +#: ../../library/asyncio-task.rst:1022 msgid "" "Any \\*args and \\*\\*kwargs supplied for this function are directly passed " "to *func*. Also, the current :class:`contextvars.Context` is propagated, " @@ -1374,19 +1398,19 @@ msgid "" "separate thread." msgstr "" -#: ../../library/asyncio-task.rst:1014 +#: ../../library/asyncio-task.rst:1027 msgid "" "Return a coroutine that can be awaited to get the eventual result of *func*." msgstr "" -#: ../../library/asyncio-task.rst:1016 +#: ../../library/asyncio-task.rst:1029 msgid "" "This coroutine function is primarily intended to be used for executing IO-" "bound functions/methods that would otherwise block the event loop if they " "were run in the main thread. For example::" msgstr "" -#: ../../library/asyncio-task.rst:1020 +#: ../../library/asyncio-task.rst:1033 msgid "" "def blocking_io():\n" " print(f\"start blocking_io at {time.strftime('%X')}\")\n" @@ -1415,7 +1439,7 @@ msgid "" "# finished main at 19:50:54" msgstr "" -#: ../../library/asyncio-task.rst:1046 +#: ../../library/asyncio-task.rst:1059 msgid "" "Directly calling ``blocking_io()`` in any coroutine would block the event " "loop for its duration, resulting in an additional 1 second of run time. " @@ -1423,7 +1447,7 @@ msgid "" "thread without blocking the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1053 +#: ../../library/asyncio-task.rst:1066 msgid "" "Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used " "to make IO-bound functions non-blocking. However, for extension modules that " @@ -1431,45 +1455,97 @@ msgid "" "``asyncio.to_thread()`` can also be used for CPU-bound functions." msgstr "" -#: ../../library/asyncio-task.rst:1062 +#: ../../library/asyncio-task.rst:1075 msgid "Scheduling From Other Threads" msgstr "" -#: ../../library/asyncio-task.rst:1066 +#: ../../library/asyncio-task.rst:1079 msgid "Submit a coroutine to the given event loop. Thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1068 +#: ../../library/asyncio-task.rst:1081 msgid "" "Return a :class:`concurrent.futures.Future` to wait for the result from " "another OS thread." msgstr "" -#: ../../library/asyncio-task.rst:1071 +#: ../../library/asyncio-task.rst:1084 msgid "" "This function is meant to be called from a different OS thread than the one " "where the event loop is running. Example::" msgstr "" -#: ../../library/asyncio-task.rst:1074 +#: ../../library/asyncio-task.rst:1087 msgid "" -"# Create a coroutine\n" -"coro = asyncio.sleep(1, result=3)\n" +"def in_thread(loop: asyncio.AbstractEventLoop) -> None:\n" +" # Run some blocking IO\n" +" pathlib.Path(\"example.txt\").write_text(\"hello world\", " +"encoding=\"utf8\")\n" +"\n" +" # Create a coroutine\n" +" coro = asyncio.sleep(1, result=3)\n" +"\n" +" # Submit the coroutine to a given loop\n" +" future = asyncio.run_coroutine_threadsafe(coro, loop)\n" +"\n" +" # Wait for the result with an optional timeout argument\n" +" assert future.result(timeout=2) == 3\n" "\n" -"# Submit the coroutine to a given loop\n" -"future = asyncio.run_coroutine_threadsafe(coro, loop)\n" +"async def amain() -> None:\n" +" # Get the running loop\n" +" loop = asyncio.get_running_loop()\n" "\n" -"# Wait for the result with an optional timeout argument\n" -"assert future.result(timeout) == 3" +" # Run something in a thread\n" +" await asyncio.to_thread(in_thread, loop)" +msgstr "" + +#: ../../library/asyncio-task.rst:1107 +msgid "It's also possible to run the other way around. Example::" msgstr "" -#: ../../library/asyncio-task.rst:1083 +#: ../../library/asyncio-task.rst:1109 +msgid "" +"@contextlib.contextmanager\n" +"def loop_in_thread() -> Generator[asyncio.AbstractEventLoop]:\n" +" loop_fut = concurrent.futures.Future[asyncio.AbstractEventLoop]()\n" +" stop_event = asyncio.Event()\n" +"\n" +" async def main() -> None:\n" +" loop_fut.set_result(asyncio.get_running_loop())\n" +" await stop_event.wait()\n" +"\n" +" with concurrent.futures.ThreadPoolExecutor(1) as tpe:\n" +" complete_fut = tpe.submit(asyncio.run, main())\n" +" for fut in concurrent.futures.as_completed((loop_fut, " +"complete_fut)):\n" +" if fut is loop_fut:\n" +" loop = loop_fut.result()\n" +" try:\n" +" yield loop\n" +" finally:\n" +" loop.call_soon_threadsafe(stop_event.set)\n" +" else:\n" +" fut.result()\n" +"\n" +"# Create a loop in another thread\n" +"with loop_in_thread() as loop:\n" +" # Create a coroutine\n" +" coro = asyncio.sleep(1, result=3)\n" +"\n" +" # Submit the coroutine to a given loop\n" +" future = asyncio.run_coroutine_threadsafe(coro, loop)\n" +"\n" +" # Wait for the result with an optional timeout argument\n" +" assert future.result(timeout=2) == 3" +msgstr "" + +#: ../../library/asyncio-task.rst:1141 msgid "" "If an exception is raised in the coroutine, the returned Future will be " "notified. It can also be used to cancel the task in the event loop::" msgstr "" -#: ../../library/asyncio-task.rst:1087 +#: ../../library/asyncio-task.rst:1145 msgid "" "try:\n" " result = future.result(timeout)\n" @@ -1482,59 +1558,59 @@ msgid "" " print(f'The coroutine returned: {result!r}')" msgstr "" -#: ../../library/asyncio-task.rst:1097 +#: ../../library/asyncio-task.rst:1155 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "" -#: ../../library/asyncio-task.rst:1100 +#: ../../library/asyncio-task.rst:1158 msgid "" "Unlike other asyncio functions this function requires the *loop* argument to " "be passed explicitly." msgstr "" -#: ../../library/asyncio-task.rst:1107 +#: ../../library/asyncio-task.rst:1165 msgid "Introspection" msgstr "" -#: ../../library/asyncio-task.rst:1112 +#: ../../library/asyncio-task.rst:1170 msgid "" "Return the currently running :class:`Task` instance, or ``None`` if no task " "is running." msgstr "" -#: ../../library/asyncio-task.rst:1115 +#: ../../library/asyncio-task.rst:1173 msgid "" "If *loop* is ``None`` :func:`get_running_loop` is used to get the current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1123 +#: ../../library/asyncio-task.rst:1181 msgid "Return a set of not yet finished :class:`Task` objects run by the loop." msgstr "" -#: ../../library/asyncio-task.rst:1126 +#: ../../library/asyncio-task.rst:1184 msgid "" "If *loop* is ``None``, :func:`get_running_loop` is used for getting current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1134 +#: ../../library/asyncio-task.rst:1192 msgid "Return ``True`` if *obj* is a coroutine object." msgstr "" -#: ../../library/asyncio-task.rst:1141 +#: ../../library/asyncio-task.rst:1199 msgid "Task Object" msgstr "Task 物件" -#: ../../library/asyncio-task.rst:1145 +#: ../../library/asyncio-task.rst:1203 msgid "" "A :class:`Future-like ` object that runs a Python :ref:`coroutine " "`. Not thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1148 +#: ../../library/asyncio-task.rst:1206 msgid "" "Tasks are used to run coroutines in event loops. If a coroutine awaits on a " "Future, the Task suspends the execution of the coroutine and waits for the " @@ -1542,21 +1618,21 @@ msgid "" "wrapped coroutine resumes." msgstr "" -#: ../../library/asyncio-task.rst:1154 +#: ../../library/asyncio-task.rst:1212 msgid "" "Event loops use cooperative scheduling: an event loop runs one Task at a " "time. While a Task awaits for the completion of a Future, the event loop " "runs other Tasks, callbacks, or performs IO operations." msgstr "" -#: ../../library/asyncio-task.rst:1159 +#: ../../library/asyncio-task.rst:1217 msgid "" "Use the high-level :func:`asyncio.create_task` function to create Tasks, or " "the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. " "Manual instantiation of Tasks is discouraged." msgstr "" -#: ../../library/asyncio-task.rst:1164 +#: ../../library/asyncio-task.rst:1222 msgid "" "To cancel a running Task use the :meth:`cancel` method. Calling it will " "cause the Task to throw a :exc:`CancelledError` exception into the wrapped " @@ -1564,28 +1640,28 @@ msgid "" "cancellation, the Future object will be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1169 +#: ../../library/asyncio-task.rst:1227 msgid "" ":meth:`cancelled` can be used to check if the Task was cancelled. The method " -"returns ``True`` if the wrapped coroutine did not suppress the :exc:" -"`CancelledError` exception and was actually cancelled." +"returns ``True`` if the wrapped coroutine did not suppress " +"the :exc:`CancelledError` exception and was actually cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1174 +#: ../../library/asyncio-task.rst:1232 msgid "" -":class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :" -"meth:`Future.set_result` and :meth:`Future.set_exception`." +":class:`asyncio.Task` inherits from :class:`Future` all of its APIs " +"except :meth:`Future.set_result` and :meth:`Future.set_exception`." msgstr "" -#: ../../library/asyncio-task.rst:1178 +#: ../../library/asyncio-task.rst:1236 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *coro* to run in. If no *context* is " -"provided, the Task copies the current context and later runs its coroutine " -"in the copied context." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. If no " +"*context* is provided, the Task copies the current context and later runs " +"its coroutine in the copied context." msgstr "" -#: ../../library/asyncio-task.rst:1183 +#: ../../library/asyncio-task.rst:1241 msgid "" "An optional keyword-only *eager_start* argument allows eagerly starting the " "execution of the :class:`asyncio.Task` at task creation time. If set to " @@ -1595,96 +1671,96 @@ msgid "" "eagerly and will skip scheduling to the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1190 +#: ../../library/asyncio-task.rst:1248 msgid "Added support for the :mod:`contextvars` module." msgstr "新增對 :mod:`contextvars` 模組的支援。" -#: ../../library/asyncio-task.rst:1196 +#: ../../library/asyncio-task.rst:1254 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" -#: ../../library/asyncio-task.rst:1203 +#: ../../library/asyncio-task.rst:1261 msgid "Added the *eager_start* parameter." msgstr "新增 *eager_start* 參數。" -#: ../../library/asyncio-task.rst:1208 +#: ../../library/asyncio-task.rst:1266 msgid "Return ``True`` if the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1210 +#: ../../library/asyncio-task.rst:1268 msgid "" "A Task is *done* when the wrapped coroutine either returned a value, raised " "an exception, or the Task was cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1215 +#: ../../library/asyncio-task.rst:1273 msgid "Return the result of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1217 +#: ../../library/asyncio-task.rst:1275 msgid "" "If the Task is *done*, the result of the wrapped coroutine is returned (or " "if the coroutine raised an exception, that exception is re-raised.)" msgstr "" -#: ../../library/asyncio-task.rst:1221 ../../library/asyncio-task.rst:1235 +#: ../../library/asyncio-task.rst:1279 ../../library/asyncio-task.rst:1293 msgid "" "If the Task has been *cancelled*, this method raises a :exc:`CancelledError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1224 +#: ../../library/asyncio-task.rst:1282 msgid "" -"If the Task's result isn't yet available, this method raises an :exc:" -"`InvalidStateError` exception." +"If the Task's result isn't yet available, this method raises " +"an :exc:`InvalidStateError` exception." msgstr "" -#: ../../library/asyncio-task.rst:1229 +#: ../../library/asyncio-task.rst:1287 msgid "Return the exception of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1231 +#: ../../library/asyncio-task.rst:1289 msgid "" "If the wrapped coroutine raised an exception that exception is returned. If " "the wrapped coroutine returned normally this method returns ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1238 +#: ../../library/asyncio-task.rst:1296 msgid "" "If the Task isn't *done* yet, this method raises an :exc:`InvalidStateError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1243 +#: ../../library/asyncio-task.rst:1301 msgid "Add a callback to be run when the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1245 ../../library/asyncio-task.rst:1254 +#: ../../library/asyncio-task.rst:1303 ../../library/asyncio-task.rst:1312 msgid "This method should only be used in low-level callback-based code." msgstr "" -#: ../../library/asyncio-task.rst:1247 +#: ../../library/asyncio-task.rst:1305 msgid "" "See the documentation of :meth:`Future.add_done_callback` for more details." msgstr "" -#: ../../library/asyncio-task.rst:1252 +#: ../../library/asyncio-task.rst:1310 msgid "Remove *callback* from the callbacks list." msgstr "" -#: ../../library/asyncio-task.rst:1256 +#: ../../library/asyncio-task.rst:1314 msgid "" "See the documentation of :meth:`Future.remove_done_callback` for more " "details." msgstr "" -#: ../../library/asyncio-task.rst:1261 +#: ../../library/asyncio-task.rst:1319 msgid "Return the list of stack frames for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1263 +#: ../../library/asyncio-task.rst:1321 msgid "" "If the wrapped coroutine is not done, this returns the stack where it is " "suspended. If the coroutine has completed successfully or was cancelled, " @@ -1692,15 +1768,15 @@ msgid "" "this returns the list of traceback frames." msgstr "" -#: ../../library/asyncio-task.rst:1269 +#: ../../library/asyncio-task.rst:1327 msgid "The frames are always ordered from oldest to newest." msgstr "" -#: ../../library/asyncio-task.rst:1271 +#: ../../library/asyncio-task.rst:1329 msgid "Only one stack frame is returned for a suspended coroutine." msgstr "" -#: ../../library/asyncio-task.rst:1273 +#: ../../library/asyncio-task.rst:1331 msgid "" "The optional *limit* argument sets the maximum number of frames to return; " "by default all available frames are returned. The ordering of the returned " @@ -1709,113 +1785,113 @@ msgid "" "are returned. (This matches the behavior of the traceback module.)" msgstr "" -#: ../../library/asyncio-task.rst:1282 +#: ../../library/asyncio-task.rst:1340 msgid "Print the stack or traceback for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1284 +#: ../../library/asyncio-task.rst:1342 msgid "" "This produces output similar to that of the traceback module for the frames " "retrieved by :meth:`get_stack`." msgstr "" -#: ../../library/asyncio-task.rst:1287 +#: ../../library/asyncio-task.rst:1345 msgid "The *limit* argument is passed to :meth:`get_stack` directly." msgstr "" -#: ../../library/asyncio-task.rst:1289 +#: ../../library/asyncio-task.rst:1347 msgid "" "The *file* argument is an I/O stream to which the output is written; by " "default output is written to :data:`sys.stdout`." msgstr "" -#: ../../library/asyncio-task.rst:1294 +#: ../../library/asyncio-task.rst:1352 msgid "Return the coroutine object wrapped by the :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:1298 +#: ../../library/asyncio-task.rst:1356 msgid "" "This will return ``None`` for Tasks which have already completed eagerly. " "See the :ref:`Eager Task Factory `." msgstr "" -#: ../../library/asyncio-task.rst:1305 +#: ../../library/asyncio-task.rst:1363 msgid "Newly added eager task execution means result may be ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1309 +#: ../../library/asyncio-task.rst:1367 msgid "" "Return the :class:`contextvars.Context` object associated with the task." msgstr "" -#: ../../library/asyncio-task.rst:1316 +#: ../../library/asyncio-task.rst:1374 msgid "Return the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1318 +#: ../../library/asyncio-task.rst:1376 msgid "" "If no name has been explicitly assigned to the Task, the default asyncio " "Task implementation generates a default name during instantiation." msgstr "" -#: ../../library/asyncio-task.rst:1326 +#: ../../library/asyncio-task.rst:1384 msgid "Set the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1328 +#: ../../library/asyncio-task.rst:1386 msgid "" "The *value* argument can be any object, which is then converted to a string." msgstr "" -#: ../../library/asyncio-task.rst:1331 +#: ../../library/asyncio-task.rst:1389 msgid "" -"In the default Task implementation, the name will be visible in the :func:" -"`repr` output of a task object." +"In the default Task implementation, the name will be visible in " +"the :func:`repr` output of a task object." msgstr "" -#: ../../library/asyncio-task.rst:1338 +#: ../../library/asyncio-task.rst:1396 msgid "Request the Task to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1340 +#: ../../library/asyncio-task.rst:1398 msgid "" "If the Task is already *done* or *cancelled*, return ``False``, otherwise, " "return ``True``." msgstr "" -#: ../../library/asyncio-task.rst:1343 +#: ../../library/asyncio-task.rst:1401 msgid "" "The method arranges for a :exc:`CancelledError` exception to be thrown into " "the wrapped coroutine on the next cycle of the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1346 +#: ../../library/asyncio-task.rst:1404 msgid "" "The coroutine then has a chance to clean up or even deny the request by " "suppressing the exception with a :keyword:`try` ... ... ``except " -"CancelledError`` ... :keyword:`finally` block. Therefore, unlike :meth:" -"`Future.cancel`, :meth:`Task.cancel` does not guarantee that the Task will " -"be cancelled, although suppressing cancellation completely is not common and " -"is actively discouraged. Should the coroutine nevertheless decide to " -"suppress the cancellation, it needs to call :meth:`Task.uncancel` in " -"addition to catching the exception." +"CancelledError`` ... :keyword:`finally` block. Therefore, " +"unlike :meth:`Future.cancel`, :meth:`Task.cancel` does not guarantee that " +"the Task will be cancelled, although suppressing cancellation completely is " +"not common and is actively discouraged. Should the coroutine nevertheless " +"decide to suppress the cancellation, it needs to call :meth:`Task.uncancel` " +"in addition to catching the exception." msgstr "" -#: ../../library/asyncio-task.rst:1356 +#: ../../library/asyncio-task.rst:1414 msgid "Added the *msg* parameter." msgstr "新增 *msg* 參數。" -#: ../../library/asyncio-task.rst:1359 +#: ../../library/asyncio-task.rst:1417 msgid "The ``msg`` parameter is propagated from cancelled task to its awaiter." msgstr "" -#: ../../library/asyncio-task.rst:1364 +#: ../../library/asyncio-task.rst:1422 msgid "" "The following example illustrates how coroutines can intercept the " "cancellation request::" msgstr "" -#: ../../library/asyncio-task.rst:1367 +#: ../../library/asyncio-task.rst:1425 msgid "" "async def cancel_me():\n" " print('cancel_me(): before sleep')\n" @@ -1852,41 +1928,41 @@ msgid "" "# main(): cancel_me is cancelled now" msgstr "" -#: ../../library/asyncio-task.rst:1403 +#: ../../library/asyncio-task.rst:1461 msgid "Return ``True`` if the Task is *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:1405 +#: ../../library/asyncio-task.rst:1463 msgid "" -"The Task is *cancelled* when the cancellation was requested with :meth:" -"`cancel` and the wrapped coroutine propagated the :exc:`CancelledError` " -"exception thrown into it." +"The Task is *cancelled* when the cancellation was requested " +"with :meth:`cancel` and the wrapped coroutine propagated " +"the :exc:`CancelledError` exception thrown into it." msgstr "" -#: ../../library/asyncio-task.rst:1411 +#: ../../library/asyncio-task.rst:1469 msgid "Decrement the count of cancellation requests to this Task." msgstr "" -#: ../../library/asyncio-task.rst:1413 +#: ../../library/asyncio-task.rst:1471 msgid "Returns the remaining number of cancellation requests." msgstr "" -#: ../../library/asyncio-task.rst:1415 +#: ../../library/asyncio-task.rst:1473 msgid "" -"Note that once execution of a cancelled task completed, further calls to :" -"meth:`uncancel` are ineffective." +"Note that once execution of a cancelled task completed, further calls " +"to :meth:`uncancel` are ineffective." msgstr "" -#: ../../library/asyncio-task.rst:1420 +#: ../../library/asyncio-task.rst:1478 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. In particular, if a Task gets successfully uncancelled, this " -"allows for elements of structured concurrency like :ref:`taskgroups` and :" -"func:`asyncio.timeout` to continue running, isolating cancellation to the " -"respective structured block. For example::" +"allows for elements of structured concurrency like :ref:`taskgroups` " +"and :func:`asyncio.timeout` to continue running, isolating cancellation to " +"the respective structured block. For example::" msgstr "" -#: ../../library/asyncio-task.rst:1427 +#: ../../library/asyncio-task.rst:1485 msgid "" "async def make_request_with_timeout():\n" " try:\n" @@ -1900,42 +1976,42 @@ msgid "" " await unrelated_code()" msgstr "" -#: ../../library/asyncio-task.rst:1438 +#: ../../library/asyncio-task.rst:1496 msgid "" "While the block with ``make_request()`` and ``make_another_request()`` might " "get cancelled due to the timeout, ``unrelated_code()`` should continue " -"running even in case of the timeout. This is implemented with :meth:" -"`uncancel`. :class:`TaskGroup` context managers use :func:`uncancel` in a " -"similar fashion." +"running even in case of the timeout. This is implemented " +"with :meth:`uncancel`. :class:`TaskGroup` context managers " +"use :func:`uncancel` in a similar fashion." msgstr "" -#: ../../library/asyncio-task.rst:1444 +#: ../../library/asyncio-task.rst:1502 msgid "" -"If end-user code is, for some reason, suppressing cancellation by catching :" -"exc:`CancelledError`, it needs to call this method to remove the " +"If end-user code is, for some reason, suppressing cancellation by " +"catching :exc:`CancelledError`, it needs to call this method to remove the " "cancellation state." msgstr "" -#: ../../library/asyncio-task.rst:1448 +#: ../../library/asyncio-task.rst:1506 msgid "" "When this method decrements the cancellation count to zero, the method " -"checks if a previous :meth:`cancel` call had arranged for :exc:" -"`CancelledError` to be thrown into the task. If it hasn't been thrown yet, " -"that arrangement will be rescinded (by resetting the internal " +"checks if a previous :meth:`cancel` call had arranged " +"for :exc:`CancelledError` to be thrown into the task. If it hasn't been " +"thrown yet, that arrangement will be rescinded (by resetting the internal " "``_must_cancel`` flag)." msgstr "" -#: ../../library/asyncio-task.rst:1454 +#: ../../library/asyncio-task.rst:1512 msgid "Changed to rescind pending cancellation requests upon reaching zero." msgstr "" -#: ../../library/asyncio-task.rst:1459 +#: ../../library/asyncio-task.rst:1517 msgid "" "Return the number of pending cancellation requests to this Task, i.e., the " "number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls." msgstr "" -#: ../../library/asyncio-task.rst:1463 +#: ../../library/asyncio-task.rst:1521 msgid "" "Note that if this number is greater than zero but the Task is still " "executing, :meth:`cancelled` will still return ``False``. This is because " @@ -1944,7 +2020,7 @@ msgid "" "to zero." msgstr "" -#: ../../library/asyncio-task.rst:1469 +#: ../../library/asyncio-task.rst:1527 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. See :meth:`uncancel` for more details." diff --git a/library/asyncio.po b/library/asyncio.po index 980b7572151..62b4ee60dce 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-10 00:19+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-07-06 17:13+0800\n" "Last-Translator: Weilin Du\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,11 +25,11 @@ msgstr "" msgid "High-level APIs" msgstr "高階 API" -#: ../../library/asyncio.rst:108 +#: ../../library/asyncio.rst:109 msgid "Low-level APIs" msgstr "低階 API" -#: ../../library/asyncio.rst:119 +#: ../../library/asyncio.rst:120 msgid "Guides and Tutorials" msgstr "指南與教學" @@ -130,9 +130,9 @@ msgstr "" #: ../../library/asyncio.rst:53 msgid "" "create and manage :ref:`event loops `, which provide " -"asynchronous APIs for :ref:`networking `, running :ref:" -"`subprocesses `, handling :ref:`OS signals " -"`, etc;" +"asynchronous APIs for :ref:`networking `, " +"running :ref:`subprocesses `, handling :ref:`OS " +"signals `, etc;" msgstr "" "建立與管理 :ref:`event loops(事件迴圈) `,它提供了能被" "用於\\ :ref:`網路 `、執行\\ :ref:`子行程 " @@ -173,8 +173,8 @@ msgstr "asyncio REPL" #: ../../library/asyncio.rst:70 msgid "" -"You can experiment with an ``asyncio`` concurrent context in the :term:" -"`REPL`:" +"You can experiment with an ``asyncio`` concurrent context in " +"the :term:`REPL`:" msgstr "" "你能在 :term:`REPL` 中對一個 ``asyncio`` 的並行情境 (context) 進行實驗:" @@ -220,6 +220,6 @@ msgstr "" msgid "Reference" msgstr "參閱" -#: ../../library/asyncio.rst:128 +#: ../../library/asyncio.rst:129 msgid "The source code for asyncio can be found in :source:`Lib/asyncio/`." msgstr "asyncio 的原始碼可以在 :source:`Lib/asyncio/` 中找到。" diff --git a/library/audit_events.po b/library/audit_events.po index 46114bbe005..d02a27507c4 100644 --- a/library/audit_events.po +++ b/library/audit_events.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-06 00:03+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2021-12-06 21:50+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,13 +24,13 @@ msgstr "稽核事件表" #: ../../library/audit_events.rst:8 msgid "" -"This table contains all events raised by :func:`sys.audit` or :c:func:" -"`PySys_Audit` calls throughout the CPython runtime and the standard " -"library. These calls were added in 3.8 or later (see :pep:`578`)." +"This table contains all events raised by :func:`sys.audit` " +"or :c:func:`PySys_Audit` calls throughout the CPython runtime and the " +"standard library. These calls were added in 3.8 or later (see :pep:`578`)." msgstr "" -"這張表包含了所有在 CPython 運行環境 (runtime) 與標準函式庫對於 :func:`sys." -"audit` 或 :c:func:`PySys_Audit` 的呼叫所觸發的事件。這些呼叫是在 3.8 或更新的" -"版本中被新增(請見 :pep:`578`\\ )。" +"這張表包含了所有在 CPython 運行環境 (runtime) 與標準函式庫對" +"於 :func:`sys.audit` 或 :c:func:`PySys_Audit` 的呼叫所觸發的事件。這些呼叫是" +"在 3.8 或更新的版本中被新增(請見 :pep:`578`\\ )。" #: ../../library/audit_events.rst:12 msgid "" @@ -120,13 +120,25 @@ msgid "``handle``, ``exit_code``" msgstr "``handle``, ``exit_code``" #: ../../library/audit_events.rst:46 +msgid "_posixsubprocess.fork_exec" +msgstr "" + +#: ../../library/audit_events.rst:46 +msgid "``exec_list``, ``args``, ``env``" +msgstr "" + +#: ../../library/audit_events.rst:48 msgid "ctypes.PyObj_FromPtr" msgstr "ctypes.PyObj_FromPtr" -#: ../../library/audit_events.rst:46 +#: ../../library/audit_events.rst:48 msgid "``obj``" msgstr "``obj``" +#: ../../library/audit_events.rst:51 +msgid "The ``_posixsubprocess.fork_exec`` internal audit event." +msgstr "" + #: ../../library/audit_events.rst:3 msgid "audit events" msgstr "audit events(稽核事件)" diff --git a/library/bdb.po b/library/bdb.po index c188b1f1025..08ecf48ba3b 100644 --- a/library/bdb.po +++ b/library/bdb.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -61,10 +61,10 @@ msgstr "" #: ../../library/bdb.rst:33 msgid "" "When creating a breakpoint, its associated :attr:`file name ` should " -"be in canonical form. If a :attr:`funcname` is defined, a breakpoint :attr:" -"`hit ` will be counted when the first line of that function is " -"executed. A :attr:`conditional ` breakpoint always counts a :attr:" -"`hit `." +"be in canonical form. If a :attr:`funcname` is defined, a " +"breakpoint :attr:`hit ` will be counted when the first line of that " +"function is executed. A :attr:`conditional ` breakpoint always counts " +"a :attr:`hit `." msgstr "" #: ../../library/bdb.rst:39 @@ -158,8 +158,8 @@ msgstr "" #: ../../library/bdb.rst:110 msgid "" -"Dictionary of :class:`Breakpoint` instances indexed by (:attr:`file`, :attr:" -"`line`) tuples." +"Dictionary of :class:`Breakpoint` instances indexed by " +"(:attr:`file`, :attr:`line`) tuples." msgstr "" #: ../../library/bdb.rst:115 @@ -177,8 +177,8 @@ msgstr "" #: ../../library/bdb.rst:125 msgid "" "This class takes care of the details of the trace facility; a derived class " -"should implement user interaction. The standard debugger class (:class:`pdb." -"Pdb`) is an example." +"should implement user interaction. The standard debugger class " +"(:class:`pdb.Pdb`) is an example." msgstr "" #: ../../library/bdb.rst:129 @@ -191,287 +191,317 @@ msgid "" msgstr "" #: ../../library/bdb.rst:135 +msgid "" +"The *backend* argument specifies the backend to use for :class:`Bdb`. It can " +"be either ``'settrace'`` or ``'monitoring'``. ``'settrace'`` " +"uses :func:`sys.settrace` which has the best backward compatibility. The " +"``'monitoring'`` backend uses the new :mod:`sys.monitoring` that was " +"introduced in Python 3.12, which can be much more efficient because it can " +"disable unused events. We are trying to keep the exact interfaces for both " +"backends, but there are some differences. The debugger developers are " +"encouraged to use the ``'monitoring'`` backend to achieve better performance." +msgstr "" + +#: ../../library/bdb.rst:145 msgid "Added the *skip* parameter." msgstr "新增 *skip* 引數。" -#: ../../library/bdb.rst:138 +#: ../../library/bdb.rst:148 +#, fuzzy +msgid "Added the *backend* parameter." +msgstr "新增 *skip* 引數。" + +#: ../../library/bdb.rst:151 msgid "" "The following methods of :class:`Bdb` normally don't need to be overridden." msgstr "" -#: ../../library/bdb.rst:142 +#: ../../library/bdb.rst:155 msgid "Return canonical form of *filename*." msgstr "" -#: ../../library/bdb.rst:144 +#: ../../library/bdb.rst:157 msgid "" -"For real file names, the canonical form is an operating-system-dependent, :" -"func:`case-normalized ` :func:`absolute path `. A *filename* with angle brackets, such as ``\"\"`` " -"generated in interactive mode, is returned unchanged." +"For real file names, the canonical form is an operating-system-" +"dependent, :func:`case-normalized ` :func:`absolute path " +"`. A *filename* with angle brackets, such as " +"``\"\"`` generated in interactive mode, is returned unchanged." msgstr "" -#: ../../library/bdb.rst:151 +#: ../../library/bdb.rst:164 msgid "" -"Set the :attr:`!botframe`, :attr:`!stopframe`, :attr:`!returnframe` and :" -"attr:`quitting ` attributes with values ready to start " +"Start tracing. For ``'settrace'`` backend, this method is equivalent to " +"``sys.settrace(self.trace_dispatch)``" +msgstr "" + +#: ../../library/bdb.rst:171 +msgid "" +"Stop tracing. For ``'settrace'`` backend, this method is equivalent to " +"``sys.settrace(None)``" +msgstr "" + +#: ../../library/bdb.rst:178 +msgid "" +"Set the :attr:`!botframe`, :attr:`!stopframe`, :attr:`!returnframe` " +"and :attr:`quitting ` attributes with values ready to start " "debugging." msgstr "" -#: ../../library/bdb.rst:156 +#: ../../library/bdb.rst:183 msgid "" "This function is installed as the trace function of debugged frames. Its " "return value is the new trace function (in most cases, that is, itself)." msgstr "" -#: ../../library/bdb.rst:159 +#: ../../library/bdb.rst:186 msgid "" "The default implementation decides how to dispatch a frame, depending on the " "type of event (passed as a string) that is about to be executed. *event* can " "be one of the following:" msgstr "" -#: ../../library/bdb.rst:163 +#: ../../library/bdb.rst:190 msgid "``\"line\"``: A new line of code is going to be executed." msgstr "" -#: ../../library/bdb.rst:164 +#: ../../library/bdb.rst:191 msgid "" "``\"call\"``: A function is about to be called, or another code block " "entered." msgstr "" -#: ../../library/bdb.rst:166 +#: ../../library/bdb.rst:193 msgid "``\"return\"``: A function or other code block is about to return." msgstr "" -#: ../../library/bdb.rst:167 +#: ../../library/bdb.rst:194 msgid "``\"exception\"``: An exception has occurred." msgstr "" -#: ../../library/bdb.rst:168 +#: ../../library/bdb.rst:195 msgid "``\"c_call\"``: A C function is about to be called." msgstr "" -#: ../../library/bdb.rst:169 +#: ../../library/bdb.rst:196 msgid "``\"c_return\"``: A C function has returned." msgstr "" -#: ../../library/bdb.rst:170 +#: ../../library/bdb.rst:197 msgid "``\"c_exception\"``: A C function has raised an exception." msgstr "" -#: ../../library/bdb.rst:172 +#: ../../library/bdb.rst:199 msgid "" "For the Python events, specialized functions (see below) are called. For " "the C events, no action is taken." msgstr "" -#: ../../library/bdb.rst:175 +#: ../../library/bdb.rst:202 msgid "The *arg* parameter depends on the previous event." msgstr "" -#: ../../library/bdb.rst:177 +#: ../../library/bdb.rst:204 msgid "" "See the documentation for :func:`sys.settrace` for more information on the " -"trace function. For more information on code and frame objects, refer to :" -"ref:`types`." +"trace function. For more information on code and frame objects, refer " +"to :ref:`types`." msgstr "" -#: ../../library/bdb.rst:183 +#: ../../library/bdb.rst:210 msgid "" -"If the debugger should stop on the current line, invoke the :meth:" -"`user_line` method (which should be overridden in subclasses). Raise a :exc:" -"`BdbQuit` exception if the :attr:`quitting ` flag is set " -"(which can be set from :meth:`user_line`). Return a reference to the :meth:" -"`trace_dispatch` method for further tracing in that scope." +"If the debugger should stop on the current line, invoke " +"the :meth:`user_line` method (which should be overridden in subclasses). " +"Raise a :exc:`BdbQuit` exception if the :attr:`quitting ` " +"flag is set (which can be set from :meth:`user_line`). Return a reference " +"to the :meth:`trace_dispatch` method for further tracing in that scope." msgstr "" -#: ../../library/bdb.rst:191 +#: ../../library/bdb.rst:218 msgid "" -"If the debugger should stop on this function call, invoke the :meth:" -"`user_call` method (which should be overridden in subclasses). Raise a :exc:" -"`BdbQuit` exception if the :attr:`quitting ` flag is set " -"(which can be set from :meth:`user_call`). Return a reference to the :meth:" -"`trace_dispatch` method for further tracing in that scope." +"If the debugger should stop on this function call, invoke " +"the :meth:`user_call` method (which should be overridden in subclasses). " +"Raise a :exc:`BdbQuit` exception if the :attr:`quitting ` " +"flag is set (which can be set from :meth:`user_call`). Return a reference " +"to the :meth:`trace_dispatch` method for further tracing in that scope." msgstr "" -#: ../../library/bdb.rst:199 +#: ../../library/bdb.rst:226 msgid "" -"If the debugger should stop on this function return, invoke the :meth:" -"`user_return` method (which should be overridden in subclasses). Raise a :" -"exc:`BdbQuit` exception if the :attr:`quitting ` flag is set " -"(which can be set from :meth:`user_return`). Return a reference to the :" -"meth:`trace_dispatch` method for further tracing in that scope." +"If the debugger should stop on this function return, invoke " +"the :meth:`user_return` method (which should be overridden in subclasses). " +"Raise a :exc:`BdbQuit` exception if the :attr:`quitting ` " +"flag is set (which can be set from :meth:`user_return`). Return a reference " +"to the :meth:`trace_dispatch` method for further tracing in that scope." msgstr "" -#: ../../library/bdb.rst:207 +#: ../../library/bdb.rst:234 msgid "" -"If the debugger should stop at this exception, invokes the :meth:" -"`user_exception` method (which should be overridden in subclasses). Raise a :" -"exc:`BdbQuit` exception if the :attr:`quitting ` flag is set " -"(which can be set from :meth:`user_exception`). Return a reference to the :" -"meth:`trace_dispatch` method for further tracing in that scope." +"If the debugger should stop at this exception, invokes " +"the :meth:`user_exception` method (which should be overridden in " +"subclasses). Raise a :exc:`BdbQuit` exception if the :attr:`quitting " +"` flag is set (which can be set from :meth:`user_exception`). " +"Return a reference to the :meth:`trace_dispatch` method for further tracing " +"in that scope." msgstr "" -#: ../../library/bdb.rst:213 +#: ../../library/bdb.rst:240 msgid "" "Normally derived classes don't override the following methods, but they may " "if they want to redefine the definition of stopping and breakpoints." msgstr "" -#: ../../library/bdb.rst:218 +#: ../../library/bdb.rst:245 msgid "Return ``True`` if *module_name* matches any skip pattern." msgstr "" -#: ../../library/bdb.rst:222 +#: ../../library/bdb.rst:249 msgid "Return ``True`` if *frame* is below the starting frame in the stack." msgstr "" -#: ../../library/bdb.rst:226 +#: ../../library/bdb.rst:253 msgid "Return ``True`` if there is an effective breakpoint for this line." msgstr "" -#: ../../library/bdb.rst:228 +#: ../../library/bdb.rst:255 msgid "" "Check whether a line or function breakpoint exists and is in effect. Delete " "temporary breakpoints based on information from :func:`effective`." msgstr "" -#: ../../library/bdb.rst:233 +#: ../../library/bdb.rst:260 msgid "Return ``True`` if any breakpoint exists for *frame*'s filename." msgstr "" -#: ../../library/bdb.rst:235 +#: ../../library/bdb.rst:262 msgid "" "Derived classes should override these methods to gain control over debugger " "operation." msgstr "" -#: ../../library/bdb.rst:240 +#: ../../library/bdb.rst:267 msgid "" "Called from :meth:`dispatch_call` if a break might stop inside the called " "function." msgstr "" -#: ../../library/bdb.rst:243 +#: ../../library/bdb.rst:270 msgid "" "*argument_list* is not used anymore and will always be ``None``. The " "argument is kept for backwards compatibility." msgstr "" -#: ../../library/bdb.rst:248 +#: ../../library/bdb.rst:275 msgid "" -"Called from :meth:`dispatch_line` when either :meth:`stop_here` or :meth:" -"`break_here` returns ``True``." +"Called from :meth:`dispatch_line` when either :meth:`stop_here` " +"or :meth:`break_here` returns ``True``." msgstr "" -#: ../../library/bdb.rst:253 +#: ../../library/bdb.rst:280 msgid "" "Called from :meth:`dispatch_return` when :meth:`stop_here` returns ``True``." msgstr "" -#: ../../library/bdb.rst:257 +#: ../../library/bdb.rst:284 msgid "" "Called from :meth:`dispatch_exception` when :meth:`stop_here` returns " "``True``." msgstr "" -#: ../../library/bdb.rst:262 +#: ../../library/bdb.rst:289 msgid "Handle how a breakpoint must be removed when it is a temporary one." msgstr "" -#: ../../library/bdb.rst:264 +#: ../../library/bdb.rst:291 msgid "This method must be implemented by derived classes." msgstr "" -#: ../../library/bdb.rst:267 +#: ../../library/bdb.rst:294 msgid "" "Derived classes and clients can call the following methods to affect the " "stepping state." msgstr "" -#: ../../library/bdb.rst:272 +#: ../../library/bdb.rst:299 msgid "Stop after one line of code." msgstr "" -#: ../../library/bdb.rst:276 +#: ../../library/bdb.rst:303 msgid "Stop on the next line in or below the given frame." msgstr "" -#: ../../library/bdb.rst:280 +#: ../../library/bdb.rst:307 msgid "Stop when returning from the given frame." msgstr "" -#: ../../library/bdb.rst:284 +#: ../../library/bdb.rst:311 msgid "" "Stop when the line with the *lineno* greater than the current one is reached " "or when returning from current frame." msgstr "" -#: ../../library/bdb.rst:289 +#: ../../library/bdb.rst:316 msgid "" "Start debugging from *frame*. If *frame* is not specified, debugging starts " "from caller's frame." msgstr "" -#: ../../library/bdb.rst:292 +#: ../../library/bdb.rst:319 msgid "" ":func:`set_trace` will enter the debugger immediately, rather than on the " "next line of code to be executed." msgstr "" -#: ../../library/bdb.rst:298 +#: ../../library/bdb.rst:325 msgid "" "Stop only at breakpoints or when finished. If there are no breakpoints, set " "the system trace function to ``None``." msgstr "" -#: ../../library/bdb.rst:305 +#: ../../library/bdb.rst:332 msgid "" "Set the :attr:`!quitting` attribute to ``True``. This raises :exc:`BdbQuit` " "in the next call to one of the :meth:`!dispatch_\\*` methods." msgstr "" -#: ../../library/bdb.rst:309 +#: ../../library/bdb.rst:336 msgid "" "Derived classes and clients can call the following methods to manipulate " "breakpoints. These methods return a string containing an error message if " "something went wrong, or ``None`` if all is well." msgstr "" -#: ../../library/bdb.rst:315 +#: ../../library/bdb.rst:342 msgid "" "Set a new breakpoint. If the *lineno* line doesn't exist for the *filename* " "passed as argument, return an error message. The *filename* should be in " "canonical form, as described in the :meth:`canonic` method." msgstr "" -#: ../../library/bdb.rst:321 +#: ../../library/bdb.rst:348 msgid "" "Delete the breakpoints in *filename* and *lineno*. If none were set, return " "an error message." msgstr "" -#: ../../library/bdb.rst:326 +#: ../../library/bdb.rst:353 msgid "" -"Delete the breakpoint which has the index *arg* in the :attr:`Breakpoint." -"bpbynumber`. If *arg* is not numeric or out of range, return an error " -"message." +"Delete the breakpoint which has the index *arg* in " +"the :attr:`Breakpoint.bpbynumber`. If *arg* is not numeric or out of range, " +"return an error message." msgstr "" -#: ../../library/bdb.rst:332 +#: ../../library/bdb.rst:359 msgid "" "Delete all breakpoints in *filename*. If none were set, return an error " "message." msgstr "" -#: ../../library/bdb.rst:337 +#: ../../library/bdb.rst:364 msgid "" "Delete all existing breakpoints. If none were set, return an error message." msgstr "" -#: ../../library/bdb.rst:342 +#: ../../library/bdb.rst:369 msgid "" "Return a breakpoint specified by the given number. If *arg* is a string, it " "will be converted to a number. If *arg* is a non-numeric string, if the " @@ -479,138 +509,161 @@ msgid "" "raised." msgstr "" -#: ../../library/bdb.rst:351 +#: ../../library/bdb.rst:378 msgid "Return ``True`` if there is a breakpoint for *lineno* in *filename*." msgstr "" -#: ../../library/bdb.rst:355 +#: ../../library/bdb.rst:382 msgid "" "Return all breakpoints for *lineno* in *filename*, or an empty list if none " "are set." msgstr "" -#: ../../library/bdb.rst:360 +#: ../../library/bdb.rst:387 msgid "Return all breakpoints in *filename*, or an empty list if none are set." msgstr "" -#: ../../library/bdb.rst:364 +#: ../../library/bdb.rst:391 msgid "Return all breakpoints that are set." msgstr "" -#: ../../library/bdb.rst:367 +#: ../../library/bdb.rst:394 +msgid "" +"Derived classes and clients can call the following methods to disable and " +"restart events to achieve better performance. These methods only work when " +"using the ``'monitoring'`` backend." +msgstr "" + +#: ../../library/bdb.rst:400 +msgid "" +"Disable the current event until the next time :func:`restart_events` is " +"called. This is helpful when the debugger is not interested in the current " +"line." +msgstr "" + +#: ../../library/bdb.rst:408 +msgid "" +"Restart all the disabled events. This function is automatically called in " +"``dispatch_*`` methods after ``user_*`` methods are called. If the " +"``dispatch_*`` methods are not overridden, the disabled events will be " +"restarted after each user interaction." +msgstr "" + +#: ../../library/bdb.rst:416 msgid "" "Derived classes and clients can call the following methods to get a data " "structure representing a stack trace." msgstr "" -#: ../../library/bdb.rst:372 +#: ../../library/bdb.rst:421 msgid "Return a list of (frame, lineno) tuples in a stack trace, and a size." msgstr "" -#: ../../library/bdb.rst:374 +#: ../../library/bdb.rst:423 msgid "" "The most recently called frame is last in the list. The size is the number " "of frames below the frame where the debugger was invoked." msgstr "" -#: ../../library/bdb.rst:379 +#: ../../library/bdb.rst:428 msgid "" "Return a string with information about a stack entry, which is a ``(frame, " "lineno)`` tuple. The return string contains:" msgstr "" -#: ../../library/bdb.rst:382 +#: ../../library/bdb.rst:431 msgid "The canonical filename which contains the frame." msgstr "" -#: ../../library/bdb.rst:383 +#: ../../library/bdb.rst:432 msgid "The function name or ``\"\"``." msgstr "函式名稱或 ``\"\"``。" -#: ../../library/bdb.rst:384 +#: ../../library/bdb.rst:433 msgid "The input arguments." msgstr "輸入引數。" -#: ../../library/bdb.rst:385 +#: ../../library/bdb.rst:434 msgid "The return value." msgstr "回傳值。" -#: ../../library/bdb.rst:386 +#: ../../library/bdb.rst:435 msgid "The line of code (if it exists)." msgstr "" -#: ../../library/bdb.rst:389 +#: ../../library/bdb.rst:438 msgid "" "The following two methods can be called by clients to use a debugger to " "debug a :term:`statement`, given as a string." msgstr "" -#: ../../library/bdb.rst:394 +#: ../../library/bdb.rst:443 msgid "" "Debug a statement executed via the :func:`exec` function. *globals* " "defaults to :attr:`!__main__.__dict__`, *locals* defaults to *globals*." msgstr "" -#: ../../library/bdb.rst:399 +#: ../../library/bdb.rst:448 msgid "" "Debug an expression executed via the :func:`eval` function. *globals* and " "*locals* have the same meaning as in :meth:`run`." msgstr "" -#: ../../library/bdb.rst:404 +#: ../../library/bdb.rst:453 msgid "For backwards compatibility. Calls the :meth:`run` method." msgstr "" -#: ../../library/bdb.rst:408 +#: ../../library/bdb.rst:457 msgid "Debug a single function call, and return its result." msgstr "" -#: ../../library/bdb.rst:411 +#: ../../library/bdb.rst:460 msgid "Finally, the module defines the following functions:" msgstr "最後,這個模組定義了以下函式:" -#: ../../library/bdb.rst:415 +#: ../../library/bdb.rst:464 msgid "" -"Return ``True`` if we should break here, depending on the way the :class:" -"`Breakpoint` *b* was set." +"Return ``True`` if we should break here, depending on the way " +"the :class:`Breakpoint` *b* was set." msgstr "" -#: ../../library/bdb.rst:418 +#: ../../library/bdb.rst:467 msgid "" -"If it was set via line number, it checks if :attr:`b.line ` is the same as the one in *frame*. If the breakpoint was set via :" -"attr:`function name `, we have to check we are in " -"the right *frame* (the right function) and if we are on its first executable " -"line." +"If it was set via line number, it checks if :attr:`b.line " +"` is the same as the one in *frame*. If the breakpoint " +"was set via :attr:`function name `, we have to " +"check we are in the right *frame* (the right function) and if we are on its " +"first executable line." msgstr "" -#: ../../library/bdb.rst:427 +#: ../../library/bdb.rst:476 msgid "" "Return ``(active breakpoint, delete temporary flag)`` or ``(None, None)`` as " "the breakpoint to act upon." msgstr "" -#: ../../library/bdb.rst:430 +#: ../../library/bdb.rst:479 msgid "" -"The *active breakpoint* is the first entry in :attr:`bplist ` for the (:attr:`file `, :attr:`line `) (which must exist) that is :attr:`enabled `, for which :func:`checkfuncname` is true, and that has neither a " +"The *active breakpoint* is the first entry in :attr:`bplist " +"` for the (:attr:`file " +"`, :attr:`line `) (which must " +"exist) that is :attr:`enabled `, for " +"which :func:`checkfuncname` is true, and that has neither a " "false :attr:`condition ` nor positive :attr:`ignore " "` count. The *flag*, meaning that a temporary " -"breakpoint should be deleted, is ``False`` only when the :attr:`cond ` cannot be evaluated (in which case, :attr:`ignore ` count is ignored)." +"breakpoint should be deleted, is ``False`` only when the :attr:`cond " +"` cannot be evaluated (in which case, :attr:`ignore " +"` count is ignored)." msgstr "" -#: ../../library/bdb.rst:441 +#: ../../library/bdb.rst:490 msgid "If no such entry exists, then ``(None, None)`` is returned." msgstr "" -#: ../../library/bdb.rst:446 +#: ../../library/bdb.rst:495 msgid "Start debugging with a :class:`Bdb` instance from caller's frame." msgstr "" -#: ../../library/bdb.rst:303 +#: ../../library/bdb.rst:330 msgid "quitting (bdb.Bdb attribute)" msgstr "" diff --git a/library/bisect.po b/library/bisect.po index 1f1e756f261..2b3e26b4c36 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-31 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-08-01 12:53+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,10 +46,10 @@ msgid "" "The module is called :mod:`bisect` because it uses a basic bisection " "algorithm to do its work. Unlike other bisection tools that search for a " "specific value, the functions in this module are designed to locate an " -"insertion point. Accordingly, the functions never call an :meth:`~object." -"__eq__` method to determine whether a value has been found. Instead, the " -"functions only call the :meth:`~object.__lt__` method and will return an " -"insertion point between values in an array." +"insertion point. Accordingly, the functions never call " +"an :meth:`~object.__eq__` method to determine whether a value has been " +"found. Instead, the functions only call the :meth:`~object.__lt__` method " +"and will return an insertion point between values in an array." msgstr "" "這個模組被稱為 :mod:`bisect` 是因為它使用基本二分演算法來完成其工作。不像其它" "搜尋特定值的二分法工具,本模組中的函式旨在定位插入點。因此,這些函式永遠不會" @@ -81,8 +81,8 @@ msgid "" msgstr "" "在 *a* 當中找到一個位置,讓 *x* 插入後 *a* 仍然是排序好的。參數 *lo* 和 *hi* " "用來指定 list 中應該被考慮的子區間,預設是考慮整個 list 。如果 *a* 裡面已經" -"有 *x* 出現,插入的位置會在所有 *x* 的前面(左邊)。回傳值可以被當作 ``list." -"insert()`` 的第一個參數,但列表 *a* 必須先排序過。" +"有 *x* 出現,插入的位置會在所有 *x* 的前面(左邊)。回傳值可以被當作 " +"``list.insert()`` 的第一個參數,但列表 *a* 必須先排序過。" #: ../../library/bisect.rst:51 msgid "" @@ -140,10 +140,11 @@ msgid "Insert *x* in *a* in sorted order." msgstr "將元素 *x* 插入 list *a*,並維持順序。" #: ../../library/bisect.rst:85 +#, fuzzy msgid "" "This function first runs :py:func:`~bisect.bisect_left` to locate an " -"insertion point. Next, it runs the :meth:`!insert` method on *a* to insert " -"*x* at the appropriate position to maintain sort order." +"insertion point. Next, it runs the :meth:`~sequence.insert` method on *a* to " +"insert *x* at the appropriate position to maintain sort order." msgstr "" "此函式先使用 :py:func:`~bisect.bisect_left` 搜尋插入位置,接著用 :meth:`!" "insert` 於 *a* 以將 *x* 插入,並維持添加元素後的順序。" @@ -171,10 +172,11 @@ msgstr "" "面(右邊)。" #: ../../library/bisect.rst:105 +#, fuzzy msgid "" "This function first runs :py:func:`~bisect.bisect_right` to locate an " -"insertion point. Next, it runs the :meth:`!insert` method on *a* to insert " -"*x* at the appropriate position to maintain sort order." +"insertion point. Next, it runs the :meth:`~sequence.insert` method on *a* to " +"insert *x* at the appropriate position to maintain sort order." msgstr "" "此函式先使用 :py:func:`~bisect.bisect_right` 搜尋插入位置,接著用 :meth:`!" "insert` 於 *a* 以將 *x* 插入,並維持添加元素後的順序。" @@ -212,10 +214,10 @@ msgid "" "The search functions are stateless and discard key function results after " "they are used. Consequently, if the search functions are used in a loop, " "the key function may be called again and again on the same array elements. " -"If the key function isn't fast, consider wrapping it with :py:func:" -"`functools.cache` to avoid duplicate computations. Alternatively, consider " -"searching an array of precomputed keys to locate the insertion point (as " -"shown in the examples section below)." +"If the key function isn't fast, consider wrapping it " +"with :py:func:`functools.cache` to avoid duplicate computations. " +"Alternatively, consider searching an array of precomputed keys to locate the " +"insertion point (as shown in the examples section below)." msgstr "" "搜尋函式為無狀態的 (stateless),且鍵函式會在使用過後被丟棄。因此,如果搜尋函" "式被使用於迴圈當中,鍵函式會不斷被重複呼叫於相同的 list 元素。如果鍵函式執行" diff --git a/library/calendar.po b/library/calendar.po index 59c409fce58..eec862b56b1 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-08 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -246,21 +246,21 @@ msgid "" "the :meth:`setfirstweekday` method." msgstr "" -#: ../../library/calendar.rst:178 +#: ../../library/calendar.rst:179 msgid "" "Return a string representing the name of a single weekday formatted to the " "specified *width*. The *weekday* parameter is an integer representing the " "day of the week, where ``0`` is Monday and ``6`` is Sunday." msgstr "" -#: ../../library/calendar.rst:184 +#: ../../library/calendar.rst:186 msgid "" "Return a string containing the header row of weekday names, formatted with " "the given *width* for each column. The names depend on the locale settings " "and are padded to the specified width." msgstr "" -#: ../../library/calendar.rst:190 +#: ../../library/calendar.rst:193 msgid "" "Return a month's calendar in a multi-line string. If *w* is provided, it " "specifies the width of the date columns, which are centered. If *l* is " @@ -272,7 +272,7 @@ msgstr "" "度。如果給定 *l*,它會指定每一週使用的行數。這個日曆會依據在建構函式中指定或" "者透過 :meth:`setfirstweekday` 方法設定的一週的第一天來輸出。" -#: ../../library/calendar.rst:198 +#: ../../library/calendar.rst:202 msgid "" "Return a string representing the month's name centered within the specified " "*width*. If *withyear* is ``True``, include the year in the output. The " @@ -280,11 +280,11 @@ msgid "" "to be formatted respectively." msgstr "" -#: ../../library/calendar.rst:205 +#: ../../library/calendar.rst:210 msgid "Print a month's calendar as returned by :meth:`formatmonth`." msgstr "印出一個月份的日曆,內容和 :meth:`formatmonth` 回傳的一樣。" -#: ../../library/calendar.rst:210 +#: ../../library/calendar.rst:215 msgid "" "Return a *m*-column calendar for an entire year as a multi-line string. " "Optional parameters *w*, *l*, and *c* are for date column width, lines per " @@ -298,20 +298,20 @@ msgstr "" "者透過 :meth:`setfirstweekday` 方法設定的一週的第一天來輸出。最早可以產生日曆" "的年份會依據平台而不同。" -#: ../../library/calendar.rst:220 +#: ../../library/calendar.rst:225 msgid "" "Print the calendar for an entire year as returned by :meth:`formatyear`." msgstr "印出一整年的日曆,內容和 :meth:`formatyear` 回傳的一樣。" -#: ../../library/calendar.rst:225 +#: ../../library/calendar.rst:230 msgid "This class can be used to generate HTML calendars." msgstr "這個類別用來產生 HTML 日曆。" -#: ../../library/calendar.rst:228 +#: ../../library/calendar.rst:233 msgid ":class:`!HTMLCalendar` instances have the following methods:" msgstr ":class:`!HTMLCalendar` 實例有以下方法:" -#: ../../library/calendar.rst:232 +#: ../../library/calendar.rst:237 msgid "" "Return a month's calendar as an HTML table. If *withyear* is true the year " "will be included in the header, otherwise just the month name will be used." @@ -319,14 +319,14 @@ msgstr "" "以 HTML 表格的形式回傳一個月份的日曆。如果 *withyear* 是 true 則標題會包含年" "份,否則只會有月份名稱。" -#: ../../library/calendar.rst:239 +#: ../../library/calendar.rst:244 msgid "" "Return a year's calendar as an HTML table. *width* (defaulting to 3) " "specifies the number of months per row." msgstr "" "以 HTML 表格的形式回傳一整年的日曆。*width*\\ (預設為 3)指定一列有幾個月。" -#: ../../library/calendar.rst:245 +#: ../../library/calendar.rst:250 msgid "" "Return a year's calendar as a complete HTML page. *width* (defaulting to 3) " "specifies the number of months per row. *css* is the name for the cascading " @@ -338,7 +338,7 @@ msgstr "" "月。*css* 是要使用的 CSS (cascading style sheet) 名稱,可以給 :const:`None` " "表示不使用任何 CSS。*encoding* 指定輸出使用的編碼(預設使用系統預設編碼)。" -#: ../../library/calendar.rst:254 +#: ../../library/calendar.rst:259 msgid "" "Return a month name as an HTML table row. If *withyear* is true the year " "will be included in the row, otherwise just the month name will be used." @@ -346,28 +346,28 @@ msgstr "" "以 HTML 表列的形式回傳一個月份的名稱。如果 *withyear* 是 true 則該列會包含年" "份,否則只會有月份名稱。" -#: ../../library/calendar.rst:259 +#: ../../library/calendar.rst:264 msgid "" ":class:`!HTMLCalendar` has the following attributes you can override to " "customize the CSS classes used by the calendar:" msgstr ":class:`!HTMLCalendar` 可以覆寫以下屬性來客製日曆所使用的 CSS 類別:" -#: ../../library/calendar.rst:264 +#: ../../library/calendar.rst:269 msgid "" "A list of CSS classes used for each weekday. The default class list is::" msgstr "對應一週每一天 CSS 類別的串列。預設的串列內容為: ::" -#: ../../library/calendar.rst:266 +#: ../../library/calendar.rst:271 msgid "" "cssclasses = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"]" msgstr "" "cssclasses = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"]" -#: ../../library/calendar.rst:268 +#: ../../library/calendar.rst:273 msgid "more styles can be added for each day::" msgstr "可以針對每一天增加更多樣式: ::" -#: ../../library/calendar.rst:270 +#: ../../library/calendar.rst:275 msgid "" "cssclasses = [\"mon text-bold\", \"tue\", \"wed\", \"thu\", \"fri\", " "\"sat\", \"sun red\"]" @@ -375,15 +375,15 @@ msgstr "" "cssclasses = [\"mon text-bold\", \"tue\", \"wed\", \"thu\", \"fri\", " "\"sat\", \"sun red\"]" -#: ../../library/calendar.rst:272 +#: ../../library/calendar.rst:277 msgid "Note that the length of this list must be seven items." msgstr "注意這個串列的長度必須是七個項目。" -#: ../../library/calendar.rst:277 +#: ../../library/calendar.rst:282 msgid "The CSS class for a weekday occurring in the previous or coming month." msgstr "跟當月為同一週且屬於前一個或下一個月份的日期使用的 CSS 類別。" -#: ../../library/calendar.rst:284 +#: ../../library/calendar.rst:289 msgid "" "A list of CSS classes used for weekday names in the header row. The default " "is the same as :attr:`cssclasses`." @@ -391,7 +391,7 @@ msgstr "" "在標題列中一週每一天名稱的 CSS 類別的串列。預設內容和 :attr:`cssclasses` 相" "同。" -#: ../../library/calendar.rst:292 +#: ../../library/calendar.rst:297 msgid "" "The month's head CSS class (used by :meth:`formatmonthname`). The default " "value is ``\"month\"``." @@ -399,7 +399,7 @@ msgstr "" "月份標題的 CSS 類別(由 :meth:`formatmonthname` 所使用),預設值是 " "``\"month\"``。" -#: ../../library/calendar.rst:300 +#: ../../library/calendar.rst:305 msgid "" "The CSS class for the whole month's table (used by :meth:`formatmonth`). The " "default value is ``\"month\"``." @@ -407,14 +407,14 @@ msgstr "" "整個月份表格的 CSS 類別(由 :meth:`formatmonth` 所使用),預設值是 " "``\"month\"``。" -#: ../../library/calendar.rst:308 +#: ../../library/calendar.rst:313 msgid "" "The CSS class for the whole year's table of tables (used " "by :meth:`formatyear`). The default value is ``\"year\"``." msgstr "" "整年表格的 CSS 類別(由 :meth:`formatyear` 所使用),預設值是 ``\"year\"``。" -#: ../../library/calendar.rst:316 +#: ../../library/calendar.rst:321 msgid "" "The CSS class for the table head for the whole year (used " "by :meth:`formatyear`). The default value is ``\"year\"``." @@ -422,7 +422,7 @@ msgstr "" "整年表格標題的 CSS 類別(由 :meth:`formatyear` 所使用),預設值是 " "``\"year\"``。" -#: ../../library/calendar.rst:322 +#: ../../library/calendar.rst:327 msgid "" "Note that although the naming for the above described class attributes is " "singular (e.g. ``cssclass_month`` ``cssclass_noday``), one can replace the " @@ -432,15 +432,15 @@ msgstr "" "``cssclass_noday``),你可以使用多個以空格隔開的 CSS 類別取代單一 CSS 類別," "例如: ::" -#: ../../library/calendar.rst:326 +#: ../../library/calendar.rst:331 msgid "\"text-bold text-red\"" msgstr "\"text-bold text-red\"" -#: ../../library/calendar.rst:328 +#: ../../library/calendar.rst:333 msgid "Here is an example how :class:`!HTMLCalendar` can be customized::" msgstr "以下是客製化 :class:`!HTMLCalendar` 的範例: ::" -#: ../../library/calendar.rst:330 +#: ../../library/calendar.rst:335 msgid "" "class CustomHTMLCal(calendar.HTMLCalendar):\n" " cssclasses = [style + \" text-nowrap\" for style in\n" @@ -456,7 +456,7 @@ msgstr "" " cssclass_month = \"text-center month\"\n" " cssclass_year = \"text-italic lead\"" -#: ../../library/calendar.rst:340 +#: ../../library/calendar.rst:345 msgid "" "This subclass of :class:`TextCalendar` can be passed a locale name in the " "constructor and will return month and weekday names in the specified locale." @@ -464,7 +464,7 @@ msgstr "" ":class:`TextCalendar` 的子類別,可以在建構函式傳入語系名稱,它會回傳指定語系" "的月份及一週每一天的名稱。" -#: ../../library/calendar.rst:346 +#: ../../library/calendar.rst:351 msgid "" "This subclass of :class:`HTMLCalendar` can be passed a locale name in the " "constructor and will return month and weekday names in the specified locale." @@ -472,7 +472,7 @@ msgstr "" ":class:`HTMLCalendar` 的子類別,可以在建構函式傳入語系名稱,它會回傳指定語系" "的月份及一週每一天的名稱。" -#: ../../library/calendar.rst:352 +#: ../../library/calendar.rst:357 msgid "" "The constructor, :meth:`!formatweekday` and :meth:`!formatmonthname` methods " "of these two classes temporarily change the ``LC_TIME`` locale to the given " @@ -483,11 +483,11 @@ msgstr "" "會把 ``LC_TIME`` 語系暫時改成給定的 *locale*。因為目前的語系是屬於整個行程 " "(process-wide) 的設定,它們不是執行緒安全的。" -#: ../../library/calendar.rst:358 +#: ../../library/calendar.rst:363 msgid "For simple text calendars this module provides the following functions." msgstr "這個模組提供以下函式給單純的文字日曆使用。" -#: ../../library/calendar.rst:362 +#: ../../library/calendar.rst:367 msgid "" "Sets the weekday (``0`` is Monday, ``6`` is Sunday) to start each week. The " "values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:`THURSDAY`, :const:`FRIDAY`, :const:`SATURDAY`, " @@ -498,7 +498,7 @@ msgstr "" "供 :const:`MONDAY`、:const:`TUESDAY`、:const:`WEDNESDAY`、:const:`THURSDAY`、:const:`FRIDAY`、:const:`SATURDAY` " "及 :const:`SUNDAY` 可以方便設定。例如設定一週的第一天為週日: ::" -#: ../../library/calendar.rst:367 +#: ../../library/calendar.rst:372 msgid "" "import calendar\n" "calendar.setfirstweekday(calendar.SUNDAY)" @@ -506,27 +506,27 @@ msgstr "" "import calendar\n" "calendar.setfirstweekday(calendar.SUNDAY)" -#: ../../library/calendar.rst:373 +#: ../../library/calendar.rst:378 msgid "Returns the current setting for the weekday to start each week." msgstr "回傳目前設定的一週的第一天。" -#: ../../library/calendar.rst:378 +#: ../../library/calendar.rst:383 msgid "" "Returns :const:`True` if *year* is a leap year, otherwise :const:`False`." msgstr "如果 *year* 是閏年回傳 :const:`True`,否則回傳 :const:`False`。" -#: ../../library/calendar.rst:383 +#: ../../library/calendar.rst:388 msgid "" "Returns the number of leap years in the range from *y1* to *y2* (exclusive), " "where *y1* and *y2* are years." msgstr "" "回傳從 *y1* 到 *y2*\\ (不包含)間有幾個閏年,其中 *y1* 和 *y2* 是年份。" -#: ../../library/calendar.rst:386 +#: ../../library/calendar.rst:391 msgid "This function works for ranges spanning a century change." msgstr "這個函式也適用在跨越世紀的時間範圍。" -#: ../../library/calendar.rst:391 +#: ../../library/calendar.rst:396 msgid "" "Returns the day of the week (``0`` is Monday) for *year* (``1970``--...), " "*month* (``1``--``12``), *day* (``1``--``31``)." @@ -534,19 +534,19 @@ msgstr "" "回傳 *year* 年 (``1970``--...) *month* 月 (``1``--``12``) *day* 日 (``1``--" "``31``) 是週幾(``0`` 是星期一)。" -#: ../../library/calendar.rst:397 +#: ../../library/calendar.rst:402 msgid "" "Return a header containing abbreviated weekday names. *n* specifies the " "width in characters for one weekday." msgstr "回傳包含一週每一天的名稱縮寫的標題。*n* 指定每一天的字元寬度。" -#: ../../library/calendar.rst:403 +#: ../../library/calendar.rst:408 msgid "" "Returns weekday of first day of the month and number of days in month, for " "the specified *year* and *month*." msgstr "回傳指定 *year* 年 *month* 月該月第一天代表週幾的數字及該月有多少天。" -#: ../../library/calendar.rst:409 +#: ../../library/calendar.rst:414 msgid "" "Returns a matrix representing a month's calendar. Each row represents a " "week; days outside of the month are represented by zeros. Each week begins " @@ -555,11 +555,11 @@ msgstr "" "回傳代表一個月份日曆的矩陣。每一列為一週;該月以外的日期以 0 表示。每一週以週" "一開始,除非有使用 :func:`setfirstweekday` 改變設定。" -#: ../../library/calendar.rst:416 +#: ../../library/calendar.rst:421 msgid "Prints a month's calendar as returned by :func:`month`." msgstr "印出一個月份的日曆,跟 :func:`month` 回傳的內容一樣。" -#: ../../library/calendar.rst:421 +#: ../../library/calendar.rst:426 msgid "" "Returns a month's calendar in a multi-line string using " "the :meth:`~TextCalendar.formatmonth` of the :class:`TextCalendar` class." @@ -567,12 +567,12 @@ msgstr "" "以多行字串的形式回傳一個月的日曆,使用 :class:`TextCalendar` 類別" "的 :meth:`~TextCalendar.formatmonth`。" -#: ../../library/calendar.rst:427 +#: ../../library/calendar.rst:432 msgid "" "Prints the calendar for an entire year as returned by :func:`calendar`." msgstr "印出一整年的日曆,跟 :func:`calendar` 回傳的內容一樣。" -#: ../../library/calendar.rst:432 +#: ../../library/calendar.rst:437 msgid "" "Returns a 3-column calendar for an entire year as a multi-line string using " "the :meth:`~TextCalendar.formatyear` of the :class:`TextCalendar` class." @@ -580,7 +580,7 @@ msgstr "" "以多行字串回傳三欄形式的一整年日曆,使用 :class:`TextCalendar` 類別" "的 :meth:`~TextCalendar.formatyear`。" -#: ../../library/calendar.rst:438 +#: ../../library/calendar.rst:443 msgid "" "An unrelated but handy function that takes a time tuple such as returned by " "the :func:`~time.gmtime` function in the :mod:`time` module, and returns the " @@ -593,29 +593,29 @@ msgstr "" "1970 開始及 POSIX 編碼。事實上,:func:`time.gmtime` 和 :func:`timegm` 是彼此" "相反的。" -#: ../../library/calendar.rst:445 +#: ../../library/calendar.rst:450 msgid "The :mod:`calendar` module exports the following data attributes:" msgstr ":mod:`calendar` 模組匯出以下資料屬性:" -#: ../../library/calendar.rst:449 +#: ../../library/calendar.rst:454 msgid "" "A sequence that represents the days of the week in the current locale, where " "Monday is day number 0." msgstr "以目前語系來表示的一週每一天名稱的序列,其中週一是第 0 天。" -#: ../../library/calendar.rst:459 +#: ../../library/calendar.rst:464 msgid "" "A sequence that represents the abbreviated days of the week in the current " "locale, where Mon is day number 0." msgstr "以目前語系來表示的一週每一天縮寫名稱的序列,其中 Mon 是第 0 天。" -#: ../../library/calendar.rst:474 +#: ../../library/calendar.rst:479 msgid "" "Aliases for the days of the week, where ``MONDAY`` is ``0`` and ``SUNDAY`` " "is ``6``." msgstr "一週每一天的別名,其中 ``MONDAY`` 是 ``0`` 而 ``SUNDAY`` 是 ``6``。" -#: ../../library/calendar.rst:482 +#: ../../library/calendar.rst:487 msgid "" "Enumeration defining days of the week as integer constants. The members of " "this enumeration are exported to the module scope as :data:`MONDAY` " @@ -624,7 +624,7 @@ msgstr "" "將一週中的幾天定義為整數常數的列舉。此列舉的成員將作為 :data:`MONDAY` " "到 :data:`SUNDAY` 匯出到模組作用域。" -#: ../../library/calendar.rst:491 +#: ../../library/calendar.rst:496 msgid "" "A sequence that represents the months of the year in the current locale. " "This follows normal convention of January being month number 1, so it has a " @@ -633,7 +633,7 @@ msgstr "" "以目前語系來表示的一年每個月份名稱的序列。它按照一般慣例以數字 1 代表一月,因" "此它的長度為 13,而 ``month_name[0]`` 是空字串。" -#: ../../library/calendar.rst:502 +#: ../../library/calendar.rst:507 msgid "" "A sequence that represents the abbreviated months of the year in the current " "locale. This follows normal convention of January being month number 1, so " @@ -642,14 +642,14 @@ msgstr "" "以目前語系來表示的一年每個月份縮寫名稱的序列。它按照一般慣例以數字 1 代表一" "月,因此它的長度為 13,而 ``month_abbr[0]`` 是空字串。" -#: ../../library/calendar.rst:523 +#: ../../library/calendar.rst:528 msgid "" "Aliases for the months of the year, where ``JANUARY`` is ``1`` and " "``DECEMBER`` is ``12``." msgstr "" "一年內每個月的別名,其中 ``JANUARY`` 是 ``1`` 而 ``DECEMBER`` 是 ``12``。" -#: ../../library/calendar.rst:531 +#: ../../library/calendar.rst:536 msgid "" "Enumeration defining months of the year as integer constants. The members of " "this enumeration are exported to the module scope as :data:`JANUARY` " @@ -658,61 +658,62 @@ msgstr "" "將一年中的月份定義為整數常數的列舉。此列舉的成員將作為 :data:`JANUARY` " "到 :data:`DECEMBER` 匯出到模組作用域。" -#: ../../library/calendar.rst:538 +#: ../../library/calendar.rst:543 msgid "The :mod:`calendar` module defines the following exceptions:" msgstr ":mod:`calendar` 模組定義了以下例外:" -#: ../../library/calendar.rst:542 +#: ../../library/calendar.rst:547 msgid "" "A subclass of :exc:`ValueError`, raised when the given month number is " "outside of the range 1-12 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的月份數字超出 1-12 範圍(含)時引發。" -#: ../../library/calendar.rst:547 +#: ../../library/calendar.rst:552 msgid "The invalid month number." msgstr "無效的月份號。" -#: ../../library/calendar.rst:552 +#: ../../library/calendar.rst:557 msgid "" "A subclass of :exc:`ValueError`, raised when the given weekday number is " "outside of the range 0-6 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的週幾的數字超出 0-6(含)範圍時引發。" -#: ../../library/calendar.rst:557 +#: ../../library/calendar.rst:562 msgid "The invalid weekday number." msgstr "無效的週幾編號。" -#: ../../library/calendar.rst:562 +#: ../../library/calendar.rst:567 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/calendar.rst:563 +#: ../../library/calendar.rst:568 msgid "" "Object-oriented interface to dates and times with similar functionality to " "the :mod:`time` module." msgstr "日期與時間的物件導向介面,和 :mod:`time` 模組有相似的功能。" -#: ../../library/calendar.rst:566 +#: ../../library/calendar.rst:571 msgid "Module :mod:`time`" msgstr ":mod:`time` 模組" -#: ../../library/calendar.rst:567 +#: ../../library/calendar.rst:572 msgid "Low-level time related functions." msgstr "底層的時間相關函式。" -#: ../../library/calendar.rst:573 -msgid "Command-Line Usage" +#: ../../library/calendar.rst:578 +#, fuzzy +msgid "Command-line usage" msgstr "命令列用法" -#: ../../library/calendar.rst:577 +#: ../../library/calendar.rst:582 msgid "" "The :mod:`calendar` module can be executed as a script from the command line " "to interactively print a calendar." msgstr ":mod:`calendar` 模組可以作為腳本從命令列執行,並以互動方式列印日曆。" -#: ../../library/calendar.rst:580 +#: ../../library/calendar.rst:585 msgid "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" @@ -722,11 +723,11 @@ msgstr "" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" " [-f FIRST_WEEKDAY] [year] [month]" -#: ../../library/calendar.rst:587 +#: ../../library/calendar.rst:592 msgid "For example, to print a calendar for the year 2000:" msgstr "例如,要列印 2000 年的日曆:" -#: ../../library/calendar.rst:589 +#: ../../library/calendar.rst:594 msgid "" "$ python -m calendar 2000\n" " 2000\n" @@ -804,40 +805,40 @@ msgstr "" "23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31\n" "30 31" -#: ../../library/calendar.rst:630 +#: ../../library/calendar.rst:635 msgid "The following options are accepted:" msgstr "接受以下選項:" -#: ../../library/calendar.rst:637 +#: ../../library/calendar.rst:642 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/calendar.rst:642 +#: ../../library/calendar.rst:647 msgid "The locale to use for month and weekday names. Defaults to English." msgstr "用於月份和週幾名稱的語系。預設為英語。" -#: ../../library/calendar.rst:648 +#: ../../library/calendar.rst:653 msgid "" "The encoding to use for output. :option:`--encoding` is required " "if :option:`--locale` is set." msgstr "" "用於輸出的編碼。如有設定 :option:`--locale` 則必須給定 :option:`--encoding`。" -#: ../../library/calendar.rst:654 +#: ../../library/calendar.rst:659 msgid "Print the calendar to the terminal as text, or as an HTML document." msgstr "將日曆以文字或 HTML 文件的形式印出到終端機。" -#: ../../library/calendar.rst:660 +#: ../../library/calendar.rst:665 msgid "" "The weekday to start each week. Must be a number between 0 (Monday) and 6 " "(Sunday). Defaults to 0." msgstr "一週起始的日子。必須是 0(週一)到 6(週日)之間的數字。預設為 0。" -#: ../../library/calendar.rst:668 +#: ../../library/calendar.rst:673 msgid "The year to print the calendar for. Defaults to the current year." msgstr "印出日曆的年份。預設為目前年份。" -#: ../../library/calendar.rst:674 +#: ../../library/calendar.rst:679 msgid "" "The month of the specified :option:`year` to print the calendar for. Must be " "a number between 1 and 12, and may only be used in text mode. Defaults to " @@ -846,11 +847,11 @@ msgstr "" "要列印日曆的指定 :option:`year` 的月份。必須是 1 到 12 之間的數字,並且只能在" "文字模式下使用。預設列印全年日曆。" -#: ../../library/calendar.rst:680 +#: ../../library/calendar.rst:685 msgid "*Text-mode options:*" msgstr "*文字模式選項:*" -#: ../../library/calendar.rst:684 +#: ../../library/calendar.rst:689 msgid "" "The width of the date column in terminal columns. The date is printed " "centred in the column. Any value lower than 2 is ignored. Defaults to 2." @@ -858,7 +859,7 @@ msgstr "" "終端機行中日期行的寬度。日期印出在行的中央。任何小於 2 的值都會被忽略。預設" "為 2。" -#: ../../library/calendar.rst:692 +#: ../../library/calendar.rst:697 msgid "" "The number of lines for each week in terminal rows. The date is printed top-" "aligned. Any value lower than 1 is ignored. Defaults to 1." @@ -866,21 +867,27 @@ msgstr "" "終端機列中每週的列數。日期印出時頂部會對齊。任何小於 1 的值都會被忽略。預設" "為 1。" -#: ../../library/calendar.rst:700 +#: ../../library/calendar.rst:705 msgid "" "The space between months in columns. Any value lower than 2 is ignored. " "Defaults to 6." msgstr "行中月份之間的間距。任何小於 2 的值都會被忽略。預設為 6。" -#: ../../library/calendar.rst:707 +#: ../../library/calendar.rst:712 msgid "The number of months printed per row. Defaults to 3." msgstr "每列印出的月份數量。預設為 3。" -#: ../../library/calendar.rst:711 +#: ../../library/calendar.rst:715 +msgid "" +"By default, today's date is highlighted in color and can be :ref:`controlled " +"using environment variables `." +msgstr "" + +#: ../../library/calendar.rst:719 msgid "*HTML-mode options:*" msgstr "*HTML 模式選項:*" -#: ../../library/calendar.rst:715 +#: ../../library/calendar.rst:723 msgid "" "The path of a CSS stylesheet to use for the calendar. This must either be " "relative to the generated HTML, or an absolute HTTP or ``file:///`` URL." diff --git a/library/cmath.po b/library/cmath.po index 6d410bc6c96..a69b9e006c8 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-07 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-03-14 09:26+0800\n" "Last-Translator: Enkai Huang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -54,33 +54,37 @@ msgstr "" "的分枝切割,我們則查看實部的符號。" #: ../../library/cmath.rst:26 +#, fuzzy msgid "" "For example, the :func:`cmath.sqrt` function has a branch cut along the " -"negative real axis. An argument of ``complex(-2.0, -0.0)`` is treated as " -"though it lies *below* the branch cut, and so gives a result on the negative " -"imaginary axis::" +"negative real axis. An argument of ``-2-0j`` is treated as though it lies " +"*below* the branch cut, and so gives a result on the negative imaginary " +"axis::" msgstr "" "例如 :func:`cmath.sqrt` 函式具有一條沿負實軸的分枝切割。 引數 " "``complex(-2.0, -0.0)`` 被視為位於分枝切割 *下方* 處理,因此給出的結果在負虛" "軸上: ::" #: ../../library/cmath.rst:31 +#, fuzzy msgid "" -">>> cmath.sqrt(complex(-2.0, -0.0))\n" +">>> cmath.sqrt(-2-0j)\n" "-1.4142135623730951j" msgstr "" ">>> cmath.sqrt(complex(-2.0, -0.0))\n" "-1.4142135623730951j" #: ../../library/cmath.rst:34 +#, fuzzy msgid "" -"But an argument of ``complex(-2.0, 0.0)`` is treated as though it lies above " -"the branch cut::" +"But an argument of ``-2+0j`` is treated as though it lies above the branch " +"cut::" msgstr "但是引數 ``complex(-2.0, 0.0)`` 會被當成位於分枝切割上方處理: ::" #: ../../library/cmath.rst:37 +#, fuzzy msgid "" -">>> cmath.sqrt(complex(-2.0, 0.0))\n" +">>> cmath.sqrt(-2+0j)\n" "1.4142135623730951j" msgstr "" ">>> cmath.sqrt(complex(-2.0, 0.0))\n" @@ -396,10 +400,11 @@ msgstr "" "``z.imag`` 為零: ::" #: ../../library/cmath.rst:117 +#, fuzzy msgid "" -">>> phase(complex(-1.0, 0.0))\n" +">>> phase(-1+0j)\n" "3.141592653589793\n" -">>> phase(complex(-1.0, -0.0))\n" +">>> phase(-1-0j)\n" "-3.141592653589793" msgstr "" ">>> phase(complex(-1.0, 0.0))\n" diff --git a/library/cmdline.po b/library/cmdline.po index aea947803ea..2c1ac869394 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-04 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-10-14 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -17,218 +17,226 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../../library/cmdline.rst:3 +#: ../../library/cmdline.rst:5 msgid "Modules command-line interface (CLI)" msgstr "模組命令列介面" -#: ../../library/cmdline.rst:5 +#: ../../library/cmdline.rst:7 msgid "The following modules have a command-line interface." msgstr "以下模組具有命令列介面。" -#: ../../library/cmdline.rst:7 +#: ../../library/cmdline.rst:9 msgid ":ref:`ast `" msgstr ":ref:`ast `" -#: ../../library/cmdline.rst:8 +#: ../../library/cmdline.rst:10 msgid ":ref:`asyncio `" msgstr ":ref:`asyncio `" -#: ../../library/cmdline.rst:9 +#: ../../library/cmdline.rst:11 msgid ":mod:`base64`" msgstr ":mod:`base64`" -#: ../../library/cmdline.rst:10 +#: ../../library/cmdline.rst:12 msgid ":ref:`calendar `" msgstr ":ref:`calendar `" -#: ../../library/cmdline.rst:11 +#: ../../library/cmdline.rst:13 msgid ":mod:`code`" msgstr ":mod:`code`" -#: ../../library/cmdline.rst:12 +#: ../../library/cmdline.rst:14 msgid ":ref:`compileall `" msgstr ":ref:`compileall `" -#: ../../library/cmdline.rst:13 +#: ../../library/cmdline.rst:15 msgid ":mod:`cProfile`: see :ref:`profile `" msgstr ":mod:`cProfile`: 請見 :ref:`profile `" -#: ../../library/cmdline.rst:14 -msgid ":ref:`difflib `" -msgstr ":ref:`difflib `" - -#: ../../library/cmdline.rst:15 +#: ../../library/cmdline.rst:16 msgid ":ref:`dis `" msgstr ":ref:`dis `" -#: ../../library/cmdline.rst:16 +#: ../../library/cmdline.rst:17 msgid ":ref:`doctest `" msgstr ":ref:`doctest `" -#: ../../library/cmdline.rst:17 +#: ../../library/cmdline.rst:18 msgid ":mod:`!encodings.rot_13`" msgstr ":mod:`!encodings.rot_13`" -#: ../../library/cmdline.rst:18 +#: ../../library/cmdline.rst:19 msgid ":mod:`ensurepip`" msgstr ":mod:`ensurepip`" -#: ../../library/cmdline.rst:19 +#: ../../library/cmdline.rst:20 msgid ":mod:`filecmp`" msgstr ":mod:`filecmp`" -#: ../../library/cmdline.rst:20 +#: ../../library/cmdline.rst:21 msgid ":mod:`fileinput`" msgstr ":mod:`fileinput`" -#: ../../library/cmdline.rst:21 +#: ../../library/cmdline.rst:22 msgid ":mod:`ftplib`" msgstr ":mod:`ftplib`" -#: ../../library/cmdline.rst:22 +#: ../../library/cmdline.rst:23 msgid ":ref:`gzip `" msgstr ":ref:`gzip `" -#: ../../library/cmdline.rst:23 +#: ../../library/cmdline.rst:24 msgid ":ref:`http.server `" msgstr ":ref:`http.server `" -#: ../../library/cmdline.rst:24 +#: ../../library/cmdline.rst:25 msgid ":mod:`!idlelib`" msgstr ":mod:`!idlelib`" -#: ../../library/cmdline.rst:25 +#: ../../library/cmdline.rst:26 msgid ":ref:`inspect `" msgstr ":ref:`inspect `" -#: ../../library/cmdline.rst:26 -msgid ":ref:`json.tool `" -msgstr ":ref:`json.tool `" - #: ../../library/cmdline.rst:27 -msgid ":mod:`mimetypes`" -msgstr ":mod:`mimetypes`" +#, fuzzy +msgid ":ref:`json `" +msgstr ":ref:`json.tool `" #: ../../library/cmdline.rst:28 -msgid ":mod:`pdb`" -msgstr ":mod:`pdb`" +#, fuzzy +msgid ":ref:`mimetypes `" +msgstr ":ref:`dis `" #: ../../library/cmdline.rst:29 -msgid ":mod:`pickle`" -msgstr ":mod:`pickle`" +msgid ":mod:`pdb`" +msgstr ":mod:`pdb`" #: ../../library/cmdline.rst:30 -msgid ":ref:`pickletools `" +#, fuzzy +msgid ":ref:`pickle `" msgstr ":ref:`pickletools `" #: ../../library/cmdline.rst:31 +msgid ":ref:`pickletools `" +msgstr ":ref:`pickletools `" + +#: ../../library/cmdline.rst:32 msgid ":ref:`platform `" msgstr ":ref:`platform `" -#: ../../library/cmdline.rst:32 +#: ../../library/cmdline.rst:33 msgid ":mod:`poplib`" msgstr ":mod:`poplib`" -#: ../../library/cmdline.rst:33 +#: ../../library/cmdline.rst:34 msgid ":ref:`profile `" msgstr ":ref:`profile `" -#: ../../library/cmdline.rst:34 +#: ../../library/cmdline.rst:35 msgid ":mod:`pstats`" msgstr ":mod:`pstats`" -#: ../../library/cmdline.rst:35 +#: ../../library/cmdline.rst:36 msgid ":ref:`py_compile `" msgstr ":ref:`py_compile `" -#: ../../library/cmdline.rst:36 +#: ../../library/cmdline.rst:37 msgid ":mod:`pyclbr`" msgstr ":mod:`pyclbr`" -#: ../../library/cmdline.rst:37 +#: ../../library/cmdline.rst:38 msgid ":mod:`pydoc`" msgstr ":mod:`pydoc`" -#: ../../library/cmdline.rst:38 +#: ../../library/cmdline.rst:39 msgid ":mod:`quopri`" msgstr ":mod:`quopri`" -#: ../../library/cmdline.rst:39 +#: ../../library/cmdline.rst:40 msgid ":ref:`random `" msgstr ":ref:`random `" -#: ../../library/cmdline.rst:40 +#: ../../library/cmdline.rst:41 msgid ":mod:`runpy`" msgstr ":mod:`runpy`" -#: ../../library/cmdline.rst:41 +#: ../../library/cmdline.rst:42 msgid ":ref:`site `" msgstr ":ref:`site `" -#: ../../library/cmdline.rst:42 +#: ../../library/cmdline.rst:43 msgid ":ref:`sqlite3 `" msgstr ":ref:`sqlite3 `" -#: ../../library/cmdline.rst:43 +#: ../../library/cmdline.rst:44 msgid ":ref:`symtable `" msgstr ":ref:`symtable `" -#: ../../library/cmdline.rst:44 +#: ../../library/cmdline.rst:45 msgid ":ref:`sysconfig `" msgstr ":ref:`sysconfig `" -#: ../../library/cmdline.rst:45 +#: ../../library/cmdline.rst:46 msgid ":mod:`tabnanny`" msgstr ":mod:`tabnanny`" -#: ../../library/cmdline.rst:46 +#: ../../library/cmdline.rst:47 msgid ":ref:`tarfile `" msgstr ":ref:`tarfile `" -#: ../../library/cmdline.rst:47 +#: ../../library/cmdline.rst:48 msgid ":mod:`!this`" msgstr ":mod:`!this`" -#: ../../library/cmdline.rst:48 +#: ../../library/cmdline.rst:49 msgid ":ref:`timeit `" msgstr ":ref:`timeit `" -#: ../../library/cmdline.rst:49 +#: ../../library/cmdline.rst:50 msgid ":ref:`tokenize `" msgstr ":ref:`tokenize `" -#: ../../library/cmdline.rst:50 +#: ../../library/cmdline.rst:51 msgid ":ref:`trace `" msgstr ":ref:`trace `" -#: ../../library/cmdline.rst:51 +#: ../../library/cmdline.rst:52 msgid ":mod:`turtledemo`" msgstr ":mod:`turtledemo`" -#: ../../library/cmdline.rst:52 +#: ../../library/cmdline.rst:53 msgid ":ref:`unittest `" msgstr ":ref:`unittest `" -#: ../../library/cmdline.rst:53 +#: ../../library/cmdline.rst:54 msgid ":ref:`uuid `" msgstr ":ref:`uuid `" -#: ../../library/cmdline.rst:54 +#: ../../library/cmdline.rst:55 msgid ":mod:`venv`" msgstr ":mod:`venv`" -#: ../../library/cmdline.rst:55 +#: ../../library/cmdline.rst:56 msgid ":mod:`webbrowser`" msgstr ":mod:`webbrowser`" -#: ../../library/cmdline.rst:56 +#: ../../library/cmdline.rst:57 msgid ":ref:`zipapp `" msgstr ":ref:`zipapp `" -#: ../../library/cmdline.rst:57 +#: ../../library/cmdline.rst:58 msgid ":ref:`zipfile `" msgstr ":ref:`zipfile `" -#: ../../library/cmdline.rst:59 +#: ../../library/cmdline.rst:60 msgid "See also the :ref:`Python command-line interface `." msgstr "另請見 :ref:`Python 命令列介面 `。" + +#~ msgid ":ref:`difflib `" +#~ msgstr ":ref:`difflib `" + +#~ msgid ":mod:`mimetypes`" +#~ msgstr ":mod:`mimetypes`" + +#~ msgid ":mod:`pickle`" +#~ msgstr ":mod:`pickle`" diff --git a/library/code.po b/library/code.po index 108750d7908..ee8ae46c299 100644 --- a/library/code.po +++ b/library/code.po @@ -7,7 +7,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-09-08 15:25+0800\n" "PO-Revision-Date: 2025-07-13 14:40+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,8 +32,8 @@ msgid "" "in Python. Two classes and convenience functions are included which can be " "used to build applications which provide an interactive interpreter prompt." msgstr "" -"``code`` 模組提供在 Python 中實作讀取-求值-印出迴圈(read-eval-print loops)的" -"設施。包含兩個類別和便利函式,可用於建立提供互動式直譯器提示的應用程式。" +"``code`` 模組提供在 Python 中實作讀取-求值-印出迴圈(read-eval-print loops)" +"的設施。包含兩個類別和便利函式,可用於建立提供互動式直譯器提示的應用程式。" #: ../../library/code.rst:18 msgid "" @@ -65,8 +65,8 @@ msgid "" "Closely emulate the behavior of the interactive Python interpreter. This " "class builds on :class:`InteractiveInterpreter` and adds prompting using the " "familiar ``sys.ps1`` and ``sys.ps2``, and input buffering. If *local_exit* " -"is true, ``exit()`` and ``quit()`` in the console will not raise :exc:" -"`SystemExit`, but instead return to the calling code." +"is true, ``exit()`` and ``quit()`` in the console will not " +"raise :exc:`SystemExit`, but instead return to the calling code." msgstr "" "近似地模擬出互動式 Python 直譯器的行為。這個類別建立" "在 :class:`InteractiveInterpreter` 的基礎上,並加入使用熟悉的 ``sys.ps1`` 和 " @@ -84,9 +84,9 @@ msgid "" "the :meth:`InteractiveConsole.raw_input` method, if provided. If *local* is " "provided, it is passed to the :class:`InteractiveConsole` constructor for " "use as the default namespace for the interpreter loop. If *local_exit* is " -"provided, it is passed to the :class:`InteractiveConsole` constructor. The :" -"meth:`~InteractiveConsole.interact` method of the instance is then run with " -"*banner* and *exitmsg* passed as the banner and exit message to use, if " +"provided, it is passed to the :class:`InteractiveConsole` constructor. " +"The :meth:`~InteractiveConsole.interact` method of the instance is then run " +"with *banner* and *exitmsg* passed as the banner and exit message to use, if " "provided. The console object is discarded after use." msgstr "" "執行 read-eval-print 迴圈的便利函式。這會建立一" @@ -102,7 +102,7 @@ msgstr "" msgid "Added *exitmsg* parameter." msgstr "新增 *exitmsg* 參數。" -#: ../../library/code.rst:57 +#: ../../library/code.rst:63 msgid "" "This function is useful for programs that want to emulate Python's " "interpreter main loop (a.k.a. the read-eval-print loop). The tricky part is " @@ -156,10 +156,10 @@ msgstr "" #: ../../library/code.rst:94 msgid "" -"The input is incorrect; :func:`compile_command` raised an exception (:exc:" -"`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be printed " -"by calling the :meth:`showsyntaxerror` method. :meth:`runsource` returns " -"``False``." +"The input is incorrect; :func:`compile_command` raised an exception " +"(:exc:`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be " +"printed by calling the :meth:`showsyntaxerror` method. :meth:`runsource` " +"returns ``False``." msgstr "" "輸入不正確;:func:`compile_command` 會引發例外(:exc:`SyntaxError` " "或 :exc:`OverflowError`)。語法回溯 (syntax traceback) 會透過呼" @@ -184,23 +184,17 @@ msgstr "" "叫 :meth:`runcode` 執行(它也會處理執行時的例外,除 :exc:`SystemExit` 以" "外)。:meth:`runsource` 會回傳 ``False``。" -#: ../../library/code.rst:100 +#: ../../library/code.rst:106 msgid "" "The return value can be used to decide whether to use ``sys.ps1`` or " "``sys.ps2`` to prompt the next line." msgstr "回傳值可用來決定是使用 ``sys.ps1`` 還是 ``sys.ps2`` 以提示下一列。" -#: ../../library/code.rst:106 -msgid "" -"The return value can be used to decide whether to use ``sys.ps1`` or ``sys." -"ps2`` to prompt the next line." -msgstr "回傳值可用來決定是使用 ``sys.ps1`` 還是 ``sys.ps2`` 以提示下一列。" - #: ../../library/code.rst:112 msgid "" "Execute a code object. When an exception occurs, :meth:`showtraceback` is " -"called to display a traceback. All exceptions are caught except :exc:" -"`SystemExit`, which is allowed to propagate." +"called to display a traceback. All exceptions are caught " +"except :exc:`SystemExit`, which is allowed to propagate." msgstr "" "執行程式碼物件。當例外發生時,會呼叫 :meth:`showtraceback` 來顯示回溯。除" "了 :exc:`SystemExit` 允許繼續傳播之外,所有的例外都會被捕獲。" @@ -214,7 +208,7 @@ msgstr "" "關於 :exc:`KeyboardInterrupt` 的注意事項:此例外可能發生在此程式碼的其他地" "方,而且不一定會被捕獲到。呼叫者應該準備好處理它。" -#: ../../library/code.rst:117 +#: ../../library/code.rst:123 msgid "" "Display the syntax error that just occurred. This does not display a stack " "trace because there isn't one for syntax errors. If *filename* is given, it " @@ -222,11 +216,12 @@ msgid "" "Python's parser, because it always uses ``''`` when reading from a " "string. The output is written by the :meth:`write` method." msgstr "" -"顯示剛剛發生的語法錯誤。這不會顯示堆疊追蹤 (stack trace),因為語法錯誤沒有堆疊追蹤。" -"如果給出 *filename*,它會被塞入例外,而不是 Python 剖析器提供的預設檔案名稱,因為它" -"從字串讀取時總是使用 ``''``。輸出會由 :meth:`write` 方法寫入。" +"顯示剛剛發生的語法錯誤。這不會顯示堆疊追蹤 (stack trace),因為語法錯誤沒有堆" +"疊追蹤。如果給出 *filename*,它會被塞入例外,而不是 Python 剖析器提供的預設檔" +"案名稱,因為它從字串讀取時總是使用 ``''``。輸出會由 :meth:`write` 方" +"法寫入。" -#: ../../library/code.rst:126 +#: ../../library/code.rst:132 msgid "" "Display the exception that just occurred. We remove the first stack item " "because it is within the interpreter object implementation. The output is " @@ -235,7 +230,7 @@ msgstr "" "顯示剛剛發生的例外。我們移除第一個堆疊項目,因為它在直譯器物件的實作範圍內。" "輸出由 :meth:`write` 方法寫入。" -#: ../../library/code.rst:130 +#: ../../library/code.rst:136 msgid "" "The full chained traceback is displayed instead of just the primary " "traceback." @@ -254,16 +249,16 @@ msgstr "" msgid "Interactive Console Objects" msgstr "互動式控制台物件" -#: ../../library/code.rst:145 +#: ../../library/code.rst:151 msgid "" -"The :class:`InteractiveConsole` class is a subclass of :class:" -"`InteractiveInterpreter`, and so offers all the methods of the interpreter " -"objects as well as the following additions." +"The :class:`InteractiveConsole` class is a subclass " +"of :class:`InteractiveInterpreter`, and so offers all the methods of the " +"interpreter objects as well as the following additions." msgstr "" ":class:`InteractiveConsole` 類別是 :class:`InteractiveInterpreter` 的子類別," "因此提供了所有直譯器物件的方法以及下列新增的功能。" -#: ../../library/code.rst:152 +#: ../../library/code.rst:158 msgid "" "Closely emulate the interactive Python console. The optional *banner* " "argument specify the banner to print before the first interaction; by " @@ -273,10 +268,10 @@ msgid "" "close!)." msgstr "" "近似地模擬互動式 Python 控制台。可選的 *banner* 引數指定在第一次互動之前要印" -"出的横幅;預設會印出類似標準 Python 直譯器所列印的横幅,接著是控制台物" -"件在括弧中的類別名稱 (以免與真正的直譯器混淆 -- 因為它是如此接近!)。" +"出的横幅;預設會印出類似標準 Python 直譯器所列印的横幅,接著是控制台物件在括" +"弧中的類別名稱 (以免與真正的直譯器混淆 -- 因為它是如此接近!)。" -#: ../../library/code.rst:158 +#: ../../library/code.rst:164 msgid "" "The optional *exitmsg* argument specifies an exit message printed when " "exiting. Pass the empty string to suppress the exit message. If *exitmsg* is " @@ -293,7 +288,7 @@ msgstr "若要抑制印出任何橫幅,請傳入空字串。" msgid "Print an exit message when exiting." msgstr "退出時印出退出訊息。" -#: ../../library/code.rst:171 +#: ../../library/code.rst:177 msgid "" "Push a line of source text to the interpreter. The line should not have a " "trailing newline; it may have internal newlines. The line is appended to a " @@ -305,24 +300,25 @@ msgid "" "is required, ``False`` if the line was dealt with in some way (this is the " "same as :meth:`!runsource`)." msgstr "" -"推送一行原始文字到直譯器。這一行不應該有尾部換行符號;它可能有內部換行符號。這行文字" -"會被附加到緩衝區,並且直譯器的 :meth:`~InteractiveInterpreter.runsource` 方法" -"會被呼叫,並以緩衝區的串接內容做為原始碼。如果這表示命令已執行或無效,緩衝區" -"會被重設;否則,命令會不完整,且緩衝區會保持該行被附加後的樣子。如果需要更多的輸" -"入,回傳值是 ``True``,如果該行已經以某種方式處理,回傳值是 ``False``\\ (這" -"與 :meth:`!runsource` 相同)。" - -#: ../../library/code.rst:183 +"推送一行原始文字到直譯器。這一行不應該有尾部換行符號;它可能有內部換行符號。" +"這行文字會被附加到緩衝區,並且直譯器" +"的 :meth:`~InteractiveInterpreter.runsource` 方法會被呼叫,並以緩衝區的串接內" +"容做為原始碼。如果這表示命令已執行或無效,緩衝區會被重設;否則,命令會不完" +"整,且緩衝區會保持該行被附加後的樣子。如果需要更多的輸入,回傳值是 ``True``," +"如果該行已經以某種方式處理,回傳值是 ``False``\\ (這與 :meth:`!runsource` 相" +"同)。" + +#: ../../library/code.rst:189 msgid "Remove any unhandled source text from the input buffer." msgstr "從輸入緩衝區移除任何未處理的原始文字。" -#: ../../library/code.rst:188 +#: ../../library/code.rst:194 msgid "" "Write a prompt and read a line. The returned line does not include the " -"trailing newline. When the user enters the EOF key sequence, :exc:" -"`EOFError` is raised. The base implementation reads from ``sys.stdin``; a " -"subclass may replace this with a different implementation." +"trailing newline. When the user enters the EOF key " +"sequence, :exc:`EOFError` is raised. The base implementation reads from " +"``sys.stdin``; a subclass may replace this with a different implementation." msgstr "" -"寫入一個提示並讀取一行。回傳的行不包括尾部的換行符號。當使用者輸入 EOF 鍵序時," -"會引發 :exc:`EOFError`。基底實作會從 ``sys.stdin`` 讀取;子類別可以用不同的實作" -"替代。" +"寫入一個提示並讀取一行。回傳的行不包括尾部的換行符號。當使用者輸入 EOF 鍵序" +"時,會引發 :exc:`EOFError`。基底實作會從 ``sys.stdin`` 讀取;子類別可以用不同" +"的實作替代。" diff --git a/library/codecs.po b/library/codecs.po index 0316e8e6121..507140edae6 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-06 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,9 +51,9 @@ msgstr "" #: ../../library/codecs.rst:40 msgid "" "*Errors* may be given to set the desired error handling scheme. The default " -"error handler is ``'strict'`` meaning that encoding errors raise :exc:" -"`ValueError` (or a more codec specific subclass, such as :exc:" -"`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more " +"error handler is ``'strict'`` meaning that encoding errors " +"raise :exc:`ValueError` (or a more codec specific subclass, such " +"as :exc:`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more " "information on codec error handling." msgstr "" @@ -64,9 +64,9 @@ msgstr "" #: ../../library/codecs.rst:50 msgid "" "*Errors* may be given to set the desired error handling scheme. The default " -"error handler is ``'strict'`` meaning that decoding errors raise :exc:" -"`ValueError` (or a more codec specific subclass, such as :exc:" -"`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more " +"error handler is ``'strict'`` meaning that decoding errors " +"raise :exc:`ValueError` (or a more codec specific subclass, such " +"as :exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more " "information on codec error handling." msgstr "" @@ -85,16 +85,17 @@ msgstr "" #: ../../library/codecs.rst:68 msgid "" -"Looks up the codec info in the Python codec registry and returns a :class:" -"`CodecInfo` object as defined below." +"Looks up the codec info in the Python codec registry and returns " +"a :class:`CodecInfo` object as defined below." msgstr "" #: ../../library/codecs.rst:71 msgid "" "Encodings are first looked up in the registry's cache. If not found, the " "list of registered search functions is scanned. If no :class:`CodecInfo` " -"object is found, a :exc:`LookupError` is raised. Otherwise, the :class:" -"`CodecInfo` object is stored in the cache and returned to the caller." +"object is found, a :exc:`LookupError` is raised. Otherwise, " +"the :class:`CodecInfo` object is stored in the cache and returned to the " +"caller." msgstr "" #: ../../library/codecs.rst:78 @@ -110,25 +111,25 @@ msgstr "編碼的名稱。" #: ../../library/codecs.rst:90 msgid "" "The stateless encoding and decoding functions. These must be functions or " -"methods which have the same interface as the :meth:`~Codec.encode` and :meth:" -"`~Codec.decode` methods of Codec instances (see :ref:`Codec Interface `). The functions or methods are expected to work in a stateless " -"mode." +"methods which have the same interface as the :meth:`~Codec.encode` " +"and :meth:`~Codec.decode` methods of Codec instances (see :ref:`Codec " +"Interface `). The functions or methods are expected to work " +"in a stateless mode." msgstr "" #: ../../library/codecs.rst:100 msgid "" "Incremental encoder and decoder classes or factory functions. These have to " -"provide the interface defined by the base classes :class:" -"`IncrementalEncoder` and :class:`IncrementalDecoder`, respectively. " -"Incremental codecs can maintain state." +"provide the interface defined by the base " +"classes :class:`IncrementalEncoder` and :class:`IncrementalDecoder`, " +"respectively. Incremental codecs can maintain state." msgstr "" #: ../../library/codecs.rst:109 msgid "" "Stream writer and reader classes or factory functions. These have to provide " -"the interface defined by the base classes :class:`StreamWriter` and :class:" -"`StreamReader`, respectively. Stream codecs can maintain state." +"the interface defined by the base classes :class:`StreamWriter` " +"and :class:`StreamReader`, respectively. Stream codecs can maintain state." msgstr "" #: ../../library/codecs.rst:114 @@ -178,14 +179,14 @@ msgstr "" #: ../../library/codecs.rst:151 msgid "" -"Look up the codec for the given encoding and return its :class:" -"`StreamReader` class or factory function." +"Look up the codec for the given encoding and return " +"its :class:`StreamReader` class or factory function." msgstr "" #: ../../library/codecs.rst:159 msgid "" -"Look up the codec for the given encoding and return its :class:" -"`StreamWriter` class or factory function." +"Look up the codec for the given encoding and return " +"its :class:`StreamWriter` class or factory function." msgstr "" #: ../../library/codecs.rst:164 @@ -223,9 +224,9 @@ msgstr "" #: ../../library/codecs.rst:194 msgid "" -"Open an encoded file using the given *mode* and return an instance of :class:" -"`StreamReaderWriter`, providing transparent encoding/decoding. The default " -"file mode is ``'r'``, meaning to open the file in read mode." +"Open an encoded file using the given *mode* and return an instance " +"of :class:`StreamReaderWriter`, providing transparent encoding/decoding. The " +"default file mode is ``'r'``, meaning to open the file in read mode." msgstr "" #: ../../library/codecs.rst:200 @@ -260,14 +261,18 @@ msgstr "" msgid "The ``'U'`` mode has been removed." msgstr "已移除 ``'U'`` 模式。" -#: ../../library/codecs.rst:222 +#: ../../library/codecs.rst:221 +msgid ":func:`codecs.open` has been superseded by :func:`open`." +msgstr "" + +#: ../../library/codecs.rst:226 msgid "" "Return a :class:`StreamRecoder` instance, a wrapped version of *file* which " "provides transparent transcoding. The original file is closed when the " "wrapped version is closed." msgstr "" -#: ../../library/codecs.rst:226 +#: ../../library/codecs.rst:230 msgid "" "Data written to the wrapped file is decoded according to the given " "*data_encoding* and then written to the original file as bytes using " @@ -275,33 +280,33 @@ msgid "" "*file_encoding*, and the result is encoded using *data_encoding*." msgstr "" -#: ../../library/codecs.rst:232 +#: ../../library/codecs.rst:236 msgid "If *file_encoding* is not given, it defaults to *data_encoding*." msgstr "" -#: ../../library/codecs.rst:234 +#: ../../library/codecs.rst:238 msgid "" "*errors* may be given to define the error handling. It defaults to " "``'strict'``, which causes :exc:`ValueError` to be raised in case an " "encoding error occurs." msgstr "" -#: ../../library/codecs.rst:241 +#: ../../library/codecs.rst:245 msgid "" "Uses an incremental encoder to iteratively encode the input provided by " -"*iterator*. *iterator* must yield :class:`str` objects. This function is a :" -"term:`generator`. The *errors* argument (as well as any other keyword " +"*iterator*. *iterator* must yield :class:`str` objects. This function is " +"a :term:`generator`. The *errors* argument (as well as any other keyword " "argument) is passed through to the incremental encoder." msgstr "" -#: ../../library/codecs.rst:246 +#: ../../library/codecs.rst:250 msgid "" "This function requires that the codec accept text :class:`str` objects to " "encode. Therefore it does not support bytes-to-bytes encoders such as " "``base64_codec``." msgstr "" -#: ../../library/codecs.rst:253 +#: ../../library/codecs.rst:257 msgid "" "Uses an incremental decoder to iteratively decode the input provided by " "*iterator*. *iterator* must yield :class:`bytes` objects. This function is " @@ -309,26 +314,26 @@ msgid "" "argument) is passed through to the incremental decoder." msgstr "" -#: ../../library/codecs.rst:258 +#: ../../library/codecs.rst:262 msgid "" "This function requires that the codec accept :class:`bytes` objects to " "decode. Therefore it does not support text-to-text encoders such as " -"``rot_13``, although ``rot_13`` may be used equivalently with :func:" -"`iterencode`." +"``rot_13``, although ``rot_13`` may be used equivalently " +"with :func:`iterencode`." msgstr "" -#: ../../library/codecs.rst:266 +#: ../../library/codecs.rst:270 msgid "" "Return a :class:`tuple` containing the raw bytes of *buffer*, a :ref:`buffer-" "compatible object ` or :class:`str` (encoded to UTF-8 before " "processing), and their length in bytes." msgstr "" -#: ../../library/codecs.rst:270 +#: ../../library/codecs.rst:274 msgid "The *errors* argument is ignored." msgstr "忽略 *errors* 引數。" -#: ../../library/codecs.rst:272 +#: ../../library/codecs.rst:276 msgid "" ">>> codecs.readbuffer_encode(b\"Zito\")\n" "(b'Zito', 4)" @@ -336,36 +341,36 @@ msgstr "" ">>> codecs.readbuffer_encode(b\"Zito\")\n" "(b'Zito', 4)" -#: ../../library/codecs.rst:278 +#: ../../library/codecs.rst:282 msgid "" "The module also provides the following constants which are useful for " "reading and writing to platform dependent files:" msgstr "" -#: ../../library/codecs.rst:293 +#: ../../library/codecs.rst:297 msgid "" "These constants define various byte sequences, being Unicode byte order " "marks (BOMs) for several encodings. They are used in UTF-16 and UTF-32 data " "streams to indicate the byte order used, and in UTF-8 as a Unicode " -"signature. :const:`BOM_UTF16` is either :const:`BOM_UTF16_BE` or :const:" -"`BOM_UTF16_LE` depending on the platform's native byte order, :const:`BOM` " -"is an alias for :const:`BOM_UTF16`, :const:`BOM_LE` for :const:" -"`BOM_UTF16_LE` and :const:`BOM_BE` for :const:`BOM_UTF16_BE`. The others " -"represent the BOM in UTF-8 and UTF-32 encodings." +"signature. :const:`BOM_UTF16` is either :const:`BOM_UTF16_BE` " +"or :const:`BOM_UTF16_LE` depending on the platform's native byte " +"order, :const:`BOM` is an alias for :const:`BOM_UTF16`, :const:`BOM_LE` " +"for :const:`BOM_UTF16_LE` and :const:`BOM_BE` for :const:`BOM_UTF16_BE`. The " +"others represent the BOM in UTF-8 and UTF-32 encodings." msgstr "" -#: ../../library/codecs.rst:307 +#: ../../library/codecs.rst:311 msgid "Codec Base Classes" msgstr "" -#: ../../library/codecs.rst:309 +#: ../../library/codecs.rst:313 msgid "" "The :mod:`codecs` module defines a set of base classes which define the " "interfaces for working with codec objects, and can also be used as the basis " "for custom codec implementations." msgstr "" -#: ../../library/codecs.rst:313 +#: ../../library/codecs.rst:317 msgid "" "Each codec has to define four interfaces to make it usable as codec in " "Python: stateless encoder, stateless decoder, stream reader and stream " @@ -374,81 +379,82 @@ msgid "" "how the codec will handle encoding and decoding errors." msgstr "" -#: ../../library/codecs.rst:324 +#: ../../library/codecs.rst:328 msgid "Error Handlers" msgstr "" -#: ../../library/codecs.rst:326 +#: ../../library/codecs.rst:330 msgid "" "To simplify and standardize error handling, codecs may implement different " "error handling schemes by accepting the *errors* string argument:" msgstr "" -#: ../../library/codecs.rst:346 +#: ../../library/codecs.rst:350 msgid "" "The following error handlers can be used with all Python :ref:`standard-" "encodings` codecs:" msgstr "" -#: ../../library/codecs.rst:352 ../../library/codecs.rst:395 -#: ../../library/codecs.rst:415 +#: ../../library/codecs.rst:356 ../../library/codecs.rst:399 +#: ../../library/codecs.rst:419 msgid "Value" msgstr "" -#: ../../library/codecs.rst:352 ../../library/codecs.rst:395 -#: ../../library/codecs.rst:415 ../../library/codecs.rst:1360 -#: ../../library/codecs.rst:1432 ../../library/codecs.rst:1517 +#: ../../library/codecs.rst:356 ../../library/codecs.rst:399 +#: ../../library/codecs.rst:419 ../../library/codecs.rst:1371 +#: ../../library/codecs.rst:1443 ../../library/codecs.rst:1498 msgid "Meaning" msgstr "含義" -#: ../../library/codecs.rst:354 +#: ../../library/codecs.rst:358 msgid "``'strict'``" msgstr "``'strict'``" -#: ../../library/codecs.rst:354 +#: ../../library/codecs.rst:358 msgid "" "Raise :exc:`UnicodeError` (or a subclass), this is the default. Implemented " "in :func:`strict_errors`." msgstr "" -#: ../../library/codecs.rst:358 +#: ../../library/codecs.rst:362 msgid "``'ignore'``" msgstr "``'ignore'``" -#: ../../library/codecs.rst:358 +#: ../../library/codecs.rst:362 msgid "" "Ignore the malformed data and continue without further notice. Implemented " "in :func:`ignore_errors`." msgstr "" -#: ../../library/codecs.rst:362 +#: ../../library/codecs.rst:366 msgid "``'replace'``" msgstr "``'replace'``" -#: ../../library/codecs.rst:362 +#: ../../library/codecs.rst:366 msgid "" "Replace with a replacement marker. On encoding, use ``?`` (ASCII character). " "On decoding, use ``�`` (U+FFFD, the official REPLACEMENT CHARACTER). " "Implemented in :func:`replace_errors`." msgstr "" -#: ../../library/codecs.rst:368 +#: ../../library/codecs.rst:372 msgid "``'backslashreplace'``" msgstr "``'backslashreplace'``" -#: ../../library/codecs.rst:368 +#: ../../library/codecs.rst:372 msgid "" "Replace with backslashed escape sequences. On encoding, use hexadecimal form " -"of Unicode code point with formats :samp:`\\\\x{hh}` :samp:`\\\\u{xxxx}` :" -"samp:`\\\\U{xxxxxxxx}`. On decoding, use hexadecimal form of byte value with " -"format :samp:`\\\\x{hh}`. Implemented in :func:`backslashreplace_errors`." +"of Unicode code point with formats :samp:`\\\\x{hh}` :samp:`\\\\u{xxxx}" +"` :samp:`\\\\U{xxxxxxxx}`. On decoding, use hexadecimal form of byte value " +"with format :samp:`\\\\x{hh}`. Implemented " +"in :func:`backslashreplace_errors`." msgstr "" -#: ../../library/codecs.rst:377 +#: ../../library/codecs.rst:381 msgid "``'surrogateescape'``" msgstr "``'surrogateescape'``" -#: ../../library/codecs.rst:377 +#: ../../library/codecs.rst:381 msgid "" "On decoding, replace byte with individual surrogate code ranging from " "``U+DC80`` to ``U+DCFF``. This code will then be turned back into the same " @@ -456,166 +462,167 @@ msgid "" "data. (See :pep:`383` for more.)" msgstr "" -#: ../../library/codecs.rst:391 +#: ../../library/codecs.rst:395 msgid "" -"The following error handlers are only applicable to encoding (within :term:" -"`text encodings `):" +"The following error handlers are only applicable to encoding " +"(within :term:`text encodings `):" msgstr "" -#: ../../library/codecs.rst:397 +#: ../../library/codecs.rst:401 msgid "``'xmlcharrefreplace'``" msgstr "``'xmlcharrefreplace'``" -#: ../../library/codecs.rst:397 +#: ../../library/codecs.rst:401 msgid "" "Replace with XML/HTML numeric character reference, which is a decimal form " -"of Unicode code point with format :samp:`&#{num};`. Implemented in :func:" -"`xmlcharrefreplace_errors`." +"of Unicode code point with format :samp:`&#{num};`. Implemented " +"in :func:`xmlcharrefreplace_errors`." msgstr "" -#: ../../library/codecs.rst:403 +#: ../../library/codecs.rst:407 msgid "``'namereplace'``" msgstr "``'namereplace'``" -#: ../../library/codecs.rst:403 +#: ../../library/codecs.rst:407 msgid "" "Replace with ``\\N{...}`` escape sequences, what appears in the braces is " -"the Name property from Unicode Character Database. Implemented in :func:" -"`namereplace_errors`." +"the Name property from Unicode Character Database. Implemented " +"in :func:`namereplace_errors`." msgstr "" -#: ../../library/codecs.rst:412 +#: ../../library/codecs.rst:416 msgid "" "In addition, the following error handler is specific to the given codecs:" msgstr "" -#: ../../library/codecs.rst:13 ../../library/codecs.rst:415 +#: ../../library/codecs.rst:13 ../../library/codecs.rst:419 msgid "Codecs" msgstr "" -#: ../../library/codecs.rst:417 +#: ../../library/codecs.rst:421 msgid "``'surrogatepass'``" msgstr "``'surrogatepass'``" -#: ../../library/codecs.rst:417 +#: ../../library/codecs.rst:421 msgid "utf-8, utf-16, utf-32, utf-16-be, utf-16-le, utf-32-be, utf-32-le" msgstr "utf-8, utf-16, utf-32, utf-16-be, utf-16-le, utf-32-be, utf-32-le" -#: ../../library/codecs.rst:417 +#: ../../library/codecs.rst:421 msgid "" "Allow encoding and decoding surrogate code point (``U+D800`` - ``U+DFFF``) " "as normal code point. Otherwise these codecs treat the presence of surrogate " "code point in :class:`str` as an error." msgstr "" -#: ../../library/codecs.rst:424 +#: ../../library/codecs.rst:428 msgid "The ``'surrogateescape'`` and ``'surrogatepass'`` error handlers." msgstr "" -#: ../../library/codecs.rst:427 +#: ../../library/codecs.rst:431 msgid "" "The ``'surrogatepass'`` error handler now works with utf-16\\* and utf-32\\* " "codecs." msgstr "" -#: ../../library/codecs.rst:431 +#: ../../library/codecs.rst:435 msgid "The ``'namereplace'`` error handler." msgstr "" -#: ../../library/codecs.rst:434 +#: ../../library/codecs.rst:438 msgid "" "The ``'backslashreplace'`` error handler now works with decoding and " "translating." msgstr "" -#: ../../library/codecs.rst:438 +#: ../../library/codecs.rst:442 msgid "" "The set of allowed values can be extended by registering a new named error " "handler:" msgstr "" -#: ../../library/codecs.rst:443 +#: ../../library/codecs.rst:447 msgid "" "Register the error handling function *error_handler* under the name *name*. " "The *error_handler* argument will be called during encoding and decoding in " "case of an error, when *name* is specified as the errors parameter." msgstr "" -#: ../../library/codecs.rst:447 +#: ../../library/codecs.rst:451 msgid "" -"For encoding, *error_handler* will be called with a :exc:" -"`UnicodeEncodeError` instance, which contains information about the location " -"of the error. The error handler must either raise this or a different " -"exception, or return a tuple with a replacement for the unencodable part of " -"the input and a position where encoding should continue. The replacement may " -"be either :class:`str` or :class:`bytes`. If the replacement is bytes, the " -"encoder will simply copy them into the output buffer. If the replacement is " -"a string, the encoder will encode the replacement. Encoding continues on " -"original input at the specified position. Negative position values will be " -"treated as being relative to the end of the input string. If the resulting " -"position is out of bound an :exc:`IndexError` will be raised." +"For encoding, *error_handler* will be called with " +"a :exc:`UnicodeEncodeError` instance, which contains information about the " +"location of the error. The error handler must either raise this or a " +"different exception, or return a tuple with a replacement for the " +"unencodable part of the input and a position where encoding should continue. " +"The replacement may be either :class:`str` or :class:`bytes`. If the " +"replacement is bytes, the encoder will simply copy them into the output " +"buffer. If the replacement is a string, the encoder will encode the " +"replacement. Encoding continues on original input at the specified position. " +"Negative position values will be treated as being relative to the end of the " +"input string. If the resulting position is out of bound an :exc:`IndexError` " +"will be raised." msgstr "" -#: ../../library/codecs.rst:459 +#: ../../library/codecs.rst:463 msgid "" "Decoding and translating works similarly, except :exc:`UnicodeDecodeError` " "or :exc:`UnicodeTranslateError` will be passed to the handler and that the " "replacement from the error handler will be put into the output directly." msgstr "" -#: ../../library/codecs.rst:464 +#: ../../library/codecs.rst:468 msgid "" "Previously registered error handlers (including the standard error handlers) " "can be looked up by name:" msgstr "" -#: ../../library/codecs.rst:469 +#: ../../library/codecs.rst:473 msgid "Return the error handler previously registered under the name *name*." msgstr "" -#: ../../library/codecs.rst:471 +#: ../../library/codecs.rst:475 msgid "Raises a :exc:`LookupError` in case the handler cannot be found." msgstr "" -#: ../../library/codecs.rst:473 +#: ../../library/codecs.rst:477 msgid "" "The following standard error handlers are also made available as module " "level functions:" msgstr "" -#: ../../library/codecs.rst:478 +#: ../../library/codecs.rst:482 msgid "Implements the ``'strict'`` error handling." msgstr "" -#: ../../library/codecs.rst:480 +#: ../../library/codecs.rst:484 msgid "Each encoding or decoding error raises a :exc:`UnicodeError`." msgstr "" -#: ../../library/codecs.rst:485 +#: ../../library/codecs.rst:489 msgid "Implements the ``'ignore'`` error handling." msgstr "" -#: ../../library/codecs.rst:487 +#: ../../library/codecs.rst:491 msgid "" "Malformed data is ignored; encoding or decoding is continued without further " "notice." msgstr "" -#: ../../library/codecs.rst:493 +#: ../../library/codecs.rst:497 msgid "Implements the ``'replace'`` error handling." msgstr "" -#: ../../library/codecs.rst:495 +#: ../../library/codecs.rst:499 msgid "" "Substitutes ``?`` (ASCII character) for encoding errors or ``�`` (U+FFFD, " "the official REPLACEMENT CHARACTER) for decoding errors." msgstr "" -#: ../../library/codecs.rst:501 +#: ../../library/codecs.rst:505 msgid "Implements the ``'backslashreplace'`` error handling." msgstr "" -#: ../../library/codecs.rst:503 +#: ../../library/codecs.rst:507 msgid "" "Malformed data is replaced by a backslashed escape sequence. On encoding, " "use the hexadecimal form of Unicode code point with formats :samp:`\\\\x{hh}" @@ -623,30 +630,30 @@ msgid "" "hexadecimal form of byte value with format :samp:`\\\\x{hh}`." msgstr "" -#: ../../library/codecs.rst:509 +#: ../../library/codecs.rst:513 msgid "Works with decoding and translating." msgstr "" -#: ../../library/codecs.rst:515 +#: ../../library/codecs.rst:519 msgid "" -"Implements the ``'xmlcharrefreplace'`` error handling (for encoding within :" -"term:`text encoding` only)." +"Implements the ``'xmlcharrefreplace'`` error handling (for encoding " +"within :term:`text encoding` only)." msgstr "" -#: ../../library/codecs.rst:518 +#: ../../library/codecs.rst:522 msgid "" "The unencodable character is replaced by an appropriate XML/HTML numeric " "character reference, which is a decimal form of Unicode code point with " "format :samp:`&#{num};` ." msgstr "" -#: ../../library/codecs.rst:525 +#: ../../library/codecs.rst:529 msgid "" -"Implements the ``'namereplace'`` error handling (for encoding within :term:" -"`text encoding` only)." +"Implements the ``'namereplace'`` error handling (for encoding " +"within :term:`text encoding` only)." msgstr "" -#: ../../library/codecs.rst:528 +#: ../../library/codecs.rst:532 msgid "" "The unencodable character is replaced by a ``\\N{...}`` escape sequence. The " "set of characters that appear in the braces is the Name property from " @@ -654,17 +661,17 @@ msgid "" "will be converted to byte sequence ``\\N{LATIN SMALL LETTER SHARP S}`` ." msgstr "" -#: ../../library/codecs.rst:539 +#: ../../library/codecs.rst:543 msgid "Stateless Encoding and Decoding" msgstr "" -#: ../../library/codecs.rst:541 +#: ../../library/codecs.rst:545 msgid "" "The base :class:`Codec` class defines these methods which also define the " "function interfaces of the stateless encoder and decoder:" msgstr "" -#: ../../library/codecs.rst:549 +#: ../../library/codecs.rst:553 msgid "" "Encodes the object *input* and returns a tuple (output object, length " "consumed). For instance, :term:`text encoding` converts a string object to a " @@ -672,26 +679,26 @@ msgid "" "``iso-8859-1``)." msgstr "" -#: ../../library/codecs.rst:554 ../../library/codecs.rst:576 +#: ../../library/codecs.rst:558 ../../library/codecs.rst:580 msgid "" "The *errors* argument defines the error handling to apply. It defaults to " "``'strict'`` handling." msgstr "" -#: ../../library/codecs.rst:557 +#: ../../library/codecs.rst:561 msgid "" -"The method may not store state in the :class:`Codec` instance. Use :class:" -"`StreamWriter` for codecs which have to keep state in order to make encoding " -"efficient." +"The method may not store state in the :class:`Codec` instance. " +"Use :class:`StreamWriter` for codecs which have to keep state in order to " +"make encoding efficient." msgstr "" -#: ../../library/codecs.rst:561 +#: ../../library/codecs.rst:565 msgid "" "The encoder must be able to handle zero length input and return an empty " "object of the output object type in this situation." msgstr "" -#: ../../library/codecs.rst:567 +#: ../../library/codecs.rst:571 msgid "" "Decodes the object *input* and returns a tuple (output object, length " "consumed). For instance, for a :term:`text encoding`, decoding converts a " @@ -699,101 +706,101 @@ msgid "" "object." msgstr "" -#: ../../library/codecs.rst:572 +#: ../../library/codecs.rst:576 msgid "" "For text encodings and bytes-to-bytes codecs, *input* must be a bytes object " "or one which provides the read-only buffer interface -- for example, buffer " "objects and memory mapped files." msgstr "" -#: ../../library/codecs.rst:579 +#: ../../library/codecs.rst:583 msgid "" -"The method may not store state in the :class:`Codec` instance. Use :class:" -"`StreamReader` for codecs which have to keep state in order to make decoding " -"efficient." +"The method may not store state in the :class:`Codec` instance. " +"Use :class:`StreamReader` for codecs which have to keep state in order to " +"make decoding efficient." msgstr "" -#: ../../library/codecs.rst:583 +#: ../../library/codecs.rst:587 msgid "" "The decoder must be able to handle zero length input and return an empty " "object of the output object type in this situation." msgstr "" -#: ../../library/codecs.rst:588 +#: ../../library/codecs.rst:592 msgid "Incremental Encoding and Decoding" msgstr "" -#: ../../library/codecs.rst:590 +#: ../../library/codecs.rst:594 msgid "" "The :class:`IncrementalEncoder` and :class:`IncrementalDecoder` classes " "provide the basic interface for incremental encoding and decoding. Encoding/" "decoding the input isn't done with one call to the stateless encoder/decoder " -"function, but with multiple calls to the :meth:`~IncrementalEncoder.encode`/:" -"meth:`~IncrementalDecoder.decode` method of the incremental encoder/decoder. " -"The incremental encoder/decoder keeps track of the encoding/decoding process " -"during method calls." +"function, but with multiple calls to " +"the :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` " +"method of the incremental encoder/decoder. The incremental encoder/decoder " +"keeps track of the encoding/decoding process during method calls." msgstr "" -#: ../../library/codecs.rst:598 +#: ../../library/codecs.rst:602 msgid "" -"The joined output of calls to the :meth:`~IncrementalEncoder.encode`/:meth:" -"`~IncrementalDecoder.decode` method is the same as if all the single inputs " -"were joined into one, and this input was encoded/decoded with the stateless " -"encoder/decoder." +"The joined output of calls to " +"the :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` " +"method is the same as if all the single inputs were joined into one, and " +"this input was encoded/decoded with the stateless encoder/decoder." msgstr "" -#: ../../library/codecs.rst:607 +#: ../../library/codecs.rst:611 msgid "IncrementalEncoder Objects" msgstr "IncrementalEncoder 物件" -#: ../../library/codecs.rst:609 +#: ../../library/codecs.rst:613 msgid "" "The :class:`IncrementalEncoder` class is used for encoding an input in " "multiple steps. It defines the following methods which every incremental " "encoder must define in order to be compatible with the Python codec registry." msgstr "" -#: ../../library/codecs.rst:616 +#: ../../library/codecs.rst:620 msgid "Constructor for an :class:`IncrementalEncoder` instance." msgstr ":class:`IncrementalEncoder` 的建構函式。" -#: ../../library/codecs.rst:618 +#: ../../library/codecs.rst:622 msgid "" "All incremental encoders must provide this constructor interface. They are " "free to add additional keyword arguments, but only the ones defined here are " "used by the Python codec registry." msgstr "" -#: ../../library/codecs.rst:622 +#: ../../library/codecs.rst:626 msgid "" "The :class:`IncrementalEncoder` may implement different error handling " "schemes by providing the *errors* keyword argument. See :ref:`error-" "handlers` for possible values." msgstr "" -#: ../../library/codecs.rst:626 +#: ../../library/codecs.rst:630 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " -"error handling strategies during the lifetime of the :class:" -"`IncrementalEncoder` object." +"error handling strategies during the lifetime of " +"the :class:`IncrementalEncoder` object." msgstr "" -#: ../../library/codecs.rst:634 +#: ../../library/codecs.rst:638 msgid "" "Encodes *object* (taking the current state of the encoder into account) and " -"returns the resulting encoded object. If this is the last call to :meth:" -"`encode` *final* must be true (the default is false)." +"returns the resulting encoded object. If this is the last call " +"to :meth:`encode` *final* must be true (the default is false)." msgstr "" -#: ../../library/codecs.rst:641 +#: ../../library/codecs.rst:645 msgid "" -"Reset the encoder to the initial state. The output is discarded: call ``." -"encode(object, final=True)``, passing an empty byte or text string if " +"Reset the encoder to the initial state. The output is discarded: call " +"``.encode(object, final=True)``, passing an empty byte or text string if " "necessary, to reset the encoder and to get the output." msgstr "" -#: ../../library/codecs.rst:648 +#: ../../library/codecs.rst:652 msgid "" "Return the current state of the encoder which must be an integer. The " "implementation should make sure that ``0`` is the most common state. (States " @@ -802,65 +809,65 @@ msgid "" "into an integer.)" msgstr "" -#: ../../library/codecs.rst:657 +#: ../../library/codecs.rst:661 msgid "" "Set the state of the encoder to *state*. *state* must be an encoder state " "returned by :meth:`getstate`." msgstr "" -#: ../../library/codecs.rst:664 +#: ../../library/codecs.rst:668 msgid "IncrementalDecoder Objects" msgstr "IncrementalDecoder 物件" -#: ../../library/codecs.rst:666 +#: ../../library/codecs.rst:670 msgid "" "The :class:`IncrementalDecoder` class is used for decoding an input in " "multiple steps. It defines the following methods which every incremental " "decoder must define in order to be compatible with the Python codec registry." msgstr "" -#: ../../library/codecs.rst:673 +#: ../../library/codecs.rst:677 msgid "Constructor for an :class:`IncrementalDecoder` instance." msgstr ":class:`IncrementalDecoder` 的建構函式。" -#: ../../library/codecs.rst:675 +#: ../../library/codecs.rst:679 msgid "" "All incremental decoders must provide this constructor interface. They are " "free to add additional keyword arguments, but only the ones defined here are " "used by the Python codec registry." msgstr "" -#: ../../library/codecs.rst:679 +#: ../../library/codecs.rst:683 msgid "" "The :class:`IncrementalDecoder` may implement different error handling " "schemes by providing the *errors* keyword argument. See :ref:`error-" "handlers` for possible values." msgstr "" -#: ../../library/codecs.rst:683 +#: ../../library/codecs.rst:687 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " -"error handling strategies during the lifetime of the :class:" -"`IncrementalDecoder` object." +"error handling strategies during the lifetime of " +"the :class:`IncrementalDecoder` object." msgstr "" -#: ../../library/codecs.rst:691 +#: ../../library/codecs.rst:695 msgid "" "Decodes *object* (taking the current state of the decoder into account) and " -"returns the resulting decoded object. If this is the last call to :meth:" -"`decode` *final* must be true (the default is false). If *final* is true the " -"decoder must decode the input completely and must flush all buffers. If this " -"isn't possible (e.g. because of incomplete byte sequences at the end of the " -"input) it must initiate error handling just like in the stateless case " -"(which might raise an exception)." +"returns the resulting decoded object. If this is the last call " +"to :meth:`decode` *final* must be true (the default is false). If *final* is " +"true the decoder must decode the input completely and must flush all " +"buffers. If this isn't possible (e.g. because of incomplete byte sequences " +"at the end of the input) it must initiate error handling just like in the " +"stateless case (which might raise an exception)." msgstr "" -#: ../../library/codecs.rst:702 +#: ../../library/codecs.rst:706 msgid "Reset the decoder to the initial state." msgstr "將解碼器重設到初始狀態。" -#: ../../library/codecs.rst:707 +#: ../../library/codecs.rst:711 msgid "" "Return the current state of the decoder. This must be a tuple with two " "items, the first must be the buffer containing the still undecoded input. " @@ -875,59 +882,59 @@ msgid "" "bytes of the resulting string into an integer.)" msgstr "" -#: ../../library/codecs.rst:722 +#: ../../library/codecs.rst:726 msgid "" "Set the state of the decoder to *state*. *state* must be a decoder state " "returned by :meth:`getstate`." msgstr "" -#: ../../library/codecs.rst:727 +#: ../../library/codecs.rst:731 msgid "Stream Encoding and Decoding" msgstr "串流編碼和解碼" -#: ../../library/codecs.rst:730 +#: ../../library/codecs.rst:734 msgid "" "The :class:`StreamWriter` and :class:`StreamReader` classes provide generic " "working interfaces which can be used to implement new encoding submodules " "very easily. See :mod:`!encodings.utf_8` for an example of how this is done." msgstr "" -#: ../../library/codecs.rst:738 +#: ../../library/codecs.rst:742 msgid "StreamWriter Objects" msgstr "StreamWriter 物件" -#: ../../library/codecs.rst:740 +#: ../../library/codecs.rst:744 msgid "" "The :class:`StreamWriter` class is a subclass of :class:`Codec` and defines " "the following methods which every stream writer must define in order to be " "compatible with the Python codec registry." msgstr "" -#: ../../library/codecs.rst:747 +#: ../../library/codecs.rst:751 msgid "Constructor for a :class:`StreamWriter` instance." msgstr ":class:`StreamWriter` 的建構函式。" -#: ../../library/codecs.rst:749 +#: ../../library/codecs.rst:753 msgid "" "All stream writers must provide this constructor interface. They are free to " "add additional keyword arguments, but only the ones defined here are used by " "the Python codec registry." msgstr "" -#: ../../library/codecs.rst:753 +#: ../../library/codecs.rst:757 msgid "" "The *stream* argument must be a file-like object open for writing text or " "binary data, as appropriate for the specific codec." msgstr "" -#: ../../library/codecs.rst:756 +#: ../../library/codecs.rst:760 msgid "" "The :class:`StreamWriter` may implement different error handling schemes by " "providing the *errors* keyword argument. See :ref:`error-handlers` for the " "standard error handlers the underlying stream codec may support." msgstr "" -#: ../../library/codecs.rst:760 +#: ../../library/codecs.rst:764 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " @@ -935,70 +942,70 @@ msgid "" "object." msgstr "" -#: ../../library/codecs.rst:766 +#: ../../library/codecs.rst:770 msgid "Writes the object's contents encoded to the stream." msgstr "" -#: ../../library/codecs.rst:771 +#: ../../library/codecs.rst:775 msgid "" "Writes the concatenated iterable of strings to the stream (possibly by " "reusing the :meth:`write` method). Infinite or very large iterables are not " "supported. The standard bytes-to-bytes codecs do not support this method." msgstr "" -#: ../../library/codecs.rst:779 ../../library/codecs.rst:874 +#: ../../library/codecs.rst:783 ../../library/codecs.rst:878 msgid "Resets the codec buffers used for keeping internal state." msgstr "" -#: ../../library/codecs.rst:781 +#: ../../library/codecs.rst:785 msgid "" "Calling this method should ensure that the data on the output is put into a " "clean state that allows appending of new fresh data without having to rescan " "the whole stream to recover state." msgstr "" -#: ../../library/codecs.rst:786 +#: ../../library/codecs.rst:790 msgid "" "In addition to the above methods, the :class:`StreamWriter` must also " "inherit all other methods and attributes from the underlying stream." msgstr "" -#: ../../library/codecs.rst:793 +#: ../../library/codecs.rst:797 msgid "StreamReader Objects" msgstr "StreamReader 物件" -#: ../../library/codecs.rst:795 +#: ../../library/codecs.rst:799 msgid "" "The :class:`StreamReader` class is a subclass of :class:`Codec` and defines " "the following methods which every stream reader must define in order to be " "compatible with the Python codec registry." msgstr "" -#: ../../library/codecs.rst:802 +#: ../../library/codecs.rst:806 msgid "Constructor for a :class:`StreamReader` instance." msgstr ":class:`StreamReader` 的建構函式。" -#: ../../library/codecs.rst:804 +#: ../../library/codecs.rst:808 msgid "" "All stream readers must provide this constructor interface. They are free to " "add additional keyword arguments, but only the ones defined here are used by " "the Python codec registry." msgstr "" -#: ../../library/codecs.rst:808 +#: ../../library/codecs.rst:812 msgid "" "The *stream* argument must be a file-like object open for reading text or " "binary data, as appropriate for the specific codec." msgstr "" -#: ../../library/codecs.rst:811 +#: ../../library/codecs.rst:815 msgid "" "The :class:`StreamReader` may implement different error handling schemes by " "providing the *errors* keyword argument. See :ref:`error-handlers` for the " "standard error handlers the underlying stream codec may support." msgstr "" -#: ../../library/codecs.rst:815 +#: ../../library/codecs.rst:819 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " @@ -1006,24 +1013,24 @@ msgid "" "object." msgstr "" -#: ../../library/codecs.rst:819 +#: ../../library/codecs.rst:823 msgid "" -"The set of allowed values for the *errors* argument can be extended with :" -"func:`register_error`." +"The set of allowed values for the *errors* argument can be extended " +"with :func:`register_error`." msgstr "" -#: ../../library/codecs.rst:825 +#: ../../library/codecs.rst:829 msgid "Decodes data from the stream and returns the resulting object." msgstr "" -#: ../../library/codecs.rst:827 +#: ../../library/codecs.rst:831 msgid "" "The *chars* argument indicates the number of decoded code points or bytes to " "return. The :func:`read` method will never return more data than requested, " "but it might return less, if there is not enough available." msgstr "" -#: ../../library/codecs.rst:832 +#: ../../library/codecs.rst:836 msgid "" "The *size* argument indicates the approximate maximum number of encoded " "bytes or code points to read for decoding. The decoder can modify this " @@ -1032,13 +1039,13 @@ msgid "" "huge files in one step." msgstr "" -#: ../../library/codecs.rst:839 +#: ../../library/codecs.rst:843 msgid "" "The *firstline* flag indicates that it would be sufficient to only return " "the first line, if there are decoding errors on later lines." msgstr "" -#: ../../library/codecs.rst:843 +#: ../../library/codecs.rst:847 msgid "" "The method should use a greedy read strategy meaning that it should read as " "much data as is allowed within the definition of the encoding and the given " @@ -1046,68 +1053,68 @@ msgid "" "the stream, these should be read too." msgstr "" -#: ../../library/codecs.rst:851 +#: ../../library/codecs.rst:855 msgid "Read one line from the input stream and return the decoded data." msgstr "" -#: ../../library/codecs.rst:853 +#: ../../library/codecs.rst:857 msgid "" "*size*, if given, is passed as size argument to the stream's :meth:`read` " "method." msgstr "" -#: ../../library/codecs.rst:856 +#: ../../library/codecs.rst:860 msgid "" "If *keepends* is false line-endings will be stripped from the lines returned." msgstr "" -#: ../../library/codecs.rst:862 +#: ../../library/codecs.rst:866 msgid "" "Read all lines available on the input stream and return them as a list of " "lines." msgstr "" -#: ../../library/codecs.rst:865 +#: ../../library/codecs.rst:869 msgid "" "Line-endings are implemented using the codec's :meth:`decode` method and are " "included in the list entries if *keepends* is true." msgstr "" -#: ../../library/codecs.rst:868 +#: ../../library/codecs.rst:872 msgid "" -"*sizehint*, if given, is passed as the *size* argument to the stream's :meth:" -"`read` method." +"*sizehint*, if given, is passed as the *size* argument to the " +"stream's :meth:`read` method." msgstr "" -#: ../../library/codecs.rst:876 +#: ../../library/codecs.rst:880 msgid "" "Note that no stream repositioning should take place. This method is " "primarily intended to be able to recover from decoding errors." msgstr "" -#: ../../library/codecs.rst:880 +#: ../../library/codecs.rst:884 msgid "" "In addition to the above methods, the :class:`StreamReader` must also " "inherit all other methods and attributes from the underlying stream." msgstr "" -#: ../../library/codecs.rst:886 +#: ../../library/codecs.rst:890 msgid "StreamReaderWriter Objects" msgstr "StreamReaderWriter 物件" -#: ../../library/codecs.rst:888 +#: ../../library/codecs.rst:892 msgid "" "The :class:`StreamReaderWriter` is a convenience class that allows wrapping " "streams which work in both read and write modes." msgstr "" -#: ../../library/codecs.rst:891 ../../library/codecs.rst:915 +#: ../../library/codecs.rst:895 ../../library/codecs.rst:919 msgid "" -"The design is such that one can use the factory functions returned by the :" -"func:`lookup` function to construct the instance." +"The design is such that one can use the factory functions returned by " +"the :func:`lookup` function to construct the instance." msgstr "" -#: ../../library/codecs.rst:897 +#: ../../library/codecs.rst:901 msgid "" "Creates a :class:`StreamReaderWriter` instance. *stream* must be a file-like " "object. *Reader* and *Writer* must be factory functions or classes providing " @@ -1116,24 +1123,24 @@ msgid "" "writers." msgstr "" -#: ../../library/codecs.rst:902 +#: ../../library/codecs.rst:906 msgid "" -":class:`StreamReaderWriter` instances define the combined interfaces of :" -"class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " +":class:`StreamReaderWriter` instances define the combined interfaces " +"of :class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " "other methods and attributes from the underlying stream." msgstr "" -#: ../../library/codecs.rst:910 +#: ../../library/codecs.rst:914 msgid "StreamRecoder Objects" msgstr "StreamRecoder 物件" -#: ../../library/codecs.rst:912 +#: ../../library/codecs.rst:916 msgid "" "The :class:`StreamRecoder` translates data from one encoding to another, " "which is sometimes useful when dealing with different encoding environments." msgstr "" -#: ../../library/codecs.rst:921 +#: ../../library/codecs.rst:925 msgid "" "Creates a :class:`StreamRecoder` instance which implements a two-way " "conversion: *encode* and *decode* work on the frontend — the data visible to " @@ -1141,17 +1148,17 @@ msgid "" "while *Reader* and *Writer* work on the backend — the data in *stream*." msgstr "" -#: ../../library/codecs.rst:927 +#: ../../library/codecs.rst:931 msgid "" "You can use these objects to do transparent transcodings, e.g., from Latin-1 " "to UTF-8 and back." msgstr "" -#: ../../library/codecs.rst:930 +#: ../../library/codecs.rst:934 msgid "The *stream* argument must be a file-like object." msgstr "*stream* 引數必須是類檔案物件。" -#: ../../library/codecs.rst:932 +#: ../../library/codecs.rst:936 msgid "" "The *encode* and *decode* arguments must adhere to the :class:`Codec` " "interface. *Reader* and *Writer* must be factory functions or classes " @@ -1159,24 +1166,24 @@ msgid "" "interface respectively." msgstr "" -#: ../../library/codecs.rst:937 +#: ../../library/codecs.rst:941 msgid "" "Error handling is done in the same way as defined for the stream readers and " "writers." msgstr "" -#: ../../library/codecs.rst:941 +#: ../../library/codecs.rst:945 msgid "" -":class:`StreamRecoder` instances define the combined interfaces of :class:" -"`StreamReader` and :class:`StreamWriter` classes. They inherit all other " -"methods and attributes from the underlying stream." +":class:`StreamRecoder` instances define the combined interfaces " +"of :class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " +"other methods and attributes from the underlying stream." msgstr "" -#: ../../library/codecs.rst:949 +#: ../../library/codecs.rst:953 msgid "Encodings and Unicode" msgstr "編碼和 Unicode" -#: ../../library/codecs.rst:951 +#: ../../library/codecs.rst:955 msgid "" "Strings are stored internally as sequences of code points in range " "``U+0000``--``U+10FFFF``. (See :pep:`393` for more details about the " @@ -1188,7 +1195,7 @@ msgid "" "which are collectivity referred to as :term:`text encodings `." msgstr "" -#: ../../library/codecs.rst:961 +#: ../../library/codecs.rst:965 msgid "" "The simplest text encoding (called ``'latin-1'`` or ``'iso-8859-1'``) maps " "the code points 0--255 to the bytes ``0x0``--``0xff``, which means that a " @@ -1199,7 +1206,7 @@ msgid "" "position 3: ordinal not in range(256)``." msgstr "" -#: ../../library/codecs.rst:969 +#: ../../library/codecs.rst:973 msgid "" "There's another group of encodings (the so called charmap encodings) that " "choose a different subset of all Unicode code points and how these code " @@ -1209,7 +1216,7 @@ msgid "" "that shows you which character is mapped to which byte value." msgstr "" -#: ../../library/codecs.rst:976 +#: ../../library/codecs.rst:980 msgid "" "All of these encodings can only encode 256 of the 1114112 code points " "defined in Unicode. A simple and straightforward way that can store each " @@ -1239,7 +1246,7 @@ msgid "" "normal character that will be decoded like any other." msgstr "" -#: ../../library/codecs.rst:1002 +#: ../../library/codecs.rst:1006 msgid "" "There's another encoding that is able to encode the full range of Unicode " "characters: UTF-8. UTF-8 is an 8-bit encoding, which means there are no " @@ -1250,59 +1257,59 @@ msgid "" "which when concatenated give the Unicode character):" msgstr "" -#: ../../library/codecs.rst:1011 +#: ../../library/codecs.rst:1015 msgid "Range" msgstr "" -#: ../../library/codecs.rst:1011 +#: ../../library/codecs.rst:1015 msgid "Encoding" msgstr "" -#: ../../library/codecs.rst:1013 +#: ../../library/codecs.rst:1017 msgid "``U-00000000`` ... ``U-0000007F``" msgstr "``U-00000000`` ... ``U-0000007F``" -#: ../../library/codecs.rst:1013 +#: ../../library/codecs.rst:1017 msgid "0xxxxxxx" msgstr "0xxxxxxx" -#: ../../library/codecs.rst:1015 +#: ../../library/codecs.rst:1019 msgid "``U-00000080`` ... ``U-000007FF``" msgstr "``U-00000080`` ... ``U-000007FF``" -#: ../../library/codecs.rst:1015 +#: ../../library/codecs.rst:1019 msgid "110xxxxx 10xxxxxx" msgstr "110xxxxx 10xxxxxx" -#: ../../library/codecs.rst:1017 +#: ../../library/codecs.rst:1021 msgid "``U-00000800`` ... ``U-0000FFFF``" msgstr "``U-00000800`` ... ``U-0000FFFF``" -#: ../../library/codecs.rst:1017 +#: ../../library/codecs.rst:1021 msgid "1110xxxx 10xxxxxx 10xxxxxx" msgstr "1110xxxx 10xxxxxx 10xxxxxx" -#: ../../library/codecs.rst:1019 +#: ../../library/codecs.rst:1023 msgid "``U-00010000`` ... ``U-0010FFFF``" msgstr "``U-00010000`` ... ``U-0010FFFF``" -#: ../../library/codecs.rst:1019 +#: ../../library/codecs.rst:1023 msgid "11110xxx 10xxxxxx 10xxxxxx 10xxxxxx" msgstr "11110xxx 10xxxxxx 10xxxxxx 10xxxxxx" -#: ../../library/codecs.rst:1022 +#: ../../library/codecs.rst:1026 msgid "" "The least significant bit of the Unicode character is the rightmost x bit." msgstr "" -#: ../../library/codecs.rst:1024 +#: ../../library/codecs.rst:1028 msgid "" "As UTF-8 is an 8-bit encoding no BOM is required and any ``U+FEFF`` " "character in the decoded string (even if it's the first character) is " "treated as a ``ZERO WIDTH NO-BREAK SPACE``." msgstr "" -#: ../../library/codecs.rst:1028 +#: ../../library/codecs.rst:1032 msgid "" "Without external information it's impossible to reliably determine which " "encoding was used for encoding a string. Each charmap encoding can decode " @@ -1328,7 +1335,7 @@ msgstr "" msgid "INVERTED QUESTION MARK" msgstr "" -#: ../../library/codecs.rst:1044 +#: ../../library/codecs.rst:1048 msgid "" "in iso-8859-1), this increases the probability that a ``utf-8-sig`` encoding " "can be correctly guessed from the byte sequence. So here the BOM is not used " @@ -1340,11 +1347,11 @@ msgid "" "the use of the BOM is discouraged and should generally be avoided." msgstr "" -#: ../../library/codecs.rst:1057 +#: ../../library/codecs.rst:1061 msgid "Standard Encodings" msgstr "標準編碼" -#: ../../library/codecs.rst:1059 +#: ../../library/codecs.rst:1063 msgid "" "Python comes with a number of codecs built-in, either implemented as C " "functions or with dictionaries as mapping tables. The following table lists " @@ -1357,13 +1364,20 @@ msgid "" "``'utf-8'`` is a valid alias for the ``'utf_8'`` codec." msgstr "" -#: ../../library/codecs.rst:1071 +#: ../../library/codecs.rst:1075 msgid "" "The below table lists the most common aliases, for a complete list refer to " "the source :source:`aliases.py ` file." msgstr "" -#: ../../library/codecs.rst:1076 +#: ../../library/codecs.rst:1078 +msgid "" +"On Windows, ``cpXXX`` codecs are available for all code pages. But only " +"codecs listed in the following table are guarantead to exist on other " +"platforms." +msgstr "" + +#: ../../library/codecs.rst:1084 msgid "" "Some common encodings can bypass the codecs lookup machinery to improve " "performance. These optimization opportunities are only recognized by CPython " @@ -1373,11 +1387,11 @@ msgid "" "Using alternative aliases for these encodings may result in slower execution." msgstr "" -#: ../../library/codecs.rst:1084 +#: ../../library/codecs.rst:1092 msgid "Optimization opportunity recognized for us-ascii." msgstr "" -#: ../../library/codecs.rst:1087 +#: ../../library/codecs.rst:1095 msgid "" "Many of the character sets support the same languages. They vary in " "individual characters (e.g. whether the EURO SIGN is supported or not), and " @@ -1385,504 +1399,504 @@ msgid "" "languages in particular, the following variants typically exist:" msgstr "" -#: ../../library/codecs.rst:1092 +#: ../../library/codecs.rst:1100 msgid "an ISO 8859 codeset" msgstr "" -#: ../../library/codecs.rst:1094 +#: ../../library/codecs.rst:1102 msgid "" "a Microsoft Windows code page, which is typically derived from an 8859 " "codeset, but replaces control characters with additional graphic characters" msgstr "" -#: ../../library/codecs.rst:1097 +#: ../../library/codecs.rst:1105 msgid "an IBM EBCDIC code page" msgstr "" -#: ../../library/codecs.rst:1099 +#: ../../library/codecs.rst:1107 msgid "an IBM PC code page, which is ASCII compatible" msgstr "" -#: ../../library/codecs.rst:1104 ../../library/codecs.rst:1360 -#: ../../library/codecs.rst:1432 ../../library/codecs.rst:1517 +#: ../../library/codecs.rst:1112 ../../library/codecs.rst:1371 +#: ../../library/codecs.rst:1443 ../../library/codecs.rst:1498 msgid "Codec" msgstr "" -#: ../../library/codecs.rst:1104 ../../library/codecs.rst:1360 -#: ../../library/codecs.rst:1432 ../../library/codecs.rst:1517 +#: ../../library/codecs.rst:1112 ../../library/codecs.rst:1371 +#: ../../library/codecs.rst:1443 ../../library/codecs.rst:1498 msgid "Aliases" msgstr "" -#: ../../library/codecs.rst:1104 +#: ../../library/codecs.rst:1112 msgid "Languages" msgstr "語言" -#: ../../library/codecs.rst:1106 +#: ../../library/codecs.rst:1114 msgid "ascii" msgstr "ascii" -#: ../../library/codecs.rst:1106 +#: ../../library/codecs.rst:1114 msgid "646, us-ascii" msgstr "646, us-ascii" -#: ../../library/codecs.rst:1106 ../../library/codecs.rst:1112 -#: ../../library/codecs.rst:1120 +#: ../../library/codecs.rst:1114 ../../library/codecs.rst:1120 +#: ../../library/codecs.rst:1128 msgid "English" msgstr "英文" -#: ../../library/codecs.rst:1108 +#: ../../library/codecs.rst:1116 msgid "big5" msgstr "big5" -#: ../../library/codecs.rst:1108 +#: ../../library/codecs.rst:1116 msgid "big5-tw, csbig5" msgstr "big5-tw, csbig5" -#: ../../library/codecs.rst:1108 ../../library/codecs.rst:1110 -#: ../../library/codecs.rst:1169 +#: ../../library/codecs.rst:1116 ../../library/codecs.rst:1118 +#: ../../library/codecs.rst:1177 msgid "Traditional Chinese" msgstr "繁體中文" -#: ../../library/codecs.rst:1110 +#: ../../library/codecs.rst:1118 msgid "big5hkscs" msgstr "big5hkscs" -#: ../../library/codecs.rst:1110 +#: ../../library/codecs.rst:1118 msgid "big5-hkscs, hkscs" msgstr "big5-hkscs, hkscs" -#: ../../library/codecs.rst:1112 +#: ../../library/codecs.rst:1120 msgid "cp037" msgstr "cp037" -#: ../../library/codecs.rst:1112 +#: ../../library/codecs.rst:1120 msgid "IBM037, IBM039" msgstr "IBM037, IBM039" -#: ../../library/codecs.rst:1114 +#: ../../library/codecs.rst:1122 msgid "cp273" msgstr "cp273" -#: ../../library/codecs.rst:1114 +#: ../../library/codecs.rst:1122 msgid "273, IBM273, csIBM273" msgstr "273, IBM273, csIBM273" -#: ../../library/codecs.rst:1114 +#: ../../library/codecs.rst:1122 msgid "German" msgstr "德文" -#: ../../library/codecs.rst:1118 +#: ../../library/codecs.rst:1126 msgid "cp424" msgstr "cp424" -#: ../../library/codecs.rst:1118 +#: ../../library/codecs.rst:1126 msgid "EBCDIC-CP-HE, IBM424" msgstr "EBCDIC-CP-HE, IBM424" -#: ../../library/codecs.rst:1118 ../../library/codecs.rst:1138 -#: ../../library/codecs.rst:1148 ../../library/codecs.rst:1192 -#: ../../library/codecs.rst:1255 +#: ../../library/codecs.rst:1126 ../../library/codecs.rst:1146 +#: ../../library/codecs.rst:1156 ../../library/codecs.rst:1200 +#: ../../library/codecs.rst:1263 msgid "Hebrew" msgstr "希伯來文" -#: ../../library/codecs.rst:1120 +#: ../../library/codecs.rst:1128 msgid "cp437" msgstr "cp437" -#: ../../library/codecs.rst:1120 +#: ../../library/codecs.rst:1128 msgid "437, IBM437" msgstr "437, IBM437" -#: ../../library/codecs.rst:1122 +#: ../../library/codecs.rst:1130 msgid "cp500" msgstr "cp500" -#: ../../library/codecs.rst:1122 +#: ../../library/codecs.rst:1130 msgid "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" msgstr "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" -#: ../../library/codecs.rst:1122 ../../library/codecs.rst:1131 -#: ../../library/codecs.rst:1142 ../../library/codecs.rst:1179 -#: ../../library/codecs.rst:1186 ../../library/codecs.rst:1239 -#: ../../library/codecs.rst:1267 ../../library/codecs.rst:1295 +#: ../../library/codecs.rst:1130 ../../library/codecs.rst:1139 +#: ../../library/codecs.rst:1150 ../../library/codecs.rst:1187 +#: ../../library/codecs.rst:1194 ../../library/codecs.rst:1247 +#: ../../library/codecs.rst:1275 ../../library/codecs.rst:1303 msgid "Western Europe" msgstr "" -#: ../../library/codecs.rst:1125 +#: ../../library/codecs.rst:1133 msgid "cp720" msgstr "cp720" -#: ../../library/codecs.rst:1125 ../../library/codecs.rst:1152 -#: ../../library/codecs.rst:1194 ../../library/codecs.rst:1251 +#: ../../library/codecs.rst:1133 ../../library/codecs.rst:1160 +#: ../../library/codecs.rst:1202 ../../library/codecs.rst:1259 msgid "Arabic" msgstr "阿拉伯文" -#: ../../library/codecs.rst:1127 +#: ../../library/codecs.rst:1135 msgid "cp737" msgstr "cp737" -#: ../../library/codecs.rst:1127 ../../library/codecs.rst:1158 -#: ../../library/codecs.rst:1162 ../../library/codecs.rst:1188 -#: ../../library/codecs.rst:1253 ../../library/codecs.rst:1288 +#: ../../library/codecs.rst:1135 ../../library/codecs.rst:1166 +#: ../../library/codecs.rst:1170 ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1261 ../../library/codecs.rst:1296 msgid "Greek" msgstr "希臘文" -#: ../../library/codecs.rst:1129 +#: ../../library/codecs.rst:1137 msgid "cp775" msgstr "cp775" -#: ../../library/codecs.rst:1129 +#: ../../library/codecs.rst:1137 msgid "IBM775" msgstr "IBM775" -#: ../../library/codecs.rst:1129 ../../library/codecs.rst:1196 -#: ../../library/codecs.rst:1263 +#: ../../library/codecs.rst:1137 ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1254 ../../library/codecs.rst:1271 msgid "Baltic languages" msgstr "" -#: ../../library/codecs.rst:1131 +#: ../../library/codecs.rst:1139 msgid "cp850" msgstr "cp850" -#: ../../library/codecs.rst:1131 +#: ../../library/codecs.rst:1139 msgid "850, IBM850" msgstr "850, IBM850" -#: ../../library/codecs.rst:1133 +#: ../../library/codecs.rst:1141 msgid "cp852" msgstr "cp852" -#: ../../library/codecs.rst:1133 +#: ../../library/codecs.rst:1141 msgid "852, IBM852" msgstr "852, IBM852" -#: ../../library/codecs.rst:1133 ../../library/codecs.rst:1181 -#: ../../library/codecs.rst:1242 ../../library/codecs.rst:1292 +#: ../../library/codecs.rst:1141 ../../library/codecs.rst:1189 +#: ../../library/codecs.rst:1250 ../../library/codecs.rst:1300 msgid "Central and Eastern Europe" msgstr "" -#: ../../library/codecs.rst:1135 +#: ../../library/codecs.rst:1143 msgid "cp855" msgstr "cp855" -#: ../../library/codecs.rst:1135 +#: ../../library/codecs.rst:1143 msgid "855, IBM855" msgstr "855, IBM855" -#: ../../library/codecs.rst:1135 ../../library/codecs.rst:1183 -#: ../../library/codecs.rst:1248 ../../library/codecs.rst:1285 +#: ../../library/codecs.rst:1143 ../../library/codecs.rst:1191 +#: ../../library/codecs.rst:1256 ../../library/codecs.rst:1293 msgid "Belarusian, Bulgarian, Macedonian, Russian, Serbian" msgstr "" -#: ../../library/codecs.rst:1138 +#: ../../library/codecs.rst:1146 msgid "cp856" msgstr "cp856" -#: ../../library/codecs.rst:1140 +#: ../../library/codecs.rst:1148 msgid "cp857" msgstr "cp857" -#: ../../library/codecs.rst:1140 +#: ../../library/codecs.rst:1148 msgid "857, IBM857" msgstr "857, IBM857" -#: ../../library/codecs.rst:1140 ../../library/codecs.rst:1173 -#: ../../library/codecs.rst:1190 ../../library/codecs.rst:1257 -#: ../../library/codecs.rst:1297 +#: ../../library/codecs.rst:1148 ../../library/codecs.rst:1181 +#: ../../library/codecs.rst:1198 ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1305 msgid "Turkish" msgstr "土耳其文" -#: ../../library/codecs.rst:1142 +#: ../../library/codecs.rst:1150 msgid "cp858" msgstr "cp858" -#: ../../library/codecs.rst:1142 +#: ../../library/codecs.rst:1150 msgid "858, IBM858" msgstr "858, IBM858" -#: ../../library/codecs.rst:1144 +#: ../../library/codecs.rst:1152 msgid "cp860" msgstr "cp860" -#: ../../library/codecs.rst:1144 +#: ../../library/codecs.rst:1152 msgid "860, IBM860" msgstr "860, IBM860" -#: ../../library/codecs.rst:1144 +#: ../../library/codecs.rst:1152 msgid "Portuguese" msgstr "" -#: ../../library/codecs.rst:1146 +#: ../../library/codecs.rst:1154 msgid "cp861" msgstr "cp861" -#: ../../library/codecs.rst:1146 +#: ../../library/codecs.rst:1154 msgid "861, CP-IS, IBM861" msgstr "861, CP-IS, IBM861" -#: ../../library/codecs.rst:1146 ../../library/codecs.rst:1290 +#: ../../library/codecs.rst:1154 ../../library/codecs.rst:1298 msgid "Icelandic" msgstr "" -#: ../../library/codecs.rst:1148 +#: ../../library/codecs.rst:1156 msgid "cp862" msgstr "cp862" -#: ../../library/codecs.rst:1148 +#: ../../library/codecs.rst:1156 msgid "862, IBM862" msgstr "862, IBM862" -#: ../../library/codecs.rst:1150 +#: ../../library/codecs.rst:1158 msgid "cp863" msgstr "cp863" -#: ../../library/codecs.rst:1150 +#: ../../library/codecs.rst:1158 msgid "863, IBM863" msgstr "863, IBM863" -#: ../../library/codecs.rst:1150 +#: ../../library/codecs.rst:1158 msgid "Canadian" msgstr "" -#: ../../library/codecs.rst:1152 +#: ../../library/codecs.rst:1160 msgid "cp864" msgstr "cp864" -#: ../../library/codecs.rst:1152 +#: ../../library/codecs.rst:1160 msgid "IBM864" msgstr "IBM864" -#: ../../library/codecs.rst:1154 +#: ../../library/codecs.rst:1162 msgid "cp865" msgstr "cp865" -#: ../../library/codecs.rst:1154 +#: ../../library/codecs.rst:1162 msgid "865, IBM865" msgstr "865, IBM865" -#: ../../library/codecs.rst:1154 +#: ../../library/codecs.rst:1162 msgid "Danish, Norwegian" msgstr "" -#: ../../library/codecs.rst:1156 +#: ../../library/codecs.rst:1164 msgid "cp866" msgstr "cp866" -#: ../../library/codecs.rst:1156 +#: ../../library/codecs.rst:1164 msgid "866, IBM866" msgstr "866, IBM866" -#: ../../library/codecs.rst:1156 ../../library/codecs.rst:1273 +#: ../../library/codecs.rst:1164 ../../library/codecs.rst:1281 msgid "Russian" msgstr "俄羅斯文" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1166 msgid "cp869" msgstr "cp869" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1166 msgid "869, CP-GR, IBM869" msgstr "869, CP-GR, IBM869" -#: ../../library/codecs.rst:1160 +#: ../../library/codecs.rst:1168 msgid "cp874" msgstr "cp874" -#: ../../library/codecs.rst:1160 +#: ../../library/codecs.rst:1168 msgid "Thai" msgstr "泰文" -#: ../../library/codecs.rst:1162 +#: ../../library/codecs.rst:1170 msgid "cp875" msgstr "cp875" -#: ../../library/codecs.rst:1164 +#: ../../library/codecs.rst:1172 msgid "cp932" msgstr "cp932" -#: ../../library/codecs.rst:1164 +#: ../../library/codecs.rst:1172 msgid "932, ms932, mskanji, ms-kanji, windows-31j" msgstr "932, ms932, mskanji, ms-kanji, windows-31j" -#: ../../library/codecs.rst:1164 ../../library/codecs.rst:1200 -#: ../../library/codecs.rst:1202 ../../library/codecs.rst:1204 -#: ../../library/codecs.rst:1221 ../../library/codecs.rst:1224 +#: ../../library/codecs.rst:1172 ../../library/codecs.rst:1208 +#: ../../library/codecs.rst:1210 ../../library/codecs.rst:1212 #: ../../library/codecs.rst:1229 ../../library/codecs.rst:1232 -#: ../../library/codecs.rst:1234 ../../library/codecs.rst:1302 -#: ../../library/codecs.rst:1305 ../../library/codecs.rst:1308 +#: ../../library/codecs.rst:1237 ../../library/codecs.rst:1240 +#: ../../library/codecs.rst:1242 ../../library/codecs.rst:1310 +#: ../../library/codecs.rst:1313 ../../library/codecs.rst:1316 msgid "Japanese" msgstr "日文" -#: ../../library/codecs.rst:1167 +#: ../../library/codecs.rst:1175 msgid "cp949" msgstr "cp949" -#: ../../library/codecs.rst:1167 +#: ../../library/codecs.rst:1175 msgid "949, ms949, uhc" msgstr "949, ms949, uhc" -#: ../../library/codecs.rst:1167 ../../library/codecs.rst:1206 -#: ../../library/codecs.rst:1236 ../../library/codecs.rst:1271 +#: ../../library/codecs.rst:1175 ../../library/codecs.rst:1214 +#: ../../library/codecs.rst:1244 ../../library/codecs.rst:1279 msgid "Korean" msgstr "韓文" -#: ../../library/codecs.rst:1169 +#: ../../library/codecs.rst:1177 msgid "cp950" msgstr "cp950" -#: ../../library/codecs.rst:1169 +#: ../../library/codecs.rst:1177 msgid "950, ms950" msgstr "950, ms950" -#: ../../library/codecs.rst:1171 +#: ../../library/codecs.rst:1179 msgid "cp1006" msgstr "cp1006" -#: ../../library/codecs.rst:1171 +#: ../../library/codecs.rst:1179 msgid "Urdu" msgstr "" -#: ../../library/codecs.rst:1173 +#: ../../library/codecs.rst:1181 msgid "cp1026" msgstr "cp1026" -#: ../../library/codecs.rst:1173 +#: ../../library/codecs.rst:1181 msgid "ibm1026" msgstr "ibm1026" -#: ../../library/codecs.rst:1175 +#: ../../library/codecs.rst:1183 msgid "cp1125" msgstr "cp1125" -#: ../../library/codecs.rst:1175 +#: ../../library/codecs.rst:1183 msgid "1125, ibm1125, cp866u, ruscii" msgstr "1125, ibm1125, cp866u, ruscii" -#: ../../library/codecs.rst:1175 ../../library/codecs.rst:1279 +#: ../../library/codecs.rst:1183 ../../library/codecs.rst:1287 msgid "Ukrainian" msgstr "烏克蘭文" -#: ../../library/codecs.rst:1179 +#: ../../library/codecs.rst:1187 msgid "cp1140" msgstr "cp1140" -#: ../../library/codecs.rst:1179 +#: ../../library/codecs.rst:1187 msgid "ibm1140" msgstr "ibm1140" -#: ../../library/codecs.rst:1181 +#: ../../library/codecs.rst:1189 msgid "cp1250" msgstr "cp1250" -#: ../../library/codecs.rst:1181 +#: ../../library/codecs.rst:1189 msgid "windows-1250" msgstr "windows-1250" -#: ../../library/codecs.rst:1183 +#: ../../library/codecs.rst:1191 msgid "cp1251" msgstr "cp1251" -#: ../../library/codecs.rst:1183 +#: ../../library/codecs.rst:1191 msgid "windows-1251" msgstr "windows-1251" -#: ../../library/codecs.rst:1186 +#: ../../library/codecs.rst:1194 msgid "cp1252" msgstr "cp1252" -#: ../../library/codecs.rst:1186 +#: ../../library/codecs.rst:1194 msgid "windows-1252" msgstr "windows-1252" -#: ../../library/codecs.rst:1188 +#: ../../library/codecs.rst:1196 msgid "cp1253" msgstr "cp1253" -#: ../../library/codecs.rst:1188 +#: ../../library/codecs.rst:1196 msgid "windows-1253" msgstr "windows-1253" -#: ../../library/codecs.rst:1190 +#: ../../library/codecs.rst:1198 msgid "cp1254" msgstr "cp1254" -#: ../../library/codecs.rst:1190 +#: ../../library/codecs.rst:1198 msgid "windows-1254" msgstr "windows-1254" -#: ../../library/codecs.rst:1192 +#: ../../library/codecs.rst:1200 msgid "cp1255" msgstr "cp1255" -#: ../../library/codecs.rst:1192 +#: ../../library/codecs.rst:1200 msgid "windows-1255" msgstr "windows-1255" -#: ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1202 msgid "cp1256" msgstr "cp1256" -#: ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1202 msgid "windows-1256" msgstr "windows-1256" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1204 msgid "cp1257" msgstr "cp1257" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1204 msgid "windows-1257" msgstr "windows-1257" -#: ../../library/codecs.rst:1198 +#: ../../library/codecs.rst:1206 msgid "cp1258" msgstr "cp1258" -#: ../../library/codecs.rst:1198 +#: ../../library/codecs.rst:1206 msgid "windows-1258" msgstr "windows-1258" -#: ../../library/codecs.rst:1198 +#: ../../library/codecs.rst:1206 msgid "Vietnamese" msgstr "越南文" -#: ../../library/codecs.rst:1200 +#: ../../library/codecs.rst:1208 msgid "euc_jp" msgstr "euc_jp" -#: ../../library/codecs.rst:1200 +#: ../../library/codecs.rst:1208 msgid "eucjp, ujis, u-jis" msgstr "eucjp, ujis, u-jis" -#: ../../library/codecs.rst:1202 +#: ../../library/codecs.rst:1210 msgid "euc_jis_2004" msgstr "euc_jis_2004" -#: ../../library/codecs.rst:1202 +#: ../../library/codecs.rst:1210 msgid "jisx0213, eucjis2004" msgstr "jisx0213, eucjis2004" -#: ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1212 msgid "euc_jisx0213" msgstr "euc_jisx0213" -#: ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1212 msgid "eucjisx0213" msgstr "eucjisx0213" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1214 msgid "euc_kr" msgstr "euc_kr" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1214 msgid "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" msgstr "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" -#: ../../library/codecs.rst:1210 +#: ../../library/codecs.rst:1218 msgid "gb2312" msgstr "gb2312" -#: ../../library/codecs.rst:1210 +#: ../../library/codecs.rst:1218 msgid "" "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " "gb2312-80, iso-ir-58" @@ -1890,450 +1904,450 @@ msgstr "" "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " "gb2312-80, iso-ir-58" -#: ../../library/codecs.rst:1210 ../../library/codecs.rst:1219 +#: ../../library/codecs.rst:1218 ../../library/codecs.rst:1227 msgid "Simplified Chinese" msgstr "簡體中文" -#: ../../library/codecs.rst:1215 +#: ../../library/codecs.rst:1223 msgid "gbk" msgstr "gbk" -#: ../../library/codecs.rst:1215 +#: ../../library/codecs.rst:1223 msgid "936, cp936, ms936" msgstr "936, cp936, ms936" -#: ../../library/codecs.rst:1215 ../../library/codecs.rst:1217 +#: ../../library/codecs.rst:1223 ../../library/codecs.rst:1225 msgid "Unified Chinese" msgstr "" -#: ../../library/codecs.rst:1217 +#: ../../library/codecs.rst:1225 msgid "gb18030" msgstr "gb18030" -#: ../../library/codecs.rst:1217 +#: ../../library/codecs.rst:1225 msgid "gb18030-2000" msgstr "gb18030-2000" -#: ../../library/codecs.rst:1219 +#: ../../library/codecs.rst:1227 msgid "hz" msgstr "hz" -#: ../../library/codecs.rst:1219 +#: ../../library/codecs.rst:1227 msgid "hzgb, hz-gb, hz-gb-2312" msgstr "hzgb, hz-gb, hz-gb-2312" -#: ../../library/codecs.rst:1221 +#: ../../library/codecs.rst:1229 msgid "iso2022_jp" msgstr "iso2022_jp" -#: ../../library/codecs.rst:1221 +#: ../../library/codecs.rst:1229 msgid "csiso2022jp, iso2022jp, iso-2022-jp" msgstr "csiso2022jp, iso2022jp, iso-2022-jp" -#: ../../library/codecs.rst:1224 +#: ../../library/codecs.rst:1232 msgid "iso2022_jp_1" msgstr "iso2022_jp_1" -#: ../../library/codecs.rst:1224 +#: ../../library/codecs.rst:1232 msgid "iso2022jp-1, iso-2022-jp-1" msgstr "iso2022jp-1, iso-2022-jp-1" -#: ../../library/codecs.rst:1226 +#: ../../library/codecs.rst:1234 msgid "iso2022_jp_2" msgstr "iso2022_jp_2" -#: ../../library/codecs.rst:1226 +#: ../../library/codecs.rst:1234 msgid "iso2022jp-2, iso-2022-jp-2" msgstr "iso2022jp-2, iso-2022-jp-2" -#: ../../library/codecs.rst:1226 +#: ../../library/codecs.rst:1234 msgid "Japanese, Korean, Simplified Chinese, Western Europe, Greek" msgstr "" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1237 msgid "iso2022_jp_2004" msgstr "iso2022_jp_2004" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1237 msgid "iso2022jp-2004, iso-2022-jp-2004" msgstr "iso2022jp-2004, iso-2022-jp-2004" -#: ../../library/codecs.rst:1232 +#: ../../library/codecs.rst:1240 msgid "iso2022_jp_3" msgstr "iso2022_jp_3" -#: ../../library/codecs.rst:1232 +#: ../../library/codecs.rst:1240 msgid "iso2022jp-3, iso-2022-jp-3" msgstr "iso2022jp-3, iso-2022-jp-3" -#: ../../library/codecs.rst:1234 +#: ../../library/codecs.rst:1242 msgid "iso2022_jp_ext" msgstr "iso2022_jp_ext" -#: ../../library/codecs.rst:1234 +#: ../../library/codecs.rst:1242 msgid "iso2022jp-ext, iso-2022-jp-ext" msgstr "iso2022jp-ext, iso-2022-jp-ext" -#: ../../library/codecs.rst:1236 +#: ../../library/codecs.rst:1244 msgid "iso2022_kr" msgstr "iso2022_kr" -#: ../../library/codecs.rst:1236 +#: ../../library/codecs.rst:1244 msgid "csiso2022kr, iso2022kr, iso-2022-kr" msgstr "csiso2022kr, iso2022kr, iso-2022-kr" -#: ../../library/codecs.rst:1239 +#: ../../library/codecs.rst:1247 msgid "latin_1" msgstr "latin_1" -#: ../../library/codecs.rst:1239 +#: ../../library/codecs.rst:1247 msgid "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" msgstr "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" -#: ../../library/codecs.rst:1242 +#: ../../library/codecs.rst:1250 msgid "iso8859_2" msgstr "iso8859_2" -#: ../../library/codecs.rst:1242 +#: ../../library/codecs.rst:1250 msgid "iso-8859-2, latin2, L2" msgstr "iso-8859-2, latin2, L2" -#: ../../library/codecs.rst:1244 +#: ../../library/codecs.rst:1252 msgid "iso8859_3" msgstr "iso8859_3" -#: ../../library/codecs.rst:1244 +#: ../../library/codecs.rst:1252 msgid "iso-8859-3, latin3, L3" msgstr "iso-8859-3, latin3, L3" -#: ../../library/codecs.rst:1244 +#: ../../library/codecs.rst:1252 msgid "Esperanto, Maltese" msgstr "" -#: ../../library/codecs.rst:1246 +#: ../../library/codecs.rst:1254 msgid "iso8859_4" msgstr "iso8859_4" -#: ../../library/codecs.rst:1246 +#: ../../library/codecs.rst:1254 msgid "iso-8859-4, latin4, L4" msgstr "iso-8859-4, latin4, L4" -#: ../../library/codecs.rst:1246 -msgid "Northern Europe" -msgstr "" - -#: ../../library/codecs.rst:1248 +#: ../../library/codecs.rst:1256 msgid "iso8859_5" msgstr "iso8859_5" -#: ../../library/codecs.rst:1248 +#: ../../library/codecs.rst:1256 msgid "iso-8859-5, cyrillic" msgstr "iso-8859-5, cyrillic" -#: ../../library/codecs.rst:1251 +#: ../../library/codecs.rst:1259 msgid "iso8859_6" msgstr "iso8859_6" -#: ../../library/codecs.rst:1251 +#: ../../library/codecs.rst:1259 msgid "iso-8859-6, arabic" msgstr "iso-8859-6, arabic" -#: ../../library/codecs.rst:1253 +#: ../../library/codecs.rst:1261 msgid "iso8859_7" msgstr "iso8859_7" -#: ../../library/codecs.rst:1253 +#: ../../library/codecs.rst:1261 msgid "iso-8859-7, greek, greek8" msgstr "iso-8859-7, greek, greek8" -#: ../../library/codecs.rst:1255 +#: ../../library/codecs.rst:1263 msgid "iso8859_8" msgstr "iso8859_8" -#: ../../library/codecs.rst:1255 +#: ../../library/codecs.rst:1263 msgid "iso-8859-8, hebrew" msgstr "iso-8859-8, hebrew" -#: ../../library/codecs.rst:1257 +#: ../../library/codecs.rst:1265 msgid "iso8859_9" msgstr "iso8859_9" -#: ../../library/codecs.rst:1257 +#: ../../library/codecs.rst:1265 msgid "iso-8859-9, latin5, L5" msgstr "iso-8859-9, latin5, L5" -#: ../../library/codecs.rst:1259 +#: ../../library/codecs.rst:1267 msgid "iso8859_10" msgstr "iso8859_10" -#: ../../library/codecs.rst:1259 +#: ../../library/codecs.rst:1267 msgid "iso-8859-10, latin6, L6" msgstr "iso-8859-10, latin6, L6" -#: ../../library/codecs.rst:1259 +#: ../../library/codecs.rst:1267 msgid "Nordic languages" msgstr "" -#: ../../library/codecs.rst:1261 +#: ../../library/codecs.rst:1269 msgid "iso8859_11" msgstr "iso8859_11" -#: ../../library/codecs.rst:1261 +#: ../../library/codecs.rst:1269 msgid "iso-8859-11, thai" msgstr "iso-8859-11, thai" -#: ../../library/codecs.rst:1261 +#: ../../library/codecs.rst:1269 msgid "Thai languages" msgstr "泰語" -#: ../../library/codecs.rst:1263 +#: ../../library/codecs.rst:1271 msgid "iso8859_13" msgstr "iso8859_13" -#: ../../library/codecs.rst:1263 +#: ../../library/codecs.rst:1271 msgid "iso-8859-13, latin7, L7" msgstr "iso-8859-13, latin7, L7" -#: ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1273 msgid "iso8859_14" msgstr "iso8859_14" -#: ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1273 msgid "iso-8859-14, latin8, L8" msgstr "iso-8859-14, latin8, L8" -#: ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1273 msgid "Celtic languages" msgstr "" -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1275 msgid "iso8859_15" msgstr "iso8859_15" -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1275 msgid "iso-8859-15, latin9, L9" msgstr "iso-8859-15, latin9, L9" -#: ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1277 msgid "iso8859_16" msgstr "iso8859_16" -#: ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1277 msgid "iso-8859-16, latin10, L10" msgstr "iso-8859-16, latin10, L10" -#: ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1277 msgid "South-Eastern Europe" msgstr "" -#: ../../library/codecs.rst:1271 +#: ../../library/codecs.rst:1279 msgid "johab" msgstr "" -#: ../../library/codecs.rst:1271 +#: ../../library/codecs.rst:1279 msgid "cp1361, ms1361" msgstr "cp1361, ms1361" -#: ../../library/codecs.rst:1273 +#: ../../library/codecs.rst:1281 msgid "koi8_r" msgstr "koi8_r" -#: ../../library/codecs.rst:1275 +#: ../../library/codecs.rst:1283 msgid "koi8_t" msgstr "koi8_t" -#: ../../library/codecs.rst:1275 +#: ../../library/codecs.rst:1283 msgid "Tajik" msgstr "" -#: ../../library/codecs.rst:1279 +#: ../../library/codecs.rst:1287 msgid "koi8_u" msgstr "koi8_u" -#: ../../library/codecs.rst:1281 +#: ../../library/codecs.rst:1289 msgid "kz1048" msgstr "kz1048" -#: ../../library/codecs.rst:1281 +#: ../../library/codecs.rst:1289 msgid "kz_1048, strk1048_2002, rk1048" msgstr "kz_1048, strk1048_2002, rk1048" -#: ../../library/codecs.rst:1281 ../../library/codecs.rst:1299 +#: ../../library/codecs.rst:1289 ../../library/codecs.rst:1307 msgid "Kazakh" msgstr "" -#: ../../library/codecs.rst:1285 +#: ../../library/codecs.rst:1293 msgid "mac_cyrillic" msgstr "mac_cyrillic" -#: ../../library/codecs.rst:1285 +#: ../../library/codecs.rst:1293 msgid "maccyrillic" msgstr "" -#: ../../library/codecs.rst:1288 +#: ../../library/codecs.rst:1296 msgid "mac_greek" msgstr "mac_greek" -#: ../../library/codecs.rst:1288 +#: ../../library/codecs.rst:1296 msgid "macgreek" msgstr "" -#: ../../library/codecs.rst:1290 +#: ../../library/codecs.rst:1298 msgid "mac_iceland" msgstr "mac_iceland" -#: ../../library/codecs.rst:1290 +#: ../../library/codecs.rst:1298 msgid "maciceland" msgstr "" -#: ../../library/codecs.rst:1292 +#: ../../library/codecs.rst:1300 msgid "mac_latin2" msgstr "mac_latin2" -#: ../../library/codecs.rst:1292 +#: ../../library/codecs.rst:1300 msgid "maclatin2, maccentraleurope, mac_centeuro" msgstr "maclatin2, maccentraleurope, mac_centeuro" -#: ../../library/codecs.rst:1295 +#: ../../library/codecs.rst:1303 msgid "mac_roman" msgstr "mac_roman" -#: ../../library/codecs.rst:1295 +#: ../../library/codecs.rst:1303 msgid "macroman, macintosh" msgstr "macroman, macintosh" -#: ../../library/codecs.rst:1297 +#: ../../library/codecs.rst:1305 msgid "mac_turkish" msgstr "mac_turkish" -#: ../../library/codecs.rst:1297 +#: ../../library/codecs.rst:1305 msgid "macturkish" msgstr "" -#: ../../library/codecs.rst:1299 +#: ../../library/codecs.rst:1307 msgid "ptcp154" msgstr "ptcp154" -#: ../../library/codecs.rst:1299 +#: ../../library/codecs.rst:1307 msgid "csptcp154, pt154, cp154, cyrillic-asian" msgstr "csptcp154, pt154, cp154, cyrillic-asian" -#: ../../library/codecs.rst:1302 +#: ../../library/codecs.rst:1310 msgid "shift_jis" msgstr "shift_jis" -#: ../../library/codecs.rst:1302 +#: ../../library/codecs.rst:1310 msgid "csshiftjis, shiftjis, sjis, s_jis" msgstr "csshiftjis, shiftjis, sjis, s_jis" -#: ../../library/codecs.rst:1305 +#: ../../library/codecs.rst:1313 msgid "shift_jis_2004" msgstr "shift_jis_2004" -#: ../../library/codecs.rst:1305 +#: ../../library/codecs.rst:1313 msgid "shiftjis2004, sjis_2004, sjis2004" msgstr "shiftjis2004, sjis_2004, sjis2004" -#: ../../library/codecs.rst:1308 +#: ../../library/codecs.rst:1316 msgid "shift_jisx0213" msgstr "shift_jisx0213" -#: ../../library/codecs.rst:1308 +#: ../../library/codecs.rst:1316 msgid "shiftjisx0213, sjisx0213, s_jisx0213" msgstr "shiftjisx0213, sjisx0213, s_jisx0213" -#: ../../library/codecs.rst:1311 +#: ../../library/codecs.rst:1319 msgid "utf_32" msgstr "utf_32" -#: ../../library/codecs.rst:1311 +#: ../../library/codecs.rst:1319 msgid "U32, utf32" msgstr "U32, utf32" -#: ../../library/codecs.rst:1311 ../../library/codecs.rst:1313 -#: ../../library/codecs.rst:1315 ../../library/codecs.rst:1317 #: ../../library/codecs.rst:1319 ../../library/codecs.rst:1321 #: ../../library/codecs.rst:1323 ../../library/codecs.rst:1325 -#: ../../library/codecs.rst:1327 +#: ../../library/codecs.rst:1327 ../../library/codecs.rst:1329 +#: ../../library/codecs.rst:1331 ../../library/codecs.rst:1333 +#: ../../library/codecs.rst:1335 msgid "all languages" msgstr "" -#: ../../library/codecs.rst:1313 +#: ../../library/codecs.rst:1321 msgid "utf_32_be" msgstr "utf_32_be" -#: ../../library/codecs.rst:1313 +#: ../../library/codecs.rst:1321 msgid "UTF-32BE" msgstr "UTF-32BE" -#: ../../library/codecs.rst:1315 +#: ../../library/codecs.rst:1323 msgid "utf_32_le" msgstr "utf_32_le" -#: ../../library/codecs.rst:1315 +#: ../../library/codecs.rst:1323 msgid "UTF-32LE" msgstr "UTF-32LE" -#: ../../library/codecs.rst:1317 +#: ../../library/codecs.rst:1325 msgid "utf_16" msgstr "utf_16" -#: ../../library/codecs.rst:1317 +#: ../../library/codecs.rst:1325 msgid "U16, utf16" msgstr "U16, utf16" -#: ../../library/codecs.rst:1319 +#: ../../library/codecs.rst:1327 msgid "utf_16_be" msgstr "utf_16_be" -#: ../../library/codecs.rst:1319 +#: ../../library/codecs.rst:1327 msgid "UTF-16BE" msgstr "UTF-16BE" -#: ../../library/codecs.rst:1321 +#: ../../library/codecs.rst:1329 msgid "utf_16_le" msgstr "utf_16_le" -#: ../../library/codecs.rst:1321 +#: ../../library/codecs.rst:1329 msgid "UTF-16LE" msgstr "UTF-16LE" -#: ../../library/codecs.rst:1323 +#: ../../library/codecs.rst:1331 msgid "utf_7" msgstr "utf_7" -#: ../../library/codecs.rst:1323 +#: ../../library/codecs.rst:1331 msgid "U7, unicode-1-1-utf-7" msgstr "U7, unicode-1-1-utf-7" -#: ../../library/codecs.rst:1325 +#: ../../library/codecs.rst:1333 msgid "utf_8" msgstr "utf_8" -#: ../../library/codecs.rst:1325 +#: ../../library/codecs.rst:1333 msgid "U8, UTF, utf8, cp65001" msgstr "U8, UTF, utf8, cp65001" -#: ../../library/codecs.rst:1327 +#: ../../library/codecs.rst:1335 msgid "utf_8_sig" msgstr "utf_8_sig" -#: ../../library/codecs.rst:1330 +#: ../../library/codecs.rst:1338 msgid "" "The utf-16\\* and utf-32\\* encoders no longer allow surrogate code points " "(``U+D800``--``U+DFFF``) to be encoded. The utf-32\\* decoders no longer " "decode byte sequences that correspond to surrogate code points." msgstr "" -#: ../../library/codecs.rst:1336 +#: ../../library/codecs.rst:1344 msgid "``cp65001`` is now an alias to ``utf_8``." msgstr "``cp65001`` 現在是 ``utf_8`` 的別名。" -#: ../../library/codecs.rst:1341 +#: ../../library/codecs.rst:1347 +msgid "On Windows, ``cpXXX`` codecs are now available for all code pages." +msgstr "" + +#: ../../library/codecs.rst:1352 msgid "Python Specific Encodings" msgstr "" -#: ../../library/codecs.rst:1343 +#: ../../library/codecs.rst:1354 msgid "" "A number of predefined codecs are specific to Python, so their codec names " "have no meaning outside Python. These are listed in the tables below based " @@ -2343,316 +2357,279 @@ msgid "" "asymmetric codecs, the stated meaning describes the encoding direction." msgstr "" -#: ../../library/codecs.rst:1351 +#: ../../library/codecs.rst:1362 msgid "Text Encodings" msgstr "" -#: ../../library/codecs.rst:1353 +#: ../../library/codecs.rst:1364 msgid "" -"The following codecs provide :class:`str` to :class:`bytes` encoding and :" -"term:`bytes-like object` to :class:`str` decoding, similar to the Unicode " -"text encodings." +"The following codecs provide :class:`str` to :class:`bytes` encoding " +"and :term:`bytes-like object` to :class:`str` decoding, similar to the " +"Unicode text encodings." msgstr "" -#: ../../library/codecs.rst:1362 +#: ../../library/codecs.rst:1373 msgid "idna" msgstr "idna" -#: ../../library/codecs.rst:1362 +#: ../../library/codecs.rst:1373 msgid "" "Implement :rfc:`3490`, see also :mod:`encodings.idna`. Only " "``errors='strict'`` is supported." msgstr "" -#: ../../library/codecs.rst:1368 +#: ../../library/codecs.rst:1379 msgid "mbcs" msgstr "mbcs" -#: ../../library/codecs.rst:1368 +#: ../../library/codecs.rst:1379 msgid "ansi, dbcs" msgstr "ansi, dbcs" -#: ../../library/codecs.rst:1368 +#: ../../library/codecs.rst:1379 msgid "" "Windows only: Encode the operand according to the ANSI codepage (CP_ACP)." msgstr "" -#: ../../library/codecs.rst:1372 +#: ../../library/codecs.rst:1383 msgid "oem" msgstr "oem" -#: ../../library/codecs.rst:1372 +#: ../../library/codecs.rst:1383 msgid "" "Windows only: Encode the operand according to the OEM codepage (CP_OEMCP)." msgstr "" -#: ../../library/codecs.rst:1378 +#: ../../library/codecs.rst:1389 msgid "palmos" msgstr "" -#: ../../library/codecs.rst:1378 +#: ../../library/codecs.rst:1389 msgid "Encoding of PalmOS 3.5." msgstr "" -#: ../../library/codecs.rst:1380 +#: ../../library/codecs.rst:1391 msgid "punycode" msgstr "" -#: ../../library/codecs.rst:1380 +#: ../../library/codecs.rst:1391 msgid "Implement :rfc:`3492`. Stateful codecs are not supported." msgstr "" -#: ../../library/codecs.rst:1384 +#: ../../library/codecs.rst:1395 msgid "raw_unicode_escape" msgstr "raw_unicode_escape" -#: ../../library/codecs.rst:1384 +#: ../../library/codecs.rst:1395 msgid "" "Latin-1 encoding with :samp:`\\\\u{XXXX}` and :samp:`\\\\U{XXXXXXXX}` for " "other code points. Existing backslashes are not escaped in any way. It is " "used in the Python pickle protocol." msgstr "" -#: ../../library/codecs.rst:1394 +#: ../../library/codecs.rst:1405 msgid "undefined" msgstr "" -#: ../../library/codecs.rst:1394 +#: ../../library/codecs.rst:1405 msgid "This Codec should only be used for testing purposes." msgstr "" -#: ../../library/codecs.rst:1398 +#: ../../library/codecs.rst:1409 msgid "" "Raise an exception for all conversions, even empty strings. The error " "handler is ignored." msgstr "" -#: ../../library/codecs.rst:1403 +#: ../../library/codecs.rst:1414 msgid "unicode_escape" msgstr "unicode_escape" -#: ../../library/codecs.rst:1403 +#: ../../library/codecs.rst:1414 msgid "" "Encoding suitable as the contents of a Unicode literal in ASCII-encoded " "Python source code, except that quotes are not escaped. Decode from Latin-1 " "source code. Beware that Python source code actually uses UTF-8 by default." msgstr "" -#: ../../library/codecs.rst:1415 +#: ../../library/codecs.rst:1426 msgid "\"unicode_internal\" codec is removed." msgstr "" -#: ../../library/codecs.rst:1422 +#: ../../library/codecs.rst:1433 msgid "Binary Transforms" msgstr "" -#: ../../library/codecs.rst:1424 +#: ../../library/codecs.rst:1435 msgid "" "The following codecs provide binary transforms: :term:`bytes-like object` " "to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode` " "(which only produces :class:`str` output)." msgstr "" -#: ../../library/codecs.rst:1432 +#: ../../library/codecs.rst:1443 msgid "Encoder / decoder" msgstr "" -#: ../../library/codecs.rst:1434 +#: ../../library/codecs.rst:1445 msgid "base64_codec [#b64]_" msgstr "base64_codec [#b64]_" -#: ../../library/codecs.rst:1434 +#: ../../library/codecs.rst:1445 msgid "base64, base_64" msgstr "base64, base_64" -#: ../../library/codecs.rst:1434 +#: ../../library/codecs.rst:1445 msgid "" "Convert the operand to multiline MIME base64 (the result always includes a " "trailing ``'\\n'``)." msgstr "" -#: ../../library/codecs.rst:1439 +#: ../../library/codecs.rst:1450 msgid "" "accepts any :term:`bytes-like object` as input for encoding and decoding" msgstr "" -#: ../../library/codecs.rst:1434 +#: ../../library/codecs.rst:1445 msgid ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" msgstr ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" -#: ../../library/codecs.rst:1445 +#: ../../library/codecs.rst:1456 msgid "bz2_codec" msgstr "bz2_codec" -#: ../../library/codecs.rst:1445 +#: ../../library/codecs.rst:1456 msgid "bz2" msgstr "bz2" -#: ../../library/codecs.rst:1445 +#: ../../library/codecs.rst:1456 msgid "Compress the operand using bz2." msgstr "" -#: ../../library/codecs.rst:1445 +#: ../../library/codecs.rst:1456 msgid ":meth:`bz2.compress` / :meth:`bz2.decompress`" msgstr ":meth:`bz2.compress` / :meth:`bz2.decompress`" -#: ../../library/codecs.rst:1448 +#: ../../library/codecs.rst:1459 msgid "hex_codec" msgstr "hex_codec" -#: ../../library/codecs.rst:1448 +#: ../../library/codecs.rst:1459 msgid "hex" msgstr "hex" -#: ../../library/codecs.rst:1448 +#: ../../library/codecs.rst:1459 msgid "" "Convert the operand to hexadecimal representation, with two digits per byte." msgstr "" -#: ../../library/codecs.rst:1448 +#: ../../library/codecs.rst:1459 msgid ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" msgstr ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" -#: ../../library/codecs.rst:1453 +#: ../../library/codecs.rst:1464 msgid "quopri_codec" msgstr "quopri_codec" -#: ../../library/codecs.rst:1453 +#: ../../library/codecs.rst:1464 msgid "quopri, quotedprintable, quoted_printable" msgstr "quopri, quotedprintable, quoted_printable" -#: ../../library/codecs.rst:1453 +#: ../../library/codecs.rst:1464 msgid "Convert the operand to MIME quoted printable." msgstr "" -#: ../../library/codecs.rst:1453 +#: ../../library/codecs.rst:1464 msgid ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" msgstr ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" -#: ../../library/codecs.rst:1457 +#: ../../library/codecs.rst:1468 msgid "uu_codec" msgstr "uu_codec" -#: ../../library/codecs.rst:1457 +#: ../../library/codecs.rst:1468 msgid "uu" msgstr "uu" -#: ../../library/codecs.rst:1457 +#: ../../library/codecs.rst:1468 msgid "Convert the operand using uuencode." msgstr "" -#: ../../library/codecs.rst:1460 +#: ../../library/codecs.rst:1471 msgid "zlib_codec" msgstr "zlib_codec" -#: ../../library/codecs.rst:1460 +#: ../../library/codecs.rst:1471 msgid "zip, zlib" msgstr "zip, zlib" -#: ../../library/codecs.rst:1460 +#: ../../library/codecs.rst:1471 msgid "Compress the operand using gzip." msgstr "" -#: ../../library/codecs.rst:1460 +#: ../../library/codecs.rst:1471 msgid ":meth:`zlib.compress` / :meth:`zlib.decompress`" msgstr ":meth:`zlib.compress` / :meth:`zlib.decompress`" -#: ../../library/codecs.rst:1464 +#: ../../library/codecs.rst:1475 msgid "" "In addition to :term:`bytes-like objects `, " "``'base64_codec'`` also accepts ASCII-only instances of :class:`str` for " "decoding" msgstr "" -#: ../../library/codecs.rst:1468 +#: ../../library/codecs.rst:1479 msgid "Restoration of the binary transforms." msgstr "" -#: ../../library/codecs.rst:1471 +#: ../../library/codecs.rst:1482 msgid "Restoration of the aliases for the binary transforms." msgstr "" -#: ../../library/codecs.rst:1478 -msgid "Standalone Codec Functions" -msgstr "" - -#: ../../library/codecs.rst:1480 -msgid "" -"The following functions provide encoding and decoding functionality similar " -"to codecs, but are not available as named codecs through :func:`codecs." -"encode` or :func:`codecs.decode`. They are used internally (for example, by :" -"mod:`pickle`) and behave similarly to the ``string_escape`` codec that was " -"removed in Python 3." -msgstr "" - -#: ../../library/codecs.rst:1487 -msgid "" -"Encode *input* using escape sequences. Similar to how :func:`repr` on bytes " -"produces escaped byte values." -msgstr "" - -#: ../../library/codecs.rst:1490 -msgid "*input* must be a :class:`bytes` object." -msgstr "*input* 必須是 :class:`bytes` 物件。" - -#: ../../library/codecs.rst:1492 ../../library/codecs.rst:1501 -msgid "" -"Returns a tuple ``(output, length)`` where *output* is a :class:`bytes` " -"object and *length* is the number of bytes consumed." -msgstr "" - -#: ../../library/codecs.rst:1497 -msgid "Decode *input* from escape sequences back to the original bytes." -msgstr "" - -#: ../../library/codecs.rst:1499 -msgid "*input* must be a :term:`bytes-like object`." -msgstr "*input* 必須是 :term:`bytes-like object`。" - -#: ../../library/codecs.rst:1508 +#: ../../library/codecs.rst:1489 msgid "Text Transforms" msgstr "" -#: ../../library/codecs.rst:1510 +#: ../../library/codecs.rst:1491 msgid "" -"The following codec provides a text transform: a :class:`str` to :class:" -"`str` mapping. It is not supported by :meth:`str.encode` (which only " -"produces :class:`bytes` output)." +"The following codec provides a text transform: a :class:`str` " +"to :class:`str` mapping. It is not supported by :meth:`str.encode` (which " +"only produces :class:`bytes` output)." msgstr "" -#: ../../library/codecs.rst:1519 +#: ../../library/codecs.rst:1500 msgid "rot_13" msgstr "rot_13" -#: ../../library/codecs.rst:1519 +#: ../../library/codecs.rst:1500 msgid "rot13" msgstr "" -#: ../../library/codecs.rst:1519 +#: ../../library/codecs.rst:1500 msgid "Return the Caesar-cypher encryption of the operand." msgstr "" -#: ../../library/codecs.rst:1524 +#: ../../library/codecs.rst:1505 msgid "Restoration of the ``rot_13`` text transform." msgstr "" -#: ../../library/codecs.rst:1527 +#: ../../library/codecs.rst:1508 msgid "Restoration of the ``rot13`` alias." msgstr "" -#: ../../library/codecs.rst:1532 +#: ../../library/codecs.rst:1513 msgid ":mod:`encodings` --- Encodings package" msgstr "" -#: ../../library/codecs.rst:1537 +#: ../../library/codecs.rst:1518 msgid "This module implements the following functions:" msgstr "" -#: ../../library/codecs.rst:1541 +#: ../../library/codecs.rst:1522 msgid "Normalize encoding name *encoding*." msgstr "" -#: ../../library/codecs.rst:1543 +#: ../../library/codecs.rst:1524 msgid "" "Normalization works as follows: all non-alphanumeric characters except the " "dot used for Python package names are collapsed and replaced with a single " @@ -2660,52 +2637,67 @@ msgid "" "-;#'`` becomes ``'_'``." msgstr "" -#: ../../library/codecs.rst:1548 +#: ../../library/codecs.rst:1529 msgid "Note that *encoding* should be ASCII only." msgstr "" -#: ../../library/codecs.rst:1552 +#: ../../library/codecs.rst:1533 msgid "" -"The following function should not be used directly, except for testing " +"The following functions should not be used directly, except for testing " "purposes; :func:`codecs.lookup` should be used instead." msgstr "" -#: ../../library/codecs.rst:1558 +#: ../../library/codecs.rst:1539 msgid "" "Search for the codec module corresponding to the given encoding name " "*encoding*." msgstr "" -#: ../../library/codecs.rst:1561 +#: ../../library/codecs.rst:1542 msgid "" -"This function first normalizes the *encoding* using :func:" -"`normalize_encoding`, then looks for a corresponding alias. It attempts to " -"import a codec module from the encodings package using either the alias or " -"the normalized name. If the module is found and defines a valid " +"This function first normalizes the *encoding* " +"using :func:`normalize_encoding`, then looks for a corresponding alias. It " +"attempts to import a codec module from the encodings package using either " +"the alias or the normalized name. If the module is found and defines a valid " "``getregentry()`` function that returns a :class:`codecs.CodecInfo` object, " "the codec is cached and returned." msgstr "" -#: ../../library/codecs.rst:1568 +#: ../../library/codecs.rst:1549 msgid "" "If the codec module defines a ``getaliases()`` function any returned aliases " "are registered for future use." msgstr "" -#: ../../library/codecs.rst:1572 +#: ../../library/codecs.rst:1555 +msgid "" +"Search for a Windows code page encoding *encoding* of the form ``cpXXXX``." +msgstr "" + +#: ../../library/codecs.rst:1557 +msgid "" +"If the code page is valid and supported, return a :class:`codecs.CodecInfo` " +"object for it." +msgstr "" + +#: ../../library/codecs.rst:1560 ../../library/codecs.rst:1646 +msgid "Availability" +msgstr "可用性" + +#: ../../library/codecs.rst:1565 msgid "This module implements the following exception:" msgstr "" -#: ../../library/codecs.rst:1576 +#: ../../library/codecs.rst:1569 msgid "Raised when a codec is invalid or incompatible." msgstr "" -#: ../../library/codecs.rst:1580 +#: ../../library/codecs.rst:1573 msgid "" ":mod:`encodings.idna` --- Internationalized Domain Names in Applications" msgstr "" -#: ../../library/codecs.rst:1586 +#: ../../library/codecs.rst:1579 msgid "" "This module implements :rfc:`3490` (Internationalized Domain Names in " "Applications) and :rfc:`3492` (Nameprep: A Stringprep Profile for " @@ -2713,27 +2705,27 @@ msgid "" "encoding and :mod:`stringprep`." msgstr "" -#: ../../library/codecs.rst:1591 +#: ../../library/codecs.rst:1584 msgid "" "If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the " "third-party :pypi:`idna` module." msgstr "" -#: ../../library/codecs.rst:1594 +#: ../../library/codecs.rst:1587 msgid "" "These RFCs together define a protocol to support non-ASCII characters in " -"domain names. A domain name containing non-ASCII characters (such as ``www." -"Alliancefrançaise.nu``) is converted into an ASCII-compatible encoding (ACE, " -"such as ``www.xn--alliancefranaise-npb.nu``). The ACE form of the domain " -"name is then used in all places where arbitrary characters are not allowed " -"by the protocol, such as DNS queries, HTTP :mailheader:`Host` fields, and so " -"on. This conversion is carried out in the application; if possible invisible " -"to the user: The application should transparently convert Unicode domain " -"labels to IDNA on the wire, and convert back ACE labels to Unicode before " -"presenting them to the user." +"domain names. A domain name containing non-ASCII characters (such as " +"``www.Alliancefrançaise.nu``) is converted into an ASCII-compatible encoding " +"(ACE, such as ``www.xn--alliancefranaise-npb.nu``). The ACE form of the " +"domain name is then used in all places where arbitrary characters are not " +"allowed by the protocol, such as DNS queries, HTTP :mailheader:`Host` " +"fields, and so on. This conversion is carried out in the application; if " +"possible invisible to the user: The application should transparently convert " +"Unicode domain labels to IDNA on the wire, and convert back ACE labels to " +"Unicode before presenting them to the user." msgstr "" -#: ../../library/codecs.rst:1605 +#: ../../library/codecs.rst:1598 msgid "" "Python supports this conversion in several ways: the ``idna`` codec " "performs conversion between Unicode and ACE, separating an input string into " @@ -2744,20 +2736,20 @@ msgid "" "the :mod:`socket` module transparently converts Unicode host names to ACE, " "so that applications need not be concerned about converting host names " "themselves when they pass them to the socket module. On top of that, modules " -"that have host names as function parameters, such as :mod:`http.client` and :" -"mod:`ftplib`, accept Unicode host names (:mod:`http.client` then also " +"that have host names as function parameters, such as :mod:`http.client` " +"and :mod:`ftplib`, accept Unicode host names (:mod:`http.client` then also " "transparently sends an IDNA hostname in the :mailheader:`Host` field if it " "sends that field at all)." msgstr "" -#: ../../library/codecs.rst:1618 +#: ../../library/codecs.rst:1611 msgid "" "When receiving host names from the wire (such as in reverse name lookup), no " "automatic conversion to Unicode is performed: applications wishing to " "present such host names to the user should decode them to Unicode." msgstr "" -#: ../../library/codecs.rst:1622 +#: ../../library/codecs.rst:1615 msgid "" "The module :mod:`encodings.idna` also implements the nameprep procedure, " "which performs certain normalizations on host names, to achieve case-" @@ -2765,49 +2757,45 @@ msgid "" "characters. The nameprep functions can be used directly if desired." msgstr "" -#: ../../library/codecs.rst:1630 +#: ../../library/codecs.rst:1623 msgid "" "Return the nameprepped version of *label*. The implementation currently " "assumes query strings, so ``AllowUnassigned`` is true." msgstr "" -#: ../../library/codecs.rst:1636 +#: ../../library/codecs.rst:1629 msgid "" "Convert a label to ASCII, as specified in :rfc:`3490`. ``UseSTD3ASCIIRules`` " "is assumed to be false." msgstr "" -#: ../../library/codecs.rst:1642 +#: ../../library/codecs.rst:1635 msgid "Convert a label to Unicode, as specified in :rfc:`3490`." msgstr "" -#: ../../library/codecs.rst:1646 +#: ../../library/codecs.rst:1639 msgid ":mod:`encodings.mbcs` --- Windows ANSI codepage" msgstr ":mod:`encodings.mbcs` --- Windows ANSI 碼頁" -#: ../../library/codecs.rst:1651 +#: ../../library/codecs.rst:1644 msgid "This module implements the ANSI codepage (CP_ACP)." msgstr "這個模組實作了 ANSI 碼頁 (CP_ACP)。" -#: ../../library/codecs.rst:1653 -msgid "Availability" -msgstr "可用性" - -#: ../../library/codecs.rst:1655 +#: ../../library/codecs.rst:1648 msgid "" "Before 3.2, the *errors* argument was ignored; ``'replace'`` was always used " "to encode, and ``'ignore'`` to decode." msgstr "" -#: ../../library/codecs.rst:1659 +#: ../../library/codecs.rst:1652 msgid "Support any error handler." msgstr "" -#: ../../library/codecs.rst:1664 +#: ../../library/codecs.rst:1657 msgid ":mod:`encodings.utf_8_sig` --- UTF-8 codec with BOM signature" msgstr "" -#: ../../library/codecs.rst:1670 +#: ../../library/codecs.rst:1663 msgid "" "This module implements a variant of the UTF-8 codec. On encoding, a UTF-8 " "encoded BOM will be prepended to the UTF-8 encoded bytes. For the stateful " @@ -2836,71 +2824,77 @@ msgstr "streams(串流)" msgid "stackable" msgstr "stackable(可堆疊)" -#: ../../library/codecs.rst:334 +#: ../../library/codecs.rst:338 msgid "strict" msgstr "strict" -#: ../../library/codecs.rst:334 ../../library/codecs.rst:386 -#: ../../library/codecs.rst:409 +#: ../../library/codecs.rst:338 ../../library/codecs.rst:390 +#: ../../library/codecs.rst:413 msgid "error handler's name" msgstr "error handler's name(錯誤處理器名稱)" -#: ../../library/codecs.rst:334 +#: ../../library/codecs.rst:338 msgid "ignore" msgstr "ignore" -#: ../../library/codecs.rst:334 +#: ../../library/codecs.rst:338 msgid "replace" msgstr "replace" -#: ../../library/codecs.rst:334 +#: ../../library/codecs.rst:338 msgid "backslashreplace" msgstr "backslashreplace" -#: ../../library/codecs.rst:334 +#: ../../library/codecs.rst:338 msgid "surrogateescape" msgstr "surrogateescape" -#: ../../library/codecs.rst:334 +#: ../../library/codecs.rst:338 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/codecs.rst:334 +#: ../../library/codecs.rst:338 msgid "replacement character" msgstr "replacement character(替代字元)" -#: ../../library/codecs.rst:334 +#: ../../library/codecs.rst:338 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../library/codecs.rst:334 ../../library/codecs.rst:386 +#: ../../library/codecs.rst:338 ../../library/codecs.rst:390 msgid "escape sequence" msgstr "escape sequence(跳脫序列)" -#: ../../library/codecs.rst:334 +#: ../../library/codecs.rst:338 msgid "\\x" msgstr "\\x" -#: ../../library/codecs.rst:334 +#: ../../library/codecs.rst:338 msgid "\\u" msgstr "\\u" -#: ../../library/codecs.rst:334 +#: ../../library/codecs.rst:338 msgid "\\U" msgstr "\\U" -#: ../../library/codecs.rst:386 +#: ../../library/codecs.rst:390 msgid "xmlcharrefreplace" msgstr "xmlcharrefreplace" -#: ../../library/codecs.rst:386 +#: ../../library/codecs.rst:390 msgid "namereplace" msgstr "namereplace" -#: ../../library/codecs.rst:386 +#: ../../library/codecs.rst:390 msgid "\\N" msgstr "\\N" -#: ../../library/codecs.rst:409 +#: ../../library/codecs.rst:413 msgid "surrogatepass" msgstr "surrogatepass" + +#~ msgid "*input* must be a :class:`bytes` object." +#~ msgstr "*input* 必須是 :class:`bytes` 物件。" + +#~ msgid "*input* must be a :term:`bytes-like object`." +#~ msgstr "*input* 必須是 :term:`bytes-like object`。" diff --git a/library/collections.abc.po b/library/collections.abc.po index b071d8b15b8..f91aa57671f 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-04 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,8 +33,8 @@ msgstr "**原始碼:**\\ :source:`Lib/_collections_abc.py`" msgid "" "This module provides :term:`abstract base classes ` " "that can be used to test whether a class provides a particular interface; " -"for example, whether it is :term:`hashable` or whether it is a :term:" -"`mapping`." +"for example, whether it is :term:`hashable` or whether it is " +"a :term:`mapping`." msgstr "" #: ../../library/collections.abc.rst:27 @@ -104,9 +104,9 @@ msgstr "" msgid "" "In this example, class :class:`!D` does not need to define ``__contains__``, " "``__iter__``, and ``__reversed__`` because the :ref:`in-operator " -"`, the :term:`iteration ` logic, and the :func:" -"`reversed` function automatically fall back to using ``__getitem__`` and " -"``__len__``." +"`, the :term:`iteration ` logic, and " +"the :func:`reversed` function automatically fall back to using " +"``__getitem__`` and ``__len__``." msgstr "" #: ../../library/collections.abc.rst:82 @@ -231,7 +231,7 @@ msgstr ":class:`Generator` [1]_" msgid ":class:`Iterator`" msgstr ":class:`Iterator`" -#: ../../library/collections.abc.rst:127 ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:127 ../../library/collections.abc.rst:173 msgid "``send``, ``throw``" msgstr "``send``、``throw``" @@ -263,12 +263,11 @@ msgstr ":class:`Collection` [1]_" msgid ":class:`Sized`, :class:`Iterable`, :class:`Container`" msgstr ":class:`Sized`、:class:`Iterable`、:class:`Container`" -#: ../../library/collections.abc.rst:130 ../../library/collections.abc.rst:146 +#: ../../library/collections.abc.rst:130 ../../library/collections.abc.rst:143 msgid "``__contains__``, ``__iter__``, ``__len__``" msgstr "``__contains__``、``__iter__``、``__len__``" #: ../../library/collections.abc.rst:134 ../../library/collections.abc.rst:137 -#: ../../library/collections.abc.rst:143 msgid ":class:`Sequence`" msgstr ":class:`Sequence`" @@ -276,7 +275,7 @@ msgstr ":class:`Sequence`" msgid ":class:`Reversible`, :class:`Collection`" msgstr ":class:`Reversible`, :class:`Collection`" -#: ../../library/collections.abc.rst:134 ../../library/collections.abc.rst:143 +#: ../../library/collections.abc.rst:134 msgid "``__getitem__``, ``__len__``" msgstr "``__getitem__``、``__len__``" @@ -302,23 +301,15 @@ msgid "" "``extend``, ``pop``, ``remove``, and ``__iadd__``" msgstr "" -#: ../../library/collections.abc.rst:143 -msgid ":class:`ByteString`" -msgstr ":class:`ByteString`" - -#: ../../library/collections.abc.rst:143 -msgid "Inherited :class:`Sequence` methods" -msgstr "" - -#: ../../library/collections.abc.rst:146 ../../library/collections.abc.rst:151 +#: ../../library/collections.abc.rst:143 ../../library/collections.abc.rst:148 msgid ":class:`Set`" msgstr ":class:`Set`" -#: ../../library/collections.abc.rst:146 ../../library/collections.abc.rst:157 +#: ../../library/collections.abc.rst:143 ../../library/collections.abc.rst:154 msgid ":class:`Collection`" msgstr ":class:`Collection`" -#: ../../library/collections.abc.rst:146 +#: ../../library/collections.abc.rst:143 msgid "" "``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, ``__gt__``, ``__ge__``, " "``__and__``, ``__or__``, ``__sub__``, ``__rsub__``, ``__xor__``, " @@ -328,29 +319,29 @@ msgstr "" "``__and__``、``__or__``、``__sub__``、``__rsub__``、``__xor__``、" "``__rxor__`` 和 ``isdisjoint``" -#: ../../library/collections.abc.rst:151 +#: ../../library/collections.abc.rst:148 msgid ":class:`MutableSet`" msgstr ":class:`MutableSet`" -#: ../../library/collections.abc.rst:151 +#: ../../library/collections.abc.rst:148 msgid "``__contains__``, ``__iter__``, ``__len__``, ``add``, ``discard``" msgstr "``__contains__``、``__iter__``、``__len__``、``add``、``discard``" -#: ../../library/collections.abc.rst:151 +#: ../../library/collections.abc.rst:148 msgid "" "Inherited :class:`Set` methods and ``clear``, ``pop``, ``remove``, " "``__ior__``, ``__iand__``, ``__ixor__``, and ``__isub__``" msgstr "" -#: ../../library/collections.abc.rst:157 ../../library/collections.abc.rst:161 +#: ../../library/collections.abc.rst:154 ../../library/collections.abc.rst:158 msgid ":class:`Mapping`" msgstr ":class:`Mapping`" -#: ../../library/collections.abc.rst:157 +#: ../../library/collections.abc.rst:154 msgid "``__getitem__``, ``__iter__``, ``__len__``" msgstr "``__getitem__``、``__iter__``、``__len__``" -#: ../../library/collections.abc.rst:157 +#: ../../library/collections.abc.rst:154 msgid "" "``__contains__``, ``keys``, ``items``, ``values``, ``get``, ``__eq__``, and " "``__ne__``" @@ -358,128 +349,128 @@ msgstr "" "``__contains__``、``keys``、``items``、``values``、``get``、``__eq__`` 和 " "``__ne__``" -#: ../../library/collections.abc.rst:161 +#: ../../library/collections.abc.rst:158 msgid ":class:`MutableMapping`" msgstr ":class:`MutableMapping`" -#: ../../library/collections.abc.rst:161 +#: ../../library/collections.abc.rst:158 msgid "" "``__getitem__``, ``__setitem__``, ``__delitem__``, ``__iter__``, ``__len__``" msgstr "" "``__getitem__``、``__setitem__``、``__delitem__``、``__iter__``、``__len__``" -#: ../../library/collections.abc.rst:161 +#: ../../library/collections.abc.rst:158 msgid "" "Inherited :class:`Mapping` methods and ``pop``, ``popitem``, ``clear``, " "``update``, and ``setdefault``" msgstr "" -#: ../../library/collections.abc.rst:168 +#: ../../library/collections.abc.rst:165 msgid ":class:`MappingView`" msgstr ":class:`MappingView`" -#: ../../library/collections.abc.rst:168 +#: ../../library/collections.abc.rst:165 msgid ":class:`Sized`" msgstr ":class:`Sized`" -#: ../../library/collections.abc.rst:168 +#: ../../library/collections.abc.rst:165 msgid "``__init__``, ``__len__`` and ``__repr__``" msgstr "``__init__``、``__len__`` 和 ``__repr__``" -#: ../../library/collections.abc.rst:169 +#: ../../library/collections.abc.rst:166 msgid ":class:`ItemsView`" msgstr ":class:`ItemsView`" -#: ../../library/collections.abc.rst:169 ../../library/collections.abc.rst:171 +#: ../../library/collections.abc.rst:166 ../../library/collections.abc.rst:168 msgid ":class:`MappingView`, :class:`Set`" msgstr ":class:`MappingView`、:class:`Set`" -#: ../../library/collections.abc.rst:169 ../../library/collections.abc.rst:171 -#: ../../library/collections.abc.rst:173 +#: ../../library/collections.abc.rst:166 ../../library/collections.abc.rst:168 +#: ../../library/collections.abc.rst:170 msgid "``__contains__``, ``__iter__``" msgstr "``__contains__``、``__iter__``" -#: ../../library/collections.abc.rst:171 +#: ../../library/collections.abc.rst:168 msgid ":class:`KeysView`" msgstr ":class:`KeysView`" -#: ../../library/collections.abc.rst:173 +#: ../../library/collections.abc.rst:170 msgid ":class:`ValuesView`" msgstr ":class:`ValuesView`" -#: ../../library/collections.abc.rst:173 +#: ../../library/collections.abc.rst:170 msgid ":class:`MappingView`, :class:`Collection`" msgstr ":class:`MappingView`、:class:`Collection`" -#: ../../library/collections.abc.rst:175 +#: ../../library/collections.abc.rst:172 msgid ":class:`Awaitable` [1]_" msgstr ":class:`Awaitable` [1]_" -#: ../../library/collections.abc.rst:175 +#: ../../library/collections.abc.rst:172 msgid "``__await__``" msgstr "``__await__``" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:173 msgid ":class:`Coroutine` [1]_" msgstr ":class:`Coroutine` [1]_" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:173 msgid ":class:`Awaitable`" msgstr ":class:`Awaitable`" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:173 msgid "``close``" msgstr "``close``" -#: ../../library/collections.abc.rst:177 +#: ../../library/collections.abc.rst:174 msgid ":class:`AsyncIterable` [1]_" msgstr ":class:`AsyncIterable` [1]_" -#: ../../library/collections.abc.rst:177 ../../library/collections.abc.rst:178 +#: ../../library/collections.abc.rst:174 ../../library/collections.abc.rst:175 msgid "``__aiter__``" msgstr "``__aiter__``" -#: ../../library/collections.abc.rst:178 +#: ../../library/collections.abc.rst:175 msgid ":class:`AsyncIterator` [1]_" msgstr ":class:`AsyncIterator` [1]_" -#: ../../library/collections.abc.rst:178 +#: ../../library/collections.abc.rst:175 msgid ":class:`AsyncIterable`" msgstr ":class:`AsyncIterable`" -#: ../../library/collections.abc.rst:178 +#: ../../library/collections.abc.rst:175 msgid "``__anext__``" msgstr "``__anext__``" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:176 msgid ":class:`AsyncGenerator` [1]_" msgstr ":class:`AsyncGenerator` [1]_" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:176 msgid ":class:`AsyncIterator`" msgstr ":class:`AsyncIterator`" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:176 msgid "``asend``, ``athrow``" msgstr "``asend``、``athrow``" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:176 msgid "``aclose``, ``__aiter__``, ``__anext__``" msgstr "``aclose``、``__aiter__``、``__anext__``" -#: ../../library/collections.abc.rst:180 +#: ../../library/collections.abc.rst:177 msgid ":class:`Buffer` [1]_" msgstr ":class:`Buffer` [1]_" -#: ../../library/collections.abc.rst:180 +#: ../../library/collections.abc.rst:177 msgid "``__buffer__``" msgstr "``__buffer__``" -#: ../../library/collections.abc.rst:185 +#: ../../library/collections.abc.rst:182 msgid "Footnotes" msgstr "註腳" -#: ../../library/collections.abc.rst:186 +#: ../../library/collections.abc.rst:183 msgid "" "These ABCs override :meth:`~abc.ABCMeta.__subclasshook__` to support testing " "an interface by verifying the required methods are present and have not been " @@ -487,225 +478,222 @@ msgid "" "interfaces require registration or direct subclassing." msgstr "" -#: ../../library/collections.abc.rst:192 +#: ../../library/collections.abc.rst:189 msgid "" "Checking ``isinstance(obj, Iterable)`` detects classes that are registered " "as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " "it does not detect classes that iterate with the :meth:`~object.__getitem__` " -"method. The only reliable way to determine whether an object is :term:" -"`iterable` is to call ``iter(obj)``." +"method. The only reliable way to determine whether an object " +"is :term:`iterable` is to call ``iter(obj)``." msgstr "" -#: ../../library/collections.abc.rst:200 +#: ../../library/collections.abc.rst:197 msgid "Collections Abstract Base Classes -- Detailed Descriptions" msgstr "" -#: ../../library/collections.abc.rst:205 +#: ../../library/collections.abc.rst:202 msgid "ABC for classes that provide the :meth:`~object.__contains__` method." msgstr "" -#: ../../library/collections.abc.rst:209 +#: ../../library/collections.abc.rst:206 msgid "ABC for classes that provide the :meth:`~object.__hash__` method." msgstr "" -#: ../../library/collections.abc.rst:213 +#: ../../library/collections.abc.rst:210 msgid "ABC for classes that provide the :meth:`~object.__len__` method." msgstr "" -#: ../../library/collections.abc.rst:217 +#: ../../library/collections.abc.rst:214 msgid "ABC for classes that provide the :meth:`~object.__call__` method." msgstr "" -#: ../../library/collections.abc.rst:219 +#: ../../library/collections.abc.rst:216 msgid "" "See :ref:`annotating-callables` for details on how to use :class:`!Callable` " "in type annotations." msgstr "" -#: ../../library/collections.abc.rst:224 +#: ../../library/collections.abc.rst:221 msgid "ABC for classes that provide the :meth:`~container.__iter__` method." msgstr "" -#: ../../library/collections.abc.rst:226 +#: ../../library/collections.abc.rst:223 msgid "" "Checking ``isinstance(obj, Iterable)`` detects classes that are registered " "as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " "it does not detect classes that iterate with the :meth:`~object.__getitem__` " -"method. The only reliable way to determine whether an object is :term:" -"`iterable` is to call ``iter(obj)``." +"method. The only reliable way to determine whether an object " +"is :term:`iterable` is to call ``iter(obj)``." msgstr "" -#: ../../library/collections.abc.rst:235 +#: ../../library/collections.abc.rst:232 msgid "ABC for sized iterable container classes." msgstr "" -#: ../../library/collections.abc.rst:241 +#: ../../library/collections.abc.rst:238 msgid "" -"ABC for classes that provide the :meth:`~iterator.__iter__` and :meth:" -"`~iterator.__next__` methods. See also the definition of :term:`iterator`." +"ABC for classes that provide the :meth:`~iterator.__iter__` " +"and :meth:`~iterator.__next__` methods. See also the definition " +"of :term:`iterator`." msgstr "" -#: ../../library/collections.abc.rst:247 +#: ../../library/collections.abc.rst:244 msgid "" "ABC for iterable classes that also provide the :meth:`~object.__reversed__` " "method." msgstr "" -#: ../../library/collections.abc.rst:254 +#: ../../library/collections.abc.rst:251 msgid "" -"ABC for :term:`generator` classes that implement the protocol defined in :" -"pep:`342` that extends :term:`iterators ` with the :meth:" -"`~generator.send`, :meth:`~generator.throw` and :meth:`~generator.close` " -"methods." +"ABC for :term:`generator` classes that implement the protocol defined " +"in :pep:`342` that extends :term:`iterators ` with " +"the :meth:`~generator.send`, :meth:`~generator.throw` " +"and :meth:`~generator.close` methods." msgstr "" -#: ../../library/collections.abc.rst:259 +#: ../../library/collections.abc.rst:256 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`!Generator` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`!Generator` in type annotations." msgstr "" -#: ../../library/collections.abc.rst:268 +#: ../../library/collections.abc.rst:264 msgid "ABCs for read-only and mutable :term:`sequences `." msgstr "" -#: ../../library/collections.abc.rst:270 +#: ../../library/collections.abc.rst:266 msgid "" -"Implementation note: Some of the mixin methods, such as :meth:`~container." -"__iter__`, :meth:`~object.__reversed__` and :meth:`index`, make repeated " -"calls to the underlying :meth:`~object.__getitem__` method. Consequently, " +"Implementation note: Some of the mixin methods, such " +"as :meth:`~container.__iter__`, :meth:`~object.__reversed__`, " +"and :meth:`~sequence.index` make repeated calls to the " +"underlying :meth:`~object.__getitem__` method. Consequently, " "if :meth:`~object.__getitem__` is implemented with constant access speed, " "the mixin methods will have linear performance; however, if the underlying " "method is linear (as it would be with a linked list), the mixins will have " "quadratic performance and will likely need to be overridden." msgstr "" -#: ../../library/collections.abc.rst:281 +#: ../../library/collections.abc.rst:278 msgid "Return first index of *value*." msgstr "" -#: ../../library/collections.abc.rst:283 +#: ../../library/collections.abc.rst:280 msgid "Raises :exc:`ValueError` if the value is not present." msgstr "" -#: ../../library/collections.abc.rst:285 +#: ../../library/collections.abc.rst:282 msgid "" "Supporting the *start* and *stop* arguments is optional, but recommended." msgstr "" -#: ../../library/collections.abc.rst:287 +#: ../../library/collections.abc.rst:284 msgid "" -"The :meth:`!index` method added support for *stop* and *start* arguments." +"The :meth:`~sequence.index` method gained support for the *stop* and *start* " +"arguments." msgstr "" #: ../../library/collections.abc.rst:291 -msgid "" -"The :class:`ByteString` ABC has been deprecated. For use in typing, prefer a " -"union, like ``bytes | bytearray``, or :class:`collections.abc.Buffer`. For " -"use as an ABC, prefer :class:`Sequence` or :class:`collections.abc.Buffer`." -msgstr "" - -#: ../../library/collections.abc.rst:300 msgid "ABCs for read-only and mutable :ref:`sets `." msgstr "" -#: ../../library/collections.abc.rst:305 +#: ../../library/collections.abc.rst:296 msgid "ABCs for read-only and mutable :term:`mappings `." msgstr "" -#: ../../library/collections.abc.rst:312 +#: ../../library/collections.abc.rst:303 msgid "" "ABCs for mapping, items, keys, and values :term:`views `." msgstr "" -#: ../../library/collections.abc.rst:316 +#: ../../library/collections.abc.rst:307 msgid "" "ABC for :term:`awaitable` objects, which can be used in :keyword:`await` " -"expressions. Custom implementations must provide the :meth:`~object." -"__await__` method." +"expressions. Custom implementations must provide " +"the :meth:`~object.__await__` method." msgstr "" -#: ../../library/collections.abc.rst:320 +#: ../../library/collections.abc.rst:311 msgid "" -":term:`Coroutine ` objects and instances of the :class:" -"`~collections.abc.Coroutine` ABC are all instances of this ABC." +":term:`Coroutine ` objects and instances of " +"the :class:`~collections.abc.Coroutine` ABC are all instances of this ABC." msgstr "" -#: ../../library/collections.abc.rst:324 +#: ../../library/collections.abc.rst:315 msgid "" "In CPython, generator-based coroutines (:term:`generators ` " "decorated with :func:`@types.coroutine `) are *awaitables*, " "even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Awaitable)`` for them will return ``False``. Use :func:" -"`inspect.isawaitable` to detect them." +"``isinstance(gencoro, Awaitable)`` for them will return ``False``. " +"Use :func:`inspect.isawaitable` to detect them." msgstr "" -#: ../../library/collections.abc.rst:334 +#: ../../library/collections.abc.rst:325 msgid "" "ABC for :term:`coroutine` compatible classes. These implement the following " -"methods, defined in :ref:`coroutine-objects`: :meth:`~coroutine.send`, :meth:" -"`~coroutine.throw`, and :meth:`~coroutine.close`. Custom implementations " -"must also implement :meth:`~object.__await__`. All :class:`Coroutine` " -"instances are also instances of :class:`Awaitable`." +"methods, defined in :ref:`coroutine-" +"objects`: :meth:`~coroutine.send`, :meth:`~coroutine.throw`, " +"and :meth:`~coroutine.close`. Custom implementations must also " +"implement :meth:`~object.__await__`. All :class:`Coroutine` instances are " +"also instances of :class:`Awaitable`." msgstr "" -#: ../../library/collections.abc.rst:342 +#: ../../library/collections.abc.rst:333 msgid "" "In CPython, generator-based coroutines (:term:`generators ` " "decorated with :func:`@types.coroutine `) are *awaitables*, " "even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Coroutine)`` for them will return ``False``. Use :func:" -"`inspect.isawaitable` to detect them." +"``isinstance(gencoro, Coroutine)`` for them will return ``False``. " +"Use :func:`inspect.isawaitable` to detect them." msgstr "" -#: ../../library/collections.abc.rst:348 +#: ../../library/collections.abc.rst:339 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`!Coroutine` in type annotations. The variance and order of type parameters " -"correspond to those of :class:`Generator`." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`!Coroutine` in type annotations. The variance and order of " +"type parameters correspond to those of :class:`Generator`." msgstr "" -#: ../../library/collections.abc.rst:357 +#: ../../library/collections.abc.rst:348 msgid "" "ABC for classes that provide an ``__aiter__`` method. See also the " "definition of :term:`asynchronous iterable`." msgstr "" -#: ../../library/collections.abc.rst:364 +#: ../../library/collections.abc.rst:355 msgid "" "ABC for classes that provide ``__aiter__`` and ``__anext__`` methods. See " "also the definition of :term:`asynchronous iterator`." msgstr "" -#: ../../library/collections.abc.rst:371 +#: ../../library/collections.abc.rst:362 msgid "" "ABC for :term:`asynchronous generator` classes that implement the protocol " "defined in :pep:`525` and :pep:`492`." msgstr "" -#: ../../library/collections.abc.rst:374 +#: ../../library/collections.abc.rst:365 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`!AsyncGenerator` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`!AsyncGenerator` in type annotations." msgstr "" -#: ../../library/collections.abc.rst:381 +#: ../../library/collections.abc.rst:372 msgid "" "ABC for classes that provide the :meth:`~object.__buffer__` method, " "implementing the :ref:`buffer protocol `. See :pep:`688`." msgstr "" -#: ../../library/collections.abc.rst:387 +#: ../../library/collections.abc.rst:378 msgid "Examples and Recipes" msgstr "" -#: ../../library/collections.abc.rst:389 +#: ../../library/collections.abc.rst:380 msgid "" "ABCs allow us to ask classes or instances if they provide particular " "functionality, for example::" msgstr "" -#: ../../library/collections.abc.rst:392 +#: ../../library/collections.abc.rst:383 msgid "" "size = None\n" "if isinstance(myvar, collections.abc.Sized):\n" @@ -715,17 +703,18 @@ msgstr "" "if isinstance(myvar, collections.abc.Sized):\n" " size = len(myvar)" -#: ../../library/collections.abc.rst:396 +#: ../../library/collections.abc.rst:387 msgid "" "Several of the ABCs are also useful as mixins that make it easier to develop " "classes supporting container APIs. For example, to write a class supporting " "the full :class:`Set` API, it is only necessary to supply the three " -"underlying abstract methods: :meth:`~object.__contains__`, :meth:`~container." -"__iter__`, and :meth:`~object.__len__`. The ABC supplies the remaining " -"methods such as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" +"underlying abstract " +"methods: :meth:`~object.__contains__`, :meth:`~container.__iter__`, " +"and :meth:`~object.__len__`. The ABC supplies the remaining methods such " +"as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" msgstr "" -#: ../../library/collections.abc.rst:403 +#: ../../library/collections.abc.rst:394 msgid "" "class ListBasedSet(collections.abc.Set):\n" " ''' Alternate set implementation favoring space over speed\n" @@ -751,31 +740,31 @@ msgid "" "automatically" msgstr "" -#: ../../library/collections.abc.rst:425 +#: ../../library/collections.abc.rst:416 msgid "Notes on using :class:`Set` and :class:`MutableSet` as a mixin:" msgstr "" -#: ../../library/collections.abc.rst:428 +#: ../../library/collections.abc.rst:419 msgid "" "Since some set operations create new sets, the default mixin methods need a " "way to create new instances from an :term:`iterable`. The class constructor " "is assumed to have a signature in the form ``ClassName(iterable)``. That " -"assumption is factored-out to an internal :class:`classmethod` called :meth:" -"`!_from_iterable` which calls ``cls(iterable)`` to produce a new set. If " -"the :class:`Set` mixin is being used in a class with a different constructor " -"signature, you will need to override :meth:`!_from_iterable` with a " -"classmethod or regular method that can construct new instances from an " -"iterable argument." +"assumption is factored-out to an internal :class:`classmethod` " +"called :meth:`!_from_iterable` which calls ``cls(iterable)`` to produce a " +"new set. If the :class:`Set` mixin is being used in a class with a different " +"constructor signature, you will need to override :meth:`!_from_iterable` " +"with a classmethod or regular method that can construct new instances from " +"an iterable argument." msgstr "" -#: ../../library/collections.abc.rst:439 +#: ../../library/collections.abc.rst:430 msgid "" "To override the comparisons (presumably for speed, as the semantics are " "fixed), redefine :meth:`~object.__le__` and :meth:`~object.__ge__`, then the " "other operations will automatically follow suit." msgstr "" -#: ../../library/collections.abc.rst:445 +#: ../../library/collections.abc.rst:436 msgid "" "The :class:`Set` mixin provides a :meth:`!_hash` method to compute a hash " "value for the set; however, :meth:`~object.__hash__` is not defined because " @@ -784,12 +773,15 @@ msgid "" "define ``__hash__ = Set._hash``." msgstr "" -#: ../../library/collections.abc.rst:453 +#: ../../library/collections.abc.rst:444 msgid "" "`OrderedSet recipe `_ for an " "example built on :class:`MutableSet`." msgstr "" -#: ../../library/collections.abc.rst:456 +#: ../../library/collections.abc.rst:447 msgid "For more about ABCs, see the :mod:`abc` module and :pep:`3119`." msgstr "關於 ABC 的更多資訊請見 :mod:`abc` module 和 :pep:`3119`。" + +#~ msgid ":class:`ByteString`" +#~ msgstr ":class:`ByteString`" diff --git a/library/collections.po b/library/collections.po index 28aa3f51f90..3fd7d6091d3 100644 --- a/library/collections.po +++ b/library/collections.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-04 00:14+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-01-22 21:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1226,15 +1226,16 @@ msgstr "" "值對序列轉換為包含 list 之字典:" #: ../../library/collections.rst:784 +#, fuzzy msgid "" "When each key is encountered for the first time, it is not already in the " "mapping; so an entry is automatically created using " "the :attr:`~defaultdict.default_factory` function which returns an " -"empty :class:`list`. The :meth:`!list.append` operation then attaches the " +"empty :class:`list`. The :meth:`list.append` operation then attaches the " "value to the new list. When keys are encountered again, the look-up " -"proceeds normally (returning the list for that key) and the :meth:`!" -"list.append` operation adds another value to the list. This technique is " -"simpler and faster than an equivalent technique " +"proceeds normally (returning the list for that key) and " +"the :meth:`list.append` operation adds another value to the list. This " +"technique is simpler and faster than an equivalent technique " "using :meth:`dict.setdefault`:" msgstr "" "當每個鍵第一次被存取時,它還沒有存在於對映中,所以會自動呼" diff --git a/library/compression.po b/library/compression.po new file mode 100644 index 00000000000..bfc26a2ad7e --- /dev/null +++ b/library/compression.po @@ -0,0 +1,53 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/compression.rst:2 +msgid "The :mod:`!compression` package" +msgstr "" + +#: ../../library/compression.rst:6 +msgid "" +"The :mod:`!compression` package contains the canonical compression modules " +"containing interfaces to several different compression algorithms. Some of " +"these modules have historically been available as separate modules; those " +"will continue to be available under their original names for compatibility " +"reasons, and will not be removed without a deprecation cycle. The use of " +"modules in :mod:`!compression` is encouraged where practical." +msgstr "" + +#: ../../library/compression.rst:13 +msgid ":mod:`!compression.bz2` -- Re-exports :mod:`bz2`" +msgstr "" + +#: ../../library/compression.rst:14 +msgid ":mod:`!compression.gzip` -- Re-exports :mod:`gzip`" +msgstr "" + +#: ../../library/compression.rst:15 +msgid ":mod:`!compression.lzma` -- Re-exports :mod:`lzma`" +msgstr "" + +#: ../../library/compression.rst:16 +msgid ":mod:`!compression.zlib` -- Re-exports :mod:`zlib`" +msgstr "" + +#: ../../library/compression.rst:17 +msgid "" +":mod:`compression.zstd` -- Wrapper for the Zstandard compression library" +msgstr "" diff --git a/library/compression.zstd.po b/library/compression.zstd.po new file mode 100644 index 00000000000..aa111409847 --- /dev/null +++ b/library/compression.zstd.po @@ -0,0 +1,1155 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/compression.zstd.rst:2 +msgid "" +":mod:`!compression.zstd` --- Compression compatible with the Zstandard format" +msgstr "" + +#: ../../library/compression.zstd.rst:10 +msgid "**Source code:** :source:`Lib/compression/zstd/__init__.py`" +msgstr "" + +#: ../../library/compression.zstd.rst:14 +msgid "" +"This module provides classes and functions for compressing and decompressing " +"data using the Zstandard (or *zstd*) compression algorithm. The `zstd manual " +"`__ describes " +"Zstandard as \"a fast lossless compression algorithm, targeting real-time " +"compression scenarios at zlib-level and better compression ratios.\" Also " +"included is a file interface that supports reading and writing the contents " +"of ``.zst`` files created by the :program:`zstd` utility, as well as raw " +"zstd compressed streams." +msgstr "" + +#: ../../library/compression.zstd.rst:23 +msgid "The :mod:`!compression.zstd` module contains:" +msgstr "" + +#: ../../library/compression.zstd.rst:25 +msgid "" +"The :func:`.open` function and :class:`ZstdFile` class for reading and " +"writing compressed files." +msgstr "" + +#: ../../library/compression.zstd.rst:27 +msgid "" +"The :class:`ZstdCompressor` and :class:`ZstdDecompressor` classes for " +"incremental (de)compression." +msgstr "" + +#: ../../library/compression.zstd.rst:29 +msgid "" +"The :func:`compress` and :func:`decompress` functions for one-shot " +"(de)compression." +msgstr "" + +#: ../../library/compression.zstd.rst:31 +msgid "" +"The :func:`train_dict` and :func:`finalize_dict` functions and " +"the :class:`ZstdDict` class to train and manage Zstandard dictionaries." +msgstr "" + +#: ../../library/compression.zstd.rst:33 +msgid "" +"The :class:`CompressionParameter`, :class:`DecompressionParameter`, " +"and :class:`Strategy` classes for setting advanced (de)compression " +"parameters." +msgstr "" + +#: ../../library/compression.zstd.rst:38 +msgid "Exceptions" +msgstr "" + +#: ../../library/compression.zstd.rst:42 +msgid "" +"This exception is raised when an error occurs during compression or " +"decompression, or while initializing the (de)compressor state." +msgstr "" + +#: ../../library/compression.zstd.rst:47 +msgid "Reading and writing compressed files" +msgstr "" + +#: ../../library/compression.zstd.rst:52 +msgid "" +"Open a Zstandard-compressed file in binary or text mode, returning " +"a :term:`file object`." +msgstr "" + +#: ../../library/compression.zstd.rst:55 +msgid "" +"The *file* argument can be either a file name (given as " +"a :class:`str`, :class:`bytes` or :term:`path-like ` " +"object), in which case the named file is opened, or it can be an existing " +"file object to read from or write to." +msgstr "" + +#: ../../library/compression.zstd.rst:60 +msgid "" +"The mode argument can be either ``'rb'`` for reading (default), ``'wb'`` for " +"overwriting, ``'ab'`` for appending, or ``'xb'`` for exclusive creation. " +"These can equivalently be given as ``'r'``, ``'w'``, ``'a'``, and ``'x'`` " +"respectively. You may also open in text mode with ``'rt'``, ``'wt'``, " +"``'at'``, and ``'xt'`` respectively." +msgstr "" + +#: ../../library/compression.zstd.rst:66 ../../library/compression.zstd.rst:110 +msgid "" +"When reading, the *options* argument can be a dictionary providing advanced " +"decompression parameters; see :class:`DecompressionParameter` for detailed " +"information about supported parameters. The *zstd_dict* argument is " +"a :class:`ZstdDict` instance to be used during decompression. When reading, " +"if the *level* argument is not None, a :exc:`!TypeError` will be raised." +msgstr "" + +#: ../../library/compression.zstd.rst:73 +msgid "" +"When writing, the *options* argument can be a dictionary providing advanced " +"decompression parameters; see :class:`CompressionParameter` for detailed " +"information about supported parameters. The *level* argument is the " +"compression level to use when writing compressed data. Only one of *level* " +"or *options* may be non-None. The *zstd_dict* argument is " +"a :class:`ZstdDict` instance to be used during compression." +msgstr "" + +#: ../../library/compression.zstd.rst:81 +msgid "" +"In binary mode, this function is equivalent to the :class:`ZstdFile` " +"constructor: ``ZstdFile(file, mode, ...)``. In this case, the *encoding*, " +"*errors*, and *newline* parameters must not be provided." +msgstr "" + +#: ../../library/compression.zstd.rst:85 +msgid "" +"In text mode, a :class:`ZstdFile` object is created, and wrapped in " +"an :class:`io.TextIOWrapper` instance with the specified encoding, error " +"handling behavior, and line endings." +msgstr "" + +#: ../../library/compression.zstd.rst:93 +msgid "Open a Zstandard-compressed file in binary mode." +msgstr "" + +#: ../../library/compression.zstd.rst:95 +msgid "" +"A :class:`ZstdFile` can wrap an already-open :term:`file object`, or operate " +"directly on a named file. The *file* argument specifies either the file " +"object to wrap, or the name of the file to open (as " +"a :class:`str`, :class:`bytes` or :term:`path-like ` " +"object). If wrapping an existing file object, the wrapped file will not be " +"closed when the :class:`ZstdFile` is closed." +msgstr "" + +#: ../../library/compression.zstd.rst:102 +msgid "" +"The *mode* argument can be either ``'rb'`` for reading (default), ``'wb'`` " +"for overwriting, ``'xb'`` for exclusive creation, or ``'ab'`` for appending. " +"These can equivalently be given as ``'r'``, ``'w'``, ``'x'`` and ``'a'`` " +"respectively." +msgstr "" + +#: ../../library/compression.zstd.rst:107 +msgid "" +"If *file* is a file object (rather than an actual file name), a mode of " +"``'w'`` does not truncate the file, and is instead equivalent to ``'a'``." +msgstr "" + +#: ../../library/compression.zstd.rst:117 +msgid "" +"When writing, the *options* argument can be a dictionary providing advanced " +"decompression parameters; see :class:`CompressionParameter` for detailed " +"information about supported parameters. The *level* argument is the " +"compression level to use when writing compressed data. Only one of *level* " +"or *options* may be passed. The *zstd_dict* argument is a :class:`ZstdDict` " +"instance to be used during compression." +msgstr "" + +#: ../../library/compression.zstd.rst:125 +msgid "" +":class:`!ZstdFile` supports all the members specified " +"by :class:`io.BufferedIOBase`, except for :meth:`~io.BufferedIOBase.detach` " +"and :meth:`~io.IOBase.truncate`. Iteration and the :keyword:`with` statement " +"are supported." +msgstr "" + +#: ../../library/compression.zstd.rst:130 +msgid "The following method and attributes are also provided:" +msgstr "" + +#: ../../library/compression.zstd.rst:134 +msgid "" +"Return buffered data without advancing the file position. At least one byte " +"of data will be returned, unless EOF has been reached. The exact number of " +"bytes returned is unspecified (the *size* argument is ignored)." +msgstr "" + +#: ../../library/compression.zstd.rst:138 +msgid "" +"While calling :meth:`peek` does not change the file position of " +"the :class:`ZstdFile`, it may change the position of the underlying file " +"object (for example, if the :class:`ZstdFile` was constructed by passing a " +"file object for *file*)." +msgstr "" + +#: ../../library/compression.zstd.rst:145 +msgid "``'rb'`` for reading and ``'wb'`` for writing." +msgstr "" + +#: ../../library/compression.zstd.rst:149 +msgid "" +"The name of the Zstandard file. Equivalent to the :attr:`~io.FileIO.name` " +"attribute of the underlying :term:`file object`." +msgstr "" + +#: ../../library/compression.zstd.rst:154 +msgid "Compressing and decompressing data in memory" +msgstr "" + +#: ../../library/compression.zstd.rst:158 +msgid "" +"Compress *data* (a :term:`bytes-like object`), returning the compressed data " +"as a :class:`bytes` object." +msgstr "" + +#: ../../library/compression.zstd.rst:161 +#: ../../library/compression.zstd.rst:205 +msgid "" +"The *level* argument is an integer controlling the level of compression. " +"*level* is an alternative to " +"setting :attr:`CompressionParameter.compression_level` in *options*. " +"Use :meth:`~CompressionParameter.bounds` " +"on :attr:`~CompressionParameter.compression_level` to get the values that " +"can be passed for *level*. If advanced compression options are needed, the " +"*level* argument must be omitted and in the *options* dictionary the :attr:`!" +"CompressionParameter.compression_level` parameter should be set." +msgstr "" + +#: ../../library/compression.zstd.rst:170 +#: ../../library/compression.zstd.rst:214 +msgid "" +"The *options* argument is a Python dictionary containing advanced " +"compression parameters. The valid keys and values for compression parameters " +"are documented as part of the :class:`CompressionParameter` documentation." +msgstr "" + +#: ../../library/compression.zstd.rst:174 +msgid "" +"The *zstd_dict* argument is an instance of :class:`ZstdDict` containing " +"trained data to improve compression efficiency. The " +"function :func:`train_dict` can be used to generate a Zstandard dictionary." +msgstr "" + +#: ../../library/compression.zstd.rst:181 +msgid "" +"Decompress *data* (a :term:`bytes-like object`), returning the uncompressed " +"data as a :class:`bytes` object." +msgstr "" + +#: ../../library/compression.zstd.rst:184 +#: ../../library/compression.zstd.rst:306 +msgid "" +"The *options* argument is a Python dictionary containing advanced " +"decompression parameters. The valid keys and values for compression " +"parameters are documented as part of the :class:`DecompressionParameter` " +"documentation." +msgstr "" + +#: ../../library/compression.zstd.rst:189 +#: ../../library/compression.zstd.rst:311 +msgid "" +"The *zstd_dict* argument is an instance of :class:`ZstdDict` containing " +"trained data used during compression. This must be the same Zstandard " +"dictionary used during compression." +msgstr "" + +#: ../../library/compression.zstd.rst:193 +msgid "" +"If *data* is the concatenation of multiple distinct compressed frames, " +"decompress all of these frames, and return the concatenation of the results." +msgstr "" + +#: ../../library/compression.zstd.rst:199 +msgid "" +"Create a compressor object, which can be used to compress data incrementally." +msgstr "" + +#: ../../library/compression.zstd.rst:202 +msgid "" +"For a more convenient way of compressing a single chunk of data, see the " +"module-level function :func:`compress`." +msgstr "" + +#: ../../library/compression.zstd.rst:218 +msgid "" +"The *zstd_dict* argument is an optional instance of :class:`ZstdDict` " +"containing trained data to improve compression efficiency. The " +"function :func:`train_dict` can be used to generate a Zstandard dictionary." +msgstr "" + +#: ../../library/compression.zstd.rst:225 +msgid "" +"Compress *data* (a :term:`bytes-like object`), returning a :class:`bytes` " +"object with compressed data if possible, or otherwise an empty :class:`!" +"bytes` object. Some of *data* may be buffered internally, for use in later " +"calls to :meth:`!compress` and :meth:`~.flush`. The returned data should be " +"concatenated with the output of any previous calls to :meth:`~.compress`." +msgstr "" + +#: ../../library/compression.zstd.rst:232 +msgid "" +"The *mode* argument is a :class:`ZstdCompressor` attribute, " +"either :attr:`~.CONTINUE`, :attr:`~.FLUSH_BLOCK`, or :attr:`~.FLUSH_FRAME`." +msgstr "" + +#: ../../library/compression.zstd.rst:236 +msgid "" +"When all data has been provided to the compressor, call the :meth:`~.flush` " +"method to finish the compression process. If :meth:`~.compress` is called " +"with *mode* set to :attr:`~.FLUSH_FRAME`, :meth:`~.flush` should not be " +"called, as it would write out a new empty frame." +msgstr "" + +#: ../../library/compression.zstd.rst:244 +msgid "" +"Finish the compression process, returning a :class:`bytes` object containing " +"any data stored in the compressor's internal buffers." +msgstr "" + +#: ../../library/compression.zstd.rst:247 +msgid "" +"The *mode* argument is a :class:`ZstdCompressor` attribute, " +"either :attr:`~.FLUSH_BLOCK`, or :attr:`~.FLUSH_FRAME`." +msgstr "" + +#: ../../library/compression.zstd.rst:252 +msgid "" +"Specify the amount of uncompressed data *size* that will be provided for the " +"next frame. *size* will be written into the frame header of the next frame " +"unless :attr:`CompressionParameter.content_size_flag` is ``False`` or ``0``. " +"A size of ``0`` means that the frame is empty. If *size* is ``None``, the " +"frame header will omit the frame size. Frames that include the uncompressed " +"data size require less memory to decompress, especially at higher " +"compression levels." +msgstr "" + +#: ../../library/compression.zstd.rst:260 +msgid "" +"If :attr:`last_mode` is not :attr:`FLUSH_FRAME`, a :exc:`ValueError` is " +"raised as the compressor is not at the start of a frame. If the pledged size " +"does not match the actual size of data provided to :meth:`.compress`, future " +"calls to :meth:`!compress` or :meth:`flush` may raise :exc:`ZstdError` and " +"the last chunk of data may be lost." +msgstr "" + +#: ../../library/compression.zstd.rst:267 +msgid "" +"After :meth:`flush` or :meth:`.compress` are called with " +"mode :attr:`FLUSH_FRAME`, the next frame will not include the frame size " +"into the header unless :meth:`!set_pledged_input_size` is called again." +msgstr "" + +#: ../../library/compression.zstd.rst:273 +msgid "" +"Collect more data for compression, which may or may not generate output " +"immediately. This mode optimizes the compression ratio by maximizing the " +"amount of data per block and frame." +msgstr "" + +#: ../../library/compression.zstd.rst:279 +msgid "" +"Complete and write a block to the data stream. The data returned so far can " +"be immediately decompressed. Past data can still be referenced in future " +"blocks generated by calls to :meth:`~.compress`, improving compression." +msgstr "" + +#: ../../library/compression.zstd.rst:286 +msgid "" +"Complete and write out a frame. Future data provided to :meth:`~.compress` " +"will be written into a new frame and *cannot* reference past data." +msgstr "" + +#: ../../library/compression.zstd.rst:292 +msgid "" +"The last mode passed to either :meth:`~.compress` or :meth:`~.flush`. The " +"value can be one of :attr:`~.CONTINUE`, :attr:`~.FLUSH_BLOCK`, " +"or :attr:`~.FLUSH_FRAME`. The initial value is :attr:`~.FLUSH_FRAME`, " +"signifying that the compressor is at the start of a new frame." +msgstr "" + +#: ../../library/compression.zstd.rst:300 +msgid "" +"Create a decompressor object, which can be used to decompress data " +"incrementally." +msgstr "" + +#: ../../library/compression.zstd.rst:303 +msgid "" +"For a more convenient way of decompressing an entire compressed stream at " +"once, see the module-level function :func:`decompress`." +msgstr "" + +#: ../../library/compression.zstd.rst:316 +msgid "" +"This class does not transparently handle inputs containing multiple " +"compressed frames, unlike the :func:`decompress` function " +"and :class:`ZstdFile` class. To decompress a multi-frame input, you should " +"use :func:`decompress`, :class:`ZstdFile` if working with a :term:`file " +"object`, or multiple :class:`!ZstdDecompressor` instances." +msgstr "" + +#: ../../library/compression.zstd.rst:324 +msgid "" +"Decompress *data* (a :term:`bytes-like object`), returning uncompressed data " +"as bytes. Some of *data* may be buffered internally, for use in later calls " +"to :meth:`!decompress`. The returned data should be concatenated with the " +"output of any previous calls to :meth:`!decompress`." +msgstr "" + +#: ../../library/compression.zstd.rst:330 +msgid "" +"If *max_length* is non-negative, the method returns at most *max_length* " +"bytes of decompressed data. If this limit is reached and further output can " +"be produced, the :attr:`~.needs_input` attribute will be set to ``False``. " +"In this case, the next call to :meth:`~.decompress` may provide *data* as " +"``b''`` to obtain more of the output." +msgstr "" + +#: ../../library/compression.zstd.rst:337 +msgid "" +"If all of the input data was decompressed and returned (either because this " +"was less than *max_length* bytes, or because *max_length* was negative), " +"the :attr:`~.needs_input` attribute will be set to ``True``." +msgstr "" + +#: ../../library/compression.zstd.rst:342 +msgid "" +"Attempting to decompress data after the end of a frame will raise " +"a :exc:`ZstdError`. Any data found after the end of the frame is ignored and " +"saved in the :attr:`~.unused_data` attribute." +msgstr "" + +#: ../../library/compression.zstd.rst:348 +msgid "``True`` if the end-of-stream marker has been reached." +msgstr "" + +#: ../../library/compression.zstd.rst:352 +msgid "Data found after the end of the compressed stream." +msgstr "" + +#: ../../library/compression.zstd.rst:354 +msgid "Before the end of the stream is reached, this will be ``b''``." +msgstr "" + +#: ../../library/compression.zstd.rst:358 +msgid "" +"``False`` if the :meth:`.decompress` method can provide more decompressed " +"data before requiring new compressed input." +msgstr "" + +#: ../../library/compression.zstd.rst:363 +msgid "Zstandard dictionaries" +msgstr "" + +#: ../../library/compression.zstd.rst:368 +msgid "" +"Train a Zstandard dictionary, returning a :class:`ZstdDict` instance. " +"Zstandard dictionaries enable more efficient compression of smaller sizes of " +"data, which is traditionally difficult to compress due to less repetition. " +"If you are compressing multiple similar groups of data (such as similar " +"files), Zstandard dictionaries can improve compression ratios and speed " +"significantly." +msgstr "" + +#: ../../library/compression.zstd.rst:375 +msgid "" +"The *samples* argument (an iterable of :class:`bytes` objects), is the " +"population of samples used to train the Zstandard dictionary." +msgstr "" + +#: ../../library/compression.zstd.rst:378 +msgid "" +"The *dict_size* argument, an integer, is the maximum size (in bytes) the " +"Zstandard dictionary should be. The Zstandard documentation suggests an " +"absolute maximum of no more than 100 KB, but the maximum can often be " +"smaller depending on the data. Larger dictionaries generally slow down " +"compression, but improve compression ratios. Smaller dictionaries lead to " +"faster compression, but reduce the compression ratio." +msgstr "" + +#: ../../library/compression.zstd.rst:388 +msgid "" +"An advanced function for converting a \"raw content\" Zstandard dictionary " +"into a regular Zstandard dictionary. \"Raw content\" dictionaries are a " +"sequence of bytes that do not need to follow the structure of a normal " +"Zstandard dictionary." +msgstr "" + +#: ../../library/compression.zstd.rst:393 +msgid "" +"The *zstd_dict* argument is a :class:`ZstdDict` instance with " +"the :attr:`~ZstdDict.dict_content` containing the raw dictionary contents." +msgstr "" + +#: ../../library/compression.zstd.rst:396 +msgid "" +"The *samples* argument (an iterable of :class:`bytes` objects), contains " +"sample data for generating the Zstandard dictionary." +msgstr "" + +#: ../../library/compression.zstd.rst:399 +msgid "" +"The *dict_size* argument, an integer, is the maximum size (in bytes) the " +"Zstandard dictionary should be. See :func:`train_dict` for suggestions on " +"the maximum dictionary size." +msgstr "" + +#: ../../library/compression.zstd.rst:403 +msgid "" +"The *level* argument (an integer) is the compression level expected to be " +"passed to the compressors using this dictionary. The dictionary information " +"varies for each compression level, so tuning for the proper compression " +"level can make compression more efficient." +msgstr "" + +#: ../../library/compression.zstd.rst:411 +msgid "" +"A wrapper around Zstandard dictionaries. Dictionaries can be used to improve " +"the compression of many small chunks of data. Use :func:`train_dict` if you " +"need to train a new dictionary from sample data." +msgstr "" + +#: ../../library/compression.zstd.rst:415 +msgid "" +"The *dict_content* argument (a :term:`bytes-like object`), is the already " +"trained dictionary information." +msgstr "" + +#: ../../library/compression.zstd.rst:418 +msgid "" +"The *is_raw* argument, a boolean, is an advanced parameter controlling the " +"meaning of *dict_content*. ``True`` means *dict_content* is a \"raw " +"content\" dictionary, without any format restrictions. ``False`` means " +"*dict_content* is an ordinary Zstandard dictionary, created from Zstandard " +"functions, for example, :func:`train_dict` or the external :program:`zstd` " +"CLI." +msgstr "" + +#: ../../library/compression.zstd.rst:424 +msgid "" +"When passing a :class:`!ZstdDict` to a function, the :attr:`!" +"as_digested_dict` and :attr:`!as_undigested_dict` attributes can control how " +"the dictionary is loaded by passing them as the ``zstd_dict`` argument, for " +"example, ``compress(data, zstd_dict=zd.as_digested_dict)``. Digesting a " +"dictionary is a costly operation that occurs when loading a Zstandard " +"dictionary. When making multiple calls to compression or decompression, " +"passing a digested dictionary will reduce the overhead of loading the " +"dictionary." +msgstr "" + +#: ../../library/compression.zstd.rst:433 +msgid "Difference for compression" +msgstr "" + +#: ../../library/compression.zstd.rst:438 +msgid "Digested dictionary" +msgstr "" + +#: ../../library/compression.zstd.rst:439 +msgid "Undigested dictionary" +msgstr "" + +#: ../../library/compression.zstd.rst:440 +msgid "" +"Advanced parameters of the compressor which may be overridden by the " +"dictionary's parameters" +msgstr "" + +#: ../../library/compression.zstd.rst:442 +msgid "" +"``window_log``, ``hash_log``, ``chain_log``, ``search_log``, ``min_match``, " +"``target_length``, ``strategy``, ``enable_long_distance_matching``, " +"``ldm_hash_log``, ``ldm_min_match``, ``ldm_bucket_size_log``, " +"``ldm_hash_rate_log``, and some non-public parameters." +msgstr "" + +#: ../../library/compression.zstd.rst:447 +msgid "None" +msgstr "" + +#: ../../library/compression.zstd.rst:448 +msgid ":class:`!ZstdDict` internally caches the dictionary" +msgstr "" + +#: ../../library/compression.zstd.rst:449 +msgid "" +"Yes. It's faster when loading a digested dictionary again with the same " +"compression level." +msgstr "" + +#: ../../library/compression.zstd.rst:451 +msgid "" +"No. If you wish to load an undigested dictionary multiple times, consider " +"reusing a compressor object." +msgstr "" + +#: ../../library/compression.zstd.rst:454 +msgid "" +"If passing a :class:`!ZstdDict` without any attribute, an undigested " +"dictionary is passed by default when compressing and a digested dictionary " +"is generated if necessary and passed by default when decompressing." +msgstr "" + +#: ../../library/compression.zstd.rst:460 +msgid "" +"The content of the Zstandard dictionary, a ``bytes`` object. It's the same " +"as the *dict_content* argument in the ``__init__`` method. It can be used " +"with other programs, such as the ``zstd`` CLI program." +msgstr "" + +#: ../../library/compression.zstd.rst:466 +msgid "Identifier of the Zstandard dictionary, a non-negative int value." +msgstr "" + +#: ../../library/compression.zstd.rst:468 +msgid "" +"Non-zero means the dictionary is ordinary, created by Zstandard functions " +"and following the Zstandard format." +msgstr "" + +#: ../../library/compression.zstd.rst:471 +msgid "" +"``0`` means a \"raw content\" dictionary, free of any format restriction, " +"used for advanced users." +msgstr "" + +#: ../../library/compression.zstd.rst:476 +msgid "" +"The meaning of ``0`` for :attr:`!ZstdDict.dict_id` is different from the " +"``dictionary_id`` attribute to the :func:`get_frame_info` function." +msgstr "" + +#: ../../library/compression.zstd.rst:482 +msgid "Load as a digested dictionary." +msgstr "" + +#: ../../library/compression.zstd.rst:486 +msgid "Load as an undigested dictionary." +msgstr "" + +#: ../../library/compression.zstd.rst:490 +msgid "Advanced parameter control" +msgstr "" + +#: ../../library/compression.zstd.rst:494 +msgid "" +"An :class:`~enum.IntEnum` containing the advanced compression parameter keys " +"that can be used when compressing data." +msgstr "" + +#: ../../library/compression.zstd.rst:497 +#: ../../library/compression.zstd.rst:731 +msgid "" +"The :meth:`~.bounds` method can be used on any attribute to get the valid " +"values for that parameter." +msgstr "" + +#: ../../library/compression.zstd.rst:500 +msgid "" +"Parameters are optional; any omitted parameter will have it's value selected " +"automatically." +msgstr "" + +#: ../../library/compression.zstd.rst:503 +msgid "" +"Example getting the lower and upper bound of :attr:`~.compression_level`::" +msgstr "" + +#: ../../library/compression.zstd.rst:505 +msgid "lower, upper = CompressionParameter.compression_level.bounds()" +msgstr "" + +#: ../../library/compression.zstd.rst:507 +msgid "Example setting the :attr:`~.window_log` to the maximum size::" +msgstr "" + +#: ../../library/compression.zstd.rst:509 +msgid "" +"_lower, upper = CompressionParameter.window_log.bounds()\n" +"options = {CompressionParameter.window_log: upper}\n" +"compress(b'venezuelan beaver cheese', options=options)" +msgstr "" + +#: ../../library/compression.zstd.rst:515 +msgid "" +"Return the tuple of int bounds, ``(lower, upper)``, of a compression " +"parameter. This method should be called on the attribute you wish to " +"retrieve the bounds of. For example, to get the valid values " +"for :attr:`~.compression_level`, one may check the result of " +"``CompressionParameter.compression_level.bounds()``." +msgstr "" + +#: ../../library/compression.zstd.rst:521 +#: ../../library/compression.zstd.rst:749 +msgid "Both the lower and upper bounds are inclusive." +msgstr "" + +#: ../../library/compression.zstd.rst:525 +msgid "" +"A high-level means of setting other compression parameters that affect the " +"speed and ratio of compressing data." +msgstr "" + +#: ../../library/compression.zstd.rst:528 +msgid "" +"Regular compression levels are greater than ``0``. Values greater than " +"``20`` are considered \"ultra\" compression and require more memory than " +"other levels. Negative values can be used to trade off faster compression " +"for worse compression ratios." +msgstr "" + +#: ../../library/compression.zstd.rst:533 +msgid "Setting the level to zero uses :attr:`COMPRESSION_LEVEL_DEFAULT`." +msgstr "" + +#: ../../library/compression.zstd.rst:537 +msgid "" +"Maximum allowed back-reference distance the compressor can use when " +"compressing data, expressed as power of two, ``1 << window_log`` bytes. This " +"parameter greatly influences the memory usage of compression. Higher values " +"require more memory but gain better compression values." +msgstr "" + +#: ../../library/compression.zstd.rst:542 +#: ../../library/compression.zstd.rst:551 +#: ../../library/compression.zstd.rst:562 +#: ../../library/compression.zstd.rst:570 +#: ../../library/compression.zstd.rst:581 +#: ../../library/compression.zstd.rst:596 +#: ../../library/compression.zstd.rst:627 +#: ../../library/compression.zstd.rst:634 +#: ../../library/compression.zstd.rst:642 +#: ../../library/compression.zstd.rst:650 +#: ../../library/compression.zstd.rst:709 +#: ../../library/compression.zstd.rst:758 +msgid "A value of zero causes the value to be selected automatically." +msgstr "" + +#: ../../library/compression.zstd.rst:546 +msgid "" +"Size of the initial probe table, as a power of two. The resulting memory " +"usage is ``1 << (hash_log+2)`` bytes. Larger tables improve compression " +"ratio of strategies <= :attr:`~Strategy.dfast`, and improve compression " +"speed of strategies > :attr:`~Strategy.dfast`." +msgstr "" + +#: ../../library/compression.zstd.rst:555 +msgid "" +"Size of the multi-probe search table, as a power of two. The resulting " +"memory usage is ``1 << (chain_log+2)`` bytes. Larger tables result in better " +"and slower compression. This parameter has no effect for " +"the :attr:`~Strategy.fast` strategy. It's still useful when " +"using :attr:`~Strategy.dfast` strategy, in which case it defines a secondary " +"probe table." +msgstr "" + +#: ../../library/compression.zstd.rst:566 +msgid "" +"Number of search attempts, as a power of two. More attempts result in better " +"and slower compression. This parameter is useless for :attr:`~Strategy.fast` " +"and :attr:`~Strategy.dfast` strategies." +msgstr "" + +#: ../../library/compression.zstd.rst:574 +msgid "" +"Minimum size of searched matches. Larger values increase compression and " +"decompression speed, but decrease ratio. Note that Zstandard can still find " +"matches of smaller size, it just tweaks its search algorithm to look for " +"this size and larger. For all strategies < :attr:`~Strategy.btopt`, the " +"effective minimum is ``4``; for all strategies > :attr:`~Strategy.fast`, the " +"effective maximum is ``6``." +msgstr "" + +#: ../../library/compression.zstd.rst:585 +msgid "The impact of this field depends on the selected :class:`Strategy`." +msgstr "" + +#: ../../library/compression.zstd.rst:587 +msgid "" +"For strategies :attr:`~Strategy.btopt`, :attr:`~Strategy.btultra` " +"and :attr:`~Strategy.btultra2`, the value is the length of a match " +"considered \"good enough\" to stop searching. Larger values make compression " +"ratios better, but compresses slower." +msgstr "" + +#: ../../library/compression.zstd.rst:592 +msgid "" +"For strategy :attr:`~Strategy.fast`, it is the distance between match " +"sampling. Larger values make compression faster, but with a worse " +"compression ratio." +msgstr "" + +#: ../../library/compression.zstd.rst:600 +msgid "" +"The higher the value of selected strategy, the more complex the compression " +"technique used by zstd, resulting in higher compression ratios but slower " +"compression." +msgstr "" + +#: ../../library/compression.zstd.rst:604 +msgid ":class:`Strategy`" +msgstr "" + +#: ../../library/compression.zstd.rst:608 +msgid "" +"Long distance matching can be used to improve compression for large inputs " +"by finding large matches at greater distances. It increases memory usage and " +"window size." +msgstr "" + +#: ../../library/compression.zstd.rst:612 +msgid "" +"``True`` or ``1`` enable long distance matching while ``False`` or ``0`` " +"disable it." +msgstr "" + +#: ../../library/compression.zstd.rst:615 +msgid "" +"Enabling this parameter increases " +"default :attr:`~CompressionParameter.window_log` to 128 MiB except when " +"expressly set to a different value. This setting is enabled by default " +"if :attr:`!window_log` >= 128 MiB and the compression strategy " +">= :attr:`~Strategy.btopt` (compression level 16+)." +msgstr "" + +#: ../../library/compression.zstd.rst:623 +msgid "" +"Size of the table for long distance matching, as a power of two. Larger " +"values increase memory usage and compression ratio, but decrease compression " +"speed." +msgstr "" + +#: ../../library/compression.zstd.rst:631 +msgid "" +"Minimum match size for long distance matcher. Larger or too small values can " +"often decrease the compression ratio." +msgstr "" + +#: ../../library/compression.zstd.rst:638 +msgid "" +"Log size of each bucket in the long distance matcher hash table for " +"collision resolution. Larger values improve collision resolution but " +"decrease compression speed." +msgstr "" + +#: ../../library/compression.zstd.rst:646 +msgid "" +"Frequency of inserting/looking up entries into the long distance matcher " +"hash table. Larger values improve compression speed. Deviating far from the " +"default value will likely result in a compression ratio decrease." +msgstr "" + +#: ../../library/compression.zstd.rst:654 +msgid "" +"Write the size of the data to be compressed into the Zstandard frame header " +"when known prior to compressing." +msgstr "" + +#: ../../library/compression.zstd.rst:657 +msgid "This flag only takes effect under the following scenarios:" +msgstr "" + +#: ../../library/compression.zstd.rst:659 +msgid "Calling :func:`compress` for one-shot compression" +msgstr "" + +#: ../../library/compression.zstd.rst:660 +msgid "" +"Providing all of the data to be compressed in the frame in a " +"single :meth:`ZstdCompressor.compress` call, with " +"the :attr:`ZstdCompressor.FLUSH_FRAME` mode." +msgstr "" + +#: ../../library/compression.zstd.rst:663 +msgid "" +"Calling :meth:`ZstdCompressor.set_pledged_input_size` with the exact amount " +"of data that will be provided to the compressor prior to any calls " +"to :meth:`ZstdCompressor.compress` for the current frame. :meth:`!" +"ZstdCompressor.set_pledged_input_size` must be called for each new frame." +msgstr "" + +#: ../../library/compression.zstd.rst:669 +msgid "" +"All other compression calls may not write the size information into the " +"frame header." +msgstr "" + +#: ../../library/compression.zstd.rst:672 +msgid "" +"``True`` or ``1`` enable the content size flag while ``False`` or ``0`` " +"disable it." +msgstr "" + +#: ../../library/compression.zstd.rst:677 +msgid "" +"A four-byte checksum using XXHash64 of the uncompressed content is written " +"at the end of each frame. Zstandard's decompression code verifies the " +"checksum. If there is a mismatch a :class:`ZstdError` exception is raised." +msgstr "" + +#: ../../library/compression.zstd.rst:682 +msgid "" +"``True`` or ``1`` enable checksum generation while ``False`` or ``0`` " +"disable it." +msgstr "" + +#: ../../library/compression.zstd.rst:687 +msgid "" +"When compressing with a :class:`ZstdDict`, the dictionary's ID is written " +"into the frame header." +msgstr "" + +#: ../../library/compression.zstd.rst:690 +msgid "" +"``True`` or ``1`` enable storing the dictionary ID while ``False`` or ``0`` " +"disable it." +msgstr "" + +#: ../../library/compression.zstd.rst:695 +msgid "" +"Select how many threads will be spawned to compress in parallel. " +"When :attr:`!nb_workers` > 0, enables multi-threaded compression, a value of " +"``1`` means \"one-thread multi-threaded mode\". More workers improve speed, " +"but also increase memory usage and slightly reduce compression ratio." +msgstr "" + +#: ../../library/compression.zstd.rst:700 +msgid "A value of zero disables multi-threading." +msgstr "" + +#: ../../library/compression.zstd.rst:704 +msgid "" +"Size of a compression job, in bytes. This value is enforced only " +"when :attr:`~CompressionParameter.nb_workers` >= 1. Each compression job is " +"completed in parallel, so this value can indirectly impact the number of " +"active threads." +msgstr "" + +#: ../../library/compression.zstd.rst:713 +msgid "" +"Sets how much data is reloaded from previous jobs (threads) for new jobs to " +"be used by the look behind window during compression. This value is only " +"used when :attr:`~CompressionParameter.nb_workers` >= 1. Acceptable values " +"vary from 0 to 9." +msgstr "" + +#: ../../library/compression.zstd.rst:718 +msgid "0 means dynamically set the overlap amount" +msgstr "" + +#: ../../library/compression.zstd.rst:719 +msgid "1 means no overlap" +msgstr "" + +#: ../../library/compression.zstd.rst:720 +msgid "9 means use a full window size from the previous job" +msgstr "" + +#: ../../library/compression.zstd.rst:722 +msgid "" +"Each increment halves/doubles the overlap size. \"8\" means an overlap of " +"``window_size/2``, \"7\" means an overlap of ``window_size/4``, etc." +msgstr "" + +#: ../../library/compression.zstd.rst:727 +msgid "" +"An :class:`~enum.IntEnum` containing the advanced decompression parameter " +"keys that can be used when decompressing data. Parameters are optional; any " +"omitted parameter will have it's value selected automatically." +msgstr "" + +#: ../../library/compression.zstd.rst:734 +msgid "Example setting the :attr:`~.window_log_max` to the maximum size::" +msgstr "" + +#: ../../library/compression.zstd.rst:736 +msgid "" +"data = compress(b'Some very long buffer of bytes...')\n" +"\n" +"_lower, upper = DecompressionParameter.window_log_max.bounds()\n" +"\n" +"options = {DecompressionParameter.window_log_max: upper}\n" +"decompress(data, options=options)" +msgstr "" + +#: ../../library/compression.zstd.rst:745 +msgid "" +"Return the tuple of int bounds, ``(lower, upper)``, of a decompression " +"parameter. This method should be called on the attribute you wish to " +"retrieve the bounds of." +msgstr "" + +#: ../../library/compression.zstd.rst:753 +msgid "" +"The base-two logarithm of the maximum size of the window used during " +"decompression. This can be useful to limit the amount of memory used when " +"decompressing data. A larger maximum window size leads to faster " +"decompression." +msgstr "" + +#: ../../library/compression.zstd.rst:763 +msgid "" +"An :class:`~enum.IntEnum` containing strategies for compression. Higher-" +"numbered strategies correspond to more complex and slower compression." +msgstr "" + +#: ../../library/compression.zstd.rst:769 +msgid "" +"The values of attributes of :class:`!Strategy` are not necessarily stable " +"across zstd versions. Only the ordering of the attributes may be relied " +"upon. The attributes are listed below in order." +msgstr "" + +#: ../../library/compression.zstd.rst:773 +msgid "The following strategies are available:" +msgstr "" + +#: ../../library/compression.zstd.rst:795 +msgid "Miscellaneous" +msgstr "" + +#: ../../library/compression.zstd.rst:799 +msgid "" +"Retrieve a :class:`FrameInfo` object containing metadata about a Zstandard " +"frame. Frames contain metadata related to the compressed data they hold." +msgstr "" + +#: ../../library/compression.zstd.rst:805 +msgid "Metadata related to a Zstandard frame." +msgstr "" + +#: ../../library/compression.zstd.rst:809 +msgid "The size of the decompressed contents of the frame." +msgstr "" + +#: ../../library/compression.zstd.rst:813 +msgid "" +"An integer representing the Zstandard dictionary ID needed for decompressing " +"the frame. ``0`` means the dictionary ID was not recorded in the frame " +"header. This may mean that a Zstandard dictionary is not needed, or that the " +"ID of a required dictionary was not recorded." +msgstr "" + +#: ../../library/compression.zstd.rst:821 +msgid "The default compression level for Zstandard: ``3``." +msgstr "" + +#: ../../library/compression.zstd.rst:826 +msgid "" +"Version number of the runtime zstd library as a tuple of integers (major, " +"minor, release)." +msgstr "" + +#: ../../library/compression.zstd.rst:831 +msgid "Examples" +msgstr "" + +#: ../../library/compression.zstd.rst:833 +msgid "Reading in a compressed file:" +msgstr "" + +#: ../../library/compression.zstd.rst:835 +msgid "" +"from compression import zstd\n" +"\n" +"with zstd.open(\"file.zst\") as f:\n" +" file_content = f.read()" +msgstr "" + +#: ../../library/compression.zstd.rst:842 +msgid "Creating a compressed file:" +msgstr "" + +#: ../../library/compression.zstd.rst:844 +msgid "" +"from compression import zstd\n" +"\n" +"data = b\"Insert Data Here\"\n" +"with zstd.open(\"file.zst\", \"w\") as f:\n" +" f.write(data)" +msgstr "" + +#: ../../library/compression.zstd.rst:852 +msgid "Compressing data in memory:" +msgstr "" + +#: ../../library/compression.zstd.rst:854 +msgid "" +"from compression import zstd\n" +"\n" +"data_in = b\"Insert Data Here\"\n" +"data_out = zstd.compress(data_in)" +msgstr "" + +#: ../../library/compression.zstd.rst:861 +msgid "Incremental compression:" +msgstr "" + +#: ../../library/compression.zstd.rst:863 +msgid "" +"from compression import zstd\n" +"\n" +"comp = zstd.ZstdCompressor()\n" +"out1 = comp.compress(b\"Some data\\n\")\n" +"out2 = comp.compress(b\"Another piece of data\\n\")\n" +"out3 = comp.compress(b\"Even more data\\n\")\n" +"out4 = comp.flush()\n" +"# Concatenate all the partial results:\n" +"result = b\"\".join([out1, out2, out3, out4])" +msgstr "" + +#: ../../library/compression.zstd.rst:875 +msgid "Writing compressed data to an already-open file:" +msgstr "" + +#: ../../library/compression.zstd.rst:877 +msgid "" +"from compression import zstd\n" +"\n" +"with open(\"myfile\", \"wb\") as f:\n" +" f.write(b\"This data will not be compressed\\n\")\n" +" with zstd.open(f, \"w\") as zstf:\n" +" zstf.write(b\"This *will* be compressed\\n\")\n" +" f.write(b\"Not compressed\\n\")" +msgstr "" + +#: ../../library/compression.zstd.rst:887 +msgid "Creating a compressed file using compression parameters:" +msgstr "" + +#: ../../library/compression.zstd.rst:889 +msgid "" +"from compression import zstd\n" +"\n" +"options = {\n" +" zstd.CompressionParameter.checksum_flag: 1\n" +"}\n" +"with zstd.open(\"file.zst\", \"w\", options=options) as f:\n" +" f.write(b\"Mind if I squeeze in?\")" +msgstr "" diff --git a/library/concurrency.po b/library/concurrency.po index fc7278d186b..7374fccb7f6 100644 --- a/library/concurrency.po +++ b/library/concurrency.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2021-11-23 13:36+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,6 +36,6 @@ msgstr "" "行什麼樣的任務(CPU 密集或 IO 密集)與偏好的開發風格(事件驅動協作式多工處理" "或搶占式多工處理)。以下為此章節總覽:" -#: ../../library/concurrency.rst:27 +#: ../../library/concurrency.rst:28 msgid "The following are support modules for some of the above services:" msgstr "以下是支援部份上述服務的模組:" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 1ad6ca601ae..e064fad7e0a 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-16 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-01-24 03:33+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,14 +24,16 @@ msgid ":mod:`!concurrent.futures` --- Launching parallel tasks" msgstr ":mod:`!concurrent.futures` --- 啟動平行任務" #: ../../library/concurrent.futures.rst:9 +#, fuzzy msgid "" -"**Source code:** :source:`Lib/concurrent/futures/thread.py` and :source:`Lib/" -"concurrent/futures/process.py`" +"**Source code:** :source:`Lib/concurrent/futures/thread.py`, :source:`Lib/" +"concurrent/futures/process.py`, and :source:`Lib/concurrent/futures/" +"interpreter.py`" msgstr "" "**原始碼:**\\ :source:`Lib/concurrent/futures/thread.py` 與 :source:`Lib/" "concurrent/futures/process.py`" -#: ../../library/concurrent.futures.rst:14 +#: ../../library/concurrent.futures.rst:15 msgid "" "The :mod:`concurrent.futures` module provides a high-level interface for " "asynchronously executing callables." @@ -39,12 +41,13 @@ msgstr "" ":mod:`concurrent.futures` 模組提供了一個高階介面來非同步地 (asynchronously) " "執行可呼叫物件 (callable) 。" -#: ../../library/concurrent.futures.rst:17 +#: ../../library/concurrent.futures.rst:18 +#, fuzzy msgid "" -"The asynchronous execution can be performed with threads, using :class:" -"`ThreadPoolExecutor`, or separate processes, using :class:" -"`ProcessPoolExecutor`. Both implement the same interface, which is defined " -"by the abstract :class:`Executor` class." +"The asynchronous execution can be performed with threads, " +"using :class:`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`, or " +"separate processes, using :class:`ProcessPoolExecutor`. Each implements the " +"same interface, which is defined by the abstract :class:`Executor` class." msgstr "" "非同步執行可以透過 :class:`ThreadPoolExecutor` 來使用執行緒 (thread) 執行,或" "透過 :class:`ProcessPoolExecutor` 來使用單獨行程 (process) 執行。兩者都實作了" @@ -62,11 +65,11 @@ msgstr "" "此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" "availability`。" -#: ../../library/concurrent.futures.rst:25 +#: ../../library/concurrent.futures.rst:27 msgid "Executor Objects" msgstr "Executor 物件" -#: ../../library/concurrent.futures.rst:29 +#: ../../library/concurrent.futures.rst:31 msgid "" "An abstract class that provides methods to execute calls asynchronously. It " "should not be used directly, but through its concrete subclasses." @@ -74,7 +77,7 @@ msgstr "" "提供非同步執行呼叫方法的抽象類別。不應直接使用它,而應透過其具體子類別來使" "用。" -#: ../../library/concurrent.futures.rst:34 +#: ../../library/concurrent.futures.rst:36 msgid "" "Schedules the callable, *fn*, to be executed as ``fn(*args, **kwargs)`` and " "returns a :class:`Future` object representing the execution of the " @@ -83,7 +86,7 @@ msgstr "" "為可呼叫物件 *fn* 排程來以 ``fn(*args, **kwargs)`` 的形式執行並回傳一個表示可" "呼叫的執行的 :class:`Future` 物件。 ::" -#: ../../library/concurrent.futures.rst:38 +#: ../../library/concurrent.futures.rst:40 msgid "" "with ThreadPoolExecutor(max_workers=1) as executor:\n" " future = executor.submit(pow, 323, 1235)\n" @@ -93,70 +96,82 @@ msgstr "" " future = executor.submit(pow, 323, 1235)\n" " print(future.result())" -#: ../../library/concurrent.futures.rst:44 +#: ../../library/concurrent.futures.rst:46 msgid "Similar to :func:`map(fn, *iterables) ` except:" msgstr "類似於 :func:`map(fn, *iterables) `,除了:" -#: ../../library/concurrent.futures.rst:46 -msgid "the *iterables* are collected immediately rather than lazily;" -msgstr "*iterables* 立即被收集而不是延遲 (lazily) 收集;" - #: ../../library/concurrent.futures.rst:48 msgid "" +"The *iterables* are collected immediately rather than lazily, unless a " +"*buffersize* is specified to limit the number of submitted tasks whose " +"results have not yet been yielded. If the buffer is full, iteration over the " +"*iterables* pauses until a result is yielded from the buffer." +msgstr "" + +#: ../../library/concurrent.futures.rst:53 +msgid "" "*fn* is executed asynchronously and several calls to *fn* may be made " "concurrently." msgstr "*fn* 是非同步執行的,並且對 *fn* 的多次呼叫可以並行處理。" -#: ../../library/concurrent.futures.rst:51 +#: ../../library/concurrent.futures.rst:56 msgid "" -"The returned iterator raises a :exc:`TimeoutError` if :meth:`~iterator." -"__next__` is called and the result isn't available after *timeout* seconds " -"from the original call to :meth:`Executor.map`. *timeout* can be an int or a " -"float. If *timeout* is not specified or ``None``, there is no limit to the " -"wait time." +"The returned iterator raises a :exc:`TimeoutError` " +"if :meth:`~iterator.__next__` is called and the result isn't available after " +"*timeout* seconds from the original call to :meth:`Executor.map`. *timeout* " +"can be an int or a float. If *timeout* is not specified or ``None``, there " +"is no limit to the wait time." msgstr "" "如果 :meth:`~iterator.__next__` 被呼叫,且在原先呼叫 :meth:`Executor.map` 的 " "*timeout* 秒後結果仍不可用,回傳的疊代器就會引發 :exc:`TimeoutError`。" "*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或為 ``None``,則等待時間" "就不會有限制。" -#: ../../library/concurrent.futures.rst:57 +#: ../../library/concurrent.futures.rst:62 msgid "" "If a *fn* call raises an exception, then that exception will be raised when " "its value is retrieved from the iterator." msgstr "如果 *fn* 呼叫引發例外,則當從疊代器中檢索到它的值時將引發該例外。" -#: ../../library/concurrent.futures.rst:60 +#: ../../library/concurrent.futures.rst:65 +#, fuzzy msgid "" "When using :class:`ProcessPoolExecutor`, this method chops *iterables* into " "a number of chunks which it submits to the pool as separate tasks. The " "(approximate) size of these chunks can be specified by setting *chunksize* " "to a positive integer. For very long iterables, using a large value for " "*chunksize* can significantly improve performance compared to the default " -"size of 1. With :class:`ThreadPoolExecutor`, *chunksize* has no effect." +"size of 1. With :class:`ThreadPoolExecutor` " +"and :class:`InterpreterPoolExecutor`, *chunksize* has no effect." msgstr "" "使用 :class:`ProcessPoolExecutor` 時,此方法將 *iterables* 分成許多分塊 " "(chunks),並將其作為獨立的任務來提交給池 (pool)。可以透過將 *chunksize* 設定" "為正整數來指定這些分塊的(約略)大小。對於非常長的可疊代物件,*chunksize* 使" -"用較大的值(與預設大小 1 相比)可以顯著提高性能。對於 :class:" -"`ThreadPoolExecutor`,*chunksize* 無效。" +"用較大的值(與預設大小 1 相比)可以顯著提高性能。對" +"於 :class:`ThreadPoolExecutor`,*chunksize* 無效。" -#: ../../library/concurrent.futures.rst:68 -msgid "Added the *chunksize* argument." +#: ../../library/concurrent.futures.rst:74 +#, fuzzy +msgid "Added the *chunksize* parameter." msgstr "新增 *chunksize* 引數。" -#: ../../library/concurrent.futures.rst:73 +#: ../../library/concurrent.futures.rst:77 +#, fuzzy +msgid "Added the *buffersize* parameter." +msgstr "新增 *chunksize* 引數。" + +#: ../../library/concurrent.futures.rst:82 msgid "" "Signal the executor that it should free any resources that it is using when " -"the currently pending futures are done executing. Calls to :meth:`Executor." -"submit` and :meth:`Executor.map` made after shutdown will raise :exc:" -"`RuntimeError`." +"the currently pending futures are done executing. Calls " +"to :meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will " +"raise :exc:`RuntimeError`." msgstr "" "向 executor 發出訊號 (signal),表明它應該在目前未定 (pending) 的 future 完成" -"執行時釋放它正在使用的任何資源。在關閉後呼叫 :meth:`Executor.submit` 和 :" -"meth:`Executor.map` 將引發 :exc:`RuntimeError`。" +"執行時釋放它正在使用的任何資源。在關閉後呼叫 :meth:`Executor.submit` " +"和 :meth:`Executor.map` 將引發 :exc:`RuntimeError`。" -#: ../../library/concurrent.futures.rst:78 +#: ../../library/concurrent.futures.rst:87 msgid "" "If *wait* is ``True`` then this method will not return until all the pending " "futures are done executing and the resources associated with the executor " @@ -172,7 +187,7 @@ msgstr "" "*wait* 的值如何,整個 Python 程式都不會退出,直到所有未定的 futures 執行完" "畢。" -#: ../../library/concurrent.futures.rst:86 +#: ../../library/concurrent.futures.rst:95 msgid "" "If *cancel_futures* is ``True``, this method will cancel all pending futures " "that the executor has not started running. Any futures that are completed or " @@ -182,7 +197,7 @@ msgstr "" "定 future。無論 *cancel_futures* 的值如何,任何已完成或正在運行的 future 都不" "會被取消。" -#: ../../library/concurrent.futures.rst:91 +#: ../../library/concurrent.futures.rst:100 msgid "" "If both *cancel_futures* and *wait* are ``True``, all futures that the " "executor has started running will be completed prior to this method " @@ -191,18 +206,20 @@ msgstr "" "如果 *cancel_futures* 和 *wait* 都為 ``True``,則 executor 已開始運行的所有 " "future 將在此方法回傳之前完成。剩餘的 future 被取消。" -#: ../../library/concurrent.futures.rst:95 +#: ../../library/concurrent.futures.rst:104 +#, fuzzy msgid "" -"You can avoid having to call this method explicitly if you use the executor " -"as a :term:`context manager` via the :keyword:`with` statement, which will " -"shutdown the :class:`Executor` (waiting as if :meth:`Executor.shutdown` were " -"called with *wait* set to ``True``)::" +"You can avoid having to call this method explicitly if you use " +"the :keyword:`with` statement, which will shutdown the :class:`Executor` " +"(waiting as if :meth:`Executor.shutdown` were called with *wait* set to " +"``True``)::" msgstr "" -"如果透過 :keyword:`with` 陳述式來將 executor 作為\\ :term:`情境管理器 `\\ " -"使用,你就可以不用明確地呼叫此方法,這將會自己關閉 :class:`Executor`\\(如同呼叫" -" :meth:`Executor.shutdown` 時 *wait* 被設定為 ``True`` 般等待): ::" +"如果透過 :keyword:`with` 陳述式來將 executor 作為\\ :term:`情境管理器 " +"`\\ 使用,你就可以不用明確地呼叫此方法,這將會自己關" +"閉 :class:`Executor`\\(如同呼叫 :meth:`Executor.shutdown` 時 *wait* 被設定" +"為 ``True`` 般等待): ::" -#: ../../library/concurrent.futures.rst:100 +#: ../../library/concurrent.futures.rst:109 msgid "" "import shutil\n" "with ThreadPoolExecutor(max_workers=4) as e:\n" @@ -218,15 +235,15 @@ msgstr "" " e.submit(shutil.copy, 'src3.txt', 'dest3.txt')\n" " e.submit(shutil.copy, 'src4.txt', 'dest4.txt')" -#: ../../library/concurrent.futures.rst:107 +#: ../../library/concurrent.futures.rst:116 msgid "Added *cancel_futures*." msgstr "新增 *cancel_futures*。" -#: ../../library/concurrent.futures.rst:112 +#: ../../library/concurrent.futures.rst:121 msgid "ThreadPoolExecutor" msgstr "ThreadPoolExecutor" -#: ../../library/concurrent.futures.rst:114 +#: ../../library/concurrent.futures.rst:123 msgid "" ":class:`ThreadPoolExecutor` is an :class:`Executor` subclass that uses a " "pool of threads to execute calls asynchronously." @@ -234,7 +251,7 @@ msgstr "" ":class:`ThreadPoolExecutor` 是一個 :class:`Executor` 子類別,它使用執行緒池來" "非同步地執行呼叫。" -#: ../../library/concurrent.futures.rst:117 +#: ../../library/concurrent.futures.rst:126 msgid "" "Deadlocks can occur when the callable associated with a :class:`Future` " "waits on the results of another :class:`Future`. For example::" @@ -242,7 +259,7 @@ msgstr "" "當與 :class:`Future` 關聯的可呼叫物件等待另一個 :class:`Future` 的結果時,可" "能會發生死鎖 (deadlock)。例如: ::" -#: ../../library/concurrent.futures.rst:120 +#: ../../library/concurrent.futures.rst:129 msgid "" "import time\n" "def wait_on_b():\n" @@ -276,11 +293,11 @@ msgstr "" "a = executor.submit(wait_on_b)\n" "b = executor.submit(wait_on_a)" -#: ../../library/concurrent.futures.rst:136 +#: ../../library/concurrent.futures.rst:145 msgid "And::" msgstr "和: ::" -#: ../../library/concurrent.futures.rst:138 +#: ../../library/concurrent.futures.rst:147 msgid "" "def wait_on_future():\n" " f = executor.submit(pow, 5, 2)\n" @@ -300,7 +317,7 @@ msgstr "" "executor = ThreadPoolExecutor(max_workers=1)\n" "executor.submit(wait_on_future)" -#: ../../library/concurrent.futures.rst:150 +#: ../../library/concurrent.futures.rst:159 msgid "" "An :class:`Executor` subclass that uses a pool of at most *max_workers* " "threads to execute calls asynchronously." @@ -308,7 +325,7 @@ msgstr "" "一個 :class:`Executor` 子類別,它使用最多有 *max_workers* 個執行緒的池來非同" "步地執行呼叫。" -#: ../../library/concurrent.futures.rst:153 +#: ../../library/concurrent.futures.rst:162 msgid "" "All threads enqueued to ``ThreadPoolExecutor`` will be joined before the " "interpreter can exit. Note that the exit handler which does this is executed " @@ -323,7 +340,7 @@ msgstr "" "退出 (gracefully exit)。因此,建議不要將 ``ThreadPoolExecutor`` 用於長時間運" "行的任務。" -#: ../../library/concurrent.futures.rst:160 +#: ../../library/concurrent.futures.rst:169 msgid "" "*initializer* is an optional callable that is called at the start of each " "worker thread; *initargs* is a tuple of arguments passed to the " @@ -333,37 +350,37 @@ msgid "" msgstr "" "*initializer* 是一個可選的可呼叫物件,在每個工作執行緒開始時呼叫; " "*initargs* 是傳遞給 initializer 的引數元組 (tuple)。如果 *initializer* 引發例" -"外,所有目前未定的作業以及任何向池中提交 (submit) 更多作業的嘗試都將引發 :" -"exc:`~concurrent.futures.thread.BrokenThreadPool`。" +"外,所有目前未定的作業以及任何向池中提交 (submit) 更多作業的嘗試都將引" +"發 :exc:`~concurrent.futures.thread.BrokenThreadPool`。" -#: ../../library/concurrent.futures.rst:166 +#: ../../library/concurrent.futures.rst:175 msgid "" "If *max_workers* is ``None`` or not given, it will default to the number of " -"processors on the machine, multiplied by ``5``, assuming that :class:" -"`ThreadPoolExecutor` is often used to overlap I/O instead of CPU work and " -"the number of workers should be higher than the number of workers for :class:" -"`ProcessPoolExecutor`." +"processors on the machine, multiplied by ``5``, assuming " +"that :class:`ThreadPoolExecutor` is often used to overlap I/O instead of CPU " +"work and the number of workers should be higher than the number of workers " +"for :class:`ProcessPoolExecutor`." msgstr "" "如果 *max_workers* 為 ``None`` 或未給定,它將預設為機器上的處理器數量乘以 " "``5``,這假定了 :class:`ThreadPoolExecutor` 通常用於 I/O 重疊而非 CPU 密集的" "作業,並且 worker 的數量應該高於 :class:`ProcessPoolExecutor` 的 worker 數" "量。" -#: ../../library/concurrent.futures.rst:174 +#: ../../library/concurrent.futures.rst:183 msgid "" -"Added the *thread_name_prefix* parameter to allow users to control the :" -"class:`threading.Thread` names for worker threads created by the pool for " -"easier debugging." +"Added the *thread_name_prefix* parameter to allow users to control " +"the :class:`threading.Thread` names for worker threads created by the pool " +"for easier debugging." msgstr "" "新增 *thread_name_prefix* 參數以允許使用者控制由池所建立的工作執行緒 (worker " "thread) 的 :class:`threading.Thread` 名稱,以便於除錯。" -#: ../../library/concurrent.futures.rst:179 -#: ../../library/concurrent.futures.rst:292 +#: ../../library/concurrent.futures.rst:188 +#: ../../library/concurrent.futures.rst:391 msgid "Added the *initializer* and *initargs* arguments." msgstr "新增 *initializer* 與 *initargs* 引數。" -#: ../../library/concurrent.futures.rst:182 +#: ../../library/concurrent.futures.rst:191 msgid "" "Default value of *max_workers* is changed to ``min(32, os.cpu_count() + " "4)``. This default value preserves at least 5 workers for I/O bound tasks. " @@ -374,7 +391,7 @@ msgstr "" "集任務至少保留了 5 個 worker。它最多使用 32 個 CPU 核心來執行CPU 密集任務,以" "釋放 GIL。並且它避免了在多核機器上隱晦地使用非常大量的資源。" -#: ../../library/concurrent.futures.rst:188 +#: ../../library/concurrent.futures.rst:197 msgid "" "ThreadPoolExecutor now reuses idle worker threads before starting " "*max_workers* worker threads too." @@ -382,18 +399,18 @@ msgstr "" "ThreadPoolExecutor 現在在啟動 *max_workers* 工作執行緒之前會重用 (reuse) 空閒" "的工作執行緒。" -#: ../../library/concurrent.futures.rst:191 +#: ../../library/concurrent.futures.rst:200 msgid "" -"Default value of *max_workers* is changed to ``min(32, (os." -"process_cpu_count() or 1) + 4)``." +"Default value of *max_workers* is changed to ``min(32, " +"(os.process_cpu_count() or 1) + 4)``." msgstr "" "*max_workers* 的預設值被改為 ``min(32, (os.process_cpu_count() or 1) + 4)``。" -#: ../../library/concurrent.futures.rst:199 +#: ../../library/concurrent.futures.rst:208 msgid "ThreadPoolExecutor Example" msgstr "ThreadPoolExecutor 範例" -#: ../../library/concurrent.futures.rst:202 +#: ../../library/concurrent.futures.rst:211 msgid "" "import concurrent.futures\n" "import urllib.request\n" @@ -424,36 +441,155 @@ msgid "" " print('%r page is %d bytes' % (url, len(data)))" msgstr "" -#: ../../library/concurrent.futures.rst:231 +#: ../../library/concurrent.futures.rst:240 +#, fuzzy +msgid "InterpreterPoolExecutor" +msgstr "ThreadPoolExecutor" + +#: ../../library/concurrent.futures.rst:242 +msgid "" +"The :class:`InterpreterPoolExecutor` class uses a pool of interpreters to " +"execute calls asynchronously. It is a :class:`ThreadPoolExecutor` subclass, " +"which means each worker is running in its own thread. The difference here is " +"that each worker has its own interpreter, and runs each task using that " +"interpreter." +msgstr "" + +#: ../../library/concurrent.futures.rst:248 +msgid "" +"The biggest benefit to using interpreters instead of only threads is true " +"multi-core parallelism. Each interpreter has its own :term:`Global " +"Interpreter Lock `, so code running in one " +"interpreter can run on one CPU core, while code in another interpreter runs " +"unblocked on a different core." +msgstr "" + +#: ../../library/concurrent.futures.rst:254 +msgid "" +"The tradeoff is that writing concurrent code for use with multiple " +"interpreters can take extra effort. However, this is because it forces you " +"to be deliberate about how and when interpreters interact, and to be " +"explicit about what data is shared between interpreters. This results in " +"several benefits that help balance the extra effort, including true multi-" +"core parallelism, For example, code written this way can make it easier to " +"reason about concurrency. Another major benefit is that you don't have to " +"deal with several of the big pain points of using threads, like race " +"conditions." +msgstr "" + +#: ../../library/concurrent.futures.rst:264 +msgid "" +"Each worker's interpreter is isolated from all the other interpreters. " +"\"Isolated\" means each interpreter has its own runtime state and operates " +"completely independently. For example, if you redirect :data:`sys.stdout` " +"in one interpreter, it will not be automatically redirected to any other " +"interpreter. If you import a module in one interpreter, it is not " +"automatically imported in any other. You would need to import the module " +"separately in interpreter where you need it. In fact, each module imported " +"in an interpreter is a completely separate object from the same module in a " +"different interpreter, including :mod:`sys`, :mod:`builtins`, and even " +"``__main__``." +msgstr "" + +#: ../../library/concurrent.futures.rst:276 +msgid "" +"Isolation means a mutable object, or other data, cannot be used by more than " +"one interpreter at the same time. That effectively means interpreters " +"cannot actually share such objects or data. Instead, each interpreter must " +"have its own copy, and you will have to synchronize any changes between the " +"copies manually. Immutable objects and data, like the builtin singletons, " +"strings, and tuples of immutable objects, don't have these limitations." +msgstr "" + +#: ../../library/concurrent.futures.rst:284 +msgid "" +"Communicating and synchronizing between interpreters is most effectively " +"done using dedicated tools, like those proposed in :pep:`734`. One less " +"efficient alternative is to serialize with :mod:`pickle` and then send the " +"bytes over a shared :mod:`socket ` or :func:`pipe `." +msgstr "" + +#: ../../library/concurrent.futures.rst:292 +msgid "" +"A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously " +"using a pool of at most *max_workers* threads. Each thread runs tasks in " +"its own interpreter. The worker interpreters are isolated from each other, " +"which means each has its own runtime state and that they can't share any " +"mutable objects or other data. Each interpreter has its own :term:`Global " +"Interpreter Lock `, which means code run with this " +"executor has true multi-core parallelism." +msgstr "" + +#: ../../library/concurrent.futures.rst:300 +msgid "" +"The optional *initializer* and *initargs* arguments have the same meaning as " +"for :class:`!ThreadPoolExecutor`: the initializer is run when each worker is " +"created, though in this case it is run in the worker's interpreter. The " +"executor serializes the *initializer* and *initargs* using :mod:`pickle` " +"when sending them to the worker's interpreter." +msgstr "" + +#: ../../library/concurrent.futures.rst:308 +msgid "" +"The executor may replace uncaught exceptions from *initializer* " +"with :class:`~concurrent.futures.interpreter.ExecutionFailed`." +msgstr "" + +#: ../../library/concurrent.futures.rst:311 +msgid "Other caveats from parent :class:`ThreadPoolExecutor` apply here." +msgstr "" + +#: ../../library/concurrent.futures.rst:313 +msgid "" +":meth:`~Executor.submit` and :meth:`~Executor.map` work like normal, except " +"the worker serializes the callable and arguments using :mod:`pickle` when " +"sending them to its interpreter. The worker likewise serializes the return " +"value when sending it back." +msgstr "" + +#: ../../library/concurrent.futures.rst:318 +msgid "" +"When a worker's current task raises an uncaught exception, the worker always " +"tries to preserve the exception as-is. If that is successful then it also " +"sets the ``__cause__`` to a " +"corresponding :class:`~concurrent.futures.interpreter.ExecutionFailed` " +"instance, which contains a summary of the original exception. In the " +"uncommon case that the worker is not able to preserve the original as-is " +"then it directly preserves the " +"corresponding :class:`~concurrent.futures.interpreter.ExecutionFailed` " +"instance instead." +msgstr "" + +#: ../../library/concurrent.futures.rst:330 msgid "ProcessPoolExecutor" msgstr "ProcessPoolExecutor" -#: ../../library/concurrent.futures.rst:233 +#: ../../library/concurrent.futures.rst:332 msgid "" "The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that " -"uses a pool of processes to execute calls asynchronously. :class:" -"`ProcessPoolExecutor` uses the :mod:`multiprocessing` module, which allows " -"it to side-step the :term:`Global Interpreter Lock ` but also means that only picklable objects can be executed and " -"returned." +"uses a pool of processes to execute calls " +"asynchronously. :class:`ProcessPoolExecutor` uses the :mod:`multiprocessing` " +"module, which allows it to side-step the :term:`Global Interpreter Lock " +"` but also means that only picklable objects can be " +"executed and returned." msgstr "" ":class:`ProcessPoolExecutor` 類別是一個 :class:`Executor` 的子類別,它使用行" -"程池來非同步地執行呼叫。:class:`ProcessPoolExecutor` 使用了 :mod:" -"`multiprocessing` 模組,這允許它避開\\ :term:`全域直譯器鎖 (Global " +"程池來非同步地執行呼叫。:class:`ProcessPoolExecutor` 使用" +"了 :mod:`multiprocessing` 模組,這允許它避開\\ :term:`全域直譯器鎖 (Global " "Interpreter Lock) `,但也意味著只能執行和回傳可被 " "pickle 的 (picklable) 物件。" -#: ../../library/concurrent.futures.rst:240 +#: ../../library/concurrent.futures.rst:339 msgid "" "The ``__main__`` module must be importable by worker subprocesses. This " "means that :class:`ProcessPoolExecutor` will not work in the interactive " "interpreter." msgstr "" -"``__main__`` 模組必須可以被工作子行程 (worker subprocess) 引入。這意味著 :" -"class:`ProcessPoolExecutor` 將無法在交互式直譯器 (interactive interpreter) 中" -"工作。" +"``__main__`` 模組必須可以被工作子行程 (worker subprocess) 引入。這意味" +"著 :class:`ProcessPoolExecutor` 將無法在交互式直譯器 (interactive " +"interpreter) 中工作。" -#: ../../library/concurrent.futures.rst:243 +#: ../../library/concurrent.futures.rst:342 msgid "" "Calling :class:`Executor` or :class:`Future` methods from a callable " "submitted to a :class:`ProcessPoolExecutor` will result in deadlock." @@ -461,15 +597,16 @@ msgstr "" "從提交給 :class:`ProcessPoolExecutor` 的可呼叫物件中呼叫 :class:`Executor` " "或 :class:`Future` 方法將導致死鎖。" -#: ../../library/concurrent.futures.rst:246 +#: ../../library/concurrent.futures.rst:345 msgid "" "Note that the restrictions on functions and arguments needing to picklable " -"as per :class:`multiprocessing.Process` apply when using :meth:`~Executor." -"submit` and :meth:`~Executor.map` on a :class:`ProcessPoolExecutor`. A " -"function defined in a REPL or a lambda should not be expected to work." +"as per :class:`multiprocessing.Process` apply when " +"using :meth:`~Executor.submit` and :meth:`~Executor.map` on " +"a :class:`ProcessPoolExecutor`. A function defined in a REPL or a lambda " +"should not be expected to work." msgstr "" -#: ../../library/concurrent.futures.rst:253 +#: ../../library/concurrent.futures.rst:352 msgid "" "An :class:`Executor` subclass that executes calls asynchronously using a " "pool of at most *max_workers* processes. If *max_workers* is ``None`` or " @@ -480,20 +617,20 @@ msgid "" "the default chosen will be at most ``61``, even if more processors are " "available. *mp_context* can be a :mod:`multiprocessing` context or ``None``. " "It will be used to launch the workers. If *mp_context* is ``None`` or not " -"given, the default :mod:`multiprocessing` context is used. See :ref:" -"`multiprocessing-start-methods`." +"given, the default :mod:`multiprocessing` context is used. " +"See :ref:`multiprocessing-start-methods`." msgstr "" "一個 :class:`Executor` 子類別,它使用了最多有 *max_workers* 個行程的池來非同" -"步地執行呼叫。如果 *max_workers* 為 ``None`` 或未給定,它將被預設為 :func:" -"`os.process_cpu_count`。如果 *max_workers* 小於或等於 ``0``,則會引發 :exc:" -"`ValueError`。在 Windows 上,*max_workers* 必須小於或等於 ``61``。如果不是," -"則會引發 :exc:`ValueError`。如果 *max_workers* 為 ``None``,則預設選擇最多為 " -"``61``,即便有更多處理器可用。*mp_context* 可以是 :mod:`multiprocessing` 情" -"境 (context) 或 ``None``。它將用於啟動 worker。如果 *mp_context* 為 ``None`` " -"或未給定,則使用預設的 :mod:`multiprocessing` 情境。請見 :ref:" -"`multiprocessing-start-methods`。" +"步地執行呼叫。如果 *max_workers* 為 ``None`` 或未給定,它將被預設" +"為 :func:`os.process_cpu_count`。如果 *max_workers* 小於或等於 ``0``,則會引" +"發 :exc:`ValueError`。在 Windows 上,*max_workers* 必須小於或等於 ``61``。如" +"果不是,則會引發 :exc:`ValueError`。如果 *max_workers* 為 ``None``,則預設選" +"擇最多為 ``61``,即便有更多處理器可用。*mp_context* 可以" +"是 :mod:`multiprocessing` 情境 (context) 或 ``None``。它將用於啟動 worker。如" +"果 *mp_context* 為 ``None`` 或未給定,則使用預設的 :mod:`multiprocessing` 情" +"境。請見 :ref:`multiprocessing-start-methods`。" -#: ../../library/concurrent.futures.rst:267 +#: ../../library/concurrent.futures.rst:366 msgid "" "*initializer* is an optional callable that is called at the start of each " "worker process; *initargs* is a tuple of arguments passed to the " @@ -503,10 +640,10 @@ msgid "" msgstr "" "*initializer* 是一個可選的可呼叫物件,在每個工作行程 (worker process) 開始時" "呼叫;*initargs* 是傳遞給 initializer 的引數元組。如果 *initializer* 引發例" -"外,所有目前未定的作業以及任何向池中提交更多作業的嘗試都將引發 :exc:" -"`~concurrent.futures.process.BrokenProcessPool`。" +"外,所有目前未定的作業以及任何向池中提交更多作業的嘗試都將引" +"發 :exc:`~concurrent.futures.process.BrokenProcessPool`。" -#: ../../library/concurrent.futures.rst:273 +#: ../../library/concurrent.futures.rst:372 msgid "" "*max_tasks_per_child* is an optional argument that specifies the maximum " "number of tasks a single process can execute before it will exit and be " @@ -522,68 +659,93 @@ msgstr "" "數的情況下,將預設使用 \"spawn\" 做為 multiprocessing 啟動方法。此功能與 " "\"fork\" 啟動方法不相容。" -#: ../../library/concurrent.futures.rst:281 +#: ../../library/concurrent.futures.rst:380 msgid "" -"When one of the worker processes terminates abruptly, a :exc:`~concurrent." -"futures.process.BrokenProcessPool` error is now raised. Previously, " -"behaviour was undefined but operations on the executor or its futures would " -"often freeze or deadlock." +"When one of the worker processes terminates abruptly, " +"a :exc:`~concurrent.futures.process.BrokenProcessPool` error is now raised. " +"Previously, behaviour was undefined but operations on the executor or its " +"futures would often freeze or deadlock." msgstr "" -"當其中一個工作行程突然終止時,現在會引發 :exc:`~concurrent.futures.process." -"BrokenProcessPool` 錯誤。在過去,此行為是未定義的 (undefined),但對 executor " -"或其 future 的操作經常會發生凍結或死鎖。" +"當其中一個工作行程突然終止時,現在會引" +"發 :exc:`~concurrent.futures.process.BrokenProcessPool` 錯誤。在過去,此行為" +"是未定義的 (undefined),但對 executor 或其 future 的操作經常會發生凍結或死" +"鎖。" -#: ../../library/concurrent.futures.rst:288 +#: ../../library/concurrent.futures.rst:387 msgid "" "The *mp_context* argument was added to allow users to control the " "start_method for worker processes created by the pool." msgstr "" "新增了 *mp_context* 引數以允許使用者控制由池所建立的工作行程的 start_method。" -#: ../../library/concurrent.futures.rst:295 -msgid "" -"The default :mod:`multiprocessing` start method (see :ref:`multiprocessing-" -"start-methods`) will change away from *fork* in Python 3.14. Code that " -"requires *fork* be used for their :class:`ProcessPoolExecutor` should " -"explicitly specify that by passing a ``mp_context=multiprocessing." -"get_context(\"fork\")`` parameter." -msgstr "" -"預設的 :mod:`multiprocessing` 啟動方法(請參閱 :ref:`multiprocessing-start-" -"methods`\\ )將不再是 Python 3.14 中的 *fork*。需要 *fork* 用於其 :class:" -"`ProcessPoolExecutor` 的程式碼應透過傳遞 ``mp_context=multiprocessing." -"get_context(\"fork\")`` 參數來明確指定。" - -#: ../../library/concurrent.futures.rst:302 +#: ../../library/concurrent.futures.rst:393 msgid "" "The *max_tasks_per_child* argument was added to allow users to control the " "lifetime of workers in the pool." msgstr "" "新增了 *max_tasks_per_child* 引數以允許使用者控制池中 worker 的生命週期。" -#: ../../library/concurrent.futures.rst:306 +#: ../../library/concurrent.futures.rst:397 msgid "" -"On POSIX systems, if your application has multiple threads and the :mod:" -"`multiprocessing` context uses the ``\"fork\"`` start method: The :func:`os." -"fork` function called internally to spawn workers may raise a :exc:" -"`DeprecationWarning`. Pass a *mp_context* configured to use a different " -"start method. See the :func:`os.fork` documentation for further explanation." +"On POSIX systems, if your application has multiple threads and " +"the :mod:`multiprocessing` context uses the ``\"fork\"`` start method: " +"The :func:`os.fork` function called internally to spawn workers may raise " +"a :exc:`DeprecationWarning`. Pass a *mp_context* configured to use a " +"different start method. See the :func:`os.fork` documentation for further " +"explanation." msgstr "" "在 POSIX 系統上,如果你的應用程式有多個執行緒並且 :mod:`multiprocessing` 情境" "使用了 ``\"fork\"`` 啟動方法:內部呼叫以產生 worker 的 :func:`os.fork` 函式可" "能會引發 :exc:`DeprecationWarning`。傳遞一個 *mp_context* 以配置為使用不同的" "啟動方法。更多說明請參閱 :func:`os.fork` 文件。" -#: ../../library/concurrent.futures.rst:314 +#: ../../library/concurrent.futures.rst:405 +msgid "" +"*max_workers* uses :func:`os.process_cpu_count` by default, instead " +"of :func:`os.cpu_count`." +msgstr "" + +#: ../../library/concurrent.futures.rst:409 +#, fuzzy +msgid "" +"The default process start method (see :ref:`multiprocessing-start-methods`) " +"changed away from *fork*. If you require the *fork* start method " +"for :class:`ProcessPoolExecutor` you must explicitly pass " +"``mp_context=multiprocessing.get_context(\"fork\")``." +msgstr "" +"預設的 :mod:`multiprocessing` 啟動方法(請參閱 :ref:`multiprocessing-start-" +"methods`\\ )將不再是 Python 3.14 中的 *fork*。需要 *fork* 用於" +"其 :class:`ProcessPoolExecutor` 的程式碼應透過傳遞 " +"``mp_context=multiprocessing.get_context(\"fork\")`` 參數來明確指定。" + +#: ../../library/concurrent.futures.rst:417 +msgid "" +"Attempt to terminate all living worker processes immediately by " +"calling :meth:`Process.terminate ` on " +"each of them. Internally, it will also call :meth:`Executor.shutdown` to " +"ensure that all other resources associated with the executor are freed." +msgstr "" + +#: ../../library/concurrent.futures.rst:422 +#: ../../library/concurrent.futures.rst:434 +msgid "" +"After calling this method the caller should no longer submit tasks to the " +"executor." +msgstr "" + +#: ../../library/concurrent.futures.rst:429 msgid "" -"*max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:" -"`os.cpu_count`." +"Attempt to kill all living worker processes immediately by " +"calling :meth:`Process.kill ` on each of them. " +"Internally, it will also call :meth:`Executor.shutdown` to ensure that all " +"other resources associated with the executor are freed." msgstr "" -#: ../../library/concurrent.futures.rst:321 +#: ../../library/concurrent.futures.rst:442 msgid "ProcessPoolExecutor Example" msgstr "ProcessPoolExecutor 範例" -#: ../../library/concurrent.futures.rst:324 +#: ../../library/concurrent.futures.rst:445 msgid "" "import concurrent.futures\n" "import math\n" @@ -651,19 +813,19 @@ msgstr "" "if __name__ == '__main__':\n" " main()" -#: ../../library/concurrent.futures.rst:359 +#: ../../library/concurrent.futures.rst:480 msgid "Future Objects" msgstr "Future 物件" -#: ../../library/concurrent.futures.rst:361 +#: ../../library/concurrent.futures.rst:482 msgid "" "The :class:`Future` class encapsulates the asynchronous execution of a " "callable. :class:`Future` instances are created by :meth:`Executor.submit`." msgstr "" -":class:`Future` 類別封裝了可呼叫物件的非同步執行。:class:`Future` 實例由 :" -"meth:`Executor.submit` 建立。" +":class:`Future` 類別封裝了可呼叫物件的非同步執行。:class:`Future` 實例" +"由 :meth:`Executor.submit` 建立。" -#: ../../library/concurrent.futures.rst:366 +#: ../../library/concurrent.futures.rst:487 msgid "" "Encapsulates the asynchronous execution of a callable. :class:`Future` " "instances are created by :meth:`Executor.submit` and should not be created " @@ -672,7 +834,7 @@ msgstr "" "封裝可呼叫物件的非同步執行。:class:`Future` 實例由 :meth:`Executor.submit` 建" "立,且除測試外不應直接建立。" -#: ../../library/concurrent.futures.rst:372 +#: ../../library/concurrent.futures.rst:493 msgid "" "Attempt to cancel the call. If the call is currently being executed or " "finished running and cannot be cancelled then the method will return " @@ -682,22 +844,22 @@ msgstr "" "嘗試取消呼叫。如果呼叫目前正在執行或已完成運行且無法取消,則該方法將回傳 " "``False``,否則呼叫將被取消並且該方法將回傳 ``True``。" -#: ../../library/concurrent.futures.rst:379 +#: ../../library/concurrent.futures.rst:500 msgid "Return ``True`` if the call was successfully cancelled." msgstr "如果該呼叫成功被取消,則回傳 ``True``。" -#: ../../library/concurrent.futures.rst:383 +#: ../../library/concurrent.futures.rst:504 msgid "" "Return ``True`` if the call is currently being executed and cannot be " "cancelled." msgstr "如果呼叫正在執行且無法取消,則回傳 ``True``。" -#: ../../library/concurrent.futures.rst:388 +#: ../../library/concurrent.futures.rst:509 msgid "" "Return ``True`` if the call was successfully cancelled or finished running." msgstr "如果呼叫成功被取消或結束運行,則回傳 ``True``。" -#: ../../library/concurrent.futures.rst:393 +#: ../../library/concurrent.futures.rst:514 msgid "" "Return the value returned by the call. If the call hasn't yet completed then " "this method will wait up to *timeout* seconds. If the call hasn't completed " @@ -709,19 +871,19 @@ msgstr "" "叫在 *timeout* 秒內未完成,則會引發 :exc:`TimeoutError`。*timeout* 可以是整數" "或浮點數。如果未指定 *timeout* 或為 ``None``,則等待時間就不會有限制。" -#: ../../library/concurrent.futures.rst:400 -#: ../../library/concurrent.futures.rst:414 +#: ../../library/concurrent.futures.rst:521 +#: ../../library/concurrent.futures.rst:535 msgid "" "If the future is cancelled before completing then :exc:`.CancelledError` " "will be raised." msgstr "如果 future 在完成之前被取消,那麼 :exc:`.CancelledError` 將被引發。" -#: ../../library/concurrent.futures.rst:403 +#: ../../library/concurrent.futures.rst:524 msgid "" "If the call raised an exception, this method will raise the same exception." msgstr "如果該呼叫引發了例外,此方法將引發相同的例外。" -#: ../../library/concurrent.futures.rst:407 +#: ../../library/concurrent.futures.rst:528 msgid "" "Return the exception raised by the call. If the call hasn't yet completed " "then this method will wait up to *timeout* seconds. If the call hasn't " @@ -733,11 +895,11 @@ msgstr "" "呼叫在 *timeout* 秒內未完成,則會引發 :exc:`TimeoutError`。 *timeout* 可以是" "整數或浮點數。如果未指定 *timeout* 或為 ``None``,則等待時間就不會有限制。" -#: ../../library/concurrent.futures.rst:417 +#: ../../library/concurrent.futures.rst:538 msgid "If the call completed without raising, ``None`` is returned." msgstr "如果呼叫在沒有引發的情況下完成,則回傳 ``None``。" -#: ../../library/concurrent.futures.rst:421 +#: ../../library/concurrent.futures.rst:542 msgid "" "Attaches the callable *fn* to the future. *fn* will be called, with the " "future as its only argument, when the future is cancelled or finishes " @@ -746,7 +908,7 @@ msgstr "" "將可呼叫的 *fn* 附加到 future 上。當 future 被取消或完成運行時,*fn* 將被以 " "future 作為其唯一引數來呼叫。" -#: ../../library/concurrent.futures.rst:425 +#: ../../library/concurrent.futures.rst:546 msgid "" "Added callables are called in the order that they were added and are always " "called in a thread belonging to the process that added them. If the " @@ -758,19 +920,19 @@ msgstr "" "如果可呼叫物件引發 :exc:`Exception` 子類別,它將被記錄 (log) 並忽略。如果可呼" "叫物件引發 :exc:`BaseException` 子類別,該行為未定義。" -#: ../../library/concurrent.futures.rst:431 +#: ../../library/concurrent.futures.rst:552 msgid "" "If the future has already completed or been cancelled, *fn* will be called " "immediately." msgstr "如果 future 已經完成或被取消,*fn* 將立即被呼叫。" -#: ../../library/concurrent.futures.rst:434 +#: ../../library/concurrent.futures.rst:555 msgid "" -"The following :class:`Future` methods are meant for use in unit tests and :" -"class:`Executor` implementations." +"The following :class:`Future` methods are meant for use in unit tests " +"and :class:`Executor` implementations." msgstr "以下 :class:`Future` 方法旨在用於單元測試和 :class:`Executor` 實作。" -#: ../../library/concurrent.futures.rst:439 +#: ../../library/concurrent.futures.rst:560 msgid "" "This method should only be called by :class:`Executor` implementations " "before executing the work associated with the :class:`Future` and by unit " @@ -779,18 +941,18 @@ msgstr "" "此方法只能在與 :class:`Future` 關聯的工作被執行之前於 :class:`Executor` 實作" "中呼叫,或者在單元測試中呼叫。" -#: ../../library/concurrent.futures.rst:443 +#: ../../library/concurrent.futures.rst:564 msgid "" -"If the method returns ``False`` then the :class:`Future` was cancelled, i." -"e. :meth:`Future.cancel` was called and returned ``True``. Any threads " +"If the method returns ``False`` then the :class:`Future` was cancelled, " +"i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads " "waiting on the :class:`Future` completing (i.e. through :func:`as_completed` " "or :func:`wait`) will be woken up." msgstr "" -"如果該方法回傳 ``False`` 則 :class:`Future` 已被取消,即 :meth:`Future." -"cancel` 被呼叫並回傳 ``True``。任何等待 :class:`Future` 完成的執行緒(即透" -"過 :func:`as_completed` 或 :func:`wait`)將被喚醒。" +"如果該方法回傳 ``False`` 則 :class:`Future` 已被取消," +"即 :meth:`Future.cancel` 被呼叫並回傳 ``True``。任何等待 :class:`Future` 完成" +"的執行緒(即透過 :func:`as_completed` 或 :func:`wait`)將被喚醒。" -#: ../../library/concurrent.futures.rst:448 +#: ../../library/concurrent.futures.rst:569 msgid "" "If the method returns ``True`` then the :class:`Future` was not cancelled " "and has been put in the running state, i.e. calls to :meth:`Future.running` " @@ -799,55 +961,56 @@ msgstr "" "如果該方法回傳 ``True`` 則代表 :class:`Future` 未被取消並已進入運行狀態,意即" "呼叫 :meth:`Future.running` 將回傳 ``True``。" -#: ../../library/concurrent.futures.rst:452 +#: ../../library/concurrent.futures.rst:573 msgid "" -"This method can only be called once and cannot be called after :meth:`Future." -"set_result` or :meth:`Future.set_exception` have been called." +"This method can only be called once and cannot be called " +"after :meth:`Future.set_result` or :meth:`Future.set_exception` have been " +"called." msgstr "" -"此方法只能呼叫一次,且不能在呼叫 :meth:`Future.set_result` 或 :meth:`Future." -"set_exception` 之後呼叫。" +"此方法只能呼叫一次,且不能在呼叫 :meth:`Future.set_result` " +"或 :meth:`Future.set_exception` 之後呼叫。" -#: ../../library/concurrent.futures.rst:458 +#: ../../library/concurrent.futures.rst:579 msgid "" "Sets the result of the work associated with the :class:`Future` to *result*." msgstr "將與 :class:`Future` 關聯的工作結果設定為 *result*。" -#: ../../library/concurrent.futures.rst:461 -#: ../../library/concurrent.futures.rst:474 +#: ../../library/concurrent.futures.rst:582 +#: ../../library/concurrent.futures.rst:595 msgid "" "This method should only be used by :class:`Executor` implementations and " "unit tests." msgstr "此方法只能在 :class:`Executor` 實作中和單元測試中使用。" -#: ../../library/concurrent.futures.rst:464 -#: ../../library/concurrent.futures.rst:477 +#: ../../library/concurrent.futures.rst:585 +#: ../../library/concurrent.futures.rst:598 msgid "" -"This method raises :exc:`concurrent.futures.InvalidStateError` if the :class:" -"`Future` is already done." +"This method raises :exc:`concurrent.futures.InvalidStateError` if " +"the :class:`Future` is already done." msgstr "" -"如果 :class:`Future` 已經完成,此方法會引發 :exc:`concurrent.futures." -"InvalidStateError`。" +"如果 :class:`Future` 已經完成,此方法會引" +"發 :exc:`concurrent.futures.InvalidStateError`。" -#: ../../library/concurrent.futures.rst:471 +#: ../../library/concurrent.futures.rst:592 msgid "" -"Sets the result of the work associated with the :class:`Future` to the :" -"class:`Exception` *exception*." +"Sets the result of the work associated with the :class:`Future` to " +"the :class:`Exception` *exception*." msgstr "" "將與 :class:`Future` 關聯的工作結果設定為 :class:`Exception` *exception*。" -#: ../../library/concurrent.futures.rst:483 +#: ../../library/concurrent.futures.rst:604 msgid "Module Functions" msgstr "模組函式" -#: ../../library/concurrent.futures.rst:487 +#: ../../library/concurrent.futures.rst:608 msgid "" -"Wait for the :class:`Future` instances (possibly created by different :class:" -"`Executor` instances) given by *fs* to complete. Duplicate futures given to " -"*fs* are removed and will be returned only once. Returns a named 2-tuple of " -"sets. The first set, named ``done``, contains the futures that completed " -"(finished or cancelled futures) before the wait completed. The second set, " -"named ``not_done``, contains the futures that did not complete (pending or " -"running futures)." +"Wait for the :class:`Future` instances (possibly created by " +"different :class:`Executor` instances) given by *fs* to complete. Duplicate " +"futures given to *fs* are removed and will be returned only once. Returns a " +"named 2-tuple of sets. The first set, named ``done``, contains the futures " +"that completed (finished or cancelled futures) before the wait completed. " +"The second set, named ``not_done``, contains the futures that did not " +"complete (pending or running futures)." msgstr "" "等待 *fs* 給定的 :class:`Future` 實例(可能由不同的 :class:`Executor` 實例建" "立)完成。提供給 *fs* 的重複 future 將被刪除,並且只會回傳一次。回傳一個集合" @@ -855,7 +1018,7 @@ msgstr "" "完成的 future(已完成或被取消的 future)。第二組名為 ``not_done``,包含未完成" "的 future(未定或運行中的 future)。" -#: ../../library/concurrent.futures.rst:495 +#: ../../library/concurrent.futures.rst:616 msgid "" "*timeout* can be used to control the maximum number of seconds to wait " "before returning. *timeout* can be an int or float. If *timeout* is not " @@ -864,38 +1027,38 @@ msgstr "" "*timeout* 可用於控制回傳前等待的最大秒數。*timeout* 可以是整數或浮點數。如果" "未指定 *timeout* 或為 ``None``,則等待時間就沒有限制。" -#: ../../library/concurrent.futures.rst:499 +#: ../../library/concurrent.futures.rst:620 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "*return_when* 表示此函式應回傳的時間。它必須是以下常數之一:" -#: ../../library/concurrent.futures.rst:505 +#: ../../library/concurrent.futures.rst:626 msgid "Constant" msgstr "常數" -#: ../../library/concurrent.futures.rst:506 +#: ../../library/concurrent.futures.rst:627 msgid "Description" msgstr "描述" -#: ../../library/concurrent.futures.rst:509 +#: ../../library/concurrent.futures.rst:630 msgid "The function will return when any future finishes or is cancelled." msgstr "當任何 future 完成或被取消時,該函式就會回傳。" -#: ../../library/concurrent.futures.rst:512 +#: ../../library/concurrent.futures.rst:633 msgid "" "The function will return when any future finishes by raising an exception. " -"If no future raises an exception then it is equivalent to :const:" -"`ALL_COMPLETED`." +"If no future raises an exception then it is equivalent " +"to :const:`ALL_COMPLETED`." msgstr "" "該函式會在任何 future 透過引發例外而完結時回傳。如果 future 沒有引發例外,那" "麼它等同於 :const:`ALL_COMPLETED`。" -#: ../../library/concurrent.futures.rst:517 +#: ../../library/concurrent.futures.rst:638 msgid "The function will return when all futures finish or are cancelled." msgstr "當所有 future 都完成或被取消時,該函式才會回傳。" -#: ../../library/concurrent.futures.rst:521 +#: ../../library/concurrent.futures.rst:642 msgid "" "Returns an iterator over the :class:`Future` instances (possibly created by " "different :class:`Executor` instances) given by *fs* that yields futures as " @@ -910,41 +1073,41 @@ msgstr "" "回傳由 *fs* 給定的 :class:`Future` 實例(可能由不同的 :class:`Executor` 實例" "建立)的疊代器,它在完成時產生 future(已完成或被取消的 future)。*fs* 給定的" "任何重複的 future 將只被回傳一次。呼叫 :func:`as_completed` 之前完成的任何 " -"future 將首先產生。如果 :meth:`~iterator.__next__` 被呼叫,並且在原先呼叫 :" -"func:`as_completed` 的 *timeout* 秒後結果仍不可用,則回傳的疊代器會引發 :exc:" -"`TimeoutError`。*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或為 " -"``None``,則等待時間就沒有限制。" +"future 將首先產生。如果 :meth:`~iterator.__next__` 被呼叫,並且在原先呼" +"叫 :func:`as_completed` 的 *timeout* 秒後結果仍不可用,則回傳的疊代器會引" +"發 :exc:`TimeoutError`。*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或" +"為 ``None``,則等待時間就沒有限制。" -#: ../../library/concurrent.futures.rst:534 +#: ../../library/concurrent.futures.rst:655 msgid ":pep:`3148` -- futures - execute computations asynchronously" msgstr ":pep:`3148` -- futures - 非同步地執行運算" -#: ../../library/concurrent.futures.rst:535 +#: ../../library/concurrent.futures.rst:656 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "描述此功能並提出被包含於 Python 標準函式庫中的提案。" -#: ../../library/concurrent.futures.rst:540 +#: ../../library/concurrent.futures.rst:661 msgid "Exception classes" msgstr "例外類別" -#: ../../library/concurrent.futures.rst:546 +#: ../../library/concurrent.futures.rst:667 msgid "Raised when a future is cancelled." msgstr "當 future 被取消時引發。" -#: ../../library/concurrent.futures.rst:550 +#: ../../library/concurrent.futures.rst:671 msgid "" "A deprecated alias of :exc:`TimeoutError`, raised when a future operation " "exceeds the given timeout." msgstr "" ":exc:`TimeoutError` 的棄用別名,在 future 操作超過給定超時 (timeout) 時引發。" -#: ../../library/concurrent.futures.rst:555 +#: ../../library/concurrent.futures.rst:676 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "這個類別是 :exc:`TimeoutError` 的別名。" -#: ../../library/concurrent.futures.rst:560 +#: ../../library/concurrent.futures.rst:681 msgid "" "Derived from :exc:`RuntimeError`, this exception class is raised when an " "executor is broken for some reason, and cannot be used to submit or execute " @@ -953,29 +1116,53 @@ msgstr "" "衍生自 :exc:`RuntimeError`,當執行器因某種原因損壞時會引發此例外類別,並且不" "能用於提交或執行新任務。" -#: ../../library/concurrent.futures.rst:568 +#: ../../library/concurrent.futures.rst:689 msgid "" "Raised when an operation is performed on a future that is not allowed in the " "current state." msgstr "目前狀態下不允許的 future 操作被執行時而引發。" -#: ../../library/concurrent.futures.rst:577 +#: ../../library/concurrent.futures.rst:698 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class " -"is raised when one of the workers of a :class:`~concurrent.futures." -"ThreadPoolExecutor` has failed initializing." +"is raised when one of the workers of " +"a :class:`~concurrent.futures.ThreadPoolExecutor` has failed initializing." msgstr "" -"衍生自 :exc:`~concurrent.futures.BrokenExecutor`,當 :class:`~concurrent." -"futures.ThreadPoolExecutor` 的其中一個 worker 初始化失敗時會引發此例外類別。" +"衍生自 :exc:`~concurrent.futures.BrokenExecutor`," +"當 :class:`~concurrent.futures.ThreadPoolExecutor` 的其中一個 worker 初始化失" +"敗時會引發此例外類別。" -#: ../../library/concurrent.futures.rst:588 +#: ../../library/concurrent.futures.rst:709 +#, fuzzy msgid "" -"Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly :exc:" -"`RuntimeError`), this exception class is raised when one of the workers of " -"a :class:`~concurrent.futures.ProcessPoolExecutor` has terminated in a non-" -"clean fashion (for example, if it was killed from the outside)." +"Derived from :exc:`~concurrent.futures.thread.BrokenThreadPool`, this " +"exception class is raised when one of the workers of " +"a :class:`~concurrent.futures.InterpreterPoolExecutor` has failed " +"initializing." msgstr "" -"衍生自 :exc:`~concurrent.futures.BrokenExecutor`\\(以前為 :exc:" -"`RuntimeError`),當 :class:`~concurrent.futures.ProcessPoolExecutor` 的其中" -"一個 worker 以不乾淨的方式終止時將引發此例外類別(例如它是從外面被 kill 掉" -"的)。" +"衍生自 :exc:`~concurrent.futures.BrokenExecutor`," +"當 :class:`~concurrent.futures.ThreadPoolExecutor` 的其中一個 worker 初始化失" +"敗時會引發此例外類別。" + +#: ../../library/concurrent.futures.rst:718 +msgid "" +"Raised from :class:`~concurrent.futures.InterpreterPoolExecutor` when the " +"given initializer fails or from :meth:`~concurrent.futures.Executor.submit` " +"when there's an uncaught exception from the submitted task." +msgstr "" + +#: ../../library/concurrent.futures.rst:729 +msgid "" +"Derived from :exc:`~concurrent.futures.BrokenExecutor` " +"(formerly :exc:`RuntimeError`), this exception class is raised when one of " +"the workers of a :class:`~concurrent.futures.ProcessPoolExecutor` has " +"terminated in a non-clean fashion (for example, if it was killed from the " +"outside)." +msgstr "" +"衍生自 :exc:`~concurrent.futures.BrokenExecutor`\\(以前" +"為 :exc:`RuntimeError`)," +"當 :class:`~concurrent.futures.ProcessPoolExecutor` 的其中一個 worker 以不乾" +"淨的方式終止時將引發此例外類別(例如它是從外面被 kill 掉的)。" + +#~ msgid "the *iterables* are collected immediately rather than lazily;" +#~ msgstr "*iterables* 立即被收集而不是延遲 (lazily) 收集;" diff --git a/library/concurrent.interpreters.po b/library/concurrent.interpreters.po new file mode 100644 index 00000000000..6fae74559fc --- /dev/null +++ b/library/concurrent.interpreters.po @@ -0,0 +1,525 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/concurrent.interpreters.rst:2 +msgid "" +":mod:`!concurrent.interpreters` --- Multiple interpreters in the same process" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:12 +msgid "**Source code:** :source:`Lib/concurrent/interpreters`" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:16 +msgid "" +"The :mod:`!concurrent.interpreters` module constructs higher-level " +"interfaces on top of the lower level :mod:`!_interpreters` module." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:19 +msgid "" +"The module is primarily meant to provide a basic API for managing " +"interpreters (AKA \"subinterpreters\") and running things in them. Running " +"mostly involves switching to an interpreter (in the current thread) and " +"calling a function in that execution context." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:24 +msgid "" +"For concurrency, interpreters themselves (and this module) don't provide " +"much more than isolation, which on its own isn't useful. Actual concurrency " +"is available separately through :mod:`threads ` See `below " +"`_" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:31 +msgid ":class:`~concurrent.futures.InterpreterPoolExecutor`" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:32 +msgid "combines threads with interpreters in a familiar interface." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:36 +msgid ":ref:`isolating-extensions-howto`" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:37 +msgid "how to update an extension module to support multiple interpreters" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:39 +msgid ":pep:`554`" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:41 +msgid ":pep:`734`" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:43 +msgid ":pep:`684`" +msgstr "" + +#: ../../includes/wasm-notavail.rst:3 +msgid "Availability" +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:51 +msgid "Key details" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:53 +msgid "" +"Before we dive in further, there are a small number of details to keep in " +"mind about using multiple interpreters:" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:56 +msgid "`isolated `_, by default" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:57 +msgid "no implicit threads" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:58 +msgid "not all PyPI packages support use in multiple interpreters yet" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:66 +msgid "Introduction" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:68 +msgid "" +"An \"interpreter\" is effectively the execution context of the Python " +"runtime. It contains all of the state the runtime needs to execute a " +"program. This includes things like the import state and builtins. (Each " +"thread, even if there's only the main thread, has some extra runtime state, " +"in addition to the current interpreter, related to the current exception and " +"the bytecode eval loop.)" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:75 +msgid "" +"The concept and functionality of the interpreter have been a part of Python " +"since version 2.2, but the feature was only available through the C-API and " +"not well known, and the `isolation `_ was relatively " +"incomplete until version 3.12." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:83 +msgid "Multiple Interpreters and Isolation" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:85 +msgid "" +"A Python implementation may support using multiple interpreters in the same " +"process. CPython has this support. Each interpreter is effectively " +"isolated from the others (with a limited number of carefully managed process-" +"global exceptions to the rule)." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:90 +msgid "" +"That isolation is primarily useful as a strong separation between distinct " +"logical components of a program, where you want to have careful control of " +"how those components interact." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:96 +msgid "" +"Interpreters in the same process can technically never be strictly isolated " +"from one another since there are few restrictions on memory access within " +"the same process. The Python runtime makes a best effort at isolation but " +"extension modules may easily violate that. Therefore, do not use multiple " +"interpreters in security-sensitive situations, where they shouldn't have " +"access to each other's data." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:104 +msgid "Running in an Interpreter" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:106 +msgid "" +"Running in a different interpreter involves switching to it in the current " +"thread and then calling some function. The runtime will execute the " +"function using the current interpreter's state. The :mod:`!" +"concurrent.interpreters` module provides a basic API for creating and " +"managing interpreters, as well as the switch-and-call operation." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:113 +msgid "" +"No other threads are automatically started for the operation. There is `a " +"helper `_ for that though. There is another " +"dedicated helper for calling the builtin :func:`exec` in an interpreter." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:118 +msgid "" +"When :func:`exec` (or :func:`eval`) are called in an interpreter, they run " +"using the interpreter's :mod:`!__main__` module as the \"globals\" " +"namespace. The same is true for functions that aren't associated with any " +"module. This is the same as how scripts invoked from the command-line run " +"in the :mod:`!__main__` module." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:128 +msgid "Concurrency and Parallelism" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:130 +msgid "" +"As noted earlier, interpreters do not provide any concurrency on their own. " +"They strictly represent the isolated execution context the runtime will use " +"*in the current thread*. That isolation makes them similar to processes, " +"but they still enjoy in-process efficiency, like threads." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:136 +msgid "" +"All that said, interpreters do naturally support certain flavors of " +"concurrency. There's a powerful side effect of that isolation. It enables a " +"different approach to concurrency than you can take with async or threads. " +"It's a similar concurrency model to CSP or the actor model, a model which is " +"relatively easy to reason about." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:143 +msgid "" +"You can take advantage of that concurrency model in a single thread, " +"switching back and forth between interpreters, Stackless-style. However, " +"this model is more useful when you combine interpreters with multiple " +"threads. This mostly involves starting a new thread, where you switch to " +"another interpreter and run what you want there." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:149 +msgid "" +"Each actual thread in Python, even if you're only running in the main " +"thread, has its own *current* execution context. Multiple threads can use " +"the same interpreter or different ones." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:153 +msgid "" +"At a high level, you can think of the combination of threads and " +"interpreters as threads with opt-in sharing." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:156 +msgid "" +"As a significant bonus, interpreters are sufficiently isolated that they do " +"not share the :term:`GIL`, which means combining threads with multiple " +"interpreters enables full multi-core parallelism. (This has been the case " +"since Python 3.12.)" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:162 +msgid "Communication Between Interpreters" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:164 +msgid "" +"In practice, multiple interpreters are useful only if we have a way to " +"communicate between them. This usually involves some form of message " +"passing, but can even mean sharing data in some carefully managed way." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:169 +msgid "" +"With this in mind, the :mod:`!concurrent.interpreters` module provides " +"a :class:`queue.Queue` implementation, available " +"through :func:`create_queue`." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:176 +msgid "\"Sharing\" Objects" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:178 +msgid "" +"Any data actually shared between interpreters loses the thread-safety " +"provided by the :term:`GIL`. There are various options for dealing with " +"this in extension modules. However, from Python code the lack of thread-" +"safety means objects can't actually be shared, with a few exceptions. " +"Instead, a copy must be created, which means mutable objects won't stay in " +"sync." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:185 +msgid "" +"By default, most objects are copied with :mod:`pickle` when they are passed " +"to another interpreter. Nearly all of the immutable builtin objects are " +"either directly shared or copied efficiently. For example:" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:189 +msgid ":const:`None`" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:190 +msgid ":class:`bool` (:const:`True` and :const:`False`)" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:191 +msgid ":class:`bytes`" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:192 +msgid ":class:`str`" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:193 +msgid ":class:`int`" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:194 +msgid ":class:`float`" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:195 +msgid ":class:`tuple` (of similarly supported objects)" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:197 +msgid "" +"There is a small number of Python types that actually share mutable data " +"between interpreters:" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:200 +msgid ":class:`memoryview`" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:201 +msgid ":class:`Queue`" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:205 +msgid "Reference" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:207 +msgid "This module defines the following functions:" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:211 +msgid "" +"Return a :class:`list` of :class:`Interpreter` objects, one for each " +"existing interpreter." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:216 +msgid "" +"Return an :class:`Interpreter` object for the currently running interpreter." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:221 +msgid "" +"Return an :class:`Interpreter` object for the main interpreter. This is the " +"interpreter the runtime created to run the :term:`REPL` or the script given " +"at the command-line. It is usually the only one." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:227 +msgid "" +"Initialize a new (idle) Python interpreter and return a :class:`Interpreter` " +"object for it." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:232 +msgid "" +"Initialize a new cross-interpreter queue and return a :class:`Queue` object " +"for it." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:237 +msgid "Interpreter objects" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:241 +msgid "A single interpreter in the current process." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:243 +msgid "" +"Generally, :class:`Interpreter` shouldn't be called directly. Instead, " +"use :func:`create` or one of the other module functions." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:248 +#: ../../library/concurrent.interpreters.rst:254 +#: ../../library/concurrent.interpreters.rst:333 +msgid "(read-only)" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:250 +msgid "The underlying interpreter's ID." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:256 +msgid "A string describing where the interpreter came from." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:260 +msgid "" +"Return ``True`` if the interpreter is currently executing code in its :mod:`!" +"__main__` module and ``False`` otherwise." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:265 +msgid "Finalize and destroy the interpreter." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:269 +msgid "Bind objects in the interpreter's :mod:`!__main__` module." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:271 +#: ../../library/concurrent.interpreters.rst:328 +msgid "" +"Some objects are actually shared and some are copied efficiently, but most " +"are copied via :mod:`pickle`. See :ref:`interp-object-sharing`." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:276 +msgid "Run the given source code in the interpreter (in the current thread)." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:280 +msgid "" +"Return the result of calling running the given function in the interpreter " +"(in the current thread)." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:287 +msgid "Run the given function in the interpreter (in a new thread)." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:290 +msgid "Exceptions" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:294 +msgid "" +"This exception, a subclass of :exc:`Exception`, is raised when an " +"interpreter-related error happens." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:299 +msgid "" +"This exception, a subclass of :exc:`InterpreterError`, is raised when the " +"targeted interpreter no longer exists." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:304 +msgid "" +"This exception, a subclass of :exc:`InterpreterError`, is raised when the " +"running code raised an uncaught exception." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:309 +msgid "A basic snapshot of the exception raised in the other interpreter." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:315 +msgid "" +"This exception, a subclass of :exc:`TypeError`, is raised when an object " +"cannot be sent to another interpreter." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:320 +msgid "Communicating Between Interpreters" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:324 +msgid "" +"A wrapper around a low-level, cross-interpreter queue, which implements " +"the :class:`queue.Queue` interface. The underlying queue can only be " +"created through :func:`create_queue`." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:335 +msgid "The queue's ID." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:340 +msgid "" +"This exception, a subclass of :exc:`queue.Empty`, is raised from :meth:`!" +"Queue.get` and :meth:`!Queue.get_nowait` when the queue is empty." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:346 +msgid "" +"This exception, a subclass of :exc:`queue.Full`, is raised from :meth:`!" +"Queue.put` and :meth:`!Queue.put_nowait` when the queue is full." +msgstr "" + +#: ../../library/concurrent.interpreters.rst:352 +msgid "Basic usage" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:354 +msgid "Creating an interpreter and running code in it::" +msgstr "" + +#: ../../library/concurrent.interpreters.rst:356 +msgid "" +"from concurrent import interpreters\n" +"\n" +"interp = interpreters.create()\n" +"\n" +"# Run in the current OS thread.\n" +"\n" +"interp.exec('print(\"spam!\")')\n" +"\n" +"interp.exec(\"\"\"if True:\n" +" print('spam!')\n" +" \"\"\")\n" +"\n" +"from textwrap import dedent\n" +"interp.exec(dedent(\"\"\"\n" +" print('spam!')\n" +" \"\"\"))\n" +"\n" +"def run(arg):\n" +" return arg\n" +"\n" +"res = interp.call(run, 'spam!')\n" +"print(res)\n" +"\n" +"def run():\n" +" print('spam!')\n" +"\n" +"interp.call(run)\n" +"\n" +"# Run in new OS thread.\n" +"\n" +"t = interp.call_in_thread(run)\n" +"t.join()" +msgstr "" diff --git a/library/concurrent.po b/library/concurrent.po index 43635439dec..113943d2b09 100644 --- a/library/concurrent.po +++ b/library/concurrent.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-29 10:36+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,9 +24,17 @@ msgid "The :mod:`!concurrent` package" msgstr ":mod:`!concurrent` 套件" #: ../../library/concurrent.rst:4 -msgid "Currently, there is only one module in this package:" -msgstr "目前此套件只有一個模組:" +msgid "This package contains the following modules:" +msgstr "" #: ../../library/concurrent.rst:6 msgid ":mod:`concurrent.futures` -- Launching parallel tasks" msgstr ":mod:`concurrent.futures` -- 啟動平行任務" + +#: ../../library/concurrent.rst:7 +msgid "" +":mod:`concurrent.interpreters` -- Multiple interpreters in the same process" +msgstr "" + +#~ msgid "Currently, there is only one module in this package:" +#~ msgstr "目前此套件只有一個模組:" diff --git a/library/configparser.po b/library/configparser.po index 4b3a98b31ef..dd63f347beb 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-19 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1462,13 +1462,13 @@ msgstr "" msgid "The default *dict_type* is :class:`collections.OrderedDict`." msgstr "" -#: ../../library/configparser.rst:1031 ../../library/configparser.rst:1320 +#: ../../library/configparser.rst:1031 ../../library/configparser.rst:1324 msgid "" "*allow_no_value*, *delimiters*, *comment_prefixes*, *strict*, " "*empty_lines_in_values*, *default_section* and *interpolation* were added." msgstr "" -#: ../../library/configparser.rst:1036 ../../library/configparser.rst:1325 +#: ../../library/configparser.rst:1036 ../../library/configparser.rst:1329 msgid "The *converters* argument was added." msgstr "新增 *converters* 引數。" @@ -1479,7 +1479,7 @@ msgid "" "converted to strings." msgstr "" -#: ../../library/configparser.rst:1044 ../../library/configparser.rst:1328 +#: ../../library/configparser.rst:1044 ../../library/configparser.rst:1332 msgid "" "The default *dict_type* is :class:`dict`, since it now preserves insertion " "order." @@ -1491,7 +1491,7 @@ msgid "" "and a key without a value is continued with an indented line." msgstr "" -#: ../../library/configparser.rst:1052 ../../library/configparser.rst:1332 +#: ../../library/configparser.rst:1052 ../../library/configparser.rst:1336 msgid "The *allow_unnamed_section* argument was added." msgstr "新增 *allow_unnamed_section* 引數。" @@ -1721,27 +1721,33 @@ msgid "" "surrounded by spaces." msgstr "" -#: ../../library/configparser.rst:1249 +#: ../../library/configparser.rst:1247 +msgid "" +"Raises InvalidWriteError if this would write a representation which cannot " +"be accurately parsed by a future :meth:`read` call from this parser." +msgstr "" + +#: ../../library/configparser.rst:1253 msgid "" "Comments in the original configuration file are not preserved when writing " "the configuration back. What is considered a comment, depends on the given " "values for *comment_prefix* and *inline_comment_prefix*." msgstr "" -#: ../../library/configparser.rst:1257 +#: ../../library/configparser.rst:1261 msgid "" "Remove the specified *option* from the specified *section*. If the section " "does not exist, raise :exc:`NoSectionError`. If the option existed to be " "removed, return :const:`True`; otherwise return :const:`False`." msgstr "" -#: ../../library/configparser.rst:1265 +#: ../../library/configparser.rst:1269 msgid "" "Remove the specified *section* from the configuration. If the section in " "fact existed, return ``True``. Otherwise return ``False``." msgstr "" -#: ../../library/configparser.rst:1271 +#: ../../library/configparser.rst:1275 msgid "" "Transforms the option name *option* as found in an input file or as passed " "in by client code to the form that should be used in the internal " @@ -1750,7 +1756,7 @@ msgid "" "of this name on instances to affect this behavior." msgstr "" -#: ../../library/configparser.rst:1277 +#: ../../library/configparser.rst:1281 msgid "" "You don't need to subclass the parser to use this method, you can also set " "it on an instance, to a function that takes a string argument and returns a " @@ -1758,7 +1764,7 @@ msgid "" "sensitive::" msgstr "" -#: ../../library/configparser.rst:1282 +#: ../../library/configparser.rst:1286 msgid "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" @@ -1766,30 +1772,30 @@ msgstr "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" -#: ../../library/configparser.rst:1285 +#: ../../library/configparser.rst:1289 msgid "" "Note that when reading configuration files, whitespace around the option " "names is stripped before :meth:`optionxform` is called." msgstr "" -#: ../../library/configparser.rst:1291 +#: ../../library/configparser.rst:1295 msgid "" "A special object representing a section name used to reference the unnamed " "section (see :ref:`unnamed-sections`)." msgstr "" -#: ../../library/configparser.rst:1296 +#: ../../library/configparser.rst:1300 msgid "" "The maximum depth for recursive interpolation " "for :meth:`~configparser.ConfigParser.get` when the *raw* parameter is " "false. This is relevant only when the default *interpolation* is used." msgstr "" -#: ../../library/configparser.rst:1304 +#: ../../library/configparser.rst:1308 msgid "RawConfigParser Objects" msgstr "RawConfigParser 物件" -#: ../../library/configparser.rst:1315 +#: ../../library/configparser.rst:1319 msgid "" "Legacy variant of the :class:`ConfigParser`. It has interpolation disabled " "by default and allows for non-string section names, option names, and values " @@ -1797,27 +1803,37 @@ msgid "" "``defaults=`` keyword argument handling." msgstr "" -#: ../../library/configparser.rst:1336 +#: ../../library/configparser.rst:1340 msgid "" "Consider using :class:`ConfigParser` instead which checks types of the " "values to be stored internally. If you don't want interpolation, you can " "use ``ConfigParser(interpolation=None)``." msgstr "" -#: ../../library/configparser.rst:1343 +#: ../../library/configparser.rst:1347 msgid "" -"Add a section named *section* to the instance. If a section by the given " -"name already exists, :exc:`DuplicateSectionError` is raised. If the " -"*default section* name is passed, :exc:`ValueError` is raised." +"Add a section named *section* or :const:`UNNAMED_SECTION` to the instance." msgstr "" -#: ../../library/configparser.rst:1347 +#: ../../library/configparser.rst:1349 +msgid "" +"If the given section already exists, :exc:`DuplicateSectionError` is raised. " +"If the *default section* name is passed, :exc:`ValueError` is raised. " +"If :const:`UNNAMED_SECTION` is passed and support is " +"disabled, :exc:`UnnamedSectionDisabledError` is raised." +msgstr "" + +#: ../../library/configparser.rst:1354 msgid "" "Type of *section* is not checked which lets users create non-string named " "sections. This behaviour is unsupported and may cause internal errors." msgstr "" -#: ../../library/configparser.rst:1353 +#: ../../library/configparser.rst:1357 +msgid "Added support for :const:`UNNAMED_SECTION`." +msgstr "" + +#: ../../library/configparser.rst:1363 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. While it is possible to " @@ -1827,7 +1843,7 @@ msgid "" "string values." msgstr "" -#: ../../library/configparser.rst:1360 +#: ../../library/configparser.rst:1370 msgid "" "This method lets users assign non-string values to keys internally. This " "behaviour is unsupported and will cause errors when attempting to write to a " @@ -1835,32 +1851,32 @@ msgid "" "not allow such assignments to take place." msgstr "" -#: ../../library/configparser.rst:1367 +#: ../../library/configparser.rst:1377 msgid "Exceptions" msgstr "例外" -#: ../../library/configparser.rst:1371 +#: ../../library/configparser.rst:1381 msgid "Base class for all other :mod:`configparser` exceptions." msgstr "" -#: ../../library/configparser.rst:1376 +#: ../../library/configparser.rst:1386 msgid "Exception raised when a specified section is not found." msgstr "" -#: ../../library/configparser.rst:1381 +#: ../../library/configparser.rst:1391 msgid "" "Exception raised if :meth:`~ConfigParser.add_section` is called with the " "name of a section that is already present or in strict parsers when a " "section if found more than once in a single input file, string or dictionary." msgstr "" -#: ../../library/configparser.rst:1385 +#: ../../library/configparser.rst:1395 msgid "" "Added the optional *source* and *lineno* attributes and parameters " "to :meth:`!__init__`." msgstr "" -#: ../../library/configparser.rst:1392 +#: ../../library/configparser.rst:1402 msgid "" "Exception raised by strict parsers if a single option appears twice during " "reading from a single file, string or dictionary. This catches misspellings " @@ -1868,64 +1884,83 @@ msgid "" "representing the same case-insensitive configuration key." msgstr "" -#: ../../library/configparser.rst:1400 +#: ../../library/configparser.rst:1410 msgid "" "Exception raised when a specified option is not found in the specified " "section." msgstr "" -#: ../../library/configparser.rst:1406 +#: ../../library/configparser.rst:1416 msgid "" "Base class for exceptions raised when problems occur performing string " "interpolation." msgstr "" -#: ../../library/configparser.rst:1412 +#: ../../library/configparser.rst:1422 msgid "" "Exception raised when string interpolation cannot be completed because the " "number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass " "of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1419 +#: ../../library/configparser.rst:1429 msgid "" "Exception raised when an option referenced from a value does not exist. " "Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1425 +#: ../../library/configparser.rst:1435 msgid "" "Exception raised when the source text into which substitutions are made does " "not conform to the required syntax. Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1431 +#: ../../library/configparser.rst:1441 msgid "" "Exception raised when attempting to parse a file which has no section " "headers." msgstr "" -#: ../../library/configparser.rst:1437 +#: ../../library/configparser.rst:1446 msgid "Exception raised when errors occur attempting to parse a file." msgstr "" -#: ../../library/configparser.rst:1439 +#: ../../library/configparser.rst:1448 msgid "" "The ``filename`` attribute and :meth:`!__init__` constructor argument were " "removed. They have been available using the name ``source`` since 3.2." msgstr "" -#: ../../library/configparser.rst:1445 +#: ../../library/configparser.rst:1454 msgid "" "Exception raised when a key without a corresponding value is continued with " "an indented line." msgstr "" -#: ../../library/configparser.rst:1451 +#: ../../library/configparser.rst:1461 +msgid "" +"Exception raised when attempting to use the :const:`UNNAMED_SECTION` without " +"enabling it." +msgstr "" + +#: ../../library/configparser.rst:1468 +msgid "" +"Exception raised when an attempted :meth:`ConfigParser.write` would not be " +"parsed accurately with a future :meth:`ConfigParser.read` call." +msgstr "" + +#: ../../library/configparser.rst:1471 +msgid "" +"Ex: Writing a key beginning with the :attr:`ConfigParser.SECTCRE` pattern " +"would parse as a section header when read. Attempting to write this will " +"raise this exception." +msgstr "" + +#: ../../library/configparser.rst:1478 msgid "Footnotes" msgstr "註腳" -#: ../../library/configparser.rst:1452 +#: ../../library/configparser.rst:1479 msgid "" "Config parsers allow for heavy customization. If you are interested in " "changing the behaviour outlined by the footnote reference, consult the " diff --git a/library/constants.po b/library/constants.po index 6b622131bca..b468b41e6e0 100644 --- a/library/constants.po +++ b/library/constants.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-16 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2021-11-19 23:36+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -59,21 +59,22 @@ msgstr "" #: ../../library/constants.rst:30 msgid "" -"A special value which should be returned by the binary special methods (e." -"g. :meth:`~object.__eq__`, :meth:`~object.__lt__`, :meth:`~object.__add__`, :" -"meth:`~object.__rsub__`, etc.) to indicate that the operation is not " -"implemented with respect to the other type; may be returned by the in-place " -"binary special methods (e.g. :meth:`~object.__imul__`, :meth:`~object." -"__iand__`, etc.) for the same purpose. It should not be evaluated in a " -"boolean context. :data:`!NotImplemented` is the sole instance of the :data:" -"`types.NotImplementedType` type." -msgstr "" -"會被二元特殊方法 (binary special methods)(如::meth:`~object.__eq__`、:meth:" -"`~object.__lt__`、:meth:`~object.__add__`、:meth:`~object.__rsub__` 等)所回" -"傳的特殊值,代表著該運算沒有針對其他型別的實作。同理也可以被原地二元特殊方法 " -"(in-place binary special methods) (如::meth:`~object.__imul__`、:meth:" -"`~object.__iand__` 等)回傳。它不應該被作為 boolean(布林)來解讀。:data:`!" -"NotImplemented` 是型別 :data:`types.NotImplementedType` 的唯一實例。" +"A special value which should be returned by the binary special methods " +"(e.g. :meth:`~object.__eq__`, :meth:`~object.__lt__`, :meth:`~object.__add__`, :meth:`~object.__rsub__`, " +"etc.) to indicate that the operation is not implemented with respect to the " +"other type; may be returned by the in-place binary special methods " +"(e.g. :meth:`~object.__imul__`, :meth:`~object.__iand__`, etc.) for the same " +"purpose. It should not be evaluated in a boolean context. :data:`!" +"NotImplemented` is the sole instance of the :data:`types.NotImplementedType` " +"type." +msgstr "" +"會被二元特殊方法 (binary special methods)" +"(如::meth:`~object.__eq__`、:meth:`~object.__lt__`、:meth:`~object.__add__`、:meth:`~object.__rsub__` " +"等)所回傳的特殊值,代表著該運算沒有針對其他型別的實作。同理也可以被原地二元" +"特殊方法 (in-place binary special methods) " +"(如::meth:`~object.__imul__`、:meth:`~object.__iand__` 等)回傳。它不應該被" +"作為 boolean(布林)來解讀。:data:`!NotImplemented` 是型" +"別 :data:`types.NotImplementedType` 的唯一實例。" #: ../../library/constants.rst:40 msgid "" @@ -98,24 +99,29 @@ msgstr "請參見 :ref:`implementing-the-arithmetic-operations` 以找到更多 #: ../../library/constants.rst:51 msgid "" ":data:`!NotImplemented` and :exc:`!NotImplementedError` are not " -"interchangeable. This constant should only be used as described above; see :" -"exc:`NotImplementedError` for details on correct usage of the exception." +"interchangeable. This constant should only be used as described above; " +"see :exc:`NotImplementedError` for details on correct usage of the exception." msgstr "" ":data:`!NotImplemented` 與 :exc:`!NotImplementedError` 並不一樣且不可互換。這" -"個常數只能用於上述的情況;欲知更多如何正確使用它們的細節,請參見 :exc:" -"`NotImplementedError`。" +"個常數只能用於上述的情況;欲知更多如何正確使用它們的細節,請參" +"見 :exc:`NotImplementedError`。" #: ../../library/constants.rst:56 +msgid "Evaluating :data:`!NotImplemented` in a boolean context was deprecated." +msgstr "" + +#: ../../library/constants.rst:59 +#, fuzzy msgid "" -"Evaluating :data:`!NotImplemented` in a boolean context is deprecated. While " -"it currently evaluates as true, it will emit a :exc:`DeprecationWarning`. It " -"will raise a :exc:`TypeError` in a future version of Python." +"Evaluating :data:`!NotImplemented` in a boolean context now raises " +"a :exc:`TypeError`. It previously evaluated to :const:`True` and emitted " +"a :exc:`DeprecationWarning` since Python 3.9." msgstr "" "在 boolean(布林)上下文中解讀 :data:`!NotImplemented` 已經被棄用。雖然目前會" "被解讀成 true,但會發出一個 :exc:`DeprecationWarning`。在未來版本的 Python 將" "會拋出 :exc:`TypeError`。" -#: ../../library/constants.rst:65 +#: ../../library/constants.rst:68 msgid "" "The same as the ellipsis literal \"``...``\". Special value used mostly in " "conjunction with extended slicing syntax for user-defined container data " @@ -123,32 +129,32 @@ msgid "" "type." msgstr "" "與刪節號 \"``...``\" 字面相同。為一特殊值,大多用於結合使用者定義資料型別的延" -"伸切片語法 (extended slicing syntax)。``Ellipsis`` 是型別 :data:`types." -"EllipsisType` 的唯一實例。" +"伸切片語法 (extended slicing syntax)。``Ellipsis`` 是型" +"別 :data:`types.EllipsisType` 的唯一實例。" -#: ../../library/constants.rst:72 +#: ../../library/constants.rst:75 msgid "" "This constant is true if Python was not started with an :option:`-O` option. " "See also the :keyword:`assert` statement." msgstr "" -"如果 Python 沒有被以 :option:`-O` 選項啟動,則此常數為 true。請參見 :keyword:" -"`assert` 陳述式。" +"如果 Python 沒有被以 :option:`-O` 選項啟動,則此常數為 true。請參" +"見 :keyword:`assert` 陳述式。" -#: ../../library/constants.rst:78 +#: ../../library/constants.rst:81 msgid "" "The names :data:`None`, :data:`False`, :data:`True` and :data:`__debug__` " -"cannot be reassigned (assignments to them, even as an attribute name, raise :" -"exc:`SyntaxError`), so they can be considered \"true\" constants." +"cannot be reassigned (assignments to them, even as an attribute name, " +"raise :exc:`SyntaxError`), so they can be considered \"true\" constants." msgstr "" ":data:`None`,:data:`False`,:data:`True`,以及 :data:`__debug__` 都是不能被" -"重新賦值的(任何對它們的賦值,即使是屬性的名稱,也會拋出 :exc:" -"`SyntaxError`)。因此,它們可以被視為”真正的”常數。" +"重新賦值的(任何對它們的賦值,即使是屬性的名稱,也會拋" +"出 :exc:`SyntaxError`)。因此,它們可以被視為”真正的”常數。" -#: ../../library/constants.rst:86 +#: ../../library/constants.rst:89 msgid "Constants added by the :mod:`site` module" msgstr "由 :mod:`site` module(模組)所添增的常數" -#: ../../library/constants.rst:88 +#: ../../library/constants.rst:91 msgid "" "The :mod:`site` module (which is imported automatically during startup, " "except if the :option:`-S` command-line option is given) adds several " @@ -159,33 +165,34 @@ msgstr "" "指令行選項)會添增一些常數到內建命名空間 (built-in namespace) 中。它們在互動" "式直譯器中是很有幫助的,但不應該在程式 (programs) 中被使用。" -#: ../../library/constants.rst:96 +#: ../../library/constants.rst:99 msgid "" "Objects that when printed, print a message like \"Use quit() or Ctrl-D (i.e. " "EOF) to exit\", and when accessed directly in the interactive interpreter or " "called as functions, raise :exc:`SystemExit` with the specified exit code." msgstr "" -"當印出物件時,會印出一個訊息:\"Use quit() or Ctrl-D (i.e. EOF) to exit\"。" -"當直接在互動式直譯器中存取或作為函式呼叫時,會引發 :exc:`SystemExit` 並帶有指定的返回碼(exit code)。" +"當印出物件時,會印出一個訊息:\"Use quit() or Ctrl-D (i.e. EOF) to exit\"。當" +"直接在互動式直譯器中存取或作為函式呼叫時,會引發 :exc:`SystemExit` 並帶有指定" +"的返回碼(exit code)。" -#: ../../library/constants.rst:104 +#: ../../library/constants.rst:107 msgid "" "Object that when printed, prints the message \"Type help() for interactive " "help, or help(object) for help about object.\", and when accessed directly " -"in the interactive interpreter, invokes the built-in help system (see :func:" -"`help`)." +"in the interactive interpreter, invokes the built-in help system " +"(see :func:`help`)." msgstr "" "當印出此物件時,會印出訊息 \"Type help() for interactive help, or " -"help(object) for help about object.\",並在互動式直譯器中直接存取時,會叫用內建的" -"幫助系統(參見 :func:`help`)。" +"help(object) for help about object.\",並在互動式直譯器中直接存取時,會叫用內" +"建的幫助系統(參見 :func:`help`)。" -#: ../../library/constants.rst:112 +#: ../../library/constants.rst:115 msgid "" "Objects that when printed or called, print the text of copyright or credits, " "respectively." msgstr "當印出或是呼叫此物件時,分別會印出版權與致謝的文字。" -#: ../../library/constants.rst:117 +#: ../../library/constants.rst:120 msgid "" "Object that when printed, prints the message \"Type license() to see the " "full license text\", and when called, displays the full license text in a " @@ -194,10 +201,10 @@ msgstr "" "當印出此物件時,會印出訊息 \"Type license() to see the full license text\"," "並在呼叫時以分頁形式印出完整的許可證文字(一次一整個畫面)。" -#: ../../library/constants.rst:62 +#: ../../library/constants.rst:65 msgid "..." msgstr "..." -#: ../../library/constants.rst:62 +#: ../../library/constants.rst:65 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" diff --git a/library/contextvars.po b/library/contextvars.po index 781c21303f7..a610416d741 100644 --- a/library/contextvars.po +++ b/library/contextvars.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-31 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-07-30 22:06+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,15 +28,15 @@ msgid "" "context in asynchronous frameworks." msgstr "" "本模組供 API 來管理、儲存及存取單一情境各自的狀態(context-local state)。 " -"用 :class:`~contextvars.ContextVar` 類別宣告和處理\\ *情境變數*。 :func:" -"`~contextvars.copy_context` 函式和 :class:`~contextvars.Context` 類別應在非同" -"步框架中管理目前的情境。" +"用 :class:`~contextvars.ContextVar` 類別宣告和處理\\ *情境變數" +"*。 :func:`~contextvars.copy_context` 函式和 :class:`~contextvars.Context` 類" +"別應在非同步框架中管理目前的情境。" #: ../../library/contextvars.rst:17 msgid "" -"Context managers that have state should use Context Variables instead of :" -"func:`threading.local` to prevent their state from bleeding to other code " -"unexpectedly, when used in concurrent code." +"Context managers that have state should use Context Variables instead " +"of :func:`threading.local` to prevent their state from bleeding to other " +"code unexpectedly, when used in concurrent code." msgstr "" "帶有狀態的 Context Manager 應該使用情境變數,而不是 :func:`threading.local`," "才能防止它們的狀態在並行(concurrent)程式碼中使用時意外外溢並干擾到其他程式" @@ -65,12 +65,12 @@ msgstr "必要參數 *name* 用於自我檢查(introspection)和除錯。" #: ../../library/contextvars.rst:38 msgid "" -"The optional keyword-only *default* parameter is returned by :meth:" -"`ContextVar.get` when no value for the variable is found in the current " -"context." +"The optional keyword-only *default* parameter is returned " +"by :meth:`ContextVar.get` when no value for the variable is found in the " +"current context." msgstr "" -"當在目前的情境中找不到變數的值時,:meth:`ContextVar.get` 會回傳可選的僅限關鍵字參" -"數 *default*。" +"當在目前的情境中找不到變數的值時,:meth:`ContextVar.get` 會回傳可選的僅限關鍵" +"字參數 *default*。" #: ../../library/contextvars.rst:42 msgid "" @@ -127,13 +127,13 @@ msgid "" "Returns a :class:`~contextvars.Token` object that can be used to restore the " "variable to its previous value via the :meth:`ContextVar.reset` method." msgstr "" -"回傳一個 :class:`~contextvars.Token` 物件,該物件可透過 :meth:`ContextVar." -"reset` 方法,用來將變數還原到之前的值。" +"回傳一個 :class:`~contextvars.Token` 物件,該物件可透" +"過 :meth:`ContextVar.reset` 方法,用來將變數還原到之前的值。" #: ../../library/contextvars.rst:82 msgid "" -"Reset the context variable to the value it had before the :meth:`ContextVar." -"set` that created the *token* was used." +"Reset the context variable to the value it had before " +"the :meth:`ContextVar.set` that created the *token* was used." msgstr "將情境變數重設為使用 :meth:`ContextVar.set` 建立 *token* 前的值。" #: ../../library/contextvars.rst:85 @@ -166,44 +166,66 @@ msgid "" "be passed to the :meth:`ContextVar.reset` method to revert the value of the " "variable to what it was before the corresponding *set*." msgstr "" -"*Token* 物件由 :meth:`ContextVar.set` 方法回傳,可以傳遞給 :meth:`ContextVar." -"reset` 方法,用以將變數的值還原為相對應的 *set* 之前的值。" +"*Token* 物件由 :meth:`ContextVar.set` 方法回傳,可以傳遞" +"給 :meth:`ContextVar.reset` 方法,用以將變數的值還原為相對應的 *set* 之前的" +"值。" -#: ../../library/contextvars.rst:106 +#: ../../library/contextvars.rst:104 +msgid "" +"The token supports :ref:`context manager protocol ` to " +"restore the corresponding context variable value at the exit " +"from :keyword:`with` block::" +msgstr "" + +#: ../../library/contextvars.rst:108 +msgid "" +"var = ContextVar('var', default='default value')\n" +"\n" +"with var.set('new value'):\n" +" assert var.get() == 'new value'\n" +"\n" +"assert var.get() == 'default value'" +msgstr "" + +#: ../../library/contextvars.rst:117 +msgid "Added support for usage as a context manager." +msgstr "" + +#: ../../library/contextvars.rst:121 msgid "" "A read-only property. Points to the :class:`ContextVar` object that created " "the token." msgstr "唯讀屬性。 指向建立 token 的 :class:`ContextVar` 物件。" -#: ../../library/contextvars.rst:111 +#: ../../library/contextvars.rst:126 msgid "" -"A read-only property. Set to the value the variable had before the :meth:" -"`ContextVar.set` method call that created the token. It points to :attr:" -"`Token.MISSING` if the variable was not set before the call." +"A read-only property. Set to the value the variable had before " +"the :meth:`ContextVar.set` method call that created the token. It points " +"to :attr:`Token.MISSING` if the variable was not set before the call." msgstr "" "唯讀屬性。 值為變數在呼叫 :meth:`ContextVar.set` 方法之前的值。如果變數在呼叫" "前沒有設定,則指向 :attr:`Token.MISSING`。" -#: ../../library/contextvars.rst:118 +#: ../../library/contextvars.rst:133 msgid "A marker object used by :attr:`Token.old_value`." msgstr "由 :attr:`Token.old_value` 使用的標記物件。" -#: ../../library/contextvars.rst:122 +#: ../../library/contextvars.rst:137 msgid "Manual Context Management" msgstr "手動情境管理" -#: ../../library/contextvars.rst:126 +#: ../../library/contextvars.rst:141 msgid "Returns a copy of the current :class:`~contextvars.Context` object." msgstr "回傳目前 :class:`~contextvars.Context` 物件的複本(copy)。" -#: ../../library/contextvars.rst:128 +#: ../../library/contextvars.rst:143 msgid "" "The following snippet gets a copy of the current context and prints all " "variables and their values that are set in it::" msgstr "" "以下程式碼片段會取得目前情境的複本,並顯示在其中設定的所有變數及其值:::" -#: ../../library/contextvars.rst:131 +#: ../../library/contextvars.rst:146 msgid "" "ctx: Context = copy_context()\n" "print(list(ctx.items()))" @@ -211,7 +233,7 @@ msgstr "" "ctx: Context = copy_context()\n" "print(list(ctx.items()))" -#: ../../library/contextvars.rst:134 +#: ../../library/contextvars.rst:149 msgid "" "The function has an *O*\\ (1) complexity, i.e. works equally fast for " "contexts with a few context variables and for contexts that have a lot of " @@ -220,30 +242,30 @@ msgstr "" "這個函式具有 *O*\\ (1) 的複雜度,也就是說,對於只有少許情境變數的情境和有大量" "情境變數的情境,速度都一樣快。" -#: ../../library/contextvars.rst:141 +#: ../../library/contextvars.rst:156 msgid "A mapping of :class:`ContextVars ` to their values." msgstr ":class:`ContextVars` 到其值的映射。" -#: ../../library/contextvars.rst:143 +#: ../../library/contextvars.rst:158 msgid "" "``Context()`` creates an empty context with no values in it. To get a copy " "of the current context use the :func:`~contextvars.copy_context` function." msgstr "" -"``Context()`` 會建立一個沒有值的空情境。要取得目前情境的複本,請使用 :func:" -"`~contextvars.copy_context` 函式。" +"``Context()`` 會建立一個沒有值的空情境。要取得目前情境的複本,請使" +"用 :func:`~contextvars.copy_context` 函式。" -#: ../../library/contextvars.rst:147 +#: ../../library/contextvars.rst:162 msgid "" -"Each thread has its own effective stack of :class:`!Context` objects. The :" -"term:`current context` is the :class:`!Context` object at the top of the " -"current thread's stack. All :class:`!Context` objects in the stacks are " +"Each thread has its own effective stack of :class:`!Context` objects. " +"The :term:`current context` is the :class:`!Context` object at the top of " +"the current thread's stack. All :class:`!Context` objects in the stacks are " "considered to be *entered*." msgstr "" -"每個執行緒都有自己的 :class:`!Context` 物件中目前主控中的堆疊(stack)。:" -"term:`current context` 是目前執行緒堆疊頂端的 :class:`!Context` 物件。 堆疊" -"中的所有 :class:`!Context` 物件都被視為\\ *已進入*。" +"每個執行緒都有自己的 :class:`!Context` 物件中目前主控中的堆疊" +"(stack)。:term:`current context` 是目前執行緒堆疊頂端的 :class:`!Context` " +"物件。 堆疊中的所有 :class:`!Context` 物件都被視為\\ *已進入*。" -#: ../../library/contextvars.rst:152 +#: ../../library/contextvars.rst:167 msgid "" "*Entering* a context, which can be done by calling its :meth:`~Context.run` " "method, makes the context the current context by pushing it onto the top of " @@ -252,7 +274,7 @@ msgstr "" "*進入*\\ 一個情境,可以藉由呼叫其 :meth:`~Context.run` 方法來完成,此\\ *進入" "*\\ 的動作會將一情境推到目前執行緒的情境堆疊的頂端,使該情境成為目前的情境。" -#: ../../library/contextvars.rst:156 +#: ../../library/contextvars.rst:171 msgid "" "*Exiting* from the current context, which can be done by returning from the " "callback passed to the :meth:`~Context.run` method, restores the current " @@ -263,28 +285,28 @@ msgstr "" "式回傳之後,就會自動\\ *退出*\\ 目前的情境,這會將目前的情境還原到進入情境之" "前的狀態,方法是將情境從情境堆疊的頂端彈出。" -#: ../../library/contextvars.rst:161 +#: ../../library/contextvars.rst:176 msgid "" "Since each thread has its own context stack, :class:`ContextVar` objects " "behave in a similar fashion to :func:`threading.local` when values are " "assigned in different threads." msgstr "" -"因為每個執行緒都有自己的情境堆疊,當值在不同的執行緒中被指定時, :class:" -"`ContextVar` 物件的行為與 :func:`threading.local` 相似。" +"因為每個執行緒都有自己的情境堆疊,當值在不同的執行緒中被指定" +"時, :class:`ContextVar` 物件的行為與 :func:`threading.local` 相似。" -#: ../../library/contextvars.rst:165 +#: ../../library/contextvars.rst:180 msgid "" "Attempting to enter an already entered context, including contexts entered " "in other threads, raises a :exc:`RuntimeError`." msgstr "" -"嘗試進入已進入的情境,包括在其他執行緒中進入的情境,會引發 :exc:" -"`RuntimeError`。" +"嘗試進入已進入的情境,包括在其他執行緒中進入的情境,會引" +"發 :exc:`RuntimeError`。" -#: ../../library/contextvars.rst:168 +#: ../../library/contextvars.rst:183 msgid "After exiting a context, it can later be re-entered (from any thread)." msgstr "退出情境後,之後可以重新進入(從任何執行緒)。" -#: ../../library/contextvars.rst:170 +#: ../../library/contextvars.rst:185 msgid "" "Any changes to :class:`ContextVar` values via the :meth:`ContextVar.set` " "method are recorded in the current context. The :meth:`ContextVar.get` " @@ -298,11 +320,11 @@ msgstr "" "實際造成的效果會像是將其在進入情境時對情境變數所做的任何變一一彈出並還原(如" "果需要,可以透過重新進入情境來還原值)。" -#: ../../library/contextvars.rst:177 +#: ../../library/contextvars.rst:192 msgid "Context implements the :class:`collections.abc.Mapping` interface." msgstr "情境(Context)實作了 :class:`collections.abc.Mapping` 介面。" -#: ../../library/contextvars.rst:181 +#: ../../library/contextvars.rst:196 msgid "" "Enters the Context, executes ``callable(*args, **kwargs)``, then exits the " "Context. Returns *callable*'s return value, or propagates an exception if " @@ -311,11 +333,11 @@ msgstr "" "進入 Context,執行 ``callable(*args, **kwargs)``,然後退出 Context。 回傳 " "*callable* 的回傳值,如果發生例外(exception),則傳播例外。" -#: ../../library/contextvars.rst:185 +#: ../../library/contextvars.rst:200 msgid "Example:" msgstr "例如:" -#: ../../library/contextvars.rst:187 +#: ../../library/contextvars.rst:202 msgid "" "import contextvars\n" "\n" @@ -379,18 +401,18 @@ msgstr "" "# 但是,在 'ctx' 外, 'var' 的值仍然是 'spam':\n" "print(var.get()) # 'spam'" -#: ../../library/contextvars.rst:233 +#: ../../library/contextvars.rst:248 msgid "Return a shallow copy of the context object." msgstr "回傳情境物件的淺層複本(shallow copy)。" -#: ../../library/contextvars.rst:237 +#: ../../library/contextvars.rst:252 msgid "" "Return ``True`` if the *context* has a value for *var* set; return ``False`` " "otherwise." msgstr "" "如果\\ *情境*\\ 裡面有 *var* 的值,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/contextvars.rst:242 +#: ../../library/contextvars.rst:257 msgid "" "Return the value of the *var* :class:`ContextVar` variable. If the variable " "is not set in the context object, a :exc:`KeyError` is raised." @@ -398,41 +420,41 @@ msgstr "" "回傳 *var* :class:`ContextVar` 變數的值。如果該變數並沒有在情境物件中設定,則" "會引發 :exc:`KeyError` 錯誤。" -#: ../../library/contextvars.rst:248 +#: ../../library/contextvars.rst:263 msgid "" "Return the value for *var* if *var* has the value in the context object. " "Return *default* otherwise. If *default* is not given, return ``None``." msgstr "" -"如果 *var* 的值在情境物件中,則回傳 *var* 的值。否則回傳 *default*。如果" -"沒有 *default* 值,則回傳 ``None``。" +"如果 *var* 的值在情境物件中,則回傳 *var* 的值。否則回傳 *default*。如果沒有 " +"*default* 值,則回傳 ``None``。" -#: ../../library/contextvars.rst:254 +#: ../../library/contextvars.rst:269 msgid "Return an iterator over the variables stored in the context object." msgstr "回傳儲存於情境物件中變數的疊代器。" -#: ../../library/contextvars.rst:259 +#: ../../library/contextvars.rst:274 msgid "Return the number of variables set in the context object." msgstr "回傳情境物件中的變數個數。" -#: ../../library/contextvars.rst:263 +#: ../../library/contextvars.rst:278 msgid "Return a list of all variables in the context object." msgstr "回傳情境物件中所有變數的串列。" -#: ../../library/contextvars.rst:267 +#: ../../library/contextvars.rst:282 msgid "Return a list of all variables' values in the context object." msgstr "回傳情境物件中所有變數的值的串列。" -#: ../../library/contextvars.rst:272 +#: ../../library/contextvars.rst:287 msgid "" "Return a list of 2-tuples containing all variables and their values in the " "context object." msgstr "回傳情境物件中所有變數與其值的 2-元組(2-tuples)的串列。" -#: ../../library/contextvars.rst:277 +#: ../../library/contextvars.rst:292 msgid "asyncio support" msgstr "對 asyncio 的支援" -#: ../../library/contextvars.rst:279 +#: ../../library/contextvars.rst:294 msgid "" "Context variables are natively supported in :mod:`asyncio` and are ready to " "be used without any extra configuration. For example, here is a simple echo " @@ -442,7 +464,7 @@ msgstr "" ":mod:`asyncio` 原生支援情境變數,不需任何額外設定。 舉例來說,以下是一個簡單" "的 echo 伺服器,使用情境變數讓遠端用戶端的位址在處理該用戶端的任務中可用:" -#: ../../library/contextvars.rst:285 +#: ../../library/contextvars.rst:300 msgid "" "import asyncio\n" "import contextvars\n" diff --git a/library/csv.po b/library/csv.po index 521f820d4fb..14bd975c650 100644 --- a/library/csv.po +++ b/library/csv.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-25 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-11-08 15:06+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -105,25 +105,25 @@ msgstr "" "其中每個字串都要是讀取器所定義的 csv 格式,csvfile 通常是個類檔案物件或者 " "list。如果 *csvfile* 是個檔案物件,則需開啟時使用 ``newline=''``。 [1]_ " "*dialect* 為一個可選填的參數,可以用為特定的 CSV dialect(方言) 定義一組參" -"數。它可能為 :class:`Dialect` 的一個子類別 (subclass) 的實例或是由 :func:" -"`list_dialects` 函式回傳的多個字串中的其中之一。另一個可選填的關鍵字引數 " -"*fmtparams* 可以在這個 dialect 中覆寫 (override) 個別的格式化參數 " -"(formatting parameter)。關於 dialect 及格式化參數的完整說明,請見段落 :ref:" -"`csv-fmt-params`。" +"數。它可能為 :class:`Dialect` 的一個子類別 (subclass) 的實例或是" +"由 :func:`list_dialects` 函式回傳的多個字串中的其中之一。另一個可選填的關鍵字" +"引數 *fmtparams* 可以在這個 dialect 中覆寫 (override) 個別的格式化參數 " +"(formatting parameter)。關於 dialect 及格式化參數的完整說明,請見段" +"落 :ref:`csv-fmt-params`。" #: ../../library/csv.rst:72 msgid "" "Each row read from the csv file is returned as a list of strings. No " -"automatic data type conversion is performed unless the :data:" -"`QUOTE_NONNUMERIC` format option is specified (in which case unquoted fields " -"are transformed into floats)." +"automatic data type conversion is performed unless " +"the :data:`QUOTE_NONNUMERIC` format option is specified (in which case " +"unquoted fields are transformed into floats)." msgstr "" -"從 CSV 檔案讀取的每一列會回傳為一個字串列表。除非格式選項 :data:" -"`QUOTE_NONNUMERIC` 有被指定(在這個情況之下,沒有引號的欄位都會被轉換成浮點" -"數),否則不會進行自動資料型別轉換。" +"從 CSV 檔案讀取的每一列會回傳為一個字串列表。除非格式選" +"項 :data:`QUOTE_NONNUMERIC` 有被指定(在這個情況之下,沒有引號的欄位都會被轉" +"換成浮點數),否則不會進行自動資料型別轉換。" -#: ../../library/csv.rst:76 ../../library/csv.rst:106 ../../library/csv.rst:182 -#: ../../library/csv.rst:220 +#: ../../library/csv.rst:76 ../../library/csv.rst:106 ../../library/csv.rst:181 +#: ../../library/csv.rst:219 msgid "A short usage example::" msgstr "一個簡短的用法範例: ::" @@ -152,12 +152,12 @@ msgid "" "object with a :meth:`~io.TextIOBase.write` method. If *csvfile* is a file " "object, it should be opened with ``newline=''`` [1]_. An optional *dialect* " "parameter can be given which is used to define a set of parameters specific " -"to a particular CSV dialect. It may be an instance of a subclass of the :" -"class:`Dialect` class or one of the strings returned by the :func:" -"`list_dialects` function. The other optional *fmtparams* keyword arguments " -"can be given to override individual formatting parameters in the current " -"dialect. For full details about dialects and formatting parameters, see " -"the :ref:`csv-fmt-params` section. To make it as easy as possible to " +"to a particular CSV dialect. It may be an instance of a subclass of " +"the :class:`Dialect` class or one of the strings returned by " +"the :func:`list_dialects` function. The other optional *fmtparams* keyword " +"arguments can be given to override individual formatting parameters in the " +"current dialect. For full details about dialects and formatting parameters, " +"see the :ref:`csv-fmt-params` section. To make it as easy as possible to " "interface with modules which implement the DB API, the value :const:`None` " "is written as the empty string. While this isn't a reversible " "transformation, it makes it easier to dump SQL NULL data values to CSV files " @@ -208,8 +208,8 @@ msgstr "" #: ../../library/csv.rst:127 msgid "" -"Delete the dialect associated with *name* from the dialect registry. An :" -"exc:`Error` is raised if *name* is not a registered dialect name." +"Delete the dialect associated with *name* from the dialect registry. " +"An :exc:`Error` is raised if *name* is not a registered dialect name." msgstr "" "從 dialect 註冊表 (registry) 中,刪除與 *name* 關聯的 dialect。若 *name* 如果" "不是註冊的 dialect 名稱,則會產生一個 :exc:`Error`。" @@ -221,14 +221,14 @@ msgid "" "immutable :class:`Dialect`." msgstr "" "回傳一個與 *name* 關聯的 dialect。若 *name* 如果不是註冊的 dialect 名稱,則會" -"產生一個 :exc:`Error`。這個函式會回傳一個 immutable (不可變物件) :class:" -"`Dialect`。" +"產生一個 :exc:`Error`。這個函式會回傳一個 immutable (不可變物" +"件) :class:`Dialect`。" #: ../../library/csv.rst:139 msgid "Return the names of all registered dialects." msgstr "回傳所有已註冊的 dialect 名稱。" -#: ../../library/csv.rst:145 +#: ../../library/csv.rst:144 msgid "" "Returns the current maximum field size allowed by the parser. If *new_limit* " "is given, this becomes the new limit." @@ -236,20 +236,20 @@ msgstr "" "回傳目前的剖析器 (parser) 允許的最大字串大小。如果 *new_limit* 被給定,則會變" "成新的最大字串大小。" -#: ../../library/csv.rst:149 +#: ../../library/csv.rst:148 msgid "The :mod:`csv` module defines the following classes:" msgstr ":mod:`csv` 模組定義了下列的類別:" -#: ../../library/csv.rst:154 +#: ../../library/csv.rst:153 msgid "" "Create an object that operates like a regular reader but maps the " "information in each row to a :class:`dict` whose keys are given by the " "optional *fieldnames* parameter." msgstr "" -"建立一個物件,其運作上就像一般的讀取器,但可以將每一列資訊 map (對映) 到 :" -"class:`dict` 中,可以透過選填的參數 *fieldnames* 設定 key。" +"建立一個物件,其運作上就像一般的讀取器,但可以將每一列資訊 map (對映) " +"到 :class:`dict` 中,可以透過選填的參數 *fieldnames* 設定 key。" -#: ../../library/csv.rst:158 +#: ../../library/csv.rst:157 msgid "" "The *fieldnames* parameter is a :term:`sequence`. If *fieldnames* is " "omitted, the values in the first row of file *f* will be used as the " @@ -263,7 +263,7 @@ msgstr "" "供,它們就會被使用,且第一列會被包含在結果中。不管欄位標題是如何決定的," "dictionary 都會保留原始的排序。" -#: ../../library/csv.rst:165 +#: ../../library/csv.rst:164 msgid "" "If a row has more fields than fieldnames, the remaining data is put in a " "list and stored with the fieldname specified by *restkey* (which defaults to " @@ -275,28 +275,28 @@ msgstr "" "``None``)特指的欄位標題會放入列表當中並儲存。如果一個非空的 (non-blank) 列中" "的欄位比欄位標題還少,缺少的值則會填入 *restval* (預設為 ``None``)的值。" -#: ../../library/csv.rst:171 +#: ../../library/csv.rst:170 msgid "" -"All other optional or keyword arguments are passed to the underlying :class:" -"`reader` instance." +"All other optional or keyword arguments are passed to the " +"underlying :class:`reader` instance." msgstr "所有其他選填的引數或關鍵字引數皆會傳遞至下層的 :class:`reader` 實例。" -#: ../../library/csv.rst:174 ../../library/csv.rst:218 +#: ../../library/csv.rst:173 ../../library/csv.rst:217 msgid "" "If the argument passed to *fieldnames* is an iterator, it will be coerced to " "a :class:`list`." msgstr "" "如果傳遞至 *fieldnames* 的引數是個疊代器,則會被迫成為一個 :class:`list`。" -#: ../../library/csv.rst:176 +#: ../../library/csv.rst:175 msgid "Returned rows are now of type :class:`OrderedDict`." msgstr "回傳的列已成為型別 :class:`OrderedDict`。" -#: ../../library/csv.rst:179 +#: ../../library/csv.rst:178 msgid "Returned rows are now of type :class:`dict`." msgstr "回傳的列已成為型別 :class:`dict`。" -#: ../../library/csv.rst:184 +#: ../../library/csv.rst:183 msgid "" ">>> import csv\n" ">>> with open('names.csv', newline='') as csvfile:\n" @@ -322,7 +322,7 @@ msgstr "" ">>> print(row)\n" "{'first_name': 'John', 'last_name': 'Cleese'}" -#: ../../library/csv.rst:200 +#: ../../library/csv.rst:199 msgid "" "Create an object which operates like a regular writer but maps dictionaries " "onto output rows. The *fieldnames* parameter is a :mod:`sequence " @@ -332,10 +332,10 @@ msgid "" "written if the dictionary is missing a key in *fieldnames*. If the " "dictionary passed to the :meth:`~csvwriter.writerow` method contains a key " "not found in *fieldnames*, the optional *extrasaction* parameter indicates " -"what action to take. If it is set to ``'raise'``, the default value, a :exc:" -"`ValueError` is raised. If it is set to ``'ignore'``, extra values in the " -"dictionary are ignored. Any other optional or keyword arguments are passed " -"to the underlying :class:`writer` instance." +"what action to take. If it is set to ``'raise'``, the default value, " +"a :exc:`ValueError` is raised. If it is set to ``'ignore'``, extra values in " +"the dictionary are ignored. Any other optional or keyword arguments are " +"passed to the underlying :class:`writer` instance." msgstr "" "建立一個物件,其運作上就像一般的寫入器,但可以將 dictionary map 到輸出的列" "上。參數 *fieldnames* 是一個鍵值的 :mod:`sequence ` 且可以辨" @@ -347,7 +347,7 @@ msgstr "" "被設定為 ``'ignore'``,dictionary 中額外的值會被忽略。其他選填的引數或關鍵字" "引數皆會傳遞至下層的 :class:`writer` 實例。" -#: ../../library/csv.rst:215 +#: ../../library/csv.rst:214 msgid "" "Note that unlike the :class:`DictReader` class, the *fieldnames* parameter " "of the :class:`DictWriter` class is not optional." @@ -355,7 +355,7 @@ msgstr "" "請記得這不像類別 :class:`DictReader`,在類別 :class:`DictWriter` 中,參數 " "*fieldnames* 並不是選填的。" -#: ../../library/csv.rst:222 +#: ../../library/csv.rst:221 msgid "" "import csv\n" "\n" @@ -379,20 +379,20 @@ msgstr "" " writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})\n" " writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})" -#: ../../library/csv.rst:236 +#: ../../library/csv.rst:235 msgid "" "The :class:`Dialect` class is a container class whose attributes contain " "information for how to handle doublequotes, whitespace, delimiters, etc. Due " "to the lack of a strict CSV specification, different applications produce " -"subtly different CSV data. :class:`Dialect` instances define how :class:" -"`reader` and :class:`writer` instances behave." +"subtly different CSV data. :class:`Dialect` instances define " +"how :class:`reader` and :class:`writer` instances behave." msgstr "" "類別 :class:`Dialect` 是一個容器類別,其屬性 (attribute) 包含如何處理雙引號、" "空白、分隔符號等資訊。由於缺少一個嚴謹的 CSV 技術規範,不同的應用程式會產出有" -"巧妙不同的 CSV 資料。:class:`Dialect` 實例定義了 :class:`reader` 以及 :class:" -"`writer` 的實例該如何表示。" +"巧妙不同的 CSV 資料。:class:`Dialect` 實例定義了 :class:`reader` 以" +"及 :class:`writer` 的實例該如何表示。" -#: ../../library/csv.rst:242 +#: ../../library/csv.rst:241 msgid "" "All available :class:`Dialect` names are returned by :func:`list_dialects`, " "and they can be registered with specific :class:`reader` and :class:`writer` " @@ -402,7 +402,7 @@ msgstr "" "透過特定 :class:`reader` 及 :class:`writer` 類別的初始器 (initializer, " "``__init__``) 函式進行註冊,就像這樣: ::" -#: ../../library/csv.rst:246 +#: ../../library/csv.rst:245 msgid "" "import csv\n" "\n" @@ -414,7 +414,7 @@ msgstr "" "with open('students.csv', 'w', newline='') as csvfile:\n" " writer = csv.writer(csvfile, dialect='unix')" -#: ../../library/csv.rst:254 +#: ../../library/csv.rst:253 msgid "" "The :class:`excel` class defines the usual properties of an Excel-generated " "CSV file. It is registered with the dialect name ``'excel'``." @@ -422,7 +422,7 @@ msgstr "" "類別 :class:`excel` 定義了透過 Excel 產生的 CSV 檔案的慣用屬性。它被註冊的 " "dialect 名稱為 ``'excel'``。" -#: ../../library/csv.rst:260 +#: ../../library/csv.rst:259 msgid "" "The :class:`excel_tab` class defines the usual properties of an Excel-" "generated TAB-delimited file. It is registered with the dialect name " @@ -431,7 +431,7 @@ msgstr "" "類別 :class:`excel_tab` 定義了透過 Excel 產生並以 Tab 作為分隔的 CSV 檔案的慣" "用屬性。它被註冊的 dialect 名稱為 ``'excel-tab'``。" -#: ../../library/csv.rst:266 +#: ../../library/csv.rst:265 msgid "" "The :class:`unix_dialect` class defines the usual properties of a CSV file " "generated on UNIX systems, i.e. using ``'\\n'`` as line terminator and " @@ -441,15 +441,15 @@ msgstr "" "句話說,使用 ``'\\n'`` 作為換行符號且所有欄位都被引號包覆起來。它被註冊的 " "dialect 名稱為 ``'unix'``。" -#: ../../library/csv.rst:275 +#: ../../library/csv.rst:274 msgid "The :class:`Sniffer` class is used to deduce the format of a CSV file." msgstr "類別 :class:`Sniffer` 被用來推斷 CSV 檔案的格式。" -#: ../../library/csv.rst:277 +#: ../../library/csv.rst:276 msgid "The :class:`Sniffer` class provides two methods:" msgstr "類別 :class:`Sniffer` 提供了兩個 method:" -#: ../../library/csv.rst:281 +#: ../../library/csv.rst:280 msgid "" "Analyze the given *sample* and return a :class:`Dialect` subclass reflecting " "the parameters found. If the optional *delimiters* parameter is given, it " @@ -459,37 +459,37 @@ msgstr "" "數。如果給定選填的參數 *delimiters*,它會被解釋為一個字串且含有可能、有效的分" "隔字元。" -#: ../../library/csv.rst:289 +#: ../../library/csv.rst:288 msgid "" -"Analyze the sample text (presumed to be in CSV format) and return :const:" -"`True` if the first row appears to be a series of column headers. Inspecting " -"each column, one of two key criteria will be considered to estimate if the " -"sample contains a header:" +"Analyze the sample text (presumed to be in CSV format) and " +"return :const:`True` if the first row appears to be a series of column " +"headers. Inspecting each column, one of two key criteria will be considered " +"to estimate if the sample contains a header:" msgstr "" "如果第一列的文字顯示將作為一系列的欄位標題,會分析 sample 文字(假定他是 CSV " "格式)並回傳 :const:`True`。檢查每一欄時,會考慮是否滿足兩個關鍵標準其中之" "一,判斷 sample 是否包含標題:" -#: ../../library/csv.rst:294 +#: ../../library/csv.rst:293 msgid "the second through n-th rows contain numeric values" msgstr "第二列至第 n 列包含數字" -#: ../../library/csv.rst:295 +#: ../../library/csv.rst:294 msgid "" "the second through n-th rows contain strings where at least one value's " "length differs from that of the putative header of that column." msgstr "" "第二列到第 n 列包含的字串中至少有一個值的長度與該行的假定標題的長度不同。" -#: ../../library/csv.rst:298 +#: ../../library/csv.rst:297 msgid "" "Twenty rows after the first row are sampled; if more than half of columns + " "rows meet the criteria, :const:`True` is returned." msgstr "" -"對第一列之後的二十個列進行取樣;如果超過一半的行及列滿足條件,則返回 :const:" -"`True`。" +"對第一列之後的二十個列進行取樣;如果超過一半的行及列滿足條件,則返" +"回 :const:`True`。" -#: ../../library/csv.rst:303 +#: ../../library/csv.rst:302 msgid "" "This method is a rough heuristic and may produce both false positives and " "negatives." @@ -497,11 +497,11 @@ msgstr "" "此方法是一個粗略的啟發,可能會產生偽陽性及偽陰性 (false positives and " "negatives)。" -#: ../../library/csv.rst:306 +#: ../../library/csv.rst:305 msgid "An example for :class:`Sniffer` use::" msgstr "一個 :class:`Sniffer` 的使用範例: ::" -#: ../../library/csv.rst:308 +#: ../../library/csv.rst:307 msgid "" "with open('example.csv', newline='') as csvfile:\n" " dialect = csv.Sniffer().sniff(csvfile.read(1024))\n" @@ -515,15 +515,15 @@ msgstr "" " reader = csv.reader(csvfile, dialect)\n" " # ... 在這邊處理 CSV 檔案 ..." -#: ../../library/csv.rst:317 +#: ../../library/csv.rst:316 msgid "The :mod:`csv` module defines the following constants:" msgstr ":mod:`csv` 模組定義了以下常數:" -#: ../../library/csv.rst:321 +#: ../../library/csv.rst:320 msgid "Instructs :class:`writer` objects to quote all fields." msgstr "引導 :class:`writer` 物件引用所有欄位。" -#: ../../library/csv.rst:326 +#: ../../library/csv.rst:325 msgid "" "Instructs :class:`writer` objects to only quote those fields which contain " "special characters such as *delimiter*, *quotechar*, ``'\\r'``, ``'\\n'`` or " @@ -532,25 +532,25 @@ msgstr "" "引導 :class:`writer` 物件只引用包含特殊字元的欄位,例如:*delimiter*、" "*quotechar*、``'\\r'``、``'\\n'`` 或是 *lineterminator* 的其他字元。" -#: ../../library/csv.rst:333 +#: ../../library/csv.rst:332 msgid "Instructs :class:`writer` objects to quote all non-numeric fields." msgstr "引導 :class:`writer` 物件引用所有非數字的欄位。" -#: ../../library/csv.rst:335 +#: ../../library/csv.rst:334 msgid "" -"Instructs :class:`reader` objects to convert all non-quoted fields to type :" -"class:`float`." +"Instructs :class:`reader` objects to convert all non-quoted fields to " +"type :class:`float`." msgstr "引導 :class:`reader` 物件轉換所有非引用的欄位為 :class:`float`。" -#: ../../library/csv.rst:338 +#: ../../library/csv.rst:337 msgid "" -"Some numeric types, such as :class:`bool`, :class:`~fractions.Fraction`, or :" -"class:`~enum.IntEnum`, have a string representation that cannot be converted " -"to :class:`float`. They cannot be read in the :data:`QUOTE_NONNUMERIC` and :" -"data:`QUOTE_STRINGS` modes." +"Some numeric types, such as :class:`bool`, :class:`~fractions.Fraction`, " +"or :class:`~enum.IntEnum`, have a string representation that cannot be " +"converted to :class:`float`. They cannot be read in " +"the :data:`QUOTE_NONNUMERIC` and :data:`QUOTE_STRINGS` modes." msgstr "" -#: ../../library/csv.rst:346 +#: ../../library/csv.rst:345 msgid "" "Instructs :class:`writer` objects to never quote fields. When the current " "*delimiter*, *quotechar*, *escapechar*, ``'\\r'``, ``'\\n'`` or any of the " @@ -564,13 +564,13 @@ msgstr "" "前的字元是目前的 *escapechar*。如果沒有設定 *escapechar*,若遇到任何字元需要" "逸出,寫入器則會引發 :exc:`Error`。設定 *quotechar* 為 ``None`` 以防止逸出。" -#: ../../library/csv.rst:354 +#: ../../library/csv.rst:353 msgid "" "Instructs :class:`reader` objects to perform no special processing of quote " "characters." msgstr "引導 :class:`reader` 物件不對引號進行特別處理。" -#: ../../library/csv.rst:358 +#: ../../library/csv.rst:357 msgid "" "Instructs :class:`writer` objects to quote all fields which are not " "``None``. This is similar to :data:`QUOTE_ALL`, except that if a field " @@ -579,7 +579,7 @@ msgstr "" "引導 :class:`writer` 物件引用所有非 ``None`` 的欄位。這與 :data:`QUOTE_ALL` " "相似,除非如果欄位值為 ``None``,該欄位則被寫成空(沒有引號)字串。" -#: ../../library/csv.rst:362 +#: ../../library/csv.rst:361 msgid "" "Instructs :class:`reader` objects to interpret an empty (unquoted) field as " "``None`` and to otherwise behave as :data:`QUOTE_ALL`." @@ -587,105 +587,105 @@ msgstr "" "引導 :class:`reader` 物件將空(沒有引號)欄位直譯 (interpret) 為 ``None``,否" "則會和 :data:`QUOTE_ALL` 有相同的表現方式。" -#: ../../library/csv.rst:369 +#: ../../library/csv.rst:368 msgid "" "Instructs :class:`writer` objects to always place quotes around fields which " "are strings. This is similar to :data:`QUOTE_NONNUMERIC`, except that if a " "field value is ``None`` an empty (unquoted) string is written." msgstr "" -"引導 :class:`writer` 物件永遠在字串的欄位前後放置引號。這與 :data:" -"`QUOTE_NONNUMERIC` 相似,除非如果欄位值為 ``None``,該欄位則被寫成空(沒有引" -"號)字串。" +"引導 :class:`writer` 物件永遠在字串的欄位前後放置引號。這" +"與 :data:`QUOTE_NONNUMERIC` 相似,除非如果欄位值為 ``None``,該欄位則被寫成空" +"(沒有引號)字串。" -#: ../../library/csv.rst:373 +#: ../../library/csv.rst:372 msgid "" "Instructs :class:`reader` objects to interpret an empty (unquoted) string as " "``None`` and to otherwise behave as :data:`QUOTE_NONNUMERIC`." msgstr "" -"引導 :class:`reader` 物件將空(沒有引號)字串直譯為 ``None``,否則會和 :data:" -"`QUOTE_ALL` 有相同的表現方式。" +"引導 :class:`reader` 物件將空(沒有引號)字串直譯為 ``None``,否則會" +"和 :data:`QUOTE_ALL` 有相同的表現方式。" -#: ../../library/csv.rst:378 +#: ../../library/csv.rst:377 msgid "The :mod:`csv` module defines the following exception:" msgstr ":mod:`csv` 模組定義下列例外:" -#: ../../library/csv.rst:383 +#: ../../library/csv.rst:382 msgid "Raised by any of the functions when an error is detected." msgstr "當偵測到錯誤時,任何函式都可以引發。" -#: ../../library/csv.rst:388 +#: ../../library/csv.rst:387 msgid "Dialects and Formatting Parameters" msgstr "Dialect 與格式參數" -#: ../../library/csv.rst:390 +#: ../../library/csv.rst:389 msgid "" "To make it easier to specify the format of input and output records, " "specific formatting parameters are grouped together into dialects. A " "dialect is a subclass of the :class:`Dialect` class containing various " -"attributes describing the format of the CSV file. When creating :class:" -"`reader` or :class:`writer` objects, the programmer can specify a string or " -"a subclass of the :class:`Dialect` class as the dialect parameter. In " -"addition to, or instead of, the *dialect* parameter, the programmer can also " -"specify individual formatting parameters, which have the same names as the " -"attributes defined below for the :class:`Dialect` class." +"attributes describing the format of the CSV file. When " +"creating :class:`reader` or :class:`writer` objects, the programmer can " +"specify a string or a subclass of the :class:`Dialect` class as the dialect " +"parameter. In addition to, or instead of, the *dialect* parameter, the " +"programmer can also specify individual formatting parameters, which have the " +"same names as the attributes defined below for the :class:`Dialect` class." msgstr "" "為了讓指定輸入及輸出紀錄的格式更方便,特定的格式化參數會被組成 dialect。一個 " "dialect 是 :class:`Dialect` class 的子類別,其包含多個描述 CSV 檔案格式的多個" "屬性。當建立 :class:`reader` 或 :class:`writer` 物件時,程式設計師可以指定一" "個字串或是一個 :class:`Dialect` 的子類別作為 dialect 參數。此外,或是作為替" -"代,在\\ *dialect*\\ 參數中,程式設計師可以指定個別的格式化參數,其與 :class:" -"`Dialect` 類別定義的屬性具有相同的名字。" +"代,在\\ *dialect*\\ 參數中,程式設計師可以指定個別的格式化參數,其" +"與 :class:`Dialect` 類別定義的屬性具有相同的名字。" -#: ../../library/csv.rst:400 +#: ../../library/csv.rst:399 msgid "Dialects support the following attributes:" msgstr "Dialect 支援下列屬性:" -#: ../../library/csv.rst:405 +#: ../../library/csv.rst:404 msgid "" "A one-character string used to separate fields. It defaults to ``','``." msgstr "一個單一字元 (one-character) 的字串可已用來分割欄位。預設為 ``','``。" -#: ../../library/csv.rst:410 +#: ../../library/csv.rst:409 msgid "" "Controls how instances of *quotechar* appearing inside a field should " -"themselves be quoted. When :const:`True`, the character is doubled. When :" -"const:`False`, the *escapechar* is used as a prefix to the *quotechar*. It " -"defaults to :const:`True`." +"themselves be quoted. When :const:`True`, the character is doubled. " +"When :const:`False`, the *escapechar* is used as a prefix to the " +"*quotechar*. It defaults to :const:`True`." msgstr "" "控制 *quotechar* 的實例何時出現在欄位之中,並讓它們自己被放在引號之內。當屬性" "為 :const:`True`,字元會是雙引號。若為 :const:`False`,在 *quotechar* 之前會" "先使用 *escapechar* 作為前綴字。預設為 :const:`True`。" -#: ../../library/csv.rst:415 +#: ../../library/csv.rst:414 msgid "" -"On output, if *doublequote* is :const:`False` and no *escapechar* is set, :" -"exc:`Error` is raised if a *quotechar* is found in a field." +"On output, if *doublequote* is :const:`False` and no *escapechar* is " +"set, :exc:`Error` is raised if a *quotechar* is found in a field." msgstr "" "在輸出時,若 *doublequote* 是 :const:`False` 且\\ *逸出字元*\\ 沒有被設定,當" "一個\\ *引號*\\ 在欄位中被發現時,:exc:`Error` 會被引發。" -#: ../../library/csv.rst:421 +#: ../../library/csv.rst:420 msgid "" "A one-character string used by the writer to escape characters that require " "escaping:" msgstr "一個單一字元的字串,會被寫入器用來逸出需要逸出的字元:" -#: ../../library/csv.rst:424 +#: ../../library/csv.rst:423 msgid "" "the *delimiter*, the *quotechar*, ``'\\r'``, ``'\\n'`` and any of the " -"characters in *lineterminator* are escaped if *quoting* is set to :const:" -"`QUOTE_NONE`;" +"characters in *lineterminator* are escaped if *quoting* is set " +"to :const:`QUOTE_NONE`;" msgstr "" -#: ../../library/csv.rst:427 +#: ../../library/csv.rst:426 msgid "the *quotechar* is escaped if *doublequote* is :const:`False`;" msgstr "" -#: ../../library/csv.rst:428 +#: ../../library/csv.rst:427 msgid "the *escapechar* itself." msgstr "*escapechar* 本身。" -#: ../../library/csv.rst:430 +#: ../../library/csv.rst:429 msgid "" "On reading, the *escapechar* removes any special meaning from the following " "character. It defaults to :const:`None`, which disables escaping." @@ -693,17 +693,17 @@ msgstr "" "在讀取時,*escapechar* 會移除後面字元的任何特殊意義。預設為 :const:`None`,表" "示禁止逸出。" -#: ../../library/csv.rst:433 +#: ../../library/csv.rst:432 msgid "An empty *escapechar* is not allowed." msgstr "*escapechar* 為空是不被接受的。" -#: ../../library/csv.rst:438 +#: ../../library/csv.rst:437 msgid "" "The string used to terminate lines produced by the :class:`writer`. It " "defaults to ``'\\r\\n'``." msgstr "由 :class:`writer` 產生被用來分行的字串。預設為 ``'\\r\\n'``。" -#: ../../library/csv.rst:443 +#: ../../library/csv.rst:442 msgid "" "The :class:`reader` is hard-coded to recognise either ``'\\r'`` or ``'\\n'`` " "as end-of-line, and ignores *lineterminator*. This behavior may change in " @@ -712,7 +712,7 @@ msgstr "" ":class:`reader` 是 hard-coded 辨別 ``'\\r'`` or ``'\\n'`` 作為行尾 (end-of-" "line),並忽略\\ *lineterminator*。未來可能會改變這個行為。" -#: ../../library/csv.rst:450 +#: ../../library/csv.rst:449 msgid "" "A one-character string used to quote fields containing special characters, " "such as the *delimiter* or the *quotechar*, or which contain new-line " @@ -725,11 +725,11 @@ msgstr "" "元)。預設為 ``'\"'``。如果 *quoting* 設定為 :const:`QUOTE_NONE`,可以設定為 " "``None`` 以防止逸出 ``'\"'``。" -#: ../../library/csv.rst:457 +#: ../../library/csv.rst:456 msgid "An empty *quotechar* is not allowed." msgstr "*quotechar* 為空是不被允許的。" -#: ../../library/csv.rst:462 +#: ../../library/csv.rst:461 msgid "" "Controls when quotes should be generated by the writer and recognised by the " "reader. It can take on any of the :ref:`QUOTE_\\* constants `\\ 且預設為 :" -"const:`QUOTE_MINIMAL`。否則預設為 :const:`QUOTE_NONE`。" +"``None``,則可以使用任何 :ref:`QUOTE_\\* 常數 `\\ 且預設" +"為 :const:`QUOTE_MINIMAL`。否則預設為 :const:`QUOTE_NONE`。" -#: ../../library/csv.rst:470 +#: ../../library/csv.rst:469 msgid "" "When :const:`True`, spaces immediately following the *delimiter* are " "ignored. The default is :const:`False`." msgstr "" -"若為 :const:`True`,在緊接著\\ *delimiter*\\ 後的空格會被忽略。預設為 :const:" -"`False`。" +"若為 :const:`True`,在緊接著\\ *delimiter*\\ 後的空格會被忽略。預設" +"為 :const:`False`。" -#: ../../library/csv.rst:476 +#: ../../library/csv.rst:475 msgid "" "When ``True``, raise exception :exc:`Error` on bad CSV input. The default is " "``False``." msgstr "" "若為 ``True``,若有錯誤的 CSV 輸入則會引發 :exc:`Error`。預設為 ``False``。" -#: ../../library/csv.rst:482 +#: ../../library/csv.rst:481 msgid "Reader Objects" msgstr "讀取器物件" -#: ../../library/csv.rst:484 +#: ../../library/csv.rst:483 msgid "" -"Reader objects (:class:`DictReader` instances and objects returned by the :" -"func:`reader` function) have the following public methods:" +"Reader objects (:class:`DictReader` instances and objects returned by " +"the :func:`reader` function) have the following public methods:" msgstr "" "讀取器物件(:func:`reader` 函式回傳的 :class:`DictReader` 實例與物件)有下列" "公開方法 (public method):" -#: ../../library/csv.rst:489 +#: ../../library/csv.rst:488 msgid "" "Return the next row of the reader's iterable object as a list (if the object " "was returned from :func:`reader`) or a dict (if it is a :class:`DictReader` " @@ -775,28 +775,28 @@ msgid "" "should call this as ``next(reader)``." msgstr "" "回傳一個列表為讀入器的可疊代物件的下一列內容(若該物件是由 :func:`reader` 回" -"傳)或是一個 dict(若為 :class:`DictReader` 實例),會依據目前的 :class:" -"`Dialect` 進行剖析。通常會用 ``next(reader)`` 來進行呼叫。" +"傳)或是一個 dict(若為 :class:`DictReader` 實例),會依據目前" +"的 :class:`Dialect` 進行剖析。通常會用 ``next(reader)`` 來進行呼叫。" -#: ../../library/csv.rst:495 +#: ../../library/csv.rst:494 msgid "Reader objects have the following public attributes:" msgstr "讀取器物件有下列公開屬性 (public attributes):" -#: ../../library/csv.rst:499 +#: ../../library/csv.rst:498 msgid "A read-only description of the dialect in use by the parser." msgstr "dialect 的唯讀敘述,會被剖析器使用。" -#: ../../library/csv.rst:504 +#: ../../library/csv.rst:503 msgid "" "The number of lines read from the source iterator. This is not the same as " "the number of records returned, as records can span multiple lines." msgstr "來源疊代器所讀取的行數。這與回傳的紀錄數不同,因為可以進行跨行紀錄。" -#: ../../library/csv.rst:508 +#: ../../library/csv.rst:507 msgid "DictReader objects have the following public attribute:" msgstr "DictReader 物件有下列公開屬性:" -#: ../../library/csv.rst:512 +#: ../../library/csv.rst:511 msgid "" "If not passed as a parameter when creating the object, this attribute is " "initialized upon first access or when the first record is read from the file." @@ -804,11 +804,11 @@ msgstr "" "若在建立物件時沒有作為參數傳遞,這個屬性會在第一次存取之前或是第一筆資料被讀" "取之前進行初始化 (initialize)。" -#: ../../library/csv.rst:519 +#: ../../library/csv.rst:518 msgid "Writer Objects" msgstr "寫入器物件" -#: ../../library/csv.rst:521 +#: ../../library/csv.rst:520 msgid "" ":class:`writer` objects (:class:`DictWriter` instances and objects returned " "by the :func:`writer` function) have the following public methods. A *row* " @@ -826,7 +826,7 @@ msgstr "" "遞)。請注意,在寫入複數 (complex number) 時會用小括號 (parens) 包起來。這可" "能在其他程式讀取 CSV 檔案時導致某些問題(假設他們完全支援複雜數字)。" -#: ../../library/csv.rst:532 +#: ../../library/csv.rst:531 msgid "" "Write the *row* parameter to the writer's file object, formatted according " "to the current :class:`Dialect`. Return the return value of the call to the " @@ -835,11 +835,11 @@ msgstr "" "將參數 *row* 寫入至寫入器的檔案物件中,並依照目前的 :class:`Dialect` 進行格式" "化。回傳下層檔案物件 *write* 方法的回傳值。" -#: ../../library/csv.rst:536 +#: ../../library/csv.rst:535 msgid "Added support of arbitrary iterables." msgstr "新增對任意可疊代物件 (arbitrary iterables) 的支援。" -#: ../../library/csv.rst:541 +#: ../../library/csv.rst:540 msgid "" "Write all elements in *rows* (an iterable of *row* objects as described " "above) to the writer's file object, formatted according to the current " @@ -848,19 +848,19 @@ msgstr "" "將 *rows* 中所有元素(為上述的一個可疊代的 *row* 物件)寫入至寫入器的檔案物件" "中,並依照目前的 dialect 進行格式化。" -#: ../../library/csv.rst:545 +#: ../../library/csv.rst:544 msgid "Writer objects have the following public attribute:" msgstr "寫入器物件有下列公開屬性:" -#: ../../library/csv.rst:550 +#: ../../library/csv.rst:549 msgid "A read-only description of the dialect in use by the writer." msgstr "dialect 的唯讀敘述,會被寫入器使用。" -#: ../../library/csv.rst:553 +#: ../../library/csv.rst:552 msgid "DictWriter objects have the following public method:" msgstr "DictWriter 物件有下列公開方法:" -#: ../../library/csv.rst:558 +#: ../../library/csv.rst:557 msgid "" "Write a row with the field names (as specified in the constructor) to the " "writer's file object, formatted according to the current dialect. Return the " @@ -870,23 +870,23 @@ msgstr "" "中,並依照目前的 dialect 進行格式化。回傳內部呼叫 :meth:`csvwriter.writerow` " "的回傳值。" -#: ../../library/csv.rst:563 +#: ../../library/csv.rst:562 msgid "" -":meth:`writeheader` now also returns the value returned by the :meth:" -"`csvwriter.writerow` method it uses internally." +":meth:`writeheader` now also returns the value returned by " +"the :meth:`csvwriter.writerow` method it uses internally." msgstr "" ":meth:`writeheader` 現在也會回傳內部呼叫 :meth:`csvwriter.writerow` 的回傳" "值。" -#: ../../library/csv.rst:571 +#: ../../library/csv.rst:570 msgid "Examples" msgstr "範例" -#: ../../library/csv.rst:573 +#: ../../library/csv.rst:572 msgid "The simplest example of reading a CSV file::" msgstr "最簡單的讀取 CSV 檔案範例: ::" -#: ../../library/csv.rst:575 +#: ../../library/csv.rst:574 msgid "" "import csv\n" "with open('some.csv', newline='') as f:\n" @@ -900,11 +900,11 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:581 +#: ../../library/csv.rst:580 msgid "Reading a file with an alternate format::" msgstr "讀取一個其他格式的檔案: ::" -#: ../../library/csv.rst:583 +#: ../../library/csv.rst:582 msgid "" "import csv\n" "with open('passwd', newline='') as f:\n" @@ -918,11 +918,11 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:589 +#: ../../library/csv.rst:588 msgid "The corresponding simplest possible writing example is::" msgstr "相對最簡單、可行的寫入範例為: ::" -#: ../../library/csv.rst:591 +#: ../../library/csv.rst:590 msgid "" "import csv\n" "with open('some.csv', 'w', newline='') as f:\n" @@ -930,18 +930,18 @@ msgid "" " writer.writerows(someiterable)" msgstr "" -#: ../../library/csv.rst:596 +#: ../../library/csv.rst:595 msgid "" "Since :func:`open` is used to open a CSV file for reading, the file will by " -"default be decoded into unicode using the system default encoding (see :func:" -"`locale.getencoding`). To decode a file using a different encoding, use the " -"``encoding`` argument of open::" +"default be decoded into unicode using the system default encoding " +"(see :func:`locale.getencoding`). To decode a file using a different " +"encoding, use the ``encoding`` argument of open::" msgstr "" "當 :func:`open` 被使用於開啟並讀取一個 CSV 檔案,該檔案會預設使用系統預設的編" "碼格式(請見 :func:`locale.getencoding`),並解碼為 unicode。若要使用不同編碼" "格式進行檔案解碼,請使用 open 函式的 ``encoding`` 引數: ::" -#: ../../library/csv.rst:601 +#: ../../library/csv.rst:600 msgid "" "import csv\n" "with open('some.csv', newline='', encoding='utf-8') as f:\n" @@ -955,7 +955,7 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:607 +#: ../../library/csv.rst:606 msgid "" "The same applies to writing in something other than the system default " "encoding: specify the encoding argument when opening the output file." @@ -963,11 +963,11 @@ msgstr "" "同理可以應用到使用不同編碼格式進行寫入:當開啟輸出檔案時,指定 ``encoding`` " "引數。" -#: ../../library/csv.rst:610 +#: ../../library/csv.rst:609 msgid "Registering a new dialect::" msgstr "註冊一個新的 dialect : ::" -#: ../../library/csv.rst:612 +#: ../../library/csv.rst:611 msgid "" "import csv\n" "csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)\n" @@ -979,13 +979,13 @@ msgstr "" "with open('passwd', newline='') as f:\n" " reader = csv.reader(f, 'unixpwd')" -#: ../../library/csv.rst:617 +#: ../../library/csv.rst:616 msgid "" "A slightly more advanced use of the reader --- catching and reporting " "errors::" msgstr "稍微進階的讀取器用法 -- 擷取及回報錯誤: ::" -#: ../../library/csv.rst:619 +#: ../../library/csv.rst:618 msgid "" "import csv, sys\n" "filename = 'some.csv'\n" @@ -1007,13 +1007,13 @@ msgstr "" " except csv.Error as e:\n" " sys.exit(f'file {filename}, line {reader.line_num}: {e}')" -#: ../../library/csv.rst:629 +#: ../../library/csv.rst:628 msgid "" "And while the module doesn't directly support parsing strings, it can easily " "be done::" msgstr "而當模組無法直接支援剖析字串時,仍可以輕鬆的解決: ::" -#: ../../library/csv.rst:632 +#: ../../library/csv.rst:631 msgid "" "import csv\n" "for row in csv.reader(['one,two,three']):\n" @@ -1023,17 +1023,17 @@ msgstr "" "for row in csv.reader(['one,two,three']):\n" " print(row)" -#: ../../library/csv.rst:638 +#: ../../library/csv.rst:637 msgid "Footnotes" msgstr "註解" -#: ../../library/csv.rst:639 +#: ../../library/csv.rst:638 msgid "" "If ``newline=''`` is not specified, newlines embedded inside quoted fields " "will not be interpreted correctly, and on platforms that use ``\\r\\n`` " "linendings on write an extra ``\\r`` will be added. It should always be " -"safe to specify ``newline=''``, since the csv module does its own (:term:" -"`universal `) newline handling." +"safe to specify ``newline=''``, since the csv module does its own " +"(:term:`universal `) newline handling." msgstr "" "如果 ``newline=''`` 沒有被指定,則嵌入引號中的換行符號不會被正確直譯,使用 " "``\\r\\n`` 行尾 (linending) 的平台會寫入額外的 ``\\r``。自從 csv 模組有自己 " diff --git a/library/ctypes.po b/library/ctypes.po index 484f953dee9..07aaffbca6b 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-20 00:19+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -47,9 +47,10 @@ msgstr "" #: ../../library/ctypes.rst:27 msgid "" "Note: Some code samples reference the ctypes :class:`c_int` type. On " -"platforms where ``sizeof(long) == sizeof(int)`` it is an alias to :class:" -"`c_long`. So, you should not be confused if :class:`c_long` is printed if " -"you would expect :class:`c_int` --- they are actually the same type." +"platforms where ``sizeof(long) == sizeof(int)`` it is an alias " +"to :class:`c_long`. So, you should not be confused if :class:`c_long` is " +"printed if you would expect :class:`c_int` --- they are actually the same " +"type." msgstr "" #: ../../library/ctypes.rst:35 @@ -75,8 +76,8 @@ msgstr "" #: ../../library/ctypes.rst:48 msgid "" -"Windows errors used to raise :exc:`WindowsError`, which is now an alias of :" -"exc:`OSError`." +"Windows errors used to raise :exc:`WindowsError`, which is now an alias " +"of :exc:`OSError`." msgstr "" #: ../../library/ctypes.rst:53 @@ -208,8 +209,8 @@ msgstr "" #: ../../library/ctypes.rst:125 msgid "" "Sometimes, dlls export functions with names which aren't valid Python " -"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to use :func:" -"`getattr` to retrieve the function::" +"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to " +"use :func:`getattr` to retrieve the function::" msgstr "" #: ../../library/ctypes.rst:129 @@ -363,10 +364,10 @@ msgid "" "``None``, integers, bytes objects and (unicode) strings are the only native " "Python objects that can directly be used as parameters in these function " "calls. ``None`` is passed as a C ``NULL`` pointer, bytes objects and strings " -"are passed as pointer to the memory block that contains their data (:c:expr:" -"`char *` or :c:expr:`wchar_t *`). Python integers are passed as the " -"platform's default C :c:expr:`int` type, their value is masked to fit into " -"the C type." +"are passed as pointer to the memory block that contains their data " +"(:c:expr:`char *` or :c:expr:`wchar_t *`). Python integers are passed as " +"the platform's default C :c:expr:`int` type, their value is masked to fit " +"into the C type." msgstr "" #: ../../library/ctypes.rst:205 @@ -375,7 +376,7 @@ msgid "" "learn more about :mod:`ctypes` data types." msgstr "" -#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2278 +#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2430 msgid "Fundamental data types" msgstr "" @@ -383,15 +384,15 @@ msgstr "" msgid ":mod:`ctypes` defines a number of primitive C compatible data types:" msgstr "" -#: ../../library/ctypes.rst:217 +#: ../../library/ctypes.rst:217 ../../library/ctypes.rst:289 msgid "ctypes type" msgstr "ctypes 型別" -#: ../../library/ctypes.rst:217 +#: ../../library/ctypes.rst:217 ../../library/ctypes.rst:289 msgid "C type" msgstr "C 型別" -#: ../../library/ctypes.rst:217 +#: ../../library/ctypes.rst:217 ../../library/ctypes.rst:289 msgid "Python type" msgstr "Python 型別" @@ -680,11 +681,53 @@ msgstr "" #: ../../library/ctypes.rst:285 msgid "" +"Additionally, if IEC 60559 compatible complex arithmetic (Annex G) is " +"supported in both C and ``libffi``, the following complex types are " +"available:" +msgstr "" + +#: ../../library/ctypes.rst:291 +#, fuzzy +msgid ":class:`c_float_complex`" +msgstr ":class:`c_float`" + +#: ../../library/ctypes.rst:291 +#, fuzzy +msgid ":c:expr:`float complex`" +msgstr ":c:expr:`float`" + +#: ../../library/ctypes.rst:291 ../../library/ctypes.rst:293 +#: ../../library/ctypes.rst:295 +msgid "complex" +msgstr "" + +#: ../../library/ctypes.rst:293 +#, fuzzy +msgid ":class:`c_double_complex`" +msgstr ":class:`c_double`" + +#: ../../library/ctypes.rst:293 +#, fuzzy +msgid ":c:expr:`double complex`" +msgstr ":c:expr:`double`" + +#: ../../library/ctypes.rst:295 +#, fuzzy +msgid ":class:`c_longdouble_complex`" +msgstr ":class:`c_longdouble`" + +#: ../../library/ctypes.rst:295 +#, fuzzy +msgid ":c:expr:`long double complex`" +msgstr ":c:expr:`long double`" + +#: ../../library/ctypes.rst:299 +msgid "" "All these types can be created by calling them with an optional initializer " "of the correct type and value::" msgstr "" -#: ../../library/ctypes.rst:288 +#: ../../library/ctypes.rst:302 msgid "" ">>> c_int()\n" "c_long(0)\n" @@ -702,12 +745,12 @@ msgstr "" "c_ushort(65533)\n" ">>>" -#: ../../library/ctypes.rst:296 +#: ../../library/ctypes.rst:310 msgid "" "Since these types are mutable, their value can also be changed afterwards::" msgstr "" -#: ../../library/ctypes.rst:298 +#: ../../library/ctypes.rst:312 msgid "" ">>> i = c_int(42)\n" ">>> print(i)\n" @@ -729,15 +772,15 @@ msgstr "" "-99\n" ">>>" -#: ../../library/ctypes.rst:308 +#: ../../library/ctypes.rst:322 msgid "" -"Assigning a new value to instances of the pointer types :class:`c_char_p`, :" -"class:`c_wchar_p`, and :class:`c_void_p` changes the *memory location* they " -"point to, *not the contents* of the memory block (of course not, because " -"Python string objects are immutable)::" +"Assigning a new value to instances of the pointer " +"types :class:`c_char_p`, :class:`c_wchar_p`, and :class:`c_void_p` changes " +"the *memory location* they point to, *not the contents* of the memory block " +"(of course not, because Python string objects are immutable)::" msgstr "" -#: ../../library/ctypes.rst:313 +#: ../../library/ctypes.rst:327 msgid "" ">>> s = \"Hello, World\"\n" ">>> c_s = c_wchar_p(s)\n" @@ -769,17 +812,17 @@ msgstr "" "Hello, World\n" ">>>" -#: ../../library/ctypes.rst:328 +#: ../../library/ctypes.rst:342 msgid "" "You should be careful, however, not to pass them to functions expecting " -"pointers to mutable memory. If you need mutable memory blocks, ctypes has a :" -"func:`create_string_buffer` function which creates these in various ways. " -"The current memory block contents can be accessed (or changed) with the " -"``raw`` property; if you want to access it as NUL terminated string, use the " -"``value`` property::" +"pointers to mutable memory. If you need mutable memory blocks, ctypes has " +"a :func:`create_string_buffer` function which creates these in various " +"ways. The current memory block contents can be accessed (or changed) with " +"the ``raw`` property; if you want to access it as NUL terminated string, use " +"the ``value`` property::" msgstr "" -#: ../../library/ctypes.rst:335 +#: ../../library/ctypes.rst:349 msgid "" ">>> from ctypes import *\n" ">>> p = create_string_buffer(3) # create a 3 byte buffer, " @@ -801,7 +844,7 @@ msgid "" ">>>" msgstr "" -#: ../../library/ctypes.rst:352 +#: ../../library/ctypes.rst:366 msgid "" "The :func:`create_string_buffer` function replaces the old :func:`!c_buffer` " "function (which is still available as an alias). To create a mutable memory " @@ -809,18 +852,18 @@ msgid "" "the :func:`create_unicode_buffer` function." msgstr "" -#: ../../library/ctypes.rst:361 +#: ../../library/ctypes.rst:375 msgid "Calling functions, continued" msgstr "" -#: ../../library/ctypes.rst:363 +#: ../../library/ctypes.rst:377 msgid "" -"Note that printf prints to the real standard output channel, *not* to :data:" -"`sys.stdout`, so these examples will only work at the console prompt, not " -"from within *IDLE* or *PythonWin*::" +"Note that printf prints to the real standard output channel, *not* " +"to :data:`sys.stdout`, so these examples will only work at the console " +"prompt, not from within *IDLE* or *PythonWin*::" msgstr "" -#: ../../library/ctypes.rst:367 +#: ../../library/ctypes.rst:381 msgid "" ">>> printf = libc.printf\n" ">>> printf(b\"Hello, %s\\n\", b\"World!\")\n" @@ -856,14 +899,14 @@ msgstr "" "parameter 2\n" ">>>" -#: ../../library/ctypes.rst:383 +#: ../../library/ctypes.rst:397 msgid "" "As has been mentioned before, all Python types except integers, strings, and " "bytes objects have to be wrapped in their corresponding :mod:`ctypes` type, " "so that they can be converted to the required C data type::" msgstr "" -#: ../../library/ctypes.rst:387 +#: ../../library/ctypes.rst:401 msgid "" ">>> printf(b\"An int %d, a double %f\\n\", 1234, c_double(3.14))\n" "An int 1234, a double 3.140000\n" @@ -875,11 +918,11 @@ msgstr "" "31\n" ">>>" -#: ../../library/ctypes.rst:395 +#: ../../library/ctypes.rst:409 msgid "Calling variadic functions" msgstr "" -#: ../../library/ctypes.rst:397 +#: ../../library/ctypes.rst:411 msgid "" "On a lot of platforms calling variadic functions through ctypes is exactly " "the same as calling functions with a fixed number of parameters. On some " @@ -888,27 +931,27 @@ msgid "" "functions." msgstr "" -#: ../../library/ctypes.rst:402 +#: ../../library/ctypes.rst:416 msgid "" "On those platforms it is required to specify the :attr:`~_CFuncPtr.argtypes` " "attribute for the regular, non-variadic, function arguments:" msgstr "" -#: ../../library/ctypes.rst:405 +#: ../../library/ctypes.rst:419 msgid "libc.printf.argtypes = [ctypes.c_char_p]" msgstr "libc.printf.argtypes = [ctypes.c_char_p]" -#: ../../library/ctypes.rst:409 +#: ../../library/ctypes.rst:423 msgid "" "Because specifying the attribute does not inhibit portability it is advised " "to always specify :attr:`~_CFuncPtr.argtypes` for all variadic functions." msgstr "" -#: ../../library/ctypes.rst:416 +#: ../../library/ctypes.rst:430 msgid "Calling functions with your own custom data types" msgstr "" -#: ../../library/ctypes.rst:418 +#: ../../library/ctypes.rst:432 msgid "" "You can also customize :mod:`ctypes` argument conversion to allow instances " "of your own classes be used as function arguments. :mod:`ctypes` looks for " @@ -917,7 +960,7 @@ msgid "" "or an object with an :attr:`!_as_parameter_` attribute::" msgstr "" -#: ../../library/ctypes.rst:424 +#: ../../library/ctypes.rst:438 msgid "" ">>> class Bottles:\n" "... def __init__(self, number):\n" @@ -939,24 +982,24 @@ msgstr "" "19\n" ">>>" -#: ../../library/ctypes.rst:434 +#: ../../library/ctypes.rst:448 msgid "" "If you don't want to store the instance's data in the :attr:`!" "_as_parameter_` instance variable, you could define a :class:`property` " "which makes the attribute available on request." msgstr "" -#: ../../library/ctypes.rst:442 +#: ../../library/ctypes.rst:456 msgid "Specifying the required argument types (function prototypes)" msgstr "" -#: ../../library/ctypes.rst:444 +#: ../../library/ctypes.rst:458 msgid "" "It is possible to specify the required argument types of functions exported " "from DLLs by setting the :attr:`~_CFuncPtr.argtypes` attribute." msgstr "" -#: ../../library/ctypes.rst:447 +#: ../../library/ctypes.rst:461 msgid "" ":attr:`~_CFuncPtr.argtypes` must be a sequence of C data types (the :func:`!" "printf` function is probably not a good example here, because it takes a " @@ -965,7 +1008,7 @@ msgid "" "feature)::" msgstr "" -#: ../../library/ctypes.rst:452 +#: ../../library/ctypes.rst:466 msgid "" ">>> printf.argtypes = [c_char_p, c_char_p, c_int, c_double]\n" ">>> printf(b\"String '%s', Int %d, Double %f\\n\", b\"Hi\", 10, 2.2)\n" @@ -979,14 +1022,14 @@ msgstr "" "37\n" ">>>" -#: ../../library/ctypes.rst:458 +#: ../../library/ctypes.rst:472 msgid "" "Specifying a format protects against incompatible argument types (just as a " "prototype for a C function), and tries to convert the arguments to valid " "types::" msgstr "" -#: ../../library/ctypes.rst:461 +#: ../../library/ctypes.rst:475 msgid "" ">>> printf(b\"%d %d %d\", 1, 2, 3)\n" "Traceback (most recent call last):\n" @@ -1008,57 +1051,58 @@ msgstr "" "13\n" ">>>" -#: ../../library/ctypes.rst:470 +#: ../../library/ctypes.rst:484 msgid "" "If you have defined your own classes which you pass to function calls, you " "have to implement a :meth:`~_CData.from_param` class method for them to be " -"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. The :meth:" -"`~_CData.from_param` class method receives the Python object passed to the " -"function call, it should do a typecheck or whatever is needed to make sure " -"this object is acceptable, and then return the object itself, its :attr:`!" -"_as_parameter_` attribute, or whatever you want to pass as the C function " -"argument in this case. Again, the result should be an integer, string, " -"bytes, a :mod:`ctypes` instance, or an object with an :attr:`!" +"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. " +"The :meth:`~_CData.from_param` class method receives the Python object " +"passed to the function call, it should do a typecheck or whatever is needed " +"to make sure this object is acceptable, and then return the object itself, " +"its :attr:`!_as_parameter_` attribute, or whatever you want to pass as the C " +"function argument in this case. Again, the result should be an integer, " +"string, bytes, a :mod:`ctypes` instance, or an object with an :attr:`!" "_as_parameter_` attribute." msgstr "" -#: ../../library/ctypes.rst:484 +#: ../../library/ctypes.rst:498 msgid "Return types" msgstr "" -#: ../../library/ctypes.rst:494 +#: ../../library/ctypes.rst:508 msgid "" "By default functions are assumed to return the C :c:expr:`int` type. Other " "return types can be specified by setting the :attr:`~_CFuncPtr.restype` " "attribute of the function object." msgstr "" -#: ../../library/ctypes.rst:498 +#: ../../library/ctypes.rst:512 msgid "" -"The C prototype of :c:func:`time` is ``time_t time(time_t *)``. Because :c:" -"type:`time_t` might be of a different type than the default return type :c:" -"expr:`int`, you should specify the :attr:`!restype` attribute::" +"The C prototype of :c:func:`time` is ``time_t time(time_t *)``. " +"Because :c:type:`time_t` might be of a different type than the default " +"return type :c:expr:`int`, you should specify the :attr:`!restype` " +"attribute::" msgstr "" -#: ../../library/ctypes.rst:502 +#: ../../library/ctypes.rst:516 msgid ">>> libc.time.restype = c_time_t" msgstr ">>> libc.time.restype = c_time_t" -#: ../../library/ctypes.rst:504 +#: ../../library/ctypes.rst:518 msgid "The argument types can be specified using :attr:`~_CFuncPtr.argtypes`::" msgstr "" -#: ../../library/ctypes.rst:506 +#: ../../library/ctypes.rst:520 msgid ">>> libc.time.argtypes = (POINTER(c_time_t),)" msgstr ">>> libc.time.argtypes = (POINTER(c_time_t),)" -#: ../../library/ctypes.rst:508 +#: ../../library/ctypes.rst:522 msgid "" "To call the function with a ``NULL`` pointer as first argument, use " "``None``::" msgstr "" -#: ../../library/ctypes.rst:510 +#: ../../library/ctypes.rst:524 msgid "" ">>> print(libc.time(None))\n" "1150640792" @@ -1066,13 +1110,13 @@ msgstr "" ">>> print(libc.time(None))\n" "1150640792" -#: ../../library/ctypes.rst:513 +#: ../../library/ctypes.rst:527 msgid "" "Here is a more advanced example, it uses the :func:`!strchr` function, which " "expects a string pointer and a char, and returns a pointer to a string::" msgstr "" -#: ../../library/ctypes.rst:516 +#: ../../library/ctypes.rst:530 msgid "" ">>> strchr = libc.strchr\n" ">>> strchr(b\"abcdef\", ord(\"d\"))\n" @@ -1094,14 +1138,14 @@ msgstr "" "None\n" ">>>" -#: ../../library/ctypes.rst:526 +#: ../../library/ctypes.rst:540 msgid "" "If you want to avoid the :func:`ord(\"x\") ` calls above, you can set " "the :attr:`~_CFuncPtr.argtypes` attribute, and the second argument will be " "converted from a single character Python bytes object into a C char:" msgstr "" -#: ../../library/ctypes.rst:530 +#: ../../library/ctypes.rst:544 msgid "" ">>> strchr.restype = c_char_p\n" ">>> strchr.argtypes = [c_char_p, c_char]\n" @@ -1131,7 +1175,7 @@ msgstr "" "b'def'\n" ">>>" -#: ../../library/ctypes.rst:545 +#: ../../library/ctypes.rst:559 msgid "" "You can also use a callable Python object (a function or a class for " "example) as the :attr:`~_CFuncPtr.restype` attribute, if the foreign " @@ -1141,7 +1185,7 @@ msgid "" "values and automatically raise an exception::" msgstr "" -#: ../../library/ctypes.rst:551 +#: ../../library/ctypes.rst:565 msgid "" ">>> GetModuleHandle = windll.kernel32.GetModuleHandleA\n" ">>> def ValidHandle(value):\n" @@ -1177,7 +1221,7 @@ msgstr "" "OSError: [Errno 126] The specified module could not be found.\n" ">>>" -#: ../../library/ctypes.rst:568 +#: ../../library/ctypes.rst:582 msgid "" "``WinError`` is a function which will call Windows ``FormatMessage()`` api " "to get the string representation of an error code, and *returns* an " @@ -1185,18 +1229,18 @@ msgid "" "used, it calls :func:`GetLastError` to retrieve it." msgstr "" -#: ../../library/ctypes.rst:573 +#: ../../library/ctypes.rst:587 msgid "" "Please note that a much more powerful error checking mechanism is available " "through the :attr:`~_CFuncPtr.errcheck` attribute; see the reference manual " "for details." msgstr "" -#: ../../library/ctypes.rst:581 +#: ../../library/ctypes.rst:595 msgid "Passing pointers (or: passing parameters by reference)" msgstr "" -#: ../../library/ctypes.rst:583 +#: ../../library/ctypes.rst:597 msgid "" "Sometimes a C api function expects a *pointer* to a data type as parameter, " "probably to write into the corresponding location, or if the data is too " @@ -1204,16 +1248,16 @@ msgid "" "reference*." msgstr "" -#: ../../library/ctypes.rst:587 +#: ../../library/ctypes.rst:601 msgid "" ":mod:`ctypes` exports the :func:`byref` function which is used to pass " -"parameters by reference. The same effect can be achieved with the :func:" -"`pointer` function, although :func:`pointer` does a lot more work since it " -"constructs a real pointer object, so it is faster to use :func:`byref` if " -"you don't need the pointer object in Python itself::" +"parameters by reference. The same effect can be achieved with " +"the :func:`pointer` function, although :func:`pointer` does a lot more work " +"since it constructs a real pointer object, so it is faster to " +"use :func:`byref` if you don't need the pointer object in Python itself::" msgstr "" -#: ../../library/ctypes.rst:593 +#: ../../library/ctypes.rst:607 msgid "" ">>> i = c_int()\n" ">>> f = c_float()\n" @@ -1239,33 +1283,33 @@ msgstr "" "1 3.1400001049 b'Hello'\n" ">>>" -#: ../../library/ctypes.rst:609 +#: ../../library/ctypes.rst:623 msgid "Structures and unions" msgstr "" -#: ../../library/ctypes.rst:611 +#: ../../library/ctypes.rst:625 msgid "" -"Structures and unions must derive from the :class:`Structure` and :class:" -"`Union` base classes which are defined in the :mod:`ctypes` module. Each " -"subclass must define a :attr:`~Structure._fields_` attribute. :attr:`!" -"_fields_` must be a list of *2-tuples*, containing a *field name* and a " -"*field type*." +"Structures and unions must derive from the :class:`Structure` " +"and :class:`Union` base classes which are defined in the :mod:`ctypes` " +"module. Each subclass must define a :attr:`~Structure._fields_` " +"attribute. :attr:`!_fields_` must be a list of *2-tuples*, containing a " +"*field name* and a *field type*." msgstr "" -#: ../../library/ctypes.rst:616 +#: ../../library/ctypes.rst:630 msgid "" "The field type must be a :mod:`ctypes` type like :class:`c_int`, or any " "other derived :mod:`ctypes` type: structure, union, array, pointer." msgstr "" -#: ../../library/ctypes.rst:619 +#: ../../library/ctypes.rst:633 msgid "" "Here is a simple example of a POINT structure, which contains two integers " "named *x* and *y*, and also shows how to initialize a structure in the " "constructor::" msgstr "" -#: ../../library/ctypes.rst:622 +#: ../../library/ctypes.rst:636 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -1301,19 +1345,19 @@ msgstr "" "TypeError: too many initializers\n" ">>>" -#: ../../library/ctypes.rst:639 +#: ../../library/ctypes.rst:653 msgid "" "You can, however, build much more complicated structures. A structure can " "itself contain other structures by using a structure as a field type." msgstr "" -#: ../../library/ctypes.rst:642 +#: ../../library/ctypes.rst:656 msgid "" "Here is a RECT structure which contains two POINTs named *upperleft* and " "*lowerright*::" msgstr "" -#: ../../library/ctypes.rst:645 +#: ../../library/ctypes.rst:659 msgid "" ">>> class RECT(Structure):\n" "... _fields_ = [(\"upperleft\", POINT),\n" @@ -1337,13 +1381,13 @@ msgstr "" "0 0\n" ">>>" -#: ../../library/ctypes.rst:656 +#: ../../library/ctypes.rst:670 msgid "" "Nested structures can also be initialized in the constructor in several " "ways::" msgstr "" -#: ../../library/ctypes.rst:658 +#: ../../library/ctypes.rst:672 msgid "" ">>> r = RECT(POINT(1, 2), POINT(3, 4))\n" ">>> r = RECT((1, 2), (3, 4))" @@ -1351,18 +1395,20 @@ msgstr "" ">>> r = RECT(POINT(1, 2), POINT(3, 4))\n" ">>> r = RECT((1, 2), (3, 4))" -#: ../../library/ctypes.rst:661 +#: ../../library/ctypes.rst:675 msgid "" "Field :term:`descriptor`\\s can be retrieved from the *class*, they are " -"useful for debugging because they can provide useful information::" +"useful for debugging because they can provide useful information. " +"See :class:`CField`::" msgstr "" -#: ../../library/ctypes.rst:664 +#: ../../library/ctypes.rst:679 +#, fuzzy msgid "" -">>> print(POINT.x)\n" -"\n" -">>> print(POINT.y)\n" -"\n" +">>> POINT.x\n" +"\n" +">>> POINT.y\n" +"\n" ">>>" msgstr "" ">>> print(POINT.x)\n" @@ -1371,7 +1417,7 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:675 +#: ../../library/ctypes.rst:690 msgid "" ":mod:`ctypes` does not support passing unions or structures with bit-fields " "to functions by value. While this may work on 32-bit x86, it's not " @@ -1379,54 +1425,64 @@ msgid "" "structures with bit-fields should always be passed to functions by pointer." msgstr "" -#: ../../library/ctypes.rst:681 -msgid "Structure/union alignment and byte order" +#: ../../library/ctypes.rst:696 +msgid "Structure/union layout, alignment and byte order" msgstr "" -#: ../../library/ctypes.rst:683 +#: ../../library/ctypes.rst:698 msgid "" -"By default, Structure and Union fields are aligned in the same way the C " -"compiler does it. It is possible to override this behavior by specifying a :" -"attr:`~Structure._pack_` class attribute in the subclass definition. This " -"must be set to a positive integer and specifies the maximum alignment for " -"the fields. This is what ``#pragma pack(n)`` also does in MSVC. It is also " -"possible to set a minimum alignment for how the subclass itself is packed in " -"the same way ``#pragma align(n)`` works in MSVC. This can be achieved by " -"specifying a :attr:`~Structure._align_` class attribute in the subclass " -"definition." +"By default, Structure and Union fields are laid out in the same way the C " +"compiler does it. It is possible to override this behavior entirely by " +"specifying a :attr:`~Structure._layout_` class attribute in the subclass " +"definition; see the attribute documentation for details." msgstr "" -#: ../../library/ctypes.rst:693 +#: ../../library/ctypes.rst:703 +msgid "" +"It is possible to specify the maximum alignment for the fields by setting " +"the :attr:`~Structure._pack_` class attribute to a positive integer. This " +"matches what ``#pragma pack(n)`` does in MSVC." +msgstr "" + +#: ../../library/ctypes.rst:707 +msgid "" +"It is also possible to set a minimum alignment for how the subclass itself " +"is packed in the same way ``#pragma align(n)`` works in MSVC. This can be " +"achieved by specifying a :attr:`~Structure._align_` class attribute in the " +"subclass definition." +msgstr "" + +#: ../../library/ctypes.rst:712 msgid "" ":mod:`ctypes` uses the native byte order for Structures and Unions. To " -"build structures with non-native byte order, you can use one of the :class:" -"`BigEndianStructure`, :class:`LittleEndianStructure`, :class:" -"`BigEndianUnion`, and :class:`LittleEndianUnion` base classes. These " -"classes cannot contain pointer fields." +"build structures with non-native byte order, you can use one of " +"the :class:`BigEndianStructure`, :class:`LittleEndianStructure`, :class:`BigEndianUnion`, " +"and :class:`LittleEndianUnion` base classes. These classes cannot contain " +"pointer fields." msgstr "" -#: ../../library/ctypes.rst:703 +#: ../../library/ctypes.rst:722 msgid "Bit fields in structures and unions" msgstr "" -#: ../../library/ctypes.rst:705 +#: ../../library/ctypes.rst:724 msgid "" "It is possible to create structures and unions containing bit fields. Bit " "fields are only possible for integer fields, the bit width is specified as " "the third item in the :attr:`~Structure._fields_` tuples::" msgstr "" -#: ../../library/ctypes.rst:709 +#: ../../library/ctypes.rst:728 +#, fuzzy msgid "" ">>> class Int(Structure):\n" "... _fields_ = [(\"first_16\", c_int, 16),\n" "... (\"second_16\", c_int, 16)]\n" "...\n" ">>> print(Int.first_16)\n" -"\n" +"\n" ">>> print(Int.second_16)\n" -"\n" -">>>" +"" msgstr "" ">>> class Int(Structure):\n" "... _fields_ = [(\"first_16\", c_int, 16),\n" @@ -1438,33 +1494,42 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:723 +#: ../../library/ctypes.rst:737 +msgid "" +"It is important to note that bit field allocation and layout in memory are " +"not defined as a C standard; their implementation is compiler-specific. By " +"default, Python will attempt to match the behavior of a \"native\" compiler " +"for the current platform. See the :attr:`~Structure._layout_` attribute for " +"details on the default behavior and how to change it." +msgstr "" + +#: ../../library/ctypes.rst:748 msgid "Arrays" msgstr "" -#: ../../library/ctypes.rst:725 +#: ../../library/ctypes.rst:750 msgid "" "Arrays are sequences, containing a fixed number of instances of the same " "type." msgstr "" -#: ../../library/ctypes.rst:727 +#: ../../library/ctypes.rst:752 msgid "" "The recommended way to create array types is by multiplying a data type with " "a positive integer::" msgstr "" -#: ../../library/ctypes.rst:730 +#: ../../library/ctypes.rst:755 msgid "TenPointsArrayType = POINT * 10" msgstr "" -#: ../../library/ctypes.rst:732 +#: ../../library/ctypes.rst:757 msgid "" "Here is an example of a somewhat artificial data type, a structure " "containing 4 POINTs among other stuff::" msgstr "" -#: ../../library/ctypes.rst:735 +#: ../../library/ctypes.rst:760 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -1492,11 +1557,11 @@ msgstr "" "4\n" ">>>" -#: ../../library/ctypes.rst:748 +#: ../../library/ctypes.rst:773 msgid "Instances are created in the usual way, by calling the class::" msgstr "" -#: ../../library/ctypes.rst:750 +#: ../../library/ctypes.rst:775 msgid "" "arr = TenPointsArrayType()\n" "for pt in arr:\n" @@ -1506,17 +1571,17 @@ msgstr "" "for pt in arr:\n" " print(pt.x, pt.y)" -#: ../../library/ctypes.rst:754 +#: ../../library/ctypes.rst:779 msgid "" "The above code print a series of ``0 0`` lines, because the array contents " "is initialized to zeros." msgstr "" -#: ../../library/ctypes.rst:757 +#: ../../library/ctypes.rst:782 msgid "Initializers of the correct type can also be specified::" msgstr "" -#: ../../library/ctypes.rst:759 +#: ../../library/ctypes.rst:784 msgid "" ">>> from ctypes import *\n" ">>> TenIntegers = c_int * 10\n" @@ -1538,17 +1603,17 @@ msgstr "" "1 2 3 4 5 6 7 8 9 10\n" ">>>" -#: ../../library/ctypes.rst:773 +#: ../../library/ctypes.rst:798 msgid "Pointers" msgstr "指標" -#: ../../library/ctypes.rst:775 +#: ../../library/ctypes.rst:800 msgid "" -"Pointer instances are created by calling the :func:`pointer` function on a :" -"mod:`ctypes` type::" +"Pointer instances are created by calling the :func:`pointer` function on " +"a :mod:`ctypes` type::" msgstr "" -#: ../../library/ctypes.rst:778 +#: ../../library/ctypes.rst:803 msgid "" ">>> from ctypes import *\n" ">>> i = c_int(42)\n" @@ -1560,13 +1625,13 @@ msgstr "" ">>> pi = pointer(i)\n" ">>>" -#: ../../library/ctypes.rst:783 +#: ../../library/ctypes.rst:808 msgid "" "Pointer instances have a :attr:`~_Pointer.contents` attribute which returns " "the object to which the pointer points, the ``i`` object above::" msgstr "" -#: ../../library/ctypes.rst:786 +#: ../../library/ctypes.rst:811 msgid "" ">>> pi.contents\n" "c_long(42)\n" @@ -1576,13 +1641,13 @@ msgstr "" "c_long(42)\n" ">>>" -#: ../../library/ctypes.rst:790 +#: ../../library/ctypes.rst:815 msgid "" "Note that :mod:`ctypes` does not have OOR (original object return), it " "constructs a new, equivalent object each time you retrieve an attribute::" msgstr "" -#: ../../library/ctypes.rst:793 +#: ../../library/ctypes.rst:818 msgid "" ">>> pi.contents is i\n" "False\n" @@ -1596,14 +1661,14 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:799 +#: ../../library/ctypes.rst:824 msgid "" "Assigning another :class:`c_int` instance to the pointer's contents " "attribute would cause the pointer to point to the memory location where this " "is stored::" msgstr "" -#: ../../library/ctypes.rst:802 +#: ../../library/ctypes.rst:827 msgid "" ">>> i = c_int(99)\n" ">>> pi.contents = i\n" @@ -1617,11 +1682,11 @@ msgstr "" "c_long(99)\n" ">>>" -#: ../../library/ctypes.rst:811 +#: ../../library/ctypes.rst:836 msgid "Pointer instances can also be indexed with integers::" msgstr "" -#: ../../library/ctypes.rst:813 +#: ../../library/ctypes.rst:838 msgid "" ">>> pi[0]\n" "99\n" @@ -1631,11 +1696,11 @@ msgstr "" "99\n" ">>>" -#: ../../library/ctypes.rst:817 +#: ../../library/ctypes.rst:842 msgid "Assigning to an integer index changes the pointed to value::" msgstr "" -#: ../../library/ctypes.rst:819 +#: ../../library/ctypes.rst:844 msgid "" ">>> print(i)\n" "c_long(99)\n" @@ -1651,7 +1716,7 @@ msgstr "" "c_long(22)\n" ">>>" -#: ../../library/ctypes.rst:826 +#: ../../library/ctypes.rst:851 msgid "" "It is also possible to use indexes different from 0, but you must know what " "you're doing, just as in C: You can access or change arbitrary memory " @@ -1660,7 +1725,7 @@ msgid "" "instead of a single item." msgstr "" -#: ../../library/ctypes.rst:832 +#: ../../library/ctypes.rst:857 msgid "" "Behind the scenes, the :func:`pointer` function does more than simply create " "pointer instances, it has to create pointer *types* first. This is done with " @@ -1668,7 +1733,7 @@ msgid "" "returns a new type::" msgstr "" -#: ../../library/ctypes.rst:837 +#: ../../library/ctypes.rst:862 msgid "" ">>> PI = POINTER(c_int)\n" ">>> PI\n" @@ -1692,13 +1757,13 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:848 +#: ../../library/ctypes.rst:873 msgid "" "Calling the pointer type without an argument creates a ``NULL`` pointer. " "``NULL`` pointers have a ``False`` boolean value::" msgstr "" -#: ../../library/ctypes.rst:851 +#: ../../library/ctypes.rst:876 msgid "" ">>> null_ptr = POINTER(c_int)()\n" ">>> print(bool(null_ptr))\n" @@ -1710,13 +1775,13 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:856 +#: ../../library/ctypes.rst:881 msgid "" ":mod:`ctypes` checks for ``NULL`` when dereferencing pointers (but " "dereferencing invalid non-\\ ``NULL`` pointers would crash Python)::" msgstr "" -#: ../../library/ctypes.rst:859 +#: ../../library/ctypes.rst:884 msgid "" ">>> null_ptr[0]\n" "Traceback (most recent call last):\n" @@ -1742,11 +1807,50 @@ msgstr "" "ValueError: NULL pointer access\n" ">>>" -#: ../../library/ctypes.rst:875 +#: ../../library/ctypes.rst:899 +msgid "Thread safety without the GIL" +msgstr "" + +#: ../../library/ctypes.rst:901 +msgid "" +"From Python 3.13 onward, the :term:`GIL` can be disabled on :term:`free " +"threaded ` builds. In ctypes, reads and writes to a single " +"object concurrently is safe, but not across multiple objects:" +msgstr "" + +#: ../../library/ctypes.rst:904 +msgid "" +">>> number = c_int(42)\n" +">>> pointer_a = pointer(number)\n" +">>> pointer_b = pointer(number)" +msgstr "" + +#: ../../library/ctypes.rst:910 +msgid "" +"In the above, it's only safe for one object to read and write to the address " +"at once if the GIL is disabled. So, ``pointer_a`` can be shared and written " +"to across multiple threads, but only if ``pointer_b`` is not also attempting " +"to do the same. If this is an issue, consider using " +"a :class:`threading.Lock` to synchronize access to memory:" +msgstr "" + +#: ../../library/ctypes.rst:915 +msgid "" +">>> import threading\n" +">>> lock = threading.Lock()\n" +">>> # Thread 1\n" +">>> with lock:\n" +"... pointer_a.contents = 24\n" +">>> # Thread 2\n" +">>> with lock:\n" +"... pointer_b.contents = 42" +msgstr "" + +#: ../../library/ctypes.rst:930 msgid "Type conversions" msgstr "" -#: ../../library/ctypes.rst:877 +#: ../../library/ctypes.rst:932 msgid "" "Usually, ctypes does strict type checking. This means, if you have " "``POINTER(c_int)`` in the :attr:`~_CFuncPtr.argtypes` list of a function or " @@ -1757,7 +1861,7 @@ msgid "" "ctypes accepts an array of c_int::" msgstr "" -#: ../../library/ctypes.rst:884 +#: ../../library/ctypes.rst:939 msgid "" ">>> class Bar(Structure):\n" "... _fields_ = [(\"count\", c_int), (\"values\", POINTER(c_int))]\n" @@ -1787,7 +1891,7 @@ msgstr "" "3\n" ">>>" -#: ../../library/ctypes.rst:898 +#: ../../library/ctypes.rst:953 msgid "" "In addition, if a function argument is explicitly declared to be a pointer " "type (such as ``POINTER(c_int)``) in :attr:`~_CFuncPtr.argtypes`, an object " @@ -1796,11 +1900,11 @@ msgid "" "automatically." msgstr "" -#: ../../library/ctypes.rst:903 +#: ../../library/ctypes.rst:958 msgid "To set a POINTER type field to ``NULL``, you can assign ``None``::" msgstr "" -#: ../../library/ctypes.rst:905 +#: ../../library/ctypes.rst:960 msgid "" ">>> bar.values = None\n" ">>>" @@ -1808,7 +1912,7 @@ msgstr "" ">>> bar.values = None\n" ">>>" -#: ../../library/ctypes.rst:910 +#: ../../library/ctypes.rst:965 msgid "" "Sometimes you have instances of incompatible types. In C, you can cast one " "type into another type. :mod:`ctypes` provides a :func:`cast` function " @@ -1817,7 +1921,7 @@ msgid "" "``values`` field, but not instances of other types::" msgstr "" -#: ../../library/ctypes.rst:916 +#: ../../library/ctypes.rst:971 msgid "" ">>> bar.values = (c_byte * 4)()\n" "Traceback (most recent call last):\n" @@ -1833,11 +1937,11 @@ msgstr "" "instance\n" ">>>" -#: ../../library/ctypes.rst:922 +#: ../../library/ctypes.rst:977 msgid "For these cases, the :func:`cast` function is handy." msgstr "" -#: ../../library/ctypes.rst:924 +#: ../../library/ctypes.rst:979 msgid "" "The :func:`cast` function can be used to cast a ctypes instance into a " "pointer to a different ctypes data type. :func:`cast` takes two parameters, " @@ -1846,7 +1950,7 @@ msgid "" "references the same memory block as the first argument::" msgstr "" -#: ../../library/ctypes.rst:930 +#: ../../library/ctypes.rst:985 msgid "" ">>> a = (c_byte * 4)()\n" ">>> cast(a, POINTER(c_int))\n" @@ -1858,13 +1962,13 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:935 +#: ../../library/ctypes.rst:990 msgid "" "So, :func:`cast` can be used to assign to the ``values`` field of ``Bar`` " "the structure::" msgstr "" -#: ../../library/ctypes.rst:938 +#: ../../library/ctypes.rst:993 msgid "" ">>> bar = Bar()\n" ">>> bar.values = cast((c_byte * 4)(), POINTER(c_int))\n" @@ -1878,18 +1982,18 @@ msgstr "" "0\n" ">>>" -#: ../../library/ctypes.rst:948 +#: ../../library/ctypes.rst:1003 msgid "Incomplete Types" msgstr "" -#: ../../library/ctypes.rst:950 +#: ../../library/ctypes.rst:1005 msgid "" "*Incomplete Types* are structures, unions or arrays whose members are not " "yet specified. In C, they are specified by forward declarations, which are " "defined later::" msgstr "" -#: ../../library/ctypes.rst:954 +#: ../../library/ctypes.rst:1009 msgid "" "struct cell; /* forward declaration */\n" "\n" @@ -1899,13 +2003,13 @@ msgid "" "};" msgstr "" -#: ../../library/ctypes.rst:961 +#: ../../library/ctypes.rst:1016 msgid "" "The straightforward translation into ctypes code would be this, but it does " "not work::" msgstr "" -#: ../../library/ctypes.rst:964 +#: ../../library/ctypes.rst:1019 msgid "" ">>> class cell(Structure):\n" "... _fields_ = [(\"name\", c_char_p),\n" @@ -1927,14 +2031,14 @@ msgstr "" "NameError: name 'cell' is not defined\n" ">>>" -#: ../../library/ctypes.rst:974 +#: ../../library/ctypes.rst:1029 msgid "" "because the new ``class cell`` is not available in the class statement " -"itself. In :mod:`ctypes`, we can define the ``cell`` class and set the :attr:" -"`~Structure._fields_` attribute later, after the class statement::" +"itself. In :mod:`ctypes`, we can define the ``cell`` class and set " +"the :attr:`~Structure._fields_` attribute later, after the class statement::" msgstr "" -#: ../../library/ctypes.rst:978 +#: ../../library/ctypes.rst:1033 msgid "" ">>> from ctypes import *\n" ">>> class cell(Structure):\n" @@ -1952,13 +2056,13 @@ msgstr "" "... (\"next\", POINTER(cell))]\n" ">>>" -#: ../../library/ctypes.rst:986 +#: ../../library/ctypes.rst:1041 msgid "" "Let's try it. We create two instances of ``cell``, and let them point to " "each other, and finally follow the pointer chain a few times::" msgstr "" -#: ../../library/ctypes.rst:989 +#: ../../library/ctypes.rst:1044 msgid "" ">>> c1 = cell()\n" ">>> c1.name = b\"foo\"\n" @@ -1988,24 +2092,24 @@ msgstr "" "foo bar foo bar foo bar foo bar\n" ">>>" -#: ../../library/ctypes.rst:1007 +#: ../../library/ctypes.rst:1062 msgid "Callback functions" msgstr "回呼函式" -#: ../../library/ctypes.rst:1009 +#: ../../library/ctypes.rst:1064 msgid "" ":mod:`ctypes` allows creating C callable function pointers from Python " "callables. These are sometimes called *callback functions*." msgstr "" -#: ../../library/ctypes.rst:1012 +#: ../../library/ctypes.rst:1067 msgid "" "First, you must create a class for the callback function. The class knows " "the calling convention, the return type, and the number and types of " "arguments this function will receive." msgstr "" -#: ../../library/ctypes.rst:1016 +#: ../../library/ctypes.rst:1071 msgid "" "The :func:`CFUNCTYPE` factory function creates types for callback functions " "using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE` " @@ -2013,21 +2117,21 @@ msgid "" "calling convention." msgstr "" -#: ../../library/ctypes.rst:1021 +#: ../../library/ctypes.rst:1076 msgid "" "Both of these factory functions are called with the result type as first " "argument, and the callback functions expected argument types as the " "remaining arguments." msgstr "" -#: ../../library/ctypes.rst:1025 +#: ../../library/ctypes.rst:1080 msgid "" "I will present an example here which uses the standard C library's :c:func:`!" "qsort` function, that is used to sort items with the help of a callback " "function. :c:func:`!qsort` will be used to sort an array of integers::" msgstr "" -#: ../../library/ctypes.rst:1029 +#: ../../library/ctypes.rst:1084 msgid "" ">>> IntArray5 = c_int * 5\n" ">>> ia = IntArray5(5, 1, 7, 33, 99)\n" @@ -2041,7 +2145,7 @@ msgstr "" ">>> qsort.restype = None\n" ">>>" -#: ../../library/ctypes.rst:1035 +#: ../../library/ctypes.rst:1090 msgid "" ":func:`!qsort` must be called with a pointer to the data to sort, the number " "of items in the data array, the size of one item, and a pointer to the " @@ -2051,13 +2155,13 @@ msgid "" "otherwise." msgstr "" -#: ../../library/ctypes.rst:1041 +#: ../../library/ctypes.rst:1096 msgid "" "So our callback function receives pointers to integers, and must return an " "integer. First we create the ``type`` for the callback function::" msgstr "" -#: ../../library/ctypes.rst:1044 +#: ../../library/ctypes.rst:1099 msgid "" ">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" ">>>" @@ -2065,13 +2169,13 @@ msgstr "" ">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" ">>>" -#: ../../library/ctypes.rst:1047 +#: ../../library/ctypes.rst:1102 msgid "" "To get started, here is a simple callback that shows the values it gets " "passed::" msgstr "" -#: ../../library/ctypes.rst:1050 +#: ../../library/ctypes.rst:1105 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -2087,11 +2191,11 @@ msgstr "" ">>> cmp_func = CMPFUNC(py_cmp_func)\n" ">>>" -#: ../../library/ctypes.rst:1057 +#: ../../library/ctypes.rst:1112 msgid "The result::" msgstr "結果為: ::" -#: ../../library/ctypes.rst:1059 +#: ../../library/ctypes.rst:1114 msgid "" ">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n" "py_cmp_func 5 1\n" @@ -2109,11 +2213,11 @@ msgstr "" "py_cmp_func 1 7\n" ">>>" -#: ../../library/ctypes.rst:1067 +#: ../../library/ctypes.rst:1122 msgid "Now we can actually compare the two items and return a useful result::" msgstr "" -#: ../../library/ctypes.rst:1069 +#: ../../library/ctypes.rst:1124 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -2141,11 +2245,11 @@ msgstr "" "py_cmp_func 5 7\n" ">>>" -#: ../../library/ctypes.rst:1082 +#: ../../library/ctypes.rst:1137 msgid "As we can easily check, our array is sorted now::" msgstr "" -#: ../../library/ctypes.rst:1084 +#: ../../library/ctypes.rst:1139 msgid "" ">>> for i in ia: print(i, end=\" \")\n" "...\n" @@ -2157,13 +2261,13 @@ msgstr "" "1 5 7 33 99\n" ">>>" -#: ../../library/ctypes.rst:1089 +#: ../../library/ctypes.rst:1144 msgid "" "The function factories can be used as decorator factories, so we may as well " "write::" msgstr "" -#: ../../library/ctypes.rst:1092 +#: ../../library/ctypes.rst:1147 msgid "" ">>> @CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" "... def py_cmp_func(a, b):\n" @@ -2191,14 +2295,14 @@ msgstr "" "py_cmp_func 5 7\n" ">>>" -#: ../../library/ctypes.rst:1107 +#: ../../library/ctypes.rst:1162 msgid "" "Make sure you keep references to :func:`CFUNCTYPE` objects as long as they " "are used from C code. :mod:`ctypes` doesn't, and if you don't, they may be " "garbage collected, crashing your program when a callback is made." msgstr "" -#: ../../library/ctypes.rst:1111 +#: ../../library/ctypes.rst:1166 msgid "" "Also, note that if the callback function is called in a thread created " "outside of Python's control (e.g. by the foreign code that calls the " @@ -2208,25 +2312,25 @@ msgid "" "even when those calls are made from the same C thread." msgstr "" -#: ../../library/ctypes.rst:1121 +#: ../../library/ctypes.rst:1176 msgid "Accessing values exported from dlls" msgstr "" -#: ../../library/ctypes.rst:1123 +#: ../../library/ctypes.rst:1178 msgid "" "Some shared libraries not only export functions, they also export variables. " "An example in the Python library itself is the :c:data:`Py_Version`, Python " "runtime version number encoded in a single constant integer." msgstr "" -#: ../../library/ctypes.rst:1127 +#: ../../library/ctypes.rst:1182 msgid "" ":mod:`ctypes` can access values like this with the :meth:`~_CData.in_dll` " "class methods of the type. *pythonapi* is a predefined symbol giving access " "to the Python C api::" msgstr "" -#: ../../library/ctypes.rst:1131 +#: ../../library/ctypes.rst:1186 msgid "" ">>> version = ctypes.c_int.in_dll(ctypes.pythonapi, \"Py_Version\")\n" ">>> print(hex(version.value))\n" @@ -2236,17 +2340,17 @@ msgstr "" ">>> print(hex(version.value))\n" "0x30c00a0" -#: ../../library/ctypes.rst:1135 +#: ../../library/ctypes.rst:1190 msgid "" "An extended example which also demonstrates the use of pointers accesses " "the :c:data:`PyImport_FrozenModules` pointer exported by Python." msgstr "" -#: ../../library/ctypes.rst:1138 +#: ../../library/ctypes.rst:1193 msgid "Quoting the docs for that value:" msgstr "" -#: ../../library/ctypes.rst:1140 +#: ../../library/ctypes.rst:1195 msgid "" "This pointer is initialized to point to an array of :c:struct:`_frozen` " "records, terminated by one whose members are all ``NULL`` or zero. When a " @@ -2255,13 +2359,13 @@ msgid "" "frozen modules." msgstr "" -#: ../../library/ctypes.rst:1145 +#: ../../library/ctypes.rst:1200 msgid "" "So manipulating this pointer could even prove useful. To restrict the " "example size, we show only how this table can be read with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1148 +#: ../../library/ctypes.rst:1203 msgid "" ">>> from ctypes import *\n" ">>>\n" @@ -2285,13 +2389,13 @@ msgstr "" "...\n" ">>>" -#: ../../library/ctypes.rst:1159 +#: ../../library/ctypes.rst:1214 msgid "" "We have defined the :c:struct:`_frozen` data type, so we can get the pointer " "to the table::" msgstr "" -#: ../../library/ctypes.rst:1162 +#: ../../library/ctypes.rst:1217 msgid "" ">>> FrozenTable = POINTER(struct_frozen)\n" ">>> table = FrozenTable.in_dll(pythonapi, \"_PyImport_FrozenBootstrap\")\n" @@ -2301,7 +2405,7 @@ msgstr "" ">>> table = FrozenTable.in_dll(pythonapi, \"_PyImport_FrozenBootstrap\")\n" ">>>" -#: ../../library/ctypes.rst:1166 +#: ../../library/ctypes.rst:1221 msgid "" "Since ``table`` is a ``pointer`` to the array of ``struct_frozen`` records, " "we can iterate over it, but we just have to make sure that our loop " @@ -2310,7 +2414,7 @@ msgid "" "the loop when we hit the ``NULL`` entry::" msgstr "" -#: ../../library/ctypes.rst:1172 +#: ../../library/ctypes.rst:1227 msgid "" ">>> for item in table:\n" "... if item.name is None:\n" @@ -2332,28 +2436,28 @@ msgstr "" "zipimport 12345\n" ">>>" -#: ../../library/ctypes.rst:1182 +#: ../../library/ctypes.rst:1237 msgid "" "The fact that standard Python has a frozen module and a frozen package " "(indicated by the negative ``size`` member) is not well known, it is only " "used for testing. Try it out with ``import __hello__`` for example." msgstr "" -#: ../../library/ctypes.rst:1190 +#: ../../library/ctypes.rst:1245 msgid "Surprises" msgstr "" -#: ../../library/ctypes.rst:1192 +#: ../../library/ctypes.rst:1247 msgid "" "There are some edges in :mod:`ctypes` where you might expect something other " "than what actually happens." msgstr "" -#: ../../library/ctypes.rst:1195 +#: ../../library/ctypes.rst:1250 msgid "Consider the following example::" msgstr "" -#: ../../library/ctypes.rst:1197 +#: ../../library/ctypes.rst:1252 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -2391,13 +2495,13 @@ msgstr "" "3 4 3 4\n" ">>>" -#: ../../library/ctypes.rst:1215 +#: ../../library/ctypes.rst:1270 msgid "" "Hm. We certainly expected the last statement to print ``3 4 1 2``. What " "happened? Here are the steps of the ``rc.a, rc.b = rc.b, rc.a`` line above::" msgstr "" -#: ../../library/ctypes.rst:1218 +#: ../../library/ctypes.rst:1273 msgid "" ">>> temp0, temp1 = rc.b, rc.a\n" ">>> rc.a = temp0\n" @@ -2409,7 +2513,7 @@ msgstr "" ">>> rc.b = temp1\n" ">>>" -#: ../../library/ctypes.rst:1223 +#: ../../library/ctypes.rst:1278 msgid "" "Note that ``temp0`` and ``temp1`` are objects still using the internal " "buffer of the ``rc`` object above. So executing ``rc.a = temp0`` copies the " @@ -2418,20 +2522,20 @@ msgid "" "have the expected effect." msgstr "" -#: ../../library/ctypes.rst:1229 +#: ../../library/ctypes.rst:1284 msgid "" "Keep in mind that retrieving sub-objects from Structure, Unions, and Arrays " "doesn't *copy* the sub-object, instead it retrieves a wrapper object " "accessing the root-object's underlying buffer." msgstr "" -#: ../../library/ctypes.rst:1233 +#: ../../library/ctypes.rst:1288 msgid "" "Another example that may behave differently from what one would expect is " "this::" msgstr "" -#: ../../library/ctypes.rst:1235 +#: ../../library/ctypes.rst:1290 msgid "" ">>> s = c_char_p()\n" ">>> s.value = b\"abc def ghi\"\n" @@ -2449,13 +2553,13 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:1245 +#: ../../library/ctypes.rst:1300 msgid "" "Objects instantiated from :class:`c_char_p` can only have their value set to " "bytes or integers." msgstr "" -#: ../../library/ctypes.rst:1248 +#: ../../library/ctypes.rst:1303 msgid "" "Why is it printing ``False``? ctypes instances are objects containing a " "memory block plus some :term:`descriptor`\\s accessing the contents of the " @@ -2464,16 +2568,16 @@ msgid "" "the contents again constructs a new Python object each time!" msgstr "" -#: ../../library/ctypes.rst:1258 +#: ../../library/ctypes.rst:1313 msgid "Variable-sized data types" msgstr "" -#: ../../library/ctypes.rst:1260 +#: ../../library/ctypes.rst:1315 msgid "" ":mod:`ctypes` provides some support for variable-sized arrays and structures." msgstr "" -#: ../../library/ctypes.rst:1262 +#: ../../library/ctypes.rst:1317 msgid "" "The :func:`resize` function can be used to resize the memory buffer of an " "existing ctypes object. The function takes the object as first argument, " @@ -2482,7 +2586,7 @@ msgid "" "objects type, a :exc:`ValueError` is raised if this is tried::" msgstr "" -#: ../../library/ctypes.rst:1268 +#: ../../library/ctypes.rst:1323 msgid "" ">>> short_array = (c_short * 4)()\n" ">>> print(sizeof(short_array))\n" @@ -2512,14 +2616,14 @@ msgstr "" "8\n" ">>>" -#: ../../library/ctypes.rst:1282 +#: ../../library/ctypes.rst:1337 msgid "" "This is nice and fine, but how would one access the additional elements " "contained in this array? Since the type still only knows about 4 elements, " "we get errors accessing other elements::" msgstr "" -#: ../../library/ctypes.rst:1286 +#: ../../library/ctypes.rst:1341 msgid "" ">>> short_array[:]\n" "[0, 0, 0, 0]\n" @@ -2537,28 +2641,28 @@ msgstr "" "IndexError: invalid index\n" ">>>" -#: ../../library/ctypes.rst:1294 +#: ../../library/ctypes.rst:1349 msgid "" "Another way to use variable-sized data types with :mod:`ctypes` is to use " "the dynamic nature of Python, and (re-)define the data type after the " "required size is already known, on a case by case basis." msgstr "" -#: ../../library/ctypes.rst:1302 +#: ../../library/ctypes.rst:1357 msgid "ctypes reference" msgstr "" -#: ../../library/ctypes.rst:1308 +#: ../../library/ctypes.rst:1363 msgid "Finding shared libraries" msgstr "" -#: ../../library/ctypes.rst:1310 +#: ../../library/ctypes.rst:1365 msgid "" "When programming in a compiled language, shared libraries are accessed when " "compiling/linking a program, and when the program is run." msgstr "" -#: ../../library/ctypes.rst:1313 +#: ../../library/ctypes.rst:1368 msgid "" "The purpose of the :func:`~ctypes.util.find_library` function is to locate a " "library in a way similar to what the compiler or runtime loader does (on " @@ -2567,13 +2671,13 @@ msgid "" "and call the runtime loader directly." msgstr "" -#: ../../library/ctypes.rst:1319 +#: ../../library/ctypes.rst:1374 msgid "" "The :mod:`!ctypes.util` module provides a function which can help to " "determine the library to load." msgstr "" -#: ../../library/ctypes.rst:1327 +#: ../../library/ctypes.rst:1382 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like *lib*, suffix like ``.so``, ``.dylib`` or version " @@ -2581,29 +2685,29 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1332 ../../library/ctypes.rst:2038 +#: ../../library/ctypes.rst:1387 ../../library/ctypes.rst:2135 msgid "The exact functionality is system dependent." msgstr "" -#: ../../library/ctypes.rst:1334 +#: ../../library/ctypes.rst:1389 msgid "" "On Linux, :func:`~ctypes.util.find_library` tries to run external programs " "(``/sbin/ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the library " "file. It returns the filename of the library file." msgstr "" -#: ../../library/ctypes.rst:1338 +#: ../../library/ctypes.rst:1393 msgid "" "On Linux, the value of the environment variable ``LD_LIBRARY_PATH`` is used " "when searching for libraries, if a library cannot be found by any other " "means." msgstr "" -#: ../../library/ctypes.rst:1342 +#: ../../library/ctypes.rst:1397 msgid "Here are some examples::" msgstr "以下是一些範例: ::" -#: ../../library/ctypes.rst:1344 +#: ../../library/ctypes.rst:1399 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"m\")\n" @@ -2623,14 +2727,14 @@ msgstr "" "'libbz2.so.1.0'\n" ">>>" -#: ../../library/ctypes.rst:1353 +#: ../../library/ctypes.rst:1408 msgid "" "On macOS and Android, :func:`~ctypes.util.find_library` uses the system's " "standard naming schemes and paths to locate the library, and returns a full " "pathname if successful::" msgstr "" -#: ../../library/ctypes.rst:1357 +#: ../../library/ctypes.rst:1412 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"c\")\n" @@ -2654,7 +2758,7 @@ msgstr "" "'/System/Library/Frameworks/AGL.framework/AGL'\n" ">>>" -#: ../../library/ctypes.rst:1368 +#: ../../library/ctypes.rst:1423 msgid "" "On Windows, :func:`~ctypes.util.find_library` searches along the system " "search path, and returns the full pathname, but since there is no predefined " @@ -2662,7 +2766,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ctypes.rst:1372 +#: ../../library/ctypes.rst:1427 msgid "" "If wrapping a shared library with :mod:`ctypes`, it *may* be better to " "determine the shared library name at development time, and hardcode that " @@ -2670,47 +2774,83 @@ msgid "" "to locate the library at runtime." msgstr "" -#: ../../library/ctypes.rst:1380 +#: ../../library/ctypes.rst:1435 +msgid "Listing loaded shared libraries" +msgstr "" + +#: ../../library/ctypes.rst:1437 +msgid "" +"When writing code that relies on code loaded from shared libraries, it can " +"be useful to know which shared libraries have already been loaded into the " +"current process." +msgstr "" + +#: ../../library/ctypes.rst:1441 +msgid "" +"The :mod:`!ctypes.util` module provides the :func:`~ctypes.util.dllist` " +"function, which calls the different APIs provided by the various platforms " +"to help determine which shared libraries have already been loaded into the " +"current process." +msgstr "" + +#: ../../library/ctypes.rst:1445 +msgid "" +"The exact output of this function will be system dependent. On most " +"platforms, the first entry of this list represents the current process " +"itself, which may be an empty string. For example, on glibc-based Linux, the " +"return may look like::" +msgstr "" + +#: ../../library/ctypes.rst:1450 +msgid "" +">>> from ctypes.util import dllist\n" +">>> dllist()\n" +"['', 'linux-vdso.so.1', '/lib/x86_64-linux-gnu/libm.so.6', '/lib/x86_64-" +"linux-gnu/libc.so.6', ... ]" +msgstr "" + +#: ../../library/ctypes.rst:1457 msgid "Loading shared libraries" msgstr "" -#: ../../library/ctypes.rst:1382 +#: ../../library/ctypes.rst:1459 msgid "" "There are several ways to load shared libraries into the Python process. " "One way is to instantiate one of the following classes:" msgstr "" -#: ../../library/ctypes.rst:1388 +#: ../../library/ctypes.rst:1465 msgid "" "Instances of this class represent loaded shared libraries. Functions in " "these libraries use the standard C calling convention, and are assumed to " "return :c:expr:`int`." msgstr "" -#: ../../library/ctypes.rst:1392 +#: ../../library/ctypes.rst:1469 msgid "" "On Windows creating a :class:`CDLL` instance may fail even if the DLL name " -"exists. When a dependent DLL of the loaded DLL is not found, a :exc:" -"`OSError` error is raised with the message *\"[WinError 126] The specified " -"module could not be found\".* This error message does not contain the name " -"of the missing DLL because the Windows API does not return this information " -"making this error hard to diagnose. To resolve this error and determine " -"which DLL is not found, you need to find the list of dependent DLLs and " -"determine which one is not found using Windows debugging and tracing tools." -msgstr "" - -#: ../../library/ctypes.rst:1404 ../../library/ctypes.rst:1429 -#: ../../library/ctypes.rst:1442 ../../library/ctypes.rst:1460 +"exists. When a dependent DLL of the loaded DLL is not found, " +"a :exc:`OSError` error is raised with the message *\"[WinError 126] The " +"specified module could not be found\".* This error message does not contain " +"the name of the missing DLL because the Windows API does not return this " +"information making this error hard to diagnose. To resolve this error and " +"determine which DLL is not found, you need to find the list of dependent " +"DLLs and determine which one is not found using Windows debugging and " +"tracing tools." +msgstr "" + +#: ../../library/ctypes.rst:1481 ../../library/ctypes.rst:1506 +#: ../../library/ctypes.rst:1519 ../../library/ctypes.rst:1537 msgid "The *name* parameter can now be a :term:`path-like object`." msgstr "" -#: ../../library/ctypes.rst:1408 +#: ../../library/ctypes.rst:1485 msgid "" "`Microsoft DUMPBIN tool `_ -- A tool to find DLL dependents." msgstr "" -#: ../../library/ctypes.rst:1414 +#: ../../library/ctypes.rst:1491 msgid "" "Instances of this class represent loaded shared libraries, functions in " "these libraries use the ``stdcall`` calling convention, and are assumed to " @@ -2720,36 +2860,38 @@ msgid "" "a failure, an :class:`OSError` is automatically raised." msgstr "" -#: ../../library/ctypes.rst:1421 ../../library/ctypes.rst:1438 -#: ../../library/ctypes.rst:1582 ../../library/ctypes.rst:1590 -#: ../../library/ctypes.rst:1767 ../../library/ctypes.rst:2018 -#: ../../library/ctypes.rst:2027 ../../library/ctypes.rst:2052 -#: ../../library/ctypes.rst:2061 ../../library/ctypes.rst:2070 -#: ../../library/ctypes.rst:2085 ../../library/ctypes.rst:2142 -#: ../../library/ctypes.rst:2170 ../../library/ctypes.rst:2514 +#: ../../library/ctypes.rst:1498 ../../library/ctypes.rst:1515 +#: ../../library/ctypes.rst:1659 ../../library/ctypes.rst:1667 +#: ../../library/ctypes.rst:1839 ../../library/ctypes.rst:1891 +#: ../../library/ctypes.rst:2043 ../../library/ctypes.rst:2115 +#: ../../library/ctypes.rst:2124 ../../library/ctypes.rst:2149 +#: ../../library/ctypes.rst:2163 ../../library/ctypes.rst:2172 +#: ../../library/ctypes.rst:2181 ../../library/ctypes.rst:2196 +#: ../../library/ctypes.rst:2263 ../../library/ctypes.rst:2290 +#: ../../library/ctypes.rst:2690 ../../library/ctypes.rst:3088 msgid "Availability" msgstr "可用性" -#: ../../library/ctypes.rst:1423 +#: ../../library/ctypes.rst:1500 msgid "" -":exc:`WindowsError` used to be raised, which is now an alias of :exc:" -"`OSError`." +":exc:`WindowsError` used to be raised, which is now an alias " +"of :exc:`OSError`." msgstr "" -#: ../../library/ctypes.rst:1434 +#: ../../library/ctypes.rst:1511 msgid "" "Instances of this class represent loaded shared libraries, functions in " "these libraries use the ``stdcall`` calling convention, and are assumed to " "return :c:expr:`int` by default." msgstr "" -#: ../../library/ctypes.rst:1445 +#: ../../library/ctypes.rst:1522 msgid "" "The Python :term:`global interpreter lock` is released before calling any " "function exported by these libraries, and reacquired afterwards." msgstr "" -#: ../../library/ctypes.rst:1451 +#: ../../library/ctypes.rst:1528 msgid "" "Instances of this class behave like :class:`CDLL` instances, except that the " "Python GIL is *not* released during the function call, and after the " @@ -2757,11 +2899,11 @@ msgid "" "set, a Python exception is raised." msgstr "" -#: ../../library/ctypes.rst:1456 +#: ../../library/ctypes.rst:1533 msgid "Thus, this is only useful to call Python C api functions directly." msgstr "" -#: ../../library/ctypes.rst:1462 +#: ../../library/ctypes.rst:1539 msgid "" "All these classes can be instantiated by calling them with at least one " "argument, the pathname of the shared library. If you have an existing " @@ -2771,7 +2913,7 @@ msgid "" "the process, and to get a handle to it." msgstr "" -#: ../../library/ctypes.rst:1469 +#: ../../library/ctypes.rst:1546 msgid "" "The *mode* parameter can be used to specify how the library is loaded. For " "details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is " @@ -2779,33 +2921,35 @@ msgid "" "configurable." msgstr "" -#: ../../library/ctypes.rst:1474 +#: ../../library/ctypes.rst:1551 msgid "" "The *use_errno* parameter, when set to true, enables a ctypes mechanism that " -"allows accessing the system :data:`errno` error number in a safe way. :mod:" -"`ctypes` maintains a thread-local copy of the system's :data:`errno` " -"variable; if you call foreign functions created with ``use_errno=True`` then " -"the :data:`errno` value before the function call is swapped with the ctypes " -"private copy, the same happens immediately after the function call." +"allows accessing the system :data:`errno` error number in a safe " +"way. :mod:`ctypes` maintains a thread-local copy of the " +"system's :data:`errno` variable; if you call foreign functions created with " +"``use_errno=True`` then the :data:`errno` value before the function call is " +"swapped with the ctypes private copy, the same happens immediately after the " +"function call." msgstr "" -#: ../../library/ctypes.rst:1481 +#: ../../library/ctypes.rst:1558 msgid "" "The function :func:`ctypes.get_errno` returns the value of the ctypes " "private copy, and the function :func:`ctypes.set_errno` changes the ctypes " "private copy to a new value and returns the former value." msgstr "" -#: ../../library/ctypes.rst:1485 +#: ../../library/ctypes.rst:1562 msgid "" "The *use_last_error* parameter, when set to true, enables the same mechanism " -"for the Windows error code which is managed by the :func:`GetLastError` and :" -"func:`!SetLastError` Windows API functions; :func:`ctypes.get_last_error` " -"and :func:`ctypes.set_last_error` are used to request and change the ctypes " -"private copy of the windows error code." +"for the Windows error code which is managed by the :func:`GetLastError` " +"and :func:`!SetLastError` Windows API " +"functions; :func:`ctypes.get_last_error` and :func:`ctypes.set_last_error` " +"are used to request and change the ctypes private copy of the windows error " +"code." msgstr "" -#: ../../library/ctypes.rst:1491 +#: ../../library/ctypes.rst:1568 msgid "" "The *winmode* parameter is used on Windows to specify how the library is " "loaded (since *mode* is ignored). It takes any value that is valid for the " @@ -2815,29 +2959,29 @@ msgid "" "ensure the correct library and dependencies are loaded." msgstr "" -#: ../../library/ctypes.rst:1498 +#: ../../library/ctypes.rst:1575 msgid "Added *winmode* parameter." msgstr "新增 *winmode* 參數。" -#: ../../library/ctypes.rst:1505 +#: ../../library/ctypes.rst:1582 msgid "" "Flag to use as *mode* parameter. On platforms where this flag is not " "available, it is defined as the integer zero." msgstr "" -#: ../../library/ctypes.rst:1512 +#: ../../library/ctypes.rst:1589 msgid "" "Flag to use as *mode* parameter. On platforms where this is not available, " "it is the same as *RTLD_GLOBAL*." msgstr "" -#: ../../library/ctypes.rst:1519 +#: ../../library/ctypes.rst:1596 msgid "" "The default mode which is used to load shared libraries. On OSX 10.3, this " "is *RTLD_GLOBAL*, otherwise it is the same as *RTLD_LOCAL*." msgstr "" -#: ../../library/ctypes.rst:1522 +#: ../../library/ctypes.rst:1599 msgid "" "Instances of these classes have no public methods. Functions exported by " "the shared library can be accessed as attributes or by index. Please note " @@ -2846,7 +2990,7 @@ msgid "" "other hand, accessing it through an index returns a new object each time::" msgstr "" -#: ../../library/ctypes.rst:1528 +#: ../../library/ctypes.rst:1605 msgid "" ">>> from ctypes import CDLL\n" ">>> libc = CDLL(\"libc.so.6\") # On Linux\n" @@ -2862,21 +3006,21 @@ msgstr "" ">>> libc['time'] == libc['time']\n" "False" -#: ../../library/ctypes.rst:1535 +#: ../../library/ctypes.rst:1612 msgid "" "The following public attributes are available, their name starts with an " "underscore to not clash with exported function names:" msgstr "" -#: ../../library/ctypes.rst:1541 +#: ../../library/ctypes.rst:1618 msgid "The system handle used to access the library." msgstr "" -#: ../../library/ctypes.rst:1546 +#: ../../library/ctypes.rst:1623 msgid "The name of the library passed in the constructor." msgstr "" -#: ../../library/ctypes.rst:1548 +#: ../../library/ctypes.rst:1625 msgid "" "Shared libraries can also be loaded by using one of the prefabricated " "objects, which are instances of the :class:`LibraryLoader` class, either by " @@ -2884,13 +3028,13 @@ msgid "" "library as attribute of the loader instance." msgstr "" -#: ../../library/ctypes.rst:1556 +#: ../../library/ctypes.rst:1633 msgid "" -"Class which loads shared libraries. *dlltype* should be one of the :class:" -"`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." +"Class which loads shared libraries. *dlltype* should be one of " +"the :class:`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." msgstr "" -#: ../../library/ctypes.rst:1559 +#: ../../library/ctypes.rst:1636 msgid "" ":meth:`!__getattr__` has special behavior: It allows loading a shared " "library by accessing it as attribute of a library loader instance. The " @@ -2898,72 +3042,72 @@ msgid "" "each time." msgstr "" -#: ../../library/ctypes.rst:1565 +#: ../../library/ctypes.rst:1642 msgid "" "Load a shared library into the process and return it. This method always " "returns a new instance of the library." msgstr "" -#: ../../library/ctypes.rst:1569 +#: ../../library/ctypes.rst:1646 msgid "These prefabricated library loaders are available:" msgstr "" -#: ../../library/ctypes.rst:1574 +#: ../../library/ctypes.rst:1651 msgid "Creates :class:`CDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1580 +#: ../../library/ctypes.rst:1657 msgid "Creates :class:`WinDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1588 +#: ../../library/ctypes.rst:1665 msgid "Creates :class:`OleDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1596 +#: ../../library/ctypes.rst:1673 msgid "Creates :class:`PyDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1599 +#: ../../library/ctypes.rst:1676 msgid "" "For accessing the C Python api directly, a ready-to-use Python shared " "library object is available:" msgstr "" -#: ../../library/ctypes.rst:1605 +#: ../../library/ctypes.rst:1682 msgid "" "An instance of :class:`PyDLL` that exposes Python C API functions as " -"attributes. Note that all these functions are assumed to return C :c:expr:" -"`int`, which is of course not always the truth, so you have to assign the " -"correct :attr:`!restype` attribute to use these functions." +"attributes. Note that all these functions are assumed to return " +"C :c:expr:`int`, which is of course not always the truth, so you have to " +"assign the correct :attr:`!restype` attribute to use these functions." msgstr "" -#: ../../library/ctypes.rst:1610 ../../library/ctypes.rst:1612 +#: ../../library/ctypes.rst:1687 ../../library/ctypes.rst:1689 msgid "" "Loading a library through any of these objects raises an :ref:`auditing " "event ` ``ctypes.dlopen`` with string argument ``name``, the name " "used to load the library." msgstr "" -#: ../../library/ctypes.rst:1616 ../../library/ctypes.rst:1618 +#: ../../library/ctypes.rst:1693 ../../library/ctypes.rst:1695 msgid "" -"Accessing a function on a loaded library raises an auditing event ``ctypes." -"dlsym`` with arguments ``library`` (the library object) and ``name`` (the " -"symbol's name as a string or integer)." +"Accessing a function on a loaded library raises an auditing event " +"``ctypes.dlsym`` with arguments ``library`` (the library object) and " +"``name`` (the symbol's name as a string or integer)." msgstr "" -#: ../../library/ctypes.rst:1622 ../../library/ctypes.rst:1624 +#: ../../library/ctypes.rst:1699 ../../library/ctypes.rst:1701 msgid "" "In cases when only the library handle is available rather than the object, " "accessing a function raises an auditing event ``ctypes.dlsym/handle`` with " "arguments ``handle`` (the raw library handle) and ``name``." msgstr "" -#: ../../library/ctypes.rst:1631 +#: ../../library/ctypes.rst:1708 msgid "Foreign functions" msgstr "" -#: ../../library/ctypes.rst:1633 +#: ../../library/ctypes.rst:1710 msgid "" "As explained in the previous section, foreign functions can be accessed as " "attributes of loaded shared libraries. The function objects created in this " @@ -2972,13 +3116,13 @@ msgid "" "library loader." msgstr "" -#: ../../library/ctypes.rst:1638 +#: ../../library/ctypes.rst:1715 msgid "" "They are instances of a private local class :class:`!_FuncPtr` (not exposed " "in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class:" msgstr "" -#: ../../library/ctypes.rst:1641 +#: ../../library/ctypes.rst:1718 msgid "" ">>> import ctypes\n" ">>> lib = ctypes.CDLL(None)\n" @@ -2988,29 +3132,29 @@ msgid "" "False" msgstr "" -#: ../../library/ctypes.rst:1652 +#: ../../library/ctypes.rst:1729 msgid "Base class for C callable foreign functions." msgstr "" -#: ../../library/ctypes.rst:1654 +#: ../../library/ctypes.rst:1731 msgid "" "Instances of foreign functions are also C compatible data types; they " "represent C function pointers." msgstr "" -#: ../../library/ctypes.rst:1657 +#: ../../library/ctypes.rst:1734 msgid "" "This behavior can be customized by assigning to special attributes of the " "foreign function object." msgstr "" -#: ../../library/ctypes.rst:1662 +#: ../../library/ctypes.rst:1739 msgid "" "Assign a ctypes type to specify the result type of the foreign function. Use " "``None`` for :c:expr:`void`, a function not returning anything." msgstr "" -#: ../../library/ctypes.rst:1665 +#: ../../library/ctypes.rst:1742 msgid "" "It is possible to assign a callable Python object that is not a ctypes type, " "in this case the function is assumed to return a C :c:expr:`int`, and the " @@ -3020,7 +3164,7 @@ msgid "" "callable to the :attr:`errcheck` attribute." msgstr "" -#: ../../library/ctypes.rst:1674 +#: ../../library/ctypes.rst:1751 msgid "" "Assign a tuple of ctypes types to specify the argument types that the " "function accepts. Functions using the ``stdcall`` calling convention can " @@ -3029,17 +3173,17 @@ msgid "" "unspecified arguments as well." msgstr "" -#: ../../library/ctypes.rst:1680 +#: ../../library/ctypes.rst:1757 msgid "" -"When a foreign function is called, each actual argument is passed to the :" -"meth:`~_CData.from_param` class method of the items in the :attr:`argtypes` " -"tuple, this method allows adapting the actual argument to an object that the " -"foreign function accepts. For example, a :class:`c_char_p` item in the :" -"attr:`argtypes` tuple will convert a string passed as argument into a bytes " -"object using ctypes conversion rules." +"When a foreign function is called, each actual argument is passed to " +"the :meth:`~_CData.from_param` class method of the items in " +"the :attr:`argtypes` tuple, this method allows adapting the actual argument " +"to an object that the foreign function accepts. For example, " +"a :class:`c_char_p` item in the :attr:`argtypes` tuple will convert a string " +"passed as argument into a bytes object using ctypes conversion rules." msgstr "" -#: ../../library/ctypes.rst:1687 +#: ../../library/ctypes.rst:1764 msgid "" "New: It is now possible to put items in argtypes which are not ctypes types, " "but each item must have a :meth:`~_CData.from_param` method which returns a " @@ -3047,64 +3191,58 @@ msgid "" "defining adapters that can adapt custom objects as function parameters." msgstr "" -#: ../../library/ctypes.rst:1694 +#: ../../library/ctypes.rst:1771 msgid "" "Assign a Python function or another callable to this attribute. The callable " "will be called with three or more arguments:" msgstr "" -#: ../../library/ctypes.rst:1701 +#: ../../library/ctypes.rst:1778 msgid "" "*result* is what the foreign function returns, as specified by the :attr:`!" "restype` attribute." msgstr "" -#: ../../library/ctypes.rst:1704 +#: ../../library/ctypes.rst:1781 msgid "" "*func* is the foreign function object itself, this allows reusing the same " "callable object to check or post process the results of several functions." msgstr "" -#: ../../library/ctypes.rst:1708 +#: ../../library/ctypes.rst:1785 msgid "" "*arguments* is a tuple containing the parameters originally passed to the " "function call, this allows specializing the behavior on the arguments used." msgstr "" -#: ../../library/ctypes.rst:1712 +#: ../../library/ctypes.rst:1789 msgid "" "The object that this function returns will be returned from the foreign " "function call, but it can also check the result value and raise an exception " "if the foreign function call failed." msgstr "" -#: ../../library/ctypes.rst:1719 -msgid "" -"This exception is raised when a foreign function call cannot convert one of " -"the passed arguments." -msgstr "" - -#: ../../library/ctypes.rst:1723 ../../library/ctypes.rst:1725 +#: ../../library/ctypes.rst:1794 ../../library/ctypes.rst:1796 msgid "" "On Windows, when a foreign function call raises a system exception (for " "example, due to an access violation), it will be captured and replaced with " -"a suitable Python exception. Further, an auditing event ``ctypes." -"set_exception`` with argument ``code`` will be raised, allowing an audit " -"hook to replace the exception with its own." +"a suitable Python exception. Further, an auditing event " +"``ctypes.set_exception`` with argument ``code`` will be raised, allowing an " +"audit hook to replace the exception with its own." msgstr "" -#: ../../library/ctypes.rst:1731 ../../library/ctypes.rst:1733 +#: ../../library/ctypes.rst:1802 ../../library/ctypes.rst:1804 msgid "" -"Some ways to invoke foreign function calls may raise an auditing event " -"``ctypes.call_function`` with arguments ``function pointer`` and " -"``arguments``." +"Some ways to invoke foreign function calls as well as some of the functions " +"in this module may raise an auditing event ``ctypes.call_function`` with " +"arguments ``function pointer`` and ``arguments``." msgstr "" -#: ../../library/ctypes.rst:1739 +#: ../../library/ctypes.rst:1811 msgid "Function prototypes" msgstr "" -#: ../../library/ctypes.rst:1741 +#: ../../library/ctypes.rst:1813 msgid "" "Foreign functions can also be created by instantiating function prototypes. " "Function prototypes are similar to function prototypes in C; they describe a " @@ -3115,46 +3253,47 @@ msgid "" "``@wrapper`` syntax. See :ref:`ctypes-callback-functions` for examples." msgstr "" -#: ../../library/ctypes.rst:1752 +#: ../../library/ctypes.rst:1824 msgid "" "The returned function prototype creates functions that use the standard C " "calling convention. The function will release the GIL during the call. If " -"*use_errno* is set to true, the ctypes private copy of the system :data:" -"`errno` variable is exchanged with the real :data:`errno` value before and " -"after the call; *use_last_error* does the same for the Windows error code." +"*use_errno* is set to true, the ctypes private copy of the " +"system :data:`errno` variable is exchanged with the real :data:`errno` value " +"before and after the call; *use_last_error* does the same for the Windows " +"error code." msgstr "" -#: ../../library/ctypes.rst:1762 +#: ../../library/ctypes.rst:1834 msgid "" "The returned function prototype creates functions that use the ``stdcall`` " "calling convention. The function will release the GIL during the call. " "*use_errno* and *use_last_error* have the same meaning as above." msgstr "" -#: ../../library/ctypes.rst:1772 +#: ../../library/ctypes.rst:1844 msgid "" "The returned function prototype creates functions that use the Python " "calling convention. The function will *not* release the GIL during the call." msgstr "" -#: ../../library/ctypes.rst:1775 +#: ../../library/ctypes.rst:1847 msgid "" "Function prototypes created by these factory functions can be instantiated " "in different ways, depending on the type and number of the parameters in the " "call:" msgstr "" -#: ../../library/ctypes.rst:1782 +#: ../../library/ctypes.rst:1854 msgid "" "Returns a foreign function at the specified address which must be an integer." msgstr "" -#: ../../library/ctypes.rst:1789 +#: ../../library/ctypes.rst:1861 msgid "" "Create a C callable function (a callback function) from a Python *callable*." msgstr "" -#: ../../library/ctypes.rst:1796 +#: ../../library/ctypes.rst:1868 msgid "" "Returns a foreign function exported by a shared library. *func_spec* must be " "a 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the " @@ -3162,7 +3301,7 @@ msgid "" "small integer. The second item is the shared library instance." msgstr "" -#: ../../library/ctypes.rst:1806 +#: ../../library/ctypes.rst:1878 msgid "" "Returns a foreign function that will call a COM method. *vtbl_index* is the " "index into the virtual function table, a small non-negative integer. *name* " @@ -3170,79 +3309,86 @@ msgid "" "identifier which is used in extended error reporting." msgstr "" -#: ../../library/ctypes.rst:1811 +#: ../../library/ctypes.rst:1883 +msgid "" +"If *iid* is not specified, an :exc:`OSError` is raised if the COM method " +"call fails. If *iid* is specified, a :exc:`~ctypes.COMError` is raised " +"instead." +msgstr "" + +#: ../../library/ctypes.rst:1887 msgid "" "COM methods use a special calling convention: They require a pointer to the " "COM interface as first argument, in addition to those parameters that are " "specified in the :attr:`!argtypes` tuple." msgstr "" -#: ../../library/ctypes.rst:1815 +#: ../../library/ctypes.rst:1894 msgid "" "The optional *paramflags* parameter creates foreign function wrappers with " "much more functionality than the features described above." msgstr "" -#: ../../library/ctypes.rst:1818 +#: ../../library/ctypes.rst:1897 msgid "" -"*paramflags* must be a tuple of the same length as :attr:`~_CFuncPtr." -"argtypes`." +"*paramflags* must be a tuple of the same length " +"as :attr:`~_CFuncPtr.argtypes`." msgstr "" -#: ../../library/ctypes.rst:1820 +#: ../../library/ctypes.rst:1899 msgid "" "Each item in this tuple contains further information about a parameter, it " "must be a tuple containing one, two, or three items." msgstr "" -#: ../../library/ctypes.rst:1823 +#: ../../library/ctypes.rst:1902 msgid "" "The first item is an integer containing a combination of direction flags for " "the parameter:" msgstr "" -#: ../../library/ctypes.rst:1826 +#: ../../library/ctypes.rst:1905 msgid "1" msgstr "1" -#: ../../library/ctypes.rst:1827 +#: ../../library/ctypes.rst:1906 msgid "Specifies an input parameter to the function." msgstr "" -#: ../../library/ctypes.rst:1829 +#: ../../library/ctypes.rst:1908 msgid "2" msgstr "2" -#: ../../library/ctypes.rst:1830 +#: ../../library/ctypes.rst:1909 msgid "Output parameter. The foreign function fills in a value." msgstr "" -#: ../../library/ctypes.rst:1832 +#: ../../library/ctypes.rst:1911 msgid "4" msgstr "4" -#: ../../library/ctypes.rst:1833 +#: ../../library/ctypes.rst:1912 msgid "Input parameter which defaults to the integer zero." msgstr "" -#: ../../library/ctypes.rst:1835 +#: ../../library/ctypes.rst:1914 msgid "" "The optional second item is the parameter name as string. If this is " "specified, the foreign function can be called with named parameters." msgstr "" -#: ../../library/ctypes.rst:1838 +#: ../../library/ctypes.rst:1917 msgid "The optional third item is the default value for this parameter." msgstr "" -#: ../../library/ctypes.rst:1841 +#: ../../library/ctypes.rst:1920 msgid "" "The following example demonstrates how to wrap the Windows ``MessageBoxW`` " "function so that it supports default parameters and named arguments. The C " "declaration from the windows header file is this::" msgstr "" -#: ../../library/ctypes.rst:1845 +#: ../../library/ctypes.rst:1924 msgid "" "WINUSERAPI int WINAPI\n" "MessageBoxW(\n" @@ -3258,11 +3404,11 @@ msgstr "" " LPCWSTR lpCaption,\n" " UINT uType);" -#: ../../library/ctypes.rst:1852 ../../library/ctypes.rst:1875 +#: ../../library/ctypes.rst:1931 ../../library/ctypes.rst:1954 msgid "Here is the wrapping with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1854 +#: ../../library/ctypes.rst:1933 msgid "" ">>> from ctypes import c_int, WINFUNCTYPE, windll\n" ">>> from ctypes.wintypes import HWND, LPCWSTR, UINT\n" @@ -3278,11 +3424,11 @@ msgstr "" "\"Hello from ctypes\"), (1, \"flags\", 0)\n" ">>> MessageBox = prototype((\"MessageBoxW\", windll.user32), paramflags)" -#: ../../library/ctypes.rst:1860 +#: ../../library/ctypes.rst:1939 msgid "The ``MessageBox`` foreign function can now be called in these ways::" msgstr "" -#: ../../library/ctypes.rst:1862 +#: ../../library/ctypes.rst:1941 msgid "" ">>> MessageBox()\n" ">>> MessageBox(text=\"Spam, spam, spam\")\n" @@ -3292,7 +3438,7 @@ msgstr "" ">>> MessageBox(text=\"Spam, spam, spam\")\n" ">>> MessageBox(flags=2, text=\"foo bar\")" -#: ../../library/ctypes.rst:1866 +#: ../../library/ctypes.rst:1945 msgid "" "A second example demonstrates output parameters. The win32 " "``GetWindowRect`` function retrieves the dimensions of a specified window by " @@ -3300,7 +3446,7 @@ msgid "" "the C declaration::" msgstr "" -#: ../../library/ctypes.rst:1870 +#: ../../library/ctypes.rst:1949 msgid "" "WINUSERAPI BOOL WINAPI\n" "GetWindowRect(\n" @@ -3312,7 +3458,7 @@ msgstr "" " HWND hWnd,\n" " LPRECT lpRect);" -#: ../../library/ctypes.rst:1877 +#: ../../library/ctypes.rst:1956 msgid "" ">>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError\n" ">>> from ctypes.wintypes import BOOL, HWND, RECT\n" @@ -3330,7 +3476,7 @@ msgstr "" "paramflags)\n" ">>>" -#: ../../library/ctypes.rst:1884 +#: ../../library/ctypes.rst:1963 msgid "" "Functions with output parameters will automatically return the output " "parameter value if there is a single one, or a tuple containing the output " @@ -3338,7 +3484,7 @@ msgid "" "now returns a RECT instance, when called." msgstr "" -#: ../../library/ctypes.rst:1889 +#: ../../library/ctypes.rst:1968 msgid "" "Output parameters can be combined with the :attr:`~_CFuncPtr.errcheck` " "protocol to do further output processing and error checking. The win32 " @@ -3347,7 +3493,7 @@ msgid "" "exception when the api call failed::" msgstr "" -#: ../../library/ctypes.rst:1894 +#: ../../library/ctypes.rst:1973 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3365,7 +3511,7 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1902 +#: ../../library/ctypes.rst:1981 msgid "" "If the :attr:`~_CFuncPtr.errcheck` function returns the argument tuple it " "receives unchanged, :mod:`ctypes` continues the normal processing it does on " @@ -3374,7 +3520,7 @@ msgid "" "and return them instead, the normal processing will no longer take place::" msgstr "" -#: ../../library/ctypes.rst:1908 +#: ../../library/ctypes.rst:1987 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3394,52 +3540,72 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1921 +#: ../../library/ctypes.rst:2000 msgid "Utility functions" msgstr "" -#: ../../library/ctypes.rst:1925 +#: ../../library/ctypes.rst:2004 msgid "" "Returns the address of the memory buffer as integer. *obj* must be an " "instance of a ctypes type." msgstr "" -#: ../../library/ctypes.rst:1928 +#: ../../library/ctypes.rst:2007 msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." msgstr "" -"引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` ``ctypes." -"addressof``。" +"引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` " +"``ctypes.addressof``。" -#: ../../library/ctypes.rst:1933 +#: ../../library/ctypes.rst:2012 msgid "" "Returns the alignment requirements of a ctypes type. *obj_or_type* must be a " "ctypes type or instance." msgstr "" -#: ../../library/ctypes.rst:1939 +#: ../../library/ctypes.rst:2018 msgid "" "Returns a light-weight pointer to *obj*, which must be an instance of a " "ctypes type. *offset* defaults to zero, and must be an integer that will be " "added to the internal pointer value." msgstr "" -#: ../../library/ctypes.rst:1943 +#: ../../library/ctypes.rst:2022 msgid "``byref(obj, offset)`` corresponds to this C code::" msgstr "" -#: ../../library/ctypes.rst:1945 +#: ../../library/ctypes.rst:2024 msgid "(((char *)&obj) + offset)" msgstr "(((char *)&obj) + offset)" -#: ../../library/ctypes.rst:1947 +#: ../../library/ctypes.rst:2026 msgid "" "The returned object can only be used as a foreign function call parameter. " "It behaves similar to ``pointer(obj)``, but the construction is a lot faster." msgstr "" -#: ../../library/ctypes.rst:1953 +#: ../../library/ctypes.rst:2032 +msgid "" +"Copies a COM pointer from *src* to *dst* and returns the Windows " +"specific :c:type:`!HRESULT` value." +msgstr "" + +#: ../../library/ctypes.rst:2035 +msgid "" +"If *src* is not ``NULL``, its ``AddRef`` method is called, incrementing the " +"reference count." +msgstr "" + +#: ../../library/ctypes.rst:2038 +msgid "" +"In contrast, the reference count of *dst* will not be decremented before " +"assigning the new value. Unless *dst* is ``NULL``, the caller is responsible " +"for decrementing the reference count by calling its ``Release`` method when " +"necessary." +msgstr "" + +#: ../../library/ctypes.rst:2050 msgid "" "This function is similar to the cast operator in C. It returns a new " "instance of *type* which points to the same memory block as *obj*. *type* " @@ -3447,47 +3613,47 @@ msgid "" "as a pointer." msgstr "" -#: ../../library/ctypes.rst:1962 +#: ../../library/ctypes.rst:2059 msgid "" "This function creates a mutable character buffer. The returned object is a " "ctypes array of :class:`c_char`." msgstr "" -#: ../../library/ctypes.rst:1965 +#: ../../library/ctypes.rst:2062 msgid "" "If *size* is given (and not ``None``), it must be an :class:`int`. It " "specifies the size of the returned array." msgstr "" -#: ../../library/ctypes.rst:1968 +#: ../../library/ctypes.rst:2065 msgid "" "If the *init* argument is given, it must be :class:`bytes`. It is used to " "initialize the array items. Bytes not initialized this way are set to zero " "(NUL)." msgstr "" -#: ../../library/ctypes.rst:1972 +#: ../../library/ctypes.rst:2069 msgid "" "If *size* is not given (or if it is ``None``), the buffer is made one " "element larger than *init*, effectively adding a NUL terminator." msgstr "" -#: ../../library/ctypes.rst:1975 +#: ../../library/ctypes.rst:2072 msgid "" "If both arguments are given, *size* must not be less than ``len(init)``." msgstr "" -#: ../../library/ctypes.rst:1979 +#: ../../library/ctypes.rst:2076 msgid "" "If *size* is equal to ``len(init)``, a NUL terminator is not added. Do not " "treat such a buffer as a C string." msgstr "" -#: ../../library/ctypes.rst:1982 +#: ../../library/ctypes.rst:2079 msgid "For example::" msgstr "" -#: ../../library/ctypes.rst:1984 +#: ../../library/ctypes.rst:2081 msgid "" ">>> bytes(create_string_buffer(2))\n" "b'\\x00\\x00'\n" @@ -3503,7 +3669,7 @@ msgid "" "ValueError: byte string too long" msgstr "" -#: ../../library/ctypes.rst:1997 +#: ../../library/ctypes.rst:2094 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` " "with arguments ``init``, ``size``." @@ -3511,19 +3677,19 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_string_buffer``。" -#: ../../library/ctypes.rst:2003 +#: ../../library/ctypes.rst:2100 msgid "" "This function creates a mutable unicode character buffer. The returned " "object is a ctypes array of :class:`c_wchar`." msgstr "" -#: ../../library/ctypes.rst:2006 +#: ../../library/ctypes.rst:2103 msgid "" "The function takes the same arguments as :func:`~create_string_buffer` " "except *init* must be a string and *size* counts :class:`c_wchar`." msgstr "" -#: ../../library/ctypes.rst:2009 +#: ../../library/ctypes.rst:2106 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` " "with arguments ``init``, ``size``." @@ -3531,21 +3697,21 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_unicode_buffer``。" -#: ../../library/ctypes.rst:2014 +#: ../../library/ctypes.rst:2111 msgid "" "This function is a hook which allows implementing in-process COM servers " "with ctypes. It is called from the DllCanUnloadNow function that the " "_ctypes extension dll exports." msgstr "" -#: ../../library/ctypes.rst:2023 +#: ../../library/ctypes.rst:2120 msgid "" "This function is a hook which allows implementing in-process COM servers " "with ctypes. It is called from the DllGetClassObject function that the " "``_ctypes`` extension dll exports." msgstr "" -#: ../../library/ctypes.rst:2033 +#: ../../library/ctypes.rst:2130 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version " @@ -3553,94 +3719,117 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:2044 +#: ../../library/ctypes.rst:2141 msgid "" "Returns the filename of the VC runtime library used by Python, and by the " "extension modules. If the name of the library cannot be determined, " "``None`` is returned." msgstr "" -#: ../../library/ctypes.rst:2048 +#: ../../library/ctypes.rst:2145 msgid "" "If you need to free memory, for example, allocated by an extension module " "with a call to the ``free(void *)``, it is important that you use the " "function in the same library that allocated the memory." msgstr "" -#: ../../library/ctypes.rst:2057 +#: ../../library/ctypes.rst:2155 +msgid "" +"Try to provide a list of paths of the shared libraries loaded into the " +"current process. These paths are not normalized or processed in any way. " +"The function can raise :exc:`OSError` if the underlying platform APIs fail. " +"The exact functionality is system dependent." +msgstr "" + +#: ../../library/ctypes.rst:2160 +msgid "" +"On most platforms, the first element of the list represents the current " +"executable file. It may be an empty string." +msgstr "" + +#: ../../library/ctypes.rst:2168 msgid "" "Returns a textual description of the error code *code*. If no error code is " -"specified, the last error code is used by calling the Windows api function " -"GetLastError." +"specified, the last error code is used by calling the Windows API " +"function :func:`GetLastError`." msgstr "" -#: ../../library/ctypes.rst:2066 +#: ../../library/ctypes.rst:2177 msgid "" "Returns the last error code set by Windows in the calling thread. This " "function calls the Windows ``GetLastError()`` function directly, it does not " "return the ctypes-private copy of the error code." msgstr "" -#: ../../library/ctypes.rst:2075 +#: ../../library/ctypes.rst:2186 msgid "" -"Returns the current value of the ctypes-private copy of the system :data:" -"`errno` variable in the calling thread." +"Returns the current value of the ctypes-private copy of the " +"system :data:`errno` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2078 +#: ../../library/ctypes.rst:2189 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_errno``。" -#: ../../library/ctypes.rst:2082 +#: ../../library/ctypes.rst:2193 msgid "" "Returns the current value of the ctypes-private copy of the system :data:`!" "LastError` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2087 +#: ../../library/ctypes.rst:2198 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_last_error``。" -#: ../../library/ctypes.rst:2092 +#: ../../library/ctypes.rst:2203 msgid "" "Same as the standard C memmove library function: copies *count* bytes from " "*src* to *dst*. *dst* and *src* must be integers or ctypes instances that " "can be converted to pointers." msgstr "" -#: ../../library/ctypes.rst:2099 +#: ../../library/ctypes.rst:2210 msgid "" "Same as the standard C memset library function: fills the memory block at " "address *dst* with *count* bytes of value *c*. *dst* must be an integer " "specifying an address, or a ctypes instance." msgstr "" -#: ../../library/ctypes.rst:2106 +#: ../../library/ctypes.rst:2217 +msgid "" +"Create or return a ctypes pointer type. Pointer types are cached and reused " +"internally, so calling this function repeatedly is cheap. *type* must be a " +"ctypes type." +msgstr "" + +#: ../../library/ctypes.rst:2223 msgid "" -"Create and return a new ctypes pointer type. Pointer types are cached and " -"reused internally, so calling this function repeatedly is cheap. *type* must " -"be a ctypes type." +"The resulting pointer type is cached in the ``__pointer_type__`` attribute " +"of *type*. It is possible to set this attribute before the first call to " +"``POINTER`` in order to set a custom pointer type. However, doing this is " +"discouraged: manually creating a suitable pointer type is difficult without " +"relying on implementation details that may change in future Python versions." msgstr "" -#: ../../library/ctypes.rst:2113 +#: ../../library/ctypes.rst:2234 msgid "" "Create a new pointer instance, pointing to *obj*. The returned object is of " "the type ``POINTER(type(obj))``." msgstr "" -#: ../../library/ctypes.rst:2116 +#: ../../library/ctypes.rst:2237 msgid "" "Note: If you just want to pass a pointer to an object to a foreign function " "call, you should use ``byref(obj)`` which is much faster." msgstr "" -#: ../../library/ctypes.rst:2122 +#: ../../library/ctypes.rst:2243 msgid "" "This function resizes the internal memory buffer of *obj*, which must be an " "instance of a ctypes type. It is not possible to make the buffer smaller " @@ -3648,114 +3837,146 @@ msgid "" "but it is possible to enlarge the buffer." msgstr "" -#: ../../library/ctypes.rst:2130 +#: ../../library/ctypes.rst:2251 msgid "" "Set the current value of the ctypes-private copy of the system :data:`errno` " "variable in the calling thread to *value* and return the previous value." msgstr "" -#: ../../library/ctypes.rst:2133 +#: ../../library/ctypes.rst:2254 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." msgstr "" -"引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` ``ctypes." -"set_errno``。" +"引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` " +"``ctypes.set_errno``。" -#: ../../library/ctypes.rst:2138 +#: ../../library/ctypes.rst:2259 msgid "" "Sets the current value of the ctypes-private copy of the system :data:`!" "LastError` variable in the calling thread to *value* and return the previous " "value." msgstr "" -#: ../../library/ctypes.rst:2144 +#: ../../library/ctypes.rst:2265 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." msgstr "" -"引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` ``ctypes." -"set_last_error``。" +"引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` " +"``ctypes.set_last_error``。" -#: ../../library/ctypes.rst:2149 +#: ../../library/ctypes.rst:2270 msgid "" "Returns the size in bytes of a ctypes type or instance memory buffer. Does " "the same as the C ``sizeof`` operator." msgstr "" -#: ../../library/ctypes.rst:2155 +#: ../../library/ctypes.rst:2276 msgid "" "Return the byte string at *void \\*ptr*. If *size* is specified, it is used " "as size, otherwise the string is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2159 +#: ../../library/ctypes.rst:2280 msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " "arguments ``ptr``, ``size``." msgstr "" -"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." -"string_at``。" +"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` " +"``ctypes.string_at``。" -#: ../../library/ctypes.rst:2164 +#: ../../library/ctypes.rst:2285 msgid "" -"This function is probably the worst-named thing in ctypes. It creates an " -"instance of :exc:`OSError`. If *code* is not specified, ``GetLastError`` is " -"called to determine the error code. If *descr* is not specified, :func:" -"`FormatError` is called to get a textual description of the error." +"Creates an instance of :exc:`OSError`. If *code* is not " +"specified, :func:`GetLastError` is called to determine the error code. If " +"*descr* is not specified, :func:`FormatError` is called to get a textual " +"description of the error." msgstr "" -#: ../../library/ctypes.rst:2172 +#: ../../library/ctypes.rst:2292 msgid "" "An instance of :exc:`WindowsError` used to be created, which is now an alias " "of :exc:`OSError`." msgstr "" -#: ../../library/ctypes.rst:2179 +#: ../../library/ctypes.rst:2299 msgid "" "Return the wide-character string at *void \\*ptr*. If *size* is specified, " "it is used as the number of characters of the string, otherwise the string " "is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2184 +#: ../../library/ctypes.rst:2304 msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " "arguments ``ptr``, ``size``." msgstr "" -"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." -"wstring_at``。" +"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` " +"``ctypes.wstring_at``。" + +#: ../../library/ctypes.rst:2309 +msgid "" +"Return a :class:`memoryview` object of length *size* that references memory " +"starting at *void \\*ptr*." +msgstr "" + +#: ../../library/ctypes.rst:2312 +msgid "" +"If *readonly* is true, the returned :class:`!memoryview` object can not be " +"used to modify the underlying memory. (Changes made by other means will " +"still be reflected in the returned object.)" +msgstr "" + +#: ../../library/ctypes.rst:2317 +msgid "" +"This function is similar to :func:`string_at` with the key difference of not " +"making a copy of the specified memory. It is a semantically equivalent (but " +"more efficient) alternative to ``memoryview((c_byte * " +"size).from_address(ptr))``. (While :meth:`~_CData.from_address` only takes " +"integers, *ptr* can also be given as a :class:`ctypes.POINTER` or " +"a :func:`~ctypes.byref` object.)" +msgstr "" -#: ../../library/ctypes.rst:2190 +#: ../../library/ctypes.rst:2324 +#, fuzzy +msgid "" +"Raises an :ref:`auditing event ` ``ctypes.memoryview_at`` with " +"arguments ``address``, ``size``, ``readonly``." +msgstr "" +"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` " +"``ctypes.string_at``。" + +#: ../../library/ctypes.rst:2332 msgid "Data types" msgstr "" -#: ../../library/ctypes.rst:2195 +#: ../../library/ctypes.rst:2337 msgid "" "This non-public class is the common base class of all ctypes data types. " "Among other things, all ctypes type instances contain a memory block that " -"hold C compatible data; the address of the memory block is returned by the :" -"func:`addressof` helper function. Another instance variable is exposed as :" -"attr:`_objects`; this contains other Python objects that need to be kept " +"hold C compatible data; the address of the memory block is returned by " +"the :func:`addressof` helper function. Another instance variable is exposed " +"as :attr:`_objects`; this contains other Python objects that need to be kept " "alive in case the memory block contains pointers." msgstr "" -#: ../../library/ctypes.rst:2202 +#: ../../library/ctypes.rst:2344 msgid "" "Common methods of ctypes data types, these are all class methods (to be " "exact, they are methods of the :term:`metaclass`):" msgstr "" -#: ../../library/ctypes.rst:2207 +#: ../../library/ctypes.rst:2349 msgid "" "This method returns a ctypes instance that shares the buffer of the *source* " "object. The *source* object must support the writeable buffer interface. " "The optional *offset* parameter specifies an offset into the source buffer " -"in bytes; the default is zero. If the source buffer is not large enough a :" -"exc:`ValueError` is raised." +"in bytes; the default is zero. If the source buffer is not large enough " +"a :exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2213 ../../library/ctypes.rst:2223 +#: ../../library/ctypes.rst:2355 ../../library/ctypes.rst:2365 msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with " "arguments ``pointer``, ``size``, ``offset``." @@ -3763,7 +3984,7 @@ msgstr "" "引發一個附帶引數 ``pointer``、``size``、``offset`` 的\\ :ref:`稽核事件 " "` ``ctypes.cdata/buffer``。" -#: ../../library/ctypes.rst:2217 +#: ../../library/ctypes.rst:2359 msgid "" "This method creates a ctypes instance, copying the buffer from the *source* " "object buffer which must be readable. The optional *offset* parameter " @@ -3771,19 +3992,20 @@ msgid "" "If the source buffer is not large enough a :exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2227 +#: ../../library/ctypes.rst:2369 msgid "" "This method returns a ctypes type instance using the memory specified by " "*address* which must be an integer." msgstr "" -#: ../../library/ctypes.rst:2230 ../../library/ctypes.rst:2232 +#: ../../library/ctypes.rst:2372 ../../library/ctypes.rst:2374 msgid "" -"This method, and others that indirectly call this method, raises an :ref:" -"`auditing event ` ``ctypes.cdata`` with argument ``address``." +"This method, and others that indirectly call this method, raises " +"an :ref:`auditing event ` ``ctypes.cdata`` with argument " +"``address``." msgstr "" -#: ../../library/ctypes.rst:2238 +#: ../../library/ctypes.rst:2380 msgid "" "This method adapts *obj* to a ctypes type. It is called with the actual " "object used in a foreign function call when the type is present in the " @@ -3791,39 +4013,50 @@ msgid "" "object that can be used as a function call parameter." msgstr "" -#: ../../library/ctypes.rst:2243 +#: ../../library/ctypes.rst:2385 msgid "" "All ctypes data types have a default implementation of this classmethod that " "normally returns *obj* if that is an instance of the type. Some types " "accept other objects as well." msgstr "" -#: ../../library/ctypes.rst:2249 +#: ../../library/ctypes.rst:2391 msgid "" "This method returns a ctypes type instance exported by a shared library. " "*name* is the name of the symbol that exports the data, *library* is the " "loaded shared library." msgstr "" -#: ../../library/ctypes.rst:2253 +#: ../../library/ctypes.rst:2395 +msgid "Common class variables of ctypes data types:" +msgstr "" + +#: ../../library/ctypes.rst:2399 +msgid "" +"The pointer type that was created by calling :func:`POINTER` for " +"corresponding ctypes data type. If a pointer type was not yet created, the " +"attribute is missing." +msgstr "" + +#: ../../library/ctypes.rst:2405 msgid "Common instance variables of ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2257 +#: ../../library/ctypes.rst:2409 msgid "" "Sometimes ctypes data instances do not own the memory block they contain, " -"instead they share part of the memory block of a base object. The :attr:" -"`_b_base_` read-only member is the root ctypes object that owns the memory " -"block." +"instead they share part of the memory block of a base object. " +"The :attr:`_b_base_` read-only member is the root ctypes object that owns " +"the memory block." msgstr "" -#: ../../library/ctypes.rst:2264 +#: ../../library/ctypes.rst:2416 msgid "" "This read-only variable is true when the ctypes data instance has allocated " "the memory block itself, false otherwise." msgstr "" -#: ../../library/ctypes.rst:2269 +#: ../../library/ctypes.rst:2421 msgid "" "This member is either ``None`` or a dictionary containing Python objects " "that need to be kept alive so that the memory block contents is kept valid. " @@ -3831,20 +4064,20 @@ msgid "" "dictionary." msgstr "" -#: ../../library/ctypes.rst:2282 +#: ../../library/ctypes.rst:2434 msgid "" "This non-public class is the base class of all fundamental ctypes data " "types. It is mentioned here because it contains the common attributes of the " -"fundamental ctypes data types. :class:`_SimpleCData` is a subclass of :" -"class:`_CData`, so it inherits their methods and attributes. ctypes data " +"fundamental ctypes data types. :class:`_SimpleCData` is a subclass " +"of :class:`_CData`, so it inherits their methods and attributes. ctypes data " "types that are not and do not contain pointers can now be pickled." msgstr "" -#: ../../library/ctypes.rst:2288 +#: ../../library/ctypes.rst:2440 msgid "Instances have a single attribute:" msgstr "" -#: ../../library/ctypes.rst:2292 +#: ../../library/ctypes.rst:2444 msgid "" "This attribute contains the actual value of the instance. For integer and " "pointer types, it is an integer, for character types, it is a single " @@ -3852,7 +4085,7 @@ msgid "" "bytes object or string." msgstr "" -#: ../../library/ctypes.rst:2297 +#: ../../library/ctypes.rst:2449 msgid "" "When the ``value`` attribute is retrieved from a ctypes instance, usually a " "new object is returned each time. :mod:`ctypes` does *not* implement " @@ -3860,7 +4093,7 @@ msgid "" "true for all other ctypes object instances." msgstr "" -#: ../../library/ctypes.rst:2303 +#: ../../library/ctypes.rst:2455 msgid "" "Fundamental data types, when returned as foreign function call results, or, " "for example, by retrieving structure field members or array items, are " @@ -3870,7 +4103,7 @@ msgid "" "instance." msgstr "" -#: ../../library/ctypes.rst:2311 +#: ../../library/ctypes.rst:2463 msgid "" "Subclasses of fundamental data types do *not* inherit this behavior. So, if " "a foreign functions :attr:`!restype` is a subclass of :class:`c_void_p`, you " @@ -3878,25 +4111,25 @@ msgid "" "you can get the value of the pointer by accessing the ``value`` attribute." msgstr "" -#: ../../library/ctypes.rst:2316 +#: ../../library/ctypes.rst:2468 msgid "These are the fundamental ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2320 +#: ../../library/ctypes.rst:2472 msgid "" "Represents the C :c:expr:`signed char` datatype, and interprets the value as " "small integer. The constructor accepts an optional integer initializer; no " "overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2327 +#: ../../library/ctypes.rst:2479 msgid "" "Represents the C :c:expr:`char` datatype, and interprets the value as a " "single character. The constructor accepts an optional string initializer, " "the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2334 +#: ../../library/ctypes.rst:2486 msgid "" "Represents the C :c:expr:`char *` datatype when it points to a zero-" "terminated string. For a general character pointer that may also point to " @@ -3904,259 +4137,287 @@ msgid "" "integer address, or a bytes object." msgstr "" -#: ../../library/ctypes.rst:2342 +#: ../../library/ctypes.rst:2494 msgid "" "Represents the C :c:expr:`double` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2348 +#: ../../library/ctypes.rst:2500 msgid "" "Represents the C :c:expr:`long double` datatype. The constructor accepts an " "optional float initializer. On platforms where ``sizeof(long double) == " "sizeof(double)`` it is an alias to :class:`c_double`." msgstr "" -#: ../../library/ctypes.rst:2354 +#: ../../library/ctypes.rst:2506 msgid "" "Represents the C :c:expr:`float` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2360 +#: ../../library/ctypes.rst:2512 +msgid "" +"Represents the C :c:expr:`double complex` datatype, if available. The " +"constructor accepts an optional :class:`complex` initializer." +msgstr "" + +#: ../../library/ctypes.rst:2520 +msgid "" +"Represents the C :c:expr:`float complex` datatype, if available. The " +"constructor accepts an optional :class:`complex` initializer." +msgstr "" + +#: ../../library/ctypes.rst:2528 +msgid "" +"Represents the C :c:expr:`long double complex` datatype, if available. The " +"constructor accepts an optional :class:`complex` initializer." +msgstr "" + +#: ../../library/ctypes.rst:2536 msgid "" "Represents the C :c:expr:`signed int` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`." msgstr "" -#: ../../library/ctypes.rst:2367 +#: ../../library/ctypes.rst:2543 msgid "" -"Represents the C 8-bit :c:expr:`signed int` datatype. It is an alias for :" -"class:`c_byte`." +"Represents the C 8-bit :c:expr:`signed int` datatype. It is an alias " +"for :class:`c_byte`." msgstr "" -#: ../../library/ctypes.rst:2373 +#: ../../library/ctypes.rst:2549 msgid "" "Represents the C 16-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_short`." msgstr "" -#: ../../library/ctypes.rst:2379 +#: ../../library/ctypes.rst:2555 msgid "" "Represents the C 32-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_int`." msgstr "" -#: ../../library/ctypes.rst:2385 +#: ../../library/ctypes.rst:2561 msgid "" "Represents the C 64-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_longlong`." msgstr "" -#: ../../library/ctypes.rst:2391 +#: ../../library/ctypes.rst:2567 msgid "" "Represents the C :c:expr:`signed long` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2397 +#: ../../library/ctypes.rst:2573 msgid "" "Represents the C :c:expr:`signed long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2403 +#: ../../library/ctypes.rst:2579 msgid "" "Represents the C :c:expr:`signed short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2409 +#: ../../library/ctypes.rst:2585 msgid "Represents the C :c:type:`size_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2414 +#: ../../library/ctypes.rst:2590 msgid "Represents the C :c:type:`ssize_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2421 +#: ../../library/ctypes.rst:2597 msgid "Represents the C :c:type:`time_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2428 +#: ../../library/ctypes.rst:2604 msgid "" "Represents the C :c:expr:`unsigned char` datatype, it interprets the value " "as small integer. The constructor accepts an optional integer initializer; " "no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2435 +#: ../../library/ctypes.rst:2611 msgid "" "Represents the C :c:expr:`unsigned int` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`." msgstr "" -#: ../../library/ctypes.rst:2442 +#: ../../library/ctypes.rst:2618 msgid "" -"Represents the C 8-bit :c:expr:`unsigned int` datatype. It is an alias for :" -"class:`c_ubyte`." +"Represents the C 8-bit :c:expr:`unsigned int` datatype. It is an alias " +"for :class:`c_ubyte`." msgstr "" -#: ../../library/ctypes.rst:2448 +#: ../../library/ctypes.rst:2624 msgid "" "Represents the C 16-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ushort`." msgstr "" -#: ../../library/ctypes.rst:2454 +#: ../../library/ctypes.rst:2630 msgid "" "Represents the C 32-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_uint`." msgstr "" -#: ../../library/ctypes.rst:2460 +#: ../../library/ctypes.rst:2636 msgid "" "Represents the C 64-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ulonglong`." msgstr "" -#: ../../library/ctypes.rst:2466 +#: ../../library/ctypes.rst:2642 msgid "" "Represents the C :c:expr:`unsigned long` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2472 +#: ../../library/ctypes.rst:2648 msgid "" "Represents the C :c:expr:`unsigned long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2478 +#: ../../library/ctypes.rst:2654 msgid "" "Represents the C :c:expr:`unsigned short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2484 +#: ../../library/ctypes.rst:2660 msgid "" "Represents the C :c:expr:`void *` type. The value is represented as " "integer. The constructor accepts an optional integer initializer." msgstr "" -#: ../../library/ctypes.rst:2490 +#: ../../library/ctypes.rst:2666 msgid "" "Represents the C :c:type:`wchar_t` datatype, and interprets the value as a " "single character unicode string. The constructor accepts an optional string " "initializer, the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2497 +#: ../../library/ctypes.rst:2673 msgid "" "Represents the C :c:expr:`wchar_t *` datatype, which must be a pointer to a " "zero-terminated wide character string. The constructor accepts an integer " "address, or a string." msgstr "" -#: ../../library/ctypes.rst:2504 +#: ../../library/ctypes.rst:2680 msgid "" "Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` " "from C99). Its value can be ``True`` or ``False``, and the constructor " "accepts any object that has a truth value." msgstr "" -#: ../../library/ctypes.rst:2511 +#: ../../library/ctypes.rst:2687 msgid "" "Represents a :c:type:`!HRESULT` value, which contains success or error " "information for a function or method call." msgstr "" -#: ../../library/ctypes.rst:2519 +#: ../../library/ctypes.rst:2695 msgid "" "Represents the C :c:expr:`PyObject *` datatype. Calling this without an " "argument creates a ``NULL`` :c:expr:`PyObject *` pointer." msgstr "" -#: ../../library/ctypes.rst:2522 +#: ../../library/ctypes.rst:2698 +msgid ":class:`!py_object` is now a :term:`generic type`." +msgstr "" + +#: ../../library/ctypes.rst:2701 msgid "" "The :mod:`!ctypes.wintypes` module provides quite some other Windows " -"specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:" -"type:`!DWORD`. Some useful structures like :c:type:`!MSG` or :c:type:`!RECT` " -"are also defined." +"specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, " +"or :c:type:`!DWORD`. Some useful structures like :c:type:`!MSG` or :c:type:`!" +"RECT` are also defined." msgstr "" -#: ../../library/ctypes.rst:2530 +#: ../../library/ctypes.rst:2709 msgid "Structured data types" msgstr "" -#: ../../library/ctypes.rst:2535 +#: ../../library/ctypes.rst:2714 msgid "Abstract base class for unions in native byte order." msgstr "" -#: ../../library/ctypes.rst:2540 +#: ../../library/ctypes.rst:2716 +msgid "" +"Unions share common attributes and behavior with structures; " +"see :class:`Structure` documentation for details." +msgstr "" + +#: ../../library/ctypes.rst:2721 msgid "Abstract base class for unions in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2546 +#: ../../library/ctypes.rst:2727 msgid "Abstract base class for unions in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2552 +#: ../../library/ctypes.rst:2733 msgid "Abstract base class for structures in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2557 +#: ../../library/ctypes.rst:2738 msgid "Abstract base class for structures in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2559 +#: ../../library/ctypes.rst:2740 msgid "" "Structures and unions with non-native byte order cannot contain pointer type " "fields, or any other data types containing pointer type fields." msgstr "" -#: ../../library/ctypes.rst:2565 +#: ../../library/ctypes.rst:2746 msgid "Abstract base class for structures in *native* byte order." msgstr "" -#: ../../library/ctypes.rst:2567 +#: ../../library/ctypes.rst:2748 msgid "" "Concrete structure and union types must be created by subclassing one of " -"these types, and at least define a :attr:`_fields_` class variable. :mod:" -"`ctypes` will create :term:`descriptor`\\s which allow reading and writing " -"the fields by direct attribute accesses. These are the" +"these types, and at least define a :attr:`_fields_` class " +"variable. :mod:`ctypes` will create :term:`descriptor`\\s which allow " +"reading and writing the fields by direct attribute accesses. These are the" msgstr "" -#: ../../library/ctypes.rst:2575 +#: ../../library/ctypes.rst:2756 msgid "" "A sequence defining the structure fields. The items must be 2-tuples or 3-" "tuples. The first item is the name of the field, the second item specifies " "the type of the field; it can be any ctypes data type." msgstr "" -#: ../../library/ctypes.rst:2579 +#: ../../library/ctypes.rst:2760 msgid "" "For integer type fields like :class:`c_int`, a third optional item can be " "given. It must be a small positive integer defining the bit width of the " "field." msgstr "" -#: ../../library/ctypes.rst:2583 +#: ../../library/ctypes.rst:2764 msgid "" "Field names must be unique within one structure or union. This is not " "checked, only one field can be accessed when names are repeated." msgstr "" -#: ../../library/ctypes.rst:2586 +#: ../../library/ctypes.rst:2767 msgid "" "It is possible to define the :attr:`_fields_` class variable *after* the " "class statement that defines the Structure subclass, this allows creating " "data types that directly or indirectly reference themselves::" msgstr "" -#: ../../library/ctypes.rst:2590 +#: ../../library/ctypes.rst:2771 msgid "" "class List(Structure):\n" " pass\n" @@ -4170,56 +4431,122 @@ msgstr "" " ...\n" " ]" -#: ../../library/ctypes.rst:2596 +#: ../../library/ctypes.rst:2777 +msgid "" +"The :attr:`!_fields_` class variable can only be set once. Later assignments " +"will raise an :exc:`AttributeError`." +msgstr "" + +#: ../../library/ctypes.rst:2780 msgid "" -"The :attr:`_fields_` class variable must, however, be defined before the " -"type is first used (an instance is created, :func:`sizeof` is called on it, " -"and so on). Later assignments to the :attr:`_fields_` class variable will " -"raise an AttributeError." +"Additionally, the :attr:`!_fields_` class variable must be defined before " +"the structure or union type is first used: an instance or subclass is " +"created, :func:`sizeof` is called on it, and so on. Later assignments " +"to :attr:`!_fields_` will raise an :exc:`AttributeError`. If :attr:`!" +"_fields_` has not been set before such use, the structure or union will have " +"no own fields, as if :attr:`!_fields_` was empty." msgstr "" -#: ../../library/ctypes.rst:2601 +#: ../../library/ctypes.rst:2788 msgid "" -"It is possible to define sub-subclasses of structure types, they inherit the " -"fields of the base class plus the :attr:`_fields_` defined in the sub-" -"subclass, if any." +"Sub-subclasses of structure types inherit the fields of the base class plus " +"the :attr:`_fields_` defined in the sub-subclass, if any." msgstr "" -#: ../../library/ctypes.rst:2608 +#: ../../library/ctypes.rst:2794 msgid "" "An optional small integer that allows overriding the alignment of structure " -"fields in the instance. :attr:`_pack_` must already be defined when :attr:" -"`_fields_` is assigned, otherwise it will have no effect. Setting this " -"attribute to 0 is the same as not setting it at all." +"fields in the instance. :attr:`_pack_` must already be defined " +"when :attr:`_fields_` is assigned, otherwise it will have no effect. Setting " +"this attribute to 0 is the same as not setting it at all." msgstr "" -#: ../../library/ctypes.rst:2616 +#: ../../library/ctypes.rst:2799 +msgid "This is only implemented for the MSVC-compatible memory layout." +msgstr "" + +#: ../../library/ctypes.rst:2803 +msgid "" +"For historical reasons, if :attr:`!_pack_` is non-zero, the MSVC-compatible " +"layout will be used by default. On non-Windows platforms, this default is " +"deprecated and is slated to become an error in Python 3.19. If it is " +"intended, set :attr:`~Structure._layout_` to ``'ms'`` explicitly." +msgstr "" + +#: ../../library/ctypes.rst:2812 msgid "" "An optional small integer that allows overriding the alignment of the " "structure when being packed or unpacked to/from memory. Setting this " "attribute to 0 is the same as not setting it at all." msgstr "" -#: ../../library/ctypes.rst:2624 +#: ../../library/ctypes.rst:2820 +msgid "" +"An optional string naming the struct/union layout. It can currently be set " +"to:" +msgstr "" + +#: ../../library/ctypes.rst:2823 +msgid "" +"``\"ms\"``: the layout used by the Microsoft compiler (MSVC). On GCC and " +"Clang, this layout can be selected with ``__attribute__((ms_struct))``." +msgstr "" + +#: ../../library/ctypes.rst:2826 +msgid "" +"``\"gcc-sysv\"``: the layout used by GCC with the System V or “SysV-like” " +"data model, as used on Linux and macOS. With this " +"layout, :attr:`~Structure._pack_` must be unset or zero." +msgstr "" + +#: ../../library/ctypes.rst:2830 +msgid "" +"If not set explicitly, ``ctypes`` will use a default that matches the " +"platform conventions. This default may change in future Python releases (for " +"example, when a new platform gains official support, or when a difference " +"between similar platforms is found). Currently the default will be:" +msgstr "" + +#: ../../library/ctypes.rst:2836 +msgid "On Windows: ``\"ms\"``" +msgstr "" + +#: ../../library/ctypes.rst:2837 +msgid "" +"When :attr:`~Structure._pack_` is specified: ``\"ms\"``. (This is " +"deprecated; see :attr:`~Structure._pack_` documentation.)" +msgstr "" + +#: ../../library/ctypes.rst:2839 +msgid "Otherwise: ``\"gcc-sysv\"``" +msgstr "" + +#: ../../library/ctypes.rst:2841 msgid "" -"An optional sequence that lists the names of unnamed (anonymous) fields. :" -"attr:`_anonymous_` must be already defined when :attr:`_fields_` is " +":attr:`!_layout_` must already be defined when :attr:`~Structure._fields_` " +"is assigned, otherwise it will have no effect." +msgstr "" + +#: ../../library/ctypes.rst:2848 +msgid "" +"An optional sequence that lists the names of unnamed (anonymous) " +"fields. :attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" -#: ../../library/ctypes.rst:2628 +#: ../../library/ctypes.rst:2852 msgid "" -"The fields listed in this variable must be structure or union type fields. :" -"mod:`ctypes` will create descriptors in the structure type that allows " -"accessing the nested fields directly, without the need to create the " +"The fields listed in this variable must be structure or union type " +"fields. :mod:`ctypes` will create descriptors in the structure type that " +"allows accessing the nested fields directly, without the need to create the " "structure or union field." msgstr "" -#: ../../library/ctypes.rst:2633 +#: ../../library/ctypes.rst:2857 msgid "Here is an example type (Windows)::" msgstr "" -#: ../../library/ctypes.rst:2635 +#: ../../library/ctypes.rst:2859 msgid "" "class _U(Union):\n" " _fields_ = [(\"lptdesc\", POINTER(TYPEDESC)),\n" @@ -4241,7 +4568,7 @@ msgstr "" " _fields_ = [(\"u\", _U),\n" " (\"vt\", VARTYPE)]" -#: ../../library/ctypes.rst:2646 +#: ../../library/ctypes.rst:2870 msgid "" "The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field " "specifies which one of the union fields is valid. Since the ``u`` field is " @@ -4251,7 +4578,7 @@ msgid "" "temporary union instance::" msgstr "" -#: ../../library/ctypes.rst:2653 +#: ../../library/ctypes.rst:2877 msgid "" "td = TYPEDESC()\n" "td.vt = VT_PTR\n" @@ -4263,15 +4590,15 @@ msgstr "" "td.lptdesc = POINTER(some_type)\n" "td.u.lptdesc = POINTER(some_type)" -#: ../../library/ctypes.rst:2658 +#: ../../library/ctypes.rst:2882 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " -"fields of the base class. If the subclass definition has a separate :attr:" -"`_fields_` variable, the fields specified in this are appended to the fields " -"of the base class." +"fields of the base class. If the subclass definition has a " +"separate :attr:`_fields_` variable, the fields specified in this are " +"appended to the fields of the base class." msgstr "" -#: ../../library/ctypes.rst:2663 +#: ../../library/ctypes.rst:2887 msgid "" "Structure and union constructors accept both positional and keyword " "arguments. Positional arguments are used to initialize member fields in the " @@ -4281,78 +4608,228 @@ msgid "" "names not present in :attr:`_fields_`." msgstr "" -#: ../../library/ctypes.rst:2674 +#: ../../library/ctypes.rst:2897 +msgid "" +"Descriptor for fields of a :class:`Structure` and :class:`Union`. For " +"example::" +msgstr "" + +#: ../../library/ctypes.rst:2900 +msgid "" +">>> class Color(Structure):\n" +"... _fields_ = (\n" +"... ('red', c_uint8),\n" +"... ('green', c_uint8),\n" +"... ('blue', c_uint8),\n" +"... ('intense', c_bool, 1),\n" +"... ('blinking', c_bool, 1),\n" +"... )\n" +"...\n" +">>> Color.red\n" +"\n" +">>> Color.green.type\n" +"\n" +">>> Color.blue.byte_offset\n" +"2\n" +">>> Color.intense\n" +"\n" +">>> Color.blinking.bit_offset\n" +"1" +msgstr "" + +#: ../../library/ctypes.rst:2920 +msgid "All attributes are read-only." +msgstr "" + +#: ../../library/ctypes.rst:2922 +msgid "" +":class:`!CField` objects are created via :attr:`~Structure._fields_`; do not " +"instantiate the class directly." +msgstr "" + +#: ../../library/ctypes.rst:2927 +msgid "" +"Previously, descriptors only had ``offset`` and ``size`` attributes and a " +"readable string representation; the :class:`!CField` class was not available " +"directly." +msgstr "" + +#: ../../library/ctypes.rst:2933 +msgid "Name of the field, as a string." +msgstr "" + +#: ../../library/ctypes.rst:2937 +msgid "Type of the field, as a :ref:`ctypes class `." +msgstr "" + +#: ../../library/ctypes.rst:2942 +msgid "Offset of the field, in bytes." +msgstr "" + +#: ../../library/ctypes.rst:2944 +msgid "" +"For bitfields, this is the offset of the underlying byte-aligned *storage " +"unit*; see :attr:`~CField.bit_offset`." +msgstr "" + +#: ../../library/ctypes.rst:2949 +msgid "Size of the field, in bytes." +msgstr "" + +#: ../../library/ctypes.rst:2951 +msgid "" +"For bitfields, this is the size of the underlying *storage unit*. Typically, " +"it has the same size as the bitfield's type." +msgstr "" + +#: ../../library/ctypes.rst:2956 +msgid "For non-bitfields, equivalent to :attr:`~CField.byte_size`." +msgstr "" + +#: ../../library/ctypes.rst:2958 +msgid "" +"For bitfields, this contains a backwards-compatible bit-packed value that " +"combines :attr:`~CField.bit_size` and :attr:`~CField.bit_offset`. Prefer " +"using the explicit attributes instead." +msgstr "" + +#: ../../library/ctypes.rst:2965 +msgid "True if this is a bitfield." +msgstr "" + +#: ../../library/ctypes.rst:2970 +msgid "" +"The location of a bitfield within its *storage unit*, that is, " +"within :attr:`~CField.byte_size` bytes of memory starting " +"at :attr:`~CField.byte_offset`." +msgstr "" + +#: ../../library/ctypes.rst:2974 +msgid "" +"To get the field's value, read the storage unit as an integer, :ref:`shift " +"left ` by :attr:`!bit_offset` and take the :attr:`!bit_size` least " +"significant bits." +msgstr "" + +#: ../../library/ctypes.rst:2978 +msgid "" +"For non-bitfields, :attr:`!bit_offset` is zero and :attr:`!bit_size` is " +"equal to ``byte_size * 8``." +msgstr "" + +#: ../../library/ctypes.rst:2983 +msgid "" +"True if this field is anonymous, that is, it contains nested sub-fields that " +"should be merged into a containing structure or union." +msgstr "" + +#: ../../library/ctypes.rst:2990 msgid "Arrays and pointers" msgstr "" -#: ../../library/ctypes.rst:2678 +#: ../../library/ctypes.rst:2994 msgid "Abstract base class for arrays." msgstr "" -#: ../../library/ctypes.rst:2680 +#: ../../library/ctypes.rst:2996 msgid "" -"The recommended way to create concrete array types is by multiplying any :" -"mod:`ctypes` data type with a non-negative integer. Alternatively, you can " -"subclass this type and define :attr:`_length_` and :attr:`_type_` class " +"The recommended way to create concrete array types is by multiplying " +"any :mod:`ctypes` data type with a non-negative integer. Alternatively, you " +"can subclass this type and define :attr:`_length_` and :attr:`_type_` class " "variables. Array elements can be read and written using standard subscript " "and slice accesses; for slice reads, the resulting object is *not* itself " "an :class:`Array`." msgstr "" -#: ../../library/ctypes.rst:2690 +#: ../../library/ctypes.rst:3006 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" -"range subscripts result in an :exc:`IndexError`. Will be returned by :func:" -"`len`." +"range subscripts result in an :exc:`IndexError`. Will be returned " +"by :func:`len`." msgstr "" -#: ../../library/ctypes.rst:2697 +#: ../../library/ctypes.rst:3013 msgid "Specifies the type of each element in the array." msgstr "" -#: ../../library/ctypes.rst:2700 +#: ../../library/ctypes.rst:3016 msgid "" "Array subclass constructors accept positional arguments, used to initialize " "the elements in order." msgstr "" -#: ../../library/ctypes.rst:2705 +#: ../../library/ctypes.rst:3021 msgid "" -"Create an array. Equivalent to ``type * length``, where *type* is a :mod:" -"`ctypes` data type and *length* an integer." +"Create an array. Equivalent to ``type * length``, where *type* is " +"a :mod:`ctypes` data type and *length* an integer." msgstr "" -#: ../../library/ctypes.rst:2709 +#: ../../library/ctypes.rst:3025 msgid "" "This function is :term:`soft deprecated` in favor of multiplication. There " "are no plans to remove it." msgstr "" -#: ../../library/ctypes.rst:2715 +#: ../../library/ctypes.rst:3031 msgid "Private, abstract base class for pointers." msgstr "" -#: ../../library/ctypes.rst:2717 +#: ../../library/ctypes.rst:3033 msgid "" "Concrete pointer types are created by calling :func:`POINTER` with the type " "that will be pointed to; this is done automatically by :func:`pointer`." msgstr "" -#: ../../library/ctypes.rst:2721 +#: ../../library/ctypes.rst:3037 msgid "" "If a pointer points to an array, its elements can be read and written using " -"standard subscript and slice accesses. Pointer objects have no size, so :" -"func:`len` will raise :exc:`TypeError`. Negative subscripts will read from " -"the memory *before* the pointer (as in C), and out-of-range subscripts will " -"probably crash with an access violation (if you're lucky)." +"standard subscript and slice accesses. Pointer objects have no size, " +"so :func:`len` will raise :exc:`TypeError`. Negative subscripts will read " +"from the memory *before* the pointer (as in C), and out-of-range subscripts " +"will probably crash with an access violation (if you're lucky)." msgstr "" -#: ../../library/ctypes.rst:2731 +#: ../../library/ctypes.rst:3047 msgid "Specifies the type pointed to." msgstr "" -#: ../../library/ctypes.rst:2735 +#: ../../library/ctypes.rst:3051 msgid "" "Returns the object to which to pointer points. Assigning to this attribute " "changes the pointer to point to the assigned object." msgstr "" + +#: ../../library/ctypes.rst:3058 +msgid "Exceptions" +msgstr "" + +#: ../../library/ctypes.rst:3062 +msgid "" +"This exception is raised when a foreign function call cannot convert one of " +"the passed arguments." +msgstr "" + +#: ../../library/ctypes.rst:3068 +msgid "This exception is raised when a COM method call failed." +msgstr "" + +#: ../../library/ctypes.rst:3072 +msgid "The integer value representing the error code." +msgstr "" + +#: ../../library/ctypes.rst:3076 +msgid "The error message." +msgstr "" + +#: ../../library/ctypes.rst:3080 +msgid "The 5-tuple ``(descr, source, helpfile, helpcontext, progid)``." +msgstr "" + +#: ../../library/ctypes.rst:3082 +msgid "" +"*descr* is the textual description. *source* is the language-dependent " +"``ProgID`` for the class or application that raised the error. *helpfile* " +"is the path of the help file. *helpcontext* is the help context " +"identifier. *progid* is the ``ProgID`` of the interface that defined the " +"error." +msgstr "" diff --git a/library/curses.po b/library/curses.po index 6983ffd45cc..1f8c07299e4 100644 --- a/library/curses.po +++ b/library/curses.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-04 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -127,23 +127,41 @@ msgstr ":mod:`curses` 模組定義了以下函式:" #: ../../library/curses.rst:73 msgid "" +"Allow use of default values for colors on terminals supporting this feature. " +"Use this to support transparency in your application." +msgstr "" + +#: ../../library/curses.rst:76 +msgid "" +"Assign terminal default foreground/background colors to color number ``-1``. " +"So ``init_pair(x, COLOR_RED, -1)`` will initialize pair *x* as red on " +"default background and ``init_pair(x, -1, COLOR_BLUE)`` will initialize pair " +"*x* as default foreground on blue." +msgstr "" + +#: ../../library/curses.rst:81 +msgid "Change the definition of the color-pair ``0`` to ``(fg, bg)``." +msgstr "" + +#: ../../library/curses.rst:88 +msgid "" "Return the output speed of the terminal in bits per second. On software " "terminal emulators it will have a fixed high value. Included for historical " "reasons; in former times, it was used to write output loops for time delays " "and occasionally to change interfaces depending on the line speed." msgstr "" -#: ../../library/curses.rst:81 +#: ../../library/curses.rst:96 msgid "Emit a short attention sound." msgstr "" -#: ../../library/curses.rst:86 +#: ../../library/curses.rst:101 msgid "" "Return ``True`` or ``False``, depending on whether the programmer can change " "the colors displayed by the terminal." msgstr "" -#: ../../library/curses.rst:92 +#: ../../library/curses.rst:107 msgid "" "Enter cbreak mode. In cbreak mode (sometimes called \"rare\" mode) normal " "tty line buffering is turned off and characters are available to be read one " @@ -153,7 +171,7 @@ msgid "" "terminal in cbreak mode." msgstr "" -#: ../../library/curses.rst:101 +#: ../../library/curses.rst:116 msgid "" "Return the intensity of the red, green, and blue (RGB) components in the " "color *color_number*, which must be between ``0`` and ``COLORS - 1``. " @@ -162,16 +180,16 @@ msgid "" "component)." msgstr "" -#: ../../library/curses.rst:109 +#: ../../library/curses.rst:124 msgid "" "Return the attribute value for displaying text in the specified color pair. " "Only the first 256 color pairs are supported. This attribute value can be " -"combined with :const:`A_STANDOUT`, :const:`A_REVERSE`, and the other :const:" -"`!A_\\*` attributes. :func:`pair_number` is the counterpart to this " -"function." +"combined with :const:`A_STANDOUT`, :const:`A_REVERSE`, and the " +"other :const:`!A_\\*` attributes. :func:`pair_number` is the counterpart to " +"this function." msgstr "" -#: ../../library/curses.rst:118 +#: ../../library/curses.rst:133 msgid "" "Set the cursor state. *visibility* can be set to ``0``, ``1``, or ``2``, " "for invisible, normal, or very visible. If the terminal supports the " @@ -180,27 +198,27 @@ msgid "" "and the \"very visible\" mode is a block cursor." msgstr "" -#: ../../library/curses.rst:127 +#: ../../library/curses.rst:142 msgid "" "Save the current terminal mode as the \"program\" mode, the mode when the " "running program is using curses. (Its counterpart is the \"shell\" mode, " -"for when the program is not in curses.) Subsequent calls to :func:" -"`reset_prog_mode` will restore this mode." +"for when the program is not in curses.) Subsequent calls " +"to :func:`reset_prog_mode` will restore this mode." msgstr "" -#: ../../library/curses.rst:135 +#: ../../library/curses.rst:150 msgid "" "Save the current terminal mode as the \"shell\" mode, the mode when the " "running program is not using curses. (Its counterpart is the \"program\" " -"mode, when the program is using curses capabilities.) Subsequent calls to :" -"func:`reset_shell_mode` will restore this mode." +"mode, when the program is using curses capabilities.) Subsequent calls " +"to :func:`reset_shell_mode` will restore this mode." msgstr "" -#: ../../library/curses.rst:143 +#: ../../library/curses.rst:158 msgid "Insert an *ms* millisecond pause in output." msgstr "" -#: ../../library/curses.rst:148 +#: ../../library/curses.rst:163 msgid "" "Update the physical screen. The curses library keeps two data structures, " "one representing the current physical screen contents and a virtual screen " @@ -208,35 +226,35 @@ msgid "" "the physical screen to match the virtual screen." msgstr "" -#: ../../library/curses.rst:153 +#: ../../library/curses.rst:168 msgid "" "The virtual screen may be updated by a :meth:`~window.noutrefresh` call " "after write operations such as :meth:`~window.addstr` have been performed on " "a window. The normal :meth:`~window.refresh` call is simply :meth:`!" "noutrefresh` followed by :func:`!doupdate`; if you have to update multiple " "windows, you can speed performance and perhaps reduce screen flicker by " -"issuing :meth:`!noutrefresh` calls on all windows, followed by a single :" -"func:`!doupdate`." +"issuing :meth:`!noutrefresh` calls on all windows, followed by a " +"single :func:`!doupdate`." msgstr "" -#: ../../library/curses.rst:163 +#: ../../library/curses.rst:178 msgid "" "Enter echo mode. In echo mode, each character input is echoed to the screen " "as it is entered." msgstr "" -#: ../../library/curses.rst:169 +#: ../../library/curses.rst:184 msgid "De-initialize the library, and return terminal to normal status." msgstr "" -#: ../../library/curses.rst:174 +#: ../../library/curses.rst:189 msgid "" "Return the user's current erase character as a one-byte bytes object. Under " "Unix operating systems this is a property of the controlling tty of the " "curses program, and is not set by the curses library itself." msgstr "" -#: ../../library/curses.rst:181 +#: ../../library/curses.rst:196 msgid "" "The :func:`.filter` routine, if used, must be called before :func:`initscr` " "is called. The effect is that, during those calls, :envvar:`LINES` is set " @@ -247,20 +265,20 @@ msgid "" "time line editing without touching the rest of the screen." msgstr "" -#: ../../library/curses.rst:191 +#: ../../library/curses.rst:206 msgid "" "Flash the screen. That is, change it to reverse-video and then change it " "back in a short interval. Some people prefer such as 'visible bell' to the " "audible attention signal produced by :func:`beep`." msgstr "" -#: ../../library/curses.rst:198 +#: ../../library/curses.rst:213 msgid "" "Flush all input buffers. This throws away any typeahead that has been " "typed by the user and has not yet been processed by the program." msgstr "" -#: ../../library/curses.rst:204 +#: ../../library/curses.rst:219 msgid "" "After :meth:`~window.getch` returns :const:`KEY_MOUSE` to signal a mouse " "event, this method should be called to retrieve the queued mouse event, " @@ -269,57 +287,55 @@ msgid "" "coordinates. (*z* is currently unused.) *bstate* is an integer value whose " "bits will be set to indicate the type of event, and will be the bitwise OR " "of one or more of the following constants, where *n* is the button number " -"from 1 to 5: :const:`BUTTONn_PRESSED`, :const:`BUTTONn_RELEASED`, :const:" -"`BUTTONn_CLICKED`, :const:`BUTTONn_DOUBLE_CLICKED`, :const:" -"`BUTTONn_TRIPLE_CLICKED`, :const:`BUTTON_SHIFT`, :const:`BUTTON_CTRL`, :" -"const:`BUTTON_ALT`." +"from 1 to " +"5: :const:`BUTTONn_PRESSED`, :const:`BUTTONn_RELEASED`, :const:`BUTTONn_CLICKED`, :const:`BUTTONn_DOUBLE_CLICKED`, :const:`BUTTONn_TRIPLE_CLICKED`, :const:`BUTTON_SHIFT`, :const:`BUTTON_CTRL`, :const:`BUTTON_ALT`." msgstr "" -#: ../../library/curses.rst:215 ../../library/curses.rst:1778 +#: ../../library/curses.rst:230 ../../library/curses.rst:1799 msgid "" "The ``BUTTON5_*`` constants are now exposed if they are provided by the " "underlying curses library." msgstr "" -#: ../../library/curses.rst:222 +#: ../../library/curses.rst:237 msgid "" "Return the current coordinates of the virtual screen cursor as a tuple ``(y, " "x)``. If :meth:`leaveok ` is currently ``True``, then " "return ``(-1, -1)``." msgstr "" -#: ../../library/curses.rst:228 +#: ../../library/curses.rst:243 msgid "" -"Read window related data stored in the file by an earlier :func:`window." -"putwin` call. The routine then creates and initializes a new window using " -"that data, returning the new window object." +"Read window related data stored in the file by an " +"earlier :func:`window.putwin` call. The routine then creates and initializes " +"a new window using that data, returning the new window object." msgstr "" -#: ../../library/curses.rst:235 +#: ../../library/curses.rst:250 msgid "" "Return ``True`` if the terminal can display colors; otherwise, return " "``False``." msgstr "" -#: ../../library/curses.rst:239 +#: ../../library/curses.rst:254 msgid "" "Return ``True`` if the module supports extended colors; otherwise, return " "``False``. Extended color support allows more than 256 color pairs for " "terminals that support more than 16 colors (e.g. xterm-256color)." msgstr "" -#: ../../library/curses.rst:243 +#: ../../library/curses.rst:258 msgid "Extended color support requires ncurses version 6.1 or later." msgstr "" -#: ../../library/curses.rst:249 +#: ../../library/curses.rst:264 msgid "" "Return ``True`` if the terminal has insert- and delete-character " "capabilities. This function is included for historical reasons only, as all " "modern software terminal emulators have such capabilities." msgstr "" -#: ../../library/curses.rst:256 +#: ../../library/curses.rst:271 msgid "" "Return ``True`` if the terminal has insert- and delete-line capabilities, or " "can simulate them using scrolling regions. This function is included for " @@ -327,13 +343,13 @@ msgid "" "capabilities." msgstr "" -#: ../../library/curses.rst:264 +#: ../../library/curses.rst:279 msgid "" "Take a key value *ch*, and return ``True`` if the current terminal type " "recognizes a key with that value." msgstr "" -#: ../../library/curses.rst:270 +#: ../../library/curses.rst:285 msgid "" "Used for half-delay mode, which is similar to cbreak mode in that characters " "typed by the user are immediately available to the program. However, after " @@ -342,7 +358,7 @@ msgid "" "``255``. Use :func:`nocbreak` to leave half-delay mode." msgstr "" -#: ../../library/curses.rst:279 +#: ../../library/curses.rst:294 msgid "" "Change the definition of a color, taking the number of the color to be " "changed followed by three RGB values (for the amounts of red, green, and " @@ -354,44 +370,45 @@ msgid "" "``True``." msgstr "" -#: ../../library/curses.rst:290 +#: ../../library/curses.rst:305 msgid "" "Change the definition of a color-pair. It takes three arguments: the number " "of the color-pair to be changed, the foreground color number, and the " "background color number. The value of *pair_number* must be between ``1`` " -"and ``COLOR_PAIRS - 1`` (the ``0`` color pair is wired to white on black and " -"cannot be changed). The value of *fg* and *bg* arguments must be between " -"``0`` and ``COLORS - 1``, or, after calling :func:`use_default_colors`, " +"and ``COLOR_PAIRS - 1`` (the ``0`` color pair can only be changed " +"by :func:`use_default_colors` and :func:`assume_default_colors`). The value " +"of *fg* and *bg* arguments must be between ``0`` and ``COLORS - 1``, or, " +"after calling :func:`!use_default_colors` or :func:`!assume_default_colors`, " "``-1``. If the color-pair was previously initialized, the screen is " "refreshed and all occurrences of that color-pair are changed to the new " "definition." msgstr "" -#: ../../library/curses.rst:303 +#: ../../library/curses.rst:320 msgid "" "Initialize the library. Return a :ref:`window ` " "object which represents the whole screen." msgstr "" -#: ../../library/curses.rst:308 +#: ../../library/curses.rst:325 msgid "" "If there is an error opening the terminal, the underlying curses library may " "cause the interpreter to exit." msgstr "" -#: ../../library/curses.rst:314 +#: ../../library/curses.rst:331 msgid "" "Return ``True`` if :func:`resize_term` would modify the window structure, " "``False`` otherwise." msgstr "" -#: ../../library/curses.rst:320 +#: ../../library/curses.rst:337 msgid "" "Return ``True`` if :func:`endwin` has been called (that is, the curses " "library has been deinitialized)." msgstr "" -#: ../../library/curses.rst:326 +#: ../../library/curses.rst:343 msgid "" "Return the name of the key numbered *k* as a bytes object. The name of a " "key generating printable ASCII character is the key's character. The name " @@ -402,27 +419,27 @@ msgid "" "character." msgstr "" -#: ../../library/curses.rst:336 +#: ../../library/curses.rst:353 msgid "" "Return the user's current line kill character as a one-byte bytes object. " "Under Unix operating systems this is a property of the controlling tty of " "the curses program, and is not set by the curses library itself." msgstr "" -#: ../../library/curses.rst:343 +#: ../../library/curses.rst:360 msgid "" "Return a bytes object containing the terminfo long name field describing the " "current terminal. The maximum length of a verbose description is 128 " "characters. It is defined only after the call to :func:`initscr`." msgstr "" -#: ../../library/curses.rst:350 +#: ../../library/curses.rst:367 msgid "" "If *flag* is ``True``, allow 8-bit characters to be input. If *flag* is " "``False``, allow only 7-bit chars." msgstr "" -#: ../../library/curses.rst:356 +#: ../../library/curses.rst:373 msgid "" "Set the maximum time in milliseconds that can elapse between press and " "release events in order for them to be recognized as a click, and return the " @@ -430,7 +447,7 @@ msgid "" "fifth of a second." msgstr "" -#: ../../library/curses.rst:363 +#: ../../library/curses.rst:380 msgid "" "Set the mouse events to be reported, and return a tuple ``(availmask, " "oldmask)``. *availmask* indicates which of the specified mouse events can " @@ -439,61 +456,61 @@ msgid "" "never called, no mouse events are ever reported." msgstr "" -#: ../../library/curses.rst:372 +#: ../../library/curses.rst:389 msgid "Sleep for *ms* milliseconds." msgstr "" -#: ../../library/curses.rst:377 +#: ../../library/curses.rst:394 msgid "" "Create and return a pointer to a new pad data structure with the given " "number of lines and columns. Return a pad as a window object." msgstr "" -#: ../../library/curses.rst:380 +#: ../../library/curses.rst:397 msgid "" "A pad is like a window, except that it is not restricted by the screen size, " "and is not necessarily associated with a particular part of the screen. " "Pads can be used when a large window is needed, and only a part of the " "window will be on the screen at one time. Automatic refreshes of pads (such " -"as from scrolling or echoing of input) do not occur. The :meth:`~window." -"refresh` and :meth:`~window.noutrefresh` methods of a pad require 6 " -"arguments to specify the part of the pad to be displayed and the location on " -"the screen to be used for the display. The arguments are *pminrow*, " -"*pmincol*, *sminrow*, *smincol*, *smaxrow*, *smaxcol*; the *p* arguments " -"refer to the upper left corner of the pad region to be displayed and the *s* " -"arguments define a clipping box on the screen within which the pad region is " -"to be displayed." +"as from scrolling or echoing of input) do not occur. " +"The :meth:`~window.refresh` and :meth:`~window.noutrefresh` methods of a pad " +"require 6 arguments to specify the part of the pad to be displayed and the " +"location on the screen to be used for the display. The arguments are " +"*pminrow*, *pmincol*, *sminrow*, *smincol*, *smaxrow*, *smaxcol*; the *p* " +"arguments refer to the upper left corner of the pad region to be displayed " +"and the *s* arguments define a clipping box on the screen within which the " +"pad region is to be displayed." msgstr "" -#: ../../library/curses.rst:396 +#: ../../library/curses.rst:413 msgid "" "Return a new :ref:`window `, whose left-upper corner " "is at ``(begin_y, begin_x)``, and whose height/width is *nlines*/*ncols*." msgstr "" -#: ../../library/curses.rst:399 +#: ../../library/curses.rst:416 msgid "" "By default, the window will extend from the specified position to the lower " "right corner of the screen." msgstr "" -#: ../../library/curses.rst:405 +#: ../../library/curses.rst:422 msgid "" "Enter newline mode. This mode translates the return key into newline on " "input, and translates newline into return and line-feed on output. Newline " "mode is initially on." msgstr "" -#: ../../library/curses.rst:412 +#: ../../library/curses.rst:429 msgid "" "Leave cbreak mode. Return to normal \"cooked\" mode with line buffering." msgstr "" -#: ../../library/curses.rst:417 +#: ../../library/curses.rst:434 msgid "Leave echo mode. Echoing of input characters is turned off." msgstr "" -#: ../../library/curses.rst:422 +#: ../../library/curses.rst:439 msgid "" "Leave newline mode. Disable translation of return into newline on input, " "and disable low-level translation of newline into newline/return on output " @@ -503,7 +520,7 @@ msgid "" "also, it will be able to detect the return key on input." msgstr "" -#: ../../library/curses.rst:432 +#: ../../library/curses.rst:449 msgid "" "When the :func:`!noqiflush` routine is used, normal flush of input and " "output queues associated with the ``INTR``, ``QUIT`` and ``SUSP`` characters " @@ -512,63 +529,63 @@ msgid "" "occurred, after the handler exits." msgstr "" -#: ../../library/curses.rst:440 +#: ../../library/curses.rst:457 msgid "Leave raw mode. Return to normal \"cooked\" mode with line buffering." msgstr "" -#: ../../library/curses.rst:445 +#: ../../library/curses.rst:462 msgid "" "Return a tuple ``(fg, bg)`` containing the colors for the requested color " "pair. The value of *pair_number* must be between ``0`` and ``COLOR_PAIRS - " "1``." msgstr "" -#: ../../library/curses.rst:451 +#: ../../library/curses.rst:468 msgid "" -"Return the number of the color-pair set by the attribute value *attr*. :func:" -"`color_pair` is the counterpart to this function." +"Return the number of the color-pair set by the attribute value " +"*attr*. :func:`color_pair` is the counterpart to this function." msgstr "" -#: ../../library/curses.rst:457 +#: ../../library/curses.rst:474 msgid "" "Equivalent to ``tputs(str, 1, putchar)``; emit the value of a specified " -"terminfo capability for the current terminal. Note that the output of :func:" -"`putp` always goes to standard output." +"terminfo capability for the current terminal. Note that the output " +"of :func:`putp` always goes to standard output." msgstr "" -#: ../../library/curses.rst:464 +#: ../../library/curses.rst:481 msgid "" "If *flag* is ``False``, the effect is the same as calling :func:`noqiflush`. " "If *flag* is ``True``, or no argument is provided, the queues will be " "flushed when these control characters are read." msgstr "" -#: ../../library/curses.rst:471 +#: ../../library/curses.rst:488 msgid "" "Enter raw mode. In raw mode, normal line buffering and processing of " "interrupt, quit, suspend, and flow control keys are turned off; characters " "are presented to curses input functions one by one." msgstr "" -#: ../../library/curses.rst:478 +#: ../../library/curses.rst:495 msgid "" -"Restore the terminal to \"program\" mode, as previously saved by :func:" -"`def_prog_mode`." +"Restore the terminal to \"program\" mode, as previously saved " +"by :func:`def_prog_mode`." msgstr "" -#: ../../library/curses.rst:484 +#: ../../library/curses.rst:501 msgid "" -"Restore the terminal to \"shell\" mode, as previously saved by :func:" -"`def_shell_mode`." +"Restore the terminal to \"shell\" mode, as previously saved " +"by :func:`def_shell_mode`." msgstr "" -#: ../../library/curses.rst:490 +#: ../../library/curses.rst:507 msgid "" -"Restore the state of the terminal modes to what it was at the last call to :" -"func:`savetty`." +"Restore the state of the terminal modes to what it was at the last call " +"to :func:`savetty`." msgstr "" -#: ../../library/curses.rst:496 +#: ../../library/curses.rst:513 msgid "" "Backend function used by :func:`resizeterm`, performing most of the work; " "when resizing the windows, :func:`resize_term` blank-fills the areas that " @@ -578,47 +595,47 @@ msgid "" "to resize these without additional interaction with the application." msgstr "" -#: ../../library/curses.rst:506 +#: ../../library/curses.rst:523 msgid "" "Resize the standard and current windows to the specified dimensions, and " "adjusts other bookkeeping data used by the curses library that record the " "window dimensions (in particular the SIGWINCH handler)." msgstr "" -#: ../../library/curses.rst:513 +#: ../../library/curses.rst:530 msgid "" -"Save the current state of the terminal modes in a buffer, usable by :func:" -"`resetty`." +"Save the current state of the terminal modes in a buffer, usable " +"by :func:`resetty`." msgstr "" -#: ../../library/curses.rst:518 +#: ../../library/curses.rst:535 msgid "Retrieves the value set by :func:`set_escdelay`." msgstr "" -#: ../../library/curses.rst:524 +#: ../../library/curses.rst:541 msgid "" "Sets the number of milliseconds to wait after reading an escape character, " "to distinguish between an individual escape character entered on the " "keyboard from escape sequences sent by cursor and function keys." msgstr "" -#: ../../library/curses.rst:532 +#: ../../library/curses.rst:549 msgid "Retrieves the value set by :func:`set_tabsize`." msgstr "" -#: ../../library/curses.rst:538 +#: ../../library/curses.rst:555 msgid "" "Sets the number of columns used by the curses library when converting a tab " "character to spaces as it adds the tab to a window." msgstr "" -#: ../../library/curses.rst:545 +#: ../../library/curses.rst:562 msgid "" "Set the virtual screen cursor to *y*, *x*. If *y* and *x* are both ``-1``, " "then :meth:`leaveok ` is set ``True``." msgstr "" -#: ../../library/curses.rst:551 +#: ../../library/curses.rst:568 msgid "" "Initialize the terminal. *term* is a string giving the terminal name, or " "``None``; if omitted or ``None``, the value of the :envvar:`TERM` " @@ -627,37 +644,37 @@ msgid "" "descriptor for ``sys.stdout`` will be used." msgstr "" -#: ../../library/curses.rst:560 +#: ../../library/curses.rst:577 msgid "" "Must be called if the programmer wants to use colors, and before any other " "color manipulation routine is called. It is good practice to call this " "routine right after :func:`initscr`." msgstr "" -#: ../../library/curses.rst:564 +#: ../../library/curses.rst:581 msgid "" ":func:`start_color` initializes eight basic colors (black, red, green, " -"yellow, blue, magenta, cyan, and white), and two global variables in the :" -"mod:`curses` module, :const:`COLORS` and :const:`COLOR_PAIRS`, containing " -"the maximum number of colors and color-pairs the terminal can support. It " -"also restores the colors on the terminal to the values they had when the " -"terminal was just turned on." +"yellow, blue, magenta, cyan, and white), and two global variables in " +"the :mod:`curses` module, :const:`COLORS` and :const:`COLOR_PAIRS`, " +"containing the maximum number of colors and color-pairs the terminal can " +"support. It also restores the colors on the terminal to the values they had " +"when the terminal was just turned on." msgstr "" -#: ../../library/curses.rst:573 +#: ../../library/curses.rst:590 msgid "" "Return a logical OR of all video attributes supported by the terminal. This " "information is useful when a curses program needs complete control over the " "appearance of the screen." msgstr "" -#: ../../library/curses.rst:580 +#: ../../library/curses.rst:597 msgid "" "Return the value of the environment variable :envvar:`TERM`, as a bytes " "object, truncated to 14 characters." msgstr "" -#: ../../library/curses.rst:586 +#: ../../library/curses.rst:603 msgid "" "Return the value of the Boolean capability corresponding to the terminfo " "capability name *capname* as an integer. Return the value ``-1`` if " @@ -665,7 +682,7 @@ msgid "" "from the terminal description." msgstr "" -#: ../../library/curses.rst:594 +#: ../../library/curses.rst:611 msgid "" "Return the value of the numeric capability corresponding to the terminfo " "capability name *capname* as an integer. Return the value ``-2`` if " @@ -673,7 +690,7 @@ msgid "" "from the terminal description." msgstr "" -#: ../../library/curses.rst:602 +#: ../../library/curses.rst:619 msgid "" "Return the value of the string capability corresponding to the terminfo " "capability name *capname* as a bytes object. Return ``None`` if *capname* " @@ -681,7 +698,7 @@ msgid "" "terminal description." msgstr "" -#: ../../library/curses.rst:610 +#: ../../library/curses.rst:627 msgid "" "Instantiate the bytes object *str* with the supplied parameters, where *str* " "should be a parameterized string obtained from the terminfo database. E.g. " @@ -689,13 +706,13 @@ msgid "" "exact result depending on terminal type." msgstr "" -#: ../../library/curses.rst:618 +#: ../../library/curses.rst:635 msgid "" "Specify that the file descriptor *fd* be used for typeahead checking. If " "*fd* is ``-1``, then no typeahead checking is done." msgstr "" -#: ../../library/curses.rst:621 +#: ../../library/curses.rst:638 msgid "" "The curses library does \"line-breakout optimization\" by looking for " "typeahead periodically while updating the screen. If input is found, and it " @@ -705,7 +722,7 @@ msgid "" "typeahead checking." msgstr "" -#: ../../library/curses.rst:630 +#: ../../library/curses.rst:647 msgid "" "Return a bytes object which is a printable representation of the character " "*ch*. Control characters are represented as a caret followed by the " @@ -713,35 +730,35 @@ msgid "" "are." msgstr "" -#: ../../library/curses.rst:637 +#: ../../library/curses.rst:654 msgid "Push *ch* so the next :meth:`~window.getch` will return it." msgstr "" -#: ../../library/curses.rst:641 +#: ../../library/curses.rst:658 msgid "Only one *ch* can be pushed before :meth:`!getch` is called." msgstr "" -#: ../../library/curses.rst:646 +#: ../../library/curses.rst:663 msgid "" "Update the :const:`LINES` and :const:`COLS` module variables. Useful for " "detecting manual screen resize." msgstr "" -#: ../../library/curses.rst:654 +#: ../../library/curses.rst:671 msgid "Push *ch* so the next :meth:`~window.get_wch` will return it." msgstr "" -#: ../../library/curses.rst:658 +#: ../../library/curses.rst:675 msgid "Only one *ch* can be pushed before :meth:`!get_wch` is called." msgstr "" -#: ../../library/curses.rst:665 +#: ../../library/curses.rst:682 msgid "" "Push a :const:`KEY_MOUSE` event onto the input queue, associating the given " "state data with it." msgstr "" -#: ../../library/curses.rst:671 +#: ../../library/curses.rst:688 msgid "" "If used, this function should be called before :func:`initscr` or newterm " "are called. When *flag* is ``False``, the values of lines and columns " @@ -751,16 +768,11 @@ msgid "" "to use the window size if :envvar:`LINES` and :envvar:`COLUMNS` are not set)." msgstr "" -#: ../../library/curses.rst:681 -msgid "" -"Allow use of default values for colors on terminals supporting this feature. " -"Use this to support transparency in your application. The default color is " -"assigned to the color number ``-1``. After calling this function, " -"``init_pair(x, curses.COLOR_RED, -1)`` initializes, for instance, color pair " -"*x* to a red foreground color on the default background." +#: ../../library/curses.rst:698 +msgid "Equivalent to ``assume_default_colors(-1, -1)``." msgstr "" -#: ../../library/curses.rst:690 +#: ../../library/curses.rst:703 msgid "" "Initialize curses and call another callable object, *func*, which should be " "the rest of your curses-using application. If the application raises an " @@ -774,50 +786,50 @@ msgid "" "echo, and disables the terminal keypad." msgstr "" -#: ../../library/curses.rst:704 +#: ../../library/curses.rst:717 msgid "Window Objects" msgstr "" -#: ../../library/curses.rst:708 +#: ../../library/curses.rst:721 msgid "" "Window objects, as returned by :func:`initscr` and :func:`newwin` above, " "have the following methods and attributes:" msgstr "" -#: ../../library/curses.rst:715 +#: ../../library/curses.rst:728 msgid "" "Paint character *ch* at ``(y, x)`` with attributes *attr*, overwriting any " "character previously painted at that location. By default, the character " "position and attributes are the current settings for the window object." msgstr "" -#: ../../library/curses.rst:721 +#: ../../library/curses.rst:734 msgid "" "Writing outside the window, subwindow, or pad raises a :exc:`curses.error`. " "Attempting to write to the lower right corner of a window, subwindow, or pad " "will cause an exception to be raised after the character is printed." msgstr "" -#: ../../library/curses.rst:729 +#: ../../library/curses.rst:742 msgid "" "Paint at most *n* characters of the character string *str* at ``(y, x)`` " "with attributes *attr*, overwriting anything previously on the display." msgstr "" -#: ../../library/curses.rst:737 +#: ../../library/curses.rst:750 msgid "" "Paint the character string *str* at ``(y, x)`` with attributes *attr*, " "overwriting anything previously on the display." msgstr "" -#: ../../library/curses.rst:742 +#: ../../library/curses.rst:755 msgid "" "Writing outside the window, subwindow, or pad raises :exc:`curses.error`. " "Attempting to write to the lower right corner of a window, subwindow, or pad " "will cause an exception to be raised after the string is printed." msgstr "" -#: ../../library/curses.rst:746 +#: ../../library/curses.rst:759 msgid "" "A `bug in ncurses `_, the backend for " "this Python module, can cause SegFaults when resizing windows. This is fixed " @@ -827,44 +839,44 @@ msgid "" "line." msgstr "" -#: ../../library/curses.rst:756 +#: ../../library/curses.rst:769 msgid "" "Remove attribute *attr* from the \"background\" set applied to all writes to " "the current window." msgstr "" -#: ../../library/curses.rst:762 +#: ../../library/curses.rst:775 msgid "" "Add attribute *attr* from the \"background\" set applied to all writes to " "the current window." msgstr "" -#: ../../library/curses.rst:768 +#: ../../library/curses.rst:781 msgid "" "Set the \"background\" set of attributes to *attr*. This set is initially " "``0`` (no attributes)." msgstr "" -#: ../../library/curses.rst:774 +#: ../../library/curses.rst:787 msgid "" "Set the background property of the window to the character *ch*, with " "attributes *attr*. The change is then applied to every character position " "in that window:" msgstr "" -#: ../../library/curses.rst:778 +#: ../../library/curses.rst:791 msgid "" "The attribute of every character in the window is changed to the new " "background attribute." msgstr "" -#: ../../library/curses.rst:781 +#: ../../library/curses.rst:794 msgid "" "Wherever the former background character appears, it is changed to the new " "background character." msgstr "" -#: ../../library/curses.rst:787 +#: ../../library/curses.rst:800 msgid "" "Set the window's background. A window's background consists of a character " "and any combination of attributes. The attribute part of the background is " @@ -875,128 +887,128 @@ msgid "" "delete line/character operations." msgstr "" -#: ../../library/curses.rst:797 +#: ../../library/curses.rst:810 msgid "" "Draw a border around the edges of the window. Each parameter specifies the " "character to use for a specific part of the border; see the table below for " "more details." msgstr "" -#: ../../library/curses.rst:803 +#: ../../library/curses.rst:816 msgid "" "A ``0`` value for any parameter will cause the default character to be used " "for that parameter. Keyword parameters can *not* be used. The defaults are " "listed in this table:" msgstr "" -#: ../../library/curses.rst:808 +#: ../../library/curses.rst:821 msgid "Parameter" msgstr "參數" -#: ../../library/curses.rst:808 +#: ../../library/curses.rst:821 msgid "Description" msgstr "描述" -#: ../../library/curses.rst:808 +#: ../../library/curses.rst:821 msgid "Default value" msgstr "" -#: ../../library/curses.rst:810 +#: ../../library/curses.rst:823 msgid "*ls*" msgstr "*ls*" -#: ../../library/curses.rst:810 +#: ../../library/curses.rst:823 msgid "Left side" msgstr "" -#: ../../library/curses.rst:810 ../../library/curses.rst:812 +#: ../../library/curses.rst:823 ../../library/curses.rst:825 msgid ":const:`ACS_VLINE`" msgstr ":const:`ACS_VLINE`" -#: ../../library/curses.rst:812 +#: ../../library/curses.rst:825 msgid "*rs*" msgstr "*rs*" -#: ../../library/curses.rst:812 +#: ../../library/curses.rst:825 msgid "Right side" msgstr "" -#: ../../library/curses.rst:814 +#: ../../library/curses.rst:827 msgid "*ts*" msgstr "*ts*" -#: ../../library/curses.rst:814 +#: ../../library/curses.rst:827 msgid "Top" msgstr "" -#: ../../library/curses.rst:814 ../../library/curses.rst:816 +#: ../../library/curses.rst:827 ../../library/curses.rst:829 msgid ":const:`ACS_HLINE`" msgstr ":const:`ACS_HLINE`" -#: ../../library/curses.rst:816 +#: ../../library/curses.rst:829 msgid "*bs*" msgstr "*bs*" -#: ../../library/curses.rst:816 +#: ../../library/curses.rst:829 msgid "Bottom" msgstr "" -#: ../../library/curses.rst:818 +#: ../../library/curses.rst:831 msgid "*tl*" msgstr "*tl*" -#: ../../library/curses.rst:818 +#: ../../library/curses.rst:831 msgid "Upper-left corner" msgstr "" -#: ../../library/curses.rst:818 +#: ../../library/curses.rst:831 msgid ":const:`ACS_ULCORNER`" msgstr ":const:`ACS_ULCORNER`" -#: ../../library/curses.rst:820 +#: ../../library/curses.rst:833 msgid "*tr*" msgstr "*tr*" -#: ../../library/curses.rst:820 +#: ../../library/curses.rst:833 msgid "Upper-right corner" msgstr "" -#: ../../library/curses.rst:820 +#: ../../library/curses.rst:833 msgid ":const:`ACS_URCORNER`" msgstr ":const:`ACS_URCORNER`" -#: ../../library/curses.rst:822 +#: ../../library/curses.rst:835 msgid "*bl*" msgstr "*bl*" -#: ../../library/curses.rst:822 +#: ../../library/curses.rst:835 msgid "Bottom-left corner" msgstr "" -#: ../../library/curses.rst:822 +#: ../../library/curses.rst:835 msgid ":const:`ACS_LLCORNER`" msgstr ":const:`ACS_LLCORNER`" -#: ../../library/curses.rst:824 +#: ../../library/curses.rst:837 msgid "*br*" msgstr "*br*" -#: ../../library/curses.rst:824 +#: ../../library/curses.rst:837 msgid "Bottom-right corner" msgstr "" -#: ../../library/curses.rst:824 +#: ../../library/curses.rst:837 msgid ":const:`ACS_LRCORNER`" msgstr ":const:`ACS_LRCORNER`" -#: ../../library/curses.rst:830 +#: ../../library/curses.rst:843 msgid "" "Similar to :meth:`border`, but both *ls* and *rs* are *vertch* and both *ts* " "and *bs* are *horch*. The default corner characters are always used by this " "function." msgstr "" -#: ../../library/curses.rst:839 +#: ../../library/curses.rst:852 msgid "" "Set the attributes of *num* characters at the current cursor position, or at " "position ``(y, x)`` if supplied. If *num* is not given or is ``-1``, the " @@ -1006,45 +1018,45 @@ msgid "" "be redisplayed by the next window refresh." msgstr "" -#: ../../library/curses.rst:849 +#: ../../library/curses.rst:862 msgid "" "Like :meth:`erase`, but also cause the whole window to be repainted upon " "next call to :meth:`refresh`." msgstr "" -#: ../../library/curses.rst:855 +#: ../../library/curses.rst:868 msgid "" "If *flag* is ``True``, the next call to :meth:`refresh` will clear the " "window completely." msgstr "" -#: ../../library/curses.rst:861 +#: ../../library/curses.rst:874 msgid "" "Erase from cursor to the end of the window: all lines below the cursor are " "deleted, and then the equivalent of :meth:`clrtoeol` is performed." msgstr "" -#: ../../library/curses.rst:867 +#: ../../library/curses.rst:880 msgid "Erase from cursor to the end of the line." msgstr "" -#: ../../library/curses.rst:872 +#: ../../library/curses.rst:885 msgid "" "Update the current cursor position of all the ancestors of the window to " "reflect the current cursor position of the window." msgstr "" -#: ../../library/curses.rst:878 +#: ../../library/curses.rst:891 msgid "Delete any character at ``(y, x)``." msgstr "" -#: ../../library/curses.rst:883 +#: ../../library/curses.rst:896 msgid "" "Delete the line under the cursor. All following lines are moved up by one " "line." msgstr "" -#: ../../library/curses.rst:889 +#: ../../library/curses.rst:902 msgid "" "An abbreviation for \"derive window\", :meth:`derwin` is the same as " "calling :meth:`subwin`, except that *begin_y* and *begin_x* are relative to " @@ -1052,13 +1064,13 @@ msgid "" "a window object for the derived window." msgstr "" -#: ../../library/curses.rst:897 +#: ../../library/curses.rst:910 msgid "" -"Add character *ch* with attribute *attr*, and immediately call :meth:" -"`refresh` on the window." +"Add character *ch* with attribute *attr*, and immediately " +"call :meth:`refresh` on the window." msgstr "" -#: ../../library/curses.rst:903 +#: ../../library/curses.rst:916 msgid "" "Test whether the given pair of screen-relative character-cell coordinates " "are enclosed by the given window, returning ``True`` or ``False``. It is " @@ -1066,11 +1078,11 @@ msgid "" "location of a mouse event." msgstr "" -#: ../../library/curses.rst:908 +#: ../../library/curses.rst:921 msgid "Previously it returned ``1`` or ``0`` instead of ``True`` or ``False``." msgstr "" -#: ../../library/curses.rst:914 +#: ../../library/curses.rst:927 msgid "" "Encoding used to encode method arguments (Unicode strings and characters). " "The encoding attribute is inherited from the parent window when a subwindow " @@ -1078,19 +1090,19 @@ msgid "" "locale encoding is used (see :func:`locale.getencoding`)." msgstr "" -#: ../../library/curses.rst:924 +#: ../../library/curses.rst:937 msgid "Clear the window." msgstr "" -#: ../../library/curses.rst:929 +#: ../../library/curses.rst:942 msgid "Return a tuple ``(y, x)`` of coordinates of upper-left corner." msgstr "" -#: ../../library/curses.rst:934 +#: ../../library/curses.rst:947 msgid "Return the given window's current background character/attribute pair." msgstr "" -#: ../../library/curses.rst:939 +#: ../../library/curses.rst:952 msgid "" "Get a character. Note that the integer returned does *not* have to be in " "ASCII range: function keys, keypad keys and so on are represented by numbers " @@ -1098,14 +1110,14 @@ msgid "" "otherwise wait until a key is pressed." msgstr "" -#: ../../library/curses.rst:947 +#: ../../library/curses.rst:960 msgid "" "Get a wide character. Return a character for most keys, or an integer for " "function keys, keypad keys, and other special keys. In no-delay mode, raise " "an exception if there is no input." msgstr "" -#: ../../library/curses.rst:956 +#: ../../library/curses.rst:969 msgid "" "Get a character, returning a string instead of an integer, as :meth:`getch` " "does. Function keys, keypad keys and other special keys return a multibyte " @@ -1113,35 +1125,40 @@ msgid "" "there is no input." msgstr "" -#: ../../library/curses.rst:964 +#: ../../library/curses.rst:977 msgid "Return a tuple ``(y, x)`` of the height and width of the window." msgstr "" -#: ../../library/curses.rst:969 +#: ../../library/curses.rst:982 msgid "" "Return the beginning coordinates of this window relative to its parent " "window as a tuple ``(y, x)``. Return ``(-1, -1)`` if this window has no " "parent." msgstr "" -#: ../../library/curses.rst:979 +#: ../../library/curses.rst:992 msgid "" -"Read a bytes object from the user, with primitive line editing capacity." +"Read a bytes object from the user, with primitive line editing capacity. The " +"maximum value for *n* is 2047." msgstr "" -#: ../../library/curses.rst:984 +#: ../../library/curses.rst:995 ../../library/curses.rst:1090 +msgid "The maximum value for *n* was increased from 1023 to 2047." +msgstr "" + +#: ../../library/curses.rst:1001 msgid "" "Return a tuple ``(y, x)`` of current cursor position relative to the " "window's upper-left corner." msgstr "" -#: ../../library/curses.rst:991 +#: ../../library/curses.rst:1008 msgid "" "Display a horizontal line starting at ``(y, x)`` with length *n* consisting " "of the character *ch*." msgstr "" -#: ../../library/curses.rst:997 +#: ../../library/curses.rst:1014 msgid "" "If *flag* is ``False``, curses no longer considers using the hardware insert/" "delete character feature of the terminal; if *flag* is ``True``, use of " @@ -1149,13 +1166,13 @@ msgid "" "initialized, use of character insert/delete is enabled by default." msgstr "" -#: ../../library/curses.rst:1005 +#: ../../library/curses.rst:1022 msgid "" "If *flag* is ``True``, :mod:`curses` will try and use hardware line editing " "facilities. Otherwise, line insertion/deletion are disabled." msgstr "" -#: ../../library/curses.rst:1011 +#: ../../library/curses.rst:1028 msgid "" "If *flag* is ``True``, any change in the window image automatically causes " "the window to be refreshed; you no longer have to call :meth:`refresh` " @@ -1163,19 +1180,19 @@ msgid "" "calls to wrefresh. This option is disabled by default." msgstr "" -#: ../../library/curses.rst:1019 +#: ../../library/curses.rst:1036 msgid "" "Return the character at the given position in the window. The bottom 8 bits " "are the character proper, and upper bits are the attributes." msgstr "" -#: ../../library/curses.rst:1026 +#: ../../library/curses.rst:1043 msgid "" "Paint character *ch* at ``(y, x)`` with attributes *attr*, moving the line " "from position *x* right by one character." msgstr "" -#: ../../library/curses.rst:1032 +#: ../../library/curses.rst:1049 msgid "" "Insert *nlines* lines into the specified window above the current line. The " "*nlines* bottom lines are lost. For negative *nlines*, delete *nlines* " @@ -1184,13 +1201,13 @@ msgid "" "remains the same." msgstr "" -#: ../../library/curses.rst:1041 +#: ../../library/curses.rst:1058 msgid "" "Insert a blank line under the cursor. All following lines are moved down by " "one line." msgstr "" -#: ../../library/curses.rst:1048 +#: ../../library/curses.rst:1065 msgid "" "Insert a character string (as many characters as will fit on the line) " "before the character under the cursor, up to *n* characters. If *n* is " @@ -1200,7 +1217,7 @@ msgid "" "if specified)." msgstr "" -#: ../../library/curses.rst:1058 +#: ../../library/curses.rst:1075 msgid "" "Insert a character string (as many characters as will fit on the line) " "before the character under the cursor. All characters to the right of the " @@ -1209,84 +1226,85 @@ msgid "" "specified)." msgstr "" -#: ../../library/curses.rst:1067 +#: ../../library/curses.rst:1084 msgid "" "Return a bytes object of characters, extracted from the window starting at " "the current cursor position, or at *y*, *x* if specified. Attributes are " "stripped from the characters. If *n* is specified, :meth:`instr` returns a " -"string at most *n* characters long (exclusive of the trailing NUL)." +"string at most *n* characters long (exclusive of the trailing NUL). The " +"maximum value for *n* is 2047." msgstr "" -#: ../../library/curses.rst:1075 +#: ../../library/curses.rst:1096 msgid "" -"Return ``True`` if the specified line was modified since the last call to :" -"meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` " +"Return ``True`` if the specified line was modified since the last call " +"to :meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` " "exception if *line* is not valid for the given window." msgstr "" -#: ../../library/curses.rst:1082 +#: ../../library/curses.rst:1103 msgid "" -"Return ``True`` if the specified window was modified since the last call to :" -"meth:`refresh`; otherwise return ``False``." +"Return ``True`` if the specified window was modified since the last call " +"to :meth:`refresh`; otherwise return ``False``." msgstr "" -#: ../../library/curses.rst:1088 +#: ../../library/curses.rst:1109 msgid "" "If *flag* is ``True``, escape sequences generated by some keys (keypad, " "function keys) will be interpreted by :mod:`curses`. If *flag* is ``False``, " "escape sequences will be left as is in the input stream." msgstr "" -#: ../../library/curses.rst:1095 +#: ../../library/curses.rst:1116 msgid "" "If *flag* is ``True``, cursor is left where it is on update, instead of " "being at \"cursor position.\" This reduces cursor movement where possible. " "If possible the cursor will be made invisible." msgstr "" -#: ../../library/curses.rst:1099 +#: ../../library/curses.rst:1120 msgid "" "If *flag* is ``False``, cursor will always be at \"cursor position\" after " "an update." msgstr "" -#: ../../library/curses.rst:1104 +#: ../../library/curses.rst:1125 msgid "Move cursor to ``(new_y, new_x)``." msgstr "" -#: ../../library/curses.rst:1109 +#: ../../library/curses.rst:1130 msgid "" "Move the window inside its parent window. The screen-relative parameters of " "the window are not changed. This routine is used to display different parts " "of the parent window at the same physical position on the screen." msgstr "" -#: ../../library/curses.rst:1116 +#: ../../library/curses.rst:1137 msgid "Move the window so its upper-left corner is at ``(new_y, new_x)``." msgstr "" -#: ../../library/curses.rst:1121 +#: ../../library/curses.rst:1142 msgid "If *flag* is ``True``, :meth:`getch` will be non-blocking." msgstr "" -#: ../../library/curses.rst:1126 +#: ../../library/curses.rst:1147 msgid "If *flag* is ``True``, escape sequences will not be timed out." msgstr "" -#: ../../library/curses.rst:1128 +#: ../../library/curses.rst:1149 msgid "" "If *flag* is ``False``, after a few milliseconds, an escape sequence will " "not be interpreted, and will be left in the input stream as is." msgstr "" -#: ../../library/curses.rst:1134 +#: ../../library/curses.rst:1155 msgid "" "Mark for refresh but wait. This function updates the data structure " "representing the desired state of the window, but does not force an update " "of the physical screen. To accomplish that, call :func:`doupdate`." msgstr "" -#: ../../library/curses.rst:1141 +#: ../../library/curses.rst:1162 msgid "" "Overlay the window on top of *destwin*. The windows need not be the same " "size, only the overlapping region is copied. This copy is non-destructive, " @@ -1294,15 +1312,15 @@ msgid "" "contents of *destwin*." msgstr "" -#: ../../library/curses.rst:1146 +#: ../../library/curses.rst:1167 msgid "" -"To get fine-grained control over the copied region, the second form of :meth:" -"`overlay` can be used. *sminrow* and *smincol* are the upper-left " +"To get fine-grained control over the copied region, the second form " +"of :meth:`overlay` can be used. *sminrow* and *smincol* are the upper-left " "coordinates of the source window, and the other variables mark a rectangle " "in the destination window." msgstr "" -#: ../../library/curses.rst:1154 +#: ../../library/curses.rst:1175 msgid "" "Overwrite the window on top of *destwin*. The windows need not be the same " "size, in which case only the overlapping region is copied. This copy is " @@ -1310,39 +1328,39 @@ msgid "" "the old contents of *destwin*." msgstr "" -#: ../../library/curses.rst:1159 +#: ../../library/curses.rst:1180 msgid "" -"To get fine-grained control over the copied region, the second form of :meth:" -"`overwrite` can be used. *sminrow* and *smincol* are the upper-left " +"To get fine-grained control over the copied region, the second form " +"of :meth:`overwrite` can be used. *sminrow* and *smincol* are the upper-left " "coordinates of the source window, the other variables mark a rectangle in " "the destination window." msgstr "" -#: ../../library/curses.rst:1167 +#: ../../library/curses.rst:1188 msgid "" "Write all data associated with the window into the provided file object. " "This information can be later retrieved using the :func:`getwin` function." msgstr "" -#: ../../library/curses.rst:1173 +#: ../../library/curses.rst:1194 msgid "" "Indicate that the *num* screen lines, starting at line *beg*, are corrupted " "and should be completely redrawn on the next :meth:`refresh` call." msgstr "" -#: ../../library/curses.rst:1179 +#: ../../library/curses.rst:1200 msgid "" -"Touch the entire window, causing it to be completely redrawn on the next :" -"meth:`refresh` call." +"Touch the entire window, causing it to be completely redrawn on the " +"next :meth:`refresh` call." msgstr "" -#: ../../library/curses.rst:1185 +#: ../../library/curses.rst:1206 msgid "" "Update the display immediately (sync actual screen with previous drawing/" "deleting methods)." msgstr "" -#: ../../library/curses.rst:1188 +#: ../../library/curses.rst:1209 msgid "" "The 6 optional arguments can only be specified when the window is a pad " "created with :func:`newpad`. The additional parameters are needed to " @@ -1357,7 +1375,7 @@ msgid "" "*smincol* are treated as if they were zero." msgstr "" -#: ../../library/curses.rst:1202 +#: ../../library/curses.rst:1223 msgid "" "Reallocate storage for a curses window to adjust its dimensions to the " "specified values. If either dimension is larger than the current values, " @@ -1365,11 +1383,11 @@ msgid "" "rendition (as set by :meth:`bkgdset`) merged into them." msgstr "" -#: ../../library/curses.rst:1210 +#: ../../library/curses.rst:1231 msgid "Scroll the screen or scrolling region upward by *lines* lines." msgstr "" -#: ../../library/curses.rst:1215 +#: ../../library/curses.rst:1236 msgid "" "Control what happens when the cursor of a window is moved off the edge of " "the window or scrolling region, either as a result of a newline action on " @@ -1379,64 +1397,64 @@ msgid "" "scrolling effect on the terminal, it is also necessary to call :meth:`idlok`." msgstr "" -#: ../../library/curses.rst:1225 +#: ../../library/curses.rst:1246 msgid "" "Set the scrolling region from line *top* to line *bottom*. All scrolling " "actions will take place in this region." msgstr "" -#: ../../library/curses.rst:1231 +#: ../../library/curses.rst:1252 msgid "" "Turn off the standout attribute. On some terminals this has the side effect " "of turning off all attributes." msgstr "" -#: ../../library/curses.rst:1237 +#: ../../library/curses.rst:1258 msgid "Turn on attribute *A_STANDOUT*." msgstr "" -#: ../../library/curses.rst:1243 ../../library/curses.rst:1250 +#: ../../library/curses.rst:1264 ../../library/curses.rst:1271 msgid "" "Return a sub-window, whose upper-left corner is at ``(begin_y, begin_x)``, " "and whose width/height is *ncols*/*nlines*." msgstr "" -#: ../../library/curses.rst:1253 +#: ../../library/curses.rst:1274 msgid "" "By default, the sub-window will extend from the specified position to the " "lower right corner of the window." msgstr "" -#: ../../library/curses.rst:1259 +#: ../../library/curses.rst:1280 msgid "" "Touch each location in the window that has been touched in any of its " "ancestor windows. This routine is called by :meth:`refresh`, so it should " "almost never be necessary to call it manually." msgstr "" -#: ../../library/curses.rst:1266 +#: ../../library/curses.rst:1287 msgid "" "If *flag* is ``True``, then :meth:`syncup` is called automatically whenever " "there is a change in the window." msgstr "" -#: ../../library/curses.rst:1272 +#: ../../library/curses.rst:1293 msgid "" "Touch all locations in ancestors of the window that have been changed in " "the window." msgstr "" -#: ../../library/curses.rst:1278 +#: ../../library/curses.rst:1299 msgid "" "Set blocking or non-blocking read behavior for the window. If *delay* is " "negative, blocking read is used (which will wait indefinitely for input). " "If *delay* is zero, then non-blocking read is used, and :meth:`getch` will " -"return ``-1`` if no input is waiting. If *delay* is positive, then :meth:" -"`getch` will block for *delay* milliseconds, and return ``-1`` if there is " -"still no input at the end of that time." +"return ``-1`` if no input is waiting. If *delay* is positive, " +"then :meth:`getch` will block for *delay* milliseconds, and return ``-1`` if " +"there is still no input at the end of that time." msgstr "" -#: ../../library/curses.rst:1288 +#: ../../library/curses.rst:1309 msgid "" "Pretend *count* lines have been changed, starting with line *start*. If " "*changed* is supplied, it specifies whether the affected lines are marked as " @@ -1444,49 +1462,49 @@ msgid "" "``=False``)." msgstr "" -#: ../../library/curses.rst:1295 +#: ../../library/curses.rst:1316 msgid "" "Pretend the whole window has been changed, for purposes of drawing " "optimizations." msgstr "" -#: ../../library/curses.rst:1301 +#: ../../library/curses.rst:1322 msgid "" -"Mark all lines in the window as unchanged since the last call to :meth:" -"`refresh`." +"Mark all lines in the window as unchanged since the last call " +"to :meth:`refresh`." msgstr "" -#: ../../library/curses.rst:1308 +#: ../../library/curses.rst:1329 msgid "" "Display a vertical line starting at ``(y, x)`` with length *n* consisting of " "the character *ch* with attributes *attr*." msgstr "" -#: ../../library/curses.rst:1313 +#: ../../library/curses.rst:1334 msgid "Constants" msgstr "" -#: ../../library/curses.rst:1315 +#: ../../library/curses.rst:1336 msgid "The :mod:`curses` module defines the following data members:" msgstr ":mod:`curses` 模組定義了以下資料成員:" -#: ../../library/curses.rst:1320 +#: ../../library/curses.rst:1341 msgid "" -"Some curses routines that return an integer, such as :meth:`~window." -"getch`, return :const:`ERR` upon failure." +"Some curses routines that return an integer, such " +"as :meth:`~window.getch`, return :const:`ERR` upon failure." msgstr "" -#: ../../library/curses.rst:1326 +#: ../../library/curses.rst:1347 msgid "" "Some curses routines that return an integer, such as :func:`napms`, " "return :const:`OK` upon success." msgstr "" -#: ../../library/curses.rst:1333 +#: ../../library/curses.rst:1354 msgid "A bytes object representing the current version of the module." msgstr "" -#: ../../library/curses.rst:1338 +#: ../../library/curses.rst:1359 msgid "" "A named tuple containing the three components of the ncurses library " "version: *major*, *minor*, and *patch*. All values are integers. The " @@ -1494,605 +1512,606 @@ msgid "" "is equivalent to ``curses.ncurses_version.major`` and so on." msgstr "" -#: ../../library/curses.rst:1343 +#: ../../library/curses.rst:1364 msgid "Availability: if the ncurses library is used." msgstr "" -#: ../../library/curses.rst:1349 +#: ../../library/curses.rst:1370 msgid "" "The maximum number of colors the terminal can support. It is defined only " "after the call to :func:`start_color`." msgstr "" -#: ../../library/curses.rst:1354 +#: ../../library/curses.rst:1375 msgid "" "The maximum number of color pairs the terminal can support. It is defined " "only after the call to :func:`start_color`." msgstr "" -#: ../../library/curses.rst:1359 +#: ../../library/curses.rst:1380 msgid "" "The width of the screen, i.e., the number of columns. It is defined only " -"after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" -"func:`resizeterm` and :func:`resize_term`." +"after the call to :func:`initscr`. Updated " +"by :func:`update_lines_cols`, :func:`resizeterm` and :func:`resize_term`." msgstr "" -#: ../../library/curses.rst:1366 +#: ../../library/curses.rst:1387 msgid "" "The height of the screen, i.e., the number of lines. It is defined only " -"after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" -"func:`resizeterm` and :func:`resize_term`." +"after the call to :func:`initscr`. Updated " +"by :func:`update_lines_cols`, :func:`resizeterm` and :func:`resize_term`." msgstr "" -#: ../../library/curses.rst:1372 +#: ../../library/curses.rst:1393 msgid "" "Some constants are available to specify character cell attributes. The exact " "constants available are system dependent." msgstr "" -#: ../../library/curses.rst:1376 +#: ../../library/curses.rst:1397 msgid "Attribute" msgstr "" -#: ../../library/curses.rst:1376 ../../library/curses.rst:1421 -#: ../../library/curses.rst:1667 ../../library/curses.rst:1759 +#: ../../library/curses.rst:1397 ../../library/curses.rst:1442 +#: ../../library/curses.rst:1688 ../../library/curses.rst:1780 msgid "Meaning" msgstr "含義" -#: ../../library/curses.rst:1378 +#: ../../library/curses.rst:1399 msgid "Alternate character set mode" msgstr "" -#: ../../library/curses.rst:1380 +#: ../../library/curses.rst:1401 msgid "Blink mode" msgstr "" -#: ../../library/curses.rst:1382 +#: ../../library/curses.rst:1403 msgid "Bold mode" msgstr "" -#: ../../library/curses.rst:1384 +#: ../../library/curses.rst:1405 msgid "Dim mode" msgstr "" -#: ../../library/curses.rst:1386 +#: ../../library/curses.rst:1407 msgid "Invisible or blank mode" msgstr "" -#: ../../library/curses.rst:1388 +#: ../../library/curses.rst:1409 msgid "Italic mode" msgstr "" -#: ../../library/curses.rst:1390 +#: ../../library/curses.rst:1411 msgid "Normal attribute" msgstr "" -#: ../../library/curses.rst:1392 +#: ../../library/curses.rst:1413 msgid "Protected mode" msgstr "" -#: ../../library/curses.rst:1394 +#: ../../library/curses.rst:1415 msgid "Reverse background and foreground colors" msgstr "" -#: ../../library/curses.rst:1397 +#: ../../library/curses.rst:1418 msgid "Standout mode" msgstr "" -#: ../../library/curses.rst:1399 +#: ../../library/curses.rst:1420 msgid "Underline mode" msgstr "" -#: ../../library/curses.rst:1401 +#: ../../library/curses.rst:1422 msgid "Horizontal highlight" msgstr "" -#: ../../library/curses.rst:1403 +#: ../../library/curses.rst:1424 msgid "Left highlight" msgstr "" -#: ../../library/curses.rst:1405 +#: ../../library/curses.rst:1426 msgid "Low highlight" msgstr "" -#: ../../library/curses.rst:1407 +#: ../../library/curses.rst:1428 msgid "Right highlight" msgstr "" -#: ../../library/curses.rst:1409 +#: ../../library/curses.rst:1430 msgid "Top highlight" msgstr "" -#: ../../library/curses.rst:1411 +#: ../../library/curses.rst:1432 msgid "Vertical highlight" msgstr "" -#: ../../library/curses.rst:1414 +#: ../../library/curses.rst:1435 msgid "``A_ITALIC`` was added." msgstr "" -#: ../../library/curses.rst:1417 +#: ../../library/curses.rst:1438 msgid "" "Several constants are available to extract corresponding attributes returned " "by some methods." msgstr "" -#: ../../library/curses.rst:1421 +#: ../../library/curses.rst:1442 msgid "Bit-mask" msgstr "" -#: ../../library/curses.rst:1423 +#: ../../library/curses.rst:1444 msgid "Bit-mask to extract attributes" msgstr "" -#: ../../library/curses.rst:1426 +#: ../../library/curses.rst:1447 msgid "Bit-mask to extract a character" msgstr "" -#: ../../library/curses.rst:1429 +#: ../../library/curses.rst:1450 msgid "Bit-mask to extract color-pair field information" msgstr "" -#: ../../library/curses.rst:1433 +#: ../../library/curses.rst:1454 msgid "" "Keys are referred to by integer constants with names starting with " "``KEY_``. The exact keycaps available are system dependent." msgstr "" -#: ../../library/curses.rst:1439 +#: ../../library/curses.rst:1460 msgid "Key constant" msgstr "" -#: ../../library/curses.rst:1439 +#: ../../library/curses.rst:1460 msgid "Key" msgstr "" -#: ../../library/curses.rst:1441 +#: ../../library/curses.rst:1462 msgid "Minimum key value" msgstr "" -#: ../../library/curses.rst:1443 +#: ../../library/curses.rst:1464 msgid "Break key (unreliable)" msgstr "" -#: ../../library/curses.rst:1445 +#: ../../library/curses.rst:1466 msgid "Down-arrow" msgstr "" -#: ../../library/curses.rst:1447 +#: ../../library/curses.rst:1468 msgid "Up-arrow" msgstr "" -#: ../../library/curses.rst:1449 +#: ../../library/curses.rst:1470 msgid "Left-arrow" msgstr "" -#: ../../library/curses.rst:1451 +#: ../../library/curses.rst:1472 msgid "Right-arrow" msgstr "" -#: ../../library/curses.rst:1453 +#: ../../library/curses.rst:1474 msgid "Home key (upward+left arrow)" msgstr "" -#: ../../library/curses.rst:1455 +#: ../../library/curses.rst:1476 msgid "Backspace (unreliable)" msgstr "" -#: ../../library/curses.rst:1457 +#: ../../library/curses.rst:1478 msgid "Function keys. Up to 64 function keys are supported." msgstr "" -#: ../../library/curses.rst:1460 +#: ../../library/curses.rst:1481 msgid "Value of function key *n*" msgstr "" -#: ../../library/curses.rst:1462 +#: ../../library/curses.rst:1483 msgid "Delete line" msgstr "" -#: ../../library/curses.rst:1464 +#: ../../library/curses.rst:1485 msgid "Insert line" msgstr "" -#: ../../library/curses.rst:1466 +#: ../../library/curses.rst:1487 msgid "Delete character" msgstr "" -#: ../../library/curses.rst:1468 +#: ../../library/curses.rst:1489 msgid "Insert char or enter insert mode" msgstr "" -#: ../../library/curses.rst:1470 +#: ../../library/curses.rst:1491 msgid "Exit insert char mode" msgstr "" -#: ../../library/curses.rst:1472 +#: ../../library/curses.rst:1493 msgid "Clear screen" msgstr "" -#: ../../library/curses.rst:1474 +#: ../../library/curses.rst:1495 msgid "Clear to end of screen" msgstr "" -#: ../../library/curses.rst:1476 +#: ../../library/curses.rst:1497 msgid "Clear to end of line" msgstr "" -#: ../../library/curses.rst:1478 +#: ../../library/curses.rst:1499 msgid "Scroll 1 line forward" msgstr "" -#: ../../library/curses.rst:1480 +#: ../../library/curses.rst:1501 msgid "Scroll 1 line backward (reverse)" msgstr "" -#: ../../library/curses.rst:1482 +#: ../../library/curses.rst:1503 msgid "Next page" msgstr "" -#: ../../library/curses.rst:1484 +#: ../../library/curses.rst:1505 msgid "Previous page" msgstr "" -#: ../../library/curses.rst:1486 +#: ../../library/curses.rst:1507 msgid "Set tab" msgstr "" -#: ../../library/curses.rst:1488 +#: ../../library/curses.rst:1509 msgid "Clear tab" msgstr "" -#: ../../library/curses.rst:1490 +#: ../../library/curses.rst:1511 msgid "Clear all tabs" msgstr "" -#: ../../library/curses.rst:1492 +#: ../../library/curses.rst:1513 msgid "Enter or send (unreliable)" msgstr "" -#: ../../library/curses.rst:1494 +#: ../../library/curses.rst:1515 msgid "Soft (partial) reset (unreliable)" msgstr "" -#: ../../library/curses.rst:1496 +#: ../../library/curses.rst:1517 msgid "Reset or hard reset (unreliable)" msgstr "" -#: ../../library/curses.rst:1498 +#: ../../library/curses.rst:1519 msgid "Print" msgstr "" -#: ../../library/curses.rst:1500 +#: ../../library/curses.rst:1521 msgid "Home down or bottom (lower left)" msgstr "" -#: ../../library/curses.rst:1502 +#: ../../library/curses.rst:1523 msgid "Upper left of keypad" msgstr "" -#: ../../library/curses.rst:1504 +#: ../../library/curses.rst:1525 msgid "Upper right of keypad" msgstr "" -#: ../../library/curses.rst:1506 +#: ../../library/curses.rst:1527 msgid "Center of keypad" msgstr "" -#: ../../library/curses.rst:1508 +#: ../../library/curses.rst:1529 msgid "Lower left of keypad" msgstr "" -#: ../../library/curses.rst:1510 +#: ../../library/curses.rst:1531 msgid "Lower right of keypad" msgstr "" -#: ../../library/curses.rst:1512 +#: ../../library/curses.rst:1533 msgid "Back tab" msgstr "" -#: ../../library/curses.rst:1514 +#: ../../library/curses.rst:1535 msgid "Beg (beginning)" msgstr "" -#: ../../library/curses.rst:1516 +#: ../../library/curses.rst:1537 msgid "Cancel" msgstr "" -#: ../../library/curses.rst:1518 +#: ../../library/curses.rst:1539 msgid "Close" msgstr "" -#: ../../library/curses.rst:1520 +#: ../../library/curses.rst:1541 msgid "Cmd (command)" msgstr "" -#: ../../library/curses.rst:1522 +#: ../../library/curses.rst:1543 msgid "Copy" msgstr "" -#: ../../library/curses.rst:1524 +#: ../../library/curses.rst:1545 msgid "Create" msgstr "" -#: ../../library/curses.rst:1526 +#: ../../library/curses.rst:1547 msgid "End" msgstr "" -#: ../../library/curses.rst:1528 +#: ../../library/curses.rst:1549 msgid "Exit" msgstr "" -#: ../../library/curses.rst:1530 +#: ../../library/curses.rst:1551 msgid "Find" msgstr "" -#: ../../library/curses.rst:1532 +#: ../../library/curses.rst:1553 msgid "Help" msgstr "" -#: ../../library/curses.rst:1534 +#: ../../library/curses.rst:1555 msgid "Mark" msgstr "" -#: ../../library/curses.rst:1536 +#: ../../library/curses.rst:1557 msgid "Message" msgstr "" -#: ../../library/curses.rst:1538 +#: ../../library/curses.rst:1559 msgid "Move" msgstr "" -#: ../../library/curses.rst:1540 +#: ../../library/curses.rst:1561 msgid "Next" msgstr "" -#: ../../library/curses.rst:1542 +#: ../../library/curses.rst:1563 msgid "Open" msgstr "" -#: ../../library/curses.rst:1544 +#: ../../library/curses.rst:1565 msgid "Options" msgstr "" -#: ../../library/curses.rst:1546 +#: ../../library/curses.rst:1567 msgid "Prev (previous)" msgstr "" -#: ../../library/curses.rst:1548 +#: ../../library/curses.rst:1569 msgid "Redo" msgstr "" -#: ../../library/curses.rst:1550 +#: ../../library/curses.rst:1571 msgid "Ref (reference)" msgstr "" -#: ../../library/curses.rst:1552 +#: ../../library/curses.rst:1573 msgid "Refresh" msgstr "" -#: ../../library/curses.rst:1554 +#: ../../library/curses.rst:1575 msgid "Replace" msgstr "" -#: ../../library/curses.rst:1556 +#: ../../library/curses.rst:1577 msgid "Restart" msgstr "" -#: ../../library/curses.rst:1558 +#: ../../library/curses.rst:1579 msgid "Resume" msgstr "" -#: ../../library/curses.rst:1560 +#: ../../library/curses.rst:1581 msgid "Save" msgstr "" -#: ../../library/curses.rst:1562 +#: ../../library/curses.rst:1583 msgid "Shifted Beg (beginning)" msgstr "" -#: ../../library/curses.rst:1564 +#: ../../library/curses.rst:1585 msgid "Shifted Cancel" msgstr "" -#: ../../library/curses.rst:1566 +#: ../../library/curses.rst:1587 msgid "Shifted Command" msgstr "" -#: ../../library/curses.rst:1568 +#: ../../library/curses.rst:1589 msgid "Shifted Copy" msgstr "" -#: ../../library/curses.rst:1570 +#: ../../library/curses.rst:1591 msgid "Shifted Create" msgstr "" -#: ../../library/curses.rst:1572 +#: ../../library/curses.rst:1593 msgid "Shifted Delete char" msgstr "" -#: ../../library/curses.rst:1574 +#: ../../library/curses.rst:1595 msgid "Shifted Delete line" msgstr "" -#: ../../library/curses.rst:1576 +#: ../../library/curses.rst:1597 msgid "Select" msgstr "" -#: ../../library/curses.rst:1578 +#: ../../library/curses.rst:1599 msgid "Shifted End" msgstr "" -#: ../../library/curses.rst:1580 +#: ../../library/curses.rst:1601 msgid "Shifted Clear line" msgstr "" -#: ../../library/curses.rst:1582 +#: ../../library/curses.rst:1603 msgid "Shifted Exit" msgstr "" -#: ../../library/curses.rst:1584 +#: ../../library/curses.rst:1605 msgid "Shifted Find" msgstr "" -#: ../../library/curses.rst:1586 +#: ../../library/curses.rst:1607 msgid "Shifted Help" msgstr "" -#: ../../library/curses.rst:1588 +#: ../../library/curses.rst:1609 msgid "Shifted Home" msgstr "" -#: ../../library/curses.rst:1590 +#: ../../library/curses.rst:1611 msgid "Shifted Input" msgstr "" -#: ../../library/curses.rst:1592 +#: ../../library/curses.rst:1613 msgid "Shifted Left arrow" msgstr "" -#: ../../library/curses.rst:1594 +#: ../../library/curses.rst:1615 msgid "Shifted Message" msgstr "" -#: ../../library/curses.rst:1596 +#: ../../library/curses.rst:1617 msgid "Shifted Move" msgstr "" -#: ../../library/curses.rst:1598 +#: ../../library/curses.rst:1619 msgid "Shifted Next" msgstr "" -#: ../../library/curses.rst:1600 +#: ../../library/curses.rst:1621 msgid "Shifted Options" msgstr "" -#: ../../library/curses.rst:1602 +#: ../../library/curses.rst:1623 msgid "Shifted Prev" msgstr "" -#: ../../library/curses.rst:1604 +#: ../../library/curses.rst:1625 msgid "Shifted Print" msgstr "" -#: ../../library/curses.rst:1606 +#: ../../library/curses.rst:1627 msgid "Shifted Redo" msgstr "" -#: ../../library/curses.rst:1608 +#: ../../library/curses.rst:1629 msgid "Shifted Replace" msgstr "" -#: ../../library/curses.rst:1610 +#: ../../library/curses.rst:1631 msgid "Shifted Right arrow" msgstr "" -#: ../../library/curses.rst:1612 +#: ../../library/curses.rst:1633 msgid "Shifted Resume" msgstr "" -#: ../../library/curses.rst:1614 +#: ../../library/curses.rst:1635 msgid "Shifted Save" msgstr "" -#: ../../library/curses.rst:1616 +#: ../../library/curses.rst:1637 msgid "Shifted Suspend" msgstr "" -#: ../../library/curses.rst:1618 +#: ../../library/curses.rst:1639 msgid "Shifted Undo" msgstr "" -#: ../../library/curses.rst:1620 +#: ../../library/curses.rst:1641 msgid "Suspend" msgstr "" -#: ../../library/curses.rst:1622 +#: ../../library/curses.rst:1643 msgid "Undo" msgstr "" -#: ../../library/curses.rst:1624 +#: ../../library/curses.rst:1645 msgid "Mouse event has occurred" msgstr "" -#: ../../library/curses.rst:1626 +#: ../../library/curses.rst:1647 msgid "Terminal resize event" msgstr "" -#: ../../library/curses.rst:1628 +#: ../../library/curses.rst:1649 msgid "Maximum key value" msgstr "" -#: ../../library/curses.rst:1631 +#: ../../library/curses.rst:1652 msgid "" "On VT100s and their software emulations, such as X terminal emulators, there " -"are normally at least four function keys (:const:`KEY_F1 `, :const:" -"`KEY_F2 `, :const:`KEY_F3 `, :const:`KEY_F4 `) " -"available, and the arrow keys mapped to :const:`KEY_UP`, :const:`KEY_DOWN`, :" -"const:`KEY_LEFT` and :const:`KEY_RIGHT` in the obvious way. If your machine " -"has a PC keyboard, it is safe to expect arrow keys and twelve function keys " -"(older PC keyboards may have only ten function keys); also, the following " -"keypad mappings are standard:" +"are normally at least four function keys (:const:`KEY_F1 " +"`, :const:`KEY_F2 `, :const:`KEY_F3 " +"`, :const:`KEY_F4 `) available, and the arrow keys mapped " +"to :const:`KEY_UP`, :const:`KEY_DOWN`, :const:`KEY_LEFT` " +"and :const:`KEY_RIGHT` in the obvious way. If your machine has a PC " +"keyboard, it is safe to expect arrow keys and twelve function keys (older PC " +"keyboards may have only ten function keys); also, the following keypad " +"mappings are standard:" msgstr "" -#: ../../library/curses.rst:1640 +#: ../../library/curses.rst:1661 msgid "Keycap" msgstr "" -#: ../../library/curses.rst:1640 ../../library/curses.rst:1785 -#: ../../library/curses.rst:1909 +#: ../../library/curses.rst:1661 ../../library/curses.rst:1806 +#: ../../library/curses.rst:1930 msgid "Constant" msgstr "" -#: ../../library/curses.rst:1642 +#: ../../library/curses.rst:1663 msgid ":kbd:`Insert`" msgstr ":kbd:`Insert`" -#: ../../library/curses.rst:1642 +#: ../../library/curses.rst:1663 msgid "KEY_IC" msgstr "KEY_IC" -#: ../../library/curses.rst:1644 +#: ../../library/curses.rst:1665 msgid ":kbd:`Delete`" msgstr ":kbd:`Delete`" -#: ../../library/curses.rst:1644 +#: ../../library/curses.rst:1665 msgid "KEY_DC" msgstr "KEY_DC" -#: ../../library/curses.rst:1646 +#: ../../library/curses.rst:1667 msgid ":kbd:`Home`" msgstr ":kbd:`Home`" -#: ../../library/curses.rst:1646 +#: ../../library/curses.rst:1667 msgid "KEY_HOME" msgstr "KEY_HOME" -#: ../../library/curses.rst:1648 +#: ../../library/curses.rst:1669 msgid ":kbd:`End`" msgstr ":kbd:`End`" -#: ../../library/curses.rst:1648 +#: ../../library/curses.rst:1669 msgid "KEY_END" msgstr "KEY_END" -#: ../../library/curses.rst:1650 +#: ../../library/curses.rst:1671 msgid ":kbd:`Page Up`" msgstr ":kbd:`Page Up`" -#: ../../library/curses.rst:1650 +#: ../../library/curses.rst:1671 msgid "KEY_PPAGE" msgstr "KEY_PPAGE" -#: ../../library/curses.rst:1652 +#: ../../library/curses.rst:1673 msgid ":kbd:`Page Down`" msgstr ":kbd:`Page Down`" -#: ../../library/curses.rst:1652 +#: ../../library/curses.rst:1673 msgid "KEY_NPAGE" msgstr "KEY_NPAGE" -#: ../../library/curses.rst:1657 +#: ../../library/curses.rst:1678 msgid "" "The following table lists characters from the alternate character set. These " "are inherited from the VT100 terminal, and will generally be available on " @@ -2100,268 +2119,268 @@ msgid "" "available, curses falls back on a crude printable ASCII approximation." msgstr "" -#: ../../library/curses.rst:1664 +#: ../../library/curses.rst:1685 msgid "These are available only after :func:`initscr` has been called." msgstr "" -#: ../../library/curses.rst:1667 +#: ../../library/curses.rst:1688 msgid "ACS code" msgstr "" -#: ../../library/curses.rst:1669 +#: ../../library/curses.rst:1690 msgid "alternate name for upper right corner" msgstr "" -#: ../../library/curses.rst:1671 +#: ../../library/curses.rst:1692 msgid "solid square block" msgstr "" -#: ../../library/curses.rst:1673 +#: ../../library/curses.rst:1694 msgid "board of squares" msgstr "" -#: ../../library/curses.rst:1675 +#: ../../library/curses.rst:1696 msgid "alternate name for horizontal line" msgstr "" -#: ../../library/curses.rst:1677 +#: ../../library/curses.rst:1698 msgid "alternate name for upper left corner" msgstr "" -#: ../../library/curses.rst:1679 +#: ../../library/curses.rst:1700 msgid "alternate name for top tee" msgstr "" -#: ../../library/curses.rst:1681 +#: ../../library/curses.rst:1702 msgid "bottom tee" msgstr "" -#: ../../library/curses.rst:1683 +#: ../../library/curses.rst:1704 msgid "bullet" msgstr "" -#: ../../library/curses.rst:1685 +#: ../../library/curses.rst:1706 msgid "checker board (stipple)" msgstr "" -#: ../../library/curses.rst:1687 +#: ../../library/curses.rst:1708 msgid "arrow pointing down" msgstr "" -#: ../../library/curses.rst:1689 +#: ../../library/curses.rst:1710 msgid "degree symbol" msgstr "" -#: ../../library/curses.rst:1691 +#: ../../library/curses.rst:1712 msgid "diamond" msgstr "" -#: ../../library/curses.rst:1693 +#: ../../library/curses.rst:1714 msgid "greater-than-or-equal-to" msgstr "" -#: ../../library/curses.rst:1695 +#: ../../library/curses.rst:1716 msgid "horizontal line" msgstr "" -#: ../../library/curses.rst:1697 +#: ../../library/curses.rst:1718 msgid "lantern symbol" msgstr "" -#: ../../library/curses.rst:1699 +#: ../../library/curses.rst:1720 msgid "left arrow" msgstr "" -#: ../../library/curses.rst:1701 +#: ../../library/curses.rst:1722 msgid "less-than-or-equal-to" msgstr "" -#: ../../library/curses.rst:1703 +#: ../../library/curses.rst:1724 msgid "lower left-hand corner" msgstr "" -#: ../../library/curses.rst:1705 +#: ../../library/curses.rst:1726 msgid "lower right-hand corner" msgstr "" -#: ../../library/curses.rst:1707 +#: ../../library/curses.rst:1728 msgid "left tee" msgstr "" -#: ../../library/curses.rst:1709 +#: ../../library/curses.rst:1730 msgid "not-equal sign" msgstr "" -#: ../../library/curses.rst:1711 +#: ../../library/curses.rst:1732 msgid "letter pi" msgstr "" -#: ../../library/curses.rst:1713 +#: ../../library/curses.rst:1734 msgid "plus-or-minus sign" msgstr "" -#: ../../library/curses.rst:1715 +#: ../../library/curses.rst:1736 msgid "big plus sign" msgstr "" -#: ../../library/curses.rst:1717 +#: ../../library/curses.rst:1738 msgid "right arrow" msgstr "" -#: ../../library/curses.rst:1719 +#: ../../library/curses.rst:1740 msgid "right tee" msgstr "" -#: ../../library/curses.rst:1721 +#: ../../library/curses.rst:1742 msgid "scan line 1" msgstr "" -#: ../../library/curses.rst:1723 +#: ../../library/curses.rst:1744 msgid "scan line 3" msgstr "" -#: ../../library/curses.rst:1725 +#: ../../library/curses.rst:1746 msgid "scan line 7" msgstr "" -#: ../../library/curses.rst:1727 +#: ../../library/curses.rst:1748 msgid "scan line 9" msgstr "" -#: ../../library/curses.rst:1729 +#: ../../library/curses.rst:1750 msgid "alternate name for lower right corner" msgstr "" -#: ../../library/curses.rst:1731 +#: ../../library/curses.rst:1752 msgid "alternate name for vertical line" msgstr "" -#: ../../library/curses.rst:1733 +#: ../../library/curses.rst:1754 msgid "alternate name for right tee" msgstr "" -#: ../../library/curses.rst:1735 +#: ../../library/curses.rst:1756 msgid "alternate name for lower left corner" msgstr "" -#: ../../library/curses.rst:1737 +#: ../../library/curses.rst:1758 msgid "alternate name for bottom tee" msgstr "" -#: ../../library/curses.rst:1739 +#: ../../library/curses.rst:1760 msgid "alternate name for left tee" msgstr "" -#: ../../library/curses.rst:1741 +#: ../../library/curses.rst:1762 msgid "alternate name for crossover or big plus" msgstr "" -#: ../../library/curses.rst:1743 +#: ../../library/curses.rst:1764 msgid "pound sterling" msgstr "" -#: ../../library/curses.rst:1745 +#: ../../library/curses.rst:1766 msgid "top tee" msgstr "" -#: ../../library/curses.rst:1747 +#: ../../library/curses.rst:1768 msgid "up arrow" msgstr "" -#: ../../library/curses.rst:1749 +#: ../../library/curses.rst:1770 msgid "upper left corner" msgstr "" -#: ../../library/curses.rst:1751 +#: ../../library/curses.rst:1772 msgid "upper right corner" msgstr "" -#: ../../library/curses.rst:1753 +#: ../../library/curses.rst:1774 msgid "vertical line" msgstr "" -#: ../../library/curses.rst:1756 +#: ../../library/curses.rst:1777 msgid "" "The following table lists mouse button constants used by :meth:`getmouse`:" msgstr "" -#: ../../library/curses.rst:1759 +#: ../../library/curses.rst:1780 msgid "Mouse button constant" msgstr "" -#: ../../library/curses.rst:1761 +#: ../../library/curses.rst:1782 msgid "Mouse button *n* pressed" msgstr "" -#: ../../library/curses.rst:1763 +#: ../../library/curses.rst:1784 msgid "Mouse button *n* released" msgstr "" -#: ../../library/curses.rst:1765 +#: ../../library/curses.rst:1786 msgid "Mouse button *n* clicked" msgstr "" -#: ../../library/curses.rst:1767 +#: ../../library/curses.rst:1788 msgid "Mouse button *n* double clicked" msgstr "" -#: ../../library/curses.rst:1769 +#: ../../library/curses.rst:1790 msgid "Mouse button *n* triple clicked" msgstr "" -#: ../../library/curses.rst:1771 +#: ../../library/curses.rst:1792 msgid "Shift was down during button state change" msgstr "" -#: ../../library/curses.rst:1773 ../../library/curses.rst:1775 +#: ../../library/curses.rst:1794 ../../library/curses.rst:1796 msgid "Control was down during button state change" msgstr "" -#: ../../library/curses.rst:1782 +#: ../../library/curses.rst:1803 msgid "The following table lists the predefined colors:" msgstr "" -#: ../../library/curses.rst:1785 +#: ../../library/curses.rst:1806 msgid "Color" msgstr "顏色" -#: ../../library/curses.rst:1787 +#: ../../library/curses.rst:1808 msgid "Black" msgstr "黑" -#: ../../library/curses.rst:1789 +#: ../../library/curses.rst:1810 msgid "Blue" msgstr "藍" -#: ../../library/curses.rst:1791 +#: ../../library/curses.rst:1812 msgid "Cyan (light greenish blue)" msgstr "" -#: ../../library/curses.rst:1793 +#: ../../library/curses.rst:1814 msgid "Green" msgstr "綠" -#: ../../library/curses.rst:1795 +#: ../../library/curses.rst:1816 msgid "Magenta (purplish red)" msgstr "" -#: ../../library/curses.rst:1797 +#: ../../library/curses.rst:1818 msgid "Red" msgstr "紅" -#: ../../library/curses.rst:1799 +#: ../../library/curses.rst:1820 msgid "White" msgstr "白" -#: ../../library/curses.rst:1801 +#: ../../library/curses.rst:1822 msgid "Yellow" msgstr "" -#: ../../library/curses.rst:1806 +#: ../../library/curses.rst:1827 msgid ":mod:`curses.textpad` --- Text input widget for curses programs" msgstr "" -#: ../../library/curses.rst:1814 +#: ../../library/curses.rst:1835 msgid "" "The :mod:`curses.textpad` module provides a :class:`Textbox` class that " "handles elementary text editing in a curses window, supporting a set of " @@ -2371,11 +2390,11 @@ msgid "" "purposes." msgstr "" -#: ../../library/curses.rst:1820 +#: ../../library/curses.rst:1841 msgid "The module :mod:`curses.textpad` defines the following function:" msgstr ":mod:`curses.textpad` 模組定義了以下函式:" -#: ../../library/curses.rst:1825 +#: ../../library/curses.rst:1846 msgid "" "Draw a rectangle. The first argument must be a window object; the remaining " "arguments are coordinates relative to that window. The second and third " @@ -2387,199 +2406,199 @@ msgid "" "will be drawn with ASCII dashes, vertical bars, and plus signs." msgstr "" -#: ../../library/curses.rst:1838 +#: ../../library/curses.rst:1859 msgid "Textbox objects" msgstr "" -#: ../../library/curses.rst:1840 +#: ../../library/curses.rst:1861 msgid "You can instantiate a :class:`Textbox` object as follows:" msgstr "" -#: ../../library/curses.rst:1845 +#: ../../library/curses.rst:1866 msgid "" -"Return a textbox widget object. The *win* argument should be a curses :ref:" -"`window ` object in which the textbox is to be " -"contained. The edit cursor of the textbox is initially located at the upper " -"left hand corner of the containing window, with coordinates ``(0, 0)``. The " -"instance's :attr:`stripspaces` flag is initially on." +"Return a textbox widget object. The *win* argument should be a " +"curses :ref:`window ` object in which the textbox is " +"to be contained. The edit cursor of the textbox is initially located at the " +"upper left hand corner of the containing window, with coordinates ``(0, " +"0)``. The instance's :attr:`stripspaces` flag is initially on." msgstr "" -#: ../../library/curses.rst:1851 +#: ../../library/curses.rst:1872 msgid ":class:`Textbox` objects have the following methods:" msgstr "" -#: ../../library/curses.rst:1856 +#: ../../library/curses.rst:1877 msgid "" "This is the entry point you will normally use. It accepts editing " "keystrokes until one of the termination keystrokes is entered. If " "*validator* is supplied, it must be a function. It will be called for each " "keystroke entered with the keystroke as a parameter; command dispatch is " "done on the result. This method returns the window contents as a string; " -"whether blanks in the window are included is affected by the :attr:" -"`stripspaces` attribute." +"whether blanks in the window are included is affected by " +"the :attr:`stripspaces` attribute." msgstr "" -#: ../../library/curses.rst:1867 +#: ../../library/curses.rst:1888 msgid "" "Process a single command keystroke. Here are the supported special " "keystrokes:" msgstr "" -#: ../../library/curses.rst:1871 ../../library/curses.rst:1909 +#: ../../library/curses.rst:1892 ../../library/curses.rst:1930 msgid "Keystroke" msgstr "" -#: ../../library/curses.rst:1871 +#: ../../library/curses.rst:1892 msgid "Action" msgstr "" -#: ../../library/curses.rst:1873 +#: ../../library/curses.rst:1894 msgid ":kbd:`Control-A`" msgstr ":kbd:`Control-A`" -#: ../../library/curses.rst:1873 +#: ../../library/curses.rst:1894 msgid "Go to left edge of window." msgstr "" -#: ../../library/curses.rst:1875 ../../library/curses.rst:1911 +#: ../../library/curses.rst:1896 ../../library/curses.rst:1932 msgid ":kbd:`Control-B`" msgstr ":kbd:`Control-B`" -#: ../../library/curses.rst:1875 +#: ../../library/curses.rst:1896 msgid "Cursor left, wrapping to previous line if appropriate." msgstr "" -#: ../../library/curses.rst:1878 +#: ../../library/curses.rst:1899 msgid ":kbd:`Control-D`" msgstr ":kbd:`Control-D`" -#: ../../library/curses.rst:1878 +#: ../../library/curses.rst:1899 msgid "Delete character under cursor." msgstr "" -#: ../../library/curses.rst:1880 +#: ../../library/curses.rst:1901 msgid ":kbd:`Control-E`" msgstr ":kbd:`Control-E`" -#: ../../library/curses.rst:1880 +#: ../../library/curses.rst:1901 msgid "Go to right edge (stripspaces off) or end of line (stripspaces on)." msgstr "" -#: ../../library/curses.rst:1883 ../../library/curses.rst:1913 +#: ../../library/curses.rst:1904 ../../library/curses.rst:1934 msgid ":kbd:`Control-F`" msgstr ":kbd:`Control-F`" -#: ../../library/curses.rst:1883 +#: ../../library/curses.rst:1904 msgid "Cursor right, wrapping to next line when appropriate." msgstr "" -#: ../../library/curses.rst:1886 +#: ../../library/curses.rst:1907 msgid ":kbd:`Control-G`" msgstr ":kbd:`Control-G`" -#: ../../library/curses.rst:1886 +#: ../../library/curses.rst:1907 msgid "Terminate, returning the window contents." msgstr "" -#: ../../library/curses.rst:1888 +#: ../../library/curses.rst:1909 msgid ":kbd:`Control-H`" msgstr ":kbd:`Control-H`" -#: ../../library/curses.rst:1888 +#: ../../library/curses.rst:1909 msgid "Delete character backward." msgstr "" -#: ../../library/curses.rst:1890 +#: ../../library/curses.rst:1911 msgid ":kbd:`Control-J`" msgstr ":kbd:`Control-J`" -#: ../../library/curses.rst:1890 +#: ../../library/curses.rst:1911 msgid "Terminate if the window is 1 line, otherwise insert newline." msgstr "" -#: ../../library/curses.rst:1893 +#: ../../library/curses.rst:1914 msgid ":kbd:`Control-K`" msgstr ":kbd:`Control-K`" -#: ../../library/curses.rst:1893 +#: ../../library/curses.rst:1914 msgid "If line is blank, delete it, otherwise clear to end of line." msgstr "" -#: ../../library/curses.rst:1896 +#: ../../library/curses.rst:1917 msgid ":kbd:`Control-L`" msgstr ":kbd:`Control-L`" -#: ../../library/curses.rst:1896 +#: ../../library/curses.rst:1917 msgid "Refresh screen." msgstr "" -#: ../../library/curses.rst:1898 ../../library/curses.rst:1917 +#: ../../library/curses.rst:1919 ../../library/curses.rst:1938 msgid ":kbd:`Control-N`" msgstr ":kbd:`Control-N`" -#: ../../library/curses.rst:1898 +#: ../../library/curses.rst:1919 msgid "Cursor down; move down one line." msgstr "" -#: ../../library/curses.rst:1900 +#: ../../library/curses.rst:1921 msgid ":kbd:`Control-O`" msgstr ":kbd:`Control-O`" -#: ../../library/curses.rst:1900 +#: ../../library/curses.rst:1921 msgid "Insert a blank line at cursor location." msgstr "" -#: ../../library/curses.rst:1902 ../../library/curses.rst:1915 +#: ../../library/curses.rst:1923 ../../library/curses.rst:1936 msgid ":kbd:`Control-P`" msgstr ":kbd:`Control-P`" -#: ../../library/curses.rst:1902 +#: ../../library/curses.rst:1923 msgid "Cursor up; move up one line." msgstr "" -#: ../../library/curses.rst:1905 +#: ../../library/curses.rst:1926 msgid "" "Move operations do nothing if the cursor is at an edge where the movement is " "not possible. The following synonyms are supported where possible:" msgstr "" -#: ../../library/curses.rst:1911 +#: ../../library/curses.rst:1932 msgid ":const:`~curses.KEY_LEFT`" msgstr ":const:`~curses.KEY_LEFT`" -#: ../../library/curses.rst:1913 +#: ../../library/curses.rst:1934 msgid ":const:`~curses.KEY_RIGHT`" msgstr ":const:`~curses.KEY_RIGHT`" -#: ../../library/curses.rst:1915 +#: ../../library/curses.rst:1936 msgid ":const:`~curses.KEY_UP`" msgstr ":const:`~curses.KEY_UP`" -#: ../../library/curses.rst:1917 +#: ../../library/curses.rst:1938 msgid ":const:`~curses.KEY_DOWN`" msgstr ":const:`~curses.KEY_DOWN`" -#: ../../library/curses.rst:1919 +#: ../../library/curses.rst:1940 msgid ":const:`~curses.KEY_BACKSPACE`" msgstr ":const:`~curses.KEY_BACKSPACE`" -#: ../../library/curses.rst:1919 +#: ../../library/curses.rst:1940 msgid ":kbd:`Control-h`" msgstr ":kbd:`Control-h`" -#: ../../library/curses.rst:1922 +#: ../../library/curses.rst:1943 msgid "" "All other keystrokes are treated as a command to insert the given character " "and move right (with line wrapping)." msgstr "" -#: ../../library/curses.rst:1928 +#: ../../library/curses.rst:1949 msgid "" "Return the window contents as a string; whether blanks in the window are " "included is affected by the :attr:`stripspaces` member." msgstr "" -#: ../../library/curses.rst:1934 +#: ../../library/curses.rst:1955 msgid "" "This attribute is a flag which controls the interpretation of blanks in the " "window. When it is on, trailing blanks on each line are ignored; any cursor " diff --git a/library/dataclasses.po b/library/dataclasses.po index 4a2bf07608e..6bb6afd865f 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-21 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-02-11 15:02+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,9 +27,9 @@ msgstr "**原始碼:**\\ :source:`Lib/dataclasses.py`" #, fuzzy msgid "" "This module provides a decorator and functions for automatically adding " -"generated :term:`special methods ` such as :meth:`~object." -"__init__` and :meth:`~object.__repr__` to user-defined classes. It was " -"originally described in :pep:`557`." +"generated :term:`special methods ` such " +"as :meth:`~object.__init__` and :meth:`~object.__repr__` to user-defined " +"classes. It was originally described in :pep:`557`." msgstr "" "該模組提供了一個裝飾器和函式,用於自動新增生成的\\ :term:`特殊方法 `,例如 :meth:`~object.__init__` 和 :meth:`~object.__repr__` 到使用者" @@ -38,8 +38,8 @@ msgstr "" #: ../../library/dataclasses.rst:19 #, fuzzy msgid "" -"The member variables to use in these generated methods are defined using :" -"pep:`526` type annotations. For example, this code::" +"The member variables to use in these generated methods are defined " +"using :pep:`526` type annotations. For example, this code::" msgstr "" "在這些生成的方法中使用的成員變數是使用 :pep:`526` 型別註釋定義的。例如,這段" "程式碼: ::" @@ -89,8 +89,9 @@ msgstr "模組內容" #: ../../library/dataclasses.rst:51 #, fuzzy msgid "" -"This function is a :term:`decorator` that is used to add generated :term:" -"`special methods ` to classes, as described below." +"This function is a :term:`decorator` that is used to add " +"generated :term:`special methods ` to classes, as described " +"below." msgstr "" "此函式是一個 :term:`decorator`,用於將生成的\\ :term:`特殊方法 `\\新增到類別中,如下所述。" @@ -103,9 +104,9 @@ msgid "" "`. With two exceptions described below, nothing in " "``@dataclass`` examines the type specified in the variable annotation." msgstr "" -"``@dataclass`` 裝飾器檢查類別以找到 ``field``\\s。 ``field`` 被定義為具有 :" -"term:`type annotation ` 的類別變數。除了下面描述的兩個例" -"外,``@dataclass`` 中沒有任何內容檢查變數註釋中指定的型別。" +"``@dataclass`` 裝飾器檢查類別以找到 ``field``\\s。 ``field`` 被定義為具" +"有 :term:`type annotation ` 的類別變數。除了下面描述的兩" +"個例外,``@dataclass`` 中沒有任何內容檢查變數註釋中指定的型別。" #: ../../library/dataclasses.rst:60 #, fuzzy @@ -222,32 +223,35 @@ msgstr "如果該類別已經定義了 :meth:`!__eq__`,則此參數會被忽 #: ../../library/dataclasses.rst:113 #, fuzzy msgid "" -"*order*: If true (the default is ``False``), :meth:`~object.__lt__`, :meth:" -"`~object.__le__`, :meth:`~object.__gt__`, and :meth:`~object.__ge__` methods " -"will be generated. These compare the class as if it were a tuple of its " -"fields, in order. Both instances in the comparison must be of the identical " -"type. If *order* is true and *eq* is false, a :exc:`ValueError` is raised." +"*order*: If true (the default is " +"``False``), :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " +"and :meth:`~object.__ge__` methods will be generated. These compare the " +"class as if it were a tuple of its fields, in order. Both instances in the " +"comparison must be of the identical type. If *order* is true and *eq* is " +"false, a :exc:`ValueError` is raised." msgstr "" -"*order*:如果為真(預設為 ``False``),:meth:`~object.__lt__`、:meth:" -"`~object.__le__`、:meth:`~object.__gt__` 和 :meth:`~object.__ge__` 方法將是產" -"生。它們按順序比較類別,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於" -"同一型別。如果 *order* 為真且 *eq* 為假,則會引發 :exc:`ValueError`。" +"*order*:如果為真(預設為 " +"``False``),:meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object.__gt__` " +"和 :meth:`~object.__ge__` 方法將是產生。它們按順序比較類別,就好像它是其欄位" +"的元組一樣。比較中的兩個實例必須屬於同一型別。如果 *order* 為真且 *eq* 為假," +"則會引發 :exc:`ValueError`。" #: ../../library/dataclasses.rst:120 msgid "" -"If the class already defines any of :meth:`!__lt__`, :meth:`!__le__`, :meth:" -"`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is raised." +"If the class already defines any of :meth:`!__lt__`, :meth:`!" +"__le__`, :meth:`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is " +"raised." msgstr "" -"如果該類別已經定義了 :meth:`!__lt__`、:meth:`!__le__`、:meth:`!__gt__` 或 :" -"meth:`!__ge__` 中的任何一個,則引發 :exc:`TypeError`。" +"如果該類別已經定義了 :meth:`!__lt__`、:meth:`!__le__`、:meth:`!__gt__` " +"或 :meth:`!__ge__` 中的任何一個,則引發 :exc:`TypeError`。" #: ../../library/dataclasses.rst:124 #, fuzzy msgid "" -"*unsafe_hash*: If true, force ``dataclasses`` to create a :meth:`~object." -"__hash__` method, even though it may not be safe to do so. Otherwise, " -"generate a :meth:`~object.__hash__` method according to how *eq* and " -"*frozen* are set. The default value is ``False``." +"*unsafe_hash*: If true, force ``dataclasses`` to create " +"a :meth:`~object.__hash__` method, even though it may not be safe to do so. " +"Otherwise, generate a :meth:`~object.__hash__` method according to how *eq* " +"and *frozen* are set. The default value is ``False``." msgstr "" "*unsafe_hash*:如果 ``False``(預設值),將根據 *eq* 和 *frozen* 的設定生成一" "個 :meth:`~object.__hash__` 方法。" @@ -270,11 +274,11 @@ msgstr "" #: ../../library/dataclasses.rst:137 #, fuzzy msgid "" -"By default, ``@dataclass`` will not implicitly add a :meth:`~object." -"__hash__` method unless it is safe to do so. Neither will it add or change " -"an existing explicitly defined :meth:`!__hash__` method. Setting the class " -"attribute ``__hash__ = None`` has a specific meaning to Python, as described " -"in the :meth:`!__hash__` documentation." +"By default, ``@dataclass`` will not implicitly add " +"a :meth:`~object.__hash__` method unless it is safe to do so. Neither will " +"it add or change an existing explicitly defined :meth:`!__hash__` method. " +"Setting the class attribute ``__hash__ = None`` has a specific meaning to " +"Python, as described in the :meth:`!__hash__` documentation." msgstr "" "預設情況下,``@dataclass`` 不會隱式新增 :meth:`~object.__hash__` 方法,除非這" "樣做是安全的。它也不會新增或更改現有的明確定義的 :meth:`!__hash__` 方法。設定" @@ -302,35 +306,35 @@ msgstr "" msgid "" "Here are the rules governing implicit creation of a :meth:`!__hash__` " "method. Note that you cannot both have an explicit :meth:`!__hash__` method " -"in your dataclass and set ``unsafe_hash=True``; this will result in a :exc:" -"`TypeError`." +"in your dataclass and set ``unsafe_hash=True``; this will result in " +"a :exc:`TypeError`." msgstr "" "以下是管理隱式建立 :meth:`!__hash__` 方法的規則。請注意,你不能在資料類別中既" -"有顯式的 :meth:`!__hash__` 方法又設定 ``unsafe_hash=True``;這將導致 :exc:" -"`TypeError`。" +"有顯式的 :meth:`!__hash__` 方法又設定 ``unsafe_hash=True``;這將導" +"致 :exc:`TypeError`。" #: ../../library/dataclasses.rst:155 msgid "" "If *eq* and *frozen* are both true, by default ``@dataclass`` will generate " -"a :meth:`!__hash__` method for you. If *eq* is true and *frozen* is false, :" -"meth:`!__hash__` will be set to ``None``, marking it unhashable (which it " -"is, since it is mutable). If *eq* is false, :meth:`!__hash__` will be left " -"untouched meaning the :meth:`!__hash__` method of the superclass will be " -"used (if the superclass is :class:`object`, this means it will fall back to " -"id-based hashing)." -msgstr "" -"如果 *eq* 和 *frozen* 都為真,預設情況下 ``@dataclass`` 會為你生成一個 :meth:" -"`!__hash__` 方法。如果 *eq* 為真且 *frozen* 為假,:meth:`!__hash__` 將被" -"設定為 ``None``,並將其標記為不可雜湊(因為它是可變的)。如果 " -"*eq* 為假,:meth:`!__hash__` 將保持不變,這意味著將使用超類別的 :meth:`!" -"__hash__` 方法(如果超類別是 :class:`object`,這意味著它將回退到基於 id 的雜湊)。" +"a :meth:`!__hash__` method for you. If *eq* is true and *frozen* is " +"false, :meth:`!__hash__` will be set to ``None``, marking it unhashable " +"(which it is, since it is mutable). If *eq* is false, :meth:`!__hash__` " +"will be left untouched meaning the :meth:`!__hash__` method of the " +"superclass will be used (if the superclass is :class:`object`, this means it " +"will fall back to id-based hashing)." +msgstr "" +"如果 *eq* 和 *frozen* 都為真,預設情況下 ``@dataclass`` 會為你生成一" +"個 :meth:`!__hash__` 方法。如果 *eq* 為真且 *frozen* 為假,:meth:`!__hash__` " +"將被設定為 ``None``,並將其標記為不可雜湊(因為它是可變的)。如果 *eq* 為" +"假,:meth:`!__hash__` 將保持不變,這意味著將使用超類別的 :meth:`!__hash__` 方" +"法(如果超類別是 :class:`object`,這意味著它將回退到基於 id 的雜湊)。" #: ../../library/dataclasses.rst:163 #, fuzzy msgid "" "*frozen*: If true (the default is ``False``), assigning to fields will " -"generate an exception. This emulates read-only frozen instances. See the :" -"ref:`discussion ` below." +"generate an exception. This emulates read-only frozen instances. See " +"the :ref:`discussion ` below." msgstr "" "*frozen*:如果為真(預設為 ``False``),分配給欄位將產生例外。這模擬了只讀的" "凍結實例。如果 :meth:`~object.__setattr__` 或 :meth:`~object.__delattr__` 在" @@ -347,11 +351,11 @@ msgstr "" #: ../../library/dataclasses.rst:170 #, fuzzy msgid "" -"*match_args*: If true (the default is ``True``), the :attr:`~object." -"__match_args__` tuple will be created from the list of non keyword-only " -"parameters to the generated :meth:`~object.__init__` method (even if :meth:`!" -"__init__` is not generated, see above). If false, or if :attr:`!" -"__match_args__` is already defined in the class, then :attr:`!" +"*match_args*: If true (the default is ``True``), " +"the :attr:`~object.__match_args__` tuple will be created from the list of " +"non keyword-only parameters to the generated :meth:`~object.__init__` method " +"(even if :meth:`!__init__` is not generated, see above). If false, or " +"if :attr:`!__match_args__` is already defined in the class, then :attr:`!" "__match_args__` will not be generated." msgstr "" "*match_args*:如果為真(預設為 ``True``),``__match_args__`` 元組將從參數列" @@ -370,10 +374,10 @@ msgid "" "the :const:`KW_ONLY` section." msgstr "" "``kw_only``:如果為 true(預設值為 ``False``),則所有欄位將被標記為僅限關鍵" -"字。如果一個欄位被標記為僅限關鍵字,那麼唯一的影響是從僅限關鍵字欄位生成的 :" -"meth:`~object.__init__` 參數必須在呼叫 :meth:`!__init__` 時指定關鍵字。對資料" -"類別的任何其他方面都沒有影響。有關詳細資訊,請參閱 :term:`parameter` 詞彙表條" -"目。另請參閱 :const:`KW_ONLY` 部分。" +"字。如果一個欄位被標記為僅限關鍵字,那麼唯一的影響是從僅限關鍵字欄位生成" +"的 :meth:`~object.__init__` 參數必須在呼叫 :meth:`!__init__` 時指定關鍵字。對" +"資料類別的任何其他方面都沒有影響。有關詳細資訊,請參閱 :term:`parameter` 詞彙" +"表條目。另請參閱 :const:`KW_ONLY` 部分。" #: ../../library/dataclasses.rst:187 msgid "Keyword-only fields are not included in :attr:`!__match_args__`." @@ -384,26 +388,14 @@ msgstr "" msgid "" "*slots*: If true (the default is ``False``), :attr:`~object.__slots__` " "attribute will be generated and new class will be returned instead of the " -"original one. If :attr:`!__slots__` is already defined in the class, then :" -"exc:`TypeError` is raised." +"original one. If :attr:`!__slots__` is already defined in the class, " +"then :exc:`TypeError` is raised." msgstr "" "``slots``:如果為 true(預設為 ``False``),將生成 :attr:`~object.__slots__` " "屬性並回傳新類別而不是原始類別。如果 :attr:`!__slots__` 已經在類別中定義," "則 :exc:`TypeError` 被引發。" #: ../../library/dataclasses.rst:197 -#, fuzzy -msgid "" -"Calling no-arg :func:`super` in dataclasses using ``slots=True`` will result " -"in the following exception being raised: ``TypeError: super(type, obj): obj " -"must be an instance or subtype of type``. The two-arg :func:`super` is a " -"valid workaround. See :gh:`90562` for full details." -msgstr "" -"``slots``:如果為 true(預設為 ``False``),將生成 :attr:`~object.__slots__` " -"屬性並回傳新類別而不是原始類別。如果 :attr:`!__slots__` 已經在類別中定義," -"則 :exc:`TypeError` 被引發。" - -#: ../../library/dataclasses.rst:204 msgid "" "Passing parameters to a base class :meth:`~object.__init_subclass__` when " "using ``slots=True`` will result in a :exc:`TypeError`. Either use " @@ -411,15 +403,15 @@ msgid "" "workaround. See :gh:`91126` for full details." msgstr "" -#: ../../library/dataclasses.rst:212 +#: ../../library/dataclasses.rst:205 #, fuzzy msgid "" "If a field name is already included in the :attr:`!__slots__` of a base " "class, it will not be included in the generated :attr:`!__slots__` to " "prevent :ref:`overriding them `. Therefore, do not " -"use :attr:`!__slots__` to retrieve the field names of a dataclass. Use :func:" -"`fields` instead. To be able to determine inherited slots, base class :attr:" -"`!__slots__` may be any iterable, but *not* an iterator." +"use :attr:`!__slots__` to retrieve the field names of a dataclass. " +"Use :func:`fields` instead. To be able to determine inherited slots, base " +"class :attr:`!__slots__` may be any iterable, but *not* an iterator." msgstr "" "如果欄位名稱已經包含在基底類別的 :attr:`!__slots__` 中,它將不會包含在生成" "的 :attr:`!__slots__` 中以防止 :ref:`覆蓋它們 `。因此," @@ -427,7 +419,7 @@ msgstr "" "夠確定繼承的插槽,基底類別 :attr:`!__slots__` 可以是任何可疊代的,但*不是*疊" "代器。" -#: ../../library/dataclasses.rst:222 +#: ../../library/dataclasses.rst:215 #, fuzzy msgid "" "*weakref_slot*: If true (the default is ``False``), add a slot named " @@ -439,14 +431,14 @@ msgstr "" "插槽,這是使實例可弱引用所必需的。在沒有指定 ``slots=True`` 的情況下指定 " "``weakref_slot=True`` 是錯誤的。" -#: ../../library/dataclasses.rst:230 +#: ../../library/dataclasses.rst:223 #, fuzzy msgid "" "``field``\\s may optionally specify a default value, using normal Python " "syntax::" msgstr "``field``\\s 可以選擇指定一個預設值,使用普通的 Python 語法: ::" -#: ../../library/dataclasses.rst:233 +#: ../../library/dataclasses.rst:226 msgid "" "@dataclass\n" "class C:\n" @@ -454,20 +446,20 @@ msgid "" " b: int = 0 # assign a default value for 'b'" msgstr "" -#: ../../library/dataclasses.rst:238 +#: ../../library/dataclasses.rst:231 #, fuzzy msgid "" "In this example, both :attr:`!a` and :attr:`!b` will be included in the " "added :meth:`~object.__init__` method, which will be defined as::" msgstr "" -"在此示例中,:attr:`!a` 和 :attr:`!b` 都將包含在新增的 :meth:`~object." -"__init__` 方法中,該方法將定義為: ::" +"在此示例中,:attr:`!a` 和 :attr:`!b` 都將包含在新增" +"的 :meth:`~object.__init__` 方法中,該方法將定義為: ::" -#: ../../library/dataclasses.rst:241 +#: ../../library/dataclasses.rst:234 msgid "def __init__(self, a: int, b: int = 0):" msgstr "def __init__(self, a: int, b: int = 0):" -#: ../../library/dataclasses.rst:243 +#: ../../library/dataclasses.rst:236 #, fuzzy msgid "" ":exc:`TypeError` will be raised if a field without a default value follows a " @@ -477,7 +469,7 @@ msgstr "" ":exc:`TypeError` 如果沒有預設值的欄位跟在具有預設值的欄位之後,將引發。無論這" "發生在單個類別中還是作為類別繼承的結果,都是如此。" -#: ../../library/dataclasses.rst:249 +#: ../../library/dataclasses.rst:242 #, fuzzy msgid "" "For common and simple use cases, no other functionality is required. There " @@ -490,7 +482,7 @@ msgstr "" "位資訊。為了滿足這種對附加資訊的需求,你可以通過呼叫提供的 :func:`!field` 函" "式來替換預設欄位值。例如: ::" -#: ../../library/dataclasses.rst:255 +#: ../../library/dataclasses.rst:248 msgid "" "@dataclass\n" "class C:\n" @@ -506,7 +498,7 @@ msgstr "" "c = C()\n" "c.mylist += [1, 2, 3]" -#: ../../library/dataclasses.rst:262 +#: ../../library/dataclasses.rst:255 #, fuzzy msgid "" "As shown above, the :const:`MISSING` value is a sentinel object used to " @@ -518,20 +510,20 @@ msgstr "" "供。使用此標記是因為 ``None`` 對於某些具有不同含義的參數是有效值。任何程式碼" "都不應直接使用 :const:`MISSING` 值。" -#: ../../library/dataclasses.rst:267 +#: ../../library/dataclasses.rst:260 msgid "The parameters to :func:`!field` are:" msgstr ":func:`!field` 的參數是:" -#: ../../library/dataclasses.rst:269 +#: ../../library/dataclasses.rst:262 msgid "" "*default*: If provided, this will be the default value for this field. This " "is needed because the :func:`!field` call itself replaces the normal " "position of the default value." msgstr "" -"*default*:如果有提供,這將是該欄位的預設值。這是必需的,因為 :meth:`!field` 呼" -"叫本身會替換預設值的正常位置。" +"*default*:如果有提供,這將是該欄位的預設值。這是必需的,因為 :meth:`!field` " +"呼叫本身會替換預設值的正常位置。" -#: ../../library/dataclasses.rst:273 +#: ../../library/dataclasses.rst:266 #, fuzzy msgid "" "*default_factory*: If provided, it must be a zero-argument callable that " @@ -544,7 +536,7 @@ msgstr "" "時將被呼叫。除其他用途外,這可用於指定具有可變預設值的欄位,如下所述。同時指" "定 *default* 和 *default_factory* 是錯誤的。" -#: ../../library/dataclasses.rst:279 +#: ../../library/dataclasses.rst:272 #, fuzzy msgid "" "*init*: If true (the default), this field is included as a parameter to the " @@ -553,7 +545,7 @@ msgstr "" "*init*:如果為 true(預設值),則此欄位將作為生成的 :meth:`~object.__init__` " "方法的參數包含在內。" -#: ../../library/dataclasses.rst:282 +#: ../../library/dataclasses.rst:275 #, fuzzy msgid "" "*repr*: If true (the default), this field is included in the string returned " @@ -562,7 +554,7 @@ msgstr "" "*repr*:如果為真(預設值),則此欄位包含在生成的 :meth:`~object.__repr__` 方" "法回傳的字串中。" -#: ../../library/dataclasses.rst:285 +#: ../../library/dataclasses.rst:278 #, fuzzy msgid "" "*hash*: This can be a bool or ``None``. If true, this field is included in " @@ -573,12 +565,12 @@ msgid "" "comparisons. Setting this value to anything other than ``None`` is " "discouraged." msgstr "" -"*hash*:這可以是 bool 或 ``None``。如果為真,則此欄位包含在生成的 :meth:" -"`__hash__` 方法中。如果 ``None``\\ (預設值),則使用\\ *比較*\\ 的值:這通常" -"是預期的行為。如果一個欄位用於比較,則應在雜湊中考慮該欄位。不鼓勵將此值設定" -"為 ``None`` 以外的任何值。" +"*hash*:這可以是 bool 或 ``None``。如果為真,則此欄位包含在生成" +"的 :meth:`__hash__` 方法中。如果 ``None``\\ (預設值),則使用\\ *比較*\\ 的" +"值:這通常是預期的行為。如果一個欄位用於比較,則應在雜湊中考慮該欄位。不鼓勵" +"將此值設定為 ``None`` 以外的任何值。" -#: ../../library/dataclasses.rst:293 +#: ../../library/dataclasses.rst:286 #, fuzzy msgid "" "One possible reason to set ``hash=False`` but ``compare=True`` would be if a " @@ -591,17 +583,17 @@ msgstr "" "湊值的成本很高,則需要該欄位進行相等性測試,並且還有其他欄位有助於型別的雜湊" "值。即使一個欄位被排除在雜湊之外,它仍然會被用於比較。" -#: ../../library/dataclasses.rst:299 +#: ../../library/dataclasses.rst:292 #, fuzzy msgid "" "*compare*: If true (the default), this field is included in the generated " -"equality and comparison methods (:meth:`~object.__eq__`, :meth:`~object." -"__gt__`, et al.)." +"equality and comparison methods " +"(:meth:`~object.__eq__`, :meth:`~object.__gt__`, et al.)." msgstr "" -"*compare*:如果為真(預設值),則此欄位包含在生成的相等和比較方法中(:meth:" -"`~object.__eq__`、:meth:`~object.__gt__` 等)。" +"*compare*:如果為真(預設值),則此欄位包含在生成的相等和比較方法中" +"(:meth:`~object.__eq__`、:meth:`~object.__gt__` 等)。" -#: ../../library/dataclasses.rst:303 +#: ../../library/dataclasses.rst:296 #, fuzzy msgid "" "*metadata*: This can be a mapping or ``None``. ``None`` is treated as an " @@ -611,25 +603,29 @@ msgid "" "mechanism. Multiple third-parties can each have their own key, to use as a " "namespace in the metadata." msgstr "" -"*metadata*:這可以是對映或無。 None 被視為空字典。此值包含在 :func:`~types." -"MappingProxyType` 中以使其成為只讀的,並暴露在 :class:`Field` 對像上。它根本" -"不被資料類別使用,而是作為第三方擴充機制提供的。多個第三方可以各自擁有自己的" -"密鑰,用作元資料中的命名空間。" +"*metadata*:這可以是對映或無。 None 被視為空字典。此值包含" +"在 :func:`~types.MappingProxyType` 中以使其成為只讀的,並暴露" +"在 :class:`Field` 對像上。它根本不被資料類別使用,而是作為第三方擴充機制提供" +"的。多個第三方可以各自擁有自己的密鑰,用作元資料中的命名空間。" -#: ../../library/dataclasses.rst:311 +#: ../../library/dataclasses.rst:304 #, fuzzy msgid "" "*kw_only*: If true, this field will be marked as keyword-only. This is used " "when the generated :meth:`~object.__init__` method's parameters are computed." msgstr "" -"*kw_only*:如果為真,該欄位將被標記為僅限關鍵字。這在計算生成的 :meth:" -"`~object.__init__` 方法的參數時使用。" +"*kw_only*:如果為真,該欄位將被標記為僅限關鍵字。這在計算生成" +"的 :meth:`~object.__init__` 方法的參數時使用。" -#: ../../library/dataclasses.rst:315 +#: ../../library/dataclasses.rst:308 msgid "Keyword-only fields are also not included in :attr:`!__match_args__`." msgstr "" -#: ../../library/dataclasses.rst:319 +#: ../../library/dataclasses.rst:312 +msgid "*doc*: optional docstring for this field." +msgstr "" + +#: ../../library/dataclasses.rst:316 #, fuzzy msgid "" "If the default value of a field is specified by a call to :func:`!field`, " @@ -645,7 +641,7 @@ msgstr "" "在 :func:`@dataclass ` 裝飾器運行後,類別屬性將全部包含欄位的預設" "值,就像預設值本身已指定一樣。例如,在: ::" -#: ../../library/dataclasses.rst:328 +#: ../../library/dataclasses.rst:325 msgid "" "@dataclass\n" "class C:\n" @@ -661,7 +657,7 @@ msgstr "" " z: int = field(repr=False, default=10)\n" " t: int = 20" -#: ../../library/dataclasses.rst:335 +#: ../../library/dataclasses.rst:332 #, fuzzy msgid "" "The class attribute :attr:`!C.z` will be ``10``, the class attribute :attr:`!" @@ -671,7 +667,7 @@ msgstr "" "類別屬性 :attr:`!C.z` 將為 ``10``,類別屬性 :attr:`!C.t` 將為 ``20``,類別屬" "性 :attr:`!C.x` 和 :attr:`!C.y` 將不會放。" -#: ../../library/dataclasses.rst:341 +#: ../../library/dataclasses.rst:338 #, fuzzy msgid "" ":class:`!Field` objects describe each defined field. These objects are " @@ -679,46 +675,47 @@ msgid "" "method (see below). Users should never instantiate a :class:`!Field` object " "directly. Its documented attributes are:" msgstr "" -":class:`!Field` 物件描述每個定義的欄位。這些對像在內部建立,並由 :func:" -"`fields` 模組級方法回傳(見下文)。使用者不應該直接實例化 :class:`!Field` 物" -"件。它記錄的屬性是:" +":class:`!Field` 物件描述每個定義的欄位。這些對像在內部建立,並" +"由 :func:`fields` 模組級方法回傳(見下文)。使用者不應該直接實例化 :class:`!" +"Field` 物件。它記錄的屬性是:" -#: ../../library/dataclasses.rst:346 +#: ../../library/dataclasses.rst:343 msgid ":attr:`!name`: The name of the field." msgstr ":attr:`!name`:欄位的名稱。" -#: ../../library/dataclasses.rst:347 +#: ../../library/dataclasses.rst:344 msgid ":attr:`!type`: The type of the field." msgstr ":attr:`!type`:欄位的型別。" -#: ../../library/dataclasses.rst:348 +#: ../../library/dataclasses.rst:345 #, fuzzy msgid "" -":attr:`!default`, :attr:`!default_factory`, :attr:`!init`, :attr:`!repr`, :" -"attr:`!hash`, :attr:`!compare`, :attr:`!metadata`, and :attr:`!kw_only` have " -"the identical meaning and values as they do in the :func:`field` function." +":attr:`!default`, :attr:`!default_factory`, :attr:`!init`, :attr:`!" +"repr`, :attr:`!hash`, :attr:`!compare`, :attr:`!metadata`, and :attr:`!" +"kw_only` have the identical meaning and values as they do in " +"the :func:`field` function." msgstr "" -":attr:`!default`、:attr:`!default_factory`、:attr:`!init`、:attr:`!repr`、:" -"attr:`!hash`、:attr:`!compare`, :attr:`!metadata` 和 :attr:`!kw_only` 有與它" -"們在 :func:`field` 函式中的含義和值相同。" +":attr:`!default`、:attr:`!default_factory`、:attr:`!init`、:attr:`!" +"repr`、:attr:`!hash`、:attr:`!compare`, :attr:`!metadata` 和 :attr:`!" +"kw_only` 有與它們在 :func:`field` 函式中的含義和值相同。" -#: ../../library/dataclasses.rst:352 +#: ../../library/dataclasses.rst:349 #, fuzzy msgid "" "Other attributes may exist, but they are private and must not be inspected " "or relied on." msgstr "可能存在其他屬性,但它們是私有的,不得檢查或依賴。" -#: ../../library/dataclasses.rst:357 +#: ../../library/dataclasses.rst:354 msgid "" "``InitVar[T]`` type annotations describe variables that are :ref:`init-only " "`. Fields annotated with :class:`!InitVar` " -"are considered pseudo-fields, and thus are neither returned by the :func:" -"`fields` function nor used in any way except adding them as parameters to :" -"meth:`~object.__init__` and an optional :meth:`__post_init__`." +"are considered pseudo-fields, and thus are neither returned by " +"the :func:`fields` function nor used in any way except adding them as " +"parameters to :meth:`~object.__init__` and an optional :meth:`__post_init__`." msgstr "" -#: ../../library/dataclasses.rst:366 +#: ../../library/dataclasses.rst:363 #, fuzzy msgid "" "Returns a tuple of :class:`Field` objects that define the fields for this " @@ -730,7 +727,7 @@ msgstr "" "實例。如果未傳遞資料類別或其中一個實例,則引發 :exc:`TypeError`。不回傳 " "``ClassVar`` 或 ``InitVar`` 的偽欄位。" -#: ../../library/dataclasses.rst:373 +#: ../../library/dataclasses.rst:370 #, fuzzy msgid "" "Converts the dataclass *obj* to a dict (by using the factory function " @@ -742,12 +739,12 @@ msgstr "" "都被轉換為其欄位的字典,作為 ``name: value`` 對。資料類別、字典、列表和元組被" "遞迴到。其他物件使用 :func:`copy.deepcopy` 複製。" -#: ../../library/dataclasses.rst:379 +#: ../../library/dataclasses.rst:376 #, fuzzy msgid "Example of using :func:`!asdict` on nested dataclasses::" msgstr "在嵌套資料類別上使用 :func:`!asdict` 的範例: ::" -#: ../../library/dataclasses.rst:381 +#: ../../library/dataclasses.rst:378 msgid "" "@dataclass\n" "class Point:\n" @@ -779,22 +776,22 @@ msgstr "" "c = C([Point(0, 0), Point(10, 4)])\n" "assert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}" -#: ../../library/dataclasses.rst:396 ../../library/dataclasses.rst:416 +#: ../../library/dataclasses.rst:393 ../../library/dataclasses.rst:413 #, fuzzy msgid "To create a shallow copy, the following workaround may be used::" msgstr "要建立淺複製,可以使用以下解決方法:" -#: ../../library/dataclasses.rst:398 +#: ../../library/dataclasses.rst:395 msgid "{field.name: getattr(obj, field.name) for field in fields(obj)}" msgstr "" -#: ../../library/dataclasses.rst:400 +#: ../../library/dataclasses.rst:397 #, fuzzy msgid "" ":func:`!asdict` raises :exc:`TypeError` if *obj* is not a dataclass instance." msgstr ":func:`!asdict` 如果 *obj* 不是資料類別實例,則引發 :exc:`TypeError`。" -#: ../../library/dataclasses.rst:405 +#: ../../library/dataclasses.rst:402 #, fuzzy msgid "" "Converts the dataclass *obj* to a tuple (by using the factory function " @@ -803,14 +800,14 @@ msgid "" "objects are copied with :func:`copy.deepcopy`." msgstr "" "將資料類別 *obj* 轉換為元組(通過使用工廠函式 *tuple_factory*)。每個資料類別" -"都被轉換為其欄位值的元組。資料類別、字典、列表和元組被遞迴到。其他物件使用 :" -"func:`copy.deepcopy` 複製。" +"都被轉換為其欄位值的元組。資料類別、字典、列表和元組被遞迴到。其他物件使" +"用 :func:`copy.deepcopy` 複製。" -#: ../../library/dataclasses.rst:411 +#: ../../library/dataclasses.rst:408 msgid "Continuing from the previous example::" msgstr "從前面的例子繼續: ::" -#: ../../library/dataclasses.rst:413 +#: ../../library/dataclasses.rst:410 msgid "" "assert astuple(p) == (10, 20)\n" "assert astuple(c) == ([(0, 0), (10, 4)],)" @@ -818,11 +815,11 @@ msgstr "" "assert astuple(p) == (10, 20)\n" "assert astuple(c) == ([(0, 0), (10, 4)],)" -#: ../../library/dataclasses.rst:418 +#: ../../library/dataclasses.rst:415 msgid "tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))" msgstr "tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))" -#: ../../library/dataclasses.rst:420 +#: ../../library/dataclasses.rst:417 #, fuzzy msgid "" ":func:`!astuple` raises :exc:`TypeError` if *obj* is not a dataclass " @@ -830,7 +827,7 @@ msgid "" msgstr "" ":func:`!astuple` 如果 *obj* 不是資料類別實例,則引發 :exc:`TypeError`。" -#: ../../library/dataclasses.rst:425 +#: ../../library/dataclasses.rst:422 #, fuzzy msgid "" "Creates a new dataclass with name *cls_name*, fields as defined in *fields*, " @@ -839,8 +836,8 @@ msgid "" "``name``, ``(name, type)``, or ``(name, type, Field)``. If just ``name`` is " "supplied, :data:`typing.Any` is used for ``type``. The values of *init*, " "*repr*, *eq*, *order*, *unsafe_hash*, *frozen*, *match_args*, *kw_only*, " -"*slots*, and *weakref_slot* have the same meaning as they do in :func:" -"`@dataclass `." +"*slots*, and *weakref_slot* have the same meaning as they do " +"in :func:`@dataclass `." msgstr "" "建立一個名為 *cls_name* 的新資料類別,欄位在 *fields* 中定義,基底類別在 " "*bases* 中給出,並使用 *namespace* 中給出的命名空間進行初始化。 ``fields`` 是" @@ -850,25 +847,33 @@ msgstr "" "``kw_only`` 的值, ``slots`` 和 ``weakref_slot`` 與它們在 :func:`dataclass` 中" "的含義相同。" -#: ../../library/dataclasses.rst:435 +#: ../../library/dataclasses.rst:432 msgid "" "If *module* is defined, the :attr:`!__module__` attribute of the dataclass " "is set to that value. By default, it is set to the module name of the caller." msgstr "" -#: ../../library/dataclasses.rst:439 +#: ../../library/dataclasses.rst:436 +msgid "" +"The *decorator* parameter is a callable that will be used to create the " +"dataclass. It should take the class object as a first argument and the same " +"keyword arguments as :func:`@dataclass `. By default, " +"the :func:`@dataclass ` function is used." +msgstr "" + +#: ../../library/dataclasses.rst:441 #, fuzzy msgid "" "This function is not strictly required, because any Python mechanism for " -"creating a new class with :attr:`!__annotations__` can then apply the :func:" -"`@dataclass ` function to convert that class to a dataclass. " -"This function is provided as a convenience. For example::" +"creating a new class with :attr:`!__annotations__` can then apply " +"the :func:`@dataclass ` function to convert that class to a " +"dataclass. This function is provided as a convenience. For example::" msgstr "" "這個函式不是嚴格要求的,因為任何使用 ``__annotations__`` 建立新類別的 Python " "機制都可以應用 :func:`dataclass` 函式將該類別轉換為資料類別。提供此功能是為了" "方便。例如: ::" -#: ../../library/dataclasses.rst:445 +#: ../../library/dataclasses.rst:447 msgid "" "C = make_dataclass('C',\n" " [('x', int),\n" @@ -882,11 +887,11 @@ msgstr "" " ('z', int, field(default=5))],\n" " namespace={'add_one': lambda self: self.x + 1})" -#: ../../library/dataclasses.rst:451 +#: ../../library/dataclasses.rst:453 msgid "Is equivalent to::" msgstr "相當於: ::" -#: ../../library/dataclasses.rst:453 +#: ../../library/dataclasses.rst:455 msgid "" "@dataclass\n" "class C:\n" @@ -899,18 +904,22 @@ msgid "" msgstr "" #: ../../library/dataclasses.rst:464 +msgid "Added the *decorator* parameter." +msgstr "" + +#: ../../library/dataclasses.rst:469 #, fuzzy msgid "" "Creates a new object of the same type as *obj*, replacing fields with values " "from *changes*. If *obj* is not a Data Class, raises :exc:`TypeError`. If " -"keys in *changes* are not field names of the given dataclass, raises :exc:" -"`TypeError`." +"keys in *changes* are not field names of the given dataclass, " +"raises :exc:`TypeError`." msgstr "" "建立一個與 ``obj`` 型別相同的新物件,用 ``changes`` 中的值替換欄位。如果 " "``obj`` 不是資料類別,則引發 :exc:`TypeError`。如果 ``changes`` 中的值未指定" "欄位,則引發 :exc:`TypeError`。" -#: ../../library/dataclasses.rst:469 +#: ../../library/dataclasses.rst:474 #, fuzzy msgid "" "The newly returned object is created by calling the :meth:`~object.__init__` " @@ -920,7 +929,7 @@ msgstr "" "新回傳的對像是通過呼叫資料類別的 :meth:`~object.__init__` 方法建立的。這確" "保 :meth:`__post_init__`(如果存在)也被呼叫。" -#: ../../library/dataclasses.rst:473 +#: ../../library/dataclasses.rst:478 #, fuzzy msgid "" "Init-only variables without default values, if any exist, must be specified " @@ -930,7 +939,7 @@ msgstr "" "沒有預設值的僅初始化變數(如果存在)必須在呼叫 :func:`replace` 時指定,以便它" "們可以傳遞給 :meth:`__init__` 和 :meth:`__post_init__`。" -#: ../../library/dataclasses.rst:477 +#: ../../library/dataclasses.rst:482 #, fuzzy msgid "" "It is an error for *changes* to contain any fields that are defined as " @@ -939,7 +948,7 @@ msgstr "" "*changes* 包含任何定義為具有 ``init=False`` 的欄位是錯誤的。在這種情況下將引" "發 :exc:`ValueError`。" -#: ../../library/dataclasses.rst:481 +#: ../../library/dataclasses.rst:486 #, fuzzy msgid "" "Be forewarned about how ``init=False`` fields work during a call to :func:`!" @@ -956,13 +965,13 @@ msgstr "" "建構函式可能是明智的,或者可能是處理實例複製的自定義:func:`!replace` (或類似" "命名的)方法。" -#: ../../library/dataclasses.rst:490 +#: ../../library/dataclasses.rst:495 msgid "" -"Dataclass instances are also supported by generic function :func:`copy." -"replace`." +"Dataclass instances are also supported by generic " +"function :func:`copy.replace`." msgstr "" -#: ../../library/dataclasses.rst:494 +#: ../../library/dataclasses.rst:499 #, fuzzy msgid "" "Return ``True`` if its parameter is a dataclass (including subclasses of a " @@ -970,7 +979,7 @@ msgid "" msgstr "" "如果它的參數是一個資料類別或一個實例,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/dataclasses.rst:497 +#: ../../library/dataclasses.rst:502 #, fuzzy msgid "" "If you need to know if a class is an instance of a dataclass (and not a " @@ -980,41 +989,41 @@ msgstr "" "如果你需要知道一個類別是否是資料類別的實例(而不是資料類別本身),那麼新增一" "個進一步的檢查 ``not isinstance(obj, type)``: ::" -#: ../../library/dataclasses.rst:501 +#: ../../library/dataclasses.rst:506 msgid "" "def is_dataclass_instance(obj):\n" " return is_dataclass(obj) and not isinstance(obj, type)" msgstr "" -#: ../../library/dataclasses.rst:506 +#: ../../library/dataclasses.rst:511 #, fuzzy msgid "A sentinel value signifying a missing default or default_factory." msgstr "表示缺少 default 或 default_factory 的標記值。" -#: ../../library/dataclasses.rst:510 +#: ../../library/dataclasses.rst:515 #, fuzzy msgid "" "A sentinel value used as a type annotation. Any fields after a pseudo-field " "with the type of :const:`!KW_ONLY` are marked as keyword-only fields. Note " "that a pseudo-field of type :const:`!KW_ONLY` is otherwise completely " "ignored. This includes the name of such a field. By convention, a name of " -"``_`` is used for a :const:`!KW_ONLY` field. Keyword-only fields signify :" -"meth:`~object.__init__` parameters that must be specified as keywords when " -"the class is instantiated." +"``_`` is used for a :const:`!KW_ONLY` field. Keyword-only fields " +"signify :meth:`~object.__init__` parameters that must be specified as " +"keywords when the class is instantiated." msgstr "" "用作型別註釋的標記值。型別為 :const:`!KW_ONLY` 的偽欄位之後的任何欄位都被標記" "為僅關鍵字欄位。請注意,:const:`!KW_ONLY` 型別的偽欄位將被完全忽略。這包括此" "類欄位的名稱。按照慣例,名稱 ``_`` 用於 :const:`!KW_ONLY` 欄位。僅關鍵字欄位" "表示 :meth:`~object.__init__` 參數,在實例化類別時必須將其指定為關鍵字。" -#: ../../library/dataclasses.rst:519 +#: ../../library/dataclasses.rst:524 #, fuzzy msgid "" "In this example, the fields ``y`` and ``z`` will be marked as keyword-only " "fields::" msgstr "在此示例中,欄位 ``y`` 和 ``z`` 將被標記為僅關鍵字欄位: ::" -#: ../../library/dataclasses.rst:521 +#: ../../library/dataclasses.rst:526 msgid "" "@dataclass\n" "class Point:\n" @@ -1034,52 +1043,52 @@ msgstr "" "\n" "p = Point(0, y=1.5, z=2.0)" -#: ../../library/dataclasses.rst:530 +#: ../../library/dataclasses.rst:535 #, fuzzy msgid "" "In a single dataclass, it is an error to specify more than one field whose " "type is :const:`!KW_ONLY`." msgstr "在單個資料類別中,指定多個型別為 :const:`!KW_ONLY` 的欄位是錯誤的。" -#: ../../library/dataclasses.rst:537 +#: ../../library/dataclasses.rst:542 #, fuzzy msgid "" -"Raised when an implicitly defined :meth:`~object.__setattr__` or :meth:" -"`~object.__delattr__` is called on a dataclass which was defined with " -"``frozen=True``. It is a subclass of :exc:`AttributeError`." +"Raised when an implicitly defined :meth:`~object.__setattr__` " +"or :meth:`~object.__delattr__` is called on a dataclass which was defined " +"with ``frozen=True``. It is a subclass of :exc:`AttributeError`." msgstr "" -"當在使用 frozen=True 定義的資料類別上呼叫隱式定義的 :meth:`__setattr__` 或 :" -"meth:`__delattr__` 時引發。它是 :exc:`AttributeError` 的子類別。" +"當在使用 frozen=True 定義的資料類別上呼叫隱式定義的 :meth:`__setattr__` " +"或 :meth:`__delattr__` 時引發。它是 :exc:`AttributeError` 的子類別。" -#: ../../library/dataclasses.rst:544 +#: ../../library/dataclasses.rst:549 #, fuzzy msgid "Post-init processing" msgstr "初始化後處理" -#: ../../library/dataclasses.rst:548 +#: ../../library/dataclasses.rst:553 #, fuzzy msgid "" -"When defined on the class, it will be called by the generated :meth:`~object." -"__init__`, normally as :meth:`!self.__post_init__`. However, if any " -"``InitVar`` fields are defined, they will also be passed to :meth:`!" -"__post_init__` in the order they were defined in the class. If no :meth:`!" -"__init__` method is generated, then :meth:`!__post_init__` will not " -"automatically be called." +"When defined on the class, it will be called by the " +"generated :meth:`~object.__init__`, normally as :meth:`!self.__post_init__`. " +"However, if any ``InitVar`` fields are defined, they will also be passed " +"to :meth:`!__post_init__` in the order they were defined in the class. If " +"no :meth:`!__init__` method is generated, then :meth:`!__post_init__` will " +"not automatically be called." msgstr "" -"生成的 :meth:`~object.__init__` 程式碼將呼叫一個名為 :meth:`!self." -"__post_init__` 的方法,如果 :meth:`!__post_init__` 是在類別上定義的。它通常被" -"稱為 ``self.!__post_init__()``。但是,如果定義了任何 ``InitVar`` 欄位,它們也" -"將按照它們在類別中定義的順序傳遞給 :meth:`!__post_init__` 。如果沒有生成 :" -"meth:`!__init__` 方法,那麼 :meth:`!__post_init__` 將不會被自動呼叫。" +"生成的 :meth:`~object.__init__` 程式碼將呼叫一個名為 :meth:`!" +"self.__post_init__` 的方法,如果 :meth:`!__post_init__` 是在類別上定義的。它" +"通常被稱為 ``self.!__post_init__()``。但是,如果定義了任何 ``InitVar`` 欄位," +"它們也將按照它們在類別中定義的順序傳遞給 :meth:`!__post_init__` 。如果沒有生" +"成 :meth:`!__init__` 方法,那麼 :meth:`!__post_init__` 將不會被自動呼叫。" -#: ../../library/dataclasses.rst:555 +#: ../../library/dataclasses.rst:560 #, fuzzy msgid "" "Among other uses, this allows for initializing field values that depend on " "one or more other fields. For example::" msgstr "在其他用途中,這允許初始化依賴於一個或多個其他欄位的欄位值。例如: ::" -#: ../../library/dataclasses.rst:558 +#: ../../library/dataclasses.rst:563 msgid "" "@dataclass\n" "class C:\n" @@ -1099,7 +1108,7 @@ msgstr "" " def __post_init__(self):\n" " self.c = self.a + self.b" -#: ../../library/dataclasses.rst:567 +#: ../../library/dataclasses.rst:572 #, fuzzy msgid "" "The :meth:`~object.__init__` method generated by :func:`@dataclass " @@ -1111,7 +1120,7 @@ msgstr "" "類別 :meth:`!__init__` 方法。如果基底類別有一個必須呼叫的 :meth:`!__init__` " "方法,通常在 :meth:`__post_init__` 方法中呼叫此方法: ::" -#: ../../library/dataclasses.rst:572 +#: ../../library/dataclasses.rst:577 msgid "" "class Rectangle:\n" " def __init__(self, height, width):\n" @@ -1137,7 +1146,7 @@ msgstr "" " def __post_init__(self):\n" " super().__init__(self.side, self.side)" -#: ../../library/dataclasses.rst:584 +#: ../../library/dataclasses.rst:589 #, fuzzy msgid "" "Note, however, that in general the dataclass-generated :meth:`!__init__` " @@ -1147,21 +1156,21 @@ msgstr "" "但是請注意,通常不需要呼叫資料類別生成的 :meth:`!__init__` 方法,因為衍生資料" "類別將負責初始化作為資料類別本身的任何基底類別的所有欄位。" -#: ../../library/dataclasses.rst:588 +#: ../../library/dataclasses.rst:593 #, fuzzy msgid "" -"See the section below on init-only variables for ways to pass parameters to :" -"meth:`!__post_init__`. Also see the warning about how :func:`replace` " +"See the section below on init-only variables for ways to pass parameters " +"to :meth:`!__post_init__`. Also see the warning about how :func:`replace` " "handles ``init=False`` fields." msgstr "" "請參閱下面有關僅初始化變數的部分,了解將參數傳遞給 :meth:`!__post_init__` 的" "方法。另請參閱有關 :func:`replace` 如何處理 ``init=False`` 欄位的警告。" -#: ../../library/dataclasses.rst:595 +#: ../../library/dataclasses.rst:600 msgid "Class variables" msgstr "類別變數" -#: ../../library/dataclasses.rst:597 +#: ../../library/dataclasses.rst:602 #, fuzzy msgid "" "One of the few places where :func:`@dataclass ` actually inspects " @@ -1169,21 +1178,21 @@ msgid "" "defined in :pep:`526`. It does this by checking if the type of the field " "is :data:`typing.ClassVar`. If a field is a ``ClassVar``, it is excluded " "from consideration as a field and is ignored by the dataclass mechanisms. " -"Such ``ClassVar`` pseudo-fields are not returned by the module-level :func:" -"`fields` function." +"Such ``ClassVar`` pseudo-fields are not returned by the module-" +"level :func:`fields` function." msgstr "" ":func:`@dataclass ` 實際檢查欄位型別的少數地方之一是確定欄位是否" -"是 :pep:`526` 中定義的類別變數。它通過檢查欄位的型別是否為 :data:`typing." -"ClassVar` 來做到這一點。如果一個欄位是一個 ``ClassVar``,它就被排除在考慮之" -"外,並被資料類別機制忽略。模組級 :func:`fields` 函式不會回傳此類別 " -"``ClassVar`` 偽欄位。" +"是 :pep:`526` 中定義的類別變數。它通過檢查欄位的型別是否" +"為 :data:`typing.ClassVar` 來做到這一點。如果一個欄位是一個 ``ClassVar``,它" +"就被排除在考慮之外,並被資料類別機制忽略。模組級 :func:`fields` 函式不會回傳" +"此類別 ``ClassVar`` 偽欄位。" -#: ../../library/dataclasses.rst:608 +#: ../../library/dataclasses.rst:613 #, fuzzy msgid "Init-only variables" msgstr "僅初始化變數" -#: ../../library/dataclasses.rst:610 +#: ../../library/dataclasses.rst:615 #, fuzzy msgid "" "Another place where :func:`@dataclass ` inspects a type " @@ -1203,14 +1212,14 @@ msgstr "" "的 :meth:`~object.__init__` 方法,並傳遞給可選的 :meth:`__post_init__` 方法。" "它們不被資料類別使用。" -#: ../../library/dataclasses.rst:620 +#: ../../library/dataclasses.rst:625 #, fuzzy msgid "" "For example, suppose a field will be initialized from a database, if a value " "is not provided when creating the class::" msgstr "例如,假設一個欄位將從資料庫中初始化,如果在建立類別時沒有提供值: ::" -#: ../../library/dataclasses.rst:623 +#: ../../library/dataclasses.rst:628 msgid "" "@dataclass\n" "class C:\n" @@ -1236,48 +1245,50 @@ msgstr "" "\n" "c = C(10, database=my_database)" -#: ../../library/dataclasses.rst:635 +#: ../../library/dataclasses.rst:640 #, fuzzy msgid "" "In this case, :func:`fields` will return :class:`Field` objects for :attr:`!" "i` and :attr:`!j`, but not for :attr:`!database`." msgstr "" -"在這種情況下,:func:`fields` 將為 :attr:`!i` 和 :attr:`!j` 回傳 :class:" -"`Field` 物件,但不會為 :attr:`!database` 回傳。" +"在這種情況下,:func:`fields` 將為 :attr:`!i` 和 :attr:`!j` 回" +"傳 :class:`Field` 物件,但不會為 :attr:`!database` 回傳。" -#: ../../library/dataclasses.rst:641 +#: ../../library/dataclasses.rst:646 msgid "Frozen instances" msgstr "凍結實例" -#: ../../library/dataclasses.rst:643 +#: ../../library/dataclasses.rst:648 #, fuzzy msgid "" "It is not possible to create truly immutable Python objects. However, by " "passing ``frozen=True`` to the :func:`@dataclass ` decorator you " -"can emulate immutability. In that case, dataclasses will add :meth:`~object." -"__setattr__` and :meth:`~object.__delattr__` methods to the class. These " -"methods will raise a :exc:`FrozenInstanceError` when invoked." +"can emulate immutability. In that case, dataclasses will " +"add :meth:`~object.__setattr__` and :meth:`~object.__delattr__` methods to " +"the class. These methods will raise a :exc:`FrozenInstanceError` when " +"invoked." msgstr "" -"不可能建立真正不可變的 Python 物件。但是,通過將 ``frozen=True`` 傳遞給 :" -"func:`@dataclass ` 裝飾器,你可以模擬不變性。在這種情況下,資料類" -"別將向類別新增 :meth:`~object.__setattr__` 和 :meth:`~object.__delattr__` 方" -"法。這些方法在叫用時會引發 :exc:`FrozenInstanceError`。" +"不可能建立真正不可變的 Python 物件。但是,通過將 ``frozen=True`` 傳遞" +"給 :func:`@dataclass ` 裝飾器,你可以模擬不變性。在這種情況下,資" +"料類別將向類別新增 :meth:`~object.__setattr__` " +"和 :meth:`~object.__delattr__` 方法。這些方法在叫用時會引" +"發 :exc:`FrozenInstanceError`。" -#: ../../library/dataclasses.rst:649 +#: ../../library/dataclasses.rst:654 #, fuzzy msgid "" -"There is a tiny performance penalty when using ``frozen=True``: :meth:" -"`~object.__init__` cannot use simple assignment to initialize fields, and " -"must use :meth:`!object.__setattr__`." +"There is a tiny performance penalty when using " +"``frozen=True``: :meth:`~object.__init__` cannot use simple assignment to " +"initialize fields, and must use :meth:`!object.__setattr__`." msgstr "" "使用 ``frozen=True`` 時有一個微小的性能損失::meth:`~object.__init__` 不能使" "用簡單賦值來初始化欄位,必須使用 :meth:`!object.__setattr__`。" -#: ../../library/dataclasses.rst:658 +#: ../../library/dataclasses.rst:663 msgid "Inheritance" msgstr "繼承" -#: ../../library/dataclasses.rst:660 +#: ../../library/dataclasses.rst:665 #, fuzzy msgid "" "When the dataclass is being created by the :func:`@dataclass ` " @@ -1295,7 +1306,7 @@ msgstr "" "將自己的欄位新增到有序對映中。所有生成的方法都將使用這種組合的、計算的有序欄" "位對映。因為欄位是按插入順序排列的,所以衍生類別會覆蓋基底類別。一個例子: ::" -#: ../../library/dataclasses.rst:670 +#: ../../library/dataclasses.rst:675 msgid "" "@dataclass\n" "class Base:\n" @@ -1317,7 +1328,7 @@ msgstr "" " z: int = 10\n" " x: int = 15" -#: ../../library/dataclasses.rst:680 +#: ../../library/dataclasses.rst:685 #, fuzzy msgid "" "The final list of fields is, in order, :attr:`!x`, :attr:`!y`, :attr:`!z`. " @@ -1327,23 +1338,23 @@ msgstr "" "最終的欄位列表按順序為 :attr:`!x`、:attr:`!y`、:attr:`!z`。:attr:`!x` 的最終" "型別是 :class:`int`,如類別 :class:`!C` 中指定的那樣。" -#: ../../library/dataclasses.rst:683 +#: ../../library/dataclasses.rst:688 #, fuzzy msgid "" "The generated :meth:`~object.__init__` method for :class:`!C` will look " "like::" msgstr "為 :class:`!C` 生成的 :meth:`~object.__init__` 方法將如下所示: ::" -#: ../../library/dataclasses.rst:685 +#: ../../library/dataclasses.rst:690 msgid "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" msgstr "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" -#: ../../library/dataclasses.rst:688 +#: ../../library/dataclasses.rst:693 #, fuzzy msgid "Re-ordering of keyword-only parameters in :meth:`!__init__`" msgstr ":meth:`!__init__` 中僅關鍵字參數的重新排序" -#: ../../library/dataclasses.rst:690 +#: ../../library/dataclasses.rst:695 #, fuzzy msgid "" "After the parameters needed for :meth:`~object.__init__` are computed, any " @@ -1355,7 +1366,7 @@ msgstr "" "僅關鍵字)參數之後。這是如何在 Python 中實作僅關鍵字參數的要求:它們必須位於" "非僅關鍵字參數之後。" -#: ../../library/dataclasses.rst:696 +#: ../../library/dataclasses.rst:701 #, fuzzy msgid "" "In this example, :attr:`!Base.y`, :attr:`!Base.w`, and :attr:`!D.t` are " @@ -1365,7 +1376,7 @@ msgstr "" "在此示例中,:attr:`!Base.y`、:attr:`!Base.w` 和 :attr:`!D.t` 是僅限關鍵字的欄" "位,:attr:`!Base.x` 和 :attr:`!D.z` 是常規欄位: ::" -#: ../../library/dataclasses.rst:699 +#: ../../library/dataclasses.rst:704 msgid "" "@dataclass\n" "class Base:\n" @@ -1391,12 +1402,12 @@ msgstr "" " z: int = 10\n" " t: int = field(kw_only=True, default=0)" -#: ../../library/dataclasses.rst:711 +#: ../../library/dataclasses.rst:716 #, fuzzy msgid "The generated :meth:`!__init__` method for :class:`!D` will look like::" msgstr "為 :class:`!D` 生成的 :meth:`!__init__` 方法將如下所示: ::" -#: ../../library/dataclasses.rst:713 +#: ../../library/dataclasses.rst:718 msgid "" "def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " "int = 0):" @@ -1404,7 +1415,7 @@ msgstr "" "def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " "int = 0):" -#: ../../library/dataclasses.rst:715 +#: ../../library/dataclasses.rst:720 #, fuzzy msgid "" "Note that the parameters have been re-ordered from how they appear in the " @@ -1414,18 +1425,18 @@ msgstr "" "請注意,參數已根據它們在欄位列表中的顯示方式重新排序:從常規欄位衍生的參數後" "跟從僅關鍵字欄位衍生的參數。" -#: ../../library/dataclasses.rst:719 +#: ../../library/dataclasses.rst:724 #, fuzzy msgid "" "The relative ordering of keyword-only parameters is maintained in the re-" "ordered :meth:`!__init__` parameter list." msgstr "僅關鍵字參數的相對順序在重新排序的 :meth:`!__init__` 參數列表中維護。" -#: ../../library/dataclasses.rst:724 +#: ../../library/dataclasses.rst:729 msgid "Default factory functions" msgstr "預設工廠函式" -#: ../../library/dataclasses.rst:726 +#: ../../library/dataclasses.rst:731 #, fuzzy msgid "" "If a :func:`field` specifies a *default_factory*, it is called with zero " @@ -1435,11 +1446,11 @@ msgstr "" "如果 :func:`field` 指定了 *default_factory*,當需要該欄位的預設值時,它會以零" "引數呼叫。例如,要建立列表的新實例,請使用: ::" -#: ../../library/dataclasses.rst:730 +#: ../../library/dataclasses.rst:735 msgid "mylist: list = field(default_factory=list)" msgstr "mylist: list = field(default_factory=list)" -#: ../../library/dataclasses.rst:732 +#: ../../library/dataclasses.rst:737 #, fuzzy msgid "" "If a field is excluded from :meth:`~object.__init__` (using ``init=False``) " @@ -1449,14 +1460,15 @@ msgid "" "initial value." msgstr "" "如果一個欄位從 :meth:`~object.__init__` 中排除(使用 ``init=False``)並且該欄" -"位還指定了 ``default_factory``,那麼預設工廠函式將始終從生成的 :meth:" -"`__init__ 中呼叫`功能。發生這種情況是因為沒有其他方法可以為該欄位賦予初始值。" +"位還指定了 ``default_factory``,那麼預設工廠函式將始終從生成" +"的 :meth:`__init__ 中呼叫`功能。發生這種情況是因為沒有其他方法可以為該欄位賦" +"予初始值。" -#: ../../library/dataclasses.rst:739 +#: ../../library/dataclasses.rst:744 msgid "Mutable default values" msgstr "可變預設值" -#: ../../library/dataclasses.rst:741 +#: ../../library/dataclasses.rst:746 #, fuzzy msgid "" "Python stores default member variable values in class attributes. Consider " @@ -1464,7 +1476,7 @@ msgid "" msgstr "" "Python 將預設成員變數值儲存在類別屬性中。考慮這個例子,不使用資料類別: ::" -#: ../../library/dataclasses.rst:744 +#: ../../library/dataclasses.rst:749 msgid "" "class C:\n" " x = []\n" @@ -1490,7 +1502,7 @@ msgstr "" "assert o1.x == [1, 2]\n" "assert o1.x is o2.x" -#: ../../library/dataclasses.rst:756 +#: ../../library/dataclasses.rst:761 #, fuzzy msgid "" "Note that the two instances of class :class:`!C` share the same class " @@ -1499,12 +1511,12 @@ msgstr "" "請注意,類別 :class:`!C` 的兩個實例共享同一個類別變數 :attr:`!x`,正如預期的" "那樣。" -#: ../../library/dataclasses.rst:759 +#: ../../library/dataclasses.rst:764 #, fuzzy msgid "Using dataclasses, *if* this code was valid::" msgstr "使用資料類別,*如果*此程式碼有效: ::" -#: ../../library/dataclasses.rst:761 +#: ../../library/dataclasses.rst:766 msgid "" "@dataclass\n" "class D:\n" @@ -1518,11 +1530,11 @@ msgstr "" " def add(self, element):\n" " self.x.append(element)" -#: ../../library/dataclasses.rst:767 +#: ../../library/dataclasses.rst:772 msgid "it would generate code similar to::" msgstr "它會生成類似的程式碼: ::" -#: ../../library/dataclasses.rst:769 +#: ../../library/dataclasses.rst:774 msgid "" "class D:\n" " x = []\n" @@ -1542,18 +1554,18 @@ msgstr "" "\n" "assert D().x is D().x" -#: ../../library/dataclasses.rst:778 +#: ../../library/dataclasses.rst:783 #, fuzzy msgid "" "This has the same issue as the original example using class :class:`!C`. " -"That is, two instances of class :class:`!D` that do not specify a value for :" -"attr:`!x` when creating a class instance will share the same copy of :attr:`!" -"x`. Because dataclasses just use normal Python class creation they also " -"share this behavior. There is no general way for Data Classes to detect " -"this condition. Instead, the :func:`@dataclass ` decorator will " -"raise a :exc:`ValueError` if it detects an unhashable default parameter. " -"The assumption is that if a value is unhashable, it is mutable. This is a " -"partial solution, but it does protect against many common errors." +"That is, two instances of class :class:`!D` that do not specify a value " +"for :attr:`!x` when creating a class instance will share the same copy " +"of :attr:`!x`. Because dataclasses just use normal Python class creation " +"they also share this behavior. There is no general way for Data Classes to " +"detect this condition. Instead, the :func:`@dataclass ` " +"decorator will raise a :exc:`ValueError` if it detects an unhashable default " +"parameter. The assumption is that if a value is unhashable, it is mutable. " +"This is a partial solution, but it does protect against many common errors." msgstr "" "這與使用類別 :class:`!C` 的原始示例存在相同的問題。也就是說,類別 :class:`!" "D` 的兩個實例在建立類別實例時沒有為 :attr:`!x` 指定值,它們將共享 :attr:`!x` " @@ -1562,14 +1574,14 @@ msgstr "" "檢測到不可散列的預設參數,它將引發 :exc:`TypeError`。假設是如果一個值是不可散" "列的,那麼它就是可變的。這是一個部分解決方案,但它確實可以防止許多常見錯誤。" -#: ../../library/dataclasses.rst:789 +#: ../../library/dataclasses.rst:794 #, fuzzy msgid "" "Using default factory functions is a way to create new instances of mutable " "types as default values for fields::" msgstr "使用預設工廠函式是一種建立可變型別的新實例作為欄位預設值的方法: ::" -#: ../../library/dataclasses.rst:792 +#: ../../library/dataclasses.rst:797 msgid "" "@dataclass\n" "class D:\n" @@ -1583,22 +1595,23 @@ msgstr "" "\n" "assert D().x is not D().x" -#: ../../library/dataclasses.rst:798 +#: ../../library/dataclasses.rst:803 #, fuzzy msgid "" -"Instead of looking for and disallowing objects of type :class:`list`, :class:" -"`dict`, or :class:`set`, unhashable objects are now not allowed as default " -"values. Unhashability is used to approximate mutability." +"Instead of looking for and disallowing objects of " +"type :class:`list`, :class:`dict`, or :class:`set`, unhashable objects are " +"now not allowed as default values. Unhashability is used to approximate " +"mutability." msgstr "" "不再查找和禁止型別為 :class:`list`、:class:`dict` 或 :class:`set` 的物件,現" "在不允許使用不可散列的對像作為預設值。不可散列性用於近似可變性。" -#: ../../library/dataclasses.rst:805 +#: ../../library/dataclasses.rst:810 #, fuzzy msgid "Descriptor-typed fields" msgstr "描述器型別的欄位" -#: ../../library/dataclasses.rst:807 +#: ../../library/dataclasses.rst:812 #, fuzzy msgid "" "Fields that are assigned :ref:`descriptor objects ` as their " @@ -1606,27 +1619,27 @@ msgid "" msgstr "" "指定為\\ :ref:`描述器物件 `\\ 作為預設值的欄位具有以下特殊行為:" -#: ../../library/dataclasses.rst:810 +#: ../../library/dataclasses.rst:815 #, fuzzy msgid "" "The value for the field passed to the dataclass's :meth:`~object.__init__` " "method is passed to the descriptor's :meth:`~object.__set__` method rather " "than overwriting the descriptor object." msgstr "" -"傳遞給資料類別的 :meth:`~object.__init__` 方法的欄位值被傳遞給描述器的 :meth:" -"`~object.__set__` 方法,而不是覆蓋描述器物件。" +"傳遞給資料類別的 :meth:`~object.__init__` 方法的欄位值被傳遞給描述器" +"的 :meth:`~object.__set__` 方法,而不是覆蓋描述器物件。" -#: ../../library/dataclasses.rst:814 +#: ../../library/dataclasses.rst:819 #, fuzzy msgid "" -"Similarly, when getting or setting the field, the descriptor's :meth:" -"`~object.__get__` or :meth:`!__set__` method is called rather than returning " -"or overwriting the descriptor object." +"Similarly, when getting or setting the field, the " +"descriptor's :meth:`~object.__get__` or :meth:`!__set__` method is called " +"rather than returning or overwriting the descriptor object." msgstr "" "同樣,在取得或設定欄位時,將呼叫描述器的 :meth:`~object.__get__` 或 :meth:`!" "__set__` 方法,而不是回傳或覆蓋描述器物件。" -#: ../../library/dataclasses.rst:818 +#: ../../library/dataclasses.rst:823 #, fuzzy msgid "" "To determine whether a field contains a default value, :func:`@dataclass " @@ -1642,7 +1655,7 @@ msgstr "" "面,如果描述器在這種情況下引發 :exc:`AttributeError`,則不會為該欄位提供預設" "值。" -#: ../../library/dataclasses.rst:828 +#: ../../library/dataclasses.rst:833 msgid "" "class IntConversionDescriptor:\n" " def __init__(self, *, default):\n" @@ -1696,7 +1709,7 @@ msgstr "" "i.quantity_on_hand = 2.5 # 以 2.5 呼叫 __set__\n" "print(i.quantity_on_hand) # 2" -#: ../../library/dataclasses.rst:853 +#: ../../library/dataclasses.rst:858 #, fuzzy msgid "" "Note that if a field is annotated with a descriptor type, but is not " @@ -1705,3 +1718,14 @@ msgid "" msgstr "" "請注意,如果一個欄位用描述器型別註釋,但未分配描述器對像作為其預設值,則該欄" "位將像普通欄位一樣工作。" + +#, fuzzy +#~ msgid "" +#~ "Calling no-arg :func:`super` in dataclasses using ``slots=True`` will " +#~ "result in the following exception being raised: ``TypeError: super(type, " +#~ "obj): obj must be an instance or subtype of type``. The two-" +#~ "arg :func:`super` is a valid workaround. See :gh:`90562` for full details." +#~ msgstr "" +#~ "``slots``:如果為 true(預設為 ``False``),將生" +#~ "成 :attr:`~object.__slots__` 屬性並回傳新類別而不是原始類別。如果 :attr:`!" +#~ "__slots__` 已經在類別中定義,則 :exc:`TypeError` 被引發。" diff --git a/library/datetime.po b/library/datetime.po index 5078659845c..bfaefd335b2 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-11 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" "Last-Translator: Griiid \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -80,9 +80,9 @@ msgstr ":pypi:`DateType` 套件" #: ../../library/datetime.rst:41 msgid "" -"Third-party library that introduces distinct static types to e.g. allow :" -"term:`static type checkers ` to differentiate between " -"naive and aware datetimes." +"Third-party library that introduces distinct static types to e.g. " +"allow :term:`static type checkers ` to differentiate " +"between naive and aware datetimes." msgstr "" #: ../../library/datetime.rst:48 @@ -117,12 +117,12 @@ msgstr "" #: ../../library/datetime.rst:66 msgid "" -"For applications requiring aware objects, :class:`.datetime` and :class:`." -"time` objects have an optional time zone information attribute, :attr:`!" -"tzinfo`, that can be set to an instance of a subclass of the abstract :class:" -"`tzinfo` class. These :class:`tzinfo` objects capture information about the " -"offset from UTC time, the time zone name, and whether daylight saving time " -"is in effect." +"For applications requiring aware objects, :class:`.datetime` " +"and :class:`.time` objects have an optional time zone information " +"attribute, :attr:`!tzinfo`, that can be set to an instance of a subclass of " +"the abstract :class:`tzinfo` class. These :class:`tzinfo` objects capture " +"information about the offset from UTC time, the time zone name, and whether " +"daylight saving time is in effect." msgstr "" #: ../../library/datetime.rst:72 @@ -167,29 +167,30 @@ msgstr "" #: ../../library/datetime.rst:108 msgid "" "An idealized naive date, assuming the current Gregorian calendar always was, " -"and always will be, in effect. Attributes: :attr:`year`, :attr:`month`, and :" -"attr:`day`." +"and always will be, in effect. Attributes: :attr:`year`, :attr:`month`, " +"and :attr:`day`." msgstr "" #: ../../library/datetime.rst:116 msgid "" "An idealized time, independent of any particular day, assuming that every " "day has exactly 24\\*60\\*60 seconds. (There is no notion of \"leap " -"seconds\" here.) Attributes: :attr:`hour`, :attr:`minute`, :attr:`second`, :" -"attr:`microsecond`, and :attr:`.tzinfo`." +"seconds\" here.) " +"Attributes: :attr:`hour`, :attr:`minute`, :attr:`second`, :attr:`microsecond`, " +"and :attr:`.tzinfo`." msgstr "" #: ../../library/datetime.rst:125 msgid "" -"A combination of a date and a time. Attributes: :attr:`year`, :attr:" -"`month`, :attr:`day`, :attr:`hour`, :attr:`minute`, :attr:`second`, :attr:" -"`microsecond`, and :attr:`.tzinfo`." +"A combination of a date and a time. " +"Attributes: :attr:`year`, :attr:`month`, :attr:`day`, :attr:`hour`, :attr:`minute`, :attr:`second`, :attr:`microsecond`, " +"and :attr:`.tzinfo`." msgstr "" #: ../../library/datetime.rst:133 msgid "" -"A duration expressing the difference between two :class:`.datetime` or :" -"class:`date` instances to microsecond resolution." +"A duration expressing the difference between two :class:`.datetime` " +"or :class:`date` instances to microsecond resolution." msgstr "" "表示兩個 :class:`.datetime` 或 :class:`date` 實例之間時間的差異,以微秒為解析" "度。" @@ -401,8 +402,8 @@ msgstr "" #: ../../library/datetime.rst:253 msgid "" -"If the normalized value of days lies outside the indicated range, :exc:" -"`OverflowError` is raised." +"If the normalized value of days lies outside the indicated " +"range, :exc:`OverflowError` is raised." msgstr "" #: ../../library/datetime.rst:256 @@ -443,9 +444,9 @@ msgid "" "'-(1:00:00)'" msgstr "" -#: ../../library/datetime.rst:281 ../../library/datetime.rst:582 -#: ../../library/datetime.rst:1142 ../../library/datetime.rst:1780 -#: ../../library/datetime.rst:2385 +#: ../../library/datetime.rst:281 ../../library/datetime.rst:615 +#: ../../library/datetime.rst:1175 ../../library/datetime.rst:1813 +#: ../../library/datetime.rst:2434 msgid "Class attributes:" msgstr "類別屬性:" @@ -468,12 +469,12 @@ msgstr "" #: ../../library/datetime.rst:299 msgid "" "Note that, because of normalization, ``timedelta.max`` is greater than ``-" -"timedelta.min``. ``-timedelta.max`` is not representable as a :class:" -"`timedelta` object." +"timedelta.min``. ``-timedelta.max`` is not representable as " +"a :class:`timedelta` object." msgstr "" -#: ../../library/datetime.rst:303 ../../library/datetime.rst:600 -#: ../../library/datetime.rst:1162 ../../library/datetime.rst:1800 +#: ../../library/datetime.rst:303 ../../library/datetime.rst:633 +#: ../../library/datetime.rst:1195 ../../library/datetime.rst:1833 msgid "Instance attributes (read-only):" msgstr "" @@ -512,18 +513,18 @@ msgstr "" msgid "Between 0 and 999,999 inclusive." msgstr "在 0 到 999,999 (含)之間" -#: ../../library/datetime.rst:334 ../../library/datetime.rst:617 -#: ../../library/datetime.rst:1215 +#: ../../library/datetime.rst:334 ../../library/datetime.rst:650 +#: ../../library/datetime.rst:1248 msgid "Supported operations:" msgstr "" -#: ../../library/datetime.rst:339 ../../library/datetime.rst:620 -#: ../../library/datetime.rst:1218 +#: ../../library/datetime.rst:339 ../../library/datetime.rst:653 +#: ../../library/datetime.rst:1251 msgid "Operation" msgstr "" -#: ../../library/datetime.rst:339 ../../library/datetime.rst:620 -#: ../../library/datetime.rst:1218 +#: ../../library/datetime.rst:339 ../../library/datetime.rst:653 +#: ../../library/datetime.rst:1251 msgid "Result" msgstr "" @@ -577,8 +578,8 @@ msgstr "``f = t2 / t3``" #: ../../library/datetime.rst:360 msgid "" -"Division (3) of overall duration ``t2`` by interval unit ``t3``. Returns a :" -"class:`float` object." +"Division (3) of overall duration ``t2`` by interval unit ``t3``. Returns " +"a :class:`float` object." msgstr "" #: ../../library/datetime.rst:364 @@ -669,8 +670,8 @@ msgid "" "constructor call with canonical attribute values." msgstr "" -#: ../../library/datetime.rst:400 ../../library/datetime.rst:639 -#: ../../library/datetime.rst:2616 +#: ../../library/datetime.rst:400 ../../library/datetime.rst:672 +#: ../../library/datetime.rst:2663 msgid "Notes:" msgstr "註解:" @@ -719,16 +720,16 @@ msgstr "" #: ../../library/datetime.rst:429 msgid "" "In addition to the operations listed above, :class:`timedelta` objects " -"support certain additions and subtractions with :class:`date` and :class:`." -"datetime` objects (see below)." +"support certain additions and subtractions with :class:`date` " +"and :class:`.datetime` objects (see below)." msgstr "" #: ../../library/datetime.rst:433 msgid "" -"Floor division and true division of a :class:`timedelta` object by another :" -"class:`timedelta` object are now supported, as are remainder operations and " -"the :func:`divmod` function. True division and multiplication of a :class:" -"`timedelta` object by a :class:`float` object are now supported." +"Floor division and true division of a :class:`timedelta` object by " +"another :class:`timedelta` object are now supported, as are remainder " +"operations and the :func:`divmod` function. True division and multiplication " +"of a :class:`timedelta` object by a :class:`float` object are now supported." msgstr "" #: ../../library/datetime.rst:439 @@ -741,8 +742,8 @@ msgid "" "and only if it isn't equal to ``timedelta(0)``." msgstr "" -#: ../../library/datetime.rst:444 ../../library/datetime.rst:681 -#: ../../library/datetime.rst:1305 ../../library/datetime.rst:1907 +#: ../../library/datetime.rst:444 ../../library/datetime.rst:714 +#: ../../library/datetime.rst:1338 ../../library/datetime.rst:1956 msgid "Instance methods:" msgstr "實例方法:" @@ -849,12 +850,12 @@ msgstr "``1 <= month <= 12``" msgid "``1 <= day <= number of days in the given month and year``" msgstr "" -#: ../../library/datetime.rst:509 ../../library/datetime.rst:899 +#: ../../library/datetime.rst:509 ../../library/datetime.rst:932 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised." msgstr "" -#: ../../library/datetime.rst:512 ../../library/datetime.rst:904 +#: ../../library/datetime.rst:512 ../../library/datetime.rst:937 msgid "Other constructors, all class methods:" msgstr "" @@ -875,19 +876,19 @@ msgstr "" #: ../../library/datetime.rst:525 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " -"values supported by the platform C :c:func:`localtime` function, and :exc:" -"`OSError` on :c:func:`localtime` failure. It's common for this to be " -"restricted to years from 1970 through 2038. Note that on non-POSIX systems " -"that include leap seconds in their notion of a timestamp, leap seconds are " -"ignored by :meth:`fromtimestamp`." +"values supported by the platform C :c:func:`localtime` function, " +"and :exc:`OSError` on :c:func:`localtime` failure. It's common for this to " +"be restricted to years from 1970 through 2038. Note that on non-POSIX " +"systems that include leap seconds in their notion of a timestamp, leap " +"seconds are ignored by :meth:`fromtimestamp`." msgstr "" #: ../../library/datetime.rst:532 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " -"function. Raise :exc:`OSError` instead of :exc:`ValueError` on :c:func:" -"`localtime` failure." +"function. Raise :exc:`OSError` instead of :exc:`ValueError` " +"on :c:func:`localtime` failure." msgstr "" #: ../../library/datetime.rst:541 @@ -908,23 +909,23 @@ msgid "" "ISO 8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:554 ../../library/datetime.rst:1064 +#: ../../library/datetime.rst:554 ../../library/datetime.rst:1097 msgid "" "Reduced precision dates are not currently supported (``YYYY-MM``, ``YYYY``)." msgstr "" -#: ../../library/datetime.rst:556 ../../library/datetime.rst:1066 +#: ../../library/datetime.rst:556 ../../library/datetime.rst:1099 msgid "" "Extended date representations are not currently supported (``±YYYYYY-MM-" "DD``)." msgstr "" -#: ../../library/datetime.rst:558 ../../library/datetime.rst:1068 +#: ../../library/datetime.rst:558 ../../library/datetime.rst:1101 msgid "Ordinal dates are not currently supported (``YYYY-OOO``)." msgstr "" -#: ../../library/datetime.rst:560 ../../library/datetime.rst:1070 -#: ../../library/datetime.rst:1536 +#: ../../library/datetime.rst:560 ../../library/datetime.rst:1103 +#: ../../library/datetime.rst:1569 msgid "Examples::" msgstr "範例: ::" @@ -953,57 +954,96 @@ msgstr "" #: ../../library/datetime.rst:576 msgid "" "Return a :class:`date` corresponding to the ISO calendar date specified by " -"year, week and day. This is the inverse of the function :meth:`date." -"isocalendar`." +"year, week and day. This is the inverse of the " +"function :meth:`date.isocalendar`." +msgstr "" + +#: ../../library/datetime.rst:583 +msgid "" +"Return a :class:`.date` corresponding to *date_string*, parsed according to " +"*format*. This is equivalent to::" msgstr "" #: ../../library/datetime.rst:586 +#, fuzzy +msgid "date(*(time.strptime(date_string, format)[0:3]))" +msgstr "datetime(*(time.strptime(date_string, format)[0:6]))" + +#: ../../library/datetime.rst:588 +msgid "" +":exc:`ValueError` is raised if the date_string and format can't be parsed " +"by :func:`time.strptime` or if it returns a value which isn't a time tuple. " +"See also :ref:`strftime-strptime-behavior` and :meth:`date.fromisoformat`." +msgstr "" + +#: ../../library/datetime.rst:595 +msgid "" +"If *format* specifies a day of month without a year " +"a :exc:`DeprecationWarning` is emitted. This is to avoid a quadrennial leap " +"year bug in code seeking to parse only a month and day as the default year " +"used in absence of one in the format is not a leap year. Such *format* " +"values may raise an error as of Python 3.15. The workaround is to always " +"include a year in your *format*. If parsing *date_string* values that do " +"not have a year, explicitly add a year that is a leap year before parsing:" +msgstr "" + +#: ../../library/datetime.rst:604 +msgid "" +">>> from datetime import date\n" +">>> date_string = \"02/29\"\n" +">>> when = date.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # Avoids " +"leap year bug.\n" +">>> when.strftime(\"%B %d\")\n" +"'February 29'" +msgstr "" + +#: ../../library/datetime.rst:619 msgid "The earliest representable date, ``date(MINYEAR, 1, 1)``." msgstr "" -#: ../../library/datetime.rst:591 +#: ../../library/datetime.rst:624 msgid "The latest representable date, ``date(MAXYEAR, 12, 31)``." msgstr "" -#: ../../library/datetime.rst:596 +#: ../../library/datetime.rst:629 msgid "" "The smallest possible difference between non-equal date objects, " "``timedelta(days=1)``." msgstr "" -#: ../../library/datetime.rst:604 ../../library/datetime.rst:1166 +#: ../../library/datetime.rst:637 ../../library/datetime.rst:1199 msgid "Between :const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: ../../library/datetime.rst:609 ../../library/datetime.rst:1171 +#: ../../library/datetime.rst:642 ../../library/datetime.rst:1204 msgid "Between 1 and 12 inclusive." msgstr "在 1 到 12 (含)之間。" -#: ../../library/datetime.rst:614 ../../library/datetime.rst:1176 +#: ../../library/datetime.rst:647 ../../library/datetime.rst:1209 msgid "Between 1 and the number of days in the given month of the given year." msgstr "" -#: ../../library/datetime.rst:622 +#: ../../library/datetime.rst:655 msgid "``date2 = date1 + timedelta``" msgstr "``date2 = date1 + timedelta``" -#: ../../library/datetime.rst:622 +#: ../../library/datetime.rst:655 msgid "``date2`` will be ``timedelta.days`` days after ``date1``. (1)" msgstr "" -#: ../../library/datetime.rst:625 +#: ../../library/datetime.rst:658 msgid "``date2 = date1 - timedelta``" msgstr "``date2 = date1 - timedelta``" -#: ../../library/datetime.rst:625 +#: ../../library/datetime.rst:658 msgid "Computes ``date2`` such that ``date2 + timedelta == date1``. (2)" msgstr "" -#: ../../library/datetime.rst:628 +#: ../../library/datetime.rst:661 msgid "``timedelta = date1 - date2``" msgstr "``timedelta = date1 - date2``" -#: ../../library/datetime.rst:628 ../../library/datetime.rst:1224 +#: ../../library/datetime.rst:661 ../../library/datetime.rst:1257 msgid "\\(3)" msgstr "\\(3)" @@ -1015,7 +1055,7 @@ msgstr "``date1 == date2``" msgid "``date1 != date2``" msgstr "``date1 != date2``" -#: ../../library/datetime.rst:630 ../../library/datetime.rst:1226 +#: ../../library/datetime.rst:663 ../../library/datetime.rst:1259 msgid "Equality comparison. (4)" msgstr "" @@ -1035,78 +1075,79 @@ msgstr "``date1 <= date2``" msgid "``date1 >= date2``" msgstr "``date1 >= date2``" -#: ../../library/datetime.rst:633 ../../library/datetime.rst:1229 +#: ../../library/datetime.rst:666 ../../library/datetime.rst:1262 msgid "Order comparison. (5)" msgstr "" -#: ../../library/datetime.rst:642 +#: ../../library/datetime.rst:675 msgid "" "*date2* is moved forward in time if ``timedelta.days > 0``, or backward if " "``timedelta.days < 0``. Afterward ``date2 - date1 == timedelta.days``. " -"``timedelta.seconds`` and ``timedelta.microseconds`` are ignored. :exc:" -"`OverflowError` is raised if ``date2.year`` would be smaller than :const:" -"`MINYEAR` or larger than :const:`MAXYEAR`." +"``timedelta.seconds`` and ``timedelta.microseconds`` are " +"ignored. :exc:`OverflowError` is raised if ``date2.year`` would be smaller " +"than :const:`MINYEAR` or larger than :const:`MAXYEAR`." msgstr "" -#: ../../library/datetime.rst:649 +#: ../../library/datetime.rst:682 msgid "``timedelta.seconds`` and ``timedelta.microseconds`` are ignored." msgstr "``timedelta.seconds`` 和 ``timedelta.microseconds`` 被忽略。" -#: ../../library/datetime.rst:652 +#: ../../library/datetime.rst:685 msgid "" -"This is exact, and cannot overflow. ``timedelta.seconds`` and ``timedelta." -"microseconds`` are 0, and ``date2 + timedelta == date1`` after." +"This is exact, and cannot overflow. ``timedelta.seconds`` and " +"``timedelta.microseconds`` are 0, and ``date2 + timedelta == date1`` after." msgstr "" -#: ../../library/datetime.rst:656 +#: ../../library/datetime.rst:689 msgid ":class:`date` objects are equal if they represent the same date." msgstr "" -#: ../../library/datetime.rst:658 +#: ../../library/datetime.rst:691 msgid "" ":class:`!date` objects that are not also :class:`.datetime` instances are " "never equal to :class:`!datetime` objects, even if they represent the same " "date." msgstr "" -#: ../../library/datetime.rst:663 +#: ../../library/datetime.rst:696 msgid "" "*date1* is considered less than *date2* when *date1* precedes *date2* in " "time. In other words, ``date1 < date2`` if and only if ``date1.toordinal() < " "date2.toordinal()``." msgstr "" -#: ../../library/datetime.rst:667 +#: ../../library/datetime.rst:700 msgid "" -"Order comparison between a :class:`!date` object that is not also a :class:`." -"datetime` instance and a :class:`!datetime` object raises :exc:`TypeError`." +"Order comparison between a :class:`!date` object that is not also " +"a :class:`.datetime` instance and a :class:`!datetime` object " +"raises :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:671 ../../library/datetime.rst:1297 +#: ../../library/datetime.rst:704 ../../library/datetime.rst:1330 msgid "" -"Comparison between :class:`.datetime` object and an instance of the :class:" -"`date` subclass that is not a :class:`!datetime` subclass no longer converts " -"the latter to :class:`!date`, ignoring the time part and the time zone. The " -"default behavior can be changed by overriding the special comparison methods " -"in subclasses." +"Comparison between :class:`.datetime` object and an instance of " +"the :class:`date` subclass that is not a :class:`!datetime` subclass no " +"longer converts the latter to :class:`!date`, ignoring the time part and the " +"time zone. The default behavior can be changed by overriding the special " +"comparison methods in subclasses." msgstr "" -#: ../../library/datetime.rst:679 +#: ../../library/datetime.rst:712 msgid "" "In Boolean contexts, all :class:`date` objects are considered to be true." msgstr "" -#: ../../library/datetime.rst:685 +#: ../../library/datetime.rst:718 msgid "" "Return a new :class:`date` object with the same values, but with specified " "parameters updated." msgstr "" -#: ../../library/datetime.rst:688 ../../library/datetime.rst:1953 +#: ../../library/datetime.rst:721 ../../library/datetime.rst:2002 msgid "Example::" msgstr "範例: ::" -#: ../../library/datetime.rst:690 +#: ../../library/datetime.rst:723 msgid "" ">>> from datetime import date\n" ">>> d = date(2002, 12, 31)\n" @@ -1118,74 +1159,74 @@ msgstr "" ">>> d.replace(day=26)\n" "datetime.date(2002, 12, 26)" -#: ../../library/datetime.rst:695 +#: ../../library/datetime.rst:728 msgid "" "The generic function :func:`copy.replace` also supports :class:`date` " "objects." msgstr "" -#: ../../library/datetime.rst:701 ../../library/datetime.rst:1421 +#: ../../library/datetime.rst:734 ../../library/datetime.rst:1454 msgid "" -"Return a :class:`time.struct_time` such as returned by :func:`time." -"localtime`." +"Return a :class:`time.struct_time` such as returned " +"by :func:`time.localtime`." msgstr "" "回傳一個 :class:`time.struct_time`,如同 :func:`time.localtime` 所回傳。" -#: ../../library/datetime.rst:703 +#: ../../library/datetime.rst:736 msgid "The hours, minutes and seconds are 0, and the DST flag is -1." msgstr "" -#: ../../library/datetime.rst:705 ../../library/datetime.rst:1423 +#: ../../library/datetime.rst:738 ../../library/datetime.rst:1456 msgid "``d.timetuple()`` is equivalent to::" msgstr "``d.timetuple()`` 等價於: ::" -#: ../../library/datetime.rst:707 +#: ../../library/datetime.rst:740 msgid "" "time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" msgstr "" "time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" -#: ../../library/datetime.rst:709 +#: ../../library/datetime.rst:742 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " "day number within the current year starting with 1 for January 1st." msgstr "" -#: ../../library/datetime.rst:715 +#: ../../library/datetime.rst:748 msgid "" "Return the proleptic Gregorian ordinal of the date, where January 1 of year " -"1 has ordinal 1. For any :class:`date` object ``d``, ``date.fromordinal(d." -"toordinal()) == d``." +"1 has ordinal 1. For any :class:`date` object ``d``, " +"``date.fromordinal(d.toordinal()) == d``." msgstr "" -#: ../../library/datetime.rst:722 +#: ../../library/datetime.rst:755 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " -"For example, ``date(2002, 12, 4).weekday() == 2``, a Wednesday. See also :" -"meth:`isoweekday`." +"For example, ``date(2002, 12, 4).weekday() == 2``, a Wednesday. See " +"also :meth:`isoweekday`." msgstr "" -"回傳一個代表星期幾的整數,星期一為 0、星期日為 6。例如 ``date(2002, 12, 4)." -"weekday() == 2`` 為星期三。也請參考 :meth:`isoweekday`。" +"回傳一個代表星期幾的整數,星期一為 0、星期日為 6。例如 ``date(2002, 12, " +"4).weekday() == 2`` 為星期三。也請參考 :meth:`isoweekday`。" -#: ../../library/datetime.rst:729 +#: ../../library/datetime.rst:762 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " -"For example, ``date(2002, 12, 4).isoweekday() == 3``, a Wednesday. See also :" -"meth:`weekday`, :meth:`isocalendar`." +"For example, ``date(2002, 12, 4).isoweekday() == 3``, a Wednesday. See " +"also :meth:`weekday`, :meth:`isocalendar`." msgstr "" -#: ../../library/datetime.rst:736 +#: ../../library/datetime.rst:769 msgid "" "Return a :term:`named tuple` object with three components: ``year``, " "``week`` and ``weekday``." msgstr "" -#: ../../library/datetime.rst:739 +#: ../../library/datetime.rst:772 msgid "" "The ISO calendar is a widely used variant of the Gregorian calendar. [#]_" msgstr "" -#: ../../library/datetime.rst:741 +#: ../../library/datetime.rst:774 msgid "" "The ISO year consists of 52 or 53 full weeks, and where a week starts on a " "Monday and ends on a Sunday. The first week of an ISO year is the first " @@ -1194,13 +1235,13 @@ msgid "" "Gregorian year." msgstr "" -#: ../../library/datetime.rst:746 +#: ../../library/datetime.rst:779 msgid "" "For example, 2004 begins on a Thursday, so the first week of ISO year 2004 " "begins on Monday, 29 Dec 2003 and ends on Sunday, 4 Jan 2004::" msgstr "" -#: ../../library/datetime.rst:749 +#: ../../library/datetime.rst:782 msgid "" ">>> from datetime import date\n" ">>> date(2003, 12, 29).isocalendar()\n" @@ -1214,16 +1255,16 @@ msgstr "" ">>> date(2004, 1, 4).isocalendar()\n" "datetime.IsoCalendarDate(year=2004, week=1, weekday=7)" -#: ../../library/datetime.rst:755 +#: ../../library/datetime.rst:788 msgid "Result changed from a tuple to a :term:`named tuple`." msgstr "" -#: ../../library/datetime.rst:760 +#: ../../library/datetime.rst:793 msgid "" "Return a string representing the date in ISO 8601 format, ``YYYY-MM-DD``::" msgstr "回傳一以 ISO 8601 格式 ``YYYY-MM-DD`` 表示的日期字串: ::" -#: ../../library/datetime.rst:762 +#: ../../library/datetime.rst:795 msgid "" ">>> from datetime import date\n" ">>> date(2002, 12, 4).isoformat()\n" @@ -1233,15 +1274,15 @@ msgstr "" ">>> date(2002, 12, 4).isoformat()\n" "'2002-12-04'" -#: ../../library/datetime.rst:768 +#: ../../library/datetime.rst:801 msgid "For a date ``d``, ``str(d)`` is equivalent to ``d.isoformat()``." msgstr "" -#: ../../library/datetime.rst:773 +#: ../../library/datetime.rst:806 msgid "Return a string representing the date::" msgstr "" -#: ../../library/datetime.rst:775 +#: ../../library/datetime.rst:808 msgid "" ">>> from datetime import date\n" ">>> date(2002, 12, 4).ctime()\n" @@ -1251,30 +1292,30 @@ msgstr "" ">>> date(2002, 12, 4).ctime()\n" "'Wed Dec 4 00:00:00 2002'" -#: ../../library/datetime.rst:779 ../../library/datetime.rst:1607 +#: ../../library/datetime.rst:812 ../../library/datetime.rst:1640 msgid "``d.ctime()`` is equivalent to::" msgstr "``d.ctime()`` 等價於: ::" -#: ../../library/datetime.rst:781 ../../library/datetime.rst:1609 +#: ../../library/datetime.rst:814 ../../library/datetime.rst:1642 msgid "time.ctime(time.mktime(d.timetuple()))" msgstr "time.ctime(time.mktime(d.timetuple()))" -#: ../../library/datetime.rst:783 +#: ../../library/datetime.rst:816 msgid "" -"on platforms where the native C :c:func:`ctime` function (which :func:`time." -"ctime` invokes, but which :meth:`date.ctime` does not invoke) conforms to " -"the C standard." +"on platforms where the native C :c:func:`ctime` function " +"(which :func:`time.ctime` invokes, but which :meth:`date.ctime` does not " +"invoke) conforms to the C standard." msgstr "" -#: ../../library/datetime.rst:790 +#: ../../library/datetime.rst:823 msgid "" "Return a string representing the date, controlled by an explicit format " "string. Format codes referring to hours, minutes or seconds will see 0 " -"values. See also :ref:`strftime-strptime-behavior` and :meth:`date." -"isoformat`." +"values. See also :ref:`strftime-strptime-behavior` " +"and :meth:`date.isoformat`." msgstr "" -#: ../../library/datetime.rst:797 +#: ../../library/datetime.rst:830 msgid "" "Same as :meth:`.date.strftime`. This makes it possible to specify a format " "string for a :class:`.date` object in :ref:`formatted string literals >> import time\n" ">>> from datetime import date\n" @@ -1326,11 +1367,11 @@ msgstr "" ">>> time_to_birthday.days\n" "202" -#: ../../library/datetime.rst:824 +#: ../../library/datetime.rst:857 msgid "More examples of working with :class:`date`:" msgstr "更多 :class:`date` 的用法範例:" -#: ../../library/datetime.rst:826 +#: ../../library/datetime.rst:859 msgid "" ">>> from datetime import date\n" ">>> d = date.fromordinal(730920) # 730920th day after 1. 1. 0001\n" @@ -1374,17 +1415,17 @@ msgid "" "datetime.date(2005, 3, 11)" msgstr "" -#: ../../library/datetime.rst:873 +#: ../../library/datetime.rst:906 msgid ":class:`.datetime` Objects" msgstr ":class:`.datetime` 物件" -#: ../../library/datetime.rst:875 +#: ../../library/datetime.rst:908 msgid "" "A :class:`.datetime` object is a single object containing all the " "information from a :class:`date` object and a :class:`.time` object." msgstr "" -#: ../../library/datetime.rst:878 +#: ../../library/datetime.rst:911 msgid "" "Like a :class:`date` object, :class:`.datetime` assumes the current " "Gregorian calendar extended in both directions; like a :class:`.time` " @@ -1392,119 +1433,120 @@ msgid "" "every day." msgstr "" -#: ../../library/datetime.rst:882 +#: ../../library/datetime.rst:915 msgid "Constructor:" msgstr "建構函式:" -#: ../../library/datetime.rst:886 +#: ../../library/datetime.rst:919 msgid "" "The *year*, *month* and *day* arguments are required. *tzinfo* may be " "``None``, or an instance of a :class:`tzinfo` subclass. The remaining " "arguments must be integers in the following ranges:" msgstr "" -#: ../../library/datetime.rst:890 +#: ../../library/datetime.rst:923 msgid "``MINYEAR <= year <= MAXYEAR``," msgstr "``MINYEAR <= year <= MAXYEAR``," -#: ../../library/datetime.rst:891 +#: ../../library/datetime.rst:924 msgid "``1 <= month <= 12``," msgstr "``1 <= month <= 12``," -#: ../../library/datetime.rst:892 +#: ../../library/datetime.rst:925 msgid "``1 <= day <= number of days in the given month and year``," msgstr "" -#: ../../library/datetime.rst:893 ../../library/datetime.rst:1771 +#: ../../library/datetime.rst:926 ../../library/datetime.rst:1804 msgid "``0 <= hour < 24``," msgstr "``0 <= hour < 24``," -#: ../../library/datetime.rst:894 ../../library/datetime.rst:1772 +#: ../../library/datetime.rst:927 ../../library/datetime.rst:1805 msgid "``0 <= minute < 60``," msgstr "``0 <= minute < 60``," -#: ../../library/datetime.rst:895 ../../library/datetime.rst:1773 +#: ../../library/datetime.rst:928 ../../library/datetime.rst:1806 msgid "``0 <= second < 60``," msgstr "``0 <= second < 60``," -#: ../../library/datetime.rst:896 ../../library/datetime.rst:1774 +#: ../../library/datetime.rst:929 ../../library/datetime.rst:1807 msgid "``0 <= microsecond < 1000000``," msgstr "``0 <= microsecond < 1000000``," -#: ../../library/datetime.rst:897 ../../library/datetime.rst:1775 +#: ../../library/datetime.rst:930 ../../library/datetime.rst:1808 msgid "``fold in [0, 1]``." msgstr "``fold in [0, 1]``。" -#: ../../library/datetime.rst:901 ../../library/datetime.rst:1342 -#: ../../library/datetime.rst:1920 +#: ../../library/datetime.rst:934 ../../library/datetime.rst:1375 +#: ../../library/datetime.rst:1969 msgid "Added the *fold* parameter." msgstr "新增 *fold* 參數。" -#: ../../library/datetime.rst:908 +#: ../../library/datetime.rst:941 msgid "Return the current local date and time, with :attr:`.tzinfo` ``None``." msgstr "回傳目前的本地日期與時間,且 :attr:`.tzinfo` 為 ``None``。" -#: ../../library/datetime.rst:910 +#: ../../library/datetime.rst:943 msgid "Equivalent to::" msgstr "等價於: ::" -#: ../../library/datetime.rst:912 +#: ../../library/datetime.rst:945 msgid "datetime.fromtimestamp(time.time())" msgstr "datetime.fromtimestamp(time.time())" -#: ../../library/datetime.rst:914 +#: ../../library/datetime.rst:947 msgid "See also :meth:`now`, :meth:`fromtimestamp`." msgstr "也請見 :meth:`now`、:meth:`fromtimestamp`。" -#: ../../library/datetime.rst:916 +#: ../../library/datetime.rst:949 msgid "" "This method is functionally equivalent to :meth:`now`, but without a ``tz`` " "parameter." msgstr "" -#: ../../library/datetime.rst:921 +#: ../../library/datetime.rst:954 msgid "Return the current local date and time." msgstr "" -#: ../../library/datetime.rst:923 +#: ../../library/datetime.rst:956 msgid "" -"If optional argument *tz* is ``None`` or not specified, this is like :meth:" -"`today`, but, if possible, supplies more precision than can be gotten from " -"going through a :func:`time.time` timestamp (for example, this may be " -"possible on platforms supplying the C :c:func:`gettimeofday` function)." +"If optional argument *tz* is ``None`` or not specified, this is " +"like :meth:`today`, but, if possible, supplies more precision than can be " +"gotten from going through a :func:`time.time` timestamp (for example, this " +"may be possible on platforms supplying the C :c:func:`gettimeofday` " +"function)." msgstr "" "如果選用的引數 *tz* 為 ``None`` 或未指定,則會像是 :meth:`today`,但盡可能提" -"供比透過 :func:`time.time` 取得的時間戳記更多位數的資訊(例如,這在有提供 C :" -"c:func:`gettimeofday` 函式的平台上可能可行)。" +"供比透過 :func:`time.time` 取得的時間戳記更多位數的資訊(例如,這在有提供 " +"C :c:func:`gettimeofday` 函式的平台上可能可行)。" -#: ../../library/datetime.rst:929 +#: ../../library/datetime.rst:962 msgid "" "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " "subclass, and the current date and time are converted to *tz*’s time zone." msgstr "" -#: ../../library/datetime.rst:932 +#: ../../library/datetime.rst:965 msgid "This function is preferred over :meth:`today` and :meth:`utcnow`." msgstr "" -#: ../../library/datetime.rst:936 +#: ../../library/datetime.rst:969 msgid "" "Subsequent calls to :meth:`!datetime.now` may return the same instant " "depending on the precision of the underlying clock." msgstr "" -#: ../../library/datetime.rst:941 +#: ../../library/datetime.rst:974 msgid "Return the current UTC date and time, with :attr:`.tzinfo` ``None``." msgstr "" -#: ../../library/datetime.rst:943 +#: ../../library/datetime.rst:976 msgid "" "This is like :meth:`now`, but returns the current UTC date and time, as a " "naive :class:`.datetime` object. An aware current UTC datetime can be " "obtained by calling ``datetime.now(timezone.utc)``. See also :meth:`now`." msgstr "" -#: ../../library/datetime.rst:949 +#: ../../library/datetime.rst:982 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1512,11 +1554,11 @@ msgid "" "current time in UTC is by calling ``datetime.now(timezone.utc)``." msgstr "" -#: ../../library/datetime.rst:956 +#: ../../library/datetime.rst:989 msgid "Use :meth:`datetime.now` with :const:`UTC` instead." msgstr "" -#: ../../library/datetime.rst:961 +#: ../../library/datetime.rst:994 msgid "" "Return the local date and time corresponding to the POSIX timestamp, such as " "is returned by :func:`time.time`. If optional argument *tz* is ``None`` or " @@ -1524,78 +1566,78 @@ msgid "" "time, and the returned :class:`.datetime` object is naive." msgstr "" -#: ../../library/datetime.rst:966 +#: ../../library/datetime.rst:999 msgid "" "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " "subclass, and the timestamp is converted to *tz*’s time zone." msgstr "" -#: ../../library/datetime.rst:969 +#: ../../library/datetime.rst:1002 msgid "" ":meth:`fromtimestamp` may raise :exc:`OverflowError`, if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " -"or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` or :" -"c:func:`gmtime` failure. It's common for this to be restricted to years in " -"1970 through 2038. Note that on non-POSIX systems that include leap seconds " -"in their notion of a timestamp, leap seconds are ignored by :meth:" -"`fromtimestamp`, and then it's possible to have two timestamps differing by " -"a second that yield identical :class:`.datetime` objects. This method is " -"preferred over :meth:`utcfromtimestamp`." +"or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` " +"or :c:func:`gmtime` failure. It's common for this to be restricted to years " +"in 1970 through 2038. Note that on non-POSIX systems that include leap " +"seconds in their notion of a timestamp, leap seconds are ignored " +"by :meth:`fromtimestamp`, and then it's possible to have two timestamps " +"differing by a second that yield identical :class:`.datetime` objects. This " +"method is preferred over :meth:`utcfromtimestamp`." msgstr "" -#: ../../library/datetime.rst:980 +#: ../../library/datetime.rst:1013 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " -"or :c:func:`gmtime` functions. Raise :exc:`OSError` instead of :exc:" -"`ValueError` on :c:func:`localtime` or :c:func:`gmtime` failure." +"or :c:func:`gmtime` functions. Raise :exc:`OSError` instead " +"of :exc:`ValueError` on :c:func:`localtime` or :c:func:`gmtime` failure." msgstr "" -#: ../../library/datetime.rst:987 +#: ../../library/datetime.rst:1020 msgid ":meth:`fromtimestamp` may return instances with :attr:`.fold` set to 1." msgstr "" -#: ../../library/datetime.rst:992 +#: ../../library/datetime.rst:1025 msgid "" "Return the UTC :class:`.datetime` corresponding to the POSIX timestamp, " "with :attr:`.tzinfo` ``None``. (The resulting object is naive.)" msgstr "" -#: ../../library/datetime.rst:995 +#: ../../library/datetime.rst:1028 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " -"values supported by the platform C :c:func:`gmtime` function, and :exc:" -"`OSError` on :c:func:`gmtime` failure. It's common for this to be restricted " -"to years in 1970 through 2038." +"values supported by the platform C :c:func:`gmtime` function, " +"and :exc:`OSError` on :c:func:`gmtime` failure. It's common for this to be " +"restricted to years in 1970 through 2038." msgstr "" -#: ../../library/datetime.rst:1000 +#: ../../library/datetime.rst:1033 msgid "To get an aware :class:`.datetime` object, call :meth:`fromtimestamp`::" msgstr "" -#: ../../library/datetime.rst:1002 +#: ../../library/datetime.rst:1035 msgid "datetime.fromtimestamp(timestamp, timezone.utc)" msgstr "datetime.fromtimestamp(timestamp, timezone.utc)" -#: ../../library/datetime.rst:1004 +#: ../../library/datetime.rst:1037 msgid "" "On the POSIX compliant platforms, it is equivalent to the following " "expression::" msgstr "" -#: ../../library/datetime.rst:1007 +#: ../../library/datetime.rst:1040 msgid "" "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" msgstr "" "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" -#: ../../library/datetime.rst:1009 +#: ../../library/datetime.rst:1042 msgid "" -"except the latter formula always supports the full years range: between :" -"const:`MINYEAR` and :const:`MAXYEAR` inclusive." +"except the latter formula always supports the full years range: " +"between :const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: ../../library/datetime.rst:1014 +#: ../../library/datetime.rst:1047 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1604,19 +1646,19 @@ msgid "" "tz=timezone.utc)``." msgstr "" -#: ../../library/datetime.rst:1020 +#: ../../library/datetime.rst:1053 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`gmtime` " -"function. Raise :exc:`OSError` instead of :exc:`ValueError` on :c:func:" -"`gmtime` failure." +"function. Raise :exc:`OSError` instead of :exc:`ValueError` " +"on :c:func:`gmtime` failure." msgstr "" -#: ../../library/datetime.rst:1028 +#: ../../library/datetime.rst:1061 msgid "Use :meth:`datetime.fromtimestamp` with :const:`UTC` instead." msgstr "" -#: ../../library/datetime.rst:1033 +#: ../../library/datetime.rst:1066 msgid "" "Return the :class:`.datetime` corresponding to the proleptic Gregorian " "ordinal, where January 1 of year 1 has ordinal 1. :exc:`ValueError` is " @@ -1625,46 +1667,46 @@ msgid "" "is ``None``." msgstr "" -#: ../../library/datetime.rst:1041 +#: ../../library/datetime.rst:1074 msgid "" "Return a new :class:`.datetime` object whose date components are equal to " "the given :class:`date` object's, and whose time components are equal to the " "given :class:`.time` object's. If the *tzinfo* argument is provided, its " "value is used to set the :attr:`.tzinfo` attribute of the result, otherwise " "the :attr:`~.time.tzinfo` attribute of the *time* argument is used. If the " -"*date* argument is a :class:`.datetime` object, its time components and :" -"attr:`.tzinfo` attributes are ignored." +"*date* argument is a :class:`.datetime` object, its time components " +"and :attr:`.tzinfo` attributes are ignored." msgstr "" -#: ../../library/datetime.rst:1049 +#: ../../library/datetime.rst:1082 msgid "" -"For any :class:`.datetime` object ``d``, ``d == datetime.combine(d.date(), d." -"time(), d.tzinfo)``." +"For any :class:`.datetime` object ``d``, ``d == datetime.combine(d.date(), " +"d.time(), d.tzinfo)``." msgstr "" -#: ../../library/datetime.rst:1052 +#: ../../library/datetime.rst:1085 msgid "Added the *tzinfo* argument." msgstr "新增 *tzinfo* 引數。" -#: ../../library/datetime.rst:1058 +#: ../../library/datetime.rst:1091 msgid "" "Return a :class:`.datetime` corresponding to a *date_string* in any valid " "ISO 8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:1061 ../../library/datetime.rst:1871 +#: ../../library/datetime.rst:1094 ../../library/datetime.rst:1904 msgid "Time zone offsets may have fractional seconds." msgstr "" -#: ../../library/datetime.rst:1062 +#: ../../library/datetime.rst:1095 msgid "The ``T`` separator may be replaced by any single unicode character." msgstr "" -#: ../../library/datetime.rst:1063 ../../library/datetime.rst:1876 +#: ../../library/datetime.rst:1096 ../../library/datetime.rst:1909 msgid "Fractional hours and minutes are not supported." msgstr "" -#: ../../library/datetime.rst:1072 +#: ../../library/datetime.rst:1105 msgid "" ">>> from datetime import datetime\n" ">>> datetime.fromisoformat('2011-11-04')\n" @@ -1682,8 +1724,8 @@ msgid "" ">>> datetime.fromisoformat('2011-11-04 00:05:23.283')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23, 283000)\n" ">>> datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')\n" -"datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone." -"utc)\n" +"datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, " +"tzinfo=datetime.timezone.utc)\n" ">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" @@ -1704,62 +1746,62 @@ msgstr "" ">>> datetime.fromisoformat('2011-11-04 00:05:23.283')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23, 283000)\n" ">>> datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')\n" -"datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone." -"utc)\n" +"datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, " +"tzinfo=datetime.timezone.utc)\n" ">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" -#: ../../library/datetime.rst:1094 +#: ../../library/datetime.rst:1127 msgid "" -"Previously, this method only supported formats that could be emitted by :" -"meth:`date.isoformat` or :meth:`datetime.isoformat`." +"Previously, this method only supported formats that could be emitted " +"by :meth:`date.isoformat` or :meth:`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1101 +#: ../../library/datetime.rst:1134 msgid "" "Return a :class:`.datetime` corresponding to the ISO calendar date specified " "by year, week and day. The non-date components of the datetime are populated " -"with their normal default values. This is the inverse of the function :meth:" -"`datetime.isocalendar`." +"with their normal default values. This is the inverse of the " +"function :meth:`datetime.isocalendar`." msgstr "" -#: ../../library/datetime.rst:1110 +#: ../../library/datetime.rst:1143 msgid "" "Return a :class:`.datetime` corresponding to *date_string*, parsed according " "to *format*." msgstr "" -#: ../../library/datetime.rst:1113 +#: ../../library/datetime.rst:1146 msgid "" "If *format* does not contain microseconds or time zone information, this is " "equivalent to::" msgstr "" -#: ../../library/datetime.rst:1115 ../../library/datetime.rst:2596 +#: ../../library/datetime.rst:1148 ../../library/datetime.rst:2643 msgid "datetime(*(time.strptime(date_string, format)[0:6]))" msgstr "datetime(*(time.strptime(date_string, format)[0:6]))" -#: ../../library/datetime.rst:1117 +#: ../../library/datetime.rst:1150 msgid "" ":exc:`ValueError` is raised if the date_string and format can't be parsed " "by :func:`time.strptime` or if it returns a value which isn't a time tuple. " -"See also :ref:`strftime-strptime-behavior` and :meth:`datetime." -"fromisoformat`." +"See also :ref:`strftime-strptime-behavior` " +"and :meth:`datetime.fromisoformat`." msgstr "" -#: ../../library/datetime.rst:1124 +#: ../../library/datetime.rst:1157 msgid "" -"If *format* specifies a day of month without a year a :exc:" -"`DeprecationWarning` is now emitted. This is to avoid a quadrennial leap " -"year bug in code seeking to parse only a month and day as the default year " -"used in absence of one in the format is not a leap year. Such *format* " +"If *format* specifies a day of month without a year " +"a :exc:`DeprecationWarning` is now emitted. This is to avoid a quadrennial " +"leap year bug in code seeking to parse only a month and day as the default " +"year used in absence of one in the format is not a leap year. Such *format* " "values may raise an error as of Python 3.15. The workaround is to always " "include a year in your *format*. If parsing *date_string* values that do " "not have a year, explicitly add a year that is a leap year before parsing:" msgstr "" -#: ../../library/datetime.rst:1133 +#: ../../library/datetime.rst:1166 msgid "" ">>> from datetime import datetime\n" ">>> date_string = \"02/29\"\n" @@ -1769,44 +1811,44 @@ msgid "" "'February 29'" msgstr "" -#: ../../library/datetime.rst:1146 +#: ../../library/datetime.rst:1179 msgid "" "The earliest representable :class:`.datetime`, ``datetime(MINYEAR, 1, 1, " "tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1152 +#: ../../library/datetime.rst:1185 msgid "" "The latest representable :class:`.datetime`, ``datetime(MAXYEAR, 12, 31, 23, " "59, 59, 999999, tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1158 +#: ../../library/datetime.rst:1191 msgid "" "The smallest possible difference between non-equal :class:`.datetime` " "objects, ``timedelta(microseconds=1)``." msgstr "" -#: ../../library/datetime.rst:1181 ../../library/datetime.rst:1804 +#: ../../library/datetime.rst:1214 ../../library/datetime.rst:1837 msgid "In ``range(24)``." msgstr "" -#: ../../library/datetime.rst:1186 ../../library/datetime.rst:1191 -#: ../../library/datetime.rst:1809 ../../library/datetime.rst:1814 +#: ../../library/datetime.rst:1219 ../../library/datetime.rst:1224 +#: ../../library/datetime.rst:1842 ../../library/datetime.rst:1847 msgid "In ``range(60)``." msgstr "" -#: ../../library/datetime.rst:1196 ../../library/datetime.rst:1819 +#: ../../library/datetime.rst:1229 ../../library/datetime.rst:1852 msgid "In ``range(1000000)``." msgstr "" -#: ../../library/datetime.rst:1201 +#: ../../library/datetime.rst:1234 msgid "" "The object passed as the *tzinfo* argument to the :class:`.datetime` " "constructor, or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1207 ../../library/datetime.rst:1830 +#: ../../library/datetime.rst:1240 ../../library/datetime.rst:1863 msgid "" "In ``[0, 1]``. Used to disambiguate wall times during a repeated interval. " "(A repeated interval occurs when clocks are rolled back at the end of " @@ -1816,26 +1858,26 @@ msgid "" "time representation." msgstr "" -#: ../../library/datetime.rst:1220 +#: ../../library/datetime.rst:1253 msgid "``datetime2 = datetime1 + timedelta``" msgstr "``datetime2 = datetime1 + timedelta``" -#: ../../library/datetime.rst:1220 ../../library/datetime.rst:2443 -#: ../../library/datetime.rst:2448 ../../library/datetime.rst:2460 -#: ../../library/datetime.rst:2465 ../../library/datetime.rst:2525 -#: ../../library/datetime.rst:2530 ../../library/datetime.rst:2534 +#: ../../library/datetime.rst:1253 ../../library/datetime.rst:2490 +#: ../../library/datetime.rst:2495 ../../library/datetime.rst:2507 +#: ../../library/datetime.rst:2512 ../../library/datetime.rst:2572 +#: ../../library/datetime.rst:2577 ../../library/datetime.rst:2581 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/datetime.rst:1222 +#: ../../library/datetime.rst:1255 msgid "``datetime2 = datetime1 - timedelta``" msgstr "``datetime2 = datetime1 - timedelta``" -#: ../../library/datetime.rst:1222 ../../library/datetime.rst:2476 +#: ../../library/datetime.rst:1255 ../../library/datetime.rst:2523 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/datetime.rst:1224 +#: ../../library/datetime.rst:1257 msgid "``timedelta = datetime1 - datetime2``" msgstr "``timedelta = datetime1 - datetime2``" @@ -1863,18 +1905,18 @@ msgstr "``datetime1 <= datetime2``" msgid "``datetime1 >= datetime2``" msgstr "``datetime1 >= datetime2``" -#: ../../library/datetime.rst:1236 +#: ../../library/datetime.rst:1269 msgid "" "``datetime2`` is a duration of ``timedelta`` removed from ``datetime1``, " -"moving forward in time if ``timedelta.days > 0``, or backward if ``timedelta." -"days < 0``. The result has the same :attr:`~.datetime.tzinfo` attribute as " -"the input datetime, and ``datetime2 - datetime1 == timedelta`` after. :exc:" -"`OverflowError` is raised if ``datetime2.year`` would be smaller than :const:" -"`MINYEAR` or larger than :const:`MAXYEAR`. Note that no time zone " -"adjustments are done even if the input is an aware object." +"moving forward in time if ``timedelta.days > 0``, or backward if " +"``timedelta.days < 0``. The result has the same :attr:`~.datetime.tzinfo` " +"attribute as the input datetime, and ``datetime2 - datetime1 == timedelta`` " +"after. :exc:`OverflowError` is raised if ``datetime2.year`` would be smaller " +"than :const:`MINYEAR` or larger than :const:`MAXYEAR`. Note that no time " +"zone adjustments are done even if the input is an aware object." msgstr "" -#: ../../library/datetime.rst:1245 +#: ../../library/datetime.rst:1278 msgid "" "Computes the ``datetime2`` such that ``datetime2 + timedelta == datetime1``. " "As for addition, the result has the same :attr:`~.datetime.tzinfo` attribute " @@ -1882,41 +1924,42 @@ msgid "" "input is aware." msgstr "" -#: ../../library/datetime.rst:1250 +#: ../../library/datetime.rst:1283 msgid "" "Subtraction of a :class:`.datetime` from a :class:`.datetime` is defined " "only if both operands are naive, or if both are aware. If one is aware and " "the other is naive, :exc:`TypeError` is raised." msgstr "" -#: ../../library/datetime.rst:1254 +#: ../../library/datetime.rst:1287 msgid "" -"If both are naive, or both are aware and have the same :attr:`~.datetime." -"tzinfo` attribute, the :attr:`~.datetime.tzinfo` attributes are ignored, and " -"the result is a :class:`timedelta` object ``t`` such that ``datetime2 + t == " -"datetime1``. No time zone adjustments are done in this case." +"If both are naive, or both are aware and have the " +"same :attr:`~.datetime.tzinfo` attribute, the :attr:`~.datetime.tzinfo` " +"attributes are ignored, and the result is a :class:`timedelta` object ``t`` " +"such that ``datetime2 + t == datetime1``. No time zone adjustments are done " +"in this case." msgstr "" -#: ../../library/datetime.rst:1259 +#: ../../library/datetime.rst:1292 msgid "" "If both are aware and have different :attr:`~.datetime.tzinfo` attributes, " "``a-b`` acts as if ``a`` and ``b`` were first converted to naive UTC " -"datetimes. The result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b." -"replace(tzinfo=None) - b.utcoffset())`` except that the implementation never " -"overflows." +"datetimes. The result is ``(a.replace(tzinfo=None) - a.utcoffset()) - " +"(b.replace(tzinfo=None) - b.utcoffset())`` except that the implementation " +"never overflows." msgstr "" -#: ../../library/datetime.rst:1265 +#: ../../library/datetime.rst:1298 msgid "" ":class:`.datetime` objects are equal if they represent the same date and " "time, taking into account the time zone." msgstr "" -#: ../../library/datetime.rst:1268 +#: ../../library/datetime.rst:1301 msgid "Naive and aware :class:`!datetime` objects are never equal." msgstr "" -#: ../../library/datetime.rst:1270 +#: ../../library/datetime.rst:1303 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1927,19 +1970,19 @@ msgid "" "interval are never equal to :class:`!datetime` instances in other time zone." msgstr "" -#: ../../library/datetime.rst:1280 +#: ../../library/datetime.rst:1313 msgid "" "*datetime1* is considered less than *datetime2* when *datetime1* precedes " "*datetime2* in time, taking into account the time zone." msgstr "" -#: ../../library/datetime.rst:1283 +#: ../../library/datetime.rst:1316 msgid "" -"Order comparison between naive and aware :class:`.datetime` objects raises :" -"exc:`TypeError`." +"Order comparison between naive and aware :class:`.datetime` objects " +"raises :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1286 +#: ../../library/datetime.rst:1319 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1949,33 +1992,33 @@ msgid "" "implementation never overflows." msgstr "" -#: ../../library/datetime.rst:1293 +#: ../../library/datetime.rst:1326 msgid "" "Equality comparisons between aware and naive :class:`.datetime` instances " "don't raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1309 +#: ../../library/datetime.rst:1342 msgid "Return :class:`date` object with same year, month and day." msgstr "" -#: ../../library/datetime.rst:1314 +#: ../../library/datetime.rst:1347 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond and " "fold. :attr:`.tzinfo` is ``None``. See also method :meth:`timetz`." msgstr "" -#: ../../library/datetime.rst:1317 ../../library/datetime.rst:1326 +#: ../../library/datetime.rst:1350 ../../library/datetime.rst:1359 msgid "The fold value is copied to the returned :class:`.time` object." msgstr "" -#: ../../library/datetime.rst:1323 +#: ../../library/datetime.rst:1356 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond, " "fold, and tzinfo attributes. See also method :meth:`time`." msgstr "" -#: ../../library/datetime.rst:1334 +#: ../../library/datetime.rst:1367 msgid "" "Return a new :class:`datetime` object with the same attributes, but with " "specified parameters updated. Note that ``tzinfo=None`` can be specified to " @@ -1983,27 +2026,27 @@ msgid "" "and time data." msgstr "" -#: ../../library/datetime.rst:1339 +#: ../../library/datetime.rst:1372 msgid "" -":class:`.datetime` objects are also supported by generic function :func:" -"`copy.replace`." +":class:`.datetime` objects are also supported by generic " +"function :func:`copy.replace`." msgstr "" -#: ../../library/datetime.rst:1348 +#: ../../library/datetime.rst:1381 msgid "" "Return a :class:`.datetime` object with new :attr:`.tzinfo` attribute *tz*, " "adjusting the date and time data so the result is the same UTC time as " "*self*, but in *tz*'s local time." msgstr "" -#: ../../library/datetime.rst:1352 +#: ../../library/datetime.rst:1385 msgid "" "If provided, *tz* must be an instance of a :class:`tzinfo` subclass, and " "its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. If " "*self* is naive, it is presumed to represent time in the system time zone." msgstr "" -#: ../../library/datetime.rst:1356 +#: ../../library/datetime.rst:1389 msgid "" "If called without arguments (or with ``tz=None``) the system local time zone " "is assumed for the target time zone. The ``.tzinfo`` attribute of the " @@ -2011,7 +2054,7 @@ msgid "" "with the zone name and offset obtained from the OS." msgstr "" -#: ../../library/datetime.rst:1361 +#: ../../library/datetime.rst:1394 msgid "" "If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no " "adjustment of date or time data is performed. Else the result is local time " @@ -2020,23 +2063,23 @@ msgid "" "date and time data as ``dt - dt.utcoffset()``." msgstr "" -#: ../../library/datetime.rst:1367 +#: ../../library/datetime.rst:1400 msgid "" "If you merely want to attach a :class:`timezone` object *tz* to a datetime " -"*dt* without adjustment of date and time data, use ``dt." -"replace(tzinfo=tz)``. If you merely want to remove the :class:`!timezone` " -"object from an aware datetime *dt* without conversion of date and time data, " -"use ``dt.replace(tzinfo=None)``." +"*dt* without adjustment of date and time data, use " +"``dt.replace(tzinfo=tz)``. If you merely want to remove the :class:`!" +"timezone` object from an aware datetime *dt* without conversion of date and " +"time data, use ``dt.replace(tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1372 +#: ../../library/datetime.rst:1405 msgid "" -"Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :" -"class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. " -"Ignoring error cases, :meth:`astimezone` acts like::" +"Note that the default :meth:`tzinfo.fromutc` method can be overridden in " +"a :class:`tzinfo` subclass to affect the result returned " +"by :meth:`astimezone`. Ignoring error cases, :meth:`astimezone` acts like::" msgstr "" -#: ../../library/datetime.rst:1376 +#: ../../library/datetime.rst:1409 msgid "" "def astimezone(self, tz):\n" " if self.tzinfo is tz:\n" @@ -2047,49 +2090,51 @@ msgid "" " return tz.fromutc(utc)" msgstr "" -#: ../../library/datetime.rst:1384 +#: ../../library/datetime.rst:1417 msgid "*tz* now can be omitted." msgstr "" -#: ../../library/datetime.rst:1387 +#: ../../library/datetime.rst:1420 msgid "" "The :meth:`astimezone` method can now be called on naive instances that are " "presumed to represent system local time." msgstr "" -#: ../../library/datetime.rst:1394 +#: ../../library/datetime.rst:1427 msgid "" -"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." -"utcoffset(self)``, and raises an exception if the latter doesn't return " -"``None`` or a :class:`timedelta` object with magnitude less than one day." +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.utcoffset(self)``, and raises an exception if the latter " +"doesn't return ``None`` or a :class:`timedelta` object with magnitude less " +"than one day." msgstr "" -#: ../../library/datetime.rst:1398 ../../library/datetime.rst:1993 -#: ../../library/datetime.rst:2100 ../../library/datetime.rst:2345 -#: ../../library/datetime.rst:2357 ../../library/datetime.rst:2669 +#: ../../library/datetime.rst:1431 ../../library/datetime.rst:2042 +#: ../../library/datetime.rst:2149 ../../library/datetime.rst:2394 +#: ../../library/datetime.rst:2406 ../../library/datetime.rst:2716 msgid "The UTC offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1404 +#: ../../library/datetime.rst:1437 msgid "" -"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." -"dst(self)``, and raises an exception if the latter doesn't return ``None`` " -"or a :class:`timedelta` object with magnitude less than one day." +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.dst(self)``, and raises an exception if the latter doesn't " +"return ``None`` or a :class:`timedelta` object with magnitude less than one " +"day." msgstr "" -#: ../../library/datetime.rst:1408 ../../library/datetime.rst:2003 -#: ../../library/datetime.rst:2154 +#: ../../library/datetime.rst:1441 ../../library/datetime.rst:2052 +#: ../../library/datetime.rst:2203 msgid "The DST offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1414 +#: ../../library/datetime.rst:1447 msgid "" -"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." -"tzname(self)``, raises an exception if the latter doesn't return ``None`` or " -"a string object," +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.tzname(self)``, raises an exception if the latter doesn't " +"return ``None`` or a string object," msgstr "" -#: ../../library/datetime.rst:1425 +#: ../../library/datetime.rst:1458 msgid "" "time.struct_time((d.year, d.month, d.day,\n" " d.hour, d.minute, d.second,\n" @@ -2099,141 +2144,141 @@ msgstr "" " d.hour, d.minute, d.second,\n" " d.weekday(), yday, dst))" -#: ../../library/datetime.rst:1429 +#: ../../library/datetime.rst:1462 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " -"day number within the current year starting with 1 for January 1st. The :" -"attr:`~time.struct_time.tm_isdst` flag of the result is set according to " -"the :meth:`dst` method: :attr:`.tzinfo` is ``None`` or :meth:`dst` returns " -"``None``, :attr:`!tm_isdst` is set to ``-1``; else if :meth:`dst` returns a " -"non-zero value, :attr:`!tm_isdst` is set to 1; else :attr:`!tm_isdst` is set " -"to 0." +"day number within the current year starting with 1 for January 1st. " +"The :attr:`~time.struct_time.tm_isdst` flag of the result is set according " +"to the :meth:`dst` method: :attr:`.tzinfo` is ``None`` or :meth:`dst` " +"returns ``None``, :attr:`!tm_isdst` is set to ``-1``; else if :meth:`dst` " +"returns a non-zero value, :attr:`!tm_isdst` is set to 1; else :attr:`!" +"tm_isdst` is set to 0." msgstr "" -#: ../../library/datetime.rst:1440 +#: ../../library/datetime.rst:1473 msgid "" -"If :class:`.datetime` instance ``d`` is naive, this is the same as ``d." -"timetuple()`` except that :attr:`~.time.struct_time.tm_isdst` is forced to 0 " -"regardless of what ``d.dst()`` returns. DST is never in effect for a UTC " -"time." +"If :class:`.datetime` instance ``d`` is naive, this is the same as " +"``d.timetuple()`` except that :attr:`~.time.struct_time.tm_isdst` is forced " +"to 0 regardless of what ``d.dst()`` returns. DST is never in effect for a " +"UTC time." msgstr "" -#: ../../library/datetime.rst:1444 +#: ../../library/datetime.rst:1477 msgid "" -"If ``d`` is aware, ``d`` is normalized to UTC time, by subtracting ``d." -"utcoffset()``, and a :class:`time.struct_time` for the normalized time is " -"returned. :attr:`!tm_isdst` is forced to 0. Note that an :exc:" -"`OverflowError` may be raised if ``d.year`` was ``MINYEAR`` or ``MAXYEAR`` " -"and UTC adjustment spills over a year boundary." +"If ``d`` is aware, ``d`` is normalized to UTC time, by subtracting " +"``d.utcoffset()``, and a :class:`time.struct_time` for the normalized time " +"is returned. :attr:`!tm_isdst` is forced to 0. Note that " +"an :exc:`OverflowError` may be raised if ``d.year`` was ``MINYEAR`` or " +"``MAXYEAR`` and UTC adjustment spills over a year boundary." msgstr "" -#: ../../library/datetime.rst:1453 +#: ../../library/datetime.rst:1486 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " "UTC; as a result, using :meth:`datetime.utctimetuple` may give misleading " -"results. If you have a naive ``datetime`` representing UTC, use ``datetime." -"replace(tzinfo=timezone.utc)`` to make it aware, at which point you can use :" -"meth:`.datetime.timetuple`." +"results. If you have a naive ``datetime`` representing UTC, use " +"``datetime.replace(tzinfo=timezone.utc)`` to make it aware, at which point " +"you can use :meth:`.datetime.timetuple`." msgstr "" -#: ../../library/datetime.rst:1462 +#: ../../library/datetime.rst:1495 msgid "" -"Return the proleptic Gregorian ordinal of the date. The same as ``self." -"date().toordinal()``." +"Return the proleptic Gregorian ordinal of the date. The same as " +"``self.date().toordinal()``." msgstr "" -#: ../../library/datetime.rst:1467 +#: ../../library/datetime.rst:1500 msgid "" "Return POSIX timestamp corresponding to the :class:`.datetime` instance. The " -"return value is a :class:`float` similar to that returned by :func:`time." -"time`." +"return value is a :class:`float` similar to that returned " +"by :func:`time.time`." msgstr "" -#: ../../library/datetime.rst:1471 +#: ../../library/datetime.rst:1504 msgid "" "Naive :class:`.datetime` instances are assumed to represent local time and " "this method relies on the platform C :c:func:`mktime` function to perform " "the conversion. Since :class:`.datetime` supports wider range of values " -"than :c:func:`mktime` on many platforms, this method may raise :exc:" -"`OverflowError` or :exc:`OSError` for times far in the past or far in the " -"future." +"than :c:func:`mktime` on many platforms, this method may " +"raise :exc:`OverflowError` or :exc:`OSError` for times far in the past or " +"far in the future." msgstr "" -#: ../../library/datetime.rst:1478 +#: ../../library/datetime.rst:1511 msgid "" "For aware :class:`.datetime` instances, the return value is computed as::" msgstr "" -#: ../../library/datetime.rst:1481 +#: ../../library/datetime.rst:1514 msgid "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" msgstr "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" -#: ../../library/datetime.rst:1485 +#: ../../library/datetime.rst:1518 msgid "" "The :meth:`timestamp` method uses the :attr:`.fold` attribute to " "disambiguate the times during a repeated interval." msgstr "" -#: ../../library/datetime.rst:1491 +#: ../../library/datetime.rst:1524 msgid "" -"There is no method to obtain the POSIX timestamp directly from a naive :" -"class:`.datetime` instance representing UTC time. If your application uses " -"this convention and your system time zone is not set to UTC, you can obtain " -"the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" +"There is no method to obtain the POSIX timestamp directly from a " +"naive :class:`.datetime` instance representing UTC time. If your application " +"uses this convention and your system time zone is not set to UTC, you can " +"obtain the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" msgstr "" -#: ../../library/datetime.rst:1497 +#: ../../library/datetime.rst:1530 msgid "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" msgstr "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" -#: ../../library/datetime.rst:1499 +#: ../../library/datetime.rst:1532 msgid "or by calculating the timestamp directly::" msgstr "" -#: ../../library/datetime.rst:1501 +#: ../../library/datetime.rst:1534 msgid "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" msgstr "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" -#: ../../library/datetime.rst:1505 +#: ../../library/datetime.rst:1538 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "The same as ``self.date().weekday()``. See also :meth:`isoweekday`." msgstr "" -#: ../../library/datetime.rst:1511 +#: ../../library/datetime.rst:1544 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " -"The same as ``self.date().isoweekday()``. See also :meth:`weekday`, :meth:" -"`isocalendar`." +"The same as ``self.date().isoweekday()``. See " +"also :meth:`weekday`, :meth:`isocalendar`." msgstr "" -#: ../../library/datetime.rst:1518 +#: ../../library/datetime.rst:1551 msgid "" "Return a :term:`named tuple` with three components: ``year``, ``week`` and " "``weekday``. The same as ``self.date().isocalendar()``." msgstr "" -#: ../../library/datetime.rst:1524 +#: ../../library/datetime.rst:1557 msgid "Return a string representing the date and time in ISO 8601 format:" msgstr "" -#: ../../library/datetime.rst:1526 +#: ../../library/datetime.rst:1559 msgid "``YYYY-MM-DDTHH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "``YYYY-MM-DDTHH:MM:SS.ffffff``,如果 :attr:`microsecond` 不是 0" -#: ../../library/datetime.rst:1527 +#: ../../library/datetime.rst:1560 msgid "``YYYY-MM-DDTHH:MM:SS``, if :attr:`microsecond` is 0" msgstr "``YYYY-MM-DDTHH:MM:SS``,如果 :attr:`microsecond` 是 0" -#: ../../library/datetime.rst:1529 +#: ../../library/datetime.rst:1562 msgid "" "If :meth:`utcoffset` does not return ``None``, a string is appended, giving " "the UTC offset:" msgstr "" "如果 :meth:`utcoffset` 没有回傳 ``None``,則會附加一个字串,給出 UTC 偏移:" -#: ../../library/datetime.rst:1532 +#: ../../library/datetime.rst:1565 msgid "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` " "is not 0" @@ -2241,13 +2286,13 @@ msgstr "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``,如果 :attr:`microsecond` " "不是 0" -#: ../../library/datetime.rst:1534 +#: ../../library/datetime.rst:1567 msgid "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0" msgstr "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``,如果 :attr:`microsecond` 是 0" -#: ../../library/datetime.rst:1538 +#: ../../library/datetime.rst:1571 msgid "" ">>> from datetime import datetime, timezone\n" ">>> datetime(2019, 5, 18, 15, 17, 8, 132263).isoformat()\n" @@ -2261,13 +2306,13 @@ msgstr "" ">>> datetime(2019, 5, 18, 15, 17, tzinfo=timezone.utc).isoformat()\n" "'2019-05-18T15:17:00+00:00'" -#: ../../library/datetime.rst:1544 +#: ../../library/datetime.rst:1577 msgid "" "The optional argument *sep* (default ``'T'``) is a one-character separator, " "placed between the date and time portions of the result. For example::" msgstr "" -#: ../../library/datetime.rst:1547 +#: ../../library/datetime.rst:1580 msgid "" ">>> from datetime import tzinfo, timedelta, datetime\n" ">>> class TZ(tzinfo):\n" @@ -2281,53 +2326,53 @@ msgid "" "'2009-11-27T00:00:00.000100-06:39'" msgstr "" -#: ../../library/datetime.rst:1558 ../../library/datetime.rst:1933 +#: ../../library/datetime.rst:1591 ../../library/datetime.rst:1982 msgid "" "The optional argument *timespec* specifies the number of additional " "components of the time to include (the default is ``'auto'``). It can be one " "of the following:" msgstr "" -#: ../../library/datetime.rst:1562 ../../library/datetime.rst:1937 +#: ../../library/datetime.rst:1595 ../../library/datetime.rst:1986 msgid "" "``'auto'``: Same as ``'seconds'`` if :attr:`microsecond` is 0, same as " "``'microseconds'`` otherwise." msgstr "" -#: ../../library/datetime.rst:1564 ../../library/datetime.rst:1939 +#: ../../library/datetime.rst:1597 ../../library/datetime.rst:1988 msgid "``'hours'``: Include the :attr:`hour` in the two-digit ``HH`` format." msgstr "" -#: ../../library/datetime.rst:1565 ../../library/datetime.rst:1940 +#: ../../library/datetime.rst:1598 ../../library/datetime.rst:1989 msgid "" "``'minutes'``: Include :attr:`hour` and :attr:`minute` in ``HH:MM`` format." msgstr "" -#: ../../library/datetime.rst:1566 ../../library/datetime.rst:1941 +#: ../../library/datetime.rst:1599 ../../library/datetime.rst:1990 msgid "" "``'seconds'``: Include :attr:`hour`, :attr:`minute`, and :attr:`second` in " "``HH:MM:SS`` format." msgstr "" -#: ../../library/datetime.rst:1568 ../../library/datetime.rst:1943 +#: ../../library/datetime.rst:1601 ../../library/datetime.rst:1992 msgid "" "``'milliseconds'``: Include full time, but truncate fractional second part " "to milliseconds. ``HH:MM:SS.sss`` format." msgstr "" -#: ../../library/datetime.rst:1570 ../../library/datetime.rst:1945 +#: ../../library/datetime.rst:1603 ../../library/datetime.rst:1994 msgid "``'microseconds'``: Include full time in ``HH:MM:SS.ffffff`` format." msgstr "" -#: ../../library/datetime.rst:1574 ../../library/datetime.rst:1949 +#: ../../library/datetime.rst:1607 ../../library/datetime.rst:1998 msgid "Excluded time components are truncated, not rounded." msgstr "" -#: ../../library/datetime.rst:1576 +#: ../../library/datetime.rst:1609 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument::" msgstr "" -#: ../../library/datetime.rst:1579 +#: ../../library/datetime.rst:1612 msgid "" ">>> from datetime import datetime\n" ">>> datetime.now().isoformat(timespec='minutes')\n" @@ -2343,21 +2388,21 @@ msgstr "" ">>> dt.isoformat(timespec='microseconds')\n" "'2015-01-01T12:30:59.000000'" -#: ../../library/datetime.rst:1586 ../../library/datetime.rst:1964 +#: ../../library/datetime.rst:1619 ../../library/datetime.rst:2013 msgid "Added the *timespec* parameter." msgstr "新增 *timespec* 參數。" -#: ../../library/datetime.rst:1592 +#: ../../library/datetime.rst:1625 msgid "" -"For a :class:`.datetime` instance ``d``, ``str(d)`` is equivalent to ``d." -"isoformat(' ')``." +"For a :class:`.datetime` instance ``d``, ``str(d)`` is equivalent to " +"``d.isoformat(' ')``." msgstr "" -#: ../../library/datetime.rst:1598 +#: ../../library/datetime.rst:1631 msgid "Return a string representing the date and time::" msgstr "" -#: ../../library/datetime.rst:1600 +#: ../../library/datetime.rst:1633 msgid "" ">>> from datetime import datetime\n" ">>> datetime(2002, 12, 4, 20, 30, 40).ctime()\n" @@ -2367,43 +2412,43 @@ msgstr "" ">>> datetime(2002, 12, 4, 20, 30, 40).ctime()\n" "'Wed Dec 4 20:30:40 2002'" -#: ../../library/datetime.rst:1604 +#: ../../library/datetime.rst:1637 msgid "" "The output string will *not* include time zone information, regardless of " "whether the input is aware or naive." msgstr "" -#: ../../library/datetime.rst:1611 +#: ../../library/datetime.rst:1644 msgid "" -"on platforms where the native C :c:func:`ctime` function (which :func:`time." -"ctime` invokes, but which :meth:`datetime.ctime` does not invoke) conforms " -"to the C standard." +"on platforms where the native C :c:func:`ctime` function " +"(which :func:`time.ctime` invokes, but which :meth:`datetime.ctime` does not " +"invoke) conforms to the C standard." msgstr "" -#: ../../library/datetime.rst:1618 +#: ../../library/datetime.rst:1651 msgid "" "Return a string representing the date and time, controlled by an explicit " -"format string. See also :ref:`strftime-strptime-behavior` and :meth:" -"`datetime.isoformat`." +"format string. See also :ref:`strftime-strptime-behavior` " +"and :meth:`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1625 +#: ../../library/datetime.rst:1658 msgid "" "Same as :meth:`.datetime.strftime`. This makes it possible to specify a " "format string for a :class:`.datetime` object in :ref:`formatted string " -"literals ` and when using :meth:`str.format`. See also :ref:" -"`strftime-strptime-behavior` and :meth:`datetime.isoformat`." +"literals ` and when using :meth:`str.format`. See " +"also :ref:`strftime-strptime-behavior` and :meth:`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1632 +#: ../../library/datetime.rst:1665 msgid "Examples of Usage: :class:`.datetime`" msgstr "用法範例::class:`.datetime`" -#: ../../library/datetime.rst:1634 +#: ../../library/datetime.rst:1667 msgid "Examples of working with :class:`.datetime` objects:" msgstr "更多 :class:`.datetime` 的用法範例:" -#: ../../library/datetime.rst:1636 +#: ../../library/datetime.rst:1669 msgid "" ">>> from datetime import datetime, date, time, timezone\n" "\n" @@ -2417,8 +2462,8 @@ msgid "" ">>> datetime.now()\n" "datetime.datetime(2007, 12, 6, 16, 29, 43, 79043) # GMT +1\n" ">>> datetime.now(timezone.utc)\n" -"datetime.datetime(2007, 12, 6, 15, 29, 43, 79060, tzinfo=datetime.timezone." -"utc)\n" +"datetime.datetime(2007, 12, 6, 15, 29, 43, 79060, " +"tzinfo=datetime.timezone.utc)\n" "\n" ">>> # Using datetime.strptime()\n" ">>> dt = datetime.strptime(\"21/11/06 16:30\", \"%d/%m/%y %H:%M\")\n" @@ -2452,19 +2497,19 @@ msgid "" ">>> # Formatting a datetime\n" ">>> dt.strftime(\"%A, %d. %B %Y %I:%M%p\")\n" "'Tuesday, 21. November 2006 04:30PM'\n" -">>> 'The {1} is {0:%d}, the {2} is {0:%B}, the {3} is {0:%I:%M%p}.'." -"format(dt, \"day\", \"month\", \"time\")\n" +">>> 'The {1} is {0:%d}, the {2} is {0:%B}, the {3} is {0:%I:" +"%M%p}.'.format(dt, \"day\", \"month\", \"time\")\n" "'The day is 21, the month is November, the time is 04:30PM.'" msgstr "" -#: ../../library/datetime.rst:1687 +#: ../../library/datetime.rst:1720 msgid "" "The example below defines a :class:`tzinfo` subclass capturing time zone " "information for Kabul, Afghanistan, which used +4 UTC until 1945 and then " "+4:30 UTC thereafter::" msgstr "" -#: ../../library/datetime.rst:1691 +#: ../../library/datetime.rst:1724 msgid "" "from datetime import timedelta, datetime, tzinfo, timezone\n" "\n" @@ -2511,11 +2556,11 @@ msgid "" " return \"+04\"" msgstr "" -#: ../../library/datetime.rst:1734 +#: ../../library/datetime.rst:1767 msgid "Usage of ``KabulTz`` from above::" msgstr "" -#: ../../library/datetime.rst:1736 +#: ../../library/datetime.rst:1769 msgid "" ">>> tz1 = KabulTz()\n" "\n" @@ -2539,63 +2584,63 @@ msgid "" "True" msgstr "" -#: ../../library/datetime.rst:1760 +#: ../../library/datetime.rst:1793 msgid ":class:`.time` Objects" msgstr ":class:`.time` 物件" -#: ../../library/datetime.rst:1762 +#: ../../library/datetime.rst:1795 msgid "" "A :class:`.time` object represents a (local) time of day, independent of any " "particular day, and subject to adjustment via a :class:`tzinfo` object." msgstr "" -#: ../../library/datetime.rst:1767 +#: ../../library/datetime.rst:1800 msgid "" -"All arguments are optional. *tzinfo* may be ``None``, or an instance of a :" -"class:`tzinfo` subclass. The remaining arguments must be integers in the " +"All arguments are optional. *tzinfo* may be ``None``, or an instance of " +"a :class:`tzinfo` subclass. The remaining arguments must be integers in the " "following ranges:" msgstr "" -#: ../../library/datetime.rst:1777 +#: ../../library/datetime.rst:1810 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised. " "All default to 0 except *tzinfo*, which defaults to ``None``." msgstr "" -#: ../../library/datetime.rst:1785 +#: ../../library/datetime.rst:1818 msgid "The earliest representable :class:`.time`, ``time(0, 0, 0, 0)``." msgstr "" -#: ../../library/datetime.rst:1790 +#: ../../library/datetime.rst:1823 msgid "The latest representable :class:`.time`, ``time(23, 59, 59, 999999)``." msgstr "" -#: ../../library/datetime.rst:1795 +#: ../../library/datetime.rst:1828 msgid "" "The smallest possible difference between non-equal :class:`.time` objects, " -"``timedelta(microseconds=1)``, although note that arithmetic on :class:`." -"time` objects is not supported." +"``timedelta(microseconds=1)``, although note that arithmetic " +"on :class:`.time` objects is not supported." msgstr "" -#: ../../library/datetime.rst:1824 +#: ../../library/datetime.rst:1857 msgid "" "The object passed as the tzinfo argument to the :class:`.time` constructor, " "or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1838 +#: ../../library/datetime.rst:1871 msgid "" ":class:`.time` objects support equality and order comparisons, where ``a`` " "is considered less than ``b`` when ``a`` precedes ``b`` in time." msgstr "" -#: ../../library/datetime.rst:1841 +#: ../../library/datetime.rst:1874 msgid "" "Naive and aware :class:`!time` objects are never equal. Order comparison " "between naive and aware :class:`!time` objects raises :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1845 +#: ../../library/datetime.rst:1878 msgid "" "If both comparands are aware, and have the same :attr:`~.time.tzinfo` " "attribute, the :attr:`!tzinfo` and :attr:`!fold` attributes are ignored and " @@ -2604,18 +2649,18 @@ msgid "" "subtracting their UTC offsets (obtained from ``self.utcoffset()``)." msgstr "" -#: ../../library/datetime.rst:1851 +#: ../../library/datetime.rst:1884 msgid "" "Equality comparisons between aware and naive :class:`.time` instances don't " "raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1855 +#: ../../library/datetime.rst:1888 msgid "" "In Boolean contexts, a :class:`.time` object is always considered to be true." msgstr "" -#: ../../library/datetime.rst:1857 +#: ../../library/datetime.rst:1890 msgid "" "Before Python 3.5, a :class:`.time` object was considered to be false if it " "represented midnight in UTC. This behavior was considered obscure and error-" @@ -2623,33 +2668,34 @@ msgid "" "details." msgstr "" -#: ../../library/datetime.rst:1864 -msgid "Other constructor:" -msgstr "" +#: ../../library/datetime.rst:1897 +#, fuzzy +msgid "Other constructors:" +msgstr "建構函式:" -#: ../../library/datetime.rst:1868 +#: ../../library/datetime.rst:1901 msgid "" "Return a :class:`.time` corresponding to a *time_string* in any valid ISO " "8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:1872 +#: ../../library/datetime.rst:1905 msgid "" "The leading ``T``, normally required in cases where there may be ambiguity " "between a date and a time, is not required." msgstr "" -#: ../../library/datetime.rst:1874 +#: ../../library/datetime.rst:1907 msgid "" "Fractional seconds may have any number of digits (anything beyond 6 will be " "truncated)." msgstr "" -#: ../../library/datetime.rst:1878 +#: ../../library/datetime.rst:1911 msgid "Examples:" msgstr "範例: ::" -#: ../../library/datetime.rst:1880 +#: ../../library/datetime.rst:1913 msgid "" ">>> from datetime import time\n" ">>> time.fromisoformat('04:23:01')\n" @@ -2663,8 +2709,8 @@ msgid "" ">>> time.fromisoformat('04:23:01,000384')\n" "datetime.time(4, 23, 1, 384)\n" ">>> time.fromisoformat('04:23:01+04:00')\n" -"datetime.time(4, 23, 1, tzinfo=datetime.timezone(datetime." -"timedelta(seconds=14400)))\n" +"datetime.time(4, 23, 1, " +"tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))\n" ">>> time.fromisoformat('04:23:01Z')\n" "datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)\n" ">>> time.fromisoformat('04:23:01+00:00')\n" @@ -2682,20 +2728,45 @@ msgstr "" ">>> time.fromisoformat('04:23:01,000384')\n" "datetime.time(4, 23, 1, 384)\n" ">>> time.fromisoformat('04:23:01+04:00')\n" -"datetime.time(4, 23, 1, tzinfo=datetime.timezone(datetime." -"timedelta(seconds=14400)))\n" +"datetime.time(4, 23, 1, " +"tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))\n" ">>> time.fromisoformat('04:23:01Z')\n" "datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)\n" ">>> time.fromisoformat('04:23:01+00:00')\n" "datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)" -#: ../../library/datetime.rst:1902 +#: ../../library/datetime.rst:1935 msgid "" -"Previously, this method only supported formats that could be emitted by :" -"meth:`time.isoformat`." +"Previously, this method only supported formats that could be emitted " +"by :meth:`time.isoformat`." msgstr "" -#: ../../library/datetime.rst:1912 +#: ../../library/datetime.rst:1941 +msgid "" +"Return a :class:`.time` corresponding to *date_string*, parsed according to " +"*format*." +msgstr "" + +#: ../../library/datetime.rst:1944 +msgid "" +"If *format* does not contain microseconds or timezone information, this is " +"equivalent to::" +msgstr "" + +#: ../../library/datetime.rst:1946 +#, fuzzy +msgid "time(*(time.strptime(date_string, format)[3:6]))" +msgstr "datetime(*(time.strptime(date_string, format)[0:6]))" + +#: ../../library/datetime.rst:1948 +msgid "" +":exc:`ValueError` is raised if the *date_string* and *format* cannot be " +"parsed by :func:`time.strptime` or if it returns a value which is not a time " +"tuple. See also :ref:`strftime-strptime-behavior` " +"and :meth:`time.fromisoformat`." +msgstr "" + +#: ../../library/datetime.rst:1961 msgid "" "Return a new :class:`.time` with the same values, but with specified " "parameters updated. Note that ``tzinfo=None`` can be specified to create a " @@ -2703,45 +2774,45 @@ msgid "" "time data." msgstr "" -#: ../../library/datetime.rst:1917 +#: ../../library/datetime.rst:1966 msgid "" -":class:`.time` objects are also supported by generic function :func:`copy." -"replace`." +":class:`.time` objects are also supported by generic " +"function :func:`copy.replace`." msgstr "" -#: ../../library/datetime.rst:1926 +#: ../../library/datetime.rst:1975 msgid "Return a string representing the time in ISO 8601 format, one of:" msgstr "" -#: ../../library/datetime.rst:1928 +#: ../../library/datetime.rst:1977 msgid "``HH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "" -#: ../../library/datetime.rst:1929 +#: ../../library/datetime.rst:1978 msgid "``HH:MM:SS``, if :attr:`microsecond` is 0" msgstr "" -#: ../../library/datetime.rst:1930 +#: ../../library/datetime.rst:1979 msgid "" "``HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :meth:`utcoffset` does not " "return ``None``" msgstr "" -#: ../../library/datetime.rst:1931 +#: ../../library/datetime.rst:1980 msgid "" -"``HH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0 and :meth:" -"`utcoffset` does not return ``None``" +"``HH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0 " +"and :meth:`utcoffset` does not return ``None``" msgstr "" -#: ../../library/datetime.rst:1951 +#: ../../library/datetime.rst:2000 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument." msgstr "" -#: ../../library/datetime.rst:1955 +#: ../../library/datetime.rst:2004 msgid "" ">>> from datetime import time\n" -">>> time(hour=12, minute=34, second=56, microsecond=123456)." -"isoformat(timespec='minutes')\n" +">>> time(hour=12, minute=34, second=56, " +"microsecond=123456).isoformat(timespec='minutes')\n" "'12:34'\n" ">>> dt = time(hour=12, minute=34, second=56, microsecond=0)\n" ">>> dt.isoformat(timespec='microseconds')\n" @@ -2750,8 +2821,8 @@ msgid "" "'12:34:56'" msgstr "" ">>> from datetime import time\n" -">>> time(hour=12, minute=34, second=56, microsecond=123456)." -"isoformat(timespec='minutes')\n" +">>> time(hour=12, minute=34, second=56, " +"microsecond=123456).isoformat(timespec='minutes')\n" "'12:34'\n" ">>> dt = time(hour=12, minute=34, second=56, microsecond=0)\n" ">>> dt.isoformat(timespec='microseconds')\n" @@ -2759,18 +2830,18 @@ msgstr "" ">>> dt.isoformat(timespec='auto')\n" "'12:34:56'" -#: ../../library/datetime.rst:1970 +#: ../../library/datetime.rst:2019 msgid "For a time ``t``, ``str(t)`` is equivalent to ``t.isoformat()``." msgstr "" -#: ../../library/datetime.rst:1975 +#: ../../library/datetime.rst:2024 msgid "" "Return a string representing the time, controlled by an explicit format " -"string. See also :ref:`strftime-strptime-behavior` and :meth:`time." -"isoformat`." +"string. See also :ref:`strftime-strptime-behavior` " +"and :meth:`time.isoformat`." msgstr "" -#: ../../library/datetime.rst:1981 +#: ../../library/datetime.rst:2030 msgid "" "Same as :meth:`.time.strftime`. This makes it possible to specify a format " "string for a :class:`.time` object in :ref:`formatted string literals >> from datetime import time, tzinfo, timedelta\n" ">>> class TZ1(tzinfo):\n" @@ -2859,147 +2932,149 @@ msgstr "" ">>> 'The {} is {:%H:%M}.'.format(\"time\", t)\n" "'The time is 12:10.'" -#: ../../library/datetime.rst:2046 +#: ../../library/datetime.rst:2095 msgid ":class:`tzinfo` Objects" msgstr ":class:`tzinfo` 物件" -#: ../../library/datetime.rst:2050 +#: ../../library/datetime.rst:2099 msgid "" "This is an abstract base class, meaning that this class should not be " "instantiated directly. Define a subclass of :class:`tzinfo` to capture " "information about a particular time zone." msgstr "" -#: ../../library/datetime.rst:2054 +#: ../../library/datetime.rst:2103 msgid "" "An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the " "constructors for :class:`.datetime` and :class:`.time` objects. The latter " -"objects view their attributes as being in local time, and the :class:" -"`tzinfo` object supports methods revealing offset of local time from UTC, " -"the name of the time zone, and DST offset, all relative to a date or time " -"object passed to them." +"objects view their attributes as being in local time, and " +"the :class:`tzinfo` object supports methods revealing offset of local time " +"from UTC, the name of the time zone, and DST offset, all relative to a date " +"or time object passed to them." msgstr "" -#: ../../library/datetime.rst:2060 +#: ../../library/datetime.rst:2109 msgid "" "You need to derive a concrete subclass, and (at least) supply " -"implementations of the standard :class:`tzinfo` methods needed by the :class:" -"`.datetime` methods you use. The :mod:`!datetime` module provides :class:" -"`timezone`, a simple concrete subclass of :class:`tzinfo` which can " -"represent time zones with fixed offset from UTC such as UTC itself or North " -"American EST and EDT." +"implementations of the standard :class:`tzinfo` methods needed by " +"the :class:`.datetime` methods you use. The :mod:`!datetime` module " +"provides :class:`timezone`, a simple concrete subclass of :class:`tzinfo` " +"which can represent time zones with fixed offset from UTC such as UTC itself " +"or North American EST and EDT." msgstr "" -#: ../../library/datetime.rst:2067 +#: ../../library/datetime.rst:2116 msgid "" -"Special requirement for pickling: A :class:`tzinfo` subclass must have an :" -"meth:`~object.__init__` method that can be called with no arguments, " +"Special requirement for pickling: A :class:`tzinfo` subclass must have " +"an :meth:`~object.__init__` method that can be called with no arguments, " "otherwise it can be pickled but possibly not unpickled again. This is a " "technical requirement that may be relaxed in the future." msgstr "" -#: ../../library/datetime.rst:2073 +#: ../../library/datetime.rst:2122 msgid "" "A concrete subclass of :class:`tzinfo` may need to implement the following " -"methods. Exactly which methods are needed depends on the uses made of aware :" -"mod:`!datetime` objects. If in doubt, simply implement all of them." +"methods. Exactly which methods are needed depends on the uses made of " +"aware :mod:`!datetime` objects. If in doubt, simply implement all of them." msgstr "" -#: ../../library/datetime.rst:2080 +#: ../../library/datetime.rst:2129 msgid "" "Return offset of local time from UTC, as a :class:`timedelta` object that is " "positive east of UTC. If local time is west of UTC, this should be negative." msgstr "" -#: ../../library/datetime.rst:2083 +#: ../../library/datetime.rst:2132 msgid "" -"This represents the *total* offset from UTC; for example, if a :class:" -"`tzinfo` object represents both time zone and DST adjustments, :meth:" -"`utcoffset` should return their sum. If the UTC offset isn't known, return " -"``None``. Else the value returned must be a :class:`timedelta` object " -"strictly between ``-timedelta(hours=24)`` and ``timedelta(hours=24)`` (the " -"magnitude of the offset must be less than one day). Most implementations of :" -"meth:`utcoffset` will probably look like one of these two::" +"This represents the *total* offset from UTC; for example, if " +"a :class:`tzinfo` object represents both time zone and DST " +"adjustments, :meth:`utcoffset` should return their sum. If the UTC offset " +"isn't known, return ``None``. Else the value returned must be " +"a :class:`timedelta` object strictly between ``-timedelta(hours=24)`` and " +"``timedelta(hours=24)`` (the magnitude of the offset must be less than one " +"day). Most implementations of :meth:`utcoffset` will probably look like one " +"of these two::" msgstr "" -#: ../../library/datetime.rst:2091 +#: ../../library/datetime.rst:2140 msgid "" "return CONSTANT # fixed-offset class\n" "return CONSTANT + self.dst(dt) # daylight-aware class" msgstr "" -#: ../../library/datetime.rst:2094 +#: ../../library/datetime.rst:2143 msgid "" "If :meth:`utcoffset` does not return ``None``, :meth:`dst` should not return " "``None`` either." msgstr "" -#: ../../library/datetime.rst:2097 +#: ../../library/datetime.rst:2146 msgid "" -"The default implementation of :meth:`utcoffset` raises :exc:" -"`NotImplementedError`." +"The default implementation of :meth:`utcoffset` " +"raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2106 +#: ../../library/datetime.rst:2155 msgid "" "Return the daylight saving time (DST) adjustment, as a :class:`timedelta` " "object or ``None`` if DST information isn't known." msgstr "" -#: ../../library/datetime.rst:2110 +#: ../../library/datetime.rst:2159 msgid "" "Return ``timedelta(0)`` if DST is not in effect. If DST is in effect, return " "the offset as a :class:`timedelta` object (see :meth:`utcoffset` for " "details). Note that DST offset, if applicable, has already been added to the " -"UTC offset returned by :meth:`utcoffset`, so there's no need to consult :" -"meth:`dst` unless you're interested in obtaining DST info separately. For " -"example, :meth:`datetime.timetuple` calls its :attr:`~.datetime.tzinfo` " -"attribute's :meth:`dst` method to determine how the :attr:`~time.struct_time." -"tm_isdst` flag should be set, and :meth:`tzinfo.fromutc` calls :meth:`dst` " -"to account for DST changes when crossing time zones." +"UTC offset returned by :meth:`utcoffset`, so there's no need to " +"consult :meth:`dst` unless you're interested in obtaining DST info " +"separately. For example, :meth:`datetime.timetuple` calls " +"its :attr:`~.datetime.tzinfo` attribute's :meth:`dst` method to determine " +"how the :attr:`~time.struct_time.tm_isdst` flag should be set, " +"and :meth:`tzinfo.fromutc` calls :meth:`dst` to account for DST changes when " +"crossing time zones." msgstr "" -#: ../../library/datetime.rst:2120 +#: ../../library/datetime.rst:2169 msgid "" "An instance *tz* of a :class:`tzinfo` subclass that models both standard and " "daylight times must be consistent in this sense:" msgstr "" -#: ../../library/datetime.rst:2123 +#: ../../library/datetime.rst:2172 msgid "``tz.utcoffset(dt) - tz.dst(dt)``" msgstr "``tz.utcoffset(dt) - tz.dst(dt)``" -#: ../../library/datetime.rst:2125 +#: ../../library/datetime.rst:2174 msgid "" -"must return the same result for every :class:`.datetime` *dt* with ``dt." -"tzinfo == tz``. For sane :class:`tzinfo` subclasses, this expression yields " -"the time zone's \"standard offset\", which should not depend on the date or " -"the time, but only on geographic location. The implementation of :meth:" -"`datetime.astimezone` relies on this, but cannot detect violations; it's the " -"programmer's responsibility to ensure it. If a :class:`tzinfo` subclass " -"cannot guarantee this, it may be able to override the default implementation " -"of :meth:`tzinfo.fromutc` to work correctly with :meth:`~.datetime." -"astimezone` regardless." +"must return the same result for every :class:`.datetime` *dt* with " +"``dt.tzinfo == tz``. For sane :class:`tzinfo` subclasses, this expression " +"yields the time zone's \"standard offset\", which should not depend on the " +"date or the time, but only on geographic location. The implementation " +"of :meth:`datetime.astimezone` relies on this, but cannot detect violations; " +"it's the programmer's responsibility to ensure it. If a :class:`tzinfo` " +"subclass cannot guarantee this, it may be able to override the default " +"implementation of :meth:`tzinfo.fromutc` to work correctly " +"with :meth:`~.datetime.astimezone` regardless." msgstr "" -#: ../../library/datetime.rst:2134 +#: ../../library/datetime.rst:2183 msgid "" "Most implementations of :meth:`dst` will probably look like one of these " "two::" msgstr "" -#: ../../library/datetime.rst:2136 +#: ../../library/datetime.rst:2185 msgid "" "def dst(self, dt):\n" " # a fixed-offset class: doesn't account for DST\n" " return timedelta(0)" msgstr "" -#: ../../library/datetime.rst:2140 +#: ../../library/datetime.rst:2189 msgid "or::" msgstr "或是: ::" -#: ../../library/datetime.rst:2142 +#: ../../library/datetime.rst:2191 msgid "" "def dst(self, dt):\n" " # Code to set dston and dstoff to the time zone's DST\n" @@ -3012,12 +3087,12 @@ msgid "" " return timedelta(0)" msgstr "" -#: ../../library/datetime.rst:2152 +#: ../../library/datetime.rst:2201 msgid "" "The default implementation of :meth:`dst` raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2160 +#: ../../library/datetime.rst:2209 msgid "" "Return the time zone name corresponding to the :class:`.datetime` object " "*dt*, as a string. Nothing about string names is defined by the :mod:`!" @@ -3025,29 +3100,29 @@ msgid "" "particular. For example, ``\"GMT\"``, ``\"UTC\"``, ``\"-500\"``, " "``\"-5:00\"``, ``\"EDT\"``, ``\"US/Eastern\"``, ``\"America/New York\"`` are " "all valid replies. Return ``None`` if a string name isn't known. Note that " -"this is a method rather than a fixed string primarily because some :class:" -"`tzinfo` subclasses will wish to return different names depending on the " -"specific value of *dt* passed, especially if the :class:`tzinfo` class is " -"accounting for daylight time." +"this is a method rather than a fixed string primarily because " +"some :class:`tzinfo` subclasses will wish to return different names " +"depending on the specific value of *dt* passed, especially if " +"the :class:`tzinfo` class is accounting for daylight time." msgstr "" -#: ../../library/datetime.rst:2170 +#: ../../library/datetime.rst:2219 msgid "" -"The default implementation of :meth:`tzname` raises :exc:" -"`NotImplementedError`." +"The default implementation of :meth:`tzname` " +"raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2173 +#: ../../library/datetime.rst:2222 msgid "" "These methods are called by a :class:`.datetime` or :class:`.time` object, " "in response to their methods of the same names. A :class:`.datetime` object " "passes itself as the argument, and a :class:`.time` object passes ``None`` " "as the argument. A :class:`tzinfo` subclass's methods should therefore be " -"prepared to accept a *dt* argument of ``None``, or of class :class:`." -"datetime`." +"prepared to accept a *dt* argument of ``None``, or of " +"class :class:`.datetime`." msgstr "" -#: ../../library/datetime.rst:2179 +#: ../../library/datetime.rst:2228 msgid "" "When ``None`` is passed, it's up to the class designer to decide the best " "response. For example, returning ``None`` is appropriate if the class wishes " @@ -3056,53 +3131,53 @@ msgid "" "offset, as there is no other convention for discovering the standard offset." msgstr "" -#: ../../library/datetime.rst:2185 +#: ../../library/datetime.rst:2234 msgid "" -"When a :class:`.datetime` object is passed in response to a :class:`." -"datetime` method, ``dt.tzinfo`` is the same object as *self*. :class:" -"`tzinfo` methods can rely on this, unless user code calls :class:`tzinfo` " -"methods directly. The intent is that the :class:`tzinfo` methods interpret " -"*dt* as being in local time, and not need worry about objects in other time " -"zones." +"When a :class:`.datetime` object is passed in response to " +"a :class:`.datetime` method, ``dt.tzinfo`` is the same object as " +"*self*. :class:`tzinfo` methods can rely on this, unless user code " +"calls :class:`tzinfo` methods directly. The intent is that " +"the :class:`tzinfo` methods interpret *dt* as being in local time, and not " +"need worry about objects in other time zones." msgstr "" -#: ../../library/datetime.rst:2191 +#: ../../library/datetime.rst:2240 msgid "" "There is one more :class:`tzinfo` method that a subclass may wish to " "override:" msgstr "" -#: ../../library/datetime.rst:2196 +#: ../../library/datetime.rst:2245 msgid "" "This is called from the default :meth:`datetime.astimezone` implementation. " "When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time " -"data are to be viewed as expressing a UTC time. The purpose of :meth:" -"`fromutc` is to adjust the date and time data, returning an equivalent " -"datetime in *self*'s local time." +"data are to be viewed as expressing a UTC time. The purpose " +"of :meth:`fromutc` is to adjust the date and time data, returning an " +"equivalent datetime in *self*'s local time." msgstr "" -#: ../../library/datetime.rst:2202 +#: ../../library/datetime.rst:2251 msgid "" -"Most :class:`tzinfo` subclasses should be able to inherit the default :meth:" -"`fromutc` implementation without problems. It's strong enough to handle " -"fixed-offset time zones, and time zones accounting for both standard and " -"daylight time, and the latter even if the DST transition times differ in " -"different years. An example of a time zone the default :meth:`fromutc` " -"implementation may not handle correctly in all cases is one where the " -"standard offset (from UTC) depends on the specific date and time passed, " -"which can happen for political reasons. The default implementations of :meth:" -"`~.datetime.astimezone` and :meth:`fromutc` may not produce the result you " -"want if the result is one of the hours straddling the moment the standard " -"offset changes." +"Most :class:`tzinfo` subclasses should be able to inherit the " +"default :meth:`fromutc` implementation without problems. It's strong enough " +"to handle fixed-offset time zones, and time zones accounting for both " +"standard and daylight time, and the latter even if the DST transition times " +"differ in different years. An example of a time zone the " +"default :meth:`fromutc` implementation may not handle correctly in all cases " +"is one where the standard offset (from UTC) depends on the specific date and " +"time passed, which can happen for political reasons. The default " +"implementations of :meth:`~.datetime.astimezone` and :meth:`fromutc` may not " +"produce the result you want if the result is one of the hours straddling the " +"moment the standard offset changes." msgstr "" -#: ../../library/datetime.rst:2213 +#: ../../library/datetime.rst:2262 msgid "" "Skipping code for error cases, the default :meth:`fromutc` implementation " "acts like::" msgstr "" -#: ../../library/datetime.rst:2216 +#: ../../library/datetime.rst:2265 msgid "" "def fromutc(self, dt):\n" " # raise ValueError error if dt.tzinfo is not self\n" @@ -3120,13 +3195,13 @@ msgid "" " return dt" msgstr "" -#: ../../library/datetime.rst:2231 +#: ../../library/datetime.rst:2280 msgid "" -"In the following :download:`tzinfo_examples.py <../includes/tzinfo_examples." -"py>` file there are some examples of :class:`tzinfo` classes:" +"In the following :download:`tzinfo_examples.py <../includes/" +"tzinfo_examples.py>` file there are some examples of :class:`tzinfo` classes:" msgstr "" -#: ../../library/datetime.rst:2235 +#: ../../library/datetime.rst:2284 msgid "" "from datetime import tzinfo, timedelta, datetime\n" "\n" @@ -3306,16 +3381,16 @@ msgid "" "Pacific = USTimeZone(-8, \"Pacific\", \"PST\", \"PDT\")\n" msgstr "" -#: ../../library/datetime.rst:2237 +#: ../../library/datetime.rst:2286 msgid "" -"Note that there are unavoidable subtleties twice per year in a :class:" -"`tzinfo` subclass accounting for both standard and daylight time, at the DST " -"transition points. For concreteness, consider US Eastern (UTC -0500), where " -"EDT begins the minute after 1:59 (EST) on the second Sunday in March, and " -"ends the minute after 1:59 (EDT) on the first Sunday in November::" +"Note that there are unavoidable subtleties twice per year in " +"a :class:`tzinfo` subclass accounting for both standard and daylight time, " +"at the DST transition points. For concreteness, consider US Eastern (UTC " +"-0500), where EDT begins the minute after 1:59 (EST) on the second Sunday in " +"March, and ends the minute after 1:59 (EDT) on the first Sunday in November::" msgstr "" -#: ../../library/datetime.rst:2243 +#: ../../library/datetime.rst:2292 msgid "" " UTC 3:MM 4:MM 5:MM 6:MM 7:MM 8:MM\n" " EST 22:MM 23:MM 0:MM 1:MM 2:MM 3:MM\n" @@ -3333,7 +3408,7 @@ msgstr "" "\n" " end 23:MM 0:MM 1:MM 1:MM 2:MM 3:MM" -#: ../../library/datetime.rst:2251 +#: ../../library/datetime.rst:2300 msgid "" "When DST starts (the \"start\" line), the local wall clock leaps from 1:59 " "to 3:00. A wall time of the form 2:MM doesn't really make sense on that day, " @@ -3342,7 +3417,7 @@ msgid "" "get::" msgstr "" -#: ../../library/datetime.rst:2256 +#: ../../library/datetime.rst:2305 msgid "" ">>> from datetime import datetime, timezone\n" ">>> from tzinfo_examples import HOUR, Eastern\n" @@ -3370,7 +3445,7 @@ msgstr "" "07:00:00 UTC = 03:00:00 EDT\n" "08:00:00 UTC = 04:00:00 EDT" -#: ../../library/datetime.rst:2270 +#: ../../library/datetime.rst:2319 msgid "" "When DST ends (the \"end\" line), there's a potentially worse problem: " "there's an hour that can't be spelled unambiguously in local wall time: the " @@ -3385,7 +3460,7 @@ msgid "" "Fall back transition of 2016, we get::" msgstr "" -#: ../../library/datetime.rst:2281 +#: ../../library/datetime.rst:2330 msgid "" ">>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n" ">>> for i in range(4):\n" @@ -3409,44 +3484,44 @@ msgstr "" "06:00:00 UTC = 01:00:00 EST 1\n" "07:00:00 UTC = 02:00:00 EST 0" -#: ../../library/datetime.rst:2292 +#: ../../library/datetime.rst:2341 msgid "" "Note that the :class:`.datetime` instances that differ only by the value of " "the :attr:`~.datetime.fold` attribute are considered equal in comparisons." msgstr "" -#: ../../library/datetime.rst:2295 +#: ../../library/datetime.rst:2344 msgid "" "Applications that can't bear wall-time ambiguities should explicitly check " -"the value of the :attr:`~.datetime.fold` attribute or avoid using hybrid :" -"class:`tzinfo` subclasses; there are no ambiguities when using :class:" -"`timezone`, or any other fixed-offset :class:`tzinfo` subclass (such as a " -"class representing only EST (fixed offset -5 hours), or only EDT (fixed " -"offset -4 hours))." +"the value of the :attr:`~.datetime.fold` attribute or avoid using " +"hybrid :class:`tzinfo` subclasses; there are no ambiguities when " +"using :class:`timezone`, or any other fixed-offset :class:`tzinfo` subclass " +"(such as a class representing only EST (fixed offset -5 hours), or only EDT " +"(fixed offset -4 hours))." msgstr "" -#: ../../library/datetime.rst:2303 +#: ../../library/datetime.rst:2352 msgid ":mod:`zoneinfo`" msgstr ":mod:`zoneinfo`" -#: ../../library/datetime.rst:2304 +#: ../../library/datetime.rst:2353 msgid "" "The :mod:`!datetime` module has a basic :class:`timezone` class (for " "handling arbitrary fixed offsets from UTC) and its :attr:`timezone.utc` " "attribute (a UTC :class:`!timezone` instance)." msgstr "" -#: ../../library/datetime.rst:2308 +#: ../../library/datetime.rst:2357 msgid "" "``zoneinfo`` brings the *IANA time zone database* (also known as the Olson " "database) to Python, and its usage is recommended." msgstr "" -#: ../../library/datetime.rst:2311 +#: ../../library/datetime.rst:2360 msgid "`IANA time zone database `_" msgstr "`IANA 時區資料庫 `_" -#: ../../library/datetime.rst:2312 +#: ../../library/datetime.rst:2361 msgid "" "The Time Zone Database (often called tz, tzdata or zoneinfo) contains code " "and data that represent the history of local time for many representative " @@ -3455,24 +3530,24 @@ msgid "" "saving rules." msgstr "" -#: ../../library/datetime.rst:2322 +#: ../../library/datetime.rst:2371 msgid ":class:`timezone` Objects" msgstr ":class:`timezone` 物件" -#: ../../library/datetime.rst:2324 +#: ../../library/datetime.rst:2373 msgid "" "The :class:`timezone` class is a subclass of :class:`tzinfo`, each instance " "of which represents a time zone defined by a fixed offset from UTC." msgstr "" -#: ../../library/datetime.rst:2328 +#: ../../library/datetime.rst:2377 msgid "" "Objects of this class cannot be used to represent time zone information in " "the locations where different offsets are used in different days of the year " "or where historical changes have been made to civil time." msgstr "" -#: ../../library/datetime.rst:2335 +#: ../../library/datetime.rst:2384 msgid "" "The *offset* argument must be specified as a :class:`timedelta` object " "representing the difference between the local time and UTC. It must be " @@ -3480,25 +3555,25 @@ msgid "" "otherwise :exc:`ValueError` is raised." msgstr "" -#: ../../library/datetime.rst:2340 +#: ../../library/datetime.rst:2389 msgid "" "The *name* argument is optional. If specified it must be a string that will " "be used as the value returned by the :meth:`datetime.tzname` method." msgstr "" -#: ../../library/datetime.rst:2351 ../../library/datetime.rst:2362 +#: ../../library/datetime.rst:2400 ../../library/datetime.rst:2411 msgid "" "Return the fixed value specified when the :class:`timezone` instance is " "constructed." msgstr "" -#: ../../library/datetime.rst:2354 +#: ../../library/datetime.rst:2403 msgid "" "The *dt* argument is ignored. The return value is a :class:`timedelta` " "instance equal to the difference between the local time and UTC." msgstr "" -#: ../../library/datetime.rst:2365 +#: ../../library/datetime.rst:2414 msgid "" "If *name* is not provided in the constructor, the name returned by " "``tzname(dt)`` is generated from the value of the ``offset`` as follows. If " @@ -3507,119 +3582,106 @@ msgid "" "are two digits of ``offset.hours`` and ``offset.minutes`` respectively." msgstr "" -#: ../../library/datetime.rst:2371 +#: ../../library/datetime.rst:2420 msgid "" "Name generated from ``offset=timedelta(0)`` is now plain ``'UTC'``, not " "``'UTC+00:00'``." msgstr "" -#: ../../library/datetime.rst:2378 +#: ../../library/datetime.rst:2427 msgid "Always returns ``None``." msgstr "總是回傳 ``None``。" -#: ../../library/datetime.rst:2382 +#: ../../library/datetime.rst:2431 msgid "" -"Return ``dt + offset``. The *dt* argument must be an aware :class:`." -"datetime` instance, with ``tzinfo`` set to ``self``." +"Return ``dt + offset``. The *dt* argument must be an " +"aware :class:`.datetime` instance, with ``tzinfo`` set to ``self``." msgstr "" -#: ../../library/datetime.rst:2389 +#: ../../library/datetime.rst:2438 msgid "The UTC time zone, ``timezone(timedelta(0))``." msgstr "UTC 時區,``timezone(timedelta(0))``。" -#: ../../library/datetime.rst:2398 +#: ../../library/datetime.rst:2447 msgid ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Behavior" msgstr ":meth:`~.datetime.strftime` 與 :meth:`~.datetime.strptime` 的行為" -#: ../../library/datetime.rst:2400 +#: ../../library/datetime.rst:2449 msgid "" ":class:`date`, :class:`.datetime`, and :class:`.time` objects all support a " "``strftime(format)`` method, to create a string representing the time under " "the control of an explicit format string." msgstr "" -#: ../../library/datetime.rst:2404 +#: ../../library/datetime.rst:2453 msgid "" -"Conversely, the :meth:`datetime.strptime` class method creates a :class:`." -"datetime` object from a string representing a date and time and a " -"corresponding format string." +"Conversely, the :meth:`date.strptime`, :meth:`datetime.strptime` " +"and :meth:`time.strptime` class methods create an object from a string " +"representing the time and a corresponding format string." msgstr "" -#: ../../library/datetime.rst:2408 +#: ../../library/datetime.rst:2457 msgid "" -"The table below provides a high-level comparison of :meth:`~.datetime." -"strftime` versus :meth:`~.datetime.strptime`:" +"The table below provides a high-level comparison " +"of :meth:`~.datetime.strftime` versus :meth:`~.datetime.strptime`:" msgstr "" -#: ../../library/datetime.rst:2412 +#: ../../library/datetime.rst:2461 msgid "``strftime``" msgstr "``strftime``" -#: ../../library/datetime.rst:2412 +#: ../../library/datetime.rst:2461 msgid "``strptime``" msgstr "``strptime``" -#: ../../library/datetime.rst:2414 +#: ../../library/datetime.rst:2463 msgid "Usage" msgstr "用法" -#: ../../library/datetime.rst:2414 +#: ../../library/datetime.rst:2463 msgid "Convert object to a string according to a given format" msgstr "" -#: ../../library/datetime.rst:2414 -msgid "" -"Parse a string into a :class:`.datetime` object given a corresponding format" +#: ../../library/datetime.rst:2463 +msgid "Parse a string into an object given a corresponding format" msgstr "" -#: ../../library/datetime.rst:2416 +#: ../../library/datetime.rst:2465 msgid "Type of method" msgstr "" -#: ../../library/datetime.rst:2416 +#: ../../library/datetime.rst:2465 msgid "Instance method" msgstr "實例方法" -#: ../../library/datetime.rst:2416 +#: ../../library/datetime.rst:2465 msgid "Class method" msgstr "類別方法" -#: ../../library/datetime.rst:2418 -msgid "Method of" -msgstr "" - -#: ../../library/datetime.rst:2418 -msgid ":class:`date`; :class:`.datetime`; :class:`.time`" -msgstr ":class:`date`; :class:`.datetime`; :class:`.time`" - -#: ../../library/datetime.rst:2418 -msgid ":class:`.datetime`" -msgstr ":class:`.datetime`" - -#: ../../library/datetime.rst:2420 +#: ../../library/datetime.rst:2467 msgid "Signature" msgstr "" -#: ../../library/datetime.rst:2420 +#: ../../library/datetime.rst:2467 msgid "``strftime(format)``" msgstr "``strftime(format)``" -#: ../../library/datetime.rst:2420 +#: ../../library/datetime.rst:2467 msgid "``strptime(date_string, format)``" msgstr "``strptime(date_string, format)``" -#: ../../library/datetime.rst:2427 +#: ../../library/datetime.rst:2474 msgid "" ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Format Codes" msgstr ":meth:`~.datetime.strftime` 與 :meth:`~.datetime.strptime` 格式碼" -#: ../../library/datetime.rst:2429 +#: ../../library/datetime.rst:2476 msgid "" "These methods accept format codes that can be used to parse and format " "dates::" msgstr "" -#: ../../library/datetime.rst:2431 +#: ../../library/datetime.rst:2478 msgid "" ">>> datetime.strptime('31/01/22 23:59:59.999999',\n" "... '%d/%m/%y %H:%M:%S.%f')\n" @@ -3633,33 +3695,33 @@ msgstr "" ">>> _.strftime('%a %d %b %Y, %I:%M%p')\n" "'Mon 31 Jan 2022, 11:59PM'" -#: ../../library/datetime.rst:2437 +#: ../../library/datetime.rst:2484 msgid "" "The following is a list of all the format codes that the 1989 C standard " "requires, and these work on all platforms with a standard C implementation." msgstr "" -#: ../../library/datetime.rst:2441 ../../library/datetime.rst:2544 +#: ../../library/datetime.rst:2488 ../../library/datetime.rst:2591 msgid "Directive" msgstr "" -#: ../../library/datetime.rst:2441 ../../library/datetime.rst:2544 +#: ../../library/datetime.rst:2488 ../../library/datetime.rst:2591 msgid "Meaning" msgstr "含義" -#: ../../library/datetime.rst:2441 ../../library/datetime.rst:2544 +#: ../../library/datetime.rst:2488 ../../library/datetime.rst:2591 msgid "Example" msgstr "範例" -#: ../../library/datetime.rst:2441 ../../library/datetime.rst:2544 +#: ../../library/datetime.rst:2488 ../../library/datetime.rst:2591 msgid "Notes" msgstr "註解" -#: ../../library/datetime.rst:2443 +#: ../../library/datetime.rst:2490 msgid "``%a``" msgstr "``%a``" -#: ../../library/datetime.rst:2443 +#: ../../library/datetime.rst:2490 msgid "Weekday as locale's abbreviated name." msgstr "" @@ -3671,11 +3733,11 @@ msgstr "" msgid "So, Mo, ..., Sa (de_DE)" msgstr "" -#: ../../library/datetime.rst:2448 +#: ../../library/datetime.rst:2495 msgid "``%A``" msgstr "``%A``" -#: ../../library/datetime.rst:2448 +#: ../../library/datetime.rst:2495 msgid "Weekday as locale's full name." msgstr "" @@ -3687,42 +3749,42 @@ msgstr "" msgid "Sonntag, Montag, ..., Samstag (de_DE)" msgstr "" -#: ../../library/datetime.rst:2453 +#: ../../library/datetime.rst:2500 msgid "``%w``" msgstr "``%w``" -#: ../../library/datetime.rst:2453 +#: ../../library/datetime.rst:2500 msgid "Weekday as a decimal number, where 0 is Sunday and 6 is Saturday." msgstr "" -#: ../../library/datetime.rst:2453 +#: ../../library/datetime.rst:2500 msgid "0, 1, ..., 6" msgstr "0, 1, ..., 6" -#: ../../library/datetime.rst:2457 +#: ../../library/datetime.rst:2504 msgid "``%d``" msgstr "``%d``" -#: ../../library/datetime.rst:2457 +#: ../../library/datetime.rst:2504 msgid "Day of the month as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2457 +#: ../../library/datetime.rst:2504 msgid "01, 02, ..., 31" msgstr "01, 02, ..., 31" -#: ../../library/datetime.rst:2457 ../../library/datetime.rst:2470 -#: ../../library/datetime.rst:2473 ../../library/datetime.rst:2479 -#: ../../library/datetime.rst:2482 ../../library/datetime.rst:2488 -#: ../../library/datetime.rst:2506 +#: ../../library/datetime.rst:2504 ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2520 ../../library/datetime.rst:2526 +#: ../../library/datetime.rst:2529 ../../library/datetime.rst:2535 +#: ../../library/datetime.rst:2553 msgid "\\(9)" msgstr "\\(9)" -#: ../../library/datetime.rst:2460 +#: ../../library/datetime.rst:2507 msgid "``%b``" msgstr "``%b``" -#: ../../library/datetime.rst:2460 +#: ../../library/datetime.rst:2507 msgid "Month as locale's abbreviated name." msgstr "" @@ -3734,11 +3796,11 @@ msgstr "" msgid "Jan, Feb, ..., Dez (de_DE)" msgstr "" -#: ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2512 msgid "``%B``" msgstr "``%B``" -#: ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2512 msgid "Month as locale's full name." msgstr "" @@ -3750,67 +3812,67 @@ msgstr "" msgid "Januar, Februar, ..., Dezember (de_DE)" msgstr "" -#: ../../library/datetime.rst:2470 +#: ../../library/datetime.rst:2517 msgid "``%m``" msgstr "``%m``" -#: ../../library/datetime.rst:2470 +#: ../../library/datetime.rst:2517 msgid "Month as a zero-padded decimal number." msgstr "以零填充的並以十進位數字表示的月份。" -#: ../../library/datetime.rst:2470 ../../library/datetime.rst:2482 +#: ../../library/datetime.rst:2517 ../../library/datetime.rst:2529 msgid "01, 02, ..., 12" msgstr "01, 02, ..., 12" -#: ../../library/datetime.rst:2473 +#: ../../library/datetime.rst:2520 msgid "``%y``" msgstr "``%y``" -#: ../../library/datetime.rst:2473 +#: ../../library/datetime.rst:2520 msgid "Year without century as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2473 +#: ../../library/datetime.rst:2520 msgid "00, 01, ..., 99" msgstr "00, 01, ..., 99" -#: ../../library/datetime.rst:2476 +#: ../../library/datetime.rst:2523 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/datetime.rst:2476 +#: ../../library/datetime.rst:2523 msgid "Year with century as a decimal number." msgstr "" -#: ../../library/datetime.rst:2476 ../../library/datetime.rst:2546 +#: ../../library/datetime.rst:2523 ../../library/datetime.rst:2593 msgid "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" msgstr "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" -#: ../../library/datetime.rst:2479 +#: ../../library/datetime.rst:2526 msgid "``%H``" msgstr "``%H``" -#: ../../library/datetime.rst:2479 +#: ../../library/datetime.rst:2526 msgid "Hour (24-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2479 +#: ../../library/datetime.rst:2526 msgid "00, 01, ..., 23" msgstr "00, 01, ..., 23" -#: ../../library/datetime.rst:2482 +#: ../../library/datetime.rst:2529 msgid "``%I``" msgstr "``%I``" -#: ../../library/datetime.rst:2482 +#: ../../library/datetime.rst:2529 msgid "Hour (12-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2485 +#: ../../library/datetime.rst:2532 msgid "``%p``" msgstr "``%p``" -#: ../../library/datetime.rst:2485 +#: ../../library/datetime.rst:2532 msgid "Locale's equivalent of either AM or PM." msgstr "" @@ -3822,128 +3884,128 @@ msgstr "AM, PM (en_US);" msgid "am, pm (de_DE)" msgstr "am, pm (de_DE)" -#: ../../library/datetime.rst:2485 +#: ../../library/datetime.rst:2532 msgid "\\(1), \\(3)" msgstr "\\(1), \\(3)" -#: ../../library/datetime.rst:2488 +#: ../../library/datetime.rst:2535 msgid "``%M``" msgstr "``%M``" -#: ../../library/datetime.rst:2488 +#: ../../library/datetime.rst:2535 msgid "Minute as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2488 ../../library/datetime.rst:2491 +#: ../../library/datetime.rst:2535 ../../library/datetime.rst:2538 msgid "00, 01, ..., 59" msgstr "00, 01, ..., 59" -#: ../../library/datetime.rst:2491 +#: ../../library/datetime.rst:2538 msgid "``%S``" msgstr "``%S``" -#: ../../library/datetime.rst:2491 +#: ../../library/datetime.rst:2538 msgid "Second as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2491 +#: ../../library/datetime.rst:2538 msgid "\\(4), \\(9)" msgstr "\\(4), \\(9)" -#: ../../library/datetime.rst:2494 +#: ../../library/datetime.rst:2541 msgid "``%f``" msgstr "``%f``" -#: ../../library/datetime.rst:2494 +#: ../../library/datetime.rst:2541 msgid "Microsecond as a decimal number, zero-padded to 6 digits." msgstr "" -#: ../../library/datetime.rst:2494 +#: ../../library/datetime.rst:2541 msgid "000000, 000001, ..., 999999" msgstr "000000, 000001, ..., 999999" -#: ../../library/datetime.rst:2494 +#: ../../library/datetime.rst:2541 msgid "\\(5)" msgstr "\\(5)" -#: ../../library/datetime.rst:2498 ../../library/datetime.rst:2657 +#: ../../library/datetime.rst:2545 ../../library/datetime.rst:2704 msgid "``%z``" msgstr "``%z``" -#: ../../library/datetime.rst:2498 +#: ../../library/datetime.rst:2545 msgid "" "UTC offset in the form ``±HHMM[SS[.ffffff]]`` (empty string if the object is " "naive)." msgstr "" -#: ../../library/datetime.rst:2498 +#: ../../library/datetime.rst:2545 msgid "(empty), +0000, -0400, +1030, +063415, -030712.345216" msgstr "" -#: ../../library/datetime.rst:2498 ../../library/datetime.rst:2503 -#: ../../library/datetime.rst:2560 +#: ../../library/datetime.rst:2545 ../../library/datetime.rst:2550 +#: ../../library/datetime.rst:2607 msgid "\\(6)" msgstr "\\(6)" -#: ../../library/datetime.rst:2503 ../../library/datetime.rst:2683 +#: ../../library/datetime.rst:2550 ../../library/datetime.rst:2730 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/datetime.rst:2503 +#: ../../library/datetime.rst:2550 msgid "Time zone name (empty string if the object is naive)." msgstr "" -#: ../../library/datetime.rst:2503 +#: ../../library/datetime.rst:2550 msgid "(empty), UTC, GMT" msgstr "" -#: ../../library/datetime.rst:2506 +#: ../../library/datetime.rst:2553 msgid "``%j``" msgstr "``%j``" -#: ../../library/datetime.rst:2506 +#: ../../library/datetime.rst:2553 msgid "Day of the year as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2506 +#: ../../library/datetime.rst:2553 msgid "001, 002, ..., 366" msgstr "001, 002, ..., 366" -#: ../../library/datetime.rst:2509 +#: ../../library/datetime.rst:2556 msgid "``%U``" msgstr "``%U``" -#: ../../library/datetime.rst:2509 +#: ../../library/datetime.rst:2556 msgid "" "Week number of the year (Sunday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Sunday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2509 ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2556 ../../library/datetime.rst:2564 msgid "00, 01, ..., 53" msgstr "00, 01, ..., 53" -#: ../../library/datetime.rst:2509 ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2556 ../../library/datetime.rst:2564 msgid "\\(7), \\(9)" msgstr "\\(7), \\(9)" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2564 msgid "``%W``" msgstr "``%W``" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2564 msgid "" "Week number of the year (Monday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Monday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2525 +#: ../../library/datetime.rst:2572 msgid "``%c``" msgstr "``%c``" -#: ../../library/datetime.rst:2525 +#: ../../library/datetime.rst:2572 msgid "Locale's appropriate date and time representation." msgstr "" @@ -3955,11 +4017,11 @@ msgstr "" msgid "Di 16 Aug 21:30:00 1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2530 +#: ../../library/datetime.rst:2577 msgid "``%x``" msgstr "``%x``" -#: ../../library/datetime.rst:2530 +#: ../../library/datetime.rst:2577 msgid "Locale's appropriate date representation." msgstr "" @@ -3975,11 +4037,11 @@ msgstr "" msgid "16.08.1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2534 +#: ../../library/datetime.rst:2581 msgid "``%X``" msgstr "``%X``" -#: ../../library/datetime.rst:2534 +#: ../../library/datetime.rst:2581 msgid "Locale's appropriate time representation." msgstr "" @@ -3991,92 +4053,92 @@ msgstr "" msgid "21:30:00 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2537 +#: ../../library/datetime.rst:2584 msgid "``%%``" msgstr "``%%``" -#: ../../library/datetime.rst:2537 +#: ../../library/datetime.rst:2584 msgid "A literal ``'%'`` character." msgstr "" -#: ../../library/datetime.rst:2537 +#: ../../library/datetime.rst:2584 msgid "%" msgstr "%" -#: ../../library/datetime.rst:2540 +#: ../../library/datetime.rst:2587 msgid "" "Several additional directives not required by the C89 standard are included " "for convenience. These parameters all correspond to ISO 8601 date values." msgstr "" -#: ../../library/datetime.rst:2546 +#: ../../library/datetime.rst:2593 msgid "``%G``" msgstr "``%G``" -#: ../../library/datetime.rst:2546 +#: ../../library/datetime.rst:2593 msgid "" "ISO 8601 year with century representing the year that contains the greater " "part of the ISO week (``%V``)." msgstr "" -#: ../../library/datetime.rst:2546 +#: ../../library/datetime.rst:2593 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/datetime.rst:2551 +#: ../../library/datetime.rst:2598 msgid "``%u``" msgstr "``%u``" -#: ../../library/datetime.rst:2551 +#: ../../library/datetime.rst:2598 msgid "ISO 8601 weekday as a decimal number where 1 is Monday." msgstr "" -#: ../../library/datetime.rst:2551 +#: ../../library/datetime.rst:2598 msgid "1, 2, ..., 7" msgstr "1, 2, ..., 7" -#: ../../library/datetime.rst:2554 +#: ../../library/datetime.rst:2601 msgid "``%V``" msgstr "``%V``" -#: ../../library/datetime.rst:2554 +#: ../../library/datetime.rst:2601 msgid "" "ISO 8601 week as a decimal number with Monday as the first day of the week. " "Week 01 is the week containing Jan 4." msgstr "" -#: ../../library/datetime.rst:2554 +#: ../../library/datetime.rst:2601 msgid "01, 02, ..., 53" msgstr "01, 02, ..., 53" -#: ../../library/datetime.rst:2554 +#: ../../library/datetime.rst:2601 msgid "\\(8), \\(9)" msgstr "\\(8), \\(9)" -#: ../../library/datetime.rst:2560 ../../library/datetime.rst:2679 +#: ../../library/datetime.rst:2607 ../../library/datetime.rst:2726 msgid "``%:z``" msgstr "``%:z``" -#: ../../library/datetime.rst:2560 +#: ../../library/datetime.rst:2607 msgid "" "UTC offset in the form ``±HH:MM[:SS[.ffffff]]`` (empty string if the object " "is naive)." msgstr "" -#: ../../library/datetime.rst:2560 +#: ../../library/datetime.rst:2607 msgid "(empty), +00:00, -04:00, +10:30, +06:34:15, -03:07:12.345216" msgstr "" -#: ../../library/datetime.rst:2566 +#: ../../library/datetime.rst:2613 msgid "" -"These may not be available on all platforms when used with the :meth:`~." -"datetime.strftime` method. The ISO 8601 year and ISO 8601 week directives " -"are not interchangeable with the year and week number directives above. " -"Calling :meth:`~.datetime.strptime` with incomplete or ambiguous ISO 8601 " -"directives will raise a :exc:`ValueError`." +"These may not be available on all platforms when used with " +"the :meth:`~.datetime.strftime` method. The ISO 8601 year and ISO 8601 week " +"directives are not interchangeable with the year and week number directives " +"above. Calling :meth:`~.datetime.strptime` with incomplete or ambiguous ISO " +"8601 directives will raise a :exc:`ValueError`." msgstr "" -#: ../../library/datetime.rst:2571 +#: ../../library/datetime.rst:2618 msgid "" "The full set of format codes supported varies across platforms, because " "Python calls the platform C library's :c:func:`strftime` function, and " @@ -4086,44 +4148,44 @@ msgid "" "unsupported format specifiers." msgstr "" -#: ../../library/datetime.rst:2577 +#: ../../library/datetime.rst:2624 msgid "``%G``, ``%u`` and ``%V`` were added." msgstr "新增 ``%G``、``%u`` 與 ``%V``。" -#: ../../library/datetime.rst:2580 +#: ../../library/datetime.rst:2627 msgid "``%:z`` was added." msgstr "新增 ``%:z``。" -#: ../../library/datetime.rst:2584 +#: ../../library/datetime.rst:2631 msgid "Technical Detail" msgstr "技術細節" -#: ../../library/datetime.rst:2586 +#: ../../library/datetime.rst:2633 msgid "" "Broadly speaking, ``d.strftime(fmt)`` acts like the :mod:`time` module's " -"``time.strftime(fmt, d.timetuple())`` although not all objects support a :" -"meth:`~date.timetuple` method." +"``time.strftime(fmt, d.timetuple())`` although not all objects support " +"a :meth:`~date.timetuple` method." msgstr "" -#: ../../library/datetime.rst:2590 +#: ../../library/datetime.rst:2637 msgid "" "For the :meth:`.datetime.strptime` class method, the default value is " "``1900-01-01T00:00:00.000``: any components not specified in the format " "string will be pulled from the default value. [#]_" msgstr "" -#: ../../library/datetime.rst:2594 +#: ../../library/datetime.rst:2641 msgid "Using ``datetime.strptime(date_string, format)`` is equivalent to::" msgstr "" -#: ../../library/datetime.rst:2598 +#: ../../library/datetime.rst:2645 msgid "" "except when the format includes sub-second components or time zone offset " "information, which are supported in ``datetime.strptime`` but are discarded " "by ``time.strptime``." msgstr "" -#: ../../library/datetime.rst:2602 +#: ../../library/datetime.rst:2649 msgid "" "For :class:`.time` objects, the format codes for year, month, and day should " "not be used, as :class:`!time` objects have no such values. If they're used " @@ -4133,25 +4195,25 @@ msgstr "" "time` 物件並沒有這些值。如果使用這些格式碼,年份會以 1900 代替、月及日會以 1 " "代替。" -#: ../../library/datetime.rst:2606 +#: ../../library/datetime.rst:2653 msgid "" "For :class:`date` objects, the format codes for hours, minutes, seconds, and " "microseconds should not be used, as :class:`date` objects have no such " "values. If they're used anyway, 0 is substituted for them." msgstr "" -"對 :class:`.date` 物件來說,不應該使用時、分、秒、微秒的格式碼,因為 :class:" -"`date` 物件並沒有這些值。如果使用這些格式碼,這些值都會以 0 代替。" +"對 :class:`.date` 物件來說,不應該使用時、分、秒、微秒的格式碼,因" +"為 :class:`date` 物件並沒有這些值。如果使用這些格式碼,這些值都會以 0 代替。" -#: ../../library/datetime.rst:2610 +#: ../../library/datetime.rst:2657 msgid "" "For the same reason, handling of format strings containing Unicode code " "points that can't be represented in the charset of the current locale is " "also platform-dependent. On some platforms such code points are preserved " -"intact in the output, while on others ``strftime`` may raise :exc:" -"`UnicodeError` or return an empty string instead." +"intact in the output, while on others ``strftime`` may " +"raise :exc:`UnicodeError` or return an empty string instead." msgstr "" -#: ../../library/datetime.rst:2619 +#: ../../library/datetime.rst:2666 msgid "" "Because the format depends on the current locale, care should be taken when " "making assumptions about the output value. Field orderings will vary (for " @@ -4159,38 +4221,38 @@ msgid "" "contain non-ASCII characters." msgstr "" -#: ../../library/datetime.rst:2625 +#: ../../library/datetime.rst:2672 msgid "" "The :meth:`~.datetime.strptime` method can parse years in the full [1, 9999] " "range, but years < 1000 must be zero-filled to 4-digit width." msgstr "" -#: ../../library/datetime.rst:2628 +#: ../../library/datetime.rst:2675 msgid "" "In previous versions, :meth:`~.datetime.strftime` method was restricted to " "years >= 1900." msgstr "" -#: ../../library/datetime.rst:2632 +#: ../../library/datetime.rst:2679 msgid "" "In version 3.2, :meth:`~.datetime.strftime` method was restricted to years " ">= 1000." msgstr "" -#: ../../library/datetime.rst:2637 +#: ../../library/datetime.rst:2684 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%p`` directive " "only affects the output hour field if the ``%I`` directive is used to parse " "the hour." msgstr "" -#: ../../library/datetime.rst:2641 +#: ../../library/datetime.rst:2688 msgid "" "Unlike the :mod:`time` module, the :mod:`!datetime` module does not support " "leap seconds." msgstr "" -#: ../../library/datetime.rst:2645 +#: ../../library/datetime.rst:2692 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%f`` directive " "accepts from one to six digits and zero pads on the right. ``%f`` is an " @@ -4198,17 +4260,17 @@ msgid "" "separately in datetime objects, and therefore always available)." msgstr "" -#: ../../library/datetime.rst:2652 +#: ../../library/datetime.rst:2699 msgid "" "For a naive object, the ``%z``, ``%:z`` and ``%Z`` format codes are replaced " "by empty strings." msgstr "" -#: ../../library/datetime.rst:2655 +#: ../../library/datetime.rst:2702 msgid "For an aware object:" msgstr "" -#: ../../library/datetime.rst:2658 +#: ../../library/datetime.rst:2705 msgid "" ":meth:`~.datetime.utcoffset` is transformed into a string of the form " "``±HHMM[SS[.ffffff]]``, where ``HH`` is a 2-digit string giving the number " @@ -4217,12 +4279,12 @@ msgid "" "seconds and ``ffffff`` is a 6-digit string giving the number of UTC offset " "microseconds. The ``ffffff`` part is omitted when the offset is a whole " "number of seconds and both the ``ffffff`` and the ``SS`` part is omitted " -"when the offset is a whole number of minutes. For example, if :meth:`~." -"datetime.utcoffset` returns ``timedelta(hours=-3, minutes=-30)``, ``%z`` is " -"replaced with the string ``'-0330'``." +"when the offset is a whole number of minutes. For example, " +"if :meth:`~.datetime.utcoffset` returns ``timedelta(hours=-3, " +"minutes=-30)``, ``%z`` is replaced with the string ``'-0330'``." msgstr "" -#: ../../library/datetime.rst:2672 +#: ../../library/datetime.rst:2719 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, the UTC offsets can have a colon as a separator between hours, " @@ -4231,61 +4293,61 @@ msgid "" "``'+00:00'``." msgstr "" -#: ../../library/datetime.rst:2680 +#: ../../library/datetime.rst:2727 msgid "" "Behaves exactly as ``%z``, but has a colon separator added between hours, " "minutes and seconds." msgstr "" -#: ../../library/datetime.rst:2684 +#: ../../library/datetime.rst:2731 msgid "" -"In :meth:`~.datetime.strftime`, ``%Z`` is replaced by an empty string if :" -"meth:`~.datetime.tzname` returns ``None``; otherwise ``%Z`` is replaced by " -"the returned value, which must be a string." +"In :meth:`~.datetime.strftime`, ``%Z`` is replaced by an empty string " +"if :meth:`~.datetime.tzname` returns ``None``; otherwise ``%Z`` is replaced " +"by the returned value, which must be a string." msgstr "" -#: ../../library/datetime.rst:2688 +#: ../../library/datetime.rst:2735 msgid ":meth:`~.datetime.strptime` only accepts certain values for ``%Z``:" msgstr "" -#: ../../library/datetime.rst:2690 +#: ../../library/datetime.rst:2737 msgid "any value in ``time.tzname`` for your machine's locale" msgstr "" -#: ../../library/datetime.rst:2691 +#: ../../library/datetime.rst:2738 msgid "the hard-coded values ``UTC`` and ``GMT``" msgstr "" -#: ../../library/datetime.rst:2693 +#: ../../library/datetime.rst:2740 msgid "" "So someone living in Japan may have ``JST``, ``UTC``, and ``GMT`` as valid " "values, but probably not ``EST``. It will raise ``ValueError`` for invalid " "values." msgstr "" -#: ../../library/datetime.rst:2697 +#: ../../library/datetime.rst:2744 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, an aware :class:`.datetime` object will be produced. The ``tzinfo`` " "of the result will be set to a :class:`timezone` instance." msgstr "" -#: ../../library/datetime.rst:2703 +#: ../../library/datetime.rst:2750 msgid "" "When used with the :meth:`~.datetime.strptime` method, ``%U`` and ``%W`` are " "only used in calculations when the day of the week and the calendar year " "(``%Y``) are specified." msgstr "" -#: ../../library/datetime.rst:2708 +#: ../../library/datetime.rst:2755 msgid "" "Similar to ``%U`` and ``%W``, ``%V`` is only used in calculations when the " -"day of the week and the ISO year (``%G``) are specified in a :meth:`~." -"datetime.strptime` format string. Also note that ``%G`` and ``%Y`` are not " -"interchangeable." +"day of the week and the ISO year (``%G``) are specified in " +"a :meth:`~.datetime.strptime` format string. Also note that ``%G`` and " +"``%Y`` are not interchangeable." msgstr "" -#: ../../library/datetime.rst:2714 +#: ../../library/datetime.rst:2761 msgid "" "When used with the :meth:`~.datetime.strptime` method, the leading zero is " "optional for formats ``%d``, ``%m``, ``%H``, ``%I``, ``%M``, ``%S``, " @@ -4293,7 +4355,7 @@ msgid "" "zero." msgstr "" -#: ../../library/datetime.rst:2719 +#: ../../library/datetime.rst:2766 msgid "" "When parsing a month and day using :meth:`~.datetime.strptime`, always " "include a year in the format. If the value you need to parse lacks a year, " @@ -4302,7 +4364,7 @@ msgid "" "parser is not a leap year. Users run into this bug every four years..." msgstr "" -#: ../../library/datetime.rst:2725 +#: ../../library/datetime.rst:2772 msgid "" ">>> month_day = \"02/29\"\n" ">>> datetime.strptime(f\"{month_day};1984\", \"%m/%d;%Y\") # No leap year " @@ -4310,7 +4372,7 @@ msgid "" "datetime.datetime(1984, 2, 29, 0, 0)" msgstr "" -#: ../../library/datetime.rst:2731 +#: ../../library/datetime.rst:2778 msgid "" ":meth:`~.datetime.strptime` calls using a format string containing a day of " "month without a year now emit a :exc:`DeprecationWarning`. In 3.15 or later " @@ -4318,15 +4380,15 @@ msgid "" "See :gh:`70647`." msgstr "" -#: ../../library/datetime.rst:2738 +#: ../../library/datetime.rst:2785 msgid "Footnotes" msgstr "註解" -#: ../../library/datetime.rst:2739 +#: ../../library/datetime.rst:2786 msgid "If, that is, we ignore the effects of Relativity" msgstr "也就是說,我們會忽略相對論的效應" -#: ../../library/datetime.rst:2741 +#: ../../library/datetime.rst:2788 msgid "" "This matches the definition of the \"proleptic Gregorian\" calendar in " "Dershowitz and Reingold's book *Calendrical Calculations*, where it's the " @@ -4335,23 +4397,29 @@ msgid "" "systems." msgstr "" -#: ../../library/datetime.rst:2747 +#: ../../library/datetime.rst:2794 msgid "" "See R. H. van Gent's `guide to the mathematics of the ISO 8601 calendar " "`_ for a good explanation." msgstr "" -#: ../../library/datetime.rst:2751 +#: ../../library/datetime.rst:2798 msgid "" "Passing ``datetime.strptime('Feb 29', '%b %d')`` will fail since 1900 is not " "a leap year." msgstr "" -#: ../../library/datetime.rst:2392 +#: ../../library/datetime.rst:2441 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/datetime.rst:2392 +#: ../../library/datetime.rst:2441 msgid "datetime format" msgstr "datetime format(日期時間格式)" + +#~ msgid ":class:`date`; :class:`.datetime`; :class:`.time`" +#~ msgstr ":class:`date`; :class:`.datetime`; :class:`.time`" + +#~ msgid ":class:`.datetime`" +#~ msgstr ":class:`.datetime`" diff --git a/library/dbm.po b/library/dbm.po index efc712a72b3..d3ec55e4406 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-20 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -59,8 +59,8 @@ msgstr "" #: ../../library/dbm.rst:31 msgid "" "This function attempts to guess which of the several simple database modules " -"available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`, or :mod:" -"`dbm.dumb` --- should be used to open a given file." +"available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`, " +"or :mod:`dbm.dumb` --- should be used to open a given file." msgstr "" #: ../../library/dbm.rst:35 @@ -82,7 +82,7 @@ msgid "" "``'dbm.gnu'``" msgstr "" -#: ../../library/dbm.rst:41 ../../library/dbm.rst:270 ../../library/dbm.rst:471 +#: ../../library/dbm.rst:41 ../../library/dbm.rst:250 ../../library/dbm.rst:448 msgid "*filename* accepts a :term:`path-like object`." msgstr "" @@ -96,13 +96,13 @@ msgstr "參數" #: ../../library/dbm.rst:67 msgid "" -"The database file to open. If the database file already exists, the :func:" -"`whichdb` function is used to determine its type and the appropriate module " -"is used; if it does not exist, the first submodule listed above that can be " -"imported is used." +"The database file to open. If the database file already exists, " +"the :func:`whichdb` function is used to determine its type and the " +"appropriate module is used; if it does not exist, the first submodule listed " +"above that can be imported is used." msgstr "" -#: ../../library/dbm.rst:68 ../../library/dbm.rst:242 +#: ../../library/dbm.rst:68 ../../library/dbm.rst:222 msgid "The database file to open." msgstr "要打開的資料庫檔案" @@ -113,7 +113,7 @@ msgid "" "the first submodule listed above that can be imported is used." msgstr "" -#: ../../library/dbm.rst:75 ../../library/dbm.rst:182 ../../library/dbm.rst:374 +#: ../../library/dbm.rst:75 ../../library/dbm.rst:178 ../../library/dbm.rst:353 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" @@ -121,28 +121,28 @@ msgstr "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" -#: ../../library/dbm.rst:76 ../../library/dbm.rst:184 ../../library/dbm.rst:247 -#: ../../library/dbm.rst:375 +#: ../../library/dbm.rst:76 ../../library/dbm.rst:180 ../../library/dbm.rst:227 +#: ../../library/dbm.rst:354 msgid "``'r'`` (default): |flag_r|" msgstr "``'r'`` (default): |flag_r|" -#: ../../library/dbm.rst:77 ../../library/dbm.rst:185 ../../library/dbm.rst:248 -#: ../../library/dbm.rst:376 ../../library/dbm.rst:452 +#: ../../library/dbm.rst:77 ../../library/dbm.rst:181 ../../library/dbm.rst:228 +#: ../../library/dbm.rst:355 ../../library/dbm.rst:429 msgid "``'w'``: |flag_w|" msgstr "``'w'``: |flag_w|" -#: ../../library/dbm.rst:78 ../../library/dbm.rst:186 ../../library/dbm.rst:249 -#: ../../library/dbm.rst:377 +#: ../../library/dbm.rst:78 ../../library/dbm.rst:182 ../../library/dbm.rst:229 +#: ../../library/dbm.rst:356 msgid "``'c'``: |flag_c|" msgstr "``'c'``: |flag_c|" -#: ../../library/dbm.rst:79 ../../library/dbm.rst:187 ../../library/dbm.rst:250 -#: ../../library/dbm.rst:378 ../../library/dbm.rst:454 +#: ../../library/dbm.rst:79 ../../library/dbm.rst:183 ../../library/dbm.rst:230 +#: ../../library/dbm.rst:357 ../../library/dbm.rst:431 msgid "``'n'``: |flag_n|" msgstr "``'n'``: |flag_n|" -#: ../../library/dbm.rst:81 ../../library/dbm.rst:264 ../../library/dbm.rst:380 -#: ../../library/dbm.rst:456 +#: ../../library/dbm.rst:81 ../../library/dbm.rst:244 ../../library/dbm.rst:359 +#: ../../library/dbm.rst:433 msgid "|mode_param_doc|" msgstr "|mode_param_doc|" @@ -152,56 +152,51 @@ msgstr "*file* 接受一個\\ :term:`類路徑物件 `。" #: ../../library/dbm.rst:87 msgid "" -"The object returned by :func:`~dbm.open` supports the basic functionality of " -"mutable :term:`mappings `; keys and their corresponding values can " -"be stored, retrieved, and deleted, and iteration, the :keyword:`in` operator " -"and methods :meth:`!keys`, :meth:`!get`, :meth:`!setdefault` and :meth:`!" -"clear` are available. The :meth:`!keys` method returns a list instead of a " -"view object. The :meth:`!setdefault` method requires two arguments." +"The object returned by :func:`~dbm.open` supports the same basic " +"functionality as a :class:`dict`; keys and their corresponding values can be " +"stored, retrieved, and deleted, and the :keyword:`in` operator and " +"the :meth:`!keys` method are available, as well as :meth:`!get` and :meth:`!" +"setdefault` methods." msgstr "" -#: ../../library/dbm.rst:95 +#: ../../library/dbm.rst:92 msgid "" "Key and values are always stored as :class:`bytes`. This means that when " "strings are used they are implicitly converted to the default encoding " "before being stored." msgstr "" -#: ../../library/dbm.rst:99 +#: ../../library/dbm.rst:96 msgid "" "These objects also support being used in a :keyword:`with` statement, which " "will automatically close them when done." msgstr "" -#: ../../library/dbm.rst:102 +#: ../../library/dbm.rst:99 msgid "" -":meth:`!get` and :meth:`!setdefault` methods are now available for all :mod:" -"`dbm` backends." +":meth:`!get` and :meth:`!setdefault` methods are now available for " +"all :mod:`dbm` backends." msgstr "" -#: ../../library/dbm.rst:106 +#: ../../library/dbm.rst:103 msgid "" "Added native support for the context management protocol to the objects " "returned by :func:`~dbm.open`." msgstr "" -#: ../../library/dbm.rst:110 +#: ../../library/dbm.rst:107 msgid "" "Deleting a key from a read-only database raises a database module specific " "exception instead of :exc:`KeyError`." msgstr "" -#: ../../library/dbm.rst:114 -msgid ":meth:`!clear` methods are now available for all :mod:`dbm` backends." -msgstr ":meth:`!clear` 方法現在可用於所有 :mod:`dbm` 後端。" - -#: ../../library/dbm.rst:118 +#: ../../library/dbm.rst:111 msgid "" "The following example records some hostnames and a corresponding title, and " "then prints out the contents of the database::" msgstr "" -#: ../../library/dbm.rst:121 +#: ../../library/dbm.rst:114 msgid "" "import dbm\n" "\n" @@ -228,32 +223,32 @@ msgid "" "# db is automatically closed when leaving the with statement." msgstr "" -#: ../../library/dbm.rst:148 +#: ../../library/dbm.rst:141 msgid "Module :mod:`shelve`" msgstr ":mod:`shelve` 模組" -#: ../../library/dbm.rst:149 +#: ../../library/dbm.rst:142 msgid "Persistence module which stores non-string data." msgstr "" -#: ../../library/dbm.rst:152 +#: ../../library/dbm.rst:145 msgid "The individual submodules are described in the following sections." msgstr "" -#: ../../library/dbm.rst:155 +#: ../../library/dbm.rst:148 msgid ":mod:`dbm.sqlite3` --- SQLite backend for dbm" msgstr ":mod:`dbm.sqlite3` --- dbm 的 SQLite 後端" -#: ../../library/dbm.rst:163 +#: ../../library/dbm.rst:156 msgid "**Source code:** :source:`Lib/dbm/sqlite3.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/sqlite3.py`" -#: ../../library/dbm.rst:167 +#: ../../library/dbm.rst:160 msgid "" "This module uses the standard library :mod:`sqlite3` module to provide an " -"SQLite backend for the :mod:`dbm` module. The files created by :mod:`dbm." -"sqlite3` can thus be opened by :mod:`sqlite3`, or any other SQLite browser, " -"including the SQLite CLI." +"SQLite backend for the :mod:`dbm` module. The files created " +"by :mod:`dbm.sqlite3` can thus be opened by :mod:`sqlite3`, or any other " +"SQLite browser, including the SQLite CLI." msgstr "" #: ../../includes/wasm-mobile-notavail.rst:3 ../../includes/wasm-notavail.rst:3 @@ -268,52 +263,39 @@ msgstr "" "此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" "availability`。" -#: ../../library/dbm.rst:176 -msgid "Open an SQLite database." -msgstr "打開一個 SQLite 資料庫。" +#: ../../library/dbm.rst:169 +msgid "" +"Open an SQLite database. The returned object behaves like a :term:`mapping`, " +"implements a :meth:`!close` method, and supports a \"closing\" context " +"manager via the :keyword:`with` keyword." +msgstr "" -#: ../../library/dbm.rst:178 +#: ../../library/dbm.rst:174 msgid "The path to the database to be opened." msgstr "要打開的資料庫路徑" -#: ../../library/dbm.rst:189 +#: ../../library/dbm.rst:185 msgid "" "The Unix file access mode of the file (default: octal ``0o666``), used only " "when the database has to be created." msgstr "" -#: ../../library/dbm.rst:193 -msgid "" -"The returned database object behaves similar to a mutable :term:`mapping`, " -"but the :meth:`!keys` method returns a list, and the :meth:`!setdefault` " -"method requires two arguments. It also supports a \"closing\" context " -"manager via the :keyword:`with` keyword." -msgstr "" - -#: ../../library/dbm.rst:198 ../../library/dbm.rst:399 -msgid "The following method is also provided:" -msgstr "也提供了以下方法:" - -#: ../../library/dbm.rst:202 -msgid "Close the SQLite database." -msgstr "關閉 SQLite 資料庫。" - -#: ../../library/dbm.rst:206 +#: ../../library/dbm.rst:191 msgid ":mod:`dbm.gnu` --- GNU database manager" msgstr ":mod:`dbm.gnu` --- GNU 資料庫管理器" -#: ../../library/dbm.rst:212 +#: ../../library/dbm.rst:197 msgid "**Source code:** :source:`Lib/dbm/gnu.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/gnu.py`" -#: ../../library/dbm.rst:216 +#: ../../library/dbm.rst:201 msgid "" "The :mod:`dbm.gnu` module provides an interface to the :abbr:`GDBM (GNU " "dbm)` library, similar to the :mod:`dbm.ndbm` module, but with additional " "functionality like crash tolerance." msgstr "" -#: ../../library/dbm.rst:222 ../../library/dbm.rst:342 +#: ../../library/dbm.rst:207 ../../library/dbm.rst:321 msgid "" "The file formats created by :mod:`dbm.gnu` and :mod:`dbm.ndbm` are " "incompatible and can not be used interchangeably." @@ -327,24 +309,18 @@ msgstr "" "此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" "台 `\\ 上不支援。" -#: ../../library/dbm.rst:229 +#: ../../library/dbm.rst:214 msgid "" -"Raised on :mod:`dbm.gnu`-specific errors, such as I/O errors. :exc:" -"`KeyError` is raised for general mapping errors like specifying an incorrect " -"key." +"Raised on :mod:`dbm.gnu`-specific errors, such as I/O " +"errors. :exc:`KeyError` is raised for general mapping errors like specifying " +"an incorrect key." msgstr "" -#: ../../library/dbm.rst:235 -msgid "" -"A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` " -"supports." -msgstr "" - -#: ../../library/dbm.rst:240 +#: ../../library/dbm.rst:220 msgid "Open a GDBM database and return a :class:`!gdbm` object." msgstr "打開一個 GDBM 資料庫,並回傳一個 :class:`!gdbm` 物件。" -#: ../../library/dbm.rst:246 +#: ../../library/dbm.rst:226 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n| The following additional characters may be appended to " @@ -356,29 +332,29 @@ msgid "" "flag characters." msgstr "" -#: ../../library/dbm.rst:252 +#: ../../library/dbm.rst:232 msgid "" "The following additional characters may be appended to control how the " "database is opened:" msgstr "" -#: ../../library/dbm.rst:255 +#: ../../library/dbm.rst:235 msgid "" "``'f'``: Open the database in fast mode. Writes to the database will not be " "synchronized." msgstr "" -#: ../../library/dbm.rst:257 +#: ../../library/dbm.rst:237 msgid "" "``'s'``: Synchronized mode. Changes to the database will be written " "immediately to the file." msgstr "" -#: ../../library/dbm.rst:259 +#: ../../library/dbm.rst:239 msgid "``'u'``: Do not lock database." msgstr "``'u'``: 不要鎖住資料庫。" -#: ../../library/dbm.rst:261 +#: ../../library/dbm.rst:241 msgid "" "Not all flags are valid for all versions of GDBM. See the :data:`open_flags` " "member for a list of supported flag characters." @@ -388,36 +364,24 @@ msgstr "" msgid "Raises" msgstr "引發" -#: ../../library/dbm.rst:267 +#: ../../library/dbm.rst:247 msgid "If an invalid *flag* argument is passed." msgstr "如果一個無效的 *flag* 引數被傳入。" -#: ../../library/dbm.rst:273 +#: ../../library/dbm.rst:255 msgid "" -":class:`!gdbm` objects behave similar to mutable :term:`mappings `, " -"but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`, " -"and :meth:`!update` are not supported, the :meth:`!keys` method returns a " -"list, and the :meth:`!setdefault` method requires two arguments. It also " -"supports a \"closing\" context manager via the :keyword:`with` keyword." -msgstr "" - -#: ../../library/dbm.rst:280 ../../library/dbm.rst:393 -msgid "Added the :meth:`!get` and :meth:`!setdefault` methods." -msgstr "" - -#: ../../library/dbm.rst:283 ../../library/dbm.rst:396 -msgid "Added the :meth:`!clear` method." +"A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` " +"supports." msgstr "" -#: ../../library/dbm.rst:286 ../../library/dbm.rst:479 -msgid "The following methods are also provided:" +#: ../../library/dbm.rst:257 +msgid "" +":class:`!gdbm` objects behave similar to :term:`mappings `, " +"but :meth:`!items` and :meth:`!values` methods are not supported. The " +"following methods are also provided:" msgstr "" -#: ../../library/dbm.rst:290 -msgid "Close the GDBM database." -msgstr "關閉 GDBM 資料庫。" - -#: ../../library/dbm.rst:294 +#: ../../library/dbm.rst:263 msgid "" "It's possible to loop over every key in the database using this method and " "the :meth:`nextkey` method. The traversal is ordered by GDBM's internal " @@ -425,14 +389,14 @@ msgid "" "starting key." msgstr "" -#: ../../library/dbm.rst:301 +#: ../../library/dbm.rst:270 msgid "" "Returns the key that follows *key* in the traversal. The following code " "prints every key in the database ``db``, without having to create a list in " "memory that contains them all::" msgstr "" -#: ../../library/dbm.rst:305 +#: ../../library/dbm.rst:274 msgid "" "k = db.firstkey()\n" "while k is not None:\n" @@ -444,37 +408,46 @@ msgstr "" " print(k)\n" " k = db.nextkey(k)" -#: ../../library/dbm.rst:312 +#: ../../library/dbm.rst:281 msgid "" "If you have carried out a lot of deletions and would like to shrink the " -"space used by the GDBM file, this routine will reorganize the database. :" -"class:`!gdbm` objects will not shorten the length of a database file except " -"by using this reorganization; otherwise, deleted file space will be kept and " -"reused as new (key, value) pairs are added." +"space used by the GDBM file, this routine will reorganize the " +"database. :class:`!gdbm` objects will not shorten the length of a database " +"file except by using this reorganization; otherwise, deleted file space will " +"be kept and reused as new (key, value) pairs are added." msgstr "" -#: ../../library/dbm.rst:320 +#: ../../library/dbm.rst:289 msgid "" "When the database has been opened in fast mode, this method forces any " "unwritten data to be written to the disk." msgstr "" -#: ../../library/dbm.rst:325 +#: ../../library/dbm.rst:294 +msgid "Close the GDBM database." +msgstr "關閉 GDBM 資料庫。" + +#: ../../library/dbm.rst:298 +#, fuzzy +msgid "Remove all items from the GDBM database." +msgstr "關閉 GDBM 資料庫。" + +#: ../../library/dbm.rst:304 msgid ":mod:`dbm.ndbm` --- New Database Manager" msgstr ":mod:`dbm.ndbm` --- 新資料庫管理器" -#: ../../library/dbm.rst:331 +#: ../../library/dbm.rst:310 msgid "**Source code:** :source:`Lib/dbm/ndbm.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/ndbm.py`" -#: ../../library/dbm.rst:335 +#: ../../library/dbm.rst:314 msgid "" "The :mod:`dbm.ndbm` module provides an interface to the :abbr:`NDBM (New " "Database Manager)` library. This module can be used with the \"classic\" " "NDBM interface or the :abbr:`GDBM (GNU dbm)` compatibility interface." msgstr "" -#: ../../library/dbm.rst:347 +#: ../../library/dbm.rst:326 msgid "" "The NDBM library shipped as part of macOS has an undocumented limitation on " "the size of values, which can result in corrupted database files when " @@ -482,104 +455,110 @@ msgid "" "result in a hard crash (segmentation fault)." msgstr "" -#: ../../library/dbm.rst:356 +#: ../../library/dbm.rst:335 msgid "" -"Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:" -"`KeyError` is raised for general mapping errors like specifying an incorrect " -"key." +"Raised on :mod:`dbm.ndbm`-specific errors, such as I/O " +"errors. :exc:`KeyError` is raised for general mapping errors like specifying " +"an incorrect key." msgstr "" -#: ../../library/dbm.rst:362 +#: ../../library/dbm.rst:341 msgid "Name of the NDBM implementation library used." msgstr "" -#: ../../library/dbm.rst:367 +#: ../../library/dbm.rst:346 msgid "Open an NDBM database and return an :class:`!ndbm` object." msgstr "" -#: ../../library/dbm.rst:369 +#: ../../library/dbm.rst:348 msgid "" "The basename of the database file (without the :file:`.dir` or :file:`.pag` " "extensions)." msgstr "" -#: ../../library/dbm.rst:383 -msgid "Accepts :term:`path-like object` for filename." +#: ../../library/dbm.rst:362 +msgid "" +":class:`!ndbm` objects behave similar to :term:`mappings `, " +"but :meth:`!items` and :meth:`!values` methods are not supported. The " +"following methods are also provided:" msgstr "" -#: ../../library/dbm.rst:386 -msgid "" -":class:`!ndbm` objects behave similar to mutable :term:`mappings `, " -"but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`, " -"and :meth:`!update` are not supported, the :meth:`!keys` method returns a " -"list, and the :meth:`!setdefault` method requires two arguments. It also " -"supports a \"closing\" context manager via the :keyword:`with` keyword." +#: ../../library/dbm.rst:366 +msgid "Accepts :term:`path-like object` for filename." msgstr "" -#: ../../library/dbm.rst:403 +#: ../../library/dbm.rst:371 msgid "Close the NDBM database." msgstr "關閉 NDBM 資料庫。" -#: ../../library/dbm.rst:407 +#: ../../library/dbm.rst:375 +#, fuzzy +msgid "Remove all items from the NDBM database." +msgstr "關閉 NDBM 資料庫。" + +#: ../../library/dbm.rst:381 msgid ":mod:`dbm.dumb` --- Portable DBM implementation" msgstr ":mod:`dbm.dumb` --- 可攜式 DBM 實作" -#: ../../library/dbm.rst:412 +#: ../../library/dbm.rst:386 msgid "**Source code:** :source:`Lib/dbm/dumb.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/dumb.py`" -#: ../../library/dbm.rst:418 +#: ../../library/dbm.rst:392 msgid "" -"The :mod:`dbm.dumb` module is intended as a last resort fallback for the :" -"mod:`dbm` module when a more robust module is not available. The :mod:`dbm." -"dumb` module is not written for speed and is not nearly as heavily used as " -"the other database modules." +"The :mod:`dbm.dumb` module is intended as a last resort fallback for " +"the :mod:`dbm` module when a more robust module is not available. " +"The :mod:`dbm.dumb` module is not written for speed and is not nearly as " +"heavily used as the other database modules." msgstr "" -#: ../../library/dbm.rst:425 +#: ../../library/dbm.rst:399 msgid "" "The :mod:`dbm.dumb` module provides a persistent :class:`dict`-like " "interface which is written entirely in Python. Unlike other :mod:`dbm` " "backends, such as :mod:`dbm.gnu`, no external library is required." msgstr "" -#: ../../library/dbm.rst:430 +#: ../../library/dbm.rst:404 msgid "The :mod:`!dbm.dumb` module defines the following:" msgstr ":mod:`!dbm.dumb` 模組定義了以下項目:" -#: ../../library/dbm.rst:434 +#: ../../library/dbm.rst:408 msgid "" -"Raised on :mod:`dbm.dumb`-specific errors, such as I/O errors. :exc:" -"`KeyError` is raised for general mapping errors like specifying an incorrect " -"key." +"Raised on :mod:`dbm.dumb`-specific errors, such as I/O " +"errors. :exc:`KeyError` is raised for general mapping errors like " +"specifying an incorrect key." msgstr "" -#: ../../library/dbm.rst:440 -msgid "Open a :mod:`!dbm.dumb` database." +#: ../../library/dbm.rst:414 +msgid "" +"Open a :mod:`!dbm.dumb` database. The returned database object behaves " +"similar to a :term:`mapping`, in addition to providing :meth:`~dumbdbm.sync` " +"and :meth:`~dumbdbm.close` methods." msgstr "" -#: ../../library/dbm.rst:442 +#: ../../library/dbm.rst:419 msgid "" "The basename of the database file (without extensions). A new database " -"creates the following files: - :file:`{filename}.dat` - :file:`{filename}." -"dir`" +"creates the following files: - :file:`{filename}.dat` " +"- :file:`{filename}.dir`" msgstr "" -#: ../../library/dbm.rst:443 +#: ../../library/dbm.rst:420 msgid "" "The basename of the database file (without extensions). A new database " "creates the following files:" msgstr "" -#: ../../library/dbm.rst:446 +#: ../../library/dbm.rst:423 msgid ":file:`{filename}.dat`" msgstr ":file:`{filename}.dat`" -#: ../../library/dbm.rst:447 +#: ../../library/dbm.rst:424 msgid ":file:`{filename}.dir`" msgstr ":file:`{filename}.dir`" -#: ../../library/dbm.rst:450 +#: ../../library/dbm.rst:427 msgid "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" @@ -587,50 +566,62 @@ msgstr "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" -#: ../../library/dbm.rst:451 +#: ../../library/dbm.rst:428 msgid "``'r'``: |flag_r|" msgstr "``'r'``: |flag_r|" -#: ../../library/dbm.rst:453 +#: ../../library/dbm.rst:430 msgid "``'c'`` (default): |flag_c|" msgstr "``'c'`` (default): |flag_c|" -#: ../../library/dbm.rst:460 +#: ../../library/dbm.rst:437 msgid "" "It is possible to crash the Python interpreter when loading a database with " "a sufficiently large/complex entry due to stack depth limitations in " "Python's AST compiler." msgstr "" -#: ../../library/dbm.rst:464 +#: ../../library/dbm.rst:441 msgid "" ":func:`~dbm.dumb.open` always creates a new database when *flag* is ``'n'``." msgstr "" -#: ../../library/dbm.rst:467 +#: ../../library/dbm.rst:444 msgid "" "A database opened read-only if *flag* is ``'r'``. A database is not created " "if it does not exist if *flag* is ``'r'`` or ``'w'``." msgstr "" -#: ../../library/dbm.rst:474 +#: ../../library/dbm.rst:451 msgid "" -"The returned database object behaves similar to a mutable :term:`mapping`, " -"but the :meth:`!keys` and :meth:`!items` methods return lists, and the :meth:" -"`!setdefault` method requires two arguments. It also supports a \"closing\" " -"context manager via the :keyword:`with` keyword." +"In addition to the methods provided by " +"the :class:`collections.abc.MutableMapping` class, the following methods are " +"provided:" msgstr "" -#: ../../library/dbm.rst:483 -msgid "Close the database." -msgstr "關閉資料庫。" - -#: ../../library/dbm.rst:487 +#: ../../library/dbm.rst:457 msgid "" "Synchronize the on-disk directory and data files. This method is called by " "the :meth:`shelve.Shelf.sync` method." msgstr "" -#: ../../library/dbm.rst:414 +#: ../../library/dbm.rst:462 +msgid "Close the database." +msgstr "關閉資料庫。" + +#: ../../library/dbm.rst:388 msgid "databases" msgstr "databases(資料庫)" + +#~ msgid "" +#~ ":meth:`!clear` methods are now available for all :mod:`dbm` backends." +#~ msgstr ":meth:`!clear` 方法現在可用於所有 :mod:`dbm` 後端。" + +#~ msgid "Open an SQLite database." +#~ msgstr "打開一個 SQLite 資料庫。" + +#~ msgid "The following method is also provided:" +#~ msgstr "也提供了以下方法:" + +#~ msgid "Close the SQLite database." +#~ msgstr "關閉 SQLite 資料庫。" diff --git a/library/decimal.po b/library/decimal.po index 384c9f1508a..ae074242e04 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -7,7 +7,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-09-08 15:25+0800\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-" @@ -29,8 +29,8 @@ msgstr "**原始碼:**\\ :source:`Lib/decimal.py`" #: ../../library/decimal.rst:33 msgid "" "The :mod:`decimal` module provides support for fast correctly rounded " -"decimal floating-point arithmetic. It offers several advantages over the :" -"class:`float` datatype:" +"decimal floating-point arithmetic. It offers several advantages over " +"the :class:`float` datatype:" msgstr "" #: ../../library/decimal.rst:37 @@ -115,9 +115,9 @@ msgid "" "The context for arithmetic is an environment specifying precision, rounding " "rules, limits on exponents, flags indicating the results of operations, and " "trap enablers which determine whether signals are treated as exceptions. " -"Rounding options include :const:`ROUND_CEILING`, :const:`ROUND_DOWN`, :const:" -"`ROUND_FLOOR`, :const:`ROUND_HALF_DOWN`, :const:`ROUND_HALF_EVEN`, :const:" -"`ROUND_HALF_UP`, :const:`ROUND_UP`, and :const:`ROUND_05UP`." +"Rounding options " +"include :const:`ROUND_CEILING`, :const:`ROUND_DOWN`, :const:`ROUND_FLOOR`, :const:`ROUND_HALF_DOWN`, :const:`ROUND_HALF_EVEN`, :const:`ROUND_HALF_UP`, :const:`ROUND_UP`, " +"and :const:`ROUND_05UP`." msgstr "" #: ../../library/decimal.rst:101 @@ -125,10 +125,9 @@ msgid "" "Signals are groups of exceptional conditions arising during the course of " "computation. Depending on the needs of the application, signals may be " "ignored, considered as informational, or treated as exceptions. The signals " -"in the decimal module are: :const:`Clamped`, :const:`InvalidOperation`, :" -"const:`DivisionByZero`, :const:`Inexact`, :const:`Rounded`, :const:" -"`Subnormal`, :const:`Overflow`, :const:`Underflow` and :const:" -"`FloatOperation`." +"in the decimal module " +"are: :const:`Clamped`, :const:`InvalidOperation`, :const:`DivisionByZero`, :const:`Inexact`, :const:`Rounded`, :const:`Subnormal`, :const:`Overflow`, :const:`Underflow` " +"and :const:`FloatOperation`." msgstr "" #: ../../library/decimal.rst:108 @@ -379,16 +378,16 @@ msgstr "" #: ../../library/decimal.rst:266 msgid "" "For more advanced work, it may be useful to create alternate contexts using " -"the Context() constructor. To make an alternate active, use the :func:" -"`setcontext` function." +"the Context() constructor. To make an alternate active, use " +"the :func:`setcontext` function." msgstr "" #: ../../library/decimal.rst:270 msgid "" "In accordance with the standard, the :mod:`decimal` module provides two " -"ready to use standard contexts, :const:`BasicContext` and :const:" -"`ExtendedContext`. The former is especially useful for debugging because " -"many of the traps are enabled:" +"ready to use standard contexts, :const:`BasicContext` " +"and :const:`ExtendedContext`. The former is especially useful for debugging " +"because many of the traps are enabled:" msgstr "" #: ../../library/decimal.rst:275 @@ -515,11 +514,11 @@ msgstr "" #: ../../library/decimal.rst:350 msgid "" -"*value* can be an integer, string, tuple, :class:`float`, or another :class:" -"`Decimal` object. If no *value* is given, returns ``Decimal('0')``. If " -"*value* is a string, it should conform to the decimal numeric string syntax " -"after leading and trailing whitespace characters, as well as underscores " -"throughout, are removed::" +"*value* can be an integer, string, tuple, :class:`float`, or " +"another :class:`Decimal` object. If no *value* is given, returns " +"``Decimal('0')``. If *value* is a string, it should conform to the decimal " +"numeric string syntax after leading and trailing whitespace characters, as " +"well as underscores throughout, are removed::" msgstr "" #: ../../library/decimal.rst:355 @@ -608,8 +607,8 @@ msgid "" "numeric types such as :class:`float` and :class:`int`. All of the usual " "math operations and special methods apply. Likewise, decimal objects can be " "copied, pickled, printed, used as dictionary keys, used as set elements, " -"compared, sorted, and coerced to another type (such as :class:`float` or :" -"class:`int`)." +"compared, sorted, and coerced to another type (such as :class:`float` " +"or :class:`int`)." msgstr "" #: ../../library/decimal.rst:415 @@ -659,13 +658,13 @@ msgstr "" #: ../../library/decimal.rst:438 msgid "" -"Decimal objects cannot generally be combined with floats or instances of :" -"class:`fractions.Fraction` in arithmetic operations: an attempt to add a :" -"class:`Decimal` to a :class:`float`, for example, will raise a :exc:" -"`TypeError`. However, it is possible to use Python's comparison operators " -"to compare a :class:`Decimal` instance ``x`` with another number ``y``. " -"This avoids confusing results when doing equality comparisons between " -"numbers of different types." +"Decimal objects cannot generally be combined with floats or instances " +"of :class:`fractions.Fraction` in arithmetic operations: an attempt to add " +"a :class:`Decimal` to a :class:`float`, for example, will raise " +"a :exc:`TypeError`. However, it is possible to use Python's comparison " +"operators to compare a :class:`Decimal` instance ``x`` with another number " +"``y``. This avoids confusing results when doing equality comparisons " +"between numbers of different types." msgstr "" #: ../../library/decimal.rst:446 @@ -690,9 +689,9 @@ msgstr "" #: ../../library/decimal.rst:463 msgid "" -"Return a pair ``(n, d)`` of integers that represent the given :class:" -"`Decimal` instance as a fraction, in lowest terms and with a positive " -"denominator::" +"Return a pair ``(n, d)`` of integers that represent the " +"given :class:`Decimal` instance as a fraction, in lowest terms and with a " +"positive denominator::" msgstr "" #: ../../library/decimal.rst:467 @@ -767,7 +766,7 @@ msgid "" msgstr "" #: ../../library/decimal.rst:522 ../../library/decimal.rst:533 -#: ../../library/decimal.rst:561 ../../library/decimal.rst:848 +#: ../../library/decimal.rst:561 ../../library/decimal.rst:865 msgid "" "This operation is unaffected by context and is quiet: no flags are changed " "and no rounding is performed. As an exception, the C version may raise " @@ -778,8 +777,8 @@ msgstr "" msgid "" "Compare two operands using their abstract representation rather than their " "value as in :meth:`compare_total`, but ignoring the sign of each operand. " -"``x.compare_total_mag(y)`` is equivalent to ``x.copy_abs().compare_total(y." -"copy_abs())``." +"``x.compare_total_mag(y)`` is equivalent to " +"``x.copy_abs().compare_total(y.copy_abs())``." msgstr "" #: ../../library/decimal.rst:539 @@ -815,8 +814,8 @@ msgstr "" #: ../../library/decimal.rst:578 msgid "" -"Alternative constructor that only accepts instances of :class:`float` or :" -"class:`int`." +"Alternative constructor that only accepts instances of :class:`float` " +"or :class:`int`." msgstr "" #: ../../library/decimal.rst:581 @@ -856,159 +855,185 @@ msgstr "" #: ../../library/decimal.rst:605 msgid "" +"Alternative constructor that only accepts instances " +"of :class:`float`, :class:`int` or :class:`Decimal`, but not strings or " +"tuples." +msgstr "" + +#: ../../library/decimal.rst:609 +#, fuzzy +msgid "" +">>> Decimal.from_number(314)\n" +"Decimal('314')\n" +">>> Decimal.from_number(0.1)\n" +"Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" +">>> Decimal.from_number(Decimal('3.14'))\n" +"Decimal('3.14')" +msgstr "" +">>> Decimal.from_float(0.1)\n" +"Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" +">>> Decimal.from_float(float('nan'))\n" +"Decimal('NaN')\n" +">>> Decimal.from_float(float('inf'))\n" +"Decimal('Infinity')\n" +">>> Decimal.from_float(float('-inf'))\n" +"Decimal('-Infinity')" + +#: ../../library/decimal.rst:622 +msgid "" "Fused multiply-add. Return self*other+third with no rounding of the " "intermediate product self*other." msgstr "" -#: ../../library/decimal.rst:613 +#: ../../library/decimal.rst:630 msgid "" "Return :const:`True` if the argument is canonical and :const:`False` " "otherwise. Currently, a :class:`Decimal` instance is always canonical, so " "this operation always returns :const:`True`." msgstr "" -#: ../../library/decimal.rst:619 +#: ../../library/decimal.rst:636 msgid "" "Return :const:`True` if the argument is a finite number, and :const:`False` " "if the argument is an infinity or a NaN." msgstr "" -#: ../../library/decimal.rst:624 +#: ../../library/decimal.rst:641 msgid "" "Return :const:`True` if the argument is either positive or negative infinity " "and :const:`False` otherwise." msgstr "" -#: ../../library/decimal.rst:629 +#: ../../library/decimal.rst:646 msgid "" -"Return :const:`True` if the argument is a (quiet or signaling) NaN and :" -"const:`False` otherwise." +"Return :const:`True` if the argument is a (quiet or signaling) NaN " +"and :const:`False` otherwise." msgstr "" -#: ../../library/decimal.rst:634 +#: ../../library/decimal.rst:651 msgid "" -"Return :const:`True` if the argument is a *normal* finite number. Return :" -"const:`False` if the argument is zero, subnormal, infinite or a NaN." +"Return :const:`True` if the argument is a *normal* finite number. " +"Return :const:`False` if the argument is zero, subnormal, infinite or a NaN." msgstr "" -#: ../../library/decimal.rst:639 +#: ../../library/decimal.rst:656 msgid "" "Return :const:`True` if the argument is a quiet NaN, and :const:`False` " "otherwise." msgstr "" -#: ../../library/decimal.rst:644 +#: ../../library/decimal.rst:661 msgid "" "Return :const:`True` if the argument has a negative sign and :const:`False` " "otherwise. Note that zeros and NaNs can both carry signs." msgstr "" -#: ../../library/decimal.rst:649 +#: ../../library/decimal.rst:666 msgid "" "Return :const:`True` if the argument is a signaling NaN and :const:`False` " "otherwise." msgstr "" -#: ../../library/decimal.rst:654 +#: ../../library/decimal.rst:671 msgid "" "Return :const:`True` if the argument is subnormal, and :const:`False` " "otherwise." msgstr "" -#: ../../library/decimal.rst:659 +#: ../../library/decimal.rst:676 msgid "" -"Return :const:`True` if the argument is a (positive or negative) zero and :" -"const:`False` otherwise." +"Return :const:`True` if the argument is a (positive or negative) zero " +"and :const:`False` otherwise." msgstr "" -#: ../../library/decimal.rst:664 +#: ../../library/decimal.rst:681 msgid "" "Return the natural (base e) logarithm of the operand. The result is " "correctly rounded using the :const:`ROUND_HALF_EVEN` rounding mode." msgstr "" -#: ../../library/decimal.rst:669 +#: ../../library/decimal.rst:686 msgid "" "Return the base ten logarithm of the operand. The result is correctly " "rounded using the :const:`ROUND_HALF_EVEN` rounding mode." msgstr "" -#: ../../library/decimal.rst:674 +#: ../../library/decimal.rst:691 msgid "" -"For a nonzero number, return the adjusted exponent of its operand as a :" -"class:`Decimal` instance. If the operand is a zero then ``Decimal('-" +"For a nonzero number, return the adjusted exponent of its operand as " +"a :class:`Decimal` instance. If the operand is a zero then ``Decimal('-" "Infinity')`` is returned and the :const:`DivisionByZero` flag is raised. If " "the operand is an infinity then ``Decimal('Infinity')`` is returned." msgstr "" -#: ../../library/decimal.rst:682 +#: ../../library/decimal.rst:699 msgid "" ":meth:`logical_and` is a logical operation which takes two *logical " "operands* (see :ref:`logical_operands_label`). The result is the digit-wise " "``and`` of the two operands." msgstr "" -#: ../../library/decimal.rst:688 +#: ../../library/decimal.rst:705 msgid "" ":meth:`logical_invert` is a logical operation. The result is the digit-wise " "inversion of the operand." msgstr "" -#: ../../library/decimal.rst:693 +#: ../../library/decimal.rst:710 msgid "" ":meth:`logical_or` is a logical operation which takes two *logical operands* " "(see :ref:`logical_operands_label`). The result is the digit-wise ``or`` of " "the two operands." msgstr "" -#: ../../library/decimal.rst:699 +#: ../../library/decimal.rst:716 msgid "" ":meth:`logical_xor` is a logical operation which takes two *logical " "operands* (see :ref:`logical_operands_label`). The result is the digit-wise " "exclusive or of the two operands." msgstr "" -#: ../../library/decimal.rst:705 +#: ../../library/decimal.rst:722 msgid "" "Like ``max(self, other)`` except that the context rounding rule is applied " "before returning and that ``NaN`` values are either signaled or ignored " "(depending on the context and whether they are signaling or quiet)." msgstr "" -#: ../../library/decimal.rst:712 +#: ../../library/decimal.rst:729 msgid "" "Similar to the :meth:`.max` method, but the comparison is done using the " "absolute values of the operands." msgstr "" -#: ../../library/decimal.rst:717 +#: ../../library/decimal.rst:734 msgid "" "Like ``min(self, other)`` except that the context rounding rule is applied " "before returning and that ``NaN`` values are either signaled or ignored " "(depending on the context and whether they are signaling or quiet)." msgstr "" -#: ../../library/decimal.rst:724 +#: ../../library/decimal.rst:741 msgid "" "Similar to the :meth:`.min` method, but the comparison is done using the " "absolute values of the operands." msgstr "" -#: ../../library/decimal.rst:729 +#: ../../library/decimal.rst:746 msgid "" "Return the largest number representable in the given context (or in the " "current thread's context if no context is given) that is smaller than the " "given operand." msgstr "" -#: ../../library/decimal.rst:735 +#: ../../library/decimal.rst:752 msgid "" "Return the smallest number representable in the given context (or in the " "current thread's context if no context is given) that is larger than the " "given operand." msgstr "" -#: ../../library/decimal.rst:741 +#: ../../library/decimal.rst:758 msgid "" "If the two operands are unequal, return the number closest to the first " "operand in the direction of the second operand. If both operands are " @@ -1016,13 +1041,13 @@ msgid "" "be the same as the sign of the second operand." msgstr "" -#: ../../library/decimal.rst:748 +#: ../../library/decimal.rst:765 msgid "" "Used for producing canonical values of an equivalence class within either " "the current context or the specified context." msgstr "" -#: ../../library/decimal.rst:751 +#: ../../library/decimal.rst:768 msgid "" "This has the same semantics as the unary plus operation, except that if the " "final result is finite it is reduced to its simplest form, with all trailing " @@ -1032,79 +1057,79 @@ msgid "" "exponent is set to 0. In all cases the sign is unchanged." msgstr "" -#: ../../library/decimal.rst:758 +#: ../../library/decimal.rst:775 msgid "" "For example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both " "normalize to the equivalent value ``Decimal('32.1')``." msgstr "" -#: ../../library/decimal.rst:761 +#: ../../library/decimal.rst:778 msgid "Note that rounding is applied *before* reducing to simplest form." msgstr "" -#: ../../library/decimal.rst:763 +#: ../../library/decimal.rst:780 msgid "" "In the latest versions of the specification, this operation is also known as " "``reduce``." msgstr "" -#: ../../library/decimal.rst:768 +#: ../../library/decimal.rst:785 msgid "" "Return a string describing the *class* of the operand. The returned value " "is one of the following ten strings." msgstr "" -#: ../../library/decimal.rst:771 +#: ../../library/decimal.rst:788 msgid "``\"-Infinity\"``, indicating that the operand is negative infinity." msgstr "" -#: ../../library/decimal.rst:772 +#: ../../library/decimal.rst:789 msgid "" "``\"-Normal\"``, indicating that the operand is a negative normal number." msgstr "" -#: ../../library/decimal.rst:773 +#: ../../library/decimal.rst:790 msgid "" "``\"-Subnormal\"``, indicating that the operand is negative and subnormal." msgstr "" -#: ../../library/decimal.rst:774 +#: ../../library/decimal.rst:791 msgid "``\"-Zero\"``, indicating that the operand is a negative zero." msgstr "" -#: ../../library/decimal.rst:775 +#: ../../library/decimal.rst:792 msgid "``\"+Zero\"``, indicating that the operand is a positive zero." msgstr "" -#: ../../library/decimal.rst:776 +#: ../../library/decimal.rst:793 msgid "" "``\"+Subnormal\"``, indicating that the operand is positive and subnormal." msgstr "" -#: ../../library/decimal.rst:777 +#: ../../library/decimal.rst:794 msgid "" "``\"+Normal\"``, indicating that the operand is a positive normal number." msgstr "" -#: ../../library/decimal.rst:778 +#: ../../library/decimal.rst:795 msgid "``\"+Infinity\"``, indicating that the operand is positive infinity." msgstr "" -#: ../../library/decimal.rst:779 +#: ../../library/decimal.rst:796 msgid "``\"NaN\"``, indicating that the operand is a quiet NaN (Not a Number)." msgstr "" -#: ../../library/decimal.rst:780 +#: ../../library/decimal.rst:797 msgid "``\"sNaN\"``, indicating that the operand is a signaling NaN." msgstr "" -#: ../../library/decimal.rst:784 +#: ../../library/decimal.rst:801 msgid "" "Return a value equal to the first operand after rounding and having the " "exponent of the second operand." msgstr "" -#: ../../library/decimal.rst:790 +#: ../../library/decimal.rst:807 msgid "" "Unlike other operations, if the length of the coefficient after the quantize " "operation would be greater than precision, then an :const:`InvalidOperation` " @@ -1112,13 +1137,13 @@ msgid "" "quantized exponent is always equal to that of the right-hand operand." msgstr "" -#: ../../library/decimal.rst:796 +#: ../../library/decimal.rst:813 msgid "" "Also unlike other operations, quantize never signals Underflow, even if the " "result is subnormal and inexact." msgstr "" -#: ../../library/decimal.rst:799 +#: ../../library/decimal.rst:816 msgid "" "If the exponent of the second operand is larger than that of the first then " "rounding may be necessary. In this case, the rounding mode is determined by " @@ -1127,19 +1152,19 @@ msgid "" "context is used." msgstr "" -#: ../../library/decimal.rst:805 +#: ../../library/decimal.rst:822 msgid "" -"An error is returned whenever the resulting exponent is greater than :attr:" -"`~Context.Emax` or less than :meth:`~Context.Etiny`." +"An error is returned whenever the resulting exponent is greater " +"than :attr:`~Context.Emax` or less than :meth:`~Context.Etiny`." msgstr "" -#: ../../library/decimal.rst:810 +#: ../../library/decimal.rst:827 msgid "" "Return ``Decimal(10)``, the radix (base) in which the :class:`Decimal` class " "does all its arithmetic. Included for compatibility with the specification." msgstr "" -#: ../../library/decimal.rst:816 +#: ../../library/decimal.rst:833 msgid "" "Return the remainder from dividing *self* by *other*. This differs from " "``self % other`` in that the sign of the remainder is chosen so as to " @@ -1148,11 +1173,11 @@ msgid "" "other``, and if two integers are equally near then the even one is chosen." msgstr "" -#: ../../library/decimal.rst:823 +#: ../../library/decimal.rst:840 msgid "If the result is zero then its sign will be the sign of *self*." msgstr "" -#: ../../library/decimal.rst:834 +#: ../../library/decimal.rst:851 msgid "" "Return the result of rotating the digits of the first operand by an amount " "specified by the second operand. The second operand must be an integer in " @@ -1164,20 +1189,20 @@ msgid "" "are unchanged." msgstr "" -#: ../../library/decimal.rst:845 +#: ../../library/decimal.rst:862 msgid "" "Test whether self and other have the same exponent or whether both are " "``NaN``." msgstr "" -#: ../../library/decimal.rst:854 +#: ../../library/decimal.rst:871 msgid "" "Return the first operand with exponent adjusted by the second. Equivalently, " "return the first operand multiplied by ``10**other``. The second operand " "must be an integer." msgstr "" -#: ../../library/decimal.rst:860 +#: ../../library/decimal.rst:877 msgid "" "Return the result of shifting the digits of the first operand by an amount " "specified by the second operand. The second operand must be an integer in " @@ -1188,34 +1213,34 @@ msgid "" "exponent of the first operand are unchanged." msgstr "" -#: ../../library/decimal.rst:870 +#: ../../library/decimal.rst:887 msgid "Return the square root of the argument to full precision." msgstr "" -#: ../../library/decimal.rst:875 ../../library/decimal.rst:1524 +#: ../../library/decimal.rst:892 ../../library/decimal.rst:1549 msgid "" "Convert to a string, using engineering notation if an exponent is needed." msgstr "" -#: ../../library/decimal.rst:877 ../../library/decimal.rst:1526 +#: ../../library/decimal.rst:894 ../../library/decimal.rst:1551 msgid "" "Engineering notation has an exponent which is a multiple of 3. This can " "leave up to 3 digits to the left of the decimal place and may require the " "addition of either one or two trailing zeros." msgstr "" -#: ../../library/decimal.rst:881 +#: ../../library/decimal.rst:898 msgid "" "For example, this converts ``Decimal('123E+1')`` to ``Decimal('1.23E+3')``." msgstr "" -#: ../../library/decimal.rst:885 +#: ../../library/decimal.rst:902 msgid "" "Identical to the :meth:`to_integral_value` method. The ``to_integral`` name " "has been kept for compatibility with older versions." msgstr "" -#: ../../library/decimal.rst:890 +#: ../../library/decimal.rst:907 msgid "" "Round to the nearest integer, signaling :const:`Inexact` or :const:`Rounded` " "as appropriate if rounding occurs. The rounding mode is determined by the " @@ -1223,58 +1248,59 @@ msgid "" "parameter is given then the rounding mode of the current context is used." msgstr "" -#: ../../library/decimal.rst:898 +#: ../../library/decimal.rst:915 msgid "" -"Round to the nearest integer without signaling :const:`Inexact` or :const:" -"`Rounded`. If given, applies *rounding*; otherwise, uses the rounding " -"method in either the supplied *context* or the current context." +"Round to the nearest integer without signaling :const:`Inexact` " +"or :const:`Rounded`. If given, applies *rounding*; otherwise, uses the " +"rounding method in either the supplied *context* or the current context." msgstr "" -#: ../../library/decimal.rst:902 +#: ../../library/decimal.rst:919 msgid "Decimal numbers can be rounded using the :func:`.round` function:" msgstr "" -#: ../../library/decimal.rst:907 +#: ../../library/decimal.rst:924 msgid "" "If *ndigits* is not given or ``None``, returns the nearest :class:`int` to " -"*number*, rounding ties to even, and ignoring the rounding mode of the :" -"class:`Decimal` context. Raises :exc:`OverflowError` if *number* is an " +"*number*, rounding ties to even, and ignoring the rounding mode of " +"the :class:`Decimal` context. Raises :exc:`OverflowError` if *number* is an " "infinity or :exc:`ValueError` if it is a (quiet or signaling) NaN." msgstr "" -#: ../../library/decimal.rst:913 +#: ../../library/decimal.rst:930 msgid "" "If *ndigits* is an :class:`int`, the context's rounding mode is respected " "and a :class:`Decimal` representing *number* rounded to the nearest multiple " "of ``Decimal('1E-ndigits')`` is returned; in this case, ``round(number, " "ndigits)`` is equivalent to ``self.quantize(Decimal('1E-ndigits'))``. " -"Returns ``Decimal('NaN')`` if *number* is a quiet NaN. Raises :class:" -"`InvalidOperation` if *number* is an infinity, a signaling NaN, or if the " -"length of the coefficient after the quantize operation would be greater than " -"the current context's precision. In other words, for the non-corner cases:" +"Returns ``Decimal('NaN')`` if *number* is a quiet NaN. " +"Raises :class:`InvalidOperation` if *number* is an infinity, a signaling " +"NaN, or if the length of the coefficient after the quantize operation would " +"be greater than the current context's precision. In other words, for the " +"non-corner cases:" msgstr "" -#: ../../library/decimal.rst:923 +#: ../../library/decimal.rst:940 msgid "" "if *ndigits* is positive, return *number* rounded to *ndigits* decimal " "places;" msgstr "" -#: ../../library/decimal.rst:925 +#: ../../library/decimal.rst:942 msgid "if *ndigits* is zero, return *number* rounded to the nearest integer;" msgstr "" -#: ../../library/decimal.rst:926 +#: ../../library/decimal.rst:943 msgid "" "if *ndigits* is negative, return *number* rounded to the nearest multiple of " "``10**abs(ndigits)``." msgstr "" -#: ../../library/decimal.rst:929 +#: ../../library/decimal.rst:946 msgid "For example::" msgstr "" -#: ../../library/decimal.rst:931 +#: ../../library/decimal.rst:948 msgid "" ">>> from decimal import Decimal, getcontext, ROUND_DOWN\n" ">>> getcontext().rounding = ROUND_DOWN\n" @@ -1290,51 +1316,51 @@ msgid "" "Decimal('0E+1')" msgstr "" -#: ../../library/decimal.rst:948 +#: ../../library/decimal.rst:965 msgid "Logical operands" msgstr "" -#: ../../library/decimal.rst:950 +#: ../../library/decimal.rst:967 msgid "" -"The :meth:`~Decimal.logical_and`, :meth:`~Decimal.logical_invert`, :meth:" -"`~Decimal.logical_or`, and :meth:`~Decimal.logical_xor` methods expect their " -"arguments to be *logical operands*. A *logical operand* is a :class:" -"`Decimal` instance whose exponent and sign are both zero, and whose digits " -"are all either ``0`` or ``1``." +"The :meth:`~Decimal.logical_and`, :meth:`~Decimal.logical_invert`, :meth:`~Decimal.logical_or`, " +"and :meth:`~Decimal.logical_xor` methods expect their arguments to be " +"*logical operands*. A *logical operand* is a :class:`Decimal` instance " +"whose exponent and sign are both zero, and whose digits are all either ``0`` " +"or ``1``." msgstr "" -#: ../../library/decimal.rst:962 +#: ../../library/decimal.rst:979 msgid "Context objects" msgstr "" -#: ../../library/decimal.rst:964 +#: ../../library/decimal.rst:981 msgid "" "Contexts are environments for arithmetic operations. They govern precision, " "set rules for rounding, determine which signals are treated as exceptions, " "and limit the range for exponents." msgstr "" -#: ../../library/decimal.rst:968 +#: ../../library/decimal.rst:985 msgid "" "Each thread has its own current context which is accessed or changed using " "the :func:`getcontext` and :func:`setcontext` functions:" msgstr "" -#: ../../library/decimal.rst:974 +#: ../../library/decimal.rst:991 msgid "Return the current context for the active thread." msgstr "" -#: ../../library/decimal.rst:979 +#: ../../library/decimal.rst:996 msgid "Set the current context for the active thread to *c*." msgstr "" -#: ../../library/decimal.rst:981 +#: ../../library/decimal.rst:998 msgid "" "You can also use the :keyword:`with` statement and the :func:`localcontext` " "function to temporarily change the active context." msgstr "" -#: ../../library/decimal.rst:986 +#: ../../library/decimal.rst:1003 msgid "" "Return a context manager that will set the current context for the active " "thread to a copy of *ctx* on entry to the with-statement and restore the " @@ -1343,14 +1369,14 @@ msgid "" "used to set the attributes of the new context." msgstr "" -#: ../../library/decimal.rst:992 +#: ../../library/decimal.rst:1009 msgid "" "For example, the following code sets the current decimal precision to 42 " "places, performs a calculation, and then automatically restores the previous " "context::" msgstr "" -#: ../../library/decimal.rst:995 +#: ../../library/decimal.rst:1012 msgid "" "from decimal import localcontext\n" "\n" @@ -1360,11 +1386,11 @@ msgid "" "s = +s # Round the final result back to the default precision" msgstr "" -#: ../../library/decimal.rst:1002 +#: ../../library/decimal.rst:1019 msgid "Using keyword arguments, the code would be the following::" msgstr "" -#: ../../library/decimal.rst:1004 +#: ../../library/decimal.rst:1021 msgid "" "from decimal import localcontext\n" "\n" @@ -1378,48 +1404,55 @@ msgstr "" " s = calculate_something()\n" "s = +s" -#: ../../library/decimal.rst:1010 +#: ../../library/decimal.rst:1027 msgid "" -"Raises :exc:`TypeError` if *kwargs* supplies an attribute that :class:" -"`Context` doesn't support. Raises either :exc:`TypeError` or :exc:" -"`ValueError` if *kwargs* supplies an invalid value for an attribute." +"Raises :exc:`TypeError` if *kwargs* supplies an attribute " +"that :class:`Context` doesn't support. Raises either :exc:`TypeError` " +"or :exc:`ValueError` if *kwargs* supplies an invalid value for an attribute." msgstr "" -#: ../../library/decimal.rst:1014 +#: ../../library/decimal.rst:1031 msgid "" ":meth:`localcontext` now supports setting context attributes through the use " "of keyword arguments." msgstr "" -#: ../../library/decimal.rst:1017 +#: ../../library/decimal.rst:1036 +msgid "" +"Return a context object initialized to the proper values for one of the IEEE " +"interchange formats. The argument must be a multiple of 32 and less " +"than :const:`IEEE_CONTEXT_MAX_BITS`." +msgstr "" + +#: ../../library/decimal.rst:1042 msgid "" "New contexts can also be created using the :class:`Context` constructor " "described below. In addition, the module provides three pre-made contexts:" msgstr "" -#: ../../library/decimal.rst:1023 +#: ../../library/decimal.rst:1048 msgid "" "This is a standard context defined by the General Decimal Arithmetic " -"Specification. Precision is set to nine. Rounding is set to :const:" -"`ROUND_HALF_UP`. All flags are cleared. All traps are enabled (treated as " -"exceptions) except :const:`Inexact`, :const:`Rounded`, and :const:" -"`Subnormal`." +"Specification. Precision is set to nine. Rounding is set " +"to :const:`ROUND_HALF_UP`. All flags are cleared. All traps are enabled " +"(treated as exceptions) except :const:`Inexact`, :const:`Rounded`, " +"and :const:`Subnormal`." msgstr "" -#: ../../library/decimal.rst:1029 +#: ../../library/decimal.rst:1054 msgid "" "Because many of the traps are enabled, this context is useful for debugging." msgstr "" -#: ../../library/decimal.rst:1034 +#: ../../library/decimal.rst:1059 msgid "" "This is a standard context defined by the General Decimal Arithmetic " -"Specification. Precision is set to nine. Rounding is set to :const:" -"`ROUND_HALF_EVEN`. All flags are cleared. No traps are enabled (so that " -"exceptions are not raised during computations)." +"Specification. Precision is set to nine. Rounding is set " +"to :const:`ROUND_HALF_EVEN`. All flags are cleared. No traps are enabled " +"(so that exceptions are not raised during computations)." msgstr "" -#: ../../library/decimal.rst:1039 +#: ../../library/decimal.rst:1064 msgid "" "Because the traps are disabled, this context is useful for applications that " "prefer to have result value of ``NaN`` or ``Infinity`` instead of raising " @@ -1427,7 +1460,7 @@ msgid "" "conditions that would otherwise halt the program." msgstr "" -#: ../../library/decimal.rst:1047 +#: ../../library/decimal.rst:1072 msgid "" "This context is used by the :class:`Context` constructor as a prototype for " "new contexts. Changing a field (such a precision) has the effect of " @@ -1435,7 +1468,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/decimal.rst:1051 +#: ../../library/decimal.rst:1076 msgid "" "This context is most useful in multi-threaded environments. Changing one of " "the fields before threads are started has the effect of setting system-wide " @@ -1443,76 +1476,78 @@ msgid "" "as it would require thread synchronization to prevent race conditions." msgstr "" -#: ../../library/decimal.rst:1056 +#: ../../library/decimal.rst:1081 msgid "" "In single threaded environments, it is preferable to not use this context at " "all. Instead, simply create contexts explicitly as described below." msgstr "" -#: ../../library/decimal.rst:1059 +#: ../../library/decimal.rst:1084 msgid "" -"The default values are :attr:`Context.prec`\\ =\\ ``28``, :attr:`Context." -"rounding`\\ =\\ :const:`ROUND_HALF_EVEN`, and enabled traps for :class:" -"`Overflow`, :class:`InvalidOperation`, and :class:`DivisionByZero`." +"The default values are :attr:`Context.prec`\\ =\\ " +"``28``, :attr:`Context.rounding`\\ =\\ :const:`ROUND_HALF_EVEN`, and enabled " +"traps for :class:`Overflow`, :class:`InvalidOperation`, " +"and :class:`DivisionByZero`." msgstr "" -#: ../../library/decimal.rst:1064 +#: ../../library/decimal.rst:1089 msgid "" "In addition to the three supplied contexts, new contexts can be created with " "the :class:`Context` constructor." msgstr "" -#: ../../library/decimal.rst:1070 +#: ../../library/decimal.rst:1095 msgid "" "Creates a new context. If a field is not specified or is :const:`None`, the " "default values are copied from the :const:`DefaultContext`. If the *flags* " "field is not specified or is :const:`None`, all flags are cleared." msgstr "" -#: ../../library/decimal.rst:1076 +#: ../../library/decimal.rst:1101 msgid "" "An integer in the range [``1``, :const:`MAX_PREC`] that sets the precision " "for arithmetic operations in the context." msgstr "" -#: ../../library/decimal.rst:1081 +#: ../../library/decimal.rst:1106 msgid "One of the constants listed in the section `Rounding Modes`_." msgstr "" -#: ../../library/decimal.rst:1086 +#: ../../library/decimal.rst:1111 msgid "" "Lists of any signals to be set. Generally, new contexts should only set " "traps and leave the flags clear." msgstr "" -#: ../../library/decimal.rst:1092 +#: ../../library/decimal.rst:1117 msgid "" "Integers specifying the outer limits allowable for exponents. *Emin* must be " -"in the range [:const:`MIN_EMIN`, ``0``], *Emax* in the range [``0``, :const:" -"`MAX_EMAX`]." +"in the range [:const:`MIN_EMIN`, ``0``], *Emax* in the range " +"[``0``, :const:`MAX_EMAX`]." msgstr "" -#: ../../library/decimal.rst:1098 +#: ../../library/decimal.rst:1123 msgid "" "Either ``0`` or ``1`` (the default). If set to ``1``, exponents are printed " "with a capital ``E``; otherwise, a lowercase ``e`` is used: " "``Decimal('6.02e+23')``." msgstr "" -#: ../../library/decimal.rst:1104 +#: ../../library/decimal.rst:1129 msgid "" "Either ``0`` (the default) or ``1``. If set to ``1``, the exponent ``e`` of " "a :class:`Decimal` instance representable in this context is strictly " "limited to the range ``Emin - prec + 1 <= e <= Emax - prec + 1``. If *clamp* " -"is ``0`` then a weaker condition holds: the adjusted exponent of the :class:" -"`Decimal` instance is at most :attr:`~Context.Emax`. When *clamp* is ``1``, " -"a large normal number will, where possible, have its exponent reduced and a " -"corresponding number of zeros added to its coefficient, in order to fit the " -"exponent constraints; this preserves the value of the number but loses " -"information about significant trailing zeros. For example::" +"is ``0`` then a weaker condition holds: the adjusted exponent of " +"the :class:`Decimal` instance is at most :attr:`~Context.Emax`. When " +"*clamp* is ``1``, a large normal number will, where possible, have its " +"exponent reduced and a corresponding number of zeros added to its " +"coefficient, in order to fit the exponent constraints; this preserves the " +"value of the number but loses information about significant trailing zeros. " +"For example::" msgstr "" -#: ../../library/decimal.rst:1115 +#: ../../library/decimal.rst:1140 msgid "" ">>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')\n" "Decimal('1.23000E+999')" @@ -1520,49 +1555,50 @@ msgstr "" ">>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')\n" "Decimal('1.23000E+999')" -#: ../../library/decimal.rst:1118 +#: ../../library/decimal.rst:1143 msgid "" "A *clamp* value of ``1`` allows compatibility with the fixed-width decimal " "interchange formats specified in IEEE 754." msgstr "" -#: ../../library/decimal.rst:1121 +#: ../../library/decimal.rst:1146 msgid "" "The :class:`Context` class defines several general purpose methods as well " "as a large number of methods for doing arithmetic directly in a given " "context. In addition, for each of the :class:`Decimal` methods described " -"above (with the exception of the :meth:`~Decimal.adjusted` and :meth:" -"`~Decimal.as_tuple` methods) there is a corresponding :class:`Context` " -"method. For example, for a :class:`Context` instance ``C`` and :class:" -"`Decimal` instance ``x``, ``C.exp(x)`` is equivalent to ``x." -"exp(context=C)``. Each :class:`Context` method accepts a Python integer (an " -"instance of :class:`int`) anywhere that a Decimal instance is accepted." +"above (with the exception of the :meth:`~Decimal.adjusted` " +"and :meth:`~Decimal.as_tuple` methods) there is a " +"corresponding :class:`Context` method. For example, for a :class:`Context` " +"instance ``C`` and :class:`Decimal` instance ``x``, ``C.exp(x)`` is " +"equivalent to ``x.exp(context=C)``. Each :class:`Context` method accepts a " +"Python integer (an instance of :class:`int`) anywhere that a Decimal " +"instance is accepted." msgstr "" -#: ../../library/decimal.rst:1134 +#: ../../library/decimal.rst:1159 msgid "Resets all of the flags to ``0``." msgstr "" -#: ../../library/decimal.rst:1138 +#: ../../library/decimal.rst:1163 msgid "Resets all of the traps to ``0``." msgstr "" -#: ../../library/decimal.rst:1144 +#: ../../library/decimal.rst:1169 msgid "Return a duplicate of the context." msgstr "" -#: ../../library/decimal.rst:1148 +#: ../../library/decimal.rst:1173 msgid "Return a copy of the Decimal instance num." msgstr "" -#: ../../library/decimal.rst:1152 +#: ../../library/decimal.rst:1177 msgid "" "Creates a new Decimal instance from *num* but using *self* as context. " "Unlike the :class:`Decimal` constructor, the context precision, rounding " "method, flags, and traps are applied to the conversion." msgstr "" -#: ../../library/decimal.rst:1156 +#: ../../library/decimal.rst:1181 msgid "" "This is useful because constants are often given to a greater precision than " "is needed by the application. Another benefit is that rounding immediately " @@ -1571,7 +1607,7 @@ msgid "" "sum can change the result:" msgstr "" -#: ../../library/decimal.rst:1162 +#: ../../library/decimal.rst:1187 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.4445') + Decimal('1.0023')\n" @@ -1585,14 +1621,14 @@ msgstr "" ">>> Decimal('3.4445') + Decimal(0) + Decimal('1.0023')\n" "Decimal('4.44')" -#: ../../library/decimal.rst:1170 +#: ../../library/decimal.rst:1195 msgid "" "This method implements the to-number operation of the IBM specification. If " "the argument is a string, no leading or trailing whitespace or underscores " "are permitted." msgstr "" -#: ../../library/decimal.rst:1176 +#: ../../library/decimal.rst:1201 msgid "" "Creates a new Decimal instance from a float *f* but rounding using *self* as " "the context. Unlike the :meth:`Decimal.from_float` class method, the " @@ -1600,7 +1636,7 @@ msgid "" "conversion." msgstr "" -#: ../../library/decimal.rst:1181 +#: ../../library/decimal.rst:1206 msgid "" ">>> context = Context(prec=5, rounding=ROUND_DOWN)\n" ">>> context.create_decimal_from_float(math.pi)\n" @@ -1620,18 +1656,18 @@ msgstr "" " ...\n" "decimal.Inexact: None" -#: ../../library/decimal.rst:1196 +#: ../../library/decimal.rst:1221 msgid "" "Returns a value equal to ``Emin - prec + 1`` which is the minimum exponent " -"value for subnormal results. When underflow occurs, the exponent is set to :" -"const:`Etiny`." +"value for subnormal results. When underflow occurs, the exponent is set " +"to :const:`Etiny`." msgstr "" -#: ../../library/decimal.rst:1202 +#: ../../library/decimal.rst:1227 msgid "Returns a value equal to ``Emax - prec + 1``." msgstr "" -#: ../../library/decimal.rst:1204 +#: ../../library/decimal.rst:1229 msgid "" "The usual approach to working with decimals is to create :class:`Decimal` " "instances and then apply arithmetic operations which take place within the " @@ -1641,189 +1677,189 @@ msgid "" "recounted here." msgstr "" -#: ../../library/decimal.rst:1214 +#: ../../library/decimal.rst:1239 msgid "Returns the absolute value of *x*." msgstr "" -#: ../../library/decimal.rst:1219 +#: ../../library/decimal.rst:1244 msgid "Return the sum of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1224 +#: ../../library/decimal.rst:1249 msgid "Returns the same Decimal object *x*." msgstr "" -#: ../../library/decimal.rst:1229 +#: ../../library/decimal.rst:1254 msgid "Compares *x* and *y* numerically." msgstr "" -#: ../../library/decimal.rst:1234 +#: ../../library/decimal.rst:1259 msgid "Compares the values of the two operands numerically." msgstr "" -#: ../../library/decimal.rst:1239 +#: ../../library/decimal.rst:1264 msgid "Compares two operands using their abstract representation." msgstr "" -#: ../../library/decimal.rst:1244 +#: ../../library/decimal.rst:1269 msgid "" "Compares two operands using their abstract representation, ignoring sign." msgstr "" -#: ../../library/decimal.rst:1249 +#: ../../library/decimal.rst:1274 msgid "Returns a copy of *x* with the sign set to 0." msgstr "" -#: ../../library/decimal.rst:1254 +#: ../../library/decimal.rst:1279 msgid "Returns a copy of *x* with the sign inverted." msgstr "" -#: ../../library/decimal.rst:1259 +#: ../../library/decimal.rst:1284 msgid "Copies the sign from *y* to *x*." msgstr "" -#: ../../library/decimal.rst:1264 +#: ../../library/decimal.rst:1289 msgid "Return *x* divided by *y*." msgstr "" -#: ../../library/decimal.rst:1269 +#: ../../library/decimal.rst:1294 msgid "Return *x* divided by *y*, truncated to an integer." msgstr "" -#: ../../library/decimal.rst:1274 +#: ../../library/decimal.rst:1299 msgid "Divides two numbers and returns the integer part of the result." msgstr "" -#: ../../library/decimal.rst:1279 +#: ../../library/decimal.rst:1304 msgid "Returns ``e ** x``." msgstr "" -#: ../../library/decimal.rst:1284 +#: ../../library/decimal.rst:1309 msgid "Returns *x* multiplied by *y*, plus *z*." msgstr "" -#: ../../library/decimal.rst:1289 +#: ../../library/decimal.rst:1314 msgid "Returns ``True`` if *x* is canonical; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1294 +#: ../../library/decimal.rst:1319 msgid "Returns ``True`` if *x* is finite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1299 +#: ../../library/decimal.rst:1324 msgid "Returns ``True`` if *x* is infinite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1304 +#: ../../library/decimal.rst:1329 msgid "Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1309 +#: ../../library/decimal.rst:1334 msgid "" "Returns ``True`` if *x* is a normal number; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1314 +#: ../../library/decimal.rst:1339 msgid "Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1319 +#: ../../library/decimal.rst:1344 msgid "Returns ``True`` if *x* is negative; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1324 +#: ../../library/decimal.rst:1349 msgid "" "Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1329 +#: ../../library/decimal.rst:1354 msgid "Returns ``True`` if *x* is subnormal; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1334 +#: ../../library/decimal.rst:1359 msgid "Returns ``True`` if *x* is a zero; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1339 +#: ../../library/decimal.rst:1364 msgid "Returns the natural (base e) logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1344 +#: ../../library/decimal.rst:1369 msgid "Returns the base 10 logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1349 +#: ../../library/decimal.rst:1374 msgid "Returns the exponent of the magnitude of the operand's MSD." msgstr "" -#: ../../library/decimal.rst:1354 +#: ../../library/decimal.rst:1379 msgid "Applies the logical operation *and* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1359 +#: ../../library/decimal.rst:1384 msgid "Invert all the digits in *x*." msgstr "" -#: ../../library/decimal.rst:1364 +#: ../../library/decimal.rst:1389 msgid "Applies the logical operation *or* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1369 +#: ../../library/decimal.rst:1394 msgid "Applies the logical operation *xor* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1374 +#: ../../library/decimal.rst:1399 msgid "Compares two values numerically and returns the maximum." msgstr "" -#: ../../library/decimal.rst:1379 ../../library/decimal.rst:1389 +#: ../../library/decimal.rst:1404 ../../library/decimal.rst:1414 msgid "Compares the values numerically with their sign ignored." msgstr "" -#: ../../library/decimal.rst:1384 +#: ../../library/decimal.rst:1409 msgid "Compares two values numerically and returns the minimum." msgstr "" -#: ../../library/decimal.rst:1394 +#: ../../library/decimal.rst:1419 msgid "Minus corresponds to the unary prefix minus operator in Python." msgstr "" -#: ../../library/decimal.rst:1399 +#: ../../library/decimal.rst:1424 msgid "Return the product of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1404 +#: ../../library/decimal.rst:1429 msgid "Returns the largest representable number smaller than *x*." msgstr "" -#: ../../library/decimal.rst:1409 +#: ../../library/decimal.rst:1434 msgid "Returns the smallest representable number larger than *x*." msgstr "" -#: ../../library/decimal.rst:1414 +#: ../../library/decimal.rst:1439 msgid "Returns the number closest to *x*, in direction towards *y*." msgstr "" -#: ../../library/decimal.rst:1419 +#: ../../library/decimal.rst:1444 msgid "Reduces *x* to its simplest form." msgstr "" -#: ../../library/decimal.rst:1424 +#: ../../library/decimal.rst:1449 msgid "Returns an indication of the class of *x*." msgstr "" -#: ../../library/decimal.rst:1429 +#: ../../library/decimal.rst:1454 msgid "" "Plus corresponds to the unary prefix plus operator in Python. This " "operation applies the context precision and rounding, so it is *not* an " "identity operation." msgstr "" -#: ../../library/decimal.rst:1436 +#: ../../library/decimal.rst:1461 msgid "Return ``x`` to the power of ``y``, reduced modulo ``modulo`` if given." msgstr "" -#: ../../library/decimal.rst:1438 +#: ../../library/decimal.rst:1463 msgid "" "With two arguments, compute ``x**y``. If ``x`` is negative then ``y`` must " "be integral. The result will be inexact unless ``y`` is integral and the " @@ -1832,42 +1868,42 @@ msgid "" "in the Python version." msgstr "" -#: ../../library/decimal.rst:1444 +#: ../../library/decimal.rst:1469 msgid "" "``Decimal(0) ** Decimal(0)`` results in ``InvalidOperation``, and if " "``InvalidOperation`` is not trapped, then results in ``Decimal('NaN')``." msgstr "" -#: ../../library/decimal.rst:1447 +#: ../../library/decimal.rst:1472 msgid "" -"The C module computes :meth:`power` in terms of the correctly rounded :meth:" -"`exp` and :meth:`ln` functions. The result is well-defined but only \"almost " -"always correctly rounded\"." +"The C module computes :meth:`power` in terms of the correctly " +"rounded :meth:`exp` and :meth:`ln` functions. The result is well-defined but " +"only \"almost always correctly rounded\"." msgstr "" -#: ../../library/decimal.rst:1452 +#: ../../library/decimal.rst:1477 msgid "" "With three arguments, compute ``(x**y) % modulo``. For the three argument " "form, the following restrictions on the arguments hold:" msgstr "" -#: ../../library/decimal.rst:1455 +#: ../../library/decimal.rst:1480 msgid "all three arguments must be integral" msgstr "" -#: ../../library/decimal.rst:1456 +#: ../../library/decimal.rst:1481 msgid "``y`` must be nonnegative" msgstr "" -#: ../../library/decimal.rst:1457 +#: ../../library/decimal.rst:1482 msgid "at least one of ``x`` or ``y`` must be nonzero" msgstr "" -#: ../../library/decimal.rst:1458 +#: ../../library/decimal.rst:1483 msgid "``modulo`` must be nonzero and have at most 'precision' digits" msgstr "" -#: ../../library/decimal.rst:1460 +#: ../../library/decimal.rst:1485 msgid "" "The value resulting from ``Context.power(x, y, modulo)`` is equal to the " "value that would be obtained by computing ``(x**y) % modulo`` with unbounded " @@ -1876,110 +1912,118 @@ msgid "" "result is always exact." msgstr "" -#: ../../library/decimal.rst:1470 +#: ../../library/decimal.rst:1495 msgid "Returns a value equal to *x* (rounded), having the exponent of *y*." msgstr "" -#: ../../library/decimal.rst:1475 +#: ../../library/decimal.rst:1500 msgid "Just returns 10, as this is Decimal, :)" msgstr "" -#: ../../library/decimal.rst:1480 +#: ../../library/decimal.rst:1505 msgid "Returns the remainder from integer division." msgstr "" -#: ../../library/decimal.rst:1482 +#: ../../library/decimal.rst:1507 msgid "" "The sign of the result, if non-zero, is the same as that of the original " "dividend." msgstr "" -#: ../../library/decimal.rst:1488 +#: ../../library/decimal.rst:1513 msgid "" "Returns ``x - y * n``, where *n* is the integer nearest the exact value of " "``x / y`` (if the result is 0 then its sign will be the sign of *x*)." msgstr "" -#: ../../library/decimal.rst:1494 +#: ../../library/decimal.rst:1519 msgid "Returns a rotated copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1499 +#: ../../library/decimal.rst:1524 msgid "Returns ``True`` if the two operands have the same exponent." msgstr "" -#: ../../library/decimal.rst:1504 +#: ../../library/decimal.rst:1529 msgid "Returns the first operand after adding the second value its exp." msgstr "" -#: ../../library/decimal.rst:1509 +#: ../../library/decimal.rst:1534 msgid "Returns a shifted copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1514 +#: ../../library/decimal.rst:1539 msgid "Square root of a non-negative number to context precision." msgstr "" -#: ../../library/decimal.rst:1519 +#: ../../library/decimal.rst:1544 msgid "Return the difference between *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1533 +#: ../../library/decimal.rst:1558 msgid "Rounds to an integer." msgstr "" -#: ../../library/decimal.rst:1538 +#: ../../library/decimal.rst:1563 msgid "Converts a number to a string using scientific notation." msgstr "" -#: ../../library/decimal.rst:1545 +#: ../../library/decimal.rst:1570 msgid "Constants" msgstr "常數" -#: ../../library/decimal.rst:1547 +#: ../../library/decimal.rst:1572 msgid "" "The constants in this section are only relevant for the C module. They are " "also included in the pure Python version for compatibility." msgstr "" -#: ../../library/decimal.rst:1551 +#: ../../library/decimal.rst:1576 msgid "32-bit" msgstr "32 位元" -#: ../../library/decimal.rst:1551 +#: ../../library/decimal.rst:1576 msgid "64-bit" msgstr "64 位元" -#: ../../library/decimal.rst:1553 ../../library/decimal.rst:1555 +#: ../../library/decimal.rst:1578 ../../library/decimal.rst:1580 msgid "``425000000``" msgstr "``425000000``" -#: ../../library/decimal.rst:1553 ../../library/decimal.rst:1555 +#: ../../library/decimal.rst:1578 ../../library/decimal.rst:1580 msgid "``999999999999999999``" msgstr "``999999999999999999``" -#: ../../library/decimal.rst:1557 +#: ../../library/decimal.rst:1582 msgid "``-425000000``" msgstr "``-425000000``" -#: ../../library/decimal.rst:1557 +#: ../../library/decimal.rst:1582 msgid "``-999999999999999999``" msgstr "``-999999999999999999``" -#: ../../library/decimal.rst:1559 +#: ../../library/decimal.rst:1584 msgid "``-849999999``" msgstr "``-849999999``" -#: ../../library/decimal.rst:1559 +#: ../../library/decimal.rst:1584 msgid "``-1999999999999999997``" msgstr "``-1999999999999999997``" -#: ../../library/decimal.rst:1565 +#: ../../library/decimal.rst:1586 +msgid "``256``" +msgstr "" + +#: ../../library/decimal.rst:1586 +msgid "``512``" +msgstr "" + +#: ../../library/decimal.rst:1591 msgid "" "The value is ``True``. Deprecated, because Python now always has threads." msgstr "" -#: ../../library/decimal.rst:1571 +#: ../../library/decimal.rst:1597 msgid "" "The default value is ``True``. If Python is :option:`configured using the --" "without-decimal-contextvar option <--without-decimal-contextvar>`, the C " @@ -1988,55 +2032,55 @@ msgid "" "scenarios." msgstr "" -#: ../../library/decimal.rst:1580 +#: ../../library/decimal.rst:1606 msgid "Rounding modes" msgstr "" -#: ../../library/decimal.rst:1584 +#: ../../library/decimal.rst:1610 msgid "Round towards ``Infinity``." msgstr "" -#: ../../library/decimal.rst:1588 +#: ../../library/decimal.rst:1614 msgid "Round towards zero." msgstr "" -#: ../../library/decimal.rst:1592 +#: ../../library/decimal.rst:1618 msgid "Round towards ``-Infinity``." msgstr "" -#: ../../library/decimal.rst:1596 +#: ../../library/decimal.rst:1622 msgid "Round to nearest with ties going towards zero." msgstr "" -#: ../../library/decimal.rst:1600 +#: ../../library/decimal.rst:1626 msgid "Round to nearest with ties going to nearest even integer." msgstr "" -#: ../../library/decimal.rst:1604 +#: ../../library/decimal.rst:1630 msgid "Round to nearest with ties going away from zero." msgstr "" -#: ../../library/decimal.rst:1608 +#: ../../library/decimal.rst:1634 msgid "Round away from zero." msgstr "" -#: ../../library/decimal.rst:1612 +#: ../../library/decimal.rst:1638 msgid "" "Round away from zero if last digit after rounding towards zero would have " "been 0 or 5; otherwise round towards zero." msgstr "" -#: ../../library/decimal.rst:1619 +#: ../../library/decimal.rst:1645 msgid "Signals" msgstr "" -#: ../../library/decimal.rst:1621 +#: ../../library/decimal.rst:1647 msgid "" "Signals represent conditions that arise during computation. Each corresponds " "to one context flag and one context trap enabler." msgstr "" -#: ../../library/decimal.rst:1624 +#: ../../library/decimal.rst:1650 msgid "" "The context flag is set whenever the condition is encountered. After the " "computation, flags may be checked for informational purposes (for instance, " @@ -2044,62 +2088,62 @@ msgid "" "sure to clear all flags before starting the next computation." msgstr "" -#: ../../library/decimal.rst:1629 +#: ../../library/decimal.rst:1655 msgid "" "If the context's trap enabler is set for the signal, then the condition " -"causes a Python exception to be raised. For example, if the :class:" -"`DivisionByZero` trap is set, then a :exc:`DivisionByZero` exception is " -"raised upon encountering the condition." +"causes a Python exception to be raised. For example, if " +"the :class:`DivisionByZero` trap is set, then a :exc:`DivisionByZero` " +"exception is raised upon encountering the condition." msgstr "" -#: ../../library/decimal.rst:1637 +#: ../../library/decimal.rst:1663 msgid "Altered an exponent to fit representation constraints." msgstr "" -#: ../../library/decimal.rst:1639 +#: ../../library/decimal.rst:1665 msgid "" -"Typically, clamping occurs when an exponent falls outside the context's :" -"attr:`~Context.Emin` and :attr:`~Context.Emax` limits. If possible, the " -"exponent is reduced to fit by adding zeros to the coefficient." +"Typically, clamping occurs when an exponent falls outside the " +"context's :attr:`~Context.Emin` and :attr:`~Context.Emax` limits. If " +"possible, the exponent is reduced to fit by adding zeros to the coefficient." msgstr "" -#: ../../library/decimal.rst:1646 +#: ../../library/decimal.rst:1672 msgid "Base class for other signals and a subclass of :exc:`ArithmeticError`." msgstr "" -#: ../../library/decimal.rst:1651 +#: ../../library/decimal.rst:1677 msgid "Signals the division of a non-infinite number by zero." msgstr "" -#: ../../library/decimal.rst:1653 +#: ../../library/decimal.rst:1679 msgid "" "Can occur with division, modulo division, or when raising a number to a " "negative power. If this signal is not trapped, returns ``Infinity`` or ``-" "Infinity`` with the sign determined by the inputs to the calculation." msgstr "" -#: ../../library/decimal.rst:1660 +#: ../../library/decimal.rst:1686 msgid "Indicates that rounding occurred and the result is not exact." msgstr "" -#: ../../library/decimal.rst:1662 +#: ../../library/decimal.rst:1688 msgid "" "Signals when non-zero digits were discarded during rounding. The rounded " "result is returned. The signal flag or trap is used to detect when results " "are inexact." msgstr "" -#: ../../library/decimal.rst:1669 +#: ../../library/decimal.rst:1695 msgid "An invalid operation was performed." msgstr "" -#: ../../library/decimal.rst:1671 +#: ../../library/decimal.rst:1697 msgid "" "Indicates that an operation was requested that does not make sense. If not " "trapped, returns ``NaN``. Possible causes include::" msgstr "" -#: ../../library/decimal.rst:1674 +#: ../../library/decimal.rst:1700 msgid "" "Infinity - Infinity\n" "0 * Infinity\n" @@ -2121,77 +2165,77 @@ msgstr "" "x ** (non-integer)\n" "x ** Infinity" -#: ../../library/decimal.rst:1687 +#: ../../library/decimal.rst:1713 msgid "Numerical overflow." msgstr "" -#: ../../library/decimal.rst:1689 +#: ../../library/decimal.rst:1715 msgid "" "Indicates the exponent is larger than :attr:`Context.Emax` after rounding " "has occurred. If not trapped, the result depends on the rounding mode, " "either pulling inward to the largest representable finite number or rounding " -"outward to ``Infinity``. In either case, :class:`Inexact` and :class:" -"`Rounded` are also signaled." +"outward to ``Infinity``. In either case, :class:`Inexact` " +"and :class:`Rounded` are also signaled." msgstr "" -#: ../../library/decimal.rst:1698 +#: ../../library/decimal.rst:1724 msgid "Rounding occurred though possibly no information was lost." msgstr "" -#: ../../library/decimal.rst:1700 +#: ../../library/decimal.rst:1726 msgid "" "Signaled whenever rounding discards digits; even if those digits are zero " "(such as rounding ``5.00`` to ``5.0``). If not trapped, returns the result " "unchanged. This signal is used to detect loss of significant digits." msgstr "" -#: ../../library/decimal.rst:1708 +#: ../../library/decimal.rst:1734 msgid "Exponent was lower than :attr:`~Context.Emin` prior to rounding." msgstr "" -#: ../../library/decimal.rst:1710 +#: ../../library/decimal.rst:1736 msgid "" "Occurs when an operation result is subnormal (the exponent is too small). If " "not trapped, returns the result unchanged." msgstr "" -#: ../../library/decimal.rst:1716 +#: ../../library/decimal.rst:1742 msgid "Numerical underflow with result rounded to zero." msgstr "" -#: ../../library/decimal.rst:1718 +#: ../../library/decimal.rst:1744 msgid "" -"Occurs when a subnormal result is pushed to zero by rounding. :class:" -"`Inexact` and :class:`Subnormal` are also signaled." +"Occurs when a subnormal result is pushed to zero by " +"rounding. :class:`Inexact` and :class:`Subnormal` are also signaled." msgstr "" -#: ../../library/decimal.rst:1724 +#: ../../library/decimal.rst:1750 msgid "Enable stricter semantics for mixing floats and Decimals." msgstr "" -#: ../../library/decimal.rst:1726 +#: ../../library/decimal.rst:1752 msgid "" "If the signal is not trapped (default), mixing floats and Decimals is " -"permitted in the :class:`~decimal.Decimal` constructor, :meth:`~decimal." -"Context.create_decimal` and all comparison operators. Both conversion and " -"comparisons are exact. Any occurrence of a mixed operation is silently " -"recorded by setting :exc:`FloatOperation` in the context flags. Explicit " -"conversions with :meth:`~decimal.Decimal.from_float` or :meth:`~decimal." -"Context.create_decimal_from_float` do not set the flag." +"permitted in the :class:`~decimal.Decimal` " +"constructor, :meth:`~decimal.Context.create_decimal` and all comparison " +"operators. Both conversion and comparisons are exact. Any occurrence of a " +"mixed operation is silently recorded by setting :exc:`FloatOperation` in the " +"context flags. Explicit conversions with :meth:`~decimal.Decimal.from_float` " +"or :meth:`~decimal.Context.create_decimal_from_float` do not set the flag." msgstr "" -#: ../../library/decimal.rst:1734 +#: ../../library/decimal.rst:1760 msgid "" "Otherwise (the signal is trapped), only equality comparisons and explicit " -"conversions are silent. All other mixed operations raise :exc:" -"`FloatOperation`." +"conversions are silent. All other mixed operations " +"raise :exc:`FloatOperation`." msgstr "" -#: ../../library/decimal.rst:1738 +#: ../../library/decimal.rst:1764 msgid "The following table summarizes the hierarchy of signals::" msgstr "" -#: ../../library/decimal.rst:1740 +#: ../../library/decimal.rst:1766 msgid "" "exceptions.ArithmeticError(exceptions.Exception)\n" " DecimalException\n" @@ -2217,15 +2261,15 @@ msgstr "" " Subnormal\n" " FloatOperation(DecimalException, exceptions.TypeError)" -#: ../../library/decimal.rst:1759 +#: ../../library/decimal.rst:1785 msgid "Floating-point notes" msgstr "" -#: ../../library/decimal.rst:1763 +#: ../../library/decimal.rst:1789 msgid "Mitigating round-off error with increased precision" msgstr "" -#: ../../library/decimal.rst:1765 +#: ../../library/decimal.rst:1791 msgid "" "The use of decimal floating point eliminates decimal representation error " "(making it possible to represent ``0.1`` exactly); however, some operations " @@ -2233,7 +2277,7 @@ msgid "" "precision." msgstr "" -#: ../../library/decimal.rst:1769 +#: ../../library/decimal.rst:1795 msgid "" "The effects of round-off error can be amplified by the addition or " "subtraction of nearly offsetting quantities resulting in loss of " @@ -2242,7 +2286,7 @@ msgid "" "of the associative and distributive properties of addition:" msgstr "" -#: ../../library/decimal.rst:1775 +#: ../../library/decimal.rst:1801 msgid "" "# Examples from Seminumerical Algorithms, Section 4.2.2.\n" ">>> from decimal import Decimal, getcontext\n" @@ -2261,13 +2305,13 @@ msgid "" "Decimal('0.0060000')" msgstr "" -#: ../../library/decimal.rst:1793 +#: ../../library/decimal.rst:1819 msgid "" "The :mod:`decimal` module makes it possible to restore the identities by " "expanding the precision sufficiently to avoid loss of significance:" msgstr "" -#: ../../library/decimal.rst:1796 +#: ../../library/decimal.rst:1822 msgid "" ">>> getcontext().prec = 20\n" ">>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n" @@ -2283,18 +2327,18 @@ msgid "" "Decimal('0.0060000')" msgstr "" -#: ../../library/decimal.rst:1813 +#: ../../library/decimal.rst:1839 msgid "Special values" msgstr "特殊值" -#: ../../library/decimal.rst:1815 +#: ../../library/decimal.rst:1841 msgid "" "The number system for the :mod:`decimal` module provides special values " "including ``NaN``, ``sNaN``, ``-Infinity``, ``Infinity``, and two zeros, " "``+0`` and ``-0``." msgstr "" -#: ../../library/decimal.rst:1819 +#: ../../library/decimal.rst:1845 msgid "" "Infinities can be constructed directly with: ``Decimal('Infinity')``. Also, " "they can arise from dividing by zero when the :exc:`DivisionByZero` signal " @@ -2303,49 +2347,49 @@ msgid "" "representable number." msgstr "" -#: ../../library/decimal.rst:1824 +#: ../../library/decimal.rst:1850 msgid "" "The infinities are signed (affine) and can be used in arithmetic operations " "where they get treated as very large, indeterminate numbers. For instance, " "adding a constant to infinity gives another infinite result." msgstr "" -#: ../../library/decimal.rst:1828 +#: ../../library/decimal.rst:1854 msgid "" -"Some operations are indeterminate and return ``NaN``, or if the :exc:" -"`InvalidOperation` signal is trapped, raise an exception. For example, " -"``0/0`` returns ``NaN`` which means \"not a number\". This variety of " -"``NaN`` is quiet and, once created, will flow through other computations " +"Some operations are indeterminate and return ``NaN``, or if " +"the :exc:`InvalidOperation` signal is trapped, raise an exception. For " +"example, ``0/0`` returns ``NaN`` which means \"not a number\". This variety " +"of ``NaN`` is quiet and, once created, will flow through other computations " "always resulting in another ``NaN``. This behavior can be useful for a " "series of computations that occasionally have missing inputs --- it allows " "the calculation to proceed while flagging specific results as invalid." msgstr "" -#: ../../library/decimal.rst:1836 +#: ../../library/decimal.rst:1862 msgid "" "A variant is ``sNaN`` which signals rather than remaining quiet after every " "operation. This is a useful return value when an invalid result needs to " "interrupt a calculation for special handling." msgstr "" -#: ../../library/decimal.rst:1840 +#: ../../library/decimal.rst:1866 msgid "" "The behavior of Python's comparison operators can be a little surprising " "where a ``NaN`` is involved. A test for equality where one of the operands " "is a quiet or signaling ``NaN`` always returns :const:`False` (even when " "doing ``Decimal('NaN')==Decimal('NaN')``), while a test for inequality " "always returns :const:`True`. An attempt to compare two Decimals using any " -"of the ``<``, ``<=``, ``>`` or ``>=`` operators will raise the :exc:" -"`InvalidOperation` signal if either operand is a ``NaN``, and return :const:" -"`False` if this signal is not trapped. Note that the General Decimal " -"Arithmetic specification does not specify the behavior of direct " +"of the ``<``, ``<=``, ``>`` or ``>=`` operators will raise " +"the :exc:`InvalidOperation` signal if either operand is a ``NaN``, and " +"return :const:`False` if this signal is not trapped. Note that the General " +"Decimal Arithmetic specification does not specify the behavior of direct " "comparisons; these rules for comparisons involving a ``NaN`` were taken from " "the IEEE 854 standard (see Table 3 in section 5.7). To ensure strict " -"standards-compliance, use the :meth:`~Decimal.compare` and :meth:`~Decimal." -"compare_signal` methods instead." +"standards-compliance, use the :meth:`~Decimal.compare` " +"and :meth:`~Decimal.compare_signal` methods instead." msgstr "" -#: ../../library/decimal.rst:1853 +#: ../../library/decimal.rst:1879 msgid "" "The signed zeros can result from calculations that underflow. They keep the " "sign that would have resulted if the calculation had been carried out to " @@ -2353,7 +2397,7 @@ msgid "" "negative zeros are treated as equal and their sign is informational." msgstr "" -#: ../../library/decimal.rst:1858 +#: ../../library/decimal.rst:1884 msgid "" "In addition to the two signed zeros which are distinct yet equal, there are " "various representations of zero with differing precisions yet equivalent in " @@ -2362,11 +2406,11 @@ msgid "" "that the following calculation returns a value equal to zero:" msgstr "" -#: ../../library/decimal.rst:1873 +#: ../../library/decimal.rst:1899 msgid "Working with threads" msgstr "" -#: ../../library/decimal.rst:1875 +#: ../../library/decimal.rst:1901 msgid "" "The :func:`getcontext` function accesses a different :class:`Context` object " "for each thread. Having separate thread contexts means that threads may " @@ -2374,29 +2418,39 @@ msgid "" "other threads." msgstr "" -#: ../../library/decimal.rst:1879 +#: ../../library/decimal.rst:1905 msgid "" "Likewise, the :func:`setcontext` function automatically assigns its target " "to the current thread." msgstr "" -#: ../../library/decimal.rst:1882 +#: ../../library/decimal.rst:1908 +msgid "" +"If :func:`setcontext` has not been called before :func:`getcontext`, " +"then :func:`getcontext` will automatically create a new context for use in " +"the current thread. New context objects have default values set from " +"the :data:`decimal.DefaultContext` object." +msgstr "" + +#: ../../library/decimal.rst:1913 msgid "" -"If :func:`setcontext` has not been called before :func:`getcontext`, then :" -"func:`getcontext` will automatically create a new context for use in the " -"current thread." +"The :data:`sys.flags.thread_inherit_context` flag affects the context for " +"new threads. If the flag is false, new threads will start with an empty " +"context. In this case, :func:`getcontext` will create a new context object " +"when called and use the default values from *DefaultContext*. If the flag " +"is true, new threads will start with a copy of context from the caller " +"of :meth:`threading.Thread.start`." msgstr "" -#: ../../library/decimal.rst:1886 +#: ../../library/decimal.rst:1920 msgid "" -"The new context is copied from a prototype context called *DefaultContext*. " "To control the defaults so that each thread will use the same values " "throughout the application, directly modify the *DefaultContext* object. " "This should be done *before* any threads are started so that there won't be " "a race condition between threads calling :func:`getcontext`. For example::" msgstr "" -#: ../../library/decimal.rst:1892 +#: ../../library/decimal.rst:1925 msgid "" "# Set applicationwide defaults for all threads about to be launched\n" "DefaultContext.prec = 12\n" @@ -2412,17 +2466,17 @@ msgid "" " . . ." msgstr "" -#: ../../library/decimal.rst:1911 +#: ../../library/decimal.rst:1944 msgid "Recipes" msgstr "" -#: ../../library/decimal.rst:1913 +#: ../../library/decimal.rst:1946 msgid "" "Here are a few recipes that serve as utility functions and that demonstrate " "ways to work with the :class:`Decimal` class::" msgstr "" -#: ../../library/decimal.rst:1916 +#: ../../library/decimal.rst:1949 msgid "" "def moneyfmt(value, places=2, curr='', sep=',', dp='.',\n" " pos='', neg='-', trailneg=''):\n" @@ -2571,41 +2625,41 @@ msgid "" " return +s" msgstr "" -#: ../../library/decimal.rst:2068 +#: ../../library/decimal.rst:2101 msgid "Decimal FAQ" msgstr "" -#: ../../library/decimal.rst:2070 +#: ../../library/decimal.rst:2103 msgid "" "Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way " "to minimize typing when using the interactive interpreter?" msgstr "" -#: ../../library/decimal.rst:2073 +#: ../../library/decimal.rst:2106 msgid "A. Some users abbreviate the constructor to just a single letter:" msgstr "" -#: ../../library/decimal.rst:2079 +#: ../../library/decimal.rst:2112 msgid "" "Q. In a fixed-point application with two decimal places, some inputs have " "many places and need to be rounded. Others are not supposed to have excess " "digits and need to be validated. What methods should be used?" msgstr "" -#: ../../library/decimal.rst:2083 +#: ../../library/decimal.rst:2116 msgid "" "A. The :meth:`~Decimal.quantize` method rounds to a fixed number of decimal " "places. If the :const:`Inexact` trap is set, it is also useful for " "validation:" msgstr "" -#: ../../library/decimal.rst:2101 +#: ../../library/decimal.rst:2134 msgid "" "Q. Once I have valid two place inputs, how do I maintain that invariant " "throughout an application?" msgstr "" -#: ../../library/decimal.rst:2104 +#: ../../library/decimal.rst:2137 msgid "" "A. Some operations like addition, subtraction, and multiplication by an " "integer will automatically preserve fixed point. Others operations, like " @@ -2613,13 +2667,13 @@ msgid "" "places and need to be followed-up with a :meth:`~Decimal.quantize` step:" msgstr "" -#: ../../library/decimal.rst:2122 +#: ../../library/decimal.rst:2155 msgid "" "In developing fixed-point applications, it is convenient to define functions " "to handle the :meth:`~Decimal.quantize` step:" msgstr "" -#: ../../library/decimal.rst:2136 +#: ../../library/decimal.rst:2169 msgid "" "Q. There are many ways to express the same value. The numbers ``200``, " "``200.000``, ``2E2``, and ``.02E+4`` all have the same value at various " @@ -2627,17 +2681,17 @@ msgid "" "canonical value?" msgstr "" -#: ../../library/decimal.rst:2141 +#: ../../library/decimal.rst:2174 msgid "" "A. The :meth:`~Decimal.normalize` method maps all equivalent values to a " "single representative:" msgstr "" -#: ../../library/decimal.rst:2148 +#: ../../library/decimal.rst:2181 msgid "Q. When does rounding occur in a computation?" msgstr "" -#: ../../library/decimal.rst:2150 +#: ../../library/decimal.rst:2183 msgid "" "A. It occurs *after* the computation. The philosophy of the decimal " "specification is that numbers are considered exact and are created " @@ -2647,7 +2701,7 @@ msgid "" "computation::" msgstr "" -#: ../../library/decimal.rst:2157 +#: ../../library/decimal.rst:2190 msgid "" ">>> getcontext().prec = 5\n" ">>> pi = Decimal('3.1415926535') # More than 5 digits\n" @@ -2661,13 +2715,13 @@ msgid "" "Decimal('3.1416')" msgstr "" -#: ../../library/decimal.rst:2168 +#: ../../library/decimal.rst:2201 msgid "" "Q. Some decimal values always print with exponential notation. Is there a " "way to get a non-exponential representation?" msgstr "" -#: ../../library/decimal.rst:2171 +#: ../../library/decimal.rst:2204 msgid "" "A. For some values, exponential notation is the only way to express the " "number of significant places in the coefficient. For example, expressing " @@ -2675,25 +2729,25 @@ msgid "" "original's two-place significance." msgstr "" -#: ../../library/decimal.rst:2176 +#: ../../library/decimal.rst:2209 msgid "" "If an application does not care about tracking significance, it is easy to " "remove the exponent and trailing zeroes, losing significance, but keeping " "the value unchanged:" msgstr "" -#: ../../library/decimal.rst:2186 +#: ../../library/decimal.rst:2219 msgid "Q. Is there a way to convert a regular float to a :class:`Decimal`?" msgstr "" -#: ../../library/decimal.rst:2188 +#: ../../library/decimal.rst:2221 msgid "" "A. Yes, any binary floating-point number can be exactly expressed as a " "Decimal though an exact conversion may take more precision than intuition " "would suggest:" msgstr "" -#: ../../library/decimal.rst:2192 +#: ../../library/decimal.rst:2225 msgid "" ">>> Decimal(math.pi)\n" "Decimal('3.141592653589793115997963468544185161590576171875')" @@ -2701,13 +2755,13 @@ msgstr "" ">>> Decimal(math.pi)\n" "Decimal('3.141592653589793115997963468544185161590576171875')" -#: ../../library/decimal.rst:2197 +#: ../../library/decimal.rst:2230 msgid "" "Q. Within a complex calculation, how can I make sure that I haven't gotten a " "spurious result because of insufficient precision or rounding anomalies." msgstr "" -#: ../../library/decimal.rst:2200 +#: ../../library/decimal.rst:2233 msgid "" "A. The decimal module makes it easy to test results. A best practice is to " "re-run calculations using greater precision and with various rounding modes. " @@ -2715,14 +2769,14 @@ msgid "" "issues, ill-conditioned inputs, or a numerically unstable algorithm." msgstr "" -#: ../../library/decimal.rst:2205 +#: ../../library/decimal.rst:2238 msgid "" "Q. I noticed that context precision is applied to the results of operations " "but not to the inputs. Is there anything to watch out for when mixing " "values of different precisions?" msgstr "" -#: ../../library/decimal.rst:2209 +#: ../../library/decimal.rst:2242 msgid "" "A. Yes. The principle is that all values are considered to be exact and so " "is the arithmetic on those values. Only the results are rounded. The " @@ -2731,7 +2785,7 @@ msgid "" "haven't been rounded:" msgstr "" -#: ../../library/decimal.rst:2214 +#: ../../library/decimal.rst:2247 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.104') + Decimal('2.104')\n" @@ -2745,57 +2799,57 @@ msgstr "" ">>> Decimal('3.104') + Decimal('0.000') + Decimal('2.104')\n" "Decimal('5.20')" -#: ../../library/decimal.rst:2222 +#: ../../library/decimal.rst:2255 msgid "" "The solution is either to increase precision or to force rounding of inputs " "using the unary plus operation:" msgstr "" -#: ../../library/decimal.rst:2225 +#: ../../library/decimal.rst:2258 msgid "" ">>> getcontext().prec = 3\n" ">>> +Decimal('1.23456789') # unary plus triggers rounding\n" "Decimal('1.23')" msgstr "" -#: ../../library/decimal.rst:2231 +#: ../../library/decimal.rst:2264 msgid "" -"Alternatively, inputs can be rounded upon creation using the :meth:`Context." -"create_decimal` method:" +"Alternatively, inputs can be rounded upon creation using " +"the :meth:`Context.create_decimal` method:" msgstr "" -#: ../../library/decimal.rst:2237 +#: ../../library/decimal.rst:2270 msgid "Q. Is the CPython implementation fast for large numbers?" msgstr "" -#: ../../library/decimal.rst:2239 +#: ../../library/decimal.rst:2272 msgid "" "A. Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of " -"the decimal module integrate the high speed `libmpdec `_ library for arbitrary precision " -"correctly rounded decimal floating-point arithmetic [#]_. ``libmpdec`` uses " -"`Karatsuba multiplication `_ library for arbitrary " +"precision correctly rounded decimal floating-point arithmetic [#]_. " +"``libmpdec`` uses `Karatsuba multiplication `_ for medium-sized numbers and the `Number Theoretic " "Transform `_ for very " "large numbers." msgstr "" -#: ../../library/decimal.rst:2249 +#: ../../library/decimal.rst:2282 msgid "" -"The context must be adapted for exact arbitrary precision arithmetic. :attr:" -"`~Context.Emin` and :attr:`~Context.Emax` should always be set to the " -"maximum values, :attr:`~Context.clamp` should always be 0 (the default). " -"Setting :attr:`~Context.prec` requires some care." +"The context must be adapted for exact arbitrary precision " +"arithmetic. :attr:`~Context.Emin` and :attr:`~Context.Emax` should always be " +"set to the maximum values, :attr:`~Context.clamp` should always be 0 (the " +"default). Setting :attr:`~Context.prec` requires some care." msgstr "" -#: ../../library/decimal.rst:2253 +#: ../../library/decimal.rst:2286 msgid "" "The easiest approach for trying out bignum arithmetic is to use the maximum " "value for :attr:`~Context.prec` as well [#]_::" msgstr "" -#: ../../library/decimal.rst:2256 +#: ../../library/decimal.rst:2289 msgid "" ">>> setcontext(Context(prec=MAX_PREC, Emax=MAX_EMAX, Emin=MIN_EMIN))\n" ">>> x = Decimal(2) ** 256\n" @@ -2807,13 +2861,13 @@ msgstr "" ">>> x / 128\n" "Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312')" -#: ../../library/decimal.rst:2262 +#: ../../library/decimal.rst:2295 msgid "" "For inexact results, :const:`MAX_PREC` is far too large on 64-bit platforms " "and the available memory will be insufficient::" msgstr "" -#: ../../library/decimal.rst:2265 +#: ../../library/decimal.rst:2298 msgid "" ">>> Decimal(1) / 3\n" "Traceback (most recent call last):\n" @@ -2825,7 +2879,7 @@ msgstr "" " File \"\", line 1, in \n" "MemoryError" -#: ../../library/decimal.rst:2270 +#: ../../library/decimal.rst:2303 msgid "" "On systems with overallocation (e.g. Linux), a more sophisticated approach " "is to adjust :attr:`~Context.prec` to the amount of available RAM. Suppose " @@ -2833,7 +2887,7 @@ msgid "" "of 500MB each::" msgstr "" -#: ../../library/decimal.rst:2274 +#: ../../library/decimal.rst:2307 msgid "" ">>> import sys\n" ">>>\n" @@ -2857,14 +2911,14 @@ msgid "" " decimal.Inexact: []" msgstr "" -#: ../../library/decimal.rst:2294 +#: ../../library/decimal.rst:2327 msgid "" "In general (and especially on systems without overallocation), it is " "recommended to estimate even tighter bounds and set the :attr:`Inexact` trap " "if all calculations are expected to be exact." msgstr "" -#: ../../library/decimal.rst:2303 +#: ../../library/decimal.rst:2336 msgid "" "This approach now works for all exact results except for non-integer powers." msgstr "" diff --git a/library/dis.po b/library/dis.po index d6ce62924e1..90d5e49e350 100644 --- a/library/dis.po +++ b/library/dis.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-24 05:58+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-07-27 16:55+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -89,10 +89,20 @@ msgid "" msgstr "" #: ../../library/dis.rst:59 +msgid "" +"The :option:`-P ` command-line option and the " +"``show_positions`` argument were added." +msgstr "" + +#: ../../library/dis.rst:63 +msgid "The :option:`-S ` command-line option is added." +msgstr "" + +#: ../../library/dis.rst:65 msgid "Example: Given the function :func:`!myfunc`::" msgstr "" -#: ../../library/dis.rst:61 +#: ../../library/dis.rst:67 msgid "" "def myfunc(alist):\n" " return len(alist)" @@ -100,19 +110,20 @@ msgstr "" "def myfunc(alist):\n" " return len(alist)" -#: ../../library/dis.rst:64 +#: ../../library/dis.rst:70 msgid "" "the following command can be used to display the disassembly of :func:`!" "myfunc`:" msgstr "" -#: ../../library/dis.rst:67 +#: ../../library/dis.rst:73 +#, fuzzy msgid "" ">>> dis.dis(myfunc)\n" " 2 RESUME 0\n" "\n" " 3 LOAD_GLOBAL 1 (len + NULL)\n" -" LOAD_FAST 0 (alist)\n" +" LOAD_FAST_BORROW 0 (alist)\n" " CALL 1\n" " RETURN_VALUE" msgstr "" @@ -124,71 +135,80 @@ msgstr "" " CALL 1\n" " RETURN_VALUE" -#: ../../library/dis.rst:77 +#: ../../library/dis.rst:83 msgid "(The \"2\" is a line number)." msgstr "" -#: ../../library/dis.rst:82 +#: ../../library/dis.rst:88 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/dis.rst:84 +#: ../../library/dis.rst:90 msgid "The :mod:`dis` module can be invoked as a script from the command line:" msgstr "" -#: ../../library/dis.rst:86 -msgid "python -m dis [-h] [-C] [-O] [infile]" +#: ../../library/dis.rst:92 +#, fuzzy +msgid "python -m dis [-h] [-C] [-O] [-P] [-S] [infile]" msgstr "python -m dis [-h] [-C] [-O] [infile]" -#: ../../library/dis.rst:90 +#: ../../library/dis.rst:96 msgid "The following options are accepted:" msgstr "可接受以下選項:" -#: ../../library/dis.rst:96 +#: ../../library/dis.rst:102 msgid "Display usage and exit." msgstr "" -#: ../../library/dis.rst:100 +#: ../../library/dis.rst:106 msgid "Show inline caches." msgstr "" -#: ../../library/dis.rst:106 +#: ../../library/dis.rst:112 msgid "Show offsets of instructions." msgstr "" -#: ../../library/dis.rst:110 +#: ../../library/dis.rst:118 +msgid "Show positions of instructions in the source code." +msgstr "" + +#: ../../library/dis.rst:124 +msgid "Show specialized bytecode." +msgstr "" + +#: ../../library/dis.rst:128 msgid "" "If :file:`infile` is specified, its disassembled code will be written to " "stdout. Otherwise, disassembly is performed on compiled source code received " "from stdin." msgstr "" -#: ../../library/dis.rst:114 +#: ../../library/dis.rst:132 msgid "Bytecode analysis" msgstr "" -#: ../../library/dis.rst:118 +#: ../../library/dis.rst:136 msgid "" "The bytecode analysis API allows pieces of Python code to be wrapped in " "a :class:`Bytecode` object that provides easy access to details of the " "compiled code." msgstr "" -#: ../../library/dis.rst:125 +#: ../../library/dis.rst:144 msgid "" "Analyse the bytecode corresponding to a function, generator, asynchronous " "generator, coroutine, method, string of source code, or a code object (as " "returned by :func:`compile`)." msgstr "" -#: ../../library/dis.rst:129 +#: ../../library/dis.rst:148 msgid "" "This is a convenience wrapper around many of the functions listed below, " "most notably :func:`get_instructions`, as iterating over a :class:`Bytecode` " "instance yields the bytecode operations as :class:`Instruction` instances." msgstr "" -#: ../../library/dis.rst:133 ../../library/dis.rst:330 +#: ../../library/dis.rst:152 ../../library/dis.rst:373 msgid "" "If *first_line* is not ``None``, it indicates the line number that should be " "reported for the first source line in the disassembled code. Otherwise, the " @@ -196,73 +216,91 @@ msgid "" "code object." msgstr "" -#: ../../library/dis.rst:138 +#: ../../library/dis.rst:157 msgid "" "If *current_offset* is not ``None``, it refers to an instruction offset in " "the disassembled code. Setting this means :meth:`.dis` will display a " "\"current instruction\" marker against the specified opcode." msgstr "" -#: ../../library/dis.rst:142 +#: ../../library/dis.rst:161 msgid "" "If *show_caches* is ``True``, :meth:`.dis` will display inline cache entries " "used by the interpreter to specialize the bytecode." msgstr "" -#: ../../library/dis.rst:145 +#: ../../library/dis.rst:164 msgid "" "If *adaptive* is ``True``, :meth:`.dis` will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: ../../library/dis.rst:148 +#: ../../library/dis.rst:167 msgid "" "If *show_offsets* is ``True``, :meth:`.dis` will include instruction offsets " "in the output." msgstr "" -#: ../../library/dis.rst:153 +#: ../../library/dis.rst:170 +msgid "" +"If *show_positions* is ``True``, :meth:`.dis` will include instruction " +"source code positions in the output." +msgstr "" + +#: ../../library/dis.rst:175 msgid "" "Construct a :class:`Bytecode` instance from the given traceback, setting " "*current_offset* to the instruction responsible for the exception." msgstr "" -#: ../../library/dis.rst:158 +#: ../../library/dis.rst:180 msgid "The compiled code object." msgstr "" -#: ../../library/dis.rst:162 +#: ../../library/dis.rst:184 msgid "The first source line of the code object (if available)" msgstr "" -#: ../../library/dis.rst:166 +#: ../../library/dis.rst:188 msgid "" "Return a formatted view of the bytecode operations (the same as printed " "by :func:`dis.dis`, but returned as a multi-line string)." msgstr "" -#: ../../library/dis.rst:171 +#: ../../library/dis.rst:193 msgid "" "Return a formatted multi-line string with detailed information about the " "code object, like :func:`code_info`." msgstr "" -#: ../../library/dis.rst:174 ../../library/dis.rst:214 -#: ../../library/dis.rst:266 +#: ../../library/dis.rst:196 ../../library/dis.rst:242 +#: ../../library/dis.rst:295 msgid "This can now handle coroutine and asynchronous generator objects." msgstr "" -#: ../../library/dis.rst:177 ../../library/dis.rst:269 -#: ../../library/dis.rst:286 ../../library/dis.rst:316 -#: ../../library/dis.rst:339 +#: ../../library/dis.rst:199 ../../library/dis.rst:298 +#: ../../library/dis.rst:320 ../../library/dis.rst:356 +#: ../../library/dis.rst:382 msgid "Added the *show_caches* and *adaptive* parameters." msgstr "新增 *show_caches* 與 *adaptive* 參數。" -#: ../../library/dis.rst:180 +#: ../../library/dis.rst:202 +#, fuzzy +msgid "Added the *show_offsets* parameter" +msgstr "新增 *show_offsets* 參數。" + +#: ../../library/dis.rst:205 ../../library/dis.rst:304 +#: ../../library/dis.rst:326 ../../library/dis.rst:362 +#, fuzzy +msgid "Added the *show_positions* parameter." +msgstr "新增 *show_offsets* 參數。" + +#: ../../library/dis.rst:208 msgid "Example:" msgstr "範例:" -#: ../../library/dis.rst:182 +#: ../../library/dis.rst:210 +#, fuzzy msgid "" ">>> bytecode = dis.Bytecode(myfunc)\n" ">>> for instr in bytecode:\n" @@ -270,7 +308,7 @@ msgid "" "...\n" "RESUME\n" "LOAD_GLOBAL\n" -"LOAD_FAST\n" +"LOAD_FAST_BORROW\n" "CALL\n" "RETURN_VALUE" msgstr "" @@ -284,11 +322,11 @@ msgstr "" "CALL\n" "RETURN_VALUE" -#: ../../library/dis.rst:196 +#: ../../library/dis.rst:224 msgid "Analysis functions" msgstr "分析函式" -#: ../../library/dis.rst:198 +#: ../../library/dis.rst:226 msgid "" "The :mod:`dis` module also defines the following analysis functions that " "convert the input directly to the desired output. They can be useful if only " @@ -296,39 +334,39 @@ msgid "" "isn't useful:" msgstr "" -#: ../../library/dis.rst:204 +#: ../../library/dis.rst:232 msgid "" "Return a formatted multi-line string with detailed code object information " "for the supplied function, generator, asynchronous generator, coroutine, " "method, source code string or code object." msgstr "" -#: ../../library/dis.rst:208 +#: ../../library/dis.rst:236 msgid "" "Note that the exact contents of code info strings are highly implementation " "dependent and they may change arbitrarily across Python VMs or Python " "releases." msgstr "" -#: ../../library/dis.rst:220 +#: ../../library/dis.rst:248 msgid "" "Print detailed code object information for the supplied function, method, " "source code string or code object to *file* (or ``sys.stdout`` if *file* is " "not specified)." msgstr "" -#: ../../library/dis.rst:224 +#: ../../library/dis.rst:252 msgid "" "This is a convenient shorthand for ``print(code_info(x), file=file)``, " "intended for interactive exploration at the interpreter prompt." msgstr "" -#: ../../library/dis.rst:229 ../../library/dis.rst:260 -#: ../../library/dis.rst:283 ../../library/dis.rst:313 +#: ../../library/dis.rst:257 ../../library/dis.rst:289 +#: ../../library/dis.rst:317 ../../library/dis.rst:353 msgid "Added *file* parameter." msgstr "新增 *file* 參數。" -#: ../../library/dis.rst:235 +#: ../../library/dis.rst:264 msgid "" "Disassemble the *x* object. *x* can denote either a module, a class, a " "method, a function, a generator, an asynchronous generator, a coroutine, a " @@ -344,103 +382,107 @@ msgid "" "disassembles the last traceback." msgstr "" -#: ../../library/dis.rst:248 ../../library/dis.rst:280 -#: ../../library/dis.rst:310 +#: ../../library/dis.rst:277 ../../library/dis.rst:314 +#: ../../library/dis.rst:350 msgid "" "The disassembly is written as text to the supplied *file* argument if " "provided and to ``sys.stdout`` otherwise." msgstr "" -#: ../../library/dis.rst:251 +#: ../../library/dis.rst:280 msgid "" "The maximal depth of recursion is limited by *depth* unless it is ``None``. " "``depth=0`` means no recursion." msgstr "" -#: ../../library/dis.rst:254 +#: ../../library/dis.rst:283 msgid "" "If *show_caches* is ``True``, this function will display inline cache " "entries used by the interpreter to specialize the bytecode." msgstr "" -#: ../../library/dis.rst:257 +#: ../../library/dis.rst:286 msgid "" "If *adaptive* is ``True``, this function will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: ../../library/dis.rst:263 +#: ../../library/dis.rst:292 msgid "Implemented recursive disassembling and added *depth* parameter." msgstr "" -#: ../../library/dis.rst:276 +#: ../../library/dis.rst:301 ../../library/dis.rst:323 +#: ../../library/dis.rst:359 +msgid "Added the *show_offsets* parameter." +msgstr "新增 *show_offsets* 參數。" + +#: ../../library/dis.rst:310 msgid "" "Disassemble the top-of-stack function of a traceback, using the last " "traceback if none was passed. The instruction causing the exception is " "indicated." msgstr "" -#: ../../library/dis.rst:289 ../../library/dis.rst:319 -msgid "Added the *show_offsets* parameter." -msgstr "新增 *show_offsets* 參數。" - -#: ../../library/dis.rst:296 +#: ../../library/dis.rst:334 msgid "" "Disassemble a code object, indicating the last instruction if *lasti* was " "provided. The output is divided in the following columns:" msgstr "" -#: ../../library/dis.rst:299 -msgid "the line number, for the first instruction of each line" +#: ../../library/dis.rst:337 +msgid "" +"the source code location of the instruction. Complete location information " +"is shown if *show_positions* is true. Otherwise (the default) only the line " +"number is displayed." msgstr "" -#: ../../library/dis.rst:300 +#: ../../library/dis.rst:340 msgid "the current instruction, indicated as ``-->``," msgstr "" -#: ../../library/dis.rst:301 +#: ../../library/dis.rst:341 msgid "a labelled instruction, indicated with ``>>``," msgstr "" -#: ../../library/dis.rst:302 +#: ../../library/dis.rst:342 msgid "the address of the instruction," msgstr "" -#: ../../library/dis.rst:303 +#: ../../library/dis.rst:343 msgid "the operation code name," msgstr "" -#: ../../library/dis.rst:304 +#: ../../library/dis.rst:344 msgid "operation parameters, and" msgstr "" -#: ../../library/dis.rst:305 +#: ../../library/dis.rst:345 msgid "interpretation of the parameters in parentheses." msgstr "" -#: ../../library/dis.rst:307 +#: ../../library/dis.rst:347 msgid "" "The parameter interpretation recognizes local and global variable names, " "constant values, branch targets, and compare operators." msgstr "" -#: ../../library/dis.rst:324 +#: ../../library/dis.rst:367 msgid "" "Return an iterator over the instructions in the supplied function, method, " "source code string or code object." msgstr "" -#: ../../library/dis.rst:327 +#: ../../library/dis.rst:370 msgid "" "The iterator generates a series of :class:`Instruction` named tuples giving " "the details of each operation in the supplied code." msgstr "" -#: ../../library/dis.rst:335 +#: ../../library/dis.rst:378 msgid "The *adaptive* parameter works as it does in :func:`dis`." msgstr "" -#: ../../library/dis.rst:342 +#: ../../library/dis.rst:385 msgid "" "The *show_caches* parameter is deprecated and has no effect. The iterator " "generates the :class:`Instruction` instances with the *cache_info* field " @@ -448,7 +490,7 @@ msgid "" "generates separate items for the cache entries." msgstr "" -#: ../../library/dis.rst:350 +#: ../../library/dis.rst:393 msgid "" "This generator function uses the :meth:`~codeobject.co_lines` method of " "the :ref:`code object ` *code* to find the offsets which are " @@ -456,33 +498,33 @@ msgid "" "lineno)`` pairs." msgstr "" -#: ../../library/dis.rst:355 +#: ../../library/dis.rst:398 msgid "Line numbers can be decreasing. Before, they were always increasing." msgstr "" -#: ../../library/dis.rst:358 +#: ../../library/dis.rst:401 msgid "" "The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of " "the :attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " "attributes of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:363 +#: ../../library/dis.rst:406 msgid "" "Line numbers can be ``None`` for bytecode that does not map to source lines." msgstr "" -#: ../../library/dis.rst:369 +#: ../../library/dis.rst:412 msgid "" "Detect all offsets in the raw compiled bytecode string *code* which are jump " "targets, and return a list of these offsets." msgstr "" -#: ../../library/dis.rst:375 +#: ../../library/dis.rst:418 msgid "Compute the stack effect of *opcode* with argument *oparg*." msgstr "" -#: ../../library/dis.rst:377 +#: ../../library/dis.rst:420 msgid "" "If the code has a jump target and *jump* is ``True``, :func:`~stack_effect` " "will return the stack effect of jumping. If *jump* is ``False``, it will " @@ -490,11 +532,11 @@ msgid "" "it will return the maximal stack effect of both cases." msgstr "" -#: ../../library/dis.rst:384 +#: ../../library/dis.rst:427 msgid "Added *jump* parameter." msgstr "新增 *jump* 參數。" -#: ../../library/dis.rst:387 +#: ../../library/dis.rst:430 msgid "" "If ``oparg`` is omitted (or ``None``), the stack effect is now returned for " "``oparg=0``. Previously this was an error for opcodes that use their arg. It " @@ -502,104 +544,104 @@ msgid "" "does not use it; the ``oparg`` in this case is ignored." msgstr "" -#: ../../library/dis.rst:397 +#: ../../library/dis.rst:440 msgid "Python Bytecode Instructions" msgstr "Python 位元組碼指令" -#: ../../library/dis.rst:399 +#: ../../library/dis.rst:442 msgid "" "The :func:`get_instructions` function and :class:`Bytecode` class provide " "details of bytecode instructions as :class:`Instruction` instances:" msgstr "" -#: ../../library/dis.rst:404 +#: ../../library/dis.rst:447 msgid "Details for a bytecode operation" msgstr "位元組碼操作的詳細資訊" -#: ../../library/dis.rst:408 +#: ../../library/dis.rst:451 msgid "" "numeric code for operation, corresponding to the opcode values listed below " "and the bytecode values in the :ref:`opcode_collections`." msgstr "" -#: ../../library/dis.rst:414 +#: ../../library/dis.rst:457 msgid "human readable name for operation" msgstr "操作的可讀名稱" -#: ../../library/dis.rst:419 +#: ../../library/dis.rst:462 msgid "" "numeric code for the base operation if operation is specialized; otherwise " "equal to :data:`opcode`" msgstr "" -#: ../../library/dis.rst:425 +#: ../../library/dis.rst:468 msgid "" "human readable name for the base operation if operation is specialized; " "otherwise equal to :data:`opname`" msgstr "" -#: ../../library/dis.rst:431 +#: ../../library/dis.rst:474 msgid "numeric argument to operation (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:435 +#: ../../library/dis.rst:478 msgid "alias for :data:`arg`" msgstr ":data:`arg` 的別名。" -#: ../../library/dis.rst:439 +#: ../../library/dis.rst:482 msgid "resolved arg value (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:444 +#: ../../library/dis.rst:487 msgid "" "human readable description of operation argument (if any), otherwise an " "empty string." msgstr "" -#: ../../library/dis.rst:450 +#: ../../library/dis.rst:493 msgid "start index of operation within bytecode sequence" msgstr "" -#: ../../library/dis.rst:455 +#: ../../library/dis.rst:498 msgid "" "start index of operation within bytecode sequence, including prefixed " "``EXTENDED_ARG`` operations if present; otherwise equal to :data:`offset`" msgstr "" -#: ../../library/dis.rst:461 +#: ../../library/dis.rst:504 msgid "start index of the cache entries following the operation" msgstr "" -#: ../../library/dis.rst:466 +#: ../../library/dis.rst:509 msgid "end index of the cache entries following the operation" msgstr "" -#: ../../library/dis.rst:471 +#: ../../library/dis.rst:514 msgid "``True`` if this opcode starts a source line, otherwise ``False``" msgstr "" -#: ../../library/dis.rst:476 +#: ../../library/dis.rst:519 msgid "" "source line number associated with this opcode (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:481 +#: ../../library/dis.rst:524 msgid "``True`` if other code jumps to here, otherwise ``False``" msgstr "" -#: ../../library/dis.rst:486 +#: ../../library/dis.rst:529 msgid "" "bytecode index of the jump target if this is a jump operation, otherwise " "``None``" msgstr "" -#: ../../library/dis.rst:492 +#: ../../library/dis.rst:535 msgid "" ":class:`dis.Positions` object holding the start and end locations that are " "covered by this instruction." msgstr "" -#: ../../library/dis.rst:497 +#: ../../library/dis.rst:540 msgid "" "Information about the cache entries of this instruction, as triplets of the " "form ``(name, size, data)``, where the ``name`` and ``size`` describe the " @@ -607,73 +649,73 @@ msgid "" "``None`` if the instruction does not have caches." msgstr "" -#: ../../library/dis.rst:507 +#: ../../library/dis.rst:550 msgid "Field ``positions`` is added." msgstr "" -#: ../../library/dis.rst:511 +#: ../../library/dis.rst:554 msgid "Changed field ``starts_line``." msgstr "" -#: ../../library/dis.rst:513 +#: ../../library/dis.rst:556 msgid "" "Added fields ``start_offset``, ``cache_offset``, ``end_offset``, " "``baseopname``, ``baseopcode``, ``jump_target``, ``oparg``, ``line_number`` " "and ``cache_info``." msgstr "" -#: ../../library/dis.rst:520 +#: ../../library/dis.rst:563 msgid "" "In case the information is not available, some fields might be ``None``." msgstr "" -#: ../../library/dis.rst:530 +#: ../../library/dis.rst:573 msgid "" "The Python compiler currently generates the following bytecode instructions." msgstr "" -#: ../../library/dis.rst:533 +#: ../../library/dis.rst:576 msgid "**General instructions**" msgstr "**一般指令**" -#: ../../library/dis.rst:535 +#: ../../library/dis.rst:578 msgid "" "In the following, We will refer to the interpreter stack as ``STACK`` and " "describe operations on it as if it was a Python list. The top of the stack " "corresponds to ``STACK[-1]`` in this language." msgstr "" -#: ../../library/dis.rst:541 +#: ../../library/dis.rst:584 msgid "" "Do nothing code. Used as a placeholder by the bytecode optimizer, and to " "generate line tracing events." msgstr "" -#: ../../library/dis.rst:547 +#: ../../library/dis.rst:590 msgid "Removes the top-of-stack item::" msgstr "" -#: ../../library/dis.rst:549 +#: ../../library/dis.rst:592 msgid "STACK.pop()" msgstr "STACK.pop()" -#: ../../library/dis.rst:554 +#: ../../library/dis.rst:597 msgid "" "Removes the top-of-stack item. Equivalent to ``POP_TOP``. Used to clean up " "at the end of loops, hence the name." msgstr "" -#: ../../library/dis.rst:563 +#: ../../library/dis.rst:606 msgid "Implements ``del STACK[-2]``. Used to clean up when a generator exits." msgstr "" -#: ../../library/dis.rst:571 +#: ../../library/dis.rst:614 msgid "" "Push the i-th item to the top of the stack without removing it from its " "original location::" msgstr "" -#: ../../library/dis.rst:574 +#: ../../library/dis.rst:617 msgid "" "assert i > 0\n" "STACK.append(STACK[-i])" @@ -681,15 +723,15 @@ msgstr "" "assert i > 0\n" "STACK.append(STACK[-i])" -#: ../../library/dis.rst:582 +#: ../../library/dis.rst:625 msgid "Swap the top of the stack with the i-th element::" msgstr "" -#: ../../library/dis.rst:584 +#: ../../library/dis.rst:627 msgid "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" msgstr "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" -#: ../../library/dis.rst:591 +#: ../../library/dis.rst:634 msgid "" "Rather than being an actual instruction, this opcode is used to mark extra " "space for the interpreter to cache useful data directly in the bytecode " @@ -697,86 +739,86 @@ msgid "" "viewed with ``show_caches=True``." msgstr "" -#: ../../library/dis.rst:596 +#: ../../library/dis.rst:639 msgid "" "Logically, this space is part of the preceding instruction. Many opcodes " "expect to be followed by an exact number of caches, and will instruct the " "interpreter to skip over them at runtime." msgstr "" -#: ../../library/dis.rst:600 +#: ../../library/dis.rst:643 msgid "" "Populated caches can look like arbitrary instructions, so great care should " "be taken when reading or modifying raw, adaptive bytecode containing " "quickened data." msgstr "" -#: ../../library/dis.rst:607 +#: ../../library/dis.rst:650 msgid "**Unary operations**" msgstr "" -#: ../../library/dis.rst:609 +#: ../../library/dis.rst:652 msgid "" "Unary operations take the top of the stack, apply the operation, and push " "the result back on the stack." msgstr "" -#: ../../library/dis.rst:615 +#: ../../library/dis.rst:658 msgid "Implements ``STACK[-1] = -STACK[-1]``." msgstr "實作 ``STACK[-1] = -STACK[-1]``。" -#: ../../library/dis.rst:620 +#: ../../library/dis.rst:663 msgid "Implements ``STACK[-1] = not STACK[-1]``." msgstr "實作 ``STACK[-1] = not STACK[-1]``。" -#: ../../library/dis.rst:622 ../../library/dis.rst:1318 -#: ../../library/dis.rst:1334 +#: ../../library/dis.rst:665 ../../library/dis.rst:1367 +#: ../../library/dis.rst:1383 msgid "This instruction now requires an exact :class:`bool` operand." msgstr "" -#: ../../library/dis.rst:628 +#: ../../library/dis.rst:671 msgid "Implements ``STACK[-1] = ~STACK[-1]``." msgstr "實作 ``STACK[-1] = ~STACK[-1]``。" -#: ../../library/dis.rst:633 +#: ../../library/dis.rst:676 msgid "Implements ``STACK[-1] = iter(STACK[-1])``." msgstr "實作 ``STACK[-1] = iter(STACK[-1])``。" -#: ../../library/dis.rst:638 +#: ../../library/dis.rst:681 msgid "" "If ``STACK[-1]`` is a :term:`generator iterator` or :term:`coroutine` object " "it is left as is. Otherwise, implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:646 +#: ../../library/dis.rst:689 msgid "Implements ``STACK[-1] = bool(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:651 +#: ../../library/dis.rst:694 msgid "**Binary and in-place operations**" msgstr "" -#: ../../library/dis.rst:653 +#: ../../library/dis.rst:696 msgid "" "Binary operations remove the top two items from the stack (``STACK[-1]`` and " "``STACK[-2]``). They perform the operation, then put the result back on the " "stack." msgstr "" -#: ../../library/dis.rst:656 +#: ../../library/dis.rst:699 msgid "" "In-place operations are like binary operations, but the operation is done in-" "place when ``STACK[-2]`` supports it, and the resulting ``STACK[-1]`` may be " "(but does not have to be) the original ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:663 +#: ../../library/dis.rst:706 msgid "" "Implements the binary and in-place operators (depending on the value of " "*op*)::" msgstr "" -#: ../../library/dis.rst:666 +#: ../../library/dis.rst:709 msgid "" "rhs = STACK.pop()\n" "lhs = STACK.pop()\n" @@ -786,27 +828,22 @@ msgstr "" "lhs = STACK.pop()\n" "STACK.append(lhs op rhs)" -#: ../../library/dis.rst:675 ../../library/dis.rst:684 -#: ../../library/dis.rst:694 ../../library/dis.rst:702 -#: ../../library/dis.rst:714 ../../library/dis.rst:802 -#: ../../library/dis.rst:812 ../../library/dis.rst:822 -#: ../../library/dis.rst:1046 ../../library/dis.rst:1057 -#: ../../library/dis.rst:1161 ../../library/dis.rst:1173 -#: ../../library/dis.rst:1185 -msgid "Implements::" +#: ../../library/dis.rst:714 +msgid "" +"With oparg :``NB_SUBSCR``, implements binary subscript (replaces opcode " +"``BINARY_SUBSCR``)" msgstr "" -#: ../../library/dis.rst:677 -msgid "" -"key = STACK.pop()\n" -"container = STACK.pop()\n" -"STACK.append(container[key])" +#: ../../library/dis.rst:720 ../../library/dis.rst:730 +#: ../../library/dis.rst:738 ../../library/dis.rst:750 +#: ../../library/dis.rst:828 ../../library/dis.rst:838 +#: ../../library/dis.rst:848 ../../library/dis.rst:1054 +#: ../../library/dis.rst:1065 ../../library/dis.rst:1210 +#: ../../library/dis.rst:1222 ../../library/dis.rst:1234 +msgid "Implements::" msgstr "" -"key = STACK.pop()\n" -"container = STACK.pop()\n" -"STACK.append(container[key])" -#: ../../library/dis.rst:686 +#: ../../library/dis.rst:722 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -818,7 +855,7 @@ msgstr "" "value = STACK.pop()\n" "container[key] = value" -#: ../../library/dis.rst:696 +#: ../../library/dis.rst:732 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -828,7 +865,7 @@ msgstr "" "container = STACK.pop()\n" "del container[key]" -#: ../../library/dis.rst:704 +#: ../../library/dis.rst:740 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -840,7 +877,7 @@ msgstr "" "container = STACK.pop()\n" "STACK.append(container[start:end])" -#: ../../library/dis.rst:716 +#: ../../library/dis.rst:752 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -854,11 +891,11 @@ msgstr "" "values = STACK.pop()\n" "container[start:end] = value" -#: ../../library/dis.rst:725 +#: ../../library/dis.rst:761 msgid "**Coroutine opcodes**" msgstr "" -#: ../../library/dis.rst:729 +#: ../../library/dis.rst:765 msgid "" "Implements ``STACK[-1] = get_awaitable(STACK[-1])``, where " "``get_awaitable(o)`` returns ``o`` if ``o`` is a coroutine object or a " @@ -866,39 +903,39 @@ msgid "" "resolves ``o.__await__``." msgstr "" -#: ../../library/dis.rst:734 +#: ../../library/dis.rst:770 msgid "" "If the ``where`` operand is nonzero, it indicates where the instruction " "occurs:" msgstr "" -#: ../../library/dis.rst:737 +#: ../../library/dis.rst:773 msgid "``1``: After a call to ``__aenter__``" msgstr "" -#: ../../library/dis.rst:738 +#: ../../library/dis.rst:774 msgid "``2``: After a call to ``__aexit__``" msgstr "" -#: ../../library/dis.rst:742 +#: ../../library/dis.rst:778 msgid "Previously, this instruction did not have an oparg." msgstr "" -#: ../../library/dis.rst:748 +#: ../../library/dis.rst:784 msgid "Implements ``STACK[-1] = STACK[-1].__aiter__()``." msgstr "" -#: ../../library/dis.rst:751 +#: ../../library/dis.rst:787 msgid "Returning awaitable objects from ``__aiter__`` is no longer supported." msgstr "" -#: ../../library/dis.rst:758 +#: ../../library/dis.rst:794 msgid "" "Implement ``STACK.append(get_awaitable(STACK[-1].__anext__()))`` to the " "stack. See ``GET_AWAITABLE`` for details about ``get_awaitable``." msgstr "" -#: ../../library/dis.rst:766 +#: ../../library/dis.rst:802 msgid "" "Terminates an :keyword:`async for` loop. Handles an exception raised when " "awaiting a next item. The stack contains the async iterable in ``STACK[-2]`` " @@ -906,13 +943,13 @@ msgid "" "is not :exc:`StopAsyncIteration`, it is re-raised." msgstr "" -#: ../../library/dis.rst:773 ../../library/dis.rst:881 -#: ../../library/dis.rst:892 +#: ../../library/dis.rst:809 ../../library/dis.rst:900 +#: ../../library/dis.rst:911 msgid "" "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:779 +#: ../../library/dis.rst:815 msgid "" "Handles an exception raised during a :meth:`~generator.throw` " "or :meth:`~generator.close` call through the current frame. If " @@ -920,21 +957,11 @@ msgid "" "the stack and push its ``value`` member. Otherwise, re-raise ``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:789 -msgid "" -"Resolves ``__aenter__`` and ``__aexit__`` from ``STACK[-1]``. Pushes " -"``__aexit__`` and result of ``__aenter__()`` to the stack::" -msgstr "" - -#: ../../library/dis.rst:792 -msgid "STACK.extend((__aexit__, __aenter__())" -msgstr "STACK.extend((__aexit__, __aenter__())" - -#: ../../library/dis.rst:798 +#: ../../library/dis.rst:824 msgid "**Miscellaneous opcodes**" msgstr "" -#: ../../library/dis.rst:804 +#: ../../library/dis.rst:830 msgid "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" @@ -942,11 +969,11 @@ msgstr "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" -#: ../../library/dis.rst:807 +#: ../../library/dis.rst:833 msgid "Used to implement set comprehensions." msgstr "" -#: ../../library/dis.rst:814 +#: ../../library/dis.rst:840 msgid "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" @@ -954,11 +981,11 @@ msgstr "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" -#: ../../library/dis.rst:817 +#: ../../library/dis.rst:843 msgid "Used to implement list comprehensions." msgstr "" -#: ../../library/dis.rst:824 +#: ../../library/dis.rst:850 msgid "" "value = STACK.pop()\n" "key = STACK.pop()\n" @@ -968,17 +995,17 @@ msgstr "" "key = STACK.pop()\n" "dict.__setitem__(STACK[-i], key, value)" -#: ../../library/dis.rst:828 +#: ../../library/dis.rst:854 msgid "Used to implement dict comprehensions." msgstr "" -#: ../../library/dis.rst:831 +#: ../../library/dis.rst:857 msgid "" "Map value is ``STACK[-1]`` and map key is ``STACK[-2]``. Before, those were " "reversed." msgstr "" -#: ../../library/dis.rst:835 +#: ../../library/dis.rst:861 msgid "" "For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` " "and :opcode:`MAP_ADD` instructions, while the added value or key/value pair " @@ -986,35 +1013,31 @@ msgid "" "available for further iterations of the loop." msgstr "" -#: ../../library/dis.rst:843 +#: ../../library/dis.rst:869 msgid "Returns with ``STACK[-1]`` to the caller of the function." msgstr "" -#: ../../library/dis.rst:848 -msgid "Returns with ``co_consts[consti]`` to the caller of the function." -msgstr "" - -#: ../../library/dis.rst:855 +#: ../../library/dis.rst:874 msgid "Yields ``STACK.pop()`` from a :term:`generator`." msgstr "" -#: ../../library/dis.rst:857 +#: ../../library/dis.rst:876 msgid "oparg set to be the stack depth." msgstr "" -#: ../../library/dis.rst:860 +#: ../../library/dis.rst:879 msgid "" "oparg set to be the exception block depth, for efficient closing of " "generators." msgstr "" -#: ../../library/dis.rst:863 +#: ../../library/dis.rst:882 msgid "" "oparg is ``1`` if this instruction is part of a yield-from or await, and " "``0`` otherwise." msgstr "" -#: ../../library/dis.rst:869 +#: ../../library/dis.rst:888 msgid "" "Checks whether ``__annotations__`` is defined in ``locals()``, if not it is " "set up to an empty ``dict``. This opcode is only emitted if a class or " @@ -1022,39 +1045,39 @@ msgid "" "statically." msgstr "" -#: ../../library/dis.rst:879 +#: ../../library/dis.rst:898 msgid "" "Pops a value from the stack, which is used to restore the exception state." msgstr "" -#: ../../library/dis.rst:886 +#: ../../library/dis.rst:905 msgid "" "Re-raises the exception currently on top of the stack. If oparg is non-zero, " "pops an additional value from the stack which is used to " "set :attr:`~frame.f_lasti` of the current frame." msgstr "" -#: ../../library/dis.rst:897 +#: ../../library/dis.rst:916 msgid "" "Pops a value from the stack. Pushes the current exception to the top of the " "stack. Pushes the value originally popped back to the stack. Used in " "exception handlers." msgstr "" -#: ../../library/dis.rst:905 +#: ../../library/dis.rst:924 msgid "" "Performs exception matching for ``except``. Tests whether the ``STACK[-2]`` " "is an exception matching ``STACK[-1]``. Pops ``STACK[-1]`` and pushes the " "boolean result of the test." msgstr "" -#: ../../library/dis.rst:913 +#: ../../library/dis.rst:932 msgid "" "Performs exception matching for ``except*``. Applies ``split(STACK[-1])`` on " "the exception group representing ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:916 +#: ../../library/dis.rst:935 msgid "" "In case of a match, pops two items from the stack and pushes the non-" "matching subgroup (``None`` in case of full match) followed by the matching " @@ -1062,7 +1085,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/dis.rst:925 +#: ../../library/dis.rst:944 msgid "" "Calls the function in position 4 on the stack with arguments (type, val, tb) " "representing the exception at the top of the stack. Used to implement the " @@ -1070,40 +1093,32 @@ msgid "" "occurred in a :keyword:`with` statement." msgstr "" -#: ../../library/dis.rst:932 +#: ../../library/dis.rst:951 msgid "" "The ``__exit__`` function is in position 4 of the stack rather than 7. " "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:939 +#: ../../library/dis.rst:958 msgid "" -"Pushes :exc:`AssertionError` onto the stack. Used by the :keyword:`assert` " -"statement." +"Pushes a common constant onto the stack. The interpreter contains a " +"hardcoded list of constants supported by this instruction. Used by " +"the :keyword:`assert` statement to load :exc:`AssertionError`." msgstr "" -#: ../../library/dis.rst:947 +#: ../../library/dis.rst:967 msgid "" "Pushes :func:`!builtins.__build_class__` onto the stack. It is later called " "to construct a class." msgstr "" -#: ../../library/dis.rst:953 -msgid "" -"This opcode performs several operations before a with block starts. First, " -"it loads :meth:`~object.__exit__` from the context manager and pushes it " -"onto the stack for later use by :opcode:`WITH_EXCEPT_START`. " -"Then, :meth:`~object.__enter__` is called. Finally, the result of calling " -"the ``__enter__()`` method is pushed onto the stack." -msgstr "" - -#: ../../library/dis.rst:964 +#: ../../library/dis.rst:972 msgid "" "Perform ``STACK.append(len(STACK[-1]))``. Used in :keyword:`match` " "statements where comparison with structure of pattern is needed." msgstr "" -#: ../../library/dis.rst:972 +#: ../../library/dis.rst:980 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Mapping` (or, " "more technically: if it has the :c:macro:`Py_TPFLAGS_MAPPING` flag set in " @@ -1111,7 +1126,7 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:982 +#: ../../library/dis.rst:990 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Sequence` and is " "*not* an instance of :class:`str`/:class:`bytes`/:class:`bytearray` (or, " @@ -1120,7 +1135,7 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:992 +#: ../../library/dis.rst:1000 msgid "" "``STACK[-1]`` is a tuple of mapping keys, and ``STACK[-2]`` is the match " "subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push " @@ -1128,13 +1143,13 @@ msgid "" "``None``." msgstr "" -#: ../../library/dis.rst:998 ../../library/dis.rst:1684 +#: ../../library/dis.rst:1006 ../../library/dis.rst:1748 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." msgstr "" -#: ../../library/dis.rst:1005 +#: ../../library/dis.rst:1013 msgid "" "Implements ``name = STACK.pop()``. *namei* is the index of *name* in the " "attribute :attr:`~codeobject.co_names` of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:1018 +#: ../../library/dis.rst:1026 msgid "" "Unpacks ``STACK[-1]`` into *count* individual values, which are put onto the " "stack right-to-left. Require there to be exactly *count* values.::" msgstr "" -#: ../../library/dis.rst:1021 +#: ../../library/dis.rst:1029 msgid "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" @@ -1163,7 +1178,7 @@ msgstr "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" -#: ../../library/dis.rst:1027 +#: ../../library/dis.rst:1035 msgid "" "Implements assignment with a starred target: Unpacks an iterable in " "``STACK[-1]`` into individual values, where the total number of values can " @@ -1171,11 +1186,11 @@ msgid "" "will be a list of all leftover items." msgstr "" -#: ../../library/dis.rst:1032 +#: ../../library/dis.rst:1040 msgid "The number of values before and after the list value is limited to 255." msgstr "" -#: ../../library/dis.rst:1034 +#: ../../library/dis.rst:1042 msgid "" "The number of values before the list value is encoded in the argument of the " "opcode. The number of values after the list if any is encoded using an " @@ -1184,13 +1199,13 @@ msgid "" "list value, the high byte of *counts* the number of values after it." msgstr "" -#: ../../library/dis.rst:1040 +#: ../../library/dis.rst:1048 msgid "" "The extracted values are put onto the stack right-to-left, i.e. ``a, *b, c = " "d`` will be stored after execution as ``STACK.extend((a, b, c))``." msgstr "" -#: ../../library/dis.rst:1048 +#: ../../library/dis.rst:1056 msgid "" "obj = STACK.pop()\n" "value = STACK.pop()\n" @@ -1200,13 +1215,13 @@ msgstr "" "value = STACK.pop()\n" "obj.name = value" -#: ../../library/dis.rst:1052 +#: ../../library/dis.rst:1060 msgid "" "where *namei* is the index of name in :attr:`~codeobject.co_names` of " "the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:1059 +#: ../../library/dis.rst:1067 msgid "" "obj = STACK.pop()\n" "del obj.name" @@ -1214,38 +1229,43 @@ msgstr "" "obj = STACK.pop()\n" "del obj.name" -#: ../../library/dis.rst:1062 +#: ../../library/dis.rst:1070 msgid "" "where *namei* is the index of name into :attr:`~codeobject.co_names` of " "the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:1068 +#: ../../library/dis.rst:1076 msgid "Works as :opcode:`STORE_NAME`, but stores the name as a global." msgstr "" -#: ../../library/dis.rst:1073 +#: ../../library/dis.rst:1081 msgid "Works as :opcode:`DELETE_NAME`, but deletes a global name." msgstr "" -#: ../../library/dis.rst:1078 +#: ../../library/dis.rst:1086 msgid "Pushes ``co_consts[consti]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1083 +#: ../../library/dis.rst:1091 +msgid "" +"Pushes the integer ``i`` onto the stack. ``i`` must be in ``range(256)``" +msgstr "" + +#: ../../library/dis.rst:1099 msgid "" "Pushes the value associated with ``co_names[namei]`` onto the stack. The " "name is looked up within the locals, then the globals, then the builtins." msgstr "" -#: ../../library/dis.rst:1089 +#: ../../library/dis.rst:1105 msgid "" "Pushes a reference to the locals dictionary onto the stack. This is used to " "prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` " "and :opcode:`LOAD_FROM_DICT_OR_GLOBALS`." msgstr "" -#: ../../library/dis.rst:1098 +#: ../../library/dis.rst:1114 msgid "" "Pops a mapping off the stack and looks up the value for ``co_names[namei]``. " "If the name is not found there, looks it up in the globals and then the " @@ -1254,13 +1274,71 @@ msgid "" "bodies." msgstr "" -#: ../../library/dis.rst:1109 +#: ../../library/dis.rst:1125 +msgid "" +"Constructs a new :class:`~string.templatelib.Template` instance from a tuple " +"of strings and a tuple of interpolations and pushes the resulting object " +"onto the stack::" +msgstr "" + +#: ../../library/dis.rst:1129 +#, fuzzy +msgid "" +"interpolations = STACK.pop()\n" +"strings = STACK.pop()\n" +"STACK.append(_build_template(strings, interpolations))" +msgstr "" +"step = STACK.pop()\n" +"end = STACK.pop()\n" +"start = STACK.pop()\n" +"STACK.append(slice(start, end, step))" + +#: ../../library/dis.rst:1138 +msgid "" +"Constructs a new :class:`~string.templatelib.Interpolation` instance from a " +"value and its source expression and pushes the resulting object onto the " +"stack." +msgstr "" + +#: ../../library/dis.rst:1142 +msgid "" +"If no conversion or format specification is present, ``format`` is set to " +"``2``." +msgstr "" + +#: ../../library/dis.rst:1145 +msgid "" +"If the low bit of ``format`` is set, it indicates that the interpolation " +"contains a format specification." +msgstr "" + +#: ../../library/dis.rst:1148 +msgid "" +"If ``format >> 2`` is non-zero, it indicates that the interpolation contains " +"a conversion. The value of ``format >> 2`` is the conversion type (``0`` for " +"no conversion, ``1`` for ``!s``, ``2`` for ``!r``, and ``3`` for ``!a``)::" +msgstr "" + +#: ../../library/dis.rst:1153 +msgid "" +"conversion = format >> 2\n" +"if format & 1:\n" +" format_spec = STACK.pop()\n" +"else:\n" +" format_spec = None\n" +"expression = STACK.pop()\n" +"value = STACK.pop()\n" +"STACK.append(_build_interpolation(value, expression, conversion, " +"format_spec))" +msgstr "" + +#: ../../library/dis.rst:1167 msgid "" "Creates a tuple consuming *count* items from the stack, and pushes the " "resulting tuple onto the stack::" msgstr "" -#: ../../library/dis.rst:1112 +#: ../../library/dis.rst:1170 msgid "" "if count == 0:\n" " value = ()\n" @@ -1278,41 +1356,34 @@ msgstr "" "\n" "STACK.append(value)" -#: ../../library/dis.rst:1123 +#: ../../library/dis.rst:1181 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." msgstr "" -#: ../../library/dis.rst:1128 +#: ../../library/dis.rst:1186 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a set." msgstr "" -#: ../../library/dis.rst:1133 +#: ../../library/dis.rst:1191 msgid "" "Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so " "that the dictionary holds *count* entries: ``{..., STACK[-4]: STACK[-3], " "STACK[-2]: STACK[-1]}``." msgstr "" -#: ../../library/dis.rst:1137 +#: ../../library/dis.rst:1195 msgid "" "The dictionary is created from stack items instead of creating an empty " "dictionary pre-sized to hold *count* items." msgstr "" -#: ../../library/dis.rst:1144 -msgid "" -"The version of :opcode:`BUILD_MAP` specialized for constant keys. Pops the " -"top element on the stack which contains a tuple of keys, then starting from " -"``STACK[-2]``, pops *count* values to form values in the built dictionary." -msgstr "" - -#: ../../library/dis.rst:1153 +#: ../../library/dis.rst:1202 msgid "" "Concatenates *count* strings from the stack and pushes the resulting string " "onto the stack." msgstr "" -#: ../../library/dis.rst:1163 +#: ../../library/dis.rst:1212 msgid "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" @@ -1320,11 +1391,11 @@ msgstr "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" -#: ../../library/dis.rst:1166 +#: ../../library/dis.rst:1215 msgid "Used to build lists." msgstr "" -#: ../../library/dis.rst:1175 +#: ../../library/dis.rst:1224 msgid "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" @@ -1332,11 +1403,11 @@ msgstr "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" -#: ../../library/dis.rst:1178 +#: ../../library/dis.rst:1227 msgid "Used to build sets." msgstr "" -#: ../../library/dis.rst:1187 +#: ../../library/dis.rst:1236 msgid "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" @@ -1344,21 +1415,21 @@ msgstr "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" -#: ../../library/dis.rst:1190 +#: ../../library/dis.rst:1239 msgid "Used to build dicts." msgstr "" -#: ../../library/dis.rst:1197 +#: ../../library/dis.rst:1246 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." msgstr "" -#: ../../library/dis.rst:1204 +#: ../../library/dis.rst:1253 msgid "" "If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with " "``getattr(STACK[-1], co_names[namei>>1])``." msgstr "" -#: ../../library/dis.rst:1207 +#: ../../library/dis.rst:1256 msgid "" "If the low bit of ``namei`` is set, this will attempt to load a method named " "``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is " @@ -1370,76 +1441,76 @@ msgid "" "pushed." msgstr "" -#: ../../library/dis.rst:1216 +#: ../../library/dis.rst:1265 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is pushed to " "the stack before the attribute or unbound method respectively." msgstr "" -#: ../../library/dis.rst:1223 +#: ../../library/dis.rst:1272 msgid "" "This opcode implements :func:`super`, both in its zero-argument and two-" "argument forms (e.g. ``super().method()``, ``super().attr`` and ``super(cls, " "self).method()``, ``super(cls, self).attr``)." msgstr "" -#: ../../library/dis.rst:1227 +#: ../../library/dis.rst:1276 msgid "It pops three values from the stack (from top of stack down):" msgstr "" -#: ../../library/dis.rst:1229 +#: ../../library/dis.rst:1278 msgid "``self``: the first argument to the current method" msgstr "" -#: ../../library/dis.rst:1230 +#: ../../library/dis.rst:1279 msgid "``cls``: the class within which the current method was defined" msgstr "" -#: ../../library/dis.rst:1231 +#: ../../library/dis.rst:1280 msgid "the global ``super``" msgstr "" -#: ../../library/dis.rst:1233 +#: ../../library/dis.rst:1282 msgid "" "With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`, " "except that ``namei`` is shifted left by 2 bits instead of 1." msgstr "" -#: ../../library/dis.rst:1236 +#: ../../library/dis.rst:1285 msgid "" "The low bit of ``namei`` signals to attempt a method load, as " "with :opcode:`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded " "method. When it is unset a single value is pushed to the stack." msgstr "" -#: ../../library/dis.rst:1240 +#: ../../library/dis.rst:1289 msgid "" "The second-low bit of ``namei``, if set, means that this was a two-argument " "call to :func:`super` (unset means zero-argument)." msgstr "" -#: ../../library/dis.rst:1248 +#: ../../library/dis.rst:1297 msgid "" "Performs a Boolean operation. The operation name can be found in " "``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set " "(``opname & 16``), the result should be coerced to ``bool``." msgstr "" -#: ../../library/dis.rst:1252 +#: ../../library/dis.rst:1301 msgid "" "The fifth-lowest bit of the oparg now indicates a forced conversion " "to :class:`bool`." msgstr "" -#: ../../library/dis.rst:1259 +#: ../../library/dis.rst:1308 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1266 +#: ../../library/dis.rst:1315 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1273 +#: ../../library/dis.rst:1322 msgid "" "Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are " "popped and provide the *fromlist* and *level* arguments " @@ -1448,62 +1519,62 @@ msgid "" "subsequent :opcode:`STORE_FAST` instruction modifies the namespace." msgstr "" -#: ../../library/dis.rst:1281 +#: ../../library/dis.rst:1330 msgid "" "Loads the attribute ``co_names[namei]`` from the module found in " "``STACK[-1]``. The resulting object is pushed onto the stack, to be " "subsequently stored by a :opcode:`STORE_FAST` instruction." msgstr "" -#: ../../library/dis.rst:1288 +#: ../../library/dis.rst:1337 msgid "Increments bytecode counter by *delta*." msgstr "" -#: ../../library/dis.rst:1293 +#: ../../library/dis.rst:1342 msgid "Decrements bytecode counter by *delta*. Checks for interrupts." msgstr "" -#: ../../library/dis.rst:1300 +#: ../../library/dis.rst:1349 msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" -#: ../../library/dis.rst:1307 +#: ../../library/dis.rst:1356 msgid "" "If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1310 ../../library/dis.rst:1326 +#: ../../library/dis.rst:1359 ../../library/dis.rst:1375 msgid "" "The oparg is now a relative delta rather than an absolute target. This " "opcode is a pseudo-instruction, replaced in final bytecode by the directed " "versions (forward/backward)." msgstr "" -#: ../../library/dis.rst:1315 ../../library/dis.rst:1331 -#: ../../library/dis.rst:1344 ../../library/dis.rst:1355 +#: ../../library/dis.rst:1364 ../../library/dis.rst:1380 +#: ../../library/dis.rst:1393 ../../library/dis.rst:1404 msgid "This is no longer a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1323 +#: ../../library/dis.rst:1372 msgid "" "If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1339 +#: ../../library/dis.rst:1388 msgid "" "If ``STACK[-1]`` is not ``None``, increments the bytecode counter by " "*delta*. ``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1350 +#: ../../library/dis.rst:1399 msgid "" "If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1360 +#: ../../library/dis.rst:1409 msgid "" "``STACK[-1]`` is an :term:`iterator`. Call its :meth:`~iterator.__next__` " "method. If this yields a new value, push it on the stack (leaving the " @@ -1511,91 +1582,103 @@ msgid "" "code counter is incremented by *delta*." msgstr "" -#: ../../library/dis.rst:1365 +#: ../../library/dis.rst:1414 msgid "Up until 3.11 the iterator was popped when it was exhausted." msgstr "" -#: ../../library/dis.rst:1370 +#: ../../library/dis.rst:1419 msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1372 +#: ../../library/dis.rst:1421 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` is pushed to the stack " "before the global variable." msgstr "" -#: ../../library/dis.rst:1378 +#: ../../library/dis.rst:1427 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1380 +#: ../../library/dis.rst:1429 msgid "" "This opcode is now only used in situations where the local variable is " "guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`." msgstr "" -#: ../../library/dis.rst:1386 +#: ../../library/dis.rst:1435 +msgid "" +"Pushes a borrowed reference to the local ``co_varnames[var_num]`` onto the " +"stack." +msgstr "" + +#: ../../library/dis.rst:1442 msgid "" "Pushes references to ``co_varnames[var_nums >> 4]`` and " "``co_varnames[var_nums & 15]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1393 +#: ../../library/dis.rst:1450 +msgid "" +"Pushes borrowed references to ``co_varnames[var_nums >> 4]`` and " +"``co_varnames[var_nums & 15]`` onto the stack." +msgstr "" + +#: ../../library/dis.rst:1457 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " "raising an :exc:`UnboundLocalError` if the local variable has not been " "initialized." msgstr "" -#: ../../library/dis.rst:1401 +#: ../../library/dis.rst:1465 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " "pushes ``NULL`` onto the stack if the local variable has not been " "initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" -#: ../../library/dis.rst:1409 +#: ../../library/dis.rst:1473 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1413 +#: ../../library/dis.rst:1477 msgid "" "Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]`` and ``STACK[-2]`` " "into ``co_varnames[var_nums & 15]``." msgstr "" -#: ../../library/dis.rst:1420 +#: ../../library/dis.rst:1484 msgid "" "Stores ``STACK.pop()`` into the local ``co_varnames[var_nums >> 4]`` and " "pushes a reference to the local ``co_varnames[var_nums & 15]`` onto the " "stack." msgstr "" -#: ../../library/dis.rst:1428 +#: ../../library/dis.rst:1492 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1433 +#: ../../library/dis.rst:1497 msgid "" "Creates a new cell in slot ``i``. If that slot is nonempty then that value " "is stored into the new cell." msgstr "" -#: ../../library/dis.rst:1441 +#: ../../library/dis.rst:1505 msgid "" "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" -#: ../../library/dis.rst:1444 ../../library/dis.rst:1466 -#: ../../library/dis.rst:1477 +#: ../../library/dis.rst:1508 ../../library/dis.rst:1530 +#: ../../library/dis.rst:1541 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -#: ../../library/dis.rst:1450 +#: ../../library/dis.rst:1514 msgid "" "Pops a mapping off the stack and looks up the name associated with slot " "``i`` of the \"fast locals\" storage in this mapping. If the name is not " @@ -1606,112 +1689,112 @@ msgid "" "class bodies." msgstr "" -#: ../../library/dis.rst:1463 +#: ../../library/dis.rst:1527 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1472 +#: ../../library/dis.rst:1536 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" -#: ../../library/dis.rst:1483 +#: ../../library/dis.rst:1547 msgid "" "Copies the ``n`` :term:`free (closure) variables ` from " "the closure into the frame. Removes the need for special code on the " "caller's side when calling closures." msgstr "" -#: ../../library/dis.rst:1492 +#: ../../library/dis.rst:1556 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: ../../library/dis.rst:1495 +#: ../../library/dis.rst:1559 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: ../../library/dis.rst:1496 +#: ../../library/dis.rst:1560 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1497 +#: ../../library/dis.rst:1561 msgid "" "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " "``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1503 +#: ../../library/dis.rst:1567 msgid "" "Calls a callable object with the number of arguments specified by ``argc``. " "On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1506 ../../library/dis.rst:1530 +#: ../../library/dis.rst:1570 ../../library/dis.rst:1594 msgid "The callable" msgstr "" -#: ../../library/dis.rst:1507 ../../library/dis.rst:1531 +#: ../../library/dis.rst:1571 ../../library/dis.rst:1595 msgid "``self`` or ``NULL``" msgstr "``self`` 或 ``NULL``" -#: ../../library/dis.rst:1508 ../../library/dis.rst:1532 +#: ../../library/dis.rst:1572 ../../library/dis.rst:1596 msgid "The remaining positional arguments" msgstr "剩餘的位置引數" -#: ../../library/dis.rst:1510 +#: ../../library/dis.rst:1574 msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -#: ../../library/dis.rst:1512 +#: ../../library/dis.rst:1576 msgid "" "``CALL`` pops all arguments and the callable object off the stack, calls the " "callable object with those arguments, and pushes the return value returned " "by the callable object." msgstr "" -#: ../../library/dis.rst:1518 +#: ../../library/dis.rst:1582 msgid "The callable now always appears at the same position on the stack." msgstr "" -#: ../../library/dis.rst:1521 +#: ../../library/dis.rst:1585 msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -#: ../../library/dis.rst:1527 +#: ../../library/dis.rst:1591 msgid "" "Calls a callable object with the number of arguments specified by ``argc``, " "including one or more named arguments. On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1533 +#: ../../library/dis.rst:1597 msgid "The named arguments" msgstr "" -#: ../../library/dis.rst:1534 +#: ../../library/dis.rst:1598 msgid "A :class:`tuple` of keyword argument names" msgstr "" -#: ../../library/dis.rst:1536 +#: ../../library/dis.rst:1600 msgid "" "``argc`` is the total of the positional and named arguments, excluding " "``self``. The length of the tuple of keyword argument names is the number of " "named arguments." msgstr "" -#: ../../library/dis.rst:1539 +#: ../../library/dis.rst:1603 msgid "" "``CALL_KW`` pops all arguments, the keyword names, and the callable object " "off the stack, calls the callable object with those arguments, and pushes " "the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1548 +#: ../../library/dis.rst:1612 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1723,33 +1806,33 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1563 +#: ../../library/dis.rst:1627 msgid "" "Pushes a ``NULL`` to the stack. Used in the call sequence to match the " "``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1572 +#: ../../library/dis.rst:1636 msgid "" "Pushes a new function object on the stack built from the code object at " "``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:1574 +#: ../../library/dis.rst:1638 msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: ../../library/dis.rst:1577 +#: ../../library/dis.rst:1641 msgid "Qualified name at ``STACK[-1]`` was removed." msgstr "" -#: ../../library/dis.rst:1580 +#: ../../library/dis.rst:1644 msgid "" "Extra function attributes on the stack, signaled by oparg flags, were " "removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" -#: ../../library/dis.rst:1587 +#: ../../library/dis.rst:1651 msgid "" "Sets an attribute on a function object. Expects the function at " "``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " @@ -1757,42 +1840,42 @@ msgid "" "attribute to set:" msgstr "" -#: ../../library/dis.rst:1591 +#: ../../library/dis.rst:1655 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: ../../library/dis.rst:1593 +#: ../../library/dis.rst:1657 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: ../../library/dis.rst:1594 +#: ../../library/dis.rst:1658 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1595 +#: ../../library/dis.rst:1659 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: ../../library/dis.rst:1604 +#: ../../library/dis.rst:1668 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" -#: ../../library/dis.rst:1606 +#: ../../library/dis.rst:1670 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" -#: ../../library/dis.rst:1610 +#: ../../library/dis.rst:1674 msgid "if it is 3, implements::" msgstr "" -#: ../../library/dis.rst:1612 +#: ../../library/dis.rst:1676 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" @@ -1804,11 +1887,11 @@ msgstr "" "start = STACK.pop()\n" "STACK.append(slice(start, end, step))" -#: ../../library/dis.rst:1617 +#: ../../library/dis.rst:1681 msgid "See the :func:`slice` built-in function for more information." msgstr "" -#: ../../library/dis.rst:1622 +#: ../../library/dis.rst:1686 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " @@ -1816,11 +1899,11 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: ../../library/dis.rst:1630 +#: ../../library/dis.rst:1694 msgid "Convert value to a string, depending on ``oparg``::" msgstr "" -#: ../../library/dis.rst:1632 +#: ../../library/dis.rst:1696 msgid "" "value = STACK.pop()\n" "result = func(value)\n" @@ -1830,28 +1913,28 @@ msgstr "" "result = func(value)\n" "STACK.append(result)" -#: ../../library/dis.rst:1636 +#: ../../library/dis.rst:1700 msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" -#: ../../library/dis.rst:1637 +#: ../../library/dis.rst:1701 msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" -#: ../../library/dis.rst:1638 +#: ../../library/dis.rst:1702 msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" -#: ../../library/dis.rst:1640 ../../library/dis.rst:1653 -#: ../../library/dis.rst:1666 +#: ../../library/dis.rst:1704 ../../library/dis.rst:1717 +#: ../../library/dis.rst:1730 msgid "Used for implementing formatted string literals (f-strings)." msgstr "" -#: ../../library/dis.rst:1647 +#: ../../library/dis.rst:1711 msgid "Formats the value on top of stack::" msgstr "" -#: ../../library/dis.rst:1649 +#: ../../library/dis.rst:1713 msgid "" "value = STACK.pop()\n" "result = value.__format__(\"\")\n" @@ -1861,11 +1944,11 @@ msgstr "" "result = value.__format__(\"\")\n" "STACK.append(result)" -#: ../../library/dis.rst:1659 +#: ../../library/dis.rst:1723 msgid "Formats the given value with the given format spec::" msgstr "" -#: ../../library/dis.rst:1661 +#: ../../library/dis.rst:1725 msgid "" "spec = STACK.pop()\n" "value = STACK.pop()\n" @@ -1877,14 +1960,14 @@ msgstr "" "result = value.__format__(spec)\n" "STACK.append(result)" -#: ../../library/dis.rst:1673 +#: ../../library/dis.rst:1737 msgid "" "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " "class being matched against, and ``STACK[-3]`` is the match subject. " "*count* is the number of positional sub-patterns." msgstr "" -#: ../../library/dis.rst:1677 +#: ../../library/dis.rst:1741 msgid "" "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " "instance of ``STACK[-2]`` and has the positional and keyword attributes " @@ -1892,219 +1975,219 @@ msgid "" "Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:1691 +#: ../../library/dis.rst:1755 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -#: ../../library/dis.rst:1693 +#: ../../library/dis.rst:1757 msgid "" -"The ``context`` oparand consists of two parts. The lowest two bits indicate " +"The ``context`` operand consists of two parts. The lowest two bits indicate " "where the ``RESUME`` occurs:" msgstr "" -#: ../../library/dis.rst:1696 +#: ../../library/dis.rst:1760 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" -#: ../../library/dis.rst:1698 +#: ../../library/dis.rst:1762 msgid "``1`` After a ``yield`` expression" msgstr "" -#: ../../library/dis.rst:1699 +#: ../../library/dis.rst:1763 msgid "``2`` After a ``yield from`` expression" msgstr "" -#: ../../library/dis.rst:1700 +#: ../../library/dis.rst:1764 msgid "``3`` After an ``await`` expression" msgstr "" -#: ../../library/dis.rst:1702 +#: ../../library/dis.rst:1766 msgid "" "The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " "otherwise." msgstr "" -#: ../../library/dis.rst:1707 +#: ../../library/dis.rst:1771 msgid "The oparg value changed to include information about except-depth" msgstr "" -#: ../../library/dis.rst:1713 +#: ../../library/dis.rst:1777 msgid "" "Create a generator, coroutine, or async generator from the current frame. " "Used as first opcode of in code object for the above mentioned callables. " "Clear the current frame and return the newly created generator." msgstr "" -#: ../../library/dis.rst:1722 +#: ../../library/dis.rst:1786 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" -#: ../../library/dis.rst:1725 +#: ../../library/dis.rst:1789 msgid "" "If the call raises :exc:`StopIteration`, pop the top value from the stack, " "push the exception's ``value`` attribute, and increment the bytecode counter " "by *delta*." msgstr "" -#: ../../library/dis.rst:1734 +#: ../../library/dis.rst:1798 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes in the range [0,255] which don't use their argument and those that " "do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -#: ../../library/dis.rst:1738 +#: ../../library/dis.rst:1802 msgid "" "If your application uses pseudo instructions or specialized instructions, " "use the :data:`hasarg` collection instead." msgstr "" -#: ../../library/dis.rst:1741 +#: ../../library/dis.rst:1805 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -#: ../../library/dis.rst:1745 +#: ../../library/dis.rst:1809 msgid "" "Pseudo instructions were added to the :mod:`dis` module, and for them it is " "not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use " "their arg." msgstr "" -#: ../../library/dis.rst:1750 +#: ../../library/dis.rst:1814 msgid "Use :data:`hasarg` instead." msgstr "" -#: ../../library/dis.rst:1755 +#: ../../library/dis.rst:1819 msgid "" "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " "argument and sets ``STACK[-1]`` to the result. Used to implement " "functionality that is not performance critical." msgstr "" -#: ../../library/dis.rst:1759 ../../library/dis.rst:1813 +#: ../../library/dis.rst:1823 ../../library/dis.rst:1877 msgid "The operand determines which intrinsic function is called:" msgstr "" -#: ../../library/dis.rst:1762 ../../library/dis.rst:1816 +#: ../../library/dis.rst:1826 ../../library/dis.rst:1880 msgid "Operand" msgstr "運算元" -#: ../../library/dis.rst:1762 ../../library/dis.rst:1816 +#: ../../library/dis.rst:1826 ../../library/dis.rst:1880 msgid "Description" msgstr "描述" -#: ../../library/dis.rst:1764 +#: ../../library/dis.rst:1828 msgid "``INTRINSIC_1_INVALID``" msgstr "``INTRINSIC_1_INVALID``" -#: ../../library/dis.rst:1764 ../../library/dis.rst:1818 +#: ../../library/dis.rst:1828 ../../library/dis.rst:1882 msgid "Not valid" msgstr "" -#: ../../library/dis.rst:1766 +#: ../../library/dis.rst:1830 msgid "``INTRINSIC_PRINT``" msgstr "``INTRINSIC_PRINT``" -#: ../../library/dis.rst:1766 +#: ../../library/dis.rst:1830 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" -#: ../../library/dis.rst:1769 +#: ../../library/dis.rst:1833 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "``INTRINSIC_IMPORT_STAR``" -#: ../../library/dis.rst:1769 +#: ../../library/dis.rst:1833 msgid "Performs ``import *`` for the named module." msgstr "" -#: ../../library/dis.rst:1772 +#: ../../library/dis.rst:1836 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "``INTRINSIC_STOPITERATION_ERROR``" -#: ../../library/dis.rst:1772 +#: ../../library/dis.rst:1836 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: ../../library/dis.rst:1775 +#: ../../library/dis.rst:1839 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "``INTRINSIC_ASYNC_GEN_WRAP``" -#: ../../library/dis.rst:1775 +#: ../../library/dis.rst:1839 msgid "Wraps an async generator value" msgstr "" -#: ../../library/dis.rst:1777 +#: ../../library/dis.rst:1841 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "``INTRINSIC_UNARY_POSITIVE``" -#: ../../library/dis.rst:1777 +#: ../../library/dis.rst:1841 msgid "Performs the unary ``+`` operation" msgstr "" -#: ../../library/dis.rst:1780 +#: ../../library/dis.rst:1844 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "``INTRINSIC_LIST_TO_TUPLE``" -#: ../../library/dis.rst:1780 +#: ../../library/dis.rst:1844 msgid "Converts a list to a tuple" msgstr "" -#: ../../library/dis.rst:1782 +#: ../../library/dis.rst:1846 msgid "``INTRINSIC_TYPEVAR``" msgstr "``INTRINSIC_TYPEVAR``" -#: ../../library/dis.rst:1782 +#: ../../library/dis.rst:1846 msgid "Creates a :class:`typing.TypeVar`" msgstr "" -#: ../../library/dis.rst:1784 +#: ../../library/dis.rst:1848 msgid "``INTRINSIC_PARAMSPEC``" msgstr "``INTRINSIC_PARAMSPEC``" -#: ../../library/dis.rst:1784 +#: ../../library/dis.rst:1848 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" -#: ../../library/dis.rst:1787 +#: ../../library/dis.rst:1851 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "``INTRINSIC_TYPEVARTUPLE``" -#: ../../library/dis.rst:1787 +#: ../../library/dis.rst:1851 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" -#: ../../library/dis.rst:1790 +#: ../../library/dis.rst:1854 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "``INTRINSIC_SUBSCRIPT_GENERIC``" -#: ../../library/dis.rst:1790 +#: ../../library/dis.rst:1854 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" -#: ../../library/dis.rst:1793 +#: ../../library/dis.rst:1857 msgid "``INTRINSIC_TYPEALIAS``" msgstr "``INTRINSIC_TYPEALIAS``" -#: ../../library/dis.rst:1793 +#: ../../library/dis.rst:1857 msgid "" "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " "statement. The argument is a tuple of the type alias's name, type " "parameters, and value." msgstr "" -#: ../../library/dis.rst:1805 +#: ../../library/dis.rst:1869 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" -#: ../../library/dis.rst:1808 +#: ../../library/dis.rst:1872 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" @@ -2116,61 +2199,69 @@ msgstr "" "result = intrinsic2(arg1, arg2)\n" "STACK.append(result)" -#: ../../library/dis.rst:1818 +#: ../../library/dis.rst:1882 msgid "``INTRINSIC_2_INVALID``" msgstr "``INTRINSIC_2_INVALID``" -#: ../../library/dis.rst:1820 +#: ../../library/dis.rst:1884 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "``INTRINSIC_PREP_RERAISE_STAR``" -#: ../../library/dis.rst:1820 +#: ../../library/dis.rst:1884 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" -#: ../../library/dis.rst:1824 +#: ../../library/dis.rst:1888 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "``INTRINSIC_TYPEVAR_WITH_BOUND``" -#: ../../library/dis.rst:1824 +#: ../../library/dis.rst:1888 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" -#: ../../library/dis.rst:1827 +#: ../../library/dis.rst:1891 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -#: ../../library/dis.rst:1827 +#: ../../library/dis.rst:1891 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" -#: ../../library/dis.rst:1831 +#: ../../library/dis.rst:1895 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -#: ../../library/dis.rst:1831 +#: ../../library/dis.rst:1895 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -#: ../../library/dis.rst:1838 +#: ../../library/dis.rst:1904 +msgid "" +"Performs special method lookup on ``STACK[-1]``. If " +"``type(STACK[-1]).__xxx__`` is a method, leave ``type(STACK[-1]).__xxx__; " +"STACK[-1]`` on the stack. If ``type(STACK[-1]).__xxx__`` is not a method, " +"leave ``STACK[-1].__xxx__; NULL`` on the stack." +msgstr "" + +#: ../../library/dis.rst:1913 msgid "**Pseudo-instructions**" msgstr "" -#: ../../library/dis.rst:1840 +#: ../../library/dis.rst:1915 msgid "" "These opcodes do not appear in Python bytecode. They are used by the " "compiler but are replaced by real opcodes or removed before bytecode is " "generated." msgstr "" -#: ../../library/dis.rst:1845 +#: ../../library/dis.rst:1920 msgid "" "Set up an exception handler for the following code block. If an exception " "occurs, the value stack level is restored to its current state and control " "is transferred to the exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1852 +#: ../../library/dis.rst:1927 msgid "" "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " "instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " @@ -2179,14 +2270,14 @@ msgid "" "exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1861 +#: ../../library/dis.rst:1936 msgid "" "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " "from the stack before control is transferred to the exception handler at " "``target``." msgstr "" -#: ../../library/dis.rst:1865 +#: ../../library/dis.rst:1940 msgid "" "This variant is used in :keyword:`with` and :keyword:`async with` " "constructs, which push the return value of the context " @@ -2194,77 +2285,83 @@ msgid "" "stack." msgstr "" -#: ../../library/dis.rst:1872 +#: ../../library/dis.rst:1947 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -#: ../../library/dis.rst:1878 +#: ../../library/dis.rst:1953 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" -#: ../../library/dis.rst:1883 +#: ../../library/dis.rst:1959 +msgid "" +"Conditional jumps which do not impact the stack. Replaced by the sequence " +"``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``." +msgstr "" + +#: ../../library/dis.rst:1964 msgid "" "Pushes a reference to the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1886 +#: ../../library/dis.rst:1967 msgid "" "Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." msgstr "" -#: ../../library/dis.rst:1888 +#: ../../library/dis.rst:1969 msgid "This opcode is now a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1894 +#: ../../library/dis.rst:1975 msgid "" "Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode with a " "flag set in the arg." msgstr "" -#: ../../library/dis.rst:1901 +#: ../../library/dis.rst:1982 msgid "Opcode collections" msgstr "" -#: ../../library/dis.rst:1903 +#: ../../library/dis.rst:1984 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: ../../library/dis.rst:1906 +#: ../../library/dis.rst:1987 msgid "" "The collections now contain pseudo instructions and instrumented " "instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " "and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" -#: ../../library/dis.rst:1913 +#: ../../library/dis.rst:1994 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: ../../library/dis.rst:1918 +#: ../../library/dis.rst:1999 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: ../../library/dis.rst:1923 +#: ../../library/dis.rst:2004 msgid "Sequence of all compare operation names." msgstr "" -#: ../../library/dis.rst:1928 +#: ../../library/dis.rst:2009 msgid "Sequence of bytecodes that use their argument." msgstr "" -#: ../../library/dis.rst:1935 +#: ../../library/dis.rst:2016 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: ../../library/dis.rst:1940 +#: ../../library/dis.rst:2021 msgid "" "Sequence of bytecodes that access a :term:`free (closure) variable `. 'free' in this context refers to names in the current scope that " @@ -2273,46 +2370,58 @@ msgid "" "scopes." msgstr "" -#: ../../library/dis.rst:1948 +#: ../../library/dis.rst:2029 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: ../../library/dis.rst:1953 +#: ../../library/dis.rst:2034 msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" -#: ../../library/dis.rst:1960 +#: ../../library/dis.rst:2041 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: ../../library/dis.rst:1965 +#: ../../library/dis.rst:2046 msgid "Sequence of bytecodes of Boolean operations." msgstr "" -#: ../../library/dis.rst:1969 +#: ../../library/dis.rst:2050 msgid "Sequence of bytecodes that set an exception handler." msgstr "" -#: ../../library/dis.rst:1976 +#: ../../library/dis.rst:2057 msgid "Sequence of bytecodes that have a relative jump target." msgstr "" -#: ../../library/dis.rst:1978 +#: ../../library/dis.rst:2059 msgid "All jumps are now relative. Use :data:`hasjump`." msgstr "" -#: ../../library/dis.rst:1984 +#: ../../library/dis.rst:2065 msgid "Sequence of bytecodes that have an absolute jump target." msgstr "" -#: ../../library/dis.rst:1986 +#: ../../library/dis.rst:2067 msgid "All jumps are now relative. This list is empty." msgstr "" -#: ../../library/dis.rst:1602 +#: ../../library/dis.rst:1666 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/dis.rst:1602 +#: ../../library/dis.rst:1666 msgid "slice" msgstr "slice(切片)" + +#~ msgid "" +#~ "key = STACK.pop()\n" +#~ "container = STACK.pop()\n" +#~ "STACK.append(container[key])" +#~ msgstr "" +#~ "key = STACK.pop()\n" +#~ "container = STACK.pop()\n" +#~ "STACK.append(container[key])" + +#~ msgid "STACK.extend((__aexit__, __aenter__())" +#~ msgstr "STACK.extend((__aexit__, __aenter__())" diff --git a/library/doctest.po b/library/doctest.po index 37c9b9bb189..4ddd44aa896 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-08-19 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\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-" @@ -199,24 +199,30 @@ msgstr "" #: ../../library/doctest.rst:133 msgid "" -"That's all you need to know to start making productive use of :mod:" -"`doctest`! Jump in. The following sections provide full details. Note that " -"there are many examples of doctests in the standard Python test suite and " -"libraries. Especially useful examples can be found in the standard test " -"file :file:`Lib/test/test_doctest/test_doctest.py`." +"That's all you need to know to start making productive use " +"of :mod:`doctest`! Jump in. The following sections provide full details. " +"Note that there are many examples of doctests in the standard Python test " +"suite and libraries. Especially useful examples can be found in the standard " +"test file :file:`Lib/test/test_doctest/test_doctest.py`." msgstr "" -#: ../../library/doctest.rst:143 +#: ../../library/doctest.rst:139 +msgid "" +"Output is colorized by default and can be :ref:`controlled using environment " +"variables `." +msgstr "" + +#: ../../library/doctest.rst:147 msgid "Simple Usage: Checking Examples in Docstrings" msgstr "" -#: ../../library/doctest.rst:145 +#: ../../library/doctest.rst:149 msgid "" "The simplest way to start using doctest (but not necessarily the way you'll " "continue to do it) is to end each module :mod:`!M` with::" msgstr "" -#: ../../library/doctest.rst:148 +#: ../../library/doctest.rst:152 msgid "" "if __name__ == \"__main__\":\n" " import doctest\n" @@ -226,21 +232,21 @@ msgstr "" " import doctest\n" " doctest.testmod()" -#: ../../library/doctest.rst:152 +#: ../../library/doctest.rst:156 msgid ":mod:`!doctest` then examines docstrings in module :mod:`!M`." msgstr "" -#: ../../library/doctest.rst:154 +#: ../../library/doctest.rst:158 msgid "" "Running the module as a script causes the examples in the docstrings to get " "executed and verified::" msgstr "" -#: ../../library/doctest.rst:157 +#: ../../library/doctest.rst:161 msgid "python M.py" msgstr "python M.py" -#: ../../library/doctest.rst:159 +#: ../../library/doctest.rst:163 msgid "" "This won't display anything unless an example fails, in which case the " "failing example(s) and the cause(s) of the failure(s) are printed to stdout, " @@ -248,51 +254,51 @@ msgid "" "is the number of examples that failed." msgstr "" -#: ../../library/doctest.rst:164 +#: ../../library/doctest.rst:168 msgid "Run it with the ``-v`` switch instead::" msgstr "" -#: ../../library/doctest.rst:166 +#: ../../library/doctest.rst:170 msgid "python M.py -v" msgstr "python M.py -v" -#: ../../library/doctest.rst:168 +#: ../../library/doctest.rst:172 msgid "" "and a detailed report of all examples tried is printed to standard output, " "along with assorted summaries at the end." msgstr "" -#: ../../library/doctest.rst:171 +#: ../../library/doctest.rst:175 msgid "" "You can force verbose mode by passing ``verbose=True`` to :func:`testmod`, " -"or prohibit it by passing ``verbose=False``. In either of those cases, :" -"data:`sys.argv` is not examined by :func:`testmod` (so passing ``-v`` or not " -"has no effect)." +"or prohibit it by passing ``verbose=False``. In either of those " +"cases, :data:`sys.argv` is not examined by :func:`testmod` (so passing ``-" +"v`` or not has no effect)." msgstr "" -#: ../../library/doctest.rst:176 +#: ../../library/doctest.rst:180 msgid "" "There is also a command line shortcut for running :func:`testmod`, see " "section :ref:`doctest-cli`." msgstr "" -#: ../../library/doctest.rst:179 +#: ../../library/doctest.rst:183 msgid "" "For more information on :func:`testmod`, see section :ref:`doctest-basic-" "api`." msgstr "" -#: ../../library/doctest.rst:185 +#: ../../library/doctest.rst:189 msgid "Simple Usage: Checking Examples in a Text File" msgstr "" -#: ../../library/doctest.rst:187 +#: ../../library/doctest.rst:191 msgid "" "Another simple application of doctest is testing interactive examples in a " "text file. This can be done with the :func:`testfile` function::" msgstr "" -#: ../../library/doctest.rst:190 +#: ../../library/doctest.rst:194 msgid "" "import doctest\n" "doctest.testfile(\"example.txt\")" @@ -300,7 +306,7 @@ msgstr "" "import doctest\n" "doctest.testfile(\"example.txt\")" -#: ../../library/doctest.rst:193 +#: ../../library/doctest.rst:197 msgid "" "That short script executes and verifies any interactive Python examples " "contained in the file :file:`example.txt`. The file content is treated as " @@ -308,7 +314,7 @@ msgid "" "Python program! For example, perhaps :file:`example.txt` contains this:" msgstr "" -#: ../../library/doctest.rst:198 +#: ../../library/doctest.rst:202 msgid "" "The ``example`` module\n" "======================\n" @@ -342,13 +348,13 @@ msgstr "" " >>> factorial(6)\n" " 120" -#: ../../library/doctest.rst:216 +#: ../../library/doctest.rst:220 msgid "" "Running ``doctest.testfile(\"example.txt\")`` then finds the error in this " "documentation::" msgstr "" -#: ../../library/doctest.rst:219 +#: ../../library/doctest.rst:223 msgid "" "File \"./example.txt\", line 14, in example.txt\n" "Failed example:\n" @@ -366,15 +372,15 @@ msgstr "" "Got:\n" " 720" -#: ../../library/doctest.rst:227 +#: ../../library/doctest.rst:231 msgid "" "As with :func:`testmod`, :func:`testfile` won't display anything unless an " "example fails. If an example does fail, then the failing example(s) and the " -"cause(s) of the failure(s) are printed to stdout, using the same format as :" -"func:`!testmod`." +"cause(s) of the failure(s) are printed to stdout, using the same format " +"as :func:`!testmod`." msgstr "" -#: ../../library/doctest.rst:232 +#: ../../library/doctest.rst:236 msgid "" "By default, :func:`testfile` looks for files in the calling module's " "directory. See section :ref:`doctest-basic-api` for a description of the " @@ -382,79 +388,79 @@ msgid "" "locations." msgstr "" -#: ../../library/doctest.rst:236 +#: ../../library/doctest.rst:240 msgid "" "Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the ``-" "v`` command-line switch or with the optional keyword argument *verbose*." msgstr "" -#: ../../library/doctest.rst:240 +#: ../../library/doctest.rst:244 msgid "" "There is also a command line shortcut for running :func:`testfile`, see " "section :ref:`doctest-cli`." msgstr "" -#: ../../library/doctest.rst:243 +#: ../../library/doctest.rst:247 msgid "" "For more information on :func:`testfile`, see section :ref:`doctest-basic-" "api`." msgstr "" -#: ../../library/doctest.rst:249 +#: ../../library/doctest.rst:253 msgid "Command-line Usage" msgstr "命令列用法" -#: ../../library/doctest.rst:251 +#: ../../library/doctest.rst:255 msgid "" "The :mod:`doctest` module can be invoked as a script from the command line:" msgstr "可以從命令列以腳本方式叫用 :mod:`doctest` 模組:" -#: ../../library/doctest.rst:253 +#: ../../library/doctest.rst:257 msgid "python -m doctest [-v] [-o OPTION] [-f] file [file ...]" msgstr "python -m doctest [-v] [-o OPTION] [-f] file [file ...]" -#: ../../library/doctest.rst:261 +#: ../../library/doctest.rst:265 msgid "" "Detailed report of all examples tried is printed to standard output, along " "with assorted summaries at the end::" msgstr "" -#: ../../library/doctest.rst:264 +#: ../../library/doctest.rst:268 msgid "python -m doctest -v example.py" msgstr "python -m doctest -v example.py" -#: ../../library/doctest.rst:266 +#: ../../library/doctest.rst:270 msgid "" -"This will import :file:`example.py` as a standalone module and run :func:" -"`testmod` on it. Note that this may not work correctly if the file is part " -"of a package and imports other submodules from that package." +"This will import :file:`example.py` as a standalone module and " +"run :func:`testmod` on it. Note that this may not work correctly if the file " +"is part of a package and imports other submodules from that package." msgstr "" -#: ../../library/doctest.rst:270 +#: ../../library/doctest.rst:274 msgid "" "If the file name does not end with :file:`.py`, :mod:`!doctest` infers that " "it must be run with :func:`testfile` instead::" msgstr "" -#: ../../library/doctest.rst:273 +#: ../../library/doctest.rst:277 msgid "python -m doctest -v example.txt" msgstr "python -m doctest -v example.txt" -#: ../../library/doctest.rst:277 +#: ../../library/doctest.rst:281 msgid "" -"Option flags control various aspects of doctest's behavior, see section :ref:" -"`doctest-options`." +"Option flags control various aspects of doctest's behavior, see " +"section :ref:`doctest-options`." msgstr "" -#: ../../library/doctest.rst:284 +#: ../../library/doctest.rst:288 msgid "This is shorthand for ``-o FAIL_FAST``." msgstr "" -#: ../../library/doctest.rst:292 +#: ../../library/doctest.rst:296 msgid "How It Works" msgstr "運作方式" -#: ../../library/doctest.rst:294 +#: ../../library/doctest.rst:298 msgid "" "This section examines in detail how doctest works: which docstrings it looks " "at, how it finds interactive examples, what execution context it uses, how " @@ -464,34 +470,34 @@ msgid "" "see the following sections." msgstr "" -#: ../../library/doctest.rst:305 +#: ../../library/doctest.rst:309 msgid "Which Docstrings Are Examined?" msgstr "" -#: ../../library/doctest.rst:307 +#: ../../library/doctest.rst:311 msgid "" "The module docstring, and all function, class and method docstrings are " "searched. Objects imported into the module are not searched." msgstr "" -#: ../../library/doctest.rst:317 +#: ../../library/doctest.rst:321 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 " "the docstring. Doctest looks for a module-level variable called ``__test__`` " "and uses it to locate other tests. If ``M.__test__`` exists, it must be a " "dict, and each entry maps a (string) name to a function object, class " -"object, or string. Function and class object docstrings found from ``M." -"__test__`` are searched, and strings are treated as if they were " -"docstrings. In output, a key ``K`` in ``M.__test__`` appears with name ``M." -"__test__.K``." +"object, or string. Function and class object docstrings found from " +"``M.__test__`` are searched, and strings are treated as if they were " +"docstrings. In output, a key ``K`` in ``M.__test__`` appears with name " +"``M.__test__.K``." msgstr "" -#: ../../library/doctest.rst:326 +#: ../../library/doctest.rst:330 msgid "For example, place this block of code at the top of :file:`example.py`:" msgstr "" -#: ../../library/doctest.rst:328 +#: ../../library/doctest.rst:332 msgid "" "__test__ = {\n" " 'numbers': \"\"\"\n" @@ -513,45 +519,45 @@ msgstr "" "\"\"\"\n" "}" -#: ../../library/doctest.rst:340 +#: ../../library/doctest.rst:344 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 " -"that the value can be mapped to a function, class object, or module; if so, :" -"mod:`!doctest` searches them recursively for docstrings, which are then " +"that the value can be mapped to a function, class object, or module; if " +"so, :mod:`!doctest` searches them recursively for docstrings, which are then " "scanned for tests." msgstr "" -#: ../../library/doctest.rst:346 +#: ../../library/doctest.rst:350 msgid "" "Any classes found are recursively searched similarly, to test docstrings in " "their contained methods and nested classes." msgstr "" -#: ../../library/doctest.rst:351 +#: ../../library/doctest.rst:355 msgid "" "``doctest`` can only automatically discover classes and functions that are " "defined at the module level or inside other classes." msgstr "" -#: ../../library/doctest.rst:354 +#: ../../library/doctest.rst:358 msgid "" "Since nested classes and functions only exist when an outer function is " "called, they cannot be discovered. Define them outside to make them visible." msgstr "" -#: ../../library/doctest.rst:360 +#: ../../library/doctest.rst:364 msgid "How are Docstring Examples Recognized?" msgstr "" -#: ../../library/doctest.rst:362 +#: ../../library/doctest.rst:366 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:367 +#: ../../library/doctest.rst:371 msgid "" ">>> # comments are ignored\n" ">>> x = 12\n" @@ -585,18 +591,18 @@ msgstr "" "NO!!!\n" ">>>" -#: ../../library/doctest.rst:387 +#: ../../library/doctest.rst:391 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:391 +#: ../../library/doctest.rst:395 msgid "The fine print:" msgstr "" -#: ../../library/doctest.rst:393 +#: ../../library/doctest.rst:397 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 " @@ -604,35 +610,35 @@ msgid "" "line is expected." msgstr "" -#: ../../library/doctest.rst:398 +#: ../../library/doctest.rst:402 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 " "hard tabs in the sample output *are* expanded, this means that if the code " -"output includes hard tabs, the only way the doctest can pass is if the :" -"const:`NORMALIZE_WHITESPACE` option or :ref:`directive ` " -"is in effect. Alternatively, the test can be rewritten to capture the output " -"and compare it to an expected value as part of the test. This handling of " -"tabs in the source was arrived at through trial and error, and has proven to " -"be the least error prone way of handling them. It is possible to use a " -"different algorithm for handling tabs by writing a custom :class:" -"`DocTestParser` class." +"output includes hard tabs, the only way the doctest can pass is if " +"the :const:`NORMALIZE_WHITESPACE` option or :ref:`directive ` is in effect. Alternatively, the test can be rewritten to " +"capture the output and compare it to an expected value as part of the test. " +"This handling of tabs in the source was arrived at through trial and error, " +"and has proven to be the least error prone way of handling them. It is " +"possible to use a different algorithm for handling tabs by writing a " +"custom :class:`DocTestParser` class." msgstr "" -#: ../../library/doctest.rst:410 +#: ../../library/doctest.rst:414 msgid "" "Output to stdout is captured, but not output to stderr (exception tracebacks " "are captured via a different means)." msgstr "" -#: ../../library/doctest.rst:413 +#: ../../library/doctest.rst:417 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:417 +#: ../../library/doctest.rst:421 msgid "" ">>> def f(x):\n" "... r'''Backslashes in a raw docstring: m\\n'''\n" @@ -641,7 +647,7 @@ msgid "" "Backslashes in a raw docstring: m\\n" msgstr "" -#: ../../library/doctest.rst:423 +#: ../../library/doctest.rst:427 msgid "" "Otherwise, the backslash will be interpreted as part of the string. For " "example, the ``\\n`` above would be interpreted as a newline character. " @@ -649,7 +655,7 @@ msgid "" "use a raw string)::" msgstr "" -#: ../../library/doctest.rst:427 +#: ../../library/doctest.rst:431 msgid "" ">>> def f(x):\n" "... '''Backslashes in a raw docstring: m\\\\n'''\n" @@ -658,11 +664,11 @@ msgid "" "Backslashes in a raw docstring: m\\n" msgstr "" -#: ../../library/doctest.rst:433 +#: ../../library/doctest.rst:437 msgid "The starting column doesn't matter::" msgstr "" -#: ../../library/doctest.rst:435 +#: ../../library/doctest.rst:439 msgid "" ">>> assert \"Easy!\"\n" " >>> import math\n" @@ -674,17 +680,17 @@ msgstr "" " >>> math.floor(1.9)\n" " 1" -#: ../../library/doctest.rst:440 +#: ../../library/doctest.rst:444 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:447 +#: ../../library/doctest.rst:451 msgid "What's the Execution Context?" msgstr "" -#: ../../library/doctest.rst:449 +#: ../../library/doctest.rst:453 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 " @@ -695,17 +701,17 @@ msgid "" "defined in other docstrings." msgstr "" -#: ../../library/doctest.rst:457 +#: ../../library/doctest.rst:461 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:464 +#: ../../library/doctest.rst:468 msgid "What About Exceptions?" msgstr "" -#: ../../library/doctest.rst:466 +#: ../../library/doctest.rst:470 msgid "" "No problem, provided that the traceback is the only output produced by the " "example: just paste in the traceback. [#]_ Since tracebacks contain details " @@ -714,11 +720,11 @@ msgid "" "it accepts." msgstr "" -#: ../../library/doctest.rst:472 +#: ../../library/doctest.rst:476 msgid "Simple example::" msgstr "簡單範例: ::" -#: ../../library/doctest.rst:474 +#: ../../library/doctest.rst:478 msgid "" ">>> [1, 2, 3].remove(42)\n" "Traceback (most recent call last):\n" @@ -730,20 +736,20 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: list.remove(x): x not in list" -#: ../../library/doctest.rst:479 +#: ../../library/doctest.rst:483 msgid "" -"That doctest succeeds if :exc:`ValueError` is raised, with the ``list." -"remove(x): x not in list`` detail as shown." +"That doctest succeeds if :exc:`ValueError` is raised, with the " +"``list.remove(x): x not in list`` detail as shown." msgstr "" -#: ../../library/doctest.rst:482 +#: ../../library/doctest.rst:486 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:486 +#: ../../library/doctest.rst:490 msgid "" "Traceback (most recent call last):\n" "Traceback (innermost last):" @@ -751,14 +757,14 @@ msgstr "" "Traceback (most recent call last):\n" "Traceback (innermost last):" -#: ../../library/doctest.rst:489 +#: ../../library/doctest.rst:493 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:493 +#: ../../library/doctest.rst:497 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 " @@ -766,7 +772,7 @@ msgid "" "multi-line detail::" msgstr "" -#: ../../library/doctest.rst:498 +#: ../../library/doctest.rst:502 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -782,20 +788,20 @@ msgstr "" " line\n" "detail" -#: ../../library/doctest.rst:505 +#: ../../library/doctest.rst:509 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:508 +#: ../../library/doctest.rst:512 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:511 +#: ../../library/doctest.rst:515 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -811,20 +817,20 @@ msgstr "" " line\n" "detail" -#: ../../library/doctest.rst:518 +#: ../../library/doctest.rst:522 msgid "" "Note that tracebacks are treated very specially. In particular, in the " -"rewritten example, the use of ``...`` is independent of doctest's :const:" -"`ELLIPSIS` option. The ellipsis in that example could be left out, or could " -"just as well be three (or three hundred) commas or digits, or an indented " -"transcript of a Monty Python skit." +"rewritten example, the use of ``...`` is independent of " +"doctest's :const:`ELLIPSIS` option. The ellipsis in that example could be " +"left out, or could just as well be three (or three hundred) commas or " +"digits, or an indented transcript of a Monty Python skit." msgstr "" -#: ../../library/doctest.rst:524 +#: ../../library/doctest.rst:528 msgid "Some details you should read once, but won't need to remember:" msgstr "" -#: ../../library/doctest.rst:526 +#: ../../library/doctest.rst:530 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 " @@ -834,7 +840,7 @@ msgid "" "create real problems." msgstr "" -#: ../../library/doctest.rst:533 +#: ../../library/doctest.rst:537 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. " @@ -843,29 +849,29 @@ msgid "" "course this does the right thing for genuine tracebacks." msgstr "" -#: ../../library/doctest.rst:539 +#: ../../library/doctest.rst:543 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:543 +#: ../../library/doctest.rst:547 msgid "" -"The interactive shell omits the traceback header line for some :exc:" -"`SyntaxError`\\ s. But doctest uses the traceback header line to " +"The interactive shell omits the traceback header line for " +"some :exc:`SyntaxError`\\ s. But doctest uses the traceback header line to " "distinguish exceptions from non-exceptions. So in the rare case where you " "need to test a :exc:`!SyntaxError` that omits the traceback header, you will " "need to manually add the traceback header line to your test example." msgstr "" -#: ../../library/doctest.rst:551 +#: ../../library/doctest.rst:555 msgid "" "For some exceptions, Python displays the position of the error using ``^`` " "markers and tildes::" msgstr "" -#: ../../library/doctest.rst:554 +#: ../../library/doctest.rst:558 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -879,7 +885,7 @@ msgstr "" " ~~^~~~~~\n" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" -#: ../../library/doctest.rst:560 +#: ../../library/doctest.rst:564 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 " @@ -887,7 +893,7 @@ msgid "" "location::" msgstr "" -#: ../../library/doctest.rst:564 +#: ../../library/doctest.rst:568 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -901,48 +907,49 @@ msgstr "" " ^~~~~~~~\n" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" -#: ../../library/doctest.rst:575 +#: ../../library/doctest.rst:579 msgid "Option Flags" msgstr "可選旗標" -#: ../../library/doctest.rst:577 +#: ../../library/doctest.rst:581 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 :" -"ref:`bitwise ORed ` together and passed to various functions. The " -"names can also be used in :ref:`doctest directives `, " -"and may be passed to the doctest command line interface via the ``-o`` " -"option." +"Symbolic names for the flags are supplied as module constants, which can " +"be :ref:`bitwise ORed ` together and passed to various functions. " +"The names can also be used in :ref:`doctest directives `, and may be passed to the doctest command line interface via " +"the ``-o`` option." msgstr "" -#: ../../library/doctest.rst:583 +#: ../../library/doctest.rst:587 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:589 +#: ../../library/doctest.rst:593 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 " -"match, and similarly for ``0`` versus ``False``. When :const:" -"`DONT_ACCEPT_TRUE_FOR_1` is specified, neither substitution is allowed. The " -"default behavior caters to that Python changed the return type of many " -"functions from integer to boolean; doctests expecting \"little integer\" " -"output still work in these cases. This option will probably go away, but " -"not for several years." +"match, and similarly for ``0`` versus ``False``. " +"When :const:`DONT_ACCEPT_TRUE_FOR_1` is specified, neither substitution is " +"allowed. The default behavior caters to that Python changed the return type " +"of many functions from integer to boolean; doctests expecting \"little " +"integer\" output still work in these cases. This option will probably go " +"away, but not for several years." msgstr "" -#: ../../library/doctest.rst:601 +#: ../../library/doctest.rst:605 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 " "output. Because a genuinely blank line delimits the expected output, this " -"is the only way to communicate that a blank line is expected. When :const:" -"`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not allowed." +"is the only way to communicate that a blank line is expected. " +"When :const:`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not " +"allowed." msgstr "" -#: ../../library/doctest.rst:610 +#: ../../library/doctest.rst:614 msgid "" "When specified, all sequences of whitespace (blanks and newlines) are " "treated as equal. Any sequence of whitespace within the expected output " @@ -952,7 +959,7 @@ msgid "" "across multiple lines in your source." msgstr "" -#: ../../library/doctest.rst:621 +#: ../../library/doctest.rst:625 msgid "" "When specified, an ellipsis marker (``...``) in the expected output can " "match any substring in the actual output. This includes substrings that " @@ -961,24 +968,24 @@ msgid "" "matched too much!\" surprises that ``.*`` is prone to in regular expressions." msgstr "" -#: ../../library/doctest.rst:630 +#: ../../library/doctest.rst:634 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:634 +#: ../../library/doctest.rst:638 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:" -"`TypeError` is raised instead. It will also ignore any fully qualified name " -"included before the exception class, which can vary between implementations " -"and versions of Python and the code/libraries in use. Hence, all three of " -"these variations will work with the flag specified:" +"exception raised is ``ValueError: 3*14``, but will fail if, say, " +"a :exc:`TypeError` is raised instead. It will also ignore any fully " +"qualified name included before the exception class, which can vary between " +"implementations and versions of Python and the code/libraries in use. Hence, " +"all three of these variations will work with the flag specified:" msgstr "" -#: ../../library/doctest.rst:642 +#: ../../library/doctest.rst:646 msgid "" ">>> raise Exception('message')\n" "Traceback (most recent call last):\n" @@ -1004,20 +1011,20 @@ msgstr "" "Traceback (most recent call last):\n" "__main__.Exception: message" -#: ../../library/doctest.rst:656 +#: ../../library/doctest.rst:660 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:660 +#: ../../library/doctest.rst:664 msgid "" ":const:`IGNORE_EXCEPTION_DETAIL` now also ignores any information relating " "to the module containing the exception under test." msgstr "" -#: ../../library/doctest.rst:667 +#: ../../library/doctest.rst:671 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, " @@ -1026,32 +1033,32 @@ msgid "" "might depend on resources which would be unavailable to the test driver." msgstr "" -#: ../../library/doctest.rst:673 +#: ../../library/doctest.rst:677 msgid "" "The SKIP flag can also be used for temporarily \"commenting out\" examples." msgstr "" -#: ../../library/doctest.rst:678 +#: ../../library/doctest.rst:682 msgid "A bitmask or'ing together all the comparison flags above." msgstr "" -#: ../../library/doctest.rst:680 +#: ../../library/doctest.rst:684 msgid "The second group of options controls how test failures are reported:" msgstr "" -#: ../../library/doctest.rst:685 +#: ../../library/doctest.rst:689 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "are displayed using a unified diff." msgstr "" -#: ../../library/doctest.rst:691 +#: ../../library/doctest.rst:695 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "will be displayed using a context diff." msgstr "" -#: ../../library/doctest.rst:697 +#: ../../library/doctest.rst:701 msgid "" "When specified, differences are computed by ``difflib.Differ``, using the " "same algorithm as the popular :file:`ndiff.py` utility. This is the only " @@ -1061,7 +1068,7 @@ msgid "" "mismatching column positions." msgstr "" -#: ../../library/doctest.rst:706 +#: ../../library/doctest.rst:710 msgid "" "When specified, display the first failing example in each doctest, but " "suppress output for all remaining examples. This will prevent doctest from " @@ -1072,7 +1079,7 @@ msgid "" "of failures reported; only the output is suppressed." msgstr "" -#: ../../library/doctest.rst:717 +#: ../../library/doctest.rst:721 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 " @@ -1080,58 +1087,58 @@ msgid "" "first failure won't even produce debugging output." msgstr "" -#: ../../library/doctest.rst:725 +#: ../../library/doctest.rst:729 msgid "A bitmask or'ing together all the reporting flags above." msgstr "" -#: ../../library/doctest.rst:728 +#: ../../library/doctest.rst:732 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:734 +#: ../../library/doctest.rst:738 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 :" -"class:`OutputChecker` or :class:`DocTestRunner` to create new options that " -"are supported by your subclasses. :func:`register_optionflag` should always " -"be called using the following idiom::" +"integer value. :func:`register_optionflag` can be used when " +"subclassing :class:`OutputChecker` or :class:`DocTestRunner` to create new " +"options that are supported by your subclasses. :func:`register_optionflag` " +"should always be called using the following idiom::" msgstr "" -#: ../../library/doctest.rst:740 +#: ../../library/doctest.rst:744 msgid "MY_FLAG = register_optionflag('MY_FLAG')" msgstr "MY_FLAG = register_optionflag('MY_FLAG')" -#: ../../library/doctest.rst:750 +#: ../../library/doctest.rst:754 msgid "Directives" msgstr "" -#: ../../library/doctest.rst:752 +#: ../../library/doctest.rst:756 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:763 +#: ../../library/doctest.rst:767 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:767 +#: ../../library/doctest.rst:771 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:770 +#: ../../library/doctest.rst:774 msgid "For example, this test passes:" msgstr "舉例來說,這個測試會通過:" -#: ../../library/doctest.rst:772 +#: ../../library/doctest.rst:776 msgid "" ">>> print(list(range(20))) # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n" @@ -1141,7 +1148,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:779 +#: ../../library/doctest.rst:783 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 " @@ -1149,7 +1156,7 @@ msgid "" "a directive to do so:" msgstr "" -#: ../../library/doctest.rst:784 +#: ../../library/doctest.rst:788 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "[0, 1, ..., 18, 19]" @@ -1157,13 +1164,13 @@ msgstr "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:790 +#: ../../library/doctest.rst:794 msgid "" "Multiple directives can be used on a single physical line, separated by " "commas:" msgstr "" -#: ../../library/doctest.rst:793 +#: ../../library/doctest.rst:797 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" @@ -1171,13 +1178,13 @@ msgstr "" ">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:799 +#: ../../library/doctest.rst:803 msgid "" "If multiple directive comments are used for a single example, then they are " "combined:" msgstr "" -#: ../../library/doctest.rst:802 +#: ../../library/doctest.rst:806 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "... # doctest: +NORMALIZE_WHITESPACE\n" @@ -1187,14 +1194,14 @@ msgstr "" "... # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:809 +#: ../../library/doctest.rst:813 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:813 +#: ../../library/doctest.rst:817 msgid "" ">>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))\n" "... # doctest: +ELLIPSIS\n" @@ -1204,7 +1211,7 @@ msgstr "" "... # doctest: +ELLIPSIS\n" "[0, ..., 4, 10, ..., 19, 30, ..., 39]" -#: ../../library/doctest.rst:820 +#: ../../library/doctest.rst:824 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 " @@ -1214,11 +1221,11 @@ msgid "" "be useful." msgstr "" -#: ../../library/doctest.rst:830 +#: ../../library/doctest.rst:834 msgid "Warnings" msgstr "警告" -#: ../../library/doctest.rst:832 +#: ../../library/doctest.rst:836 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 " @@ -1228,7 +1235,7 @@ msgid "" "test like ::" msgstr "" -#: ../../library/doctest.rst:838 +#: ../../library/doctest.rst:842 msgid "" ">>> foo()\n" "{\"spam\", \"eggs\"}" @@ -1236,11 +1243,11 @@ msgstr "" ">>> foo()\n" "{\"spam\", \"eggs\"}" -#: ../../library/doctest.rst:841 +#: ../../library/doctest.rst:845 msgid "is vulnerable! One workaround is to do ::" msgstr "" -#: ../../library/doctest.rst:843 +#: ../../library/doctest.rst:847 msgid "" ">>> foo() == {\"spam\", \"eggs\"}\n" "True" @@ -1248,11 +1255,11 @@ msgstr "" ">>> foo() == {\"spam\", \"eggs\"}\n" "True" -#: ../../library/doctest.rst:846 +#: ../../library/doctest.rst:850 msgid "instead. Another is to do ::" msgstr "" -#: ../../library/doctest.rst:848 +#: ../../library/doctest.rst:852 msgid "" ">>> d = sorted(foo())\n" ">>> d\n" @@ -1262,15 +1269,15 @@ msgstr "" ">>> d\n" "['eggs', 'spam']" -#: ../../library/doctest.rst:852 +#: ../../library/doctest.rst:856 msgid "There are others, but you get the idea." msgstr "" -#: ../../library/doctest.rst:854 +#: ../../library/doctest.rst:858 msgid "Another bad idea is to print things that embed an object address, like" msgstr "" -#: ../../library/doctest.rst:856 +#: ../../library/doctest.rst:860 msgid "" ">>> id(1.0) # certain to fail some of the time\n" "7948648\n" @@ -1279,12 +1286,12 @@ msgid "" "" msgstr "" -#: ../../library/doctest.rst:864 +#: ../../library/doctest.rst:868 msgid "" "The :const:`ELLIPSIS` directive gives a nice approach for the last example:" msgstr "" -#: ../../library/doctest.rst:866 +#: ../../library/doctest.rst:870 msgid "" ">>> C() # doctest: +ELLIPSIS\n" "" @@ -1292,14 +1299,14 @@ msgstr "" ">>> C() # doctest: +ELLIPSIS\n" "" -#: ../../library/doctest.rst:872 +#: ../../library/doctest.rst:876 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:876 +#: ../../library/doctest.rst:880 msgid "" ">>> 1000**0.1 # risky\n" "1.9952623149688797\n" @@ -1309,29 +1316,29 @@ msgid "" "1.9953" msgstr "" -#: ../../library/doctest.rst:883 +#: ../../library/doctest.rst:887 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:886 +#: ../../library/doctest.rst:890 msgid "" ">>> 3./4 # utterly safe\n" "0.75" msgstr "" -#: ../../library/doctest.rst:889 +#: ../../library/doctest.rst:893 msgid "" "Simple fractions are also easier for people to understand, and that makes " "for better documentation." msgstr "" -#: ../../library/doctest.rst:896 +#: ../../library/doctest.rst:900 msgid "Basic API" msgstr "基礎 API" -#: ../../library/doctest.rst:898 +#: ../../library/doctest.rst:902 msgid "" "The functions :func:`testmod` and :func:`testfile` provide a simple " "interface to doctest that should be sufficient for most basic uses. For a " @@ -1339,25 +1346,25 @@ msgid "" "simple-testmod` and :ref:`doctest-simple-testfile`." msgstr "" -#: ../../library/doctest.rst:906 +#: ../../library/doctest.rst:910 msgid "" "All arguments except *filename* are optional, and should be specified in " "keyword form." msgstr "" -#: ../../library/doctest.rst:909 +#: ../../library/doctest.rst:913 msgid "" "Test examples in the file named *filename*. Return ``(failure_count, " "test_count)``." msgstr "" -#: ../../library/doctest.rst:912 +#: ../../library/doctest.rst:916 msgid "" "Optional argument *module_relative* specifies how the filename should be " "interpreted:" msgstr "" -#: ../../library/doctest.rst:915 +#: ../../library/doctest.rst:919 msgid "" "If *module_relative* is ``True`` (the default), then *filename* specifies an " "OS-independent module-relative path. By default, this path is relative to " @@ -1367,20 +1374,20 @@ msgid "" "absolute path (i.e., it may not begin with ``/``)." msgstr "" -#: ../../library/doctest.rst:922 +#: ../../library/doctest.rst:926 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:926 +#: ../../library/doctest.rst:930 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:929 +#: ../../library/doctest.rst:933 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-" @@ -1389,7 +1396,7 @@ msgid "" "is an error to specify *package* if *module_relative* is ``False``." msgstr "" -#: ../../library/doctest.rst:935 +#: ../../library/doctest.rst:939 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 " @@ -1397,7 +1404,7 @@ msgid "" "``None``, a new empty dict is used." msgstr "" -#: ../../library/doctest.rst:940 +#: ../../library/doctest.rst:944 msgid "" "Optional argument *extraglobs* gives a dict merged into the globals used to " "execute examples. This works like :meth:`dict.update`: if *globs* and " @@ -1410,27 +1417,28 @@ msgid "" "tested." msgstr "" -#: ../../library/doctest.rst:949 +#: ../../library/doctest.rst:953 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:953 +#: ../../library/doctest.rst:957 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:957 +#: ../../library/doctest.rst:961 msgid "" -"Optional argument *optionflags* (default value ``0``) takes the :ref:" -"`bitwise OR ` of option flags. See section :ref:`doctest-options`." +"Optional argument *optionflags* (default value ``0``) takes " +"the :ref:`bitwise OR ` of option flags. See section :ref:`doctest-" +"options`." msgstr "" -#: ../../library/doctest.rst:961 +#: ../../library/doctest.rst:965 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. " @@ -1438,99 +1446,99 @@ msgid "" "continue running examples." msgstr "" -#: ../../library/doctest.rst:966 ../../library/doctest.rst:1109 +#: ../../library/doctest.rst:970 ../../library/doctest.rst:1113 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:970 ../../library/doctest.rst:1113 +#: ../../library/doctest.rst:974 ../../library/doctest.rst:1117 msgid "" "Optional argument *encoding* specifies an encoding that should be used to " "convert the file to unicode." msgstr "" -#: ../../library/doctest.rst:976 +#: ../../library/doctest.rst:980 msgid "" "All arguments are optional, and all except for *m* should be specified in " "keyword form." msgstr "" -#: ../../library/doctest.rst:979 +#: ../../library/doctest.rst:983 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:983 +#: ../../library/doctest.rst:987 msgid "" -"Also test examples reachable from dict ``m.__test__``, if it exists. ``m." -"__test__`` maps names (strings) to functions, classes and strings; function " -"and class docstrings are searched for examples; strings are searched " -"directly, as if they were docstrings." +"Also test examples reachable from dict ``m.__test__``, if it exists. " +"``m.__test__`` maps names (strings) to functions, classes and strings; " +"function and class docstrings are searched for examples; strings are " +"searched directly, as if they were docstrings." msgstr "" -#: ../../library/doctest.rst:988 +#: ../../library/doctest.rst:992 msgid "" "Only docstrings attached to objects belonging to module *m* are searched." msgstr "" -#: ../../library/doctest.rst:990 +#: ../../library/doctest.rst:994 msgid "Return ``(failure_count, test_count)``." msgstr "回傳 ``(failure_count, test_count)``。" -#: ../../library/doctest.rst:992 +#: ../../library/doctest.rst:996 msgid "" "Optional argument *name* gives the name of the module; by default, or if " "``None``, ``m.__name__`` is used." msgstr "" -#: ../../library/doctest.rst:995 +#: ../../library/doctest.rst:999 msgid "" "Optional argument *exclude_empty* defaults to false. If true, objects for " "which no doctests are found are excluded from consideration. The default is " -"a backward compatibility hack, so that code still using :meth:`doctest." -"master.summarize ` in conjunction with :func:" -"`testmod` continues to get output for objects with no tests. The " -"*exclude_empty* argument to the newer :class:`DocTestFinder` constructor " -"defaults to true." +"a backward compatibility hack, so that code still " +"using :meth:`doctest.master.summarize ` in " +"conjunction with :func:`testmod` continues to get output for objects with no " +"tests. The *exclude_empty* argument to the newer :class:`DocTestFinder` " +"constructor defaults to true." msgstr "" -#: ../../library/doctest.rst:1003 +#: ../../library/doctest.rst:1007 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:1010 +#: ../../library/doctest.rst:1014 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:1013 +#: ../../library/doctest.rst:1017 msgid "" "A shallow copy of dictionary argument *globs* is used for the execution " "context." msgstr "" -#: ../../library/doctest.rst:1015 +#: ../../library/doctest.rst:1019 msgid "" "Optional argument *name* is used in failure messages, and defaults to " "``\"NoName\"``." msgstr "" -#: ../../library/doctest.rst:1018 +#: ../../library/doctest.rst:1022 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:1021 +#: ../../library/doctest.rst:1025 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 " @@ -1538,16 +1546,16 @@ msgid "" "found in *globs*." msgstr "" -#: ../../library/doctest.rst:1025 +#: ../../library/doctest.rst:1029 msgid "" "Optional argument *optionflags* works as for function :func:`testfile` above." msgstr "" -#: ../../library/doctest.rst:1031 +#: ../../library/doctest.rst:1035 msgid "Unittest API" msgstr "Unittest API" -#: ../../library/doctest.rst:1033 +#: ../../library/doctest.rst:1037 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 " @@ -1557,7 +1565,7 @@ msgid "" "your test module::" msgstr "" -#: ../../library/doctest.rst:1039 +#: ../../library/doctest.rst:1043 msgid "" "import unittest\n" "import doctest\n" @@ -1575,44 +1583,44 @@ msgstr "" " tests.addTests(doctest.DocTestSuite(my_module_with_doctests))\n" " return tests" -#: ../../library/doctest.rst:1047 +#: ../../library/doctest.rst:1051 msgid "" "There are two main functions for creating :class:`unittest.TestSuite` " "instances from text files and modules with doctests:" msgstr "" -#: ../../library/doctest.rst:1053 +#: ../../library/doctest.rst:1057 msgid "" -"Convert doctest tests from one or more text files to a :class:`unittest." -"TestSuite`." +"Convert doctest tests from one or more text files to " +"a :class:`unittest.TestSuite`." msgstr "" -#: ../../library/doctest.rst:1056 +#: ../../library/doctest.rst:1060 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 " -"any file fails, then the synthesized unit test fails, and a :exc:`~unittest." -"TestCase.failureException` exception is raised showing the name of the file " -"containing the test and a (sometimes approximate) line number. If all the " -"examples in a file are skipped, then the synthesized unit test is also " -"marked as skipped." +"any file fails, then the synthesized unit test fails, and " +"a :exc:`~unittest.TestCase.failureException` exception is raised showing the " +"name of the file containing the test and a (sometimes approximate) line " +"number. If all the examples in a file are skipped, then the synthesized " +"unit test is also marked as skipped." msgstr "" -#: ../../library/doctest.rst:1063 +#: ../../library/doctest.rst:1067 msgid "Pass one or more paths (as strings) to text files to be examined." msgstr "" -#: ../../library/doctest.rst:1065 +#: ../../library/doctest.rst:1069 msgid "Options may be provided as keyword arguments:" msgstr "" -#: ../../library/doctest.rst:1067 +#: ../../library/doctest.rst:1071 msgid "" "Optional argument *module_relative* specifies how the filenames in *paths* " "should be interpreted:" msgstr "" -#: ../../library/doctest.rst:1070 +#: ../../library/doctest.rst:1074 msgid "" "If *module_relative* is ``True`` (the default), then each filename in " "*paths* specifies an OS-independent module-relative path. By default, this " @@ -1623,14 +1631,14 @@ msgid "" "``)." msgstr "" -#: ../../library/doctest.rst:1078 +#: ../../library/doctest.rst:1082 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:1082 +#: ../../library/doctest.rst:1086 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-" @@ -1640,7 +1648,7 @@ msgid "" "``False``." msgstr "" -#: ../../library/doctest.rst:1089 +#: ../../library/doctest.rst:1093 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 " @@ -1648,7 +1656,7 @@ msgid "" "the test globals as the :attr:`~DocTest.globs` attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1094 +#: ../../library/doctest.rst:1098 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* " @@ -1657,32 +1665,33 @@ msgid "" "test passed." msgstr "" -#: ../../library/doctest.rst:1100 +#: ../../library/doctest.rst:1104 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:1104 +#: ../../library/doctest.rst:1108 msgid "" "Optional argument *optionflags* specifies the default doctest options for " -"the tests, created by or-ing together individual option flags. See section :" -"ref:`doctest-options`. See function :func:`set_unittest_reportflags` below " -"for a better way to set reporting options." +"the tests, created by or-ing together individual option flags. See " +"section :ref:`doctest-options`. See " +"function :func:`set_unittest_reportflags` below for a better way to set " +"reporting options." msgstr "" -#: ../../library/doctest.rst:1116 +#: ../../library/doctest.rst:1120 msgid "" "The global ``__file__`` is added to the globals provided to doctests loaded " "from a text file using :func:`DocFileSuite`." msgstr "" -#: ../../library/doctest.rst:1122 +#: ../../library/doctest.rst:1126 msgid "Convert doctest tests for a module to a :class:`unittest.TestSuite`." msgstr "" -#: ../../library/doctest.rst:1124 +#: ../../library/doctest.rst:1128 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 " @@ -1693,50 +1702,50 @@ msgid "" "then the" msgstr "" -#: ../../library/doctest.rst:1132 +#: ../../library/doctest.rst:1136 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:1136 +#: ../../library/doctest.rst:1140 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:1140 +#: ../../library/doctest.rst:1144 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:1143 +#: ../../library/doctest.rst:1147 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:1146 +#: ../../library/doctest.rst:1150 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:1149 +#: ../../library/doctest.rst:1153 msgid "This function uses the same search technique as :func:`testmod`." msgstr "" -#: ../../library/doctest.rst:1151 +#: ../../library/doctest.rst:1155 msgid "" ":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if " "*module* contains no docstrings instead of raising :exc:`ValueError`." msgstr "" -#: ../../library/doctest.rst:1155 +#: ../../library/doctest.rst:1159 msgid "" "Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` " "out of :class:`!doctest.DocTestCase` instances, and :class:`!DocTestCase` is " @@ -1745,18 +1754,18 @@ msgid "" "questions about the exact details of :mod:`unittest` integration." msgstr "" -#: ../../library/doctest.rst:1161 +#: ../../library/doctest.rst:1165 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:1165 +#: ../../library/doctest.rst:1169 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 :" -"mod:`doctest` functions yourself, you can control the :mod:`!doctest` " +"So both ways of creating a :class:`unittest.TestSuite` run instances " +"of :class:`!DocTestCase`. This is important for a subtle reason: when you " +"run :mod:`doctest` functions yourself, you can control the :mod:`!doctest` " "options in use directly, by passing option flags to :mod:`!doctest` " "functions. However, if you're writing a :mod:`unittest` framework, :mod:`!" "unittest` ultimately controls when and how tests get run. The framework " @@ -1765,47 +1774,48 @@ msgid "" "pass options through :mod:`!unittest` to :mod:`!doctest` test runners." msgstr "" -#: ../../library/doctest.rst:1175 +#: ../../library/doctest.rst:1179 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:1181 +#: ../../library/doctest.rst:1185 msgid "Set the :mod:`doctest` reporting flags to use." msgstr "" -#: ../../library/doctest.rst:1183 +#: ../../library/doctest.rst:1187 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:1186 +#: ../../library/doctest.rst:1190 msgid "" "This is a module-global setting, and affects all future doctests run by " "module :mod:`unittest`: the :meth:`!runTest` method of :class:`!" -"DocTestCase` looks at the option flags specified for the test case when the :" -"class:`!DocTestCase` instance was constructed. If no reporting flags were " -"specified (which is the typical and expected case), :mod:`!doctest`'s :mod:`!" -"unittest` reporting flags are :ref:`bitwise ORed ` into the option " -"flags, and the option flags so augmented are passed to the :class:" -"`DocTestRunner` instance created to run the doctest. If any reporting flags " -"were specified when the :class:`!DocTestCase` instance was constructed, :mod:" -"`!doctest`'s :mod:`!unittest` reporting flags are ignored." +"DocTestCase` looks at the option flags specified for the test case when " +"the :class:`!DocTestCase` instance was constructed. If no reporting flags " +"were specified (which is the typical and expected case), :mod:`!" +"doctest`'s :mod:`!unittest` reporting flags are :ref:`bitwise ORed " +"` into the option flags, and the option flags so augmented are " +"passed to the :class:`DocTestRunner` instance created to run the doctest. " +"If any reporting flags were specified when the :class:`!DocTestCase` " +"instance was constructed, :mod:`!doctest`'s :mod:`!unittest` reporting flags " +"are ignored." msgstr "" -#: ../../library/doctest.rst:1197 +#: ../../library/doctest.rst:1201 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:1204 +#: ../../library/doctest.rst:1208 msgid "Advanced API" msgstr "" -#: ../../library/doctest.rst:1206 +#: ../../library/doctest.rst:1210 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 " @@ -1813,62 +1823,62 @@ msgid "" "doctest's capabilities, then you should use the advanced API." msgstr "" -#: ../../library/doctest.rst:1211 +#: ../../library/doctest.rst:1215 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:1214 +#: ../../library/doctest.rst:1218 msgid "" ":class:`Example`: A single Python :term:`statement`, paired with its " "expected output." msgstr "" -#: ../../library/doctest.rst:1217 +#: ../../library/doctest.rst:1221 msgid "" ":class:`DocTest`: A collection of :class:`Example`\\ s, typically extracted " "from a single docstring or text file." msgstr "" -#: ../../library/doctest.rst:1220 +#: ../../library/doctest.rst:1224 msgid "" "Additional processing classes are defined to find, parse, and run, and check " "doctest examples:" msgstr "" -#: ../../library/doctest.rst:1223 +#: ../../library/doctest.rst:1227 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." +":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:1227 +#: ../../library/doctest.rst:1231 msgid "" ":class:`DocTestParser`: Creates a :class:`DocTest` object from a string " "(such as an object's docstring)." msgstr "" -#: ../../library/doctest.rst:1230 +#: ../../library/doctest.rst:1234 msgid "" ":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and " "uses an :class:`OutputChecker` to verify their output." msgstr "" -#: ../../library/doctest.rst:1233 +#: ../../library/doctest.rst:1237 msgid "" ":class:`OutputChecker`: Compares the actual output from a doctest example " "with the expected output, and decides whether they match." msgstr "" -#: ../../library/doctest.rst:1236 +#: ../../library/doctest.rst:1240 msgid "" "The relationships among these processing classes are summarized in the " "following diagram::" msgstr "" -#: ../../library/doctest.rst:1239 +#: ../../library/doctest.rst:1243 msgid "" " list of:\n" "+------+ +---------+\n" @@ -1888,88 +1898,88 @@ msgstr "" " DocTestParser | Example | OutputChecker\n" " +---------+" -#: ../../library/doctest.rst:1252 +#: ../../library/doctest.rst:1256 msgid "DocTest Objects" msgstr "DocTest 物件" -#: ../../library/doctest.rst:1257 +#: ../../library/doctest.rst:1261 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:1261 +#: ../../library/doctest.rst:1265 msgid "" ":class:`DocTest` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1267 +#: ../../library/doctest.rst:1271 msgid "" "A list of :class:`Example` objects encoding the individual interactive " "Python examples that should be run by this test." msgstr "" -#: ../../library/doctest.rst:1273 +#: ../../library/doctest.rst:1277 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 " -"the examples (such as binding new variables) will be reflected in :attr:" -"`globs` after the test is run." +"the examples (such as binding new variables) will be reflected " +"in :attr:`globs` after the test is run." msgstr "" -#: ../../library/doctest.rst:1281 +#: ../../library/doctest.rst:1285 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:1287 +#: ../../library/doctest.rst:1291 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:1294 +#: ../../library/doctest.rst:1298 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:1301 +#: ../../library/doctest.rst:1305 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:1308 +#: ../../library/doctest.rst:1312 msgid "Example Objects" msgstr "Example 物件" -#: ../../library/doctest.rst:1313 +#: ../../library/doctest.rst:1317 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:1318 +#: ../../library/doctest.rst:1322 msgid "" ":class:`Example` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1324 +#: ../../library/doctest.rst:1328 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:1331 +#: ../../library/doctest.rst:1335 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 " @@ -1977,29 +1987,29 @@ msgid "" "The constructor adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1339 +#: ../../library/doctest.rst:1343 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 " -"exception. This exception message is compared against the return value of :" -"func:`traceback.format_exception_only`. :attr:`exc_msg` ends with a newline " -"unless it's ``None``. The constructor adds a newline if needed." +"exception. This exception message is compared against the return value " +"of :func:`traceback.format_exception_only`. :attr:`exc_msg` ends with a " +"newline unless it's ``None``. The constructor adds a newline if needed." msgstr "" -#: ../../library/doctest.rst:1348 +#: ../../library/doctest.rst:1352 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:1355 +#: ../../library/doctest.rst:1359 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:1361 +#: ../../library/doctest.rst:1365 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 " @@ -2008,11 +2018,11 @@ msgid "" "default, no options are set." msgstr "" -#: ../../library/doctest.rst:1371 +#: ../../library/doctest.rst:1375 msgid "DocTestFinder objects" msgstr "DocTestFinder 物件" -#: ../../library/doctest.rst:1376 +#: ../../library/doctest.rst:1380 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 " @@ -2020,48 +2030,49 @@ msgid "" "classes, functions, methods, staticmethods, classmethods, and properties." msgstr "" -#: ../../library/doctest.rst:1381 +#: ../../library/doctest.rst:1385 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:1384 +#: ../../library/doctest.rst:1388 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:1387 +#: ../../library/doctest.rst:1391 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:1390 +#: ../../library/doctest.rst:1394 msgid "" -"If the optional argument *exclude_empty* is false, then :meth:`DocTestFinder." -"find` will include tests for objects with empty docstrings." +"If the optional argument *exclude_empty* is false, " +"then :meth:`DocTestFinder.find` will include tests for objects with empty " +"docstrings." msgstr "" -#: ../../library/doctest.rst:1394 +#: ../../library/doctest.rst:1398 msgid ":class:`DocTestFinder` defines the following method:" msgstr ":class:`DocTestFinder` 定義了以下方法:" -#: ../../library/doctest.rst:1399 +#: ../../library/doctest.rst:1403 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:1402 +#: ../../library/doctest.rst:1406 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:1406 +#: ../../library/doctest.rst:1410 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 " @@ -2069,26 +2080,26 @@ msgid "" "module is used:" msgstr "" -#: ../../library/doctest.rst:1410 +#: ../../library/doctest.rst:1414 msgid "As a default namespace, if *globs* is not specified." msgstr "" -#: ../../library/doctest.rst:1412 +#: ../../library/doctest.rst:1416 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:1416 +#: ../../library/doctest.rst:1420 msgid "To find the name of the file containing the object." msgstr "" -#: ../../library/doctest.rst:1418 +#: ../../library/doctest.rst:1422 msgid "To help find the line number of the object within its file." msgstr "" -#: ../../library/doctest.rst:1420 +#: ../../library/doctest.rst:1424 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 " @@ -2097,44 +2108,44 @@ msgid "" "contained objects will (recursively) be searched for doctests." msgstr "" -#: ../../library/doctest.rst:1426 +#: ../../library/doctest.rst:1430 msgid "" "The globals for each :class:`DocTest` is formed by combining *globs* and " "*extraglobs* (bindings in *extraglobs* override bindings in *globs*). A new " "shallow copy of the globals dictionary is created for each :class:`!" -"DocTest`. If *globs* is not specified, then it defaults to the module's :" -"attr:`~module.__dict__`, if specified, or ``{}`` otherwise. If *extraglobs* " -"is not specified, then it defaults to ``{}``." +"DocTest`. If *globs* is not specified, then it defaults to the " +"module's :attr:`~module.__dict__`, if specified, or ``{}`` otherwise. If " +"*extraglobs* is not specified, then it defaults to ``{}``." msgstr "" -#: ../../library/doctest.rst:1437 +#: ../../library/doctest.rst:1441 msgid "DocTestParser objects" msgstr "DocTestParser 物件" -#: ../../library/doctest.rst:1442 +#: ../../library/doctest.rst:1446 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:1446 +#: ../../library/doctest.rst:1450 msgid ":class:`DocTestParser` defines the following methods:" msgstr ":class:`DocTestParser` 定義了以下方法:" -#: ../../library/doctest.rst:1451 +#: ../../library/doctest.rst:1455 msgid "" -"Extract all doctest examples from the given string, and collect them into a :" -"class:`DocTest` object." +"Extract all doctest examples from the given string, and collect them into " +"a :class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1454 +#: ../../library/doctest.rst:1458 msgid "" -"*globs*, *name*, *filename*, and *lineno* are attributes for the new :class:" -"`!DocTest` object. See the documentation for :class:`DocTest` for more " -"information." +"*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:1461 +#: ../../library/doctest.rst:1465 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 " @@ -2142,7 +2153,7 @@ msgid "" "error messages." msgstr "" -#: ../../library/doctest.rst:1468 +#: ../../library/doctest.rst:1472 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 " @@ -2150,146 +2161,149 @@ msgid "" "name identifying this string, and is only used for error messages." msgstr "" -#: ../../library/doctest.rst:1475 +#: ../../library/doctest.rst:1479 msgid "TestResults objects" msgstr "TestResults 物件" -#: ../../library/doctest.rst:1482 +#: ../../library/doctest.rst:1486 msgid "Number of failed tests." msgstr "失敗的測試數量。" -#: ../../library/doctest.rst:1486 +#: ../../library/doctest.rst:1490 msgid "Number of attempted tests." msgstr "嘗試的測試數量。" -#: ../../library/doctest.rst:1490 +#: ../../library/doctest.rst:1494 msgid "Number of skipped tests." msgstr "跳過的測試數量。" -#: ../../library/doctest.rst:1498 +#: ../../library/doctest.rst:1502 msgid "DocTestRunner objects" msgstr "DocTestRunner 物件" -#: ../../library/doctest.rst:1503 +#: ../../library/doctest.rst:1507 msgid "" -"A processing class used to execute and verify the interactive examples in a :" -"class:`DocTest`." +"A processing class used to execute and verify the interactive examples in " +"a :class:`DocTest`." msgstr "" -#: ../../library/doctest.rst:1506 +#: ../../library/doctest.rst:1510 msgid "" -"The comparison between expected outputs and actual outputs is done by an :" -"class:`OutputChecker`. This comparison may be customized with a number of " -"option flags; see section :ref:`doctest-options` for more information. If " -"the option flags are insufficient, then the comparison may also be " +"The comparison between expected outputs and actual outputs is done by " +"an :class:`OutputChecker`. This comparison may be customized with a number " +"of option flags; see section :ref:`doctest-options` for more information. " +"If the option flags are insufficient, then the comparison may also be " "customized by passing a subclass of :class:`!OutputChecker` to the " "constructor." msgstr "" -#: ../../library/doctest.rst:1512 +#: ../../library/doctest.rst:1516 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 " -"with strings that should be displayed. It defaults to ``sys.stdout." -"write``. If capturing the output is not sufficient, then the display output " -"can be also customized by subclassing DocTestRunner, and overriding the " -"methods :meth:`report_start`, :meth:`report_success`, :meth:" -"`report_unexpected_exception`, and :meth:`report_failure`." +"with strings that should be displayed. It defaults to " +"``sys.stdout.write``. If capturing the output is not sufficient, then the " +"display output can be also customized by subclassing DocTestRunner, and " +"overriding the " +"methods :meth:`report_start`, :meth:`report_success`, :meth:`report_unexpected_exception`, " +"and :meth:`report_failure`." msgstr "" -#: ../../library/doctest.rst:1520 +#: ../../library/doctest.rst:1524 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:1524 +#: ../../library/doctest.rst:1528 msgid "" -"The optional keyword argument *verbose* controls the :class:" -"`DocTestRunner`'s verbosity. If *verbose* is ``True``, then information is " -"printed about each example, as it is run. If *verbose* is ``False``, then " -"only failures are printed. If *verbose* is unspecified, or ``None``, then " -"verbose output is used iff the command-line switch ``-v`` is used." +"The optional keyword argument *verbose* controls " +"the :class:`DocTestRunner`'s verbosity. If *verbose* is ``True``, then " +"information is printed about each example, as it is run. If *verbose* is " +"``False``, then only failures are printed. If *verbose* is unspecified, or " +"``None``, then verbose output is used iff the command-line switch ``-v`` is " +"used." msgstr "" -#: ../../library/doctest.rst:1530 +#: ../../library/doctest.rst:1534 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:1534 +#: ../../library/doctest.rst:1538 msgid "" "The test runner accumulates statistics. The aggregated number of attempted, " -"failed and skipped examples is also available via the :attr:`tries`, :attr:" -"`failures` and :attr:`skips` attributes. The :meth:`run` and :meth:" -"`summarize` methods return a :class:`TestResults` instance." +"failed and skipped examples is also available via " +"the :attr:`tries`, :attr:`failures` and :attr:`skips` attributes. " +"The :meth:`run` and :meth:`summarize` methods return a :class:`TestResults` " +"instance." msgstr "" -#: ../../library/doctest.rst:1539 +#: ../../library/doctest.rst:1543 msgid ":class:`DocTestRunner` defines the following methods:" msgstr ":class:`DocTestRunner` 定義了以下方法:" -#: ../../library/doctest.rst:1544 +#: ../../library/doctest.rst:1548 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:1548 +#: ../../library/doctest.rst:1552 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`." +"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 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:1559 ../../library/doctest.rst:1570 +#: ../../library/doctest.rst:1563 ../../library/doctest.rst:1574 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:1566 +#: ../../library/doctest.rst:1570 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:1577 +#: ../../library/doctest.rst:1581 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:1581 +#: ../../library/doctest.rst:1585 msgid "" "*example* is the example about to be processed. *exc_info* is a tuple " -"containing information about the unexpected exception (as returned by :func:" -"`sys.exc_info`). *test* is the test containing *example*. *out* is the " -"output function that was passed to :meth:`DocTestRunner.run`." +"containing information about the unexpected exception (as returned " +"by :func:`sys.exc_info`). *test* is the test containing *example*. *out* is " +"the output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1589 +#: ../../library/doctest.rst:1593 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:1593 +#: ../../library/doctest.rst:1597 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, " @@ -2297,97 +2311,97 @@ msgid "" "after the test completes, then use *clear_globs=False*." msgstr "" -#: ../../library/doctest.rst:1598 +#: ../../library/doctest.rst:1602 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:1602 +#: ../../library/doctest.rst:1606 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." +"output checker, and the results are formatted by the :meth:`!" +"DocTestRunner.report_\\*` methods." msgstr "" -#: ../../library/doctest.rst:1609 +#: ../../library/doctest.rst:1613 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:1612 +#: ../../library/doctest.rst:1616 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:1616 +#: ../../library/doctest.rst:1620 msgid ":class:`DocTestParser` has the following attributes:" msgstr ":class:`DocTestParser` 有以下屬性:" -#: ../../library/doctest.rst:1620 +#: ../../library/doctest.rst:1624 msgid "Number of attempted examples." msgstr "嘗試的範例數量。" -#: ../../library/doctest.rst:1624 +#: ../../library/doctest.rst:1628 msgid "Number of failed examples." msgstr "失敗的範例數量。" -#: ../../library/doctest.rst:1628 +#: ../../library/doctest.rst:1632 msgid "Number of skipped examples." msgstr "跳過的範例數量。" -#: ../../library/doctest.rst:1636 +#: ../../library/doctest.rst:1640 msgid "OutputChecker objects" msgstr "OutputChecker 物件" -#: ../../library/doctest.rst:1641 +#: ../../library/doctest.rst:1645 msgid "" "A class used to check the whether the actual output from a doctest example " -"matches the expected output. :class:`OutputChecker` defines two methods: :" -"meth:`check_output`, which compares a given pair of outputs, and returns " -"``True`` if they match; and :meth:`output_difference`, which returns a " -"string describing the differences between two outputs." +"matches the expected output. :class:`OutputChecker` defines two " +"methods: :meth:`check_output`, which compares a given pair of outputs, and " +"returns ``True`` if they match; and :meth:`output_difference`, which returns " +"a string describing the differences between two outputs." msgstr "" -#: ../../library/doctest.rst:1648 +#: ../../library/doctest.rst:1652 msgid ":class:`OutputChecker` defines the following methods:" msgstr ":class:`OutputChecker` 定義了以下方法:" -#: ../../library/doctest.rst:1652 +#: ../../library/doctest.rst:1656 msgid "" "Return ``True`` iff the actual output from an example (*got*) matches the " "expected output (*want*). These strings are always considered to match if " "they are identical; but depending on what option flags the test runner is " -"using, several non-exact match types are also possible. See section :ref:" -"`doctest-options` for more information about option flags." +"using, several non-exact match types are also possible. See " +"section :ref:`doctest-options` for more information about option flags." msgstr "" -#: ../../library/doctest.rst:1661 +#: ../../library/doctest.rst:1665 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:1669 +#: ../../library/doctest.rst:1673 msgid "Debugging" msgstr "偵錯" -#: ../../library/doctest.rst:1671 +#: ../../library/doctest.rst:1675 msgid "Doctest provides several mechanisms for debugging doctest examples:" msgstr "Doctest 提供了幾種偵錯 doctest 範例的機制:" -#: ../../library/doctest.rst:1673 +#: ../../library/doctest.rst:1677 msgid "" "Several functions convert doctests to executable Python programs, which can " "be run under the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1676 +#: ../../library/doctest.rst:1680 msgid "" "The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that " "raises an exception for the first failing example, containing information " @@ -2395,21 +2409,21 @@ msgid "" "debugging on the example." msgstr "" -#: ../../library/doctest.rst:1681 +#: ../../library/doctest.rst:1685 msgid "" -"The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :" -"meth:`debug` method defined by :class:`unittest.TestCase`." +"The :mod:`unittest` cases generated by :func:`DocTestSuite` support " +"the :meth:`debug` method defined by :class:`unittest.TestCase`." msgstr "" -#: ../../library/doctest.rst:1684 +#: ../../library/doctest.rst:1688 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 " -"inspect current values of variables, and so on. For example, suppose :file:" -"`a.py` contains just this module docstring::" +"inspect current values of variables, and so on. For example, " +"suppose :file:`a.py` contains just this module docstring::" msgstr "" -#: ../../library/doctest.rst:1689 +#: ../../library/doctest.rst:1693 msgid "" "\"\"\"\n" ">>> def f(x):\n" @@ -2431,11 +2445,11 @@ msgstr "" "9\n" "\"\"\"" -#: ../../library/doctest.rst:1699 +#: ../../library/doctest.rst:1703 msgid "Then an interactive Python session may look like this::" msgstr "" -#: ../../library/doctest.rst:1701 +#: ../../library/doctest.rst:1705 msgid "" ">>> import a, doctest\n" ">>> doctest.testmod(a)\n" @@ -2497,17 +2511,17 @@ msgstr "" "(0, 3)\n" ">>>" -#: ../../library/doctest.rst:1732 +#: ../../library/doctest.rst:1736 msgid "" "Functions that convert doctests to Python code, and possibly run the " "synthesized code under the debugger:" msgstr "" -#: ../../library/doctest.rst:1738 +#: ../../library/doctest.rst:1742 msgid "Convert text with examples to a script." msgstr "" -#: ../../library/doctest.rst:1740 +#: ../../library/doctest.rst:1744 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 " @@ -2515,7 +2529,7 @@ msgid "" "generated script is returned as a string. For example, ::" msgstr "" -#: ../../library/doctest.rst:1745 +#: ../../library/doctest.rst:1749 msgid "" "import doctest\n" "print(doctest.script_from_examples(r\"\"\"\n" @@ -2528,11 +2542,11 @@ msgid "" "\"\"\"))" msgstr "" -#: ../../library/doctest.rst:1755 +#: ../../library/doctest.rst:1759 msgid "displays::" msgstr "" -#: ../../library/doctest.rst:1757 +#: ../../library/doctest.rst:1761 msgid "" "# Set x and y to 1 and 2.\n" "x, y = 1, 2\n" @@ -2543,18 +2557,18 @@ msgid "" "## 3" msgstr "" -#: ../../library/doctest.rst:1765 +#: ../../library/doctest.rst:1769 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:1772 +#: ../../library/doctest.rst:1776 msgid "Convert the doctest for an object to a script." msgstr "" -#: ../../library/doctest.rst:1774 +#: ../../library/doctest.rst:1778 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 " @@ -2564,7 +2578,7 @@ msgid "" "module :file:`a.py` contains a top-level function :func:`!f`, then ::" msgstr "" -#: ../../library/doctest.rst:1781 +#: ../../library/doctest.rst:1785 msgid "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" @@ -2572,66 +2586,66 @@ msgstr "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" -#: ../../library/doctest.rst:1784 +#: ../../library/doctest.rst:1788 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:1790 +#: ../../library/doctest.rst:1794 msgid "Debug the doctests for an object." msgstr "" -#: ../../library/doctest.rst:1792 +#: ../../library/doctest.rst:1796 msgid "" -"The *module* and *name* arguments are the same as for function :func:" -"`testsource` above. The synthesized Python script for the named object's " -"docstring is written to a temporary file, and then that file is run under " -"the control of the Python debugger, :mod:`pdb`." +"The *module* and *name* arguments are the same as for " +"function :func:`testsource` above. The synthesized Python script for the " +"named object's docstring is written to a temporary file, and then that file " +"is run under the control of the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1797 +#: ../../library/doctest.rst:1801 msgid "" "A shallow copy of ``module.__dict__`` is used for both local and global " "execution context." msgstr "" -#: ../../library/doctest.rst:1800 +#: ../../library/doctest.rst:1804 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 " "gets involved only if the script terminates via raising an unhandled " -"exception. If it does, then post-mortem debugging is invoked, via :func:" -"`pdb.post_mortem`, passing the traceback object from the unhandled " +"exception. If it does, then post-mortem debugging is invoked, " +"via :func:`pdb.post_mortem`, passing the traceback object from the unhandled " "exception. If *pm* is not specified, or is false, the script is run under " "the debugger from the start, via passing an appropriate :func:`exec` call " "to :func:`pdb.run`." msgstr "" -#: ../../library/doctest.rst:1811 +#: ../../library/doctest.rst:1815 msgid "Debug the doctests in a string." msgstr "" -#: ../../library/doctest.rst:1813 +#: ../../library/doctest.rst:1817 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:1816 +#: ../../library/doctest.rst:1820 msgid "" "Optional argument *pm* has the same meaning as in function :func:`debug` " "above." msgstr "" -#: ../../library/doctest.rst:1818 +#: ../../library/doctest.rst:1822 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:1823 +#: ../../library/doctest.rst:1827 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 " @@ -2639,99 +2653,99 @@ msgid "" "(which is a doctest!) for more details:" msgstr "" -#: ../../library/doctest.rst:1831 +#: ../../library/doctest.rst:1835 msgid "" "A subclass of :class:`DocTestRunner` that raises an exception as soon as a " -"failure is encountered. If an unexpected exception occurs, an :exc:" -"`UnexpectedException` exception is raised, containing the test, the example, " -"and the original exception. If the output doesn't match, then a :exc:" -"`DocTestFailure` exception is raised, containing the test, the example, and " -"the actual output." +"failure is encountered. If an unexpected exception occurs, " +"an :exc:`UnexpectedException` exception is raised, containing the test, the " +"example, and the original exception. If the output doesn't match, then " +"a :exc:`DocTestFailure` exception is raised, containing the test, the " +"example, and the actual output." msgstr "" -#: ../../library/doctest.rst:1838 +#: ../../library/doctest.rst:1842 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:1841 +#: ../../library/doctest.rst:1845 msgid "" "There are two exceptions that may be raised by :class:`DebugRunner` " "instances:" msgstr "" -#: ../../library/doctest.rst:1846 +#: ../../library/doctest.rst:1850 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:1850 +#: ../../library/doctest.rst:1854 msgid ":exc:`DocTestFailure` defines the following attributes:" msgstr ":exc:`DocTestFailure` 定義了以下屬性:" -#: ../../library/doctest.rst:1855 ../../library/doctest.rst:1879 +#: ../../library/doctest.rst:1859 ../../library/doctest.rst:1883 msgid "The :class:`DocTest` object that was being run when the example failed." msgstr "" -#: ../../library/doctest.rst:1860 ../../library/doctest.rst:1884 +#: ../../library/doctest.rst:1864 ../../library/doctest.rst:1888 msgid "The :class:`Example` that failed." msgstr "" -#: ../../library/doctest.rst:1865 +#: ../../library/doctest.rst:1869 msgid "The example's actual output." msgstr "" -#: ../../library/doctest.rst:1870 +#: ../../library/doctest.rst:1874 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:1874 +#: ../../library/doctest.rst:1878 msgid ":exc:`UnexpectedException` defines the following attributes:" msgstr ":exc:`UnexpectedException` 定義了以下屬性:" -#: ../../library/doctest.rst:1889 +#: ../../library/doctest.rst:1893 msgid "" "A tuple containing information about the unexpected exception, as returned " "by :func:`sys.exc_info`." msgstr "" -#: ../../library/doctest.rst:1896 +#: ../../library/doctest.rst:1900 msgid "Soapbox" msgstr "" -#: ../../library/doctest.rst:1898 +#: ../../library/doctest.rst:1902 msgid "" "As mentioned in the introduction, :mod:`doctest` has grown to have three " "primary uses:" msgstr "" -#: ../../library/doctest.rst:1901 +#: ../../library/doctest.rst:1905 msgid "Checking examples in docstrings." msgstr "" -#: ../../library/doctest.rst:1903 +#: ../../library/doctest.rst:1907 msgid "Regression testing." msgstr "回歸測試。" -#: ../../library/doctest.rst:1905 +#: ../../library/doctest.rst:1909 msgid "Executable documentation / literate testing." msgstr "" -#: ../../library/doctest.rst:1907 +#: ../../library/doctest.rst:1911 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:1911 +#: ../../library/doctest.rst:1915 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. " @@ -2743,7 +2757,7 @@ msgid "" "\"harmless\" change." msgstr "" -#: ../../library/doctest.rst:1919 +#: ../../library/doctest.rst:1923 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 " @@ -2764,13 +2778,13 @@ msgid "" "different results, blurring the distinction between testing and explaining." msgstr "" -#: ../../library/doctest.rst:1937 +#: ../../library/doctest.rst:1941 msgid "" "Regression testing is best confined to dedicated objects or files. There " "are several options for organizing tests:" msgstr "" -#: ../../library/doctest.rst:1940 +#: ../../library/doctest.rst:1944 msgid "" "Write text files containing test cases as interactive examples, and test the " "files using :func:`testfile` or :func:`DocFileSuite`. This is recommended, " @@ -2778,7 +2792,7 @@ msgid "" "doctest." msgstr "" -#: ../../library/doctest.rst:1945 +#: ../../library/doctest.rst:1949 msgid "" "Define functions named ``_regrtest_topic`` that consist of single " "docstrings, containing test cases for the named topics. These functions can " @@ -2786,13 +2800,13 @@ msgid "" "test file." msgstr "" -#: ../../library/doctest.rst:1949 +#: ../../library/doctest.rst:1953 msgid "" "Define a :attr:`~module.__test__` dictionary mapping from regression test " "topics to docstrings containing test cases." msgstr "" -#: ../../library/doctest.rst:1952 +#: ../../library/doctest.rst:1956 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-" @@ -2800,7 +2814,7 @@ msgid "" "example of such a test runner::" msgstr "" -#: ../../library/doctest.rst:1957 +#: ../../library/doctest.rst:1961 msgid "" "if __name__ == '__main__':\n" " import doctest\n" @@ -2832,54 +2846,54 @@ msgstr "" " fail, total = doctest.testmod(optionflags=flags)\n" " print(f\"{fail} failures out of {total} tests\")" -#: ../../library/doctest.rst:1974 +#: ../../library/doctest.rst:1978 msgid "Footnotes" msgstr "註腳" -#: ../../library/doctest.rst:1975 +#: ../../library/doctest.rst:1979 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:383 +#: ../../library/doctest.rst:387 msgid ">>>" msgstr ">>>" -#: ../../library/doctest.rst:383 +#: ../../library/doctest.rst:387 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/doctest.rst:383 ../../library/doctest.rst:618 +#: ../../library/doctest.rst:387 ../../library/doctest.rst:622 msgid "..." msgstr "..." -#: ../../library/doctest.rst:549 +#: ../../library/doctest.rst:553 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/doctest.rst:549 +#: ../../library/doctest.rst:553 msgid "marker" msgstr "marker(標記)" -#: ../../library/doctest.rst:598 +#: ../../library/doctest.rst:602 msgid "" msgstr "" -#: ../../library/doctest.rst:618 ../../library/doctest.rst:743 +#: ../../library/doctest.rst:622 ../../library/doctest.rst:747 msgid "in doctests" msgstr "於 doctests 中" -#: ../../library/doctest.rst:743 +#: ../../library/doctest.rst:747 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/doctest.rst:743 +#: ../../library/doctest.rst:747 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../library/doctest.rst:743 +#: ../../library/doctest.rst:747 msgid "- (minus)" msgstr "- (減號)" diff --git a/library/email.utils.po b/library/email.utils.po index eb6c4dec6bc..cf165d9bc23 100644 --- a/library/email.utils.po +++ b/library/email.utils.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,33 +35,32 @@ msgstr "" #: ../../library/email.utils.rst:16 msgid "" "Return local time as an aware datetime object. If called without arguments, " -"return current time. Otherwise *dt* argument should be a :class:`~datetime." -"datetime` instance, and it is converted to the local time zone according to " -"the system time zone database. If *dt* is naive (that is, ``dt.tzinfo`` is " -"``None``), it is assumed to be in local time. The *isdst* parameter is " -"ignored." +"return current time. Otherwise *dt* argument should be " +"a :class:`~datetime.datetime` instance, and it is converted to the local " +"time zone according to the system time zone database. If *dt* is naive " +"(that is, ``dt.tzinfo`` is ``None``), it is assumed to be in local time." msgstr "" -#: ../../library/email.utils.rst:25 +#: ../../library/email.utils.rst:24 msgid "The *isdst* parameter." msgstr "" -#: ../../library/email.utils.rst:30 +#: ../../library/email.utils.rst:29 msgid "" -"Returns a string suitable for an :rfc:`2822`\\ -compliant :mailheader:" -"`Message-ID` header. Optional *idstring* if given, is a string used to " -"strengthen the uniqueness of the message id. Optional *domain* if given " -"provides the portion of the msgid after the '@'. The default is the local " -"hostname. It is not normally necessary to override this default, but may be " -"useful certain cases, such as a constructing distributed system that uses a " -"consistent domain name across multiple hosts." +"Returns a string suitable for an :rfc:`2822`\\ " +"-compliant :mailheader:`Message-ID` header. Optional *idstring* if given, " +"is a string used to strengthen the uniqueness of the message id. Optional " +"*domain* if given provides the portion of the msgid after the '@'. The " +"default is the local hostname. It is not normally necessary to override " +"this default, but may be useful certain cases, such as a constructing " +"distributed system that uses a consistent domain name across multiple hosts." msgstr "" -#: ../../library/email.utils.rst:38 +#: ../../library/email.utils.rst:37 msgid "Added the *domain* keyword." msgstr "新增 *domain* 關鍵字。" -#: ../../library/email.utils.rst:42 +#: ../../library/email.utils.rst:41 msgid "" "The remaining functions are part of the legacy (``Compat32``) email API. " "There is no need to directly use these with the new API, since the parsing " @@ -69,20 +68,20 @@ msgid "" "machinery of the new API." msgstr "" -#: ../../library/email.utils.rst:50 +#: ../../library/email.utils.rst:49 msgid "" "Return a new string with backslashes in *str* replaced by two backslashes, " "and double quotes replaced by backslash-double quote." msgstr "" -#: ../../library/email.utils.rst:56 +#: ../../library/email.utils.rst:55 msgid "" "Return a new string which is an *unquoted* version of *str*. If *str* ends " "and begins with double quotes, they are stripped off. Likewise if *str* " "ends and begins with angle brackets, they are stripped off." msgstr "" -#: ../../library/email.utils.rst:63 +#: ../../library/email.utils.rst:62 msgid "" "Parse address -- which should be the value of some address-containing field " "such as :mailheader:`To` or :mailheader:`Cc` -- into its constituent " @@ -90,47 +89,47 @@ msgid "" "unless the parse fails, in which case a 2-tuple of ``('', '')`` is returned." msgstr "" -#: ../../library/email.utils.rst:68 ../../library/email.utils.rst:96 +#: ../../library/email.utils.rst:67 ../../library/email.utils.rst:95 msgid "" "If *strict* is true, use a strict parser which rejects malformed inputs." msgstr "" -#: ../../library/email.utils.rst:70 ../../library/email.utils.rst:108 +#: ../../library/email.utils.rst:69 ../../library/email.utils.rst:107 msgid "Add *strict* optional parameter and reject malformed inputs by default." msgstr "" -#: ../../library/email.utils.rst:76 +#: ../../library/email.utils.rst:75 msgid "" "The inverse of :meth:`parseaddr`, this takes a 2-tuple of the form " -"``(realname, email_address)`` and returns the string value suitable for a :" -"mailheader:`To` or :mailheader:`Cc` header. If the first element of *pair* " -"is false, then the second element is returned unmodified." +"``(realname, email_address)`` and returns the string value suitable for " +"a :mailheader:`To` or :mailheader:`Cc` header. If the first element of " +"*pair* is false, then the second element is returned unmodified." msgstr "" -#: ../../library/email.utils.rst:81 +#: ../../library/email.utils.rst:80 msgid "" "Optional *charset* is the character set that will be used in the :rfc:`2047` " "encoding of the ``realname`` if the ``realname`` contains non-ASCII " -"characters. Can be an instance of :class:`str` or a :class:`~email.charset." -"Charset`. Defaults to ``utf-8``." +"characters. Can be an instance of :class:`str` or " +"a :class:`~email.charset.Charset`. Defaults to ``utf-8``." msgstr "" -#: ../../library/email.utils.rst:86 +#: ../../library/email.utils.rst:85 msgid "Added the *charset* option." msgstr "新增 *charset* 選項。" -#: ../../library/email.utils.rst:92 +#: ../../library/email.utils.rst:91 msgid "" "This method returns a list of 2-tuples of the form returned by " "``parseaddr()``. *fieldvalues* is a sequence of header field values as might " "be returned by :meth:`Message.get_all `." msgstr "" -#: ../../library/email.utils.rst:98 +#: ../../library/email.utils.rst:97 msgid "Here's a simple example that gets all the recipients of a message::" msgstr "" -#: ../../library/email.utils.rst:100 +#: ../../library/email.utils.rst:99 msgid "" "from email.utils import getaddresses\n" "\n" @@ -148,18 +147,18 @@ msgstr "" "resent_ccs = msg.get_all('resent-cc', [])\n" "all_recipients = getaddresses(tos + ccs + resent_tos + resent_ccs)" -#: ../../library/email.utils.rst:114 +#: ../../library/email.utils.rst:113 msgid "" "Attempts to parse a date according to the rules in :rfc:`2822`. however, " "some mailers don't follow that format as specified, so :func:`parsedate` " -"tries to guess correctly in such cases. *date* is a string containing an :" -"rfc:`2822` date, such as ``\"Mon, 20 Nov 1995 19:12:08 -0500\"``. If it " -"succeeds in parsing the date, :func:`parsedate` returns a 9-tuple that can " -"be passed directly to :func:`time.mktime`; otherwise ``None`` will be " +"tries to guess correctly in such cases. *date* is a string containing " +"an :rfc:`2822` date, such as ``\"Mon, 20 Nov 1995 19:12:08 -0500\"``. If " +"it succeeds in parsing the date, :func:`parsedate` returns a 9-tuple that " +"can be passed directly to :func:`time.mktime`; otherwise ``None`` will be " "returned. Note that indexes 6, 7, and 8 of the result tuple are not usable." msgstr "" -#: ../../library/email.utils.rst:125 +#: ../../library/email.utils.rst:124 msgid "" "Performs the same function as :func:`parsedate`, but returns either ``None`` " "or a 10-tuple; the first 9 elements make up a tuple that can be passed " @@ -170,43 +169,43 @@ msgid "" "the result tuple are not usable." msgstr "" -#: ../../library/email.utils.rst:135 +#: ../../library/email.utils.rst:134 msgid "" -"The inverse of :func:`format_datetime`. Performs the same function as :func:" -"`parsedate`, but on success returns a :mod:`~datetime.datetime`; otherwise " -"``ValueError`` is raised if *date* contains an invalid value such as an hour " -"greater than 23 or a timezone offset not between -24 and 24 hours. If the " -"input date has a timezone of ``-0000``, the ``datetime`` will be a naive " -"``datetime``, and if the date is conforming to the RFCs it will represent a " -"time in UTC but with no indication of the actual source timezone of the " -"message the date comes from. If the input date has any other valid timezone " -"offset, the ``datetime`` will be an aware ``datetime`` with the " +"The inverse of :func:`format_datetime`. Performs the same function " +"as :func:`parsedate`, but on success returns a :mod:`~datetime.datetime`; " +"otherwise ``ValueError`` is raised if *date* contains an invalid value such " +"as an hour greater than 23 or a timezone offset not between -24 and 24 " +"hours. If the input date has a timezone of ``-0000``, the ``datetime`` will " +"be a naive ``datetime``, and if the date is conforming to the RFCs it will " +"represent a time in UTC but with no indication of the actual source timezone " +"of the message the date comes from. If the input date has any other valid " +"timezone offset, the ``datetime`` will be an aware ``datetime`` with the " "corresponding a :class:`~datetime.timezone` :class:`~datetime.tzinfo`." msgstr "" -#: ../../library/email.utils.rst:151 +#: ../../library/email.utils.rst:150 msgid "" "Turn a 10-tuple as returned by :func:`parsedate_tz` into a UTC timestamp " "(seconds since the Epoch). If the timezone item in the tuple is ``None``, " "assume local time." msgstr "" -#: ../../library/email.utils.rst:158 +#: ../../library/email.utils.rst:157 msgid "Returns a date string as per :rfc:`2822`, e.g.::" msgstr "" -#: ../../library/email.utils.rst:160 +#: ../../library/email.utils.rst:159 msgid "Fri, 09 Nov 2001 01:08:47 -0000" msgstr "Fri, 09 Nov 2001 01:08:47 -0000" -#: ../../library/email.utils.rst:162 +#: ../../library/email.utils.rst:161 msgid "" -"Optional *timeval* if given is a floating-point time value as accepted by :" -"func:`time.gmtime` and :func:`time.localtime`, otherwise the current time is " -"used." +"Optional *timeval* if given is a floating-point time value as accepted " +"by :func:`time.gmtime` and :func:`time.localtime`, otherwise the current " +"time is used." msgstr "" -#: ../../library/email.utils.rst:166 +#: ../../library/email.utils.rst:165 msgid "" "Optional *localtime* is a flag that when ``True``, interprets *timeval*, and " "returns a date relative to the local timezone instead of UTC, properly " @@ -214,7 +213,7 @@ msgid "" "UTC is used." msgstr "" -#: ../../library/email.utils.rst:171 +#: ../../library/email.utils.rst:170 msgid "" "Optional *usegmt* is a flag that when ``True``, outputs a date string with " "the timezone as an ascii string ``GMT``, rather than a numeric ``-0000``. " @@ -222,7 +221,7 @@ msgid "" "*localtime* is ``False``. The default is ``False``." msgstr "" -#: ../../library/email.utils.rst:179 +#: ../../library/email.utils.rst:178 msgid "" "Like ``formatdate``, but the input is a :mod:`datetime` instance. If it is " "a naive datetime, it is assumed to be \"UTC with no information about the " @@ -234,11 +233,11 @@ msgid "" "date headers." msgstr "" -#: ../../library/email.utils.rst:193 +#: ../../library/email.utils.rst:192 msgid "Decode the string *s* according to :rfc:`2231`." msgstr "" -#: ../../library/email.utils.rst:198 +#: ../../library/email.utils.rst:197 msgid "" "Encode the string *s* according to :rfc:`2231`. Optional *charset* and " "*language*, if given is the character set name and language name to use. If " @@ -247,35 +246,35 @@ msgid "" "*language*." msgstr "" -#: ../../library/email.utils.rst:206 +#: ../../library/email.utils.rst:205 msgid "" -"When a header parameter is encoded in :rfc:`2231` format, :meth:`Message." -"get_param ` may return a 3-tuple containing " -"the character set, language, and value. :func:`collapse_rfc2231_value` " -"turns this into a unicode string. Optional *errors* is passed to the " -"*errors* argument of :class:`str`'s :func:`~str.encode` method; it defaults " -"to ``'replace'``. Optional *fallback_charset* specifies the character set " -"to use if the one in the :rfc:`2231` header is not known by Python; it " -"defaults to ``'us-ascii'``." +"When a header parameter is encoded in :rfc:`2231` " +"format, :meth:`Message.get_param ` may " +"return a 3-tuple containing the character set, language, and " +"value. :func:`collapse_rfc2231_value` turns this into a unicode string. " +"Optional *errors* is passed to the *errors* argument " +"of :class:`str`'s :func:`~str.encode` method; it defaults to ``'replace'``. " +"Optional *fallback_charset* specifies the character set to use if the one in " +"the :rfc:`2231` header is not known by Python; it defaults to ``'us-ascii'``." msgstr "" -#: ../../library/email.utils.rst:215 +#: ../../library/email.utils.rst:214 msgid "" "For convenience, if the *value* passed to :func:`collapse_rfc2231_value` is " "not a tuple, it should be a string and it is returned unquoted." msgstr "" -#: ../../library/email.utils.rst:221 +#: ../../library/email.utils.rst:220 msgid "" "Decode parameters list according to :rfc:`2231`. *params* is a sequence of " "2-tuples containing elements of the form ``(content-type, string-value)``." msgstr "" -#: ../../library/email.utils.rst:226 +#: ../../library/email.utils.rst:225 msgid "Footnotes" msgstr "註解" -#: ../../library/email.utils.rst:227 +#: ../../library/email.utils.rst:226 msgid "" "Note that the sign of the timezone offset is the opposite of the sign of the " "``time.timezone`` variable for the same timezone; the latter variable " diff --git a/library/enum.po b/library/enum.po index d2e7a9d28c5..f62dae906da 100644 --- a/library/enum.po +++ b/library/enum.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-13 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-12-21 13:50+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -125,8 +125,8 @@ msgid "" "The enum members have *names* and *values* (the name of :attr:`!Color.RED` " "is ``RED``, the value of :attr:`!Color.BLUE` is ``3``, etc.)" msgstr "" -"列舉成員有\\ *名稱*\\ 和\\ *值*\\ (:attr:`!Color.RED` 的名稱是 ``RED``,:" -"attr:`!Color.BLUE` 的值是 ``3`` 諸如此類)" +"列舉成員有\\ *名稱*\\ 和\\ *值*\\ (:attr:`!Color.RED` 的名稱是 " +"``RED``,:attr:`!Color.BLUE` 的值是 ``3`` 諸如此類)" #: ../../library/enum.rst:65 msgid "Module Contents" @@ -154,8 +154,8 @@ msgstr ":class:`IntEnum`" #: ../../library/enum.rst:77 msgid "" -"Base class for creating enumerated constants that are also subclasses of :" -"class:`int`. (`Notes`_)" +"Base class for creating enumerated constants that are also subclasses " +"of :class:`int`. (`Notes`_)" msgstr "" "用來建立列舉常數的基礎類別,同時也是 :class:`int` 的子類別。(`備註 " "`_)" @@ -166,8 +166,8 @@ msgstr ":class:`StrEnum`" #: ../../library/enum.rst:82 msgid "" -"Base class for creating enumerated constants that are also subclasses of :" -"class:`str`. (`Notes`_)" +"Base class for creating enumerated constants that are also subclasses " +"of :class:`str`. (`Notes`_)" msgstr "" "用來建立列舉常數的基礎類別,同時也是 :class:`str` 的子類別。(`備註 " "`_)" @@ -181,8 +181,8 @@ msgid "" "Base class for creating enumerated constants that can be combined using the " "bitwise operations without losing their :class:`Flag` membership." msgstr "" -"用來建立列舉常數的基礎類別,可以使用位元操作來結合成員且其結果不失去 :class:" -"`Flag` 的成員資格。" +"用來建立列舉常數的基礎類別,可以使用位元操作來結合成員且其結果不失" +"去 :class:`Flag` 的成員資格。" #: ../../library/enum.rst:90 msgid ":class:`IntFlag`" @@ -191,12 +191,13 @@ msgstr ":class:`IntFlag`" #: ../../library/enum.rst:92 msgid "" "Base class for creating enumerated constants that can be combined using the " -"bitwise operators without losing their :class:`IntFlag` membership. :class:" -"`IntFlag` members are also subclasses of :class:`int`. (`Notes`_)" +"bitwise operators without losing their :class:`IntFlag` " +"membership. :class:`IntFlag` members are also subclasses of :class:`int`. " +"(`Notes`_)" msgstr "" -"用來建立列舉常數的基礎類別,可以使用位元操作來結合成員且其結果不失去 :class:" -"`IntFlag` 的成員資格。:class:`IntFlag` 的成員也是 :class:`int` 的子類別。(`" -"備註 `_)" +"用來建立列舉常數的基礎類別,可以使用位元操作來結合成員且其結果不失" +"去 :class:`IntFlag` 的成員資格。:class:`IntFlag` 的成員也是 :class:`int` 的子" +"類別。(`備註 `_)" #: ../../library/enum.rst:96 msgid ":class:`ReprEnum`" @@ -220,8 +221,8 @@ msgid "" "``UNIQUE``, for use with :func:`verify` to ensure various constraints are " "met by a given enumeration." msgstr "" -"一個有 ``CONTINUOUS``、``NAMED_FLAGS`` 及 ``UNIQUE`` 這些值的列舉,和 :func:" -"`verify` 一起使用來確保給定的列舉符合多種限制。" +"一個有 ``CONTINUOUS``、``NAMED_FLAGS`` 及 ``UNIQUE`` 這些值的列舉," +"和 :func:`verify` 一起使用來確保給定的列舉符合多種限制。" #: ../../library/enum.rst:107 msgid ":class:`FlagBoundary`" @@ -250,9 +251,9 @@ msgstr ":class:`auto`" #: ../../library/enum.rst:119 msgid "" -"Instances are replaced with an appropriate value for Enum members. :class:" -"`StrEnum` defaults to the lower-cased version of the member name, while " -"other Enums default to 1 and increase from there." +"Instances are replaced with an appropriate value for Enum " +"members. :class:`StrEnum` defaults to the lower-cased version of the member " +"name, while other Enums default to 1 and increase from there." msgstr "" "列舉成員的實例會被取代成合適的值。:class:`StrEnum` 預設是小寫版本的成員名稱," "其它列舉則預設是 1 且往後遞增。" @@ -357,26 +358,20 @@ msgstr "" #: ../../library/enum.rst:173 msgid "" -"``EnumType`` is responsible for setting the correct :meth:`!__repr__`, :meth:" -"`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the " -"final *enum*, as well as creating the enum members, properly handling " -"duplicates, providing iteration over the enum class, etc." +"``EnumType`` is responsible for setting the correct :meth:`!" +"__repr__`, :meth:`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` " +"methods on the final *enum*, as well as creating the enum members, properly " +"handling duplicates, providing iteration over the enum class, etc." msgstr "" -"``EnumType`` 負責在最後的\\ *列舉*\\ 上面設定正確的 :meth:`!__repr__`、:meth:" -"`!__str__`、:meth:`!__format__` 及 :meth:`!__reduce__` 方法,以及建立列舉成" -"員、正確處理重複、提供列舉類別的疊代等等。" +"``EnumType`` 負責在最後的\\ *列舉*\\ 上面設定正確的 :meth:`!" +"__repr__`、:meth:`!__str__`、:meth:`!__format__` 及 :meth:`!__reduce__` 方" +"法,以及建立列舉成員、正確處理重複、提供列舉類別的疊代等等。" #: ../../library/enum.rst:180 -msgid "" -"Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available " -"as an alias." -msgstr "在 3.11 之前,``EnumType`` 稱作 ``EnumMeta``,其目前仍可作為別名使用。" - -#: ../../library/enum.rst:184 msgid "This method is called in two different ways:" msgstr "這個方法可以用兩種不同的方式呼叫:" -#: ../../library/enum.rst:186 +#: ../../library/enum.rst:182 msgid "to look up an existing member:" msgstr "查詢已存在的成員:" @@ -384,7 +379,7 @@ msgstr "查詢已存在的成員:" msgid "cls" msgstr "cls" -#: ../../library/enum.rst:188 ../../library/enum.rst:194 +#: ../../library/enum.rst:184 ../../library/enum.rst:190 msgid "The enum class being called." msgstr "所呼叫的列舉類別。" @@ -392,17 +387,17 @@ msgstr "所呼叫的列舉類別。" msgid "value" msgstr "value" -#: ../../library/enum.rst:189 +#: ../../library/enum.rst:185 msgid "The value to lookup." msgstr "要查詢的值。" -#: ../../library/enum.rst:191 +#: ../../library/enum.rst:187 msgid "" "to use the ``cls`` enum to create a new enum (only if the existing enum does " "not have any members):" msgstr "使用 ``cls`` 列舉來建立新列舉(只有在現有列舉沒有任何成員時)" -#: ../../library/enum.rst:195 +#: ../../library/enum.rst:191 msgid "The name of the new Enum to create." msgstr "要建立的新列舉的名稱。" @@ -410,7 +405,7 @@ msgstr "要建立的新列舉的名稱。" msgid "names" msgstr "names" -#: ../../library/enum.rst:196 +#: ../../library/enum.rst:192 msgid "The names/values of the members for the new Enum." msgstr "新列舉的成員的名稱/值。" @@ -418,7 +413,7 @@ msgstr "新列舉的成員的名稱/值。" msgid "module" msgstr "module" -#: ../../library/enum.rst:197 +#: ../../library/enum.rst:193 msgid "The name of the module the new Enum is created in." msgstr "新列舉要建立在哪個模組名稱下。" @@ -426,7 +421,7 @@ msgstr "新列舉要建立在哪個模組名稱下。" msgid "qualname" msgstr "qualname" -#: ../../library/enum.rst:198 +#: ../../library/enum.rst:194 msgid "The actual location in the module where this Enum can be found." msgstr "這個列舉在模組裡實際上的位置。" @@ -434,7 +429,7 @@ msgstr "這個列舉在模組裡實際上的位置。" msgid "type" msgstr "type" -#: ../../library/enum.rst:199 +#: ../../library/enum.rst:195 msgid "A mix-in type for the new Enum." msgstr "新列舉的混合型別。" @@ -442,7 +437,7 @@ msgstr "新列舉的混合型別。" msgid "start" msgstr "start" -#: ../../library/enum.rst:200 +#: ../../library/enum.rst:196 msgid "The first integer value for the Enum (used by :class:`auto`)." msgstr "列舉的第一個整數值(由 :class:`auto` 所使用)" @@ -450,16 +445,16 @@ msgstr "列舉的第一個整數值(由 :class:`auto` 所使用)" msgid "boundary" msgstr "boundary" -#: ../../library/enum.rst:201 +#: ../../library/enum.rst:197 msgid "" "How to handle out-of-range values from bit operations (:class:`Flag` only)." msgstr "在位元操作時怎麼處理範圍外的值(只有 :class:`Flag` 會用到)" -#: ../../library/enum.rst:205 +#: ../../library/enum.rst:201 msgid "Returns ``True`` if member belongs to the ``cls``::" msgstr "如果 member 屬於 ``cls`` 則回傳 ``True``: ::" -#: ../../library/enum.rst:207 +#: ../../library/enum.rst:203 msgid "" ">>> some_var = Color.RED\n" ">>> some_var in Color\n" @@ -473,7 +468,7 @@ msgstr "" ">>> Color.RED.value in Color\n" "True" -#: ../../library/enum.rst:215 +#: ../../library/enum.rst:211 msgid "" "Before Python 3.12, a ``TypeError`` is raised if a non-Enum-member is used " "in a containment check." @@ -481,7 +476,7 @@ msgstr "" "在 Python 3.12 之前,如果用非列舉成員做屬於檢查 (containment check) 會引發 " "``TypeError``。" -#: ../../library/enum.rst:220 +#: ../../library/enum.rst:216 msgid "" "Returns ``['__class__', '__doc__', '__members__', '__module__']`` and the " "names of the members in *cls*::" @@ -489,7 +484,7 @@ msgstr "" "回傳 ``['__class__', '__doc__', '__members__', '__module__']`` 及 *cls* 的成" "員名稱: ::" -#: ../../library/enum.rst:223 +#: ../../library/enum.rst:219 msgid "" ">>> dir(Color)\n" "['BLUE', 'GREEN', 'RED', '__class__', '__contains__', '__doc__', " @@ -501,13 +496,13 @@ msgstr "" "'__getitem__', '__init_subclass__', '__iter__', '__len__', '__members__', " "'__module__', '__name__', '__qualname__']" -#: ../../library/enum.rst:228 +#: ../../library/enum.rst:224 msgid "" -"Returns the Enum member in *cls* matching *name*, or raises a :exc:" -"`KeyError`::" +"Returns the Enum member in *cls* matching *name*, or raises " +"a :exc:`KeyError`::" msgstr "回傳 *cls* 中符合 *name* 的列舉成員,或引發 :exc:`KeyError`: ::" -#: ../../library/enum.rst:230 +#: ../../library/enum.rst:226 msgid "" ">>> Color['BLUE']\n" "" @@ -515,11 +510,11 @@ msgstr "" ">>> Color['BLUE']\n" "" -#: ../../library/enum.rst:235 +#: ../../library/enum.rst:231 msgid "Returns each member in *cls* in definition order::" msgstr "以定義的順序回傳在 *cls* 中的每個成員: ::" -#: ../../library/enum.rst:237 +#: ../../library/enum.rst:233 msgid "" ">>> list(Color)\n" "[, , ]" @@ -527,11 +522,11 @@ msgstr "" ">>> list(Color)\n" "[, , ]" -#: ../../library/enum.rst:242 +#: ../../library/enum.rst:238 msgid "Returns the number of member in *cls*::" msgstr "回傳 *cls* 的成員數量: ::" -#: ../../library/enum.rst:244 +#: ../../library/enum.rst:240 msgid "" ">>> len(Color)\n" "3" @@ -539,15 +534,15 @@ msgstr "" ">>> len(Color)\n" "3" -#: ../../library/enum.rst:249 +#: ../../library/enum.rst:245 msgid "Returns a mapping of every enum name to its member, including aliases" msgstr "回傳每個列舉名稱到其成員的對映,包括別名" -#: ../../library/enum.rst:253 +#: ../../library/enum.rst:249 msgid "Returns each member in *cls* in reverse definition order::" msgstr "以跟定義相反的順序回傳 *cls* 的每個成員: ::" -#: ../../library/enum.rst:255 +#: ../../library/enum.rst:251 msgid "" ">>> list(reversed(Color))\n" "[, , ]" @@ -555,15 +550,35 @@ msgstr "" ">>> list(reversed(Color))\n" "[, , ]" +#: ../../library/enum.rst:256 +#, fuzzy +msgid "" +"Adds a new name as an alias to an existing member. Raises " +"a :exc:`NameError` if the name is already assigned to a different member." +msgstr "如果該名稱已被指派給不同的成員,則會引發 :exc:`NameError`。" + #: ../../library/enum.rst:261 +#, fuzzy +msgid "" +"Adds a new value as an alias to an existing member. Raises " +"a :exc:`ValueError` if the value is already linked with a different member." +msgstr "如果該值已與不同成員連結,則會引發 :exc:`ValueError`。" + +#: ../../library/enum.rst:266 +msgid "" +"Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available " +"as an alias." +msgstr "在 3.11 之前,``EnumType`` 稱作 ``EnumMeta``,其目前仍可作為別名使用。" + +#: ../../library/enum.rst:271 msgid "*Enum* is the base class for all *enum* enumerations." msgstr "*Enum* 是所有 *enum* 列舉的基礎類別。" -#: ../../library/enum.rst:265 +#: ../../library/enum.rst:275 msgid "The name used to define the ``Enum`` member::" msgstr "用來定義 ``Enum`` 成員的名稱: ::" -#: ../../library/enum.rst:267 +#: ../../library/enum.rst:277 msgid "" ">>> Color.BLUE.name\n" "'BLUE'" @@ -571,11 +586,11 @@ msgstr "" ">>> Color.BLUE.name\n" "'BLUE'" -#: ../../library/enum.rst:272 +#: ../../library/enum.rst:282 msgid "The value given to the ``Enum`` member::" msgstr "``Enum`` 成員給定的值: ::" -#: ../../library/enum.rst:274 +#: ../../library/enum.rst:284 msgid "" ">>> Color.RED.value\n" "1" @@ -583,61 +598,61 @@ msgstr "" ">>> Color.RED.value\n" "1" -#: ../../library/enum.rst:277 ../../library/enum.rst:297 +#: ../../library/enum.rst:287 ../../library/enum.rst:307 msgid "Value of the member, can be set in :meth:`~Enum.__new__`." msgstr "成員的值,可以在 :meth:`~Enum.__new__` 設定。" -#: ../../library/enum.rst:279 +#: ../../library/enum.rst:289 msgid "Enum member values" msgstr "列舉成員的值" -#: ../../library/enum.rst:281 +#: ../../library/enum.rst:291 msgid "" "Member values can be anything: :class:`int`, :class:`str`, etc. If the " "exact value is unimportant you may use :class:`auto` instances and an " "appropriate value will be chosen for you. See :class:`auto` for the details." msgstr "" "成員的值可以是任何值::class:`int`、:class:`str` 等等。如果實際使用什麼值並不" -"重要,你可以使用 :class:`auto` 實例,它會為你選擇合適的值。更多細節請參考 :" -"class:`auto`。" +"重要,你可以使用 :class:`auto` 實例,它會為你選擇合適的值。更多細節請參" +"考 :class:`auto`。" -#: ../../library/enum.rst:286 +#: ../../library/enum.rst:296 msgid "" "While mutable/unhashable values, such as :class:`dict`, :class:`list` or a " "mutable :class:`~dataclasses.dataclass`, can be used, they will have a " "quadratic performance impact during creation relative to the total number of " "mutable/unhashable values in the enum." msgstr "" -"雖然可以使用可變的 (mutable) / 不可雜湊的 (unhashable) 值,例如 :class:" -"`dict`、:class:`list` 或可變的 :class:`~dataclasses.dataclass`,它們在建立期" -"間會對效能產生相對於列舉中可變的 / 不可雜湊的值總數量的二次方影響。" +"雖然可以使用可變的 (mutable) / 不可雜湊的 (unhashable) 值,例" +"如 :class:`dict`、:class:`list` 或可變的 :class:`~dataclasses.dataclass`,它" +"們在建立期間會對效能產生相對於列舉中可變的 / 不可雜湊的值總數量的二次方影響。" -#: ../../library/enum.rst:293 +#: ../../library/enum.rst:303 msgid "Name of the member." msgstr "成員名稱。" -#: ../../library/enum.rst:301 +#: ../../library/enum.rst:311 msgid "" "No longer used, kept for backward compatibility. (class attribute, removed " "during class creation)." msgstr "已不再使用,只為了向後相容而保留(類別屬性,在類別建立時移除)" -#: ../../library/enum.rst:306 +#: ../../library/enum.rst:316 msgid "" "``_ignore_`` is only used during creation and is removed from the " "enumeration once creation is complete." msgstr "``_ignore_`` 只有在建立的時候用到,在列舉建立完成後會被移除。" -#: ../../library/enum.rst:309 +#: ../../library/enum.rst:319 msgid "" "``_ignore_`` is a list of names that will not become members, and whose " -"names will also be removed from the completed enumeration. See :ref:" -"`TimePeriod ` for an example." +"names will also be removed from the completed enumeration. " +"See :ref:`TimePeriod ` for an example." msgstr "" "``_ignore_`` 是一個不會變成成員的名稱串列,在列舉建立完成後其名稱會被移除。範" "例請參考 :ref:`TimePeriod `。" -#: ../../library/enum.rst:315 +#: ../../library/enum.rst:325 msgid "" "Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and any " "public methods defined on *self.__class__*::" @@ -645,7 +660,7 @@ msgstr "" "回傳 ``['__class__', '__doc__', '__module__', 'name', 'value']`` 及任何 " "*self.__class__* 上定義的公開方法: ::" -#: ../../library/enum.rst:318 +#: ../../library/enum.rst:328 msgid "" ">>> from datetime import date\n" ">>> class Weekday(Enum):\n" @@ -685,11 +700,11 @@ msgstr "" msgid "name" msgstr "name" -#: ../../library/enum.rst:336 +#: ../../library/enum.rst:346 msgid "The name of the member being defined (e.g. 'RED')." msgstr "定義的成員名稱(例如 'RED')。" -#: ../../library/enum.rst:337 +#: ../../library/enum.rst:347 msgid "The start value for the Enum; the default is 1." msgstr "列舉的開始值,預設為 1。" @@ -697,7 +712,7 @@ msgstr "列舉的開始值,預設為 1。" msgid "count" msgstr "count" -#: ../../library/enum.rst:338 +#: ../../library/enum.rst:348 msgid "The number of members currently defined, not including this one." msgstr "已定義的成員數量,不包含目前這一個。" @@ -705,17 +720,17 @@ msgstr "已定義的成員數量,不包含目前這一個。" msgid "last_values" msgstr "last_values" -#: ../../library/enum.rst:339 +#: ../../library/enum.rst:349 msgid "A list of the previous values." msgstr "一個之前值的串列。" -#: ../../library/enum.rst:341 +#: ../../library/enum.rst:351 msgid "" -"A *staticmethod* that is used to determine the next value returned by :class:" -"`auto`::" +"A *staticmethod* that is used to determine the next value returned " +"by :class:`auto`::" msgstr "一個 *staticmethod*,用來決定 :class:`auto` 下一個要回傳的值的: ::" -#: ../../library/enum.rst:344 +#: ../../library/enum.rst:354 msgid "" ">>> from enum import auto\n" ">>> class PowersOfThree(Enum):\n" @@ -739,7 +754,7 @@ msgstr "" ">>> PowersOfThree.SECOND.value\n" "9" -#: ../../library/enum.rst:357 +#: ../../library/enum.rst:367 msgid "" "By default, does nothing. If multiple values are given in the member " "assignment, those values become separate arguments to ``__init__``; e.g." @@ -747,19 +762,19 @@ msgstr "" "預設情況下,不執行任何操作。如果在成員賦值中給出多個值,這些值將成為與 " "``__init__`` 分別的引數;例如" -#: ../../library/enum.rst:364 +#: ../../library/enum.rst:374 msgid "" "``Weekday.__init__()`` would be called as ``Weekday.__init__(self, 1, " "'Mon')``" msgstr "``Weekday.__init__()`` 將被稱為 ``Weekday.__init__(self, 1, 'Mon')``" -#: ../../library/enum.rst:368 +#: ../../library/enum.rst:378 msgid "" "A *classmethod* that is used to further configure subsequent subclasses. By " "default, does nothing." msgstr "一個 *classmethod*,用來進一步設定後續的子類別,預設不做任何事。" -#: ../../library/enum.rst:373 +#: ../../library/enum.rst:383 msgid "" "A *classmethod* for looking up values not found in *cls*. By default it " "does nothing, but can be overridden to implement custom search behavior::" @@ -767,7 +782,7 @@ msgstr "" "一個 *classmethod*,用來查詢在 *cls* 裡找不到的值。預設不做任何事,但可以被覆" "寫以實作客製化的搜尋行為: ::" -#: ../../library/enum.rst:376 +#: ../../library/enum.rst:386 msgid "" ">>> from enum import StrEnum\n" ">>> class Build(StrEnum):\n" @@ -803,7 +818,7 @@ msgstr "" ">>> Build('deBUG')\n" "" -#: ../../library/enum.rst:395 +#: ../../library/enum.rst:405 msgid "" "By default, doesn't exist. If specified, either in the enum class " "definition or in a mixin class (such as ``int``), all values given in the " @@ -812,12 +827,12 @@ msgstr "" "預設情況下不存在。如果有指定,無論是在列舉類別定義中還是在 mixin 類別中(例" "如 ``int``\\ ),都將傳遞成員賦值中給出的所有值;例如" -#: ../../library/enum.rst:403 +#: ../../library/enum.rst:413 msgid "" "results in the call ``int('1a', 16)`` and a value of ``26`` for the member." msgstr "會產生呼叫 ``int('1a', 16)`` 而該成員的值為 ``26``。" -#: ../../library/enum.rst:407 +#: ../../library/enum.rst:417 msgid "" "When writing a custom ``__new__``, do not use ``super().__new__`` -- call " "the appropriate ``__new__`` instead." @@ -825,7 +840,7 @@ msgstr "" "當寫自訂的 ``__new__`` 時,不要使用 ``super().__new__``,而是要呼叫適當的 " "``__new__``。" -#: ../../library/enum.rst:412 +#: ../../library/enum.rst:422 msgid "" "Returns the string used for *repr()* calls. By default, returns the *Enum* " "name, member name, and value, but can be overridden::" @@ -833,7 +848,7 @@ msgstr "" "回傳呼叫 *repr()* 時使用的字串。預設回傳 *Enum* 名稱、成員名稱及值,但可以被" "覆寫: ::" -#: ../../library/enum.rst:415 +#: ../../library/enum.rst:425 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -843,8 +858,8 @@ msgid "" "... cls_name = self.__class__.__name__\n" "... return f'{cls_name}.{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." -"ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " +"f\"{OtherStyle.ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" msgstr "" ">>> class OtherStyle(Enum):\n" @@ -855,11 +870,11 @@ msgstr "" "... cls_name = self.__class__.__name__\n" "... return f'{cls_name}.{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." -"ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " +"f\"{OtherStyle.ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" -#: ../../library/enum.rst:428 +#: ../../library/enum.rst:438 msgid "" "Returns the string used for *str()* calls. By default, returns the *Enum* " "name and member name, but can be overridden::" @@ -867,7 +882,7 @@ msgstr "" "回傳呼叫 *str()* 時使用的字串。預設回傳 *Enum* 名稱及成員名稱,但可以被覆" "寫: ::" -#: ../../library/enum.rst:431 +#: ../../library/enum.rst:441 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -876,8 +891,8 @@ msgid "" "... def __str__(self):\n" "... return f'{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." -"ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " +"f\"{OtherStyle.ALTERNATE}\"\n" "(, 'ALTERNATE', 'ALTERNATE')" msgstr "" ">>> class OtherStyle(Enum):\n" @@ -887,11 +902,11 @@ msgstr "" "... def __str__(self):\n" "... return f'{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." -"ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " +"f\"{OtherStyle.ALTERNATE}\"\n" "(, 'ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:443 +#: ../../library/enum.rst:453 msgid "" "Returns the string used for *format()* and *f-string* calls. By default, " "returns :meth:`__str__` return value, but can be overridden::" @@ -899,7 +914,7 @@ msgstr "" "回傳呼叫 *format()* 及 *f-string* 時使用的字串。預設回傳 :meth:`__str__` 的回" "傳值,但可以被覆寫: ::" -#: ../../library/enum.rst:446 +#: ../../library/enum.rst:456 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -908,8 +923,8 @@ msgid "" "... def __format__(self, spec):\n" "... return f'{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." -"ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " +"f\"{OtherStyle.ALTERNATE}\"\n" "(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" msgstr "" ">>> class OtherStyle(Enum):\n" @@ -919,63 +934,21 @@ msgstr "" "... def __format__(self, spec):\n" "... return f'{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." -"ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " +"f\"{OtherStyle.ALTERNATE}\"\n" "(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:458 +#: ../../library/enum.rst:468 msgid "" "Using :class:`auto` with :class:`Enum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`Enum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:461 +#: ../../library/enum.rst:471 msgid "Added :ref:`enum-dataclass-support`" msgstr "新增 :ref:`enum-dataclass-support`" -#: ../../library/enum.rst:465 -msgid "Adds a new name as an alias to an existing member::" -msgstr "新增一個名稱作為現有成員的別名: ::" - -#: ../../library/enum.rst:467 -msgid "" -">>> Color.RED._add_alias_(\"ERROR\")\n" -">>> Color.ERROR\n" -"" -msgstr "" -">>> Color.RED._add_alias_(\"ERROR\")\n" -">>> Color.ERROR\n" -"" - -#: ../../library/enum.rst:471 -msgid "" -"Raises a :exc:`NameError` if the name is already assigned to a different " -"member." -msgstr "" -"如果該名稱已被指派給不同的成員,則會引發 :exc:`NameError`。" - -#: ../../library/enum.rst:477 -msgid "Adds a new value as an alias to an existing member::" -msgstr "新增一個值作為現有成員的別名: ::" - -#: ../../library/enum.rst:479 -msgid "" -">>> Color.RED._add_value_alias_(42)\n" -">>> Color(42)\n" -"" -msgstr "" -">>> Color.RED._add_value_alias_(42)\n" -">>> Color(42)\n" -"" - -#: ../../library/enum.rst:483 -msgid "" -"Raises a :exc:`ValueError` if the value is already linked with a different " -"member." -msgstr "" -"如果該值已與不同成員連結,則會引發 :exc:`ValueError`。" - -#: ../../library/enum.rst:490 +#: ../../library/enum.rst:476 msgid "" "*IntEnum* is the same as :class:`Enum`, but its members are also integers " "and can be used anywhere that an integer can be used. If any integer " @@ -985,23 +958,23 @@ msgstr "" "*IntEnum* 和 :class:`Enum` 一樣,但其成員同時也是整數而可以被用在任何使用整數" "的地方。如果 *IntEnum* 成員經過任何整數運算,結果值會失去其列舉狀態。" -#: ../../library/enum.rst:511 +#: ../../library/enum.rst:497 msgid "" "Using :class:`auto` with :class:`IntEnum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`IntEnum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:514 +#: ../../library/enum.rst:500 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` was " "already :meth:`!int.__format__` for that same reason." msgstr "" "為了更好地支援\\ *現存常數取代 (replacement of existing constants)* 的使用情" -"境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" -"meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" +"境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理" +"由,:meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:521 +#: ../../library/enum.rst:507 msgid "" "*StrEnum* is the same as :class:`Enum`, but its members are also strings and " "can be used in most of the same places that a string can be used. The result " @@ -1011,7 +984,7 @@ msgstr "" "*StrEnum* 和 :class:`Enum` 一樣,但其成員同時也是字串而可以被用在幾乎所有使用" "字串的地方。*StrEnum* 成員經過任何字串操作的結果會不再是列舉的一部份。" -#: ../../library/enum.rst:542 +#: ../../library/enum.rst:528 msgid "" "There are places in the stdlib that check for an exact :class:`str` instead " "of a :class:`str` subclass (i.e. ``type(unknown) == str`` instead of " @@ -1022,23 +995,23 @@ msgstr "" "是 ``type(unknown) == str`` 而不是 ``isinstance(unknown, str)``),在這些地方" "你需要使用 ``str(MyStrEnum.MY_MEMBER)``。" -#: ../../library/enum.rst:549 +#: ../../library/enum.rst:535 msgid "" "Using :class:`auto` with :class:`StrEnum` results in the lower-cased member " "name as the value." msgstr ":class:`StrEnum` 使用 :class:`auto` 會產生小寫的成員名稱當作值。" -#: ../../library/enum.rst:554 +#: ../../library/enum.rst:540 msgid "" ":meth:`~object.__str__` is :meth:`!str.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` is " "likewise :meth:`!str.__format__` for that same reason." msgstr "" "為了更好地支援\\ *現存常數取代 (replacement of existing constants)* 的使用情" -"境,:meth:`~object.__str__` 現在會是 :meth:`!str.__str__`。為了同樣的理由,:" -"meth:`~object.__format__` 也會是 :meth:`!str.__format__`。" +"境,:meth:`~object.__str__` 現在會是 :meth:`!str.__str__`。為了同樣的理" +"由,:meth:`~object.__format__` 也會是 :meth:`!str.__format__`。" -#: ../../library/enum.rst:562 +#: ../../library/enum.rst:548 msgid "" "``Flag`` is the same as :class:`Enum`, but its members support the bitwise " "operators ``&`` (*AND*), ``|`` (*OR*), ``^`` (*XOR*), and ``~`` (*INVERT*); " @@ -1048,11 +1021,11 @@ msgstr "" "(*OR*)、``^`` (*XOR*) 和 ``~`` (*INVERT*);這些操作的結果是列舉的成員(的別" "名)。" -#: ../../library/enum.rst:568 +#: ../../library/enum.rst:554 msgid "Returns *True* if value is in self::" msgstr "如果 value 在 self 裡則回傳 *True*: ::" -#: ../../library/enum.rst:570 +#: ../../library/enum.rst:556 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -1088,11 +1061,11 @@ msgstr "" ">>> white in purple\n" "False" -#: ../../library/enum.rst:589 +#: ../../library/enum.rst:575 msgid "Returns all contained non-alias members::" msgstr "回傳所有包含的非別名成員: ::" -#: ../../library/enum.rst:591 +#: ../../library/enum.rst:577 msgid "" ">>> list(Color.RED)\n" "[]\n" @@ -1104,11 +1077,11 @@ msgstr "" ">>> list(purple)\n" "[, ]" -#: ../../library/enum.rst:600 +#: ../../library/enum.rst:586 msgid "Returns number of members in flag::" msgstr "回傳旗標裡的成員數量: ::" -#: ../../library/enum.rst:602 +#: ../../library/enum.rst:588 msgid "" ">>> len(Color.GREEN)\n" "1\n" @@ -1120,11 +1093,11 @@ msgstr "" ">>> len(white)\n" "3" -#: ../../library/enum.rst:611 +#: ../../library/enum.rst:597 msgid "Returns *True* if any members in flag, *False* otherwise::" msgstr "如果成員在旗標裡則回傳 *True*,否則回傳 *False*: ::" -#: ../../library/enum.rst:613 +#: ../../library/enum.rst:599 msgid "" ">>> bool(Color.GREEN)\n" "True\n" @@ -1142,11 +1115,11 @@ msgstr "" ">>> bool(black)\n" "False" -#: ../../library/enum.rst:623 +#: ../../library/enum.rst:609 msgid "Returns current flag binary or'ed with other::" msgstr "回傳和 other 做 OR 過後的二進位旗標: ::" -#: ../../library/enum.rst:625 +#: ../../library/enum.rst:611 msgid "" ">>> Color.RED | Color.GREEN\n" "" @@ -1154,11 +1127,11 @@ msgstr "" ">>> Color.RED | Color.GREEN\n" "" -#: ../../library/enum.rst:630 +#: ../../library/enum.rst:616 msgid "Returns current flag binary and'ed with other::" msgstr "回傳和 other 做 AND 過後的二進位旗標: ::" -#: ../../library/enum.rst:632 +#: ../../library/enum.rst:618 msgid "" ">>> purple & white\n" "\n" @@ -1170,11 +1143,11 @@ msgstr "" ">>> purple & Color.GREEN\n" "" -#: ../../library/enum.rst:639 +#: ../../library/enum.rst:625 msgid "Returns current flag binary xor'ed with other::" msgstr "回傳和 other 做 XOR 過後的二進位旗標: ::" -#: ../../library/enum.rst:641 +#: ../../library/enum.rst:627 msgid "" ">>> purple ^ white\n" "\n" @@ -1186,11 +1159,11 @@ msgstr "" ">>> purple ^ Color.GREEN\n" "" -#: ../../library/enum.rst:648 +#: ../../library/enum.rst:634 msgid "Returns all the flags in *type(self)* that are not in *self*::" msgstr "回傳所有在 *type(self)* 但不在 *self* 裡的旗標: ::" -#: ../../library/enum.rst:650 +#: ../../library/enum.rst:636 msgid "" ">>> ~white\n" "\n" @@ -1206,7 +1179,7 @@ msgstr "" ">>> ~Color.RED\n" "" -#: ../../library/enum.rst:659 +#: ../../library/enum.rst:645 msgid "" "Function used to format any remaining unnamed numeric values. Default is " "the value's repr; common choices are :func:`hex` and :func:`oct`." @@ -1214,17 +1187,18 @@ msgstr "" "用來格式化任何剩下未命名數值的函式。預設是值的 repr,常見選擇是 :func:`hex` " "和 :func:`oct`。" -#: ../../library/enum.rst:664 +#: ../../library/enum.rst:650 msgid "" "Using :class:`auto` with :class:`Flag` results in integers that are powers " "of two, starting with ``1``." msgstr ":class:`Flag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:667 -msgid "The *repr()* of zero-valued flags has changed. It is now::" +#: ../../library/enum.rst:653 +#, fuzzy +msgid "The *repr()* of zero-valued flags has changed. It is now:" msgstr "值為 0 的旗標的 *repr()* 已改變。現在是: ::" -#: ../../library/enum.rst:675 +#: ../../library/enum.rst:661 msgid "" "``IntFlag`` is the same as :class:`Flag`, but its members are also integers " "and can be used anywhere that an integer can be used." @@ -1232,13 +1206,13 @@ msgstr "" "``IntFlag`` 和 :class:`Flag` 一樣,但其成員同時也是整數而可以被用在任何使用整" "數的地方。" -#: ../../library/enum.rst:689 +#: ../../library/enum.rst:675 msgid "" "If any integer operation is performed with an *IntFlag* member, the result " "is not an *IntFlag*::" msgstr "如果 *IntFlag* 成員經過任何整數運算,其結果不是 *IntFlag*: ::" -#: ../../library/enum.rst:692 +#: ../../library/enum.rst:678 msgid "" ">>> Color.RED + 2\n" "3" @@ -1246,42 +1220,52 @@ msgstr "" ">>> Color.RED + 2\n" "3" -#: ../../library/enum.rst:695 +#: ../../library/enum.rst:681 msgid "If a :class:`Flag` operation is performed with an *IntFlag* member and:" msgstr "如果 *IntFlag* 成員經過 :class:`Flag` 操作且:" -#: ../../library/enum.rst:697 +#: ../../library/enum.rst:683 msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "結果是合法的 *IntFlag*:回傳 *IntFlag*" -#: ../../library/enum.rst:698 +#: ../../library/enum.rst:684 msgid "" -"the result is not a valid *IntFlag*: the result depends on the :class:" -"`FlagBoundary` setting" +"the result is not a valid *IntFlag*: the result depends on " +"the :class:`FlagBoundary` setting" msgstr "結果不是合法的 *IntFlag*:結果會根據 :class:`FlagBoundary` 的設定" -#: ../../library/enum.rst:700 -msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now:" +#: ../../library/enum.rst:686 +#, fuzzy +msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now::" msgstr "未命名且值為 0 的旗標的 :func:`repr` 已改變。現在是:" -#: ../../library/enum.rst:707 +#: ../../library/enum.rst:688 +#, fuzzy +msgid "" +">>> Color(0)\n" +"" +msgstr "" +">>> Color['BLUE']\n" +"" + +#: ../../library/enum.rst:693 msgid "" "Using :class:`auto` with :class:`IntFlag` results in integers that are " "powers of two, starting with ``1``." msgstr "" ":class:`IntFlag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:712 +#: ../../library/enum.rst:698 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` " "was already :meth:`!int.__format__` for that same reason." msgstr "" "為了更好地支援\\ *現存常數取代 (replacement of existing constants)* 的使用情" -"境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" -"meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" +"境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理" +"由,:meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:716 +#: ../../library/enum.rst:702 msgid "" "Inversion of an :class:`!IntFlag` now returns a positive value that is the " "union of all flags not in the given flag, rather than a negative value. This " @@ -1290,7 +1274,7 @@ msgstr "" ":class:`!IntFlag` 的反轉 (inversion) 現在會回傳正值,該值是不在給定旗標的所有" "旗標聯集,而不是一個負值。這符合現有 :class:`Flag` 的行為。" -#: ../../library/enum.rst:722 +#: ../../library/enum.rst:708 msgid "" ":class:`!ReprEnum` uses the :meth:`repr() ` of :class:`Enum`, " "but the :class:`str() ` of the mixed-in data type:" @@ -1298,24 +1282,25 @@ msgstr "" ":class:`!ReprEnum` 使用 :class:`Enum` 的 :meth:`repr() `,但使" "用混合資料型別的 :class:`str() `:" -#: ../../library/enum.rst:725 +#: ../../library/enum.rst:711 msgid ":meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`" msgstr "對 :class:`IntEnum` 和 :class:`IntFlag` 是 :meth:`!int.__str__`" -#: ../../library/enum.rst:726 +#: ../../library/enum.rst:712 msgid ":meth:`!str.__str__` for :class:`StrEnum`" msgstr "對 :class:`StrEnum` 是 :meth:`!str.__str__`" -#: ../../library/enum.rst:728 +#: ../../library/enum.rst:714 msgid "" -"Inherit from :class:`!ReprEnum` to keep the :class:`str() ` / :func:" -"`format` of the mixed-in data type instead of using the :class:`Enum`-" -"default :meth:`str() `." +"Inherit from :class:`!ReprEnum` to keep the :class:`str() " +"` / :func:`format` of the mixed-in data type instead of using " +"the :class:`Enum`-default :meth:`str() `." msgstr "" -"繼承 :class:`!ReprEnum` 來保留混合資料型別的 :class:`str() ` / :func:" -"`format`,而不是使用 :class:`Enum` 預設的 :meth:`str() `。" +"繼承 :class:`!ReprEnum` 來保留混合資料型別的 :class:`str() " +"` / :func:`format`,而不是使用 :class:`Enum` 預設的 :meth:`str() " +"`。" -#: ../../library/enum.rst:737 +#: ../../library/enum.rst:723 msgid "" "*EnumCheck* contains the options used by the :func:`verify` decorator to " "ensure various constraints; failed constraints result in a :exc:`ValueError`." @@ -1323,11 +1308,11 @@ msgstr "" "*EnumCheck* 包含 :func:`verify` 裝飾器使用的選項,以確保多樣的限制,不符合限" "制會產生 :exc:`ValueError`。" -#: ../../library/enum.rst:742 +#: ../../library/enum.rst:728 msgid "Ensure that each value has only one name::" msgstr "確保每個值只有一個名稱: ::" -#: ../../library/enum.rst:744 +#: ../../library/enum.rst:730 msgid "" ">>> from enum import Enum, verify, UNIQUE\n" ">>> @verify(UNIQUE)\n" @@ -1351,13 +1336,13 @@ msgstr "" "...\n" "ValueError: aliases found in : CRIMSON -> RED" -#: ../../library/enum.rst:758 +#: ../../library/enum.rst:744 msgid "" "Ensure that there are no missing values between the lowest-valued member and " "the highest-valued member::" msgstr "確保在最小值成員跟最大值成員間沒有缺少值: ::" -#: ../../library/enum.rst:761 +#: ../../library/enum.rst:747 msgid "" ">>> from enum import Enum, verify, CONTINUOUS\n" ">>> @verify(CONTINUOUS)\n" @@ -1379,7 +1364,7 @@ msgstr "" "...\n" "ValueError: invalid enum 'Color': missing values 3, 4" -#: ../../library/enum.rst:773 +#: ../../library/enum.rst:759 msgid "" "Ensure that any flag groups/masks contain only named flags -- useful when " "values are specified instead of being generated by :func:`auto`::" @@ -1387,7 +1372,7 @@ msgstr "" "確保任何旗標群組 / 遮罩只包含命名旗標 -- 當值是用指定而不是透過 :func:`auto` " "產生時是很實用的: ::" -#: ../../library/enum.rst:776 +#: ../../library/enum.rst:762 msgid "" ">>> from enum import Flag, verify, NAMED_FLAGS\n" ">>> @verify(NAMED_FLAGS)\n" @@ -1415,24 +1400,24 @@ msgstr "" "ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing " "combined values of 0x18 [use enum.show_flag_values(value) for details]" -#: ../../library/enum.rst:790 +#: ../../library/enum.rst:776 msgid "" "CONTINUOUS and NAMED_FLAGS are designed to work with integer-valued members." msgstr "CONTINUOUS 和 NAMED_FLAGS 是設計用來運作在整數值的成員上。" -#: ../../library/enum.rst:796 +#: ../../library/enum.rst:782 msgid "" -"``FlagBoundary`` controls how out-of-range values are handled in :class:" -"`Flag` and its subclasses." +"``FlagBoundary`` controls how out-of-range values are handled " +"in :class:`Flag` and its subclasses." msgstr "``FlagBoundary`` 控制在 :class:`Flag` 及其子類別中如何處理範圍外的值。" -#: ../../library/enum.rst:801 +#: ../../library/enum.rst:787 msgid "" "Out-of-range values cause a :exc:`ValueError` to be raised. This is the " "default for :class:`Flag`::" msgstr "範圍外的值會引發 :exc:`ValueError`。這是 :class:`Flag` 的預設行為: ::" -#: ../../library/enum.rst:804 +#: ../../library/enum.rst:790 msgid "" ">>> from enum import Flag, STRICT, auto\n" ">>> class StrictFlag(Flag, boundary=STRICT):\n" @@ -1460,13 +1445,13 @@ msgstr "" " given 0b0 10100\n" " allowed 0b0 00111" -#: ../../library/enum.rst:819 +#: ../../library/enum.rst:805 msgid "" -"Out-of-range values have invalid values removed, leaving a valid :class:" -"`Flag` value::" +"Out-of-range values have invalid values removed, leaving a " +"valid :class:`Flag` value::" msgstr "會移除範圍外的值中的非法值,留下合法的 :class:`Flag` 值: ::" -#: ../../library/enum.rst:822 +#: ../../library/enum.rst:808 msgid "" ">>> from enum import Flag, CONFORM, auto\n" ">>> class ConformFlag(Flag, boundary=CONFORM):\n" @@ -1486,13 +1471,13 @@ msgstr "" ">>> ConformFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:833 +#: ../../library/enum.rst:819 msgid "" -"Out-of-range values lose their :class:`Flag` membership and revert to :class:" -"`int`." +"Out-of-range values lose their :class:`Flag` membership and revert " +"to :class:`int`." msgstr "範圍外的值會失去它們的 :class:`Flag` 成員資格且恢復成 :class:`int`。" -#: ../../library/enum.rst:846 +#: ../../library/enum.rst:832 msgid "" "Out-of-range values are kept, and the :class:`Flag` membership is kept. This " "is the default for :class:`IntFlag`::" @@ -1500,7 +1485,7 @@ msgstr "" "範圍外的值會被保留,:class:`Flag` 成員資格也會被保留。這是 :class:`IntFlag` " "的預設行為: ::" -#: ../../library/enum.rst:849 +#: ../../library/enum.rst:835 msgid "" ">>> from enum import Flag, KEEP, auto\n" ">>> class KeepFlag(Flag, boundary=KEEP):\n" @@ -1520,7 +1505,7 @@ msgstr "" ">>> KeepFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:862 +#: ../../library/enum.rst:848 msgid "" "*EnumDict* is a subclass of :class:`dict` that is used as the namespace for " "defining enum classes (see :ref:`prepare`). It is exposed to allow " @@ -1529,31 +1514,31 @@ msgid "" "created, otherwise private names and internal classes will not be handled " "correctly." msgstr "" -"*EnumDict* 是 :class:`dict` 的子類別,用來作為定義列舉類別的命名空間(參見 :" -"ref:`prepare`)。它被公開來使得 :class:`EnumType` 的子類別能具有進階行為,例" -"如讓每個成員有多個值。它應該在被呼叫時帶上正在建立的列舉類別名稱,否則私有名" -"稱和內部類別將無法被正確處理。" +"*EnumDict* 是 :class:`dict` 的子類別,用來作為定義列舉類別的命名空間(參" +"見 :ref:`prepare`)。它被公開來使得 :class:`EnumType` 的子類別能具有進階行" +"為,例如讓每個成員有多個值。它應該在被呼叫時帶上正在建立的列舉類別名稱,否則" +"私有名稱和內部類別將無法被正確處理。" -#: ../../library/enum.rst:869 +#: ../../library/enum.rst:855 msgid "" -"Note that only the :class:`~collections.abc.MutableMapping` interface (:meth:" -"`~object.__setitem__` and :meth:`~dict.update`) is overridden. It may be " -"possible to bypass the checks using other :class:`!dict` operations like :" -"meth:`|= `." +"Note that only the :class:`~collections.abc.MutableMapping` interface " +"(:meth:`~object.__setitem__` and :meth:`~dict.update`) is overridden. It may " +"be possible to bypass the checks using other :class:`!dict` operations " +"like :meth:`|= `." msgstr "" -"注意只有 :class:`~collections.abc.MutableMapping` 介面(:meth:`~object." -"__setitem__` 和 :meth:`~dict.update`)被覆寫。可能可以使用其他 :class:`!" -"dict` 操作來繞過檢查,例如 :meth:`|= `。" +"注意只有 :class:`~collections.abc.MutableMapping` 介面" +"(:meth:`~object.__setitem__` 和 :meth:`~dict.update`)被覆寫。可能可以使用其" +"他 :class:`!dict` 操作來繞過檢查,例如 :meth:`|= `。" -#: ../../library/enum.rst:876 +#: ../../library/enum.rst:862 msgid "A list of member names." msgstr "一個成員名稱的串列。" -#: ../../library/enum.rst:883 +#: ../../library/enum.rst:869 msgid "Supported ``__dunder__`` names" msgstr "支援的 ``__dunder__`` 名稱" -#: ../../library/enum.rst:885 +#: ../../library/enum.rst:871 msgid "" ":attr:`~EnumType.__members__` is a read-only ordered mapping of " "``member_name``:``member`` items. It is only available on the class." @@ -1561,7 +1546,7 @@ msgstr "" ":attr:`~EnumType.__members__` 是一個唯讀有序的\\ ``成員名稱``:``成員``\\ 項" "目的對映。只有在類別上可用。" -#: ../../library/enum.rst:888 +#: ../../library/enum.rst:874 msgid "" ":meth:`~Enum.__new__`, if specified, must create and return the enum " "members; it is also a very good idea to set the member's :attr:`!_value_` " @@ -1571,35 +1556,49 @@ msgstr "" "的 :attr:`!_value_` 也是一個很好的主意。一旦所有成員都建立之後就不會再被用" "到。" -#: ../../library/enum.rst:894 +#: ../../library/enum.rst:880 msgid "Supported ``_sunder_`` names" msgstr "支援的 ``_sunder_`` 名稱" -#: ../../library/enum.rst:896 +#: ../../library/enum.rst:882 +#, fuzzy +msgid "" +":meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing " +"member." +msgstr ":meth:`~Enum._add_alias_` -- 新增一個名稱作為現有成員的別名。" + +#: ../../library/enum.rst:884 +#, fuzzy +msgid "" +":meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an " +"existing member." +msgstr ":meth:`~Enum._add_value_alias_` -- 新增一個值作為現有成員的別名。" + +#: ../../library/enum.rst:886 msgid ":attr:`~Enum._name_` -- name of the member" msgstr ":attr:`~Enum._name_` -- 成員名稱" -#: ../../library/enum.rst:897 +#: ../../library/enum.rst:887 msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" msgstr ":attr:`~Enum._value_` -- 成員的值;可以在 ``__new__`` 設定" -#: ../../library/enum.rst:898 +#: ../../library/enum.rst:888 msgid "" ":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " "may be overridden" msgstr "" ":meth:`~Enum._missing_` -- 當值沒有被找到時會使用的查詢函式;可以被覆寫" -#: ../../library/enum.rst:900 +#: ../../library/enum.rst:890 msgid "" -":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" -"class:`str`, that will not be transformed into members, and will be removed " -"from the final class" +":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or " +"a :class:`str`, that will not be transformed into members, and will be " +"removed from the final class" msgstr "" -":attr:`~Enum._ignore_` -- 一個名稱的串列,可以是 :class:`list` 或 :class:" -"`str`,它不會被轉換成成員,且在最後的類別上會被移除" +":attr:`~Enum._ignore_` -- 一個名稱的串列,可以是 :class:`list` " +"或 :class:`str`,它不會被轉換成成員,且在最後的類別上會被移除" -#: ../../library/enum.rst:903 +#: ../../library/enum.rst:893 msgid "" ":attr:`~Enum._order_` -- no longer used, kept for backward compatibility " "(class attribute, removed during class creation)" @@ -1607,40 +1606,28 @@ msgstr "" ":attr:`~Enum._order_` -- 不再被使用,僅為了向後相容而保留(類別屬性,在類別建" "立時移除)" -#: ../../library/enum.rst:905 +#: ../../library/enum.rst:895 msgid "" ":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " "an enum member; may be overridden" msgstr "" ":meth:`~Enum._generate_next_value_` -- 用來為列舉成員取得合適的值;可以被覆寫" -#: ../../library/enum.rst:910 +#: ../../library/enum.rst:900 msgid "" "For standard :class:`Enum` classes the next value chosen is the highest " "value seen incremented by one." msgstr "" "對標準的 :class:`Enum` 類別來說,下一個被選擇的值是所看過的最大值加一。" -#: ../../library/enum.rst:913 +#: ../../library/enum.rst:903 msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " "power-of-two." msgstr "" "對 :class:`Flag` 類別來說,下一個被選擇的值是下一個最大的 2 的次方的數字。" -#: ../../library/enum.rst:916 -msgid "" -":meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing " -"member." -msgstr ":meth:`~Enum._add_alias_` -- 新增一個名稱作為現有成員的別名。" - -#: ../../library/enum.rst:918 -msgid "" -":meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an " -"existing member." -msgstr ":meth:`~Enum._add_value_alias_` -- 新增一個值作為現有成員的別名。" - -#: ../../library/enum.rst:921 +#: ../../library/enum.rst:906 msgid "" "While ``_sunder_`` names are generally reserved for the further development " "of the :class:`Enum` class and can not be used, some are explicitly allowed:" @@ -1648,55 +1635,57 @@ msgstr "" "雖然 ``_sunder_`` 名稱通常保留用於 :class:`Enum` 類別的進一步開發而不能被使" "用,但有些是明確允許的:" -#: ../../library/enum.rst:924 +#: ../../library/enum.rst:909 msgid "" "``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" msgstr "" "``_repr_*``\\ (例如 ``_repr_html_``),例如用於 `IPython 的豐富顯示 " "`_" -#: ../../library/enum.rst:926 +#: ../../library/enum.rst:911 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "``_missing_``、``_order_``、``_generate_next_value_``" -#: ../../library/enum.rst:927 +#: ../../library/enum.rst:912 msgid "``_ignore_``" msgstr "``_ignore_``" -#: ../../library/enum.rst:928 +#: ../../library/enum.rst:913 msgid "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" msgstr "``_add_alias_``、``_add_value_alias_``、``_repr_*``" -#: ../../library/enum.rst:934 +#: ../../library/enum.rst:919 msgid "Utilities and Decorators" msgstr "通用項目與裝飾器" -#: ../../library/enum.rst:938 +#: ../../library/enum.rst:923 msgid "" "*auto* can be used in place of a value. If used, the *Enum* machinery will " "call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an " "appropriate value. For :class:`Enum` and :class:`IntEnum` that appropriate " -"value will be the last value plus one; for :class:`Flag` and :class:" -"`IntFlag` it will be the first power-of-two greater than the highest value; " -"for :class:`StrEnum` it will be the lower-cased version of the member's " -"name. Care must be taken if mixing *auto()* with manually specified values." +"value will be the last value plus one; for :class:`Flag` " +"and :class:`IntFlag` it will be the first power-of-two greater than the " +"highest value; for :class:`StrEnum` it will be the lower-cased version of " +"the member's name. Care must be taken if mixing *auto()* with manually " +"specified values." msgstr "" -"*auto* 可以用來取代給值。如果使用的話,*Enum* 系統會呼叫 :class:`Enum` 的 :" -"meth:`~Enum._generate_next_value_` 來取得合適的值。對 :class:`Enum` 和 :" -"class:`IntEnum` 來說,合適的值是最後一個值加一;對 :class:`Flag` 和 :class:" -"`IntFlag` 來說,是第一個比最大值還大的 2 的次方的數字;對 :class:`StrEnum` 來" -"說,是成員名稱的小寫版本。如果混用 *auto()* 和手動指定值的話要特別注意。" +"*auto* 可以用來取代給值。如果使用的話,*Enum* 系統會呼叫 :class:`Enum` " +"的 :meth:`~Enum._generate_next_value_` 來取得合適的值。對 :class:`Enum` " +"和 :class:`IntEnum` 來說,合適的值是最後一個值加一;對 :class:`Flag` " +"和 :class:`IntFlag` 來說,是第一個比最大值還大的 2 的次方的數字;" +"對 :class:`StrEnum` 來說,是成員名稱的小寫版本。如果混用 *auto()* 和手動指定" +"值的話要特別注意。" -#: ../../library/enum.rst:946 +#: ../../library/enum.rst:931 msgid "" "*auto* instances are only resolved when at the top level of an assignment:" msgstr "*auto* 實例只有在最上層的賦值時才會被解析:" -#: ../../library/enum.rst:948 +#: ../../library/enum.rst:933 msgid "``FIRST = auto()`` will work (auto() is replaced with ``1``);" msgstr "``FIRST = auto()`` 可以運作(auto() 會被取代成 ``1``)" -#: ../../library/enum.rst:949 +#: ../../library/enum.rst:934 msgid "" "``SECOND = auto(), -2`` will work (auto is replaced with ``2``, so ``2, -2`` " "is used to create the ``SECOND`` enum member;" @@ -1704,7 +1693,7 @@ msgstr "" "``SECOND = auto(), -2`` 可以運作(auto 會被取代成 ``2``, 因此 ``2, -2`` 會被" "用來建立列舉成員 ``SECOND``;" -#: ../../library/enum.rst:951 +#: ../../library/enum.rst:936 msgid "" "``THREE = [auto(), -3]`` will *not* work (``, -3`` is used to " "create the ``THREE`` enum member)" @@ -1712,19 +1701,19 @@ msgstr "" "``THREE = [auto(), -3]`` *無法*\\ 運作(\\ ``, -3`` 會被用來建立列" "舉成員 ``THREE``)" -#: ../../library/enum.rst:956 +#: ../../library/enum.rst:941 msgid "" "In prior versions, ``auto()`` had to be the only thing on the assignment " "line to work properly." msgstr "在之前的版本中,``auto()`` 必須是賦值行裡的唯一內容才能運作正確。" -#: ../../library/enum.rst:959 +#: ../../library/enum.rst:944 msgid "" "``_generate_next_value_`` can be overridden to customize the values used by " "*auto*." msgstr "可以覆寫 ``_generate_next_value_`` 來客製 *auto* 使用的值。" -#: ../../library/enum.rst:962 +#: ../../library/enum.rst:947 msgid "" "in 3.13 the default ``_generate_next_value_`` will always return the highest " "member value incremented by 1, and will fail if any member is an " @@ -1733,7 +1722,7 @@ msgstr "" "在 3.13 預設 ``_generate_next_value_`` 總是回傳最大的成員值加一,如果任何成員" "是不相容的型別就會失敗。" -#: ../../library/enum.rst:968 +#: ../../library/enum.rst:953 msgid "" "A decorator similar to the built-in *property*, but specifically for " "enumerations. It allows member attributes to have the same names as members " @@ -1742,7 +1731,7 @@ msgstr "" "和內建的 *property* 相似的裝飾器,但只專門針對列舉。它允許成員屬性和成員本身" "有相同名稱。" -#: ../../library/enum.rst:972 +#: ../../library/enum.rst:957 msgid "" "the *property* and the member must be defined in separate classes; for " "example, the *value* and *name* attributes are defined in the *Enum* class, " @@ -1752,17 +1741,17 @@ msgstr "" "*屬性*\\ 和成員必須定義在分開的類別裡;例如 *value* 和 *name* 屬性定義在 " "*Enum* 類別而 *Enum* 子類別可以定義成員名稱為 ``value`` 和 ``name``。" -#: ../../library/enum.rst:981 +#: ../../library/enum.rst:966 msgid "" "A :keyword:`class` decorator specifically for enumerations. It searches an " "enumeration's :attr:`~EnumType.__members__`, gathering any aliases it finds; " "if any are found :exc:`ValueError` is raised with the details::" msgstr "" -"專門針對列舉的 :keyword:`class` 裝飾器。它搜尋列舉的 :attr:`~EnumType." -"__members__`,蒐集任何它找到的別名;如果有找到任何別名則引發 :exc:" -"`ValueError` 並附上細節: ::" +"專門針對列舉的 :keyword:`class` 裝飾器。它搜尋列舉" +"的 :attr:`~EnumType.__members__`,蒐集任何它找到的別名;如果有找到任何別名則" +"引發 :exc:`ValueError` 並附上細節: ::" -#: ../../library/enum.rst:985 +#: ../../library/enum.rst:970 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -1788,24 +1777,24 @@ msgstr "" "...\n" "ValueError: duplicate values found in : FOUR -> THREE" -#: ../../library/enum.rst:999 +#: ../../library/enum.rst:984 msgid "" -"A :keyword:`class` decorator specifically for enumerations. Members from :" -"class:`EnumCheck` are used to specify which constraints should be checked on " -"the decorated enumeration." +"A :keyword:`class` decorator specifically for enumerations. Members " +"from :class:`EnumCheck` are used to specify which constraints should be " +"checked on the decorated enumeration." msgstr "" "專門針對列舉的 :keyword:`class` 裝飾器。使用 :class:`EnumCheck` 裡的成員來指" "定在裝飾的列舉上應該檢查什麼限制。" -#: ../../library/enum.rst:1007 +#: ../../library/enum.rst:992 msgid "A decorator for use in enums: its target will become a member." msgstr "列舉所使用的裝飾器:其目標會變成成員。" -#: ../../library/enum.rst:1013 +#: ../../library/enum.rst:998 msgid "A decorator for use in enums: its target will not become a member." msgstr "列舉所使用的裝飾器:其目標不會變成成員。" -#: ../../library/enum.rst:1019 +#: ../../library/enum.rst:1004 msgid "" "A decorator to change the :class:`str() ` and :func:`repr` of an enum " "to show its members as belonging to the module instead of its class. Should " @@ -1816,19 +1805,19 @@ msgstr "" "組而不是其類別。應該只有當列舉成員被匯出到模組的全域命名空間才使用(範例請參" "考 :class:`re.RegexFlag`)。" -#: ../../library/enum.rst:1028 +#: ../../library/enum.rst:1014 msgid "Return a list of all power-of-two integers contained in a flag *value*." msgstr "回傳在旗標\\ *值*\\ 中包含的所有 2 的次方的整數串列。" -#: ../../library/enum.rst:1036 +#: ../../library/enum.rst:1021 msgid "Notes" msgstr "備註" -#: ../../library/enum.rst:1038 +#: ../../library/enum.rst:1023 msgid ":class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag`" msgstr ":class:`IntEnum`、:class:`StrEnum` 及 :class:`IntFlag`" -#: ../../library/enum.rst:1040 +#: ../../library/enum.rst:1025 msgid "" "These three enum types are designed to be drop-in replacements for existing " "integer- and string-based values; as such, they have extra limitations:" @@ -1836,17 +1825,17 @@ msgstr "" "這三種列舉型別是設計來直接取代現有以整數及字串為基底的值;因此它們有額外的限" "制:" -#: ../../library/enum.rst:1043 +#: ../../library/enum.rst:1028 msgid "``__str__`` uses the value and not the name of the enum member" msgstr "``__str__`` 使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:1045 +#: ../../library/enum.rst:1030 msgid "" "``__format__``, because it uses ``__str__``, will also use the value of the " "enum member instead of its name" msgstr "``__format__`` 因為使用 ``__str__``,也會使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:1048 +#: ../../library/enum.rst:1033 msgid "" "If you do not need/want those limitations, you can either create your own " "base class by mixing in the ``int`` or ``str`` type yourself::" @@ -1854,7 +1843,7 @@ msgstr "" "如果你不需要或不想要這些限制,你可以透過混合 ``int`` 或 ``str`` 型別來建立自" "己的基礎類別: ::" -#: ../../library/enum.rst:1051 +#: ../../library/enum.rst:1036 msgid "" ">>> from enum import Enum\n" ">>> class MyIntEnum(int, Enum):\n" @@ -1864,11 +1853,11 @@ msgstr "" ">>> class MyIntEnum(int, Enum):\n" "... pass" -#: ../../library/enum.rst:1055 +#: ../../library/enum.rst:1040 msgid "or you can reassign the appropriate :meth:`str`, etc., in your enum::" msgstr "或者你也可以在你的列舉重新給定合適的 :meth:`str`: ::" -#: ../../library/enum.rst:1057 +#: ../../library/enum.rst:1042 msgid "" ">>> from enum import Enum, IntEnum\n" ">>> class MyIntEnum(IntEnum):\n" @@ -1877,3 +1866,27 @@ msgstr "" ">>> from enum import Enum, IntEnum\n" ">>> class MyIntEnum(IntEnum):\n" "... __str__ = Enum.__str__" + +#~ msgid "Adds a new name as an alias to an existing member::" +#~ msgstr "新增一個名稱作為現有成員的別名: ::" + +#~ msgid "" +#~ ">>> Color.RED._add_alias_(\"ERROR\")\n" +#~ ">>> Color.ERROR\n" +#~ "" +#~ msgstr "" +#~ ">>> Color.RED._add_alias_(\"ERROR\")\n" +#~ ">>> Color.ERROR\n" +#~ "" + +#~ msgid "Adds a new value as an alias to an existing member::" +#~ msgstr "新增一個值作為現有成員的別名: ::" + +#~ msgid "" +#~ ">>> Color.RED._add_value_alias_(42)\n" +#~ ">>> Color(42)\n" +#~ "" +#~ msgstr "" +#~ ">>> Color.RED._add_value_alias_(42)\n" +#~ ">>> Color(42)\n" +#~ "" diff --git a/library/errno.po b/library/errno.po index 53fcac01e5a..58a75aa3b73 100644 --- a/library/errno.po +++ b/library/errno.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-29 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -39,8 +39,8 @@ msgstr "" #: ../../library/errno.rst:21 msgid "" -"To translate a numeric error code to an error message, use :func:`os." -"strerror`." +"To translate a numeric error code to an error message, " +"use :func:`os.strerror`." msgstr "" #: ../../library/errno.rst:23 @@ -52,26 +52,26 @@ msgstr "" #: ../../library/errno.rst:30 msgid "" -"Operation not permitted. This error is mapped to the exception :exc:" -"`PermissionError`." +"Operation not permitted. This error is mapped to the " +"exception :exc:`PermissionError`." msgstr "" #: ../../library/errno.rst:36 msgid "" -"No such file or directory. This error is mapped to the exception :exc:" -"`FileNotFoundError`." +"No such file or directory. This error is mapped to the " +"exception :exc:`FileNotFoundError`." msgstr "" #: ../../library/errno.rst:42 msgid "" -"No such process. This error is mapped to the exception :exc:" -"`ProcessLookupError`." +"No such process. This error is mapped to the " +"exception :exc:`ProcessLookupError`." msgstr "" #: ../../library/errno.rst:48 msgid "" -"Interrupted system call. This error is mapped to the exception :exc:" -"`InterruptedError`." +"Interrupted system call. This error is mapped to the " +"exception :exc:`InterruptedError`." msgstr "" #: ../../library/errno.rst:54 @@ -96,8 +96,8 @@ msgstr "" #: ../../library/errno.rst:79 msgid "" -"No child processes. This error is mapped to the exception :exc:" -"`ChildProcessError`." +"No child processes. This error is mapped to the " +"exception :exc:`ChildProcessError`." msgstr "" #: ../../library/errno.rst:85 @@ -111,8 +111,8 @@ msgstr "" #: ../../library/errno.rst:95 msgid "" -"Permission denied. This error is mapped to the exception :exc:" -"`PermissionError`." +"Permission denied. This error is mapped to the " +"exception :exc:`PermissionError`." msgstr "" #: ../../library/errno.rst:101 @@ -142,14 +142,14 @@ msgstr "" #: ../../library/errno.rst:132 msgid "" -"Not a directory. This error is mapped to the exception :exc:" -"`NotADirectoryError`." +"Not a directory. This error is mapped to the " +"exception :exc:`NotADirectoryError`." msgstr "" #: ../../library/errno.rst:138 msgid "" -"Is a directory. This error is mapped to the exception :exc:" -"`IsADirectoryError`." +"Is a directory. This error is mapped to the " +"exception :exc:`IsADirectoryError`." msgstr "" #: ../../library/errno.rst:144 @@ -231,8 +231,8 @@ msgstr "" #: ../../library/errno.rst:240 msgid "" -"Operation would block. This error is mapped to the exception :exc:" -"`BlockingIOError`." +"Operation would block. This error is mapped to the " +"exception :exc:`BlockingIOError`." msgstr "" #: ../../library/errno.rst:246 @@ -485,14 +485,14 @@ msgstr "" #: ../../library/errno.rst:558 msgid "" -"Software caused connection abort. This error is mapped to the exception :exc:" -"`ConnectionAbortedError`." +"Software caused connection abort. This error is mapped to the " +"exception :exc:`ConnectionAbortedError`." msgstr "" #: ../../library/errno.rst:564 msgid "" -"Connection reset by peer. This error is mapped to the exception :exc:" -"`ConnectionResetError`." +"Connection reset by peer. This error is mapped to the " +"exception :exc:`ConnectionResetError`." msgstr "" #: ../../library/errno.rst:570 @@ -519,14 +519,14 @@ msgstr "" #: ../../library/errno.rst:596 msgid "" -"Connection timed out. This error is mapped to the exception :exc:" -"`TimeoutError`." +"Connection timed out. This error is mapped to the " +"exception :exc:`TimeoutError`." msgstr "" #: ../../library/errno.rst:602 msgid "" -"Connection refused. This error is mapped to the exception :exc:" -"`ConnectionRefusedError`." +"Connection refused. This error is mapped to the " +"exception :exc:`ConnectionRefusedError`." msgstr "" #: ../../library/errno.rst:608 @@ -538,171 +538,175 @@ msgid "No route to host" msgstr "" #: ../../library/errno.rst:618 +msgid "Memory page has hardware error." +msgstr "" + +#: ../../library/errno.rst:625 msgid "" -"Operation already in progress. This error is mapped to the exception :exc:" -"`BlockingIOError`." +"Operation already in progress. This error is mapped to the " +"exception :exc:`BlockingIOError`." msgstr "" -#: ../../library/errno.rst:624 +#: ../../library/errno.rst:631 msgid "" -"Operation now in progress. This error is mapped to the exception :exc:" -"`BlockingIOError`." +"Operation now in progress. This error is mapped to the " +"exception :exc:`BlockingIOError`." msgstr "" -#: ../../library/errno.rst:630 +#: ../../library/errno.rst:637 msgid "Stale NFS file handle" msgstr "" -#: ../../library/errno.rst:635 +#: ../../library/errno.rst:642 msgid "Structure needs cleaning" msgstr "" -#: ../../library/errno.rst:640 +#: ../../library/errno.rst:647 msgid "Not a XENIX named type file" msgstr "" -#: ../../library/errno.rst:645 +#: ../../library/errno.rst:652 msgid "No XENIX semaphores available" msgstr "" -#: ../../library/errno.rst:650 +#: ../../library/errno.rst:657 msgid "Is a named type file" msgstr "" -#: ../../library/errno.rst:655 +#: ../../library/errno.rst:662 msgid "Remote I/O error" msgstr "" -#: ../../library/errno.rst:660 +#: ../../library/errno.rst:667 msgid "Quota exceeded" msgstr "" -#: ../../library/errno.rst:664 +#: ../../library/errno.rst:671 msgid "Interface output queue is full" msgstr "" -#: ../../library/errno.rst:671 +#: ../../library/errno.rst:678 msgid "No medium found" msgstr "" -#: ../../library/errno.rst:676 +#: ../../library/errno.rst:683 msgid "Wrong medium type" msgstr "" -#: ../../library/errno.rst:681 +#: ../../library/errno.rst:688 msgid "Required key not available" msgstr "" -#: ../../library/errno.rst:686 +#: ../../library/errno.rst:693 msgid "Key has expired" msgstr "" -#: ../../library/errno.rst:691 +#: ../../library/errno.rst:698 msgid "Key has been revoked" msgstr "" -#: ../../library/errno.rst:696 +#: ../../library/errno.rst:703 msgid "Key was rejected by service" msgstr "" -#: ../../library/errno.rst:701 +#: ../../library/errno.rst:708 msgid "Operation not possible due to RF-kill" msgstr "" -#: ../../library/errno.rst:706 +#: ../../library/errno.rst:713 msgid "Locked lock was unmapped" msgstr "" -#: ../../library/errno.rst:711 +#: ../../library/errno.rst:718 msgid "Facility is not active" msgstr "" -#: ../../library/errno.rst:716 +#: ../../library/errno.rst:723 msgid "Authentication error" msgstr "" -#: ../../library/errno.rst:723 +#: ../../library/errno.rst:730 msgid "Bad CPU type in executable" msgstr "" -#: ../../library/errno.rst:730 +#: ../../library/errno.rst:737 msgid "Bad executable (or shared library)" msgstr "" -#: ../../library/errno.rst:737 +#: ../../library/errno.rst:744 msgid "Malformed Mach-o file" msgstr "" -#: ../../library/errno.rst:744 +#: ../../library/errno.rst:751 msgid "Device error" msgstr "" -#: ../../library/errno.rst:751 +#: ../../library/errno.rst:758 msgid "Inappropriate file type or format" msgstr "" -#: ../../library/errno.rst:758 +#: ../../library/errno.rst:765 msgid "Need authenticator" msgstr "" -#: ../../library/errno.rst:765 +#: ../../library/errno.rst:772 msgid "Attribute not found" msgstr "" -#: ../../library/errno.rst:772 +#: ../../library/errno.rst:779 msgid "Policy not found" msgstr "" -#: ../../library/errno.rst:779 +#: ../../library/errno.rst:786 msgid "Too many processes" msgstr "" -#: ../../library/errno.rst:786 +#: ../../library/errno.rst:793 msgid "Bad procedure for program" msgstr "" -#: ../../library/errno.rst:793 +#: ../../library/errno.rst:800 msgid "Program version wrong" msgstr "" -#: ../../library/errno.rst:800 +#: ../../library/errno.rst:807 msgid "RPC prog. not avail" msgstr "" -#: ../../library/errno.rst:807 +#: ../../library/errno.rst:814 msgid "Device power is off" msgstr "" -#: ../../library/errno.rst:814 +#: ../../library/errno.rst:821 msgid "RPC struct is bad" msgstr "" -#: ../../library/errno.rst:821 +#: ../../library/errno.rst:828 msgid "RPC version wrong" msgstr "" -#: ../../library/errno.rst:828 +#: ../../library/errno.rst:835 msgid "Shared library version mismatch" msgstr "" -#: ../../library/errno.rst:835 +#: ../../library/errno.rst:842 msgid "" -"Capabilities insufficient. This error is mapped to the exception :exc:" -"`PermissionError`." +"Capabilities insufficient. This error is mapped to the " +"exception :exc:`PermissionError`." msgstr "" -#: ../../library/errno.rst:838 +#: ../../library/errno.rst:845 msgid "Availability" msgstr "可用性" -#: ../../library/errno.rst:845 +#: ../../library/errno.rst:852 msgid "Operation canceled" msgstr "" -#: ../../library/errno.rst:852 +#: ../../library/errno.rst:859 msgid "Owner died" msgstr "" -#: ../../library/errno.rst:859 +#: ../../library/errno.rst:866 msgid "State not recoverable" msgstr "" diff --git a/library/exceptions.po b/library/exceptions.po index bc2c4e7aea7..8704cb18934 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-30 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-12-20 16:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,12 +24,13 @@ msgstr "內建的例外" #: ../../library/exceptions.rst:10 msgid "" -"In Python, all exceptions must be instances of a class that derives from :" -"class:`BaseException`. In a :keyword:`try` statement with an :keyword:" -"`except` clause that mentions a particular class, that clause also handles " -"any exception classes derived from that class (but not exception classes " -"from which *it* is derived). Two exception classes that are not related via " -"subclassing are never equivalent, even if they have the same name." +"In Python, all exceptions must be instances of a class that derives " +"from :class:`BaseException`. In a :keyword:`try` statement with " +"an :keyword:`except` clause that mentions a particular class, that clause " +"also handles any exception classes derived from that class (but not " +"exception classes from which *it* is derived). Two exception classes that " +"are not related via subclassing are never equivalent, even if they have the " +"same name." msgstr "" "在 Python 中,所有例外必須是從 :class:`BaseException` 衍生的類別的實例。在陳" "述式 :keyword:`try` 搭配 :keyword:`except` 子句裡提到一個特定的類別時,那個子" @@ -66,10 +67,10 @@ msgstr "" #: ../../library/exceptions.rst:31 msgid "" "The built-in exception classes can be subclassed to define new exceptions; " -"programmers are encouraged to derive new exceptions from the :exc:" -"`Exception` class or one of its subclasses, and not from :exc:" -"`BaseException`. More information on defining exceptions is available in " -"the Python Tutorial under :ref:`tut-userexceptions`." +"programmers are encouraged to derive new exceptions from " +"the :exc:`Exception` class or one of its subclasses, and not " +"from :exc:`BaseException`. More information on defining exceptions is " +"available in the Python Tutorial under :ref:`tut-userexceptions`." msgstr "" "可以從內建的例外類別定義新的例外子類別;程式設計師被鼓勵從 :exc:`Exception` " "類別或其子類別衍生新的例外,而不是從 :exc:`BaseException` 來衍生。更多關於定" @@ -89,13 +90,13 @@ msgstr "三個例外物件上的屬性提供關於引發此例外的情境的資 msgid "" "When raising a new exception while another exception is already being " "handled, the new exception's :attr:`!__context__` attribute is automatically " -"set to the handled exception. An exception may be handled when an :keyword:" -"`except` or :keyword:`finally` clause, or a :keyword:`with` statement, is " -"used." +"set to the handled exception. An exception may be handled when " +"an :keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " +"statement, is used." msgstr "" "當引發一個新的例外而同時有另一個例外已經正在被處理時,這個新例外的 :attr:`!" -"__context__` 屬性會自動被設成那個已處理的例外。當使用 :keyword:`except` 或 :" -"keyword:`finally` 子句或 :keyword:`with` 陳述式的時候例外會被處理。" +"__context__` 屬性會自動被設成那個已處理的例外。當使用 :keyword:`except` " +"或 :keyword:`finally` 子句或 :keyword:`with` 陳述式的時候例外會被處理。" #: ../../library/exceptions.rst:59 msgid "" @@ -121,11 +122,11 @@ msgid "" "introspection when debugging." msgstr "" "在 :keyword:`from` 後面的運算式必須是一個例外或 ``None``。它將會被設定" -"成所引發例外的 :attr:`!__cause__`。設定 :attr:`!__cause__` 也隱含地設定 :" -"attr:`!__suppress_context__` 屬性為 ``True``,因此使用 ``raise new_exc from " -"None`` 實際上會以新的例外取代舊的例外以利於顯示(例如轉換 :exc:`KeyError` " -"為 :exc:`AttributeError`),同時保持舊的例外可以透過 :attr:`!__context__` 取" -"得以方便 debug 的時候檢查。" +"成所引發例外的 :attr:`!__cause__`。設定 :attr:`!__cause__` 也隱含地設" +"定 :attr:`!__suppress_context__` 屬性為 ``True``,因此使用 ``raise new_exc " +"from None`` 實際上會以新的例外取代舊的例外以利於顯示(例如轉" +"換 :exc:`KeyError` 為 :exc:`AttributeError`),同時保持舊的例外可以透" +"過 :attr:`!__context__` 取得以方便 debug 的時候檢查。" #: ../../library/exceptions.rst:74 msgid "" @@ -167,17 +168,18 @@ msgstr "" #: ../../library/exceptions.rst:95 msgid "" -"Most built-in exceptions are implemented in C for efficiency, see: :source:" -"`Objects/exceptions.c`. Some have custom memory layouts which makes it " -"impossible to create a subclass that inherits from multiple exception types. " -"The memory layout of a type is an implementation detail and might change " -"between Python versions, leading to new conflicts in the future. Therefore, " -"it's recommended to avoid subclassing multiple exception types altogether." +"Most built-in exceptions are implemented in C for efficiency, " +"see: :source:`Objects/exceptions.c`. Some have custom memory layouts which " +"makes it impossible to create a subclass that inherits from multiple " +"exception types. The memory layout of a type is an implementation detail and " +"might change between Python versions, leading to new conflicts in the " +"future. Therefore, it's recommended to avoid subclassing multiple exception " +"types altogether." msgstr "" -"為了效率,大部分的內建例外使用 C 來實作,參考 :source:`Objects/exceptions." -"c`。一些例外有客製化的記憶體佈局,使其不可能建立一個繼承多種例外型別的子類" -"別。型別的記憶體佈局是實作細節且可能會在不同 Python 版本間改變,造成未來新的" -"衝突。因此,總之建議避免繼承多種例外型別。" +"為了效率,大部分的內建例外使用 C 來實作,參考 :source:`Objects/" +"exceptions.c`。一些例外有客製化的記憶體佈局,使其不可能建立一個繼承多種例外型" +"別的子類別。型別的記憶體佈局是實作細節且可能會在不同 Python 版本間改變,造成" +"未來新的衝突。因此,總之建議避免繼承多種例外型別。" #: ../../library/exceptions.rst:105 msgid "Base classes" @@ -192,14 +194,14 @@ msgstr "以下的例外大部分被用在當作其他例外的基底類別。" #: ../../library/exceptions.rst:111 msgid "" "The base class for all built-in exceptions. It is not meant to be directly " -"inherited by user-defined classes (for that, use :exc:`Exception`). If :" -"func:`str` is called on an instance of this class, the representation of the " -"argument(s) to the instance are returned, or the empty string when there " +"inherited by user-defined classes (for that, use :exc:`Exception`). " +"If :func:`str` is called on an instance of this class, the representation of " +"the argument(s) to the instance are returned, or the empty string when there " "were no arguments." msgstr "" -"所有內建例外的基底類別。這不是為了讓使用者定義的類別直接繼承(可以使用 :exc:" -"`Exception`)。如果在這個類別的實例上呼叫 :func:`str`,會回傳實例的引數的表" -"示,或者沒有引數的時候會回傳空字串。" +"所有內建例外的基底類別。這不是為了讓使用者定義的類別直接繼承(可以使" +"用 :exc:`Exception`)。如果在這個類別的實例上呼叫 :func:`str`,會回傳實例的引" +"數的表示,或者沒有引數的時候會回傳空字串。" #: ../../library/exceptions.rst:119 msgid "" @@ -262,8 +264,9 @@ msgstr "" #: ../../library/exceptions.rst:157 msgid "" -"A list of the notes of this exception, which were added with :meth:" -"`add_note`. This attribute is created when :meth:`add_note` is called." +"A list of the notes of this exception, which were added " +"with :meth:`add_note`. This attribute is created when :meth:`add_note` is " +"called." msgstr "" "該例外的備註串列,使用 :meth:`add_note` 來新增。此屬性在 :meth:`add_note` 被" "呼叫的時候建立。" @@ -279,11 +282,12 @@ msgstr "" #: ../../library/exceptions.rst:171 msgid "" "The base class for those built-in exceptions that are raised for various " -"arithmetic errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:" -"`FloatingPointError`." +"arithmetic " +"errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:`FloatingPointError`." msgstr "" -"各種運算錯誤所引發的那些內建例外::exc:`OverflowError`、:exc:" -"`ZeroDivisionError`、:exc:`FloatingPointError` 的基底類別。" +"各種運算錯誤所引發的那些內建例" +"外::exc:`OverflowError`、:exc:`ZeroDivisionError`、:exc:`FloatingPointError` " +"的基底類別。" #: ../../library/exceptions.rst:178 msgid "" @@ -299,8 +303,9 @@ msgid "" "on a mapping or sequence is invalid: :exc:`IndexError`, :exc:`KeyError`. " "This can be raised directly by :func:`codecs.lookup`." msgstr "" -"當使用在對映或序列上的鍵或索引是無效的時候所引發的例外::exc:`IndexError`、:" -"exc:`KeyError` 的基底類別。這可以被 :func:`codecs.lookup` 直接引發。" +"當使用在對映或序列上的鍵或索引是無效的時候所引發的例" +"外::exc:`IndexError`、:exc:`KeyError` 的基底類別。這可以" +"被 :func:`codecs.lookup` 直接引發。" #: ../../library/exceptions.rst:190 msgid "Concrete exceptions" @@ -344,8 +349,9 @@ msgstr "新增 :attr:`name` 與 :attr:`obj` 屬性。" #: ../../library/exceptions.rst:223 msgid "" "Raised when the :func:`input` function hits an end-of-file condition (EOF) " -"without reading any data. (Note: the :meth:`!io.IOBase.read` and :meth:`io." -"IOBase.readline` methods return an empty string when they hit EOF.)" +"without reading any data. (Note: the :meth:`!io.IOBase.read` " +"and :meth:`io.IOBase.readline` methods return an empty string when they hit " +"EOF.)" msgstr "" "當 :func:`input` 函式在沒有讀到任何資料而到達檔案結尾 (end-of-file, EOF) 條件" "的時候被引發。(注意::meth:`!io.IOBase.read` 和 :meth:`io.IOBase.readline` " @@ -357,14 +363,15 @@ msgstr "目前沒有被使用。" #: ../../library/exceptions.rst:235 msgid "" -"Raised when a :term:`generator` or :term:`coroutine` is closed; see :meth:" -"`generator.close` and :meth:`coroutine.close`. It directly inherits from :" -"exc:`BaseException` instead of :exc:`Exception` since it is technically not " -"an error." +"Raised when a :term:`generator` or :term:`coroutine` is closed; " +"see :meth:`generator.close` and :meth:`coroutine.close`. It directly " +"inherits from :exc:`BaseException` instead of :exc:`Exception` since it is " +"technically not an error." msgstr "" -"當 :term:`generator` 或 :term:`coroutine` 被關閉的時候被引發;參考 :meth:" -"`generator.close` 和 :meth:`coroutine.close`。此例外直接繼承自 :exc:" -"`BaseException` 而不是 :exc:`Exception`,因為技術上來說這不是一個錯誤。" +"當 :term:`generator` 或 :term:`coroutine` 被關閉的時候被引發;參" +"考 :meth:`generator.close` 和 :meth:`coroutine.close`。此例外直接繼承" +"自 :exc:`BaseException` 而不是 :exc:`Exception`,因為技術上來說這不是一個錯" +"誤。" #: ../../library/exceptions.rst:243 msgid "" @@ -396,8 +403,8 @@ msgstr "新增 :attr:`name` 與 :attr:`path` 屬性。" #: ../../library/exceptions.rst:263 msgid "" "A subclass of :exc:`ImportError` which is raised by :keyword:`import` when a " -"module could not be located. It is also raised when ``None`` is found in :" -"data:`sys.modules`." +"module could not be located. It is also raised when ``None`` is found " +"in :data:`sys.modules`." msgstr "" ":exc:`ImportError` 的子類別,當模組不能被定位的時候會被 :keyword:`import` 所" "引發。當在 :data:`sys.modules` 裡找到 ``None`` 時也會被引發。" @@ -419,16 +426,16 @@ msgstr "當對映(字典)的鍵無法在已存在的鍵的集合中被找到 #: ../../library/exceptions.rst:288 msgid "" -"Raised when the user hits the interrupt key (normally :kbd:`Control-C` or :" -"kbd:`Delete`). During execution, a check for interrupts is made regularly. " -"The exception inherits from :exc:`BaseException` so as to not be " +"Raised when the user hits the interrupt key (normally :kbd:`Control-C` " +"or :kbd:`Delete`). During execution, a check for interrupts is made " +"regularly. The exception inherits from :exc:`BaseException` so as to not be " "accidentally caught by code that catches :exc:`Exception` and thus prevent " "the interpreter from exiting." msgstr "" -"當使用者輸入中斷鍵 (interrupt key)(一般來說是 :kbd:`Control-C` 或 :kbd:" -"`Delete`)時會被引發。在執行過程中,會定期檢查是否產生中斷。此例外繼承自 :" -"exc:`BaseException` 以防止意外地被捕捉 :exc:`Exception` 的程式碼所捕捉,而因" -"此讓直譯器無法結束。" +"當使用者輸入中斷鍵 (interrupt key)(一般來說是 :kbd:`Control-C` " +"或 :kbd:`Delete`)時會被引發。在執行過程中,會定期檢查是否產生中斷。此例外繼" +"承自 :exc:`BaseException` 以防止意外地被捕捉 :exc:`Exception` 的程式碼所捕" +"捉,而因此讓直譯器無法結束。" #: ../../library/exceptions.rst:296 msgid "" @@ -439,19 +446,20 @@ msgid "" "avoid raising it entirely. (See :ref:`handlers-and-exceptions`.)" msgstr "" "捕捉 :exc:`KeyboardInterrupt` 需要特殊的考量。因為它可以在無法預期的時間點被" -"引發,可能在某些情況下讓正在跑的程式處在一個不一致的狀態。一般來說最好讓 :" -"exc:`KeyboardInterrupt` 越快結束程式越好,或者完全避免引發它。(參考 :ref:" -"`handlers-and-exceptions`。)" +"引發,可能在某些情況下讓正在跑的程式處在一個不一致的狀態。一般來說最好" +"讓 :exc:`KeyboardInterrupt` 越快結束程式越好,或者完全避免引發它。(參" +"考 :ref:`handlers-and-exceptions`。)" #: ../../library/exceptions.rst:306 msgid "" "Raised when an operation runs out of memory but the situation may still be " "rescued (by deleting some objects). The associated value is a string " "indicating what kind of (internal) operation ran out of memory. Note that " -"because of the underlying memory management architecture (C's :c:func:" -"`malloc` function), the interpreter may not always be able to completely " -"recover from this situation; it nevertheless raises an exception so that a " -"stack traceback can be printed, in case a run-away program was the cause." +"because of the underlying memory management architecture " +"(C's :c:func:`malloc` function), the interpreter may not always be able to " +"completely recover from this situation; it nevertheless raises an exception " +"so that a stack traceback can be printed, in case a run-away program was the " +"cause." msgstr "" "當一個操作用光了記憶體但情況還可能被修復 (rescued)(透過刪除一些物件)的時候" "被引發。關聯值是一個字串,表示什麼類型的(內部)操作用光了記憶體。需注意的是" @@ -503,8 +511,9 @@ msgstr "" #: ../../library/exceptions.rst:346 msgid "" ":exc:`!NotImplementedError` and :data:`!NotImplemented` are not " -"interchangeable. This exception should only be used as described above; see :" -"data:`NotImplemented` for details on correct usage of the built-in constant." +"interchangeable. This exception should only be used as described above; " +"see :data:`NotImplemented` for details on correct usage of the built-in " +"constant." msgstr "" ":exc:`!NotImplementedError` 和 :data:`!NotImplemented` 並不是可互換的。這個例" "外只能用在上面描述的情況;參考 :data:`NotImplemented` 裡關於內建常數正確使用" @@ -513,8 +522,8 @@ msgstr "" #: ../../library/exceptions.rst:357 msgid "" "This exception is raised when a system function returns a system-related " -"error, including I/O failures such as \"file not found\" or \"disk " -"full\" (not for illegal argument types or other incidental errors)." +"error, including I/O failures such as \"file not found\" or \"disk full\" " +"(not for illegal argument types or other incidental errors)." msgstr "" "當系統函式回傳系統相關錯誤,包含像\"找不到檔案\"或\"硬碟已滿\"的 I/O 失敗會引" "發此例外(而非不合法的引數或其他次要的錯誤)。" @@ -523,21 +532,22 @@ msgstr "" msgid "" "The second form of the constructor sets the corresponding attributes, " "described below. The attributes default to :const:`None` if not specified. " -"For backwards compatibility, if three arguments are passed, the :attr:" -"`~BaseException.args` attribute contains only a 2-tuple of the first two " -"constructor arguments." +"For backwards compatibility, if three arguments are passed, " +"the :attr:`~BaseException.args` attribute contains only a 2-tuple of the " +"first two constructor arguments." msgstr "" -"建構函式的第二種形式會設定以下描述的相對應屬性。如果沒有給定則屬性預設為 :" -"const:`None`。為了向後相容,如果傳入三個引數,:attr:`~BaseException.args` 屬" -"性只會是包含建構函式前兩個引數的雙元素元組。" +"建構函式的第二種形式會設定以下描述的相對應屬性。如果沒有給定則屬性預設" +"為 :const:`None`。為了向後相容,如果傳入三個引" +"數,:attr:`~BaseException.args` 屬性只會是包含建構函式前兩個引數的雙元素元" +"組。" #: ../../library/exceptions.rst:367 msgid "" "The constructor often actually returns a subclass of :exc:`OSError`, as " "described in `OS exceptions`_ below. The particular subclass depends on the " -"final :attr:`.errno` value. This behaviour only occurs when constructing :" -"exc:`OSError` directly or via an alias, and is not inherited when " -"subclassing." +"final :attr:`.errno` value. This behaviour only occurs when " +"constructing :exc:`OSError` directly or via an alias, and is not inherited " +"when subclassing." msgstr "" "如同下面的\\ `作業系統例外 `_\\ 所描述,實際上建構函式通常回" "傳 :exc:`OSError` 的子類別。會依據最後 :attr:`.errno` 的值決定特定子類別。這" @@ -550,19 +560,19 @@ msgstr "從 C 變數 :c:data:`errno` 而來的數值錯誤代碼。" #: ../../library/exceptions.rst:379 msgid "" -"Under Windows, this gives you the native Windows error code. The :attr:`." -"errno` attribute is then an approximate translation, in POSIX terms, of that " -"native error code." +"Under Windows, this gives you the native Windows error code. " +"The :attr:`.errno` attribute is then an approximate translation, in POSIX " +"terms, of that native error code." msgstr "" "在 Windows 下,這會提供你原生的 Windows 錯誤代碼。而 :attr:`.errno` 屬性是一" "個該原生錯誤代碼對於 POSIX 來說的近似翻譯。" #: ../../library/exceptions.rst:383 msgid "" -"Under Windows, if the *winerror* constructor argument is an integer, the :" -"attr:`.errno` attribute is determined from the Windows error code, and the " -"*errno* argument is ignored. On other platforms, the *winerror* argument is " -"ignored, and the :attr:`winerror` attribute does not exist." +"Under Windows, if the *winerror* constructor argument is an integer, " +"the :attr:`.errno` attribute is determined from the Windows error code, and " +"the *errno* argument is ignored. On other platforms, the *winerror* " +"argument is ignored, and the :attr:`winerror` attribute does not exist." msgstr "" "在 Windows 下,如果建構函式引數 *winerror* 是整數,則 :attr:`.errno` 屬性會根" "據該 Windows 錯誤代碼來決定,且 *errno* 引數會被忽略。在其他平台上," @@ -579,32 +589,32 @@ msgstr "" #: ../../library/exceptions.rst:399 msgid "" -"For exceptions that involve a file system path (such as :func:`open` or :" -"func:`os.unlink`), :attr:`filename` is the file name passed to the function. " -"For functions that involve two file system paths (such as :func:`os." -"rename`), :attr:`filename2` corresponds to the second file name passed to " -"the function." +"For exceptions that involve a file system path (such as :func:`open` " +"or :func:`os.unlink`), :attr:`filename` is the file name passed to the " +"function. For functions that involve two file system paths (such " +"as :func:`os.rename`), :attr:`filename2` corresponds to the second file name " +"passed to the function." msgstr "" -"對於包含檔案系統路徑的例外(像是 :func:`open` 或 :func:`os.unlink`),:attr:" -"`filename` 是傳入函式的檔案名稱。對於包含兩個檔案系統路徑的函式(像是 :func:" -"`os.rename`),:attr:`filename2` 對應到傳入函式的第二個檔案名稱。" +"對於包含檔案系統路徑的例外(像是 :func:`open` " +"或 :func:`os.unlink`),:attr:`filename` 是傳入函式的檔案名稱。對於包含兩個檔" +"案系統路徑的函式(像是 :func:`os.rename`),:attr:`filename2` 對應到傳入函式" +"的第二個檔案名稱。" #: ../../library/exceptions.rst:406 msgid "" -":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket." -"error`, :exc:`select.error` and :exc:`!mmap.error` have been merged into :" -"exc:`OSError`, and the constructor may return a subclass." +":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket.error`, :exc:`select.error` " +"and :exc:`!mmap.error` have been merged into :exc:`OSError`, and the " +"constructor may return a subclass." msgstr "" -":exc:`EnvironmentError`、:exc:`IOError`、:exc:`WindowsError`、:exc:`socket." -"error`、:exc:`select.error` 及 :exc:`!mmap.error` 已合併進 :exc:`OSError`,而" -"建構函式可能會回傳子類別。" +":exc:`EnvironmentError`、:exc:`IOError`、:exc:`WindowsError`、:exc:`socket.error`、:exc:`select.error` " +"及 :exc:`!mmap.error` 已合併進 :exc:`OSError`,而建構函式可能會回傳子類別。" #: ../../library/exceptions.rst:412 msgid "" "The :attr:`filename` attribute is now the original file name passed to the " -"function, instead of the name encoded to or decoded from the :term:" -"`filesystem encoding and error handler`. Also, the *filename2* constructor " -"argument and attribute was added." +"function, instead of the name encoded to or decoded from " +"the :term:`filesystem encoding and error handler`. Also, the *filename2* " +"constructor argument and attribute was added." msgstr "" ":attr:`filename` 屬性現在是傳入函式的原始檔名,而不是從\\ :term:`檔案系統編碼" "和錯誤處理函式 `\\ 編碼或解碼過的名" @@ -613,11 +623,11 @@ msgstr "" #: ../../library/exceptions.rst:421 msgid "" "Raised when the result of an arithmetic operation is too large to be " -"represented. This cannot occur for integers (which would rather raise :exc:" -"`MemoryError` than give up). However, for historical reasons, OverflowError " -"is sometimes raised for integers that are outside a required range. " -"Because of the lack of standardization of floating-point exception handling " -"in C, most floating-point operations are not checked." +"represented. This cannot occur for integers (which would rather " +"raise :exc:`MemoryError` than give up). However, for historical reasons, " +"OverflowError is sometimes raised for integers that are outside a required " +"range. Because of the lack of standardization of floating-point exception " +"handling in C, most floating-point operations are not checked." msgstr "" "當運算操作的結果太大而無法表示的時候會引發此例外。這不會發生在整數上(會改成" "引發 :exc:`MemoryError` 而不是放棄)。然而,因為一些歷史因素,OverflowError " @@ -630,14 +640,14 @@ msgid "" "operation is blocked during interpreter shutdown also known as :term:`Python " "finalization `." msgstr "" -"此例外衍生自 :exc:`RuntimeError`。當一個操作在直譯器關閉(也稱作 :term:" -"`Python 最終化 (Python finalization) `)期間被阻塞會引" -"發此例外。" +"此例外衍生自 :exc:`RuntimeError`。當一個操作在直譯器關閉(也稱" +"作 :term:`Python 最終化 (Python finalization) `)期間" +"被阻塞會引發此例外。" #: ../../library/exceptions.rst:435 msgid "" -"Examples of operations which can be blocked with a :exc:" -"`PythonFinalizationError` during the Python finalization:" +"Examples of operations which can be blocked with " +"a :exc:`PythonFinalizationError` during the Python finalization:" msgstr "" "在 Python 最終化期間,能夠以 :exc:`PythonFinalizationError` 被阻塞的操作範" "例:" @@ -647,38 +657,46 @@ msgid "Creating a new Python thread." msgstr "建立新的 Python 執行緒。" #: ../../library/exceptions.rst:439 +msgid ":meth:`Joining ` a running daemon thread." +msgstr "" + +#: ../../library/exceptions.rst:440 msgid ":func:`os.fork`." msgstr ":func:`os.fork`。" -#: ../../library/exceptions.rst:441 +#: ../../library/exceptions.rst:442 msgid "See also the :func:`sys.is_finalizing` function." msgstr "也可以參閱 :func:`sys.is_finalizing` 函式。" -#: ../../library/exceptions.rst:443 ../../library/exceptions.rst:453 +#: ../../library/exceptions.rst:444 ../../library/exceptions.rst:457 msgid "Previously, a plain :exc:`RuntimeError` was raised." msgstr "在之前,會引發一般的 :exc:`RuntimeError`。" #: ../../library/exceptions.rst:449 +msgid ":meth:`threading.Thread.join` can now raise this exception." +msgstr "" + +#: ../../library/exceptions.rst:453 msgid "" "This exception is derived from :exc:`RuntimeError`. It is raised when the " -"interpreter detects that the maximum recursion depth (see :func:`sys." -"getrecursionlimit`) is exceeded." +"interpreter detects that the maximum recursion depth " +"(see :func:`sys.getrecursionlimit`) is exceeded." msgstr "" -"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參考 :" -"func:`sys.getrecursionlimit`)時會引發此例外。" +"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參" +"考 :func:`sys.getrecursionlimit`)時會引發此例外。" -#: ../../library/exceptions.rst:459 +#: ../../library/exceptions.rst:463 msgid "" -"This exception is raised when a weak reference proxy, created by the :func:" -"`weakref.proxy` function, is used to access an attribute of the referent " -"after it has been garbage collected. For more information on weak " +"This exception is raised when a weak reference proxy, created by " +"the :func:`weakref.proxy` function, is used to access an attribute of the " +"referent after it has been garbage collected. For more information on weak " "references, see the :mod:`weakref` module." msgstr "" "當一個被 :func:`weakref.proxy` 函式建立的弱參照代理 (weak reference proxy) 被" "用來存取已經被垃圾回收 (garbage collected) 的參照物屬性時會引發此例外。更多關" "於弱參照的資訊參考 :mod:`weakref` 模組。" -#: ../../library/exceptions.rst:467 +#: ../../library/exceptions.rst:471 msgid "" "Raised when an error is detected that doesn't fall in any of the other " "categories. The associated value is a string indicating what precisely went " @@ -687,50 +705,51 @@ msgstr "" "當偵測到一個不屬於任何其他種類的錯誤時會引發此例外。關聯值是一個表示確切什麼" "地方出錯的字串。" -#: ../../library/exceptions.rst:474 +#: ../../library/exceptions.rst:478 msgid "" -"Raised by built-in function :func:`next` and an :term:`iterator`\\'s :meth:" -"`~iterator.__next__` method to signal that there are no further items " -"produced by the iterator." +"Raised by built-in function :func:`next` and " +"an :term:`iterator`\\'s :meth:`~iterator.__next__` method to signal that " +"there are no further items produced by the iterator." msgstr "" "會被內建函式 :func:`next` 及 :term:`iterator` 的 :meth:`~iterator.__next__` " "方法引發,用來表示疊代器沒有更多項目可以產生。" -#: ../../library/exceptions.rst:480 +#: ../../library/exceptions.rst:484 msgid "" "The exception object has a single attribute :attr:`!value`, which is given " -"as an argument when constructing the exception, and defaults to :const:" -"`None`." +"as an argument when constructing the exception, and defaults " +"to :const:`None`." msgstr "" -"此例外物件有單一屬性 :attr:`!value`,當建構此例外時會以引數給定,預設為 :" -"const:`None`。" +"此例外物件有單一屬性 :attr:`!value`,當建構此例外時會以引數給定,預設" +"為 :const:`None`。" -#: ../../library/exceptions.rst:484 +#: ../../library/exceptions.rst:488 msgid "" -"When a :term:`generator` or :term:`coroutine` function returns, a new :exc:" -"`StopIteration` instance is raised, and the value returned by the function " -"is used as the :attr:`value` parameter to the constructor of the exception." +"When a :term:`generator` or :term:`coroutine` function returns, a " +"new :exc:`StopIteration` instance is raised, and the value returned by the " +"function is used as the :attr:`value` parameter to the constructor of the " +"exception." msgstr "" -"當 :term:`generator` 或 :term:`coroutine` 函式回傳時,新的 :exc:" -"`StopIteration` 實例會被引發,而該函式的回傳值會被用來當作此例外建構函式的 :" -"attr:`value` 參數。" +"當 :term:`generator` 或 :term:`coroutine` 函式回傳時,新" +"的 :exc:`StopIteration` 實例會被引發,而該函式的回傳值會被用來當作此例外建構" +"函式的 :attr:`value` 參數。" -#: ../../library/exceptions.rst:489 +#: ../../library/exceptions.rst:493 msgid "" "If a generator code directly or indirectly raises :exc:`StopIteration`, it " "is converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration` " "as the new exception's cause)." msgstr "" -"如果產生器程式直接或間接引發 :exc:`StopIteration`,則其會被轉換成 :exc:" -"`RuntimeError`\\ (保留 :exc:`StopIteration` 作為新例外的成因)。" +"如果產生器程式直接或間接引發 :exc:`StopIteration`,則其會被轉換" +"成 :exc:`RuntimeError`\\ (保留 :exc:`StopIteration` 作為新例外的成因)。" -#: ../../library/exceptions.rst:493 +#: ../../library/exceptions.rst:497 msgid "" "Added ``value`` attribute and the ability for generator functions to use it " "to return a value." msgstr "新增 ``value`` 屬性且產生器函式可以用它來回傳值。" -#: ../../library/exceptions.rst:497 +#: ../../library/exceptions.rst:501 msgid "" "Introduced the RuntimeError transformation via ``from __future__ import " "generator_stop``, see :pep:`479`." @@ -738,7 +757,7 @@ msgstr "" "透過 ``from __future__ import generator_stop`` 引入 RuntimeError 的轉換,參" "考 :pep:`479`。" -#: ../../library/exceptions.rst:501 +#: ../../library/exceptions.rst:505 msgid "" "Enable :pep:`479` for all code by default: a :exc:`StopIteration` error " "raised in a generator is transformed into a :exc:`RuntimeError`." @@ -746,7 +765,7 @@ msgstr "" "預設對所有程式啟用 :pep:`479`:在產生器引發的 :exc:`StopIteration` 錯誤會轉換" "成 :exc:`RuntimeError`。" -#: ../../library/exceptions.rst:507 +#: ../../library/exceptions.rst:511 msgid "" "Must be raised by :meth:`~object.__anext__` method of an :term:`asynchronous " "iterator` object to stop the iteration." @@ -754,18 +773,18 @@ msgstr "" "此例外必須被 :term:`asynchronous iterator` 物件的 :meth:`~object.__anext__` " "方法引發來停止疊代。" -#: ../../library/exceptions.rst:514 +#: ../../library/exceptions.rst:518 msgid "" -"Raised when the parser encounters a syntax error. This may occur in an :" -"keyword:`import` statement, in a call to the built-in functions :func:" -"`compile`, :func:`exec`, or :func:`eval`, or when reading the initial script " -"or standard input (also interactively)." +"Raised when the parser encounters a syntax error. This may occur in " +"an :keyword:`import` statement, in a call to the built-in " +"functions :func:`compile`, :func:`exec`, or :func:`eval`, or when reading " +"the initial script or standard input (also interactively)." msgstr "" "當剖析器遇到語法錯誤時會引發此例外。這可能發生在 :keyword:`import` 陳述式、在" "呼叫內建函式 :func:`compile`、:func:`exec` 或 :func:`eval` 的時候,或者在讀取" "初始腳本或標準輸入(也包含互動式)的時候。" -#: ../../library/exceptions.rst:520 +#: ../../library/exceptions.rst:524 msgid "" "The :func:`str` of the exception instance returns only the error message. " "Details is a tuple whose members are also available as separate attributes." @@ -773,18 +792,18 @@ msgstr "" "例外實例的 :func:`str` 只回傳錯誤訊息。Details 是個元組,其成員也能夠以分開的" "屬性取得。" -#: ../../library/exceptions.rst:525 +#: ../../library/exceptions.rst:529 msgid "The name of the file the syntax error occurred in." msgstr "發生語法錯誤所在的檔案名稱。" -#: ../../library/exceptions.rst:529 +#: ../../library/exceptions.rst:533 msgid "" "Which line number in the file the error occurred in. This is 1-indexed: the " "first line in the file has a ``lineno`` of 1." msgstr "" "發生錯誤所在檔案的列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 1。" -#: ../../library/exceptions.rst:534 +#: ../../library/exceptions.rst:538 msgid "" "The column in the line where the error occurred. This is 1-indexed: the " "first character in the line has an ``offset`` of 1." @@ -792,11 +811,11 @@ msgstr "" "發生錯誤所在該列的欄號 (column)。這是以 1 開始的索引:該列第一個字元的 " "``offset`` 是 1。" -#: ../../library/exceptions.rst:539 +#: ../../library/exceptions.rst:543 msgid "The source code text involved in the error." msgstr "涉及該錯誤的原始程式碼文字。" -#: ../../library/exceptions.rst:543 +#: ../../library/exceptions.rst:547 msgid "" "Which line number in the file the error occurred ends in. This is 1-indexed: " "the first line in the file has a ``lineno`` of 1." @@ -804,7 +823,7 @@ msgstr "" "發生錯誤所在檔案的結束列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 " "1。" -#: ../../library/exceptions.rst:548 +#: ../../library/exceptions.rst:552 msgid "" "The column in the end line where the error occurred finishes. This is 1-" "indexed: the first character in the line has an ``offset`` of 1." @@ -812,7 +831,7 @@ msgstr "" "發生錯誤所在該結束列的欄號。這是以 1 開始的索引:該列第一個字元的 ``offset`` " "是 1。" -#: ../../library/exceptions.rst:551 +#: ../../library/exceptions.rst:555 msgid "" "For errors in f-string fields, the message is prefixed by \"f-string: \" and " "the offsets are offsets in a text constructed from the replacement " @@ -823,39 +842,39 @@ msgstr "" "(offset) 是從替代表達式建構的文字的偏移量。例如編譯 f'Bad {a b} field' 會得到" "這個 args 屬性:('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))。" -#: ../../library/exceptions.rst:556 +#: ../../library/exceptions.rst:560 msgid "Added the :attr:`end_lineno` and :attr:`end_offset` attributes." msgstr "新增 :attr:`end_lineno` 與 :attr:`end_offset` 屬性。" -#: ../../library/exceptions.rst:561 +#: ../../library/exceptions.rst:565 msgid "" "Base class for syntax errors related to incorrect indentation. This is a " "subclass of :exc:`SyntaxError`." msgstr "" "與不正確的縮排有關的語法錯誤的基礎類別。這是 :exc:`SyntaxError` 的子類別。" -#: ../../library/exceptions.rst:567 +#: ../../library/exceptions.rst:571 msgid "" "Raised when indentation contains an inconsistent use of tabs and spaces. " "This is a subclass of :exc:`IndentationError`." msgstr "" -"當縮排包含製表符號 (tab) 和空白的不一致用法時會引發此例外。這是 :exc:" -"`IndentationError` 的子類別。" +"當縮排包含製表符號 (tab) 和空白的不一致用法時會引發此例外。這" +"是 :exc:`IndentationError` 的子類別。" -#: ../../library/exceptions.rst:573 +#: ../../library/exceptions.rst:577 msgid "" "Raised when the interpreter finds an internal error, but the situation does " "not look so serious to cause it to abandon all hope. The associated value is " -"a string indicating what went wrong (in low-level terms). In :term:" -"`CPython`, this could be raised by incorrectly using Python's C API, such as " -"returning a ``NULL`` value without an exception set." +"a string indicating what went wrong (in low-level terms). " +"In :term:`CPython`, this could be raised by incorrectly using Python's C " +"API, such as returning a ``NULL`` value without an exception set." msgstr "" "當直譯器找到一個內部錯誤,但該情況看起來沒有嚴重到要讓它放棄所有的希望時會引" -"發此例外。關聯值是一個表示什麼地方出錯的字串(以低階的方式表達)。在 :term:" -"`CPython` 中,這可能是因為錯誤地使用 Python 的 C API,例如回傳一個 ``NULL`` " -"值而沒有設定例外。" +"發此例外。關聯值是一個表示什麼地方出錯的字串(以低階的方式表達)。" +"在 :term:`CPython` 中,這可能是因為錯誤地使用 Python 的 C API,例如回傳一個 " +"``NULL`` 值而沒有設定例外。" -#: ../../library/exceptions.rst:579 +#: ../../library/exceptions.rst:583 msgid "" "If you're confident that this exception wasn't your fault, or the fault of a " "package you're using, you should report this to the author or maintainer of " @@ -870,28 +889,28 @@ msgstr "" "互動式 Python 會話的開頭被印出)、確切的錯誤訊息(該例外的關聯值)及如果可能" "的話,觸發此錯誤的程式來源。" -#: ../../library/exceptions.rst:590 +#: ../../library/exceptions.rst:594 msgid "" "This exception is raised by the :func:`sys.exit` function. It inherits " "from :exc:`BaseException` instead of :exc:`Exception` so that it is not " "accidentally caught by code that catches :exc:`Exception`. This allows the " "exception to properly propagate up and cause the interpreter to exit. When " "it is not handled, the Python interpreter exits; no stack traceback is " -"printed. The constructor accepts the same optional argument passed to :func:" -"`sys.exit`. If the value is an integer, it specifies the system exit status " -"(passed to C's :c:func:`!exit` function); if it is ``None``, the exit status " -"is zero; if it has another type (such as a string), the object's value is " -"printed and the exit status is one." -msgstr "" -"此例外會被 :func:`sys.exit` 函式引發。它繼承自 :exc:`BaseException` 而不是 :" -"exc:`Exception` 因此不會被捕捉 :exc:`Exception` 的程式意外地捕捉。這允許例外" -"可以正確地向上傳遞並導致直譯器結束。當它未被處理時,Python 直譯器會結束;不會" -"印出堆疊回溯。建構函式接受跟傳入 :func:`sys.exit` 一樣的可選引數。如果該值是" -"整數,它會指定系統的結束狀態(傳入 C 的 :c:func:`!exit` 函式);如果它是 " +"printed. The constructor accepts the same optional argument passed " +"to :func:`sys.exit`. If the value is an integer, it specifies the system " +"exit status (passed to C's :c:func:`!exit` function); if it is ``None``, the " +"exit status is zero; if it has another type (such as a string), the object's " +"value is printed and the exit status is one." +msgstr "" +"此例外會被 :func:`sys.exit` 函式引發。它繼承自 :exc:`BaseException` 而不" +"是 :exc:`Exception` 因此不會被捕捉 :exc:`Exception` 的程式意外地捕捉。這允許" +"例外可以正確地向上傳遞並導致直譯器結束。當它未被處理時,Python 直譯器會結束;" +"不會印出堆疊回溯。建構函式接受跟傳入 :func:`sys.exit` 一樣的可選引數。如果該" +"值是整數,它會指定系統的結束狀態(傳入 C 的 :c:func:`!exit` 函式);如果它是 " "``None``,結束狀態會是 0;如果它是其他型別(例如字串),則物件的值會被印出而" "結束狀態是 1。" -#: ../../library/exceptions.rst:601 +#: ../../library/exceptions.rst:605 msgid "" "A call to :func:`sys.exit` is translated into an exception so that clean-up " "handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be " @@ -902,16 +921,16 @@ msgid "" msgstr "" "對 :func:`sys.exit` 的呼叫會轉譯成例外讓負責清理的處理函式(:keyword:`try` 陳" "述式的 :keyword:`finally` 子句)可以被執行,且讓除錯器可以在不冒著失去控制的" -"風險下執行腳本。如果在絕對有必要立即結束的情況(例如在子行程呼叫完 :func:`os." -"fork` 之後 )可以使用 :func:`os._exit` 函式。" +"風險下執行腳本。如果在絕對有必要立即結束的情況(例如在子行程呼叫" +"完 :func:`os.fork` 之後 )可以使用 :func:`os._exit` 函式。" -#: ../../library/exceptions.rst:610 +#: ../../library/exceptions.rst:614 msgid "" "The exit status or error message that is passed to the constructor. " "(Defaults to ``None``.)" msgstr "傳入建構函式的結束狀態或錯誤訊息。(預設是 ``None``。 )" -#: ../../library/exceptions.rst:616 +#: ../../library/exceptions.rst:620 msgid "" "Raised when an operation or function is applied to an object of " "inappropriate type. The associated value is a string giving details about " @@ -920,7 +939,7 @@ msgstr "" "當一個操作或函式被用在不適合的型別的物件時會引發此例外。關聯值是一個字串,提" "供關於不相符型別的細節。" -#: ../../library/exceptions.rst:619 +#: ../../library/exceptions.rst:623 msgid "" "This exception may be raised by user code to indicate that an attempted " "operation on an object is not supported, and is not meant to be. If an " @@ -931,27 +950,27 @@ msgstr "" "這樣做。如果一個物件有意要支援某個給定的操作但尚未提供實作,該引發的正確例外" "是 :exc:`NotImplementedError`。" -#: ../../library/exceptions.rst:624 +#: ../../library/exceptions.rst:628 msgid "" -"Passing arguments of the wrong type (e.g. passing a :class:`list` when an :" -"class:`int` is expected) should result in a :exc:`TypeError`, but passing " -"arguments with the wrong value (e.g. a number outside expected boundaries) " -"should result in a :exc:`ValueError`." +"Passing arguments of the wrong type (e.g. passing a :class:`list` when " +"an :class:`int` is expected) should result in a :exc:`TypeError`, but " +"passing arguments with the wrong value (e.g. a number outside expected " +"boundaries) should result in a :exc:`ValueError`." msgstr "" "傳入錯誤型別的引數(例如當預期傳入 :class:`int` 卻傳入 :class:`list`)應該要" "導致 :exc:`TypeError`,但傳入帶有錯誤值的引數(例如超出預期範圍的數值)應該要" "導致 :exc:`ValueError`。" -#: ../../library/exceptions.rst:631 +#: ../../library/exceptions.rst:635 msgid "" "Raised when a reference is made to a local variable in a function or method, " -"but no value has been bound to that variable. This is a subclass of :exc:" -"`NameError`." +"but no value has been bound to that variable. This is a subclass " +"of :exc:`NameError`." msgstr "" "當在函式或方法裡引用某個區域變數,但該變數尚未被繫結到任何值的時候會引發此例" "外。這是 :exc:`NameError` 的子類別。" -#: ../../library/exceptions.rst:638 +#: ../../library/exceptions.rst:642 msgid "" "Raised when a Unicode-related encoding or decoding error occurs. It is a " "subclass of :exc:`ValueError`." @@ -959,36 +978,42 @@ msgstr "" "當 Unicode 相關的編碼或解碼錯誤發生時會引發此例外。這是 :exc:`ValueError` 的" "子類別。" -#: ../../library/exceptions.rst:641 +#: ../../library/exceptions.rst:645 msgid "" ":exc:`UnicodeError` has attributes that describe the encoding or decoding " "error. For example, ``err.object[err.start:err.end]`` gives the particular " "invalid input that the codec failed on." msgstr "" -":exc:`UnicodeError` 有屬性描述編碼或解碼錯誤。例如 ``err.object[err.start:" -"err.end]`` 會提供讓編解碼器失敗的具體無效輸入。" +":exc:`UnicodeError` 有屬性描述編碼或解碼錯誤。例如 " +"``err.object[err.start:err.end]`` 會提供讓編解碼器失敗的具體無效輸入。" -#: ../../library/exceptions.rst:647 +#: ../../library/exceptions.rst:651 msgid "The name of the encoding that raised the error." msgstr "引發錯誤的編碼名稱。" -#: ../../library/exceptions.rst:651 +#: ../../library/exceptions.rst:655 msgid "A string describing the specific codec error." msgstr "描述特定編解碼器錯誤的字串。" -#: ../../library/exceptions.rst:655 +#: ../../library/exceptions.rst:659 msgid "The object the codec was attempting to encode or decode." msgstr "編解碼器嘗試編碼或解碼的物件。" -#: ../../library/exceptions.rst:659 +#: ../../library/exceptions.rst:663 msgid "The first index of invalid data in :attr:`object`." msgstr "在 :attr:`object` 中無效資料的開始索引。" -#: ../../library/exceptions.rst:663 +#: ../../library/exceptions.rst:665 ../../library/exceptions.rst:672 +msgid "" +"This value should not be negative as it is interpreted as an absolute offset " +"but this constraint is not enforced at runtime." +msgstr "" + +#: ../../library/exceptions.rst:670 msgid "The index after the last invalid data in :attr:`object`." msgstr "在 :attr:`object` 中最後的無效資料後的索引。" -#: ../../library/exceptions.rst:668 +#: ../../library/exceptions.rst:678 msgid "" "Raised when a Unicode-related error occurs during encoding. It is a " "subclass of :exc:`UnicodeError`." @@ -996,7 +1021,7 @@ msgstr "" "在編碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:674 +#: ../../library/exceptions.rst:684 msgid "" "Raised when a Unicode-related error occurs during decoding. It is a " "subclass of :exc:`UnicodeError`." @@ -1004,7 +1029,7 @@ msgstr "" "在解碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:680 +#: ../../library/exceptions.rst:690 msgid "" "Raised when a Unicode-related error occurs during translating. It is a " "subclass of :exc:`UnicodeError`." @@ -1012,7 +1037,7 @@ msgstr "" "在轉譯當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:686 +#: ../../library/exceptions.rst:696 msgid "" "Raised when an operation or function receives an argument that has the right " "type but an inappropriate value, and the situation is not described by a " @@ -1021,7 +1046,7 @@ msgstr "" "當一個操作或函式收到引數是正確型別但是不適合的值,且該情況無法被更精確的例外" "例如 :exc:`IndexError` 所描述時會引發此例外。" -#: ../../library/exceptions.rst:693 +#: ../../library/exceptions.rst:703 msgid "" "Raised when the second argument of a division or modulo operation is zero. " "The associated value is a string indicating the type of the operands and the " @@ -1030,47 +1055,47 @@ msgstr "" "當除法或模數運算 (modulo operation) 的第二個引數是 0 的時候會引發此例外。關聯" "值是一個字串,表示運算元及運算的類型。" -#: ../../library/exceptions.rst:698 +#: ../../library/exceptions.rst:708 msgid "" "The following exceptions are kept for compatibility with previous versions; " "starting from Python 3.3, they are aliases of :exc:`OSError`." msgstr "" -"以下例外是為了相容於之前版本而保留;從 Python 3.3 開始,它們是 :exc:" -"`OSError` 的別名。" +"以下例外是為了相容於之前版本而保留;從 Python 3.3 開始,它們" +"是 :exc:`OSError` 的別名。" -#: ../../library/exceptions.rst:707 +#: ../../library/exceptions.rst:717 msgid "Only available on Windows." msgstr "僅限於在 Windows 中使用。" -#: ../../library/exceptions.rst:711 +#: ../../library/exceptions.rst:721 msgid "OS exceptions" msgstr "作業系統例外" -#: ../../library/exceptions.rst:713 +#: ../../library/exceptions.rst:723 msgid "" "The following exceptions are subclasses of :exc:`OSError`, they get raised " "depending on the system error code." msgstr "以下的例外是 :exc:`OSError` 的子類別,它們根據系統錯誤代碼來引發。" -#: ../../library/exceptions.rst:718 +#: ../../library/exceptions.rst:728 msgid "" "Raised when an operation would block on an object (e.g. socket) set for non-" -"blocking operation. Corresponds to :c:data:`errno` :py:const:`~errno." -"EAGAIN`, :py:const:`~errno.EALREADY`, :py:const:`~errno.EWOULDBLOCK` and :py:" -"const:`~errno.EINPROGRESS`." +"blocking operation. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EAGAIN`, :py:const:`~errno.EALREADY`, :py:const:`~errno.EWOULDBLOCK` " +"and :py:const:`~errno.EINPROGRESS`." msgstr "" "當設置為非阻塞操作的物件(例如 socket)上的操作將要阻塞時會引發此例外。對應" -"到 :c:data:`errno` :py:const:`~errno.EAGAIN`、:py:const:`~errno.EALREADY`、:" -"py:const:`~errno.EWOULDBLOCK` 及 :py:const:`~errno.EINPROGRESS`。" +"到 :c:data:`errno` :py:const:`~errno.EAGAIN`、:py:const:`~errno.EALREADY`、:py:const:`~errno.EWOULDBLOCK` " +"及 :py:const:`~errno.EINPROGRESS`。" -#: ../../library/exceptions.rst:723 +#: ../../library/exceptions.rst:733 msgid "" "In addition to those of :exc:`OSError`, :exc:`BlockingIOError` can have one " "more attribute:" msgstr "" "除了 :exc:`OSError` 的那些屬性之外,:exc:`BlockingIOError` 有多一個屬性:" -#: ../../library/exceptions.rst:728 +#: ../../library/exceptions.rst:738 msgid "" "An integer containing the number of characters written to the stream before " "it blocked. This attribute is available when using the buffered I/O classes " @@ -1079,56 +1104,58 @@ msgstr "" "一個整數,內容為在其阻塞之前,已寫進串流的字元數。當使用 :mod:`io` 模組裡的緩" "衝 I/O 類別時這個屬性是可用的。" -#: ../../library/exceptions.rst:734 +#: ../../library/exceptions.rst:744 msgid "" -"Raised when an operation on a child process failed. Corresponds to :c:data:" -"`errno` :py:const:`~errno.ECHILD`." +"Raised when an operation on a child process failed. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECHILD`." msgstr "" -"當子行程上的操作失敗時會引發此例外。對應到 :c:data:`errno` :py:const:`~errno." -"ECHILD`。" +"當子行程上的操作失敗時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.ECHILD`。" -#: ../../library/exceptions.rst:739 +#: ../../library/exceptions.rst:749 msgid "A base class for connection-related issues." msgstr "連線相關問題的基礎類別。" -#: ../../library/exceptions.rst:741 +#: ../../library/exceptions.rst:751 msgid "" -"Subclasses are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:" -"`ConnectionRefusedError` and :exc:`ConnectionResetError`." +"Subclasses " +"are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:`ConnectionRefusedError` " +"and :exc:`ConnectionResetError`." msgstr "" -"子類別有 :exc:`BrokenPipeError`、:exc:`ConnectionAbortedError`、:exc:" -"`ConnectionRefusedError` 及 :exc:`ConnectionResetError`。" +"子類別" +"有 :exc:`BrokenPipeError`、:exc:`ConnectionAbortedError`、:exc:`ConnectionRefusedError` " +"及 :exc:`ConnectionResetError`。" -#: ../../library/exceptions.rst:746 +#: ../../library/exceptions.rst:756 msgid "" "A subclass of :exc:`ConnectionError`, raised when trying to write on a pipe " "while the other end has been closed, or trying to write on a socket which " -"has been shutdown for writing. Corresponds to :c:data:`errno` :py:const:" -"`~errno.EPIPE` and :py:const:`~errno.ESHUTDOWN`." +"has been shutdown for writing. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EPIPE` and :py:const:`~errno.ESHUTDOWN`." msgstr "" ":exc:`ConnectionError` 的子類別,當嘗試寫入管道 (pipe) 同時另一端已經被關閉時" -"會引發此例外,或者當嘗試寫入已關閉寫入的 socket 時也會引發。對應到 :c:data:" -"`errno` :py:const:`~errno.EPIPE` 及 :py:const:`~errno.ESHUTDOWN`。" +"會引發此例外,或者當嘗試寫入已關閉寫入的 socket 時也會引發。對應" +"到 :c:data:`errno` :py:const:`~errno.EPIPE` 及 :py:const:`~errno.ESHUTDOWN`。" -#: ../../library/exceptions.rst:753 +#: ../../library/exceptions.rst:763 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " -"aborted by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." -"ECONNABORTED`." +"aborted by the peer. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECONNABORTED`." msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點 (peer) 中斷時會引" "發此例外。對應到 :c:data:`errno` :py:const:`~errno.ECONNABORTED`。" -#: ../../library/exceptions.rst:759 +#: ../../library/exceptions.rst:769 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " -"refused by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." -"ECONNREFUSED`." +"refused by the peer. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECONNREFUSED`." msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點拒絕時會引發此例" "外。對應到 :c:data:`errno` :py:const:`~errno.ECONNREFUSED`。" -#: ../../library/exceptions.rst:765 +#: ../../library/exceptions.rst:775 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection is reset by " "the peer. Corresponds to :c:data:`errno` :py:const:`~errno.ECONNRESET`." @@ -1136,146 +1163,146 @@ msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線被對等端點重置時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.ECONNRESET`。" -#: ../../library/exceptions.rst:771 +#: ../../library/exceptions.rst:781 msgid "" "Raised when trying to create a file or directory which already exists. " "Corresponds to :c:data:`errno` :py:const:`~errno.EEXIST`." msgstr "" -"當嘗試建立已存在的檔案或目錄時會引發此例外。對應到 :c:data:`errno` :py:const:" -"`~errno.EEXIST`。" +"當嘗試建立已存在的檔案或目錄時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.EEXIST`。" -#: ../../library/exceptions.rst:776 +#: ../../library/exceptions.rst:786 msgid "" "Raised when a file or directory is requested but doesn't exist. Corresponds " "to :c:data:`errno` :py:const:`~errno.ENOENT`." msgstr "" -"當請求不存在的檔案或目錄時會引發此例外。對應到 :c:data:`errno` :py:const:" -"`~errno.ENOENT`。" +"當請求不存在的檔案或目錄時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.ENOENT`。" -#: ../../library/exceptions.rst:781 +#: ../../library/exceptions.rst:791 msgid "" "Raised when a system call is interrupted by an incoming signal. Corresponds " "to :c:data:`errno` :py:const:`~errno.EINTR`." msgstr "" -"當系統呼叫被傳入的信號中斷時會引發此例外。對應到 :c:data:`errno` :py:const:" -"`~errno.EINTR`。" +"當系統呼叫被傳入的信號中斷時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.EINTR`。" -#: ../../library/exceptions.rst:784 +#: ../../library/exceptions.rst:794 msgid "" "Python now retries system calls when a syscall is interrupted by a signal, " "except if the signal handler raises an exception (see :pep:`475` for the " "rationale), instead of raising :exc:`InterruptedError`." msgstr "" -"現在當 syscall 被信號中斷時 Python 會重試系統呼叫而不會引發 :exc:" -"`InterruptedError`,除非信號處理器引發例外(理由可參考 :pep:`475`)。" +"現在當 syscall 被信號中斷時 Python 會重試系統呼叫而不會引" +"發 :exc:`InterruptedError`,除非信號處理器引發例外(理由可參考 :pep:`475`)。" -#: ../../library/exceptions.rst:791 +#: ../../library/exceptions.rst:801 msgid "" "Raised when a file operation (such as :func:`os.remove`) is requested on a " "directory. Corresponds to :c:data:`errno` :py:const:`~errno.EISDIR`." msgstr "" -"當在目錄上請求檔案操作(例如 :func:`os.remove`)時會引發此例外。對應到 :c:" -"data:`errno` :py:const:`~errno.EISDIR`。" +"當在目錄上請求檔案操作(例如 :func:`os.remove`)時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.EISDIR`。" -#: ../../library/exceptions.rst:797 +#: ../../library/exceptions.rst:807 msgid "" "Raised when a directory operation (such as :func:`os.listdir`) is requested " "on something which is not a directory. On most POSIX platforms, it may also " "be raised if an operation attempts to open or traverse a non-directory file " -"as if it were a directory. Corresponds to :c:data:`errno` :py:const:`~errno." -"ENOTDIR`." +"as if it were a directory. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ENOTDIR`." msgstr "" "當在某個不是目錄的東西上請求目錄操作(例如 :func:`os.listdir`)時會引發此例" "外。在大多數的 POSIX 平台上,如果嘗試操作開啟或遍歷一個當作目錄的非目錄檔案也" "會引發此例外。對應到 :c:data:`errno` :py:const:`~errno.ENOTDIR`。" -#: ../../library/exceptions.rst:805 +#: ../../library/exceptions.rst:815 msgid "" "Raised when trying to run an operation without the adequate access rights - " -"for example filesystem permissions. Corresponds to :c:data:`errno` :py:const:" -"`~errno.EACCES`, :py:const:`~errno.EPERM`, and :py:const:`~errno." -"ENOTCAPABLE`." +"for example filesystem permissions. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EACCES`, :py:const:`~errno.EPERM`, " +"and :py:const:`~errno.ENOTCAPABLE`." msgstr "" "當嘗試執行一個沒有合乎存取權限的操作時會引發此例外 — 例如檔案系統權限。對應" -"到 :c:data:`errno` :py:const:`~errno.EACCES`、:py:const:`~errno.EPERM` 及 :" -"py:const:`~errno.ENOTCAPABLE`。" +"到 :c:data:`errno` :py:const:`~errno.EACCES`、:py:const:`~errno.EPERM` " +"及 :py:const:`~errno.ENOTCAPABLE`。" -#: ../../library/exceptions.rst:810 +#: ../../library/exceptions.rst:820 msgid "" -"WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped to :exc:" -"`PermissionError`." +"WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped " +"to :exc:`PermissionError`." msgstr "" "WASI 的 :py:const:`~errno.ENOTCAPABLE` 現在對應到 :exc:`PermissionError`。" -#: ../../library/exceptions.rst:816 +#: ../../library/exceptions.rst:826 msgid "" -"Raised when a given process doesn't exist. Corresponds to :c:data:`errno` :" -"py:const:`~errno.ESRCH`." +"Raised when a given process doesn't exist. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ESRCH`." msgstr "" -"當給定的行程不存在時會引發此例外。對應到 :c:data:`errno` :py:const:`~errno." -"ESRCH`。" +"當給定的行程不存在時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.ESRCH`。" -#: ../../library/exceptions.rst:821 +#: ../../library/exceptions.rst:831 msgid "" -"Raised when a system function timed out at the system level. Corresponds to :" -"c:data:`errno` :py:const:`~errno.ETIMEDOUT`." +"Raised when a system function timed out at the system level. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ETIMEDOUT`." msgstr "" -"當系統函式在系統層級超時會引發此例外。對應到 :c:data:`errno` :py:const:" -"`~errno.ETIMEDOUT`。" +"當系統函式在系統層級超時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.ETIMEDOUT`。" -#: ../../library/exceptions.rst:824 +#: ../../library/exceptions.rst:834 msgid "All the above :exc:`OSError` subclasses were added." msgstr "加入以上所有的 :exc:`OSError` 子類別。" -#: ../../library/exceptions.rst:830 +#: ../../library/exceptions.rst:840 msgid ":pep:`3151` - Reworking the OS and IO exception hierarchy" msgstr ":pep:`3151` — 改寫作業系統與 IO 例外階層" -#: ../../library/exceptions.rst:836 +#: ../../library/exceptions.rst:846 msgid "Warnings" msgstr "警告" -#: ../../library/exceptions.rst:838 +#: ../../library/exceptions.rst:848 msgid "" -"The following exceptions are used as warning categories; see the :ref:" -"`warning-categories` documentation for more details." +"The following exceptions are used as warning categories; see " +"the :ref:`warning-categories` documentation for more details." msgstr "" "以下的例外是當作警告的種類使用;更多細節參考 :ref:`warning-categories` 文件。" -#: ../../library/exceptions.rst:843 +#: ../../library/exceptions.rst:853 msgid "Base class for warning categories." msgstr "警告種類的基礎類別。" -#: ../../library/exceptions.rst:848 +#: ../../library/exceptions.rst:858 msgid "Base class for warnings generated by user code." msgstr "使用者程式碼產生的警告的基礎類別。" -#: ../../library/exceptions.rst:853 +#: ../../library/exceptions.rst:863 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for other Python developers." msgstr "關於已棄用功能的警告的基礎類別,且當那些警告是針對其他 Python 開發者。" -#: ../../library/exceptions.rst:856 +#: ../../library/exceptions.rst:866 msgid "" -"Ignored by the default warning filters, except in the ``__main__`` module (:" -"pep:`565`). Enabling the :ref:`Python Development Mode ` shows this " -"warning." +"Ignored by the default warning filters, except in the ``__main__`` module " +"(:pep:`565`). Enabling the :ref:`Python Development Mode ` shows " +"this warning." msgstr "" -"會被預設的警告過濾器忽略,在 ``__main__`` 模組裡除外 (:pep:`565`)。啟用 :ref:" -"`Python 開發模式 `\\ 會顯示此警告。" +"會被預設的警告過濾器忽略,在 ``__main__`` 模組裡除外 (:pep:`565`)。啟" +"用 :ref:`Python 開發模式 `\\ 會顯示此警告。" -#: ../../library/exceptions.rst:860 ../../library/exceptions.rst:876 +#: ../../library/exceptions.rst:870 ../../library/exceptions.rst:886 msgid "The deprecation policy is described in :pep:`387`." msgstr "棄用原則描述在 :pep:`387` 裡。" -#: ../../library/exceptions.rst:865 +#: ../../library/exceptions.rst:875 msgid "" "Base class for warnings about features which are obsolete and expected to be " "deprecated in the future, but are not deprecated at the moment." msgstr "關於過時且預期未來要被棄用,但目前尚未被棄用的功能的警告的基礎類別。" -#: ../../library/exceptions.rst:869 +#: ../../library/exceptions.rst:879 msgid "" "This class is rarely used as emitting a warning about a possible upcoming " "deprecation is unusual, and :exc:`DeprecationWarning` is preferred for " @@ -1284,8 +1311,8 @@ msgstr "" "因為發出關於可能即將被棄用的警告是不尋常的,此類別很少被使用,而對已經被棄用" "的情況會優先使用 :exc:`DeprecationWarning`。" -#: ../../library/exceptions.rst:873 ../../library/exceptions.rst:902 -#: ../../library/exceptions.rst:929 +#: ../../library/exceptions.rst:883 ../../library/exceptions.rst:912 +#: ../../library/exceptions.rst:939 msgid "" "Ignored by the default warning filters. Enabling the :ref:`Python " "Development Mode ` shows this warning." @@ -1293,21 +1320,21 @@ msgstr "" "會被預設的警告過濾器忽略。啟用 :ref:`Python 開發模式 `\\ 會顯示此警" "告。" -#: ../../library/exceptions.rst:881 +#: ../../library/exceptions.rst:891 msgid "Base class for warnings about dubious syntax." msgstr "關於可疑語法的警告的基礎類別。" -#: ../../library/exceptions.rst:883 +#: ../../library/exceptions.rst:893 msgid "" "This warning is typically emitted when compiling Python source code, and " "usually won't be reported when running already compiled code." msgstr "" -#: ../../library/exceptions.rst:889 +#: ../../library/exceptions.rst:899 msgid "Base class for warnings about dubious runtime behavior." msgstr "關於可疑執行環境行為的警告的基礎類別。" -#: ../../library/exceptions.rst:894 +#: ../../library/exceptions.rst:904 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for end users of applications that are written in Python." @@ -1315,36 +1342,36 @@ msgstr "" "關於已棄用功能的警告的基礎類別,且當那些警告是針對以 Python 寫的應用程式的終" "端使用者。" -#: ../../library/exceptions.rst:900 +#: ../../library/exceptions.rst:910 msgid "Base class for warnings about probable mistakes in module imports." msgstr "關於在模組引入的可能錯誤的警告的基礎類別。" -#: ../../library/exceptions.rst:908 +#: ../../library/exceptions.rst:918 msgid "Base class for warnings related to Unicode." msgstr "Unicode 相關警告的基礎類別。" -#: ../../library/exceptions.rst:913 +#: ../../library/exceptions.rst:923 msgid "Base class for warnings related to encodings." msgstr "編碼相關警告的基礎類別。" -#: ../../library/exceptions.rst:915 +#: ../../library/exceptions.rst:925 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節參考\\ :ref:`io-encoding-warning`。" -#: ../../library/exceptions.rst:922 +#: ../../library/exceptions.rst:932 msgid "" "Base class for warnings related to :class:`bytes` and :class:`bytearray`." msgstr ":class:`bytes` 及 :class:`bytearray` 相關警告的基礎類別。" -#: ../../library/exceptions.rst:927 +#: ../../library/exceptions.rst:937 msgid "Base class for warnings related to resource usage." msgstr "資源用法相關警告的基礎類別。" -#: ../../library/exceptions.rst:938 +#: ../../library/exceptions.rst:948 msgid "Exception groups" msgstr "例外群組" -#: ../../library/exceptions.rst:940 +#: ../../library/exceptions.rst:950 msgid "" "The following are used when it is necessary to raise multiple unrelated " "exceptions. They are part of the exception hierarchy so they can be handled " @@ -1356,46 +1383,48 @@ msgstr "" "所有其他例外一樣使用 :keyword:`except` 來處理。此外,它們會以包含的例外型別為" "基礎來比對其子群組而被 :keyword:`except*` 辨認出來。" -#: ../../library/exceptions.rst:949 +#: ../../library/exceptions.rst:959 msgid "" "Both of these exception types wrap the exceptions in the sequence ``excs``. " "The ``msg`` parameter must be a string. The difference between the two " "classes is that :exc:`BaseExceptionGroup` extends :exc:`BaseException` and " -"it can wrap any exception, while :exc:`ExceptionGroup` extends :exc:" -"`Exception` and it can only wrap subclasses of :exc:`Exception`. This design " -"is so that ``except Exception`` catches an :exc:`ExceptionGroup` but not :" -"exc:`BaseExceptionGroup`." +"it can wrap any exception, while :exc:`ExceptionGroup` " +"extends :exc:`Exception` and it can only wrap subclasses " +"of :exc:`Exception`. This design is so that ``except Exception`` catches " +"an :exc:`ExceptionGroup` but not :exc:`BaseExceptionGroup`." msgstr "" "這兩個例外型別都將例外包裝在序列 ``excs`` 中。``msg`` 參數必須是字串。這兩個" "類別的差異是 :exc:`BaseExceptionGroup` 擴充了 :exc:`BaseException` 且可以包裝" -"任何例外,而 :exc:`ExceptionGroup` 擴充了 :exc:`Exception` 且只能包裝 :exc:" -"`Exception` 的子類別。這個設計使得 ``except Exception`` 可以捕捉 :exc:" -"`ExceptionGroup` 但不能捕捉 :exc:`BaseExceptionGroup`。" +"任何例外,而 :exc:`ExceptionGroup` 擴充了 :exc:`Exception` 且只能包" +"裝 :exc:`Exception` 的子類別。這個設計使得 ``except Exception`` 可以捕" +"捉 :exc:`ExceptionGroup` 但不能捕捉 :exc:`BaseExceptionGroup`。" -#: ../../library/exceptions.rst:957 +#: ../../library/exceptions.rst:967 msgid "" "The :exc:`BaseExceptionGroup` constructor returns an :exc:`ExceptionGroup` " -"rather than a :exc:`BaseExceptionGroup` if all contained exceptions are :exc:" -"`Exception` instances, so it can be used to make the selection automatic. " -"The :exc:`ExceptionGroup` constructor, on the other hand, raises a :exc:" -"`TypeError` if any contained exception is not an :exc:`Exception` subclass." +"rather than a :exc:`BaseExceptionGroup` if all contained exceptions " +"are :exc:`Exception` instances, so it can be used to make the selection " +"automatic. The :exc:`ExceptionGroup` constructor, on the other hand, raises " +"a :exc:`TypeError` if any contained exception is not an :exc:`Exception` " +"subclass." msgstr "" "如果所有包含的例外都是 :exc:`Exception` 實例,:exc:`BaseExceptionGroup` 建構" "函式會回傳 :exc:`ExceptionGroup` 而不是 :exc:`BaseExceptionGroup`,因此可以被" -"使用來讓這樣的選擇自動化。另一方面來說,如果任何包含的例外不是 :exc:" -"`Exception` 的子類別,:exc:`ExceptionGroup` 建構函式會引發 :exc:`TypeError`。" +"使用來讓這樣的選擇自動化。另一方面來說,如果任何包含的例外不" +"是 :exc:`Exception` 的子類別,:exc:`ExceptionGroup` 建構函式會引" +"發 :exc:`TypeError`。" -#: ../../library/exceptions.rst:966 +#: ../../library/exceptions.rst:976 msgid "The ``msg`` argument to the constructor. This is a read-only attribute." msgstr "建構函式的 ``msg`` 引數。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:970 +#: ../../library/exceptions.rst:980 msgid "" "A tuple of the exceptions in the ``excs`` sequence given to the constructor. " "This is a read-only attribute." msgstr "指定給建構函式 ``excs`` 序列中的例外組成的元組。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:975 +#: ../../library/exceptions.rst:985 msgid "" "Returns an exception group that contains only the exceptions from the " "current group that match *condition*, or ``None`` if the result is empty." @@ -1403,7 +1432,7 @@ msgstr "" "回傳只包含從現有群組比對到 *condition* 的例外的例外群組,或者當結果為空時回" "傳 ``None``。" -#: ../../library/exceptions.rst:978 +#: ../../library/exceptions.rst:988 msgid "" "The condition can be an exception type or tuple of exception types, in which " "case each exception is checked for a match using the same check that is used " @@ -1416,20 +1445,20 @@ msgstr "" "物件(除了型別物件之外),其接受一個例外作為單一引數,而如果該例外應該在子群" "組中就回傳 true。" -#: ../../library/exceptions.rst:984 +#: ../../library/exceptions.rst:994 msgid "" "The nesting structure of the current exception is preserved in the result, " -"as are the values of its :attr:`message`, :attr:`~BaseException." -"__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." -"__context__` and :attr:`~BaseException.__notes__` fields. Empty nested " -"groups are omitted from the result." +"as are the values of " +"its :attr:`message`, :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` " +"and :attr:`~BaseException.__notes__` fields. Empty nested groups are omitted " +"from the result." msgstr "" -"現有例外的巢狀結構會保留在結果裡,其 :attr:`message`、:attr:`~BaseException." -"__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException." -"__context__` 及 :attr:`~BaseException.__notes__` 欄位的值也一樣。空的巢狀群組" -"會從結果裡排除。" +"現有例外的巢狀結構會保留在結果裡," +"其 :attr:`message`、:attr:`~BaseException.__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException.__context__` " +"及 :attr:`~BaseException.__notes__` 欄位的值也一樣。空的巢狀群組會從結果裡排" +"除。" -#: ../../library/exceptions.rst:991 +#: ../../library/exceptions.rst:1001 msgid "" "The condition is checked for all exceptions in the nested exception group, " "including the top-level and any nested exception groups. If the condition is " @@ -1438,11 +1467,11 @@ msgstr "" "條件會對巢狀例外群組裡的所有例外做檢查,包括頂層及任何巢狀的例外群組。如果條" "件對這樣的例外群組為 true,它會被完整包含在結果裡。" -#: ../../library/exceptions.rst:995 +#: ../../library/exceptions.rst:1005 msgid "``condition`` can be any callable which is not a type object." msgstr "``condition`` 可以是任何不是型別物件的可呼叫物件。" -#: ../../library/exceptions.rst:1000 +#: ../../library/exceptions.rst:1010 msgid "" "Like :meth:`subgroup`, but returns the pair ``(match, rest)`` where " "``match`` is ``subgroup(condition)`` and ``rest`` is the remaining non-" @@ -1451,13 +1480,13 @@ msgstr "" "像 :meth:`subgroup` 一樣,但回傳一對 ``(match, rest)``,其中 ``match`` 是 " "``subgroup(condition)`` 而 ``rest`` 是剩下沒有比對到的部分。" -#: ../../library/exceptions.rst:1006 +#: ../../library/exceptions.rst:1016 msgid "" "Returns an exception group with the same :attr:`message`, but which wraps " "the exceptions in ``excs``." msgstr "回傳有相同 :attr:`message` 但將例外包裝在 ``excs`` 的例外群組。" -#: ../../library/exceptions.rst:1009 +#: ../../library/exceptions.rst:1019 msgid "" "This method is used by :meth:`subgroup` and :meth:`split`, which are used in " "various contexts to break up an exception group. A subclass needs to " @@ -1465,23 +1494,23 @@ msgid "" "instances of the subclass rather than :exc:`ExceptionGroup`." msgstr "" "此方法被 :meth:`subgroup` 及 :meth:`split` 使用,被用來在各種情境下拆分例外群" -"組。子類別需要覆寫它來讓 :meth:`subgroup` 及 :meth:`split` 回傳子類別而不是 :" -"exc:`ExceptionGroup` 的實例。" +"組。子類別需要覆寫它來讓 :meth:`subgroup` 及 :meth:`split` 回傳子類別而不" +"是 :exc:`ExceptionGroup` 的實例。" -#: ../../library/exceptions.rst:1015 +#: ../../library/exceptions.rst:1025 msgid "" -":meth:`subgroup` and :meth:`split` copy the :attr:`~BaseException." -"__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." -"__context__` and :attr:`~BaseException.__notes__` fields from the original " -"exception group to the one returned by :meth:`derive`, so these fields do " -"not need to be updated by :meth:`derive`." +":meth:`subgroup` and :meth:`split` copy " +"the :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` " +"and :attr:`~BaseException.__notes__` fields from the original exception " +"group to the one returned by :meth:`derive`, so these fields do not need to " +"be updated by :meth:`derive`." msgstr "" -":meth:`subgroup` 及 :meth:`split` 會從原始的例外群組複製 :attr:" -"`~BaseException.__traceback__`、:attr:`~BaseException.__cause__`、:attr:" -"`~BaseException.__context__` 和 :attr:`~BaseException.__notes__` 欄位到 :" -"meth:`derive` 所回傳的例外群組上,因此這些欄位不需要被 :meth:`derive` 更新。" +":meth:`subgroup` 及 :meth:`split` 會從原始的例外群組複" +"製 :attr:`~BaseException.__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException.__context__` " +"和 :attr:`~BaseException.__notes__` 欄位到 :meth:`derive` 所回傳的例外群組" +"上,因此這些欄位不需要被 :meth:`derive` 更新。" -#: ../../library/exceptions.rst:1022 +#: ../../library/exceptions.rst:1032 msgid "" ">>> class MyGroup(ExceptionGroup):\n" "... def derive(self, excs):\n" @@ -1535,7 +1564,7 @@ msgstr "" ">>> exc.__traceback__ is match.__traceback__ is rest.__traceback__\n" "True" -#: ../../library/exceptions.rst:1048 +#: ../../library/exceptions.rst:1058 msgid "" "Note that :exc:`BaseExceptionGroup` defines :meth:`~object.__new__`, so " "subclasses that need a different constructor signature need to override that " @@ -1547,7 +1576,7 @@ msgstr "" "建構函式簽名的子類別需要覆寫它而不是 :meth:`~object.__init__`。例如下面定義了" "一個例外群組子類別接受 exit_code 並從中建構群組的訊息。: ::" -#: ../../library/exceptions.rst:1054 +#: ../../library/exceptions.rst:1064 msgid "" "class Errors(ExceptionGroup):\n" " def __new__(cls, errors, exit_code):\n" @@ -1567,24 +1596,24 @@ msgstr "" " def derive(self, excs):\n" " return Errors(excs, self.exit_code)" -#: ../../library/exceptions.rst:1063 +#: ../../library/exceptions.rst:1073 msgid "" "Like :exc:`ExceptionGroup`, any subclass of :exc:`BaseExceptionGroup` which " -"is also a subclass of :exc:`Exception` can only wrap instances of :exc:" -"`Exception`." +"is also a subclass of :exc:`Exception` can only wrap instances " +"of :exc:`Exception`." msgstr "" "像 :exc:`ExceptionGroup` 一樣,任何 :exc:`BaseExceptionGroup` 的子類別且也" "是 :exc:`Exception` 的子類別只能包裝 :exc:`Exception` 的實例。" -#: ../../library/exceptions.rst:1071 +#: ../../library/exceptions.rst:1081 msgid "Exception hierarchy" msgstr "例外階層" -#: ../../library/exceptions.rst:1073 +#: ../../library/exceptions.rst:1083 msgid "The class hierarchy for built-in exceptions is:" msgstr "內建例外的類別階層如下:" -#: ../../library/exceptions.rst:1075 +#: ../../library/exceptions.rst:1085 msgid "" "BaseException\n" " ├── BaseExceptionGroup\n" diff --git a/library/faulthandler.po b/library/faulthandler.po index 202d723b3c3..12b954ea311 100644 --- a/library/faulthandler.po +++ b/library/faulthandler.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\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-" @@ -24,10 +24,10 @@ msgstr ":mod:`!faulthandler` --- 傾印 Python 回溯" #: ../../library/faulthandler.rst:11 msgid "" "This module contains functions to dump Python tracebacks explicitly, on a " -"fault, after a timeout, or on a user signal. Call :func:`faulthandler." -"enable` to install fault handlers for the :const:`~signal.SIGSEGV`, :const:" -"`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS`, and :" -"const:`~signal.SIGILL` signals. You can also enable them at startup by " +"fault, after a timeout, or on a user signal. " +"Call :func:`faulthandler.enable` to install fault handlers for " +"the :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS`, " +"and :const:`~signal.SIGILL` signals. You can also enable them at startup by " "setting the :envvar:`PYTHONFAULTHANDLER` environment variable or by using " "the :option:`-X` ``faulthandler`` command line option." msgstr "" @@ -87,8 +87,8 @@ msgstr "" #: ../../library/faulthandler.rst:44 msgid "" -"The :ref:`Python Development Mode ` calls :func:`faulthandler." -"enable` at Python startup." +"The :ref:`Python Development Mode ` " +"calls :func:`faulthandler.enable` at Python startup." msgstr "" #: ../../library/faulthandler.rst:49 @@ -124,117 +124,175 @@ msgid "" ":func:`traceback.print_tb`, which can be used to print a traceback object." msgstr "" -#: ../../library/faulthandler.rst:65 ../../library/faulthandler.rst:84 -#: ../../library/faulthandler.rst:123 ../../library/faulthandler.rst:148 +#: ../../library/faulthandler.rst:65 ../../library/faulthandler.rst:119 +#: ../../library/faulthandler.rst:165 ../../library/faulthandler.rst:190 msgid "Added support for passing file descriptor to this function." msgstr "" #: ../../library/faulthandler.rst:70 +msgid "Dumping the C stack" +msgstr "" + +#: ../../library/faulthandler.rst:76 +msgid "Dump the C stack trace of the current thread into *file*." +msgstr "" + +#: ../../library/faulthandler.rst:78 +msgid "" +"If the Python build does not support it or the operating system does not " +"provide a stack trace, then this prints an error in place of a dumped C " +"stack." +msgstr "" + +#: ../../library/faulthandler.rst:85 +msgid "C Stack Compatibility" +msgstr "" + +#: ../../library/faulthandler.rst:87 +msgid "" +"If the system does not support the C-level :manpage:`backtrace(3)` " +"or :manpage:`dladdr1(3)`, then C stack dumps will not work. An error will be " +"printed instead of the stack." +msgstr "" + +#: ../../library/faulthandler.rst:91 +msgid "" +"Additionally, some compilers do not support :term:`CPython's ` " +"implementation of C stack dumps. As a result, a different error may be " +"printed instead of the stack, even if the operating system supports dumping " +"stacks." +msgstr "" + +#: ../../library/faulthandler.rst:97 +msgid "" +"Dumping C stacks can be arbitrarily slow, depending on the DWARF level of " +"the binaries in the call stack." +msgstr "" + +#: ../../library/faulthandler.rst:101 msgid "Fault handler state" msgstr "" -#: ../../library/faulthandler.rst:74 +#: ../../library/faulthandler.rst:105 msgid "" -"Enable the fault handler: install handlers for the :const:`~signal." -"SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal." -"SIGBUS` and :const:`~signal.SIGILL` signals to dump the Python traceback. If " +"Enable the fault handler: install handlers for " +"the :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS` " +"and :const:`~signal.SIGILL` signals to dump the Python traceback. If " "*all_threads* is ``True``, produce tracebacks for every running thread. " "Otherwise, dump only the current thread." msgstr "" -#: ../../library/faulthandler.rst:81 +#: ../../library/faulthandler.rst:112 msgid "" -"The *file* must be kept open until the fault handler is disabled: see :ref:" -"`issue with file descriptors `." +"The *file* must be kept open until the fault handler is disabled: " +"see :ref:`issue with file descriptors `." msgstr "" -#: ../../library/faulthandler.rst:87 +#: ../../library/faulthandler.rst:115 +msgid "" +"If *c_stack* is ``True``, then the C stack trace is printed after the Python " +"traceback, unless the system does not support it. See :func:`dump_c_stack` " +"for more information on compatibility." +msgstr "" + +#: ../../library/faulthandler.rst:122 msgid "On Windows, a handler for Windows exception is also installed." msgstr "" -#: ../../library/faulthandler.rst:90 +#: ../../library/faulthandler.rst:125 msgid "" "The dump now mentions if a garbage collector collection is running if " "*all_threads* is true." msgstr "" -#: ../../library/faulthandler.rst:96 +#: ../../library/faulthandler.rst:129 msgid "" -"Disable the fault handler: uninstall the signal handlers installed by :func:" -"`enable`." +"Only the current thread is dumped if the :term:`GIL` is disabled to prevent " +"the risk of data races." msgstr "" -#: ../../library/faulthandler.rst:101 +#: ../../library/faulthandler.rst:133 +msgid "The dump now displays the C stack trace if *c_stack* is true." +msgstr "" + +#: ../../library/faulthandler.rst:138 +msgid "" +"Disable the fault handler: uninstall the signal handlers installed " +"by :func:`enable`." +msgstr "" + +#: ../../library/faulthandler.rst:143 msgid "Check if the fault handler is enabled." msgstr "" -#: ../../library/faulthandler.rst:105 +#: ../../library/faulthandler.rst:147 msgid "Dumping the tracebacks after a timeout" msgstr "" -#: ../../library/faulthandler.rst:109 +#: ../../library/faulthandler.rst:151 msgid "" "Dump the tracebacks of all threads, after a timeout of *timeout* seconds, or " "every *timeout* seconds if *repeat* is ``True``. If *exit* is ``True``, " -"call :c:func:`!_exit` with status=1 after dumping the tracebacks. (Note :c:" -"func:`!_exit` exits the process immediately, which means it doesn't do any " -"cleanup like flushing file buffers.) If the function is called twice, the " -"new call replaces previous parameters and resets the timeout. The timer has " -"a sub-second resolution." +"call :c:func:`!_exit` with status=1 after dumping the tracebacks. " +"(Note :c:func:`!_exit` exits the process immediately, which means it doesn't " +"do any cleanup like flushing file buffers.) If the function is called twice, " +"the new call replaces previous parameters and resets the timeout. The timer " +"has a sub-second resolution." msgstr "" -#: ../../library/faulthandler.rst:117 +#: ../../library/faulthandler.rst:159 msgid "" -"The *file* must be kept open until the traceback is dumped or :func:" -"`cancel_dump_traceback_later` is called: see :ref:`issue with file " +"The *file* must be kept open until the traceback is dumped " +"or :func:`cancel_dump_traceback_later` is called: see :ref:`issue with file " "descriptors `." msgstr "" -#: ../../library/faulthandler.rst:121 +#: ../../library/faulthandler.rst:163 msgid "This function is implemented using a watchdog thread." msgstr "" -#: ../../library/faulthandler.rst:126 +#: ../../library/faulthandler.rst:168 msgid "This function is now always available." msgstr "" -#: ../../library/faulthandler.rst:131 +#: ../../library/faulthandler.rst:173 msgid "Cancel the last call to :func:`dump_traceback_later`." msgstr "" -#: ../../library/faulthandler.rst:135 +#: ../../library/faulthandler.rst:177 msgid "Dumping the traceback on a user signal" msgstr "" -#: ../../library/faulthandler.rst:139 +#: ../../library/faulthandler.rst:181 msgid "" "Register a user signal: install a handler for the *signum* signal to dump " "the traceback of all threads, or of the current thread if *all_threads* is " "``False``, into *file*. Call the previous handler if chain is ``True``." msgstr "" -#: ../../library/faulthandler.rst:143 +#: ../../library/faulthandler.rst:185 msgid "" -"The *file* must be kept open until the signal is unregistered by :func:" -"`unregister`: see :ref:`issue with file descriptors `." +"The *file* must be kept open until the signal is unregistered " +"by :func:`unregister`: see :ref:`issue with file descriptors `." msgstr "" -#: ../../library/faulthandler.rst:146 ../../library/faulthandler.rst:157 +#: ../../library/faulthandler.rst:188 ../../library/faulthandler.rst:199 msgid "Not available on Windows." msgstr "" -#: ../../library/faulthandler.rst:153 +#: ../../library/faulthandler.rst:195 msgid "" "Unregister a user signal: uninstall the handler of the *signum* signal " "installed by :func:`register`. Return ``True`` if the signal was registered, " "``False`` otherwise." msgstr "" -#: ../../library/faulthandler.rst:163 +#: ../../library/faulthandler.rst:205 msgid "Issue with file descriptors" msgstr "" -#: ../../library/faulthandler.rst:165 +#: ../../library/faulthandler.rst:207 msgid "" ":func:`enable`, :func:`dump_traceback_later` and :func:`register` keep the " "file descriptor of their *file* argument. If the file is closed and its file " @@ -243,17 +301,17 @@ msgid "" "Call these functions again each time that the file is replaced." msgstr "" -#: ../../library/faulthandler.rst:173 +#: ../../library/faulthandler.rst:215 msgid "Example" msgstr "範例" -#: ../../library/faulthandler.rst:175 +#: ../../library/faulthandler.rst:217 msgid "" "Example of a segmentation fault on Linux with and without enabling the fault " "handler:" msgstr "" -#: ../../library/faulthandler.rst:178 +#: ../../library/faulthandler.rst:220 msgid "" "$ python -c \"import ctypes; ctypes.string_at(0)\"\n" "Segmentation fault\n" @@ -264,21 +322,82 @@ msgid "" "Fatal Python error: Segmentation fault\n" "\n" "Current thread 0x00007fb899f39700 (most recent call first):\n" -" File \"/home/python/cpython/Lib/ctypes/__init__.py\", line 486 in " -"string_at\n" +" File \"/opt/python/Lib/ctypes/__init__.py\", line 486 in string_at\n" " File \"\", line 1 in \n" -"Segmentation fault" -msgstr "" -"$ python -c \"import ctypes; ctypes.string_at(0)\"\n" -"Segmentation fault\n" -"\n" -"$ python -q -X faulthandler\n" -">>> import ctypes\n" -">>> ctypes.string_at(0)\n" -"Fatal Python error: Segmentation fault\n" "\n" -"Current thread 0x00007fb899f39700 (most recent call first):\n" -" File \"/home/python/cpython/Lib/ctypes/__init__.py\", line 486 in " -"string_at\n" -" File \"\", line 1 in \n" +"Current thread's C stack trace (most recent call first):\n" +" Binary file \"/opt/python/python\", at _Py_DumpStack+0x42 " +"[0x5b27f7d7147e]\n" +" Binary file \"/opt/python/python\", at +0x32dcbd [0x5b27f7d85cbd]\n" +" Binary file \"/opt/python/python\", at +0x32df8a [0x5b27f7d85f8a]\n" +" Binary file \"/usr/lib/libc.so.6\", at +0x3def0 [0x77b73226bef0]\n" +" Binary file \"/usr/lib/libc.so.6\", at +0x17ef9c [0x77b7323acf9c]\n" +" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-" +"x86_64-linux-gnu.so\", at +0xcdf6 [0x77b7315dddf6]\n" +" Binary file \"/usr/lib/libffi.so.8\", at +0x7976 [0x77b73158f976]\n" +" Binary file \"/usr/lib/libffi.so.8\", at +0x413c [0x77b73158c13c]\n" +" Binary file \"/usr/lib/libffi.so.8\", at ffi_call+0x12e [0x77b73158ef0e]\n" +" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-" +"x86_64-linux-gnu.so\", at +0x15a33 [0x77b7315e6a33]\n" +" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-" +"x86_64-linux-gnu.so\", at +0x164fa [0x77b7315e74fa]\n" +" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-" +"x86_64-linux-gnu.so\", at +0xc624 [0x77b7315dd624]\n" +" Binary file \"/opt/python/python\", at _PyObject_MakeTpCall+0xce " +"[0x5b27f7b73883]\n" +" Binary file \"/opt/python/python\", at +0x11bab6 [0x5b27f7b73ab6]\n" +" Binary file \"/opt/python/python\", at PyObject_Vectorcall+0x23 " +"[0x5b27f7b73b04]\n" +" Binary file \"/opt/python/python\", at _PyEval_EvalFrameDefault+0x490c " +"[0x5b27f7cbb302]\n" +" Binary file \"/opt/python/python\", at +0x2818e6 [0x5b27f7cd98e6]\n" +" Binary file \"/opt/python/python\", at +0x281aab [0x5b27f7cd9aab]\n" +" Binary file \"/opt/python/python\", at PyEval_EvalCode+0xc5 " +"[0x5b27f7cd9ba3]\n" +" Binary file \"/opt/python/python\", at +0x255957 [0x5b27f7cad957]\n" +" Binary file \"/opt/python/python\", at +0x255ab4 [0x5b27f7cadab4]\n" +" Binary file \"/opt/python/python\", at _PyEval_EvalFrameDefault+0x6c3e " +"[0x5b27f7cbd634]\n" +" Binary file \"/opt/python/python\", at +0x2818e6 [0x5b27f7cd98e6]\n" +" Binary file \"/opt/python/python\", at +0x281aab [0x5b27f7cd9aab]\n" +" Binary file \"/opt/python/python\", at +0x11b6e1 [0x5b27f7b736e1]\n" +" Binary file \"/opt/python/python\", at +0x11d348 [0x5b27f7b75348]\n" +" Binary file \"/opt/python/python\", at +0x11d626 [0x5b27f7b75626]\n" +" Binary file \"/opt/python/python\", at PyObject_Call+0x20 " +"[0x5b27f7b7565e]\n" +" Binary file \"/opt/python/python\", at +0x32a67a [0x5b27f7d8267a]\n" +" Binary file \"/opt/python/python\", at +0x32a7f8 [0x5b27f7d827f8]\n" +" Binary file \"/opt/python/python\", at +0x32ac1b [0x5b27f7d82c1b]\n" +" Binary file \"/opt/python/python\", at Py_RunMain+0x31 [0x5b27f7d82ebe]\n" +" \n" "Segmentation fault" +msgstr "" + +#~ msgid "" +#~ "$ python -c \"import ctypes; ctypes.string_at(0)\"\n" +#~ "Segmentation fault\n" +#~ "\n" +#~ "$ python -q -X faulthandler\n" +#~ ">>> import ctypes\n" +#~ ">>> ctypes.string_at(0)\n" +#~ "Fatal Python error: Segmentation fault\n" +#~ "\n" +#~ "Current thread 0x00007fb899f39700 (most recent call first):\n" +#~ " File \"/home/python/cpython/Lib/ctypes/__init__.py\", line 486 in " +#~ "string_at\n" +#~ " File \"\", line 1 in \n" +#~ "Segmentation fault" +#~ msgstr "" +#~ "$ python -c \"import ctypes; ctypes.string_at(0)\"\n" +#~ "Segmentation fault\n" +#~ "\n" +#~ "$ python -q -X faulthandler\n" +#~ ">>> import ctypes\n" +#~ ">>> ctypes.string_at(0)\n" +#~ "Fatal Python error: Segmentation fault\n" +#~ "\n" +#~ "Current thread 0x00007fb899f39700 (most recent call first):\n" +#~ " File \"/home/python/cpython/Lib/ctypes/__init__.py\", line 486 in " +#~ "string_at\n" +#~ " File \"\", line 1 in \n" +#~ "Segmentation fault" diff --git a/library/fcntl.po b/library/fcntl.po index bf6a8ef8140..4bbdcd57538 100644 --- a/library/fcntl.po +++ b/library/fcntl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-24 05:58+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,8 +25,8 @@ msgstr ":mod:`!fcntl` --- ``fcntl`` 和 ``ioctl`` 系統呼叫" #: ../../library/fcntl.rst:16 msgid "" "This module performs file and I/O control on file descriptors. It is an " -"interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. See the :" -"manpage:`fcntl(2)` and :manpage:`ioctl(2)` Unix manual pages for full " +"interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. See " +"the :manpage:`fcntl(2)` and :manpage:`ioctl(2)` Unix manual pages for full " "details." msgstr "" @@ -37,10 +37,10 @@ msgstr "可用性" #: ../../library/fcntl.rst:23 msgid "" "All functions in this module take a file descriptor *fd* as their first " -"argument. This can be an integer file descriptor, such as returned by ``sys." -"stdin.fileno()``, or an :class:`io.IOBase` object, such as ``sys.stdin`` " -"itself, which provides a :meth:`~io.IOBase.fileno` that returns a genuine " -"file descriptor." +"argument. This can be an integer file descriptor, such as returned by " +"``sys.stdin.fileno()``, or an :class:`io.IOBase` object, such as " +"``sys.stdin`` itself, which provides a :meth:`~io.IOBase.fileno` that " +"returns a genuine file descriptor." msgstr "" #: ../../library/fcntl.rst:29 @@ -59,8 +59,8 @@ msgstr "" #: ../../library/fcntl.rst:38 msgid "" "On macOS, the :mod:`!fcntl` module exposes the ``F_GETPATH`` constant, which " -"obtains the path of a file from a file descriptor. On Linux(>=3.15), the :" -"mod:`!fcntl` module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK`` and " +"obtains the path of a file from a file descriptor. On Linux(>=3.15), " +"the :mod:`!fcntl` module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK`` and " "``F_OFD_SETLKW`` constants, which are used when working with open file " "description locks." msgstr "" @@ -109,43 +109,49 @@ msgid "" msgstr "" #: ../../library/fcntl.rst:82 +msgid "" +"On Linux >= 6.1, the :mod:`!fcntl` module exposes the ``F_DUPFD_QUERY`` to " +"query a file descriptor pointing to the same file." +msgstr "" + +#: ../../library/fcntl.rst:86 msgid "The module defines the following functions:" msgstr "這個模組定義了以下函式:" -#: ../../library/fcntl.rst:87 +#: ../../library/fcntl.rst:91 msgid "" "Perform the operation *cmd* on file descriptor *fd* (file objects providing " "a :meth:`~io.IOBase.fileno` method are accepted as well). The values used " "for *cmd* are operating system dependent, and are available as constants in " "the :mod:`fcntl` module, using the same names as used in the relevant C " -"header files. The argument *arg* can either be an integer value, a :class:" -"`bytes` object, or a string. The type and size of *arg* must match the type " -"and size of the argument of the operation as specified in the relevant C " -"documentation." +"header files. The argument *arg* can either be an integer value, " +"a :term:`bytes-like object`, or a string. The type and size of *arg* must " +"match the type and size of the argument of the operation as specified in the " +"relevant C documentation." msgstr "" -#: ../../library/fcntl.rst:96 +#: ../../library/fcntl.rst:100 msgid "" "When *arg* is an integer, the function returns the integer return value of " "the C :c:func:`fcntl` call." msgstr "" -#: ../../library/fcntl.rst:99 +#: ../../library/fcntl.rst:103 msgid "" -"When the argument is bytes, it represents a binary structure, for example, " -"created by :func:`struct.pack`. A string value is encoded to binary using " -"the UTF-8 encoding. The binary data is copied to a buffer whose address is " -"passed to the C :c:func:`fcntl` call. The return value after a successful " -"call is the contents of the buffer, converted to a :class:`bytes` object. " -"The length of the returned object will be the same as the length of the " -"*arg* argument. This is limited to 1024 bytes." +"When the argument is bytes-like object, it represents a binary structure, " +"for example, created by :func:`struct.pack`. A string value is encoded to " +"binary using the UTF-8 encoding. The binary data is copied to a buffer whose " +"address is passed to the C :c:func:`fcntl` call. The return value after a " +"successful call is the contents of the buffer, converted to a :class:`bytes` " +"object. The length of the returned object will be the same as the length of " +"the *arg* argument. This is limited to 1024 bytes." msgstr "" -#: ../../library/fcntl.rst:108 +#: ../../library/fcntl.rst:112 msgid "If the :c:func:`fcntl` call fails, an :exc:`OSError` is raised." msgstr "" -#: ../../library/fcntl.rst:111 +#: ../../library/fcntl.rst:115 msgid "" "If the type or the size of *arg* does not match the type or size of the " "argument of the operation (for example, if an integer is passed when a " @@ -154,7 +160,7 @@ msgid "" "in a segmentation violation or a more subtle data corruption." msgstr "" -#: ../../library/fcntl.rst:118 +#: ../../library/fcntl.rst:122 msgid "" "Raises an :ref:`auditing event ` ``fcntl.fcntl`` with arguments " "``fd``, ``cmd``, ``arg``." @@ -162,13 +168,19 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``arg`` 的\\ :ref:`稽核事件 ` " "``fcntl.fcntl``。" -#: ../../library/fcntl.rst:123 +#: ../../library/fcntl.rst:124 +msgid "" +"Add support of arbitrary :term:`bytes-like objects `, not " +"only :class:`bytes`." +msgstr "" + +#: ../../library/fcntl.rst:131 msgid "" "This function is identical to the :func:`~fcntl.fcntl` function, except that " "the argument handling is even more complicated." msgstr "" -#: ../../library/fcntl.rst:126 +#: ../../library/fcntl.rst:134 msgid "" "The *request* parameter is limited to values that can fit in 32-bits or 64-" "bits, depending on the platform. Additional constants of interest for use as " @@ -176,20 +188,20 @@ msgid "" "same names as used in the relevant C header files." msgstr "" -#: ../../library/fcntl.rst:132 +#: ../../library/fcntl.rst:140 msgid "" "The parameter *arg* can be an integer, a :term:`bytes-like object`, or a " "string. The type and size of *arg* must match the type and size of the " "argument of the operation as specified in the relevant C documentation." msgstr "" -#: ../../library/fcntl.rst:137 +#: ../../library/fcntl.rst:145 msgid "" "If *arg* does not support the read-write buffer interface or the " "*mutate_flag* is false, behavior is as for the :func:`~fcntl.fcntl` function." msgstr "" -#: ../../library/fcntl.rst:141 +#: ../../library/fcntl.rst:149 msgid "" "If *arg* supports the read-write buffer interface (like :class:`bytearray`) " "and *mutate_flag* is true (the default), then the buffer is (in effect) " @@ -197,16 +209,16 @@ msgid "" "code is passed back to the calling Python, and the buffer's new contents " "reflect the action of the :c:func:`ioctl`. This is a slight simplification, " "because if the supplied buffer is less than 1024 bytes long it is first " -"copied into a static buffer 1024 bytes long which is then passed to :func:" -"`ioctl` and copied back into the supplied buffer." +"copied into a static buffer 1024 bytes long which is then passed " +"to :func:`ioctl` and copied back into the supplied buffer." msgstr "" -#: ../../library/fcntl.rst:150 +#: ../../library/fcntl.rst:158 msgid "" "If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised." msgstr "" -#: ../../library/fcntl.rst:153 +#: ../../library/fcntl.rst:161 msgid "" "If the type or size of *arg* does not match the type or size of the " "operation's argument (for example, if an integer is passed when a pointer is " @@ -216,11 +228,11 @@ msgid "" "more subtle data corruption." msgstr "" -#: ../../library/fcntl.rst:161 +#: ../../library/fcntl.rst:169 msgid "An example::" msgstr "範例: ::" -#: ../../library/fcntl.rst:163 +#: ../../library/fcntl.rst:171 msgid "" ">>> import array, fcntl, struct, termios, os\n" ">>> os.getpgrp()\n" @@ -244,7 +256,7 @@ msgstr "" ">>> buf\n" "array('h', [13341])" -#: ../../library/fcntl.rst:174 +#: ../../library/fcntl.rst:182 msgid "" "Raises an :ref:`auditing event ` ``fcntl.ioctl`` with arguments " "``fd``, ``request``, ``arg``." @@ -252,7 +264,13 @@ msgstr "" "引發一個附帶引數 ``fd``、``request``、``arg`` 的\\ :ref:`稽核事件 " "` ``fcntl.ioctl``。" -#: ../../library/fcntl.rst:179 +#: ../../library/fcntl.rst:184 +msgid "" +"The GIL is always released during a system call. System calls failing with " +"EINTR are automatically retried." +msgstr "" + +#: ../../library/fcntl.rst:190 msgid "" "Perform the lock operation *operation* on file descriptor *fd* (file objects " "providing a :meth:`~io.IOBase.fileno` method are accepted as well). See the " @@ -260,12 +278,12 @@ msgid "" "function is emulated using :c:func:`fcntl`.)" msgstr "" -#: ../../library/fcntl.rst:184 +#: ../../library/fcntl.rst:195 msgid "" "If the :c:func:`flock` call fails, an :exc:`OSError` exception is raised." msgstr "" -#: ../../library/fcntl.rst:186 +#: ../../library/fcntl.rst:197 msgid "" "Raises an :ref:`auditing event ` ``fcntl.flock`` with arguments " "``fd``, ``operation``." @@ -273,69 +291,69 @@ msgstr "" "引發一個附帶引數 ``fd``、``operation`` 的\\ :ref:`稽核事件 ` " "``fcntl.flock``。" -#: ../../library/fcntl.rst:191 +#: ../../library/fcntl.rst:202 msgid "" "This is essentially a wrapper around the :func:`~fcntl.fcntl` locking calls. " -"*fd* is the file descriptor (file objects providing a :meth:`~io.IOBase." -"fileno` method are accepted as well) of the file to lock or unlock, and " -"*cmd* is one of the following values:" +"*fd* is the file descriptor (file objects providing " +"a :meth:`~io.IOBase.fileno` method are accepted as well) of the file to lock " +"or unlock, and *cmd* is one of the following values:" msgstr "" -#: ../../library/fcntl.rst:198 +#: ../../library/fcntl.rst:209 msgid "Release an existing lock." msgstr "" -#: ../../library/fcntl.rst:202 +#: ../../library/fcntl.rst:213 msgid "Acquire a shared lock." msgstr "" -#: ../../library/fcntl.rst:206 +#: ../../library/fcntl.rst:217 msgid "Acquire an exclusive lock." msgstr "" -#: ../../library/fcntl.rst:210 +#: ../../library/fcntl.rst:221 msgid "" "Bitwise OR with any of the other three ``LOCK_*`` constants to make the " "request non-blocking." msgstr "" -#: ../../library/fcntl.rst:213 +#: ../../library/fcntl.rst:224 msgid "" -"If :const:`!LOCK_NB` is used and the lock cannot be acquired, an :exc:" -"`OSError` will be raised and the exception will have an *errno* attribute " -"set to :const:`~errno.EACCES` or :const:`~errno.EAGAIN` (depending on the " -"operating system; for portability, check for both values). On at least some " -"systems, :const:`!LOCK_EX` can only be used if the file descriptor refers to " -"a file opened for writing." +"If :const:`!LOCK_NB` is used and the lock cannot be acquired, " +"an :exc:`OSError` will be raised and the exception will have an *errno* " +"attribute set to :const:`~errno.EACCES` or :const:`~errno.EAGAIN` (depending " +"on the operating system; for portability, check for both values). On at " +"least some systems, :const:`!LOCK_EX` can only be used if the file " +"descriptor refers to a file opened for writing." msgstr "" -#: ../../library/fcntl.rst:220 +#: ../../library/fcntl.rst:231 msgid "" "*len* is the number of bytes to lock, *start* is the byte offset at which " -"the lock starts, relative to *whence*, and *whence* is as with :func:`io." -"IOBase.seek`, specifically:" +"the lock starts, relative to *whence*, and *whence* is as " +"with :func:`io.IOBase.seek`, specifically:" msgstr "" -#: ../../library/fcntl.rst:224 +#: ../../library/fcntl.rst:235 msgid "``0`` -- relative to the start of the file (:const:`os.SEEK_SET`)" msgstr "" -#: ../../library/fcntl.rst:225 +#: ../../library/fcntl.rst:236 msgid "``1`` -- relative to the current buffer position (:const:`os.SEEK_CUR`)" msgstr "" -#: ../../library/fcntl.rst:226 +#: ../../library/fcntl.rst:237 msgid "``2`` -- relative to the end of the file (:const:`os.SEEK_END`)" msgstr "" -#: ../../library/fcntl.rst:228 +#: ../../library/fcntl.rst:239 msgid "" "The default for *start* is 0, which means to start at the beginning of the " "file. The default for *len* is 0 which means to lock to the end of the " "file. The default for *whence* is also 0." msgstr "" -#: ../../library/fcntl.rst:232 +#: ../../library/fcntl.rst:243 msgid "" "Raises an :ref:`auditing event ` ``fcntl.lockf`` with arguments " "``fd``, ``cmd``, ``len``, ``start``, ``whence``." @@ -343,11 +361,11 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``len``、``start``、``whence`` 的\\ :ref:`" "稽核事件 ` ``fcntl.lockf``。" -#: ../../library/fcntl.rst:234 +#: ../../library/fcntl.rst:245 msgid "Examples (all on a SVR4 compliant system)::" msgstr "" -#: ../../library/fcntl.rst:236 +#: ../../library/fcntl.rst:247 msgid "" "import struct, fcntl, os\n" "\n" @@ -365,7 +383,7 @@ msgstr "" "lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)\n" "rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata)" -#: ../../library/fcntl.rst:244 +#: ../../library/fcntl.rst:255 msgid "" "Note that in the first example the return value variable *rv* will hold an " "integer value; in the second example it will hold a :class:`bytes` object. " @@ -373,11 +391,11 @@ msgid "" "therefore using the :func:`flock` call may be better." msgstr "" -#: ../../library/fcntl.rst:252 +#: ../../library/fcntl.rst:263 msgid "Module :mod:`os`" msgstr ":mod:`os` 模組" -#: ../../library/fcntl.rst:253 +#: ../../library/fcntl.rst:264 msgid "" "If the locking flags :const:`~os.O_SHLOCK` and :const:`~os.O_EXLOCK` are " "present in the :mod:`os` module (on BSD only), the :func:`os.open` function " diff --git a/library/fnmatch.po b/library/fnmatch.po index 75dd730a60a..fb01ac7540d 100644 --- a/library/fnmatch.po +++ b/library/fnmatch.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-15 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -82,10 +82,10 @@ msgstr "" #: ../../library/fnmatch.rst:43 msgid "" "Note that the filename separator (``'/'`` on Unix) is *not* special to this " -"module. See module :mod:`glob` for pathname expansion (:mod:`glob` uses :" -"func:`.filter` to match pathname segments). Similarly, filenames starting " -"with a period are not special for this module, and are matched by the ``*`` " -"and ``?`` patterns." +"module. See module :mod:`glob` for pathname expansion (:mod:`glob` " +"uses :func:`.filter` to match pathname segments). Similarly, filenames " +"starting with a period are not special for this module, and are matched by " +"the ``*`` and ``?`` patterns." msgstr "" #: ../../library/fnmatch.rst:49 @@ -100,15 +100,15 @@ msgstr "" msgid "" "Finally, note that :func:`functools.lru_cache` with a *maxsize* of 32768 is " "used to cache the (typed) compiled regex patterns in the following " -"functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`." +"functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`, :func:`.filterfalse`." msgstr "" #: ../../library/fnmatch.rst:61 msgid "" "Test whether the filename string *name* matches the pattern string *pat*, " -"returning ``True`` or ``False``. Both parameters are case-normalized using :" -"func:`os.path.normcase`. :func:`fnmatchcase` can be used to perform a case-" -"sensitive comparison, regardless of whether that's standard for the " +"returning ``True`` or ``False``. Both parameters are case-normalized " +"using :func:`os.path.normcase`. :func:`fnmatchcase` can be used to perform a " +"case-sensitive comparison, regardless of whether that's standard for the " "operating system." msgstr "" @@ -150,19 +150,27 @@ msgstr "" #: ../../library/fnmatch.rst:95 msgid "" +"Construct a list from those elements of the :term:`iterable` of filename " +"strings *names* that do not match the pattern string *pat*. It is the same " +"as ``[n for n in names if not fnmatch(n, pat)]``, but implemented more " +"efficiently." +msgstr "" + +#: ../../library/fnmatch.rst:105 +msgid "" "Return the shell-style pattern *pat* converted to a regular expression for " "using with :func:`re.match`. The pattern is expected to be a :class:`str`." msgstr "" -#: ../../library/fnmatch.rst:98 +#: ../../library/fnmatch.rst:108 msgid "Example:" msgstr "範例:" -#: ../../library/fnmatch.rst:112 +#: ../../library/fnmatch.rst:122 msgid "Module :mod:`glob`" msgstr ":mod:`glob` 模組" -#: ../../library/fnmatch.rst:113 +#: ../../library/fnmatch.rst:123 msgid "Unix shell-style path expansion." msgstr "" diff --git a/library/fractions.po b/library/fractions.po index c3f5ecb2777..819ee0581e4 100644 --- a/library/fractions.po +++ b/library/fractions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-06 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2016-01-31 07:18+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,44 +33,54 @@ msgstr "" #: ../../library/fractions.rst:17 msgid "" -"A Fraction instance can be constructed from a pair of rational numbers, from " -"a single number, or from a string." +"A Fraction instance can be constructed from a pair of integers, from another " +"rational number, or from a string." msgstr "" #: ../../library/fractions.rst:26 msgid "" "The first version requires that *numerator* and *denominator* are instances " "of :class:`numbers.Rational` and returns a new :class:`Fraction` instance " -"with a value equal to ``numerator/denominator``. If *denominator* is zero, " -"it raises a :exc:`ZeroDivisionError`. The second version requires that " -"*other_fraction* is an instance of :class:`numbers.Rational` and returns a :" -"class:`Fraction` instance with the same value. The next two versions accept " -"either a :class:`float` or a :class:`decimal.Decimal` instance, and return " -"a :class:`Fraction` instance with exactly the same value. Note that due to " -"the usual issues with binary floating point (see :ref:`tut-fp-issues`), the " -"argument to ``Fraction(1.1)`` is not exactly equal to 11/10, and so " -"``Fraction(1.1)`` does *not* return ``Fraction(11, 10)`` as one might " -"expect. (But see the documentation for the :meth:`limit_denominator` method " -"below.) The last version of the constructor expects a string or unicode " -"instance. The usual form for this instance is::" -msgstr "" - -#: ../../library/fractions.rst:41 +"with value ``numerator/denominator``. If *denominator* is ``0``, it raises " +"a :exc:`ZeroDivisionError`." +msgstr "" + +#: ../../library/fractions.rst:31 +msgid "" +"The second version requires that *number* is an instance " +"of :class:`numbers.Rational` or has the :meth:`!as_integer_ratio` method " +"(this includes :class:`float` and :class:`decimal.Decimal`). It returns " +"a :class:`Fraction` instance with exactly the same value. Assumed, that " +"the :meth:`!as_integer_ratio` method returns a pair of coprime integers and " +"last one is positive. Note that due to the usual issues with binary point " +"(see :ref:`tut-fp-issues`), the argument to ``Fraction(1.1)`` is not exactly " +"equal to 11/10, and so ``Fraction(1.1)`` does *not* return ``Fraction(11, " +"10)`` as one might expect. (But see the documentation for " +"the :meth:`limit_denominator` method below.)" +msgstr "" + +#: ../../library/fractions.rst:43 +msgid "" +"The last version of the constructor expects a string. The usual form for " +"this instance is::" +msgstr "" + +#: ../../library/fractions.rst:46 msgid "[sign] numerator ['/' denominator]" msgstr "[sign] numerator ['/' denominator]" -#: ../../library/fractions.rst:43 +#: ../../library/fractions.rst:48 msgid "" "where the optional ``sign`` may be either '+' or '-' and ``numerator`` and " "``denominator`` (if present) are strings of decimal digits (underscores may " "be used to delimit digits as with integral literals in code). In addition, " -"any string that represents a finite value and is accepted by the :class:" -"`float` constructor is also accepted by the :class:`Fraction` constructor. " -"In either form the input string may also have leading and/or trailing " -"whitespace. Here are some examples::" +"any string that represents a finite value and is accepted by " +"the :class:`float` constructor is also accepted by the :class:`Fraction` " +"constructor. In either form the input string may also have leading and/or " +"trailing whitespace. Here are some examples::" msgstr "" -#: ../../library/fractions.rst:52 +#: ../../library/fractions.rst:57 msgid "" ">>> from fractions import Fraction\n" ">>> Fraction(16, -10)\n" @@ -122,143 +132,160 @@ msgstr "" ">>> Fraction(Decimal('1.1'))\n" "Fraction(11, 10)" -#: ../../library/fractions.rst:78 +#: ../../library/fractions.rst:83 msgid "" -"The :class:`Fraction` class inherits from the abstract base class :class:" -"`numbers.Rational`, and implements all of the methods and operations from " -"that class. :class:`Fraction` instances are :term:`hashable`, and should be " -"treated as immutable. In addition, :class:`Fraction` has the following " -"properties and methods:" +"The :class:`Fraction` class inherits from the abstract base " +"class :class:`numbers.Rational`, and implements all of the methods and " +"operations from that class. :class:`Fraction` instances " +"are :term:`hashable`, and should be treated as immutable. In " +"addition, :class:`Fraction` has the following properties and methods:" msgstr "" -#: ../../library/fractions.rst:84 +#: ../../library/fractions.rst:89 msgid "" -"The :class:`Fraction` constructor now accepts :class:`float` and :class:" -"`decimal.Decimal` instances." +"The :class:`Fraction` constructor now accepts :class:`float` " +"and :class:`decimal.Decimal` instances." msgstr "" -":class:`Fraction` 建構函式現在可接受 :class:`float` 和 :class:`decimal." -"Decimal` 實例。" +":class:`Fraction` 建構函式現在可接受 :class:`float` " +"和 :class:`decimal.Decimal` 實例。" -#: ../../library/fractions.rst:88 +#: ../../library/fractions.rst:93 msgid "" "The :func:`math.gcd` function is now used to normalize the *numerator* and " "*denominator*. :func:`math.gcd` always returns an :class:`int` type. " "Previously, the GCD type depended on *numerator* and *denominator*." msgstr "" -#: ../../library/fractions.rst:93 +#: ../../library/fractions.rst:98 msgid "" "Underscores are now permitted when creating a :class:`Fraction` instance " "from a string, following :PEP:`515` rules." msgstr "" -#: ../../library/fractions.rst:97 +#: ../../library/fractions.rst:102 msgid "" -":class:`Fraction` implements ``__int__`` now to satisfy ``typing." -"SupportsInt`` instance checks." +":class:`Fraction` implements ``__int__`` now to satisfy " +"``typing.SupportsInt`` instance checks." msgstr "" -#: ../../library/fractions.rst:101 +#: ../../library/fractions.rst:106 msgid "" "Space is allowed around the slash for string inputs: ``Fraction('2 / 3')``." msgstr "" -#: ../../library/fractions.rst:104 +#: ../../library/fractions.rst:109 msgid "" ":class:`Fraction` instances now support float-style formatting, with " "presentation types ``\"e\"``, ``\"E\"``, ``\"f\"``, ``\"F\"``, ``\"g\"``, " "``\"G\"`` and ``\"%\"\"``." msgstr "" -#: ../../library/fractions.rst:109 +#: ../../library/fractions.rst:114 msgid "" "Formatting of :class:`Fraction` instances without a presentation type now " "supports fill, alignment, sign handling, minimum width and grouping." msgstr "" -#: ../../library/fractions.rst:115 +#: ../../library/fractions.rst:118 +#, fuzzy +msgid "" +"The :class:`Fraction` constructor now accepts any objects with the :meth:`!" +"as_integer_ratio` method." +msgstr "" +":class:`Fraction` 建構函式現在可接受 :class:`float` " +"和 :class:`decimal.Decimal` 實例。" + +#: ../../library/fractions.rst:124 msgid "Numerator of the Fraction in lowest term." msgstr "" -#: ../../library/fractions.rst:119 -msgid "Denominator of the Fraction in lowest terms. Guaranteed to be positive." +#: ../../library/fractions.rst:128 +msgid "Denominator of the Fraction in lowest term." msgstr "" -#: ../../library/fractions.rst:125 +#: ../../library/fractions.rst:133 msgid "" "Return a tuple of two integers, whose ratio is equal to the original " "Fraction. The ratio is in lowest terms and has a positive denominator." msgstr "" -#: ../../library/fractions.rst:133 +#: ../../library/fractions.rst:141 msgid "Return ``True`` if the Fraction is an integer." msgstr "" -#: ../../library/fractions.rst:139 +#: ../../library/fractions.rst:147 msgid "" -"Alternative constructor which only accepts instances of :class:`float` or :" -"class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is not " -"the same value as ``Fraction(3, 10)``." +"Alternative constructor which only accepts instances of :class:`float` " +"or :class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is " +"not the same value as ``Fraction(3, 10)``." msgstr "" -#: ../../library/fractions.rst:145 +#: ../../library/fractions.rst:153 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`float`." msgstr "" -#: ../../library/fractions.rst:151 +#: ../../library/fractions.rst:159 msgid "" -"Alternative constructor which only accepts instances of :class:`decimal." -"Decimal` or :class:`numbers.Integral`." +"Alternative constructor which only accepts instances " +"of :class:`decimal.Decimal` or :class:`numbers.Integral`." msgstr "" -#: ../../library/fractions.rst:156 +#: ../../library/fractions.rst:164 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`decimal.Decimal` instance." msgstr "" -#: ../../library/fractions.rst:163 +#: ../../library/fractions.rst:171 +msgid "" +"Alternative constructor which only accepts instances " +"of :class:`numbers.Integral`, :class:`numbers.Rational`, :class:`float` " +"or :class:`decimal.Decimal`, and objects with the :meth:`!as_integer_ratio` " +"method, but not strings." +msgstr "" + +#: ../../library/fractions.rst:181 msgid "" "Finds and returns the closest :class:`Fraction` to ``self`` that has " "denominator at most max_denominator. This method is useful for finding " "rational approximations to a given floating-point number:" msgstr "" -#: ../../library/fractions.rst:171 +#: ../../library/fractions.rst:189 msgid "or for recovering a rational number that's represented as a float:" msgstr "" -#: ../../library/fractions.rst:184 +#: ../../library/fractions.rst:202 msgid "" "Returns the greatest :class:`int` ``<= self``. This method can also be " "accessed through the :func:`math.floor` function:" msgstr "" -#: ../../library/fractions.rst:194 +#: ../../library/fractions.rst:212 msgid "" "Returns the least :class:`int` ``>= self``. This method can also be " "accessed through the :func:`math.ceil` function." msgstr "" -#: ../../library/fractions.rst:201 +#: ../../library/fractions.rst:219 msgid "" "The first version returns the nearest :class:`int` to ``self``, rounding " "half to even. The second version rounds ``self`` to the nearest multiple of " "``Fraction(1, 10**ndigits)`` (logically, if ``ndigits`` is negative), again " -"rounding half toward even. This method can also be accessed through the :" -"func:`round` function." +"rounding half toward even. This method can also be accessed through " +"the :func:`round` function." msgstr "" -#: ../../library/fractions.rst:209 +#: ../../library/fractions.rst:227 msgid "" -"Provides support for formatting of :class:`Fraction` instances via the :meth:" -"`str.format` method, the :func:`format` built-in function, or :ref:" -"`Formatted string literals `." +"Provides support for formatting of :class:`Fraction` instances via " +"the :meth:`str.format` method, the :func:`format` built-in function, " +"or :ref:`Formatted string literals `." msgstr "" -#: ../../library/fractions.rst:213 +#: ../../library/fractions.rst:231 msgid "" "If the ``format_spec`` format specification string does not end with one of " "the presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` " @@ -270,7 +297,7 @@ msgid "" "exact integer. The zero-fill flag ``'0'`` is not supported." msgstr "" -#: ../../library/fractions.rst:223 +#: ../../library/fractions.rst:241 msgid "" "If the ``format_spec`` format specification string ends with one of the " "presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` or " @@ -278,11 +305,11 @@ msgid "" "type in the :ref:`formatspec` section." msgstr "" -#: ../../library/fractions.rst:228 +#: ../../library/fractions.rst:246 msgid "Here are some examples::" msgstr "" -#: ../../library/fractions.rst:230 +#: ../../library/fractions.rst:248 msgid "" ">>> from fractions import Fraction\n" ">>> format(Fraction(103993, 33102), '_')\n" @@ -322,10 +349,14 @@ msgstr "" ">>> \"{:.2%} price increase\".format(Fraction(new_price, old_price) - 1)\n" "'34.67% price increase'" -#: ../../library/fractions.rst:252 +#: ../../library/fractions.rst:270 msgid "Module :mod:`numbers`" msgstr ":mod:`numbers` 模組" -#: ../../library/fractions.rst:253 +#: ../../library/fractions.rst:271 msgid "The abstract base classes making up the numeric tower." msgstr "" + +#: ../../library/fractions.rst:20 +msgid "as_integer_ratio()" +msgstr "" diff --git a/library/functions.po b/library/functions.po index ed0adb9e742..ffc64e8e318 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-26 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -460,9 +460,9 @@ msgid "" "iterator. If *default* is given, it is returned if the iterator is " "exhausted, otherwise :exc:`StopAsyncIteration` is raised." msgstr "" -"呼叫 *async_iterator* 的 :meth:`~object.__anext__` 方法,回傳 :term:" -"`awaitable`。等待返回疊代器的下一個值。如果指定 *default*,當疊代器結束時會返" -"回該值,否則會引發 :exc:`StopAsyncIteration` 。" +"呼叫 *async_iterator* 的 :meth:`~object.__anext__` 方法,回" +"傳 :term:`awaitable`。等待返回疊代器的下一個值。如果指定 *default*,當疊代器" +"結束時會返回該值,否則會引發 :exc:`StopAsyncIteration` 。" #: ../../library/functions.rst:104 msgid "" @@ -489,9 +489,9 @@ msgstr "" #: ../../library/functions.rst:116 msgid "" "As :func:`repr`, return a string containing a printable representation of an " -"object, but escape the non-ASCII characters in the string returned by :func:" -"`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates a string " -"similar to that returned by :func:`repr` in Python 2." +"object, but escape the non-ASCII characters in the string returned " +"by :func:`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates " +"a string similar to that returned by :func:`repr` in Python 2." msgstr "" "就像函式 :func:`repr`,回傳一個表示物件的字串,但是 :func:`repr` 回傳的字串中" "非 ASCII 編碼的字元會被跳脫 (escape),像是 ``\\x``、``\\u`` 和 ``\\U``。這個" @@ -500,13 +500,13 @@ msgstr "" #: ../../library/functions.rst:124 msgid "" "Convert an integer number to a binary string prefixed with \"0b\". The " -"result is a valid Python expression. If *integer* is not a Python :class:" -"`int` object, it has to define an :meth:`~object.__index__` method that " -"returns an integer. Some examples:" +"result is a valid Python expression. If *integer* is not a " +"Python :class:`int` object, it has to define an :meth:`~object.__index__` " +"method that returns an integer. Some examples:" msgstr "" "將一個整數轉變為一個前綴為 \"0b\" 的二進位制字串。結果是一個有效的 Python 運" -"算式。如果 *integer* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:`~object." -"__index__` method 回傳一個整數。舉例來說:" +"算式。如果 *integer* 不是 Python 的 :class:`int` 物件,那它需要定" +"義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" #: ../../library/functions.rst:134 msgid "" @@ -514,8 +514,8 @@ msgid "" "ways." msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" -#: ../../library/functions.rst:141 ../../library/functions.rst:940 -#: ../../library/functions.rst:1321 +#: ../../library/functions.rst:141 ../../library/functions.rst:948 +#: ../../library/functions.rst:1332 msgid "See also :func:`format` for more information." msgstr "可參考 :func:`format` 取得更多資訊。" @@ -524,9 +524,9 @@ msgid "" "Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is " "converted using the standard :ref:`truth testing procedure `. If the " "argument is false or omitted, this returns ``False``; otherwise, it returns " -"``True``. The :class:`bool` class is a subclass of :class:`int` (see :ref:" -"`typesnumeric`). It cannot be subclassed further. Its only instances are " -"``False`` and ``True`` (see :ref:`typebool`)." +"``True``. The :class:`bool` class is a subclass of :class:`int` " +"(see :ref:`typesnumeric`). It cannot be subclassed further. Its only " +"instances are ``False`` and ``True`` (see :ref:`typebool`)." msgstr "" "回傳一個布林值,即 ``True`` 或者 ``False``。引數會使用標準的\\ :ref:`真值測試" "程序 `\\ 來轉換。如果引數為假或者被省略,則回傳 ``False``;其他情況回" @@ -534,7 +534,7 @@ msgstr "" "(參見 :ref:`typesnumeric`),其他 class 不能繼承自它。它只有 ``False`` 和 " "``True`` 兩個實例(參見 :ref:`typebool`)。" -#: ../../library/functions.rst:156 ../../library/functions.rst:805 +#: ../../library/functions.rst:156 ../../library/functions.rst:813 msgid "The parameter is now positional-only." msgstr "現在為僅限位置參數。" @@ -551,18 +551,18 @@ msgid "" "not accessible, this function will raise :exc:`RuntimeError`." msgstr "" "這個函式將呼叫 :func:`sys.breakpointhook` 函式,並將 ``args`` 和 ``kws`` 傳遞" -"給它。這將有效地讓你在特定的呼叫點進入除錯器。預設情況下,``sys." -"breakpointhook()`` 呼叫 :func:`pdb.set_trace` 不須帶任何引數。這樣的設計是為" -"了方便使用者,讓他們不需要額外地導入 :mod:`pdb` 模組或輸入太多程式就可以進入" -"除錯器。然而,可以將 :func:`sys.breakpointhook` 設置為其他函式,並且 :func:" -"`breakpoint` 將自動呼叫該函式,讓你進入所選擇的除錯器。如果無法存取 :func:" -"`sys.breakpointhook` 這個函式,則此函式將引發 :exc:`RuntimeError`。" +"給它。這將有效地讓你在特定的呼叫點進入除錯器。預設情況下," +"``sys.breakpointhook()`` 呼叫 :func:`pdb.set_trace` 不須帶任何引數。這樣的設" +"計是為了方便使用者,讓他們不需要額外地導入 :mod:`pdb` 模組或輸入太多程式就可" +"以進入除錯器。然而,可以將 :func:`sys.breakpointhook` 設置為其他函式,並" +"且 :func:`breakpoint` 將自動呼叫該函式,讓你進入所選擇的除錯器。如果無法存" +"取 :func:`sys.breakpointhook` 這個函式,則此函式將引發 :exc:`RuntimeError`。" #: ../../library/functions.rst:173 msgid "" -"By default, the behavior of :func:`breakpoint` can be changed with the :" -"envvar:`PYTHONBREAKPOINT` environment variable. See :func:`sys." -"breakpointhook` for usage details." +"By default, the behavior of :func:`breakpoint` can be changed with " +"the :envvar:`PYTHONBREAKPOINT` environment variable. " +"See :func:`sys.breakpointhook` for usage details." msgstr "" "預設情況下,:func:`breakpoint` 的行為可以透過 :envvar:`PYTHONBREAKPOINT` 環境" "變數來更改。有關使用詳情,請參考 :func:`sys.breakpointhook`。" @@ -589,9 +589,9 @@ msgid "" "as most methods that the :class:`bytes` type has, see :ref:`bytes-methods`." msgstr "" "回傳一個新的 bytes 陣列。:class:`bytearray` class 是一個可變的整數序列,包含" -"範圍為 0 <= x < 256 的整數。它有可變序列大部分常見的 method(如在 :ref:" -"`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 method,參" -"見 :ref:`bytes-methods`。" +"範圍為 0 <= x < 256 的整數。它有可變序列大部分常見的 method(如" +"在 :ref:`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 " +"method,參見 :ref:`bytes-methods`。" #: ../../library/functions.rst:194 msgid "" @@ -644,8 +644,8 @@ msgstr "可參考 :ref:`binaryseq` 和 :ref:`typebytearray`。" #: ../../library/functions.rst:220 msgid "" "Return a new \"bytes\" object which is an immutable sequence of integers in " -"the range ``0 <= x < 256``. :class:`bytes` is an immutable version of :" -"class:`bytearray` -- it has the same non-mutating methods and the same " +"the range ``0 <= x < 256``. :class:`bytes` is an immutable version " +"of :class:`bytearray` -- it has the same non-mutating methods and the same " "indexing and slicing behavior." msgstr "" "回傳一個新的 \"bytes\" 物件,會是一個元素是範圍為 ``0 <= x < 256`` 整數的不可" @@ -667,11 +667,12 @@ msgstr "可參考 :ref:`binaryseq`、:ref:`typebytes` 和 :ref:`bytes-methods` #: ../../library/functions.rst:234 msgid "" -"Return :const:`True` if the *object* argument appears callable, :const:" -"`False` if not. If this returns ``True``, it is still possible that a call " -"fails, but if it is ``False``, calling *object* will never succeed. Note " -"that classes are callable (calling a class returns a new instance); " -"instances are callable if their class has a :meth:`~object.__call__` method." +"Return :const:`True` if the *object* argument appears " +"callable, :const:`False` if not. If this returns ``True``, it is still " +"possible that a call fails, but if it is ``False``, calling *object* will " +"never succeed. Note that classes are callable (calling a class returns a new " +"instance); instances are callable if their class has " +"a :meth:`~object.__call__` method." msgstr "" "如果引數 *object* 是可呼叫的,回傳 :const:`True`,否則回傳 :const:`False`。如" "果回傳 ``True``,呼叫仍可能會失敗;但如果回傳 ``False``,則呼叫 *object* 肯定" @@ -698,8 +699,8 @@ msgid "" "The valid range for the argument is from 0 through 1,114,111 (0x10FFFF in " "base 16). :exc:`ValueError` will be raised if it is outside that range." msgstr "" -"引數的有效範圍是 0 到 1,114,111(16 進制表示為 0x10FFFF)。如果它超過這個" -"範圍,會引發 :exc:`ValueError`。" +"引數的有效範圍是 0 到 1,114,111(16 進制表示為 0x10FFFF)。如果它超過這個範" +"圍,會引發 :exc:`ValueError`。" #: ../../library/functions.rst:257 msgid "Transform a method into a class method." @@ -726,8 +727,8 @@ msgstr "" #: ../../library/functions.rst:267 msgid "" -"The ``@classmethod`` form is a function :term:`decorator` -- see :ref:" -"`function` for details." +"The ``@classmethod`` form is a function :term:`decorator` -- " +"see :ref:`function` for details." msgstr "" "``@classmethod`` 語法是一個函式 :term:`decorator` — 參見 :ref:`function` 中關" "於函式定義的詳細介紹。" @@ -755,31 +756,30 @@ msgstr "" #: ../../library/functions.rst:279 msgid "" -"Class methods can now wrap other :term:`descriptors ` such as :" -"func:`property`." +"Class methods can now wrap other :term:`descriptors ` such " +"as :func:`property`." msgstr "" -"Class methods 現在可以包裝其他\\ :term:`描述器 `,例如 :func:" -"`property`" +"Class methods 現在可以包裝其他\\ :term:`描述器 `,例" +"如 :func:`property`" #: ../../library/functions.rst:283 msgid "" -"Class methods now inherit the method attributes (:attr:`~function." -"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" -"attr:`~function.__doc__` and :attr:`~function.__annotations__`) and have a " -"new ``__wrapped__`` attribute." +"Class methods now inherit the method attributes " +"(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " +"and :attr:`~function.__annotations__`) and have a new ``__wrapped__`` " +"attribute." msgstr "" -"Class method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" -"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." -"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " -"``__wrapped__`` 屬性。" +"Class method 現在繼承了 method 屬性" +"(:attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__doc__` " +"和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性。" #: ../../library/functions.rst:290 msgid "" "Class methods can no longer wrap other :term:`descriptors ` such " "as :func:`property`." msgstr "" -"Class methods 不能再包裝其他的\\ :term:`描述器 `,例如 :func:" -"`property`。" +"Class methods 不能再包裝其他的\\ :term:`描述器 `,例" +"如 :func:`property`。" #: ../../library/functions.rst:297 msgid "" @@ -788,9 +788,9 @@ msgid "" "string, a byte string, or an AST object. Refer to the :mod:`ast` module " "documentation for information on how to work with AST objects." msgstr "" -"將 *source* 編譯成程式碼或 AST 物件。程式碼物件可以被 :func:`exec` 或 :func:" -"`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。參見 :mod:" -"`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" +"將 *source* 編譯成程式碼或 AST 物件。程式碼物件可以被 :func:`exec` " +"或 :func:`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。" +"參見 :mod:`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" #: ../../library/functions.rst:302 msgid "" @@ -816,16 +816,16 @@ msgstr "" #: ../../library/functions.rst:312 msgid "" -"The optional arguments *flags* and *dont_inherit* control which :ref:" -"`compiler options ` should be activated and which :ref:" -"`future features ` should be allowed. If neither is present (or both " -"are zero) the code is compiled with the same flags that affect the code that " -"is calling :func:`compile`. If the *flags* argument is given and " -"*dont_inherit* is not (or is zero) then the compiler options and the future " -"statements specified by the *flags* argument are used in addition to those " -"that would be used anyway. If *dont_inherit* is a non-zero integer then the " -"*flags* argument is it -- the flags (future features and compiler options) " -"in the surrounding code are ignored." +"The optional arguments *flags* and *dont_inherit* control " +"which :ref:`compiler options ` should be activated and " +"which :ref:`future features ` should be allowed. If neither is " +"present (or both are zero) the code is compiled with the same flags that " +"affect the code that is calling :func:`compile`. If the *flags* argument is " +"given and *dont_inherit* is not (or is zero) then the compiler options and " +"the future statements specified by the *flags* argument are used in addition " +"to those that would be used anyway. If *dont_inherit* is a non-zero integer " +"then the *flags* argument is it -- the flags (future features and compiler " +"options) in the surrounding code are ignored." msgstr "" "可選引數 *flags* 和 *dont_inherit* 控制啟用哪個\\ :ref:`編譯器選項 `\\ 以及允許哪個\\ :ref:`未來功能 `。如果兩者都不存在" @@ -838,16 +838,18 @@ msgstr "" msgid "" "Compiler options and future statements are specified by bits which can be " "bitwise ORed together to specify multiple options. The bitfield required to " -"specify a given future feature can be found as the :attr:`~__future__." -"_Feature.compiler_flag` attribute on the :class:`~__future__._Feature` " -"instance in the :mod:`__future__` module. :ref:`Compiler flags ` can be found in :mod:`ast` module, with ``PyCF_`` prefix." +"specify a given future feature can be found as " +"the :attr:`~__future__._Feature.compiler_flag` attribute on " +"the :class:`~__future__._Feature` instance in the :mod:`__future__` " +"module. :ref:`Compiler flags ` can be found " +"in :mod:`ast` module, with ``PyCF_`` prefix." msgstr "" "編譯器選項和 future 陳述式使用 bits 來表示,可以一起被位元操作 OR 來表示複數" -"個選項。需要被具體定義特徵的位元域可以透過 :mod:`__future__` module 中 :" -"class:`~__future__._Feature` 實例中的 :attr:`~__future__._Feature." -"compiler_flag` 屬性來獲得。:ref:`編譯器旗標 `\\ 可以在 :" -"mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名稱。" +"個選項。需要被具體定義特徵的位元域可以透過 :mod:`__future__` module " +"中 :class:`~__future__._Feature` 實例中" +"的 :attr:`~__future__._Feature.compiler_flag` 屬性來獲得。:ref:`編譯器旗標 " +"`\\ 可以在 :mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名" +"稱。" #: ../../library/functions.rst:331 msgid "" @@ -857,8 +859,8 @@ msgid "" "optimization; ``__debug__`` is true), ``1`` (asserts are removed, " "``__debug__`` is false) or ``2`` (docstrings are removed too)." msgstr "" -"引數 *optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器的 :" -"option:`-O` 選項相同的最佳化級別。其他級別為 ``0``\\ (沒有最佳化;\\ " +"引數 *optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器" +"的 :option:`-O` 選項相同的最佳化級別。其他級別為 ``0``\\ (沒有最佳化;\\ " "``__debug__`` 為真值)、``1``\\ (assert 被刪除,``__debug__`` 為假值)或 " "``2``\\ (說明字串 (docstring) 也被刪除)。" @@ -872,8 +874,8 @@ msgstr "" #: ../../library/functions.rst:340 msgid "" -"If you want to parse Python code into its AST representation, see :func:`ast." -"parse`." +"If you want to parse Python code into its AST representation, " +"see :func:`ast.parse`." msgstr "如果你想解析 Python 程式碼為 AST 運算式,請參閱 :func:`ast.parse`。" #: ../../library/functions.rst:343 ../../library/functions.rst:345 @@ -889,8 +891,8 @@ msgstr "" msgid "" "When compiling a string with multi-line code in ``'single'`` or ``'eval'`` " "mode, input must be terminated by at least one newline character. This is " -"to facilitate detection of incomplete and complete statements in the :mod:" -"`code` module." +"to facilitate detection of incomplete and complete statements in " +"the :mod:`code` module." msgstr "" "在 ``'single'`` 或 ``'eval'`` 模式編譯多行程式碼時,輸入必須以至少一個換行符" "結尾。這使 :mod:`code` module 更容易檢測陳述式的完整性。" @@ -932,8 +934,8 @@ msgid "" "number from real and imaginary parts." msgstr "" -#: ../../library/functions.rst:382 ../../library/functions.rst:750 -#: ../../library/functions.rst:996 +#: ../../library/functions.rst:382 ../../library/functions.rst:756 +#: ../../library/functions.rst:1004 msgid "Examples:" msgstr "例如: ::" @@ -983,23 +985,23 @@ msgid "" "and ``')'``, which are ignored. The string must not contain whitespace " "between ``'+'``, ``'-'``, the ``'j'`` or ``'J'`` suffix, and the decimal " "number. For example, ``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` " -"raises :exc:`ValueError`. More precisely, the input must conform to the :" -"token:`~float:complexvalue` production rule in the following grammar, after " -"parentheses and leading and trailing whitespace characters are removed:" +"raises :exc:`ValueError`. More precisely, the input must conform to " +"the :token:`~float:complexvalue` production rule in the following grammar, " +"after parentheses and leading and trailing whitespace characters are removed:" msgstr "" #: ../../library/functions.rst:422 msgid "" "If the argument is a number, the constructor serves as a numeric conversion " "like :class:`int` and :class:`float`. For a general Python object ``x``, " -"``complex(x)`` delegates to ``x.__complex__()``. If :meth:`~object." -"__complex__` is not defined then it falls back to :meth:`~object.__float__`. " -"If :meth:`!__float__` is not defined then it falls back to :meth:`~object." -"__index__`." +"``complex(x)`` delegates to ``x.__complex__()``. " +"If :meth:`~object.__complex__` is not defined then it falls back " +"to :meth:`~object.__float__`. If :meth:`!__float__` is not defined then it " +"falls back to :meth:`~object.__index__`." msgstr "" "如果引數是一個數字,則建構函式會像 :class:`int` 和 :class:`float` 一樣進行數" -"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 ``x." -"__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " +"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 " +"``x.__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " "back) 到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未定義,則會再回" "退到 :meth:`~object.__index__`。" @@ -1015,27 +1017,39 @@ msgid "" msgstr "" #: ../../library/functions.rst:441 -msgid "If all arguments are omitted, returns ``0j``." +msgid "" +"See also :meth:`complex.from_number` which only accepts a single numeric " +"argument." msgstr "" #: ../../library/functions.rst:443 +msgid "If all arguments are omitted, returns ``0j``." +msgstr "" + +#: ../../library/functions.rst:445 msgid "The complex type is described in :ref:`typesnumeric`." msgstr "複數型別在 :ref:`typesnumeric` 中有相關描述。" -#: ../../library/functions.rst:445 ../../library/functions.rst:802 -#: ../../library/functions.rst:1045 +#: ../../library/functions.rst:447 ../../library/functions.rst:810 +#: ../../library/functions.rst:1052 msgid "Grouping digits with underscores as in code literals is allowed." msgstr "可以使用底線將程式碼文字中的數字進行分組。" -#: ../../library/functions.rst:448 +#: ../../library/functions.rst:450 msgid "" -"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :" -"meth:`~object.__float__` are not defined." +"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` " +"and :meth:`~object.__float__` are not defined." msgstr "" "如果 :meth:`~object.__complex__` 和 :meth:`~object.__float__` 未定義,則會回" "退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:455 +#: ../../library/functions.rst:454 +msgid "" +"Passing a complex number as the *real* or *imag* argument is now deprecated; " +"it should only be passed as a single positional argument." +msgstr "" + +#: ../../library/functions.rst:461 msgid "" "This is a relative of :func:`setattr`. The arguments are an object and a " "string. The string must be the name of one of the object's attributes. The " @@ -1048,7 +1062,7 @@ msgstr "" "'foobar')`` 等價於 ``del x.foobar``。*name* 不必是個 Python 識別符 " "(identifier)(請見 :func:`setattr`)。" -#: ../../library/functions.rst:468 +#: ../../library/functions.rst:474 msgid "" "Create a new dictionary. The :class:`dict` object is the dictionary class. " "See :class:`dict` and :ref:`typesmapping` for documentation about this class." @@ -1056,15 +1070,15 @@ msgstr "" "建立一個新的 dictionary(字典)。:class:`dict` 物件是一個 dictionary class。" "參見 :class:`dict` 和 :ref:`typesmapping` 來瞭解這個 class。" -#: ../../library/functions.rst:471 +#: ../../library/functions.rst:477 msgid "" -"For other containers see the built-in :class:`list`, :class:`set`, and :" -"class:`tuple` classes, as well as the :mod:`collections` module." +"For other containers see the built-in :class:`list`, :class:`set`, " +"and :class:`tuple` classes, as well as the :mod:`collections` module." msgstr "" "其他容器型別,請參見內建的 :class:`list`、:class:`set` 和 :class:`tuple` " "class,以及 :mod:`collections` module。" -#: ../../library/functions.rst:478 +#: ../../library/functions.rst:484 msgid "" "Without arguments, return the list of names in the current local scope. " "With an argument, attempt to return a list of valid attributes for that " @@ -1073,32 +1087,32 @@ msgstr "" "如果沒有引數,則回傳目前區域作用域 (local scope) 中的名稱列表。如果有引數,它" "會嘗試回傳該物件的有效屬性列表。" -#: ../../library/functions.rst:481 +#: ../../library/functions.rst:487 msgid "" "If the object has a method named :meth:`~object.__dir__`, this method will " "be called and must return the list of attributes. This allows objects that " -"implement a custom :func:`~object.__getattr__` or :func:`~object." -"__getattribute__` function to customize the way :func:`dir` reports their " -"attributes." +"implement a custom :func:`~object.__getattr__` " +"or :func:`~object.__getattribute__` function to customize the " +"way :func:`dir` reports their attributes." msgstr "" "如果物件有一個名為 :meth:`~object.__dir__` 的 method,那麼該 method 將被呼" "叫,並且必須回傳一個屬性列表。這允許實現自定義 :func:`~object.__getattr__` " "或 :func:`~object.__getattribute__` 函式的物件能夠自定義 :func:`dir` 來報告它" "們的屬性。" -#: ../../library/functions.rst:488 +#: ../../library/functions.rst:494 msgid "" "If the object does not provide :meth:`~object.__dir__`, the function tries " "its best to gather information from the object's :attr:`~object.__dict__` " "attribute, if defined, and from its type object. The resulting list is not " -"necessarily complete and may be inaccurate when the object has a custom :" -"func:`~object.__getattr__`." +"necessarily complete and may be inaccurate when the object has a " +"custom :func:`~object.__getattr__`." msgstr "" -"如果物件不提供 :meth:`~object.__dir__`,這個函式會嘗試從物件已定義的 :attr:" -"`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的,如果物件有" -"自定義 :func:`~object.__getattr__`,那結果可能不準確。" +"如果物件不提供 :meth:`~object.__dir__`,這個函式會嘗試從物件已定義" +"的 :attr:`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的," +"如果物件有自定義 :func:`~object.__getattr__`,那結果可能不準確。" -#: ../../library/functions.rst:494 +#: ../../library/functions.rst:500 msgid "" "The default :func:`dir` mechanism behaves differently with different types " "of objects, as it attempts to produce the most relevant, rather than " @@ -1107,13 +1121,13 @@ msgstr "" "預設的 :func:`dir` 機制對不同型別的物件有不同行為,它會試圖回傳最相關而非最完" "整的資訊:" -#: ../../library/functions.rst:498 +#: ../../library/functions.rst:504 msgid "" "If the object is a module object, the list contains the names of the " "module's attributes." msgstr "如果物件是 module 物件,則列表包含 module 的屬性名稱。" -#: ../../library/functions.rst:501 +#: ../../library/functions.rst:507 msgid "" "If the object is a type or class object, the list contains the names of its " "attributes, and recursively of the attributes of its bases." @@ -1121,7 +1135,7 @@ msgstr "" "如果物件是型別或 class 物件,則列表包含它們的屬性名稱,並且遞迴查詢其基礎的所" "有屬性。" -#: ../../library/functions.rst:504 +#: ../../library/functions.rst:510 msgid "" "Otherwise, the list contains the object's attributes' names, the names of " "its class's attributes, and recursively of the attributes of its class's " @@ -1130,11 +1144,11 @@ msgstr "" "否則,包含物件的屬性名稱列表、它的 class 屬性名稱,並且遞迴查詢它的 class 的" "所有基礎 class 的屬性。" -#: ../../library/functions.rst:508 +#: ../../library/functions.rst:514 msgid "The resulting list is sorted alphabetically. For example:" msgstr "回傳的列表按字母表排序,例如:" -#: ../../library/functions.rst:528 +#: ../../library/functions.rst:534 msgid "" "Because :func:`dir` is supplied primarily as a convenience for use at an " "interactive prompt, it tries to supply an interesting set of names more than " @@ -1147,42 +1161,42 @@ msgstr "" "版本之間改變。例如,當引數是一個 class 時,metaclass 的屬性不包含在結果列表" "中。" -#: ../../library/functions.rst:538 +#: ../../library/functions.rst:544 msgid "" "Take two (non-complex) numbers as arguments and return a pair of numbers " "consisting of their quotient and remainder when using integer division. " "With mixed operand types, the rules for binary arithmetic operators apply. " "For integers, the result is the same as ``(a // b, a % b)``. For floating-" -"point numbers the result is ``(q, a % b)``, where *q* is usually ``math." -"floor(a / b)`` but may be 1 less than that. In any case ``q * b + a % b`` " -"is very close to *a*, if ``a % b`` is non-zero it has the same sign as *b*, " -"and ``0 <= abs(a % b) < abs(b)``." +"point numbers the result is ``(q, a % b)``, where *q* is usually " +"``math.floor(a / b)`` but may be 1 less than that. In any case ``q * b + a " +"% b`` is very close to *a*, if ``a % b`` is non-zero it has the same sign as " +"*b*, and ``0 <= abs(a % b) < abs(b)``." msgstr "" "它將兩個(非複數)數字作為引數,並在執行整數除法時回傳一對商和餘數。對於混合" "運算元型別,適用二進位算術運算子的規則。對於整數,運算結果和 ``(a // b, a % " -"b)`` 一致。對於浮點數,運算結果是 ``(q, a % b)``,*q* 通常是 ``math." -"floor(a / b)`` 但可能會比 1 小。在任何情況下,``q * b + a % b`` 和 *a* 基本相" -"等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % b) < " -"abs(b)``。" +"b)`` 一致。對於浮點數,運算結果是 ``(q, a % b)``,*q* 通常是 " +"``math.floor(a / b)`` 但可能會比 1 小。在任何情況下,``q * b + a % b`` 和 " +"*a* 基本相等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % " +"b) < abs(b)``。" -#: ../../library/functions.rst:550 +#: ../../library/functions.rst:556 msgid "" -"Return an enumerate object. *iterable* must be a sequence, an :term:" -"`iterator`, or some other object which supports iteration. The :meth:" -"`~iterator.__next__` method of the iterator returned by :func:`enumerate` " -"returns a tuple containing a count (from *start* which defaults to 0) and " -"the values obtained from iterating over *iterable*." +"Return an enumerate object. *iterable* must be a sequence, " +"an :term:`iterator`, or some other object which supports iteration. " +"The :meth:`~iterator.__next__` method of the iterator returned " +"by :func:`enumerate` returns a tuple containing a count (from *start* which " +"defaults to 0) and the values obtained from iterating over *iterable*." msgstr "" "回傳一個列舉 (enumerate) 物件。*iterable* 必須是一個序列、:term:`iterator` 或" -"其他支援疊代的物件。:func:`enumerate` 回傳之 iterator 的 :meth:`~iterator." -"__next__` method 回傳一個 tuple(元組),裡面包含一個計數值(從 *start* 開" -"始,預設為 0)和透過疊代 *iterable* 獲得的值。" +"其他支援疊代的物件。:func:`enumerate` 回傳之 iterator " +"的 :meth:`~iterator.__next__` method 回傳一個 tuple(元組),裡面包含一個計數" +"值(從 *start* 開始,預設為 0)和透過疊代 *iterable* 獲得的值。" -#: ../../library/functions.rst:562 +#: ../../library/functions.rst:568 msgid "Equivalent to::" msgstr "等價於: ::" -#: ../../library/functions.rst:564 +#: ../../library/functions.rst:570 msgid "" "def enumerate(iterable, start=0):\n" " n = start\n" @@ -1200,15 +1214,15 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/functions.rst:574 +#: ../../library/functions.rst:580 msgid "A Python expression." msgstr "" -#: ../../library/functions.rst:578 +#: ../../library/functions.rst:584 msgid "The global namespace (default: ``None``)." msgstr "" -#: ../../library/functions.rst:582 +#: ../../library/functions.rst:588 msgid "The local namespace (default: ``None``)." msgstr "" @@ -1216,7 +1230,7 @@ msgstr "" msgid "Returns" msgstr "" -#: ../../library/functions.rst:586 +#: ../../library/functions.rst:592 msgid "The result of the evaluated expression." msgstr "" @@ -1224,17 +1238,17 @@ msgstr "" msgid "raises" msgstr "引發" -#: ../../library/functions.rst:587 +#: ../../library/functions.rst:593 msgid "Syntax errors are reported as exceptions." msgstr "" -#: ../../library/functions.rst:591 ../../library/functions.rst:652 +#: ../../library/functions.rst:597 ../../library/functions.rst:658 msgid "" "This function executes arbitrary code. Calling it with user-supplied input " "may lead to security vulnerabilities." msgstr "" -#: ../../library/functions.rst:594 +#: ../../library/functions.rst:600 msgid "" "The *expression* argument is parsed and evaluated as a Python expression " "(technically speaking, a condition list) using the *globals* and *locals* " @@ -1243,14 +1257,14 @@ msgid "" "reference to the dictionary of the built-in module :mod:`builtins` is " "inserted under that key before *expression* is parsed. That way you can " "control what builtins are available to the executed code by inserting your " -"own ``__builtins__`` dictionary into *globals* before passing it to :func:" -"`eval`. If the *locals* mapping is omitted it defaults to the *globals* " -"dictionary. If both mappings are omitted, the expression is executed with " -"the *globals* and *locals* in the environment where :func:`eval` is called. " -"Note, *eval()* will only have access to the :term:`nested scopes ` (non-locals) in the enclosing environment if they are already " -"referenced in the scope that is calling :func:`eval` (e.g. via a :keyword:" -"`nonlocal` statement)." +"own ``__builtins__`` dictionary into *globals* before passing it " +"to :func:`eval`. If the *locals* mapping is omitted it defaults to the " +"*globals* dictionary. If both mappings are omitted, the expression is " +"executed with the *globals* and *locals* in the environment " +"where :func:`eval` is called. Note, *eval()* will only have access to " +"the :term:`nested scopes ` (non-locals) in the enclosing " +"environment if they are already referenced in the scope that is " +"calling :func:`eval` (e.g. via a :keyword:`nonlocal` statement)." msgstr "" "*expression* 引數會被視為一條 Python 運算式(技術上而言,是條件列表)來剖析及" "求值,而 *globals* 和 *locals* 對映分別用作全域和區域命名空間。如果 " @@ -1258,17 +1272,17 @@ msgstr "" "析之前,將為該鍵插入對內建 :mod:`builtins` module dictionary 的引用。這麼一" "來,在將 ``__builtins__`` dictionary 傳入 :func:`eval` 之前,你可以透過將它插" "入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 對映被省略," -"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以在 :func:" -"`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意,*eval()* 在" -"封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-" -"locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透過 :keyword:" -"`nonlocal` 陳述式)。" +"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以" +"在 :func:`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意," +"*eval()* 在封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透" +"過 :keyword:`nonlocal` 陳述式)。" -#: ../../library/functions.rst:610 +#: ../../library/functions.rst:616 msgid "Example:" msgstr "範例:" -#: ../../library/functions.rst:616 +#: ../../library/functions.rst:622 msgid "" "This function can also be used to execute arbitrary code objects (such as " "those created by :func:`compile`). In this case, pass a code object instead " @@ -1279,7 +1293,7 @@ msgstr "" "情況下,傳入的引數是程式碼物件而不是字串。如果編譯該物件時的 *mode* 引數是 " "``'exec'``,那麼 :func:`eval` 回傳值為 ``None``。" -#: ../../library/functions.rst:621 +#: ../../library/functions.rst:627 msgid "" "Hints: dynamic execution of statements is supported by the :func:`exec` " "function. The :func:`globals` and :func:`locals` functions return the " @@ -1287,16 +1301,16 @@ msgid "" "pass around for use by :func:`eval` or :func:`exec`." msgstr "" "提示::func:`exec` 函式支援動態執行陳述式。:func:`globals` 和 :func:`locals` " -"函式分別回傳目前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" -"`eval` 或 :func:`exec` 可能會方便許多。" +"函式分別回傳目前的全域性和局部性 dictionary,它們對於將引數傳遞" +"給 :func:`eval` 或 :func:`exec` 可能會方便許多。" -#: ../../library/functions.rst:626 +#: ../../library/functions.rst:632 msgid "" "If the given source is a string, then leading and trailing spaces and tabs " "are stripped." msgstr "如果給定來源是一個字串,那麼其前後的空格和定位字元會被移除。" -#: ../../library/functions.rst:629 +#: ../../library/functions.rst:635 msgid "" "See :func:`ast.literal_eval` for a function that can safely evaluate strings " "with expressions containing only literals." @@ -1304,8 +1318,8 @@ msgstr "" "另外可以參閱 :func:`ast.literal_eval`,該函式可以安全執行僅包含文字的運算式字" "串。" -#: ../../library/functions.rst:632 ../../library/functions.rst:634 -#: ../../library/functions.rst:694 ../../library/functions.rst:696 +#: ../../library/functions.rst:638 ../../library/functions.rst:640 +#: ../../library/functions.rst:700 ../../library/functions.rst:702 msgid "" "Raises an :ref:`auditing event ` ``exec`` with the code object as " "the argument. Code compilation events may also be raised." @@ -1313,37 +1327,37 @@ msgstr "" "引發一個附帶程式碼物件為引數的\\ :ref:`稽核事件 ` ``exec``。也可能" "會引發程式碼編譯事件。" -#: ../../library/functions.rst:639 ../../library/functions.rst:716 +#: ../../library/functions.rst:645 ../../library/functions.rst:722 msgid "The *globals* and *locals* arguments can now be passed as keywords." msgstr "" -#: ../../library/functions.rst:643 ../../library/functions.rst:720 +#: ../../library/functions.rst:649 ../../library/functions.rst:726 msgid "" "The semantics of the default *locals* namespace have been adjusted as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:655 +#: ../../library/functions.rst:661 msgid "" "This function supports dynamic execution of Python code. *source* must be " "either a string or a code object. If it is a string, the string is parsed " "as a suite of Python statements which is then executed (unless a syntax " "error occurs). [#]_ If it is a code object, it is simply executed. In all " "cases, the code that's executed is expected to be valid as file input (see " -"the section :ref:`file-input` in the Reference Manual). Be aware that the :" -"keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements may " -"not be used outside of function definitions even within the context of code " -"passed to the :func:`exec` function. The return value is ``None``." +"the section :ref:`file-input` in the Reference Manual). Be aware that " +"the :keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements " +"may not be used outside of function definitions even within the context of " +"code passed to the :func:`exec` function. The return value is ``None``." msgstr "" "這個函式支援動態執行 Python 程式碼。*source* 必須是字串或者程式碼物件。如果是" "字串,那麼該字串將被剖析為一系列 Python 陳述式並執行(除非發生語法錯誤)。" "[#]_ 如果是程式碼物件,它將被直接執行。無論哪種情況,被執行的程式碼都需要和檔" "案輸入一樣是有效的(可參閱語言參考手冊中關於\\ :ref:`file-input`\\ 的章節)。" -"請注意,即使在傳遞給 :func:`exec` 函式的程式碼的上下文中,:keyword:" -"`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使" -"用。該函式回傳值是 ``None``。" +"請注意,即使在傳遞給 :func:`exec` 函式的程式碼的上下文" +"中,:keyword:`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在" +"函式之外使用。該函式回傳值是 ``None``。" -#: ../../library/functions.rst:666 +#: ../../library/functions.rst:672 msgid "" "In all cases, if the optional parts are omitted, the code is executed in the " "current scope. If only *globals* is provided, it must be a dictionary (and " @@ -1359,7 +1373,7 @@ msgstr "" "用作全域和區域變數。如果提供了 *locals*,則它可以是任何對映物件。請記住在 " "module 層級中全域和區域變數是相同的 dictionary。" -#: ../../library/functions.rst:676 +#: ../../library/functions.rst:682 msgid "" "When ``exec`` gets two separate objects as *globals* and *locals*, the code " "will be executed as if it were embedded in a class definition. This means " @@ -1368,12 +1382,12 @@ msgid "" "are treated as class variables in a class definition)." msgstr "" -#: ../../library/functions.rst:682 +#: ../../library/functions.rst:688 msgid "" "If the *globals* dictionary does not contain a value for the key " -"``__builtins__``, a reference to the dictionary of the built-in module :mod:" -"`builtins` is inserted under that key. That way you can control what " -"builtins are available to the executed code by inserting your own " +"``__builtins__``, a reference to the dictionary of the built-in " +"module :mod:`builtins` is inserted under that key. That way you can control " +"what builtins are available to the executed code by inserting your own " "``__builtins__`` dictionary into *globals* before passing it to :func:`exec`." msgstr "" "如果 *globals* dictionary 不包含 ``__builtins__`` 鍵值,則將為該鍵插入對內" @@ -1381,7 +1395,7 @@ msgstr "" "dictionary 傳入 :func:`exec` 之前,你可以透過將它插入 *globals* 來控制你需要" "哪些內建函式來執行程式碼。" -#: ../../library/functions.rst:688 +#: ../../library/functions.rst:694 msgid "" "The *closure* argument specifies a closure--a tuple of cellvars. It's only " "valid when the *object* is a code object containing :term:`free (closure) " @@ -1393,7 +1407,7 @@ msgstr "" "variables) ` 的程式碼物件時,它才有效。Tuple 的長度必須與程" "式碼物件的 :attr:`~codeobject.co_freevars` 屬性完全匹配。" -#: ../../library/functions.rst:701 +#: ../../library/functions.rst:707 msgid "" "The built-in functions :func:`globals` and :func:`locals` return the current " "global and local namespace, respectively, which may be useful to pass around " @@ -1402,21 +1416,21 @@ msgstr "" "內建 :func:`globals` 和 :func:`locals` 函式各自回傳目前的全域和區域命名空間," "因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數以供後續使用。" -#: ../../library/functions.rst:707 +#: ../../library/functions.rst:713 msgid "" "The default *locals* act as described for function :func:`locals` below. " "Pass an explicit *locals* dictionary if you need to see effects of the code " "on *locals* after function :func:`exec` returns." msgstr "" -"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想在 :" -"func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 *locals* " -"dictionary 。" +"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想" +"在 :func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 " +"*locals* dictionary 。" -#: ../../library/functions.rst:711 +#: ../../library/functions.rst:717 msgid "Added the *closure* parameter." msgstr "增加了 *closure* 參數。" -#: ../../library/functions.rst:726 +#: ../../library/functions.rst:732 msgid "" "Construct an iterator from those elements of *iterable* for which *function* " "is true. *iterable* may be either a sequence, a container which supports " @@ -1428,7 +1442,7 @@ msgstr "" "*function* 是 ``None``,則會假設它是一個識別性函式,即 *iterable* 中所有假值" "元素會被移除。" -#: ../../library/functions.rst:732 +#: ../../library/functions.rst:738 msgid "" "Note that ``filter(function, iterable)`` is equivalent to the generator " "expression ``(item for item in iterable if function(item))`` if function is " @@ -1439,7 +1453,7 @@ msgstr "" "是 ``None`` 的時候為 ``(item for item in iterable if function(item))``;" "function 是 ``None`` 的時候為 ``(item for item in iterable if item)``。" -#: ../../library/functions.rst:737 +#: ../../library/functions.rst:743 msgid "" "See :func:`itertools.filterfalse` for the complementary function that " "returns elements of *iterable* for which *function* is false." @@ -1447,11 +1461,11 @@ msgstr "" "請參閱 :func:`itertools.filterfalse`,只有 *function* 為 false 時才選取 " "*iterable* 中元素的互補函式。" -#: ../../library/functions.rst:748 +#: ../../library/functions.rst:754 msgid "Return a floating-point number constructed from a number or a string." msgstr "回傳從數字或字串生成的浮點數。" -#: ../../library/functions.rst:752 +#: ../../library/functions.rst:758 msgid "" ">>> float('+1.23')\n" "1.23\n" @@ -1475,7 +1489,7 @@ msgstr "" ">>> float('-Infinity')\n" "-inf" -#: ../../library/functions.rst:765 +#: ../../library/functions.rst:771 msgid "" "If the argument is a string, it should contain a decimal number, optionally " "preceded by a sign, and optionally embedded in whitespace. The optional " @@ -1490,7 +1504,7 @@ msgstr "" "數也可以是 NaN(非數字)或正負無窮大的字串。確切地說,除去首尾的空格後,輸入" "必須遵循以下語法中 :token:`~float:floatvalue` 的生成規則:" -#: ../../library/functions.rst:786 +#: ../../library/functions.rst:792 msgid "" "Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", " "and \"iNfINity\" are all acceptable spellings for positive infinity." @@ -1498,7 +1512,7 @@ msgstr "" "字母大小寫不影響,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表" "示正無窮大。" -#: ../../library/functions.rst:789 +#: ../../library/functions.rst:795 msgid "" "Otherwise, if the argument is an integer or a floating-point number, a " "floating-point number with the same value (within Python's floating-point " @@ -1508,31 +1522,36 @@ msgstr "" "否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的" "浮點數。如果引數在 Python 浮點精度範圍外,則會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:794 +#: ../../library/functions.rst:800 msgid "" -"For a general Python object ``x``, ``float(x)`` delegates to ``x." -"__float__()``. If :meth:`~object.__float__` is not defined then it falls " -"back to :meth:`~object.__index__`." +"For a general Python object ``x``, ``float(x)`` delegates to " +"``x.__float__()``. If :meth:`~object.__float__` is not defined then it " +"falls back to :meth:`~object.__index__`." msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" "定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:798 +#: ../../library/functions.rst:804 +msgid "" +"See also :meth:`float.from_number` which only accepts a numeric argument." +msgstr "" + +#: ../../library/functions.rst:806 msgid "If no argument is given, ``0.0`` is returned." msgstr "如果沒有引數,則回傳 ``0.0``。" -#: ../../library/functions.rst:800 +#: ../../library/functions.rst:808 msgid "The float type is described in :ref:`typesnumeric`." msgstr ":ref:`typesnumeric` 描述了浮點數型別。" -#: ../../library/functions.rst:808 +#: ../../library/functions.rst:816 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not " "defined." msgstr "" "如果 :meth:`~object.__float__` 未定義,則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:818 +#: ../../library/functions.rst:826 msgid "" "Convert a *value* to a \"formatted\" representation, as controlled by " "*format_spec*. The interpretation of *format_spec* will depend on the type " @@ -1540,10 +1559,10 @@ msgid "" "is used by most built-in types: :ref:`formatspec`." msgstr "" "將 *value* 轉換為 *format_spec* 控制的 \"格式化\" 表示。*format_spec* 的解釋" -"取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" -"`formatspec`。" +"取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語" +"法::ref:`formatspec`。" -#: ../../library/functions.rst:823 +#: ../../library/functions.rst:831 msgid "" "The default *format_spec* is an empty string which usually gives the same " "effect as calling :func:`str(value) `." @@ -1551,47 +1570,48 @@ msgstr "" "預設的 *format_spec* 是一個空字串,它通常和呼叫 :func:`str(value) ` 的效" "果相同。" -#: ../../library/functions.rst:826 +#: ../../library/functions.rst:834 msgid "" -"A call to ``format(value, format_spec)`` is translated to ``type(value)." -"__format__(value, format_spec)`` which bypasses the instance dictionary when " -"searching for the value's :meth:`~object.__format__` method. A :exc:" -"`TypeError` exception is raised if the method search reaches :mod:`object` " -"and the *format_spec* is non-empty, or if either the *format_spec* or the " -"return value are not strings." +"A call to ``format(value, format_spec)`` is translated to " +"``type(value).__format__(value, format_spec)`` which bypasses the instance " +"dictionary when searching for the value's :meth:`~object.__format__` method. " +"A :exc:`TypeError` exception is raised if the method search " +"reaches :mod:`object` and the *format_spec* is non-empty, or if either the " +"*format_spec* or the return value are not strings." msgstr "" "呼叫 ``format(value, format_spec)`` 會轉換成 ``type(value).__format__(value, " "format_spec)``,當搜尋 value 的 :meth:`~object.__format__` method 時,會忽略" "實例中的字典。如果搜尋到 :mod:`object` 這個 method 但 *format_spec* 不為空," "或是 *format_spec* 或回傳值不是字串,則會引發 :exc:`TypeError`。" -#: ../../library/functions.rst:833 +#: ../../library/functions.rst:841 msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." msgstr "" -"當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" -"exc:`TypeError`。" +"當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引" +"發 :exc:`TypeError`。" -#: ../../library/functions.rst:842 +#: ../../library/functions.rst:850 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " -"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" -"ref:`types-set` for documentation about this class." +"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` " +"and :ref:`types-set` for documentation about this class." msgstr "" "回傳一個新的 :class:`frozenset` 物件,它包含選擇性引數 *iterable* 中的元素。" -"``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" -"`frozenset` 和 :ref:`types-set`。" +"``frozenset`` 是一個內建的 class。有關此 class 的文件,請參" +"閱 :class:`frozenset` 和 :ref:`types-set`。" -#: ../../library/functions.rst:846 +#: ../../library/functions.rst:854 msgid "" -"For other containers see the built-in :class:`set`, :class:`list`, :class:" -"`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." +"For other containers see the built-" +"in :class:`set`, :class:`list`, :class:`tuple`, and :class:`dict` classes, " +"as well as the :mod:`collections` module." msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" -#: ../../library/functions.rst:854 +#: ../../library/functions.rst:862 msgid "" "Return the value of the named attribute of *object*. *name* must be a " "string. If the string is the name of one of the object's attributes, the " @@ -1602,22 +1622,22 @@ msgid "" msgstr "" "回傳 *object* 之具名屬性的值。*name* 必須是字串。如果該字串是物件屬性之一的名" "稱,則回傳該屬性的值。例如,``getattr(x, 'foobar')`` 等同於 ``x.foobar``。如" -"果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則引發 :exc:" -"`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" -"`setattr`)。" +"果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則引" +"發 :exc:`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請" +"見 :func:`setattr`)。" -#: ../../library/functions.rst:863 +#: ../../library/functions.rst:871 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " -"with two leading underscores) name in order to retrieve it with :func:" -"`getattr`." +"with two leading underscores) name in order to retrieve it " +"with :func:`getattr`." msgstr "" "由於\\ :ref:`私有名稱改編 (private name mangling) ` 是" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" "使用 :func:`getattr` 來取得它。" -#: ../../library/functions.rst:871 +#: ../../library/functions.rst:879 msgid "" "Return the dictionary implementing the current module namespace. For code " "within functions, this is set when the function is defined and remains the " @@ -1626,7 +1646,7 @@ msgstr "" "回傳代表目前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" "函式時設定且不論該函式是在何處呼叫都會保持相同。" -#: ../../library/functions.rst:878 +#: ../../library/functions.rst:886 msgid "" "The arguments are an object and a string. The result is ``True`` if the " "string is the name of one of the object's attributes, ``False`` if not. " @@ -1637,7 +1657,7 @@ msgstr "" "則回傳 ``False``。(此功能是透過呼叫 ``getattr(object, name)`` 並檢查是否引" "發 :exc:`AttributeError` 來實作的。)" -#: ../../library/functions.rst:886 +#: ../../library/functions.rst:894 msgid "" "Return the hash value of the object (if it has one). Hash values are " "integers. They are used to quickly compare dictionary keys during a " @@ -1648,15 +1668,16 @@ msgstr "" "時用來快速比較 dictionary 的鍵。相同大小的數字數值有相同的雜湊值(即使它們型" "別不同,如 1 和 1.0)。" -#: ../../library/functions.rst:893 +#: ../../library/functions.rst:901 msgid "" -"For objects with custom :meth:`~object.__hash__` methods, note that :func:" -"`hash` truncates the return value based on the bit width of the host machine." +"For objects with custom :meth:`~object.__hash__` methods, note " +"that :func:`hash` truncates the return value based on the bit width of the " +"host machine." msgstr "" "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" "運行機器的位元長度來截斷回傳值。" -#: ../../library/functions.rst:900 +#: ../../library/functions.rst:908 msgid "" "Invoke the built-in help system. (This function is intended for interactive " "use.) If no argument is given, the interactive help system starts on the " @@ -1670,7 +1691,7 @@ msgstr "" "關鍵字或說明文件主題中搜尋該字串,並在控制台上列印幫助資訊。如果引數是其他任" "意物件,則會生成該物件的幫助頁。" -#: ../../library/functions.rst:907 +#: ../../library/functions.rst:915 msgid "" "Note that if a slash(/) appears in the parameter list of a function when " "invoking :func:`help`, it means that the parameters prior to the slash are " @@ -1681,12 +1702,12 @@ msgstr "" "前面的參數是僅限位置 (positional-only) 參數。有關更多資訊,請參閱\\ :ref:`常" "見問答集中的僅限位置參數條目 `。" -#: ../../library/functions.rst:912 +#: ../../library/functions.rst:920 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." msgstr "此函式會被 :mod:`site` module 加入到內建命名空間。" -#: ../../library/functions.rst:914 +#: ../../library/functions.rst:922 msgid "" "Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " "for callables are now more comprehensive and consistent." @@ -1694,17 +1715,17 @@ msgstr "" "對於 :mod:`pydoc` 和 :mod:`inspect` 的變更,使得可呼叫物件回報的的簽名 " "(signature) 更加全面和一致。" -#: ../../library/functions.rst:921 +#: ../../library/functions.rst:929 msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " "\"0x\". If *integer* is not a Python :class:`int` object, it has to define " "an :meth:`~object.__index__` method that returns an integer. Some examples:" msgstr "" -"將整數轉換為以 \"0x\" 為前綴的小寫十六進位制字串。如果 *integer* 不是 Python :" -"class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並且回傳一" -"個整數。舉例來說:" +"將整數轉換為以 \"0x\" 為前綴的小寫十六進位制字串。如果 *integer* 不是 " +"Python :class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並" +"且回傳一個整數。舉例來說:" -#: ../../library/functions.rst:930 +#: ../../library/functions.rst:938 msgid "" "If you want to convert an integer number to an uppercase or lower " "hexadecimal string with prefix or not, you can use either of the following " @@ -1713,20 +1734,20 @@ msgstr "" "如果要將整數轉換為大寫或小寫的十六進位制字串,並可選擇有無 \"0x\" 前綴,則可" "以使用如下方法:" -#: ../../library/functions.rst:942 +#: ../../library/functions.rst:950 msgid "" "See also :func:`int` for converting a hexadecimal string to an integer using " "a base of 16." msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基數的整數。" -#: ../../library/functions.rst:947 +#: ../../library/functions.rst:955 msgid "" -"To obtain a hexadecimal string representation for a float, use the :meth:" -"`float.hex` method." +"To obtain a hexadecimal string representation for a float, use " +"the :meth:`float.hex` method." msgstr "" "如果要取得浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" -#: ../../library/functions.rst:953 +#: ../../library/functions.rst:961 msgid "" "Return the \"identity\" of an object. This is an integer which is " "guaranteed to be unique and constant for this object during its lifetime. " @@ -1736,18 +1757,18 @@ msgstr "" "回傳物件的 \"識別性\" 。該值是一個整數,在此物件的生命週期中保證是唯一且恆定" "的。兩個生命期不重疊的物件可能具有相同的 :func:`id` 值。" -#: ../../library/functions.rst:958 +#: ../../library/functions.rst:966 msgid "This is the address of the object in memory." msgstr "這是該物件在記憶體中的位址。" -#: ../../library/functions.rst:960 +#: ../../library/functions.rst:968 msgid "" "Raises an :ref:`auditing event ` ``builtins.id`` with argument " "``id``." msgstr "" "引發一個附帶引數 ``id`` 的\\ :ref:`稽核事件 ` ``builtins.id``。" -#: ../../library/functions.rst:966 +#: ../../library/functions.rst:974 msgid "" "If the *prompt* argument is present, it is written to standard output " "without a trailing newline. The function then reads a line from input, " @@ -1758,7 +1779,7 @@ msgstr "" "從輸入中讀取一行,將其轉換為字串(去除末尾的換行符)並回傳。當讀取到 EOF 時," "則引發 :exc:`EOFError`。例如: ::" -#: ../../library/functions.rst:971 +#: ../../library/functions.rst:979 msgid "" ">>> s = input('--> ')\n" "--> Monty Python's Flying Circus\n" @@ -1770,7 +1791,7 @@ msgstr "" ">>> s\n" "\"Monty Python's Flying Circus\"" -#: ../../library/functions.rst:976 +#: ../../library/functions.rst:984 msgid "" "If the :mod:`readline` module was loaded, then :func:`input` will use it to " "provide elaborate line editing and history features." @@ -1778,7 +1799,7 @@ msgstr "" "如果載入了 :mod:`readline` module,:func:`input` 將使用它來提供複雜的行編輯和" "歷史記錄功能。" -#: ../../library/functions.rst:979 ../../library/functions.rst:981 +#: ../../library/functions.rst:987 ../../library/functions.rst:989 msgid "" "Raises an :ref:`auditing event ` ``builtins.input`` with argument " "``prompt`` before reading input" @@ -1786,7 +1807,7 @@ msgstr "" "引發一個附帶讀取輸入前的引數 ``prompt`` 的\\ :ref:`稽核事件 ` " "``builtins.input``。" -#: ../../library/functions.rst:984 ../../library/functions.rst:986 +#: ../../library/functions.rst:992 ../../library/functions.rst:994 msgid "" "Raises an :ref:`auditing event ` ``builtins.input/result`` with " "the result after successfully reading input." @@ -1794,13 +1815,13 @@ msgstr "" "引發一個附帶成功讀取結果的\\ :ref:`稽核事件 ` ``builtins.input/" "result``。" -#: ../../library/functions.rst:993 +#: ../../library/functions.rst:1001 msgid "" "Return an integer object constructed from a number or a string, or return " "``0`` if no arguments are given." msgstr "" -#: ../../library/functions.rst:998 +#: ../../library/functions.rst:1006 msgid "" ">>> int(123.45)\n" "123\n" @@ -1828,12 +1849,12 @@ msgstr "" ">>> int('01110011', base=2)\n" "115" -#: ../../library/functions.rst:1013 +#: ../../library/functions.rst:1021 +#, fuzzy msgid "" -"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." -"__int__()``. If the argument defines :meth:`~object.__index__`, it returns " -"``x.__index__()``. If the argument defines :meth:`~object.__trunc__`, it " -"returns ``x.__trunc__()``. For floating-point numbers, this truncates " +"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns " +"``x.__int__()``. If the argument defines :meth:`~object.__index__`, it " +"returns ``x.__index__()``. For floating-point numbers, this truncates " "towards zero." msgstr "" "如果引數定義了 :meth:`~object.__int__`,則 ``int(x)`` 回傳 ``x.__int__()``。" @@ -1841,7 +1862,7 @@ msgstr "" "義了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數,則會向零" "的方向無條件捨去。" -#: ../../library/functions.rst:1019 +#: ../../library/functions.rst:1026 msgid "" "If the argument is not a number or if *base* is given, then it must be a " "string, :class:`bytes`, or :class:`bytearray` instance representing an " @@ -1849,12 +1870,12 @@ msgid "" "``-`` (with no space in between), have leading zeros, be surrounded by " "whitespace, and have single underscores interspersed between digits." msgstr "" -"如果引數不是數字或如果有給定 *base*,則它必須是個字串、:class:`bytes` 或 :" -"class:`bytearray` 實例,表示基數 (radix) *base* 中的整數。可選地,字串之前可" -"以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在" -"數字間有單一底線。" +"如果引數不是數字或如果有給定 *base*,則它必須是個字串、:class:`bytes` " +"或 :class:`bytearray` 實例,表示基數 (radix) *base* 中的整數。可選地,字串之" +"前可以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、" +"或在數字間有單一底線。" -#: ../../library/functions.rst:1025 +#: ../../library/functions.rst:1032 msgid "" "A base-n integer string contains digits, each representing a value from 0 to " "n-1. The values 0--9 can be represented by any Unicode decimal digit. The " @@ -1876,52 +1897,54 @@ msgstr "" "進制中的一個,所以 ``int('010', 0)`` 是非法的,但 ``int('010')`` 和 " "``int('010', 8)`` 是有效的。" -#: ../../library/functions.rst:1036 +#: ../../library/functions.rst:1043 msgid "The integer type is described in :ref:`typesnumeric`." msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" -#: ../../library/functions.rst:1038 +#: ../../library/functions.rst:1045 msgid "" -"If *base* is not an instance of :class:`int` and the *base* object has a :" -"meth:`base.__index__ ` method, that method is called to " +"If *base* is not an instance of :class:`int` and the *base* object has " +"a :meth:`base.__index__ ` method, that method is called to " "obtain an integer for the base. Previous versions used :meth:`base.__int__ " "` instead of :meth:`base.__index__ `." msgstr "" "如果 *base* 不是 :class:`int` 的實例,但 *base* 物件有 :meth:`base.__index__ " "` method,則會呼叫該 method 來取得此進位制所需的整數。以前" -"的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." -"__index__ `。" +"的版本使用 :meth:`base.__int__ ` 而不" +"是 :meth:`base.__index__ `。" -#: ../../library/functions.rst:1048 +#: ../../library/functions.rst:1055 msgid "The first parameter is now positional-only." msgstr "第一個參數為僅限位置參數。" -#: ../../library/functions.rst:1051 +#: ../../library/functions.rst:1058 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not " "defined." msgstr "" "如果未定義 :meth:`~object.__int__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:1054 -msgid "The delegation to :meth:`~object.__trunc__` is deprecated." -msgstr "對 :meth:`~object.__trunc__` 的委派已棄用。" - -#: ../../library/functions.rst:1057 +#: ../../library/functions.rst:1061 msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " "limit is exceeded while converting a string to an :class:`int` or when " -"converting an :class:`int` into a string would exceed the limit. See the :" -"ref:`integer string conversion length limitation ` " +"converting an :class:`int` into a string would exceed the limit. See " +"the :ref:`integer string conversion length limitation ` " "documentation." msgstr "" ":class:`int` 的字串輸入和字串表示法可以被限制,以避免阻斷服務攻擊 (denial of " -"service attack)。在字串 *x* 轉換為 :class:`int` 時已超出限制,或是在 :class:" -"`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" -"數字串轉換的長度限制 `\\ 說明文件。" +"service attack)。在字串 *x* 轉換為 :class:`int` 時已超出限制,或是" +"在 :class:`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱" +"\\ :ref:`整數字串轉換的長度限制 `\\ 說明文件。" -#: ../../library/functions.rst:1068 +#: ../../library/functions.rst:1069 +#, fuzzy +msgid "" +":func:`int` no longer delegates to the :meth:`~object.__trunc__` method." +msgstr "對 :meth:`~object.__trunc__` 的委派已棄用。" + +#: ../../library/functions.rst:1074 msgid "" "Return ``True`` if the *object* argument is an instance of the *classinfo* " "argument, or of a (direct, indirect, or :term:`virtual `)subclass 的實例,則回傳 ``True``。如果 " -"*object* 不是給定型別的物件,函式始終回傳 ``False``。如果 *classinfo* 是包含" -"物件型別的 tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-union`," -"若 *object* 是其中的任何一個物件的實例則回傳 ``True``。如果 *classinfo* 既不" -"是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會引發 :exc:`TypeError` 異" -"常。若是先前檢查已經成功,:exc:`TypeError` 可能不會再因為不合格的型別而被引" -"發。" - -#: ../../library/functions.rst:1079 ../../library/functions.rst:1093 +"types. If *classinfo* is not a type or tuple of types and such tuples, " +"a :exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised " +"for an invalid type if an earlier check succeeds." +msgstr "" +"如果 *object* 引數是 *classinfo* 引數的實例,或者是(直接、間接" +"或 :term:`virtual `)subclass 的實例,則回傳 ``True``。" +"如果 *object* 不是給定型別的物件,函式始終回傳 ``False``。如果 *classinfo* 是" +"包含物件型別的 tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-" +"union`,若 *object* 是其中的任何一個物件的實例則回傳 ``True``。如果 " +"*classinfo* 既不是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會引" +"發 :exc:`TypeError` 異常。若是先前檢查已經成功,:exc:`TypeError` 可能不會再因" +"為不合格的型別而被引發。" + +#: ../../library/functions.rst:1085 ../../library/functions.rst:1099 msgid "*classinfo* can be a :ref:`types-union`." msgstr "*classinfo* 可以是一個 :ref:`types-union`。" -#: ../../library/functions.rst:1085 +#: ../../library/functions.rst:1091 msgid "" -"Return ``True`` if *class* is a subclass (direct, indirect, or :term:" -"`virtual `) of *classinfo*. A class is considered a " -"subclass of itself. *classinfo* may be a tuple of class objects (or " -"recursively, other such tuples) or a :ref:`types-union`, in which case " +"Return ``True`` if *class* is a subclass (direct, indirect, " +"or :term:`virtual `) of *classinfo*. A class is " +"considered a subclass of itself. *classinfo* may be a tuple of class objects " +"(or recursively, other such tuples) or a :ref:`types-union`, in which case " "return ``True`` if *class* is a subclass of any entry in *classinfo*. In " "any other case, a :exc:`TypeError` exception is raised." msgstr "" "如果 *class* 是 *classinfo* 的 subclass(直接、間接或 :term:`virtual " "`),則回傳 ``True``。*classinfo* 可以是 class 物件的 " "tuple(或遞迴地其他類似 tuple)或是一個 :ref:`types-union`,此時若 *class* " -"是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" -"exc:`TypeError`。" +"是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引" +"發 :exc:`TypeError`。" -#: ../../library/functions.rst:1100 +#: ../../library/functions.rst:1106 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " "second argument, the single argument must be a collection object which " "supports the :term:`iterable` protocol (the :meth:`~object.__iter__` " -"method), or it must support the sequence protocol (the :meth:`~object." -"__getitem__` method with integer arguments starting at ``0``). If it does " -"not support either of those protocols, :exc:`TypeError` is raised. If the " -"second argument, *sentinel*, is given, then the first argument must be a " -"callable object. The iterator created in this case will call *callable* " -"with no arguments for each call to its :meth:`~iterator.__next__` method; if " -"the value returned is equal to *sentinel*, :exc:`StopIteration` will be " -"raised, otherwise the value will be returned." +"method), or it must support the sequence protocol " +"(the :meth:`~object.__getitem__` method with integer arguments starting at " +"``0``). If it does not support either of those protocols, :exc:`TypeError` " +"is raised. If the second argument, *sentinel*, is given, then the first " +"argument must be a callable object. The iterator created in this case will " +"call *callable* with no arguments for each call to " +"its :meth:`~iterator.__next__` method; if the value returned is equal to " +"*sentinel*, :exc:`StopIteration` will be raised, otherwise the value will be " +"returned." msgstr "" "回傳一個 :term:`iterator` 物件。根據是否存在第二個引數,第一個引數的意義是非" -"常不同的。如果沒有第二個引數,該單一引數必須是支援 :term:`iterable` 協定(有 :" -"meth:`~object.__iter__` method)的集合物件,或必須支援序列協定(有 :meth:" -"`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支援這些協定," -"會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼第一引數必須是可" -"呼叫的物件,這種情況下生成的 iterator,每次疊代呼叫 :meth:`~iterator." -"__next__` 時會不帶引數地呼叫 *callable*;如果回傳的結果是 *sentinel* 則引發 :" -"exc:`StopIteration`,否則回傳呼叫結果。" - -#: ../../library/functions.rst:1114 +"常不同的。如果沒有第二個引數,該單一引數必須是支援 :term:`iterable` 協定" +"(有 :meth:`~object.__iter__` method)的集合物件,或必須支援序列協定" +"(有 :meth:`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支" +"援這些協定,會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼第一引" +"數必須是可呼叫的物件,這種情況下生成的 iterator,每次疊代呼" +"叫 :meth:`~iterator.__next__` 時會不帶引數地呼叫 *callable*;如果回傳的結果" +"是 *sentinel* 則引發 :exc:`StopIteration`,否則回傳呼叫結果。" + +#: ../../library/functions.rst:1120 msgid "See also :ref:`typeiter`." msgstr "另請參閱 :ref:`typeiter`。" -#: ../../library/functions.rst:1116 +#: ../../library/functions.rst:1122 msgid "" "One useful application of the second form of :func:`iter` is to build a " "block-reader. For example, reading fixed-width blocks from a binary database " @@ -1998,7 +2022,7 @@ msgstr "" ":func:`iter` 的第二種形式有一個好用的應用,是能夠建立一個區塊閱讀器 (block-" "reader)。例如,從二進位資料庫檔案中讀取固定寬度的區塊,直到檔案的結尾: ::" -#: ../../library/functions.rst:1120 +#: ../../library/functions.rst:1126 msgid "" "from functools import partial\n" "with open('mydata.db', 'rb') as f:\n" @@ -2010,7 +2034,7 @@ msgstr "" " for block in iter(partial(f.read, 64), b''):\n" " process_block(block)" -#: ../../library/functions.rst:1128 +#: ../../library/functions.rst:1134 msgid "" "Return the length (the number of items) of an object. The argument may be a " "sequence (such as a string, bytes, tuple, list, or range) or a collection " @@ -2019,15 +2043,15 @@ msgstr "" "回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 " "range)或集合(如 dictionary、set 或 frozen set)。" -#: ../../library/functions.rst:1134 +#: ../../library/functions.rst:1140 msgid "" -"``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." -"maxsize`, such as :class:`range(2 ** 100) `." +"``len`` raises :exc:`OverflowError` on lengths larger " +"than :data:`sys.maxsize`, such as :class:`range(2 ** 100) `." msgstr "" "如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," "則 ``len`` 會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:1142 +#: ../../library/functions.rst:1148 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." @@ -2035,33 +2059,33 @@ msgstr "" "除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` " "和 :ref:`typesseq`。" -#: ../../library/functions.rst:1148 +#: ../../library/functions.rst:1154 msgid "" "Return a mapping object representing the current local symbol table, with " "variable names as the keys, and their currently bound references as the " "values." msgstr "" -#: ../../library/functions.rst:1152 +#: ../../library/functions.rst:1158 msgid "" "At module scope, as well as when using :func:`exec` or :func:`eval` with a " -"single namespace, this function returns the same namespace as :func:" -"`globals`." +"single namespace, this function returns the same namespace " +"as :func:`globals`." msgstr "" -#: ../../library/functions.rst:1156 +#: ../../library/functions.rst:1162 msgid "" "At class scope, it returns the namespace that will be passed to the " "metaclass constructor." msgstr "" -#: ../../library/functions.rst:1159 +#: ../../library/functions.rst:1165 msgid "" "When using ``exec()`` or ``eval()`` with separate local and global " "arguments, it returns the local namespace passed in to the function call." msgstr "" -#: ../../library/functions.rst:1162 +#: ../../library/functions.rst:1168 msgid "" "In all of the above cases, each call to ``locals()`` in a given frame of " "execution will return the *same* mapping object. Changes made through the " @@ -2071,7 +2095,7 @@ msgid "" "returned mapping object." msgstr "" -#: ../../library/functions.rst:1169 +#: ../../library/functions.rst:1175 msgid "" "In an :term:`optimized scope` (including functions, generators, and " "coroutines), each call to ``locals()`` instead returns a fresh dictionary " @@ -2083,7 +2107,7 @@ msgid "" "previously returned dictionaries." msgstr "" -#: ../../library/functions.rst:1178 +#: ../../library/functions.rst:1184 msgid "" "Calling ``locals()`` as part of a comprehension in a function, generator, or " "coroutine is equivalent to calling it in the containing scope, except that " @@ -2092,35 +2116,38 @@ msgid "" "function." msgstr "" -#: ../../library/functions.rst:1184 +#: ../../library/functions.rst:1190 msgid "" "Calling ``locals()`` as part of a generator expression is equivalent to " "calling it in a nested generator function." msgstr "" -#: ../../library/functions.rst:1187 +#: ../../library/functions.rst:1193 msgid "" "The behaviour of ``locals()`` in a comprehension has been updated as " "described in :pep:`709`." msgstr "" -#: ../../library/functions.rst:1191 +#: ../../library/functions.rst:1197 msgid "" "As part of :pep:`667`, the semantics of mutating the mapping objects " -"returned from this function are now defined. The behavior in :term:" -"`optimized scopes ` is now as described above. Aside from " -"being defined, the behaviour in other scopes remains unchanged from previous " -"versions." +"returned from this function are now defined. The behavior " +"in :term:`optimized scopes ` is now as described above. " +"Aside from being defined, the behaviour in other scopes remains unchanged " +"from previous versions." msgstr "" -#: ../../library/functions.rst:1201 +#: ../../library/functions.rst:1207 +#, fuzzy msgid "" "Return an iterator that applies *function* to every item of *iterable*, " "yielding the results. If additional *iterables* arguments are passed, " "*function* must take that many arguments and is applied to the items from " "all iterables in parallel. With multiple iterables, the iterator stops when " -"the shortest iterable is exhausted. For cases where the function inputs are " -"already arranged into argument tuples, see :func:`itertools.starmap`\\." +"the shortest iterable is exhausted. If *strict* is ``True`` and one of the " +"iterables is exhausted before the others, a :exc:`ValueError` is raised. For " +"cases where the function inputs are already arranged into argument tuples, " +"see :func:`itertools.starmap`." msgstr "" "產生一個將 *function* 應用於 *iterable* 中所有元素,並收集回傳結果的 " "iterator。如果傳遞了額外的 *iterables* 引數,則 *function* 必須接受相同個數的" @@ -2128,13 +2155,18 @@ msgstr "" "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," "請參閱 :func:`itertools.starmap`。" -#: ../../library/functions.rst:1213 +#: ../../library/functions.rst:1216 +#, fuzzy +msgid "Added the *strict* parameter." +msgstr "增加了 *closure* 參數。" + +#: ../../library/functions.rst:1224 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." msgstr "回傳 iterable 中最大的元素,或者回傳兩個以上的引數中最大的。" -#: ../../library/functions.rst:1216 +#: ../../library/functions.rst:1227 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The largest item in the iterable is returned. If two or more positional " @@ -2143,53 +2175,53 @@ msgstr "" "如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素" "會被回傳。如果提供了兩個或以上的位置引數,則回傳最大的位置引數。" -#: ../../library/functions.rst:1221 ../../library/functions.rst:1259 +#: ../../library/functions.rst:1232 ../../library/functions.rst:1270 msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " "*default* argument specifies an object to return if the provided iterable is " -"empty. If the iterable is empty and *default* is not provided, a :exc:" -"`ValueError` is raised." +"empty. If the iterable is empty and *default* is not provided, " +"a :exc:`ValueError` is raised." msgstr "" "這個函式有兩個選擇性的僅限關鍵字引數。*key* 引數能指定單一引數所使用的排序函" "式,如同 :meth:`list.sort` 的使用方式。*default* 引數是當 iterable 為空時回傳" -"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" -"`ValueError`。" +"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引" +"發 :exc:`ValueError`。" -#: ../../library/functions.rst:1227 +#: ../../library/functions.rst:1238 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " -"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and ``heapq." -"nlargest(1, iterable, key=keyfunc)``." +"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and " +"``heapq.nlargest(1, iterable, key=keyfunc)``." msgstr "" "如果有多個最大元素,則此函式將回傳第一個找到的。這和其他穩定排序工具如 " "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " "iterable, key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1232 ../../library/functions.rst:1270 +#: ../../library/functions.rst:1243 ../../library/functions.rst:1281 msgid "Added the *default* keyword-only parameter." msgstr "新增 *default* 僅限關鍵字參數。" -#: ../../library/functions.rst:1235 ../../library/functions.rst:1273 +#: ../../library/functions.rst:1246 ../../library/functions.rst:1284 msgid "The *key* can be ``None``." msgstr "*key* 可以為 ``None``。" -#: ../../library/functions.rst:1243 +#: ../../library/functions.rst:1254 msgid "" -"Return a \"memory view\" object created from the given argument. See :ref:" -"`typememoryview` for more information." +"Return a \"memory view\" object created from the given argument. " +"See :ref:`typememoryview` for more information." msgstr "" "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" "閱\\ :ref:`typememoryview`。" -#: ../../library/functions.rst:1251 +#: ../../library/functions.rst:1262 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." msgstr "回傳 iterable 中最小的元素,或者回傳兩個以上的引數中最小的。" -#: ../../library/functions.rst:1254 +#: ../../library/functions.rst:1265 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The smallest item in the iterable is returned. If two or more positional " @@ -2198,7 +2230,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" "被回傳。如果提供了兩個以上的位置引數,則回傳最小的位置引數。" -#: ../../library/functions.rst:1265 +#: ../../library/functions.rst:1276 msgid "" "If multiple items are minimal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2209,17 +2241,18 @@ msgstr "" "``sorted(iterable, key=keyfunc)[0]`` 和 ``heapq.nsmallest(1, iterable, " "key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1280 +#: ../../library/functions.rst:1291 msgid "" -"Retrieve the next item from the :term:`iterator` by calling its :meth:" -"`~iterator.__next__` method. If *default* is given, it is returned if the " -"iterator is exhausted, otherwise :exc:`StopIteration` is raised." +"Retrieve the next item from the :term:`iterator` by calling " +"its :meth:`~iterator.__next__` method. If *default* is given, it is " +"returned if the iterator is exhausted, otherwise :exc:`StopIteration` is " +"raised." msgstr "" "透過呼叫 :term:`iterator` 的 :meth:`~iterator.__next__` method 取得下一個元" -"素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" -"exc:`StopIteration`。" +"素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引" +"發 :exc:`StopIteration`。" -#: ../../library/functions.rst:1287 +#: ../../library/functions.rst:1298 msgid "" "This is the ultimate base class of all other classes. It has methods that " "are common to all instances of Python classes. When the constructor is " @@ -2230,7 +2263,7 @@ msgstr "" "函式被呼叫時,它會回傳一個新的沒有特徵 (featureless) 的物件。這個建構函式不接" "受任何引數。" -#: ../../library/functions.rst:1294 +#: ../../library/functions.rst:1305 msgid "" ":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, " "so you can't assign arbitrary attributes to an instance of :class:`object`." @@ -2238,18 +2271,18 @@ msgstr "" "由於 :class:`object` 實例\\ *沒有* :attr:`~object.__dict__` 屬性,因此無法將" "任意屬性賦給 :class:`object` 的實例。" -#: ../../library/functions.rst:1301 +#: ../../library/functions.rst:1312 msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " -"result is a valid Python expression. If *integer* is not a Python :class:" -"`int` object, it has to define an :meth:`~object.__index__` method that " -"returns an integer. For example:" +"result is a valid Python expression. If *integer* is not a " +"Python :class:`int` object, it has to define an :meth:`~object.__index__` " +"method that returns an integer. For example:" msgstr "" "將一個整數轉變為一個前綴為 \"0o\" 的八進位制字串。回傳結果是一個有效的 " -"Python 運算式。如果 *integer* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" -"`~object.__index__` method 回傳一個整數。舉例來說:" +"Python 運算式。如果 *integer* 不是 Python 的 :class:`int` 物件,那它需要定" +"義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" -#: ../../library/functions.rst:1311 +#: ../../library/functions.rst:1322 msgid "" "If you want to convert an integer number to an octal string either with the " "prefix \"0o\" or not, you can use either of the following ways." @@ -2257,7 +2290,7 @@ msgstr "" "如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方" "法。" -#: ../../library/functions.rst:1328 +#: ../../library/functions.rst:1339 msgid "" "Open *file* and return a corresponding :term:`file object`. If the file " "cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more " @@ -2267,7 +2300,7 @@ msgstr "" "啟,則引發 :exc:`OSError`。關於使用此函式的更多方法,請參閱\\ :ref:`tut-" "files`。" -#: ../../library/functions.rst:1332 +#: ../../library/functions.rst:1343 msgid "" "*file* is a :term:`path-like object` giving the pathname (absolute or " "relative to the current working directory) of the file to be opened or an " @@ -2280,7 +2313,7 @@ msgstr "" "器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關" "閉,除非 *closefd* 被設為 ``False``。)" -#: ../../library/functions.rst:1338 +#: ../../library/functions.rst:1349 msgid "" "*mode* is an optional string that specifies the mode in which the file is " "opened. It defaults to ``'r'`` which means open for reading in text mode. " @@ -2288,84 +2321,84 @@ msgid "" "already exists), ``'x'`` for exclusive creation, and ``'a'`` for appending " "(which on *some* Unix systems, means that *all* writes append to the end of " "the file regardless of the current seek position). In text mode, if " -"*encoding* is not specified the encoding used is platform-dependent: :func:" -"`locale.getencoding` is called to get the current locale encoding. (For " -"reading and writing raw bytes use binary mode and leave *encoding* " -"unspecified.) The available modes are:" +"*encoding* is not specified the encoding used is platform-" +"dependent: :func:`locale.getencoding` is called to get the current locale " +"encoding. (For reading and writing raw bytes use binary mode and leave " +"*encoding* unspecified.) The available modes are:" msgstr "" "*mode* 是一個選擇性字串,用於指定開啟檔案的模式。預設值是 ``'r'``,這意味著它" "以文字模式開啟並讀取。其他常見模式有:寫入 ``'w'``\\ (會捨去已經存在的檔" "案)、唯一性建立 ``'x'``、追加寫入 ``'a'``\\ (在\\ *一些* Unix 系統上,無論" "目前的檔案指標在什麼位置,*所有* 寫入都會追加到檔案末尾)。在文字模式,如果沒" -"有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼叫 :func:`locale." -"getencoding` 來取得目前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" -"式且不要指定 *encoding*。)可用的模式有:" +"有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼" +"叫 :func:`locale.getencoding` 來取得目前的本地編碼。(要讀取和寫入原始 " +"bytes,請使用二進位制模式且不要指定 *encoding*。)可用的模式有:" -#: ../../library/functions.rst:1355 +#: ../../library/functions.rst:1366 msgid "Character" msgstr "字元" -#: ../../library/functions.rst:1355 +#: ../../library/functions.rst:1366 msgid "Meaning" msgstr "意義" -#: ../../library/functions.rst:1357 +#: ../../library/functions.rst:1368 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/functions.rst:1357 +#: ../../library/functions.rst:1368 msgid "open for reading (default)" msgstr "讀取(預設)" -#: ../../library/functions.rst:1358 +#: ../../library/functions.rst:1369 msgid "``'w'``" msgstr "``'w'``" -#: ../../library/functions.rst:1358 +#: ../../library/functions.rst:1369 msgid "open for writing, truncating the file first" msgstr "寫入,會先清除檔案內容" -#: ../../library/functions.rst:1359 +#: ../../library/functions.rst:1370 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/functions.rst:1359 +#: ../../library/functions.rst:1370 msgid "open for exclusive creation, failing if the file already exists" msgstr "唯一性建立,如果文件已存在則會失敗" -#: ../../library/functions.rst:1360 +#: ../../library/functions.rst:1371 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/functions.rst:1360 +#: ../../library/functions.rst:1371 msgid "open for writing, appending to the end of file if it exists" msgstr "寫入,如果檔案存在則在其末端附加內容" -#: ../../library/functions.rst:1361 +#: ../../library/functions.rst:1372 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/functions.rst:1361 ../../library/functions.rst:1505 +#: ../../library/functions.rst:1372 ../../library/functions.rst:1516 msgid "binary mode" msgstr "二進制模式" -#: ../../library/functions.rst:1362 +#: ../../library/functions.rst:1373 msgid "``'t'``" msgstr "``'t'``" -#: ../../library/functions.rst:1362 +#: ../../library/functions.rst:1373 msgid "text mode (default)" msgstr "文字模式(預設)" -#: ../../library/functions.rst:1363 +#: ../../library/functions.rst:1374 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/functions.rst:1363 +#: ../../library/functions.rst:1374 msgid "open for updating (reading and writing)" msgstr "更新(讀取並寫入)" -#: ../../library/functions.rst:1366 +#: ../../library/functions.rst:1377 msgid "" "The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). " "Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'`` and " @@ -2375,7 +2408,7 @@ msgstr "" "``'w+b'`` 模式會開啟並清除檔案。``'r+'`` 和 ``'r+b'`` 模式會開啟且保留檔案內" "容。" -#: ../../library/functions.rst:1370 +#: ../../library/functions.rst:1381 msgid "" "As mentioned in the :ref:`io-overview`, Python distinguishes between binary " "and text I/O. Files opened in binary mode (including ``'b'`` in the *mode* " @@ -2391,7 +2424,7 @@ msgstr "" "``'t'``),檔案的內容會以 :class:`str` 回傳,其位元組已經先被解碼,使用的是取" "決於平台的編碼系統或是給定的 *encoding*。" -#: ../../library/functions.rst:1380 +#: ../../library/functions.rst:1391 msgid "" "Python doesn't depend on the underlying operating system's notion of text " "files; all the processing is done by Python itself, and is therefore " @@ -2400,7 +2433,7 @@ msgstr "" "Python 不會使用底層作業系統對於文字檔案的操作概念;所有的處理都是由 Python 獨" "自完成的,因此能獨立於不同平台。" -#: ../../library/functions.rst:1384 +#: ../../library/functions.rst:1395 msgid "" "*buffering* is an optional integer used to set the buffering policy. Pass 0 " "to switch buffering off (only allowed in binary mode), 1 to select line " @@ -2421,19 +2454,20 @@ msgstr "" "``write_through`` 旗標。若未給定 *buffering* 引數,則預設的緩衝策略會運作如" "下:" -#: ../../library/functions.rst:1394 +#: ../../library/functions.rst:1405 +#, fuzzy msgid "" "Binary files are buffered in fixed-size chunks; the size of the buffer is " -"chosen using a heuristic trying to determine the underlying device's \"block " -"size\" and falling back on :const:`io.DEFAULT_BUFFER_SIZE`. On many " -"systems, the buffer will typically be 4096 or 8192 bytes long." +"``max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)`` when the device block " +"size is available. On most systems, the buffer will typically be 128 " +"kilobytes long." msgstr "" "二進制檔案會以固定大小的區塊進行緩衝;緩衝區的大小是使用啟發式嘗試 " -"(heuristic trying) 來決定底層設備的「區塊大小」,並會回退到 :attr:`io." -"DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 8192 個位元" -"組。" +"(heuristic trying) 來決定底層設備的「區塊大小」,並會回退" +"到 :attr:`io.DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 " +"8192 個位元組。" -#: ../../library/functions.rst:1399 +#: ../../library/functions.rst:1410 msgid "" "\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " "returns ``True``) use line buffering. Other text files use the policy " @@ -2442,7 +2476,7 @@ msgstr "" "「互動式」文字檔(:meth:`~io.IOBase.isatty` 回傳 ``True`` 的檔案)會使用列緩" "衝。其他文字檔則使用上述的二進制檔案緩衝策略。" -#: ../../library/functions.rst:1403 +#: ../../library/functions.rst:1414 msgid "" "*encoding* is the name of the encoding used to decode or encode the file. " "This should only be used in text mode. The default encoding is platform " @@ -2455,20 +2489,21 @@ msgstr "" "Python 支援的任何 :term:`text encoding`\\ (文字編碼)都是可以使用的。關於支" "援的編碼系統清單,請參閱 :mod:`codecs` module。" -#: ../../library/functions.rst:1409 +#: ../../library/functions.rst:1420 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " "standard error handlers are available (listed under :ref:`error-handlers`), " -"though any error handling name that has been registered with :func:`codecs." -"register_error` is also valid. The standard names include:" +"though any error handling name that has been registered " +"with :func:`codecs.register_error` is also valid. The standard names " +"include:" msgstr "" "*errors* 是一個選擇性的字串,用於指定要如何處理編碼和解碼的錯誤——它不能在二進" "制模式下使用。有許多不同的標準錯誤處理程式(error handler,在\\ :ref:`error-" "handlers`\\ 有列出清單),不過任何已註冊到 :func:`codecs.register_error` 的錯" "誤處理程式名稱也都是有效的。標準的名稱包括:" -#: ../../library/functions.rst:1417 +#: ../../library/functions.rst:1428 msgid "" "``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " "error. The default value of ``None`` has the same effect." @@ -2476,20 +2511,20 @@ msgstr "" "``'strict'`` 如果發生編碼錯誤,則引發 :exc:`ValueError` 例外。預設值 " "``None`` 也有相同的效果。" -#: ../../library/functions.rst:1421 +#: ../../library/functions.rst:1432 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." msgstr "``'ignore'`` 忽略錯誤。請注意,忽略編碼錯誤可能導致資料遺失。" -#: ../../library/functions.rst:1424 +#: ../../library/functions.rst:1435 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." msgstr "" "``'replace'`` 會在格式不正確的資料位置插入一個替換標誌(像是 ``'?'``)。" -#: ../../library/functions.rst:1427 +#: ../../library/functions.rst:1438 msgid "" "``'surrogateescape'`` will represent any incorrect bytes as low surrogate " "code units ranging from U+DC80 to U+DCFF. These surrogate code units will " @@ -2502,7 +2537,7 @@ msgstr "" "被還原回 ``surrogateescape`` 錯誤處理程式當時所處理的那些相同位元組。這對於處" "理未知編碼方式的檔案會很好用。" -#: ../../library/functions.rst:1434 +#: ../../library/functions.rst:1445 msgid "" "``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " "not supported by the encoding are replaced with the appropriate XML " @@ -2511,7 +2546,7 @@ msgstr "" "``'xmlcharrefreplace'`` 僅在寫入檔案時可支援。編碼系統不支援的字元會被替換為" "適當的 XML 字元參考 (character reference) ``&#nnn;``。" -#: ../../library/functions.rst:1438 +#: ../../library/functions.rst:1449 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." @@ -2519,7 +2554,7 @@ msgstr "" "``'backslashreplace'`` 會用 Python 的反斜線跳脫序列 (backslashed escape " "sequence) 替換格式不正確的資料。" -#: ../../library/functions.rst:1441 +#: ../../library/functions.rst:1452 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." @@ -2527,7 +2562,7 @@ msgstr "" "``'namereplace'``\\ (也僅在寫入時支援)會將不支援的字元替換為 ``\\N{...}`` " "跳脫序列。" -#: ../../library/functions.rst:1449 +#: ../../library/functions.rst:1460 msgid "" "*newline* determines how to parse newline characters from the stream. It can " "be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " @@ -2536,7 +2571,7 @@ msgstr "" "*newline* 會決定如何剖析資料串流 (stream) 中的換行字元。它可以是 ``None``、" "``''``、``'\\n'``、``'\\r'`` 或 ``'\\r\\n'``。它的運作規則如下:" -#: ../../library/functions.rst:1453 +#: ../../library/functions.rst:1464 msgid "" "When reading input from the stream, if *newline* is ``None``, universal " "newlines mode is enabled. Lines in the input can end in ``'\\n'``, " @@ -2552,20 +2587,20 @@ msgstr "" "傳給呼叫方時,行尾符號不會被轉換。如果它是任何其他有效的值,則輸入資料的行只" "會由給定的字串做結尾,且在回傳給呼叫方時,行尾符號不會被轉換。" -#: ../../library/functions.rst:1461 +#: ../../library/functions.rst:1472 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " -"characters written are translated to the system default line separator, :" -"data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no translation " -"takes place. If *newline* is any of the other legal values, any ``'\\n'`` " -"characters written are translated to the given string." +"characters written are translated to the system default line " +"separator, :data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no " +"translation takes place. If *newline* is any of the other legal values, any " +"``'\\n'`` characters written are translated to the given string." msgstr "" "將輸出寫入資料串流時,如果 *newline* 是 ``None``,則被寫入的任何 ``'\\n'`` 字" "元都會轉換為系統預設的行分隔符號 :data:`os.linesep`。如果 *newline* 是 " "``''`` 或 ``'\\n'``,則不做任何轉換。如果 *newline* 是任何其他有效的值,則寫" "入的任何 ``'\\n'`` 字元都將轉換為給定的字串。" -#: ../../library/functions.rst:1467 +#: ../../library/functions.rst:1478 msgid "" "If *closefd* is ``False`` and a file descriptor rather than a filename was " "given, the underlying file descriptor will be kept open when the file is " @@ -2576,7 +2611,7 @@ msgstr "" "則當檔案關閉時,底層的檔案描述器會保持開啟狀態。如果有給定一個檔名,則 " "*closefd* 必須是 ``True``\\ (預設值);否則將引發錯誤。" -#: ../../library/functions.rst:1472 +#: ../../library/functions.rst:1483 msgid "" "A custom opener can be used by passing a callable as *opener*. The " "underlying file descriptor for the file object is then obtained by calling " @@ -2589,19 +2624,19 @@ msgstr "" "必須回傳一個開啟的檔案描述器(將 :mod:`os.open` 作為 *opener* 傳入,在功能上" "的結果會相當於傳入 ``None``)。" -#: ../../library/functions.rst:1478 +#: ../../library/functions.rst:1489 msgid "The newly created file is :ref:`non-inheritable `." msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" -#: ../../library/functions.rst:1480 +#: ../../library/functions.rst:1491 msgid "" -"The following example uses the :ref:`dir_fd ` parameter of the :func:" -"`os.open` function to open a file relative to a given directory::" +"The following example uses the :ref:`dir_fd ` parameter of " +"the :func:`os.open` function to open a file relative to a given directory::" msgstr "" "下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" -#: ../../library/functions.rst:1483 +#: ../../library/functions.rst:1494 msgid "" ">>> import os\n" ">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" @@ -2614,41 +2649,41 @@ msgid "" ">>> os.close(dir_fd) # don't leak a file descriptor" msgstr "" -#: ../../library/functions.rst:1493 +#: ../../library/functions.rst:1504 msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " -"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass of :" -"class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When used " -"to open a file in a binary mode with buffering, the returned class is a " +"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass " +"of :class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When " +"used to open a file in a binary mode with buffering, the returned class is a " "subclass of :class:`io.BufferedIOBase`. The exact class varies: in read " "binary mode, it returns an :class:`io.BufferedReader`; in write binary and " "append binary modes, it returns an :class:`io.BufferedWriter`, and in read/" "write mode, it returns an :class:`io.BufferedRandom`. When buffering is " -"disabled, the raw stream, a subclass of :class:`io.RawIOBase`, :class:`io." -"FileIO`, is returned." +"disabled, the raw stream, a subclass " +"of :class:`io.RawIOBase`, :class:`io.FileIO`, is returned." msgstr "" ":func:`open` 函式回傳的 :term:`file object` 型別取決於模式。當 :func:`open` " "是在文字模式中開啟檔案時(``'w'``、``'r'``、``'wt'``、``'rt'`` 等),它會回" -"傳 :class:`io.TextIOBase` 的一個 subclass(具體來說,就是 :class:`io." -"TextIOWrapper`)。使用有緩衝的二進制模式開啟檔案時,回傳的 class 則會是 :" -"class:`io.BufferedIOBase` 的 subclass。確切的 class 各不相同:在讀取的二進制" -"模式,它會回傳 :class:`io.BufferedReader`;在寫入和附加的二進制模式,它會回" -"傳 :class:`io.BufferedWriter`,而在讀/寫模式,它會回傳 :class:`io." -"BufferedRandom`。當緩衝被停用時,會回傳原始資料串流 :class:`io.FileIO`,它" -"是 :class:`io.RawIOBase` 的一個 subclass。" +"傳 :class:`io.TextIOBase` 的一個 subclass(具體來說,就" +"是 :class:`io.TextIOWrapper`)。使用有緩衝的二進制模式開啟檔案時,回傳的 " +"class 則會是 :class:`io.BufferedIOBase` 的 subclass。確切的 class 各不相同:" +"在讀取的二進制模式,它會回傳 :class:`io.BufferedReader`;在寫入和附加的二進制" +"模式,它會回傳 :class:`io.BufferedWriter`,而在讀/寫模式,它會回" +"傳 :class:`io.BufferedRandom`。當緩衝被停用時,會回傳原始資料串" +"流 :class:`io.FileIO`,它是 :class:`io.RawIOBase` 的一個 subclass。" -#: ../../library/functions.rst:1514 +#: ../../library/functions.rst:1525 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " -"(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" -"`tempfile`, and :mod:`shutil`." +"(where :func:`open` is " +"declared), :mod:`os`, :mod:`os.path`, :mod:`tempfile`, and :mod:`shutil`." msgstr "" -"另請參閱檔案操作模組,例如 :mod:`fileinput`、:mod:`io`\\ (定義了 :func:" -"`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" -"`shutil`。" +"另請參閱檔案操作模組,例如 :mod:`fileinput`、:mod:`io`\\ (定義" +"了 :func:`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以" +"及 :mod:`shutil`。" -#: ../../library/functions.rst:1518 +#: ../../library/functions.rst:1529 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -2656,88 +2691,78 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/functions.rst:1520 +#: ../../library/functions.rst:1531 msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." msgstr "``mode`` 和 ``flags`` 引數可能會被原始的呼叫所修改或推論 (infer)。" -#: ../../library/functions.rst:1525 +#: ../../library/functions.rst:1536 msgid "The *opener* parameter was added." msgstr "增加了 *opener* 參數。" -#: ../../library/functions.rst:1526 +#: ../../library/functions.rst:1537 msgid "The ``'x'`` mode was added." msgstr "增加了 ``'x'`` 模式。" -#: ../../library/functions.rst:1527 +#: ../../library/functions.rst:1538 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "過去引發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" -#: ../../library/functions.rst:1528 +#: ../../library/functions.rst:1539 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." msgstr "" -"如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" -"`FileExistsError`。" +"如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引" +"發 :exc:`FileExistsError`。" -#: ../../library/functions.rst:1533 +#: ../../library/functions.rst:1544 msgid "The file is now non-inheritable." msgstr "檔案在此版本開始是不可繼承的。" -#: ../../library/functions.rst:1537 +#: ../../library/functions.rst:1548 msgid "" "If the system call is interrupted and the signal handler does not raise an " -"exception, the function now retries the system call instead of raising an :" -"exc:`InterruptedError` exception (see :pep:`475` for the rationale)." +"exception, the function now retries the system call instead of raising " +"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" "如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" "不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" -#: ../../library/functions.rst:1540 +#: ../../library/functions.rst:1551 msgid "The ``'namereplace'`` error handler was added." msgstr "增加了 ``'namereplace'`` 錯誤處理程式。" -#: ../../library/functions.rst:1544 +#: ../../library/functions.rst:1555 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" -#: ../../library/functions.rst:1545 +#: ../../library/functions.rst:1556 msgid "" -"On Windows, opening a console buffer may return a subclass of :class:`io." -"RawIOBase` other than :class:`io.FileIO`." +"On Windows, opening a console buffer may return a subclass " +"of :class:`io.RawIOBase` other than :class:`io.FileIO`." msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" -#: ../../library/functions.rst:1548 +#: ../../library/functions.rst:1559 msgid "The ``'U'`` mode has been removed." msgstr "``'U'`` 模式被移除。" -#: ../../library/functions.rst:1553 -msgid "Return the ordinal value of a character." -msgstr "" - -#: ../../library/functions.rst:1555 +#: ../../library/functions.rst:1564 +#, fuzzy msgid "" -"If the argument is a one-character string, return the Unicode code point of " -"that character. For example, ``ord('a')`` returns the integer ``97`` and " -"``ord('€')`` (Euro sign) returns ``8364``. This is the inverse of :func:" -"`chr`." +"Given a string representing one Unicode character, return an integer " +"representing the Unicode code point of that character. For example, " +"``ord('a')`` returns the integer ``97`` and ``ord('€')`` (Euro sign) returns " +"``8364``. This is the inverse of :func:`chr`." msgstr "" "如果引數是單字元字串,則回傳該字元的 Unicode 編碼位置。例如 ``ord('a')`` 回傳" "整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這是 :func:`chr` 的逆" "函式。" -#: ../../library/functions.rst:1560 -msgid "" -"If the argument is a :class:`bytes` or :class:`bytearray` object of length " -"1, return its single byte value. For example, ``ord(b'a')`` returns the " -"integer ``97``." -msgstr "" - -#: ../../library/functions.rst:1567 +#: ../../library/functions.rst:1572 msgid "" "Return *base* to the power *exp*; if *mod* is present, return *base* to the " "power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " @@ -2748,9 +2773,10 @@ msgstr "" "*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" -#: ../../library/functions.rst:1572 +#: ../../library/functions.rst:1577 +#, fuzzy msgid "" -"When arguments are builtin numeric types with mixed operand types, the " +"The arguments must have numeric types. With mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " "operands, the result has the same type as the operands (after coercion) " "unless the second argument is negative; in that case, all arguments are " @@ -2758,9 +2784,9 @@ msgid "" "2)`` returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative " "base of type :class:`int` or :class:`float` and a non-integral exponent, a " "complex result is delivered. For example, ``pow(-9, 0.5)`` returns a value " -"close to ``3j``. Whereas, for a negative base of type :class:`int` or :class:" -"`float` with an integral exponent, a float result is delivered. For example, " -"``pow(-9, 2.0)`` returns ``81.0``." +"close to ``3j``. Whereas, for a negative base of type :class:`int` " +"or :class:`float` with an integral exponent, a float result is delivered. " +"For example, ``pow(-9, 2.0)`` returns ``81.0``." msgstr "" "當引數為內建數值型別,且用於混合型別的運算元,會套用二元算術運算子的強制轉型 " "(coercion) 規則。對於 :class:`int` 運算元,運算結果會(在強制轉型後)與運算元" @@ -2768,11 +2794,11 @@ msgstr "" "並得到浮點數的結果。例如,``pow(10, 2)`` 會回傳 ``100``,但 ``pow(10, -2)`` " "會回傳 ``0.01``。如果底數 (base) 是型別為 :class:`int` 或 :class:`float` 的負" "數且指數 (exponent) 不是整數,則會得到一個複數的結果,例如 ``pow(-9, 0.5)`` " -"會回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` 或 :class:" -"`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 ``pow(-9, 2.0)`` " -"會回傳 ``81.0``。" +"會回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` " +"或 :class:`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 " +"``pow(-9, 2.0)`` 會回傳 ``81.0``。" -#: ../../library/functions.rst:1584 +#: ../../library/functions.rst:1589 msgid "" "For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must " "also be of integer type and *mod* must be nonzero. If *mod* is present and " @@ -2785,11 +2811,11 @@ msgstr "" "與 *mod* 互質。在這種情況下,會回傳 ``pow(inv_base, -exp, mod)``,其中 " "*inv_base* 是 *base* 對 *mod* 的模倒數 (inverse modulo)。" -#: ../../library/functions.rst:1590 +#: ../../library/functions.rst:1595 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "以下是一個計算 ``38`` 對 ``97`` 取模倒數的範例: ::" -#: ../../library/functions.rst:1592 +#: ../../library/functions.rst:1597 msgid "" ">>> pow(38, -1, mod=97)\n" "23\n" @@ -2801,7 +2827,7 @@ msgstr "" ">>> 23 * 38 % 97 == 1\n" "True" -#: ../../library/functions.rst:1597 +#: ../../library/functions.rst:1602 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." @@ -2809,12 +2835,12 @@ msgstr "" "對於 :class:`int` 運算元,現在 ``pow`` 的三引數形式允許第二個引數為負數,也容" "許模倒數的計算。" -#: ../../library/functions.rst:1602 +#: ../../library/functions.rst:1607 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "允許關鍵字引數。在此之前只支援位置引數。" -#: ../../library/functions.rst:1609 +#: ../../library/functions.rst:1614 msgid "" "Print *objects* to the text stream *file*, separated by *sep* and followed " "by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " @@ -2823,7 +2849,7 @@ msgstr "" "將 *objects* 列印到文字資料串流 *file*,用 *sep* 分隔並以 *end* 結尾。如果有" "給定 *sep*、*end*、*file* 和 *flush*,那麼它們必須是關鍵字引數的形式。" -#: ../../library/functions.rst:1613 +#: ../../library/functions.rst:1618 msgid "" "All non-keyword arguments are converted to strings like :func:`str` does and " "written to the stream, separated by *sep* and followed by *end*. Both *sep* " @@ -2836,7 +2862,7 @@ msgstr "" "以是 ``None``,這表示使用預設值。如果沒有給定 *objects*,:func:`print` 就只會" "寫入 *end*。" -#: ../../library/functions.rst:1619 +#: ../../library/functions.rst:1624 msgid "" "The *file* argument must be an object with a ``write(string)`` method; if it " "is not present or ``None``, :data:`sys.stdout` will be used. Since printed " @@ -2848,7 +2874,7 @@ msgstr "" "串,所以 :func:`print` 不能用於二進位模式的檔案物件。對於此類物件,請改用 " "``file.write(...)``。" -#: ../../library/functions.rst:1624 +#: ../../library/functions.rst:1629 msgid "" "Output buffering is usually determined by *file*. However, if *flush* is " "true, the stream is forcibly flushed." @@ -2856,15 +2882,15 @@ msgstr "" "輸出緩衝通常會由 *file* 決定。但是如果 *flush* 為 true,則資料串流會被強制清" "除。" -#: ../../library/functions.rst:1628 +#: ../../library/functions.rst:1633 msgid "Added the *flush* keyword argument." msgstr "增加了 *flush* 關鍵字引數。" -#: ../../library/functions.rst:1634 +#: ../../library/functions.rst:1639 msgid "Return a property attribute." msgstr "回傳 property 屬性。" -#: ../../library/functions.rst:1636 +#: ../../library/functions.rst:1641 msgid "" "*fget* is a function for getting an attribute value. *fset* is a function " "for setting an attribute value. *fdel* is a function for deleting an " @@ -2873,11 +2899,11 @@ msgstr "" "*fget* 是一個用於取得屬性值的函式,*fset* 是一個用於設定屬性值的函式,*fdel* " "是一個用於刪除屬性值的函式,而 *doc* 會為該屬性建立一個說明字串。" -#: ../../library/functions.rst:1640 +#: ../../library/functions.rst:1645 msgid "A typical use is to define a managed attribute ``x``::" msgstr "一個典型的用途是定義一個受管理的屬性 ``x``: ::" -#: ../../library/functions.rst:1642 +#: ../../library/functions.rst:1647 msgid "" "class C:\n" " def __init__(self):\n" @@ -2909,7 +2935,7 @@ msgstr "" "\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" -#: ../../library/functions.rst:1657 +#: ../../library/functions.rst:1662 msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." @@ -2917,18 +2943,18 @@ msgstr "" "如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會叫用取得器 (getter),``c.x = " "value`` 會呼叫設定器 (setter),而 ``del c.x`` 會叫用刪除器 (deleter)。" -#: ../../library/functions.rst:1660 +#: ../../library/functions.rst:1665 msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " -"possible to create read-only properties easily using :func:`property` as a :" -"term:`decorator`::" +"possible to create read-only properties easily using :func:`property` as " +"a :term:`decorator`::" msgstr "" "如果有給定 *doc*,它將會是 property 屬性的說明字串。否則,property 會複製 " -"*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" -"`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" +"*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使" +"用 :func:`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" -#: ../../library/functions.rst:1664 +#: ../../library/functions.rst:1669 msgid "" "class Parrot:\n" " def __init__(self):\n" @@ -2940,14 +2966,14 @@ msgid "" " return self._voltage" msgstr "" -#: ../../library/functions.rst:1673 +#: ../../library/functions.rst:1678 msgid "" "The ``@property`` decorator turns the :meth:`!voltage` method into a " "\"getter\" for a read-only attribute with the same name, and it sets the " "docstring for *voltage* to \"Get the current voltage.\"" msgstr "" -#: ../../library/functions.rst:1681 +#: ../../library/functions.rst:1686 msgid "" "A property object has ``getter``, ``setter``, and ``deleter`` methods usable " "as decorators that create a copy of the property with the corresponding " @@ -2955,7 +2981,7 @@ msgid "" "with an example:" msgstr "" -#: ../../library/functions.rst:1686 +#: ../../library/functions.rst:1691 msgid "" "class C:\n" " def __init__(self):\n" @@ -2991,36 +3017,36 @@ msgstr "" " def x(self):\n" " del self._x" -#: ../../library/functions.rst:1705 +#: ../../library/functions.rst:1710 msgid "" "This code is exactly equivalent to the first example. Be sure to give the " "additional functions the same name as the original property (``x`` in this " "case.)" msgstr "" -#: ../../library/functions.rst:1709 +#: ../../library/functions.rst:1714 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." msgstr "" -#: ../../library/functions.rst:1712 +#: ../../library/functions.rst:1717 msgid "The docstrings of property objects are now writeable." msgstr "" -#: ../../library/functions.rst:1717 +#: ../../library/functions.rst:1722 msgid "" "Attribute holding the name of the property. The name of the property can be " "changed at runtime." msgstr "" -#: ../../library/functions.rst:1728 +#: ../../library/functions.rst:1733 msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1734 +#: ../../library/functions.rst:1739 msgid "" "Return a string containing a printable representation of an object. For " "many types, this function makes an attempt to return a string that would " @@ -3033,11 +3059,11 @@ msgid "" "raise :exc:`RuntimeError`." msgstr "" -#: ../../library/functions.rst:1745 +#: ../../library/functions.rst:1750 msgid "This class has a custom representation that can be evaluated::" msgstr "" -#: ../../library/functions.rst:1747 +#: ../../library/functions.rst:1752 msgid "" "class Person:\n" " def __init__(self, name, age):\n" @@ -3055,7 +3081,7 @@ msgstr "" " def __repr__(self):\n" " return f\"Person('{self.name}', {self.age})\"" -#: ../../library/functions.rst:1758 +#: ../../library/functions.rst:1763 msgid "" "Return a reverse :term:`iterator`. The argument must be an object which has " "a :meth:`~object.__reversed__` method or supports the sequence protocol " @@ -3063,14 +3089,14 @@ msgid "" "method with integer arguments starting at ``0``)." msgstr "" -#: ../../library/functions.rst:1766 +#: ../../library/functions.rst:1771 msgid "" "Return *number* rounded to *ndigits* precision after the decimal point. If " "*ndigits* is omitted or is ``None``, it returns the nearest integer to its " "input." msgstr "" -#: ../../library/functions.rst:1770 +#: ../../library/functions.rst:1775 msgid "" "For the built-in types supporting :func:`round`, values are rounded to the " "closest multiple of 10 to the power minus *ndigits*; if two multiples are " @@ -3081,13 +3107,13 @@ msgid "" "``None``. Otherwise, the return value has the same type as *number*." msgstr "" -#: ../../library/functions.rst:1779 +#: ../../library/functions.rst:1784 msgid "" -"For a general Python object ``number``, ``round`` delegates to ``number." -"__round__``." +"For a general Python object ``number``, ``round`` delegates to " +"``number.__round__``." msgstr "" -#: ../../library/functions.rst:1784 +#: ../../library/functions.rst:1789 msgid "" "The behavior of :func:`round` for floats can be surprising: for example, " "``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is " @@ -3096,21 +3122,21 @@ msgid "" "information." msgstr "" -#: ../../library/functions.rst:1795 +#: ../../library/functions.rst:1800 msgid "" "Return a new :class:`set` object, optionally with elements taken from " "*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" "set` for documentation about this class." msgstr "" -#: ../../library/functions.rst:1799 +#: ../../library/functions.rst:1804 msgid "" -"For other containers see the built-in :class:`frozenset`, :class:`list`, :" -"class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " -"module." +"For other containers see the built-" +"in :class:`frozenset`, :class:`list`, :class:`tuple`, and :class:`dict` " +"classes, as well as the :mod:`collections` module." msgstr "" -#: ../../library/functions.rst:1806 +#: ../../library/functions.rst:1811 msgid "" "This is the counterpart of :func:`getattr`. The arguments are an object, a " "string, and an arbitrary value. The string may name an existing attribute " @@ -3119,30 +3145,30 @@ msgid "" "is equivalent to ``x.foobar = 123``." msgstr "" -#: ../../library/functions.rst:1812 +#: ../../library/functions.rst:1817 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " -"unless the object chooses to enforce that, for example in a custom :meth:" -"`~object.__getattribute__` or via :attr:`~object.__slots__`. An attribute " -"whose name is not an identifier will not be accessible using the dot " -"notation, but is accessible through :func:`getattr` etc.." +"unless the object chooses to enforce that, for example in a " +"custom :meth:`~object.__getattribute__` or via :attr:`~object.__slots__`. An " +"attribute whose name is not an identifier will not be accessible using the " +"dot notation, but is accessible through :func:`getattr` etc.." msgstr "" -#: ../../library/functions.rst:1820 +#: ../../library/functions.rst:1825 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " "with two leading underscores) name in order to set it with :func:`setattr`." msgstr "" -#: ../../library/functions.rst:1829 +#: ../../library/functions.rst:1834 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " "``None``." msgstr "" -#: ../../library/functions.rst:1833 +#: ../../library/functions.rst:1838 msgid "" "Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, " "and :attr:`!step` which merely return the argument values (or their " @@ -3150,48 +3176,51 @@ msgid "" "by NumPy and other third-party packages." msgstr "" -#: ../../library/functions.rst:1842 +#: ../../library/functions.rst:1847 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " -"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" -"`itertools.islice` for an alternate version that returns an :term:`iterator`." +"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. " +"See :func:`itertools.islice` for an alternate version that returns " +"an :term:`iterator`." msgstr "" -#: ../../library/functions.rst:1847 +#: ../../library/functions.rst:1852 msgid "" -"Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" -"`~slice.stop`, and :attr:`~slice.step` are hashable)." +"Slice objects are now :term:`hashable` " +"(provided :attr:`~slice.start`, :attr:`~slice.stop`, and :attr:`~slice.step` " +"are hashable)." msgstr "" -#: ../../library/functions.rst:1853 +#: ../../library/functions.rst:1858 msgid "Return a new sorted list from the items in *iterable*." msgstr "" -#: ../../library/functions.rst:1855 +#: ../../library/functions.rst:1860 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" -#: ../../library/functions.rst:1857 +#: ../../library/functions.rst:1862 msgid "" "*key* specifies a function of one argument that is used to extract a " -"comparison key from each element in *iterable* (for example, ``key=str." -"lower``). The default value is ``None`` (compare the elements directly)." +"comparison key from each element in *iterable* (for example, " +"``key=str.lower``). The default value is ``None`` (compare the elements " +"directly)." msgstr "" -#: ../../library/functions.rst:1861 +#: ../../library/functions.rst:1866 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -#: ../../library/functions.rst:1864 +#: ../../library/functions.rst:1869 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." msgstr "" -#: ../../library/functions.rst:1867 +#: ../../library/functions.rst:1872 msgid "" "The built-in :func:`sorted` function is guaranteed to be stable. A sort is " "stable if it guarantees not to change the relative order of elements that " @@ -3199,7 +3228,7 @@ msgid "" "example, sort by department, then by salary grade)." msgstr "" -#: ../../library/functions.rst:1872 +#: ../../library/functions.rst:1877 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -3211,22 +3240,22 @@ msgid "" "method." msgstr "" -#: ../../library/functions.rst:1881 +#: ../../library/functions.rst:1886 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functions.rst:1885 +#: ../../library/functions.rst:1890 msgid "Transform a method into a static method." msgstr "" -#: ../../library/functions.rst:1887 +#: ../../library/functions.rst:1892 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -#: ../../library/functions.rst:1890 +#: ../../library/functions.rst:1895 msgid "" "class C:\n" " @staticmethod\n" @@ -3236,30 +3265,30 @@ msgstr "" " @staticmethod\n" " def f(arg1, arg2, argN): ..." -#: ../../library/functions.rst:1894 +#: ../../library/functions.rst:1899 msgid "" -"The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" -"`function` for details." +"The ``@staticmethod`` form is a function :term:`decorator` -- " +"see :ref:`function` for details." msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" -#: ../../library/functions.rst:1897 +#: ../../library/functions.rst:1902 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " -"an instance (such as ``C().f()``). Moreover, the static method :term:" -"`descriptor` is also callable, so it can be used in the class definition " -"(such as ``f()``)." +"an instance (such as ``C().f()``). Moreover, the static " +"method :term:`descriptor` is also callable, so it can be used in the class " +"definition (such as ``f()``)." msgstr "" -#: ../../library/functions.rst:1902 +#: ../../library/functions.rst:1907 msgid "" "Static methods in Python are similar to those found in Java or C++. Also, " "see :func:`classmethod` for a variant that is useful for creating alternate " "class constructors." msgstr "" -#: ../../library/functions.rst:1906 +#: ../../library/functions.rst:1911 msgid "" "Like all decorators, it is also possible to call ``staticmethod`` as a " "regular function and do something with its result. This is needed in some " @@ -3268,7 +3297,7 @@ msgid "" "cases, use this idiom::" msgstr "" -#: ../../library/functions.rst:1912 +#: ../../library/functions.rst:1917 msgid "" "def regular_function():\n" " ...\n" @@ -3282,88 +3311,94 @@ msgstr "" "class C:\n" " method = staticmethod(regular_function)" -#: ../../library/functions.rst:1918 +#: ../../library/functions.rst:1923 msgid "For more information on static methods, see :ref:`types`." msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" -#: ../../library/functions.rst:1920 +#: ../../library/functions.rst:1925 msgid "" -"Static methods now inherit the method attributes (:attr:`~function." -"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" -"attr:`~function.__doc__` and :attr:`~function.__annotations__`), have a new " -"``__wrapped__`` attribute, and are now callable as regular functions." +"Static methods now inherit the method attributes " +"(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " +"and :attr:`~function.__annotations__`), have a new ``__wrapped__`` " +"attribute, and are now callable as regular functions." msgstr "" -"Static method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" -"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." -"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " -"``__wrapped__`` 屬性,且為如一般函式的可呼叫物件。" +"Static method 現在繼承了 method 屬性" +"(:attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__doc__` " +"和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性," +"且為如一般函式的可呼叫物件。" -#: ../../library/functions.rst:1938 +#: ../../library/functions.rst:1943 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" -#: ../../library/functions.rst:1940 +#: ../../library/functions.rst:1945 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -#: ../../library/functions.rst:1946 +#: ../../library/functions.rst:1951 msgid "" "Sums *start* and the items of an *iterable* from left to right and returns " "the total. The *iterable*'s items are normally numbers, and the start value " "is not allowed to be a string." msgstr "" -#: ../../library/functions.rst:1950 +#: ../../library/functions.rst:1955 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " -"preferred, fast way to concatenate a sequence of strings is by calling ``''." -"join(sequence)``. To add floating-point values with extended precision, " -"see :func:`math.fsum`\\. To concatenate a series of iterables, consider " -"using :func:`itertools.chain`." +"preferred, fast way to concatenate a sequence of strings is by calling " +"``''.join(sequence)``. To add floating-point values with extended " +"precision, see :func:`math.fsum`\\. To concatenate a series of iterables, " +"consider using :func:`itertools.chain`." msgstr "" -#: ../../library/functions.rst:1956 +#: ../../library/functions.rst:1961 msgid "The *start* parameter can be specified as a keyword argument." msgstr "*start* 參數可被指定為關鍵字引數。" -#: ../../library/functions.rst:1959 +#: ../../library/functions.rst:1964 msgid "" "Summation of floats switched to an algorithm that gives higher accuracy and " "better commutativity on most builds." msgstr "" -#: ../../library/functions.rst:1966 +#: ../../library/functions.rst:1967 +msgid "" +"Added specialization for summation of complexes, using same algorithm as for " +"summation of floats." +msgstr "" + +#: ../../library/functions.rst:1975 msgid "" "Return a proxy object that delegates method calls to a parent or sibling " "class of *type*. This is useful for accessing inherited methods that have " "been overridden in a class." msgstr "" -#: ../../library/functions.rst:1970 +#: ../../library/functions.rst:1979 msgid "" "The *object_or_type* determines the :term:`method resolution order` to be " "searched. The search starts from the class right after the *type*." msgstr "" -#: ../../library/functions.rst:1974 +#: ../../library/functions.rst:1983 msgid "" -"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" -"> A -> object`` and the value of *type* is ``B``, then :func:`super` " +"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C " +"-> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -#: ../../library/functions.rst:1978 +#: ../../library/functions.rst:1987 msgid "" "The :attr:`~type.__mro__` attribute of the class corresponding to " -"*object_or_type* lists the method resolution search order used by both :func:" -"`getattr` and :func:`super`. The attribute is dynamic and can change " -"whenever the inheritance hierarchy is updated." +"*object_or_type* lists the method resolution search order used by " +"both :func:`getattr` and :func:`super`. The attribute is dynamic and can " +"change whenever the inheritance hierarchy is updated." msgstr "" -#: ../../library/functions.rst:1983 +#: ../../library/functions.rst:1992 msgid "" "If the second argument is omitted, the super object returned is unbound. If " "the second argument is an object, ``isinstance(obj, type)`` must be true. " @@ -3371,7 +3406,7 @@ msgid "" "(this is useful for classmethods)." msgstr "" -#: ../../library/functions.rst:1988 +#: ../../library/functions.rst:1997 msgid "" "When called directly within an ordinary method of a class, both arguments " "may be omitted (\"zero-argument :func:`!super`\"). In this case, *type* will " @@ -3381,7 +3416,7 @@ msgid "" "including generator expressions, which implicitly create nested functions.)" msgstr "" -#: ../../library/functions.rst:1995 +#: ../../library/functions.rst:2004 msgid "" "There are two typical use cases for *super*. In a class hierarchy with " "single inheritance, *super* can be used to refer to parent classes without " @@ -3389,7 +3424,7 @@ msgid "" "closely parallels the use of *super* in other programming languages." msgstr "" -#: ../../library/functions.rst:2000 +#: ../../library/functions.rst:2009 msgid "" "The second use case is to support cooperative multiple inheritance in a " "dynamic execution environment. This use case is unique to Python and is not " @@ -3402,11 +3437,11 @@ msgid "" "classes that are unknown prior to runtime)." msgstr "" -#: ../../library/functions.rst:2010 +#: ../../library/functions.rst:2019 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" -#: ../../library/functions.rst:2012 +#: ../../library/functions.rst:2021 msgid "" "class C(B):\n" " def method(self, arg):\n" @@ -3414,14 +3449,14 @@ msgid "" " # super(C, self).method(arg)" msgstr "" -#: ../../library/functions.rst:2017 +#: ../../library/functions.rst:2026 msgid "" "In addition to method lookups, :func:`super` also works for attribute " "lookups. One possible use case for this is calling :term:`descriptors " "` in a parent or sibling class." msgstr "" -#: ../../library/functions.rst:2021 +#: ../../library/functions.rst:2030 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -3431,7 +3466,7 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" -#: ../../library/functions.rst:2029 +#: ../../library/functions.rst:2038 msgid "" "Also note that, aside from the zero argument form, :func:`super` is not " "limited to use inside methods. The two argument form specifies the " @@ -3441,33 +3476,39 @@ msgid "" "accessing the current instance for ordinary methods." msgstr "" -#: ../../library/functions.rst:2036 +#: ../../library/functions.rst:2045 msgid "" -"For practical suggestions on how to design cooperative classes using :func:" -"`super`, see `guide to using super() `_." +"For practical suggestions on how to design cooperative classes " +"using :func:`super`, see `guide to using super() `_." msgstr "" -#: ../../library/functions.rst:2045 +#: ../../library/functions.rst:2049 +msgid "" +":class:`super` objects are now :mod:`pickleable ` " +"and :mod:`copyable `." +msgstr "" + +#: ../../library/functions.rst:2058 msgid "" "Rather than being a function, :class:`tuple` is actually an immutable " "sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:2054 +#: ../../library/functions.rst:2067 msgid "" "With one argument, return the type of an *object*. The return value is a " -"type object and generally the same object as returned by :attr:`object." -"__class__`." +"type object and generally the same object as returned " +"by :attr:`object.__class__`." msgstr "" -#: ../../library/functions.rst:2058 +#: ../../library/functions.rst:2071 msgid "" "The :func:`isinstance` built-in function is recommended for testing the type " "of an object, because it takes subclasses into account." msgstr "" -#: ../../library/functions.rst:2061 +#: ../../library/functions.rst:2074 msgid "" "With three arguments, return a new type object. This is essentially a " "dynamic form of the :keyword:`class` statement. The *name* string is the " @@ -3475,26 +3516,26 @@ msgid "" "tuple contains the base classes and becomes the :attr:`~type.__bases__` " "attribute; if empty, :class:`object`, the ultimate base of all classes, is " "added. The *dict* dictionary contains attribute and method definitions for " -"the class body; it may be copied or wrapped before becoming the :attr:`~type." -"__dict__` attribute. The following two statements create identical :class:`!" -"type` objects:" +"the class body; it may be copied or wrapped before becoming " +"the :attr:`~type.__dict__` attribute. The following two statements create " +"identical :class:`!type` objects:" msgstr "" -#: ../../library/functions.rst:2076 +#: ../../library/functions.rst:2089 msgid "See also:" msgstr "" -#: ../../library/functions.rst:2078 +#: ../../library/functions.rst:2091 msgid "" ":ref:`Documentation on attributes and methods on classes `." msgstr "" -#: ../../library/functions.rst:2079 +#: ../../library/functions.rst:2092 msgid ":ref:`bltin-type-objects`" msgstr ":ref:`bltin-type-objects`" -#: ../../library/functions.rst:2081 +#: ../../library/functions.rst:2094 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -3502,58 +3543,59 @@ msgid "" "would." msgstr "" -#: ../../library/functions.rst:2086 +#: ../../library/functions.rst:2099 msgid "See also :ref:`class-customization`." msgstr "另請參閱 :ref:`class-customization`。" -#: ../../library/functions.rst:2088 +#: ../../library/functions.rst:2101 msgid "" "Subclasses of :class:`!type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" -#: ../../library/functions.rst:2095 +#: ../../library/functions.rst:2108 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " "or any other object with a :attr:`!__dict__` attribute." msgstr "" -#: ../../library/functions.rst:2098 +#: ../../library/functions.rst:2111 msgid "" -"Objects such as modules and instances have an updateable :attr:`~object." -"__dict__` attribute; however, other objects may have write restrictions on " -"their :attr:`!__dict__` attributes (for example, classes use a :class:`types." -"MappingProxyType` to prevent direct dictionary updates)." +"Objects such as modules and instances have an " +"updateable :attr:`~object.__dict__` attribute; however, other objects may " +"have write restrictions on their :attr:`!__dict__` attributes (for example, " +"classes use a :class:`types.MappingProxyType` to prevent direct dictionary " +"updates)." msgstr "" -#: ../../library/functions.rst:2103 +#: ../../library/functions.rst:2116 msgid "Without an argument, :func:`vars` acts like :func:`locals`." msgstr "" -#: ../../library/functions.rst:2105 +#: ../../library/functions.rst:2118 msgid "" "A :exc:`TypeError` exception is raised if an object is specified but it " "doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " "defines the :attr:`~object.__slots__` attribute)." msgstr "" -#: ../../library/functions.rst:2111 +#: ../../library/functions.rst:2124 msgid "" "The result of calling this function without an argument has been updated as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:2117 +#: ../../library/functions.rst:2130 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." msgstr "" -#: ../../library/functions.rst:2120 +#: ../../library/functions.rst:2133 msgid "Example::" msgstr "例如: ::" -#: ../../library/functions.rst:2122 +#: ../../library/functions.rst:2135 msgid "" ">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" "... print(item)\n" @@ -3569,27 +3611,27 @@ msgstr "" "(2, 'spice')\n" "(3, 'everything nice')" -#: ../../library/functions.rst:2129 +#: ../../library/functions.rst:2142 msgid "" "More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " "tuple contains the *i*-th element from each of the argument iterables." msgstr "" -#: ../../library/functions.rst:2132 +#: ../../library/functions.rst:2145 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " -"columns into rows. This is similar to `transposing a matrix `_." +"columns into rows. This is similar to `transposing a matrix `_." msgstr "" -#: ../../library/functions.rst:2136 +#: ../../library/functions.rst:2149 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " -"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" -"`list`." +"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in " +"a :class:`list`." msgstr "" -#: ../../library/functions.rst:2140 +#: ../../library/functions.rst:2153 msgid "" "One thing to consider is that the iterables passed to :func:`zip` could have " "different lengths; sometimes by design, and sometimes because of a bug in " @@ -3597,14 +3639,14 @@ msgid "" "approaches to dealing with this issue:" msgstr "" -#: ../../library/functions.rst:2145 +#: ../../library/functions.rst:2158 msgid "" "By default, :func:`zip` stops when the shortest iterable is exhausted. It " "will ignore the remaining items in the longer iterables, cutting off the " "result to the length of the shortest iterable::" msgstr "" -#: ../../library/functions.rst:2149 +#: ../../library/functions.rst:2162 msgid "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" @@ -3612,14 +3654,14 @@ msgstr "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" -#: ../../library/functions.rst:2152 +#: ../../library/functions.rst:2165 msgid "" ":func:`zip` is often used in cases where the iterables are assumed to be of " "equal length. In such cases, it's recommended to use the ``strict=True`` " "option. Its output is the same as regular :func:`zip`::" msgstr "" -#: ../../library/functions.rst:2156 +#: ../../library/functions.rst:2169 msgid "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" @@ -3627,37 +3669,37 @@ msgstr "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" -#: ../../library/functions.rst:2159 +#: ../../library/functions.rst:2172 msgid "" "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " "is exhausted before the others:" msgstr "" -#: ../../library/functions.rst:2177 +#: ../../library/functions.rst:2190 msgid "" "Without the ``strict=True`` argument, any bug that results in iterables of " "different lengths will be silenced, possibly manifesting as a hard-to-find " "bug in another part of the program." msgstr "" -#: ../../library/functions.rst:2181 +#: ../../library/functions.rst:2194 msgid "" "Shorter iterables can be padded with a constant value to make all the " -"iterables have the same length. This is done by :func:`itertools." -"zip_longest`." +"iterables have the same length. This is done " +"by :func:`itertools.zip_longest`." msgstr "" -#: ../../library/functions.rst:2185 +#: ../../library/functions.rst:2198 msgid "" "Edge cases: With a single iterable argument, :func:`zip` returns an iterator " "of 1-tuples. With no arguments, it returns an empty iterator." msgstr "" -#: ../../library/functions.rst:2188 +#: ../../library/functions.rst:2201 msgid "Tips and tricks:" msgstr "" -#: ../../library/functions.rst:2190 +#: ../../library/functions.rst:2203 msgid "" "The left-to-right evaluation order of the iterables is guaranteed. This " "makes possible an idiom for clustering a data series into n-length groups " @@ -3666,13 +3708,13 @@ msgid "" "iterator. This has the effect of dividing the input into n-length chunks." msgstr "" -#: ../../library/functions.rst:2196 +#: ../../library/functions.rst:2209 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -#: ../../library/functions.rst:2199 +#: ../../library/functions.rst:2212 msgid "" ">>> x = [1, 2, 3]\n" ">>> y = [4, 5, 6]\n" @@ -3690,17 +3732,17 @@ msgstr "" ">>> x == list(x2) and y == list(y2)\n" "True" -#: ../../library/functions.rst:2207 +#: ../../library/functions.rst:2220 msgid "Added the ``strict`` argument." msgstr "增加了 ``strict`` 引數。" -#: ../../library/functions.rst:2219 +#: ../../library/functions.rst:2232 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2222 +#: ../../library/functions.rst:2235 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -3712,7 +3754,7 @@ msgid "" "discouraged in favor of :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2231 +#: ../../library/functions.rst:2244 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -3722,7 +3764,7 @@ msgid "" "determine the package context of the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2238 +#: ../../library/functions.rst:2251 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -3731,7 +3773,7 @@ msgid "" "details)." msgstr "" -#: ../../library/functions.rst:2244 +#: ../../library/functions.rst:2257 msgid "" "When the *name* variable is of the form ``package.module``, normally, the " "top-level package (the name up till the first dot) is returned, *not* the " @@ -3739,37 +3781,37 @@ msgid "" "given, the module named by *name* is returned." msgstr "" -#: ../../library/functions.rst:2249 +#: ../../library/functions.rst:2262 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" msgstr "" -#: ../../library/functions.rst:2252 +#: ../../library/functions.rst:2265 msgid "spam = __import__('spam', globals(), locals(), [], 0)" msgstr "spam = __import__('spam', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2254 +#: ../../library/functions.rst:2267 msgid "The statement ``import spam.ham`` results in this call::" msgstr "" -#: ../../library/functions.rst:2256 +#: ../../library/functions.rst:2269 msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2258 +#: ../../library/functions.rst:2271 msgid "" "Note how :func:`__import__` returns the toplevel module here because this is " "the object that is bound to a name by the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2261 +#: ../../library/functions.rst:2274 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" msgstr "" -#: ../../library/functions.rst:2264 +#: ../../library/functions.rst:2277 msgid "" "_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" "eggs = _temp.eggs\n" @@ -3779,36 +3821,36 @@ msgstr "" "eggs = _temp.eggs\n" "saus = _temp.sausage" -#: ../../library/functions.rst:2268 +#: ../../library/functions.rst:2281 msgid "" "Here, the ``spam.ham`` module is returned from :func:`__import__`. From " "this object, the names to import are retrieved and assigned to their " "respective names." msgstr "" -#: ../../library/functions.rst:2272 +#: ../../library/functions.rst:2285 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2275 +#: ../../library/functions.rst:2288 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." msgstr "" -#: ../../library/functions.rst:2279 +#: ../../library/functions.rst:2292 msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." msgstr "" -#: ../../library/functions.rst:2284 +#: ../../library/functions.rst:2297 msgid "Footnotes" msgstr "註解" -#: ../../library/functions.rst:2285 +#: ../../library/functions.rst:2298 msgid "" "Note that the parser only accepts the Unix-style end of line convention. If " "you are reading the code from a file, make sure to use newline conversion " @@ -3821,106 +3863,106 @@ msgstr "" msgid "Boolean" msgstr "Boolean(布林值)" -#: ../../library/functions.rst:154 ../../library/functions.rst:2052 +#: ../../library/functions.rst:154 ../../library/functions.rst:2065 msgid "type" msgstr "type(型別)" -#: ../../library/functions.rst:646 +#: ../../library/functions.rst:652 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/functions.rst:646 +#: ../../library/functions.rst:652 msgid "exec" msgstr "exec" -#: ../../library/functions.rst:744 +#: ../../library/functions.rst:750 msgid "NaN" msgstr "NaN" -#: ../../library/functions.rst:744 +#: ../../library/functions.rst:750 msgid "Infinity" msgstr "Infinity(無窮)" -#: ../../library/functions.rst:812 +#: ../../library/functions.rst:820 msgid "__format__" msgstr "__format__" -#: ../../library/functions.rst:812 ../../library/functions.rst:1928 +#: ../../library/functions.rst:820 ../../library/functions.rst:1933 msgid "string" msgstr "string(字串)" -#: ../../library/functions.rst:812 +#: ../../library/functions.rst:820 msgid "format() (built-in function)" msgstr "format()(內建函式)" -#: ../../library/functions.rst:1323 +#: ../../library/functions.rst:1334 msgid "file object" msgstr "file object(檔案物件)" -#: ../../library/functions.rst:1323 ../../library/functions.rst:1444 +#: ../../library/functions.rst:1334 ../../library/functions.rst:1455 msgid "open() built-in function" msgstr "open() 內建函式" -#: ../../library/functions.rst:1351 +#: ../../library/functions.rst:1362 msgid "file" msgstr "file(檔案)" -#: ../../library/functions.rst:1351 +#: ../../library/functions.rst:1362 msgid "modes" msgstr "modes(模式)" -#: ../../library/functions.rst:1444 +#: ../../library/functions.rst:1455 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/functions.rst:1505 +#: ../../library/functions.rst:1516 msgid "line-buffered I/O" msgstr "line-buffered I/O(行緩衝 I/O)" -#: ../../library/functions.rst:1505 +#: ../../library/functions.rst:1516 msgid "unbuffered I/O" msgstr "unbuffered I/O(非緩衝 I/O)" -#: ../../library/functions.rst:1505 +#: ../../library/functions.rst:1516 msgid "buffer size, I/O" msgstr "buffer size, I/O(緩衝區大小、I/O)" -#: ../../library/functions.rst:1505 +#: ../../library/functions.rst:1516 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/functions.rst:1505 +#: ../../library/functions.rst:1516 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/functions.rst:1505 +#: ../../library/functions.rst:1516 msgid "text mode" msgstr "text mode(文字模式)" -#: ../../library/functions.rst:1505 ../../library/functions.rst:2213 +#: ../../library/functions.rst:1516 ../../library/functions.rst:2226 msgid "module" msgstr "module(模組)" -#: ../../library/functions.rst:1505 +#: ../../library/functions.rst:1516 msgid "sys" msgstr "sys" -#: ../../library/functions.rst:1928 +#: ../../library/functions.rst:1933 msgid "str() (built-in function)" msgstr "str() (內建函式)" -#: ../../library/functions.rst:2052 +#: ../../library/functions.rst:2065 msgid "object" msgstr "object(物件)" -#: ../../library/functions.rst:2213 +#: ../../library/functions.rst:2226 msgid "statement" msgstr "statement(陳述式)" -#: ../../library/functions.rst:2213 +#: ../../library/functions.rst:2226 msgid "import" msgstr "import(引入)" -#: ../../library/functions.rst:2213 +#: ../../library/functions.rst:2226 msgid "builtins" msgstr "builtins(內建)" diff --git a/library/functools.po b/library/functools.po index 69858cd1de4..3363535f85c 100644 --- a/library/functools.po +++ b/library/functools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-12 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-05-11 16:02+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -121,7 +121,7 @@ msgstr "" "屬性外實質上幾乎是不可變 (immutable) 的實例,針對其所需要繁重計算會很有用。" #: ../../library/functools.rst:70 ../../library/functools.rst:142 -#: ../../library/functools.rst:389 +#: ../../library/functools.rst:438 msgid "Example::" msgstr "範例: ::" @@ -147,9 +147,9 @@ msgstr "" #: ../../library/functools.rst:81 msgid "" -"The mechanics of :func:`cached_property` are somewhat different from :func:" -"`property`. A regular property blocks attribute writes unless a setter is " -"defined. In contrast, a *cached_property* allows writes." +"The mechanics of :func:`cached_property` are somewhat different " +"from :func:`property`. A regular property blocks attribute writes unless a " +"setter is defined. In contrast, a *cached_property* allows writes." msgstr "" ":func:`cached_property` 的機制與 :func:`property` 有所不同。除非定義了 " "setter,否則常規屬性會阻止屬性的寫入。相反地,*cached_property* 則允許寫入。" @@ -218,8 +218,8 @@ msgid "" "If a mutable mapping is not available or if space-efficient key sharing is " "desired, an effect similar to :func:`cached_property` can also be achieved " "by stacking :func:`property` on top of :func:`lru_cache`. See :ref:`faq-" -"cache-method-calls` for more details on how this differs from :func:" -"`cached_property`." +"cache-method-calls` for more details on how this differs " +"from :func:`cached_property`." msgstr "" "如果可變對映不可用或需要金鑰共享以節省空間,則也可以透過在 :func:`lru_cache` " "之上堆疊 :func:`property` 來實作類似於 :func:`cached_property` 的效果。請參閱" @@ -242,16 +242,15 @@ msgstr "" #: ../../library/functools.rst:130 msgid "" "Transform an old-style comparison function to a :term:`key function`. Used " -"with tools that accept key functions (such as :func:`sorted`, :func:`min`, :" -"func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:" -"`itertools.groupby`). This function is primarily used as a transition tool " -"for programs being converted from Python 2 which supported the use of " -"comparison functions." +"with tools that accept key functions (such " +"as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). " +"This function is primarily used as a transition tool for programs being " +"converted from Python 2 which supported the use of comparison functions." msgstr "" "將舊式比較函式轉換為\\ :term:`鍵函式 `,能與接受鍵函式的工具一" -"起使用(例如 :func:`sorted`、:func:`min`、:func:`max`、:func:`heapq." -"nlargest`、:func:`heapq.nsmallest`、:func:`itertools.groupby`)。此函式主要作" -"為轉換工具,用於從有支援使用比較函式的 Python 2 轉換成的程式。" +"起使用(例" +"如 :func:`sorted`、:func:`min`、:func:`max`、:func:`heapq.nlargest`、:func:`heapq.nsmallest`、:func:`itertools.groupby`)。" +"此函式主要作為轉換工具,用於從有支援使用比較函式的 Python 2 轉換成的程式。" #: ../../library/functools.rst:137 msgid "" @@ -369,8 +368,8 @@ msgid "" "function that returns a :term:`named tuple` showing *hits*, *misses*, " "*maxsize* and *currsize*." msgstr "" -"為了輔助測量快取的有效性並調整 *maxsize* 參數,包裝的函式使用了一個 :func:" -"`!cache_info` 函式來做檢測,該函式會回傳一個\\ :term:`附名元組 `\\ 來顯示 *hits*、*misses*、*maxsize* 和 *currsize*。" #: ../../library/functools.rst:213 @@ -381,9 +380,9 @@ msgstr "裝飾器還提供了一個 :func:`!cache_clear` 函式來清除或使 #: ../../library/functools.rst:216 msgid "" -"The original underlying function is accessible through the :attr:" -"`__wrapped__` attribute. This is useful for introspection, for bypassing " -"the cache, or for rewrapping the function with a different cache." +"The original underlying function is accessible through " +"the :attr:`__wrapped__` attribute. This is useful for introspection, for " +"bypassing the cache, or for rewrapping the function with a different cache." msgstr "" "原本的底層函式可以透過 :attr:`__wrapped__` 屬性存取。這對於要自我檢查 " "(introspection)、繞過快取或使用不同的快取重新包裝函式時非常有用。" @@ -413,10 +412,11 @@ msgid "" "long-running processes such as web servers." msgstr "" "當最近的呼叫是即將發生之呼叫的最佳預測因子時(例如新聞伺服器上最受歡迎的文章" -"往往每天都會發生變化),`LRU (least recently used) 快取 `_\\ " -"能發揮最好的效果。快取的大小限制可確保快取不會在長時間運行的行程(例如 Web 伺" -"服器)上無限制地成長。" +"往往每天都會發生變化),`LRU (least recently used) 快取 `_\\ 能發揮最好的效果。" +"快取的大小限制可確保快取不會在長時間運行的行程(例如 Web 伺服器)上無限制地成" +"長。" #: ../../library/functools.rst:233 msgid "" @@ -472,9 +472,10 @@ msgstr "" #: ../../library/functools.rst:258 msgid "" -"Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a `dynamic " -"programming `_ technique::" +"Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a " +"`dynamic programming `_ " +"technique::" msgstr "" "使用快取來實作\\ `動態規劃 (dynamic programming) `_ 技法以有效率地計算\\ `費波那契數 (Fibonacci " @@ -529,12 +530,15 @@ msgstr "" #: ../../library/functools.rst:293 msgid "" -"The class must define one of :meth:`~object.__lt__`, :meth:`~object." -"__le__`, :meth:`~object.__gt__`, or :meth:`~object.__ge__`. In addition, the " -"class should supply an :meth:`~object.__eq__` method." +"The class must define one " +"of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " +"or :meth:`~object.__ge__`. In addition, the class should supply " +"an :meth:`~object.__eq__` method." msgstr "" -"類別必須定義 :meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object.__gt__` " -"或 :meth:`~object.__ge__` 其中之一。此外,該類別應該提供 :meth:`~object.__eq__` 方法。" +"類別必須定" +"義 :meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object.__gt__` " +"或 :meth:`~object.__ge__` 其中之一。此外,該類別應該提" +"供 :meth:`~object.__eq__` 方法。" #: ../../library/functools.rst:299 msgid "" @@ -602,6 +606,12 @@ msgstr "現在支援從底層對於未識別型別的比較函式回傳 ``NotImp #: ../../library/functools.rst:339 msgid "" +"A singleton object used as a sentinel to reserve a place for positional " +"arguments when calling :func:`partial` and :func:`partialmethod`." +msgstr "" + +#: ../../library/functools.rst:347 +msgid "" "Return a new :ref:`partial object` which when called will " "behave like *func* called with the positional arguments *args* and keyword " "arguments *keywords*. If more arguments are supplied to the call, they are " @@ -613,12 +623,12 @@ msgstr "" "引數,它們將被附加到 *args*。如果提供了額外的關鍵字引數,它們會擴充並覆寫 " "*keywords*。大致相當於: ::" -#: ../../library/functools.rst:346 +#: ../../library/functools.rst:354 +#, fuzzy msgid "" "def partial(func, /, *args, **keywords):\n" -" def newfunc(*fargs, **fkeywords):\n" -" newkeywords = {**keywords, **fkeywords}\n" -" return func(*args, *fargs, **newkeywords)\n" +" def newfunc(*more_args, **more_keywords):\n" +" return func(*args, *more_args, **(keywords | more_keywords))\n" " newfunc.func = func\n" " newfunc.args = args\n" " newfunc.keywords = keywords\n" @@ -633,28 +643,100 @@ msgstr "" " newfunc.keywords = keywords\n" " return newfunc" -#: ../../library/functools.rst:355 +#: ../../library/functools.rst:362 +#, fuzzy msgid "" -"The :func:`partial` is used for partial function application which " +"The :func:`!partial` function is used for partial function application which " "\"freezes\" some portion of a function's arguments and/or keywords resulting " "in a new object with a simplified signature. For example, :func:`partial` " "can be used to create a callable that behaves like the :func:`int` function " -"where the *base* argument defaults to two:" +"where the *base* argument defaults to ``2``:" msgstr "" ":func:`partial` 用於部分函式應用程序,它「凍結」函式引數和/或關鍵字的某些部" "分,從而產生具有簡化簽名的新物件。例如,:func:`partial` 可用來建立可呼叫函" "式,其行為類似於 :func:`int` 函式,其中 *base* 引數預設為 2:" -#: ../../library/functools.rst:370 +#: ../../library/functools.rst:368 +msgid "" +">>> basetwo = partial(int, base=2)\n" +">>> basetwo.__doc__ = 'Convert base 2 string to an int.'\n" +">>> basetwo('10010')\n" +"18" +msgstr "" + +#: ../../library/functools.rst:375 +msgid "" +"If :data:`Placeholder` sentinels are present in *args*, they will be filled " +"first when :func:`!partial` is called. This makes it possible to pre-fill " +"any positional argument with a call to :func:`!partial`; without :data:`!" +"Placeholder`, only the chosen number of leading positional arguments can be " +"pre-filled." +msgstr "" + +#: ../../library/functools.rst:380 msgid "" -"Return a new :class:`partialmethod` descriptor which behaves like :class:" -"`partial` except that it is designed to be used as a method definition " -"rather than being directly callable." +"If any :data:`!Placeholder` sentinels are present, all must be filled at " +"call time:" msgstr "" -"回傳一個新的 :class:`partialmethod` 描述器 (descriptor),其行為類似於 :class:" -"`partial`,只不過它被設計為用於方法定義而不能直接呼叫。" -#: ../../library/functools.rst:374 +#: ../../library/functools.rst:382 +msgid "" +">>> say_to_world = partial(print, Placeholder, Placeholder, \"world!\")\n" +">>> say_to_world('Hello', 'dear')\n" +"Hello dear world!" +msgstr "" + +#: ../../library/functools.rst:388 +msgid "" +"Calling ``say_to_world('Hello')`` raises a :exc:`TypeError`, because only " +"one positional argument is provided, but there are two placeholders that " +"must be filled in." +msgstr "" + +#: ../../library/functools.rst:392 +msgid "" +"If :func:`!partial` is applied to an existing :func:`!partial` " +"object, :data:`!Placeholder` sentinels of the input object are filled in " +"with new positional arguments. A placeholder can be retained by inserting a " +"new :data:`!Placeholder` sentinel to the place held by a previous :data:`!" +"Placeholder`:" +msgstr "" + +#: ../../library/functools.rst:398 +msgid "" +">>> from functools import partial, Placeholder as _\n" +">>> remove = partial(str.replace, _, _, '')\n" +">>> message = 'Hello, dear dear world!'\n" +">>> remove(message, ' dear')\n" +"'Hello, world!'\n" +">>> remove_dear = partial(remove, _, ' dear')\n" +">>> remove_dear(message)\n" +"'Hello, world!'\n" +">>> remove_first_dear = partial(remove_dear, _, 1)\n" +">>> remove_first_dear(message)\n" +"'Hello, dear world!'" +msgstr "" + +#: ../../library/functools.rst:412 +msgid "" +":data:`!Placeholder` cannot be passed to :func:`!partial` as a keyword " +"argument." +msgstr "" + +#: ../../library/functools.rst:414 +msgid "Added support for :data:`Placeholder` in positional arguments." +msgstr "" + +#: ../../library/functools.rst:419 +msgid "" +"Return a new :class:`partialmethod` descriptor which behaves " +"like :class:`partial` except that it is designed to be used as a method " +"definition rather than being directly callable." +msgstr "" +"回傳一個新的 :class:`partialmethod` 描述器 (descriptor),其行為類似" +"於 :class:`partial`,只不過它被設計為用於方法定義而不能直接呼叫。" + +#: ../../library/functools.rst:423 msgid "" "*func* must be a :term:`descriptor` or a callable (objects which are both, " "like normal functions, are handled as descriptors)." @@ -662,33 +744,34 @@ msgstr "" "*func* 必須是一個 :term:`descriptor` 或可呼叫物件(兩者兼具的物件,就像普通函" "式一樣,會被當作描述器處理)。" -#: ../../library/functools.rst:377 +#: ../../library/functools.rst:426 msgid "" -"When *func* is a descriptor (such as a normal Python function, :func:" -"`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` or another " -"instance of :class:`partialmethod`), calls to ``__get__`` are delegated to " -"the underlying descriptor, and an appropriate :ref:`partial object` returned as the result." +"When *func* is a descriptor (such as a normal Python " +"function, :func:`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` " +"or another instance of :class:`partialmethod`), calls to ``__get__`` are " +"delegated to the underlying descriptor, and an appropriate :ref:`partial " +"object` returned as the result." msgstr "" -"當 *func* 是描述器時(例如普通的 Python 函式、:func:`classmethod`、:func:" -"`staticmethod`、:func:`~abc.abstractmethod` 或 :class:`partialmethod` 的另一個實" -"例),對 ``__get__`` 的呼叫將被委託 (delegated) 給底層描述器,且一個適當的 :" -"ref:`partial 物件 `\\ 會被作為結果回傳。" +"當 *func* 是描述器時(例如普通的 Python 函" +"式、:func:`classmethod`、:func:`staticmethod`、:func:`~abc.abstractmethod` " +"或 :class:`partialmethod` 的另一個實例),對 ``__get__`` 的呼叫將被委託 " +"(delegated) 給底層描述器,且一個適當的 :ref:`partial 物件 `\\ 會被作為結果回傳。" -#: ../../library/functools.rst:383 +#: ../../library/functools.rst:432 msgid "" "When *func* is a non-descriptor callable, an appropriate bound method is " "created dynamically. This behaves like a normal Python function when used as " "a method: the *self* argument will be inserted as the first positional " -"argument, even before the *args* and *keywords* supplied to the :class:" -"`partialmethod` constructor." +"argument, even before the *args* and *keywords* supplied to " +"the :class:`partialmethod` constructor." msgstr "" "當 *func* 是非描述器可呼叫物件 (non-descriptor callable) 時,會動態建立適當的" "繫結方法 (bound method)。當被作為方法使用時,其行為類似於普通的 Python 函式:" "*self* 引數將作為第一個位置引數插入,甚至會在提供給 :class:`partialmethod` 建" "構函式的 *args* 和 *keywords* 的前面。" -#: ../../library/functools.rst:391 +#: ../../library/functools.rst:440 msgid "" ">>> class Cell:\n" "... def __init__(self):\n" @@ -726,7 +809,7 @@ msgstr "" ">>> c.alive\n" "True" -#: ../../library/functools.rst:414 +#: ../../library/functools.rst:463 msgid "" "Apply *function* of two arguments cumulatively to the items of *iterable*, " "from left to right, so as to reduce the iterable to a single value. For " @@ -745,15 +828,16 @@ msgstr "" "物件的項目之前,並在可疊代物件為空時作為預設值。如果未給定 *initial* 且 " "*iterable* 僅包含一個項目,則回傳第一個項目。" -#: ../../library/functools.rst:423 +#: ../../library/functools.rst:472 msgid "Roughly equivalent to::" msgstr "大致相當於: ::" -#: ../../library/functools.rst:425 +#: ../../library/functools.rst:474 +#, fuzzy msgid "" "initial_missing = object()\n" "\n" -"def reduce(function, iterable, initial=initial_missing, /):\n" +"def reduce(function, iterable, /, initial=initial_missing):\n" " it = iter(iterable)\n" " if initial is initial_missing:\n" " value = next(it)\n" @@ -775,7 +859,7 @@ msgstr "" " value = function(value, element)\n" " return value" -#: ../../library/functools.rst:437 +#: ../../library/functools.rst:486 msgid "" "See :func:`itertools.accumulate` for an iterator that yields all " "intermediate values." @@ -783,15 +867,19 @@ msgstr "" "請參閱 :func:`itertools.accumulate` 以了解產生 (yield) 所有中間值 " "(intermediate value) 的疊代器。" -#: ../../library/functools.rst:442 +#: ../../library/functools.rst:489 +msgid "*initial* is now supported as a keyword argument." +msgstr "" + +#: ../../library/functools.rst:494 msgid "" -"Transform a function into a :term:`single-dispatch ` :term:" -"`generic function`." +"Transform a function into a :term:`single-dispatch ` :term:`generic function`." msgstr "" "將函式轉換為\\ :term:`單一調度 `\\ :term:`泛型函式 `。" -#: ../../library/functools.rst:445 +#: ../../library/functools.rst:497 msgid "" "To define a generic function, decorate it with the ``@singledispatch`` " "decorator. When defining a function using ``@singledispatch``, note that the " @@ -801,7 +889,7 @@ msgstr "" "``@singledispatch`` 定義函式時,分派調度 (dispatch) 是發生在第一個引數的型別" "上: ::" -#: ../../library/functools.rst:449 +#: ../../library/functools.rst:501 msgid "" ">>> from functools import singledispatch\n" ">>> @singledispatch\n" @@ -817,7 +905,7 @@ msgstr "" "... print(\"Let me just say,\", end=\" \")\n" "... print(arg)" -#: ../../library/functools.rst:459 +#: ../../library/functools.rst:511 msgid "" "To add overloaded implementations to the function, use the :func:`!register` " "attribute of the generic function, which can be used as a decorator. For " @@ -827,7 +915,7 @@ msgstr "" "若要為函式新增過載實作,請使用泛型函式的 :func:`!register` 屬性,該屬性可用作" "裝飾器。對於以型別來註釋的函式,裝飾器將自動推斷第一個引數的型別: ::" -#: ../../library/functools.rst:464 +#: ../../library/functools.rst:516 msgid "" ">>> @fun.register\n" "... def _(arg: int, verbose=False):\n" @@ -855,11 +943,12 @@ msgstr "" "... for i, elem in enumerate(arg):\n" "... print(i, elem)" -#: ../../library/functools.rst:477 -msgid ":data:`types.UnionType` and :data:`typing.Union` can also be used::" +#: ../../library/functools.rst:529 +#, fuzzy +msgid ":class:`typing.Union` can also be used::" msgstr "也可以使用 :data:`types.UnionType` 和 :data:`typing.Union`: ::" -#: ../../library/functools.rst:479 +#: ../../library/functools.rst:531 msgid "" ">>> @fun.register\n" "... def _(arg: int | float, verbose=False):\n" @@ -891,14 +980,14 @@ msgstr "" "... print(i, elem)\n" "..." -#: ../../library/functools.rst:494 +#: ../../library/functools.rst:546 msgid "" "For code which doesn't use type annotations, the appropriate type argument " "can be passed explicitly to the decorator itself::" msgstr "" "對於不使用型別註釋的程式碼,可以將適當的型別引數明確傳遞給裝飾器本身: ::" -#: ../../library/functools.rst:497 +#: ../../library/functools.rst:549 msgid "" ">>> @fun.register(complex)\n" "... def _(arg, verbose=False):\n" @@ -914,7 +1003,7 @@ msgstr "" "... print(arg.real, arg.imag)\n" "..." -#: ../../library/functools.rst:504 +#: ../../library/functools.rst:556 msgid "" "For code that dispatches on a collections type (e.g., ``list``), but wants " "to typehint the items of the collection (e.g., ``list[int]``), the dispatch " @@ -922,7 +1011,7 @@ msgid "" "going into the function definition::" msgstr "" -#: ../../library/functools.rst:509 +#: ../../library/functools.rst:561 msgid "" ">>> @fun.register(list)\n" "... def _(arg: list[int], verbose=False):\n" @@ -938,7 +1027,7 @@ msgstr "" "... for i, elem in enumerate(arg):\n" "... print(i, elem)" -#: ../../library/functools.rst:518 +#: ../../library/functools.rst:570 msgid "" "At runtime the function will dispatch on an instance of a list regardless of " "the type contained within the list i.e. ``[1,2,3]`` will be dispatched the " @@ -946,16 +1035,16 @@ msgid "" "example is for static type checkers only and has no runtime impact." msgstr "" -#: ../../library/functools.rst:524 +#: ../../library/functools.rst:576 msgid "" "To enable registering :term:`lambdas` and pre-existing functions, " "the :func:`~singledispatch.register` attribute can also be used in a " "functional form::" msgstr "" -"若要啟用註冊 :term:`lambdas` 和預先存在的函式,:func:`~singledispatch.register` " -"屬性也能以函式形式使用: ::" +"若要啟用註冊 :term:`lambdas` 和預先存在的函" +"式,:func:`~singledispatch.register` 屬性也能以函式形式使用: ::" -#: ../../library/functools.rst:527 +#: ../../library/functools.rst:579 msgid "" ">>> def nothing(arg, verbose=False):\n" "... print(\"Nothing.\")\n" @@ -967,16 +1056,17 @@ msgstr "" "...\n" ">>> fun.register(type(None), nothing)" -#: ../../library/functools.rst:532 +#: ../../library/functools.rst:584 msgid "" "The :func:`~singledispatch.register` attribute returns the undecorated " "function. This enables decorator stacking, :mod:`pickling`, and the " "creation of unit tests for each variant independently::" msgstr "" -":func:`~singledispatch.register` 屬性回傳未加裝飾器的函式。這讓使得裝飾器堆疊 (decorator " -"stacking)、:mod:`pickling` 以及為每個變體獨立建立單元測試成為可能:" +":func:`~singledispatch.register` 屬性回傳未加裝飾器的函式。這讓使得裝飾器堆" +"疊 (decorator stacking)、:mod:`pickling` 以及為每個變體獨立建立單元測" +"試成為可能:" -#: ../../library/functools.rst:536 +#: ../../library/functools.rst:588 msgid "" ">>> @fun.register(float)\n" "... @fun.register(Decimal)\n" @@ -998,13 +1088,13 @@ msgstr "" ">>> fun_num is fun\n" "False" -#: ../../library/functools.rst:546 +#: ../../library/functools.rst:598 msgid "" "When called, the generic function dispatches on the type of the first " "argument::" msgstr "呼叫時,泛型函式會分派第一個引數的型別: ::" -#: ../../library/functools.rst:549 +#: ../../library/functools.rst:601 msgid "" ">>> fun(\"Hello, world.\")\n" "Hello, world.\n" @@ -1040,19 +1130,19 @@ msgstr "" ">>> fun(1.23)\n" "0.615" -#: ../../library/functools.rst:566 +#: ../../library/functools.rst:618 msgid "" "Where there is no registered implementation for a specific type, its method " "resolution order is used to find a more generic implementation. The original " -"function decorated with ``@singledispatch`` is registered for the base :" -"class:`object` type, which means it is used if no better implementation is " -"found." +"function decorated with ``@singledispatch`` is registered for the " +"base :class:`object` type, which means it is used if no better " +"implementation is found." msgstr "" "如果沒有為特定型別註冊實作,則使用其方法解析順序 (method resolution order) 來" -"尋找更通用的實作。用 ``@singledispatch`` 裝飾的原始函式是為基底 :class:" -"`object` 型別註冊的,這意味著如果沒有找到更好的實作就會使用它。" +"尋找更通用的實作。用 ``@singledispatch`` 裝飾的原始函式是為基" +"底 :class:`object` 型別註冊的,這意味著如果沒有找到更好的實作就會使用它。" -#: ../../library/functools.rst:572 +#: ../../library/functools.rst:624 msgid "" "If an implementation is registered to an :term:`abstract base class`, " "virtual subclasses of the base class will be dispatched to that " @@ -1061,7 +1151,7 @@ msgstr "" "如果一個實作有被註冊到一個\\ :term:`抽象基底類別 `,則基" "底類別的虛擬子類別將被分派到該實作: ::" -#: ../../library/functools.rst:576 +#: ../../library/functools.rst:628 msgid "" ">>> from collections.abc import Mapping\n" ">>> @fun.register\n" @@ -1085,14 +1175,14 @@ msgstr "" ">>> fun({\"a\": \"b\"})\n" "a => b" -#: ../../library/functools.rst:587 +#: ../../library/functools.rst:639 msgid "" "To check which implementation the generic function will choose for a given " "type, use the ``dispatch()`` attribute::" msgstr "" "若要檢查泛型函式將為給定型別選擇哪種實作,請使用 ``dispatch()`` 屬性: ::" -#: ../../library/functools.rst:590 +#: ../../library/functools.rst:642 msgid "" ">>> fun.dispatch(float)\n" "\n" @@ -1100,13 +1190,13 @@ msgid "" "" msgstr "" -#: ../../library/functools.rst:595 +#: ../../library/functools.rst:647 msgid "" "To access all registered implementations, use the read-only ``registry`` " "attribute::" msgstr "若要存取所有已註冊的實作,請使用唯讀 ``registry`` 屬性: ::" -#: ../../library/functools.rst:598 +#: ../../library/functools.rst:650 msgid "" ">>> fun.registry.keys()\n" "dict_keys([, , ,\n" @@ -1126,29 +1216,28 @@ msgstr "" ">>> fun.registry[object]\n" "" -#: ../../library/functools.rst:609 +#: ../../library/functools.rst:661 msgid "" "The :func:`~singledispatch.register` attribute now supports using type " "annotations." msgstr ":func:`~singledispatch.register` 屬性現在支援使用型別註釋。" -#: ../../library/functools.rst:612 +#: ../../library/functools.rst:664 +#, fuzzy msgid "" -"The :func:`~singledispatch.register` attribute now supports :data:`types." -"UnionType` and :data:`typing.Union` as type annotations." -msgstr "" -":func:`~singledispatch.register` 屬性現在支援以 :data:`types.UnionType` 和 :data:`typing." -"Union` 作為型別註釋。" +"The :func:`~singledispatch.register` attribute now " +"supports :class:`typing.Union` as a type annotation." +msgstr ":func:`~singledispatch.register` 屬性現在支援使用型別註釋。" -#: ../../library/functools.rst:619 +#: ../../library/functools.rst:671 msgid "" -"Transform a method into a :term:`single-dispatch ` :term:" -"`generic function`." +"Transform a method into a :term:`single-dispatch ` :term:`generic function`." msgstr "" "將方法轉換為\\ :term:`單一調度 `\\ :term:`泛型函式 `。" -#: ../../library/functools.rst:622 +#: ../../library/functools.rst:674 msgid "" "To define a generic method, decorate it with the ``@singledispatchmethod`` " "decorator. When defining a function using ``@singledispatchmethod``, note " @@ -1159,7 +1248,7 @@ msgstr "" "用 ``@singledispatchmethod`` 定義函式時,分派調度是發生在第一個非 *self* 或" "非 *cls* 引數的型別上: ::" -#: ../../library/functools.rst:627 +#: ../../library/functools.rst:679 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1187,20 +1276,20 @@ msgstr "" " def _(self, arg: bool):\n" " return not arg" -#: ../../library/functools.rst:640 +#: ../../library/functools.rst:692 msgid "" -"``@singledispatchmethod`` supports nesting with other decorators such as :" -"func:`@classmethod`. Note that to allow for ``dispatcher." -"register``, ``singledispatchmethod`` must be the *outer most* decorator. " -"Here is the ``Negator`` class with the ``neg`` methods bound to the class, " -"rather than an instance of the class::" +"``@singledispatchmethod`` supports nesting with other decorators such " +"as :func:`@classmethod`. Note that to allow for " +"``dispatcher.register``, ``singledispatchmethod`` must be the *outer most* " +"decorator. Here is the ``Negator`` class with the ``neg`` methods bound to " +"the class, rather than an instance of the class::" msgstr "" -"``@singledispatchmethod`` 支援與其他裝飾器巢狀使用 (nesting),例如 :func:" -"`@classmethod`。請注意,為了使 ``dispatcher.register`` 可用," -"``singledispatchmethod`` 必須是\\ *最外面的*\\ 裝飾器。以下範例是 " +"``@singledispatchmethod`` 支援與其他裝飾器巢狀使用 (nesting),例" +"如 :func:`@classmethod`。請注意,為了使 ``dispatcher.register`` " +"可用,``singledispatchmethod`` 必須是\\ *最外面的*\\ 裝飾器。以下範例是 " "``Negator`` 類別,其 ``neg`` 方法繫結到該類別,而不是該類別的實例: ::" -#: ../../library/functools.rst:646 +#: ../../library/functools.rst:698 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1234,16 +1323,17 @@ msgstr "" " def _(cls, arg: bool):\n" " return not arg" -#: ../../library/functools.rst:662 +#: ../../library/functools.rst:714 msgid "" -"The same pattern can be used for other similar decorators: :func:" -"`@staticmethod`, :func:`@abstractmethod`, " +"The same pattern can be used for other similar " +"decorators: :func:`@staticmethod`, :func:`@abstractmethod`, " "and others." msgstr "" -"相同的模式可用於其他類似的裝飾器::func:`@staticmethod`、:func:" -"`@abstractmethod` 等。" +"相同的模式可用於其他類似的裝飾" +"器::func:`@staticmethod`、:func:`@abstractmethod` " +"等。" -#: ../../library/functools.rst:671 +#: ../../library/functools.rst:723 msgid "" "Update a *wrapper* function to look like the *wrapped* function. The " "optional arguments are tuples to specify which attributes of the original " @@ -1251,23 +1341,21 @@ msgid "" "function and which attributes of the wrapper function are updated with the " "corresponding attributes from the original function. The default values for " "these arguments are the module level constants ``WRAPPER_ASSIGNMENTS`` " -"(which assigns to the wrapper function's :attr:`~function.__module__`, :attr:" -"`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function." -"__annotations__`, :attr:`~function.__type_params__`, and :attr:`~function." -"__doc__`, the documentation string) and ``WRAPPER_UPDATES`` (which updates " -"the wrapper function's :attr:`~function.__dict__`, i.e. the instance " -"dictionary)." +"(which assigns to the wrapper " +"function's :attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__annotations__`, :attr:`~function.__type_params__`, " +"and :attr:`~function.__doc__`, the documentation string) and " +"``WRAPPER_UPDATES`` (which updates the wrapper " +"function's :attr:`~function.__dict__`, i.e. the instance dictionary)." msgstr "" "更新 *wrapper* 函式,使其看起來像 *wrapped* 函式。可選引數是元組,用於指定原" "始函式的哪些屬性直接賦值給包裝函式上的匹配屬性,以及包裝函式的哪些屬性使用原" "始函式中的對應屬性進行更新。這些引數的預設值是模組層級的常數 " -"``WRAPPER_ASSIGNMENTS``\\ (它賦值給包裝函式的 :attr:`~function." -"__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:" -"attr:`~function.__annotations__`、:attr:`~function.__type_params__` 和 :attr:" -"`~function.__doc__` 文件字串 (docstring))和 ``WRAPPER_UPDATES``\\ (更新包" -"裝器函式的 :attr:`~function.__dict__`,即實例字典)。" +"``WRAPPER_ASSIGNMENTS``\\ (它賦值給包裝函式" +"的 :attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__annotations__`、:attr:`~function.__type_params__` " +"和 :attr:`~function.__doc__` 文件字串 (docstring))和 ``WRAPPER_UPDATES``\\ " +"(更新包裝器函式的 :attr:`~function.__dict__`,即實例字典)。" -#: ../../library/functools.rst:683 +#: ../../library/functools.rst:735 msgid "" "To allow access to the original function for introspection and other " "purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), " @@ -1278,7 +1366,7 @@ msgstr "" "飾器,如 :func:`lru_cache`),此函式會自動向包裝器新增 ``__wrapped__`` 屬性," "該包裝器參照被包裝的函式。" -#: ../../library/functools.rst:688 +#: ../../library/functools.rst:740 msgid "" "The main intended use for this function is in :term:`decorator` functions " "which wrap the decorated function and return the wrapper. If the wrapper " @@ -1290,7 +1378,7 @@ msgstr "" "裝器函式未更新,則回傳函式的元資料 (metadata) 將反映包裝器定義而非原始函式定" "義,這通常不太會有幫助。" -#: ../../library/functools.rst:694 +#: ../../library/functools.rst:746 msgid "" ":func:`update_wrapper` may be used with callables other than functions. Any " "attributes named in *assigned* or *updated* that are missing from the object " @@ -1303,30 +1391,31 @@ msgstr "" "器函式上設定它們)。如果包裝函式本身缺少 *updated* 中指定的任何屬性,仍然會引" "發 :exc:`AttributeError`。" -#: ../../library/functools.rst:700 +#: ../../library/functools.rst:752 msgid "" -"The ``__wrapped__`` attribute is now automatically added. The :attr:" -"`~function.__annotations__` attribute is now copied by default. Missing " -"attributes no longer trigger an :exc:`AttributeError`." +"The ``__wrapped__`` attribute is now automatically added. " +"The :attr:`~function.__annotations__` attribute is now copied by default. " +"Missing attributes no longer trigger an :exc:`AttributeError`." msgstr "" -"現在會自動新增 ``__wrapped__`` 屬性。現在預設會複製 :attr:`~function." -"__annotations__` 屬性。缺少的屬性不再觸發 :exc:`AttributeError`。" +"現在會自動新增 ``__wrapped__`` 屬性。現在預設會複" +"製 :attr:`~function.__annotations__` 屬性。缺少的屬性不再觸" +"發 :exc:`AttributeError`。" -#: ../../library/functools.rst:705 +#: ../../library/functools.rst:757 msgid "" "The ``__wrapped__`` attribute now always refers to the wrapped function, " -"even if that function defined a ``__wrapped__`` attribute. (see :issue:" -"`17482`)" +"even if that function defined a ``__wrapped__`` attribute. " +"(see :issue:`17482`)" msgstr "" "``__wrapped__`` 屬性現在都會參照包裝函式,即便函式有定義 ``__wrapped__`` 屬" "性。(參見 :issue:`17482`)" -#: ../../library/functools.rst:710 +#: ../../library/functools.rst:762 msgid "" "The :attr:`~function.__type_params__` attribute is now copied by default." msgstr "現在預設會複製 :attr:`~function.__type_params__` 屬性。" -#: ../../library/functools.rst:716 +#: ../../library/functools.rst:768 msgid "" "This is a convenience function for invoking :func:`update_wrapper` as a " "function decorator when defining a wrapper function. It is equivalent to " @@ -1337,7 +1426,7 @@ msgstr "" "式裝飾器。它相當於 ``partial(update_wrapper, wrapped=wrapped, " "assigned=assigned, updated=updated)``。例如: ::" -#: ../../library/functools.rst:721 +#: ../../library/functools.rst:773 msgid "" ">>> from functools import wraps\n" ">>> def my_decorator(f):\n" @@ -1361,7 +1450,7 @@ msgid "" "'Docstring'" msgstr "" -#: ../../library/functools.rst:742 +#: ../../library/functools.rst:794 msgid "" "Without the use of this decorator factory, the name of the example function " "would have been ``'wrapper'``, and the docstring of the original :func:`!" @@ -1370,11 +1459,11 @@ msgstr "" "如果不使用這個裝飾器工廠 (decorator factory),範例函式的名稱將會是 " "``'wrapper'``,並且原始 :func:`!example` 的文件字串將會遺失。" -#: ../../library/functools.rst:750 +#: ../../library/functools.rst:802 msgid ":class:`partial` Objects" msgstr ":class:`partial` 物件" -#: ../../library/functools.rst:752 +#: ../../library/functools.rst:804 msgid "" ":class:`partial` objects are callable objects created by :func:`partial`. " "They have three read-only attributes:" @@ -1382,7 +1471,7 @@ msgstr "" ":class:`partial` 物件是由 :func:`partial` 所建立的可呼叫物件。它們有三個唯讀" "屬性:" -#: ../../library/functools.rst:758 +#: ../../library/functools.rst:810 msgid "" "A callable object or function. Calls to the :class:`partial` object will be " "forwarded to :attr:`func` with new arguments and keywords." @@ -1390,7 +1479,7 @@ msgstr "" "一個可呼叫的物件或函式。對 :class:`partial` 物件的呼叫將被轉送到帶有新引數和" "關鍵字的 :attr:`func`。" -#: ../../library/functools.rst:764 +#: ../../library/functools.rst:816 msgid "" "The leftmost positional arguments that will be prepended to the positional " "arguments provided to a :class:`partial` object call." @@ -1398,24 +1487,31 @@ msgstr "" "最左邊的位置引數將會被加入到提供給 :class:`partial` 物件呼叫的位置引數的前" "面。" -#: ../../library/functools.rst:770 +#: ../../library/functools.rst:822 msgid "" "The keyword arguments that will be supplied when the :class:`partial` object " "is called." msgstr "呼叫 :class:`partial` 物件時將提供的關鍵字引數。" -#: ../../library/functools.rst:773 +#: ../../library/functools.rst:825 +#, fuzzy msgid "" ":class:`partial` objects are like :ref:`function objects ` in that they are callable, weak referenceable, and can have " -"attributes. There are some important differences. For instance, the :attr:" -"`~function.__name__` and :attr:`function.__doc__` attributes are not created " -"automatically. Also, :class:`partial` objects defined in classes behave " -"like static methods and do not transform into bound methods during instance " -"attribute look-up." +"attributes. There are some important differences. For instance, " +"the :attr:`~definition.__name__` and :attr:`~definition.__doc__` attributes " +"are not created automatically." msgstr "" ":class:`partial` 物件與\\ :ref:`函式物件 `\\ 類似,因為它" "們是可呼叫的、可弱參照的 (weak referencable) 且可以具有屬性。有一些重要的區" "別,例如,:attr:`~function.__name__` 和 :attr:`function.__doc__` 屬性不會自動" "建立。此外,類別中定義的 :class:`partial` 物件的行為類似於靜態方法,並且在實" "例屬性查找期間不會轉換為繫結方法。" + +#~ msgid "" +#~ "The :func:`~singledispatch.register` attribute now " +#~ "supports :data:`types.UnionType` and :data:`typing.Union` as type " +#~ "annotations." +#~ msgstr "" +#~ ":func:`~singledispatch.register` 屬性現在支援以 :data:`types.UnionType` " +#~ "和 :data:`typing.Union` 作為型別註釋。" diff --git a/library/gc.po b/library/gc.po index 78ce3ab4e88..62e6600b51a 100644 --- a/library/gc.po +++ b/library/gc.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-01 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-04-24 21:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -63,17 +63,36 @@ msgid "Return ``True`` if automatic collection is enabled." msgstr "如果啟用了自動回收則回傳 ``True``。" #: ../../library/gc.rst:43 +#, fuzzy msgid "" -"With no arguments, run a full collection. The optional argument " -"*generation* may be an integer specifying which generation to collect (from " -"0 to 2). A :exc:`ValueError` is raised if the generation number is invalid. " -"The sum of collected objects and uncollectable objects is returned." +"Perform a collection. The optional argument *generation* may be an integer " +"specifying which generation to collect (from 0 to 2). A :exc:`ValueError` " +"is raised if the generation number is invalid. The sum of collected objects " +"and uncollectable objects is returned." msgstr "" "若被呼叫時沒有引數,則啟動完整垃圾回收。可選的引數 *generation* 可以是一個指" -"明需要回收哪一代垃圾的整數(從 0 到 2)。當引數 *generation* 無效時,會引發 :" -"exc:`ValueError` 例外。發現的不可達物件數目會被回傳。" +"明需要回收哪一代垃圾的整數(從 0 到 2)。當引數 *generation* 無效時,會引" +"發 :exc:`ValueError` 例外。發現的不可達物件數目會被回傳。" #: ../../library/gc.rst:48 +#, fuzzy +msgid "" +"Calling ``gc.collect(0)`` will perform a GC collection on the young " +"generation." +msgstr "當直譯器已經執行收集時呼叫 ``gc.collect()`` 的效果是未定義的。" + +#: ../../library/gc.rst:50 +msgid "" +"Calling ``gc.collect(1)`` will perform a GC collection on the young " +"generation and an increment of the old generation." +msgstr "" + +#: ../../library/gc.rst:53 +msgid "" +"Calling ``gc.collect(2)`` or ``gc.collect()`` performs a full collection" +msgstr "" + +#: ../../library/gc.rst:55 msgid "" "The free lists maintained for a number of built-in types are cleared " "whenever a full collection or collection of the highest generation (2) is " @@ -84,13 +103,17 @@ msgstr "" "為了特定型別的實現,特別是 :class:`float`,在某些空閒列表中並非所有項目都會被" "釋放。" -#: ../../library/gc.rst:53 +#: ../../library/gc.rst:60 msgid "" "The effect of calling ``gc.collect()`` while the interpreter is already " "performing a collection is undefined." msgstr "當直譯器已經執行收集時呼叫 ``gc.collect()`` 的效果是未定義的。" -#: ../../library/gc.rst:59 +#: ../../library/gc.rst:63 +msgid "``generation=1`` performs an increment of collection." +msgstr "" + +#: ../../library/gc.rst:69 msgid "" "Set the garbage collection debugging flags. Debugging information will be " "written to ``sys.stderr``. See below for a list of debugging flags which " @@ -99,24 +122,43 @@ msgstr "" "設定垃圾回收器的除錯旗標。除錯資訊會被寫入 ``sys.stderr``。請見下方的除錯旗標" "列表,可以使用位元操作 (bit operation) 進行設定以控制除錯程式。" -#: ../../library/gc.rst:66 +#: ../../library/gc.rst:76 msgid "Return the debugging flags currently set." msgstr "回傳目前設置的除錯旗標。" -#: ../../library/gc.rst:71 +#: ../../library/gc.rst:82 +#, fuzzy msgid "" "Returns a list of all objects tracked by the collector, excluding the list " -"returned. If *generation* is not ``None``, return only the objects tracked " -"by the collector that are in that generation." +"returned. If *generation* is not ``None``, return only the objects as " +"follows:" msgstr "" "回傳一個包含回收器正在追蹤的所有物件的 list,除去所回傳的 list。如果 " "*generation* 不為 ``None``,只回傳回收器正在追蹤且屬於該代的物件。" -#: ../../library/gc.rst:75 +#: ../../library/gc.rst:85 +#, fuzzy +msgid "0: All objects in the young generation" +msgstr "回傳永久代中的物件數量。" + +#: ../../library/gc.rst:86 +msgid "1: No objects, as there is no generation 1 (as of Python 3.14)" +msgstr "" + +#: ../../library/gc.rst:87 +#, fuzzy +msgid "2: All objects in the old generation" +msgstr "回傳永久代中的物件數量。" + +#: ../../library/gc.rst:89 msgid "New *generation* parameter." msgstr "新增 *generation* 參數。" -#: ../../library/gc.rst:78 +#: ../../library/gc.rst:92 +msgid "Generation 1 is removed" +msgstr "" + +#: ../../library/gc.rst:95 msgid "" "Raises an :ref:`auditing event ` ``gc.get_objects`` with argument " "``generation``." @@ -124,7 +166,7 @@ msgstr "" "引發一個附帶引數 ``generation`` 的\\ :ref:`稽核事件 (auditing event) " "` ``gc.get_objects``。" -#: ../../library/gc.rst:82 +#: ../../library/gc.rst:99 msgid "" "Return a list of three per-generation dictionaries containing collection " "statistics since interpreter start. The number of keys may change in the " @@ -134,73 +176,91 @@ msgstr "" "的垃圾回收統計資料。字典的鍵的數目在將來可能會改變,但目前每個字典包含以下項" "目:" -#: ../../library/gc.rst:87 +#: ../../library/gc.rst:104 msgid "``collections`` is the number of times this generation was collected;" msgstr "``collections`` 是該代被回收的次數;" -#: ../../library/gc.rst:89 +#: ../../library/gc.rst:106 msgid "" "``collected`` is the total number of objects collected inside this " "generation;" msgstr "``collected`` 是該代中被回收的物件總數;" -#: ../../library/gc.rst:92 +#: ../../library/gc.rst:109 msgid "" "``uncollectable`` is the total number of objects which were found to be " "uncollectable (and were therefore moved to the :data:`garbage` list) inside " "this generation." msgstr "" -"``uncollectable`` 是在這一代中被發現無法回收的物件總數(因此被移到 :data:" -"`garbage` list 中)。" +"``uncollectable`` 是在這一代中被發現無法回收的物件總數(因此被移" +"到 :data:`garbage` list 中)。" -#: ../../library/gc.rst:101 +#: ../../library/gc.rst:118 msgid "" "Set the garbage collection thresholds (the collection frequency). Setting " "*threshold0* to zero disables collection." msgstr "設定垃圾回收閾值(回收頻率)。 將 *threshold0* 設為零會停止回收。" -#: ../../library/gc.rst:104 +#: ../../library/gc.rst:121 msgid "" -"The GC classifies objects into three generations depending on how many " -"collection sweeps they have survived. New objects are placed in the " -"youngest generation (generation ``0``). If an object survives a collection " -"it is moved into the next older generation. Since generation ``2`` is the " -"oldest generation, objects in that generation remain there after a " -"collection. In order to decide when to run, the collector keeps track of " -"the number object allocations and deallocations since the last collection. " -"When the number of allocations minus the number of deallocations exceeds " -"*threshold0*, collection starts. Initially only generation ``0`` is " -"examined. If generation ``0`` has been examined more than *threshold1* " -"times since generation ``1`` has been examined, then generation ``1`` is " -"examined as well. With the third generation, things are a bit more " -"complicated, see `Collecting the oldest generation `_ for more " -"information." -msgstr "" -"垃圾回收器會根據物件在多少次垃圾回收後仍倖存來把所有物件分類為三代。新建物件" -"會被放在最年輕代(第 ``0`` 代)。 如果一個物件在一次垃圾回收後倖存,它會被移" -"入下一個較老代。由於第 ``2`` 代是最老代,這一代的物件在一次垃圾回收後仍會保留" -"原樣。為了確定何時要執行,垃圾回收器會追蹤自上一次回收後物件分配和釋放的數" -"量。當分配數量減去釋放數量的結果大於 *threshold0* 時,垃圾回收就會開始。初始" -"時只有第 ``0`` 代會被檢查。如果自第 ``1`` 代被檢查後第 ``0`` 代已被檢查超過 " -"*threshold1* 次,則第 ``1`` 代也會被檢查。對於第三代來說,情況還會更復雜一" -"些,請參閱 `Collecting the oldest generation `_ 來了解詳情。" +"The GC classifies objects into two generations depending on whether they " +"have survived a collection. New objects are placed in the young generation. " +"If an object survives a collection it is moved into the old generation." +msgstr "" -#: ../../library/gc.rst:121 +#: ../../library/gc.rst:125 +msgid "" +"In order to decide when to run, the collector keeps track of the number of " +"object allocations and deallocations since the last collection. When the " +"number of allocations minus the number of deallocations exceeds " +"*threshold0*, collection starts. For each collection, all the objects in the " +"young generation and some fraction of the old generation is collected." +msgstr "" + +#: ../../library/gc.rst:131 +msgid "" +"In the free-threaded build, the increase in process memory usage is also " +"checked before running the collector. If the memory usage has not increased " +"by 10% since the last collection and the net number of object allocations " +"has not exceeded 40 times *threshold0*, the collection is not run." +msgstr "" + +#: ../../library/gc.rst:136 +msgid "" +"The fraction of the old generation that is collected is **inversely** " +"proportional to *threshold1*. The larger *threshold1* is, the slower objects " +"in the old generation are collected. For the default value of 10, 1% of the " +"old generation is scanned during each collection." +msgstr "" + +#: ../../library/gc.rst:141 +msgid "*threshold2* is ignored." +msgstr "" + +#: ../../library/gc.rst:143 +msgid "" +"See `Garbage collector design `_ for more information." +msgstr "" + +#: ../../library/gc.rst:145 +msgid "*threshold2* is ignored" +msgstr "" + +#: ../../library/gc.rst:151 msgid "" "Return the current collection counts as a tuple of ``(count0, count1, " "count2)``." msgstr "將目前回收計數以 ``(count0, count1, count2)`` 形式的 tuple 回傳。" -#: ../../library/gc.rst:127 +#: ../../library/gc.rst:157 msgid "" "Return the current collection thresholds as a tuple of ``(threshold0, " "threshold1, threshold2)``." msgstr "" "將目前回收閾值以 ``(threshold0, threshold1, threshold2)`` 形式的 tuple 回傳。" -#: ../../library/gc.rst:133 +#: ../../library/gc.rst:163 msgid "" "Return the list of objects that directly refer to any of objs. This function " "will only locate those containers which support garbage collection; " @@ -210,7 +270,7 @@ msgstr "" "回傳包含直接參照 objs 中任一個物件的物件 list。這個函式只定位支援垃圾回收的容" "器;參照了其它物件但不支援垃圾回收的擴充套件型別無法被找到。" -#: ../../library/gc.rst:138 +#: ../../library/gc.rst:168 msgid "" "Note that objects which have already been dereferenced, but which live in " "cycles and have not yet been collected by the garbage collector can be " @@ -221,7 +281,7 @@ msgstr "" "會被作為參照者出現在回傳的 list 中。若只要取得目前正在參照的物件,需要在呼" "叫 :func:`get_referrers` 之前呼叫 :func:`collect`。" -#: ../../library/gc.rst:144 +#: ../../library/gc.rst:174 msgid "" "Care must be taken when using objects returned by :func:`get_referrers` " "because some of them could still be under construction and hence in a " @@ -232,41 +292,42 @@ msgstr "" "在建構中而處於暫時無效的狀態。不要把 :func:`get_referrers` 用於除錯以外的其它" "目的。" -#: ../../library/gc.rst:149 +#: ../../library/gc.rst:179 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referrers`` with " "argument ``objs``." msgstr "" -"引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." -"get_referrers``。" +"引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` " +"``gc.get_referrers``。" -#: ../../library/gc.rst:154 +#: ../../library/gc.rst:184 msgid "" "Return a list of objects directly referred to by any of the arguments. The " -"referents returned are those objects visited by the arguments' C-level :c:" -"member:`~PyTypeObject.tp_traverse` methods (if any), and may not be all " -"objects actually directly reachable. :c:member:`~PyTypeObject.tp_traverse` " -"methods are supported only by objects that support garbage collection, and " -"are only required to visit objects that may be involved in a cycle. So, for " -"example, if an integer is directly reachable from an argument, that integer " -"object may or may not appear in the result list." +"referents returned are those objects visited by the arguments' C-" +"level :c:member:`~PyTypeObject.tp_traverse` methods (if any), and may not be " +"all objects actually directly " +"reachable. :c:member:`~PyTypeObject.tp_traverse` methods are supported only " +"by objects that support garbage collection, and are only required to visit " +"objects that may be involved in a cycle. So, for example, if an integer is " +"directly reachable from an argument, that integer object may or may not " +"appear in the result list." msgstr "" "回傳包含被任意一個引數直接參照之物件的 list。回傳的被參照物件是有被引數的 C " "語言級別 :c:member:`~PyTypeObject.tp_traverse` 方法(若存在)瀏覽到的物件,可" -"能不是所有的實際直接可達物件。只有支援垃圾回收的物件支援 :c:member:" -"`~PyTypeObject.tp_traverse` 方法,並且此方法只會瀏覽涉及參照迴圈的物件。因" -"此,可以有以下例子:一個整數對於一個引數是直接可達的,這個整數物件有可能出現" -"或不出現在結果的 list 當中。" +"能不是所有的實際直接可達物件。只有支援垃圾回收的物件支" +"援 :c:member:`~PyTypeObject.tp_traverse` 方法,並且此方法只會瀏覽涉及參照迴圈" +"的物件。因此,可以有以下例子:一個整數對於一個引數是直接可達的,這個整數物件" +"有可能出現或不出現在結果的 list 當中。" -#: ../../library/gc.rst:162 +#: ../../library/gc.rst:192 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referents`` with " "argument ``objs``." msgstr "" -"引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." -"get_referents``。" +"引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` " +"``gc.get_referents``。" -#: ../../library/gc.rst:166 +#: ../../library/gc.rst:196 msgid "" "Returns ``True`` if the object is currently tracked by the garbage " "collector, ``False`` otherwise. As a general rule, instances of atomic " @@ -280,7 +341,8 @@ msgstr "" "件)會被追蹤。然而,有一些特定型別最佳化會被用來減少垃圾回收器在簡單實例(如" "只含有原子性的鍵和值的字典)上的足跡: ::" -#: ../../library/gc.rst:173 +#: ../../library/gc.rst:203 +#, fuzzy msgid "" ">>> gc.is_tracked(0)\n" "False\n" @@ -291,8 +353,6 @@ msgid "" ">>> gc.is_tracked({})\n" "False\n" ">>> gc.is_tracked({\"a\": 1})\n" -"False\n" -">>> gc.is_tracked({\"a\": []})\n" "True" msgstr "" ">>> gc.is_tracked(0)\n" @@ -308,14 +368,14 @@ msgstr "" ">>> gc.is_tracked({\"a\": []})\n" "True" -#: ../../library/gc.rst:191 +#: ../../library/gc.rst:219 msgid "" "Returns ``True`` if the given object has been finalized by the garbage " "collector, ``False`` otherwise. ::" msgstr "" "如果給定物件已被垃圾回收器終結則回傳 ``True``,否則回傳 ``False``。: ::" -#: ../../library/gc.rst:194 +#: ../../library/gc.rst:222 msgid "" ">>> x = None\n" ">>> class Lazarus:\n" @@ -343,7 +403,7 @@ msgstr "" ">>> gc.is_finalized(x)\n" "True" -#: ../../library/gc.rst:212 +#: ../../library/gc.rst:240 msgid "" "Freeze all the objects tracked by the garbage collector; move them to a " "permanent generation and ignore them in all the future collections." @@ -351,7 +411,7 @@ msgstr "" "凍結 (freeze) 垃圾回收器所追蹤的所有物件;將它們移至永久代並忽略所有未來的收" "集動作。" -#: ../../library/gc.rst:215 +#: ../../library/gc.rst:243 msgid "" "If a process will ``fork()`` without ``exec()``, avoiding unnecessary copy-" "on-write in child processes will maximize memory sharing and reduce overall " @@ -365,27 +425,27 @@ msgstr "" "如果一個行程將在沒有 ``exec()`` 的情況下進行 ``fork()``,避免子行程中不必要的" "寫入時複製將最大化記憶體共享並減少整體記憶體使用。這需要避免在父行程的記憶體" "頁面中建立已釋放的「漏洞」,並確保子行程中的 GC 收集不會觸及源自父行程的長壽" -"命物件的 ``gc_refs`` 計數器。要實現這兩個目標,請在父行程的早期呼叫 ``gc." -"disable()``,在 ``fork()`` 之前呼叫 ``gc.freeze()``,並儘早在子行程中呼叫 " -"``gc.enable()``。" +"命物件的 ``gc_refs`` 計數器。要實現這兩個目標,請在父行程的早期呼叫 " +"``gc.disable()``,在 ``fork()`` 之前呼叫 ``gc.freeze()``,並儘早在子行程中呼" +"叫 ``gc.enable()``。" -#: ../../library/gc.rst:229 +#: ../../library/gc.rst:257 msgid "" "Unfreeze the objects in the permanent generation, put them back into the " "oldest generation." msgstr "解凍 (unfreeze) 永久代中的物件,並將它們放回到最年老代中。" -#: ../../library/gc.rst:237 +#: ../../library/gc.rst:265 msgid "Return the number of objects in the permanent generation." msgstr "回傳永久代中的物件數量。" -#: ../../library/gc.rst:242 +#: ../../library/gc.rst:270 msgid "" "The following variables are provided for read-only access (you can mutate " "the values but should not rebind them):" msgstr "以下變數僅供唯讀存取(你可以修改其值但不應該重新繫結 (rebind) 它們):" -#: ../../library/gc.rst:247 +#: ../../library/gc.rst:275 msgid "" "A list of objects which the collector found to be unreachable but could not " "be freed (uncollectable objects). Starting with Python 3.4, this list " @@ -396,7 +456,7 @@ msgstr "" "開始,該 list 在大多數時候都應該是空的,除非使用了有非 ``NULL`` ``tp_del`` 槽" "位的 C 擴充套件型別的實例。" -#: ../../library/gc.rst:252 +#: ../../library/gc.rst:280 msgid "" "If :const:`DEBUG_SAVEALL` is set, then all unreachable objects will be added " "to this list rather than freed." @@ -404,26 +464,26 @@ msgstr "" "如果設定了 :const:`DEBUG_SAVEALL`,則所有不可達物件將被加進該 list 而不會被釋" "放。" -#: ../../library/gc.rst:255 +#: ../../library/gc.rst:283 msgid "" -"If this list is non-empty at :term:`interpreter shutdown`, a :exc:" -"`ResourceWarning` is emitted, which is silent by default. If :const:" -"`DEBUG_UNCOLLECTABLE` is set, in addition all uncollectable objects are " -"printed." +"If this list is non-empty at :term:`interpreter shutdown`, " +"a :exc:`ResourceWarning` is emitted, which is silent by default. " +"If :const:`DEBUG_UNCOLLECTABLE` is set, in addition all uncollectable " +"objects are printed." msgstr "" -"當 :term:`interpreter shutdown` 即直譯器關閉時,若此 list 非空,會產生 :exc:" -"`ResourceWarning`,在預設情況下此警告不會被提醒。如果設定了 :const:" -"`DEBUG_UNCOLLECTABLE`,所有無法被回收的物件會被印出。" +"當 :term:`interpreter shutdown` 即直譯器關閉時,若此 list 非空,會產" +"生 :exc:`ResourceWarning`,在預設情況下此警告不會被提醒。如果設定" +"了 :const:`DEBUG_UNCOLLECTABLE`,所有無法被回收的物件會被印出。" -#: ../../library/gc.rst:261 +#: ../../library/gc.rst:289 msgid "" "Following :pep:`442`, objects with a :meth:`~object.__del__` method don't " "end up in :data:`gc.garbage` anymore." msgstr "" -"根據 :pep:`442`,帶有 :meth:`~object.__del__` method 的物件最終不會在 :data:" -"`gc.garbage` 內。" +"根據 :pep:`442`,帶有 :meth:`~object.__del__` method 的物件最終不會" +"在 :data:`gc.garbage` 內。" -#: ../../library/gc.rst:267 +#: ../../library/gc.rst:295 msgid "" "A list of callbacks that will be invoked by the garbage collector before and " "after collection. The callbacks will be called with two arguments, *phase* " @@ -432,29 +492,29 @@ msgstr "" "會被垃圾回收器在回收開始前和完成後叫用的一系列回呼函式 (callback) 。這些回呼" "函式在被呼叫時附帶兩個引數:*phase* 和 *info*。" -#: ../../library/gc.rst:271 +#: ../../library/gc.rst:299 msgid "*phase* can be one of two values:" msgstr "*phase* 可為以下兩者之一:" -#: ../../library/gc.rst:273 +#: ../../library/gc.rst:301 msgid "\"start\": The garbage collection is about to start." msgstr "\"start\":垃圾回收即將開始。" -#: ../../library/gc.rst:275 +#: ../../library/gc.rst:303 msgid "\"stop\": The garbage collection has finished." msgstr "\"stop\":垃圾回收已結束。" -#: ../../library/gc.rst:277 +#: ../../library/gc.rst:305 msgid "" "*info* is a dict providing more information for the callback. The following " "keys are currently defined:" msgstr "*info* 是一個字典,提供回呼函式更多資訊。已有定義的鍵有:" -#: ../../library/gc.rst:280 +#: ../../library/gc.rst:308 msgid "\"generation\": The oldest generation being collected." msgstr "\"generation\"(代):正在被回收的最年老的一代。" -#: ../../library/gc.rst:282 +#: ../../library/gc.rst:310 msgid "" "\"collected\": When *phase* is \"stop\", the number of objects successfully " "collected." @@ -462,7 +522,7 @@ msgstr "" "\"collected\"(已回收的):當 *phase* 為 \"stop\" 時,被成功回收的物件的數" "目。" -#: ../../library/gc.rst:285 +#: ../../library/gc.rst:313 msgid "" "\"uncollectable\": When *phase* is \"stop\", the number of objects that " "could not be collected and were put in :data:`garbage`." @@ -470,40 +530,40 @@ msgstr "" "\"uncollectable\"(不可回收的):當 *phase* 為 \"stop\" 時,不能被回收並被放" "入 :data:`garbage` 的物件的數目。" -#: ../../library/gc.rst:288 +#: ../../library/gc.rst:316 msgid "" "Applications can add their own callbacks to this list. The primary use " "cases are:" msgstr "應用程式可以把他們自己的回呼函式加入此 list。主要的使用場景有:" -#: ../../library/gc.rst:291 +#: ../../library/gc.rst:319 msgid "" "Gathering statistics about garbage collection, such as how often various " "generations are collected, and how long the collection takes." msgstr "收集垃圾回收的統計資料,如:不同代的回收頻率、回收任務所花費的時間。" -#: ../../library/gc.rst:295 +#: ../../library/gc.rst:323 msgid "" "Allowing applications to identify and clear their own uncollectable types " "when they appear in :data:`garbage`." msgstr "" "讓應用程式可以識別和清理他們自己在 :data:`garbage` 中的不可回收型別物件。" -#: ../../library/gc.rst:301 +#: ../../library/gc.rst:329 msgid "The following constants are provided for use with :func:`set_debug`:" msgstr "以下常數是為了和 :func:`set_debug` 一起使用所提供:" -#: ../../library/gc.rst:306 +#: ../../library/gc.rst:334 msgid "" "Print statistics during collection. This information can be useful when " "tuning the collection frequency." msgstr "在回收完成後印出統計資訊。當調校回收頻率設定時,這些資訊會很有用。" -#: ../../library/gc.rst:312 +#: ../../library/gc.rst:340 msgid "Print information on collectable objects found." msgstr "當發現可回收物件時印出資訊。" -#: ../../library/gc.rst:317 +#: ../../library/gc.rst:345 msgid "" "Print information of uncollectable objects found (objects which are not " "reachable but cannot be freed by the collector). These objects will be " @@ -512,7 +572,7 @@ msgstr "" "印出找到的不可回收物件的資訊(指不能被回收器回收的不可達物件)。這些物件會被" "新增到 ``garbage`` list 中。" -#: ../../library/gc.rst:321 +#: ../../library/gc.rst:349 msgid "" "Also print the contents of the :data:`garbage` list at :term:`interpreter " "shutdown`, if it isn't empty." @@ -520,7 +580,7 @@ msgstr "" "當 :term:`interpreter shutdown`\\ (直譯器關閉)時,若 :data:`garbage` list " "不是空的,那這些內容也會被印出。" -#: ../../library/gc.rst:327 +#: ../../library/gc.rst:355 msgid "" "When set, all unreachable objects found will be appended to *garbage* rather " "than being freed. This can be useful for debugging a leaking program." @@ -528,7 +588,7 @@ msgstr "" "設定後,所有回收器找到的不可達物件會被加進 *garbage* 而不是直接被釋放。這在為" "一個記憶體流失的程式除錯時會很有用。" -#: ../../library/gc.rst:333 +#: ../../library/gc.rst:361 msgid "" "The debugging flags necessary for the collector to print information about a " "leaking program (equal to ``DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | " @@ -536,3 +596,31 @@ msgid "" msgstr "" "要印出記憶體流失程式之相關資訊時,回收器所需的除錯旗標。(等同於 " "``DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | DEBUG_SAVEALL``)。" + +#~ msgid "" +#~ "The GC classifies objects into three generations depending on how many " +#~ "collection sweeps they have survived. New objects are placed in the " +#~ "youngest generation (generation ``0``). If an object survives a " +#~ "collection it is moved into the next older generation. Since generation " +#~ "``2`` is the oldest generation, objects in that generation remain there " +#~ "after a collection. In order to decide when to run, the collector keeps " +#~ "track of the number object allocations and deallocations since the last " +#~ "collection. When the number of allocations minus the number of " +#~ "deallocations exceeds *threshold0*, collection starts. Initially only " +#~ "generation ``0`` is examined. If generation ``0`` has been examined more " +#~ "than *threshold1* times since generation ``1`` has been examined, then " +#~ "generation ``1`` is examined as well. With the third generation, things " +#~ "are a bit more complicated, see `Collecting the oldest generation " +#~ "`_ for more information." +#~ msgstr "" +#~ "垃圾回收器會根據物件在多少次垃圾回收後仍倖存來把所有物件分類為三代。新建物" +#~ "件會被放在最年輕代(第 ``0`` 代)。 如果一個物件在一次垃圾回收後倖存,它會" +#~ "被移入下一個較老代。由於第 ``2`` 代是最老代,這一代的物件在一次垃圾回收後" +#~ "仍會保留原樣。為了確定何時要執行,垃圾回收器會追蹤自上一次回收後物件分配和" +#~ "釋放的數量。當分配數量減去釋放數量的結果大於 *threshold0* 時,垃圾回收就會" +#~ "開始。初始時只有第 ``0`` 代會被檢查。如果自第 ``1`` 代被檢查後第 ``0`` 代" +#~ "已被檢查超過 *threshold1* 次,則第 ``1`` 代也會被檢查。對於第三代來說,情" +#~ "況還會更復雜一些,請參閱 `Collecting the oldest generation `_ 來了解詳情。" diff --git a/library/getopt.po b/library/getopt.po index f9d84aca9d0..3326714d586 100644 --- a/library/getopt.po +++ b/library/getopt.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-29 11:18+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2016-01-31 07:19+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,8 +36,8 @@ msgstr "" #: ../../library/getopt.rst:20 msgid "" -"This module helps scripts to parse the command line arguments in ``sys." -"argv``. It supports the same conventions as the Unix :c:func:`!getopt` " +"This module helps scripts to parse the command line arguments in " +"``sys.argv``. It supports the same conventions as the Unix :c:func:`!getopt` " "function (including the special meanings of arguments of the form '``-``' " "and '``--``'). Long options similar to those supported by GNU software may " "be used as well via an optional third argument." @@ -63,45 +63,51 @@ msgid "" "to be parsed, without the leading reference to the running program. " "Typically, this means ``sys.argv[1:]``. *shortopts* is the string of option " "letters that the script wants to recognize, with options that require an " -"argument followed by a colon (``':'``; i.e., the same format that Unix :c:" -"func:`!getopt` uses)." +"argument followed by a colon (``':'``) and options that accept an optional " +"argument followed by two colons (``'::'``); i.e., the same format that " +"Unix :c:func:`!getopt` uses." msgstr "" -#: ../../library/getopt.rst:47 +#: ../../library/getopt.rst:48 msgid "" "Unlike GNU :c:func:`!getopt`, after a non-option argument, all further " "arguments are considered also non-options. This is similar to the way non-" "GNU Unix systems work." msgstr "" -#: ../../library/getopt.rst:51 +#: ../../library/getopt.rst:52 msgid "" "*longopts*, if specified, must be a list of strings with the names of the " "long options which should be supported. The leading ``'--'`` characters " "should not be included in the option name. Long options which require an " -"argument should be followed by an equal sign (``'='``). Optional arguments " -"are not supported. To accept only long options, *shortopts* should be an " -"empty string. Long options on the command line can be recognized so long as " -"they provide a prefix of the option name that matches exactly one of the " -"accepted options. For example, if *longopts* is ``['foo', 'frob']``, the " -"option ``--fo`` will match as ``--foo``, but ``--f`` will not match " -"uniquely, so :exc:`GetoptError` will be raised." +"argument should be followed by an equal sign (``'='``). Long options which " +"accept an optional argument should be followed by an equal sign and question " +"mark (``'=?'``). To accept only long options, *shortopts* should be an empty " +"string. Long options on the command line can be recognized so long as they " +"provide a prefix of the option name that matches exactly one of the accepted " +"options. For example, if *longopts* is ``['foo', 'frob']``, the option ``--" +"fo`` will match as ``--foo``, but ``--f`` will not match uniquely, " +"so :exc:`GetoptError` will be raised." msgstr "" -#: ../../library/getopt.rst:62 +#: ../../library/getopt.rst:65 msgid "" "The return value consists of two elements: the first is a list of ``(option, " "value)`` pairs; the second is the list of program arguments left after the " "option list was stripped (this is a trailing slice of *args*). Each option-" "and-value pair returned has the option as its first element, prefixed with a " -"hyphen for short options (e.g., ``'-x'``) or two hyphens for long options (e." -"g., ``'--long-option'``), and the option argument as its second element, or " -"an empty string if the option has no argument. The options occur in the " +"hyphen for short options (e.g., ``'-x'``) or two hyphens for long options " +"(e.g., ``'--long-option'``), and the option argument as its second element, " +"or an empty string if the option has no argument. The options occur in the " "list in the same order in which they were found, thus allowing multiple " "occurrences. Long and short options may be mixed." msgstr "" #: ../../library/getopt.rst:75 +msgid "Optional arguments are supported." +msgstr "" + +#: ../../library/getopt.rst:81 msgid "" "This function works like :func:`getopt`, except that GNU style scanning mode " "is used by default. This means that option and non-option arguments may be " @@ -109,14 +115,28 @@ msgid "" "a non-option argument is encountered." msgstr "" -#: ../../library/getopt.rst:80 +#: ../../library/getopt.rst:86 msgid "" "If the first character of the option string is ``'+'``, or if the " "environment variable :envvar:`!POSIXLY_CORRECT` is set, then option " "processing stops as soon as a non-option argument is encountered." msgstr "" -#: ../../library/getopt.rst:87 +#: ../../library/getopt.rst:90 +msgid "" +"If the first character of the option string is ``'-'``, non-option arguments " +"that are followed by options are added to the list of option-and-value pairs " +"as a pair that has ``None`` as its first element and the list of non-option " +"arguments as its second element. The second element of the :func:`!" +"gnu_getopt` result is a list of program arguments after the last option." +msgstr "" + +#: ../../library/getopt.rst:97 +msgid "" +"Support for returning intermixed options and non-option arguments in order." +msgstr "" + +#: ../../library/getopt.rst:103 msgid "" "This is raised when an unrecognized option is found in the argument list or " "when an option requiring an argument is given none. The argument to the " @@ -127,15 +147,15 @@ msgid "" "which the exception relates, :attr:`!opt` is an empty string." msgstr "" -#: ../../library/getopt.rst:98 +#: ../../library/getopt.rst:114 msgid "Alias for :exc:`GetoptError`; for backward compatibility." msgstr "為了向後相容性而設的 :exc:`GetoptError` 別名。" -#: ../../library/getopt.rst:100 +#: ../../library/getopt.rst:116 msgid "An example using only Unix style options:" msgstr "一個僅使用 Unix 風格選項的範例:" -#: ../../library/getopt.rst:102 +#: ../../library/getopt.rst:118 msgid "" ">>> import getopt\n" ">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" @@ -157,11 +177,11 @@ msgstr "" ">>> args\n" "['a1', 'a2']" -#: ../../library/getopt.rst:114 +#: ../../library/getopt.rst:130 msgid "Using long option names is equally easy:" msgstr "使用長選項名稱同樣容易:" -#: ../../library/getopt.rst:116 +#: ../../library/getopt.rst:132 msgid "" ">>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n" ">>> args = s.split()\n" @@ -189,11 +209,65 @@ msgstr "" ">>> args\n" "['a1', 'a2']" -#: ../../library/getopt.rst:129 +#: ../../library/getopt.rst:145 +msgid "Optional arguments should be specified explicitly:" +msgstr "" + +#: ../../library/getopt.rst:147 +#, fuzzy +msgid "" +">>> s = '-Con -C --color=off --color a1 a2'\n" +">>> args = s.split()\n" +">>> args\n" +"['-Con', '-C', '--color=off', '--color', 'a1', 'a2']\n" +">>> optlist, args = getopt.getopt(args, 'C::', ['color=?'])\n" +">>> optlist\n" +"[('-C', 'on'), ('-C', ''), ('--color', 'off'), ('--color', '')]\n" +">>> args\n" +"['a1', 'a2']" +msgstr "" +">>> import getopt\n" +">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" +">>> args\n" +"['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']\n" +">>> optlist, args = getopt.getopt(args, 'abc:d:')\n" +">>> optlist\n" +"[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]\n" +">>> args\n" +"['a1', 'a2']" + +#: ../../library/getopt.rst:159 +msgid "The order of options and non-option arguments can be preserved:" +msgstr "" + +#: ../../library/getopt.rst:161 +#, fuzzy +msgid "" +">>> s = 'a1 -x a2 a3 a4 --long a5 a6'\n" +">>> args = s.split()\n" +">>> args\n" +"['a1', '-x', 'a2', 'a3', 'a4', '--long', 'a5', 'a6']\n" +">>> optlist, args = getopt.gnu_getopt(args, '-x:', ['long='])\n" +">>> optlist\n" +"[(None, ['a1']), ('-x', 'a2'), (None, ['a3', 'a4']), ('--long', 'a5')]\n" +">>> args\n" +"['a6']" +msgstr "" +">>> import getopt\n" +">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" +">>> args\n" +"['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']\n" +">>> optlist, args = getopt.getopt(args, 'abc:d:')\n" +">>> optlist\n" +"[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]\n" +">>> args\n" +"['a1', 'a2']" + +#: ../../library/getopt.rst:173 msgid "In a script, typical usage is something like this:" msgstr "在腳本中,典型的用法如下:" -#: ../../library/getopt.rst:131 +#: ../../library/getopt.rst:175 msgid "" "import getopt, sys\n" "\n" @@ -252,14 +326,14 @@ msgstr "" "if __name__ == \"__main__\":\n" " main()" -#: ../../library/getopt.rst:160 +#: ../../library/getopt.rst:204 msgid "" "Note that an equivalent command line interface could be produced with less " -"code and more informative help and error messages by using the :mod:" -"`optparse` module:" +"code and more informative help and error messages by using " +"the :mod:`optparse` module:" msgstr "" -#: ../../library/getopt.rst:163 +#: ../../library/getopt.rst:207 msgid "" "import optparse\n" "\n" @@ -279,13 +353,13 @@ msgstr "" " opts, args = parser.parse_args()\n" " process(args, output=opts.output, verbose=opts.verbose)" -#: ../../library/getopt.rst:174 +#: ../../library/getopt.rst:218 msgid "" "A roughly equivalent command line interface for this case can also be " "produced by using the :mod:`argparse` module:" msgstr "" -#: ../../library/getopt.rst:177 +#: ../../library/getopt.rst:221 msgid "" "import argparse\n" "\n" @@ -307,7 +381,7 @@ msgstr "" " args = parser.parse_args()\n" " process(args.rest, output=args.output, verbose=args.verbose)" -#: ../../library/getopt.rst:189 +#: ../../library/getopt.rst:233 msgid "" "See :ref:`choosing-an-argument-parser` for details on how the ``argparse`` " "version of this code differs in behaviour from the ``optparse`` (and " @@ -316,18 +390,18 @@ msgstr "" "參見 :ref:`choosing-an-argument-parser` 以瞭解這段程式碼的 ``argparse`` 版本" "與 ``optparse``\\(以及 ``getopt``)版本在行為上的差異。" -#: ../../library/getopt.rst:195 +#: ../../library/getopt.rst:239 msgid "Module :mod:`optparse`" msgstr ":mod:`optparse` 模組" -#: ../../library/getopt.rst:196 +#: ../../library/getopt.rst:240 msgid "Declarative command line option parsing." msgstr "宣告式命令列選項剖析。" -#: ../../library/getopt.rst:198 +#: ../../library/getopt.rst:242 msgid "Module :mod:`argparse`" msgstr ":mod:`argparse` 模組" -#: ../../library/getopt.rst:199 +#: ../../library/getopt.rst:243 msgid "More opinionated command line option and argument parsing library." msgstr "" diff --git a/library/getpass.po b/library/getpass.po index 8904954af22..8329e99e6c6 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-02-11 12:04+0800\n" "Last-Translator: Weilin Du\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -60,6 +60,15 @@ msgstr "" #: ../../library/getpass.rst:28 msgid "" +"The *echo_char* argument controls how user input is displayed while typing. " +"If *echo_char* is ``None`` (default), input remains hidden. Otherwise, " +"*echo_char* must be a printable ASCII string and each typed character is " +"replaced by it. For example, ``echo_char='*'`` will display asterisks " +"instead of the actual input." +msgstr "" + +#: ../../library/getpass.rst:34 +msgid "" "If echo free input is unavailable getpass() falls back to printing a warning " "message to *stream* and reading from ``sys.stdin`` and issuing " "a :exc:`GetPassWarning`." @@ -67,7 +76,7 @@ msgstr "" "如果無回音輸入 (echo-free input) 無法使用則 getpass() 將回退為印出一條警告訊" "息到 *stream*,並從 ``sys.stdin`` 讀取且同時發出 :exc:`GetPassWarning`。" -#: ../../library/getpass.rst:33 +#: ../../library/getpass.rst:39 msgid "" "If you call getpass from within IDLE, the input may be done in the terminal " "you launched IDLE from rather than the idle window itself." @@ -75,15 +84,19 @@ msgstr "" "如果你從 IDLE 內部呼叫 getpass,輸入可能會在你啟動 IDLE 的終端機中完成,而非" "在 IDLE 視窗中。" -#: ../../library/getpass.rst:38 +#: ../../library/getpass.rst:42 +msgid "Added the *echo_char* parameter for keyboard feedback." +msgstr "" + +#: ../../library/getpass.rst:47 msgid "A :exc:`UserWarning` subclass issued when password input may be echoed." msgstr "當密碼輸入可能被回音時會發出的 :exc:`UserWarning` 子類別。" -#: ../../library/getpass.rst:43 +#: ../../library/getpass.rst:52 msgid "Return the \"login name\" of the user." msgstr "回傳使用者的\"登入名稱\"。" -#: ../../library/getpass.rst:45 +#: ../../library/getpass.rst:54 msgid "" "This function checks the environment " "variables :envvar:`LOGNAME`, :envvar:`USER`, :envvar:`!LNAME` " @@ -97,10 +110,10 @@ msgstr "" "設定,則在支援 :mod:`pwd` 模組的系統上將會回傳來自密碼資料庫的登入名稱,否則" "將引發一個 :exc:`OSError` 例外。" -#: ../../library/getpass.rst:52 +#: ../../library/getpass.rst:61 msgid "In general, this function should be preferred over :func:`os.getlogin`." msgstr "大部分情況下,此函式應該要比 :func:`os.getlogin` 優先使用。" -#: ../../library/getpass.rst:54 +#: ../../library/getpass.rst:63 msgid "Previously, various exceptions beyond just :exc:`OSError` were raised." msgstr "在過去,除了 :exc:`OSError` 外還會引發各種例外。" diff --git a/library/graphlib.po b/library/graphlib.po index 8e8f8e4479e..13d0b1c9392 100644 --- a/library/graphlib.po +++ b/library/graphlib.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-01-04 16:35+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -94,15 +94,15 @@ msgid "" "nodes returned by :meth:`~TopologicalSorter.get_ready` and process them. " "Call :meth:`~TopologicalSorter.done` on each node as it finishes processing." msgstr "" -"當 :meth:`~TopologicalSorter.is_active` 為 ``True`` 時,疊代 :meth:" -"`~TopologicalSorter.get_ready` 回傳的節點並處理它們。在每個節點完成處理時呼" -"叫 :meth:`~TopologicalSorter.done`。" +"當 :meth:`~TopologicalSorter.is_active` 為 ``True`` 時,疊" +"代 :meth:`~TopologicalSorter.get_ready` 回傳的節點並處理它們。在每個節點完成" +"處理時呼叫 :meth:`~TopologicalSorter.done`。" #: ../../library/graphlib.rst:49 msgid "" "In case just an immediate sorting of the nodes in the graph is required and " -"no parallelism is involved, the convenience method :meth:`TopologicalSorter." -"static_order` can be used directly:" +"no parallelism is involved, the convenience " +"method :meth:`TopologicalSorter.static_order` can be used directly:" msgstr "" "如果只需要立即對圖中的節點進行排序且不涉及平行性 (parallelism),則可以直接使" "用便捷方法 :meth:`TopologicalSorter.static_order`:" @@ -180,44 +180,57 @@ msgstr "" msgid "" "Raises :exc:`ValueError` if called after :meth:`~TopologicalSorter.prepare`." msgstr "" -"如果在 :meth:`~TopologicalSorter.prepare` 之後呼叫,則引發 :exc:" -"`ValueError`。" +"如果在 :meth:`~TopologicalSorter.prepare` 之後呼叫,則引" +"發 :exc:`ValueError`。" #: ../../library/graphlib.rst:102 msgid "" "Mark the graph as finished and check for cycles in the graph. If any cycle " -"is detected, :exc:`CycleError` will be raised, but :meth:`~TopologicalSorter." -"get_ready` can still be used to obtain as many nodes as possible until " -"cycles block more progress. After a call to this function, the graph cannot " -"be modified, and therefore no more nodes can be added using :meth:" -"`~TopologicalSorter.add`." +"is detected, :exc:`CycleError` will be raised, " +"but :meth:`~TopologicalSorter.get_ready` can still be used to obtain as many " +"nodes as possible until cycles block more progress. After a call to this " +"function, the graph cannot be modified, and therefore no more nodes can be " +"added using :meth:`~TopologicalSorter.add`." msgstr "" -"將圖標記為已完成並檢查圖中的循環。如果檢測到任何循環,將引發 :exc:" -"`CycleError`,但 :meth:`~TopologicalSorter.get_ready` 仍可用於盡可能獲得更多" -"的節點,直到循環阻塞了進度。呼叫此函式後就無法修改圖,因此無法使用 :meth:" -"`~TopologicalSorter.add` 來新增更多節點。" +"將圖標記為已完成並檢查圖中的循環。如果檢測到任何循環,將引" +"發 :exc:`CycleError`,但 :meth:`~TopologicalSorter.get_ready` 仍可用於盡可能" +"獲得更多的節點,直到循環阻塞了進度。呼叫此函式後就無法修改圖,因此無法使" +"用 :meth:`~TopologicalSorter.add` 來新增更多節點。" -#: ../../library/graphlib.rst:111 +#: ../../library/graphlib.rst:109 +msgid "" +"A :exc:`ValueError` will be raised if the sort has been started " +"by :meth:`~.static_order` or :meth:`~.get_ready`." +msgstr "" + +#: ../../library/graphlib.rst:114 +msgid "" +"``prepare()`` can now be called more than once as long as the sort has not " +"started. Previously this raised :exc:`ValueError`." +msgstr "" + +#: ../../library/graphlib.rst:119 msgid "" "Returns ``True`` if more progress can be made and ``False`` otherwise. " "Progress can be made if cycles do not block the resolution and either there " -"are still nodes ready that haven't yet been returned by :meth:" -"`TopologicalSorter.get_ready` or the number of nodes marked :meth:" -"`TopologicalSorter.done` is less than the number that have been returned by :" -"meth:`TopologicalSorter.get_ready`." +"are still nodes ready that haven't yet been returned " +"by :meth:`TopologicalSorter.get_ready` or the number of nodes " +"marked :meth:`TopologicalSorter.done` is less than the number that have been " +"returned by :meth:`TopologicalSorter.get_ready`." msgstr "" "如果可以有更多進度則回傳 ``True``,否則回傳 ``False``。如果循環不阻塞解析 " -"(resolution) 並且仍有節點準備就緒但尚未由 :meth:`TopologicalSorter." -"get_ready` 回傳或標記為 :meth:`TopologicalSorter.done` 的節點數量較 :meth:" -"`TopologicalSorter.get_ready` 所回傳的少,則可以繼續取得進度。" +"(resolution) 並且仍有節點準備就緒但尚未" +"由 :meth:`TopologicalSorter.get_ready` 回傳或標記" +"為 :meth:`TopologicalSorter.done` 的節點數量" +"較 :meth:`TopologicalSorter.get_ready` 所回傳的少,則可以繼續取得進度。" -#: ../../library/graphlib.rst:118 +#: ../../library/graphlib.rst:126 msgid "" "The :meth:`~object.__bool__` method of this class defers to this function, " "so instead of::" msgstr "此類別的 :meth:`~object.__bool__` 方法遵循此函式,因此以下做法: ::" -#: ../../library/graphlib.rst:121 +#: ../../library/graphlib.rst:129 msgid "" "if ts.is_active():\n" " ..." @@ -225,11 +238,11 @@ msgstr "" "if ts.is_active():\n" " ..." -#: ../../library/graphlib.rst:124 +#: ../../library/graphlib.rst:132 msgid "it is possible to simply do::" msgstr "可以簡單地用以下方式替換: ::" -#: ../../library/graphlib.rst:126 +#: ../../library/graphlib.rst:134 msgid "" "if ts:\n" " ..." @@ -237,38 +250,38 @@ msgstr "" "if ts:\n" " ..." -#: ../../library/graphlib.rst:129 ../../library/graphlib.rst:152 +#: ../../library/graphlib.rst:137 ../../library/graphlib.rst:160 msgid "" -"Raises :exc:`ValueError` if called without calling :meth:`~TopologicalSorter." -"prepare` previously." +"Raises :exc:`ValueError` if called without " +"calling :meth:`~TopologicalSorter.prepare` previously." msgstr "" -"如果呼叫之前沒有先呼叫 :meth:`~TopologicalSorter.prepare` 則引發 :exc:" -"`ValueError`。" +"如果呼叫之前沒有先呼叫 :meth:`~TopologicalSorter.prepare` 則引" +"發 :exc:`ValueError`。" -#: ../../library/graphlib.rst:134 +#: ../../library/graphlib.rst:142 msgid "" "Marks a set of nodes returned by :meth:`TopologicalSorter.get_ready` as " "processed, unblocking any successor of each node in *nodes* for being " "returned in the future by a call to :meth:`TopologicalSorter.get_ready`." msgstr "" "將 :meth:`TopologicalSorter.get_ready` 回傳的一組節點標記為已處理,停止阻塞 " -"*nodes* 中每個節點的任何後繼節點 (successor),以便將來通過呼叫 :meth:" -"`TopologicalSorter.get_ready` 回傳。" +"*nodes* 中每個節點的任何後繼節點 (successor),以便將來通過呼" +"叫 :meth:`TopologicalSorter.get_ready` 回傳。" -#: ../../library/graphlib.rst:138 +#: ../../library/graphlib.rst:146 msgid "" "Raises :exc:`ValueError` if any node in *nodes* has already been marked as " "processed by a previous call to this method or if a node was not added to " -"the graph by using :meth:`TopologicalSorter.add`, if called without calling :" -"meth:`~TopologicalSorter.prepare` or if node has not yet been returned by :" -"meth:`~TopologicalSorter.get_ready`." +"the graph by using :meth:`TopologicalSorter.add`, if called without " +"calling :meth:`~TopologicalSorter.prepare` or if node has not yet been " +"returned by :meth:`~TopologicalSorter.get_ready`." msgstr "" -"若沒有和該呼叫一起呼叫 :meth:`~TopologicalSorter.prepare` 或節點還沒有被 :" -"meth:`~TopologicalSorter.get_ready` 回傳,且如果 *nodes* 中有任何節點已被先前" -"對此方法的呼叫標記為已處理、或者未使用 :meth:`TopologicalSorter.add` 將節點新" -"增到圖中,則引發 :exc:`ValueError`。" +"若沒有和該呼叫一起呼叫 :meth:`~TopologicalSorter.prepare` 或節點還沒有" +"被 :meth:`~TopologicalSorter.get_ready` 回傳,且如果 *nodes* 中有任何節點已被" +"先前對此方法的呼叫標記為已處理、或者未使用 :meth:`TopologicalSorter.add` 將節" +"點新增到圖中,則引發 :exc:`ValueError`。" -#: ../../library/graphlib.rst:146 +#: ../../library/graphlib.rst:154 msgid "" "Returns a ``tuple`` with all the nodes that are ready. Initially it returns " "all nodes with no predecessors, and once those are marked as processed by " @@ -281,18 +294,18 @@ msgstr "" "步的呼叫將回傳所有其全部前驅節點都已被處理的新節點。若無法取得更多進度,將回" "傳空 tuple。" -#: ../../library/graphlib.rst:157 +#: ../../library/graphlib.rst:165 msgid "" "Returns an iterator object which will iterate over nodes in a topological " -"order. When using this method, :meth:`~TopologicalSorter.prepare` and :meth:" -"`~TopologicalSorter.done` should not be called. This method is equivalent " -"to::" +"order. When using this method, :meth:`~TopologicalSorter.prepare` " +"and :meth:`~TopologicalSorter.done` should not be called. This method is " +"equivalent to::" msgstr "" -"回傳一個可疊代物件,它將按拓撲排序疊代節點。使用此方法時,不應呼叫 :meth:" -"`~TopologicalSorter.prepare` 和 :meth:`~TopologicalSorter.done`。此方法等效" -"於: ::" +"回傳一個可疊代物件,它將按拓撲排序疊代節點。使用此方法時,不應呼" +"叫 :meth:`~TopologicalSorter.prepare` 和 :meth:`~TopologicalSorter.done`。此" +"方法等效於: ::" -#: ../../library/graphlib.rst:162 +#: ../../library/graphlib.rst:170 msgid "" "def static_order(self):\n" " self.prepare()\n" @@ -308,13 +321,13 @@ msgstr "" " yield from node_group\n" " self.done(*node_group)" -#: ../../library/graphlib.rst:169 +#: ../../library/graphlib.rst:177 msgid "" "The particular order that is returned may depend on the specific order in " "which the items were inserted in the graph. For example:" msgstr "回傳的特定順序可能取決於將項目插入圖中的特定順序。例如:" -#: ../../library/graphlib.rst:172 +#: ../../library/graphlib.rst:180 msgid "" ">>> ts = TopologicalSorter()\n" ">>> ts.add(3, 2, 1)\n" @@ -340,46 +353,47 @@ msgstr "" ">>> print([*ts2.static_order()])\n" "[0, 2, 1, 3]" -#: ../../library/graphlib.rst:186 +#: ../../library/graphlib.rst:194 msgid "" "This is due to the fact that \"0\" and \"2\" are in the same level in the " -"graph (they would have been returned in the same call to :meth:" -"`~TopologicalSorter.get_ready`) and the order between them is determined by " -"the order of insertion." +"graph (they would have been returned in the same call " +"to :meth:`~TopologicalSorter.get_ready`) and the order between them is " +"determined by the order of insertion." msgstr "" -"這是因為 \"0\" 和 \"2\" 在圖中處於同一級別(它們將在對 :meth:" -"`~TopologicalSorter.get_ready` 的同一呼叫中回傳)並且它們之間的順序取決於插入" -"順序。" +"這是因為 \"0\" 和 \"2\" 在圖中處於同一級別(它們將在" +"對 :meth:`~TopologicalSorter.get_ready` 的同一呼叫中回傳)並且它們之間的順序" +"取決於插入順序。" -#: ../../library/graphlib.rst:192 +#: ../../library/graphlib.rst:200 msgid "If any cycle is detected, :exc:`CycleError` will be raised." msgstr "如果檢測到任何循環,則引發 :exc:`CycleError`。" -#: ../../library/graphlib.rst:198 +#: ../../library/graphlib.rst:206 msgid "Exceptions" msgstr "例外" -#: ../../library/graphlib.rst:199 +#: ../../library/graphlib.rst:207 msgid "The :mod:`graphlib` module defines the following exception classes:" msgstr ":mod:`graphlib` 模組定義了以下例外類別:" -#: ../../library/graphlib.rst:203 +#: ../../library/graphlib.rst:211 msgid "" "Subclass of :exc:`ValueError` raised by :meth:`TopologicalSorter.prepare` if " "cycles exist in the working graph. If multiple cycles exist, only one " "undefined choice among them will be reported and included in the exception." msgstr "" -":exc:`ValueError` 的子類別,如果作用的圖中存在循環則由 :meth:" -"`TopologicalSorter.prepare` 引發。如果存在多個循環,則只會報告未定義的其中一" -"個並包含在例外中。" - -#: ../../library/graphlib.rst:207 -msgid "" -"The detected cycle can be accessed via the second element in the :attr:" -"`~BaseException.args` attribute of the exception instance and consists in a " -"list of nodes, such that each node is, in the graph, an immediate " -"predecessor of the next node in the list. In the reported list, the first " -"and the last node will be the same, to make it clear that it is cyclic." +":exc:`ValueError` 的子類別,如果作用的圖中存在循環則" +"由 :meth:`TopologicalSorter.prepare` 引發。如果存在多個循環,則只會報告未定義" +"的其中一個並包含在例外中。" + +#: ../../library/graphlib.rst:215 +msgid "" +"The detected cycle can be accessed via the second element in " +"the :attr:`~BaseException.args` attribute of the exception instance and " +"consists in a list of nodes, such that each node is, in the graph, an " +"immediate predecessor of the next node in the list. In the reported list, " +"the first and the last node will be the same, to make it clear that it is " +"cyclic." msgstr "" "檢測到的循環可以通過例外實例的 :attr:`~BaseException.args` 屬性中第二個元素來" "存取,其為一個節點列表,每個節點在圖中都是列表中下一個節點的直接前驅節點" diff --git a/library/gzip.po b/library/gzip.po index 80147ac8e0f..353c4c69890 100644 --- a/library/gzip.po +++ b/library/gzip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-26 00:14+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,18 +38,18 @@ msgstr "" #: ../../library/gzip.rst:16 msgid "" -"The :mod:`gzip` module provides the :class:`GzipFile` class, as well as the :" -"func:`.open`, :func:`compress` and :func:`decompress` convenience functions. " -"The :class:`GzipFile` class reads and writes :program:`gzip`\\ -format " -"files, automatically compressing or decompressing the data so that it looks " -"like an ordinary :term:`file object`." +"The :mod:`gzip` module provides the :class:`GzipFile` class, as well as " +"the :func:`.open`, :func:`compress` and :func:`decompress` convenience " +"functions. The :class:`GzipFile` class reads and writes :program:`gzip`\\ " +"-format files, automatically compressing or decompressing the data so that " +"it looks like an ordinary :term:`file object`." msgstr "" #: ../../library/gzip.rst:22 msgid "" -"Note that additional file formats which can be decompressed by the :program:" -"`gzip` and :program:`gunzip` programs, such as those produced by :program:" -"`compress` and :program:`pack`, are not supported by this module." +"Note that additional file formats which can be decompressed by " +"the :program:`gzip` and :program:`gunzip` programs, such as those produced " +"by :program:`compress` and :program:`pack`, are not supported by this module." msgstr "" #: ../../library/gzip.rst:26 @@ -64,8 +64,9 @@ msgstr "" #: ../../library/gzip.rst:34 msgid "" -"The *filename* argument can be an actual filename (a :class:`str` or :class:" -"`bytes` object), or an existing file object to read from or write to." +"The *filename* argument can be an actual filename (a :class:`str` " +"or :class:`bytes` object), or an existing file object to read from or write " +"to." msgstr "" #: ../../library/gzip.rst:37 @@ -77,8 +78,8 @@ msgstr "" #: ../../library/gzip.rst:41 msgid "" -"The *compresslevel* argument is an integer from 0 to 9, as for the :class:" -"`GzipFile` constructor." +"The *compresslevel* argument is an integer from 0 to 9, as for " +"the :class:`GzipFile` constructor." msgstr "" #: ../../library/gzip.rst:44 @@ -90,8 +91,8 @@ msgstr "" #: ../../library/gzip.rst:48 msgid "" -"For text mode, a :class:`GzipFile` object is created, and wrapped in an :" -"class:`io.TextIOWrapper` instance with the specified encoding, error " +"For text mode, a :class:`GzipFile` object is created, and wrapped in " +"an :class:`io.TextIOWrapper` instance with the specified encoding, error " "handling behavior, and line ending(s)." msgstr "" @@ -111,17 +112,17 @@ msgstr "接受\\ :term:`類路徑物件 `。" #: ../../library/gzip.rst:64 msgid "" -"An exception raised for invalid gzip files. It inherits from :exc:" -"`OSError`. :exc:`EOFError` and :exc:`zlib.error` can also be raised for " -"invalid gzip files." +"An exception raised for invalid gzip files. It inherits " +"from :exc:`OSError`. :exc:`EOFError` and :exc:`zlib.error` can also be " +"raised for invalid gzip files." msgstr "" #: ../../library/gzip.rst:72 msgid "" "Constructor for the :class:`GzipFile` class, which simulates most of the " -"methods of a :term:`file object`, with the exception of the :meth:`~io." -"IOBase.truncate` method. At least one of *fileobj* and *filename* must be " -"given a non-trivial value." +"methods of a :term:`file object`, with the exception of " +"the :meth:`~io.IOBase.truncate` method. At least one of *fileobj* and " +"*filename* must be given a non-trivial value." msgstr "" #: ../../library/gzip.rst:77 @@ -184,15 +185,15 @@ msgid "" "Calling a :class:`GzipFile` object's :meth:`!close` method does not close " "*fileobj*, since you might wish to append more material after the compressed " "data. This also allows you to pass an :class:`io.BytesIO` object opened for " -"writing as *fileobj*, and retrieve the resulting memory buffer using the :" -"class:`io.BytesIO` object's :meth:`~io.BytesIO.getvalue` method." +"writing as *fileobj*, and retrieve the resulting memory buffer using " +"the :class:`io.BytesIO` object's :meth:`~io.BytesIO.getvalue` method." msgstr "" #: ../../library/gzip.rst:116 msgid "" ":class:`GzipFile` supports the :class:`io.BufferedIOBase` interface, " -"including iteration and the :keyword:`with` statement. Only the :meth:`~io." -"IOBase.truncate` method isn't implemented." +"including iteration and the :keyword:`with` statement. Only " +"the :meth:`~io.IOBase.truncate` method isn't implemented." msgstr "" #: ../../library/gzip.rst:120 @@ -207,9 +208,10 @@ msgstr "" #: ../../library/gzip.rst:127 msgid "" -"While calling :meth:`peek` does not change the file position of the :class:" -"`GzipFile`, it may change the position of the underlying file object (e.g. " -"if the :class:`GzipFile` was constructed with the *fileobj* parameter)." +"While calling :meth:`peek` does not change the file position of " +"the :class:`GzipFile`, it may change the position of the underlying file " +"object (e.g. if the :class:`GzipFile` was constructed with the *fileobj* " +"parameter)." msgstr "" #: ../../library/gzip.rst:136 @@ -276,29 +278,36 @@ msgstr "" msgid "" "Compress the *data*, returning a :class:`bytes` object containing the " "compressed data. *compresslevel* and *mtime* have the same meaning as in " -"the :class:`GzipFile` constructor above." +"the :class:`GzipFile` constructor above, but *mtime* defaults to 0 for " +"reproducible output." msgstr "" -#: ../../library/gzip.rst:192 +#: ../../library/gzip.rst:193 msgid "Added the *mtime* parameter for reproducible output." msgstr "" -#: ../../library/gzip.rst:194 +#: ../../library/gzip.rst:195 msgid "" "Speed is improved by compressing all data at once instead of in a streamed " -"fashion. Calls with *mtime* set to ``0`` are delegated to :func:`zlib." -"compress` for better speed. In this situation the output may contain a gzip " -"header \"OS\" byte value other than 255 \"unknown\" as supplied by the " -"underlying zlib implementation." +"fashion. Calls with *mtime* set to ``0`` are delegated " +"to :func:`zlib.compress` for better speed. In this situation the output may " +"contain a gzip header \"OS\" byte value other than 255 \"unknown\" as " +"supplied by the underlying zlib implementation." msgstr "" -#: ../../library/gzip.rst:201 +#: ../../library/gzip.rst:202 msgid "" "The gzip header OS byte is guaranteed to be set to 255 when this function is " "used as was the case in 3.10 and earlier." msgstr "" -#: ../../library/gzip.rst:207 +#: ../../library/gzip.rst:205 +msgid "" +"The *mtime* parameter now defaults to 0 for reproducible output. For the " +"previous behaviour of using the current time, pass ``None`` to *mtime*." +msgstr "" + +#: ../../library/gzip.rst:212 msgid "" "Decompress the *data*, returning a :class:`bytes` object containing the " "uncompressed data. This function is capable of decompressing multi-member " @@ -307,21 +316,21 @@ msgid "" "*wbits* set to 31 is faster." msgstr "" -#: ../../library/gzip.rst:214 +#: ../../library/gzip.rst:219 msgid "" "Speed is improved by decompressing members at once in memory instead of in a " "streamed fashion." msgstr "" -#: ../../library/gzip.rst:221 +#: ../../library/gzip.rst:226 msgid "Examples of usage" msgstr "用法範例" -#: ../../library/gzip.rst:223 +#: ../../library/gzip.rst:228 msgid "Example of how to read a compressed file::" msgstr "如何讀取壓縮檔案的範例: ::" -#: ../../library/gzip.rst:225 +#: ../../library/gzip.rst:230 msgid "" "import gzip\n" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" @@ -331,11 +340,11 @@ msgstr "" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" " file_content = f.read()" -#: ../../library/gzip.rst:229 +#: ../../library/gzip.rst:234 msgid "Example of how to create a compressed GZIP file::" msgstr "如何建立一個壓縮的 GZIP 檔案的範例: ::" -#: ../../library/gzip.rst:231 +#: ../../library/gzip.rst:236 msgid "" "import gzip\n" "content = b\"Lots of content here\"\n" @@ -347,11 +356,11 @@ msgstr "" "with gzip.open('/home/joe/file.txt.gz', 'wb') as f:\n" " f.write(content)" -#: ../../library/gzip.rst:236 +#: ../../library/gzip.rst:241 msgid "Example of how to GZIP compress an existing file::" msgstr "如何壓縮一個已存在的檔案的範例: ::" -#: ../../library/gzip.rst:238 +#: ../../library/gzip.rst:243 msgid "" "import gzip\n" "import shutil\n" @@ -365,11 +374,11 @@ msgstr "" " with gzip.open('/home/joe/file.txt.gz', 'wb') as f_out:\n" " shutil.copyfileobj(f_in, f_out)" -#: ../../library/gzip.rst:244 +#: ../../library/gzip.rst:249 msgid "Example of how to GZIP compress a binary string::" msgstr "如何壓縮一個二進位字串的範例: ::" -#: ../../library/gzip.rst:246 +#: ../../library/gzip.rst:251 msgid "" "import gzip\n" "s_in = b\"Lots of content here\"\n" @@ -379,62 +388,62 @@ msgstr "" "s_in = b\"Lots of content here\"\n" "s_out = gzip.compress(s_in)" -#: ../../library/gzip.rst:252 +#: ../../library/gzip.rst:257 msgid "Module :mod:`zlib`" msgstr ":mod:`zlib` 模組" -#: ../../library/gzip.rst:253 +#: ../../library/gzip.rst:258 msgid "" "The basic data compression module needed to support the :program:`gzip` file " "format." msgstr "" -#: ../../library/gzip.rst:256 +#: ../../library/gzip.rst:261 msgid "" "In case gzip (de)compression is a bottleneck, the `python-isal`_ package " "speeds up (de)compression with a mostly compatible API." msgstr "" -#: ../../library/gzip.rst:266 +#: ../../library/gzip.rst:271 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/gzip.rst:268 +#: ../../library/gzip.rst:273 msgid "" "The :mod:`gzip` module provides a simple command line interface to compress " "or decompress files." msgstr "" -#: ../../library/gzip.rst:271 +#: ../../library/gzip.rst:276 msgid "Once executed the :mod:`gzip` module keeps the input file(s)." msgstr "" -#: ../../library/gzip.rst:275 +#: ../../library/gzip.rst:280 msgid "" "Add a new command line interface with a usage. By default, when you will " "execute the CLI, the default compression level is 6." msgstr "" -#: ../../library/gzip.rst:279 +#: ../../library/gzip.rst:284 msgid "Command line options" msgstr "命令列選項" -#: ../../library/gzip.rst:283 +#: ../../library/gzip.rst:288 msgid "If *file* is not specified, read from :data:`sys.stdin`." msgstr "如果未指定 *file*,則從 :data:`sys.stdin` 讀取。" -#: ../../library/gzip.rst:287 +#: ../../library/gzip.rst:292 msgid "Indicates the fastest compression method (less compression)." msgstr "" -#: ../../library/gzip.rst:291 +#: ../../library/gzip.rst:296 msgid "Indicates the slowest compression method (best compression)." msgstr "" -#: ../../library/gzip.rst:295 +#: ../../library/gzip.rst:300 msgid "Decompress the given file." msgstr "解壓縮指定的檔案。" -#: ../../library/gzip.rst:299 +#: ../../library/gzip.rst:304 msgid "Show the help message." msgstr "顯示幫助訊息。" diff --git a/library/heapq.po b/library/heapq.po index fb9399796c8..85e8229e23d 100644 --- a/library/heapq.po +++ b/library/heapq.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-07-01 18:20+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,35 +37,48 @@ msgstr "" "queue) 演算法。" #: ../../library/heapq.rst:19 +#, fuzzy msgid "" -"Heaps are binary trees for which every parent node has a value less than or " -"equal to any of its children. We refer to this condition as the heap " +"Min-heaps are binary trees for which every parent node has a value less than " +"or equal to any of its children. We refer to this condition as the heap " "invariant." msgstr "" "Heap(堆積)是一顆二元樹,樹上所有父節點的值都小於等於他的子節點的值,我們將" "這種情況稱為堆積的性質不變。" -#: ../../library/heapq.rst:22 +#: ../../library/heapq.rst:23 +#, fuzzy msgid "" -"This implementation uses arrays for which ``heap[k] <= heap[2*k+1]`` and " -"``heap[k] <= heap[2*k+2]`` for all *k*, counting elements from zero. For " -"the sake of comparison, non-existing elements are considered to be " -"infinite. The interesting property of a heap is that its smallest element " -"is always the root, ``heap[0]``." +"For min-heaps, this implementation uses lists for which ``heap[k] <= " +"heap[2*k+1]`` and ``heap[k] <= heap[2*k+2]`` for all *k* for which the " +"compared elements exist. Elements are counted from zero. The interesting " +"property of a min-heap is that its smallest element is always the root, " +"``heap[0]``." msgstr "" "使用陣列實作,對於所有從0開始的 *k* 都滿足 ``heap[k] <= heap[2*k+1]`` 和 " "``heap[k] <= heap[2*k+2]`` 。為了比較節點的值,不存在的元素被視為無限大。" "heap 存在一個有趣的性質:樹上最小的元素永遠會在根節點 ``heap[0]`` 上。" -#: ../../library/heapq.rst:28 +#: ../../library/heapq.rst:29 msgid "" -"The API below differs from textbook heap algorithms in two aspects: (a) We " -"use zero-based indexing. This makes the relationship between the index for " -"a node and the indexes for its children slightly less obvious, but is more " -"suitable since Python uses zero-based indexing. (b) Our pop method returns " -"the smallest item, not the largest (called a \"min heap\" in textbooks; a " -"\"max heap\" is more common in texts because of its suitability for in-place " -"sorting)." +"Max-heaps satisfy the reverse invariant: every parent node has a value " +"*greater* than any of its children. These are implemented as lists for " +"which ``maxheap[2*k+1] <= maxheap[k]`` and ``maxheap[2*k+2] <= maxheap[k]`` " +"for all *k* for which the compared elements exist. The root, ``maxheap[0]``, " +"contains the *largest* element; ``heap.sort(reverse=True)`` maintains the " +"max-heap invariant." +msgstr "" + +#: ../../library/heapq.rst:36 +#, fuzzy +msgid "" +"The :mod:`!heapq` API differs from textbook heap algorithms in two aspects: " +"(a) We use zero-based indexing. This makes the relationship between the " +"index for a node and the indexes for its children slightly less obvious, but " +"is more suitable since Python uses zero-based indexing. (b) Textbooks often " +"focus on max-heaps, due to their suitability for in-place sorting. Our " +"implementation favors min-heaps as they better correspond to " +"Python :class:`lists `." msgstr "" "下方的 API 跟一般教科書的 heap queue 演算法有兩個方面不同:第一,我們的索引" "從 0 開始計算,這會父節點與子節點之間的關係產生很微小的差異,但更符合 Python " @@ -73,41 +86,61 @@ msgstr "" "( 在教科書中被稱作 \"min heap\",而 \"max heap\" 因為他很適合做原地排序,所" "以更常出現在教科書中 )。" -#: ../../library/heapq.rst:35 +#: ../../library/heapq.rst:43 +#, fuzzy msgid "" -"These two make it possible to view the heap as a regular Python list without " -"surprises: ``heap[0]`` is the smallest item, and ``heap.sort()`` maintains " -"the heap invariant!" +"These two aspects make it possible to view the heap as a regular Python list " +"without surprises: ``heap[0]`` is the smallest item, and ``heap.sort()`` " +"maintains the heap invariant!" msgstr "" "這兩個特性使得把 heap 當作一個標準的 Python list 檢視時不會出現意外:" "``heap[0]`` 是最小的物件,``heap.sort()`` 能保持 heap 的性質不變!" -#: ../../library/heapq.rst:39 +#: ../../library/heapq.rst:47 +msgid "" +"Like :meth:`list.sort`, this implementation uses only the ``<`` operator for " +"comparisons, for both min-heaps and max-heaps." +msgstr "" + +#: ../../library/heapq.rst:50 msgid "" -"To create a heap, use a list initialized to ``[]``, or you can transform a " -"populated list into a heap via function :func:`heapify`." +"In the API below, and in this documentation, the unqualified term *heap* " +"generally refers to a min-heap. The API for max-heaps is named using a " +"``_max`` suffix." +msgstr "" + +#: ../../library/heapq.rst:54 +#, fuzzy +msgid "" +"To create a heap, use a list initialized as ``[]``, or transform an existing " +"list into a min-heap or max-heap using the :func:`heapify` " +"or :func:`heapify_max` functions, respectively." msgstr "" "建立一個 heap 可以使用 list 初始化為 ``[]``,或者使用函式 :func:`heapify` 將" "一個已經有元素的 list轉成一個 heap。" -#: ../../library/heapq.rst:42 -msgid "The following functions are provided:" +#: ../../library/heapq.rst:58 +#, fuzzy +msgid "The following functions are provided for min-heaps:" msgstr "此模組提供下面的函式" -#: ../../library/heapq.rst:47 -msgid "Push the value *item* onto the *heap*, maintaining the heap invariant." +#: ../../library/heapq.rst:63 +#, fuzzy +msgid "" +"Push the value *item* onto the *heap*, maintaining the min-heap invariant." msgstr "把 *item* 放進 *heap*,並保持 heap 性質不變。" -#: ../../library/heapq.rst:52 +#: ../../library/heapq.rst:68 +#, fuzzy msgid "" -"Pop and return the smallest item from the *heap*, maintaining the heap " +"Pop and return the smallest item from the *heap*, maintaining the min-heap " "invariant. If the heap is empty, :exc:`IndexError` is raised. To access " "the smallest item without popping it, use ``heap[0]``." msgstr "" "從 *heap* 取出並回傳最小的元素,同時保持 heap 性質不變。如果 heap 是空的會產" "生 :exc:`IndexError` 錯誤。只存取最小元素但不取出可以使用 ``heap[0]`` 。" -#: ../../library/heapq.rst:59 +#: ../../library/heapq.rst:75 msgid "" "Push *item* on the heap, then pop and return the smallest item from the " "*heap*. The combined action runs more efficiently than :func:`heappush` " @@ -116,11 +149,12 @@ msgstr "" "將 *item* 放入 heap ,接著從 *heap* 取出並回傳最小的元素。這個組合函式比呼" "叫 :func:`heappush` 之後呼叫 :func:`heappop` 更有效率。" -#: ../../library/heapq.rst:66 -msgid "Transform list *x* into a heap, in-place, in linear time." +#: ../../library/heapq.rst:82 +#, fuzzy +msgid "Transform list *x* into a min-heap, in-place, in linear time." msgstr "在線性時間內將 list *x* 轉為 heap,且過程不會申請額外記憶體。" -#: ../../library/heapq.rst:71 +#: ../../library/heapq.rst:87 msgid "" "Pop and return the smallest item from the *heap*, and also push the new " "*item*. The heap size doesn't change. If the heap is " @@ -129,7 +163,7 @@ msgstr "" "從 *heap* 取出並回傳最小的元素,接著將新的 *item* 放進heap。heap 的大小不會改" "變。如果 heap 是空的會產生 :exc:`IndexError` 錯誤。" -#: ../../library/heapq.rst:74 +#: ../../library/heapq.rst:90 msgid "" "This one step operation is more efficient than a :func:`heappop` followed " "by :func:`heappush` and can be more appropriate when using a fixed-size " @@ -140,7 +174,7 @@ msgstr "" "率,並在維護 heap 的大小不變時更為適當,取出/放入的組合函式一定會從 heap 回傳" "一個元素並用 *item* 取代他。" -#: ../../library/heapq.rst:79 +#: ../../library/heapq.rst:95 msgid "" "The value returned may be larger than the *item* added. If that isn't " "desired, consider using :func:`heappushpop` instead. Its push/pop " @@ -151,11 +185,64 @@ msgstr "" "用 :func:`heappushpop` 替代,他會回傳 heap 的最小值和 *item* 兩個當中比較小的" "那個,並將大的留在 heap 內。" -#: ../../library/heapq.rst:85 +#: ../../library/heapq.rst:101 +#, fuzzy +msgid "For max-heaps, the following functions are provided:" +msgstr "此模組提供下面的函式" + +#: ../../library/heapq.rst:106 +#, fuzzy +msgid "Transform list *x* into a max-heap, in-place, in linear time." +msgstr "在線性時間內將 list *x* 轉為 heap,且過程不會申請額外記憶體。" + +#: ../../library/heapq.rst:113 +#, fuzzy +msgid "" +"Push the value *item* onto the max-heap *heap*, maintaining the max-heap " +"invariant." +msgstr "把 *item* 放進 *heap*,並保持 heap 性質不變。" + +#: ../../library/heapq.rst:121 +#, fuzzy +msgid "" +"Pop and return the largest item from the max-heap *heap*, maintaining the " +"max-heap invariant. If the max-heap is empty, :exc:`IndexError` is raised. " +"To access the largest item without popping it, use ``maxheap[0]``." +msgstr "" +"從 *heap* 取出並回傳最小的元素,同時保持 heap 性質不變。如果 heap 是空的會產" +"生 :exc:`IndexError` 錯誤。只存取最小元素但不取出可以使用 ``heap[0]`` 。" + +#: ../../library/heapq.rst:130 +#, fuzzy +msgid "" +"Push *item* on the max-heap *heap*, then pop and return the largest item " +"from *heap*. The combined action runs more efficiently " +"than :func:`heappush_max` followed by a separate call to :func:`heappop_max`." +msgstr "" +"將 *item* 放入 heap ,接著從 *heap* 取出並回傳最小的元素。這個組合函式比呼" +"叫 :func:`heappush` 之後呼叫 :func:`heappop` 更有效率。" + +#: ../../library/heapq.rst:140 +#, fuzzy +msgid "" +"Pop and return the largest item from the max-heap *heap* and also push the " +"new *item*. The max-heap size doesn't change. If the max-heap is " +"empty, :exc:`IndexError` is raised." +msgstr "" +"從 *heap* 取出並回傳最小的元素,接著將新的 *item* 放進heap。heap 的大小不會改" +"變。如果 heap 是空的會產生 :exc:`IndexError` 錯誤。" + +#: ../../library/heapq.rst:145 +msgid "" +"The value returned may be smaller than the *item* added. Refer to the " +"analogous function :func:`heapreplace` for detailed usage notes." +msgstr "" + +#: ../../library/heapq.rst:151 msgid "The module also offers three general purpose functions based on heaps." msgstr "這個模組也提供三個利用 heap 實作的一般用途函式" -#: ../../library/heapq.rst:90 +#: ../../library/heapq.rst:156 msgid "" "Merge multiple sorted inputs into a single sorted output (for example, merge " "timestamped entries from multiple log files). Returns an :term:`iterator` " @@ -164,7 +251,7 @@ msgstr "" "合併多個已排序的輸入並產生單一且已排序的輸出(舉例:合併來自多個 log 檔中有時" "間戳記的項目)。回傳一個 :term:`iterator` 包含已經排序的值。" -#: ../../library/heapq.rst:94 +#: ../../library/heapq.rst:160 msgid "" "Similar to ``sorted(itertools.chain(*iterables))`` but returns an iterable, " "does not pull the data into memory all at once, and assumes that each of the " @@ -173,12 +260,12 @@ msgstr "" "和 ``sorted(itertools.chain(*iterables))`` 類似但回傳值是一個 iterable ,不會" "一次把所有資料都放進記憶體中,並且假設每一個輸入都已經(由小到大)排序過了。" -#: ../../library/heapq.rst:98 +#: ../../library/heapq.rst:164 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選用參數,指定時必須被當作關鍵字參數指定。" -#: ../../library/heapq.rst:100 +#: ../../library/heapq.rst:166 msgid "" "*key* specifies a :term:`key function` of one argument that is used to " "extract a comparison key from each input element. The default value is " @@ -187,7 +274,7 @@ msgstr "" "*key* 參數指定了一個 :term:`key function` 引數,用來從每一個輸入的元素中決定" "一個比較的依據。預設的值是 ``None`` (直接比較元素)。" -#: ../../library/heapq.rst:104 +#: ../../library/heapq.rst:170 msgid "" "*reverse* is a boolean value. If set to ``True``, then the input elements " "are merged as if each comparison were reversed. To achieve behavior similar " @@ -198,11 +285,11 @@ msgstr "" "進行合併。為了達成類似 ``sorted(itertools.chain(*iterables), reverse=True)`` " "的行為,所有 iterables 必須由大到小排序。" -#: ../../library/heapq.rst:109 +#: ../../library/heapq.rst:175 msgid "Added the optional *key* and *reverse* parameters." msgstr "加入選用參數 *key* 和 *reverse* 。" -#: ../../library/heapq.rst:115 +#: ../../library/heapq.rst:181 msgid "" "Return a list with the *n* largest elements from the dataset defined by " "*iterable*. *key*, if provided, specifies a function of one argument that " @@ -215,7 +302,7 @@ msgstr "" "的依據(例如 ``key=str.lower`` )。效果相當於 ``sorted(iterable, key=key, " "reverse=True)[:n]`` 。" -#: ../../library/heapq.rst:124 +#: ../../library/heapq.rst:190 msgid "" "Return a list with the *n* smallest elements from the dataset defined by " "*iterable*. *key*, if provided, specifies a function of one argument that " @@ -228,7 +315,7 @@ msgstr "" "的依據(例如 ``key=str.lower`` )。效果相當於 ``sorted(iterable, key=key)" "[:n]`` 。" -#: ../../library/heapq.rst:130 +#: ../../library/heapq.rst:196 msgid "" "The latter two functions perform best for smaller values of *n*. For larger " "values, it is more efficient to use the :func:`sorted` function. Also, when " @@ -241,11 +328,11 @@ msgstr "" "式 :func:`min` 和 :func:`max` 會有更好的效率。如果需要重複使用這些函式,可以" "考慮將 iterable 轉成真正的 heap 。" -#: ../../library/heapq.rst:138 +#: ../../library/heapq.rst:204 msgid "Basic Examples" msgstr "基礎範例" -#: ../../library/heapq.rst:140 +#: ../../library/heapq.rst:206 msgid "" "A `heapsort `_ can be implemented by " "pushing all values onto a heap and then popping off the smallest values one " @@ -254,7 +341,7 @@ msgstr "" "`堆積排序 (heapsort) `_ 可以透過將所" "有的值推入一個 heap,並且從 heap 中一個接一個彈出最小元素來實作: ::" -#: ../../library/heapq.rst:144 +#: ../../library/heapq.rst:210 msgid "" ">>> def heapsort(iterable):\n" "... h = []\n" @@ -274,7 +361,7 @@ msgstr "" ">>> heapsort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])\n" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]" -#: ../../library/heapq.rst:153 +#: ../../library/heapq.rst:219 msgid "" "This is similar to ``sorted(iterable)``, but unlike :func:`sorted`, this " "implementation is not stable." @@ -282,7 +369,7 @@ msgstr "" "雖然類似 ``sorted(iterable)`` ,但跟 :func:`sorted` 不同的是,這個實作不是 " "stable 的排序。" -#: ../../library/heapq.rst:156 +#: ../../library/heapq.rst:222 msgid "" "Heap elements can be tuples. This is useful for assigning comparison values " "(such as task priorities) alongside the main record being tracked::" @@ -290,7 +377,7 @@ msgstr "" "Heap 中的元素可以是 tuple 。這有利於將要比較的值(例如一個 task 的優先度)和" "主要資料放在一起排序: ::" -#: ../../library/heapq.rst:159 +#: ../../library/heapq.rst:225 msgid "" ">>> h = []\n" ">>> heappush(h, (5, 'write code'))\n" @@ -308,11 +395,11 @@ msgstr "" ">>> heappop(h)\n" "(1, 'write spec')" -#: ../../library/heapq.rst:169 +#: ../../library/heapq.rst:235 msgid "Priority Queue Implementation Notes" msgstr "優先佇列實作細節" -#: ../../library/heapq.rst:171 +#: ../../library/heapq.rst:237 msgid "" "A `priority queue `_ is common " "use for a heap, and it presents several implementation challenges:" @@ -320,7 +407,7 @@ msgstr "" "`優先佇列 (priority queue) `_ " "是 heap 的常見用途之一,實作優先佇列伴隨著下列挑戰:" -#: ../../library/heapq.rst:174 +#: ../../library/heapq.rst:240 msgid "" "Sort stability: how do you get two tasks with equal priorities to be " "returned in the order they were originally added?" @@ -328,7 +415,7 @@ msgstr "" "排序的穩定性:如何將兩個擁有相同優先次序 (priority) 的 task 按照他們被加入的" "順序回傳?" -#: ../../library/heapq.rst:177 +#: ../../library/heapq.rst:243 msgid "" "Tuple comparison breaks for (priority, task) pairs if the priorities are " "equal and the tasks do not have a default comparison order." @@ -336,21 +423,21 @@ msgstr "" "Tuple的排序在某些情況下會壞掉,例如當 Tuple (priority, task) 的 priorities 相" "等且 tasks 沒有一個預設的排序時。" -#: ../../library/heapq.rst:180 +#: ../../library/heapq.rst:246 msgid "" "If the priority of a task changes, how do you move it to a new position in " "the heap?" msgstr "" "當一個 heap 中 task 的 priority 改變時,如何將它移到 heap 正確的位置上?" -#: ../../library/heapq.rst:183 +#: ../../library/heapq.rst:249 msgid "" "Or if a pending task needs to be deleted, how do you find it and remove it " "from the queue?" msgstr "" "或者一個還沒被解決的 task 需要被刪除時,要如何從佇列中找到並刪除指定的 task?" -#: ../../library/heapq.rst:186 +#: ../../library/heapq.rst:252 msgid "" "A solution to the first two challenges is to store entries as 3-element list " "including the priority, an entry count, and the task. The entry count " @@ -363,7 +450,7 @@ msgstr "" "入的順序排序。因為沒有任何兩個 task 擁有相同的 entry count,所以永遠不會直接" "使用 task 做比較。" -#: ../../library/heapq.rst:192 +#: ../../library/heapq.rst:258 msgid "" "Another solution to the problem of non-comparable tasks is to create a " "wrapper class that ignores the task item and only compares the priority " @@ -372,7 +459,7 @@ msgstr "" "task 無法比較的另一個解決方案是建立一個包裝器類別,該類別忽略 task 項目,只比" "較優先等級: ::" -#: ../../library/heapq.rst:195 +#: ../../library/heapq.rst:261 msgid "" "from dataclasses import dataclass, field\n" "from typing import Any\n" @@ -390,7 +477,7 @@ msgstr "" " priority: int\n" " item: Any=field(compare=False)" -#: ../../library/heapq.rst:203 +#: ../../library/heapq.rst:269 msgid "" "The remaining challenges revolve around finding a pending task and making " "changes to its priority or removing it entirely. Finding a task can be done " @@ -399,7 +486,7 @@ msgstr "" "剩下的問題可以藉由找到要刪除的 task 並更改它的 priority 或者直接將它移除。尋" "找一個 task 可以使用一個 dictionary 指向佇列當中的 entry 。" -#: ../../library/heapq.rst:207 +#: ../../library/heapq.rst:273 msgid "" "Removing the entry or changing its priority is more difficult because it " "would break the heap structure invariants. So, a possible solution is to " @@ -409,7 +496,7 @@ msgstr "" "行的方案是將原本的 entry 做一個標記表示它已經被刪除,並新增一個擁有新的 " "priority 的 entry: ::" -#: ../../library/heapq.rst:211 +#: ../../library/heapq.rst:277 msgid "" "pq = [] # list of entries arranged in a heap\n" "entry_finder = {} # mapping of tasks to entries\n" @@ -467,11 +554,11 @@ msgstr "" " return task\n" " raise KeyError('從空的優先佇列中 pop 出元素')" -#: ../../library/heapq.rst:241 +#: ../../library/heapq.rst:307 msgid "Theory" msgstr "原理" -#: ../../library/heapq.rst:243 +#: ../../library/heapq.rst:309 msgid "" "Heaps are arrays for which ``a[k] <= a[2*k+1]`` and ``a[k] <= a[2*k+2]`` for " "all *k*, counting elements from 0. For the sake of comparison, non-existing " @@ -482,7 +569,7 @@ msgstr "" "和 ``a[k] <= a[2*k+2]`` 。為了方便比較,不存在的元素被視為無限大。Heap 的一個" "有趣的性質是:``a[0]`` 永遠是最小的元素。" -#: ../../library/heapq.rst:248 +#: ../../library/heapq.rst:314 msgid "" "The strange invariant above is meant to be an efficient memory " "representation for a tournament. The numbers below are *k*, not ``a[k]``::" @@ -490,7 +577,7 @@ msgstr "" "上述乍看之下有些奇怪的不變式,是為了實作一個對記憶體來說有效率的方法,其表示" "方式如同錦標賽一般。下列的數字為 *k*,而不是 ``a[k]``: ::" -#: ../../library/heapq.rst:251 +#: ../../library/heapq.rst:317 msgid "" " 0\n" "\n" @@ -512,7 +599,7 @@ msgstr "" "\n" "15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30" -#: ../../library/heapq.rst:261 +#: ../../library/heapq.rst:327 msgid "" "In the tree above, each cell *k* is topping ``2*k+1`` and ``2*k+2``. In a " "usual binary tournament we see in sports, each cell is the winner over the " @@ -531,7 +618,7 @@ msgstr "" "下方較低層級的另一個項目來取代它,至此規則變為一個單元以及它下方兩個單元,包" "含三個不同項目,但是最上方的單元「勝過」下方兩個單元。" -#: ../../library/heapq.rst:270 +#: ../../library/heapq.rst:336 msgid "" "If this heap invariant is protected at all time, index 0 is clearly the " "overall winner. The simplest algorithmic way to remove it and find the " @@ -547,7 +634,7 @@ msgstr "" "的複雜度顯然是樹的節點數目的對數級別。透過對所有項目疊代,可以得到一個複雜度" "為 *O*\\ (*n* log *n*) 的排序。" -#: ../../library/heapq.rst:277 +#: ../../library/heapq.rst:343 msgid "" "A nice feature of this sort is that you can efficiently insert new items " "while the sort is going on, provided that the inserted items are not " @@ -564,7 +651,7 @@ msgstr "" "時,因這些事件仍在等待進行,所以很容易將它們插入 heap 當中。因此, heap 是一" "個實現排程器的優秀資料結構(這就是我用以實作 MIDI 編曲器的方法 :-)。" -#: ../../library/heapq.rst:286 +#: ../../library/heapq.rst:352 msgid "" "Various structures for implementing schedulers have been extensively " "studied, and heaps are good for this, as they are reasonably speedy, the " @@ -576,7 +663,7 @@ msgstr "" "快,且速度幾乎不受其他因素影響,最壞情況與平均狀況差異無幾。也有其它整體說來" "更有效率的方法,然而它們的最壞情況可能會非常糟糕。" -#: ../../library/heapq.rst:292 +#: ../../library/heapq.rst:358 msgid "" "Heaps are also very useful in big disk sorts. You most probably all know " "that a big sort implies producing \"runs\" (which are pre-sorted sequences, " @@ -597,7 +684,7 @@ msgstr "" "於隨機產生的輸入,將可以產生長度兩倍於記憶體大小的 run。對於已模糊排序過的輸" "入,效果更好。" -#: ../../library/heapq.rst:302 +#: ../../library/heapq.rst:368 msgid "" "Moreover, if you output the 0'th item on disk and get an input which may not " "fit in the current tournament (because the value \"wins\" over the last " @@ -613,7 +700,7 @@ msgstr "" "大小增加的速度會與第一個 heap 減少的速度一致。當第一個 heap 完全消失時,你可" "以切換至第二個 heap 開啟一個新 run 。這真是個聰明且相當有效率的做法!" -#: ../../library/heapq.rst:310 +#: ../../library/heapq.rst:376 msgid "" "In a word, heaps are useful memory structures to know. I use them in a few " "applications, and I think it is good to keep a 'heap' module around. :-)" @@ -621,11 +708,11 @@ msgstr "" "總結來說,heap 是值得了解的有用記憶體結構。我在一些應用中使用它們,我認為能有" "一個 'heap' 模組是很棒的。:-)" -#: ../../library/heapq.rst:314 +#: ../../library/heapq.rst:380 msgid "Footnotes" msgstr "註解" -#: ../../library/heapq.rst:315 +#: ../../library/heapq.rst:381 msgid "" "The disk balancing algorithms which are current, nowadays, are more annoying " "than clever, and this is a consequence of the seeking capabilities of the " diff --git a/library/http.cookies.po b/library/http.cookies.po index 8c5c66d5c8f..c9aeb1e8e3c 100644 --- a/library/http.cookies.po +++ b/library/http.cookies.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-28 00:20+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-12-24 18:49+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,12 +38,12 @@ msgstr "" #: ../../library/http.cookies.rst:19 msgid "" -"The module formerly strictly applied the parsing rules described in the :rfc:" -"`2109` and :rfc:`2068` specifications. It has since been discovered that " -"MSIE 3.0x didn't follow the character rules outlined in those specs; many " -"current-day browsers and servers have also relaxed parsing rules when it " -"comes to cookie handling. As a result, this module now uses parsing rules " -"that are a bit less strict than they once were." +"The module formerly strictly applied the parsing rules described in " +"the :rfc:`2109` and :rfc:`2068` specifications. It has since been " +"discovered that MSIE 3.0x didn't follow the character rules outlined in " +"those specs; many current-day browsers and servers have also relaxed parsing " +"rules when it comes to cookie handling. As a result, this module now uses " +"parsing rules that are a bit less strict than they once were." msgstr "" "此模組原先嚴格遵循了 :rfc:`2109` 和 :rfc:`2068` 規範所描述的剖析規則。自從發" "現 MSIE 3.0x 並不遵循這些規範所描述的字元規則,許多目前的瀏覽器和伺服器也在處" @@ -55,8 +55,9 @@ msgid "" "``!#$%&'*+-.^_`|~:`` denote the set of valid characters allowed by this " "module in a cookie name (as :attr:`~Morsel.key`)." msgstr "" -"字元集 :data:`string.ascii_letters`、:data:`string.digits` 和 ``!#$%&'*+-." -"^_`|~`` 表示此模組在 cookie 名稱 (:attr:`~Morsel.key`) 中允許的合法字元集合。" +"字元集 :data:`string.ascii_letters`、:data:`string.digits` 和 ``!#$" +"%&'*+-.^_`|~`` 表示此模組在 cookie 名稱 (:attr:`~Morsel.key`) 中允許的合法字" +"元集合。" #: ../../library/http.cookies.rst:30 msgid "Allowed ':' as a valid cookie name character." @@ -95,11 +96,12 @@ msgstr "如果有給定 *input*,它會被傳遞給 :meth:`load` 方法。" #: ../../library/http.cookies.rst:58 msgid "" -"This class derives from :class:`BaseCookie` and overrides :meth:`~BaseCookie." -"value_decode` and :meth:`~BaseCookie.value_encode`. :class:`!SimpleCookie` " -"supports strings as cookie values. When setting the value, :class:`!" -"SimpleCookie` calls the builtin :func:`str` to convert the value to a " -"string. Values received from HTTP are kept as strings." +"This class derives from :class:`BaseCookie` and " +"overrides :meth:`~BaseCookie.value_decode` " +"and :meth:`~BaseCookie.value_encode`. :class:`!SimpleCookie` supports " +"strings as cookie values. When setting the value, :class:`!SimpleCookie` " +"calls the builtin :func:`str` to convert the value to a string. Values " +"received from HTTP are kept as strings." msgstr "" "這個類別繼承自 :class:`BaseCookie` 並覆寫了 :meth:`~BaseCookie.value_decode` " "和 :meth:`~BaseCookie.value_encode`。:class:`!SimpleCookie` 支援字串作為 " @@ -112,11 +114,11 @@ msgstr ":mod:`http.cookiejar` 模組" #: ../../library/http.cookies.rst:67 msgid "" -"HTTP cookie handling for web *clients*. The :mod:`http.cookiejar` and :mod:" -"`http.cookies` modules do not depend on each other." +"HTTP cookie handling for web *clients*. The :mod:`http.cookiejar` " +"and :mod:`http.cookies` modules do not depend on each other." msgstr "" -"用於網路\\ *用戶端*\\ 的 HTTP cookie 處理。:mod:`http.cookiejar` 和 :mod:" -"`http.cookies` 模組互不相依。" +"用於網路\\ *用戶端*\\ 的 HTTP cookie 處理。:mod:`http.cookiejar` " +"和 :mod:`http.cookies` 模組互不相依。" #: ../../library/http.cookies.rst:70 msgid ":rfc:`2109` - HTTP State Management Mechanism" @@ -133,8 +135,8 @@ msgstr "Cookie 物件" #: ../../library/http.cookies.rst:82 msgid "" "Return a tuple ``(real_value, coded_value)`` from a string representation. " -"``real_value`` can be any type. This method does no decoding in :class:" -"`BaseCookie` --- it exists so it can be overridden." +"``real_value`` can be any type. This method does no decoding " +"in :class:`BaseCookie` --- it exists so it can be overridden." msgstr "" "從字串表示回傳 ``(real_value, coded_value)`` 的元組。``real_value`` 可以是任" "何型別。此方法在 :class:`BaseCookie` 中不做解碼 --- 它存在以便可以被覆寫。" @@ -151,8 +153,8 @@ msgstr "" #: ../../library/http.cookies.rst:94 msgid "" -"In general, it should be the case that :meth:`value_encode` and :meth:" -"`value_decode` are inverses on the range of *value_decode*." +"In general, it should be the case that :meth:`value_encode` " +"and :meth:`value_decode` are inverses on the range of *value_decode*." msgstr "" "一般來說,:meth:`value_encode` 和 :meth:`value_decode` 應該在 *value_decode* " "的範圍內是互逆的 (inverse)。" @@ -176,8 +178,8 @@ msgstr "" "回傳一個可嵌入的 JavaScript 片段,如果在支援 JavaScript 的瀏覽器上執行,它的" "行為會與 HTTP 標頭被傳送的情況相同。" -#: ../../library/http.cookies.rst:111 ../../library/http.cookies.rst:210 -#: ../../library/http.cookies.rst:218 +#: ../../library/http.cookies.rst:111 ../../library/http.cookies.rst:227 +#: ../../library/http.cookies.rst:235 msgid "The meaning for *attrs* is the same as in :meth:`output`." msgstr "*attrs* 的意義與 :meth:`output` 裡的相同。" @@ -214,7 +216,7 @@ msgstr "" "Morsel 是一種類似字典的物件,其鍵的集合是固定的 --- 有效的 :rfc:`2109` 屬性," "它們是:" -#: ../../library/http.cookies.rst:146 +#: ../../library/http.cookies.rst:147 msgid "" "The attribute :attr:`httponly` specifies that the cookie is only transferred " "in HTTP requests, and is not accessible through JavaScript. This is intended " @@ -223,7 +225,7 @@ msgstr "" "屬性 :attr:`httponly` 指定 cookie 僅在 HTTP 請求中傳輸,而不可通過 " "JavaScript 存取。這是為了減輕某些形式的跨網站腳本攻擊。" -#: ../../library/http.cookies.rst:150 +#: ../../library/http.cookies.rst:151 msgid "" "The attribute :attr:`samesite` controls when the browser sends the cookie " "with cross-site requests. This helps to mitigate CSRF attacks. Valid values " @@ -232,55 +234,78 @@ msgid "" "and cross-site requests). When using \"None\", the \"secure\" attribute must " "also be set, as required by modern browsers." msgstr "" -":attr:`samesite` 屬性控制瀏覽器要在何時將 cookie 與跨網站請求一起傳送," -"這有助於減輕 CSRF 攻擊。有效值為 \"Strict\"\\ (僅在同站請求時傳送)、" -"\"Lax\"\\ (同站請求和頂層導航時傳送)和 \"None\"\\ (同站請求和跨站請求時傳送)。" -"使用 \"None\" 時,必須同時設定 \"secure\" 屬性,這是現代瀏覽器的要求。" +":attr:`samesite` 屬性控制瀏覽器要在何時將 cookie 與跨網站請求一起傳送,這有助" +"於減輕 CSRF 攻擊。有效值為 \"Strict\"\\ (僅在同站請求時傳送)、\"Lax\"\\ " +"(同站請求和頂層導航時傳送)和 \"None\"\\ (同站請求和跨站請求時傳送)。使用 " +"\"None\" 時,必須同時設定 \"secure\" 屬性,這是現代瀏覽器的要求。" + +#: ../../library/http.cookies.rst:158 +msgid "" +"The attribute :attr:`partitioned` indicates to user agents that these cross-" +"site cookies *should* only be available in the same top-level context that " +"the cookie was first set in. For this to be accepted by the user agent, you " +"**must** also set ``Secure``." +msgstr "" + +#: ../../library/http.cookies.rst:163 +msgid "" +"In addition, it is recommended to use the ``__Host`` prefix when setting " +"partitioned cookies to make them bound to the hostname and not the " +"registrable domain. Read `CHIPS (Cookies Having Independent Partitioned " +"State)`_ for full details and examples." +msgstr "" -#: ../../library/http.cookies.rst:157 +#: ../../library/http.cookies.rst:171 msgid "The keys are case-insensitive and their default value is ``''``." msgstr "鍵不區分大小寫,其預設值為 ``''``。" -#: ../../library/http.cookies.rst:159 +#: ../../library/http.cookies.rst:173 msgid "" ":meth:`!__eq__` now takes :attr:`~Morsel.key` and :attr:`~Morsel.value` into " "account." msgstr "" ":meth:`!__eq__` 現在會考慮 :attr:`~Morsel.key` 和 :attr:`~Morsel.value`。" -#: ../../library/http.cookies.rst:163 +#: ../../library/http.cookies.rst:177 msgid "" -"Attributes :attr:`~Morsel.key`, :attr:`~Morsel.value` and :attr:`~Morsel." -"coded_value` are read-only. Use :meth:`~Morsel.set` for setting them." +"Attributes :attr:`~Morsel.key`, :attr:`~Morsel.value` " +"and :attr:`~Morsel.coded_value` are read-only. Use :meth:`~Morsel.set` for " +"setting them." msgstr "" -"屬性 :attr:`~Morsel.key`、:attr:`~Morsel.value` 和 :attr:`~Morsel." -"coded_value` 是唯讀的。請使用 :meth:`~Morsel.set` 來設定它們。" +"屬性 :attr:`~Morsel.key`、:attr:`~Morsel.value` " +"和 :attr:`~Morsel.coded_value` 是唯讀的。請使用 :meth:`~Morsel.set` 來設定它" +"們。" -#: ../../library/http.cookies.rst:168 +#: ../../library/http.cookies.rst:182 msgid "Added support for the :attr:`samesite` attribute." msgstr "新增對 :attr:`samesite` 屬性的支援。" -#: ../../library/http.cookies.rst:174 +#: ../../library/http.cookies.rst:185 +#, fuzzy +msgid "Added support for the :attr:`partitioned` attribute." +msgstr "新增對 :attr:`samesite` 屬性的支援。" + +#: ../../library/http.cookies.rst:191 msgid "The value of the cookie." msgstr "cookie 的值。" -#: ../../library/http.cookies.rst:179 +#: ../../library/http.cookies.rst:196 msgid "The encoded value of the cookie --- this is what should be sent." msgstr "cookie 的編碼值 --- 這是應該被傳送的值。" -#: ../../library/http.cookies.rst:184 +#: ../../library/http.cookies.rst:201 msgid "The name of the cookie." msgstr "cookie 的名稱。" -#: ../../library/http.cookies.rst:189 +#: ../../library/http.cookies.rst:206 msgid "Set the *key*, *value* and *coded_value* attributes." msgstr "設定 *key*、*value* 和 *coded_value* 屬性。" -#: ../../library/http.cookies.rst:194 +#: ../../library/http.cookies.rst:211 msgid "Whether *K* is a member of the set of keys of a :class:`Morsel`." msgstr "*K* 是否為 :class:`Morsel` 的鍵集合中的成員。" -#: ../../library/http.cookies.rst:199 +#: ../../library/http.cookies.rst:216 msgid "" "Return a string representation of the Morsel, suitable to be sent as an HTTP " "header. By default, all the attributes are included, unless *attrs* is " @@ -291,7 +316,7 @@ msgstr "" "定 *attrs*,在此情況下,它應該是一個要使用的屬性的串列。預設的 *header* 是 " "``\"Set-Cookie:\"``。" -#: ../../library/http.cookies.rst:207 +#: ../../library/http.cookies.rst:224 msgid "" "Return an embeddable JavaScript snippet, which, if run on a browser which " "supports JavaScript, will act the same as if the HTTP header was sent." @@ -299,13 +324,13 @@ msgstr "" "回傳一個可嵌入的 JavaScript 片段,如果在支援 JavaScript 的瀏覽器上執行,它的" "行為會與 HTTP 標頭被傳送的情況相同。" -#: ../../library/http.cookies.rst:215 +#: ../../library/http.cookies.rst:232 msgid "" "Return a string representing the Morsel, without any surrounding HTTP or " "JavaScript." msgstr "回傳表示 Morsel 的字串,不包含周圍任何的 HTTP 或 JavaScript。" -#: ../../library/http.cookies.rst:223 +#: ../../library/http.cookies.rst:240 msgid "" "Update the values in the Morsel dictionary with the values in the dictionary " "*values*. Raise an error if any of the keys in the *values* dict is not a " @@ -314,36 +339,36 @@ msgstr "" "更新 Morsel 字典中的值為 *values* 字典中的值。如果 *values* 字典中的任何鍵不" "是有效的 :rfc:`2109` 屬性則引發錯誤。" -#: ../../library/http.cookies.rst:227 +#: ../../library/http.cookies.rst:244 msgid "an error is raised for invalid keys." msgstr "對於無效的鍵會引發錯誤。" -#: ../../library/http.cookies.rst:233 +#: ../../library/http.cookies.rst:250 msgid "Return a shallow copy of the Morsel object." msgstr "回傳 Morsel 物件的淺層複製。" -#: ../../library/http.cookies.rst:235 +#: ../../library/http.cookies.rst:252 msgid "return a Morsel object instead of a dict." msgstr "回傳 Morsel 物件而不是字典。" -#: ../../library/http.cookies.rst:241 +#: ../../library/http.cookies.rst:258 msgid "" "Raise an error if key is not a valid :rfc:`2109` attribute, otherwise behave " "the same as :meth:`dict.setdefault`." msgstr "" -"如果鍵不是一個有效的 :rfc:`2109` 屬性會引發錯誤,否則行為與 :meth:`dict." -"setdefault` 相同。" +"如果鍵不是一個有效的 :rfc:`2109` 屬性會引發錯誤,否則行為" +"與 :meth:`dict.setdefault` 相同。" -#: ../../library/http.cookies.rst:248 +#: ../../library/http.cookies.rst:265 msgid "Example" msgstr "範例" -#: ../../library/http.cookies.rst:250 +#: ../../library/http.cookies.rst:267 msgid "" "The following example demonstrates how to use the :mod:`http.cookies` module." msgstr "以下範例示範如何使用 :mod:`http.cookies` 模組。" -#: ../../library/http.cookies.rst:252 +#: ../../library/http.cookies.rst:269 msgid "" ">>> from http import cookies\n" ">>> C = cookies.SimpleCookie()\n" diff --git a/library/http.server.po b/library/http.server.po index 63505924a46..6829e5a0c18 100644 --- a/library/http.server.po +++ b/library/http.server.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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "此模組定義了用於實作 HTTP 伺服器的類別。" #: ../../library/http.server.rst:22 msgid "" -":mod:`http.server` is not recommended for production. It only implements :" -"ref:`basic security checks `." +":mod:`http.server` is not recommended for production. It only " +"implements :ref:`basic security checks `." msgstr "" #: ../../includes/wasm-notavail.rst:3 @@ -69,9 +69,9 @@ msgstr "" #: ../../library/http.server.rst:39 msgid "" "This class builds on the :class:`~socketserver.TCPServer` class by storing " -"the server address as instance variables named :attr:`server_name` and :attr:" -"`server_port`. The server is accessible by the handler, typically through " -"the handler's :attr:`server` instance variable." +"the server address as instance variables named :attr:`server_name` " +"and :attr:`server_port`. The server is accessible by the handler, typically " +"through the handler's :attr:`server` instance variable." msgstr "" #: ../../library/http.server.rst:46 @@ -82,23 +82,69 @@ msgid "" "indefinitely." msgstr "" -#: ../../library/http.server.rst:54 +#: ../../library/http.server.rst:58 msgid "" -"The :class:`HTTPServer` and :class:`ThreadingHTTPServer` must be given a " -"*RequestHandlerClass* on instantiation, of which this module provides three " -"different variants:" +"Subclass of :class:`HTTPServer` with a wrapped socket using the :mod:`ssl` " +"module. If the :mod:`ssl` module is not available, instantiating a :class:`!" +"HTTPSServer` object fails with a :exc:`RuntimeError`." msgstr "" -#: ../../library/http.server.rst:60 +#: ../../library/http.server.rst:62 +msgid "" +"The *certfile* argument is the path to the SSL certificate chain file, and " +"the *keyfile* is the path to file containing the private key." +msgstr "" + +#: ../../library/http.server.rst:65 +msgid "" +"A *password* can be specified for files protected and wrapped with PKCS#8, " +"but beware that this could possibly expose hardcoded passwords in clear." +msgstr "" + +#: ../../library/http.server.rst:70 +msgid "" +"See :meth:`ssl.SSLContext.load_cert_chain` for additional information on the " +"accepted values for *certfile*, *keyfile* and *password*." +msgstr "" + +#: ../../library/http.server.rst:74 +msgid "" +"When specified, the *alpn_protocols* argument must be a sequence of strings " +"specifying the \"Application-Layer Protocol Negotiation\" (ALPN) protocols " +"supported by the server. ALPN allows the server and the client to negotiate " +"the application protocol during the TLS handshake." +msgstr "" + +#: ../../library/http.server.rst:79 +msgid "" +"By default, it is set to ``[\"http/1.1\"]``, meaning the server supports " +"HTTP/1.1." +msgstr "" + +#: ../../library/http.server.rst:87 +msgid "" +"This class is identical to :class:`HTTPSServer` but uses threads to handle " +"requests by inheriting from :class:`~socketserver.ThreadingMixIn`. This is " +"analogous to :class:`ThreadingHTTPServer` only using :class:`HTTPSServer`." +msgstr "" + +#: ../../library/http.server.rst:94 +msgid "" +"The :class:`HTTPServer`, :class:`ThreadingHTTPServer`, :class:`HTTPSServer` " +"and :class:`ThreadingHTTPSServer` must be given a *RequestHandlerClass* on " +"instantiation, of which this module provides three different variants:" +msgstr "" + +#: ../../library/http.server.rst:100 msgid "" "This class is used to handle the HTTP requests that arrive at the server. " "By itself, it cannot respond to any actual HTTP requests; it must be " -"subclassed to handle each request method (e.g. GET or POST). :class:" -"`BaseHTTPRequestHandler` provides a number of class and instance variables, " -"and methods for use by subclasses." +"subclassed to handle each request method (e.g. GET or " +"POST). :class:`BaseHTTPRequestHandler` provides a number of class and " +"instance variables, and methods for use by subclasses." msgstr "" -#: ../../library/http.server.rst:66 +#: ../../library/http.server.rst:106 msgid "" "The handler will parse the request and the headers, then call a method " "specific to the request type. The method name is constructed from the " @@ -108,52 +154,52 @@ msgid "" "override or extend the :meth:`!__init__` method." msgstr "" -#: ../../library/http.server.rst:73 +#: ../../library/http.server.rst:113 msgid ":class:`BaseHTTPRequestHandler` has the following instance variables:" msgstr ":class:`BaseHTTPRequestHandler` 有以下實例變數:" -#: ../../library/http.server.rst:77 +#: ../../library/http.server.rst:117 msgid "" "Contains a tuple of the form ``(host, port)`` referring to the client's " "address." msgstr "" -#: ../../library/http.server.rst:82 +#: ../../library/http.server.rst:122 msgid "Contains the server instance." msgstr "" -#: ../../library/http.server.rst:86 +#: ../../library/http.server.rst:126 msgid "" "Boolean that should be set before :meth:`handle_one_request` returns, " "indicating if another request may be expected, or if the connection should " "be shut down." msgstr "" -#: ../../library/http.server.rst:92 +#: ../../library/http.server.rst:132 msgid "" "Contains the string representation of the HTTP request line. The terminating " -"CRLF is stripped. This attribute should be set by :meth:" -"`handle_one_request`. If no valid request line was processed, it should be " -"set to the empty string." +"CRLF is stripped. This attribute should be set " +"by :meth:`handle_one_request`. If no valid request line was processed, it " +"should be set to the empty string." msgstr "" -#: ../../library/http.server.rst:99 +#: ../../library/http.server.rst:139 msgid "Contains the command (request type). For example, ``'GET'``." msgstr "" -#: ../../library/http.server.rst:103 +#: ../../library/http.server.rst:143 msgid "" "Contains the request path. If query component of the URL is present, then " "``path`` includes the query. Using the terminology of :rfc:`3986`, ``path`` " "here includes ``hier-part`` and the ``query``." msgstr "" -#: ../../library/http.server.rst:109 +#: ../../library/http.server.rst:149 msgid "" "Contains the version string from the request. For example, ``'HTTP/1.0'``." msgstr "" -#: ../../library/http.server.rst:113 +#: ../../library/http.server.rst:153 msgid "" "Holds an instance of the class specified by the :attr:`MessageClass` class " "variable. This instance parses and manages the headers in the HTTP request. " @@ -162,42 +208,42 @@ msgid "" "valid :rfc:`2822` style header." msgstr "" -#: ../../library/http.server.rst:121 +#: ../../library/http.server.rst:161 msgid "" "An :class:`io.BufferedIOBase` input stream, ready to read from the start of " "the optional input data." msgstr "" -#: ../../library/http.server.rst:126 +#: ../../library/http.server.rst:166 msgid "" "Contains the output stream for writing a response back to the client. Proper " "adherence to the HTTP protocol must be used when writing to this stream in " "order to achieve successful interoperation with HTTP clients." msgstr "" -#: ../../library/http.server.rst:131 +#: ../../library/http.server.rst:171 msgid "This is an :class:`io.BufferedIOBase` stream." msgstr "" -#: ../../library/http.server.rst:134 +#: ../../library/http.server.rst:174 msgid ":class:`BaseHTTPRequestHandler` has the following attributes:" msgstr ":class:`BaseHTTPRequestHandler` 擁有以下屬性:" -#: ../../library/http.server.rst:138 +#: ../../library/http.server.rst:178 msgid "" "Specifies the server software version. You may want to override this. The " "format is multiple whitespace-separated strings, where each string is of the " "form name[/version]. For example, ``'BaseHTTP/0.2'``." msgstr "" -#: ../../library/http.server.rst:144 +#: ../../library/http.server.rst:184 msgid "" -"Contains the Python system version, in a form usable by the :attr:" -"`version_string` method and the :attr:`server_version` class variable. For " -"example, ``'Python/1.4'``." +"Contains the Python system version, in a form usable by " +"the :attr:`version_string` method and the :attr:`server_version` class " +"variable. For example, ``'Python/1.4'``." msgstr "" -#: ../../library/http.server.rst:150 +#: ../../library/http.server.rst:190 msgid "" "Specifies a format string that should be used by :meth:`send_error` method " "for building an error response to the client. The string is filled by " @@ -205,13 +251,13 @@ msgid "" "passed to :meth:`send_error`." msgstr "" -#: ../../library/http.server.rst:157 +#: ../../library/http.server.rst:197 msgid "" "Specifies the Content-Type HTTP header of error responses sent to the " "client. The default value is ``'text/html'``." msgstr "" -#: ../../library/http.server.rst:162 +#: ../../library/http.server.rst:202 msgid "" "Specifies the HTTP version to which the server is conformant. It is sent in " "responses to let the client know the server's communication capabilities for " @@ -222,14 +268,14 @@ msgid "" "``'HTTP/1.0'``." msgstr "" -#: ../../library/http.server.rst:172 +#: ../../library/http.server.rst:212 msgid "" "Specifies an :class:`email.message.Message`\\ -like class to parse HTTP " -"headers. Typically, this is not overridden, and it defaults to :class:`http." -"client.HTTPMessage`." +"headers. Typically, this is not overridden, and it defaults " +"to :class:`http.client.HTTPMessage`." msgstr "" -#: ../../library/http.server.rst:178 +#: ../../library/http.server.rst:218 msgid "" "This attribute contains a mapping of error code integers to two-element " "tuples containing a short and long message. For example, ``{code: " @@ -238,24 +284,24 @@ msgid "" "It is used by :meth:`send_response_only` and :meth:`send_error` methods." msgstr "" -#: ../../library/http.server.rst:184 +#: ../../library/http.server.rst:224 msgid "A :class:`BaseHTTPRequestHandler` instance has the following methods:" msgstr ":class:`BaseHTTPRequestHandler` 實例擁有以下方法:" -#: ../../library/http.server.rst:188 +#: ../../library/http.server.rst:228 msgid "" "Calls :meth:`handle_one_request` once (or, if persistent connections are " "enabled, multiple times) to handle incoming HTTP requests. You should never " "need to override it; instead, implement appropriate :meth:`!do_\\*` methods." msgstr "" -#: ../../library/http.server.rst:195 +#: ../../library/http.server.rst:235 msgid "" "This method will parse and dispatch the request to the appropriate :meth:`!" "do_\\*` method. You should never need to override it." msgstr "" -#: ../../library/http.server.rst:200 +#: ../../library/http.server.rst:240 msgid "" "When an HTTP/1.1 conformant server receives an ``Expect: 100-continue`` " "request header it responds back with a ``100 Continue`` followed by ``200 " @@ -264,7 +310,7 @@ msgid "" "``417 Expectation Failed`` as a response header and ``return False``." msgstr "" -#: ../../library/http.server.rst:211 +#: ../../library/http.server.rst:251 msgid "" "Sends and logs a complete error reply to the client. The numeric *code* " "specifies the HTTP error code, with *message* as an optional, short, human " @@ -279,13 +325,13 @@ msgid "" "``205 Reset Content``, ``304 Not Modified``." msgstr "" -#: ../../library/http.server.rst:223 +#: ../../library/http.server.rst:263 msgid "" "The error response includes a Content-Length header. Added the *explain* " "argument." msgstr "" -#: ../../library/http.server.rst:229 +#: ../../library/http.server.rst:269 msgid "" "Adds a response header to the headers buffer and logs the accepted request. " "The HTTP response line is written to the internal buffer, followed by " @@ -296,26 +342,26 @@ msgid "" "followed by an :meth:`end_headers` call." msgstr "" -#: ../../library/http.server.rst:238 +#: ../../library/http.server.rst:278 msgid "" "Headers are stored to an internal buffer and :meth:`end_headers` needs to be " "called explicitly." msgstr "" -#: ../../library/http.server.rst:244 +#: ../../library/http.server.rst:284 msgid "" "Adds the HTTP header to an internal buffer which will be written to the " "output stream when either :meth:`end_headers` or :meth:`flush_headers` is " "invoked. *keyword* should specify the header keyword, with *value* " -"specifying its value. Note that, after the send_header calls are done, :meth:" -"`end_headers` MUST BE called in order to complete the operation." +"specifying its value. Note that, after the send_header calls are " +"done, :meth:`end_headers` MUST BE called in order to complete the operation." msgstr "" -#: ../../library/http.server.rst:250 +#: ../../library/http.server.rst:290 msgid "Headers are stored in an internal buffer." msgstr "" -#: ../../library/http.server.rst:255 +#: ../../library/http.server.rst:295 msgid "" "Sends the response header only, used for the purposes when ``100 Continue`` " "response is sent by the server to the client. The headers not buffered and " @@ -323,152 +369,152 @@ msgid "" "message corresponding the response *code* is sent." msgstr "" -#: ../../library/http.server.rst:264 +#: ../../library/http.server.rst:304 msgid "" "Adds a blank line (indicating the end of the HTTP headers in the response) " "to the headers buffer and calls :meth:`flush_headers`." msgstr "" -#: ../../library/http.server.rst:268 +#: ../../library/http.server.rst:308 msgid "The buffered headers are written to the output stream." msgstr "" -#: ../../library/http.server.rst:273 +#: ../../library/http.server.rst:313 msgid "" "Finally send the headers to the output stream and flush the internal headers " "buffer." msgstr "" -#: ../../library/http.server.rst:280 +#: ../../library/http.server.rst:320 msgid "" "Logs an accepted (successful) request. *code* should specify the numeric " "HTTP code associated with the response. If a size of the response is " "available, then it should be passed as the *size* parameter." msgstr "" -#: ../../library/http.server.rst:286 +#: ../../library/http.server.rst:326 msgid "" "Logs an error when a request cannot be fulfilled. By default, it passes the " "message to :meth:`log_message`, so it takes the same arguments (*format* and " "additional values)." msgstr "" -#: ../../library/http.server.rst:293 +#: ../../library/http.server.rst:333 msgid "" "Logs an arbitrary message to ``sys.stderr``. This is typically overridden to " "create custom error logging mechanisms. The *format* argument is a standard " -"printf-style format string, where the additional arguments to :meth:" -"`log_message` are applied as inputs to the formatting. The client ip address " -"and current date and time are prefixed to every message logged." +"printf-style format string, where the additional arguments " +"to :meth:`log_message` are applied as inputs to the formatting. The client " +"ip address and current date and time are prefixed to every message logged." msgstr "" -#: ../../library/http.server.rst:301 +#: ../../library/http.server.rst:341 msgid "" -"Returns the server software's version string. This is a combination of the :" -"attr:`server_version` and :attr:`sys_version` attributes." +"Returns the server software's version string. This is a combination of " +"the :attr:`server_version` and :attr:`sys_version` attributes." msgstr "" -#: ../../library/http.server.rst:306 +#: ../../library/http.server.rst:346 msgid "" "Returns the date and time given by *timestamp* (which must be ``None`` or in " "the format returned by :func:`time.time`), formatted for a message header. " "If *timestamp* is omitted, it uses the current date and time." msgstr "" -#: ../../library/http.server.rst:310 +#: ../../library/http.server.rst:350 msgid "The result looks like ``'Sun, 06 Nov 1994 08:49:37 GMT'``." msgstr "" -#: ../../library/http.server.rst:314 +#: ../../library/http.server.rst:354 msgid "Returns the current date and time, formatted for logging." msgstr "" -#: ../../library/http.server.rst:318 +#: ../../library/http.server.rst:358 msgid "Returns the client address." msgstr "" -#: ../../library/http.server.rst:320 +#: ../../library/http.server.rst:360 msgid "" "Previously, a name lookup was performed. To avoid name resolution delays, it " "now always returns the IP address." msgstr "" -#: ../../library/http.server.rst:327 +#: ../../library/http.server.rst:367 msgid "" "This class serves files from the directory *directory* and below, or the " "current directory if *directory* is not provided, directly mapping the " "directory structure to HTTP requests." msgstr "" -#: ../../library/http.server.rst:331 +#: ../../library/http.server.rst:371 msgid "Added the *directory* parameter." msgstr "新增 *directory* 參數。" -#: ../../library/http.server.rst:334 +#: ../../library/http.server.rst:374 msgid "The *directory* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/http.server.rst:337 +#: ../../library/http.server.rst:377 msgid "" -"A lot of the work, such as parsing the request, is done by the base class :" -"class:`BaseHTTPRequestHandler`. This class implements the :func:`do_GET` " -"and :func:`do_HEAD` functions." +"A lot of the work, such as parsing the request, is done by the base " +"class :class:`BaseHTTPRequestHandler`. This class implements " +"the :func:`do_GET` and :func:`do_HEAD` functions." msgstr "" -#: ../../library/http.server.rst:341 +#: ../../library/http.server.rst:381 msgid "" -"The following are defined as class-level attributes of :class:" -"`SimpleHTTPRequestHandler`:" +"The following are defined as class-level attributes " +"of :class:`SimpleHTTPRequestHandler`:" msgstr "" -#: ../../library/http.server.rst:346 +#: ../../library/http.server.rst:386 msgid "" "This will be ``\"SimpleHTTP/\" + __version__``, where ``__version__`` is " "defined at the module level." msgstr "" -#: ../../library/http.server.rst:351 +#: ../../library/http.server.rst:391 msgid "" "A dictionary mapping suffixes into MIME types, contains custom overrides for " "the default system mappings. The mapping is used case-insensitively, and so " "should contain only lower-cased keys." msgstr "" -#: ../../library/http.server.rst:355 +#: ../../library/http.server.rst:395 msgid "" "This dictionary is no longer filled with the default system mappings, but " "only contains overrides." msgstr "" -#: ../../library/http.server.rst:359 +#: ../../library/http.server.rst:399 msgid "" "The :class:`SimpleHTTPRequestHandler` class defines the following methods:" msgstr ":class:`SimpleHTTPRequestHandler` 類別定義了以下方法:" -#: ../../library/http.server.rst:363 +#: ../../library/http.server.rst:403 msgid "" "This method serves the ``'HEAD'`` request type: it sends the headers it " "would send for the equivalent ``GET`` request. See the :meth:`do_GET` method " "for a more complete explanation of the possible headers." msgstr "" -#: ../../library/http.server.rst:369 +#: ../../library/http.server.rst:409 msgid "" "The request is mapped to a local file by interpreting the request as a path " "relative to the current working directory." msgstr "" -#: ../../library/http.server.rst:372 +#: ../../library/http.server.rst:412 msgid "" "If the request was mapped to a directory, the directory is checked for a " "file named ``index.html`` or ``index.htm`` (in that order). If found, the " "file's contents are returned; otherwise a directory listing is generated by " -"calling the :meth:`list_directory` method. This method uses :func:`os." -"listdir` to scan the directory, and returns a ``404`` error response if the :" -"func:`~os.listdir` fails." +"calling the :meth:`list_directory` method. This method " +"uses :func:`os.listdir` to scan the directory, and returns a ``404`` error " +"response if the :func:`~os.listdir` fails." msgstr "" -#: ../../library/http.server.rst:379 +#: ../../library/http.server.rst:419 msgid "" "If the request was mapped to a file, it is opened. Any :exc:`OSError` " "exception in opening the requested file is mapped to a ``404``, ``'File not " @@ -479,37 +525,37 @@ msgid "" "*extensions_map* variable, and the file contents are returned." msgstr "" -#: ../../library/http.server.rst:387 +#: ../../library/http.server.rst:427 msgid "" "A ``'Content-type:'`` header with the guessed content type is output, " "followed by a ``'Content-Length:'`` header with the file's size and a " "``'Last-Modified:'`` header with the file's modification time." msgstr "" -#: ../../library/http.server.rst:391 +#: ../../library/http.server.rst:431 msgid "" "Then follows a blank line signifying the end of the headers, and then the " "contents of the file are output." msgstr "" -#: ../../library/http.server.rst:394 +#: ../../library/http.server.rst:434 msgid "" -"For example usage, see the implementation of the ``test`` function in :" -"source:`Lib/http/server.py`." +"For example usage, see the implementation of the ``test`` function " +"in :source:`Lib/http/server.py`." msgstr "" -#: ../../library/http.server.rst:397 +#: ../../library/http.server.rst:437 msgid "Support of the ``'If-Modified-Since'`` header." msgstr "" -#: ../../library/http.server.rst:400 +#: ../../library/http.server.rst:440 msgid "" "The :class:`SimpleHTTPRequestHandler` class can be used in the following " "manner in order to create a very basic webserver serving files relative to " "the current directory::" msgstr "" -#: ../../library/http.server.rst:404 +#: ../../library/http.server.rst:444 msgid "" "import http.server\n" "import socketserver\n" @@ -533,28 +579,28 @@ msgstr "" " print(\"serving at port\", PORT)\n" " httpd.serve_forever()" -#: ../../library/http.server.rst:416 +#: ../../library/http.server.rst:456 msgid "" ":class:`SimpleHTTPRequestHandler` can also be subclassed to enhance " "behavior, such as using different index file names by overriding the class " "attribute :attr:`index_pages`." msgstr "" -#: ../../library/http.server.rst:423 +#: ../../library/http.server.rst:463 msgid "" "This class is used to serve either files or output of CGI scripts from the " "current directory and below. Note that mapping HTTP hierarchic structure to " "local directory structure is exactly as in :class:`SimpleHTTPRequestHandler`." msgstr "" -#: ../../library/http.server.rst:429 +#: ../../library/http.server.rst:469 msgid "" "CGI scripts run by the :class:`CGIHTTPRequestHandler` class cannot execute " "redirects (HTTP code 302), because code 200 (script output follows) is sent " "prior to execution of the CGI script. This pre-empts the status code." msgstr "" -#: ../../library/http.server.rst:434 +#: ../../library/http.server.rst:474 msgid "" "The class will however, run the CGI script, instead of serving it as a file, " "if it guesses it to be a CGI script. Only directory-based CGI are used --- " @@ -562,79 +608,79 @@ msgid "" "denoting CGI scripts." msgstr "" -#: ../../library/http.server.rst:439 +#: ../../library/http.server.rst:479 msgid "" "The :func:`do_GET` and :func:`do_HEAD` functions are modified to run CGI " "scripts and serve the output, instead of serving files, if the request leads " "to somewhere below the ``cgi_directories`` path." msgstr "" -#: ../../library/http.server.rst:443 +#: ../../library/http.server.rst:483 msgid "The :class:`CGIHTTPRequestHandler` defines the following data member:" msgstr ":class:`CGIHTTPRequestHandler` 類別定義了以下資料成員:" -#: ../../library/http.server.rst:447 +#: ../../library/http.server.rst:487 msgid "" "This defaults to ``['/cgi-bin', '/htbin']`` and describes directories to " "treat as containing CGI scripts." msgstr "" -#: ../../library/http.server.rst:450 +#: ../../library/http.server.rst:490 msgid "The :class:`CGIHTTPRequestHandler` defines the following method:" msgstr ":class:`CGIHTTPRequestHandler` 類別定義了以下方法:" -#: ../../library/http.server.rst:454 +#: ../../library/http.server.rst:494 msgid "" "This method serves the ``'POST'`` request type, only allowed for CGI " "scripts. Error 501, \"Can only POST to CGI scripts\", is output when trying " "to POST to a non-CGI url." msgstr "" -#: ../../library/http.server.rst:458 +#: ../../library/http.server.rst:498 msgid "" "Note that CGI scripts will be run with UID of user nobody, for security " "reasons. Problems with the CGI script will be translated to error 403." msgstr "" -#: ../../library/http.server.rst:463 +#: ../../library/http.server.rst:503 msgid "" ":class:`CGIHTTPRequestHandler` is being removed in 3.15. CGI has not been " "considered a good way to do things for well over a decade. This code has " "been unmaintained for a while now and sees very little practical use. " -"Retaining it could lead to further :ref:`security considerations `." +"Retaining it could lead to further :ref:`security considerations " +"`." msgstr "" -#: ../../library/http.server.rst:473 +#: ../../library/http.server.rst:513 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/http.server.rst:475 +#: ../../library/http.server.rst:515 msgid "" ":mod:`http.server` can also be invoked directly using the :option:`-m` " "switch of the interpreter. The following example illustrates how to serve " "files relative to the current directory::" msgstr "" -#: ../../library/http.server.rst:479 +#: ../../library/http.server.rst:519 msgid "python -m http.server [OPTIONS] [port]" msgstr "python -m http.server [OPTIONS] [port]" -#: ../../library/http.server.rst:481 +#: ../../library/http.server.rst:521 msgid "The following options are accepted:" msgstr "可接受以下選項:" -#: ../../library/http.server.rst:487 +#: ../../library/http.server.rst:527 msgid "" "The server listens to port 8000 by default. The default can be overridden by " "passing the desired port number as an argument::" msgstr "" -#: ../../library/http.server.rst:490 +#: ../../library/http.server.rst:530 msgid "python -m http.server 9000" msgstr "python -m http.server 9000" -#: ../../library/http.server.rst:494 +#: ../../library/http.server.rst:534 msgid "" "Specifies a specific address to which it should bind. Both IPv4 and IPv6 " "addresses are supported. By default, the server binds itself to all " @@ -642,80 +688,113 @@ msgid "" "localhost only::" msgstr "" -#: ../../library/http.server.rst:499 +#: ../../library/http.server.rst:539 msgid "python -m http.server --bind 127.0.0.1" msgstr "python -m http.server --bind 127.0.0.1" -#: ../../library/http.server.rst:503 +#: ../../library/http.server.rst:543 msgid "Support IPv6 in the ``--bind`` option." msgstr "於 ``--bind`` 選項中支援 IPv6。" -#: ../../library/http.server.rst:508 +#: ../../library/http.server.rst:548 msgid "" "Specifies a directory to which it should serve the files. By default, the " "server uses the current directory. For example, the following command uses a " "specific directory::" msgstr "" -#: ../../library/http.server.rst:512 +#: ../../library/http.server.rst:552 msgid "python -m http.server --directory /tmp/" msgstr "python -m http.server --directory /tmp/" -#: ../../library/http.server.rst:518 +#: ../../library/http.server.rst:558 msgid "" "Specifies the HTTP version to which the server is conformant. By default, " "the server is conformant to HTTP/1.0. For example, the following command " "runs an HTTP/1.1 conformant server::" msgstr "" -#: ../../library/http.server.rst:522 +#: ../../library/http.server.rst:562 msgid "python -m http.server --protocol HTTP/1.1" msgstr "python -m http.server --protocol HTTP/1.1" -#: ../../library/http.server.rst:528 +#: ../../library/http.server.rst:568 msgid "" ":class:`CGIHTTPRequestHandler` can be enabled in the command line by passing " "the ``--cgi`` option::" msgstr "" -#: ../../library/http.server.rst:531 +#: ../../library/http.server.rst:571 msgid "python -m http.server --cgi" msgstr "python -m http.server --cgi" -#: ../../library/http.server.rst:535 +#: ../../library/http.server.rst:575 msgid "" -":mod:`http.server` command line ``--cgi`` support is being removed because :" -"class:`CGIHTTPRequestHandler` is being removed." +":mod:`http.server` command line ``--cgi`` support is being removed " +"because :class:`CGIHTTPRequestHandler` is being removed." msgstr "" -#: ../../library/http.server.rst:540 +#: ../../library/http.server.rst:580 msgid "" ":class:`CGIHTTPRequestHandler` and the ``--cgi`` command-line option are not " "intended for use by untrusted clients and may be vulnerable to exploitation. " "Always use within a secure environment." msgstr "" -#: ../../library/http.server.rst:548 +#: ../../library/http.server.rst:586 +msgid "Specifies a TLS certificate chain for HTTPS connections::" +msgstr "" + +#: ../../library/http.server.rst:588 +#, fuzzy +msgid "python -m http.server --tls-cert fullchain.pem" +msgstr "python -m http.server --cgi" + +#: ../../library/http.server.rst:594 +msgid "Specifies a private key file for HTTPS connections." +msgstr "" + +#: ../../library/http.server.rst:596 +msgid "This option requires ``--tls-cert`` to be specified." +msgstr "" + +#: ../../library/http.server.rst:602 +msgid "Specifies the password file for password-protected private keys::" +msgstr "" + +#: ../../library/http.server.rst:604 +msgid "" +"python -m http.server \\\n" +" --tls-cert cert.pem \\\n" +" --tls-key key.pem \\\n" +" --tls-password-file password.txt" +msgstr "" + +#: ../../library/http.server.rst:609 +msgid "This option requires `--tls-cert`` to be specified." +msgstr "" + +#: ../../library/http.server.rst:617 msgid "Security considerations" msgstr "安全性注意事項" -#: ../../library/http.server.rst:552 +#: ../../library/http.server.rst:621 msgid "" ":class:`SimpleHTTPRequestHandler` will follow symbolic links when handling " "requests, this makes it possible for files outside of the specified " "directory to be served." msgstr "" -#: ../../library/http.server.rst:556 +#: ../../library/http.server.rst:625 msgid "" "Earlier versions of Python did not scrub control characters from the log " -"messages emitted to stderr from ``python -m http.server`` or the default :" -"class:`BaseHTTPRequestHandler` ``.log_message`` implementation. This could " -"allow remote clients connecting to your server to send nefarious control " -"codes to your terminal." +"messages emitted to stderr from ``python -m http.server`` or the " +"default :class:`BaseHTTPRequestHandler` ``.log_message`` implementation. " +"This could allow remote clients connecting to your server to send nefarious " +"control codes to your terminal." msgstr "" -#: ../../library/http.server.rst:562 +#: ../../library/http.server.rst:631 msgid "Control characters are scrubbed in stderr logs." msgstr "" @@ -743,11 +822,11 @@ msgstr "URL(統一資源定位器)" msgid "httpd" msgstr "httpd" -#: ../../library/http.server.rst:550 +#: ../../library/http.server.rst:619 msgid "http.server" msgstr "http.server" -#: ../../library/http.server.rst:550 +#: ../../library/http.server.rst:619 msgid "security" msgstr "security(安全)" diff --git a/library/imaplib.po b/library/imaplib.po index e30c6ea3ac8..33a19495d6a 100644 --- a/library/imaplib.po +++ b/library/imaplib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-24 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -21,17 +21,17 @@ msgstr "" msgid ":mod:`!imaplib` --- IMAP4 protocol client" msgstr ":mod:`!imaplib` --- IMAP4 協定用戶端" -#: ../../library/imaplib.rst:14 +#: ../../library/imaplib.rst:15 msgid "**Source code:** :source:`Lib/imaplib.py`" msgstr "**原始碼:**\\ :source:`Lib/imaplib.py`" -#: ../../library/imaplib.rst:23 +#: ../../library/imaplib.rst:24 msgid "" -"This module defines three classes, :class:`IMAP4`, :class:`IMAP4_SSL` and :" -"class:`IMAP4_stream`, which encapsulate a connection to an IMAP4 server and " -"implement a large subset of the IMAP4rev1 client protocol as defined in :rfc:" -"`2060`. It is backward compatible with IMAP4 (:rfc:`1730`) servers, but note " -"that the ``STATUS`` command is not supported in IMAP4." +"This module defines three classes, :class:`IMAP4`, :class:`IMAP4_SSL` " +"and :class:`IMAP4_stream`, which encapsulate a connection to an IMAP4 server " +"and implement a large subset of the IMAP4rev1 client protocol as defined " +"in :rfc:`2060`. It is backward compatible with IMAP4 (:rfc:`1730`) servers, " +"but note that the ``STATUS`` command is not supported in IMAP4." msgstr "" #: ../../includes/wasm-notavail.rst:3 @@ -46,13 +46,13 @@ msgstr "" "此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" "availability`。" -#: ../../library/imaplib.rst:31 +#: ../../library/imaplib.rst:32 msgid "" "Three classes are provided by the :mod:`imaplib` module, :class:`IMAP4` is " "the base class:" msgstr "" -#: ../../library/imaplib.rst:37 +#: ../../library/imaplib.rst:38 msgid "" "This class implements the actual IMAP4 protocol. The connection is created " "and protocol version (IMAP4 or IMAP4rev1) is determined when the instance is " @@ -63,14 +63,14 @@ msgid "" "timeout is used." msgstr "" -#: ../../library/imaplib.rst:44 +#: ../../library/imaplib.rst:45 msgid "" "The :class:`IMAP4` class supports the :keyword:`with` statement. When used " -"like this, the IMAP4 ``LOGOUT`` command is issued automatically when the :" -"keyword:`!with` statement exits. E.g.::" +"like this, the IMAP4 ``LOGOUT`` command is issued automatically when " +"the :keyword:`!with` statement exits. E.g.::" msgstr "" -#: ../../library/imaplib.rst:48 +#: ../../library/imaplib.rst:49 msgid "" ">>> from imaplib import IMAP4\n" ">>> with IMAP4(\"domain.org\") as M:\n" @@ -84,32 +84,32 @@ msgstr "" "...\n" "('OK', [b'Nothing Accomplished. d25if65hy903weo.87'])" -#: ../../library/imaplib.rst:54 +#: ../../library/imaplib.rst:55 msgid "Support for the :keyword:`with` statement was added." msgstr "" -#: ../../library/imaplib.rst:57 ../../library/imaplib.rst:111 +#: ../../library/imaplib.rst:58 ../../library/imaplib.rst:112 msgid "The optional *timeout* parameter was added." msgstr "新增 *timeout* 選用參數。" -#: ../../library/imaplib.rst:60 +#: ../../library/imaplib.rst:61 msgid "Three exceptions are defined as attributes of the :class:`IMAP4` class:" msgstr "" -#: ../../library/imaplib.rst:65 +#: ../../library/imaplib.rst:66 msgid "" "Exception raised on any errors. The reason for the exception is passed to " "the constructor as a string." msgstr "" -#: ../../library/imaplib.rst:71 +#: ../../library/imaplib.rst:72 msgid "" "IMAP4 server errors cause this exception to be raised. This is a sub-class " "of :exc:`IMAP4.error`. Note that closing the instance and instantiating a " "new one will usually allow recovery from this exception." msgstr "" -#: ../../library/imaplib.rst:78 +#: ../../library/imaplib.rst:79 msgid "" "This exception is raised when a writable mailbox has its status changed by " "the server. This is a sub-class of :exc:`IMAP4.error`. Some other client " @@ -117,11 +117,11 @@ msgid "" "obtain write permission." msgstr "" -#: ../../library/imaplib.rst:84 +#: ../../library/imaplib.rst:85 msgid "There's also a subclass for secure connections:" msgstr "" -#: ../../library/imaplib.rst:90 +#: ../../library/imaplib.rst:91 msgid "" "This is a subclass derived from :class:`IMAP4` that connects over an SSL " "encrypted socket (to use this class you need a socket module that was " @@ -133,72 +133,73 @@ msgid "" "for best practices." msgstr "" -#: ../../library/imaplib.rst:99 +#: ../../library/imaplib.rst:100 msgid "" "The optional *timeout* parameter specifies a timeout in seconds for the " "connection attempt. If timeout is not given or is ``None``, the global " "default socket timeout is used." msgstr "" -#: ../../library/imaplib.rst:103 +#: ../../library/imaplib.rst:104 msgid "*ssl_context* parameter was added." msgstr "新增 *ssl_context* 參數。" -#: ../../library/imaplib.rst:106 +#: ../../library/imaplib.rst:107 msgid "" -"The class now supports hostname check with :attr:`ssl.SSLContext." -"check_hostname` and *Server Name Indication* (see :const:`ssl.HAS_SNI`)." +"The class now supports hostname check " +"with :attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* " +"(see :const:`ssl.HAS_SNI`)." msgstr "" -#: ../../library/imaplib.rst:114 +#: ../../library/imaplib.rst:115 msgid "The deprecated *keyfile* and *certfile* parameters have been removed." msgstr "" -#: ../../library/imaplib.rst:117 +#: ../../library/imaplib.rst:118 msgid "The second subclass allows for connections created by a child process:" msgstr "" -#: ../../library/imaplib.rst:122 +#: ../../library/imaplib.rst:123 msgid "" "This is a subclass derived from :class:`IMAP4` that connects to the ``stdin/" -"stdout`` file descriptors created by passing *command* to ``subprocess." -"Popen()``." +"stdout`` file descriptors created by passing *command* to " +"``subprocess.Popen()``." msgstr "" -#: ../../library/imaplib.rst:127 +#: ../../library/imaplib.rst:128 msgid "The following utility functions are defined:" msgstr "" -#: ../../library/imaplib.rst:132 +#: ../../library/imaplib.rst:133 msgid "" "Parse an IMAP4 ``INTERNALDATE`` string and return corresponding local time. " "The return value is a :class:`time.struct_time` tuple or ``None`` if the " "string has wrong format." msgstr "" -#: ../../library/imaplib.rst:138 +#: ../../library/imaplib.rst:139 msgid "" "Converts an integer into a bytes representation using characters from the " "set [``A`` .. ``P``]." msgstr "" -#: ../../library/imaplib.rst:144 +#: ../../library/imaplib.rst:145 msgid "Converts an IMAP4 ``FLAGS`` response to a tuple of individual flags." msgstr "" -#: ../../library/imaplib.rst:149 +#: ../../library/imaplib.rst:150 msgid "" "Convert *date_time* to an IMAP4 ``INTERNALDATE`` representation. The return " "value is a string in the form: ``\"DD-Mmm-YYYY HH:MM:SS +HHMM\"`` (including " "double-quotes). The *date_time* argument can be a number (int or float) " "representing seconds since epoch (as returned by :func:`time.time`), a 9-" "tuple representing local time an instance of :class:`time.struct_time` (as " -"returned by :func:`time.localtime`), an aware instance of :class:`datetime." -"datetime`, or a double-quoted string. In the last case, it is assumed to " -"already be in the correct format." +"returned by :func:`time.localtime`), an aware instance " +"of :class:`datetime.datetime`, or a double-quoted string. In the last case, " +"it is assumed to already be in the correct format." msgstr "" -#: ../../library/imaplib.rst:159 +#: ../../library/imaplib.rst:160 msgid "" "Note that IMAP4 message numbers change as the mailbox changes; in " "particular, after an ``EXPUNGE`` command performs deletions the remaining " @@ -206,30 +207,30 @@ msgid "" "the UID command." msgstr "" -#: ../../library/imaplib.rst:163 +#: ../../library/imaplib.rst:164 msgid "" "At the end of the module, there is a test section that contains a more " "extensive example of usage." msgstr "" -#: ../../library/imaplib.rst:169 +#: ../../library/imaplib.rst:170 msgid "" "Documents describing the protocol, sources for servers implementing it, by " "the University of Washington's IMAP Information Center can all be found at " "(**Source Code**) https://github.com/uw-imap/imap (**Not Maintained**)." msgstr "" -#: ../../library/imaplib.rst:177 +#: ../../library/imaplib.rst:178 msgid "IMAP4 Objects" msgstr "IMAP4 物件" -#: ../../library/imaplib.rst:179 +#: ../../library/imaplib.rst:180 msgid "" "All IMAP4rev1 commands are represented by methods of the same name, either " "uppercase or lowercase." msgstr "" -#: ../../library/imaplib.rst:182 +#: ../../library/imaplib.rst:183 msgid "" "All arguments to commands are converted to strings, except for " "``AUTHENTICATE``, and the last argument to ``APPEND`` which is passed as an " @@ -241,16 +242,16 @@ msgid "" "(eg: ``r'(\\Deleted)'``)." msgstr "" -#: ../../library/imaplib.rst:190 +#: ../../library/imaplib.rst:191 msgid "" -"Each command returns a tuple: ``(type, [data, ...])`` where *type* is " +"Most commands return a tuple: ``(type, [data, ...])`` where *type* is " "usually ``'OK'`` or ``'NO'``, and *data* is either the text from the command " "response, or mandated results from the command. Each *data* is either a " "``bytes``, or a tuple. If a tuple, then the first part is the header of the " "response, and the second part contains the data (ie: 'literal' value)." msgstr "" -#: ../../library/imaplib.rst:196 +#: ../../library/imaplib.rst:197 msgid "" "The *message_set* options to commands below is a string specifying one or " "more messages to be acted upon. It may be a simple message number " @@ -259,34 +260,34 @@ msgid "" "an asterisk to indicate an infinite upper bound (``'3:*'``)." msgstr "" -#: ../../library/imaplib.rst:202 +#: ../../library/imaplib.rst:203 msgid "An :class:`IMAP4` instance has the following methods:" msgstr ":class:`IMAP4` 實例擁有以下方法:" -#: ../../library/imaplib.rst:207 +#: ../../library/imaplib.rst:208 msgid "Append *message* to named mailbox." msgstr "" -#: ../../library/imaplib.rst:212 +#: ../../library/imaplib.rst:213 msgid "Authenticate command --- requires response processing." msgstr "" -#: ../../library/imaplib.rst:214 +#: ../../library/imaplib.rst:215 msgid "" "*mechanism* specifies which authentication mechanism is to be used - it " "should appear in the instance variable ``capabilities`` in the form " "``AUTH=mechanism``." msgstr "" -#: ../../library/imaplib.rst:217 +#: ../../library/imaplib.rst:218 msgid "*authobject* must be a callable object::" msgstr "" -#: ../../library/imaplib.rst:219 +#: ../../library/imaplib.rst:220 msgid "data = authobject(response)" msgstr "data = authobject(response)" -#: ../../library/imaplib.rst:221 +#: ../../library/imaplib.rst:222 msgid "" "It will be called to process server continuation responses; the *response* " "argument it is passed will be ``bytes``. It should return ``bytes`` *data* " @@ -294,152 +295,257 @@ msgid "" "``None`` if the client abort response ``*`` should be sent instead." msgstr "" -#: ../../library/imaplib.rst:226 +#: ../../library/imaplib.rst:227 msgid "" "string usernames and passwords are now encoded to ``utf-8`` instead of being " "limited to ASCII." msgstr "" -#: ../../library/imaplib.rst:233 +#: ../../library/imaplib.rst:234 msgid "Checkpoint mailbox on server." msgstr "" -#: ../../library/imaplib.rst:238 +#: ../../library/imaplib.rst:239 msgid "" "Close currently selected mailbox. Deleted messages are removed from writable " "mailbox. This is the recommended command before ``LOGOUT``." msgstr "" -#: ../../library/imaplib.rst:244 +#: ../../library/imaplib.rst:245 msgid "Copy *message_set* messages onto end of *new_mailbox*." msgstr "" -#: ../../library/imaplib.rst:249 +#: ../../library/imaplib.rst:250 msgid "Create new mailbox named *mailbox*." msgstr "" -#: ../../library/imaplib.rst:254 +#: ../../library/imaplib.rst:255 msgid "Delete old mailbox named *mailbox*." msgstr "" -#: ../../library/imaplib.rst:259 +#: ../../library/imaplib.rst:260 msgid "Delete the ACLs (remove any rights) set for who on mailbox." msgstr "" -#: ../../library/imaplib.rst:264 +#: ../../library/imaplib.rst:265 msgid "" "Enable *capability* (see :rfc:`5161`). Most capabilities do not need to be " -"enabled. Currently only the ``UTF8=ACCEPT`` capability is supported (see :" -"RFC:`6855`)." +"enabled. Currently only the ``UTF8=ACCEPT`` capability is supported " +"(see :RFC:`6855`)." msgstr "" -#: ../../library/imaplib.rst:268 +#: ../../library/imaplib.rst:269 msgid "The :meth:`enable` method itself, and :RFC:`6855` support." msgstr "" -#: ../../library/imaplib.rst:274 +#: ../../library/imaplib.rst:275 msgid "" "Permanently remove deleted items from selected mailbox. Generates an " "``EXPUNGE`` response for each deleted message. Returned data contains a list " "of ``EXPUNGE`` message numbers in order received." msgstr "" -#: ../../library/imaplib.rst:281 +#: ../../library/imaplib.rst:282 msgid "" "Fetch (parts of) messages. *message_parts* should be a string of message " "part names enclosed within parentheses, eg: ``\"(UID BODY[TEXT])\"``. " "Returned data are tuples of message part envelope and data." msgstr "" -#: ../../library/imaplib.rst:288 +#: ../../library/imaplib.rst:289 msgid "" "Get the ``ACL``\\ s for *mailbox*. The method is non-standard, but is " "supported by the ``Cyrus`` server." msgstr "" -#: ../../library/imaplib.rst:294 +#: ../../library/imaplib.rst:295 msgid "" "Retrieve the specified ``ANNOTATION``\\ s for *mailbox*. The method is non-" "standard, but is supported by the ``Cyrus`` server." msgstr "" -#: ../../library/imaplib.rst:300 +#: ../../library/imaplib.rst:301 msgid "" "Get the ``quota`` *root*'s resource usage and limits. This method is part of " "the IMAP4 QUOTA extension defined in rfc2087." msgstr "" -#: ../../library/imaplib.rst:306 +#: ../../library/imaplib.rst:307 msgid "" "Get the list of ``quota`` ``roots`` for the named *mailbox*. This method is " "part of the IMAP4 QUOTA extension defined in rfc2087." msgstr "" -#: ../../library/imaplib.rst:312 +#: ../../library/imaplib.rst:313 +msgid "" +"Return an :class:`!Idler`: an iterable context manager implementing the " +"IMAP4 ``IDLE`` command as defined in :rfc:`2177`." +msgstr "" + +#: ../../library/imaplib.rst:316 +msgid "" +"The returned object sends the ``IDLE`` command when activated by " +"the :keyword:`with` statement, produces IMAP untagged responses via " +"the :term:`iterator` protocol, and sends ``DONE`` upon context exit." +msgstr "" + +#: ../../library/imaplib.rst:320 +msgid "" +"All untagged responses that arrive after sending the ``IDLE`` command " +"(including any that arrive before the server acknowledges the command) will " +"be available via iteration. Any leftover responses (those not iterated in " +"the :keyword:`with` context) can be retrieved in the usual way after " +"``IDLE`` ends, using :meth:`IMAP4.response`." +msgstr "" + +#: ../../library/imaplib.rst:326 +msgid "" +"Responses are represented as ``(type, [data, ...])`` tuples, as described " +"in :ref:`IMAP4 Objects `." +msgstr "" + +#: ../../library/imaplib.rst:329 +msgid "" +"The *duration* argument sets a maximum duration (in seconds) to keep idling, " +"after which any ongoing iteration will stop. It can be an :class:`int` " +"or :class:`float`, or ``None`` for no time limit. Callers wishing to avoid " +"inactivity timeouts on servers that impose them should keep this at most 29 " +"minutes (1740 seconds). Requires a socket connection; *duration* must be " +"``None`` on :class:`IMAP4_stream` connections." +msgstr "" + +#: ../../library/imaplib.rst:337 +msgid "" +">>> with M.idle(duration=29 * 60) as idler:\n" +"... for typ, data in idler:\n" +"... print(typ, data)\n" +"...\n" +"EXISTS [b'1']\n" +"RECENT [b'1']" +msgstr "" + +#: ../../library/imaplib.rst:349 +msgid "" +"Yield a burst of responses no more than *interval* seconds apart (expressed " +"as an :class:`int` or :class:`float`)." +msgstr "" + +#: ../../library/imaplib.rst:352 +msgid "" +"This :term:`generator` is an alternative to iterating one response at a " +"time, intended to aid in efficient batch processing. It retrieves the next " +"response along with any immediately available subsequent responses. (For " +"example, a rapid series of ``EXPUNGE`` responses after a bulk delete.)" +msgstr "" + +#: ../../library/imaplib.rst:358 +msgid "" +"Requires a socket connection; does not work on :class:`IMAP4_stream` " +"connections." +msgstr "" + +#: ../../library/imaplib.rst:361 +msgid "" +">>> with M.idle() as idler:\n" +"... # get a response and any others following by < 0.1 seconds\n" +"... batch = list(idler.burst())\n" +"... print(f'processing {len(batch)} responses...')\n" +"... print(batch)\n" +"...\n" +"processing 3 responses...\n" +"[('EXPUNGE', [b'2']), ('EXPUNGE', [b'1']), ('RECENT', [b'0'])]" +msgstr "" + +#: ../../library/imaplib.rst:374 +msgid "" +"The ``IDLE`` context's maximum duration, as passed to :meth:`IMAP4.idle`, is " +"respected when waiting for the first response in a burst. Therefore, an " +"expired :class:`!Idler` will cause this generator to return immediately " +"without producing anything. Callers should consider this if using it in a " +"loop." +msgstr "" + +#: ../../library/imaplib.rst:383 +msgid "" +"The iterator returned by :meth:`IMAP4.idle` is usable only within " +"a :keyword:`with` statement. Before or after that context, unsolicited " +"responses are collected internally whenever a command finishes, and can be " +"retrieved with :meth:`IMAP4.response`." +msgstr "" + +#: ../../library/imaplib.rst:390 +msgid "" +"The :class:`!Idler` class name and structure are internal interfaces, " +"subject to change. Calling code can rely on its context management, " +"iteration, and public method to remain stable, but should not subclass, " +"instantiate, compare, or otherwise directly reference the class." +msgstr "" + +#: ../../library/imaplib.rst:400 msgid "" "List mailbox names in *directory* matching *pattern*. *directory* defaults " "to the top-level mail folder, and *pattern* defaults to match anything. " "Returned data contains a list of ``LIST`` responses." msgstr "" -#: ../../library/imaplib.rst:319 +#: ../../library/imaplib.rst:407 msgid "" "Identify the client using a plaintext password. The *password* will be " "quoted." msgstr "" -#: ../../library/imaplib.rst:324 +#: ../../library/imaplib.rst:412 msgid "" "Force use of ``CRAM-MD5`` authentication when identifying the client to " "protect the password. Will only work if the server ``CAPABILITY`` response " "includes the phrase ``AUTH=CRAM-MD5``." msgstr "" -#: ../../library/imaplib.rst:328 +#: ../../library/imaplib.rst:416 msgid "An :exc:`IMAP4.error` is raised if MD5 support is not available." msgstr "" -#: ../../library/imaplib.rst:334 +#: ../../library/imaplib.rst:422 msgid "Shutdown connection to server. Returns server ``BYE`` response." msgstr "" -#: ../../library/imaplib.rst:336 +#: ../../library/imaplib.rst:424 msgid "The method no longer ignores silently arbitrary exceptions." msgstr "" -#: ../../library/imaplib.rst:342 +#: ../../library/imaplib.rst:430 msgid "" "List subscribed mailbox names in directory matching pattern. *directory* " "defaults to the top level directory and *pattern* defaults to match any " "mailbox. Returned data are tuples of message part envelope and data." msgstr "" -#: ../../library/imaplib.rst:349 +#: ../../library/imaplib.rst:437 msgid "Show my ACLs for a mailbox (i.e. the rights that I have on mailbox)." msgstr "" -#: ../../library/imaplib.rst:354 +#: ../../library/imaplib.rst:442 msgid "Returns IMAP namespaces as defined in :rfc:`2342`." msgstr "" -#: ../../library/imaplib.rst:359 +#: ../../library/imaplib.rst:447 msgid "Send ``NOOP`` to server." msgstr "" -#: ../../library/imaplib.rst:364 +#: ../../library/imaplib.rst:452 msgid "" "Opens socket to *port* at *host*. The optional *timeout* parameter specifies " "a timeout in seconds for the connection attempt. If timeout is not given or " "is ``None``, the global default socket timeout is used. Also note that if " -"the *timeout* parameter is set to be zero, it will raise a :class:" -"`ValueError` to reject creating a non-blocking socket. This method is " -"implicitly called by the :class:`IMAP4` constructor. The connection objects " -"established by this method will be used in the :meth:`IMAP4.read`, :meth:" -"`IMAP4.readline`, :meth:`IMAP4.send`, and :meth:`IMAP4.shutdown` methods. " -"You may override this method." +"the *timeout* parameter is set to be zero, it will raise " +"a :class:`ValueError` to reject creating a non-blocking socket. This method " +"is implicitly called by the :class:`IMAP4` constructor. The connection " +"objects established by this method will be used in " +"the :meth:`IMAP4.read`, :meth:`IMAP4.readline`, :meth:`IMAP4.send`, " +"and :meth:`IMAP4.shutdown` methods. You may override this method." msgstr "" -#: ../../library/imaplib.rst:374 +#: ../../library/imaplib.rst:462 msgid "" "Raises an :ref:`auditing event ` ``imaplib.open`` with arguments " "``self``, ``host``, ``port``." @@ -447,62 +553,62 @@ msgstr "" "引發一個附帶引數 ``self``、``host``、``port`` 的\\ :ref:`稽核事件 " "` ``imaplib.open``。" -#: ../../library/imaplib.rst:376 +#: ../../library/imaplib.rst:464 msgid "The *timeout* parameter was added." msgstr "新增 *timeout* 參數。" -#: ../../library/imaplib.rst:381 +#: ../../library/imaplib.rst:469 msgid "" "Fetch truncated part of a message. Returned data is a tuple of message part " "envelope and data." msgstr "" -#: ../../library/imaplib.rst:387 +#: ../../library/imaplib.rst:475 msgid "" "Assume authentication as *user*. Allows an authorised administrator to proxy " "into any user's mailbox." msgstr "" -#: ../../library/imaplib.rst:393 +#: ../../library/imaplib.rst:481 msgid "" "Reads *size* bytes from the remote server. You may override this method." msgstr "" -#: ../../library/imaplib.rst:398 +#: ../../library/imaplib.rst:486 msgid "Reads one line from the remote server. You may override this method." msgstr "" -#: ../../library/imaplib.rst:403 +#: ../../library/imaplib.rst:491 msgid "" "Prompt server for an update. Returned data is ``None`` if no new messages, " "else value of ``RECENT`` response." msgstr "" -#: ../../library/imaplib.rst:409 +#: ../../library/imaplib.rst:497 msgid "Rename mailbox named *oldmailbox* to *newmailbox*." msgstr "" -#: ../../library/imaplib.rst:414 +#: ../../library/imaplib.rst:502 msgid "" "Return data for response *code* if received, or ``None``. Returns the given " "code, instead of the usual type." msgstr "" -#: ../../library/imaplib.rst:420 +#: ../../library/imaplib.rst:508 msgid "" "Search mailbox for matching messages. *charset* may be ``None``, in which " "case no ``CHARSET`` will be specified in the request to the server. The " "IMAP protocol requires that at least one criterion be specified; an " "exception will be raised when the server returns an error. *charset* must " -"be ``None`` if the ``UTF8=ACCEPT`` capability was enabled using the :meth:" -"`enable` command." +"be ``None`` if the ``UTF8=ACCEPT`` capability was enabled using " +"the :meth:`enable` command." msgstr "" -#: ../../library/imaplib.rst:427 +#: ../../library/imaplib.rst:515 msgid "Example::" msgstr "範例: ::" -#: ../../library/imaplib.rst:429 +#: ../../library/imaplib.rst:517 msgid "" "# M is a connected IMAP4 instance...\n" "typ, msgnums = M.search(None, 'FROM', '\"LDJ\"')\n" @@ -511,18 +617,18 @@ msgid "" "typ, msgnums = M.search(None, '(FROM \"LDJ\")')" msgstr "" -#: ../../library/imaplib.rst:438 +#: ../../library/imaplib.rst:526 msgid "" "Select a mailbox. Returned data is the count of messages in *mailbox* " "(``EXISTS`` response). The default *mailbox* is ``'INBOX'``. If the " "*readonly* flag is set, modifications to the mailbox are not allowed." msgstr "" -#: ../../library/imaplib.rst:445 +#: ../../library/imaplib.rst:533 msgid "Sends ``data`` to the remote server. You may override this method." msgstr "" -#: ../../library/imaplib.rst:447 +#: ../../library/imaplib.rst:535 msgid "" "Raises an :ref:`auditing event ` ``imaplib.send`` with arguments " "``self``, ``data``." @@ -530,42 +636,42 @@ msgstr "" "引發一個附帶引數 ``self``、``data`` 的\\ :ref:`稽核事件 ` " "``imaplib.send``。" -#: ../../library/imaplib.rst:452 +#: ../../library/imaplib.rst:540 msgid "" "Set an ``ACL`` for *mailbox*. The method is non-standard, but is supported " "by the ``Cyrus`` server." msgstr "" -#: ../../library/imaplib.rst:458 +#: ../../library/imaplib.rst:546 msgid "" "Set ``ANNOTATION``\\ s for *mailbox*. The method is non-standard, but is " "supported by the ``Cyrus`` server." msgstr "" -#: ../../library/imaplib.rst:464 +#: ../../library/imaplib.rst:552 msgid "" "Set the ``quota`` *root*'s resource *limits*. This method is part of the " "IMAP4 QUOTA extension defined in rfc2087." msgstr "" -#: ../../library/imaplib.rst:470 +#: ../../library/imaplib.rst:558 msgid "" "Close connection established in ``open``. This method is implicitly called " "by :meth:`IMAP4.logout`. You may override this method." msgstr "" -#: ../../library/imaplib.rst:476 +#: ../../library/imaplib.rst:564 msgid "Returns socket instance used to connect to server." msgstr "" -#: ../../library/imaplib.rst:481 +#: ../../library/imaplib.rst:569 msgid "" "The ``sort`` command is a variant of ``search`` with sorting semantics for " "the results. Returned data contains a space separated list of matching " "message numbers." msgstr "" -#: ../../library/imaplib.rst:485 +#: ../../library/imaplib.rst:573 msgid "" "Sort has two arguments before the *search_criterion* argument(s); a " "parenthesized list of *sort_criteria*, and the searching *charset*. Note " @@ -577,39 +683,40 @@ msgid "" "searching criteria. It then returns the numbers of matching messages." msgstr "" -#: ../../library/imaplib.rst:494 ../../library/imaplib.rst:565 +#: ../../library/imaplib.rst:582 ../../library/imaplib.rst:653 msgid "This is an ``IMAP4rev1`` extension command." msgstr "" -#: ../../library/imaplib.rst:499 +#: ../../library/imaplib.rst:587 msgid "" "Send a ``STARTTLS`` command. The *ssl_context* argument is optional and " "should be a :class:`ssl.SSLContext` object. This will enable encryption on " "the IMAP connection. Please read :ref:`ssl-security` for best practices." msgstr "" -#: ../../library/imaplib.rst:506 +#: ../../library/imaplib.rst:594 msgid "" -"The method now supports hostname check with :attr:`ssl.SSLContext." -"check_hostname` and *Server Name Indication* (see :const:`ssl.HAS_SNI`)." +"The method now supports hostname check " +"with :attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* " +"(see :const:`ssl.HAS_SNI`)." msgstr "" -#: ../../library/imaplib.rst:514 +#: ../../library/imaplib.rst:602 msgid "Request named status conditions for *mailbox*." msgstr "" -#: ../../library/imaplib.rst:519 +#: ../../library/imaplib.rst:607 msgid "" "Alters flag dispositions for messages in mailbox. *command* is specified by " "section 6.4.6 of :rfc:`2060` as being one of \"FLAGS\", \"+FLAGS\", or \"-" "FLAGS\", optionally with a suffix of \".SILENT\"." msgstr "" -#: ../../library/imaplib.rst:523 +#: ../../library/imaplib.rst:611 msgid "For example, to set the delete flag on all messages::" msgstr "" -#: ../../library/imaplib.rst:525 +#: ../../library/imaplib.rst:613 msgid "" "typ, data = M.search(None, 'ALL')\n" "for num in data[0].split():\n" @@ -621,7 +728,7 @@ msgstr "" " M.store(num, '+FLAGS', '\\\\Deleted')\n" "M.expunge()" -#: ../../library/imaplib.rst:532 +#: ../../library/imaplib.rst:620 msgid "" "Creating flags containing ']' (for example: \"[test]\") violates :rfc:`3501` " "(the IMAP protocol). However, imaplib has historically allowed creation of " @@ -633,24 +740,24 @@ msgid "" "are sent from the server, since this improves real-world compatibility." msgstr "" -#: ../../library/imaplib.rst:544 +#: ../../library/imaplib.rst:632 msgid "Subscribe to new mailbox." msgstr "" -#: ../../library/imaplib.rst:549 +#: ../../library/imaplib.rst:637 msgid "" "The ``thread`` command is a variant of ``search`` with threading semantics " "for the results. Returned data contains a space separated list of thread " "members." msgstr "" -#: ../../library/imaplib.rst:552 +#: ../../library/imaplib.rst:640 msgid "" "Thread members consist of zero or more messages numbers, delimited by " "spaces, indicating successive parent and child." msgstr "" -#: ../../library/imaplib.rst:555 +#: ../../library/imaplib.rst:643 msgid "" "Thread has two arguments before the *search_criterion* argument(s); a " "*threading_algorithm*, and the searching *charset*. Note that unlike " @@ -663,7 +770,7 @@ msgid "" "specified threading algorithm." msgstr "" -#: ../../library/imaplib.rst:570 +#: ../../library/imaplib.rst:658 msgid "" "Execute command args with messages identified by UID, rather than message " "number. Returns response appropriate to command. At least one argument " @@ -671,11 +778,11 @@ msgid "" "an exception will be raised." msgstr "" -#: ../../library/imaplib.rst:578 +#: ../../library/imaplib.rst:666 msgid "Unsubscribe from old mailbox." msgstr "" -#: ../../library/imaplib.rst:582 +#: ../../library/imaplib.rst:670 msgid "" ":meth:`imaplib.IMAP4.unselect` frees server's resources associated with the " "selected mailbox and returns the server to the authenticated state. This " @@ -683,46 +790,47 @@ msgid "" "that no messages are permanently removed from the currently selected mailbox." msgstr "" -#: ../../library/imaplib.rst:592 +#: ../../library/imaplib.rst:680 msgid "" "Allow simple extension commands notified by server in ``CAPABILITY`` " "response." msgstr "" -#: ../../library/imaplib.rst:595 +#: ../../library/imaplib.rst:683 msgid "The following attributes are defined on instances of :class:`IMAP4`:" msgstr "" -#: ../../library/imaplib.rst:599 +#: ../../library/imaplib.rst:687 msgid "" "The most recent supported protocol in the ``CAPABILITY`` response from the " "server." msgstr "" -#: ../../library/imaplib.rst:605 +#: ../../library/imaplib.rst:693 msgid "" "Integer value to control debugging output. The initialize value is taken " "from the module variable ``Debug``. Values greater than three trace each " "command." msgstr "" -#: ../../library/imaplib.rst:611 +#: ../../library/imaplib.rst:699 msgid "" -"Boolean value that is normally ``False``, but is set to ``True`` if an :meth:" -"`enable` command is successfully issued for the ``UTF8=ACCEPT`` capability." +"Boolean value that is normally ``False``, but is set to ``True`` if " +"an :meth:`enable` command is successfully issued for the ``UTF8=ACCEPT`` " +"capability." msgstr "" -#: ../../library/imaplib.rst:621 +#: ../../library/imaplib.rst:709 msgid "IMAP4 Example" msgstr "IMAP4 範例" -#: ../../library/imaplib.rst:623 +#: ../../library/imaplib.rst:711 msgid "" "Here is a minimal example (without error checking) that opens a mailbox and " "retrieves and prints all messages::" msgstr "" -#: ../../library/imaplib.rst:626 +#: ../../library/imaplib.rst:714 msgid "" "import getpass, imaplib\n" "\n" @@ -748,18 +856,18 @@ msgstr "" "M.close()\n" "M.logout()" -#: ../../library/imaplib.rst:16 +#: ../../library/imaplib.rst:17 msgid "IMAP4" msgstr "IMAP4" -#: ../../library/imaplib.rst:16 +#: ../../library/imaplib.rst:17 msgid "protocol" msgstr "protocol(協定)" -#: ../../library/imaplib.rst:16 +#: ../../library/imaplib.rst:17 msgid "IMAP4_SSL" msgstr "IMAP4_SSL" -#: ../../library/imaplib.rst:16 +#: ../../library/imaplib.rst:17 msgid "IMAP4_stream" msgstr "IMAP4_stream" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index 32a230af5da..8fc210ce373 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-28 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,7 +37,7 @@ msgid "" "glossary/#term-Import-Package>`_\\s, modules, if any). Built in part on " "Python's import system, this library intends to replace similar " "functionality in the `entry point API`_ and `metadata API`_ of " -"``pkg_resources``. Along with :mod:`importlib.resources`, this package can " +"``pkg_resources``. Along with :mod:`importlib.resources`, this package can " "eliminate the need to use the older and less efficient ``pkg_resources`` " "package." msgstr "" @@ -45,9 +45,9 @@ msgstr "" #: ../../library/importlib.metadata.rst:27 msgid "" "``importlib.metadata`` operates on third-party *distribution packages* " -"installed into Python's ``site-packages`` directory via tools such as :pypi:" -"`pip`. Specifically, it works with distributions with discoverable ``dist-" -"info`` or ``egg-info`` directories, and metadata defined by the `Core " +"installed into Python's ``site-packages`` directory via tools such " +"as :pypi:`pip`. Specifically, it works with distributions with discoverable " +"``dist-info`` or ``egg-info`` directories, and metadata defined by the `Core " "metadata specifications `_." msgstr "" @@ -58,15 +58,15 @@ msgid "" "level *import package* names that can be imported inside Python code. One " "*distribution package* can contain multiple *import packages* (and single " "modules), and one top-level *import package* may map to multiple " -"*distribution packages* if it is a namespace package. You can use :ref:" -"`packages_distributions() ` to get a mapping between " -"them." +"*distribution packages* if it is a namespace package. You can " +"use :ref:`packages_distributions() ` to get a mapping " +"between them." msgstr "" #: ../../library/importlib.metadata.rst:47 msgid "" "By default, distribution metadata can live on the file system or in zip " -"archives on :data:`sys.path`. Through an extension mechanism, the metadata " +"archives on :data:`sys.path`. Through an extension mechanism, the metadata " "can live almost anywhere." msgstr "" @@ -79,8 +79,8 @@ msgid "" "The documentation for ``importlib_metadata``, which supplies a backport of " "``importlib.metadata``. This includes an `API reference `__ for this module's classes and " -"functions, as well as a `migration guide `__ for existing users of " +"functions, as well as a `migration guide `__ for existing users of " "``pkg_resources``." msgstr "" @@ -92,7 +92,7 @@ msgstr "" msgid "" "Let's say you wanted to get the version string for a `Distribution Package " "`_ you've installed using ``pip``. We start by creating a virtual " +"Package>`_ you've installed using ``pip``. We start by creating a virtual " "environment and installing something into it:" msgstr "" @@ -126,8 +126,8 @@ msgstr "" msgid "" "You can also get a collection of entry points selectable by properties of " "the EntryPoint (typically 'group' or 'name'), such as ``console_scripts``, " -"``distutils.commands`` and others. Each group contains a collection of :ref:" -"`EntryPoint ` objects." +"``distutils.commands`` and others. Each group contains a collection " +"of :ref:`EntryPoint ` objects." msgstr "" #: ../../library/importlib.metadata.rst:93 @@ -156,9 +156,9 @@ msgstr "" #: ../../library/importlib.metadata.rst:98 msgid "" -"You can also get a :ref:`distribution's version number `, list its :" -"ref:`constituent files `, and get a list of the distribution's :ref:" -"`requirements`." +"You can also get a :ref:`distribution's version number `, list " +"its :ref:`constituent files `, and get a list of the " +"distribution's :ref:`requirements`." msgstr "" #: ../../library/importlib.metadata.rst:105 @@ -190,10 +190,10 @@ msgstr "" #: ../../library/importlib.metadata.rst:128 msgid "" -"Note: it is not currently possible to query for entry points based on their :" -"attr:`!EntryPoint.dist` attribute (as different :class:`!Distribution` " -"instances do not currently compare equal, even if they have the same " -"attributes)" +"Note: it is not currently possible to query for entry points based on " +"their :attr:`!EntryPoint.dist` attribute (as different :class:`!" +"Distribution` instances do not currently compare equal, even if they have " +"the same attributes)" msgstr "" #: ../../library/importlib.metadata.rst:134 @@ -214,10 +214,10 @@ msgstr "" #: ../../library/importlib.metadata.rst:144 msgid "" "Each :class:`!EntryPoint` instance has ``.name``, ``.group``, and ``.value`` " -"attributes and a ``.load()`` method to resolve the value. There are also ``." -"module``, ``.attr``, and ``.extras`` attributes for getting the components " -"of the ``.value`` attribute, and ``.dist`` for obtaining information " -"regarding the distribution package that provides the entry point." +"attributes and a ``.load()`` method to resolve the value. There are also " +"``.module``, ``.attr``, and ``.extras`` attributes for getting the " +"components of the ``.value`` attribute, and ``.dist`` for obtaining " +"information regarding the distribution package that provides the entry point." msgstr "" #: ../../library/importlib.metadata.rst:150 @@ -327,7 +327,7 @@ msgstr "" msgid "" "The ``group`` and ``name`` are arbitrary values defined by the package " "author and usually a client will wish to resolve all entry points for a " -"particular group. Read `the setuptools docs `_ for more information on entry points, " "their definition, and usage." msgstr "" @@ -338,14 +338,14 @@ msgid "" "3.6 and Python 3.10. Prior to those changes, ``entry_points`` accepted no " "parameters and always returned a dictionary of entry points, keyed by group. " "With ``importlib_metadata`` 5.0 and Python 3.12, ``entry_points`` always " -"returns an ``EntryPoints`` object. See :pypi:`backports." -"entry_points_selectable` for compatibility options." +"returns an ``EntryPoints`` object. " +"See :pypi:`backports.entry_points_selectable` for compatibility options." msgstr "" #: ../../library/importlib.metadata.rst:212 msgid "" -"``EntryPoint`` objects no longer present a tuple-like interface (:meth:" -"`~object.__getitem__`)." +"``EntryPoint`` objects no longer present a tuple-like interface " +"(:meth:`~object.__getitem__`)." msgstr "" #: ../../library/importlib.metadata.rst:219 @@ -371,8 +371,8 @@ msgstr "" #: ../../library/importlib.metadata.rst:231 msgid "" "A concrete implementation of the `PackageMetadata protocol `_." +"importlib-metadata.readthedocs.io/en/latest/" +"api.html#importlib_metadata.PackageMetadata>`_." msgstr "" #: ../../library/importlib.metadata.rst:234 @@ -444,9 +444,9 @@ msgstr "" #: ../../library/importlib.metadata.rst:271 msgid "" -"Return the installed distribution package `version `__ for the named " -"distribution package." +"Return the installed distribution package `version `__ for " +"the named distribution package." msgstr "" #: ../../library/importlib.metadata.rst:278 @@ -476,8 +476,8 @@ msgstr "" #: ../../library/importlib.metadata.rst:299 msgid "" "Returns :const:`None` if the distribution is found but the installation " -"database records reporting the files associated with the distribuion package " -"are missing." +"database records reporting the files associated with the distribution " +"package are missing." msgstr "" #: ../../library/importlib.metadata.rst:305 @@ -489,10 +489,10 @@ msgstr "" #: ../../library/importlib.metadata.rst:309 msgid "" -"The :func:`!files` function takes a `Distribution Package `_ name and returns " -"all of the files installed by this distribution. Each file is reported as a :" -"class:`PackagePath` instance. For example::" +"The :func:`!files` function takes a `Distribution Package `_ name " +"and returns all of the files installed by this distribution. Each file is " +"reported as a :class:`PackagePath` instance. For example::" msgstr "" #: ../../library/importlib.metadata.rst:314 @@ -557,12 +557,13 @@ msgstr "" #: ../../library/importlib.metadata.rst:341 msgid "" -"In the case where the metadata file listing files (``RECORD`` or ``SOURCES." -"txt``) is missing, :func:`!files` will return :const:`None`. The caller may " -"wish to wrap calls to :func:`!files` in `always_iterable `_ or otherwise guard against this condition if the target " -"distribution is not known to have the metadata present." +"In the case where the metadata file listing files (``RECORD`` or " +"``SOURCES.txt``) is missing, :func:`!files` will return :const:`None`. The " +"caller may wish to wrap calls to :func:`!files` in `always_iterable `_ or otherwise guard against this " +"condition if the target distribution is not known to have the metadata " +"present." msgstr "" #: ../../library/importlib.metadata.rst:352 @@ -609,11 +610,11 @@ msgstr "" #: ../../library/importlib.metadata.rst:386 msgid "" -"A convenience method to resolve the `Distribution Package `_ name (or names, " -"in the case of a namespace package) that provide each importable top-level " -"Python module or `Import Package `_::" +"A convenience method to resolve the `Distribution Package `_ name " +"(or names, in the case of a namespace package) that provide each importable " +"top-level Python module or `Import Package `_::" msgstr "" #: ../../library/importlib.metadata.rst:391 @@ -660,9 +661,9 @@ msgid "" "usage, you can get all of that information from the :class:`!Distribution` " "class. :class:`!Distribution` is an abstract object that represents the " "metadata for a Python `Distribution Package `_. You can get the concrete :" -"class:`!Distribution` subclass instance for an installed distribution " -"package by calling the :func:`distribution` function::" +"latest/glossary/#term-Distribution-Package>`_. You can get the " +"concrete :class:`!Distribution` subclass instance for an installed " +"distribution package by calling the :func:`distribution` function::" msgstr "" #: ../../library/importlib.metadata.rst:428 @@ -732,10 +733,11 @@ msgstr "" #: ../../library/importlib.metadata.rst:462 msgid "" "By default, this package provides built-in support for discovery of metadata " -"for file system and zip file `Distribution Package `_\\s. This metadata " -"finder search defaults to ``sys.path``, but varies slightly in how it " -"interprets those values from how other import machinery does. In particular:" +"for file system and zip file `Distribution Package `_\\s. " +"This metadata finder search defaults to ``sys.path``, but varies slightly in " +"how it interprets those values from how other import machinery does. In " +"particular:" msgstr "" #: ../../library/importlib.metadata.rst:466 @@ -750,73 +752,79 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:471 -msgid "Extending the search algorithm" +msgid "Implementing Custom Providers" msgstr "" #: ../../library/importlib.metadata.rst:473 msgid "" +"``importlib.metadata`` address two API surfaces, one for *consumers* and " +"another for *providers*. Most users are consumers, consuming metadata " +"provided by the packages. There are other use-cases, however, where users " +"wish to expose metadata through some other mechanism, such as alongside a " +"custom importer. Such a use case calls for a *custom provider*." +msgstr "" + +#: ../../library/importlib.metadata.rst:480 +msgid "" "Because `Distribution Package `_ metadata is not available through :" -"data:`sys.path` searches, or package loaders directly, the metadata for a " -"distribution is found through import system :ref:`finders `. To find a distribution package's metadata, ``importlib." -"metadata`` queries the list of :term:`meta path finders ` " +"glossary/#term-Distribution-Package>`_ metadata is not available " +"through :data:`sys.path` searches, or package loaders directly, the metadata " +"for a distribution is found through import system :ref:`finders `. To find a distribution package's metadata, ``importlib.metadata`` " +"queries the list of :term:`meta path finders ` " "on :data:`sys.meta_path`." msgstr "" -#: ../../library/importlib.metadata.rst:481 +#: ../../library/importlib.metadata.rst:488 msgid "" -"By default ``importlib.metadata`` installs a finder for distribution " -"packages found on the file system. This finder doesn't actually find any " -"*distributions*, but it can find their metadata." +"The implementation has hooks integrated into the ``PathFinder``, serving " +"metadata for distribution packages found on the file system." msgstr "" -#: ../../library/importlib.metadata.rst:486 +#: ../../library/importlib.metadata.rst:491 msgid "" "The abstract class :py:class:`importlib.abc.MetaPathFinder` defines the " -"interface expected of finders by Python's import system. ``importlib." -"metadata`` extends this protocol by looking for an optional " +"interface expected of finders by Python's import system. " +"``importlib.metadata`` extends this protocol by looking for an optional " "``find_distributions`` callable on the finders from :data:`sys.meta_path` " "and presents this extended interface as the ``DistributionFinder`` abstract " "base class, which defines this abstract method::" msgstr "" -#: ../../library/importlib.metadata.rst:494 +#: ../../library/importlib.metadata.rst:499 msgid "" "@abc.abstractmethod\n" -"def find_distributions(context=DistributionFinder.Context()):\n" +"def find_distributions(context=DistributionFinder.Context()) -> " +"Iterable[Distribution]:\n" " \"\"\"Return an iterable of all Distribution instances capable of\n" " loading the metadata for packages for the indicated ``context``.\n" " \"\"\"" msgstr "" -#: ../../library/importlib.metadata.rst:500 +#: ../../library/importlib.metadata.rst:505 msgid "" "The ``DistributionFinder.Context`` object provides ``.path`` and ``.name`` " "properties indicating the path to search and name to match and may supply " -"other relevant context." +"other relevant context sought by the consumer." msgstr "" -#: ../../library/importlib.metadata.rst:504 +#: ../../library/importlib.metadata.rst:509 msgid "" -"What this means in practice is that to support finding distribution package " -"metadata in locations other than the file system, subclass ``Distribution`` " -"and implement the abstract methods. Then from a custom finder, return " -"instances of this derived ``Distribution`` in the ``find_distributions()`` " -"method." +"In practice, to support finding distribution package metadata in locations " +"other than the file system, subclass ``Distribution`` and implement the " +"abstract methods. Then from a custom finder, return instances of this " +"derived ``Distribution`` in the ``find_distributions()`` method." msgstr "" -#: ../../library/importlib.metadata.rst:511 +#: ../../library/importlib.metadata.rst:516 msgid "Example" msgstr "" -#: ../../library/importlib.metadata.rst:513 -msgid "" -"Consider for example a custom finder that loads Python modules from a " -"database::" +#: ../../library/importlib.metadata.rst:518 +msgid "Imagine a custom finder that loads Python modules from a database::" msgstr "" -#: ../../library/importlib.metadata.rst:516 +#: ../../library/importlib.metadata.rst:520 msgid "" "class DatabaseImporter(importlib.abc.MetaPathFinder):\n" " def __init__(self, db):\n" @@ -828,14 +836,14 @@ msgid "" "sys.meta_path.append(DatabaseImporter(connect_db(...)))" msgstr "" -#: ../../library/importlib.metadata.rst:525 +#: ../../library/importlib.metadata.rst:529 msgid "" "That importer now presumably provides importable modules from a database, " "but it provides no metadata or entry points. For this custom importer to " "provide metadata, it would also need to implement ``DistributionFinder``::" msgstr "" -#: ../../library/importlib.metadata.rst:530 +#: ../../library/importlib.metadata.rst:534 msgid "" "from importlib.metadata import DistributionFinder\n" "\n" @@ -848,7 +856,7 @@ msgid "" " yield DatabaseDistribution(dist_record)" msgstr "" -#: ../../library/importlib.metadata.rst:540 +#: ../../library/importlib.metadata.rst:544 msgid "" "In this way, ``query_distributions`` would return records for each " "distribution served by the database matching the query. For example, if " @@ -857,7 +865,7 @@ msgid "" "``Context(name=None)``." msgstr "" -#: ../../library/importlib.metadata.rst:546 +#: ../../library/importlib.metadata.rst:550 msgid "" "For the sake of simplicity, this example ignores ``context.path``\\. The " "``path`` attribute defaults to ``sys.path`` and is the set of import paths " @@ -870,11 +878,11 @@ msgid "" "``context.path`` and only yield ``Distribution``\\ s pertinent to that path." msgstr "" -#: ../../library/importlib.metadata.rst:557 +#: ../../library/importlib.metadata.rst:561 msgid "``DatabaseDistribution``, then, would look something like::" msgstr "" -#: ../../library/importlib.metadata.rst:559 +#: ../../library/importlib.metadata.rst:563 msgid "" "class DatabaseDistribution(importlib.metadata.Distribution):\n" " def __init__(self, record):\n" @@ -897,14 +905,14 @@ msgid "" " raise RuntimeError(\"This distribution has no file system\")" msgstr "" -#: ../../library/importlib.metadata.rst:579 +#: ../../library/importlib.metadata.rst:583 msgid "" "This basic implementation should provide metadata and entry points for " "packages served by the ``DatabaseImporter``, assuming that the ``record`` " "supplies suitable ``.name``, ``.version``, and ``.entry_points`` attributes." msgstr "" -#: ../../library/importlib.metadata.rst:584 +#: ../../library/importlib.metadata.rst:588 msgid "" "The ``DatabaseDistribution`` may also provide other metadata files, like " "``RECORD`` (required for ``Distribution.files``) or override the " diff --git a/library/importlib.po b/library/importlib.po index 4e6856b302b..c1c15fb8d5e 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-16 17:40+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,9 +43,9 @@ msgid "" "to comprehend than one implemented in a programming language other than " "Python." msgstr "" -"第一是提供 Python 原始碼中 :keyword:`import` 陳述式的實作(因此,也延伸到 :" -"func:`__import__` 函式)。這讓 :keyword:`!import` 實作可以移植到任何 Python " -"直譯器。同時,這也提供了一個比用其他程式語言實作更容易理解的版本。" +"第一是提供 Python 原始碼中 :keyword:`import` 陳述式的實作(因此,也延伸" +"到 :func:`__import__` 函式)。這讓 :keyword:`!import` 實作可以移植到任何 " +"Python 直譯器。同時,這也提供了一個比用其他程式語言實作更容易理解的版本。" #: ../../library/importlib.rst:29 msgid "" @@ -89,8 +89,8 @@ msgstr "" #: ../../library/importlib.rst:47 msgid "" "Original specification of packages. Some semantics have changed since the " -"writing of this document (e.g. redirecting based on ``None`` in :data:`sys." -"modules`)." +"writing of this document (e.g. redirecting based on ``None`` " +"in :data:`sys.modules`)." msgstr "" #: ../../library/importlib.rst:51 @@ -231,11 +231,11 @@ msgstr "" #: ../../library/importlib.rst:115 msgid "" -"The :func:`import_module` function acts as a simplifying wrapper around :" -"func:`importlib.__import__`. This means all semantics of the function are " -"derived from :func:`importlib.__import__`. The most important difference " -"between these two functions is that :func:`import_module` returns the " -"specified package or module (e.g. ``pkg.mod``), while :func:`__import__` " +"The :func:`import_module` function acts as a simplifying wrapper " +"around :func:`importlib.__import__`. This means all semantics of the " +"function are derived from :func:`importlib.__import__`. The most important " +"difference between these two functions is that :func:`import_module` returns " +"the specified package or module (e.g. ``pkg.mod``), while :func:`__import__` " "returns the top-level package or module (e.g. ``pkg``)." msgstr "" @@ -347,11 +347,11 @@ msgstr "" #: ../../library/importlib.rst:193 msgid "" -"If a module imports objects from another module using :keyword:`from` ... :" -"keyword:`import` ..., calling :func:`reload` for the other module does not " -"redefine the objects imported from it --- one way around this is to re-" -"execute the :keyword:`!from` statement, another is to use :keyword:`!import` " -"and qualified names (*module.name*) instead." +"If a module imports objects from another module " +"using :keyword:`from` ... :keyword:`import` ..., calling :func:`reload` for " +"the other module does not redefine the objects imported from it --- one way " +"around this is to re-execute the :keyword:`!from` statement, another is to " +"use :keyword:`!import` and qualified names (*module.name*) instead." msgstr "" #: ../../library/importlib.rst:199 @@ -364,15 +364,16 @@ msgstr "" #: ../../library/importlib.rst:205 msgid "" -":exc:`ModuleNotFoundError` is raised when the module being reloaded lacks a :" -"class:`~importlib.machinery.ModuleSpec`." +":exc:`ModuleNotFoundError` is raised when the module being reloaded lacks " +"a :class:`~importlib.machinery.ModuleSpec`." msgstr "" #: ../../library/importlib.rst:210 msgid "" "This function is not thread-safe. Calling it from multiple threads can " -"result in unexpected behavior. It's recommended to use the :class:`threading." -"Lock` or other synchronization primitives for thread-safe module reloading." +"result in unexpected behavior. It's recommended to use " +"the :class:`threading.Lock` or other synchronization primitives for thread-" +"safe module reloading." msgstr "" #: ../../library/importlib.rst:215 @@ -451,26 +452,27 @@ msgstr "" msgid "" "An abstract base class representing a :term:`path entry finder`. Though it " "bears some similarities to :class:`MetaPathFinder`, ``PathEntryFinder`` is " -"meant for use only within the path-based import subsystem provided by :class:" -"`importlib.machinery.PathFinder`." +"meant for use only within the path-based import subsystem provided " +"by :class:`importlib.machinery.PathFinder`." msgstr "" #: ../../library/importlib.rst:289 msgid "" "An abstract method for finding a :term:`spec ` for the " -"specified module. The finder will search for the module only within the :" -"term:`path entry` to which it is assigned. If a spec cannot be found, " +"specified module. The finder will search for the module only within " +"the :term:`path entry` to which it is assigned. If a spec cannot be found, " "``None`` is returned. When passed in, ``target`` is a module object that " -"the finder may use to make a more educated guess about what spec to return. :" -"func:`importlib.util.spec_from_loader` may be useful for implementing " -"concrete ``PathEntryFinders``." +"the finder may use to make a more educated guess about what spec to " +"return. :func:`importlib.util.spec_from_loader` may be useful for " +"implementing concrete ``PathEntryFinders``." msgstr "" #: ../../library/importlib.rst:301 msgid "" "An optional method which, when called, should invalidate any internal cache " -"used by the finder. Used by :meth:`importlib.machinery.PathFinder." -"invalidate_caches` when invalidating the caches of all cached finders." +"used by the finder. Used " +"by :meth:`importlib.machinery.PathFinder.invalidate_caches` when " +"invalidating the caches of all cached finders." msgstr "" #: ../../library/importlib.rst:309 @@ -481,9 +483,9 @@ msgstr "" #: ../../library/importlib.rst:312 msgid "" -"Loaders that wish to support resource reading should implement a :meth:" -"`get_resource_reader` method as specified by :class:`importlib.resources.abc." -"ResourceReader`." +"Loaders that wish to support resource reading should implement " +"a :meth:`get_resource_reader` method as specified " +"by :class:`importlib.resources.abc.ResourceReader`." msgstr "" #: ../../library/importlib.rst:316 @@ -505,8 +507,8 @@ msgstr "" msgid "" "An abstract method that executes the module in its own namespace when a " "module is imported or reloaded. The module should already be initialized " -"when :meth:`exec_module` is called. When this method exists, :meth:" -"`create_module` must be defined." +"when :meth:`exec_module` is called. When this method " +"exists, :meth:`create_module` must be defined." msgstr "" #: ../../library/importlib.rst:340 @@ -515,8 +517,9 @@ msgstr ":meth:`create_module` 也必須被定義。" #: ../../library/importlib.rst:345 msgid "" -"A legacy method for loading a module. If the module cannot be loaded, :exc:" -"`ImportError` is raised, otherwise the loaded module is returned." +"A legacy method for loading a module. If the module cannot be " +"loaded, :exc:`ImportError` is raised, otherwise the loaded module is " +"returned." msgstr "" #: ../../library/importlib.rst:349 @@ -574,67 +577,70 @@ msgstr "" #: ../../library/importlib.rst:377 msgid "" -"The recommended API for loading a module is :meth:`exec_module` (and :meth:" -"`create_module`). Loaders should implement it instead of :meth:" -"`load_module`. The import machinery takes care of all the other " +"The recommended API for loading a module is :meth:`exec_module` " +"(and :meth:`create_module`). Loaders should implement it instead " +"of :meth:`load_module`. The import machinery takes care of all the other " "responsibilities of :meth:`load_module` when :meth:`exec_module` is " "implemented." msgstr "" -#: ../../library/importlib.rst:387 ../../library/importlib.rst:640 +#: ../../library/importlib.rst:387 ../../library/importlib.rst:642 msgid "*Superseded by TraversableResources*" msgstr "" #: ../../library/importlib.rst:389 msgid "" -"An abstract base class for a :term:`loader` which implements the optional :" -"pep:`302` protocol for loading arbitrary resources from the storage back-end." +"An abstract base class for a :term:`loader` which implements the " +"optional :pep:`302` protocol for loading arbitrary resources from the " +"storage back-end." msgstr "" #: ../../library/importlib.rst:393 msgid "" -"This ABC is deprecated in favour of supporting resource loading through :" -"class:`importlib.resources.abc.TraversableResources`." +"This ABC is deprecated in favour of supporting resource loading " +"through :class:`importlib.resources.abc.TraversableResources`. This class " +"exists for backwards compatibility only with other ABCs in this module." msgstr "" -#: ../../library/importlib.rst:400 +#: ../../library/importlib.rst:402 msgid "" "An abstract method to return the bytes for the data located at *path*. " "Loaders that have a file-like storage back-end that allows storing arbitrary " "data can implement this abstract method to give direct access to the data " "stored. :exc:`OSError` is to be raised if the *path* cannot be found. The " -"*path* is expected to be constructed using a module's :attr:`~module." -"__file__` attribute or an item from a package's :attr:`~module.__path__`." +"*path* is expected to be constructed using a " +"module's :attr:`~module.__file__` attribute or an item from a " +"package's :attr:`~module.__path__`." msgstr "" -#: ../../library/importlib.rst:409 +#: ../../library/importlib.rst:411 msgid "Raises :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:415 +#: ../../library/importlib.rst:417 msgid "" -"An abstract base class for a :term:`loader` which implements the optional :" -"pep:`302` protocol for loaders that inspect modules." +"An abstract base class for a :term:`loader` which implements the " +"optional :pep:`302` protocol for loaders that inspect modules." msgstr "" -#: ../../library/importlib.rst:420 +#: ../../library/importlib.rst:422 msgid "" "Return the code object for a module, or ``None`` if the module does not have " "a code object (as would be the case, for example, for a built-in module). " "Raise an :exc:`ImportError` if loader cannot find the requested module." msgstr "" -#: ../../library/importlib.rst:426 +#: ../../library/importlib.rst:428 msgid "" "While the method has a default implementation, it is suggested that it be " "overridden if possible for performance." msgstr "" -#: ../../library/importlib.rst:432 +#: ../../library/importlib.rst:434 msgid "No longer abstract and a concrete implementation is provided." msgstr "" -#: ../../library/importlib.rst:438 +#: ../../library/importlib.rst:440 msgid "" "An abstract method to return the source of a module. It is returned as a " "text string using :term:`universal newlines`, translating all recognized " @@ -643,233 +649,234 @@ msgid "" "cannot find the module specified." msgstr "" -#: ../../library/importlib.rst:444 ../../library/importlib.rst:453 -#: ../../library/importlib.rst:504 +#: ../../library/importlib.rst:446 ../../library/importlib.rst:455 +#: ../../library/importlib.rst:506 msgid "Raises :exc:`ImportError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:449 +#: ../../library/importlib.rst:451 msgid "" "An optional method to return a true value if the module is a package, a " "false value otherwise. :exc:`ImportError` is raised if the :term:`loader` " "cannot find the module." msgstr "" -#: ../../library/importlib.rst:458 +#: ../../library/importlib.rst:460 msgid "Create a code object from Python source." msgstr "" -#: ../../library/importlib.rst:460 +#: ../../library/importlib.rst:462 msgid "" -"The *data* argument can be whatever the :func:`compile` function supports (i." -"e. string or bytes). The *path* argument should be the \"path\" to where the " -"source code originated from, which can be an abstract concept (e.g. location " -"in a zip file)." +"The *data* argument can be whatever the :func:`compile` function supports " +"(i.e. string or bytes). The *path* argument should be the \"path\" to where " +"the source code originated from, which can be an abstract concept (e.g. " +"location in a zip file)." msgstr "" -#: ../../library/importlib.rst:465 +#: ../../library/importlib.rst:467 msgid "" "With the subsequent code object one can execute it in a module by running " "``exec(code, module.__dict__)``." msgstr "" -#: ../../library/importlib.rst:470 +#: ../../library/importlib.rst:472 msgid "Made the method static." msgstr "" -#: ../../library/importlib.rst:475 +#: ../../library/importlib.rst:477 msgid "Implementation of :meth:`Loader.exec_module`." msgstr ":meth:`Loader.exec_module` 的實作。" -#: ../../library/importlib.rst:481 +#: ../../library/importlib.rst:483 msgid "Implementation of :meth:`Loader.load_module`." msgstr ":meth:`Loader.load_module` 的實作。" -#: ../../library/importlib.rst:483 +#: ../../library/importlib.rst:485 msgid "use :meth:`exec_module` instead." msgstr "請改用 :meth:`exec_module`。" -#: ../../library/importlib.rst:489 +#: ../../library/importlib.rst:491 msgid "" "An abstract base class which inherits from :class:`InspectLoader` that, when " "implemented, helps a module to be executed as a script. The ABC represents " "an optional :pep:`302` protocol." msgstr "" -#: ../../library/importlib.rst:496 +#: ../../library/importlib.rst:498 msgid "" "An abstract method that is to return the value of :attr:`~module.__file__` " "for the specified module. If no path is available, :exc:`ImportError` is " "raised." msgstr "" -#: ../../library/importlib.rst:500 +#: ../../library/importlib.rst:502 msgid "" "If source code is available, then the method should return the path to the " "source file, regardless of whether a bytecode was used to load the module." msgstr "" -#: ../../library/importlib.rst:510 +#: ../../library/importlib.rst:512 msgid "" -"An abstract base class which inherits from :class:`ResourceLoader` and :" -"class:`ExecutionLoader`, providing concrete implementations of :meth:" -"`ResourceLoader.get_data` and :meth:`ExecutionLoader.get_filename`." +"An abstract base class which inherits from :class:`ResourceLoader` " +"and :class:`ExecutionLoader`, providing concrete implementations " +"of :meth:`ResourceLoader.get_data` and :meth:`ExecutionLoader.get_filename`." msgstr "" -#: ../../library/importlib.rst:514 +#: ../../library/importlib.rst:516 msgid "" "The *fullname* argument is a fully resolved name of the module the loader is " "to handle. The *path* argument is the path to the file for the module." msgstr "" -#: ../../library/importlib.rst:521 +#: ../../library/importlib.rst:523 msgid "The name of the module the loader can handle." msgstr "" -#: ../../library/importlib.rst:525 +#: ../../library/importlib.rst:527 msgid "Path to the file of the module." msgstr "" -#: ../../library/importlib.rst:529 +#: ../../library/importlib.rst:531 msgid "Calls super's ``load_module()``." msgstr "" -#: ../../library/importlib.rst:531 +#: ../../library/importlib.rst:533 msgid "Use :meth:`Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:537 ../../library/importlib.rst:1144 +#: ../../library/importlib.rst:539 ../../library/importlib.rst:1146 msgid "Returns :attr:`path`." msgstr "" -#: ../../library/importlib.rst:542 +#: ../../library/importlib.rst:544 msgid "Reads *path* as a binary file and returns the bytes from it." msgstr "" -#: ../../library/importlib.rst:547 +#: ../../library/importlib.rst:549 msgid "" "An abstract base class for implementing source (and optionally bytecode) " -"file loading. The class inherits from both :class:`ResourceLoader` and :" -"class:`ExecutionLoader`, requiring the implementation of:" +"file loading. The class inherits from both :class:`ResourceLoader` " +"and :class:`ExecutionLoader`, requiring the implementation of:" msgstr "" -#: ../../library/importlib.rst:551 +#: ../../library/importlib.rst:553 msgid ":meth:`ResourceLoader.get_data`" msgstr ":meth:`ResourceLoader.get_data`" -#: ../../library/importlib.rst:552 +#: ../../library/importlib.rst:554 msgid ":meth:`ExecutionLoader.get_filename`" msgstr ":meth:`ExecutionLoader.get_filename`" -#: ../../library/importlib.rst:553 +#: ../../library/importlib.rst:555 msgid "" "Should only return the path to the source file; sourceless loading is not " "supported." msgstr "" -#: ../../library/importlib.rst:556 +#: ../../library/importlib.rst:558 msgid "" "The abstract methods defined by this class are to add optional bytecode file " -"support. Not implementing these optional methods (or causing them to raise :" -"exc:`NotImplementedError`) causes the loader to only work with source code. " -"Implementing the methods allows the loader to work with source *and* " +"support. Not implementing these optional methods (or causing them to " +"raise :exc:`NotImplementedError`) causes the loader to only work with source " +"code. Implementing the methods allows the loader to work with source *and* " "bytecode files; it does not allow for *sourceless* loading where only " "bytecode is provided. Bytecode files are an optimization to speed up " "loading by removing the parsing step of Python's compiler, and so no " "bytecode-specific API is exposed." msgstr "" -#: ../../library/importlib.rst:567 +#: ../../library/importlib.rst:569 msgid "" "Optional abstract method which returns a :class:`dict` containing metadata " "about the specified path. Supported dictionary keys are:" msgstr "" -#: ../../library/importlib.rst:570 +#: ../../library/importlib.rst:572 msgid "" "``'mtime'`` (mandatory): an integer or floating-point number representing " "the modification time of the source code;" msgstr "" -#: ../../library/importlib.rst:572 +#: ../../library/importlib.rst:574 msgid "``'size'`` (optional): the size in bytes of the source code." msgstr "" -#: ../../library/importlib.rst:574 +#: ../../library/importlib.rst:576 msgid "" "Any other keys in the dictionary are ignored, to allow for future " "extensions. If the path cannot be handled, :exc:`OSError` is raised." msgstr "" -#: ../../library/importlib.rst:579 ../../library/importlib.rst:592 +#: ../../library/importlib.rst:581 ../../library/importlib.rst:594 msgid "Raise :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:584 +#: ../../library/importlib.rst:586 msgid "" "Optional abstract method which returns the modification time for the " "specified path." msgstr "" -#: ../../library/importlib.rst:587 +#: ../../library/importlib.rst:589 msgid "" "This method is deprecated in favour of :meth:`path_stats`. You don't have " "to implement it, but it is still available for compatibility purposes. " "Raise :exc:`OSError` if the path cannot be handled." msgstr "" -#: ../../library/importlib.rst:597 +#: ../../library/importlib.rst:599 msgid "" "Optional abstract method which writes the specified bytes to a file path. " "Any intermediate directories which do not exist are to be created " "automatically." msgstr "" -#: ../../library/importlib.rst:601 +#: ../../library/importlib.rst:603 msgid "" -"When writing to the path fails because the path is read-only (:const:`errno." -"EACCES`/:exc:`PermissionError`), do not propagate the exception." +"When writing to the path fails because the path is read-only " +"(:const:`errno.EACCES`/:exc:`PermissionError`), do not propagate the " +"exception." msgstr "" -#: ../../library/importlib.rst:605 +#: ../../library/importlib.rst:607 msgid "No longer raises :exc:`NotImplementedError` when called." msgstr "" -#: ../../library/importlib.rst:610 +#: ../../library/importlib.rst:612 msgid "Concrete implementation of :meth:`InspectLoader.get_code`." msgstr "" -#: ../../library/importlib.rst:614 +#: ../../library/importlib.rst:616 msgid "Concrete implementation of :meth:`Loader.exec_module`." msgstr "" -#: ../../library/importlib.rst:620 +#: ../../library/importlib.rst:622 msgid "Concrete implementation of :meth:`Loader.load_module`." msgstr "" -#: ../../library/importlib.rst:622 +#: ../../library/importlib.rst:624 msgid "Use :meth:`exec_module` instead." msgstr "" -#: ../../library/importlib.rst:627 +#: ../../library/importlib.rst:629 msgid "Concrete implementation of :meth:`InspectLoader.get_source`." msgstr "" -#: ../../library/importlib.rst:631 +#: ../../library/importlib.rst:633 msgid "" "Concrete implementation of :meth:`InspectLoader.is_package`. A module is " -"determined to be a package if its file path (as provided by :meth:" -"`ExecutionLoader.get_filename`) is a file named ``__init__`` when the file " -"extension is removed **and** the module name itself does not end in " +"determined to be a package if its file path (as provided " +"by :meth:`ExecutionLoader.get_filename`) is a file named ``__init__`` when " +"the file extension is removed **and** the module name itself does not end in " "``__init__``." msgstr "" -#: ../../library/importlib.rst:642 +#: ../../library/importlib.rst:644 msgid "" "An :term:`abstract base class` to provide the ability to read *resources*." msgstr "" -#: ../../library/importlib.rst:645 +#: ../../library/importlib.rst:647 msgid "" "From the perspective of this ABC, a *resource* is a binary artifact that is " "shipped within a package. Typically this is something like a data file that " @@ -879,11 +886,11 @@ msgid "" "file versus on the file system." msgstr "" -#: ../../library/importlib.rst:653 +#: ../../library/importlib.rst:655 msgid "" -"For any of methods of this class, a *resource* argument is expected to be a :" -"term:`path-like object` which represents conceptually just a file name. This " -"means that no subdirectory paths should be included in the *resource* " +"For any of methods of this class, a *resource* argument is expected to be " +"a :term:`path-like object` which represents conceptually just a file name. " +"This means that no subdirectory paths should be included in the *resource* " "argument. This is because the location of the package the reader is for, " "acts as the \"directory\". Hence the metaphor for directories and file names " "is packages and resources, respectively. This is also why instances of this " @@ -891,7 +898,7 @@ msgid "" "potentially representing multiple packages or a module)." msgstr "" -#: ../../library/importlib.rst:664 +#: ../../library/importlib.rst:666 msgid "" "Loaders that wish to support resource reading are expected to provide a " "method called ``get_resource_reader(fullname)`` which returns an object " @@ -900,45 +907,45 @@ msgid "" "with this ABC should only be returned when the specified module is a package." msgstr "" -#: ../../library/importlib.rst:673 ../../library/importlib.rst:793 +#: ../../library/importlib.rst:675 ../../library/importlib.rst:795 msgid "Use :class:`importlib.resources.abc.TraversableResources` instead." msgstr "" -#: ../../library/importlib.rst:679 +#: ../../library/importlib.rst:681 msgid "" "Returns an opened, :term:`file-like object` for binary reading of the " "*resource*." msgstr "" -#: ../../library/importlib.rst:682 +#: ../../library/importlib.rst:684 msgid "If the resource cannot be found, :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/importlib.rst:688 +#: ../../library/importlib.rst:690 msgid "Returns the file system path to the *resource*." msgstr "" -#: ../../library/importlib.rst:690 +#: ../../library/importlib.rst:692 msgid "" -"If the resource does not concretely exist on the file system, raise :exc:" -"`FileNotFoundError`." +"If the resource does not concretely exist on the file system, " +"raise :exc:`FileNotFoundError`." msgstr "" -#: ../../library/importlib.rst:696 +#: ../../library/importlib.rst:698 msgid "" -"Returns ``True`` if the named *name* is considered a resource. :exc:" -"`FileNotFoundError` is raised if *name* does not exist." +"Returns ``True`` if the named *name* is considered a " +"resource. :exc:`FileNotFoundError` is raised if *name* does not exist." msgstr "" -#: ../../library/importlib.rst:702 +#: ../../library/importlib.rst:704 msgid "" "Returns an :term:`iterable` of strings over the contents of the package. Do " "note that it is not required that all names returned by the iterator be " -"actual resources, e.g. it is acceptable to return names for which :meth:" -"`is_resource` would be false." +"actual resources, e.g. it is acceptable to return names for " +"which :meth:`is_resource` would be false." msgstr "" -#: ../../library/importlib.rst:708 +#: ../../library/importlib.rst:710 msgid "" "Allowing non-resource names to be returned is to allow for situations where " "how a package and its resources are stored are known a priori and the non-" @@ -947,254 +954,258 @@ msgid "" "stored on the file system then those subdirectory names can be used directly." msgstr "" -#: ../../library/importlib.rst:716 +#: ../../library/importlib.rst:718 msgid "The abstract method returns an iterable of no items." msgstr "" -#: ../../library/importlib.rst:721 +#: ../../library/importlib.rst:723 msgid "" "An object with a subset of :class:`pathlib.Path` methods suitable for " "traversing directories and opening files." msgstr "" -#: ../../library/importlib.rst:724 +#: ../../library/importlib.rst:726 msgid "" -"For a representation of the object on the file-system, use :meth:`importlib." -"resources.as_file`." +"For a representation of the object on the file-system, " +"use :meth:`importlib.resources.as_file`." msgstr "" -#: ../../library/importlib.rst:729 +#: ../../library/importlib.rst:731 msgid "Use :class:`importlib.resources.abc.Traversable` instead." msgstr "" -#: ../../library/importlib.rst:734 +#: ../../library/importlib.rst:736 msgid "Abstract. The base name of this object without any parent references." msgstr "" -#: ../../library/importlib.rst:739 +#: ../../library/importlib.rst:741 msgid "Yield ``Traversable`` objects in ``self``." msgstr "" -#: ../../library/importlib.rst:744 +#: ../../library/importlib.rst:746 msgid "Return ``True`` if ``self`` is a directory." msgstr "" -#: ../../library/importlib.rst:749 +#: ../../library/importlib.rst:751 msgid "Return ``True`` if ``self`` is a file." msgstr "" -#: ../../library/importlib.rst:754 +#: ../../library/importlib.rst:756 msgid "Return Traversable child in ``self``." msgstr "" -#: ../../library/importlib.rst:759 +#: ../../library/importlib.rst:761 msgid "Return ``Traversable`` child in ``self``." msgstr "" -#: ../../library/importlib.rst:764 +#: ../../library/importlib.rst:766 msgid "" "*mode* may be 'r' or 'rb' to open as text or binary. Return a handle " "suitable for reading (same as :attr:`pathlib.Path.open`)." msgstr "" -#: ../../library/importlib.rst:767 +#: ../../library/importlib.rst:769 msgid "" -"When opening as text, accepts encoding parameters such as those accepted by :" -"class:`io.TextIOWrapper`." +"When opening as text, accepts encoding parameters such as those accepted " +"by :class:`io.TextIOWrapper`." msgstr "" -#: ../../library/importlib.rst:772 +#: ../../library/importlib.rst:774 msgid "Read contents of ``self`` as bytes." msgstr "" -#: ../../library/importlib.rst:776 +#: ../../library/importlib.rst:778 msgid "Read contents of ``self`` as text." msgstr "" -#: ../../library/importlib.rst:781 +#: ../../library/importlib.rst:783 msgid "" -"An abstract base class for resource readers capable of serving the :meth:" -"`importlib.resources.files` interface. Subclasses :class:`importlib." -"resources.abc.ResourceReader` and provides concrete implementations of the :" -"class:`importlib.resources.abc.ResourceReader`'s abstract methods. " +"An abstract base class for resource readers capable of serving " +"the :meth:`importlib.resources.files` interface. " +"Subclasses :class:`importlib.resources.abc.ResourceReader` and provides " +"concrete implementations of " +"the :class:`importlib.resources.abc.ResourceReader`'s abstract methods. " "Therefore, any loader supplying :class:`importlib.abc.TraversableResources` " "also supplies ResourceReader." msgstr "" -#: ../../library/importlib.rst:788 +#: ../../library/importlib.rst:790 msgid "" "Loaders that wish to support resource reading are expected to implement this " "interface." msgstr "" -#: ../../library/importlib.rst:799 +#: ../../library/importlib.rst:801 msgid "" "Returns a :class:`importlib.resources.abc.Traversable` object for the loaded " "package." msgstr "" -#: ../../library/importlib.rst:805 +#: ../../library/importlib.rst:807 msgid ":mod:`importlib.machinery` -- Importers and path hooks" msgstr "" -#: ../../library/importlib.rst:810 +#: ../../library/importlib.rst:812 msgid "**Source code:** :source:`Lib/importlib/machinery.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/machinery.py`" -#: ../../library/importlib.rst:814 +#: ../../library/importlib.rst:816 msgid "" "This module contains the various objects that help :keyword:`import` find " "and load modules." msgstr "" -#: ../../library/importlib.rst:819 +#: ../../library/importlib.rst:821 msgid "" "A list of strings representing the recognized file suffixes for source " "modules." msgstr "" -#: ../../library/importlib.rst:826 +#: ../../library/importlib.rst:828 msgid "" "A list of strings representing the file suffixes for non-optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:831 ../../library/importlib.rst:841 +#: ../../library/importlib.rst:833 ../../library/importlib.rst:843 msgid "Use :const:`BYTECODE_SUFFIXES` instead." msgstr "" -#: ../../library/importlib.rst:836 +#: ../../library/importlib.rst:838 msgid "" "A list of strings representing the file suffixes for optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:846 +#: ../../library/importlib.rst:848 msgid "" "A list of strings representing the recognized file suffixes for bytecode " "modules (including the leading dot)." msgstr "" -#: ../../library/importlib.rst:851 +#: ../../library/importlib.rst:853 msgid "The value is no longer dependent on ``__debug__``." msgstr "" -#: ../../library/importlib.rst:856 +#: ../../library/importlib.rst:858 msgid "" "A list of strings representing the recognized file suffixes for extension " "modules." msgstr "" -#: ../../library/importlib.rst:863 +#: ../../library/importlib.rst:865 msgid "" "Returns a combined list of strings representing all file suffixes for " "modules recognized by the standard import machinery. This is a helper for " "code which simply needs to know if a filesystem path potentially refers to a " -"module without needing any details on the kind of module (for example, :func:" -"`inspect.getmodulename`)." +"module without needing any details on the kind of module (for " +"example, :func:`inspect.getmodulename`)." msgstr "" -#: ../../library/importlib.rst:874 +#: ../../library/importlib.rst:876 msgid "" "An :term:`importer` for built-in modules. All known built-in modules are " -"listed in :data:`sys.builtin_module_names`. This class implements the :class:" -"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." +"listed in :data:`sys.builtin_module_names`. This class implements " +"the :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:879 ../../library/importlib.rst:893 -#: ../../library/importlib.rst:906 ../../library/importlib.rst:921 +#: ../../library/importlib.rst:881 ../../library/importlib.rst:895 +#: ../../library/importlib.rst:908 ../../library/importlib.rst:923 msgid "" "Only class methods are defined by this class to alleviate the need for " "instantiation." msgstr "" -#: ../../library/importlib.rst:882 +#: ../../library/importlib.rst:884 msgid "" -"As part of :pep:`489`, the builtin importer now implements :meth:`Loader." -"create_module` and :meth:`Loader.exec_module`" +"As part of :pep:`489`, the builtin importer now " +"implements :meth:`Loader.create_module` and :meth:`Loader.exec_module`" msgstr "" -#: ../../library/importlib.rst:889 +#: ../../library/importlib.rst:891 msgid "" -"An :term:`importer` for frozen modules. This class implements the :class:" -"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." +"An :term:`importer` for frozen modules. This class implements " +"the :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:896 +#: ../../library/importlib.rst:898 msgid "" "Gained :meth:`~Loader.create_module` and :meth:`~Loader.exec_module` methods." msgstr "" -#: ../../library/importlib.rst:903 +#: ../../library/importlib.rst:905 msgid "" ":term:`Finder ` for modules declared in the Windows registry. This " "class implements the :class:`importlib.abc.MetaPathFinder` ABC." msgstr "" -#: ../../library/importlib.rst:911 +#: ../../library/importlib.rst:913 msgid "" "Use :mod:`site` configuration instead. Future versions of Python may not " "enable this finder by default." msgstr "" -#: ../../library/importlib.rst:918 +#: ../../library/importlib.rst:920 msgid "" "A :term:`Finder ` for :data:`sys.path` and package ``__path__`` " "attributes. This class implements the :class:`importlib.abc.MetaPathFinder` " "ABC." msgstr "" -#: ../../library/importlib.rst:926 +#: ../../library/importlib.rst:928 msgid "" "Class method that attempts to find a :term:`spec ` for the " "module specified by *fullname* on :data:`sys.path` or, if defined, on " -"*path*. For each path entry that is searched, :data:`sys." -"path_importer_cache` is checked. If a non-false object is found then it is " -"used as the :term:`path entry finder` to look for the module being searched " -"for. If no entry is found in :data:`sys.path_importer_cache`, then :data:" -"`sys.path_hooks` is searched for a finder for the path entry and, if found, " -"is stored in :data:`sys.path_importer_cache` along with being queried about " -"the module. If no finder is ever found then ``None`` is both stored in the " -"cache and returned." +"*path*. For each path entry that is " +"searched, :data:`sys.path_importer_cache` is checked. If a non-false object " +"is found then it is used as the :term:`path entry finder` to look for the " +"module being searched for. If no entry is found " +"in :data:`sys.path_importer_cache`, then :data:`sys.path_hooks` is searched " +"for a finder for the path entry and, if found, is stored " +"in :data:`sys.path_importer_cache` along with being queried about the " +"module. If no finder is ever found then ``None`` is both stored in the cache " +"and returned." msgstr "" -#: ../../library/importlib.rst:940 +#: ../../library/importlib.rst:942 msgid "" "If the current working directory -- represented by an empty string -- is no " -"longer valid then ``None`` is returned but no value is cached in :data:`sys." -"path_importer_cache`." +"longer valid then ``None`` is returned but no value is cached " +"in :data:`sys.path_importer_cache`." msgstr "" -#: ../../library/importlib.rst:947 +#: ../../library/importlib.rst:949 msgid "" "Calls :meth:`importlib.abc.PathEntryFinder.invalidate_caches` on all finders " "stored in :data:`sys.path_importer_cache` that define the method. Otherwise " "entries in :data:`sys.path_importer_cache` set to ``None`` are deleted." msgstr "" -#: ../../library/importlib.rst:952 +#: ../../library/importlib.rst:954 msgid "Entries of ``None`` in :data:`sys.path_importer_cache` are deleted." msgstr "" -#: ../../library/importlib.rst:955 +#: ../../library/importlib.rst:957 msgid "" "Calls objects in :data:`sys.path_hooks` with the current working directory " "for ``''`` (i.e. the empty string)." msgstr "" -#: ../../library/importlib.rst:962 +#: ../../library/importlib.rst:964 msgid "" "A concrete implementation of :class:`importlib.abc.PathEntryFinder` which " "caches results from the file system." msgstr "" -#: ../../library/importlib.rst:965 +#: ../../library/importlib.rst:967 msgid "" "The *path* argument is the directory for which the finder is in charge of " "searching." msgstr "" -#: ../../library/importlib.rst:968 +#: ../../library/importlib.rst:970 msgid "" "The *loader_details* argument is a variable number of 2-item tuples each " "containing a loader and a sequence of file suffixes the loader recognizes. " @@ -1202,7 +1213,7 @@ msgid "" "module's name and the path to the file found." msgstr "" -#: ../../library/importlib.rst:973 +#: ../../library/importlib.rst:975 msgid "" "The finder will cache the directory contents as necessary, making stat calls " "for each module search to verify the cache is not outdated. Because cache " @@ -1215,166 +1226,166 @@ msgid "" "to call :func:`importlib.invalidate_caches`." msgstr "" -#: ../../library/importlib.rst:987 +#: ../../library/importlib.rst:989 msgid "The path the finder will search in." msgstr "" -#: ../../library/importlib.rst:991 +#: ../../library/importlib.rst:993 msgid "Attempt to find the spec to handle *fullname* within :attr:`path`." msgstr "" -#: ../../library/importlib.rst:997 +#: ../../library/importlib.rst:999 msgid "Clear out the internal cache." msgstr "" -#: ../../library/importlib.rst:1001 +#: ../../library/importlib.rst:1003 msgid "" "A class method which returns a closure for use on :data:`sys.path_hooks`. An " "instance of :class:`FileFinder` is returned by the closure using the path " "argument given to the closure directly and *loader_details* indirectly." msgstr "" -#: ../../library/importlib.rst:1006 +#: ../../library/importlib.rst:1008 msgid "" -"If the argument to the closure is not an existing directory, :exc:" -"`ImportError` is raised." +"If the argument to the closure is not an existing " +"directory, :exc:`ImportError` is raised." msgstr "" -#: ../../library/importlib.rst:1012 +#: ../../library/importlib.rst:1014 msgid "" "A concrete implementation of :class:`importlib.abc.SourceLoader` by " "subclassing :class:`importlib.abc.FileLoader` and providing some concrete " "implementations of other methods." msgstr "" -#: ../../library/importlib.rst:1020 +#: ../../library/importlib.rst:1022 msgid "The name of the module that this loader will handle." msgstr "" -#: ../../library/importlib.rst:1024 +#: ../../library/importlib.rst:1026 msgid "The path to the source file." msgstr "" -#: ../../library/importlib.rst:1028 +#: ../../library/importlib.rst:1030 msgid "Return ``True`` if :attr:`path` appears to be for a package." msgstr "" -#: ../../library/importlib.rst:1032 +#: ../../library/importlib.rst:1034 msgid "" "Concrete implementation of :meth:`importlib.abc.SourceLoader.path_stats`." msgstr "" -#: ../../library/importlib.rst:1036 +#: ../../library/importlib.rst:1038 msgid "Concrete implementation of :meth:`importlib.abc.SourceLoader.set_data`." msgstr "" -#: ../../library/importlib.rst:1040 ../../library/importlib.rst:1083 +#: ../../library/importlib.rst:1042 ../../library/importlib.rst:1085 msgid "" "Concrete implementation of :meth:`importlib.abc.Loader.load_module` where " "specifying the name of the module to load is optional." msgstr "" -#: ../../library/importlib.rst:1045 ../../library/importlib.rst:1088 +#: ../../library/importlib.rst:1047 ../../library/importlib.rst:1090 msgid "Use :meth:`importlib.abc.Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:1050 +#: ../../library/importlib.rst:1052 msgid "" "A concrete implementation of :class:`importlib.abc.FileLoader` which can " "import bytecode files (i.e. no source code files exist)." msgstr "" -#: ../../library/importlib.rst:1053 +#: ../../library/importlib.rst:1055 msgid "" "Please note that direct use of bytecode files (and thus not source code " "files) inhibits your modules from being usable by all Python implementations " "or new versions of Python which change the bytecode format." msgstr "" -#: ../../library/importlib.rst:1062 +#: ../../library/importlib.rst:1064 msgid "The name of the module the loader will handle." msgstr "" -#: ../../library/importlib.rst:1066 +#: ../../library/importlib.rst:1068 msgid "The path to the bytecode file." msgstr "" -#: ../../library/importlib.rst:1070 +#: ../../library/importlib.rst:1072 msgid "Determines if the module is a package based on :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1074 +#: ../../library/importlib.rst:1076 msgid "Returns the code object for :attr:`name` created from :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1078 +#: ../../library/importlib.rst:1080 msgid "" "Returns ``None`` as bytecode files have no source when this loader is used." msgstr "" -#: ../../library/importlib.rst:1093 +#: ../../library/importlib.rst:1095 msgid "" "A concrete implementation of :class:`importlib.abc.ExecutionLoader` for " "extension modules." msgstr "" -#: ../../library/importlib.rst:1096 +#: ../../library/importlib.rst:1098 msgid "" "The *fullname* argument specifies the name of the module the loader is to " "support. The *path* argument is the path to the extension module's file." msgstr "" -#: ../../library/importlib.rst:1099 +#: ../../library/importlib.rst:1101 msgid "" "Note that, by default, importing an extension module will fail in " "subinterpreters if it doesn't implement multi-phase init (see :pep:`489`), " "even if it would otherwise import successfully." msgstr "" -#: ../../library/importlib.rst:1105 +#: ../../library/importlib.rst:1107 msgid "Multi-phase init is now required for use in subinterpreters." msgstr "" -#: ../../library/importlib.rst:1110 ../../library/importlib.rst:1296 +#: ../../library/importlib.rst:1112 ../../library/importlib.rst:1298 msgid "Name of the module the loader supports." msgstr "" -#: ../../library/importlib.rst:1114 +#: ../../library/importlib.rst:1116 msgid "Path to the extension module." msgstr "" -#: ../../library/importlib.rst:1118 +#: ../../library/importlib.rst:1120 msgid "" -"Creates the module object from the given specification in accordance with :" -"pep:`489`." +"Creates the module object from the given specification in accordance " +"with :pep:`489`." msgstr "" -#: ../../library/importlib.rst:1125 +#: ../../library/importlib.rst:1127 msgid "Initializes the given module object in accordance with :pep:`489`." msgstr "" -#: ../../library/importlib.rst:1131 +#: ../../library/importlib.rst:1133 msgid "" "Returns ``True`` if the file path points to a package's ``__init__`` module " "based on :const:`EXTENSION_SUFFIXES`." msgstr "" -#: ../../library/importlib.rst:1136 +#: ../../library/importlib.rst:1138 msgid "Returns ``None`` as extension modules lack a code object." msgstr "" -#: ../../library/importlib.rst:1140 +#: ../../library/importlib.rst:1142 msgid "Returns ``None`` as extension modules do not have source code." msgstr "" -#: ../../library/importlib.rst:1151 +#: ../../library/importlib.rst:1153 msgid "" "A concrete implementation of :class:`importlib.abc.InspectLoader` for " "namespace packages. This is an alias for a private class and is only made " "public for introspecting the ``__loader__`` attribute on namespace packages::" msgstr "" -#: ../../library/importlib.rst:1156 +#: ../../library/importlib.rst:1158 msgid "" ">>> from importlib.machinery import NamespaceLoader\n" ">>> import my_namespace\n" @@ -1392,7 +1403,7 @@ msgstr "" ">>> isinstance(my_namespace.__loader__, importlib.abc.Loader)\n" "True" -#: ../../library/importlib.rst:1169 +#: ../../library/importlib.rst:1171 msgid "" "A specification for a module's import-system-related state. This is " "typically exposed as the module's :attr:`~module.__spec__` attribute. Many " @@ -1401,39 +1412,40 @@ msgid "" "the *values* are usually equivalent, they can differ since there is no " "synchronization between the two objects. For example, it is possible to " "update the module's :attr:`~module.__file__` at runtime and this will not be " -"automatically reflected in the module's :attr:`__spec__.origin `, and vice versa." +"automatically reflected in the module's :attr:`__spec__.origin " +"`, and vice versa." msgstr "" -#: ../../library/importlib.rst:1183 +#: ../../library/importlib.rst:1185 msgid "" -"The module's fully qualified name (see :attr:`module.__name__`). The :term:" -"`finder` should always set this attribute to a non-empty string." +"The module's fully qualified name (see :attr:`module.__name__`). " +"The :term:`finder` should always set this attribute to a non-empty string." msgstr "" -#: ../../library/importlib.rst:1188 +#: ../../library/importlib.rst:1190 msgid "" "The :term:`loader` used to load the module (see :attr:`module.__loader__`). " "The :term:`finder` should always set this attribute." msgstr "" -#: ../../library/importlib.rst:1193 +#: ../../library/importlib.rst:1195 msgid "" -"The location the :term:`loader` should use to load the module (see :attr:" -"`module.__file__`). For example, for modules loaded from a ``.py`` file this " -"is the filename. The :term:`finder` should always set this attribute to a " -"meaningful value for the :term:`loader` to use. In the uncommon case that " -"there is not one (like for namespace packages), it should be set to ``None``." +"The location the :term:`loader` should use to load the module " +"(see :attr:`module.__file__`). For example, for modules loaded from a " +"``.py`` file this is the filename. The :term:`finder` should always set this " +"attribute to a meaningful value for the :term:`loader` to use. In the " +"uncommon case that there is not one (like for namespace packages), it should " +"be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1202 +#: ../../library/importlib.rst:1204 msgid "" "A (possibly empty) :term:`sequence` of strings enumerating the locations in " "which a package's submodules will be found (see :attr:`module.__path__`). " "Most of the time there will only be a single directory in this list." msgstr "" -#: ../../library/importlib.rst:1207 +#: ../../library/importlib.rst:1209 msgid "" "The :term:`finder` should set this attribute to a sequence, even an empty " "one, to indicate to the import system that the module is a package. It " @@ -1441,41 +1453,42 @@ msgid "" "later to a special object for namespace packages." msgstr "" -#: ../../library/importlib.rst:1215 +#: ../../library/importlib.rst:1217 msgid "" "The :term:`finder` may set this attribute to an object containing " "additional, module-specific data to use when loading the module. Otherwise " "it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1221 +#: ../../library/importlib.rst:1223 msgid "" -"The filename of a compiled version of the module's code (see :attr:`module." -"__cached__`). The :term:`finder` should always set this attribute but it may " -"be ``None`` for modules that do not need compiled code stored." +"The filename of a compiled version of the module's code " +"(see :attr:`module.__cached__`). The :term:`finder` should always set this " +"attribute but it may be ``None`` for modules that do not need compiled code " +"stored." msgstr "" -#: ../../library/importlib.rst:1228 +#: ../../library/importlib.rst:1230 msgid "" "(Read-only) The fully qualified name of the package the module is in (or the " "empty string for a top-level module). See :attr:`module.__package__`. If the " "module is a package then this is the same as :attr:`name`." msgstr "" -#: ../../library/importlib.rst:1235 +#: ../../library/importlib.rst:1237 msgid "" "``True`` if the spec's :attr:`origin` refers to a loadable location, " "``False`` otherwise. This value impacts how :attr:`!origin` is interpreted " "and how the module's :attr:`~module.__file__` is populated." msgstr "" -#: ../../library/importlib.rst:1242 +#: ../../library/importlib.rst:1244 msgid "" "A specialization of :class:`importlib.machinery.ExtensionFileLoader` that is " "able to load extension modules in Framework format." msgstr "" -#: ../../library/importlib.rst:1245 +#: ../../library/importlib.rst:1247 msgid "" "For compatibility with the iOS App Store, *all* binary modules in an iOS app " "must be dynamic libraries, contained in a framework with appropriate " @@ -1484,46 +1497,46 @@ msgid "" "material outside the Frameworks folder." msgstr "" -#: ../../library/importlib.rst:1251 +#: ../../library/importlib.rst:1253 msgid "" "To accommodate this requirement, when running on iOS, extension module " "binaries are *not* packaged as ``.so`` files on ``sys.path``, but as " "individual standalone frameworks. To discover those frameworks, this loader " "is be registered against the ``.fwork`` file extension, with a ``.fwork`` " -"file acting as a placeholder in the original location of the binary on ``sys." -"path``. The ``.fwork`` file contains the path of the actual binary in the " -"``Frameworks`` folder, relative to the app bundle. To allow for resolving a " -"framework-packaged binary back to the original location, the framework is " -"expected to contain a ``.origin`` file that contains the location of the ``." -"fwork`` file, relative to the app bundle." +"file acting as a placeholder in the original location of the binary on " +"``sys.path``. The ``.fwork`` file contains the path of the actual binary in " +"the ``Frameworks`` folder, relative to the app bundle. To allow for " +"resolving a framework-packaged binary back to the original location, the " +"framework is expected to contain a ``.origin`` file that contains the " +"location of the ``.fwork`` file, relative to the app bundle." msgstr "" -#: ../../library/importlib.rst:1262 +#: ../../library/importlib.rst:1264 msgid "" "For example, consider the case of an import ``from foo.bar import _whiz``, " "where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" -"_whiz.abi3.so``, with ``sources`` being the location registered on ``sys." -"path``, relative to the application bundle. This module *must* be " +"_whiz.abi3.so``, with ``sources`` being the location registered on " +"``sys.path``, relative to the application bundle. This module *must* be " "distributed as ``Frameworks/foo.bar._whiz.framework/foo.bar._whiz`` " "(creating the framework name from the full import path of the module), with " "an ``Info.plist`` file in the ``.framework`` directory identifying the " "binary as a framework. The ``foo.bar._whiz`` module would be represented in " "the original location with a ``sources/foo/bar/_whiz.abi3.fwork`` marker " "file, containing the path ``Frameworks/foo.bar._whiz/foo.bar._whiz``. The " -"framework would also contain ``Frameworks/foo.bar._whiz.framework/foo.bar." -"_whiz.origin``, containing the path to the ``.fwork`` file." +"framework would also contain ``Frameworks/foo.bar._whiz.framework/" +"foo.bar._whiz.origin``, containing the path to the ``.fwork`` file." msgstr "" -#: ../../library/importlib.rst:1276 +#: ../../library/importlib.rst:1278 msgid "" "When a module is loaded with this loader, the ``__file__`` for the module " "will report as the location of the ``.fwork`` file. This allows code to use " -"the ``__file__`` of a module as an anchor for file system traveral. " +"the ``__file__`` of a module as an anchor for file system traversal. " "However, the spec origin will reference the location of the *actual* binary " "in the ``.framework`` folder." msgstr "" -#: ../../library/importlib.rst:1282 +#: ../../library/importlib.rst:1284 msgid "" "The Xcode project building the app is responsible for converting any ``.so`` " "files from wherever they exist in the ``PYTHONPATH`` into frameworks in the " @@ -1534,45 +1547,45 @@ msgid "" "details on how to construct this build step." msgstr "" -#: ../../library/importlib.rst:1292 +#: ../../library/importlib.rst:1294 msgid "Availability" msgstr "可用性" -#: ../../library/importlib.rst:1300 +#: ../../library/importlib.rst:1302 msgid "Path to the ``.fwork`` file for the extension module." msgstr "" -#: ../../library/importlib.rst:1304 +#: ../../library/importlib.rst:1306 msgid ":mod:`importlib.util` -- Utility code for importers" msgstr "" -#: ../../library/importlib.rst:1310 +#: ../../library/importlib.rst:1312 msgid "**Source code:** :source:`Lib/importlib/util.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/util.py`" -#: ../../library/importlib.rst:1314 +#: ../../library/importlib.rst:1316 msgid "" "This module contains the various objects that help in the construction of " "an :term:`importer`." msgstr "" -#: ../../library/importlib.rst:1319 +#: ../../library/importlib.rst:1321 msgid "" "The bytes which represent the bytecode version number. If you need help with " "loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`." msgstr "" -#: ../../library/importlib.rst:1326 +#: ../../library/importlib.rst:1328 msgid "" "Return the :pep:`3147`/:pep:`488` path to the byte-compiled file associated " "with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the " "return value would be ``/foo/bar/__pycache__/baz.cpython-32.pyc`` for Python " -"3.2. The ``cpython-32`` string comes from the current magic tag (see :func:" -"`get_tag`; if :attr:`sys.implementation.cache_tag` is not defined then :exc:" -"`NotImplementedError` will be raised)." +"3.2. The ``cpython-32`` string comes from the current magic tag " +"(see :func:`get_tag`; if :attr:`sys.implementation.cache_tag` is not defined " +"then :exc:`NotImplementedError` will be raised)." msgstr "" -#: ../../library/importlib.rst:1333 +#: ../../library/importlib.rst:1335 msgid "" "The *optimization* parameter is used to specify the optimization level of " "the bytecode file. An empty string represents no optimization, so ``/foo/bar/" @@ -1580,12 +1593,12 @@ msgid "" "``/foo/bar/__pycache__/baz.cpython-32.pyc``. ``None`` causes the " "interpreter's optimization level to be used. Any other value's string " "representation is used, so ``/foo/bar/baz.py`` with an *optimization* of " -"``2`` will lead to the bytecode path of ``/foo/bar/__pycache__/baz." -"cpython-32.opt-2.pyc``. The string representation of *optimization* can only " -"be alphanumeric, else :exc:`ValueError` is raised." +"``2`` will lead to the bytecode path of ``/foo/bar/__pycache__/" +"baz.cpython-32.opt-2.pyc``. The string representation of *optimization* can " +"only be alphanumeric, else :exc:`ValueError` is raised." msgstr "" -#: ../../library/importlib.rst:1343 +#: ../../library/importlib.rst:1345 msgid "" "The *debug_override* parameter is deprecated and can be used to override the " "system's value for ``__debug__``. A ``True`` value is the equivalent of " @@ -1594,60 +1607,63 @@ msgid "" "are not ``None`` then :exc:`TypeError` is raised." msgstr "" -#: ../../library/importlib.rst:1351 +#: ../../library/importlib.rst:1353 msgid "" "The *optimization* parameter was added and the *debug_override* parameter " "was deprecated." msgstr "" -#: ../../library/importlib.rst:1355 ../../library/importlib.rst:1371 -#: ../../library/importlib.rst:1460 +#: ../../library/importlib.rst:1357 ../../library/importlib.rst:1373 +#: ../../library/importlib.rst:1462 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/importlib.rst:1361 +#: ../../library/importlib.rst:1363 msgid "" "Given the *path* to a :pep:`3147` file name, return the associated source " -"code file path. For example, if *path* is ``/foo/bar/__pycache__/baz." -"cpython-32.pyc`` the returned path would be ``/foo/bar/baz.py``. *path* " +"code file path. For example, if *path* is ``/foo/bar/__pycache__/" +"baz.cpython-32.pyc`` the returned path would be ``/foo/bar/baz.py``. *path* " "need not exist, however if it does not conform to :pep:`3147` or :pep:`488` " -"format, a :exc:`ValueError` is raised. If :attr:`sys.implementation." -"cache_tag` is not defined, :exc:`NotImplementedError` is raised." +"format, a :exc:`ValueError` is raised. " +"If :attr:`sys.implementation.cache_tag` is not " +"defined, :exc:`NotImplementedError` is raised." msgstr "" -#: ../../library/importlib.rst:1376 +#: ../../library/importlib.rst:1378 msgid "" "Decode the given bytes representing source code and return it as a string " -"with universal newlines (as required by :meth:`importlib.abc.InspectLoader." -"get_source`)." +"with universal newlines (as required " +"by :meth:`importlib.abc.InspectLoader.get_source`)." msgstr "" -#: ../../library/importlib.rst:1384 +#: ../../library/importlib.rst:1386 msgid "Resolve a relative module name to an absolute one." msgstr "" -#: ../../library/importlib.rst:1386 +#: ../../library/importlib.rst:1388 msgid "" "If **name** has no leading dots, then **name** is simply returned. This " -"allows for usage such as ``importlib.util.resolve_name('sys', __spec__." -"parent)`` without doing a check to see if the **package** argument is needed." +"allows for usage such as ``importlib.util.resolve_name('sys', " +"__spec__.parent)`` without doing a check to see if the **package** argument " +"is needed." msgstr "" -#: ../../library/importlib.rst:1391 +#: ../../library/importlib.rst:1393 msgid "" ":exc:`ImportError` is raised if **name** is a relative module name but " -"**package** is a false value (e.g. ``None`` or the empty string). :exc:" -"`ImportError` is also raised if a relative name would escape its containing " -"package (e.g. requesting ``..bacon`` from within the ``spam`` package)." +"**package** is a false value (e.g. ``None`` or the empty " +"string). :exc:`ImportError` is also raised if a relative name would escape " +"its containing package (e.g. requesting ``..bacon`` from within the ``spam`` " +"package)." msgstr "" -#: ../../library/importlib.rst:1399 +#: ../../library/importlib.rst:1401 msgid "" "To improve consistency with import statements, raise :exc:`ImportError` " "instead of :exc:`ValueError` for invalid relative import attempts." msgstr "" -#: ../../library/importlib.rst:1406 +#: ../../library/importlib.rst:1408 msgid "" "Find the :term:`spec ` for a module, optionally relative to the " "specified **package** name. If the module is in :data:`sys.modules`, then " @@ -1657,30 +1673,30 @@ msgid "" "if no spec is found." msgstr "" -#: ../../library/importlib.rst:1413 +#: ../../library/importlib.rst:1415 msgid "" "If **name** is for a submodule (contains a dot), the parent module is " "automatically imported." msgstr "" -#: ../../library/importlib.rst:1416 +#: ../../library/importlib.rst:1418 msgid "**name** and **package** work the same as for :func:`import_module`." msgstr "" -#: ../../library/importlib.rst:1420 +#: ../../library/importlib.rst:1422 msgid "" "Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if " "**package** is in fact not a package (i.e. lacks a :attr:`~module.__path__` " "attribute)." msgstr "" -#: ../../library/importlib.rst:1427 +#: ../../library/importlib.rst:1429 msgid "" "Create a new module based on **spec** and :meth:`spec.loader.create_module " "`." msgstr "" -#: ../../library/importlib.rst:1430 +#: ../../library/importlib.rst:1432 msgid "" "If :meth:`spec.loader.create_module ` " "does not return ``None``, then any pre-existing attributes will not be " @@ -1688,23 +1704,23 @@ msgid "" "accessing **spec** or setting an attribute on the module." msgstr "" -#: ../../library/importlib.rst:1435 +#: ../../library/importlib.rst:1437 msgid "" "This function is preferred over using :class:`types.ModuleType` to create a " "new module as **spec** is used to set as many import-controlled attributes " "on the module as possible." msgstr "" -#: ../../library/importlib.rst:1443 +#: ../../library/importlib.rst:1445 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on a loader. The parameters have the same meaning as they do " -"for ModuleSpec. The function uses available :term:`loader` APIs, such as :" -"meth:`InspectLoader.is_package`, to fill in any missing information on the " -"spec." +"for ModuleSpec. The function uses available :term:`loader` APIs, such " +"as :meth:`InspectLoader.is_package`, to fill in any missing information on " +"the spec." msgstr "" -#: ../../library/importlib.rst:1453 +#: ../../library/importlib.rst:1455 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on the path to a file. Missing information will be filled in " @@ -1712,14 +1728,14 @@ msgid "" "module will be file-based." msgstr "" -#: ../../library/importlib.rst:1465 +#: ../../library/importlib.rst:1467 msgid "" "Return the hash of *source_bytes* as bytes. A hash-based ``.pyc`` file " "embeds the :func:`source_hash` of the corresponding source file's contents " "in its header." msgstr "" -#: ../../library/importlib.rst:1473 +#: ../../library/importlib.rst:1475 msgid "" "A context manager that can temporarily skip the compatibility check for " "extension modules. By default the check is enabled and will fail when a " @@ -1728,14 +1744,14 @@ msgid "" "interpreter GIL, when imported in an interpreter with its own GIL." msgstr "" -#: ../../library/importlib.rst:1480 +#: ../../library/importlib.rst:1482 msgid "" "Note that this function is meant to accommodate an unusual case; one which " "is likely to eventually go away. There's is a pretty good chance this is " "not what you were looking for." msgstr "" -#: ../../library/importlib.rst:1484 +#: ../../library/importlib.rst:1486 msgid "" "You can get the same effect as this function by implementing the basic " "interface of multi-phase init (:pep:`489`) and lying about support for " @@ -1744,32 +1760,33 @@ msgstr "" "你可以透過實作多階段初始化的基本介面 (:pep:`489`) 並假稱有多個直譯器(或直譯" "器各別持有的 GIL)的支援,來達到與此函式相同的效果。" -#: ../../library/importlib.rst:1489 +#: ../../library/importlib.rst:1491 msgid "" "Using this function to disable the check can lead to unexpected behavior and " "even crashes. It should only be used during extension module development." msgstr "" -#: ../../library/importlib.rst:1497 +#: ../../library/importlib.rst:1499 msgid "" "A class which postpones the execution of the loader of a module until the " "module has an attribute accessed." msgstr "" -#: ../../library/importlib.rst:1500 +#: ../../library/importlib.rst:1502 msgid "" -"This class **only** works with loaders that define :meth:`~importlib.abc." -"Loader.exec_module` as control over what module type is used for the module " -"is required. For those same reasons, the loader's :meth:`~importlib.abc." -"Loader.create_module` method must return ``None`` or a type for which its " -"``__class__`` attribute can be mutated along with not using :term:`slots " -"<__slots__>`. Finally, modules which substitute the object placed into :data:" -"`sys.modules` will not work as there is no way to properly replace the " -"module references throughout the interpreter safely; :exc:`ValueError` is " -"raised if such a substitution is detected." +"This class **only** works with loaders that " +"define :meth:`~importlib.abc.Loader.exec_module` as control over what module " +"type is used for the module is required. For those same reasons, the " +"loader's :meth:`~importlib.abc.Loader.create_module` method must return " +"``None`` or a type for which its ``__class__`` attribute can be mutated " +"along with not using :term:`slots <__slots__>`. Finally, modules which " +"substitute the object placed into :data:`sys.modules` will not work as there " +"is no way to properly replace the module references throughout the " +"interpreter safely; :exc:`ValueError` is raised if such a substitution is " +"detected." msgstr "" -#: ../../library/importlib.rst:1511 +#: ../../library/importlib.rst:1513 msgid "" "For projects where startup time is critical, this class allows for " "potentially minimizing the cost of loading a module if it is never used. For " @@ -1778,21 +1795,21 @@ msgid "" "postponed and thus occurring out of context." msgstr "" -#: ../../library/importlib.rst:1519 +#: ../../library/importlib.rst:1521 msgid "" "Began calling :meth:`~importlib.abc.Loader.create_module`, removing the " -"compatibility warning for :class:`importlib.machinery.BuiltinImporter` and :" -"class:`importlib.machinery.ExtensionFileLoader`." +"compatibility warning for :class:`importlib.machinery.BuiltinImporter` " +"and :class:`importlib.machinery.ExtensionFileLoader`." msgstr "" -#: ../../library/importlib.rst:1526 +#: ../../library/importlib.rst:1528 msgid "" "A class method which returns a callable that creates a lazy loader. This is " "meant to be used in situations where the loader is passed by class instead " "of by instance. ::" msgstr "" -#: ../../library/importlib.rst:1531 +#: ../../library/importlib.rst:1533 msgid "" "suffixes = importlib.machinery.SOURCE_SUFFIXES\n" "loader = importlib.machinery.SourceFileLoader\n" @@ -1804,20 +1821,20 @@ msgstr "" "lazy_loader = importlib.util.LazyLoader.factory(loader)\n" "finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes))" -#: ../../library/importlib.rst:1539 +#: ../../library/importlib.rst:1541 msgid "Examples" msgstr "範例" -#: ../../library/importlib.rst:1542 +#: ../../library/importlib.rst:1544 msgid "Importing programmatically" msgstr "" -#: ../../library/importlib.rst:1544 +#: ../../library/importlib.rst:1546 msgid "" "To programmatically import a module, use :func:`importlib.import_module`. ::" msgstr "" -#: ../../library/importlib.rst:1547 +#: ../../library/importlib.rst:1549 msgid "" "import importlib\n" "\n" @@ -1827,23 +1844,23 @@ msgstr "" "\n" "itertools = importlib.import_module('itertools')" -#: ../../library/importlib.rst:1553 +#: ../../library/importlib.rst:1555 msgid "Checking if a module can be imported" msgstr "" -#: ../../library/importlib.rst:1555 +#: ../../library/importlib.rst:1557 msgid "" "If you need to find out if a module can be imported without actually doing " "the import, then you should use :func:`importlib.util.find_spec`." msgstr "" -#: ../../library/importlib.rst:1558 +#: ../../library/importlib.rst:1560 msgid "" -"Note that if ``name`` is a submodule (contains a dot), :func:`importlib.util." -"find_spec` will import the parent module. ::" +"Note that if ``name`` is a submodule (contains a " +"dot), :func:`importlib.util.find_spec` will import the parent module. ::" msgstr "" -#: ../../library/importlib.rst:1562 +#: ../../library/importlib.rst:1564 msgid "" "import importlib.util\n" "import sys\n" @@ -1863,27 +1880,27 @@ msgid "" " print(f\"can't find the {name!r} module\")" msgstr "" -#: ../../library/importlib.rst:1581 +#: ../../library/importlib.rst:1583 msgid "Importing a source file directly" msgstr "" -#: ../../library/importlib.rst:1583 +#: ../../library/importlib.rst:1585 msgid "" "This recipe should be used with caution: it is an approximation of an import " -"statement where the file path is specified directly, rather than :data:`sys." -"path` being searched. Alternatives should first be considered first, such as " -"modifying :data:`sys.path` when a proper module is required, or using :func:" -"`runpy.run_path` when the global namespace resulting from running a Python " -"file is appropriate." +"statement where the file path is specified directly, rather " +"than :data:`sys.path` being searched. Alternatives should first be " +"considered first, such as modifying :data:`sys.path` when a proper module is " +"required, or using :func:`runpy.run_path` when the global namespace " +"resulting from running a Python file is appropriate." msgstr "" -#: ../../library/importlib.rst:1590 +#: ../../library/importlib.rst:1592 msgid "" "To import a Python source file directly from a path, use the following " "recipe::" msgstr "" -#: ../../library/importlib.rst:1592 +#: ../../library/importlib.rst:1594 msgid "" "import importlib.util\n" "import sys\n" @@ -1906,15 +1923,15 @@ msgid "" "json = import_from_path(module_name, file_path)" msgstr "" -#: ../../library/importlib.rst:1614 +#: ../../library/importlib.rst:1616 msgid "Implementing lazy imports" msgstr "" -#: ../../library/importlib.rst:1616 +#: ../../library/importlib.rst:1618 msgid "The example below shows how to implement lazy imports::" msgstr "" -#: ../../library/importlib.rst:1618 +#: ../../library/importlib.rst:1620 msgid "" ">>> import importlib.util\n" ">>> import sys\n" @@ -1934,25 +1951,26 @@ msgid "" "False" msgstr "" -#: ../../library/importlib.rst:1637 +#: ../../library/importlib.rst:1639 msgid "Setting up an importer" msgstr "" -#: ../../library/importlib.rst:1639 +#: ../../library/importlib.rst:1641 msgid "" -"For deep customizations of import, you typically want to implement an :term:" -"`importer`. This means managing both the :term:`finder` and :term:`loader` " -"side of things. For finders there are two flavours to choose from depending " -"on your needs: a :term:`meta path finder` or a :term:`path entry finder`. " -"The former is what you would put on :data:`sys.meta_path` while the latter " -"is what you create using a :term:`path entry hook` on :data:`sys.path_hooks` " -"which works with :data:`sys.path` entries to potentially create a finder. " -"This example will show you how to register your own importers so that import " -"will use them (for creating an importer for yourself, read the documentation " -"for the appropriate classes defined within this package)::" +"For deep customizations of import, you typically want to implement " +"an :term:`importer`. This means managing both the :term:`finder` " +"and :term:`loader` side of things. For finders there are two flavours to " +"choose from depending on your needs: a :term:`meta path finder` or " +"a :term:`path entry finder`. The former is what you would put " +"on :data:`sys.meta_path` while the latter is what you create using " +"a :term:`path entry hook` on :data:`sys.path_hooks` which works " +"with :data:`sys.path` entries to potentially create a finder. This example " +"will show you how to register your own importers so that import will use " +"them (for creating an importer for yourself, read the documentation for the " +"appropriate classes defined within this package)::" msgstr "" -#: ../../library/importlib.rst:1650 +#: ../../library/importlib.rst:1652 msgid "" "import importlib.machinery\n" "import sys\n" @@ -1976,11 +1994,11 @@ msgid "" "sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))" msgstr "" -#: ../../library/importlib.rst:1671 +#: ../../library/importlib.rst:1673 msgid "Approximating :func:`importlib.import_module`" msgstr "" -#: ../../library/importlib.rst:1673 +#: ../../library/importlib.rst:1675 msgid "" "Import itself is implemented in Python code, making it possible to expose " "most of the import machinery through importlib. The following helps " @@ -1988,7 +2006,7 @@ msgid "" "approximate implementation of :func:`importlib.import_module`::" msgstr "" -#: ../../library/importlib.rst:1679 +#: ../../library/importlib.rst:1681 msgid "" "import importlib.util\n" "import sys\n" @@ -2021,11 +2039,11 @@ msgid "" " return module" msgstr "" -#: ../../library/importlib.rst:429 +#: ../../library/importlib.rst:431 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/importlib.rst:429 +#: ../../library/importlib.rst:431 msgid "importlib.abc.InspectLoader.get_source method" msgstr "importlib.abc.InspectLoader.get_source 方法" diff --git a/library/importlib.resources.po b/library/importlib.resources.po index 63b4b181c73..89712e7d8a1 100644 --- a/library/importlib.resources.po +++ b/library/importlib.resources.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-25 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,19 +37,18 @@ msgid "" "\"Resources\" are file-like resources associated with a module or package in " "Python. The resources may be contained directly in a package, within a " "subdirectory contained in that package, or adjacent to modules outside a " -"package. Resources may be text or binary. As a result, a package's Python " -"module sources (.py), compilation artifacts (pycache), and installation " -"artifacts (like :func:`reserved filenames ` in " -"directories) are technically de-facto resources of that package. In " -"practice, however, resources are primarily those non-Python artifacts " -"exposed specifically by the package author." +"package. Resources may be text or binary. As a result, Python module sources " +"(.py) of a package and compilation artifacts (pycache) are technically de-" +"facto resources of that package. In practice, however, resources are " +"primarily those non-Python artifacts exposed specifically by the package " +"author." msgstr "" -#: ../../library/importlib.resources.rst:26 +#: ../../library/importlib.resources.rst:25 msgid "Resources can be opened or read in either binary or text mode." msgstr "" -#: ../../library/importlib.resources.rst:28 +#: ../../library/importlib.resources.rst:27 msgid "" "Resources are roughly akin to files inside directories, though it's " "important to keep in mind that this is just a metaphor. Resources and " @@ -58,7 +57,7 @@ msgid "" "zip file using :py:mod:`zipimport`." msgstr "" -#: ../../library/importlib.resources.rst:36 +#: ../../library/importlib.resources.rst:35 msgid "" "This module provides functionality similar to `pkg_resources `_ `Basic Resource " @@ -68,7 +67,7 @@ msgid "" "consistent semantics." msgstr "" -#: ../../library/importlib.resources.rst:44 +#: ../../library/importlib.resources.rst:43 msgid "" "The standalone backport of this module provides more information on `using " "importlib.resources `_." msgstr "" -#: ../../library/importlib.resources.rst:50 +#: ../../library/importlib.resources.rst:49 msgid "" ":class:`Loaders ` that wish to support resource " "reading should implement a ``get_resource_reader(fullname)`` method as " "specified by :class:`importlib.resources.abc.ResourceReader`." msgstr "" -#: ../../library/importlib.resources.rst:56 +#: ../../library/importlib.resources.rst:55 msgid "" -"Represents an anchor for resources, either a :class:`module object ` or a module name as a string. Defined as ``Union[str, " +"Represents an anchor for resources, either a :class:`module object " +"` or a module name as a string. Defined as ``Union[str, " "ModuleType]``." msgstr "" -#: ../../library/importlib.resources.rst:62 +#: ../../library/importlib.resources.rst:61 msgid "" "Returns a :class:`~importlib.resources.abc.Traversable` object representing " "the resource container (think directory) and its resources (think files). A " "Traversable may contain other containers (think subdirectories)." msgstr "" -#: ../../library/importlib.resources.rst:67 +#: ../../library/importlib.resources.rst:66 msgid "" "*anchor* is an optional :class:`Anchor`. If the anchor is a package, " "resources are resolved from that package. If a module, resources are " @@ -105,16 +104,17 @@ msgid "" "If the anchor is omitted, the caller's module is used." msgstr "" -#: ../../library/importlib.resources.rst:75 +#: ../../library/importlib.resources.rst:74 msgid "" "*package* parameter was renamed to *anchor*. *anchor* can now be a non-" "package module and if omitted will default to the caller's module. *package* " -"is still accepted for compatibility but will raise a :exc:" -"`DeprecationWarning`. Consider passing the anchor positionally or using " -"``importlib_resources >= 5.10`` for a compatible interface on older Pythons." +"is still accepted for compatibility but will raise " +"a :exc:`DeprecationWarning`. Consider passing the anchor positionally or " +"using ``importlib_resources >= 5.10`` for a compatible interface on older " +"Pythons." msgstr "" -#: ../../library/importlib.resources.rst:85 +#: ../../library/importlib.resources.rst:84 msgid "" "Given a :class:`~importlib.resources.abc.Traversable` object representing a " "file or directory, typically from :func:`importlib.resources.files`, return " @@ -122,60 +122,61 @@ msgid "" "manager provides a :class:`pathlib.Path` object." msgstr "" -#: ../../library/importlib.resources.rst:90 +#: ../../library/importlib.resources.rst:89 msgid "" "Exiting the context manager cleans up any temporary file or directory " "created when the resource was extracted from e.g. a zip file." msgstr "" -#: ../../library/importlib.resources.rst:93 +#: ../../library/importlib.resources.rst:92 msgid "" "Use ``as_file`` when the Traversable methods (``read_text``, etc) are " "insufficient and an actual file or directory on the file system is required." msgstr "" -#: ../../library/importlib.resources.rst:99 +#: ../../library/importlib.resources.rst:98 msgid "Added support for *traversable* representing a directory." msgstr "" -#: ../../library/importlib.resources.rst:106 +#: ../../library/importlib.resources.rst:105 msgid "Functional API" msgstr "" -#: ../../library/importlib.resources.rst:108 +#: ../../library/importlib.resources.rst:107 msgid "" "A set of simplified, backwards-compatible helpers is available. These allow " "common operations in a single function call." msgstr "" -#: ../../library/importlib.resources.rst:111 +#: ../../library/importlib.resources.rst:110 msgid "For all the following functions:" msgstr "" -#: ../../library/importlib.resources.rst:113 +#: ../../library/importlib.resources.rst:112 msgid "" -"*anchor* is an :class:`~importlib.resources.Anchor`, as in :func:`~importlib." -"resources.files`. Unlike in ``files``, it may not be omitted." +"*anchor* is an :class:`~importlib.resources.Anchor`, as " +"in :func:`~importlib.resources.files`. Unlike in ``files``, it may not be " +"omitted." msgstr "" -#: ../../library/importlib.resources.rst:117 +#: ../../library/importlib.resources.rst:116 msgid "" "*path_names* are components of a resource's path name, relative to the " "anchor. For example, to get the text of resource named ``info.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:121 +#: ../../library/importlib.resources.rst:120 msgid "importlib.resources.read_text(my_module, \"info.txt\")" msgstr "importlib.resources.read_text(my_module, \"info.txt\")" -#: ../../library/importlib.resources.rst:123 +#: ../../library/importlib.resources.rst:122 msgid "" "Like :meth:`Traversable.joinpath `, The " "individual components should use forward slashes (``/``) as path separators. " "For example, the following are equivalent::" msgstr "" -#: ../../library/importlib.resources.rst:128 +#: ../../library/importlib.resources.rst:127 msgid "" "importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" "importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" @@ -183,14 +184,14 @@ msgstr "" "importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" "importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" -#: ../../library/importlib.resources.rst:131 +#: ../../library/importlib.resources.rst:130 msgid "" "For backward compatibility reasons, functions that read text require an " "explicit *encoding* argument if multiple *path_names* are given. For " "example, to get the text of ``info/chapter1.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:135 +#: ../../library/importlib.resources.rst:134 msgid "" "importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" " encoding='utf-8')" @@ -198,124 +199,124 @@ msgstr "" "importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" " encoding='utf-8')" -#: ../../library/importlib.resources.rst:140 +#: ../../library/importlib.resources.rst:139 msgid "Open the named resource for binary reading." msgstr "" -#: ../../library/importlib.resources.rst:142 -#: ../../library/importlib.resources.rst:185 -#: ../../library/importlib.resources.rst:233 -#: ../../library/importlib.resources.rst:250 -#: ../../library/importlib.resources.rst:268 +#: ../../library/importlib.resources.rst:141 +#: ../../library/importlib.resources.rst:184 +#: ../../library/importlib.resources.rst:232 +#: ../../library/importlib.resources.rst:249 +#: ../../library/importlib.resources.rst:267 msgid "" "See :ref:`the introduction ` for details on " "*anchor* and *path_names*." msgstr "" -#: ../../library/importlib.resources.rst:145 +#: ../../library/importlib.resources.rst:144 msgid "" "This function returns a :class:`~typing.BinaryIO` object, that is, a binary " "stream open for reading." msgstr "" -#: ../../library/importlib.resources.rst:148 -#: ../../library/importlib.resources.rst:172 -#: ../../library/importlib.resources.rst:188 -#: ../../library/importlib.resources.rst:209 -#: ../../library/importlib.resources.rst:236 -#: ../../library/importlib.resources.rst:253 -#: ../../library/importlib.resources.rst:271 +#: ../../library/importlib.resources.rst:147 +#: ../../library/importlib.resources.rst:171 +#: ../../library/importlib.resources.rst:187 +#: ../../library/importlib.resources.rst:208 +#: ../../library/importlib.resources.rst:235 +#: ../../library/importlib.resources.rst:252 +#: ../../library/importlib.resources.rst:270 msgid "This function is roughly equivalent to::" msgstr "這個函式大致等同於: ::" -#: ../../library/importlib.resources.rst:150 +#: ../../library/importlib.resources.rst:149 msgid "files(anchor).joinpath(*path_names).open('rb')" msgstr "files(anchor).joinpath(*path_names).open('rb')" -#: ../../library/importlib.resources.rst:152 -#: ../../library/importlib.resources.rst:192 -#: ../../library/importlib.resources.rst:257 +#: ../../library/importlib.resources.rst:151 +#: ../../library/importlib.resources.rst:191 +#: ../../library/importlib.resources.rst:256 msgid "Multiple *path_names* are accepted." msgstr "多個 *path_names* 是被接受的。" -#: ../../library/importlib.resources.rst:158 +#: ../../library/importlib.resources.rst:157 msgid "" "Open the named resource for text reading. By default, the contents are read " "as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:161 -#: ../../library/importlib.resources.rst:201 +#: ../../library/importlib.resources.rst:160 +#: ../../library/importlib.resources.rst:200 msgid "" "See :ref:`the introduction ` for details on " "*anchor* and *path_names*. *encoding* and *errors* have the same meaning as " "in built-in :func:`open`." msgstr "" -#: ../../library/importlib.resources.rst:165 -#: ../../library/importlib.resources.rst:205 +#: ../../library/importlib.resources.rst:164 +#: ../../library/importlib.resources.rst:204 msgid "" "For backward compatibility reasons, the *encoding* argument must be given " "explicitly if there are multiple *path_names*. This limitation is scheduled " "to be removed in Python 3.15." msgstr "" -#: ../../library/importlib.resources.rst:169 +#: ../../library/importlib.resources.rst:168 msgid "" "This function returns a :class:`~typing.TextIO` object, that is, a text " "stream open for reading." msgstr "" -#: ../../library/importlib.resources.rst:174 +#: ../../library/importlib.resources.rst:173 msgid "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" msgstr "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" -#: ../../library/importlib.resources.rst:176 -#: ../../library/importlib.resources.rst:213 -#: ../../library/importlib.resources.rst:240 +#: ../../library/importlib.resources.rst:175 +#: ../../library/importlib.resources.rst:212 +#: ../../library/importlib.resources.rst:239 msgid "" "Multiple *path_names* are accepted. *encoding* and *errors* must be given as " "keyword arguments." msgstr "" -#: ../../library/importlib.resources.rst:183 +#: ../../library/importlib.resources.rst:182 msgid "Read and return the contents of the named resource as :class:`bytes`." msgstr "以 :class:`bytes` 形式讀取並回傳指定資源的內容。" -#: ../../library/importlib.resources.rst:190 +#: ../../library/importlib.resources.rst:189 msgid "files(anchor).joinpath(*path_names).read_bytes()" msgstr "files(anchor).joinpath(*path_names).read_bytes()" -#: ../../library/importlib.resources.rst:198 +#: ../../library/importlib.resources.rst:197 msgid "" "Read and return the contents of the named resource as :class:`str`. By " "default, the contents are read as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:211 +#: ../../library/importlib.resources.rst:210 msgid "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" msgstr "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" -#: ../../library/importlib.resources.rst:220 +#: ../../library/importlib.resources.rst:219 msgid "" "Provides the path to the *resource* as an actual file system path. This " "function returns a context manager for use in a :keyword:`with` statement. " "The context manager provides a :class:`pathlib.Path` object." msgstr "" -#: ../../library/importlib.resources.rst:224 +#: ../../library/importlib.resources.rst:223 msgid "" "Exiting the context manager cleans up any temporary files created, e.g. when " "the resource needs to be extracted from a zip file." msgstr "" -#: ../../library/importlib.resources.rst:227 +#: ../../library/importlib.resources.rst:226 msgid "" "For example, the :meth:`~pathlib.Path.stat` method requires an actual file " "system path; it can be used like this::" msgstr "" -#: ../../library/importlib.resources.rst:230 +#: ../../library/importlib.resources.rst:229 msgid "" "with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" " result = fspath.stat()" @@ -323,21 +324,21 @@ msgstr "" "with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" " result = fspath.stat()" -#: ../../library/importlib.resources.rst:238 +#: ../../library/importlib.resources.rst:237 msgid "as_file(files(anchor).joinpath(*path_names))" msgstr "as_file(files(anchor).joinpath(*path_names))" -#: ../../library/importlib.resources.rst:247 +#: ../../library/importlib.resources.rst:246 msgid "" "Return ``True`` if the named resource exists, otherwise ``False``. This " "function does not consider directories to be resources." msgstr "" -#: ../../library/importlib.resources.rst:255 +#: ../../library/importlib.resources.rst:254 msgid "files(anchor).joinpath(*path_names).is_file()" msgstr "files(anchor).joinpath(*path_names).is_file()" -#: ../../library/importlib.resources.rst:263 +#: ../../library/importlib.resources.rst:262 msgid "" "Return an iterable over the named items within the package or path. The " "iterable returns names of resources (e.g. files) and non-resources (e.g. " @@ -345,7 +346,7 @@ msgid "" "subdirectories." msgstr "" -#: ../../library/importlib.resources.rst:273 +#: ../../library/importlib.resources.rst:272 msgid "" "for resource in files(anchor).joinpath(*path_names).iterdir():\n" " yield resource.name" @@ -353,7 +354,7 @@ msgstr "" "for resource in files(anchor).joinpath(*path_names).iterdir():\n" " yield resource.name" -#: ../../library/importlib.resources.rst:276 +#: ../../library/importlib.resources.rst:275 msgid "" "Prefer ``iterdir()`` as above, which offers more control over the results " "and richer functionality." diff --git a/library/inspect.po b/library/inspect.po index 4b2f07941bd..b821883c2d9 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -52,10 +52,10 @@ msgstr "" msgid "" "The :func:`getmembers` function retrieves the members of an object such as a " "class or module. The functions whose names begin with \"is\" are mainly " -"provided as convenient choices for the second argument to :func:" -"`getmembers`. They also help you determine when you can expect to find the " -"following special attributes (see :ref:`import-mod-attrs` for module " -"attributes):" +"provided as convenient choices for the second argument " +"to :func:`getmembers`. They also help you determine when you can expect to " +"find the following special attributes (see :ref:`import-mod-attrs` for " +"module attributes):" msgstr "" #: ../../library/inspect.rst:46 @@ -75,19 +75,19 @@ msgid "class" msgstr "" #: ../../library/inspect.rst:48 ../../library/inspect.rst:63 -#: ../../library/inspect.rst:81 ../../library/inspect.rst:261 +#: ../../library/inspect.rst:81 ../../library/inspect.rst:292 msgid "__doc__" msgstr "__doc__" #: ../../library/inspect.rst:48 ../../library/inspect.rst:63 -#: ../../library/inspect.rst:81 ../../library/inspect.rst:261 +#: ../../library/inspect.rst:81 ../../library/inspect.rst:292 msgid "documentation string" msgstr "" #: ../../library/inspect.rst:50 ../../library/inspect.rst:65 -#: ../../library/inspect.rst:83 ../../library/inspect.rst:217 -#: ../../library/inspect.rst:231 ../../library/inspect.rst:244 -#: ../../library/inspect.rst:263 +#: ../../library/inspect.rst:83 ../../library/inspect.rst:248 +#: ../../library/inspect.rst:262 ../../library/inspect.rst:275 +#: ../../library/inspect.rst:294 msgid "__name__" msgstr "__name__" @@ -96,16 +96,16 @@ msgid "name with which this class was defined" msgstr "" #: ../../library/inspect.rst:53 ../../library/inspect.rst:68 -#: ../../library/inspect.rst:86 ../../library/inspect.rst:219 -#: ../../library/inspect.rst:233 ../../library/inspect.rst:246 -#: ../../library/inspect.rst:266 +#: ../../library/inspect.rst:86 ../../library/inspect.rst:250 +#: ../../library/inspect.rst:264 ../../library/inspect.rst:277 +#: ../../library/inspect.rst:297 msgid "__qualname__" msgstr "__qualname__" #: ../../library/inspect.rst:53 ../../library/inspect.rst:68 -#: ../../library/inspect.rst:86 ../../library/inspect.rst:219 -#: ../../library/inspect.rst:233 ../../library/inspect.rst:246 -#: ../../library/inspect.rst:266 +#: ../../library/inspect.rst:86 ../../library/inspect.rst:250 +#: ../../library/inspect.rst:264 ../../library/inspect.rst:277 +#: ../../library/inspect.rst:297 msgid "qualified name" msgstr "" @@ -144,7 +144,7 @@ msgstr "__func__" msgid "function object containing implementation of method" msgstr "" -#: ../../library/inspect.rst:74 ../../library/inspect.rst:268 +#: ../../library/inspect.rst:74 ../../library/inspect.rst:299 msgid "__self__" msgstr "__self__" @@ -260,8 +260,8 @@ msgstr "tb_next" msgid "next inner traceback object (called by this level)" msgstr "" -#: ../../library/inspect.rst:132 ../../library/inspect.rst:221 -#: ../../library/inspect.rst:238 ../../library/inspect.rst:251 +#: ../../library/inspect.rst:132 ../../library/inspect.rst:252 +#: ../../library/inspect.rst:269 ../../library/inspect.rst:282 msgid "frame" msgstr "" @@ -314,277 +314,344 @@ msgid "local namespace seen by this frame" msgstr "" #: ../../library/inspect.rst:153 +msgid "f_generator" +msgstr "" + +#: ../../library/inspect.rst:153 +msgid "" +"returns the generator or coroutine object that owns this frame, or ``None`` " +"if the frame is of a regular function" +msgstr "" + +#: ../../library/inspect.rst:159 msgid "f_trace" msgstr "f_trace" -#: ../../library/inspect.rst:153 +#: ../../library/inspect.rst:159 msgid "tracing function for this frame, or ``None``" msgstr "" -#: ../../library/inspect.rst:156 ../../library/inspect.rst:225 -#: ../../library/inspect.rst:242 ../../library/inspect.rst:255 +#: ../../library/inspect.rst:162 +#, fuzzy +msgid "f_trace_lines" +msgstr "f_trace" + +#: ../../library/inspect.rst:162 +msgid "" +"indicate whether a tracing event is triggered for each source source line" +msgstr "" + +#: ../../library/inspect.rst:167 +#, fuzzy +msgid "f_trace_opcodes" +msgstr "f_trace" + +#: ../../library/inspect.rst:167 +msgid "indicate whether per-opcode events are requested" +msgstr "" + +#: ../../library/inspect.rst:171 +msgid "clear()" +msgstr "" + +#: ../../library/inspect.rst:171 +msgid "used to clear all references to local variables" +msgstr "" + +#: ../../library/inspect.rst:175 ../../library/inspect.rst:256 +#: ../../library/inspect.rst:273 ../../library/inspect.rst:286 msgid "code" msgstr "code(程式碼)" -#: ../../library/inspect.rst:156 +#: ../../library/inspect.rst:175 msgid "co_argcount" msgstr "co_argcount" -#: ../../library/inspect.rst:156 +#: ../../library/inspect.rst:175 msgid "" "number of arguments (not including keyword only arguments, \\* or \\*\\* " "args)" msgstr "" -#: ../../library/inspect.rst:161 +#: ../../library/inspect.rst:180 msgid "co_code" msgstr "co_code" -#: ../../library/inspect.rst:161 +#: ../../library/inspect.rst:180 msgid "string of raw compiled bytecode" msgstr "" -#: ../../library/inspect.rst:164 +#: ../../library/inspect.rst:183 msgid "co_cellvars" msgstr "co_cellvars" -#: ../../library/inspect.rst:164 +#: ../../library/inspect.rst:183 msgid "tuple of names of cell variables (referenced by containing scopes)" msgstr "" -#: ../../library/inspect.rst:168 +#: ../../library/inspect.rst:187 msgid "co_consts" msgstr "co_consts" -#: ../../library/inspect.rst:168 +#: ../../library/inspect.rst:187 msgid "tuple of constants used in the bytecode" msgstr "" -#: ../../library/inspect.rst:171 +#: ../../library/inspect.rst:190 msgid "co_filename" msgstr "co_filename" -#: ../../library/inspect.rst:171 +#: ../../library/inspect.rst:190 msgid "name of file in which this code object was created" msgstr "" -#: ../../library/inspect.rst:175 +#: ../../library/inspect.rst:194 msgid "co_firstlineno" msgstr "co_firstlineno" -#: ../../library/inspect.rst:175 +#: ../../library/inspect.rst:194 msgid "number of first line in Python source code" msgstr "" -#: ../../library/inspect.rst:178 +#: ../../library/inspect.rst:197 msgid "co_flags" msgstr "co_flags" -#: ../../library/inspect.rst:178 +#: ../../library/inspect.rst:197 msgid "" "bitmap of ``CO_*`` flags, read more :ref:`here `" msgstr "" -#: ../../library/inspect.rst:182 +#: ../../library/inspect.rst:201 msgid "co_lnotab" msgstr "co_lnotab" -#: ../../library/inspect.rst:182 +#: ../../library/inspect.rst:201 msgid "encoded mapping of line numbers to bytecode indices" msgstr "" -#: ../../library/inspect.rst:186 +#: ../../library/inspect.rst:205 msgid "co_freevars" msgstr "co_freevars" -#: ../../library/inspect.rst:186 +#: ../../library/inspect.rst:205 msgid "tuple of names of free variables (referenced via a function's closure)" msgstr "" -#: ../../library/inspect.rst:190 +#: ../../library/inspect.rst:209 msgid "co_posonlyargcount" msgstr "co_posonlyargcount" -#: ../../library/inspect.rst:190 +#: ../../library/inspect.rst:209 msgid "number of positional only arguments" msgstr "" -#: ../../library/inspect.rst:193 +#: ../../library/inspect.rst:212 msgid "co_kwonlyargcount" msgstr "co_kwonlyargcount" -#: ../../library/inspect.rst:193 +#: ../../library/inspect.rst:212 msgid "number of keyword only arguments (not including \\*\\* arg)" msgstr "" -#: ../../library/inspect.rst:197 +#: ../../library/inspect.rst:216 msgid "co_name" msgstr "co_name" -#: ../../library/inspect.rst:197 +#: ../../library/inspect.rst:216 msgid "name with which this code object was defined" msgstr "" -#: ../../library/inspect.rst:200 +#: ../../library/inspect.rst:219 msgid "co_qualname" msgstr "co_qualname" -#: ../../library/inspect.rst:200 +#: ../../library/inspect.rst:219 msgid "fully qualified name with which this code object was defined" msgstr "" -#: ../../library/inspect.rst:204 +#: ../../library/inspect.rst:223 msgid "co_names" msgstr "co_names" -#: ../../library/inspect.rst:204 +#: ../../library/inspect.rst:223 msgid "tuple of names other than arguments and function locals" msgstr "" -#: ../../library/inspect.rst:208 +#: ../../library/inspect.rst:227 msgid "co_nlocals" msgstr "co_nlocals" -#: ../../library/inspect.rst:208 +#: ../../library/inspect.rst:227 msgid "number of local variables" msgstr "" -#: ../../library/inspect.rst:210 +#: ../../library/inspect.rst:229 msgid "co_stacksize" msgstr "co_stacksize" -#: ../../library/inspect.rst:210 +#: ../../library/inspect.rst:229 msgid "virtual machine stack space required" msgstr "" -#: ../../library/inspect.rst:213 +#: ../../library/inspect.rst:232 msgid "co_varnames" msgstr "co_varnames" -#: ../../library/inspect.rst:213 +#: ../../library/inspect.rst:232 msgid "tuple of names of arguments and local variables" msgstr "" -#: ../../library/inspect.rst:217 -msgid "generator" +#: ../../library/inspect.rst:236 +msgid "co_lines()" +msgstr "" + +#: ../../library/inspect.rst:236 +msgid "returns an iterator that yields successive bytecode ranges" +msgstr "" + +#: ../../library/inspect.rst:240 +msgid "co_positions()" +msgstr "" + +#: ../../library/inspect.rst:240 +msgid "" +"returns an iterator of source code positions for each bytecode instruction" msgstr "" -#: ../../library/inspect.rst:217 ../../library/inspect.rst:231 #: ../../library/inspect.rst:244 +msgid "replace()" +msgstr "" + +#: ../../library/inspect.rst:244 +msgid "returns a copy of the code object with new values" +msgstr "" + +#: ../../library/inspect.rst:248 +msgid "generator" +msgstr "" + +#: ../../library/inspect.rst:248 ../../library/inspect.rst:262 +#: ../../library/inspect.rst:275 msgid "name" msgstr "" -#: ../../library/inspect.rst:221 +#: ../../library/inspect.rst:252 msgid "gi_frame" msgstr "gi_frame" -#: ../../library/inspect.rst:223 +#: ../../library/inspect.rst:254 msgid "gi_running" msgstr "gi_running" -#: ../../library/inspect.rst:223 ../../library/inspect.rst:240 +#: ../../library/inspect.rst:254 ../../library/inspect.rst:271 msgid "is the generator running?" msgstr "" -#: ../../library/inspect.rst:225 +#: ../../library/inspect.rst:256 msgid "gi_code" msgstr "gi_code" -#: ../../library/inspect.rst:227 +#: ../../library/inspect.rst:258 msgid "gi_yieldfrom" msgstr "gi_yieldfrom" -#: ../../library/inspect.rst:227 +#: ../../library/inspect.rst:258 msgid "object being iterated by ``yield from``, or ``None``" msgstr "" -#: ../../library/inspect.rst:231 +#: ../../library/inspect.rst:262 msgid "async generator" msgstr "" -#: ../../library/inspect.rst:235 +#: ../../library/inspect.rst:266 msgid "ag_await" msgstr "ag_await" -#: ../../library/inspect.rst:235 ../../library/inspect.rst:248 +#: ../../library/inspect.rst:266 ../../library/inspect.rst:279 msgid "object being awaited on, or ``None``" msgstr "" -#: ../../library/inspect.rst:238 +#: ../../library/inspect.rst:269 msgid "ag_frame" msgstr "ag_frame" -#: ../../library/inspect.rst:240 +#: ../../library/inspect.rst:271 msgid "ag_running" msgstr "ag_running" -#: ../../library/inspect.rst:242 +#: ../../library/inspect.rst:273 msgid "ag_code" msgstr "ag_code" -#: ../../library/inspect.rst:244 +#: ../../library/inspect.rst:275 msgid "coroutine" msgstr "coroutine" -#: ../../library/inspect.rst:248 +#: ../../library/inspect.rst:279 msgid "cr_await" msgstr "cr_await" -#: ../../library/inspect.rst:251 +#: ../../library/inspect.rst:282 msgid "cr_frame" msgstr "cr_frame" -#: ../../library/inspect.rst:253 +#: ../../library/inspect.rst:284 msgid "cr_running" msgstr "cr_running" -#: ../../library/inspect.rst:253 +#: ../../library/inspect.rst:284 msgid "is the coroutine running?" msgstr "" -#: ../../library/inspect.rst:255 +#: ../../library/inspect.rst:286 msgid "cr_code" msgstr "cr_code" -#: ../../library/inspect.rst:257 +#: ../../library/inspect.rst:288 msgid "cr_origin" msgstr "cr_origin" -#: ../../library/inspect.rst:257 +#: ../../library/inspect.rst:288 msgid "where coroutine was created, or ``None``. See |coroutine-origin-link|" msgstr "" -#: ../../library/inspect.rst:261 +#: ../../library/inspect.rst:292 msgid "builtin" msgstr "" -#: ../../library/inspect.rst:263 +#: ../../library/inspect.rst:294 msgid "original name of this function or method" msgstr "" -#: ../../library/inspect.rst:268 +#: ../../library/inspect.rst:299 msgid "instance to which a method is bound, or ``None``" msgstr "" -#: ../../library/inspect.rst:275 +#: ../../library/inspect.rst:306 msgid "Add ``__qualname__`` and ``gi_yieldfrom`` attributes to generators." msgstr "將 ``__qualname__`` 和 ``gi_yieldfrom`` 屬性加到產生器。" -#: ../../library/inspect.rst:277 +#: ../../library/inspect.rst:308 msgid "" "The ``__name__`` attribute of generators is now set from the function name, " "instead of the code name, and it can now be modified." msgstr "" -#: ../../library/inspect.rst:282 +#: ../../library/inspect.rst:313 msgid "Add ``cr_origin`` attribute to coroutines." msgstr "新增協程的 ``cr_origin`` 屬性。" -#: ../../library/inspect.rst:286 +#: ../../library/inspect.rst:317 msgid "Add ``__builtins__`` attribute to functions." msgstr "新增函式的 ``__builtins__`` 屬性。" -#: ../../library/inspect.rst:290 +#: ../../library/inspect.rst:321 +#, fuzzy +msgid "Add ``f_generator`` attribute to frames." +msgstr "新增協程的 ``cr_origin`` 屬性。" + +#: ../../library/inspect.rst:325 msgid "" "Return all the members of an object in a list of ``(name, value)`` pairs " "sorted by name. If the optional *predicate* argument—which will be called " @@ -592,14 +659,14 @@ msgid "" "the predicate returns a true value are included." msgstr "" -#: ../../library/inspect.rst:297 +#: ../../library/inspect.rst:332 msgid "" ":func:`getmembers` will only return class attributes defined in the " "metaclass when the argument is a class and those attributes have been listed " "in the metaclass' custom :meth:`~object.__dir__`." msgstr "" -#: ../../library/inspect.rst:304 +#: ../../library/inspect.rst:339 msgid "" "Return all the members of an object in a list of ``(name, value)`` pairs " "sorted by name without triggering dynamic lookup via the descriptor " @@ -607,7 +674,7 @@ msgid "" "that satisfy a given predicate." msgstr "" -#: ../../library/inspect.rst:311 +#: ../../library/inspect.rst:346 msgid "" ":func:`getmembers_static` may not be able to retrieve all members that " "getmembers can fetch (like dynamically created attributes) and may find " @@ -616,7 +683,7 @@ msgid "" "cases." msgstr "" -#: ../../library/inspect.rst:322 +#: ../../library/inspect.rst:357 msgid "" "Return the name of the module named by the file *path*, without including " "the names of enclosing packages. The file extension is checked against all " @@ -625,119 +692,124 @@ msgid "" "``None`` is returned." msgstr "" -#: ../../library/inspect.rst:328 +#: ../../library/inspect.rst:363 msgid "" "Note that this function *only* returns a meaningful name for actual Python " "modules - paths that potentially refer to Python packages will still return " "``None``." msgstr "" -#: ../../library/inspect.rst:332 +#: ../../library/inspect.rst:367 msgid "The function is based directly on :mod:`importlib`." msgstr "此函式直接基於 :mod:`importlib`。" -#: ../../library/inspect.rst:338 +#: ../../library/inspect.rst:373 msgid "Return ``True`` if the object is a module." msgstr "如果物件是模組,則回傳 ``True``。" -#: ../../library/inspect.rst:343 +#: ../../library/inspect.rst:378 msgid "" "Return ``True`` if the object is a class, whether built-in or created in " "Python code." msgstr "" -#: ../../library/inspect.rst:349 +#: ../../library/inspect.rst:384 msgid "Return ``True`` if the object is a bound method written in Python." msgstr "" -#: ../../library/inspect.rst:354 +#: ../../library/inspect.rst:389 +#, fuzzy +msgid "Return ``True`` if the object is a :term:`package`." +msgstr "如果物件是程式碼,則回傳 ``True``。" + +#: ../../library/inspect.rst:396 msgid "" "Return ``True`` if the object is a Python function, which includes functions " "created by a :term:`lambda` expression." msgstr "" -#: ../../library/inspect.rst:360 +#: ../../library/inspect.rst:402 msgid "Return ``True`` if the object is a Python generator function." msgstr "如果物件是 Python 產生器函式,則回傳 ``True``。" -#: ../../library/inspect.rst:362 +#: ../../library/inspect.rst:404 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is a Python generator function." msgstr "" -#: ../../library/inspect.rst:366 +#: ../../library/inspect.rst:408 msgid "" "Functions wrapped in :func:`functools.partialmethod` now return ``True`` if " "the wrapped function is a Python generator function." msgstr "" -#: ../../library/inspect.rst:372 +#: ../../library/inspect.rst:414 msgid "Return ``True`` if the object is a generator." msgstr "如果物件是產生器,則回傳 ``True``。" -#: ../../library/inspect.rst:377 +#: ../../library/inspect.rst:419 msgid "" "Return ``True`` if the object is a :term:`coroutine function` (a function " "defined with an :keyword:`async def` syntax), a :func:`functools.partial` " -"wrapping a :term:`coroutine function`, or a sync function marked with :func:" -"`markcoroutinefunction`." +"wrapping a :term:`coroutine function`, or a sync function marked " +"with :func:`markcoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:384 +#: ../../library/inspect.rst:426 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is a :term:`coroutine function`." msgstr "" -#: ../../library/inspect.rst:388 +#: ../../library/inspect.rst:430 msgid "" "Sync functions marked with :func:`markcoroutinefunction` now return ``True``." msgstr "" -#: ../../library/inspect.rst:392 ../../library/inspect.rst:462 +#: ../../library/inspect.rst:434 ../../library/inspect.rst:504 msgid "" "Functions wrapped in :func:`functools.partialmethod` now return ``True`` if " "the wrapped function is a :term:`coroutine function`." msgstr "" -#: ../../library/inspect.rst:399 +#: ../../library/inspect.rst:441 msgid "" "Decorator to mark a callable as a :term:`coroutine function` if it would not " "otherwise be detected by :func:`iscoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:402 +#: ../../library/inspect.rst:444 msgid "" "This may be of use for sync functions that return a :term:`coroutine`, if " "the function is passed to an API that requires :func:`iscoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:405 +#: ../../library/inspect.rst:447 msgid "" "When possible, using an :keyword:`async def` function is preferred. Also " -"acceptable is calling the function and testing the return with :func:" -"`iscoroutine`." +"acceptable is calling the function and testing the return " +"with :func:`iscoroutine`." msgstr "" -#: ../../library/inspect.rst:414 +#: ../../library/inspect.rst:456 msgid "" -"Return ``True`` if the object is a :term:`coroutine` created by an :keyword:" -"`async def` function." +"Return ``True`` if the object is a :term:`coroutine` created by " +"an :keyword:`async def` function." msgstr "" -#: ../../library/inspect.rst:422 +#: ../../library/inspect.rst:464 msgid "" "Return ``True`` if the object can be used in :keyword:`await` expression." msgstr "" -#: ../../library/inspect.rst:424 +#: ../../library/inspect.rst:466 msgid "" "Can also be used to distinguish generator-based coroutines from regular " "generators:" msgstr "" -#: ../../library/inspect.rst:427 +#: ../../library/inspect.rst:469 msgid "" "import types\n" "\n" @@ -761,13 +833,13 @@ msgstr "" "assert not isawaitable(gen())\n" "assert isawaitable(gen_coro())" -#: ../../library/inspect.rst:445 +#: ../../library/inspect.rst:487 msgid "" "Return ``True`` if the object is an :term:`asynchronous generator` function, " "for example:" msgstr "" -#: ../../library/inspect.rst:448 +#: ../../library/inspect.rst:490 msgid "" ">>> async def agen():\n" "... yield 1\n" @@ -776,65 +848,66 @@ msgid "" "True" msgstr "" -#: ../../library/inspect.rst:458 +#: ../../library/inspect.rst:500 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is an :term:`asynchronous generator` function." msgstr "" -#: ../../library/inspect.rst:468 +#: ../../library/inspect.rst:510 msgid "" "Return ``True`` if the object is an :term:`asynchronous generator iterator` " "created by an :term:`asynchronous generator` function." msgstr "" -#: ../../library/inspect.rst:475 +#: ../../library/inspect.rst:517 msgid "Return ``True`` if the object is a traceback." msgstr "" -#: ../../library/inspect.rst:480 +#: ../../library/inspect.rst:522 msgid "Return ``True`` if the object is a frame." msgstr "" -#: ../../library/inspect.rst:485 +#: ../../library/inspect.rst:527 msgid "Return ``True`` if the object is a code." msgstr "如果物件是程式碼,則回傳 ``True``。" -#: ../../library/inspect.rst:490 +#: ../../library/inspect.rst:532 msgid "" "Return ``True`` if the object is a built-in function or a bound built-in " "method." msgstr "" -#: ../../library/inspect.rst:495 +#: ../../library/inspect.rst:537 msgid "" "Return ``True`` if the type of object is a :class:`~types.MethodWrapperType`." msgstr "" -#: ../../library/inspect.rst:497 +#: ../../library/inspect.rst:539 msgid "" -"These are instances of :class:`~types.MethodWrapperType`, such as :meth:" -"`~object.__str__`, :meth:`~object.__eq__` and :meth:`~object.__repr__`." +"These are instances of :class:`~types.MethodWrapperType`, such " +"as :meth:`~object.__str__`, :meth:`~object.__eq__` " +"and :meth:`~object.__repr__`." msgstr "" -#: ../../library/inspect.rst:505 +#: ../../library/inspect.rst:547 msgid "" "Return ``True`` if the object is a user-defined or built-in function or " "method." msgstr "如果物件是使用者定義或內建的函式或方法,則回傳 ``True``。" -#: ../../library/inspect.rst:510 +#: ../../library/inspect.rst:552 msgid "Return ``True`` if the object is an abstract base class." msgstr "如果物件是抽象基底類別,則回傳 ``True``。" -#: ../../library/inspect.rst:515 +#: ../../library/inspect.rst:557 msgid "" -"Return ``True`` if the object is a method descriptor, but not if :func:" -"`ismethod`, :func:`isclass`, :func:`isfunction` or :func:`isbuiltin` are " -"true." +"Return ``True`` if the object is a method descriptor, but not " +"if :func:`ismethod`, :func:`isclass`, :func:`isfunction` " +"or :func:`isbuiltin` are true." msgstr "" -#: ../../library/inspect.rst:519 +#: ../../library/inspect.rst:561 msgid "" "This, for example, is true of ``int.__add__``. An object passing this test " "has a :meth:`~object.__get__` method, but not a :meth:`~object.__set__` " @@ -843,77 +916,79 @@ msgid "" "sensible, and :attr:`~definition.__doc__` often is." msgstr "" -#: ../../library/inspect.rst:525 +#: ../../library/inspect.rst:567 msgid "" "Methods implemented via descriptors that also pass one of the other tests " "return ``False`` from the :func:`ismethoddescriptor` test, simply because " -"the other tests promise more -- you can, e.g., count on having the :attr:" -"`~method.__func__` attribute (etc) when an object passes :func:`ismethod`." +"the other tests promise more -- you can, e.g., count on having " +"the :attr:`~method.__func__` attribute (etc) when an object " +"passes :func:`ismethod`." msgstr "" -#: ../../library/inspect.rst:531 +#: ../../library/inspect.rst:573 msgid "" -"This function no longer incorrectly reports objects with :meth:`~object." -"__get__` and :meth:`~object.__delete__`, but not :meth:`~object.__set__`, as " -"being method descriptors (such objects are data descriptors, not method " -"descriptors)." +"This function no longer incorrectly reports objects " +"with :meth:`~object.__get__` and :meth:`~object.__delete__`, but " +"not :meth:`~object.__set__`, as being method descriptors (such objects are " +"data descriptors, not method descriptors)." msgstr "" -#: ../../library/inspect.rst:539 +#: ../../library/inspect.rst:581 msgid "Return ``True`` if the object is a data descriptor." msgstr "如果物件是資料描述器,則回傳 ``True``。" -#: ../../library/inspect.rst:541 +#: ../../library/inspect.rst:583 msgid "" -"Data descriptors have a :attr:`~object.__set__` or a :attr:`~object." -"__delete__` method. Examples are properties (defined in Python), getsets, " -"and members. The latter two are defined in C and there are more specific " -"tests available for those types, which is robust across Python " -"implementations. Typically, data descriptors will also have :attr:" -"`~definition.__name__` and :attr:`!__doc__` attributes (properties, getsets, " -"and members have both of these attributes), but this is not guaranteed." +"Data descriptors have a :attr:`~object.__set__` or " +"a :attr:`~object.__delete__` method. Examples are properties (defined in " +"Python), getsets, and members. The latter two are defined in C and there " +"are more specific tests available for those types, which is robust across " +"Python implementations. Typically, data descriptors will also " +"have :attr:`~definition.__name__` and :attr:`!__doc__` attributes " +"(properties, getsets, and members have both of these attributes), but this " +"is not guaranteed." msgstr "" -#: ../../library/inspect.rst:552 +#: ../../library/inspect.rst:594 msgid "Return ``True`` if the object is a getset descriptor." msgstr "" -#: ../../library/inspect.rst:556 +#: ../../library/inspect.rst:598 msgid "" -"getsets are attributes defined in extension modules via :c:type:" -"`PyGetSetDef` structures. For Python implementations without such types, " -"this method will always return ``False``." +"getsets are attributes defined in extension modules " +"via :c:type:`PyGetSetDef` structures. For Python implementations without " +"such types, this method will always return ``False``." msgstr "" -#: ../../library/inspect.rst:563 +#: ../../library/inspect.rst:605 msgid "Return ``True`` if the object is a member descriptor." msgstr "如果物件是成員描述器,則回傳 ``True``。" -#: ../../library/inspect.rst:567 +#: ../../library/inspect.rst:609 msgid "" -"Member descriptors are attributes defined in extension modules via :c:type:" -"`PyMemberDef` structures. For Python implementations without such types, " -"this method will always return ``False``." +"Member descriptors are attributes defined in extension modules " +"via :c:type:`PyMemberDef` structures. For Python implementations without " +"such types, this method will always return ``False``." msgstr "" -#: ../../library/inspect.rst:575 +#: ../../library/inspect.rst:617 msgid "Retrieving source code" msgstr "取得原始碼" -#: ../../library/inspect.rst:579 +#: ../../library/inspect.rst:621 msgid "" -"Get the documentation string for an object, cleaned up with :func:" -"`cleandoc`. If the documentation string for an object is not provided and " -"the object is a class, a method, a property or a descriptor, retrieve the " -"documentation string from the inheritance hierarchy. Return ``None`` if the " -"documentation string is invalid or missing." +"Get the documentation string for an object, cleaned up " +"with :func:`cleandoc`. If the documentation string for an object is not " +"provided and the object is a class, a method, a property or a descriptor, " +"retrieve the documentation string from the inheritance hierarchy. Return " +"``None`` if the documentation string is invalid or missing." msgstr "" -#: ../../library/inspect.rst:585 +#: ../../library/inspect.rst:627 msgid "Documentation strings are now inherited if not overridden." msgstr "" -#: ../../library/inspect.rst:591 +#: ../../library/inspect.rst:633 msgid "" "Return in a single string any lines of comments immediately preceding the " "object's source code (for a class, function, or method), or at the top of " @@ -922,27 +997,27 @@ msgid "" "been defined in C or the interactive shell." msgstr "" -#: ../../library/inspect.rst:600 +#: ../../library/inspect.rst:642 msgid "" "Return the name of the (text or binary) file in which an object was defined. " "This will fail with a :exc:`TypeError` if the object is a built-in module, " "class, or function." msgstr "" -#: ../../library/inspect.rst:607 +#: ../../library/inspect.rst:649 msgid "" "Try to guess which module an object was defined in. Return ``None`` if the " "module cannot be determined." msgstr "" -#: ../../library/inspect.rst:613 +#: ../../library/inspect.rst:655 msgid "" "Return the name of the Python source file in which an object was defined or " "``None`` if no way can be identified to get the source. This will fail with " "a :exc:`TypeError` if the object is a built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:621 +#: ../../library/inspect.rst:663 msgid "" "Return a list of source lines and starting line number for an object. The " "argument may be a module, class, method, function, traceback, frame, or code " @@ -953,13 +1028,13 @@ msgid "" "built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:630 ../../library/inspect.rst:644 +#: ../../library/inspect.rst:672 ../../library/inspect.rst:686 msgid "" ":exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the " "former." msgstr "" -#: ../../library/inspect.rst:637 +#: ../../library/inspect.rst:679 msgid "" "Return the text of the source code for an object. The argument may be a " "module, class, method, function, traceback, frame, or code object. The " @@ -968,13 +1043,13 @@ msgid "" "object is a built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:651 +#: ../../library/inspect.rst:693 msgid "" "Clean up indentation from docstrings that are indented to line up with " "blocks of code." msgstr "" -#: ../../library/inspect.rst:654 +#: ../../library/inspect.rst:696 msgid "" "All leading whitespace is removed from the first line. Any leading " "whitespace that can be uniformly removed from the second line onwards is " @@ -982,22 +1057,22 @@ msgid "" "Also, all tabs are expanded to spaces." msgstr "" -#: ../../library/inspect.rst:663 +#: ../../library/inspect.rst:705 msgid "Introspecting callables with the Signature object" msgstr "" -#: ../../library/inspect.rst:667 +#: ../../library/inspect.rst:709 msgid "" "The :class:`Signature` object represents the call signature of a callable " "object and its return annotation. To retrieve a :class:`!Signature` object, " "use the :func:`!signature` function." msgstr "" -#: ../../library/inspect.rst:674 +#: ../../library/inspect.rst:716 msgid "Return a :class:`Signature` object for the given *callable*:" msgstr "" -#: ../../library/inspect.rst:676 +#: ../../library/inspect.rst:718 msgid "" ">>> from inspect import signature\n" ">>> def foo(a, *, b:int, **kwargs):\n" @@ -1029,57 +1104,68 @@ msgstr "" ">>> sig.parameters['b'].annotation\n" "" -#: ../../library/inspect.rst:693 +#: ../../library/inspect.rst:735 msgid "" "Accepts a wide range of Python callables, from plain functions and classes " "to :func:`functools.partial` objects." msgstr "" -#: ../../library/inspect.rst:696 +#: ../../library/inspect.rst:738 msgid "" -"For objects defined in modules using stringized annotations (``from " -"__future__ import annotations``), :func:`signature` will attempt to " -"automatically un-stringize the annotations using :func:`get_annotations`. " -"The *globals*, *locals*, and *eval_str* parameters are passed into :func:" -"`get_annotations` when resolving the annotations; see the documentation for :" -"func:`get_annotations` for instructions on how to use these parameters." +"If some of the annotations are strings (e.g., because ``from __future__ " +"import annotations`` was used), :func:`signature` will attempt to " +"automatically un-stringize the annotations " +"using :func:`annotationlib.get_annotations`. The *globals*, *locals*, and " +"*eval_str* parameters are passed into :func:`!annotationlib.get_annotations` " +"when resolving the annotations; see the documentation for :func:`!" +"annotationlib.get_annotations` for instructions on how to use these " +"parameters. A member of the :class:`annotationlib.Format` enum can be passed " +"to the *annotation_format* parameter to control the format of the returned " +"annotations. For example, use " +"``annotation_format=annotationlib.Format.STRING`` to return annotations in " +"string format." msgstr "" -#: ../../library/inspect.rst:705 +#: ../../library/inspect.rst:752 msgid "" -"Raises :exc:`ValueError` if no signature can be provided, and :exc:" -"`TypeError` if that type of object is not supported. Also, if the " +"Raises :exc:`ValueError` if no signature can be provided, " +"and :exc:`TypeError` if that type of object is not supported. Also, if the " "annotations are stringized, and *eval_str* is not false, the ``eval()`` " -"call(s) to un-stringize the annotations in :func:`get_annotations` could " -"potentially raise any kind of exception." +"call(s) to un-stringize the annotations " +"in :func:`annotationlib.get_annotations` could potentially raise any kind of " +"exception." msgstr "" -#: ../../library/inspect.rst:711 +#: ../../library/inspect.rst:758 msgid "" -"A slash(/) in the signature of a function denotes that the parameters prior " +"A slash (/) in the signature of a function denotes that the parameters prior " "to it are positional-only. For more info, see :ref:`the FAQ entry on " "positional-only parameters `." msgstr "" -#: ../../library/inspect.rst:715 +#: ../../library/inspect.rst:762 msgid "" "The *follow_wrapped* parameter was added. Pass ``False`` to get a signature " "of *callable* specifically (``callable.__wrapped__`` will not be used to " "unwrap decorated callables.)" msgstr "" -#: ../../library/inspect.rst:721 ../../library/inspect.rst:845 +#: ../../library/inspect.rst:768 ../../library/inspect.rst:904 msgid "The *globals*, *locals*, and *eval_str* parameters were added." msgstr "" -#: ../../library/inspect.rst:726 +#: ../../library/inspect.rst:771 +msgid "The *annotation_format* parameter was added." +msgstr "" + +#: ../../library/inspect.rst:776 msgid "" "Some callables may not be introspectable in certain implementations of " "Python. For example, in CPython, some built-in functions defined in C " "provide no metadata about their arguments." msgstr "" -#: ../../library/inspect.rst:732 +#: ../../library/inspect.rst:782 msgid "" "If the passed object has a :attr:`!__signature__` attribute, we may use it " "to create the signature. The exact semantics are an implementation detail " @@ -1087,14 +1173,14 @@ msgid "" "semantics." msgstr "" -#: ../../library/inspect.rst:740 +#: ../../library/inspect.rst:790 msgid "" "A :class:`!Signature` object represents the call signature of a function and " "its return annotation. For each parameter accepted by the function it " "stores a :class:`Parameter` object in its :attr:`parameters` collection." msgstr "" -#: ../../library/inspect.rst:745 +#: ../../library/inspect.rst:795 msgid "" "The optional *parameters* argument is a sequence of :class:`Parameter` " "objects, which is validated to check that there are no parameters with " @@ -1103,54 +1189,54 @@ msgid "" "defaults follow parameters without defaults." msgstr "" -#: ../../library/inspect.rst:751 +#: ../../library/inspect.rst:801 msgid "" "The optional *return_annotation* argument can be an arbitrary Python object. " "It represents the \"return\" annotation of the callable." msgstr "" -#: ../../library/inspect.rst:754 +#: ../../library/inspect.rst:804 msgid "" ":class:`!Signature` objects are *immutable*. Use :meth:`Signature.replace` " "or :func:`copy.replace` to make a modified copy." msgstr "" -#: ../../library/inspect.rst:757 +#: ../../library/inspect.rst:807 msgid ":class:`!Signature` objects are now picklable and :term:`hashable`." msgstr "" -#: ../../library/inspect.rst:762 +#: ../../library/inspect.rst:812 msgid "A special class-level marker to specify absence of a return annotation." msgstr "" -#: ../../library/inspect.rst:766 +#: ../../library/inspect.rst:816 msgid "" -"An ordered mapping of parameters' names to the corresponding :class:" -"`Parameter` objects. Parameters appear in strict definition order, " -"including keyword-only parameters." +"An ordered mapping of parameters' names to the " +"corresponding :class:`Parameter` objects. Parameters appear in strict " +"definition order, including keyword-only parameters." msgstr "" -#: ../../library/inspect.rst:770 ../../library/inspect.rst:1125 +#: ../../library/inspect.rst:820 ../../library/inspect.rst:1184 msgid "" "Python only explicitly guaranteed that it preserved the declaration order of " "keyword-only parameters as of version 3.7, although in practice this order " "had always been preserved in Python 3." msgstr "" -#: ../../library/inspect.rst:777 +#: ../../library/inspect.rst:827 msgid "" "The \"return\" annotation for the callable. If the callable has no " "\"return\" annotation, this attribute is set to :attr:`Signature.empty`." msgstr "" -#: ../../library/inspect.rst:782 +#: ../../library/inspect.rst:832 msgid "" "Create a mapping from positional and keyword arguments to parameters. " "Returns :class:`BoundArguments` if ``*args`` and ``**kwargs`` match the " "signature, or raises a :exc:`TypeError`." msgstr "" -#: ../../library/inspect.rst:788 +#: ../../library/inspect.rst:838 msgid "" "Works the same way as :meth:`Signature.bind`, but allows the omission of " "some required arguments (mimics :func:`functools.partial` behavior.) " @@ -1158,16 +1244,16 @@ msgid "" "arguments do not match the signature." msgstr "" -#: ../../library/inspect.rst:795 +#: ../../library/inspect.rst:845 msgid "" -"Create a new :class:`Signature` instance based on the instance :meth:" -"`replace` was invoked on. It is possible to pass different *parameters* and/" -"or *return_annotation* to override the corresponding properties of the base " -"signature. To remove ``return_annotation`` from the copied :class:`!" -"Signature`, pass in :attr:`Signature.empty`." +"Create a new :class:`Signature` instance based on the " +"instance :meth:`replace` was invoked on. It is possible to pass different " +"*parameters* and/or *return_annotation* to override the corresponding " +"properties of the base signature. To remove ``return_annotation`` from the " +"copied :class:`!Signature`, pass in :attr:`Signature.empty`." msgstr "" -#: ../../library/inspect.rst:803 +#: ../../library/inspect.rst:853 msgid "" ">>> def test(a, b):\n" "... pass\n" @@ -1185,34 +1271,47 @@ msgstr "" ">>> str(new_sig)\n" "\"(a, b) -> 'new return anno'\"" -#: ../../library/inspect.rst:813 +#: ../../library/inspect.rst:863 msgid "" -":class:`Signature` objects are also supported by the generic function :func:" -"`copy.replace`." +":class:`Signature` objects are also supported by the generic " +"function :func:`copy.replace`." msgstr "" -#: ../../library/inspect.rst:818 +#: ../../library/inspect.rst:868 msgid "Create a string representation of the :class:`Signature` object." msgstr "" -#: ../../library/inspect.rst:820 +#: ../../library/inspect.rst:870 msgid "" "If *max_width* is passed, the method will attempt to fit the signature into " "lines of at most *max_width* characters. If the signature is longer than " "*max_width*, all parameters will be on separate lines." msgstr "" -#: ../../library/inspect.rst:829 +#: ../../library/inspect.rst:875 +msgid "" +"If *quote_annotation_strings* is False, :term:`annotations ` in " +"the signature are displayed without opening and closing quotation marks if " +"they are strings. This is useful if the signature was created with " +"the :attr:`~annotationlib.Format.STRING` format or if ``from __future__ " +"import annotations`` was used." +msgstr "" + +#: ../../library/inspect.rst:883 +msgid "The *unquote_annotations* parameter was added." +msgstr "" + +#: ../../library/inspect.rst:888 msgid "" "Return a :class:`Signature` (or its subclass) object for a given callable " "*obj*." msgstr "" -#: ../../library/inspect.rst:832 +#: ../../library/inspect.rst:891 msgid "This method simplifies subclassing of :class:`Signature`:" msgstr "" -#: ../../library/inspect.rst:834 +#: ../../library/inspect.rst:893 msgid "" "class MySignature(Signature):\n" " pass\n" @@ -1224,129 +1323,130 @@ msgstr "" "sig = MySignature.from_callable(sum)\n" "assert isinstance(sig, MySignature)" -#: ../../library/inspect.rst:841 +#: ../../library/inspect.rst:900 msgid "Its behavior is otherwise identical to that of :func:`signature`." msgstr "" -#: ../../library/inspect.rst:851 +#: ../../library/inspect.rst:910 msgid "" ":class:`!Parameter` objects are *immutable*. Instead of modifying a :class:`!" -"Parameter` object, you can use :meth:`Parameter.replace` or :func:`copy." -"replace` to create a modified copy." +"Parameter` object, you can use :meth:`Parameter.replace` " +"or :func:`copy.replace` to create a modified copy." msgstr "" -#: ../../library/inspect.rst:855 +#: ../../library/inspect.rst:914 msgid "Parameter objects are now picklable and :term:`hashable`." msgstr "" -#: ../../library/inspect.rst:860 +#: ../../library/inspect.rst:919 msgid "" "A special class-level marker to specify absence of default values and " "annotations." msgstr "" -#: ../../library/inspect.rst:865 +#: ../../library/inspect.rst:924 msgid "" "The name of the parameter as a string. The name must be a valid Python " "identifier." msgstr "" -#: ../../library/inspect.rst:870 +#: ../../library/inspect.rst:929 msgid "" "CPython generates implicit parameter names of the form ``.0`` on the code " "objects used to implement comprehensions and generator expressions." msgstr "" -#: ../../library/inspect.rst:874 +#: ../../library/inspect.rst:933 msgid "" "These parameter names are now exposed by this module as names like " "``implicit0``." msgstr "" -#: ../../library/inspect.rst:880 +#: ../../library/inspect.rst:939 msgid "" "The default value for the parameter. If the parameter has no default value, " "this attribute is set to :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:885 +#: ../../library/inspect.rst:944 msgid "" "The annotation for the parameter. If the parameter has no annotation, this " "attribute is set to :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:890 +#: ../../library/inspect.rst:949 msgid "" "Describes how argument values are bound to the parameter. The possible " -"values are accessible via :class:`Parameter` (like ``Parameter." -"KEYWORD_ONLY``), and support comparison and ordering, in the following order:" +"values are accessible via :class:`Parameter` (like " +"``Parameter.KEYWORD_ONLY``), and support comparison and ordering, in the " +"following order:" msgstr "" -#: ../../library/inspect.rst:897 +#: ../../library/inspect.rst:956 msgid "Name" msgstr "名稱" -#: ../../library/inspect.rst:897 +#: ../../library/inspect.rst:956 msgid "Meaning" msgstr "意義" -#: ../../library/inspect.rst:899 +#: ../../library/inspect.rst:958 msgid "*POSITIONAL_ONLY*" msgstr "*POSITIONAL_ONLY*" -#: ../../library/inspect.rst:899 +#: ../../library/inspect.rst:958 msgid "" "Value must be supplied as a positional argument. Positional only parameters " "are those which appear before a ``/`` entry (if present) in a Python " "function definition." msgstr "" -#: ../../library/inspect.rst:904 +#: ../../library/inspect.rst:963 msgid "*POSITIONAL_OR_KEYWORD*" msgstr "*POSITIONAL_OR_KEYWORD*" -#: ../../library/inspect.rst:904 +#: ../../library/inspect.rst:963 msgid "" "Value may be supplied as either a keyword or positional argument (this is " "the standard binding behaviour for functions implemented in Python.)" msgstr "" -#: ../../library/inspect.rst:909 +#: ../../library/inspect.rst:968 msgid "*VAR_POSITIONAL*" msgstr "*VAR_POSITIONAL*" -#: ../../library/inspect.rst:909 +#: ../../library/inspect.rst:968 msgid "" "A tuple of positional arguments that aren't bound to any other parameter. " "This corresponds to a ``*args`` parameter in a Python function definition." msgstr "" -#: ../../library/inspect.rst:914 +#: ../../library/inspect.rst:973 msgid "*KEYWORD_ONLY*" msgstr "*KEYWORD_ONLY*" -#: ../../library/inspect.rst:914 +#: ../../library/inspect.rst:973 msgid "" "Value must be supplied as a keyword argument. Keyword only parameters are " "those which appear after a ``*`` or ``*args`` entry in a Python function " "definition." msgstr "" -#: ../../library/inspect.rst:919 +#: ../../library/inspect.rst:978 msgid "*VAR_KEYWORD*" msgstr "*VAR_KEYWORD*" -#: ../../library/inspect.rst:919 +#: ../../library/inspect.rst:978 msgid "" "A dict of keyword arguments that aren't bound to any other parameter. This " "corresponds to a ``**kwargs`` parameter in a Python function definition." msgstr "" -#: ../../library/inspect.rst:925 +#: ../../library/inspect.rst:984 msgid "Example: print all keyword-only arguments without default values:" msgstr "" -#: ../../library/inspect.rst:927 +#: ../../library/inspect.rst:986 msgid "" ">>> def foo(a, b, *, c, d=10):\n" "... pass\n" @@ -1368,15 +1468,15 @@ msgstr "" "... print('Parameter:', param)\n" "Parameter: c" -#: ../../library/inspect.rst:941 +#: ../../library/inspect.rst:1000 msgid "Describes an enum value of :attr:`Parameter.kind`." msgstr "" -#: ../../library/inspect.rst:945 +#: ../../library/inspect.rst:1004 msgid "Example: print all descriptions of arguments:" msgstr "範例:列印所有引數的描述:" -#: ../../library/inspect.rst:947 +#: ../../library/inspect.rst:1006 msgid "" ">>> def foo(a, b, *, c, d=10):\n" "... pass\n" @@ -1400,7 +1500,7 @@ msgstr "" "keyword-only\n" "keyword-only" -#: ../../library/inspect.rst:962 +#: ../../library/inspect.rst:1021 msgid "" "Create a new :class:`Parameter` instance based on the instance replaced was " "invoked on. To override a :class:`!Parameter` attribute, pass the " @@ -1408,7 +1508,7 @@ msgid "" "a :class:`!Parameter`, pass :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:967 +#: ../../library/inspect.rst:1026 msgid "" ">>> from inspect import Parameter\n" ">>> param = Parameter('foo', Parameter.KEYWORD_ONLY, default=42)\n" @@ -1432,83 +1532,83 @@ msgstr "" ">>> str(param.replace(default=Parameter.empty, annotation='spam'))\n" "\"foo: 'spam'\"" -#: ../../library/inspect.rst:980 +#: ../../library/inspect.rst:1039 msgid "" -":class:`Parameter` objects are also supported by the generic function :func:" -"`copy.replace`." +":class:`Parameter` objects are also supported by the generic " +"function :func:`copy.replace`." msgstr "" -#: ../../library/inspect.rst:983 +#: ../../library/inspect.rst:1042 msgid "" "In Python 3.3 :class:`Parameter` objects were allowed to have ``name`` set " "to ``None`` if their ``kind`` was set to ``POSITIONAL_ONLY``. This is no " "longer permitted." msgstr "" -#: ../../library/inspect.rst:990 +#: ../../library/inspect.rst:1049 msgid "" "Result of a :meth:`Signature.bind` or :meth:`Signature.bind_partial` call. " "Holds the mapping of arguments to the function's parameters." msgstr "" -#: ../../library/inspect.rst:995 +#: ../../library/inspect.rst:1054 msgid "" "A mutable mapping of parameters' names to arguments' values. Contains only " -"explicitly bound arguments. Changes in :attr:`arguments` will reflect in :" -"attr:`args` and :attr:`kwargs`." +"explicitly bound arguments. Changes in :attr:`arguments` will reflect " +"in :attr:`args` and :attr:`kwargs`." msgstr "" -#: ../../library/inspect.rst:999 +#: ../../library/inspect.rst:1058 msgid "" "Should be used in conjunction with :attr:`Signature.parameters` for any " "argument processing purposes." msgstr "" -#: ../../library/inspect.rst:1004 +#: ../../library/inspect.rst:1063 msgid "" "Arguments for which :meth:`Signature.bind` or :meth:`Signature.bind_partial` " -"relied on a default value are skipped. However, if needed, use :meth:" -"`BoundArguments.apply_defaults` to add them." +"relied on a default value are skipped. However, if needed, " +"use :meth:`BoundArguments.apply_defaults` to add them." msgstr "" -#: ../../library/inspect.rst:1009 +#: ../../library/inspect.rst:1068 msgid "" -":attr:`arguments` is now of type :class:`dict`. Formerly, it was of type :" -"class:`collections.OrderedDict`." +":attr:`arguments` is now of type :class:`dict`. Formerly, it was of " +"type :class:`collections.OrderedDict`." msgstr "" -#: ../../library/inspect.rst:1015 +#: ../../library/inspect.rst:1074 msgid "" -"A tuple of positional arguments values. Dynamically computed from the :attr:" -"`arguments` attribute." +"A tuple of positional arguments values. Dynamically computed from " +"the :attr:`arguments` attribute." msgstr "" -#: ../../library/inspect.rst:1020 +#: ../../library/inspect.rst:1079 msgid "" -"A dict of keyword arguments values. Dynamically computed from the :attr:" -"`arguments` attribute. Arguments that can be passed positionally are " -"included in :attr:`args` instead." +"A dict of keyword arguments values. Dynamically computed from " +"the :attr:`arguments` attribute. Arguments that can be passed positionally " +"are included in :attr:`args` instead." msgstr "" -#: ../../library/inspect.rst:1026 +#: ../../library/inspect.rst:1085 msgid "A reference to the parent :class:`Signature` object." msgstr "" -#: ../../library/inspect.rst:1030 +#: ../../library/inspect.rst:1089 msgid "Set default values for missing arguments." msgstr "為遺漏的引數設定預設值。" -#: ../../library/inspect.rst:1032 +#: ../../library/inspect.rst:1091 msgid "" "For variable-positional arguments (``*args``) the default is an empty tuple." msgstr "" -#: ../../library/inspect.rst:1035 +#: ../../library/inspect.rst:1094 msgid "" "For variable-keyword arguments (``**kwargs``) the default is an empty dict." msgstr "" -#: ../../library/inspect.rst:1038 +#: ../../library/inspect.rst:1097 msgid "" ">>> def foo(a, b='ham', *args): pass\n" ">>> ba = inspect.signature(foo).bind('spam')\n" @@ -1522,13 +1622,13 @@ msgstr "" ">>> ba.arguments\n" "{'a': 'spam', 'b': 'ham', 'args': ()}" -#: ../../library/inspect.rst:1048 +#: ../../library/inspect.rst:1107 msgid "" "The :attr:`args` and :attr:`kwargs` properties can be used to invoke " "functions:" msgstr "" -#: ../../library/inspect.rst:1051 +#: ../../library/inspect.rst:1110 msgid "" "def test(a, *, b):\n" " ...\n" @@ -1544,19 +1644,19 @@ msgstr "" "ba = sig.bind(10, b=20)\n" "test(*ba.args, **ba.kwargs)" -#: ../../library/inspect.rst:1063 +#: ../../library/inspect.rst:1122 msgid ":pep:`362` - Function Signature Object." msgstr "" -#: ../../library/inspect.rst:1064 +#: ../../library/inspect.rst:1123 msgid "The detailed specification, implementation details and examples." msgstr "" -#: ../../library/inspect.rst:1070 +#: ../../library/inspect.rst:1129 msgid "Classes and functions" msgstr "類別與函式" -#: ../../library/inspect.rst:1074 +#: ../../library/inspect.rst:1133 msgid "" "Arrange the given list of classes into a hierarchy of nested lists. Where a " "nested list appears, it contains classes derived from the class whose entry " @@ -1567,19 +1667,19 @@ msgid "" "will appear multiple times." msgstr "" -#: ../../library/inspect.rst:1085 +#: ../../library/inspect.rst:1144 msgid "" -"Get the names and default values of a Python function's parameters. A :term:" -"`named tuple` is returned:" +"Get the names and default values of a Python function's parameters. " +"A :term:`named tuple` is returned:" msgstr "" -#: ../../library/inspect.rst:1088 +#: ../../library/inspect.rst:1147 msgid "" "``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, " "annotations)``" msgstr "" -#: ../../library/inspect.rst:1091 +#: ../../library/inspect.rst:1150 msgid "" "*args* is a list of the positional parameter names. *varargs* is the name of " "the ``*`` parameter or ``None`` if arbitrary positional arguments are not " @@ -1594,7 +1694,7 @@ msgid "" "report the function return value annotation (if any)." msgstr "" -#: ../../library/inspect.rst:1106 +#: ../../library/inspect.rst:1165 msgid "" "Note that :func:`signature` and :ref:`Signature Object ` provide the recommended API for callable introspection, and support " @@ -1604,42 +1704,43 @@ msgid "" "``inspect`` module API." msgstr "" -#: ../../library/inspect.rst:1113 +#: ../../library/inspect.rst:1172 msgid "" "This function is now based on :func:`signature`, but still ignores " "``__wrapped__`` attributes and includes the already bound first parameter in " "the signature output for bound methods." msgstr "" -#: ../../library/inspect.rst:1118 +#: ../../library/inspect.rst:1177 msgid "" -"This method was previously documented as deprecated in favour of :func:" -"`signature` in Python 3.5, but that decision has been reversed in order to " -"restore a clearly supported standard interface for single-source Python 2/3 " -"code migrating away from the legacy :func:`getargspec` API." +"This method was previously documented as deprecated in favour " +"of :func:`signature` in Python 3.5, but that decision has been reversed in " +"order to restore a clearly supported standard interface for single-source " +"Python 2/3 code migrating away from the legacy :func:`getargspec` API." msgstr "" -#: ../../library/inspect.rst:1133 +#: ../../library/inspect.rst:1192 msgid "" -"Get information about arguments passed into a particular frame. A :term:" -"`named tuple` ``ArgInfo(args, varargs, keywords, locals)`` is returned. " -"*args* is a list of the argument names. *varargs* and *keywords* are the " -"names of the ``*`` and ``**`` arguments or ``None``. *locals* is the locals " -"dictionary of the given frame." +"Get information about arguments passed into a particular frame. " +"A :term:`named tuple` ``ArgInfo(args, varargs, keywords, locals)`` is " +"returned. *args* is a list of the argument names. *varargs* and *keywords* " +"are the names of the ``*`` and ``**`` arguments or ``None``. *locals* is " +"the locals dictionary of the given frame." msgstr "" -#: ../../library/inspect.rst:1140 ../../library/inspect.rst:1150 +#: ../../library/inspect.rst:1199 ../../library/inspect.rst:1209 msgid "This function was inadvertently marked as deprecated in Python 3.5." msgstr "" -#: ../../library/inspect.rst:1145 +#: ../../library/inspect.rst:1204 msgid "" -"Format a pretty argument spec from the four values returned by :func:" -"`getargvalues`. The format\\* arguments are the corresponding optional " -"formatting functions that are called to turn names and values into strings." +"Format a pretty argument spec from the four values returned " +"by :func:`getargvalues`. The format\\* arguments are the corresponding " +"optional formatting functions that are called to turn names and values into " +"strings." msgstr "" -#: ../../library/inspect.rst:1155 +#: ../../library/inspect.rst:1214 msgid "" "Return a tuple of class cls's base classes, including cls, in method " "resolution order. No class appears more than once in this tuple. Note that " @@ -1647,7 +1748,7 @@ msgid "" "user-defined metatype is in use, cls will be the first element of the tuple." msgstr "" -#: ../../library/inspect.rst:1163 +#: ../../library/inspect.rst:1222 msgid "" "Bind the *args* and *kwds* to the argument names of the Python function or " "method *func*, as if it was called with them. For bound methods, bind also " @@ -1660,7 +1761,7 @@ msgid "" "example:" msgstr "" -#: ../../library/inspect.rst:1172 +#: ../../library/inspect.rst:1231 msgid "" ">>> from inspect import getcallargs\n" ">>> def f(a, b=1, *pos, **named):\n" @@ -1690,11 +1791,11 @@ msgstr "" "...\n" "TypeError: f() missing 1 required positional argument: 'a'" -#: ../../library/inspect.rst:1189 +#: ../../library/inspect.rst:1248 msgid "Use :meth:`Signature.bind` and :meth:`Signature.bind_partial` instead." msgstr "請改用 :meth:`Signature.bind` 與 :meth:`Signature.bind_partial`。" -#: ../../library/inspect.rst:1195 +#: ../../library/inspect.rst:1254 msgid "" "Get the mapping of external name references in a Python function or method " "*func* to their current values. A :term:`named tuple` " @@ -1706,137 +1807,52 @@ msgid "" "builtins." msgstr "" -#: ../../library/inspect.rst:1204 +#: ../../library/inspect.rst:1263 msgid "" ":exc:`TypeError` is raised if *func* is not a Python function or method." msgstr "如果 *func* 不是 Python 函式或方法,則引發 :exc:`TypeError`。" -#: ../../library/inspect.rst:1211 +#: ../../library/inspect.rst:1270 msgid "" -"Get the object wrapped by *func*. It follows the chain of :attr:" -"`__wrapped__` attributes returning the last object in the chain." +"Get the object wrapped by *func*. It follows the chain " +"of :attr:`__wrapped__` attributes returning the last object in the chain." msgstr "" -#: ../../library/inspect.rst:1214 +#: ../../library/inspect.rst:1273 msgid "" "*stop* is an optional callback accepting an object in the wrapper chain as " "its sole argument that allows the unwrapping to be terminated early if the " "callback returns a true value. If the callback never returns a true value, " -"the last object in the chain is returned as usual. For example, :func:" -"`signature` uses this to stop unwrapping if any object in the chain has a " -"``__signature__`` attribute defined." +"the last object in the chain is returned as usual. For " +"example, :func:`signature` uses this to stop unwrapping if any object in the " +"chain has a ``__signature__`` attribute defined." msgstr "" -#: ../../library/inspect.rst:1221 +#: ../../library/inspect.rst:1280 msgid ":exc:`ValueError` is raised if a cycle is encountered." msgstr "如果遇到循環,則引發 :exc:`ValueError`。" -#: ../../library/inspect.rst:1228 +#: ../../library/inspect.rst:1287 msgid "Compute the annotations dict for an object." msgstr "" -#: ../../library/inspect.rst:1230 -msgid "" -"``obj`` may be a callable, class, or module. Passing in an object of any " -"other type raises :exc:`TypeError`." -msgstr "" - -#: ../../library/inspect.rst:1233 -msgid "" -"Returns a dict. ``get_annotations()`` returns a new dict every time it's " -"called; calling it twice on the same object will return two different but " -"equivalent dicts." -msgstr "" - -#: ../../library/inspect.rst:1237 -msgid "This function handles several details for you:" -msgstr "" - -#: ../../library/inspect.rst:1239 -msgid "" -"If ``eval_str`` is true, values of type ``str`` will be un-stringized using :" -"func:`eval`. This is intended for use with stringized annotations (``from " -"__future__ import annotations``)." -msgstr "" - -#: ../../library/inspect.rst:1243 -msgid "" -"If ``obj`` doesn't have an annotations dict, returns an empty dict. " -"(Functions and methods always have an annotations dict; classes, modules, " -"and other types of callables may not.)" -msgstr "" - -#: ../../library/inspect.rst:1247 +#: ../../library/inspect.rst:1289 msgid "" -"Ignores inherited annotations on classes. If a class doesn't have its own " -"annotations dict, returns an empty dict." +"This is an alias for :func:`annotationlib.get_annotations`; see the " +"documentation of that function for more information." msgstr "" -#: ../../library/inspect.rst:1249 +#: ../../library/inspect.rst:1294 msgid "" -"All accesses to object members and dict values are done using ``getattr()`` " -"and ``dict.get()`` for safety." +"This function is now an alias for :func:`annotationlib.get_annotations`. " +"Calling it as ``inspect.get_annotations`` will continue to work." msgstr "" -#: ../../library/inspect.rst:1251 -msgid "Always, always, always returns a freshly created dict." -msgstr "" - -#: ../../library/inspect.rst:1253 -msgid "" -"``eval_str`` controls whether or not values of type ``str`` are replaced " -"with the result of calling :func:`eval` on those values:" -msgstr "" - -#: ../../library/inspect.rst:1256 -msgid "" -"If eval_str is true, :func:`eval` is called on values of type ``str``. (Note " -"that ``get_annotations`` doesn't catch exceptions; if :func:`eval` raises an " -"exception, it will unwind the stack past the ``get_annotations`` call.)" -msgstr "" - -#: ../../library/inspect.rst:1260 -msgid "" -"If eval_str is false (the default), values of type ``str`` are unchanged." -msgstr "" - -#: ../../library/inspect.rst:1262 -msgid "" -"``globals`` and ``locals`` are passed in to :func:`eval`; see the " -"documentation for :func:`eval` for more information. If ``globals`` or " -"``locals`` is ``None``, this function may replace that value with a context-" -"specific default, contingent on ``type(obj)``:" -msgstr "" - -#: ../../library/inspect.rst:1267 -msgid "If ``obj`` is a module, ``globals`` defaults to ``obj.__dict__``." -msgstr "" - -#: ../../library/inspect.rst:1268 -msgid "" -"If ``obj`` is a class, ``globals`` defaults to ``sys.modules[obj.__module__]." -"__dict__`` and ``locals`` defaults to the ``obj`` class namespace." -msgstr "" - -#: ../../library/inspect.rst:1271 -msgid "" -"If ``obj`` is a callable, ``globals`` defaults to :attr:`obj.__globals__ " -"`, although if ``obj`` is a wrapped function (using :" -"func:`functools.update_wrapper`) it is first unwrapped." -msgstr "" - -#: ../../library/inspect.rst:1276 -msgid "" -"Calling ``get_annotations`` is best practice for accessing the annotations " -"dict of any object. See :ref:`annotations-howto` for more information on " -"annotations best practices." -msgstr "" - -#: ../../library/inspect.rst:1286 +#: ../../library/inspect.rst:1302 msgid "The interpreter stack" msgstr "直譯器堆疊" -#: ../../library/inspect.rst:1288 +#: ../../library/inspect.rst:1304 msgid "" "Some of the following functions return :class:`FrameInfo` objects. For " "backwards compatibility these objects allow tuple-like operations on all " @@ -1844,95 +1860,95 @@ msgid "" "may be removed in the future." msgstr "" -#: ../../library/inspect.rst:1297 +#: ../../library/inspect.rst:1313 msgid "The :ref:`frame object ` that the record corresponds to." msgstr "" -#: ../../library/inspect.rst:1301 +#: ../../library/inspect.rst:1317 msgid "" "The file name associated with the code being executed by the frame this " "record corresponds to." msgstr "" -#: ../../library/inspect.rst:1306 +#: ../../library/inspect.rst:1322 msgid "" "The line number of the current line associated with the code being executed " "by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1311 +#: ../../library/inspect.rst:1327 msgid "" "The function name that is being executed by the frame this record " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1315 +#: ../../library/inspect.rst:1331 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1320 ../../library/inspect.rst:1359 +#: ../../library/inspect.rst:1336 ../../library/inspect.rst:1375 msgid "" "The index of the current line being executed in the :attr:`code_context` " "list." msgstr "" -#: ../../library/inspect.rst:1324 +#: ../../library/inspect.rst:1340 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1328 +#: ../../library/inspect.rst:1344 msgid "Return a :term:`named tuple` instead of a :class:`tuple`." msgstr "" -#: ../../library/inspect.rst:1331 +#: ../../library/inspect.rst:1347 msgid "" ":class:`!FrameInfo` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1340 +#: ../../library/inspect.rst:1356 msgid "" "The file name associated with the code being executed by the frame this " "traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1345 +#: ../../library/inspect.rst:1361 msgid "" "The line number of the current line associated with the code being executed " "by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1350 +#: ../../library/inspect.rst:1366 msgid "" "The function name that is being executed by the frame this traceback " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1354 +#: ../../library/inspect.rst:1370 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1363 +#: ../../library/inspect.rst:1379 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1368 +#: ../../library/inspect.rst:1384 msgid "" ":class:`!Traceback` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1375 +#: ../../library/inspect.rst:1391 msgid "" "Keeping references to frame objects, as found in the first element of the " "frame records these functions return, can cause your program to create " @@ -1944,15 +1960,16 @@ msgid "" "consumption which occurs." msgstr "" -#: ../../library/inspect.rst:1383 +#: ../../library/inspect.rst:1399 msgid "" "Though the cycle detector will catch these, destruction of the frames (and " -"local variables) can be made deterministic by removing the cycle in a :" -"keyword:`finally` clause. This is also important if the cycle detector was " -"disabled when Python was compiled or using :func:`gc.disable`. For example::" +"local variables) can be made deterministic by removing the cycle in " +"a :keyword:`finally` clause. This is also important if the cycle detector " +"was disabled when Python was compiled or using :func:`gc.disable`. For " +"example::" msgstr "" -#: ../../library/inspect.rst:1388 +#: ../../library/inspect.rst:1404 msgid "" "def handle_stackframe_without_leak():\n" " frame = inspect.currentframe()\n" @@ -1962,31 +1979,31 @@ msgid "" " del frame" msgstr "" -#: ../../library/inspect.rst:1395 +#: ../../library/inspect.rst:1411 msgid "" "If you want to keep the frame around (for example to print a traceback " "later), you can also break reference cycles by using the :meth:`frame.clear` " "method." msgstr "" -#: ../../library/inspect.rst:1399 +#: ../../library/inspect.rst:1415 msgid "" "The optional *context* argument supported by most of these functions " "specifies the number of lines of context to return, which are centered " "around the current line." msgstr "" -#: ../../library/inspect.rst:1406 +#: ../../library/inspect.rst:1422 msgid "" "Get information about a frame or traceback object. A :class:`Traceback` " "object is returned." msgstr "" -#: ../../library/inspect.rst:1409 +#: ../../library/inspect.rst:1425 msgid "A :class:`Traceback` object is returned instead of a named tuple." msgstr "" -#: ../../library/inspect.rst:1414 +#: ../../library/inspect.rst:1430 msgid "" "Get a list of :class:`FrameInfo` objects for a frame and all outer frames. " "These frames represent the calls that lead to the creation of *frame*. The " @@ -1994,19 +2011,19 @@ msgid "" "represents the outermost call on *frame*'s stack." msgstr "" -#: ../../library/inspect.rst:1419 ../../library/inspect.rst:1434 -#: ../../library/inspect.rst:1460 ../../library/inspect.rst:1475 +#: ../../library/inspect.rst:1435 ../../library/inspect.rst:1450 +#: ../../library/inspect.rst:1476 ../../library/inspect.rst:1491 msgid "" "A list of :term:`named tuples ` ``FrameInfo(frame, filename, " "lineno, function, code_context, index)`` is returned." msgstr "" -#: ../../library/inspect.rst:1424 ../../library/inspect.rst:1439 -#: ../../library/inspect.rst:1465 ../../library/inspect.rst:1480 +#: ../../library/inspect.rst:1440 ../../library/inspect.rst:1455 +#: ../../library/inspect.rst:1481 ../../library/inspect.rst:1496 msgid "A list of :class:`FrameInfo` objects is returned." msgstr "回傳一個 :class:`FrameInfo` 物件串列。" -#: ../../library/inspect.rst:1429 +#: ../../library/inspect.rst:1445 msgid "" "Get a list of :class:`FrameInfo` objects for a traceback's frame and all " "inner frames. These frames represent calls made as a consequence of " @@ -2014,11 +2031,11 @@ msgid "" "represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1444 +#: ../../library/inspect.rst:1460 msgid "Return the frame object for the caller's stack frame." msgstr "" -#: ../../library/inspect.rst:1448 +#: ../../library/inspect.rst:1464 msgid "" "This function relies on Python stack frame support in the interpreter, which " "isn't guaranteed to exist in all implementations of Python. If running in " @@ -2026,14 +2043,14 @@ msgid "" "``None``." msgstr "" -#: ../../library/inspect.rst:1456 +#: ../../library/inspect.rst:1472 msgid "" "Return a list of :class:`FrameInfo` objects for the caller's stack. The " "first entry in the returned list represents the caller; the last entry " "represents the outermost call on the stack." msgstr "" -#: ../../library/inspect.rst:1470 +#: ../../library/inspect.rst:1486 msgid "" "Return a list of :class:`FrameInfo` objects for the stack between the " "current frame and the frame in which an exception currently being handled " @@ -2041,32 +2058,32 @@ msgid "" "entry represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1484 +#: ../../library/inspect.rst:1500 msgid "Fetching attributes statically" msgstr "" -#: ../../library/inspect.rst:1486 +#: ../../library/inspect.rst:1502 msgid "" "Both :func:`getattr` and :func:`hasattr` can trigger code execution when " "fetching or checking for the existence of attributes. Descriptors, like " -"properties, will be invoked and :meth:`~object.__getattr__` and :meth:" -"`~object.__getattribute__` may be called." +"properties, will be invoked and :meth:`~object.__getattr__` " +"and :meth:`~object.__getattribute__` may be called." msgstr "" -#: ../../library/inspect.rst:1492 +#: ../../library/inspect.rst:1508 msgid "" "For cases where you want passive introspection, like documentation tools, " -"this can be inconvenient. :func:`getattr_static` has the same signature as :" -"func:`getattr` but avoids executing code when it fetches attributes." +"this can be inconvenient. :func:`getattr_static` has the same signature " +"as :func:`getattr` but avoids executing code when it fetches attributes." msgstr "" -#: ../../library/inspect.rst:1498 +#: ../../library/inspect.rst:1514 msgid "" "Retrieve attributes without triggering dynamic lookup via the descriptor " "protocol, :meth:`~object.__getattr__` or :meth:`~object.__getattribute__`." msgstr "" -#: ../../library/inspect.rst:1502 +#: ../../library/inspect.rst:1518 msgid "" "Note: this function may not be able to retrieve all attributes that getattr " "can fetch (like dynamically created attributes) and may find attributes that " @@ -2074,27 +2091,27 @@ msgid "" "return descriptors objects instead of instance members." msgstr "" -#: ../../library/inspect.rst:1508 +#: ../../library/inspect.rst:1524 msgid "" "If the instance :attr:`~object.__dict__` is shadowed by another member (for " "example a property) then this function will be unable to find instance " "members." msgstr "" -#: ../../library/inspect.rst:1514 +#: ../../library/inspect.rst:1530 msgid "" ":func:`getattr_static` does not resolve descriptors, for example slot " "descriptors or getset descriptors on objects implemented in C. The " "descriptor object is returned instead of the underlying attribute." msgstr "" -#: ../../library/inspect.rst:1518 +#: ../../library/inspect.rst:1534 msgid "" "You can handle these with code like the following. Note that for arbitrary " "getset descriptors invoking these may trigger code execution::" msgstr "" -#: ../../library/inspect.rst:1522 +#: ../../library/inspect.rst:1538 msgid "" "# example code for resolving the builtin descriptor types\n" "class _foo:\n" @@ -2117,11 +2134,11 @@ msgid "" " pass" msgstr "" -#: ../../library/inspect.rst:1544 +#: ../../library/inspect.rst:1560 msgid "Current State of Generators, Coroutines, and Asynchronous Generators" msgstr "" -#: ../../library/inspect.rst:1546 +#: ../../library/inspect.rst:1562 msgid "" "When implementing coroutine schedulers and for other advanced uses of " "generators, it is useful to determine whether a generator is currently " @@ -2130,32 +2147,32 @@ msgid "" "generator to be determined easily." msgstr "" -#: ../../library/inspect.rst:1554 +#: ../../library/inspect.rst:1570 msgid "Get current state of a generator-iterator." msgstr "" -#: ../../library/inspect.rst:1556 ../../library/inspect.rst:1572 -#: ../../library/inspect.rst:1589 +#: ../../library/inspect.rst:1572 ../../library/inspect.rst:1588 +#: ../../library/inspect.rst:1605 msgid "Possible states are:" msgstr "" -#: ../../library/inspect.rst:1558 +#: ../../library/inspect.rst:1574 msgid "GEN_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1559 +#: ../../library/inspect.rst:1575 msgid "GEN_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1560 +#: ../../library/inspect.rst:1576 msgid "GEN_SUSPENDED: Currently suspended at a yield expression." msgstr "" -#: ../../library/inspect.rst:1561 +#: ../../library/inspect.rst:1577 msgid "GEN_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1567 +#: ../../library/inspect.rst:1583 msgid "" "Get current state of a coroutine object. The function is intended to be " "used with coroutine objects created by :keyword:`async def` functions, but " @@ -2163,55 +2180,55 @@ msgid "" "``cr_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1574 +#: ../../library/inspect.rst:1590 msgid "CORO_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1575 +#: ../../library/inspect.rst:1591 msgid "CORO_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1576 +#: ../../library/inspect.rst:1592 msgid "CORO_SUSPENDED: Currently suspended at an await expression." msgstr "" -#: ../../library/inspect.rst:1577 +#: ../../library/inspect.rst:1593 msgid "CORO_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1583 +#: ../../library/inspect.rst:1599 msgid "" "Get current state of an asynchronous generator object. The function is " -"intended to be used with asynchronous iterator objects created by :keyword:" -"`async def` functions which use the :keyword:`yield` statement, but will " -"accept any asynchronous generator-like object that has ``ag_running`` and " -"``ag_frame`` attributes." +"intended to be used with asynchronous iterator objects created " +"by :keyword:`async def` functions which use the :keyword:`yield` statement, " +"but will accept any asynchronous generator-like object that has " +"``ag_running`` and ``ag_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1591 +#: ../../library/inspect.rst:1607 msgid "AGEN_CREATED: Waiting to start execution." msgstr "AGEN_CREATED: 等待開始執行。" -#: ../../library/inspect.rst:1592 +#: ../../library/inspect.rst:1608 msgid "AGEN_RUNNING: Currently being executed by the interpreter." msgstr "AGEN_RUNNING: 目前正在被直譯器執行。" -#: ../../library/inspect.rst:1593 +#: ../../library/inspect.rst:1609 msgid "AGEN_SUSPENDED: Currently suspended at a yield expression." msgstr "AGEN_SUSPENDED: 目前於 yield 運算式暫停。" -#: ../../library/inspect.rst:1594 +#: ../../library/inspect.rst:1610 msgid "AGEN_CLOSED: Execution has completed." msgstr "AGEN_CLOSED: 執行已完成。" -#: ../../library/inspect.rst:1598 +#: ../../library/inspect.rst:1614 msgid "" "The current internal state of the generator can also be queried. This is " "mostly useful for testing purposes, to ensure that internal state is being " "updated as expected:" msgstr "" -#: ../../library/inspect.rst:1604 +#: ../../library/inspect.rst:1620 msgid "" "Get the mapping of live local variables in *generator* to their current " "values. A dictionary is returned that maps from variable names to values. " @@ -2219,14 +2236,14 @@ msgid "" "generator, and all the same caveats apply." msgstr "" -#: ../../library/inspect.rst:1609 +#: ../../library/inspect.rst:1625 msgid "" "If *generator* is a :term:`generator` with no currently associated frame, " "then an empty dictionary is returned. :exc:`TypeError` is raised if " "*generator* is not a Python generator object." msgstr "" -#: ../../library/inspect.rst:1615 +#: ../../library/inspect.rst:1631 msgid "" "This function relies on the generator exposing a Python stack frame for " "introspection, which isn't guaranteed to be the case in all implementations " @@ -2234,79 +2251,90 @@ msgid "" "dictionary." msgstr "" -#: ../../library/inspect.rst:1624 +#: ../../library/inspect.rst:1640 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for coroutine objects created by :keyword:`async def` functions." msgstr "" -#: ../../library/inspect.rst:1631 +#: ../../library/inspect.rst:1647 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for asynchronous generator objects created by :keyword:`async def` functions " "which use the :keyword:`yield` statement." msgstr "" -#: ../../library/inspect.rst:1641 +#: ../../library/inspect.rst:1657 msgid "Code Objects Bit Flags" msgstr "" -#: ../../library/inspect.rst:1643 +#: ../../library/inspect.rst:1659 msgid "" "Python code objects have a :attr:`~codeobject.co_flags` attribute, which is " "a bitmap of the following flags:" msgstr "" -#: ../../library/inspect.rst:1648 +#: ../../library/inspect.rst:1664 msgid "The code object is optimized, using fast locals." msgstr "" -#: ../../library/inspect.rst:1652 +#: ../../library/inspect.rst:1668 msgid "" "If set, a new dict will be created for the frame's :attr:`~frame.f_locals` " "when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1657 +#: ../../library/inspect.rst:1673 msgid "The code object has a variable positional parameter (``*args``-like)." msgstr "" -#: ../../library/inspect.rst:1661 +#: ../../library/inspect.rst:1677 msgid "The code object has a variable keyword parameter (``**kwargs``-like)." msgstr "" -#: ../../library/inspect.rst:1665 +#: ../../library/inspect.rst:1681 msgid "The flag is set when the code object is a nested function." msgstr "" -#: ../../library/inspect.rst:1669 +#: ../../library/inspect.rst:1685 msgid "" "The flag is set when the code object is a generator function, i.e. a " "generator object is returned when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1674 +#: ../../library/inspect.rst:1690 msgid "" "The flag is set when the code object is a coroutine function. When the code " "object is executed it returns a coroutine object. See :pep:`492` for more " "details." msgstr "" -#: ../../library/inspect.rst:1682 +#: ../../library/inspect.rst:1698 msgid "" "The flag is used to transform generators into generator-based coroutines. " "Generator objects with this flag can be used in ``await`` expression, and " "can ``yield from`` coroutine objects. See :pep:`492` for more details." msgstr "" -#: ../../library/inspect.rst:1691 +#: ../../library/inspect.rst:1707 msgid "" "The flag is set when the code object is an asynchronous generator function. " "When the code object is executed it returns an asynchronous generator " "object. See :pep:`525` for more details." msgstr "" -#: ../../library/inspect.rst:1698 +#: ../../library/inspect.rst:1715 +msgid "" +"The flag is set when there is a docstring for the code object in the source " +"code. If set, it will be the first item in :attr:`~codeobject.co_consts`." +msgstr "" + +#: ../../library/inspect.rst:1723 +msgid "" +"The flag is set when the code object is a function defined in class scope." +msgstr "" + +#: ../../library/inspect.rst:1729 msgid "" "The flags are specific to CPython, and may not be defined in other Python " "implementations. Furthermore, the flags are an implementation detail, and " @@ -2314,39 +2342,39 @@ msgid "" "use public APIs from the :mod:`inspect` module for any introspection needs." msgstr "" -#: ../../library/inspect.rst:1706 +#: ../../library/inspect.rst:1737 msgid "Buffer flags" msgstr "" -#: ../../library/inspect.rst:1710 +#: ../../library/inspect.rst:1741 msgid "" "This is an :class:`enum.IntFlag` that represents the flags that can be " -"passed to the :meth:`~object.__buffer__` method of objects implementing the :" -"ref:`buffer protocol `." +"passed to the :meth:`~object.__buffer__` method of objects implementing " +"the :ref:`buffer protocol `." msgstr "" -#: ../../library/inspect.rst:1714 +#: ../../library/inspect.rst:1745 msgid "The meaning of the flags is explained at :ref:`buffer-request-types`." msgstr "" -#: ../../library/inspect.rst:1741 +#: ../../library/inspect.rst:1772 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/inspect.rst:1743 +#: ../../library/inspect.rst:1774 msgid "" "The :mod:`inspect` module also provides a basic introspection capability " "from the command line." msgstr "" -#: ../../library/inspect.rst:1748 +#: ../../library/inspect.rst:1779 msgid "" "By default, accepts the name of a module and prints the source of that " "module. A class or function within the module can be printed instead by " "appended a colon and the qualified name of the target object." msgstr "" -#: ../../library/inspect.rst:1754 +#: ../../library/inspect.rst:1785 msgid "" "Print information about the specified object rather than the source code" msgstr "" diff --git a/library/io.po b/library/io.po index bbe8863356a..17d1920ef56 100644 --- a/library/io.po +++ b/library/io.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-09-08 15:25+0800\n" "PO-Revision-Date: 2023-12-08 00:08+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -61,23 +61,23 @@ msgstr "" msgid "" "All streams are careful about the type of data you give to them. For " "example giving a :class:`str` object to the :meth:`!write` method of a " -"binary stream will raise a :exc:`TypeError`. So will giving a :class:" -"`bytes` object to the :meth:`!write` method of a text stream." +"binary stream will raise a :exc:`TypeError`. So will giving " +"a :class:`bytes` object to the :meth:`!write` method of a text stream." msgstr "" -"所有的資料串流都會謹慎處理你所提供的資料的型別。舉例來說,提供一個 :class:" -"`str` 物件給二進位資料串流的 :meth:`!write` 方法將會引發 :exc:`TypeError`。同" -"樣地,若提供一個 :class:`bytes` 物件給文字資料串流的 :meth:`!write` 方法,也" -"會引發同樣的錯誤。" +"所有的資料串流都會謹慎處理你所提供的資料的型別。舉例來說,提供一" +"個 :class:`str` 物件給二進位資料串流的 :meth:`!write` 方法將會引" +"發 :exc:`TypeError`。同樣地,若提供一個 :class:`bytes` 物件給文字資料串流" +"的 :meth:`!write` 方法,也會引發同樣的錯誤。" #: ../../library/io.rst:45 msgid "" "Operations that used to raise :exc:`IOError` now raise :exc:`OSError`, " "since :exc:`IOError` is now an alias of :exc:`OSError`." msgstr "" -"原本會引發 :exc:`IOError` 的操作,現在將改成引發 :exc:`OSError`。因為 :exc:" -"`IOError` 現在是 :exc:`OSError` 的別名。" +"原本會引發 :exc:`IOError` 的操作,現在將改成引發 :exc:`OSError`。因" +"為 :exc:`IOError` 現在是 :exc:`OSError` 的別名。" -#: ../../library/io.rst:51 ../../library/io.rst:862 ../../library/io.rst:1158 +#: ../../library/io.rst:51 ../../library/io.rst:867 ../../library/io.rst:1217 msgid "Text I/O" msgstr "文字 I/O" @@ -112,17 +112,24 @@ msgstr "記憶體內的文字資料串流也可以使用 :class:`StringIO` 物 msgid "f = io.StringIO(\"some initial text data\")" msgstr "f = io.StringIO(\"some initial text data\")" -#: ../../library/io.rst:67 +#: ../../library/io.rst:69 msgid "" -"The text stream API is described in detail in the documentation of :class:" -"`TextIOBase`." +"When working with a non-blocking stream, be aware that read operations on " +"text I/O objects might raise a :exc:`BlockingIOError` if the stream cannot " +"perform the operation immediately." +msgstr "" + +#: ../../library/io.rst:73 +msgid "" +"The text stream API is described in detail in the documentation " +"of :class:`TextIOBase`." msgstr "文字資料串流 API 的詳細說明在 :class:`TextIOBase` 文件當中。" -#: ../../library/io.rst:72 ../../library/io.rst:1146 +#: ../../library/io.rst:78 ../../library/io.rst:1205 msgid "Binary I/O" msgstr "二進位 (Binary) I/O" -#: ../../library/io.rst:74 +#: ../../library/io.rst:80 msgid "" "Binary I/O (also called *buffered I/O*) expects :term:`bytes-like objects " "` and produces :class:`bytes` objects. No encoding, " @@ -135,7 +142,7 @@ msgstr "" "行編碼、解碼或者換行字元轉換。這種類型的資料串流可用於各種非文字資料,以及需" "要手動控制對文字資料的處理時。" -#: ../../library/io.rst:80 +#: ../../library/io.rst:86 msgid "" "The easiest way to create a binary stream is with :meth:`open` with ``'b'`` " "in the mode string::" @@ -143,38 +150,38 @@ msgstr "" "建立二進位資料串流最簡單的方法是使用 :meth:`open`,並在 mode 字串中加入 " "``'b'``: ::" -#: ../../library/io.rst:83 +#: ../../library/io.rst:89 msgid "f = open(\"myfile.jpg\", \"rb\")" msgstr "f = open(\"myfile.jpg\", \"rb\")" -#: ../../library/io.rst:85 +#: ../../library/io.rst:91 msgid "" "In-memory binary streams are also available as :class:`BytesIO` objects::" msgstr "記憶體內的二進位資料串流也可以透過 :class:`BytesIO` 物件來建立: ::" -#: ../../library/io.rst:87 +#: ../../library/io.rst:93 msgid "f = io.BytesIO(b\"some initial binary data: \\x00\\x01\")" msgstr "f = io.BytesIO(b\"some initial binary data: \\x00\\x01\")" -#: ../../library/io.rst:89 +#: ../../library/io.rst:95 msgid "" -"The binary stream API is described in detail in the docs of :class:" -"`BufferedIOBase`." +"The binary stream API is described in detail in the docs " +"of :class:`BufferedIOBase`." msgstr "二進位資料串流 API 的詳細說明在 :class:`BufferedIOBase` 文件當中。" -#: ../../library/io.rst:92 +#: ../../library/io.rst:98 msgid "" "Other library modules may provide additional ways to create text or binary " "streams. See :meth:`socket.socket.makefile` for example." msgstr "" -"其它函式庫模組可能提供額外的方法來建立文字或二進位資料串流。例如 :meth:" -"`socket.socket.makefile`。" +"其它函式庫模組可能提供額外的方法來建立文字或二進位資料串流。例" +"如 :meth:`socket.socket.makefile`。" -#: ../../library/io.rst:97 +#: ../../library/io.rst:103 msgid "Raw I/O" msgstr "原始 (Raw) I/O" -#: ../../library/io.rst:99 +#: ../../library/io.rst:105 msgid "" "Raw I/O (also called *unbuffered I/O*) is generally used as a low-level " "building-block for binary and text streams; it is rarely useful to directly " @@ -186,20 +193,20 @@ msgstr "" "用。然而,你可以透過以無緩衝的二進位模式開啟一個檔案來建立一個原始資料串" "流: ::" -#: ../../library/io.rst:104 +#: ../../library/io.rst:110 msgid "f = open(\"myfile.jpg\", \"rb\", buffering=0)" msgstr "f = open(\"myfile.jpg\", \"rb\", buffering=0)" -#: ../../library/io.rst:106 +#: ../../library/io.rst:112 msgid "" "The raw stream API is described in detail in the docs of :class:`RawIOBase`." msgstr "原始串流 API 在 :class:`RawIOBase` 文件中有詳細描述。" -#: ../../library/io.rst:112 +#: ../../library/io.rst:118 msgid "Text Encoding" msgstr "文字編碼" -#: ../../library/io.rst:114 +#: ../../library/io.rst:120 msgid "" "The default encoding of :class:`TextIOWrapper` and :func:`open` is locale-" "specific (:func:`locale.getencoding`)." @@ -207,7 +214,7 @@ msgstr "" ":class:`TextIOWrapper` 和 :func:`open` 預設編碼是根據區域設定的 (locale-" "specific) (:func:`locale.getencoding`)。" -#: ../../library/io.rst:117 +#: ../../library/io.rst:123 msgid "" "However, many developers forget to specify the encoding when opening text " "files encoded in UTF-8 (e.g. JSON, TOML, Markdown, etc...) since most Unix " @@ -218,14 +225,14 @@ msgstr "" "等)時忘記指定編碼,因為多數 Unix 平台預設使用 UTF-8 區域設定。這會導致錯誤," "因為對於大多數 Windows 使用者來說,預設地區編碼並非 UTF-8。舉例來說:" -#: ../../library/io.rst:122 +#: ../../library/io.rst:128 msgid "" "# May not work on Windows when non-ASCII characters in the file.\n" "with open(\"README.md\") as f:\n" " long_description = f.read()" msgstr "" -#: ../../library/io.rst:126 +#: ../../library/io.rst:132 msgid "" "Accordingly, it is highly recommended that you specify the encoding " "explicitly when opening text files. If you want to use UTF-8, pass " @@ -236,76 +243,77 @@ msgstr "" "``encoding=\"utf-8\"``。若想使用目前的地區編碼,Python 3.10 以後的版本支援使" "用 ``encoding=\"locale\"``。" -#: ../../library/io.rst:133 +#: ../../library/io.rst:139 msgid ":ref:`utf8-mode`" msgstr ":ref:`utf8-mode`" -#: ../../library/io.rst:134 +#: ../../library/io.rst:140 msgid "" "Python UTF-8 Mode can be used to change the default encoding to UTF-8 from " "locale-specific encoding." msgstr "在 Python UTF-8 模式下,可以將預設編碼從特定地區編碼改為 UTF-8。" -#: ../../library/io.rst:137 +#: ../../library/io.rst:143 msgid ":pep:`686`" msgstr ":pep:`686`" -#: ../../library/io.rst:138 +#: ../../library/io.rst:144 msgid "Python 3.15 will make :ref:`utf8-mode` default." msgstr "Python 3.15 將預設使用 :ref:`utf8-mode`。" -#: ../../library/io.rst:143 +#: ../../library/io.rst:149 msgid "Opt-in EncodingWarning" msgstr "選擇性加入的編碼警告" -#: ../../library/io.rst:145 +#: ../../library/io.rst:151 msgid "See :pep:`597` for more details." msgstr "更多資訊請見 :pep:`597`。" -#: ../../library/io.rst:148 +#: ../../library/io.rst:154 msgid "" -"To find where the default locale encoding is used, you can enable the :" -"option:`-X warn_default_encoding <-X>` command line option or set the :" -"envvar:`PYTHONWARNDEFAULTENCODING` environment variable, which will emit an :" -"exc:`EncodingWarning` when the default encoding is used." +"To find where the default locale encoding is used, you can enable " +"the :option:`-X warn_default_encoding <-X>` command line option or set " +"the :envvar:`PYTHONWARNDEFAULTENCODING` environment variable, which will " +"emit an :exc:`EncodingWarning` when the default encoding is used." msgstr "" "要找出哪些地方使用到預設的地區編碼,你可以啟用 :option:`-X " -"warn_default_encoding <-X>` 命令列選項,或者設定環境變數 :envvar:" -"`PYTHONWARNDEFAULTENCODING`。當使用到預設編碼時,會引發 :exc:" -"`EncodingWarning`。" +"warn_default_encoding <-X>` 命令列選項,或者設定環境變" +"數 :envvar:`PYTHONWARNDEFAULTENCODING`。當使用到預設編碼時,會引" +"發 :exc:`EncodingWarning`。" -#: ../../library/io.rst:153 +#: ../../library/io.rst:159 msgid "" "If you are providing an API that uses :func:`open` or :class:`TextIOWrapper` " -"and passes ``encoding=None`` as a parameter, you can use :func:" -"`text_encoding` so that callers of the API will emit an :exc:" -"`EncodingWarning` if they don't pass an ``encoding``. However, please " -"consider using UTF-8 by default (i.e. ``encoding=\"utf-8\"``) for new APIs." +"and passes ``encoding=None`` as a parameter, you can " +"use :func:`text_encoding` so that callers of the API will emit " +"an :exc:`EncodingWarning` if they don't pass an ``encoding``. However, " +"please consider using UTF-8 by default (i.e. ``encoding=\"utf-8\"``) for new " +"APIs." msgstr "" "如果你正在提供一個使用 :func:`open` 或 :class:`TextIOWrapper` 且傳遞 " "``encoding=None`` 作為參數的 API,你可以使用 :func:`text_encoding`。如此一來" -"如果 API 的呼叫方沒有傳遞 ``encoding``,呼叫方就會發出一個 :exc:" -"`EncodingWarning`。然而,對於新的 API,請考慮預設使用 UTF-8(即 " +"如果 API 的呼叫方沒有傳遞 ``encoding``,呼叫方就會發出一" +"個 :exc:`EncodingWarning`。然而,對於新的 API,請考慮預設使用 UTF-8(即 " "``encoding=\"utf-8\"``)。" -#: ../../library/io.rst:162 +#: ../../library/io.rst:168 msgid "High-level Module Interface" msgstr "高階模組介面" -#: ../../library/io.rst:166 +#: ../../library/io.rst:172 msgid "" "An int containing the default buffer size used by the module's buffered I/O " -"classes. :func:`open` uses the file's blksize (as obtained by :func:`os." -"stat`) if possible." +"classes. :func:`open` uses the file's blksize (as obtained " +"by :func:`os.stat`) if possible." msgstr "" -"一個包含模組中緩衝 I/O 類別所使用的預設緩衝區大小的整數。若可能的話,:func:" -"`open` 會使用檔案的 blksize (透過 :func:`os.stat` 取得)。" +"一個包含模組中緩衝 I/O 類別所使用的預設緩衝區大小的整數。若可能的" +"話,:func:`open` 會使用檔案的 blksize (透過 :func:`os.stat` 取得)。" -#: ../../library/io.rst:173 +#: ../../library/io.rst:179 msgid "This is an alias for the builtin :func:`open` function." msgstr "這是內建函式 :func:`open` 的別名。" -#: ../../library/io.rst:175 ../../library/io.rst:177 +#: ../../library/io.rst:181 ../../library/io.rst:183 msgid "" "This function raises an :ref:`auditing event ` ``open`` with " "arguments *path*, *mode* and *flags*. The *mode* and *flags* arguments may " @@ -315,7 +323,7 @@ msgstr "" "(auditing event) ` ``open``。*mode* 與 *flags* 引數可能已經被修改或" "者從原始呼叫中被推斷出來。" -#: ../../library/io.rst:184 +#: ../../library/io.rst:190 msgid "" "Opens the provided file with mode ``'rb'``. This function should be used " "when the intent is to treat the contents as executable code." @@ -323,51 +331,52 @@ msgstr "" "以 ``'rb'`` 模式開啟提供的檔案。此函式應用於意圖將內容視為可執行的程式碼的情" "況下。" -#: ../../library/io.rst:187 +#: ../../library/io.rst:193 msgid "*path* should be a :class:`str` and an absolute path." msgstr "*path* 應該要屬於 :class:`str` 類別,且是個絕對路徑。" -#: ../../library/io.rst:189 +#: ../../library/io.rst:195 msgid "" -"The behavior of this function may be overridden by an earlier call to the :c:" -"func:`PyFile_SetOpenCodeHook`. However, assuming that *path* is a :class:" -"`str` and an absolute path, ``open_code(path)`` should always behave the " -"same as ``open(path, 'rb')``. Overriding the behavior is intended for " -"additional validation or preprocessing of the file." +"The behavior of this function may be overridden by an earlier call to " +"the :c:func:`PyFile_SetOpenCodeHook`. However, assuming that *path* is " +"a :class:`str` and an absolute path, ``open_code(path)`` should always " +"behave the same as ``open(path, 'rb')``. Overriding the behavior is intended " +"for additional validation or preprocessing of the file." msgstr "" "這個函式的行為可能會被之前對 :c:func:`PyFile_SetOpenCodeHook` 的呼叫覆寫。然" "而,假設 *path* 是個 :class:`str` 且為絕對路徑,則 ``open_code(path)`` 總是" "與 ``open(path, 'rb')`` 有相同行為。覆寫這個行為是為了對檔案進行額外驗證或預" "處理。" -#: ../../library/io.rst:200 +#: ../../library/io.rst:206 msgid "" -"This is a helper function for callables that use :func:`open` or :class:" -"`TextIOWrapper` and have an ``encoding=None`` parameter." +"This is a helper function for callables that use :func:`open` " +"or :class:`TextIOWrapper` and have an ``encoding=None`` parameter." msgstr "" "這是個輔助函式,適用於使用 :func:`open` 或 :class:`TextIOWrapper` 且具有 " "``encoding=None`` 參數的可呼叫物件。" -#: ../../library/io.rst:203 +#: ../../library/io.rst:209 msgid "" "This function returns *encoding* if it is not ``None``. Otherwise, it " "returns ``\"locale\"`` or ``\"utf-8\"`` depending on :ref:`UTF-8 Mode `." msgstr "" -"若 *encoding* 不為 ``None``,此函式將回傳 *encoding*。否則,將根據 :ref:" -"`UTF-8 Mode ` 回傳 ``\"locale\"`` 或 ``\"utf-8\"``。" +"若 *encoding* 不為 ``None``,此函式將回傳 *encoding*。否則,將根" +"據 :ref:`UTF-8 Mode ` 回傳 ``\"locale\"`` 或 ``\"utf-8\"``。" -#: ../../library/io.rst:207 +#: ../../library/io.rst:213 msgid "" -"This function emits an :class:`EncodingWarning` if :data:`sys.flags." -"warn_default_encoding ` is true and *encoding* is ``None``. " -"*stacklevel* specifies where the warning is emitted. For example::" +"This function emits an :class:`EncodingWarning` " +"if :data:`sys.flags.warn_default_encoding ` is true and " +"*encoding* is ``None``. *stacklevel* specifies where the warning is emitted. " +"For example::" msgstr "" "若 :data:`sys.flags.warn_default_encoding ` 為真,且 *encoding* " "為 ``None``,此函式會發出一個 :class:`EncodingWarning`。*stacklevel* 指定警告" "在哪層發出。範例: ::" -#: ../../library/io.rst:212 +#: ../../library/io.rst:218 msgid "" "def read_text(path, encoding=None):\n" " encoding = io.text_encoding(encoding) # stacklevel=2\n" @@ -379,19 +388,19 @@ msgstr "" " with open(path, encoding) as f:\n" " return f.read()" -#: ../../library/io.rst:217 +#: ../../library/io.rst:223 msgid "" "In this example, an :class:`EncodingWarning` is emitted for the caller of " "``read_text()``." msgstr "" -"在此範例中,對於 ``read_text()`` 的呼叫方會引發一個 :class:" -"`EncodingWarning`。" +"在此範例中,對於 ``read_text()`` 的呼叫方會引發一" +"個 :class:`EncodingWarning`。" -#: ../../library/io.rst:220 +#: ../../library/io.rst:226 msgid "See :ref:`io-text-encoding` for more information." msgstr "更多資訊請見 :ref:`io-text-encoding`。" -#: ../../library/io.rst:224 +#: ../../library/io.rst:230 msgid "" ":func:`text_encoding` returns \"utf-8\" when UTF-8 mode is enabled and " "*encoding* is ``None``." @@ -399,37 +408,37 @@ msgstr "" "當 UTF-8 模式啟用且 *encoding* 為 ``None`` 時,:func:`text_encoding` 會回傳 " "\"utf-8\"。" -#: ../../library/io.rst:231 +#: ../../library/io.rst:237 msgid "" "This is a compatibility alias for the builtin :exc:`BlockingIOError` " "exception." msgstr "這是內建的 :exc:`BlockingIOError` 例外的相容性別名。" -#: ../../library/io.rst:237 +#: ../../library/io.rst:243 msgid "" "An exception inheriting :exc:`OSError` and :exc:`ValueError` that is raised " "when an unsupported operation is called on a stream." msgstr "" -"當在資料串流上呼叫不支援的操作時,會引發繼承自 :exc:`OSError` 與 :exc:" -"`ValueError` 的例外。" +"當在資料串流上呼叫不支援的操作時,會引發繼承自 :exc:`OSError` " +"與 :exc:`ValueError` 的例外。" -#: ../../library/io.rst:243 +#: ../../library/io.rst:249 msgid ":mod:`sys`" msgstr ":mod:`sys`" -#: ../../library/io.rst:244 +#: ../../library/io.rst:250 msgid "" "contains the standard IO streams: :data:`sys.stdin`, :data:`sys.stdout`, " "and :data:`sys.stderr`." msgstr "" -"包含標準的 IO 資料串流::data:`sys.stdin`、:data:`sys.stdout` 以及 :data:" -"`sys.stderr`。" +"包含標準的 IO 資料串流::data:`sys.stdin`、:data:`sys.stdout` 以" +"及 :data:`sys.stderr`。" -#: ../../library/io.rst:249 +#: ../../library/io.rst:255 msgid "Class hierarchy" msgstr "類別階層" -#: ../../library/io.rst:251 +#: ../../library/io.rst:257 msgid "" "The implementation of I/O streams is organized as a hierarchy of classes. " "First :term:`abstract base classes ` (ABCs), which are " @@ -440,18 +449,18 @@ msgstr "" "base classes ` (抽象基底類別,ABCs),它們被用來規範各" "種不同類型的串流,接著具體類別會提供標準串流的實作。" -#: ../../library/io.rst:258 +#: ../../library/io.rst:264 msgid "" "The abstract base classes also provide default implementations of some " "methods in order to help implementation of concrete stream classes. For " -"example, :class:`BufferedIOBase` provides unoptimized implementations of :" -"meth:`!readinto` and :meth:`!readline`." +"example, :class:`BufferedIOBase` provides unoptimized implementations " +"of :meth:`!readinto` and :meth:`!readline`." msgstr "" -"為了協助具體串流類別的實作,抽象基底類別提供了某些方法的預設實作。舉例來說,:" -"class:`BufferedIOBase` 提供未經最佳化的 :meth:`!readinto` 與 :meth:`!" +"為了協助具體串流類別的實作,抽象基底類別提供了某些方法的預設實作。舉例來" +"說,:class:`BufferedIOBase` 提供未經最佳化的 :meth:`!readinto` 與 :meth:`!" "readline` 實作。" -#: ../../library/io.rst:263 +#: ../../library/io.rst:269 msgid "" "At the top of the I/O hierarchy is the abstract base class :class:`IOBase`. " "It defines the basic interface to a stream. Note, however, that there is no " @@ -463,34 +472,37 @@ msgstr "" "面。然而,請注意,讀取串流與寫入串流之間並沒有分離;若不支援給定的操作,實作" "是允許引發 :exc:`UnsupportedOperation` 例外的。" -#: ../../library/io.rst:268 +#: ../../library/io.rst:274 msgid "" "The :class:`RawIOBase` ABC extends :class:`IOBase`. It deals with the " -"reading and writing of bytes to a stream. :class:`FileIO` subclasses :class:" -"`RawIOBase` to provide an interface to files in the machine's file system." +"reading and writing of bytes to a stream. :class:`FileIO` " +"subclasses :class:`RawIOBase` to provide an interface to files in the " +"machine's file system." msgstr "" "抽象基底類別 :class:`RawIOBase` 繼承 :class:`IOBase`。此類別處理對串流的位元" "組讀寫。:class:`FileIO` 則繼承 :class:`RawIOBase` 來提供一個介面以存取機器檔" "案系統內的檔案。" -#: ../../library/io.rst:272 +#: ../../library/io.rst:278 msgid "" "The :class:`BufferedIOBase` ABC extends :class:`IOBase`. It deals with " -"buffering on a raw binary stream (:class:`RawIOBase`). Its subclasses, :" -"class:`BufferedWriter`, :class:`BufferedReader`, and :class:`BufferedRWPair` " -"buffer raw binary streams that are writable, readable, and both readable and " -"writable, respectively. :class:`BufferedRandom` provides a buffered " -"interface to seekable streams. Another :class:`BufferedIOBase` subclass, :" -"class:`BytesIO`, is a stream of in-memory bytes." +"buffering on a raw binary stream (:class:`RawIOBase`). Its " +"subclasses, :class:`BufferedWriter`, :class:`BufferedReader`, " +"and :class:`BufferedRWPair` buffer raw binary streams that are writable, " +"readable, and both readable and writable, " +"respectively. :class:`BufferedRandom` provides a buffered interface to " +"seekable streams. Another :class:`BufferedIOBase` " +"subclass, :class:`BytesIO`, is a stream of in-memory bytes." msgstr "" "抽象基底類別 :class:`BufferedIOBase` 繼承 :class:`IOBase`。此類別緩衝原始二進" -"位串流 (:class:`RawIOBase`)。它的子類別 :class:`BufferedWriter`、:class:" -"`BufferedReader` 與 :class:`BufferedRWPair` 分別緩衝可寫、可讀、可讀也可寫的" -"的原始二進位串流。類別 :class:`BufferedRandom` 則提供一個對可搜尋串流 " -"(seekable stream) 的緩衝介面。另一個類別 :class:`BufferedIOBase` 的子類別 :" -"class:`BytesIO`,是一個記憶體內位元組串流。" +"位串流 (:class:`RawIOBase`)。它的子類" +"別 :class:`BufferedWriter`、:class:`BufferedReader` " +"與 :class:`BufferedRWPair` 分別緩衝可寫、可讀、可讀也可寫的的原始二進位串流。" +"類別 :class:`BufferedRandom` 則提供一個對可搜尋串流 (seekable stream) 的緩衝" +"介面。另一個類別 :class:`BufferedIOBase` 的子類別 :class:`BytesIO`,是一個記" +"憶體內位元組串流。" -#: ../../library/io.rst:280 +#: ../../library/io.rst:286 msgid "" "The :class:`TextIOBase` ABC extends :class:`IOBase`. It deals with streams " "whose bytes represent text, and handles encoding and decoding to and from " @@ -499,47 +511,47 @@ msgid "" "Finally, :class:`StringIO` is an in-memory stream for text." msgstr "" "抽象基底類別 :class:`TextIOBase` 繼承 :class:`IOBase`。此類別處理文本位元組串" -"流,並處理字串的編碼和解碼。類別 :class:`TextIOWrapper` 繼承自 :class:" -"`TextIOBase`,這是個對緩衝原始串流 (:class:`BufferedIOBase`) 的緩衝文本介面。" -"最後,:class:`StringIO` 是個文字記憶體內串流。" +"流,並處理字串的編碼和解碼。類別 :class:`TextIOWrapper` 繼承" +"自 :class:`TextIOBase`,這是個對緩衝原始串流 (:class:`BufferedIOBase`) 的緩衝" +"文本介面。最後,:class:`StringIO` 是個文字記憶體內串流。" -#: ../../library/io.rst:286 +#: ../../library/io.rst:292 msgid "" -"Argument names are not part of the specification, and only the arguments of :" -"func:`open` are intended to be used as keyword arguments." +"Argument names are not part of the specification, and only the arguments " +"of :func:`open` are intended to be used as keyword arguments." msgstr "引數名稱不是規範的一部份,只有 :func:`open` 的引數將作為關鍵字引數。" -#: ../../library/io.rst:289 +#: ../../library/io.rst:295 msgid "" "The following table summarizes the ABCs provided by the :mod:`io` module:" msgstr "以下表格總結了 :mod:`io` 模組提供的抽象基底類別 (ABC):" -#: ../../library/io.rst:294 +#: ../../library/io.rst:300 msgid "ABC" msgstr "抽象基底類別 (ABC)" -#: ../../library/io.rst:294 +#: ../../library/io.rst:300 msgid "Inherits" msgstr "繼承" -#: ../../library/io.rst:294 +#: ../../library/io.rst:300 msgid "Stub Methods" msgstr "Stub 方法" -#: ../../library/io.rst:294 +#: ../../library/io.rst:300 msgid "Mixin Methods and Properties" msgstr "Mixin 方法與屬性" -#: ../../library/io.rst:296 ../../library/io.rst:301 ../../library/io.rst:303 -#: ../../library/io.rst:305 +#: ../../library/io.rst:302 ../../library/io.rst:307 ../../library/io.rst:309 +#: ../../library/io.rst:311 msgid ":class:`IOBase`" msgstr ":class:`IOBase`" -#: ../../library/io.rst:296 +#: ../../library/io.rst:302 msgid "``fileno``, ``seek``, and ``truncate``" msgstr "``fileno``、``seek`` 和 ``truncate``" -#: ../../library/io.rst:296 +#: ../../library/io.rst:302 msgid "" "``close``, ``closed``, ``__enter__``, ``__exit__``, ``flush``, ``isatty``, " "``__iter__``, ``__next__``, ``readable``, ``readline``, ``readlines``, " @@ -549,53 +561,53 @@ msgstr "" "``__iter__``、``__next__``、``readable``、``readline``、``readlines``、" "``seekable``、``tell``、``writable`` 與 ``writelines``" -#: ../../library/io.rst:301 +#: ../../library/io.rst:307 msgid ":class:`RawIOBase`" msgstr ":class:`RawIOBase`" -#: ../../library/io.rst:301 +#: ../../library/io.rst:307 msgid "``readinto`` and ``write``" msgstr "``readinto`` 和 ``write``" -#: ../../library/io.rst:301 +#: ../../library/io.rst:307 msgid "Inherited :class:`IOBase` methods, ``read``, and ``readall``" msgstr "繼承自 :class:`IOBase` 的方法,``read`` 與 ``readall``" -#: ../../library/io.rst:303 +#: ../../library/io.rst:309 msgid ":class:`BufferedIOBase`" msgstr ":class:`BufferedIOBase`" -#: ../../library/io.rst:303 +#: ../../library/io.rst:309 msgid "``detach``, ``read``, ``read1``, and ``write``" msgstr "``detach``、``read``、``read1`` 和 ``write``" -#: ../../library/io.rst:303 +#: ../../library/io.rst:309 msgid "Inherited :class:`IOBase` methods, ``readinto``, and ``readinto1``" msgstr "繼承自 :class:`IOBase` 的方法,``readinto`` 與 ``readinto1``" -#: ../../library/io.rst:305 +#: ../../library/io.rst:311 msgid ":class:`TextIOBase`" msgstr ":class:`TextIOBase`" -#: ../../library/io.rst:305 +#: ../../library/io.rst:311 msgid "``detach``, ``read``, ``readline``, and ``write``" msgstr "``detach``、``read``、``readline`` 和 ``write``" -#: ../../library/io.rst:305 +#: ../../library/io.rst:311 msgid "" "Inherited :class:`IOBase` methods, ``encoding``, ``errors``, and ``newlines``" msgstr "" "繼承自 :class:`IOBase` 的方法,``encoding``、``errors`` 與 ``newlines``" -#: ../../library/io.rst:312 +#: ../../library/io.rst:318 msgid "I/O Base Classes" msgstr "I/O 基礎類別" -#: ../../library/io.rst:316 +#: ../../library/io.rst:322 msgid "The abstract base class for all I/O classes." msgstr "所有 I/O 類別的抽象基礎類別。" -#: ../../library/io.rst:318 +#: ../../library/io.rst:324 msgid "" "This class provides empty abstract implementations for many methods that " "derived classes can override selectively; the default implementations " @@ -604,7 +616,7 @@ msgstr "" "為許多方法提供了空的抽象實作,衍生類別可以選擇性地覆寫這些方法;預設的實作代" "表一個無法讀取、寫入或搜尋的檔案。" -#: ../../library/io.rst:323 +#: ../../library/io.rst:329 msgid "" "Even though :class:`IOBase` does not declare :meth:`!read` or :meth:`!write` " "because their signatures will vary, implementations and clients should " @@ -612,19 +624,20 @@ msgid "" "raise a :exc:`ValueError` (or :exc:`UnsupportedOperation`) when operations " "they do not support are called." msgstr "" -"即使 :class:`IOBase` 因為實作的簽名差異巨大而沒有宣告 :meth:`!read` 或 :meth:" -"`!write` 方法,實作與用戶端應把這些方法視為介面的一部份。此外,當呼叫不被它們" -"支援的操作時,可能會引發 :exc:`ValueError` (或 :exc:`UnsupportedOperation`)" -"例外。" +"即使 :class:`IOBase` 因為實作的簽名差異巨大而沒有宣告 :meth:`!read` " +"或 :meth:`!write` 方法,實作與用戶端應把這些方法視為介面的一部份。此外,當呼" +"叫不被它們支援的操作時,可能會引發 :exc:`ValueError` " +"(或 :exc:`UnsupportedOperation`)例外。" -#: ../../library/io.rst:329 +#: ../../library/io.rst:335 msgid "" -"The basic type used for binary data read from or written to a file is :class:" -"`bytes`. Other :term:`bytes-like objects ` are accepted " -"as method arguments too. Text I/O classes work with :class:`str` data." +"The basic type used for binary data read from or written to a file " +"is :class:`bytes`. Other :term:`bytes-like objects ` are " +"accepted as method arguments too. Text I/O classes work with :class:`str` " +"data." msgstr "" -#: ../../library/io.rst:333 +#: ../../library/io.rst:339 msgid "" "Note that calling any method (even inquiries) on a closed stream is " "undefined. Implementations may raise :exc:`ValueError` in this case." @@ -632,7 +645,7 @@ msgstr "" "請注意,在一個已經關閉的串流上呼叫任何方法(即使只是查詢)都是未定義的。在這" "種情況下,實作可能會引發 :exc:`ValueError` 例外。" -#: ../../library/io.rst:336 +#: ../../library/io.rst:342 msgid "" ":class:`IOBase` (and its subclasses) supports the iterator protocol, meaning " "that an :class:`IOBase` object can be iterated over yielding the lines in a " @@ -641,16 +654,17 @@ msgid "" "character strings). See :meth:`~IOBase.readline` below." msgstr "" -#: ../../library/io.rst:342 +#: ../../library/io.rst:348 msgid "" -":class:`IOBase` is also a context manager and therefore supports the :" -"keyword:`with` statement. In this example, *file* is closed after the :" -"keyword:`!with` statement's suite is finished---even if an exception occurs::" +":class:`IOBase` is also a context manager and therefore supports " +"the :keyword:`with` statement. In this example, *file* is closed after " +"the :keyword:`!with` statement's suite is finished---even if an exception " +"occurs::" msgstr "" ":class:`IOBase` 也是個情境管理器,因此支援 :keyword:`with` 陳述式。在這個例子" "中,*file* 會在 :keyword:`!with` 陳述式執行完畢後關閉——即使發生了異常。" -#: ../../library/io.rst:346 +#: ../../library/io.rst:352 msgid "" "with open('spam.txt', 'w') as file:\n" " file.write('Spam and eggs!')" @@ -658,11 +672,11 @@ msgstr "" "with open('spam.txt', 'w') as file:\n" " file.write('Spam and eggs!')" -#: ../../library/io.rst:349 +#: ../../library/io.rst:355 msgid ":class:`IOBase` provides these data attributes and methods:" msgstr ":class:`IOBase` 提供這些資料屬性與方法:" -#: ../../library/io.rst:353 +#: ../../library/io.rst:359 msgid "" "Flush and close this stream. This method has no effect if the file is " "already closed. Once the file is closed, any operation on the file (e.g. " @@ -671,17 +685,17 @@ msgstr "" "清除並關閉這個串流。若檔案已經關閉,則此方法沒有作用。一旦檔案被關閉,任何對" "檔案的操作(例如讀取或寫入)將引發 :exc:`ValueError` 異常。" -#: ../../library/io.rst:357 +#: ../../library/io.rst:363 msgid "" "As a convenience, it is allowed to call this method more than once; only the " "first call, however, will have an effect." msgstr "為了方便起見,允許多次呼叫這個方法;然而,只有第一次呼叫會有效果。" -#: ../../library/io.rst:362 +#: ../../library/io.rst:368 msgid "``True`` if the stream is closed." msgstr "如果串流已關閉,則為 ``True``。" -#: ../../library/io.rst:366 +#: ../../library/io.rst:372 msgid "" "Return the underlying file descriptor (an integer) of the stream if it " "exists. An :exc:`OSError` is raised if the IO object does not use a file " @@ -690,7 +704,7 @@ msgstr "" "如果串流存在,則回傳其底層的檔案描述器(一個整數)。如果 IO 物件不使用檔案描" "述器,則會引發一個 :exc:`OSError` 例外。" -#: ../../library/io.rst:372 +#: ../../library/io.rst:378 msgid "" "Flush the write buffers of the stream if applicable. This does nothing for " "read-only and non-blocking streams." @@ -698,13 +712,13 @@ msgstr "" "如果適用,清空串流的寫入緩衝區。對於唯讀和非阻塞串流,此操作不會執行任何操" "作。" -#: ../../library/io.rst:377 +#: ../../library/io.rst:383 msgid "" "Return ``True`` if the stream is interactive (i.e., connected to a terminal/" "tty device)." msgstr "如果串流是互動式的(即連接到終端機/tty 設備),則回傳 ``True``。" -#: ../../library/io.rst:382 +#: ../../library/io.rst:388 msgid "" "Return ``True`` if the stream can be read from. If ``False``, :meth:`!read` " "will raise :exc:`OSError`." @@ -712,13 +726,13 @@ msgstr "" "如果串流可以被讀取,則回傳 ``True``。如果是 ``False``,:meth:`!read` 將會引" "發 :exc:`OSError` 例外。" -#: ../../library/io.rst:387 +#: ../../library/io.rst:393 msgid "" "Read and return one line from the stream. If *size* is specified, at most " "*size* bytes will be read." msgstr "從串流讀取並回傳一行。如果指定了 *size*,則最多讀取 *size* 個位元組。" -#: ../../library/io.rst:390 +#: ../../library/io.rst:396 msgid "" "The line terminator is always ``b'\\n'`` for binary files; for text files, " "the *newline* argument to :func:`open` can be used to select the line " @@ -727,7 +741,7 @@ msgstr "" "對於二進位檔案,行結束符總是 ``b'\\n'``;對於文字檔案,可以使用 :func:`open` " "函式的 *newline* 引數來選擇識別的行結束符號。" -#: ../../library/io.rst:396 +#: ../../library/io.rst:402 msgid "" "Read and return a list of lines from the stream. *hint* can be specified to " "control the number of lines read: no more lines will be read if the total " @@ -737,12 +751,12 @@ msgstr "" "果到目前為止所有行的總大小(以位元組/字元計)超過 *hint*,則不會再讀取更多" "行。" -#: ../../library/io.rst:400 +#: ../../library/io.rst:406 msgid "" "*hint* values of ``0`` or less, as well as ``None``, are treated as no hint." msgstr "*hint* 值為 ``0`` 或更小,以及 ``None``,都被視為沒有提供 hint。" -#: ../../library/io.rst:403 +#: ../../library/io.rst:409 msgid "" "Note that it's already possible to iterate on file objects using ``for line " "in file: ...`` without calling :meth:`!file.readlines`." @@ -750,7 +764,7 @@ msgstr "" "請注意,已經可以使用 ``for line in file: ...`` 在檔案物件上進行疊代,而不一定" "需要呼叫 :meth:`!file.readlines`。" -#: ../../library/io.rst:408 +#: ../../library/io.rst:414 msgid "" "Change the stream position to the given byte *offset*, interpreted relative " "to the position indicated by *whence*, and return the new absolute position. " @@ -759,51 +773,53 @@ msgstr "" "將串流位置改變到給定的位元組 *offset*,此位置是相對於由 *whence* 指示的位置解" "釋的,並回傳新的絕對位置。*whence* 的值可為:" -#: ../../library/io.rst:413 +#: ../../library/io.rst:419 msgid "" ":data:`os.SEEK_SET` or ``0`` -- start of the stream (the default); *offset* " "should be zero or positive" msgstr "" ":data:`os.SEEK_SET` 或 ``0`` -- 串流的起點(預設值);*offset* 應為零或正數" -#: ../../library/io.rst:415 +#: ../../library/io.rst:421 msgid "" ":data:`os.SEEK_CUR` or ``1`` -- current stream position; *offset* may be " "negative" msgstr ":data:`os.SEEK_CUR` 或 ``1`` -- 目前串流位置;*offset* 可以是負數" -#: ../../library/io.rst:417 +#: ../../library/io.rst:423 msgid "" ":data:`os.SEEK_END` or ``2`` -- end of the stream; *offset* is usually " "negative" msgstr ":data:`os.SEEK_END` 或 ``2`` -- 串流的結尾;*offset* 通常是負數" -#: ../../library/io.rst:420 ../../library/io.rst:938 +#: ../../library/io.rst:426 ../../library/io.rst:943 msgid "The :data:`!SEEK_*` constants." msgstr ":data:`!SEEK_*` 常數。" -#: ../../library/io.rst:423 +#: ../../library/io.rst:429 msgid "" -"Some operating systems could support additional values, like :const:`os." -"SEEK_HOLE` or :const:`os.SEEK_DATA`. The valid values for a file could " -"depend on it being open in text or binary mode." +"Some operating systems could support additional values, " +"like :const:`os.SEEK_HOLE` or :const:`os.SEEK_DATA`. The valid values for a " +"file could depend on it being open in text or binary mode." msgstr "" -"某些作業系統可以支援額外的值,例如 :const:`os.SEEK_HOLE` 或 :const:`os." -"SEEK_DATA`。檔案的合法值取決於它是以文字模式還是二進位模式開啟。" +"某些作業系統可以支援額外的值,例如 :const:`os.SEEK_HOLE` " +"或 :const:`os.SEEK_DATA`。檔案的合法值取決於它是以文字模式還是二進位模式開" +"啟。" -#: ../../library/io.rst:430 +#: ../../library/io.rst:436 msgid "" -"Return ``True`` if the stream supports random access. If ``False``, :meth:" -"`seek`, :meth:`tell` and :meth:`truncate` will raise :exc:`OSError`." +"Return ``True`` if the stream supports random access. If " +"``False``, :meth:`seek`, :meth:`tell` and :meth:`truncate` will " +"raise :exc:`OSError`." msgstr "" -"如果串流支援隨機存取,則回傳 ``True``。如果是 ``False``,則 :meth:`seek`、:" -"meth:`tell` 和 :meth:`truncate` 會引發 :exc:`OSError`。" +"如果串流支援隨機存取,則回傳 ``True``。如果是 ``False``," +"則 :meth:`seek`、:meth:`tell` 和 :meth:`truncate` 會引發 :exc:`OSError`。" -#: ../../library/io.rst:435 +#: ../../library/io.rst:441 msgid "Return the current stream position." msgstr "回傳目前串流的位置。" -#: ../../library/io.rst:439 +#: ../../library/io.rst:445 msgid "" "Resize the stream to the given *size* in bytes (or the current position if " "*size* is not specified). The current stream position isn't changed. This " @@ -816,19 +832,19 @@ msgstr "" "下,新檔案區域的內容取決於平台(在大多數系統上,額外的位元組會被填充為零)。" "回傳新的檔案大小。" -#: ../../library/io.rst:446 +#: ../../library/io.rst:452 msgid "Windows will now zero-fill files when extending." msgstr "Windows 現在在擴展時會對檔案進行零填充 (zero-fill)。" -#: ../../library/io.rst:451 +#: ../../library/io.rst:457 msgid "" "Return ``True`` if the stream supports writing. If ``False``, :meth:`!" "write` and :meth:`truncate` will raise :exc:`OSError`." msgstr "" -"如果串流支援寫入,則回傳 ``True``。如果是 ``False``,:meth:`!write` 和 :meth:" -"`truncate` 將會引發 :exc:`OSError`。" +"如果串流支援寫入,則回傳 ``True``。如果是 ``False``,:meth:`!write` " +"和 :meth:`truncate` 將會引發 :exc:`OSError`。" -#: ../../library/io.rst:456 +#: ../../library/io.rst:462 msgid "" "Write a list of lines to the stream. Line separators are not added, so it " "is usual for each of the lines provided to have a line separator at the end." @@ -836,20 +852,20 @@ msgstr "" "將一個包含每一行的 list 寫入串流。這不會新增行分隔符號,因此通常提供的每一行" "末尾都有一個行分隔符號。" -#: ../../library/io.rst:462 +#: ../../library/io.rst:468 msgid "" "Prepare for object destruction. :class:`IOBase` provides a default " -"implementation of this method that calls the instance's :meth:`~IOBase." -"close` method." +"implementation of this method that calls the " +"instance's :meth:`~IOBase.close` method." msgstr "" "為物件銷毀做準備。:class:`IOBase` 提供了這個方法的預設實作,該實作會呼叫實例" "的 :meth:`~IOBase.close` 方法。" -#: ../../library/io.rst:469 +#: ../../library/io.rst:475 msgid "Base class for raw binary streams. It inherits from :class:`IOBase`." msgstr "原始二進位串流的基底類別。它繼承自 :class:`IOBase`。" -#: ../../library/io.rst:471 +#: ../../library/io.rst:477 msgid "" "Raw binary streams typically provide low-level access to an underlying OS " "device or API, and do not try to encapsulate it in high-level primitives " @@ -860,13 +876,13 @@ msgstr "" "高階基元 (primitive) 中(這項功能在緩衝二進位串流和文字串流中的更高階層級完" "成,後面的頁面會有描述)。" -#: ../../library/io.rst:476 +#: ../../library/io.rst:482 msgid "" -":class:`RawIOBase` provides these methods in addition to those from :class:" -"`IOBase`:" +":class:`RawIOBase` provides these methods in addition to those " +"from :class:`IOBase`:" msgstr ":class:`RawIOBase` 除了 :class:`IOBase` 的方法外,還提供以下這些方法:" -#: ../../library/io.rst:481 +#: ../../library/io.rst:487 msgid "" "Read up to *size* bytes from the object and return them. As a convenience, " "if *size* is unspecified or -1, all bytes until EOF are returned. Otherwise, " @@ -877,7 +893,7 @@ msgstr "" "則回傳直到檔案結尾 (EOF) 的所有位元組。否則,只會進行一次系統呼叫。如果作業系" "統呼叫回傳的位元組少於 *size*,則可能回傳少於 *size* 的位元組。" -#: ../../library/io.rst:486 +#: ../../library/io.rst:492 msgid "" "If 0 bytes are returned, and *size* was not 0, this indicates end of file. " "If the object is in non-blocking mode and no bytes are available, ``None`` " @@ -886,29 +902,30 @@ msgstr "" "如果回傳了 0 位元組,且 *size* 不是 0,這表示檔案結尾 (end of file)。如果物件" "處於非阻塞模式且沒有可用的位元組,則回傳 ``None``。" -#: ../../library/io.rst:490 +#: ../../library/io.rst:496 msgid "" "The default implementation defers to :meth:`readall` and :meth:`readinto`." msgstr "預設的實作會遵守 :meth:`readall` 和 :meth:`readinto` 的實作。" -#: ../../library/io.rst:495 +#: ../../library/io.rst:501 msgid "" "Read and return all the bytes from the stream until EOF, using multiple " "calls to the stream if necessary." msgstr "讀取並回傳串流中直到檔案結尾的所有位元組,必要時使用多次對串流的呼叫。" -#: ../../library/io.rst:500 +#: ../../library/io.rst:506 msgid "" "Read bytes into a pre-allocated, writable :term:`bytes-like object` *b*, and " -"return the number of bytes read. For example, *b* might be a :class:" -"`bytearray`. If the object is in non-blocking mode and no bytes are " +"return the number of bytes read. For example, *b* might be " +"a :class:`bytearray`. If the object is in non-blocking mode and no bytes are " "available, ``None`` is returned." msgstr "" "將位元組讀入一個預先分配的、可寫的 :term:`bytes-like object` (類位元組物" -"件) *b* 中,並回傳讀取的位元組數量。例如,*b* 可能是一個 :class:" -"`bytearray`。如果物件處於非阻塞模式且沒有可用的位元組,則回傳 ``None``。" +"件) *b* 中,並回傳讀取的位元組數量。例如,*b* 可能是一" +"個 :class:`bytearray`。如果物件處於非阻塞模式且沒有可用的位元組,則回傳 " +"``None``。" -#: ../../library/io.rst:508 +#: ../../library/io.rst:514 msgid "" "Write the given :term:`bytes-like object`, *b*, to the underlying raw " "stream, and return the number of bytes written. This can be less than the " @@ -924,22 +941,24 @@ msgstr "" "何單一位元組,則回傳 ``None``。呼叫者在此方法回傳後可以釋放或變更 *b*,因此實" "作應該只在方法呼叫期間存取 *b*。" -#: ../../library/io.rst:521 +#: ../../library/io.rst:527 msgid "" "Base class for binary streams that support some kind of buffering. It " "inherits from :class:`IOBase`." msgstr "支援某種緩衝的二進位串流的基底類別。它繼承自 :class:`IOBase`。" -#: ../../library/io.rst:524 +#: ../../library/io.rst:530 msgid "" -"The main difference with :class:`RawIOBase` is that methods :meth:`read`, :" -"meth:`readinto` and :meth:`write` will try (respectively) to read as much " -"input as requested or to emit all provided data." +"The main difference with :class:`RawIOBase` is that " +"methods :meth:`read`, :meth:`readinto` and :meth:`write` will try " +"(respectively) to read as much input as requested or to emit all provided " +"data." msgstr "" -"與 :class:`RawIOBase` 的主要差異在於,:meth:`read`、:meth:`readinto` 及 :" -"meth:`write` 方法將分別嘗試讀取所請求的盡可能多的輸入,或發出所有提供的資料。" +"與 :class:`RawIOBase` 的主要差異在於,:meth:`read`、:meth:`readinto` " +"及 :meth:`write` 方法將分別嘗試讀取所請求的盡可能多的輸入,或發出所有提供的資" +"料。" -#: ../../library/io.rst:528 +#: ../../library/io.rst:534 msgid "" "In addition, if the underlying raw stream is in non-blocking mode, when the " "system returns would block :meth:`write` will raise :exc:`BlockingIOError` " @@ -947,23 +966,23 @@ msgid "" "data read so far or ``None`` if no data is available." msgstr "" -#: ../../library/io.rst:533 +#: ../../library/io.rst:539 msgid "" "Besides, the :meth:`read` method does not have a default implementation that " "defers to :meth:`readinto`." msgstr "此外,:meth:`read` 方法不存在一個遵從 :meth:`readinto` 的預設實作。" -#: ../../library/io.rst:536 +#: ../../library/io.rst:542 msgid "" -"A typical :class:`BufferedIOBase` implementation should not inherit from a :" -"class:`RawIOBase` implementation, but wrap one, like :class:`BufferedWriter` " -"and :class:`BufferedReader` do." +"A typical :class:`BufferedIOBase` implementation should not inherit from " +"a :class:`RawIOBase` implementation, but wrap one, " +"like :class:`BufferedWriter` and :class:`BufferedReader` do." msgstr "" "一個典型的 :class:`BufferedIOBase` 實作不應該繼承自一個 :class:`RawIOBase` 的" -"實作,而是應該改用包裝的方式,像 :class:`BufferedWriter` 和 :class:" -"`BufferedReader` 那樣的作法。" +"實作,而是應該改用包裝的方式,像 :class:`BufferedWriter` " +"和 :class:`BufferedReader` 那樣的作法。" -#: ../../library/io.rst:540 +#: ../../library/io.rst:546 msgid "" ":class:`BufferedIOBase` provides or overrides these data attributes and " "methods in addition to those from :class:`IOBase`:" @@ -971,25 +990,25 @@ msgstr "" ":class:`BufferedIOBase` 除了提供或覆寫來自 :class:`IOBase` 的資料屬性和方法以" "外,還包含了這些:" -#: ../../library/io.rst:545 +#: ../../library/io.rst:551 msgid "" -"The underlying raw stream (a :class:`RawIOBase` instance) that :class:" -"`BufferedIOBase` deals with. This is not part of the :class:" -"`BufferedIOBase` API and may not exist on some implementations." +"The underlying raw stream (a :class:`RawIOBase` instance) " +"that :class:`BufferedIOBase` deals with. This is not part of " +"the :class:`BufferedIOBase` API and may not exist on some implementations." msgstr "" "底層的原始串流(一個 :class:`RawIOBase` 實例),:class:`BufferedIOBase` 處理" "的對象。這不是 :class:`BufferedIOBase` API 的一部分,且在某些實作可能不存在。" -#: ../../library/io.rst:551 +#: ../../library/io.rst:557 msgid "Separate the underlying raw stream from the buffer and return it." msgstr "將底層的原始串流從緩衝區中分離出來,並回傳它。" -#: ../../library/io.rst:553 +#: ../../library/io.rst:559 msgid "" "After the raw stream has been detached, the buffer is in an unusable state." msgstr "在原始串流被分離後,緩衝區處於一個不可用的狀態。" -#: ../../library/io.rst:556 +#: ../../library/io.rst:562 msgid "" "Some buffers, like :class:`BytesIO`, do not have the concept of a single raw " "stream to return from this method. They raise :exc:`UnsupportedOperation`." @@ -997,7 +1016,7 @@ msgstr "" "某些緩衝區,如 :class:`BytesIO`,沒有單一原始串流的概念可從此方法回傳。它們會" "引發 :exc:`UnsupportedOperation`。" -#: ../../library/io.rst:564 +#: ../../library/io.rst:570 msgid "" "Read and return up to *size* bytes. If the argument is omitted, ``None``, or " "negative read as much as possible." @@ -1005,32 +1024,33 @@ msgstr "" "讀取並回傳最多 *size* 個位元組。如果引數被省略、為 ``None`` 或為負值,將讀取" "盡可能最多的位元組。" -#: ../../library/io.rst:567 +#: ../../library/io.rst:573 msgid "" "Fewer bytes may be returned than requested. An empty :class:`bytes` object " "is returned if the stream is already at EOF. More than one read may be made " -"and calls may be retried if specific errors are encountered, see :meth:`os." -"read` and :pep:`475` for more details. Less than size bytes being returned " -"does not imply that EOF is imminent." +"and calls may be retried if specific errors are encountered, " +"see :meth:`os.read` and :pep:`475` for more details. Less than size bytes " +"being returned does not imply that EOF is imminent." msgstr "" -#: ../../library/io.rst:573 +#: ../../library/io.rst:579 msgid "" -"When reading as much as possible the default implementation will use ``raw." -"readall`` if available (which should implement :meth:`RawIOBase.readall`), " -"otherwise will read in a loop until read returns ``None``, an empty :class:" -"`bytes`, or a non-retryable error. For most streams this is to EOF, but for " -"non-blocking streams more data may become available." +"When reading as much as possible the default implementation will use " +"``raw.readall`` if available (which should " +"implement :meth:`RawIOBase.readall`), otherwise will read in a loop until " +"read returns ``None``, an empty :class:`bytes`, or a non-retryable error. " +"For most streams this is to EOF, but for non-blocking streams more data may " +"become available." msgstr "" -#: ../../library/io.rst:582 ../../library/io.rst:595 +#: ../../library/io.rst:588 ../../library/io.rst:601 msgid "" "When the underlying raw stream is non-blocking, implementations may either " -"raise :exc:`BlockingIOError` or return ``None`` if no data is available. :" -"mod:`io` implementations return ``None``." +"raise :exc:`BlockingIOError` or return ``None`` if no data is " +"available. :mod:`io` implementations return ``None``." msgstr "" -#: ../../library/io.rst:588 +#: ../../library/io.rst:594 msgid "" "Read and return up to *size* bytes, calling :meth:`~RawIOBase.readinto` " "which may retry if :py:const:`~errno.EINTR` is encountered per :pep:`475`. " @@ -1038,16 +1058,16 @@ msgid "" "arbitrary value for *size*." msgstr "" -#: ../../library/io.rst:601 +#: ../../library/io.rst:607 msgid "" "Read bytes into a pre-allocated, writable :term:`bytes-like object` *b* and " -"return the number of bytes read. For example, *b* might be a :class:" -"`bytearray`." +"return the number of bytes read. For example, *b* might be " +"a :class:`bytearray`." msgstr "" "讀取位元組到一個預先分配的、可寫的 :term:`bytes-like object` *b* 當中,並回傳" "讀取的位元組數量。例如,*b* 可能是一個 :class:`bytearray`。" -#: ../../library/io.rst:605 +#: ../../library/io.rst:611 msgid "" "Like :meth:`read`, multiple reads may be issued to the underlying raw " "stream, unless the latter is interactive." @@ -1055,26 +1075,26 @@ msgstr "" "類似於 :meth:`read`,除非後者是互動式的,否則可能會對底層原始串流發出多次讀" "取。" -#: ../../library/io.rst:608 ../../library/io.rst:618 +#: ../../library/io.rst:614 ../../library/io.rst:624 msgid "" "A :exc:`BlockingIOError` is raised if the underlying raw stream is in non " "blocking-mode, and has no data available at the moment." msgstr "" -"如果底層原始串流處於非阻塞模式,且目前沒有可用資料,則會引發 :exc:" -"`BlockingIOError`。" +"如果底層原始串流處於非阻塞模式,且目前沒有可用資料,則會引" +"發 :exc:`BlockingIOError`。" -#: ../../library/io.rst:613 +#: ../../library/io.rst:619 msgid "" "Read bytes into a pre-allocated, writable :term:`bytes-like object` *b*, " -"using at most one call to the underlying raw stream's :meth:`~RawIOBase." -"read` (or :meth:`~RawIOBase.readinto`) method. Return the number of bytes " -"read." +"using at most one call to the underlying raw " +"stream's :meth:`~RawIOBase.read` (or :meth:`~RawIOBase.readinto`) method. " +"Return the number of bytes read." msgstr "" "讀取位元組到一個預先分配的、可寫的 :term:`bytes-like object` *b* 中,最多呼叫" "一次底層原始串流的 :meth:`~RawIOBase.read` (或 :meth:`~RawIOBase.readinto`)" "方法。此方法回傳讀取的位元組數量。" -#: ../../library/io.rst:625 +#: ../../library/io.rst:631 msgid "" "Write the given :term:`bytes-like object`, *b*, and return the number of " "bytes written (always equal to the length of *b* in bytes, since if the " @@ -1087,7 +1107,7 @@ msgstr "" "實作,這些位元組可能會立即寫入底層串流,或出於性能和延遲的緣故而被留在緩衝區" "當中。" -#: ../../library/io.rst:632 +#: ../../library/io.rst:638 msgid "" "When in non-blocking mode, a :exc:`BlockingIOError` is raised if the data " "needed to be written to the raw stream but it couldn't accept all the data " @@ -1096,7 +1116,7 @@ msgstr "" "當處於非阻塞模式時,如果需要將資料寫入原始串流,但它無法接受所有資料而不阻" "塞,則會引發 :exc:`BlockingIOError`。" -#: ../../library/io.rst:636 +#: ../../library/io.rst:642 msgid "" "The caller may release or mutate *b* after this method returns, so the " "implementation should only access *b* during the method call." @@ -1104,23 +1124,23 @@ msgstr "" "呼叫者可以在此方法回傳後釋放或變更 *b*,因此實作應該僅在方法呼叫期間存取 " "*b*。" -#: ../../library/io.rst:641 +#: ../../library/io.rst:647 msgid "Raw File I/O" msgstr "原始檔案 I/O" -#: ../../library/io.rst:645 +#: ../../library/io.rst:651 msgid "" "A raw binary stream representing an OS-level file containing bytes data. It " "inherits from :class:`RawIOBase`." msgstr "" -"一個代表包含位元組資料的 OS 層級檔案的原始二進制串流。它繼承自 :class:" -"`RawIOBase`。" +"一個代表包含位元組資料的 OS 層級檔案的原始二進制串流。它繼承" +"自 :class:`RawIOBase`。" -#: ../../library/io.rst:648 +#: ../../library/io.rst:654 msgid "The *name* can be one of two things:" msgstr "*name* 可以是兩種事物之一:" -#: ../../library/io.rst:650 +#: ../../library/io.rst:656 msgid "" "a character string or :class:`bytes` object representing the path to the " "file which will be opened. In this case closefd must be ``True`` (the " @@ -1129,7 +1149,7 @@ msgstr "" "代表將要打開的檔案路徑的一個字元串或 :class:`bytes` 物件。在這種情況下," "closefd 必須是 ``True`` (預設值),否則將引發錯誤。" -#: ../../library/io.rst:653 +#: ../../library/io.rst:659 msgid "" "an integer representing the number of an existing OS-level file descriptor " "to which the resulting :class:`FileIO` object will give access. When the " @@ -1137,7 +1157,7 @@ msgid "" "set to ``False``." msgstr "" -#: ../../library/io.rst:658 +#: ../../library/io.rst:664 msgid "" "The *mode* can be ``'r'``, ``'w'``, ``'x'`` or ``'a'`` for reading " "(default), writing, exclusive creation or appending. The file will be " @@ -1148,14 +1168,14 @@ msgid "" "``'+'`` to the mode to allow simultaneous reading and writing." msgstr "" -#: ../../library/io.rst:666 +#: ../../library/io.rst:672 msgid "" -"The :meth:`~RawIOBase.read` (when called with a positive argument), :meth:" -"`~RawIOBase.readinto` and :meth:`~RawIOBase.write` methods on this class " -"will only make one system call." +"The :meth:`~RawIOBase.read` (when called with a positive " +"argument), :meth:`~RawIOBase.readinto` and :meth:`~RawIOBase.write` methods " +"on this class will only make one system call." msgstr "" -#: ../../library/io.rst:670 +#: ../../library/io.rst:676 msgid "" "A custom opener can be used by passing a callable as *opener*. The " "underlying file descriptor for the file object is then obtained by calling " @@ -1164,77 +1184,77 @@ msgid "" "similar to passing ``None``)." msgstr "" -#: ../../library/io.rst:676 +#: ../../library/io.rst:682 msgid "The newly created file is :ref:`non-inheritable `." msgstr "" -#: ../../library/io.rst:678 +#: ../../library/io.rst:684 msgid "" "See the :func:`open` built-in function for examples on using the *opener* " "parameter." msgstr "" -#: ../../library/io.rst:681 +#: ../../library/io.rst:687 msgid "The *opener* parameter was added. The ``'x'`` mode was added." msgstr "" -#: ../../library/io.rst:685 +#: ../../library/io.rst:691 msgid "The file is now non-inheritable." msgstr "" -#: ../../library/io.rst:688 +#: ../../library/io.rst:694 msgid "" -":class:`FileIO` provides these data attributes in addition to those from :" -"class:`RawIOBase` and :class:`IOBase`:" +":class:`FileIO` provides these data attributes in addition to those " +"from :class:`RawIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:693 +#: ../../library/io.rst:699 msgid "The mode as given in the constructor." msgstr "" -#: ../../library/io.rst:697 +#: ../../library/io.rst:703 msgid "" "The file name. This is the file descriptor of the file when no name is " "given in the constructor." msgstr "" -#: ../../library/io.rst:702 +#: ../../library/io.rst:708 msgid "Buffered Streams" msgstr "" -#: ../../library/io.rst:704 +#: ../../library/io.rst:710 msgid "" "Buffered I/O streams provide a higher-level interface to an I/O device than " "raw I/O does." msgstr "" -#: ../../library/io.rst:709 +#: ../../library/io.rst:715 msgid "" -"A binary stream using an in-memory bytes buffer. It inherits from :class:" -"`BufferedIOBase`. The buffer is discarded when the :meth:`~IOBase.close` " -"method is called." +"A binary stream using an in-memory bytes buffer. It inherits " +"from :class:`BufferedIOBase`. The buffer is discarded when " +"the :meth:`~IOBase.close` method is called." msgstr "" -#: ../../library/io.rst:713 +#: ../../library/io.rst:719 msgid "" "The optional argument *initial_bytes* is a :term:`bytes-like object` that " "contains initial data." msgstr "" -#: ../../library/io.rst:716 +#: ../../library/io.rst:722 msgid "" ":class:`BytesIO` provides or overrides these methods in addition to those " "from :class:`BufferedIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:721 +#: ../../library/io.rst:727 msgid "" "Return a readable and writable view over the contents of the buffer without " "copying them. Also, mutating the view will transparently update the " "contents of the buffer::" msgstr "" -#: ../../library/io.rst:725 +#: ../../library/io.rst:731 msgid "" ">>> b = io.BytesIO(b\"abcdef\")\n" ">>> view = b.getbuffer()\n" @@ -1248,305 +1268,306 @@ msgstr "" ">>> b.getvalue()\n" "b'ab56ef'" -#: ../../library/io.rst:732 +#: ../../library/io.rst:738 msgid "" "As long as the view exists, the :class:`BytesIO` object cannot be resized or " "closed." msgstr "" -#: ../../library/io.rst:739 +#: ../../library/io.rst:745 msgid "Return :class:`bytes` containing the entire contents of the buffer." msgstr "" -#: ../../library/io.rst:744 +#: ../../library/io.rst:750 msgid "In :class:`BytesIO`, this is the same as :meth:`~BufferedIOBase.read`." msgstr "" -#: ../../library/io.rst:746 ../../library/io.rst:786 +#: ../../library/io.rst:752 ../../library/io.rst:792 msgid "The *size* argument is now optional." msgstr "" -#: ../../library/io.rst:751 +#: ../../library/io.rst:757 msgid "" "In :class:`BytesIO`, this is the same as :meth:`~BufferedIOBase.readinto`." msgstr "" -#: ../../library/io.rst:757 +#: ../../library/io.rst:763 msgid "" "A buffered binary stream providing higher-level access to a readable, non " -"seekable :class:`RawIOBase` raw binary stream. It inherits from :class:" -"`BufferedIOBase`." +"seekable :class:`RawIOBase` raw binary stream. It inherits " +"from :class:`BufferedIOBase`." msgstr "" -#: ../../library/io.rst:761 +#: ../../library/io.rst:767 msgid "" "When reading data from this object, a larger amount of data may be requested " "from the underlying raw stream, and kept in an internal buffer. The buffered " "data can then be returned directly on subsequent reads." msgstr "" -#: ../../library/io.rst:765 +#: ../../library/io.rst:771 msgid "" "The constructor creates a :class:`BufferedReader` for the given readable " -"*raw* stream and *buffer_size*. If *buffer_size* is omitted, :data:" -"`DEFAULT_BUFFER_SIZE` is used." +"*raw* stream and *buffer_size*. If *buffer_size* is " +"omitted, :data:`DEFAULT_BUFFER_SIZE` is used." msgstr "" -#: ../../library/io.rst:769 +#: ../../library/io.rst:775 msgid "" ":class:`BufferedReader` provides or overrides these methods in addition to " "those from :class:`BufferedIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:774 +#: ../../library/io.rst:780 msgid "" "Return bytes from the stream without advancing the position. The number of " "bytes returned may be less or more than requested. If the underlying raw " "stream is non-blocking and the operation would block, returns empty bytes." msgstr "" -#: ../../library/io.rst:780 +#: ../../library/io.rst:786 msgid "" "In :class:`BufferedReader` this is the same as :meth:`io.BufferedIOBase.read`" msgstr "" -#: ../../library/io.rst:784 +#: ../../library/io.rst:790 msgid "" -"In :class:`BufferedReader` this is the same as :meth:`io.BufferedIOBase." -"read1`" +"In :class:`BufferedReader` this is the same " +"as :meth:`io.BufferedIOBase.read1`" msgstr "" -#: ../../library/io.rst:792 +#: ../../library/io.rst:797 msgid "" "A buffered binary stream providing higher-level access to a writeable, non " -"seekable :class:`RawIOBase` raw binary stream. It inherits from :class:" -"`BufferedIOBase`." +"seekable :class:`RawIOBase` raw binary stream. It inherits " +"from :class:`BufferedIOBase`." msgstr "" -#: ../../library/io.rst:796 +#: ../../library/io.rst:801 msgid "" "When writing to this object, data is normally placed into an internal " "buffer. The buffer will be written out to the underlying :class:`RawIOBase` " "object under various conditions, including:" msgstr "" -#: ../../library/io.rst:800 +#: ../../library/io.rst:805 msgid "when the buffer gets too small for all pending data;" msgstr "" -#: ../../library/io.rst:801 +#: ../../library/io.rst:806 msgid "when :meth:`flush` is called;" msgstr "" -#: ../../library/io.rst:802 +#: ../../library/io.rst:807 msgid "" "when a :meth:`~IOBase.seek` is requested (for :class:`BufferedRandom` " "objects);" msgstr "" -#: ../../library/io.rst:803 +#: ../../library/io.rst:808 msgid "when the :class:`BufferedWriter` object is closed or destroyed." msgstr "" -#: ../../library/io.rst:805 +#: ../../library/io.rst:810 msgid "" "The constructor creates a :class:`BufferedWriter` for the given writeable " -"*raw* stream. If the *buffer_size* is not given, it defaults to :data:" -"`DEFAULT_BUFFER_SIZE`." +"*raw* stream. If the *buffer_size* is not given, it defaults " +"to :data:`DEFAULT_BUFFER_SIZE`." msgstr "" -#: ../../library/io.rst:809 +#: ../../library/io.rst:814 msgid "" ":class:`BufferedWriter` provides or overrides these methods in addition to " "those from :class:`BufferedIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:814 +#: ../../library/io.rst:819 msgid "" -"Force bytes held in the buffer into the raw stream. A :exc:" -"`BlockingIOError` should be raised if the raw stream blocks." +"Force bytes held in the buffer into the raw stream. " +"A :exc:`BlockingIOError` should be raised if the raw stream blocks." msgstr "" -#: ../../library/io.rst:819 +#: ../../library/io.rst:824 msgid "" "Write the :term:`bytes-like object`, *b*, and return the number of bytes " -"written. When in non-blocking mode, a :exc:`BlockingIOError` with :attr:" -"`BlockingIOError.characters_written` set is raised if the buffer needs to be " -"written out but the raw stream blocks." +"written. When in non-blocking mode, a :exc:`BlockingIOError` " +"with :attr:`BlockingIOError.characters_written` set is raised if the buffer " +"needs to be written out but the raw stream blocks." msgstr "" -#: ../../library/io.rst:827 +#: ../../library/io.rst:832 msgid "" -"A buffered binary stream providing higher-level access to a seekable :class:" -"`RawIOBase` raw binary stream. It inherits from :class:`BufferedReader` " -"and :class:`BufferedWriter`." +"A buffered binary stream providing higher-level access to a " +"seekable :class:`RawIOBase` raw binary stream. It inherits " +"from :class:`BufferedReader` and :class:`BufferedWriter`." msgstr "" -#: ../../library/io.rst:831 +#: ../../library/io.rst:836 msgid "" "The constructor creates a reader and writer for a seekable raw stream, given " -"in the first argument. If the *buffer_size* is omitted it defaults to :data:" -"`DEFAULT_BUFFER_SIZE`." +"in the first argument. If the *buffer_size* is omitted it defaults " +"to :data:`DEFAULT_BUFFER_SIZE`." msgstr "" -#: ../../library/io.rst:835 +#: ../../library/io.rst:840 msgid "" -":class:`BufferedRandom` is capable of anything :class:`BufferedReader` or :" -"class:`BufferedWriter` can do. In addition, :meth:`~IOBase.seek` and :meth:" -"`~IOBase.tell` are guaranteed to be implemented." +":class:`BufferedRandom` is capable of anything :class:`BufferedReader` " +"or :class:`BufferedWriter` can do. In addition, :meth:`~IOBase.seek` " +"and :meth:`~IOBase.tell` are guaranteed to be implemented." msgstr "" -#: ../../library/io.rst:842 +#: ../../library/io.rst:847 msgid "" -"A buffered binary stream providing higher-level access to two non seekable :" -"class:`RawIOBase` raw binary streams---one readable, the other writeable. It " -"inherits from :class:`BufferedIOBase`." +"A buffered binary stream providing higher-level access to two non " +"seekable :class:`RawIOBase` raw binary streams---one readable, the other " +"writeable. It inherits from :class:`BufferedIOBase`." msgstr "" -#: ../../library/io.rst:846 +#: ../../library/io.rst:851 msgid "" "*reader* and *writer* are :class:`RawIOBase` objects that are readable and " -"writeable respectively. If the *buffer_size* is omitted it defaults to :" -"data:`DEFAULT_BUFFER_SIZE`." +"writeable respectively. If the *buffer_size* is omitted it defaults " +"to :data:`DEFAULT_BUFFER_SIZE`." msgstr "" -#: ../../library/io.rst:850 +#: ../../library/io.rst:855 msgid "" ":class:`BufferedRWPair` implements all of :class:`BufferedIOBase`\\'s " -"methods except for :meth:`~BufferedIOBase.detach`, which raises :exc:" -"`UnsupportedOperation`." +"methods except for :meth:`~BufferedIOBase.detach`, which " +"raises :exc:`UnsupportedOperation`." msgstr "" -#: ../../library/io.rst:856 +#: ../../library/io.rst:861 msgid "" ":class:`BufferedRWPair` does not attempt to synchronize accesses to its " "underlying raw streams. You should not pass it the same object as reader " "and writer; use :class:`BufferedRandom` instead." msgstr "" -#: ../../library/io.rst:866 +#: ../../library/io.rst:871 msgid "" "Base class for text streams. This class provides a character and line based " "interface to stream I/O. It inherits from :class:`IOBase`." msgstr "" -#: ../../library/io.rst:869 +#: ../../library/io.rst:874 msgid "" ":class:`TextIOBase` provides or overrides these data attributes and methods " "in addition to those from :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:874 +#: ../../library/io.rst:879 msgid "" "The name of the encoding used to decode the stream's bytes into strings, and " "to encode strings into bytes." msgstr "" -#: ../../library/io.rst:879 +#: ../../library/io.rst:884 msgid "The error setting of the decoder or encoder." msgstr "" -#: ../../library/io.rst:883 +#: ../../library/io.rst:888 msgid "" "A string, a tuple of strings, or ``None``, indicating the newlines " "translated so far. Depending on the implementation and the initial " "constructor flags, this may not be available." msgstr "" -#: ../../library/io.rst:889 +#: ../../library/io.rst:894 msgid "" -"The underlying binary buffer (a :class:`BufferedIOBase` or :class:" -"`RawIOBase` instance) that :class:`TextIOBase` deals with. This is not part " -"of the :class:`TextIOBase` API and may not exist in some implementations." +"The underlying binary buffer (a :class:`BufferedIOBase` " +"or :class:`RawIOBase` instance) that :class:`TextIOBase` deals with. This is " +"not part of the :class:`TextIOBase` API and may not exist in some " +"implementations." msgstr "" -"底層的二進位緩衝(一個 :class:`BufferedIOBase` 或 :class:" -"`RawIOBase` 實例),為 :class:`TextIOBase` 處理的對象。" -"這不是 :class:`TextIOBase` API 的一部分,且在某些實作可能不存在。" +"底層的二進位緩衝(一個 :class:`BufferedIOBase` 或 :class:`RawIOBase` 實例)," +"為 :class:`TextIOBase` 處理的對象。這不是 :class:`TextIOBase` API 的一部分," +"且在某些實作可能不存在。" -#: ../../library/io.rst:896 +#: ../../library/io.rst:901 msgid "" "Separate the underlying binary buffer from the :class:`TextIOBase` and " "return it." msgstr "" -#: ../../library/io.rst:899 +#: ../../library/io.rst:904 msgid "" "After the underlying buffer has been detached, the :class:`TextIOBase` is in " "an unusable state." msgstr "" -#: ../../library/io.rst:902 +#: ../../library/io.rst:907 msgid "" "Some :class:`TextIOBase` implementations, like :class:`StringIO`, may not " -"have the concept of an underlying buffer and calling this method will raise :" -"exc:`UnsupportedOperation`." +"have the concept of an underlying buffer and calling this method will " +"raise :exc:`UnsupportedOperation`." msgstr "" -#: ../../library/io.rst:910 +#: ../../library/io.rst:915 msgid "" -"Read and return at most *size* characters from the stream as a single :class:" -"`str`. If *size* is negative or ``None``, reads until EOF." +"Read and return at most *size* characters from the stream as a " +"single :class:`str`. If *size* is negative or ``None``, reads until EOF." msgstr "" -#: ../../library/io.rst:915 +#: ../../library/io.rst:920 msgid "" "Read until newline or EOF and return a single :class:`str`. If the stream " "is already at EOF, an empty string is returned." msgstr "" -#: ../../library/io.rst:918 +#: ../../library/io.rst:923 msgid "If *size* is specified, at most *size* characters will be read." msgstr "" -#: ../../library/io.rst:922 +#: ../../library/io.rst:927 msgid "" "Change the stream position to the given *offset*. Behaviour depends on the " "*whence* parameter. The default value for *whence* is :data:`!SEEK_SET`." msgstr "" -#: ../../library/io.rst:926 +#: ../../library/io.rst:931 msgid "" ":data:`!SEEK_SET` or ``0``: seek from the start of the stream (the default); " "*offset* must either be a number returned by :meth:`TextIOBase.tell`, or " "zero. Any other *offset* value produces undefined behaviour." msgstr "" -#: ../../library/io.rst:930 +#: ../../library/io.rst:935 msgid "" ":data:`!SEEK_CUR` or ``1``: \"seek\" to the current position; *offset* must " "be zero, which is a no-operation (all other values are unsupported)." msgstr "" -#: ../../library/io.rst:933 +#: ../../library/io.rst:938 msgid "" ":data:`!SEEK_END` or ``2``: seek to the end of the stream; *offset* must be " "zero (all other values are unsupported)." msgstr "" -#: ../../library/io.rst:936 +#: ../../library/io.rst:941 msgid "Return the new absolute position as an opaque number." msgstr "" -#: ../../library/io.rst:943 +#: ../../library/io.rst:948 msgid "" "Return the current stream position as an opaque number. The number does not " "usually represent a number of bytes in the underlying binary storage." msgstr "" -#: ../../library/io.rst:949 +#: ../../library/io.rst:954 msgid "" "Write the string *s* to the stream and return the number of characters " "written." msgstr "" -#: ../../library/io.rst:956 +#: ../../library/io.rst:961 msgid "" -"A buffered text stream providing higher-level access to a :class:" -"`BufferedIOBase` buffered binary stream. It inherits from :class:" -"`TextIOBase`." +"A buffered text stream providing higher-level access to " +"a :class:`BufferedIOBase` buffered binary stream. It inherits " +"from :class:`TextIOBase`." msgstr "" -#: ../../library/io.rst:960 +#: ../../library/io.rst:965 msgid "" "*encoding* gives the name of the encoding that the stream will be decoded or " "encoded with. In :ref:`UTF-8 Mode `, this defaults to UTF-8. " @@ -1555,7 +1576,7 @@ msgid "" "explicitly. See :ref:`io-text-encoding` for more information." msgstr "" -#: ../../library/io.rst:966 +#: ../../library/io.rst:971 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled. Pass ``'strict'`` to raise a :exc:`ValueError` " @@ -1570,52 +1591,52 @@ msgid "" "that has been registered with :func:`codecs.register_error` is also valid." msgstr "" -#: ../../library/io.rst:982 +#: ../../library/io.rst:987 msgid "" "*newline* controls how line endings are handled. It can be ``None``, " "``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as follows:" msgstr "" -#: ../../library/io.rst:985 +#: ../../library/io.rst:990 msgid "" -"When reading input from the stream, if *newline* is ``None``, :term:" -"`universal newlines` mode is enabled. Lines in the input can end in " -"``'\\n'``, ``'\\r'``, or ``'\\r\\n'``, and these are translated into " -"``'\\n'`` before being returned to the caller. If *newline* is ``''``, " +"When reading input from the stream, if *newline* is " +"``None``, :term:`universal newlines` mode is enabled. Lines in the input " +"can end in ``'\\n'``, ``'\\r'``, or ``'\\r\\n'``, and these are translated " +"into ``'\\n'`` before being returned to the caller. If *newline* is ``''``, " "universal newlines mode is enabled, but line endings are returned to the " "caller untranslated. If *newline* has any of the other legal values, input " "lines are only terminated by the given string, and the line ending is " "returned to the caller untranslated." msgstr "" -#: ../../library/io.rst:994 +#: ../../library/io.rst:999 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " -"characters written are translated to the system default line separator, :" -"data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no translation " -"takes place. If *newline* is any of the other legal values, any ``'\\n'`` " -"characters written are translated to the given string." +"characters written are translated to the system default line " +"separator, :data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no " +"translation takes place. If *newline* is any of the other legal values, any " +"``'\\n'`` characters written are translated to the given string." msgstr "" -#: ../../library/io.rst:1000 +#: ../../library/io.rst:1005 msgid "" "If *line_buffering* is ``True``, :meth:`~IOBase.flush` is implied when a " "call to write contains a newline character or a carriage return." msgstr "" -#: ../../library/io.rst:1003 +#: ../../library/io.rst:1008 msgid "" "If *write_through* is ``True``, calls to :meth:`~BufferedIOBase.write` are " -"guaranteed not to be buffered: any data written on the :class:" -"`TextIOWrapper` object is immediately handled to its underlying binary " -"*buffer*." +"guaranteed not to be buffered: any data written on " +"the :class:`TextIOWrapper` object is immediately handled to its underlying " +"binary *buffer*." msgstr "" -#: ../../library/io.rst:1007 +#: ../../library/io.rst:1012 msgid "The *write_through* argument has been added." msgstr "" -#: ../../library/io.rst:1010 +#: ../../library/io.rst:1015 msgid "" "The default *encoding* is now ``locale.getpreferredencoding(False)`` instead " "of ``locale.getpreferredencoding()``. Don't change temporary the locale " @@ -1623,144 +1644,150 @@ msgid "" "instead of the user preferred encoding." msgstr "" -#: ../../library/io.rst:1016 +#: ../../library/io.rst:1021 msgid "" "The *encoding* argument now supports the ``\"locale\"`` dummy encoding name." msgstr "" -#: ../../library/io.rst:1019 +#: ../../library/io.rst:1026 +msgid "" +"When the underlying raw stream is non-blocking, a :exc:`BlockingIOError` may " +"be raised if a read operation cannot be completed immediately." +msgstr "" + +#: ../../library/io.rst:1029 msgid "" ":class:`TextIOWrapper` provides these data attributes and methods in " "addition to those from :class:`TextIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:1024 +#: ../../library/io.rst:1034 msgid "Whether line buffering is enabled." msgstr "" -#: ../../library/io.rst:1028 +#: ../../library/io.rst:1038 msgid "Whether writes are passed immediately to the underlying binary buffer." msgstr "" -#: ../../library/io.rst:1036 +#: ../../library/io.rst:1046 msgid "" "Reconfigure this text stream using new settings for *encoding*, *errors*, " "*newline*, *line_buffering* and *write_through*." msgstr "" -#: ../../library/io.rst:1039 +#: ../../library/io.rst:1049 msgid "" "Parameters not specified keep current settings, except ``errors='strict'`` " "is used when *encoding* is specified but *errors* is not specified." msgstr "" -#: ../../library/io.rst:1043 +#: ../../library/io.rst:1053 msgid "" "It is not possible to change the encoding or newline if some data has " "already been read from the stream. On the other hand, changing encoding " "after write is possible." msgstr "" -#: ../../library/io.rst:1047 +#: ../../library/io.rst:1057 msgid "" "This method does an implicit stream flush before setting the new parameters." msgstr "" -#: ../../library/io.rst:1052 +#: ../../library/io.rst:1062 msgid "The method supports ``encoding=\"locale\"`` option." msgstr "" -#: ../../library/io.rst:1057 +#: ../../library/io.rst:1067 msgid "" "Set the stream position. Return the new stream position as an :class:`int`." msgstr "" -#: ../../library/io.rst:1060 +#: ../../library/io.rst:1070 msgid "" "Four operations are supported, given by the following argument combinations:" msgstr "" -#: ../../library/io.rst:1063 +#: ../../library/io.rst:1073 msgid "``seek(0, SEEK_SET)``: Rewind to the start of the stream." msgstr "" -#: ../../library/io.rst:1064 +#: ../../library/io.rst:1074 msgid "" "``seek(cookie, SEEK_SET)``: Restore a previous position; *cookie* **must " "be** a number returned by :meth:`tell`." msgstr "" -#: ../../library/io.rst:1066 +#: ../../library/io.rst:1076 msgid "``seek(0, SEEK_END)``: Fast-forward to the end of the stream." msgstr "" -#: ../../library/io.rst:1067 +#: ../../library/io.rst:1077 msgid "``seek(0, SEEK_CUR)``: Leave the current stream position unchanged." msgstr "" -#: ../../library/io.rst:1069 +#: ../../library/io.rst:1079 msgid "Any other argument combinations are invalid, and may raise exceptions." msgstr "" -#: ../../library/io.rst:1074 +#: ../../library/io.rst:1084 msgid ":data:`os.SEEK_SET`, :data:`os.SEEK_CUR`, and :data:`os.SEEK_END`." msgstr "" -#: ../../library/io.rst:1078 +#: ../../library/io.rst:1088 msgid "" "Return the stream position as an opaque number. The return value of :meth:`!" "tell` can be given as input to :meth:`seek`, to restore a previous stream " "position." msgstr "" -#: ../../library/io.rst:1085 +#: ../../library/io.rst:1095 msgid "" -"A text stream using an in-memory text buffer. It inherits from :class:" -"`TextIOBase`." +"A text stream using an in-memory text buffer. It inherits " +"from :class:`TextIOBase`." msgstr "" -#: ../../library/io.rst:1088 +#: ../../library/io.rst:1098 msgid "" "The text buffer is discarded when the :meth:`~IOBase.close` method is called." msgstr "" -#: ../../library/io.rst:1091 +#: ../../library/io.rst:1101 msgid "" "The initial value of the buffer can be set by providing *initial_value*. If " -"newline translation is enabled, newlines will be encoded as if by :meth:" -"`~TextIOBase.write`. The stream is positioned at the start of the buffer " -"which emulates opening an existing file in a ``w+`` mode, making it ready " -"for an immediate write from the beginning or for a write that would " +"newline translation is enabled, newlines will be encoded as if " +"by :meth:`~TextIOBase.write`. The stream is positioned at the start of the " +"buffer which emulates opening an existing file in a ``w+`` mode, making it " +"ready for an immediate write from the beginning or for a write that would " "overwrite the initial value. To emulate opening a file in an ``a+`` mode " "ready for appending, use ``f.seek(0, io.SEEK_END)`` to reposition the stream " "at the end of the buffer." msgstr "" -#: ../../library/io.rst:1100 +#: ../../library/io.rst:1110 msgid "" "The *newline* argument works like that of :class:`TextIOWrapper`, except " "that when writing output to the stream, if *newline* is ``None``, newlines " "are written as ``\\n`` on all platforms." msgstr "" -#: ../../library/io.rst:1104 +#: ../../library/io.rst:1114 msgid "" -":class:`StringIO` provides this method in addition to those from :class:" -"`TextIOBase` and :class:`IOBase`:" +":class:`StringIO` provides this method in addition to those " +"from :class:`TextIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:1109 +#: ../../library/io.rst:1119 msgid "" "Return a :class:`str` containing the entire contents of the buffer. Newlines " "are decoded as if by :meth:`~TextIOBase.read`, although the stream position " "is not changed." msgstr "" -#: ../../library/io.rst:1113 +#: ../../library/io.rst:1123 msgid "Example usage::" msgstr "使用範例: ::" -#: ../../library/io.rst:1115 +#: ../../library/io.rst:1125 msgid "" "import io\n" "\n" @@ -1777,23 +1804,85 @@ msgid "" "output.close()" msgstr "" -#: ../../library/io.rst:1135 +#: ../../library/io.rst:1145 msgid "" "A helper codec that decodes newlines for :term:`universal newlines` mode. It " "inherits from :class:`codecs.IncrementalDecoder`." msgstr "" -#: ../../library/io.rst:1140 +#: ../../library/io.rst:1150 +msgid "Static Typing" +msgstr "" + +#: ../../library/io.rst:1152 +msgid "" +"The following protocols can be used for annotating function and method " +"arguments for simple stream reading or writing operations. They are " +"decorated with :deco:`typing.runtime_checkable`." +msgstr "" + +#: ../../library/io.rst:1158 +msgid "" +"Generic protocol for reading from a file or other input stream. ``T`` will " +"usually be :class:`str` or :class:`bytes`, but can be any type that is read " +"from the stream." +msgstr "" + +#: ../../library/io.rst:1167 +#, fuzzy +msgid "" +"Read data from the input stream and return it. If *size* is specified, it " +"should be an integer, and at most *size* items (bytes/characters) will be " +"read." +msgstr "從串流讀取並回傳一行。如果指定了 *size*,則最多讀取 *size* 個位元組。" + +#: ../../library/io.rst:1171 ../../library/io.rst:1190 +msgid "For example::" +msgstr "" + +#: ../../library/io.rst:1173 +msgid "" +"def read_it(reader: Reader[str]):\n" +" data = reader.read(11)\n" +" assert isinstance(data, str)" +msgstr "" + +#: ../../library/io.rst:1179 +msgid "" +"Generic protocol for writing to a file or other output stream. ``T`` will " +"usually be :class:`str` or :class:`bytes`, but can be any type that can be " +"written to the stream." +msgstr "" + +#: ../../library/io.rst:1187 +msgid "" +"Write *data* to the output stream and return the number of items (bytes/" +"characters) written." +msgstr "" + +#: ../../library/io.rst:1192 +msgid "" +"def write_binary(writer: Writer[bytes]):\n" +" writer.write(b\"Hello world!\\n\")" +msgstr "" + +#: ../../library/io.rst:1195 +msgid "" +"See :ref:`typing-io` for other I/O related protocols and classes that can be " +"used for static type checking." +msgstr "" + +#: ../../library/io.rst:1199 msgid "Performance" msgstr "" -#: ../../library/io.rst:1142 +#: ../../library/io.rst:1201 msgid "" "This section discusses the performance of the provided concrete I/O " "implementations." msgstr "" -#: ../../library/io.rst:1148 +#: ../../library/io.rst:1207 msgid "" "By reading and writing only large chunks of data even when the user asks for " "a single byte, buffered I/O hides any inefficiency in calling and executing " @@ -1806,61 +1895,61 @@ msgid "" "data." msgstr "" -#: ../../library/io.rst:1160 +#: ../../library/io.rst:1219 msgid "" "Text I/O over a binary storage (such as a file) is significantly slower than " "binary I/O over the same storage, because it requires conversions between " "unicode and binary data using a character codec. This can become noticeable " -"handling huge amounts of text data like large log files. Also, :meth:" -"`~TextIOBase.tell` and :meth:`~TextIOBase.seek` are both quite slow due to " -"the reconstruction algorithm used." +"handling huge amounts of text data like large log files. " +"Also, :meth:`~TextIOBase.tell` and :meth:`~TextIOBase.seek` are both quite " +"slow due to the reconstruction algorithm used." msgstr "" -#: ../../library/io.rst:1167 +#: ../../library/io.rst:1226 msgid "" ":class:`StringIO`, however, is a native in-memory unicode container and will " "exhibit similar speed to :class:`BytesIO`." msgstr "" -#: ../../library/io.rst:1171 +#: ../../library/io.rst:1230 msgid "Multi-threading" msgstr "" -#: ../../library/io.rst:1173 +#: ../../library/io.rst:1232 msgid "" ":class:`FileIO` objects are thread-safe to the extent that the operating " "system calls (such as :manpage:`read(2)` under Unix) they wrap are thread-" "safe too." msgstr "" -#: ../../library/io.rst:1176 +#: ../../library/io.rst:1235 msgid "" -"Binary buffered objects (instances of :class:`BufferedReader`, :class:" -"`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) " -"protect their internal structures using a lock; it is therefore safe to call " -"them from multiple threads at once." +"Binary buffered objects (instances " +"of :class:`BufferedReader`, :class:`BufferedWriter`, :class:`BufferedRandom` " +"and :class:`BufferedRWPair`) protect their internal structures using a lock; " +"it is therefore safe to call them from multiple threads at once." msgstr "" -#: ../../library/io.rst:1181 +#: ../../library/io.rst:1240 msgid ":class:`TextIOWrapper` objects are not thread-safe." msgstr "" -#: ../../library/io.rst:1184 +#: ../../library/io.rst:1243 msgid "Reentrancy" msgstr "" -#: ../../library/io.rst:1186 +#: ../../library/io.rst:1245 msgid "" -"Binary buffered objects (instances of :class:`BufferedReader`, :class:" -"`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) are " -"not reentrant. While reentrant calls will not happen in normal situations, " -"they can arise from doing I/O in a :mod:`signal` handler. If a thread tries " -"to re-enter a buffered object which it is already accessing, a :exc:" -"`RuntimeError` is raised. Note this doesn't prohibit a different thread " -"from entering the buffered object." +"Binary buffered objects (instances " +"of :class:`BufferedReader`, :class:`BufferedWriter`, :class:`BufferedRandom` " +"and :class:`BufferedRWPair`) are not reentrant. While reentrant calls will " +"not happen in normal situations, they can arise from doing I/O in " +"a :mod:`signal` handler. If a thread tries to re-enter a buffered object " +"which it is already accessing, a :exc:`RuntimeError` is raised. Note this " +"doesn't prohibit a different thread from entering the buffered object." msgstr "" -#: ../../library/io.rst:1194 +#: ../../library/io.rst:1253 msgid "" "The above implicitly extends to text files, since the :func:`open` function " "will wrap a buffered object inside a :class:`TextIOWrapper`. This includes " @@ -1876,15 +1965,15 @@ msgstr "file object(檔案物件)" msgid "io module" msgstr "io 模組" -#: ../../library/io.rst:979 ../../library/io.rst:1130 +#: ../../library/io.rst:984 ../../library/io.rst:1140 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/io.rst:979 +#: ../../library/io.rst:984 msgid "io.TextIOWrapper class" msgstr "io.TextIOWrapper 類別" -#: ../../library/io.rst:1130 +#: ../../library/io.rst:1140 msgid "io.IncrementalNewlineDecoder class" msgstr "io.IncrementalNewlineDecoder 類別" @@ -1911,13 +2000,14 @@ msgstr "io.IncrementalNewlineDecoder 類別" #~ msgid "" #~ "Read and return up to *size* bytes, with at most one call to the " -#~ "underlying raw stream's :meth:`~RawIOBase.read` (or :meth:`~RawIOBase." -#~ "readinto`) method. This can be useful if you are implementing your own " -#~ "buffering on top of a :class:`BufferedIOBase` object." +#~ "underlying raw stream's :meth:`~RawIOBase.read` " +#~ "(or :meth:`~RawIOBase.readinto`) method. This can be useful if you are " +#~ "implementing your own buffering on top of a :class:`BufferedIOBase` " +#~ "object." #~ msgstr "" -#~ "讀取並回傳最多 *size* 個位元組,最多呼叫一次底層原始串流的 :meth:" -#~ "`~RawIOBase.read` (或 :meth:`~RawIOBase.readinto`) 方法。如果你正在 :" -#~ "class:`BufferedIOBase` 物件之上實作自己的緩衝區,這可能會很有用。" +#~ "讀取並回傳最多 *size* 個位元組,最多呼叫一次底層原始串流" +#~ "的 :meth:`~RawIOBase.read` (或 :meth:`~RawIOBase.readinto`) 方法。如果你正" +#~ "在 :class:`BufferedIOBase` 物件之上實作自己的緩衝區,這可能會很有用。" #~ msgid "" #~ "If *size* is ``-1`` (the default), an arbitrary number of bytes are " diff --git a/library/ipaddress.po b/library/ipaddress.po index 7b51f912d2f..55181cc2211 100644 --- a/library/ipaddress.po +++ b/library/ipaddress.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-20 00:19+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,8 +42,8 @@ msgstr "" #: ../../library/ipaddress.rst:22 msgid "" -"This is the full module API reference—for an overview and introduction, see :" -"ref:`ipaddress-howto`." +"This is the full module API reference—for an overview and introduction, " +"see :ref:`ipaddress-howto`." msgstr "" #: ../../library/ipaddress.rst:35 @@ -81,9 +81,9 @@ msgid "" "Return an :class:`IPv4Interface` or :class:`IPv6Interface` object depending " "on the IP address passed as argument. *address* is a string or integer " "representing the IP address. Either IPv4 or IPv6 addresses may be supplied; " -"integers less than ``2**32`` will be considered to be IPv4 by default. A :" -"exc:`ValueError` is raised if *address* does not represent a valid IPv4 or " -"IPv6 address." +"integers less than ``2**32`` will be considered to be IPv4 by default. " +"A :exc:`ValueError` is raised if *address* does not represent a valid IPv4 " +"or IPv6 address." msgstr "" #: ../../library/ipaddress.rst:77 @@ -157,25 +157,29 @@ msgstr "" msgid "The appropriate version number: ``4`` for IPv4, ``6`` for IPv6." msgstr "" -#: ../../library/ipaddress.rst:136 +#: ../../library/ipaddress.rst:136 ../../library/ipaddress.rst:149 +msgid "Made available on the class." +msgstr "" + +#: ../../library/ipaddress.rst:140 msgid "" "The total number of bits in the address representation for this version: " "``32`` for IPv4, ``128`` for IPv6." msgstr "" -#: ../../library/ipaddress.rst:139 +#: ../../library/ipaddress.rst:143 msgid "" "The prefix defines the number of leading bits in an address that are " "compared to determine whether or not an address is part of a network." msgstr "" -#: ../../library/ipaddress.rst:146 +#: ../../library/ipaddress.rst:154 msgid "" "The string representation in dotted decimal notation. Leading zeroes are " "never included in the representation." msgstr "" -#: ../../library/ipaddress.rst:149 +#: ../../library/ipaddress.rst:157 msgid "" "As IPv4 does not define a shorthand notation for addresses with octets set " "to zero, these two attributes are always the same as ``str(addr)`` for IPv4 " @@ -183,18 +187,18 @@ msgid "" "that can handle both IPv4 and IPv6 addresses." msgstr "" -#: ../../library/ipaddress.rst:156 +#: ../../library/ipaddress.rst:164 msgid "" "The binary representation of this address - a :class:`bytes` object of the " "appropriate length (most significant octet first). This is 4 bytes for IPv4 " "and 16 bytes for IPv6." msgstr "" -#: ../../library/ipaddress.rst:162 +#: ../../library/ipaddress.rst:170 msgid "The name of the reverse DNS PTR record for the IP address, e.g.::" msgstr "" -#: ../../library/ipaddress.rst:164 +#: ../../library/ipaddress.rst:172 msgid "" ">>> ipaddress.ip_address(\"127.0.0.1\").reverse_pointer\n" "'1.0.0.127.in-addr.arpa'\n" @@ -206,67 +210,67 @@ msgstr "" ">>> ipaddress.ip_address(\"2001:db8::1\").reverse_pointer\n" "'1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'" -#: ../../library/ipaddress.rst:169 +#: ../../library/ipaddress.rst:177 msgid "" "This is the name that could be used for performing a PTR lookup, not the " "resolved hostname itself." msgstr "" -#: ../../library/ipaddress.rst:176 +#: ../../library/ipaddress.rst:184 msgid "" "``True`` if the address is reserved for multicast use. See :RFC:`3171` (for " "IPv4) or :RFC:`2373` (for IPv6)." msgstr "" -#: ../../library/ipaddress.rst:181 +#: ../../library/ipaddress.rst:189 msgid "" "``True`` if the address is defined as not globally reachable by iana-ipv4-" "special-registry_ (for IPv4) or iana-ipv6-special-registry_ (for IPv6) with " "the following exceptions:" msgstr "" -#: ../../library/ipaddress.rst:185 +#: ../../library/ipaddress.rst:193 msgid "" "``is_private`` is ``False`` for the shared address space (``100.64.0.0/10``)" msgstr "" -#: ../../library/ipaddress.rst:186 ../../library/ipaddress.rst:213 +#: ../../library/ipaddress.rst:194 ../../library/ipaddress.rst:221 msgid "" "For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the " "semantics of the underlying IPv4 addresses and the following condition holds " "(see :attr:`IPv6Address.ipv4_mapped`)::" msgstr "" -#: ../../library/ipaddress.rst:190 +#: ../../library/ipaddress.rst:198 msgid "address.is_private == address.ipv4_mapped.is_private" msgstr "address.is_private == address.ipv4_mapped.is_private" -#: ../../library/ipaddress.rst:192 +#: ../../library/ipaddress.rst:200 msgid "" "``is_private`` has value opposite to :attr:`is_global`, except for the " "shared address space (``100.64.0.0/10`` range) where they are both ``False``." msgstr "" -#: ../../library/ipaddress.rst:197 +#: ../../library/ipaddress.rst:205 msgid "Fixed some false positives and false negatives." msgstr "" -#: ../../library/ipaddress.rst:199 +#: ../../library/ipaddress.rst:207 msgid "" "``192.0.0.0/24`` is considered private with the exception of " "``192.0.0.9/32`` and ``192.0.0.10/32`` (previously: only the " "``192.0.0.0/29`` sub-range was considered private)." msgstr "" -#: ../../library/ipaddress.rst:201 +#: ../../library/ipaddress.rst:209 msgid "``64:ff9b:1::/48`` is considered private." msgstr "" -#: ../../library/ipaddress.rst:202 +#: ../../library/ipaddress.rst:210 msgid "``2002::/16`` is considered private." msgstr "" -#: ../../library/ipaddress.rst:203 +#: ../../library/ipaddress.rst:211 msgid "" "There are exceptions within ``2001::/23`` (otherwise considered private): " "``2001:1::1/128``, ``2001:1::2/128``, ``2001:3::/32``, ``2001:4:112::/48``, " @@ -274,36 +278,36 @@ msgid "" "private." msgstr "" -#: ../../library/ipaddress.rst:209 +#: ../../library/ipaddress.rst:217 msgid "" "``True`` if the address is defined as globally reachable by iana-ipv4-" "special-registry_ (for IPv4) or iana-ipv6-special-registry_ (for IPv6) with " "the following exception:" msgstr "" -#: ../../library/ipaddress.rst:217 +#: ../../library/ipaddress.rst:225 msgid "address.is_global == address.ipv4_mapped.is_global" msgstr "address.is_global == address.ipv4_mapped.is_global" -#: ../../library/ipaddress.rst:219 +#: ../../library/ipaddress.rst:227 msgid "" "``is_global`` has value opposite to :attr:`is_private`, except for the " "shared address space (``100.64.0.0/10`` range) where they are both ``False``." msgstr "" -#: ../../library/ipaddress.rst:226 +#: ../../library/ipaddress.rst:234 msgid "" "Fixed some false positives and false negatives, see :attr:`is_private` for " "details." msgstr "" -#: ../../library/ipaddress.rst:230 +#: ../../library/ipaddress.rst:238 msgid "" -"``True`` if the address is unspecified. See :RFC:`5735` (for IPv4) or :RFC:" -"`2373` (for IPv6)." +"``True`` if the address is unspecified. See :RFC:`5735` (for IPv4) " +"or :RFC:`2373` (for IPv6)." msgstr "" -#: ../../library/ipaddress.rst:235 +#: ../../library/ipaddress.rst:243 msgid "" "``True`` if the address is noted as reserved by the IETF. For IPv4, this is " "only ``240.0.0.0/4``, the ``Reserved`` address block. For IPv6, this is all " @@ -311,37 +315,37 @@ msgid "" "for future use." msgstr "" -#: ../../library/ipaddress.rst:240 +#: ../../library/ipaddress.rst:248 msgid "" "For IPv4, ``is_reserved`` is not related to the address block value of the " "``Reserved-by-Protocol`` column in iana-ipv4-special-registry_." msgstr "" -#: ../../library/ipaddress.rst:243 +#: ../../library/ipaddress.rst:251 msgid "" "For IPv6, ``fec0::/10`` a former Site-Local scoped address prefix is " -"currently excluded from that list (see :attr:`~IPv6Address.is_site_local` & :" -"rfc:`3879`)." +"currently excluded from that list (see :attr:`~IPv6Address.is_site_local` " +"& :rfc:`3879`)." msgstr "" -#: ../../library/ipaddress.rst:248 +#: ../../library/ipaddress.rst:256 msgid "" -"``True`` if this is a loopback address. See :RFC:`3330` (for IPv4) or :RFC:" -"`2373` (for IPv6)." +"``True`` if this is a loopback address. See :RFC:`3330` (for IPv4) " +"or :RFC:`2373` (for IPv6)." msgstr "" -#: ../../library/ipaddress.rst:253 +#: ../../library/ipaddress.rst:261 msgid "" "``True`` if the address is reserved for link-local usage. See :RFC:`3927`." msgstr "" -#: ../../library/ipaddress.rst:258 +#: ../../library/ipaddress.rst:266 msgid "" -":class:`IPv4Address` object representing the IPv4-mapped IPv6 address. See :" -"RFC:`4291`." +":class:`IPv4Address` object representing the IPv4-mapped IPv6 address. " +"See :RFC:`4291`." msgstr "" -#: ../../library/ipaddress.rst:269 +#: ../../library/ipaddress.rst:277 msgid "" "Returns a string representation of the IP address, controlled by an explicit " "format string. *fmt* can be one of the following: ``'s'``, the default " @@ -353,17 +357,17 @@ msgid "" "used by ``format``, ``str.format`` and f-strings." msgstr "" -#: ../../library/ipaddress.rst:296 +#: ../../library/ipaddress.rst:304 msgid "" "Construct an IPv6 address. An :exc:`AddressValueError` is raised if " "*address* is not a valid IPv6 address." msgstr "" -#: ../../library/ipaddress.rst:299 +#: ../../library/ipaddress.rst:307 msgid "The following constitutes a valid IPv6 address:" msgstr "" -#: ../../library/ipaddress.rst:301 +#: ../../library/ipaddress.rst:309 msgid "" "A string consisting of eight groups of four hexadecimal digits, each group " "representing 16 bits. The groups are separated by colons. This describes an " @@ -373,7 +377,7 @@ msgid "" "to ``\"::abc:7:def\"``." msgstr "" -#: ../../library/ipaddress.rst:309 +#: ../../library/ipaddress.rst:317 msgid "" "Optionally, the string may also have a scope zone ID, expressed with a " "suffix ``%scope_id``. If present, the scope ID must be non-empty, and may " @@ -382,61 +386,61 @@ msgid "" "the node." msgstr "" -#: ../../library/ipaddress.rst:314 +#: ../../library/ipaddress.rst:322 msgid "An integer that fits into 128 bits." msgstr "" -#: ../../library/ipaddress.rst:315 +#: ../../library/ipaddress.rst:323 msgid "" "An integer packed into a :class:`bytes` object of length 16, big-endian." msgstr "" -#: ../../library/ipaddress.rst:325 +#: ../../library/ipaddress.rst:333 msgid "" "The short form of the address representation, with leading zeroes in groups " "omitted and the longest sequence of groups consisting entirely of zeroes " "collapsed to a single empty group." msgstr "" -#: ../../library/ipaddress.rst:329 +#: ../../library/ipaddress.rst:337 msgid "This is also the value returned by ``str(addr)`` for IPv6 addresses." msgstr "" -#: ../../library/ipaddress.rst:333 +#: ../../library/ipaddress.rst:341 msgid "" "The long form of the address representation, with all leading zeroes and " "groups consisting entirely of zeroes included." msgstr "" -#: ../../library/ipaddress.rst:337 +#: ../../library/ipaddress.rst:345 msgid "" "For the following attributes and methods, see the corresponding " "documentation of the :class:`IPv4Address` class:" msgstr "" -#: ../../library/ipaddress.rst:357 +#: ../../library/ipaddress.rst:365 msgid "" "``True`` if the address is reserved for site-local usage. Note that the " -"site-local address space has been deprecated by :RFC:`3879`. Use :attr:" -"`~IPv4Address.is_private` to test if this address is in the space of unique " -"local addresses as defined by :RFC:`4193`." +"site-local address space has been deprecated by :RFC:`3879`. " +"Use :attr:`~IPv4Address.is_private` to test if this address is in the space " +"of unique local addresses as defined by :RFC:`4193`." msgstr "" -#: ../../library/ipaddress.rst:364 +#: ../../library/ipaddress.rst:372 msgid "" -"For addresses that appear to be IPv4 mapped addresses (starting with ``::" -"FFFF/96``), this property will report the embedded IPv4 address. For any " +"For addresses that appear to be IPv4 mapped addresses (starting with " +"``::FFFF/96``), this property will report the embedded IPv4 address. For any " "other address, this property will be ``None``." msgstr "" -#: ../../library/ipaddress.rst:370 +#: ../../library/ipaddress.rst:378 msgid "" "For scoped addresses as defined by :RFC:`4007`, this property identifies the " "particular zone of the address's scope that the address belongs to, as a " "string. When no scope zone is specified, this property will be ``None``." msgstr "" -#: ../../library/ipaddress.rst:376 +#: ../../library/ipaddress.rst:384 msgid "" "For addresses that appear to be 6to4 addresses (starting with " "``2002::/16``) as defined by :RFC:`3056`, this property will report the " @@ -444,7 +448,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ipaddress.rst:383 +#: ../../library/ipaddress.rst:391 msgid "" "For addresses that appear to be Teredo addresses (starting with " "``2001::/32``) as defined by :RFC:`4380`, this property will report the " @@ -452,23 +456,23 @@ msgid "" "property will be ``None``." msgstr "" -#: ../../library/ipaddress.rst:390 +#: ../../library/ipaddress.rst:398 msgid "" "Refer to the corresponding method documentation in :class:`IPv4Address`." msgstr "" -#: ../../library/ipaddress.rst:396 +#: ../../library/ipaddress.rst:404 msgid "Conversion to Strings and Integers" msgstr "" -#: ../../library/ipaddress.rst:398 +#: ../../library/ipaddress.rst:406 msgid "" "To interoperate with networking interfaces such as the socket module, " "addresses must be converted to strings or integers. This is handled using " "the :func:`str` and :func:`int` builtin functions::" msgstr "" -#: ../../library/ipaddress.rst:402 +#: ../../library/ipaddress.rst:410 msgid "" ">>> str(ipaddress.IPv4Address('192.168.0.1'))\n" "'192.168.0.1'\n" @@ -488,36 +492,36 @@ msgstr "" ">>> int(ipaddress.IPv6Address('::1'))\n" "1" -#: ../../library/ipaddress.rst:411 +#: ../../library/ipaddress.rst:419 msgid "" "Note that IPv6 scoped addresses are converted to integers without scope zone " "ID." msgstr "" -#: ../../library/ipaddress.rst:415 ../../library/ipaddress.rst:799 -#: ../../library/ipaddress.rst:935 +#: ../../library/ipaddress.rst:423 ../../library/ipaddress.rst:807 +#: ../../library/ipaddress.rst:943 msgid "Operators" msgstr "運算子" -#: ../../library/ipaddress.rst:417 +#: ../../library/ipaddress.rst:425 msgid "" "Address objects support some operators. Unless stated otherwise, operators " "can only be applied between compatible objects (i.e. IPv4 with IPv4, IPv6 " "with IPv6)." msgstr "" -#: ../../library/ipaddress.rst:423 +#: ../../library/ipaddress.rst:431 msgid "Comparison operators" msgstr "比較運算子" -#: ../../library/ipaddress.rst:425 +#: ../../library/ipaddress.rst:433 msgid "" "Address objects can be compared with the usual set of comparison operators. " "Same IPv6 addresses with different scope zone IDs are not equal. Some " "examples::" msgstr "" -#: ../../library/ipaddress.rst:429 +#: ../../library/ipaddress.rst:437 msgid "" ">>> IPv4Address('127.0.0.2') > IPv4Address('127.0.0.1')\n" "True\n" @@ -541,16 +545,16 @@ msgstr "" ">>> IPv6Address('fe80::1234%1') != IPv6Address('fe80::1234%2')\n" "True" -#: ../../library/ipaddress.rst:442 +#: ../../library/ipaddress.rst:450 msgid "Arithmetic operators" msgstr "算術運算子" -#: ../../library/ipaddress.rst:444 +#: ../../library/ipaddress.rst:452 msgid "" "Integers can be added to or subtracted from address objects. Some examples::" msgstr "" -#: ../../library/ipaddress.rst:446 +#: ../../library/ipaddress.rst:454 msgid "" ">>> IPv4Address('127.0.0.2') + 3\n" "IPv4Address('127.0.0.5')\n" @@ -572,11 +576,11 @@ msgstr "" "ipaddress.AddressValueError: 4294967296 (>= 2**32) is not permitted as an " "IPv4 address" -#: ../../library/ipaddress.rst:457 +#: ../../library/ipaddress.rst:465 msgid "IP Network definitions" msgstr "" -#: ../../library/ipaddress.rst:459 +#: ../../library/ipaddress.rst:467 msgid "" "The :class:`IPv4Network` and :class:`IPv6Network` objects provide a " "mechanism for defining and inspecting IP network definitions. A network " @@ -587,11 +591,11 @@ msgid "" "addresses in the inclusive range ``192.168.1.0`` to ``192.168.1.255``." msgstr "" -#: ../../library/ipaddress.rst:469 +#: ../../library/ipaddress.rst:477 msgid "Prefix, net mask and host mask" msgstr "" -#: ../../library/ipaddress.rst:471 +#: ../../library/ipaddress.rst:479 msgid "" "There are several equivalent ways to specify IP network masks. A *prefix* " "``/`` is a notation that denotes how many high-order bits are set in " @@ -603,26 +607,26 @@ msgid "" "mask equivalent to ``/24`` in IPv4 is ``0.0.0.255``." msgstr "" -#: ../../library/ipaddress.rst:482 +#: ../../library/ipaddress.rst:490 msgid "Network objects" msgstr "" -#: ../../library/ipaddress.rst:484 +#: ../../library/ipaddress.rst:492 msgid "" "All attributes implemented by address objects are implemented by network " "objects as well. In addition, network objects implement additional " -"attributes. All of these are common between :class:`IPv4Network` and :class:" -"`IPv6Network`, so to avoid duplication they are only documented for :class:" -"`IPv4Network`. Network objects are :term:`hashable`, so they can be used as " -"keys in dictionaries." +"attributes. All of these are common between :class:`IPv4Network` " +"and :class:`IPv6Network`, so to avoid duplication they are only documented " +"for :class:`IPv4Network`. Network objects are :term:`hashable`, so they can " +"be used as keys in dictionaries." msgstr "" -#: ../../library/ipaddress.rst:493 +#: ../../library/ipaddress.rst:501 msgid "" "Construct an IPv4 network definition. *address* can be one of the following:" msgstr "" -#: ../../library/ipaddress.rst:495 +#: ../../library/ipaddress.rst:503 msgid "" "A string consisting of an IP address and an optional mask, separated by a " "slash (``/``). The IP address is the network address, and the mask can be " @@ -634,120 +638,120 @@ msgid "" "it's considered to be ``/32``." msgstr "" -#: ../../library/ipaddress.rst:504 +#: ../../library/ipaddress.rst:512 msgid "" "For example, the following *address* specifications are equivalent: " "``192.168.1.0/24``, ``192.168.1.0/255.255.255.0`` and " "``192.168.1.0/0.0.0.255``." msgstr "" -#: ../../library/ipaddress.rst:508 +#: ../../library/ipaddress.rst:516 msgid "" "An integer that fits into 32 bits. This is equivalent to a single-address " "network, with the network address being *address* and the mask being ``/32``." msgstr "" -#: ../../library/ipaddress.rst:512 +#: ../../library/ipaddress.rst:520 msgid "" "An integer packed into a :class:`bytes` object of length 4, big-endian. The " "interpretation is similar to an integer *address*." msgstr "" -#: ../../library/ipaddress.rst:515 +#: ../../library/ipaddress.rst:523 msgid "" "A two-tuple of an address description and a netmask, where the address " "description is either a string, a 32-bits integer, a 4-bytes packed integer, " -"or an existing IPv4Address object; and the netmask is either an integer " -"representing the prefix length (e.g. ``24``) or a string representing the " -"prefix mask (e.g. ``255.255.255.0``)." +"or an existing :class:`IPv4Address` object; and the netmask is either an " +"integer representing the prefix length (e.g. ``24``) or a string " +"representing the prefix mask (e.g. ``255.255.255.0``)." msgstr "" -#: ../../library/ipaddress.rst:521 +#: ../../library/ipaddress.rst:529 msgid "" "An :exc:`AddressValueError` is raised if *address* is not a valid IPv4 " "address. A :exc:`NetmaskValueError` is raised if the mask is not valid for " "an IPv4 address." msgstr "" -#: ../../library/ipaddress.rst:525 ../../library/ipaddress.rst:745 +#: ../../library/ipaddress.rst:533 ../../library/ipaddress.rst:753 msgid "" -"If *strict* is ``True`` and host bits are set in the supplied address, then :" -"exc:`ValueError` is raised. Otherwise, the host bits are masked out to " -"determine the appropriate network address." +"If *strict* is ``True`` and host bits are set in the supplied address, " +"then :exc:`ValueError` is raised. Otherwise, the host bits are masked out " +"to determine the appropriate network address." msgstr "" -#: ../../library/ipaddress.rst:529 +#: ../../library/ipaddress.rst:537 msgid "" "Unless stated otherwise, all network methods accepting other network/address " "objects will raise :exc:`TypeError` if the argument's IP version is " "incompatible to ``self``." msgstr "" -#: ../../library/ipaddress.rst:535 ../../library/ipaddress.rst:751 +#: ../../library/ipaddress.rst:543 ../../library/ipaddress.rst:759 msgid "Added the two-tuple form for the *address* constructor parameter." msgstr "" -#: ../../library/ipaddress.rst:540 +#: ../../library/ipaddress.rst:548 msgid "" "Refer to the corresponding attribute documentation in :class:`IPv4Address`." msgstr "" -#: ../../library/ipaddress.rst:550 +#: ../../library/ipaddress.rst:558 msgid "" "These attributes are true for the network as a whole if they are true for " "both the network address and the broadcast address." msgstr "" -#: ../../library/ipaddress.rst:555 +#: ../../library/ipaddress.rst:563 msgid "" "The network address for the network. The network address and the prefix " "length together uniquely define a network." msgstr "" -#: ../../library/ipaddress.rst:560 +#: ../../library/ipaddress.rst:568 msgid "" "The broadcast address for the network. Packets sent to the broadcast address " "should be received by every host on the network." msgstr "" -#: ../../library/ipaddress.rst:565 +#: ../../library/ipaddress.rst:573 msgid "The host mask, as an :class:`IPv4Address` object." msgstr "" -#: ../../library/ipaddress.rst:569 +#: ../../library/ipaddress.rst:577 msgid "The net mask, as an :class:`IPv4Address` object." msgstr "" -#: ../../library/ipaddress.rst:575 +#: ../../library/ipaddress.rst:583 msgid "" "A string representation of the network, with the mask in prefix notation." msgstr "" -#: ../../library/ipaddress.rst:578 +#: ../../library/ipaddress.rst:586 msgid "" "``with_prefixlen`` and ``compressed`` are always the same as " "``str(network)``. ``exploded`` uses the exploded form the network address." msgstr "" -#: ../../library/ipaddress.rst:584 +#: ../../library/ipaddress.rst:592 msgid "" "A string representation of the network, with the mask in net mask notation." msgstr "" -#: ../../library/ipaddress.rst:589 +#: ../../library/ipaddress.rst:597 msgid "" "A string representation of the network, with the mask in host mask notation." msgstr "" -#: ../../library/ipaddress.rst:594 +#: ../../library/ipaddress.rst:602 msgid "The total number of addresses in the network." msgstr "" -#: ../../library/ipaddress.rst:598 +#: ../../library/ipaddress.rst:606 msgid "Length of the network prefix, in bits." msgstr "" -#: ../../library/ipaddress.rst:602 +#: ../../library/ipaddress.rst:610 msgid "" "Returns an iterator over the usable hosts in the network. The usable hosts " "are all the IP addresses that belong to the network, except the network " @@ -757,20 +761,21 @@ msgid "" "containing the single host address." msgstr "" -#: ../../library/ipaddress.rst:620 +#: ../../library/ipaddress.rst:628 msgid "" "``True`` if this network is partly or wholly contained in *other* or *other* " "is wholly contained in this network." msgstr "" -#: ../../library/ipaddress.rst:625 +#: ../../library/ipaddress.rst:633 msgid "" "Computes the network definitions resulting from removing the given *network* " -"from this one. Returns an iterator of network objects. Raises :exc:" -"`ValueError` if *network* is not completely contained in this network." +"from this one. Returns an iterator of network objects. " +"Raises :exc:`ValueError` if *network* is not completely contained in this " +"network." msgstr "" -#: ../../library/ipaddress.rst:638 +#: ../../library/ipaddress.rst:646 msgid "" "The subnets that join to make the current network definition, depending on " "the argument values. *prefixlen_diff* is the amount our prefix length " @@ -780,7 +785,7 @@ msgid "" "network objects." msgstr "" -#: ../../library/ipaddress.rst:663 +#: ../../library/ipaddress.rst:671 msgid "" "The supernet containing this network definition, depending on the argument " "values. *prefixlen_diff* is the amount our prefix length should be " @@ -789,33 +794,33 @@ msgid "" "*new_prefix* must be set. Returns a single network object." msgstr "" -#: ../../library/ipaddress.rst:679 +#: ../../library/ipaddress.rst:687 msgid "Return ``True`` if this network is a subnet of *other*." msgstr "" -#: ../../library/ipaddress.rst:690 +#: ../../library/ipaddress.rst:698 msgid "Return ``True`` if this network is a supernet of *other*." msgstr "" -#: ../../library/ipaddress.rst:701 +#: ../../library/ipaddress.rst:709 msgid "" "Compare this network to *other*. In this comparison only the network " "addresses are considered; host bits aren't. Returns either ``-1``, ``0`` or " "``1``." msgstr "" -#: ../../library/ipaddress.rst:712 +#: ../../library/ipaddress.rst:720 msgid "" "It uses the same ordering and comparison algorithm as \"<\", \"==\", and " "\">\"" msgstr "" -#: ../../library/ipaddress.rst:718 +#: ../../library/ipaddress.rst:726 msgid "" "Construct an IPv6 network definition. *address* can be one of the following:" msgstr "" -#: ../../library/ipaddress.rst:720 +#: ../../library/ipaddress.rst:728 msgid "" "A string consisting of an IP address and an optional prefix length, " "separated by a slash (``/``). The IP address is the network address, and " @@ -823,41 +828,42 @@ msgid "" "length is provided, it's considered to be ``/128``." msgstr "" -#: ../../library/ipaddress.rst:725 +#: ../../library/ipaddress.rst:733 msgid "" -"Note that currently expanded netmasks are not supported. That means ``2001:" -"db00::0/24`` is a valid argument while ``2001:db00::0/ffff:ff00::`` is not." +"Note that currently expanded netmasks are not supported. That means " +"``2001:db00::0/24`` is a valid argument while ``2001:db00::0/ffff:ff00::`` " +"is not." msgstr "" -#: ../../library/ipaddress.rst:729 +#: ../../library/ipaddress.rst:737 msgid "" "An integer that fits into 128 bits. This is equivalent to a single-address " -"network, with the network address being *address* and the mask being " -"``/128``." +"network, with the network address being *address* and the mask being ``/" +"128``." msgstr "" -#: ../../library/ipaddress.rst:733 +#: ../../library/ipaddress.rst:741 msgid "" "An integer packed into a :class:`bytes` object of length 16, big-endian. The " "interpretation is similar to an integer *address*." msgstr "" -#: ../../library/ipaddress.rst:736 +#: ../../library/ipaddress.rst:744 msgid "" "A two-tuple of an address description and a netmask, where the address " "description is either a string, a 128-bits integer, a 16-bytes packed " -"integer, or an existing IPv6Address object; and the netmask is an integer " -"representing the prefix length." +"integer, or an existing :class:`IPv6Address` object; and the netmask is an " +"integer representing the prefix length." msgstr "" -#: ../../library/ipaddress.rst:741 +#: ../../library/ipaddress.rst:749 msgid "" "An :exc:`AddressValueError` is raised if *address* is not a valid IPv6 " "address. A :exc:`NetmaskValueError` is raised if the mask is not valid for " "an IPv6 address." msgstr "" -#: ../../library/ipaddress.rst:774 +#: ../../library/ipaddress.rst:782 msgid "" "Returns an iterator over the usable hosts in the network. The usable hosts " "are all the IP addresses that belong to the network, except the Subnet-" @@ -866,46 +872,46 @@ msgid "" "of 128 will return a list containing the single host address." msgstr "" -#: ../../library/ipaddress.rst:789 +#: ../../library/ipaddress.rst:797 msgid "" "Refer to the corresponding attribute documentation in :class:`IPv4Network`." msgstr "" -#: ../../library/ipaddress.rst:794 +#: ../../library/ipaddress.rst:802 msgid "" -"These attribute is true for the network as a whole if it is true for both " -"the network address and the broadcast address." +"This attribute is true for the network as a whole if it is true for both the " +"network address and the broadcast address." msgstr "" -#: ../../library/ipaddress.rst:801 +#: ../../library/ipaddress.rst:809 msgid "" "Network objects support some operators. Unless stated otherwise, operators " "can only be applied between compatible objects (i.e. IPv4 with IPv4, IPv6 " "with IPv6)." msgstr "" -#: ../../library/ipaddress.rst:807 ../../library/ipaddress.rst:943 +#: ../../library/ipaddress.rst:815 ../../library/ipaddress.rst:951 msgid "Logical operators" msgstr "" -#: ../../library/ipaddress.rst:809 +#: ../../library/ipaddress.rst:817 msgid "" "Network objects can be compared with the usual set of logical operators. " "Network objects are ordered first by network address, then by net mask." msgstr "" -#: ../../library/ipaddress.rst:814 +#: ../../library/ipaddress.rst:822 msgid "Iteration" msgstr "疊代" -#: ../../library/ipaddress.rst:816 +#: ../../library/ipaddress.rst:824 msgid "" "Network objects can be iterated to list all the addresses belonging to the " "network. For iteration, *all* hosts are returned, including unusable hosts " "(for usable hosts, use the :meth:`~IPv4Network.hosts` method). An example::" msgstr "" -#: ../../library/ipaddress.rst:821 +#: ../../library/ipaddress.rst:829 msgid "" ">>> for addr in IPv4Network('192.0.2.0/28'):\n" "... addr\n" @@ -947,15 +953,15 @@ msgstr "" "IPv4Address('192.0.2.14')\n" "IPv4Address('192.0.2.15')" -#: ../../library/ipaddress.rst:843 +#: ../../library/ipaddress.rst:851 msgid "Networks as containers of addresses" msgstr "" -#: ../../library/ipaddress.rst:845 +#: ../../library/ipaddress.rst:853 msgid "Network objects can act as containers of addresses. Some examples::" msgstr "" -#: ../../library/ipaddress.rst:847 +#: ../../library/ipaddress.rst:855 msgid "" ">>> IPv4Network('192.0.2.0/28')[0]\n" "IPv4Address('192.0.2.0')\n" @@ -975,92 +981,92 @@ msgstr "" ">>> IPv4Address('192.0.3.6') in IPv4Network('192.0.2.0/28')\n" "False" -#: ../../library/ipaddress.rst:858 +#: ../../library/ipaddress.rst:866 msgid "Interface objects" msgstr "" -#: ../../library/ipaddress.rst:860 +#: ../../library/ipaddress.rst:868 msgid "" "Interface objects are :term:`hashable`, so they can be used as keys in " "dictionaries." msgstr "" -#: ../../library/ipaddress.rst:865 +#: ../../library/ipaddress.rst:873 msgid "" "Construct an IPv4 interface. The meaning of *address* is as in the " "constructor of :class:`IPv4Network`, except that arbitrary host addresses " "are always accepted." msgstr "" -#: ../../library/ipaddress.rst:869 +#: ../../library/ipaddress.rst:877 msgid "" ":class:`IPv4Interface` is a subclass of :class:`IPv4Address`, so it inherits " "all the attributes from that class. In addition, the following attributes " "are available:" msgstr "" -#: ../../library/ipaddress.rst:875 +#: ../../library/ipaddress.rst:883 msgid "The address (:class:`IPv4Address`) without network information." msgstr "" -#: ../../library/ipaddress.rst:883 +#: ../../library/ipaddress.rst:891 msgid "The network (:class:`IPv4Network`) this interface belongs to." msgstr "" -#: ../../library/ipaddress.rst:891 +#: ../../library/ipaddress.rst:899 msgid "" "A string representation of the interface with the mask in prefix notation." msgstr "" -#: ../../library/ipaddress.rst:899 +#: ../../library/ipaddress.rst:907 msgid "" "A string representation of the interface with the network as a net mask." msgstr "" -#: ../../library/ipaddress.rst:907 +#: ../../library/ipaddress.rst:915 msgid "" "A string representation of the interface with the network as a host mask." msgstr "" -#: ../../library/ipaddress.rst:916 +#: ../../library/ipaddress.rst:924 msgid "" "Construct an IPv6 interface. The meaning of *address* is as in the " "constructor of :class:`IPv6Network`, except that arbitrary host addresses " "are always accepted." msgstr "" -#: ../../library/ipaddress.rst:920 +#: ../../library/ipaddress.rst:928 msgid "" ":class:`IPv6Interface` is a subclass of :class:`IPv6Address`, so it inherits " "all the attributes from that class. In addition, the following attributes " "are available:" msgstr "" -#: ../../library/ipaddress.rst:930 +#: ../../library/ipaddress.rst:938 msgid "" "Refer to the corresponding attribute documentation in :class:`IPv4Interface`." msgstr "" -#: ../../library/ipaddress.rst:937 +#: ../../library/ipaddress.rst:945 msgid "" "Interface objects support some operators. Unless stated otherwise, " "operators can only be applied between compatible objects (i.e. IPv4 with " "IPv4, IPv6 with IPv6)." msgstr "" -#: ../../library/ipaddress.rst:945 +#: ../../library/ipaddress.rst:953 msgid "" "Interface objects can be compared with the usual set of logical operators." msgstr "" -#: ../../library/ipaddress.rst:947 +#: ../../library/ipaddress.rst:955 msgid "" "For equality comparison (``==`` and ``!=``), both the IP address and network " "must be the same for the objects to be equal. An interface will not compare " "equal to any address or network object." msgstr "" -#: ../../library/ipaddress.rst:951 +#: ../../library/ipaddress.rst:959 msgid "" "For ordering (``<``, ``>``, etc) the rules are different. Interface and " "address objects with the same IP version can be compared, and the address " @@ -1069,86 +1075,86 @@ msgid "" "then by their IP addresses." msgstr "" -#: ../../library/ipaddress.rst:959 +#: ../../library/ipaddress.rst:967 msgid "Other Module Level Functions" msgstr "" -#: ../../library/ipaddress.rst:961 +#: ../../library/ipaddress.rst:969 msgid "The module also provides the following module level functions:" msgstr "" -#: ../../library/ipaddress.rst:965 +#: ../../library/ipaddress.rst:973 msgid "" "Represent an address as 4 packed bytes in network (big-endian) order. " -"*address* is an integer representation of an IPv4 IP address. A :exc:" -"`ValueError` is raised if the integer is negative or too large to be an IPv4 " -"IP address." +"*address* is an integer representation of an IPv4 IP address. " +"A :exc:`ValueError` is raised if the integer is negative or too large to be " +"an IPv4 IP address." msgstr "" -#: ../../library/ipaddress.rst:978 +#: ../../library/ipaddress.rst:986 msgid "" "Represent an address as 16 packed bytes in network (big-endian) order. " -"*address* is an integer representation of an IPv6 IP address. A :exc:" -"`ValueError` is raised if the integer is negative or too large to be an IPv6 " -"IP address." +"*address* is an integer representation of an IPv6 IP address. " +"A :exc:`ValueError` is raised if the integer is negative or too large to be " +"an IPv6 IP address." msgstr "" -#: ../../library/ipaddress.rst:986 +#: ../../library/ipaddress.rst:994 msgid "" "Return an iterator of the summarized network range given the first and last " -"IP addresses. *first* is the first :class:`IPv4Address` or :class:" -"`IPv6Address` in the range and *last* is the last :class:`IPv4Address` or :" -"class:`IPv6Address` in the range. A :exc:`TypeError` is raised if *first* " -"or *last* are not IP addresses or are not of the same version. A :exc:" -"`ValueError` is raised if *last* is not greater than *first* or if *first* " -"address version is not 4 or 6." +"IP addresses. *first* is the first :class:`IPv4Address` " +"or :class:`IPv6Address` in the range and *last* is the " +"last :class:`IPv4Address` or :class:`IPv6Address` in the range. " +"A :exc:`TypeError` is raised if *first* or *last* are not IP addresses or " +"are not of the same version. A :exc:`ValueError` is raised if *last* is not " +"greater than *first* or if *first* address version is not 4 or 6." msgstr "" -#: ../../library/ipaddress.rst:1002 +#: ../../library/ipaddress.rst:1010 msgid "" -"Return an iterator of the collapsed :class:`IPv4Network` or :class:" -"`IPv6Network` objects. *addresses* is an :term:`iterable` of :class:" -"`IPv4Network` or :class:`IPv6Network` objects. A :exc:`TypeError` is raised " -"if *addresses* contains mixed version objects." +"Return an iterator of the collapsed :class:`IPv4Network` " +"or :class:`IPv6Network` objects. *addresses* is an :term:`iterable` " +"of :class:`IPv4Network` or :class:`IPv6Network` objects. A :exc:`TypeError` " +"is raised if *addresses* contains mixed version objects." msgstr "" -#: ../../library/ipaddress.rst:1015 +#: ../../library/ipaddress.rst:1023 msgid "" "Return a key suitable for sorting between networks and addresses. Address " "and Network objects are not sortable by default; they're fundamentally " "different, so the expression::" msgstr "" -#: ../../library/ipaddress.rst:1019 +#: ../../library/ipaddress.rst:1027 msgid "IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')" msgstr "IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')" -#: ../../library/ipaddress.rst:1021 +#: ../../library/ipaddress.rst:1029 msgid "" "doesn't make sense. There are some times however, where you may wish to " "have :mod:`ipaddress` sort these anyway. If you need to do this, you can " "use this function as the *key* argument to :func:`sorted`." msgstr "" -#: ../../library/ipaddress.rst:1025 +#: ../../library/ipaddress.rst:1033 msgid "*obj* is either a network or address object." msgstr "" -#: ../../library/ipaddress.rst:1029 +#: ../../library/ipaddress.rst:1037 msgid "Custom Exceptions" msgstr "" -#: ../../library/ipaddress.rst:1031 +#: ../../library/ipaddress.rst:1039 msgid "" "To support more specific error reporting from class constructors, the module " "defines the following exceptions:" msgstr "" -#: ../../library/ipaddress.rst:1036 +#: ../../library/ipaddress.rst:1044 msgid "Any value error related to the address." msgstr "" -#: ../../library/ipaddress.rst:1041 +#: ../../library/ipaddress.rst:1049 msgid "Any value error related to the net mask." msgstr "" diff --git a/library/itertools.po b/library/itertools.po index ade57219eeb..7cf3251f8ca 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-20 00:19+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -318,6 +318,11 @@ msgstr "it, n" msgid "it1, it2, ... itn splits one iterator into n" msgstr "it1, it2, ... itn,將一個疊代器分成 n 個" +#: ../../library/itertools.rst:61 +#, fuzzy +msgid "``tee('ABC', 2) → A B C, A B C``" +msgstr "``cycle('ABCD') → A B C D A B C D ...``" + #: ../../library/itertools.rst:62 msgid ":func:`zip_longest`" msgstr ":func:`zip_longest`" @@ -407,7 +412,8 @@ msgid "``AB AC AD BC BD CD``" msgstr "``AB AC AD BC BD CD``" #: ../../library/itertools.rst:82 -msgid "``combinations_with_replacement('ABCD', 2)``" +#, fuzzy +msgid "``combinations_with_replacement('ABCD', 2)``" msgstr "``combinations_with_replacement('ABCD', 2)``" #: ../../library/itertools.rst:82 @@ -505,10 +511,10 @@ msgid "" "www.ramseysolutions.com/real-estate/amortization-schedule>`_, accumulate the " "interest and apply payments:" msgstr "" -"*function* 引數可以被設定為 :func:`min` 以得到連續的最小值,設定為 :func:" -"`max` 以得到連續的最大值,或者設定為 :func:`operator.mul` 以得到連續的乘積。" -"也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) `_ :" +"*function* 引數可以被設定為 :func:`min` 以得到連續的最小值,設定" +"為 :func:`max` 以得到連續的最大值,或者設定為 :func:`operator.mul` 以得到連續" +"的乘積。也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) " +"`_ :" #: ../../library/itertools.rst:136 msgid "" @@ -662,9 +668,9 @@ msgstr "從輸入 *iterable* 中回傳長度為 *r* 的元素的子序列。" #: ../../library/itertools.rst:227 msgid "" "The output is a subsequence of :func:`product` keeping only entries that are " -"subsequences of the *iterable*. The length of the output is given by :func:" -"`math.comb` which computes ``n! / r! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero " -"when ``r > n``." +"subsequences of the *iterable*. The length of the output is given " +"by :func:`math.comb` which computes ``n! / r! / (n - r)!`` when ``0 ≤ r ≤ " +"n`` or zero when ``r > n``." msgstr "" "輸出是 :func:`product` 的子序列,僅保留作為 *iterable* 子序列的條目。輸出的長" "度由 :func:`math.comb` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / r! / (n - r)!" @@ -832,8 +838,8 @@ msgstr "" #: ../../library/itertools.rst:323 msgid "" "Make an iterator that returns evenly spaced values beginning with *start*. " -"Can be used with :func:`map` to generate consecutive data points or with :" -"func:`zip` to add sequence numbers. Roughly equivalent to::" +"Can be used with :func:`map` to generate consecutive data points or " +"with :func:`zip` to add sequence numbers. Roughly equivalent to::" msgstr "" "建立一個疊代器,回傳從 *start* 開始的等差的值。可以與 :func:`map` 一起使用來" "產生連續的資料點,或與 :func:`zip` 一起使用來增加序列號。大致等價於: ::" @@ -1013,9 +1019,9 @@ msgstr "" #: ../../library/itertools.rst:420 msgid "" "The returned group is itself an iterator that shares the underlying iterable " -"with :func:`groupby`. Because the source is shared, when the :func:" -"`groupby` object is advanced, the previous group is no longer visible. So, " -"if that data is needed later, it should be stored as a list::" +"with :func:`groupby`. Because the source is shared, when " +"the :func:`groupby` object is advanced, the previous group is no longer " +"visible. So, if that data is needed later, it should be stored as a list::" msgstr "" "回傳的群組本身是一個與 :func:`groupby` 共享底層可疊代物件的疊代器。由於來源是" "共享的,當 :func:`groupby` 物件前進時,前一個群組將不再可見。因此,如果之後需" @@ -1228,11 +1234,11 @@ msgstr "" #: ../../library/itertools.rst:536 msgid "" -"Return successive *r* length `permutations of elements `_ from the *iterable*." +"Return successive *r* length `permutations of elements `_ from the *iterable*." msgstr "" -"回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 `_ 。" +"回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 `_ 。" #: ../../library/itertools.rst:539 msgid "" @@ -1245,13 +1251,13 @@ msgstr "" #: ../../library/itertools.rst:543 msgid "" "The output is a subsequence of :func:`product` where entries with repeated " -"elements have been filtered out. The length of the output is given by :func:" -"`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero when " -"``r > n``." +"elements have been filtered out. The length of the output is given " +"by :func:`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or " +"zero when ``r > n``." msgstr "" -"輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度由 :" -"func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 ``r " -"> n`` 時為零。" +"輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度" +"由 :func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 " +"``r > n`` 時為零。" #: ../../library/itertools.rst:548 msgid "" @@ -1516,14 +1522,15 @@ msgid "" "the input iterator and there is no way to access it. This could be an issue " "if an application wants to further consume the input iterator after " "*takewhile* has been run to exhaustion. To work around this problem, " -"consider using `more-itertools before_and_after() `_ instead." +"consider using `more-itertools before_and_after() `_ instead." msgstr "" "注意,第一個不符合條件判斷的元素將從輸入疊代器中被消耗,且無法再存取它。如果" "應用程式希望在 *takewhile* 耗盡後進一步消耗輸入疊代器,這可能會是個問題。為了" "解決這個問題,可以考慮使用 `more-itertools 中的 before_and_after() `_ 作為替代。" +"more-itertools.readthedocs.io/en/stable/" +"api.html#more_itertools.before_and_after>`_ 作為替代。" #: ../../library/itertools.rst:691 msgid "Return *n* independent iterators from a single iterable." @@ -1601,9 +1608,9 @@ msgstr "" msgid "" "When the input *iterable* is already a tee iterator object, all members of " "the return tuple are constructed as if they had been produced by the " -"upstream :func:`tee` call. This \"flattening step\" allows nested :func:" -"`tee` calls to share the same underlying data chain and to have a single " -"update step rather than a chain of calls." +"upstream :func:`tee` call. This \"flattening step\" allows " +"nested :func:`tee` calls to share the same underlying data chain and to have " +"a single update step rather than a chain of calls." msgstr "" "當輸入的 *iterable* 已經是一個 tee 疊代物件時,回傳的 tuple(元組)中所有成員" "都會被建立,就如同它們是由上游的 :func:`tee` 呼叫所產生的一樣。這個「展平步" @@ -1653,19 +1660,19 @@ msgid "" "even if the original *iterable* is threadsafe." msgstr "" "``tee`` 疊代器不是執行緒安全 (threadsafe) 的。當同時使用由同一個 :func:`tee` " -"呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc:" -"`RuntimeError`。" +"呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引" +"發 :exc:`RuntimeError`。" #: ../../library/itertools.rst:758 msgid "" "This itertool may require significant auxiliary storage (depending on how " "much temporary data needs to be stored). In general, if one iterator uses " -"most or all of the data before another iterator starts, it is faster to use :" -"func:`list` instead of :func:`tee`." +"most or all of the data before another iterator starts, it is faster to " +"use :func:`list` instead of :func:`tee`." msgstr "" "此 itertool 可能需要大量的輔助儲存空間(取決於需要儲存多少臨時資料)。通常如" -"果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func:" -"`list` 會比 :func:`tee` 更快。" +"果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使" +"用 :func:`list` 會比 :func:`tee` 更快。" #: ../../library/itertools.rst:766 msgid "Make an iterator that aggregates elements from each of the *iterables*." @@ -1731,9 +1738,9 @@ msgstr "" #: ../../library/itertools.rst:798 msgid "" -"If one of the iterables is potentially infinite, then the :func:" -"`zip_longest` function should be wrapped with something that limits the " -"number of calls (for example :func:`islice` or :func:`takewhile`)." +"If one of the iterables is potentially infinite, then " +"the :func:`zip_longest` function should be wrapped with something that " +"limits the number of calls (for example :func:`islice` or :func:`takewhile`)." msgstr "" "如果其中一個 iterables 可能是無限的,那麼應該用別的可以限制呼叫次數的方法來包" "裝 :func:`zip_longest` 函式(例如 :func:`islice` 或 :func:`takewhile`)。" @@ -1756,16 +1763,16 @@ msgid "" "``chain.from_iterable`` is related to the concept of flattening. The " "recipes also give ideas about ways that the tools can be combined — for " "example, how ``starmap()`` and ``repeat()`` can work together. The recipes " -"also show patterns for using itertools with the :mod:`operator` and :mod:" -"`collections` modules as well as with the built-in itertools such as " -"``map()``, ``filter()``, ``reversed()``, and ``enumerate()``." +"also show patterns for using itertools with the :mod:`operator` " +"and :mod:`collections` modules as well as with the built-in itertools such " +"as ``map()``, ``filter()``, ``reversed()``, and ``enumerate()``." msgstr "" "itertools 應用技巧的主要目的是教學。這些應用技巧展示了對單個工具進行思考的各" "種方式 —— 例如,``chain.from_iterable`` 與攤平 (flattening) 的概念相關。這些" "應用技巧還提供了組合使用工具的想法 —— 例如,``starmap()`` 和 ``repeat()`` 如" -"何一起工作。另外還展示了將 itertools 與 :mod:`operator` 和 :mod:" -"`collections` 模組一同使用以及與內建 itertools(如 ``map()``、``filter()``、" -"``reversed()`` 和 ``enumerate()``)一同使用的模式。" +"何一起工作。另外還展示了將 itertools 與 :mod:`operator` " +"和 :mod:`collections` 模組一同使用以及與內建 itertools(如 ``map()``、" +"``filter()``、``reversed()`` 和 ``enumerate()``)一同使用的模式。" #: ../../library/itertools.rst:820 msgid "" @@ -1784,8 +1791,8 @@ msgid "" "Substantially all of these recipes and many, many others can be installed " "from the :pypi:`more-itertools` project found on the Python Package Index::" msgstr "" -"幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 :" -"pypi:`more-itertools` 專案中安裝: ::" +"幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上" +"的 :pypi:`more-itertools` 專案中安裝: ::" #: ../../library/itertools.rst:829 msgid "python -m pip install more-itertools" @@ -1806,8 +1813,8 @@ msgstr "" "可疊代物件一次性引入記憶體,能保持優異的記憶體性能。以\\ `函式風格 " "(functional style) `_ 將工具連接在一起,能將程式碼的數量維持在較少的情況。透過優先使" -"用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和\\ :" -"term:`產生器 `,則能保持高速度。" +"用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和" +"\\ :term:`產生器 `,則能保持高速度。" #: ../../library/itertools.rst:839 msgid "" diff --git a/library/json.po b/library/json.po index d12f9c5f5ab..b4521b9773f 100644 --- a/library/json.po +++ b/library/json.po @@ -8,7 +8,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-09-08 15:25+0800\n" "PO-Revision-Date: 2023-08-05 15:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,12 +30,12 @@ msgstr "**原始碼:**\\ :source:`Lib/json/__init__.py`" #: ../../library/json.rst:14 msgid "" -"`JSON (JavaScript Object Notation) `_, specified by :rfc:" -"`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, specified " +"by :rfc:`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, is a " -"lightweight data interchange format inspired by `JavaScript `_ object literal syntax (although it is not a " -"strict subset of JavaScript [#rfc-errata]_ )." +"lightweight data interchange format inspired by `JavaScript `_ object literal syntax (although it is " +"not a strict subset of JavaScript [#rfc-errata]_ )." msgstr "" "`JSON (JavaScript Object Notation) `_ 是一個輕量化的資料交" "換格式,在 :rfc:`7159`\\ (其廢棄了 :rfc:`4627`\\ )及 `ECMA-404 >> import json\n" ">>> def custom_json(obj):\n" "... if isinstance(obj, complex):\n" -"... return {'__complex__': True, 'real': obj.real, 'imag': obj." -"imag}\n" +"... return {'__complex__': True, 'real': obj.real, 'imag': " +"obj.imag}\n" "... raise TypeError(f'Cannot serialize object of {type(obj)}')\n" "...\n" ">>> json.dumps(1 + 2j, default=custom_json)\n" @@ -158,8 +158,8 @@ msgstr "" ">>> import json\n" ">>> def custom_json(obj):\n" "... if isinstance(obj, complex):\n" -"... return {'__complex__': True, 'real': obj.real, 'imag': obj." -"imag}\n" +"... return {'__complex__': True, 'real': obj.real, 'imag': " +"obj.imag}\n" "... raise TypeError(f'Cannot serialize object of {type(obj)}')\n" "...\n" ">>> json.dumps(1 + 2j, default=custom_json)\n" @@ -246,16 +246,18 @@ msgid "" msgstr "" #: ../../library/json.rst:124 -msgid "Using :mod:`json.tool` from the shell to validate and pretty-print:" +#, fuzzy +msgid "Using :mod:`json` from the shell to validate and pretty-print:" msgstr "在命令列介面裡使用 :mod:`json.tool` 來驗證 JSON 語法和美化呈現方式:" #: ../../library/json.rst:126 +#, fuzzy msgid "" -"$ echo '{\"json\":\"obj\"}' | python -m json.tool\n" +"$ echo '{\"json\":\"obj\"}' | python -m json\n" "{\n" " \"json\": \"obj\"\n" "}\n" -"$ echo '{1.2:3.4}' | python -m json.tool\n" +"$ echo '{1.2:3.4}' | python -m json\n" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" msgstr "" "$ echo '{\"json\":\"obj\"}' | python -m json.tool\n" @@ -300,8 +302,8 @@ msgid "" "conversion table `." msgstr "" "參考這個 :ref:`Python-to-JSON 轉換表 `\\ 將 *obj* 序列化為" -"符合 JSON 格式的串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:" -"`file-like object`)" +"符合 JSON 格式的串流,並寫入到 *fp* (一個支援 ``.write()`` 方法" +"的 :term:`file-like object`)" # SkyLull: 我想這裡的 "framed protocol" 指的是 # https://peps.python.org/pep-3154/#framing @@ -332,9 +334,9 @@ msgstr "" #: ../../library/json.rst:178 msgid "" -"If ``True``, keys that are not of a basic type (:class:`str`, :class:`int`, :" -"class:`float`, :class:`bool`, ``None``) will be skipped instead of raising " -"a :exc:`TypeError`. Default ``False``." +"If ``True``, keys that are not of a basic type " +"(:class:`str`, :class:`int`, :class:`float`, :class:`bool`, ``None``) will " +"be skipped instead of raising a :exc:`TypeError`. Default ``False``." msgstr "" #: ../../library/json.rst:184 @@ -396,8 +398,8 @@ msgstr "" #: ../../library/json.rst:227 msgid "" "A function that is called for objects that can't otherwise be serialized. It " -"should return a JSON encodable version of the object or raise a :exc:" -"`TypeError`. If ``None`` (the default), :exc:`!TypeError` is raised." +"should return a JSON encodable version of the object or raise " +"a :exc:`TypeError`. If ``None`` (the default), :exc:`!TypeError` is raised." msgstr "" #: ../../library/json.rst:234 @@ -422,11 +424,11 @@ msgstr "" #: ../../library/json.rst:253 msgid "" "Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion " -"table `. The arguments have the same meaning as in :func:" -"`dump`." +"table `. The arguments have the same meaning as " +"in :func:`dump`." msgstr "" -"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格式 :" -"class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" +"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格" +"式 :class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" #: ../../library/json.rst:259 msgid "" @@ -458,8 +460,8 @@ msgstr "" #: ../../library/json.rst:278 msgid "" "If set, a custom JSON decoder. Additional keyword arguments to :func:`!load` " -"will be passed to the constructor of *cls*. If ``None`` (the default), :" -"class:`!JSONDecoder` is used." +"will be passed to the constructor of *cls*. If ``None`` (the " +"default), :class:`!JSONDecoder` is used." msgstr "" #: ../../library/json.rst:285 @@ -495,8 +497,8 @@ msgstr "" msgid "" "If set, a function that is called with the string of every JSON float to be " "decoded. If ``None`` (the default), it is equivalent to ``float(num_str)``. " -"This can be used to parse JSON floats into custom datatypes, for example :" -"class:`decimal.Decimal`." +"This can be used to parse JSON floats into custom datatypes, for " +"example :class:`decimal.Decimal`." msgstr "" "*parse_float* 為可選函式,每個要被解碼的 JSON 浮點數字串都會改用這個參數給定" "的函式來進行解碼。預設情況這等效於 ``float(num_str)``。這個參數可用於將 JSON " @@ -507,8 +509,8 @@ msgstr "" msgid "" "If set, a function that is called with the string of every JSON int to be " "decoded. If ``None`` (the default), it is equivalent to ``int(num_str)``. " -"This can be used to parse JSON integers into custom datatypes, for example :" -"class:`float`." +"This can be used to parse JSON integers into custom datatypes, for " +"example :class:`float`." msgstr "" "*parse_int* 為可選函式,當解碼 JSON 整數字串時會被呼叫。預設情況等效於 " "``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別" @@ -533,8 +535,8 @@ msgstr "" #, fuzzy msgid "When the data being deserialized is not a valid JSON document." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" -"`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" +"發 :exc:`JSONDecodeError` 例外。" #: ../../library/json.rst:332 #, fuzzy @@ -542,8 +544,8 @@ msgid "" "When the data being deserialized does not contain UTF-8, UTF-16 or UTF-32 " "encoded data." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" -"`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" +"發 :exc:`JSONDecodeError` 例外。" #: ../../library/json.rst:338 msgid "Added the optional *object_pairs_hook* parameter." @@ -580,9 +582,9 @@ msgid "" "containing a JSON document) to a Python object using this :ref:`conversion " "table `." msgstr "" -"使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件的 :" -"class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去序列" -"化(deserialize)為一個 Python 物件" +"使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件" +"的 :class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去" +"序列化(deserialize)為一個 Python 物件" #: ../../library/json.rst:360 msgid "" @@ -692,8 +694,8 @@ msgstr "" msgid "" "*object_hook* is an optional function that will be called with the result of " "every JSON object decoded and its return value will be used in place of the " -"given :class:`dict`. This can be used to provide custom deserializations (e." -"g. to support `JSON-RPC `_ class hinting)." +"given :class:`dict`. This can be used to provide custom deserializations " +"(e.g. to support `JSON-RPC `_ class hinting)." msgstr "" "*object_hook* 是一個可選函式,其接受一個解碼後的 JSON 物件作為輸入,並使用其" "回傳值來取代原先的 :class:`dict`。這個功能可用於提供自訂的去序列化(例如支援 " @@ -703,9 +705,9 @@ msgstr "" msgid "" "*object_pairs_hook* is an optional function that will be called with the " "result of every JSON object decoded with an ordered list of pairs. The " -"return value of *object_pairs_hook* will be used instead of the :class:" -"`dict`. This feature can be used to implement custom decoders. If " -"*object_hook* is also defined, the *object_pairs_hook* takes priority." +"return value of *object_pairs_hook* will be used instead of " +"the :class:`dict`. This feature can be used to implement custom decoders. " +"If *object_hook* is also defined, the *object_pairs_hook* takes priority." msgstr "" #: ../../library/json.rst:413 @@ -757,11 +759,11 @@ msgstr "" #: ../../library/json.rst:435 msgid "" -"If the data being deserialized is not a valid JSON document, a :exc:" -"`JSONDecodeError` will be raised." +"If the data being deserialized is not a valid JSON document, " +"a :exc:`JSONDecodeError` will be raised." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" -"`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" +"發 :exc:`JSONDecodeError` 例外。" #: ../../library/json.rst:438 ../../library/json.rst:539 msgid "All parameters are now :ref:`keyword-only `." @@ -825,8 +827,8 @@ msgstr "" #: ../../library/json.rst:488 msgid "" -"To extend this to recognize other objects, subclass and implement a :meth:" -"`~JSONEncoder.default` method with another method that returns a " +"To extend this to recognize other objects, subclass and implement " +"a :meth:`~JSONEncoder.default` method with another method that returns a " "serializable object for ``o`` if possible, otherwise it should call the " "superclass implementation (to raise :exc:`TypeError`)." msgstr "" @@ -837,13 +839,14 @@ msgstr "" #: ../../library/json.rst:493 msgid "" "If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when " -"trying to encode keys that are not :class:`str`, :class:`int`, :class:" -"`float`, :class:`bool` or ``None``. If *skipkeys* is true, such items are " -"simply skipped." +"trying to encode keys that are " +"not :class:`str`, :class:`int`, :class:`float`, :class:`bool` or ``None``. " +"If *skipkeys* is true, such items are simply skipped." msgstr "" -"若 *skipkeys* 為 false(預設值),則當在編碼不是 :class:`str`、:class:" -"`int`、:class:`float`、:class:`bool` 或 ``None`` 的鍵值時,將引發 :exc:" -"`TypeError`。如果 *skipkeys* 為 true,這些項目將直接被跳過。" +"若 *skipkeys* 為 false(預設值),則當在編碼不" +"是 :class:`str`、:class:`int`、:class:`float`、:class:`bool` 或 ``None`` 的鍵" +"值時,將引發 :exc:`TypeError`。如果 *skipkeys* 為 true,這些項目將直接被跳" +"過。" #: ../../library/json.rst:497 msgid "" @@ -862,8 +865,8 @@ msgid "" "Otherwise, no such check takes place." msgstr "" "如果 *check_circular* 為 true(預設值),則會在編碼期間檢查串列(list)、字典" -"(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:" -"`RecursionError` 例外的問題)。否則不會進行此類檢查。" +"(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導" +"致 :exc:`RecursionError` 例外的問題)。否則不會進行此類檢查。" #: ../../library/json.rst:506 msgid "" @@ -917,8 +920,8 @@ msgstr "" msgid "" "If specified, *default* should be a function that gets called for objects " "that can't otherwise be serialized. It should return a JSON encodable " -"version of the object or raise a :exc:`TypeError`. If not specified, :exc:" -"`TypeError` is raised." +"version of the object or raise a :exc:`TypeError`. If not " +"specified, :exc:`TypeError` is raised." msgstr "" "如果有指定本參數,*default* 會是一個遭遇無法序列化的物件時會被呼叫的函式。它" "應該回傳該物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會直接" @@ -927,19 +930,19 @@ msgstr "" #: ../../library/json.rst:545 msgid "" "Implement this method in a subclass such that it returns a serializable " -"object for *o*, or calls the base implementation (to raise a :exc:" -"`TypeError`)." +"object for *o*, or calls the base implementation (to raise " +"a :exc:`TypeError`)." msgstr "" "在任意一個子類別裡實作這個方法時須讓其回傳一個可序列化的物件 *o* ,或呼叫原始" "的實作以引發 :exc:`TypeError` 例外。" #: ../../library/json.rst:549 msgid "" -"For example, to support arbitrary iterators, you could implement :meth:" -"`~JSONEncoder.default` like this::" +"For example, to support arbitrary iterators, you could " +"implement :meth:`~JSONEncoder.default` like this::" msgstr "" -"舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子的 :meth:" -"`~JSONEncoder.default`: ::" +"舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子" +"的 :meth:`~JSONEncoder.default`: ::" #: ../../library/json.rst:552 msgid "" @@ -1085,8 +1088,9 @@ msgid "" "`, and thus does not otherwise directly address the issue of character " "encodings." msgstr "" -"除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件與 :class:" -"`Unicode strings ` 之間的轉換規範,因此並不另外處理字元編碼的問題。" +"除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件" +"與 :class:`Unicode strings ` 之間的轉換規範,因此並不另外處理字元編碼的" +"問題。" #: ../../library/json.rst:646 msgid "" @@ -1106,8 +1110,8 @@ msgid "" "The RFC does not explicitly forbid JSON strings which contain byte sequences " "that don't correspond to valid Unicode characters (e.g. unpaired UTF-16 " "surrogates), but it does note that they may cause interoperability problems. " -"By default, this module accepts and outputs (when present in the original :" -"class:`str`) code points for such sequences." +"By default, this module accepts and outputs (when present in the " +"original :class:`str`) code points for such sequences." msgstr "" "RFC 並未明確禁止 JSON 文件包含無法對應有效 Unicode 字元的位元組序列(例如未配" "對的 UTF-16 代理對(surrogate pairs)),但這個特性的確可能會引起相容性問題。" @@ -1249,7 +1253,8 @@ msgstr "" "值、或是序列化特殊數字型別的實例時(例如 :class:`decimal.Decimal`)尤其重要。" #: ../../library/json.rst:737 -msgid "Command Line Interface" +#, fuzzy +msgid "Command-line interface" msgstr "命令列介面" #: ../../library/json.rst:742 @@ -1258,30 +1263,38 @@ msgstr "**原始碼:**\\ :source:`Lib/json/tool.py`" #: ../../library/json.rst:746 msgid "" -"The :mod:`json.tool` module provides a simple command line interface to " -"validate and pretty-print JSON objects." +"The :mod:`json` module can be invoked as a script via ``python -m json`` to " +"validate and pretty-print JSON objects. The :mod:`json.tool` submodule " +"implements this interface." msgstr "" -":mod:`json.tool` 模組提供了一個簡易的命令列介面以供校驗與美化呈現 JSON 物件。" -#: ../../library/json.rst:749 +#: ../../library/json.rst:750 msgid "" -"If the optional ``infile`` and ``outfile`` arguments are not specified, :" -"data:`sys.stdin` and :data:`sys.stdout` will be used respectively:" +"If the optional ``infile`` and ``outfile`` arguments are not " +"specified, :data:`sys.stdin` and :data:`sys.stdout` will be used " +"respectively:" msgstr "" -"如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` 和 :" -"data:`sys.stdout` 將各自做為輸入和輸出的預設值。" +"如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` " +"和 :data:`sys.stdout` 將各自做為輸入和輸出的預設值。" -#: ../../library/json.rst:752 +#: ../../library/json.rst:753 +#, fuzzy msgid "" -"$ echo '{\"json\": \"obj\"}' | python -m json.tool\n" +"$ echo '{\"json\": \"obj\"}' | python -m json\n" "{\n" " \"json\": \"obj\"\n" "}\n" -"$ echo '{1.2:3.4}' | python -m json.tool\n" +"$ echo '{1.2:3.4}' | python -m json\n" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" msgstr "" +"$ echo '{\"json\":\"obj\"}' | python -m json.tool\n" +"{\n" +" \"json\": \"obj\"\n" +"}\n" +"$ echo '{1.2:3.4}' | python -m json.tool\n" +"Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" -#: ../../library/json.rst:761 +#: ../../library/json.rst:762 msgid "" "The output is now in the same order as the input. Use the :option:`--sort-" "keys` option to sort the output of dictionaries alphabetically by key." @@ -1289,17 +1302,26 @@ msgstr "" "現在開始輸出和輸入的資料順序會是相同的。傳入 :option:`--sort-keys` 引數以按照" "鍵值的字母順序對輸出進行排序。" -#: ../../library/json.rst:768 -msgid "Command line options" +#: ../../library/json.rst:767 +msgid "" +"The :mod:`json` module may now be directly executed as ``python -m json``. " +"For backwards compatibility, invoking the CLI as ``python -m json.tool`` " +"remains supported." +msgstr "" + +#: ../../library/json.rst:774 +#, fuzzy +msgid "Command-line options" msgstr "命令列選項" -#: ../../library/json.rst:772 +#: ../../library/json.rst:778 msgid "The JSON file to be validated or pretty-printed:" msgstr "將被用於校驗或美化呈現的 JSON 文件:" -#: ../../library/json.rst:774 +#: ../../library/json.rst:780 +#, fuzzy msgid "" -"$ python -m json.tool mp_films.json\n" +"$ python -m json mp_films.json\n" "[\n" " {\n" " \"title\": \"And Now for Something Completely Different\",\n" @@ -1323,45 +1345,45 @@ msgstr "" " }\n" "]" -#: ../../library/json.rst:788 +#: ../../library/json.rst:794 msgid "If *infile* is not specified, read from :data:`sys.stdin`." msgstr "如果沒有指定 *infile* 則會從 :data:`sys.stdin` 讀取輸入。" -#: ../../library/json.rst:792 +#: ../../library/json.rst:798 msgid "" "Write the output of the *infile* to the given *outfile*. Otherwise, write it " "to :data:`sys.stdout`." msgstr "" -"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到 :data:`sys." -"stdout`。" +"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入" +"到 :data:`sys.stdout`。" -#: ../../library/json.rst:797 +#: ../../library/json.rst:803 msgid "Sort the output of dictionaries alphabetically by key." msgstr "按照鍵值的字母順序對輸出字典進行排序。" -#: ../../library/json.rst:803 +#: ../../library/json.rst:809 msgid "" "Disable escaping of non-ascii characters, see :func:`json.dumps` for more " "information." msgstr "關閉非 ASCII 字元的自動跳脫功能。詳情請參照 :func:`json.dumps`。" -#: ../../library/json.rst:809 +#: ../../library/json.rst:815 msgid "Parse every input line as separate JSON object." msgstr "將每一行輸入都單獨輸出為一個 JSON 物件。" -#: ../../library/json.rst:815 +#: ../../library/json.rst:821 msgid "Mutually exclusive options for whitespace control." msgstr "互斥的空白字元控制選項。" -#: ../../library/json.rst:821 +#: ../../library/json.rst:827 msgid "Show the help message." msgstr "顯示說明訊息。" -#: ../../library/json.rst:825 +#: ../../library/json.rst:831 msgid "Footnotes" msgstr "註解" -#: ../../library/json.rst:826 +#: ../../library/json.rst:832 msgid "" "As noted in `the errata for RFC 7159 `_, JSON permits literal U+2028 (LINE SEPARATOR) " @@ -1371,3 +1393,10 @@ msgstr "" "如 `RFC 7159 更正 `_ " "所述,JSON 允許字串中出現 U+2028(列分隔符)和 U+2029(段落分隔符)字元,而 " "JavaScript(截至 ECMAScript 5.1 版)則不允許。" + +#~ msgid "" +#~ "The :mod:`json.tool` module provides a simple command line interface to " +#~ "validate and pretty-print JSON objects." +#~ msgstr "" +#~ ":mod:`json.tool` 模組提供了一個簡易的命令列介面以供校驗與美化呈現 JSON 物" +#~ "件。" diff --git a/library/linecache.po b/library/linecache.po index cdb7ae4122d..6daa425307e 100644 --- a/library/linecache.po +++ b/library/linecache.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-07-07 23:50+0800\n" "Last-Translator: Weilin Du <1372449351@qq.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -66,6 +66,13 @@ msgstr "" #: ../../library/linecache.rst:33 msgid "" +"If *filename* indicates a frozen module (starting with ``'>> import linecache\n" ">>> linecache.getline(linecache.__file__, 8)\n" diff --git a/library/locale.po b/library/locale.po index afdb048b04c..19317a1cc58 100644 --- a/library/locale.po +++ b/library/locale.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-14 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -53,33 +53,27 @@ msgstr "" msgid "" "If *locale* is given and not ``None``, :func:`setlocale` modifies the locale " "setting for the *category*. The available categories are listed in the data " -"description below. *locale* may be a :ref:`string `, or a pair, " -"language code and encoding. An empty string specifies the user's default " -"settings. If the modification of the locale fails, the exception :exc:" -"`Error` is raised. If successful, the new locale setting is returned." -msgstr "" - -#: ../../library/locale.rst:42 -msgid "" -"If *locale* is a pair, it is converted to a locale name using the locale " -"aliasing engine. The language code has the same format as a :ref:`locale " -"name `, but without encoding and ``@``-modifier. The language " -"code and encoding can be ``None``." +"description below. *locale* may be a string, or an iterable of two strings " +"(language code and encoding). If it's an iterable, it's converted to a " +"locale name using the locale aliasing engine. An empty string specifies the " +"user's default settings. If the modification of the locale fails, the " +"exception :exc:`Error` is raised. If successful, the new locale setting is " +"returned." msgstr "" -#: ../../library/locale.rst:48 +#: ../../library/locale.rst:43 msgid "" "If *locale* is omitted or ``None``, the current setting for *category* is " "returned." msgstr "" -#: ../../library/locale.rst:51 +#: ../../library/locale.rst:46 msgid "" ":func:`setlocale` is not thread-safe on most systems. Applications typically " "start with a call of ::" msgstr "" -#: ../../library/locale.rst:54 +#: ../../library/locale.rst:49 msgid "" "import locale\n" "locale.setlocale(locale.LC_ALL, '')" @@ -87,7 +81,7 @@ msgstr "" "import locale\n" "locale.setlocale(locale.LC_ALL, '')" -#: ../../library/locale.rst:57 +#: ../../library/locale.rst:52 msgid "" "This sets the locale for all categories to the user's default setting " "(typically specified in the :envvar:`LANG` environment variable). If the " @@ -95,246 +89,246 @@ msgid "" "problems." msgstr "" -#: ../../library/locale.rst:64 +#: ../../library/locale.rst:59 msgid "" "Returns the database of the local conventions as a dictionary. This " "dictionary has the following strings as keys:" msgstr "" -#: ../../library/locale.rst:70 +#: ../../library/locale.rst:65 msgid "Category" msgstr "分類" -#: ../../library/locale.rst:70 +#: ../../library/locale.rst:65 msgid "Key" msgstr "" -#: ../../library/locale.rst:70 +#: ../../library/locale.rst:65 msgid "Meaning" msgstr "含義" -#: ../../library/locale.rst:72 +#: ../../library/locale.rst:67 msgid ":const:`LC_NUMERIC`" msgstr ":const:`LC_NUMERIC`" -#: ../../library/locale.rst:72 +#: ../../library/locale.rst:67 msgid "``'decimal_point'``" msgstr "``'decimal_point'``" -#: ../../library/locale.rst:72 +#: ../../library/locale.rst:67 msgid "Decimal point character." msgstr "" -#: ../../library/locale.rst:74 +#: ../../library/locale.rst:69 msgid "``'grouping'``" msgstr "``'grouping'``" -#: ../../library/locale.rst:74 +#: ../../library/locale.rst:69 msgid "" "Sequence of numbers specifying which relative positions the " -"``'thousands_sep'`` is expected. If the sequence is terminated with :const:" -"`CHAR_MAX`, no further grouping is performed. If the sequence terminates " -"with a ``0``, the last group size is repeatedly used." +"``'thousands_sep'`` is expected. If the sequence is terminated " +"with :const:`CHAR_MAX`, no further grouping is performed. If the sequence " +"terminates with a ``0``, the last group size is repeatedly used." msgstr "" -#: ../../library/locale.rst:85 +#: ../../library/locale.rst:80 msgid "``'thousands_sep'``" msgstr "``'thousands_sep'``" -#: ../../library/locale.rst:85 +#: ../../library/locale.rst:80 msgid "Character used between groups." msgstr "" -#: ../../library/locale.rst:87 +#: ../../library/locale.rst:82 msgid ":const:`LC_MONETARY`" msgstr ":const:`LC_MONETARY`" -#: ../../library/locale.rst:87 +#: ../../library/locale.rst:82 msgid "``'int_curr_symbol'``" msgstr "``'int_curr_symbol'``" -#: ../../library/locale.rst:87 +#: ../../library/locale.rst:82 msgid "International currency symbol." msgstr "" -#: ../../library/locale.rst:89 +#: ../../library/locale.rst:84 msgid "``'currency_symbol'``" msgstr "``'currency_symbol'``" -#: ../../library/locale.rst:89 +#: ../../library/locale.rst:84 msgid "Local currency symbol." msgstr "" -#: ../../library/locale.rst:91 +#: ../../library/locale.rst:86 msgid "``'p_cs_precedes/n_cs_precedes'``" msgstr "``'p_cs_precedes/n_cs_precedes'``" -#: ../../library/locale.rst:91 +#: ../../library/locale.rst:86 msgid "" "Whether the currency symbol precedes the value (for positive resp. negative " "values)." msgstr "" -#: ../../library/locale.rst:96 +#: ../../library/locale.rst:91 msgid "``'p_sep_by_space/n_sep_by_space'``" msgstr "``'p_sep_by_space/n_sep_by_space'``" -#: ../../library/locale.rst:96 +#: ../../library/locale.rst:91 msgid "" "Whether the currency symbol is separated from the value by a space (for " "positive resp. negative values)." msgstr "" -#: ../../library/locale.rst:101 +#: ../../library/locale.rst:96 msgid "``'mon_decimal_point'``" msgstr "``'mon_decimal_point'``" -#: ../../library/locale.rst:101 +#: ../../library/locale.rst:96 msgid "Decimal point used for monetary values." msgstr "" -#: ../../library/locale.rst:104 +#: ../../library/locale.rst:99 msgid "``'frac_digits'``" msgstr "``'frac_digits'``" -#: ../../library/locale.rst:104 +#: ../../library/locale.rst:99 msgid "" "Number of fractional digits used in local formatting of monetary values." msgstr "" -#: ../../library/locale.rst:108 +#: ../../library/locale.rst:103 msgid "``'int_frac_digits'``" msgstr "``'int_frac_digits'``" -#: ../../library/locale.rst:108 +#: ../../library/locale.rst:103 msgid "" "Number of fractional digits used in international formatting of monetary " "values." msgstr "" -#: ../../library/locale.rst:112 +#: ../../library/locale.rst:107 msgid "``'mon_thousands_sep'``" msgstr "``'mon_thousands_sep'``" -#: ../../library/locale.rst:112 +#: ../../library/locale.rst:107 msgid "Group separator used for monetary values." msgstr "" -#: ../../library/locale.rst:115 +#: ../../library/locale.rst:110 msgid "``'mon_grouping'``" msgstr "``'mon_grouping'``" -#: ../../library/locale.rst:115 +#: ../../library/locale.rst:110 msgid "Equivalent to ``'grouping'``, used for monetary values." msgstr "" -#: ../../library/locale.rst:118 +#: ../../library/locale.rst:113 msgid "``'positive_sign'``" msgstr "``'positive_sign'``" -#: ../../library/locale.rst:118 +#: ../../library/locale.rst:113 msgid "Symbol used to annotate a positive monetary value." msgstr "" -#: ../../library/locale.rst:121 +#: ../../library/locale.rst:116 msgid "``'negative_sign'``" msgstr "``'negative_sign'``" -#: ../../library/locale.rst:121 +#: ../../library/locale.rst:116 msgid "Symbol used to annotate a negative monetary value." msgstr "" -#: ../../library/locale.rst:124 +#: ../../library/locale.rst:119 msgid "``'p_sign_posn/n_sign_posn'``" msgstr "``'p_sign_posn/n_sign_posn'``" -#: ../../library/locale.rst:124 +#: ../../library/locale.rst:119 msgid "" "The position of the sign (for positive resp. negative values), see below." msgstr "" -#: ../../library/locale.rst:129 +#: ../../library/locale.rst:124 msgid "" "All numeric values can be set to :const:`CHAR_MAX` to indicate that there is " "no value specified in this locale." msgstr "" -#: ../../library/locale.rst:132 +#: ../../library/locale.rst:127 msgid "" "The possible values for ``'p_sign_posn'`` and ``'n_sign_posn'`` are given " "below." msgstr "" -#: ../../library/locale.rst:135 +#: ../../library/locale.rst:130 msgid "Value" msgstr "" -#: ../../library/locale.rst:135 +#: ../../library/locale.rst:130 msgid "Explanation" msgstr "" -#: ../../library/locale.rst:137 +#: ../../library/locale.rst:132 msgid "``0``" msgstr "``0``" -#: ../../library/locale.rst:137 +#: ../../library/locale.rst:132 msgid "Currency and value are surrounded by parentheses." msgstr "" -#: ../../library/locale.rst:140 +#: ../../library/locale.rst:135 msgid "``1``" msgstr "``1``" -#: ../../library/locale.rst:140 +#: ../../library/locale.rst:135 msgid "The sign should precede the value and currency symbol." msgstr "" -#: ../../library/locale.rst:143 +#: ../../library/locale.rst:138 msgid "``2``" msgstr "``2``" -#: ../../library/locale.rst:143 +#: ../../library/locale.rst:138 msgid "The sign should follow the value and currency symbol." msgstr "" -#: ../../library/locale.rst:146 +#: ../../library/locale.rst:141 msgid "``3``" msgstr "``3``" -#: ../../library/locale.rst:146 +#: ../../library/locale.rst:141 msgid "The sign should immediately precede the value." msgstr "" -#: ../../library/locale.rst:149 +#: ../../library/locale.rst:144 msgid "``4``" msgstr "``4``" -#: ../../library/locale.rst:149 +#: ../../library/locale.rst:144 msgid "The sign should immediately follow the value." msgstr "" -#: ../../library/locale.rst:152 +#: ../../library/locale.rst:147 msgid "``CHAR_MAX``" msgstr "``CHAR_MAX``" -#: ../../library/locale.rst:152 +#: ../../library/locale.rst:147 msgid "Nothing is specified in this locale." msgstr "" -#: ../../library/locale.rst:155 +#: ../../library/locale.rst:150 msgid "" "The function temporarily sets the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` " "locale or the ``LC_MONETARY`` locale if locales are different and numeric or " "monetary strings are non-ASCII. This temporary change affects other threads." msgstr "" -#: ../../library/locale.rst:159 +#: ../../library/locale.rst:154 msgid "" "The function now temporarily sets the ``LC_CTYPE`` locale to the " "``LC_NUMERIC`` locale in some cases." msgstr "" -#: ../../library/locale.rst:166 +#: ../../library/locale.rst:161 msgid "" "Return some locale-specific information as a string. This function is not " "available on all systems, and the set of possible options might also vary " @@ -342,106 +336,106 @@ msgid "" "symbolic constants are available in the locale module." msgstr "" -#: ../../library/locale.rst:171 +#: ../../library/locale.rst:166 msgid "" "The :func:`nl_langinfo` function accepts one of the following keys. Most " "descriptions are taken from the corresponding description in the GNU C " "library." msgstr "" -#: ../../library/locale.rst:177 +#: ../../library/locale.rst:172 msgid "" "Get a string with the name of the character encoding used in the selected " "locale." msgstr "" -#: ../../library/locale.rst:182 +#: ../../library/locale.rst:177 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent date and time in a locale-specific way." msgstr "" -#: ../../library/locale.rst:187 +#: ../../library/locale.rst:182 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent a date in a locale-specific way." msgstr "" -#: ../../library/locale.rst:192 +#: ../../library/locale.rst:187 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent a time in a locale-specific way." msgstr "" -#: ../../library/locale.rst:197 +#: ../../library/locale.rst:192 msgid "" "Get a format string for :func:`time.strftime` to represent time in the am/pm " "format." msgstr "" -#: ../../library/locale.rst:208 +#: ../../library/locale.rst:203 msgid "Get the name of the n-th day of the week." msgstr "" -#: ../../library/locale.rst:212 +#: ../../library/locale.rst:207 msgid "" "This follows the US convention of :const:`DAY_1` being Sunday, not the " "international convention (ISO 8601) that Monday is the first day of the week." msgstr "" -#: ../../library/locale.rst:224 +#: ../../library/locale.rst:219 msgid "Get the abbreviated name of the n-th day of the week." msgstr "" -#: ../../library/locale.rst:239 +#: ../../library/locale.rst:234 msgid "Get the name of the n-th month." msgstr "" -#: ../../library/locale.rst:254 +#: ../../library/locale.rst:249 msgid "Get the abbreviated name of the n-th month." msgstr "" -#: ../../library/locale.rst:258 +#: ../../library/locale.rst:253 msgid "Get the radix character (decimal dot, decimal comma, etc.)." msgstr "" -#: ../../library/locale.rst:262 +#: ../../library/locale.rst:257 msgid "Get the separator character for thousands (groups of three digits)." msgstr "" -#: ../../library/locale.rst:266 +#: ../../library/locale.rst:261 msgid "" "Get a regular expression that can be used with the regex function to " "recognize a positive response to a yes/no question." msgstr "" -#: ../../library/locale.rst:271 +#: ../../library/locale.rst:266 msgid "" "Get a regular expression that can be used with the ``regex(3)`` function to " "recognize a negative response to a yes/no question." msgstr "" -#: ../../library/locale.rst:276 +#: ../../library/locale.rst:271 msgid "" "The regular expressions for :const:`YESEXPR` and :const:`NOEXPR` use syntax " "suitable for the ``regex`` function from the C library, which might differ " "from the syntax used in :mod:`re`." msgstr "" -#: ../../library/locale.rst:283 +#: ../../library/locale.rst:278 msgid "" "Get the currency symbol, preceded by \"-\" if the symbol should appear " "before the value, \"+\" if the symbol should appear after the value, or \"." "\" if the symbol should replace the radix character." msgstr "" -#: ../../library/locale.rst:289 +#: ../../library/locale.rst:284 msgid "" "Get a string which describes how years are counted and displayed for each " "era in a locale." msgstr "" -#: ../../library/locale.rst:292 +#: ../../library/locale.rst:287 msgid "" "Most locales do not define this value. An example of a locale which does " "define this value is the Japanese one. In Japan, the traditional " @@ -449,48 +443,61 @@ msgid "" "then-emperor's reign." msgstr "" -#: ../../library/locale.rst:297 +#: ../../library/locale.rst:292 msgid "" "Normally it should not be necessary to use this value directly. Specifying " "the ``E`` modifier in their format strings causes the :func:`time.strftime` " "function to use this information. The format of the returned string is " "specified in *The Open Group Base Specifications Issue 8*, paragraph " -"`7.3.5.2 LC_TIME C-Language Access `_." +"`7.3.5.2 LC_TIME C-Language Access `_." msgstr "" -#: ../../library/locale.rst:306 +#: ../../library/locale.rst:301 msgid "" "Get a format string for :func:`time.strftime` to represent date and time in " "a locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:311 +#: ../../library/locale.rst:306 msgid "" "Get a format string for :func:`time.strftime` to represent a date in a " "locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:316 +#: ../../library/locale.rst:311 msgid "" "Get a format string for :func:`time.strftime` to represent a time in a " "locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:321 +#: ../../library/locale.rst:316 msgid "" "Get a string consisting of up to 100 semicolon-separated symbols used to " "represent the values 0 to 99 in a locale-specific way. In most locales this " "is an empty string." msgstr "" -#: ../../library/locale.rst:328 +#: ../../library/locale.rst:320 +msgid "" +"The function temporarily sets the ``LC_CTYPE`` locale to the locale of the " +"category that determines the requested value (``LC_TIME``, ``LC_NUMERIC``, " +"``LC_MONETARY`` or ``LC_MESSAGES``) if locales are different and the " +"resulting string is non-ASCII. This temporary change affects other threads." +msgstr "" + +#: ../../library/locale.rst:326 +msgid "" +"The function now temporarily sets the ``LC_CTYPE`` locale in some cases." +msgstr "" + +#: ../../library/locale.rst:332 msgid "" "Tries to determine the default locale settings and returns them as a tuple " "of the form ``(language code, encoding)``." msgstr "" -#: ../../library/locale.rst:331 +#: ../../library/locale.rst:335 msgid "" "According to POSIX, a program which has not called ``setlocale(LC_ALL, '')`` " "runs using the portable ``'C'`` locale. Calling ``setlocale(LC_ALL, '')`` " @@ -499,7 +506,7 @@ msgid "" "emulate the behavior in the way described above." msgstr "" -#: ../../library/locale.rst:337 +#: ../../library/locale.rst:341 msgid "" "To maintain compatibility with other platforms, not only the :envvar:`LANG` " "variable is tested, but a list of variables given as envvars parameter. The " @@ -509,20 +516,19 @@ msgid "" "``'LC_CTYPE'``, ``'LANG'`` and ``'LANGUAGE'``, in that order." msgstr "" -#: ../../library/locale.rst:344 ../../library/locale.rst:359 +#: ../../library/locale.rst:348 ../../library/locale.rst:361 msgid "" -"The language code has the same format as a :ref:`locale name `, " -"but without encoding and ``@``-modifier. The language code and encoding may " -"be ``None`` if their values cannot be determined. The \"C\" locale is " -"represented as ``(None, None)``." +"Except for the code ``'C'``, the language code corresponds to :rfc:`1766`. " +"*language code* and *encoding* may be ``None`` if their values cannot be " +"determined." msgstr "" -#: ../../library/locale.rst:355 +#: ../../library/locale.rst:357 msgid "" -"Returns the current setting for the given locale category as a tuple " -"containing the language code and encoding. *category* may be one of the :" -"const:`!LC_\\*` values except :const:`LC_ALL`. It defaults to :const:" -"`LC_CTYPE`." +"Returns the current setting for the given locale category as sequence " +"containing *language code*, *encoding*. *category* may be one of " +"the :const:`!LC_\\*` values except :const:`LC_ALL`. It defaults " +"to :const:`LC_CTYPE`." msgstr "" #: ../../library/locale.rst:368 @@ -555,8 +561,8 @@ msgstr "" #: ../../library/locale.rst:384 msgid "" -"The function now always returns ``\"utf-8\"`` on Android or if the :ref:" -"`Python UTF-8 Mode ` is enabled." +"The function now always returns ``\"utf-8\"`` on Android or if " +"the :ref:`Python UTF-8 Mode ` is enabled." msgstr "" #: ../../library/locale.rst:391 @@ -666,14 +672,14 @@ msgstr "" #: ../../library/locale.rst:476 msgid "" -"Converts a string into a normalized number string, following the :const:" -"`LC_NUMERIC` settings." +"Converts a string into a normalized number string, following " +"the :const:`LC_NUMERIC` settings." msgstr "" #: ../../library/locale.rst:484 msgid "" -"Converts a normalized number string into a formatted string following the :" -"const:`LC_NUMERIC` settings." +"Converts a normalized number string into a formatted string following " +"the :const:`LC_NUMERIC` settings." msgstr "" #: ../../library/locale.rst:492 @@ -707,14 +713,14 @@ msgstr "" #: ../../library/locale.rst:517 msgid "" -"Locale category for sorting strings. The functions :func:`strcoll` and :" -"func:`strxfrm` of the :mod:`locale` module are affected." +"Locale category for sorting strings. The functions :func:`strcoll` " +"and :func:`strxfrm` of the :mod:`locale` module are affected." msgstr "" #: ../../library/locale.rst:523 msgid "" -"Locale category for the formatting of time. The function :func:`time." -"strftime` follows these conventions." +"Locale category for the formatting of time. The " +"function :func:`time.strftime` follows these conventions." msgstr "" #: ../../library/locale.rst:529 @@ -739,10 +745,10 @@ msgstr "" #: ../../library/locale.rst:546 msgid "" -"Locale category for formatting numbers. The functions :func:" -"`format_string`, :func:`atoi`, :func:`atof` and :func:`.str` of the :mod:" -"`locale` module are affected by that category. All other numeric formatting " -"operations are not affected." +"Locale category for formatting numbers. The " +"functions :func:`format_string`, :func:`atoi`, :func:`atof` and :func:`.str` " +"of the :mod:`locale` module are affected by that category. All other " +"numeric formatting operations are not affected." msgstr "" #: ../../library/locale.rst:554 @@ -757,8 +763,8 @@ msgstr "" #: ../../library/locale.rst:563 msgid "" -"This is a symbolic constant used for different values returned by :func:" -"`localeconv`." +"This is a symbolic constant used for different values returned " +"by :func:`localeconv`." msgstr "" #: ../../library/locale.rst:567 @@ -793,9 +799,9 @@ msgstr "" #: ../../library/locale.rst:587 msgid "" "Initially, when a program is started, the locale is the ``C`` locale, no " -"matter what the user's preferred locale is. There is one exception: the :" -"data:`LC_CTYPE` category is changed at startup to set the current locale " -"encoding to the user's preferred locale encoding. The program must " +"matter what the user's preferred locale is. There is one exception: " +"the :data:`LC_CTYPE` category is changed at startup to set the current " +"locale encoding to the user's preferred locale encoding. The program must " "explicitly say that it wants the user's preferred locale settings for other " "categories by calling ``setlocale(LC_ALL, '')``." msgstr "" @@ -822,8 +828,8 @@ msgstr "" #: ../../library/locale.rst:606 msgid "" "The only way to perform numeric operations according to the locale is to use " -"the special functions defined by this module: :func:`atof`, :func:`atoi`, :" -"func:`format_string`, :func:`.str`." +"the special functions defined by this " +"module: :func:`atof`, :func:`atoi`, :func:`format_string`, :func:`.str`." msgstr "" #: ../../library/locale.rst:610 @@ -838,84 +844,10 @@ msgid "" msgstr "" #: ../../library/locale.rst:621 -msgid "Locale names" -msgstr "" - -#: ../../library/locale.rst:623 -msgid "" -"The format of the locale name is platform dependent, and the set of " -"supported locales can depend on the system configuration." -msgstr "" - -#: ../../library/locale.rst:626 -msgid "On Posix platforms, it usually has the format [1]_:" -msgstr "" - -#: ../../library/locale.rst:631 -msgid "" -"where *language* is a two- or three-letter language code from `ISO 639`_, " -"*territory* is a two-letter country or region code from `ISO 3166`_, " -"*charset* is a locale encoding, and *modifier* is a script name, a language " -"subtag, a sort order identifier, or other locale modifier (for example, " -"\"latin\", \"valencia\", \"stroke\" and \"euro\")." -msgstr "" - -#: ../../library/locale.rst:637 -msgid "" -"On Windows, several formats are supported. [2]_ [3]_ A subset of `IETF BCP " -"47`_ tags:" -msgstr "" - -#: ../../library/locale.rst:644 -msgid "" -"where *language* and *territory* have the same meaning as in Posix, *script* " -"is a four-letter script code from `ISO 15924`_, and *modifier* is a language " -"subtag, a sort order identifier or custom modifier (for example, " -"\"valencia\", \"stroke\" or \"x-python\"). Both hyphen (``'-'``) and " -"underscore (``'_'``) separators are supported. Only UTF-8 encoding is " -"allowed for BCP 47 tags." -msgstr "" - -#: ../../library/locale.rst:651 -msgid "Windows also supports locale names in the format:" -msgstr "" - -#: ../../library/locale.rst:656 -msgid "" -"where *language* and *territory* are full names, such as \"English\" and " -"\"United States\", and *charset* is either a code page number (for example, " -"\"1252\") or UTF-8. Only the underscore separator is supported in this " -"format." -msgstr "" - -#: ../../library/locale.rst:661 -msgid "The \"C\" locale is supported on all platforms." -msgstr "" - -#: ../../library/locale.rst:668 -msgid "" -"`IEEE Std 1003.1-2024; 8.2 Internationalization Variables `_" -msgstr "" - -#: ../../library/locale.rst:669 -msgid "" -"`UCRT Locale names, Languages, and Country/Region strings `_" -msgstr "" - -#: ../../library/locale.rst:670 -msgid "" -"`Locale Names `_" -msgstr "" - -#: ../../library/locale.rst:676 msgid "For extension writers and programs that embed Python" msgstr "" -#: ../../library/locale.rst:678 +#: ../../library/locale.rst:623 msgid "" "Extension modules should never call :func:`setlocale`, except to find out " "what the current locale is. But since the return value can only be used " @@ -923,32 +855,32 @@ msgid "" "whether or not the locale is ``C``)." msgstr "" -#: ../../library/locale.rst:683 +#: ../../library/locale.rst:628 msgid "" "When Python code uses the :mod:`locale` module to change the locale, this " "also affects the embedding application. If the embedding application " "doesn't want this to happen, it should remove the :mod:`!_locale` extension " -"module (which does all the work) from the table of built-in modules in the :" -"file:`config.c` file, and make sure that the :mod:`!_locale` module is not " -"accessible as a shared library." +"module (which does all the work) from the table of built-in modules in " +"the :file:`config.c` file, and make sure that the :mod:`!_locale` module is " +"not accessible as a shared library." msgstr "" -#: ../../library/locale.rst:694 +#: ../../library/locale.rst:639 msgid "Access to message catalogs" msgstr "" -#: ../../library/locale.rst:703 +#: ../../library/locale.rst:648 msgid "" "The locale module exposes the C library's gettext interface on systems that " -"provide this interface. It consists of the functions :func:`gettext`, :func:" -"`dgettext`, :func:`dcgettext`, :func:`textdomain`, :func:`bindtextdomain`, " +"provide this interface. It consists of the " +"functions :func:`gettext`, :func:`dgettext`, :func:`dcgettext`, :func:`textdomain`, :func:`bindtextdomain`, " "and :func:`bind_textdomain_codeset`. These are similar to the same " "functions in the :mod:`gettext` module, but use the C library's binary " "format for message catalogs, and the C library's search algorithms for " "locating message catalogs." msgstr "" -#: ../../library/locale.rst:710 +#: ../../library/locale.rst:655 msgid "" "Python applications should normally find no need to invoke these functions, " "and should use :mod:`gettext` instead. A known exception to this rule are " diff --git a/library/logging.handlers.po b/library/logging.handlers.po index b8f0f87f91e..adbc3760f8c 100644 --- a/library/logging.handlers.po +++ b/library/logging.handlers.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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,9 +45,9 @@ msgstr "" #: ../../library/logging.handlers.rst:25 msgid "" "The following useful handlers are provided in the package. Note that three " -"of the handlers (:class:`StreamHandler`, :class:`FileHandler` and :class:" -"`NullHandler`) are actually defined in the :mod:`logging` module itself, but " -"have been documented here along with the other handlers." +"of the handlers (:class:`StreamHandler`, :class:`FileHandler` " +"and :class:`NullHandler`) are actually defined in the :mod:`logging` module " +"itself, but have been documented here along with the other handlers." msgstr "" #: ../../library/logging.handlers.rst:33 @@ -58,30 +58,30 @@ msgstr "StreamHandler" msgid "" "The :class:`StreamHandler` class, located in the core :mod:`logging` " "package, sends logging output to streams such as *sys.stdout*, *sys.stderr* " -"or any file-like object (or, more precisely, any object which supports :meth:" -"`write` and :meth:`flush` methods)." +"or any file-like object (or, more precisely, any object which " +"supports :meth:`write` and :meth:`flush` methods)." msgstr "" #: ../../library/logging.handlers.rst:43 msgid "" "Returns a new instance of the :class:`StreamHandler` class. If *stream* is " -"specified, the instance will use it for logging output; otherwise, *sys." -"stderr* will be used." +"specified, the instance will use it for logging output; otherwise, " +"*sys.stderr* will be used." msgstr "" #: ../../library/logging.handlers.rst:50 msgid "" "If a formatter is specified, it is used to format the record. The record is " "then written to the stream followed by :attr:`terminator`. If exception " -"information is present, it is formatted using :func:`traceback." -"print_exception` and appended to the stream." +"information is present, it is formatted " +"using :func:`traceback.print_exception` and appended to the stream." msgstr "" #: ../../library/logging.handlers.rst:58 msgid "" -"Flushes the stream by calling its :meth:`flush` method. Note that the :meth:" -"`close` method is inherited from :class:`~logging.Handler` and so does no " -"output, so an explicit :meth:`flush` call may be needed at times." +"Flushes the stream by calling its :meth:`flush` method. Note that " +"the :meth:`close` method is inherited from :class:`~logging.Handler` and so " +"does no output, so an explicit :meth:`flush` call may be needed at times." msgstr "" #: ../../library/logging.handlers.rst:64 @@ -202,8 +202,8 @@ msgstr "" #: ../../library/logging.handlers.rst:153 msgid "" -"See :ref:`library-config` for more information on how to use :class:" -"`NullHandler`." +"See :ref:`library-config` for more information on how to " +"use :class:`NullHandler`." msgstr "" #: ../../library/logging.handlers.rst:159 @@ -212,10 +212,10 @@ msgstr "WatchedFileHandler" #: ../../library/logging.handlers.rst:163 msgid "" -"The :class:`WatchedFileHandler` class, located in the :mod:`logging." -"handlers` module, is a :class:`FileHandler` which watches the file it is " -"logging to. If the file changes, it is closed and reopened using the file " -"name." +"The :class:`WatchedFileHandler` class, located in " +"the :mod:`logging.handlers` module, is a :class:`FileHandler` which watches " +"the file it is logging to. If the file changes, it is closed and reopened " +"using the file name." msgstr "" #: ../../library/logging.handlers.rst:167 @@ -267,11 +267,11 @@ msgstr "BaseRotatingHandler" #: ../../library/logging.handlers.rst:216 msgid "" -"The :class:`BaseRotatingHandler` class, located in the :mod:`logging." -"handlers` module, is the base class for the rotating file handlers, :class:" -"`RotatingFileHandler` and :class:`TimedRotatingFileHandler`. You should not " -"need to instantiate this class, but it has attributes and methods you may " -"need to override." +"The :class:`BaseRotatingHandler` class, located in " +"the :mod:`logging.handlers` module, is the base class for the rotating file " +"handlers, :class:`RotatingFileHandler` " +"and :class:`TimedRotatingFileHandler`. You should not need to instantiate " +"this class, but it has attributes and methods you may need to override." msgstr "" #: ../../library/logging.handlers.rst:224 @@ -304,10 +304,10 @@ msgid "" "determining the oldest files to delete. For this to happen, the filenames " "should be sortable using the date/time portion of the filename, and a namer " "needs to respect this. (If a namer is wanted that doesn't respect this " -"scheme, it will need to be used in a subclass of :class:" -"`TimedRotatingFileHandler` which overrides the :meth:" -"`~TimedRotatingFileHandler.getFilesToDelete` method to fit in with the " -"custom naming scheme.)" +"scheme, it will need to be used in a subclass " +"of :class:`TimedRotatingFileHandler` which overrides " +"the :meth:`~TimedRotatingFileHandler.getFilesToDelete` method to fit in with " +"the custom naming scheme.)" msgstr "" #: ../../library/logging.handlers.rst:255 @@ -355,18 +355,18 @@ msgstr "" #: ../../library/logging.handlers.rst:287 msgid "" -"The destination filename. This is normally what the source is rotated to, e." -"g. 'test.log.1'." +"The destination filename. This is normally what the source is rotated to, " +"e.g. 'test.log.1'." msgstr "" #: ../../library/logging.handlers.rst:292 msgid "" "The reason the attributes exist is to save you having to subclass - you can " -"use the same callables for instances of :class:`RotatingFileHandler` and :" -"class:`TimedRotatingFileHandler`. If either the namer or rotator callable " -"raises an exception, this will be handled in the same way as any other " -"exception during an :meth:`emit` call, i.e. via the :meth:`handleError` " -"method of the handler." +"use the same callables for instances of :class:`RotatingFileHandler` " +"and :class:`TimedRotatingFileHandler`. If either the namer or rotator " +"callable raises an exception, this will be handled in the same way as any " +"other exception during an :meth:`emit` call, i.e. via " +"the :meth:`handleError` method of the handler." msgstr "" #: ../../library/logging.handlers.rst:299 @@ -385,8 +385,8 @@ msgstr "RotatingFileHandler" #: ../../library/logging.handlers.rst:310 msgid "" -"The :class:`RotatingFileHandler` class, located in the :mod:`logging." -"handlers` module, supports rotation of disk log files." +"The :class:`RotatingFileHandler` class, located in " +"the :mod:`logging.handlers` module, supports rotation of disk log files." msgstr "" #: ../../library/logging.handlers.rst:316 @@ -402,20 +402,21 @@ msgstr "" #: ../../library/logging.handlers.rst:323 msgid "" -"You can use the *maxBytes* and *backupCount* values to allow the file to :" -"dfn:`rollover` at a predetermined size. When the size is about to be " +"You can use the *maxBytes* and *backupCount* values to allow the file " +"to :dfn:`rollover` at a predetermined size. When the size is about to be " "exceeded, the file is closed and a new file is silently opened for output. " "Rollover occurs whenever the current log file is nearly *maxBytes* in " "length; but if either of *maxBytes* or *backupCount* is zero, rollover never " "occurs, so you generally want to set *backupCount* to at least 1, and have a " "non-zero *maxBytes*. When *backupCount* is non-zero, the system will save " "old log files by appending the extensions '.1', '.2' etc., to the filename. " -"For example, with a *backupCount* of 5 and a base file name of :file:`app." -"log`, you would get :file:`app.log`, :file:`app.log.1`, :file:`app.log.2`, " -"up to :file:`app.log.5`. The file being written to is always :file:`app." -"log`. When this file is filled, it is closed and renamed to :file:`app." -"log.1`, and if files :file:`app.log.1`, :file:`app.log.2`, etc. exist, then " -"they are renamed to :file:`app.log.2`, :file:`app.log.3` etc. respectively." +"For example, with a *backupCount* of 5 and a base file name " +"of :file:`app.log`, you would " +"get :file:`app.log`, :file:`app.log.1`, :file:`app.log.2`, up " +"to :file:`app.log.5`. The file being written to is always :file:`app.log`. " +"When this file is filled, it is closed and renamed to :file:`app.log.1`, and " +"if files :file:`app.log.1`, :file:`app.log.2`, etc. exist, then they are " +"renamed to :file:`app.log.2`, :file:`app.log.3` etc. respectively." msgstr "" #: ../../library/logging.handlers.rst:347 @@ -441,9 +442,9 @@ msgstr "TimedRotatingFileHandler" #: ../../library/logging.handlers.rst:364 msgid "" -"The :class:`TimedRotatingFileHandler` class, located in the :mod:`logging." -"handlers` module, supports rotation of disk log files at certain timed " -"intervals." +"The :class:`TimedRotatingFileHandler` class, located in " +"the :mod:`logging.handlers` module, supports rotation of disk log files at " +"certain timed intervals." msgstr "" #: ../../library/logging.handlers.rst:371 @@ -570,8 +571,8 @@ msgstr "" #: ../../library/logging.handlers.rst:419 msgid "" -"If *delay* is true, then file opening is deferred until the first call to :" -"meth:`emit`." +"If *delay* is true, then file opening is deferred until the first call " +"to :meth:`emit`." msgstr "" #: ../../library/logging.handlers.rst:422 @@ -659,8 +660,9 @@ msgid "" "Pickles the record's attribute dictionary and writes it to the socket in " "binary format. If there is an error with the socket, silently drops the " "packet. If the connection was previously lost, re-establishes the " -"connection. To unpickle the record at the receiving end into a :class:" -"`~logging.LogRecord`, use the :func:`~logging.makeLogRecord` function." +"connection. To unpickle the record at the receiving end into " +"a :class:`~logging.LogRecord`, use the :func:`~logging.makeLogRecord` " +"function." msgstr "" #: ../../library/logging.handlers.rst:507 @@ -673,8 +675,8 @@ msgstr "" #: ../../library/logging.handlers.rst:514 msgid "" "This is a factory method which allows subclasses to define the precise type " -"of socket they want. The default implementation creates a TCP socket (:const:" -"`socket.SOCK_STREAM`)." +"of socket they want. The default implementation creates a TCP socket " +"(:const:`socket.SOCK_STREAM`)." msgstr "" #: ../../library/logging.handlers.rst:521 @@ -706,8 +708,8 @@ msgstr "" #: ../../library/logging.handlers.rst:538 msgid "" "Send a pickled byte-string *packet* to the socket. The format of the sent " -"byte-string is as described in the documentation for :meth:`~SocketHandler." -"makePickle`." +"byte-string is as described in the documentation " +"for :meth:`~SocketHandler.makePickle`." msgstr "" #: ../../library/logging.handlers.rst:542 @@ -789,8 +791,9 @@ msgstr "" msgid "" "Pickles the record's attribute dictionary and writes it to the socket in " "binary format. If there is an error with the socket, silently drops the " -"packet. To unpickle the record at the receiving end into a :class:`~logging." -"LogRecord`, use the :func:`~logging.makeLogRecord` function." +"packet. To unpickle the record at the receiving end into " +"a :class:`~logging.LogRecord`, use the :func:`~logging.makeLogRecord` " +"function." msgstr "" #: ../../library/logging.handlers.rst:605 @@ -823,44 +826,54 @@ msgid "" "``('localhost', 514)`` is used. The address is used to open a socket. An " "alternative to providing a ``(host, port)`` tuple is providing an address as " "a string, for example '/dev/log'. In this case, a Unix domain socket is used " -"to send the message to the syslog. If *facility* is not specified, :const:" -"`LOG_USER` is used. The type of socket opened depends on the *socktype* " -"argument, which defaults to :const:`socket.SOCK_DGRAM` and thus opens a UDP " -"socket. To open a TCP socket (for use with the newer syslog daemons such as " -"rsyslog), specify a value of :const:`socket.SOCK_STREAM`." +"to send the message to the syslog. If *facility* is not " +"specified, :const:`LOG_USER` is used. The type of socket opened depends on " +"the *socktype* argument, which defaults to :const:`socket.SOCK_DGRAM` and " +"thus opens a UDP socket. To open a TCP socket (for use with the newer syslog " +"daemons such as rsyslog), specify a value of :const:`socket.SOCK_STREAM`. If " +"*timeout* is specified, it sets a timeout (in seconds) for the socket " +"operations. This can help prevent the program from hanging indefinitely if " +"the syslog server is unreachable. By default, *timeout* is ``None``, meaning " +"no timeout is applied." msgstr "" -#: ../../library/logging.handlers.rst:638 +#: ../../library/logging.handlers.rst:643 msgid "" -"Note that if your server is not listening on UDP port 514, :class:" -"`SysLogHandler` may appear not to work. In that case, check what address you " -"should be using for a domain socket - it's system dependent. For example, on " -"Linux it's usually '/dev/log' but on OS/X it's '/var/run/syslog'. You'll " -"need to check your platform and use the appropriate address (you may need to " -"do this check at runtime if your application needs to run on several " -"platforms). On Windows, you pretty much have to use the UDP option." +"Note that if your server is not listening on UDP port " +"514, :class:`SysLogHandler` may appear not to work. In that case, check what " +"address you should be using for a domain socket - it's system dependent. For " +"example, on Linux it's usually '/dev/log' but on OS/X it's '/var/run/" +"syslog'. You'll need to check your platform and use the appropriate address " +"(you may need to do this check at runtime if your application needs to run " +"on several platforms). On Windows, you pretty much have to use the UDP " +"option." msgstr "" -#: ../../library/logging.handlers.rst:647 +#: ../../library/logging.handlers.rst:652 msgid "" "On macOS 12.x (Monterey), Apple has changed the behaviour of their syslog " "daemon - it no longer listens on a domain socket. Therefore, you cannot " "expect :class:`SysLogHandler` to work on this system." msgstr "" -#: ../../library/logging.handlers.rst:651 +#: ../../library/logging.handlers.rst:656 msgid "See :gh:`91070` for more information." msgstr "" -#: ../../library/logging.handlers.rst:653 +#: ../../library/logging.handlers.rst:658 msgid "*socktype* was added." msgstr "新增 *socktype*。" -#: ../../library/logging.handlers.rst:659 +#: ../../library/logging.handlers.rst:661 +#, fuzzy +msgid "*timeout* was added." +msgstr "新增 *socktype*。" + +#: ../../library/logging.handlers.rst:666 msgid "Closes the socket to the remote host." msgstr "" -#: ../../library/logging.handlers.rst:663 +#: ../../library/logging.handlers.rst:670 msgid "" "Tries to create a socket and, if it's not a datagram socket, connect it to " "the other end. This method is called during handler initialization, but it's " @@ -869,13 +882,13 @@ msgid "" "socket at that point." msgstr "" -#: ../../library/logging.handlers.rst:673 +#: ../../library/logging.handlers.rst:680 msgid "" "The record is formatted, and then sent to the syslog server. If exception " "information is present, it is *not* sent to the server." msgstr "" -#: ../../library/logging.handlers.rst:676 +#: ../../library/logging.handlers.rst:683 msgid "" "(See: :issue:`12168`.) In earlier versions, the message sent to the syslog " "daemons was always terminated with a NUL byte, because early versions of " @@ -886,7 +899,7 @@ msgid "" "byte on as part of the message." msgstr "" -#: ../../library/logging.handlers.rst:685 +#: ../../library/logging.handlers.rst:692 msgid "" "To enable easier handling of syslog messages in the face of all these " "differing daemon behaviours, the appending of the NUL byte has been made " @@ -896,7 +909,7 @@ msgid "" "*not* append the NUL terminator." msgstr "" -#: ../../library/logging.handlers.rst:692 +#: ../../library/logging.handlers.rst:699 msgid "" "(See: :issue:`12419`.) In earlier versions, there was no facility for an " "\"ident\" or \"tag\" prefix to identify the source of the message. This can " @@ -907,262 +920,262 @@ msgid "" "bytes, and is prepended to the message exactly as is." msgstr "" -#: ../../library/logging.handlers.rst:703 +#: ../../library/logging.handlers.rst:710 msgid "" "Encodes the facility and priority into an integer. You can pass in strings " "or integers - if strings are passed, internal mapping dictionaries are used " "to convert them to integers." msgstr "" -#: ../../library/logging.handlers.rst:707 +#: ../../library/logging.handlers.rst:714 msgid "" "The symbolic ``LOG_`` values are defined in :class:`SysLogHandler` and " "mirror the values defined in the ``sys/syslog.h`` header file." msgstr "" -#: ../../library/logging.handlers.rst:710 +#: ../../library/logging.handlers.rst:717 msgid "**Priorities**" msgstr "" -#: ../../library/logging.handlers.rst:713 -#: ../../library/logging.handlers.rst:735 +#: ../../library/logging.handlers.rst:720 +#: ../../library/logging.handlers.rst:742 msgid "Name (string)" msgstr "" -#: ../../library/logging.handlers.rst:713 -#: ../../library/logging.handlers.rst:735 +#: ../../library/logging.handlers.rst:720 +#: ../../library/logging.handlers.rst:742 msgid "Symbolic value" msgstr "" -#: ../../library/logging.handlers.rst:715 +#: ../../library/logging.handlers.rst:722 msgid "``alert``" msgstr "``alert``" -#: ../../library/logging.handlers.rst:715 +#: ../../library/logging.handlers.rst:722 msgid "LOG_ALERT" msgstr "LOG_ALERT" -#: ../../library/logging.handlers.rst:717 +#: ../../library/logging.handlers.rst:724 msgid "``crit`` or ``critical``" msgstr "``crit`` 或 ``critical``" -#: ../../library/logging.handlers.rst:717 +#: ../../library/logging.handlers.rst:724 msgid "LOG_CRIT" msgstr "LOG_CRIT" -#: ../../library/logging.handlers.rst:719 +#: ../../library/logging.handlers.rst:726 msgid "``debug``" msgstr "``debug``" -#: ../../library/logging.handlers.rst:719 +#: ../../library/logging.handlers.rst:726 msgid "LOG_DEBUG" msgstr "LOG_DEBUG" -#: ../../library/logging.handlers.rst:721 +#: ../../library/logging.handlers.rst:728 msgid "``emerg`` or ``panic``" msgstr "``emerg`` 或 ``panic``" -#: ../../library/logging.handlers.rst:721 +#: ../../library/logging.handlers.rst:728 msgid "LOG_EMERG" msgstr "LOG_EMERG" -#: ../../library/logging.handlers.rst:723 +#: ../../library/logging.handlers.rst:730 msgid "``err`` or ``error``" msgstr "``err`` 或 ``error``" -#: ../../library/logging.handlers.rst:723 +#: ../../library/logging.handlers.rst:730 msgid "LOG_ERR" msgstr "LOG_ERR" -#: ../../library/logging.handlers.rst:725 +#: ../../library/logging.handlers.rst:732 msgid "``info``" msgstr "``info``" -#: ../../library/logging.handlers.rst:725 +#: ../../library/logging.handlers.rst:732 msgid "LOG_INFO" msgstr "LOG_INFO" -#: ../../library/logging.handlers.rst:727 +#: ../../library/logging.handlers.rst:734 msgid "``notice``" msgstr "``notice``" -#: ../../library/logging.handlers.rst:727 +#: ../../library/logging.handlers.rst:734 msgid "LOG_NOTICE" msgstr "LOG_NOTICE" -#: ../../library/logging.handlers.rst:729 +#: ../../library/logging.handlers.rst:736 msgid "``warn`` or ``warning``" msgstr "``warn`` 或 ``warning``" -#: ../../library/logging.handlers.rst:729 +#: ../../library/logging.handlers.rst:736 msgid "LOG_WARNING" msgstr "LOG_WARNING" -#: ../../library/logging.handlers.rst:732 +#: ../../library/logging.handlers.rst:739 msgid "**Facilities**" msgstr "" -#: ../../library/logging.handlers.rst:737 +#: ../../library/logging.handlers.rst:744 msgid "``auth``" msgstr "``auth``" -#: ../../library/logging.handlers.rst:737 +#: ../../library/logging.handlers.rst:744 msgid "LOG_AUTH" msgstr "LOG_AUTH" -#: ../../library/logging.handlers.rst:739 +#: ../../library/logging.handlers.rst:746 msgid "``authpriv``" msgstr "``authpriv``" -#: ../../library/logging.handlers.rst:739 +#: ../../library/logging.handlers.rst:746 msgid "LOG_AUTHPRIV" msgstr "LOG_AUTHPRIV" -#: ../../library/logging.handlers.rst:741 +#: ../../library/logging.handlers.rst:748 msgid "``cron``" msgstr "``cron``" -#: ../../library/logging.handlers.rst:741 +#: ../../library/logging.handlers.rst:748 msgid "LOG_CRON" msgstr "LOG_CRON" -#: ../../library/logging.handlers.rst:743 +#: ../../library/logging.handlers.rst:750 msgid "``daemon``" msgstr "``daemon``" -#: ../../library/logging.handlers.rst:743 +#: ../../library/logging.handlers.rst:750 msgid "LOG_DAEMON" msgstr "LOG_DAEMON" -#: ../../library/logging.handlers.rst:745 +#: ../../library/logging.handlers.rst:752 msgid "``ftp``" msgstr "``ftp``" -#: ../../library/logging.handlers.rst:745 +#: ../../library/logging.handlers.rst:752 msgid "LOG_FTP" msgstr "LOG_FTP" -#: ../../library/logging.handlers.rst:747 +#: ../../library/logging.handlers.rst:754 msgid "``kern``" msgstr "``kern``" -#: ../../library/logging.handlers.rst:747 +#: ../../library/logging.handlers.rst:754 msgid "LOG_KERN" msgstr "LOG_KERN" -#: ../../library/logging.handlers.rst:749 +#: ../../library/logging.handlers.rst:756 msgid "``lpr``" msgstr "``lpr``" -#: ../../library/logging.handlers.rst:749 +#: ../../library/logging.handlers.rst:756 msgid "LOG_LPR" msgstr "LOG_LPR" -#: ../../library/logging.handlers.rst:751 +#: ../../library/logging.handlers.rst:758 msgid "``mail``" msgstr "``mail``" -#: ../../library/logging.handlers.rst:751 +#: ../../library/logging.handlers.rst:758 msgid "LOG_MAIL" msgstr "LOG_MAIL" -#: ../../library/logging.handlers.rst:753 +#: ../../library/logging.handlers.rst:760 msgid "``news``" msgstr "``news``" -#: ../../library/logging.handlers.rst:753 +#: ../../library/logging.handlers.rst:760 msgid "LOG_NEWS" msgstr "LOG_NEWS" -#: ../../library/logging.handlers.rst:755 +#: ../../library/logging.handlers.rst:762 msgid "``syslog``" msgstr "``syslog``" -#: ../../library/logging.handlers.rst:755 +#: ../../library/logging.handlers.rst:762 msgid "LOG_SYSLOG" msgstr "LOG_SYSLOG" -#: ../../library/logging.handlers.rst:757 +#: ../../library/logging.handlers.rst:764 msgid "``user``" msgstr "``user``" -#: ../../library/logging.handlers.rst:757 +#: ../../library/logging.handlers.rst:764 msgid "LOG_USER" msgstr "LOG_USER" -#: ../../library/logging.handlers.rst:759 +#: ../../library/logging.handlers.rst:766 msgid "``uucp``" msgstr "``uucp``" -#: ../../library/logging.handlers.rst:759 +#: ../../library/logging.handlers.rst:766 msgid "LOG_UUCP" msgstr "LOG_UUCP" -#: ../../library/logging.handlers.rst:761 +#: ../../library/logging.handlers.rst:768 msgid "``local0``" msgstr "``local0``" -#: ../../library/logging.handlers.rst:761 +#: ../../library/logging.handlers.rst:768 msgid "LOG_LOCAL0" msgstr "LOG_LOCAL0" -#: ../../library/logging.handlers.rst:763 +#: ../../library/logging.handlers.rst:770 msgid "``local1``" msgstr "``local1``" -#: ../../library/logging.handlers.rst:763 +#: ../../library/logging.handlers.rst:770 msgid "LOG_LOCAL1" msgstr "LOG_LOCAL1" -#: ../../library/logging.handlers.rst:765 +#: ../../library/logging.handlers.rst:772 msgid "``local2``" msgstr "``local2``" -#: ../../library/logging.handlers.rst:765 +#: ../../library/logging.handlers.rst:772 msgid "LOG_LOCAL2" msgstr "LOG_LOCAL2" -#: ../../library/logging.handlers.rst:767 +#: ../../library/logging.handlers.rst:774 msgid "``local3``" msgstr "``local3``" -#: ../../library/logging.handlers.rst:767 +#: ../../library/logging.handlers.rst:774 msgid "LOG_LOCAL3" msgstr "LOG_LOCAL3" -#: ../../library/logging.handlers.rst:769 +#: ../../library/logging.handlers.rst:776 msgid "``local4``" msgstr "``local4``" -#: ../../library/logging.handlers.rst:769 +#: ../../library/logging.handlers.rst:776 msgid "LOG_LOCAL4" msgstr "LOG_LOCAL4" -#: ../../library/logging.handlers.rst:771 +#: ../../library/logging.handlers.rst:778 msgid "``local5``" msgstr "``local5``" -#: ../../library/logging.handlers.rst:771 +#: ../../library/logging.handlers.rst:778 msgid "LOG_LOCAL5" msgstr "LOG_LOCAL5" -#: ../../library/logging.handlers.rst:773 +#: ../../library/logging.handlers.rst:780 msgid "``local6``" msgstr "``local6``" -#: ../../library/logging.handlers.rst:773 +#: ../../library/logging.handlers.rst:780 msgid "LOG_LOCAL6" msgstr "LOG_LOCAL6" -#: ../../library/logging.handlers.rst:775 +#: ../../library/logging.handlers.rst:782 msgid "``local7``" msgstr "``local7``" -#: ../../library/logging.handlers.rst:775 +#: ../../library/logging.handlers.rst:782 msgid "LOG_LOCAL7" msgstr "LOG_LOCAL7" -#: ../../library/logging.handlers.rst:780 +#: ../../library/logging.handlers.rst:787 msgid "" "Maps a logging level name to a syslog priority name. You may need to " "override this if you are using custom levels, or if the default algorithm is " @@ -1171,11 +1184,11 @@ msgid "" "all other level names to 'warning'." msgstr "" -#: ../../library/logging.handlers.rst:790 +#: ../../library/logging.handlers.rst:797 msgid "NTEventLogHandler" msgstr "NTEventLogHandler" -#: ../../library/logging.handlers.rst:792 +#: ../../library/logging.handlers.rst:799 msgid "" "The :class:`NTEventLogHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to a local Windows NT, Windows " @@ -1183,23 +1196,23 @@ msgid "" "Win32 extensions for Python installed." msgstr "" -#: ../../library/logging.handlers.rst:800 +#: ../../library/logging.handlers.rst:807 msgid "" "Returns a new instance of the :class:`NTEventLogHandler` class. The " "*appname* is used to define the application name as it appears in the event " "log. An appropriate registry entry is created using this name. The *dllname* " "should give the fully qualified pathname of a .dll or .exe which contains " -"message definitions to hold in the log (if not specified, ``'win32service." -"pyd'`` is used - this is installed with the Win32 extensions and contains " -"some basic placeholder message definitions. Note that use of these " -"placeholders will make your event logs big, as the entire message source is " -"held in the log. If you want slimmer logs, you have to pass in the name of " -"your own .dll or .exe which contains the message definitions you want to use " -"in the event log). The *logtype* is one of ``'Application'``, ``'System'`` " -"or ``'Security'``, and defaults to ``'Application'``." +"message definitions to hold in the log (if not specified, " +"``'win32service.pyd'`` is used - this is installed with the Win32 extensions " +"and contains some basic placeholder message definitions. Note that use of " +"these placeholders will make your event logs big, as the entire message " +"source is held in the log. If you want slimmer logs, you have to pass in the " +"name of your own .dll or .exe which contains the message definitions you " +"want to use in the event log). The *logtype* is one of ``'Application'``, " +"``'System'`` or ``'Security'``, and defaults to ``'Application'``." msgstr "" -#: ../../library/logging.handlers.rst:816 +#: ../../library/logging.handlers.rst:823 msgid "" "At this point, you can remove the application name from the registry as a " "source of event log entries. However, if you do this, you will not be able " @@ -1208,30 +1221,31 @@ msgid "" "not do this." msgstr "" -#: ../../library/logging.handlers.rst:825 +#: ../../library/logging.handlers.rst:832 msgid "" "Determines the message ID, event category and event type, and then logs the " "message in the NT event log." msgstr "" -#: ../../library/logging.handlers.rst:831 +#: ../../library/logging.handlers.rst:838 msgid "" "Returns the event category for the record. Override this if you want to " "specify your own categories. This version returns 0." msgstr "" -#: ../../library/logging.handlers.rst:837 +#: ../../library/logging.handlers.rst:844 msgid "" "Returns the event type for the record. Override this if you want to specify " "your own types. This version does a mapping using the handler's typemap " "attribute, which is set up in :meth:`__init__` to a dictionary which " -"contains mappings for :const:`DEBUG`, :const:`INFO`, :const:`WARNING`, :" -"const:`ERROR` and :const:`CRITICAL`. If you are using your own levels, you " -"will either need to override this method or place a suitable dictionary in " -"the handler's *typemap* attribute." +"contains mappings " +"for :const:`DEBUG`, :const:`INFO`, :const:`WARNING`, :const:`ERROR` " +"and :const:`CRITICAL`. If you are using your own levels, you will either " +"need to override this method or place a suitable dictionary in the handler's " +"*typemap* attribute." msgstr "" -#: ../../library/logging.handlers.rst:848 +#: ../../library/logging.handlers.rst:855 msgid "" "Returns the message ID for the record. If you are using your own messages, " "you could do this by having the *msg* passed to the logger being an ID " @@ -1240,17 +1254,17 @@ msgid "" "message ID in :file:`win32service.pyd`." msgstr "" -#: ../../library/logging.handlers.rst:857 +#: ../../library/logging.handlers.rst:864 msgid "SMTPHandler" msgstr "SMTPHandler" -#: ../../library/logging.handlers.rst:859 +#: ../../library/logging.handlers.rst:866 msgid "" "The :class:`SMTPHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to an email address via SMTP." msgstr "" -#: ../../library/logging.handlers.rst:865 +#: ../../library/logging.handlers.rst:872 msgid "" "Returns a new instance of the :class:`SMTPHandler` class. The instance is " "initialized with the from and to addresses and subject line of the email. " @@ -1261,41 +1275,41 @@ msgid "" "*credentials* argument." msgstr "" -#: ../../library/logging.handlers.rst:872 +#: ../../library/logging.handlers.rst:879 msgid "" "To specify the use of a secure protocol (TLS), pass in a tuple to the " "*secure* argument. This will only be used when authentication credentials " "are supplied. The tuple should be either an empty tuple, or a single-value " "tuple with the name of a keyfile, or a 2-value tuple with the names of the " -"keyfile and certificate file. (This tuple is passed to the :meth:`smtplib." -"SMTP.starttls` method.)" +"keyfile and certificate file. (This tuple is passed to " +"the :meth:`smtplib.SMTP.starttls` method.)" msgstr "" -#: ../../library/logging.handlers.rst:879 +#: ../../library/logging.handlers.rst:886 msgid "" "A timeout can be specified for communication with the SMTP server using the " "*timeout* argument." msgstr "" -#: ../../library/logging.handlers.rst:882 +#: ../../library/logging.handlers.rst:889 msgid "Added the *timeout* parameter." msgstr "新增 *timeout* 參數。" -#: ../../library/logging.handlers.rst:887 +#: ../../library/logging.handlers.rst:894 msgid "Formats the record and sends it to the specified addressees." msgstr "" -#: ../../library/logging.handlers.rst:892 +#: ../../library/logging.handlers.rst:899 msgid "" "If you want to specify a subject line which is record-dependent, override " "this method." msgstr "" -#: ../../library/logging.handlers.rst:898 +#: ../../library/logging.handlers.rst:905 msgid "MemoryHandler" msgstr "MemoryHandler" -#: ../../library/logging.handlers.rst:900 +#: ../../library/logging.handlers.rst:907 msgid "" "The :class:`MemoryHandler` class, located in the :mod:`logging.handlers` " "module, supports buffering of logging records in memory, periodically " @@ -1303,41 +1317,41 @@ msgid "" "buffer is full, or when an event of a certain severity or greater is seen." msgstr "" -#: ../../library/logging.handlers.rst:905 +#: ../../library/logging.handlers.rst:912 msgid "" -":class:`MemoryHandler` is a subclass of the more general :class:" -"`BufferingHandler`, which is an abstract class. This buffers logging records " -"in memory. Whenever each record is added to the buffer, a check is made by " -"calling :meth:`shouldFlush` to see if the buffer should be flushed. If it " -"should, then :meth:`flush` is expected to do the flushing." +":class:`MemoryHandler` is a subclass of the more " +"general :class:`BufferingHandler`, which is an abstract class. This buffers " +"logging records in memory. Whenever each record is added to the buffer, a " +"check is made by calling :meth:`shouldFlush` to see if the buffer should be " +"flushed. If it should, then :meth:`flush` is expected to do the flushing." msgstr "" -#: ../../library/logging.handlers.rst:914 +#: ../../library/logging.handlers.rst:921 msgid "" "Initializes the handler with a buffer of the specified capacity. Here, " "*capacity* means the number of logging records buffered." msgstr "" -#: ../../library/logging.handlers.rst:920 +#: ../../library/logging.handlers.rst:927 msgid "" -"Append the record to the buffer. If :meth:`shouldFlush` returns true, call :" -"meth:`flush` to process the buffer." +"Append the record to the buffer. If :meth:`shouldFlush` returns true, " +"call :meth:`flush` to process the buffer." msgstr "" -#: ../../library/logging.handlers.rst:926 +#: ../../library/logging.handlers.rst:933 msgid "" "For a :class:`BufferingHandler` instance, flushing means that it sets the " "buffer to an empty list. This method can be overwritten to implement more " "useful flushing behavior." msgstr "" -#: ../../library/logging.handlers.rst:933 +#: ../../library/logging.handlers.rst:940 msgid "" "Return ``True`` if the buffer is up to capacity. This method can be " "overridden to implement custom flushing strategies." msgstr "" -#: ../../library/logging.handlers.rst:939 +#: ../../library/logging.handlers.rst:946 msgid "" "Returns a new instance of the :class:`MemoryHandler` class. The instance is " "initialized with a buffer size of *capacity* (number of records buffered). " @@ -1349,15 +1363,15 @@ msgid "" "the buffer will occur when the handler is closed." msgstr "" -#: ../../library/logging.handlers.rst:948 +#: ../../library/logging.handlers.rst:955 msgid "The *flushOnClose* parameter was added." msgstr "新增 *flushOnClose* 參數。" -#: ../../library/logging.handlers.rst:954 +#: ../../library/logging.handlers.rst:961 msgid "Calls :meth:`flush`, sets the target to ``None`` and clears the buffer." msgstr "" -#: ../../library/logging.handlers.rst:960 +#: ../../library/logging.handlers.rst:967 msgid "" "For a :class:`MemoryHandler` instance, flushing means just sending the " "buffered records to the target, if there is one. The buffer is also cleared " @@ -1365,60 +1379,60 @@ msgid "" "behavior." msgstr "" -#: ../../library/logging.handlers.rst:967 +#: ../../library/logging.handlers.rst:974 msgid "Sets the target handler for this handler." msgstr "" -#: ../../library/logging.handlers.rst:972 +#: ../../library/logging.handlers.rst:979 msgid "Checks for buffer full or a record at the *flushLevel* or higher." msgstr "" -#: ../../library/logging.handlers.rst:978 +#: ../../library/logging.handlers.rst:985 msgid "HTTPHandler" msgstr "HTTPHandler" -#: ../../library/logging.handlers.rst:980 +#: ../../library/logging.handlers.rst:987 msgid "" "The :class:`HTTPHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to a web server, using either " "``GET`` or ``POST`` semantics." msgstr "" -#: ../../library/logging.handlers.rst:987 +#: ../../library/logging.handlers.rst:994 msgid "" "Returns a new instance of the :class:`HTTPHandler` class. The *host* can be " "of the form ``host:port``, should you need to use a specific port number. " "If no *method* is specified, ``GET`` is used. If *secure* is true, a HTTPS " -"connection will be used. The *context* parameter may be set to a :class:`ssl." -"SSLContext` instance to configure the SSL settings used for the HTTPS " -"connection. If *credentials* is specified, it should be a 2-tuple consisting " -"of userid and password, which will be placed in a HTTP 'Authorization' " -"header using Basic authentication. If you specify credentials, you should " -"also specify secure=True so that your userid and password are not passed in " -"cleartext across the wire." +"connection will be used. The *context* parameter may be set to " +"a :class:`ssl.SSLContext` instance to configure the SSL settings used for " +"the HTTPS connection. If *credentials* is specified, it should be a 2-tuple " +"consisting of userid and password, which will be placed in a HTTP " +"'Authorization' header using Basic authentication. If you specify " +"credentials, you should also specify secure=True so that your userid and " +"password are not passed in cleartext across the wire." msgstr "" -#: ../../library/logging.handlers.rst:998 +#: ../../library/logging.handlers.rst:1005 msgid "The *context* parameter was added." msgstr "新增 *context* 參數。" -#: ../../library/logging.handlers.rst:1003 +#: ../../library/logging.handlers.rst:1010 msgid "" "Provides a dictionary, based on ``record``, which is to be URL-encoded and " -"sent to the web server. The default implementation just returns ``record." -"__dict__``. This method can be overridden if e.g. only a subset of :class:" -"`~logging.LogRecord` is to be sent to the web server, or if more specific " -"customization of what's sent to the server is required." +"sent to the web server. The default implementation just returns " +"``record.__dict__``. This method can be overridden if e.g. only a subset " +"of :class:`~logging.LogRecord` is to be sent to the web server, or if more " +"specific customization of what's sent to the server is required." msgstr "" -#: ../../library/logging.handlers.rst:1011 +#: ../../library/logging.handlers.rst:1018 msgid "" -"Sends the record to the web server as a URL-encoded dictionary. The :meth:" -"`mapLogRecord` method is used to convert the record to the dictionary to be " -"sent." +"Sends the record to the web server as a URL-encoded dictionary. " +"The :meth:`mapLogRecord` method is used to convert the record to the " +"dictionary to be sent." msgstr "" -#: ../../library/logging.handlers.rst:1015 +#: ../../library/logging.handlers.rst:1022 msgid "" "Since preparing a record for sending it to a web server is not the same as a " "generic formatting operation, using :meth:`~logging.Handler.setFormatter` to " @@ -1428,18 +1442,18 @@ msgid "" "the dictionary in a form suitable for sending to a web server." msgstr "" -#: ../../library/logging.handlers.rst:1028 +#: ../../library/logging.handlers.rst:1035 msgid "QueueHandler" msgstr "QueueHandler" -#: ../../library/logging.handlers.rst:1032 +#: ../../library/logging.handlers.rst:1039 msgid "" "The :class:`QueueHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to a queue, such as those " "implemented in the :mod:`queue` or :mod:`multiprocessing` modules." msgstr "" -#: ../../library/logging.handlers.rst:1036 +#: ../../library/logging.handlers.rst:1043 msgid "" "Along with the :class:`QueueListener` class, :class:`QueueHandler` can be " "used to let handlers do their work on a separate thread from the one which " @@ -1449,7 +1463,7 @@ msgid "" "an email via :class:`SMTPHandler`) are done on a separate thread." msgstr "" -#: ../../library/logging.handlers.rst:1045 +#: ../../library/logging.handlers.rst:1052 msgid "" "Returns a new instance of the :class:`QueueHandler` class. The instance is " "initialized with the queue to send messages to. The *queue* can be any queue-" @@ -1459,63 +1473,66 @@ msgid "" "instances for *queue*." msgstr "" -#: ../../library/logging.handlers.rst:1052 -#: ../../library/logging.handlers.rst:1150 +#: ../../library/logging.handlers.rst:1059 +#: ../../library/logging.handlers.rst:1157 msgid "" -"If you are using :mod:`multiprocessing`, you should avoid using :class:" -"`~queue.SimpleQueue` and instead use :class:`multiprocessing.Queue`." +"If you are using :mod:`multiprocessing`, you should avoid " +"using :class:`~queue.SimpleQueue` and instead " +"use :class:`multiprocessing.Queue`." msgstr "" -#: ../../library/logging.handlers.rst:1057 +#: ../../library/logging.handlers.rst:1064 msgid "" "The :mod:`multiprocessing` module uses an internal logger created and " -"accessed via :meth:`~multiprocessing.get_logger`. :class:`multiprocessing." -"Queue` will log ``DEBUG`` level messages upon items being queued. If those " -"log messages are processed by a :class:`QueueHandler` using the same :class:" -"`multiprocessing.Queue` instance, it will cause a deadlock or infinite " -"recursion." +"accessed " +"via :meth:`~multiprocessing.get_logger`. :class:`multiprocessing.Queue` will " +"log ``DEBUG`` level messages upon items being queued. If those log messages " +"are processed by a :class:`QueueHandler` using the " +"same :class:`multiprocessing.Queue` instance, it will cause a deadlock or " +"infinite recursion." msgstr "" -#: ../../library/logging.handlers.rst:1066 +#: ../../library/logging.handlers.rst:1073 msgid "" -"Enqueues the result of preparing the LogRecord. Should an exception occur (e." -"g. because a bounded queue has filled up), the :meth:`~logging.Handler." -"handleError` method is called to handle the error. This can result in the " -"record silently being dropped (if :data:`logging.raiseExceptions` is " -"``False``) or a message printed to ``sys.stderr`` (if :data:`logging." -"raiseExceptions` is ``True``)." +"Enqueues the result of preparing the LogRecord. Should an exception occur " +"(e.g. because a bounded queue has filled up), " +"the :meth:`~logging.Handler.handleError` method is called to handle the " +"error. This can result in the record silently being dropped " +"(if :data:`logging.raiseExceptions` is ``False``) or a message printed to " +"``sys.stderr`` (if :data:`logging.raiseExceptions` is ``True``)." msgstr "" -#: ../../library/logging.handlers.rst:1075 +#: ../../library/logging.handlers.rst:1082 msgid "" "Prepares a record for queuing. The object returned by this method is " "enqueued." msgstr "" -#: ../../library/logging.handlers.rst:1078 +#: ../../library/logging.handlers.rst:1085 msgid "" "The base implementation formats the record to merge the message, arguments, " "exception and stack information, if present. It also removes unpickleable " -"items from the record in-place. Specifically, it overwrites the record's :" -"attr:`msg` and :attr:`message` attributes with the merged message (obtained " -"by calling the handler's :meth:`format` method), and sets the :attr:`args`, :" -"attr:`exc_info` and :attr:`exc_text` attributes to ``None``." +"items from the record in-place. Specifically, it overwrites the " +"record's :attr:`msg` and :attr:`message` attributes with the merged message " +"(obtained by calling the handler's :meth:`format` method), and sets " +"the :attr:`args`, :attr:`exc_info` and :attr:`exc_text` attributes to " +"``None``." msgstr "" -#: ../../library/logging.handlers.rst:1086 +#: ../../library/logging.handlers.rst:1093 msgid "" "You might want to override this method if you want to convert the record to " "a dict or JSON string, or send a modified copy of the record while leaving " "the original intact." msgstr "" -#: ../../library/logging.handlers.rst:1090 +#: ../../library/logging.handlers.rst:1097 msgid "" "The base implementation formats the message with arguments, sets the " "``message`` and ``msg`` attributes to the formatted message and sets the " "``args`` and ``exc_text`` attributes to ``None`` to allow pickling and to " -"prevent further attempts at formatting. This means that a handler on the :" -"class:`QueueListener` side won't have the information to do custom " +"prevent further attempts at formatting. This means that a handler on " +"the :class:`QueueListener` side won't have the information to do custom " "formatting, e.g. of exceptions. You may wish to subclass ``QueueHandler`` " "and override this method to e.g. avoid setting ``exc_text`` to ``None``. " "Note that the ``message`` / ``msg`` / ``args`` changes are related to " @@ -1525,36 +1542,36 @@ msgid "" "libraries that you use.)" msgstr "" -#: ../../library/logging.handlers.rst:1106 +#: ../../library/logging.handlers.rst:1113 msgid "" "Enqueues the record on the queue using ``put_nowait()``; you may want to " "override this if you want to use blocking behaviour, or a timeout, or a " "customized queue implementation." msgstr "" -#: ../../library/logging.handlers.rst:1112 +#: ../../library/logging.handlers.rst:1119 msgid "" "When created via configuration using :func:`~logging.config.dictConfig`, " "this attribute will contain a :class:`QueueListener` instance for use with " "this handler. Otherwise, it will be ``None``." msgstr "" -#: ../../library/logging.handlers.rst:1121 +#: ../../library/logging.handlers.rst:1128 msgid "QueueListener" msgstr "QueueListener" -#: ../../library/logging.handlers.rst:1125 +#: ../../library/logging.handlers.rst:1132 msgid "" "The :class:`QueueListener` class, located in the :mod:`logging.handlers` " "module, supports receiving logging messages from a queue, such as those " "implemented in the :mod:`queue` or :mod:`multiprocessing` modules. The " "messages are received from a queue in an internal thread and passed, on the " -"same thread, to one or more handlers for processing. While :class:" -"`QueueListener` is not itself a handler, it is documented here because it " -"works hand-in-hand with :class:`QueueHandler`." +"same thread, to one or more handlers for processing. " +"While :class:`QueueListener` is not itself a handler, it is documented here " +"because it works hand-in-hand with :class:`QueueHandler`." msgstr "" -#: ../../library/logging.handlers.rst:1133 +#: ../../library/logging.handlers.rst:1140 msgid "" "Along with the :class:`QueueHandler` class, :class:`QueueListener` can be " "used to let handlers do their work on a separate thread from the one which " @@ -1564,18 +1581,18 @@ msgid "" "an email via :class:`SMTPHandler`) are done on a separate thread." msgstr "" -#: ../../library/logging.handlers.rst:1142 +#: ../../library/logging.handlers.rst:1149 msgid "" "Returns a new instance of the :class:`QueueListener` class. The instance is " "initialized with the queue to send messages to and a list of handlers which " "will handle entries placed on the queue. The queue can be any queue-like " "object; it's passed as-is to the :meth:`dequeue` method, which needs to know " "how to get messages from it. The queue is not *required* to have the task " -"tracking API (though it's used if available), which means that you can use :" -"class:`~queue.SimpleQueue` instances for *queue*." +"tracking API (though it's used if available), which means that you can " +"use :class:`~queue.SimpleQueue` instances for *queue*." msgstr "" -#: ../../library/logging.handlers.rst:1153 +#: ../../library/logging.handlers.rst:1160 msgid "" "If ``respect_handler_level`` is ``True``, a handler's level is respected " "(compared with the level for the message) when deciding whether to pass " @@ -1583,87 +1600,96 @@ msgid "" "versions - to always pass each message to each handler." msgstr "" -#: ../../library/logging.handlers.rst:1158 +#: ../../library/logging.handlers.rst:1165 msgid "The ``respect_handler_level`` argument was added." msgstr "新增 ``respect_handler_level`` 引數。" -#: ../../library/logging.handlers.rst:1163 +#: ../../library/logging.handlers.rst:1168 +msgid "" +":class:`QueueListener` can now be used as a context manager " +"via :keyword:`with`. When entering the context, the listener is started. " +"When exiting the context, the listener is " +"stopped. :meth:`~contextmanager.__enter__` returns " +"the :class:`QueueListener` object." +msgstr "" + +#: ../../library/logging.handlers.rst:1177 msgid "Dequeues a record and return it, optionally blocking." msgstr "" -#: ../../library/logging.handlers.rst:1165 +#: ../../library/logging.handlers.rst:1179 msgid "" "The base implementation uses ``get()``. You may want to override this method " "if you want to use timeouts or work with custom queue implementations." msgstr "" -#: ../../library/logging.handlers.rst:1171 +#: ../../library/logging.handlers.rst:1185 msgid "Prepare a record for handling." msgstr "" -#: ../../library/logging.handlers.rst:1173 +#: ../../library/logging.handlers.rst:1187 msgid "" "This implementation just returns the passed-in record. You may want to " "override this method if you need to do any custom marshalling or " "manipulation of the record before passing it to the handlers." msgstr "" -#: ../../library/logging.handlers.rst:1179 +#: ../../library/logging.handlers.rst:1193 msgid "Handle a record." msgstr "" -#: ../../library/logging.handlers.rst:1181 +#: ../../library/logging.handlers.rst:1195 msgid "" "This just loops through the handlers offering them the record to handle. The " -"actual object passed to the handlers is that which is returned from :meth:" -"`prepare`." +"actual object passed to the handlers is that which is returned " +"from :meth:`prepare`." msgstr "" -#: ../../library/logging.handlers.rst:1187 +#: ../../library/logging.handlers.rst:1201 msgid "Starts the listener." msgstr "" -#: ../../library/logging.handlers.rst:1189 +#: ../../library/logging.handlers.rst:1203 msgid "" "This starts up a background thread to monitor the queue for LogRecords to " "process." msgstr "" -#: ../../library/logging.handlers.rst:1192 +#: ../../library/logging.handlers.rst:1206 msgid "" "Raises :exc:`RuntimeError` if called and the listener is already running." msgstr "" -#: ../../library/logging.handlers.rst:1198 +#: ../../library/logging.handlers.rst:1212 msgid "Stops the listener." msgstr "" -#: ../../library/logging.handlers.rst:1200 +#: ../../library/logging.handlers.rst:1214 msgid "" "This asks the thread to terminate, and then waits for it to do so. Note that " "if you don't call this before your application exits, there may be some " "records still left on the queue, which won't be processed." msgstr "" -#: ../../library/logging.handlers.rst:1206 +#: ../../library/logging.handlers.rst:1220 msgid "" "Writes a sentinel to the queue to tell the listener to quit. This " "implementation uses ``put_nowait()``. You may want to override this method " "if you want to use timeouts or work with custom queue implementations." msgstr "" -#: ../../library/logging.handlers.rst:1216 +#: ../../library/logging.handlers.rst:1230 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../library/logging.handlers.rst:1217 +#: ../../library/logging.handlers.rst:1231 msgid "API reference for the logging module." msgstr "" -#: ../../library/logging.handlers.rst:1219 +#: ../../library/logging.handlers.rst:1233 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.handlers.rst:1220 +#: ../../library/logging.handlers.rst:1234 msgid "Configuration API for the logging module." msgstr "" diff --git a/library/logging.po b/library/logging.po index 2d4e3808317..fd274a0b1ef 100644 --- a/library/logging.po +++ b/library/logging.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-21 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-03-28 22:40+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -206,15 +206,15 @@ msgid "" "are all descendants of ``foo``. In addition, all loggers are descendants of " "the root logger. The logger name hierarchy is analogous to the Python " "package hierarchy, and identical to it if you organise your loggers on a per-" -"module basis using the recommended construction ``logging." -"getLogger(__name__)``. That's because in a module, ``__name__`` is the " -"module's name in the Python package namespace." +"module basis using the recommended construction " +"``logging.getLogger(__name__)``. That's because in a module, ``__name__`` " +"is the module's name in the Python package namespace." msgstr "" #: ../../library/logging.rst:123 msgid "" -"This is the logger's name, and is the value that was passed to :func:" -"`getLogger` to obtain the logger." +"This is the logger's name, and is the value that was passed " +"to :func:`getLogger` to obtain the logger." msgstr "" #: ../../library/logging.rst:126 ../../library/logging.rst:186 @@ -362,27 +362,29 @@ msgstr "" #: ../../library/logging.rst:223 msgid "" "Indicates if a message of severity *level* would be processed by this " -"logger. This method checks first the module-level level set by ``logging." -"disable(level)`` and then the logger's effective level as determined by :" -"meth:`getEffectiveLevel`." +"logger. This method checks first the module-level level set by " +"``logging.disable(level)`` and then the logger's effective level as " +"determined by :meth:`getEffectiveLevel`." msgstr "" #: ../../library/logging.rst:231 msgid "" -"Indicates the effective level for this logger. If a value other than :const:" -"`NOTSET` has been set using :meth:`setLevel`, it is returned. Otherwise, the " -"hierarchy is traversed towards the root until a value other than :const:" -"`NOTSET` is found, and that value is returned. The value returned is an " -"integer, typically one of :const:`logging.DEBUG`, :const:`logging.INFO` etc." +"Indicates the effective level for this logger. If a value other " +"than :const:`NOTSET` has been set using :meth:`setLevel`, it is returned. " +"Otherwise, the hierarchy is traversed towards the root until a value other " +"than :const:`NOTSET` is found, and that value is returned. The value " +"returned is an integer, typically one " +"of :const:`logging.DEBUG`, :const:`logging.INFO` etc." msgstr "" #: ../../library/logging.rst:241 msgid "" "Returns a logger which is a descendant to this logger, as determined by the " "suffix. Thus, ``logging.getLogger('abc').getChild('def.ghi')`` would return " -"the same logger as would be returned by ``logging.getLogger('abc.def." -"ghi')``. This is a convenience method, useful when the parent logger is " -"named using e.g. ``__name__`` rather than a literal string." +"the same logger as would be returned by " +"``logging.getLogger('abc.def.ghi')``. This is a convenience method, useful " +"when the parent logger is named using e.g. ``__name__`` rather than a " +"literal string." msgstr "" #: ../../library/logging.rst:252 @@ -453,19 +455,19 @@ msgstr "" msgid "" "The third optional keyword argument is *stacklevel*, which defaults to " "``1``. If greater than 1, the corresponding number of stack frames are " -"skipped when computing the line number and function name set in the :class:" -"`LogRecord` created for the logging event. This can be used in logging " -"helpers so that the function name, filename and line number recorded are not " -"the information for the helper function/method, but rather its caller. The " -"name of this parameter mirrors the equivalent one in the :mod:`warnings` " -"module." +"skipped when computing the line number and function name set in " +"the :class:`LogRecord` created for the logging event. This can be used in " +"logging helpers so that the function name, filename and line number recorded " +"are not the information for the helper function/method, but rather its " +"caller. The name of this parameter mirrors the equivalent one in " +"the :mod:`warnings` module." msgstr "" #: ../../library/logging.rst:306 msgid "" "The fourth keyword argument is *extra* which can be used to pass a " -"dictionary which is used to populate the :attr:`~object.__dict__` of the :" -"class:`LogRecord` created for the logging event with user-defined " +"dictionary which is used to populate the :attr:`~object.__dict__` of " +"the :class:`LogRecord` created for the logging event with user-defined " "attributes. These custom attributes can then be used as you like. For " "example, they could be incorporated into logged messages. For example::" msgstr "" @@ -504,12 +506,12 @@ msgstr "" #: ../../library/logging.rst:329 msgid "" "If you choose to use these attributes in logged messages, you need to " -"exercise some care. In the above example, for instance, the :class:" -"`Formatter` has been set up with a format string which expects 'clientip' " -"and 'user' in the attribute dictionary of the :class:`LogRecord`. If these " -"are missing, the message will not be logged because a string formatting " -"exception will occur. So in this case, you always need to pass the *extra* " -"dictionary with these keys." +"exercise some care. In the above example, for instance, " +"the :class:`Formatter` has been set up with a format string which expects " +"'clientip' and 'user' in the attribute dictionary of the :class:`LogRecord`. " +"If these are missing, the message will not be logged because a string " +"formatting exception will occur. So in this case, you always need to pass " +"the *extra* dictionary with these keys." msgstr "" #: ../../library/logging.rst:336 @@ -553,8 +555,8 @@ msgid "" "Logs a message with level :const:`WARNING` on this logger. The arguments are " "interpreted as for :meth:`debug`." msgstr "" -"在此記錄器上記錄一條層級為 :const:`WARNING` 的訊息。這些引數被直譯的方式與 :" -"meth:`debug` 相同。" +"在此記錄器上記錄一條層級為 :const:`WARNING` 的訊息。這些引數被直譯的方式" +"與 :meth:`debug` 相同。" #: ../../library/logging.rst:368 msgid "" @@ -635,8 +637,8 @@ msgid "" "Handles a record by passing it to all handlers associated with this logger " "and its ancestors (until a false value of *propagate* is found). This method " "is used for unpickled records received from a socket, as well as those " -"created locally. Logger-level filtering is applied using :meth:`~Logger." -"filter`." +"created locally. Logger-level filtering is applied " +"using :meth:`~Logger.filter`." msgstr "" #: ../../library/logging.rst:450 @@ -750,17 +752,17 @@ msgstr "" #: ../../library/logging.rst:518 msgid "" -"Handlers have the following attributes and methods. Note that :class:" -"`Handler` is never instantiated directly; this class acts as a base for more " -"useful subclasses. However, the :meth:`!__init__` method in subclasses needs " -"to call :meth:`Handler.__init__`." +"Handlers have the following attributes and methods. Note " +"that :class:`Handler` is never instantiated directly; this class acts as a " +"base for more useful subclasses. However, the :meth:`!__init__` method in " +"subclasses needs to call :meth:`Handler.__init__`." msgstr "" #: ../../library/logging.rst:527 msgid "" "Initializes the :class:`Handler` instance by setting its level, setting the " -"list of filters to the empty list and creating a lock (using :meth:" -"`createLock`) for serializing access to an I/O mechanism." +"list of filters to the empty list and creating a lock " +"(using :meth:`createLock`) for serializing access to an I/O mechanism." msgstr "" #: ../../library/logging.rst:534 @@ -792,8 +794,8 @@ msgstr "" #: ../../library/logging.rst:565 msgid "" -"Sets the formatter for this handler to *fmt*. The *fmt* argument must be a :" -"class:`Formatter` instance or ``None``." +"Sets the formatter for this handler to *fmt*. The *fmt* argument must be " +"a :class:`Formatter` instance or ``None``." msgstr "" #: ../../library/logging.rst:571 @@ -842,14 +844,15 @@ msgstr "" #: ../../library/logging.rst:613 msgid "" "This method should be called from handlers when an exception is encountered " -"during an :meth:`emit` call. If the module-level attribute :data:" -"`raiseExceptions` is ``False``, exceptions get silently ignored. This is " -"what is mostly wanted for a logging system - most users will not care about " -"errors in the logging system, they are more interested in application " -"errors. You could, however, replace this with a custom handler if you wish. " -"The specified record is the one which was being processed when the exception " -"occurred. (The default value of :data:`raiseExceptions` is ``True``, as that " -"is more useful during development)." +"during an :meth:`emit` call. If the module-level " +"attribute :data:`raiseExceptions` is ``False``, exceptions get silently " +"ignored. This is what is mostly wanted for a logging system - most users " +"will not care about errors in the logging system, they are more interested " +"in application errors. You could, however, replace this with a custom " +"handler if you wish. The specified record is the one which was being " +"processed when the exception occurred. (The default value " +"of :data:`raiseExceptions` is ``True``, as that is more useful during " +"development)." msgstr "" #: ../../library/logging.rst:626 @@ -861,8 +864,8 @@ msgstr "" #: ../../library/logging.rst:632 msgid "" "Do whatever it takes to actually log the specified logging record. This " -"version is intended to be implemented by subclasses and so raises a :exc:" -"`NotImplementedError`." +"version is intended to be implemented by subclasses and so raises " +"a :exc:`NotImplementedError`." msgstr "" #: ../../library/logging.rst:636 @@ -912,9 +915,9 @@ msgstr "" #: ../../library/logging.rst:666 msgid "" "A format string in the given *style* for the logged output as a whole. The " -"possible mapping keys are drawn from the :class:`LogRecord` object's :ref:" -"`logrecord-attributes`. If not specified, ``'%(message)s'`` is used, which " -"is just the logged message." +"possible mapping keys are drawn from the :class:`LogRecord` " +"object's :ref:`logrecord-attributes`. If not specified, ``'%(message)s'`` is " +"used, which is just the logged message." msgstr "" #: ../../library/logging.rst:674 @@ -938,8 +941,8 @@ msgstr "" #: ../../library/logging.rst:689 msgid "" "If ``True`` (the default), incorrect or mismatched *fmt* and *style* will " -"raise a :exc:`ValueError`; for example, ``logging.Formatter('%(asctime)s - " -"%(message)s', style='{')``." +"raise a :exc:`ValueError`; for example, ``logging.Formatter('%(asctime)s - %" +"(message)s', style='{')``." msgstr "" #: ../../library/logging.rst:694 @@ -967,11 +970,11 @@ msgid "" "dictionary, a couple of preparatory steps are carried out. The *message* " "attribute of the record is computed using *msg* % *args*. If the formatting " "string contains ``'(asctime)'``, :meth:`formatTime` is called to format the " -"event time. If there is exception information, it is formatted using :meth:" -"`formatException` and appended to the message. Note that the formatted " -"exception information is cached in attribute *exc_text*. This is useful " -"because the exception information can be pickled and sent across the wire, " -"but you should be careful if you have more than one :class:`Formatter` " +"event time. If there is exception information, it is formatted " +"using :meth:`formatException` and appended to the message. Note that the " +"formatted exception information is cached in attribute *exc_text*. This is " +"useful because the exception information can be pickled and sent across the " +"wire, but you should be careful if you have more than one :class:`Formatter` " "subclass which customizes the formatting of exception information. In this " "case, you will have to clear the cached value (by setting the *exc_text* " "attribute to ``None``) after a formatter has done its formatting, so that " @@ -990,12 +993,12 @@ msgid "" "This method should be called from :meth:`format` by a formatter which wants " "to make use of a formatted time. This method can be overridden in formatters " "to provide for any specific requirement, but the basic behavior is as " -"follows: if *datefmt* (a string) is specified, it is used with :func:`time." -"strftime` to format the creation time of the record. Otherwise, the format " -"'%Y-%m-%d %H:%M:%S,uuu' is used, where the uuu part is a millisecond value " -"and the other letters are as per the :func:`time.strftime` documentation. " -"An example time in this format is ``2003-01-23 00:29:50,411``. The " -"resulting string is returned." +"follows: if *datefmt* (a string) is specified, it is used " +"with :func:`time.strftime` to format the creation time of the record. " +"Otherwise, the format '%Y-%m-%d %H:%M:%S,uuu' is used, where the uuu part is " +"a millisecond value and the other letters are as per " +"the :func:`time.strftime` documentation. An example time in this format is " +"``2003-01-23 00:29:50,411``. The resulting string is returned." msgstr "" #: ../../library/logging.rst:743 @@ -1037,9 +1040,9 @@ msgstr "" #: ../../library/logging.rst:776 msgid "" -"Formats the specified stack information (a string as returned by :func:" -"`traceback.print_stack`, but with the last newline removed) as a string. " -"This default implementation just returns the input value." +"Formats the specified stack information (a string as returned " +"by :func:`traceback.print_stack`, but with the last newline removed) as a " +"string. This default implementation just returns the input value." msgstr "" #: ../../library/logging.rst:782 @@ -1125,8 +1128,8 @@ msgid "" "You don't need to create specialized ``Filter`` classes, or use other " "classes with a ``filter`` method: you can use a function (or other callable) " "as a filter. The filtering logic will check to see if the filter object has " -"a ``filter`` attribute: if it does, it's assumed to be a ``Filter`` and its :" -"meth:`~Filter.filter` method is called. Otherwise, it's assumed to be a " +"a ``filter`` attribute: if it does, it's assumed to be a ``Filter`` and " +"its :meth:`~Filter.filter` method is called. Otherwise, it's assumed to be a " "callable and called with the record as the single parameter. The returned " "value should conform to that returned by :meth:`~Filter.filter`." msgstr "" @@ -1157,10 +1160,10 @@ msgstr "LogRecord 物件" #: ../../library/logging.rst:877 msgid "" -":class:`LogRecord` instances are created automatically by the :class:" -"`Logger` every time something is logged, and can be created manually via :" -"func:`makeLogRecord` (for example, from a pickled event received over the " -"wire)." +":class:`LogRecord` instances are created automatically by " +"the :class:`Logger` every time something is logged, and can be created " +"manually via :func:`makeLogRecord` (for example, from a pickled event " +"received over the wire)." msgstr "" #: ../../library/logging.rst:885 @@ -1185,8 +1188,8 @@ msgstr "" msgid "" "The :ref:`numeric level ` of the logging event (such as ``10`` for " "``DEBUG``, ``20`` for ``INFO``, etc). Note that this is converted to *two* " -"attributes of the LogRecord: :attr:`!levelno` for the numeric value and :" -"attr:`!levelname` for the corresponding level name." +"attributes of the LogRecord: :attr:`!levelno` for the numeric value " +"and :attr:`!levelname` for the corresponding level name." msgstr "" #: ../../library/logging.rst:906 @@ -1213,8 +1216,9 @@ msgstr "" #: ../../library/logging.rst:923 msgid "" -"An exception tuple with the current exception information, as returned by :" -"func:`sys.exc_info`, or ``None`` if no exception information is available." +"An exception tuple with the current exception information, as returned " +"by :func:`sys.exc_info`, or ``None`` if no exception information is " +"available." msgstr "" #: ../../library/logging.rst:928 @@ -1247,8 +1251,8 @@ msgstr "" #: ../../library/logging.rst:952 msgid "" -"This functionality can be used to inject your own values into a :class:" -"`LogRecord` at creation time. You can use the following pattern::" +"This functionality can be used to inject your own values into " +"a :class:`LogRecord` at creation time. You can use the following pattern::" msgstr "" #: ../../library/logging.rst:955 @@ -1296,8 +1300,8 @@ msgstr "" #: ../../library/logging.rst:983 msgid "" "If you are using {}-formatting (:func:`str.format`), you can use ``{attrname}" -"`` as the placeholder in the format string. If you are using $-formatting (:" -"class:`string.Template`), use the form ``${attrname}``. In both cases, of " +"`` as the placeholder in the format string. If you are using $-formatting " +"(:class:`string.Template`), use the form ``${attrname}``. In both cases, of " "course, replace ``attrname`` with the actual attribute name you want to use." msgstr "" @@ -1363,8 +1367,8 @@ msgstr "``%(created)f``" #: ../../library/logging.rst:1009 msgid "" -"Time when the :class:`LogRecord` was created (as returned by :func:`time." -"time_ns` / 1e9)." +"Time when the :class:`LogRecord` was created (as returned " +"by :func:`time.time_ns` / 1e9)." msgstr "" #: ../../library/logging.rst:0 ../../library/logging.rst:1012 @@ -1425,8 +1429,8 @@ msgstr "``%(levelno)s``" #: ../../library/logging.rst:1023 msgid "" -"Numeric logging level for the message (:const:`DEBUG`, :const:`INFO`, :const:" -"`WARNING`, :const:`ERROR`, :const:`CRITICAL`)." +"Numeric logging level for the message " +"(:const:`DEBUG`, :const:`INFO`, :const:`WARNING`, :const:`ERROR`, :const:`CRITICAL`)." msgstr "" #: ../../library/logging.rst:1028 @@ -1451,8 +1455,8 @@ msgstr "``%(message)s``" #: ../../library/logging.rst:1031 msgid "" -"The logged message, computed as ``msg % args``. This is set when :meth:" -"`Formatter.format` is invoked." +"The logged message, computed as ``msg % args``. This is set " +"when :meth:`Formatter.format` is invoked." msgstr "" #: ../../library/logging.rst:1035 @@ -1617,8 +1621,9 @@ msgstr "LoggerAdapter 物件" #: ../../library/logging.rst:1082 msgid "" ":class:`LoggerAdapter` instances are used to conveniently pass contextual " -"information into logging calls. For a usage example, see the section on :ref:" -"`adding contextual information to your logging output `." +"information into logging calls. For a usage example, see the section " +"on :ref:`adding contextual information to your logging output `." msgstr "" #: ../../library/logging.rst:1088 @@ -1651,20 +1656,18 @@ msgstr "" #: ../../library/logging.rst:1111 msgid "" "In addition to the above, :class:`LoggerAdapter` supports the following " -"methods of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`, :" -"meth:`~Logger.warning`, :meth:`~Logger.error`, :meth:`~Logger.exception`, :" -"meth:`~Logger.critical`, :meth:`~Logger.log`, :meth:`~Logger.isEnabledFor`, :" -"meth:`~Logger.getEffectiveLevel`, :meth:`~Logger.setLevel` and :meth:" -"`~Logger.hasHandlers`. These methods have the same signatures as their " -"counterparts in :class:`Logger`, so you can use the two types of instances " -"interchangeably." +"methods " +"of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`, :meth:`~Logger.warning`, :meth:`~Logger.error`, :meth:`~Logger.exception`, :meth:`~Logger.critical`, :meth:`~Logger.log`, :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:`~Logger.setLevel` " +"and :meth:`~Logger.hasHandlers`. These methods have the same signatures as " +"their counterparts in :class:`Logger`, so you can use the two types of " +"instances interchangeably." msgstr "" #: ../../library/logging.rst:1122 msgid "" -"The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:" -"`~Logger.setLevel` and :meth:`~Logger.hasHandlers` methods were added to :" -"class:`LoggerAdapter`. These methods delegate to the underlying logger." +"The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:`~Logger.setLevel` " +"and :meth:`~Logger.hasHandlers` methods were added " +"to :class:`LoggerAdapter`. These methods delegate to the underlying logger." msgstr "" #: ../../library/logging.rst:1128 @@ -1684,7 +1687,7 @@ msgstr "執行緒安全" #: ../../library/logging.rst:1139 msgid "" "The logging module is intended to be thread-safe without any special work " -"needing to be done by its clients. It achieves this through using threading " +"needing to be done by its clients. It achieves this though using threading " "locks; there is one lock to serialize access to the module's shared data, " "and each handler also creates a lock to serialize access to its underlying I/" "O." @@ -1768,8 +1771,9 @@ msgstr "" #: ../../library/logging.rst:1200 msgid "" -"The only difference is that if the root logger has no handlers, then :func:" -"`basicConfig` is called, prior to calling ``debug`` on the root logger." +"The only difference is that if the root logger has no handlers, " +"then :func:`basicConfig` is called, prior to calling ``debug`` on the root " +"logger." msgstr "" #: ../../library/logging.rst:1203 @@ -1779,7 +1783,7 @@ msgid "" "most programs will want to carefully and explicitly control the logging " "configuration, and should therefore prefer creating a module-level logger " "and calling :meth:`Logger.debug` (or other level-specific methods) on it, as " -"described at the beginnning of this documentation." +"described at the beginning of this documentation." msgstr "" #: ../../library/logging.rst:1213 @@ -1835,10 +1839,10 @@ msgid "" "useful. Its effect is to disable all logging calls of severity *level* and " "below, so that if you call it with a value of INFO, then all INFO and DEBUG " "events would be discarded, whereas those of severity WARNING and above would " -"be processed according to the logger's effective level. If ``logging." -"disable(logging.NOTSET)`` is called, it effectively removes this overriding " -"level, so that logging output again depends on the effective levels of " -"individual loggers." +"be processed according to the logger's effective level. If " +"``logging.disable(logging.NOTSET)`` is called, it effectively removes this " +"overriding level, so that logging output again depends on the effective " +"levels of individual loggers." msgstr "" #: ../../library/logging.rst:1263 @@ -1851,8 +1855,8 @@ msgstr "" #: ../../library/logging.rst:1268 msgid "" -"The *level* parameter was defaulted to level ``CRITICAL``. See :issue:" -"`28524` for more information about this change." +"The *level* parameter was defaulted to level ``CRITICAL``. " +"See :issue:`28524` for more information about this change." msgstr "" #: ../../library/logging.rst:1274 @@ -1867,8 +1871,8 @@ msgstr "" #: ../../library/logging.rst:1281 msgid "" -"If you are thinking of defining your own levels, please see the section on :" -"ref:`custom-levels`." +"If you are thinking of defining your own levels, please see the section " +"on :ref:`custom-levels`." msgstr "" #: ../../library/logging.rst:1286 @@ -1884,12 +1888,13 @@ msgstr "" #: ../../library/logging.rst:1296 msgid "" -"If *level* is one of the predefined levels :const:`CRITICAL`, :const:" -"`ERROR`, :const:`WARNING`, :const:`INFO` or :const:`DEBUG` then you get the " -"corresponding string. If you have associated levels with names using :func:" -"`addLevelName` then the name you have associated with *level* is returned. " -"If a numeric value corresponding to one of the defined levels is passed in, " -"the corresponding string representation is returned." +"If *level* is one of the predefined " +"levels :const:`CRITICAL`, :const:`ERROR`, :const:`WARNING`, :const:`INFO` " +"or :const:`DEBUG` then you get the corresponding string. If you have " +"associated levels with names using :func:`addLevelName` then the name you " +"have associated with *level* is returned. If a numeric value corresponding " +"to one of the defined levels is passed in, the corresponding string " +"representation is returned." msgstr "" #: ../../library/logging.rst:1303 @@ -1909,9 +1914,9 @@ msgstr "" msgid "" "Levels are internally integers (as they need to be compared in the logging " "logic). This function is used to convert between an integer level and the " -"level name displayed in the formatted log output by means of the " -"``%(levelname)s`` format specifier (see :ref:`logrecord-attributes`), and " -"vice versa." +"level name displayed in the formatted log output by means of the ``%" +"(levelname)s`` format specifier (see :ref:`logrecord-attributes`), and vice " +"versa." msgstr "" #: ../../library/logging.rst:1316 @@ -1935,18 +1940,19 @@ msgstr "" #: ../../library/logging.rst:1337 msgid "" "Creates and returns a new :class:`LogRecord` instance whose attributes are " -"defined by *attrdict*. This function is useful for taking a pickled :class:" -"`LogRecord` attribute dictionary, sent over a socket, and reconstituting it " -"as a :class:`LogRecord` instance at the receiving end." +"defined by *attrdict*. This function is useful for taking a " +"pickled :class:`LogRecord` attribute dictionary, sent over a socket, and " +"reconstituting it as a :class:`LogRecord` instance at the receiving end." msgstr "" #: ../../library/logging.rst:1345 msgid "" -"Does basic configuration for the logging system by creating a :class:" -"`StreamHandler` with a default :class:`Formatter` and adding it to the root " -"logger. The functions :func:`debug`, :func:`info`, :func:`warning`, :func:" -"`error` and :func:`critical` will call :func:`basicConfig` automatically if " -"no handlers are defined for the root logger." +"Does basic configuration for the logging system by creating " +"a :class:`StreamHandler` with a default :class:`Formatter` and adding it to " +"the root logger. The " +"functions :func:`debug`, :func:`info`, :func:`warning`, :func:`error` " +"and :func:`critical` will call :func:`basicConfig` automatically if no " +"handlers are defined for the root logger." msgstr "" #: ../../library/logging.rst:1351 @@ -2082,8 +2088,9 @@ msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " "the output file. If not specified, the value 'backslashreplace' is used. " -"Note that if ``None`` is specified, it will be passed as such to :func:" -"`open`, which means that it will be treated the same as passing 'errors'." +"Note that if ``None`` is specified, it will be passed as such " +"to :func:`open`, which means that it will be treated the same as passing " +"'errors'." msgstr "" #: ../../library/logging.rst:1432 @@ -2122,8 +2129,8 @@ msgstr "" msgid "" "Tells the logging system to use the class *klass* when instantiating a " "logger. The class should define :meth:`!__init__` such that only a name " -"argument is required, and the :meth:`!__init__` should call :meth:`!Logger." -"__init__`. This function is typically called before any loggers are " +"argument is required, and the :meth:`!__init__` should call :meth:`!" +"Logger.__init__`. This function is typically called before any loggers are " "instantiated by applications which need to use custom logger behavior. After " "this call, as at any other time, do not instantiate loggers directly using " "the subclass: continue to use the :func:`logging.getLogger` API to get your " @@ -2227,13 +2234,13 @@ msgstr "模組層級屬性" #: ../../library/logging.rst:1503 msgid "" -"A \"handler of last resort\" is available through this attribute. This is a :" -"class:`StreamHandler` writing to ``sys.stderr`` with a level of ``WARNING``, " -"and is used to handle logging events in the absence of any logging " -"configuration. The end result is to just print the message to ``sys." -"stderr``. This replaces the earlier error message saying that \"no handlers " -"could be found for logger XYZ\". If you need the earlier behaviour for some " -"reason, ``lastResort`` can be set to ``None``." +"A \"handler of last resort\" is available through this attribute. This is " +"a :class:`StreamHandler` writing to ``sys.stderr`` with a level of " +"``WARNING``, and is used to handle logging events in the absence of any " +"logging configuration. The end result is to just print the message to " +"``sys.stderr``. This replaces the earlier error message saying that \"no " +"handlers could be found for logger XYZ\". If you need the earlier behaviour " +"for some reason, ``lastResort`` can be set to ``None``." msgstr "" #: ../../library/logging.rst:1515 @@ -2272,15 +2279,15 @@ msgid "" "If *capture* is ``True``, warnings issued by the :mod:`warnings` module will " "be redirected to the logging system. Specifically, a warning will be " "formatted using :func:`warnings.formatwarning` and the resulting string " -"logged to a logger named ``'py.warnings'`` with a severity of :const:" -"`WARNING`." +"logged to a logger named ``'py.warnings'`` with a severity " +"of :const:`WARNING`." msgstr "" #: ../../library/logging.rst:1541 msgid "" "If *capture* is ``False``, the redirection of warnings to the logging system " -"will stop, and warnings will be redirected to their original destinations (i." -"e. those in effect before ``captureWarnings(True)`` was called)." +"will stop, and warnings will be redirected to their original destinations " +"(i.e. those in effect before ``captureWarnings(True)`` was called)." msgstr "" #: ../../library/logging.rst:1548 @@ -2311,8 +2318,8 @@ msgstr "" #: ../../library/logging.rst:1558 msgid "" -"`Original Python logging package `_" +"`Original Python logging package `_" msgstr "" #: ../../library/logging.rst:1559 diff --git a/library/marshal.po b/library/marshal.po index 92d8e87392b..5e42c9cbe6a 100644 --- a/library/marshal.po +++ b/library/marshal.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-04-24 21:28+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -73,42 +73,71 @@ msgstr "" ":mod:`marshal` 模組對於錯誤或惡意構建的資料來說是不安全的。永遠不要 " "unmarshal 來自不受信任的或來源未經驗證的資料。" -#: ../../library/marshal.rst:43 -msgid "" -"Not all Python object types are supported; in general, only objects whose " -"value is independent from a particular invocation of Python can be written " -"and read by this module. The following types are supported: booleans, " -"integers, floating-point numbers, complex numbers, strings, bytes, " -"bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects " -"(if *allow_code* is true), where it should be understood that tuples, lists, " -"sets, frozensets and dictionaries are only supported as long as the values " -"contained therein are themselves supported. The " -"singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration` can " -"also be marshalled and unmarshalled. For format *version* lower than 3, " -"recursive lists, sets and dictionaries cannot be written (see below)." -msgstr "" -"不是所有 Python 物件型別都有支援;一般來說,此模組只能寫入和讀取不依賴於特定 " -"Python 呼叫 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整數、浮" -"點數 (floating-point number)、複數、字串、位元組串 (bytes)、位元組陣列 " -"(bytearray)、元組 (tuple)、list、集合 (set)、凍結集合 (frozenset)、" -"dictionary 和程式碼物件(如 *allow_code* 為 true),需要了解的一點是元組、" -"list、集合、凍結集合和 dictionary 只在其所包含的值也屬於這些型別時才會支援。" -"單例 (singleton) 物件 :const:`None`、:const:`Ellipsis` " -"和 :exc:`StopIteration` 也可以被 marshal 和 unmarshal。對於 *version* 低於 3 " -"的格式,遞迴 list、集合和 dictionary 無法被寫入(見下文)。" - -#: ../../library/marshal.rst:56 +#: ../../library/marshal.rst:41 msgid "" "There are functions that read/write files as well as functions operating on " "bytes-like objects." msgstr "" "有些函式可以讀/寫檔案,還有些函式可以操作類位元組串物件 (bytes-like object)。" +#: ../../library/marshal.rst:46 +msgid "" +"Not all Python object types are supported; in general, only objects whose " +"value is independent from a particular invocation of Python can be written " +"and read by this module. The following types are supported:" +msgstr "" + +#: ../../library/marshal.rst:50 +msgid "" +"Numeric types: :class:`int`, :class:`bool`, :class:`float`, :class:`complex`." +msgstr "" + +#: ../../library/marshal.rst:51 +msgid "" +"Strings (:class:`str`) and :class:`bytes`. :term:`Bytes-like objects ` like :class:`bytearray` are marshalled as :class:`!bytes`." +msgstr "" + +#: ../../library/marshal.rst:54 +msgid "" +"Containers: :class:`tuple`, :class:`list`, :class:`set`, :class:`frozenset`, " +"and (since :data:`version` 5), :class:`slice`. It should be understood that " +"these are supported only if the values contained therein are themselves " +"supported. Recursive containers are supported since :data:`version` 3." +msgstr "" + #: ../../library/marshal.rst:59 +msgid "" +"The singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration`." +msgstr "" + +#: ../../library/marshal.rst:60 +msgid "" +":class:`code` objects, if *allow_code* is true. See note above about version " +"dependence." +msgstr "" + +#: ../../library/marshal.rst:65 +msgid "" +"Added format version 3, which supports marshalling recursive lists, sets and " +"dictionaries." +msgstr "" + +#: ../../library/marshal.rst:67 +msgid "" +"Added format version 4, which supports efficient representations of short " +"strings." +msgstr "" + +#: ../../library/marshal.rst:72 +msgid "Added format version 5, which allows marshalling slices." +msgstr "" + +#: ../../library/marshal.rst:75 msgid "The module defines these functions:" msgstr "這個模組定義了以下函式:" -#: ../../library/marshal.rst:64 +#: ../../library/marshal.rst:80 msgid "" "Write the value on the open file. The value must be a supported type. The " "file must be a writeable :term:`binary file`." @@ -116,7 +145,7 @@ msgstr "" "將值寫入被開啟的檔案。值必須為受支援的型別,檔案必須為可寫入的 :term:`binary " "file`。" -#: ../../library/marshal.rst:67 +#: ../../library/marshal.rst:83 msgid "" "If the value has (or contains an object that has) an unsupported type, " "a :exc:`ValueError` exception is raised --- but garbage data will also be " @@ -129,13 +158,13 @@ msgstr "" "過 :func:`load` 重新讀取。:ref:`程式碼物件 `\\ 只有在 " "*allow_code* 為 true 時才會支援。" -#: ../../library/marshal.rst:72 +#: ../../library/marshal.rst:88 msgid "" "The *version* argument indicates the data format that ``dump`` should use " "(see below)." msgstr "*version* 引數指明 ``dump`` 應該使用的資料格式(見下文)。" -#: ../../library/marshal.rst:75 ../../library/marshal.rst:115 +#: ../../library/marshal.rst:91 ../../library/marshal.rst:131 msgid "" "Raises an :ref:`auditing event ` ``marshal.dumps`` with arguments " "``value``, ``version``." @@ -143,12 +172,12 @@ msgstr "" "引發一個附帶引數 ``value`` 與 ``version`` 的\\ :ref:`稽核事件 (auditing " "event) ` ``marshal.dumps``。" -#: ../../library/marshal.rst:77 ../../library/marshal.rst:101 -#: ../../library/marshal.rst:117 ../../library/marshal.rst:135 +#: ../../library/marshal.rst:93 ../../library/marshal.rst:117 +#: ../../library/marshal.rst:133 ../../library/marshal.rst:151 msgid "Added the *allow_code* parameter." msgstr "新增 *allow_code* 參數。" -#: ../../library/marshal.rst:83 +#: ../../library/marshal.rst:99 msgid "" "Read one value from the open file and return it. If no valid value is read " "(e.g. because the data has a different Python version's incompatible marshal " @@ -162,13 +191,13 @@ msgstr "" "`\\ 只有在 *allow_code* 為 true 時才會支援。檔案必須為可讀取" "的 :term:`binary file`。" -#: ../../library/marshal.rst:89 +#: ../../library/marshal.rst:105 msgid "" "Raises an :ref:`auditing event ` ``marshal.load`` with no " "arguments." msgstr "引發一個沒有附帶引數的\\ :ref:`稽核事件 ` ``marshal.load``。" -#: ../../library/marshal.rst:93 +#: ../../library/marshal.rst:109 msgid "" "If an object containing an unsupported type was marshalled " "with :func:`dump`, :func:`load` will substitute ``None`` for the " @@ -177,7 +206,7 @@ msgstr "" "如果透過 :func:`dump` marshal 了一個包含不支援型別的物件,:func:`load` 會將不" "可 marshal 的型別替換為 ``None``。" -#: ../../library/marshal.rst:98 +#: ../../library/marshal.rst:114 msgid "" "This call used to raise a ``code.__new__`` audit event for each code object. " "Now it raises a single ``marshal.load`` event for the entire load operation." @@ -185,7 +214,7 @@ msgstr "" "使用此呼叫為每個程式碼物件引發一個 ``code.__new__`` 稽核事件。現在它會為整個" "載入操作引發單個 ``marshal.load`` 事件。" -#: ../../library/marshal.rst:107 +#: ../../library/marshal.rst:123 msgid "" "Return the bytes object that would be written to a file by ``dump(value, " "file)``. The value must be a supported type. Raise a :exc:`ValueError` " @@ -198,13 +227,13 @@ msgstr "" "發 :exc:`ValueError`。:ref:`程式碼物件 `\\ 只有在 *allow_code* " "為 true 時才會支援。" -#: ../../library/marshal.rst:112 +#: ../../library/marshal.rst:128 msgid "" "The *version* argument indicates the data format that ``dumps`` should use " "(see below)." msgstr "*version* 引數指明 ``dumps`` 應當使用的資料型別(見下文)。" -#: ../../library/marshal.rst:123 +#: ../../library/marshal.rst:139 msgid "" "Convert the :term:`bytes-like object` to a value. If no valid value is " "found, raise :exc:`EOFError`, :exc:`ValueError` " @@ -216,7 +245,7 @@ msgstr "" "`\\ 只有在 *allow_code* 為 true 時才會支援。輸入中額外的位元組" "串會被忽略。" -#: ../../library/marshal.rst:128 +#: ../../library/marshal.rst:144 msgid "" "Raises an :ref:`auditing event ` ``marshal.loads`` with argument " "``bytes``." @@ -224,7 +253,7 @@ msgstr "" "引發一個附帶引數 ``bytes`` 的\\ :ref:`稽核事件 ` " "``marshal.loads``。" -#: ../../library/marshal.rst:132 +#: ../../library/marshal.rst:148 msgid "" "This call used to raise a ``code.__new__`` audit event for each code object. " "Now it raises a single ``marshal.loads`` event for the entire load operation." @@ -232,26 +261,94 @@ msgstr "" "使用此呼叫為每個程式碼物件引發一個 ``code.__new__`` 稽核事件。現在它會為整個" "載入操作引發單個 ``marshal.loads`` 事件。" -#: ../../library/marshal.rst:139 +#: ../../library/marshal.rst:155 msgid "In addition, the following constants are defined:" msgstr "此外,還定義了以下常數:" -#: ../../library/marshal.rst:143 +#: ../../library/marshal.rst:159 +#, fuzzy msgid "" -"Indicates the format that the module uses. Version 0 is the historical " -"format, version 1 shares interned strings and version 2 uses a binary format " -"for floating-point numbers. Version 3 adds support for object instancing and " -"recursion. The current version is 4." +"Indicates the format that the module uses. Version 0 is the historical first " +"version; subsequent versions add new features. Generally, a new version " +"becomes the default when it is introduced." msgstr "" "表示模組所使用的格式。第 0 版為歷史格式,第 1 版共享了駐留字串 (interned " "string),第 2 版對浮點數使用二進位制格式。第 3 版添加了對於物件實例化和遞迴的" "支援。目前使用的是第 4 版。" -#: ../../library/marshal.rst:151 +#: ../../library/marshal.rst:165 +msgid "Version" +msgstr "" + +#: ../../library/marshal.rst:165 +msgid "Available since" +msgstr "" + +#: ../../library/marshal.rst:165 +msgid "New features" +msgstr "" + +#: ../../library/marshal.rst:167 +msgid "1" +msgstr "" + +#: ../../library/marshal.rst:167 +msgid "Python 2.4" +msgstr "" + +#: ../../library/marshal.rst:167 +msgid "Sharing interned strings" +msgstr "" + +#: ../../library/marshal.rst:169 +msgid "2" +msgstr "" + +#: ../../library/marshal.rst:169 +msgid "Python 2.5" +msgstr "" + +#: ../../library/marshal.rst:169 +msgid "Binary representation of floats" +msgstr "" + +#: ../../library/marshal.rst:171 +msgid "3" +msgstr "" + +#: ../../library/marshal.rst:171 ../../library/marshal.rst:173 +msgid "Python 3.4" +msgstr "" + +#: ../../library/marshal.rst:171 +msgid "Support for object instancing and recursion" +msgstr "" + +#: ../../library/marshal.rst:173 +msgid "4" +msgstr "" + +#: ../../library/marshal.rst:173 +msgid "Efficient representation of short strings" +msgstr "" + +#: ../../library/marshal.rst:175 +msgid "5" +msgstr "" + +#: ../../library/marshal.rst:175 +msgid "Python 3.14" +msgstr "" + +#: ../../library/marshal.rst:175 +msgid "Support for :class:`slice` objects" +msgstr "" + +#: ../../library/marshal.rst:180 msgid "Footnotes" msgstr "註解" -#: ../../library/marshal.rst:152 +#: ../../library/marshal.rst:181 msgid "" "The name of this module stems from a bit of terminology used by the " "designers of Modula-3 (amongst others), who use the term \"marshalling\" for " @@ -276,14 +373,37 @@ msgstr "pickle" msgid "shelve" msgstr "shelve" -#: ../../library/marshal.rst:41 +#: ../../library/marshal.rst:44 msgid "object" msgstr "object(物件)" -#: ../../library/marshal.rst:41 +#: ../../library/marshal.rst:44 msgid "code" msgstr "code(程式碼)" -#: ../../library/marshal.rst:41 +#: ../../library/marshal.rst:44 msgid "code object" msgstr "code object(程式碼物件)" + +#~ msgid "" +#~ "Not all Python object types are supported; in general, only objects whose " +#~ "value is independent from a particular invocation of Python can be " +#~ "written and read by this module. The following types are supported: " +#~ "booleans, integers, floating-point numbers, complex numbers, strings, " +#~ "bytes, bytearrays, tuples, lists, sets, frozensets, dictionaries, and " +#~ "code objects (if *allow_code* is true), where it should be understood " +#~ "that tuples, lists, sets, frozensets and dictionaries are only supported " +#~ "as long as the values contained therein are themselves supported. The " +#~ "singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration` can " +#~ "also be marshalled and unmarshalled. For format *version* lower than 3, " +#~ "recursive lists, sets and dictionaries cannot be written (see below)." +#~ msgstr "" +#~ "不是所有 Python 物件型別都有支援;一般來說,此模組只能寫入和讀取不依賴於特" +#~ "定 Python 呼叫 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整" +#~ "數、浮點數 (floating-point number)、複數、字串、位元組串 (bytes)、位元組陣" +#~ "列 (bytearray)、元組 (tuple)、list、集合 (set)、凍結集合 (frozenset)、" +#~ "dictionary 和程式碼物件(如 *allow_code* 為 true),需要了解的一點是元組、" +#~ "list、集合、凍結集合和 dictionary 只在其所包含的值也屬於這些型別時才會支" +#~ "援。單例 (singleton) 物件 :const:`None`、:const:`Ellipsis` " +#~ "和 :exc:`StopIteration` 也可以被 marshal 和 unmarshal。對於 *version* 低" +#~ "於 3 的格式,遞迴 list、集合和 dictionary 無法被寫入(見下文)。" diff --git a/library/math.po b/library/math.po index 5a2a58d37e5..20bba05b80e 100644 --- a/library/math.po +++ b/library/math.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-01 00:18+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -548,8 +548,8 @@ msgstr ":func:`lgamma(x) `" #: ../../library/math.rst:112 msgid "" -"Natural logarithm of the absolute value of the `Gamma function `_ at *x*" +"Natural logarithm of the absolute value of the `Gamma function `_ at *x*" msgstr "" #: ../../library/math.rst:114 @@ -622,11 +622,11 @@ msgstr "" #: ../../library/math.rst:139 ../../library/math.rst:204 msgid "" -"Raises :exc:`TypeError` if either of the arguments are not integers. Raises :" -"exc:`ValueError` if either of the arguments are negative." +"Raises :exc:`TypeError` if either of the arguments are not integers. " +"Raises :exc:`ValueError` if either of the arguments are negative." msgstr "" -"當任一參數非整數型別時會引發 :exc:`TypeError`。當任一參數為負數時會引發 :exc:" -"`ValueError`。" +"當任一參數非整數型別時會引發 :exc:`TypeError`。當任一參數為負數時會引" +"發 :exc:`ValueError`。" #: ../../library/math.rst:147 msgid "Return factorial of the nonnegative integer *n*." @@ -711,12 +711,12 @@ msgstr "" #: ../../library/math.rst:215 msgid "" "Return the ceiling of *x*, the smallest integer greater than or equal to " -"*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ `, which should return an :class:`~numbers.Integral` value." +"*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ " +"`, which should return an :class:`~numbers.Integral` value." msgstr "" "回傳 *x* 經上取整的值,即大於或等於 *x* 的最小整數。若 *x* 並非浮點數,此函式" -"將委派給 :meth:`x.__ceil__ `,並回傳 :class:`~numbers." -"Integral` 型別的值。" +"將委派給 :meth:`x.__ceil__ `,並回" +"傳 :class:`~numbers.Integral` 型別的值。" #: ../../library/math.rst:222 msgid "Return the absolute value of *x*." @@ -729,8 +729,8 @@ msgid "" "which should return an :class:`~numbers.Integral` value." msgstr "" "回傳 *x* 經下取整的值,即小於或等於 *x* 的最大整數。若 *x* 並非浮點數,此函式" -"將委派給 :meth:`x.__floor__ `,並回傳 :class:`~numbers." -"Integral` 型別的值。" +"將委派給 :meth:`x.__floor__ `,並回" +"傳 :class:`~numbers.Integral` 型別的值。" #: ../../library/math.rst:234 msgid "" @@ -817,8 +817,8 @@ msgid "" "Return *x* with the fractional part removed, leaving the integer part. This " "rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " "*x*, and equivalent to :func:`ceil` for negative *x*. If *x* is not a float, " -"delegates to :meth:`x.__trunc__ `, which should return an :" -"class:`~numbers.Integral` value." +"delegates to :meth:`x.__trunc__ `, which should return " +"an :class:`~numbers.Integral` value." msgstr "" #: ../../library/math.rst:305 @@ -938,8 +938,8 @@ msgstr "" #: ../../library/math.rst:389 msgid "" -"Return ``x * (2**i)``. This is essentially the inverse of function :func:" -"`frexp`." +"Return ``x * (2**i)``. This is essentially the inverse of " +"function :func:`frexp`." msgstr "回傳 ``x * (2**i)``。此函式本質上為 :func:`frexp` 的反函式。" #: ../../library/math.rst:395 @@ -997,8 +997,8 @@ msgstr "若 *x* 為正無限值,回傳 *x*。" #: ../../library/math.rst:421 msgid "" "If *x* is equal to zero, return the smallest positive *denormalized* " -"representable float (smaller than the minimum positive *normalized* float, :" -"data:`sys.float_info.min `)." +"representable float (smaller than the minimum positive *normalized* " +"float, :data:`sys.float_info.min `)." msgstr "" #: ../../library/math.rst:424 @@ -1021,8 +1021,8 @@ msgstr "" #: ../../library/math.rst:433 msgid "" -"See also :func:`math.nextafter` and :data:`sys.float_info.epsilon `." +"See also :func:`math.nextafter` and :data:`sys.float_info.epsilon " +"`." msgstr "" #: ../../library/math.rst:440 @@ -1156,9 +1156,9 @@ msgstr "" #: ../../library/math.rst:564 msgid "" "For further discussion and two alternative approaches, see the `ASPN " -"cookbook recipes for accurate floating-point summation `_\\." +"cookbook recipes for accurate floating-point summation `_\\." msgstr "" "更深入的討論及兩種替代做法請參閱 `ASPN cookbook recipes 精準的浮點數總和 " "`_。" @@ -1212,7 +1212,8 @@ msgid "Raises :exc:`ValueError` if the inputs do not have the same length." msgstr "" #: ../../library/math.rst:609 -msgid "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" +#, fuzzy +msgid "sum(map(operator.mul, p, q, strict=True))" msgstr "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" #: ../../library/math.rst:611 @@ -1261,8 +1262,8 @@ msgid "" "``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " "this angle with the positive X axis. The point of :func:`atan2` is that the " "signs of both inputs are known to it, so it can compute the correct quadrant " -"for the angle. For example, ``atan(1)`` and ``atan2(1, 1)`` are both " -"``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." +"for the angle. For example, ``atan(1)`` and ``atan2(1, 1)`` are both ``pi/" +"4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." msgstr "" #: ../../library/math.rst:663 @@ -1325,8 +1326,8 @@ msgstr "" #: ../../library/math.rst:721 msgid "" "The :func:`erf` function can be used to compute traditional statistical " -"functions such as the `cumulative standard normal distribution `_::" +"functions such as the `cumulative standard normal distribution `_::" msgstr "" #: ../../library/math.rst:725 @@ -1380,8 +1381,8 @@ msgstr "" #: ../../library/math.rst:785 msgid "" -"A floating-point positive infinity. (For negative infinity, use ``-math." -"inf``.) Equivalent to the output of ``float('inf')``." +"A floating-point positive infinity. (For negative infinity, use ``-" +"math.inf``.) Equivalent to the output of ``float('inf')``." msgstr "" #: ../../library/math.rst:793 @@ -1402,15 +1403,15 @@ msgstr "" msgid "" "The :mod:`math` module consists mostly of thin wrappers around the platform " "C math library functions. Behavior in exceptional cases follows Annex F of " -"the C99 standard where appropriate. The current implementation will raise :" -"exc:`ValueError` for invalid operations like ``sqrt(-1.0)`` or ``log(0.0)`` " -"(where C99 Annex F recommends signaling invalid operation or divide-by-" -"zero), and :exc:`OverflowError` for results that overflow (for example, " -"``exp(1000.0)``). A NaN will not be returned from any of the functions " -"above unless one or more of the input arguments was a NaN; in that case, " -"most functions will return a NaN, but (again following C99 Annex F) there " -"are some exceptions to this rule, for example ``pow(float('nan'), 0.0)`` or " -"``hypot(float('nan'), float('inf'))``." +"the C99 standard where appropriate. The current implementation will " +"raise :exc:`ValueError` for invalid operations like ``sqrt(-1.0)`` or " +"``log(0.0)`` (where C99 Annex F recommends signaling invalid operation or " +"divide-by-zero), and :exc:`OverflowError` for results that overflow (for " +"example, ``exp(1000.0)``). A NaN will not be returned from any of the " +"functions above unless one or more of the input arguments was a NaN; in that " +"case, most functions will return a NaN, but (again following C99 Annex F) " +"there are some exceptions to this rule, for example ``pow(float('nan'), " +"0.0)`` or ``hypot(float('nan'), float('inf'))``." msgstr "" #: ../../library/math.rst:831 @@ -1432,5 +1433,5 @@ msgstr "" #~ "Return *n* factorial as an integer. Raises :exc:`ValueError` if *n* is " #~ "not integral or is negative." #~ msgstr "" -#~ "以整數回傳 *n* 的階乘。若 *n* 非整數型別或其值為負會引發 :exc:" -#~ "`ValueError`。" +#~ "以整數回傳 *n* 的階乘。若 *n* 非整數型別或其值為負會引" +#~ "發 :exc:`ValueError`。" diff --git a/library/mimetypes.po b/library/mimetypes.po index ecad6814671..bc0e22fbf34 100644 --- a/library/mimetypes.po +++ b/library/mimetypes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2016-11-19 00:32+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -65,8 +65,8 @@ msgstr "" msgid "" "*encoding* is ``None`` for no encoding or the name of the program used to " "encode (e.g. :program:`compress` or :program:`gzip`). The encoding is " -"suitable for use as a :mailheader:`Content-Encoding` header, **not** as a :" -"mailheader:`Content-Transfer-Encoding` header. The mappings are table " +"suitable for use as a :mailheader:`Content-Encoding` header, **not** as " +"a :mailheader:`Content-Transfer-Encoding` header. The mappings are table " "driven. Encoding suffixes are case sensitive; type suffixes are first tried " "case sensitively, then case insensitively." msgstr "" @@ -75,30 +75,33 @@ msgstr "" msgid "" "The optional *strict* argument is a flag specifying whether the list of " "known MIME types is limited to only the official types `registered with IANA " -"`_. When " -"*strict* is ``True`` (the default), only the IANA types are supported; when " -"*strict* is ``False``, some additional non-standard but commonly used MIME " -"types are also recognized." +"`_. However, " +"the behavior of this module also depends on the underlying operating system. " +"Only file types recognized by the OS or explicitly registered with Python's " +"internal database can be identified. When *strict* is ``True`` (the " +"default), only the IANA types are supported; when *strict* is ``False``, " +"some additional non-standard but commonly used MIME types are also " +"recognized." msgstr "" -#: ../../library/mimetypes.rst:54 +#: ../../library/mimetypes.rst:56 msgid "Added support for *url* being a :term:`path-like object`." msgstr "新增 *url* 做為 :term:`path-like object` 的支援。" -#: ../../library/mimetypes.rst:57 +#: ../../library/mimetypes.rst:59 msgid "" -"Passing a file path instead of URL is :term:`soft deprecated`. Use :func:" -"`guess_file_type` for this." +"Passing a file path instead of URL is :term:`soft deprecated`. " +"Use :func:`guess_file_type` for this." msgstr "" -#: ../../library/mimetypes.rst:66 +#: ../../library/mimetypes.rst:68 msgid "" -"Guess the type of a file based on its path, given by *path*. Similar to the :" -"func:`guess_type` function, but accepts a path instead of URL. Path can be a " -"string, a bytes object or a :term:`path-like object`." +"Guess the type of a file based on its path, given by *path*. Similar to " +"the :func:`guess_type` function, but accepts a path instead of URL. Path can " +"be a string, a bytes object or a :term:`path-like object`." msgstr "" -#: ../../library/mimetypes.rst:75 +#: ../../library/mimetypes.rst:77 msgid "" "Guess the extensions for a file based on its MIME type, given by *type*. The " "return value is a list of strings giving all possible filename extensions, " @@ -107,29 +110,29 @@ msgid "" "the MIME type *type* by :func:`guess_type` and :func:`guess_file_type`." msgstr "" -#: ../../library/mimetypes.rst:81 ../../library/mimetypes.rst:93 +#: ../../library/mimetypes.rst:83 ../../library/mimetypes.rst:95 msgid "" -"The optional *strict* argument has the same meaning as with the :func:" -"`guess_type` function." +"The optional *strict* argument has the same meaning as with " +"the :func:`guess_type` function." msgstr "" -#: ../../library/mimetypes.rst:86 +#: ../../library/mimetypes.rst:88 msgid "" "Guess the extension for a file based on its MIME type, given by *type*. The " "return value is a string giving a filename extension, including the leading " "dot (``'.'``). The extension is not guaranteed to have been associated with " -"any particular data stream, but would be mapped to the MIME type *type* by :" -"func:`guess_type` and :func:`guess_file_type`. If no extension can be " +"any particular data stream, but would be mapped to the MIME type *type* " +"by :func:`guess_type` and :func:`guess_file_type`. If no extension can be " "guessed for *type*, ``None`` is returned." msgstr "" -#: ../../library/mimetypes.rst:95 +#: ../../library/mimetypes.rst:97 msgid "" "Some additional functions and data items are available for controlling the " "behavior of the module." msgstr "" -#: ../../library/mimetypes.rst:101 +#: ../../library/mimetypes.rst:103 msgid "" "Initialize the internal data structures. If given, *files* must be a " "sequence of file names which should be used to augment the default type " @@ -139,25 +142,25 @@ msgid "" "Calling :func:`init` repeatedly is allowed." msgstr "" -#: ../../library/mimetypes.rst:108 +#: ../../library/mimetypes.rst:110 msgid "" "Specifying an empty list for *files* will prevent the system defaults from " "being applied: only the well-known values will be present from a built-in " "list." msgstr "" -#: ../../library/mimetypes.rst:111 +#: ../../library/mimetypes.rst:113 msgid "" "If *files* is ``None`` the internal data structure is completely rebuilt to " "its initial default value. This is a stable operation and will produce the " "same results when called multiple times." msgstr "" -#: ../../library/mimetypes.rst:115 +#: ../../library/mimetypes.rst:117 msgid "Previously, Windows registry settings were ignored." msgstr "" -#: ../../library/mimetypes.rst:121 +#: ../../library/mimetypes.rst:123 msgid "" "Load the type map given in the file *filename*, if it exists. The type map " "is returned as a dictionary mapping filename extensions, including the " @@ -165,7 +168,7 @@ msgid "" "file *filename* does not exist or cannot be read, ``None`` is returned." msgstr "" -#: ../../library/mimetypes.rst:129 ../../library/mimetypes.rst:302 +#: ../../library/mimetypes.rst:131 msgid "" "Add a mapping from the MIME type *type* to the extension *ext*. When the " "extension is already known, the new type will replace the old one. When the " @@ -173,52 +176,53 @@ msgid "" "extensions." msgstr "" -#: ../../library/mimetypes.rst:133 ../../library/mimetypes.rst:306 +#: ../../library/mimetypes.rst:135 ../../library/mimetypes.rst:309 msgid "" "When *strict* is ``True`` (the default), the mapping will be added to the " "official MIME types, otherwise to the non-standard ones." msgstr "" -#: ../../library/mimetypes.rst:139 +#: ../../library/mimetypes.rst:141 msgid "" "Flag indicating whether or not the global data structures have been " "initialized. This is set to ``True`` by :func:`init`." msgstr "" -#: ../../library/mimetypes.rst:147 +#: ../../library/mimetypes.rst:149 msgid "" "List of type map file names commonly installed. These files are typically " "named :file:`mime.types` and are installed in different locations by " "different packages." msgstr "" -#: ../../library/mimetypes.rst:154 +#: ../../library/mimetypes.rst:156 msgid "" "Dictionary mapping suffixes to suffixes. This is used to allow recognition " "of encoded files for which the encoding and the type are indicated by the " -"same extension. For example, the :file:`.tgz` extension is mapped to :file:" -"`.tar.gz` to allow the encoding and type to be recognized separately." +"same extension. For example, the :file:`.tgz` extension is mapped " +"to :file:`.tar.gz` to allow the encoding and type to be recognized " +"separately." msgstr "" -#: ../../library/mimetypes.rst:162 +#: ../../library/mimetypes.rst:164 msgid "Dictionary mapping filename extensions to encoding types." msgstr "" -#: ../../library/mimetypes.rst:167 +#: ../../library/mimetypes.rst:169 msgid "Dictionary mapping filename extensions to MIME types." msgstr "" -#: ../../library/mimetypes.rst:172 +#: ../../library/mimetypes.rst:174 msgid "" "Dictionary mapping filename extensions to non-standard, but commonly found " "MIME types." msgstr "" -#: ../../library/mimetypes.rst:176 +#: ../../library/mimetypes.rst:178 msgid "An example usage of the module::" msgstr "模組的使用範例: ::" -#: ../../library/mimetypes.rst:178 +#: ../../library/mimetypes.rst:180 msgid "" ">>> import mimetypes\n" ">>> mimetypes.init()\n" @@ -242,49 +246,52 @@ msgstr "" ">>> mimetypes.types_map['.tgz']\n" "'application/x-tar-gz'" -#: ../../library/mimetypes.rst:193 -msgid "MimeTypes Objects" +#: ../../library/mimetypes.rst:195 +#, fuzzy +msgid "MimeTypes objects" msgstr "MimeTypes 物件" -#: ../../library/mimetypes.rst:195 +#: ../../library/mimetypes.rst:197 msgid "" "The :class:`MimeTypes` class may be useful for applications which may want " "more than one MIME-type database; it provides an interface similar to the " "one of the :mod:`mimetypes` module." msgstr "" -#: ../../library/mimetypes.rst:202 +#: ../../library/mimetypes.rst:204 msgid "" "This class represents a MIME-types database. By default, it provides access " "to the same database as the rest of this module. The initial database is a " "copy of that provided by the module, and may be extended by loading " -"additional :file:`mime.types`\\ -style files into the database using the :" -"meth:`read` or :meth:`readfp` methods. The mapping dictionaries may also be " -"cleared before loading additional data if the default data is not desired." +"additional :file:`mime.types`\\ -style files into the database using " +"the :meth:`read` or :meth:`readfp` methods. The mapping dictionaries may " +"also be cleared before loading additional data if the default data is not " +"desired." msgstr "" -#: ../../library/mimetypes.rst:209 +#: ../../library/mimetypes.rst:211 msgid "" "The optional *filenames* parameter can be used to cause additional files to " "be loaded \"on top\" of the default database." msgstr "" -#: ../../library/mimetypes.rst:215 +#: ../../library/mimetypes.rst:217 msgid "" "Dictionary mapping suffixes to suffixes. This is used to allow recognition " "of encoded files for which the encoding and the type are indicated by the " -"same extension. For example, the :file:`.tgz` extension is mapped to :file:" -"`.tar.gz` to allow the encoding and type to be recognized separately. This " -"is initially a copy of the global :data:`suffix_map` defined in the module." +"same extension. For example, the :file:`.tgz` extension is mapped " +"to :file:`.tar.gz` to allow the encoding and type to be recognized " +"separately. This is initially a copy of the global :data:`suffix_map` " +"defined in the module." msgstr "" -#: ../../library/mimetypes.rst:224 +#: ../../library/mimetypes.rst:226 msgid "" "Dictionary mapping filename extensions to encoding types. This is initially " "a copy of the global :data:`encodings_map` defined in the module." msgstr "" -#: ../../library/mimetypes.rst:230 +#: ../../library/mimetypes.rst:232 msgid "" "Tuple containing two dictionaries, mapping filename extensions to MIME " "types: the first dictionary is for the non-standards types and the second " @@ -292,72 +299,186 @@ msgid "" "and :data:`types_map`." msgstr "" -#: ../../library/mimetypes.rst:238 +#: ../../library/mimetypes.rst:240 msgid "" "Tuple containing two dictionaries, mapping MIME types to a list of filename " "extensions: the first dictionary is for the non-standards types and the " -"second one is for the standard types. They are initialized by :data:" -"`common_types` and :data:`types_map`." +"second one is for the standard types. They are initialized " +"by :data:`common_types` and :data:`types_map`." msgstr "" -#: ../../library/mimetypes.rst:246 +#: ../../library/mimetypes.rst:248 msgid "" "Similar to the :func:`guess_extension` function, using the tables stored as " "part of the object." msgstr "" -#: ../../library/mimetypes.rst:252 +#: ../../library/mimetypes.rst:254 msgid "" "Similar to the :func:`guess_type` function, using the tables stored as part " "of the object." msgstr "" -#: ../../library/mimetypes.rst:258 +#: ../../library/mimetypes.rst:260 msgid "" "Similar to the :func:`guess_file_type` function, using the tables stored as " "part of the object." msgstr "" -#: ../../library/mimetypes.rst:266 +#: ../../library/mimetypes.rst:268 msgid "" "Similar to the :func:`guess_all_extensions` function, using the tables " "stored as part of the object." msgstr "" -#: ../../library/mimetypes.rst:272 +#: ../../library/mimetypes.rst:274 msgid "" -"Load MIME information from a file named *filename*. This uses :meth:" -"`readfp` to parse the file." +"Load MIME information from a file named *filename*. This " +"uses :meth:`readfp` to parse the file." msgstr "" -#: ../../library/mimetypes.rst:275 +#: ../../library/mimetypes.rst:277 msgid "" "If *strict* is ``True``, information will be added to list of standard " "types, else to the list of non-standard types." msgstr "" -#: ../../library/mimetypes.rst:281 +#: ../../library/mimetypes.rst:283 msgid "" "Load MIME type information from an open file *fp*. The file must have the " "format of the standard :file:`mime.types` files." msgstr "" -#: ../../library/mimetypes.rst:284 ../../library/mimetypes.rst:294 +#: ../../library/mimetypes.rst:286 ../../library/mimetypes.rst:296 msgid "" "If *strict* is ``True``, information will be added to the list of standard " "types, else to the list of non-standard types." msgstr "" -#: ../../library/mimetypes.rst:290 +#: ../../library/mimetypes.rst:292 msgid "Load MIME type information from the Windows registry." msgstr "" -#: ../../library/mimetypes.rst:292 +#: ../../library/mimetypes.rst:294 msgid "Availability" msgstr "可用性" +#: ../../library/mimetypes.rst:304 +msgid "" +"Add a mapping from the MIME type *type* to the extension *ext*. Valid " +"extensions start with a '.' or are empty. When the extension is already " +"known, the new type will replace the old one. When the type is already known " +"the extension will be added to the list of known extensions." +msgstr "" + +#: ../../library/mimetypes.rst:312 +msgid "" +"Invalid, undotted extensions will raise a :exc:`ValueError` in Python 3.16." +msgstr "" + +#: ../../library/mimetypes.rst:320 +msgid "Command-line usage" +msgstr "" + +#: ../../library/mimetypes.rst:322 +msgid "" +"The :mod:`!mimetypes` module can be executed as a script from the command " +"line." +msgstr "" + +#: ../../library/mimetypes.rst:324 +msgid "python -m mimetypes [-h] [-e] [-l] type [type ...]" +msgstr "" + +#: ../../library/mimetypes.rst:328 +msgid "The following options are accepted:" +msgstr "" + +#: ../../library/mimetypes.rst:335 +msgid "Show the help message and exit." +msgstr "" + +#: ../../library/mimetypes.rst:340 +msgid "Guess extension instead of type." +msgstr "" + +#: ../../library/mimetypes.rst:345 +msgid "Additionally search for some common, but non-standard types." +msgstr "" + +#: ../../library/mimetypes.rst:347 +msgid "" +"By default the script converts MIME types to file extensions. However, if " +"``--extension`` is specified, it converts file extensions to MIME types." +msgstr "" + +#: ../../library/mimetypes.rst:351 +msgid "" +"For each ``type`` entry, the script writes a line into the standard output " +"stream. If an unknown type occurs, it writes an error message into the " +"standard error stream and exits with the return code ``1``." +msgstr "" + +#: ../../library/mimetypes.rst:359 +msgid "Command-line example" +msgstr "" + +#: ../../library/mimetypes.rst:361 +msgid "" +"Here are some examples of typical usage of the :mod:`!mimetypes` command-" +"line interface:" +msgstr "" + +#: ../../library/mimetypes.rst:364 +msgid "" +"$ # get a MIME type by a file name\n" +"$ python -m mimetypes filename.png\n" +"type: image/png encoding: None\n" +"\n" +"$ # get a MIME type by a URL\n" +"$ python -m mimetypes https://example.com/filename.txt\n" +"type: text/plain encoding: None\n" +"\n" +"$ # get a complex MIME type\n" +"$ python -m mimetypes filename.tar.gz\n" +"type: application/x-tar encoding: gzip\n" +"\n" +"$ # get a MIME type for a rare file extension\n" +"$ python -m mimetypes filename.pict\n" +"error: unknown extension of filename.pict\n" +"\n" +"$ # now look in the extended database built into Python\n" +"$ python -m mimetypes --lenient filename.pict\n" +"type: image/pict encoding: None\n" +"\n" +"$ # get a file extension by a MIME type\n" +"$ python -m mimetypes --extension text/javascript\n" +".js\n" +"\n" +"$ # get a file extension by a rare MIME type\n" +"$ python -m mimetypes --extension text/xul\n" +"error: unknown type text/xul\n" +"\n" +"$ # now look in the extended database again\n" +"$ python -m mimetypes --extension --lenient text/xul\n" +".xul\n" +"\n" +"$ # try to feed an unknown file extension\n" +"$ python -m mimetypes filename.sh filename.nc filename.xxx filename.txt\n" +"type: application/x-sh encoding: None\n" +"type: application/x-netcdf encoding: None\n" +"error: unknown extension of filename.xxx\n" +"\n" +"$ # try to feed an unknown MIME type\n" +"$ python -m mimetypes --extension audio/aac audio/opus audio/future audio/x-" +"wav\n" +".aac\n" +".opus\n" +"error: unknown type audio/future" +msgstr "" + #: ../../library/mimetypes.rst:11 ../../library/mimetypes.rst:31 -#: ../../library/mimetypes.rst:64 +#: ../../library/mimetypes.rst:66 msgid "MIME" msgstr "MIME" @@ -365,14 +486,14 @@ msgstr "MIME" msgid "content type" msgstr "content type(內容類型)" -#: ../../library/mimetypes.rst:31 ../../library/mimetypes.rst:64 +#: ../../library/mimetypes.rst:31 ../../library/mimetypes.rst:66 msgid "headers" msgstr "headers(標頭)" -#: ../../library/mimetypes.rst:145 +#: ../../library/mimetypes.rst:147 msgid "file" msgstr "file(檔案)" -#: ../../library/mimetypes.rst:145 +#: ../../library/mimetypes.rst:147 msgid "mime.types" msgstr "mime.types" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index c1a61a818ff..d3c7c7ebfc0 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-28 17:30+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,14 +55,14 @@ msgstr "" #: ../../library/multiprocessing.rst:25 msgid "" "The :mod:`multiprocessing` module also introduces APIs which do not have " -"analogs in the :mod:`threading` module. A prime example of this is the :" -"class:`~multiprocessing.pool.Pool` object which offers a convenient means of " -"parallelizing the execution of a function across multiple input values, " -"distributing the input data across processes (data parallelism). The " -"following example demonstrates the common practice of defining such " +"analogs in the :mod:`threading` module. A prime example of this is " +"the :class:`~multiprocessing.pool.Pool` object which offers a convenient " +"means of parallelizing the execution of a function across multiple input " +"values, distributing the input data across processes (data parallelism). " +"The following example demonstrates the common practice of defining such " "functions in a module so that child processes can successfully import that " -"module. This basic example of data parallelism using :class:" -"`~multiprocessing.pool.Pool`, ::" +"module. This basic example of data parallelism " +"using :class:`~multiprocessing.pool.Pool`, ::" msgstr "" #: ../../library/multiprocessing.rst:34 @@ -97,10 +97,10 @@ msgstr "[1, 4, 9]" msgid "" ":class:`concurrent.futures.ProcessPoolExecutor` offers a higher level " "interface to push tasks to a background process without blocking execution " -"of the calling process. Compared to using the :class:`~multiprocessing.pool." -"Pool` interface directly, the :mod:`concurrent.futures` API more readily " -"allows the submission of work to the underlying process pool to be separated " -"from waiting for the results." +"of the calling process. Compared to using " +"the :class:`~multiprocessing.pool.Pool` interface directly, " +"the :mod:`concurrent.futures` API more readily allows the submission of work " +"to the underlying process pool to be separated from waiting for the results." msgstr "" #: ../../library/multiprocessing.rst:59 @@ -109,10 +109,10 @@ msgstr ":class:`Process` 類別" #: ../../library/multiprocessing.rst:61 msgid "" -"In :mod:`multiprocessing`, processes are spawned by creating a :class:" -"`Process` object and then calling its :meth:`~Process.start` method. :class:" -"`Process` follows the API of :class:`threading.Thread`. A trivial example " -"of a multiprocess program is ::" +"In :mod:`multiprocessing`, processes are spawned by creating " +"a :class:`Process` object and then calling its :meth:`~Process.start` " +"method. :class:`Process` follows the API of :class:`threading.Thread`. A " +"trivial example of a multiprocess program is ::" msgstr "" #: ../../library/multiprocessing.rst:66 @@ -238,23 +238,22 @@ msgid "" msgstr "" #: ../../library/multiprocessing.rst:135 -msgid "" -"Available on POSIX systems. Currently the default on POSIX except macOS." +msgid "Available on POSIX systems." msgstr "" -#: ../../library/multiprocessing.rst:138 +#: ../../library/multiprocessing.rst:137 msgid "" -"The default start method will change away from *fork* in Python 3.14. Code " -"that requires *fork* should explicitly specify that via :func:`get_context` " +"This is no longer the default start method on any platform. Code that " +"requires *fork* must explicitly specify that via :func:`get_context` " "or :func:`set_start_method`." msgstr "" #: ../../library/multiprocessing.rst:142 msgid "" -"If Python is able to detect that your process has multiple threads, the :" -"func:`os.fork` function that this start method calls internally will raise " -"a :exc:`DeprecationWarning`. Use a different start method. See the :func:`os." -"fork` documentation for further explanation." +"If Python is able to detect that your process has multiple threads, " +"the :func:`os.fork` function that this start method calls internally will " +"raise a :exc:`DeprecationWarning`. Use a different start method. See " +"the :func:`os.fork` documentation for further explanation." msgstr "" #: ../../library/multiprocessing.rst:150 @@ -274,45 +273,56 @@ msgstr "" #: ../../library/multiprocessing.rst:159 msgid "" "Available on POSIX platforms which support passing file descriptors over " -"Unix pipes such as Linux." +"Unix pipes such as Linux. The default on those." +msgstr "" + +#: ../../library/multiprocessing.rst:162 +msgid "This became the default start method on POSIX platforms." msgstr "" -#: ../../library/multiprocessing.rst:163 +#: ../../library/multiprocessing.rst:165 msgid "" "*spawn* added on all POSIX platforms, and *forkserver* added for some POSIX " "platforms. Child processes no longer inherit all of the parents inheritable " "handles on Windows." msgstr "" -#: ../../library/multiprocessing.rst:171 +#: ../../library/multiprocessing.rst:173 msgid "" "On macOS, the *spawn* start method is now the default. The *fork* start " "method should be considered unsafe as it can lead to crashes of the " "subprocess as macOS system libraries may start threads. See :issue:`33725`." msgstr "" -#: ../../library/multiprocessing.rst:175 +#: ../../library/multiprocessing.rst:179 +msgid "" +"On POSIX platforms the default start method was changed from *fork* to " +"*forkserver* to retain the performance but avoid common multithreaded " +"process incompatibilities. See :gh:`84559`." +msgstr "" + +#: ../../library/multiprocessing.rst:184 msgid "" "On POSIX using the *spawn* or *forkserver* start methods will also start a " "*resource tracker* process which tracks the unlinked named system resources " -"(such as named semaphores or :class:`~multiprocessing.shared_memory." -"SharedMemory` objects) created by processes of the program. When all " -"processes have exited the resource tracker unlinks any remaining tracked " -"object. Usually there should be none, but if a process was killed by a " -"signal there may be some \"leaked\" resources. (Neither leaked semaphores " -"nor shared memory segments will be automatically unlinked until the next " -"reboot. This is problematic for both objects because the system allows only " -"a limited number of named semaphores, and shared memory segments occupy some " -"space in the main memory.)" +"(such as named semaphores " +"or :class:`~multiprocessing.shared_memory.SharedMemory` objects) created by " +"processes of the program. When all processes have exited the resource " +"tracker unlinks any remaining tracked object. Usually there should be none, " +"but if a process was killed by a signal there may be some \"leaked\" " +"resources. (Neither leaked semaphores nor shared memory segments will be " +"automatically unlinked until the next reboot. This is problematic for both " +"objects because the system allows only a limited number of named semaphores, " +"and shared memory segments occupy some space in the main memory.)" msgstr "" -#: ../../library/multiprocessing.rst:188 +#: ../../library/multiprocessing.rst:197 msgid "" "To select a start method you use the :func:`set_start_method` in the ``if " "__name__ == '__main__'`` clause of the main module. For example::" msgstr "" -#: ../../library/multiprocessing.rst:192 +#: ../../library/multiprocessing.rst:201 msgid "" "import multiprocessing as mp\n" "\n" @@ -340,19 +350,19 @@ msgstr "" " print(q.get())\n" " p.join()" -#: ../../library/multiprocessing.rst:205 +#: ../../library/multiprocessing.rst:214 msgid "" ":func:`set_start_method` should not be used more than once in the program." msgstr "" -#: ../../library/multiprocessing.rst:208 +#: ../../library/multiprocessing.rst:217 msgid "" "Alternatively, you can use :func:`get_context` to obtain a context object. " "Context objects have the same API as the multiprocessing module, and allow " "one to use multiple start methods in the same program. ::" msgstr "" -#: ../../library/multiprocessing.rst:213 +#: ../../library/multiprocessing.rst:222 msgid "" "import multiprocessing as mp\n" "\n" @@ -380,7 +390,7 @@ msgstr "" " print(q.get())\n" " p.join()" -#: ../../library/multiprocessing.rst:226 +#: ../../library/multiprocessing.rst:235 msgid "" "Note that objects related to one context may not be compatible with " "processes for a different context. In particular, locks created using the " @@ -388,17 +398,17 @@ msgid "" "*forkserver* start methods." msgstr "" -#: ../../library/multiprocessing.rst:231 +#: ../../library/multiprocessing.rst:240 msgid "" -"Libraries using :mod:`multiprocessing` or :class:`~concurrent.futures." -"ProcessPoolExecutor` should be designed to allow their users to provide " -"their own multiprocessing context. Using a specific context of your own " -"within a library can lead to incompatibilities with the rest of the library " -"user's application. Always document if your library requires a specific " -"start method." +"Libraries using :mod:`multiprocessing` " +"or :class:`~concurrent.futures.ProcessPoolExecutor` should be designed to " +"allow their users to provide their own multiprocessing context. Using a " +"specific context of your own within a library can lead to incompatibilities " +"with the rest of the library user's application. Always document if your " +"library requires a specific start method." msgstr "" -#: ../../library/multiprocessing.rst:240 +#: ../../library/multiprocessing.rst:249 msgid "" "The ``'spawn'`` and ``'forkserver'`` start methods generally cannot be used " "with \"frozen\" executables (i.e., binaries produced by packages like " @@ -406,27 +416,27 @@ msgid "" "method may work if code does not use threads." msgstr "" -#: ../../library/multiprocessing.rst:247 +#: ../../library/multiprocessing.rst:256 msgid "Exchanging objects between processes" msgstr "" -#: ../../library/multiprocessing.rst:249 +#: ../../library/multiprocessing.rst:258 msgid "" ":mod:`multiprocessing` supports two types of communication channel between " "processes:" msgstr "" -#: ../../library/multiprocessing.rst:252 +#: ../../library/multiprocessing.rst:261 msgid "**Queues**" msgstr "" -#: ../../library/multiprocessing.rst:254 +#: ../../library/multiprocessing.rst:263 msgid "" "The :class:`Queue` class is a near clone of :class:`queue.Queue`. For " "example::" msgstr "" -#: ../../library/multiprocessing.rst:257 +#: ../../library/multiprocessing.rst:266 msgid "" "from multiprocessing import Process, Queue\n" "\n" @@ -452,23 +462,23 @@ msgstr "" " print(q.get()) # 印出 \"[42, None, 'hello']\"\n" " p.join()" -#: ../../library/multiprocessing.rst:269 +#: ../../library/multiprocessing.rst:278 msgid "" -"Queues are thread and process safe. Any object put into a :mod:" -"`~multiprocessing` queue will be serialized." +"Queues are thread and process safe. Any object put into " +"a :mod:`~multiprocessing` queue will be serialized." msgstr "" -#: ../../library/multiprocessing.rst:272 +#: ../../library/multiprocessing.rst:281 msgid "**Pipes**" msgstr "" -#: ../../library/multiprocessing.rst:274 +#: ../../library/multiprocessing.rst:283 msgid "" "The :func:`Pipe` function returns a pair of connection objects connected by " "a pipe which by default is duplex (two-way). For example::" msgstr "" -#: ../../library/multiprocessing.rst:277 +#: ../../library/multiprocessing.rst:286 msgid "" "from multiprocessing import Process, Pipe\n" "\n" @@ -496,34 +506,35 @@ msgstr "" " print(parent_conn.recv()) # 印出 \"[42, None, 'hello']\"\n" " p.join()" -#: ../../library/multiprocessing.rst:290 +#: ../../library/multiprocessing.rst:299 msgid "" "The two connection objects returned by :func:`Pipe` represent the two ends " -"of the pipe. Each connection object has :meth:`~Connection.send` and :meth:" -"`~Connection.recv` methods (among others). Note that data in a pipe may " -"become corrupted if two processes (or threads) try to read from or write to " -"the *same* end of the pipe at the same time. Of course there is no risk of " -"corruption from processes using different ends of the pipe at the same time." +"of the pipe. Each connection object has :meth:`~Connection.send` " +"and :meth:`~Connection.recv` methods (among others). Note that data in a " +"pipe may become corrupted if two processes (or threads) try to read from or " +"write to the *same* end of the pipe at the same time. Of course there is no " +"risk of corruption from processes using different ends of the pipe at the " +"same time." msgstr "" -#: ../../library/multiprocessing.rst:298 +#: ../../library/multiprocessing.rst:307 msgid "" -"The :meth:`~Connection.send` method serializes the object and :meth:" -"`~Connection.recv` re-creates the object." +"The :meth:`~Connection.send` method serializes the object " +"and :meth:`~Connection.recv` re-creates the object." msgstr "" -#: ../../library/multiprocessing.rst:302 +#: ../../library/multiprocessing.rst:311 msgid "Synchronization between processes" msgstr "" -#: ../../library/multiprocessing.rst:304 +#: ../../library/multiprocessing.rst:313 msgid "" ":mod:`multiprocessing` contains equivalents of all the synchronization " "primitives from :mod:`threading`. For instance one can use a lock to ensure " "that only one process prints to standard output at a time::" msgstr "" -#: ../../library/multiprocessing.rst:308 +#: ../../library/multiprocessing.rst:317 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -555,40 +566,40 @@ msgstr "" " for num in range(10):\n" " Process(target=f, args=(lock, num)).start()" -#: ../../library/multiprocessing.rst:323 +#: ../../library/multiprocessing.rst:332 msgid "" "Without using the lock output from the different processes is liable to get " "all mixed up." msgstr "" -#: ../../library/multiprocessing.rst:328 +#: ../../library/multiprocessing.rst:337 msgid "Sharing state between processes" msgstr "" -#: ../../library/multiprocessing.rst:330 +#: ../../library/multiprocessing.rst:339 msgid "" "As mentioned above, when doing concurrent programming it is usually best to " "avoid using shared state as far as possible. This is particularly true when " "using multiple processes." msgstr "" -#: ../../library/multiprocessing.rst:334 +#: ../../library/multiprocessing.rst:343 msgid "" -"However, if you really do need to use some shared data then :mod:" -"`multiprocessing` provides a couple of ways of doing so." +"However, if you really do need to use some shared data " +"then :mod:`multiprocessing` provides a couple of ways of doing so." msgstr "" -#: ../../library/multiprocessing.rst:337 +#: ../../library/multiprocessing.rst:346 msgid "**Shared memory**" msgstr "" -#: ../../library/multiprocessing.rst:339 +#: ../../library/multiprocessing.rst:348 msgid "" -"Data can be stored in a shared memory map using :class:`Value` or :class:" -"`Array`. For example, the following code ::" +"Data can be stored in a shared memory map using :class:`Value` " +"or :class:`Array`. For example, the following code ::" msgstr "" -#: ../../library/multiprocessing.rst:342 +#: ../../library/multiprocessing.rst:351 msgid "" "from multiprocessing import Process, Value, Array\n" "\n" @@ -626,11 +637,11 @@ msgstr "" " print(num.value)\n" " print(arr[:])" -#: ../../library/multiprocessing.rst:360 ../../library/multiprocessing.rst:406 +#: ../../library/multiprocessing.rst:369 ../../library/multiprocessing.rst:419 msgid "will print ::" msgstr "" -#: ../../library/multiprocessing.rst:362 +#: ../../library/multiprocessing.rst:371 msgid "" "3.1415927\n" "[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]" @@ -638,7 +649,7 @@ msgstr "" "3.1415927\n" "[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]" -#: ../../library/multiprocessing.rst:365 +#: ../../library/multiprocessing.rst:374 msgid "" "The ``'d'`` and ``'i'`` arguments used when creating ``num`` and ``arr`` are " "typecodes of the kind used by the :mod:`array` module: ``'d'`` indicates a " @@ -646,54 +657,57 @@ msgid "" "objects will be process and thread-safe." msgstr "" -#: ../../library/multiprocessing.rst:370 +#: ../../library/multiprocessing.rst:379 msgid "" -"For more flexibility in using shared memory one can use the :mod:" -"`multiprocessing.sharedctypes` module which supports the creation of " -"arbitrary ctypes objects allocated from shared memory." +"For more flexibility in using shared memory one can use " +"the :mod:`multiprocessing.sharedctypes` module which supports the creation " +"of arbitrary ctypes objects allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:374 +#: ../../library/multiprocessing.rst:383 msgid "**Server process**" msgstr "" -#: ../../library/multiprocessing.rst:376 +#: ../../library/multiprocessing.rst:385 msgid "" "A manager object returned by :func:`Manager` controls a server process which " "holds Python objects and allows other processes to manipulate them using " "proxies." msgstr "" -#: ../../library/multiprocessing.rst:380 +#: ../../library/multiprocessing.rst:389 msgid "" -"A manager returned by :func:`Manager` will support types :class:`list`, :" -"class:`dict`, :class:`~managers.Namespace`, :class:`Lock`, :class:`RLock`, :" -"class:`Semaphore`, :class:`BoundedSemaphore`, :class:`Condition`, :class:" -"`Event`, :class:`Barrier`, :class:`Queue`, :class:`Value` and :class:" -"`Array`. For example, ::" +"A manager returned by :func:`Manager` will support " +"types :class:`list`, :class:`dict`, :class:`set`, :class:`~managers.Namespace`, :class:`Lock`, :class:`RLock`, :class:`Semaphore`, :class:`BoundedSemaphore`, :class:`Condition`, :class:`Event`, :class:`Barrier`, :class:`Queue`, :class:`Value` " +"and :class:`Array`. For example, ::" msgstr "" -#: ../../library/multiprocessing.rst:386 +#: ../../library/multiprocessing.rst:395 +#, fuzzy msgid "" "from multiprocessing import Process, Manager\n" "\n" -"def f(d, l):\n" +"def f(d, l, s):\n" " d[1] = '1'\n" " d['2'] = 2\n" " d[0.25] = None\n" " l.reverse()\n" +" s.add('a')\n" +" s.add('b')\n" "\n" "if __name__ == '__main__':\n" " with Manager() as manager:\n" " d = manager.dict()\n" " l = manager.list(range(10))\n" +" s = manager.set()\n" "\n" -" p = Process(target=f, args=(d, l))\n" +" p = Process(target=f, args=(d, l, s))\n" " p.start()\n" " p.join()\n" "\n" " print(d)\n" -" print(l)" +" print(l)\n" +" print(s)" msgstr "" "from multiprocessing import Process, Manager\n" "\n" @@ -715,15 +729,17 @@ msgstr "" " print(d)\n" " print(l)" -#: ../../library/multiprocessing.rst:408 +#: ../../library/multiprocessing.rst:421 +#, fuzzy msgid "" "{0.25: None, 1: '1', '2': 2}\n" -"[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]" +"[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n" +"{'a', 'b'}" msgstr "" "{0.25: None, 1: '1', '2': 2}\n" "[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]" -#: ../../library/multiprocessing.rst:411 +#: ../../library/multiprocessing.rst:425 msgid "" "Server process managers are more flexible than using shared memory objects " "because they can be made to support arbitrary object types. Also, a single " @@ -731,22 +747,22 @@ msgid "" "They are, however, slower than using shared memory." msgstr "" -#: ../../library/multiprocessing.rst:418 +#: ../../library/multiprocessing.rst:432 msgid "Using a pool of workers" msgstr "" -#: ../../library/multiprocessing.rst:420 +#: ../../library/multiprocessing.rst:434 msgid "" "The :class:`~multiprocessing.pool.Pool` class represents a pool of worker " "processes. It has methods which allows tasks to be offloaded to the worker " "processes in a few different ways." msgstr "" -#: ../../library/multiprocessing.rst:424 +#: ../../library/multiprocessing.rst:438 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/multiprocessing.rst:426 +#: ../../library/multiprocessing.rst:440 msgid "" "from multiprocessing import Pool, TimeoutError\n" "import time\n" @@ -786,8 +802,8 @@ msgid "" " try:\n" " print(res.get(timeout=1))\n" " except TimeoutError:\n" -" print(\"We lacked patience and got a multiprocessing." -"TimeoutError\")\n" +" print(\"We lacked patience and got a " +"multiprocessing.TimeoutError\")\n" "\n" " print(\"For the moment, the pool remains available for more work\")\n" "\n" @@ -795,13 +811,13 @@ msgid "" " print(\"Now the pool is closed and no longer available\")" msgstr "" -#: ../../library/multiprocessing.rst:468 +#: ../../library/multiprocessing.rst:482 msgid "" "Note that the methods of a pool should only ever be used by the process " "which created it." msgstr "" -#: ../../library/multiprocessing.rst:473 +#: ../../library/multiprocessing.rst:487 msgid "" "Functionality within this package requires that the ``__main__`` module be " "importable by the children. This is covered in :ref:`multiprocessing-" @@ -810,7 +826,7 @@ msgid "" "work in the interactive interpreter. For example::" msgstr "" -#: ../../library/multiprocessing.rst:479 +#: ../../library/multiprocessing.rst:493 msgid "" ">>> from multiprocessing import Pool\n" ">>> p = Pool(5)\n" @@ -852,71 +868,71 @@ msgstr "" "AttributeError: Can't get attribute 'f' on )>" -#: ../../library/multiprocessing.rst:496 +#: ../../library/multiprocessing.rst:510 msgid "" "(If you try this it will actually output three full tracebacks interleaved " "in a semi-random fashion, and then you may have to stop the parent process " "somehow.)" msgstr "" -#: ../../library/multiprocessing.rst:502 +#: ../../library/multiprocessing.rst:516 msgid "Reference" msgstr "" -#: ../../library/multiprocessing.rst:504 +#: ../../library/multiprocessing.rst:518 msgid "" -"The :mod:`multiprocessing` package mostly replicates the API of the :mod:" -"`threading` module." +"The :mod:`multiprocessing` package mostly replicates the API of " +"the :mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:509 +#: ../../library/multiprocessing.rst:523 msgid ":class:`Process` and exceptions" msgstr ":class:`Process` 與例外" -#: ../../library/multiprocessing.rst:514 +#: ../../library/multiprocessing.rst:528 msgid "" -"Process objects represent activity that is run in a separate process. The :" -"class:`Process` class has equivalents of all the methods of :class:" -"`threading.Thread`." +"Process objects represent activity that is run in a separate process. " +"The :class:`Process` class has equivalents of all the methods " +"of :class:`threading.Thread`." msgstr "" -#: ../../library/multiprocessing.rst:518 +#: ../../library/multiprocessing.rst:532 msgid "" "The constructor should always be called with keyword arguments. *group* " -"should always be ``None``; it exists solely for compatibility with :class:" -"`threading.Thread`. *target* is the callable object to be invoked by the :" -"meth:`run` method. It defaults to ``None``, meaning nothing is called. " -"*name* is the process name (see :attr:`name` for more details). *args* is " -"the argument tuple for the target invocation. *kwargs* is a dictionary of " -"keyword arguments for the target invocation. If provided, the keyword-only " -"*daemon* argument sets the process :attr:`daemon` flag to ``True`` or " -"``False``. If ``None`` (the default), this flag will be inherited from the " -"creating process." +"should always be ``None``; it exists solely for compatibility " +"with :class:`threading.Thread`. *target* is the callable object to be " +"invoked by the :meth:`run` method. It defaults to ``None``, meaning nothing " +"is called. *name* is the process name (see :attr:`name` for more details). " +"*args* is the argument tuple for the target invocation. *kwargs* is a " +"dictionary of keyword arguments for the target invocation. If provided, the " +"keyword-only *daemon* argument sets the process :attr:`daemon` flag to " +"``True`` or ``False``. If ``None`` (the default), this flag will be " +"inherited from the creating process." msgstr "" -#: ../../library/multiprocessing.rst:529 +#: ../../library/multiprocessing.rst:543 msgid "" "By default, no arguments are passed to *target*. The *args* argument, which " "defaults to ``()``, can be used to specify a list or tuple of the arguments " "to pass to *target*." msgstr "" -#: ../../library/multiprocessing.rst:533 +#: ../../library/multiprocessing.rst:547 msgid "" "If a subclass overrides the constructor, it must make sure it invokes the " "base class constructor (``super().__init__()``) before doing anything else " "to the process." msgstr "" -#: ../../library/multiprocessing.rst:539 +#: ../../library/multiprocessing.rst:553 msgid "" "In general, all arguments to :class:`Process` must be picklable. This is " -"frequently observed when trying to create a :class:`Process` or use a :class:" -"`concurrent.futures.ProcessPoolExecutor` from a REPL with a locally defined " -"*target* function." +"frequently observed when trying to create a :class:`Process` or use " +"a :class:`concurrent.futures.ProcessPoolExecutor` from a REPL with a locally " +"defined *target* function." msgstr "" -#: ../../library/multiprocessing.rst:544 +#: ../../library/multiprocessing.rst:558 msgid "" "Passing a callable object defined in the current REPL session causes the " "child process to die via an uncaught :exc:`AttributeError` exception when " @@ -924,11 +940,11 @@ msgid "" "order to be loaded during unpickling." msgstr "" -#: ../../library/multiprocessing.rst:549 +#: ../../library/multiprocessing.rst:563 msgid "Example of this uncatchable error from the child::" msgstr "" -#: ../../library/multiprocessing.rst:551 +#: ../../library/multiprocessing.rst:565 msgid "" ">>> import multiprocessing as mp\n" ">>> def knigit():\n" @@ -958,7 +974,7 @@ msgstr "" "" -#: ../../library/multiprocessing.rst:564 +#: ../../library/multiprocessing.rst:578 msgid "" "See :ref:`multiprocessing-programming-spawn`. While this restriction is not " "true if using the ``\"fork\"`` start method, as of Python ``3.14`` that is " @@ -966,15 +982,15 @@ msgid "" "methods`. See also :gh:`132898`." msgstr "" -#: ../../library/multiprocessing.rst:570 +#: ../../library/multiprocessing.rst:584 msgid "Added the *daemon* parameter." msgstr "新增 *daemon* 參數。" -#: ../../library/multiprocessing.rst:575 +#: ../../library/multiprocessing.rst:589 msgid "Method representing the process's activity." msgstr "" -#: ../../library/multiprocessing.rst:577 +#: ../../library/multiprocessing.rst:591 msgid "" "You may override this method in a subclass. The standard :meth:`run` method " "invokes the callable object passed to the object's constructor as the target " @@ -982,17 +998,17 @@ msgid "" "*args* and *kwargs* arguments, respectively." msgstr "" -#: ../../library/multiprocessing.rst:582 +#: ../../library/multiprocessing.rst:596 msgid "" "Using a list or tuple as the *args* argument passed to :class:`Process` " "achieves the same effect." msgstr "" -#: ../../library/multiprocessing.rst:585 +#: ../../library/multiprocessing.rst:599 msgid "Example::" msgstr "範例: ::" -#: ../../library/multiprocessing.rst:587 +#: ../../library/multiprocessing.rst:601 msgid "" ">>> from multiprocessing import Process\n" ">>> p = Process(target=print, args=[1])\n" @@ -1010,17 +1026,17 @@ msgstr "" ">>> p.run()\n" "1" -#: ../../library/multiprocessing.rst:597 +#: ../../library/multiprocessing.rst:611 msgid "Start the process's activity." msgstr "" -#: ../../library/multiprocessing.rst:599 +#: ../../library/multiprocessing.rst:613 msgid "" "This must be called at most once per process object. It arranges for the " "object's :meth:`run` method to be invoked in a separate process." msgstr "" -#: ../../library/multiprocessing.rst:604 +#: ../../library/multiprocessing.rst:618 msgid "" "If the optional argument *timeout* is ``None`` (the default), the method " "blocks until the process whose :meth:`join` method is called terminates. If " @@ -1030,57 +1046,57 @@ msgid "" "terminated." msgstr "" -#: ../../library/multiprocessing.rst:611 +#: ../../library/multiprocessing.rst:625 msgid "A process can be joined many times." msgstr "" -#: ../../library/multiprocessing.rst:613 +#: ../../library/multiprocessing.rst:627 msgid "" "A process cannot join itself because this would cause a deadlock. It is an " "error to attempt to join a process before it has been started." msgstr "" -#: ../../library/multiprocessing.rst:618 +#: ../../library/multiprocessing.rst:632 msgid "" "The process's name. The name is a string used for identification purposes " "only. It has no semantics. Multiple processes may be given the same name." msgstr "" -#: ../../library/multiprocessing.rst:622 +#: ../../library/multiprocessing.rst:636 msgid "" "The initial name is set by the constructor. If no explicit name is provided " -"to the constructor, a name of the form 'Process-N\\ :sub:`1`:N\\ :sub:" -"`2`:...:N\\ :sub:`k`' is constructed, where each N\\ :sub:`k` is the N-th " -"child of its parent." +"to the constructor, a name of the form 'Process-" +"N\\ :sub:`1`:N\\ :sub:`2`:...:N\\ :sub:`k`' is constructed, where each " +"N\\ :sub:`k` is the N-th child of its parent." msgstr "" -#: ../../library/multiprocessing.rst:629 +#: ../../library/multiprocessing.rst:643 msgid "Return whether the process is alive." msgstr "" -#: ../../library/multiprocessing.rst:631 +#: ../../library/multiprocessing.rst:645 msgid "" "Roughly, a process object is alive from the moment the :meth:`start` method " "returns until the child process terminates." msgstr "" -#: ../../library/multiprocessing.rst:636 +#: ../../library/multiprocessing.rst:650 msgid "" -"The process's daemon flag, a Boolean value. This must be set before :meth:" -"`start` is called." +"The process's daemon flag, a Boolean value. This must be set " +"before :meth:`start` is called." msgstr "" -#: ../../library/multiprocessing.rst:639 +#: ../../library/multiprocessing.rst:653 msgid "The initial value is inherited from the creating process." msgstr "" -#: ../../library/multiprocessing.rst:641 +#: ../../library/multiprocessing.rst:655 msgid "" "When a process exits, it attempts to terminate all of its daemonic child " "processes." msgstr "" -#: ../../library/multiprocessing.rst:644 +#: ../../library/multiprocessing.rst:658 msgid "" "Note that a daemonic process is not allowed to create child processes. " "Otherwise a daemonic process would leave its children orphaned if it gets " @@ -1089,92 +1105,121 @@ msgid "" "(and not joined) if non-daemonic processes have exited." msgstr "" -#: ../../library/multiprocessing.rst:650 +#: ../../library/multiprocessing.rst:664 msgid "" "In addition to the :class:`threading.Thread` API, :class:`Process` objects " "also support the following attributes and methods:" msgstr "" -#: ../../library/multiprocessing.rst:655 +#: ../../library/multiprocessing.rst:669 msgid "" "Return the process ID. Before the process is spawned, this will be ``None``." msgstr "" -#: ../../library/multiprocessing.rst:660 +#: ../../library/multiprocessing.rst:674 msgid "" "The child's exit code. This will be ``None`` if the process has not yet " "terminated." msgstr "" -#: ../../library/multiprocessing.rst:663 +#: ../../library/multiprocessing.rst:677 msgid "" "If the child's :meth:`run` method returned normally, the exit code will be " "0. If it terminated via :func:`sys.exit` with an integer argument *N*, the " "exit code will be *N*." msgstr "" -#: ../../library/multiprocessing.rst:667 +#: ../../library/multiprocessing.rst:681 msgid "" "If the child terminated due to an exception not caught within :meth:`run`, " "the exit code will be 1. If it was terminated by signal *N*, the exit code " "will be the negative value *-N*." msgstr "" -#: ../../library/multiprocessing.rst:673 +#: ../../library/multiprocessing.rst:687 msgid "The process's authentication key (a byte string)." msgstr "" -#: ../../library/multiprocessing.rst:675 +#: ../../library/multiprocessing.rst:689 msgid "" "When :mod:`multiprocessing` is initialized the main process is assigned a " "random string using :func:`os.urandom`." msgstr "" -#: ../../library/multiprocessing.rst:678 +#: ../../library/multiprocessing.rst:692 msgid "" "When a :class:`Process` object is created, it will inherit the " "authentication key of its parent process, although this may be changed by " "setting :attr:`authkey` to another byte string." msgstr "" -#: ../../library/multiprocessing.rst:682 +#: ../../library/multiprocessing.rst:696 msgid "See :ref:`multiprocessing-auth-keys`." msgstr "參閱 :ref:`multiprocessing-auth-keys`。" -#: ../../library/multiprocessing.rst:686 +#: ../../library/multiprocessing.rst:700 msgid "" "A numeric handle of a system object which will become \"ready\" when the " "process ends." msgstr "" -#: ../../library/multiprocessing.rst:689 +#: ../../library/multiprocessing.rst:703 msgid "" -"You can use this value if you want to wait on several events at once using :" -"func:`multiprocessing.connection.wait`. Otherwise calling :meth:`join` is " -"simpler." +"You can use this value if you want to wait on several events at once " +"using :func:`multiprocessing.connection.wait`. Otherwise " +"calling :meth:`join` is simpler." msgstr "" -#: ../../library/multiprocessing.rst:693 +#: ../../library/multiprocessing.rst:707 msgid "" "On Windows, this is an OS handle usable with the ``WaitForSingleObject`` and " "``WaitForMultipleObjects`` family of API calls. On POSIX, this is a file " "descriptor usable with primitives from the :mod:`select` module." msgstr "" -#: ../../library/multiprocessing.rst:701 +#: ../../library/multiprocessing.rst:715 +msgid "" +"Terminate the process. Works on POSIX using the :py:const:`~signal.SIGINT` " +"signal. Behavior on Windows is undefined." +msgstr "" + +#: ../../library/multiprocessing.rst:718 +msgid "" +"By default, this terminates the child process by " +"raising :exc:`KeyboardInterrupt`. This behavior can be altered by setting " +"the respective signal handler in the child process :func:`signal.signal` " +"for :py:const:`~signal.SIGINT`." +msgstr "" + +#: ../../library/multiprocessing.rst:722 +msgid "" +"Note: if the child process catches and discards :exc:`KeyboardInterrupt`, " +"the process will not be terminated." +msgstr "" + +#: ../../library/multiprocessing.rst:725 msgid "" -"Terminate the process. On POSIX this is done using the :py:const:`~signal." -"SIGTERM` signal; on Windows :c:func:`!TerminateProcess` is used. Note that " -"exit handlers and finally clauses, etc., will not be executed." +"Note: the default behavior will also set :attr:`exitcode` to ``1`` as if an " +"uncaught exception was raised in the child process. To have a " +"different :attr:`exitcode` you may simply catch :exc:`KeyboardInterrupt` and " +"call ``exit(your_code)``." msgstr "" -#: ../../library/multiprocessing.rst:705 +#: ../../library/multiprocessing.rst:734 +msgid "" +"Terminate the process. On POSIX this is done using " +"the :py:const:`~signal.SIGTERM` signal; on Windows :c:func:`!" +"TerminateProcess` is used. Note that exit handlers and finally clauses, " +"etc., will not be executed." +msgstr "" + +#: ../../library/multiprocessing.rst:738 msgid "" "Note that descendant processes of the process will *not* be terminated -- " "they will simply become orphaned." msgstr "" -#: ../../library/multiprocessing.rst:710 +#: ../../library/multiprocessing.rst:743 msgid "" "If this method is used when the associated process is using a pipe or queue " "then the pipe or queue is liable to become corrupted and may become unusable " @@ -1183,11 +1228,11 @@ msgid "" "deadlock." msgstr "" -#: ../../library/multiprocessing.rst:718 +#: ../../library/multiprocessing.rst:751 msgid "Same as :meth:`terminate` but using the ``SIGKILL`` signal on POSIX." msgstr "" -#: ../../library/multiprocessing.rst:724 +#: ../../library/multiprocessing.rst:757 msgid "" "Close the :class:`Process` object, releasing all resources associated with " "it. :exc:`ValueError` is raised if the underlying process is still " @@ -1195,18 +1240,19 @@ msgid "" "attributes of the :class:`Process` object will raise :exc:`ValueError`." msgstr "" -#: ../../library/multiprocessing.rst:732 +#: ../../library/multiprocessing.rst:765 msgid "" -"Note that the :meth:`start`, :meth:`join`, :meth:`is_alive`, :meth:" -"`terminate` and :attr:`exitcode` methods should only be called by the " -"process that created the process object." +"Note that " +"the :meth:`start`, :meth:`join`, :meth:`is_alive`, :meth:`terminate` " +"and :attr:`exitcode` methods should only be called by the process that " +"created the process object." msgstr "" -#: ../../library/multiprocessing.rst:736 +#: ../../library/multiprocessing.rst:769 msgid "Example usage of some of the methods of :class:`Process`:" msgstr "" -#: ../../library/multiprocessing.rst:738 +#: ../../library/multiprocessing.rst:771 msgid "" ">>> import multiprocessing, time, signal\n" ">>> mp_context = multiprocessing.get_context('spawn')\n" @@ -1238,87 +1284,88 @@ msgstr "" ">>> p.exitcode == -signal.SIGTERM\n" "True" -#: ../../library/multiprocessing.rst:757 +#: ../../library/multiprocessing.rst:790 msgid "The base class of all :mod:`multiprocessing` exceptions." msgstr "" -#: ../../library/multiprocessing.rst:761 +#: ../../library/multiprocessing.rst:794 msgid "" "Exception raised by :meth:`Connection.recv_bytes_into` when the supplied " "buffer object is too small for the message read." msgstr "" -#: ../../library/multiprocessing.rst:764 +#: ../../library/multiprocessing.rst:797 msgid "" "If ``e`` is an instance of :exc:`BufferTooShort` then ``e.args[0]`` will " "give the message as a byte string." msgstr "" -#: ../../library/multiprocessing.rst:769 +#: ../../library/multiprocessing.rst:802 msgid "Raised when there is an authentication error." msgstr "" -#: ../../library/multiprocessing.rst:773 +#: ../../library/multiprocessing.rst:806 msgid "Raised by methods with a timeout when the timeout expires." msgstr "" -#: ../../library/multiprocessing.rst:776 +#: ../../library/multiprocessing.rst:809 msgid "Pipes and Queues" msgstr "" -#: ../../library/multiprocessing.rst:778 +#: ../../library/multiprocessing.rst:811 msgid "" "When using multiple processes, one generally uses message passing for " "communication between processes and avoids having to use any synchronization " "primitives like locks." msgstr "" -#: ../../library/multiprocessing.rst:782 +#: ../../library/multiprocessing.rst:815 msgid "" "For passing messages one can use :func:`Pipe` (for a connection between two " "processes) or a queue (which allows multiple producers and consumers)." msgstr "" -#: ../../library/multiprocessing.rst:785 +#: ../../library/multiprocessing.rst:818 msgid "" "The :class:`Queue`, :class:`SimpleQueue` and :class:`JoinableQueue` types " "are multi-producer, multi-consumer :abbr:`FIFO (first-in, first-out)` queues " "modelled on the :class:`queue.Queue` class in the standard library. They " -"differ in that :class:`Queue` lacks the :meth:`~queue.Queue.task_done` and :" -"meth:`~queue.Queue.join` methods introduced into Python 2.5's :class:`queue." -"Queue` class." +"differ in that :class:`Queue` lacks the :meth:`~queue.Queue.task_done` " +"and :meth:`~queue.Queue.join` methods introduced into Python " +"2.5's :class:`queue.Queue` class." msgstr "" -#: ../../library/multiprocessing.rst:792 +#: ../../library/multiprocessing.rst:825 msgid "" -"If you use :class:`JoinableQueue` then you **must** call :meth:" -"`JoinableQueue.task_done` for each task removed from the queue or else the " -"semaphore used to count the number of unfinished tasks may eventually " -"overflow, raising an exception." +"If you use :class:`JoinableQueue` then you **must** " +"call :meth:`JoinableQueue.task_done` for each task removed from the queue or " +"else the semaphore used to count the number of unfinished tasks may " +"eventually overflow, raising an exception." msgstr "" -#: ../../library/multiprocessing.rst:797 +#: ../../library/multiprocessing.rst:830 msgid "" -"One difference from other Python queue implementations, is that :mod:" -"`multiprocessing` queues serializes all objects that are put into them " -"using :mod:`pickle`. The object return by the get method is a re-created " -"object that does not share memory with the original object." +"One difference from other Python queue implementations, is " +"that :mod:`multiprocessing` queues serializes all objects that are put into " +"them using :mod:`pickle`. The object return by the get method is a re-" +"created object that does not share memory with the original object." msgstr "" -#: ../../library/multiprocessing.rst:802 +#: ../../library/multiprocessing.rst:835 msgid "" "Note that one can also create a shared queue by using a manager object -- " "see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:807 +#: ../../library/multiprocessing.rst:840 msgid "" -":mod:`multiprocessing` uses the usual :exc:`queue.Empty` and :exc:`queue." -"Full` exceptions to signal a timeout. They are not available in the :mod:" -"`multiprocessing` namespace so you need to import them from :mod:`queue`." +":mod:`multiprocessing` uses the usual :exc:`queue.Empty` " +"and :exc:`queue.Full` exceptions to signal a timeout. They are not " +"available in the :mod:`multiprocessing` namespace so you need to import them " +"from :mod:`queue`." msgstr "" -#: ../../library/multiprocessing.rst:814 +#: ../../library/multiprocessing.rst:847 msgid "" "When an object is put on a queue, the object is pickled and a background " "thread later flushes the pickled data to an underlying pipe. This has some " @@ -1327,14 +1374,14 @@ msgid "" "a queue created with a :ref:`manager `." msgstr "" -#: ../../library/multiprocessing.rst:821 +#: ../../library/multiprocessing.rst:854 msgid "" "After putting an object on an empty queue there may be an infinitesimal " "delay before the queue's :meth:`~Queue.empty` method returns :const:`False` " "and :meth:`~Queue.get_nowait` can return without raising :exc:`queue.Empty`." msgstr "" -#: ../../library/multiprocessing.rst:826 +#: ../../library/multiprocessing.rst:859 msgid "" "If multiple processes are enqueuing objects, it is possible for the objects " "to be received at the other end out-of-order. However, objects enqueued by " @@ -1342,7 +1389,7 @@ msgid "" "other." msgstr "" -#: ../../library/multiprocessing.rst:833 +#: ../../library/multiprocessing.rst:866 msgid "" "If a process is killed using :meth:`Process.terminate` or :func:`os.kill` " "while it is trying to use a :class:`Queue`, then the data in the queue is " @@ -1350,15 +1397,15 @@ msgid "" "exception when it tries to use the queue later on." msgstr "" -#: ../../library/multiprocessing.rst:840 +#: ../../library/multiprocessing.rst:873 msgid "" "As mentioned above, if a child process has put items on a queue (and it has " -"not used :meth:`JoinableQueue.cancel_join_thread `), then that process will not terminate until all " -"buffered items have been flushed to the pipe." +"not used :meth:`JoinableQueue.cancel_join_thread " +"`), then that process will not " +"terminate until all buffered items have been flushed to the pipe." msgstr "" -#: ../../library/multiprocessing.rst:845 +#: ../../library/multiprocessing.rst:878 msgid "" "This means that if you try joining that process you may get a deadlock " "unless you are sure that all items which have been put on the queue have " @@ -1367,25 +1414,26 @@ msgid "" "children." msgstr "" -#: ../../library/multiprocessing.rst:850 +#: ../../library/multiprocessing.rst:883 msgid "" -"Note that a queue created using a manager does not have this issue. See :" -"ref:`multiprocessing-programming`." +"Note that a queue created using a manager does not have this issue. " +"See :ref:`multiprocessing-programming`." msgstr "" -#: ../../library/multiprocessing.rst:853 +#: ../../library/multiprocessing.rst:886 msgid "" -"For an example of the usage of queues for interprocess communication see :" -"ref:`multiprocessing-examples`." +"For an example of the usage of queues for interprocess communication " +"see :ref:`multiprocessing-examples`." msgstr "" -#: ../../library/multiprocessing.rst:859 +#: ../../library/multiprocessing.rst:892 msgid "" -"Returns a pair ``(conn1, conn2)`` of :class:`~multiprocessing.connection." -"Connection` objects representing the ends of a pipe." +"Returns a pair ``(conn1, conn2)`` " +"of :class:`~multiprocessing.connection.Connection` objects representing the " +"ends of a pipe." msgstr "" -#: ../../library/multiprocessing.rst:863 +#: ../../library/multiprocessing.rst:896 msgid "" "If *duplex* is ``True`` (the default) then the pipe is bidirectional. If " "*duplex* is ``False`` then the pipe is unidirectional: ``conn1`` can only be " @@ -1393,61 +1441,61 @@ msgid "" "messages." msgstr "" -#: ../../library/multiprocessing.rst:868 +#: ../../library/multiprocessing.rst:901 msgid "" "The :meth:`~multiprocessing.Connection.send` method serializes the object " "using :mod:`pickle` and the :meth:`~multiprocessing.Connection.recv` re-" "creates the object." msgstr "" -#: ../../library/multiprocessing.rst:873 +#: ../../library/multiprocessing.rst:906 msgid "" "Returns a process shared queue implemented using a pipe and a few locks/" "semaphores. When a process first puts an item on the queue a feeder thread " "is started which transfers objects from a buffer into the pipe." msgstr "" -#: ../../library/multiprocessing.rst:877 +#: ../../library/multiprocessing.rst:910 msgid "" "The usual :exc:`queue.Empty` and :exc:`queue.Full` exceptions from the " "standard library's :mod:`queue` module are raised to signal timeouts." msgstr "" -#: ../../library/multiprocessing.rst:880 +#: ../../library/multiprocessing.rst:913 msgid "" ":class:`Queue` implements all the methods of :class:`queue.Queue` except " "for :meth:`~queue.Queue.task_done` and :meth:`~queue.Queue.join`." msgstr "" -#: ../../library/multiprocessing.rst:885 +#: ../../library/multiprocessing.rst:918 msgid "" "Return the approximate size of the queue. Because of multithreading/" "multiprocessing semantics, this number is not reliable." msgstr "" -#: ../../library/multiprocessing.rst:888 +#: ../../library/multiprocessing.rst:921 msgid "" "Note that this may raise :exc:`NotImplementedError` on platforms like macOS " "where ``sem_getvalue()`` is not implemented." msgstr "" -#: ../../library/multiprocessing.rst:893 +#: ../../library/multiprocessing.rst:926 msgid "" "Return ``True`` if the queue is empty, ``False`` otherwise. Because of " "multithreading/multiprocessing semantics, this is not reliable." msgstr "" -#: ../../library/multiprocessing.rst:896 +#: ../../library/multiprocessing.rst:929 msgid "May raise an :exc:`OSError` on closed queues. (not guaranteed)" msgstr "" -#: ../../library/multiprocessing.rst:900 +#: ../../library/multiprocessing.rst:933 msgid "" "Return ``True`` if the queue is full, ``False`` otherwise. Because of " "multithreading/multiprocessing semantics, this is not reliable." msgstr "" -#: ../../library/multiprocessing.rst:905 +#: ../../library/multiprocessing.rst:938 msgid "" "Put obj into the queue. If the optional argument *block* is ``True`` (the " "default) and *timeout* is ``None`` (the default), block if necessary until a " @@ -1458,82 +1506,83 @@ msgid "" "the :exc:`queue.Full` exception (*timeout* is ignored in that case)." msgstr "" -#: ../../library/multiprocessing.rst:914 +#: ../../library/multiprocessing.rst:947 msgid "" -"If the queue is closed, :exc:`ValueError` is raised instead of :exc:" -"`AssertionError`." +"If the queue is closed, :exc:`ValueError` is raised instead " +"of :exc:`AssertionError`." msgstr "" -#: ../../library/multiprocessing.rst:920 +#: ../../library/multiprocessing.rst:953 msgid "Equivalent to ``put(obj, False)``." msgstr "" -#: ../../library/multiprocessing.rst:924 +#: ../../library/multiprocessing.rst:957 msgid "" "Remove and return an item from the queue. If optional args *block* is " "``True`` (the default) and *timeout* is ``None`` (the default), block if " "necessary until an item is available. If *timeout* is a positive number, it " "blocks at most *timeout* seconds and raises the :exc:`queue.Empty` exception " "if no item was available within that time. Otherwise (block is ``False``), " -"return an item if one is immediately available, else raise the :exc:`queue." -"Empty` exception (*timeout* is ignored in that case)." +"return an item if one is immediately available, else raise " +"the :exc:`queue.Empty` exception (*timeout* is ignored in that case)." msgstr "" -#: ../../library/multiprocessing.rst:932 +#: ../../library/multiprocessing.rst:965 msgid "" -"If the queue is closed, :exc:`ValueError` is raised instead of :exc:" -"`OSError`." +"If the queue is closed, :exc:`ValueError` is raised instead " +"of :exc:`OSError`." msgstr "" -#: ../../library/multiprocessing.rst:938 +#: ../../library/multiprocessing.rst:971 msgid "Equivalent to ``get(False)``." msgstr "" -#: ../../library/multiprocessing.rst:940 +#: ../../library/multiprocessing.rst:973 msgid "" -":class:`multiprocessing.Queue` has a few additional methods not found in :" -"class:`queue.Queue`. These methods are usually unnecessary for most code:" +":class:`multiprocessing.Queue` has a few additional methods not found " +"in :class:`queue.Queue`. These methods are usually unnecessary for most " +"code:" msgstr "" -#: ../../library/multiprocessing.rst:946 ../../library/multiprocessing.rst:994 +#: ../../library/multiprocessing.rst:979 ../../library/multiprocessing.rst:1027 msgid "Close the queue: release internal resources." msgstr "" -#: ../../library/multiprocessing.rst:948 +#: ../../library/multiprocessing.rst:981 msgid "" -"A queue must not be used anymore after it is closed. For example, :meth:" -"`~Queue.get`, :meth:`~Queue.put` and :meth:`~Queue.empty` methods must no " -"longer be called." +"A queue must not be used anymore after it is closed. For " +"example, :meth:`~Queue.get`, :meth:`~Queue.put` and :meth:`~Queue.empty` " +"methods must no longer be called." msgstr "" -#: ../../library/multiprocessing.rst:952 +#: ../../library/multiprocessing.rst:985 msgid "" "The background thread will quit once it has flushed all buffered data to the " "pipe. This is called automatically when the queue is garbage collected." msgstr "" -#: ../../library/multiprocessing.rst:958 +#: ../../library/multiprocessing.rst:991 msgid "" "Join the background thread. This can only be used after :meth:`close` has " "been called. It blocks until the background thread exits, ensuring that all " "data in the buffer has been flushed to the pipe." msgstr "" -#: ../../library/multiprocessing.rst:962 +#: ../../library/multiprocessing.rst:995 msgid "" "By default if a process is not the creator of the queue then on exit it will " -"attempt to join the queue's background thread. The process can call :meth:" -"`cancel_join_thread` to make :meth:`join_thread` do nothing." +"attempt to join the queue's background thread. The process can " +"call :meth:`cancel_join_thread` to make :meth:`join_thread` do nothing." msgstr "" -#: ../../library/multiprocessing.rst:968 +#: ../../library/multiprocessing.rst:1001 msgid "" "Prevent :meth:`join_thread` from blocking. In particular, this prevents the " "background thread from being joined automatically when the process exits -- " "see :meth:`join_thread`." msgstr "" -#: ../../library/multiprocessing.rst:972 +#: ../../library/multiprocessing.rst:1005 msgid "" "A better name for this method might be ``allow_exit_without_flush()``. It " "is likely to cause enqueued data to be lost, and you almost certainly will " @@ -1542,7 +1591,7 @@ msgid "" "pipe, and you don't care about lost data." msgstr "" -#: ../../library/multiprocessing.rst:981 +#: ../../library/multiprocessing.rst:1014 msgid "" "This class's functionality requires a functioning shared semaphore " "implementation on the host operating system. Without one, the functionality " @@ -1552,40 +1601,41 @@ msgid "" "listed below." msgstr "" -#: ../../library/multiprocessing.rst:990 +#: ../../library/multiprocessing.rst:1023 msgid "" "It is a simplified :class:`Queue` type, very close to a locked :class:`Pipe`." msgstr "" -#: ../../library/multiprocessing.rst:996 +#: ../../library/multiprocessing.rst:1029 msgid "" -"A queue must not be used anymore after it is closed. For example, :meth:" -"`get`, :meth:`put` and :meth:`empty` methods must no longer be called." +"A queue must not be used anymore after it is closed. For " +"example, :meth:`get`, :meth:`put` and :meth:`empty` methods must no longer " +"be called." msgstr "" -#: ../../library/multiprocessing.rst:1004 +#: ../../library/multiprocessing.rst:1037 msgid "Return ``True`` if the queue is empty, ``False`` otherwise." msgstr "" -#: ../../library/multiprocessing.rst:1006 +#: ../../library/multiprocessing.rst:1039 msgid "Always raises an :exc:`OSError` if the SimpleQueue is closed." msgstr "" -#: ../../library/multiprocessing.rst:1010 +#: ../../library/multiprocessing.rst:1043 msgid "Remove and return an item from the queue." msgstr "" -#: ../../library/multiprocessing.rst:1014 +#: ../../library/multiprocessing.rst:1047 msgid "Put *item* into the queue." msgstr "" -#: ../../library/multiprocessing.rst:1019 +#: ../../library/multiprocessing.rst:1052 msgid "" ":class:`JoinableQueue`, a :class:`Queue` subclass, is a queue which " "additionally has :meth:`task_done` and :meth:`join` methods." msgstr "" -#: ../../library/multiprocessing.rst:1024 +#: ../../library/multiprocessing.rst:1057 msgid "" "Indicate that a formerly enqueued task is complete. Used by queue " "consumers. For each :meth:`~Queue.get` used to fetch a task, a subsequent " @@ -1593,24 +1643,24 @@ msgid "" "complete." msgstr "" -#: ../../library/multiprocessing.rst:1029 +#: ../../library/multiprocessing.rst:1062 msgid "" "If a :meth:`~queue.Queue.join` is currently blocking, it will resume when " "all items have been processed (meaning that a :meth:`task_done` call was " "received for every item that had been :meth:`~Queue.put` into the queue)." msgstr "" -#: ../../library/multiprocessing.rst:1033 +#: ../../library/multiprocessing.rst:1066 msgid "" "Raises a :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "" -#: ../../library/multiprocessing.rst:1039 +#: ../../library/multiprocessing.rst:1072 msgid "Block until all items in the queue have been gotten and processed." msgstr "" -#: ../../library/multiprocessing.rst:1041 +#: ../../library/multiprocessing.rst:1074 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " "queue. The count goes down whenever a consumer calls :meth:`task_done` to " @@ -1619,78 +1669,78 @@ msgid "" "unblocks." msgstr "" -#: ../../library/multiprocessing.rst:1049 +#: ../../library/multiprocessing.rst:1082 msgid "Miscellaneous" msgstr "" -#: ../../library/multiprocessing.rst:1053 +#: ../../library/multiprocessing.rst:1086 msgid "Return list of all live children of the current process." msgstr "" -#: ../../library/multiprocessing.rst:1055 +#: ../../library/multiprocessing.rst:1088 msgid "" "Calling this has the side effect of \"joining\" any processes which have " "already finished." msgstr "" -#: ../../library/multiprocessing.rst:1060 +#: ../../library/multiprocessing.rst:1093 msgid "Return the number of CPUs in the system." msgstr "" -#: ../../library/multiprocessing.rst:1062 +#: ../../library/multiprocessing.rst:1095 msgid "" "This number is not equivalent to the number of CPUs the current process can " -"use. The number of usable CPUs can be obtained with :func:`os." -"process_cpu_count` (or ``len(os.sched_getaffinity(0))``)." +"use. The number of usable CPUs can be obtained " +"with :func:`os.process_cpu_count` (or ``len(os.sched_getaffinity(0))``)." msgstr "" -#: ../../library/multiprocessing.rst:1066 +#: ../../library/multiprocessing.rst:1099 msgid "" "When the number of CPUs cannot be determined a :exc:`NotImplementedError` is " "raised." msgstr "" -#: ../../library/multiprocessing.rst:1070 +#: ../../library/multiprocessing.rst:1103 msgid ":func:`os.cpu_count` :func:`os.process_cpu_count`" msgstr ":func:`os.cpu_count` :func:`os.process_cpu_count`" -#: ../../library/multiprocessing.rst:1075 +#: ../../library/multiprocessing.rst:1108 msgid "" "The return value can also be overridden using the :option:`-X cpu_count <-" "X>` flag or :envvar:`PYTHON_CPU_COUNT` as this is merely a wrapper around " "the :mod:`os` cpu count APIs." msgstr "" -#: ../../library/multiprocessing.rst:1081 +#: ../../library/multiprocessing.rst:1114 msgid "" "Return the :class:`Process` object corresponding to the current process." msgstr "" -#: ../../library/multiprocessing.rst:1083 +#: ../../library/multiprocessing.rst:1116 msgid "An analogue of :func:`threading.current_thread`." msgstr "" -#: ../../library/multiprocessing.rst:1087 +#: ../../library/multiprocessing.rst:1120 msgid "" "Return the :class:`Process` object corresponding to the parent process of " "the :func:`current_process`. For the main process, ``parent_process`` will " "be ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1095 +#: ../../library/multiprocessing.rst:1128 msgid "" "Add support for when a program which uses :mod:`multiprocessing` has been " "frozen to produce an executable. (Has been tested with **py2exe**, " "**PyInstaller** and **cx_Freeze**.)" msgstr "" -#: ../../library/multiprocessing.rst:1099 +#: ../../library/multiprocessing.rst:1132 msgid "" "One needs to call this function straight after the ``if __name__ == " "'__main__'`` line of the main module. For example::" msgstr "" -#: ../../library/multiprocessing.rst:1102 +#: ../../library/multiprocessing.rst:1135 msgid "" "from multiprocessing import Process, freeze_support\n" "\n" @@ -1710,13 +1760,13 @@ msgstr "" " freeze_support()\n" " Process(target=f).start()" -#: ../../library/multiprocessing.rst:1111 +#: ../../library/multiprocessing.rst:1144 msgid "" "If the ``freeze_support()`` line is omitted then trying to run the frozen " "executable will raise :exc:`RuntimeError`." msgstr "" -#: ../../library/multiprocessing.rst:1114 +#: ../../library/multiprocessing.rst:1147 msgid "" "Calling ``freeze_support()`` has no effect when the start method is not " "*spawn*. In addition, if the module is being run normally by the Python " @@ -1724,21 +1774,21 @@ msgid "" "no effect." msgstr "" -#: ../../library/multiprocessing.rst:1121 +#: ../../library/multiprocessing.rst:1154 msgid "" "Returns a list of the supported start methods, the first of which is the " "default. The possible start methods are ``'fork'``, ``'spawn'`` and " -"``'forkserver'``. Not all platforms support all methods. See :ref:" -"`multiprocessing-start-methods`." +"``'forkserver'``. Not all platforms support all methods. " +"See :ref:`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1130 +#: ../../library/multiprocessing.rst:1163 msgid "" -"Return a context object which has the same attributes as the :mod:" -"`multiprocessing` module." +"Return a context object which has the same attributes as " +"the :mod:`multiprocessing` module." msgstr "" -#: ../../library/multiprocessing.rst:1133 +#: ../../library/multiprocessing.rst:1166 msgid "" "If *method* is ``None`` then the default context is returned. Note that if " "the global start method has not been set, this will set it to the default " @@ -1747,11 +1797,11 @@ msgid "" "is not available. See :ref:`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1144 +#: ../../library/multiprocessing.rst:1177 msgid "Return the name of start method used for starting processes." msgstr "" -#: ../../library/multiprocessing.rst:1146 +#: ../../library/multiprocessing.rst:1179 msgid "" "If the global start method has not been set and *allow_none* is ``False``, " "then the start method is set to the default and the name is returned. If the " @@ -1759,43 +1809,43 @@ msgid "" "returned." msgstr "" -#: ../../library/multiprocessing.rst:1151 +#: ../../library/multiprocessing.rst:1184 msgid "" "The return value can be ``'fork'``, ``'spawn'``, ``'forkserver'`` or " "``None``. See :ref:`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1158 +#: ../../library/multiprocessing.rst:1191 msgid "" "On macOS, the *spawn* start method is now the default. The *fork* start " "method should be considered unsafe as it can lead to crashes of the " "subprocess. See :issue:`33725`." msgstr "" -#: ../../library/multiprocessing.rst:1164 +#: ../../library/multiprocessing.rst:1197 msgid "" "Set the path of the Python interpreter to use when starting a child process. " "(By default :data:`sys.executable` is used). Embedders will probably need " "to do some thing like ::" msgstr "" -#: ../../library/multiprocessing.rst:1168 +#: ../../library/multiprocessing.rst:1201 msgid "set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))" msgstr "set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))" -#: ../../library/multiprocessing.rst:1170 +#: ../../library/multiprocessing.rst:1203 msgid "before they can create child processes." msgstr "" -#: ../../library/multiprocessing.rst:1172 +#: ../../library/multiprocessing.rst:1205 msgid "Now supported on POSIX when the ``'spawn'`` start method is used." msgstr "" -#: ../../library/multiprocessing.rst:1175 +#: ../../library/multiprocessing.rst:1208 msgid "Accepts a :term:`path-like object`." msgstr "接受一個\\ :term:`類路徑物件 `。" -#: ../../library/multiprocessing.rst:1180 +#: ../../library/multiprocessing.rst:1213 msgid "" "Set a list of module names for the forkserver main process to attempt to " "import so that their already imported state is inherited by forked " @@ -1804,143 +1854,143 @@ msgid "" "process." msgstr "" -#: ../../library/multiprocessing.rst:1186 +#: ../../library/multiprocessing.rst:1219 msgid "" "For this to work, it must be called before the forkserver process has been " "launched (before creating a :class:`Pool` or starting a :class:`Process`)." msgstr "" -#: ../../library/multiprocessing.rst:1189 +#: ../../library/multiprocessing.rst:1222 msgid "" -"Only meaningful when using the ``'forkserver'`` start method. See :ref:" -"`multiprocessing-start-methods`." +"Only meaningful when using the ``'forkserver'`` start method. " +"See :ref:`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1196 +#: ../../library/multiprocessing.rst:1229 msgid "" "Set the method which should be used to start child processes. The *method* " -"argument can be ``'fork'``, ``'spawn'`` or ``'forkserver'``. Raises :exc:" -"`RuntimeError` if the start method has already been set and *force* is not " -"``True``. If *method* is ``None`` and *force* is ``True`` then the start " -"method is set to ``None``. If *method* is ``None`` and *force* is ``False`` " -"then the context is set to the default context." +"argument can be ``'fork'``, ``'spawn'`` or ``'forkserver'``. " +"Raises :exc:`RuntimeError` if the start method has already been set and " +"*force* is not ``True``. If *method* is ``None`` and *force* is ``True`` " +"then the start method is set to ``None``. If *method* is ``None`` and " +"*force* is ``False`` then the context is set to the default context." msgstr "" -#: ../../library/multiprocessing.rst:1203 +#: ../../library/multiprocessing.rst:1236 msgid "" "Note that this should be called at most once, and it should be protected " "inside the ``if __name__ == '__main__'`` clause of the main module." msgstr "" -#: ../../library/multiprocessing.rst:1207 +#: ../../library/multiprocessing.rst:1240 msgid "See :ref:`multiprocessing-start-methods`." msgstr "參閱 :ref:`multiprocessing-start-methods`。" -#: ../../library/multiprocessing.rst:1213 +#: ../../library/multiprocessing.rst:1246 msgid "" -":mod:`multiprocessing` contains no analogues of :func:`threading." -"active_count`, :func:`threading.enumerate`, :func:`threading.settrace`, :" -"func:`threading.setprofile`, :class:`threading.Timer`, or :class:`threading." -"local`." +":mod:`multiprocessing` contains no analogues " +"of :func:`threading.active_count`, :func:`threading.enumerate`, :func:`threading.settrace`, :func:`threading.setprofile`, :class:`threading.Timer`, " +"or :class:`threading.local`." msgstr "" -#: ../../library/multiprocessing.rst:1220 +#: ../../library/multiprocessing.rst:1253 msgid "Connection Objects" msgstr "" -#: ../../library/multiprocessing.rst:1224 +#: ../../library/multiprocessing.rst:1257 msgid "" "Connection objects allow the sending and receiving of picklable objects or " "strings. They can be thought of as message oriented connected sockets." msgstr "" -#: ../../library/multiprocessing.rst:1227 +#: ../../library/multiprocessing.rst:1260 msgid "" -"Connection objects are usually created using :func:`Pipe ` -- see also :ref:`multiprocessing-listeners-clients`." +"Connection objects are usually created using :func:`Pipe " +"` -- see also :ref:`multiprocessing-listeners-clients`." msgstr "" -#: ../../library/multiprocessing.rst:1235 +#: ../../library/multiprocessing.rst:1268 msgid "" "Send an object to the other end of the connection which should be read " "using :meth:`recv`." msgstr "" -#: ../../library/multiprocessing.rst:1238 +#: ../../library/multiprocessing.rst:1271 msgid "" "The object must be picklable. Very large pickles (approximately 32 MiB+, " "though it depends on the OS) may raise a :exc:`ValueError` exception." msgstr "" -#: ../../library/multiprocessing.rst:1243 +#: ../../library/multiprocessing.rst:1276 msgid "" -"Return an object sent from the other end of the connection using :meth:" -"`send`. Blocks until there is something to receive. Raises :exc:`EOFError` " -"if there is nothing left to receive and the other end was closed." +"Return an object sent from the other end of the connection " +"using :meth:`send`. Blocks until there is something to receive. " +"Raises :exc:`EOFError` if there is nothing left to receive and the other end " +"was closed." msgstr "" -#: ../../library/multiprocessing.rst:1250 +#: ../../library/multiprocessing.rst:1283 msgid "Return the file descriptor or handle used by the connection." msgstr "" -#: ../../library/multiprocessing.rst:1254 +#: ../../library/multiprocessing.rst:1287 msgid "Close the connection." msgstr "" -#: ../../library/multiprocessing.rst:1256 +#: ../../library/multiprocessing.rst:1289 msgid "This is called automatically when the connection is garbage collected." msgstr "" -#: ../../library/multiprocessing.rst:1260 +#: ../../library/multiprocessing.rst:1293 msgid "Return whether there is any data available to be read." msgstr "" -#: ../../library/multiprocessing.rst:1262 +#: ../../library/multiprocessing.rst:1295 msgid "" "If *timeout* is not specified then it will return immediately. If *timeout* " "is a number then this specifies the maximum time in seconds to block. If " "*timeout* is ``None`` then an infinite timeout is used." msgstr "" -#: ../../library/multiprocessing.rst:1266 +#: ../../library/multiprocessing.rst:1299 msgid "" -"Note that multiple connection objects may be polled at once by using :func:" -"`multiprocessing.connection.wait`." +"Note that multiple connection objects may be polled at once by " +"using :func:`multiprocessing.connection.wait`." msgstr "" -#: ../../library/multiprocessing.rst:1271 +#: ../../library/multiprocessing.rst:1304 msgid "Send byte data from a :term:`bytes-like object` as a complete message." msgstr "" -#: ../../library/multiprocessing.rst:1273 +#: ../../library/multiprocessing.rst:1306 msgid "" "If *offset* is given then data is read from that position in *buffer*. If " "*size* is given then that many bytes will be read from buffer. Very large " -"buffers (approximately 32 MiB+, though it depends on the OS) may raise a :" -"exc:`ValueError` exception" +"buffers (approximately 32 MiB+, though it depends on the OS) may raise " +"a :exc:`ValueError` exception" msgstr "" -#: ../../library/multiprocessing.rst:1280 +#: ../../library/multiprocessing.rst:1313 msgid "" "Return a complete message of byte data sent from the other end of the " -"connection as a string. Blocks until there is something to receive. Raises :" -"exc:`EOFError` if there is nothing left to receive and the other end has " -"closed." +"connection as a string. Blocks until there is something to receive. " +"Raises :exc:`EOFError` if there is nothing left to receive and the other end " +"has closed." msgstr "" -#: ../../library/multiprocessing.rst:1285 +#: ../../library/multiprocessing.rst:1318 msgid "" -"If *maxlength* is specified and the message is longer than *maxlength* then :" -"exc:`OSError` is raised and the connection will no longer be readable." +"If *maxlength* is specified and the message is longer than *maxlength* " +"then :exc:`OSError` is raised and the connection will no longer be readable." msgstr "" -#: ../../library/multiprocessing.rst:1289 +#: ../../library/multiprocessing.rst:1322 msgid "" -"This function used to raise :exc:`IOError`, which is now an alias of :exc:" -"`OSError`." +"This function used to raise :exc:`IOError`, which is now an alias " +"of :exc:`OSError`." msgstr "" -#: ../../library/multiprocessing.rst:1296 +#: ../../library/multiprocessing.rst:1329 msgid "" "Read into *buffer* a complete message of byte data sent from the other end " "of the connection and return the number of bytes in the message. Blocks " @@ -1948,38 +1998,39 @@ msgid "" "nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1302 +#: ../../library/multiprocessing.rst:1335 msgid "" "*buffer* must be a writable :term:`bytes-like object`. If *offset* is given " "then the message will be written into the buffer from that position. Offset " "must be a non-negative integer less than the length of *buffer* (in bytes)." msgstr "" -#: ../../library/multiprocessing.rst:1307 +#: ../../library/multiprocessing.rst:1340 msgid "" "If the buffer is too short then a :exc:`BufferTooShort` exception is raised " "and the complete message is available as ``e.args[0]`` where ``e`` is the " "exception instance." msgstr "" -#: ../../library/multiprocessing.rst:1311 +#: ../../library/multiprocessing.rst:1344 msgid "" "Connection objects themselves can now be transferred between processes " "using :meth:`Connection.send` and :meth:`Connection.recv`." msgstr "" -#: ../../library/multiprocessing.rst:1315 +#: ../../library/multiprocessing.rst:1348 msgid "" -"Connection objects also now support the context management protocol -- see :" -"ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " -"connection object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." +"Connection objects also now support the context management protocol -- " +"see :ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns " +"the connection object, and :meth:`~contextmanager.__exit__` " +"calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:1319 +#: ../../library/multiprocessing.rst:1352 msgid "For example:" msgstr "舉例來說:" -#: ../../library/multiprocessing.rst:1321 +#: ../../library/multiprocessing.rst:1354 msgid "" ">>> from multiprocessing import Pipe\n" ">>> a, b = Pipe()\n" @@ -2015,117 +2066,117 @@ msgstr "" ">>> arr2\n" "array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])" -#: ../../library/multiprocessing.rst:1344 +#: ../../library/multiprocessing.rst:1377 msgid "" "The :meth:`Connection.recv` method automatically unpickles the data it " "receives, which can be a security risk unless you can trust the process " "which sent the message." msgstr "" -#: ../../library/multiprocessing.rst:1348 +#: ../../library/multiprocessing.rst:1381 msgid "" "Therefore, unless the connection object was produced using :func:`Pipe` you " "should only use the :meth:`~Connection.recv` and :meth:`~Connection.send` " -"methods after performing some sort of authentication. See :ref:" -"`multiprocessing-auth-keys`." +"methods after performing some sort of authentication. " +"See :ref:`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:1355 +#: ../../library/multiprocessing.rst:1388 msgid "" "If a process is killed while it is trying to read or write to a pipe then " "the data in the pipe is likely to become corrupted, because it may become " "impossible to be sure where the message boundaries lie." msgstr "" -#: ../../library/multiprocessing.rst:1361 +#: ../../library/multiprocessing.rst:1394 msgid "Synchronization primitives" msgstr "" -#: ../../library/multiprocessing.rst:1365 +#: ../../library/multiprocessing.rst:1398 msgid "" "Generally synchronization primitives are not as necessary in a multiprocess " -"program as they are in a multithreaded program. See the documentation for :" -"mod:`threading` module." +"program as they are in a multithreaded program. See the documentation " +"for :mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:1369 +#: ../../library/multiprocessing.rst:1402 msgid "" "Note that one can also create synchronization primitives by using a manager " "object -- see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:1374 +#: ../../library/multiprocessing.rst:1407 msgid "A barrier object: a clone of :class:`threading.Barrier`." msgstr "" -#: ../../library/multiprocessing.rst:1380 +#: ../../library/multiprocessing.rst:1413 msgid "" -"A bounded semaphore object: a close analog of :class:`threading." -"BoundedSemaphore`." +"A bounded semaphore object: a close analog " +"of :class:`threading.BoundedSemaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1383 -#: ../../library/multiprocessing.rst:1521 +#: ../../library/multiprocessing.rst:1416 +#: ../../library/multiprocessing.rst:1568 msgid "" "A solitary difference from its close analog exists: its ``acquire`` method's " "first argument is named *block*, as is consistent with :meth:`Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1387 +#: ../../library/multiprocessing.rst:1420 msgid "" "On macOS, this is indistinguishable from :class:`Semaphore` because " "``sem_getvalue()`` is not implemented on that platform." msgstr "" -#: ../../library/multiprocessing.rst:1392 +#: ../../library/multiprocessing.rst:1425 msgid "A condition variable: an alias for :class:`threading.Condition`." msgstr "" -#: ../../library/multiprocessing.rst:1394 +#: ../../library/multiprocessing.rst:1427 msgid "" "If *lock* is specified then it should be a :class:`Lock` or :class:`RLock` " "object from :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:1397 -#: ../../library/multiprocessing.rst:1935 +#: ../../library/multiprocessing.rst:1430 +#: ../../library/multiprocessing.rst:1982 msgid "The :meth:`~threading.Condition.wait_for` method was added." msgstr "" -#: ../../library/multiprocessing.rst:1402 +#: ../../library/multiprocessing.rst:1435 msgid "A clone of :class:`threading.Event`." msgstr "" -#: ../../library/multiprocessing.rst:1407 +#: ../../library/multiprocessing.rst:1440 msgid "" "A non-recursive lock object: a close analog of :class:`threading.Lock`. Once " "a process or thread has acquired a lock, subsequent attempts to acquire it " "from any process or thread will block until it is released; any process or " -"thread may release it. The concepts and behaviors of :class:`threading." -"Lock` as it applies to threads are replicated here in :class:" -"`multiprocessing.Lock` as it applies to either processes or threads, except " -"as noted." +"thread may release it. The concepts and behaviors " +"of :class:`threading.Lock` as it applies to threads are replicated here " +"in :class:`multiprocessing.Lock` as it applies to either processes or " +"threads, except as noted." msgstr "" -#: ../../library/multiprocessing.rst:1415 +#: ../../library/multiprocessing.rst:1448 msgid "" "Note that :class:`Lock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.Lock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1419 +#: ../../library/multiprocessing.rst:1452 msgid "" ":class:`Lock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1424 -#: ../../library/multiprocessing.rst:1475 +#: ../../library/multiprocessing.rst:1457 +#: ../../library/multiprocessing.rst:1515 msgid "Acquire a lock, blocking or non-blocking." msgstr "" -#: ../../library/multiprocessing.rst:1426 +#: ../../library/multiprocessing.rst:1459 msgid "" "With the *block* argument set to ``True`` (the default), the method call " "will block until the lock is in an unlocked state, then set it to locked and " @@ -2133,14 +2184,14 @@ msgid "" "that in :meth:`threading.Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1431 +#: ../../library/multiprocessing.rst:1464 msgid "" "With the *block* argument set to ``False``, the method call does not block. " "If the lock is currently in a locked state, return ``False``; otherwise set " "the lock to a locked state and return ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1435 +#: ../../library/multiprocessing.rst:1468 msgid "" "When invoked with a positive, floating-point value for *timeout*, block for " "at most the number of seconds specified by *timeout* as long as the lock can " @@ -2154,19 +2205,24 @@ msgid "" "acquired or ``False`` if the timeout period has elapsed." msgstr "" -#: ../../library/multiprocessing.rst:1450 +#: ../../library/multiprocessing.rst:1483 msgid "" "Release a lock. This can be called from any process or thread, not only the " "process or thread which originally acquired the lock." msgstr "" -#: ../../library/multiprocessing.rst:1453 +#: ../../library/multiprocessing.rst:1486 msgid "" "Behavior is the same as in :meth:`threading.Lock.release` except that when " "invoked on an unlocked lock, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:1459 +#: ../../library/multiprocessing.rst:1492 +#: ../../library/multiprocessing.rst:1559 +msgid "Return a boolean indicating whether this object is locked right now." +msgstr "" + +#: ../../library/multiprocessing.rst:1499 msgid "" "A recursive lock object: a close analog of :class:`threading.RLock`. A " "recursive lock must be released by the process or thread that acquired it. " @@ -2175,20 +2231,20 @@ msgid "" "release it once for each time it has been acquired." msgstr "" -#: ../../library/multiprocessing.rst:1465 +#: ../../library/multiprocessing.rst:1505 msgid "" "Note that :class:`RLock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.RLock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1469 +#: ../../library/multiprocessing.rst:1509 msgid "" ":class:`RLock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1477 +#: ../../library/multiprocessing.rst:1517 msgid "" "When invoked with the *block* argument set to ``True``, block until the lock " "is in an unlocked state (not owned by any process or thread) unless the lock " @@ -2201,7 +2257,7 @@ msgid "" "itself." msgstr "" -#: ../../library/multiprocessing.rst:1487 +#: ../../library/multiprocessing.rst:1527 msgid "" "When invoked with the *block* argument set to ``False``, do not block. If " "the lock has already been acquired (and thus is owned) by another process or " @@ -2212,14 +2268,14 @@ msgid "" "a return value of ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1495 +#: ../../library/multiprocessing.rst:1535 msgid "" -"Use and behaviors of the *timeout* argument are the same as in :meth:`Lock." -"acquire`. Note that some of these behaviors of *timeout* differ from the " -"implemented behaviors in :meth:`threading.RLock.acquire`." +"Use and behaviors of the *timeout* argument are the same as " +"in :meth:`Lock.acquire`. Note that some of these behaviors of *timeout* " +"differ from the implemented behaviors in :meth:`threading.RLock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1502 +#: ../../library/multiprocessing.rst:1542 msgid "" "Release a lock, decrementing the recursion level. If after the decrement " "the recursion level is zero, reset the lock to unlocked (not owned by any " @@ -2229,60 +2285,61 @@ msgid "" "locked and owned by the calling process or thread." msgstr "" -#: ../../library/multiprocessing.rst:1510 +#: ../../library/multiprocessing.rst:1550 msgid "" -"Only call this method when the calling process or thread owns the lock. An :" -"exc:`AssertionError` is raised if this method is called by a process or " +"Only call this method when the calling process or thread owns the lock. " +"An :exc:`AssertionError` is raised if this method is called by a process or " "thread other than the owner or if the lock is in an unlocked (unowned) " "state. Note that the type of exception raised in this situation differs " "from the implemented behavior in :meth:`threading.RLock.release`." msgstr "" -#: ../../library/multiprocessing.rst:1519 +#: ../../library/multiprocessing.rst:1566 msgid "A semaphore object: a close analog of :class:`threading.Semaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1526 +#: ../../library/multiprocessing.rst:1573 msgid "" "On macOS, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with a " "timeout will emulate that function's behavior using a sleeping loop." msgstr "" -#: ../../library/multiprocessing.rst:1531 +#: ../../library/multiprocessing.rst:1578 msgid "" "Some of this package's functionality requires a functioning shared semaphore " -"implementation on the host operating system. Without one, the :mod:" -"`multiprocessing.synchronize` module will be disabled, and attempts to " -"import it will result in an :exc:`ImportError`. See :issue:`3770` for " +"implementation on the host operating system. Without one, " +"the :mod:`multiprocessing.synchronize` module will be disabled, and attempts " +"to import it will result in an :exc:`ImportError`. See :issue:`3770` for " "additional information." msgstr "" -#: ../../library/multiprocessing.rst:1539 +#: ../../library/multiprocessing.rst:1586 msgid "Shared :mod:`ctypes` Objects" msgstr "共享的 :mod:`ctypes` 物件" -#: ../../library/multiprocessing.rst:1541 +#: ../../library/multiprocessing.rst:1588 msgid "" "It is possible to create shared objects using shared memory which can be " "inherited by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1546 +#: ../../library/multiprocessing.rst:1593 msgid "" "Return a :mod:`ctypes` object allocated from shared memory. By default the " "return value is actually a synchronized wrapper for the object. The object " "itself can be accessed via the *value* attribute of a :class:`Value`." msgstr "" -#: ../../library/multiprocessing.rst:1550 -#: ../../library/multiprocessing.rst:1637 +#: ../../library/multiprocessing.rst:1597 +#: ../../library/multiprocessing.rst:1684 msgid "" "*typecode_or_type* determines the type of the returned object: it is either " -"a ctypes type or a one character typecode of the kind used by the :mod:" -"`array` module. *\\*args* is passed on to the constructor for the type." +"a ctypes type or a one character typecode of the kind used by " +"the :mod:`array` module. *\\*args* is passed on to the constructor for the " +"type." msgstr "" -#: ../../library/multiprocessing.rst:1554 +#: ../../library/multiprocessing.rst:1601 msgid "" "If *lock* is ``True`` (the default) then a new recursive lock object is " "created to synchronize access to the value. If *lock* is a :class:`Lock` " @@ -2292,24 +2349,24 @@ msgid "" "\"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1561 +#: ../../library/multiprocessing.rst:1608 msgid "" "Operations like ``+=`` which involve a read and write are not atomic. So " "if, for instance, you want to atomically increment a shared value it is " "insufficient to just do ::" msgstr "" -#: ../../library/multiprocessing.rst:1565 +#: ../../library/multiprocessing.rst:1612 msgid "counter.value += 1" msgstr "counter.value += 1" -#: ../../library/multiprocessing.rst:1567 +#: ../../library/multiprocessing.rst:1614 msgid "" "Assuming the associated lock is recursive (which it is by default) you can " "instead do ::" msgstr "" -#: ../../library/multiprocessing.rst:1570 +#: ../../library/multiprocessing.rst:1617 msgid "" "with counter.get_lock():\n" " counter.value += 1" @@ -2317,19 +2374,19 @@ msgstr "" "with counter.get_lock():\n" " counter.value += 1" -#: ../../library/multiprocessing.rst:1573 -#: ../../library/multiprocessing.rst:1663 -#: ../../library/multiprocessing.rst:1678 +#: ../../library/multiprocessing.rst:1620 +#: ../../library/multiprocessing.rst:1710 +#: ../../library/multiprocessing.rst:1725 msgid "Note that *lock* is a keyword-only argument." msgstr "" -#: ../../library/multiprocessing.rst:1577 +#: ../../library/multiprocessing.rst:1624 msgid "" "Return a ctypes array allocated from shared memory. By default the return " "value is actually a synchronized wrapper for the array." msgstr "" -#: ../../library/multiprocessing.rst:1580 +#: ../../library/multiprocessing.rst:1627 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -2339,38 +2396,38 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1587 +#: ../../library/multiprocessing.rst:1634 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " -"synchronize access to the value. If *lock* is a :class:`Lock` or :class:" -"`RLock` object then that will be used to synchronize access to the value. " -"If *lock* is ``False`` then access to the returned object will not be " -"automatically protected by a lock, so it will not necessarily be \"process-" -"safe\"." +"synchronize access to the value. If *lock* is a :class:`Lock` " +"or :class:`RLock` object then that will be used to synchronize access to the " +"value. If *lock* is ``False`` then access to the returned object will not " +"be automatically protected by a lock, so it will not necessarily be " +"\"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1594 +#: ../../library/multiprocessing.rst:1641 msgid "Note that *lock* is a keyword only argument." msgstr "" -#: ../../library/multiprocessing.rst:1596 +#: ../../library/multiprocessing.rst:1643 msgid "" "Note that an array of :data:`ctypes.c_char` has *value* and *raw* attributes " "which allow one to use it to store and retrieve strings." msgstr "" -#: ../../library/multiprocessing.rst:1601 +#: ../../library/multiprocessing.rst:1648 msgid "The :mod:`multiprocessing.sharedctypes` module" msgstr ":mod:`multiprocessing.sharedctypes` 模組" -#: ../../library/multiprocessing.rst:1606 +#: ../../library/multiprocessing.rst:1653 msgid "" "The :mod:`multiprocessing.sharedctypes` module provides functions for " "allocating :mod:`ctypes` objects from shared memory which can be inherited " "by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1612 +#: ../../library/multiprocessing.rst:1659 msgid "" "Although it is possible to store a pointer in shared memory remember that " "this will refer to a location in the address space of a specific process. " @@ -2379,11 +2436,11 @@ msgid "" "may cause a crash." msgstr "" -#: ../../library/multiprocessing.rst:1620 +#: ../../library/multiprocessing.rst:1667 msgid "Return a ctypes array allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1622 +#: ../../library/multiprocessing.rst:1669 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -2393,156 +2450,156 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1629 +#: ../../library/multiprocessing.rst:1676 msgid "" -"Note that setting and getting an element is potentially non-atomic -- use :" -"func:`Array` instead to make sure that access is automatically synchronized " -"using a lock." +"Note that setting and getting an element is potentially non-atomic -- " +"use :func:`Array` instead to make sure that access is automatically " +"synchronized using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1635 +#: ../../library/multiprocessing.rst:1682 msgid "Return a ctypes object allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1641 +#: ../../library/multiprocessing.rst:1688 msgid "" -"Note that setting and getting the value is potentially non-atomic -- use :" -"func:`Value` instead to make sure that access is automatically synchronized " -"using a lock." +"Note that setting and getting the value is potentially non-atomic -- " +"use :func:`Value` instead to make sure that access is automatically " +"synchronized using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1645 +#: ../../library/multiprocessing.rst:1692 msgid "" "Note that an array of :data:`ctypes.c_char` has ``value`` and ``raw`` " "attributes which allow one to use it to store and retrieve strings -- see " "documentation for :mod:`ctypes`." msgstr "" -#: ../../library/multiprocessing.rst:1651 +#: ../../library/multiprocessing.rst:1698 msgid "" "The same as :func:`RawArray` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "array." msgstr "" -#: ../../library/multiprocessing.rst:1655 -#: ../../library/multiprocessing.rst:1671 +#: ../../library/multiprocessing.rst:1702 +#: ../../library/multiprocessing.rst:1718 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " -"synchronize access to the value. If *lock* is a :class:`~multiprocessing." -"Lock` or :class:`~multiprocessing.RLock` object then that will be used to " -"synchronize access to the value. If *lock* is ``False`` then access to the " -"returned object will not be automatically protected by a lock, so it will " -"not necessarily be \"process-safe\"." +"synchronize access to the value. If *lock* is " +"a :class:`~multiprocessing.Lock` or :class:`~multiprocessing.RLock` object " +"then that will be used to synchronize access to the value. If *lock* is " +"``False`` then access to the returned object will not be automatically " +"protected by a lock, so it will not necessarily be \"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1667 +#: ../../library/multiprocessing.rst:1714 msgid "" "The same as :func:`RawValue` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "object." msgstr "" -#: ../../library/multiprocessing.rst:1682 +#: ../../library/multiprocessing.rst:1729 msgid "" "Return a ctypes object allocated from shared memory which is a copy of the " "ctypes object *obj*." msgstr "" -#: ../../library/multiprocessing.rst:1687 +#: ../../library/multiprocessing.rst:1734 msgid "" "Return a process-safe wrapper object for a ctypes object which uses *lock* " -"to synchronize access. If *lock* is ``None`` (the default) then a :class:" -"`multiprocessing.RLock` object is created automatically." +"to synchronize access. If *lock* is ``None`` (the default) then " +"a :class:`multiprocessing.RLock` object is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1691 +#: ../../library/multiprocessing.rst:1738 msgid "" "A synchronized wrapper will have two methods in addition to those of the " -"object it wraps: :meth:`get_obj` returns the wrapped object and :meth:" -"`get_lock` returns the lock object used for synchronization." +"object it wraps: :meth:`get_obj` returns the wrapped object " +"and :meth:`get_lock` returns the lock object used for synchronization." msgstr "" -#: ../../library/multiprocessing.rst:1695 +#: ../../library/multiprocessing.rst:1742 msgid "" "Note that accessing the ctypes object through the wrapper can be a lot " "slower than accessing the raw ctypes object." msgstr "" -#: ../../library/multiprocessing.rst:1698 +#: ../../library/multiprocessing.rst:1745 msgid "Synchronized objects support the :term:`context manager` protocol." msgstr "" -#: ../../library/multiprocessing.rst:1702 +#: ../../library/multiprocessing.rst:1749 msgid "" "The table below compares the syntax for creating shared ctypes objects from " "shared memory with the normal ctypes syntax. (In the table ``MyStruct`` is " "some subclass of :class:`ctypes.Structure`.)" msgstr "" -#: ../../library/multiprocessing.rst:1707 +#: ../../library/multiprocessing.rst:1754 msgid "ctypes" msgstr "ctypes" -#: ../../library/multiprocessing.rst:1707 +#: ../../library/multiprocessing.rst:1754 msgid "sharedctypes using type" msgstr "" -#: ../../library/multiprocessing.rst:1707 +#: ../../library/multiprocessing.rst:1754 msgid "sharedctypes using typecode" msgstr "" -#: ../../library/multiprocessing.rst:1709 +#: ../../library/multiprocessing.rst:1756 msgid "c_double(2.4)" msgstr "c_double(2.4)" -#: ../../library/multiprocessing.rst:1709 +#: ../../library/multiprocessing.rst:1756 msgid "RawValue(c_double, 2.4)" msgstr "RawValue(c_double, 2.4)" -#: ../../library/multiprocessing.rst:1709 +#: ../../library/multiprocessing.rst:1756 msgid "RawValue('d', 2.4)" msgstr "RawValue('d', 2.4)" -#: ../../library/multiprocessing.rst:1710 +#: ../../library/multiprocessing.rst:1757 msgid "MyStruct(4, 6)" msgstr "MyStruct(4, 6)" -#: ../../library/multiprocessing.rst:1710 +#: ../../library/multiprocessing.rst:1757 msgid "RawValue(MyStruct, 4, 6)" msgstr "RawValue(MyStruct, 4, 6)" -#: ../../library/multiprocessing.rst:1711 +#: ../../library/multiprocessing.rst:1758 msgid "(c_short * 7)()" msgstr "(c_short * 7)()" -#: ../../library/multiprocessing.rst:1711 +#: ../../library/multiprocessing.rst:1758 msgid "RawArray(c_short, 7)" msgstr "RawArray(c_short, 7)" -#: ../../library/multiprocessing.rst:1711 +#: ../../library/multiprocessing.rst:1758 msgid "RawArray('h', 7)" msgstr "RawArray('h', 7)" -#: ../../library/multiprocessing.rst:1712 +#: ../../library/multiprocessing.rst:1759 msgid "(c_int * 3)(9, 2, 8)" msgstr "(c_int * 3)(9, 2, 8)" -#: ../../library/multiprocessing.rst:1712 +#: ../../library/multiprocessing.rst:1759 msgid "RawArray(c_int, (9, 2, 8))" msgstr "RawArray(c_int, (9, 2, 8))" -#: ../../library/multiprocessing.rst:1712 +#: ../../library/multiprocessing.rst:1759 msgid "RawArray('i', (9, 2, 8))" msgstr "RawArray('i', (9, 2, 8))" -#: ../../library/multiprocessing.rst:1716 +#: ../../library/multiprocessing.rst:1763 msgid "" "Below is an example where a number of ctypes objects are modified by a child " "process::" msgstr "" -#: ../../library/multiprocessing.rst:1719 +#: ../../library/multiprocessing.rst:1766 msgid "" "from multiprocessing import Process, Lock\n" "from multiprocessing.sharedctypes import Value, Array\n" @@ -2608,11 +2665,11 @@ msgstr "" " print(s.value)\n" " print([(a.x, a.y) for a in A])" -#: ../../library/multiprocessing.rst:1754 +#: ../../library/multiprocessing.rst:1801 msgid "The results printed are ::" msgstr "" -#: ../../library/multiprocessing.rst:1756 +#: ../../library/multiprocessing.rst:1803 msgid "" "49\n" "0.1111111111111111\n" @@ -2624,11 +2681,11 @@ msgstr "" "HELLO WORLD\n" "[(3.515625, 39.0625), (33.0625, 4.0), (5.640625, 90.25)]" -#: ../../library/multiprocessing.rst:1767 +#: ../../library/multiprocessing.rst:1814 msgid "Managers" msgstr "" -#: ../../library/multiprocessing.rst:1769 +#: ../../library/multiprocessing.rst:1816 msgid "" "Managers provide a way to create data which can be shared between different " "processes, including sharing over a network between processes running on " @@ -2637,7 +2694,7 @@ msgid "" "proxies." msgstr "" -#: ../../library/multiprocessing.rst:1778 +#: ../../library/multiprocessing.rst:1825 msgid "" "Returns a started :class:`~multiprocessing.managers.SyncManager` object " "which can be used for sharing objects between processes. The returned " @@ -2645,31 +2702,31 @@ msgid "" "will create shared objects and return corresponding proxies." msgstr "" -#: ../../library/multiprocessing.rst:1786 +#: ../../library/multiprocessing.rst:1833 msgid "" "Manager processes will be shutdown as soon as they are garbage collected or " -"their parent process exits. The manager classes are defined in the :mod:" -"`multiprocessing.managers` module:" +"their parent process exits. The manager classes are defined in " +"the :mod:`multiprocessing.managers` module:" msgstr "" -#: ../../library/multiprocessing.rst:1792 +#: ../../library/multiprocessing.rst:1839 msgid "Create a BaseManager object." msgstr "建立一個 BaseManager 物件。" -#: ../../library/multiprocessing.rst:1794 +#: ../../library/multiprocessing.rst:1841 msgid "" -"Once created one should call :meth:`start` or ``get_server()." -"serve_forever()`` to ensure that the manager object refers to a started " -"manager process." +"Once created one should call :meth:`start` or " +"``get_server().serve_forever()`` to ensure that the manager object refers to " +"a started manager process." msgstr "" -#: ../../library/multiprocessing.rst:1797 +#: ../../library/multiprocessing.rst:1844 msgid "" "*address* is the address on which the manager process listens for new " "connections. If *address* is ``None`` then an arbitrary one is chosen." msgstr "" -#: ../../library/multiprocessing.rst:1800 +#: ../../library/multiprocessing.rst:1847 msgid "" "*authkey* is the authentication key which will be used to check the validity " "of incoming connections to the server process. If *authkey* is ``None`` " @@ -2677,19 +2734,19 @@ msgid "" "it must be a byte string." msgstr "" -#: ../../library/multiprocessing.rst:1805 +#: ../../library/multiprocessing.rst:1852 msgid "" "*serializer* must be ``'pickle'`` (use :mod:`pickle` serialization) or " "``'xmlrpclib'`` (use :mod:`xmlrpc.client` serialization)." msgstr "" -#: ../../library/multiprocessing.rst:1808 +#: ../../library/multiprocessing.rst:1855 msgid "" -"*ctx* is a context object, or ``None`` (use the current context). See the :" -"func:`get_context` function." +"*ctx* is a context object, or ``None`` (use the current context). See " +"the :func:`get_context` function." msgstr "" -#: ../../library/multiprocessing.rst:1811 +#: ../../library/multiprocessing.rst:1858 msgid "" "*shutdown_timeout* is a timeout in seconds used to wait until the process " "used by the manager completes in the :meth:`shutdown` method. If the " @@ -2697,24 +2754,24 @@ msgid "" "also times out, the process is killed." msgstr "" -#: ../../library/multiprocessing.rst:1816 +#: ../../library/multiprocessing.rst:1863 msgid "Added the *shutdown_timeout* parameter." msgstr "新增 *shutdown_timeout* 參數。" -#: ../../library/multiprocessing.rst:1821 +#: ../../library/multiprocessing.rst:1868 msgid "" "Start a subprocess to start the manager. If *initializer* is not ``None`` " "then the subprocess will call ``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:1826 +#: ../../library/multiprocessing.rst:1873 msgid "" "Returns a :class:`Server` object which represents the actual server under " -"the control of the Manager. The :class:`Server` object supports the :meth:" -"`serve_forever` method::" +"the control of the Manager. The :class:`Server` object supports " +"the :meth:`serve_forever` method::" msgstr "" -#: ../../library/multiprocessing.rst:1830 +#: ../../library/multiprocessing.rst:1877 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> manager = BaseManager(address=('', 50000), authkey=b'abc')\n" @@ -2726,15 +2783,15 @@ msgstr "" ">>> server = manager.get_server()\n" ">>> server.serve_forever()" -#: ../../library/multiprocessing.rst:1835 +#: ../../library/multiprocessing.rst:1882 msgid ":class:`Server` additionally has an :attr:`address` attribute." msgstr "" -#: ../../library/multiprocessing.rst:1839 +#: ../../library/multiprocessing.rst:1886 msgid "Connect a local manager object to a remote manager process::" msgstr "" -#: ../../library/multiprocessing.rst:1841 +#: ../../library/multiprocessing.rst:1888 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n" @@ -2744,29 +2801,29 @@ msgstr "" ">>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n" ">>> m.connect()" -#: ../../library/multiprocessing.rst:1847 +#: ../../library/multiprocessing.rst:1894 msgid "" -"Stop the process used by the manager. This is only available if :meth:" -"`start` has been used to start the server process." +"Stop the process used by the manager. This is only available " +"if :meth:`start` has been used to start the server process." msgstr "" -#: ../../library/multiprocessing.rst:1850 +#: ../../library/multiprocessing.rst:1897 msgid "This can be called multiple times." msgstr "" -#: ../../library/multiprocessing.rst:1854 +#: ../../library/multiprocessing.rst:1901 msgid "" "A classmethod which can be used for registering a type or callable with the " "manager class." msgstr "" -#: ../../library/multiprocessing.rst:1857 +#: ../../library/multiprocessing.rst:1904 msgid "" "*typeid* is a \"type identifier\" which is used to identify a particular " "type of shared object. This must be a string." msgstr "" -#: ../../library/multiprocessing.rst:1860 +#: ../../library/multiprocessing.rst:1907 msgid "" "*callable* is a callable used for creating objects for this type " "identifier. If a manager instance will be connected to the server using " @@ -2774,172 +2831,181 @@ msgid "" "then this can be left as ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1866 +#: ../../library/multiprocessing.rst:1913 msgid "" "*proxytype* is a subclass of :class:`BaseProxy` which is used to create " "proxies for shared objects with this *typeid*. If ``None`` then a proxy " "class is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1870 +#: ../../library/multiprocessing.rst:1917 msgid "" "*exposed* is used to specify a sequence of method names which proxies for " -"this typeid should be allowed to access using :meth:`BaseProxy." -"_callmethod`. (If *exposed* is ``None`` then :attr:`proxytype._exposed_` is " -"used instead if it exists.) In the case where no exposed list is specified, " -"all \"public methods\" of the shared object will be accessible. (Here a " -"\"public method\" means any attribute which has a :meth:`~object.__call__` " -"method and whose name does not begin with ``'_'``.)" +"this typeid should be allowed to access " +"using :meth:`BaseProxy._callmethod`. (If *exposed* is ``None`` " +"then :attr:`proxytype._exposed_` is used instead if it exists.) In the case " +"where no exposed list is specified, all \"public methods\" of the shared " +"object will be accessible. (Here a \"public method\" means any attribute " +"which has a :meth:`~object.__call__` method and whose name does not begin " +"with ``'_'``.)" msgstr "" -#: ../../library/multiprocessing.rst:1879 +#: ../../library/multiprocessing.rst:1926 msgid "" "*method_to_typeid* is a mapping used to specify the return type of those " "exposed methods which should return a proxy. It maps method names to typeid " -"strings. (If *method_to_typeid* is ``None`` then :attr:`proxytype." -"_method_to_typeid_` is used instead if it exists.) If a method's name is " -"not a key of this mapping or if the mapping is ``None`` then the object " -"returned by the method will be copied by value." +"strings. (If *method_to_typeid* is ``None`` " +"then :attr:`proxytype._method_to_typeid_` is used instead if it exists.) If " +"a method's name is not a key of this mapping or if the mapping is ``None`` " +"then the object returned by the method will be copied by value." msgstr "" -#: ../../library/multiprocessing.rst:1886 +#: ../../library/multiprocessing.rst:1933 msgid "" "*create_method* determines whether a method should be created with name " "*typeid* which can be used to tell the server process to create a new shared " "object and return a proxy for it. By default it is ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1890 +#: ../../library/multiprocessing.rst:1937 msgid ":class:`BaseManager` instances also have one read-only property:" msgstr "" -#: ../../library/multiprocessing.rst:1894 +#: ../../library/multiprocessing.rst:1941 msgid "The address used by the manager." msgstr "" -#: ../../library/multiprocessing.rst:1896 +#: ../../library/multiprocessing.rst:1943 msgid "" -"Manager objects support the context management protocol -- see :ref:" -"`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the server " -"process (if it has not already started) and then returns the manager " +"Manager objects support the context management protocol -- " +"see :ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the " +"server process (if it has not already started) and then returns the manager " "object. :meth:`~contextmanager.__exit__` calls :meth:`shutdown`." msgstr "" -#: ../../library/multiprocessing.rst:1902 +#: ../../library/multiprocessing.rst:1949 msgid "" "In previous versions :meth:`~contextmanager.__enter__` did not start the " "manager's server process if it was not already started." msgstr "" -#: ../../library/multiprocessing.rst:1907 +#: ../../library/multiprocessing.rst:1954 msgid "" "A subclass of :class:`BaseManager` which can be used for the synchronization " -"of processes. Objects of this type are returned by :func:`multiprocessing." -"Manager`." +"of processes. Objects of this type are returned " +"by :func:`multiprocessing.Manager`." msgstr "" -#: ../../library/multiprocessing.rst:1911 +#: ../../library/multiprocessing.rst:1958 msgid "" "Its methods create and return :ref:`multiprocessing-proxy_objects` for a " "number of commonly used data types to be synchronized across processes. This " "notably includes shared lists and dictionaries." msgstr "" -#: ../../library/multiprocessing.rst:1917 +#: ../../library/multiprocessing.rst:1964 msgid "" "Create a shared :class:`threading.Barrier` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1924 +#: ../../library/multiprocessing.rst:1971 msgid "" "Create a shared :class:`threading.BoundedSemaphore` object and return a " "proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1929 +#: ../../library/multiprocessing.rst:1976 msgid "" "Create a shared :class:`threading.Condition` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1932 +#: ../../library/multiprocessing.rst:1979 msgid "" -"If *lock* is supplied then it should be a proxy for a :class:`threading." -"Lock` or :class:`threading.RLock` object." +"If *lock* is supplied then it should be a proxy for " +"a :class:`threading.Lock` or :class:`threading.RLock` object." msgstr "" -#: ../../library/multiprocessing.rst:1940 +#: ../../library/multiprocessing.rst:1987 msgid "" "Create a shared :class:`threading.Event` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1944 +#: ../../library/multiprocessing.rst:1991 msgid "" "Create a shared :class:`threading.Lock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1948 +#: ../../library/multiprocessing.rst:1995 msgid "Create a shared :class:`Namespace` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1952 +#: ../../library/multiprocessing.rst:1999 msgid "Create a shared :class:`queue.Queue` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1956 +#: ../../library/multiprocessing.rst:2003 msgid "" "Create a shared :class:`threading.RLock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1960 +#: ../../library/multiprocessing.rst:2007 msgid "" "Create a shared :class:`threading.Semaphore` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1965 +#: ../../library/multiprocessing.rst:2012 msgid "Create an array and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1969 +#: ../../library/multiprocessing.rst:2016 msgid "" "Create an object with a writable ``value`` attribute and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1976 +#: ../../library/multiprocessing.rst:2023 msgid "Create a shared :class:`dict` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1981 +#: ../../library/multiprocessing.rst:2028 msgid "Create a shared :class:`list` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1983 +#: ../../library/multiprocessing.rst:2034 +msgid "Create a shared :class:`set` object and return a proxy for it." +msgstr "" + +#: ../../library/multiprocessing.rst:2036 +msgid ":class:`set` support was added." +msgstr "" + +#: ../../library/multiprocessing.rst:2039 msgid "" "Shared objects are capable of being nested. For example, a shared container " "object such as a shared list can contain other shared objects which will all " "be managed and synchronized by the :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1990 +#: ../../library/multiprocessing.rst:2046 msgid "A type that can register with :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1992 +#: ../../library/multiprocessing.rst:2048 msgid "" "A namespace object has no public methods, but does have writable attributes. " "Its representation shows the values of its attributes." msgstr "" -#: ../../library/multiprocessing.rst:1995 +#: ../../library/multiprocessing.rst:2051 msgid "" "However, when using a proxy for a namespace object, an attribute beginning " "with ``'_'`` will be an attribute of the proxy and not an attribute of the " "referent:" msgstr "" -#: ../../library/multiprocessing.rst:1999 +#: ../../library/multiprocessing.rst:2055 msgid "" ">>> mp_context = multiprocessing.get_context('spawn')\n" ">>> manager = mp_context.Manager()\n" @@ -2951,18 +3017,18 @@ msgid "" "Namespace(x=10, y='hello')" msgstr "" -#: ../../library/multiprocessing.rst:2012 +#: ../../library/multiprocessing.rst:2068 msgid "Customized managers" msgstr "" -#: ../../library/multiprocessing.rst:2014 +#: ../../library/multiprocessing.rst:2070 msgid "" "To create one's own manager, one creates a subclass of :class:`BaseManager` " "and uses the :meth:`~BaseManager.register` classmethod to register new types " "or callables with the manager class. For example::" msgstr "" -#: ../../library/multiprocessing.rst:2018 +#: ../../library/multiprocessing.rst:2074 msgid "" "from multiprocessing.managers import BaseManager\n" "\n" @@ -3002,23 +3068,23 @@ msgstr "" " print(maths.add(4, 3)) # 印出 7\n" " print(maths.mul(7, 8)) # 印出 56" -#: ../../library/multiprocessing.rst:2039 +#: ../../library/multiprocessing.rst:2095 msgid "Using a remote manager" msgstr "" -#: ../../library/multiprocessing.rst:2041 +#: ../../library/multiprocessing.rst:2097 msgid "" "It is possible to run a manager server on one machine and have clients use " "it from other machines (assuming that the firewalls involved allow it)." msgstr "" -#: ../../library/multiprocessing.rst:2044 +#: ../../library/multiprocessing.rst:2100 msgid "" "Running the following commands creates a server for a single shared queue " "which remote clients can access::" msgstr "" -#: ../../library/multiprocessing.rst:2047 +#: ../../library/multiprocessing.rst:2103 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> from queue import Queue\n" @@ -3038,11 +3104,11 @@ msgstr "" ">>> s = m.get_server()\n" ">>> s.serve_forever()" -#: ../../library/multiprocessing.rst:2056 +#: ../../library/multiprocessing.rst:2112 msgid "One client can access the server as follows::" msgstr "" -#: ../../library/multiprocessing.rst:2058 +#: ../../library/multiprocessing.rst:2114 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> class QueueManager(BaseManager): pass\n" @@ -3062,11 +3128,11 @@ msgstr "" ">>> queue = m.get_queue()\n" ">>> queue.put('hello')" -#: ../../library/multiprocessing.rst:2066 +#: ../../library/multiprocessing.rst:2122 msgid "Another client can also use it::" msgstr "" -#: ../../library/multiprocessing.rst:2068 +#: ../../library/multiprocessing.rst:2124 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> class QueueManager(BaseManager): pass\n" @@ -3088,13 +3154,13 @@ msgstr "" ">>> queue.get()\n" "'hello'" -#: ../../library/multiprocessing.rst:2077 +#: ../../library/multiprocessing.rst:2133 msgid "" "Local processes can also access that queue, using the code from above on the " "client to access it remotely::" msgstr "" -#: ../../library/multiprocessing.rst:2080 +#: ../../library/multiprocessing.rst:2136 msgid "" ">>> from multiprocessing import Process, Queue\n" ">>> from multiprocessing.managers import BaseManager\n" @@ -3134,18 +3200,18 @@ msgstr "" ">>> s = m.get_server()\n" ">>> s.serve_forever()" -#: ../../library/multiprocessing.rst:2102 +#: ../../library/multiprocessing.rst:2158 msgid "Proxy Objects" msgstr "" -#: ../../library/multiprocessing.rst:2104 +#: ../../library/multiprocessing.rst:2160 msgid "" "A proxy is an object which *refers* to a shared object which lives " "(presumably) in a different process. The shared object is said to be the " "*referent* of the proxy. Multiple proxy objects may have the same referent." msgstr "" -#: ../../library/multiprocessing.rst:2108 +#: ../../library/multiprocessing.rst:2164 msgid "" "A proxy object has methods which invoke corresponding methods of its " "referent (although not every method of the referent will necessarily be " @@ -3153,7 +3219,7 @@ msgid "" "its referent can:" msgstr "" -#: ../../library/multiprocessing.rst:2112 +#: ../../library/multiprocessing.rst:2168 msgid "" ">>> mp_context = multiprocessing.get_context('spawn')\n" ">>> manager = mp_context.Manager()\n" @@ -3179,22 +3245,22 @@ msgstr "" ">>> l[2:5]\n" "[4, 9, 16]" -#: ../../library/multiprocessing.rst:2126 +#: ../../library/multiprocessing.rst:2182 msgid "" "Notice that applying :func:`str` to a proxy will return the representation " "of the referent, whereas applying :func:`repr` will return the " "representation of the proxy." msgstr "" -#: ../../library/multiprocessing.rst:2130 +#: ../../library/multiprocessing.rst:2186 msgid "" "An important feature of proxy objects is that they are picklable so they can " -"be passed between processes. As such, a referent can contain :ref:" -"`multiprocessing-proxy_objects`. This permits nesting of these managed " -"lists, dicts, and other :ref:`multiprocessing-proxy_objects`:" +"be passed between processes. As such, a referent can " +"contain :ref:`multiprocessing-proxy_objects`. This permits nesting of these " +"managed lists, dicts, and other :ref:`multiprocessing-proxy_objects`:" msgstr "" -#: ../../library/multiprocessing.rst:2135 +#: ../../library/multiprocessing.rst:2191 msgid "" ">>> a = manager.list()\n" ">>> b = manager.list()\n" @@ -3206,11 +3272,11 @@ msgid "" "['hello'] ['hello']" msgstr "" -#: ../../library/multiprocessing.rst:2146 +#: ../../library/multiprocessing.rst:2202 msgid "Similarly, dict and list proxies may be nested inside one another::" msgstr "" -#: ../../library/multiprocessing.rst:2148 +#: ../../library/multiprocessing.rst:2204 msgid "" ">>> l_outer = manager.list([ manager.dict() for i in range(2) ])\n" ">>> d_first_inner = l_outer[0]\n" @@ -3234,7 +3300,7 @@ msgstr "" ">>> print(l_outer[1])\n" "{'c': 3, 'z': 26}" -#: ../../library/multiprocessing.rst:2159 +#: ../../library/multiprocessing.rst:2215 msgid "" "If standard (non-proxy) :class:`list` or :class:`dict` objects are contained " "in a referent, modifications to those mutable values will not be propagated " @@ -3245,7 +3311,7 @@ msgid "" "assign the modified value to the container proxy::" msgstr "" -#: ../../library/multiprocessing.rst:2167 +#: ../../library/multiprocessing.rst:2223 msgid "" "# create a list proxy and append a mutable object (a dictionary)\n" "lproxy = manager.list()\n" @@ -3259,20 +3325,20 @@ msgid "" "lproxy[0] = d" msgstr "" -#: ../../library/multiprocessing.rst:2178 +#: ../../library/multiprocessing.rst:2234 msgid "" -"This approach is perhaps less convenient than employing nested :ref:" -"`multiprocessing-proxy_objects` for most use cases but also demonstrates a " -"level of control over the synchronization." +"This approach is perhaps less convenient than employing " +"nested :ref:`multiprocessing-proxy_objects` for most use cases but also " +"demonstrates a level of control over the synchronization." msgstr "" -#: ../../library/multiprocessing.rst:2184 +#: ../../library/multiprocessing.rst:2240 msgid "" "The proxy types in :mod:`multiprocessing` do nothing to support comparisons " "by value. So, for instance, we have:" msgstr "" -#: ../../library/multiprocessing.rst:2187 +#: ../../library/multiprocessing.rst:2243 msgid "" ">>> manager.list([1,2,3]) == [1,2,3]\n" "False" @@ -3280,66 +3346,66 @@ msgstr "" ">>> manager.list([1,2,3]) == [1,2,3]\n" "False" -#: ../../library/multiprocessing.rst:2192 +#: ../../library/multiprocessing.rst:2248 msgid "" "One should just use a copy of the referent instead when making comparisons." msgstr "" -#: ../../library/multiprocessing.rst:2196 +#: ../../library/multiprocessing.rst:2252 msgid "Proxy objects are instances of subclasses of :class:`BaseProxy`." msgstr "" -#: ../../library/multiprocessing.rst:2200 +#: ../../library/multiprocessing.rst:2256 msgid "Call and return the result of a method of the proxy's referent." msgstr "" -#: ../../library/multiprocessing.rst:2202 +#: ../../library/multiprocessing.rst:2258 msgid "" "If ``proxy`` is a proxy whose referent is ``obj`` then the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2204 +#: ../../library/multiprocessing.rst:2260 msgid "proxy._callmethod(methodname, args, kwds)" msgstr "proxy._callmethod(methodname, args, kwds)" -#: ../../library/multiprocessing.rst:2206 +#: ../../library/multiprocessing.rst:2262 msgid "will evaluate the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2208 +#: ../../library/multiprocessing.rst:2264 msgid "getattr(obj, methodname)(*args, **kwds)" msgstr "getattr(obj, methodname)(*args, **kwds)" -#: ../../library/multiprocessing.rst:2210 +#: ../../library/multiprocessing.rst:2266 msgid "in the manager's process." msgstr "" -#: ../../library/multiprocessing.rst:2212 +#: ../../library/multiprocessing.rst:2268 msgid "" "The returned value will be a copy of the result of the call or a proxy to a " "new shared object -- see documentation for the *method_to_typeid* argument " "of :meth:`BaseManager.register`." msgstr "" -#: ../../library/multiprocessing.rst:2216 +#: ../../library/multiprocessing.rst:2272 msgid "" -"If an exception is raised by the call, then is re-raised by :meth:" -"`_callmethod`. If some other exception is raised in the manager's process " -"then this is converted into a :exc:`RemoteError` exception and is raised by :" -"meth:`_callmethod`." +"If an exception is raised by the call, then is re-raised " +"by :meth:`_callmethod`. If some other exception is raised in the manager's " +"process then this is converted into a :exc:`RemoteError` exception and is " +"raised by :meth:`_callmethod`." msgstr "" -#: ../../library/multiprocessing.rst:2221 +#: ../../library/multiprocessing.rst:2277 msgid "" "Note in particular that an exception will be raised if *methodname* has not " "been *exposed*." msgstr "" -#: ../../library/multiprocessing.rst:2224 +#: ../../library/multiprocessing.rst:2280 msgid "An example of the usage of :meth:`_callmethod`:" msgstr "" -#: ../../library/multiprocessing.rst:2226 +#: ../../library/multiprocessing.rst:2282 msgid "" ">>> l = manager.list(range(10))\n" ">>> l._callmethod('__len__')\n" @@ -3361,69 +3427,69 @@ msgstr "" "...\n" "IndexError: list index out of range" -#: ../../library/multiprocessing.rst:2240 +#: ../../library/multiprocessing.rst:2296 msgid "Return a copy of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2242 +#: ../../library/multiprocessing.rst:2298 msgid "If the referent is unpicklable then this will raise an exception." msgstr "" -#: ../../library/multiprocessing.rst:2246 +#: ../../library/multiprocessing.rst:2302 msgid "Return a representation of the proxy object." msgstr "" -#: ../../library/multiprocessing.rst:2250 +#: ../../library/multiprocessing.rst:2306 msgid "Return the representation of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2254 +#: ../../library/multiprocessing.rst:2310 msgid "Cleanup" msgstr "" -#: ../../library/multiprocessing.rst:2256 +#: ../../library/multiprocessing.rst:2312 msgid "" "A proxy object uses a weakref callback so that when it gets garbage " "collected it deregisters itself from the manager which owns its referent." msgstr "" -#: ../../library/multiprocessing.rst:2259 +#: ../../library/multiprocessing.rst:2315 msgid "" "A shared object gets deleted from the manager process when there are no " "longer any proxies referring to it." msgstr "" -#: ../../library/multiprocessing.rst:2264 +#: ../../library/multiprocessing.rst:2320 msgid "Process Pools" msgstr "" -#: ../../library/multiprocessing.rst:2269 +#: ../../library/multiprocessing.rst:2325 msgid "" "One can create a pool of processes which will carry out tasks submitted to " "it with the :class:`Pool` class." msgstr "" -#: ../../library/multiprocessing.rst:2274 +#: ../../library/multiprocessing.rst:2330 msgid "" "A process pool object which controls a pool of worker processes to which " "jobs can be submitted. It supports asynchronous results with timeouts and " "callbacks and has a parallel map implementation." msgstr "" -#: ../../library/multiprocessing.rst:2278 +#: ../../library/multiprocessing.rst:2334 msgid "" "*processes* is the number of worker processes to use. If *processes* is " "``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2281 -#: ../../library/multiprocessing.rst:2845 +#: ../../library/multiprocessing.rst:2337 +#: ../../library/multiprocessing.rst:2901 msgid "" "If *initializer* is not ``None`` then each worker process will call " "``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:2284 +#: ../../library/multiprocessing.rst:2340 msgid "" "*maxtasksperchild* is the number of tasks a worker process can complete " "before it will exit and be replaced with a fresh worker process, to enable " @@ -3431,21 +3497,21 @@ msgid "" "which means worker processes will live as long as the pool." msgstr "" -#: ../../library/multiprocessing.rst:2289 +#: ../../library/multiprocessing.rst:2345 msgid "" "*context* can be used to specify the context used for starting the worker " -"processes. Usually a pool is created using the function :func:" -"`multiprocessing.Pool` or the :meth:`Pool` method of a context object. In " -"both cases *context* is set appropriately." +"processes. Usually a pool is created using the " +"function :func:`multiprocessing.Pool` or the :meth:`Pool` method of a " +"context object. In both cases *context* is set appropriately." msgstr "" -#: ../../library/multiprocessing.rst:2295 +#: ../../library/multiprocessing.rst:2351 msgid "" "Note that the methods of the pool object should only be called by the " "process which created the pool." msgstr "" -#: ../../library/multiprocessing.rst:2299 +#: ../../library/multiprocessing.rst:2355 msgid "" ":class:`multiprocessing.pool` objects have internal resources that need to " "be properly managed (like any other resource) by using the pool as a context " @@ -3453,28 +3519,28 @@ msgid "" "to do this can lead to the process hanging on finalization." msgstr "" -#: ../../library/multiprocessing.rst:2304 +#: ../../library/multiprocessing.rst:2360 msgid "" "Note that it is **not correct** to rely on the garbage collector to destroy " "the pool as CPython does not assure that the finalizer of the pool will be " "called (see :meth:`object.__del__` for more information)." msgstr "" -#: ../../library/multiprocessing.rst:2308 +#: ../../library/multiprocessing.rst:2364 msgid "Added the *maxtasksperchild* parameter." msgstr "新增 *maxtasksperchild* 參數。" -#: ../../library/multiprocessing.rst:2311 +#: ../../library/multiprocessing.rst:2367 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" -#: ../../library/multiprocessing.rst:2314 +#: ../../library/multiprocessing.rst:2370 msgid "" -"*processes* uses :func:`os.process_cpu_count` by default, instead of :func:" -"`os.cpu_count`." +"*processes* uses :func:`os.process_cpu_count` by default, instead " +"of :func:`os.cpu_count`." msgstr "" -#: ../../library/multiprocessing.rst:2320 +#: ../../library/multiprocessing.rst:2376 msgid "" "Worker processes within a :class:`Pool` typically live for the complete " "duration of the Pool's work queue. A frequent pattern found in other systems " @@ -3485,7 +3551,7 @@ msgid "" "ability to the end user." msgstr "" -#: ../../library/multiprocessing.rst:2330 +#: ../../library/multiprocessing.rst:2386 msgid "" "Call *func* with arguments *args* and keyword arguments *kwds*. It blocks " "until the result is ready. Given this blocks, :meth:`apply_async` is better " @@ -3493,14 +3559,14 @@ msgid "" "executed in one of the workers of the pool." msgstr "" -#: ../../library/multiprocessing.rst:2337 +#: ../../library/multiprocessing.rst:2393 msgid "" -"A variant of the :meth:`apply` method which returns a :class:" -"`~multiprocessing.pool.AsyncResult` object." +"A variant of the :meth:`apply` method which returns " +"a :class:`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2340 -#: ../../library/multiprocessing.rst:2371 +#: ../../library/multiprocessing.rst:2396 +#: ../../library/multiprocessing.rst:2427 msgid "" "If *callback* is specified then it should be a callable which accepts a " "single argument. When the result becomes ready *callback* is applied to it, " @@ -3508,60 +3574,60 @@ msgid "" "applied instead." msgstr "" -#: ../../library/multiprocessing.rst:2345 -#: ../../library/multiprocessing.rst:2376 +#: ../../library/multiprocessing.rst:2401 +#: ../../library/multiprocessing.rst:2432 msgid "" "If *error_callback* is specified then it should be a callable which accepts " "a single argument. If the target function fails, then the *error_callback* " "is called with the exception instance." msgstr "" -#: ../../library/multiprocessing.rst:2349 -#: ../../library/multiprocessing.rst:2380 +#: ../../library/multiprocessing.rst:2405 +#: ../../library/multiprocessing.rst:2436 msgid "" "Callbacks should complete immediately since otherwise the thread which " "handles the results will get blocked." msgstr "" -#: ../../library/multiprocessing.rst:2354 +#: ../../library/multiprocessing.rst:2410 msgid "" "A parallel equivalent of the :func:`map` built-in function (it supports only " "one *iterable* argument though, for multiple iterables see :meth:`starmap`). " "It blocks until the result is ready." msgstr "" -#: ../../library/multiprocessing.rst:2358 +#: ../../library/multiprocessing.rst:2414 msgid "" "This method chops the iterable into a number of chunks which it submits to " "the process pool as separate tasks. The (approximate) size of these chunks " "can be specified by setting *chunksize* to a positive integer." msgstr "" -#: ../../library/multiprocessing.rst:2362 +#: ../../library/multiprocessing.rst:2418 msgid "" "Note that it may cause high memory usage for very long iterables. Consider " "using :meth:`imap` or :meth:`imap_unordered` with explicit *chunksize* " "option for better efficiency." msgstr "" -#: ../../library/multiprocessing.rst:2368 +#: ../../library/multiprocessing.rst:2424 msgid "" -"A variant of the :meth:`.map` method which returns a :class:" -"`~multiprocessing.pool.AsyncResult` object." +"A variant of the :meth:`.map` method which returns " +"a :class:`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2385 +#: ../../library/multiprocessing.rst:2441 msgid "A lazier version of :meth:`.map`." msgstr "" -#: ../../library/multiprocessing.rst:2387 +#: ../../library/multiprocessing.rst:2443 msgid "" "The *chunksize* argument is the same as the one used by the :meth:`.map` " "method. For very long iterables using a large value for *chunksize* can " "make the job complete **much** faster than using the default value of ``1``." msgstr "" -#: ../../library/multiprocessing.rst:2392 +#: ../../library/multiprocessing.rst:2448 msgid "" "Also if *chunksize* is ``1`` then the :meth:`!next` method of the iterator " "returned by the :meth:`imap` method has an optional *timeout* parameter: " @@ -3569,97 +3635,98 @@ msgid "" "result cannot be returned within *timeout* seconds." msgstr "" -#: ../../library/multiprocessing.rst:2399 +#: ../../library/multiprocessing.rst:2455 msgid "" "The same as :meth:`imap` except that the ordering of the results from the " "returned iterator should be considered arbitrary. (Only when there is only " "one worker process is the order guaranteed to be \"correct\".)" msgstr "" -#: ../../library/multiprocessing.rst:2405 +#: ../../library/multiprocessing.rst:2461 msgid "" "Like :meth:`~multiprocessing.pool.Pool.map` except that the elements of the " "*iterable* are expected to be iterables that are unpacked as arguments." msgstr "" -#: ../../library/multiprocessing.rst:2409 +#: ../../library/multiprocessing.rst:2465 msgid "" "Hence an *iterable* of ``[(1,2), (3, 4)]`` results in ``[func(1,2), " "func(3,4)]``." msgstr "" -#: ../../library/multiprocessing.rst:2416 +#: ../../library/multiprocessing.rst:2472 msgid "" "A combination of :meth:`starmap` and :meth:`map_async` that iterates over " "*iterable* of iterables and calls *func* with the iterables unpacked. " "Returns a result object." msgstr "" -#: ../../library/multiprocessing.rst:2424 +#: ../../library/multiprocessing.rst:2480 msgid "" "Prevents any more tasks from being submitted to the pool. Once all the " "tasks have been completed the worker processes will exit." msgstr "" -#: ../../library/multiprocessing.rst:2429 +#: ../../library/multiprocessing.rst:2485 msgid "" "Stops the worker processes immediately without completing outstanding work. " "When the pool object is garbage collected :meth:`terminate` will be called " "immediately." msgstr "" -#: ../../library/multiprocessing.rst:2435 +#: ../../library/multiprocessing.rst:2491 msgid "" -"Wait for the worker processes to exit. One must call :meth:`close` or :meth:" -"`terminate` before using :meth:`join`." +"Wait for the worker processes to exit. One must call :meth:`close` " +"or :meth:`terminate` before using :meth:`join`." msgstr "" -#: ../../library/multiprocessing.rst:2438 +#: ../../library/multiprocessing.rst:2494 msgid "" -"Pool objects now support the context management protocol -- see :ref:" -"`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the pool " -"object, and :meth:`~contextmanager.__exit__` calls :meth:`terminate`." +"Pool objects now support the context management protocol -- " +"see :ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns " +"the pool object, and :meth:`~contextmanager.__exit__` " +"calls :meth:`terminate`." msgstr "" -#: ../../library/multiprocessing.rst:2446 +#: ../../library/multiprocessing.rst:2502 msgid "" -"The class of the result returned by :meth:`Pool.apply_async` and :meth:`Pool." -"map_async`." +"The class of the result returned by :meth:`Pool.apply_async` " +"and :meth:`Pool.map_async`." msgstr "" -#: ../../library/multiprocessing.rst:2451 +#: ../../library/multiprocessing.rst:2507 msgid "" "Return the result when it arrives. If *timeout* is not ``None`` and the " -"result does not arrive within *timeout* seconds then :exc:`multiprocessing." -"TimeoutError` is raised. If the remote call raised an exception then that " -"exception will be reraised by :meth:`get`." +"result does not arrive within *timeout* seconds " +"then :exc:`multiprocessing.TimeoutError` is raised. If the remote call " +"raised an exception then that exception will be reraised by :meth:`get`." msgstr "" -#: ../../library/multiprocessing.rst:2458 +#: ../../library/multiprocessing.rst:2514 msgid "Wait until the result is available or until *timeout* seconds pass." msgstr "" -#: ../../library/multiprocessing.rst:2462 +#: ../../library/multiprocessing.rst:2518 msgid "Return whether the call has completed." msgstr "" -#: ../../library/multiprocessing.rst:2466 +#: ../../library/multiprocessing.rst:2522 msgid "" -"Return whether the call completed without raising an exception. Will raise :" -"exc:`ValueError` if the result is not ready." +"Return whether the call completed without raising an exception. Will " +"raise :exc:`ValueError` if the result is not ready." msgstr "" -#: ../../library/multiprocessing.rst:2469 +#: ../../library/multiprocessing.rst:2525 msgid "" -"If the result is not ready, :exc:`ValueError` is raised instead of :exc:" -"`AssertionError`." +"If the result is not ready, :exc:`ValueError` is raised instead " +"of :exc:`AssertionError`." msgstr "" -#: ../../library/multiprocessing.rst:2473 +#: ../../library/multiprocessing.rst:2529 msgid "The following example demonstrates the use of a pool::" msgstr "" -#: ../../library/multiprocessing.rst:2475 +#: ../../library/multiprocessing.rst:2531 msgid "" "from multiprocessing import Pool\n" "import time\n" @@ -3683,21 +3750,21 @@ msgid "" "computer is *very* slow\n" "\n" " result = pool.apply_async(time.sleep, (10,))\n" -" print(result.get(timeout=1)) # raises multiprocessing." -"TimeoutError" +" print(result.get(timeout=1)) # raises " +"multiprocessing.TimeoutError" msgstr "" -#: ../../library/multiprocessing.rst:2500 +#: ../../library/multiprocessing.rst:2556 msgid "Listeners and Clients" msgstr "" -#: ../../library/multiprocessing.rst:2505 +#: ../../library/multiprocessing.rst:2561 msgid "" -"Usually message passing between processes is done using queues or by using :" -"class:`~Connection` objects returned by :func:`~multiprocessing.Pipe`." +"Usually message passing between processes is done using queues or by " +"using :class:`~Connection` objects returned by :func:`~multiprocessing.Pipe`." msgstr "" -#: ../../library/multiprocessing.rst:2509 +#: ../../library/multiprocessing.rst:2565 msgid "" "However, the :mod:`multiprocessing.connection` module allows some extra " "flexibility. It basically gives a high level message oriented API for " @@ -3706,74 +3773,74 @@ msgid "" "multiple connections at the same time." msgstr "" -#: ../../library/multiprocessing.rst:2518 +#: ../../library/multiprocessing.rst:2574 msgid "" "Send a randomly generated message to the other end of the connection and " "wait for a reply." msgstr "" -#: ../../library/multiprocessing.rst:2521 +#: ../../library/multiprocessing.rst:2577 msgid "" "If the reply matches the digest of the message using *authkey* as the key " "then a welcome message is sent to the other end of the connection. " "Otherwise :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2527 +#: ../../library/multiprocessing.rst:2583 msgid "" "Receive a message, calculate the digest of the message using *authkey* as " "the key, and then send the digest back." msgstr "" -#: ../../library/multiprocessing.rst:2530 +#: ../../library/multiprocessing.rst:2586 msgid "" -"If a welcome message is not received, then :exc:`~multiprocessing." -"AuthenticationError` is raised." +"If a welcome message is not received, " +"then :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2535 +#: ../../library/multiprocessing.rst:2591 msgid "" "Attempt to set up a connection to the listener which is using address " "*address*, returning a :class:`~Connection`." msgstr "" -#: ../../library/multiprocessing.rst:2538 +#: ../../library/multiprocessing.rst:2594 msgid "" "The type of the connection is determined by *family* argument, but this can " "generally be omitted since it can usually be inferred from the format of " "*address*. (See :ref:`multiprocessing-address-formats`)" msgstr "" -#: ../../library/multiprocessing.rst:2542 -#: ../../library/multiprocessing.rst:2577 +#: ../../library/multiprocessing.rst:2598 +#: ../../library/multiprocessing.rst:2633 msgid "" "If *authkey* is given and not ``None``, it should be a byte string and will " "be used as the secret key for an HMAC-based authentication challenge. No " -"authentication is done if *authkey* is ``None``. :exc:`~multiprocessing." -"AuthenticationError` is raised if authentication fails. See :ref:" -"`multiprocessing-auth-keys`." +"authentication is done if *authkey* is " +"``None``. :exc:`~multiprocessing.AuthenticationError` is raised if " +"authentication fails. See :ref:`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:2550 +#: ../../library/multiprocessing.rst:2606 msgid "" "A wrapper for a bound socket or Windows named pipe which is 'listening' for " "connections." msgstr "" -#: ../../library/multiprocessing.rst:2553 +#: ../../library/multiprocessing.rst:2609 msgid "" "*address* is the address to be used by the bound socket or named pipe of the " "listener object." msgstr "" -#: ../../library/multiprocessing.rst:2558 +#: ../../library/multiprocessing.rst:2614 msgid "" "If an address of '0.0.0.0' is used, the address will not be a connectable " "end point on Windows. If you require a connectable end-point, you should use " "'127.0.0.1'." msgstr "" -#: ../../library/multiprocessing.rst:2562 +#: ../../library/multiprocessing.rst:2618 msgid "" "*family* is the type of socket (or named pipe) to use. This can be one of " "the strings ``'AF_INET'`` (for a TCP socket), ``'AF_UNIX'`` (for a Unix " @@ -3787,49 +3854,50 @@ msgid "" "using :func:`tempfile.mkstemp`." msgstr "" -#: ../../library/multiprocessing.rst:2573 +#: ../../library/multiprocessing.rst:2629 msgid "" "If the listener object uses a socket then *backlog* (1 by default) is passed " "to the :meth:`~socket.socket.listen` method of the socket once it has been " "bound." msgstr "" -#: ../../library/multiprocessing.rst:2585 +#: ../../library/multiprocessing.rst:2641 msgid "" "Accept a connection on the bound socket or named pipe of the listener object " "and return a :class:`~Connection` object. If authentication is attempted and " "fails, then :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2592 +#: ../../library/multiprocessing.rst:2648 msgid "" "Close the bound socket or named pipe of the listener object. This is called " "automatically when the listener is garbage collected. However it is " "advisable to call it explicitly." msgstr "" -#: ../../library/multiprocessing.rst:2596 +#: ../../library/multiprocessing.rst:2652 msgid "Listener objects have the following read-only properties:" msgstr "" -#: ../../library/multiprocessing.rst:2600 +#: ../../library/multiprocessing.rst:2656 msgid "The address which is being used by the Listener object." msgstr "" -#: ../../library/multiprocessing.rst:2604 +#: ../../library/multiprocessing.rst:2660 msgid "" "The address from which the last accepted connection came. If this is " "unavailable then it is ``None``." msgstr "" -#: ../../library/multiprocessing.rst:2607 +#: ../../library/multiprocessing.rst:2663 msgid "" -"Listener objects now support the context management protocol -- see :ref:" -"`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " -"listener object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." +"Listener objects now support the context management protocol -- " +"see :ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns " +"the listener object, and :meth:`~contextmanager.__exit__` " +"calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:2614 +#: ../../library/multiprocessing.rst:2670 msgid "" "Wait till an object in *object_list* is ready. Returns the list of those " "objects in *object_list* which are ready. If *timeout* is a float then the " @@ -3838,61 +3906,62 @@ msgid "" "zero timeout." msgstr "" -#: ../../library/multiprocessing.rst:2620 +#: ../../library/multiprocessing.rst:2676 msgid "" "For both POSIX and Windows, an object can appear in *object_list* if it is" msgstr "" -#: ../../library/multiprocessing.rst:2623 +#: ../../library/multiprocessing.rst:2679 msgid "a readable :class:`~multiprocessing.connection.Connection` object;" msgstr "" -#: ../../library/multiprocessing.rst:2624 +#: ../../library/multiprocessing.rst:2680 msgid "a connected and readable :class:`socket.socket` object; or" msgstr "" -#: ../../library/multiprocessing.rst:2625 +#: ../../library/multiprocessing.rst:2681 msgid "" -"the :attr:`~multiprocessing.Process.sentinel` attribute of a :class:" -"`~multiprocessing.Process` object." +"the :attr:`~multiprocessing.Process.sentinel` attribute of " +"a :class:`~multiprocessing.Process` object." msgstr "" -#: ../../library/multiprocessing.rst:2628 +#: ../../library/multiprocessing.rst:2684 msgid "" "A connection or socket object is ready when there is data available to be " "read from it, or the other end has been closed." msgstr "" -#: ../../library/multiprocessing.rst:2631 +#: ../../library/multiprocessing.rst:2687 msgid "" -"**POSIX**: ``wait(object_list, timeout)`` almost equivalent ``select." -"select(object_list, [], [], timeout)``. The difference is that, if :func:" -"`select.select` is interrupted by a signal, it can raise :exc:`OSError` with " -"an error number of ``EINTR``, whereas :func:`wait` will not." +"**POSIX**: ``wait(object_list, timeout)`` almost equivalent " +"``select.select(object_list, [], [], timeout)``. The difference is that, " +"if :func:`select.select` is interrupted by a signal, it can " +"raise :exc:`OSError` with an error number of ``EINTR``, whereas :func:`wait` " +"will not." msgstr "" -#: ../../library/multiprocessing.rst:2637 +#: ../../library/multiprocessing.rst:2693 msgid "" "**Windows**: An item in *object_list* must either be an integer handle which " "is waitable (according to the definition used by the documentation of the " -"Win32 function ``WaitForMultipleObjects()``) or it can be an object with a :" -"meth:`~io.IOBase.fileno` method which returns a socket handle or pipe " +"Win32 function ``WaitForMultipleObjects()``) or it can be an object with " +"a :meth:`~io.IOBase.fileno` method which returns a socket handle or pipe " "handle. (Note that pipe handles and socket handles are **not** waitable " "handles.)" msgstr "" -#: ../../library/multiprocessing.rst:2647 +#: ../../library/multiprocessing.rst:2703 msgid "**Examples**" msgstr "" -#: ../../library/multiprocessing.rst:2649 +#: ../../library/multiprocessing.rst:2705 msgid "" "The following server code creates a listener which uses ``'secret " "password'`` as an authentication key. It then waits for a connection and " "sends some data to the client::" msgstr "" -#: ../../library/multiprocessing.rst:2653 +#: ../../library/multiprocessing.rst:2709 msgid "" "from multiprocessing.connection import Listener\n" "from array import array\n" @@ -3910,13 +3979,13 @@ msgid "" " conn.send_bytes(array('i', [42, 1729]))" msgstr "" -#: ../../library/multiprocessing.rst:2668 +#: ../../library/multiprocessing.rst:2724 msgid "" "The following code connects to the server and receives some data from the " "server::" msgstr "" -#: ../../library/multiprocessing.rst:2671 +#: ../../library/multiprocessing.rst:2727 msgid "" "from multiprocessing.connection import Client\n" "from array import array\n" @@ -3946,13 +4015,13 @@ msgstr "" " print(conn.recv_bytes_into(arr)) # => 8\n" " print(arr) # => array('i', [42, 1729, 0, 0, 0])" -#: ../../library/multiprocessing.rst:2685 +#: ../../library/multiprocessing.rst:2741 msgid "" "The following code uses :func:`~multiprocessing.connection.wait` to wait for " "messages from multiple processes at once::" msgstr "" -#: ../../library/multiprocessing.rst:2688 +#: ../../library/multiprocessing.rst:2744 msgid "" "from multiprocessing import Process, Pipe, current_process\n" "from multiprocessing.connection import wait\n" @@ -3986,23 +4055,23 @@ msgid "" " print(msg)" msgstr "" -#: ../../library/multiprocessing.rst:2723 +#: ../../library/multiprocessing.rst:2779 msgid "Address Formats" msgstr "" -#: ../../library/multiprocessing.rst:2725 +#: ../../library/multiprocessing.rst:2781 msgid "" "An ``'AF_INET'`` address is a tuple of the form ``(hostname, port)`` where " "*hostname* is a string and *port* is an integer." msgstr "" -#: ../../library/multiprocessing.rst:2728 +#: ../../library/multiprocessing.rst:2784 msgid "" "An ``'AF_UNIX'`` address is a string representing a filename on the " "filesystem." msgstr "" -#: ../../library/multiprocessing.rst:2731 +#: ../../library/multiprocessing.rst:2787 msgid "" "An ``'AF_PIPE'`` address is a string of the form :samp:`r'\\\\\\\\\\\\.\\" "\\pipe\\\\\\\\{PipeName}'`. To use :func:`Client` to connect to a named " @@ -4011,17 +4080,17 @@ msgid "" "instead." msgstr "" -#: ../../library/multiprocessing.rst:2736 +#: ../../library/multiprocessing.rst:2792 msgid "" "Note that any string beginning with two backslashes is assumed by default to " "be an ``'AF_PIPE'`` address rather than an ``'AF_UNIX'`` address." msgstr "" -#: ../../library/multiprocessing.rst:2743 +#: ../../library/multiprocessing.rst:2799 msgid "Authentication keys" msgstr "" -#: ../../library/multiprocessing.rst:2745 +#: ../../library/multiprocessing.rst:2801 msgid "" "When one uses :meth:`Connection.recv `, the data received " "is automatically unpickled. Unfortunately unpickling data from an untrusted " @@ -4029,7 +4098,7 @@ msgid "" "use the :mod:`hmac` module to provide digest authentication." msgstr "" -#: ../../library/multiprocessing.rst:2751 +#: ../../library/multiprocessing.rst:2807 msgid "" "An authentication key is a byte string which can be thought of as a " "password: once a connection is established both ends will demand proof that " @@ -4037,56 +4106,56 @@ msgid "" "using the same key does **not** involve sending the key over the connection.)" msgstr "" -#: ../../library/multiprocessing.rst:2757 +#: ../../library/multiprocessing.rst:2813 msgid "" "If authentication is requested but no authentication key is specified then " -"the return value of ``current_process().authkey`` is used (see :class:" -"`~multiprocessing.Process`). This value will be automatically inherited by " -"any :class:`~multiprocessing.Process` object that the current process " -"creates. This means that (by default) all processes of a multi-process " -"program will share a single authentication key which can be used when " -"setting up connections between themselves." +"the return value of ``current_process().authkey`` is used " +"(see :class:`~multiprocessing.Process`). This value will be automatically " +"inherited by any :class:`~multiprocessing.Process` object that the current " +"process creates. This means that (by default) all processes of a multi-" +"process program will share a single authentication key which can be used " +"when setting up connections between themselves." msgstr "" -#: ../../library/multiprocessing.rst:2765 +#: ../../library/multiprocessing.rst:2821 msgid "" -"Suitable authentication keys can also be generated by using :func:`os." -"urandom`." +"Suitable authentication keys can also be generated by " +"using :func:`os.urandom`." msgstr "" -#: ../../library/multiprocessing.rst:2769 +#: ../../library/multiprocessing.rst:2825 msgid "Logging" msgstr "" -#: ../../library/multiprocessing.rst:2771 +#: ../../library/multiprocessing.rst:2827 msgid "" -"Some support for logging is available. Note, however, that the :mod:" -"`logging` package does not use process shared locks so it is possible " -"(depending on the handler type) for messages from different processes to get " -"mixed up." +"Some support for logging is available. Note, however, that " +"the :mod:`logging` package does not use process shared locks so it is " +"possible (depending on the handler type) for messages from different " +"processes to get mixed up." msgstr "" -#: ../../library/multiprocessing.rst:2778 +#: ../../library/multiprocessing.rst:2834 msgid "" "Returns the logger used by :mod:`multiprocessing`. If necessary, a new one " "will be created." msgstr "" -#: ../../library/multiprocessing.rst:2781 +#: ../../library/multiprocessing.rst:2837 msgid "" "When first created the logger has level :const:`logging.NOTSET` and no " "default handler. Messages sent to this logger will not by default propagate " "to the root logger." msgstr "" -#: ../../library/multiprocessing.rst:2785 +#: ../../library/multiprocessing.rst:2841 msgid "" "Note that on Windows child processes will only inherit the level of the " "parent process's logger -- any other customization of the logger will not be " "inherited." msgstr "" -#: ../../library/multiprocessing.rst:2792 +#: ../../library/multiprocessing.rst:2848 msgid "" "This function performs a call to :func:`get_logger` but in addition to " "returning the logger created by get_logger, it adds a handler which sends " @@ -4095,11 +4164,11 @@ msgid "" "``level`` argument." msgstr "" -#: ../../library/multiprocessing.rst:2798 +#: ../../library/multiprocessing.rst:2854 msgid "Below is an example session with logging turned on::" msgstr "" -#: ../../library/multiprocessing.rst:2800 +#: ../../library/multiprocessing.rst:2856 msgid "" ">>> import multiprocessing, logging\n" ">>> logger = multiprocessing.log_to_stderr()\n" @@ -4127,160 +4196,160 @@ msgstr "" "[INFO/MainProcess] sending shutdown message to manager\n" "[INFO/SyncManager-...] manager exiting with exitcode 0" -#: ../../library/multiprocessing.rst:2813 +#: ../../library/multiprocessing.rst:2869 msgid "For a full table of logging levels, see the :mod:`logging` module." msgstr "" -#: ../../library/multiprocessing.rst:2817 +#: ../../library/multiprocessing.rst:2873 msgid "The :mod:`multiprocessing.dummy` module" msgstr ":mod:`multiprocessing.dummy` 模組" -#: ../../library/multiprocessing.rst:2822 +#: ../../library/multiprocessing.rst:2878 msgid "" ":mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` " "but is no more than a wrapper around the :mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:2827 +#: ../../library/multiprocessing.rst:2883 msgid "" -"In particular, the ``Pool`` function provided by :mod:`multiprocessing." -"dummy` returns an instance of :class:`ThreadPool`, which is a subclass of :" -"class:`Pool` that supports all the same method calls but uses a pool of " -"worker threads rather than worker processes." +"In particular, the ``Pool`` function provided " +"by :mod:`multiprocessing.dummy` returns an instance of :class:`ThreadPool`, " +"which is a subclass of :class:`Pool` that supports all the same method calls " +"but uses a pool of worker threads rather than worker processes." msgstr "" -#: ../../library/multiprocessing.rst:2835 +#: ../../library/multiprocessing.rst:2891 msgid "" "A thread pool object which controls a pool of worker threads to which jobs " "can be submitted. :class:`ThreadPool` instances are fully interface " "compatible with :class:`Pool` instances, and their resources must also be " "properly managed, either by using the pool as a context manager or by " -"calling :meth:`~multiprocessing.pool.Pool.close` and :meth:`~multiprocessing." -"pool.Pool.terminate` manually." +"calling :meth:`~multiprocessing.pool.Pool.close` " +"and :meth:`~multiprocessing.pool.Pool.terminate` manually." msgstr "" -#: ../../library/multiprocessing.rst:2842 +#: ../../library/multiprocessing.rst:2898 msgid "" "*processes* is the number of worker threads to use. If *processes* is " "``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2848 +#: ../../library/multiprocessing.rst:2904 msgid "" "Unlike :class:`Pool`, *maxtasksperchild* and *context* cannot be provided." msgstr "" -#: ../../library/multiprocessing.rst:2852 +#: ../../library/multiprocessing.rst:2908 msgid "" "A :class:`ThreadPool` shares the same interface as :class:`Pool`, which is " -"designed around a pool of processes and predates the introduction of the :" -"class:`concurrent.futures` module. As such, it inherits some operations " -"that don't make sense for a pool backed by threads, and it has its own type " -"for representing the status of asynchronous jobs, :class:`AsyncResult`, that " -"is not understood by any other libraries." +"designed around a pool of processes and predates the introduction of " +"the :class:`concurrent.futures` module. As such, it inherits some " +"operations that don't make sense for a pool backed by threads, and it has " +"its own type for representing the status of asynchronous " +"jobs, :class:`AsyncResult`, that is not understood by any other libraries." msgstr "" -#: ../../library/multiprocessing.rst:2859 +#: ../../library/multiprocessing.rst:2915 msgid "" -"Users should generally prefer to use :class:`concurrent.futures." -"ThreadPoolExecutor`, which has a simpler interface that was designed around " -"threads from the start, and which returns :class:`concurrent.futures.Future` " -"instances that are compatible with many other libraries, including :mod:" -"`asyncio`." +"Users should generally prefer to " +"use :class:`concurrent.futures.ThreadPoolExecutor`, which has a simpler " +"interface that was designed around threads from the start, and which " +"returns :class:`concurrent.futures.Future` instances that are compatible " +"with many other libraries, including :mod:`asyncio`." msgstr "" -#: ../../library/multiprocessing.rst:2869 +#: ../../library/multiprocessing.rst:2925 msgid "Programming guidelines" msgstr "" -#: ../../library/multiprocessing.rst:2871 +#: ../../library/multiprocessing.rst:2927 msgid "" "There are certain guidelines and idioms which should be adhered to when " "using :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:2876 +#: ../../library/multiprocessing.rst:2932 msgid "All start methods" msgstr "" -#: ../../library/multiprocessing.rst:2878 +#: ../../library/multiprocessing.rst:2934 msgid "The following applies to all start methods." msgstr "" -#: ../../library/multiprocessing.rst:2880 +#: ../../library/multiprocessing.rst:2936 msgid "Avoid shared state" msgstr "" -#: ../../library/multiprocessing.rst:2882 +#: ../../library/multiprocessing.rst:2938 msgid "" "As far as possible one should try to avoid shifting large amounts of data " "between processes." msgstr "" -#: ../../library/multiprocessing.rst:2885 +#: ../../library/multiprocessing.rst:2941 msgid "" "It is probably best to stick to using queues or pipes for communication " "between processes rather than using the lower level synchronization " "primitives." msgstr "" -#: ../../library/multiprocessing.rst:2889 +#: ../../library/multiprocessing.rst:2945 msgid "Picklability" msgstr "" -#: ../../library/multiprocessing.rst:2891 +#: ../../library/multiprocessing.rst:2947 msgid "Ensure that the arguments to the methods of proxies are picklable." msgstr "" -#: ../../library/multiprocessing.rst:2893 +#: ../../library/multiprocessing.rst:2949 msgid "Thread safety of proxies" msgstr "" -#: ../../library/multiprocessing.rst:2895 +#: ../../library/multiprocessing.rst:2951 msgid "" "Do not use a proxy object from more than one thread unless you protect it " "with a lock." msgstr "" -#: ../../library/multiprocessing.rst:2898 +#: ../../library/multiprocessing.rst:2954 msgid "" "(There is never a problem with different processes using the *same* proxy.)" msgstr "" -#: ../../library/multiprocessing.rst:2900 +#: ../../library/multiprocessing.rst:2956 msgid "Joining zombie processes" msgstr "" -#: ../../library/multiprocessing.rst:2902 +#: ../../library/multiprocessing.rst:2958 msgid "" "On POSIX when a process finishes but has not been joined it becomes a " "zombie. There should never be very many because each time a new process " "starts (or :func:`~multiprocessing.active_children` is called) all completed " "processes which have not yet been joined will be joined. Also calling a " -"finished process's :meth:`Process.is_alive ` will join the process. Even so it is probably good practice to " -"explicitly join all the processes that you start." +"finished process's :meth:`Process.is_alive " +"` will join the process. Even so it is " +"probably good practice to explicitly join all the processes that you start." msgstr "" -#: ../../library/multiprocessing.rst:2910 +#: ../../library/multiprocessing.rst:2966 msgid "Better to inherit than pickle/unpickle" msgstr "" -#: ../../library/multiprocessing.rst:2912 +#: ../../library/multiprocessing.rst:2968 msgid "" -"When using the *spawn* or *forkserver* start methods many types from :mod:" -"`multiprocessing` need to be picklable so that child processes can use " -"them. However, one should generally avoid sending shared objects to other " -"processes using pipes or queues. Instead you should arrange the program so " -"that a process which needs access to a shared resource created elsewhere can " -"inherit it from an ancestor process." +"When using the *spawn* or *forkserver* start methods many types " +"from :mod:`multiprocessing` need to be picklable so that child processes can " +"use them. However, one should generally avoid sending shared objects to " +"other processes using pipes or queues. Instead you should arrange the " +"program so that a process which needs access to a shared resource created " +"elsewhere can inherit it from an ancestor process." msgstr "" -#: ../../library/multiprocessing.rst:2920 +#: ../../library/multiprocessing.rst:2976 msgid "Avoid terminating processes" msgstr "" -#: ../../library/multiprocessing.rst:2922 +#: ../../library/multiprocessing.rst:2978 msgid "" "Using the :meth:`Process.terminate ` " "method to stop a process is liable to cause any shared resources (such as " @@ -4288,27 +4357,28 @@ msgid "" "become broken or unavailable to other processes." msgstr "" -#: ../../library/multiprocessing.rst:2928 +#: ../../library/multiprocessing.rst:2984 msgid "" -"Therefore it is probably best to only consider using :meth:`Process." -"terminate ` on processes which never use " -"any shared resources." +"Therefore it is probably best to only consider " +"using :meth:`Process.terminate ` on " +"processes which never use any shared resources." msgstr "" -#: ../../library/multiprocessing.rst:2932 +#: ../../library/multiprocessing.rst:2988 msgid "Joining processes that use queues" msgstr "" -#: ../../library/multiprocessing.rst:2934 +#: ../../library/multiprocessing.rst:2990 msgid "" "Bear in mind that a process that has put items in a queue will wait before " "terminating until all the buffered items are fed by the \"feeder\" thread to " -"the underlying pipe. (The child process can call the :meth:`Queue." -"cancel_join_thread ` method of the " -"queue to avoid this behaviour.)" +"the underlying pipe. (The child process can call " +"the :meth:`Queue.cancel_join_thread " +"` method of the queue to avoid " +"this behaviour.)" msgstr "" -#: ../../library/multiprocessing.rst:2940 +#: ../../library/multiprocessing.rst:2996 msgid "" "This means that whenever you use a queue you need to make sure that all " "items which have been put on the queue will eventually be removed before the " @@ -4317,11 +4387,11 @@ msgid "" "processes will be joined automatically." msgstr "" -#: ../../library/multiprocessing.rst:2946 +#: ../../library/multiprocessing.rst:3002 msgid "An example which will deadlock is the following::" msgstr "" -#: ../../library/multiprocessing.rst:2948 +#: ../../library/multiprocessing.rst:3004 msgid "" "from multiprocessing import Process, Queue\n" "\n" @@ -4336,17 +4406,17 @@ msgid "" " obj = queue.get()" msgstr "" -#: ../../library/multiprocessing.rst:2960 +#: ../../library/multiprocessing.rst:3016 msgid "" -"A fix here would be to swap the last two lines (or simply remove the ``p." -"join()`` line)." +"A fix here would be to swap the last two lines (or simply remove the " +"``p.join()`` line)." msgstr "" -#: ../../library/multiprocessing.rst:2963 +#: ../../library/multiprocessing.rst:3019 msgid "Explicitly pass resources to child processes" msgstr "" -#: ../../library/multiprocessing.rst:2965 +#: ../../library/multiprocessing.rst:3021 msgid "" "On POSIX using the *fork* start method, a child process can make use of a " "shared resource created in a parent process using a global resource. " @@ -4354,7 +4424,7 @@ msgid "" "for the child process." msgstr "" -#: ../../library/multiprocessing.rst:2970 +#: ../../library/multiprocessing.rst:3026 msgid "" "Apart from making the code (potentially) compatible with Windows and the " "other start methods this also ensures that as long as the child process is " @@ -4363,11 +4433,11 @@ msgid "" "collected in the parent process." msgstr "" -#: ../../library/multiprocessing.rst:2977 +#: ../../library/multiprocessing.rst:3033 msgid "So for instance ::" msgstr "" -#: ../../library/multiprocessing.rst:2979 +#: ../../library/multiprocessing.rst:3035 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4389,11 +4459,11 @@ msgstr "" " for i in range(10):\n" " Process(target=f).start()" -#: ../../library/multiprocessing.rst:2989 +#: ../../library/multiprocessing.rst:3045 msgid "should be rewritten as ::" msgstr "" -#: ../../library/multiprocessing.rst:2991 +#: ../../library/multiprocessing.rst:3047 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4415,25 +4485,25 @@ msgstr "" " for i in range(10):\n" " Process(target=f, args=(lock,)).start()" -#: ../../library/multiprocessing.rst:3001 +#: ../../library/multiprocessing.rst:3057 msgid "Beware of replacing :data:`sys.stdin` with a \"file like object\"" msgstr "" -#: ../../library/multiprocessing.rst:3003 +#: ../../library/multiprocessing.rst:3059 msgid ":mod:`multiprocessing` originally unconditionally called::" msgstr "" -#: ../../library/multiprocessing.rst:3005 +#: ../../library/multiprocessing.rst:3061 msgid "os.close(sys.stdin.fileno())" msgstr "os.close(sys.stdin.fileno())" -#: ../../library/multiprocessing.rst:3007 +#: ../../library/multiprocessing.rst:3063 msgid "" "in the :meth:`multiprocessing.Process._bootstrap` method --- this resulted " "in issues with processes-in-processes. This has been changed to::" msgstr "" -#: ../../library/multiprocessing.rst:3010 +#: ../../library/multiprocessing.rst:3066 msgid "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" @@ -4441,24 +4511,25 @@ msgstr "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" -#: ../../library/multiprocessing.rst:3013 +#: ../../library/multiprocessing.rst:3069 msgid "" "Which solves the fundamental issue of processes colliding with each other " "resulting in a bad file descriptor error, but introduces a potential danger " "to applications which replace :func:`sys.stdin` with a \"file-like object\" " -"with output buffering. This danger is that if multiple processes call :meth:" -"`~io.IOBase.close` on this file-like object, it could result in the same " -"data being flushed to the object multiple times, resulting in corruption." +"with output buffering. This danger is that if multiple processes " +"call :meth:`~io.IOBase.close` on this file-like object, it could result in " +"the same data being flushed to the object multiple times, resulting in " +"corruption." msgstr "" -#: ../../library/multiprocessing.rst:3020 +#: ../../library/multiprocessing.rst:3076 msgid "" "If you write a file-like object and implement your own caching, you can make " "it fork-safe by storing the pid whenever you append to the cache, and " "discarding the cache when the pid changes. For example::" msgstr "" -#: ../../library/multiprocessing.rst:3024 +#: ../../library/multiprocessing.rst:3080 msgid "" "@property\n" "def cache(self):\n" @@ -4476,26 +4547,26 @@ msgstr "" " self._cache = []\n" " return self._cache" -#: ../../library/multiprocessing.rst:3032 +#: ../../library/multiprocessing.rst:3088 msgid "" "For more information, see :issue:`5155`, :issue:`5313` and :issue:`5331`" msgstr "" -#: ../../library/multiprocessing.rst:3038 +#: ../../library/multiprocessing.rst:3094 msgid "The *spawn* and *forkserver* start methods" msgstr "" -#: ../../library/multiprocessing.rst:3040 +#: ../../library/multiprocessing.rst:3096 msgid "" "There are a few extra restrictions which don't apply to the *fork* start " "method." msgstr "" -#: ../../library/multiprocessing.rst:3043 +#: ../../library/multiprocessing.rst:3099 msgid "More picklability" msgstr "" -#: ../../library/multiprocessing.rst:3045 +#: ../../library/multiprocessing.rst:3101 msgid "" "Ensure that all arguments to :class:`~multiprocessing.Process` are " "picklable. Also, if you subclass ``Process.__init__``, you must make sure " @@ -4503,42 +4574,42 @@ msgid "" "` method is called." msgstr "" -#: ../../library/multiprocessing.rst:3050 +#: ../../library/multiprocessing.rst:3106 msgid "Global variables" msgstr "" -#: ../../library/multiprocessing.rst:3052 +#: ../../library/multiprocessing.rst:3108 msgid "" "Bear in mind that if code run in a child process tries to access a global " "variable, then the value it sees (if any) may not be the same as the value " -"in the parent process at the time that :meth:`Process.start ` was called." +"in the parent process at the time that :meth:`Process.start " +"` was called." msgstr "" -#: ../../library/multiprocessing.rst:3057 +#: ../../library/multiprocessing.rst:3113 msgid "" "However, global variables which are just module level constants cause no " "problems." msgstr "" -#: ../../library/multiprocessing.rst:3062 +#: ../../library/multiprocessing.rst:3118 msgid "Safe importing of main module" msgstr "" -#: ../../library/multiprocessing.rst:3064 +#: ../../library/multiprocessing.rst:3120 msgid "" "Make sure that the main module can be safely imported by a new Python " "interpreter without causing unintended side effects (such as starting a new " "process)." msgstr "" -#: ../../library/multiprocessing.rst:3068 +#: ../../library/multiprocessing.rst:3124 msgid "" "For example, using the *spawn* or *forkserver* start method running the " "following module would fail with a :exc:`RuntimeError`::" msgstr "" -#: ../../library/multiprocessing.rst:3072 +#: ../../library/multiprocessing.rst:3128 msgid "" "from multiprocessing import Process\n" "\n" @@ -4556,13 +4627,13 @@ msgstr "" "p = Process(target=foo)\n" "p.start()" -#: ../../library/multiprocessing.rst:3080 +#: ../../library/multiprocessing.rst:3136 msgid "" "Instead one should protect the \"entry point\" of the program by using ``if " "__name__ == '__main__':`` as follows::" msgstr "" -#: ../../library/multiprocessing.rst:3083 +#: ../../library/multiprocessing.rst:3139 msgid "" "from multiprocessing import Process, freeze_support, set_start_method\n" "\n" @@ -4586,33 +4657,33 @@ msgstr "" " p = Process(target=foo)\n" " p.start()" -#: ../../library/multiprocessing.rst:3094 +#: ../../library/multiprocessing.rst:3150 msgid "" "(The ``freeze_support()`` line can be omitted if the program will be run " "normally instead of frozen.)" msgstr "" -#: ../../library/multiprocessing.rst:3097 +#: ../../library/multiprocessing.rst:3153 msgid "" "This allows the newly spawned Python interpreter to safely import the module " "and then run the module's ``foo()`` function." msgstr "" -#: ../../library/multiprocessing.rst:3100 +#: ../../library/multiprocessing.rst:3156 msgid "" "Similar restrictions apply if a pool or manager is created in the main " "module." msgstr "" -#: ../../library/multiprocessing.rst:3107 +#: ../../library/multiprocessing.rst:3163 msgid "Examples" msgstr "範例" -#: ../../library/multiprocessing.rst:3109 +#: ../../library/multiprocessing.rst:3165 msgid "Demonstration of how to create and use customized managers and proxies:" msgstr "" -#: ../../library/multiprocessing.rst:3111 +#: ../../library/multiprocessing.rst:3167 msgid "" "from multiprocessing import freeze_support\n" "from multiprocessing.managers import BaseManager, BaseProxy\n" @@ -4706,11 +4777,11 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3115 +#: ../../library/multiprocessing.rst:3171 msgid "Using :class:`~multiprocessing.pool.Pool`:" msgstr "使用 :class:`~multiprocessing.pool.Pool`:" -#: ../../library/multiprocessing.rst:3117 +#: ../../library/multiprocessing.rst:3173 msgid "" "import multiprocessing\n" "import time\n" @@ -4812,8 +4883,8 @@ msgid "" " try:\n" " print(list(pool.imap(f, list(range(10)))))\n" " except ZeroDivisionError:\n" -" print('\\tGot ZeroDivisionError as expected from list(pool." -"imap())')\n" +" print('\\tGot ZeroDivisionError as expected from " +"list(pool.imap())')\n" " else:\n" " raise AssertionError('expected ZeroDivisionError')\n" "\n" @@ -4831,8 +4902,8 @@ msgid "" " raise AssertionError('expected ZeroDivisionError')\n" "\n" " assert i == 9\n" -" print('\\tGot ZeroDivisionError as expected from IMapIterator." -"next()')\n" +" print('\\tGot ZeroDivisionError as expected from " +"IMapIterator.next()')\n" " print()\n" "\n" " #\n" @@ -4870,13 +4941,13 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3121 +#: ../../library/multiprocessing.rst:3177 msgid "" "An example showing how to use queues to feed tasks to a collection of worker " "processes and collect the results:" msgstr "" -#: ../../library/multiprocessing.rst:3124 +#: ../../library/multiprocessing.rst:3180 msgid "" "import time\n" "import random\n" diff --git a/library/numbers.po b/library/numbers.po index 1ce21e81503..33bd765f186 100644 --- a/library/numbers.po +++ b/library/numbers.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-06 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-11-16 04:57+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,10 +30,10 @@ msgstr "**原始碼:**\\ :source:`Lib/numbers.py`" #: ../../library/numbers.rst:11 msgid "" -"The :mod:`!numbers` module (:pep:`3141`) defines a hierarchy of numeric :" -"term:`abstract base classes ` which progressively " -"define more operations. None of the types defined in this module are " -"intended to be instantiated." +"The :mod:`!numbers` module (:pep:`3141`) defines a hierarchy of " +"numeric :term:`abstract base classes ` which " +"progressively define more operations. None of the types defined in this " +"module are intended to be instantiated." msgstr "" ":mod:`!numbers` 模組 (:pep:`3141`) 定義了數值\\ :term:`抽象基底類別 " "` 的階層結構,其中逐一定義了更多操作。此模組中定義的型別" @@ -54,15 +54,16 @@ msgstr "數值的階層" #: ../../library/numbers.rst:27 msgid "" "Subclasses of this type describe complex numbers and include the operations " -"that work on the built-in :class:`complex` type. These are: conversions to :" -"class:`complex` and :class:`bool`, :attr:`.real`, :attr:`.imag`, ``+``, ``-" -"``, ``*``, ``/``, ``**``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!" +"that work on the built-in :class:`complex` type. These are: conversions " +"to :class:`complex` and :class:`bool`, :attr:`.real`, :attr:`.imag`, ``+``, " +"``-``, ``*``, ``/``, ``**``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!" "=``. All except ``-`` and ``!=`` are abstract." msgstr "" "這個型別的子類別描述了複數並包含適用於內建 :class:`complex` 型別的操作。這些" -"操作有::class:`complex` 和 :class:`bool` 的轉換、:attr:`.real`、:attr:`." -"imag`、``+``、``-``、``*``、``/``、``**``、:func:`abs`、:meth:`conjugate`、" -"``==`` 以及 ``!=``。除 ``-`` 和 ``!=`` 之外所有操作都是抽象的。" +"操作有::class:`complex` 和 :class:`bool` 的轉" +"換、:attr:`.real`、:attr:`.imag`、``+``、``-``、``*``、``/``、" +"``**``、:func:`abs`、:meth:`conjugate`、``==`` 以及 ``!=``。除 ``-`` 和 ``!" +"=`` 之外所有操作都是抽象的。" #: ../../library/numbers.rst:35 msgid "Abstract. Retrieves the real component of this number." @@ -86,59 +87,59 @@ msgstr "相對於 :class:`Complex`,:class:`!Real` 加入了只有實數才能 #: ../../library/numbers.rst:52 msgid "" -"In short, those are: a conversion to :class:`float`, :func:`math.trunc`, :" -"func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, ``//``, " -"``%``, ``<``, ``<=``, ``>``, and ``>=``." +"In short, those are: a conversion " +"to :class:`float`, :func:`math.trunc`, :func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, " +"``//``, ``%``, ``<``, ``<=``, ``>``, and ``>=``." msgstr "" -"簡單的說,有 :class:`float` 的轉換、:func:`math.trunc`、:func:`round`、:func:" -"`math.floor`、:func:`math.ceil`、:func:`divmod`、``//``、``%``、 ``<``、" -"``<=``、``>``、和 ``>=``。" +"簡單的說,有 :class:`float` 的轉" +"換、:func:`math.trunc`、:func:`round`、:func:`math.floor`、:func:`math.ceil`、:func:`divmod`、" +"``//``、``%``、 ``<``、``<=``、``>``、和 ``>=``。" #: ../../library/numbers.rst:56 msgid "" -"Real also provides defaults for :func:`complex`, :attr:`~Complex.real`, :" -"attr:`~Complex.imag`, and :meth:`~Complex.conjugate`." +"Real also provides defaults " +"for :func:`complex`, :attr:`~Complex.real`, :attr:`~Complex.imag`, " +"and :meth:`~Complex.conjugate`." msgstr "" "實數同樣提供 :func:`complex`、:attr:`~Complex.real`、:attr:`~Complex.imag` " "和 :meth:`~Complex.conjugate` 的預設值。" #: ../../library/numbers.rst:62 msgid "" -"Subtypes :class:`Real` and adds :attr:`~Rational.numerator` and :attr:" -"`~Rational.denominator` properties. It also provides a default for :func:" -"`float`." +"Subtypes :class:`Real` and adds :attr:`~Rational.numerator` " +"and :attr:`~Rational.denominator` properties. It also provides a default " +"for :func:`float`." msgstr "" -":class:`Real` 的子型別,並增加了 :attr:`~Rational.numerator` 和 :attr:" -"`~Rational.denominator` 這兩種特性。它也會提供 :func:`float` 的預設值。" +":class:`Real` 的子型別,並增加了 :attr:`~Rational.numerator` " +"和 :attr:`~Rational.denominator` 這兩種特性。它也會提供 :func:`float` 的預設" +"值。" #: ../../library/numbers.rst:66 msgid "" "The :attr:`~Rational.numerator` and :attr:`~Rational.denominator` values " -"should be instances of :class:`Integral` and should be in lowest terms with :" -"attr:`~Rational.denominator` positive." +"should be instances of :class:`Integral` and should be in lowest terms " +"with :attr:`~Rational.denominator` positive." msgstr "" -":attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 的值必須是 :" -"class:`Integral` 的實例且 :attr:`~Rational.denominator` 要是正數。" +":attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 的值必須" +"是 :class:`Integral` 的實例且 :attr:`~Rational.denominator` 要是正數。" -#: ../../library/numbers.rst:72 -msgid "Abstract. The numerator of this rational number." -msgstr "為抽象的。該有理數的分子。" - -#: ../../library/numbers.rst:76 -msgid "Abstract. The denominator of this rational number." -msgstr "為抽象的。該有理數的分母。" +#: ../../library/numbers.rst:72 ../../library/numbers.rst:76 +msgid "Abstract." +msgstr "為抽象的。" #: ../../library/numbers.rst:81 msgid "" "Subtypes :class:`Rational` and adds a conversion to :class:`int`. Provides " -"defaults for :func:`float`, :attr:`~Rational.numerator`, and :attr:" -"`~Rational.denominator`. Adds abstract methods for :func:`pow` with modulus " -"and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~``." +"defaults for :func:`float`, :attr:`~Rational.numerator`, " +"and :attr:`~Rational.denominator`. Adds abstract methods for :func:`pow` " +"with modulus and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, " +"``~``." msgstr "" -":class:`Rational` 的子型別,並增加了 :class:`int` 的轉換操作。為 :func:" -"`float`、:attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 提供了" -"預設值。為 :func:`pow` 方法增加了求餘 (modulus) 和位元字串運算 (bit-string " -"operations) 的抽象方法:``<<``、``>>``、``&``、``^``、``|``、``~``。" +":class:`Rational` 的子型別,並增加了 :class:`int` 的轉換操作。" +"為 :func:`float`、:attr:`~Rational.numerator` " +"和 :attr:`~Rational.denominator` 提供了預設值。為 :func:`pow` 方法增加了求餘 " +"(modulus) 和位元字串運算 (bit-string operations) 的抽象方法:``<<``、``>>``、" +"``&``、``^``、``|``、``~``。" #: ../../library/numbers.rst:89 msgid "Notes for type implementers" @@ -148,12 +149,12 @@ msgstr "給型別實作者的註記" msgid "" "Implementers should be careful to make equal numbers equal and hash them to " "the same values. This may be subtle if there are two different extensions of " -"the real numbers. For example, :class:`fractions.Fraction` implements :func:" -"`hash` as follows::" +"the real numbers. For example, :class:`fractions.Fraction` " +"implements :func:`hash` as follows::" msgstr "" "實作者需注意,相等的數值除了大小相等外,還必須擁有同樣的雜湊值。當使用兩個不" -"同的實數擴充時,這可能是很微妙的。例如,:class:`fractions.Fraction` 底下的 :" -"func:`hash` 實作如下: ::" +"同的實數擴充時,這可能是很微妙的。例如,:class:`fractions.Fraction` 底下" +"的 :func:`hash` 實作如下: ::" #: ../../library/numbers.rst:96 msgid "" @@ -190,8 +191,8 @@ msgid "" "poor hierarchy if it precluded the possibility of adding those. You can add " "``MyFoo`` between :class:`Complex` and :class:`Real` with::" msgstr "" -"當然,還有更多用於數值的 ABC,如果不加入它們就不會有健全的階層。你可以在 :" -"class:`Complex` 和 :class:`Real` 中加入 ``MyFoo``,像是: ::" +"當然,還有更多用於數值的 ABC,如果不加入它們就不會有健全的階層。你可以" +"在 :class:`Complex` 和 :class:`Real` 中加入 ``MyFoo``,像是: ::" #: ../../library/numbers.rst:117 msgid "" @@ -210,8 +211,9 @@ msgid "" "We want to implement the arithmetic operations so that mixed-mode operations " "either call an implementation whose author knew about the types of both " "arguments, or convert both to the nearest built in type and do the operation " -"there. For subtypes of :class:`Integral`, this means that :meth:`~object." -"__add__` and :meth:`~object.__radd__` should be defined as::" +"there. For subtypes of :class:`Integral`, this means " +"that :meth:`~object.__add__` and :meth:`~object.__radd__` should be defined " +"as::" msgstr "" "我們想要實作算術操作,來使得混合模式操作要麼呼叫一個作者知道兩個引數之型別的" "實作,要麼將其轉換成最接近的內建型別並執行這個操作。對於 :class:`Integral` 的" @@ -270,10 +272,10 @@ msgstr "" #: ../../library/numbers.rst:158 msgid "" -"There are 5 different cases for a mixed-type operation on subclasses of :" -"class:`Complex`. I'll refer to all of the above code that doesn't refer to " -"``MyIntegral`` and ``OtherTypeIKnowAbout`` as \"boilerplate\". ``a`` will be " -"an instance of ``A``, which is a subtype of :class:`Complex` (``a : A <: " +"There are 5 different cases for a mixed-type operation on subclasses " +"of :class:`Complex`. I'll refer to all of the above code that doesn't refer " +"to ``MyIntegral`` and ``OtherTypeIKnowAbout`` as \"boilerplate\". ``a`` will " +"be an instance of ``A``, which is a subtype of :class:`Complex` (``a : A <: " "Complex``), and ``b : B <: Complex``. I'll consider ``a + b``:" msgstr "" ":class:`Complex` 的子類別有 5 種不同的混合型別操作。我將上面提到所有不涉及 " @@ -291,9 +293,9 @@ msgstr "" msgid "" "If ``A`` falls back to the boilerplate code, and it were to return a value " "from :meth:`~object.__add__`, we'd miss the possibility that ``B`` defines a " -"more intelligent :meth:`~object.__radd__`, so the boilerplate should return :" -"data:`NotImplemented` from :meth:`!__add__`. (Or ``A`` may not implement :" -"meth:`!__add__` at all.)" +"more intelligent :meth:`~object.__radd__`, so the boilerplate should " +"return :data:`NotImplemented` from :meth:`!__add__`. (Or ``A`` may not " +"implement :meth:`!__add__` at all.)" msgstr "" "如果 ``A`` 回退成模板程式碼,它將回傳一個來自 :meth:`~object.__add__` 的值," "並喪失讓 ``B`` 定義一個更完善的 :meth:`~object.__radd__` 的機會,因此模板需要" @@ -328,24 +330,24 @@ msgstr "" #: ../../library/numbers.rst:183 msgid "" "If ``A <: Complex`` and ``B <: Real`` without sharing any other knowledge, " -"then the appropriate shared operation is the one involving the built in :" -"class:`complex`, and both :meth:`~object.__radd__` s land there, so ``a+b == " -"b+a``." +"then the appropriate shared operation is the one involving the built " +"in :class:`complex`, and both :meth:`~object.__radd__` s land there, so " +"``a+b == b+a``." msgstr "" "如果 ``A <: Complex`` 和 ``B <: Real`` 且沒有共享任何其他型別上的理解,那麼適" -"當的共享操作會涉及內建的 :class:`complex`,並且分別用到 :meth:`~object." -"__radd__`,因此 ``a+b == b+a``。" +"當的共享操作會涉及內建的 :class:`complex`,並且分別用" +"到 :meth:`~object.__radd__`,因此 ``a+b == b+a``。" #: ../../library/numbers.rst:188 msgid "" "Because most of the operations on any given type will be very similar, it " "can be useful to define a helper function which generates the forward and " -"reverse instances of any given operator. For example, :class:`fractions." -"Fraction` uses::" +"reverse instances of any given operator. For " +"example, :class:`fractions.Fraction` uses::" msgstr "" "由於大部分對任意給定類型的操作都十分相似的,定義一個為任意給定運算子生成向前 " -"(forward) 與向後 (reverse) 實例的輔助函式可能會非常有用。例如,:class:" -"`fractions.Fraction` 使用了: ::" +"(forward) 與向後 (reverse) 實例的輔助函式可能會非常有用。例" +"如,:class:`fractions.Fraction` 使用了: ::" #: ../../library/numbers.rst:193 msgid "" @@ -425,5 +427,8 @@ msgstr "" "\n" "# ..." -#~ msgid "Abstract." -#~ msgstr "為抽象的。" +#~ msgid "Abstract. The numerator of this rational number." +#~ msgstr "為抽象的。該有理數的分子。" + +#~ msgid "Abstract. The denominator of this rational number." +#~ msgstr "為抽象的。該有理數的分母。" diff --git a/library/operator.po b/library/operator.po index 297a3f9c143..9193a8fc7eb 100644 --- a/library/operator.po +++ b/library/operator.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-02-18 14:49+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -107,128 +107,138 @@ msgstr "回傳 ``a is b``。測試物件識別性。" msgid "Return ``a is not b``. Tests object identity." msgstr "回傳 ``a is not b``。測試物件識別性。" -#: ../../library/operator.rst:83 +#: ../../library/operator.rst:85 +#, fuzzy +msgid "Return ``a is None``. Tests object identity." +msgstr "回傳 ``a is b``。測試物件識別性。" + +#: ../../library/operator.rst:92 +#, fuzzy +msgid "Return ``a is not None``. Tests object identity." +msgstr "回傳 ``a is not b``。測試物件識別性。" + +#: ../../library/operator.rst:97 msgid "The mathematical and bitwise operations are the most numerous:" msgstr "數學和位元運算的種類是最多的:" -#: ../../library/operator.rst:89 +#: ../../library/operator.rst:103 msgid "Return the absolute value of *obj*." msgstr "回傳 *obj* 的絕對值。" -#: ../../library/operator.rst:95 +#: ../../library/operator.rst:109 msgid "Return ``a + b``, for *a* and *b* numbers." msgstr "對於數字 *a* 和 *b*,回傳 ``a + b``。" -#: ../../library/operator.rst:101 +#: ../../library/operator.rst:115 msgid "Return the bitwise and of *a* and *b*." msgstr "回傳 *x* 和 *y* 位元運算與 (and) 的結果。" -#: ../../library/operator.rst:107 +#: ../../library/operator.rst:121 msgid "Return ``a // b``." msgstr "回傳 ``a // b``。" -#: ../../library/operator.rst:113 +#: ../../library/operator.rst:127 msgid "Return *a* converted to an integer. Equivalent to ``a.__index__()``." msgstr "回傳 *a* 轉換為整數的結果。等價於 ``a.__index__()``。" -#: ../../library/operator.rst:115 +#: ../../library/operator.rst:129 msgid "" "The result always has exact type :class:`int`. Previously, the result could " "have been an instance of a subclass of ``int``." msgstr "" "結果總是 :class:`int` 型別。在過去的版本中,結果可能為 ``int`` 子類別的實例。" -#: ../../library/operator.rst:125 +#: ../../library/operator.rst:139 msgid "" "Return the bitwise inverse of the number *obj*. This is equivalent to " "``~obj``." msgstr "回傳數字 *obj* 按位元取反 (inverse) 的結果。這等價於 ``~obj``。" -#: ../../library/operator.rst:131 +#: ../../library/operator.rst:145 msgid "Return *a* shifted left by *b*." msgstr "回傳 *a* 左移 *b* 位的結果。" -#: ../../library/operator.rst:137 +#: ../../library/operator.rst:151 msgid "Return ``a % b``." msgstr "回傳 ``a % b``。" -#: ../../library/operator.rst:143 +#: ../../library/operator.rst:157 msgid "Return ``a * b``, for *a* and *b* numbers." msgstr "對於數字 *a* 和 *b*,回傳 ``a * b``。" -#: ../../library/operator.rst:149 +#: ../../library/operator.rst:163 msgid "Return ``a @ b``." msgstr "回傳 ``a @ b``。" -#: ../../library/operator.rst:157 +#: ../../library/operator.rst:171 msgid "Return *obj* negated (``-obj``)." msgstr "回傳 *obj* 取負值的結果 (\\ ``-obj``\\ )。" -#: ../../library/operator.rst:163 +#: ../../library/operator.rst:177 msgid "Return the bitwise or of *a* and *b*." msgstr "回傳 *a* 和 *b* 按位元或 (or) 的結果。" -#: ../../library/operator.rst:169 +#: ../../library/operator.rst:183 msgid "Return *obj* positive (``+obj``)." msgstr "回傳 *obj* 取正的結果 (\\ ``+obj``\\ )。" -#: ../../library/operator.rst:175 +#: ../../library/operator.rst:189 msgid "Return ``a ** b``, for *a* and *b* numbers." msgstr "對於數字 *a* 和 *b*,回傳 ``a ** b``。" -#: ../../library/operator.rst:181 +#: ../../library/operator.rst:195 msgid "Return *a* shifted right by *b*." msgstr "回傳 *a* 右移 *b* 位的結果。" -#: ../../library/operator.rst:187 +#: ../../library/operator.rst:201 msgid "Return ``a - b``." msgstr "回傳 ``a - b``。" -#: ../../library/operator.rst:193 +#: ../../library/operator.rst:207 msgid "" "Return ``a / b`` where 2/3 is .66 rather than 0. This is also known as " "\"true\" division." msgstr "回傳 ``a / b``,例如 2/3 將等於 .66 而不是 0。這也被稱為「真」除法。" -#: ../../library/operator.rst:200 +#: ../../library/operator.rst:214 msgid "Return the bitwise exclusive or of *a* and *b*." msgstr "回傳 *a* 和 *b* 按位元異或 (exclusive or) 的結果。" -#: ../../library/operator.rst:203 +#: ../../library/operator.rst:217 msgid "" "Operations which work with sequences (some of them with mappings too) " "include:" msgstr "適用於序列的操作(其中一些也適用於對映 (mapping)),包括:" -#: ../../library/operator.rst:208 +#: ../../library/operator.rst:222 msgid "Return ``a + b`` for *a* and *b* sequences." msgstr "對於序列 *a* 和 *b*,回傳 ``a + b``。" -#: ../../library/operator.rst:214 +#: ../../library/operator.rst:228 msgid "Return the outcome of the test ``b in a``. Note the reversed operands." msgstr "回傳 ``b in a`` 檢測的結果。請注意運算元是反序的。" -#: ../../library/operator.rst:219 +#: ../../library/operator.rst:233 msgid "Return the number of occurrences of *b* in *a*." msgstr "回傳 *b* 在 *a* 中的出現次數。" -#: ../../library/operator.rst:225 +#: ../../library/operator.rst:239 msgid "Remove the value of *a* at index *b*." msgstr "移除 *a* 中索引為 *b* 的值。" -#: ../../library/operator.rst:231 +#: ../../library/operator.rst:245 msgid "Return the value of *a* at index *b*." msgstr "回傳 *a* 中索引為 *b* 的值。" -#: ../../library/operator.rst:236 +#: ../../library/operator.rst:250 msgid "Return the index of the first of occurrence of *b* in *a*." msgstr "回傳 *b* 在 *a* 中首次出現所在的索引。" -#: ../../library/operator.rst:242 +#: ../../library/operator.rst:256 msgid "Set the value of *a* at index *b* to *c*." msgstr "將 *a* 中索引為 *b* 的值設為 *c*。" -#: ../../library/operator.rst:247 +#: ../../library/operator.rst:261 msgid "" "Return an estimated length for the object *obj*. First try to return its " "actual length, then an estimate using :meth:`object.__length_hint__`, and " @@ -237,15 +247,15 @@ msgstr "" "回傳物件 *obj* 的估計長度。首先嘗試回傳其實際長度,再使" "用 :meth:`object.__length_hint__` 得出估計值,最後才是回傳預設值。" -#: ../../library/operator.rst:254 +#: ../../library/operator.rst:268 msgid "The following operation works with callables:" msgstr "以下操作適用於可呼叫物件:" -#: ../../library/operator.rst:259 +#: ../../library/operator.rst:273 msgid "Return ``obj(*args, **kwargs)``." msgstr "回傳 ``obj(*args, **kwargs)``。" -#: ../../library/operator.rst:264 +#: ../../library/operator.rst:278 msgid "" "The :mod:`operator` module also defines tools for generalized attribute and " "item lookups. These are useful for making fast field extractors as " @@ -257,7 +267,7 @@ msgstr "" "為 :func:`map`、:func:`sorted`、:meth:`itertools.groupby` 或其他需要函式引數" "的函式之引數。" -#: ../../library/operator.rst:273 +#: ../../library/operator.rst:287 msgid "" "Return a callable object that fetches *attr* from its operand. If more than " "one attribute is requested, returns a tuple of attributes. The attribute " @@ -266,11 +276,11 @@ msgstr "" "回傳一個可從運算元中取得 *attr* 的可呼叫 (callable) 物件。如果請求了一個以上" "的屬性,則回傳一個包含屬性的 tupple(元組)。屬性名稱還可包含點號。例如:" -#: ../../library/operator.rst:277 +#: ../../library/operator.rst:291 msgid "After ``f = attrgetter('name')``, the call ``f(b)`` returns ``b.name``." msgstr "在 ``f = attrgetter('name')`` 之後,呼叫 ``f(b)`` 將回傳 ``b.name``。" -#: ../../library/operator.rst:279 +#: ../../library/operator.rst:293 msgid "" "After ``f = attrgetter('name', 'date')``, the call ``f(b)`` returns " "``(b.name, b.date)``." @@ -278,7 +288,7 @@ msgstr "" "在 ``f = attrgetter('name', 'date')`` 之後,呼叫 ``f(b)`` 將回傳 ``(b.name, " "b.date)``。" -#: ../../library/operator.rst:282 +#: ../../library/operator.rst:296 msgid "" "After ``f = attrgetter('name.first', 'name.last')``, the call ``f(b)`` " "returns ``(b.name.first, b.name.last)``." @@ -286,12 +296,12 @@ msgstr "" "在 ``f = attrgetter('name.first', 'name.last')`` 之後,呼叫 ``f(b)`` 將回傳 " "``(b.name.first, b.name.last)``。" -#: ../../library/operator.rst:285 ../../library/operator.rst:317 -#: ../../library/operator.rst:365 +#: ../../library/operator.rst:299 ../../library/operator.rst:331 +#: ../../library/operator.rst:379 msgid "Equivalent to::" msgstr "等價於: ::" -#: ../../library/operator.rst:287 +#: ../../library/operator.rst:301 msgid "" "def attrgetter(*items):\n" " if any(not isinstance(item, str) for item in items):\n" @@ -327,7 +337,7 @@ msgstr "" " obj = getattr(obj, name)\n" " return obj" -#: ../../library/operator.rst:308 +#: ../../library/operator.rst:322 msgid "" "Return a callable object that fetches *item* from its operand using the " "operand's :meth:`~object.__getitem__` method. If multiple items are " @@ -336,11 +346,11 @@ msgstr "" "回傳一個使用運算元的 :meth:`~object.__getitem__` 方法從運算元中取得 *item* 的" "可呼叫物件。如果指定了多個條目,則回傳一個查詢值的 tupple。例如:" -#: ../../library/operator.rst:312 +#: ../../library/operator.rst:326 msgid "After ``f = itemgetter(2)``, the call ``f(r)`` returns ``r[2]``." msgstr "在 ``f = itemgetter(2)`` 之後,呼叫 ``f(r)`` 將回傳 ``r[2]``。" -#: ../../library/operator.rst:314 +#: ../../library/operator.rst:328 msgid "" "After ``g = itemgetter(2, 5, 3)``, the call ``g(r)`` returns ``(r[2], r[5], " "r[3])``." @@ -348,7 +358,7 @@ msgstr "" "在 ``g = itemgetter(2, 5, 3)`` 之後,呼叫 ``g(r)`` 將回傳 ``(r[2], r[5], " "r[3])``。" -#: ../../library/operator.rst:319 +#: ../../library/operator.rst:333 msgid "" "def itemgetter(*items):\n" " if len(items) == 1:\n" @@ -370,7 +380,7 @@ msgstr "" " return tuple(obj[item] for item in items)\n" " return g" -#: ../../library/operator.rst:329 +#: ../../library/operator.rst:343 msgid "" "The items can be any type accepted by the " "operand's :meth:`~object.__getitem__` method. Dictionaries accept " @@ -381,13 +391,13 @@ msgstr "" "dictionary(字典)接受任意\\ :term:`可雜湊 `\\ 的值。list、tupple " "和字串接受索引或切片:" -#: ../../library/operator.rst:343 +#: ../../library/operator.rst:357 msgid "" "Example of using :func:`itemgetter` to retrieve specific fields from a tuple " "record:" msgstr "使用 :func:`itemgetter` 從 tuple 中提取特定欄位的例子:" -#: ../../library/operator.rst:356 +#: ../../library/operator.rst:370 msgid "" "Return a callable object that calls the method *name* on its operand. If " "additional arguments and/or keyword arguments are given, they will be given " @@ -396,13 +406,13 @@ msgstr "" "回傳一個在運算元上呼叫 *name* method 的可呼叫物件。如果給定額外的引數和/或關" "鍵字引數,它們也將被傳給該 method。例如:" -#: ../../library/operator.rst:360 +#: ../../library/operator.rst:374 msgid "" "After ``f = methodcaller('name')``, the call ``f(b)`` returns ``b.name()``." msgstr "" "在 ``f = methodcaller('name')`` 之後,呼叫 ``f(b)`` 將回傳 ``b.name()``。" -#: ../../library/operator.rst:362 +#: ../../library/operator.rst:376 msgid "" "After ``f = methodcaller('name', 'foo', bar=1)``, the call ``f(b)`` returns " "``b.name('foo', bar=1)``." @@ -410,7 +420,7 @@ msgstr "" "在 ``f = methodcaller('name', 'foo', bar=1)`` 之後,呼叫 ``f(b)`` 將回傳 " "``b.name('foo', bar=1)``。" -#: ../../library/operator.rst:367 +#: ../../library/operator.rst:381 msgid "" "def methodcaller(name, /, *args, **kwargs):\n" " def caller(obj):\n" @@ -422,11 +432,11 @@ msgstr "" " return getattr(obj, name)(*args, **kwargs)\n" " return caller" -#: ../../library/operator.rst:376 +#: ../../library/operator.rst:390 msgid "Mapping Operators to Functions" msgstr "運算子與函式間的對映" -#: ../../library/operator.rst:378 +#: ../../library/operator.rst:392 msgid "" "This table shows how abstract operations correspond to operator symbols in " "the Python syntax and the functions in the :mod:`operator` module." @@ -434,424 +444,445 @@ msgstr "" "以下表格表示了抽象運算是如何對應於 Python 語法中的運算子和 :mod:`operator` " "module中的函式。" -#: ../../library/operator.rst:382 +#: ../../library/operator.rst:396 msgid "Operation" msgstr "運算" -#: ../../library/operator.rst:382 +#: ../../library/operator.rst:396 msgid "Syntax" msgstr "語法" -#: ../../library/operator.rst:382 +#: ../../library/operator.rst:396 msgid "Function" msgstr "函式" -#: ../../library/operator.rst:384 +#: ../../library/operator.rst:398 msgid "Addition" msgstr "加法" -#: ../../library/operator.rst:384 +#: ../../library/operator.rst:398 msgid "``a + b``" msgstr "``a + b``" -#: ../../library/operator.rst:384 +#: ../../library/operator.rst:398 msgid "``add(a, b)``" msgstr "``add(a, b)``" -#: ../../library/operator.rst:386 +#: ../../library/operator.rst:400 msgid "Concatenation" msgstr "字串串接" -#: ../../library/operator.rst:386 +#: ../../library/operator.rst:400 msgid "``seq1 + seq2``" msgstr "``seq1 + seq2``" -#: ../../library/operator.rst:386 +#: ../../library/operator.rst:400 msgid "``concat(seq1, seq2)``" msgstr "``concat(seq1, seq2)``" -#: ../../library/operator.rst:388 +#: ../../library/operator.rst:402 msgid "Containment Test" msgstr "包含性檢測" -#: ../../library/operator.rst:388 +#: ../../library/operator.rst:402 msgid "``obj in seq``" msgstr "``obj in seq``" -#: ../../library/operator.rst:388 +#: ../../library/operator.rst:402 msgid "``contains(seq, obj)``" msgstr "``contains(seq, obj)``" -#: ../../library/operator.rst:390 ../../library/operator.rst:392 +#: ../../library/operator.rst:404 ../../library/operator.rst:406 msgid "Division" msgstr "除法" -#: ../../library/operator.rst:390 +#: ../../library/operator.rst:404 msgid "``a / b``" msgstr "``a / b``" -#: ../../library/operator.rst:390 +#: ../../library/operator.rst:404 msgid "``truediv(a, b)``" msgstr "``truediv(a, b)``" -#: ../../library/operator.rst:392 +#: ../../library/operator.rst:406 msgid "``a // b``" msgstr "``a // b``" -#: ../../library/operator.rst:392 +#: ../../library/operator.rst:406 msgid "``floordiv(a, b)``" msgstr "``floordiv(a, b)``" -#: ../../library/operator.rst:394 +#: ../../library/operator.rst:408 msgid "Bitwise And" msgstr "按位元與 (And)" -#: ../../library/operator.rst:394 +#: ../../library/operator.rst:408 msgid "``a & b``" msgstr "``a & b``" -#: ../../library/operator.rst:394 +#: ../../library/operator.rst:408 msgid "``and_(a, b)``" msgstr "``and_(a, b)``" -#: ../../library/operator.rst:396 +#: ../../library/operator.rst:410 msgid "Bitwise Exclusive Or" msgstr "按位元互斥或 (Exclusive Or)" -#: ../../library/operator.rst:396 +#: ../../library/operator.rst:410 msgid "``a ^ b``" msgstr "``a ^ b``" -#: ../../library/operator.rst:396 +#: ../../library/operator.rst:410 msgid "``xor(a, b)``" msgstr "``xor(a, b)``" -#: ../../library/operator.rst:398 +#: ../../library/operator.rst:412 msgid "Bitwise Inversion" msgstr "按位元取反 (Inversion)" -#: ../../library/operator.rst:398 +#: ../../library/operator.rst:412 msgid "``~ a``" msgstr "``~ a``" -#: ../../library/operator.rst:398 +#: ../../library/operator.rst:412 msgid "``invert(a)``" msgstr "``invert(a)``" -#: ../../library/operator.rst:400 +#: ../../library/operator.rst:414 msgid "Bitwise Or" msgstr "按位元或 (Or)" -#: ../../library/operator.rst:400 +#: ../../library/operator.rst:414 msgid "``a | b``" msgstr "``a | b``" -#: ../../library/operator.rst:400 +#: ../../library/operator.rst:414 msgid "``or_(a, b)``" msgstr "``or_(a, b)``" -#: ../../library/operator.rst:402 +#: ../../library/operator.rst:416 msgid "Exponentiation" msgstr "取冪" -#: ../../library/operator.rst:402 +#: ../../library/operator.rst:416 msgid "``a ** b``" msgstr "``a ** b``" -#: ../../library/operator.rst:402 +#: ../../library/operator.rst:416 msgid "``pow(a, b)``" msgstr "``pow(a, b)``" -#: ../../library/operator.rst:404 ../../library/operator.rst:406 +#: ../../library/operator.rst:418 ../../library/operator.rst:420 +#: ../../library/operator.rst:422 ../../library/operator.rst:424 msgid "Identity" msgstr "識別性" -#: ../../library/operator.rst:404 +#: ../../library/operator.rst:418 msgid "``a is b``" msgstr "``a is b``" -#: ../../library/operator.rst:404 +#: ../../library/operator.rst:418 msgid "``is_(a, b)``" msgstr "``is_(a, b)``" -#: ../../library/operator.rst:406 +#: ../../library/operator.rst:420 msgid "``a is not b``" msgstr "``a is not b``" -#: ../../library/operator.rst:406 +#: ../../library/operator.rst:420 msgid "``is_not(a, b)``" msgstr "``is_not(a, b)``" -#: ../../library/operator.rst:408 +#: ../../library/operator.rst:422 +#, fuzzy +msgid "``a is None``" +msgstr "``a is b``" + +#: ../../library/operator.rst:422 +#, fuzzy +msgid "``is_none(a)``" +msgstr "``is_not(a, b)``" + +#: ../../library/operator.rst:424 +#, fuzzy +msgid "``a is not None``" +msgstr "``a is not b``" + +#: ../../library/operator.rst:424 +#, fuzzy +msgid "``is_not_none(a)``" +msgstr "``is_not(a, b)``" + +#: ../../library/operator.rst:426 msgid "Indexed Assignment" msgstr "索引賦值" -#: ../../library/operator.rst:408 +#: ../../library/operator.rst:426 msgid "``obj[k] = v``" msgstr "``obj[k] = v``" -#: ../../library/operator.rst:408 +#: ../../library/operator.rst:426 msgid "``setitem(obj, k, v)``" msgstr "``setitem(obj, k, v)``" -#: ../../library/operator.rst:410 +#: ../../library/operator.rst:428 msgid "Indexed Deletion" msgstr "索引刪除" -#: ../../library/operator.rst:410 +#: ../../library/operator.rst:428 msgid "``del obj[k]``" msgstr "``del obj[k]``" -#: ../../library/operator.rst:410 +#: ../../library/operator.rst:428 msgid "``delitem(obj, k)``" msgstr "``delitem(obj, k)``" -#: ../../library/operator.rst:412 +#: ../../library/operator.rst:430 msgid "Indexing" msgstr "索引取值" -#: ../../library/operator.rst:412 +#: ../../library/operator.rst:430 msgid "``obj[k]``" msgstr "``obj[k]``" -#: ../../library/operator.rst:412 +#: ../../library/operator.rst:430 msgid "``getitem(obj, k)``" msgstr "``getitem(obj, k)``" -#: ../../library/operator.rst:414 +#: ../../library/operator.rst:432 msgid "Left Shift" msgstr "左移" -#: ../../library/operator.rst:414 +#: ../../library/operator.rst:432 msgid "``a << b``" msgstr "``a << b``" -#: ../../library/operator.rst:414 +#: ../../library/operator.rst:432 msgid "``lshift(a, b)``" msgstr "``lshift(a, b)``" -#: ../../library/operator.rst:416 +#: ../../library/operator.rst:434 msgid "Modulo" msgstr "模除 (Modulo)" -#: ../../library/operator.rst:416 +#: ../../library/operator.rst:434 msgid "``a % b``" msgstr "``a % b``" -#: ../../library/operator.rst:416 +#: ../../library/operator.rst:434 msgid "``mod(a, b)``" msgstr "``mod(a, b)``" -#: ../../library/operator.rst:418 +#: ../../library/operator.rst:436 msgid "Multiplication" msgstr "乘法" -#: ../../library/operator.rst:418 +#: ../../library/operator.rst:436 msgid "``a * b``" msgstr "``a * b``" -#: ../../library/operator.rst:418 +#: ../../library/operator.rst:436 msgid "``mul(a, b)``" msgstr "``mul(a, b)``" -#: ../../library/operator.rst:420 +#: ../../library/operator.rst:438 msgid "Matrix Multiplication" msgstr "矩陣乘法" -#: ../../library/operator.rst:420 +#: ../../library/operator.rst:438 msgid "``a @ b``" msgstr "``a @ b``" -#: ../../library/operator.rst:420 +#: ../../library/operator.rst:438 msgid "``matmul(a, b)``" msgstr "``matmul(a, b)``" -#: ../../library/operator.rst:422 +#: ../../library/operator.rst:440 msgid "Negation (Arithmetic)" msgstr "反相(算術)" -#: ../../library/operator.rst:422 +#: ../../library/operator.rst:440 msgid "``- a``" msgstr "``- a``" -#: ../../library/operator.rst:422 +#: ../../library/operator.rst:440 msgid "``neg(a)``" msgstr "``neg(a)``" -#: ../../library/operator.rst:424 +#: ../../library/operator.rst:442 msgid "Negation (Logical)" msgstr "反相(邏輯)" -#: ../../library/operator.rst:424 +#: ../../library/operator.rst:442 msgid "``not a``" msgstr "``not a``" -#: ../../library/operator.rst:424 +#: ../../library/operator.rst:442 msgid "``not_(a)``" msgstr "``not_(a)``" -#: ../../library/operator.rst:426 +#: ../../library/operator.rst:444 msgid "Positive" msgstr "正數" -#: ../../library/operator.rst:426 +#: ../../library/operator.rst:444 msgid "``+ a``" msgstr "``+ a``" -#: ../../library/operator.rst:426 +#: ../../library/operator.rst:444 msgid "``pos(a)``" msgstr "``pos(a)``" -#: ../../library/operator.rst:428 +#: ../../library/operator.rst:446 msgid "Right Shift" msgstr "右移" -#: ../../library/operator.rst:428 +#: ../../library/operator.rst:446 msgid "``a >> b``" msgstr "``a >> b``" -#: ../../library/operator.rst:428 +#: ../../library/operator.rst:446 msgid "``rshift(a, b)``" msgstr "``rshift(a, b)``" -#: ../../library/operator.rst:430 +#: ../../library/operator.rst:448 msgid "Slice Assignment" msgstr "切片賦值" -#: ../../library/operator.rst:430 +#: ../../library/operator.rst:448 msgid "``seq[i:j] = values``" msgstr "``seq[i:j] = values``" -#: ../../library/operator.rst:430 +#: ../../library/operator.rst:448 msgid "``setitem(seq, slice(i, j), values)``" msgstr "``setitem(seq, slice(i, j), values)``" -#: ../../library/operator.rst:432 +#: ../../library/operator.rst:450 msgid "Slice Deletion" msgstr "切片刪除" -#: ../../library/operator.rst:432 +#: ../../library/operator.rst:450 msgid "``del seq[i:j]``" msgstr "``del seq[i:j]``" -#: ../../library/operator.rst:432 +#: ../../library/operator.rst:450 msgid "``delitem(seq, slice(i, j))``" msgstr "``delitem(seq, slice(i, j))``" -#: ../../library/operator.rst:434 +#: ../../library/operator.rst:452 msgid "Slicing" msgstr "切片取值" -#: ../../library/operator.rst:434 +#: ../../library/operator.rst:452 msgid "``seq[i:j]``" msgstr "``seq[i:j]``" -#: ../../library/operator.rst:434 +#: ../../library/operator.rst:452 msgid "``getitem(seq, slice(i, j))``" msgstr "``getitem(seq, slice(i, j))``" -#: ../../library/operator.rst:436 +#: ../../library/operator.rst:454 msgid "String Formatting" msgstr "字串格式化" -#: ../../library/operator.rst:436 +#: ../../library/operator.rst:454 msgid "``s % obj``" msgstr "``s % obj``" -#: ../../library/operator.rst:436 +#: ../../library/operator.rst:454 msgid "``mod(s, obj)``" msgstr "``mod(s, obj)``" -#: ../../library/operator.rst:438 +#: ../../library/operator.rst:456 msgid "Subtraction" msgstr "減法" -#: ../../library/operator.rst:438 +#: ../../library/operator.rst:456 msgid "``a - b``" msgstr "``a - b``" -#: ../../library/operator.rst:438 +#: ../../library/operator.rst:456 msgid "``sub(a, b)``" msgstr "``sub(a, b)``" -#: ../../library/operator.rst:440 +#: ../../library/operator.rst:458 msgid "Truth Test" msgstr "真值檢測" -#: ../../library/operator.rst:440 +#: ../../library/operator.rst:458 msgid "``obj``" msgstr "``obj``" -#: ../../library/operator.rst:440 +#: ../../library/operator.rst:458 msgid "``truth(obj)``" msgstr "``truth(obj)``" -#: ../../library/operator.rst:442 ../../library/operator.rst:444 -#: ../../library/operator.rst:450 ../../library/operator.rst:452 +#: ../../library/operator.rst:460 ../../library/operator.rst:462 +#: ../../library/operator.rst:468 ../../library/operator.rst:470 msgid "Ordering" msgstr "比較大小" -#: ../../library/operator.rst:442 +#: ../../library/operator.rst:460 msgid "``a < b``" msgstr "``a < b``" -#: ../../library/operator.rst:442 +#: ../../library/operator.rst:460 msgid "``lt(a, b)``" msgstr "``lt(a, b)``" -#: ../../library/operator.rst:444 +#: ../../library/operator.rst:462 msgid "``a <= b``" msgstr "``a <= b``" -#: ../../library/operator.rst:444 +#: ../../library/operator.rst:462 msgid "``le(a, b)``" msgstr "``le(a, b)``" -#: ../../library/operator.rst:446 +#: ../../library/operator.rst:464 msgid "Equality" msgstr "相等性" -#: ../../library/operator.rst:446 +#: ../../library/operator.rst:464 msgid "``a == b``" msgstr "``a == b``" -#: ../../library/operator.rst:446 +#: ../../library/operator.rst:464 msgid "``eq(a, b)``" msgstr "``eq(a, b)``" -#: ../../library/operator.rst:448 +#: ../../library/operator.rst:466 msgid "Difference" msgstr "不等性" -#: ../../library/operator.rst:448 +#: ../../library/operator.rst:466 msgid "``a != b``" msgstr "``a != b``" -#: ../../library/operator.rst:448 +#: ../../library/operator.rst:466 msgid "``ne(a, b)``" msgstr "``ne(a, b)``" -#: ../../library/operator.rst:450 +#: ../../library/operator.rst:468 msgid "``a >= b``" msgstr "``a >= b``" -#: ../../library/operator.rst:450 +#: ../../library/operator.rst:468 msgid "``ge(a, b)``" msgstr "``ge(a, b)``" -#: ../../library/operator.rst:452 +#: ../../library/operator.rst:470 msgid "``a > b``" msgstr "``a > b``" -#: ../../library/operator.rst:452 +#: ../../library/operator.rst:470 msgid "``gt(a, b)``" msgstr "``gt(a, b)``" -#: ../../library/operator.rst:456 +#: ../../library/operator.rst:474 msgid "In-place Operators" msgstr "原地 (in-place) 運算子" -#: ../../library/operator.rst:458 +#: ../../library/operator.rst:476 msgid "" "Many operations have an \"in-place\" version. Listed below are functions " "providing a more primitive access to in-place operators than the usual " @@ -865,7 +896,7 @@ msgstr "" "operator.iadd(x, y)``。換一種方式來講就是 ``z = operator.iadd(x, y)`` 等價於" "複合陳述式 ``z = x; z += y``。" -#: ../../library/operator.rst:465 +#: ../../library/operator.rst:483 msgid "" "In those examples, note that when an in-place method is called, the " "computation and assignment are performed in two separate steps. The in-" @@ -875,7 +906,7 @@ msgstr "" "在這些例子中,請注意當呼叫一個原地方法時,運算和賦值是分成兩個步驟來執行的。" "下面列出的原地函式只執行第一步,即呼叫原地方法,第二步賦值則不加處理。" -#: ../../library/operator.rst:470 +#: ../../library/operator.rst:488 msgid "" "For immutable targets such as strings, numbers, and tuples, the updated " "value is computed, but not assigned back to the input variable:" @@ -883,7 +914,7 @@ msgstr "" "對於不可變 (immutable) 的目標例如字串、數字和 tupple,更新的值會被計算,但不" "會被再被賦值給輸入變數:" -#: ../../library/operator.rst:479 +#: ../../library/operator.rst:497 msgid "" "For mutable targets such as lists and dictionaries, the in-place method will " "perform the update, so no subsequent assignment is necessary:" @@ -891,59 +922,59 @@ msgstr "" "對於可變 (mutable) 的目標例如 list 和 dictionary,原地方法將執行更新,因此不" "需要後續賦值操作:" -#: ../../library/operator.rst:491 +#: ../../library/operator.rst:509 msgid "``a = iadd(a, b)`` is equivalent to ``a += b``." msgstr "``a = iadd(a, b)`` 等價於 ``a += b``。" -#: ../../library/operator.rst:497 +#: ../../library/operator.rst:515 msgid "``a = iand(a, b)`` is equivalent to ``a &= b``." msgstr "``a = iand(a, b)`` 等價於 ``a &= b``。" -#: ../../library/operator.rst:503 +#: ../../library/operator.rst:521 msgid "" "``a = iconcat(a, b)`` is equivalent to ``a += b`` for *a* and *b* sequences." msgstr "``a = iconcat(a, b)`` 等價於 ``a += b``,其中 *a* 和 *b* 為序列。" -#: ../../library/operator.rst:509 +#: ../../library/operator.rst:527 msgid "``a = ifloordiv(a, b)`` is equivalent to ``a //= b``." msgstr "``a = ifloordiv(a, b)`` 等價於 ``a //= b``。" -#: ../../library/operator.rst:515 +#: ../../library/operator.rst:533 msgid "``a = ilshift(a, b)`` is equivalent to ``a <<= b``." msgstr "``a = ilshift(a, b)`` 等價於 ``a <<= b``。" -#: ../../library/operator.rst:521 +#: ../../library/operator.rst:539 msgid "``a = imod(a, b)`` is equivalent to ``a %= b``." msgstr "``a = imod(a, b)`` 等價於 ``a %= b``。" -#: ../../library/operator.rst:527 +#: ../../library/operator.rst:545 msgid "``a = imul(a, b)`` is equivalent to ``a *= b``." msgstr "``a = imul(a, b)`` 等價於 ``a *= b``。" -#: ../../library/operator.rst:533 +#: ../../library/operator.rst:551 msgid "``a = imatmul(a, b)`` is equivalent to ``a @= b``." msgstr "``a = imatmul(a, b)`` 等價於 ``a @= b``。" -#: ../../library/operator.rst:541 +#: ../../library/operator.rst:559 msgid "``a = ior(a, b)`` is equivalent to ``a |= b``." msgstr "``a = ior(a, b)`` 等價於 ``a |= b``。" -#: ../../library/operator.rst:547 +#: ../../library/operator.rst:565 msgid "``a = ipow(a, b)`` is equivalent to ``a **= b``." msgstr "``a = ipow(a, b)`` 等價於 ``a **= b``。" -#: ../../library/operator.rst:553 +#: ../../library/operator.rst:571 msgid "``a = irshift(a, b)`` is equivalent to ``a >>= b``." msgstr "``a = irshift(a, b)`` 等價於 ``a >>= b``。" -#: ../../library/operator.rst:559 +#: ../../library/operator.rst:577 msgid "``a = isub(a, b)`` is equivalent to ``a -= b``." msgstr "``a = isub(a, b)`` 等價於 ``a -= b``。" -#: ../../library/operator.rst:565 +#: ../../library/operator.rst:583 msgid "``a = itruediv(a, b)`` is equivalent to ``a /= b``." msgstr "``a = itruediv(a, b)`` 等價於 ``a /= b``。" -#: ../../library/operator.rst:571 +#: ../../library/operator.rst:589 msgid "``a = ixor(a, b)`` is equivalent to ``a ^= b``." msgstr "``a = ixor(a, b)`` 等價於 ``a ^= b``。" diff --git a/library/os.po b/library/os.po index 09e8c4943f5..a97fe057bfc 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-30 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-04-29 15:24+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,10 +31,10 @@ msgid "" "This module provides a portable way of using operating system dependent " "functionality. If you just want to read or write a file see :func:`open`, " "if you want to manipulate paths, see the :mod:`os.path` module, and if you " -"want to read all the lines in all the files on the command line see the :mod:" -"`fileinput` module. For creating temporary files and directories see the :" -"mod:`tempfile` module, and for high-level file and directory handling see " -"the :mod:`shutil` module." +"want to read all the lines in all the files on the command line see " +"the :mod:`fileinput` module. For creating temporary files and directories " +"see the :mod:`tempfile` module, and for high-level file and directory " +"handling see the :mod:`shutil` module." msgstr "" "該模組提供了一種便利的方式來操作與作業系統相關的功能。如果你想讀取或寫入檔" "案,請參閱 :func:`open` ,如果你想操作檔案路徑,請參閱 :mod:`os.path` 模組," @@ -84,11 +84,11 @@ msgstr "在 VxWorks, 不支援 os.popen、os.fork、os.execv 和 os.spawn*p*。" #: ../../library/os.rst:37 msgid "" "On WebAssembly platforms, Android and iOS, large parts of the :mod:`os` " -"module are not available or behave differently. APIs related to processes (e." -"g. :func:`~os.fork`, :func:`~os.execve`) and resources (e.g. :func:`~os." -"nice`) are not available. Others like :func:`~os.getuid` and :func:`~os." -"getpid` are emulated or stubs. WebAssembly platforms also lack support for " -"signals (e.g. :func:`~os.kill`, :func:`~os.wait`)." +"module are not available or behave differently. APIs related to processes " +"(e.g. :func:`~os.fork`, :func:`~os.execve`) and resources " +"(e.g. :func:`~os.nice`) are not available. Others like :func:`~os.getuid` " +"and :func:`~os.getpid` are emulated or stubs. WebAssembly platforms also " +"lack support for signals (e.g. :func:`~os.kill`, :func:`~os.wait`)." msgstr "" "在 WebAssembly 平台和 Android 與 iOS 上,大部分 :mod:`os` 模組無法使用或行為" "不同。與行程 (process)(例如 :func:`~os.fork`、:func:`~os.execve`\\ )與資源" @@ -143,9 +143,9 @@ msgstr "" #: ../../library/os.rst:82 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " -"startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." -"filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :" -"c:type:`PyConfig`." +"startup by the :c:func:`PyConfig_Read` function: " +"see :c:member:`~PyConfig.filesystem_encoding` " +"and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." msgstr "" #: ../../library/os.rst:87 @@ -161,8 +161,8 @@ msgstr "" msgid "" "The :term:`file system encoding ` " "must guarantee to successfully decode all bytes below 128. If the file " -"system encoding fails to provide this guarantee, API functions can raise :" -"exc:`UnicodeError`." +"system encoding fails to provide this guarantee, API functions can " +"raise :exc:`UnicodeError`." msgstr "" #: ../../library/os.rst:100 @@ -220,9 +220,9 @@ msgstr "在 Unix 中,:func:`os.device_encoding` 回傳 ``'utf-8'`` 而非裝 #: ../../library/os.rst:127 msgid "" -"Note that the standard stream settings in UTF-8 mode can be overridden by :" -"envvar:`PYTHONIOENCODING` (just as they can be in the default locale-aware " -"mode)." +"Note that the standard stream settings in UTF-8 mode can be overridden " +"by :envvar:`PYTHONIOENCODING` (just as they can be in the default locale-" +"aware mode)." msgstr "" "請注意,在 UTF-8 模式中,標準的串流設定會被 :envvar:`PYTHONIOENCODING` 覆蓋" "(如同在預設在地化覺察 模式一樣)。" @@ -282,8 +282,8 @@ msgstr "" #: ../../library/os.rst:159 msgid "" -"See also the :ref:`UTF-8 mode on Windows ` and the :term:" -"`filesystem encoding and error handler`." +"See also the :ref:`UTF-8 mode on Windows ` and " +"the :term:`filesystem encoding and error handler`." msgstr "" #: ../../library/os.rst:164 @@ -309,93 +309,93 @@ msgid "" "Return the filename corresponding to the controlling terminal of the process." msgstr "" -#: ../../library/os.rst:181 ../../library/os.rst:323 ../../library/os.rst:338 -#: ../../library/os.rst:359 ../../library/os.rst:368 ../../library/os.rst:377 -#: ../../library/os.rst:390 ../../library/os.rst:399 ../../library/os.rst:427 -#: ../../library/os.rst:435 ../../library/os.rst:443 ../../library/os.rst:463 -#: ../../library/os.rst:481 ../../library/os.rst:492 ../../library/os.rst:504 -#: ../../library/os.rst:513 ../../library/os.rst:523 ../../library/os.rst:534 -#: ../../library/os.rst:546 ../../library/os.rst:580 ../../library/os.rst:587 -#: ../../library/os.rst:594 ../../library/os.rst:603 ../../library/os.rst:640 -#: ../../library/os.rst:653 ../../library/os.rst:662 ../../library/os.rst:679 -#: ../../library/os.rst:688 ../../library/os.rst:695 ../../library/os.rst:704 -#: ../../library/os.rst:713 ../../library/os.rst:720 ../../library/os.rst:727 -#: ../../library/os.rst:736 ../../library/os.rst:793 ../../library/os.rst:832 -#: ../../library/os.rst:954 ../../library/os.rst:980 ../../library/os.rst:993 -#: ../../library/os.rst:1010 ../../library/os.rst:1028 -#: ../../library/os.rst:1039 ../../library/os.rst:1062 -#: ../../library/os.rst:1083 ../../library/os.rst:1095 -#: ../../library/os.rst:1106 ../../library/os.rst:1119 -#: ../../library/os.rst:1140 ../../library/os.rst:1161 -#: ../../library/os.rst:1173 ../../library/os.rst:1184 -#: ../../library/os.rst:1245 ../../library/os.rst:1368 -#: ../../library/os.rst:1380 ../../library/os.rst:1394 -#: ../../library/os.rst:1404 ../../library/os.rst:1419 -#: ../../library/os.rst:1434 ../../library/os.rst:1447 -#: ../../library/os.rst:1464 ../../library/os.rst:1490 -#: ../../library/os.rst:1507 ../../library/os.rst:1521 -#: ../../library/os.rst:1536 ../../library/os.rst:1548 -#: ../../library/os.rst:1575 ../../library/os.rst:1587 -#: ../../library/os.rst:1597 ../../library/os.rst:1611 -#: ../../library/os.rst:1663 ../../library/os.rst:1683 -#: ../../library/os.rst:1692 ../../library/os.rst:1704 -#: ../../library/os.rst:1739 ../../library/os.rst:1763 -#: ../../library/os.rst:1773 ../../library/os.rst:1781 -#: ../../library/os.rst:1790 ../../library/os.rst:1801 -#: ../../library/os.rst:1838 ../../library/os.rst:1865 -#: ../../library/os.rst:1916 ../../library/os.rst:1922 -#: ../../library/os.rst:2088 ../../library/os.rst:2165 -#: ../../library/os.rst:2182 ../../library/os.rst:2196 -#: ../../library/os.rst:2222 ../../library/os.rst:2240 -#: ../../library/os.rst:2256 ../../library/os.rst:2272 -#: ../../library/os.rst:2335 ../../library/os.rst:2359 -#: ../../library/os.rst:2379 ../../library/os.rst:2515 -#: ../../library/os.rst:2537 ../../library/os.rst:2581 -#: ../../library/os.rst:2593 ../../library/os.rst:2615 -#: ../../library/os.rst:3323 ../../library/os.rst:3457 -#: ../../library/os.rst:3480 ../../library/os.rst:3494 -#: ../../library/os.rst:3714 ../../library/os.rst:3739 -#: ../../library/os.rst:3764 ../../library/os.rst:3818 -#: ../../library/os.rst:3827 ../../library/os.rst:3836 -#: ../../library/os.rst:3844 ../../library/os.rst:3853 -#: ../../library/os.rst:3862 ../../library/os.rst:3934 -#: ../../library/os.rst:3997 ../../library/os.rst:4007 -#: ../../library/os.rst:4025 ../../library/os.rst:4034 -#: ../../library/os.rst:4044 ../../library/os.rst:4054 -#: ../../library/os.rst:4064 ../../library/os.rst:4075 -#: ../../library/os.rst:4220 ../../library/os.rst:4289 -#: ../../library/os.rst:4324 ../../library/os.rst:4332 -#: ../../library/os.rst:4339 ../../library/os.rst:4346 -#: ../../library/os.rst:4353 ../../library/os.rst:4360 -#: ../../library/os.rst:4367 ../../library/os.rst:4374 -#: ../../library/os.rst:4382 ../../library/os.rst:4390 -#: ../../library/os.rst:4397 ../../library/os.rst:4404 -#: ../../library/os.rst:4413 ../../library/os.rst:4421 -#: ../../library/os.rst:4429 ../../library/os.rst:4436 -#: ../../library/os.rst:4443 ../../library/os.rst:4492 -#: ../../library/os.rst:4519 ../../library/os.rst:4542 -#: ../../library/os.rst:4558 ../../library/os.rst:4565 -#: ../../library/os.rst:4576 ../../library/os.rst:4586 -#: ../../library/os.rst:4595 ../../library/os.rst:4627 -#: ../../library/os.rst:4735 ../../library/os.rst:4751 -#: ../../library/os.rst:4784 ../../library/os.rst:4853 -#: ../../library/os.rst:4872 ../../library/os.rst:4883 -#: ../../library/os.rst:4895 ../../library/os.rst:4940 -#: ../../library/os.rst:4977 ../../library/os.rst:5000 -#: ../../library/os.rst:5021 ../../library/os.rst:5055 -#: ../../library/os.rst:5096 ../../library/os.rst:5116 -#: ../../library/os.rst:5130 ../../library/os.rst:5147 -#: ../../library/os.rst:5162 ../../library/os.rst:5173 -#: ../../library/os.rst:5185 ../../library/os.rst:5198 -#: ../../library/os.rst:5207 ../../library/os.rst:5217 -#: ../../library/os.rst:5230 ../../library/os.rst:5265 -#: ../../library/os.rst:5281 ../../library/os.rst:5292 -#: ../../library/os.rst:5304 ../../library/os.rst:5311 -#: ../../library/os.rst:5320 ../../library/os.rst:5329 -#: ../../library/os.rst:5338 ../../library/os.rst:5347 -#: ../../library/os.rst:5499 ../../library/os.rst:5508 -#: ../../library/os.rst:5532 ../../library/os.rst:5559 -#: ../../library/os.rst:5568 ../../library/os.rst:5691 +#: ../../library/os.rst:181 ../../library/os.rst:345 ../../library/os.rst:360 +#: ../../library/os.rst:381 ../../library/os.rst:390 ../../library/os.rst:399 +#: ../../library/os.rst:412 ../../library/os.rst:421 ../../library/os.rst:449 +#: ../../library/os.rst:457 ../../library/os.rst:465 ../../library/os.rst:485 +#: ../../library/os.rst:503 ../../library/os.rst:514 ../../library/os.rst:526 +#: ../../library/os.rst:535 ../../library/os.rst:545 ../../library/os.rst:556 +#: ../../library/os.rst:568 ../../library/os.rst:604 ../../library/os.rst:611 +#: ../../library/os.rst:618 ../../library/os.rst:627 ../../library/os.rst:664 +#: ../../library/os.rst:677 ../../library/os.rst:686 ../../library/os.rst:703 +#: ../../library/os.rst:712 ../../library/os.rst:719 ../../library/os.rst:728 +#: ../../library/os.rst:737 ../../library/os.rst:744 ../../library/os.rst:751 +#: ../../library/os.rst:760 ../../library/os.rst:817 ../../library/os.rst:858 +#: ../../library/os.rst:980 ../../library/os.rst:1006 ../../library/os.rst:1019 +#: ../../library/os.rst:1036 ../../library/os.rst:1054 +#: ../../library/os.rst:1065 ../../library/os.rst:1088 +#: ../../library/os.rst:1109 ../../library/os.rst:1121 +#: ../../library/os.rst:1132 ../../library/os.rst:1145 +#: ../../library/os.rst:1166 ../../library/os.rst:1187 +#: ../../library/os.rst:1199 ../../library/os.rst:1210 +#: ../../library/os.rst:1271 ../../library/os.rst:1394 +#: ../../library/os.rst:1406 ../../library/os.rst:1420 +#: ../../library/os.rst:1430 ../../library/os.rst:1445 +#: ../../library/os.rst:1460 ../../library/os.rst:1473 +#: ../../library/os.rst:1490 ../../library/os.rst:1516 +#: ../../library/os.rst:1533 ../../library/os.rst:1547 +#: ../../library/os.rst:1562 ../../library/os.rst:1574 +#: ../../library/os.rst:1601 ../../library/os.rst:1613 +#: ../../library/os.rst:1623 ../../library/os.rst:1637 +#: ../../library/os.rst:1716 ../../library/os.rst:1736 +#: ../../library/os.rst:1745 ../../library/os.rst:1757 +#: ../../library/os.rst:1811 ../../library/os.rst:1835 +#: ../../library/os.rst:1845 ../../library/os.rst:1853 +#: ../../library/os.rst:1862 ../../library/os.rst:1873 +#: ../../library/os.rst:1910 ../../library/os.rst:1937 +#: ../../library/os.rst:1988 ../../library/os.rst:1994 +#: ../../library/os.rst:2160 ../../library/os.rst:2237 +#: ../../library/os.rst:2254 ../../library/os.rst:2268 +#: ../../library/os.rst:2294 ../../library/os.rst:2312 +#: ../../library/os.rst:2328 ../../library/os.rst:2345 +#: ../../library/os.rst:2408 ../../library/os.rst:2432 +#: ../../library/os.rst:2452 ../../library/os.rst:2588 +#: ../../library/os.rst:2610 ../../library/os.rst:2654 +#: ../../library/os.rst:2666 ../../library/os.rst:2688 +#: ../../library/os.rst:3396 ../../library/os.rst:3530 +#: ../../library/os.rst:3553 ../../library/os.rst:3567 +#: ../../library/os.rst:3787 ../../library/os.rst:3812 +#: ../../library/os.rst:3837 ../../library/os.rst:3891 +#: ../../library/os.rst:3900 ../../library/os.rst:3909 +#: ../../library/os.rst:3917 ../../library/os.rst:3926 +#: ../../library/os.rst:3935 ../../library/os.rst:4007 +#: ../../library/os.rst:4070 ../../library/os.rst:4080 +#: ../../library/os.rst:4098 ../../library/os.rst:4107 +#: ../../library/os.rst:4117 ../../library/os.rst:4127 +#: ../../library/os.rst:4137 ../../library/os.rst:4148 +#: ../../library/os.rst:4293 ../../library/os.rst:4362 +#: ../../library/os.rst:4397 ../../library/os.rst:4405 +#: ../../library/os.rst:4412 ../../library/os.rst:4419 +#: ../../library/os.rst:4426 ../../library/os.rst:4433 +#: ../../library/os.rst:4440 ../../library/os.rst:4447 +#: ../../library/os.rst:4455 ../../library/os.rst:4463 +#: ../../library/os.rst:4470 ../../library/os.rst:4477 +#: ../../library/os.rst:4486 ../../library/os.rst:4494 +#: ../../library/os.rst:4502 ../../library/os.rst:4509 +#: ../../library/os.rst:4516 ../../library/os.rst:4565 +#: ../../library/os.rst:4592 ../../library/os.rst:4615 +#: ../../library/os.rst:4631 ../../library/os.rst:4638 +#: ../../library/os.rst:4649 ../../library/os.rst:4659 +#: ../../library/os.rst:4668 ../../library/os.rst:4700 +#: ../../library/os.rst:4812 ../../library/os.rst:4828 +#: ../../library/os.rst:4861 ../../library/os.rst:4930 +#: ../../library/os.rst:4953 ../../library/os.rst:4964 +#: ../../library/os.rst:4976 ../../library/os.rst:5021 +#: ../../library/os.rst:5058 ../../library/os.rst:5081 +#: ../../library/os.rst:5102 ../../library/os.rst:5136 +#: ../../library/os.rst:5177 ../../library/os.rst:5197 +#: ../../library/os.rst:5211 ../../library/os.rst:5228 +#: ../../library/os.rst:5243 ../../library/os.rst:5254 +#: ../../library/os.rst:5266 ../../library/os.rst:5279 +#: ../../library/os.rst:5288 ../../library/os.rst:5298 +#: ../../library/os.rst:5311 ../../library/os.rst:5346 +#: ../../library/os.rst:5362 ../../library/os.rst:5373 +#: ../../library/os.rst:5385 ../../library/os.rst:5392 +#: ../../library/os.rst:5401 ../../library/os.rst:5410 +#: ../../library/os.rst:5419 ../../library/os.rst:5428 +#: ../../library/os.rst:5592 ../../library/os.rst:5601 +#: ../../library/os.rst:5625 ../../library/os.rst:5652 +#: ../../library/os.rst:5661 ../../library/os.rst:5784 msgid "Availability" msgstr "可用性" @@ -411,9 +411,9 @@ msgstr "" msgid "" "This mapping is captured the first time the :mod:`os` module is imported, " "typically during Python startup as part of processing :file:`site.py`. " -"Changes to the environment made after this time are not reflected in :data:" -"`os.environ`, except for changes made by modifying :data:`os.environ` " -"directly." +"Changes to the environment made after this time are not reflected " +"in :data:`os.environ`, except for changes made by " +"modifying :data:`os.environ` directly." msgstr "" #: ../../library/os.rst:196 @@ -442,8 +442,8 @@ msgid "" "Calling :func:`putenv` directly does not change :data:`os.environ`, so it's " "better to modify :data:`os.environ`." msgstr "" -"呼叫 :func:`putenv` 並不會改變 :data:`os.environ`,所以建議直接修改 :data:" -"`os.environ`。" +"呼叫 :func:`putenv` 並不會改變 :data:`os.environ`,所以建議直接修" +"改 :data:`os.environ`。" #: ../../library/os.rst:216 msgid "" @@ -453,66 +453,91 @@ msgstr "" #: ../../library/os.rst:220 msgid "" -"You can delete items in this mapping to unset environment variables. :func:" -"`unsetenv` will be called automatically when an item is deleted from :data:" -"`os.environ`, and when one of the :meth:`pop` or :meth:`clear` methods is " -"called." +"You can delete items in this mapping to unset environment " +"variables. :func:`unsetenv` will be called automatically when an item is " +"deleted from :data:`os.environ`, and when one of the :meth:`pop` " +"or :meth:`clear` methods is called." msgstr "" -#: ../../library/os.rst:225 ../../library/os.rst:241 +#: ../../library/os.rst:227 +#, fuzzy +msgid "The :func:`os.reload_environ` function." +msgstr ":func:`~os.setns` 函式。" + +#: ../../library/os.rst:229 ../../library/os.rst:245 msgid "" "Updated to support :pep:`584`'s merge (``|``) and update (``|=``) operators." msgstr "" -#: ../../library/os.rst:231 +#: ../../library/os.rst:235 msgid "" "Bytes version of :data:`environ`: a :term:`mapping` object where both keys " -"and values are :class:`bytes` objects representing the process environment. :" -"data:`environ` and :data:`environb` are synchronized (modifying :data:" -"`environb` updates :data:`environ`, and vice versa)." +"and values are :class:`bytes` objects representing the process " +"environment. :data:`environ` and :data:`environb` are synchronized " +"(modifying :data:`environb` updates :data:`environ`, and vice versa)." msgstr "" -#: ../../library/os.rst:236 +#: ../../library/os.rst:240 msgid "" ":data:`environb` is only available if :const:`supports_bytes_environ` is " "``True``." msgstr "" -#: ../../library/os.rst:250 +#: ../../library/os.rst:251 +msgid "" +"The :data:`os.environ` and :data:`os.environb` mappings are a cache of " +"environment variables at the time that Python started. As such, changes to " +"the current process environment are not reflected if made outside Python, or " +"by :func:`os.putenv` or :func:`os.unsetenv`. Use :func:`!os.reload_environ` " +"to update :data:`os.environ` and :data:`os.environb` with any such changes " +"to the current process environment." +msgstr "" + +#: ../../library/os.rst:259 +msgid "" +"This function is not thread-safe. Calling it while the environment is being " +"modified in an other thread is an undefined behavior. Reading " +"from :data:`os.environ` or :data:`os.environb`, or calling :func:`os.getenv` " +"while reloading, may return an empty result." +msgstr "" + +#: ../../library/os.rst:272 msgid "These functions are described in :ref:`os-file-dir`." msgstr "" -#: ../../library/os.rst:255 +#: ../../library/os.rst:277 msgid "" -"Encode :term:`path-like ` *filename* to the :term:" -"`filesystem encoding and error handler`; return :class:`bytes` unchanged." +"Encode :term:`path-like ` *filename* to " +"the :term:`filesystem encoding and error handler`; return :class:`bytes` " +"unchanged." msgstr "" -#: ../../library/os.rst:259 +#: ../../library/os.rst:281 msgid ":func:`fsdecode` is the reverse function." msgstr "" -#: ../../library/os.rst:263 ../../library/os.rst:278 +#: ../../library/os.rst:285 ../../library/os.rst:300 msgid "" "Support added to accept objects implementing the :class:`os.PathLike` " "interface." msgstr "" -#: ../../library/os.rst:270 +#: ../../library/os.rst:292 msgid "" -"Decode the :term:`path-like ` *filename* from the :term:" -"`filesystem encoding and error handler`; return :class:`str` unchanged." +"Decode the :term:`path-like ` *filename* from " +"the :term:`filesystem encoding and error handler`; return :class:`str` " +"unchanged." msgstr "" -#: ../../library/os.rst:274 +#: ../../library/os.rst:296 msgid ":func:`fsencode` is the reverse function." msgstr "" -#: ../../library/os.rst:285 +#: ../../library/os.rst:307 msgid "Return the file system representation of the path." msgstr "" -#: ../../library/os.rst:287 +#: ../../library/os.rst:309 msgid "" "If :class:`str` or :class:`bytes` is passed in, it is returned unchanged. " "Otherwise :meth:`~os.PathLike.__fspath__` is called and its value is " @@ -520,54 +545,54 @@ msgid "" "other cases, :exc:`TypeError` is raised." msgstr "" -#: ../../library/os.rst:297 +#: ../../library/os.rst:319 msgid "" "An :term:`abstract base class` for objects representing a file system path, " "e.g. :class:`pathlib.PurePath`." msgstr "" -#: ../../library/os.rst:305 +#: ../../library/os.rst:327 msgid "Return the file system path representation of the object." msgstr "" -#: ../../library/os.rst:307 +#: ../../library/os.rst:329 msgid "" "The method should only return a :class:`str` or :class:`bytes` object, with " "the preference being for :class:`str`." msgstr "" -#: ../../library/os.rst:313 +#: ../../library/os.rst:335 msgid "" "Return the value of the environment variable *key* as a string if it exists, " -"or *default* if it doesn't. *key* is a string. Note that since :func:" -"`getenv` uses :data:`os.environ`, the mapping of :func:`getenv` is similarly " -"also captured on import, and the function may not reflect future environment " -"changes." +"or *default* if it doesn't. *key* is a string. Note that " +"since :func:`getenv` uses :data:`os.environ`, the mapping of :func:`getenv` " +"is similarly also captured on import, and the function may not reflect " +"future environment changes." msgstr "" -#: ../../library/os.rst:319 +#: ../../library/os.rst:341 msgid "" "On Unix, keys and values are decoded with :func:`sys.getfilesystemencoding` " "and ``'surrogateescape'`` error handler. Use :func:`os.getenvb` if you would " "like to use a different encoding." msgstr "" -#: ../../library/os.rst:328 +#: ../../library/os.rst:350 msgid "" "Return the value of the environment variable *key* as bytes if it exists, or " -"*default* if it doesn't. *key* must be bytes. Note that since :func:" -"`getenvb` uses :data:`os.environb`, the mapping of :func:`getenvb` is " -"similarly also captured on import, and the function may not reflect future " -"environment changes." +"*default* if it doesn't. *key* must be bytes. Note that " +"since :func:`getenvb` uses :data:`os.environb`, the mapping " +"of :func:`getenvb` is similarly also captured on import, and the function " +"may not reflect future environment changes." msgstr "" -#: ../../library/os.rst:335 +#: ../../library/os.rst:357 msgid "" ":func:`getenvb` is only available if :const:`supports_bytes_environ` is " "``True``." msgstr "" -#: ../../library/os.rst:345 +#: ../../library/os.rst:367 msgid "" "Returns the list of directories that will be searched for a named " "executable, similar to a shell, when launching a process. *env*, when " @@ -575,28 +600,28 @@ msgid "" "in. By default, when *env* is ``None``, :data:`environ` is used." msgstr "" -#: ../../library/os.rst:356 +#: ../../library/os.rst:378 msgid "" "Return the effective group id of the current process. This corresponds to " "the \"set id\" bit on the file being executed in the current process." msgstr "" -#: ../../library/os.rst:366 +#: ../../library/os.rst:388 msgid "Return the current process's effective user id." msgstr "" -#: ../../library/os.rst:375 +#: ../../library/os.rst:397 msgid "Return the real group id of the current process." msgstr "" -#: ../../library/os.rst:379 ../../library/os.rst:452 ../../library/os.rst:536 -#: ../../library/os.rst:759 +#: ../../library/os.rst:401 ../../library/os.rst:474 ../../library/os.rst:558 +#: ../../library/os.rst:783 msgid "" "The function is a stub on WASI, see :ref:`wasm-availability` for more " "information." msgstr "" -#: ../../library/os.rst:385 +#: ../../library/os.rst:407 msgid "" "Return list of group ids that *user* belongs to. If *group* is not in the " "list, it is included; typically, *group* is specified as the group ID field " @@ -604,12 +629,12 @@ msgid "" "potentially omitted." msgstr "" -#: ../../library/os.rst:397 +#: ../../library/os.rst:419 msgid "" "Return list of supplemental group ids associated with the current process." msgstr "" -#: ../../library/os.rst:403 +#: ../../library/os.rst:425 msgid "" "On macOS, :func:`getgroups` behavior differs somewhat from other Unix " "platforms. If the Python interpreter was built with a deployment target of " @@ -621,132 +646,138 @@ msgid "" "access list for the user associated with the effective user id of the " "process; the group access list may change over the lifetime of the process, " "it is not affected by calls to :func:`setgroups`, and its length is not " -"limited to 16. The deployment target value, :const:" -"`MACOSX_DEPLOYMENT_TARGET`, can be obtained with :func:`sysconfig." -"get_config_var`." +"limited to 16. The deployment target " +"value, :const:`MACOSX_DEPLOYMENT_TARGET`, can be obtained " +"with :func:`sysconfig.get_config_var`." msgstr "" -#: ../../library/os.rst:420 +#: ../../library/os.rst:442 msgid "" "Return the name of the user logged in on the controlling terminal of the " -"process. For most purposes, it is more useful to use :func:`getpass." -"getuser` since the latter checks the environment variables :envvar:`LOGNAME` " -"or :envvar:`USERNAME` to find out who the user is, and falls back to ``pwd." -"getpwuid(os.getuid())[0]`` to get the login name of the current real user id." +"process. For most purposes, it is more useful to " +"use :func:`getpass.getuser` since the latter checks the environment " +"variables :envvar:`LOGNAME` or :envvar:`USERNAME` to find out who the user " +"is, and falls back to ``pwd.getpwuid(os.getuid())[0]`` to get the login name " +"of the current real user id." msgstr "" -#: ../../library/os.rst:432 +#: ../../library/os.rst:454 msgid "" "Return the process group id of the process with process id *pid*. If *pid* " "is 0, the process group id of the current process is returned." msgstr "" -#: ../../library/os.rst:441 +#: ../../library/os.rst:463 msgid "Return the id of the current process group." msgstr "" -#: ../../library/os.rst:450 +#: ../../library/os.rst:472 msgid "Return the current process id." msgstr "" -#: ../../library/os.rst:459 +#: ../../library/os.rst:481 msgid "" "Return the parent's process id. When the parent process has exited, on Unix " "the id returned is the one of the init process (1), on Windows it is still " "the same id, which may be already reused by another process." msgstr "" -#: ../../library/os.rst:465 +#: ../../library/os.rst:487 msgid "Added support for Windows." msgstr "新增對 Windows 的支援。" -#: ../../library/os.rst:473 +#: ../../library/os.rst:495 msgid "" -"Get program scheduling priority. The value *which* is one of :const:" -"`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " -"interpreted relative to *which* (a process identifier for :const:" -"`PRIO_PROCESS`, process group identifier for :const:`PRIO_PGRP`, and a user " -"ID for :const:`PRIO_USER`). A zero value for *who* denotes (respectively) " -"the calling process, the process group of the calling process, or the real " -"user ID of the calling process." +"Get program scheduling priority. The value *which* is one " +"of :const:`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and " +"*who* is interpreted relative to *which* (a process identifier " +"for :const:`PRIO_PROCESS`, process group identifier for :const:`PRIO_PGRP`, " +"and a user ID for :const:`PRIO_USER`). A zero value for *who* denotes " +"(respectively) the calling process, the process group of the calling " +"process, or the real user ID of the calling process." msgstr "" -#: ../../library/os.rst:490 ../../library/os.rst:502 +#: ../../library/os.rst:512 ../../library/os.rst:524 msgid "" "Parameters for the :func:`getpriority` and :func:`setpriority` functions." msgstr "" -#: ../../library/os.rst:510 +#: ../../library/os.rst:532 msgid "" "Return a tuple (ruid, euid, suid) denoting the current process's real, " "effective, and saved user ids." msgstr "" -#: ../../library/os.rst:520 +#: ../../library/os.rst:542 msgid "" "Return a tuple (rgid, egid, sgid) denoting the current process's real, " "effective, and saved group ids." msgstr "" -#: ../../library/os.rst:532 +#: ../../library/os.rst:554 msgid "Return the current process's real user id." msgstr "" -#: ../../library/os.rst:542 +#: ../../library/os.rst:564 msgid "" "Call the system initgroups() to initialize the group access list with all of " "the groups of which the specified username is a member, plus the specified " "group id." msgstr "" -#: ../../library/os.rst:555 +#: ../../library/os.rst:577 msgid "" "Set the environment variable named *key* to the string *value*. Such " -"changes to the environment affect subprocesses started with :func:`os." -"system`, :func:`popen` or :func:`fork` and :func:`execv`." +"changes to the environment affect subprocesses started " +"with :func:`os.system`, :func:`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: ../../library/os.rst:559 +#: ../../library/os.rst:581 msgid "" "Assignments to items in :data:`os.environ` are automatically translated into " "corresponding calls to :func:`putenv`; however, calls to :func:`putenv` " "don't update :data:`os.environ`, so it is actually preferable to assign to " -"items of :data:`os.environ`. This also applies to :func:`getenv` and :func:" -"`getenvb`, which respectively use :data:`os.environ` and :data:`os.environb` " -"in their implementations." +"items of :data:`os.environ`. This also applies to :func:`getenv` " +"and :func:`getenvb`, which respectively use :data:`os.environ` " +"and :data:`os.environb` in their implementations." msgstr "" -#: ../../library/os.rst:567 +#: ../../library/os.rst:587 ../../library/os.rst:837 +#, fuzzy +msgid "See also the :func:`os.reload_environ` function." +msgstr "也請見 :func:`sched_getaffinity` 函式。" + +#: ../../library/os.rst:591 msgid "" "On some platforms, including FreeBSD and macOS, setting ``environ`` may " "cause memory leaks. Refer to the system documentation for :c:func:`!putenv`." msgstr "" -#: ../../library/os.rst:570 +#: ../../library/os.rst:594 msgid "" "Raises an :ref:`auditing event ` ``os.putenv`` with arguments " "``key``, ``value``." msgstr "" -"引發一個附帶引數 ``key``、``value`` 的\\ :ref:`稽核事件 ` ``os." -"putenv``。" +"引發一個附帶引數 ``key``、``value`` 的\\ :ref:`稽核事件 ` " +"``os.putenv``。" -#: ../../library/os.rst:572 +#: ../../library/os.rst:596 msgid "The function is now always available." msgstr "此函式現在都會是可用的。" -#: ../../library/os.rst:578 +#: ../../library/os.rst:602 msgid "Set the current process's effective group id." msgstr "" -#: ../../library/os.rst:585 +#: ../../library/os.rst:609 msgid "Set the current process's effective user id." msgstr "" -#: ../../library/os.rst:592 +#: ../../library/os.rst:616 msgid "Set the current process' group id." msgstr "" -#: ../../library/os.rst:599 +#: ../../library/os.rst:623 msgid "" "Set the list of supplemental group ids associated with the current process " "to *groups*. *groups* must be a sequence, and each element must be an " @@ -754,21 +785,22 @@ msgid "" "the superuser." msgstr "" -#: ../../library/os.rst:605 +#: ../../library/os.rst:629 msgid "" "On macOS, the length of *groups* may not exceed the system-defined maximum " -"number of effective group ids, typically 16. See the documentation for :func:" -"`getgroups` for cases where it may not return the same group list set by " -"calling setgroups()." +"number of effective group ids, typically 16. See the documentation " +"for :func:`getgroups` for cases where it may not return the same group list " +"set by calling setgroups()." msgstr "" -#: ../../library/os.rst:612 +#: ../../library/os.rst:636 msgid "" -"Reassociate the current thread with a Linux namespace. See the :manpage:" -"`setns(2)` and :manpage:`namespaces(7)` man pages for more details." +"Reassociate the current thread with a Linux namespace. See " +"the :manpage:`setns(2)` and :manpage:`namespaces(7)` man pages for more " +"details." msgstr "" -#: ../../library/os.rst:616 +#: ../../library/os.rst:640 msgid "" "If *fd* refers to a :file:`/proc/{pid}/ns/` link, ``setns()`` reassociates " "the calling thread with the namespace associated with that link, and " @@ -777,30 +809,31 @@ msgid "" "constraints)." msgstr "" -#: ../../library/os.rst:623 +#: ../../library/os.rst:647 msgid "" -"Since Linux 5.8, *fd* may refer to a PID file descriptor obtained from :func:" -"`~os.pidfd_open`. In this case, ``setns()`` reassociates the calling thread " -"into one or more of the same namespaces as the thread referred to by *fd*. " -"This is subject to any constraints imposed by *nstype*, which is a bit mask " -"combining one or more of the :ref:`CLONE_NEW* constants `, e.g. ``setns(fd, os.CLONE_NEWUTS | os.CLONE_NEWPID)``. The caller's " -"memberships in unspecified namespaces are left unchanged." +"Since Linux 5.8, *fd* may refer to a PID file descriptor obtained " +"from :func:`~os.pidfd_open`. In this case, ``setns()`` reassociates the " +"calling thread into one or more of the same namespaces as the thread " +"referred to by *fd*. This is subject to any constraints imposed by *nstype*, " +"which is a bit mask combining one or more of the :ref:`CLONE_NEW* constants " +"`, e.g. ``setns(fd, os.CLONE_NEWUTS | " +"os.CLONE_NEWPID)``. The caller's memberships in unspecified namespaces are " +"left unchanged." msgstr "" -#: ../../library/os.rst:632 +#: ../../library/os.rst:656 msgid "" "*fd* can be any object with a :meth:`~io.IOBase.fileno` method, or a raw " "file descriptor." msgstr "" -#: ../../library/os.rst:634 +#: ../../library/os.rst:658 msgid "" "This example reassociates the thread with the ``init`` process's network " "namespace::" msgstr "" -#: ../../library/os.rst:636 +#: ../../library/os.rst:660 msgid "" "fd = os.open(\"/proc/1/ns/net\", os.O_RDONLY)\n" "os.setns(fd, os.CLONE_NEWNET)\n" @@ -810,148 +843,149 @@ msgstr "" "os.setns(fd, os.CLONE_NEWNET)\n" "os.close(fd)" -#: ../../library/os.rst:646 +#: ../../library/os.rst:670 msgid "The :func:`~os.unshare` function." msgstr ":func:`~os.unshare` 函式。" -#: ../../library/os.rst:650 +#: ../../library/os.rst:674 msgid "" "Call the system call :c:func:`!setpgrp` or ``setpgrp(0, 0)`` depending on " "which version is implemented (if any). See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:658 +#: ../../library/os.rst:682 msgid "" "Call the system call :c:func:`!setpgid` to set the process group id of the " "process with id *pid* to the process group with id *pgrp*. See the Unix " "manual for the semantics." msgstr "" -#: ../../library/os.rst:669 +#: ../../library/os.rst:693 msgid "" -"Set program scheduling priority. The value *which* is one of :const:" -"`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " -"interpreted relative to *which* (a process identifier for :const:" -"`PRIO_PROCESS`, process group identifier for :const:`PRIO_PGRP`, and a user " -"ID for :const:`PRIO_USER`). A zero value for *who* denotes (respectively) " -"the calling process, the process group of the calling process, or the real " -"user ID of the calling process. *priority* is a value in the range -20 to " -"19. The default priority is 0; lower priorities cause more favorable " -"scheduling." +"Set program scheduling priority. The value *which* is one " +"of :const:`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and " +"*who* is interpreted relative to *which* (a process identifier " +"for :const:`PRIO_PROCESS`, process group identifier for :const:`PRIO_PGRP`, " +"and a user ID for :const:`PRIO_USER`). A zero value for *who* denotes " +"(respectively) the calling process, the process group of the calling " +"process, or the real user ID of the calling process. *priority* is a value " +"in the range -20 to 19. The default priority is 0; lower priorities cause " +"more favorable scheduling." msgstr "" -#: ../../library/os.rst:686 +#: ../../library/os.rst:710 msgid "Set the current process's real and effective group ids." msgstr "" -#: ../../library/os.rst:693 +#: ../../library/os.rst:717 msgid "Set the current process's real, effective, and saved group ids." msgstr "" -#: ../../library/os.rst:702 +#: ../../library/os.rst:726 msgid "Set the current process's real, effective, and saved user ids." msgstr "" -#: ../../library/os.rst:711 +#: ../../library/os.rst:735 msgid "Set the current process's real and effective user ids." msgstr "" -#: ../../library/os.rst:718 +#: ../../library/os.rst:742 msgid "" "Call the system call :c:func:`!getsid`. See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:725 +#: ../../library/os.rst:749 msgid "" "Call the system call :c:func:`!setsid`. See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:734 +#: ../../library/os.rst:758 msgid "Set the current process's user id." msgstr "" -#: ../../library/os.rst:742 +#: ../../library/os.rst:766 msgid "" "Return the error message corresponding to the error code in *code*. On " "platforms where :c:func:`!strerror` returns ``NULL`` when given an unknown " "error number, :exc:`ValueError` is raised." msgstr "" -#: ../../library/os.rst:749 +#: ../../library/os.rst:773 msgid "" "``True`` if the native OS type of the environment is bytes (eg. ``False`` on " "Windows)." msgstr "" -#: ../../library/os.rst:757 +#: ../../library/os.rst:781 msgid "Set the current numeric umask and return the previous umask." msgstr "" -#: ../../library/os.rst:769 +#: ../../library/os.rst:793 msgid "" "Returns information identifying the current operating system. The return " "value is an object with five attributes:" msgstr "" -#: ../../library/os.rst:772 +#: ../../library/os.rst:796 msgid ":attr:`sysname` - operating system name" msgstr ":attr:`sysname` - 作業系統名稱" -#: ../../library/os.rst:773 +#: ../../library/os.rst:797 msgid ":attr:`nodename` - name of machine on network (implementation-defined)" msgstr "" -#: ../../library/os.rst:774 +#: ../../library/os.rst:798 msgid ":attr:`release` - operating system release" msgstr "" -#: ../../library/os.rst:775 +#: ../../library/os.rst:799 msgid ":attr:`version` - operating system version" msgstr ":attr:`version` - 作業系統版本" -#: ../../library/os.rst:776 +#: ../../library/os.rst:800 msgid ":attr:`machine` - hardware identifier" msgstr "" -#: ../../library/os.rst:778 +#: ../../library/os.rst:802 msgid "" "For backwards compatibility, this object is also iterable, behaving like a " -"five-tuple containing :attr:`sysname`, :attr:`nodename`, :attr:`release`, :" -"attr:`version`, and :attr:`machine` in that order." +"five-tuple " +"containing :attr:`sysname`, :attr:`nodename`, :attr:`release`, :attr:`version`, " +"and :attr:`machine` in that order." msgstr "" -#: ../../library/os.rst:783 +#: ../../library/os.rst:807 msgid "" "Some systems truncate :attr:`nodename` to 8 characters or to the leading " "component; a better way to get the hostname is :func:`socket.gethostname` " "or even ``socket.gethostbyaddr(socket.gethostname())``." msgstr "" -#: ../../library/os.rst:788 +#: ../../library/os.rst:812 msgid "" "On macOS, iOS and Android, this returns the *kernel* name and version (i.e., " -"``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android). :func:`platform." -"uname` can be used to get the user-facing operating system name and version " -"on iOS and Android." +"``'Darwin'`` on macOS and iOS; ``'Linux'`` on " +"Android). :func:`platform.uname` can be used to get the user-facing " +"operating system name and version on iOS and Android." msgstr "" -#: ../../library/os.rst:795 ../../library/os.rst:5002 +#: ../../library/os.rst:819 ../../library/os.rst:5083 msgid "" "Return type changed from a tuple to a tuple-like object with named " "attributes." msgstr "" -#: ../../library/os.rst:804 +#: ../../library/os.rst:828 msgid "" "Unset (delete) the environment variable named *key*. Such changes to the " -"environment affect subprocesses started with :func:`os.system`, :func:" -"`popen` or :func:`fork` and :func:`execv`." +"environment affect subprocesses started " +"with :func:`os.system`, :func:`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: ../../library/os.rst:808 +#: ../../library/os.rst:832 msgid "" "Deletion of items in :data:`os.environ` is automatically translated into a " "corresponding call to :func:`unsetenv`; however, calls to :func:`unsetenv` " @@ -959,50 +993,50 @@ msgid "" "items of :data:`os.environ`." msgstr "" -#: ../../library/os.rst:813 +#: ../../library/os.rst:839 msgid "" "Raises an :ref:`auditing event ` ``os.unsetenv`` with argument " "``key``." msgstr "" "引發一個附帶引數 ``key`` 的\\ :ref:`稽核事件 ` ``os.unsetenv``。" -#: ../../library/os.rst:815 +#: ../../library/os.rst:841 msgid "The function is now always available and is also available on Windows." msgstr "" -#: ../../library/os.rst:821 +#: ../../library/os.rst:847 msgid "" "Disassociate parts of the process execution context, and move them into a " "newly created namespace. See the :manpage:`unshare(2)` man page for more " -"details. The *flags* argument is a bit mask, combining zero or more of the :" -"ref:`CLONE_* constants `, that specifies which parts " -"of the execution context should be unshared from their existing associations " -"and moved to a new namespace. If the *flags* argument is ``0``, no changes " -"are made to the calling process's execution context." +"details. The *flags* argument is a bit mask, combining zero or more of " +"the :ref:`CLONE_* constants `, that specifies which " +"parts of the execution context should be unshared from their existing " +"associations and moved to a new namespace. If the *flags* argument is ``0``, " +"no changes are made to the calling process's execution context." msgstr "" -#: ../../library/os.rst:838 +#: ../../library/os.rst:864 msgid "The :func:`~os.setns` function." msgstr ":func:`~os.setns` 函式。" -#: ../../library/os.rst:842 +#: ../../library/os.rst:868 msgid "" "Flags to the :func:`unshare` function, if the implementation supports them. " "See :manpage:`unshare(2)` in the Linux manual for their exact effect and " "availability." msgstr "" -#: ../../library/os.rst:865 +#: ../../library/os.rst:891 msgid "File Object Creation" msgstr "" -#: ../../library/os.rst:867 +#: ../../library/os.rst:893 msgid "" -"These functions create new :term:`file objects `. (See also :" -"func:`~os.open` for opening file descriptors.)" +"These functions create new :term:`file objects `. (See " +"also :func:`~os.open` for opening file descriptors.)" msgstr "" -#: ../../library/os.rst:873 +#: ../../library/os.rst:899 msgid "" "Return an open file object connected to the file descriptor *fd*. This is " "an alias of the :func:`open` built-in function and accepts the same " @@ -1010,16 +1044,16 @@ msgid "" "must always be an integer." msgstr "" -#: ../../library/os.rst:882 +#: ../../library/os.rst:908 msgid "File Descriptor Operations" msgstr "" -#: ../../library/os.rst:884 +#: ../../library/os.rst:910 msgid "" "These functions operate on I/O streams referenced using file descriptors." msgstr "" -#: ../../library/os.rst:886 +#: ../../library/os.rst:912 msgid "" "File descriptors are small integers corresponding to a file that has been " "opened by the current process. For example, standard input is usually file " @@ -1029,7 +1063,7 @@ msgid "" "pipes are also referenced by file descriptors." msgstr "" -#: ../../library/os.rst:893 +#: ../../library/os.rst:919 msgid "" "The :meth:`~io.IOBase.fileno` method can be used to obtain the file " "descriptor associated with a :term:`file object` when required. Note that " @@ -1037,25 +1071,25 @@ msgid "" "ignoring aspects such as internal buffering of data." msgstr "" -#: ../../library/os.rst:901 +#: ../../library/os.rst:927 msgid "Close file descriptor *fd*." msgstr "" -#: ../../library/os.rst:905 +#: ../../library/os.rst:931 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To close a " -"\"file object\" returned by the built-in function :func:`open` or by :func:" -"`popen` or :func:`fdopen`, use its :meth:`~io.IOBase.close` method." +"\"file object\" returned by the built-in function :func:`open` or " +"by :func:`popen` or :func:`fdopen`, use its :meth:`~io.IOBase.close` method." msgstr "" -#: ../../library/os.rst:913 +#: ../../library/os.rst:939 msgid "" "Close all file descriptors from *fd_low* (inclusive) to *fd_high* " "(exclusive), ignoring errors. Equivalent to (but much faster than)::" msgstr "" -#: ../../library/os.rst:916 +#: ../../library/os.rst:942 msgid "" "for fd in range(fd_low, fd_high):\n" " try:\n" @@ -1069,7 +1103,7 @@ msgstr "" " except OSError:\n" " pass" -#: ../../library/os.rst:925 +#: ../../library/os.rst:951 msgid "" "Copy *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " @@ -1077,14 +1111,14 @@ msgid "" "respectively for *offset_dst*." msgstr "" -#: ../../library/os.rst:930 +#: ../../library/os.rst:956 msgid "" "In Linux kernel older than 5.3, the files pointed to by *src* and *dst* must " -"reside in the same filesystem, otherwise an :exc:`OSError` is raised with :" -"attr:`~OSError.errno` set to :const:`errno.EXDEV`." +"reside in the same filesystem, otherwise an :exc:`OSError` is raised " +"with :attr:`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:934 +#: ../../library/os.rst:960 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -1094,19 +1128,19 @@ msgid "" "(in the case of NFS)." msgstr "" -#: ../../library/os.rst:941 +#: ../../library/os.rst:967 msgid "" "The function copies bytes between two file descriptors. Text options, like " "the encoding and the line ending, are ignored." msgstr "" -#: ../../library/os.rst:944 +#: ../../library/os.rst:970 msgid "" "The return value is the amount of bytes copied. This could be less than the " "amount requested." msgstr "" -#: ../../library/os.rst:949 +#: ../../library/os.rst:975 msgid "" "On Linux, :func:`os.copy_file_range` should not be used for copying a range " "of a pseudo file from a special filesystem like procfs and sysfs. It will " @@ -1114,39 +1148,39 @@ msgid "" "known Linux kernel issue." msgstr "" -#: ../../library/os.rst:961 +#: ../../library/os.rst:987 msgid "" "Return a string describing the encoding of the device associated with *fd* " "if it is connected to a terminal; else return :const:`None`." msgstr "" -#: ../../library/os.rst:964 +#: ../../library/os.rst:990 msgid "" "On Unix, if the :ref:`Python UTF-8 Mode ` is enabled, return " "``'UTF-8'`` rather than the device encoding." msgstr "" -#: ../../library/os.rst:967 +#: ../../library/os.rst:993 msgid "On Unix, the function now implements the Python UTF-8 Mode." msgstr "" -#: ../../library/os.rst:973 +#: ../../library/os.rst:999 msgid "" -"Return a duplicate of file descriptor *fd*. The new file descriptor is :ref:" -"`non-inheritable `." +"Return a duplicate of file descriptor *fd*. The new file descriptor " +"is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:976 +#: ../../library/os.rst:1002 msgid "" "On Windows, when duplicating a standard stream (0: stdin, 1: stdout, 2: " "stderr), the new file descriptor is :ref:`inheritable `." msgstr "" -#: ../../library/os.rst:982 ../../library/os.rst:1267 +#: ../../library/os.rst:1008 ../../library/os.rst:1293 msgid "The new file descriptor is now non-inheritable." msgstr "" -#: ../../library/os.rst:988 +#: ../../library/os.rst:1014 msgid "" "Duplicate file descriptor *fd* to *fd2*, closing the latter first if " "necessary. Return *fd2*. The new file descriptor is :ref:`inheritable " @@ -1154,23 +1188,23 @@ msgid "" "``False``." msgstr "" -#: ../../library/os.rst:995 +#: ../../library/os.rst:1021 msgid "Add the optional *inheritable* parameter." msgstr "新增可選用的參數 *inheritable*。" -#: ../../library/os.rst:998 +#: ../../library/os.rst:1024 msgid "Return *fd2* on success. Previously, ``None`` was always returned." msgstr "" -#: ../../library/os.rst:1004 +#: ../../library/os.rst:1030 msgid "" "Change the mode of the file given by *fd* to the numeric *mode*. See the " "docs for :func:`chmod` for possible values of *mode*. As of Python 3.3, " "this is equivalent to ``os.chmod(fd, mode)``." msgstr "" -#: ../../library/os.rst:1008 ../../library/os.rst:2137 -#: ../../library/os.rst:2238 +#: ../../library/os.rst:1034 ../../library/os.rst:2209 +#: ../../library/os.rst:2310 msgid "" "Raises an :ref:`auditing event ` ``os.chmod`` with arguments " "``path``, ``mode``, ``dir_fd``." @@ -1178,28 +1212,29 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.chmod``。" -#: ../../library/os.rst:1012 ../../library/os.rst:1030 -#: ../../library/os.rst:1121 ../../library/os.rst:1706 -#: ../../library/os.rst:2134 ../../library/os.rst:2167 -#: ../../library/os.rst:3459 +#: ../../library/os.rst:1038 ../../library/os.rst:1056 +#: ../../library/os.rst:1147 ../../library/os.rst:1759 +#: ../../library/os.rst:2206 ../../library/os.rst:2239 +#: ../../library/os.rst:3532 msgid "" "The function is limited on WASI, see :ref:`wasm-availability` for more " "information." msgstr "" -#: ../../library/os.rst:1015 ../../library/os.rst:2245 +#: ../../library/os.rst:1041 ../../library/os.rst:2317 msgid "Added support on Windows." msgstr "新增對 Windows 的支援。" -#: ../../library/os.rst:1021 +#: ../../library/os.rst:1047 msgid "" "Change the owner and group id of the file given by *fd* to the numeric *uid* " -"and *gid*. To leave one of the ids unchanged, set it to -1. See :func:" -"`chown`. As of Python 3.3, this is equivalent to ``os.chown(fd, uid, gid)``." +"and *gid*. To leave one of the ids unchanged, set it to -1. " +"See :func:`chown`. As of Python 3.3, this is equivalent to ``os.chown(fd, " +"uid, gid)``." msgstr "" -#: ../../library/os.rst:1026 ../../library/os.rst:2163 -#: ../../library/os.rst:2254 +#: ../../library/os.rst:1052 ../../library/os.rst:2235 +#: ../../library/os.rst:2326 msgid "" "Raises an :ref:`auditing event ` ``os.chown`` with arguments " "``path``, ``uid``, ``gid``, ``dir_fd``." @@ -1207,17 +1242,17 @@ msgstr "" "引發一個附帶引數 ``path``、``uid``、``gid``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.chown``。" -#: ../../library/os.rst:1036 +#: ../../library/os.rst:1062 msgid "" "Force write of file with filedescriptor *fd* to disk. Does not force update " "of metadata." msgstr "" -#: ../../library/os.rst:1042 +#: ../../library/os.rst:1068 msgid "This function is not available on MacOS." msgstr "" -#: ../../library/os.rst:1047 +#: ../../library/os.rst:1073 msgid "" "Return system configuration information relevant to an open file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -1228,116 +1263,116 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:1055 ../../library/os.rst:2573 +#: ../../library/os.rst:1081 ../../library/os.rst:2646 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " -"included in ``pathconf_names``, an :exc:`OSError` is raised with :const:" -"`errno.EINVAL` for the error number." +"included in ``pathconf_names``, an :exc:`OSError` is raised " +"with :const:`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:1060 +#: ../../library/os.rst:1086 msgid "As of Python 3.3, this is equivalent to ``os.pathconf(fd, name)``." msgstr "" -#: ../../library/os.rst:1067 +#: ../../library/os.rst:1093 msgid "" "Get the status of the file descriptor *fd*. Return a :class:`stat_result` " "object." msgstr "" -#: ../../library/os.rst:1070 +#: ../../library/os.rst:1096 msgid "As of Python 3.3, this is equivalent to ``os.stat(fd)``." msgstr "" -#: ../../library/os.rst:1074 ../../library/os.rst:2401 +#: ../../library/os.rst:1100 ../../library/os.rst:2474 msgid "The :func:`.stat` function." msgstr "" -#: ../../library/os.rst:1079 +#: ../../library/os.rst:1105 msgid "" "Return information about the filesystem containing the file associated with " "file descriptor *fd*, like :func:`statvfs`. As of Python 3.3, this is " "equivalent to ``os.statvfs(fd)``." msgstr "" -#: ../../library/os.rst:1088 +#: ../../library/os.rst:1114 msgid "" "Force write of file with filedescriptor *fd* to disk. On Unix, this calls " "the native :c:func:`!fsync` function; on Windows, the MS :c:func:`!_commit` " "function." msgstr "" -#: ../../library/os.rst:1091 +#: ../../library/os.rst:1117 msgid "" "If you're starting with a buffered Python :term:`file object` *f*, first do " "``f.flush()``, and then do ``os.fsync(f.fileno())``, to ensure that all " "internal buffers associated with *f* are written to disk." msgstr "" -#: ../../library/os.rst:1100 +#: ../../library/os.rst:1126 msgid "" "Truncate the file corresponding to file descriptor *fd*, so that it is at " -"most *length* bytes in size. As of Python 3.3, this is equivalent to ``os." -"truncate(fd, length)``." +"most *length* bytes in size. As of Python 3.3, this is equivalent to " +"``os.truncate(fd, length)``." msgstr "" -#: ../../library/os.rst:1104 +#: ../../library/os.rst:1130 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``fd``, ``length``." msgstr "" -"引發一個附帶引數 ``fd``、``length`` 的\\ :ref:`稽核事件 ` ``os." -"truncate``。" +"引發一個附帶引數 ``fd``、``length`` 的\\ :ref:`稽核事件 ` " +"``os.truncate``。" -#: ../../library/os.rst:1108 ../../library/os.rst:3498 +#: ../../library/os.rst:1134 ../../library/os.rst:3571 msgid "Added support for Windows" msgstr "新增對 Windows 的支援" -#: ../../library/os.rst:1114 +#: ../../library/os.rst:1140 msgid "" -"Get the blocking mode of the file descriptor: ``False`` if the :data:" -"`O_NONBLOCK` flag is set, ``True`` if the flag is cleared." +"Get the blocking mode of the file descriptor: ``False`` if " +"the :data:`O_NONBLOCK` flag is set, ``True`` if the flag is cleared." msgstr "" -#: ../../library/os.rst:1117 +#: ../../library/os.rst:1143 msgid "See also :func:`set_blocking` and :meth:`socket.socket.setblocking`." msgstr "另請參閱 :func:`set_blocking` 與 :meth:`socket.socket.setblocking`。" -#: ../../library/os.rst:1124 ../../library/os.rst:1709 +#: ../../library/os.rst:1150 ../../library/os.rst:1762 msgid "On Windows, this function is limited to pipes." msgstr "" -#: ../../library/os.rst:1128 ../../library/os.rst:1713 +#: ../../library/os.rst:1154 ../../library/os.rst:1766 msgid "Added support for pipes on Windows." msgstr "新增對 Windows 上的 pipe 支援。" -#: ../../library/os.rst:1134 +#: ../../library/os.rst:1160 msgid "" "Grant access to the slave pseudo-terminal device associated with the master " "pseudo-terminal device to which the file descriptor *fd* refers. The file " "descriptor *fd* is not closed upon failure." msgstr "" -#: ../../library/os.rst:1138 +#: ../../library/os.rst:1164 msgid "Calls the C standard library function :c:func:`grantpt`." msgstr "" -#: ../../library/os.rst:1147 +#: ../../library/os.rst:1173 msgid "" "Return ``True`` if the file descriptor *fd* is open and connected to a tty(-" "like) device, else ``False``." msgstr "" -#: ../../library/os.rst:1153 +#: ../../library/os.rst:1179 msgid "" "Apply, test or remove a POSIX lock on an open file descriptor. *fd* is an " -"open file descriptor. *cmd* specifies the command to use - one of :data:" -"`F_LOCK`, :data:`F_TLOCK`, :data:`F_ULOCK` or :data:`F_TEST`. *len* " +"open file descriptor. *cmd* specifies the command to use - one " +"of :data:`F_LOCK`, :data:`F_TLOCK`, :data:`F_ULOCK` or :data:`F_TEST`. *len* " "specifies the section of the file to lock." msgstr "" -#: ../../library/os.rst:1159 +#: ../../library/os.rst:1185 msgid "" "Raises an :ref:`auditing event ` ``os.lockf`` with arguments " "``fd``, ``cmd``, ``len``." @@ -1345,119 +1380,119 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``len`` 的\\ :ref:`稽核事件 ` " "``os.lockf``。" -#: ../../library/os.rst:1171 +#: ../../library/os.rst:1197 msgid "Flags that specify what action :func:`lockf` will take." msgstr "" -#: ../../library/os.rst:1180 +#: ../../library/os.rst:1206 msgid "" "Prepare the tty of which fd is a file descriptor for a new login session. " "Make the calling process a session leader; make the tty the controlling tty, " "the stdin, the stdout, and the stderr of the calling process; close fd." msgstr "" -#: ../../library/os.rst:1191 +#: ../../library/os.rst:1217 msgid "" "Set the current position of file descriptor *fd* to position *pos*, modified " "by *whence*, and return the new position in bytes relative to the start of " "the file. Valid values for *whence* are:" msgstr "" -#: ../../library/os.rst:1196 +#: ../../library/os.rst:1222 msgid "" ":const:`SEEK_SET` or ``0`` -- set *pos* relative to the beginning of the file" msgstr "" -#: ../../library/os.rst:1197 +#: ../../library/os.rst:1223 msgid "" ":const:`SEEK_CUR` or ``1`` -- set *pos* relative to the current file position" msgstr "" -#: ../../library/os.rst:1198 +#: ../../library/os.rst:1224 msgid ":const:`SEEK_END` or ``2`` -- set *pos* relative to the end of the file" msgstr "" -#: ../../library/os.rst:1199 +#: ../../library/os.rst:1225 msgid "" ":const:`SEEK_HOLE` -- set *pos* to the next data location, relative to *pos*" msgstr "" -#: ../../library/os.rst:1200 +#: ../../library/os.rst:1226 msgid "" ":const:`SEEK_DATA` -- set *pos* to the next data hole, relative to *pos*" msgstr "" -#: ../../library/os.rst:1204 +#: ../../library/os.rst:1230 msgid "Add support for :const:`!SEEK_HOLE` and :const:`!SEEK_DATA`." msgstr "" -#: ../../library/os.rst:1211 +#: ../../library/os.rst:1237 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for whence to adjust the " "file position indicator." msgstr "" -#: ../../library/os.rst:1215 +#: ../../library/os.rst:1241 msgid ":const:`SEEK_SET`" msgstr ":const:`SEEK_SET`" -#: ../../library/os.rst:1216 +#: ../../library/os.rst:1242 msgid "Adjust the file position relative to the beginning of the file." msgstr "" -#: ../../library/os.rst:1217 +#: ../../library/os.rst:1243 msgid ":const:`SEEK_CUR`" msgstr ":const:`SEEK_CUR`" -#: ../../library/os.rst:1218 +#: ../../library/os.rst:1244 msgid "Adjust the file position relative to the current file position." msgstr "" -#: ../../library/os.rst:1219 +#: ../../library/os.rst:1245 msgid ":const:`SEEK_END`" msgstr ":const:`SEEK_END`" -#: ../../library/os.rst:1220 +#: ../../library/os.rst:1246 msgid "Adjust the file position relative to the end of the file." msgstr "" -#: ../../library/os.rst:1222 +#: ../../library/os.rst:1248 msgid "Their values are 0, 1, and 2, respectively." msgstr "" -#: ../../library/os.rst:1228 +#: ../../library/os.rst:1254 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for seeking file data and " "holes on sparsely allocated files." msgstr "" -#: ../../library/os.rst:1232 +#: ../../library/os.rst:1258 msgid ":data:`!SEEK_DATA`" msgstr ":data:`!SEEK_DATA`" -#: ../../library/os.rst:1233 +#: ../../library/os.rst:1259 msgid "" "Adjust the file offset to the next location containing data, relative to the " "seek position." msgstr "" -#: ../../library/os.rst:1236 +#: ../../library/os.rst:1262 msgid ":data:`!SEEK_HOLE`" msgstr ":data:`!SEEK_HOLE`" -#: ../../library/os.rst:1237 +#: ../../library/os.rst:1263 msgid "" "Adjust the file offset to the next location containing a hole, relative to " "the seek position. A hole is defined as a sequence of zeros." msgstr "" -#: ../../library/os.rst:1243 +#: ../../library/os.rst:1269 msgid "These operations only make sense for filesystems that support them." msgstr "" -#: ../../library/os.rst:1252 +#: ../../library/os.rst:1278 msgid "" "Open the file *path* and set various flags according to *flags* and possibly " "its mode according to *mode*. When computing *mode*, the current umask " @@ -1465,21 +1500,21 @@ msgid "" "file. The new file descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:1257 +#: ../../library/os.rst:1283 msgid "" "For a description of the flag and mode values, see the C run-time " "documentation; flag constants (like :const:`O_RDONLY` and :const:`O_WRONLY`) " -"are defined in the :mod:`os` module. In particular, on Windows adding :" -"const:`O_BINARY` is needed to open files in binary mode." +"are defined in the :mod:`os` module. In particular, on Windows " +"adding :const:`O_BINARY` is needed to open files in binary mode." msgstr "" -#: ../../library/os.rst:1262 +#: ../../library/os.rst:1288 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" -#: ../../library/os.rst:1265 +#: ../../library/os.rst:1291 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -1487,97 +1522,97 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/os.rst:1272 +#: ../../library/os.rst:1298 msgid "" "This function is intended for low-level I/O. For normal usage, use the " -"built-in function :func:`open`, which returns a :term:`file object` with :" -"meth:`~file.read` and :meth:`~file.write` methods (and many more). To wrap " -"a file descriptor in a file object, use :func:`fdopen`." +"built-in function :func:`open`, which returns a :term:`file object` " +"with :meth:`~file.read` and :meth:`~file.write` methods (and many more). To " +"wrap a file descriptor in a file object, use :func:`fdopen`." msgstr "" -#: ../../library/os.rst:1277 ../../library/os.rst:2406 -#: ../../library/os.rst:2446 ../../library/os.rst:2517 -#: ../../library/os.rst:2539 ../../library/os.rst:2620 -#: ../../library/os.rst:2650 ../../library/os.rst:2757 -#: ../../library/os.rst:3514 +#: ../../library/os.rst:1303 ../../library/os.rst:2479 +#: ../../library/os.rst:2519 ../../library/os.rst:2590 +#: ../../library/os.rst:2612 ../../library/os.rst:2693 +#: ../../library/os.rst:2723 ../../library/os.rst:2830 +#: ../../library/os.rst:3587 msgid "Added the *dir_fd* parameter." msgstr "新增 *dir_fd* 參數。" -#: ../../library/os.rst:1280 ../../library/os.rst:1631 -#: ../../library/os.rst:1820 ../../library/os.rst:5098 +#: ../../library/os.rst:1306 ../../library/os.rst:1657 +#: ../../library/os.rst:1892 ../../library/os.rst:5179 msgid "" "If the system call is interrupted and the signal handler does not raise an " -"exception, the function now retries the system call instead of raising an :" -"exc:`InterruptedError` exception (see :pep:`475` for the rationale)." -msgstr "" - -#: ../../library/os.rst:1285 ../../library/os.rst:2030 -#: ../../library/os.rst:2062 ../../library/os.rst:2093 -#: ../../library/os.rst:2143 ../../library/os.rst:2184 -#: ../../library/os.rst:2224 ../../library/os.rst:2242 -#: ../../library/os.rst:2258 ../../library/os.rst:2317 -#: ../../library/os.rst:2409 ../../library/os.rst:2449 -#: ../../library/os.rst:2493 ../../library/os.rst:2520 -#: ../../library/os.rst:2542 ../../library/os.rst:2583 -#: ../../library/os.rst:2653 ../../library/os.rst:2672 -#: ../../library/os.rst:2760 ../../library/os.rst:3050 -#: ../../library/os.rst:3337 ../../library/os.rst:3501 -#: ../../library/os.rst:3517 ../../library/os.rst:3557 -#: ../../library/os.rst:3657 ../../library/os.rst:3718 -#: ../../library/os.rst:4115 ../../library/os.rst:4295 -#: ../../library/os.rst:4860 +"exception, the function now retries the system call instead of raising " +"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." +msgstr "" + +#: ../../library/os.rst:1311 ../../library/os.rst:2102 +#: ../../library/os.rst:2134 ../../library/os.rst:2165 +#: ../../library/os.rst:2215 ../../library/os.rst:2256 +#: ../../library/os.rst:2296 ../../library/os.rst:2314 +#: ../../library/os.rst:2330 ../../library/os.rst:2390 +#: ../../library/os.rst:2482 ../../library/os.rst:2522 +#: ../../library/os.rst:2566 ../../library/os.rst:2593 +#: ../../library/os.rst:2615 ../../library/os.rst:2656 +#: ../../library/os.rst:2726 ../../library/os.rst:2745 +#: ../../library/os.rst:2833 ../../library/os.rst:3123 +#: ../../library/os.rst:3410 ../../library/os.rst:3574 +#: ../../library/os.rst:3590 ../../library/os.rst:3630 +#: ../../library/os.rst:3730 ../../library/os.rst:3791 +#: ../../library/os.rst:4188 ../../library/os.rst:4368 +#: ../../library/os.rst:4937 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:1288 +#: ../../library/os.rst:1314 msgid "" -"The following constants are options for the *flags* parameter to the :func:" -"`~os.open` function. They can be combined using the bitwise OR operator ``|" -"``. Some of them are not available on all platforms. For descriptions of " -"their availability and use, consult the :manpage:`open(2)` manual page on " -"Unix or `the MSDN `_ " -"on Windows." +"The following constants are options for the *flags* parameter to " +"the :func:`~os.open` function. They can be combined using the bitwise OR " +"operator ``|``. Some of them are not available on all platforms. For " +"descriptions of their availability and use, consult the :manpage:`open(2)` " +"manual page on Unix or `the MSDN `_ on Windows." msgstr "" -#: ../../library/os.rst:1303 +#: ../../library/os.rst:1329 msgid "The above constants are available on Unix and Windows." msgstr "" -#: ../../library/os.rst:1314 +#: ../../library/os.rst:1340 msgid "The above constants are only available on Unix." msgstr "" -#: ../../library/os.rst:1316 +#: ../../library/os.rst:1342 msgid "Add :data:`O_CLOEXEC` constant." msgstr "" -#: ../../library/os.rst:1327 +#: ../../library/os.rst:1353 msgid "The above constants are only available on Windows." msgstr "" -#: ../../library/os.rst:1334 +#: ../../library/os.rst:1360 msgid "The above constants are only available on macOS." msgstr "" -#: ../../library/os.rst:1336 +#: ../../library/os.rst:1362 msgid "" -"Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK` and :data:" -"`O_NOFOLLOW_ANY` constants." +"Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK` " +"and :data:`O_NOFOLLOW_ANY` constants." msgstr "" -#: ../../library/os.rst:1350 +#: ../../library/os.rst:1376 msgid "" "The above constants are extensions and not present if they are not defined " "by the C library." msgstr "" -#: ../../library/os.rst:1353 +#: ../../library/os.rst:1379 msgid "" "Add :data:`O_PATH` on systems that support it. Add :data:`O_TMPFILE`, only " "available on Linux Kernel 3.11 or newer." msgstr "" -#: ../../library/os.rst:1363 +#: ../../library/os.rst:1389 msgid "" "Open a new pseudo-terminal pair. Return a pair of file descriptors " "``(master, slave)`` for the pty and the tty, respectively. The new file " @@ -1585,213 +1620,213 @@ msgid "" "more portable approach, use the :mod:`pty` module." msgstr "" -#: ../../library/os.rst:1370 ../../library/os.rst:1382 +#: ../../library/os.rst:1396 ../../library/os.rst:1408 msgid "The new file descriptors are now non-inheritable." msgstr "" -#: ../../library/os.rst:1376 +#: ../../library/os.rst:1402 msgid "" "Create a pipe. Return a pair of file descriptors ``(r, w)`` usable for " "reading and writing, respectively. The new file descriptor is :ref:`non-" "inheritable `." msgstr "" -#: ../../library/os.rst:1388 +#: ../../library/os.rst:1414 msgid "" "Create a pipe with *flags* set atomically. *flags* can be constructed by " -"ORing together one or more of these values: :data:`O_NONBLOCK`, :data:" -"`O_CLOEXEC`. Return a pair of file descriptors ``(r, w)`` usable for reading " -"and writing, respectively." +"ORing together one or more of these " +"values: :data:`O_NONBLOCK`, :data:`O_CLOEXEC`. Return a pair of file " +"descriptors ``(r, w)`` usable for reading and writing, respectively." msgstr "" -#: ../../library/os.rst:1401 +#: ../../library/os.rst:1427 msgid "" "Ensures that enough disk space is allocated for the file specified by *fd* " "starting from *offset* and continuing for *len* bytes." msgstr "" -#: ../../library/os.rst:1411 +#: ../../library/os.rst:1437 msgid "" "Announces an intention to access data in a specific pattern thus allowing " "the kernel to make optimizations. The advice applies to the region of the " "file specified by *fd* starting at *offset* and continuing for *len* bytes. " -"*advice* is one of :data:`POSIX_FADV_NORMAL`, :data:" -"`POSIX_FADV_SEQUENTIAL`, :data:`POSIX_FADV_RANDOM`, :data:" -"`POSIX_FADV_NOREUSE`, :data:`POSIX_FADV_WILLNEED` or :data:" -"`POSIX_FADV_DONTNEED`." +"*advice* is one " +"of :data:`POSIX_FADV_NORMAL`, :data:`POSIX_FADV_SEQUENTIAL`, :data:`POSIX_FADV_RANDOM`, :data:`POSIX_FADV_NOREUSE`, :data:`POSIX_FADV_WILLNEED` " +"or :data:`POSIX_FADV_DONTNEED`." msgstr "" -#: ../../library/os.rst:1431 +#: ../../library/os.rst:1457 msgid "" "Flags that can be used in *advice* in :func:`posix_fadvise` that specify the " "access pattern that is likely to be used." msgstr "" -#: ../../library/os.rst:1441 +#: ../../library/os.rst:1467 msgid "" "Read at most *n* bytes from file descriptor *fd* at a position of *offset*, " "leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1444 ../../library/os.rst:1620 +#: ../../library/os.rst:1470 ../../library/os.rst:1646 msgid "" "Return a bytestring containing the bytes read. If the end of the file " "referred to by *fd* has been reached, an empty bytes object is returned." msgstr "" -#: ../../library/os.rst:1454 +#: ../../library/os.rst:1480 msgid "Open and return a file descriptor for a master pseudo-terminal device." msgstr "" -#: ../../library/os.rst:1456 +#: ../../library/os.rst:1482 msgid "" "Calls the C standard library function :c:func:`posix_openpt`. The *oflag* " "argument is used to set file status flags and file access modes as specified " "in the manual page of :c:func:`posix_openpt` of your system." msgstr "" -#: ../../library/os.rst:1460 +#: ../../library/os.rst:1486 msgid "" "The returned file descriptor is :ref:`non-inheritable `. If " "the value :data:`O_CLOEXEC` is available on the system, it is added to " "*oflag*." msgstr "" -#: ../../library/os.rst:1471 +#: ../../library/os.rst:1497 msgid "" -"Read from a file descriptor *fd* at a position of *offset* into mutable :" -"term:`bytes-like objects ` *buffers*, leaving the file " -"offset unchanged. Transfer data into each buffer until it is full and then " -"move on to the next buffer in the sequence to hold the rest of the data." +"Read from a file descriptor *fd* at a position of *offset* into " +"mutable :term:`bytes-like objects ` *buffers*, leaving " +"the file offset unchanged. Transfer data into each buffer until it is full " +"and then move on to the next buffer in the sequence to hold the rest of the " +"data." msgstr "" -#: ../../library/os.rst:1476 ../../library/os.rst:1561 +#: ../../library/os.rst:1502 ../../library/os.rst:1587 msgid "" "The flags argument contains a bitwise OR of zero or more of the following " "flags:" msgstr "" -#: ../../library/os.rst:1479 +#: ../../library/os.rst:1505 msgid ":data:`RWF_HIPRI`" msgstr ":data:`RWF_HIPRI`" -#: ../../library/os.rst:1480 +#: ../../library/os.rst:1506 msgid ":data:`RWF_NOWAIT`" msgstr ":data:`RWF_NOWAIT`" -#: ../../library/os.rst:1482 ../../library/os.rst:1757 +#: ../../library/os.rst:1508 ../../library/os.rst:1829 msgid "" "Return the total number of bytes actually read which can be less than the " "total capacity of all the objects." msgstr "" -#: ../../library/os.rst:1485 ../../library/os.rst:1570 -#: ../../library/os.rst:1760 ../../library/os.rst:1835 +#: ../../library/os.rst:1511 ../../library/os.rst:1596 +#: ../../library/os.rst:1832 ../../library/os.rst:1907 msgid "" "The operating system may set a limit (:func:`sysconf` value " "``'SC_IOV_MAX'``) on the number of buffers that can be used." msgstr "" -#: ../../library/os.rst:1488 +#: ../../library/os.rst:1514 msgid "Combine the functionality of :func:`os.readv` and :func:`os.pread`." msgstr "" -#: ../../library/os.rst:1492 ../../library/os.rst:1577 +#: ../../library/os.rst:1518 ../../library/os.rst:1603 msgid "Using flags requires Linux >= 4.6." msgstr "" -#: ../../library/os.rst:1499 +#: ../../library/os.rst:1525 msgid "" "Do not wait for data which is not immediately available. If this flag is " "specified, the system call will return instantly if it would have to read " "data from the backing storage or wait for a lock." msgstr "" -#: ../../library/os.rst:1503 +#: ../../library/os.rst:1529 msgid "" "If some data was successfully read, it will return the number of bytes read. " -"If no bytes were read, it will return ``-1`` and set errno to :const:`errno." -"EAGAIN`." +"If no bytes were read, it will return ``-1`` and set errno " +"to :const:`errno.EAGAIN`." msgstr "" -#: ../../library/os.rst:1514 +#: ../../library/os.rst:1540 msgid "" "High priority read/write. Allows block-based filesystems to use polling of " "the device, which provides lower latency, but may use additional resources." msgstr "" -#: ../../library/os.rst:1518 +#: ../../library/os.rst:1544 msgid "" "Currently, on Linux, this feature is usable only on a file descriptor opened " "using the :data:`O_DIRECT` flag." msgstr "" -#: ../../library/os.rst:1528 +#: ../../library/os.rst:1554 msgid "" "Return the name of the slave pseudo-terminal device associated with the " "master pseudo-terminal device to which the file descriptor *fd* refers. The " "file descriptor *fd* is not closed upon failure." msgstr "" -#: ../../library/os.rst:1532 +#: ../../library/os.rst:1558 msgid "" "Calls the reentrant C standard library function :c:func:`ptsname_r` if it is " "available; otherwise, the C standard library function :c:func:`ptsname`, " "which is not guaranteed to be thread-safe, is called." msgstr "" -#: ../../library/os.rst:1543 +#: ../../library/os.rst:1569 msgid "" "Write the bytestring in *str* to file descriptor *fd* at position of " "*offset*, leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1546 ../../library/os.rst:1810 +#: ../../library/os.rst:1572 ../../library/os.rst:1882 msgid "Return the number of bytes actually written." msgstr "" -#: ../../library/os.rst:1555 +#: ../../library/os.rst:1581 msgid "" "Write the *buffers* contents to file descriptor *fd* at an offset *offset*, " -"leaving the file offset unchanged. *buffers* must be a sequence of :term:" -"`bytes-like objects `. Buffers are processed in array " -"order. Entire contents of the first buffer is written before proceeding to " -"the second, and so on." +"leaving the file offset unchanged. *buffers* must be a sequence " +"of :term:`bytes-like objects `. Buffers are processed in " +"array order. Entire contents of the first buffer is written before " +"proceeding to the second, and so on." msgstr "" -#: ../../library/os.rst:1564 +#: ../../library/os.rst:1590 msgid ":data:`RWF_DSYNC`" msgstr ":data:`RWF_DSYNC`" -#: ../../library/os.rst:1565 +#: ../../library/os.rst:1591 msgid ":data:`RWF_SYNC`" msgstr ":data:`RWF_SYNC`" -#: ../../library/os.rst:1566 +#: ../../library/os.rst:1592 msgid ":data:`RWF_APPEND`" msgstr ":data:`RWF_APPEND`" -#: ../../library/os.rst:1568 +#: ../../library/os.rst:1594 msgid "Return the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1573 +#: ../../library/os.rst:1599 msgid "Combine the functionality of :func:`os.writev` and :func:`os.pwrite`." msgstr "" -#: ../../library/os.rst:1584 +#: ../../library/os.rst:1610 msgid "" "Provide a per-write equivalent of the :data:`O_DSYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1594 +#: ../../library/os.rst:1620 msgid "" "Provide a per-write equivalent of the :data:`O_SYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1604 +#: ../../library/os.rst:1630 msgid "" "Provide a per-write equivalent of the :data:`O_APPEND` :func:`os.open` flag. " "This flag is meaningful only for :func:`os.pwritev`, and its effect applies " @@ -1801,39 +1836,71 @@ msgid "" "*offset* is updated." msgstr "" -#: ../../library/os.rst:1618 +#: ../../library/os.rst:1644 msgid "Read at most *n* bytes from file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1625 +#: ../../library/os.rst:1651 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To read a \"file " "object\" returned by the built-in function :func:`open` or by :func:`popen` " -"or :func:`fdopen`, or :data:`sys.stdin`, use its :meth:`~file.read` or :meth:" -"`~file.readline` methods." +"or :func:`fdopen`, or :data:`sys.stdin`, use its :meth:`~file.read` " +"or :meth:`~file.readline` methods." +msgstr "" + +#: ../../library/os.rst:1665 +msgid "" +"Read from a file descriptor *fd* into a mutable :ref:`buffer object " +"` *buffer*." msgstr "" -#: ../../library/os.rst:1640 +#: ../../library/os.rst:1668 +msgid "" +"The *buffer* should be mutable and :term:`bytes-like `. " +"On success, returns the number of bytes read. Less bytes may be read than " +"the size of the buffer. The underlying system call will be retried when " +"interrupted by a signal, unless the signal handler raises an exception. " +"Other errors will not be retried and an error will be raised." +msgstr "" + +#: ../../library/os.rst:1674 +msgid "" +"Returns 0 if *fd* is at end of file or if the provided *buffer* has length 0 " +"(which can be used to check for errors without reading data). Never returns " +"negative." +msgstr "" + +#: ../../library/os.rst:1680 +msgid "" +"This function is intended for low-level I/O and must be applied to a file " +"descriptor as returned by :func:`os.open` or :func:`os.pipe`. To read a " +"\"file object\" returned by the built-in function :func:`open`, " +"or :data:`sys.stdin`, use its member functions, for " +"example :meth:`io.BufferedIOBase.readinto`, :meth:`io.BufferedIOBase.read`, " +"or :meth:`io.TextIOBase.read`" +msgstr "" + +#: ../../library/os.rst:1693 msgid "" "Copy *count* bytes from file descriptor *in_fd* to file descriptor *out_fd* " "starting at *offset*. Return the number of bytes sent. When EOF is reached " "return ``0``." msgstr "" -#: ../../library/os.rst:1644 +#: ../../library/os.rst:1697 msgid "" -"The first function notation is supported by all platforms that define :func:" -"`sendfile`." +"The first function notation is supported by all platforms that " +"define :func:`sendfile`." msgstr "" -#: ../../library/os.rst:1647 +#: ../../library/os.rst:1700 msgid "" "On Linux, if *offset* is given as ``None``, the bytes are read from the " "current position of *in_fd* and the position of *in_fd* is updated." msgstr "" -#: ../../library/os.rst:1650 +#: ../../library/os.rst:1703 msgid "" "The second case may be used on macOS and FreeBSD where *headers* and " "*trailers* are arbitrary sequences of buffers that are written before and " @@ -1841,70 +1908,102 @@ msgid "" "case." msgstr "" -#: ../../library/os.rst:1654 +#: ../../library/os.rst:1707 msgid "" "On macOS and FreeBSD, a value of ``0`` for *count* specifies to send until " "the end of *in_fd* is reached." msgstr "" -#: ../../library/os.rst:1657 +#: ../../library/os.rst:1710 msgid "" "All platforms support sockets as *out_fd* file descriptor, and some " "platforms allow other types (e.g. regular file, pipe) as well." msgstr "" -#: ../../library/os.rst:1660 +#: ../../library/os.rst:1713 msgid "" "Cross-platform applications should not use *headers*, *trailers* and *flags* " "arguments." msgstr "" -#: ../../library/os.rst:1667 +#: ../../library/os.rst:1720 msgid "" -"For a higher-level wrapper of :func:`sendfile`, see :meth:`socket.socket." -"sendfile`." +"For a higher-level wrapper of :func:`sendfile`, " +"see :meth:`socket.socket.sendfile`." msgstr "" -#: ../../library/os.rst:1672 +#: ../../library/os.rst:1725 msgid "Parameters *out* and *in* was renamed to *out_fd* and *in_fd*." msgstr "" -#: ../../library/os.rst:1680 +#: ../../library/os.rst:1733 msgid "" "Parameters to the :func:`sendfile` function, if the implementation supports " "them." msgstr "" -#: ../../library/os.rst:1689 +#: ../../library/os.rst:1742 msgid "" "Parameter to the :func:`sendfile` function, if the implementation supports " "it. The data won't be cached in the virtual memory and will be freed " "afterwards." msgstr "" -#: ../../library/os.rst:1699 +#: ../../library/os.rst:1752 msgid "" -"Set the blocking mode of the specified file descriptor. Set the :data:" -"`O_NONBLOCK` flag if blocking is ``False``, clear the flag otherwise." +"Set the blocking mode of the specified file descriptor. Set " +"the :data:`O_NONBLOCK` flag if blocking is ``False``, clear the flag " +"otherwise." msgstr "" -#: ../../library/os.rst:1702 +#: ../../library/os.rst:1755 msgid "See also :func:`get_blocking` and :meth:`socket.socket.setblocking`." msgstr "另請參閱 :func:`get_blocking` 與 :meth:`socket.socket.setblocking`。" -#: ../../library/os.rst:1719 +#: ../../library/os.rst:1772 msgid "" "Transfer *count* bytes from file descriptor *src*, starting from offset " -"*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " +"*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*." +msgstr "" + +#: ../../library/os.rst:1775 +msgid "" +"The splicing behaviour can be modified by specifying a *flags* value. Any of " +"the following variables may used, combined using bitwise OR (the ``|`` " +"operator):" +msgstr "" + +#: ../../library/os.rst:1779 +msgid "" +"If :const:`SPLICE_F_MOVE` is specified, the kernel is asked to move pages " +"instead of copying, but pages may still be copied if the kernel cannot move " +"the pages from the pipe." +msgstr "" + +#: ../../library/os.rst:1783 +msgid "" +"If :const:`SPLICE_F_NONBLOCK` is specified, the kernel is asked to not block " +"on I/O. This makes the splice pipe operations nonblocking, but splice may " +"nevertheless block because the spliced file descriptors may block." +msgstr "" + +#: ../../library/os.rst:1788 +msgid "" +"If :const:`SPLICE_F_MORE` is specified, it hints to the kernel that more " +"data will be coming in a subsequent splice." +msgstr "" + +#: ../../library/os.rst:1791 +msgid "" "At least one of the file descriptors must refer to a pipe. If *offset_src* " "is ``None``, then *src* is read from the current position; respectively for " "*offset_dst*. The offset associated to the file descriptor that refers to a " "pipe must be ``None``. The files pointed to by *src* and *dst* must reside " -"in the same filesystem, otherwise an :exc:`OSError` is raised with :attr:" -"`~OSError.errno` set to :const:`errno.EXDEV`." +"in the same filesystem, otherwise an :exc:`OSError` is raised " +"with :attr:`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:1728 +#: ../../library/os.rst:1798 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -1912,7 +2011,7 @@ msgid "" "files are opened as binary." msgstr "" -#: ../../library/os.rst:1733 +#: ../../library/os.rst:1803 msgid "" "Upon successful completion, returns the number of bytes spliced to or from " "the pipe. A return value of 0 means end of input. If *src* refers to a pipe, " @@ -1921,7 +2020,12 @@ msgid "" "the pipe." msgstr "" -#: ../../library/os.rst:1752 +#: ../../library/os.rst:1809 +#, fuzzy +msgid "The :manpage:`splice(2)` man page." +msgstr ":manpage:`timerfd_create(2)` 手冊頁。" + +#: ../../library/os.rst:1824 msgid "" "Read from a file descriptor *fd* into a number of mutable :term:`bytes-like " "objects ` *buffers*. Transfer data into each buffer until " @@ -1929,50 +2033,50 @@ msgid "" "rest of the data." msgstr "" -#: ../../library/os.rst:1770 +#: ../../library/os.rst:1842 msgid "" "Return the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`)." msgstr "" -#: ../../library/os.rst:1778 +#: ../../library/os.rst:1850 msgid "" "Set the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`) to *pg*." msgstr "" -#: ../../library/os.rst:1786 +#: ../../library/os.rst:1858 msgid "" "Return a string which specifies the terminal device associated with file " "descriptor *fd*. If *fd* is not associated with a terminal device, an " "exception is raised." msgstr "" -#: ../../library/os.rst:1795 +#: ../../library/os.rst:1867 msgid "" "Unlock the slave pseudo-terminal device associated with the master pseudo-" "terminal device to which the file descriptor *fd* refers. The file " "descriptor *fd* is not closed upon failure." msgstr "" -#: ../../library/os.rst:1799 +#: ../../library/os.rst:1871 msgid "Calls the C standard library function :c:func:`unlockpt`." msgstr "" -#: ../../library/os.rst:1808 +#: ../../library/os.rst:1880 msgid "Write the bytestring in *str* to file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1814 +#: ../../library/os.rst:1886 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To write a " -"\"file object\" returned by the built-in function :func:`open` or by :func:" -"`popen` or :func:`fdopen`, or :data:`sys.stdout` or :data:`sys.stderr`, use " -"its :meth:`~file.write` method." +"\"file object\" returned by the built-in function :func:`open` or " +"by :func:`popen` or :func:`fdopen`, or :data:`sys.stdout` " +"or :data:`sys.stderr`, use its :meth:`~file.write` method." msgstr "" -#: ../../library/os.rst:1828 +#: ../../library/os.rst:1900 msgid "" "Write the contents of *buffers* to file descriptor *fd*. *buffers* must be a " "sequence of :term:`bytes-like objects `. Buffers are " @@ -1980,70 +2084,70 @@ msgid "" "before proceeding to the second, and so on." msgstr "" -#: ../../library/os.rst:1833 +#: ../../library/os.rst:1905 msgid "Returns the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1846 +#: ../../library/os.rst:1918 msgid "Querying the size of a terminal" msgstr "" -#: ../../library/os.rst:1852 +#: ../../library/os.rst:1924 msgid "" "Return the size of the terminal window as ``(columns, lines)``, tuple of " "type :class:`terminal_size`." msgstr "" -#: ../../library/os.rst:1855 +#: ../../library/os.rst:1927 msgid "" "The optional argument ``fd`` (default ``STDOUT_FILENO``, or standard output) " "specifies which file descriptor should be queried." msgstr "" -#: ../../library/os.rst:1858 +#: ../../library/os.rst:1930 msgid "" "If the file descriptor is not connected to a terminal, an :exc:`OSError` is " "raised." msgstr "" -#: ../../library/os.rst:1861 +#: ../../library/os.rst:1933 msgid "" ":func:`shutil.get_terminal_size` is the high-level function which should " "normally be used, ``os.get_terminal_size`` is the low-level implementation." msgstr "" -#: ../../library/os.rst:1869 +#: ../../library/os.rst:1941 msgid "" "A subclass of tuple, holding ``(columns, lines)`` of the terminal window " "size." msgstr "" -#: ../../library/os.rst:1873 +#: ../../library/os.rst:1945 msgid "Width of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1877 +#: ../../library/os.rst:1949 msgid "Height of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1883 +#: ../../library/os.rst:1955 msgid "Inheritance of File Descriptors" msgstr "" -#: ../../library/os.rst:1887 +#: ../../library/os.rst:1959 msgid "" "A file descriptor has an \"inheritable\" flag which indicates if the file " "descriptor can be inherited by child processes. Since Python 3.4, file " "descriptors created by Python are non-inheritable by default." msgstr "" -#: ../../library/os.rst:1891 +#: ../../library/os.rst:1963 msgid "" "On UNIX, non-inheritable file descriptors are closed in child processes at " "the execution of a new program, other file descriptors are inherited." msgstr "" -#: ../../library/os.rst:1894 +#: ../../library/os.rst:1966 msgid "" "On Windows, non-inheritable handles and file descriptors are closed in child " "processes, except for standard streams (file descriptors 0, 1 and 2: stdin, " @@ -2054,38 +2158,38 @@ msgid "" "only inherited if the *close_fds* parameter is ``False``." msgstr "" -#: ../../library/os.rst:1902 +#: ../../library/os.rst:1974 msgid "On WebAssembly platforms, the file descriptor cannot be modified." msgstr "" -#: ../../library/os.rst:1906 +#: ../../library/os.rst:1978 msgid "" "Get the \"inheritable\" flag of the specified file descriptor (a boolean)." msgstr "" -#: ../../library/os.rst:1910 +#: ../../library/os.rst:1982 msgid "Set the \"inheritable\" flag of the specified file descriptor." msgstr "" -#: ../../library/os.rst:1914 +#: ../../library/os.rst:1986 msgid "Get the \"inheritable\" flag of the specified handle (a boolean)." msgstr "" -#: ../../library/os.rst:1920 +#: ../../library/os.rst:1992 msgid "Set the \"inheritable\" flag of the specified handle." msgstr "" -#: ../../library/os.rst:1928 +#: ../../library/os.rst:2000 msgid "Files and Directories" msgstr "" -#: ../../library/os.rst:1930 +#: ../../library/os.rst:2002 msgid "" "On some Unix platforms, many of these functions support one or more of these " "features:" msgstr "" -#: ../../library/os.rst:1935 +#: ../../library/os.rst:2007 msgid "" "**specifying a file descriptor:** Normally the *path* argument provided to " "functions in the :mod:`os` module must be a string specifying a file path. " @@ -2096,21 +2200,21 @@ msgid "" "``chdir``).)" msgstr "" -#: ../../library/os.rst:1943 +#: ../../library/os.rst:2015 msgid "" "You can check whether or not *path* can be specified as a file descriptor " "for a particular function on your platform using :data:`os.supports_fd`. If " -"this functionality is unavailable, using it will raise a :exc:" -"`NotImplementedError`." +"this functionality is unavailable, using it will raise " +"a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1948 +#: ../../library/os.rst:2020 msgid "" "If the function also supports *dir_fd* or *follow_symlinks* arguments, it's " "an error to specify one of those when supplying *path* as a file descriptor." msgstr "" -#: ../../library/os.rst:1953 +#: ../../library/os.rst:2025 msgid "" "**paths relative to directory descriptors:** If *dir_fd* is not ``None``, it " "should be a file descriptor referring to a directory, and the path to " @@ -2121,14 +2225,14 @@ msgid "" "``access``)." msgstr "" -#: ../../library/os.rst:1960 +#: ../../library/os.rst:2032 msgid "" "You can check whether or not *dir_fd* is supported for a particular function " "on your platform using :data:`os.supports_dir_fd`. If it's unavailable, " "using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1966 +#: ../../library/os.rst:2038 msgid "" "**not following symlinks:** If *follow_symlinks* is ``False``, and the last " "element of the path to operate on is a symbolic link, the function will " @@ -2137,32 +2241,32 @@ msgid "" "function.)" msgstr "" -#: ../../library/os.rst:1972 +#: ../../library/os.rst:2044 msgid "" "You can check whether or not *follow_symlinks* is supported for a particular " "function on your platform using :data:`os.supports_follow_symlinks`. If it's " "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1980 +#: ../../library/os.rst:2052 msgid "" "Use the real uid/gid to test for access to *path*. Note that most " "operations will use the effective uid/gid, therefore this routine can be " "used in a suid/sgid environment to test if the invoking user has the " "specified access to *path*. *mode* should be :const:`F_OK` to test the " -"existence of *path*, or it can be the inclusive OR of one or more of :const:" -"`R_OK`, :const:`W_OK`, and :const:`X_OK` to test permissions. Return :const:" -"`True` if access is allowed, :const:`False` if not. See the Unix man page :" -"manpage:`access(2)` for more information." +"existence of *path*, or it can be the inclusive OR of one or more " +"of :const:`R_OK`, :const:`W_OK`, and :const:`X_OK` to test permissions. " +"Return :const:`True` if access is allowed, :const:`False` if not. See the " +"Unix man page :manpage:`access(2)` for more information." msgstr "" -#: ../../library/os.rst:1989 +#: ../../library/os.rst:2061 msgid "" "This function can support specifying :ref:`paths relative to directory " "descriptors ` and :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:1992 +#: ../../library/os.rst:2064 msgid "" "If *effective_ids* is ``True``, :func:`access` will perform its access " "checks using the effective uid/gid instead of the real uid/gid. " @@ -2171,7 +2275,7 @@ msgid "" "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:2000 +#: ../../library/os.rst:2072 msgid "" "Using :func:`access` to check if a user is authorized to e.g. open a file " "before actually doing so using :func:`open` creates a security hole, because " @@ -2180,7 +2284,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/os.rst:2006 +#: ../../library/os.rst:2078 msgid "" "if os.access(\"myfile\", os.R_OK):\n" " with open(\"myfile\") as fp:\n" @@ -2192,11 +2296,11 @@ msgstr "" " return fp.read()\n" "return \"some default data\"" -#: ../../library/os.rst:2011 +#: ../../library/os.rst:2083 msgid "is better written as::" msgstr "" -#: ../../library/os.rst:2013 +#: ../../library/os.rst:2085 msgid "" "try:\n" " fp = open(\"myfile\")\n" @@ -2214,216 +2318,217 @@ msgstr "" " with fp:\n" " return fp.read()" -#: ../../library/os.rst:2023 +#: ../../library/os.rst:2095 msgid "" "I/O operations may fail even when :func:`access` indicates that they would " "succeed, particularly for operations on network filesystems which may have " "permissions semantics beyond the usual POSIX permission-bit model." msgstr "" -#: ../../library/os.rst:2027 +#: ../../library/os.rst:2099 msgid "Added the *dir_fd*, *effective_ids*, and *follow_symlinks* parameters." msgstr "新增 *dir_fd*、*effective_ids* 與 *follow_symlinks* 參數。" -#: ../../library/os.rst:2039 +#: ../../library/os.rst:2111 msgid "" "Values to pass as the *mode* parameter of :func:`access` to test the " "existence, readability, writability and executability of *path*, " "respectively." msgstr "" -#: ../../library/os.rst:2048 +#: ../../library/os.rst:2120 msgid "Change the current working directory to *path*." msgstr "" -#: ../../library/os.rst:2050 +#: ../../library/os.rst:2122 msgid "" "This function can support :ref:`specifying a file descriptor `. " "The descriptor must refer to an opened directory, not an open file." msgstr "" -#: ../../library/os.rst:2053 +#: ../../library/os.rst:2125 msgid "" -"This function can raise :exc:`OSError` and subclasses such as :exc:" -"`FileNotFoundError`, :exc:`PermissionError`, and :exc:`NotADirectoryError`." +"This function can raise :exc:`OSError` and subclasses such " +"as :exc:`FileNotFoundError`, :exc:`PermissionError`, " +"and :exc:`NotADirectoryError`." msgstr "" -#: ../../library/os.rst:2056 ../../library/os.rst:2194 +#: ../../library/os.rst:2128 ../../library/os.rst:2266 msgid "" "Raises an :ref:`auditing event ` ``os.chdir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.chdir``。" -#: ../../library/os.rst:2058 +#: ../../library/os.rst:2130 msgid "" "Added support for specifying *path* as a file descriptor on some platforms." msgstr "" -#: ../../library/os.rst:2068 +#: ../../library/os.rst:2140 msgid "" "Set the flags of *path* to the numeric *flags*. *flags* may take a " -"combination (bitwise OR) of the following values (as defined in the :mod:" -"`stat` module):" +"combination (bitwise OR) of the following values (as defined in " +"the :mod:`stat` module):" msgstr "" -#: ../../library/os.rst:2071 +#: ../../library/os.rst:2143 msgid ":const:`stat.UF_NODUMP`" msgstr ":const:`stat.UF_NODUMP`" -#: ../../library/os.rst:2072 +#: ../../library/os.rst:2144 msgid ":const:`stat.UF_IMMUTABLE`" msgstr ":const:`stat.UF_IMMUTABLE`" -#: ../../library/os.rst:2073 +#: ../../library/os.rst:2145 msgid ":const:`stat.UF_APPEND`" msgstr ":const:`stat.UF_APPEND`" -#: ../../library/os.rst:2074 +#: ../../library/os.rst:2146 msgid ":const:`stat.UF_OPAQUE`" msgstr ":const:`stat.UF_OPAQUE`" -#: ../../library/os.rst:2075 +#: ../../library/os.rst:2147 msgid ":const:`stat.UF_NOUNLINK`" msgstr ":const:`stat.UF_NOUNLINK`" -#: ../../library/os.rst:2076 +#: ../../library/os.rst:2148 msgid ":const:`stat.UF_COMPRESSED`" msgstr ":const:`stat.UF_COMPRESSED`" -#: ../../library/os.rst:2077 +#: ../../library/os.rst:2149 msgid ":const:`stat.UF_HIDDEN`" msgstr ":const:`stat.UF_HIDDEN`" -#: ../../library/os.rst:2078 +#: ../../library/os.rst:2150 msgid ":const:`stat.SF_ARCHIVED`" msgstr ":const:`stat.SF_ARCHIVED`" -#: ../../library/os.rst:2079 +#: ../../library/os.rst:2151 msgid ":const:`stat.SF_IMMUTABLE`" msgstr ":const:`stat.SF_IMMUTABLE`" -#: ../../library/os.rst:2080 +#: ../../library/os.rst:2152 msgid ":const:`stat.SF_APPEND`" msgstr ":const:`stat.SF_APPEND`" -#: ../../library/os.rst:2081 +#: ../../library/os.rst:2153 msgid ":const:`stat.SF_NOUNLINK`" msgstr ":const:`stat.SF_NOUNLINK`" -#: ../../library/os.rst:2082 +#: ../../library/os.rst:2154 msgid ":const:`stat.SF_SNAPSHOT`" msgstr ":const:`stat.SF_SNAPSHOT`" -#: ../../library/os.rst:2084 +#: ../../library/os.rst:2156 msgid "" "This function can support :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:2086 ../../library/os.rst:2220 +#: ../../library/os.rst:2158 ../../library/os.rst:2292 msgid "" "Raises an :ref:`auditing event ` ``os.chflags`` with arguments " "``path``, ``flags``." msgstr "" -"引發一個附帶引數 ``path``、``flags`` 的\\ :ref:`稽核事件 ` ``os." -"chflags``。" +"引發一個附帶引數 ``path``、``flags`` 的\\ :ref:`稽核事件 ` " +"``os.chflags``。" -#: ../../library/os.rst:2090 +#: ../../library/os.rst:2162 msgid "Added the *follow_symlinks* parameter." msgstr "新增 *follow_symlinks* 參數。" -#: ../../library/os.rst:2099 +#: ../../library/os.rst:2171 msgid "" "Change the mode of *path* to the numeric *mode*. *mode* may take one of the " "following values (as defined in the :mod:`stat` module) or bitwise ORed " "combinations of them:" msgstr "" -#: ../../library/os.rst:2103 +#: ../../library/os.rst:2175 msgid ":const:`stat.S_ISUID`" msgstr ":const:`stat.S_ISUID`" -#: ../../library/os.rst:2104 +#: ../../library/os.rst:2176 msgid ":const:`stat.S_ISGID`" msgstr ":const:`stat.S_ISGID`" -#: ../../library/os.rst:2105 +#: ../../library/os.rst:2177 msgid ":const:`stat.S_ENFMT`" msgstr ":const:`stat.S_ENFMT`" -#: ../../library/os.rst:2106 +#: ../../library/os.rst:2178 msgid ":const:`stat.S_ISVTX`" msgstr ":const:`stat.S_ISVTX`" -#: ../../library/os.rst:2107 +#: ../../library/os.rst:2179 msgid ":const:`stat.S_IREAD`" msgstr ":const:`stat.S_IREAD`" -#: ../../library/os.rst:2108 +#: ../../library/os.rst:2180 msgid ":const:`stat.S_IWRITE`" msgstr ":const:`stat.S_IWRITE`" -#: ../../library/os.rst:2109 +#: ../../library/os.rst:2181 msgid ":const:`stat.S_IEXEC`" msgstr ":const:`stat.S_IEXEC`" -#: ../../library/os.rst:2110 +#: ../../library/os.rst:2182 msgid ":const:`stat.S_IRWXU`" msgstr ":const:`stat.S_IRWXU`" -#: ../../library/os.rst:2111 +#: ../../library/os.rst:2183 msgid ":const:`stat.S_IRUSR`" msgstr ":const:`stat.S_IRUSR`" -#: ../../library/os.rst:2112 +#: ../../library/os.rst:2184 msgid ":const:`stat.S_IWUSR`" msgstr ":const:`stat.S_IWUSR`" -#: ../../library/os.rst:2113 +#: ../../library/os.rst:2185 msgid ":const:`stat.S_IXUSR`" msgstr ":const:`stat.S_IXUSR`" -#: ../../library/os.rst:2114 +#: ../../library/os.rst:2186 msgid ":const:`stat.S_IRWXG`" msgstr ":const:`stat.S_IRWXG`" -#: ../../library/os.rst:2115 +#: ../../library/os.rst:2187 msgid ":const:`stat.S_IRGRP`" msgstr ":const:`stat.S_IRGRP`" -#: ../../library/os.rst:2116 +#: ../../library/os.rst:2188 msgid ":const:`stat.S_IWGRP`" msgstr ":const:`stat.S_IWGRP`" -#: ../../library/os.rst:2117 +#: ../../library/os.rst:2189 msgid ":const:`stat.S_IXGRP`" msgstr ":const:`stat.S_IXGRP`" -#: ../../library/os.rst:2118 +#: ../../library/os.rst:2190 msgid ":const:`stat.S_IRWXO`" msgstr ":const:`stat.S_IRWXO`" -#: ../../library/os.rst:2119 +#: ../../library/os.rst:2191 msgid ":const:`stat.S_IROTH`" msgstr ":const:`stat.S_IROTH`" -#: ../../library/os.rst:2120 +#: ../../library/os.rst:2192 msgid ":const:`stat.S_IWOTH`" msgstr ":const:`stat.S_IWOTH`" -#: ../../library/os.rst:2121 +#: ../../library/os.rst:2193 msgid ":const:`stat.S_IXOTH`" msgstr ":const:`stat.S_IXOTH`" -#: ../../library/os.rst:2123 ../../library/os.rst:2156 -#: ../../library/os.rst:3547 +#: ../../library/os.rst:2195 ../../library/os.rst:2228 +#: ../../library/os.rst:3620 msgid "" -"This function can support :ref:`specifying a file descriptor `, :" -"ref:`paths relative to directory descriptors ` and :ref:`not " -"following symlinks `." +"This function can support :ref:`specifying a file descriptor " +"`, :ref:`paths relative to directory descriptors ` " +"and :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:2129 +#: ../../library/os.rst:2201 msgid "" "Although Windows supports :func:`chmod`, you can only set the file's read-" "only flag with it (via the ``stat.S_IWRITE`` and ``stat.S_IREAD`` constants " @@ -2431,100 +2536,101 @@ msgid "" "value of *follow_symlinks* is ``False`` on Windows." msgstr "" -#: ../../library/os.rst:2139 ../../library/os.rst:2170 +#: ../../library/os.rst:2211 ../../library/os.rst:2242 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd* and *follow_symlinks* arguments." msgstr "" -#: ../../library/os.rst:2146 +#: ../../library/os.rst:2218 msgid "" "Added support for a file descriptor and the *follow_symlinks* argument on " "Windows." msgstr "" -#: ../../library/os.rst:2153 +#: ../../library/os.rst:2225 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. To " "leave one of the ids unchanged, set it to -1." msgstr "" -#: ../../library/os.rst:2160 +#: ../../library/os.rst:2232 msgid "" "See :func:`shutil.chown` for a higher-level function that accepts names in " "addition to numeric ids." msgstr "" -#: ../../library/os.rst:2174 +#: ../../library/os.rst:2246 msgid "Supports a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:2180 +#: ../../library/os.rst:2252 msgid "Change the root directory of the current process to *path*." msgstr "" -#: ../../library/os.rst:2190 +#: ../../library/os.rst:2262 msgid "" "Change the current working directory to the directory represented by the " "file descriptor *fd*. The descriptor must refer to an opened directory, not " "an open file. As of Python 3.3, this is equivalent to ``os.chdir(fd)``." msgstr "" -#: ../../library/os.rst:2201 +#: ../../library/os.rst:2273 msgid "Return a string representing the current working directory." msgstr "" -#: ../../library/os.rst:2206 +#: ../../library/os.rst:2278 msgid "Return a bytestring representing the current working directory." msgstr "" -#: ../../library/os.rst:2208 +#: ../../library/os.rst:2280 msgid "" "The function now uses the UTF-8 encoding on Windows, rather than the ANSI " "code page: see :pep:`529` for the rationale. The function is no longer " "deprecated on Windows." msgstr "" -#: ../../library/os.rst:2216 +#: ../../library/os.rst:2288 msgid "" "Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do " -"not follow symbolic links. As of Python 3.3, this is equivalent to ``os." -"chflags(path, flags, follow_symlinks=False)``." +"not follow symbolic links. As of Python 3.3, this is equivalent to " +"``os.chflags(path, flags, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2230 +#: ../../library/os.rst:2302 msgid "" "Change the mode of *path* to the numeric *mode*. If path is a symlink, this " "affects the symlink rather than the target. See the docs for :func:`chmod` " -"for possible values of *mode*. As of Python 3.3, this is equivalent to ``os." -"chmod(path, mode, follow_symlinks=False)``." +"for possible values of *mode*. As of Python 3.3, this is equivalent to " +"``os.chmod(path, mode, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2235 +#: ../../library/os.rst:2307 msgid "" "``lchmod()`` is not part of POSIX, but Unix implementations may have it if " "changing the mode of symbolic links is supported." msgstr "" -#: ../../library/os.rst:2250 +#: ../../library/os.rst:2322 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. " "This function will not follow symbolic links. As of Python 3.3, this is " "equivalent to ``os.chown(path, uid, gid, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2264 +#: ../../library/os.rst:2336 msgid "Create a hard link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:2266 +#: ../../library/os.rst:2338 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " -"supply :ref:`paths relative to directory descriptors `, and :ref:" -"`not following symlinks `." +"supply :ref:`paths relative to directory descriptors `, " +"and :ref:`not following symlinks `. The default value of " +"*follow_symlinks* is ``False`` on Windows." msgstr "" -#: ../../library/os.rst:2270 +#: ../../library/os.rst:2343 msgid "" "Raises an :ref:`auditing event ` ``os.link`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." @@ -2532,20 +2638,20 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``src_dir_fd``、``dst_dir_fd`` 的\\ :ref:`" "稽核事件 ` ``os.link``。" -#: ../../library/os.rst:2274 ../../library/os.rst:4544 +#: ../../library/os.rst:2347 ../../library/os.rst:4617 msgid "Added Windows support." msgstr "新支援 Windows。" -#: ../../library/os.rst:2277 +#: ../../library/os.rst:2350 msgid "Added the *src_dir_fd*, *dst_dir_fd*, and *follow_symlinks* parameters." msgstr "新增 *src_dir_fd*、*dst_dir_fd* 與 *follow_symlinks* 參數。" -#: ../../library/os.rst:2280 ../../library/os.rst:2704 -#: ../../library/os.rst:2741 ../../library/os.rst:3469 +#: ../../library/os.rst:2353 ../../library/os.rst:2777 +#: ../../library/os.rst:2814 ../../library/os.rst:3542 msgid "Accepts a :term:`path-like object` for *src* and *dst*." msgstr "" -#: ../../library/os.rst:2286 +#: ../../library/os.rst:2359 msgid "" "Return a list containing the names of the entries in the directory given by " "*path*. The list is in arbitrary order, and does not include the special " @@ -2554,7 +2660,7 @@ msgid "" "function, whether a name for that file be included is unspecified." msgstr "" -#: ../../library/os.rst:2292 +#: ../../library/os.rst:2365 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the " @@ -2562,42 +2668,42 @@ msgid "" "circumstances, they will be of type ``str``." msgstr "" -#: ../../library/os.rst:2297 ../../library/os.rst:2789 +#: ../../library/os.rst:2370 ../../library/os.rst:2862 msgid "" "This function can also support :ref:`specifying a file descriptor " "`; the file descriptor must refer to a directory." msgstr "" -#: ../../library/os.rst:2300 +#: ../../library/os.rst:2373 msgid "" "Raises an :ref:`auditing event ` ``os.listdir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listdir``。" -#: ../../library/os.rst:2303 +#: ../../library/os.rst:2376 msgid "To encode ``str`` filenames to ``bytes``, use :func:`~os.fsencode`." msgstr "" -#: ../../library/os.rst:2307 +#: ../../library/os.rst:2380 msgid "" "The :func:`scandir` function returns directory entries along with file " "attribute information, giving better performance for many common use cases." msgstr "" -#: ../../library/os.rst:2311 +#: ../../library/os.rst:2384 msgid "The *path* parameter became optional." msgstr "" -#: ../../library/os.rst:2314 ../../library/os.rst:3328 +#: ../../library/os.rst:2387 ../../library/os.rst:3401 msgid "Added support for specifying *path* as an open file descriptor." msgstr "" -#: ../../library/os.rst:2323 +#: ../../library/os.rst:2396 msgid "Return a list containing the names of drives on a Windows system." msgstr "" -#: ../../library/os.rst:2325 +#: ../../library/os.rst:2398 msgid "" "A drive name typically looks like ``'C:\\\\'``. Not every drive name will be " "associated with a volume, and some may be inaccessible for a variety of " @@ -2605,54 +2711,54 @@ msgid "" "function does not test for access." msgstr "" -#: ../../library/os.rst:2330 +#: ../../library/os.rst:2403 msgid "May raise :exc:`OSError` if an error occurs collecting the drive names." msgstr "" -#: ../../library/os.rst:2333 +#: ../../library/os.rst:2406 msgid "" "Raises an :ref:`auditing event ` ``os.listdrives`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.listdrives``。" -#: ../../library/os.rst:2342 +#: ../../library/os.rst:2415 msgid "" "Return a list containing the mount points for a volume on a Windows system." msgstr "" -#: ../../library/os.rst:2345 +#: ../../library/os.rst:2418 msgid "" -"*volume* must be represented as a GUID path, like those returned by :func:" -"`os.listvolumes`. Volumes may be mounted in multiple locations or not at " -"all. In the latter case, the list will be empty. Mount points that are not " -"associated with a volume will not be returned by this function." +"*volume* must be represented as a GUID path, like those returned " +"by :func:`os.listvolumes`. Volumes may be mounted in multiple locations or " +"not at all. In the latter case, the list will be empty. Mount points that " +"are not associated with a volume will not be returned by this function." msgstr "" -#: ../../library/os.rst:2351 +#: ../../library/os.rst:2424 msgid "" "The mount points return by this function will be absolute paths, and may be " "longer than the drive name." msgstr "" -#: ../../library/os.rst:2354 +#: ../../library/os.rst:2427 msgid "" "Raises :exc:`OSError` if the volume is not recognized or if an error occurs " "collecting the paths." msgstr "" -#: ../../library/os.rst:2357 +#: ../../library/os.rst:2430 msgid "" "Raises an :ref:`auditing event ` ``os.listmounts`` with argument " "``volume``." msgstr "" -"引發一個附帶引數 ``volume`` 的\\ :ref:`稽核事件 ` ``os." -"listmounts``。" +"引發一個附帶引數 ``volume`` 的\\ :ref:`稽核事件 ` " +"``os.listmounts``。" -#: ../../library/os.rst:2366 +#: ../../library/os.rst:2439 msgid "Return a list containing the volumes in the system." msgstr "" -#: ../../library/os.rst:2368 +#: ../../library/os.rst:2441 msgid "" "Volumes are typically represented as a GUID path that looks like ``\\\\?" "\\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\\``. Files can usually be " @@ -2661,68 +2767,68 @@ msgid "" "function is to retrieve mount points using :func:`os.listmounts`." msgstr "" -#: ../../library/os.rst:2375 +#: ../../library/os.rst:2448 msgid "May raise :exc:`OSError` if an error occurs collecting the volumes." msgstr "" -#: ../../library/os.rst:2377 +#: ../../library/os.rst:2450 msgid "" "Raises an :ref:`auditing event ` ``os.listvolumes`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.listvolumes``。" -#: ../../library/os.rst:2386 +#: ../../library/os.rst:2459 msgid "" "Perform the equivalent of an :c:func:`!lstat` system call on the given path. " -"Similar to :func:`~os.stat`, but does not follow symbolic links. Return a :" -"class:`stat_result` object." +"Similar to :func:`~os.stat`, but does not follow symbolic links. Return " +"a :class:`stat_result` object." msgstr "" -#: ../../library/os.rst:2390 +#: ../../library/os.rst:2463 msgid "" -"On platforms that do not support symbolic links, this is an alias for :func:" -"`~os.stat`." +"On platforms that do not support symbolic links, this is an alias " +"for :func:`~os.stat`." msgstr "" -#: ../../library/os.rst:2393 +#: ../../library/os.rst:2466 msgid "" "As of Python 3.3, this is equivalent to ``os.stat(path, dir_fd=dir_fd, " "follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2396 ../../library/os.rst:2438 -#: ../../library/os.rst:2506 ../../library/os.rst:2534 -#: ../../library/os.rst:2608 +#: ../../library/os.rst:2469 ../../library/os.rst:2511 +#: ../../library/os.rst:2579 ../../library/os.rst:2607 +#: ../../library/os.rst:2681 msgid "" "This function can also support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2403 ../../library/os.rst:2617 -#: ../../library/os.rst:3462 +#: ../../library/os.rst:2476 ../../library/os.rst:2690 +#: ../../library/os.rst:3535 msgid "Added support for Windows 6.0 (Vista) symbolic links." msgstr "" -#: ../../library/os.rst:2412 +#: ../../library/os.rst:2485 msgid "" "On Windows, now opens reparse points that represent another path (name " "surrogates), including symbolic links and directory junctions. Other kinds " -"of reparse points are resolved by the operating system as for :func:`~os." -"stat`." +"of reparse points are resolved by the operating system as " +"for :func:`~os.stat`." msgstr "" -#: ../../library/os.rst:2421 +#: ../../library/os.rst:2494 msgid "Create a directory named *path* with numeric mode *mode*." msgstr "" -#: ../../library/os.rst:2423 +#: ../../library/os.rst:2496 msgid "" "If the directory already exists, :exc:`FileExistsError` is raised. If a " "parent directory in the path does not exist, :exc:`FileNotFoundError` is " "raised." msgstr "" -#: ../../library/os.rst:2428 +#: ../../library/os.rst:2501 msgid "" "On some systems, *mode* is ignored. Where it is used, the current umask " "value is first masked out. If bits other than the last 9 (i.e. the last 3 " @@ -2731,20 +2837,20 @@ msgid "" "call :func:`chmod` explicitly to set them." msgstr "" -#: ../../library/os.rst:2434 +#: ../../library/os.rst:2507 msgid "" "On Windows, a *mode* of ``0o700`` is specifically handled to apply access " "control to the new directory such that only the current user and " "administrators have access. Other values of *mode* are ignored." msgstr "" -#: ../../library/os.rst:2441 +#: ../../library/os.rst:2514 msgid "" "It is also possible to create temporary directories; see the :mod:`tempfile` " "module's :func:`tempfile.mkdtemp` function." msgstr "" -#: ../../library/os.rst:2444 ../../library/os.rst:2481 +#: ../../library/os.rst:2517 ../../library/os.rst:2554 msgid "" "Raises an :ref:`auditing event ` ``os.mkdir`` with arguments " "``path``, ``mode``, ``dir_fd``." @@ -2752,17 +2858,17 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.mkdir``。" -#: ../../library/os.rst:2452 +#: ../../library/os.rst:2525 msgid "Windows now handles a *mode* of ``0o700``." msgstr "" -#: ../../library/os.rst:2462 +#: ../../library/os.rst:2535 msgid "" "Recursive directory creation function. Like :func:`mkdir`, but makes all " "intermediate-level directories needed to contain the leaf directory." msgstr "" -#: ../../library/os.rst:2465 +#: ../../library/os.rst:2538 msgid "" "The *mode* parameter is passed to :func:`mkdir` for creating the leaf " "directory; see :ref:`the mkdir() description ` for how it is " @@ -2771,47 +2877,47 @@ msgid "" "file permission bits of existing parent directories are not changed." msgstr "" -#: ../../library/os.rst:2471 +#: ../../library/os.rst:2544 msgid "" "If *exist_ok* is ``False`` (the default), a :exc:`FileExistsError` is raised " "if the target directory already exists." msgstr "" -#: ../../library/os.rst:2476 +#: ../../library/os.rst:2549 msgid "" ":func:`makedirs` will become confused if the path elements to create " "include :data:`pardir` (eg. \"..\" on UNIX systems)." msgstr "" -#: ../../library/os.rst:2479 +#: ../../library/os.rst:2552 msgid "This function handles UNC paths correctly." msgstr "" -#: ../../library/os.rst:2483 +#: ../../library/os.rst:2556 msgid "Added the *exist_ok* parameter." msgstr "新增 *exist_ok* 參數。" -#: ../../library/os.rst:2488 +#: ../../library/os.rst:2561 msgid "" -"Before Python 3.4.1, if *exist_ok* was ``True`` and the directory existed, :" -"func:`makedirs` would still raise an error if *mode* did not match the mode " -"of the existing directory. Since this behavior was impossible to implement " -"safely, it was removed in Python 3.4.1. See :issue:`21082`." +"Before Python 3.4.1, if *exist_ok* was ``True`` and the directory " +"existed, :func:`makedirs` would still raise an error if *mode* did not match " +"the mode of the existing directory. Since this behavior was impossible to " +"implement safely, it was removed in Python 3.4.1. See :issue:`21082`." msgstr "" -#: ../../library/os.rst:2496 +#: ../../library/os.rst:2569 msgid "" "The *mode* argument no longer affects the file permission bits of newly " "created intermediate-level directories." msgstr "" -#: ../../library/os.rst:2503 +#: ../../library/os.rst:2576 msgid "" "Create a FIFO (a named pipe) named *path* with numeric mode *mode*. The " "current umask value is first masked out from the mode." msgstr "" -#: ../../library/os.rst:2509 +#: ../../library/os.rst:2582 msgid "" "FIFOs are pipes that can be accessed like regular files. FIFOs exist until " "they are deleted (for example with :func:`os.unlink`). Generally, FIFOs are " @@ -2821,34 +2927,34 @@ msgid "" "rendezvous point." msgstr "" -#: ../../library/os.rst:2526 +#: ../../library/os.rst:2599 msgid "" "Create a filesystem node (file, device special file or named pipe) named " "*path*. *mode* specifies both the permissions to use and the type of node to " -"be created, being combined (bitwise OR) with one of ``stat.S_IFREG``, ``stat." -"S_IFCHR``, ``stat.S_IFBLK``, and ``stat.S_IFIFO`` (those constants are " -"available in :mod:`stat`). For ``stat.S_IFCHR`` and ``stat.S_IFBLK``, " -"*device* defines the newly created device special file (probably using :func:" -"`os.makedev`), otherwise it is ignored." +"be created, being combined (bitwise OR) with one of ``stat.S_IFREG``, " +"``stat.S_IFCHR``, ``stat.S_IFBLK``, and ``stat.S_IFIFO`` (those constants " +"are available in :mod:`stat`). For ``stat.S_IFCHR`` and ``stat.S_IFBLK``, " +"*device* defines the newly created device special file (probably " +"using :func:`os.makedev`), otherwise it is ignored." msgstr "" -#: ../../library/os.rst:2548 +#: ../../library/os.rst:2621 msgid "" -"Extract the device major number from a raw device number (usually the :attr:" -"`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." +"Extract the device major number from a raw device number (usually " +"the :attr:`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: ../../library/os.rst:2554 +#: ../../library/os.rst:2627 msgid "" -"Extract the device minor number from a raw device number (usually the :attr:" -"`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." +"Extract the device minor number from a raw device number (usually " +"the :attr:`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: ../../library/os.rst:2560 +#: ../../library/os.rst:2633 msgid "Compose a raw device number from the major and minor device numbers." msgstr "" -#: ../../library/os.rst:2565 +#: ../../library/os.rst:2638 msgid "" "Return system configuration information relevant to a named file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -2859,71 +2965,72 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:2578 ../../library/os.rst:3321 -#: ../../library/os.rst:3490 +#: ../../library/os.rst:2651 ../../library/os.rst:3394 +#: ../../library/os.rst:3563 msgid "" "This function can support :ref:`specifying a file descriptor `." msgstr "" -#: ../../library/os.rst:2589 +#: ../../library/os.rst:2662 msgid "" "Dictionary mapping names accepted by :func:`pathconf` and :func:`fpathconf` " "to the integer values defined for those names by the host operating system. " "This can be used to determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:2598 +#: ../../library/os.rst:2671 msgid "" "Return a string representing the path to which the symbolic link points. " "The result may be either an absolute or relative pathname; if it is " -"relative, it may be converted to an absolute pathname using ``os.path." -"join(os.path.dirname(path), result)``." +"relative, it may be converted to an absolute pathname using " +"``os.path.join(os.path.dirname(path), result)``." msgstr "" -#: ../../library/os.rst:2603 +#: ../../library/os.rst:2676 msgid "" -"If the *path* is a string object (directly or indirectly through a :class:" -"`PathLike` interface), the result will also be a string object, and the call " -"may raise a UnicodeDecodeError. If the *path* is a bytes object (direct or " -"indirectly), the result will be a bytes object." +"If the *path* is a string object (directly or indirectly through " +"a :class:`PathLike` interface), the result will also be a string object, and " +"the call may raise a UnicodeDecodeError. If the *path* is a bytes object " +"(direct or indirectly), the result will be a bytes object." msgstr "" -#: ../../library/os.rst:2611 +#: ../../library/os.rst:2684 msgid "" -"When trying to resolve a path that may contain links, use :func:`~os.path." -"realpath` to properly handle recursion and platform differences." +"When trying to resolve a path that may contain links, " +"use :func:`~os.path.realpath` to properly handle recursion and platform " +"differences." msgstr "" -#: ../../library/os.rst:2623 +#: ../../library/os.rst:2696 msgid "Accepts a :term:`path-like object` on Unix." msgstr "" -#: ../../library/os.rst:2626 +#: ../../library/os.rst:2699 msgid "Accepts a :term:`path-like object` and a bytes object on Windows." msgstr "" -#: ../../library/os.rst:2629 +#: ../../library/os.rst:2702 msgid "" "Added support for directory junctions, and changed to return the " "substitution path (which typically includes ``\\\\?\\`` prefix) rather than " "the optional \"print name\" field that was previously returned." msgstr "" -#: ../../library/os.rst:2635 +#: ../../library/os.rst:2708 msgid "" -"Remove (delete) the file *path*. If *path* is a directory, an :exc:" -"`OSError` is raised. Use :func:`rmdir` to remove directories. If the file " -"does not exist, a :exc:`FileNotFoundError` is raised." +"Remove (delete) the file *path*. If *path* is a directory, " +"an :exc:`OSError` is raised. Use :func:`rmdir` to remove directories. If " +"the file does not exist, a :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/os.rst:2639 ../../library/os.rst:2752 -#: ../../library/os.rst:3441 +#: ../../library/os.rst:2712 ../../library/os.rst:2825 +#: ../../library/os.rst:3514 msgid "" "This function can support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2642 +#: ../../library/os.rst:2715 msgid "" "On Windows, attempting to remove a file that is in use causes an exception " "to be raised; on Unix, the directory entry is removed but the storage " @@ -2931,20 +3038,20 @@ msgid "" "longer in use." msgstr "" -#: ../../library/os.rst:2646 +#: ../../library/os.rst:2719 msgid "This function is semantically identical to :func:`unlink`." msgstr "" -#: ../../library/os.rst:2648 ../../library/os.rst:2670 -#: ../../library/os.rst:3512 +#: ../../library/os.rst:2721 ../../library/os.rst:2743 +#: ../../library/os.rst:3585 msgid "" "Raises an :ref:`auditing event ` ``os.remove`` with arguments " "``path``, ``dir_fd``." msgstr "" -"引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." -"remove``。" +"引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` " +"``os.remove``。" -#: ../../library/os.rst:2661 +#: ../../library/os.rst:2734 msgid "" "Remove directories recursively. Works like :func:`rmdir` except that, if " "the leaf directory is successfully removed, :func:`removedirs` tries to " @@ -2956,23 +3063,23 @@ msgid "" "could not be successfully removed." msgstr "" -#: ../../library/os.rst:2678 +#: ../../library/os.rst:2751 msgid "" "Rename the file or directory *src* to *dst*. If *dst* exists, the operation " "will fail with an :exc:`OSError` subclass in a number of cases:" msgstr "" -#: ../../library/os.rst:2681 +#: ../../library/os.rst:2754 msgid "" "On Windows, if *dst* exists a :exc:`FileExistsError` is always raised. The " -"operation may fail if *src* and *dst* are on different filesystems. Use :" -"func:`shutil.move` to support moves to a different filesystem." +"operation may fail if *src* and *dst* are on different filesystems. " +"Use :func:`shutil.move` to support moves to a different filesystem." msgstr "" -#: ../../library/os.rst:2685 +#: ../../library/os.rst:2758 msgid "" -"On Unix, if *src* is a file and *dst* is a directory or vice-versa, an :exc:" -"`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised " +"On Unix, if *src* is a file and *dst* is a directory or vice-versa, " +"an :exc:`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised " "respectively. If both are directories and *dst* is empty, *dst* will be " "silently replaced. If *dst* is a non-empty directory, an :exc:`OSError` is " "raised. If both are files, *dst* will be replaced silently if the user has " @@ -2981,20 +3088,20 @@ msgid "" "operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2694 ../../library/os.rst:2734 +#: ../../library/os.rst:2767 ../../library/os.rst:2807 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `." msgstr "" -#: ../../library/os.rst:2697 +#: ../../library/os.rst:2770 msgid "" -"If you want cross-platform overwriting of the destination, use :func:" -"`replace`." +"If you want cross-platform overwriting of the destination, " +"use :func:`replace`." msgstr "" -#: ../../library/os.rst:2699 ../../library/os.rst:2720 -#: ../../library/os.rst:2737 +#: ../../library/os.rst:2772 ../../library/os.rst:2793 +#: ../../library/os.rst:2810 msgid "" "Raises an :ref:`auditing event ` ``os.rename`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." @@ -3002,11 +3109,11 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``src_dir_fd``、``dst_dir_fd`` 的\\ :ref:`" "稽核事件 ` ``os.rename``。" -#: ../../library/os.rst:2701 +#: ../../library/os.rst:2774 msgid "Added the *src_dir_fd* and *dst_dir_fd* parameters." msgstr "新增 *src_dir_fd* 與 *dst_dir_fd* 參數。" -#: ../../library/os.rst:2710 +#: ../../library/os.rst:2783 msgid "" "Recursive directory or file renaming function. Works like :func:`rename`, " "except creation of any intermediate directories needed to make the new " @@ -3015,17 +3122,17 @@ msgid "" "using :func:`removedirs`." msgstr "" -#: ../../library/os.rst:2717 +#: ../../library/os.rst:2790 msgid "" "This function can fail with the new directory structure made if you lack " "permissions needed to remove the leaf directory or file." msgstr "" -#: ../../library/os.rst:2722 +#: ../../library/os.rst:2795 msgid "Accepts a :term:`path-like object` for *old* and *new*." msgstr "" -#: ../../library/os.rst:2728 +#: ../../library/os.rst:2801 msgid "" "Rename the file or directory *src* to *dst*. If *dst* is a non-empty " "directory, :exc:`OSError` will be raised. If *dst* exists and is a file, it " @@ -3034,23 +3141,23 @@ msgid "" "renaming will be an atomic operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2747 +#: ../../library/os.rst:2820 msgid "" "Remove (delete) the directory *path*. If the directory does not exist or is " "not empty, a :exc:`FileNotFoundError` or an :exc:`OSError` is raised " -"respectively. In order to remove whole directory trees, :func:`shutil." -"rmtree` can be used." +"respectively. In order to remove whole directory " +"trees, :func:`shutil.rmtree` can be used." msgstr "" -#: ../../library/os.rst:2755 +#: ../../library/os.rst:2828 msgid "" "Raises an :ref:`auditing event ` ``os.rmdir`` with arguments " "``path``, ``dir_fd``." msgstr "" -"引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." -"rmdir``。" +"引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` " +"``os.rmdir``。" -#: ../../library/os.rst:2766 +#: ../../library/os.rst:2839 msgid "" "Return an iterator of :class:`os.DirEntry` objects corresponding to the " "entries in the directory given by *path*. The entries are yielded in " @@ -3060,19 +3167,20 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:2773 +#: ../../library/os.rst:2846 msgid "" "Using :func:`scandir` instead of :func:`listdir` can significantly increase " "the performance of code that also needs file type or file attribute " "information, because :class:`os.DirEntry` objects expose this information if " -"the operating system provides it when scanning a directory. All :class:`os." -"DirEntry` methods may perform a system call, but :func:`~os.DirEntry.is_dir` " -"and :func:`~os.DirEntry.is_file` usually only require a system call for " -"symbolic links; :func:`os.DirEntry.stat` always requires a system call on " -"Unix but only requires one for symbolic links on Windows." +"the operating system provides it when scanning a directory. " +"All :class:`os.DirEntry` methods may perform a system call, " +"but :func:`~os.DirEntry.is_dir` and :func:`~os.DirEntry.is_file` usually " +"only require a system call for symbolic links; :func:`os.DirEntry.stat` " +"always requires a system call on Unix but only requires one for symbolic " +"links on Windows." msgstr "" -#: ../../library/os.rst:2783 +#: ../../library/os.rst:2856 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the type " @@ -3081,31 +3189,32 @@ msgid "" "they will be of type ``str``." msgstr "" -#: ../../library/os.rst:2792 +#: ../../library/os.rst:2865 msgid "" "Raises an :ref:`auditing event ` ``os.scandir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.scandir``。" -#: ../../library/os.rst:2794 +#: ../../library/os.rst:2867 msgid "" "The :func:`scandir` iterator supports the :term:`context manager` protocol " "and has the following method:" -msgstr ":func:`scandir` 疊代器支援 :term:`context manager` 協定,並具有以下方法:" +msgstr "" +":func:`scandir` 疊代器支援 :term:`context manager` 協定,並具有以下方法:" -#: ../../library/os.rst:2799 +#: ../../library/os.rst:2872 msgid "Close the iterator and free acquired resources." msgstr "" -#: ../../library/os.rst:2801 +#: ../../library/os.rst:2874 msgid "" "This is called automatically when the iterator is exhausted or garbage " "collected, or when an error happens during iterating. However it is " "advisable to call it explicitly or use the :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:2808 +#: ../../library/os.rst:2881 msgid "" "The following example shows a simple use of :func:`scandir` to display all " "the files (excluding directories) in the given *path* that don't start with " @@ -3113,7 +3222,7 @@ msgid "" "system call::" msgstr "" -#: ../../library/os.rst:2813 +#: ../../library/os.rst:2886 msgid "" "with os.scandir(path) as it:\n" " for entry in it:\n" @@ -3125,47 +3234,47 @@ msgstr "" " if not entry.name.startswith('.') and entry.is_file():\n" " print(entry.name)" -#: ../../library/os.rst:2820 +#: ../../library/os.rst:2893 msgid "" "On Unix-based systems, :func:`scandir` uses the system's `opendir() `_ and " "`readdir() `_ functions. On Windows, it uses the Win32 `FindFirstFileW " -"`_ and `FindNextFileW `_ functions." +"`_ and `FindNextFileW `_ functions." msgstr "" -#: ../../library/os.rst:2832 +#: ../../library/os.rst:2905 msgid "" -"Added support for the :term:`context manager` protocol and the :func:" -"`~scandir.close` method. If a :func:`scandir` iterator is neither exhausted " -"nor explicitly closed a :exc:`ResourceWarning` will be emitted in its " -"destructor." +"Added support for the :term:`context manager` protocol and " +"the :func:`~scandir.close` method. If a :func:`scandir` iterator is neither " +"exhausted nor explicitly closed a :exc:`ResourceWarning` will be emitted in " +"its destructor." msgstr "" -#: ../../library/os.rst:2838 +#: ../../library/os.rst:2911 msgid "The function accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:2840 +#: ../../library/os.rst:2913 msgid "Added support for :ref:`file descriptors ` on Unix." msgstr "新增對 Unix 上的\\ :ref:`檔案描述器 `\\ 的支援。" -#: ../../library/os.rst:2846 +#: ../../library/os.rst:2919 msgid "" "Object yielded by :func:`scandir` to expose the file path and other file " "attributes of a directory entry." msgstr "" -#: ../../library/os.rst:2849 +#: ../../library/os.rst:2922 msgid "" ":func:`scandir` will provide as much of this information as possible without " "making additional system calls. When a ``stat()`` or ``lstat()`` system call " "is made, the ``os.DirEntry`` object will cache the result." msgstr "" -#: ../../library/os.rst:2853 +#: ../../library/os.rst:2926 msgid "" "``os.DirEntry`` instances are not intended to be stored in long-lived data " "structures; if you know the file metadata has changed or if a long time has " @@ -3173,7 +3282,7 @@ msgid "" "up-to-date information." msgstr "" -#: ../../library/os.rst:2858 +#: ../../library/os.rst:2931 msgid "" "Because the ``os.DirEntry`` methods can make operating system calls, they " "may also raise :exc:`OSError`. If you need very fine-grained control over " @@ -3181,83 +3290,84 @@ msgid "" "methods and handle as appropriate." msgstr "" -#: ../../library/os.rst:2863 +#: ../../library/os.rst:2936 msgid "" "To be directly usable as a :term:`path-like object`, ``os.DirEntry`` " "implements the :class:`PathLike` interface." msgstr "" -#: ../../library/os.rst:2866 +#: ../../library/os.rst:2939 msgid "Attributes and methods on a ``os.DirEntry`` instance are as follows:" msgstr "" -#: ../../library/os.rst:2870 +#: ../../library/os.rst:2943 msgid "" "The entry's base filename, relative to the :func:`scandir` *path* argument." msgstr "" -#: ../../library/os.rst:2873 +#: ../../library/os.rst:2946 msgid "" "The :attr:`name` attribute will be ``bytes`` if the :func:`scandir` *path* " -"argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." -"fsdecode` to decode byte filenames." +"argument is of type ``bytes`` and ``str`` otherwise. " +"Use :func:`~os.fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2879 +#: ../../library/os.rst:2952 msgid "" -"The entry's full path name: equivalent to ``os.path.join(scandir_path, entry." -"name)`` where *scandir_path* is the :func:`scandir` *path* argument. The " -"path is only absolute if the :func:`scandir` *path* argument was absolute. " -"If the :func:`scandir` *path* argument was a :ref:`file descriptor " -"`, the :attr:`path` attribute is the same as the :attr:`name` " -"attribute." +"The entry's full path name: equivalent to ``os.path.join(scandir_path, " +"entry.name)`` where *scandir_path* is the :func:`scandir` *path* argument. " +"The path is only absolute if the :func:`scandir` *path* argument was " +"absolute. If the :func:`scandir` *path* argument was a :ref:`file " +"descriptor `, the :attr:`path` attribute is the same as " +"the :attr:`name` attribute." msgstr "" -#: ../../library/os.rst:2886 +#: ../../library/os.rst:2959 msgid "" "The :attr:`path` attribute will be ``bytes`` if the :func:`scandir` *path* " -"argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." -"fsdecode` to decode byte filenames." +"argument is of type ``bytes`` and ``str`` otherwise. " +"Use :func:`~os.fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2892 +#: ../../library/os.rst:2965 msgid "Return the inode number of the entry." msgstr "" -#: ../../library/os.rst:2894 +#: ../../library/os.rst:2967 msgid "" -"The result is cached on the ``os.DirEntry`` object. Use ``os.stat(entry." -"path, follow_symlinks=False).st_ino`` to fetch up-to-date information." +"The result is cached on the ``os.DirEntry`` object. Use " +"``os.stat(entry.path, follow_symlinks=False).st_ino`` to fetch up-to-date " +"information." msgstr "" -#: ../../library/os.rst:2898 +#: ../../library/os.rst:2971 msgid "" "On the first, uncached call, a system call is required on Windows but not on " "Unix." msgstr "" -#: ../../library/os.rst:2903 +#: ../../library/os.rst:2976 msgid "" "Return ``True`` if this entry is a directory or a symbolic link pointing to " "a directory; return ``False`` if the entry is or points to any other kind of " "file, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2907 +#: ../../library/os.rst:2980 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "directory (without following symlinks); return ``False`` if the entry is any " "other kind of file or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2911 +#: ../../library/os.rst:2984 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` along " "with :func:`stat.S_ISDIR` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2915 +#: ../../library/os.rst:2988 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, for non-symlinks, neither Windows or Unix require a system " @@ -3267,46 +3377,46 @@ msgid "" "is ``False``." msgstr "" -#: ../../library/os.rst:2922 ../../library/os.rst:2952 +#: ../../library/os.rst:2995 ../../library/os.rst:3025 msgid "" -"This method can raise :exc:`OSError`, such as :exc:`PermissionError`, but :" -"exc:`FileNotFoundError` is caught and not raised." +"This method can raise :exc:`OSError`, such as :exc:`PermissionError`, " +"but :exc:`FileNotFoundError` is caught and not raised." msgstr "" -#: ../../library/os.rst:2927 +#: ../../library/os.rst:3000 msgid "" "Return ``True`` if this entry is a file or a symbolic link pointing to a " "file; return ``False`` if the entry is or points to a directory or other non-" "file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2931 +#: ../../library/os.rst:3004 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "file (without following symlinks); return ``False`` if the entry is a " "directory or other non-file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2935 +#: ../../library/os.rst:3008 msgid "" "The result is cached on the ``os.DirEntry`` object. Caching, system calls " "made, and exceptions raised are as per :func:`~os.DirEntry.is_dir`." msgstr "" -#: ../../library/os.rst:2940 +#: ../../library/os.rst:3013 msgid "" "Return ``True`` if this entry is a symbolic link (even if broken); return " "``False`` if the entry points to a directory or any kind of file, or if it " "doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2944 +#: ../../library/os.rst:3017 msgid "" -"The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." -"islink` to fetch up-to-date information." +"The result is cached on the ``os.DirEntry`` object. " +"Call :func:`os.path.islink` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2947 +#: ../../library/os.rst:3020 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, neither Windows or Unix require a system call, except on " @@ -3314,48 +3424,48 @@ msgid "" "``dirent.d_type == DT_UNKNOWN``." msgstr "" -#: ../../library/os.rst:2957 +#: ../../library/os.rst:3030 msgid "" "Return ``True`` if this entry is a junction (even if broken); return " "``False`` if the entry points to a regular directory, any kind of file, a " "symlink, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2961 +#: ../../library/os.rst:3034 msgid "" -"The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." -"isjunction` to fetch up-to-date information." +"The result is cached on the ``os.DirEntry`` object. " +"Call :func:`os.path.isjunction` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2968 +#: ../../library/os.rst:3041 msgid "" "Return a :class:`stat_result` object for this entry. This method follows " "symbolic links by default; to stat a symbolic link add the " "``follow_symlinks=False`` argument." msgstr "" -#: ../../library/os.rst:2972 +#: ../../library/os.rst:3045 msgid "" "On Unix, this method always requires a system call. On Windows, it only " "requires a system call if *follow_symlinks* is ``True`` and the entry is a " "reparse point (for example, a symbolic link or directory junction)." msgstr "" -#: ../../library/os.rst:2977 +#: ../../library/os.rst:3050 msgid "" -"On Windows, the ``st_ino``, ``st_dev`` and ``st_nlink`` attributes of the :" -"class:`stat_result` are always set to zero. Call :func:`os.stat` to get " +"On Windows, the ``st_ino``, ``st_dev`` and ``st_nlink`` attributes of " +"the :class:`stat_result` are always set to zero. Call :func:`os.stat` to get " "these attributes." msgstr "" -#: ../../library/os.rst:2981 +#: ../../library/os.rst:3054 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` to fetch " "up-to-date information." msgstr "" -#: ../../library/os.rst:2985 +#: ../../library/os.rst:3058 msgid "" "Note that there is a nice correspondence between several attributes and " "methods of ``os.DirEntry`` and of :class:`pathlib.Path`. In particular, the " @@ -3363,13 +3473,13 @@ msgid "" "``is_file()``, ``is_symlink()``, ``is_junction()``, and ``stat()`` methods." msgstr "" -#: ../../library/os.rst:2993 +#: ../../library/os.rst:3066 msgid "" -"Added support for the :class:`~os.PathLike` interface. Added support for :" -"class:`bytes` paths on Windows." +"Added support for the :class:`~os.PathLike` interface. Added support " +"for :class:`bytes` paths on Windows." msgstr "" -#: ../../library/os.rst:2997 +#: ../../library/os.rst:3070 msgid "" "The ``st_ctime`` attribute of a stat result is deprecated on Windows. The " "file creation time is properly available as ``st_birthtime``, and in the " @@ -3377,30 +3487,30 @@ msgid "" "time, if available." msgstr "" -#: ../../library/os.rst:3006 +#: ../../library/os.rst:3079 msgid "" -"Get the status of a file or a file descriptor. Perform the equivalent of a :" -"c:func:`stat` system call on the given path. *path* may be specified as " -"either a string or bytes -- directly or indirectly through the :class:" -"`PathLike` interface -- or as an open file descriptor. Return a :class:" -"`stat_result` object." +"Get the status of a file or a file descriptor. Perform the equivalent of " +"a :c:func:`stat` system call on the given path. *path* may be specified as " +"either a string or bytes -- directly or indirectly through " +"the :class:`PathLike` interface -- or as an open file descriptor. Return " +"a :class:`stat_result` object." msgstr "" -#: ../../library/os.rst:3012 +#: ../../library/os.rst:3085 msgid "" "This function normally follows symlinks; to stat a symlink add the argument " "``follow_symlinks=False``, or use :func:`lstat`." msgstr "" -#: ../../library/os.rst:3015 ../../library/os.rst:4094 -#: ../../library/os.rst:4110 ../../library/os.rst:4126 -#: ../../library/os.rst:4146 +#: ../../library/os.rst:3088 ../../library/os.rst:4167 +#: ../../library/os.rst:4183 ../../library/os.rst:4199 +#: ../../library/os.rst:4219 msgid "" -"This function can support :ref:`specifying a file descriptor ` and :" -"ref:`not following symlinks `." +"This function can support :ref:`specifying a file descriptor ` " +"and :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:3018 +#: ../../library/os.rst:3091 msgid "" "On Windows, passing ``follow_symlinks=False`` will disable following all " "name-surrogate reparse points, which includes symlinks and directory " @@ -3408,17 +3518,17 @@ msgid "" "the operating system is unable to follow will be opened directly. When " "following a chain of multiple links, this may result in the original link " "being returned instead of the non-link that prevented full traversal. To " -"obtain stat results for the final path in this case, use the :func:`os.path." -"realpath` function to resolve the path name as far as possible and call :" -"func:`lstat` on the result. This does not apply to dangling symlinks or " -"junction points, which will raise the usual exceptions." +"obtain stat results for the final path in this case, use " +"the :func:`os.path.realpath` function to resolve the path name as far as " +"possible and call :func:`lstat` on the result. This does not apply to " +"dangling symlinks or junction points, which will raise the usual exceptions." msgstr "" -#: ../../library/os.rst:3031 ../../library/os.rst:3801 +#: ../../library/os.rst:3104 ../../library/os.rst:3874 msgid "Example::" msgstr "範例: ::" -#: ../../library/os.rst:3033 +#: ../../library/os.rst:3106 msgid "" ">>> import os\n" ">>> statinfo = os.stat('somefile.txt')\n" @@ -3438,17 +3548,17 @@ msgstr "" ">>> statinfo.st_size\n" "264" -#: ../../library/os.rst:3044 +#: ../../library/os.rst:3117 msgid ":func:`fstat` and :func:`lstat` functions." msgstr ":func:`fstat` 和 :func:`lstat` 函式。" -#: ../../library/os.rst:3046 +#: ../../library/os.rst:3119 msgid "" "Added the *dir_fd* and *follow_symlinks* parameters, specifying a file " "descriptor instead of a path." msgstr "新增 *dir_fd* 與 *follow_symlinks* 參數,指定一個檔案描述器而非路徑。" -#: ../../library/os.rst:3053 +#: ../../library/os.rst:3126 msgid "" "On Windows, all reparse points that can be resolved by the operating system " "are now followed, and passing ``follow_symlinks=False`` disables following " @@ -3458,299 +3568,297 @@ msgid "" "of raising an error." msgstr "" -#: ../../library/os.rst:3064 +#: ../../library/os.rst:3137 msgid "" -"Object whose attributes correspond roughly to the members of the :c:struct:" -"`stat` structure. It is used for the result of :func:`os.stat`, :func:`os." -"fstat` and :func:`os.lstat`." +"Object whose attributes correspond roughly to the members of " +"the :c:struct:`stat` structure. It is used for the result " +"of :func:`os.stat`, :func:`os.fstat` and :func:`os.lstat`." msgstr "" -#: ../../library/os.rst:3068 +#: ../../library/os.rst:3141 msgid "Attributes:" msgstr "屬性:" -#: ../../library/os.rst:3072 +#: ../../library/os.rst:3145 msgid "File mode: file type and file mode bits (permissions)." msgstr "" -#: ../../library/os.rst:3076 +#: ../../library/os.rst:3149 msgid "" "Platform dependent, but if non-zero, uniquely identifies the file for a " "given value of ``st_dev``. Typically:" msgstr "" -#: ../../library/os.rst:3079 +#: ../../library/os.rst:3152 msgid "the inode number on Unix," msgstr "" -#: ../../library/os.rst:3080 +#: ../../library/os.rst:3153 msgid "" "the `file index `_ on " "Windows" msgstr "" -#: ../../library/os.rst:3086 +#: ../../library/os.rst:3159 msgid "Identifier of the device on which this file resides." msgstr "" -#: ../../library/os.rst:3090 +#: ../../library/os.rst:3163 msgid "Number of hard links." msgstr "" -#: ../../library/os.rst:3094 +#: ../../library/os.rst:3167 msgid "User identifier of the file owner." msgstr "" -#: ../../library/os.rst:3098 +#: ../../library/os.rst:3171 msgid "Group identifier of the file owner." msgstr "" -#: ../../library/os.rst:3102 +#: ../../library/os.rst:3175 msgid "" "Size of the file in bytes, if it is a regular file or a symbolic link. The " "size of a symbolic link is the length of the pathname it contains, without a " "terminating null byte." msgstr "" -#: ../../library/os.rst:3106 +#: ../../library/os.rst:3179 msgid "Timestamps:" msgstr "" -#: ../../library/os.rst:3110 +#: ../../library/os.rst:3183 msgid "Time of most recent access expressed in seconds." msgstr "" -#: ../../library/os.rst:3114 +#: ../../library/os.rst:3187 msgid "Time of most recent content modification expressed in seconds." msgstr "" -#: ../../library/os.rst:3118 +#: ../../library/os.rst:3191 msgid "Time of most recent metadata change expressed in seconds." msgstr "" -#: ../../library/os.rst:3120 +#: ../../library/os.rst:3193 msgid "" "``st_ctime`` is deprecated on Windows. Use ``st_birthtime`` for the file " "creation time. In the future, ``st_ctime`` will contain the time of the most " "recent metadata change, as for other platforms." msgstr "" -#: ../../library/os.rst:3127 +#: ../../library/os.rst:3200 msgid "Time of most recent access expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:3133 +#: ../../library/os.rst:3206 msgid "" "Time of most recent content modification expressed in nanoseconds as an " "integer." msgstr "" -#: ../../library/os.rst:3140 +#: ../../library/os.rst:3213 msgid "" "Time of most recent metadata change expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:3145 +#: ../../library/os.rst:3218 msgid "" "``st_ctime_ns`` is deprecated on Windows. Use ``st_birthtime_ns`` for the " "file creation time. In the future, ``st_ctime`` will contain the time of the " "most recent metadata change, as for other platforms." msgstr "" -#: ../../library/os.rst:3152 +#: ../../library/os.rst:3225 msgid "" "Time of file creation expressed in seconds. This attribute is not always " "available, and may raise :exc:`AttributeError`." msgstr "" -#: ../../library/os.rst:3155 +#: ../../library/os.rst:3228 msgid "``st_birthtime`` is now available on Windows." msgstr "" -#: ../../library/os.rst:3160 +#: ../../library/os.rst:3233 msgid "" "Time of file creation expressed in nanoseconds as an integer. This attribute " "is not always available, and may raise :exc:`AttributeError`." msgstr "" -#: ../../library/os.rst:3168 +#: ../../library/os.rst:3241 msgid "" -"The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, :" -"attr:`st_ctime` and :attr:`st_birthtime` attributes depend on the operating " -"system and the file system. For example, on Windows systems using the FAT32 " -"file systems, :attr:`st_mtime` has 2-second resolution, and :attr:`st_atime` " -"has only 1-day resolution. See your operating system documentation for " -"details." +"The exact meaning and resolution of " +"the :attr:`st_atime`, :attr:`st_mtime`, :attr:`st_ctime` " +"and :attr:`st_birthtime` attributes depend on the operating system and the " +"file system. For example, on Windows systems using the FAT32 file " +"systems, :attr:`st_mtime` has 2-second resolution, and :attr:`st_atime` has " +"only 1-day resolution. See your operating system documentation for details." msgstr "" -#: ../../library/os.rst:3175 +#: ../../library/os.rst:3248 msgid "" -"Similarly, although :attr:`st_atime_ns`, :attr:`st_mtime_ns`, :attr:" -"`st_ctime_ns` and :attr:`st_birthtime_ns` are always expressed in " -"nanoseconds, many systems do not provide nanosecond precision. On systems " -"that do provide nanosecond precision, the floating-point object used to " -"store :attr:`st_atime`, :attr:`st_mtime`, :attr:`st_ctime` and :attr:" -"`st_birthtime` cannot preserve all of it, and as such will be slightly " -"inexact. If you need the exact timestamps you should always use :attr:" -"`st_atime_ns`, :attr:`st_mtime_ns`, :attr:`st_ctime_ns` and :attr:" -"`st_birthtime_ns`." +"Similarly, " +"although :attr:`st_atime_ns`, :attr:`st_mtime_ns`, :attr:`st_ctime_ns` " +"and :attr:`st_birthtime_ns` are always expressed in nanoseconds, many " +"systems do not provide nanosecond precision. On systems that do provide " +"nanosecond precision, the floating-point object used to " +"store :attr:`st_atime`, :attr:`st_mtime`, :attr:`st_ctime` " +"and :attr:`st_birthtime` cannot preserve all of it, and as such will be " +"slightly inexact. If you need the exact timestamps you should always " +"use :attr:`st_atime_ns`, :attr:`st_mtime_ns`, :attr:`st_ctime_ns` " +"and :attr:`st_birthtime_ns`." msgstr "" -#: ../../library/os.rst:3185 +#: ../../library/os.rst:3258 msgid "" "On some Unix systems (such as Linux), the following attributes may also be " "available:" msgstr "" -#: ../../library/os.rst:3190 +#: ../../library/os.rst:3263 msgid "" -"Number of 512-byte blocks allocated for file. This may be smaller than :attr:" -"`st_size`/512 when the file has holes." +"Number of 512-byte blocks allocated for file. This may be smaller " +"than :attr:`st_size`/512 when the file has holes." msgstr "" -#: ../../library/os.rst:3195 +#: ../../library/os.rst:3268 msgid "" "\"Preferred\" blocksize for efficient file system I/O. Writing to a file in " "smaller chunks may cause an inefficient read-modify-rewrite." msgstr "" -#: ../../library/os.rst:3200 +#: ../../library/os.rst:3273 msgid "Type of device if an inode device." msgstr "" -#: ../../library/os.rst:3204 +#: ../../library/os.rst:3277 msgid "User defined flags for file." msgstr "" -#: ../../library/os.rst:3206 +#: ../../library/os.rst:3279 msgid "" "On other Unix systems (such as FreeBSD), the following attributes may be " "available (but may be only filled out if root tries to use them):" msgstr "" -#: ../../library/os.rst:3211 +#: ../../library/os.rst:3284 msgid "File generation number." msgstr "" -#: ../../library/os.rst:3213 +#: ../../library/os.rst:3286 msgid "" "On Solaris and derivatives, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:3218 +#: ../../library/os.rst:3291 msgid "" "String that uniquely identifies the type of the filesystem that contains the " "file." msgstr "" -#: ../../library/os.rst:3221 +#: ../../library/os.rst:3294 msgid "On macOS systems, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:3225 +#: ../../library/os.rst:3298 msgid "Real size of the file." msgstr "" -#: ../../library/os.rst:3229 +#: ../../library/os.rst:3302 msgid "Creator of the file." msgstr "" -#: ../../library/os.rst:3233 +#: ../../library/os.rst:3306 msgid "File type." msgstr "" -#: ../../library/os.rst:3235 +#: ../../library/os.rst:3308 msgid "On Windows systems, the following attributes are also available:" msgstr "" -#: ../../library/os.rst:3239 +#: ../../library/os.rst:3312 msgid "" "Windows file attributes: ``dwFileAttributes`` member of the " "``BY_HANDLE_FILE_INFORMATION`` structure returned by :c:func:`!" -"GetFileInformationByHandle`. See the :const:`!FILE_ATTRIBUTE_* ` constants in the :mod:`stat` module." +"GetFileInformationByHandle`. See the :const:`!FILE_ATTRIBUTE_* " +"` constants in the :mod:`stat` module." msgstr "" -#: ../../library/os.rst:3249 +#: ../../library/os.rst:3322 msgid "" -"When :attr:`st_file_attributes` has the :const:`~stat." -"FILE_ATTRIBUTE_REPARSE_POINT` set, this field contains the tag identifying " -"the type of reparse point. See the :const:`IO_REPARSE_TAG_* ` constants in the :mod:`stat` module." +"When :attr:`st_file_attributes` has " +"the :const:`~stat.FILE_ATTRIBUTE_REPARSE_POINT` set, this field contains the " +"tag identifying the type of reparse point. See the :const:`IO_REPARSE_TAG_* " +"` constants in the :mod:`stat` module." msgstr "" -#: ../../library/os.rst:3254 +#: ../../library/os.rst:3327 msgid "" "The standard module :mod:`stat` defines functions and constants that are " "useful for extracting information from a :c:struct:`stat` structure. (On " "Windows, some items are filled with dummy values.)" msgstr "" -#: ../../library/os.rst:3258 +#: ../../library/os.rst:3331 msgid "" "For backward compatibility, a :class:`stat_result` instance is also " "accessible as a tuple of at least 10 integers giving the most important (and " -"portable) members of the :c:struct:`stat` structure, in the order :attr:" -"`st_mode`, :attr:`st_ino`, :attr:`st_dev`, :attr:`st_nlink`, :attr:" -"`st_uid`, :attr:`st_gid`, :attr:`st_size`, :attr:`st_atime`, :attr:" -"`st_mtime`, :attr:`st_ctime`. More items may be added at the end by some " -"implementations. For compatibility with older Python versions, accessing :" -"class:`stat_result` as a tuple always returns integers." +"portable) members of the :c:struct:`stat` structure, in the " +"order :attr:`st_mode`, :attr:`st_ino`, :attr:`st_dev`, :attr:`st_nlink`, :attr:`st_uid`, :attr:`st_gid`, :attr:`st_size`, :attr:`st_atime`, :attr:`st_mtime`, :attr:`st_ctime`. " +"More items may be added at the end by some implementations. For " +"compatibility with older Python versions, accessing :class:`stat_result` as " +"a tuple always returns integers." msgstr "" -#: ../../library/os.rst:3267 +#: ../../library/os.rst:3340 msgid "Windows now returns the file index as :attr:`st_ino` when available." msgstr "" -#: ../../library/os.rst:3271 +#: ../../library/os.rst:3344 msgid "Added the :attr:`st_fstype` member to Solaris/derivatives." msgstr "" -#: ../../library/os.rst:3274 +#: ../../library/os.rst:3347 msgid "Added the :attr:`st_reparse_tag` member on Windows." msgstr "在 Windows 上新增 :attr:`st_reparse_tag` 成員。" -#: ../../library/os.rst:3277 +#: ../../library/os.rst:3350 msgid "" -"On Windows, the :attr:`st_mode` member now identifies special files as :" -"const:`S_IFCHR`, :const:`S_IFIFO` or :const:`S_IFBLK` as appropriate." +"On Windows, the :attr:`st_mode` member now identifies special files " +"as :const:`S_IFCHR`, :const:`S_IFIFO` or :const:`S_IFBLK` as appropriate." msgstr "" -#: ../../library/os.rst:3282 +#: ../../library/os.rst:3355 msgid "" "On Windows, :attr:`st_ctime` is deprecated. Eventually, it will contain the " "last metadata change time, for consistency with other platforms, but for now " "still contains creation time. Use :attr:`st_birthtime` for the creation time." msgstr "" -#: ../../library/os.rst:3288 +#: ../../library/os.rst:3361 msgid "" "On Windows, :attr:`st_ino` may now be up to 128 bits, depending on the file " "system. Previously it would not be above 64 bits, and larger file " "identifiers would be arbitrarily packed." msgstr "" -#: ../../library/os.rst:3292 +#: ../../library/os.rst:3365 msgid "" "On Windows, :attr:`st_rdev` no longer returns a value. Previously it would " "contain the same as :attr:`st_dev`, which was incorrect." msgstr "" -#: ../../library/os.rst:3295 +#: ../../library/os.rst:3368 msgid "Added the :attr:`st_birthtime` member on Windows." msgstr "在 Windows 上新增 :attr:`st_birthtime` 成員。" -#: ../../library/os.rst:3300 +#: ../../library/os.rst:3373 msgid "" "Perform a :c:func:`!statvfs` system call on the given path. The return " "value is an object whose attributes describe the filesystem on the given " "path, and correspond to the members of the :c:struct:`statvfs` structure, " -"namely: :attr:`f_bsize`, :attr:`f_frsize`, :attr:`f_blocks`, :attr:" -"`f_bfree`, :attr:`f_bavail`, :attr:`f_files`, :attr:`f_ffree`, :attr:" -"`f_favail`, :attr:`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`." +"namely: :attr:`f_bsize`, :attr:`f_frsize`, :attr:`f_blocks`, :attr:`f_bfree`, :attr:`f_bavail`, :attr:`f_files`, :attr:`f_ffree`, :attr:`f_favail`, :attr:`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`." msgstr "" -#: ../../library/os.rst:3307 +#: ../../library/os.rst:3380 msgid "" "Two module-level constants are defined for the :attr:`f_flag` attribute's " "bit-flags: if :const:`ST_RDONLY` is set, the filesystem is mounted read-" @@ -3758,36 +3866,35 @@ msgid "" "are disabled or not supported." msgstr "" -#: ../../library/os.rst:3312 +#: ../../library/os.rst:3385 msgid "" "Additional module-level constants are defined for GNU/glibc based systems. " -"These are :const:`ST_NODEV` (disallow access to device special files), :" -"const:`ST_NOEXEC` (disallow program execution), :const:`ST_SYNCHRONOUS` " -"(writes are synced at once), :const:`ST_MANDLOCK` (allow mandatory locks on " -"an FS), :const:`ST_WRITE` (write on file/directory/symlink), :const:" -"`ST_APPEND` (append-only file), :const:`ST_IMMUTABLE` (immutable file), :" -"const:`ST_NOATIME` (do not update access times), :const:`ST_NODIRATIME` (do " -"not update directory access times), :const:`ST_RELATIME` (update atime " -"relative to mtime/ctime)." -msgstr "" - -#: ../../library/os.rst:3325 +"These are :const:`ST_NODEV` (disallow access to device special " +"files), :const:`ST_NOEXEC` (disallow program " +"execution), :const:`ST_SYNCHRONOUS` (writes are synced at " +"once), :const:`ST_MANDLOCK` (allow mandatory locks on an " +"FS), :const:`ST_WRITE` (write on file/directory/symlink), :const:`ST_APPEND` " +"(append-only file), :const:`ST_IMMUTABLE` (immutable " +"file), :const:`ST_NOATIME` (do not update access " +"times), :const:`ST_NODIRATIME` (do not update directory access " +"times), :const:`ST_RELATIME` (update atime relative to mtime/ctime)." +msgstr "" + +#: ../../library/os.rst:3398 msgid "The :const:`ST_RDONLY` and :const:`ST_NOSUID` constants were added." msgstr "新增 :const:`ST_RDONLY` 與 :const:`ST_NOSUID` 常數。" -#: ../../library/os.rst:3331 +#: ../../library/os.rst:3404 msgid "" -"The :const:`ST_NODEV`, :const:`ST_NOEXEC`, :const:`ST_SYNCHRONOUS`, :const:" -"`ST_MANDLOCK`, :const:`ST_WRITE`, :const:`ST_APPEND`, :const:" -"`ST_IMMUTABLE`, :const:`ST_NOATIME`, :const:`ST_NODIRATIME`, and :const:" -"`ST_RELATIME` constants were added." +"The :const:`ST_NODEV`, :const:`ST_NOEXEC`, :const:`ST_SYNCHRONOUS`, :const:`ST_MANDLOCK`, :const:`ST_WRITE`, :const:`ST_APPEND`, :const:`ST_IMMUTABLE`, :const:`ST_NOATIME`, :const:`ST_NODIRATIME`, " +"and :const:`ST_RELATIME` constants were added." msgstr "" -#: ../../library/os.rst:3340 +#: ../../library/os.rst:3413 msgid "Added the :attr:`f_fsid` attribute." msgstr "新增 :attr:`f_fsid` 屬性。" -#: ../../library/os.rst:3346 +#: ../../library/os.rst:3419 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept an open file descriptor for their *dir_fd* parameter. Different " @@ -3799,7 +3906,7 @@ msgid "" "(Specifying ``None`` for *dir_fd* is always supported on all platforms.)" msgstr "" -#: ../../library/os.rst:3356 +#: ../../library/os.rst:3429 msgid "" "To check whether a particular function accepts an open file descriptor for " "its *dir_fd* parameter, use the ``in`` operator on ``supports_dir_fd``. As " @@ -3807,42 +3914,42 @@ msgid "" "open file descriptors for *dir_fd* on the local platform::" msgstr "" -#: ../../library/os.rst:3361 +#: ../../library/os.rst:3434 msgid "os.stat in os.supports_dir_fd" msgstr "os.stat in os.supports_dir_fd" -#: ../../library/os.rst:3363 +#: ../../library/os.rst:3436 msgid "" "Currently *dir_fd* parameters only work on Unix platforms; none of them work " "on Windows." msgstr "" -#: ../../library/os.rst:3371 +#: ../../library/os.rst:3444 msgid "" "A :class:`set` object indicating whether :func:`os.access` permits " "specifying ``True`` for its *effective_ids* parameter on the local platform. " "(Specifying ``False`` for *effective_ids* is always supported on all " -"platforms.) If the local platform supports it, the collection will contain :" -"func:`os.access`; otherwise it will be empty." +"platforms.) If the local platform supports it, the collection will " +"contain :func:`os.access`; otherwise it will be empty." msgstr "" -#: ../../library/os.rst:3377 +#: ../../library/os.rst:3450 msgid "" "This expression evaluates to ``True`` if :func:`os.access` supports " "``effective_ids=True`` on the local platform::" msgstr "" -#: ../../library/os.rst:3380 +#: ../../library/os.rst:3453 msgid "os.access in os.supports_effective_ids" msgstr "os.access in os.supports_effective_ids" -#: ../../library/os.rst:3382 +#: ../../library/os.rst:3455 msgid "" "Currently *effective_ids* is only supported on Unix platforms; it does not " "work on Windows." msgstr "" -#: ../../library/os.rst:3390 +#: ../../library/os.rst:3463 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "permit specifying their *path* parameter as an open file descriptor on the " @@ -3851,20 +3958,20 @@ msgid "" "*path* arguments is not available on all platforms Python supports." msgstr "" -#: ../../library/os.rst:3397 +#: ../../library/os.rst:3470 msgid "" "To determine whether a particular function permits specifying an open file " "descriptor for its *path* parameter, use the ``in`` operator on " -"``supports_fd``. As an example, this expression evaluates to ``True`` if :" -"func:`os.chdir` accepts open file descriptors for *path* on your local " +"``supports_fd``. As an example, this expression evaluates to ``True`` " +"if :func:`os.chdir` accepts open file descriptors for *path* on your local " "platform::" msgstr "" -#: ../../library/os.rst:3403 +#: ../../library/os.rst:3476 msgid "os.chdir in os.supports_fd" msgstr "os.chdir in os.supports_fd" -#: ../../library/os.rst:3410 +#: ../../library/os.rst:3483 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept ``False`` for their *follow_symlinks* parameter on the local " @@ -3877,24 +3984,24 @@ msgid "" "on all platforms.)" msgstr "" -#: ../../library/os.rst:3420 +#: ../../library/os.rst:3493 msgid "" "To check whether a particular function accepts ``False`` for its " "*follow_symlinks* parameter, use the ``in`` operator on " "``supports_follow_symlinks``. As an example, this expression evaluates to " -"``True`` if you may specify ``follow_symlinks=False`` when calling :func:`os." -"stat` on the local platform::" +"``True`` if you may specify ``follow_symlinks=False`` when " +"calling :func:`os.stat` on the local platform::" msgstr "" -#: ../../library/os.rst:3426 +#: ../../library/os.rst:3499 msgid "os.stat in os.supports_follow_symlinks" msgstr "os.stat in os.supports_follow_symlinks" -#: ../../library/os.rst:3433 +#: ../../library/os.rst:3506 msgid "Create a symbolic link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:3435 +#: ../../library/os.rst:3508 msgid "" "On Windows, a symlink represents either a file or a directory, and does not " "morph to the target dynamically. If the target is present, the type of the " @@ -3904,7 +4011,7 @@ msgid "" "ignored." msgstr "" -#: ../../library/os.rst:3446 +#: ../../library/os.rst:3519 msgid "" "On newer versions of Windows 10, unprivileged accounts can create symlinks " "if Developer Mode is enabled. When Developer Mode is not available/enabled, " @@ -3912,12 +4019,12 @@ msgid "" "must be run as an administrator." msgstr "" -#: ../../library/os.rst:3452 +#: ../../library/os.rst:3525 msgid "" ":exc:`OSError` is raised when the function is called by an unprivileged user." msgstr "" -#: ../../library/os.rst:3455 +#: ../../library/os.rst:3528 msgid "" "Raises an :ref:`auditing event ` ``os.symlink`` with arguments " "``src``, ``dst``, ``dir_fd``." @@ -3925,84 +4032,84 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.symlink``。" -#: ../../library/os.rst:3465 +#: ../../library/os.rst:3538 msgid "" "Added the *dir_fd* parameter, and now allow *target_is_directory* on non-" "Windows platforms." msgstr "" -#: ../../library/os.rst:3472 +#: ../../library/os.rst:3545 msgid "Added support for unelevated symlinks on Windows with Developer Mode." msgstr "" -#: ../../library/os.rst:3478 +#: ../../library/os.rst:3551 msgid "Force write of everything to disk." msgstr "" -#: ../../library/os.rst:3487 +#: ../../library/os.rst:3560 msgid "" "Truncate the file corresponding to *path*, so that it is at most *length* " "bytes in size." msgstr "" -#: ../../library/os.rst:3492 +#: ../../library/os.rst:3565 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``path``, ``length``." msgstr "" -"引發一個附帶引數 ``path``、``length`` 的\\ :ref:`稽核事件 ` ``os." -"truncate``。" +"引發一個附帶引數 ``path``、``length`` 的\\ :ref:`稽核事件 ` " +"``os.truncate``。" -#: ../../library/os.rst:3507 +#: ../../library/os.rst:3580 msgid "" "Remove (delete) the file *path*. This function is semantically identical " "to :func:`remove`; the ``unlink`` name is its traditional Unix name. Please " "see the documentation for :func:`remove` for further information." msgstr "" -#: ../../library/os.rst:3523 +#: ../../library/os.rst:3596 msgid "Set the access and modified times of the file specified by *path*." msgstr "" -#: ../../library/os.rst:3525 +#: ../../library/os.rst:3598 msgid "" ":func:`utime` takes two optional parameters, *times* and *ns*. These specify " "the times set on *path* and are used as follows:" msgstr "" -#: ../../library/os.rst:3528 +#: ../../library/os.rst:3601 msgid "" "If *ns* is specified, it must be a 2-tuple of the form ``(atime_ns, " "mtime_ns)`` where each member is an int expressing nanoseconds." msgstr "" -#: ../../library/os.rst:3531 +#: ../../library/os.rst:3604 msgid "" "If *times* is not ``None``, it must be a 2-tuple of the form ``(atime, " "mtime)`` where each member is an int or float expressing seconds." msgstr "" -#: ../../library/os.rst:3534 +#: ../../library/os.rst:3607 msgid "" "If *times* is ``None`` and *ns* is unspecified, this is equivalent to " "specifying ``ns=(atime_ns, mtime_ns)`` where both times are the current time." msgstr "" -#: ../../library/os.rst:3538 +#: ../../library/os.rst:3611 msgid "It is an error to specify tuples for both *times* and *ns*." msgstr "" -#: ../../library/os.rst:3540 +#: ../../library/os.rst:3613 msgid "" -"Note that the exact times you set here may not be returned by a subsequent :" -"func:`~os.stat` call, depending on the resolution with which your operating " -"system records access and modification times; see :func:`~os.stat`. The best " -"way to preserve exact times is to use the *st_atime_ns* and *st_mtime_ns* " -"fields from the :func:`os.stat` result object with the *ns* parameter to :" -"func:`utime`." +"Note that the exact times you set here may not be returned by a " +"subsequent :func:`~os.stat` call, depending on the resolution with which " +"your operating system records access and modification times; " +"see :func:`~os.stat`. The best way to preserve exact times is to use the " +"*st_atime_ns* and *st_mtime_ns* fields from the :func:`os.stat` result " +"object with the *ns* parameter to :func:`utime`." msgstr "" -#: ../../library/os.rst:3551 +#: ../../library/os.rst:3624 msgid "" "Raises an :ref:`auditing event ` ``os.utime`` with arguments " "``path``, ``times``, ``ns``, ``dir_fd``." @@ -4010,13 +4117,13 @@ msgstr "" "引發一個附帶引數 ``path``、``times``、``ns``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.utime``。" -#: ../../library/os.rst:3553 +#: ../../library/os.rst:3626 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd*, *follow_symlinks*, and *ns* parameters." msgstr "" -#: ../../library/os.rst:3567 +#: ../../library/os.rst:3640 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up. For each directory in the tree rooted at directory *top* " @@ -4024,7 +4131,7 @@ msgid "" "filenames)``." msgstr "" -#: ../../library/os.rst:3572 +#: ../../library/os.rst:3645 msgid "" "*dirpath* is a string, the path to the directory. *dirnames* is a list of " "the names of the subdirectories in *dirpath* (including symlinks to " @@ -4038,7 +4145,7 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:3583 +#: ../../library/os.rst:3656 msgid "" "If optional argument *topdown* is ``True`` or not specified, the triple for " "a directory is generated before the triples for any of its subdirectories " @@ -4049,7 +4156,7 @@ msgid "" "its subdirectories are generated." msgstr "" -#: ../../library/os.rst:3591 +#: ../../library/os.rst:3664 msgid "" "When *topdown* is ``True``, the caller can modify the *dirnames* list in-" "place (perhaps using :keyword:`del` or slice assignment), and :func:`walk` " @@ -4062,7 +4169,7 @@ msgid "" "itself is generated." msgstr "" -#: ../../library/os.rst:3600 +#: ../../library/os.rst:3673 msgid "" "By default, errors from the :func:`scandir` call are ignored. If optional " "argument *onerror* is specified, it should be a function; it will be called " @@ -4072,35 +4179,35 @@ msgid "" "object." msgstr "" -#: ../../library/os.rst:3606 +#: ../../library/os.rst:3679 msgid "" "By default, :func:`walk` will not walk down into symbolic links that resolve " "to directories. Set *followlinks* to ``True`` to visit directories pointed " "to by symlinks, on systems that support them." msgstr "" -#: ../../library/os.rst:3612 +#: ../../library/os.rst:3685 msgid "" "Be aware that setting *followlinks* to ``True`` can lead to infinite " "recursion if a link points to a parent directory of itself. :func:`walk` " "does not keep track of the directories it visited already." msgstr "" -#: ../../library/os.rst:3618 +#: ../../library/os.rst:3691 msgid "" "If you pass a relative pathname, don't change the current working directory " "between resumptions of :func:`walk`. :func:`walk` never changes the current " "directory, and assumes that its caller doesn't either." msgstr "" -#: ../../library/os.rst:3622 ../../library/os.rst:3684 +#: ../../library/os.rst:3695 ../../library/os.rst:3757 msgid "" "This example displays the number of bytes taken by non-directory files in " "each directory under the starting directory, except that it doesn't look " "under any ``__pycache__`` subdirectory::" msgstr "" -#: ../../library/os.rst:3626 +#: ../../library/os.rst:3699 msgid "" "import os\n" "from os.path import join, getsize\n" @@ -4112,14 +4219,14 @@ msgid "" " dirs.remove('__pycache__') # don't visit __pycache__ directories" msgstr "" -#: ../../library/os.rst:3635 +#: ../../library/os.rst:3708 msgid "" "In the next example (simple implementation of :func:`shutil.rmtree`), " "walking the tree bottom-up is essential, :func:`rmdir` doesn't allow " "deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3639 +#: ../../library/os.rst:3712 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4134,33 +4241,33 @@ msgid "" "os.rmdir(top)" msgstr "" -#: ../../library/os.rst:3651 +#: ../../library/os.rst:3724 msgid "" "Raises an :ref:`auditing event ` ``os.walk`` with arguments " "``top``, ``topdown``, ``onerror``, ``followlinks``." msgstr "" -"引發一個附帶引數 ``top``、``topdown``、``onerror``、``followlinks`` 的\\ :" -"ref:`稽核事件 ` ``os.walk``。" +"引發一個附帶引數 ``top``、``topdown``、``onerror``、``followlinks`` 的" +"\\ :ref:`稽核事件 ` ``os.walk``。" -#: ../../library/os.rst:3653 +#: ../../library/os.rst:3726 msgid "" "This function now calls :func:`os.scandir` instead of :func:`os.listdir`, " "making it faster by reducing the number of calls to :func:`os.stat`." msgstr "" -#: ../../library/os.rst:3667 +#: ../../library/os.rst:3740 msgid "" "This behaves exactly like :func:`walk`, except that it yields a 4-tuple " "``(dirpath, dirnames, filenames, dirfd)``, and it supports ``dir_fd``." msgstr "" -#: ../../library/os.rst:3670 +#: ../../library/os.rst:3743 msgid "" "*dirpath*, *dirnames* and *filenames* are identical to :func:`walk` output, " "and *dirfd* is a file descriptor referring to the directory *dirpath*." msgstr "" -#: ../../library/os.rst:3673 +#: ../../library/os.rst:3746 msgid "" "This function always supports :ref:`paths relative to directory descriptors " "` and :ref:`not following symlinks `. Note however " @@ -4168,14 +4275,14 @@ msgid "" "*follow_symlinks* is ``False``." msgstr "" -#: ../../library/os.rst:3680 +#: ../../library/os.rst:3753 msgid "" "Since :func:`fwalk` yields file descriptors, those are only valid until the " "next iteration step, so you should duplicate them (e.g. with :func:`dup`) if " "you want to keep them longer." msgstr "" -#: ../../library/os.rst:3688 +#: ../../library/os.rst:3761 msgid "" "import os\n" "for root, dirs, files, rootfd in os.fwalk('python/Lib/xml'):\n" @@ -4187,13 +4294,13 @@ msgid "" " dirs.remove('__pycache__') # don't visit __pycache__ directories" msgstr "" -#: ../../library/os.rst:3697 +#: ../../library/os.rst:3770 msgid "" "In the next example, walking the tree bottom-up is essential: :func:`rmdir` " "doesn't allow deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3701 +#: ../../library/os.rst:3774 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4207,7 +4314,7 @@ msgid "" " os.rmdir(name, dir_fd=rootfd)" msgstr "" -#: ../../library/os.rst:3712 +#: ../../library/os.rst:3785 msgid "" "Raises an :ref:`auditing event ` ``os.fwalk`` with arguments " "``top``, ``topdown``, ``onerror``, ``follow_symlinks``, ``dir_fd``." @@ -4215,11 +4322,11 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``follow_symlinks``、" "``dir_fd`` 的\\ :ref:`稽核事件 ` ``os.fwalk``。" -#: ../../library/os.rst:3721 +#: ../../library/os.rst:3794 msgid "Added support for :class:`bytes` paths." msgstr "新增對 :class:`bytes` 路徑的支援。" -#: ../../library/os.rst:3727 +#: ../../library/os.rst:3800 msgid "" "Create an anonymous file and return a file descriptor that refers to it. " "*flags* must be one of the ``os.MFD_*`` constants available on the system " @@ -4227,7 +4334,7 @@ msgid "" "descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3732 +#: ../../library/os.rst:3805 msgid "" "The name supplied in *name* is used as a filename and will be displayed as " "the target of the corresponding symbolic link in the directory ``/proc/self/" @@ -4237,24 +4344,24 @@ msgid "" "side effects." msgstr "" -#: ../../library/os.rst:3762 +#: ../../library/os.rst:3835 msgid "These flags can be passed to :func:`memfd_create`." msgstr "這些旗標可以傳給 :func:`memfd_create`。" -#: ../../library/os.rst:3766 +#: ../../library/os.rst:3839 msgid "The ``MFD_HUGE*`` flags are only available since Linux 4.14." msgstr "``MFD_HUGE*`` 旗標僅在 Linux 4.14 以上可用。" -#: ../../library/os.rst:3773 +#: ../../library/os.rst:3846 msgid "" "Create and return an event file descriptor. The file descriptors supports " -"raw :func:`read` and :func:`write` with a buffer size of 8, :func:`~select." -"select`, :func:`~select.poll` and similar. See man page :manpage:" -"`eventfd(2)` for more information. By default, the new file descriptor is :" -"ref:`non-inheritable `." +"raw :func:`read` and :func:`write` with a buffer size of " +"8, :func:`~select.select`, :func:`~select.poll` and similar. See man " +"page :manpage:`eventfd(2)` for more information. By default, the new file " +"descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3779 +#: ../../library/os.rst:3852 msgid "" "*initval* is the initial value of the event counter. The initial value must " "be a 32 bit unsigned integer. Please note that the initial value is limited " @@ -4262,39 +4369,39 @@ msgid "" "integer with a maximum value of 2\\ :sup:`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3784 +#: ../../library/os.rst:3857 msgid "" "*flags* can be constructed from :const:`EFD_CLOEXEC`, :const:`EFD_NONBLOCK`, " "and :const:`EFD_SEMAPHORE`." msgstr "" -#: ../../library/os.rst:3787 +#: ../../library/os.rst:3860 msgid "" -"If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero, :" -"func:`eventfd_read` returns 1 and decrements the counter by one." +"If :const:`EFD_SEMAPHORE` is specified and the event counter is non-" +"zero, :func:`eventfd_read` returns 1 and decrements the counter by one." msgstr "" -#: ../../library/os.rst:3790 +#: ../../library/os.rst:3863 msgid "" "If :const:`EFD_SEMAPHORE` is not specified and the event counter is non-" "zero, :func:`eventfd_read` returns the current event counter value and " "resets the counter to zero." msgstr "" -#: ../../library/os.rst:3794 +#: ../../library/os.rst:3867 msgid "" -"If the event counter is zero and :const:`EFD_NONBLOCK` is not specified, :" -"func:`eventfd_read` blocks." +"If the event counter is zero and :const:`EFD_NONBLOCK` is not " +"specified, :func:`eventfd_read` blocks." msgstr "" -#: ../../library/os.rst:3797 +#: ../../library/os.rst:3870 msgid "" ":func:`eventfd_write` increments the event counter. Write blocks if the " -"write operation would increment the counter to a value larger than 2\\ :sup:" -"`64`\\ -\\ 2." +"write operation would increment the counter to a value larger than " +"2\\ :sup:`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3803 +#: ../../library/os.rst:3876 msgid "" "import os\n" "\n" @@ -4312,133 +4419,134 @@ msgid "" " os.close(fd)" msgstr "" -#: ../../library/os.rst:3824 +#: ../../library/os.rst:3897 msgid "" "Read value from an :func:`eventfd` file descriptor and return a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3833 +#: ../../library/os.rst:3906 msgid "" "Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3842 +#: ../../library/os.rst:3915 msgid "Set close-on-exec flag for new :func:`eventfd` file descriptor." msgstr "" -#: ../../library/os.rst:3850 +#: ../../library/os.rst:3923 msgid "" "Set :const:`O_NONBLOCK` status flag for new :func:`eventfd` file descriptor." msgstr "設定新的 :func:`eventfd` 檔案描述器的 :const:`O_NONBLOCK` 狀態旗標。" -#: ../../library/os.rst:3859 +#: ../../library/os.rst:3932 msgid "" "Provide semaphore-like semantics for reads from an :func:`eventfd` file " "descriptor. On read the internal counter is decremented by one." msgstr "" -#: ../../library/os.rst:3870 +#: ../../library/os.rst:3943 msgid "Timer File Descriptors" msgstr "" -#: ../../library/os.rst:3874 +#: ../../library/os.rst:3947 msgid "" "These functions provide support for Linux's *timer file descriptor* API. " "Naturally, they are all only available on Linux." msgstr "" -#: ../../library/os.rst:3879 +#: ../../library/os.rst:3952 msgid "Create and return a timer file descriptor (*timerfd*)." msgstr "" -#: ../../library/os.rst:3881 +#: ../../library/os.rst:3954 msgid "The file descriptor returned by :func:`timerfd_create` supports:" msgstr "" -#: ../../library/os.rst:3883 +#: ../../library/os.rst:3956 msgid ":func:`read`" msgstr ":func:`read`" -#: ../../library/os.rst:3884 +#: ../../library/os.rst:3957 msgid ":func:`~select.select`" msgstr ":func:`~select.select`" -#: ../../library/os.rst:3885 +#: ../../library/os.rst:3958 msgid ":func:`~select.poll`" msgstr ":func:`~select.poll`" -#: ../../library/os.rst:3887 +#: ../../library/os.rst:3960 msgid "" "The file descriptor's :func:`read` method can be called with a buffer size " "of 8. If the timer has already expired one or more times, :func:`read` " "returns the number of expirations with the host's endianness, which may be " -"converted to an :class:`int` by ``int.from_bytes(x, byteorder=sys." -"byteorder)``." +"converted to an :class:`int` by ``int.from_bytes(x, " +"byteorder=sys.byteorder)``." msgstr "" -#: ../../library/os.rst:3892 +#: ../../library/os.rst:3965 msgid "" ":func:`~select.select` and :func:`~select.poll` can be used to wait until " "timer expires and the file descriptor is readable." msgstr "" -#: ../../library/os.rst:3895 +#: ../../library/os.rst:3968 msgid "" "*clockid* must be a valid :ref:`clock ID `, as " "defined in the :py:mod:`time` module:" msgstr "" -#: ../../library/os.rst:3898 +#: ../../library/os.rst:3971 msgid ":const:`time.CLOCK_REALTIME`" msgstr ":const:`time.CLOCK_REALTIME`" -#: ../../library/os.rst:3899 +#: ../../library/os.rst:3972 msgid ":const:`time.CLOCK_MONOTONIC`" msgstr ":const:`time.CLOCK_MONOTONIC`" -#: ../../library/os.rst:3900 +#: ../../library/os.rst:3973 msgid ":const:`time.CLOCK_BOOTTIME` (Since Linux 3.15 for timerfd_create)" msgstr "" -#: ../../library/os.rst:3902 +#: ../../library/os.rst:3975 msgid "" "If *clockid* is :const:`time.CLOCK_REALTIME`, a settable system-wide real-" "time clock is used. If system clock is changed, timer setting need to be " -"updated. To cancel timer when system clock is changed, see :const:" -"`TFD_TIMER_CANCEL_ON_SET`." +"updated. To cancel timer when system clock is changed, " +"see :const:`TFD_TIMER_CANCEL_ON_SET`." msgstr "" -#: ../../library/os.rst:3907 +#: ../../library/os.rst:3980 msgid "" "If *clockid* is :const:`time.CLOCK_MONOTONIC`, a non-settable monotonically " "increasing clock is used. Even if the system clock is changed, the timer " "setting will not be affected." msgstr "" -#: ../../library/os.rst:3911 +#: ../../library/os.rst:3984 msgid "" -"If *clockid* is :const:`time.CLOCK_BOOTTIME`, same as :const:`time." -"CLOCK_MONOTONIC` except it includes any time that the system is suspended." +"If *clockid* is :const:`time.CLOCK_BOOTTIME`, same " +"as :const:`time.CLOCK_MONOTONIC` except it includes any time that the system " +"is suspended." msgstr "" -#: ../../library/os.rst:3914 +#: ../../library/os.rst:3987 msgid "" "The file descriptor's behaviour can be modified by specifying a *flags* " "value. Any of the following variables may used, combined using bitwise OR " "(the ``|`` operator):" msgstr "" -#: ../../library/os.rst:3918 +#: ../../library/os.rst:3991 msgid ":const:`TFD_NONBLOCK`" msgstr ":const:`TFD_NONBLOCK`" -#: ../../library/os.rst:3919 +#: ../../library/os.rst:3992 msgid ":const:`TFD_CLOEXEC`" msgstr ":const:`TFD_CLOEXEC`" -#: ../../library/os.rst:3921 +#: ../../library/os.rst:3994 msgid "" "If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks until the " "timer expires. If it is set as a flag, :func:`read` doesn't block, but If " @@ -4446,165 +4554,165 @@ msgid "" "raises :class:`OSError` with ``errno`` is set to :const:`errno.EAGAIN`." msgstr "" -#: ../../library/os.rst:3927 +#: ../../library/os.rst:4000 msgid ":const:`TFD_CLOEXEC` is always set by Python automatically." msgstr "" -#: ../../library/os.rst:3929 +#: ../../library/os.rst:4002 msgid "" "The file descriptor must be closed with :func:`os.close` when it is no " "longer needed, or else the file descriptor will be leaked." msgstr "" -#: ../../library/os.rst:3932 +#: ../../library/os.rst:4005 msgid "The :manpage:`timerfd_create(2)` man page." msgstr ":manpage:`timerfd_create(2)` 手冊頁。" -#: ../../library/os.rst:3941 +#: ../../library/os.rst:4014 msgid "" "Alter a timer file descriptor's internal timer. This function operates the " "same interval timer as :func:`timerfd_settime_ns`." msgstr "" -#: ../../library/os.rst:3944 +#: ../../library/os.rst:4017 msgid "*fd* must be a valid timer file descriptor." msgstr "" -#: ../../library/os.rst:3946 +#: ../../library/os.rst:4019 msgid "" "The timer's behaviour can be modified by specifying a *flags* value. Any of " "the following variables may used, combined using bitwise OR (the ``|`` " "operator):" msgstr "" -#: ../../library/os.rst:3950 +#: ../../library/os.rst:4023 msgid ":const:`TFD_TIMER_ABSTIME`" msgstr ":const:`TFD_TIMER_ABSTIME`" -#: ../../library/os.rst:3951 +#: ../../library/os.rst:4024 msgid ":const:`TFD_TIMER_CANCEL_ON_SET`" msgstr ":const:`TFD_TIMER_CANCEL_ON_SET`" -#: ../../library/os.rst:3953 +#: ../../library/os.rst:4026 msgid "" "The timer is disabled by setting *initial* to zero (``0``). If *initial* is " "equal to or greater than zero, the timer is enabled. If *initial* is less " -"than zero, it raises an :class:`OSError` exception with ``errno`` set to :" -"const:`errno.EINVAL`" +"than zero, it raises an :class:`OSError` exception with ``errno`` set " +"to :const:`errno.EINVAL`" msgstr "" -#: ../../library/os.rst:3958 +#: ../../library/os.rst:4031 msgid "" "By default the timer will fire when *initial* seconds have elapsed. (If " "*initial* is zero, timer will fire immediately.)" msgstr "" -#: ../../library/os.rst:3961 +#: ../../library/os.rst:4034 msgid "" "However, if the :const:`TFD_TIMER_ABSTIME` flag is set, the timer will fire " "when the timer's clock (set by *clockid* in :func:`timerfd_create`) reaches " "*initial* seconds." msgstr "" -#: ../../library/os.rst:3965 +#: ../../library/os.rst:4038 msgid "" "The timer's interval is set by the *interval* :py:class:`float`. If " "*interval* is zero, the timer only fires once, on the initial expiration. If " "*interval* is greater than zero, the timer fires every time *interval* " "seconds have elapsed since the previous expiration. If *interval* is less " -"than zero, it raises :class:`OSError` with ``errno`` set to :const:`errno." -"EINVAL`" +"than zero, it raises :class:`OSError` with ``errno`` set " +"to :const:`errno.EINVAL`" msgstr "" -#: ../../library/os.rst:3972 +#: ../../library/os.rst:4045 msgid "" -"If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along with :const:" -"`TFD_TIMER_ABSTIME` and the clock for this timer is :const:`time." -"CLOCK_REALTIME`, the timer is marked as cancelable if the real-time clock is " -"changed discontinuously. Reading the descriptor is aborted with the error " -"ECANCELED." +"If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along " +"with :const:`TFD_TIMER_ABSTIME` and the clock for this timer " +"is :const:`time.CLOCK_REALTIME`, the timer is marked as cancelable if the " +"real-time clock is changed discontinuously. Reading the descriptor is " +"aborted with the error ECANCELED." msgstr "" -#: ../../library/os.rst:3978 +#: ../../library/os.rst:4051 msgid "" "Linux manages system clock as UTC. A daylight-savings time transition is " "done by changing time offset only and doesn't cause discontinuous system " "clock change." msgstr "" -#: ../../library/os.rst:3982 +#: ../../library/os.rst:4055 msgid "" "Discontinuous system clock change will be caused by the following events:" msgstr "" -#: ../../library/os.rst:3984 +#: ../../library/os.rst:4057 msgid "``settimeofday``" msgstr "``settimeofday``" -#: ../../library/os.rst:3985 +#: ../../library/os.rst:4058 msgid "``clock_settime``" msgstr "``clock_settime``" -#: ../../library/os.rst:3986 +#: ../../library/os.rst:4059 msgid "set the system date and time by ``date`` command" msgstr "" -#: ../../library/os.rst:3988 +#: ../../library/os.rst:4061 msgid "" "Return a two-item tuple of (``next_expiration``, ``interval``) from the " "previous timer state, before this function executed." msgstr "" -#: ../../library/os.rst:3993 +#: ../../library/os.rst:4066 msgid "" -":manpage:`timerfd_create(2)`, :manpage:`timerfd_settime(2)`, :manpage:" -"`settimeofday(2)`, :manpage:`clock_settime(2)`, and :manpage:`date(1)`." +":manpage:`timerfd_create(2)`, :manpage:`timerfd_settime(2)`, :manpage:`settimeofday(2)`, :manpage:`clock_settime(2)`, " +"and :manpage:`date(1)`." msgstr "" -#: ../../library/os.rst:4004 +#: ../../library/os.rst:4077 msgid "" "Similar to :func:`timerfd_settime`, but use time as nanoseconds. This " "function operates the same interval timer as :func:`timerfd_settime`." msgstr "" -#: ../../library/os.rst:4014 +#: ../../library/os.rst:4087 msgid "Return a two-item tuple of floats (``next_expiration``, ``interval``)." msgstr "" -#: ../../library/os.rst:4016 +#: ../../library/os.rst:4089 msgid "" "``next_expiration`` denotes the relative time until next the timer next " "fires, regardless of if the :const:`TFD_TIMER_ABSTIME` flag is set." msgstr "" -#: ../../library/os.rst:4019 +#: ../../library/os.rst:4092 msgid "" "``interval`` denotes the timer's interval. If zero, the timer will only fire " "once, after ``next_expiration`` seconds have elapsed." msgstr "" -#: ../../library/os.rst:4023 +#: ../../library/os.rst:4096 msgid ":manpage:`timerfd_gettime(2)`" msgstr ":manpage:`timerfd_gettime(2)`" -#: ../../library/os.rst:4032 +#: ../../library/os.rst:4105 msgid "Similar to :func:`timerfd_gettime`, but return time as nanoseconds." msgstr "" -#: ../../library/os.rst:4040 +#: ../../library/os.rst:4113 msgid "" -"A flag for the :func:`timerfd_create` function, which sets the :const:" -"`O_NONBLOCK` status flag for the new timer file descriptor. If :const:" -"`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks." +"A flag for the :func:`timerfd_create` function, which sets " +"the :const:`O_NONBLOCK` status flag for the new timer file descriptor. " +"If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks." msgstr "" -#: ../../library/os.rst:4050 +#: ../../library/os.rst:4123 msgid "" "A flag for the :func:`timerfd_create` function, If :const:`TFD_CLOEXEC` is " "set as a flag, set close-on-exec flag for new file descriptor." msgstr "" -#: ../../library/os.rst:4060 +#: ../../library/os.rst:4133 msgid "" "A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " "functions. If this flag is set, *initial* is interpreted as an absolute " @@ -4612,30 +4720,30 @@ msgid "" "Epoch)." msgstr "" -#: ../../library/os.rst:4070 +#: ../../library/os.rst:4143 msgid "" "A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " "functions along with :const:`TFD_TIMER_ABSTIME`. The timer is cancelled when " "the time of the underlying clock changes discontinuously." msgstr "" -#: ../../library/os.rst:4081 +#: ../../library/os.rst:4154 msgid "Linux extended attributes" msgstr "" -#: ../../library/os.rst:4085 +#: ../../library/os.rst:4158 msgid "These functions are all available on Linux only." msgstr "" -#: ../../library/os.rst:4089 +#: ../../library/os.rst:4162 msgid "" "Return the value of the extended filesystem attribute *attribute* for " -"*path*. *attribute* can be bytes or str (directly or indirectly through the :" -"class:`PathLike` interface). If it is str, it is encoded with the filesystem " -"encoding." +"*path*. *attribute* can be bytes or str (directly or indirectly through " +"the :class:`PathLike` interface). If it is str, it is encoded with the " +"filesystem encoding." msgstr "" -#: ../../library/os.rst:4097 +#: ../../library/os.rst:4170 msgid "" "Raises an :ref:`auditing event ` ``os.getxattr`` with arguments " "``path``, ``attribute``." @@ -4643,12 +4751,12 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.getxattr``。" -#: ../../library/os.rst:4099 ../../library/os.rst:4131 -#: ../../library/os.rst:4156 +#: ../../library/os.rst:4172 ../../library/os.rst:4204 +#: ../../library/os.rst:4229 msgid "Accepts a :term:`path-like object` for *path* and *attribute*." msgstr "" -#: ../../library/os.rst:4105 +#: ../../library/os.rst:4178 msgid "" "Return a list of the extended filesystem attributes on *path*. The " "attributes in the list are represented as strings decoded with the " @@ -4656,22 +4764,22 @@ msgid "" "the current directory." msgstr "" -#: ../../library/os.rst:4113 +#: ../../library/os.rst:4186 msgid "" "Raises an :ref:`auditing event ` ``os.listxattr`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listxattr``。" -#: ../../library/os.rst:4121 +#: ../../library/os.rst:4194 msgid "" "Removes the extended filesystem attribute *attribute* from *path*. " -"*attribute* should be bytes or str (directly or indirectly through the :" -"class:`PathLike` interface). If it is a string, it is encoded with the :term:" -"`filesystem encoding and error handler`." +"*attribute* should be bytes or str (directly or indirectly through " +"the :class:`PathLike` interface). If it is a string, it is encoded with " +"the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../library/os.rst:4129 +#: ../../library/os.rst:4202 msgid "" "Raises an :ref:`auditing event ` ``os.removexattr`` with arguments " "``path``, ``attribute``." @@ -4679,25 +4787,25 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.removexattr``。" -#: ../../library/os.rst:4137 +#: ../../library/os.rst:4210 msgid "" "Set the extended filesystem attribute *attribute* on *path* to *value*. " "*attribute* must be a bytes or str with no embedded NULs (directly or " "indirectly through the :class:`PathLike` interface). If it is a str, it is " "encoded with the :term:`filesystem encoding and error handler`. *flags* may " "be :data:`XATTR_REPLACE` or :data:`XATTR_CREATE`. If :data:`XATTR_REPLACE` " -"is given and the attribute does not exist, ``ENODATA`` will be raised. If :" -"data:`XATTR_CREATE` is given and the attribute already exists, the attribute " -"will not be created and ``EEXISTS`` will be raised." +"is given and the attribute does not exist, ``ENODATA`` will be raised. " +"If :data:`XATTR_CREATE` is given and the attribute already exists, the " +"attribute will not be created and ``EEXISTS`` will be raised." msgstr "" -#: ../../library/os.rst:4151 +#: ../../library/os.rst:4224 msgid "" "A bug in Linux kernel versions less than 2.6.39 caused the flags argument to " "be ignored on some filesystems." msgstr "" -#: ../../library/os.rst:4154 +#: ../../library/os.rst:4227 msgid "" "Raises an :ref:`auditing event ` ``os.setxattr`` with arguments " "``path``, ``attribute``, ``value``, ``flags``." @@ -4705,33 +4813,33 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute``、``value``、``flags`` 的\\ :ref:`稽" "核事件 ` ``os.setxattr``。" -#: ../../library/os.rst:4162 +#: ../../library/os.rst:4235 msgid "" "The maximum size the value of an extended attribute can be. Currently, this " "is 64 KiB on Linux." msgstr "" -#: ../../library/os.rst:4168 +#: ../../library/os.rst:4241 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must create an attribute." msgstr "" -#: ../../library/os.rst:4174 +#: ../../library/os.rst:4247 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must replace an existing attribute." msgstr "" -#: ../../library/os.rst:4181 +#: ../../library/os.rst:4254 msgid "Process Management" msgstr "行程管理" -#: ../../library/os.rst:4183 +#: ../../library/os.rst:4256 msgid "These functions may be used to create and manage processes." msgstr "" -#: ../../library/os.rst:4185 +#: ../../library/os.rst:4258 msgid "" "The various :func:`exec\\* ` functions take a list of arguments for " "the new program loaded into the process. In each case, the first of these " @@ -4742,48 +4850,48 @@ msgid "" "standard output; ``foo`` will seem to be ignored." msgstr "" -#: ../../library/os.rst:4196 +#: ../../library/os.rst:4269 msgid "" "Generate a :const:`SIGABRT` signal to the current process. On Unix, the " "default behavior is to produce a core dump; on Windows, the process " "immediately returns an exit code of ``3``. Be aware that calling this " -"function will not call the Python signal handler registered for :const:" -"`SIGABRT` with :func:`signal.signal`." +"function will not call the Python signal handler registered " +"for :const:`SIGABRT` with :func:`signal.signal`." msgstr "" -#: ../../library/os.rst:4205 +#: ../../library/os.rst:4278 msgid "Add a path to the DLL search path." msgstr "" -#: ../../library/os.rst:4207 +#: ../../library/os.rst:4280 msgid "" "This search path is used when resolving dependencies for imported extension " "modules (the module itself is resolved through :data:`sys.path`), and also " "by :mod:`ctypes`." msgstr "" -#: ../../library/os.rst:4211 +#: ../../library/os.rst:4284 msgid "" "Remove the directory by calling **close()** on the returned object or using " "it in a :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:4214 +#: ../../library/os.rst:4287 msgid "" -"See the `Microsoft documentation `_ for more information about how " -"DLLs are loaded." +"See the `Microsoft documentation `_ for more information about how DLLs " +"are loaded." msgstr "" -#: ../../library/os.rst:4218 +#: ../../library/os.rst:4291 msgid "" "Raises an :ref:`auditing event ` ``os.add_dll_directory`` with " "argument ``path``." msgstr "" -"引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os." -"add_dll_directory``。" +"引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` " +"``os.add_dll_directory``。" -#: ../../library/os.rst:4222 +#: ../../library/os.rst:4295 msgid "" "Previous versions of CPython would resolve DLLs using the default behavior " "for the current process. This led to inconsistencies, such as only sometimes " @@ -4791,14 +4899,14 @@ msgid "" "such as ``AddDllDirectory`` having no effect." msgstr "" -#: ../../library/os.rst:4229 +#: ../../library/os.rst:4302 msgid "" "In 3.8, the two primary ways DLLs are loaded now explicitly override the " "process-wide behavior to ensure consistency. See the :ref:`porting notes " "` for information on updating libraries." msgstr "" -#: ../../library/os.rst:4244 +#: ../../library/os.rst:4317 msgid "" "These functions all execute a new program, replacing the current process; " "they do not return. On Unix, the new executable is loaded into the current " @@ -4806,15 +4914,15 @@ msgid "" "reported as :exc:`OSError` exceptions." msgstr "" -#: ../../library/os.rst:4249 +#: ../../library/os.rst:4322 msgid "" "The current process is replaced immediately. Open file objects and " "descriptors are not flushed, so if there may be data buffered on these open " -"files, you should flush them using :func:`sys.stdout.flush` or :func:`os." -"fsync` before calling an :func:`exec\\* ` function." +"files, you should flush them using :func:`sys.stdout.flush` " +"or :func:`os.fsync` before calling an :func:`exec\\* ` function." msgstr "" -#: ../../library/os.rst:4255 +#: ../../library/os.rst:4328 msgid "" "The \"l\" and \"v\" variants of the :func:`exec\\* ` functions differ " "in how command-line arguments are passed. The \"l\" variants are perhaps " @@ -4827,40 +4935,41 @@ msgid "" "is not enforced." msgstr "" -#: ../../library/os.rst:4264 +#: ../../library/os.rst:4337 msgid "" -"The variants which include a \"p\" near the end (:func:`execlp`, :func:" -"`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the :envvar:`PATH` " -"environment variable to locate the program *file*. When the environment is " -"being replaced (using one of the :func:`exec\\*e ` variants, " -"discussed in the next paragraph), the new environment is used as the source " -"of the :envvar:`PATH` variable. The other variants, :func:`execl`, :func:" -"`execle`, :func:`execv`, and :func:`execve`, will not use the :envvar:`PATH` " -"variable to locate the executable; *path* must contain an appropriate " -"absolute or relative path. Relative paths must include at least one slash, " -"even on Windows, as plain names will not be resolved." +"The variants which include a \"p\" near the end " +"(:func:`execlp`, :func:`execlpe`, :func:`execvp`, and :func:`execvpe`) will " +"use the :envvar:`PATH` environment variable to locate the program *file*. " +"When the environment is being replaced (using one of the :func:`exec\\*e " +"` variants, discussed in the next paragraph), the new environment is " +"used as the source of the :envvar:`PATH` variable. The other " +"variants, :func:`execl`, :func:`execle`, :func:`execv`, and :func:`execve`, " +"will not use the :envvar:`PATH` variable to locate the executable; *path* " +"must contain an appropriate absolute or relative path. Relative paths must " +"include at least one slash, even on Windows, as plain names will not be " +"resolved." msgstr "" -#: ../../library/os.rst:4275 +#: ../../library/os.rst:4348 msgid "" "For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " "which is used to define the environment variables for the new process (these " -"are used instead of the current process' environment); the functions :func:" -"`execl`, :func:`execlp`, :func:`execv`, and :func:`execvp` all cause the new " -"process to inherit the environment of the current process." +"are used instead of the current process' environment); the " +"functions :func:`execl`, :func:`execlp`, :func:`execv`, and :func:`execvp` " +"all cause the new process to inherit the environment of the current process." msgstr "" -#: ../../library/os.rst:4282 +#: ../../library/os.rst:4355 msgid "" "For :func:`execve` on some platforms, *path* may also be specified as an " "open file descriptor. This functionality may not be supported on your " -"platform; you can check whether or not it is available using :data:`os." -"supports_fd`. If it is unavailable, using it will raise a :exc:" -"`NotImplementedError`." +"platform; you can check whether or not it is available " +"using :data:`os.supports_fd`. If it is unavailable, using it will raise " +"a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:4287 +#: ../../library/os.rst:4360 msgid "" "Raises an :ref:`auditing event ` ``os.exec`` with arguments " "``path``, ``args``, ``env``." @@ -4868,25 +4977,25 @@ msgstr "" "引發一個附帶引數 ``path``、``args``、``env`` 的\\ :ref:`稽核事件 ` " "``os.exec``。" -#: ../../library/os.rst:4291 +#: ../../library/os.rst:4364 msgid "" -"Added support for specifying *path* as an open file descriptor for :func:" -"`execve`." +"Added support for specifying *path* as an open file descriptor " +"for :func:`execve`." msgstr "" -#: ../../library/os.rst:4300 +#: ../../library/os.rst:4373 msgid "" "Exit the process with status *n*, without calling cleanup handlers, flushing " "stdio buffers, etc." msgstr "" -#: ../../library/os.rst:4305 +#: ../../library/os.rst:4378 msgid "" "The standard way to exit is :func:`sys.exit(n) `. :func:`!_exit` " "should normally only be used in the child process after a :func:`fork`." msgstr "" -#: ../../library/os.rst:4308 +#: ../../library/os.rst:4381 msgid "" "The following exit codes are defined and can be used with :func:`_exit`, " "although they are not required. These are typically used for system " @@ -4894,139 +5003,139 @@ msgid "" "delivery program." msgstr "" -#: ../../library/os.rst:4314 +#: ../../library/os.rst:4387 msgid "" "Some of these may not be available on all Unix platforms, since there is " "some variation. These constants are defined where they are defined by the " "underlying platform." msgstr "" -#: ../../library/os.rst:4321 +#: ../../library/os.rst:4394 msgid "" "Exit code that means no error occurred. May be taken from the defined value " "of ``EXIT_SUCCESS`` on some platforms. Generally has a value of zero." msgstr "" -#: ../../library/os.rst:4329 +#: ../../library/os.rst:4402 msgid "" "Exit code that means the command was used incorrectly, such as when the " "wrong number of arguments are given." msgstr "" -#: ../../library/os.rst:4337 +#: ../../library/os.rst:4410 msgid "Exit code that means the input data was incorrect." msgstr "" -#: ../../library/os.rst:4344 +#: ../../library/os.rst:4417 msgid "Exit code that means an input file did not exist or was not readable." msgstr "" -#: ../../library/os.rst:4351 +#: ../../library/os.rst:4424 msgid "Exit code that means a specified user did not exist." msgstr "" -#: ../../library/os.rst:4358 +#: ../../library/os.rst:4431 msgid "Exit code that means a specified host did not exist." msgstr "" -#: ../../library/os.rst:4365 +#: ../../library/os.rst:4438 msgid "Exit code that means that a required service is unavailable." msgstr "" -#: ../../library/os.rst:4372 +#: ../../library/os.rst:4445 msgid "Exit code that means an internal software error was detected." msgstr "" -#: ../../library/os.rst:4379 +#: ../../library/os.rst:4452 msgid "" "Exit code that means an operating system error was detected, such as the " "inability to fork or create a pipe." msgstr "" -#: ../../library/os.rst:4387 +#: ../../library/os.rst:4460 msgid "" "Exit code that means some system file did not exist, could not be opened, or " "had some other kind of error." msgstr "" -#: ../../library/os.rst:4395 +#: ../../library/os.rst:4468 msgid "Exit code that means a user specified output file could not be created." msgstr "" -#: ../../library/os.rst:4402 +#: ../../library/os.rst:4475 msgid "" "Exit code that means that an error occurred while doing I/O on some file." msgstr "" -#: ../../library/os.rst:4409 +#: ../../library/os.rst:4482 msgid "" "Exit code that means a temporary failure occurred. This indicates something " "that may not really be an error, such as a network connection that couldn't " "be made during a retryable operation." msgstr "" -#: ../../library/os.rst:4418 +#: ../../library/os.rst:4491 msgid "" "Exit code that means that a protocol exchange was illegal, invalid, or not " "understood." msgstr "" -#: ../../library/os.rst:4426 +#: ../../library/os.rst:4499 msgid "" "Exit code that means that there were insufficient permissions to perform the " "operation (but not intended for file system problems)." msgstr "" -#: ../../library/os.rst:4434 +#: ../../library/os.rst:4507 msgid "Exit code that means that some kind of configuration error occurred." msgstr "" -#: ../../library/os.rst:4441 +#: ../../library/os.rst:4514 msgid "Exit code that means something like \"an entry was not found\"." msgstr "" -#: ../../library/os.rst:4448 +#: ../../library/os.rst:4521 msgid "" "Fork a child process. Return ``0`` in the child and the child's process id " "in the parent. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4451 +#: ../../library/os.rst:4524 msgid "" "Note that some platforms including FreeBSD <= 6.3 and Cygwin have known " "issues when using ``fork()`` from a thread." msgstr "" -#: ../../library/os.rst:4454 +#: ../../library/os.rst:4527 msgid "" "Raises an :ref:`auditing event ` ``os.fork`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.fork``。" -#: ../../library/os.rst:4458 +#: ../../library/os.rst:4531 msgid "" "If you use TLS sockets in an application calling ``fork()``, see the warning " "in the :mod:`ssl` documentation." msgstr "" -#: ../../library/os.rst:4463 ../../library/os.rst:4507 +#: ../../library/os.rst:4536 ../../library/os.rst:4580 msgid "" "On macOS the use of this function is unsafe when mixed with using higher-" "level system APIs, and that includes using :mod:`urllib.request`." msgstr "" -#: ../../library/os.rst:4466 +#: ../../library/os.rst:4539 msgid "" -"Calling ``fork()`` in a subinterpreter is no longer supported (:exc:" -"`RuntimeError` is raised)." +"Calling ``fork()`` in a subinterpreter is no longer supported " +"(:exc:`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4470 +#: ../../library/os.rst:4543 msgid "" -"If Python is able to detect that your process has multiple threads, :func:" -"`os.fork` now raises a :exc:`DeprecationWarning`." +"If Python is able to detect that your process has multiple " +"threads, :func:`os.fork` now raises a :exc:`DeprecationWarning`." msgstr "" -#: ../../library/os.rst:4474 +#: ../../library/os.rst:4547 msgid "" "We chose to surface this as a warning, when detectable, to better inform " "developers of a design problem that the POSIX platform specifically notes as " @@ -5037,21 +5146,21 @@ msgid "" "``free``)." msgstr "" -#: ../../library/os.rst:4483 +#: ../../library/os.rst:4556 msgid "" "Users of macOS or users of libc or malloc implementations other than those " "typically found in glibc to date are among those already more likely to " "experience deadlocks running such code." msgstr "" -#: ../../library/os.rst:4487 +#: ../../library/os.rst:4560 msgid "" "See `this discussion on fork being incompatible with threads `_ for technical details of why we're surfacing " "this longstanding platform compatibility problem to developers." msgstr "" -#: ../../library/os.rst:4497 +#: ../../library/os.rst:4570 msgid "" "Fork a child process, using a new pseudo-terminal as the child's controlling " "terminal. Return a pair of ``(pid, fd)``, where *pid* is ``0`` in the child, " @@ -5060,81 +5169,81 @@ msgid "" "the :mod:`pty` module. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4503 +#: ../../library/os.rst:4576 msgid "" "Raises an :ref:`auditing event ` ``os.forkpty`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.forkpty``。" -#: ../../library/os.rst:4510 +#: ../../library/os.rst:4583 msgid "" -"Calling ``forkpty()`` in a subinterpreter is no longer supported (:exc:" -"`RuntimeError` is raised)." +"Calling ``forkpty()`` in a subinterpreter is no longer supported " +"(:exc:`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4514 +#: ../../library/os.rst:4587 msgid "" "If Python is able to detect that your process has multiple threads, this now " -"raises a :exc:`DeprecationWarning`. See the longer explanation on :func:`os." -"fork`." +"raises a :exc:`DeprecationWarning`. See the longer explanation " +"on :func:`os.fork`." msgstr "" -#: ../../library/os.rst:4528 +#: ../../library/os.rst:4601 msgid "" "Send signal *sig* to the process *pid*. Constants for the specific signals " "available on the host platform are defined in the :mod:`signal` module." msgstr "" -#: ../../library/os.rst:4531 +#: ../../library/os.rst:4604 msgid "" -"Windows: The :const:`signal.CTRL_C_EVENT` and :const:`signal." -"CTRL_BREAK_EVENT` signals are special signals which can only be sent to " -"console processes which share a common console window, e.g., some " -"subprocesses. Any other value for *sig* will cause the process to be " +"Windows: The :const:`signal.CTRL_C_EVENT` " +"and :const:`signal.CTRL_BREAK_EVENT` signals are special signals which can " +"only be sent to console processes which share a common console window, e.g., " +"some subprocesses. Any other value for *sig* will cause the process to be " "unconditionally killed by the TerminateProcess API, and the exit code will " "be set to *sig*." msgstr "" -#: ../../library/os.rst:4538 +#: ../../library/os.rst:4611 msgid "See also :func:`signal.pthread_kill`." msgstr "另請參閱 :func:`signal.pthread_kill`。" -#: ../../library/os.rst:4540 +#: ../../library/os.rst:4613 msgid "" "Raises an :ref:`auditing event ` ``os.kill`` with arguments " "``pid``, ``sig``." msgstr "" -"引發一個附帶引數 ``pid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." -"kill``。" +"引發一個附帶引數 ``pid``、``sig`` 的\\ :ref:`稽核事件 ` " +"``os.kill``。" -#: ../../library/os.rst:4554 +#: ../../library/os.rst:4627 msgid "Send the signal *sig* to the process group *pgid*." msgstr "" -#: ../../library/os.rst:4556 +#: ../../library/os.rst:4629 msgid "" "Raises an :ref:`auditing event ` ``os.killpg`` with arguments " "``pgid``, ``sig``." msgstr "" -"引發一個附帶引數 ``pgid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." -"killpg``。" +"引發一個附帶引數 ``pgid``、``sig`` 的\\ :ref:`稽核事件 ` " +"``os.killpg``。" -#: ../../library/os.rst:4563 +#: ../../library/os.rst:4636 msgid "" "Add *increment* to the process's \"niceness\". Return the new niceness." msgstr "" -#: ../../library/os.rst:4570 +#: ../../library/os.rst:4643 msgid "" "Return a file descriptor referring to the process *pid* with *flags* set. " "This descriptor can be used to perform process management without races and " "signals." msgstr "" -#: ../../library/os.rst:4574 +#: ../../library/os.rst:4647 msgid "See the :manpage:`pidfd_open(2)` man page for more details." msgstr "更多細節請見 :manpage:`pidfd_open(2)` 手冊頁。" -#: ../../library/os.rst:4581 +#: ../../library/os.rst:4654 msgid "" "This flag indicates that the file descriptor will be non-blocking. If the " "process referred to by the file descriptor has not yet terminated, then an " @@ -5142,23 +5251,23 @@ msgid "" "immediately return the error :const:`~errno.EAGAIN` rather than blocking." msgstr "" -#: ../../library/os.rst:4592 +#: ../../library/os.rst:4665 msgid "" "Lock program segments into memory. The value of *op* (defined in ````) determines which segments are locked." msgstr "" -#: ../../library/os.rst:4600 +#: ../../library/os.rst:4673 msgid "" "Open a pipe to or from command *cmd*. The return value is an open file " "object connected to the pipe, which can be read or written depending on " "whether *mode* is ``'r'`` (default) or ``'w'``. The *buffering* argument " -"have the same meaning as the corresponding argument to the built-in :func:" -"`open` function. The returned file object reads or writes text strings " -"rather than bytes." +"have the same meaning as the corresponding argument to the built-" +"in :func:`open` function. The returned file object reads or writes text " +"strings rather than bytes." msgstr "" -#: ../../library/os.rst:4608 +#: ../../library/os.rst:4681 msgid "" "The ``close`` method returns :const:`None` if the subprocess exited " "successfully, or the subprocess's return code if there was an error. On " @@ -5170,57 +5279,63 @@ msgid "" "contains the signed integer return code from the child process." msgstr "" -#: ../../library/os.rst:4618 +#: ../../library/os.rst:4691 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the ``close`` " "method result (exit status) into an exit code if it is not ``None``. On " "Windows, the ``close`` method result is directly the exit code (or ``None``)." msgstr "" -#: ../../library/os.rst:4623 +#: ../../library/os.rst:4696 msgid "" "This is implemented using :class:`subprocess.Popen`; see that class's " "documentation for more powerful ways to manage and communicate with " "subprocesses." msgstr "" -#: ../../library/os.rst:4630 +#: ../../library/os.rst:4703 msgid "" "The :ref:`Python UTF-8 Mode ` affects encodings used for *cmd* " "and pipe contents." msgstr "" -#: ../../library/os.rst:4633 +#: ../../library/os.rst:4706 +msgid "" +":func:`popen` is a simple wrapper around :class:`subprocess.Popen`. " +"Use :class:`subprocess.Popen` or :func:`subprocess.run` to control options " +"like encodings." +msgstr "" + +#: ../../library/os.rst:4710 msgid "" -":func:`popen` is a simple wrapper around :class:`subprocess.Popen`. Use :" -"class:`subprocess.Popen` or :func:`subprocess.run` to control options like " -"encodings." +"The function is :term:`soft deprecated` and should no longer be used to " +"write new code. The :mod:`subprocess` module is recommended instead." msgstr "" -#: ../../library/os.rst:4642 +#: ../../library/os.rst:4719 msgid "Wraps the :c:func:`!posix_spawn` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4644 +#: ../../library/os.rst:4721 msgid "" "Most users should use :func:`subprocess.run` instead of :func:`posix_spawn`." msgstr "" -#: ../../library/os.rst:4646 +#: ../../library/os.rst:4723 msgid "" -"The positional-only arguments *path*, *args*, and *env* are similar to :func:" -"`execve`. *env* is allowed to be ``None``, in which case current process' " -"environment is used." +"The positional-only arguments *path*, *args*, and *env* are similar " +"to :func:`execve`. *env* is allowed to be ``None``, in which case current " +"process' environment is used." msgstr "" -#: ../../library/os.rst:4650 +#: ../../library/os.rst:4727 msgid "" "The *path* parameter is the path to the executable file. The *path* should " "contain a directory. Use :func:`posix_spawnp` to pass an executable file " "without directory." msgstr "" -#: ../../library/os.rst:4654 +#: ../../library/os.rst:4731 msgid "" "The *file_actions* argument may be a sequence of tuples describing actions " "to take on specific file descriptors in the child process between the C " @@ -5229,49 +5344,49 @@ msgid "" "describing the remaining tuple elements:" msgstr "" -#: ../../library/os.rst:4662 +#: ../../library/os.rst:4739 msgid "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" msgstr "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" -#: ../../library/os.rst:4664 +#: ../../library/os.rst:4741 msgid "Performs ``os.dup2(os.open(path, flags, mode), fd)``." msgstr "" -#: ../../library/os.rst:4668 +#: ../../library/os.rst:4745 msgid "(``os.POSIX_SPAWN_CLOSE``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSE``, *fd*)" -#: ../../library/os.rst:4670 +#: ../../library/os.rst:4747 msgid "Performs ``os.close(fd)``." msgstr "" -#: ../../library/os.rst:4674 +#: ../../library/os.rst:4751 msgid "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" msgstr "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" -#: ../../library/os.rst:4676 +#: ../../library/os.rst:4753 msgid "Performs ``os.dup2(fd, new_fd)``." msgstr "" -#: ../../library/os.rst:4680 +#: ../../library/os.rst:4757 msgid "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" -#: ../../library/os.rst:4682 +#: ../../library/os.rst:4759 msgid "Performs ``os.closerange(fd, INF)``." msgstr "" -#: ../../library/os.rst:4684 +#: ../../library/os.rst:4761 msgid "" "These tuples correspond to the C library :c:func:`!" "posix_spawn_file_actions_addopen`, :c:func:`!" "posix_spawn_file_actions_addclose`, :c:func:`!" "posix_spawn_file_actions_adddup2`, and :c:func:`!" -"posix_spawn_file_actions_addclosefrom_np` API calls used to prepare for the :" -"c:func:`!posix_spawn` call itself." +"posix_spawn_file_actions_addclosefrom_np` API calls used to prepare for " +"the :c:func:`!posix_spawn` call itself." msgstr "" -#: ../../library/os.rst:4691 +#: ../../library/os.rst:4768 msgid "" "The *setpgroup* argument will set the process group of the child to the " "value specified. If the value specified is 0, the child's process group ID " @@ -5280,7 +5395,7 @@ msgid "" "corresponds to the C library :c:macro:`!POSIX_SPAWN_SETPGROUP` flag." msgstr "" -#: ../../library/os.rst:4697 +#: ../../library/os.rst:4774 msgid "" "If the *resetids* argument is ``True`` it will reset the effective UID and " "GID of the child to the real UID and GID of the parent process. If the " @@ -5291,15 +5406,15 @@ msgid "" "library :c:macro:`!POSIX_SPAWN_RESETIDS` flag." msgstr "" -#: ../../library/os.rst:4705 +#: ../../library/os.rst:4782 msgid "" "If the *setsid* argument is ``True``, it will create a new session ID for " -"``posix_spawn``. *setsid* requires :c:macro:`!POSIX_SPAWN_SETSID` or :c:" -"macro:`!POSIX_SPAWN_SETSID_NP` flag. Otherwise, :exc:`NotImplementedError` " -"is raised." +"``posix_spawn``. *setsid* requires :c:macro:`!POSIX_SPAWN_SETSID` " +"or :c:macro:`!POSIX_SPAWN_SETSID_NP` flag. " +"Otherwise, :exc:`NotImplementedError` is raised." msgstr "" -#: ../../library/os.rst:4710 +#: ../../library/os.rst:4787 msgid "" "The *setsigmask* argument will set the signal mask to the signal set " "specified. If the parameter is not used, then the child inherits the " @@ -5307,14 +5422,14 @@ msgid "" "POSIX_SPAWN_SETSIGMASK` flag." msgstr "" -#: ../../library/os.rst:4715 +#: ../../library/os.rst:4792 msgid "" "The *sigdef* argument will reset the disposition of all signals in the set " "specified. This argument corresponds to the C library :c:macro:`!" "POSIX_SPAWN_SETSIGDEF` flag." msgstr "" -#: ../../library/os.rst:4719 +#: ../../library/os.rst:4796 msgid "" "The *scheduler* argument must be a tuple containing the (optional) scheduler " "policy and an instance of :class:`sched_param` with the scheduler " @@ -5324,7 +5439,7 @@ msgid "" "POSIX_SPAWN_SETSCHEDULER` flags." msgstr "" -#: ../../library/os.rst:4726 ../../library/os.rst:4747 +#: ../../library/os.rst:4803 ../../library/os.rst:4824 msgid "" "Raises an :ref:`auditing event ` ``os.posix_spawn`` with arguments " "``path``, ``argv``, ``env``." @@ -5332,87 +5447,88 @@ msgstr "" "引發一個附帶引數 ``path``、``argv``、``env`` 的\\ :ref:`稽核事件 ` " "``os.posix_spawn``。" -#: ../../library/os.rst:4730 +#: ../../library/os.rst:4807 msgid "" "*env* parameter accepts ``None``. ``os.POSIX_SPAWN_CLOSEFROM`` is available " "on platforms where :c:func:`!posix_spawn_file_actions_addclosefrom_np` " "exists." msgstr "" -#: ../../library/os.rst:4741 +#: ../../library/os.rst:4818 msgid "Wraps the :c:func:`!posix_spawnp` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4743 +#: ../../library/os.rst:4820 msgid "" "Similar to :func:`posix_spawn` except that the system searches for the " "*executable* file in the list of directories specified by the :envvar:`PATH` " "environment variable (in the same way as for ``execvp(3)``)." msgstr "" -#: ../../library/os.rst:4753 +#: ../../library/os.rst:4830 msgid "See :func:`posix_spawn` documentation." msgstr "見 :func:`posix_spawn` 文件。" -#: ../../library/os.rst:4759 +#: ../../library/os.rst:4836 msgid "" -"Register callables to be executed when a new child process is forked using :" -"func:`os.fork` or similar process cloning APIs. The parameters are optional " -"and keyword-only. Each specifies a different call point." +"Register callables to be executed when a new child process is forked " +"using :func:`os.fork` or similar process cloning APIs. The parameters are " +"optional and keyword-only. Each specifies a different call point." msgstr "" -#: ../../library/os.rst:4764 +#: ../../library/os.rst:4841 msgid "*before* is a function called before forking a child process." msgstr "" -#: ../../library/os.rst:4765 +#: ../../library/os.rst:4842 msgid "" "*after_in_parent* is a function called from the parent process after forking " "a child process." msgstr "" -#: ../../library/os.rst:4767 +#: ../../library/os.rst:4844 msgid "*after_in_child* is a function called from the child process." msgstr "" -#: ../../library/os.rst:4769 +#: ../../library/os.rst:4846 msgid "" "These calls are only made if control is expected to return to the Python " "interpreter. A typical :mod:`subprocess` launch will not trigger them as " "the child is not going to re-enter the interpreter." msgstr "" -#: ../../library/os.rst:4773 +#: ../../library/os.rst:4850 msgid "" "Functions registered for execution before forking are called in reverse " "registration order. Functions registered for execution after forking " "(either in the parent or in the child) are called in registration order." msgstr "" -#: ../../library/os.rst:4778 +#: ../../library/os.rst:4855 msgid "" "Note that :c:func:`fork` calls made by third-party C code may not call those " -"functions, unless it explicitly calls :c:func:`PyOS_BeforeFork`, :c:func:" -"`PyOS_AfterFork_Parent` and :c:func:`PyOS_AfterFork_Child`." +"functions, unless it explicitly " +"calls :c:func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` " +"and :c:func:`PyOS_AfterFork_Child`." msgstr "" -#: ../../library/os.rst:4782 +#: ../../library/os.rst:4859 msgid "There is no way to unregister a function." msgstr "" -#: ../../library/os.rst:4798 +#: ../../library/os.rst:4875 msgid "Execute the program *path* in a new process." msgstr "" -#: ../../library/os.rst:4800 +#: ../../library/os.rst:4877 msgid "" "(Note that the :mod:`subprocess` module provides more powerful facilities " "for spawning new processes and retrieving their results; using that module " -"is preferable to using these functions. Check especially the :ref:" -"`subprocess-replacements` section.)" +"is preferable to using these functions. Check especially " +"the :ref:`subprocess-replacements` section.)" msgstr "" -#: ../../library/os.rst:4805 +#: ../../library/os.rst:4882 msgid "" "If *mode* is :const:`P_NOWAIT`, this function returns the process id of the " "new process; if *mode* is :const:`P_WAIT`, returns the process's exit code " @@ -5421,13 +5537,13 @@ msgid "" "handle, so can be used with the :func:`waitpid` function." msgstr "" -#: ../../library/os.rst:4811 +#: ../../library/os.rst:4888 msgid "" "Note on VxWorks, this function doesn't return ``-signal`` when the new " "process is killed. Instead it raises OSError exception." msgstr "" -#: ../../library/os.rst:4814 +#: ../../library/os.rst:4891 msgid "" "The \"l\" and \"v\" variants of the :func:`spawn\\* ` functions " "differ in how command-line arguments are passed. The \"l\" variants are " @@ -5439,38 +5555,39 @@ msgid "" "to the child process must start with the name of the command being run." msgstr "" -#: ../../library/os.rst:4823 +#: ../../library/os.rst:4900 msgid "" -"The variants which include a second \"p\" near the end (:func:`spawnlp`, :" -"func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the :envvar:" -"`PATH` environment variable to locate the program *file*. When the " -"environment is being replaced (using one of the :func:`spawn\\*e ` " -"variants, discussed in the next paragraph), the new environment is used as " -"the source of the :envvar:`PATH` variable. The other variants, :func:" -"`spawnl`, :func:`spawnle`, :func:`spawnv`, and :func:`spawnve`, will not use " -"the :envvar:`PATH` variable to locate the executable; *path* must contain an " -"appropriate absolute or relative path." +"The variants which include a second \"p\" near the end " +"(:func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) " +"will use the :envvar:`PATH` environment variable to locate the program " +"*file*. When the environment is being replaced (using one of " +"the :func:`spawn\\*e ` variants, discussed in the next paragraph), " +"the new environment is used as the source of the :envvar:`PATH` variable. " +"The other variants, :func:`spawnl`, :func:`spawnle`, :func:`spawnv`, " +"and :func:`spawnve`, will not use the :envvar:`PATH` variable to locate the " +"executable; *path* must contain an appropriate absolute or relative path." msgstr "" -#: ../../library/os.rst:4833 +#: ../../library/os.rst:4910 msgid "" "For :func:`spawnle`, :func:`spawnlpe`, :func:`spawnve`, and :func:`spawnvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " "which is used to define the environment variables for the new process (they " -"are used instead of the current process' environment); the functions :func:" -"`spawnl`, :func:`spawnlp`, :func:`spawnv`, and :func:`spawnvp` all cause the " -"new process to inherit the environment of the current process. Note that " -"keys and values in the *env* dictionary must be strings; invalid keys or " -"values will cause the function to fail, with a return value of ``127``." +"are used instead of the current process' environment); the " +"functions :func:`spawnl`, :func:`spawnlp`, :func:`spawnv`, " +"and :func:`spawnvp` all cause the new process to inherit the environment of " +"the current process. Note that keys and values in the *env* dictionary must " +"be strings; invalid keys or values will cause the function to fail, with a " +"return value of ``127``." msgstr "" -#: ../../library/os.rst:4842 +#: ../../library/os.rst:4919 msgid "" "As an example, the following calls to :func:`spawnlp` and :func:`spawnvpe` " "are equivalent::" msgstr "" -#: ../../library/os.rst:4845 +#: ../../library/os.rst:4922 msgid "" "import os\n" "os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')\n" @@ -5484,7 +5601,7 @@ msgstr "" "L = ['cp', 'index.html', '/dev/null']\n" "os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)" -#: ../../library/os.rst:4851 +#: ../../library/os.rst:4928 msgid "" "Raises an :ref:`auditing event ` ``os.spawn`` with arguments " "``mode``, ``path``, ``args``, ``env``." @@ -5492,7 +5609,7 @@ msgstr "" "引發一個附帶引數 ``mode``、``path``、``args``、``env`` 的\\ :ref:`稽核事件 " "` ``os.spawn``。" -#: ../../library/os.rst:4855 +#: ../../library/os.rst:4932 msgid "" ":func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp` and :func:`spawnvpe` are " "not available on Windows. :func:`spawnle` and :func:`spawnve` are not " @@ -5500,15 +5617,21 @@ msgid "" "instead." msgstr "" -#: ../../library/os.rst:4867 +#: ../../library/os.rst:4940 +msgid "" +"These functions are :term:`soft deprecated` and should no longer be used to " +"write new code. The :mod:`subprocess` module is recommended instead." +msgstr "" + +#: ../../library/os.rst:4948 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " -"family of functions. If either of these values is given, the :func:" -"`spawn\\* ` functions will return as soon as the new process has " -"been created, with the process id as the return value." +"family of functions. If either of these values is given, " +"the :func:`spawn\\* ` functions will return as soon as the new " +"process has been created, with the process id as the return value." msgstr "" -#: ../../library/os.rst:4877 +#: ../../library/os.rst:4958 msgid "" "Possible value for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If this is given as *mode*, the :func:`spawn\\* " @@ -5517,29 +5640,29 @@ msgid "" "successful, or ``-signal`` if a signal kills the process." msgstr "" -#: ../../library/os.rst:4889 +#: ../../library/os.rst:4970 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " -"family of functions. These are less portable than those listed above. :" -"const:`P_DETACH` is similar to :const:`P_NOWAIT`, but the new process is " -"detached from the console of the calling process. If :const:`P_OVERLAY` is " -"used, the current process will be replaced; the :func:`spawn\\* ` " -"function will not return." +"family of functions. These are less portable than those listed " +"above. :const:`P_DETACH` is similar to :const:`P_NOWAIT`, but the new " +"process is detached from the console of the calling process. " +"If :const:`P_OVERLAY` is used, the current process will be replaced; " +"the :func:`spawn\\* ` function will not return." msgstr "" -#: ../../library/os.rst:4900 +#: ../../library/os.rst:4981 msgid "Start a file with its associated application." msgstr "" -#: ../../library/os.rst:4902 +#: ../../library/os.rst:4983 msgid "" "When *operation* is not specified, this acts like double-clicking the file " -"in Windows Explorer, or giving the file name as an argument to the :program:" -"`start` command from the interactive command shell: the file is opened with " -"whatever application (if any) its extension is associated." +"in Windows Explorer, or giving the file name as an argument to " +"the :program:`start` command from the interactive command shell: the file is " +"opened with whatever application (if any) its extension is associated." msgstr "" -#: ../../library/os.rst:4907 +#: ../../library/os.rst:4988 msgid "" "When another *operation* is given, it must be a \"command verb\" that " "specifies what should be done with the file. Common verbs documented by " @@ -5547,28 +5670,28 @@ msgid "" "as well as ``'explore'`` and ``'find'`` (to be used on directories)." msgstr "" -#: ../../library/os.rst:4912 +#: ../../library/os.rst:4993 msgid "" "When launching an application, specify *arguments* to be passed as a single " "string. This argument may have no effect when using this function to launch " "a document." msgstr "" -#: ../../library/os.rst:4916 +#: ../../library/os.rst:4997 msgid "" "The default working directory is inherited, but may be overridden by the " "*cwd* argument. This should be an absolute path. A relative *path* will be " "resolved against this argument." msgstr "" -#: ../../library/os.rst:4920 +#: ../../library/os.rst:5001 msgid "" "Use *show_cmd* to override the default window style. Whether this has any " "effect will depend on the application being launched. Values are integers as " "supported by the Win32 :c:func:`!ShellExecute` function." msgstr "" -#: ../../library/os.rst:4924 +#: ../../library/os.rst:5005 msgid "" ":func:`startfile` returns as soon as the associated application is launched. " "There is no option to wait for the application to close, and no way to " @@ -5579,14 +5702,14 @@ msgid "" "encoded for Win32." msgstr "" -#: ../../library/os.rst:4932 +#: ../../library/os.rst:5013 msgid "" "To reduce interpreter startup overhead, the Win32 :c:func:`!ShellExecute` " "function is not resolved until this function is first called. If the " "function cannot be resolved, :exc:`NotImplementedError` will be raised." msgstr "" -#: ../../library/os.rst:4936 +#: ../../library/os.rst:5017 msgid "" "Raises an :ref:`auditing event ` ``os.startfile`` with arguments " "``path``, ``operation``." @@ -5594,7 +5717,7 @@ msgstr "" "引發一個附帶引數 ``path``、``operation`` 的\\ :ref:`稽核事件 ` " "``os.startfile``。" -#: ../../library/os.rst:4938 +#: ../../library/os.rst:5019 msgid "" "Raises an :ref:`auditing event ` ``os.startfile/2`` with arguments " "``path``, ``operation``, ``arguments``, ``cwd``, ``show_cmd``." @@ -5602,13 +5725,13 @@ msgstr "" "引發一個附帶引數 ``path``、``operation``、``arguments``、``cwd``、" "``show_cmd`` 的\\ :ref:`稽核事件 ` ``os.startfile/2``。" -#: ../../library/os.rst:4942 +#: ../../library/os.rst:5023 msgid "" -"Added the *arguments*, *cwd* and *show_cmd* arguments, and the ``os." -"startfile/2`` audit event." +"Added the *arguments*, *cwd* and *show_cmd* arguments, and the " +"``os.startfile/2`` audit event." msgstr "" -#: ../../library/os.rst:4949 +#: ../../library/os.rst:5030 msgid "" "Execute the command (a string) in a subshell. This is implemented by " "calling the Standard C function :c:func:`system`, and has the same " @@ -5619,87 +5742,87 @@ msgid "" "value of the Python function is system-dependent." msgstr "" -#: ../../library/os.rst:4957 +#: ../../library/os.rst:5038 msgid "" "On Unix, the return value is the exit status of the process encoded in the " "format specified for :func:`wait`." msgstr "" -#: ../../library/os.rst:4960 +#: ../../library/os.rst:5041 msgid "" "On Windows, the return value is that returned by the system shell after " -"running *command*. The shell is given by the Windows environment variable :" -"envvar:`COMSPEC`: it is usually :program:`cmd.exe`, which returns the exit " -"status of the command run; on systems using a non-native shell, consult your " -"shell documentation." +"running *command*. The shell is given by the Windows environment " +"variable :envvar:`COMSPEC`: it is usually :program:`cmd.exe`, which returns " +"the exit status of the command run; on systems using a non-native shell, " +"consult your shell documentation." msgstr "" -#: ../../library/os.rst:4966 +#: ../../library/os.rst:5047 msgid "" "The :mod:`subprocess` module provides more powerful facilities for spawning " -"new processes and retrieving their results; using that module is preferable " +"new processes and retrieving their results; using that module is recommended " "to using this function. See the :ref:`subprocess-replacements` section in " "the :mod:`subprocess` documentation for some helpful recipes." msgstr "" -#: ../../library/os.rst:4971 +#: ../../library/os.rst:5052 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the result " "(exit status) into an exit code. On Windows, the result is directly the exit " "code." msgstr "" -#: ../../library/os.rst:4975 +#: ../../library/os.rst:5056 msgid "" "Raises an :ref:`auditing event ` ``os.system`` with argument " "``command``." msgstr "" "引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 ` ``os.system``。" -#: ../../library/os.rst:4982 +#: ../../library/os.rst:5063 msgid "" "Returns the current global process times. The return value is an object with " "five attributes:" msgstr "" -#: ../../library/os.rst:4985 +#: ../../library/os.rst:5066 msgid ":attr:`!user` - user time" msgstr ":attr:`!user` - 使用者時間" -#: ../../library/os.rst:4986 +#: ../../library/os.rst:5067 msgid ":attr:`!system` - system time" msgstr ":attr:`!system` - 系統時間" -#: ../../library/os.rst:4987 +#: ../../library/os.rst:5068 msgid ":attr:`!children_user` - user time of all child processes" msgstr ":attr:`!children_user` - 所有子行程的使用者時間" -#: ../../library/os.rst:4988 +#: ../../library/os.rst:5069 msgid ":attr:`!children_system` - system time of all child processes" msgstr ":attr:`!children_system` - 所有子行程的系統時間" -#: ../../library/os.rst:4989 +#: ../../library/os.rst:5070 msgid ":attr:`!elapsed` - elapsed real time since a fixed point in the past" msgstr "" -#: ../../library/os.rst:4991 +#: ../../library/os.rst:5072 msgid "" "For backwards compatibility, this object also behaves like a five-tuple " "containing :attr:`!user`, :attr:`!system`, :attr:`!children_user`, :attr:`!" "children_system`, and :attr:`!elapsed` in that order." msgstr "" -#: ../../library/os.rst:4995 +#: ../../library/os.rst:5076 msgid "" -"See the Unix manual page :manpage:`times(2)` and `times(3) `_ manual page on Unix or `the " +"See the Unix manual page :manpage:`times(2)` and `times(3) `_ manual page on Unix or `the " "GetProcessTimes MSDN `_ on Windows. On " "Windows, only :attr:`!user` and :attr:`!system` are known; the other " "attributes are zero." msgstr "" -#: ../../library/os.rst:5009 +#: ../../library/os.rst:5090 msgid "" "Wait for completion of a child process, and return a tuple containing its " "pid and exit status indication: a 16-bit number, whose low byte is the " @@ -5708,87 +5831,87 @@ msgid "" "if a core file was produced." msgstr "" -#: ../../library/os.rst:5015 +#: ../../library/os.rst:5096 msgid "" "If there are no children that could be waited for, :exc:`ChildProcessError` " "is raised." msgstr "" -#: ../../library/os.rst:5018 ../../library/os.rst:5093 +#: ../../library/os.rst:5099 ../../library/os.rst:5174 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exit code." msgstr "" -#: ../../library/os.rst:5025 +#: ../../library/os.rst:5106 msgid "" "The other :func:`!wait*` functions documented below can be used to wait for " -"the completion of a specific child process and have more options. :func:" -"`waitpid` is the only one also available on Windows." +"the completion of a specific child process and have more " +"options. :func:`waitpid` is the only one also available on Windows." msgstr "" -#: ../../library/os.rst:5032 +#: ../../library/os.rst:5113 msgid "Wait for the completion of a child process." msgstr "" -#: ../../library/os.rst:5034 +#: ../../library/os.rst:5115 msgid "" -"*idtype* can be :data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or (on Linux) :" -"data:`P_PIDFD`. The interpretation of *id* depends on it; see their " +"*idtype* can be :data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or (on " +"Linux) :data:`P_PIDFD`. The interpretation of *id* depends on it; see their " "individual descriptions." msgstr "" -#: ../../library/os.rst:5037 +#: ../../library/os.rst:5118 msgid "" -"*options* is an OR combination of flags. At least one of :data:`WEXITED`, :" -"data:`WSTOPPED` or :data:`WCONTINUED` is required; :data:`WNOHANG` and :data:" -"`WNOWAIT` are additional optional flags." +"*options* is an OR combination of flags. At least one " +"of :data:`WEXITED`, :data:`WSTOPPED` or :data:`WCONTINUED` is " +"required; :data:`WNOHANG` and :data:`WNOWAIT` are additional optional flags." msgstr "" -#: ../../library/os.rst:5041 +#: ../../library/os.rst:5122 msgid "" -"The return value is an object representing the data contained in the :c:type:" -"`siginfo_t` structure with the following attributes:" +"The return value is an object representing the data contained in " +"the :c:type:`siginfo_t` structure with the following attributes:" msgstr "" -#: ../../library/os.rst:5044 +#: ../../library/os.rst:5125 msgid ":attr:`!si_pid` (process ID)" msgstr "" -#: ../../library/os.rst:5045 +#: ../../library/os.rst:5126 msgid ":attr:`!si_uid` (real user ID of the child)" msgstr "" -#: ../../library/os.rst:5046 +#: ../../library/os.rst:5127 msgid ":attr:`!si_signo` (always :const:`~signal.SIGCHLD`)" msgstr "" -#: ../../library/os.rst:5047 +#: ../../library/os.rst:5128 msgid "" ":attr:`!si_status` (the exit status or signal number, depending on :attr:`!" "si_code`)" msgstr "" -#: ../../library/os.rst:5048 +#: ../../library/os.rst:5129 msgid ":attr:`!si_code` (see :data:`CLD_EXITED` for possible values)" msgstr "" -#: ../../library/os.rst:5050 +#: ../../library/os.rst:5131 msgid "" "If :data:`WNOHANG` is specified and there are no matching children in the " "requested state, ``None`` is returned. Otherwise, if there are no matching " "children that could be waited for, :exc:`ChildProcessError` is raised." msgstr "" -#: ../../library/os.rst:5059 +#: ../../library/os.rst:5140 msgid "This function is now available on macOS as well." msgstr "" -#: ../../library/os.rst:5065 +#: ../../library/os.rst:5146 msgid "The details of this function differ on Unix and Windows." msgstr "" -#: ../../library/os.rst:5067 +#: ../../library/os.rst:5148 msgid "" "On Unix: Wait for completion of a child process given by process id *pid*, " "and return a tuple containing its process id and exit status indication " @@ -5797,7 +5920,7 @@ msgid "" "operation." msgstr "" -#: ../../library/os.rst:5072 +#: ../../library/os.rst:5153 msgid "" "If *pid* is greater than ``0``, :func:`waitpid` requests status information " "for that specific process. If *pid* is ``0``, the request is for the status " @@ -5807,7 +5930,7 @@ msgid "" "group ``-pid`` (the absolute value of *pid*)." msgstr "" -#: ../../library/os.rst:5079 +#: ../../library/os.rst:5160 msgid "" "*options* is an OR combination of flags. If it contains :data:`WNOHANG` and " "there are no matching children in the requested state, ``(0, 0)`` is " @@ -5816,19 +5939,19 @@ msgid "" "are :data:`WUNTRACED` and :data:`WCONTINUED`." msgstr "" -#: ../../library/os.rst:5085 +#: ../../library/os.rst:5166 msgid "" "On Windows: Wait for completion of a process given by process handle *pid*, " "and return a tuple containing *pid*, and its exit status shifted left by 8 " "bits (shifting makes cross-platform use of the function easier). A *pid* " "less than or equal to ``0`` has no special meaning on Windows, and raises an " "exception. The value of integer *options* has no effect. *pid* can refer to " -"any process whose id is known, not necessarily a child process. The :func:" -"`spawn\\* ` functions called with :const:`P_NOWAIT` return suitable " -"process handles." +"any process whose id is known, not necessarily a child process. " +"The :func:`spawn\\* ` functions called with :const:`P_NOWAIT` return " +"suitable process handles." msgstr "" -#: ../../library/os.rst:5106 +#: ../../library/os.rst:5187 msgid "" "Similar to :func:`waitpid`, except no process id argument is given and a 3-" "element tuple containing the child's process id, exit status indication, and " @@ -5837,13 +5960,13 @@ msgid "" "same as that provided to :func:`waitpid` and :func:`wait4`." msgstr "" -#: ../../library/os.rst:5113 ../../library/os.rst:5127 +#: ../../library/os.rst:5194 ../../library/os.rst:5208 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exitcode." msgstr "" -#: ../../library/os.rst:5121 +#: ../../library/os.rst:5202 msgid "" "Similar to :func:`waitpid`, except a 3-element tuple, containing the child's " "process id, exit status indication, and resource usage information is " @@ -5852,118 +5975,118 @@ msgid "" "to :func:`waitpid`." msgstr "" -#: ../../library/os.rst:5138 +#: ../../library/os.rst:5219 msgid "" "These are the possible values for *idtype* in :func:`waitid`. They affect " "how *id* is interpreted:" msgstr "" -#: ../../library/os.rst:5141 +#: ../../library/os.rst:5222 msgid ":data:`!P_PID` - wait for the child whose PID is *id*." msgstr "" -#: ../../library/os.rst:5142 +#: ../../library/os.rst:5223 msgid ":data:`!P_PGID` - wait for any child whose progress group ID is *id*." msgstr "" -#: ../../library/os.rst:5143 +#: ../../library/os.rst:5224 msgid ":data:`!P_ALL` - wait for any child; *id* is ignored." msgstr "" -#: ../../library/os.rst:5144 +#: ../../library/os.rst:5225 msgid "" ":data:`!P_PIDFD` - wait for the child identified by the file descriptor *id* " "(a process file descriptor created with :func:`pidfd_open`)." msgstr "" -#: ../../library/os.rst:5149 +#: ../../library/os.rst:5230 msgid ":data:`!P_PIDFD` is only available on Linux >= 5.4." msgstr "" -#: ../../library/os.rst:5152 +#: ../../library/os.rst:5233 msgid "The :data:`!P_PIDFD` constant." msgstr "" -#: ../../library/os.rst:5158 +#: ../../library/os.rst:5239 msgid "" -"This *options* flag for :func:`waitpid`, :func:`wait3`, :func:`wait4`, and :" -"func:`waitid` causes child processes to be reported if they have been " +"This *options* flag for :func:`waitpid`, :func:`wait3`, :func:`wait4`, " +"and :func:`waitid` causes child processes to be reported if they have been " "continued from a job control stop since they were last reported." msgstr "" -#: ../../library/os.rst:5167 +#: ../../library/os.rst:5248 msgid "" "This *options* flag for :func:`waitid` causes child processes that have " "terminated to be reported." msgstr "" -#: ../../library/os.rst:5170 +#: ../../library/os.rst:5251 msgid "" "The other ``wait*`` functions always report children that have terminated, " "so this option is not available for them." msgstr "" -#: ../../library/os.rst:5180 +#: ../../library/os.rst:5261 msgid "" "This *options* flag for :func:`waitid` causes child processes that have been " "stopped by the delivery of a signal to be reported." msgstr "" -#: ../../library/os.rst:5183 ../../library/os.rst:5215 +#: ../../library/os.rst:5264 ../../library/os.rst:5296 msgid "This option is not available for the other ``wait*`` functions." msgstr "" -#: ../../library/os.rst:5192 +#: ../../library/os.rst:5273 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, and :func:`wait4` " "causes child processes to also be reported if they have been stopped but " "their current state has not been reported since they were stopped." msgstr "" -#: ../../library/os.rst:5196 +#: ../../library/os.rst:5277 msgid "This option is not available for :func:`waitid`." msgstr "" -#: ../../library/os.rst:5203 +#: ../../library/os.rst:5284 msgid "" "This *options* flag causes :func:`waitpid`, :func:`wait3`, :func:`wait4`, " "and :func:`waitid` to return right away if no child process status is " "available immediately." msgstr "" -#: ../../library/os.rst:5212 +#: ../../library/os.rst:5293 msgid "" "This *options* flag causes :func:`waitid` to leave the child in a waitable " "state, so that a later :func:`!wait*` call can be used to retrieve the child " "status information again." msgstr "" -#: ../../library/os.rst:5227 +#: ../../library/os.rst:5308 msgid "" "These are the possible values for :attr:`!si_code` in the result returned " "by :func:`waitid`." msgstr "" -#: ../../library/os.rst:5234 +#: ../../library/os.rst:5315 msgid "Added :data:`CLD_KILLED` and :data:`CLD_STOPPED` values." msgstr "新增 :data:`CLD_KILLED` 和 :data:`CLD_STOPPED` 值。" -#: ../../library/os.rst:5240 +#: ../../library/os.rst:5321 msgid "Convert a wait status to an exit code." msgstr "" -#: ../../library/os.rst:5242 +#: ../../library/os.rst:5323 msgid "On Unix:" msgstr "在 Unix 上:" -#: ../../library/os.rst:5244 +#: ../../library/os.rst:5325 msgid "" "If the process exited normally (if ``WIFEXITED(status)`` is true), return " "the process exit status (return ``WEXITSTATUS(status)``): result greater " "than or equal to 0." msgstr "" -#: ../../library/os.rst:5247 +#: ../../library/os.rst:5328 msgid "" "If the process was terminated by a signal (if ``WIFSIGNALED(status)`` is " "true), return ``-signum`` where *signum* is the number of the signal that " @@ -5971,15 +6094,15 @@ msgid "" "than 0." msgstr "" -#: ../../library/os.rst:5251 +#: ../../library/os.rst:5332 msgid "Otherwise, raise a :exc:`ValueError`." msgstr "否則,引發 :exc:`ValueError`。" -#: ../../library/os.rst:5253 +#: ../../library/os.rst:5334 msgid "On Windows, return *status* shifted right by 8 bits." msgstr "" -#: ../../library/os.rst:5255 +#: ../../library/os.rst:5336 msgid "" "On Unix, if the process is being traced or if :func:`waitpid` was called " "with :data:`WUNTRACED` option, the caller must first check if " @@ -5987,226 +6110,234 @@ msgid "" "``WIFSTOPPED(status)`` is true." msgstr "" -#: ../../library/os.rst:5262 +#: ../../library/os.rst:5343 msgid "" -":func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`, :func:" -"`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` functions." +":func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`, :func:`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` " +"functions." msgstr "" -#: ../../library/os.rst:5270 +#: ../../library/os.rst:5351 msgid "" -"The following functions take a process status code as returned by :func:" -"`system`, :func:`wait`, or :func:`waitpid` as a parameter. They may be used " -"to determine the disposition of a process." +"The following functions take a process status code as returned " +"by :func:`system`, :func:`wait`, or :func:`waitpid` as a parameter. They " +"may be used to determine the disposition of a process." msgstr "" -#: ../../library/os.rst:5276 +#: ../../library/os.rst:5357 msgid "" "Return ``True`` if a core dump was generated for the process, otherwise " "return ``False``." msgstr "" -#: ../../library/os.rst:5279 ../../library/os.rst:5345 +#: ../../library/os.rst:5360 ../../library/os.rst:5426 msgid "This function should be employed only if :func:`WIFSIGNALED` is true." msgstr "" -#: ../../library/os.rst:5286 +#: ../../library/os.rst:5367 msgid "" -"Return ``True`` if a stopped child has been resumed by delivery of :const:" -"`~signal.SIGCONT` (if the process has been continued from a job control " -"stop), otherwise return ``False``." +"Return ``True`` if a stopped child has been resumed by delivery " +"of :const:`~signal.SIGCONT` (if the process has been continued from a job " +"control stop), otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5290 +#: ../../library/os.rst:5371 msgid "See :data:`WCONTINUED` option." msgstr "參閱 :data:`WCONTINUED` 選項。" -#: ../../library/os.rst:5297 +#: ../../library/os.rst:5378 msgid "" "Return ``True`` if the process was stopped by delivery of a signal, " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5300 +#: ../../library/os.rst:5381 msgid "" ":func:`WIFSTOPPED` only returns ``True`` if the :func:`waitpid` call was " "done using :data:`WUNTRACED` option or when the process is being traced " "(see :manpage:`ptrace(2)`)." msgstr "" -#: ../../library/os.rst:5308 +#: ../../library/os.rst:5389 msgid "" "Return ``True`` if the process was terminated by a signal, otherwise return " "``False``." msgstr "" -#: ../../library/os.rst:5316 +#: ../../library/os.rst:5397 msgid "" "Return ``True`` if the process exited terminated normally, that is, by " "calling ``exit()`` or ``_exit()``, or by returning from ``main()``; " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5325 +#: ../../library/os.rst:5406 msgid "Return the process exit status." msgstr "" -#: ../../library/os.rst:5327 +#: ../../library/os.rst:5408 msgid "This function should be employed only if :func:`WIFEXITED` is true." msgstr "" -#: ../../library/os.rst:5334 +#: ../../library/os.rst:5415 msgid "Return the signal which caused the process to stop." msgstr "" -#: ../../library/os.rst:5336 +#: ../../library/os.rst:5417 msgid "This function should be employed only if :func:`WIFSTOPPED` is true." msgstr "" -#: ../../library/os.rst:5343 +#: ../../library/os.rst:5424 msgid "Return the number of the signal that caused the process to terminate." msgstr "" -#: ../../library/os.rst:5351 +#: ../../library/os.rst:5432 msgid "Interface to the scheduler" msgstr "排程器介面" -#: ../../library/os.rst:5353 +#: ../../library/os.rst:5434 msgid "" "These functions control how a process is allocated CPU time by the operating " "system. They are only available on some Unix platforms. For more detailed " "information, consult your Unix manpages." msgstr "" -#: ../../library/os.rst:5359 +#: ../../library/os.rst:5440 msgid "" "The following scheduling policies are exposed if they are supported by the " "operating system." msgstr "" -#: ../../library/os.rst:5366 +#: ../../library/os.rst:5447 msgid "The default scheduling policy." msgstr "" -#: ../../library/os.rst:5370 +#: ../../library/os.rst:5451 msgid "" "Scheduling policy for CPU-intensive processes that tries to preserve " "interactivity on the rest of the computer." msgstr "" -#: ../../library/os.rst:5375 +#: ../../library/os.rst:5456 +msgid "Scheduling policy for tasks with deadline constraints." +msgstr "" + +#: ../../library/os.rst:5462 msgid "Scheduling policy for extremely low priority background tasks." msgstr "" -#: ../../library/os.rst:5379 +#: ../../library/os.rst:5466 +msgid "Alias for :data:`SCHED_OTHER`." +msgstr "" + +#: ../../library/os.rst:5472 msgid "Scheduling policy for sporadic server programs." msgstr "" -#: ../../library/os.rst:5383 +#: ../../library/os.rst:5476 msgid "A First In First Out scheduling policy." msgstr "先進先出排程策略。" -#: ../../library/os.rst:5387 +#: ../../library/os.rst:5480 msgid "A round-robin scheduling policy." msgstr "輪轉排程策略。" -#: ../../library/os.rst:5391 +#: ../../library/os.rst:5484 msgid "" "This flag can be OR'ed with any other scheduling policy. When a process with " "this flag set forks, its child's scheduling policy and priority are reset to " "the default." msgstr "" -#: ../../library/os.rst:5398 +#: ../../library/os.rst:5491 msgid "" -"This class represents tunable scheduling parameters used in :func:" -"`sched_setparam`, :func:`sched_setscheduler`, and :func:`sched_getparam`. It " -"is immutable." +"This class represents tunable scheduling parameters used " +"in :func:`sched_setparam`, :func:`sched_setscheduler`, " +"and :func:`sched_getparam`. It is immutable." msgstr "" -#: ../../library/os.rst:5402 +#: ../../library/os.rst:5495 msgid "At the moment, there is only one possible parameter:" msgstr "" -#: ../../library/os.rst:5406 +#: ../../library/os.rst:5499 msgid "The scheduling priority for a scheduling policy." msgstr "" -#: ../../library/os.rst:5411 +#: ../../library/os.rst:5504 msgid "" "Get the minimum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5417 +#: ../../library/os.rst:5510 msgid "" "Get the maximum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5423 +#: ../../library/os.rst:5516 msgid "" "Set the scheduling policy for the process with PID *pid*. A *pid* of 0 means " "the calling process. *policy* is one of the scheduling policy constants " "above. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5430 +#: ../../library/os.rst:5523 msgid "" "Return the scheduling policy for the process with PID *pid*. A *pid* of 0 " "means the calling process. The result is one of the scheduling policy " "constants above." msgstr "" -#: ../../library/os.rst:5437 +#: ../../library/os.rst:5530 msgid "" "Set the scheduling parameters for the process with PID *pid*. A *pid* of 0 " "means the calling process. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5443 +#: ../../library/os.rst:5536 msgid "" "Return the scheduling parameters as a :class:`sched_param` instance for the " "process with PID *pid*. A *pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5449 +#: ../../library/os.rst:5542 msgid "" "Return the round-robin quantum in seconds for the process with PID *pid*. A " "*pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5455 +#: ../../library/os.rst:5548 msgid "" "Voluntarily relinquish the CPU. See :manpage:`sched_yield(2)` for details." msgstr "" -#: ../../library/os.rst:5460 +#: ../../library/os.rst:5553 msgid "" "Restrict the process with PID *pid* (or the current process if zero) to a " "set of CPUs. *mask* is an iterable of integers representing the set of CPUs " "to which the process should be restricted." msgstr "" -#: ../../library/os.rst:5467 +#: ../../library/os.rst:5560 msgid "Return the set of CPUs the process with PID *pid* is restricted to." msgstr "" -#: ../../library/os.rst:5469 +#: ../../library/os.rst:5562 msgid "" "If *pid* is zero, return the set of CPUs the calling thread of the current " "process is restricted to." msgstr "" -#: ../../library/os.rst:5472 +#: ../../library/os.rst:5565 msgid "See also the :func:`process_cpu_count` function." msgstr "也請見 :func:`process_cpu_count` 函式。" -#: ../../library/os.rst:5478 +#: ../../library/os.rst:5571 msgid "Miscellaneous System Information" msgstr "" -#: ../../library/os.rst:5483 +#: ../../library/os.rst:5576 msgid "" "Return string-valued system configuration values. *name* specifies the " "configuration value to retrieve; it may be a string which is the name of a " @@ -6217,76 +6348,76 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:5491 +#: ../../library/os.rst:5584 msgid "" "If the configuration value specified by *name* isn't defined, ``None`` is " "returned." msgstr "" -#: ../../library/os.rst:5494 +#: ../../library/os.rst:5587 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " -"included in ``confstr_names``, an :exc:`OSError` is raised with :const:" -"`errno.EINVAL` for the error number." +"included in ``confstr_names``, an :exc:`OSError` is raised " +"with :const:`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:5504 +#: ../../library/os.rst:5597 msgid "" "Dictionary mapping names accepted by :func:`confstr` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5513 +#: ../../library/os.rst:5606 msgid "" "Return the number of logical CPUs in the **system**. Returns ``None`` if " "undetermined." msgstr "" -#: ../../library/os.rst:5516 +#: ../../library/os.rst:5609 msgid "" "The :func:`process_cpu_count` function can be used to get the number of " "logical CPUs usable by the calling thread of the **current process**." msgstr "" -#: ../../library/os.rst:5521 +#: ../../library/os.rst:5614 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`cpu_count` returns the overridden value *n*." msgstr "" -#: ../../library/os.rst:5528 +#: ../../library/os.rst:5621 msgid "" "Return the number of processes in the system run queue averaged over the " "last 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was " "unobtainable." msgstr "" -#: ../../library/os.rst:5537 +#: ../../library/os.rst:5630 msgid "" "Get the number of logical CPUs usable by the calling thread of the **current " -"process**. Returns ``None`` if undetermined. It can be less than :func:" -"`cpu_count` depending on the CPU affinity." +"process**. Returns ``None`` if undetermined. It can be less " +"than :func:`cpu_count` depending on the CPU affinity." msgstr "" -#: ../../library/os.rst:5541 +#: ../../library/os.rst:5634 msgid "" "The :func:`cpu_count` function can be used to get the number of logical CPUs " "in the **system**." msgstr "" -#: ../../library/os.rst:5544 +#: ../../library/os.rst:5637 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`process_cpu_count` returns the overridden value *n*." msgstr "" -#: ../../library/os.rst:5547 +#: ../../library/os.rst:5640 msgid "See also the :func:`sched_getaffinity` function." msgstr "也請見 :func:`sched_getaffinity` 函式。" -#: ../../library/os.rst:5554 +#: ../../library/os.rst:5647 msgid "" "Return integer-valued system configuration values. If the configuration " "value specified by *name* isn't defined, ``-1`` is returned. The comments " @@ -6295,53 +6426,53 @@ msgid "" "``sysconf_names``." msgstr "" -#: ../../library/os.rst:5564 +#: ../../library/os.rst:5657 msgid "" "Dictionary mapping names accepted by :func:`sysconf` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5570 +#: ../../library/os.rst:5663 msgid "Add ``'SC_MINSIGSTKSZ'`` name." msgstr "" -#: ../../library/os.rst:5573 +#: ../../library/os.rst:5666 msgid "" "The following data values are used to support path manipulation operations. " "These are defined for all platforms." msgstr "" -#: ../../library/os.rst:5576 +#: ../../library/os.rst:5669 msgid "" "Higher-level operations on pathnames are defined in the :mod:`os.path` " "module." msgstr "" -#: ../../library/os.rst:5582 +#: ../../library/os.rst:5675 msgid "" "The constant string used by the operating system to refer to the current " -"directory. This is ``'.'`` for Windows and POSIX. Also available via :mod:" -"`os.path`." +"directory. This is ``'.'`` for Windows and POSIX. Also available " +"via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5590 +#: ../../library/os.rst:5683 msgid "" "The constant string used by the operating system to refer to the parent " -"directory. This is ``'..'`` for Windows and POSIX. Also available via :mod:" -"`os.path`." +"directory. This is ``'..'`` for Windows and POSIX. Also available " +"via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5599 +#: ../../library/os.rst:5692 msgid "" "The character used by the operating system to separate pathname components. " "This is ``'/'`` for POSIX and ``'\\\\'`` for Windows. Note that knowing " -"this is not sufficient to be able to parse or concatenate pathnames --- use :" -"func:`os.path.split` and :func:`os.path.join` --- but it is occasionally " -"useful. Also available via :mod:`os.path`." +"this is not sufficient to be able to parse or concatenate pathnames --- " +"use :func:`os.path.split` and :func:`os.path.join` --- but it is " +"occasionally useful. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5609 +#: ../../library/os.rst:5702 msgid "" "An alternative character used by the operating system to separate pathname " "components, or ``None`` if only one separator character exists. This is set " @@ -6349,65 +6480,65 @@ msgid "" "via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5618 +#: ../../library/os.rst:5711 msgid "" "The character which separates the base filename from the extension; for " "example, the ``'.'`` in :file:`os.py`. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5626 +#: ../../library/os.rst:5719 msgid "" "The character conventionally used by the operating system to separate search " "path components (as in :envvar:`PATH`), such as ``':'`` for POSIX or ``';'`` " "for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5633 +#: ../../library/os.rst:5726 msgid "" -"The default search path used by :func:`exec\\*p\\* ` and :func:" -"`spawn\\*p\\* ` if the environment doesn't have a ``'PATH'`` key. " -"Also available via :mod:`os.path`." +"The default search path used by :func:`exec\\*p\\* ` " +"and :func:`spawn\\*p\\* ` if the environment doesn't have a " +"``'PATH'`` key. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5640 +#: ../../library/os.rst:5733 msgid "" "The string used to separate (or, rather, terminate) lines on the current " "platform. This may be a single character, such as ``'\\n'`` for POSIX, or " -"multiple characters, for example, ``'\\r\\n'`` for Windows. Do not use *os." -"linesep* as a line terminator when writing files opened in text mode (the " -"default); use a single ``'\\n'`` instead, on all platforms." +"multiple characters, for example, ``'\\r\\n'`` for Windows. Do not use " +"*os.linesep* as a line terminator when writing files opened in text mode " +"(the default); use a single ``'\\n'`` instead, on all platforms." msgstr "" -#: ../../library/os.rst:5649 +#: ../../library/os.rst:5742 msgid "" "The file path of the null device. For example: ``'/dev/null'`` for POSIX, " "``'nul'`` for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5660 +#: ../../library/os.rst:5753 msgid "" -"Flags for use with the :func:`~sys.setdlopenflags` and :func:`~sys." -"getdlopenflags` functions. See the Unix manual page :manpage:`dlopen(3)` " -"for what the different flags mean." +"Flags for use with the :func:`~sys.setdlopenflags` " +"and :func:`~sys.getdlopenflags` functions. See the Unix manual " +"page :manpage:`dlopen(3)` for what the different flags mean." msgstr "" -#: ../../library/os.rst:5668 +#: ../../library/os.rst:5761 msgid "Random numbers" msgstr "" -#: ../../library/os.rst:5673 +#: ../../library/os.rst:5766 msgid "" "Get up to *size* random bytes. The function can return less bytes than " "requested." msgstr "" -#: ../../library/os.rst:5676 +#: ../../library/os.rst:5769 msgid "" "These bytes can be used to seed user-space random number generators or for " "cryptographic purposes." msgstr "" -#: ../../library/os.rst:5679 +#: ../../library/os.rst:5772 msgid "" "``getrandom()`` relies on entropy gathered from device drivers and other " "sources of environmental noise. Unnecessarily reading large quantities of " @@ -6415,32 +6546,32 @@ msgid "" "``/dev/urandom`` devices." msgstr "" -#: ../../library/os.rst:5684 +#: ../../library/os.rst:5777 msgid "" "The flags argument is a bit mask that can contain zero or more of the " -"following values ORed together: :py:const:`os.GRND_RANDOM` and :py:data:" -"`GRND_NONBLOCK`." +"following values ORed together: :py:const:`os.GRND_RANDOM` " +"and :py:data:`GRND_NONBLOCK`." msgstr "" -#: ../../library/os.rst:5688 +#: ../../library/os.rst:5781 msgid "" "See also the `Linux getrandom() manual page `_." msgstr "" -#: ../../library/os.rst:5697 +#: ../../library/os.rst:5790 msgid "" "Return a bytestring of *size* random bytes suitable for cryptographic use." msgstr "" -#: ../../library/os.rst:5699 +#: ../../library/os.rst:5792 msgid "" "This function returns random bytes from an OS-specific randomness source. " "The returned data should be unpredictable enough for cryptographic " "applications, though its exact quality depends on the OS implementation." msgstr "" -#: ../../library/os.rst:5703 +#: ../../library/os.rst:5796 msgid "" "On Linux, if the ``getrandom()`` syscall is available, it is used in " "blocking mode: block until the system urandom entropy pool is initialized " @@ -6450,206 +6581,206 @@ msgid "" "to poll until the system urandom entropy pool is initialized." msgstr "" -#: ../../library/os.rst:5710 +#: ../../library/os.rst:5803 msgid "" "On a Unix-like system, random bytes are read from the ``/dev/urandom`` " "device. If the ``/dev/urandom`` device is not available or not readable, " "the :exc:`NotImplementedError` exception is raised." msgstr "" -#: ../../library/os.rst:5714 +#: ../../library/os.rst:5807 msgid "On Windows, it will use ``BCryptGenRandom()``." msgstr "" -#: ../../library/os.rst:5717 +#: ../../library/os.rst:5810 msgid "" "The :mod:`secrets` module provides higher level functions. For an easy-to-" "use interface to the random number generator provided by your platform, " "please see :class:`random.SystemRandom`." msgstr "" -#: ../../library/os.rst:5721 +#: ../../library/os.rst:5814 msgid "" "On Linux 3.17 and newer, the ``getrandom()`` syscall is now used when " "available. On OpenBSD 5.6 and newer, the C ``getentropy()`` function is now " "used. These functions avoid the usage of an internal file descriptor." msgstr "" -#: ../../library/os.rst:5727 +#: ../../library/os.rst:5820 msgid "" "On Linux, if the ``getrandom()`` syscall blocks (the urandom entropy pool is " "not initialized yet), fall back on reading ``/dev/urandom``." msgstr "" -#: ../../library/os.rst:5731 +#: ../../library/os.rst:5824 msgid "" "On Linux, ``getrandom()`` is now used in blocking mode to increase the " "security." msgstr "" -#: ../../library/os.rst:5735 +#: ../../library/os.rst:5828 msgid "" "On Windows, ``BCryptGenRandom()`` is used instead of ``CryptGenRandom()`` " "which is deprecated." msgstr "" -#: ../../library/os.rst:5741 +#: ../../library/os.rst:5834 msgid "" "By default, when reading from ``/dev/random``, :func:`getrandom` blocks if " "no random bytes are available, and when reading from ``/dev/urandom``, it " "blocks if the entropy pool has not yet been initialized." msgstr "" -#: ../../library/os.rst:5745 +#: ../../library/os.rst:5838 msgid "" "If the :py:data:`GRND_NONBLOCK` flag is set, then :func:`getrandom` does not " "block in these cases, but instead immediately raises :exc:`BlockingIOError`." msgstr "" -#: ../../library/os.rst:5752 +#: ../../library/os.rst:5845 msgid "" "If this bit is set, then random bytes are drawn from the ``/dev/" "random`` pool instead of the ``/dev/urandom`` pool." msgstr "" -#: ../../library/os.rst:364 ../../library/os.rst:530 ../../library/os.rst:732 +#: ../../library/os.rst:386 ../../library/os.rst:552 ../../library/os.rst:756 msgid "user" msgstr "user(使用者)" -#: ../../library/os.rst:364 +#: ../../library/os.rst:386 msgid "effective id" msgstr "" -#: ../../library/os.rst:373 ../../library/os.rst:439 ../../library/os.rst:448 -#: ../../library/os.rst:457 ../../library/os.rst:471 ../../library/os.rst:667 -#: ../../library/os.rst:4524 ../../library/os.rst:4550 +#: ../../library/os.rst:395 ../../library/os.rst:461 ../../library/os.rst:470 +#: ../../library/os.rst:479 ../../library/os.rst:493 ../../library/os.rst:691 +#: ../../library/os.rst:4597 ../../library/os.rst:4623 msgid "process" msgstr "process" -#: ../../library/os.rst:373 ../../library/os.rst:439 +#: ../../library/os.rst:395 ../../library/os.rst:461 msgid "group" msgstr "group(群組)" -#: ../../library/os.rst:448 ../../library/os.rst:530 +#: ../../library/os.rst:470 ../../library/os.rst:552 msgid "id" msgstr "id" -#: ../../library/os.rst:457 +#: ../../library/os.rst:479 msgid "id of parent" msgstr "" -#: ../../library/os.rst:471 ../../library/os.rst:667 +#: ../../library/os.rst:493 ../../library/os.rst:691 msgid "scheduling priority" msgstr "scheduling priority(排程優先權)" -#: ../../library/os.rst:553 ../../library/os.rst:802 +#: ../../library/os.rst:575 ../../library/os.rst:826 msgid "environment variables" msgstr "environment variables(環境變數)" -#: ../../library/os.rst:553 +#: ../../library/os.rst:575 msgid "setting" msgstr "setting(設定)" -#: ../../library/os.rst:732 +#: ../../library/os.rst:756 msgid "id, setting" msgstr "id, setting(設定)" -#: ../../library/os.rst:765 +#: ../../library/os.rst:789 msgid "gethostname() (in module socket)" msgstr "gethostname()(於 socket 模組)" -#: ../../library/os.rst:765 +#: ../../library/os.rst:789 msgid "gethostbyaddr() (in module socket)" msgstr "gethostbyaddr()(於 socket 模組)" -#: ../../library/os.rst:802 ../../library/os.rst:2659 +#: ../../library/os.rst:826 ../../library/os.rst:2732 msgid "deleting" msgstr "deleting(刪除)" -#: ../../library/os.rst:1361 ../../library/os.rst:3029 +#: ../../library/os.rst:1387 ../../library/os.rst:3102 msgid "module" msgstr "module(模組)" -#: ../../library/os.rst:1361 +#: ../../library/os.rst:1387 msgid "pty" msgstr "pty" -#: ../../library/os.rst:2046 ../../library/os.rst:2458 -#: ../../library/os.rst:2659 ../../library/os.rst:3563 -#: ../../library/os.rst:3663 +#: ../../library/os.rst:2118 ../../library/os.rst:2531 +#: ../../library/os.rst:2732 ../../library/os.rst:3636 +#: ../../library/os.rst:3736 msgid "directory" msgstr "directory(目錄)" -#: ../../library/os.rst:2046 +#: ../../library/os.rst:2118 msgid "changing" msgstr "changing(改變)" -#: ../../library/os.rst:2458 +#: ../../library/os.rst:2531 msgid "creating" msgstr "creating(建立)" -#: ../../library/os.rst:2458 +#: ../../library/os.rst:2531 msgid "UNC paths" msgstr "UNC paths(UNC 路徑)" -#: ../../library/os.rst:2458 +#: ../../library/os.rst:2531 msgid "and os.makedirs()" msgstr "以及 os.makedirs()" -#: ../../library/os.rst:3029 +#: ../../library/os.rst:3102 msgid "stat" msgstr "stat" -#: ../../library/os.rst:3563 ../../library/os.rst:3663 +#: ../../library/os.rst:3636 ../../library/os.rst:3736 msgid "walking" msgstr "" -#: ../../library/os.rst:3563 ../../library/os.rst:3663 +#: ../../library/os.rst:3636 ../../library/os.rst:3736 msgid "traversal" msgstr "traversal(遍歷)" -#: ../../library/os.rst:4524 ../../library/os.rst:4550 +#: ../../library/os.rst:4597 ../../library/os.rst:4623 msgid "killing" msgstr "" -#: ../../library/os.rst:4524 ../../library/os.rst:4550 +#: ../../library/os.rst:4597 ../../library/os.rst:4623 msgid "signalling" msgstr "signalling(信號)" -#: ../../library/os.rst:5579 ../../library/os.rst:5615 +#: ../../library/os.rst:5672 ../../library/os.rst:5708 msgid ". (dot)" msgstr ". (點)" -#: ../../library/os.rst:5579 ../../library/os.rst:5587 -#: ../../library/os.rst:5595 ../../library/os.rst:5606 -#: ../../library/os.rst:5615 +#: ../../library/os.rst:5672 ../../library/os.rst:5680 +#: ../../library/os.rst:5688 ../../library/os.rst:5699 +#: ../../library/os.rst:5708 msgid "in pathnames" msgstr "於 pathnames(路徑名稱)中" -#: ../../library/os.rst:5587 +#: ../../library/os.rst:5680 msgid ".." msgstr ".." -#: ../../library/os.rst:5595 ../../library/os.rst:5606 +#: ../../library/os.rst:5688 ../../library/os.rst:5699 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../library/os.rst:5596 +#: ../../library/os.rst:5689 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../library/os.rst:5596 +#: ../../library/os.rst:5689 msgid "in pathnames (Windows)" msgstr "in pathnames (Windows)(在路徑名稱中 (Windows))" -#: ../../library/os.rst:5622 +#: ../../library/os.rst:5715 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/os.rst:5622 +#: ../../library/os.rst:5715 msgid "path separator (POSIX)" msgstr "path separator (POSIX)(路徑分隔器 (POSIX))" -#: ../../library/os.rst:5622 +#: ../../library/os.rst:5715 msgid "; (semicolon)" msgstr "; (分號)" diff --git a/library/pathlib.po b/library/pathlib.po index a9e18733415..cfa4f7c927f 100644 --- a/library/pathlib.po +++ b/library/pathlib.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-09-08 15:25+0800\n" "PO-Revision-Date: 2024-12-23 19:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -76,8 +76,8 @@ msgid "" "You cannot instantiate a :class:`WindowsPath` when running on Unix, but you " "can instantiate :class:`PureWindowsPath`." msgstr "" -"如果你想在 Unix 機器上處理 Windows 路徑(或反過來),你無法在 Unix 上實例化 :" -"class:`WindowsPath`,但你可以實例化 :class:`PureWindowsPath`。" +"如果你想在 Unix 機器上處理 Windows 路徑(或反過來),你無法在 Unix 上實例" +"化 :class:`WindowsPath`,但你可以實例化 :class:`PureWindowsPath`。" #: ../../library/pathlib.rst:40 msgid "" @@ -94,8 +94,8 @@ msgstr ":pep:`428`:pathlib 模組 -- 物件導向檔案系統路徑。" #: ../../library/pathlib.rst:48 msgid "" -"For low-level path manipulation on strings, you can also use the :mod:`os." -"path` module." +"For low-level path manipulation on strings, you can also use " +"the :mod:`os.path` module." msgstr "針對字串上的底層路徑操作,你也可以使用 :mod:`os.path` 模組。" #: ../../library/pathlib.rst:53 @@ -222,8 +222,8 @@ msgid "" "A generic class that represents the system's path flavour (instantiating it " "creates either a :class:`PurePosixPath` or a :class:`PureWindowsPath`)::" msgstr "" -"一個通用的類別,表示系統的路徑類型(實例化時會建立一個 :class:" -"`PurePosixPath` 或 :class:`PureWindowsPath`): ::" +"一個通用的類別,表示系統的路徑類型(實例化時會建立一" +"個 :class:`PurePosixPath` 或 :class:`PureWindowsPath`): ::" #: ../../library/pathlib.rst:121 msgid "" @@ -241,8 +241,8 @@ msgid "" "path object::" msgstr "" "*pathsegments* 中的每個元素可以是以下的其中一種:一個表示路徑片段的字串,或一" -"個物件,它實作了 :class:`os.PathLike` 介面且其中的 :meth:`~os.PathLike." -"__fspath__` 方法會回傳字串,就像是另一個路徑物件: ::" +"個物件,它實作了 :class:`os.PathLike` 介面且其中" +"的 :meth:`~os.PathLike.__fspath__` 方法會回傳字串,就像是另一個路徑物件: ::" #: ../../library/pathlib.rst:129 msgid "" @@ -270,11 +270,11 @@ msgstr "" #: ../../library/pathlib.rst:139 msgid "" -"If a segment is an absolute path, all previous segments are ignored (like :" -"func:`os.path.join`)::" +"If a segment is an absolute path, all previous segments are ignored " +"(like :func:`os.path.join`)::" msgstr "" -"如果一個片段是絕對路徑,則所有之前的片段會被忽略(類似 :func:`os.path." -"join`): ::" +"如果一個片段是絕對路徑,則所有之前的片段會被忽略(類" +"似 :func:`os.path.join`): ::" #: ../../library/pathlib.rst:142 msgid "" @@ -290,8 +290,8 @@ msgstr "" #: ../../library/pathlib.rst:147 msgid "" -"On Windows, the drive is not reset when a rooted relative path segment (e." -"g., ``r'\\foo'``) is encountered::" +"On Windows, the drive is not reset when a rooted relative path segment " +"(e.g., ``r'\\foo'``) is encountered::" msgstr "" "在 Windows 系統上,當遇到具有根目錄的相對路徑片段(例如 ``r'\\foo'``)時,磁" "碟機 (drive) 部分不會被重置: ::" @@ -371,8 +371,8 @@ msgstr "" "PurePosixPath('/etc/hosts')" #: ../../library/pathlib.rst:184 ../../library/pathlib.rst:196 -#: ../../library/pathlib.rst:766 ../../library/pathlib.rst:776 -#: ../../library/pathlib.rst:791 +#: ../../library/pathlib.rst:779 ../../library/pathlib.rst:789 +#: ../../library/pathlib.rst:804 msgid "*pathsegments* is specified similarly to :class:`PurePath`." msgstr "*pathsegments* 的指定方式與 :class:`PurePath` 類似。" @@ -504,8 +504,8 @@ msgstr "" #: ../../library/pathlib.rst:251 msgid "" -"A path object can be used anywhere an object implementing :class:`os." -"PathLike` is accepted::" +"A path object can be used anywhere an object " +"implementing :class:`os.PathLike` is accepted::" msgstr "" "路徑物件可以被用在任何可以接受實作 :class:`os.PathLike` 的物件的地方: ::" @@ -690,8 +690,8 @@ msgstr "" #: ../../library/pathlib.rst:350 msgid "" -"If the path starts with more than two successive slashes, :class:`~pathlib." -"PurePosixPath` collapses them::" +"If the path starts with more than two successive " +"slashes, :class:`~pathlib.PurePosixPath` collapses them::" msgstr "" "如果路徑以超過兩個連續的斜線開頭,:class:`~pathlib.PurePosixPath` 會合併它" "們: ::" @@ -715,12 +715,12 @@ msgstr "" #: ../../library/pathlib.rst:362 msgid "" "This behavior conforms to *The Open Group Base Specifications Issue 6*, " -"paragraph `4.11 Pathname Resolution `_:" +"paragraph `4.11 Pathname Resolution `_:" msgstr "" "此行為符合 *The Open Group Base Specifications Issue 6*,章節 `4.11 路徑名稱" -"解析 `_:" +"解析 `_:" #: ../../library/pathlib.rst:366 msgid "" @@ -897,11 +897,15 @@ msgstr "" msgid "This is commonly called the file extension." msgstr "這通常被稱為檔案副檔名。" -#: ../../library/pathlib.rst:460 +#: ../../library/pathlib.rst:460 ../../library/pathlib.rst:475 +msgid "A single dot (\"``.``\") is considered a valid suffix." +msgstr "" + +#: ../../library/pathlib.rst:464 msgid "A list of the path's suffixes, often called file extensions::" msgstr "一個路徑後綴 (suffix) 的串列,通常被稱為檔案副檔名: ::" -#: ../../library/pathlib.rst:462 +#: ../../library/pathlib.rst:466 msgid "" ">>> PurePosixPath('my/library.tar.gar').suffixes\n" "['.tar', '.gar']\n" @@ -917,11 +921,11 @@ msgstr "" ">>> PurePosixPath('my/library').suffixes\n" "[]" -#: ../../library/pathlib.rst:472 +#: ../../library/pathlib.rst:480 msgid "The final path component, without its suffix::" msgstr "最後的路徑組成,不包括後綴: ::" -#: ../../library/pathlib.rst:474 +#: ../../library/pathlib.rst:482 msgid "" ">>> PurePosixPath('my/library.tar.gz').stem\n" "'library.tar'\n" @@ -937,12 +941,12 @@ msgstr "" ">>> PurePosixPath('my/library').stem\n" "'library'" -#: ../../library/pathlib.rst:484 +#: ../../library/pathlib.rst:492 msgid "" "Return a string representation of the path with forward slashes (``/``)::" msgstr "回傳一個使用正斜線 (``/``) 的路徑的字串表示: ::" -#: ../../library/pathlib.rst:486 +#: ../../library/pathlib.rst:494 msgid "" ">>> p = PureWindowsPath('c:\\\\windows')\n" ">>> str(p)\n" @@ -956,7 +960,7 @@ msgstr "" ">>> p.as_posix()\n" "'c:/windows'" -#: ../../library/pathlib.rst:495 +#: ../../library/pathlib.rst:503 msgid "" "Return whether the path is absolute or not. A path is considered absolute " "if it has both a root and (if the flavour allows) a drive::" @@ -964,7 +968,7 @@ msgstr "" "回傳一個路徑是否是絕對路徑。一個路徑被視為絕對路徑的條件是它同時有根目錄及" "(如果該系統類型允許的話)磁碟機: ::" -#: ../../library/pathlib.rst:498 +#: ../../library/pathlib.rst:506 msgid "" ">>> PurePosixPath('/a/b').is_absolute()\n" "True\n" @@ -994,11 +998,11 @@ msgstr "" ">>> PureWindowsPath('//some/share').is_absolute()\n" "True" -#: ../../library/pathlib.rst:515 +#: ../../library/pathlib.rst:523 msgid "Return whether or not this path is relative to the *other* path." msgstr "回傳此路徑是否為 *other* 路徑的相對路徑。" -#: ../../library/pathlib.rst:523 +#: ../../library/pathlib.rst:531 msgid "" "This method is string-based; it neither accesses the filesystem nor treats " "\"``..``\" segments specially. The following code is equivalent:" @@ -1006,13 +1010,13 @@ msgstr "" "該方法是基於字串的;它既不存取檔案系統,也不特別處理 \"``..``\" 片段。以下程" "式碼是等效的:" -#: ../../library/pathlib.rst:534 +#: ../../library/pathlib.rst:542 msgid "" "Passing additional arguments is deprecated; if supplied, they are joined " "with *other*." msgstr "額外引數的傳入已棄用;如果有的話,它們會與 *other* 連接在一起。" -#: ../../library/pathlib.rst:539 +#: ../../library/pathlib.rst:547 msgid "" "With :class:`PureWindowsPath`, return ``True`` if the path is considered " "reserved under Windows, ``False`` otherwise. With :class:`PurePosixPath`, " @@ -1022,7 +1026,7 @@ msgstr "" "``True``,否則回傳 ``False``。對 :class:`PurePosixPath` 來說,總是回傳 " "``False``。" -#: ../../library/pathlib.rst:543 +#: ../../library/pathlib.rst:551 msgid "" "Windows path names that contain a colon, or end with a dot or a space, are " "considered reserved. UNC paths may be reserved." @@ -1030,7 +1034,7 @@ msgstr "" "Windows 路徑名稱中包含冒號或結尾為點或空格會被視為保留。UNC 路徑可能被視為保" "留。" -#: ../../library/pathlib.rst:547 +#: ../../library/pathlib.rst:555 msgid "" "This method is deprecated; use :func:`os.path.isreserved` to detect reserved " "paths on Windows." @@ -1038,13 +1042,13 @@ msgstr "" "此方法已被棄用;請使用 :func:`os.path.isreserved` 來檢測 Windows 上的保留路" "徑。" -#: ../../library/pathlib.rst:553 +#: ../../library/pathlib.rst:561 msgid "" "Calling this method is equivalent to combining the path with each of the " "given *pathsegments* in turn::" msgstr "呼叫此方法會依序結合每個所給定的 *pathsegments* 到路徑上: ::" -#: ../../library/pathlib.rst:556 +#: ../../library/pathlib.rst:564 msgid "" ">>> PurePosixPath('/etc').joinpath('passwd')\n" "PurePosixPath('/etc/passwd')\n" @@ -1064,7 +1068,7 @@ msgstr "" ">>> PureWindowsPath('c:').joinpath('/Program Files')\n" "PureWindowsPath('c:/Program Files')" -#: ../../library/pathlib.rst:568 +#: ../../library/pathlib.rst:576 msgid "" "Match this path against the provided glob-style pattern. Return ``True`` if " "matching is successful, ``False`` otherwise. For example::" @@ -1072,7 +1076,7 @@ msgstr "" "將路徑與 glob 形式的模式 (glob-style pattern) 做比對。如果比對成功則回傳 " "``True``,否則回傳 ``False``,例如: ::" -#: ../../library/pathlib.rst:571 +#: ../../library/pathlib.rst:579 msgid "" ">>> PurePath('a/b.py').full_match('a/*.py')\n" "True\n" @@ -1092,15 +1096,15 @@ msgstr "" ">>> PurePath('/a/b/c.py').full_match('**/*.py')\n" "True" -#: ../../library/pathlib.rst:581 ../../library/pathlib.rst:1291 +#: ../../library/pathlib.rst:589 ../../library/pathlib.rst:1349 msgid ":ref:`pathlib-pattern-language` documentation." msgstr ":ref:`pathlib-pattern-language` 文件。" -#: ../../library/pathlib.rst:583 +#: ../../library/pathlib.rst:591 msgid "As with other methods, case-sensitivity follows platform defaults::" msgstr "像其它方法一樣,是否區分大小寫會遵循平台的預設行為: ::" -#: ../../library/pathlib.rst:585 +#: ../../library/pathlib.rst:593 msgid "" ">>> PurePosixPath('b.py').full_match('*.PY')\n" "False\n" @@ -1112,12 +1116,12 @@ msgstr "" ">>> PureWindowsPath('b.py').full_match('*.PY')\n" "True" -#: ../../library/pathlib.rst:590 +#: ../../library/pathlib.rst:598 msgid "" "Set *case_sensitive* to ``True`` or ``False`` to override this behaviour." msgstr "將 *case_sensitive* 設定成 ``True`` 或 ``False`` 會覆蓋這個行為。" -#: ../../library/pathlib.rst:597 +#: ../../library/pathlib.rst:605 msgid "" "Match this path against the provided non-recursive glob-style pattern. " "Return ``True`` if matching is successful, ``False`` otherwise." @@ -1125,18 +1129,18 @@ msgstr "" "將路徑與非遞迴 glob 形式的模式 (glob-style pattern) 做比對。如果比對成功則回" "傳 ``True``,否則回傳 ``False``。" -#: ../../library/pathlib.rst:600 +#: ../../library/pathlib.rst:608 msgid "" "This method is similar to :meth:`~PurePath.full_match`, but empty patterns " "aren't allowed (:exc:`ValueError` is raised), the recursive wildcard " "\"``**``\" isn't supported (it acts like non-recursive \"``*``\"), and if a " "relative pattern is provided, then matching is done from the right::" msgstr "" -"此方法類似於 :meth:`~PurePath.full_match`,但不允許空白模式(會引發 :exc:" -"`ValueError`)、不支援遞迴萬用字元 \"``**``\"(它會像非遞迴的 \"``*``\" 一" -"樣),且如果提供相對模式,則會從右邊進行比對: ::" +"此方法類似於 :meth:`~PurePath.full_match`,但不允許空白模式(會引" +"發 :exc:`ValueError`)、不支援遞迴萬用字元 \"``**``\"(它會像非遞迴的 " +"\"``*``\" 一樣),且如果提供相對模式,則會從右邊進行比對: ::" -#: ../../library/pathlib.rst:605 +#: ../../library/pathlib.rst:613 msgid "" ">>> PurePath('a/b.py').match('*.py')\n" "True\n" @@ -1152,25 +1156,25 @@ msgstr "" ">>> PurePath('/a/b/c.py').match('a/*.py')\n" "False" -#: ../../library/pathlib.rst:612 ../../library/pathlib.rst:1310 -#: ../../library/pathlib.rst:1335 +#: ../../library/pathlib.rst:620 ../../library/pathlib.rst:1368 +#: ../../library/pathlib.rst:1393 msgid "The *pattern* parameter accepts a :term:`path-like object`." msgstr "*pattern* 參數接受\\ :term:`類路徑物件 `。" -#: ../../library/pathlib.rst:615 ../../library/pathlib.rst:1304 -#: ../../library/pathlib.rst:1329 +#: ../../library/pathlib.rst:623 ../../library/pathlib.rst:1362 +#: ../../library/pathlib.rst:1387 msgid "The *case_sensitive* parameter was added." msgstr "新增 *case_sensitive* 參數。" -#: ../../library/pathlib.rst:621 +#: ../../library/pathlib.rst:629 msgid "" "Compute a version of this path relative to the path represented by *other*. " "If it's impossible, :exc:`ValueError` is raised::" msgstr "" -"計算這個路徑相對於 *other* 所表示路徑的版本。如果做不到會引發 :exc:" -"`ValueError`: ::" +"計算這個路徑相對於 *other* 所表示路徑的版本。如果做不到會引" +"發 :exc:`ValueError`: ::" -#: ../../library/pathlib.rst:624 +#: ../../library/pathlib.rst:632 msgid "" ">>> p = PurePosixPath('/etc/passwd')\n" ">>> p.relative_to('/')\n" @@ -1198,18 +1202,18 @@ msgstr "" "ValueError: '/etc/passwd' is not in the subpath of '/usr' OR one path is " "relative and the other is absolute." -#: ../../library/pathlib.rst:636 +#: ../../library/pathlib.rst:644 msgid "" "When *walk_up* is false (the default), the path must start with *other*. " "When the argument is true, ``..`` entries may be added to form the relative " -"path. In all other cases, such as the paths referencing different drives, :" -"exc:`ValueError` is raised.::" +"path. In all other cases, such as the paths referencing different " +"drives, :exc:`ValueError` is raised.::" msgstr "" "當 *walk_up* 是 False(預設值),路徑必須以 *other* 為開始。當此引數是 True," "可能會加入 ``..`` 以組成相對路徑。在其他情況下,例如路徑參考到不同的磁碟機," "則會引發 :exc:`ValueError`: ::" -#: ../../library/pathlib.rst:641 +#: ../../library/pathlib.rst:649 msgid "" ">>> p.relative_to('/usr', walk_up=True)\n" "PurePosixPath('../etc/passwd')\n" @@ -1231,7 +1235,7 @@ msgstr "" "ValueError: '/etc/passwd' is not on the same drive as 'foo' OR one path is " "relative and the other is absolute." -#: ../../library/pathlib.rst:651 +#: ../../library/pathlib.rst:659 msgid "" "This function is part of :class:`PurePath` and works with strings. It does " "not check or access the underlying file structure. This can impact the " @@ -1242,19 +1246,19 @@ msgstr "" "的檔案架構。這會影響到 *walk_up* 選項,因為它假設路徑中沒有符號連結;如果需要" "解析符號連結的話可以先呼叫 :meth:`~Path.resolve`。" -#: ../../library/pathlib.rst:657 +#: ../../library/pathlib.rst:665 msgid "" "The *walk_up* parameter was added (old behavior is the same as " "``walk_up=False``)." msgstr "加入 *walk_up* 參數(舊的行為和 ``walk_up=False`` 相同)。" -#: ../../library/pathlib.rst:662 +#: ../../library/pathlib.rst:670 msgid "" "Passing additional positional arguments is deprecated; if supplied, they are " "joined with *other*." msgstr "額外位置引數的傳入已棄用;如果有的話,它們會與 *other* 連接在一起。" -#: ../../library/pathlib.rst:667 +#: ../../library/pathlib.rst:675 msgid "" "Return a new path with the :attr:`name` changed. If the original path " "doesn't have a name, ValueError is raised::" @@ -1262,7 +1266,7 @@ msgstr "" "回傳一個修改 :attr:`name` 後的新路徑。如果原始路徑沒有名稱則引發 " "ValueError: ::" -#: ../../library/pathlib.rst:670 +#: ../../library/pathlib.rst:678 msgid "" ">>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')\n" ">>> p.with_name('setup.py')\n" @@ -1288,7 +1292,7 @@ msgstr "" " raise ValueError(\"%r has an empty name\" % (self,))\n" "ValueError: PureWindowsPath('c:/') has an empty name" -#: ../../library/pathlib.rst:684 +#: ../../library/pathlib.rst:692 msgid "" "Return a new path with the :attr:`stem` changed. If the original path " "doesn't have a name, ValueError is raised::" @@ -1296,7 +1300,7 @@ msgstr "" "回傳一個修改 :attr:`stem` 後的新路徑。如果原始路徑沒有名稱則引發 " "ValueError: ::" -#: ../../library/pathlib.rst:687 +#: ../../library/pathlib.rst:695 msgid "" ">>> p = PureWindowsPath('c:/Downloads/draft.txt')\n" ">>> p.with_stem('final')\n" @@ -1334,7 +1338,7 @@ msgstr "" " raise ValueError(\"%r has an empty name\" % (self,))\n" "ValueError: PureWindowsPath('c:/') has an empty name" -#: ../../library/pathlib.rst:708 +#: ../../library/pathlib.rst:716 msgid "" "Return a new path with the :attr:`suffix` changed. If the original path " "doesn't have a suffix, the new *suffix* is appended instead. If the " @@ -1343,7 +1347,7 @@ msgstr "" "回傳一個修改 :attr:`suffix` 後的新路徑。如果原始路徑沒有後綴,新的 *suffix* " "會附加在後面。如果 *suffix* 是一個空字串,原來的後綴會被移除: ::" -#: ../../library/pathlib.rst:712 +#: ../../library/pathlib.rst:720 msgid "" ">>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')\n" ">>> p.with_suffix('.bz2')\n" @@ -1365,7 +1369,13 @@ msgstr "" ">>> p.with_suffix('')\n" "PureWindowsPath('README')" -#: ../../library/pathlib.rst:725 +#: ../../library/pathlib.rst:732 +msgid "" +"A single dot (\"``.``\") is considered a valid suffix. In previous " +"versions, :exc:`ValueError` is raised if a single dot is supplied." +msgstr "" + +#: ../../library/pathlib.rst:738 msgid "" "Create a new path object of the same type by combining the given " "*pathsegments*. This method is called whenever a derivative path is created, " @@ -1376,7 +1386,7 @@ msgstr "" "建立的時候會呼叫這個方法,例如從 :attr:`parent` 和 :meth:`relative_to` 建立衍" "生路徑。子類別可以覆寫此方法來傳遞資訊給衍生路徑,例如: ::" -#: ../../library/pathlib.rst:730 +#: ../../library/pathlib.rst:743 msgid "" "from pathlib import PurePosixPath\n" "\n" @@ -1406,11 +1416,11 @@ msgstr "" "hosts = etc / 'hosts'\n" "print(hosts.session_id) # 42" -#: ../../library/pathlib.rst:751 +#: ../../library/pathlib.rst:764 msgid "Concrete paths" msgstr "實體路徑" -#: ../../library/pathlib.rst:753 +#: ../../library/pathlib.rst:766 msgid "" "Concrete paths are subclasses of the pure path classes. In addition to " "operations provided by the latter, they also provide methods to do system " @@ -1419,7 +1429,7 @@ msgstr "" "實體路徑是純路徑類別的子類別。除了後者本來就有提供的操作,它們也提供方法可以" "對路徑物件做系統呼叫。有三種方式可以實例化實體路徑:" -#: ../../library/pathlib.rst:759 +#: ../../library/pathlib.rst:772 msgid "" "A subclass of :class:`PurePath`, this class represents concrete paths of the " "system's path flavour (instantiating it creates either a :class:`PosixPath` " @@ -1428,7 +1438,7 @@ msgstr "" ":class:`PurePath` 的子類別,此類別表示系統的路徑類型的實體路徑(實例化時會建" "立一個 :class:`PosixPath` 或 :class:`WindowsPath`): ::" -#: ../../library/pathlib.rst:763 +#: ../../library/pathlib.rst:776 msgid "" ">>> Path('setup.py')\n" "PosixPath('setup.py')" @@ -1436,7 +1446,7 @@ msgstr "" ">>> Path('setup.py')\n" "PosixPath('setup.py')" -#: ../../library/pathlib.rst:770 +#: ../../library/pathlib.rst:783 msgid "" "A subclass of :class:`Path` and :class:`PurePosixPath`, this class " "represents concrete non-Windows filesystem paths::" @@ -1444,7 +1454,7 @@ msgstr "" ":class:`Path` 和 :class:`PurePosixPath` 的子類別,此類別表示實體非 Windows 檔" "案系統路徑: ::" -#: ../../library/pathlib.rst:773 +#: ../../library/pathlib.rst:786 msgid "" ">>> PosixPath('/etc/hosts')\n" "PosixPath('/etc/hosts')" @@ -1452,15 +1462,15 @@ msgstr "" ">>> PosixPath('/etc/hosts')\n" "PosixPath('/etc/hosts')" -#: ../../library/pathlib.rst:778 +#: ../../library/pathlib.rst:791 msgid "" -"Raises :exc:`UnsupportedOperation` on Windows. In previous versions, :exc:" -"`NotImplementedError` was raised instead." +"Raises :exc:`UnsupportedOperation` on Windows. In previous " +"versions, :exc:`NotImplementedError` was raised instead." msgstr "" -"在 Windows 上會引發 :exc:`UnsupportedOperation`。在先前版本中,則是引發 :exc:" -"`NotImplementedError`。" +"在 Windows 上會引發 :exc:`UnsupportedOperation`。在先前版本中,則是引" +"發 :exc:`NotImplementedError`。" -#: ../../library/pathlib.rst:785 +#: ../../library/pathlib.rst:798 msgid "" "A subclass of :class:`Path` and :class:`PureWindowsPath`, this class " "represents concrete Windows filesystem paths::" @@ -1468,7 +1478,7 @@ msgstr "" ":class:`Path` 和 :class:`PureWindowsPath` 的子類別,此類別表示實體 Windows 檔" "案系統路徑: ::" -#: ../../library/pathlib.rst:788 +#: ../../library/pathlib.rst:801 msgid "" ">>> WindowsPath('c:/', 'Users', 'Ximénez')\n" "WindowsPath('c:/Users/Ximénez')" @@ -1476,7 +1486,7 @@ msgstr "" ">>> WindowsPath('c:/', 'Users', 'Ximénez')\n" "WindowsPath('c:/Users/Ximénez')" -#: ../../library/pathlib.rst:793 +#: ../../library/pathlib.rst:806 msgid "" "Raises :exc:`UnsupportedOperation` on non-Windows platforms. In previous " "versions, :exc:`NotImplementedError` was raised instead." @@ -1484,7 +1494,7 @@ msgstr "" "在非 Windows 平台上會引發 :exc:`UnsupportedOperation`。在先前版本中,則是引" "發 :exc:`NotImplementedError`。" -#: ../../library/pathlib.rst:798 +#: ../../library/pathlib.rst:811 msgid "" "You can only instantiate the class flavour that corresponds to your system " "(allowing system calls on non-compatible path flavours could lead to bugs or " @@ -1493,7 +1503,7 @@ msgstr "" "你只能實例化對應你的系統的類別類型(允許在不相容的路徑類型上做系統呼叫可能在" "你的應用程式導致漏洞或故障): ::" -#: ../../library/pathlib.rst:802 +#: ../../library/pathlib.rst:815 msgid "" ">>> import os\n" ">>> os.name\n" @@ -1523,18 +1533,18 @@ msgstr "" " % (cls.__name__,))\n" "UnsupportedOperation: cannot instantiate 'WindowsPath' on your system" -#: ../../library/pathlib.rst:816 +#: ../../library/pathlib.rst:829 msgid "" "Some concrete path methods can raise an :exc:`OSError` if a system call " "fails (for example because the path doesn't exist)." msgstr "" "有些實體路徑方法會在系統呼叫失敗(例如因為路徑不存在)時引發 :exc:`OSError`。" -#: ../../library/pathlib.rst:821 +#: ../../library/pathlib.rst:834 msgid "Parsing and generating URIs" msgstr "剖析和產生 URI" -#: ../../library/pathlib.rst:823 +#: ../../library/pathlib.rst:836 msgid "" "Concrete path objects can be created from, and represented as, 'file' URIs " "conforming to :rfc:`8089`." @@ -1542,7 +1552,7 @@ msgstr "" "實體路徑物件可以從符合 :rfc:`8089` 中的 'file' URI 建立,也可以以該形式來表" "示。" -#: ../../library/pathlib.rst:828 +#: ../../library/pathlib.rst:841 msgid "" "File URIs are not portable across machines with different :ref:`filesystem " "encodings `." @@ -1550,11 +1560,11 @@ msgstr "" "檔案 URI 在跨不同\\ :ref:`檔案系統編碼 `\\ 的機器上是無" "法移植的。" -#: ../../library/pathlib.rst:833 +#: ../../library/pathlib.rst:846 msgid "Return a new path object from parsing a 'file' URI. For example::" msgstr "從剖析 'file' URI 回傳新的路徑物件。例如: ::" -#: ../../library/pathlib.rst:835 +#: ../../library/pathlib.rst:848 msgid "" ">>> p = Path.from_uri('file:///etc/hosts')\n" "PosixPath('/etc/hosts')" @@ -1562,11 +1572,11 @@ msgstr "" ">>> p = Path.from_uri('file:///etc/hosts')\n" "PosixPath('/etc/hosts')" -#: ../../library/pathlib.rst:838 +#: ../../library/pathlib.rst:851 msgid "On Windows, DOS device and UNC paths may be parsed from URIs::" msgstr "在 Windows 上,從 URI 可以剖析 DOS 裝置和 UNC 路徑: ::" -#: ../../library/pathlib.rst:840 +#: ../../library/pathlib.rst:853 msgid "" ">>> p = Path.from_uri('file:///c:/windows')\n" "WindowsPath('c:/windows')\n" @@ -1578,11 +1588,11 @@ msgstr "" ">>> p = Path.from_uri('file://server/share')\n" "WindowsPath('//server/share')" -#: ../../library/pathlib.rst:845 +#: ../../library/pathlib.rst:858 msgid "Several variant forms are supported::" msgstr "支援多種變形: ::" -#: ../../library/pathlib.rst:847 +#: ../../library/pathlib.rst:860 msgid "" ">>> p = Path.from_uri('file:////server/share')\n" "WindowsPath('//server/share')\n" @@ -1602,22 +1612,29 @@ msgstr "" ">>> p = Path.from_uri('file:/c|/windows')\n" "WindowsPath('c:/windows')" -#: ../../library/pathlib.rst:856 +#: ../../library/pathlib.rst:869 msgid "" ":exc:`ValueError` is raised if the URI does not start with ``file:``, or the " "parsed path isn't absolute." msgstr "" -"如果 URI 不是 ``file:`` 開頭,或是剖析後的路徑不是絕對路徑,則會引發 :exc:" -"`ValueError`。" +"如果 URI 不是 ``file:`` 開頭,或是剖析後的路徑不是絕對路徑,則會引" +"發 :exc:`ValueError`。" -#: ../../library/pathlib.rst:864 +#: ../../library/pathlib.rst:874 +msgid "" +"The URL authority is discarded if it matches the local hostname. Otherwise, " +"if the authority isn't empty or ``localhost``, then on Windows a UNC path is " +"returned (as before), and on other platforms a :exc:`ValueError` is raised." +msgstr "" + +#: ../../library/pathlib.rst:883 msgid "" "Represent the path as a 'file' URI. :exc:`ValueError` is raised if the path " "isn't absolute." msgstr "" "以 'file' URI 來表示路徑。如果路徑不是絕對的則會引發 :exc:`ValueError`。" -#: ../../library/pathlib.rst:867 +#: ../../library/pathlib.rst:886 msgid "" ">>> p = PosixPath('/etc/passwd')\n" ">>> p.as_uri()\n" @@ -1633,28 +1650,31 @@ msgstr "" ">>> p.as_uri()\n" "'file:///c:/Windows'" -#: ../../library/pathlib.rst:876 +#: ../../library/pathlib.rst:897 +#, fuzzy msgid "" -"For historical reasons, this method is also available from :class:`PurePath` " -"objects. However, its use of :func:`os.fsencode` makes it strictly impure." +"Calling this method from :class:`PurePath` rather than :class:`Path` is " +"possible but deprecated. The method's use of :func:`os.fsencode` makes it " +"strictly impure." msgstr "" -"因為歷史上的原因,此方法也可以從 :class:`PurePath` 物件上使用。然而,它使用 :" -"func:`os.fsencode` 而讓它完全不純粹。" +"因為歷史上的原因,此方法也可以從 :class:`PurePath` 物件上使用。然而,它使" +"用 :func:`os.fsencode` 而讓它完全不純粹。" -#: ../../library/pathlib.rst:882 +#: ../../library/pathlib.rst:903 msgid "Expanding and resolving paths" msgstr "擴展和解析路徑" -#: ../../library/pathlib.rst:886 +#: ../../library/pathlib.rst:907 msgid "" "Return a new path object representing the user's home directory (as returned " "by :func:`os.path.expanduser` with ``~`` construct). If the home directory " "can't be resolved, :exc:`RuntimeError` is raised." msgstr "" -"回傳一個代表使用者家目錄的新的路徑物件(像以 ``~`` 構成的 :func:`os.path." -"expanduser` 的回傳一樣)。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" +"回傳一個代表使用者家目錄的新的路徑物件(像以 ``~`` 構成" +"的 :func:`os.path.expanduser` 的回傳一樣)。如果無法解析家目錄,會引" +"發 :exc:`RuntimeError`。" -#: ../../library/pathlib.rst:892 +#: ../../library/pathlib.rst:913 msgid "" ">>> Path.home()\n" "PosixPath('/home/antoine')" @@ -1662,16 +1682,16 @@ msgstr "" ">>> Path.home()\n" "PosixPath('/home/antoine')" -#: ../../library/pathlib.rst:900 +#: ../../library/pathlib.rst:921 msgid "" "Return a new path with expanded ``~`` and ``~user`` constructs, as returned " -"by :meth:`os.path.expanduser`. If a home directory can't be resolved, :exc:" -"`RuntimeError` is raised." +"by :meth:`os.path.expanduser`. If a home directory can't be " +"resolved, :exc:`RuntimeError` is raised." msgstr "" "回傳一個展開 ``~`` 和 ``~user`` 構成的新路徑,像 :meth:`os.path.expanduser` " "回傳的一樣。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" -#: ../../library/pathlib.rst:906 +#: ../../library/pathlib.rst:927 msgid "" ">>> p = PosixPath('~/films/Monty Python')\n" ">>> p.expanduser()\n" @@ -1681,14 +1701,14 @@ msgstr "" ">>> p.expanduser()\n" "PosixPath('/home/eric/films/Monty Python')" -#: ../../library/pathlib.rst:915 +#: ../../library/pathlib.rst:936 msgid "" -"Return a new path object representing the current directory (as returned by :" -"func:`os.getcwd`)::" +"Return a new path object representing the current directory (as returned " +"by :func:`os.getcwd`)::" msgstr "" "回傳一個代表目前目錄的新的路徑物件(像 :func:`os.getcwd` 回傳的一樣): ::" -#: ../../library/pathlib.rst:918 +#: ../../library/pathlib.rst:939 msgid "" ">>> Path.cwd()\n" "PosixPath('/home/antoine/pathlib')" @@ -1696,14 +1716,14 @@ msgstr "" ">>> Path.cwd()\n" "PosixPath('/home/antoine/pathlib')" -#: ../../library/pathlib.rst:924 +#: ../../library/pathlib.rst:945 msgid "" "Make the path absolute, without normalization or resolving symlinks. Returns " "a new path object::" msgstr "" "將路徑轉換為絕對路徑,不進行標準化或解析符號連結。回傳一個新的路徑物件: ::" -#: ../../library/pathlib.rst:927 +#: ../../library/pathlib.rst:948 msgid "" ">>> p = Path('tests')\n" ">>> p\n" @@ -1717,13 +1737,13 @@ msgstr "" ">>> p.absolute()\n" "PosixPath('/home/antoine/pathlib/tests')" -#: ../../library/pathlib.rst:936 +#: ../../library/pathlib.rst:957 msgid "" "Make the path absolute, resolving any symlinks. A new path object is " "returned::" msgstr "將路徑轉換為絕對路徑,解析所有符號連結。回傳一個新的路徑物件: ::" -#: ../../library/pathlib.rst:939 +#: ../../library/pathlib.rst:960 msgid "" ">>> p = Path()\n" ">>> p\n" @@ -1737,13 +1757,13 @@ msgstr "" ">>> p.resolve()\n" "PosixPath('/home/antoine/pathlib')" -#: ../../library/pathlib.rst:945 +#: ../../library/pathlib.rst:966 msgid "" "\"``..``\" components are also eliminated (this is the only method to do " "so)::" msgstr "同時也會消除 \"``..``\" 的路徑組成(只有此方法這樣做): ::" -#: ../../library/pathlib.rst:947 +#: ../../library/pathlib.rst:968 msgid "" ">>> p = Path('docs/../setup.py')\n" ">>> p.resolve()\n" @@ -1753,22 +1773,22 @@ msgstr "" ">>> p.resolve()\n" "PosixPath('/home/antoine/pathlib/setup.py')" -#: ../../library/pathlib.rst:951 +#: ../../library/pathlib.rst:972 msgid "" "If a path doesn't exist or a symlink loop is encountered, and *strict* is " "``True``, :exc:`OSError` is raised. If *strict* is ``False``, the path is " "resolved as far as possible and any remainder is appended without checking " "whether it exists." msgstr "" -"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引發 :exc:" -"`OSError`。如果 *strict* 為 ``False``,則將盡可能解析該路徑,並將任何剩餘部分" -"追加到路徑中,而不檢查其是否存在。" +"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引" +"發 :exc:`OSError`。如果 *strict* 為 ``False``,則將盡可能解析該路徑,並將任何" +"剩餘部分追加到路徑中,而不檢查其是否存在。" -#: ../../library/pathlib.rst:956 +#: ../../library/pathlib.rst:977 msgid "The *strict* parameter was added (pre-3.6 behavior is strict)." msgstr "新增 *strict* 參數(在 3.6 版本之前的行為是嚴格的)。" -#: ../../library/pathlib.rst:959 +#: ../../library/pathlib.rst:980 msgid "" "Symlink loops are treated like other errors: :exc:`OSError` is raised in " "strict mode, and no exception is raised in non-strict mode. In previous " @@ -1778,13 +1798,13 @@ msgstr "" "在非嚴格模式下,不會引發任何例外。在先前版本中,不管 *strict* 的值是什麼,都" "會引發 :exc:`RuntimeError`。" -#: ../../library/pathlib.rst:967 +#: ../../library/pathlib.rst:988 msgid "" -"Return the path to which the symbolic link points (as returned by :func:`os." -"readlink`)::" +"Return the path to which the symbolic link points (as returned " +"by :func:`os.readlink`)::" msgstr "回傳符號連結指向的路徑(如 :func:`os.readlink` 的回傳值): ::" -#: ../../library/pathlib.rst:970 +#: ../../library/pathlib.rst:991 msgid "" ">>> p = Path('mylink')\n" ">>> p.symlink_to('setup.py')\n" @@ -1796,7 +1816,7 @@ msgstr "" ">>> p.readlink()\n" "PosixPath('setup.py')" -#: ../../library/pathlib.rst:977 +#: ../../library/pathlib.rst:998 msgid "" "Raises :exc:`UnsupportedOperation` if :func:`os.readlink` is not available. " "In previous versions, :exc:`NotImplementedError` was raised." @@ -1804,24 +1824,31 @@ msgstr "" "如果 :func:`os.readlink` 不可用,會引發 :exc:`UnsupportedOperation`。在先前版" "本中,則是引發 :exc:`NotImplementedError`。" -#: ../../library/pathlib.rst:983 +#: ../../library/pathlib.rst:1004 msgid "Querying file type and status" msgstr "查詢檔案類型和狀態" -#: ../../library/pathlib.rst:987 +#: ../../library/pathlib.rst:1008 msgid "" -":meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`, :meth:" -"`~Path.is_mount`, :meth:`~Path.is_symlink`, :meth:`~Path.is_block_device`, :" -"meth:`~Path.is_char_device`, :meth:`~Path.is_fifo`, :meth:`~Path.is_socket` " +":meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`, :meth:`~Path.is_mount`, :meth:`~Path.is_symlink`, :meth:`~Path.is_block_device`, :meth:`~Path.is_char_device`, :meth:`~Path.is_fifo`, :meth:`~Path.is_socket` " "now return ``False`` instead of raising an exception for paths that contain " "characters unrepresentable at the OS level." msgstr "" -":meth:`~Path.exists`、:meth:`~Path.is_dir`、:meth:`~Path.is_file`、:meth:" -"`~Path.is_mount`、:meth:`~Path.is_symlink`、:meth:`~Path.is_block_device`、:" -"meth:`~Path.is_char_device`、:meth:`~Path.is_fifo`、:meth:`~Path.is_socket` " +":meth:`~Path.exists`、:meth:`~Path.is_dir`、:meth:`~Path.is_file`、:meth:`~Path.is_mount`、:meth:`~Path.is_symlink`、:meth:`~Path.is_block_device`、:meth:`~Path.is_char_device`、:meth:`~Path.is_fifo`、:meth:`~Path.is_socket` " "遇到路徑包含 OS 層無法表示的字元時現在會回傳 ``False`` 而不是引發例外。" -#: ../../library/pathlib.rst:997 +#: ../../library/pathlib.rst:1017 +msgid "" +"The methods given above now return ``False`` instead of raising " +"any :exc:`OSError` exception from the operating system. In previous " +"versions, some kinds of :exc:`OSError` exception are raised, and others " +"suppressed. The new behaviour is consistent " +"with :func:`os.path.exists`, :func:`os.path.isdir`, etc. " +"Use :meth:`~Path.stat` to retrieve the file status without suppressing " +"exceptions." +msgstr "" + +#: ../../library/pathlib.rst:1027 msgid "" "Return an :class:`os.stat_result` object containing information about this " "path, like :func:`os.stat`. The result is looked up at each call to this " @@ -1830,7 +1857,7 @@ msgstr "" "回傳一個包含該路徑資訊的 :class:`os.stat_result` 物件,像 :func:`os.stat` 一" "樣。每次呼叫此方法都會重新查詢結果。" -#: ../../library/pathlib.rst:1000 +#: ../../library/pathlib.rst:1030 msgid "" "This method normally follows symlinks; to stat a symlink add the argument " "``follow_symlinks=False``, or use :meth:`~Path.lstat`." @@ -1838,7 +1865,7 @@ msgstr "" "此方法通常會跟隨 (follow) 符號連結;想要取得符號連結的資訊,可以加上引數 " "``follow_symlinks=False`` 或使用 :meth:`~Path.lstat`。" -#: ../../library/pathlib.rst:1005 +#: ../../library/pathlib.rst:1035 msgid "" ">>> p = Path('setup.py')\n" ">>> p.stat().st_size\n" @@ -1852,14 +1879,14 @@ msgstr "" ">>> p.stat().st_mtime\n" "1327883547.852554" -#: ../../library/pathlib.rst:1011 ../../library/pathlib.rst:1039 -#: ../../library/pathlib.rst:1054 ../../library/pathlib.rst:1069 -#: ../../library/pathlib.rst:1600 ../../library/pathlib.rst:1616 -#: ../../library/pathlib.rst:1637 +#: ../../library/pathlib.rst:1041 ../../library/pathlib.rst:1071 +#: ../../library/pathlib.rst:1085 ../../library/pathlib.rst:1099 +#: ../../library/pathlib.rst:1720 ../../library/pathlib.rst:1736 +#: ../../library/pathlib.rst:1757 msgid "The *follow_symlinks* parameter was added." msgstr "新增 *follow_symlinks* 參數。" -#: ../../library/pathlib.rst:1017 +#: ../../library/pathlib.rst:1047 msgid "" "Like :meth:`Path.stat` but, if the path points to a symbolic link, return " "the symbolic link's information rather than its target's." @@ -1867,11 +1894,14 @@ msgstr "" "類似 :meth:`Path.stat`,但如果該路徑指向一個符號連結,則回傳符號連結的資訊而" "不是其指向的目標。" -#: ../../library/pathlib.rst:1023 -msgid "Return ``True`` if the path points to an existing file or directory." -msgstr "如果路徑指向存在的檔案或目錄則回傳 ``True``。" +#: ../../library/pathlib.rst:1053 +msgid "" +"Return ``True`` if the path points to an existing file or directory. " +"``False`` will be returned if the path is invalid, inaccessible or missing. " +"Use :meth:`Path.stat` to distinguish between these cases." +msgstr "" -#: ../../library/pathlib.rst:1025 +#: ../../library/pathlib.rst:1057 msgid "" "This method normally follows symlinks; to check if a symlink exists, add the " "argument ``follow_symlinks=False``." @@ -1879,7 +1909,7 @@ msgstr "" "此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " "``follow_symlinks=False``。" -#: ../../library/pathlib.rst:1030 +#: ../../library/pathlib.rst:1062 msgid "" ">>> Path('.').exists()\n" "True\n" @@ -1899,25 +1929,15 @@ msgstr "" ">>> Path('nonexistentfile').exists()\n" "False" -#: ../../library/pathlib.rst:1045 -msgid "" -"Return ``True`` if the path points to a regular file, ``False`` if it points " -"to another kind of file." -msgstr "" -"如果該路徑指向一個普通檔案則回傳 ``True``,如果指向其他類型的檔案則回傳 " -"``False``。" - -#: ../../library/pathlib.rst:1048 ../../library/pathlib.rst:1063 -#: ../../library/pathlib.rst:1111 ../../library/pathlib.rst:1120 -#: ../../library/pathlib.rst:1129 ../../library/pathlib.rst:1138 +#: ../../library/pathlib.rst:1077 msgid "" -"``False`` is also returned if the path doesn't exist or is a broken symlink; " -"other errors (such as permission errors) are propagated." +"Return ``True`` if the path points to a regular file. ``False`` will be " +"returned if the path is invalid, inaccessible or missing, or if it points to " +"something other than a regular file. Use :meth:`Path.stat` to distinguish " +"between these cases." msgstr "" -"如果路徑不存在或者是一個斷掉的符號連結則也會回傳 ``False``;其他錯誤(例如權" -"限錯誤)則會傳遞出來。" -#: ../../library/pathlib.rst:1051 +#: ../../library/pathlib.rst:1082 msgid "" "This method normally follows symlinks; to exclude symlinks, add the argument " "``follow_symlinks=False``." @@ -1925,15 +1945,15 @@ msgstr "" "此方法通常會跟隨符號連結;如果想將符號連結除外,可以加上引數 " "``follow_symlinks=False``。" -#: ../../library/pathlib.rst:1060 +#: ../../library/pathlib.rst:1091 msgid "" -"Return ``True`` if the path points to a directory, ``False`` if it points to " -"another kind of file." +"Return ``True`` if the path points to a directory. ``False`` will be " +"returned if the path is invalid, inaccessible or missing, or if it points to " +"something other than a directory. Use :meth:`Path.stat` to distinguish " +"between these cases." msgstr "" -"如果該路徑指向一個目錄則回傳 ``True``,如果指向其他類型的檔案則回傳 " -"``False``。" -#: ../../library/pathlib.rst:1066 +#: ../../library/pathlib.rst:1096 msgid "" "This method normally follows symlinks; to exclude symlinks to directories, " "add the argument ``follow_symlinks=False``." @@ -1941,19 +1961,15 @@ msgstr "" "此方法通常會跟隨符號連結;如果想將對目錄的符號連結除外,可以加上引數 " "``follow_symlinks=False``。" -#: ../../library/pathlib.rst:1075 -msgid "" -"Return ``True`` if the path points to a symbolic link, ``False`` otherwise." -msgstr "如果該路徑指向一個符號連結則回傳 ``True``,否則回傳 ``False``。" - -#: ../../library/pathlib.rst:1077 +#: ../../library/pathlib.rst:1105 msgid "" -"``False`` is also returned if the path doesn't exist; other errors (such as " -"permission errors) are propagated." +"Return ``True`` if the path points to a symbolic link, even if that symlink " +"is broken. ``False`` will be returned if the path is invalid, inaccessible " +"or missing, or if it points to something other than a symbolic link. " +"Use :meth:`Path.stat` to distinguish between these cases." msgstr "" -"如果該路徑不存在也會回傳 ``False``;其他錯誤(例如權限錯誤)則會傳遞出來。" -#: ../../library/pathlib.rst:1083 +#: ../../library/pathlib.rst:1113 msgid "" "Return ``True`` if the path points to a junction, and ``False`` for any " "other type of file. Currently only Windows supports junctions." @@ -1961,7 +1977,7 @@ msgstr "" "如果該路徑指向一個連接點 (junction) 則回傳 ``True``,對其他類型的檔案則回傳 " "``False``。目前只有 Windows 支援連接點。" -#: ../../library/pathlib.rst:1091 +#: ../../library/pathlib.rst:1121 msgid "" "Return ``True`` if the path is a :dfn:`mount point`: a point in a file " "system where a different file system has been mounted. On POSIX, the " @@ -1979,60 +1995,58 @@ msgstr "" "Windows 上,一個掛載點被視為一個根磁碟機字母(例如 ``c:\\``)、一個 UNC share" "(例如 ``\\\\server\\share``)或是掛載的檔案系統目錄。" -#: ../../library/pathlib.rst:1102 +#: ../../library/pathlib.rst:1132 msgid "Windows support was added." msgstr "加入對 Windows 的支援。" -#: ../../library/pathlib.rst:1108 +#: ../../library/pathlib.rst:1137 msgid "" -"Return ``True`` if the path points to a Unix socket (or a symbolic link " -"pointing to a Unix socket), ``False`` if it points to another kind of file." +"Return ``True`` if the path points to a Unix socket. ``False`` will be " +"returned if the path is invalid, inaccessible or missing, or if it points to " +"something other than a Unix socket. Use :meth:`Path.stat` to distinguish " +"between these cases." msgstr "" -"如果該路徑指向一個 Unix socket(或者是一個指向 Unix socket 的符號連結)則會回" -"傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:1117 +#: ../../library/pathlib.rst:1145 msgid "" -"Return ``True`` if the path points to a FIFO (or a symbolic link pointing to " -"a FIFO), ``False`` if it points to another kind of file." +"Return ``True`` if the path points to a FIFO. ``False`` will be returned if " +"the path is invalid, inaccessible or missing, or if it points to something " +"other than a FIFO. Use :meth:`Path.stat` to distinguish between these cases." msgstr "" -"如果該路徑指向一個 FIFO(或者是一個指向 FIFO 的符號連結)則會回傳 ``True``," -"如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:1126 +#: ../../library/pathlib.rst:1153 msgid "" -"Return ``True`` if the path points to a block device (or a symbolic link " -"pointing to a block device), ``False`` if it points to another kind of file." +"Return ``True`` if the path points to a block device. ``False`` will be " +"returned if the path is invalid, inaccessible or missing, or if it points to " +"something other than a block device. Use :meth:`Path.stat` to distinguish " +"between these cases." msgstr "" -"如果該路徑指向一個區塊裝置 (block device)(或者是一個指向區塊裝置的符號連結)" -"則會回傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:1135 +#: ../../library/pathlib.rst:1161 msgid "" -"Return ``True`` if the path points to a character device (or a symbolic link " -"pointing to a character device), ``False`` if it points to another kind of " -"file." +"Return ``True`` if the path points to a character device. ``False`` will be " +"returned if the path is invalid, inaccessible or missing, or if it points to " +"something other than a character device. Use :meth:`Path.stat` to " +"distinguish between these cases." msgstr "" -"如果該路徑指向一個字元裝置 (character device)(或者是一個指向字元裝置的符號連" -"結)則會回傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:1144 +#: ../../library/pathlib.rst:1169 msgid "" "Return whether this path points to the same file as *other_path*, which can " -"be either a Path object, or a string. The semantics are similar to :func:" -"`os.path.samefile` and :func:`os.path.samestat`." +"be either a Path object, or a string. The semantics are similar " +"to :func:`os.path.samefile` and :func:`os.path.samestat`." msgstr "" "回傳此路徑是否指向與 *other_path* 相同的檔案,*other_path* 可以是路徑 (Path) " -"物件或字串。其語義類似於 :func:`os.path.samefile` 和 :func:`os.path." -"samestat`。" +"物件或字串。其語義類似於 :func:`os.path.samefile` " +"和 :func:`os.path.samestat`。" -#: ../../library/pathlib.rst:1148 +#: ../../library/pathlib.rst:1173 msgid "" "An :exc:`OSError` can be raised if either file cannot be accessed for some " "reason." msgstr "若任何一個檔案因為某些原因無法存取,則引發 :exc:`OSError`。" -#: ../../library/pathlib.rst:1153 +#: ../../library/pathlib.rst:1178 msgid "" ">>> p = Path('spam')\n" ">>> q = Path('eggs')\n" @@ -2048,17 +2062,57 @@ msgstr "" ">>> p.samefile('spam')\n" "True" -#: ../../library/pathlib.rst:1164 +#: ../../library/pathlib.rst:1190 +msgid "" +"A :class:`~pathlib.types.PathInfo` object that supports querying file type " +"information. The object exposes methods that cache their results, which can " +"help reduce the number of system calls needed when switching on file type. " +"For example::" +msgstr "" + +#: ../../library/pathlib.rst:1195 +msgid "" +">>> p = Path('src')\n" +">>> if p.info.is_symlink():\n" +"... print('symlink')\n" +"... elif p.info.is_dir():\n" +"... print('directory')\n" +"... elif p.info.exists():\n" +"... print('something else')\n" +"... else:\n" +"... print('not found')\n" +"...\n" +"directory" +msgstr "" + +#: ../../library/pathlib.rst:1207 +msgid "" +"If the path was generated from :meth:`Path.iterdir` then this attribute is " +"initialized with some information about the file type gleaned from scanning " +"the parent directory. Merely accessing :attr:`Path.info` does not perform " +"any filesystem queries." +msgstr "" + +#: ../../library/pathlib.rst:1212 +msgid "" +"To fetch up-to-date information, it's best to " +"call :meth:`Path.is_dir`, :meth:`~Path.is_file` and :meth:`~Path.is_symlink` " +"rather than methods of this attribute. There is no way to reset the cache; " +"instead you can create a new path object with an empty info cache via ``p = " +"Path(p)``." +msgstr "" + +#: ../../library/pathlib.rst:1221 msgid "Reading and writing files" msgstr "讀取和寫入檔案" -#: ../../library/pathlib.rst:1169 +#: ../../library/pathlib.rst:1226 msgid "" "Open the file pointed to by the path, like the built-in :func:`open` " "function does::" msgstr "開啟該路徑指向的檔案,像內建的 :func:`open` 函式做的一樣: ::" -#: ../../library/pathlib.rst:1172 +#: ../../library/pathlib.rst:1229 msgid "" ">>> p = Path('setup.py')\n" ">>> with p.open() as f:\n" @@ -2072,11 +2126,11 @@ msgstr "" "...\n" "'#!/usr/bin/env python3\\n'" -#: ../../library/pathlib.rst:1181 +#: ../../library/pathlib.rst:1238 msgid "Return the decoded contents of the pointed-to file as a string::" msgstr "將路徑指向的檔案的解碼內容以字串形式回傳: ::" -#: ../../library/pathlib.rst:1183 ../../library/pathlib.rst:1216 +#: ../../library/pathlib.rst:1240 ../../library/pathlib.rst:1273 msgid "" ">>> p = Path('my_text_file')\n" ">>> p.write_text('Text file contents')\n" @@ -2090,21 +2144,21 @@ msgstr "" ">>> p.read_text()\n" "'Text file contents'" -#: ../../library/pathlib.rst:1189 +#: ../../library/pathlib.rst:1246 msgid "" "The file is opened and then closed. The optional parameters have the same " "meaning as in :func:`open`." msgstr "該檔案被打開並且隨後關閉。可選參數的含義與 :func:`open` 中的相同。" -#: ../../library/pathlib.rst:1194 ../../library/pathlib.rst:1227 +#: ../../library/pathlib.rst:1251 ../../library/pathlib.rst:1284 msgid "The *newline* parameter was added." msgstr "新增 *newline* 參數。" -#: ../../library/pathlib.rst:1200 +#: ../../library/pathlib.rst:1257 msgid "Return the binary contents of the pointed-to file as a bytes object::" msgstr "將路徑指向的檔案的二進位內容以一個位元組物件回傳: ::" -#: ../../library/pathlib.rst:1202 ../../library/pathlib.rst:1236 +#: ../../library/pathlib.rst:1259 ../../library/pathlib.rst:1293 msgid "" ">>> p = Path('my_binary_file')\n" ">>> p.write_bytes(b'Binary file contents')\n" @@ -2118,40 +2172,40 @@ msgstr "" ">>> p.read_bytes()\n" "b'Binary file contents'" -#: ../../library/pathlib.rst:1213 +#: ../../library/pathlib.rst:1270 msgid "" "Open the file pointed to in text mode, write *data* to it, and close the " "file::" msgstr "以文字模式開啟指向的檔案,將 *data* 寫到檔案,並關閉檔案:: :" -#: ../../library/pathlib.rst:1222 +#: ../../library/pathlib.rst:1279 msgid "" "An existing file of the same name is overwritten. The optional parameters " "have the same meaning as in :func:`open`." msgstr "" "一個名稱相同的已存在檔案會被覆寫。可選參數和 :func:`open` 的參數有相同意義。" -#: ../../library/pathlib.rst:1233 +#: ../../library/pathlib.rst:1290 msgid "" "Open the file pointed to in bytes mode, write *data* to it, and close the " "file::" msgstr "以位元組模式開啟指向的檔案,將 *data* 寫到檔案,並關閉檔案:: :" -#: ../../library/pathlib.rst:1242 +#: ../../library/pathlib.rst:1299 msgid "An existing file of the same name is overwritten." msgstr "一個名稱相同的已存在檔案會被覆寫。" -#: ../../library/pathlib.rst:1248 +#: ../../library/pathlib.rst:1305 msgid "Reading directories" msgstr "讀取目錄" -#: ../../library/pathlib.rst:1252 +#: ../../library/pathlib.rst:1309 msgid "" "When the path points to a directory, yield path objects of the directory " "contents::" msgstr "當該路徑指向一個目錄,會 yield 目錄裡面的路徑物件: ::" -#: ../../library/pathlib.rst:1255 +#: ../../library/pathlib.rst:1312 msgid "" ">>> p = Path('docs')\n" ">>> for child in p.iterdir(): child\n" @@ -2175,7 +2229,7 @@ msgstr "" "PosixPath('docs/_static')\n" "PosixPath('docs/Makefile')" -#: ../../library/pathlib.rst:1266 +#: ../../library/pathlib.rst:1323 msgid "" "The children are yielded in arbitrary order, and the special entries ``'.'`` " "and ``'..'`` are not included. If a file is removed from or added to the " @@ -2186,13 +2240,13 @@ msgstr "" "檔案在建立這個疊代器之後加到該目錄或從目錄刪除,這個檔案的路徑物件是否會被包" "含是沒有明定的。" -#: ../../library/pathlib.rst:1271 +#: ../../library/pathlib.rst:1328 msgid "" "If the path is not a directory or otherwise inaccessible, :exc:`OSError` is " "raised." msgstr "如果路徑不是目錄或無法存取,則會引發 :exc:`OSError`。" -#: ../../library/pathlib.rst:1276 +#: ../../library/pathlib.rst:1334 msgid "" "Glob the given relative *pattern* in the directory represented by this path, " "yielding all matching files (of any kind)::" @@ -2200,11 +2254,11 @@ msgstr "" "在該路徑表示的目錄裡,以 glob 方式比對所給定的相對 *pattern*,並 yield 所有比" "對到的檔案(任意類型): ::" -#: ../../library/pathlib.rst:1279 +#: ../../library/pathlib.rst:1337 msgid "" ">>> sorted(Path('.').glob('*.py'))\n" -"[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." -"py')]\n" +"[PosixPath('pathlib.py'), PosixPath('setup.py'), " +"PosixPath('test_pathlib.py')]\n" ">>> sorted(Path('.').glob('*/*.py'))\n" "[PosixPath('docs/conf.py')]\n" ">>> sorted(Path('.').glob('**/*.py'))\n" @@ -2215,8 +2269,8 @@ msgid "" " PosixPath('test_pathlib.py')]" msgstr "" ">>> sorted(Path('.').glob('*.py'))\n" -"[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." -"py')]\n" +"[PosixPath('pathlib.py'), PosixPath('setup.py'), " +"PosixPath('test_pathlib.py')]\n" ">>> sorted(Path('.').glob('*/*.py'))\n" "[PosixPath('docs/conf.py')]\n" ">>> sorted(Path('.').glob('**/*.py'))\n" @@ -2226,7 +2280,7 @@ msgstr "" " PosixPath('setup.py'),\n" " PosixPath('test_pathlib.py')]" -#: ../../library/pathlib.rst:1293 +#: ../../library/pathlib.rst:1351 msgid "" "By default, or when the *case_sensitive* keyword-only argument is set to " "``None``, this method matches paths using platform-specific casing rules: " @@ -2238,7 +2292,7 @@ msgstr "" "在 Windows 上不區分大小寫。將 *case_sensitive* 設成 ``True`` 或 ``False`` 會" "覆寫這個行為。" -#: ../../library/pathlib.rst:1298 +#: ../../library/pathlib.rst:1356 msgid "" "By default, or when the *recurse_symlinks* keyword-only argument is set to " "``False``, this method follows symlinks except when expanding \"``**``\" " @@ -2248,7 +2302,7 @@ msgstr "" "候,此方法會跟隨符號連結,除非在擴展 \"``**``\" 萬用字元時。將 " "*recurse_symlinks* 設成 ``True`` 以總是跟隨符號連結。" -#: ../../library/pathlib.rst:1302 +#: ../../library/pathlib.rst:1360 msgid "" "Raises an :ref:`auditing event ` ``pathlib.Path.glob`` with " "arguments ``self``, ``pattern``." @@ -2256,11 +2310,11 @@ msgstr "" "引發一個附帶引數 ``self``、``pattern`` 的\\ :ref:`稽核事件 ` " "``pathlib.Path.glob``。" -#: ../../library/pathlib.rst:1307 ../../library/pathlib.rst:1332 +#: ../../library/pathlib.rst:1365 ../../library/pathlib.rst:1390 msgid "The *recurse_symlinks* parameter was added." msgstr "新增 *recurse_symlinks* 參數。" -#: ../../library/pathlib.rst:1313 +#: ../../library/pathlib.rst:1371 msgid "" "Any :exc:`OSError` exceptions raised from scanning the filesystem are " "suppressed. In previous versions, such exceptions are suppressed in many " @@ -2269,19 +2323,19 @@ msgstr "" "從掃描檔案系統引發的任何 :exc:`OSError` 例外都會被抑制。在先前版本中,在許多" "情況下這種例外都會被抑制,但不是所有情況。" -#: ../../library/pathlib.rst:1321 +#: ../../library/pathlib.rst:1379 msgid "" -"Glob the given relative *pattern* recursively. This is like calling :func:" -"`Path.glob` with \"``**/``\" added in front of the *pattern*." +"Glob the given relative *pattern* recursively. This is like " +"calling :func:`Path.glob` with \"``**/``\" added in front of the *pattern*." msgstr "" "遞迴地 glob 給定的相對 *pattern*。這相當於在給定的相對 *pattern* 前面加上 " "\"``**/``\" 並呼叫 :func:`Path.glob`。" -#: ../../library/pathlib.rst:1325 +#: ../../library/pathlib.rst:1383 msgid ":ref:`pathlib-pattern-language` and :meth:`Path.glob` documentation." msgstr ":ref:`pathlib-pattern-language` 和 :meth:`Path.glob` 文件。" -#: ../../library/pathlib.rst:1327 +#: ../../library/pathlib.rst:1385 msgid "" "Raises an :ref:`auditing event ` ``pathlib.Path.rglob`` with " "arguments ``self``, ``pattern``." @@ -2289,13 +2343,13 @@ msgstr "" "引發一個附帶引數 ``self``、``pattern`` 的\\ :ref:`稽核事件 ` " "``pathlib.Path.rglob``。" -#: ../../library/pathlib.rst:1341 +#: ../../library/pathlib.rst:1399 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up." msgstr "透過由上而下或由下而上地走訪目錄樹產生目錄樹裡的檔案名稱。" -#: ../../library/pathlib.rst:1344 +#: ../../library/pathlib.rst:1402 msgid "" "For each directory in the directory tree rooted at *self* (including *self* " "but excluding '.' and '..'), the method yields a 3-tuple of ``(dirpath, " @@ -2304,7 +2358,7 @@ msgstr "" "對每個以 *self* 為根且在目錄樹裡的目錄(包含 *self* 但不包含 '.' 和 '..' )," "此方法會 yield 一個 ``(dirpath, dirnames, filenames)`` 的三元素元組。" -#: ../../library/pathlib.rst:1348 +#: ../../library/pathlib.rst:1406 msgid "" "*dirpath* is a :class:`Path` to the directory currently being walked, " "*dirnames* is a list of strings for the names of subdirectories in *dirpath* " @@ -2319,7 +2373,7 @@ msgstr "" "裡檔案或目錄的完整路徑(以 *self* 開頭),可以使用 ``dirpath / name``。會根據" "檔案系統來決定串列是否有排序。" -#: ../../library/pathlib.rst:1356 +#: ../../library/pathlib.rst:1414 msgid "" "If the optional argument *top_down* is true (which is the default), the " "triple for a directory is generated before the triples for any of its " @@ -2335,17 +2389,18 @@ msgstr "" "不論 *top_down* 的值是什麼,子目錄的串列會在走訪該目錄及其子目錄的三元素元組" "之前取得。" -#: ../../library/pathlib.rst:1364 +#: ../../library/pathlib.rst:1422 msgid "" "When *top_down* is true, the caller can modify the *dirnames* list in-place " -"(for example, using :keyword:`del` or slice assignment), and :meth:`Path." -"walk` will only recurse into the subdirectories whose names remain in " -"*dirnames*. This can be used to prune the search, or to impose a specific " -"order of visiting, or even to inform :meth:`Path.walk` about directories the " -"caller creates or renames before it resumes :meth:`Path.walk` again. " -"Modifying *dirnames* when *top_down* is false has no effect on the behavior " -"of :meth:`Path.walk` since the directories in *dirnames* have already been " -"generated by the time *dirnames* is yielded to the caller." +"(for example, using :keyword:`del` or slice assignment), " +"and :meth:`Path.walk` will only recurse into the subdirectories whose names " +"remain in *dirnames*. This can be used to prune the search, or to impose a " +"specific order of visiting, or even to inform :meth:`Path.walk` about " +"directories the caller creates or renames before it " +"resumes :meth:`Path.walk` again. Modifying *dirnames* when *top_down* is " +"false has no effect on the behavior of :meth:`Path.walk` since the " +"directories in *dirnames* have already been generated by the time *dirnames* " +"is yielded to the caller." msgstr "" "當 *top_down* 是 true,呼叫者可以原地 (in-place) 修改 *dirnames* 串列(例如使" "用 :keyword:`del` 或切片賦值 (slice assignment)),且 :meth:`Path.walk` 只會" @@ -2355,7 +2410,7 @@ msgstr "" "*dirnames* 對 :meth:`Path.walk` 的行為沒有影響,因為 *dirnames* 裡的目錄已經" "在 *dirnames* yield 給呼叫者之前被產生。" -#: ../../library/pathlib.rst:1374 +#: ../../library/pathlib.rst:1432 msgid "" "By default, errors from :func:`os.scandir` are ignored. If the optional " "argument *on_error* is specified, it should be a callable; it will be called " @@ -2368,7 +2423,7 @@ msgstr "" "這個可呼叫物件可以處理錯誤以繼續走訪,或者再次引發錯誤來停止走訪。注意,檔案" "名稱可以從例外物件的 ``filename`` 屬性來取得。" -#: ../../library/pathlib.rst:1380 +#: ../../library/pathlib.rst:1438 msgid "" "By default, :meth:`Path.walk` does not follow symbolic links, and instead " "adds them to the *filenames* list. Set *follow_symlinks* to true to resolve " @@ -2381,16 +2436,17 @@ msgstr "" "適當的 *dirnames* 和 *filenames*,而因此瀏覽到符號連結指向的目錄(在有支援符" "號連結的地方)。" -#: ../../library/pathlib.rst:1387 +#: ../../library/pathlib.rst:1445 msgid "" "Be aware that setting *follow_symlinks* to true can lead to infinite " -"recursion if a link points to a parent directory of itself. :meth:`Path." -"walk` does not keep track of the directories it has already visited." +"recursion if a link points to a parent directory of " +"itself. :meth:`Path.walk` does not keep track of the directories it has " +"already visited." msgstr "" "需要注意的是如果符號連結指向一個其本身的父目錄,則將 *follow_symlinks* 設定" "為 true 會導致無窮的遞迴。:meth:`Path.walk` 不會紀錄其已經瀏覽過的目錄。" -#: ../../library/pathlib.rst:1392 +#: ../../library/pathlib.rst:1450 msgid "" ":meth:`Path.walk` assumes the directories it walks are not modified during " "execution. For example, if a directory from *dirnames* has been replaced " @@ -2399,19 +2455,19 @@ msgid "" "*dirnames* as appropriate." msgstr "" ":meth:`Path.walk` 假設其走訪的目錄在執行過程中不會被修改。舉例來說,如果在 " -"*dirnames* 裡的目錄已經被一個符號連結取代,且 *follow_symlinks* 是 false,:" -"meth:`Path.walk` 依然會試著往下進入它。為了防止這樣的行為,可以從 *dirnames* " -"適當地移除目錄。" +"*dirnames* 裡的目錄已經被一個符號連結取代,且 *follow_symlinks* 是 " +"false,:meth:`Path.walk` 依然會試著往下進入它。為了防止這樣的行為,可以從 " +"*dirnames* 適當地移除目錄。" -#: ../../library/pathlib.rst:1400 +#: ../../library/pathlib.rst:1458 msgid "" "Unlike :func:`os.walk`, :meth:`Path.walk` lists symlinks to directories in " "*filenames* if *follow_symlinks* is false." msgstr "" -"如果 *follow_symlinks* 是 false,和 :func:`os.walk` 行為不同的是 :meth:`Path." -"walk` 會將指向目錄的符號連結放在 *filenames* 串列。" +"如果 *follow_symlinks* 是 false,和 :func:`os.walk` 行為不同的" +"是 :meth:`Path.walk` 會將指向目錄的符號連結放在 *filenames* 串列。" -#: ../../library/pathlib.rst:1403 +#: ../../library/pathlib.rst:1461 msgid "" "This example displays the number of bytes used by all files in each " "directory, while ignoring ``__pycache__`` directories::" @@ -2419,11 +2475,11 @@ msgstr "" "這個範例會顯示在每個目錄裡所有檔案使用的位元組數量,同時間忽略 " "``__pycache__`` 目錄: ::" -#: ../../library/pathlib.rst:1406 +#: ../../library/pathlib.rst:1464 msgid "" "from pathlib import Path\n" -"for root, dirs, files in Path(\"cpython/Lib/concurrent\")." -"walk(on_error=print):\n" +"for root, dirs, files in Path(\"cpython/Lib/" +"concurrent\").walk(on_error=print):\n" " print(\n" " root,\n" " \"consumes\",\n" @@ -2436,8 +2492,8 @@ msgid "" " dirs.remove('__pycache__')" msgstr "" "from pathlib import Path\n" -"for root, dirs, files in Path(\"cpython/Lib/concurrent\")." -"walk(on_error=print):\n" +"for root, dirs, files in Path(\"cpython/Lib/" +"concurrent\").walk(on_error=print):\n" " print(\n" " root,\n" " \"consumes\",\n" @@ -2449,7 +2505,7 @@ msgstr "" " if '__pycache__' in dirs:\n" " dirs.remove('__pycache__')" -#: ../../library/pathlib.rst:1419 +#: ../../library/pathlib.rst:1477 msgid "" "This next example is a simple implementation of :func:`shutil.rmtree`. " "Walking the tree bottom-up is essential as :func:`rmdir` doesn't allow " @@ -2458,7 +2514,7 @@ msgstr "" "下一個範例是 :func:`shutil.rmtree` 的一個簡單的實作方式。由下而上走訪目錄樹是" "必要的,因為 :func:`rmdir` 不允許在目錄為空之前刪除它: ::" -#: ../../library/pathlib.rst:1423 +#: ../../library/pathlib.rst:1481 msgid "" "# Delete everything reachable from the directory \"top\".\n" "# CAUTION: This is dangerous! For example, if top == Path('/'),\n" @@ -2478,31 +2534,31 @@ msgstr "" " for name in dirs:\n" " (root / name).rmdir()" -#: ../../library/pathlib.rst:1436 +#: ../../library/pathlib.rst:1494 msgid "Creating files and directories" msgstr "建立檔案和目錄" -#: ../../library/pathlib.rst:1440 +#: ../../library/pathlib.rst:1498 msgid "" "Create a file at this given path. If *mode* is given, it is combined with " "the process's ``umask`` value to determine the file mode and access flags. " "If the file already exists, the function succeeds when *exist_ok* is true " -"(and its modification time is updated to the current time), otherwise :exc:" -"`FileExistsError` is raised." +"(and its modification time is updated to the current time), " +"otherwise :exc:`FileExistsError` is raised." msgstr "" "根據給定路徑來建立一個檔案。如果 *mode* 有給定,它會與行程的 ``umask`` 值結" "合,以確定檔案模式和存取旗標。當檔案已經存在時,若 *exist_ok* 為 true 則函式" "不會失敗(其變更時間會被更新為當下時間),否則會引發 :exc:`FileExistsError`。" -#: ../../library/pathlib.rst:1447 +#: ../../library/pathlib.rst:1505 msgid "" -"The :meth:`~Path.open`, :meth:`~Path.write_text` and :meth:`~Path." -"write_bytes` methods are often used to create files." +"The :meth:`~Path.open`, :meth:`~Path.write_text` " +"and :meth:`~Path.write_bytes` methods are often used to create files." msgstr "" ":meth:`~Path.open`、:meth:`~Path.write_text` 和 :meth:`~Path.write_bytes` 方" "法通常用於建立檔案。" -#: ../../library/pathlib.rst:1453 +#: ../../library/pathlib.rst:1511 msgid "" "Create a new directory at this given path. If *mode* is given, it is " "combined with the process's ``umask`` value to determine the file mode and " @@ -2512,7 +2568,7 @@ msgstr "" "``umask`` 值來決定檔案模式與存取旗標 (access flag)。如果路徑已經存在,會引" "發 :exc:`FileExistsError`。" -#: ../../library/pathlib.rst:1458 +#: ../../library/pathlib.rst:1516 msgid "" "If *parents* is true, any missing parents of this path are created as " "needed; they are created with the default permissions without taking *mode* " @@ -2521,40 +2577,41 @@ msgstr "" "如果 *parents* 是 true,則任何缺少的父路徑都會依需要被建立;它們不考慮 " "*mode* 而會以預設的權限來建立(模仿 POSIX 的 ``mkdir -p`` 指令)。" -#: ../../library/pathlib.rst:1462 +#: ../../library/pathlib.rst:1520 msgid "" -"If *parents* is false (the default), a missing parent raises :exc:" -"`FileNotFoundError`." +"If *parents* is false (the default), a missing parent " +"raises :exc:`FileNotFoundError`." msgstr "" -"如果 *parents* 是 false(預設值),缺少的父路徑會引發 :exc:" -"`FileNotFoundError`。" +"如果 *parents* 是 false(預設值),缺少的父路徑會引" +"發 :exc:`FileNotFoundError`。" -#: ../../library/pathlib.rst:1465 +#: ../../library/pathlib.rst:1523 msgid "" "If *exist_ok* is false (the default), :exc:`FileExistsError` is raised if " "the target directory already exists." msgstr "" -"如果 *exist_ok* 是 false(預設值),則當目標目錄已經存在的話會引發 :exc:" -"`FileExistsError`。" +"如果 *exist_ok* 是 false(預設值),則當目標目錄已經存在的話會引" +"發 :exc:`FileExistsError`。" -#: ../../library/pathlib.rst:1468 +#: ../../library/pathlib.rst:1526 msgid "" "If *exist_ok* is true, :exc:`FileExistsError` will not be raised unless the " "given path already exists in the file system and is not a directory (same " "behavior as the POSIX ``mkdir -p`` command)." msgstr "" -"如果 *exist_ok* 是 true,只有當最後的路徑組成不是一個已存在的非目錄檔案,:" -"exc:`FileExistsError` 例外會被忽略(與 POSIX 的 ``mkdir -p`` 指令行為相同)。" +"如果 *exist_ok* 是 true,只有當最後的路徑組成不是一個已存在的非目錄檔" +"案,:exc:`FileExistsError` 例外會被忽略(與 POSIX 的 ``mkdir -p`` 指令行為相" +"同)。" -#: ../../library/pathlib.rst:1472 +#: ../../library/pathlib.rst:1530 msgid "The *exist_ok* parameter was added." msgstr "新增 *exist_ok* 參數。" -#: ../../library/pathlib.rst:1478 +#: ../../library/pathlib.rst:1536 msgid "Make this path a symbolic link pointing to *target*." msgstr "使這個路徑成為一個指向 *target* 的符號連結。" -#: ../../library/pathlib.rst:1480 +#: ../../library/pathlib.rst:1538 msgid "" "On Windows, a symlink represents either a file or a directory, and does not " "morph to the target dynamically. If the target is present, the type of the " @@ -2567,7 +2624,7 @@ msgstr "" "*target_is_directory* 是 true,該符號連結會被建立成目錄,如果不是則建立成檔案" "(預設值)。在非 Windows 平台上,*target_is_directory* 會被忽略。" -#: ../../library/pathlib.rst:1488 +#: ../../library/pathlib.rst:1546 msgid "" ">>> p = Path('mylink')\n" ">>> p.symlink_to('setup.py')\n" @@ -2587,12 +2644,12 @@ msgstr "" ">>> p.lstat().st_size\n" "8" -#: ../../library/pathlib.rst:1498 +#: ../../library/pathlib.rst:1556 msgid "" "The order of arguments (link, target) is the reverse of :func:`os.symlink`'s." msgstr "引數的順序 (link, target) 和 :func:`os.symlink` 相反。" -#: ../../library/pathlib.rst:1501 +#: ../../library/pathlib.rst:1559 msgid "" "Raises :exc:`UnsupportedOperation` if :func:`os.symlink` is not available. " "In previous versions, :exc:`NotImplementedError` was raised." @@ -2600,16 +2657,16 @@ msgstr "" "如果 :func:`os.symlink` 不可用,會引發 :exc:`UnsupportedOperation`。在先前版" "本中,則是引發 :exc:`NotImplementedError`。" -#: ../../library/pathlib.rst:1508 +#: ../../library/pathlib.rst:1566 msgid "Make this path a hard link to the same file as *target*." msgstr "使這個路徑成為與 *target* 相同檔案的一個硬連結 (hard link)。" -#: ../../library/pathlib.rst:1511 +#: ../../library/pathlib.rst:1569 msgid "" "The order of arguments (link, target) is the reverse of :func:`os.link`'s." msgstr "引數的順序 (link, target) 和 :func:`os.link` 相反。" -#: ../../library/pathlib.rst:1516 +#: ../../library/pathlib.rst:1574 msgid "" "Raises :exc:`UnsupportedOperation` if :func:`os.link` is not available. In " "previous versions, :exc:`NotImplementedError` was raised." @@ -2617,24 +2674,68 @@ msgstr "" "如果 :func:`os.link` 不可用,會引發 :exc:`UnsupportedOperation`。在先前版本" "中,則是引發 :exc:`NotImplementedError`。" -#: ../../library/pathlib.rst:1522 -msgid "Renaming and deleting" +#: ../../library/pathlib.rst:1580 +#, fuzzy +msgid "Copying, moving and deleting" msgstr "重新命名和刪除" -#: ../../library/pathlib.rst:1526 +#: ../../library/pathlib.rst:1584 +#, fuzzy +msgid "" +"Copy this file or directory tree to the given *target*, and return a " +"new :class:`!Path` instance pointing to *target*." +msgstr "" +"將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的" +"新 :class:`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條" +"件地取代。" + +#: ../../library/pathlib.rst:1587 +msgid "" +"If the source is a file, the target will be replaced if it is an existing " +"file. If the source is a symlink and *follow_symlinks* is true (the " +"default), the symlink's target is copied. Otherwise, the symlink is " +"recreated at the destination." +msgstr "" + +#: ../../library/pathlib.rst:1592 +msgid "" +"If *preserve_metadata* is false (the default), only directory structures and " +"file data are guaranteed to be copied. Set *preserve_metadata* to true to " +"ensure that file and directory permissions, flags, last access and " +"modification times, and extended attributes are copied where supported. This " +"argument has no effect when copying files on Windows (where metadata is " +"always preserved)." +msgstr "" + +#: ../../library/pathlib.rst:1600 +msgid "" +"Where supported by the operating system and file system, this method " +"performs a lightweight copy, where data blocks are only copied when " +"modified. This is known as copy-on-write." +msgstr "" + +#: ../../library/pathlib.rst:1610 +msgid "" +"Copy this file or directory tree into the given *target_dir*, which should " +"be an existing directory. Other arguments are handled identically " +"to :meth:`Path.copy`. Returns a new :class:`!Path` instance pointing to the " +"copy." +msgstr "" + +#: ../../library/pathlib.rst:1620 msgid "" -"Rename this file or directory to the given *target*, and return a new :class:" -"`!Path` instance pointing to *target*. On Unix, if *target* exists and is a " -"file, it will be replaced silently if the user has permission. On Windows, " -"if *target* exists, :exc:`FileExistsError` will be raised. *target* can be " -"either a string or another path object::" +"Rename this file or directory to the given *target*, and return a " +"new :class:`!Path` instance pointing to *target*. On Unix, if *target* " +"exists and is a file, it will be replaced silently if the user has " +"permission. On Windows, if *target* exists, :exc:`FileExistsError` will be " +"raised. *target* can be either a string or another path object::" msgstr "" "將此檔案或目錄重新命名為給定的 *target* ,並回傳一個新的 :class:`!Path` 實例" "指向該 *target*。在 Unix 系統上,若 *target* 存在且為一個檔案,若使用者有權" "限,則會在不顯示訊息的情況下進行取代。在 Windows 系統上,若 *target* 存在,則" "會引發 :exc:`FileExistsError` 錯誤。*target* 可以是字串或另一個路徑物件: ::" -#: ../../library/pathlib.rst:1532 +#: ../../library/pathlib.rst:1626 msgid "" ">>> p = Path('foo')\n" ">>> p.open('w').write('some text')\n" @@ -2654,41 +2755,74 @@ msgstr "" ">>> target.open().read()\n" "'some text'" -#: ../../library/pathlib.rst:1541 ../../library/pathlib.rst:1557 +#: ../../library/pathlib.rst:1635 ../../library/pathlib.rst:1651 msgid "" "The target path may be absolute or relative. Relative paths are interpreted " -"relative to the current working directory, *not* the directory of the :class:" -"`!Path` object." +"relative to the current working directory, *not* the directory of " +"the :class:`!Path` object." msgstr "" "目標路徑可以是絕對路徑或相對路徑。相對路徑會相對於目前的工作目錄進行解釋,*而" "不是*\\ 相對於 :class:`!Path` 物件所在的目錄。" -#: ../../library/pathlib.rst:1545 +#: ../../library/pathlib.rst:1639 msgid "" "It is implemented in terms of :func:`os.rename` and gives the same " "guarantees." msgstr "此功能是使用 :func:`os.rename` 實現的,並提供相同的保證。" -#: ../../library/pathlib.rst:1547 ../../library/pathlib.rst:1561 +#: ../../library/pathlib.rst:1641 ../../library/pathlib.rst:1655 msgid "Added return value, return the new :class:`!Path` instance." msgstr "新增了回傳值,回傳新的 :class:`!Path` 實例。" -#: ../../library/pathlib.rst:1553 +#: ../../library/pathlib.rst:1647 +msgid "" +"Rename this file or directory to the given *target*, and return a " +"new :class:`!Path` instance pointing to *target*. If *target* points to an " +"existing file or empty directory, it will be unconditionally replaced." +msgstr "" +"將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的" +"新 :class:`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條" +"件地取代。" + +#: ../../library/pathlib.rst:1661 +#, fuzzy msgid "" -"Rename this file or directory to the given *target*, and return a new :class:" -"`!Path` instance pointing to *target*. If *target* points to an existing " -"file or empty directory, it will be unconditionally replaced." +"Move this file or directory tree to the given *target*, and return a " +"new :class:`!Path` instance pointing to *target*." msgstr "" -"將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的新 :class:" -"`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條件地取代。" +"將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的" +"新 :class:`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條" +"件地取代。" -#: ../../library/pathlib.rst:1567 +#: ../../library/pathlib.rst:1664 msgid "" -"Remove this file or symbolic link. If the path points to a directory, use :" -"func:`Path.rmdir` instead." +"If the *target* doesn't exist it will be created. If both this path and the " +"*target* are existing files, then the target is overwritten. If both paths " +"point to the same file or directory, or the *target* is a non-empty " +"directory, then :exc:`OSError` is raised." +msgstr "" + +#: ../../library/pathlib.rst:1669 +msgid "" +"If both paths are on the same filesystem, the move is performed " +"with :func:`os.replace`. Otherwise, this path is copied (preserving metadata " +"and symlinks) and then deleted." +msgstr "" + +#: ../../library/pathlib.rst:1678 +msgid "" +"Move this file or directory tree into the given *target_dir*, which should " +"be an existing directory. Returns a new :class:`!Path` instance pointing to " +"the moved path." +msgstr "" + +#: ../../library/pathlib.rst:1687 +msgid "" +"Remove this file or symbolic link. If the path points to a directory, " +"use :func:`Path.rmdir` instead." msgstr "移除這個檔案或符號連結。如果路徑指向目錄,請改用 :func:`Path.rmdir`。" -#: ../../library/pathlib.rst:1570 +#: ../../library/pathlib.rst:1690 msgid "" "If *missing_ok* is false (the default), :exc:`FileNotFoundError` is raised " "if the path does not exist." @@ -2696,7 +2830,7 @@ msgstr "" "如果 *missing_ok* 是 false(預設值),:exc:`FileNotFoundError` 會在路徑不存在" "時被引發。" -#: ../../library/pathlib.rst:1573 +#: ../../library/pathlib.rst:1693 msgid "" "If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be ignored " "(same behavior as the POSIX ``rm -f`` command)." @@ -2704,19 +2838,19 @@ msgstr "" "如果 *missing_ok* 是 true,:exc:`FileNotFoundError` 例外會被忽略(行為與 " "POSIX ``rm -f`` 指令相同)。" -#: ../../library/pathlib.rst:1576 +#: ../../library/pathlib.rst:1696 msgid "The *missing_ok* parameter was added." msgstr "新增 *missing_ok* 參數。" -#: ../../library/pathlib.rst:1582 +#: ../../library/pathlib.rst:1702 msgid "Remove this directory. The directory must be empty." msgstr "移除此目錄。該目錄必須為空。" -#: ../../library/pathlib.rst:1586 +#: ../../library/pathlib.rst:1706 msgid "Permissions and ownership" msgstr "權限和所有權" -#: ../../library/pathlib.rst:1590 +#: ../../library/pathlib.rst:1710 msgid "" "Return the name of the user owning the file. :exc:`KeyError` is raised if " "the file's user identifier (UID) isn't found in the system database." @@ -2724,7 +2858,7 @@ msgstr "" "回傳擁有該檔案的用戶名稱。如果在系統資料庫中找不到該檔案的使用者識別字 " "(UID),則會引發 :exc:`KeyError`。" -#: ../../library/pathlib.rst:1593 +#: ../../library/pathlib.rst:1713 msgid "" "This method normally follows symlinks; to get the owner of the symlink, add " "the argument ``follow_symlinks=False``." @@ -2732,7 +2866,7 @@ msgstr "" "此方法通常會跟隨符號連結;如果想取得符號連結的擁有者,可以加上引數 " "``follow_symlinks=False``。" -#: ../../library/pathlib.rst:1596 +#: ../../library/pathlib.rst:1716 msgid "" "Raises :exc:`UnsupportedOperation` if the :mod:`pwd` module is not " "available. In earlier versions, :exc:`NotImplementedError` was raised." @@ -2740,7 +2874,7 @@ msgstr "" "如果 :mod:`pwd` 模組不可用,會引發 :exc:`UnsupportedOperation`。在先前版本" "中,則是引發 :exc:`NotImplementedError`。" -#: ../../library/pathlib.rst:1606 +#: ../../library/pathlib.rst:1726 msgid "" "Return the name of the group owning the file. :exc:`KeyError` is raised if " "the file's group identifier (GID) isn't found in the system database." @@ -2748,7 +2882,7 @@ msgstr "" "回傳擁有該檔案的群組名稱。如果在系統資料庫裡找不到檔案的群組識別字 (GID) 會引" "發 :exc:`KeyError`。" -#: ../../library/pathlib.rst:1609 +#: ../../library/pathlib.rst:1729 msgid "" "This method normally follows symlinks; to get the group of the symlink, add " "the argument ``follow_symlinks=False``." @@ -2756,7 +2890,7 @@ msgstr "" "此方法通常會跟隨符號連結;如果想取得符號連結的群組,可以加上引數 " "``follow_symlinks=False``。" -#: ../../library/pathlib.rst:1612 +#: ../../library/pathlib.rst:1732 msgid "" "Raises :exc:`UnsupportedOperation` if the :mod:`grp` module is not " "available. In earlier versions, :exc:`NotImplementedError` was raised." @@ -2764,11 +2898,11 @@ msgstr "" "如果 :mod:`grp` 模組不可用,會引發 :exc:`UnsupportedOperation`。在先前版本" "中,則是引發 :exc:`NotImplementedError`。" -#: ../../library/pathlib.rst:1622 +#: ../../library/pathlib.rst:1742 msgid "Change the file mode and permissions, like :func:`os.chmod`." msgstr "修改檔案模式 (file mode) 與權限,像 :func:`os.chmod` 一樣。" -#: ../../library/pathlib.rst:1624 +#: ../../library/pathlib.rst:1744 msgid "" "This method normally follows symlinks. Some Unix flavours support changing " "permissions on the symlink itself; on these platforms you may add the " @@ -2777,7 +2911,7 @@ msgstr "" "此方法通常會跟隨符號連結。一些 Unix 類型支援修改符號連結本身的權限;在這些平" "台上你可以加上引數 ``follow_symlinks=False`` 或使用 :meth:`~Path.lchmod`。" -#: ../../library/pathlib.rst:1630 +#: ../../library/pathlib.rst:1750 msgid "" ">>> p = Path('setup.py')\n" ">>> p.stat().st_mode\n" @@ -2793,7 +2927,7 @@ msgstr "" ">>> p.stat().st_mode\n" "33060" -#: ../../library/pathlib.rst:1643 +#: ../../library/pathlib.rst:1763 msgid "" "Like :meth:`Path.chmod` but, if the path points to a symbolic link, the " "symbolic link's mode is changed rather than its target's." @@ -2801,55 +2935,55 @@ msgstr "" "類似 :meth:`Path.chmod`,但如果該路徑指向一個符號連結,則符號連結的模式 " "(mode) 會被改變而不是其指向的目標。" -#: ../../library/pathlib.rst:1650 +#: ../../library/pathlib.rst:1770 msgid "Pattern language" msgstr "模式語言 (pattern language)" -#: ../../library/pathlib.rst:1652 +#: ../../library/pathlib.rst:1772 msgid "" -"The following wildcards are supported in patterns for :meth:`~PurePath." -"full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:" +"The following wildcards are supported in patterns " +"for :meth:`~PurePath.full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:" msgstr "" -"以下的萬用字元在 :meth:`~PurePath.full_match`、:meth:`~Path.glob` 和 :meth:" -"`~Path.rglob` 的模式中被支援:" +"以下的萬用字元在 :meth:`~PurePath.full_match`、:meth:`~Path.glob` " +"和 :meth:`~Path.rglob` 的模式中被支援:" -#: ../../library/pathlib.rst:1655 +#: ../../library/pathlib.rst:1775 msgid "``**`` (entire segment)" msgstr "``**``\\(整個片段)" -#: ../../library/pathlib.rst:1656 +#: ../../library/pathlib.rst:1776 msgid "Matches any number of file or directory segments, including zero." msgstr "匹配任何數量的檔案或目錄片段,包括零個。" -#: ../../library/pathlib.rst:1657 +#: ../../library/pathlib.rst:1777 msgid "``*`` (entire segment)" msgstr "``*``\\(整個片段)" -#: ../../library/pathlib.rst:1658 +#: ../../library/pathlib.rst:1778 msgid "Matches one file or directory segment." msgstr "匹配一個檔案或目錄的片段。" -#: ../../library/pathlib.rst:1659 +#: ../../library/pathlib.rst:1779 msgid "``*`` (part of a segment)" msgstr "``*``\\(片段的一部分)" -#: ../../library/pathlib.rst:1660 +#: ../../library/pathlib.rst:1780 msgid "Matches any number of non-separator characters, including zero." msgstr "匹配任意數量的非分隔字元,包括零個。" -#: ../../library/pathlib.rst:1661 +#: ../../library/pathlib.rst:1781 msgid "``?``" msgstr "``?``" -#: ../../library/pathlib.rst:1662 +#: ../../library/pathlib.rst:1782 msgid "Matches one non-separator character." msgstr "匹配一個非分隔字元。" -#: ../../library/pathlib.rst:1663 +#: ../../library/pathlib.rst:1783 msgid "``[seq]``" msgstr "``[seq]``" -#: ../../library/pathlib.rst:1664 +#: ../../library/pathlib.rst:1784 msgid "" "Matches one character in *seq*, where *seq* is a sequence of characters. " "Range expressions are supported; for example, ``[a-z]`` matches any " @@ -2857,17 +2991,17 @@ msgid "" "matches any ASCII letter, digit, or underscore." msgstr "" -#: ../../library/pathlib.rst:1668 +#: ../../library/pathlib.rst:1788 msgid "``[!seq]``" msgstr "``[!seq]``" -#: ../../library/pathlib.rst:1669 +#: ../../library/pathlib.rst:1789 msgid "" "Matches one character not in *seq*, where *seq* follows the same rules as " "above." msgstr "匹配一個不在 *seq* 中的字元,其中 *seq* 遵循上述相同的規則。" -#: ../../library/pathlib.rst:1671 +#: ../../library/pathlib.rst:1791 msgid "" "For a literal match, wrap the meta-characters in brackets. For example, " "``\"[?]\"`` matches the character ``\"?\"``." @@ -2875,52 +3009,52 @@ msgstr "" "對於文本 (literal) 匹配,可以用方括號包裝元字元 (meta-characters)。例如," "``\"[?]\"`` 會匹配字元 ``\"?\"``。" -#: ../../library/pathlib.rst:1674 +#: ../../library/pathlib.rst:1794 msgid "The \"``**``\" wildcard enables recursive globbing. A few examples:" msgstr "\"``**``\" 萬用字元讓它可以做遞迴 glob。例如:" -#: ../../library/pathlib.rst:1677 +#: ../../library/pathlib.rst:1797 msgid "Pattern" msgstr "模式" -#: ../../library/pathlib.rst:1677 +#: ../../library/pathlib.rst:1797 msgid "Meaning" msgstr "意涵" -#: ../../library/pathlib.rst:1679 +#: ../../library/pathlib.rst:1799 msgid "\"``**/*``\"" msgstr "\"``**/*``\"" -#: ../../library/pathlib.rst:1679 +#: ../../library/pathlib.rst:1799 msgid "Any path with at least one segment." msgstr "至少有一個片段的路徑。" -#: ../../library/pathlib.rst:1680 +#: ../../library/pathlib.rst:1800 msgid "\"``**/*.py``\"" msgstr "\"``**/*.py``\"" -#: ../../library/pathlib.rst:1680 +#: ../../library/pathlib.rst:1800 msgid "Any path with a final segment ending \"``.py``\"." msgstr "最後一個片段以 \"``.py``\" 結尾的任何路徑。" -#: ../../library/pathlib.rst:1681 +#: ../../library/pathlib.rst:1801 msgid "\"``assets/**``\"" msgstr "\"``assets/**``\"" -#: ../../library/pathlib.rst:1681 +#: ../../library/pathlib.rst:1801 msgid "Any path starting with \"``assets/``\"." msgstr "任何以 \"``assets/``\" 開頭的路徑。" -#: ../../library/pathlib.rst:1682 +#: ../../library/pathlib.rst:1802 msgid "\"``assets/**/*``\"" msgstr "\"``assets/**/*``\"" -#: ../../library/pathlib.rst:1682 +#: ../../library/pathlib.rst:1802 msgid "" "Any path starting with \"``assets/``\", excluding \"``assets/``\" itself." msgstr "任何以 \"``assets/``\" 開頭的路徑,不包括 \"``assets/``\" 本身。" -#: ../../library/pathlib.rst:1686 +#: ../../library/pathlib.rst:1806 msgid "" "Globbing with the \"``**``\" wildcard visits every directory in the tree. " "Large directory trees may take a long time to search." @@ -2928,7 +3062,7 @@ msgstr "" "Glob 使用 ``**`` 萬用字元會訪問目錄樹中的每個目錄。對於大型的目錄樹,搜尋可能" "需要花費很長的時間。" -#: ../../library/pathlib.rst:1689 +#: ../../library/pathlib.rst:1809 msgid "" "Globbing with a pattern that ends with \"``**``\" returns both files and " "directories. In previous versions, only directories were returned." @@ -2936,7 +3070,7 @@ msgstr "" "Glob 使用結尾為 ``**`` 的模式會同時回傳檔案和目錄。在先前版本中,只會回傳目" "錄。" -#: ../../library/pathlib.rst:1693 +#: ../../library/pathlib.rst:1813 msgid "" "In :meth:`Path.glob` and :meth:`~Path.rglob`, a trailing slash may be added " "to the pattern to match only directories." @@ -2944,43 +3078,43 @@ msgstr "" "在 :meth:`Path.glob` 和 :meth:`~Path.rglob` 中,可以在模式後面加上斜線以只匹" "配目錄。" -#: ../../library/pathlib.rst:1696 +#: ../../library/pathlib.rst:1816 msgid "" -"Globbing with a pattern that ends with a pathname components separator (:" -"data:`~os.sep` or :data:`~os.altsep`) returns only directories." +"Globbing with a pattern that ends with a pathname components separator " +"(:data:`~os.sep` or :data:`~os.altsep`) returns only directories." msgstr "" "Glob 使用以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os.altsep`)作" "結尾的模式則只會回傳目錄。" -#: ../../library/pathlib.rst:1702 +#: ../../library/pathlib.rst:1822 msgid "Comparison to the :mod:`glob` module" msgstr "與 :mod:`glob` 模組的比較" -#: ../../library/pathlib.rst:1704 +#: ../../library/pathlib.rst:1824 msgid "" -"The patterns accepted and results generated by :meth:`Path.glob` and :meth:" -"`Path.rglob` differ slightly from those by the :mod:`glob` module:" +"The patterns accepted and results generated by :meth:`Path.glob` " +"and :meth:`Path.rglob` differ slightly from those by the :mod:`glob` module:" msgstr "" ":meth:`Path.glob` 和 :meth:`Path.rglob` 接受的模式和產生的結果與 :mod:`glob` " "模組略有不同:" -#: ../../library/pathlib.rst:1707 +#: ../../library/pathlib.rst:1827 msgid "" "Files beginning with a dot are not special in pathlib. This is like passing " "``include_hidden=True`` to :func:`glob.glob`." msgstr "" -"pathlib 中以點開頭的檔案並不特別。這和將 ``include_hidden=True`` 傳遞給 :" -"func:`glob.glob` 相同。" +"pathlib 中以點開頭的檔案並不特別。這和將 ``include_hidden=True`` 傳遞" +"給 :func:`glob.glob` 相同。" -#: ../../library/pathlib.rst:1709 +#: ../../library/pathlib.rst:1829 msgid "" "\"``**``\" pattern components are always recursive in pathlib. This is like " "passing ``recursive=True`` to :func:`glob.glob`." msgstr "" -"``**`` 模式組成在 pathlib 中總是遞迴的。這與將 ``recursive=True`` 傳遞給 :" -"func:`glob.glob` 相同。" +"``**`` 模式組成在 pathlib 中總是遞迴的。這與將 ``recursive=True`` 傳遞" +"給 :func:`glob.glob` 相同。" -#: ../../library/pathlib.rst:1711 +#: ../../library/pathlib.rst:1831 msgid "" "\"``**``\" pattern components do not follow symlinks by default in pathlib. " "This behaviour has no equivalent in :func:`glob.glob`, but you can pass " @@ -2990,24 +3124,24 @@ msgstr "" "有等效的行為,但你可以將 ``recurse_symlinks=True`` 傳遞給 :meth:`Path.glob` " "以獲得相容的行為。" -#: ../../library/pathlib.rst:1714 +#: ../../library/pathlib.rst:1834 msgid "" "Like all :class:`PurePath` and :class:`Path` objects, the values returned " "from :meth:`Path.glob` and :meth:`Path.rglob` don't include trailing slashes." msgstr "" -"與所有 :class:`PurePath` 和 :class:`Path` 物件一樣,從 :meth:`Path.glob` 和 :" -"meth:`Path.rglob` 回傳的值不包含結尾斜線。" +"與所有 :class:`PurePath` 和 :class:`Path` 物件一樣,從 :meth:`Path.glob` " +"和 :meth:`Path.rglob` 回傳的值不包含結尾斜線。" -#: ../../library/pathlib.rst:1717 +#: ../../library/pathlib.rst:1837 msgid "" "The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` " -"include the *path* as a prefix, unlike the results of ``glob." -"glob(root_dir=path)``." +"include the *path* as a prefix, unlike the results of " +"``glob.glob(root_dir=path)``." msgstr "" "pathlib 的 ``path.glob()`` 和 ``path.rglob()`` 回傳的值包含了 *path* 作為前" "綴,而 ``glob.glob(root_dir=path)`` 的結果則不會如此。" -#: ../../library/pathlib.rst:1720 +#: ../../library/pathlib.rst:1840 msgid "" "The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` may " "include *path* itself, for example when globbing \"``**``\", whereas the " @@ -3018,15 +3152,15 @@ msgstr "" "例如當使用 \"``**``\" 做 glob 的時候,然而 ``glob.glob(root_dir=path)`` 的結" "果則永遠不會包含一個對應到 *path* 的空字串。" -#: ../../library/pathlib.rst:1727 +#: ../../library/pathlib.rst:1847 msgid "Comparison to the :mod:`os` and :mod:`os.path` modules" msgstr "與 :mod:`os` 和 :mod:`os.path` 模組的比較" -#: ../../library/pathlib.rst:1729 +#: ../../library/pathlib.rst:1849 msgid "" "pathlib implements path operations using :class:`PurePath` and :class:`Path` " -"objects, and so it's said to be *object-oriented*. On the other hand, the :" -"mod:`os` and :mod:`os.path` modules supply functions that work with low-" +"objects, and so it's said to be *object-oriented*. On the other hand, " +"the :mod:`os` and :mod:`os.path` modules supply functions that work with low-" "level ``str`` and ``bytes`` objects, which is a more *procedural* approach. " "Some users consider the object-oriented style to be more readable." msgstr "" @@ -3035,27 +3169,27 @@ msgstr "" "與底層 ``str`` 和 ``bytes`` 物件互動的函式,這是一種更\\ *程序式*\\ 的方法。" "有些使用者認為物件導向的風格更易讀。" -#: ../../library/pathlib.rst:1735 +#: ../../library/pathlib.rst:1855 msgid "" -"Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths and :" -"ref:`paths relative to directory descriptors `. These features " +"Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths " +"and :ref:`paths relative to directory descriptors `. These features " "aren't available in pathlib." msgstr "" ":mod:`os` 和 :mod:`os.path` 中的許多函式支援 ``bytes`` 路徑和\\ :ref:`相對路" "徑的目錄描述器 (paths relative to directory descriptors) `。這些功能" "在 pathlib 中不可用。" -#: ../../library/pathlib.rst:1739 +#: ../../library/pathlib.rst:1859 msgid "" -"Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` and :mod:" -"`os.path` modules, are written in C and are very speedy. pathlib is written " -"in pure Python and is often slower, but rarely slow enough to matter." +"Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` " +"and :mod:`os.path` modules, are written in C and are very speedy. pathlib is " +"written in pure Python and is often slower, but rarely slow enough to matter." msgstr "" "Python 的 ``str`` 和 ``bytes`` 型別,以及 :mod:`os` 和 :mod:`os.path` 模組的" "一些部分,是用 C 寫的且非常快速。pathlib 是用純 Python 寫的且通常比較慢,但很" "少會慢到足以產生影響。" -#: ../../library/pathlib.rst:1743 +#: ../../library/pathlib.rst:1863 msgid "" "pathlib's path normalization is slightly more opinionated and consistent " "than :mod:`os.path`. For example, whereas :func:`os.path.abspath` eliminates " @@ -3063,16 +3197,16 @@ msgid "" "are involved, :meth:`Path.absolute` preserves these segments for greater " "safety." msgstr "" -"pathlib 的路徑正規化略比 :mod:`os.path` 更武斷和一致。例如,儘管 :func:`os." -"path.abspath` 會從路徑中移除 \"``..``\" 片段,如果包含符號連結的話這可能會改" -"變其意義,而 :meth:`Path.absolute` 則會保留這些片段以增加安全性。" +"pathlib 的路徑正規化略比 :mod:`os.path` 更武斷和一致。例如,儘" +"管 :func:`os.path.abspath` 會從路徑中移除 \"``..``\" 片段,如果包含符號連結的" +"話這可能會改變其意義,而 :meth:`Path.absolute` 則會保留這些片段以增加安全性。" -#: ../../library/pathlib.rst:1748 +#: ../../library/pathlib.rst:1868 msgid "" "pathlib's path normalization may render it unsuitable for some applications:" msgstr "pathlib 的路徑正規化可能會使它不適合某些應用程式:" -#: ../../library/pathlib.rst:1750 +#: ../../library/pathlib.rst:1870 msgid "" "pathlib normalizes ``Path(\"my_folder/\")`` to ``Path(\"my_folder\")``, " "which changes a path's meaning when supplied to various operating system " @@ -3084,7 +3218,7 @@ msgstr "" "提供給各種操作系統 API 和命令列工具時改變路徑的意義。具體來說,缺少結尾分隔符" "號可能會允許該路徑被解析為檔案或目錄,而不只是目錄。" -#: ../../library/pathlib.rst:1755 +#: ../../library/pathlib.rst:1875 msgid "" "pathlib normalizes ``Path(\"./my_program\")`` to ``Path(\"my_program\")``, " "which changes a path's meaning when used as an executable search path, such " @@ -3097,285 +3231,285 @@ msgstr "" "程時。具體來說,在路徑中缺少分隔符號可能會使其強制在 :envvar:`PATH` 中尋找," "而不是目前目錄。" -#: ../../library/pathlib.rst:1761 +#: ../../library/pathlib.rst:1881 msgid "" "As a consequence of these differences, pathlib is not a drop-in replacement " "for :mod:`os.path`." msgstr "因為這些差異,pathlib 不是 :mod:`os.path` 的直接替代品。" -#: ../../library/pathlib.rst:1766 +#: ../../library/pathlib.rst:1886 msgid "Corresponding tools" msgstr "對應工具" -#: ../../library/pathlib.rst:1768 +#: ../../library/pathlib.rst:1888 msgid "" -"Below is a table mapping various :mod:`os` functions to their corresponding :" -"class:`PurePath`/:class:`Path` equivalent." +"Below is a table mapping various :mod:`os` functions to their " +"corresponding :class:`PurePath`/:class:`Path` equivalent." msgstr "" -"以下是一張表格,對應許多 :mod:`os` 函式及其相符於 :class:`PurePath`/:class:" -"`Path` 的項目。" +"以下是一張表格,對應許多 :mod:`os` 函式及其相符" +"於 :class:`PurePath`/:class:`Path` 的項目。" -#: ../../library/pathlib.rst:1772 +#: ../../library/pathlib.rst:1892 msgid ":mod:`os` and :mod:`os.path`" msgstr ":mod:`os` 和 :mod:`os.path`" -#: ../../library/pathlib.rst:1772 +#: ../../library/pathlib.rst:1892 msgid ":mod:`pathlib`" msgstr ":mod:`pathlib`" -#: ../../library/pathlib.rst:1774 +#: ../../library/pathlib.rst:1894 msgid ":func:`os.path.dirname`" msgstr ":func:`os.path.dirname`" -#: ../../library/pathlib.rst:1774 +#: ../../library/pathlib.rst:1894 msgid ":attr:`PurePath.parent`" msgstr ":attr:`PurePath.parent`" -#: ../../library/pathlib.rst:1775 +#: ../../library/pathlib.rst:1895 msgid ":func:`os.path.basename`" msgstr ":func:`os.path.basename`" -#: ../../library/pathlib.rst:1775 +#: ../../library/pathlib.rst:1895 msgid ":attr:`PurePath.name`" msgstr ":attr:`PurePath.name`" -#: ../../library/pathlib.rst:1776 +#: ../../library/pathlib.rst:1896 msgid ":func:`os.path.splitext`" msgstr ":func:`os.path.splitext`" -#: ../../library/pathlib.rst:1776 +#: ../../library/pathlib.rst:1896 msgid ":attr:`PurePath.stem`, :attr:`PurePath.suffix`" msgstr ":attr:`PurePath.stem` 和 :attr:`PurePath.suffix`" -#: ../../library/pathlib.rst:1777 +#: ../../library/pathlib.rst:1897 msgid ":func:`os.path.join`" msgstr ":func:`os.path.join`" -#: ../../library/pathlib.rst:1777 +#: ../../library/pathlib.rst:1897 msgid ":meth:`PurePath.joinpath`" msgstr ":meth:`PurePath.joinpath`" -#: ../../library/pathlib.rst:1778 +#: ../../library/pathlib.rst:1898 msgid ":func:`os.path.isabs`" msgstr ":func:`os.path.isabs`" -#: ../../library/pathlib.rst:1778 +#: ../../library/pathlib.rst:1898 msgid ":meth:`PurePath.is_absolute`" msgstr ":meth:`PurePath.is_absolute`" -#: ../../library/pathlib.rst:1779 +#: ../../library/pathlib.rst:1899 msgid ":func:`os.path.relpath`" msgstr ":func:`os.path.relpath`" -#: ../../library/pathlib.rst:1779 +#: ../../library/pathlib.rst:1899 msgid ":meth:`PurePath.relative_to` [1]_" msgstr ":meth:`PurePath.relative_to` [1]_" -#: ../../library/pathlib.rst:1780 +#: ../../library/pathlib.rst:1900 msgid ":func:`os.path.expanduser`" msgstr ":func:`os.path.expanduser`" -#: ../../library/pathlib.rst:1780 +#: ../../library/pathlib.rst:1900 msgid ":meth:`Path.expanduser` [2]_" msgstr ":meth:`Path.expanduser` [2]_" -#: ../../library/pathlib.rst:1781 +#: ../../library/pathlib.rst:1901 msgid ":func:`os.path.realpath`" msgstr ":func:`os.path.realpath`" -#: ../../library/pathlib.rst:1781 +#: ../../library/pathlib.rst:1901 msgid ":meth:`Path.resolve`" msgstr ":meth:`Path.resolve`" -#: ../../library/pathlib.rst:1782 +#: ../../library/pathlib.rst:1902 msgid ":func:`os.path.abspath`" msgstr ":func:`os.path.abspath`" -#: ../../library/pathlib.rst:1782 +#: ../../library/pathlib.rst:1902 msgid ":meth:`Path.absolute` [3]_" msgstr ":meth:`Path.absolute` [3]_" -#: ../../library/pathlib.rst:1783 +#: ../../library/pathlib.rst:1903 msgid ":func:`os.path.exists`" msgstr ":func:`os.path.exists`" -#: ../../library/pathlib.rst:1783 +#: ../../library/pathlib.rst:1903 msgid ":meth:`Path.exists`" msgstr ":meth:`Path.exists`" -#: ../../library/pathlib.rst:1784 +#: ../../library/pathlib.rst:1904 msgid ":func:`os.path.isfile`" msgstr ":func:`os.path.isfile`" -#: ../../library/pathlib.rst:1784 +#: ../../library/pathlib.rst:1904 msgid ":meth:`Path.is_file`" msgstr ":meth:`Path.is_file`" -#: ../../library/pathlib.rst:1785 +#: ../../library/pathlib.rst:1905 msgid ":func:`os.path.isdir`" msgstr ":func:`os.path.isdir`" -#: ../../library/pathlib.rst:1785 +#: ../../library/pathlib.rst:1905 msgid ":meth:`Path.is_dir`" msgstr ":meth:`Path.is_dir`" -#: ../../library/pathlib.rst:1786 +#: ../../library/pathlib.rst:1906 msgid ":func:`os.path.islink`" msgstr ":func:`os.path.islink`" -#: ../../library/pathlib.rst:1786 +#: ../../library/pathlib.rst:1906 msgid ":meth:`Path.is_symlink`" msgstr ":meth:`Path.is_symlink`" -#: ../../library/pathlib.rst:1787 +#: ../../library/pathlib.rst:1907 msgid ":func:`os.path.isjunction`" msgstr ":func:`os.path.isjunction`" -#: ../../library/pathlib.rst:1787 +#: ../../library/pathlib.rst:1907 msgid ":meth:`Path.is_junction`" msgstr ":meth:`Path.is_junction`" -#: ../../library/pathlib.rst:1788 +#: ../../library/pathlib.rst:1908 msgid ":func:`os.path.ismount`" msgstr ":func:`os.path.ismount`" -#: ../../library/pathlib.rst:1788 +#: ../../library/pathlib.rst:1908 msgid ":meth:`Path.is_mount`" msgstr ":meth:`Path.is_mount`" -#: ../../library/pathlib.rst:1789 +#: ../../library/pathlib.rst:1909 msgid ":func:`os.path.samefile`" msgstr ":func:`os.path.samefile`" -#: ../../library/pathlib.rst:1789 +#: ../../library/pathlib.rst:1909 msgid ":meth:`Path.samefile`" msgstr ":meth:`Path.samefile`" -#: ../../library/pathlib.rst:1790 +#: ../../library/pathlib.rst:1910 msgid ":func:`os.getcwd`" msgstr ":func:`os.getcwd`" -#: ../../library/pathlib.rst:1790 +#: ../../library/pathlib.rst:1910 msgid ":meth:`Path.cwd`" msgstr ":meth:`Path.cwd`" -#: ../../library/pathlib.rst:1791 +#: ../../library/pathlib.rst:1911 msgid ":func:`os.stat`" msgstr ":func:`os.stat`" -#: ../../library/pathlib.rst:1791 +#: ../../library/pathlib.rst:1911 msgid ":meth:`Path.stat`" msgstr ":meth:`Path.stat`" -#: ../../library/pathlib.rst:1792 +#: ../../library/pathlib.rst:1912 msgid ":func:`os.lstat`" msgstr ":func:`os.lstat`" -#: ../../library/pathlib.rst:1792 +#: ../../library/pathlib.rst:1912 msgid ":meth:`Path.lstat`" msgstr ":meth:`Path.lstat`" -#: ../../library/pathlib.rst:1793 +#: ../../library/pathlib.rst:1913 msgid ":func:`os.listdir`" msgstr ":func:`os.listdir`" -#: ../../library/pathlib.rst:1793 +#: ../../library/pathlib.rst:1913 msgid ":meth:`Path.iterdir`" msgstr ":meth:`Path.iterdir`" -#: ../../library/pathlib.rst:1794 +#: ../../library/pathlib.rst:1914 msgid ":func:`os.walk`" msgstr ":func:`os.walk`" -#: ../../library/pathlib.rst:1794 +#: ../../library/pathlib.rst:1914 msgid ":meth:`Path.walk` [4]_" msgstr ":meth:`Path.walk` [4]_" -#: ../../library/pathlib.rst:1795 +#: ../../library/pathlib.rst:1915 msgid ":func:`os.mkdir`, :func:`os.makedirs`" msgstr ":func:`os.mkdir`、:func:`os.makedirs`" -#: ../../library/pathlib.rst:1795 +#: ../../library/pathlib.rst:1915 msgid ":meth:`Path.mkdir`" msgstr ":meth:`Path.mkdir`" -#: ../../library/pathlib.rst:1796 +#: ../../library/pathlib.rst:1916 msgid ":func:`os.link`" msgstr ":func:`os.link`" -#: ../../library/pathlib.rst:1796 +#: ../../library/pathlib.rst:1916 msgid ":meth:`Path.hardlink_to`" msgstr ":meth:`Path.hardlink_to`" -#: ../../library/pathlib.rst:1797 +#: ../../library/pathlib.rst:1917 msgid ":func:`os.symlink`" msgstr ":func:`os.symlink`" -#: ../../library/pathlib.rst:1797 +#: ../../library/pathlib.rst:1917 msgid ":meth:`Path.symlink_to`" msgstr ":meth:`Path.symlink_to`" -#: ../../library/pathlib.rst:1798 +#: ../../library/pathlib.rst:1918 msgid ":func:`os.readlink`" msgstr ":func:`os.readlink`" -#: ../../library/pathlib.rst:1798 +#: ../../library/pathlib.rst:1918 msgid ":meth:`Path.readlink`" msgstr ":meth:`Path.readlink`" -#: ../../library/pathlib.rst:1799 +#: ../../library/pathlib.rst:1919 msgid ":func:`os.rename`" msgstr ":func:`os.rename`" -#: ../../library/pathlib.rst:1799 +#: ../../library/pathlib.rst:1919 msgid ":meth:`Path.rename`" msgstr ":meth:`Path.rename`" -#: ../../library/pathlib.rst:1800 +#: ../../library/pathlib.rst:1920 msgid ":func:`os.replace`" msgstr ":func:`os.replace`" -#: ../../library/pathlib.rst:1800 +#: ../../library/pathlib.rst:1920 msgid ":meth:`Path.replace`" msgstr ":meth:`Path.replace`" -#: ../../library/pathlib.rst:1801 +#: ../../library/pathlib.rst:1921 msgid ":func:`os.remove`, :func:`os.unlink`" msgstr ":func:`os.remove`、:func:`os.unlink`" -#: ../../library/pathlib.rst:1801 +#: ../../library/pathlib.rst:1921 msgid ":meth:`Path.unlink`" msgstr ":meth:`Path.unlink`" -#: ../../library/pathlib.rst:1802 +#: ../../library/pathlib.rst:1922 msgid ":func:`os.rmdir`" msgstr ":func:`os.rmdir`" -#: ../../library/pathlib.rst:1802 +#: ../../library/pathlib.rst:1922 msgid ":meth:`Path.rmdir`" msgstr ":meth:`Path.rmdir`" -#: ../../library/pathlib.rst:1803 +#: ../../library/pathlib.rst:1923 msgid ":func:`os.chmod`" msgstr ":func:`os.chmod`" -#: ../../library/pathlib.rst:1803 +#: ../../library/pathlib.rst:1923 msgid ":meth:`Path.chmod`" msgstr ":meth:`Path.chmod`" -#: ../../library/pathlib.rst:1804 +#: ../../library/pathlib.rst:1924 msgid ":func:`os.lchmod`" msgstr ":func:`os.lchmod`" -#: ../../library/pathlib.rst:1804 +#: ../../library/pathlib.rst:1924 msgid ":meth:`Path.lchmod`" msgstr ":meth:`Path.lchmod`" -#: ../../library/pathlib.rst:1808 +#: ../../library/pathlib.rst:1928 msgid "Footnotes" msgstr "註腳" -#: ../../library/pathlib.rst:1809 +#: ../../library/pathlib.rst:1929 msgid "" ":func:`os.path.relpath` calls :func:`~os.path.abspath` to make paths " "absolute and remove \"``..``\" parts, whereas :meth:`PurePath.relative_to` " @@ -3384,28 +3518,28 @@ msgid "" msgstr "" ":func:`os.path.relpath` 會呼叫 :func:`~os.path.abspath` 來將路徑變成絕對路徑" "並移除 \"``..``\" 部分,而 :meth:`PurePath.relative_to` 是一個文本上的操作," -"當它輸入的錨點不同時(例如一個是絕對路徑,另一個則是相對路徑)會引發 :exc:" -"`ValueError`。" +"當它輸入的錨點不同時(例如一個是絕對路徑,另一個則是相對路徑)會引" +"發 :exc:`ValueError`。" -#: ../../library/pathlib.rst:1813 +#: ../../library/pathlib.rst:1933 msgid "" ":func:`os.path.expanduser` returns the path unchanged if the home directory " -"can't be resolved, whereas :meth:`Path.expanduser` raises :exc:" -"`RuntimeError`." +"can't be resolved, whereas :meth:`Path.expanduser` " +"raises :exc:`RuntimeError`." msgstr "" -":func:`os.path.expanduser` 會在無法解析家目錄時回傳原始路徑,而 :meth:`Path." -"expanduser` 則會引發 :exc:`RuntimeError`。" +":func:`os.path.expanduser` 會在無法解析家目錄時回傳原始路徑," +"而 :meth:`Path.expanduser` 則會引發 :exc:`RuntimeError`。" -#: ../../library/pathlib.rst:1816 +#: ../../library/pathlib.rst:1936 msgid "" ":func:`os.path.abspath` removes \"``..``\" components without resolving " -"symlinks, which may change the meaning of the path, whereas :meth:`Path." -"absolute` leaves any \"``..``\" components in the path." +"symlinks, which may change the meaning of the path, " +"whereas :meth:`Path.absolute` leaves any \"``..``\" components in the path." msgstr "" ":func:`os.path.abspath` 將 \"``..``\" 組成移除而不解析符號連結,這可能會改變" "路徑的意義,而 :meth:`Path.absolute` 則會保留路徑中任何 \"``..``\" 組成。" -#: ../../library/pathlib.rst:1819 +#: ../../library/pathlib.rst:1939 msgid "" ":func:`os.walk` always follows symlinks when categorizing paths into " "*dirnames* and *filenames*, whereas :meth:`Path.walk` categorizes all " @@ -3415,6 +3549,79 @@ msgstr "" "而 :meth:`Path.walk` 在 *follow_symlinks* 為 false(預設值)時,會將所有符號" "連結都分類為 *filenames*。" +#: ../../library/pathlib.rst:1945 +msgid "Protocols" +msgstr "" + +#: ../../library/pathlib.rst:1951 +msgid "" +"The :mod:`pathlib.types` module provides types for static type checking." +msgstr "" + +#: ../../library/pathlib.rst:1958 +msgid "" +"A :class:`typing.Protocol` describing the :attr:`Path.info " +"` attribute. Implementations may return cached results " +"from their methods." +msgstr "" + +#: ../../library/pathlib.rst:1964 +#, fuzzy +msgid "" +"Return ``True`` if the path is an existing file or directory, or any other " +"kind of file; return ``False`` if the path doesn't exist." +msgstr "如果路徑指向存在的檔案或目錄則回傳 ``True``。" + +#: ../../library/pathlib.rst:1967 +msgid "" +"If *follow_symlinks* is ``False``, return ``True`` for symlinks without " +"checking if their targets exist." +msgstr "" + +#: ../../library/pathlib.rst:1972 +#, fuzzy +msgid "" +"Return ``True`` if the path is a directory, or a symbolic link pointing to a " +"directory; return ``False`` if the path is (or points to) any other kind of " +"file, or if it doesn't exist." +msgstr "" +"如果該路徑指向一個 Unix socket(或者是一個指向 Unix socket 的符號連結)則會回" +"傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" + +#: ../../library/pathlib.rst:1976 +msgid "" +"If *follow_symlinks* is ``False``, return ``True`` only if the path is a " +"directory (without following symlinks); return ``False`` if the path is any " +"other kind of file, or if it doesn't exist." +msgstr "" + +#: ../../library/pathlib.rst:1982 +#, fuzzy +msgid "" +"Return ``True`` if the path is a file, or a symbolic link pointing to a " +"file; return ``False`` if the path is (or points to) a directory or other " +"non-file, or if it doesn't exist." +msgstr "" +"如果該路徑指向一個 Unix socket(或者是一個指向 Unix socket 的符號連結)則會回" +"傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" + +#: ../../library/pathlib.rst:1986 +msgid "" +"If *follow_symlinks* is ``False``, return ``True`` only if the path is a " +"file (without following symlinks); return ``False`` if the path is a " +"directory or other non-file, or if it doesn't exist." +msgstr "" + +#: ../../library/pathlib.rst:1992 +#, fuzzy +msgid "" +"Return ``True`` if the path is a symbolic link (even if broken); return " +"``False`` if the path is a directory or any kind of file, or if it doesn't " +"exist." +msgstr "" +"如果該路徑指向一個 FIFO(或者是一個指向 FIFO 的符號連結)則會回傳 ``True``," +"如果指向其他類型的檔案則回傳 ``False``。" + #: ../../library/pathlib.rst:11 msgid "path" msgstr "path(路徑)" @@ -3423,5 +3630,53 @@ msgstr "path(路徑)" msgid "operations" msgstr "operations(操作)" +#~ msgid "" +#~ "Return ``True`` if the path points to a regular file, ``False`` if it " +#~ "points to another kind of file." +#~ msgstr "" +#~ "如果該路徑指向一個普通檔案則回傳 ``True``,如果指向其他類型的檔案則回傳 " +#~ "``False``。" + +#~ msgid "" +#~ "``False`` is also returned if the path doesn't exist or is a broken " +#~ "symlink; other errors (such as permission errors) are propagated." +#~ msgstr "" +#~ "如果路徑不存在或者是一個斷掉的符號連結則也會回傳 ``False``;其他錯誤(例如" +#~ "權限錯誤)則會傳遞出來。" + +#~ msgid "" +#~ "Return ``True`` if the path points to a directory, ``False`` if it points " +#~ "to another kind of file." +#~ msgstr "" +#~ "如果該路徑指向一個目錄則回傳 ``True``,如果指向其他類型的檔案則回傳 " +#~ "``False``。" + +#~ msgid "" +#~ "Return ``True`` if the path points to a symbolic link, ``False`` " +#~ "otherwise." +#~ msgstr "如果該路徑指向一個符號連結則回傳 ``True``,否則回傳 ``False``。" + +#~ msgid "" +#~ "``False`` is also returned if the path doesn't exist; other errors (such " +#~ "as permission errors) are propagated." +#~ msgstr "" +#~ "如果該路徑不存在也會回傳 ``False``;其他錯誤(例如權限錯誤)則會傳遞出來。" + +#~ msgid "" +#~ "Return ``True`` if the path points to a block device (or a symbolic link " +#~ "pointing to a block device), ``False`` if it points to another kind of " +#~ "file." +#~ msgstr "" +#~ "如果該路徑指向一個區塊裝置 (block device)(或者是一個指向區塊裝置的符號連" +#~ "結)則會回傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" + +#~ msgid "" +#~ "Return ``True`` if the path points to a character device (or a symbolic " +#~ "link pointing to a character device), ``False`` if it points to another " +#~ "kind of file." +#~ msgstr "" +#~ "如果該路徑指向一個字元裝置 (character device)(或者是一個指向字元裝置的符" +#~ "號連結)則會回傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" + #~ msgid "Matches one character in *seq*." #~ msgstr "匹配一個在 *seq* 中的字元。" diff --git a/library/pdb.po b/library/pdb.po index 2cdb572a069..5b30e3e5f49 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-09 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-10-19 17:39+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -152,17 +152,18 @@ msgstr "" "透過 :mod:`readline` 模組達成的 tab 補全可用於補全本模組的命令和命令的引數," "例如會提供目前的全域和區域名稱以作為 ``p`` 命令的引數。" -#: ../../library/pdb.rst:80 +#: ../../library/pdb.rst:81 msgid "" "You can also invoke :mod:`pdb` from the command line to debug other " "scripts. For example::" msgstr "你還可以從命令列叫用 :mod:`pdb` 來偵錯其他腳本。例如: ::" -#: ../../library/pdb.rst:83 -msgid "python -m pdb [-c command] (-m module | pyfile) [args ...]" +#: ../../library/pdb.rst:84 +#, fuzzy +msgid "python -m pdb [-c command] (-m module | -p pid | pyfile) [args ...]" msgstr "python -m pdb [-c command] (-m module | pyfile) [args ...]" -#: ../../library/pdb.rst:85 +#: ../../library/pdb.rst:86 msgid "" "When invoked as a module, pdb will automatically enter post-mortem debugging " "if the program being debugged exits abnormally. After post-mortem debugging " @@ -174,7 +175,7 @@ msgstr "" "偵錯後(或程式正常退出後),pdb 將重新啟動程式。自動重新啟動會保留 pdb 的狀態" "(例如斷點),並且在大多數情況下比在程式退出時退出偵錯器更有用。" -#: ../../library/pdb.rst:93 +#: ../../library/pdb.rst:94 msgid "" "To execute commands as if given in a :file:`.pdbrc` file; see :ref:`debugger-" "commands`." @@ -182,11 +183,11 @@ msgstr "" "就像在 :file:`.pdbrc` 檔案中給定的那樣來執行命令;請參閱\\ :ref:`偵錯器命令 " "`。" -#: ../../library/pdb.rst:96 +#: ../../library/pdb.rst:97 msgid "Added the ``-c`` option." msgstr "新增了 ``-c`` 選項。" -#: ../../library/pdb.rst:101 +#: ../../library/pdb.rst:102 msgid "" "To execute modules similar to the way ``python -m`` does. As with a script, " "the debugger will pause execution just before the first line of the module." @@ -194,15 +195,37 @@ msgstr "" "以類似於 ``python -m`` 的方式來執行模組。與腳本一樣,偵錯器將在模組的第一列之" "前暫停執行。" -#: ../../library/pdb.rst:104 +#: ../../library/pdb.rst:105 msgid "Added the ``-m`` option." msgstr "新增了 ``-m`` 選項。" -#: ../../library/pdb.rst:107 +#: ../../library/pdb.rst:110 +msgid "Attach to the process with the specified PID." +msgstr "" + +#: ../../library/pdb.rst:115 +msgid "" +"To attach to a running Python process for remote debugging, use the ``-p`` " +"or ``--pid`` option with the target process's PID::" +msgstr "" + +#: ../../library/pdb.rst:118 +#, fuzzy +msgid "python -m pdb -p 1234" +msgstr "python -m pdb myscript.py" + +#: ../../library/pdb.rst:122 +msgid "" +"Attaching to a process that is blocked in a system call or waiting for I/O " +"will only work once the next bytecode instruction is executed or when the " +"process receives a signal." +msgstr "" + +#: ../../library/pdb.rst:126 msgid "Typical usage to execute a statement under control of the debugger is::" msgstr "在偵錯器控制下執行陳述式的典型用法是: ::" -#: ../../library/pdb.rst:109 +#: ../../library/pdb.rst:128 msgid "" ">>> import pdb\n" ">>> def f(x):\n" @@ -222,11 +245,11 @@ msgstr "" "0.5\n" ">>>" -#: ../../library/pdb.rst:118 +#: ../../library/pdb.rst:137 msgid "The typical usage to inspect a crashed program is::" msgstr "檢查一個損壞程式的典型用法: ::" -#: ../../library/pdb.rst:120 +#: ../../library/pdb.rst:139 msgid "" ">>> import pdb\n" ">>> def f(x):\n" @@ -258,7 +281,7 @@ msgstr "" "0\n" "(Pdb)" -#: ../../library/pdb.rst:135 +#: ../../library/pdb.rst:154 msgid "" "The implementation of :pep:`667` means that name assignments made via " "``pdb`` will immediately affect the active scope, even when running inside " @@ -268,13 +291,13 @@ msgstr "" "影響有效作用域,即使在\\ :term:`最佳化作用域 `\\ 內運作也是" "如此。" -#: ../../library/pdb.rst:141 +#: ../../library/pdb.rst:160 msgid "" "The module defines the following functions; each enters the debugger in a " "slightly different way:" msgstr "本模組定義了下列函式,每個函式進入偵錯器的方式略有不同:" -#: ../../library/pdb.rst:146 +#: ../../library/pdb.rst:165 msgid "" "Execute the *statement* (given as a string or a code object) under debugger " "control. The debugger prompt appears before any code is executed; you can " @@ -292,7 +315,7 @@ msgstr "" "用 :mod:`__main__` 模組的字典。(請參閱內建函式 :func:`exec` 或 :func:`eval` " "的說明。)" -#: ../../library/pdb.rst:158 +#: ../../library/pdb.rst:177 msgid "" "Evaluate the *expression* (given as a string or a code object) under " "debugger control. When :func:`runeval` returns, it returns the value of the " @@ -302,7 +325,7 @@ msgstr "" "當 :func:`runeval` 回傳時,它回傳 *expression* 的值。除此之外,該函式" "與 :func:`run` 類似。" -#: ../../library/pdb.rst:165 +#: ../../library/pdb.rst:184 msgid "" "Call the *function* (a function or method object, not a string) with the " "given arguments. When :func:`runcall` returns, it returns whatever the " @@ -313,28 +336,54 @@ msgstr "" "串)。:func:`runcall` 回傳的是所呼叫函式的回傳值。偵錯器提示字元將在進入函式" "後立即出現。" -#: ../../library/pdb.rst:173 +#: ../../library/pdb.rst:192 +#, fuzzy msgid "" "Enter the debugger at the calling stack frame. This is useful to hard-code " "a breakpoint at a given point in a program, even if the code is not " "otherwise being debugged (e.g. when an assertion fails). If given, *header* " -"is printed to the console just before debugging begins." +"is printed to the console just before debugging begins. The *commands* " +"argument, if given, is a list of commands to execute when the debugger " +"starts." msgstr "" "在呼叫此函式的 stack frame 進入偵錯器。用於在程式中給定之處寫死 (hard-code) " "一個斷點,即便該程式碼不在偵錯狀態(如斷言失敗時)。如有給定 *header*,它將在" "偵錯正要開始前被印出到控制台。" -#: ../../library/pdb.rst:178 +#: ../../library/pdb.rst:200 msgid "The keyword-only argument *header*." msgstr "僅限關鍵字引數 *header*。" -#: ../../library/pdb.rst:181 +#: ../../library/pdb.rst:203 msgid "" ":func:`set_trace` will enter the debugger immediately, rather than on the " "next line of code to be executed." msgstr ":func:`set_trace` 將立即進入偵錯器,而不是在下一列要執行的程式碼中。" -#: ../../library/pdb.rst:187 +#: ../../library/pdb.rst:207 +#, fuzzy +msgid "The *commands* argument." +msgstr "*readrc* 引數。" + +#: ../../library/pdb.rst:213 +msgid "" +"async version of :func:`set_trace`. This function should be used inside an " +"async function with :keyword:`await`." +msgstr "" + +#: ../../library/pdb.rst:216 +msgid "" +"async def f():\n" +" await pdb.set_trace_async()" +msgstr "" + +#: ../../library/pdb.rst:221 +msgid "" +":keyword:`await` statements are supported if the debugger is invoked by this " +"function." +msgstr "" + +#: ../../library/pdb.rst:227 msgid "" "Enter post-mortem debugging of the given exception or :ref:`traceback object " "`. If no value is given, it uses the exception that is " @@ -343,16 +392,34 @@ msgstr "" "進入所給定例外或\\ :ref:`回溯物件 `\\ 的事後偵錯。如果沒有" "給定,預設使用目前正在處理的例外,或如果沒有例外則會引發 ``ValueError``。" -#: ../../library/pdb.rst:192 +#: ../../library/pdb.rst:232 msgid "Support for exception objects was added." msgstr "新增對例外物件的支援。" -#: ../../library/pdb.rst:197 +#: ../../library/pdb.rst:237 msgid "" "Enter post-mortem debugging of the exception found in :data:`sys.last_exc`." msgstr "進入在 :data:`sys.last_exc` 中發現的例外的事後偵錯。" -#: ../../library/pdb.rst:201 +#: ../../library/pdb.rst:242 +msgid "" +"There are two supported backends for pdb: ``'settrace'`` and " +"``'monitoring'``. See :class:`bdb.Bdb` for details. The user can set the " +"default backend to use if none is specified when instantiating :class:`Pdb`. " +"If no backend is specified, the default is ``'settrace'``." +msgstr "" + +#: ../../library/pdb.rst:249 +msgid "" +":func:`breakpoint` and :func:`set_trace` will not be affected by this " +"function. They always use ``'monitoring'`` backend." +msgstr "" + +#: ../../library/pdb.rst:256 +msgid "Returns the default backend for pdb." +msgstr "" + +#: ../../library/pdb.rst:260 msgid "" "The ``run*`` functions and :func:`set_trace` are aliases for instantiating " "the :class:`Pdb` class and calling the method of the same name. If you want " @@ -362,11 +429,11 @@ msgstr "" "(instantiate) :class:`Pdb` 類別並呼叫同名方法。如果要使用更多功能,則必須自己" "執行以下操作:" -#: ../../library/pdb.rst:208 +#: ../../library/pdb.rst:267 msgid ":class:`Pdb` is the debugger class." msgstr ":class:`Pdb` 是偵錯器類別。" -#: ../../library/pdb.rst:210 +#: ../../library/pdb.rst:269 msgid "" "The *completekey*, *stdin* and *stdout* arguments are passed to the " "underlying :class:`cmd.Cmd` class; see the description there." @@ -374,7 +441,7 @@ msgstr "" "*completekey*、*stdin* 與 *stdout* 引數會被傳到底層的 :class:`cmd.Cmd` 類別;" "請於該文件閱讀相關敘述。" -#: ../../library/pdb.rst:213 +#: ../../library/pdb.rst:272 msgid "" "The *skip* argument, if given, must be an iterable of glob-style module name " "patterns. The debugger will not step into frames that originate in a module " @@ -383,7 +450,7 @@ msgstr "" "如果給定 *skip* 引數,則它必須是一個給出 glob 樣式之模組名稱的疊代器。如果遇" "到匹配這些樣式的模組,偵錯器將不會進入來自該模組的 frame。 [1]_" -#: ../../library/pdb.rst:217 +#: ../../library/pdb.rst:276 msgid "" "By default, Pdb sets a handler for the SIGINT signal (which is sent when the " "user presses :kbd:`Ctrl-C` on the console) when you give " @@ -396,50 +463,96 @@ msgstr "" "允許你透過按下 :kbd:`Ctrl-C` 再次切入偵錯器。如果你希望 Pdb 不影響到 SIGINT " "處理程式,請將 *nosigint* 設定為 true。" -#: ../../library/pdb.rst:222 +#: ../../library/pdb.rst:281 msgid "" "The *readrc* argument defaults to true and controls whether Pdb will " "load .pdbrc files from the filesystem." msgstr "*readrc* 引數預設為 true,它控制 Pdb 是否從檔案系統載入 .pdbrc 檔案。" -#: ../../library/pdb.rst:225 +#: ../../library/pdb.rst:284 +msgid "" +"The *mode* argument specifies how the debugger was invoked. It impacts the " +"workings of some debugger commands. Valid values are ``'inline'`` (used by " +"the breakpoint() builtin), ``'cli'`` (used by the command line invocation) " +"or ``None`` (for backwards compatible behaviour, as before the *mode* " +"argument was added)." +msgstr "" + +#: ../../library/pdb.rst:291 +msgid "" +"The *backend* argument specifies the backend to use for the debugger. If " +"``None`` is passed, the default backend will be used. " +"See :func:`set_default_backend`. Otherwise the supported backends are " +"``'settrace'`` and ``'monitoring'``." +msgstr "" + +#: ../../library/pdb.rst:295 +msgid "" +"The *colorize* argument, if set to ``True``, will enable colorized output in " +"the debugger, if color is supported. This will highlight source code " +"displayed in pdb." +msgstr "" + +#: ../../library/pdb.rst:298 msgid "Example call to enable tracing with *skip*::" msgstr "啟用追蹤 (tracing) 且帶有 *skip* 引數的呼叫示範: ::" -#: ../../library/pdb.rst:227 +#: ../../library/pdb.rst:300 msgid "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" msgstr "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" -#: ../../library/pdb.rst:229 +#: ../../library/pdb.rst:302 msgid "" "Raises an :ref:`auditing event ` ``pdb.Pdb`` with no arguments." msgstr "" "不帶引數地引發一個\\ :ref:`稽核事件 (auditing event) ` " "``pdb.Pdb``。" -#: ../../library/pdb.rst:231 +#: ../../library/pdb.rst:304 msgid "Added the *skip* parameter." msgstr "新增了 *skip* 參數。" -#: ../../library/pdb.rst:234 +#: ../../library/pdb.rst:307 msgid "" "Added the *nosigint* parameter. Previously, a SIGINT handler was never set " "by Pdb." msgstr "新增了 *nosigint* 參數。以前 SIGINT 處理程式從未被 Pdb 設定過。" -#: ../../library/pdb.rst:238 +#: ../../library/pdb.rst:311 msgid "The *readrc* argument." msgstr "*readrc* 引數。" -#: ../../library/pdb.rst:246 +#: ../../library/pdb.rst:314 +#, fuzzy +msgid "Added the *mode* argument." +msgstr "新增了 *skip* 參數。" + +#: ../../library/pdb.rst:317 +#, fuzzy +msgid "Added the *backend* argument." +msgstr "新增了 *skip* 參數。" + +#: ../../library/pdb.rst:320 +#, fuzzy +msgid "Added the *colorize* argument." +msgstr "新增了 *skip* 參數。" + +#: ../../library/pdb.rst:323 +msgid "" +"Inline breakpoints like :func:`breakpoint` or :func:`pdb.set_trace` will " +"always stop the program at calling frame, ignoring the *skip* pattern (if " +"any)." +msgstr "" + +#: ../../library/pdb.rst:332 msgid "See the documentation for the functions explained above." msgstr "請見上面關於這些函式的文件說明。" -#: ../../library/pdb.rst:252 +#: ../../library/pdb.rst:338 msgid "Debugger Commands" msgstr "偵錯器命令" -#: ../../library/pdb.rst:254 +#: ../../library/pdb.rst:340 msgid "" "The commands recognized by the debugger are listed below. Most commands can " "be abbreviated to one or two letters as indicated; e.g. ``h(elp)`` means " @@ -456,7 +569,7 @@ msgstr "" "空格(空格符 (spaces) 或製表符 (tabs))分隔。在命令語法中,可選引數被括在方括" "號 (``[]``) 中;使用時請勿輸入方括號。命令語法中的選擇項由豎線 (``|``) 分隔。" -#: ../../library/pdb.rst:263 +#: ../../library/pdb.rst:349 msgid "" "Entering a blank line repeats the last command entered. Exception: if the " "last command was a :pdbcmd:`list` command, the next 11 lines are listed." @@ -464,7 +577,7 @@ msgstr "" "輸入一個空白列 (blank line) 將重複上次輸入的命令。例外:如果上一個命令" "是 :pdbcmd:`list` 命令,則會列出接下來的 11 列。" -#: ../../library/pdb.rst:266 +#: ../../library/pdb.rst:352 msgid "" "Commands that the debugger doesn't recognize are assumed to be Python " "statements and are executed in the context of the program being debugged. " @@ -479,13 +592,13 @@ msgstr "" "大方法,甚至可以修改變數或呼叫函式。當此類陳述式發生例外,將印出例外名稱,但" "偵錯器的狀態不會改變。" -#: ../../library/pdb.rst:274 +#: ../../library/pdb.rst:360 msgid "" "Expressions/Statements whose prefix is a pdb command are now correctly " "identified and executed." msgstr "現在可以正確辨識並執行前綴為 pdb 命令的運算式/陳述式。" -#: ../../library/pdb.rst:278 +#: ../../library/pdb.rst:364 msgid "" "The debugger supports :ref:`aliases `. Aliases can have " "parameters which allows one a certain level of adaptability to the context " @@ -494,7 +607,7 @@ msgstr "" "偵錯器有支援設定\\ :ref:`別名 `。別名可以有參數,使得偵錯器" "對被檢查的情境有一定程度的適應性。" -#: ../../library/pdb.rst:282 +#: ../../library/pdb.rst:368 msgid "" "Multiple commands may be entered on a single line, separated by ``;;``. (A " "single ``;`` is not used as it is the separator for multiple commands in a " @@ -509,7 +622,7 @@ msgstr "" "總是在第一處 ``;;`` 被切分開,即使它位於引號內的字串之中。對於具有雙分號字串" "的一個變通解法,是使用隱式字串連接 ``';'';'`` 或 ``\";\"\";\"``。" -#: ../../library/pdb.rst:289 +#: ../../library/pdb.rst:375 msgid "" "To set a temporary global variable, use a *convenience variable*. A " "*convenience variable* is a variable whose name starts with ``$``. For " @@ -523,27 +636,37 @@ msgstr "" "可以在偵錯器會話 (debugger session) 中使用它。當程式恢復執行時,*便利變數*\\ " "將被清除,因此與使用 ``foo = 1`` 等普通變數相比,它不太會去干擾你的程式。" -#: ../../library/pdb.rst:296 -msgid "There are three preset *convenience variables*:" +#: ../../library/pdb.rst:382 +#, fuzzy +msgid "There are four preset *convenience variables*:" msgstr "共有三個預先設定的\\ *便利變數*:" -#: ../../library/pdb.rst:298 +#: ../../library/pdb.rst:384 msgid "``$_frame``: the current frame you are debugging" msgstr "``$_frame``:目前正在偵錯的 frame" -#: ../../library/pdb.rst:299 +#: ../../library/pdb.rst:385 msgid "``$_retval``: the return value if the frame is returning" msgstr "``$_retval``:frame 回傳時的回傳值" -#: ../../library/pdb.rst:300 +#: ../../library/pdb.rst:386 msgid "``$_exception``: the exception if the frame is raising an exception" msgstr "``$_exception``:frame 引發例外時的例外" -#: ../../library/pdb.rst:304 +#: ../../library/pdb.rst:387 +msgid "``$_asynctask``: the asyncio task if pdb stops in an async function" +msgstr "" + +#: ../../library/pdb.rst:391 msgid "Added the *convenience variable* feature." msgstr "新增了\\ *便利變數*\\ 功能。" -#: ../../library/pdb.rst:310 +#: ../../library/pdb.rst:393 +#, fuzzy +msgid "Added the ``$_asynctask`` convenience variable." +msgstr "新增了\\ *便利變數*\\ 功能。" + +#: ../../library/pdb.rst:400 msgid "" "If a file :file:`.pdbrc` exists in the user's home directory or in the " "current directory, it is read with ``'utf-8'`` encoding and executed as if " @@ -557,7 +680,7 @@ msgstr "" "空列和以 ``#`` 開頭的列會被忽略之外。這對於別名設定特別有用。如果兩個檔案都存" "在,則先讀取家目錄中的檔案,且定義於其中的別名可以被本地檔案覆蓋。" -#: ../../library/pdb.rst:317 +#: ../../library/pdb.rst:407 msgid "" ":file:`.pdbrc` can now contain commands that continue debugging, such " "as :pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no " @@ -566,7 +689,7 @@ msgstr "" ":file:`.pdbrc` 現在可以包含繼續偵錯的命令,如 :pdbcmd:`continue` " "或 :pdbcmd:`next`。以前檔案中的這些命令是無效的。" -#: ../../library/pdb.rst:322 +#: ../../library/pdb.rst:412 msgid "" ":file:`.pdbrc` is now read with ``'utf-8'`` encoding. Previously, it was " "read with the system locale encoding." @@ -574,7 +697,7 @@ msgstr "" ":file:`.pdbrc` 現在使用 ``'utf-8'`` 編碼讀取。以前它是使用系統區域設定編碼讀" "取的。" -#: ../../library/pdb.rst:329 +#: ../../library/pdb.rst:419 msgid "" "Without argument, print the list of available commands. With a *command* as " "argument, print help about that command. ``help pdb`` displays the full " @@ -587,16 +710,23 @@ msgstr "" "由於 *command* 引數必須是一個識別字 (identifier),若要取得 ``!`` 命令的幫助訊" "息則必須輸入 ``help exec``。" -#: ../../library/pdb.rst:337 +#: ../../library/pdb.rst:427 +#, fuzzy msgid "" -"Print a stack trace, with the most recent frame at the bottom. An arrow " -"(``>``) indicates the current frame, which determines the context of most " -"commands." +"Print a stack trace, with the most recent frame at the bottom. if *count* " +"is 0, print the current frame entry. If *count* is negative, print the least " +"recent - *count* frames. If *count* is positive, print the most recent " +"*count* frames. An arrow (``>``) indicates the current frame, which " +"determines the context of most commands." msgstr "" "印出 stack trace,最新的 frame 會位於底部。箭頭(``>``)表示目前的 frame,它" "也決定了大多數命令的情境。" -#: ../../library/pdb.rst:342 +#: ../../library/pdb.rst:433 +msgid "*count* argument is added." +msgstr "" + +#: ../../library/pdb.rst:438 msgid "" "Move the current frame *count* (default one) levels down in the stack trace " "(to a newer frame)." @@ -604,7 +734,7 @@ msgstr "" "在 stack trace 中,將目前 frame 向下移動 *count* 級(預設為 1 級,移往較新的 " "frame)。" -#: ../../library/pdb.rst:347 +#: ../../library/pdb.rst:443 msgid "" "Move the current frame *count* (default one) levels up in the stack trace " "(to an older frame)." @@ -612,21 +742,21 @@ msgstr "" "在 stack trace 中,將目前 frame 向上移動 *count* 級(預設為 1 級,移向較舊的 " "frame)。" -#: ../../library/pdb.rst:352 +#: ../../library/pdb.rst:448 +#, fuzzy msgid "" "With a *lineno* argument, set a break at line *lineno* in the current file. " "The line number may be prefixed with a *filename* and a colon, to specify a " "breakpoint in another file (possibly one that hasn't been loaded yet). The " -"file is searched on :data:`sys.path`. Accepatable forms of *filename* are " -"``/abspath/to/file.py``, ``relpath/file.py``, ``module`` and " -"``package.module``." +"file is searched on :data:`sys.path`. Acceptable forms of *filename* are ``/" +"abspath/to/file.py``, ``relpath/file.py``, ``module`` and ``package.module``." msgstr "" "如帶有 *lineno* 引數,則在目前檔案中的 *lineno* 列處設定中斷。列號可以以 " "*filename* 和冒號為前綴,以指定另一個檔案(可能是尚未載入的檔案)中的斷點。該" "檔案會在 :data:`sys.path` 上搜尋。可接受的 *filename* 形式為 ``/abspath/to/" "file.py``、``relpath/file.py``、``module`` 和 ``package.module``。" -#: ../../library/pdb.rst:359 +#: ../../library/pdb.rst:455 msgid "" "With a *function* argument, set a break at the first executable statement " "within that function. *function* can be any expression that evaluates to a " @@ -635,13 +765,13 @@ msgstr "" "如帶有 *function* 引數,在該函式內的第一個可執行陳述式處設定中斷。*function* " "可以是任何其求值結果為目前命名空間中函式的運算式。" -#: ../../library/pdb.rst:363 +#: ../../library/pdb.rst:459 msgid "" "If a second argument is present, it is an expression which must evaluate to " "true before the breakpoint is honored." msgstr "如果第二個引數存在,它是一個運算式,在斷點生效前其必須求值為 true" -#: ../../library/pdb.rst:366 +#: ../../library/pdb.rst:462 msgid "" "Without argument, list all breaks, including for each breakpoint, the number " "of times that breakpoint has been hit, the current ignore count, and the " @@ -650,20 +780,20 @@ msgstr "" "如果不帶引數執行會列出所有斷點資訊,包括每個斷點、命中該斷點的次數、目前的忽" "略次數以及關聯的條件(如存在)。" -#: ../../library/pdb.rst:370 +#: ../../library/pdb.rst:466 msgid "" "Each breakpoint is assigned a number to which all the other breakpoint " "commands refer." msgstr "每個斷點都有賦予一個編號,所有其他斷點命令都參照該編號。" -#: ../../library/pdb.rst:375 +#: ../../library/pdb.rst:471 msgid "" "Temporary breakpoint, which is removed automatically when it is first hit. " "The arguments are the same as for :pdbcmd:`break`." msgstr "" "臨時斷點,在第一次遇見時會自動被刪除。它的引數與 :pdbcmd:`break` 相同。" -#: ../../library/pdb.rst:380 +#: ../../library/pdb.rst:476 msgid "" "With a *filename:lineno* argument, clear all the breakpoints at this line. " "With a space separated list of breakpoint numbers, clear those breakpoints. " @@ -672,7 +802,7 @@ msgstr "" "如帶有 *filename:lineno* 引數,則清除此列上的所有斷點。如果引數是空格分隔的斷" "點編號列表,則清除這些斷點。如果不帶引數則清除所有斷點(但會先提示確認)。" -#: ../../library/pdb.rst:386 +#: ../../library/pdb.rst:482 msgid "" "Disable the breakpoints given as a space separated list of breakpoint " "numbers. Disabling a breakpoint means it cannot cause the program to stop " @@ -682,11 +812,11 @@ msgstr "" "停用斷點,斷點以空格分隔的斷點編號列表來給定。停用斷點表示它不會導致程式停止" "執行,但是與清除斷點不同,停用的斷點將保留在斷點列表中並且可以(重新)啟用。" -#: ../../library/pdb.rst:393 +#: ../../library/pdb.rst:489 msgid "Enable the breakpoints specified." msgstr "啟用指定的斷點。" -#: ../../library/pdb.rst:397 +#: ../../library/pdb.rst:493 msgid "" "Set the ignore count for the given breakpoint number. If *count* is " "omitted, the ignore count is set to 0. A breakpoint becomes active when the " @@ -698,7 +828,7 @@ msgstr "" "為 0 時,斷點將變為有效狀態。當非 0 時,每次到達斷點,且斷點沒有被禁用,且任" "何關聯的條件被求值為 true,則 *count* 就會遞減。" -#: ../../library/pdb.rst:405 +#: ../../library/pdb.rst:501 msgid "" "Set a new *condition* for the breakpoint, an expression which must evaluate " "to true before the breakpoint is honored. If *condition* is absent, any " @@ -707,7 +837,7 @@ msgstr "" "為斷點設定一個新 *condition*,為一個運算式,且其求值結果為 true 時斷點才會起" "作用。如果沒有給定 *condition*,則刪除任何現有條件,也就是不為斷點設定條件。" -#: ../../library/pdb.rst:411 +#: ../../library/pdb.rst:507 msgid "" "Specify a list of commands for breakpoint number *bpnumber*. The commands " "themselves appear on the following lines. Type a line containing just " @@ -716,7 +846,7 @@ msgstr "" "為編號是 *bpnumber* 的斷點指定一系列命令。命令內容出現在後續的幾列中。輸入僅" "包含 ``end`` 的一列來結束命令列表。例如: ::" -#: ../../library/pdb.rst:415 +#: ../../library/pdb.rst:511 msgid "" "(Pdb) commands 1\n" "(com) p some_variable\n" @@ -728,7 +858,7 @@ msgstr "" "(com) end\n" "(Pdb)" -#: ../../library/pdb.rst:420 +#: ../../library/pdb.rst:516 msgid "" "To remove all commands from a breakpoint, type ``commands`` and follow it " "immediately with ``end``; that is, give no commands." @@ -736,12 +866,12 @@ msgstr "" "要刪除斷點上的所有命令,請輸入 ``commands`` 並立即以 ``end`` 結尾,也就是不指" "定任何命令。" -#: ../../library/pdb.rst:423 +#: ../../library/pdb.rst:519 msgid "" "With no *bpnumber* argument, ``commands`` refers to the last breakpoint set." msgstr "不帶有 *bpnumber* 引數則 ``commands`` 會關聯到上一個設定的斷點。" -#: ../../library/pdb.rst:425 +#: ../../library/pdb.rst:521 msgid "" "You can use breakpoint commands to start your program up again. Simply use " "the :pdbcmd:`continue` command, or :pdbcmd:`step`, or any other command that " @@ -750,10 +880,11 @@ msgstr "" "可以使用斷點命令來重新啟動程式,只需使用 :pdbcmd:`continue` " "或 :pdbcmd:`step` 命令,或其他可以繼續執行程式的命令。" -#: ../../library/pdb.rst:429 +#: ../../library/pdb.rst:525 +#, fuzzy msgid "" "Specifying any command resuming execution " -"(currently :pdbcmd:`continue`, :pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`jump`, :pdbcmd:`quit` " +"(currently :pdbcmd:`continue`, :pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`until`, :pdbcmd:`jump`, :pdbcmd:`quit` " "and their abbreviations) terminates the command list (as if that command was " "immediately followed by end). This is because any time you resume execution " "(even with a simple next or step), you may encounter another breakpoint—" @@ -766,19 +897,20 @@ msgstr "" "執行下去(即使是簡單的 next 或 step),都可能會遇到另一個斷點,該斷點可能具有" "自己的命令列表,這會導致無法確定要執行哪個列表。" -#: ../../library/pdb.rst:438 +#: ../../library/pdb.rst:534 msgid "" -"If you use the ``silent`` command in the command list, the usual message " -"about stopping at a breakpoint is not printed. This may be desirable for " -"breakpoints that are to print a specific message and then continue. If none " -"of the other commands print anything, you see no sign that the breakpoint " -"was reached." +"If the list of commands contains the ``silent`` command, or a command that " +"resumes execution, then the breakpoint message containing information about " +"the frame is not displayed." msgstr "" -"如果你在命令列表中使用 ``silent`` 命令,則平常會有的那些關於停止於斷點處的訊" -"息就不會印出。對於要印出特定訊息再繼續的斷點來說,這可能會是需要的功能。如果" -"其他命令都沒有印出任何內容,那你就看不到已到達斷點的跡象。" -#: ../../library/pdb.rst:445 +#: ../../library/pdb.rst:538 +msgid "" +"Frame information will not be displayed if a command that resumes execution " +"is present in the command list." +msgstr "" + +#: ../../library/pdb.rst:544 msgid "" "Execute the current line, stop at the first possible occasion (either in a " "function that is called or on the next line in the current function)." @@ -786,7 +918,7 @@ msgstr "" "執行目前列,在第一個可以停止的位置(在被呼叫的函式內部或在目前函式的下一列)" "停止。" -#: ../../library/pdb.rst:450 +#: ../../library/pdb.rst:549 msgid "" "Continue execution until the next line in the current function is reached or " "it returns. (The difference between :pdbcmd:`next` and :pdbcmd:`step` is " @@ -799,13 +931,13 @@ msgstr "" "而 :pdbcmd:`next`\\ (幾乎)全速執行被呼叫的函式,並僅在目前函式的下一列停" "止。)" -#: ../../library/pdb.rst:458 +#: ../../library/pdb.rst:557 msgid "" "Without argument, continue execution until the line with a number greater " "than the current one is reached." msgstr "如果不帶引數則繼續執行,直到列號比目前的列大時停止。" -#: ../../library/pdb.rst:461 +#: ../../library/pdb.rst:560 msgid "" "With *lineno*, continue execution until a line with a number greater or " "equal to *lineno* is reached. In both cases, also stop when the current " @@ -814,19 +946,19 @@ msgstr "" "如帶有 *lineno* 則繼續執行,直到到達列號大於或等於 *lineno* 的那一列。在這兩" "種情況下,目前 frame 回傳時也會停止。" -#: ../../library/pdb.rst:465 +#: ../../library/pdb.rst:564 msgid "Allow giving an explicit line number." msgstr "允許明確給定一個列號。" -#: ../../library/pdb.rst:470 +#: ../../library/pdb.rst:569 msgid "Continue execution until the current function returns." msgstr "繼續執行,直到目前的函式回傳。" -#: ../../library/pdb.rst:474 +#: ../../library/pdb.rst:573 msgid "Continue execution, only stop when a breakpoint is encountered." msgstr "繼續執行,除非遇到斷點才停下來。" -#: ../../library/pdb.rst:478 +#: ../../library/pdb.rst:577 msgid "" "Set the next line that will be executed. Only available in the bottom-most " "frame. This lets you jump back and execute code again, or jump forward to " @@ -835,7 +967,7 @@ msgstr "" "設定即將執行的下一列,僅可用於堆疊中最底部的 frame。這讓你可以跳回去並再次執" "行程式碼,或者往前跳以跳過不想執行的程式碼。" -#: ../../library/pdb.rst:482 +#: ../../library/pdb.rst:581 msgid "" "It should be noted that not all jumps are allowed -- for instance it is not " "possible to jump into the middle of a :keyword:`for` loop or out of " @@ -844,7 +976,7 @@ msgstr "" "需要注意的是,不是所有的跳轉都是被允許的 -- 例如不能跳轉到 :keyword:`for` 迴" "圈的中間或跳出 :keyword:`finally` 子句。" -#: ../../library/pdb.rst:488 +#: ../../library/pdb.rst:587 msgid "" "List source code for the current file. Without arguments, list 11 lines " "around the current line or continue the previous listing. With ``.`` as " @@ -857,7 +989,7 @@ msgstr "" "列出那一列周圍的 11 列。如果帶有兩個引數,則列出給定範圍中的程式碼;如果第二" "個引數小於第一個引數,則將其直譯為要列出的列數。" -#: ../../library/pdb.rst:494 +#: ../../library/pdb.rst:593 msgid "" "The current line in the current frame is indicated by ``->``. If an " "exception is being debugged, the line where the exception was originally " @@ -867,26 +999,26 @@ msgstr "" "目前 frame 中的目前列會用 ``->`` 標記出來。如果正在偵錯一個例外,且引發或傳遞" "該例外的那一列不是目前列,則會用 ``>>`` 來標記該列。" -#: ../../library/pdb.rst:499 +#: ../../library/pdb.rst:598 msgid "Added the ``>>`` marker." msgstr "新增了 ``>>`` 標記。" -#: ../../library/pdb.rst:504 +#: ../../library/pdb.rst:603 msgid "" "List all source code for the current function or frame. Interesting lines " "are marked as for :pdbcmd:`list`." msgstr "" "列出目前函式或 frame 的所有原始碼。相關列的標記方式與 :pdbcmd:`list` 相同。" -#: ../../library/pdb.rst:511 +#: ../../library/pdb.rst:610 msgid "Print the arguments of the current function and their current values." msgstr "印出目前函式的引數及它們目前的值。" -#: ../../library/pdb.rst:515 +#: ../../library/pdb.rst:614 msgid "Evaluate *expression* in the current context and print its value." msgstr "在目前情境中為 *expression* 求值並印出其值。" -#: ../../library/pdb.rst:519 +#: ../../library/pdb.rst:618 msgid "" "``print()`` can also be used, but is not a debugger command --- this " "executes the Python :func:`print` function." @@ -894,7 +1026,7 @@ msgstr "" "也可以使用 ``print()``,但它不是一個偵錯器命令 --- 它會執行 " "Python :func:`print` 函式。" -#: ../../library/pdb.rst:525 +#: ../../library/pdb.rst:624 msgid "" "Like the :pdbcmd:`p` command, except the value of *expression* is pretty-" "printed using the :mod:`pprint` module." @@ -902,26 +1034,26 @@ msgstr "" "與 :pdbcmd:`p` 命令類似,除了 *expression* 的值是使用 :mod:`pprint` 模組美化" "後印出來的。" -#: ../../library/pdb.rst:530 +#: ../../library/pdb.rst:629 msgid "Print the type of *expression*." msgstr "印出 *expression* 的型別。" -#: ../../library/pdb.rst:534 +#: ../../library/pdb.rst:633 msgid "Try to get source code of *expression* and display it." msgstr "嘗試取得 *expression* 的原始碼並顯示它。" -#: ../../library/pdb.rst:540 +#: ../../library/pdb.rst:639 msgid "" "Display the value of *expression* if it changed, each time execution stops " "in the current frame." msgstr "每次在目前 frame 中停止執行時,顯示 *expression* 的值(如果有變更)。" -#: ../../library/pdb.rst:543 +#: ../../library/pdb.rst:642 msgid "" "Without *expression*, list all display expressions for the current frame." msgstr "如果不帶有 *expression*,則列出目前 frame 的所有運算式。" -#: ../../library/pdb.rst:547 +#: ../../library/pdb.rst:646 msgid "" "Display evaluates *expression* and compares to the result of the previous " "evaluation of *expression*, so when the result is mutable, display may not " @@ -930,11 +1062,11 @@ msgstr "" "display 會對 *expression* 求值並將結果與之前 *expression* 的求值結果進行比" "較,因此當結果可變時,display 可能無法取得其變更。" -#: ../../library/pdb.rst:551 ../../library/pdb.rst:701 +#: ../../library/pdb.rst:650 ../../library/pdb.rst:815 msgid "Example::" msgstr "範例如下: ::" -#: ../../library/pdb.rst:553 +#: ../../library/pdb.rst:652 msgid "" "lst = []\n" "breakpoint()\n" @@ -948,7 +1080,7 @@ msgstr "" "lst.append(1)\n" "print(lst)" -#: ../../library/pdb.rst:559 +#: ../../library/pdb.rst:658 msgid "" "Display won't realize ``lst`` has been changed because the result of " "evaluation is modified in place by ``lst.append(1)`` before being compared::" @@ -956,7 +1088,7 @@ msgstr "" "display 不會意識到 ``lst`` 已更改,因為其求值結果在比較之前已被 " "``lst.append(1)`` 原地 (in place) 修改: ::" -#: ../../library/pdb.rst:562 +#: ../../library/pdb.rst:661 msgid "" "> example.py(3)()\n" "-> pass\n" @@ -982,11 +1114,11 @@ msgstr "" "-> print(lst)\n" "(Pdb)" -#: ../../library/pdb.rst:574 +#: ../../library/pdb.rst:673 msgid "You can do some tricks with copy mechanism to make it work::" msgstr "你可以運用複製機制的一些技巧來使其能夠運作: ::" -#: ../../library/pdb.rst:576 +#: ../../library/pdb.rst:675 msgid "" "> example.py(3)()\n" "-> pass\n" @@ -1014,7 +1146,7 @@ msgstr "" "display lst[:]: [1] [old: []]\n" "(Pdb)" -#: ../../library/pdb.rst:593 +#: ../../library/pdb.rst:692 msgid "" "Do not display *expression* anymore in the current frame. Without " "*expression*, clear all display expressions for the current frame." @@ -1022,7 +1154,7 @@ msgstr "" "不再顯示目前 frame 中的 *expression*。如果不帶有 *expression*,則清除目前 " "frame 的所有顯示運算式。" -#: ../../library/pdb.rst:600 +#: ../../library/pdb.rst:699 msgid "" "Start an interactive interpreter (using the :mod:`code` module) in a new " "global namespace initialised from the local and global namespaces for the " @@ -1033,7 +1165,7 @@ msgstr "" "(使用 :mod:`code` 模組)。可使用 ``exit()`` 或 ``quit()`` 退出直譯器並回到偵" "錯器。" -#: ../../library/pdb.rst:607 +#: ../../library/pdb.rst:706 msgid "" "As ``interact`` creates a new dedicated namespace for code execution, " "assignments to variables will not affect the original namespaces. However, " @@ -1044,12 +1176,12 @@ msgstr "" "影響原始命名空間,但是對任何被參照的可變物件的修改將像往常一樣反映在原始命名" "空間中。" -#: ../../library/pdb.rst:614 +#: ../../library/pdb.rst:713 msgid "" "``exit()`` and ``quit()`` can be used to exit the :pdbcmd:`interact` command." msgstr "``exit()`` 和 ``quit()`` 可用來退出 :pdbcmd:`interact` 命令。" -#: ../../library/pdb.rst:618 +#: ../../library/pdb.rst:717 msgid "" ":pdbcmd:`interact` directs its output to the debugger's output channel " "rather than :data:`sys.stderr`." @@ -1057,7 +1189,7 @@ msgstr "" ":pdbcmd:`interact` 將其輸出導向到偵錯器的輸出通道 (output channel),而不" "是 :data:`sys.stderr`。" -#: ../../library/pdb.rst:626 +#: ../../library/pdb.rst:725 msgid "" "Create an alias called *name* that executes *command*. The *command* must " "*not* be enclosed in quotes. Replaceable parameters can be indicated by " @@ -1070,7 +1202,7 @@ msgstr "" "有參數替換。如果省略 *command*,則顯示 *name* 的目前別名。如果未給定引數,則" "列出所有別名。" -#: ../../library/pdb.rst:632 +#: ../../library/pdb.rst:731 msgid "" "Aliases may be nested and can contain anything that can be legally typed at " "the pdb prompt. Note that internal pdb commands *can* be overridden by " @@ -1082,14 +1214,14 @@ msgstr "" "部 pdb 命令\\ *可以*\\ 被別名所覆蓋。這樣的命令在別名被移除前都將被隱藏。別名" "會遞迴地應用到命令列的第一個單詞;該列內的其他單詞則不會受影響。" -#: ../../library/pdb.rst:638 +#: ../../library/pdb.rst:737 msgid "" "As an example, here are two useful aliases (especially when placed in " "the :file:`.pdbrc` file)::" msgstr "" "作為範例,這裡列出了兩個有用的別名(特別是放在 :file:`.pdbrc` 檔案中時): ::" -#: ../../library/pdb.rst:641 +#: ../../library/pdb.rst:740 msgid "" "# Print instance variables (usage \"pi classInst\")\n" "alias pi for k in %1.__dict__.keys(): print(f\"%1.{k} = {%1.__dict__[k]}\")\n" @@ -1101,11 +1233,11 @@ msgstr "" "# 印出 self 中的實例變數\n" "alias ps pi self" -#: ../../library/pdb.rst:648 +#: ../../library/pdb.rst:747 msgid "Delete the specified alias *name*." msgstr "刪除指定的別名 *name*。" -#: ../../library/pdb.rst:652 +#: ../../library/pdb.rst:751 msgid "" "Execute the (one-line) *statement* in the context of the current stack " "frame. The exclamation point can be omitted unless the first word of the " @@ -1114,7 +1246,7 @@ msgstr "" "在目前 stack frame 的情境中執行(單列)\\ *statement*。除非陳述式的第一個單詞" "類似於偵錯器命令,否則可以省略驚嘆號,例如:" -#: ../../library/pdb.rst:656 +#: ../../library/pdb.rst:755 msgid "" "(Pdb) ! n=42\n" "(Pdb)" @@ -1122,7 +1254,7 @@ msgstr "" "(Pdb) ! n=42\n" "(Pdb)" -#: ../../library/pdb.rst:661 +#: ../../library/pdb.rst:760 msgid "" "To set a global variable, you can prefix the assignment command with " "a :keyword:`global` statement on the same line, e.g.:" @@ -1130,7 +1262,7 @@ msgstr "" "要設定全域變數,你可以在同一列的賦值命令前面加上 :keyword:`global` 陳述式,例" "如:" -#: ../../library/pdb.rst:664 +#: ../../library/pdb.rst:763 msgid "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" @@ -1138,7 +1270,7 @@ msgstr "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" -#: ../../library/pdb.rst:672 +#: ../../library/pdb.rst:771 msgid "" "Restart the debugged Python program. If *args* is supplied, it is split " "with :mod:`shlex` and the result is used as the new :data:`sys.argv`. " @@ -1149,11 +1281,35 @@ msgstr "" "割,並將結果用作新的 :data:`sys.argv`。歷史記錄、斷點、操作和偵錯器選項均會被" "保留。:pdbcmd:`restart` 是 :pdbcmd:`run` 的別名。" -#: ../../library/pdb.rst:679 -msgid "Quit from the debugger. The program being executed is aborted." +#: ../../library/pdb.rst:776 +msgid "" +":pdbcmd:`run` and :pdbcmd:`restart` commands are disabled when the debugger " +"is invoked in ``'inline'`` mode." +msgstr "" + +#: ../../library/pdb.rst:782 +#, fuzzy +msgid "" +"Quit from the debugger. The program being executed is aborted. An end-of-" +"file input is equivalent to :pdbcmd:`quit`." msgstr "離開偵錯器,執行中的程式會被中止。" -#: ../../library/pdb.rst:683 +#: ../../library/pdb.rst:785 +msgid "" +"A confirmation prompt will be shown if the debugger is invoked in " +"``'inline'`` mode. Either ``y``, ``Y``, ```` or ``EOF`` will confirm " +"the quit." +msgstr "" + +#: ../../library/pdb.rst:789 +msgid "" +"A confirmation prompt will be shown if the debugger is invoked in " +"``'inline'`` mode. After the confirmation, the debugger will " +"call :func:`sys.exit` immediately, instead of raising :exc:`bdb.BdbQuit` in " +"the next trace event." +msgstr "" + +#: ../../library/pdb.rst:797 msgid "" "Enter a recursive debugger that steps through *code* (which is an arbitrary " "expression or statement to be executed in the current environment)." @@ -1161,15 +1317,15 @@ msgstr "" "進入一個遞迴偵錯器,逐步執行 *code*\\ (這是要在目前環境中執行的任意運算式或" "陳述式)。" -#: ../../library/pdb.rst:689 +#: ../../library/pdb.rst:803 msgid "Print the return value for the last return of the current function." msgstr "印出目前函式最後一次回傳的回傳值。" -#: ../../library/pdb.rst:693 +#: ../../library/pdb.rst:807 msgid "List or jump between chained exceptions." msgstr "列出鏈接例外 (chained exceptions),或在其間跳轉。" -#: ../../library/pdb.rst:695 +#: ../../library/pdb.rst:809 msgid "" "When using ``pdb.pm()`` or ``Pdb.post_mortem(...)`` with a chained " "exception instead of a traceback, it allows the user to move between the " @@ -1180,7 +1336,7 @@ msgstr "" "許使用者在鏈接例外之間移動,使用 ``exceptions`` 命令以列出例外,並使用 " "``exceptions `` 切換到該例外。" -#: ../../library/pdb.rst:703 +#: ../../library/pdb.rst:817 msgid "" "def out():\n" " try:\n" @@ -1216,11 +1372,11 @@ msgstr "" "\n" " out()" -#: ../../library/pdb.rst:720 +#: ../../library/pdb.rst:834 msgid "calling ``pdb.pm()`` will allow to move between exceptions::" msgstr "呼叫 ``pdb.pm()`` 將允許在例外之間移動: ::" -#: ../../library/pdb.rst:722 +#: ../../library/pdb.rst:836 msgid "" "> example.py(5)out()\n" "-> raise ValueError(\"reraise middle() error\") from e\n" @@ -1254,11 +1410,11 @@ msgstr "" "> example.py(10)middle()\n" "-> return inner(0)" -#: ../../library/pdb.rst:741 +#: ../../library/pdb.rst:855 msgid "Footnotes" msgstr "註腳" -#: ../../library/pdb.rst:742 +#: ../../library/pdb.rst:856 msgid "" "Whether a frame is considered to originate in a certain module is determined " "by the ``__name__`` in the frame globals." @@ -1286,21 +1442,29 @@ msgstr "bdb" msgid "cmd" msgstr "cmd" -#: ../../library/pdb.rst:306 +#: ../../library/pdb.rst:396 msgid ".pdbrc" msgstr ".pdbrc" -#: ../../library/pdb.rst:306 +#: ../../library/pdb.rst:396 msgid "file" msgstr "file(檔案)" -#: ../../library/pdb.rst:306 +#: ../../library/pdb.rst:396 msgid "debugger" msgstr "debugger(偵錯器)" -#: ../../library/pdb.rst:306 +#: ../../library/pdb.rst:396 msgid "configuration" msgstr "configuration(設定)" -#~ msgid "python -m pdb myscript.py" -#~ msgstr "python -m pdb myscript.py" +#~ msgid "" +#~ "If you use the ``silent`` command in the command list, the usual message " +#~ "about stopping at a breakpoint is not printed. This may be desirable for " +#~ "breakpoints that are to print a specific message and then continue. If " +#~ "none of the other commands print anything, you see no sign that the " +#~ "breakpoint was reached." +#~ msgstr "" +#~ "如果你在命令列表中使用 ``silent`` 命令,則平常會有的那些關於停止於斷點處的" +#~ "訊息就不會印出。對於要印出特定訊息再繼續的斷點來說,這可能會是需要的功能。" +#~ "如果其他命令都沒有印出任何內容,那你就看不到已到達斷點的跡象。" diff --git a/library/pickle.po b/library/pickle.po index f0d214959df..da8f3d678e4 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -304,10 +304,11 @@ msgstr "" "被 2.x 版本的 Python 拆封。在 3.0~3.7 的 Python 預設使用 3 版協定。" #: ../../library/pickle.rst:157 +#, fuzzy msgid "" "Protocol version 4 was added in Python 3.4. It adds support for very large " "objects, pickling more kinds of objects, and some data format " -"optimizations. It is the default protocol starting with Python 3.8. Refer " +"optimizations. This was the default protocol in Python 3.8--3.13. Refer " "to :pep:`3154` for information about improvements brought by protocol 4." msgstr "" "版本 4 的協定在 Python 3.4 被新增。現在能支援超大物件的封裝、更多種型別的物件" @@ -315,10 +316,12 @@ msgstr "" "請參閱 :pep:`3154` 以了解第 4 版協定改進的細節。" #: ../../library/pickle.rst:163 +#, fuzzy msgid "" "Protocol version 5 was added in Python 3.8. It adds support for out-of-band " -"data and speedup for in-band data. Refer to :pep:`574` for information " -"about improvements brought by protocol 5." +"data and speedup for in-band data. It is the default protocol starting with " +"Python 3.14. Refer to :pep:`574` for information about improvements brought " +"by protocol 5." msgstr "" "版本 5 的協定在 Python 3.8 被新增。現在能支援帶外資料(Out-of-band data)並加" "速帶內資料的處理速度。請參閱 :pep:`574` 以了解第 5 版協定改進的細節。" @@ -330,7 +333,7 @@ msgstr "" # tw/%E5%8F%AF%E6%8C%81%E4%B9%85%E5%8C%96%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84 # https://1fly2sky.wordpress.com/2016/04/05/%E6%8C%81%E4%B9%85%E5%B1%A4data- # persistence-layer/ -#: ../../library/pickle.rst:168 +#: ../../library/pickle.rst:169 msgid "" "Serialization is a more primitive notion than persistence; " "although :mod:`pickle` reads and writes file objects, it does not handle the " @@ -351,11 +354,11 @@ msgstr "" "提供了一個簡單的介面來讓使用者在 DBM 風格的資料庫檔案中對物件進行封裝和拆封的" "操作。" -#: ../../library/pickle.rst:181 +#: ../../library/pickle.rst:182 msgid "Module Interface" msgstr "模組介面" -#: ../../library/pickle.rst:183 +#: ../../library/pickle.rst:184 msgid "" "To serialize an object hierarchy, you simply call the :func:`dumps` " "function. Similarly, to de-serialize a data stream, you call " @@ -368,11 +371,11 @@ msgstr "" "化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` " "或 :class:`Unpickler` 物件。" -#: ../../library/pickle.rst:188 +#: ../../library/pickle.rst:189 msgid "The :mod:`pickle` module provides the following constants:" msgstr ":mod:`pickle` 模組提供以下常數:" -#: ../../library/pickle.rst:193 +#: ../../library/pickle.rst:194 msgid "" "An integer, the highest :ref:`protocol version ` " "available. This value can be passed as a *protocol* value to " @@ -383,32 +386,40 @@ msgstr "" "為 *protocol* 的數值傳給 :func:`dump` 和 :func:`dumps` 函式以" "及 :class:`Pickler` 建構式。" -#: ../../library/pickle.rst:200 +#: ../../library/pickle.rst:201 +#, fuzzy msgid "" "An integer, the default :ref:`protocol version ` used for " "pickling. May be less than :data:`HIGHEST_PROTOCOL`. Currently the default " -"protocol is 4, first introduced in Python 3.4 and incompatible with previous " -"versions." +"protocol is 5, introduced in Python 3.8 and incompatible with previous " +"versions. This version introduces support for out-of-band buffers, " +"where :pep:`3118`-compatible data can be transmitted separately from the " +"main pickle stream." msgstr "" "一個整數,指示用於序列化的預設\\ :ref:`協定版本 `。有可能小" "於 :data:`HIGHEST_PROTOCOL`。目前的預設協定版本為 4,是在 Python 3.4 中首次引" "入的,且與先前版本不相容。" -#: ../../library/pickle.rst:207 +#: ../../library/pickle.rst:210 msgid "The default protocol is 3." msgstr "預設協定版本為 3。" -#: ../../library/pickle.rst:211 +#: ../../library/pickle.rst:214 msgid "The default protocol is 4." msgstr "預設協定版本為 4。" -#: ../../library/pickle.rst:213 +#: ../../library/pickle.rst:218 +#, fuzzy +msgid "The default protocol is 5." +msgstr "預設協定版本為 3。" + +#: ../../library/pickle.rst:220 msgid "" "The :mod:`pickle` module provides the following functions to make the " "pickling process more convenient:" msgstr ":mod:`pickle` 模組提供下列函式來簡化封裝的過程:" -#: ../../library/pickle.rst:218 +#: ../../library/pickle.rst:225 msgid "" "Write the pickled representation of the object *obj* to the open :term:`file " "object` *file*. This is equivalent to ``Pickler(file, protocol).dump(obj)``." @@ -416,7 +427,7 @@ msgstr "" "將被封裝成 pickle 形式的物件 *obj* 寫入到已開啟的\\ :term:`file object` " "*file*。這等效於\\ ``Pickler(file, protocol).dump(obj)``。" -#: ../../library/pickle.rst:222 +#: ../../library/pickle.rst:229 msgid "" "Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have the " "same meaning as in the :class:`Pickler` constructor." @@ -424,12 +435,12 @@ msgstr "" "引數 *file*、*protocol*、*fix_imports* 和 *buffer_callback* 的意義" "與 :class:`Pickler` 建構式中的相同。" -#: ../../library/pickle.rst:225 ../../library/pickle.rst:236 -#: ../../library/pickle.rst:328 +#: ../../library/pickle.rst:232 ../../library/pickle.rst:243 +#: ../../library/pickle.rst:335 msgid "The *buffer_callback* argument was added." msgstr "新增 *buffer_callback* 引數。" -#: ../../library/pickle.rst:230 +#: ../../library/pickle.rst:237 msgid "" "Return the pickled representation of the object *obj* as a :class:`bytes` " "object, instead of writing it to a file." @@ -437,7 +448,7 @@ msgstr "" "將被封裝為 pickle 形式的物件 *obj* 以 :class:`bytes` 類別回傳,而非寫入進檔" "案。" -#: ../../library/pickle.rst:233 +#: ../../library/pickle.rst:240 msgid "" "Arguments *protocol*, *fix_imports* and *buffer_callback* have the same " "meaning as in the :class:`Pickler` constructor." @@ -445,7 +456,7 @@ msgstr "" "引數 *protocol*、*fix_imports* 和 *buffer_callback* 的意義" "和 :class:`Pickler` 建構式中的相同。" -#: ../../library/pickle.rst:241 +#: ../../library/pickle.rst:248 msgid "" "Read the pickled representation of an object from the open :term:`file " "object` *file* and return the reconstituted object hierarchy specified " @@ -454,7 +465,7 @@ msgstr "" "從已開啟的 :term:`檔案物件 ` *file* 中讀取已序列化的物件,並傳回" "其重建後的物件階層。這相當於呼叫 ``Unpickler(file).load()``。" -#: ../../library/pickle.rst:245 ../../library/pickle.rst:260 +#: ../../library/pickle.rst:252 ../../library/pickle.rst:267 msgid "" "The protocol version of the pickle is detected automatically, so no protocol " "argument is needed. Bytes past the pickled representation of the object are " @@ -463,7 +474,7 @@ msgstr "" "模組會自動偵測 pickle 封包所使用的協定版本,所以無須另外指定。超出 pickle 封" "包表示範圍的位元組將被忽略。" -#: ../../library/pickle.rst:249 +#: ../../library/pickle.rst:256 msgid "" "Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and " "*buffers* have the same meaning as in the :class:`Unpickler` constructor." @@ -471,12 +482,12 @@ msgstr "" "引數 *file*、*fix_imports*、*encoding*、*errors*、*strict* 和 *buffers* 的意" "義和 :class:`Unpickler` 建構式中的相同。" -#: ../../library/pickle.rst:252 ../../library/pickle.rst:267 -#: ../../library/pickle.rst:433 +#: ../../library/pickle.rst:259 ../../library/pickle.rst:274 +#: ../../library/pickle.rst:449 msgid "The *buffers* argument was added." msgstr "新增 *buffer* 引數。" -#: ../../library/pickle.rst:257 +#: ../../library/pickle.rst:264 msgid "" "Return the reconstituted object hierarchy of the pickled representation " "*data* of an object. *data* must be a :term:`bytes-like object`." @@ -484,7 +495,7 @@ msgstr "" "回傳從 *data* 的 pickle 封包重建後的物件階層。*data* 必須是一個 :term:`bytes-" "like object`。" -#: ../../library/pickle.rst:264 +#: ../../library/pickle.rst:271 msgid "" "Arguments *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have " "the same meaning as in the :class:`Unpickler` constructor." @@ -492,18 +503,18 @@ msgstr "" "引數 *fix_imports*、*encoding*、*errors*、*strict* 和 *buffers* 的意義" "與 :class:`Unpickler` 建構式所用的相同。" -#: ../../library/pickle.rst:271 +#: ../../library/pickle.rst:278 msgid "The :mod:`pickle` module defines three exceptions:" msgstr ":mod:`pickle` 模組定義了以下三種例外:" -#: ../../library/pickle.rst:275 +#: ../../library/pickle.rst:282 msgid "" "Common base class for the other pickling exceptions. It inherits " "from :exc:`Exception`." msgstr "" "繼承 :exc:`Exception` 類別。一個在封裝或拆封時遭遇其他例外時通用的基底類別。" -#: ../../library/pickle.rst:280 +#: ../../library/pickle.rst:287 msgid "" "Error raised when an unpicklable object is encountered by :class:`Pickler`. " "It inherits from :exc:`PickleError`." @@ -511,13 +522,13 @@ msgstr "" "當 :class:`Pickler` 遭遇無法封裝物件時會引發的例外。繼承 :exc:`PickleError` " "類別。" -#: ../../library/pickle.rst:283 +#: ../../library/pickle.rst:290 msgid "" "Refer to :ref:`pickle-picklable` to learn what kinds of objects can be " "pickled." msgstr "請參閱 :ref:`pickle-picklable` 以了解哪些物件是可以被封裝的。" -#: ../../library/pickle.rst:288 +#: ../../library/pickle.rst:295 msgid "" "Error raised when there is a problem unpickling an object, such as a data " "corruption or a security violation. It inherits from :exc:`PickleError`." @@ -525,7 +536,7 @@ msgstr "" "拆封物件時遇到問題(如資料毀損或違反安全性原則等)所引發的意外。繼承" "自 :exc:`PickleError` 類別。" -#: ../../library/pickle.rst:291 +#: ../../library/pickle.rst:298 msgid "" "Note that other exceptions may also be raised during unpickling, including " "(but not necessarily limited to) AttributeError, EOFError, ImportError, and " @@ -534,7 +545,7 @@ msgstr "" "拆封的時候還是可能會遭遇其他不在此列的例外(例如:AttributeError、EOFError、" "ImportError、或 IndexError),請注意。" -#: ../../library/pickle.rst:296 +#: ../../library/pickle.rst:303 msgid "" "The :mod:`pickle` module exports three " "classes, :class:`Pickler`, :class:`Unpickler` and :class:`PickleBuffer`:" @@ -542,11 +553,11 @@ msgstr "" "引入模組 :mod:`pickle` 時會帶來三個類" "別::class:`Pickler`、:class:`Unpickler` 和 :class:`PickleBuffer`:" -#: ../../library/pickle.rst:301 +#: ../../library/pickle.rst:308 msgid "This takes a binary file for writing a pickle data stream." msgstr "接受一個用以寫入 pickle 資料流的二進位檔案。" -#: ../../library/pickle.rst:303 +#: ../../library/pickle.rst:310 msgid "" "The optional *protocol* argument, an integer, tells the pickler to use the " "given protocol; supported protocols are 0 to :data:`HIGHEST_PROTOCOL`. If " @@ -558,7 +569,7 @@ msgstr "" "為 :data:`DEFAULT_PROTOCOL`。若指定了負數,則視為選" "擇 :data:`HIGHEST_PROTOCOL`。" -#: ../../library/pickle.rst:308 +#: ../../library/pickle.rst:315 msgid "" "The *file* argument must have a write() method that accepts a single bytes " "argument. It can thus be an on-disk file opened for binary writing, " @@ -569,7 +580,7 @@ msgstr "" "的物件可以是一個硬碟上二進位檔案、一個 :class:`io.BytesIO` 實例或任何其他滿足" "這個介面要求的物件。" -#: ../../library/pickle.rst:313 +#: ../../library/pickle.rst:320 msgid "" "If *fix_imports* is true and *protocol* is less than 3, pickle will try to " "map the new Python 3 names to the old module names used in Python 2, so that " @@ -583,7 +594,7 @@ msgstr "" # 應作何翻譯? # out-of-band 目前參考 https://kb.synology.com/zh- # tw/DSM/tutorial/Quick_Start_OOB_Management `帶外管理` 譯作 `帶外` -#: ../../library/pickle.rst:317 +#: ../../library/pickle.rst:324 msgid "" "If *buffer_callback* is ``None`` (the default), buffer views are serialized " "into *file* as part of the pickle stream." @@ -591,7 +602,7 @@ msgstr "" "如果 *buffer_callback* 是 ``None``\\ (預設值),緩衝區的視圖會作為 pickle 封" "裝串流的一部分被序列化進 *file* 中。" -#: ../../library/pickle.rst:320 +#: ../../library/pickle.rst:327 msgid "" "If *buffer_callback* is not ``None``, then it can be called any number of " "times with a buffer view. If the callback returns a false value (such as " @@ -603,7 +614,7 @@ msgstr "" "帶外資料 `;否則,該緩衝區將被視為 pickle 串流的帶內資料被序列" "化。" -#: ../../library/pickle.rst:325 +#: ../../library/pickle.rst:332 msgid "" "It is an error if *buffer_callback* is not ``None`` and *protocol* is " "``None`` or smaller than 5." @@ -611,19 +622,19 @@ msgstr "" "如果 *buffer_callback* 不是 ``None`` 且 *protocol* 是 ``None`` 或小於 5 則會" "報錯。" -#: ../../library/pickle.rst:333 +#: ../../library/pickle.rst:340 msgid "" "Write the pickled representation of *obj* to the open file object given in " "the constructor." msgstr "將已封裝(pickled)的 *obj* 寫入已在建構式中開啟的對應檔案。" -#: ../../library/pickle.rst:338 +#: ../../library/pickle.rst:345 msgid "Do nothing by default. This exists so a subclass can override it." msgstr "" "預設不進行任何動作。這是一種抽象方法,用於讓後續繼承這個類別的物件可以覆寫本" "方法函式。" -#: ../../library/pickle.rst:340 +#: ../../library/pickle.rst:347 msgid "" "If :meth:`persistent_id` returns ``None``, *obj* is pickled as usual. Any " "other value causes :class:`Pickler` to emit the returned value as a " @@ -636,11 +647,11 @@ msgstr "" "碼回傳。此永久識別碼的意義應由 :meth:`Unpickler.persistent_load` 定義。請注" "意 :meth:`persistent_id` 回傳的值本身不能擁有自己的永久識別碼。" -#: ../../library/pickle.rst:346 ../../library/pickle.rst:451 +#: ../../library/pickle.rst:353 ../../library/pickle.rst:467 msgid "See :ref:`pickle-persistent` for details and examples of uses." msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" -#: ../../library/pickle.rst:348 +#: ../../library/pickle.rst:355 msgid "" "Add the default implementation of this method in the C implementation " "of :class:`!Pickler`." @@ -653,7 +664,7 @@ msgstr "在 C 的 :class:`!Pickler` 實作中的增加了這個方法的預設 # reduction function -> 縮減函式 # 這個是指reduce()函式類型的運算,類似sql的aggregation類型運算,故參閱以下內文,譯為縮減 # https://support.google.com/docs/answer/12657238?hl=zh-Hant -#: ../../library/pickle.rst:354 +#: ../../library/pickle.rst:361 msgid "" "A pickler object's dispatch table is a registry of *reduction functions* of " "the kind which can be declared using :func:`copyreg.pickle`. It is a " @@ -666,7 +677,7 @@ msgstr "" "一個以類別為鍵、還原函式為值的映射表。縮減函式應準備接收一個對應類別的引數," "並應遵循與 :meth:`~object.__reduce__` 方法相同的介面。" -#: ../../library/pickle.rst:362 +#: ../../library/pickle.rst:369 msgid "" "By default, a pickler object will not have a :attr:`dispatch_table` " "attribute, and it will instead use the global dispatch table managed by " @@ -682,11 +693,11 @@ msgstr "" "如果 :class:`Pickler` 的子類別具有 :attr:`dispatch_table` 屬性,那麼這個屬性" "將作為該子類別實例的預設調度表。" -#: ../../library/pickle.rst:371 +#: ../../library/pickle.rst:378 msgid "See :ref:`pickle-dispatch` for usage examples." msgstr "關於用法範例請見 :ref:`pickle-dispatch`。" -#: ../../library/pickle.rst:377 +#: ../../library/pickle.rst:384 msgid "" "Special reducer that can be defined in :class:`Pickler` subclasses. This " "method has priority over any reducer in the :attr:`dispatch_table`. It " @@ -700,11 +711,11 @@ msgstr "" "傳 :data:`NotImplemented` 以後備(fallback)使用 :attr:`分派表 " "` 中登錄的縮減方法來封裝 ``obj``。" -#: ../../library/pickle.rst:383 +#: ../../library/pickle.rst:390 msgid "For a detailed example, see :ref:`reducer_override`." msgstr "請查閱 :ref:`reducer_override` 來參考其他較詳細的範例。" -#: ../../library/pickle.rst:389 +#: ../../library/pickle.rst:396 msgid "" "Deprecated. Enable fast mode if set to a true value. The fast mode disables " "the usage of memo, therefore speeding the pickling process by not generating " @@ -715,21 +726,32 @@ msgstr "" "過不產生多餘的 PUT 操作碼(OpCode)來加速封裝過程。它不應被用於自我參照物件," "否則將導致 :class:`Pickler` 陷入無限遞迴。" -#: ../../library/pickle.rst:395 +#: ../../library/pickle.rst:402 msgid "Use :func:`pickletools.optimize` if you need more compact pickles." msgstr "使用 :func:`pickletools.optimize` 以獲得更緊湊的 pickle 輸出。" -#: ../../library/pickle.rst:400 +#: ../../library/pickle.rst:406 +msgid "Clears the pickler's \"memo\"." +msgstr "" + +#: ../../library/pickle.rst:408 +msgid "" +"The memo is the data structure that remembers which objects the pickler has " +"already seen, so that shared or recursive objects are pickled by reference " +"and not by value. This method is useful when re-using picklers." +msgstr "" + +#: ../../library/pickle.rst:416 msgid "This takes a binary file for reading a pickle data stream." msgstr "這個物件接受一個二進位檔案 *file* 來從中讀取 pickle 資料流。" -#: ../../library/pickle.rst:402 +#: ../../library/pickle.rst:418 msgid "" "The protocol version of the pickle is detected automatically, so no protocol " "argument is needed." msgstr "協定版本號會被自動偵測,所以不需要在這邊手動輸入。" -#: ../../library/pickle.rst:405 +#: ../../library/pickle.rst:421 msgid "" "The argument *file* must have three methods, a read() method that takes an " "integer argument, a readinto() method that takes a buffer argument and a " @@ -743,7 +765,7 @@ msgstr "" "在 :class:`io.BufferedIOBase` 的介面一樣。因此,*file* 可以是一個以二進位讀取" "模式開啟的檔案、一個 :class:`io.BytesIO` 物件、或任何符合此介面的自訂物件。" -#: ../../library/pickle.rst:412 +#: ../../library/pickle.rst:428 msgid "" "The optional arguments *fix_imports*, *encoding* and *errors* are used to " "control compatibility support for pickle stream generated by Python 2. If " @@ -765,7 +787,7 @@ msgstr "" "列、:class:`~datetime.datetime`、:class:`~datetime.date` " "和 :class:`~datetime.time` 的實例則必須使用 ``encoding='latin1'`` 來拆封。" -#: ../../library/pickle.rst:423 +#: ../../library/pickle.rst:439 msgid "" "If *buffers* is ``None`` (the default), then all data necessary for " "deserialization must be contained in the pickle stream. This means that the " @@ -776,7 +798,7 @@ msgstr "" "包含在 pickle 串流中。這意味著當初在建立對應的 :class:`Pickler` 時(或在呼" "叫 :func:`dump` 或 :func:`dumps` 時)*buffer_callback* 引數必須為 ``None``。" -#: ../../library/pickle.rst:428 +#: ../../library/pickle.rst:444 msgid "" "If *buffers* is not ``None``, it should be an iterable of buffer-enabled " "objects that is consumed each time the pickle stream references an :ref:`out-" @@ -788,7 +810,7 @@ msgstr "" "將會被照順序消耗。這些緩衝資料當初建立時應已按照順序給定於 Pickler 物件中的 " "*buffer_callback*。" -#: ../../library/pickle.rst:438 +#: ../../library/pickle.rst:454 msgid "" "Read the pickled representation of an object from the open file object given " "in the constructor, and return the reconstituted object hierarchy specified " @@ -797,11 +819,11 @@ msgstr "" "開啟先前被傳入建構子的檔案,從中讀取一個被 pickle 封裝的物件,並回傳重建完成" "的物件階層。超過 pickle 表示範圍的位元組會被忽略。" -#: ../../library/pickle.rst:445 +#: ../../library/pickle.rst:461 msgid "Raise an :exc:`UnpicklingError` by default." msgstr "預設會引發 :exc:`UnpicklingError` 例外。" -#: ../../library/pickle.rst:447 +#: ../../library/pickle.rst:463 msgid "" "If defined, :meth:`persistent_load` should return the object specified by " "the persistent ID *pid*. If an invalid persistent ID is encountered, " @@ -810,13 +832,13 @@ msgstr "" "若有定義,則 :meth:`persistent_load` 將回傳符合持久化識別碼 *pid* 的物件。如" "果遭遇了無效的持久化識別碼,則會引發 :exc:`UnpicklingError`。" -#: ../../library/pickle.rst:453 +#: ../../library/pickle.rst:469 msgid "" "Add the default implementation of this method in the C implementation " "of :class:`!Unpickler`." msgstr "在 C 的 :class:`!Unpickler` 實作中的增加了這個方法的預設實作。" -#: ../../library/pickle.rst:459 +#: ../../library/pickle.rst:475 msgid "" "Import *module* if necessary and return the object called *name* from it, " "where the *module* and *name* arguments are :class:`str` objects. Note, " @@ -827,7 +849,7 @@ msgstr "" "*name* 引數接受的輸入是 :class:`str` 物件。注意,雖然名稱上看起來不像," "但 :meth:`find_class` 亦可被用於尋找其他函式。" -#: ../../library/pickle.rst:464 +#: ../../library/pickle.rst:480 msgid "" "Subclasses may override this to gain control over what type of objects and " "how they can be loaded, potentially reducing security risks. Refer " @@ -836,7 +858,7 @@ msgstr "" "子類別可以覆寫此方法以控制可以載入哪些類型的物件、以及如何載入它們,從而潛在" "地降低安全性風險。詳情請參考\\ :ref:`pickle-restrict`。" -#: ../../library/pickle.rst:468 +#: ../../library/pickle.rst:484 msgid "" "Raises an :ref:`auditing event ` ``pickle.find_class`` with " "arguments ``module``, ``name``." @@ -847,7 +869,7 @@ msgstr "" # SkyLull: [T] # 參見 #729 # wrapper -> 包裝器 -#: ../../library/pickle.rst:472 +#: ../../library/pickle.rst:488 msgid "" "A wrapper for a buffer representing picklable data. *buffer* must be " "a :ref:`buffer-providing ` object, such as a :term:`bytes-" @@ -857,7 +879,7 @@ msgstr "" "一個 :ref:`提供緩衝區 ` 的物件,例如一個 :term:`類位元組物件 " "` 或 N 維陣列。" -#: ../../library/pickle.rst:476 +#: ../../library/pickle.rst:492 msgid "" ":class:`PickleBuffer` is itself a buffer provider, therefore it is possible " "to pass it to other APIs expecting a buffer-providing object, such " @@ -866,7 +888,7 @@ msgstr "" ":class:`PickleBuffer` 本身就是一個提供緩衝區的物件,所以是能夠將其提供給其它" "「預期收到含有緩衝物件的 API」的,比如 :class:`memoryview`。" -#: ../../library/pickle.rst:480 +#: ../../library/pickle.rst:496 msgid "" ":class:`PickleBuffer` objects can only be serialized using pickle protocol 5 " "or higher. They are eligible for :ref:`out-of-band serialization 限定名稱 -#: ../../library/pickle.rst:529 +#: ../../library/pickle.rst:545 msgid "" "Note that functions (built-in and user-defined) are pickled by " "fully :term:`qualified name`, not by value. [#]_ This means that only the " @@ -978,7 +1000,7 @@ msgstr "" "拆封該物件的環境中,定義此函式的模組必須可被引入,且該模組必須包含具此命名之" "物件,否則將引發例外。 [#]_" -#: ../../library/pickle.rst:536 +#: ../../library/pickle.rst:552 msgid "" "Similarly, classes are pickled by fully qualified name, so the same " "restrictions in the unpickling environment apply. Note that none of the " @@ -989,7 +1011,7 @@ msgstr "" "上的限制。類別中的程式碼或資料皆不會被封裝,因此在以下範例中,注意到類別屬性 " "``attr`` 在拆封的環境中不會被還原::" -#: ../../library/pickle.rst:541 +#: ../../library/pickle.rst:557 msgid "" "class Foo:\n" " attr = 'A class attribute'\n" @@ -1001,13 +1023,13 @@ msgstr "" "\n" "picklestring = pickle.dumps(Foo)" -#: ../../library/pickle.rst:546 +#: ../../library/pickle.rst:562 msgid "" "These restrictions are why picklable functions and classes must be defined " "at the top level of a module." msgstr "這些限制就是可封裝的函式和類別必須被定義在模組頂層的原因。" -#: ../../library/pickle.rst:549 +#: ../../library/pickle.rst:565 msgid "" "Similarly, when class instances are pickled, their class's code and data are " "not pickled along with them. Only the instance data are pickled. This is " @@ -1024,11 +1046,11 @@ msgstr "" "計將有長期存在的物件、且該物件將經歷許多版本的更替,你可以在物件中存放一個版" "本號,以便未來能透過 :meth:`~object.__setstate__` 方法來進行適當的版本轉換。" -#: ../../library/pickle.rst:561 +#: ../../library/pickle.rst:577 msgid "Pickling Class Instances" msgstr "Pickling 類別實例" -#: ../../library/pickle.rst:565 +#: ../../library/pickle.rst:581 msgid "" "In this section, we describe the general mechanisms available to you to " "define, customize, and control how class instances are pickled and unpickled." @@ -1036,7 +1058,7 @@ msgstr "" "在這一個章節,我們會講述如何封裝或拆封一個物件實例的相關機制,以方便你進行自" "訂。" -#: ../../library/pickle.rst:568 +#: ../../library/pickle.rst:584 msgid "" "In most cases, no additional code is needed to make instances picklable. By " "default, pickle will retrieve the class and the attributes of an instance " @@ -1051,7 +1073,7 @@ msgstr "" "其 :meth:`~object.__init__` 方法通常\\ *不會*\\ 被呼叫。預設行為首先會建立一" "個未初始化的實例,然後還原紀錄中的屬性。以下程式碼的實作展示了前述行為: ::" -#: ../../library/pickle.rst:575 +#: ../../library/pickle.rst:591 msgid "" "def save(obj):\n" " return (obj.__class__, obj.__dict__)\n" @@ -1069,14 +1091,14 @@ msgstr "" " obj.__dict__.update(attributes)\n" " return obj" -#: ../../library/pickle.rst:583 +#: ../../library/pickle.rst:599 msgid "" "Classes can alter the default behaviour by providing one or several special " "methods:" msgstr "" "被封裝的目標類別可以提供一個或數個下列特殊方法來改變 pickle 的預設行為:" -#: ../../library/pickle.rst:588 +#: ../../library/pickle.rst:604 msgid "" "In protocols 2 and newer, classes that implements " "the :meth:`__getnewargs_ex__` method can dictate the values passed to " @@ -1090,7 +1112,7 @@ msgstr "" "kwargs)`` 的組合,其中 *args* 是一個位置引數的元組(tuple),*kwargs* 是一個" "用於建構物件的命名引數字典。這些資訊將在拆封時傳遞給 :meth:`__new__` 方法。" -#: ../../library/pickle.rst:596 +#: ../../library/pickle.rst:612 msgid "" "You should implement this method if the :meth:`__new__` method of your class " "requires keyword-only arguments. Otherwise, it is recommended for " @@ -1099,11 +1121,11 @@ msgstr "" "如果目標類別的方法 :meth:`__new__` 需要僅限關鍵字的參數時,你應該實作此方法。" "否則,為了提高相容性,建議你改為實作 :meth:`__getnewargs__`。" -#: ../../library/pickle.rst:600 +#: ../../library/pickle.rst:616 msgid ":meth:`__getnewargs_ex__` is now used in protocols 2 and 3." msgstr "在第 2、3 版的協定中現在改為使用 :meth:`__getnewargs_ex__`。" -#: ../../library/pickle.rst:606 +#: ../../library/pickle.rst:622 msgid "" "This method serves a similar purpose as :meth:`__getnewargs_ex__`, but " "supports only positional arguments. It must return a tuple of arguments " @@ -1113,14 +1135,14 @@ msgstr "" "個由傳入引數所組成的元組(tuple)\\ ``args``,這些引數會在拆封時傳遞" "給 :meth:`__new__` 方法。" -#: ../../library/pickle.rst:610 +#: ../../library/pickle.rst:626 msgid "" ":meth:`__getnewargs__` will not be called if :meth:`__getnewargs_ex__` is " "defined." msgstr "" "當有定義 :meth:`__getnewargs_ex__` 的時候便不會呼叫 :meth:`__getnewargs__`。" -#: ../../library/pickle.rst:613 +#: ../../library/pickle.rst:629 msgid "" "Before Python 3.6, :meth:`__getnewargs__` was called instead " "of :meth:`__getnewargs_ex__` in protocols 2 and 3." @@ -1128,7 +1150,7 @@ msgstr "" "在 Python 3.6 之前、版本 2 和版本 3 的協定中,會呼叫 :meth:`__getnewargs__` " "而非 :meth:`__getnewargs_ex__`。" -#: ../../library/pickle.rst:620 +#: ../../library/pickle.rst:636 msgid "" "Classes can further influence how their instances are pickled by overriding " "the method :meth:`__getstate__`. It is called and the returned object is " @@ -1139,7 +1161,7 @@ msgstr "" "封裝時,呼叫該方法所回傳的物件將作為該實例的內容被封裝、而非一個預設狀態。以" "下列出幾種預設狀態:" -#: ../../library/pickle.rst:625 +#: ../../library/pickle.rst:641 msgid "" "For a class that has no instance :attr:`~object.__dict__` and " "no :attr:`~object.__slots__`, the default state is ``None``." @@ -1147,7 +1169,7 @@ msgstr "" "沒有 :attr:`~object.__dict__` 和 :attr:`~object.__slots__` 實例的類別,其預設" "狀態為 ``None``。" -#: ../../library/pickle.rst:628 +#: ../../library/pickle.rst:644 msgid "" "For a class that has an instance :attr:`~object.__dict__` and " "no :attr:`~object.__slots__`, the default state is ``self.__dict__``." @@ -1155,7 +1177,7 @@ msgstr "" "有 :attr:`~object.__dict__` 實例、但沒有 :attr:`~object.__slots__` 實例的類" "別,其預設狀態為 ``self.__dict__``。" -#: ../../library/pickle.rst:631 +#: ../../library/pickle.rst:647 msgid "" "For a class that has an instance :attr:`~object.__dict__` " "and :attr:`~object.__slots__`, the default state is a tuple consisting of " @@ -1167,7 +1189,7 @@ msgstr "" "和紀錄欄位(slot)名稱和值對應關係的字典(只有含有值的欄位(slot)會被紀錄其" "中)。" -#: ../../library/pickle.rst:637 +#: ../../library/pickle.rst:653 msgid "" "For a class that has :attr:`~object.__slots__` and no " "instance :attr:`~object.__dict__`, the default state is a tuple whose first " @@ -1178,13 +1200,13 @@ msgstr "" "設狀態是一個二元組(tuple),元組中的第一個值是 ``None``,第二個值則是紀錄欄" "位(slot)名稱和值對應關係的字典(與前一項提到的字典是同一個)。" -#: ../../library/pickle.rst:642 +#: ../../library/pickle.rst:658 msgid "" "Added the default implementation of the ``__getstate__()`` method in " "the :class:`object` class." msgstr "在 :class:`object` 類別中增加預設的 ``__getstate__()`` 實作。" -#: ../../library/pickle.rst:649 +#: ../../library/pickle.rst:665 msgid "" "Upon unpickling, if the class defines :meth:`__setstate__`, it is called " "with the unpickled state. In that case, there is no requirement for the " @@ -1195,7 +1217,7 @@ msgstr "" "這種情況下,紀錄狀態的物件不需要是字典(dictionary)。否則,封裝時的狀態紀錄" "必須是一個字典,其紀錄的項目將被賦值給新實例的字典。" -#: ../../library/pickle.rst:656 +#: ../../library/pickle.rst:672 msgid "" "If :meth:`__reduce__` returns a state with value ``None`` at pickling, " "the :meth:`__setstate__` method will not be called upon unpickling." @@ -1203,7 +1225,7 @@ msgstr "" "如果 :meth:`__reduce__` 在封裝時回傳了 ``None`` 狀態,則拆封時就不會去呼" "叫 :meth:`__setstate__`。" -#: ../../library/pickle.rst:660 +#: ../../library/pickle.rst:676 msgid "" "Refer to the section :ref:`pickle-state` for more information about how to " "use the methods :meth:`~object.__getstate__` " @@ -1212,7 +1234,7 @@ msgstr "" "參閱 :ref:`pickle-state` 以了解 :meth:`~object.__getstate__` " "和 :meth:`~object.__setstate__` 的使用方法。" -#: ../../library/pickle.rst:665 +#: ../../library/pickle.rst:681 msgid "" "At unpickling time, some methods " "like :meth:`~object.__getattr__`, :meth:`~object.__getattribute__`, " @@ -1227,7 +1249,7 @@ msgstr "" "些實例內部的不變性,則應實作 :meth:`~object.__new__` 以建立此不變性,因為在拆" "封實例時不會呼叫 :meth:`~object.__init__`。" -#: ../../library/pickle.rst:674 +#: ../../library/pickle.rst:690 msgid "" "As we shall see, pickle does not use directly the methods described above. " "In fact, these methods are part of the copy protocol which implements " @@ -1239,7 +1261,7 @@ msgstr "" "了 :meth:`~object.__reduce__` 特殊方法的拷貝協定(copy protocol)。拷貝協定提" "供了統一的介面,以檢索進行封裝及複製物件時所需的資料。 [#]_" -#: ../../library/pickle.rst:680 +#: ../../library/pickle.rst:696 msgid "" "Although powerful, implementing :meth:`~object.__reduce__` directly in your " "classes is error prone. For this reason, class designers should use the " @@ -1256,7 +1278,7 @@ msgstr "" "中,使用 :meth:`!__reduce__` 可能是唯一的選擇、是更有效率的封裝方法或二者兼" "備。" -#: ../../library/pickle.rst:689 +#: ../../library/pickle.rst:705 msgid "" "The interface is currently defined as follows. The :meth:`__reduce__` " "method takes no argument and shall return either a string or preferably a " @@ -1265,7 +1287,7 @@ msgstr "" "目前的介面定義如下。 :meth:`__reduce__` 方法不接受引數,且應回傳一個字串或一" "個元組(元組一般而言是較佳的選擇;所回傳的物件通常稱為「縮減值」)。" -#: ../../library/pickle.rst:693 +#: ../../library/pickle.rst:709 msgid "" "If a string is returned, the string should be interpreted as the name of a " "global variable. It should be the object's local name relative to its " @@ -1276,7 +1298,7 @@ msgstr "" "模組的本地名稱;pickle 模組會在模組命名空間中尋找,以確定該物件所在的模組。這" "種行為通常對於單例物件特別有用。" -#: ../../library/pickle.rst:698 +#: ../../library/pickle.rst:714 msgid "" "When a tuple is returned, it must be between two and six items long. " "Optional items can either be omitted, or ``None`` can be provided as their " @@ -1285,13 +1307,13 @@ msgstr "" "當回傳一個元組時,其長度必須介於兩至六項元素之間。可選項可以被省略,或者其值" "可以被設為 ``None``。各項物件的語意依序為:" -#: ../../library/pickle.rst:704 +#: ../../library/pickle.rst:720 msgid "" "A callable object that will be called to create the initial version of the " "object." msgstr "一個將會被呼叫來建立初始版本物件的可呼叫物件。" -#: ../../library/pickle.rst:707 +#: ../../library/pickle.rst:723 msgid "" "A tuple of arguments for the callable object. An empty tuple must be given " "if the callable does not accept any argument." @@ -1299,7 +1321,7 @@ msgstr "" "一個用於傳遞引數給前述物件的元組。如果前述物件不接受引數輸入,則你仍應在這裡" "給定一個空元組。" -#: ../../library/pickle.rst:710 +#: ../../library/pickle.rst:726 msgid "" "Optionally, the object's state, which will be passed to the " "object's :meth:`__setstate__` method as previously described. If the object " @@ -1312,16 +1334,17 @@ msgstr "" # SkyLull: [T] # signature: https://jo-jo.medium.com/c-c-%E5%B9%BC%E5%B9%BC%E7%8F%AD-%E7%B0%BD%E7%AB%A0signature-fa9b04e1a3e2 -#: ../../library/pickle.rst:715 +#: ../../library/pickle.rst:731 +#, fuzzy msgid "" "Optionally, an iterator (and not a sequence) yielding successive items. " "These items will be appended to the object either using ``obj.append(item)`` " "or, in batch, using ``obj.extend(list_of_items)``. This is primarily used " "for list subclasses, but may be used by other classes as long as they " -"have :ref:`append and extend methods ` with the appropriate " -"signature. (Whether :meth:`!append` or :meth:`!extend` is used depends on " -"which pickle protocol version is used as well as the number of items to " -"append, so both must be supported.)" +"have :meth:`~sequence.append` and :meth:`~sequence.extend` methods with the " +"appropriate signature. (Whether :meth:`!append` or :meth:`!extend` is used " +"depends on which pickle protocol version is used as well as the number of " +"items to append, so both must be supported.)" msgstr "" "可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 " "``obj.append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被" @@ -1331,7 +1354,7 @@ msgstr "" "方法將取決於所選用的 pickle 協定版本以及要附加的項目數量,因此必須同時支援這" "兩種方法。)" -#: ../../library/pickle.rst:725 +#: ../../library/pickle.rst:741 msgid "" "Optionally, an iterator (not a sequence) yielding successive key-value " "pairs. These items will be stored to the object using ``obj[key] = " @@ -1342,7 +1365,7 @@ msgstr "" "value`` 方式被儲存到物件中。主要用於字典(dictionary)子類別,但只要有實現" "了 :meth:`__setitem__` 的其他類別也可以使用。" -#: ../../library/pickle.rst:730 +#: ../../library/pickle.rst:746 msgid "" "Optionally, a callable with a ``(obj, state)`` signature. This callable " "allows the user to programmatically control the state-updating behavior of a " @@ -1355,11 +1378,11 @@ msgstr "" "法去控制特定物件的狀態更新方式。如果這個物件不是 ``None``,這個物件的呼叫優先" "權將優於物件 ``obj`` 的 :meth:`__setstate__`。" -#: ../../library/pickle.rst:736 +#: ../../library/pickle.rst:752 msgid "The optional sixth tuple item, ``(obj, state)``, was added." msgstr "加入第六個可選項(一個 ``(obj, state)`` 元組)。" -#: ../../library/pickle.rst:742 +#: ../../library/pickle.rst:758 msgid "" "Alternatively, a :meth:`__reduce_ex__` method may be defined. The only " "difference is this method should take a single integer argument, the " @@ -1374,11 +1397,11 @@ msgstr "" "是 :meth:`__reduce__` 。此外,呼叫 :meth:`__reduce__` 時也會自動變成呼叫這個" "變體版本。此方法主要是為了向後相容的舊的 Python 版本而存在。" -#: ../../library/pickle.rst:754 +#: ../../library/pickle.rst:770 msgid "Persistence of External Objects" msgstr "外部物件持久化" -#: ../../library/pickle.rst:760 +#: ../../library/pickle.rst:776 msgid "" "For the benefit of object persistence, the :mod:`pickle` module supports the " "notion of a reference to an object outside the pickled data stream. Such " @@ -1391,7 +1414,7 @@ msgstr "" "(alphanumeric)組成的字串(協定 0) [#]_ 或者是任意的物件(任何較新的協" "定)。" -#: ../../library/pickle.rst:766 +#: ../../library/pickle.rst:782 msgid "" "The resolution of such persistent IDs is not defined by the :mod:`pickle` " "module; it will delegate this resolution to the user-defined methods on the " @@ -1402,7 +1425,7 @@ msgstr "" "使用者自行定義在封裝器(pickler)以及拆封器(unpickler)中。方法的名稱各自" "為 :meth:`~Pickler.persistent_id` 和 :meth:`~Unpickler.persistent_load`。" -#: ../../library/pickle.rst:771 +#: ../../library/pickle.rst:787 msgid "" "To pickle objects that have an external persistent ID, the pickler must have " "a custom :meth:`~Pickler.persistent_id` method that takes an object as an " @@ -1418,7 +1441,7 @@ msgstr "" "當回傳一個持久化 ID 字串時,封裝器會封裝該物件並加上一個標記,讓拆封器" "(unpickler)能識別它是一個持久化 ID。" -#: ../../library/pickle.rst:778 +#: ../../library/pickle.rst:794 msgid "" "To unpickle external objects, the unpickler must have a " "custom :meth:`~Unpickler.persistent_load` method that takes a persistent ID " @@ -1428,14 +1451,14 @@ msgstr "" "的 :meth:`~Unpickler.persistent_load` 方法,該方法應接受一個持久化 ID 物件," "並回傳相對應的物件。" -#: ../../library/pickle.rst:782 +#: ../../library/pickle.rst:798 msgid "" "Here is a comprehensive example presenting how persistent ID can be used to " "pickle external objects by reference." msgstr "" "以下是一個完整的範例,用以說明如何使用持久化 ID 來封裝具外部參照的物件。" -#: ../../library/pickle.rst:785 +#: ../../library/pickle.rst:801 msgid "" "# Simple example presenting how persistent ID can be used to pickle\n" "# external objects by reference.\n" @@ -1619,11 +1642,11 @@ msgstr "" "if __name__ == '__main__':\n" " main()\n" -#: ../../library/pickle.rst:790 +#: ../../library/pickle.rst:806 msgid "Dispatch Tables" msgstr "調度表" -#: ../../library/pickle.rst:792 +#: ../../library/pickle.rst:808 msgid "" "If one wants to customize pickling of some classes without disturbing any " "other code which depends on pickling, then one can create a pickler with a " @@ -1632,7 +1655,7 @@ msgstr "" "如果你希望在不干擾其他物件正常封裝的前提下建立一個針對特定物件的封裝器,你可" "建立一個有私密調度表的封裝器。" -#: ../../library/pickle.rst:796 +#: ../../library/pickle.rst:812 msgid "" "The global dispatch table managed by the :mod:`copyreg` module is available " "as :data:`!copyreg.dispatch_table`. Therefore, one may choose to use a " @@ -1642,11 +1665,11 @@ msgstr "" "叫。你可以透過這個方式來基於原始 :data:`!copyreg.dispatch_table` 建立一個修改" "過的版本,作為你的專屬用途的調度表。" -#: ../../library/pickle.rst:801 +#: ../../library/pickle.rst:817 msgid "For example ::" msgstr "舉例來說: ::" -#: ../../library/pickle.rst:803 +#: ../../library/pickle.rst:819 msgid "" "f = io.BytesIO()\n" "p = pickle.Pickler(f)\n" @@ -1658,7 +1681,7 @@ msgstr "" "p.dispatch_table = copyreg.dispatch_table.copy()\n" "p.dispatch_table[SomeClass] = reduce_SomeClass" -#: ../../library/pickle.rst:808 +#: ../../library/pickle.rst:824 msgid "" "creates an instance of :class:`pickle.Pickler` with a private dispatch table " "which handles the ``SomeClass`` class specially. Alternatively, the code ::" @@ -1666,7 +1689,7 @@ msgstr "" "建立了一個 :class:`pickle.Pickler`,其中含有專門處裡 ``SomeClass`` 類別的專屬" "調度表。此外,你也可以寫作:::" -#: ../../library/pickle.rst:812 +#: ../../library/pickle.rst:828 msgid "" "class MyPickler(pickle.Pickler):\n" " dispatch_table = copyreg.dispatch_table.copy()\n" @@ -1680,7 +1703,7 @@ msgstr "" "f = io.BytesIO()\n" "p = MyPickler(f)" -#: ../../library/pickle.rst:818 +#: ../../library/pickle.rst:834 msgid "" "does the same but all instances of ``MyPickler`` will by default share the " "private dispatch table. On the other hand, the code ::" @@ -1688,7 +1711,7 @@ msgstr "" "這樣可產生相似的結果,唯一不同的是往後所有 ``MyPickler`` 預設都會使用這個專屬" "調度表。最後,如果將程式寫為:::" -#: ../../library/pickle.rst:821 +#: ../../library/pickle.rst:837 msgid "" "copyreg.pickle(SomeClass, reduce_SomeClass)\n" "f = io.BytesIO()\n" @@ -1698,17 +1721,17 @@ msgstr "" "f = io.BytesIO()\n" "p = pickle.Pickler(f)" -#: ../../library/pickle.rst:825 +#: ../../library/pickle.rst:841 msgid "" "modifies the global dispatch table shared by all users of the :mod:`copyreg` " "module." msgstr "則會改變 :mod:`copyreg` 模組內建、所有使用者共通的調度表。" -#: ../../library/pickle.rst:830 +#: ../../library/pickle.rst:846 msgid "Handling Stateful Objects" msgstr "處裡紀錄大量狀態的物件" -#: ../../library/pickle.rst:836 +#: ../../library/pickle.rst:852 msgid "" "Here's an example that shows how to modify pickling behavior for a class. " "The :class:`!TextReader` class below opens a text file, and returns the line " @@ -1726,7 +1749,7 @@ msgstr "" "上次的位置繼續讀取。這個行為的達成是透過 :meth:`!__setstate__` 和 :meth:`!" "__getstate__` 方法來實作的。::" -#: ../../library/pickle.rst:844 +#: ../../library/pickle.rst:860 msgid "" "class TextReader:\n" " \"\"\"Print and number lines in a text file.\"\"\"\n" @@ -1801,11 +1824,11 @@ msgstr "" " # 存檔。\n" " self.file = file" -#: ../../library/pickle.rst:882 +#: ../../library/pickle.rst:898 msgid "A sample usage might be something like this::" msgstr "可以這樣實際使用:::" -#: ../../library/pickle.rst:884 +#: ../../library/pickle.rst:900 msgid "" ">>> reader = TextReader(\"hello.txt\")\n" ">>> reader.readline()\n" @@ -1825,11 +1848,11 @@ msgstr "" ">>> new_reader.readline()\n" "'3: Goodbye!'" -#: ../../library/pickle.rst:896 +#: ../../library/pickle.rst:912 msgid "Custom Reduction for Types, Functions, and Other Objects" msgstr "針對型別、函式或特定物件定製縮減函式" -#: ../../library/pickle.rst:900 +#: ../../library/pickle.rst:916 msgid "" "Sometimes, :attr:`~Pickler.dispatch_table` may not be flexible enough. In " "particular we may want to customize pickling based on another criterion than " @@ -1840,7 +1863,7 @@ msgstr "" "用型別以外的方式來判斷如何使用自訂封裝、或者我們想要自訂特定函式和類別的封裝" "方法時。" -#: ../../library/pickle.rst:905 +#: ../../library/pickle.rst:921 msgid "" "For those cases, it is possible to subclass from the :class:`Pickler` class " "and implement a :meth:`~Pickler.reducer_override` method. This method can " @@ -1853,7 +1876,7 @@ msgstr "" "閱 :meth:`~object.__reduce__`)、也可以回傳 :data:`NotImplemented` 以使用後備" "的原始行為方案。" -#: ../../library/pickle.rst:910 +#: ../../library/pickle.rst:926 msgid "" "If both the :attr:`~Pickler.dispatch_table` " "and :meth:`~Pickler.reducer_override` are defined, " @@ -1862,7 +1885,7 @@ msgstr "" "如果 :attr:`~Pickler.dispatch_table` 和 :meth:`~Pickler.reducer_override` 都" "被定義了的話,:meth:`~Pickler.reducer_override` 的優先度較高。" -#: ../../library/pickle.rst:915 +#: ../../library/pickle.rst:931 msgid "" "For performance reasons, :meth:`~Pickler.reducer_override` may not be called " "for the following objects: ``None``, ``True``, ``False``, and exact " @@ -1875,13 +1898,13 @@ msgstr "" "及 :class:`int`、:class:`float`、:class:`bytes`、:class:`str`、:class:`dict`、:class:`set`、:class:`frozenset`、:class:`list` " "和 :class:`tuple` 的實例。" -#: ../../library/pickle.rst:921 +#: ../../library/pickle.rst:937 msgid "" "Here is a simple example where we allow pickling and reconstructing a given " "class::" msgstr "以下是一個簡單的例子,我們示範如何允許封裝和重建給定的類別:::" -#: ../../library/pickle.rst:924 +#: ../../library/pickle.rst:940 msgid "" "import io\n" "import pickle\n" @@ -1939,11 +1962,11 @@ msgstr "" "assert unpickled_class.__name__ == \"MyClass\"\n" "assert unpickled_class.my_attribute == 1\n" -#: ../../library/pickle.rst:956 +#: ../../library/pickle.rst:972 msgid "Out-of-band Buffers" msgstr "帶外(Out-of-band)資料緩衝區" -#: ../../library/pickle.rst:960 +#: ../../library/pickle.rst:976 msgid "" "In some contexts, the :mod:`pickle` module is used to transfer massive " "amounts of data. Therefore, it can be important to minimize the number of " @@ -1957,7 +1980,7 @@ msgstr "" "的圖狀結構(graph-like structure)轉換為連續的位元組串流時,本質上就涉及將資" "料複製到封裝流以及從封裝流複製資料。" -#: ../../library/pickle.rst:967 +#: ../../library/pickle.rst:983 msgid "" "This constraint can be eschewed if both the *provider* (the implementation " "of the object types to be transferred) and the *consumer* (the " @@ -1968,11 +1991,11 @@ msgstr "" "實作)都支援由 pickle 協定 5 或更高版本提供的帶外傳輸功能,則可以避免此一先天" "限制。" -#: ../../library/pickle.rst:973 +#: ../../library/pickle.rst:989 msgid "Provider API" msgstr "供給者 API" -#: ../../library/pickle.rst:975 +#: ../../library/pickle.rst:991 msgid "" "The large data objects to be pickled must implement " "a :meth:`~object.__reduce_ex__` method specialized for protocol 5 and " @@ -1984,7 +2007,7 @@ msgstr "" "個 :class:`PickleBuffer` 實例來處理任何大型資料(而非回傳如 :class:`bytes` 物" "件)。" -#: ../../library/pickle.rst:980 +#: ../../library/pickle.rst:996 msgid "" "A :class:`PickleBuffer` object *signals* that the underlying buffer is " "eligible for out-of-band data transfer. Those objects remain compatible " @@ -1996,11 +2019,11 @@ msgstr "" "資料傳輸。這些物件仍然相容 :mod:`pickle` 模組的一般使用方式。消費者程式也可以" "選擇介入,指示 :mod:`pickle` 他們將自行處理這些緩衝區。" -#: ../../library/pickle.rst:987 +#: ../../library/pickle.rst:1003 msgid "Consumer API" msgstr "消費者 API" -#: ../../library/pickle.rst:989 +#: ../../library/pickle.rst:1005 msgid "" "A communications system can enable custom handling of " "the :class:`PickleBuffer` objects generated when serializing an object graph." @@ -2008,7 +2031,7 @@ msgstr "" "一個資訊交換系統可以決定要自行處裡序列化物件圖時產生的 :class:`PickleBuffer` " "物件。" -#: ../../library/pickle.rst:992 +#: ../../library/pickle.rst:1008 msgid "" "On the sending side, it needs to pass a *buffer_callback* argument " "to :class:`Pickler` (or to the :func:`dump` or :func:`dumps` function), " @@ -2022,7 +2045,7 @@ msgstr "" "成 :class:`PickleBuffer` 時,該物件在處理物件圖時能被呼叫。除了一個簡易標記以" "外,由 *buffer_callback* 累積的緩衝區資料不會被複製到 pickle 串流中。" -#: ../../library/pickle.rst:999 +#: ../../library/pickle.rst:1015 msgid "" "On the receiving side, it needs to pass a *buffers* argument " "to :class:`Unpickler` (or to the :func:`load` or :func:`loads` function), " @@ -2039,7 +2062,7 @@ msgstr "" "這些緩衝區將提供物件重建所需的資料,以使重建器能還原出那個當時產生" "了 :class:`PickleBuffer` 的物件。" -#: ../../library/pickle.rst:1007 +#: ../../library/pickle.rst:1023 msgid "" "Between the sending side and the receiving side, the communications system " "is free to implement its own transfer mechanism for out-of-band buffers. " @@ -2049,11 +2072,11 @@ msgstr "" "在傳送與接收端之間,通訊系統可以自由實作轉移帶外緩衝區資料的機制。該機制可能" "可以利用共用記憶體機制或根據資料類型特定的壓縮方式來最佳化執行速度。" -#: ../../library/pickle.rst:1013 +#: ../../library/pickle.rst:1029 msgid "Example" msgstr "範例" -#: ../../library/pickle.rst:1015 +#: ../../library/pickle.rst:1031 msgid "" "Here is a trivial example where we implement a :class:`bytearray` subclass " "able to participate in out-of-band buffer pickling::" @@ -2061,7 +2084,7 @@ msgstr "" "這一個簡單的範例展示了如何實作一個可以參與帶外緩衝區封裝" "的 :class:`bytearray` 子類別:::" -#: ../../library/pickle.rst:1018 +#: ../../library/pickle.rst:1034 msgid "" "class ZeroCopyByteArray(bytearray):\n" "\n" @@ -2104,7 +2127,7 @@ msgstr "" " else:\n" " return cls(obj)" -#: ../../library/pickle.rst:1039 +#: ../../library/pickle.rst:1055 msgid "" "The reconstructor (the ``_reconstruct`` class method) returns the buffer's " "providing object if it has the right type. This is an easy way to simulate " @@ -2113,7 +2136,7 @@ msgstr "" "如果型別正確,重建器(``_reconstruct`` 類別方法)會回傳當時提供緩衝區的物件。" "這個簡易實作可以模擬一個無複製行為的重建器。" -#: ../../library/pickle.rst:1043 +#: ../../library/pickle.rst:1059 msgid "" "On the consumer side, we can pickle those objects the usual way, which when " "unserialized will give us a copy of the original object::" @@ -2121,7 +2144,7 @@ msgstr "" "在使用端,我們可以用一般的方式封裝這些物件,當我們拆封時會得到一個原始物件的" "副本:::" -#: ../../library/pickle.rst:1046 +#: ../../library/pickle.rst:1062 msgid "" "b = ZeroCopyByteArray(b\"abc\")\n" "data = pickle.dumps(b, protocol=5)\n" @@ -2135,7 +2158,7 @@ msgstr "" "print(b == new_b) # True\n" "print(b is new_b) # False: 曾進行過複製運算" -#: ../../library/pickle.rst:1052 +#: ../../library/pickle.rst:1068 msgid "" "But if we pass a *buffer_callback* and then give back the accumulated " "buffers when unserializing, we are able to get back the original object::" @@ -2143,7 +2166,7 @@ msgstr "" "但如果我們傳一個 *buffer_callback* 並在去序列化時正確回傳積累的緩衝資料,我們" "就能拿回原始的物件:::" -#: ../../library/pickle.rst:1055 +#: ../../library/pickle.rst:1071 msgid "" "b = ZeroCopyByteArray(b\"abc\")\n" "buffers = []\n" @@ -2159,7 +2182,7 @@ msgstr "" "print(b == new_b) # True\n" "print(b is new_b) # True: 沒有進行過複製" -#: ../../library/pickle.rst:1062 +#: ../../library/pickle.rst:1078 msgid "" "This example is limited by the fact that :class:`bytearray` allocates its " "own memory: you cannot create a :class:`bytearray` instance that is backed " @@ -2173,15 +2196,15 @@ msgstr "" "則可能沒有這個限制,而允許在不同程序或系統之間傳輸資料時使用零拷貝封裝(或儘" "可能地減少拷貝次數)。" -#: ../../library/pickle.rst:1069 +#: ../../library/pickle.rst:1085 msgid ":pep:`574` -- Pickle protocol 5 with out-of-band data" msgstr ":pep:`574` -- 第 5 版 Pickle 協定的帶外資料(out-of-band data)處裡" -#: ../../library/pickle.rst:1075 +#: ../../library/pickle.rst:1091 msgid "Restricting Globals" msgstr "限制全域物件" -#: ../../library/pickle.rst:1080 +#: ../../library/pickle.rst:1096 msgid "" "By default, unpickling will import any class or function that it finds in " "the pickle data. For many applications, this behaviour is unacceptable as " @@ -2192,7 +2215,7 @@ msgstr "" "用程式來說,這種行為是不可接受的,因為它讓拆封器能夠引入並執行任意程式碼。請" "參見以下 pickle 資料流在載入時的行為:::" -#: ../../library/pickle.rst:1085 +#: ../../library/pickle.rst:1101 msgid "" ">>> import pickle\n" ">>> pickle.loads(b\"cos\\nsystem\\n(S'echo hello world'\\ntR.\")\n" @@ -2204,7 +2227,7 @@ msgstr "" "hello world\n" "0" -#: ../../library/pickle.rst:1090 +#: ../../library/pickle.rst:1106 msgid "" "In this example, the unpickler imports the :func:`os.system` function and " "then apply the string argument \"echo hello world\". Although this example " @@ -2215,7 +2238,7 @@ msgstr "" "world」。雖然這個例子是無害的,但不難想像可以這個方式輕易執行任意可能對系統造" "成損害的命令。" -#: ../../library/pickle.rst:1094 +#: ../../library/pickle.rst:1110 msgid "" "For this reason, you may want to control what gets unpickled by " "customizing :meth:`Unpickler.find_class`. Unlike its name " @@ -2228,7 +2251,7 @@ msgstr "" "(例如,類別或函式)時,就會呼叫 :meth:`Unpickler.find_class`。因此,可以透過" "這個方法完全禁止全域物件或將其限制在安全的子集合。" -#: ../../library/pickle.rst:1100 +#: ../../library/pickle.rst:1116 msgid "" "Here is an example of an unpickler allowing only few safe classes from " "the :mod:`builtins` module to be loaded::" @@ -2236,7 +2259,7 @@ msgstr "" "以下是一個僅允許從 :mod:`builtins` 模組中載入少數安全類別的拆封器" "(unpickler)的例子:::" -#: ../../library/pickle.rst:1103 +#: ../../library/pickle.rst:1119 msgid "" "import builtins\n" "import io\n" @@ -2290,11 +2313,11 @@ msgstr "" " \"\"\"一個模擬 pickle.loads() 的輔助函式\"\"\"\n" " return RestrictedUnpickler(io.BytesIO(s)).load()" -#: ../../library/pickle.rst:1129 +#: ../../library/pickle.rst:1145 msgid "A sample usage of our unpickler working as intended::" msgstr "我們剛才實作的的拆封器範例正常運作的樣子:::" -#: ../../library/pickle.rst:1131 +#: ../../library/pickle.rst:1147 msgid "" ">>> restricted_loads(pickle.dumps([1, 2, range(15)]))\n" "[1, 2, range(0, 15)]\n" @@ -2322,7 +2345,7 @@ msgstr "" " ...\n" "pickle.UnpicklingError: global 'builtins.eval' is forbidden" -#: ../../library/pickle.rst:1148 +#: ../../library/pickle.rst:1164 msgid "" "As our examples shows, you have to be careful with what you allow to be " "unpickled. Therefore if security is a concern, you may want to consider " @@ -2333,11 +2356,11 @@ msgstr "" "心安全性,你可能需要考慮其他選擇,例如 :mod:`xmlrpc.client` 中的 marshalling " "API 或其他第三方解決方案。" -#: ../../library/pickle.rst:1155 +#: ../../library/pickle.rst:1171 msgid "Performance" msgstr "效能" -#: ../../library/pickle.rst:1157 +#: ../../library/pickle.rst:1173 msgid "" "Recent versions of the pickle protocol (from protocol 2 and upwards) feature " "efficient binary encodings for several common features and built-in types. " @@ -2347,16 +2370,16 @@ msgstr "" "率的二進位編碼。此外,:mod:`pickle` 模組還具備一個透明化的、以 C 語言編寫的最" "佳化工具。" -#: ../../library/pickle.rst:1165 +#: ../../library/pickle.rst:1181 msgid "Examples" msgstr "範例" -#: ../../library/pickle.rst:1167 +#: ../../library/pickle.rst:1183 msgid "" "For the simplest code, use the :func:`dump` and :func:`load` functions. ::" msgstr "最簡單的使用方式,呼叫 :func:`dump` 和 :func:`load` 函式。::" -#: ../../library/pickle.rst:1169 +#: ../../library/pickle.rst:1185 msgid "" "import pickle\n" "\n" @@ -2384,11 +2407,11 @@ msgstr "" " # 使用可用的最高協定來封裝 'data' 字典。\n" " pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)\n" -#: ../../library/pickle.rst:1183 +#: ../../library/pickle.rst:1199 msgid "The following example reads the resulting pickled data. ::" msgstr "以下範例可以讀取前述程式所封裝的 pickle 資料。::" -#: ../../library/pickle.rst:1185 +#: ../../library/pickle.rst:1201 msgid "" "import pickle\n" "\n" @@ -2403,55 +2426,83 @@ msgstr "" " # 會自動檢測資料使用的協定版本,因此我們不需要手動指定。\n" " data = pickle.load(f)" -#: ../../library/pickle.rst:1199 +#: ../../library/pickle.rst:1216 +#, fuzzy +msgid "Command-line interface" +msgstr "模組介面" + +#: ../../library/pickle.rst:1218 +msgid "" +"The :mod:`pickle` module can be invoked as a script from the command line, " +"it will display contents of the pickle files. However, when the pickle file " +"that you want to examine comes from an untrusted source, ``-m pickletools`` " +"is a safer option because it does not execute pickle bytecode, " +"see :ref:`pickletools CLI usage `." +msgstr "" + +#: ../../library/pickle.rst:1224 +msgid "python -m pickle pickle_file [pickle_file ...]" +msgstr "" + +#: ../../library/pickle.rst:1228 +#, fuzzy +msgid "The following option is accepted:" +msgstr "下列型別可以被封裝:" + +#: ../../library/pickle.rst:1234 +msgid "" +"A pickle file to read, or ``-`` to indicate reading from standard input." +msgstr "" + +#: ../../library/pickle.rst:1239 msgid "Module :mod:`copyreg`" msgstr ":mod:`copyreg` 模組" -#: ../../library/pickle.rst:1200 +#: ../../library/pickle.rst:1240 msgid "Pickle interface constructor registration for extension types." msgstr "註冊擴充型別的 Pickle 介面建構子。" -#: ../../library/pickle.rst:1202 +#: ../../library/pickle.rst:1242 msgid "Module :mod:`pickletools`" msgstr ":mod:`pickletools` 模組" -#: ../../library/pickle.rst:1203 +#: ../../library/pickle.rst:1243 msgid "Tools for working with and analyzing pickled data." msgstr "用於分析或處裡被封裝資料的工具。" -#: ../../library/pickle.rst:1205 +#: ../../library/pickle.rst:1245 msgid "Module :mod:`shelve`" msgstr ":mod:`shelve` 模組" -#: ../../library/pickle.rst:1206 +#: ../../library/pickle.rst:1246 msgid "Indexed databases of objects; uses :mod:`pickle`." msgstr "索引式資料庫;使用 :mod:`pickle` 實作。" -#: ../../library/pickle.rst:1208 +#: ../../library/pickle.rst:1248 msgid "Module :mod:`copy`" msgstr ":mod:`copy` 模組" -#: ../../library/pickle.rst:1209 +#: ../../library/pickle.rst:1249 msgid "Shallow and deep object copying." msgstr "物件的淺層或深度拷貝。" -#: ../../library/pickle.rst:1211 +#: ../../library/pickle.rst:1251 msgid "Module :mod:`marshal`" msgstr ":mod:`marshal` 模組" -#: ../../library/pickle.rst:1212 +#: ../../library/pickle.rst:1252 msgid "High-performance serialization of built-in types." msgstr "內建型別的高效能序列化。" -#: ../../library/pickle.rst:1216 +#: ../../library/pickle.rst:1256 msgid "Footnotes" msgstr "註解" -#: ../../library/pickle.rst:1217 +#: ../../library/pickle.rst:1257 msgid "Don't confuse this with the :mod:`marshal` module" msgstr "不要將此模組與 :mod:`marshal` 模組混淆" -#: ../../library/pickle.rst:1219 +#: ../../library/pickle.rst:1259 msgid "" "This is why :keyword:`lambda` functions cannot be pickled: all :keyword:`!" "lambda` functions share the same name: ````." @@ -2459,7 +2510,7 @@ msgstr "" "這就是為什麼 :keyword:`lambda` 函式無法被封裝:所有 :keyword:`!lambda` 函式共" "享相同的名稱:````。" -#: ../../library/pickle.rst:1222 +#: ../../library/pickle.rst:1262 msgid "" "The exception raised will likely be an :exc:`ImportError` or " "an :exc:`AttributeError` but it could be something else." @@ -2467,13 +2518,13 @@ msgstr "" "引發的例外應該是 :exc:`ImportError` 或 :exc:`AttributeError`,但也可能是其他" "例外。" -#: ../../library/pickle.rst:1225 +#: ../../library/pickle.rst:1265 msgid "" "The :mod:`copy` module uses this protocol for shallow and deep copying " "operations." msgstr ":mod:`copy` 模組使用此協定進行淺層及深層複製操作。" -#: ../../library/pickle.rst:1228 +#: ../../library/pickle.rst:1268 msgid "" "The limitation on alphanumeric characters is due to the fact that persistent " "IDs in protocol 0 are delimited by the newline character. Therefore if any " @@ -2516,30 +2567,30 @@ msgstr "pickling" msgid "External Data Representation" msgstr "External Data Representation(外部資料表現)" -#: ../../library/pickle.rst:672 +#: ../../library/pickle.rst:688 msgid "copy" msgstr "copy(複製)" -#: ../../library/pickle.rst:672 +#: ../../library/pickle.rst:688 msgid "protocol" msgstr "protocol(協定)" -#: ../../library/pickle.rst:756 +#: ../../library/pickle.rst:772 msgid "persistent_id (pickle protocol)" msgstr "persistent_id(pickle 協定)" -#: ../../library/pickle.rst:756 +#: ../../library/pickle.rst:772 msgid "persistent_load (pickle protocol)" msgstr "persistent_load(pickle 協定)" -#: ../../library/pickle.rst:832 +#: ../../library/pickle.rst:848 msgid "__getstate__() (copy protocol)" msgstr "__getstate__()(copy 協定)" -#: ../../library/pickle.rst:832 +#: ../../library/pickle.rst:848 msgid "__setstate__() (copy protocol)" msgstr "__setstate__()(copy 協定)" -#: ../../library/pickle.rst:1077 +#: ../../library/pickle.rst:1093 msgid "find_class() (pickle protocol)" msgstr "find_class()(pickle 協定)" diff --git a/library/pickletools.po b/library/pickletools.po index d3bd0aee938..5e4ecb6fee0 100644 --- a/library/pickletools.po +++ b/library/pickletools.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,9 +32,9 @@ msgid "" "This module contains various constants relating to the intimate details of " "the :mod:`pickle` module, some lengthy comments about the implementation, " "and a few useful functions for analyzing pickled data. The contents of this " -"module are useful for Python core developers who are working on the :mod:" -"`pickle`; ordinary users of the :mod:`pickle` module probably won't find " -"the :mod:`pickletools` module relevant." +"module are useful for Python core developers who are working on " +"the :mod:`pickle`; ordinary users of the :mod:`pickle` module probably won't " +"find the :mod:`pickletools` module relevant." msgstr "" "該模組包含與 :mod:`pickle` 模組的詳細資訊相關的各種常數、一些有關實作的冗長註" "釋以及一些用於分析已 pickle 資料的有用函式。該模組的內容對於有 :mod:`pickle` " @@ -42,7 +42,8 @@ msgstr "" "發現 :mod:`pickletools` 模組。" #: ../../library/pickletools.rst:23 -msgid "Command line usage" +#, fuzzy +msgid "Command-line usage" msgstr "命令列用法" #: ../../library/pickletools.rst:27 @@ -91,7 +92,8 @@ msgstr "" "highest protocol among opcodes = 2" #: ../../library/pickletools.rst:52 -msgid "Command line options" +#, fuzzy +msgid "Command-line options" msgstr "命令列選項" #: ../../library/pickletools.rst:58 @@ -112,17 +114,24 @@ msgid "" msgstr "當拆解多個物件時,會在拆解間保留備忘錄。" #: ../../library/pickletools.rst:75 +#, fuzzy msgid "" -"When more than one pickle file are specified, print given preamble before " +"When more than one pickle file is specified, print given preamble before " "each disassembly." msgstr "" "當指定多個 pickle 檔案時,會在每次拆解之前印出給定的一段序言 (preamble)。" -#: ../../library/pickletools.rst:81 -msgid "Programmatic Interface" +#: ../../library/pickletools.rst:80 +msgid "" +"A pickle file to read, or ``-`` to indicate reading from standard input." +msgstr "" + +#: ../../library/pickletools.rst:85 +#, fuzzy +msgid "Programmatic interface" msgstr "程式化介面" -#: ../../library/pickletools.rst:86 +#: ../../library/pickletools.rst:90 msgid "" "Outputs a symbolic disassembly of the pickle to the file-like object *out*, " "defaulting to ``sys.stdout``. *pickle* can be a string or a file-like " @@ -141,11 +150,11 @@ msgstr "" "*annotate* 指定非零值,則輸出中的每個操作碼都會用簡短的描述進行註釋。" "*annotate* 的值用作為註釋之起始行提示。" -#: ../../library/pickletools.rst:97 +#: ../../library/pickletools.rst:101 msgid "Added the *annotate* parameter." msgstr "新增 *annotate* 參數。" -#: ../../library/pickletools.rst:102 +#: ../../library/pickletools.rst:106 msgid "" "Provides an :term:`iterator` over all of the opcodes in a pickle, returning " "a sequence of ``(opcode, arg, pos)`` triples. *opcode* is an instance of " @@ -158,7 +167,7 @@ msgstr "" "引數的解碼值(作為 Python 物件);*pos* 是該操作碼所在的位置。*pickle* 可以是" "字串或類檔案物件。" -#: ../../library/pickletools.rst:110 +#: ../../library/pickletools.rst:114 msgid "" "Returns a new equivalent pickle string after eliminating unused ``PUT`` " "opcodes. The optimized pickle is shorter, takes less transmission time, " diff --git a/library/pkgutil.po b/library/pkgutil.po index d1733250d34..42fa73f805a 100644 --- a/library/pkgutil.po +++ b/library/pkgutil.po @@ -7,7 +7,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-09-08 15:25+0800\n" "PO-Revision-Date: 2024-03-08 16:07+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,8 +41,8 @@ msgid "" "Extend the search path for the modules which comprise a package. Intended " "use is to place the following code in a package's :file:`__init__.py`::" msgstr "" -"擴充組成一個套件之模組的搜尋路徑。預期用法是將以下程式碼放入套件的 :file:" -"`__init__.py`: ::" +"擴充組成一個套件之模組的搜尋路徑。預期用法是將以下程式碼放入套件" +"的 :file:`__init__.py`: ::" #: ../../library/pkgutil.rst:25 msgid "" @@ -55,9 +55,10 @@ msgstr "" #: ../../library/pkgutil.rst:28 msgid "" "For each directory on :data:`sys.path` that has a subdirectory that matches " -"the package name, add the subdirectory to the package's :attr:`~module." -"__path__`. This is useful if one wants to distribute different parts of a " -"single logical package as multiple directories." +"the package name, add the subdirectory to the " +"package's :attr:`~module.__path__`. This is useful if one wants to " +"distribute different parts of a single logical package as multiple " +"directories." msgstr "" "對於 :data:`sys.path` 上具有與套件名稱相符的子目錄的每個目錄,將該子目錄新增" "至套件的 :attr:`~module.__path__` 中。如果想要將單一邏輯套件的不同部分給分配" @@ -66,12 +67,12 @@ msgstr "" #: ../../library/pkgutil.rst:34 msgid "" "It also looks for :file:`\\*.pkg` files beginning where ``*`` matches the " -"*name* argument. This feature is similar to :file:`\\*.pth` files (see the :" -"mod:`site` module for more information), except that it doesn't special-case " -"lines starting with ``import``. A :file:`\\*.pkg` file is trusted at face " -"value: apart from skipping blank lines and ignoring comments, all entries " -"found in a :file:`\\*.pkg` file are added to the path, regardless of whether " -"they exist on the filesystem (this is a feature)." +"*name* argument. This feature is similar to :file:`\\*.pth` files (see " +"the :mod:`site` module for more information), except that it doesn't special-" +"case lines starting with ``import``. A :file:`\\*.pkg` file is trusted at " +"face value: apart from skipping blank lines and ignoring comments, all " +"entries found in a :file:`\\*.pkg` file are added to the path, regardless of " +"whether they exist on the filesystem (this is a feature)." msgstr "" "它還會尋找 :file:`\\*.pkg` 檔案,其中開頭的 ``*`` 與 *name* 引數相符。此功能" "類似於 :file:`\\*.pth` 檔案(更多資訊請參閱 :mod:`site` 模組),但他不特別處" @@ -90,54 +91,21 @@ msgstr "" #: ../../library/pkgutil.rst:46 msgid "" -"It is assumed that :data:`sys.path` is a sequence. Items of :data:`sys." -"path` that are not strings referring to existing directories are ignored. " -"Unicode items on :data:`sys.path` that cause errors when used as filenames " -"may cause this function to raise an exception (in line with :func:`os.path." -"isdir` behavior)." +"It is assumed that :data:`sys.path` is a sequence. Items " +"of :data:`sys.path` that are not strings referring to existing directories " +"are ignored. Unicode items on :data:`sys.path` that cause errors when used " +"as filenames may cause this function to raise an exception (in line " +"with :func:`os.path.isdir` behavior)." msgstr "" ":data:`sys.path` 被假設是一個序列,:data:`sys.path` 中的項目裡,若不是代表現" "存目錄的字串則將被忽略。:data:`sys.path` 上用作檔案名稱時導致錯誤的 Unicode " "項目可能會導致此函式引發例外(與 :func:`os.path.isdir` 行為一致)。" -#: ../../library/pkgutil.rst:54 -msgid "Retrieve a module :term:`loader` for the given *fullname*." -msgstr "取得給定之 *fullname* 的模組 :term:`loader`。" - -#: ../../library/pkgutil.rst:56 -msgid "" -"This is a backwards compatibility wrapper around :func:`importlib.util." -"find_spec` that converts most failures to :exc:`ImportError` and only " -"returns the loader rather than the full :class:`importlib.machinery." -"ModuleSpec`." -msgstr "" -"這是一個 :func:`importlib.util.find_spec` 的向後相容包裝器,它將大多數的失敗" -"轉換為 :exc:`ImportError` 並且僅回傳載入器而不是完整的 :class:`importlib." -"machinery.ModuleSpec`。" - -#: ../../library/pkgutil.rst:61 ../../library/pkgutil.rst:82 -#: ../../library/pkgutil.rst:97 ../../library/pkgutil.rst:121 -#: ../../library/pkgutil.rst:142 ../../library/pkgutil.rst:181 -msgid "" -"Updated to be based directly on :mod:`importlib` rather than relying on the " -"package internal :pep:`302` import emulation." -msgstr "" -"更新為直接基於 :mod:`importlib`,而不是依賴套件內部 :pep:`302` 的引入模擬 " -"(import emulation)。" - -#: ../../library/pkgutil.rst:65 ../../library/pkgutil.rst:101 -msgid "Updated to be based on :pep:`451`" -msgstr "基於 :pep:`451` 來更新" - -#: ../../library/pkgutil.rst:68 ../../library/pkgutil.rst:104 -msgid "Use :func:`importlib.util.find_spec` instead." -msgstr "改用 :func:`importlib.util.find_spec`。" - -#: ../../library/pkgutil.rst:74 +#: ../../library/pkgutil.rst:55 msgid "Retrieve a :term:`finder` for the given *path_item*." msgstr "取得給定之 *path_item* 的 :term:`finder`。" -#: ../../library/pkgutil.rst:76 +#: ../../library/pkgutil.rst:57 msgid "" "The returned finder is cached in :data:`sys.path_importer_cache` if it was " "newly created by a path hook." @@ -145,45 +113,38 @@ msgstr "" "如果回傳的尋檢器 (finder) 是由路徑勾點 (path hook) 所新建立的,則它會被快取" "在 :data:`sys.path_importer_cache` 中。" -#: ../../library/pkgutil.rst:79 +#: ../../library/pkgutil.rst:60 msgid "" -"The cache (or part of it) can be cleared manually if a rescan of :data:`sys." -"path_hooks` is necessary." +"The cache (or part of it) can be cleared manually if a rescan " +"of :data:`sys.path_hooks` is necessary." msgstr "" "如果需要重新掃描 :data:`sys.path_hooks`,可以手動清除快取(或部分快取)。" -#: ../../library/pkgutil.rst:89 -msgid "Get a :term:`loader` object for *module_or_name*." -msgstr "取得 *module_or_name* 的 :term:`loader` 物件。" - -#: ../../library/pkgutil.rst:91 +#: ../../library/pkgutil.rst:63 ../../library/pkgutil.rst:81 +#: ../../library/pkgutil.rst:102 ../../library/pkgutil.rst:141 msgid "" -"If the module or package is accessible via the normal import mechanism, a " -"wrapper around the relevant part of that machinery is returned. Returns " -"``None`` if the module cannot be found or imported. If the named module is " -"not already imported, its containing package (if any) is imported, in order " -"to establish the package ``__path__``." +"Updated to be based directly on :mod:`importlib` rather than relying on the " +"package internal :pep:`302` import emulation." msgstr "" -"如果可以透過正常引入機制存取模組或套件,則回傳該機制相關部分的包裝器。如果找" -"不到或無法引入模組,則回傳 ``None``。如果指定的模組尚未被引入,則引入其包含的" -"套件(如有存在)以建立套件 ``__path__``。" +"更新為直接基於 :mod:`importlib`,而不是依賴套件內部 :pep:`302` 的引入模擬 " +"(import emulation)。" -#: ../../library/pkgutil.rst:110 +#: ../../library/pkgutil.rst:70 msgid "Yield :term:`finder` objects for the given module name." msgstr "yield 給定模組名稱的 :term:`finder` 物件。" -#: ../../library/pkgutil.rst:112 +#: ../../library/pkgutil.rst:72 msgid "" "If *fullname* contains a ``'.'``, the finders will be for the package " "containing *fullname*, otherwise they will be all registered top level " -"finders (i.e. those on both :data:`sys.meta_path` and :data:`sys." -"path_hooks`)." +"finders (i.e. those on both :data:`sys.meta_path` " +"and :data:`sys.path_hooks`)." msgstr "" -"如果 *fullname* 包含 ``'.'``,則尋檢器將針對包含 *fullname* 的套件,否則它們全部" -"會是在頂層被註冊的尋檢器(即 :data:`sys.meta_path` 和 :data:`sys.path_hooks` " -"上的尋檢器)。" +"如果 *fullname* 包含 ``'.'``,則尋檢器將針對包含 *fullname* 的套件,否則它們" +"全部會是在頂層被註冊的尋檢器(即 :data:`sys.meta_path` " +"和 :data:`sys.path_hooks` 上的尋檢器)。" -#: ../../library/pkgutil.rst:116 +#: ../../library/pkgutil.rst:76 msgid "" "If the named module is in a package, that package is imported as a side " "effect of invoking this function." @@ -191,11 +152,11 @@ msgstr "" "如果指定的模組位於套件中,則作為呼叫此函式的副作用 (side effect) ,該套件會被" "引入。" -#: ../../library/pkgutil.rst:119 +#: ../../library/pkgutil.rst:79 msgid "If no module name is specified, all top level finders are produced." msgstr "如果未指定模組名稱,則會產生所有頂層尋檢器。" -#: ../../library/pkgutil.rst:128 +#: ../../library/pkgutil.rst:88 msgid "" "Yields :class:`ModuleInfo` for all submodules on *path*, or, if *path* is " "``None``, all top-level modules on :data:`sys.path`." @@ -203,28 +164,28 @@ msgstr "" "yield *path* 上所有子模組的 :class:`ModuleInfo`,或者如果 *path* 為 " "``None``,則產生 :data:`sys.path` 上的所有頂層模組。" -#: ../../library/pkgutil.rst:131 ../../library/pkgutil.rst:152 +#: ../../library/pkgutil.rst:91 ../../library/pkgutil.rst:112 msgid "" "*path* should be either ``None`` or a list of paths to look for modules in." msgstr "*path* 應該是 ``None`` 或用來尋找模組的路徑串列。" -#: ../../library/pkgutil.rst:133 ../../library/pkgutil.rst:154 +#: ../../library/pkgutil.rst:93 ../../library/pkgutil.rst:114 msgid "" "*prefix* is a string to output on the front of every module name on output." msgstr "*prefix* 是在輸出的每個模組名稱前面的輸出字串。" -#: ../../library/pkgutil.rst:137 ../../library/pkgutil.rst:176 +#: ../../library/pkgutil.rst:97 ../../library/pkgutil.rst:136 msgid "" "Only works for a :term:`finder` which defines an ``iter_modules()`` method. " "This interface is non-standard, so the module also provides implementations " -"for :class:`importlib.machinery.FileFinder` and :class:`zipimport." -"zipimporter`." +"for :class:`importlib.machinery.FileFinder` " +"and :class:`zipimport.zipimporter`." msgstr "" "僅適用於有定義 ``iter_modules()`` 方法的 :term:`finder`。此介面並非是標準的," -"因此該模組還提供了 :class:`importlib.machinery.FileFinder` 和 :class:" -"`zipimport.zipimporter` 的實作。" +"因此該模組還提供了 :class:`importlib.machinery.FileFinder` " +"和 :class:`zipimport.zipimporter` 的實作。" -#: ../../library/pkgutil.rst:149 +#: ../../library/pkgutil.rst:109 msgid "" "Yields :class:`ModuleInfo` for all modules recursively on *path*, or, if " "*path* is ``None``, all accessible modules." @@ -232,7 +193,7 @@ msgstr "" "為 *path* 上的所有模組遞迴 yield 出 :class:`ModuleInfo`,或如果 *path* 為 " "``None`` 則 yield 所有可存取的模組。" -#: ../../library/pkgutil.rst:156 +#: ../../library/pkgutil.rst:116 msgid "" "Note that this function must import all *packages* (*not* all modules!) on " "the given *path*, in order to access the ``__path__`` attribute to find " @@ -241,23 +202,23 @@ msgstr "" "請注意,此函式必須引入給定之 *path* 上的所有\\ *套件*\\ (*不是*\\ 所有模" "組!),以便存取 ``__path__`` 屬性來尋找子模組。" -#: ../../library/pkgutil.rst:160 +#: ../../library/pkgutil.rst:120 msgid "" "*onerror* is a function which gets called with one argument (the name of the " "package which was being imported) if any exception occurs while trying to " -"import a package. If no *onerror* function is supplied, :exc:" -"`ImportError`\\s are caught and ignored, while all other exceptions are " -"propagated, terminating the search." +"import a package. If no *onerror* function is " +"supplied, :exc:`ImportError`\\s are caught and ignored, while all other " +"exceptions are propagated, terminating the search." msgstr "" "*onerror* 是一個函式,如果在嘗試引入套件時發生任何例外,則使用一個引數(正在" -"引入之套件的名稱)來呼叫函式。如果未提供 *onerror* 函式,則會捕獲並忽略 :exc:" -"`ImportError`,同時傳播所有其他例外並終止搜尋。" +"引入之套件的名稱)來呼叫函式。如果未提供 *onerror* 函式,則會捕獲並忽" +"略 :exc:`ImportError`,同時傳播所有其他例外並終止搜尋。" -#: ../../library/pkgutil.rst:166 +#: ../../library/pkgutil.rst:126 msgid "Examples::" msgstr "範例: ::" -#: ../../library/pkgutil.rst:168 +#: ../../library/pkgutil.rst:128 msgid "" "# list all modules python can access\n" "walk_packages()\n" @@ -271,37 +232,37 @@ msgstr "" "# 列出 ctypes 的所有子模組\n" "walk_packages(ctypes.__path__, ctypes.__name__ + '.')" -#: ../../library/pkgutil.rst:188 +#: ../../library/pkgutil.rst:148 msgid "Get a resource from a package." msgstr "從套件中取得資源。" -#: ../../library/pkgutil.rst:190 +#: ../../library/pkgutil.rst:150 msgid "" -"This is a wrapper for the :term:`loader` :meth:`get_data ` API. The *package* argument should be the name of " -"a package, in standard module format (``foo.bar``). The *resource* argument " -"should be in the form of a relative filename, using ``/`` as the path " -"separator. The parent directory name ``..`` is not allowed, and nor is a " -"rooted name (starting with a ``/``)." +"This is a wrapper for the :term:`loader` :meth:`get_data " +"` API. The *package* argument should " +"be the name of a package, in standard module format (``foo.bar``). The " +"*resource* argument should be in the form of a relative filename, using ``/" +"`` as the path separator. The parent directory name ``..`` is not allowed, " +"and nor is a rooted name (starting with a ``/``)." msgstr "" "這是 :term:`loader` :meth:`get_data ` " "API 的包裝器。*package* 引數應該是採用標準模組格式 (``foo.bar``) 的套件名稱。" "*resource* 引數應為相對檔案名稱的形式,並使用 ``/`` 作為路徑分隔符號。不允許" "使用父目錄名稱 ``..``,也不允許使用根目錄名稱(以 ``/`` 開頭)。" -#: ../../library/pkgutil.rst:197 +#: ../../library/pkgutil.rst:157 msgid "" "The function returns a binary string that is the contents of the specified " "resource." msgstr "該函式回傳一個二進位字串,它是指定資源的內容。" -#: ../../library/pkgutil.rst:200 +#: ../../library/pkgutil.rst:160 msgid "" "For packages located in the filesystem, which have already been imported, " "this is the rough equivalent of::" msgstr "對於位於檔案系統中且已被引入過的套件,這大致相當於: ::" -#: ../../library/pkgutil.rst:203 +#: ../../library/pkgutil.rst:163 msgid "" "d = os.path.dirname(sys.modules[package].__file__)\n" "data = open(os.path.join(d, resource), 'rb').read()" @@ -309,33 +270,34 @@ msgstr "" "d = os.path.dirname(sys.modules[package].__file__)\n" "data = open(os.path.join(d, resource), 'rb').read()" -#: ../../library/pkgutil.rst:206 +#: ../../library/pkgutil.rst:166 msgid "" "If the package cannot be located or loaded, or it uses a :term:`loader` " -"which does not support :meth:`get_data `, then ``None`` is returned. In particular, the :term:`loader` " -"for :term:`namespace packages ` does not support :meth:" -"`get_data `." +"which does not support :meth:`get_data " +"`, then ``None`` is returned. In " +"particular, the :term:`loader` for :term:`namespace packages ` does not support :meth:`get_data " +"`." msgstr "" -"如果無法定位或載入套件,或者它使用不支援 :meth:`get_data ` 的 :term:`loader` 則回傳 ``None``。特別是\\ :term:`" -"命名空間套件 `\\ 的 :term:`loader` 不支援 :meth:`get_data " -"`。" +"如果無法定位或載入套件,或者它使用不支援 :meth:`get_data " +"` 的 :term:`loader` 則回傳 ``None``。" +"特別是\\ :term:`命名空間套件 `\\ 的 :term:`loader` 不支" +"援 :meth:`get_data `。" -#: ../../library/pkgutil.rst:215 +#: ../../library/pkgutil.rst:175 msgid "Resolve a name to an object." msgstr "將名稱解析為物件。" -#: ../../library/pkgutil.rst:217 +#: ../../library/pkgutil.rst:177 msgid "" -"This functionality is used in numerous places in the standard library (see :" -"issue:`12915`) - and equivalent functionality is also in widely used third-" -"party packages such as setuptools, Django and Pyramid." +"This functionality is used in numerous places in the standard library " +"(see :issue:`12915`) - and equivalent functionality is also in widely used " +"third-party packages such as setuptools, Django and Pyramid." msgstr "" "標準函式庫中的許多地方都使用了此功能(請參閱 :issue:`12915`),且相同功能也被" "用於擁有廣大使用者的第三方套件,如 setuptools、Django 和 Pyramid。" -#: ../../library/pkgutil.rst:221 +#: ../../library/pkgutil.rst:181 msgid "" "It is expected that *name* will be a string in one of the following formats, " "where W is shorthand for a valid Python identifier and dot stands for a " @@ -344,15 +306,15 @@ msgstr "" "*name* 預期要是以下格式之一的字串,其中 W 是有效 Python 識別字的簡寫,而點 " "(dot) 代表這些偽正規表示式 (pseudo-regex) 中的字面句點 (literal period):" -#: ../../library/pkgutil.rst:225 +#: ../../library/pkgutil.rst:185 msgid "``W(.W)*``" msgstr "``W(.W)*``" -#: ../../library/pkgutil.rst:226 +#: ../../library/pkgutil.rst:186 msgid "``W(.W)*:(W(.W)*)?``" msgstr "``W(.W)*:(W(.W)*)?``" -#: ../../library/pkgutil.rst:228 +#: ../../library/pkgutil.rst:188 msgid "" "The first form is intended for backward compatibility only. It assumes that " "some part of the dotted name is a package, and the rest is an object " @@ -366,7 +328,7 @@ msgstr "" "於無法透過檢查 (inspection) 來推斷出套件停止的位置和物件層次結構的開始位置," "因此必須使用此形式來重複嘗試引入。" -#: ../../library/pkgutil.rst:235 +#: ../../library/pkgutil.rst:195 msgid "" "In the second form, the caller makes the division point clear through the " "provision of a single colon: the dotted name to the left of the colon is a " @@ -378,24 +340,57 @@ msgstr "" "引入的套件,右側的點名稱是該套件內的物件層次結構。這種形式只需要一次引入。如" "果它以冒號結尾,則回傳一個模組物件。" -#: ../../library/pkgutil.rst:241 +#: ../../library/pkgutil.rst:201 msgid "" "The function will return an object (which might be a module), or raise one " "of the following exceptions:" msgstr "此函式會回傳一個物件(可能是一個模組),或引發以下其中一個例外:" -#: ../../library/pkgutil.rst:244 +#: ../../library/pkgutil.rst:204 msgid ":exc:`ValueError` -- if *name* isn't in a recognised format." msgstr ":exc:`ValueError` -- 如果 *name* 不是可辨識的格式。" -#: ../../library/pkgutil.rst:246 +#: ../../library/pkgutil.rst:206 msgid ":exc:`ImportError` -- if an import failed when it shouldn't have." msgstr ":exc:`ImportError` -- 如果在不應該失敗的情況下引入失敗。" -#: ../../library/pkgutil.rst:248 +#: ../../library/pkgutil.rst:208 msgid "" ":exc:`AttributeError` -- If a failure occurred when traversing the object " "hierarchy within the imported package to get to the desired object." msgstr "" ":exc:`AttributeError` -- 如果在遍歷引入套件中的物件層次結構以取得所需物件時發" "生失敗。" + +#~ msgid "Retrieve a module :term:`loader` for the given *fullname*." +#~ msgstr "取得給定之 *fullname* 的模組 :term:`loader`。" + +#~ msgid "" +#~ "This is a backwards compatibility wrapper " +#~ "around :func:`importlib.util.find_spec` that converts most failures " +#~ "to :exc:`ImportError` and only returns the loader rather than the " +#~ "full :class:`importlib.machinery.ModuleSpec`." +#~ msgstr "" +#~ "這是一個 :func:`importlib.util.find_spec` 的向後相容包裝器,它將大多數的失" +#~ "敗轉換為 :exc:`ImportError` 並且僅回傳載入器而不是完整" +#~ "的 :class:`importlib.machinery.ModuleSpec`。" + +#~ msgid "Updated to be based on :pep:`451`" +#~ msgstr "基於 :pep:`451` 來更新" + +#~ msgid "Use :func:`importlib.util.find_spec` instead." +#~ msgstr "改用 :func:`importlib.util.find_spec`。" + +#~ msgid "Get a :term:`loader` object for *module_or_name*." +#~ msgstr "取得 *module_or_name* 的 :term:`loader` 物件。" + +#~ msgid "" +#~ "If the module or package is accessible via the normal import mechanism, a " +#~ "wrapper around the relevant part of that machinery is returned. Returns " +#~ "``None`` if the module cannot be found or imported. If the named module " +#~ "is not already imported, its containing package (if any) is imported, in " +#~ "order to establish the package ``__path__``." +#~ msgstr "" +#~ "如果可以透過正常引入機制存取模組或套件,則回傳該機制相關部分的包裝器。如果" +#~ "找不到或無法引入模組,則回傳 ``None``。如果指定的模組尚未被引入,則引入其" +#~ "包含的套件(如有存在)以建立套件 ``__path__``。" diff --git a/library/platform.po b/library/platform.po index f411588e976..094d59ed603 100644 --- a/library/platform.po +++ b/library/platform.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-13 00:18+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-06-11 14:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -88,8 +88,8 @@ msgid "" "To get at the \"64-bitness\" of the current interpreter, it is more reliable " "to query the :data:`sys.maxsize` attribute::" msgstr "" -"要取得目前直譯器的 \"64 位元性 (64-bitness)\",更可靠的做法是查詢 :data:`sys." -"maxsize` 屬性: ::" +"要取得目前直譯器的 \"64 位元性 (64-bitness)\",更可靠的做法是查" +"詢 :data:`sys.maxsize` 屬性: ::" #: ../../library/platform.rst:51 msgid "is_64bits = sys.maxsize > 2**32" @@ -264,12 +264,13 @@ msgstr "" #: ../../library/platform.rst:172 msgid "" "Fairly portable uname interface. Returns a :func:`~collections.namedtuple` " -"containing six attributes: :attr:`system`, :attr:`node`, :attr:`release`, :" -"attr:`version`, :attr:`machine`, and :attr:`processor`." +"containing six " +"attributes: :attr:`system`, :attr:`node`, :attr:`release`, :attr:`version`, :attr:`machine`, " +"and :attr:`processor`." msgstr "" -"具有高可攜性 (portable) 的 uname 介面。回傳包含六個屬性的 :func:" -"`~collections.namedtuple`::attr:`system`、:attr:`node`、:attr:`release`、:" -"attr:`version`、:attr:`machine` 和 :attr:`processor`。" +"具有高可攜性 (portable) 的 uname 介面。回傳包含六個屬性" +"的 :func:`~collections.namedtuple`::attr:`system`、:attr:`node`、:attr:`release`、:attr:`version`、:attr:`machine` " +"和 :attr:`processor`。" #: ../../library/platform.rst:176 msgid ":attr:`processor` is resolved late, on demand." @@ -277,11 +278,12 @@ msgstr ":attr:`processor` 會延遲解析,有需求時才會解析" #: ../../library/platform.rst:178 msgid "" -"Note: the first two attribute names differ from the names presented by :func:" -"`os.uname`, where they are named :attr:`!sysname` and :attr:`!nodename`." +"Note: the first two attribute names differ from the names presented " +"by :func:`os.uname`, where they are named :attr:`!sysname` and :attr:`!" +"nodename`." msgstr "" -"注意:前兩個屬性名稱與 :func:`os.uname` 提供的名稱不同,它們分別命名為 :attr:" -"`!sysname` 和 :attr:`!nodename`。" +"注意:前兩個屬性名稱與 :func:`os.uname` 提供的名稱不同,它們分別命名" +"為 :attr:`!sysname` 和 :attr:`!nodename`。" #: ../../library/platform.rst:182 msgid "Entries which cannot be determined are set to ``''``." @@ -342,8 +344,8 @@ msgid "" "As a hint: *ptype* is ``'Uniprocessor Free'`` on single processor NT " "machines and ``'Multiprocessor Free'`` on multi processor machines. The " "``'Free'`` refers to the OS version being free of debugging code. It could " -"also state ``'Checked'`` which means the OS version uses debugging code, i." -"e. code that checks arguments, ranges, etc." +"also state ``'Checked'`` which means the OS version uses debugging code, " +"i.e. code that checks arguments, ranges, etc." msgstr "" "一點提示:*ptype* 在單個處理器的 NT 機器上為 ``'Uniprocessor Free'``,而在多" "個處理器的機器上為 ``'Multiprocessor Free'``。``'Free'`` 是指該 OS 版本沒有除" @@ -394,8 +396,8 @@ msgstr "iOS 平台" #: ../../library/platform.rst:260 msgid "" -"Get iOS version information and return it as a :func:`~collections." -"namedtuple` with the following attributes:" +"Get iOS version information and return it as " +"a :func:`~collections.namedtuple` with the following attributes:" msgstr "" #: ../../library/platform.rst:263 @@ -473,8 +475,8 @@ msgid "" "Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor ``/" "usr/lib/os-release`` can be read." msgstr "" -"當 ``/etc/os-release`` 與 ``/usr/lib/os-release`` 均無法被讀取時將引發 :exc:" -"`OSError` 或其子類別。" +"當 ``/etc/os-release`` 與 ``/usr/lib/os-release`` 均無法被讀取時將引" +"發 :exc:`OSError` 或其子類別。" #: ../../library/platform.rst:304 msgid "" @@ -533,8 +535,8 @@ msgstr "" #: ../../library/platform.rst:340 msgid "" "``api_level`` - API level of the running device, as an integer (e.g. ``34`` " -"for Android 14). To get the API level which Python was built against, see :" -"func:`sys.getandroidapilevel`." +"for Android 14). To get the API level which Python was built against, " +"see :func:`sys.getandroidapilevel`." msgstr "" #: ../../library/platform.rst:344 @@ -563,8 +565,8 @@ msgstr "" #: ../../library/platform.rst:358 msgid "" -"Google maintains a `list of known model and device names `__." +"Google maintains a `list of known model and device names `__." msgstr "" #: ../../library/platform.rst:366 @@ -587,8 +589,8 @@ msgstr "可接受以下選項:" #: ../../library/platform.rst:379 msgid "" -"Print terse information about the platform. This is equivalent to calling :" -"func:`platform.platform` with the *terse* argument set to ``True``." +"Print terse information about the platform. This is equivalent to " +"calling :func:`platform.platform` with the *terse* argument set to ``True``." msgstr "" #: ../../library/platform.rst:384 @@ -604,3 +606,14 @@ msgid "" "``nonaliased``) to explicitly control the output format. These behave " "similarly to their corresponding options." msgstr "" + +#: ../../library/platform.rst:393 +msgid "Miscellaneous" +msgstr "" + +#: ../../library/platform.rst:397 +msgid "" +"Clear out the internal cache of information, such as the :func:`uname`. This " +"is typically useful when the platform's :func:`node` is changed by an " +"external process and one needs to retrieve the updated value." +msgstr "" diff --git a/library/pyexpat.po b/library/pyexpat.po index 9fea398e754..adbf2937581 100644 --- a/library/pyexpat.po +++ b/library/pyexpat.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-07 10:49+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,12 +30,12 @@ msgstr "如果你需要剖析不受信任或未經驗證的資料,請參閱 :r #: ../../library/pyexpat.rst:27 msgid "" "The :mod:`xml.parsers.expat` module is a Python interface to the Expat non-" -"validating XML parser. The module provides a single extension type, :class:" -"`xmlparser`, that represents the current state of an XML parser. After an :" -"class:`xmlparser` object has been created, various attributes of the object " -"can be set to handler functions. When an XML document is then fed to the " -"parser, the handler functions are called for the character data and markup " -"in the XML document." +"validating XML parser. The module provides a single extension " +"type, :class:`xmlparser`, that represents the current state of an XML " +"parser. After an :class:`xmlparser` object has been created, various " +"attributes of the object can be set to handler functions. When an XML " +"document is then fed to the parser, the handler functions are called for the " +"character data and markup in the XML document." msgstr "" #: ../../library/pyexpat.rst:37 @@ -50,8 +50,9 @@ msgstr "這個模組提供一個例外和一個型別物件:" #: ../../library/pyexpat.rst:45 msgid "" -"The exception raised when Expat reports an error. See section :ref:" -"`expaterror-objects` for more information on interpreting Expat errors." +"The exception raised when Expat reports an error. See " +"section :ref:`expaterror-objects` for more information on interpreting Expat " +"errors." msgstr "" #: ../../library/pyexpat.rst:51 @@ -121,8 +122,7 @@ msgstr "" msgid "" ":attr:`StartElementHandler` will receive the following strings for each " "element::" -msgstr "" -":attr:`StartElementHandler` 將會收到每個元素的以下字串: ::" +msgstr ":attr:`StartElementHandler` 將會收到每個元素的以下字串: ::" #: ../../library/pyexpat.rst:102 msgid "" @@ -136,10 +136,10 @@ msgstr "" #: ../../library/pyexpat.rst:106 msgid "" -"Due to limitations in the ``Expat`` library used by :mod:`pyexpat`, the :" -"class:`xmlparser` instance returned can only be used to parse a single XML " -"document. Call ``ParserCreate`` for each document to provide unique parser " -"instances." +"Due to limitations in the ``Expat`` library used by :mod:`pyexpat`, " +"the :class:`xmlparser` instance returned can only be used to parse a single " +"XML document. Call ``ParserCreate`` for each document to provide unique " +"parser instances." msgstr "" #: ../../library/pyexpat.rst:114 @@ -178,15 +178,15 @@ msgstr "" msgid "" "Sets the base to be used for resolving relative URIs in system identifiers " "in declarations. Resolving relative identifiers is left to the application: " -"this value will be passed through as the *base* argument to the :func:" -"`ExternalEntityRefHandler`, :func:`NotationDeclHandler`, and :func:" -"`UnparsedEntityDeclHandler` functions." +"this value will be passed through as the *base* argument to " +"the :func:`ExternalEntityRefHandler`, :func:`NotationDeclHandler`, " +"and :func:`UnparsedEntityDeclHandler` functions." msgstr "" #: ../../library/pyexpat.rst:153 msgid "" -"Returns a string containing the base set by a previous call to :meth:" -"`SetBase`, or ``None`` if :meth:`SetBase` hasn't been called." +"Returns a string containing the base set by a previous call " +"to :meth:`SetBase`, or ``None`` if :meth:`SetBase` hasn't been called." msgstr "" #: ../../library/pyexpat.rst:159 @@ -200,19 +200,19 @@ msgstr "" msgid "" "Create a \"child\" parser which can be used to parse an external parsed " "entity referred to by content parsed by the parent parser. The *context* " -"parameter should be the string passed to the :meth:" -"`ExternalEntityRefHandler` handler function, described below. The child " -"parser is created with the :attr:`ordered_attributes` and :attr:" -"`specified_attributes` set to the values of this parser." +"parameter should be the string passed to " +"the :meth:`ExternalEntityRefHandler` handler function, described below. The " +"child parser is created with the :attr:`ordered_attributes` " +"and :attr:`specified_attributes` set to the values of this parser." msgstr "" #: ../../library/pyexpat.rst:175 msgid "" "Control parsing of parameter entities (including the external DTD subset). " -"Possible *flag* values are :const:`XML_PARAM_ENTITY_PARSING_NEVER`, :const:" -"`XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE` and :const:" -"`XML_PARAM_ENTITY_PARSING_ALWAYS`. Return true if setting the flag was " -"successful." +"Possible *flag* values " +"are :const:`XML_PARAM_ENTITY_PARSING_NEVER`, :const:`XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE` " +"and :const:`XML_PARAM_ENTITY_PARSING_ALWAYS`. Return true if setting the " +"flag was successful." msgstr "" #: ../../library/pyexpat.rst:183 @@ -221,8 +221,8 @@ msgid "" "call the :attr:`ExternalEntityRefHandler` with :const:`None` for all " "arguments to allow an alternate DTD to be loaded. If the document does not " "contain a document type declaration, the :attr:`ExternalEntityRefHandler` " -"will still be called, but the :attr:`StartDoctypeDeclHandler` and :attr:" -"`EndDoctypeDeclHandler` will not be called." +"will still be called, but the :attr:`StartDoctypeDeclHandler` " +"and :attr:`EndDoctypeDeclHandler` will not be called." msgstr "" #: ../../library/pyexpat.rst:190 @@ -264,8 +264,8 @@ msgstr "" #: ../../library/pyexpat.rst:219 msgid "" "Note that :meth:`SetReparseDeferralEnabled` has been backported to some " -"prior releases of CPython as a security fix. Check for availability of :" -"meth:`SetReparseDeferralEnabled` using :func:`hasattr` if used in code " +"prior releases of CPython as a security fix. Check for availability " +"of :meth:`SetReparseDeferralEnabled` using :func:`hasattr` if used in code " "running across a variety of Python versions." msgstr "" @@ -289,12 +289,12 @@ msgstr "" #: ../../library/pyexpat.rst:247 msgid "" "Setting this to true causes the :class:`xmlparser` object to buffer textual " -"content returned by Expat to avoid multiple calls to the :meth:" -"`CharacterDataHandler` callback whenever possible. This can improve " -"performance substantially since Expat normally breaks character data into " -"chunks at every line ending. This attribute is false by default, and may be " -"changed at any time. Note that when it is false, data that does not contain " -"newlines may be chunked too." +"content returned by Expat to avoid multiple calls to " +"the :meth:`CharacterDataHandler` callback whenever possible. This can " +"improve performance substantially since Expat normally breaks character data " +"into chunks at every line ending. This attribute is false by default, and " +"may be changed at any time. Note that when it is false, data that does not " +"contain newlines may be chunked too." msgstr "" #: ../../library/pyexpat.rst:258 @@ -329,8 +329,8 @@ msgstr "" msgid "" "The following attributes contain values relating to the most recent error " "encountered by an :class:`xmlparser` object, and will only have correct " -"values once a call to :meth:`Parse` or :meth:`ParseFile` has raised an :exc:" -"`xml.parsers.expat.ExpatError` exception." +"values once a call to :meth:`Parse` or :meth:`ParseFile` has raised " +"an :exc:`xml.parsers.expat.ExpatError` exception." msgstr "" #: ../../library/pyexpat.rst:291 @@ -339,9 +339,9 @@ msgstr "" #: ../../library/pyexpat.rst:296 msgid "" -"Numeric code specifying the problem. This value can be passed to the :func:" -"`ErrorString` function, or compared to one of the constants defined in the " -"``errors`` object." +"Numeric code specifying the problem. This value can be passed to " +"the :func:`ErrorString` function, or compared to one of the constants " +"defined in the ``errors`` object." msgstr "" #: ../../library/pyexpat.rst:303 @@ -376,11 +376,11 @@ msgstr "" #: ../../library/pyexpat.rst:332 msgid "" -"Here is the list of handlers that can be set. To set a handler on an :class:" -"`xmlparser` object *o*, use ``o.handlername = func``. *handlername* must be " -"taken from the following list, and *func* must be a callable object " -"accepting the correct number of arguments. The arguments are all strings, " -"unless otherwise stated." +"Here is the list of handlers that can be set. To set a handler on " +"an :class:`xmlparser` object *o*, use ``o.handlername = func``. " +"*handlername* must be taken from the following list, and *func* must be a " +"callable object accepting the correct number of arguments. The arguments " +"are all strings, unless otherwise stated." msgstr "" #: ../../library/pyexpat.rst:341 @@ -434,9 +434,10 @@ msgstr "" #: ../../library/pyexpat.rst:388 msgid "" "Called for the start of every element. *name* is a string containing the " -"element name, and *attributes* is the element attributes. If :attr:" -"`ordered_attributes` is true, this is a list (see :attr:`ordered_attributes` " -"for a full description). Otherwise it's a dictionary mapping names to values." +"element name, and *attributes* is the element attributes. " +"If :attr:`ordered_attributes` is true, this is a list " +"(see :attr:`ordered_attributes` for a full description). Otherwise it's a " +"dictionary mapping names to values." msgstr "" #: ../../library/pyexpat.rst:397 @@ -451,20 +452,20 @@ msgstr "" msgid "" "Called for character data. This will be called for normal character data, " "CDATA marked content, and ignorable whitespace. Applications which must " -"distinguish these cases can use the :attr:`StartCdataSectionHandler`, :attr:" -"`EndCdataSectionHandler`, and :attr:`ElementDeclHandler` callbacks to " -"collect the required information. Note that the character data may be " -"chunked even if it is short and so you may receive more than one call to :" -"meth:`CharacterDataHandler`. Set the :attr:`buffer_text` instance attribute " -"to ``True`` to avoid that." +"distinguish these cases can use " +"the :attr:`StartCdataSectionHandler`, :attr:`EndCdataSectionHandler`, " +"and :attr:`ElementDeclHandler` callbacks to collect the required " +"information. Note that the character data may be chunked even if it is short " +"and so you may receive more than one call to :meth:`CharacterDataHandler`. " +"Set the :attr:`buffer_text` instance attribute to ``True`` to avoid that." msgstr "" #: ../../library/pyexpat.rst:419 msgid "" "Called for unparsed (NDATA) entity declarations. This is only present for " -"version 1.2 of the Expat library; for more recent versions, use :attr:" -"`EntityDeclHandler` instead. (The underlying function in the Expat library " -"has been declared obsolete.)" +"version 1.2 of the Expat library; for more recent versions, " +"use :attr:`EntityDeclHandler` instead. (The underlying function in the " +"Expat library has been declared obsolete.)" msgstr "" #: ../../library/pyexpat.rst:427 @@ -497,10 +498,10 @@ msgstr "" msgid "" "Called when the closing tag is reached for an element that contained a " "namespace declaration. This is called once for each namespace declaration " -"on the element in the reverse of the order for which the :attr:" -"`StartNamespaceDeclHandler` was called to indicate the start of each " -"namespace declaration's scope. Calls to this handler are made after the " -"corresponding :attr:`EndElementHandler` for the end of the element." +"on the element in the reverse of the order for which " +"the :attr:`StartNamespaceDeclHandler` was called to indicate the start of " +"each namespace declaration's scope. Calls to this handler are made after " +"the corresponding :attr:`EndElementHandler` for the end of the element." msgstr "" #: ../../library/pyexpat.rst:463 @@ -511,9 +512,9 @@ msgstr "" #: ../../library/pyexpat.rst:469 msgid "" -"Called at the start of a CDATA section. This and :attr:" -"`EndCdataSectionHandler` are needed to be able to identify the syntactical " -"start and end for CDATA sections." +"Called at the start of a CDATA section. This " +"and :attr:`EndCdataSectionHandler` are needed to be able to identify the " +"syntactical start and end for CDATA sections." msgstr "" #: ../../library/pyexpat.rst:476 @@ -560,14 +561,15 @@ msgid "" "responsible for creating the sub-parser using " "``ExternalEntityParserCreate(context)``, initializing it with the " "appropriate callbacks, and parsing the entity. This handler should return " -"an integer; if it returns ``0``, the parser will raise an :const:" -"`XML_ERROR_EXTERNAL_ENTITY_HANDLING` error, otherwise parsing will continue." +"an integer; if it returns ``0``, the parser will raise " +"an :const:`XML_ERROR_EXTERNAL_ENTITY_HANDLING` error, otherwise parsing will " +"continue." msgstr "" #: ../../library/pyexpat.rst:519 msgid "" -"If this handler is not provided, external entities are reported by the :attr:" -"`DefaultHandler` callback, if provided." +"If this handler is not provided, external entities are reported by " +"the :attr:`DefaultHandler` callback, if provided." msgstr "" #: ../../library/pyexpat.rst:526 @@ -580,9 +582,9 @@ msgstr "" #: ../../library/pyexpat.rst:536 msgid "" -"Expat's internal error number for the specific error. The :data:`errors." -"messages ` dictionary maps these error " -"numbers to Expat's error messages. For example::" +"Expat's internal error number for the specific error. " +"The :data:`errors.messages ` dictionary " +"maps these error numbers to Expat's error messages. For example::" msgstr "" #: ../../library/pyexpat.rst:540 @@ -717,9 +719,9 @@ msgstr "" #: ../../library/pyexpat.rst:620 msgid "" -"The values of the first two fields are constants defined in the :mod:`xml." -"parsers.expat.model` module. These constants can be collected in two " -"groups: the model type group and the quantifier group." +"The values of the first two fields are constants defined in " +"the :mod:`xml.parsers.expat.model` module. These constants can be collected " +"in two groups: the model type group and the quantifier group." msgstr "" #: ../../library/pyexpat.rst:624 @@ -780,8 +782,8 @@ msgid "" "of the :exc:`ExpatError` exception objects raised when an error has " "occurred. Since for backwards compatibility reasons, the constants' value is " "the error *message* and not the numeric error *code*, you do this by " -"comparing its :attr:`code` attribute with :samp:`errors.codes[errors." -"XML_ERROR_{CONSTANT_NAME}]`." +"comparing its :attr:`code` attribute " +"with :samp:`errors.codes[errors.XML_ERROR_{CONSTANT_NAME}]`." msgstr "" #: ../../library/pyexpat.rst:703 @@ -887,8 +889,8 @@ msgstr "" #: ../../library/pyexpat.rst:827 msgid "" "The parser determined that the document was not \"standalone\" though it " -"declared itself to be in the XML declaration, and the :attr:" -"`NotStandaloneHandler` was set and returned ``0``." +"declared itself to be in the XML declaration, and " +"the :attr:`NotStandaloneHandler` was set and returned ``0``." msgstr "" #: ../../library/pyexpat.rst:840 @@ -901,8 +903,8 @@ msgstr "" #: ../../library/pyexpat.rst:847 msgid "" "A behavioral change was requested after parsing started that can only be " -"changed before parsing has started. This is (currently) only raised by :" -"meth:`UseForeignDTD`." +"changed before parsing has started. This is (currently) only raised " +"by :meth:`UseForeignDTD`." msgstr "" #: ../../library/pyexpat.rst:854 @@ -979,16 +981,20 @@ msgid "" "breached." msgstr "" -#: ../../library/pyexpat.rst:944 +#: ../../library/pyexpat.rst:945 +msgid "The parser was tried to be stopped or suspended before it started." +msgstr "" + +#: ../../library/pyexpat.rst:951 msgid "Footnotes" msgstr "註解" -#: ../../library/pyexpat.rst:945 +#: ../../library/pyexpat.rst:952 msgid "" "The encoding string included in XML output should conform to the appropriate " "standards. For example, \"UTF-8\" is valid, but \"UTF8\" is not. See https://" -"www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl and https://www.iana." -"org/assignments/character-sets/character-sets.xhtml." +"www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl and https://" +"www.iana.org/assignments/character-sets/character-sets.xhtml." msgstr "" #: ../../library/pyexpat.rst:25 diff --git a/library/python.po b/library/python.po index 2c766353773..54a3e5e79d6 100644 --- a/library/python.po +++ b/library/python.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,3 +29,9 @@ msgid "" msgstr "" "本章節所描述的模組提供了與 Python 直譯器及其與環境互動相關的廣泛服務。以下是" "概觀:" + +#: ../../library/python.rst:33 +msgid "" +"See the :mod:`concurrent.interpreters` module, which similarly exposes core " +"runtime functionality." +msgstr "" diff --git a/library/queue.po b/library/queue.po index ba0d4abd768..ef13ffbcf5d 100644 --- a/library/queue.po +++ b/library/queue.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-26 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-09-27 00:12+0800\n" "Last-Translator: Allen Wu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,11 +51,11 @@ msgid "" "kept sorted (using the :mod:`heapq` module) and the lowest valued entry is " "retrieved first." msgstr "" -"此 module 實作三種型別的佇列,它們僅在取出條目的順序上有所不同。在 :abbr:" -"`FIFO (first-in, first-out)` 佇列中,先加入的任務是第一個被取出的。在 :abbr:" -"`LIFO (last-in, first-out)` 佇列中,最近被加入的條目是第一個被取出的(像堆疊 " -"(stack) 一樣操作)。使用優先佇列 (priority queue) 時,條目將保持排序狀態(使" -"用 :mod:`heapq` module),並先取出最低值條目。" +"此 module 實作三種型別的佇列,它們僅在取出條目的順序上有所不同。" +"在 :abbr:`FIFO (first-in, first-out)` 佇列中,先加入的任務是第一個被取出的。" +"在 :abbr:`LIFO (last-in, first-out)` 佇列中,最近被加入的條目是第一個被取出的" +"(像堆疊 (stack) 一樣操作)。使用優先佇列 (priority queue) 時,條目將保持排序" +"狀態(使用 :mod:`heapq` module),並先取出最低值條目。" #: ../../library/queue.rst:24 msgid "" @@ -160,27 +160,30 @@ msgstr "" #: ../../library/queue.rst:84 msgid "" -"Exception raised when non-blocking :meth:`~Queue.get` (or :meth:`~Queue." -"get_nowait`) is called on a :class:`Queue` object which is empty." +"Exception raised when non-blocking :meth:`~Queue.get` " +"(or :meth:`~Queue.get_nowait`) is called on a :class:`Queue` object which is " +"empty." msgstr "" -"當對一個空的 :class:`Queue` 物件呼叫非阻塞的 (non-blocking) :meth:`~Queue." -"get`\\ (或 :meth:`~Queue.get_nowait`\\ )將引發此例外。" +"當對一個空的 :class:`Queue` 物件呼叫非阻塞的 (non-" +"blocking) :meth:`~Queue.get`\\ (或 :meth:`~Queue.get_nowait`\\ )將引發此例" +"外。" #: ../../library/queue.rst:91 msgid "" -"Exception raised when non-blocking :meth:`~Queue.put` (or :meth:`~Queue." -"put_nowait`) is called on a :class:`Queue` object which is full." +"Exception raised when non-blocking :meth:`~Queue.put` " +"(or :meth:`~Queue.put_nowait`) is called on a :class:`Queue` object which is " +"full." msgstr "" -"當對一個已滿的 :class:`Queue` 物件呼叫非阻塞的 :meth:`~Queue.put`\\ (或 :" -"meth:`~Queue.put_nowait`\\ )將引發此例外。" +"當對一個已滿的 :class:`Queue` 物件呼叫非阻塞的 :meth:`~Queue.put`\\ " +"(或 :meth:`~Queue.put_nowait`\\ )將引發此例外。" #: ../../library/queue.rst:98 msgid "" "Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " "a :class:`Queue` object which has been shut down." msgstr "" -"當對一個已關閉的 :class:`Queue` 物件呼叫 :meth:`~Queue.put` 或 :meth:`~Queue.get` " -"時將引發此例外。" +"當對一個已關閉的 :class:`Queue` 物件呼叫 :meth:`~Queue.put` " +"或 :meth:`~Queue.get` 時將引發此例外。" #: ../../library/queue.rst:107 msgid "Queue Objects" @@ -188,8 +191,8 @@ msgstr "佇列物件" #: ../../library/queue.rst:109 msgid "" -"Queue objects (:class:`Queue`, :class:`LifoQueue`, or :class:" -"`PriorityQueue`) provide the public methods described below." +"Queue objects (:class:`Queue`, :class:`LifoQueue`, " +"or :class:`PriorityQueue`) provide the public methods described below." msgstr "" "佇列物件(:class:`Queue`、:class:`LifoQueue`、:class:`PriorityQueue`)提供下" "面描述的公用 method。" @@ -249,7 +252,7 @@ msgstr "如果佇列已被關閉,則引發 :exc:`ShutDown`。" msgid "Equivalent to ``put(item, block=False)``." msgstr "等效於 ``put(item, block=False)``。" -#: ../../library/queue.rst:156 ../../library/queue.rst:314 +#: ../../library/queue.rst:156 ../../library/queue.rst:297 msgid "" "Remove and return an item from the queue. If optional args *block* is true " "and *timeout* is ``None`` (the default), block if necessary until an item is " @@ -261,17 +264,17 @@ msgid "" msgstr "" "從佇列中移除並回傳一個項目。如果可選的 args *block* 為 true,且 *timeout* 為 " "``None``\\ (預設值),則在必要時阻塞,直到有可用的項目。如果 *timeout* 是正" -"數,則最多會阻塞 *timeout* 秒,如果該時間內沒有可用的項目,則會引發 :exc:" -"`Empty` 例外。否則(*block* 為 false),如果立即可用,則回傳一個項目,否則引" -"發 :exc:`Empty` 例外(在這種情況下,*timeout* 將被忽略)。" +"數,則最多會阻塞 *timeout* 秒,如果該時間內沒有可用的項目,則會引" +"發 :exc:`Empty` 例外。否則(*block* 為 false),如果立即可用,則回傳一個項" +"目,否則引發 :exc:`Empty` 例外(在這種情況下,*timeout* 將被忽略)。" #: ../../library/queue.rst:163 msgid "" "Prior to 3.0 on POSIX systems, and for all versions on Windows, if *block* " "is true and *timeout* is ``None``, this operation goes into an " "uninterruptible wait on an underlying lock. This means that no exceptions " -"can occur, and in particular a SIGINT will not trigger a :exc:" -"`KeyboardInterrupt`." +"can occur, and in particular a SIGINT will not trigger " +"a :exc:`KeyboardInterrupt`." msgstr "" "在 POSIX 系統的 3.0 版之前,以及 Windows 的所有版本,如果 *block* 為 true 且 " "*timeout* 為 ``None``,則此操作將在底層鎖上進入不間斷等待。這意味著不會發生例" @@ -281,10 +284,9 @@ msgstr "" msgid "" "Raises :exc:`ShutDown` if the queue has been shut down and is empty, or if " "the queue has been shut down immediately." -msgstr "" -"如果佇列已被關閉且為空,或佇列已立即關閉,則引發 :exc:`ShutDown`。" +msgstr "如果佇列已被關閉且為空,或佇列已立即關閉,則引發 :exc:`ShutDown`。" -#: ../../library/queue.rst:174 ../../library/queue.rst:324 +#: ../../library/queue.rst:174 ../../library/queue.rst:307 msgid "Equivalent to ``get(False)``." msgstr "等效於 ``get(False)``。" @@ -299,8 +301,9 @@ msgstr "" #: ../../library/queue.rst:182 msgid "" "Indicate that a formerly enqueued task is complete. Used by queue consumer " -"threads. For each :meth:`get` used to fetch a task, a subsequent call to :" -"meth:`task_done` tells the queue that the processing on the task is complete." +"threads. For each :meth:`get` used to fetch a task, a subsequent call " +"to :meth:`task_done` tells the queue that the processing on the task is " +"complete." msgstr "" "表示先前放入佇列的任務已完成。由佇列消費者執行緒使用。對於用來提取任務的每" "個 :meth:`get`,隨後呼叫 :meth:`task_done` 告訴佇列任務的處理已完成。" @@ -311,34 +314,36 @@ msgid "" "been processed (meaning that a :meth:`task_done` call was received for every " "item that had been :meth:`put` into the queue)." msgstr "" -"如果目前 :meth:`join` 阻塞,它將會在所有項目都已處理完畢後恢復(代表對於以 :" -"meth:`put` 放進佇列的每個項目,都要收到 :meth:`task_done` 的呼叫)。" +"如果目前 :meth:`join` 阻塞,它將會在所有項目都已處理完畢後恢復(代表對於" +"以 :meth:`put` 放進佇列的每個項目,都要收到 :meth:`task_done` 的呼叫)。" #: ../../library/queue.rst:190 msgid "" +"``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining item " +"in the queue." +msgstr "" + +#: ../../library/queue.rst:193 +msgid "" "Raises a :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "如果呼叫次數超過佇列中放置的項目數量,則引發 :exc:`ValueError`。" -#: ../../library/queue.rst:196 +#: ../../library/queue.rst:199 msgid "Blocks until all items in the queue have been gotten and processed." msgstr "持續阻塞直到佇列中的所有項目都已被取得並處理完畢。" -#: ../../library/queue.rst:198 +#: ../../library/queue.rst:201 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " -"queue. The count goes down whenever a consumer thread calls :meth:" -"`task_done` to indicate that the item was retrieved and all work on it is " -"complete. When the count of unfinished tasks drops to zero, :meth:`join` " -"unblocks." -msgstr "" -"每當項目被加到佇列中時,未完成任務的計數都會增加。每當消費者執行緒呼叫 :meth:" -"`task_done` 以指示該項目已被取出並且對其的所有工作都已完成時,計數就會下降。" -"當未完成任務的計數降至零時,:meth:`join` 將停止阻塞。" - -#: ../../library/queue.rst:205 -msgid "Waiting for task completion" +"queue. The count goes down whenever a consumer thread " +"calls :meth:`task_done` to indicate that the item was retrieved and all work " +"on it is complete. When the count of unfinished tasks drops to " +"zero, :meth:`join` unblocks." msgstr "" +"每當項目被加到佇列中時,未完成任務的計數都會增加。每當消費者執行緒呼" +"叫 :meth:`task_done` 以指示該項目已被取出並且對其的所有工作都已完成時,計數就" +"會下降。當未完成任務的計數降至零時,:meth:`join` 將停止阻塞。" #: ../../library/queue.rst:207 msgid "Example of how to wait for enqueued tasks to be completed::" @@ -376,72 +381,48 @@ msgstr "" #: ../../library/queue.rst:236 msgid "" -"When no longer needed, :class:`Queue` objects can be wound down until empty " -"or terminated immediately with a hard shutdown." +":class:`Queue` objects can be made to prevent further interaction by " +"shutting them down." msgstr "" #: ../../library/queue.rst:241 -msgid "Put a :class:`Queue` instance into a shutdown mode." -msgstr "" - -#: ../../library/queue.rst:243 -msgid "" -"The queue can no longer grow. Future calls to :meth:`~Queue.put` raise :exc:" -"`ShutDown`. Currently blocked callers of :meth:`~Queue.put` will be " -"unblocked and will raise :exc:`ShutDown` in the formerly blocked thread." -msgstr "" - -#: ../../library/queue.rst:248 -msgid "" -"If *immediate* is false (the default), the queue can be wound down normally " -"with :meth:`~Queue.get` calls to extract tasks that have already been loaded." -msgstr "" - -#: ../../library/queue.rst:252 msgid "" -"And if :meth:`~Queue.task_done` is called for each remaining task, a " -"pending :meth:`~Queue.join` will be unblocked normally." +"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` " +"raise :exc:`ShutDown`." msgstr "" -#: ../../library/queue.rst:255 +#: ../../library/queue.rst:244 msgid "" -"Once the queue is empty, future calls to :meth:`~Queue.get` will raise :exc:" -"`ShutDown`." +"By default, :meth:`~Queue.get` on a shut down queue will only raise once the " +"queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise " +"immediately instead." msgstr "" -#: ../../library/queue.rst:258 -msgid "" -"If *immediate* is true, the queue is terminated immediately. The queue is " -"drained to be completely empty and the count of unfinished tasks is reduced " -"by the number of tasks drained. If unfinished tasks is zero, callers of :" -"meth:`~Queue.join` are unblocked. Also, blocked callers of :meth:`~Queue." -"get` are unblocked and will raise :exc:`ShutDown` because the queue is empty." -msgstr "" - -#: ../../library/queue.rst:266 +#: ../../library/queue.rst:248 msgid "" -"Use caution when using :meth:`~Queue.join` with *immediate* set to true. " -"This unblocks the join even when no work has been done on the tasks, " -"violating the usual invariant for joining a queue." +"All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " +"unblocked. If *immediate* is true, a task will be marked as done for each " +"remaining item in the queue, which may unblock callers " +"of :meth:`~Queue.join`." msgstr "" -#: ../../library/queue.rst:274 +#: ../../library/queue.rst:257 msgid "SimpleQueue Objects" msgstr "SimpleQueue 物件" -#: ../../library/queue.rst:276 +#: ../../library/queue.rst:259 msgid "" ":class:`SimpleQueue` objects provide the public methods described below." msgstr ":class:`SimpleQueue` 物件提供下面描述的公用 method。" -#: ../../library/queue.rst:280 +#: ../../library/queue.rst:263 msgid "" "Return the approximate size of the queue. Note, qsize() > 0 doesn't " "guarantee that a subsequent get() will not block." msgstr "" "傳回佇列的近似大小。注意,qsize() > 0 並不能保證後續的 get() 不會阻塞。" -#: ../../library/queue.rst:286 +#: ../../library/queue.rst:269 msgid "" "Return ``True`` if the queue is empty, ``False`` otherwise. If empty() " "returns ``False`` it doesn't guarantee that a subsequent call to get() will " @@ -450,7 +431,7 @@ msgstr "" "如果佇列為空,則回傳 ``True``,否則回傳 ``False``。如果 empty() 回傳 " "``False``,則不保證後續呼叫 get() 不會阻塞。" -#: ../../library/queue.rst:293 +#: ../../library/queue.rst:276 msgid "" "Put *item* into the queue. The method never blocks and always succeeds " "(except for potential low-level errors such as failure to allocate memory). " @@ -461,7 +442,7 @@ msgstr "" "像是分配記憶體失敗)。可選的 args *block* 和 *timeout* 會被忽略,它們僅是為了" "與 :meth:`Queue.put` 相容才存在。" -#: ../../library/queue.rst:299 +#: ../../library/queue.rst:282 msgid "" "This method has a C implementation which is reentrant. That is, a ``put()`` " "or ``get()`` call can be interrupted by another ``put()`` call in the same " @@ -474,18 +455,18 @@ msgstr "" "鎖 (deadlock) 或損壞佇列中的內部狀態。這使得它適合在解構子 (destructor) 中使" "用,像是 ``__del__`` method 或 :mod:`weakref` 回呼函式 (callback)。" -#: ../../library/queue.rst:308 +#: ../../library/queue.rst:291 msgid "" -"Equivalent to ``put(item, block=False)``, provided for compatibility with :" -"meth:`Queue.put_nowait`." +"Equivalent to ``put(item, block=False)``, provided for compatibility " +"with :meth:`Queue.put_nowait`." msgstr "" "等效於 ``put(item, block=False)``,用於與 :meth:`Queue.put_nowait` 相容。" -#: ../../library/queue.rst:329 +#: ../../library/queue.rst:312 msgid "Class :class:`multiprocessing.Queue`" msgstr "Class :class:`multiprocessing.Queue`" -#: ../../library/queue.rst:330 +#: ../../library/queue.rst:313 msgid "" "A queue class for use in a multi-processing (rather than multi-threading) " "context." @@ -493,12 +474,12 @@ msgstr "" "用於多行程處理 (multi-processing)(而非多執行緒)情境 (context) 的佇列 " "class。" -#: ../../library/queue.rst:333 +#: ../../library/queue.rst:316 msgid "" ":class:`collections.deque` is an alternative implementation of unbounded " -"queues with fast atomic :meth:`~collections.deque.append` and :meth:" -"`~collections.deque.popleft` operations that do not require locking and also " -"support indexing." +"queues with fast atomic :meth:`~collections.deque.append` " +"and :meth:`~collections.deque.popleft` operations that do not require " +"locking and also support indexing." msgstr "" ":class:`collections.deque` 是無界佇列的替代實作,有快速且具原子性 (atomic) " "的 :meth:`~collections.deque.append` 和 :meth:`~collections.deque.popleft` 操" diff --git a/library/re.po b/library/re.po index da02815fe26..97394eb1b7d 100644 --- a/library/re.po +++ b/library/re.po @@ -8,7 +8,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-09-08 15:25+0800\n" "PO-Revision-Date: 2023-09-16 14:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,12 +36,12 @@ msgstr "此模組提供類似於 Perl 中正規表示式的配對操作。" #: ../../library/re.rst:17 msgid "" -"Both patterns and strings to be searched can be Unicode strings (:class:" -"`str`) as well as 8-bit strings (:class:`bytes`). However, Unicode strings " -"and 8-bit strings cannot be mixed: that is, you cannot match a Unicode " -"string with a bytes pattern or vice-versa; similarly, when asking for a " -"substitution, the replacement string must be of the same type as both the " -"pattern and the search string." +"Both patterns and strings to be searched can be Unicode strings " +"(:class:`str`) as well as 8-bit strings (:class:`bytes`). However, Unicode " +"strings and 8-bit strings cannot be mixed: that is, you cannot match a " +"Unicode string with a bytes pattern or vice-versa; similarly, when asking " +"for a substitution, the replacement string must be of the same type as both " +"the pattern and the search string." msgstr "" "被搜尋的模式 (pattern) 與字串可以是 Unicode 字串 (:class:`str`),也可以是 8-" "bit 字串 (:class:`bytes`)。然而,Unicode 字串和 8-bit 字串不能混用:也就是," @@ -169,7 +169,7 @@ msgstr "" msgid "The special characters are:" msgstr "" -#: ../../library/re.rst:101 ../../library/re.rst:1660 +#: ../../library/re.rst:101 ../../library/re.rst:1663 msgid "``.``" msgstr "``.``" @@ -200,10 +200,10 @@ msgid "" "string, and in :const:`MULTILINE` mode also matches before a newline. " "``foo`` matches both 'foo' and 'foobar', while the regular expression " "``foo$`` matches only 'foo'. More interestingly, searching for ``foo.$`` in " -"``'foo1\\nfoo2\\n'`` matches 'foo2' normally, but 'foo1' in :const:" -"`MULTILINE` mode; searching for a single ``$`` in ``'foo\\n'`` will find two " -"(empty) matches: one just before the newline, and one at the end of the " -"string." +"``'foo1\\nfoo2\\n'`` matches 'foo2' normally, but 'foo1' " +"in :const:`MULTILINE` mode; searching for a single ``$`` in ``'foo\\n'`` " +"will find two (empty) matches: one just before the newline, and one at the " +"end of the string." msgstr "" #: ../../library/re.rst:125 @@ -393,17 +393,17 @@ msgid "" "``\\b`` represents a single \"backspace\" character, not a word boundary as " "outside a set, and numeric escapes such as ``\\1`` are always octal escapes, " "not group references. Special sequences which do not match a single " -"character such as ``\\A`` and ``\\Z`` are not allowed." +"character such as ``\\A`` and ``\\z`` are not allowed." msgstr "" #: ../../library/re.rst:273 msgid "" -"Characters that are not within a range can be matched by :dfn:" -"`complementing` the set. If the first character of the set is ``'^'``, all " -"the characters that are *not* in the set will be matched. For example, " -"``[^5]`` will match any character except ``'5'``, and ``[^^]`` will match " -"any character except ``'^'``. ``^`` has no special meaning if it's not the " -"first character in the set." +"Characters that are not within a range can be matched " +"by :dfn:`complementing` the set. If the first character of the set is " +"``'^'``, all the characters that are *not* in the set will be matched. For " +"example, ``[^5]`` will match any character except ``'5'``, and ``[^^]`` will " +"match any character except ``'^'``. ``^`` has no special meaning if it's " +"not the first character in the set." msgstr "" #: ../../library/re.rst:280 @@ -579,13 +579,13 @@ msgid "" "Attempts to match ``...`` as if it was a separate regular expression, and if " "successful, continues to match the rest of the pattern following it. If the " "subsequent pattern fails to match, the stack can only be unwound to a point " -"*before* the ``(?>...)`` because once exited, the expression, known as an :" -"dfn:`atomic group`, has thrown away all stack points within itself. Thus, " -"``(?>.*).`` would never match anything because first the ``.*`` would match " -"all characters possible, then, having nothing left to match, the final ``.`` " -"would fail to match. Since there are no stack points saved in the Atomic " -"Group, and there is no stack point before it, the entire expression would " -"thus fail to match." +"*before* the ``(?>...)`` because once exited, the expression, known as " +"an :dfn:`atomic group`, has thrown away all stack points within itself. " +"Thus, ``(?>.*).`` would never match anything because first the ``.*`` would " +"match all characters possible, then, having nothing left to match, the final " +"``.`` would fail to match. Since there are no stack points saved in the " +"Atomic Group, and there is no stack point before it, the entire expression " +"would thus fail to match." msgstr "" #: ../../library/re.rst:416 @@ -713,8 +713,8 @@ msgid "" "length, meaning that ``abc`` or ``a|b`` are allowed, but ``a*`` and ``a{3,4}" "`` are not. Note that patterns which start with positive lookbehind " "assertions will not match at the beginning of the string being searched; you " -"will most likely want to use the :func:`search` function rather than the :" -"func:`match` function:" +"will most likely want to use the :func:`search` function rather than " +"the :func:`match` function:" msgstr "" #: ../../library/re.rst:489 @@ -807,9 +807,9 @@ msgstr "" #: ../../library/re.rst:559 msgid "" "The default word characters in Unicode (str) patterns are Unicode " -"alphanumerics and the underscore, but this can be changed by using the :py:" -"const:`~re.ASCII` flag. Word boundaries are determined by the current locale " -"if the :py:const:`~re.LOCALE` flag is used." +"alphanumerics and the underscore, but this can be changed by using " +"the :py:const:`~re.ASCII` flag. Word boundaries are determined by the " +"current locale if the :py:const:`~re.LOCALE` flag is used." msgstr "" #: ../../library/re.rst:567 @@ -833,110 +833,107 @@ msgid "" "current locale if the :py:const:`~re.LOCALE` flag is used." msgstr "" -#: ../../library/re.rst:586 -msgid "" -"Note that ``\\B`` does not match an empty string, which differs from RE " -"implementations in other programming languages such as Perl. This behavior " -"is kept for compatibility reasons." +#: ../../library/re.rst:584 +msgid "``\\B`` now matches empty input string." msgstr "" -#: ../../library/re.rst:592 +#: ../../library/re.rst:589 msgid "``\\d``" msgstr "``\\d``" -#: ../../library/re.rst:593 ../../library/re.rst:617 ../../library/re.rst:639 +#: ../../library/re.rst:590 ../../library/re.rst:614 ../../library/re.rst:636 msgid "For Unicode (str) patterns:" msgstr "" -#: ../../library/re.rst:594 +#: ../../library/re.rst:591 msgid "" "Matches any Unicode decimal digit (that is, any character in Unicode " "character category `[Nd]`__). This includes ``[0-9]``, and also many other " "digit characters." msgstr "" -#: ../../library/re.rst:598 +#: ../../library/re.rst:595 msgid "Matches ``[0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:602 ../../library/re.rst:624 ../../library/re.rst:647 +#: ../../library/re.rst:599 ../../library/re.rst:621 ../../library/re.rst:644 msgid "For 8-bit (bytes) patterns:" msgstr "" -#: ../../library/re.rst:603 +#: ../../library/re.rst:600 msgid "" "Matches any decimal digit in the ASCII character set; this is equivalent to " "``[0-9]``." msgstr "" -#: ../../library/re.rst:608 +#: ../../library/re.rst:605 msgid "``\\D``" msgstr "``\\D``" -#: ../../library/re.rst:609 +#: ../../library/re.rst:606 msgid "" "Matches any character which is not a decimal digit. This is the opposite of " "``\\d``." msgstr "" -#: ../../library/re.rst:612 +#: ../../library/re.rst:609 msgid "Matches ``[^0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:616 +#: ../../library/re.rst:613 msgid "``\\s``" msgstr "``\\s``" -#: ../../library/re.rst:618 +#: ../../library/re.rst:615 msgid "" -"Matches Unicode whitespace characters (as defined by :py:meth:`str." -"isspace`). This includes ``[ \\t\\n\\r\\f\\v]``, and also many other " -"characters, for example the non-breaking spaces mandated by typography rules " -"in many languages." +"Matches Unicode whitespace characters (as defined " +"by :py:meth:`str.isspace`). This includes ``[ \\t\\n\\r\\f\\v]``, and also " +"many other characters, for example the non-breaking spaces mandated by " +"typography rules in many languages." msgstr "" -#: ../../library/re.rst:622 +#: ../../library/re.rst:619 msgid "" "Matches ``[ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:625 +#: ../../library/re.rst:622 msgid "" "Matches characters considered whitespace in the ASCII character set; this is " "equivalent to ``[ \\t\\n\\r\\f\\v]``." msgstr "" -#: ../../library/re.rst:630 +#: ../../library/re.rst:627 msgid "``\\S``" msgstr "``\\S``" -#: ../../library/re.rst:631 +#: ../../library/re.rst:628 msgid "" "Matches any character which is not a whitespace character. This is the " "opposite of ``\\s``." msgstr "" -#: ../../library/re.rst:634 +#: ../../library/re.rst:631 msgid "" "Matches ``[^ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:638 +#: ../../library/re.rst:635 msgid "``\\w``" msgstr "``\\w``" -#: ../../library/re.rst:640 +#: ../../library/re.rst:637 msgid "" "Matches Unicode word characters; this includes all Unicode alphanumeric " "characters (as defined by :py:meth:`str.isalnum`), as well as the underscore " "(``_``)." msgstr "" -#: ../../library/re.rst:645 +#: ../../library/re.rst:642 msgid "Matches ``[a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:648 +#: ../../library/re.rst:645 msgid "" "Matches characters considered alphanumeric in the ASCII character set; this " "is equivalent to ``[a-zA-Z0-9_]``. If the :py:const:`~re.LOCALE` flag is " @@ -944,42 +941,50 @@ msgid "" "the underscore." msgstr "" -#: ../../library/re.rst:655 +#: ../../library/re.rst:652 msgid "``\\W``" msgstr "``\\W``" -#: ../../library/re.rst:656 +#: ../../library/re.rst:653 msgid "" "Matches any character which is not a word character. This is the opposite of " -"``\\w``. By default, matches non-underscore (``_``) characters for which :py:" -"meth:`str.isalnum` returns ``False``." +"``\\w``. By default, matches non-underscore (``_``) characters for " +"which :py:meth:`str.isalnum` returns ``False``." msgstr "" -#: ../../library/re.rst:661 +#: ../../library/re.rst:658 msgid "Matches ``[^a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:663 +#: ../../library/re.rst:660 msgid "" "If the :py:const:`~re.LOCALE` flag is used, matches characters which are " "neither alphanumeric in the current locale nor the underscore." msgstr "" -#: ../../library/re.rst:669 +#: ../../library/re.rst:667 +msgid "``\\z``" +msgstr "" + +#: ../../library/re.rst:668 +msgid "Matches only at the end of the string." +msgstr "" + +#: ../../library/re.rst:672 msgid "``\\Z``" msgstr "``\\Z``" -#: ../../library/re.rst:670 -msgid "Matches only at the end of the string." +#: ../../library/re.rst:673 +msgid "The same as ``\\z``. For compatibility with old Python versions." msgstr "" -#: ../../library/re.rst:686 +#: ../../library/re.rst:689 msgid "" "Most of the :ref:`escape sequences ` supported by Python " "string literals are also accepted by the regular expression parser::" msgstr "" -#: ../../library/re.rst:689 +#: ../../library/re.rst:692 msgid "" "\\a \\b \\f \\n\n" "\\N \\r \\t \\u\n" @@ -989,20 +994,20 @@ msgstr "" "\\N \\r \\t \\u\n" "\\U \\v \\x \\\\" -#: ../../library/re.rst:693 +#: ../../library/re.rst:696 msgid "" "(Note that ``\\b`` is used to represent word boundaries, and means " "\"backspace\" only inside character classes.)" msgstr "" -#: ../../library/re.rst:696 +#: ../../library/re.rst:699 msgid "" "``'\\u'``, ``'\\U'``, and ``'\\N'`` escape sequences are only recognized in " "Unicode (str) patterns. In bytes patterns they are errors. Unknown escapes " "of ASCII letters are reserved for future use and treated as errors." msgstr "" -#: ../../library/re.rst:702 +#: ../../library/re.rst:705 msgid "" "Octal escapes are included in a limited form. If the first digit is a 0, or " "if there are three octal digits, it is considered an octal escape. " @@ -1010,27 +1015,27 @@ msgid "" "are always at most three digits in length." msgstr "" -#: ../../library/re.rst:707 +#: ../../library/re.rst:710 msgid "The ``'\\u'`` and ``'\\U'`` escape sequences have been added." msgstr "" -#: ../../library/re.rst:710 +#: ../../library/re.rst:713 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter now are errors." msgstr "" -#: ../../library/re.rst:713 +#: ../../library/re.rst:716 msgid "" "The :samp:`'\\\\N\\\\{{name}\\\\}'` escape sequence has been added. As in " "string literals, it expands to the named Unicode character (e.g. ``'\\N{EM " "DASH}'``)." msgstr "" -#: ../../library/re.rst:721 +#: ../../library/re.rst:724 msgid "Module Contents" msgstr "模組內容" -#: ../../library/re.rst:723 +#: ../../library/re.rst:726 msgid "" "The module defines several functions, constants, and an exception. Some of " "the functions are simplified versions of the full featured methods for " @@ -1038,26 +1043,26 @@ msgid "" "compiled form." msgstr "" -#: ../../library/re.rst:730 +#: ../../library/re.rst:733 msgid "Flags" msgstr "旗標" -#: ../../library/re.rst:732 +#: ../../library/re.rst:735 msgid "" "Flag constants are now instances of :class:`RegexFlag`, which is a subclass " "of :class:`enum.IntFlag`." msgstr "" -#: ../../library/re.rst:739 +#: ../../library/re.rst:742 msgid "" "An :class:`enum.IntFlag` class containing the regex options listed below." msgstr "" -#: ../../library/re.rst:741 +#: ../../library/re.rst:744 msgid "- added to ``__all__``" msgstr "" -#: ../../library/re.rst:746 +#: ../../library/re.rst:749 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B``, ``\\d``, ``\\D``, ``\\s`` and " "``\\S`` perform ASCII-only matching instead of full Unicode matching. This " @@ -1065,27 +1070,28 @@ msgid "" "patterns." msgstr "" -#: ../../library/re.rst:750 +#: ../../library/re.rst:753 msgid "Corresponds to the inline flag ``(?a)``." msgstr "" -#: ../../library/re.rst:754 +#: ../../library/re.rst:757 msgid "" "The :py:const:`~re.U` flag still exists for backward compatibility, but is " "redundant in Python 3 since matches are Unicode by default for ``str`` " -"patterns, and Unicode matching isn't allowed for bytes patterns. :py:const:" -"`~re.UNICODE` and the inline flag ``(?u)`` are similarly redundant." +"patterns, and Unicode matching isn't allowed for bytes " +"patterns. :py:const:`~re.UNICODE` and the inline flag ``(?u)`` are similarly " +"redundant." msgstr "" -#: ../../library/re.rst:763 +#: ../../library/re.rst:766 msgid "Display debug information about compiled expression." msgstr "" -#: ../../library/re.rst:765 +#: ../../library/re.rst:768 msgid "No corresponding inline flag." msgstr "" -#: ../../library/re.rst:771 +#: ../../library/re.rst:774 msgid "" "Perform case-insensitive matching; expressions like ``[A-Z]`` will also " "match lowercase letters. Full Unicode matching (such as ``Ü`` matching " @@ -1094,33 +1100,33 @@ msgid "" "flag unless the :py:const:`~re.LOCALE` flag is also used." msgstr "" -#: ../../library/re.rst:779 +#: ../../library/re.rst:782 msgid "Corresponds to the inline flag ``(?i)``." msgstr "" -#: ../../library/re.rst:781 +#: ../../library/re.rst:784 msgid "" "Note that when the Unicode patterns ``[a-z]`` or ``[A-Z]`` are used in " "combination with the :const:`IGNORECASE` flag, they will match the 52 ASCII " "letters and 4 additional non-ASCII letters: 'İ' (U+0130, Latin capital " -"letter I with dot above), 'ı' (U+0131, Latin small letter dotless i), " -"'ſ' (U+017F, Latin small letter long s) and 'K' (U+212A, Kelvin sign). If " +"letter I with dot above), 'ı' (U+0131, Latin small letter dotless i), 'ſ' " +"(U+017F, Latin small letter long s) and 'K' (U+212A, Kelvin sign). If " "the :py:const:`~re.ASCII` flag is used, only letters 'a' to 'z' and 'A' to " "'Z' are matched." msgstr "" -#: ../../library/re.rst:792 +#: ../../library/re.rst:795 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B`` and case-insensitive matching " "dependent on the current locale. This flag can be used only with bytes " "patterns." msgstr "" -#: ../../library/re.rst:796 +#: ../../library/re.rst:799 msgid "Corresponds to the inline flag ``(?L)``." msgstr "" -#: ../../library/re.rst:800 +#: ../../library/re.rst:803 msgid "" "This flag is discouraged; consider Unicode matching instead. The locale " "mechanism is very unreliable as it only handles one \"culture\" at a time " @@ -1129,20 +1135,20 @@ msgid "" "languages." msgstr "" -#: ../../library/re.rst:807 +#: ../../library/re.rst:810 msgid "" ":py:const:`~re.LOCALE` can be used only with bytes patterns and is not " "compatible with :py:const:`~re.ASCII`." msgstr "" -#: ../../library/re.rst:811 +#: ../../library/re.rst:814 msgid "" "Compiled regular expression objects with the :py:const:`~re.LOCALE` flag no " "longer depend on the locale at compile time. Only the locale at matching " "time affects the result of matching." msgstr "" -#: ../../library/re.rst:820 +#: ../../library/re.rst:823 msgid "" "When specified, the pattern character ``'^'`` matches at the beginning of " "the string and at the beginning of each line (immediately following each " @@ -1153,11 +1159,11 @@ msgid "" "the end of the string." msgstr "" -#: ../../library/re.rst:827 +#: ../../library/re.rst:830 msgid "Corresponds to the inline flag ``(?m)``." msgstr "" -#: ../../library/re.rst:831 +#: ../../library/re.rst:834 msgid "" "Indicates no flag being applied, the value is ``0``. This flag may be used " "as a default value for a function keyword argument or as a base value that " @@ -1165,35 +1171,35 @@ msgid "" "value::" msgstr "" -#: ../../library/re.rst:836 +#: ../../library/re.rst:839 msgid "" "def myfunc(text, flag=re.NOFLAG):\n" " return re.match(text, flag)" msgstr "" -#: ../../library/re.rst:844 +#: ../../library/re.rst:847 msgid "" "Make the ``'.'`` special character match any character at all, including a " "newline; without this flag, ``'.'`` will match anything *except* a newline." msgstr "" -#: ../../library/re.rst:847 +#: ../../library/re.rst:850 msgid "Corresponds to the inline flag ``(?s)``." msgstr "" -#: ../../library/re.rst:853 +#: ../../library/re.rst:856 msgid "" "In Python 3, Unicode characters are matched by default for ``str`` patterns. " "This flag is therefore redundant with **no effect** and is only kept for " "backward compatibility." msgstr "" -#: ../../library/re.rst:858 +#: ../../library/re.rst:861 msgid "" "See :py:const:`~re.ASCII` to restrict matching to ASCII characters instead." msgstr "" -#: ../../library/re.rst:865 +#: ../../library/re.rst:868 msgid "" "This flag allows you to write regular expressions that look nicer and are " "more readable by allowing you to visually separate logical sections of the " @@ -1206,13 +1212,13 @@ msgid "" "ignored." msgstr "" -#: ../../library/re.rst:875 +#: ../../library/re.rst:878 msgid "" "This means that the two following regular expression objects that match a " "decimal number are functionally equal::" msgstr "" -#: ../../library/re.rst:878 +#: ../../library/re.rst:881 msgid "" "a = re.compile(r\"\"\"\\d + # the integral part\n" " \\. # the decimal point\n" @@ -1220,27 +1226,28 @@ msgid "" "b = re.compile(r\"\\d+\\.\\d*\")" msgstr "" -#: ../../library/re.rst:883 +#: ../../library/re.rst:886 msgid "Corresponds to the inline flag ``(?x)``." msgstr "" -#: ../../library/re.rst:887 +#: ../../library/re.rst:890 msgid "Functions" msgstr "函式" -#: ../../library/re.rst:891 +#: ../../library/re.rst:894 msgid "" "Compile a regular expression pattern into a :ref:`regular expression object " -"`, which can be used for matching using its :func:`~Pattern." -"match`, :func:`~Pattern.search` and other methods, described below." +"`, which can be used for matching using " +"its :func:`~Pattern.match`, :func:`~Pattern.search` and other methods, " +"described below." msgstr "" -"將正規表示式模式編譯成\\ :ref:`正規表示式物件 `,可以使用它的 :" -"func:`~Pattern.match`、:func:`~Pattern.search` 等方法來匹配,如下所述。" +"將正規表示式模式編譯成\\ :ref:`正規表示式物件 `,可以使用它" +"的 :func:`~Pattern.match`、:func:`~Pattern.search` 等方法來匹配,如下所述。" -#: ../../library/re.rst:896 ../../library/re.rst:928 ../../library/re.rst:946 -#: ../../library/re.rst:957 ../../library/re.rst:1003 ../../library/re.rst:1037 -#: ../../library/re.rst:1052 ../../library/re.rst:1114 -#: ../../library/re.rst:1149 +#: ../../library/re.rst:899 ../../library/re.rst:931 ../../library/re.rst:949 +#: ../../library/re.rst:960 ../../library/re.rst:1006 ../../library/re.rst:1040 +#: ../../library/re.rst:1055 ../../library/re.rst:1117 +#: ../../library/re.rst:1152 msgid "" "The expression's behaviour can be modified by specifying a *flags* value. " "Values can be any of the `flags`_ variables, combined using bitwise OR (the " @@ -1249,11 +1256,11 @@ msgstr "" "可以透過指定 *flags* 值來修改運算式的行為,值可以是任何 `flags`_ 變數,使用位" "元 OR(bitwise OR、``|`` 運算子)組合。" -#: ../../library/re.rst:900 +#: ../../library/re.rst:903 msgid "The sequence ::" msgstr "順序為: ::" -#: ../../library/re.rst:902 +#: ../../library/re.rst:905 msgid "" "prog = re.compile(pattern)\n" "result = prog.match(string)" @@ -1261,15 +1268,15 @@ msgstr "" "prog = re.compile(pattern)\n" "result = prog.match(string)" -#: ../../library/re.rst:905 +#: ../../library/re.rst:908 msgid "is equivalent to ::" msgstr "等價於: ::" -#: ../../library/re.rst:907 +#: ../../library/re.rst:910 msgid "result = re.match(pattern, string)" msgstr "result = re.match(pattern, string)" -#: ../../library/re.rst:909 +#: ../../library/re.rst:912 msgid "" "but using :func:`re.compile` and saving the resulting regular expression " "object for reuse is more efficient when the expression will be used several " @@ -1278,40 +1285,40 @@ msgstr "" "但是當表示式在單一程式中多次使用時,使用 :func:`re.compile` 並保存產生的正規" "表示式物件以供重複使用會更有效率。" -#: ../../library/re.rst:915 +#: ../../library/re.rst:918 msgid "" -"The compiled versions of the most recent patterns passed to :func:`re." -"compile` and the module-level matching functions are cached, so programs " -"that use only a few regular expressions at a time needn't worry about " -"compiling regular expressions." +"The compiled versions of the most recent patterns passed " +"to :func:`re.compile` and the module-level matching functions are cached, so " +"programs that use only a few regular expressions at a time needn't worry " +"about compiling regular expressions." msgstr "" "傳遞給 :func:`re.compile` 之最新模式的編譯版本和模組層級匹配函式都會被快取," "因此一次僅使用幾個正規表示式的程式不必去擔心編譯正規表示式。" -#: ../../library/re.rst:923 +#: ../../library/re.rst:926 msgid "" "Scan through *string* looking for the first location where the regular " -"expression *pattern* produces a match, and return a corresponding :class:" -"`~re.Match`. Return ``None`` if no position in the string matches the " -"pattern; note that this is different from finding a zero-length match at " -"some point in the string." +"expression *pattern* produces a match, and return a " +"corresponding :class:`~re.Match`. Return ``None`` if no position in the " +"string matches the pattern; note that this is different from finding a zero-" +"length match at some point in the string." msgstr "" -"掃描 *string* 以尋找正規表示式 *pattern* 產生匹配的第一個位置,並回傳對應的 :" -"class:`~re.Match`。如果字串中沒有與模式匹配的位置則回傳 ``None``;請注意,這" -"與在字串中的某個點查找零長度匹配不同。" +"掃描 *string* 以尋找正規表示式 *pattern* 產生匹配的第一個位置,並回傳對應" +"的 :class:`~re.Match`。如果字串中沒有與模式匹配的位置則回傳 ``None``;請注" +"意,這與在字串中的某個點查找零長度匹配不同。" -#: ../../library/re.rst:935 +#: ../../library/re.rst:938 msgid "" "If zero or more characters at the beginning of *string* match the regular " "expression *pattern*, return a corresponding :class:`~re.Match`. Return " "``None`` if the string does not match the pattern; note that this is " "different from a zero-length match." msgstr "" -"如果 *string* 開頭的零個或多個字元與正規表示式 *pattern* 匹配,則回傳對應的 :" -"class:`~re.Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零長度" -"匹配不同。" +"如果 *string* 開頭的零個或多個字元與正規表示式 *pattern* 匹配,則回傳對應" +"的 :class:`~re.Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零" +"長度匹配不同。" -#: ../../library/re.rst:940 +#: ../../library/re.rst:943 msgid "" "Note that even in :const:`MULTILINE` mode, :func:`re.match` will only match " "at the beginning of the string and not at the beginning of each line." @@ -1319,7 +1326,7 @@ msgstr "" "請注意,即使在 :const:`MULTILINE` 模式 (mode) 下,:func:`re.match` 只會於字串" "的開頭匹配,而非每行的開頭。" -#: ../../library/re.rst:943 +#: ../../library/re.rst:946 msgid "" "If you want to locate a match anywhere in *string*, use :func:`search` " "instead (see also :ref:`search-vs-match`)." @@ -1327,16 +1334,17 @@ msgstr "" "如果你想在 *string* 中的任何位置找到匹配項,請使用 :func:`search`\\ (另請參" "閱 :ref:`search-vs-match`)。" -#: ../../library/re.rst:953 +#: ../../library/re.rst:956 msgid "" "If the whole *string* matches the regular expression *pattern*, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" -"如果整個 *string* 與正規表示式 *pattern* 匹配,則回傳對應的 :class:`~re." -"Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零長度匹配不同。" +"如果整個 *string* 與正規表示式 *pattern* 匹配,則回傳對應" +"的 :class:`~re.Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零" +"長度匹配不同。" -#: ../../library/re.rst:966 +#: ../../library/re.rst:969 msgid "" "Split *string* by the occurrences of *pattern*. If capturing parentheses " "are used in *pattern*, then the text of all groups in the pattern are also " @@ -1348,7 +1356,7 @@ msgstr "" "中所有群組的文字也會作為結果串列的一部分回傳。如果 *maxsplit* 非零,則最多發" "生 *maxsplit* 次拆分,並且字串的其餘部分會作為串列的最終元素回傳。 ::" -#: ../../library/re.rst:972 +#: ../../library/re.rst:975 msgid "" ">>> re.split(r'\\W+', 'Words, words, words.')\n" "['Words', 'words', 'words', '']\n" @@ -1368,7 +1376,7 @@ msgstr "" ">>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE)\n" "['0', '3', '9']" -#: ../../library/re.rst:981 +#: ../../library/re.rst:984 msgid "" "If there are capturing groups in the separator and it matches at the start " "of the string, the result will start with an empty string. The same holds " @@ -1377,7 +1385,7 @@ msgstr "" "如果分隔符號中有捕獲群組並且它在字串的開頭匹配,則結果將以空字串開頭。這同樣" "適用於字串的結尾: ::" -#: ../../library/re.rst:985 +#: ../../library/re.rst:988 msgid "" ">>> re.split(r'(\\W+)', '...words, words...')\n" "['', '...', 'words', ', ', 'words', '...', '']" @@ -1385,19 +1393,19 @@ msgstr "" ">>> re.split(r'(\\W+)', '...words, words...')\n" "['', '...', 'words', ', ', 'words', '...', '']" -#: ../../library/re.rst:988 +#: ../../library/re.rst:991 msgid "" "That way, separator components are always found at the same relative indices " "within the result list." msgstr "如此一來,分隔符號元件始終可以在結果串列中的相同相對索引處找到。" -#: ../../library/re.rst:991 +#: ../../library/re.rst:994 msgid "" "Adjacent empty matches are not possible, but an empty match can occur " "immediately after a non-empty match." msgstr "" -#: ../../library/re.rst:994 +#: ../../library/re.rst:997 msgid "" ">>> re.split(r'\\b', 'Words, words, words.')\n" "['', 'Words', ', ', 'words', ', ', 'words', '.']\n" @@ -1415,16 +1423,16 @@ msgstr "" "['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', " "'']" -#: ../../library/re.rst:1007 ../../library/re.rst:1118 +#: ../../library/re.rst:1010 ../../library/re.rst:1121 msgid "Added the optional flags argument." msgstr "新增可選的旗標引數。" -#: ../../library/re.rst:1010 +#: ../../library/re.rst:1013 msgid "" "Added support of splitting on a pattern that could match an empty string." msgstr "新增了對可以匹配空字串之模式進行拆分的支援。" -#: ../../library/re.rst:1013 +#: ../../library/re.rst:1016 msgid "" "Passing *maxsplit* and *flags* as positional arguments is deprecated. In " "future Python versions they will be :ref:`keyword-only parameters `。" -#: ../../library/re.rst:1021 +#: ../../library/re.rst:1024 msgid "" "Return all non-overlapping matches of *pattern* in *string*, as a list of " "strings or tuples. The *string* is scanned left-to-right, and matches are " @@ -1442,7 +1450,7 @@ msgstr "" "以字串或元組串列的形式回傳 *string* 中 *pattern* 的所有非重疊匹配項。從左到右" "掃描 *string*,並按找到的順序回傳符合項目。結果中會包含空匹配項。" -#: ../../library/re.rst:1025 +#: ../../library/re.rst:1028 msgid "" "The result depends on the number of capturing groups in the pattern. If " "there are no groups, return a list of strings matching the whole pattern. " @@ -1455,11 +1463,11 @@ msgstr "" "列。如果恰好存在一個群組,則回傳與該群組匹配的字串串列。如果存在多個群組,則" "回傳與群組匹配的字串元組串列。非捕獲群組則不影響結果的形式。" -#: ../../library/re.rst:1041 ../../library/re.rst:1056 +#: ../../library/re.rst:1044 ../../library/re.rst:1059 msgid "Non-empty matches can now start just after a previous empty match." msgstr "非空匹配現在可以剛好在前一個空匹配的後面開始。" -#: ../../library/re.rst:1047 +#: ../../library/re.rst:1050 msgid "" "Return an :term:`iterator` yielding :class:`~re.Match` objects over all non-" "overlapping matches for the RE *pattern* in *string*. The *string* is " @@ -1470,7 +1478,7 @@ msgstr "" "yield :class:`~re.Match` 物件。從左到右掃描 *string*,並按找到的順序回傳匹配" "項目。結果中包含空匹配項。" -#: ../../library/re.rst:1062 +#: ../../library/re.rst:1065 msgid "" "Return the string obtained by replacing the leftmost non-overlapping " "occurrences of *pattern* in *string* by the replacement *repl*. If the " @@ -1490,7 +1498,7 @@ msgstr "" "留以供將來使用並被視為錯誤。其他未知跳脫符例如 ``\\&`` 會被單獨保留。例如 " "``\\6`` 的反向參照將被替換為模式中第 6 組匹配的子字串。例如: ::" -#: ../../library/re.rst:1073 +#: ../../library/re.rst:1076 msgid "" ">>> re.sub(r'def\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\(\\s*\\):',\n" "... r'static PyObject*\\npy_\\1(void)\\n{',\n" @@ -1502,7 +1510,7 @@ msgstr "" "... 'def myfunc():')\n" "'static PyObject*\\npy_myfunc(void)\\n{'" -#: ../../library/re.rst:1078 +#: ../../library/re.rst:1081 msgid "" "If *repl* is a function, it is called for every non-overlapping occurrence " "of *pattern*. The function takes a single :class:`~re.Match` argument, and " @@ -1511,7 +1519,7 @@ msgstr "" "如果 *repl* 是一個函式,則 *pattern* 的每個不重疊出現之處都會呼叫它。此函式接" "收單一 :class:`~re.Match` 引數,並回傳替換字串。例如: ::" -#: ../../library/re.rst:1082 +#: ../../library/re.rst:1085 msgid "" ">>> def dashrepl(matchobj):\n" "... if matchobj.group(0) == '-': return ' '\n" @@ -1519,8 +1527,8 @@ msgid "" "...\n" ">>> re.sub('-{1,2}', dashrepl, 'pro----gram-files')\n" "'pro--gram files'\n" -">>> re.sub(r'\\sAND\\s', ' & ', 'Baked Beans And Spam', flags=re." -"IGNORECASE)\n" +">>> re.sub(r'\\sAND\\s', ' & ', 'Baked Beans And Spam', " +"flags=re.IGNORECASE)\n" "'Baked Beans & Spam'" msgstr "" ">>> def dashrepl(matchobj):\n" @@ -1529,15 +1537,15 @@ msgstr "" "...\n" ">>> re.sub('-{1,2}', dashrepl, 'pro----gram-files')\n" "'pro--gram files'\n" -">>> re.sub(r'\\sAND\\s', ' & ', 'Baked Beans And Spam', flags=re." -"IGNORECASE)\n" +">>> re.sub(r'\\sAND\\s', ' & ', 'Baked Beans And Spam', " +"flags=re.IGNORECASE)\n" "'Baked Beans & Spam'" -#: ../../library/re.rst:1091 +#: ../../library/re.rst:1094 msgid "The pattern may be a string or a :class:`~re.Pattern`." msgstr "此模式可以是字串或 :class:`~re.Pattern`。" -#: ../../library/re.rst:1093 +#: ../../library/re.rst:1096 msgid "" "The optional argument *count* is the maximum number of pattern occurrences " "to be replaced; *count* must be a non-negative integer. If omitted or zero, " @@ -1546,14 +1554,14 @@ msgstr "" "可選引數 *count* 是要替換的模式出現的最大次數;*count* 必須是非負整數。如果省" "略或為零,則所有出現的內容都將被替換。" -#: ../../library/re.rst:1097 +#: ../../library/re.rst:1100 msgid "" "Adjacent empty matches are not possible, but an empty match can occur " "immediately after a non-empty match. As a result, ``sub('x*', '-', 'abxd')`` " "returns ``'-a-b--d-'`` instead of ``'-a-b-d-'``." msgstr "" -#: ../../library/re.rst:1104 +#: ../../library/re.rst:1107 msgid "" "In string-type *repl* arguments, in addition to the character escapes and " "backreferences described above, ``\\g`` will use the substring matched " @@ -1572,26 +1580,26 @@ msgstr "" "群組 20 的參照,而不是對後面跟著字面字元 ``'0'`` 的群組 2 的參照。反向參照 " "``\\g<0>`` 會取代以 RE 所匹配到的整個子字串。" -#: ../../library/re.rst:1121 ../../library/re.rst:1398 +#: ../../library/re.rst:1124 ../../library/re.rst:1401 msgid "Unmatched groups are replaced with an empty string." msgstr "不匹配的群組將被替換為空字串。" -#: ../../library/re.rst:1124 +#: ../../library/re.rst:1127 msgid "" "Unknown escapes in *pattern* consisting of ``'\\'`` and an ASCII letter now " "are errors." msgstr "" "在由 ``'\\'`` 和一個 ASCII 字母組成之 *pattern* 中的未知跳脫符現在為錯誤。" -#: ../../library/re.rst:1128 +#: ../../library/re.rst:1131 msgid "" "Unknown escapes in *repl* consisting of ``'\\'`` and an ASCII letter now are " "errors. An empty match can occur immediately after a non-empty match." msgstr "" -"由 ``'\\'`` 和一個 ASCII 字母組成之 *repl* 中的未知跳脫符現在為錯誤。" -"非空匹配後可以緊接著出現空匹配。" +"由 ``'\\'`` 和一個 ASCII 字母組成之 *repl* 中的未知跳脫符現在為錯誤。非空匹配" +"後可以緊接著出現空匹配。" -#: ../../library/re.rst:1133 +#: ../../library/re.rst:1136 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` replacement " "strings, group *name* can only contain bytes in the ASCII range " @@ -1600,7 +1608,7 @@ msgstr "" "群組 *id* 只能包含 ASCII 數字。在 :class:`bytes` 替換字串中,群組 *name* 只能" "包含 ASCII 範圍內的位元組 (``b'\\x00'``-``b'\\x7f'``)。" -#: ../../library/re.rst:1138 +#: ../../library/re.rst:1141 msgid "" "Passing *count* and *flags* as positional arguments is deprecated. In future " "Python versions they will be :ref:`keyword-only parameters `。" -#: ../../library/re.rst:1146 +#: ../../library/re.rst:1149 msgid "" "Perform the same operation as :func:`sub`, but return a tuple ``(new_string, " "number_of_subs_made)``." @@ -1617,7 +1625,7 @@ msgstr "" "執行與 :func:`sub` 相同的操作,但回傳一個元組 ``(new_string, " "number_of_subs_made)``。" -#: ../../library/re.rst:1156 +#: ../../library/re.rst:1159 msgid "" "Escape special characters in *pattern*. This is useful if you want to match " "an arbitrary literal string that may have regular expression metacharacters " @@ -1626,7 +1634,7 @@ msgstr "" "對 *pattern* 中的特殊字元進行跳脫。如果你想要匹配其中可能包含正規表示式元字" "元 (metacharacter) 的任意文本字串,這會非常有用。例如: ::" -#: ../../library/re.rst:1160 +#: ../../library/re.rst:1163 msgid "" ">>> print(re.escape('https://www.python.org'))\n" "https://www\\.python\\.org\n" @@ -1652,7 +1660,7 @@ msgstr "" ">>> print('|'.join(map(re.escape, sorted(operators, reverse=True))))\n" "/|\\-|\\+|\\*\\*|\\*" -#: ../../library/re.rst:1171 +#: ../../library/re.rst:1174 msgid "" "This function must not be used for the replacement string in :func:`sub` " "and :func:`subn`, only backslashes should be escaped. For example::" @@ -1660,7 +1668,7 @@ msgstr "" "此函式不得用於 :func:`sub` 和 :func:`subn` 中的替換字串,僅應跳脫反斜線。例" "如: ::" -#: ../../library/re.rst:1174 +#: ../../library/re.rst:1177 msgid "" ">>> digits_re = r'\\d+'\n" ">>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'\n" @@ -1672,11 +1680,11 @@ msgstr "" ">>> print(re.sub(digits_re, digits_re.replace('\\\\', r'\\\\'), sample))\n" "/usr/sbin/sendmail - \\d+ errors, \\d+ warnings" -#: ../../library/re.rst:1179 +#: ../../library/re.rst:1182 msgid "The ``'_'`` character is no longer escaped." msgstr "``'_'`` 字元不再被跳脫。" -#: ../../library/re.rst:1182 +#: ../../library/re.rst:1185 msgid "" "Only characters that can have special meaning in a regular expression are " "escaped. As a result, ``'!'``, ``'\"'``, ``'%'``, ``\"'\"``, ``','``, " @@ -1684,15 +1692,15 @@ msgid "" "are no longer escaped." msgstr "" -#: ../../library/re.rst:1191 +#: ../../library/re.rst:1194 msgid "Clear the regular expression cache." msgstr "清除正規表示式快取。" -#: ../../library/re.rst:1195 +#: ../../library/re.rst:1198 msgid "Exceptions" msgstr "例外" -#: ../../library/re.rst:1199 +#: ../../library/re.rst:1202 msgid "" "Exception raised when a string passed to one of the functions here is not a " "valid regular expression (for example, it might contain unmatched " @@ -1705,52 +1713,52 @@ msgstr "" "或在編譯或匹配期間發生某些其他錯誤時,將引發例外。如果字串不包含模式匹配項," "則絕不是錯誤。``PatternError`` 實例具有以下附加屬性:" -#: ../../library/re.rst:1207 +#: ../../library/re.rst:1210 msgid "The unformatted error message." msgstr "未格式化的錯誤訊息。" -#: ../../library/re.rst:1211 +#: ../../library/re.rst:1214 msgid "The regular expression pattern." msgstr "正規表示式模式。" -#: ../../library/re.rst:1215 +#: ../../library/re.rst:1218 msgid "The index in *pattern* where compilation failed (may be ``None``)." msgstr "*pattern* 中編譯失敗的索引(可能是 ``None``)。" -#: ../../library/re.rst:1219 +#: ../../library/re.rst:1222 msgid "The line corresponding to *pos* (may be ``None``)." msgstr "對應 *pos* 的列(可能是 ``None``)。" -#: ../../library/re.rst:1223 +#: ../../library/re.rst:1226 msgid "The column corresponding to *pos* (may be ``None``)." msgstr "對應 *pos* 的欄(可能是 ``None``)。" -#: ../../library/re.rst:1225 +#: ../../library/re.rst:1228 msgid "Added additional attributes." msgstr "新增額外屬性。" -#: ../../library/re.rst:1228 +#: ../../library/re.rst:1231 msgid "" "``PatternError`` was originally named ``error``; the latter is kept as an " "alias for backward compatibility." msgstr "" "``PatternError`` 最初被命名為 ``error``;後者為了向後相容性而被保留為別名。" -#: ../../library/re.rst:1235 +#: ../../library/re.rst:1238 msgid "Regular Expression Objects" msgstr "" -#: ../../library/re.rst:1239 +#: ../../library/re.rst:1242 msgid "Compiled regular expression object returned by :func:`re.compile`." msgstr "" -#: ../../library/re.rst:1241 +#: ../../library/re.rst:1244 msgid "" ":py:class:`re.Pattern` supports ``[]`` to indicate a Unicode (str) or bytes " "pattern. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1247 +#: ../../library/re.rst:1250 msgid "" "Scan through *string* looking for the first location where this regular " "expression produces a match, and return a corresponding :class:`~re.Match`. " @@ -1759,7 +1767,7 @@ msgid "" "string." msgstr "" -#: ../../library/re.rst:1252 +#: ../../library/re.rst:1255 msgid "" "The optional second parameter *pos* gives an index in the string where the " "search is to start; it defaults to ``0``. This is not completely equivalent " @@ -1768,7 +1776,7 @@ msgid "" "necessarily at the index where the search is to start." msgstr "" -#: ../../library/re.rst:1258 +#: ../../library/re.rst:1261 msgid "" "The optional parameter *endpos* limits how far the string will be searched; " "it will be as if the string is *endpos* characters long, so only the " @@ -1778,7 +1786,7 @@ msgid "" "equivalent to ``rx.search(string[:50], 0)``. ::" msgstr "" -#: ../../library/re.rst:1265 +#: ../../library/re.rst:1268 msgid "" ">>> pattern = re.compile(\"d\")\n" ">>> pattern.search(\"dog\") # Match at index 0\n" @@ -1786,7 +1794,7 @@ msgid "" ">>> pattern.search(\"dog\", 1) # No match; search doesn't include the \"d\"" msgstr "" -#: ../../library/re.rst:1273 +#: ../../library/re.rst:1276 msgid "" "If zero or more characters at the *beginning* of *string* match this regular " "expression, return a corresponding :class:`~re.Match`. Return ``None`` if " @@ -1794,13 +1802,13 @@ msgid "" "zero-length match." msgstr "" -#: ../../library/re.rst:1278 ../../library/re.rst:1296 +#: ../../library/re.rst:1281 ../../library/re.rst:1299 msgid "" -"The optional *pos* and *endpos* parameters have the same meaning as for the :" -"meth:`~Pattern.search` method. ::" +"The optional *pos* and *endpos* parameters have the same meaning as for " +"the :meth:`~Pattern.search` method. ::" msgstr "" -#: ../../library/re.rst:1281 +#: ../../library/re.rst:1284 msgid "" ">>> pattern = re.compile(\"o\")\n" ">>> pattern.match(\"dog\") # No match as \"o\" is not at the start of " @@ -1810,20 +1818,20 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1286 +#: ../../library/re.rst:1289 msgid "" -"If you want to locate a match anywhere in *string*, use :meth:`~Pattern." -"search` instead (see also :ref:`search-vs-match`)." +"If you want to locate a match anywhere in *string*, " +"use :meth:`~Pattern.search` instead (see also :ref:`search-vs-match`)." msgstr "" -#: ../../library/re.rst:1292 +#: ../../library/re.rst:1295 msgid "" "If the whole *string* matches this regular expression, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" -#: ../../library/re.rst:1299 +#: ../../library/re.rst:1302 msgid "" ">>> pattern = re.compile(\"o[gh]\")\n" ">>> pattern.fullmatch(\"dog\") # No match as \"o\" is not at the start " @@ -1834,72 +1842,74 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1310 +#: ../../library/re.rst:1313 msgid "Identical to the :func:`split` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1315 +#: ../../library/re.rst:1318 msgid "" "Similar to the :func:`findall` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1322 +#: ../../library/re.rst:1325 msgid "" "Similar to the :func:`finditer` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1329 +#: ../../library/re.rst:1332 msgid "Identical to the :func:`sub` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1334 +#: ../../library/re.rst:1337 msgid "Identical to the :func:`subn` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1339 +#: ../../library/re.rst:1342 msgid "" -"The regex matching flags. This is a combination of the flags given to :func:" -"`.compile`, any ``(?...)`` inline flags in the pattern, and implicit flags " -"such as :py:const:`~re.UNICODE` if the pattern is a Unicode string." +"The regex matching flags. This is a combination of the flags given " +"to :func:`.compile`, any ``(?...)`` inline flags in the pattern, and " +"implicit flags such as :py:const:`~re.UNICODE` if the pattern is a Unicode " +"string." msgstr "" -#: ../../library/re.rst:1346 +#: ../../library/re.rst:1349 msgid "The number of capturing groups in the pattern." msgstr "" -#: ../../library/re.rst:1351 +#: ../../library/re.rst:1354 msgid "" "A dictionary mapping any symbolic group names defined by ``(?P)`` to " "group numbers. The dictionary is empty if no symbolic groups were used in " "the pattern." msgstr "" -#: ../../library/re.rst:1358 +#: ../../library/re.rst:1361 msgid "The pattern string from which the pattern object was compiled." msgstr "" -#: ../../library/re.rst:1361 +#: ../../library/re.rst:1364 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Compiled " "regular expression objects are considered atomic." msgstr "" -#: ../../library/re.rst:1369 +#: ../../library/re.rst:1372 msgid "Match Objects" msgstr "" -#: ../../library/re.rst:1371 +#: ../../library/re.rst:1374 msgid "" -"Match objects always have a boolean value of ``True``. Since :meth:`~Pattern." -"match` and :meth:`~Pattern.search` return ``None`` when there is no match, " -"you can test whether there was a match with a simple ``if`` statement::" +"Match objects always have a boolean value of ``True``. " +"Since :meth:`~Pattern.match` and :meth:`~Pattern.search` return ``None`` " +"when there is no match, you can test whether there was a match with a simple " +"``if`` statement::" msgstr "" -#: ../../library/re.rst:1376 +#: ../../library/re.rst:1379 msgid "" "match = re.search(pattern, string)\n" "if match:\n" @@ -1909,17 +1919,17 @@ msgstr "" "if match:\n" " process(match)" -#: ../../library/re.rst:1382 +#: ../../library/re.rst:1385 msgid "Match object returned by successful ``match``\\ es and ``search``\\ es." msgstr "" -#: ../../library/re.rst:1384 +#: ../../library/re.rst:1387 msgid "" ":py:class:`re.Match` supports ``[]`` to indicate a Unicode (str) or bytes " "match. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1390 +#: ../../library/re.rst:1393 msgid "" "Return the string obtained by doing backslash substitution on the template " "string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such " @@ -1929,7 +1939,7 @@ msgid "" "backreference ``\\g<0>`` will be replaced by the entire match." msgstr "" -#: ../../library/re.rst:1403 +#: ../../library/re.rst:1406 msgid "" "Returns one or more subgroups of the match. If there is a single argument, " "the result is a single string; if there are multiple arguments, the result " @@ -1944,7 +1954,7 @@ msgid "" "the pattern that matched multiple times, the last match is returned. ::" msgstr "" -#: ../../library/re.rst:1415 +#: ../../library/re.rst:1418 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m.group(0) # The entire match\n" @@ -1957,19 +1967,19 @@ msgid "" "('Isaac', 'Newton')" msgstr "" -#: ../../library/re.rst:1425 +#: ../../library/re.rst:1428 msgid "" "If the regular expression uses the ``(?P...)`` syntax, the *groupN* " "arguments may also be strings identifying groups by their group name. If a " -"string argument is not used as a group name in the pattern, an :exc:" -"`IndexError` exception is raised." +"string argument is not used as a group name in the pattern, " +"an :exc:`IndexError` exception is raised." msgstr "" -#: ../../library/re.rst:1430 +#: ../../library/re.rst:1433 msgid "A moderately complicated example::" msgstr "" -#: ../../library/re.rst:1432 +#: ../../library/re.rst:1435 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -1985,11 +1995,11 @@ msgstr "" ">>> m.group('last_name')\n" "'Reynolds'" -#: ../../library/re.rst:1438 +#: ../../library/re.rst:1441 msgid "Named groups can also be referred to by their index::" msgstr "" -#: ../../library/re.rst:1440 +#: ../../library/re.rst:1443 msgid "" ">>> m.group(1)\n" "'Malcolm'\n" @@ -2001,24 +2011,24 @@ msgstr "" ">>> m.group(2)\n" "'Reynolds'" -#: ../../library/re.rst:1445 +#: ../../library/re.rst:1448 msgid "If a group matches multiple times, only the last match is accessible::" msgstr "" -#: ../../library/re.rst:1447 +#: ../../library/re.rst:1450 msgid "" ">>> m = re.match(r\"(..)+\", \"a1b2c3\") # Matches 3 times.\n" ">>> m.group(1) # Returns only the last match.\n" "'c3'" msgstr "" -#: ../../library/re.rst:1454 +#: ../../library/re.rst:1457 msgid "" "This is identical to ``m.group(g)``. This allows easier access to an " "individual group from a match::" msgstr "" -#: ../../library/re.rst:1457 +#: ../../library/re.rst:1460 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m[0] # The entire match\n" @@ -2029,11 +2039,11 @@ msgid "" "'Newton'" msgstr "" -#: ../../library/re.rst:1465 +#: ../../library/re.rst:1468 msgid "Named groups are supported as well::" msgstr "" -#: ../../library/re.rst:1467 +#: ../../library/re.rst:1470 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Isaac " "Newton\")\n" @@ -2049,18 +2059,18 @@ msgstr "" ">>> m['last_name']\n" "'Newton'" -#: ../../library/re.rst:1478 +#: ../../library/re.rst:1481 msgid "" "Return a tuple containing all the subgroups of the match, from 1 up to " "however many groups are in the pattern. The *default* argument is used for " "groups that did not participate in the match; it defaults to ``None``." msgstr "" -#: ../../library/re.rst:1482 ../../library/re.rst:1707 +#: ../../library/re.rst:1485 ../../library/re.rst:1710 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/re.rst:1484 +#: ../../library/re.rst:1487 msgid "" ">>> m = re.match(r\"(\\d+)\\.(\\d+)\", \"24.1632\")\n" ">>> m.groups()\n" @@ -2070,14 +2080,14 @@ msgstr "" ">>> m.groups()\n" "('24', '1632')" -#: ../../library/re.rst:1488 +#: ../../library/re.rst:1491 msgid "" "If we make the decimal place and everything after it optional, not all " "groups might participate in the match. These groups will default to " "``None`` unless the *default* argument is given::" msgstr "" -#: ../../library/re.rst:1492 +#: ../../library/re.rst:1495 msgid "" ">>> m = re.match(r\"(\\d+)\\.?(\\d+)?\", \"24\")\n" ">>> m.groups() # Second group defaults to None.\n" @@ -2086,14 +2096,14 @@ msgid "" "('24', '0')" msgstr "" -#: ../../library/re.rst:1501 +#: ../../library/re.rst:1504 msgid "" "Return a dictionary containing all the *named* subgroups of the match, keyed " "by the subgroup name. The *default* argument is used for groups that did " "not participate in the match; it defaults to ``None``. For example::" msgstr "" -#: ../../library/re.rst:1505 +#: ../../library/re.rst:1508 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -2105,7 +2115,7 @@ msgstr "" ">>> m.groupdict()\n" "{'first_name': 'Malcolm', 'last_name': 'Reynolds'}" -#: ../../library/re.rst:1513 +#: ../../library/re.rst:1516 msgid "" "Return the indices of the start and end of the substring matched by *group*; " "*group* defaults to zero (meaning the whole matched substring). Return " @@ -2114,23 +2124,23 @@ msgid "" "matched by group *g* (equivalent to ``m.group(g)``) is ::" msgstr "" -#: ../../library/re.rst:1519 +#: ../../library/re.rst:1522 msgid "m.string[m.start(g):m.end(g)]" msgstr "m.string[m.start(g):m.end(g)]" -#: ../../library/re.rst:1521 +#: ../../library/re.rst:1524 msgid "" "Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched " -"a null string. For example, after ``m = re.search('b(c?)', 'cba')``, ``m." -"start(0)`` is 1, ``m.end(0)`` is 2, ``m.start(1)`` and ``m.end(1)`` are both " -"2, and ``m.start(2)`` raises an :exc:`IndexError` exception." +"a null string. For example, after ``m = re.search('b(c?)', 'cba')``, " +"``m.start(0)`` is 1, ``m.end(0)`` is 2, ``m.start(1)`` and ``m.end(1)`` are " +"both 2, and ``m.start(2)`` raises an :exc:`IndexError` exception." msgstr "" -#: ../../library/re.rst:1526 +#: ../../library/re.rst:1529 msgid "An example that will remove *remove_this* from email addresses::" msgstr "" -#: ../../library/re.rst:1528 +#: ../../library/re.rst:1531 msgid "" ">>> email = \"tony@tiremove_thisger.net\"\n" ">>> m = re.search(\"remove_this\", email)\n" @@ -2142,28 +2152,29 @@ msgstr "" ">>> email[:m.start()] + email[m.end():]\n" "'tony@tiger.net'" -#: ../../library/re.rst:1536 +#: ../../library/re.rst:1539 msgid "" "For a match *m*, return the 2-tuple ``(m.start(group), m.end(group))``. Note " "that if *group* did not contribute to the match, this is ``(-1, -1)``. " "*group* defaults to zero, the entire match." msgstr "" -#: ../../library/re.rst:1543 +#: ../../library/re.rst:1546 msgid "" -"The value of *pos* which was passed to the :meth:`~Pattern.search` or :meth:" -"`~Pattern.match` method of a :ref:`regex object `. This is the " -"index into the string at which the RE engine started looking for a match." +"The value of *pos* which was passed to the :meth:`~Pattern.search` " +"or :meth:`~Pattern.match` method of a :ref:`regex object `. " +"This is the index into the string at which the RE engine started looking for " +"a match." msgstr "" -#: ../../library/re.rst:1550 +#: ../../library/re.rst:1553 msgid "" -"The value of *endpos* which was passed to the :meth:`~Pattern.search` or :" -"meth:`~Pattern.match` method of a :ref:`regex object `. This is " -"the index into the string beyond which the RE engine will not go." +"The value of *endpos* which was passed to the :meth:`~Pattern.search` " +"or :meth:`~Pattern.match` method of a :ref:`regex object `. " +"This is the index into the string beyond which the RE engine will not go." msgstr "" -#: ../../library/re.rst:1557 +#: ../../library/re.rst:1560 msgid "" "The integer index of the last matched capturing group, or ``None`` if no " "group was matched at all. For example, the expressions ``(a)b``, ``((a)" @@ -2172,43 +2183,44 @@ msgid "" "applied to the same string." msgstr "" -#: ../../library/re.rst:1566 +#: ../../library/re.rst:1569 msgid "" "The name of the last matched capturing group, or ``None`` if the group " "didn't have a name, or if no group was matched at all." msgstr "" -#: ../../library/re.rst:1572 +#: ../../library/re.rst:1575 msgid "" -"The :ref:`regular expression object ` whose :meth:`~Pattern." -"match` or :meth:`~Pattern.search` method produced this match instance." +"The :ref:`regular expression object ` " +"whose :meth:`~Pattern.match` or :meth:`~Pattern.search` method produced this " +"match instance." msgstr "" -#: ../../library/re.rst:1578 +#: ../../library/re.rst:1581 msgid "The string passed to :meth:`~Pattern.match` or :meth:`~Pattern.search`." msgstr "" -#: ../../library/re.rst:1581 +#: ../../library/re.rst:1584 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Match objects " "are considered atomic." msgstr "" -#: ../../library/re.rst:1589 +#: ../../library/re.rst:1592 msgid "Regular Expression Examples" msgstr "" -#: ../../library/re.rst:1593 +#: ../../library/re.rst:1596 msgid "Checking for a Pair" msgstr "" -#: ../../library/re.rst:1595 +#: ../../library/re.rst:1598 msgid "" "In this example, we'll use the following helper function to display match " "objects a little more gracefully::" msgstr "" -#: ../../library/re.rst:1598 +#: ../../library/re.rst:1601 msgid "" "def displaymatch(match):\n" " if match is None:\n" @@ -2220,7 +2232,7 @@ msgstr "" " return None\n" " return '' % (match.group(), match.groups())" -#: ../../library/re.rst:1603 +#: ../../library/re.rst:1606 msgid "" "Suppose you are writing a poker program where a player's hand is represented " "as a 5-character string with each character representing a card, \"a\" for " @@ -2228,11 +2240,11 @@ msgid "" "\"2\" through \"9\" representing the card with that value." msgstr "" -#: ../../library/re.rst:1608 +#: ../../library/re.rst:1611 msgid "To see if a given string is a valid hand, one could do the following::" msgstr "" -#: ../../library/re.rst:1610 +#: ../../library/re.rst:1613 msgid "" ">>> valid = re.compile(r\"^[a2-9tjqk]{5}$\")\n" ">>> displaymatch(valid.match(\"akt5q\")) # Valid.\n" @@ -2243,14 +2255,14 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1618 +#: ../../library/re.rst:1621 msgid "" "That last hand, ``\"727ak\"``, contained a pair, or two of the same valued " "cards. To match this with a regular expression, one could use backreferences " "as such::" msgstr "" -#: ../../library/re.rst:1621 +#: ../../library/re.rst:1624 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> displaymatch(pair.match(\"717ak\")) # Pair of 7s.\n" @@ -2260,13 +2272,13 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1628 +#: ../../library/re.rst:1631 msgid "" -"To find out what card the pair consists of, one could use the :meth:`~Match." -"group` method of the match object in the following manner::" +"To find out what card the pair consists of, one could use " +"the :meth:`~Match.group` method of the match object in the following manner::" msgstr "" -#: ../../library/re.rst:1631 +#: ../../library/re.rst:1634 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> pair.match(\"717ak\").group(1)\n" @@ -2284,143 +2296,143 @@ msgid "" "'a'" msgstr "" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1650 msgid "Simulating scanf()" msgstr "模擬 scanf()" -#: ../../library/re.rst:1651 +#: ../../library/re.rst:1654 msgid "" "Python does not currently have an equivalent to :c:func:`!scanf`. Regular " -"expressions are generally more powerful, though also more verbose, than :c:" -"func:`!scanf` format strings. The table below offers some more-or-less " -"equivalent mappings between :c:func:`!scanf` format tokens and regular " +"expressions are generally more powerful, though also more verbose, " +"than :c:func:`!scanf` format strings. The table below offers some more-or-" +"less equivalent mappings between :c:func:`!scanf` format tokens and regular " "expressions." msgstr "" -#: ../../library/re.rst:1658 +#: ../../library/re.rst:1661 msgid ":c:func:`!scanf` Token" msgstr "" -#: ../../library/re.rst:1658 +#: ../../library/re.rst:1661 msgid "Regular Expression" msgstr "" -#: ../../library/re.rst:1660 +#: ../../library/re.rst:1663 msgid "``%c``" msgstr "``%c``" -#: ../../library/re.rst:1662 +#: ../../library/re.rst:1665 msgid "``%5c``" msgstr "``%5c``" -#: ../../library/re.rst:1662 +#: ../../library/re.rst:1665 msgid "``.{5}``" msgstr "``.{5}``" -#: ../../library/re.rst:1664 +#: ../../library/re.rst:1667 msgid "``%d``" msgstr "``%d``" -#: ../../library/re.rst:1664 +#: ../../library/re.rst:1667 msgid "``[-+]?\\d+``" msgstr "``[-+]?\\d+``" -#: ../../library/re.rst:1666 +#: ../../library/re.rst:1669 msgid "``%e``, ``%E``, ``%f``, ``%g``" msgstr "``%e``, ``%E``, ``%f``, ``%g``" -#: ../../library/re.rst:1666 +#: ../../library/re.rst:1669 msgid "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" msgstr "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" -#: ../../library/re.rst:1668 +#: ../../library/re.rst:1671 msgid "``%i``" msgstr "``%i``" -#: ../../library/re.rst:1668 +#: ../../library/re.rst:1671 msgid "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" msgstr "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" -#: ../../library/re.rst:1670 +#: ../../library/re.rst:1673 msgid "``%o``" msgstr "``%o``" -#: ../../library/re.rst:1670 +#: ../../library/re.rst:1673 msgid "``[-+]?[0-7]+``" msgstr "``[-+]?[0-7]+``" -#: ../../library/re.rst:1672 +#: ../../library/re.rst:1675 msgid "``%s``" msgstr "``%s``" -#: ../../library/re.rst:1672 +#: ../../library/re.rst:1675 msgid "``\\S+``" msgstr "``\\S+``" -#: ../../library/re.rst:1674 +#: ../../library/re.rst:1677 msgid "``%u``" msgstr "``%u``" -#: ../../library/re.rst:1674 +#: ../../library/re.rst:1677 msgid "``\\d+``" msgstr "``\\d+``" -#: ../../library/re.rst:1676 +#: ../../library/re.rst:1679 msgid "``%x``, ``%X``" msgstr "``%x``、``%X``" -#: ../../library/re.rst:1676 +#: ../../library/re.rst:1679 msgid "``[-+]?(0[xX])?[\\dA-Fa-f]+``" msgstr "``[-+]?(0[xX])?[\\dA-Fa-f]+``" -#: ../../library/re.rst:1679 +#: ../../library/re.rst:1682 msgid "To extract the filename and numbers from a string like ::" msgstr "" -#: ../../library/re.rst:1681 +#: ../../library/re.rst:1684 msgid "/usr/sbin/sendmail - 0 errors, 4 warnings" msgstr "/usr/sbin/sendmail - 0 errors, 4 warnings" -#: ../../library/re.rst:1683 +#: ../../library/re.rst:1686 msgid "you would use a :c:func:`!scanf` format like ::" msgstr "" -#: ../../library/re.rst:1685 +#: ../../library/re.rst:1688 msgid "%s - %d errors, %d warnings" msgstr "" -#: ../../library/re.rst:1687 +#: ../../library/re.rst:1690 msgid "The equivalent regular expression would be ::" msgstr "" -#: ../../library/re.rst:1689 +#: ../../library/re.rst:1692 msgid "(\\S+) - (\\d+) errors, (\\d+) warnings" msgstr "" -#: ../../library/re.rst:1695 +#: ../../library/re.rst:1698 msgid "search() vs. match()" msgstr "search() vs. match()" -#: ../../library/re.rst:1699 +#: ../../library/re.rst:1702 msgid "" "Python offers different primitive operations based on regular expressions:" msgstr "" -#: ../../library/re.rst:1701 +#: ../../library/re.rst:1704 msgid ":func:`re.match` checks for a match only at the beginning of the string" msgstr "" -#: ../../library/re.rst:1702 +#: ../../library/re.rst:1705 msgid "" ":func:`re.search` checks for a match anywhere in the string (this is what " "Perl does by default)" msgstr "" -#: ../../library/re.rst:1704 +#: ../../library/re.rst:1707 msgid ":func:`re.fullmatch` checks for entire string to be a match" msgstr "" -#: ../../library/re.rst:1709 +#: ../../library/re.rst:1712 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"c\", \"abcdef\") # Match\n" @@ -2430,13 +2442,13 @@ msgid "" ">>> re.fullmatch(\"r.*n\", \"python\") # No match" msgstr "" -#: ../../library/re.rst:1716 +#: ../../library/re.rst:1719 msgid "" "Regular expressions beginning with ``'^'`` can be used with :func:`search` " "to restrict the match at the beginning of the string::" msgstr "" -#: ../../library/re.rst:1719 +#: ../../library/re.rst:1722 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"^c\", \"abcdef\") # No match\n" @@ -2444,7 +2456,7 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1724 +#: ../../library/re.rst:1727 msgid "" "Note however that in :const:`MULTILINE` mode :func:`match` only matches at " "the beginning of the string, whereas using :func:`search` with a regular " @@ -2452,18 +2464,18 @@ msgid "" "line. ::" msgstr "" -#: ../../library/re.rst:1728 +#: ../../library/re.rst:1731 msgid "" ">>> re.match(\"X\", \"A\\nB\\nX\", re.MULTILINE) # No match\n" ">>> re.search(\"^X\", \"A\\nB\\nX\", re.MULTILINE) # Match\n" "" msgstr "" -#: ../../library/re.rst:1734 +#: ../../library/re.rst:1737 msgid "Making a Phonebook" msgstr "" -#: ../../library/re.rst:1736 +#: ../../library/re.rst:1739 msgid "" ":func:`split` splits a string into a list delimited by the passed pattern. " "The method is invaluable for converting textual data into data structures " @@ -2471,13 +2483,13 @@ msgid "" "following example that creates a phonebook." msgstr "" -#: ../../library/re.rst:1741 +#: ../../library/re.rst:1744 msgid "" "First, here is the input. Normally it may come from a file, here we are " "using triple-quoted string syntax" msgstr "" -#: ../../library/re.rst:1744 +#: ../../library/re.rst:1747 msgid "" ">>> text = \"\"\"Ross McFluff: 834.345.1254 155 Elm Street\n" "...\n" @@ -2495,13 +2507,13 @@ msgstr "" "...\n" "... Heather Albrecht: 548.326.4584 919 Park Place\"\"\"" -#: ../../library/re.rst:1754 +#: ../../library/re.rst:1757 msgid "" "The entries are separated by one or more newlines. Now we convert the string " "into a list with each nonempty line having its own entry:" msgstr "" -#: ../../library/re.rst:1757 +#: ../../library/re.rst:1760 msgid "" ">>> entries = re.split(\"\\n+\", text)\n" ">>> entries\n" @@ -2517,14 +2529,14 @@ msgstr "" "'Frank Burger: 925.541.7625 662 South Dogwood Way',\n" "'Heather Albrecht: 548.326.4584 919 Park Place']" -#: ../../library/re.rst:1767 +#: ../../library/re.rst:1770 msgid "" "Finally, split each entry into a list with first name, last name, telephone " "number, and address. We use the ``maxsplit`` parameter of :func:`split` " "because the address has spaces, our splitting pattern, in it:" msgstr "" -#: ../../library/re.rst:1771 +#: ../../library/re.rst:1774 msgid "" ">>> [re.split(\":? \", entry, maxsplit=3) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],\n" @@ -2538,14 +2550,14 @@ msgstr "" "['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919 Park Place']]" -#: ../../library/re.rst:1780 +#: ../../library/re.rst:1783 msgid "" "The ``:?`` pattern matches the colon after the last name, so that it does " "not occur in the result list. With a ``maxsplit`` of ``4``, we could " "separate the house number from the street name:" msgstr "" -#: ../../library/re.rst:1784 +#: ../../library/re.rst:1787 msgid "" ">>> [re.split(\":? \", entry, maxsplit=4) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155', 'Elm Street'],\n" @@ -2559,11 +2571,11 @@ msgstr "" "['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919', 'Park Place']]" -#: ../../library/re.rst:1795 +#: ../../library/re.rst:1798 msgid "Text Munging" msgstr "" -#: ../../library/re.rst:1797 +#: ../../library/re.rst:1800 msgid "" ":func:`sub` replaces every occurrence of a pattern with a string or the " "result of a function. This example demonstrates using :func:`sub` with a " @@ -2571,7 +2583,7 @@ msgid "" "each word of a sentence except for the first and last characters::" msgstr "" -#: ../../library/re.rst:1802 +#: ../../library/re.rst:1805 msgid "" ">>> def repl(m):\n" "... inner_word = list(m.group(2))\n" @@ -2595,11 +2607,11 @@ msgstr "" ">>> re.sub(r\"(\\w)(\\w+)(\\w)\", repl, text)\n" "'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'" -#: ../../library/re.rst:1815 +#: ../../library/re.rst:1818 msgid "Finding all Adverbs" msgstr "" -#: ../../library/re.rst:1817 +#: ../../library/re.rst:1820 msgid "" ":func:`findall` matches *all* occurrences of a pattern, not just the first " "one as :func:`search` does. For example, if a writer wanted to find all of " @@ -2607,7 +2619,7 @@ msgid "" "manner::" msgstr "" -#: ../../library/re.rst:1822 +#: ../../library/re.rst:1825 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> re.findall(r\"\\w+ly\\b\", text)\n" @@ -2617,11 +2629,11 @@ msgstr "" ">>> re.findall(r\"\\w+ly\\b\", text)\n" "['carefully', 'quickly']" -#: ../../library/re.rst:1828 +#: ../../library/re.rst:1831 msgid "Finding all Adverbs and their Positions" msgstr "" -#: ../../library/re.rst:1830 +#: ../../library/re.rst:1833 msgid "" "If one wants more information about all matches of a pattern than the " "matched text, :func:`finditer` is useful as it provides :class:`~re.Match` " @@ -2630,7 +2642,7 @@ msgid "" "they would use :func:`finditer` in the following manner::" msgstr "" -#: ../../library/re.rst:1836 +#: ../../library/re.rst:1839 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> for m in re.finditer(r\"\\w+ly\\b\", text):\n" @@ -2644,11 +2656,11 @@ msgstr "" "07-16: carefully\n" "40-47: quickly" -#: ../../library/re.rst:1844 +#: ../../library/re.rst:1847 msgid "Raw String Notation" msgstr "" -#: ../../library/re.rst:1846 +#: ../../library/re.rst:1849 msgid "" "Raw string notation (``r\"text\"``) keeps regular expressions sane. Without " "it, every backslash (``'\\'``) in a regular expression would have to be " @@ -2656,7 +2668,7 @@ msgid "" "lines of code are functionally identical::" msgstr "" -#: ../../library/re.rst:1851 +#: ../../library/re.rst:1854 msgid "" ">>> re.match(r\"\\W(.)\\1\\W\", \" ff \")\n" "\n" @@ -2668,7 +2680,7 @@ msgstr "" ">>> re.match(\"\\\\W(.)\\\\1\\\\W\", \" ff \")\n" "" -#: ../../library/re.rst:1856 +#: ../../library/re.rst:1859 msgid "" "When one wants to match a literal backslash, it must be escaped in the " "regular expression. With raw string notation, this means ``r\"\\\\\"``. " @@ -2676,7 +2688,7 @@ msgid "" "following lines of code functionally identical::" msgstr "" -#: ../../library/re.rst:1861 +#: ../../library/re.rst:1864 msgid "" ">>> re.match(r\"\\\\\", r\"\\\\\")\n" "\n" @@ -2688,25 +2700,25 @@ msgstr "" ">>> re.match(\"\\\\\\\\\", r\"\\\\\")\n" "" -#: ../../library/re.rst:1868 +#: ../../library/re.rst:1871 msgid "Writing a Tokenizer" msgstr "" -#: ../../library/re.rst:1870 +#: ../../library/re.rst:1873 msgid "" "A `tokenizer or scanner `_ " "analyzes a string to categorize groups of characters. This is a useful " "first step in writing a compiler or interpreter." msgstr "" -#: ../../library/re.rst:1874 +#: ../../library/re.rst:1877 msgid "" "The text categories are specified with regular expressions. The technique " "is to combine those into a single master regular expression and to loop over " "successive matches::" msgstr "" -#: ../../library/re.rst:1878 +#: ../../library/re.rst:1881 msgid "" "from typing import NamedTuple\n" "import re\n" @@ -2762,11 +2774,11 @@ msgid "" " print(token)" msgstr "" -#: ../../library/re.rst:1930 +#: ../../library/re.rst:1933 msgid "The tokenizer produces the following output::" msgstr "" -#: ../../library/re.rst:1932 +#: ../../library/re.rst:1935 msgid "" "Token(type='IF', value='IF', line=2, column=4)\n" "Token(type='ID', value='quantity', line=2, column=7)\n" @@ -2808,7 +2820,7 @@ msgstr "" "Token(type='ENDIF', value='ENDIF', line=5, column=4)\n" "Token(type='END', value=';', line=5, column=9)" -#: ../../library/re.rst:1953 +#: ../../library/re.rst:1956 msgid "" "Friedl, Jeffrey. Mastering Regular Expressions. 3rd ed., O'Reilly Media, " "2009. The third edition of the book no longer covers Python at all, but the " @@ -2830,10 +2842,10 @@ msgstr ". (點)" #: ../../library/re.rst:457 ../../library/re.rst:464 ../../library/re.rst:471 #: ../../library/re.rst:498 ../../library/re.rst:508 ../../library/re.rst:531 #: ../../library/re.rst:543 ../../library/re.rst:548 ../../library/re.rst:570 -#: ../../library/re.rst:590 ../../library/re.rst:606 ../../library/re.rst:614 -#: ../../library/re.rst:628 ../../library/re.rst:636 ../../library/re.rst:653 -#: ../../library/re.rst:667 ../../library/re.rst:672 ../../library/re.rst:863 -#: ../../library/re.rst:1102 +#: ../../library/re.rst:587 ../../library/re.rst:603 ../../library/re.rst:611 +#: ../../library/re.rst:625 ../../library/re.rst:633 ../../library/re.rst:650 +#: ../../library/re.rst:664 ../../library/re.rst:675 ../../library/re.rst:866 +#: ../../library/re.rst:1105 msgid "in regular expressions" msgstr "於正規表示式中" @@ -2949,7 +2961,7 @@ msgstr "(?(" msgid "\\A" msgstr "\\A" -#: ../../library/re.rst:548 ../../library/re.rst:672 +#: ../../library/re.rst:548 ../../library/re.rst:675 msgid "\\b" msgstr "\\b" @@ -2957,87 +2969,91 @@ msgstr "\\b" msgid "\\B" msgstr "\\B" -#: ../../library/re.rst:590 +#: ../../library/re.rst:587 msgid "\\d" msgstr "\\d" -#: ../../library/re.rst:606 +#: ../../library/re.rst:603 msgid "\\D" msgstr "\\D" -#: ../../library/re.rst:614 +#: ../../library/re.rst:611 msgid "\\s" msgstr "\\s" -#: ../../library/re.rst:628 +#: ../../library/re.rst:625 msgid "\\S" msgstr "\\S" -#: ../../library/re.rst:636 +#: ../../library/re.rst:633 msgid "\\w" msgstr "\\w" -#: ../../library/re.rst:653 +#: ../../library/re.rst:650 msgid "\\W" msgstr "\\W" -#: ../../library/re.rst:667 +#: ../../library/re.rst:664 +msgid "\\z" +msgstr "" + +#: ../../library/re.rst:664 msgid "\\Z" msgstr "\\Z" -#: ../../library/re.rst:672 +#: ../../library/re.rst:675 msgid "\\a" msgstr "\\a" -#: ../../library/re.rst:672 +#: ../../library/re.rst:675 msgid "\\f" msgstr "\\f" -#: ../../library/re.rst:672 +#: ../../library/re.rst:675 msgid "\\n" msgstr "\\n" -#: ../../library/re.rst:672 +#: ../../library/re.rst:675 msgid "\\N" msgstr "\\N" -#: ../../library/re.rst:672 +#: ../../library/re.rst:675 msgid "\\r" msgstr "\\r" -#: ../../library/re.rst:672 +#: ../../library/re.rst:675 msgid "\\t" msgstr "\\t" -#: ../../library/re.rst:672 +#: ../../library/re.rst:675 msgid "\\u" msgstr "\\u" -#: ../../library/re.rst:672 +#: ../../library/re.rst:675 msgid "\\U" msgstr "\\U" -#: ../../library/re.rst:672 +#: ../../library/re.rst:675 msgid "\\v" msgstr "\\v" -#: ../../library/re.rst:672 +#: ../../library/re.rst:675 msgid "\\x" msgstr "\\x" -#: ../../library/re.rst:672 +#: ../../library/re.rst:675 msgid "\\\\" msgstr "\\\\" -#: ../../library/re.rst:863 +#: ../../library/re.rst:866 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/re.rst:1102 +#: ../../library/re.rst:1105 msgid "\\g" msgstr "\\g" -#: ../../library/re.rst:1649 +#: ../../library/re.rst:1652 msgid "scanf (C function)" msgstr "scanf(C 函式)" diff --git a/library/readline.po b/library/readline.po index d27a830994c..f26d45fc2be 100644 --- a/library/readline.po +++ b/library/readline.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-21 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,8 +29,8 @@ msgid "" "This module can be used directly, or via the :mod:`rlcompleter` module, " "which supports completion of Python identifiers at the interactive prompt. " "Settings made using this module affect the behaviour of both the " -"interpreter's interactive prompt and the prompts offered by the built-in :" -"func:`input` function." +"interpreter's interactive prompt and the prompts offered by the built-" +"in :func:`input` function." msgstr "" #: ../../library/readline.rst:20 @@ -65,8 +65,8 @@ msgstr "" #: ../../library/readline.rst:36 msgid "" "The configuration file for ``editline`` is different from that of GNU " -"readline. If you programmatically load configuration strings you can use :" -"data:`backend` to determine which library is being used." +"readline. If you programmatically load configuration strings you can " +"use :data:`backend` to determine which library is being used." msgstr "" #: ../../library/readline.rst:40 @@ -108,147 +108,160 @@ msgstr "" #: ../../library/readline.rst:67 msgid "" -"Execute the init line provided in the *string* argument. This calls :c:func:" -"`!rl_parse_and_bind` in the underlying library." +"Execute the init line provided in the *string* argument. This " +"calls :c:func:`!rl_parse_and_bind` in the underlying library." msgstr "" #: ../../library/readline.rst:73 msgid "" "Execute a readline initialization file. The default filename is the last " "filename used. This calls :c:func:`!rl_read_init_file` in the underlying " -"library." +"library. It raises an :ref:`auditing event ` ``open`` with the " +"file name if given, and :code:`\"\"` otherwise, " +"regardless of which file the library resolves." +msgstr "" + +#: ../../library/readline.rst:79 ../../library/readline.rst:122 +#: ../../library/readline.rst:134 ../../library/readline.rst:149 +msgid "The auditing event was added." msgstr "" -#: ../../library/readline.rst:78 +#: ../../library/readline.rst:84 msgid "Line buffer" msgstr "" -#: ../../library/readline.rst:80 +#: ../../library/readline.rst:86 msgid "The following functions operate on the line buffer:" msgstr "" -#: ../../library/readline.rst:85 +#: ../../library/readline.rst:91 msgid "" "Return the current contents of the line buffer (:c:data:`!rl_line_buffer` in " "the underlying library)." msgstr "" -#: ../../library/readline.rst:91 +#: ../../library/readline.rst:97 msgid "" -"Insert text into the line buffer at the cursor position. This calls :c:func:" -"`!rl_insert_text` in the underlying library, but ignores the return value." +"Insert text into the line buffer at the cursor position. This " +"calls :c:func:`!rl_insert_text` in the underlying library, but ignores the " +"return value." msgstr "" -#: ../../library/readline.rst:98 +#: ../../library/readline.rst:104 msgid "" "Change what's displayed on the screen to reflect the current contents of the " "line buffer. This calls :c:func:`!rl_redisplay` in the underlying library." msgstr "" -#: ../../library/readline.rst:103 +#: ../../library/readline.rst:109 msgid "History file" msgstr "" -#: ../../library/readline.rst:105 +#: ../../library/readline.rst:111 msgid "The following functions operate on a history file:" msgstr "" -#: ../../library/readline.rst:110 +#: ../../library/readline.rst:116 msgid "" "Load a readline history file, and append it to the history list. The default " "filename is :file:`~/.history`. This calls :c:func:`!read_history` in the " -"underlying library." +"underlying library and raises an :ref:`auditing event ` ``open`` " +"with the file name if given and :code:`\"~/.history\"` otherwise." msgstr "" -#: ../../library/readline.rst:117 +#: ../../library/readline.rst:128 msgid "" "Save the history list to a readline history file, overwriting any existing " "file. The default filename is :file:`~/.history`. This calls :c:func:`!" -"write_history` in the underlying library." +"write_history` in the underlying library and raises an :ref:`auditing event " +"` ``open`` with the file name if given and :code:`\"~/.history\"` " +"otherwise." msgstr "" -#: ../../library/readline.rst:124 +#: ../../library/readline.rst:140 msgid "" "Append the last *nelements* items of history to a file. The default " -"filename is :file:`~/.history`. The file must already exist. This calls :c:" -"func:`!append_history` in the underlying library. This function only exists " -"if Python was compiled for a version of the library that supports it." +"filename is :file:`~/.history`. The file must already exist. This " +"calls :c:func:`!append_history` in the underlying library. This function " +"only exists if Python was compiled for a version of the library that " +"supports it. It raises an :ref:`auditing event ` ``open`` with the " +"file name if given and :code:`\"~/.history\"` otherwise." msgstr "" -#: ../../library/readline.rst:136 +#: ../../library/readline.rst:156 msgid "" -"Set or return the desired number of lines to save in the history file. The :" -"func:`write_history_file` function uses this value to truncate the history " -"file, by calling :c:func:`!history_truncate_file` in the underlying " +"Set or return the desired number of lines to save in the history file. " +"The :func:`write_history_file` function uses this value to truncate the " +"history file, by calling :c:func:`!history_truncate_file` in the underlying " "library. Negative values imply unlimited history file size." msgstr "" -#: ../../library/readline.rst:144 +#: ../../library/readline.rst:164 msgid "History list" msgstr "" -#: ../../library/readline.rst:146 +#: ../../library/readline.rst:166 msgid "The following functions operate on a global history list:" msgstr "" -#: ../../library/readline.rst:151 +#: ../../library/readline.rst:171 msgid "" "Clear the current history. This calls :c:func:`!clear_history` in the " "underlying library. The Python function only exists if Python was compiled " "for a version of the library that supports it." msgstr "" -#: ../../library/readline.rst:158 +#: ../../library/readline.rst:178 msgid "" "Return the number of items currently in the history. (This is different " "from :func:`get_history_length`, which returns the maximum number of lines " "that will be written to a history file.)" msgstr "" -#: ../../library/readline.rst:165 +#: ../../library/readline.rst:185 msgid "" "Return the current contents of history item at *index*. The item index is " "one-based. This calls :c:func:`!history_get` in the underlying library." msgstr "" -#: ../../library/readline.rst:171 +#: ../../library/readline.rst:191 msgid "" "Remove history item specified by its position from the history. The position " "is zero-based. This calls :c:func:`!remove_history` in the underlying " "library." msgstr "" -#: ../../library/readline.rst:178 +#: ../../library/readline.rst:198 msgid "" "Replace history item specified by its position with *line*. The position is " "zero-based. This calls :c:func:`!replace_history_entry` in the underlying " "library." msgstr "" -#: ../../library/readline.rst:185 +#: ../../library/readline.rst:205 msgid "" "Append *line* to the history buffer, as if it was the last line typed. This " "calls :c:func:`!add_history` in the underlying library." msgstr "" -#: ../../library/readline.rst:191 +#: ../../library/readline.rst:211 msgid "" "Enable or disable automatic calls to :c:func:`!add_history` when reading " "input via readline. The *enabled* argument should be a Boolean value that " "when true, enables auto history, and that when false, disables auto history." msgstr "" -#: ../../library/readline.rst:199 +#: ../../library/readline.rst:219 msgid "" "Auto history is enabled by default, and changes to this do not persist " "across multiple sessions." msgstr "" -#: ../../library/readline.rst:204 +#: ../../library/readline.rst:224 msgid "Startup hooks" msgstr "" -#: ../../library/readline.rst:209 +#: ../../library/readline.rst:229 msgid "" "Set or remove the function invoked by the :c:data:`!rl_startup_hook` " "callback of the underlying library. If *function* is specified, it will be " @@ -257,7 +270,7 @@ msgid "" "readline prints the first prompt." msgstr "" -#: ../../library/readline.rst:218 +#: ../../library/readline.rst:238 msgid "" "Set or remove the function invoked by the :c:data:`!rl_pre_input_hook` " "callback of the underlying library. If *function* is specified, it will be " @@ -268,11 +281,11 @@ msgid "" "of the library that supports it." msgstr "" -#: ../../library/readline.rst:230 +#: ../../library/readline.rst:250 msgid "Completion" msgstr "" -#: ../../library/readline.rst:232 +#: ../../library/readline.rst:252 msgid "" "The following functions relate to implementing a custom word completion " "function. This is typically operated by the Tab key, and can suggest and " @@ -282,7 +295,7 @@ msgid "" "custom completer, a different set of word delimiters should be set." msgstr "" -#: ../../library/readline.rst:242 +#: ../../library/readline.rst:262 msgid "" "Set or remove the completer function. If *function* is specified, it will " "be used as the new completer function; if omitted or ``None``, any completer " @@ -292,7 +305,7 @@ msgid "" "starting with *text*." msgstr "" -#: ../../library/readline.rst:249 +#: ../../library/readline.rst:269 msgid "" "The installed completer function is invoked by the *entry_func* callback " "passed to :c:func:`!rl_completion_matches` in the underlying library. The " @@ -300,19 +313,19 @@ msgid "" "rl_attempted_completion_function` callback of the underlying library." msgstr "" -#: ../../library/readline.rst:258 +#: ../../library/readline.rst:278 msgid "" "Get the completer function, or ``None`` if no completer function has been " "set." msgstr "" -#: ../../library/readline.rst:263 +#: ../../library/readline.rst:283 msgid "" "Get the type of completion being attempted. This returns the :c:data:`!" "rl_completion_type` variable in the underlying library as an integer." msgstr "" -#: ../../library/readline.rst:271 +#: ../../library/readline.rst:291 msgid "" "Get the beginning or ending index of the completion scope. These indexes are " "the *start* and *end* arguments passed to the :c:data:`!" @@ -322,7 +335,7 @@ msgid "" "differently than libreadline." msgstr "" -#: ../../library/readline.rst:282 +#: ../../library/readline.rst:302 msgid "" "Set or get the word delimiters for completion. These determine the start of " "the word to be considered for completion (the completion scope). These " @@ -330,7 +343,7 @@ msgid "" "in the underlying library." msgstr "" -#: ../../library/readline.rst:290 +#: ../../library/readline.rst:310 msgid "" "Set or remove the completion display function. If *function* is specified, " "it will be used as the new completion display function; if omitted or " @@ -341,11 +354,11 @@ msgid "" "each time matches need to be displayed." msgstr "" -#: ../../library/readline.rst:303 +#: ../../library/readline.rst:323 msgid "Example" msgstr "範例" -#: ../../library/readline.rst:305 +#: ../../library/readline.rst:325 msgid "" "The following example demonstrates how to use the :mod:`readline` module's " "history reading and writing functions to automatically load and save a " @@ -354,7 +367,7 @@ msgid "" "sessions from the user's :envvar:`PYTHONSTARTUP` file. ::" msgstr "" -#: ../../library/readline.rst:311 +#: ../../library/readline.rst:331 msgid "" "import atexit\n" "import os\n" @@ -371,19 +384,19 @@ msgid "" "atexit.register(readline.write_history_file, histfile)" msgstr "" -#: ../../library/readline.rst:325 +#: ../../library/readline.rst:345 msgid "" -"This code is actually automatically run when Python is run in :ref:" -"`interactive mode ` (see :ref:`rlcompleter-config`)." +"This code is actually automatically run when Python is run " +"in :ref:`interactive mode ` (see :ref:`rlcompleter-config`)." msgstr "" -#: ../../library/readline.rst:328 +#: ../../library/readline.rst:348 msgid "" "The following example achieves the same goal but supports concurrent " "interactive sessions, by only appending the new history. ::" msgstr "" -#: ../../library/readline.rst:331 +#: ../../library/readline.rst:351 msgid "" "import atexit\n" "import os\n" @@ -421,13 +434,13 @@ msgstr "" " readline.append_history_file(new_h_len - prev_h_len, histfile)\n" "atexit.register(save, h_len, histfile)" -#: ../../library/readline.rst:349 +#: ../../library/readline.rst:369 msgid "" "The following example extends the :class:`code.InteractiveConsole` class to " "support history save/restore. ::" msgstr "" -#: ../../library/readline.rst:352 +#: ../../library/readline.rst:372 msgid "" "import atexit\n" "import code\n" diff --git a/library/select.po b/library/select.po index 4936cc5b8eb..05a6a9bd438 100644 --- a/library/select.po +++ b/library/select.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,11 +26,11 @@ msgstr ":mod:`!select` --- 等待 I/O 完成" msgid "" "This module provides access to the :c:func:`!select` and :c:func:`!poll` " "functions available in most operating systems, :c:func:`!devpoll` available " -"on Solaris and derivatives, :c:func:`!epoll` available on Linux 2.5+ and :c:" -"func:`!kqueue` available on most BSD. Note that on Windows, it only works " -"for sockets; on other operating systems, it also works for other file types " -"(in particular, on Unix, it works on pipes). It cannot be used on regular " -"files to determine whether a file has grown since it was last read." +"on Solaris and derivatives, :c:func:`!epoll` available on Linux 2.5+ " +"and :c:func:`!kqueue` available on most BSD. Note that on Windows, it only " +"works for sockets; on other operating systems, it also works for other file " +"types (in particular, on Unix, it works on pipes). It cannot be used on " +"regular files to determine whether a file has grown since it was last read." msgstr "" #: ../../library/select.rst:20 @@ -75,9 +75,10 @@ msgstr "" #: ../../library/select.rst:44 msgid "" ":c:func:`!devpoll` objects are linked to the number of file descriptors " -"allowed at the time of instantiation. If your program reduces this value, :c:" -"func:`!devpoll` will fail. If your program increases this value, :c:func:`!" -"devpoll` may return an incomplete list of active file descriptors." +"allowed at the time of instantiation. If your program reduces this " +"value, :c:func:`!devpoll` will fail. If your program increases this " +"value, :c:func:`!devpoll` may return an incomplete list of active file " +"descriptors." msgstr "" #: ../../library/select.rst:50 ../../library/select.rst:79 @@ -118,9 +119,9 @@ msgstr "" #: ../../library/select.rst:75 msgid "" -"``epoll`` objects support the context management protocol: when used in a :" -"keyword:`with` statement, the new file descriptor is automatically closed at " -"the end of the block." +"``epoll`` objects support the context management protocol: when used in " +"a :keyword:`with` statement, the new file descriptor is automatically closed " +"at the end of the block." msgstr "" #: ../../library/select.rst:81 @@ -149,14 +150,16 @@ msgstr "" #: ../../library/select.rst:103 msgid "" -"(Only supported on BSD.) Returns a kernel queue object; see section :ref:" -"`kqueue-objects` below for the methods supported by kqueue objects." +"(Only supported on BSD.) Returns a kernel queue object; see " +"section :ref:`kqueue-objects` below for the methods supported by kqueue " +"objects." msgstr "" #: ../../library/select.rst:114 msgid "" -"(Only supported on BSD.) Returns a kernel event object; see section :ref:" -"`kevent-objects` below for the methods supported by kevent objects." +"(Only supported on BSD.) Returns a kernel event object; see " +"section :ref:`kevent-objects` below for the methods supported by kevent " +"objects." msgstr "" #: ../../library/select.rst:120 @@ -201,11 +204,11 @@ msgstr "" #: ../../library/select.rst:145 msgid "" "Among the acceptable object types in the iterables are Python :term:`file " -"objects ` (e.g. ``sys.stdin``, or objects returned by :func:" -"`open` or :func:`os.popen`), socket objects returned by :func:`socket." -"socket`. You may also define a :dfn:`wrapper` class yourself, as long as it " -"has an appropriate :meth:`~io.IOBase.fileno` method (that really returns a " -"file descriptor, not just a random integer)." +"objects ` (e.g. ``sys.stdin``, or objects returned " +"by :func:`open` or :func:`os.popen`), socket objects returned " +"by :func:`socket.socket`. You may also define a :dfn:`wrapper` class " +"yourself, as long as it has an appropriate :meth:`~io.IOBase.fileno` method " +"(that really returns a file descriptor, not just a random integer)." msgstr "" #: ../../library/select.rst:156 @@ -217,8 +220,8 @@ msgid "" msgstr "" #: ../../library/select.rst:161 ../../library/select.rst:267 -#: ../../library/select.rst:367 ../../library/select.rst:455 -#: ../../library/select.rst:496 +#: ../../library/select.rst:373 ../../library/select.rst:461 +#: ../../library/select.rst:502 msgid "" "The function is now retried with a recomputed timeout when interrupted by a " "signal, except if the signal handler raises an exception (see :pep:`475` for " @@ -228,9 +231,10 @@ msgstr "" #: ../../library/select.rst:170 msgid "" "The minimum number of bytes which can be written without blocking to a pipe " -"when the pipe has been reported as ready for writing by :func:`~select." -"select`, :func:`!poll` or another interface in this module. This doesn't " -"apply to other kind of file-like objects such as sockets." +"when the pipe has been reported as ready for writing " +"by :func:`~select.select`, :func:`!poll` or another interface in this " +"module. This doesn't apply to other kind of file-like objects such as " +"sockets." msgstr "" #: ../../library/select.rst:175 @@ -265,12 +269,12 @@ msgstr "" msgid "Return the file descriptor number of the polling object." msgstr "" -#: ../../library/select.rst:218 ../../library/select.rst:390 +#: ../../library/select.rst:218 ../../library/select.rst:396 msgid "" -"Register a file descriptor with the polling object. Future calls to the :" -"meth:`poll` method will then check whether the file descriptor has any " -"pending I/O events. *fd* can be either an integer, or an object with a :" -"meth:`~io.IOBase.fileno` method that returns an integer. File objects " +"Register a file descriptor with the polling object. Future calls to " +"the :meth:`poll` method will then check whether the file descriptor has any " +"pending I/O events. *fd* can be either an integer, or an object with " +"a :meth:`~io.IOBase.fileno` method that returns an integer. File objects " "implement :meth:`!fileno`, so they can also be used as the argument." msgstr "" @@ -278,8 +282,8 @@ msgstr "" msgid "" "*eventmask* is an optional bitmask describing the type of events you want to " "check for. The constants are the same that with :c:func:`!poll` object. The " -"default value is a combination of the constants :const:`POLLIN`, :const:" -"`POLLPRI`, and :const:`POLLOUT`." +"default value is a combination of the " +"constants :const:`POLLIN`, :const:`POLLPRI`, and :const:`POLLOUT`." msgstr "" #: ../../library/select.rst:231 @@ -295,11 +299,11 @@ msgid "" "(a bit) more efficient that doing the same explicitly." msgstr "" -#: ../../library/select.rst:246 ../../library/select.rst:434 +#: ../../library/select.rst:246 ../../library/select.rst:440 msgid "" -"Remove a file descriptor being tracked by a polling object. Just like the :" -"meth:`register` method, *fd* can be an integer or an object with a :meth:" -"`~io.IOBase.fileno` method that returns an integer." +"Remove a file descriptor being tracked by a polling object. Just like " +"the :meth:`register` method, *fd* can be an integer or an object with " +"a :meth:`~io.IOBase.fileno` method that returns an integer." msgstr "" #: ../../library/select.rst:250 @@ -313,13 +317,14 @@ msgid "" "Polls the set of registered file descriptors, and returns a possibly empty " "list containing ``(fd, event)`` 2-tuples for the descriptors that have " "events or errors to report. *fd* is the file descriptor, and *event* is a " -"bitmask with bits set for the reported events for that descriptor --- :const:" -"`POLLIN` for waiting input, :const:`POLLOUT` to indicate that the descriptor " -"can be written to, and so forth. An empty list indicates that the call timed " -"out and no file descriptors had any events to report. If *timeout* is given, " -"it specifies the length of time in milliseconds which the system will wait " -"for events before returning. If *timeout* is omitted, -1, or :const:`None`, " -"the call will block until there is an event for this poll object." +"bitmask with bits set for the reported events for that descriptor " +"--- :const:`POLLIN` for waiting input, :const:`POLLOUT` to indicate that the " +"descriptor can be written to, and so forth. An empty list indicates that the " +"call timed out and no file descriptors had any events to report. If " +"*timeout* is given, it specifies the length of time in milliseconds which " +"the system will wait for events before returning. If *timeout* is omitted, " +"-1, or :const:`None`, the call will block until there is an event for this " +"poll object." msgstr "" #: ../../library/select.rst:277 @@ -334,17 +339,17 @@ msgstr "https://linux.die.net/man/4/epoll" msgid "*eventmask*" msgstr "" -#: ../../library/select.rst:284 ../../library/select.rst:402 -#: ../../library/select.rst:522 ../../library/select.rst:551 -#: ../../library/select.rst:582 ../../library/select.rst:590 -#: ../../library/select.rst:610 ../../library/select.rst:633 +#: ../../library/select.rst:284 ../../library/select.rst:408 +#: ../../library/select.rst:528 ../../library/select.rst:557 +#: ../../library/select.rst:588 ../../library/select.rst:596 +#: ../../library/select.rst:616 ../../library/select.rst:639 msgid "Constant" msgstr "常數" -#: ../../library/select.rst:284 ../../library/select.rst:402 -#: ../../library/select.rst:522 ../../library/select.rst:551 -#: ../../library/select.rst:582 ../../library/select.rst:590 -#: ../../library/select.rst:610 ../../library/select.rst:633 +#: ../../library/select.rst:284 ../../library/select.rst:408 +#: ../../library/select.rst:528 ../../library/select.rst:557 +#: ../../library/select.rst:588 ../../library/select.rst:596 +#: ../../library/select.rst:616 ../../library/select.rst:639 msgid "Meaning" msgstr "含義" @@ -465,53 +470,68 @@ msgstr ":const:`EPOLLMSG`" msgid "Ignored." msgstr "" -#: ../../library/select.rst:321 +#: ../../library/select.rst:320 +#, fuzzy +msgid ":const:`EPOLLWAKEUP`" +msgstr ":const:`EPOLLHUP`" + +#: ../../library/select.rst:320 +msgid "Prevents sleep during event waiting." +msgstr "" + +#: ../../library/select.rst:323 msgid "" ":const:`EPOLLEXCLUSIVE` was added. It's only supported by Linux Kernel 4.5 " "or later." msgstr "" #: ../../library/select.rst:327 +msgid "" +":const:`EPOLLWAKEUP` was added. It's only supported by Linux Kernel 3.5 or " +"later." +msgstr "" + +#: ../../library/select.rst:333 msgid "Close the control file descriptor of the epoll object." msgstr "" -#: ../../library/select.rst:332 +#: ../../library/select.rst:338 msgid "``True`` if the epoll object is closed." msgstr "" -#: ../../library/select.rst:337 ../../library/select.rst:479 +#: ../../library/select.rst:343 ../../library/select.rst:485 msgid "Return the file descriptor number of the control fd." msgstr "" -#: ../../library/select.rst:342 +#: ../../library/select.rst:348 msgid "Create an epoll object from a given file descriptor." msgstr "" -#: ../../library/select.rst:347 +#: ../../library/select.rst:353 msgid "Register a fd descriptor with the epoll object." msgstr "" -#: ../../library/select.rst:352 +#: ../../library/select.rst:358 msgid "Modify a registered file descriptor." msgstr "" -#: ../../library/select.rst:357 +#: ../../library/select.rst:363 msgid "Remove a registered file descriptor from the epoll object." msgstr "" -#: ../../library/select.rst:359 +#: ../../library/select.rst:365 msgid "The method no longer ignores the :data:`~errno.EBADF` error." msgstr "" -#: ../../library/select.rst:365 +#: ../../library/select.rst:371 msgid "Wait for events. timeout in seconds (float)" msgstr "" -#: ../../library/select.rst:377 +#: ../../library/select.rst:383 msgid "Polling Objects" msgstr "" -#: ../../library/select.rst:379 +#: ../../library/select.rst:385 msgid "" "The :c:func:`!poll` system call, supported on most Unix systems, provides " "better scalability for network servers that service many, many clients at " @@ -523,148 +543,150 @@ msgid "" "of file descriptors*)." msgstr "" -#: ../../library/select.rst:396 +#: ../../library/select.rst:402 msgid "" "*eventmask* is an optional bitmask describing the type of events you want to " -"check for, and can be a combination of the constants :const:`POLLIN`, :const:" -"`POLLPRI`, and :const:`POLLOUT`, described in the table below. If not " -"specified, the default value used will check for all 3 types of events." +"check for, and can be a combination of the " +"constants :const:`POLLIN`, :const:`POLLPRI`, and :const:`POLLOUT`, described " +"in the table below. If not specified, the default value used will check for " +"all 3 types of events." msgstr "" -#: ../../library/select.rst:404 +#: ../../library/select.rst:410 msgid ":const:`POLLIN`" msgstr ":const:`POLLIN`" -#: ../../library/select.rst:404 +#: ../../library/select.rst:410 msgid "There is data to read" msgstr "" -#: ../../library/select.rst:406 +#: ../../library/select.rst:412 msgid ":const:`POLLPRI`" msgstr ":const:`POLLPRI`" -#: ../../library/select.rst:406 +#: ../../library/select.rst:412 msgid "There is urgent data to read" msgstr "" -#: ../../library/select.rst:408 +#: ../../library/select.rst:414 msgid ":const:`POLLOUT`" msgstr ":const:`POLLOUT`" -#: ../../library/select.rst:408 +#: ../../library/select.rst:414 msgid "Ready for output: writing will not block" msgstr "" -#: ../../library/select.rst:410 +#: ../../library/select.rst:416 msgid ":const:`POLLERR`" msgstr ":const:`POLLERR`" -#: ../../library/select.rst:410 +#: ../../library/select.rst:416 msgid "Error condition of some sort" msgstr "" -#: ../../library/select.rst:412 +#: ../../library/select.rst:418 msgid ":const:`POLLHUP`" msgstr ":const:`POLLHUP`" -#: ../../library/select.rst:412 +#: ../../library/select.rst:418 msgid "Hung up" msgstr "" -#: ../../library/select.rst:414 +#: ../../library/select.rst:420 msgid ":const:`POLLRDHUP`" msgstr ":const:`POLLRDHUP`" -#: ../../library/select.rst:414 +#: ../../library/select.rst:420 msgid "" "Stream socket peer closed connection, or shut down writing half of connection" msgstr "" -#: ../../library/select.rst:417 +#: ../../library/select.rst:423 msgid ":const:`POLLNVAL`" msgstr ":const:`POLLNVAL`" -#: ../../library/select.rst:417 +#: ../../library/select.rst:423 msgid "Invalid request: descriptor not open" msgstr "" -#: ../../library/select.rst:420 +#: ../../library/select.rst:426 msgid "" "Registering a file descriptor that's already registered is not an error, and " "has the same effect as registering the descriptor exactly once." msgstr "" -#: ../../library/select.rst:426 +#: ../../library/select.rst:432 msgid "" "Modifies an already registered fd. This has the same effect as " "``register(fd, eventmask)``. Attempting to modify a file descriptor that " -"was never registered causes an :exc:`OSError` exception with errno :const:" -"`ENOENT` to be raised." +"was never registered causes an :exc:`OSError` exception with " +"errno :const:`ENOENT` to be raised." msgstr "" -#: ../../library/select.rst:438 +#: ../../library/select.rst:444 msgid "" -"Attempting to remove a file descriptor that was never registered causes a :" -"exc:`KeyError` exception to be raised." +"Attempting to remove a file descriptor that was never registered causes " +"a :exc:`KeyError` exception to be raised." msgstr "" -#: ../../library/select.rst:444 +#: ../../library/select.rst:450 msgid "" "Polls the set of registered file descriptors, and returns a possibly empty " "list containing ``(fd, event)`` 2-tuples for the descriptors that have " "events or errors to report. *fd* is the file descriptor, and *event* is a " -"bitmask with bits set for the reported events for that descriptor --- :const:" -"`POLLIN` for waiting input, :const:`POLLOUT` to indicate that the descriptor " -"can be written to, and so forth. An empty list indicates that the call timed " -"out and no file descriptors had any events to report. If *timeout* is given, " -"it specifies the length of time in milliseconds which the system will wait " -"for events before returning. If *timeout* is omitted, negative, or :const:" -"`None`, the call will block until there is an event for this poll object." +"bitmask with bits set for the reported events for that descriptor " +"--- :const:`POLLIN` for waiting input, :const:`POLLOUT` to indicate that the " +"descriptor can be written to, and so forth. An empty list indicates that the " +"call timed out and no file descriptors had any events to report. If " +"*timeout* is given, it specifies the length of time in milliseconds which " +"the system will wait for events before returning. If *timeout* is omitted, " +"negative, or :const:`None`, the call will block until there is an event for " +"this poll object." msgstr "" -#: ../../library/select.rst:465 +#: ../../library/select.rst:471 msgid "Kqueue Objects" msgstr "" -#: ../../library/select.rst:469 +#: ../../library/select.rst:475 msgid "Close the control file descriptor of the kqueue object." msgstr "" -#: ../../library/select.rst:474 +#: ../../library/select.rst:480 msgid "``True`` if the kqueue object is closed." msgstr "" -#: ../../library/select.rst:484 +#: ../../library/select.rst:490 msgid "Create a kqueue object from a given file descriptor." msgstr "" -#: ../../library/select.rst:489 +#: ../../library/select.rst:495 msgid "Low level interface to kevent" msgstr "" -#: ../../library/select.rst:491 +#: ../../library/select.rst:497 msgid "changelist must be an iterable of kevent objects or ``None``" msgstr "" -#: ../../library/select.rst:492 +#: ../../library/select.rst:498 msgid "max_events must be 0 or a positive integer" msgstr "" -#: ../../library/select.rst:493 +#: ../../library/select.rst:499 msgid "" "timeout in seconds (floats possible); the default is ``None``, to wait " "forever" msgstr "" -#: ../../library/select.rst:506 +#: ../../library/select.rst:512 msgid "Kevent Objects" msgstr "" -#: ../../library/select.rst:508 +#: ../../library/select.rst:514 msgid "https://man.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2" msgstr "https://man.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2" -#: ../../library/select.rst:512 +#: ../../library/select.rst:518 msgid "" "Value used to identify the event. The interpretation depends on the filter " "but it's usually the file descriptor. In the constructor ident can either be " @@ -672,329 +694,329 @@ msgid "" "the integer internally." msgstr "" -#: ../../library/select.rst:519 +#: ../../library/select.rst:525 msgid "Name of the kernel filter." msgstr "" -#: ../../library/select.rst:524 +#: ../../library/select.rst:530 msgid ":const:`KQ_FILTER_READ`" msgstr ":const:`KQ_FILTER_READ`" -#: ../../library/select.rst:524 +#: ../../library/select.rst:530 msgid "Takes a descriptor and returns whenever there is data available to read" msgstr "" -#: ../../library/select.rst:527 +#: ../../library/select.rst:533 msgid ":const:`KQ_FILTER_WRITE`" msgstr ":const:`KQ_FILTER_WRITE`" -#: ../../library/select.rst:527 +#: ../../library/select.rst:533 msgid "" "Takes a descriptor and returns whenever there is data available to write" msgstr "" -#: ../../library/select.rst:530 +#: ../../library/select.rst:536 msgid ":const:`KQ_FILTER_AIO`" msgstr ":const:`KQ_FILTER_AIO`" -#: ../../library/select.rst:530 +#: ../../library/select.rst:536 msgid "AIO requests" msgstr "" -#: ../../library/select.rst:532 +#: ../../library/select.rst:538 msgid ":const:`KQ_FILTER_VNODE`" msgstr ":const:`KQ_FILTER_VNODE`" -#: ../../library/select.rst:532 +#: ../../library/select.rst:538 msgid "" "Returns when one or more of the requested events watched in *fflag* occurs" msgstr "" -#: ../../library/select.rst:535 +#: ../../library/select.rst:541 msgid ":const:`KQ_FILTER_PROC`" msgstr ":const:`KQ_FILTER_PROC`" -#: ../../library/select.rst:535 +#: ../../library/select.rst:541 msgid "Watch for events on a process id" msgstr "" -#: ../../library/select.rst:537 +#: ../../library/select.rst:543 msgid ":const:`KQ_FILTER_NETDEV`" msgstr ":const:`KQ_FILTER_NETDEV`" -#: ../../library/select.rst:537 +#: ../../library/select.rst:543 msgid "Watch for events on a network device [not available on macOS]" msgstr "" -#: ../../library/select.rst:540 +#: ../../library/select.rst:546 msgid ":const:`KQ_FILTER_SIGNAL`" msgstr ":const:`KQ_FILTER_SIGNAL`" -#: ../../library/select.rst:540 +#: ../../library/select.rst:546 msgid "Returns whenever the watched signal is delivered to the process" msgstr "" -#: ../../library/select.rst:543 +#: ../../library/select.rst:549 msgid ":const:`KQ_FILTER_TIMER`" msgstr ":const:`KQ_FILTER_TIMER`" -#: ../../library/select.rst:543 +#: ../../library/select.rst:549 msgid "Establishes an arbitrary timer" msgstr "" -#: ../../library/select.rst:548 +#: ../../library/select.rst:554 msgid "Filter action." msgstr "" -#: ../../library/select.rst:553 +#: ../../library/select.rst:559 msgid ":const:`KQ_EV_ADD`" msgstr ":const:`KQ_EV_ADD`" -#: ../../library/select.rst:553 +#: ../../library/select.rst:559 msgid "Adds or modifies an event" msgstr "" -#: ../../library/select.rst:555 +#: ../../library/select.rst:561 msgid ":const:`KQ_EV_DELETE`" msgstr ":const:`KQ_EV_DELETE`" -#: ../../library/select.rst:555 +#: ../../library/select.rst:561 msgid "Removes an event from the queue" msgstr "" -#: ../../library/select.rst:557 +#: ../../library/select.rst:563 msgid ":const:`KQ_EV_ENABLE`" msgstr ":const:`KQ_EV_ENABLE`" -#: ../../library/select.rst:557 +#: ../../library/select.rst:563 msgid "Permitscontrol() to returns the event" msgstr "" -#: ../../library/select.rst:559 +#: ../../library/select.rst:565 msgid ":const:`KQ_EV_DISABLE`" msgstr ":const:`KQ_EV_DISABLE`" -#: ../../library/select.rst:559 +#: ../../library/select.rst:565 msgid "Disablesevent" msgstr "" -#: ../../library/select.rst:561 +#: ../../library/select.rst:567 msgid ":const:`KQ_EV_ONESHOT`" msgstr ":const:`KQ_EV_ONESHOT`" -#: ../../library/select.rst:561 +#: ../../library/select.rst:567 msgid "Removes event after first occurrence" msgstr "" -#: ../../library/select.rst:563 +#: ../../library/select.rst:569 msgid ":const:`KQ_EV_CLEAR`" msgstr ":const:`KQ_EV_CLEAR`" -#: ../../library/select.rst:563 +#: ../../library/select.rst:569 msgid "Reset the state after an event is retrieved" msgstr "" -#: ../../library/select.rst:565 +#: ../../library/select.rst:571 msgid ":const:`KQ_EV_SYSFLAGS`" msgstr ":const:`KQ_EV_SYSFLAGS`" -#: ../../library/select.rst:565 ../../library/select.rst:567 +#: ../../library/select.rst:571 ../../library/select.rst:573 msgid "internal event" msgstr "" -#: ../../library/select.rst:567 +#: ../../library/select.rst:573 msgid ":const:`KQ_EV_FLAG1`" msgstr ":const:`KQ_EV_FLAG1`" -#: ../../library/select.rst:569 +#: ../../library/select.rst:575 msgid ":const:`KQ_EV_EOF`" msgstr ":const:`KQ_EV_EOF`" -#: ../../library/select.rst:569 +#: ../../library/select.rst:575 msgid "Filter specific EOF condition" msgstr "" -#: ../../library/select.rst:571 +#: ../../library/select.rst:577 msgid ":const:`KQ_EV_ERROR`" msgstr ":const:`KQ_EV_ERROR`" -#: ../../library/select.rst:571 +#: ../../library/select.rst:577 msgid "See return values" msgstr "" -#: ../../library/select.rst:577 +#: ../../library/select.rst:583 msgid "Filter specific flags." msgstr "" -#: ../../library/select.rst:579 +#: ../../library/select.rst:585 msgid ":const:`KQ_FILTER_READ` and :const:`KQ_FILTER_WRITE` filter flags:" msgstr "" -#: ../../library/select.rst:584 +#: ../../library/select.rst:590 msgid ":const:`KQ_NOTE_LOWAT`" msgstr ":const:`KQ_NOTE_LOWAT`" -#: ../../library/select.rst:584 +#: ../../library/select.rst:590 msgid "low water mark of a socket buffer" msgstr "" -#: ../../library/select.rst:587 +#: ../../library/select.rst:593 msgid ":const:`KQ_FILTER_VNODE` filter flags:" msgstr "" -#: ../../library/select.rst:592 +#: ../../library/select.rst:598 msgid ":const:`KQ_NOTE_DELETE`" msgstr ":const:`KQ_NOTE_DELETE`" -#: ../../library/select.rst:592 +#: ../../library/select.rst:598 msgid "*unlink()* was called" msgstr "" -#: ../../library/select.rst:594 +#: ../../library/select.rst:600 msgid ":const:`KQ_NOTE_WRITE`" msgstr ":const:`KQ_NOTE_WRITE`" -#: ../../library/select.rst:594 +#: ../../library/select.rst:600 msgid "a write occurred" msgstr "" -#: ../../library/select.rst:596 +#: ../../library/select.rst:602 msgid ":const:`KQ_NOTE_EXTEND`" msgstr ":const:`KQ_NOTE_EXTEND`" -#: ../../library/select.rst:596 +#: ../../library/select.rst:602 msgid "the file was extended" msgstr "" -#: ../../library/select.rst:598 +#: ../../library/select.rst:604 msgid ":const:`KQ_NOTE_ATTRIB`" msgstr ":const:`KQ_NOTE_ATTRIB`" -#: ../../library/select.rst:598 +#: ../../library/select.rst:604 msgid "an attribute was changed" msgstr "" -#: ../../library/select.rst:600 +#: ../../library/select.rst:606 msgid ":const:`KQ_NOTE_LINK`" msgstr ":const:`KQ_NOTE_LINK`" -#: ../../library/select.rst:600 +#: ../../library/select.rst:606 msgid "the link count has changed" msgstr "" -#: ../../library/select.rst:602 +#: ../../library/select.rst:608 msgid ":const:`KQ_NOTE_RENAME`" msgstr ":const:`KQ_NOTE_RENAME`" -#: ../../library/select.rst:602 +#: ../../library/select.rst:608 msgid "the file was renamed" msgstr "" -#: ../../library/select.rst:604 +#: ../../library/select.rst:610 msgid ":const:`KQ_NOTE_REVOKE`" msgstr ":const:`KQ_NOTE_REVOKE`" -#: ../../library/select.rst:604 +#: ../../library/select.rst:610 msgid "access to the file was revoked" msgstr "" -#: ../../library/select.rst:607 +#: ../../library/select.rst:613 msgid ":const:`KQ_FILTER_PROC` filter flags:" msgstr "" -#: ../../library/select.rst:612 +#: ../../library/select.rst:618 msgid ":const:`KQ_NOTE_EXIT`" msgstr ":const:`KQ_NOTE_EXIT`" -#: ../../library/select.rst:612 +#: ../../library/select.rst:618 msgid "the process has exited" msgstr "" -#: ../../library/select.rst:614 +#: ../../library/select.rst:620 msgid ":const:`KQ_NOTE_FORK`" msgstr ":const:`KQ_NOTE_FORK`" -#: ../../library/select.rst:614 +#: ../../library/select.rst:620 msgid "the process has called *fork()*" msgstr "" -#: ../../library/select.rst:616 +#: ../../library/select.rst:622 msgid ":const:`KQ_NOTE_EXEC`" msgstr ":const:`KQ_NOTE_EXEC`" -#: ../../library/select.rst:616 +#: ../../library/select.rst:622 msgid "the process has executed a new process" msgstr "" -#: ../../library/select.rst:618 +#: ../../library/select.rst:624 msgid ":const:`KQ_NOTE_PCTRLMASK`" msgstr ":const:`KQ_NOTE_PCTRLMASK`" -#: ../../library/select.rst:618 ../../library/select.rst:620 +#: ../../library/select.rst:624 ../../library/select.rst:626 msgid "internal filter flag" msgstr "" -#: ../../library/select.rst:620 +#: ../../library/select.rst:626 msgid ":const:`KQ_NOTE_PDATAMASK`" msgstr ":const:`KQ_NOTE_PDATAMASK`" -#: ../../library/select.rst:622 +#: ../../library/select.rst:628 msgid ":const:`KQ_NOTE_TRACK`" msgstr ":const:`KQ_NOTE_TRACK`" -#: ../../library/select.rst:622 +#: ../../library/select.rst:628 msgid "follow a process across *fork()*" msgstr "" -#: ../../library/select.rst:624 +#: ../../library/select.rst:630 msgid ":const:`KQ_NOTE_CHILD`" msgstr ":const:`KQ_NOTE_CHILD`" -#: ../../library/select.rst:624 +#: ../../library/select.rst:630 msgid "returned on the child process for *NOTE_TRACK*" msgstr "" -#: ../../library/select.rst:627 +#: ../../library/select.rst:633 msgid ":const:`KQ_NOTE_TRACKERR`" msgstr ":const:`KQ_NOTE_TRACKERR`" -#: ../../library/select.rst:627 +#: ../../library/select.rst:633 msgid "unable to attach to a child" msgstr "" -#: ../../library/select.rst:630 +#: ../../library/select.rst:636 msgid ":const:`KQ_FILTER_NETDEV` filter flags (not available on macOS):" msgstr "" -#: ../../library/select.rst:635 +#: ../../library/select.rst:641 msgid ":const:`KQ_NOTE_LINKUP`" msgstr ":const:`KQ_NOTE_LINKUP`" -#: ../../library/select.rst:635 +#: ../../library/select.rst:641 msgid "link is up" msgstr "" -#: ../../library/select.rst:637 +#: ../../library/select.rst:643 msgid ":const:`KQ_NOTE_LINKDOWN`" msgstr ":const:`KQ_NOTE_LINKDOWN`" -#: ../../library/select.rst:637 +#: ../../library/select.rst:643 msgid "link is down" msgstr "" -#: ../../library/select.rst:639 +#: ../../library/select.rst:645 msgid ":const:`KQ_NOTE_LINKINV`" msgstr ":const:`KQ_NOTE_LINKINV`" -#: ../../library/select.rst:639 +#: ../../library/select.rst:645 msgid "link state is invalid" msgstr "" -#: ../../library/select.rst:645 +#: ../../library/select.rst:651 msgid "Filter specific data." msgstr "" -#: ../../library/select.rst:650 +#: ../../library/select.rst:656 msgid "User defined value." msgstr "" diff --git a/library/shutil.po b/library/shutil.po index 75769f7b7c9..f4375bf8936 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-04 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,8 +35,8 @@ msgstr "" #: ../../library/shutil.rst:25 msgid "" -"Even the higher-level file copying functions (:func:`shutil.copy`, :func:" -"`shutil.copy2`) cannot copy all file metadata." +"Even the higher-level file copying functions " +"(:func:`shutil.copy`, :func:`shutil.copy2`) cannot copy all file metadata." msgstr "" #: ../../library/shutil.rst:28 @@ -63,7 +63,18 @@ msgid "" "current file position to the end of the file will be copied." msgstr "" -#: ../../library/shutil.rst:53 +#: ../../library/shutil.rst:50 +msgid "" +":func:`copyfileobj` will *not* guarantee that the destination stream has " +"been flushed on completion of the copy. If you want to read from the " +"destination at the completion of the copy operation (for example, reading " +"the contents of a temporary file that has been copied from a HTTP stream), " +"you must ensure that you have called :func:`~io.IOBase.flush` " +"or :func:`~io.IOBase.close` on the file-like object before attempting to " +"read the destination file." +msgstr "" + +#: ../../library/shutil.rst:60 msgid "" "Copy the contents (no metadata) of the file named *src* to a file named " "*dst* and return *dst* in the most efficient way possible. *src* and *dst* " @@ -71,14 +82,14 @@ msgid "" "strings." msgstr "" -#: ../../library/shutil.rst:57 +#: ../../library/shutil.rst:64 msgid "" "*dst* must be the complete target file name; look at :func:`~shutil.copy` " "for a copy that accepts a target directory path. If *src* and *dst* specify " "the same file, :exc:`SameFileError` is raised." msgstr "" -#: ../../library/shutil.rst:61 +#: ../../library/shutil.rst:68 msgid "" "The destination location must be writable; otherwise, an :exc:`OSError` " "exception will be raised. If *dst* already exists, it will be replaced. " @@ -86,80 +97,80 @@ msgid "" "with this function." msgstr "" -#: ../../library/shutil.rst:66 +#: ../../library/shutil.rst:73 msgid "" "If *follow_symlinks* is false and *src* is a symbolic link, a new symbolic " "link will be created instead of copying the file *src* points to." msgstr "" -#: ../../library/shutil.rst:70 ../../library/shutil.rst:184 -#: ../../library/shutil.rst:215 +#: ../../library/shutil.rst:77 ../../library/shutil.rst:191 +#: ../../library/shutil.rst:222 msgid "" "Raises an :ref:`auditing event ` ``shutil.copyfile`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"copyfile``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.copyfile``。" -#: ../../library/shutil.rst:72 +#: ../../library/shutil.rst:79 msgid "" ":exc:`IOError` used to be raised instead of :exc:`OSError`. Added " "*follow_symlinks* argument. Now returns *dst*." msgstr "" -#: ../../library/shutil.rst:77 +#: ../../library/shutil.rst:84 msgid "" "Raise :exc:`SameFileError` instead of :exc:`Error`. Since the former is a " "subclass of the latter, this change is backward compatible." msgstr "" -#: ../../library/shutil.rst:81 ../../library/shutil.rst:192 -#: ../../library/shutil.rst:224 ../../library/shutil.rst:294 -#: ../../library/shutil.rst:407 +#: ../../library/shutil.rst:88 ../../library/shutil.rst:199 +#: ../../library/shutil.rst:231 ../../library/shutil.rst:301 +#: ../../library/shutil.rst:414 msgid "" "Platform-specific fast-copy syscalls may be used internally in order to copy " "the file more efficiently. See :ref:`shutil-platform-dependent-efficient-" "copy-operations` section." msgstr "" -#: ../../library/shutil.rst:88 +#: ../../library/shutil.rst:95 msgid "" "This exception is raised when :func:`copyfile` or :func:`copytree` attempt " "to copy a named pipe." msgstr "" -#: ../../library/shutil.rst:95 +#: ../../library/shutil.rst:102 msgid "" "This exception is raised if source and destination in :func:`copyfile` are " "the same file." msgstr "" -#: ../../library/shutil.rst:103 +#: ../../library/shutil.rst:110 msgid "" "Copy the permission bits from *src* to *dst*. The file contents, owner, and " "group are unaffected. *src* and *dst* are :term:`path-like objects ` or path names given as strings. If *follow_symlinks* is false, " "and both *src* and *dst* are symbolic links, :func:`copymode` will attempt " "to modify the mode of *dst* itself (rather than the file it points to). " -"This functionality is not available on every platform; please see :func:" -"`copystat` for more information. If :func:`copymode` cannot modify symbolic " -"links on the local platform, and it is asked to do so, it will do nothing " -"and return." +"This functionality is not available on every platform; please " +"see :func:`copystat` for more information. If :func:`copymode` cannot " +"modify symbolic links on the local platform, and it is asked to do so, it " +"will do nothing and return." msgstr "" -#: ../../library/shutil.rst:113 ../../library/shutil.rst:186 +#: ../../library/shutil.rst:120 ../../library/shutil.rst:193 msgid "" "Raises an :ref:`auditing event ` ``shutil.copymode`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"copymode``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.copymode``。" -#: ../../library/shutil.rst:115 +#: ../../library/shutil.rst:122 msgid "Added *follow_symlinks* argument." msgstr "新增 *follow_symlinks* 引數。" -#: ../../library/shutil.rst:120 +#: ../../library/shutil.rst:127 msgid "" "Copy the permission bits, last access time, last modification time, and " "flags from *src* to *dst*. On Linux, :func:`copystat` also copies the " @@ -168,7 +179,7 @@ msgid "" "object>` or path names given as strings." msgstr "" -#: ../../library/shutil.rst:126 +#: ../../library/shutil.rst:133 msgid "" "If *follow_symlinks* is false, and *src* and *dst* both refer to symbolic " "links, :func:`copystat` will operate on the symbolic links themselves rather " @@ -176,56 +187,56 @@ msgid "" "*src* symbolic link, and writing the information to the *dst* symbolic link." msgstr "" -#: ../../library/shutil.rst:135 +#: ../../library/shutil.rst:142 msgid "" "Not all platforms provide the ability to examine and modify symbolic links. " "Python itself can tell you what functionality is locally available." msgstr "" -#: ../../library/shutil.rst:139 +#: ../../library/shutil.rst:146 msgid "" "If ``os.chmod in os.supports_follow_symlinks`` is ``True``, :func:`copystat` " "can modify the permission bits of a symbolic link." msgstr "" -#: ../../library/shutil.rst:143 +#: ../../library/shutil.rst:150 msgid "" "If ``os.utime in os.supports_follow_symlinks`` is ``True``, :func:`copystat` " "can modify the last access and modification times of a symbolic link." msgstr "" -#: ../../library/shutil.rst:147 +#: ../../library/shutil.rst:154 msgid "" -"If ``os.chflags in os.supports_follow_symlinks`` is ``True``, :func:" -"`copystat` can modify the flags of a symbolic link. (``os.chflags`` is not " -"available on all platforms.)" +"If ``os.chflags in os.supports_follow_symlinks`` is " +"``True``, :func:`copystat` can modify the flags of a symbolic link. " +"(``os.chflags`` is not available on all platforms.)" msgstr "" -#: ../../library/shutil.rst:152 +#: ../../library/shutil.rst:159 msgid "" "On platforms where some or all of this functionality is unavailable, when " "asked to modify a symbolic link, :func:`copystat` will copy everything it " "can. :func:`copystat` never returns failure." msgstr "" -#: ../../library/shutil.rst:157 +#: ../../library/shutil.rst:164 msgid "Please see :data:`os.supports_follow_symlinks` for more information." msgstr "更多資訊請見 :data:`os.supports_follow_symlinks`。" -#: ../../library/shutil.rst:160 ../../library/shutil.rst:217 +#: ../../library/shutil.rst:167 ../../library/shutil.rst:224 msgid "" "Raises an :ref:`auditing event ` ``shutil.copystat`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"copystat``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.copystat``。" -#: ../../library/shutil.rst:162 +#: ../../library/shutil.rst:169 msgid "" "Added *follow_symlinks* argument and support for Linux extended attributes." msgstr "" -#: ../../library/shutil.rst:167 +#: ../../library/shutil.rst:174 msgid "" "Copies the file *src* to the file or directory *dst*. *src* and *dst* " "should be :term:`path-like objects ` or strings. If *dst* " @@ -234,14 +245,14 @@ msgid "" "be replaced. Returns the path to the newly created file." msgstr "" -#: ../../library/shutil.rst:173 +#: ../../library/shutil.rst:180 msgid "" "If *follow_symlinks* is false, and *src* is a symbolic link, *dst* will be " "created as a symbolic link. If *follow_symlinks* is true and *src* is a " "symbolic link, *dst* will be a copy of the file *src* refers to." msgstr "" -#: ../../library/shutil.rst:178 +#: ../../library/shutil.rst:185 msgid "" ":func:`~shutil.copy` copies the file data and the file's permission mode " "(see :func:`os.chmod`). Other metadata, like the file's creation and " @@ -249,62 +260,63 @@ msgid "" "original, use :func:`~shutil.copy2` instead." msgstr "" -#: ../../library/shutil.rst:188 +#: ../../library/shutil.rst:195 msgid "" "Added *follow_symlinks* argument. Now returns path to the newly created file." msgstr "" -#: ../../library/shutil.rst:199 +#: ../../library/shutil.rst:206 msgid "" "Identical to :func:`~shutil.copy` except that :func:`copy2` also attempts to " "preserve file metadata." msgstr "" -#: ../../library/shutil.rst:202 +#: ../../library/shutil.rst:209 msgid "" "When *follow_symlinks* is false, and *src* is a symbolic link, :func:`copy2` " "attempts to copy all metadata from the *src* symbolic link to the newly " "created *dst* symbolic link. However, this functionality is not available on " "all platforms. On platforms where some or all of this functionality is " -"unavailable, :func:`copy2` will preserve all the metadata it can; :func:" -"`copy2` never raises an exception because it cannot preserve file metadata." +"unavailable, :func:`copy2` will preserve all the metadata it " +"can; :func:`copy2` never raises an exception because it cannot preserve file " +"metadata." msgstr "" -#: ../../library/shutil.rst:211 +#: ../../library/shutil.rst:218 msgid "" -":func:`copy2` uses :func:`copystat` to copy the file metadata. Please see :" -"func:`copystat` for more information about platform support for modifying " -"symbolic link metadata." +":func:`copy2` uses :func:`copystat` to copy the file metadata. Please " +"see :func:`copystat` for more information about platform support for " +"modifying symbolic link metadata." msgstr "" -#: ../../library/shutil.rst:219 +#: ../../library/shutil.rst:226 msgid "" "Added *follow_symlinks* argument, try to copy extended file system " "attributes too (currently Linux only). Now returns path to the newly created " "file." msgstr "" -#: ../../library/shutil.rst:231 +#: ../../library/shutil.rst:238 msgid "" -"This factory function creates a function that can be used as a callable for :" -"func:`copytree`\\'s *ignore* argument, ignoring files and directories that " -"match one of the glob-style *patterns* provided. See the example below." +"This factory function creates a function that can be used as a callable " +"for :func:`copytree`\\'s *ignore* argument, ignoring files and directories " +"that match one of the glob-style *patterns* provided. See the example below." msgstr "" -#: ../../library/shutil.rst:240 +#: ../../library/shutil.rst:247 msgid "" "Recursively copy an entire directory tree rooted at *src* to a directory " "named *dst* and return the destination directory. All intermediate " "directories needed to contain *dst* will also be created by default." msgstr "" -#: ../../library/shutil.rst:244 +#: ../../library/shutil.rst:251 msgid "" "Permissions and times of directories are copied with :func:`copystat`, " "individual files are copied using :func:`~shutil.copy2`." msgstr "" -#: ../../library/shutil.rst:247 +#: ../../library/shutil.rst:254 msgid "" "If *symlinks* is true, symbolic links in the source tree are represented as " "symbolic links in the new tree and the metadata of the original links will " @@ -312,17 +324,17 @@ msgid "" "and metadata of the linked files are copied to the new tree." msgstr "" -#: ../../library/shutil.rst:252 +#: ../../library/shutil.rst:259 msgid "" "When *symlinks* is false, if the file pointed to by the symlink doesn't " -"exist, an exception will be added in the list of errors raised in an :exc:" -"`Error` exception at the end of the copy process. You can set the optional " -"*ignore_dangling_symlinks* flag to true if you want to silence this " +"exist, an exception will be added in the list of errors raised in " +"an :exc:`Error` exception at the end of the copy process. You can set the " +"optional *ignore_dangling_symlinks* flag to true if you want to silence this " "exception. Notice that this option has no effect on platforms that don't " "support :func:`os.symlink`." msgstr "" -#: ../../library/shutil.rst:259 +#: ../../library/shutil.rst:266 msgid "" "If *ignore* is given, it must be a callable that will receive as its " "arguments the directory being visited by :func:`copytree`, and a list of its " @@ -335,12 +347,12 @@ msgid "" "ignores names based on glob-style patterns." msgstr "" -#: ../../library/shutil.rst:269 +#: ../../library/shutil.rst:276 msgid "" "If exception(s) occur, an :exc:`Error` is raised with a list of reasons." msgstr "" -#: ../../library/shutil.rst:271 +#: ../../library/shutil.rst:278 msgid "" "If *copy_function* is given, it must be a callable that will be used to copy " "each file. It will be called with the source path and the destination path " @@ -348,39 +360,39 @@ msgid "" "that supports the same signature (like :func:`~shutil.copy`) can be used." msgstr "" -#: ../../library/shutil.rst:276 +#: ../../library/shutil.rst:283 msgid "" -"If *dirs_exist_ok* is false (the default) and *dst* already exists, a :exc:" -"`FileExistsError` is raised. If *dirs_exist_ok* is true, the copying " +"If *dirs_exist_ok* is false (the default) and *dst* already exists, " +"a :exc:`FileExistsError` is raised. If *dirs_exist_ok* is true, the copying " "operation will continue if it encounters existing directories, and files " "within the *dst* tree will be overwritten by corresponding files from the " "*src* tree." msgstr "" -#: ../../library/shutil.rst:282 +#: ../../library/shutil.rst:289 msgid "" "Raises an :ref:`auditing event ` ``shutil.copytree`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"copytree``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.copytree``。" -#: ../../library/shutil.rst:284 +#: ../../library/shutil.rst:291 msgid "" "Added the *copy_function* argument to be able to provide a custom copy " "function. Added the *ignore_dangling_symlinks* argument to silence dangling " "symlinks errors when *symlinks* is false." msgstr "" -#: ../../library/shutil.rst:290 +#: ../../library/shutil.rst:297 msgid "Copy metadata when *symlinks* is false. Now returns *dst*." msgstr "" -#: ../../library/shutil.rst:299 +#: ../../library/shutil.rst:306 msgid "Added the *dirs_exist_ok* parameter." msgstr "新增 *dirs_exist_ok* 參數。" -#: ../../library/shutil.rst:306 +#: ../../library/shutil.rst:313 msgid "" "Delete an entire directory tree; *path* must point to a directory (but not a " "symbolic link to a directory). If *ignore_errors* is true, errors resulting " @@ -389,13 +401,13 @@ msgid "" "are omitted, exceptions are propagated to the caller." msgstr "" -#: ../../library/shutil.rst:312 +#: ../../library/shutil.rst:319 msgid "" "This function can support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/shutil.rst:317 +#: ../../library/shutil.rst:324 msgid "" "On platforms that support the necessary fd-based functions a symlink attack " "resistant version of :func:`rmtree` is used by default. On other platforms, " @@ -406,13 +418,13 @@ msgid "" "attribute to determine which case applies." msgstr "" -#: ../../library/shutil.rst:325 +#: ../../library/shutil.rst:332 msgid "" "If *onexc* is provided, it must be a callable that accepts three parameters: " "*function*, *path*, and *excinfo*." msgstr "" -#: ../../library/shutil.rst:328 +#: ../../library/shutil.rst:335 msgid "" "The first parameter, *function*, is the function which raised the exception; " "it depends on the platform and implementation. The second parameter, " @@ -421,19 +433,19 @@ msgid "" "will not be caught." msgstr "" -#: ../../library/shutil.rst:334 +#: ../../library/shutil.rst:341 msgid "" "The deprecated *onerror* is similar to *onexc*, except that the third " "parameter it receives is the tuple returned from :func:`sys.exc_info`." msgstr "" -#: ../../library/shutil.rst:338 +#: ../../library/shutil.rst:345 msgid "" ":ref:`shutil-rmtree-example` for an example of handling the removal of a " "directory tree that contains read-only files." msgstr "" -#: ../../library/shutil.rst:341 +#: ../../library/shutil.rst:348 msgid "" "Raises an :ref:`auditing event ` ``shutil.rmtree`` with arguments " "``path``, ``dir_fd``." @@ -441,60 +453,60 @@ msgstr "" "引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` " "``shutil.rmtree``。" -#: ../../library/shutil.rst:343 +#: ../../library/shutil.rst:350 msgid "" "Added a symlink attack resistant version that is used automatically if " "platform supports fd-based functions." msgstr "" -#: ../../library/shutil.rst:347 +#: ../../library/shutil.rst:354 msgid "" "On Windows, will no longer delete the contents of a directory junction " "before removing the junction." msgstr "" -#: ../../library/shutil.rst:351 +#: ../../library/shutil.rst:358 msgid "Added the *dir_fd* parameter." msgstr "新增 *dir_fd* 參數。" -#: ../../library/shutil.rst:354 +#: ../../library/shutil.rst:361 msgid "Added the *onexc* parameter, deprecated *onerror*." msgstr "新增 *onexc* 參數並棄用 *onerror*。" -#: ../../library/shutil.rst:357 +#: ../../library/shutil.rst:364 msgid "" ":func:`!rmtree` now ignores :exc:`FileNotFoundError` exceptions for all but " -"the top-level path. Exceptions other than :exc:`OSError` and subclasses of :" -"exc:`!OSError` are now always propagated to the caller." +"the top-level path. Exceptions other than :exc:`OSError` and subclasses " +"of :exc:`!OSError` are now always propagated to the caller." msgstr "" -#: ../../library/shutil.rst:365 +#: ../../library/shutil.rst:372 msgid "" "Indicates whether the current platform and implementation provides a symlink " "attack resistant version of :func:`rmtree`. Currently this is only true for " "platforms supporting fd-based directory access functions." msgstr "" -#: ../../library/shutil.rst:374 +#: ../../library/shutil.rst:381 msgid "" "Recursively move a file or directory (*src*) to another location and return " "the destination." msgstr "" -#: ../../library/shutil.rst:377 +#: ../../library/shutil.rst:384 msgid "" "If *dst* is an existing directory or a symlink to a directory, then *src* is " "moved inside that directory. The destination path in that directory must not " "already exist." msgstr "" -#: ../../library/shutil.rst:381 +#: ../../library/shutil.rst:388 msgid "" "If *dst* already exists but is not a directory, it may be overwritten " "depending on :func:`os.rename` semantics." msgstr "" -#: ../../library/shutil.rst:384 +#: ../../library/shutil.rst:391 msgid "" "If the destination is on the current filesystem, then :func:`os.rename` is " "used. Otherwise, *src* is copied to the destination using *copy_function* " @@ -502,76 +514,76 @@ msgid "" "of *src* will be created as the destination and *src* will be removed." msgstr "" -#: ../../library/shutil.rst:389 +#: ../../library/shutil.rst:396 msgid "" "If *copy_function* is given, it must be a callable that takes two arguments, " "*src* and the destination, and will be used to copy *src* to the destination " -"if :func:`os.rename` cannot be used. If the source is a directory, :func:" -"`copytree` is called, passing it the *copy_function*. The default " -"*copy_function* is :func:`copy2`. Using :func:`~shutil.copy` as the " +"if :func:`os.rename` cannot be used. If the source is a " +"directory, :func:`copytree` is called, passing it the *copy_function*. The " +"default *copy_function* is :func:`copy2`. Using :func:`~shutil.copy` as the " "*copy_function* allows the move to succeed when it is not possible to also " "copy the metadata, at the expense of not copying any of the metadata." msgstr "" -#: ../../library/shutil.rst:397 +#: ../../library/shutil.rst:404 msgid "" "Raises an :ref:`auditing event ` ``shutil.move`` with arguments " "``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"move``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.move``。" -#: ../../library/shutil.rst:399 +#: ../../library/shutil.rst:406 msgid "" "Added explicit symlink handling for foreign filesystems, thus adapting it to " "the behavior of GNU's :program:`mv`. Now returns *dst*." msgstr "" -#: ../../library/shutil.rst:404 +#: ../../library/shutil.rst:411 msgid "Added the *copy_function* keyword argument." msgstr "新增 *copy_function* 關鍵字引數。" -#: ../../library/shutil.rst:412 +#: ../../library/shutil.rst:419 msgid "Accepts a :term:`path-like object` for both *src* and *dst*." msgstr "" -#: ../../library/shutil.rst:417 +#: ../../library/shutil.rst:424 msgid "" "Return disk usage statistics about the given path as a :term:`named tuple` " "with the attributes *total*, *used* and *free*, which are the amount of " "total, used and free space, in bytes. *path* may be a file or a directory." msgstr "" -#: ../../library/shutil.rst:424 +#: ../../library/shutil.rst:431 msgid "" "On Unix filesystems, *path* must point to a path within a **mounted** " "filesystem partition. On those platforms, CPython doesn't attempt to " "retrieve disk usage information from non-mounted filesystems." msgstr "" -#: ../../library/shutil.rst:430 +#: ../../library/shutil.rst:437 msgid "On Windows, *path* can now be a file or directory." msgstr "" -#: ../../library/shutil.rst:433 ../../library/shutil.rst:447 +#: ../../library/shutil.rst:440 ../../library/shutil.rst:454 msgid "Availability" msgstr "可用性" -#: ../../library/shutil.rst:438 +#: ../../library/shutil.rst:445 msgid "Change owner *user* and/or *group* of the given *path*." msgstr "" -#: ../../library/shutil.rst:440 +#: ../../library/shutil.rst:447 msgid "" "*user* can be a system user name or a uid; the same applies to *group*. At " "least one argument is required." msgstr "" -#: ../../library/shutil.rst:443 +#: ../../library/shutil.rst:450 msgid "See also :func:`os.chown`, the underlying function." msgstr "" -#: ../../library/shutil.rst:445 +#: ../../library/shutil.rst:452 msgid "" "Raises an :ref:`auditing event ` ``shutil.chown`` with arguments " "``path``, ``user``, ``group``." @@ -579,38 +591,38 @@ msgstr "" "引發一個附帶引數 ``path``、``user``、``group`` 的\\ :ref:`稽核事件 " "` ``shutil.chown``。" -#: ../../library/shutil.rst:451 +#: ../../library/shutil.rst:458 msgid "Added *dir_fd* and *follow_symlinks* parameters." msgstr "新增 *dir_fd* 和 *follow_symlinks* 參數。" -#: ../../library/shutil.rst:457 +#: ../../library/shutil.rst:464 msgid "" "Return the path to an executable which would be run if the given *cmd* was " "called. If no *cmd* would be called, return ``None``." msgstr "" -#: ../../library/shutil.rst:460 +#: ../../library/shutil.rst:467 msgid "" "*mode* is a permission mask passed to :func:`os.access`, by default " "determining if the file exists and is executable." msgstr "" -#: ../../library/shutil.rst:463 +#: ../../library/shutil.rst:470 msgid "" "*path* is a \"``PATH`` string\" specifying the directories to look in, " -"delimited by :data:`os.pathsep`. When no *path* is specified, the :envvar:" -"`PATH` environment variable is read from :data:`os.environ`, falling back " -"to :data:`os.defpath` if it is not set." +"delimited by :data:`os.pathsep`. When no *path* is specified, " +"the :envvar:`PATH` environment variable is read from :data:`os.environ`, " +"falling back to :data:`os.defpath` if it is not set." msgstr "" -#: ../../library/shutil.rst:468 +#: ../../library/shutil.rst:475 msgid "" "If *cmd* contains a directory component, :func:`!which` only checks the " "specified path directly and does not search the directories listed in *path* " "or in the system's :envvar:`PATH` environment variable." msgstr "" -#: ../../library/shutil.rst:472 +#: ../../library/shutil.rst:479 msgid "" "On Windows, the current directory is prepended to the *path* if *mode* does " "not include ``os.X_OK``. When the *mode* does include ``os.X_OK``, the " @@ -620,7 +632,7 @@ msgid "" "environment variable ``NoDefaultCurrentDirectoryInExePath``." msgstr "" -#: ../../library/shutil.rst:479 +#: ../../library/shutil.rst:486 msgid "" "Also on Windows, the :envvar:`PATHEXT` environment variable is used to " "resolve commands that may not already include an extension. For example, if " @@ -629,7 +641,7 @@ msgid "" "directories. For example, on Windows::" msgstr "" -#: ../../library/shutil.rst:485 +#: ../../library/shutil.rst:492 msgid "" ">>> shutil.which(\"python\")\n" "'C:\\\\Python33\\\\python.EXE'" @@ -637,13 +649,13 @@ msgstr "" ">>> shutil.which(\"python\")\n" "'C:\\\\Python33\\\\python.EXE'" -#: ../../library/shutil.rst:488 +#: ../../library/shutil.rst:495 msgid "" "This is also applied when *cmd* is a path that contains a directory " "component::" msgstr "" -#: ../../library/shutil.rst:491 +#: ../../library/shutil.rst:498 msgid "" ">>> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" @@ -651,13 +663,13 @@ msgstr "" ">>> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" -#: ../../library/shutil.rst:496 +#: ../../library/shutil.rst:503 msgid "" "The :class:`bytes` type is now accepted. If *cmd* type is :class:`bytes`, " "the result type is also :class:`bytes`." msgstr "" -#: ../../library/shutil.rst:500 +#: ../../library/shutil.rst:507 msgid "" "On Windows, the current directory is no longer prepended to the search path " "if *mode* includes ``os.X_OK`` and WinAPI " @@ -668,58 +680,72 @@ msgid "" "now be found." msgstr "" -#: ../../library/shutil.rst:511 +#: ../../library/shutil.rst:518 msgid "" "This exception collects exceptions that are raised during a multi-file " "operation. For :func:`copytree`, the exception argument is a list of 3-" "tuples (*srcname*, *dstname*, *exception*)." msgstr "" -#: ../../library/shutil.rst:518 +#: ../../library/shutil.rst:525 msgid "Platform-dependent efficient copy operations" msgstr "" -#: ../../library/shutil.rst:520 +#: ../../library/shutil.rst:527 msgid "" -"Starting from Python 3.8, all functions involving a file copy (:func:" -"`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, and :func:" -"`move`) may use platform-specific \"fast-copy\" syscalls in order to copy " -"the file more efficiently (see :issue:`33671`). \"fast-copy\" means that the " -"copying operation occurs within the kernel, avoiding the use of userspace " -"buffers in Python as in \"``outfd.write(infd.read())``\"." +"Starting from Python 3.8, all functions involving a file copy " +"(:func:`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, " +"and :func:`move`) may use platform-specific \"fast-copy\" syscalls in order " +"to copy the file more efficiently (see :issue:`33671`). \"fast-copy\" means " +"that the copying operation occurs within the kernel, avoiding the use of " +"userspace buffers in Python as in \"``outfd.write(infd.read())``\"." msgstr "" -#: ../../library/shutil.rst:528 +#: ../../library/shutil.rst:535 msgid "On macOS `fcopyfile`_ is used to copy the file content (not metadata)." msgstr "" -#: ../../library/shutil.rst:530 -msgid "On Linux :func:`os.sendfile` is used." +#: ../../library/shutil.rst:537 +msgid "On Linux :func:`os.copy_file_range` or :func:`os.sendfile` is used." +msgstr "" + +#: ../../library/shutil.rst:539 +msgid "On Solaris :func:`os.sendfile` is used." msgstr "" -#: ../../library/shutil.rst:532 +#: ../../library/shutil.rst:541 msgid "" "On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " -"instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil." -"copyfileobj` is used." +"instead of 64 KiB) and a :func:`memoryview`-based variant " +"of :func:`shutil.copyfileobj` is used." msgstr "" -#: ../../library/shutil.rst:536 +#: ../../library/shutil.rst:545 msgid "" "If the fast-copy operation fails and no data was written in the destination " -"file then shutil will silently fallback on using less efficient :func:" -"`copyfileobj` function internally." +"file then shutil will silently fallback on using less " +"efficient :func:`copyfileobj` function internally." msgstr "" -#: ../../library/shutil.rst:545 +#: ../../library/shutil.rst:551 +msgid "Solaris now uses :func:`os.sendfile`." +msgstr "" + +#: ../../library/shutil.rst:554 +msgid "" +"Copy-on-write or server-side copy may be used internally " +"via :func:`os.copy_file_range` on supported Linux filesystems." +msgstr "" + +#: ../../library/shutil.rst:561 msgid "copytree example" msgstr "copytree 範例" -#: ../../library/shutil.rst:547 +#: ../../library/shutil.rst:563 msgid "An example that uses the :func:`ignore_patterns` helper::" msgstr "" -#: ../../library/shutil.rst:549 +#: ../../library/shutil.rst:565 msgid "" "from shutil import copytree, ignore_patterns\n" "\n" @@ -729,17 +755,17 @@ msgstr "" "\n" "copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*'))" -#: ../../library/shutil.rst:553 +#: ../../library/shutil.rst:569 msgid "" "This will copy everything except ``.pyc`` files and files or directories " "whose name starts with ``tmp``." msgstr "" -#: ../../library/shutil.rst:556 +#: ../../library/shutil.rst:572 msgid "Another example that uses the *ignore* argument to add a logging call::" msgstr "" -#: ../../library/shutil.rst:558 +#: ../../library/shutil.rst:574 msgid "" "from shutil import copytree\n" "import logging\n" @@ -751,11 +777,11 @@ msgid "" "copytree(source, destination, ignore=_logpath)" msgstr "" -#: ../../library/shutil.rst:571 +#: ../../library/shutil.rst:587 msgid "rmtree example" msgstr "rmtree 範例" -#: ../../library/shutil.rst:573 +#: ../../library/shutil.rst:589 msgid "" "This example shows how to remove a directory tree on Windows where some of " "the files have their read-only bit set. It uses the onexc callback to clear " @@ -763,7 +789,7 @@ msgid "" "propagate. ::" msgstr "" -#: ../../library/shutil.rst:578 +#: ../../library/shutil.rst:594 msgid "" "import os, stat\n" "import shutil\n" @@ -776,46 +802,47 @@ msgid "" "shutil.rmtree(directory, onexc=remove_readonly)" msgstr "" -#: ../../library/shutil.rst:591 +#: ../../library/shutil.rst:607 msgid "Archiving operations" msgstr "" -#: ../../library/shutil.rst:595 +#: ../../library/shutil.rst:611 msgid "Added support for the *xztar* format." msgstr "新增 *xztar* 格式的支援。" -#: ../../library/shutil.rst:599 +#: ../../library/shutil.rst:615 msgid "" "High-level utilities to create and read compressed and archived files are " "also provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules." msgstr "" -#: ../../library/shutil.rst:604 +#: ../../library/shutil.rst:620 msgid "Create an archive file (such as zip or tar) and return its name." msgstr "" -#: ../../library/shutil.rst:606 +#: ../../library/shutil.rst:622 msgid "" "*base_name* is the name of the file to create, including the path, minus any " "format-specific extension." msgstr "" -#: ../../library/shutil.rst:609 +#: ../../library/shutil.rst:625 msgid "" "*format* is the archive format: one of \"zip\" (if the :mod:`zlib` module is " "available), \"tar\", \"gztar\" (if the :mod:`zlib` module is available), " -"\"bztar\" (if the :mod:`bz2` module is available), or \"xztar\" (if the :mod:" -"`lzma` module is available)." +"\"bztar\" (if the :mod:`bz2` module is available), \"xztar\" (if " +"the :mod:`lzma` module is available), or \"zstdtar\" (if " +"the :mod:`compression.zstd` module is available)." msgstr "" -#: ../../library/shutil.rst:614 +#: ../../library/shutil.rst:631 msgid "" "*root_dir* is a directory that will be the root directory of the archive, " "all paths in the archive will be relative to it; for example, we typically " "chdir into *root_dir* before creating the archive." msgstr "" -#: ../../library/shutil.rst:618 +#: ../../library/shutil.rst:635 msgid "" "*base_dir* is the directory where we start archiving from; i.e. *base_dir* " "will be the common prefix of all files and directories in the archive. " @@ -823,102 +850,108 @@ msgid "" "example-with-basedir` for how to use *base_dir* and *root_dir* together." msgstr "" -#: ../../library/shutil.rst:624 +#: ../../library/shutil.rst:641 msgid "*root_dir* and *base_dir* both default to the current directory." msgstr "" -#: ../../library/shutil.rst:626 +#: ../../library/shutil.rst:643 msgid "" "If *dry_run* is true, no archive is created, but the operations that would " "be executed are logged to *logger*." msgstr "" -#: ../../library/shutil.rst:629 +#: ../../library/shutil.rst:646 msgid "" "*owner* and *group* are used when creating a tar archive. By default, uses " "the current owner and group." msgstr "" -#: ../../library/shutil.rst:632 +#: ../../library/shutil.rst:649 msgid "" "*logger* must be an object compatible with :pep:`282`, usually an instance " "of :class:`logging.Logger`." msgstr "" -#: ../../library/shutil.rst:635 +#: ../../library/shutil.rst:652 msgid "The *verbose* argument is unused and deprecated." msgstr "" -#: ../../library/shutil.rst:637 +#: ../../library/shutil.rst:654 msgid "" "Raises an :ref:`auditing event ` ``shutil.make_archive`` with " "arguments ``base_name``, ``format``, ``root_dir``, ``base_dir``." msgstr "" -"引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的\\ :" -"ref:`稽核事件 ` ``shutil.make_archive``。" +"引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的" +"\\ :ref:`稽核事件 ` ``shutil.make_archive``。" -#: ../../library/shutil.rst:641 +#: ../../library/shutil.rst:658 msgid "" -"This function is not thread-safe when custom archivers registered with :func:" -"`register_archive_format` do not support the *root_dir* argument. In this " -"case it temporarily changes the current working directory of the process to " -"*root_dir* to perform archiving." +"This function is not thread-safe when custom archivers registered " +"with :func:`register_archive_format` do not support the *root_dir* " +"argument. In this case it temporarily changes the current working directory " +"of the process to *root_dir* to perform archiving." msgstr "" -#: ../../library/shutil.rst:647 +#: ../../library/shutil.rst:664 msgid "" "The modern pax (POSIX.1-2001) format is now used instead of the legacy GNU " "format for archives created with ``format=\"tar\"``." msgstr "" -#: ../../library/shutil.rst:651 +#: ../../library/shutil.rst:668 msgid "" "This function is now made thread-safe during creation of standard ``.zip`` " "and tar archives." msgstr "" -#: ../../library/shutil.rst:657 +#: ../../library/shutil.rst:674 msgid "" "Return a list of supported formats for archiving. Each element of the " "returned sequence is a tuple ``(name, description)``." msgstr "" -#: ../../library/shutil.rst:660 ../../library/shutil.rst:771 +#: ../../library/shutil.rst:677 ../../library/shutil.rst:794 msgid "By default :mod:`shutil` provides these formats:" msgstr "" -#: ../../library/shutil.rst:662 +#: ../../library/shutil.rst:679 msgid "*zip*: ZIP file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:663 +#: ../../library/shutil.rst:680 msgid "" "*tar*: Uncompressed tar file. Uses POSIX.1-2001 pax format for new archives." msgstr "" -#: ../../library/shutil.rst:664 ../../library/shutil.rst:776 +#: ../../library/shutil.rst:681 ../../library/shutil.rst:799 msgid "*gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:665 ../../library/shutil.rst:777 +#: ../../library/shutil.rst:682 ../../library/shutil.rst:800 msgid "*bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available)." msgstr "" -#: ../../library/shutil.rst:666 ../../library/shutil.rst:778 +#: ../../library/shutil.rst:683 ../../library/shutil.rst:801 msgid "*xztar*: xz'ed tar-file (if the :mod:`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:668 +#: ../../library/shutil.rst:684 ../../library/shutil.rst:802 +msgid "" +"*zstdtar*: Zstandard compressed tar-file (if the :mod:`compression.zstd` " +"module is available)." +msgstr "" + +#: ../../library/shutil.rst:687 msgid "" "You can register new formats or provide your own archiver for any existing " "formats, by using :func:`register_archive_format`." msgstr "" -#: ../../library/shutil.rst:674 +#: ../../library/shutil.rst:693 msgid "Register an archiver for the format *name*." msgstr "" -#: ../../library/shutil.rst:676 +#: ../../library/shutil.rst:695 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive the *base_name* of the file to create, followed by the " @@ -927,7 +960,7 @@ msgid "" "*dry_run* and *logger* (as passed in :func:`make_archive`)." msgstr "" -#: ../../library/shutil.rst:682 +#: ../../library/shutil.rst:701 msgid "" "If *function* has the custom attribute ``function.supports_root_dir`` set to " "``True``, the *root_dir* argument is passed as a keyword argument. Otherwise " @@ -936,56 +969,56 @@ msgid "" "not thread-safe." msgstr "" -#: ../../library/shutil.rst:688 +#: ../../library/shutil.rst:707 msgid "" "If given, *extra_args* is a sequence of ``(name, value)`` pairs that will be " "used as extra keywords arguments when the archiver callable is used." msgstr "" -#: ../../library/shutil.rst:691 +#: ../../library/shutil.rst:710 msgid "" "*description* is used by :func:`get_archive_formats` which returns the list " "of archivers. Defaults to an empty string." msgstr "" -#: ../../library/shutil.rst:694 +#: ../../library/shutil.rst:713 msgid "Added support for functions supporting the *root_dir* argument." msgstr "" -#: ../../library/shutil.rst:700 +#: ../../library/shutil.rst:719 msgid "Remove the archive format *name* from the list of supported formats." msgstr "" -#: ../../library/shutil.rst:705 +#: ../../library/shutil.rst:724 msgid "Unpack an archive. *filename* is the full path of the archive." msgstr "" -#: ../../library/shutil.rst:707 +#: ../../library/shutil.rst:726 msgid "" "*extract_dir* is the name of the target directory where the archive is " "unpacked. If not provided, the current working directory is used." msgstr "" -#: ../../library/shutil.rst:710 +#: ../../library/shutil.rst:729 msgid "" "*format* is the archive format: one of \"zip\", \"tar\", \"gztar\", " -"\"bztar\", or \"xztar\". Or any other format registered with :func:" -"`register_unpack_format`. If not provided, :func:`unpack_archive` will use " -"the archive file name extension and see if an unpacker was registered for " -"that extension. In case none is found, a :exc:`ValueError` is raised." +"\"bztar\", \"xztar\", or \"zstdtar\". Or any other format registered " +"with :func:`register_unpack_format`. If not " +"provided, :func:`unpack_archive` will use the archive file name extension " +"and see if an unpacker was registered for that extension. In case none is " +"found, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/shutil.rst:717 +#: ../../library/shutil.rst:736 msgid "" "The keyword-only *filter* argument is passed to the underlying unpacking " "function. For zip files, *filter* is not accepted. For tar files, it is " -"recommended to set it to ``'data'``, unless using features specific to tar " -"and UNIX-like filesystems. (See :ref:`tarfile-extraction-filter` for " -"details.) The ``'data'`` filter will become the default for tar files in " -"Python 3.14." +"recommended to use ``'data'`` (default since Python 3.14), unless using " +"features specific to tar and UNIX-like filesystems. (See :ref:`tarfile-" +"extraction-filter` for details.)" msgstr "" -#: ../../library/shutil.rst:725 +#: ../../library/shutil.rst:742 msgid "" "Raises an :ref:`auditing event ` ``shutil.unpack_archive`` with " "arguments ``filename``, ``extract_dir``, ``format``." @@ -993,7 +1026,7 @@ msgstr "" "引發一個附帶引數 ``filename``、``extract_dir``、``format`` 的\\ :ref:`稽核事" "件 ` ``shutil.unpack_archive``。" -#: ../../library/shutil.rst:729 +#: ../../library/shutil.rst:746 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of the path specified in the " @@ -1001,91 +1034,99 @@ msgid "" "with \"/\" or filenames with two dots \"..\"." msgstr "" -#: ../../library/shutil.rst:734 +#: ../../library/shutil.rst:751 +msgid "" +"Since Python 3.14, the defaults for both built-in formats (zip and tar " +"files) will prevent the most dangerous of such security issues, but will not " +"prevent *all* unintended behavior. Read the :ref:`tarfile-further-" +"verification` section for tar-specific details." +msgstr "" + +#: ../../library/shutil.rst:757 msgid "Accepts a :term:`path-like object` for *filename* and *extract_dir*." msgstr "" -#: ../../library/shutil.rst:737 +#: ../../library/shutil.rst:760 msgid "Added the *filter* argument." msgstr "新增 *filter* 引數。" -#: ../../library/shutil.rst:742 +#: ../../library/shutil.rst:765 msgid "" "Registers an unpack format. *name* is the name of the format and " -"*extensions* is a list of extensions corresponding to the format, like ``." -"zip`` for Zip files." +"*extensions* is a list of extensions corresponding to the format, like " +"``.zip`` for Zip files." msgstr "" -#: ../../library/shutil.rst:746 +#: ../../library/shutil.rst:769 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive:" msgstr "" -#: ../../library/shutil.rst:749 +#: ../../library/shutil.rst:772 msgid "the path of the archive, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:750 +#: ../../library/shutil.rst:773 msgid "" "the directory the archive must be extracted to, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:751 +#: ../../library/shutil.rst:774 msgid "" -"possibly a *filter* keyword argument, if it was given to :func:" -"`unpack_archive`;" +"possibly a *filter* keyword argument, if it was given " +"to :func:`unpack_archive`;" msgstr "" -#: ../../library/shutil.rst:753 +#: ../../library/shutil.rst:776 msgid "" "additional keyword arguments, specified by *extra_args* as a sequence of " "``(name, value)`` tuples." msgstr "" -#: ../../library/shutil.rst:756 +#: ../../library/shutil.rst:779 msgid "" "*description* can be provided to describe the format, and will be returned " "by the :func:`get_unpack_formats` function." msgstr "" -#: ../../library/shutil.rst:762 +#: ../../library/shutil.rst:785 msgid "Unregister an unpack format. *name* is the name of the format." msgstr "" -#: ../../library/shutil.rst:767 +#: ../../library/shutil.rst:790 msgid "" "Return a list of all registered formats for unpacking. Each element of the " "returned sequence is a tuple ``(name, extensions, description)``." msgstr "" -#: ../../library/shutil.rst:773 +#: ../../library/shutil.rst:796 msgid "" "*zip*: ZIP file (unpacking compressed files works only if the corresponding " "module is available)." msgstr "" -#: ../../library/shutil.rst:775 +#: ../../library/shutil.rst:798 msgid "*tar*: uncompressed tar file." msgstr "" -#: ../../library/shutil.rst:780 +#: ../../library/shutil.rst:805 msgid "" "You can register new formats or provide your own unpacker for any existing " "formats, by using :func:`register_unpack_format`." msgstr "" -#: ../../library/shutil.rst:787 +#: ../../library/shutil.rst:812 msgid "Archiving example" msgstr "" -#: ../../library/shutil.rst:789 +#: ../../library/shutil.rst:814 msgid "" "In this example, we create a gzip'ed tar-file archive containing all files " "found in the :file:`.ssh` directory of the user::" msgstr "" -#: ../../library/shutil.rst:792 +#: ../../library/shutil.rst:817 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1095,11 +1136,11 @@ msgid "" "'/Users/tarek/myarchive.tar.gz'" msgstr "" -#: ../../library/shutil.rst:799 +#: ../../library/shutil.rst:824 msgid "The resulting archive contains:" msgstr "" -#: ../../library/shutil.rst:801 +#: ../../library/shutil.rst:826 msgid "" "$ tar -tzvf /Users/tarek/myarchive.tar.gz\n" "drwx------ tarek/staff 0 2010-02-01 16:23:40 ./\n" @@ -1121,18 +1162,18 @@ msgstr "" "-rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub\n" "-rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts" -#: ../../library/shutil.rst:817 +#: ../../library/shutil.rst:842 msgid "Archiving example with *base_dir*" msgstr "" -#: ../../library/shutil.rst:819 +#: ../../library/shutil.rst:844 msgid "" "In this example, similar to the `one above `_, we " "show how to use :func:`make_archive`, but this time with the usage of " "*base_dir*. We now have the following directory structure:" msgstr "" -#: ../../library/shutil.rst:823 +#: ../../library/shutil.rst:848 msgid "" "$ tree tmp\n" "tmp\n" @@ -1150,13 +1191,14 @@ msgstr "" " └── please_add.txt\n" " └── do_not_add.txt" -#: ../../library/shutil.rst:833 +#: ../../library/shutil.rst:858 msgid "" -"In the final archive, :file:`please_add.txt` should be included, but :file:" -"`do_not_add.txt` should not. Therefore we use the following::" +"In the final archive, :file:`please_add.txt` should be included, " +"but :file:`do_not_add.txt` should not. Therefore we use the following::" msgstr "" -#: ../../library/shutil.rst:836 +#: ../../library/shutil.rst:861 +#, fuzzy msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1167,7 +1209,7 @@ msgid "" "... root_dir='tmp/root',\n" "... base_dir='structure/content',\n" "... )\n" -"'/Users/tarek/myarchive.tar'" +"'/Users/tarek/my_archive.tar'" msgstr "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1180,11 +1222,11 @@ msgstr "" "... )\n" "'/Users/tarek/myarchive.tar'" -#: ../../library/shutil.rst:847 +#: ../../library/shutil.rst:872 msgid "Listing the files in the resulting archive gives us:" msgstr "" -#: ../../library/shutil.rst:849 +#: ../../library/shutil.rst:874 msgid "" "$ python -m tarfile -l /Users/tarek/myarchive.tar\n" "structure/content/\n" @@ -1194,29 +1236,29 @@ msgstr "" "structure/content/\n" "structure/content/please_add.txt" -#: ../../library/shutil.rst:857 +#: ../../library/shutil.rst:882 msgid "Querying the size of the output terminal" msgstr "" -#: ../../library/shutil.rst:861 +#: ../../library/shutil.rst:886 msgid "Get the size of the terminal window." msgstr "" -#: ../../library/shutil.rst:863 +#: ../../library/shutil.rst:888 msgid "" "For each of the two dimensions, the environment variable, ``COLUMNS`` and " "``LINES`` respectively, is checked. If the variable is defined and the value " "is a positive integer, it is used." msgstr "" -#: ../../library/shutil.rst:867 +#: ../../library/shutil.rst:892 msgid "" "When ``COLUMNS`` or ``LINES`` is not defined, which is the common case, the " -"terminal connected to :data:`sys.__stdout__` is queried by invoking :func:" -"`os.get_terminal_size`." +"terminal connected to :data:`sys.__stdout__` is queried by " +"invoking :func:`os.get_terminal_size`." msgstr "" -#: ../../library/shutil.rst:871 +#: ../../library/shutil.rst:896 msgid "" "If the terminal size cannot be successfully queried, either because the " "system doesn't support querying, or because we are not connected to a " @@ -1225,17 +1267,17 @@ msgid "" "emulators." msgstr "" -#: ../../library/shutil.rst:877 +#: ../../library/shutil.rst:902 msgid "The value returned is a named tuple of type :class:`os.terminal_size`." msgstr "" -#: ../../library/shutil.rst:879 +#: ../../library/shutil.rst:904 msgid "" "See also: The Single UNIX Specification, Version 2, `Other Environment " "Variables`_." msgstr "" -#: ../../library/shutil.rst:884 +#: ../../library/shutil.rst:909 msgid "" "The ``fallback`` values are also used if :func:`os.get_terminal_size` " "returns zeroes." @@ -1253,10 +1295,10 @@ msgstr "copying(複製)" msgid "copying files" msgstr "copying files(複製檔案)" -#: ../../library/shutil.rst:304 +#: ../../library/shutil.rst:311 msgid "directory" msgstr "directory(目錄)" -#: ../../library/shutil.rst:304 +#: ../../library/shutil.rst:311 msgid "deleting" msgstr "deleting(刪除)" diff --git a/library/site.po b/library/site.po index 9108089b601..924a1f9278b 100644 --- a/library/site.po +++ b/library/site.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,8 +46,8 @@ msgstr "" #: ../../library/site.rst:25 msgid "" -"Importing the module used to trigger paths manipulation even when using :" -"option:`-S`." +"Importing the module used to trigger paths manipulation even when " +"using :option:`-S`." msgstr "" #: ../../library/site.rst:32 @@ -75,31 +75,38 @@ msgid "" "as :file:`lib/python3.13t/`." msgstr "" -#: ../../library/site.rst:52 +#: ../../library/site.rst:54 msgid "" -"If a file named \"pyvenv.cfg\" exists one directory above sys.executable, " -"sys.prefix and sys.exec_prefix are set to that directory and it is also " -"checked for site-packages (sys.base_prefix and sys.base_exec_prefix will " -"always be the \"real\" prefixes of the Python installation). If \"pyvenv." -"cfg\" (a bootstrap configuration file) contains the key \"include-system-" -"site-packages\" set to anything other than \"true\" (case-insensitive), the " -"system-level prefixes will not be searched for site-packages; otherwise they " -"will." +":mod:`site` is no longer responsible for updating :data:`sys.prefix` " +"and :data:`sys.exec_prefix` on :ref:`sys-path-init-virtual-environments`. " +"This is now done during the :ref:`path initialization `. As a " +"result, under :ref:`sys-path-init-virtual-environments`, :data:`sys.prefix` " +"and :data:`sys.exec_prefix` no longer depend on the :mod:`site` " +"initialization, and are therefore unaffected by :option:`-S`." msgstr "" -#: ../../library/site.rst:65 +#: ../../library/site.rst:63 msgid "" -"A path configuration file is a file whose name has the form :file:`{name}." -"pth` and exists in one of the four directories mentioned above; its contents " -"are additional items (one per line) to be added to ``sys.path``. Non-" -"existing items are never added to ``sys.path``, and no check is made that " -"the item refers to a directory rather than a file. No item is added to " -"``sys.path`` more than once. Blank lines and lines beginning with ``#`` are " -"skipped. Lines starting with ``import`` (followed by space or tab) are " -"executed." +"When running under a :ref:`virtual environment `, the ``pyvenv.cfg`` file in :data:`sys.prefix` is checked for " +"site-specific configurations. If the ``include-system-site-packages`` key " +"exists and is set to ``true`` (case-insensitive), the system-level prefixes " +"will be searched for site-packages, otherwise they won't." msgstr "" -#: ../../library/site.rst:75 +#: ../../library/site.rst:73 +msgid "" +"A path configuration file is a file whose name has the " +"form :file:`{name}.pth` and exists in one of the four directories mentioned " +"above; its contents are additional items (one per line) to be added to " +"``sys.path``. Non-existing items are never added to ``sys.path``, and no " +"check is made that the item refers to a directory rather than a file. No " +"item is added to ``sys.path`` more than once. Blank lines and lines " +"beginning with ``#`` are skipped. Lines starting with ``import`` (followed " +"by space or tab) are executed." +msgstr "" + +#: ../../library/site.rst:83 msgid "" "An executable line in a :file:`.pth` file is run at every Python startup, " "regardless of whether a particular module is actually going to be used. Its " @@ -111,23 +118,24 @@ msgid "" "putting anything more complex here." msgstr "" -#: ../../library/site.rst:86 +#: ../../library/site.rst:94 msgid "" -"The :file:`.pth` files are now decoded by UTF-8 at first and then by the :" -"term:`locale encoding` if it fails." +"The :file:`.pth` files are now decoded by UTF-8 at first and then by " +"the :term:`locale encoding` if it fails." msgstr "" -#: ../../library/site.rst:94 +#: ../../library/site.rst:102 msgid "" -"For example, suppose ``sys.prefix`` and ``sys.exec_prefix`` are set to :file:" -"`/usr/local`. The Python X.Y library is then installed in :file:`/usr/local/" -"lib/python{X.Y}`. Suppose this has a subdirectory :file:`/usr/local/lib/" -"python{X.Y}/site-packages` with three subsubdirectories, :file:`foo`, :file:" -"`bar` and :file:`spam`, and two path configuration files, :file:`foo.pth` " -"and :file:`bar.pth`. Assume :file:`foo.pth` contains the following::" +"For example, suppose ``sys.prefix`` and ``sys.exec_prefix`` are set " +"to :file:`/usr/local`. The Python X.Y library is then installed in :file:`/" +"usr/local/lib/python{X.Y}`. Suppose this has a subdirectory :file:`/usr/" +"local/lib/python{X.Y}/site-packages` with three " +"subsubdirectories, :file:`foo`, :file:`bar` and :file:`spam`, and two path " +"configuration files, :file:`foo.pth` and :file:`bar.pth`. " +"Assume :file:`foo.pth` contains the following::" msgstr "" -#: ../../library/site.rst:102 +#: ../../library/site.rst:110 msgid "" "# foo package configuration\n" "\n" @@ -136,24 +144,24 @@ msgid "" "bletch" msgstr "" -#: ../../library/site.rst:108 +#: ../../library/site.rst:116 msgid "and :file:`bar.pth` contains::" msgstr "" -#: ../../library/site.rst:110 +#: ../../library/site.rst:118 msgid "" "# bar package configuration\n" "\n" "bar" msgstr "" -#: ../../library/site.rst:114 +#: ../../library/site.rst:122 msgid "" "Then the following version-specific directories are added to ``sys.path``, " "in this order::" msgstr "" -#: ../../library/site.rst:117 +#: ../../library/site.rst:125 msgid "" "/usr/local/lib/pythonX.Y/site-packages/bar\n" "/usr/local/lib/pythonX.Y/site-packages/foo" @@ -161,162 +169,166 @@ msgstr "" "/usr/local/lib/pythonX.Y/site-packages/bar\n" "/usr/local/lib/pythonX.Y/site-packages/foo" -#: ../../library/site.rst:120 +#: ../../library/site.rst:128 msgid "" -"Note that :file:`bletch` is omitted because it doesn't exist; the :file:" -"`bar` directory precedes the :file:`foo` directory because :file:`bar.pth` " -"comes alphabetically before :file:`foo.pth`; and :file:`spam` is omitted " -"because it is not mentioned in either path configuration file." +"Note that :file:`bletch` is omitted because it doesn't exist; " +"the :file:`bar` directory precedes the :file:`foo` directory " +"because :file:`bar.pth` comes alphabetically before :file:`foo.pth`; " +"and :file:`spam` is omitted because it is not mentioned in either path " +"configuration file." msgstr "" -#: ../../library/site.rst:126 +#: ../../library/site.rst:134 msgid ":mod:`sitecustomize`" msgstr ":mod:`sitecustomize`" -#: ../../library/site.rst:130 +#: ../../library/site.rst:138 msgid "" -"After these path manipulations, an attempt is made to import a module named :" -"mod:`sitecustomize`, which can perform arbitrary site-specific " +"After these path manipulations, an attempt is made to import a module " +"named :mod:`sitecustomize`, which can perform arbitrary site-specific " "customizations. It is typically created by a system administrator in the " "site-packages directory. If this import fails with an :exc:`ImportError` or " "its subclass exception, and the exception's :attr:`~ImportError.name` " "attribute equals to ``'sitecustomize'``, it is silently ignored. If Python " "is started without output streams available, as with :file:`pythonw.exe` on " -"Windows (which is used by default to start IDLE), attempted output from :mod:" -"`sitecustomize` is ignored. Any other exception causes a silent and perhaps " -"mysterious failure of the process." +"Windows (which is used by default to start IDLE), attempted output " +"from :mod:`sitecustomize` is ignored. Any other exception causes a silent " +"and perhaps mysterious failure of the process." msgstr "" -#: ../../library/site.rst:142 +#: ../../library/site.rst:150 msgid ":mod:`usercustomize`" msgstr ":mod:`usercustomize`" -#: ../../library/site.rst:146 +#: ../../library/site.rst:154 msgid "" -"After this, an attempt is made to import a module named :mod:" -"`usercustomize`, which can perform arbitrary user-specific customizations, " -"if :data:`~site.ENABLE_USER_SITE` is true. This file is intended to be " -"created in the user site-packages directory (see below), which is part of " -"``sys.path`` unless disabled by :option:`-s`. If this import fails with an :" -"exc:`ImportError` or its subclass exception, and the exception's :attr:" -"`~ImportError.name` attribute equals to ``'usercustomize'``, it is silently " -"ignored." +"After this, an attempt is made to import a module " +"named :mod:`usercustomize`, which can perform arbitrary user-specific " +"customizations, if :data:`~site.ENABLE_USER_SITE` is true. This file is " +"intended to be created in the user site-packages directory (see below), " +"which is part of ``sys.path`` unless disabled by :option:`-s`. If this " +"import fails with an :exc:`ImportError` or its subclass exception, and the " +"exception's :attr:`~ImportError.name` attribute equals to " +"``'usercustomize'``, it is silently ignored." msgstr "" -#: ../../library/site.rst:154 +#: ../../library/site.rst:162 msgid "" "Note that for some non-Unix systems, ``sys.prefix`` and ``sys.exec_prefix`` " -"are empty, and the path manipulations are skipped; however the import of :" -"mod:`sitecustomize` and :mod:`usercustomize` is still attempted." +"are empty, and the path manipulations are skipped; however the import " +"of :mod:`sitecustomize` and :mod:`usercustomize` is still attempted." msgstr "" -#: ../../library/site.rst:163 +#: ../../library/site.rst:171 msgid "Readline configuration" msgstr "" -#: ../../library/site.rst:165 +#: ../../library/site.rst:173 msgid "" "On systems that support :mod:`readline`, this module will also import and " -"configure the :mod:`rlcompleter` module, if Python is started in :ref:" -"`interactive mode ` and without the :option:`-S` option. " -"The default behavior is enable tab-completion and to use :file:`~/." -"python_history` as the history save file. To disable it, delete (or " -"override) the :data:`sys.__interactivehook__` attribute in your :mod:" -"`sitecustomize` or :mod:`usercustomize` module or your :envvar:" -"`PYTHONSTARTUP` file." +"configure the :mod:`rlcompleter` module, if Python is started " +"in :ref:`interactive mode ` and without the :option:`-S` " +"option. The default behavior is enable tab-completion and to " +"use :file:`~/.python_history` as the history save file. To disable it, " +"delete (or override) the :data:`sys.__interactivehook__` attribute in " +"your :mod:`sitecustomize` or :mod:`usercustomize` module or " +"your :envvar:`PYTHONSTARTUP` file." msgstr "" -#: ../../library/site.rst:174 +#: ../../library/site.rst:182 msgid "Activation of rlcompleter and history was made automatic." msgstr "" -#: ../../library/site.rst:179 +#: ../../library/site.rst:187 msgid "Module contents" msgstr "模組內容" -#: ../../library/site.rst:183 +#: ../../library/site.rst:191 msgid "A list of prefixes for site-packages directories." msgstr "" -#: ../../library/site.rst:188 +#: ../../library/site.rst:196 msgid "" "Flag showing the status of the user site-packages directory. ``True`` means " "that it is enabled and was added to ``sys.path``. ``False`` means that it " -"was disabled by user request (with :option:`-s` or :envvar:" -"`PYTHONNOUSERSITE`). ``None`` means it was disabled for security reasons " -"(mismatch between user or group id and effective id) or by an administrator." +"was disabled by user request (with :option:`-s` " +"or :envvar:`PYTHONNOUSERSITE`). ``None`` means it was disabled for security " +"reasons (mismatch between user or group id and effective id) or by an " +"administrator." msgstr "" -#: ../../library/site.rst:198 +#: ../../library/site.rst:206 msgid "" -"Path to the user site-packages for the running Python. Can be ``None`` if :" -"func:`getusersitepackages` hasn't been called yet. Default value is :file:" -"`~/.local/lib/python{X.Y}[t]/site-packages` for UNIX and non-framework macOS " -"builds, :file:`~/Library/Python/{X.Y}/lib/python/site-packages` for macOS " -"framework builds, and :file:`{%APPDATA%}\\\\Python\\\\Python{XY}\\\\site-" -"packages` on Windows. The optional \"t\" indicates the free-threaded " -"build. This directory is a site directory, which means that :file:`.pth` " -"files in it will be processed." +"Path to the user site-packages for the running Python. Can be ``None`` " +"if :func:`getusersitepackages` hasn't been called yet. Default value " +"is :file:`~/.local/lib/python{X.Y}[t]/site-packages` for UNIX and non-" +"framework macOS builds, :file:`~/Library/Python/{X.Y}/lib/python/site-" +"packages` for macOS framework builds, and :file:`{%APPDATA%}\\\\Python\\" +"\\Python{XY}\\\\site-packages` on Windows. The optional \"t\" indicates the " +"free-threaded build. This directory is a site directory, which means " +"that :file:`.pth` files in it will be processed." msgstr "" -#: ../../library/site.rst:210 +#: ../../library/site.rst:218 msgid "" -"Path to the base directory for the user site-packages. Can be ``None`` if :" -"func:`getuserbase` hasn't been called yet. Default value is :file:`~/." -"local` for UNIX and macOS non-framework builds, :file:`~/Library/Python/{X.Y}" -"` for macOS framework builds, and :file:`{%APPDATA%}\\\\Python` for " -"Windows. This value is used to compute the installation directories for " -"scripts, data files, Python modules, etc. for the :ref:`user installation " -"scheme `. See also :envvar:`PYTHONUSERBASE`." +"Path to the base directory for the user site-packages. Can be ``None`` " +"if :func:`getuserbase` hasn't been called yet. Default value " +"is :file:`~/.local` for UNIX and macOS non-framework builds, :file:`~/" +"Library/Python/{X.Y}` for macOS framework builds, and :file:`{%APPDATA%}\\" +"\\Python` for Windows. This value is used to compute the installation " +"directories for scripts, data files, Python modules, etc. for the :ref:`user " +"installation scheme `. See " +"also :envvar:`PYTHONUSERBASE`." msgstr "" -#: ../../library/site.rst:222 +#: ../../library/site.rst:230 msgid "" "Adds all the standard site-specific directories to the module search path. " "This function is called automatically when this module is imported, unless " "the Python interpreter was started with the :option:`-S` flag." msgstr "" -#: ../../library/site.rst:226 +#: ../../library/site.rst:234 msgid "This function used to be called unconditionally." msgstr "" -#: ../../library/site.rst:232 +#: ../../library/site.rst:240 msgid "" "Add a directory to sys.path and process its :file:`.pth` files. Typically " "used in :mod:`sitecustomize` or :mod:`usercustomize` (see above)." msgstr "" -#: ../../library/site.rst:238 +#: ../../library/site.rst:246 msgid "Return a list containing all global site-packages directories." msgstr "" -#: ../../library/site.rst:245 +#: ../../library/site.rst:253 msgid "" "Return the path of the user base directory, :data:`USER_BASE`. If it is not " -"initialized yet, this function will also set it, respecting :envvar:" -"`PYTHONUSERBASE`." +"initialized yet, this function will also set it, " +"respecting :envvar:`PYTHONUSERBASE`." msgstr "" -#: ../../library/site.rst:254 +#: ../../library/site.rst:262 msgid "" -"Return the path of the user-specific site-packages directory, :data:" -"`USER_SITE`. If it is not initialized yet, this function will also set it, " -"respecting :data:`USER_BASE`. To determine if the user-specific site-" -"packages was added to ``sys.path`` :data:`ENABLE_USER_SITE` should be used." +"Return the path of the user-specific site-packages " +"directory, :data:`USER_SITE`. If it is not initialized yet, this function " +"will also set it, respecting :data:`USER_BASE`. To determine if the user-" +"specific site-packages was added to ``sys.path`` :data:`ENABLE_USER_SITE` " +"should be used." msgstr "" -#: ../../library/site.rst:266 +#: ../../library/site.rst:274 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/site.rst:270 +#: ../../library/site.rst:278 msgid "" "The :mod:`site` module also provides a way to get the user directories from " "the command line:" msgstr "" -#: ../../library/site.rst:273 +#: ../../library/site.rst:281 msgid "" "$ python -m site --user-site\n" "/home/user/.local/lib/python3.11/site-packages" @@ -324,29 +336,29 @@ msgstr "" "$ python -m site --user-site\n" "/home/user/.local/lib/python3.11/site-packages" -#: ../../library/site.rst:278 +#: ../../library/site.rst:286 msgid "" -"If it is called without arguments, it will print the contents of :data:`sys." -"path` on the standard output, followed by the value of :data:`USER_BASE` and " -"whether the directory exists, then the same thing for :data:`USER_SITE`, and " -"finally the value of :data:`ENABLE_USER_SITE`." +"If it is called without arguments, it will print the contents " +"of :data:`sys.path` on the standard output, followed by the value " +"of :data:`USER_BASE` and whether the directory exists, then the same thing " +"for :data:`USER_SITE`, and finally the value of :data:`ENABLE_USER_SITE`." msgstr "" -#: ../../library/site.rst:285 +#: ../../library/site.rst:293 msgid "Print the path to the user base directory." msgstr "" -#: ../../library/site.rst:289 +#: ../../library/site.rst:297 msgid "Print the path to the user site-packages directory." msgstr "" -#: ../../library/site.rst:291 +#: ../../library/site.rst:299 msgid "" "If both options are given, user base and user site will be printed (always " "in this order), separated by :data:`os.pathsep`." msgstr "" -#: ../../library/site.rst:294 +#: ../../library/site.rst:302 msgid "" "If any option is given, the script will exit with one of these values: ``0`` " "if the user site-packages directory is enabled, ``1`` if it was disabled by " @@ -354,11 +366,11 @@ msgid "" "administrator, and a value greater than 2 if there is an error." msgstr "" -#: ../../library/site.rst:301 +#: ../../library/site.rst:309 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" -#: ../../library/site.rst:302 +#: ../../library/site.rst:310 msgid ":ref:`sys-path-init` -- The initialization of :data:`sys.path`." msgstr "" @@ -370,7 +382,7 @@ msgstr "module(模組)" msgid "search" msgstr "search(搜尋)" -#: ../../library/site.rst:16 ../../library/site.rst:90 +#: ../../library/site.rst:16 ../../library/site.rst:98 msgid "path" msgstr "path(路徑)" @@ -382,30 +394,30 @@ msgstr "site-packages" msgid "directory" msgstr "directory(目錄)" -#: ../../library/site.rst:61 +#: ../../library/site.rst:69 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/site.rst:61 +#: ../../library/site.rst:69 msgid "comment" msgstr "comment(註解)" -#: ../../library/site.rst:61 +#: ../../library/site.rst:69 msgid "statement" msgstr "statement(陳述式)" -#: ../../library/site.rst:61 +#: ../../library/site.rst:69 msgid "import" msgstr "import(引入)" -#: ../../library/site.rst:90 +#: ../../library/site.rst:98 msgid "package" msgstr "package(套件)" -#: ../../library/site.rst:90 +#: ../../library/site.rst:98 msgid "configuration" msgstr "configuration(設定)" -#: ../../library/site.rst:90 +#: ../../library/site.rst:98 msgid "file" msgstr "file(檔案)" diff --git a/library/socket.po b/library/socket.po index c99925f319b..d570420e8ae 100644 --- a/library/socket.po +++ b/library/socket.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-09-08 15:25+0800\n" "PO-Revision-Date: 2024-12-30 23:45+0800\n" "Last-Translator: Jay \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,35 +41,38 @@ msgid "" "operating system socket APIs." msgstr "由於是呼叫作業系統的 socket API,某些行為可能會因平台而有所差異。" -#: ../../library/socket.rst:176 ../../library/socket.rst:186 -#: ../../library/socket.rst:214 ../../library/socket.rst:221 -#: ../../library/socket.rst:238 ../../library/socket.rst:388 -#: ../../library/socket.rst:466 ../../library/socket.rst:483 -#: ../../library/socket.rst:498 ../../library/socket.rst:509 -#: ../../library/socket.rst:518 ../../library/socket.rst:527 -#: ../../library/socket.rst:538 ../../library/socket.rst:550 -#: ../../library/socket.rst:561 ../../library/socket.rst:574 -#: ../../library/socket.rst:602 ../../library/socket.rst:614 -#: ../../library/socket.rst:620 ../../library/socket.rst:650 -#: ../../library/socket.rst:665 ../../library/socket.rst:674 -#: ../../library/socket.rst:691 ../../library/socket.rst:706 -#: ../../library/socket.rst:716 ../../library/socket.rst:905 -#: ../../library/socket.rst:1030 ../../library/socket.rst:1046 -#: ../../library/socket.rst:1059 ../../library/socket.rst:1074 -#: ../../library/socket.rst:1091 ../../library/socket.rst:1102 -#: ../../library/socket.rst:1113 ../../library/socket.rst:1124 -#: ../../library/socket.rst:1213 ../../library/socket.rst:1233 -#: ../../library/socket.rst:1259 ../../library/socket.rst:1282 -#: ../../library/socket.rst:1311 ../../library/socket.rst:1322 -#: ../../library/socket.rst:1349 ../../library/socket.rst:1366 -#: ../../library/socket.rst:1383 ../../library/socket.rst:1397 -#: ../../library/socket.rst:1448 ../../library/socket.rst:1495 -#: ../../library/socket.rst:1509 ../../library/socket.rst:1529 -#: ../../library/socket.rst:1576 ../../library/socket.rst:1621 -#: ../../library/socket.rst:1746 ../../library/socket.rst:1790 -#: ../../library/socket.rst:1898 ../../library/socket.rst:1916 -#: ../../library/socket.rst:2000 ../../library/socket.rst:2010 -#: ../../library/socket.rst:2022 ../../includes/wasm-notavail.rst:3 +#: ../../library/socket.rst:196 ../../library/socket.rst:206 +#: ../../library/socket.rst:234 ../../library/socket.rst:241 +#: ../../library/socket.rst:258 ../../library/socket.rst:408 +#: ../../library/socket.rst:494 ../../library/socket.rst:511 +#: ../../library/socket.rst:526 ../../library/socket.rst:537 +#: ../../library/socket.rst:546 ../../library/socket.rst:555 +#: ../../library/socket.rst:566 ../../library/socket.rst:578 +#: ../../library/socket.rst:589 ../../library/socket.rst:602 +#: ../../library/socket.rst:630 ../../library/socket.rst:642 +#: ../../library/socket.rst:648 ../../library/socket.rst:680 +#: ../../library/socket.rst:733 ../../library/socket.rst:745 +#: ../../library/socket.rst:754 ../../library/socket.rst:769 +#: ../../library/socket.rst:778 ../../library/socket.rst:786 +#: ../../library/socket.rst:803 ../../library/socket.rst:818 +#: ../../library/socket.rst:828 ../../library/socket.rst:1017 +#: ../../library/socket.rst:1142 ../../library/socket.rst:1158 +#: ../../library/socket.rst:1171 ../../library/socket.rst:1186 +#: ../../library/socket.rst:1203 ../../library/socket.rst:1214 +#: ../../library/socket.rst:1225 ../../library/socket.rst:1236 +#: ../../library/socket.rst:1325 ../../library/socket.rst:1345 +#: ../../library/socket.rst:1371 ../../library/socket.rst:1394 +#: ../../library/socket.rst:1423 ../../library/socket.rst:1434 +#: ../../library/socket.rst:1461 ../../library/socket.rst:1478 +#: ../../library/socket.rst:1495 ../../library/socket.rst:1509 +#: ../../library/socket.rst:1560 ../../library/socket.rst:1607 +#: ../../library/socket.rst:1621 ../../library/socket.rst:1641 +#: ../../library/socket.rst:1688 ../../library/socket.rst:1721 +#: ../../library/socket.rst:1734 ../../library/socket.rst:1859 +#: ../../library/socket.rst:1903 ../../library/socket.rst:2011 +#: ../../library/socket.rst:2029 ../../library/socket.rst:2113 +#: ../../library/socket.rst:2123 ../../library/socket.rst:2135 +#: ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "可用性" @@ -87,8 +90,8 @@ msgid "" "call and library interface for sockets to Python's object-oriented style: " "the :func:`~socket.socket` function returns a :dfn:`socket object` whose " "methods implement the various socket system calls. Parameter types are " -"somewhat higher-level than in the C interface: as with :meth:`read` and :" -"meth:`write` operations on Python files, buffer allocation on receive " +"somewhat higher-level than in the C interface: as with :meth:`read` " +"and :meth:`write` operations on Python files, buffer allocation on receive " "operations is automatic, and buffer length is implicit on send operations." msgstr "" "Python 的介面是將 Unix 的系統呼叫和 socket 函式庫介面直接轉換成 Python 的物件" @@ -147,8 +150,8 @@ msgid "" "Previously, :const:`AF_UNIX` socket paths were assumed to use UTF-8 encoding." msgstr "" -#: ../../library/socket.rst:66 ../../library/socket.rst:1196 -#: ../../library/socket.rst:1238 ../../library/socket.rst:1994 +#: ../../library/socket.rst:66 ../../library/socket.rst:1308 +#: ../../library/socket.rst:1350 ../../library/socket.rst:2107 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" @@ -164,10 +167,10 @@ msgstr "" msgid "" "For IPv4 addresses, two special forms are accepted instead of a host " "address: ``''`` represents :const:`INADDR_ANY`, which is used to bind to all " -"interfaces, and the string ``''`` represents :const:" -"`INADDR_BROADCAST`. This behavior is not compatible with IPv6, therefore, " -"you may want to avoid these if you intend to support IPv6 with your Python " -"programs." +"interfaces, and the string ``''`` " +"represents :const:`INADDR_BROADCAST`. This behavior is not compatible with " +"IPv6, therefore, you may want to avoid these if you intend to support IPv6 " +"with your Python programs." msgstr "" #: ../../library/socket.rst:83 @@ -270,143 +273,175 @@ msgstr "" #: ../../library/socket.rst:140 msgid "" -":const:`BTPROTO_L2CAP` accepts ``(bdaddr, psm)`` where ``bdaddr`` is the " -"Bluetooth address as a string and ``psm`` is an integer." +":const:`BTPROTO_L2CAP` accepts a tuple ``(bdaddr, psm[, cid[, " +"bdaddr_type]])`` where:" msgstr "" #: ../../library/socket.rst:143 +msgid "``bdaddr`` is a string specifying the Bluetooth address." +msgstr "" + +#: ../../library/socket.rst:144 +msgid "``psm`` is an integer specifying the Protocol/Service Multiplexer." +msgstr "" + +#: ../../library/socket.rst:145 +msgid "" +"``cid`` is an optional integer specifying the Channel Identifier. If not " +"given, defaults to zero." +msgstr "" + +#: ../../library/socket.rst:147 +msgid "" +"``bdaddr_type`` is an optional integer specifying the address type; one " +"of :const:`BDADDR_BREDR` " +"(default), :const:`BDADDR_LE_PUBLIC`, :const:`BDADDR_LE_RANDOM`." +msgstr "" + +#: ../../library/socket.rst:151 +msgid "Added ``cid`` and ``bdaddr_type`` fields." +msgstr "" + +#: ../../library/socket.rst:154 msgid "" ":const:`BTPROTO_RFCOMM` accepts ``(bdaddr, channel)`` where ``bdaddr`` is " "the Bluetooth address as a string and ``channel`` is an integer." msgstr "" -#: ../../library/socket.rst:146 +#: ../../library/socket.rst:157 msgid ":const:`BTPROTO_HCI` accepts a format that depends on your OS." msgstr "" -#: ../../library/socket.rst:148 +#: ../../library/socket.rst:159 msgid "" -"On Linux it accepts a tuple ``(device_id,)`` where ``device_id`` is an " -"integer specifying the number of the Bluetooth device." +"On Linux it accepts an integer ``device_id`` or a tuple ``(device_id, " +"[channel])`` where ``device_id`` specifies the number of the Bluetooth " +"device, and ``channel`` is an optional integer specifying the HCI channel " +"(:const:`HCI_CHANNEL_RAW` by default)." msgstr "" -#: ../../library/socket.rst:150 +#: ../../library/socket.rst:164 msgid "" "On FreeBSD, NetBSD and DragonFly BSD it accepts ``bdaddr`` where ``bdaddr`` " "is the Bluetooth address as a string." msgstr "" -#: ../../library/socket.rst:153 +#: ../../library/socket.rst:167 msgid "NetBSD and DragonFlyBSD support added." msgstr "加入對 NetBSD 和 DragonFlyBSD 的支援。" -#: ../../library/socket.rst:156 +#: ../../library/socket.rst:170 ../../library/socket.rst:181 msgid "FreeBSD support added." msgstr "新增對 FreeBSD 的支援。" -#: ../../library/socket.rst:159 +#: ../../library/socket.rst:173 +msgid "" +"Added ``channel`` field. ``device_id`` not packed in a tuple is now accepted." +msgstr "" + +#: ../../library/socket.rst:177 msgid "" ":const:`BTPROTO_SCO` accepts ``bdaddr`` where ``bdaddr`` is the Bluetooth " "address as a string or a :class:`bytes` object. (ex. ``'12:23:34:45:56:67'`` " -"or ``b'12:23:34:45:56:67'``) This protocol is not supported under FreeBSD." +"or ``b'12:23:34:45:56:67'``)" msgstr "" -#: ../../library/socket.rst:164 +#: ../../library/socket.rst:184 msgid "" ":const:`AF_ALG` is a Linux-only socket based interface to Kernel " "cryptography. An algorithm socket is configured with a tuple of two to four " "elements ``(type, name [, feat [, mask]])``, where:" msgstr "" -#: ../../library/socket.rst:168 +#: ../../library/socket.rst:188 msgid "" "*type* is the algorithm type as string, e.g. ``aead``, ``hash``, " "``skcipher`` or ``rng``." msgstr "" -#: ../../library/socket.rst:171 +#: ../../library/socket.rst:191 msgid "" "*name* is the algorithm name and operation mode as string, e.g. ``sha256``, " "``hmac(sha256)``, ``cbc(aes)`` or ``drbg_nopr_ctr_aes256``." msgstr "" -#: ../../library/socket.rst:174 +#: ../../library/socket.rst:194 msgid "*feat* and *mask* are unsigned 32bit integers." msgstr "" -#: ../../library/socket.rst:178 +#: ../../library/socket.rst:198 msgid "Some algorithm types require more recent Kernels." msgstr "" -#: ../../library/socket.rst:182 +#: ../../library/socket.rst:202 msgid "" ":const:`AF_VSOCK` allows communication between virtual machines and their " "hosts. The sockets are represented as a ``(CID, port)`` tuple where the " "context ID or CID and port are integers." msgstr "" -#: ../../library/socket.rst:188 +#: ../../library/socket.rst:208 msgid "See :manpage:`vsock(7)`" msgstr "請見 :manpage:`vsock(7)`" -#: ../../library/socket.rst:192 +#: ../../library/socket.rst:212 msgid "" ":const:`AF_PACKET` is a low-level interface directly to network devices. The " "addresses are represented by the tuple ``(ifname, proto[, pkttype[, hatype[, " "addr]]])`` where:" msgstr "" -#: ../../library/socket.rst:196 +#: ../../library/socket.rst:216 msgid "*ifname* - String specifying the device name." msgstr "" -#: ../../library/socket.rst:197 +#: ../../library/socket.rst:217 msgid "" "*proto* - The Ethernet protocol number. May be :data:`ETH_P_ALL` to capture " "all protocols, one of the :ref:`ETHERTYPE_* constants ` or any other Ethernet protocol number." msgstr "" -#: ../../library/socket.rst:201 +#: ../../library/socket.rst:221 msgid "*pkttype* - Optional integer specifying the packet type:" msgstr "" -#: ../../library/socket.rst:203 +#: ../../library/socket.rst:223 msgid "``PACKET_HOST`` (the default) - Packet addressed to the local host." msgstr "" -#: ../../library/socket.rst:204 +#: ../../library/socket.rst:224 msgid "``PACKET_BROADCAST`` - Physical-layer broadcast packet." msgstr "" -#: ../../library/socket.rst:205 +#: ../../library/socket.rst:225 msgid "" "``PACKET_MULTICAST`` - Packet sent to a physical-layer multicast address." msgstr "" -#: ../../library/socket.rst:206 +#: ../../library/socket.rst:226 msgid "" "``PACKET_OTHERHOST`` - Packet to some other host that has been caught by a " "device driver in promiscuous mode." msgstr "" -#: ../../library/socket.rst:208 +#: ../../library/socket.rst:228 msgid "" "``PACKET_OUTGOING`` - Packet originating from the local host that is looped " "back to a packet socket." msgstr "" -#: ../../library/socket.rst:210 +#: ../../library/socket.rst:230 msgid "*hatype* - Optional integer specifying the ARP hardware address type." msgstr "" -#: ../../library/socket.rst:211 +#: ../../library/socket.rst:231 msgid "" "*addr* - Optional bytes-like object specifying the hardware physical " "address, whose interpretation depends on the device." msgstr "" -#: ../../library/socket.rst:216 +#: ../../library/socket.rst:236 msgid "" ":const:`AF_QIPCRTR` is a Linux-only socket based interface for communicating " "with services running on co-processors in Qualcomm platforms. The address " @@ -414,7 +449,7 @@ msgid "" "*port* are non-negative integers." msgstr "" -#: ../../library/socket.rst:225 +#: ../../library/socket.rst:245 msgid "" ":const:`IPPROTO_UDPLITE` is a variant of UDP which allows you to specify " "what portion of a packet is covered with the checksum. It adds two socket " @@ -425,14 +460,14 @@ msgid "" "of their data. In both cases ``length`` should be in ``range(8, 2**16, 8)``." msgstr "" -#: ../../library/socket.rst:234 +#: ../../library/socket.rst:254 msgid "" "Such a socket should be constructed with ``socket(AF_INET, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv4 or ``socket(AF_INET6, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv6." msgstr "" -#: ../../library/socket.rst:242 +#: ../../library/socket.rst:262 msgid "" ":const:`AF_HYPERV` is a Windows-only socket based interface for " "communicating with Hyper-V hosts and guests. The address family is " @@ -440,49 +475,49 @@ msgid "" "``service_id`` are UUID strings." msgstr "" -#: ../../library/socket.rst:247 +#: ../../library/socket.rst:267 msgid "" "The ``vm_id`` is the virtual machine identifier or a set of known VMID " "values if the target is not a specific virtual machine. Known VMID constants " "defined on ``socket`` are:" msgstr "" -#: ../../library/socket.rst:251 +#: ../../library/socket.rst:271 msgid "``HV_GUID_ZERO``" msgstr "``HV_GUID_ZERO``" -#: ../../library/socket.rst:252 +#: ../../library/socket.rst:272 msgid "``HV_GUID_BROADCAST``" msgstr "``HV_GUID_BROADCAST``" -#: ../../library/socket.rst:253 +#: ../../library/socket.rst:273 msgid "" "``HV_GUID_WILDCARD`` - Used to bind on itself and accept connections from " "all partitions." msgstr "" -#: ../../library/socket.rst:255 +#: ../../library/socket.rst:275 msgid "" "``HV_GUID_CHILDREN`` - Used to bind on itself and accept connection from " "child partitions." msgstr "" -#: ../../library/socket.rst:257 +#: ../../library/socket.rst:277 msgid "``HV_GUID_LOOPBACK`` - Used as a target to itself." msgstr "" -#: ../../library/socket.rst:258 +#: ../../library/socket.rst:278 msgid "" "``HV_GUID_PARENT`` - When used as a bind accepts connection from the parent " "partition. When used as an address target it will connect to the parent " "partition." msgstr "" -#: ../../library/socket.rst:261 +#: ../../library/socket.rst:281 msgid "The ``service_id`` is the service identifier of the registered service." msgstr "" -#: ../../library/socket.rst:265 +#: ../../library/socket.rst:285 msgid "" "If you use a hostname in the *host* portion of IPv4/v6 socket address, the " "program may show a nondeterministic behavior, as Python uses the first " @@ -492,56 +527,57 @@ msgid "" "deterministic behavior use a numeric address in *host* portion." msgstr "" -#: ../../library/socket.rst:272 +#: ../../library/socket.rst:292 msgid "" "All errors raise exceptions. The normal exceptions for invalid argument " "types and out-of-memory conditions can be raised. Errors related to socket " "or address semantics raise :exc:`OSError` or one of its subclasses." msgstr "" -#: ../../library/socket.rst:277 +#: ../../library/socket.rst:297 msgid "" "Non-blocking mode is supported through :meth:`~socket.setblocking`. A " -"generalization of this based on timeouts is supported through :meth:`~socket." -"settimeout`." +"generalization of this based on timeouts is supported " +"through :meth:`~socket.settimeout`." msgstr "" -#: ../../library/socket.rst:283 +#: ../../library/socket.rst:303 msgid "Module contents" msgstr "模組內容" -#: ../../library/socket.rst:285 +#: ../../library/socket.rst:305 msgid "The module :mod:`socket` exports the following elements." msgstr "" -#: ../../library/socket.rst:289 +#: ../../library/socket.rst:309 msgid "Exceptions" msgstr "例外" -#: ../../library/socket.rst:293 +#: ../../library/socket.rst:313 msgid "A deprecated alias of :exc:`OSError`." msgstr "一個已棄用的 :exc:`OSError` 的別名。" -#: ../../library/socket.rst:295 +#: ../../library/socket.rst:315 msgid "Following :pep:`3151`, this class was made an alias of :exc:`OSError`." msgstr "" -#: ../../library/socket.rst:301 +#: ../../library/socket.rst:321 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " -"errors, i.e. for functions that use *h_errno* in the POSIX C API, including :" -"func:`gethostbyname_ex` and :func:`gethostbyaddr`. The accompanying value is " -"a pair ``(h_errno, string)`` representing an error returned by a library " -"call. *h_errno* is a numeric value, while *string* represents the " -"description of *h_errno*, as returned by the :c:func:`hstrerror` C function." +"errors, i.e. for functions that use *h_errno* in the POSIX C API, " +"including :func:`gethostbyname_ex` and :func:`gethostbyaddr`. The " +"accompanying value is a pair ``(h_errno, string)`` representing an error " +"returned by a library call. *h_errno* is a numeric value, while *string* " +"represents the description of *h_errno*, as returned by " +"the :c:func:`hstrerror` C function." msgstr "" -#: ../../library/socket.rst:309 ../../library/socket.rst:322 -#: ../../library/socket.rst:335 +#: ../../library/socket.rst:329 ../../library/socket.rst:342 +#: ../../library/socket.rst:355 msgid "This class was made a subclass of :exc:`OSError`." msgstr "" -#: ../../library/socket.rst:314 +#: ../../library/socket.rst:334 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " "errors by :func:`getaddrinfo` and :func:`getnameinfo`. The accompanying " @@ -551,34 +587,34 @@ msgid "" "match one of the :const:`!EAI_\\*` constants defined in this module." msgstr "" -#: ../../library/socket.rst:327 +#: ../../library/socket.rst:347 msgid "A deprecated alias of :exc:`TimeoutError`." msgstr "" -#: ../../library/socket.rst:329 +#: ../../library/socket.rst:349 msgid "" "A subclass of :exc:`OSError`, this exception is raised when a timeout occurs " -"on a socket which has had timeouts enabled via a prior call to :meth:" -"`~socket.settimeout` (or implicitly through :func:`~socket." -"setdefaulttimeout`). The accompanying value is a string whose value is " -"currently always \"timed out\"." +"on a socket which has had timeouts enabled via a prior call " +"to :meth:`~socket.settimeout` (or implicitly " +"through :func:`~socket.setdefaulttimeout`). The accompanying value is a " +"string whose value is currently always \"timed out\"." msgstr "" -#: ../../library/socket.rst:338 +#: ../../library/socket.rst:358 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "" -#: ../../library/socket.rst:343 +#: ../../library/socket.rst:363 msgid "Constants" msgstr "常數" -#: ../../library/socket.rst:345 +#: ../../library/socket.rst:365 msgid "" -"The AF_* and SOCK_* constants are now :class:`AddressFamily` and :class:" -"`SocketKind` :class:`.IntEnum` collections." +"The AF_* and SOCK_* constants are now :class:`AddressFamily` " +"and :class:`SocketKind` :class:`.IntEnum` collections." msgstr "" -#: ../../library/socket.rst:354 +#: ../../library/socket.rst:374 msgid "" "These constants represent the address (and protocol) families, used for the " "first argument to :func:`~socket.socket`. If the :const:`AF_UNIX` constant " @@ -586,79 +622,79 @@ msgid "" "available depending on the system." msgstr "" -#: ../../library/socket.rst:361 +#: ../../library/socket.rst:381 msgid "" ":const:`AF_UNSPEC` means that :func:`getaddrinfo` should return socket " "addresses for any address family (either IPv4, IPv6, or any other) that can " "be used." msgstr "" -#: ../../library/socket.rst:371 +#: ../../library/socket.rst:391 msgid "" -"These constants represent the socket types, used for the second argument to :" -"func:`~socket.socket`. More constants may be available depending on the " +"These constants represent the socket types, used for the second argument " +"to :func:`~socket.socket`. More constants may be available depending on the " "system. (Only :const:`SOCK_STREAM` and :const:`SOCK_DGRAM` appear to be " "generally useful.)" msgstr "" -#: ../../library/socket.rst:379 +#: ../../library/socket.rst:399 msgid "" "These two constants, if defined, can be combined with the socket types and " "allow you to set some flags atomically (thus avoiding possible race " "conditions and the need for separate calls)." msgstr "" -#: ../../library/socket.rst:385 +#: ../../library/socket.rst:405 msgid "" -"`Secure File Descriptor Handling `_ for a more thorough explanation." +"`Secure File Descriptor Handling `_ for a more thorough explanation." msgstr "" -#: ../../library/socket.rst:409 +#: ../../library/socket.rst:429 msgid "" "Many constants of these forms, documented in the Unix documentation on " "sockets and/or the IP protocol, are also defined in the socket module. They " -"are generally used in arguments to the :meth:`~socket.setsockopt` and :meth:" -"`~socket.getsockopt` methods of socket objects. In most cases, only those " -"symbols that are defined in the Unix header files are defined; for a few " -"symbols, default values are provided." +"are generally used in arguments to the :meth:`~socket.setsockopt` " +"and :meth:`~socket.getsockopt` methods of socket objects. In most cases, " +"only those symbols that are defined in the Unix header files are defined; " +"for a few symbols, default values are provided." msgstr "" -#: ../../library/socket.rst:416 +#: ../../library/socket.rst:436 msgid "" "``SO_DOMAIN``, ``SO_PROTOCOL``, ``SO_PEERSEC``, ``SO_PASSSEC``, " "``TCP_USER_TIMEOUT``, ``TCP_CONGESTION`` were added." msgstr "" -#: ../../library/socket.rst:420 +#: ../../library/socket.rst:440 msgid "" -"On Windows, ``TCP_FASTOPEN``, ``TCP_KEEPCNT`` appear if run-time Windows " -"supports." +"Added support for ``TCP_FASTOPEN``, ``TCP_KEEPCNT`` on Windows platforms " +"when available." msgstr "" -#: ../../library/socket.rst:424 +#: ../../library/socket.rst:444 msgid "``TCP_NOTSENT_LOWAT`` was added." msgstr "新增 ``TCP_NOTSENT_LOWAT``。" -#: ../../library/socket.rst:427 +#: ../../library/socket.rst:447 msgid "" -"On Windows, ``TCP_KEEPIDLE``, ``TCP_KEEPINTVL`` appear if run-time Windows " -"supports." +"Added support for ``TCP_KEEPIDLE``, ``TCP_KEEPINTVL`` on Windows platforms " +"when available." msgstr "" -#: ../../library/socket.rst:430 +#: ../../library/socket.rst:450 msgid "" "``IP_RECVTOS`` was added. Added ``TCP_KEEPALIVE``. On MacOS this constant " "can be used in the same way that ``TCP_KEEPIDLE`` is used on Linux." msgstr "" -#: ../../library/socket.rst:435 +#: ../../library/socket.rst:455 msgid "" "Added ``TCP_CONNECTION_INFO``. On MacOS this constant can be used in the " "same way that ``TCP_INFO`` is used on Linux and BSD." msgstr "" -#: ../../library/socket.rst:439 +#: ../../library/socket.rst:459 msgid "" "Added ``SO_RTABLE`` and ``SO_USER_COOKIE``. On OpenBSD and FreeBSD " "respectively those constants can be used in the same way that ``SO_MARK`` is " @@ -674,137 +710,199 @@ msgid "" "``IP_DROP_SOURCE_MEMBERSHIP``." msgstr "" -#: ../../library/socket.rst:453 +#: ../../library/socket.rst:473 msgid "" "Added ``SO_BINDTOIFINDEX``. On Linux this constant can be used in the same " "way that ``SO_BINDTODEVICE`` is used, but with the index of a network " "interface instead of its name." msgstr "" -#: ../../library/socket.rst:463 ../../library/socket.rst:547 -#: ../../library/socket.rst:571 +#: ../../library/socket.rst:478 +msgid "" +"Added missing ``IP_FREEBIND``, ``IP_RECVERR``, ``IPV6_RECVERR``, " +"``IP_RECVTTL``, and ``IP_RECVORIGDSTADDR`` on Linux." +msgstr "" + +#: ../../library/socket.rst:482 +msgid "Added support for ``TCP_QUICKACK`` on Windows platforms when available." +msgstr "" + +#: ../../library/socket.rst:491 ../../library/socket.rst:575 +#: ../../library/socket.rst:599 msgid "" "Many constants of these forms, documented in the Linux documentation, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:470 +#: ../../library/socket.rst:498 msgid "NetBSD support was added." msgstr "" -#: ../../library/socket.rst:473 +#: ../../library/socket.rst:501 msgid "Restored missing ``CAN_RAW_ERR_FILTER`` on Linux." msgstr "" -#: ../../library/socket.rst:479 +#: ../../library/socket.rst:507 msgid "" "CAN_BCM, in the CAN protocol family, is the broadcast manager (BCM) " "protocol. Broadcast manager constants, documented in the Linux " "documentation, are also defined in the socket module." msgstr "" -#: ../../library/socket.rst:486 +#: ../../library/socket.rst:514 msgid "" "The :data:`CAN_BCM_CAN_FD_FRAME` flag is only available on Linux >= 4.8." msgstr "" -#: ../../library/socket.rst:492 +#: ../../library/socket.rst:520 msgid "" "Enables CAN FD support in a CAN_RAW socket. This is disabled by default. " "This allows your application to send both CAN and CAN FD frames; however, " "you must accept both CAN and CAN FD frames when reading from the socket." msgstr "" -#: ../../library/socket.rst:496 ../../library/socket.rst:507 +#: ../../library/socket.rst:524 ../../library/socket.rst:535 msgid "This constant is documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:504 +#: ../../library/socket.rst:532 msgid "" "Joins the applied CAN filters such that only CAN frames that match all given " "CAN filters are passed to user space." msgstr "" -#: ../../library/socket.rst:515 +#: ../../library/socket.rst:543 msgid "" "CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol. " "ISO-TP constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:524 +#: ../../library/socket.rst:552 msgid "" "CAN_J1939, in the CAN protocol family, is the SAE J1939 protocol. J1939 " "constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:535 +#: ../../library/socket.rst:563 msgid "" "These two constants, documented in the FreeBSD divert(4) manual page, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:555 +#: ../../library/socket.rst:583 msgid "" ":data:`!ETH_P_ALL` can be used in the :class:`~socket.socket` constructor as " "*proto* for the :const:`AF_PACKET` family in order to capture every packet, " "regardless of protocol." msgstr "" -#: ../../library/socket.rst:559 +#: ../../library/socket.rst:587 msgid "For more information, see the :manpage:`packet(7)` manpage." msgstr "" -#: ../../library/socket.rst:584 +#: ../../library/socket.rst:612 msgid "" "Constants for Windows' WSAIoctl(). The constants are used as arguments to " "the :meth:`~socket.socket.ioctl` method of socket objects." msgstr "" -#: ../../library/socket.rst:587 ../../library/socket.rst:1611 +#: ../../library/socket.rst:615 ../../library/socket.rst:1723 msgid "``SIO_LOOPBACK_FAST_PATH`` was added." msgstr "加入 ``SIO_LOOPBACK_FAST_PATH``。" -#: ../../library/socket.rst:593 +#: ../../library/socket.rst:621 msgid "" "TIPC related constants, matching the ones exported by the C socket API. See " "the TIPC documentation for more information." msgstr "" -#: ../../library/socket.rst:600 +#: ../../library/socket.rst:628 msgid "Constants for Linux Kernel cryptography." msgstr "" -#: ../../library/socket.rst:612 +#: ../../library/socket.rst:640 msgid "Constants for Linux host/guest communication." msgstr "" -#: ../../library/socket.rst:626 +#: ../../library/socket.rst:654 msgid "" "This constant contains a boolean value which indicates if IPv6 is supported " "on this platform." msgstr "" -#: ../../library/socket.rst:632 +#: ../../library/socket.rst:663 +msgid "Integer constants for use with Bluetooth addresses." +msgstr "" + +#: ../../library/socket.rst:668 msgid "" "These are string constants containing Bluetooth addresses with special " "meanings. For example, :const:`BDADDR_ANY` can be used to indicate any " "address when specifying the binding socket with :const:`BTPROTO_RFCOMM`." msgstr "" -#: ../../library/socket.rst:641 +#: ../../library/socket.rst:677 +msgid "" +"These constants describe the Bluetooth address type when binding or " +"connecting a :const:`BTPROTO_L2CAP` socket." +msgstr "" + +#: ../../library/socket.rst:690 +msgid "" +"Used in the level argument to the :meth:`~socket.setsockopt` " +"and :meth:`~socket.getsockopt` methods of Bluetooth socket objects." +msgstr "" + +#: ../../library/socket.rst:693 +msgid "" +":const:`SOL_BLUETOOTH` is only available on Linux. Other constants are " +"available if the corresponding protocol is supported." +msgstr "" + +#: ../../library/socket.rst:705 +msgid "" +"Used in the option name and value argument to the :meth:`~socket.setsockopt` " +"and :meth:`~socket.getsockopt` methods of Bluetooth socket objects." +msgstr "" + +#: ../../library/socket.rst:708 +msgid "" +":const:`!BT_*` and :const:`L2CAP_LM` are only available on Linux. :const:`!" +"SO_BTH_*` are only available on Windows. Other constants may be available on " +"Linux and various BSD platforms." +msgstr "" + +#: ../../library/socket.rst:720 +msgid "" +"Option names for use with :const:`BTPROTO_HCI`. Availability and format of " +"the option values depend on platform." +msgstr "" + +#: ../../library/socket.rst:723 +msgid "" +"Added :const:`!SO_HCI_EVT_FILTER` and :const:`!SO_HCI_PKT_FILTER` on NetBSD " +"and DragonFly BSD. Added :const:`!HCI_DATA_DIR` on FreeBSD, NetBSD and " +"DragonFly BSD." +msgstr "" + +#: ../../library/socket.rst:730 +msgid "" +"The ``device_id`` value used to create an HCI socket that isn't specific to " +"a single Bluetooth adapter." +msgstr "" + +#: ../../library/socket.rst:743 msgid "" -"For use with :const:`BTPROTO_HCI`. :const:`!HCI_FILTER` is only available on " -"Linux and FreeBSD. :const:`!HCI_TIME_STAMP` and :const:`!HCI_DATA_DIR` are " -"only available on Linux." +"Possible values for ``channel`` field in the :const:`BTPROTO_HCI` address." msgstr "" -#: ../../library/socket.rst:647 +#: ../../library/socket.rst:751 msgid "" "Constant for Qualcomm's IPC router protocol, used to communicate with " "service providing remote processors." msgstr "" -#: ../../library/socket.rst:656 +#: ../../library/socket.rst:760 msgid "" "LOCAL_CREDS and LOCAL_CREDS_PERSISTENT can be used with SOCK_DGRAM, " "SOCK_STREAM sockets, equivalent to Linux/DragonFlyBSD SO_PASSCRED, while " @@ -813,71 +911,76 @@ msgid "" "message type." msgstr "" -#: ../../library/socket.rst:669 +#: ../../library/socket.rst:773 +msgid "" +"Constant to optimize CPU locality, to be used in conjunction " +"with :data:`SO_REUSEPORT`." +msgstr "" + +#: ../../library/socket.rst:782 msgid "" -"Constant to optimize CPU locality, to be used in conjunction with :data:" -"`SO_REUSEPORT`." +"Constant to enable duplicate address and port bindings with load balancing." msgstr "" -#: ../../library/socket.rst:689 +#: ../../library/socket.rst:801 msgid "Constants for Windows Hyper-V sockets for host/guest communications." msgstr "" -#: ../../library/socket.rst:702 +#: ../../library/socket.rst:814 msgid "" "`IEEE 802.3 protocol number `_. constants." msgstr "" -#: ../../library/socket.rst:714 +#: ../../library/socket.rst:826 msgid "" "These constants are used by the :meth:`~socket.socket.shutdown` method of " "socket objects." msgstr "" -#: ../../library/socket.rst:719 +#: ../../library/socket.rst:831 msgid "Functions" msgstr "函式" -#: ../../library/socket.rst:722 +#: ../../library/socket.rst:834 msgid "Creating sockets" msgstr "建立 sockets" -#: ../../library/socket.rst:724 +#: ../../library/socket.rst:836 msgid "" "The following functions all create :ref:`socket objects `." msgstr "" -#: ../../library/socket.rst:729 +#: ../../library/socket.rst:841 msgid "" "Create a new socket using the given address family, socket type and protocol " -"number. The address family should be :const:`AF_INET` (the default), :const:" -"`AF_INET6`, :const:`AF_UNIX`, :const:`AF_CAN`, :const:`AF_PACKET`, or :const:" -"`AF_RDS`. The socket type should be :const:`SOCK_STREAM` (the default), :" -"const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other ``SOCK_`` " -"constants. The protocol number is usually zero and may be omitted or in the " -"case where the address family is :const:`AF_CAN` the protocol should be one " -"of :const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP` or :const:" -"`CAN_J1939`." +"number. The address family should be :const:`AF_INET` (the " +"default), :const:`AF_INET6`, :const:`AF_UNIX`, :const:`AF_CAN`, :const:`AF_PACKET`, " +"or :const:`AF_RDS`. The socket type should be :const:`SOCK_STREAM` (the " +"default), :const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other " +"``SOCK_`` constants. The protocol number is usually zero and may be omitted " +"or in the case where the address family is :const:`AF_CAN` the protocol " +"should be one of :const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP` " +"or :const:`CAN_J1939`." msgstr "" -#: ../../library/socket.rst:739 +#: ../../library/socket.rst:851 msgid "" "If *fileno* is specified, the values for *family*, *type*, and *proto* are " "auto-detected from the specified file descriptor. Auto-detection can be " "overruled by calling the function with explicit *family*, *type*, or *proto* " "arguments. This only affects how Python represents e.g. the return value " -"of :meth:`socket.getpeername` but not the actual OS resource. Unlike :func:" -"`socket.fromfd`, *fileno* will return the same socket and not a duplicate. " -"This may help close a detached socket using :meth:`socket.close`." +"of :meth:`socket.getpeername` but not the actual OS resource. " +"Unlike :func:`socket.fromfd`, *fileno* will return the same socket and not a " +"duplicate. This may help close a detached socket using :meth:`socket.close`." msgstr "" -#: ../../library/socket.rst:748 ../../library/socket.rst:894 -#: ../../library/socket.rst:1430 ../../library/socket.rst:1524 +#: ../../library/socket.rst:860 ../../library/socket.rst:1006 +#: ../../library/socket.rst:1542 ../../library/socket.rst:1636 msgid "The newly created socket is :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:750 +#: ../../library/socket.rst:862 msgid "" "Raises an :ref:`auditing event ` ``socket.__new__`` with arguments " "``self``, ``family``, ``type``, ``protocol``." @@ -885,30 +988,30 @@ msgstr "" "引發一個附帶引數 ``self``、``family``、``type``、``protocol`` 的\\ :ref:`稽核" "事件 ` ``socket.__new__``。" -#: ../../library/socket.rst:752 +#: ../../library/socket.rst:864 msgid "The AF_CAN family was added. The AF_RDS family was added." msgstr "" -#: ../../library/socket.rst:756 +#: ../../library/socket.rst:868 msgid "The CAN_BCM protocol was added." msgstr "新增 CAN_BCM 協定。" -#: ../../library/socket.rst:759 ../../library/socket.rst:896 +#: ../../library/socket.rst:871 ../../library/socket.rst:1008 msgid "The returned socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:762 +#: ../../library/socket.rst:874 msgid "The CAN_ISOTP protocol was added." msgstr "新增 CAN_ISOTP 協定。" -#: ../../library/socket.rst:765 +#: ../../library/socket.rst:877 msgid "" "When :const:`SOCK_NONBLOCK` or :const:`SOCK_CLOEXEC` bit flags are applied " "to *type* they are cleared, and :attr:`socket.type` will not reflect them. " "They are still passed to the underlying system ``socket()`` call. Therefore," msgstr "" -#: ../../library/socket.rst:773 +#: ../../library/socket.rst:885 msgid "" "sock = socket.socket(\n" " socket.AF_INET,\n" @@ -918,21 +1021,21 @@ msgstr "" " socket.AF_INET,\n" " socket.SOCK_STREAM | socket.SOCK_NONBLOCK)" -#: ../../library/socket.rst:777 +#: ../../library/socket.rst:889 msgid "" "will still create a non-blocking socket on OSes that support " "``SOCK_NONBLOCK``, but ``sock.type`` will be set to ``socket.SOCK_STREAM``." msgstr "" -#: ../../library/socket.rst:781 +#: ../../library/socket.rst:893 msgid "The CAN_J1939 protocol was added." msgstr "新增 CAN_J1939 協定。" -#: ../../library/socket.rst:784 +#: ../../library/socket.rst:896 msgid "The IPPROTO_MPTCP protocol was added." msgstr "新增 IPPROTO_MPTCP 協定。" -#: ../../library/socket.rst:789 +#: ../../library/socket.rst:901 msgid "" "Build a pair of connected socket objects using the given address family, " "socket type, and protocol number. Address family, socket type, and protocol " @@ -941,25 +1044,25 @@ msgid "" "default is :const:`AF_INET`." msgstr "" -#: ../../library/socket.rst:794 +#: ../../library/socket.rst:906 msgid "The newly created sockets are :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:796 +#: ../../library/socket.rst:908 msgid "" "The returned socket objects now support the whole socket API, rather than a " "subset." msgstr "" -#: ../../library/socket.rst:800 +#: ../../library/socket.rst:912 msgid "The returned sockets are now non-inheritable." msgstr "" -#: ../../library/socket.rst:803 +#: ../../library/socket.rst:915 msgid "Windows support added." msgstr "新增對 Windows 的支援。" -#: ../../library/socket.rst:809 +#: ../../library/socket.rst:921 msgid "" "Connect to a TCP service listening on the internet *address* (a 2-tuple " "``(host, port)``), and return the socket object. This is a higher-level " @@ -970,21 +1073,21 @@ msgid "" "IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:817 +#: ../../library/socket.rst:929 msgid "" "Passing the optional *timeout* parameter will set the timeout on the socket " "instance before attempting to connect. If no *timeout* is supplied, the " "global default timeout setting returned by :func:`getdefaulttimeout` is used." msgstr "" -#: ../../library/socket.rst:822 +#: ../../library/socket.rst:934 msgid "" "If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the " "socket to bind to as its source address before connecting. If host or port " "are '' or 0 respectively the OS default behavior will be used." msgstr "" -#: ../../library/socket.rst:826 +#: ../../library/socket.rst:938 msgid "" "When a connection cannot be created, an exception is raised. By default, it " "is the exception from the last address in the list. If *all_errors* is " @@ -992,29 +1095,29 @@ msgid "" "attempts." msgstr "" -#: ../../library/socket.rst:831 +#: ../../library/socket.rst:943 msgid "*source_address* was added." msgstr "新增 *source_address*。" -#: ../../library/socket.rst:834 +#: ../../library/socket.rst:946 msgid "*all_errors* was added." msgstr "新增 *all_errors*。" -#: ../../library/socket.rst:840 +#: ../../library/socket.rst:952 msgid "" "Convenience function which creates a TCP socket bound to *address* (a 2-" "tuple ``(host, port)``) and returns the socket object." msgstr "" -#: ../../library/socket.rst:843 +#: ../../library/socket.rst:955 msgid "" "*family* should be either :data:`AF_INET` or :data:`AF_INET6`. *backlog* is " "the queue size passed to :meth:`socket.listen`; if not specified , a default " -"reasonable value is chosen. *reuse_port* dictates whether to set the :data:" -"`SO_REUSEPORT` socket option." +"reasonable value is chosen. *reuse_port* dictates whether to set " +"the :data:`SO_REUSEPORT` socket option." msgstr "" -#: ../../library/socket.rst:848 +#: ../../library/socket.rst:960 msgid "" "If *dualstack_ipv6* is true, *family* is :data:`AF_INET6` and the platform " "supports it the socket will be able to accept both IPv4 and IPv6 " @@ -1027,7 +1130,7 @@ msgid "" "parameter can be used in conjunction with :func:`has_dualstack_ipv6`:" msgstr "" -#: ../../library/socket.rst:861 +#: ../../library/socket.rst:973 msgid "" "import socket\n" "\n" @@ -1047,65 +1150,65 @@ msgstr "" "else:\n" " s = socket.create_server(addr)" -#: ../../library/socket.rst:870 +#: ../../library/socket.rst:982 msgid "" "On POSIX platforms the :data:`SO_REUSEADDR` socket option is set in order to " "immediately reuse previous sockets which were bound on the same *address* " "and remained in TIME_WAIT state." msgstr "" -#: ../../library/socket.rst:878 +#: ../../library/socket.rst:990 msgid "" "Return ``True`` if the platform supports creating a TCP socket which can " "handle both IPv4 and IPv6 connections." msgstr "" -#: ../../library/socket.rst:885 +#: ../../library/socket.rst:997 msgid "" "Duplicate the file descriptor *fd* (an integer as returned by a file " "object's :meth:`~io.IOBase.fileno` method) and build a socket object from " -"the result. Address family, socket type and protocol number are as for the :" -"func:`~socket.socket` function above. The file descriptor should refer to a " -"socket, but this is not checked --- subsequent operations on the object may " -"fail if the file descriptor is invalid. This function is rarely needed, but " -"can be used to get or set socket options on a socket passed to a program as " -"standard input or output (such as a server started by the Unix inet " +"the result. Address family, socket type and protocol number are as for " +"the :func:`~socket.socket` function above. The file descriptor should refer " +"to a socket, but this is not checked --- subsequent operations on the object " +"may fail if the file descriptor is invalid. This function is rarely needed, " +"but can be used to get or set socket options on a socket passed to a program " +"as standard input or output (such as a server started by the Unix inet " "daemon). The socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:902 +#: ../../library/socket.rst:1014 msgid "" "Instantiate a socket from data obtained from the :meth:`socket.share` " "method. The socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:912 +#: ../../library/socket.rst:1024 msgid "" "This is a Python type object that represents the socket object type. It is " "the same as ``type(socket(...))``." msgstr "" -#: ../../library/socket.rst:917 +#: ../../library/socket.rst:1029 msgid "Other functions" msgstr "其他函式" -#: ../../library/socket.rst:919 +#: ../../library/socket.rst:1031 msgid "The :mod:`socket` module also offers various network-related services:" msgstr "" -#: ../../library/socket.rst:924 +#: ../../library/socket.rst:1036 msgid "" "Close a socket file descriptor. This is like :func:`os.close`, but for " "sockets. On some platforms (most noticeable Windows) :func:`os.close` does " "not work for socket file descriptors." msgstr "" -#: ../../library/socket.rst:932 +#: ../../library/socket.rst:1044 msgid "" "This function wraps the C function ``getaddrinfo`` of the underlying system." msgstr "" -#: ../../library/socket.rst:934 +#: ../../library/socket.rst:1046 msgid "" "Translate the *host*/*port* argument into a sequence of 5-tuples that " "contain all the necessary arguments for creating a socket connected to that " @@ -1115,7 +1218,7 @@ msgid "" "and *port*, you can pass ``NULL`` to the underlying C API." msgstr "" -#: ../../library/socket.rst:941 +#: ../../library/socket.rst:1053 msgid "" "The *family*, *type* and *proto* arguments can be optionally specified in " "order to provide options and limit the list of addresses returned. Pass " @@ -1123,35 +1226,36 @@ msgid "" "limit the results. See the note below for details." msgstr "" -#: ../../library/socket.rst:946 +#: ../../library/socket.rst:1058 msgid "" "The *flags* argument can be one or several of the ``AI_*`` constants, and " -"will influence how results are computed and returned. For example, :const:" -"`AI_NUMERICHOST` will disable domain name resolution and will raise an error " -"if *host* is a domain name." +"will influence how results are computed and returned. For " +"example, :const:`AI_NUMERICHOST` will disable domain name resolution and " +"will raise an error if *host* is a domain name." msgstr "" -#: ../../library/socket.rst:951 +#: ../../library/socket.rst:1063 msgid "The function returns a list of 5-tuples with the following structure:" msgstr "" -#: ../../library/socket.rst:953 +#: ../../library/socket.rst:1065 msgid "``(family, type, proto, canonname, sockaddr)``" msgstr "``(family, type, proto, canonname, sockaddr)``" -#: ../../library/socket.rst:955 +#: ../../library/socket.rst:1067 msgid "" "In these tuples, *family*, *type*, *proto* are all integers and are meant to " "be passed to the :func:`~socket.socket` function. *canonname* will be a " -"string representing the canonical name of the *host* if :const:" -"`AI_CANONNAME` is part of the *flags* argument; else *canonname* will be " -"empty. *sockaddr* is a tuple describing a socket address, whose format " -"depends on the returned *family* (a ``(address, port)`` 2-tuple for :const:" -"`AF_INET`, a ``(address, port, flowinfo, scope_id)`` 4-tuple for :const:" -"`AF_INET6`), and is meant to be passed to the :meth:`socket.connect` method." +"string representing the canonical name of the *host* " +"if :const:`AI_CANONNAME` is part of the *flags* argument; else *canonname* " +"will be empty. *sockaddr* is a tuple describing a socket address, whose " +"format depends on the returned *family* (a ``(address, port)`` 2-tuple " +"for :const:`AF_INET`, a ``(address, port, flowinfo, scope_id)`` 4-tuple " +"for :const:`AF_INET6`), and is meant to be passed to " +"the :meth:`socket.connect` method." msgstr "" -#: ../../library/socket.rst:967 +#: ../../library/socket.rst:1079 msgid "" "If you intend to use results from :func:`!getaddrinfo` to create a socket " "(rather than, for example, retrieve *canonname*), consider limiting the " @@ -1160,13 +1264,13 @@ msgid "" "application can handle." msgstr "" -#: ../../library/socket.rst:973 +#: ../../library/socket.rst:1085 msgid "" "The behavior with default values of *family*, *type*, *proto* and *flags* is " "system-specific." msgstr "" -#: ../../library/socket.rst:976 +#: ../../library/socket.rst:1088 msgid "" "Many systems (for example, most Linux configurations) will return a sorted " "list of all matching addresses. These addresses should generally be tried in " @@ -1176,14 +1280,14 @@ msgid "" "attempts." msgstr "" -#: ../../library/socket.rst:983 +#: ../../library/socket.rst:1095 msgid "" "Some systems will, however, only return a single address. (For example, this " "was reported on Solaris and AIX configurations.) On these systems, limiting " "the *type* and/or *proto* helps ensure that this address is usable." msgstr "" -#: ../../library/socket.rst:988 +#: ../../library/socket.rst:1100 msgid "" "Raises an :ref:`auditing event ` ``socket.getaddrinfo`` with " "arguments ``host``, ``port``, ``family``, ``type``, ``protocol``." @@ -1191,14 +1295,14 @@ msgstr "" "引發一個附帶引數 ``host``、``port``、``family``、``type``、``protocol`` 的" "\\ :ref:`稽核事件 ` ``socket.getaddrinfo``。" -#: ../../library/socket.rst:990 +#: ../../library/socket.rst:1102 msgid "" "The following example fetches address information for a hypothetical TCP " "connection to ``example.org`` on port 80 (results may differ on your system " "if IPv6 isn't enabled)::" msgstr "" -#: ../../library/socket.rst:994 +#: ../../library/socket.rst:1106 msgid "" ">>> socket.getaddrinfo(\"example.org\", 80, proto=socket.IPPROTO_TCP)\n" "[(socket.AF_INET6, socket.SOCK_STREAM,\n" @@ -1212,17 +1316,17 @@ msgstr "" " (socket.AF_INET, socket.SOCK_STREAM,\n" " 6, '', ('93.184.216.34', 80))]" -#: ../../library/socket.rst:1000 +#: ../../library/socket.rst:1112 msgid "parameters can now be passed using keyword arguments." msgstr "" -#: ../../library/socket.rst:1003 +#: ../../library/socket.rst:1115 msgid "" "for IPv6 multicast addresses, string representing an address will not " "contain ``%scope_id`` part." msgstr "" -#: ../../library/socket.rst:1011 +#: ../../library/socket.rst:1123 msgid "" "Return a fully qualified domain name for *name*. If *name* is omitted or " "empty, it is interpreted as the local host. To find the fully qualified " @@ -1233,7 +1337,7 @@ msgid "" "``'0.0.0.0'``, the hostname from :func:`gethostname` is returned." msgstr "" -#: ../../library/socket.rst:1022 +#: ../../library/socket.rst:1134 msgid "" "Translate a host name to IPv4 address format. The IPv4 address is returned " "as a string, such as ``'100.50.200.5'``. If the host name is an IPv4 " @@ -1243,15 +1347,15 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:1028 ../../library/socket.rst:1044 +#: ../../library/socket.rst:1140 ../../library/socket.rst:1156 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyname`` with " "argument ``hostname``." msgstr "" -"引發一個附帶引數 ``hostname`` 的\\ :ref:`稽核事件 ` ``socket." -"gethostbyname``。" +"引發一個附帶引數 ``hostname`` 的\\ :ref:`稽核事件 ` " +"``socket.gethostbyname``。" -#: ../../library/socket.rst:1035 +#: ../../library/socket.rst:1147 msgid "" "Translate a host name to IPv4 address format, extended interface. Return a 3-" "tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the host's " @@ -1263,45 +1367,45 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:1051 +#: ../../library/socket.rst:1163 msgid "" "Return a string containing the hostname of the machine where the Python " "interpreter is currently executing." msgstr "" -#: ../../library/socket.rst:1054 +#: ../../library/socket.rst:1166 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostname`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``socket.gethostname``。" -#: ../../library/socket.rst:1056 +#: ../../library/socket.rst:1168 msgid "" "Note: :func:`gethostname` doesn't always return the fully qualified domain " "name; use :func:`getfqdn` for that." msgstr "" -#: ../../library/socket.rst:1064 +#: ../../library/socket.rst:1176 msgid "" "Return a 3-tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is " "the primary host name responding to the given *ip_address*, *aliaslist* is a " "(possibly empty) list of alternative host names for the same address, and " "*ipaddrlist* is a list of IPv4/v6 addresses for the same interface on the " "same host (most likely containing only a single address). To find the fully " -"qualified domain name, use the function :func:`getfqdn`. :func:" -"`gethostbyaddr` supports both IPv4 and IPv6." +"qualified domain name, use the " +"function :func:`getfqdn`. :func:`gethostbyaddr` supports both IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:1072 +#: ../../library/socket.rst:1184 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyaddr`` with " "argument ``ip_address``." msgstr "" -"引發一個附帶引數 ``ip_address`` 的\\ :ref:`稽核事件 ` ``socket." -"gethostbyaddr``。" +"引發一個附帶引數 ``ip_address`` 的\\ :ref:`稽核事件 ` " +"``socket.gethostbyaddr``。" -#: ../../library/socket.rst:1079 +#: ../../library/socket.rst:1191 msgid "" "Translate a socket address *sockaddr* into a 2-tuple ``(host, port)``. " "Depending on the settings of *flags*, the result can contain a fully " @@ -1309,42 +1413,43 @@ msgid "" "Similarly, *port* can contain a string port name or a numeric port number." msgstr "" -#: ../../library/socket.rst:1084 +#: ../../library/socket.rst:1196 msgid "" "For IPv6 addresses, ``%scope_id`` is appended to the host part if *sockaddr* " "contains meaningful *scope_id*. Usually this happens for multicast addresses." msgstr "" -#: ../../library/socket.rst:1087 +#: ../../library/socket.rst:1199 msgid "" "For more information about *flags* you can consult :manpage:`getnameinfo(3)`." msgstr "" -#: ../../library/socket.rst:1089 +#: ../../library/socket.rst:1201 msgid "" "Raises an :ref:`auditing event ` ``socket.getnameinfo`` with " "argument ``sockaddr``." msgstr "" -"引發一個附帶引數 ``sockaddr`` 的\\ :ref:`稽核事件 ` ``socket." -"getnameinfo``。" +"引發一個附帶引數 ``sockaddr`` 的\\ :ref:`稽核事件 ` " +"``socket.getnameinfo``。" -#: ../../library/socket.rst:1096 +#: ../../library/socket.rst:1208 msgid "" "Translate an internet protocol name (for example, ``'icmp'``) to a constant " -"suitable for passing as the (optional) third argument to the :func:`~socket." -"socket` function. This is usually only needed for sockets opened in \"raw\" " -"mode (:const:`SOCK_RAW`); for the normal socket modes, the correct protocol " -"is chosen automatically if the protocol is omitted or zero." +"suitable for passing as the (optional) third argument to " +"the :func:`~socket.socket` function. This is usually only needed for " +"sockets opened in \"raw\" mode (:const:`SOCK_RAW`); for the normal socket " +"modes, the correct protocol is chosen automatically if the protocol is " +"omitted or zero." msgstr "" -#: ../../library/socket.rst:1107 +#: ../../library/socket.rst:1219 msgid "" "Translate an internet service name and protocol name to a port number for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1111 +#: ../../library/socket.rst:1223 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyname`` with " "arguments ``servicename``, ``protocolname``." @@ -1352,14 +1457,14 @@ msgstr "" "引發一個附帶引數 ``sockaddr``、``protocolname`` 的\\ :ref:`稽核事件 " "` ``socket.getservbyname``。" -#: ../../library/socket.rst:1118 +#: ../../library/socket.rst:1230 msgid "" "Translate an internet port number and protocol name to a service name for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1122 +#: ../../library/socket.rst:1234 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyport`` with " "arguments ``port``, ``protocolname``." @@ -1367,40 +1472,40 @@ msgstr "" "引發一個附帶引數 ``port``、``protocolname`` 的\\ :ref:`稽核事件 ` " "``socket.getservbyport``。" -#: ../../library/socket.rst:1129 +#: ../../library/socket.rst:1241 msgid "" "Convert 32-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1136 +#: ../../library/socket.rst:1248 msgid "" "Convert 16-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1140 ../../library/socket.rst:1158 +#: ../../library/socket.rst:1252 ../../library/socket.rst:1270 msgid "" "Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned integer." msgstr "" -#: ../../library/socket.rst:1147 +#: ../../library/socket.rst:1259 msgid "" "Convert 32-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1154 +#: ../../library/socket.rst:1266 msgid "" "Convert 16-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1165 +#: ../../library/socket.rst:1277 msgid "" "Convert an IPv4 address from dotted-quad string format (for example, " "'123.45.67.89') to 32-bit packed binary format, as a bytes object four " @@ -1409,26 +1514,26 @@ msgid "" "which is the C type for the 32-bit packed binary this function returns." msgstr "" -#: ../../library/socket.rst:1171 +#: ../../library/socket.rst:1283 msgid "" ":func:`inet_aton` also accepts strings with less than three dots; see the " "Unix manual page :manpage:`inet(3)` for details." msgstr "" -#: ../../library/socket.rst:1174 +#: ../../library/socket.rst:1286 msgid "" -"If the IPv4 address string passed to this function is invalid, :exc:" -"`OSError` will be raised. Note that exactly what is valid depends on the " -"underlying C implementation of :c:func:`inet_aton`." +"If the IPv4 address string passed to this function is " +"invalid, :exc:`OSError` will be raised. Note that exactly what is valid " +"depends on the underlying C implementation of :c:func:`inet_aton`." msgstr "" -#: ../../library/socket.rst:1178 +#: ../../library/socket.rst:1290 msgid "" ":func:`inet_aton` does not support IPv6, and :func:`inet_pton` should be " "used instead for IPv4/v6 dual stack support." msgstr "" -#: ../../library/socket.rst:1184 +#: ../../library/socket.rst:1296 msgid "" "Convert a 32-bit packed IPv4 address (a :term:`bytes-like object` four bytes " "in length) to its standard dotted-quad string representation (for example, " @@ -1438,7 +1543,7 @@ msgid "" "argument." msgstr "" -#: ../../library/socket.rst:1191 +#: ../../library/socket.rst:1303 msgid "" "If the byte sequence passed to this function is not exactly 4 bytes in " "length, :exc:`OSError` will be raised. :func:`inet_ntoa` does not support " @@ -1446,28 +1551,28 @@ msgid "" "support." msgstr "" -#: ../../library/socket.rst:1202 +#: ../../library/socket.rst:1314 msgid "" "Convert an IP address from its family-specific string format to a packed, " "binary format. :func:`inet_pton` is useful when a library or network " -"protocol calls for an object of type :c:struct:`in_addr` (similar to :func:" -"`inet_aton`) or :c:struct:`in6_addr`." +"protocol calls for an object of type :c:struct:`in_addr` (similar " +"to :func:`inet_aton`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1207 +#: ../../library/socket.rst:1319 msgid "" -"Supported values for *address_family* are currently :const:`AF_INET` and :" -"const:`AF_INET6`. If the IP address string *ip_string* is invalid, :exc:" -"`OSError` will be raised. Note that exactly what is valid depends on both " -"the value of *address_family* and the underlying implementation of :c:func:" -"`inet_pton`." +"Supported values for *address_family* are currently :const:`AF_INET` " +"and :const:`AF_INET6`. If the IP address string *ip_string* is " +"invalid, :exc:`OSError` will be raised. Note that exactly what is valid " +"depends on both the value of *address_family* and the underlying " +"implementation of :c:func:`inet_pton`." msgstr "" -#: ../../library/socket.rst:1215 ../../library/socket.rst:1235 +#: ../../library/socket.rst:1327 ../../library/socket.rst:1347 msgid "Windows support added" msgstr "" -#: ../../library/socket.rst:1221 +#: ../../library/socket.rst:1333 msgid "" "Convert a packed IP address (a :term:`bytes-like object` of some number of " "bytes) to its standard, family-specific string representation (for example, " @@ -1476,31 +1581,32 @@ msgid "" "(similar to :func:`inet_ntoa`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1228 +#: ../../library/socket.rst:1340 msgid "" -"Supported values for *address_family* are currently :const:`AF_INET` and :" -"const:`AF_INET6`. If the bytes object *packed_ip* is not the correct length " -"for the specified address family, :exc:`ValueError` will be raised. :exc:" -"`OSError` is raised for errors from the call to :func:`inet_ntop`." +"Supported values for *address_family* are currently :const:`AF_INET` " +"and :const:`AF_INET6`. If the bytes object *packed_ip* is not the correct " +"length for the specified address family, :exc:`ValueError` will be " +"raised. :exc:`OSError` is raised for errors from the call " +"to :func:`inet_ntop`." msgstr "" -#: ../../library/socket.rst:1250 +#: ../../library/socket.rst:1362 msgid "" "Return the total length, without trailing padding, of an ancillary data item " "with associated data of the given *length*. This value can often be used as " "the buffer size for :meth:`~socket.recvmsg` to receive a single item of " -"ancillary data, but :rfc:`3542` requires portable applications to use :func:" -"`CMSG_SPACE` and thus include space for padding, even when the item will be " -"the last in the buffer. Raises :exc:`OverflowError` if *length* is outside " -"the permissible range of values." +"ancillary data, but :rfc:`3542` requires portable applications to " +"use :func:`CMSG_SPACE` and thus include space for padding, even when the " +"item will be the last in the buffer. Raises :exc:`OverflowError` if " +"*length* is outside the permissible range of values." msgstr "" -#: ../../library/socket.rst:1261 ../../library/socket.rst:1748 -#: ../../library/socket.rst:1792 ../../library/socket.rst:1900 +#: ../../library/socket.rst:1373 ../../library/socket.rst:1861 +#: ../../library/socket.rst:1905 ../../library/socket.rst:2013 msgid "Most Unix platforms." msgstr "" -#: ../../library/socket.rst:1268 +#: ../../library/socket.rst:1380 msgid "" "Return the buffer size needed for :meth:`~socket.recvmsg` to receive an " "ancillary data item with associated data of the given *length*, along with " @@ -1510,7 +1616,7 @@ msgid "" "values." msgstr "" -#: ../../library/socket.rst:1276 +#: ../../library/socket.rst:1388 msgid "" "Note that some systems might support ancillary data without providing this " "function. Also note that setting the buffer size using the results of this " @@ -1518,140 +1624,142 @@ msgid "" "received, since additional data may be able to fit into the padding area." msgstr "" -#: ../../library/socket.rst:1284 +#: ../../library/socket.rst:1396 msgid "most Unix platforms." msgstr "" -#: ../../library/socket.rst:1291 +#: ../../library/socket.rst:1403 msgid "" "Return the default timeout in seconds (float) for new socket objects. A " "value of ``None`` indicates that new socket objects have no timeout. When " "the socket module is first imported, the default is ``None``." msgstr "" -#: ../../library/socket.rst:1298 +#: ../../library/socket.rst:1410 msgid "" "Set the default timeout in seconds (float) for new socket objects. When the " -"socket module is first imported, the default is ``None``. See :meth:" -"`~socket.settimeout` for possible values and their respective meanings." +"socket module is first imported, the default is ``None``. " +"See :meth:`~socket.settimeout` for possible values and their respective " +"meanings." msgstr "" -#: ../../library/socket.rst:1306 +#: ../../library/socket.rst:1418 msgid "" "Set the machine's hostname to *name*. This will raise an :exc:`OSError` if " "you don't have enough rights." msgstr "" -#: ../../library/socket.rst:1309 +#: ../../library/socket.rst:1421 msgid "" "Raises an :ref:`auditing event ` ``socket.sethostname`` with " "argument ``name``." msgstr "" -"引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 ` ``socket." -"sethostname``。" +"引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 ` " +"``socket.sethostname``。" -#: ../../library/socket.rst:1318 +#: ../../library/socket.rst:1430 msgid "" "Return a list of network interface information (index int, name string) " "tuples. :exc:`OSError` if the system call fails." msgstr "" -#: ../../library/socket.rst:1326 ../../library/socket.rst:1353 -#: ../../library/socket.rst:1370 +#: ../../library/socket.rst:1438 ../../library/socket.rst:1465 +#: ../../library/socket.rst:1482 msgid "Windows support was added." msgstr "增加對 Windows 的支援。" -#: ../../library/socket.rst:1331 +#: ../../library/socket.rst:1443 msgid "" "On Windows network interfaces have different names in different contexts " "(all names are examples):" msgstr "" -#: ../../library/socket.rst:1334 +#: ../../library/socket.rst:1446 msgid "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" msgstr "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" -#: ../../library/socket.rst:1335 +#: ../../library/socket.rst:1447 msgid "name: ``ethernet_32770``" msgstr "" -#: ../../library/socket.rst:1336 +#: ../../library/socket.rst:1448 msgid "friendly name: ``vEthernet (nat)``" msgstr "" -#: ../../library/socket.rst:1337 +#: ../../library/socket.rst:1449 msgid "description: ``Hyper-V Virtual Ethernet Adapter``" msgstr "" -#: ../../library/socket.rst:1339 +#: ../../library/socket.rst:1451 msgid "" "This function returns names of the second form from the list, " "``ethernet_32770`` in this example case." msgstr "" -#: ../../library/socket.rst:1345 +#: ../../library/socket.rst:1457 msgid "" -"Return a network interface index number corresponding to an interface name. :" -"exc:`OSError` if no interface with the given name exists." +"Return a network interface index number corresponding to an interface " +"name. :exc:`OSError` if no interface with the given name exists." msgstr "" -#: ../../library/socket.rst:1357 ../../library/socket.rst:1374 +#: ../../library/socket.rst:1469 ../../library/socket.rst:1486 msgid "\"Interface name\" is a name as documented in :func:`if_nameindex`." msgstr "" -#: ../../library/socket.rst:1362 +#: ../../library/socket.rst:1474 msgid "" -"Return a network interface name corresponding to an interface index number. :" -"exc:`OSError` if no interface with the given index exists." +"Return a network interface name corresponding to an interface index " +"number. :exc:`OSError` if no interface with the given index exists." msgstr "" -#: ../../library/socket.rst:1379 +#: ../../library/socket.rst:1491 msgid "" "Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket " -"*sock*. The *fds* parameter is a sequence of file descriptors. Consult :meth:" -"`~socket.sendmsg` for the documentation of these parameters." +"*sock*. The *fds* parameter is a sequence of file descriptors. " +"Consult :meth:`~socket.sendmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1385 +#: ../../library/socket.rst:1497 msgid "" "Unix platforms supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` " "mechanism." msgstr "" -#: ../../library/socket.rst:1393 +#: ../../library/socket.rst:1505 msgid "" "Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket " -"*sock*. Return ``(msg, list(fds), flags, addr)``. Consult :meth:`~socket." -"recvmsg` for the documentation of these parameters." +"*sock*. Return ``(msg, list(fds), flags, addr)``. " +"Consult :meth:`~socket.recvmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1399 +#: ../../library/socket.rst:1511 msgid "" "Unix platforms supporting :meth:`~socket.recvmsg` and :const:`SCM_RIGHTS` " "mechanism." msgstr "" -#: ../../library/socket.rst:1406 +#: ../../library/socket.rst:1518 msgid "Any truncated integers at the end of the list of file descriptors." msgstr "" -#: ../../library/socket.rst:1412 +#: ../../library/socket.rst:1524 msgid "Socket Objects" msgstr "Socket 物件" -#: ../../library/socket.rst:1414 +#: ../../library/socket.rst:1526 msgid "" -"Socket objects have the following methods. Except for :meth:`~socket." -"makefile`, these correspond to Unix system calls applicable to sockets." +"Socket objects have the following methods. Except " +"for :meth:`~socket.makefile`, these correspond to Unix system calls " +"applicable to sockets." msgstr "" -#: ../../library/socket.rst:1418 +#: ../../library/socket.rst:1530 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`~socket.close`." msgstr "" -#: ../../library/socket.rst:1425 +#: ../../library/socket.rst:1537 msgid "" "Accept a connection. The socket must be bound to an address and listening " "for connections. The return value is a pair ``(conn, address)`` where *conn* " @@ -1660,27 +1768,27 @@ msgid "" "connection." msgstr "" -#: ../../library/socket.rst:1432 ../../library/socket.rst:1526 +#: ../../library/socket.rst:1544 ../../library/socket.rst:1638 msgid "The socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:1435 ../../library/socket.rst:1661 -#: ../../library/socket.rst:1675 ../../library/socket.rst:1752 -#: ../../library/socket.rst:1825 ../../library/socket.rst:1844 -#: ../../library/socket.rst:1861 ../../library/socket.rst:1906 +#: ../../library/socket.rst:1547 ../../library/socket.rst:1774 +#: ../../library/socket.rst:1788 ../../library/socket.rst:1865 +#: ../../library/socket.rst:1938 ../../library/socket.rst:1957 +#: ../../library/socket.rst:1974 ../../library/socket.rst:2019 msgid "" "If the system call is interrupted and the signal handler does not raise an " -"exception, the method now retries the system call instead of raising an :exc:" -"`InterruptedError` exception (see :pep:`475` for the rationale)." +"exception, the method now retries the system call instead of raising " +"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1443 +#: ../../library/socket.rst:1555 msgid "" "Bind the socket to *address*. The socket must not already be bound. (The " "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1446 +#: ../../library/socket.rst:1558 msgid "" "Raises an :ref:`auditing event ` ``socket.bind`` with arguments " "``self``, ``address``." @@ -1688,7 +1796,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.bind``。" -#: ../../library/socket.rst:1453 +#: ../../library/socket.rst:1565 msgid "" "Mark the socket closed. The underlying system resource (e.g. a file " "descriptor) is also closed when all file objects from :meth:`makefile` are " @@ -1697,43 +1805,43 @@ msgid "" "flushed)." msgstr "" -#: ../../library/socket.rst:1459 +#: ../../library/socket.rst:1571 msgid "" "Sockets are automatically closed when they are garbage-collected, but it is " "recommended to :meth:`close` them explicitly, or to use a :keyword:`with` " "statement around them." msgstr "" -#: ../../library/socket.rst:1463 +#: ../../library/socket.rst:1575 msgid "" -":exc:`OSError` is now raised if an error occurs when the underlying :c:func:" -"`close` call is made." +":exc:`OSError` is now raised if an error occurs when the " +"underlying :c:func:`close` call is made." msgstr "" -#: ../../library/socket.rst:1469 +#: ../../library/socket.rst:1581 msgid "" ":meth:`close` releases the resource associated with a connection but does " "not necessarily close the connection immediately. If you want to close the " "connection in a timely fashion, call :meth:`shutdown` before :meth:`close`." msgstr "" -#: ../../library/socket.rst:1477 +#: ../../library/socket.rst:1589 msgid "" "Connect to a remote socket at *address*. (The format of *address* depends on " "the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1480 +#: ../../library/socket.rst:1592 msgid "" "If the connection is interrupted by a signal, the method waits until the " "connection completes, or raise a :exc:`TimeoutError` on timeout, if the " "signal handler doesn't raise an exception and the socket is blocking or has " -"a timeout. For non-blocking sockets, the method raises an :exc:" -"`InterruptedError` exception if the connection is interrupted by a signal " -"(or the exception raised by the signal handler)." +"a timeout. For non-blocking sockets, the method raises " +"an :exc:`InterruptedError` exception if the connection is interrupted by a " +"signal (or the exception raised by the signal handler)." msgstr "" -#: ../../library/socket.rst:1487 ../../library/socket.rst:1507 +#: ../../library/socket.rst:1599 ../../library/socket.rst:1619 msgid "" "Raises an :ref:`auditing event ` ``socket.connect`` with arguments " "``self``, ``address``." @@ -1741,15 +1849,15 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.connect``。" -#: ../../library/socket.rst:1489 +#: ../../library/socket.rst:1601 msgid "" -"The method now waits until the connection completes instead of raising an :" -"exc:`InterruptedError` exception if the connection is interrupted by a " +"The method now waits until the connection completes instead of raising " +"an :exc:`InterruptedError` exception if the connection is interrupted by a " "signal, the signal handler doesn't raise an exception and the socket is " "blocking or has a timeout (see the :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1500 +#: ../../library/socket.rst:1612 msgid "" "Like ``connect(address)``, but return an error indicator instead of raising " "an exception for errors returned by the C-level :c:func:`connect` call " @@ -1759,38 +1867,38 @@ msgid "" "asynchronous connects." msgstr "" -#: ../../library/socket.rst:1513 +#: ../../library/socket.rst:1625 msgid "" "Put the socket object into closed state without actually closing the " "underlying file descriptor. The file descriptor is returned, and can be " "reused for other purposes." msgstr "" -#: ../../library/socket.rst:1522 +#: ../../library/socket.rst:1634 msgid "Duplicate the socket." msgstr "" -#: ../../library/socket.rst:1534 +#: ../../library/socket.rst:1646 msgid "" "Return the socket's file descriptor (a small integer), or -1 on failure. " "This is useful with :func:`select.select`." msgstr "" -#: ../../library/socket.rst:1537 +#: ../../library/socket.rst:1649 msgid "" "Under Windows the small integer returned by this method cannot be used where " "a file descriptor can be used (such as :func:`os.fdopen`). Unix does not " "have this limitation." msgstr "" -#: ../../library/socket.rst:1543 +#: ../../library/socket.rst:1655 msgid "" "Get the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle: ``True`` if the socket can be inherited in " "child processes, ``False`` if it cannot." msgstr "" -#: ../../library/socket.rst:1552 +#: ../../library/socket.rst:1664 msgid "" "Return the remote address to which the socket is connected. This is useful " "to find out the port number of a remote IPv4/v6 socket, for instance. (The " @@ -1798,70 +1906,63 @@ msgid "" "above.) On some systems this function is not supported." msgstr "" -#: ../../library/socket.rst:1560 +#: ../../library/socket.rst:1672 msgid "" "Return the socket's own address. This is useful to find out the port number " "of an IPv4/v6 socket, for instance. (The format of the address returned " "depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1567 +#: ../../library/socket.rst:1679 msgid "" -"Return the value of the given socket option (see the Unix man page :manpage:" -"`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* etc. `) are defined in this module. If *buflen* is absent, an " -"integer option is assumed and its integer value is returned by the " -"function. If *buflen* is present, it specifies the maximum length of the " -"buffer used to receive the option in, and this buffer is returned as a bytes " -"object. It is up to the caller to decode the contents of the buffer (see " -"the optional built-in module :mod:`struct` for a way to decode C structures " -"encoded as byte strings)." +"Return the value of the given socket option (see the Unix man " +"page :manpage:`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* " +"etc. `) are defined in this module. If *buflen* is " +"absent, an integer option is assumed and its integer value is returned by " +"the function. If *buflen* is present, it specifies the maximum length of " +"the buffer used to receive the option in, and this buffer is returned as a " +"bytes object. It is up to the caller to decode the contents of the buffer " +"(see the optional built-in module :mod:`struct` for a way to decode C " +"structures encoded as byte strings)." msgstr "" -#: ../../library/socket.rst:1581 +#: ../../library/socket.rst:1693 msgid "" "Return ``True`` if socket is in blocking mode, ``False`` if in non-blocking." msgstr "" -#: ../../library/socket.rst:1584 +#: ../../library/socket.rst:1696 msgid "This is equivalent to checking ``socket.gettimeout() != 0``." msgstr "這等同於檢查 ``socket.gettimeout() != 0``。" -#: ../../library/socket.rst:1591 +#: ../../library/socket.rst:1703 msgid "" "Return the timeout in seconds (float) associated with socket operations, or " -"``None`` if no timeout is set. This reflects the last call to :meth:" -"`setblocking` or :meth:`settimeout`." +"``None`` if no timeout is set. This reflects the last call " +"to :meth:`setblocking` or :meth:`settimeout`." msgstr "" -#: ../../library/socket.rst:0 -msgid "platform" -msgstr "平台" - -#: ../../library/socket.rst:1598 -msgid "Windows" -msgstr "Windows" - -#: ../../library/socket.rst:1600 +#: ../../library/socket.rst:1710 msgid "" "The :meth:`ioctl` method is a limited interface to the WSAIoctl system " -"interface. Please refer to the `Win32 documentation `_ for more information." +"interface. Please refer to the `Win32 documentation `_ for more " +"information." msgstr "" -#: ../../library/socket.rst:1605 +#: ../../library/socket.rst:1715 msgid "" "On other platforms, the generic :func:`fcntl.fcntl` and :func:`fcntl.ioctl` " "functions may be used; they accept a socket object as their first argument." msgstr "" -#: ../../library/socket.rst:1608 +#: ../../library/socket.rst:1718 msgid "" "Currently only the following control codes are supported: ``SIO_RCVALL``, " "``SIO_KEEPALIVE_VALS``, and ``SIO_LOOPBACK_FAST_PATH``." msgstr "" -#: ../../library/socket.rst:1616 +#: ../../library/socket.rst:1729 msgid "" "Enable a server to accept connections. If *backlog* is specified, it must " "be at least 0 (if it is lower, it is set to 0); it specifies the number of " @@ -1869,11 +1970,11 @@ msgid "" "connections. If not specified, a default reasonable value is chosen." msgstr "" -#: ../../library/socket.rst:1623 +#: ../../library/socket.rst:1736 msgid "The *backlog* parameter is now optional." msgstr "" -#: ../../library/socket.rst:1632 +#: ../../library/socket.rst:1745 msgid "" "Return a :term:`file object` associated with the socket. The exact returned " "type depends on the arguments given to :meth:`makefile`. These arguments " @@ -1882,38 +1983,38 @@ msgid "" "``'b'``, or a combination of those." msgstr "" -#: ../../library/socket.rst:1638 +#: ../../library/socket.rst:1751 msgid "" "The socket must be in blocking mode; it can have a timeout, but the file " "object's internal buffer may end up in an inconsistent state if a timeout " "occurs." msgstr "" -#: ../../library/socket.rst:1642 +#: ../../library/socket.rst:1755 msgid "" "Closing the file object returned by :meth:`makefile` won't close the " -"original socket unless all other file objects have been closed and :meth:" -"`socket.close` has been called on the socket object." +"original socket unless all other file objects have been closed " +"and :meth:`socket.close` has been called on the socket object." msgstr "" -#: ../../library/socket.rst:1648 +#: ../../library/socket.rst:1761 msgid "" "On Windows, the file-like object created by :meth:`makefile` cannot be used " "where a file object with a file descriptor is expected, such as the stream " "arguments of :meth:`subprocess.Popen`." msgstr "" -#: ../../library/socket.rst:1655 +#: ../../library/socket.rst:1768 msgid "" "Receive data from the socket. The return value is a bytes object " "representing the data received. The maximum amount of data to be received " "at once is specified by *bufsize*. A returned empty bytes object indicates " -"that the client has disconnected. See the Unix manual page :manpage:" -"`recv(2)` for the meaning of the optional argument *flags*; it defaults to " -"zero." +"that the client has disconnected. See the Unix manual " +"page :manpage:`recv(2)` for the meaning of the optional argument *flags*; it " +"defaults to zero." msgstr "" -#: ../../library/socket.rst:1669 +#: ../../library/socket.rst:1782 msgid "" "Receive data from the socket. The return value is a pair ``(bytes, " "address)`` where *bytes* is a bytes object representing the data received " @@ -1923,14 +2024,14 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1680 +#: ../../library/socket.rst:1793 msgid "" "For multicast IPv6 address, first item of *address* does not contain " -"``%scope_id`` part anymore. In order to get full IPv6 address use :func:" -"`getnameinfo`." +"``%scope_id`` part anymore. In order to get full IPv6 address " +"use :func:`getnameinfo`." msgstr "" -#: ../../library/socket.rst:1687 +#: ../../library/socket.rst:1800 msgid "" "Receive normal data (up to *bufsize* bytes) and ancillary data from the " "socket. The *ancbufsize* argument sets the size in bytes of the internal " @@ -1941,7 +2042,7 @@ msgid "" "*flags* argument defaults to 0 and has the same meaning as for :meth:`recv`." msgstr "" -#: ../../library/socket.rst:1697 +#: ../../library/socket.rst:1810 msgid "" "The return value is a 4-tuple: ``(data, ancdata, msg_flags, address)``. The " "*data* item is a :class:`bytes` object holding the non-ancillary data " @@ -1956,38 +2057,39 @@ msgid "" "socket, if available; otherwise, its value is unspecified." msgstr "" -#: ../../library/socket.rst:1711 +#: ../../library/socket.rst:1824 msgid "" "On some systems, :meth:`sendmsg` and :meth:`recvmsg` can be used to pass " "file descriptors between processes over an :const:`AF_UNIX` socket. When " "this facility is used (it is often restricted to :const:`SOCK_STREAM` " "sockets), :meth:`recvmsg` will return, in its ancillary data, items of the " -"form ``(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)``, where *fds* is a :" -"class:`bytes` object representing the new file descriptors as a binary array " -"of the native C :c:expr:`int` type. If :meth:`recvmsg` raises an exception " -"after the system call returns, it will first attempt to close any file " -"descriptors received via this mechanism." +"form ``(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)``, where *fds* is " +"a :class:`bytes` object representing the new file descriptors as a binary " +"array of the native C :c:expr:`int` type. If :meth:`recvmsg` raises an " +"exception after the system call returns, it will first attempt to close any " +"file descriptors received via this mechanism." msgstr "" -#: ../../library/socket.rst:1722 +#: ../../library/socket.rst:1835 msgid "" "Some systems do not indicate the truncated length of ancillary data items " "which have been only partially received. If an item appears to extend " -"beyond the end of the buffer, :meth:`recvmsg` will issue a :exc:" -"`RuntimeWarning`, and will return the part of it which is inside the buffer " -"provided it has not been truncated before the start of its associated data." +"beyond the end of the buffer, :meth:`recvmsg` will issue " +"a :exc:`RuntimeWarning`, and will return the part of it which is inside the " +"buffer provided it has not been truncated before the start of its associated " +"data." msgstr "" -#: ../../library/socket.rst:1729 +#: ../../library/socket.rst:1842 msgid "" "On systems which support the :const:`SCM_RIGHTS` mechanism, the following " "function will receive up to *maxfds* file descriptors, returning the message " "data and a list containing the descriptors (while ignoring unexpected " -"conditions such as unrelated control messages being received). See also :" -"meth:`sendmsg`. ::" +"conditions such as unrelated control messages being received). See " +"also :meth:`sendmsg`. ::" msgstr "" -#: ../../library/socket.rst:1735 +#: ../../library/socket.rst:1848 msgid "" "import socket, array\n" "\n" @@ -1996,28 +2098,29 @@ msgid "" " msg, ancdata, flags, addr = sock.recvmsg(msglen, socket.CMSG_LEN(maxfds " "* fds.itemsize))\n" " for cmsg_level, cmsg_type, cmsg_data in ancdata:\n" -" if cmsg_level == socket.SOL_SOCKET and cmsg_type == socket." -"SCM_RIGHTS:\n" +" if cmsg_level == socket.SOL_SOCKET and cmsg_type == " +"socket.SCM_RIGHTS:\n" " # Append data, ignoring any truncated integers at the end.\n" -" fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds." -"itemsize)])\n" +" fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % " +"fds.itemsize)])\n" " return msg, list(fds)" msgstr "" -#: ../../library/socket.rst:1760 +#: ../../library/socket.rst:1873 msgid "" -"Receive normal data and ancillary data from the socket, behaving as :meth:" -"`recvmsg` would, but scatter the non-ancillary data into a series of buffers " -"instead of returning a new bytes object. The *buffers* argument must be an " -"iterable of objects that export writable buffers (e.g. :class:`bytearray` " -"objects); these will be filled with successive chunks of the non-ancillary " -"data until it has all been written or there are no more buffers. The " -"operating system may set a limit (:func:`~os.sysconf` value ``SC_IOV_MAX``) " -"on the number of buffers that can be used. The *ancbufsize* and *flags* " -"arguments have the same meaning as for :meth:`recvmsg`." +"Receive normal data and ancillary data from the socket, behaving " +"as :meth:`recvmsg` would, but scatter the non-ancillary data into a series " +"of buffers instead of returning a new bytes object. The *buffers* argument " +"must be an iterable of objects that export writable buffers " +"(e.g. :class:`bytearray` objects); these will be filled with successive " +"chunks of the non-ancillary data until it has all been written or there are " +"no more buffers. The operating system may set a limit (:func:`~os.sysconf` " +"value ``SC_IOV_MAX``) on the number of buffers that can be used. The " +"*ancbufsize* and *flags* arguments have the same meaning as " +"for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1771 +#: ../../library/socket.rst:1884 msgid "" "The return value is a 4-tuple: ``(nbytes, ancdata, msg_flags, address)``, " "where *nbytes* is the total number of bytes of non-ancillary data written " @@ -2025,11 +2128,11 @@ msgid "" "for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1776 +#: ../../library/socket.rst:1889 msgid "Example::" msgstr "範例: ::" -#: ../../library/socket.rst:1778 +#: ../../library/socket.rst:1891 msgid "" ">>> import socket\n" ">>> s1, s2 = socket.socketpair()\n" @@ -2055,7 +2158,7 @@ msgstr "" ">>> [b1, b2, b3]\n" "[bytearray(b'Mary'), bytearray(b'01 had a 9'), bytearray(b'little lamb---')]" -#: ../../library/socket.rst:1799 +#: ../../library/socket.rst:1912 msgid "" "Receive data from the socket, writing it into *buffer* instead of creating a " "new bytestring. The return value is a pair ``(nbytes, address)`` where " @@ -2065,7 +2168,7 @@ msgid "" "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1809 +#: ../../library/socket.rst:1922 msgid "" "Receive up to *nbytes* bytes from the socket, storing the data into a buffer " "rather than creating a new bytestring. If *nbytes* is not specified (or 0), " @@ -2074,7 +2177,7 @@ msgid "" "of the optional argument *flags*; it defaults to zero." msgstr "" -#: ../../library/socket.rst:1818 +#: ../../library/socket.rst:1931 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2084,7 +2187,7 @@ msgid "" "data. For further information on this topic, consult the :ref:`socket-howto`." msgstr "" -#: ../../library/socket.rst:1833 +#: ../../library/socket.rst:1946 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2094,13 +2197,13 @@ msgid "" "to determine how much data, if any, was successfully sent." msgstr "" -#: ../../library/socket.rst:1840 +#: ../../library/socket.rst:1953 msgid "" "The socket timeout is no longer reset each time data is sent successfully. " "The socket timeout is now the maximum total duration to send all data." msgstr "" -#: ../../library/socket.rst:1853 +#: ../../library/socket.rst:1966 msgid "" "Send data to the socket. The socket should not be connected to a remote " "socket, since the destination socket is specified by *address*. The " @@ -2109,7 +2212,7 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1859 +#: ../../library/socket.rst:1972 msgid "" "Raises an :ref:`auditing event ` ``socket.sendto`` with arguments " "``self``, ``address``." @@ -2117,13 +2220,13 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendto``。" -#: ../../library/socket.rst:1869 +#: ../../library/socket.rst:1982 msgid "" "Send normal and ancillary data to the socket, gathering the non-ancillary " "data from a series of buffers and concatenating it into a single message. " -"The *buffers* argument specifies the non-ancillary data as an iterable of :" -"term:`bytes-like objects ` (e.g. :class:`bytes` objects); " -"the operating system may set a limit (:func:`~os.sysconf` value " +"The *buffers* argument specifies the non-ancillary data as an iterable " +"of :term:`bytes-like objects ` (e.g. :class:`bytes` " +"objects); the operating system may set a limit (:func:`~os.sysconf` value " "``SC_IOV_MAX``) on the number of buffers that can be used. The *ancdata* " "argument specifies the ancillary data (control messages) as an iterable of " "zero or more tuples ``(cmsg_level, cmsg_type, cmsg_data)``, where " @@ -2137,28 +2240,28 @@ msgid "" "bytes of non-ancillary data sent." msgstr "" -#: ../../library/socket.rst:1889 +#: ../../library/socket.rst:2002 msgid "" -"The following function sends the list of file descriptors *fds* over an :" -"const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " +"The following function sends the list of file descriptors *fds* over " +"an :const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " "mechanism. See also :meth:`recvmsg`. ::" msgstr "" -#: ../../library/socket.rst:1893 +#: ../../library/socket.rst:2006 msgid "" "import socket, array\n" "\n" "def send_fds(sock, msg, fds):\n" -" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." -"array(\"i\", fds))])" +" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, " +"array.array(\"i\", fds))])" msgstr "" "import socket, array\n" "\n" "def send_fds(sock, msg, fds):\n" -" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." -"array(\"i\", fds))])" +" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, " +"array.array(\"i\", fds))])" -#: ../../library/socket.rst:1902 +#: ../../library/socket.rst:2015 msgid "" "Raises an :ref:`auditing event ` ``socket.sendmsg`` with arguments " "``self``, ``address``." @@ -2166,158 +2269,161 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendmsg``。" -#: ../../library/socket.rst:1913 +#: ../../library/socket.rst:2026 msgid "" "Specialized version of :meth:`~socket.sendmsg` for :const:`AF_ALG` socket. " "Set mode, IV, AEAD associated data length and flags for :const:`AF_ALG` " "socket." msgstr "" -#: ../../library/socket.rst:1922 +#: ../../library/socket.rst:2035 msgid "" -"Send a file until EOF is reached by using high-performance :mod:`os." -"sendfile` and return the total number of bytes which were sent. *file* must " -"be a regular file object opened in binary mode. If :mod:`os.sendfile` is not " -"available (e.g. Windows) or *file* is not a regular file :meth:`send` will " -"be used instead. *offset* tells from where to start reading the file. If " -"specified, *count* is the total number of bytes to transmit as opposed to " -"sending the file until EOF is reached. File position is updated on return or " -"also in case of error in which case :meth:`file.tell() ` can " -"be used to figure out the number of bytes which were sent. The socket must " -"be of :const:`SOCK_STREAM` type. Non-blocking sockets are not supported." +"Send a file until EOF is reached by using high-" +"performance :mod:`os.sendfile` and return the total number of bytes which " +"were sent. *file* must be a regular file object opened in binary mode. " +"If :mod:`os.sendfile` is not available (e.g. Windows) or *file* is not a " +"regular file :meth:`send` will be used instead. *offset* tells from where to " +"start reading the file. If specified, *count* is the total number of bytes " +"to transmit as opposed to sending the file until EOF is reached. File " +"position is updated on return or also in case of error in which " +"case :meth:`file.tell() ` can be used to figure out the " +"number of bytes which were sent. The socket must be of :const:`SOCK_STREAM` " +"type. Non-blocking sockets are not supported." msgstr "" -#: ../../library/socket.rst:1938 +#: ../../library/socket.rst:2051 msgid "" "Set the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle." msgstr "" -#: ../../library/socket.rst:1946 +#: ../../library/socket.rst:2059 msgid "" "Set blocking or non-blocking mode of the socket: if *flag* is false, the " "socket is set to non-blocking, else to blocking mode." msgstr "" -#: ../../library/socket.rst:1949 +#: ../../library/socket.rst:2062 msgid "" "This method is a shorthand for certain :meth:`~socket.settimeout` calls:" msgstr "" -#: ../../library/socket.rst:1951 +#: ../../library/socket.rst:2064 msgid "``sock.setblocking(True)`` is equivalent to ``sock.settimeout(None)``" msgstr "``sock.setblocking(True)`` 等價於 ``sock.settimeout(None)``" -#: ../../library/socket.rst:1953 +#: ../../library/socket.rst:2066 msgid "``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)``" msgstr "``sock.setblocking(False)`` 等價於 ``sock.settimeout(0.0)``" -#: ../../library/socket.rst:1955 +#: ../../library/socket.rst:2068 msgid "" -"The method no longer applies :const:`SOCK_NONBLOCK` flag on :attr:`socket." -"type`." +"The method no longer applies :const:`SOCK_NONBLOCK` flag " +"on :attr:`socket.type`." msgstr "" -#: ../../library/socket.rst:1962 +#: ../../library/socket.rst:2075 msgid "" "Set a timeout on blocking socket operations. The *value* argument can be a " "nonnegative floating-point number expressing seconds, or ``None``. If a non-" -"zero value is given, subsequent socket operations will raise a :exc:" -"`timeout` exception if the timeout period *value* has elapsed before the " -"operation has completed. If zero is given, the socket is put in non-" +"zero value is given, subsequent socket operations will raise " +"a :exc:`timeout` exception if the timeout period *value* has elapsed before " +"the operation has completed. If zero is given, the socket is put in non-" "blocking mode. If ``None`` is given, the socket is put in blocking mode." msgstr "" -#: ../../library/socket.rst:1969 +#: ../../library/socket.rst:2082 msgid "" "For further information, please consult the :ref:`notes on socket timeouts " "`." msgstr "" -#: ../../library/socket.rst:1971 +#: ../../library/socket.rst:2084 msgid "" -"The method no longer toggles :const:`SOCK_NONBLOCK` flag on :attr:`socket." -"type`." +"The method no longer toggles :const:`SOCK_NONBLOCK` flag " +"on :attr:`socket.type`." msgstr "" -#: ../../library/socket.rst:1984 +#: ../../library/socket.rst:2097 msgid "" -"Set the value of the given socket option (see the Unix manual page :manpage:" -"`setsockopt(2)`). The needed symbolic constants are defined in this module " -"(:ref:`!SO_\\* etc. `). The value can be an integer, " -"``None`` or a :term:`bytes-like object` representing a buffer. In the later " -"case it is up to the caller to ensure that the bytestring contains the " -"proper bits (see the optional built-in module :mod:`struct` for a way to " -"encode C structures as bytestrings). When *value* is set to ``None``, " -"*optlen* argument is required. It's equivalent to call :c:func:`setsockopt` " -"C function with ``optval=NULL`` and ``optlen=optlen``." +"Set the value of the given socket option (see the Unix manual " +"page :manpage:`setsockopt(2)`). The needed symbolic constants are defined " +"in this module (:ref:`!SO_\\* etc. `). The value can " +"be an integer, ``None`` or a :term:`bytes-like object` representing a " +"buffer. In the later case it is up to the caller to ensure that the " +"bytestring contains the proper bits (see the optional built-in " +"module :mod:`struct` for a way to encode C structures as bytestrings). When " +"*value* is set to ``None``, *optlen* argument is required. It's equivalent " +"to call :c:func:`setsockopt` C function with ``optval=NULL`` and " +"``optlen=optlen``." msgstr "" -#: ../../library/socket.rst:1997 +#: ../../library/socket.rst:2110 msgid "setsockopt(level, optname, None, optlen: int) form added." msgstr "" -#: ../../library/socket.rst:2005 +#: ../../library/socket.rst:2118 msgid "" -"Shut down one or both halves of the connection. If *how* is :const:" -"`SHUT_RD`, further receives are disallowed. If *how* is :const:`SHUT_WR`, " -"further sends are disallowed. If *how* is :const:`SHUT_RDWR`, further sends " -"and receives are disallowed." +"Shut down one or both halves of the connection. If *how* " +"is :const:`SHUT_RD`, further receives are disallowed. If *how* " +"is :const:`SHUT_WR`, further sends are disallowed. If *how* " +"is :const:`SHUT_RDWR`, further sends and receives are disallowed." msgstr "" -#: ../../library/socket.rst:2015 +#: ../../library/socket.rst:2128 msgid "" "Duplicate a socket and prepare it for sharing with a target process. The " "target process must be provided with *process_id*. The resulting bytes " "object can then be passed to the target process using some form of " -"interprocess communication and the socket can be recreated there using :func:" -"`fromshare`. Once this method has been called, it is safe to close the " -"socket since the operating system has already duplicated it for the target " -"process." +"interprocess communication and the socket can be recreated there " +"using :func:`fromshare`. Once this method has been called, it is safe to " +"close the socket since the operating system has already duplicated it for " +"the target process." msgstr "" -#: ../../library/socket.rst:2027 +#: ../../library/socket.rst:2140 msgid "" -"Note that there are no methods :meth:`read` or :meth:`write`; use :meth:" -"`~socket.recv` and :meth:`~socket.send` without *flags* argument instead." +"Note that there are no methods :meth:`read` or :meth:`write`; " +"use :meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument " +"instead." msgstr "" -#: ../../library/socket.rst:2030 +#: ../../library/socket.rst:2143 msgid "" "Socket objects also have these (read-only) attributes that correspond to the " "values given to the :class:`~socket.socket` constructor." msgstr "" -#: ../../library/socket.rst:2036 +#: ../../library/socket.rst:2149 msgid "The socket family." msgstr "" -#: ../../library/socket.rst:2041 +#: ../../library/socket.rst:2154 msgid "The socket type." msgstr "" -#: ../../library/socket.rst:2046 +#: ../../library/socket.rst:2159 msgid "The socket protocol." msgstr "" -#: ../../library/socket.rst:2053 +#: ../../library/socket.rst:2166 msgid "Notes on socket timeouts" msgstr "" -#: ../../library/socket.rst:2055 +#: ../../library/socket.rst:2168 msgid "" "A socket object can be in one of three modes: blocking, non-blocking, or " "timeout. Sockets are by default always created in blocking mode, but this " "can be changed by calling :func:`setdefaulttimeout`." msgstr "" -#: ../../library/socket.rst:2059 +#: ../../library/socket.rst:2172 msgid "" "In *blocking mode*, operations block until complete or the system returns an " "error (such as connection timed out)." msgstr "" -#: ../../library/socket.rst:2062 +#: ../../library/socket.rst:2175 msgid "" "In *non-blocking mode*, operations fail (with an error that is unfortunately " "system-dependent) if they cannot be completed immediately: functions from " @@ -2325,14 +2431,14 @@ msgid "" "available for reading or writing." msgstr "" -#: ../../library/socket.rst:2067 +#: ../../library/socket.rst:2180 msgid "" "In *timeout mode*, operations fail if they cannot be completed within the " "timeout specified for the socket (they raise a :exc:`timeout` exception) or " "if the system returns an error." msgstr "" -#: ../../library/socket.rst:2072 +#: ../../library/socket.rst:2185 msgid "" "At the operating system level, sockets in *timeout mode* are internally set " "in non-blocking mode. Also, the blocking and timeout modes are shared " @@ -2341,38 +2447,38 @@ msgid "" "you decide to use the :meth:`~socket.fileno` of a socket." msgstr "" -#: ../../library/socket.rst:2079 +#: ../../library/socket.rst:2192 msgid "Timeouts and the ``connect`` method" msgstr "" -#: ../../library/socket.rst:2081 +#: ../../library/socket.rst:2194 msgid "" "The :meth:`~socket.connect` operation is also subject to the timeout " "setting, and in general it is recommended to call :meth:`~socket.settimeout` " -"before calling :meth:`~socket.connect` or pass a timeout parameter to :meth:" -"`create_connection`. However, the system network stack may also return a " -"connection timeout error of its own regardless of any Python socket timeout " -"setting." +"before calling :meth:`~socket.connect` or pass a timeout parameter " +"to :meth:`create_connection`. However, the system network stack may also " +"return a connection timeout error of its own regardless of any Python socket " +"timeout setting." msgstr "" -#: ../../library/socket.rst:2089 +#: ../../library/socket.rst:2202 msgid "Timeouts and the ``accept`` method" msgstr "" -#: ../../library/socket.rst:2091 +#: ../../library/socket.rst:2204 msgid "" -"If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by the :" -"meth:`~socket.accept` method inherit that timeout. Otherwise, the behaviour " -"depends on settings of the listening socket:" +"If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by " +"the :meth:`~socket.accept` method inherit that timeout. Otherwise, the " +"behaviour depends on settings of the listening socket:" msgstr "" -#: ../../library/socket.rst:2095 +#: ../../library/socket.rst:2208 msgid "" "if the listening socket is in *blocking mode* or in *timeout mode*, the " "socket returned by :meth:`~socket.accept` is in *blocking mode*;" msgstr "" -#: ../../library/socket.rst:2098 +#: ../../library/socket.rst:2211 msgid "" "if the listening socket is in *non-blocking mode*, whether the socket " "returned by :meth:`~socket.accept` is in blocking or non-blocking mode is " @@ -2380,28 +2486,29 @@ msgid "" "it is recommended you manually override this setting." msgstr "" -#: ../../library/socket.rst:2107 +#: ../../library/socket.rst:2220 msgid "Example" msgstr "範例" -#: ../../library/socket.rst:2109 +#: ../../library/socket.rst:2222 msgid "" "Here are four minimal example programs using the TCP/IP protocol: a server " "that echoes all data that it receives back (servicing only one client), and " -"a client using it. Note that a server must perform the sequence :func:" -"`~socket.socket`, :meth:`~socket.bind`, :meth:`~socket.listen`, :meth:" -"`~socket.accept` (possibly repeating the :meth:`~socket.accept` to service " -"more than one client), while a client only needs the sequence :func:`~socket." -"socket`, :meth:`~socket.connect`. Also note that the server does not :meth:" -"`~socket.sendall`/:meth:`~socket.recv` on the socket it is listening on but " -"on the new socket returned by :meth:`~socket.accept`." +"a client using it. Note that a server must perform the " +"sequence :func:`~socket.socket`, :meth:`~socket.bind`, :meth:`~socket.listen`, :meth:`~socket.accept` " +"(possibly repeating the :meth:`~socket.accept` to service more than one " +"client), while a client only needs the " +"sequence :func:`~socket.socket`, :meth:`~socket.connect`. Also note that " +"the server does not :meth:`~socket.sendall`/:meth:`~socket.recv` on the " +"socket it is listening on but on the new socket returned " +"by :meth:`~socket.accept`." msgstr "" -#: ../../library/socket.rst:2119 +#: ../../library/socket.rst:2232 msgid "The first two examples support IPv4 only. ::" msgstr "前兩個範例只支援 IPv4: ::" -#: ../../library/socket.rst:2121 +#: ../../library/socket.rst:2234 msgid "" "# Echo server program\n" "import socket\n" @@ -2420,7 +2527,7 @@ msgid "" " conn.sendall(data)" msgstr "" -#: ../../library/socket.rst:2139 +#: ../../library/socket.rst:2252 msgid "" "# Echo client program\n" "import socket\n" @@ -2434,7 +2541,7 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2150 +#: ../../library/socket.rst:2263 msgid "" "The next two examples are identical to the above two, but support both IPv4 " "and IPv6. The server side will listen to the first address family available " @@ -2444,7 +2551,7 @@ msgid "" "resolution, and sends traffic to the first one connected successfully. ::" msgstr "" -#: ../../library/socket.rst:2157 +#: ../../library/socket.rst:2270 msgid "" "# Echo server program\n" "import socket\n" @@ -2481,7 +2588,7 @@ msgid "" " conn.send(data)" msgstr "" -#: ../../library/socket.rst:2193 +#: ../../library/socket.rst:2306 msgid "" "# Echo client program\n" "import socket\n" @@ -2490,8 +2597,8 @@ msgid "" "HOST = 'daring.cwi.nl' # The remote host\n" "PORT = 50007 # The same port as used by the server\n" "s = None\n" -"for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket." -"SOCK_STREAM):\n" +"for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, " +"socket.SOCK_STREAM):\n" " af, socktype, proto, canonname, sa = res\n" " try:\n" " s = socket.socket(af, socktype, proto)\n" @@ -2514,14 +2621,14 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2222 +#: ../../library/socket.rst:2335 msgid "" "The next example shows how to write a very simple network sniffer with raw " "sockets on Windows. The example requires administrator privileges to modify " "the interface::" msgstr "" -#: ../../library/socket.rst:2226 +#: ../../library/socket.rst:2339 msgid "" "import socket\n" "\n" @@ -2545,29 +2652,29 @@ msgid "" "s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)" msgstr "" -#: ../../library/socket.rst:2247 +#: ../../library/socket.rst:2360 msgid "" "The next example shows how to use the socket interface to communicate to a " "CAN network using the raw socket protocol. To use CAN with the broadcast " "manager protocol instead, open a socket with::" msgstr "" -#: ../../library/socket.rst:2251 +#: ../../library/socket.rst:2364 msgid "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" msgstr "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" -#: ../../library/socket.rst:2253 +#: ../../library/socket.rst:2366 msgid "" "After binding (:const:`CAN_RAW`) or connecting (:const:`CAN_BCM`) the " "socket, you can use the :meth:`socket.send` and :meth:`socket.recv` " "operations (and their counterparts) on the socket object as usual." msgstr "" -#: ../../library/socket.rst:2257 +#: ../../library/socket.rst:2370 msgid "This last example might require special privileges::" msgstr "" -#: ../../library/socket.rst:2259 +#: ../../library/socket.rst:2372 msgid "" "import socket\n" "import struct\n" @@ -2609,29 +2716,29 @@ msgid "" " print('Error sending CAN frame')" msgstr "" -#: ../../library/socket.rst:2297 +#: ../../library/socket.rst:2410 msgid "" "Running an example several times with too small delay between executions, " "could lead to this error::" msgstr "" -#: ../../library/socket.rst:2300 +#: ../../library/socket.rst:2413 msgid "OSError: [Errno 98] Address already in use" msgstr "OSError: [Errno 98] Address already in use" -#: ../../library/socket.rst:2302 +#: ../../library/socket.rst:2415 msgid "" "This is because the previous execution has left the socket in a " "``TIME_WAIT`` state, and can't be immediately reused." msgstr "" -#: ../../library/socket.rst:2305 +#: ../../library/socket.rst:2418 msgid "" -"There is a :mod:`socket` flag to set, in order to prevent this, :const:" -"`socket.SO_REUSEADDR`::" +"There is a :mod:`socket` flag to set, in order to prevent " +"this, :const:`socket.SO_REUSEADDR`::" msgstr "" -#: ../../library/socket.rst:2308 +#: ../../library/socket.rst:2421 msgid "" "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" @@ -2641,30 +2748,30 @@ msgstr "" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" "s.bind((HOST, PORT))" -#: ../../library/socket.rst:2312 +#: ../../library/socket.rst:2425 msgid "" "the :data:`SO_REUSEADDR` flag tells the kernel to reuse a local socket in " "``TIME_WAIT`` state, without waiting for its natural timeout to expire." msgstr "" -#: ../../library/socket.rst:2318 +#: ../../library/socket.rst:2431 msgid "" "For an introduction to socket programming (in C), see the following papers:" msgstr "" -#: ../../library/socket.rst:2320 +#: ../../library/socket.rst:2433 msgid "" "*An Introductory 4.3BSD Interprocess Communication Tutorial*, by Stuart " "Sechrest" msgstr "" -#: ../../library/socket.rst:2322 +#: ../../library/socket.rst:2435 msgid "" "*An Advanced 4.3BSD Interprocess Communication Tutorial*, by Samuel J. " "Leffler et al," msgstr "" -#: ../../library/socket.rst:2325 +#: ../../library/socket.rst:2438 msgid "" "both in the UNIX Programmer's Manual, Supplementary Documents 1 (sections " "PS1:7 and PS1:8). The platform-specific reference material for the various " @@ -2683,18 +2790,24 @@ msgstr "object(物件)" msgid "socket" msgstr "socket" -#: ../../library/socket.rst:1630 +#: ../../library/socket.rst:1743 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/socket.rst:1630 +#: ../../library/socket.rst:1743 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/socket.rst:1982 +#: ../../library/socket.rst:2095 msgid "module" msgstr "module(模組)" -#: ../../library/socket.rst:1982 +#: ../../library/socket.rst:2095 msgid "struct" msgstr "struct" + +#~ msgid "platform" +#~ msgstr "平台" + +#~ msgid "Windows" +#~ msgstr "Windows" diff --git a/library/socketserver.po b/library/socketserver.po index a2fdff816e1..3a381adc735 100644 --- a/library/socketserver.po +++ b/library/socketserver.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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -90,9 +90,9 @@ msgid "" "classes, passing it the server's address and the request handler class. It " "is recommended to use the server in a :keyword:`with` statement. Then call " "the :meth:`~BaseServer.handle_request` or :meth:`~BaseServer.serve_forever` " -"method of the server object to process one or many requests. Finally, call :" -"meth:`~BaseServer.server_close` to close the socket (unless you used a :" -"keyword:`!with` statement)." +"method of the server object to process one or many requests. Finally, " +"call :meth:`~BaseServer.server_close` to close the socket (unless you used " +"a :keyword:`!with` statement)." msgstr "" #: ../../library/socketserver.rst:64 @@ -103,8 +103,8 @@ msgid "" "attribute *daemon_threads*, which indicates whether or not the server should " "wait for thread termination. You should set the flag explicitly if you " "would like threads to behave autonomously; the default is :const:`False`, " -"meaning that Python will not exit until all threads created by :class:" -"`ThreadingMixIn` have exited." +"meaning that Python will not exit until all threads created " +"by :class:`ThreadingMixIn` have exited." msgstr "" #: ../../library/socketserver.rst:73 @@ -177,9 +177,9 @@ msgstr "" #: ../../library/socketserver.rst:112 msgid "" -"The mix-in class comes first, since it overrides a method defined in :class:" -"`UDPServer`. Setting the various attributes also changes the behavior of " -"the underlying server mechanism." +"The mix-in class comes first, since it overrides a method defined " +"in :class:`UDPServer`. Setting the various attributes also changes the " +"behavior of the underlying server mechanism." msgstr "" #: ../../library/socketserver.rst:116 @@ -204,42 +204,49 @@ msgstr "" #: ../../library/socketserver.rst:131 msgid "" -"For :class:`ThreadingMixIn` use daemonic threads by setting :data:" -"`ThreadingMixIn.daemon_threads ` to ``True`` to not wait " -"until threads complete." +"Specify how many child processes will exist to handle requests at a time " +"for :class:`ForkingMixIn`. If the limit is reached, new requests will wait " +"until one child process has finished." msgstr "" #: ../../library/socketserver.rst:137 msgid "" -":meth:`ForkingMixIn.server_close ` and :meth:" -"`ThreadingMixIn.server_close ` now waits until all " -"child processes and non-daemonic threads complete. Add a new :attr:" -"`ForkingMixIn.block_on_close ` class attribute to opt-in for " -"the pre-3.7 behaviour." +"For :class:`ThreadingMixIn` use daemonic threads by " +"setting :data:`ThreadingMixIn.daemon_threads ` to ``True`` " +"to not wait until threads complete." msgstr "" -#: ../../library/socketserver.rst:153 +#: ../../library/socketserver.rst:143 +msgid "" +":meth:`ForkingMixIn.server_close ` " +"and :meth:`ThreadingMixIn.server_close ` now waits " +"until all child processes and non-daemonic threads complete. Add a " +"new :attr:`ForkingMixIn.block_on_close ` class attribute to " +"opt-in for the pre-3.7 behaviour." +msgstr "" + +#: ../../library/socketserver.rst:159 msgid "These classes are pre-defined using the mix-in classes." msgstr "" -#: ../../library/socketserver.rst:155 +#: ../../library/socketserver.rst:161 msgid "" "The ``ForkingUnixStreamServer`` and ``ForkingUnixDatagramServer`` classes " "were added." msgstr "" -#: ../../library/socketserver.rst:159 +#: ../../library/socketserver.rst:165 msgid "" -"To implement a service, you must derive a class from :class:" -"`BaseRequestHandler` and redefine its :meth:`~BaseRequestHandler.handle` " -"method. You can then run various versions of the service by combining one of " -"the server classes with your request handler class. The request handler " -"class must be different for datagram or stream services. This can be hidden " -"by using the handler subclasses :class:`StreamRequestHandler` or :class:" -"`DatagramRequestHandler`." +"To implement a service, you must derive a class " +"from :class:`BaseRequestHandler` and redefine " +"its :meth:`~BaseRequestHandler.handle` method. You can then run various " +"versions of the service by combining one of the server classes with your " +"request handler class. The request handler class must be different for " +"datagram or stream services. This can be hidden by using the handler " +"subclasses :class:`StreamRequestHandler` or :class:`DatagramRequestHandler`." msgstr "" -#: ../../library/socketserver.rst:167 +#: ../../library/socketserver.rst:173 msgid "" "Of course, you still have to use your head! For instance, it makes no sense " "to use a forking server if the service contains state in memory that can be " @@ -249,7 +256,7 @@ msgid "" "probably have to use locks to protect the integrity of the shared data." msgstr "" -#: ../../library/socketserver.rst:174 +#: ../../library/socketserver.rst:180 msgid "" "On the other hand, if you are building an HTTP server where all data is " "stored externally (for instance, in the file system), a synchronous class " @@ -259,16 +266,16 @@ msgid "" "appropriate." msgstr "" -#: ../../library/socketserver.rst:180 +#: ../../library/socketserver.rst:186 msgid "" "In some cases, it may be appropriate to process part of a request " "synchronously, but to finish processing in a forked child depending on the " "request data. This can be implemented by using a synchronous server and " -"doing an explicit fork in the request handler class :meth:" -"`~BaseRequestHandler.handle` method." +"doing an explicit fork in the request handler " +"class :meth:`~BaseRequestHandler.handle` method." msgstr "" -#: ../../library/socketserver.rst:185 +#: ../../library/socketserver.rst:191 msgid "" "Another approach to handling multiple simultaneous requests in an " "environment that supports neither threads nor :func:`~os.fork` (or where " @@ -280,37 +287,38 @@ msgid "" "subprocesses cannot be used)." msgstr "" -#: ../../library/socketserver.rst:198 +#: ../../library/socketserver.rst:204 msgid "Server Objects" msgstr "" -#: ../../library/socketserver.rst:202 +#: ../../library/socketserver.rst:208 msgid "" "This is the superclass of all Server objects in the module. It defines the " "interface, given below, but does not implement most of the methods, which is " -"done in subclasses. The two parameters are stored in the respective :attr:" -"`server_address` and :attr:`RequestHandlerClass` attributes." +"done in subclasses. The two parameters are stored in the " +"respective :attr:`server_address` and :attr:`RequestHandlerClass` attributes." msgstr "" -#: ../../library/socketserver.rst:210 +#: ../../library/socketserver.rst:216 msgid "" "Return an integer file descriptor for the socket on which the server is " "listening. This function is most commonly passed to :mod:`selectors`, to " "allow monitoring multiple servers in the same process." msgstr "" -#: ../../library/socketserver.rst:217 +#: ../../library/socketserver.rst:223 msgid "" "Process a single request. This function calls the following methods in " -"order: :meth:`get_request`, :meth:`verify_request`, and :meth:" -"`process_request`. If the user-provided :meth:`~BaseRequestHandler.handle` " -"method of the handler class raises an exception, the server's :meth:" -"`handle_error` method will be called. If no request is received within :" -"attr:`timeout` seconds, :meth:`handle_timeout` will be called and :meth:" -"`handle_request` will return." +"order: :meth:`get_request`, :meth:`verify_request`, " +"and :meth:`process_request`. If the user-" +"provided :meth:`~BaseRequestHandler.handle` method of the handler class " +"raises an exception, the server's :meth:`handle_error` method will be " +"called. If no request is received within :attr:`timeout` " +"seconds, :meth:`handle_timeout` will be called and :meth:`handle_request` " +"will return." msgstr "" -#: ../../library/socketserver.rst:229 +#: ../../library/socketserver.rst:235 msgid "" "Handle requests until an explicit :meth:`shutdown` request. Poll for " "shutdown every *poll_interval* seconds. Ignores the :attr:`timeout` " @@ -320,68 +328,68 @@ msgid "" "clean up zombie child processes." msgstr "" -#: ../../library/socketserver.rst:237 +#: ../../library/socketserver.rst:243 msgid "Added ``service_actions`` call to the ``serve_forever`` method." msgstr "" -#: ../../library/socketserver.rst:243 +#: ../../library/socketserver.rst:249 msgid "" "This is called in the :meth:`serve_forever` loop. This method can be " "overridden by subclasses or mixin classes to perform actions specific to a " "given service, such as cleanup actions." msgstr "" -#: ../../library/socketserver.rst:251 +#: ../../library/socketserver.rst:257 msgid "" -"Tell the :meth:`serve_forever` loop to stop and wait until it does. :meth:" -"`shutdown` must be called while :meth:`serve_forever` is running in a " -"different thread otherwise it will deadlock." +"Tell the :meth:`serve_forever` loop to stop and wait until it " +"does. :meth:`shutdown` must be called while :meth:`serve_forever` is running " +"in a different thread otherwise it will deadlock." msgstr "" -#: ../../library/socketserver.rst:258 +#: ../../library/socketserver.rst:264 msgid "Clean up the server. May be overridden." msgstr "" -#: ../../library/socketserver.rst:263 +#: ../../library/socketserver.rst:269 msgid "" "The family of protocols to which the server's socket belongs. Common " -"examples are :const:`socket.AF_INET`, :const:`socket.AF_INET6`, and :const:" -"`socket.AF_UNIX`. Subclass the TCP or UDP server classes in this module " -"with class attribute ``address_family = AF_INET6`` set if you want IPv6 " -"server classes." +"examples are :const:`socket.AF_INET`, :const:`socket.AF_INET6`, " +"and :const:`socket.AF_UNIX`. Subclass the TCP or UDP server classes in this " +"module with class attribute ``address_family = AF_INET6`` set if you want " +"IPv6 server classes." msgstr "" -#: ../../library/socketserver.rst:272 +#: ../../library/socketserver.rst:278 msgid "" "The user-provided request handler class; an instance of this class is " "created for each request." msgstr "" -#: ../../library/socketserver.rst:278 +#: ../../library/socketserver.rst:284 msgid "" "The address on which the server is listening. The format of addresses " -"varies depending on the protocol family; see the documentation for the :mod:" -"`socket` module for details. For internet protocols, this is a tuple " -"containing a string giving the address, and an integer port number: " +"varies depending on the protocol family; see the documentation for " +"the :mod:`socket` module for details. For internet protocols, this is a " +"tuple containing a string giving the address, and an integer port number: " "``('127.0.0.1', 80)``, for example." msgstr "" -#: ../../library/socketserver.rst:287 +#: ../../library/socketserver.rst:293 msgid "" "The socket object on which the server will listen for incoming requests." msgstr "" -#: ../../library/socketserver.rst:290 +#: ../../library/socketserver.rst:296 msgid "The server classes support the following class variables:" msgstr "" -#: ../../library/socketserver.rst:296 +#: ../../library/socketserver.rst:302 msgid "" -"Whether the server will allow the reuse of an address. This defaults to :" -"const:`False`, and can be set in subclasses to change the policy." +"Whether the server will allow the reuse of an address. This defaults " +"to :const:`False`, and can be set in subclasses to change the policy." msgstr "" -#: ../../library/socketserver.rst:302 +#: ../../library/socketserver.rst:308 msgid "" "The size of the request queue. If it takes a long time to process a single " "request, any requests that arrive while the server is busy are placed into a " @@ -390,40 +398,40 @@ msgid "" "default value is usually 5, but this can be overridden by subclasses." msgstr "" -#: ../../library/socketserver.rst:311 +#: ../../library/socketserver.rst:317 msgid "" -"The type of socket used by the server; :const:`socket.SOCK_STREAM` and :" -"const:`socket.SOCK_DGRAM` are two common values." +"The type of socket used by the server; :const:`socket.SOCK_STREAM` " +"and :const:`socket.SOCK_DGRAM` are two common values." msgstr "" -#: ../../library/socketserver.rst:317 +#: ../../library/socketserver.rst:323 msgid "" "Timeout duration, measured in seconds, or :const:`None` if no timeout is " "desired. If :meth:`handle_request` receives no incoming requests within the " "timeout period, the :meth:`handle_timeout` method is called." msgstr "" -#: ../../library/socketserver.rst:322 +#: ../../library/socketserver.rst:328 msgid "" "There are various server methods that can be overridden by subclasses of " "base server classes like :class:`TCPServer`; these methods aren't useful to " "external users of the server object." msgstr "" -#: ../../library/socketserver.rst:331 +#: ../../library/socketserver.rst:337 msgid "" "Actually processes the request by instantiating :attr:`RequestHandlerClass` " "and calling its :meth:`~BaseRequestHandler.handle` method." msgstr "" -#: ../../library/socketserver.rst:337 +#: ../../library/socketserver.rst:343 msgid "" "Must accept a request from the socket, and return a 2-tuple containing the " "*new* socket object to be used to communicate with the client, and the " "client's address." msgstr "" -#: ../../library/socketserver.rst:344 +#: ../../library/socketserver.rst:350 msgid "" "This function is called if the :meth:`~BaseRequestHandler.handle` method of " "a :attr:`RequestHandlerClass` instance raises an exception. The default " @@ -431,11 +439,11 @@ msgid "" "further requests." msgstr "" -#: ../../library/socketserver.rst:349 +#: ../../library/socketserver.rst:355 msgid "Now only called for exceptions derived from the :exc:`Exception` class." msgstr "" -#: ../../library/socketserver.rst:356 +#: ../../library/socketserver.rst:362 msgid "" "This function is called when the :attr:`timeout` attribute has been set to a " "value other than :const:`None` and the timeout period has passed with no " @@ -444,28 +452,28 @@ msgid "" "threading servers this method does nothing." msgstr "" -#: ../../library/socketserver.rst:365 +#: ../../library/socketserver.rst:371 msgid "" -"Calls :meth:`finish_request` to create an instance of the :attr:" -"`RequestHandlerClass`. If desired, this function can create a new process " -"or thread to handle the request; the :class:`ForkingMixIn` and :class:" -"`ThreadingMixIn` classes do this." +"Calls :meth:`finish_request` to create an instance of " +"the :attr:`RequestHandlerClass`. If desired, this function can create a new " +"process or thread to handle the request; the :class:`ForkingMixIn` " +"and :class:`ThreadingMixIn` classes do this." msgstr "" -#: ../../library/socketserver.rst:377 +#: ../../library/socketserver.rst:383 msgid "" "Called by the server's constructor to activate the server. The default " "behavior for a TCP server just invokes :meth:`~socket.socket.listen` on the " "server's socket. May be overridden." msgstr "" -#: ../../library/socketserver.rst:384 +#: ../../library/socketserver.rst:390 msgid "" "Called by the server's constructor to bind the socket to the desired " "address. May be overridden." msgstr "" -#: ../../library/socketserver.rst:390 +#: ../../library/socketserver.rst:396 msgid "" "Must return a Boolean value; if the value is :const:`True`, the request will " "be processed, and if it's :const:`False`, the request will be denied. This " @@ -473,17 +481,17 @@ msgid "" "default implementation always returns :const:`True`." msgstr "" -#: ../../library/socketserver.rst:396 +#: ../../library/socketserver.rst:402 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`server_close`." msgstr "" -#: ../../library/socketserver.rst:402 +#: ../../library/socketserver.rst:408 msgid "Request Handler Objects" msgstr "" -#: ../../library/socketserver.rst:406 +#: ../../library/socketserver.rst:412 msgid "" "This is the superclass of all request handler objects. It defines the " "interface, given below. A concrete request handler subclass must define a " @@ -491,87 +499,87 @@ msgid "" "instance of the subclass is created for each request." msgstr "" -#: ../../library/socketserver.rst:415 +#: ../../library/socketserver.rst:421 msgid "" "Called before the :meth:`handle` method to perform any initialization " "actions required. The default implementation does nothing." msgstr "" -#: ../../library/socketserver.rst:421 +#: ../../library/socketserver.rst:427 msgid "" "This function must do all the work required to service a request. The " "default implementation does nothing. Several instance attributes are " "available to it; the request is available as :attr:`request`; the client " -"address as :attr:`client_address`; and the server instance as :attr:" -"`server`, in case it needs access to per-server information." +"address as :attr:`client_address`; and the server instance " +"as :attr:`server`, in case it needs access to per-server information." msgstr "" -#: ../../library/socketserver.rst:427 +#: ../../library/socketserver.rst:433 msgid "" "The type of :attr:`request` is different for datagram or stream services. " "For stream services, :attr:`request` is a socket object; for datagram " "services, :attr:`request` is a pair of string and socket." msgstr "" -#: ../../library/socketserver.rst:434 +#: ../../library/socketserver.rst:440 msgid "" "Called after the :meth:`handle` method to perform any clean-up actions " "required. The default implementation does nothing. If :meth:`setup` raises " "an exception, this function will not be called." msgstr "" -#: ../../library/socketserver.rst:441 +#: ../../library/socketserver.rst:447 msgid "" "The *new* :class:`socket.socket` object to be used to communicate with the " "client." msgstr "" -#: ../../library/socketserver.rst:447 +#: ../../library/socketserver.rst:453 msgid "Client address returned by :meth:`BaseServer.get_request`." msgstr "" -#: ../../library/socketserver.rst:452 +#: ../../library/socketserver.rst:458 msgid ":class:`BaseServer` object used for handling the request." msgstr "" -#: ../../library/socketserver.rst:458 +#: ../../library/socketserver.rst:464 msgid "" -"These :class:`BaseRequestHandler` subclasses override the :meth:" -"`~BaseRequestHandler.setup` and :meth:`~BaseRequestHandler.finish` methods, " -"and provide :attr:`rfile` and :attr:`wfile` attributes." +"These :class:`BaseRequestHandler` subclasses override " +"the :meth:`~BaseRequestHandler.setup` and :meth:`~BaseRequestHandler.finish` " +"methods, and provide :attr:`rfile` and :attr:`wfile` attributes." msgstr "" -#: ../../library/socketserver.rst:464 +#: ../../library/socketserver.rst:470 msgid "" -"A file object from which receives the request is read. Support the :class:" -"`io.BufferedIOBase` readable interface." +"A file object from which receives the request is read. Support " +"the :class:`io.BufferedIOBase` readable interface." msgstr "" -#: ../../library/socketserver.rst:469 +#: ../../library/socketserver.rst:475 msgid "" -"A file object to which the reply is written. Support the :class:`io." -"BufferedIOBase` writable interface" +"A file object to which the reply is written. Support " +"the :class:`io.BufferedIOBase` writable interface" msgstr "" -#: ../../library/socketserver.rst:473 +#: ../../library/socketserver.rst:479 msgid "" ":attr:`wfile` also supports the :class:`io.BufferedIOBase` writable " "interface." msgstr "" -#: ../../library/socketserver.rst:479 +#: ../../library/socketserver.rst:485 msgid "Examples" msgstr "範例" -#: ../../library/socketserver.rst:482 +#: ../../library/socketserver.rst:488 msgid ":class:`socketserver.TCPServer` Example" msgstr ":class:`socketserver.TCPServer` 範例" -#: ../../library/socketserver.rst:484 ../../library/socketserver.rst:595 +#: ../../library/socketserver.rst:490 ../../library/socketserver.rst:601 msgid "This is the server side::" msgstr "" -#: ../../library/socketserver.rst:486 +#: ../../library/socketserver.rst:492 msgid "" "import socketserver\n" "\n" @@ -608,14 +616,14 @@ msgid "" " server.serve_forever()" msgstr "" -#: ../../library/socketserver.rst:520 +#: ../../library/socketserver.rst:526 msgid "" "An alternative request handler class that makes use of streams (file-like " "objects that simplify communication by providing the standard file " "interface)::" msgstr "" -#: ../../library/socketserver.rst:523 +#: ../../library/socketserver.rst:529 msgid "" "class MyTCPHandler(socketserver.StreamRequestHandler):\n" "\n" @@ -631,7 +639,7 @@ msgid "" " self.wfile.write(self.data.upper())" msgstr "" -#: ../../library/socketserver.rst:536 +#: ../../library/socketserver.rst:542 msgid "" "The difference is that the ``readline()`` call in the second handler will " "call ``recv()`` multiple times until it encounters a newline character, " @@ -643,11 +651,11 @@ msgid "" "the number of ``recv()`` calls on the server required to receive it." msgstr "" -#: ../../library/socketserver.rst:546 ../../library/socketserver.rst:619 +#: ../../library/socketserver.rst:552 ../../library/socketserver.rst:625 msgid "This is the client side::" msgstr "" -#: ../../library/socketserver.rst:548 +#: ../../library/socketserver.rst:554 msgid "" "import socket\n" "import sys\n" @@ -669,15 +677,15 @@ msgid "" "print(\"Received:\", received)" msgstr "" -#: ../../library/socketserver.rst:568 ../../library/socketserver.rst:694 +#: ../../library/socketserver.rst:574 ../../library/socketserver.rst:700 msgid "The output of the example should look something like this:" msgstr "" -#: ../../library/socketserver.rst:570 +#: ../../library/socketserver.rst:576 msgid "Server:" msgstr "" -#: ../../library/socketserver.rst:572 +#: ../../library/socketserver.rst:578 msgid "" "$ python TCPServer.py\n" "127.0.0.1 wrote:\n" @@ -691,11 +699,11 @@ msgstr "" "127.0.0.1 wrote:\n" "b'python is nice'" -#: ../../library/socketserver.rst:580 +#: ../../library/socketserver.rst:586 msgid "Client:" msgstr "" -#: ../../library/socketserver.rst:582 +#: ../../library/socketserver.rst:588 msgid "" "$ python TCPClient.py hello world with TCP\n" "Sent: hello world with TCP\n" @@ -711,11 +719,11 @@ msgstr "" "Sent: python is nice\n" "Received: PYTHON IS NICE" -#: ../../library/socketserver.rst:593 +#: ../../library/socketserver.rst:599 msgid ":class:`socketserver.UDPServer` Example" msgstr ":class:`socketserver.UDPServer` 範例" -#: ../../library/socketserver.rst:597 +#: ../../library/socketserver.rst:603 msgid "" "import socketserver\n" "\n" @@ -740,7 +748,7 @@ msgid "" " server.serve_forever()" msgstr "" -#: ../../library/socketserver.rst:621 +#: ../../library/socketserver.rst:627 msgid "" "import socket\n" "import sys\n" @@ -760,27 +768,27 @@ msgid "" "print(\"Received:\", received)" msgstr "" -#: ../../library/socketserver.rst:638 +#: ../../library/socketserver.rst:644 msgid "" "The output of the example should look exactly like for the TCP server " "example." msgstr "" -#: ../../library/socketserver.rst:642 +#: ../../library/socketserver.rst:648 msgid "Asynchronous Mixins" msgstr "" -#: ../../library/socketserver.rst:644 +#: ../../library/socketserver.rst:650 msgid "" -"To build asynchronous handlers, use the :class:`ThreadingMixIn` and :class:" -"`ForkingMixIn` classes." +"To build asynchronous handlers, use the :class:`ThreadingMixIn` " +"and :class:`ForkingMixIn` classes." msgstr "" -#: ../../library/socketserver.rst:647 +#: ../../library/socketserver.rst:653 msgid "An example for the :class:`ThreadingMixIn` class::" msgstr "" -#: ../../library/socketserver.rst:649 +#: ../../library/socketserver.rst:655 msgid "" "import socket\n" "import threading\n" @@ -794,8 +802,8 @@ msgid "" " response = bytes(\"{}: {}\".format(cur_thread.name, data), 'ascii')\n" " self.request.sendall(response)\n" "\n" -"class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver." -"TCPServer):\n" +"class ThreadedTCPServer(socketserver.ThreadingMixIn, " +"socketserver.TCPServer):\n" " pass\n" "\n" "def client(ip, port, message):\n" @@ -828,7 +836,7 @@ msgid "" " server.shutdown()" msgstr "" -#: ../../library/socketserver.rst:696 +#: ../../library/socketserver.rst:702 msgid "" "$ python ThreadedTCPServer.py\n" "Server loop running in thread: Thread-1\n" @@ -842,7 +850,7 @@ msgstr "" "Received: Thread-3: Hello World 2\n" "Received: Thread-4: Hello World 3" -#: ../../library/socketserver.rst:705 +#: ../../library/socketserver.rst:711 msgid "" "The :class:`ForkingMixIn` class is used in the same way, except that the " "server will spawn a new process for each request. Available only on POSIX " diff --git a/library/sqlite3.po b/library/sqlite3.po index 3c5ccfd31d7..04ec4d7edd7 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,8 +38,8 @@ msgstr "" #: ../../library/sqlite3.rst:32 msgid "" "The :mod:`!sqlite3` module was written by Gerhard Häring. It provides an " -"SQL interface compliant with the DB-API 2.0 specification described by :pep:" -"`249`, and requires SQLite 3.15.2 or newer." +"SQL interface compliant with the DB-API 2.0 specification described " +"by :pep:`249`, and requires SQLite 3.15.2 or newer." msgstr "" #: ../../library/sqlite3.rst:36 @@ -128,8 +128,8 @@ msgstr "" #: ../../library/sqlite3.rst:89 msgid "" "In order to execute SQL statements and fetch results from SQL queries, we " -"will need to use a database cursor. Call :meth:`con.cursor() ` to create the :class:`Cursor`:" +"will need to use a database cursor. Call :meth:`con.cursor() " +"` to create the :class:`Cursor`:" msgstr "" #: ../../library/sqlite3.rst:93 @@ -142,8 +142,8 @@ msgid "" "database table ``movie`` with columns for title, release year, and review " "score. For simplicity, we can just use column names in the table declaration " "-- thanks to the `flexible typing`_ feature of SQLite, specifying the data " -"types is optional. Execute the ``CREATE TABLE`` statement by calling :meth:" -"`cur.execute(...) `:" +"types is optional. Execute the ``CREATE TABLE`` statement by " +"calling :meth:`cur.execute(...) `:" msgstr "" #: ../../library/sqlite3.rst:106 @@ -155,9 +155,9 @@ msgid "" "We can verify that the new table has been created by querying the " "``sqlite_master`` table built-in to SQLite, which should now contain an " "entry for the ``movie`` table definition (see `The Schema Table`_ for " -"details). Execute that query by calling :meth:`cur.execute(...) `, assign the result to ``res``, and call :meth:`res.fetchone() " -"` to fetch the resulting row:" +"details). Execute that query by calling :meth:`cur.execute(...) " +"`, assign the result to ``res``, and " +"call :meth:`res.fetchone() ` to fetch the resulting row:" msgstr "" #: ../../library/sqlite3.rst:121 @@ -172,9 +172,10 @@ msgstr "" #: ../../library/sqlite3.rst:127 msgid "" -"We can see that the table has been created, as the query returns a :class:" -"`tuple` containing the table's name. If we query ``sqlite_master`` for a non-" -"existent table ``spam``, :meth:`!res.fetchone` will return ``None``:" +"We can see that the table has been created, as the query returns " +"a :class:`tuple` containing the table's name. If we query ``sqlite_master`` " +"for a non-existent table ``spam``, :meth:`!res.fetchone` will return " +"``None``:" msgstr "" #: ../../library/sqlite3.rst:132 @@ -190,8 +191,8 @@ msgstr "" #: ../../library/sqlite3.rst:138 msgid "" "Now, add two rows of data supplied as SQL literals by executing an " -"``INSERT`` statement, once again by calling :meth:`cur.execute(...) `:" +"``INSERT`` statement, once again by calling :meth:`cur.execute(...) " +"`:" msgstr "" #: ../../library/sqlite3.rst:142 @@ -212,8 +213,8 @@ msgstr "" msgid "" "The ``INSERT`` statement implicitly opens a transaction, which needs to be " "committed before changes are saved in the database (see :ref:`sqlite3-" -"controlling-transactions` for details). Call :meth:`con.commit() ` on the connection object to commit the transaction:" +"controlling-transactions` for details). Call :meth:`con.commit() " +"` on the connection object to commit the transaction:" msgstr "" #: ../../library/sqlite3.rst:156 @@ -224,8 +225,8 @@ msgstr "con.commit()" msgid "" "We can verify that the data was inserted correctly by executing a ``SELECT`` " "query. Use the now-familiar :meth:`cur.execute(...) ` to " -"assign the result to ``res``, and call :meth:`res.fetchall() ` to return all resulting rows:" +"assign the result to ``res``, and call :meth:`res.fetchall() " +"` to return all resulting rows:" msgstr "" #: ../../library/sqlite3.rst:166 @@ -246,8 +247,8 @@ msgstr "" #: ../../library/sqlite3.rst:175 msgid "" -"Now, insert three more rows by calling :meth:`cur.executemany(...) `:" +"Now, insert three more rows by calling :meth:`cur.executemany(...) " +"`:" msgstr "" #: ../../library/sqlite3.rst:178 @@ -303,9 +304,10 @@ msgstr "" #: ../../library/sqlite3.rst:211 msgid "" -"Finally, verify that the database has been written to disk by calling :meth:" -"`con.close() ` to close the existing connection, opening a " -"new one, creating a new cursor, then querying the database:" +"Finally, verify that the database has been written to disk by " +"calling :meth:`con.close() ` to close the existing " +"connection, opening a new one, creating a new cursor, then querying the " +"database:" msgstr "" #: ../../library/sqlite3.rst:216 @@ -356,7 +358,7 @@ msgstr ":ref:`sqlite3-adapters`" msgid ":ref:`sqlite3-converters`" msgstr ":ref:`sqlite3-converters`" -#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:618 +#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:600 msgid ":ref:`sqlite3-connection-context-manager`" msgstr ":ref:`sqlite3-connection-context-manager`" @@ -394,9 +396,9 @@ msgstr "" #: ../../library/sqlite3.rst:277 msgid "" -"How many seconds the connection should wait before raising an :exc:" -"`OperationalError` when a table is locked. If another connection opens a " -"transaction to modify a table, that table will be locked until the " +"How many seconds the connection should wait before raising " +"an :exc:`OperationalError` when a table is locked. If another connection " +"opens a transaction to modify a table, that table will be locked until the " "transaction is committed. Default five seconds." msgstr "" @@ -405,19 +407,20 @@ msgid "" "Control whether and how data types not :ref:`natively supported by SQLite " "` are looked up to be converted to Python types, using the " "converters registered with :func:`register_converter`. Set it to any " -"combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` and :const:" -"`PARSE_COLNAMES` to enable this. Column names takes precedence over declared " -"types if both flags are set. By default (``0``), type detection is disabled." +"combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` " +"and :const:`PARSE_COLNAMES` to enable this. Column names takes precedence " +"over declared types if both flags are set. By default (``0``), type " +"detection is disabled." msgstr "" #: ../../library/sqlite3.rst:295 msgid "" -"Control legacy transaction handling behaviour. See :attr:`Connection." -"isolation_level` and :ref:`sqlite3-transaction-control-isolation-level` for " -"more information. Can be ``\"DEFERRED\"`` (default), ``\"EXCLUSIVE\"`` or " -"``\"IMMEDIATE\"``; or ``None`` to disable opening transactions implicitly. " -"Has no effect unless :attr:`Connection.autocommit` is set to :const:" -"`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." +"Control legacy transaction handling behaviour. " +"See :attr:`Connection.isolation_level` and :ref:`sqlite3-transaction-control-" +"isolation-level` for more information. Can be ``\"DEFERRED\"`` (default), " +"``\"EXCLUSIVE\"`` or ``\"IMMEDIATE\"``; or ``None`` to disable opening " +"transactions implicitly. Has no effect unless :attr:`Connection.autocommit` " +"is set to :const:`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." msgstr "" #: ../../library/sqlite3.rst:305 @@ -452,11 +455,11 @@ msgstr "" #: ../../library/sqlite3.rst:332 msgid "" -"Control :pep:`249` transaction handling behaviour. See :attr:`Connection." -"autocommit` and :ref:`sqlite3-transaction-control-autocommit` for more " -"information. *autocommit* currently defaults to :const:`~sqlite3." -"LEGACY_TRANSACTION_CONTROL`. The default will change to ``False`` in a " -"future Python release." +"Control :pep:`249` transaction handling behaviour. " +"See :attr:`Connection.autocommit` and :ref:`sqlite3-transaction-control-" +"autocommit` for more information. *autocommit* currently defaults " +"to :const:`~sqlite3.LEGACY_TRANSACTION_CONTROL`. The default will change to " +"``False`` in a future Python release." msgstr "" #: ../../library/sqlite3.rst:0 @@ -468,8 +471,8 @@ msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect`` with argument " "``database``." msgstr "" -"引發一個附帶引數 ``database`` 的\\ :ref:`稽核事件 ` ``sqlite3." -"connect``。" +"引發一個附帶引數 ``database`` 的\\ :ref:`稽核事件 ` " +"``sqlite3.connect``。" #: ../../library/sqlite3.rst:344 msgid "" @@ -617,8 +620,8 @@ msgstr "" #: ../../library/sqlite3.rst:459 msgid "" -"Generated fields (for example ``MAX(p)``) are returned as :class:`str`. Use :" -"const:`!PARSE_COLNAMES` to enforce types for such queries." +"Generated fields (for example ``MAX(p)``) are returned as :class:`str`. " +"Use :const:`!PARSE_COLNAMES` to enforce types for such queries." msgstr "" #: ../../library/sqlite3.rst:464 @@ -685,8 +688,8 @@ msgstr "" #: ../../library/sqlite3.rst:510 msgid "" -"Version number of the runtime SQLite library as a :class:`tuple` of :class:" -"`integers `." +"Version number of the runtime SQLite library as a :class:`tuple` " +"of :class:`integers `." msgstr "" #: ../../library/sqlite3.rst:515 @@ -782,102 +785,89 @@ msgstr "" msgid "Set *threadsafety* dynamically instead of hard-coding it to ``1``." msgstr "" -#: ../../library/sqlite3.rst:552 +#: ../../library/sqlite3.rst:569 msgid "" -"Version number of this module as a :class:`string `. This is not the " -"version of the SQLite library." +"These constants are used for the :meth:`Connection.setconfig` " +"and :meth:`~Connection.getconfig` methods." msgstr "" -#: ../../library/sqlite3.rst:555 ../../library/sqlite3.rst:565 -msgid "" -"This constant used to reflect the version number of the ``pysqlite`` " -"package, a third-party library which used to upstream changes to :mod:`!" -"sqlite3`. Today, it carries no meaning or practical value." -msgstr "" - -#: ../../library/sqlite3.rst:562 -msgid "" -"Version number of this module as a :class:`tuple` of :class:`integers " -"`. This is not the version of the SQLite library." -msgstr "" - -#: ../../library/sqlite3.rst:589 -msgid "" -"These constants are used for the :meth:`Connection.setconfig` and :meth:" -"`~Connection.getconfig` methods." -msgstr "" - -#: ../../library/sqlite3.rst:592 +#: ../../library/sqlite3.rst:572 msgid "" "The availability of these constants varies depending on the version of " "SQLite Python was compiled with." msgstr "" -#: ../../library/sqlite3.rst:599 +#: ../../library/sqlite3.rst:579 msgid "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" msgstr "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" -#: ../../library/sqlite3.rst:600 +#: ../../library/sqlite3.rst:580 msgid "SQLite docs: Database Connection Configuration Options" msgstr "" -#: ../../library/sqlite3.rst:606 +#: ../../library/sqlite3.rst:582 +msgid "The :data:`!version` and :data:`!version_info` constants." +msgstr "" + +#: ../../library/sqlite3.rst:588 msgid "Connection objects" msgstr "Connection 物件" -#: ../../library/sqlite3.rst:610 +#: ../../library/sqlite3.rst:592 msgid "" "Each open SQLite database is represented by a ``Connection`` object, which " -"is created using :func:`sqlite3.connect`. Their main purpose is creating :" -"class:`Cursor` objects, and :ref:`sqlite3-controlling-transactions`." +"is created using :func:`sqlite3.connect`. Their main purpose is " +"creating :class:`Cursor` objects, and :ref:`sqlite3-controlling-" +"transactions`." msgstr "" -#: ../../library/sqlite3.rst:617 +#: ../../library/sqlite3.rst:599 msgid ":ref:`sqlite3-connection-shortcuts`" msgstr ":ref:`sqlite3-connection-shortcuts`" -#: ../../library/sqlite3.rst:623 +#: ../../library/sqlite3.rst:605 msgid "" -"A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before a :" -"class:`!Connection` object is deleted." +"A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before " +"a :class:`!Connection` object is deleted." msgstr "" -#: ../../library/sqlite3.rst:626 +#: ../../library/sqlite3.rst:608 msgid "An SQLite database connection has the following attributes and methods:" msgstr "一個 SQLite 資料庫連線具有以下屬性和方法:" -#: ../../library/sqlite3.rst:630 +#: ../../library/sqlite3.rst:612 msgid "" "Create and return a :class:`Cursor` object. The cursor method accepts a " -"single optional parameter *factory*. If supplied, this must be a :term:" -"`callable` returning an instance of :class:`Cursor` or its subclasses." +"single optional parameter *factory*. If supplied, this must be " +"a :term:`callable` returning an instance of :class:`Cursor` or its " +"subclasses." msgstr "" -#: ../../library/sqlite3.rst:637 +#: ../../library/sqlite3.rst:619 msgid "" "Open a :class:`Blob` handle to an existing :abbr:`BLOB (Binary Large " "OBject)`." msgstr "" -#: ../../library/sqlite3.rst:640 +#: ../../library/sqlite3.rst:622 msgid "The name of the table where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:643 +#: ../../library/sqlite3.rst:625 msgid "The name of the column where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:646 +#: ../../library/sqlite3.rst:628 msgid "The name of the row where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:649 +#: ../../library/sqlite3.rst:631 msgid "" "Set to ``True`` if the blob should be opened without write permissions. " "Defaults to ``False``." msgstr "" -#: ../../library/sqlite3.rst:654 +#: ../../library/sqlite3.rst:636 msgid "" "The name of the database where the blob is located. Defaults to ``\"main\"``." msgstr "" @@ -886,33 +876,33 @@ msgstr "" msgid "Raises" msgstr "" -#: ../../library/sqlite3.rst:658 +#: ../../library/sqlite3.rst:640 msgid "When trying to open a blob in a ``WITHOUT ROWID`` table." msgstr "" -#: ../../library/sqlite3.rst:665 +#: ../../library/sqlite3.rst:647 msgid "" "The blob size cannot be changed using the :class:`Blob` class. Use the SQL " "function ``zeroblob`` to create a blob with a fixed size." msgstr "" -#: ../../library/sqlite3.rst:672 +#: ../../library/sqlite3.rst:654 msgid "" "Commit any pending transaction to the database. If :attr:`autocommit` is " -"``True``, or there is no open transaction, this method does nothing. If :" -"attr:`!autocommit` is ``False``, a new transaction is implicitly opened if a " -"pending transaction was committed by this method." +"``True``, or there is no open transaction, this method does nothing. " +"If :attr:`!autocommit` is ``False``, a new transaction is implicitly opened " +"if a pending transaction was committed by this method." msgstr "" -#: ../../library/sqlite3.rst:680 +#: ../../library/sqlite3.rst:662 msgid "" "Roll back to the start of any pending transaction. If :attr:`autocommit` is " -"``True``, or there is no open transaction, this method does nothing. If :" -"attr:`!autocommit` is ``False``, a new transaction is implicitly opened if a " -"pending transaction was rolled back by this method." +"``True``, or there is no open transaction, this method does nothing. " +"If :attr:`!autocommit` is ``False``, a new transaction is implicitly opened " +"if a pending transaction was rolled back by this method." msgstr "" -#: ../../library/sqlite3.rst:688 +#: ../../library/sqlite3.rst:670 msgid "" "Close the database connection. If :attr:`autocommit` is ``False``, any " "pending transaction is implicitly rolled back. If :attr:`!autocommit` is " @@ -921,63 +911,63 @@ msgid "" "losing pending changes." msgstr "" -#: ../../library/sqlite3.rst:698 +#: ../../library/sqlite3.rst:680 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.execute` on it " "with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:704 +#: ../../library/sqlite3.rst:686 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executemany` on " "it with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:710 +#: ../../library/sqlite3.rst:692 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executescript` " "on it with the given *sql_script*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:716 +#: ../../library/sqlite3.rst:698 msgid "Create or remove a user-defined SQL function." msgstr "" -#: ../../library/sqlite3.rst:718 +#: ../../library/sqlite3.rst:700 msgid "The name of the SQL function." msgstr "" -#: ../../library/sqlite3.rst:721 +#: ../../library/sqlite3.rst:703 msgid "" "The number of arguments the SQL function can accept. If ``-1``, it may take " "any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:725 +#: ../../library/sqlite3.rst:707 msgid "" "A :term:`callable` that is called when the SQL function is invoked. The " "callable must return :ref:`a type natively supported by SQLite `. Set to ``None`` to remove an existing SQL function." msgstr "" -#: ../../library/sqlite3.rst:732 +#: ../../library/sqlite3.rst:714 msgid "" "If ``True``, the created SQL function is marked as `deterministic `_, which allows SQLite to perform additional " "optimizations." msgstr "" -#: ../../library/sqlite3.rst:737 +#: ../../library/sqlite3.rst:719 msgid "Added the *deterministic* parameter." msgstr "新增 *deterministic* 參數。" -#: ../../library/sqlite3.rst:740 ../../library/sqlite3.rst:784 -#: ../../library/sqlite3.rst:852 ../../library/sqlite3.rst:1131 -#: ../../library/sqlite3.rst:1553 ../../library/sqlite3.rst:1596 +#: ../../library/sqlite3.rst:722 ../../library/sqlite3.rst:766 +#: ../../library/sqlite3.rst:834 ../../library/sqlite3.rst:1113 +#: ../../library/sqlite3.rst:1537 ../../library/sqlite3.rst:1578 msgid "Example:" msgstr "範例:" -#: ../../library/sqlite3.rst:742 +#: ../../library/sqlite3.rst:724 msgid "" ">>> import hashlib\n" ">>> def md5sum(t):\n" @@ -999,27 +989,27 @@ msgstr "" "('acbd18db4cc2f85cedef654fccc4a4d8',)\n" ">>> con.close()" -#: ../../library/sqlite3.rst:756 +#: ../../library/sqlite3.rst:738 msgid "" "Passing *name*, *narg*, and *func* as keyword arguments is deprecated. These " "parameters will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:762 +#: ../../library/sqlite3.rst:744 msgid "Create or remove a user-defined SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:764 +#: ../../library/sqlite3.rst:746 msgid "The name of the SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:767 +#: ../../library/sqlite3.rst:749 msgid "" "The number of arguments the SQL aggregate function can accept. If ``-1``, it " "may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:771 +#: ../../library/sqlite3.rst:753 msgid "" "A class must implement the following methods: * ``step()``: Add a row to " "the aggregate. * ``finalize()``: Return the final result of the aggregate " @@ -1028,31 +1018,31 @@ msgid "" "*n_arg*. Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:772 +#: ../../library/sqlite3.rst:754 msgid "A class must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:774 +#: ../../library/sqlite3.rst:756 msgid "``step()``: Add a row to the aggregate." msgstr "" -#: ../../library/sqlite3.rst:775 ../../library/sqlite3.rst:836 +#: ../../library/sqlite3.rst:757 ../../library/sqlite3.rst:818 msgid "" "``finalize()``: Return the final result of the aggregate as :ref:`a type " "natively supported by SQLite `." msgstr "" -#: ../../library/sqlite3.rst:778 +#: ../../library/sqlite3.rst:760 msgid "" "The number of arguments that the ``step()`` method must accept is controlled " "by *n_arg*." msgstr "" -#: ../../library/sqlite3.rst:781 +#: ../../library/sqlite3.rst:763 msgid "Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:786 +#: ../../library/sqlite3.rst:768 msgid "" "class MySum:\n" " def __init__(self):\n" @@ -1094,27 +1084,27 @@ msgstr "" "\n" "con.close()" -#: ../../library/sqlite3.rst:815 +#: ../../library/sqlite3.rst:797 msgid "" "Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is " "deprecated. These parameters will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:821 +#: ../../library/sqlite3.rst:803 msgid "Create or remove a user-defined aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:823 +#: ../../library/sqlite3.rst:805 msgid "The name of the SQL aggregate window function to create or remove." msgstr "" -#: ../../library/sqlite3.rst:826 +#: ../../library/sqlite3.rst:808 msgid "" "The number of arguments the SQL aggregate window function can accept. If " "``-1``, it may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:830 +#: ../../library/sqlite3.rst:812 msgid "" "A class that must implement the following methods: * ``step()``: Add a row " "to the current window. * ``value()``: Return the current value of the " @@ -1126,39 +1116,39 @@ msgid "" "function." msgstr "" -#: ../../library/sqlite3.rst:831 +#: ../../library/sqlite3.rst:813 msgid "A class that must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:833 +#: ../../library/sqlite3.rst:815 msgid "``step()``: Add a row to the current window." msgstr "" -#: ../../library/sqlite3.rst:834 +#: ../../library/sqlite3.rst:816 msgid "``value()``: Return the current value of the aggregate." msgstr "" -#: ../../library/sqlite3.rst:835 +#: ../../library/sqlite3.rst:817 msgid "``inverse()``: Remove a row from the current window." msgstr "" -#: ../../library/sqlite3.rst:839 +#: ../../library/sqlite3.rst:821 msgid "" "The number of arguments that the ``step()`` and ``value()`` methods must " "accept is controlled by *num_params*." msgstr "" -#: ../../library/sqlite3.rst:842 +#: ../../library/sqlite3.rst:824 msgid "Set to ``None`` to remove an existing SQL aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:844 +#: ../../library/sqlite3.rst:826 msgid "" "If used with a version of SQLite older than 3.25.0, which does not support " "aggregate window functions." msgstr "" -#: ../../library/sqlite3.rst:854 +#: ../../library/sqlite3.rst:836 msgid "" "# Example taken from https://www.sqlite.org/windowfunctions.html#udfwinfunc\n" "class WindowSumInt:\n" @@ -1206,30 +1196,30 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:908 +#: ../../library/sqlite3.rst:890 msgid "" "Create a collation named *name* using the collating function *callable*. " "*callable* is passed two :class:`string ` arguments, and it should " "return an :class:`integer `:" msgstr "" -#: ../../library/sqlite3.rst:912 +#: ../../library/sqlite3.rst:894 msgid "``1`` if the first is ordered higher than the second" msgstr "" -#: ../../library/sqlite3.rst:913 +#: ../../library/sqlite3.rst:895 msgid "``-1`` if the first is ordered lower than the second" msgstr "" -#: ../../library/sqlite3.rst:914 +#: ../../library/sqlite3.rst:896 msgid "``0`` if they are ordered equal" msgstr "" -#: ../../library/sqlite3.rst:916 +#: ../../library/sqlite3.rst:898 msgid "The following example shows a reverse sorting collation:" msgstr "" -#: ../../library/sqlite3.rst:918 +#: ../../library/sqlite3.rst:900 msgid "" "def collate_reverse(string1, string2):\n" " if string1 == string2:\n" @@ -1267,33 +1257,33 @@ msgstr "" " print(row)\n" "con.close()" -#: ../../library/sqlite3.rst:944 +#: ../../library/sqlite3.rst:926 msgid "Remove a collation function by setting *callable* to ``None``." msgstr "" -#: ../../library/sqlite3.rst:946 +#: ../../library/sqlite3.rst:928 msgid "" "The collation name can contain any Unicode character. Earlier, only ASCII " "characters were allowed." msgstr "" -#: ../../library/sqlite3.rst:953 +#: ../../library/sqlite3.rst:935 msgid "" "Call this method from a different thread to abort any queries that might be " -"executing on the connection. Aborted queries will raise an :exc:" -"`OperationalError`." +"executing on the connection. Aborted queries will raise " +"an :exc:`OperationalError`." msgstr "" -#: ../../library/sqlite3.rst:960 +#: ../../library/sqlite3.rst:942 msgid "" "Register :term:`callable` *authorizer_callback* to be invoked for each " "attempt to access a column of a table in the database. The callback should " -"return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, or :const:" -"`SQLITE_IGNORE` to signal how access to the column should be handled by the " -"underlying SQLite library." +"return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, " +"or :const:`SQLITE_IGNORE` to signal how access to the column should be " +"handled by the underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:967 +#: ../../library/sqlite3.rst:949 msgid "" "The first argument to the callback signifies what kind of operation is to be " "authorized. The second and third argument will be arguments or ``None`` " @@ -1303,7 +1293,7 @@ msgid "" "attempt or ``None`` if this access attempt is directly from input SQL code." msgstr "" -#: ../../library/sqlite3.rst:974 +#: ../../library/sqlite3.rst:956 msgid "" "Please consult the SQLite documentation about the possible values for the " "first argument and the meaning of the second and third argument depending on " @@ -1311,21 +1301,21 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:978 +#: ../../library/sqlite3.rst:960 msgid "Passing ``None`` as *authorizer_callback* will disable the authorizer." msgstr "" -#: ../../library/sqlite3.rst:980 +#: ../../library/sqlite3.rst:962 msgid "Added support for disabling the authorizer using ``None``." msgstr "" -#: ../../library/sqlite3.rst:983 +#: ../../library/sqlite3.rst:965 msgid "" "Passing *authorizer_callback* as a keyword argument is deprecated. The " "parameter will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:990 +#: ../../library/sqlite3.rst:972 msgid "" "Register :term:`callable` *progress_handler* to be invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " @@ -1333,59 +1323,60 @@ msgid "" "a GUI." msgstr "" -#: ../../library/sqlite3.rst:995 +#: ../../library/sqlite3.rst:977 msgid "" "If you want to clear any previously installed progress handler, call the " "method with ``None`` for *progress_handler*." msgstr "" -#: ../../library/sqlite3.rst:998 +#: ../../library/sqlite3.rst:980 msgid "" "Returning a non-zero value from the handler function will terminate the " "currently executing query and cause it to raise a :exc:`DatabaseError` " "exception." msgstr "" -#: ../../library/sqlite3.rst:1002 +#: ../../library/sqlite3.rst:984 msgid "" "Passing *progress_handler* as a keyword argument is deprecated. The " "parameter will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:1009 +#: ../../library/sqlite3.rst:991 msgid "" "Register :term:`callable` *trace_callback* to be invoked for each SQL " "statement that is actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:1012 +#: ../../library/sqlite3.rst:994 msgid "" "The only argument passed to the callback is the statement (as :class:`str`) " "that is being executed. The return value of the callback is ignored. Note " -"that the backend does not only run statements passed to the :meth:`Cursor." -"execute` methods. Other sources include the :ref:`transaction management " -"` of the :mod:`!sqlite3` module and the " -"execution of triggers defined in the current database." +"that the backend does not only run statements passed to " +"the :meth:`Cursor.execute` methods. Other sources include " +"the :ref:`transaction management ` of " +"the :mod:`!sqlite3` module and the execution of triggers defined in the " +"current database." msgstr "" -#: ../../library/sqlite3.rst:1020 +#: ../../library/sqlite3.rst:1002 msgid "Passing ``None`` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:1023 +#: ../../library/sqlite3.rst:1005 msgid "" "Exceptions raised in the trace callback are not propagated. As a development " "and debugging aid, use :meth:`~sqlite3.enable_callback_tracebacks` to enable " "printing tracebacks from exceptions raised in the trace callback." msgstr "" -#: ../../library/sqlite3.rst:1030 +#: ../../library/sqlite3.rst:1012 msgid "" "Passing *trace_callback* as a keyword argument is deprecated. The parameter " "will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:1037 +#: ../../library/sqlite3.rst:1019 msgid "" "Enable the SQLite engine to load SQLite extensions from shared libraries if " "*enabled* is ``True``; else, disallow loading SQLite extensions. SQLite " @@ -1394,16 +1385,16 @@ msgid "" "distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:1046 +#: ../../library/sqlite3.rst:1028 msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " "are compiled without this feature. To get loadable extension support, you " -"must pass the :option:`--enable-loadable-sqlite-extensions` option to :" -"program:`configure`." +"must pass the :option:`--enable-loadable-sqlite-extensions` option " +"to :program:`configure`." msgstr "" -#: ../../library/sqlite3.rst:1053 +#: ../../library/sqlite3.rst:1035 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." @@ -1411,11 +1402,11 @@ msgstr "" "引發一個附帶引數 ``connection``、``enabled`` 的\\ :ref:`稽核事件 ` " "``sqlite3.enable_load_extension``。" -#: ../../library/sqlite3.rst:1057 +#: ../../library/sqlite3.rst:1039 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "加入 ``sqlite3.enable_load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1063 +#: ../../library/sqlite3.rst:1045 msgid "" "con.enable_load_extension(True)\n" "\n" @@ -1445,24 +1436,24 @@ msgid "" " print(row)" msgstr "" -#: ../../library/sqlite3.rst:1089 +#: ../../library/sqlite3.rst:1071 msgid "" "Load an SQLite extension from a shared library. Enable extension loading " "with :meth:`enable_load_extension` before calling this method." msgstr "" -#: ../../library/sqlite3.rst:1093 +#: ../../library/sqlite3.rst:1075 msgid "The path to the SQLite extension." msgstr "" -#: ../../library/sqlite3.rst:1097 +#: ../../library/sqlite3.rst:1079 msgid "" "Entry point name. If ``None`` (the default), SQLite will come up with an " "entry point name of its own; see the SQLite docs `Loading an Extension`_ for " "details." msgstr "" -#: ../../library/sqlite3.rst:1106 +#: ../../library/sqlite3.rst:1088 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." @@ -1470,29 +1461,29 @@ msgstr "" "引發一個附帶引數 ``connection``、``path`` 的\\ :ref:`稽核事件 ` " "``sqlite3.load_extension``。" -#: ../../library/sqlite3.rst:1110 +#: ../../library/sqlite3.rst:1092 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "加入 ``sqlite3.load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1113 +#: ../../library/sqlite3.rst:1095 msgid "Added the *entrypoint* parameter." msgstr "新增 *entrypoint* 參數。" -#: ../../library/sqlite3.rst:1120 +#: ../../library/sqlite3.rst:1102 msgid "" "Return an :term:`iterator` to dump the database as SQL source code. Useful " -"when saving an in-memory database for later restoration. Similar to the ``." -"dump`` command in the :program:`sqlite3` shell." +"when saving an in-memory database for later restoration. Similar to the " +"``.dump`` command in the :program:`sqlite3` shell." msgstr "" -#: ../../library/sqlite3.rst:1124 +#: ../../library/sqlite3.rst:1106 msgid "" "An optional ``LIKE`` pattern for database objects to dump, e.g. " "``prefix_%``. If ``None`` (the default), all database objects will be " "included." msgstr "" -#: ../../library/sqlite3.rst:1133 +#: ../../library/sqlite3.rst:1115 msgid "" "# Convert file example.db to SQL dump file dump.sql\n" "con = sqlite3.connect('example.db')\n" @@ -1502,35 +1493,35 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1144 ../../library/sqlite3.rst:1218 +#: ../../library/sqlite3.rst:1126 ../../library/sqlite3.rst:1200 msgid ":ref:`sqlite3-howto-encoding`" msgstr ":ref:`sqlite3-howto-encoding`" -#: ../../library/sqlite3.rst:1146 +#: ../../library/sqlite3.rst:1128 msgid "Added the *filter* parameter." msgstr "新增 *filter* 參數。" -#: ../../library/sqlite3.rst:1151 +#: ../../library/sqlite3.rst:1133 msgid "Create a backup of an SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1153 +#: ../../library/sqlite3.rst:1135 msgid "" "Works even if the database is being accessed by other clients or " "concurrently by the same connection." msgstr "" -#: ../../library/sqlite3.rst:1156 +#: ../../library/sqlite3.rst:1138 msgid "The database connection to save the backup to." msgstr "" -#: ../../library/sqlite3.rst:1159 +#: ../../library/sqlite3.rst:1141 msgid "" "The number of pages to copy at a time. If equal to or less than ``0``, the " "entire database is copied in a single step. Defaults to ``-1``." msgstr "" -#: ../../library/sqlite3.rst:1165 +#: ../../library/sqlite3.rst:1147 msgid "" "If set to a :term:`callable`, it is invoked with three integer arguments for " "every backup iteration: the *status* of the last iteration, the *remaining* " @@ -1538,24 +1529,24 @@ msgid "" "Defaults to ``None``." msgstr "" -#: ../../library/sqlite3.rst:1174 +#: ../../library/sqlite3.rst:1156 msgid "" "The name of the database to back up. Either ``\"main\"`` (the default) for " "the main database, ``\"temp\"`` for the temporary database, or the name of a " "custom database as attached using the ``ATTACH DATABASE`` SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1181 +#: ../../library/sqlite3.rst:1163 msgid "" "The number of seconds to sleep between successive attempts to back up " "remaining pages." msgstr "" -#: ../../library/sqlite3.rst:1185 +#: ../../library/sqlite3.rst:1167 msgid "Example 1, copy an existing database into another:" msgstr "" -#: ../../library/sqlite3.rst:1187 +#: ../../library/sqlite3.rst:1169 msgid "" "def progress(status, remaining, total):\n" " print(f'Copied {total-remaining} of {total} pages...')\n" @@ -1577,11 +1568,11 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1204 +#: ../../library/sqlite3.rst:1186 msgid "Example 2, copy an existing database into a transient copy:" msgstr "" -#: ../../library/sqlite3.rst:1206 +#: ../../library/sqlite3.rst:1188 msgid "" "src = sqlite3.connect('example.db')\n" "dst = sqlite3.connect(':memory:')\n" @@ -1595,25 +1586,25 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1222 +#: ../../library/sqlite3.rst:1204 msgid "Get a connection runtime limit." msgstr "" -#: ../../library/sqlite3.rst:1224 +#: ../../library/sqlite3.rst:1206 msgid "The `SQLite limit category`_ to be queried." msgstr "" -#: ../../library/sqlite3.rst:1229 ../../library/sqlite3.rst:1266 +#: ../../library/sqlite3.rst:1211 ../../library/sqlite3.rst:1248 msgid "If *category* is not recognised by the underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:1232 +#: ../../library/sqlite3.rst:1214 msgid "" -"Example, query the maximum length of an SQL statement for :class:" -"`Connection` ``con`` (the default is 1000000000):" +"Example, query the maximum length of an SQL statement " +"for :class:`Connection` ``con`` (the default is 1000000000):" msgstr "" -#: ../../library/sqlite3.rst:1242 +#: ../../library/sqlite3.rst:1224 msgid "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" @@ -1621,7 +1612,7 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" -#: ../../library/sqlite3.rst:1252 +#: ../../library/sqlite3.rst:1234 msgid "" "Set a connection runtime limit. Attempts to increase a limit above its hard " "upper bound are silently truncated to the hard upper bound. Regardless of " @@ -1629,22 +1620,22 @@ msgid "" "returned." msgstr "" -#: ../../library/sqlite3.rst:1257 +#: ../../library/sqlite3.rst:1239 msgid "The `SQLite limit category`_ to be set." msgstr "" -#: ../../library/sqlite3.rst:1260 +#: ../../library/sqlite3.rst:1242 msgid "" "The value of the new limit. If negative, the current limit is unchanged." msgstr "" -#: ../../library/sqlite3.rst:1269 +#: ../../library/sqlite3.rst:1251 msgid "" "Example, limit the number of attached databases to 1 for :class:`Connection` " "``con`` (the default limit is 10):" msgstr "" -#: ../../library/sqlite3.rst:1272 +#: ../../library/sqlite3.rst:1254 msgid "" ">>> con.setlimit(sqlite3.SQLITE_LIMIT_ATTACHED, 1)\n" "10\n" @@ -1656,25 +1647,25 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_ATTACHED)\n" "1" -#: ../../library/sqlite3.rst:1290 +#: ../../library/sqlite3.rst:1272 msgid "Query a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1292 ../../library/sqlite3.rst:1303 +#: ../../library/sqlite3.rst:1274 ../../library/sqlite3.rst:1285 msgid "A :ref:`SQLITE_DBCONFIG code `." msgstr "" -#: ../../library/sqlite3.rst:1301 +#: ../../library/sqlite3.rst:1283 msgid "Set a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1306 +#: ../../library/sqlite3.rst:1288 msgid "" "``True`` if the configuration option should be enabled (default); ``False`` " "if it should be disabled." msgstr "" -#: ../../library/sqlite3.rst:1314 +#: ../../library/sqlite3.rst:1296 msgid "" "Serialize a database into a :class:`bytes` object. For an ordinary on-disk " "database file, the serialization is just a copy of the disk file. For an in-" @@ -1683,114 +1674,114 @@ msgid "" "backed up to disk." msgstr "" -#: ../../library/sqlite3.rst:1320 +#: ../../library/sqlite3.rst:1302 msgid "The database name to be serialized. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1328 +#: ../../library/sqlite3.rst:1310 msgid "" "This method is only available if the underlying SQLite library has the " "serialize API." msgstr "" -#: ../../library/sqlite3.rst:1336 +#: ../../library/sqlite3.rst:1318 msgid "" -"Deserialize a :meth:`serialized ` database into a :class:" -"`Connection`. This method causes the database connection to disconnect from " -"database *name*, and reopen *name* as an in-memory database based on the " -"serialization contained in *data*." +"Deserialize a :meth:`serialized ` database into " +"a :class:`Connection`. This method causes the database connection to " +"disconnect from database *name*, and reopen *name* as an in-memory database " +"based on the serialization contained in *data*." msgstr "" -#: ../../library/sqlite3.rst:1342 +#: ../../library/sqlite3.rst:1324 msgid "A serialized database." msgstr "" -#: ../../library/sqlite3.rst:1345 +#: ../../library/sqlite3.rst:1327 msgid "The database name to deserialize into. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1349 +#: ../../library/sqlite3.rst:1331 msgid "" "If the database connection is currently involved in a read transaction or a " "backup operation." msgstr "" -#: ../../library/sqlite3.rst:1353 +#: ../../library/sqlite3.rst:1335 msgid "If *data* does not contain a valid SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1356 +#: ../../library/sqlite3.rst:1338 msgid "If :func:`len(data) ` is larger than ``2**63 - 1``." msgstr "" -#: ../../library/sqlite3.rst:1361 +#: ../../library/sqlite3.rst:1343 msgid "" "This method is only available if the underlying SQLite library has the " "deserialize API." msgstr "" -#: ../../library/sqlite3.rst:1368 +#: ../../library/sqlite3.rst:1350 msgid "" "This attribute controls :pep:`249`-compliant transaction behaviour. :attr:`!" "autocommit` has three allowed values:" msgstr "" -#: ../../library/sqlite3.rst:1371 +#: ../../library/sqlite3.rst:1353 msgid "" -"``False``: Select :pep:`249`-compliant transaction behaviour, implying that :" -"mod:`!sqlite3` ensures a transaction is always open. Use :meth:`commit` and :" -"meth:`rollback` to close transactions." +"``False``: Select :pep:`249`-compliant transaction behaviour, implying " +"that :mod:`!sqlite3` ensures a transaction is always open. " +"Use :meth:`commit` and :meth:`rollback` to close transactions." msgstr "" -#: ../../library/sqlite3.rst:1375 +#: ../../library/sqlite3.rst:1357 msgid "This is the recommended value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1377 +#: ../../library/sqlite3.rst:1359 msgid "" -"``True``: Use SQLite's `autocommit mode`_. :meth:`commit` and :meth:" -"`rollback` have no effect in this mode." +"``True``: Use SQLite's `autocommit mode`_. :meth:`commit` " +"and :meth:`rollback` have no effect in this mode." msgstr "" -#: ../../library/sqlite3.rst:1380 +#: ../../library/sqlite3.rst:1362 msgid "" ":data:`LEGACY_TRANSACTION_CONTROL`: Pre-Python 3.12 (non-:pep:`249`-" "compliant) transaction control. See :attr:`isolation_level` for more details." msgstr "" -#: ../../library/sqlite3.rst:1384 +#: ../../library/sqlite3.rst:1366 msgid "This is currently the default value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1386 +#: ../../library/sqlite3.rst:1368 msgid "" "Changing :attr:`!autocommit` to ``False`` will open a new transaction, and " "changing it to ``True`` will commit any pending transaction." msgstr "" -#: ../../library/sqlite3.rst:1389 +#: ../../library/sqlite3.rst:1371 msgid "See :ref:`sqlite3-transaction-control-autocommit` for more details." msgstr "更多詳情請見 :ref:`sqlite3-transaction-control-autocommit`。" -#: ../../library/sqlite3.rst:1393 +#: ../../library/sqlite3.rst:1375 msgid "" -"The :attr:`isolation_level` attribute has no effect unless :attr:" -"`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." +"The :attr:`isolation_level` attribute has no effect " +"unless :attr:`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." msgstr "" -#: ../../library/sqlite3.rst:1400 +#: ../../library/sqlite3.rst:1382 msgid "" "This read-only attribute corresponds to the low-level SQLite `autocommit " "mode`_." msgstr "" -#: ../../library/sqlite3.rst:1403 +#: ../../library/sqlite3.rst:1385 msgid "" "``True`` if a transaction is active (there are uncommitted changes), " "``False`` otherwise." msgstr "" -#: ../../library/sqlite3.rst:1410 +#: ../../library/sqlite3.rst:1392 msgid "" "Controls the :ref:`legacy transaction handling mode ` of :mod:`!sqlite3`. If set to ``None``, " @@ -1800,13 +1791,13 @@ msgid "" "` is performed." msgstr "" -#: ../../library/sqlite3.rst:1418 +#: ../../library/sqlite3.rst:1400 msgid "" "If not overridden by the *isolation_level* parameter of :func:`connect`, the " "default is ``\"\"``, which is an alias for ``\"DEFERRED\"``." msgstr "" -#: ../../library/sqlite3.rst:1423 +#: ../../library/sqlite3.rst:1405 msgid "" "Using :attr:`autocommit` to control transaction handling is recommended over " "using :attr:`!isolation_level`. :attr:`!isolation_level` has no effect " @@ -1814,57 +1805,57 @@ msgid "" "default)." msgstr "" -#: ../../library/sqlite3.rst:1430 +#: ../../library/sqlite3.rst:1412 msgid "" "The initial :attr:`~Cursor.row_factory` for :class:`Cursor` objects created " -"from this connection. Assigning to this attribute does not affect the :attr:" -"`!row_factory` of existing cursors belonging to this connection, only new " -"ones. Is ``None`` by default, meaning each row is returned as a :class:" -"`tuple`." +"from this connection. Assigning to this attribute does not affect " +"the :attr:`!row_factory` of existing cursors belonging to this connection, " +"only new ones. Is ``None`` by default, meaning each row is returned as " +"a :class:`tuple`." msgstr "" -#: ../../library/sqlite3.rst:1437 ../../library/sqlite3.rst:1723 -#: ../../library/sqlite3.rst:1746 +#: ../../library/sqlite3.rst:1419 ../../library/sqlite3.rst:1705 +#: ../../library/sqlite3.rst:1728 msgid "See :ref:`sqlite3-howto-row-factory` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-row-factory`。" -#: ../../library/sqlite3.rst:1441 +#: ../../library/sqlite3.rst:1423 msgid "" "A :term:`callable` that accepts a :class:`bytes` parameter and returns a " "text representation of it. The callable is invoked for SQLite values with " "the ``TEXT`` data type. By default, this attribute is set to :class:`str`." msgstr "" -#: ../../library/sqlite3.rst:1446 +#: ../../library/sqlite3.rst:1428 msgid "See :ref:`sqlite3-howto-encoding` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-encoding`。" -#: ../../library/sqlite3.rst:1450 +#: ../../library/sqlite3.rst:1432 msgid "" "Return the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: ../../library/sqlite3.rst:1457 +#: ../../library/sqlite3.rst:1439 msgid "Cursor objects" msgstr "Cursor 物件" -#: ../../library/sqlite3.rst:1459 +#: ../../library/sqlite3.rst:1441 msgid "" "A ``Cursor`` object represents a `database cursor`_ which is used to execute " "SQL statements, and manage the context of a fetch operation. Cursors are " -"created using :meth:`Connection.cursor`, or by using any of the :ref:" -"`connection shortcut methods `." +"created using :meth:`Connection.cursor`, or by using any of " +"the :ref:`connection shortcut methods `." msgstr "" -#: ../../library/sqlite3.rst:1466 +#: ../../library/sqlite3.rst:1448 msgid "" -"Cursor objects are :term:`iterators `, meaning that if you :meth:" -"`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " -"to fetch the resulting rows:" +"Cursor objects are :term:`iterators `, meaning that if " +"you :meth:`~Cursor.execute` a ``SELECT`` query, you can simply iterate over " +"the cursor to fetch the resulting rows:" msgstr "" -#: ../../library/sqlite3.rst:1477 +#: ../../library/sqlite3.rst:1459 msgid "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" @@ -1872,78 +1863,83 @@ msgstr "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" -#: ../../library/sqlite3.rst:1491 +#: ../../library/sqlite3.rst:1473 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr ":class:`Cursor` 實例具有以下屬性和方法。" -#: ../../library/sqlite3.rst:1498 +#: ../../library/sqlite3.rst:1480 msgid "" -"Execute a single SQL statement, optionally binding Python values using :ref:" -"`placeholders `." +"Execute a single SQL statement, optionally binding Python values " +"using :ref:`placeholders `." msgstr "" -#: ../../library/sqlite3.rst:1502 +#: ../../library/sqlite3.rst:1484 msgid "A single SQL statement." msgstr "單一個 SQL 陳述式。" -#: ../../library/sqlite3.rst:1505 +#: ../../library/sqlite3.rst:1487 msgid "" "Python values to bind to placeholders in *sql*. A :class:`!dict` if named " "placeholders are used. A :term:`!sequence` if unnamed placeholders are used. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1512 -msgid "If *sql* contains more than one SQL statement." +#: ../../library/sqlite3.rst:1494 +msgid "" +"When *sql* contains more than one SQL statement. When :ref:`named " +"placeholders ` are used and *parameters* is a sequence " +"instead of a :class:`dict`." msgstr "" -#: ../../library/sqlite3.rst:1515 +#: ../../library/sqlite3.rst:1499 msgid "" -"If :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`, :" -"attr:`~Connection.isolation_level` is not ``None``, *sql* is an ``INSERT``, " -"``UPDATE``, ``DELETE``, or ``REPLACE`` statement, and there is no open " -"transaction, a transaction is implicitly opened before executing *sql*." +"If :attr:`~Connection.autocommit` " +"is :data:`LEGACY_TRANSACTION_CONTROL`, :attr:`~Connection.isolation_level` " +"is not ``None``, *sql* is an ``INSERT``, ``UPDATE``, ``DELETE``, or " +"``REPLACE`` statement, and there is no open transaction, a transaction is " +"implicitly opened before executing *sql*." msgstr "" -#: ../../library/sqlite3.rst:1524 +#: ../../library/sqlite3.rst:1508 msgid "" -":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and *parameters* is a sequence instead of a :class:" -"`dict`. Starting with Python 3.14, :exc:`ProgrammingError` will be raised " -"instead." +":exc:`ProgrammingError` is emitted if :ref:`named placeholders ` are used and *parameters* is a sequence instead of " +"a :class:`dict`." msgstr "" -#: ../../library/sqlite3.rst:1530 +#: ../../library/sqlite3.rst:1512 msgid "Use :meth:`executescript` to execute multiple SQL statements." msgstr "" -#: ../../library/sqlite3.rst:1534 +#: ../../library/sqlite3.rst:1516 msgid "" "For every item in *parameters*, repeatedly execute the :ref:`parameterized " "` :abbr:`DML (Data Manipulation Language)` SQL " "statement *sql*." msgstr "" -#: ../../library/sqlite3.rst:1538 +#: ../../library/sqlite3.rst:1520 msgid "Uses the same implicit transaction handling as :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:1540 +#: ../../library/sqlite3.rst:1522 msgid "A single SQL DML statement." msgstr "" -#: ../../library/sqlite3.rst:1543 +#: ../../library/sqlite3.rst:1525 msgid "" "An :term:`!iterable` of parameters to bind with the placeholders in *sql*. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1549 +#: ../../library/sqlite3.rst:1531 msgid "" -"If *sql* contains more than one SQL statement, or is not a DML statement." +"When *sql* contains more than one SQL statement or is not a DML statement, " +"When :ref:`named placeholders ` are used and the items " +"in *parameters* are sequences instead of :class:`dict`\\s." msgstr "" -#: ../../library/sqlite3.rst:1555 +#: ../../library/sqlite3.rst:1539 msgid "" "rows = [\n" " (\"row1\",),\n" @@ -1959,34 +1955,33 @@ msgstr "" "# cur 是一個 sqlite3.Cursor 物件\n" "cur.executemany(\"INSERT INTO data VALUES(?)\", rows)" -#: ../../library/sqlite3.rst:1570 +#: ../../library/sqlite3.rst:1554 msgid "" "Any resulting rows are discarded, including DML statements with `RETURNING " "clauses`_." msgstr "" -#: ../../library/sqlite3.rst:1577 +#: ../../library/sqlite3.rst:1561 msgid "" -":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and the items in *parameters* are sequences instead " -"of :class:`dict`\\s. Starting with Python 3.14, :exc:`ProgrammingError` will " -"be raised instead." +"of :class:`dict`\\s." msgstr "" -#: ../../library/sqlite3.rst:1586 +#: ../../library/sqlite3.rst:1568 msgid "" -"Execute the SQL statements in *sql_script*. If the :attr:`~Connection." -"autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and there is a pending " -"transaction, an implicit ``COMMIT`` statement is executed first. No other " -"implicit transaction control is performed; any transaction control must be " -"added to *sql_script*." +"Execute the SQL statements in *sql_script*. If " +"the :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and " +"there is a pending transaction, an implicit ``COMMIT`` statement is executed " +"first. No other implicit transaction control is performed; any transaction " +"control must be added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:1594 +#: ../../library/sqlite3.rst:1576 msgid "*sql_script* must be a :class:`string `." msgstr "*sql_script* 必須是一個 :class:`string `。" -#: ../../library/sqlite3.rst:1598 +#: ../../library/sqlite3.rst:1580 msgid "" "# cur is an sqlite3.Cursor object\n" "cur.executescript(\"\"\"\n" @@ -2006,20 +2001,20 @@ msgstr "" " COMMIT;\n" "\"\"\")" -#: ../../library/sqlite3.rst:1611 +#: ../../library/sqlite3.rst:1593 msgid "" "If :attr:`~Cursor.row_factory` is ``None``, return the next row query result " "set as a :class:`tuple`. Else, pass it to the row factory and return its " "result. Return ``None`` if no more data is available." msgstr "" -#: ../../library/sqlite3.rst:1619 +#: ../../library/sqlite3.rst:1601 msgid "" "Return the next set of rows of a query result as a :class:`list`. Return an " "empty list if no more rows are available." msgstr "" -#: ../../library/sqlite3.rst:1622 +#: ../../library/sqlite3.rst:1604 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " "If *size* is not given, :attr:`arraysize` determines the number of rows to " @@ -2027,7 +2022,7 @@ msgid "" "available are returned." msgstr "" -#: ../../library/sqlite3.rst:1628 +#: ../../library/sqlite3.rst:1610 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -2035,44 +2030,44 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:1635 +#: ../../library/sqlite3.rst:1617 msgid "" "Return all (remaining) rows of a query result as a :class:`list`. Return an " "empty list if no rows are available. Note that the :attr:`arraysize` " "attribute can affect the performance of this operation." msgstr "" -#: ../../library/sqlite3.rst:1642 +#: ../../library/sqlite3.rst:1624 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:1644 +#: ../../library/sqlite3.rst:1626 msgid "" -"The cursor will be unusable from this point forward; a :exc:" -"`ProgrammingError` exception will be raised if any operation is attempted " -"with the cursor." +"The cursor will be unusable from this point forward; " +"a :exc:`ProgrammingError` exception will be raised if any operation is " +"attempted with the cursor." msgstr "" -#: ../../library/sqlite3.rst:1649 ../../library/sqlite3.rst:1653 +#: ../../library/sqlite3.rst:1631 ../../library/sqlite3.rst:1635 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:1657 +#: ../../library/sqlite3.rst:1639 msgid "" -"Read/write attribute that controls the number of rows returned by :meth:" -"`fetchmany`. The default value is 1 which means a single row would be " -"fetched per call." +"Read/write attribute that controls the number of rows returned " +"by :meth:`fetchmany`. The default value is 1 which means a single row would " +"be fetched per call." msgstr "" -#: ../../library/sqlite3.rst:1662 +#: ../../library/sqlite3.rst:1644 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " -"belonging to the cursor. A :class:`Cursor` object created by calling :meth:" -"`con.cursor() ` will have a :attr:`connection` attribute " -"that refers to *con*:" +"belonging to the cursor. A :class:`Cursor` object created by " +"calling :meth:`con.cursor() ` will have " +"a :attr:`connection` attribute that refers to *con*:" msgstr "" -#: ../../library/sqlite3.rst:1667 +#: ../../library/sqlite3.rst:1649 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> cur = con.cursor()\n" @@ -2086,18 +2081,18 @@ msgstr "" "True\n" ">>> con.close()" -#: ../../library/sqlite3.rst:1677 +#: ../../library/sqlite3.rst:1659 msgid "" "Read-only attribute that provides the column names of the last query. To " "remain compatible with the Python DB API, it returns a 7-tuple for each " "column where the last six items of each tuple are ``None``." msgstr "" -#: ../../library/sqlite3.rst:1681 +#: ../../library/sqlite3.rst:1663 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:1685 +#: ../../library/sqlite3.rst:1667 msgid "" "Read-only attribute that provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " @@ -2107,15 +2102,15 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:1693 +#: ../../library/sqlite3.rst:1675 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:1695 +#: ../../library/sqlite3.rst:1677 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:1700 +#: ../../library/sqlite3.rst:1682 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -2125,7 +2120,7 @@ msgid "" "resulting rows must be fetched in order for :attr:`!rowcount` to be updated." msgstr "" -#: ../../library/sqlite3.rst:1711 +#: ../../library/sqlite3.rst:1693 msgid "" "Control how a row fetched from this :class:`!Cursor` is represented. If " "``None``, a row is represented as a :class:`tuple`. Can be set to the " @@ -2134,61 +2129,61 @@ msgid "" "and returns a custom object representing an SQLite row." msgstr "" -#: ../../library/sqlite3.rst:1718 +#: ../../library/sqlite3.rst:1700 msgid "" "Defaults to what :attr:`Connection.row_factory` was set to when the :class:`!" -"Cursor` was created. Assigning to this attribute does not affect :attr:" -"`Connection.row_factory` of the parent connection." +"Cursor` was created. Assigning to this attribute does not " +"affect :attr:`Connection.row_factory` of the parent connection." msgstr "" -#: ../../library/sqlite3.rst:1734 +#: ../../library/sqlite3.rst:1716 msgid "Row objects" msgstr "Row 物件" -#: ../../library/sqlite3.rst:1738 +#: ../../library/sqlite3.rst:1720 msgid "" -"A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." -"row_factory` for :class:`Connection` objects. It supports iteration, " -"equality testing, :func:`len`, and :term:`mapping` access by column name and " -"index." +"A :class:`!Row` instance serves as a highly " +"optimized :attr:`~Connection.row_factory` for :class:`Connection` objects. " +"It supports iteration, equality testing, :func:`len`, and :term:`mapping` " +"access by column name and index." msgstr "" -#: ../../library/sqlite3.rst:1743 +#: ../../library/sqlite3.rst:1725 msgid "" "Two :class:`!Row` objects compare equal if they have identical column names " "and values." msgstr "" -#: ../../library/sqlite3.rst:1750 +#: ../../library/sqlite3.rst:1732 msgid "" "Return a :class:`list` of column names as :class:`strings `. " -"Immediately after a query, it is the first member of each tuple in :attr:" -"`Cursor.description`." +"Immediately after a query, it is the first member of each tuple " +"in :attr:`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:1754 +#: ../../library/sqlite3.rst:1736 msgid "Added support of slicing." msgstr "新增對切片的支援。" -#: ../../library/sqlite3.rst:1761 +#: ../../library/sqlite3.rst:1743 msgid "Blob objects" msgstr "Blob 物件" -#: ../../library/sqlite3.rst:1767 +#: ../../library/sqlite3.rst:1749 msgid "" "A :class:`Blob` instance is a :term:`file-like object` that can read and " -"write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. Call :func:" -"`len(blob) ` to get the size (number of bytes) of the blob. Use indices " -"and :term:`slices ` for direct access to the blob data." +"write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. " +"Call :func:`len(blob) ` to get the size (number of bytes) of the blob. " +"Use indices and :term:`slices ` for direct access to the blob data." msgstr "" -#: ../../library/sqlite3.rst:1772 +#: ../../library/sqlite3.rst:1754 msgid "" "Use the :class:`Blob` as a :term:`context manager` to ensure that the blob " "handle is closed after use." msgstr "" -#: ../../library/sqlite3.rst:1775 +#: ../../library/sqlite3.rst:1757 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE test(blob_col blob)\")\n" @@ -2210,37 +2205,37 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1803 +#: ../../library/sqlite3.rst:1785 msgid "Close the blob." msgstr "" -#: ../../library/sqlite3.rst:1805 +#: ../../library/sqlite3.rst:1787 msgid "" -"The blob will be unusable from this point onward. An :class:`~sqlite3." -"Error` (or subclass) exception will be raised if any further operation is " -"attempted with the blob." +"The blob will be unusable from this point onward. " +"An :class:`~sqlite3.Error` (or subclass) exception will be raised if any " +"further operation is attempted with the blob." msgstr "" -#: ../../library/sqlite3.rst:1811 +#: ../../library/sqlite3.rst:1793 msgid "" "Read *length* bytes of data from the blob at the current offset position. If " "the end of the blob is reached, the data up to :abbr:`EOF (End of File)` " -"will be returned. When *length* is not specified, or is negative, :meth:" -"`~Blob.read` will read until the end of the blob." +"will be returned. When *length* is not specified, or is " +"negative, :meth:`~Blob.read` will read until the end of the blob." msgstr "" -#: ../../library/sqlite3.rst:1819 +#: ../../library/sqlite3.rst:1801 msgid "" "Write *data* to the blob at the current offset. This function cannot change " -"the blob length. Writing beyond the end of the blob will raise :exc:" -"`ValueError`." +"the blob length. Writing beyond the end of the blob will " +"raise :exc:`ValueError`." msgstr "" -#: ../../library/sqlite3.rst:1825 +#: ../../library/sqlite3.rst:1807 msgid "Return the current access position of the blob." msgstr "" -#: ../../library/sqlite3.rst:1829 +#: ../../library/sqlite3.rst:1811 msgid "" "Set the current access position of the blob to *offset*. The *origin* " "argument defaults to :const:`os.SEEK_SET` (absolute blob positioning). Other " @@ -2248,26 +2243,26 @@ msgid "" "position) and :const:`os.SEEK_END` (seek relative to the blob’s end)." msgstr "" -#: ../../library/sqlite3.rst:1837 +#: ../../library/sqlite3.rst:1819 msgid "PrepareProtocol objects" msgstr "PrepareProtocol 物件" -#: ../../library/sqlite3.rst:1841 +#: ../../library/sqlite3.rst:1823 msgid "" "The PrepareProtocol type's single purpose is to act as a :pep:`246` style " "adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." msgstr "" -#: ../../library/sqlite3.rst:1849 +#: ../../library/sqlite3.rst:1831 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:1851 +#: ../../library/sqlite3.rst:1833 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:1855 +#: ../../library/sqlite3.rst:1837 msgid "" "This exception is not currently raised by the :mod:`!sqlite3` module, but " "may be raised by applications using :mod:`!sqlite3`, for example if a user-" @@ -2275,39 +2270,39 @@ msgid "" "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1862 +#: ../../library/sqlite3.rst:1844 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1866 +#: ../../library/sqlite3.rst:1848 msgid "" "If the exception originated from within the SQLite library, the following " "two attributes are added to the exception:" msgstr "" -#: ../../library/sqlite3.rst:1871 +#: ../../library/sqlite3.rst:1853 msgid "" -"The numeric error code from the `SQLite API `_" +"The numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1878 +#: ../../library/sqlite3.rst:1860 msgid "" "The symbolic name of the numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1885 +#: ../../library/sqlite3.rst:1867 msgid "" "Exception raised for misuse of the low-level SQLite C API. In other words, " "if this exception is raised, it probably indicates a bug in the :mod:`!" "sqlite3` module. ``InterfaceError`` is a subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1892 +#: ../../library/sqlite3.rst:1874 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -2315,14 +2310,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1899 +#: ../../library/sqlite3.rst:1881 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1905 +#: ../../library/sqlite3.rst:1887 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -2330,28 +2325,28 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1913 +#: ../../library/sqlite3.rst:1895 msgid "" "Exception raised when the relational integrity of the database is affected, " "e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1918 +#: ../../library/sqlite3.rst:1900 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1925 +#: ../../library/sqlite3.rst:1907 msgid "" "Exception raised for :mod:`!sqlite3` API programming errors, for example " "supplying the wrong number of bindings to a query, or trying to operate on a " -"closed :class:`Connection`. ``ProgrammingError`` is a subclass of :exc:" -"`DatabaseError`." +"closed :class:`Connection`. ``ProgrammingError`` is a subclass " +"of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1932 +#: ../../library/sqlite3.rst:1914 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -2360,78 +2355,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1942 +#: ../../library/sqlite3.rst:1924 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1944 +#: ../../library/sqlite3.rst:1926 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1947 +#: ../../library/sqlite3.rst:1929 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1950 ../../library/sqlite3.rst:1967 +#: ../../library/sqlite3.rst:1932 ../../library/sqlite3.rst:1949 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1950 ../../library/sqlite3.rst:1967 +#: ../../library/sqlite3.rst:1932 ../../library/sqlite3.rst:1949 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1952 ../../library/sqlite3.rst:1969 +#: ../../library/sqlite3.rst:1934 ../../library/sqlite3.rst:1951 msgid "``None``" msgstr "``None``" -#: ../../library/sqlite3.rst:1952 ../../library/sqlite3.rst:1969 +#: ../../library/sqlite3.rst:1934 ../../library/sqlite3.rst:1951 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1954 ../../library/sqlite3.rst:1971 +#: ../../library/sqlite3.rst:1936 ../../library/sqlite3.rst:1953 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1954 ../../library/sqlite3.rst:1971 +#: ../../library/sqlite3.rst:1936 ../../library/sqlite3.rst:1953 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1956 ../../library/sqlite3.rst:1973 +#: ../../library/sqlite3.rst:1938 ../../library/sqlite3.rst:1955 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1956 ../../library/sqlite3.rst:1973 +#: ../../library/sqlite3.rst:1938 ../../library/sqlite3.rst:1955 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1958 +#: ../../library/sqlite3.rst:1940 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1958 ../../library/sqlite3.rst:1975 +#: ../../library/sqlite3.rst:1940 ../../library/sqlite3.rst:1957 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1960 ../../library/sqlite3.rst:1978 +#: ../../library/sqlite3.rst:1942 ../../library/sqlite3.rst:1960 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1960 ../../library/sqlite3.rst:1978 +#: ../../library/sqlite3.rst:1942 ../../library/sqlite3.rst:1960 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1964 +#: ../../library/sqlite3.rst:1946 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1975 +#: ../../library/sqlite3.rst:1957 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1981 +#: ../../library/sqlite3.rst:1963 msgid "" "The type system of the :mod:`!sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via :ref:`object " @@ -2440,47 +2435,47 @@ msgid "" "converters>`." msgstr "" -#: ../../library/sqlite3.rst:1991 +#: ../../library/sqlite3.rst:1973 msgid "Default adapters and converters (deprecated)" msgstr "" -#: ../../library/sqlite3.rst:1995 +#: ../../library/sqlite3.rst:1977 msgid "" "The default adapters and converters are deprecated as of Python 3.12. " "Instead, use the :ref:`sqlite3-adapter-converter-recipes` and tailor them to " "your needs." msgstr "" -#: ../../library/sqlite3.rst:1999 +#: ../../library/sqlite3.rst:1981 msgid "The deprecated default adapters and converters consist of:" msgstr "" -#: ../../library/sqlite3.rst:2001 +#: ../../library/sqlite3.rst:1983 msgid "" "An adapter for :class:`datetime.date` objects to :class:`strings ` in " "`ISO 8601`_ format." msgstr "" -#: ../../library/sqlite3.rst:2003 +#: ../../library/sqlite3.rst:1985 msgid "" "An adapter for :class:`datetime.datetime` objects to strings in ISO 8601 " "format." msgstr "" -#: ../../library/sqlite3.rst:2005 +#: ../../library/sqlite3.rst:1987 msgid "" -"A converter for :ref:`declared ` \"date\" types to :" -"class:`datetime.date` objects." +"A converter for :ref:`declared ` \"date\" types " +"to :class:`datetime.date` objects." msgstr "" -#: ../../library/sqlite3.rst:2007 +#: ../../library/sqlite3.rst:1989 msgid "" "A converter for declared \"timestamp\" types to :class:`datetime.datetime` " "objects. Fractional parts will be truncated to 6 digits (microsecond " "precision)." msgstr "" -#: ../../library/sqlite3.rst:2013 +#: ../../library/sqlite3.rst:1995 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -2488,42 +2483,42 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:2026 +#: ../../library/sqlite3.rst:2008 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/sqlite3.rst:2028 +#: ../../library/sqlite3.rst:2010 msgid "" "The :mod:`!sqlite3` module can be invoked as a script, using the " "interpreter's :option:`-m` switch, in order to provide a simple SQLite " "shell. The argument signature is as follows::" msgstr "" -#: ../../library/sqlite3.rst:2033 +#: ../../library/sqlite3.rst:2015 msgid "python -m sqlite3 [-h] [-v] [filename] [sql]" msgstr "python -m sqlite3 [-h] [-v] [filename] [sql]" -#: ../../library/sqlite3.rst:2035 +#: ../../library/sqlite3.rst:2017 msgid "Type ``.quit`` or CTRL-D to exit the shell." msgstr "" -#: ../../library/sqlite3.rst:2041 +#: ../../library/sqlite3.rst:2023 msgid "Print CLI help." msgstr "" -#: ../../library/sqlite3.rst:2045 +#: ../../library/sqlite3.rst:2027 msgid "Print underlying SQLite library version." msgstr "" -#: ../../library/sqlite3.rst:2053 +#: ../../library/sqlite3.rst:2035 msgid "How-to guides" msgstr "" -#: ../../library/sqlite3.rst:2058 +#: ../../library/sqlite3.rst:2040 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: ../../library/sqlite3.rst:2060 +#: ../../library/sqlite3.rst:2042 msgid "" "SQL operations usually need to use values from Python variables. However, " "beware of using Python's string operations to assemble queries, as they are " @@ -2531,7 +2526,7 @@ msgid "" "close the single quote and inject ``OR TRUE`` to select all rows::" msgstr "" -#: ../../library/sqlite3.rst:2065 +#: ../../library/sqlite3.rst:2047 msgid "" ">>> # Never do this -- insecure!\n" ">>> symbol = input()\n" @@ -2542,7 +2537,7 @@ msgid "" ">>> cur.execute(sql)" msgstr "" -#: ../../library/sqlite3.rst:2073 +#: ../../library/sqlite3.rst:2055 msgid "" "Instead, use the DB-API's parameter substitution. To insert a variable into " "a query string, use a placeholder in the string, and substitute the actual " @@ -2550,7 +2545,7 @@ msgid "" "second argument of the cursor's :meth:`~Cursor.execute` method." msgstr "" -#: ../../library/sqlite3.rst:2078 +#: ../../library/sqlite3.rst:2060 msgid "" "An SQL statement may use one of two kinds of placeholders: question marks " "(qmark style) or named placeholders (named style). For the qmark style, " @@ -2561,7 +2556,7 @@ msgid "" "ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:2089 +#: ../../library/sqlite3.rst:2071 msgid "" "con = sqlite3.connect(\":memory:\")\n" "cur = con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" @@ -2582,24 +2577,24 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2116 +#: ../../library/sqlite3.rst:2098 msgid "" ":pep:`249` numeric placeholders are *not* supported. If used, they will be " "interpreted as named placeholders." msgstr "" -#: ../../library/sqlite3.rst:2123 +#: ../../library/sqlite3.rst:2105 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: ../../library/sqlite3.rst:2125 +#: ../../library/sqlite3.rst:2107 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands `." msgstr "" -#: ../../library/sqlite3.rst:2129 +#: ../../library/sqlite3.rst:2111 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -2609,11 +2604,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:2141 +#: ../../library/sqlite3.rst:2123 msgid "How to write adaptable objects" msgstr "" -#: ../../library/sqlite3.rst:2143 +#: ../../library/sqlite3.rst:2125 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -2623,7 +2618,7 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:2151 +#: ../../library/sqlite3.rst:2133 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2655,18 +2650,18 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2175 +#: ../../library/sqlite3.rst:2157 msgid "How to register adapter callables" msgstr "" -#: ../../library/sqlite3.rst:2177 +#: ../../library/sqlite3.rst:2159 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:2181 +#: ../../library/sqlite3.rst:2163 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2700,36 +2695,36 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2208 +#: ../../library/sqlite3.rst:2190 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:2210 +#: ../../library/sqlite3.rst:2192 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: ../../library/sqlite3.rst:2215 +#: ../../library/sqlite3.rst:2197 msgid "" "Let's go back to the :class:`!Point` class. We stored the x and y " "coordinates separated via semicolons as strings in SQLite." msgstr "" -#: ../../library/sqlite3.rst:2218 +#: ../../library/sqlite3.rst:2200 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`!Point` object from it." msgstr "" -#: ../../library/sqlite3.rst:2223 +#: ../../library/sqlite3.rst:2205 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:2226 +#: ../../library/sqlite3.rst:2208 msgid "" "def convert_point(s):\n" " x, y = map(float, s.split(b\";\"))\n" @@ -2739,32 +2734,32 @@ msgstr "" " x, y = map(float, s.split(b\";\"))\n" " return Point(x, y)" -#: ../../library/sqlite3.rst:2232 +#: ../../library/sqlite3.rst:2214 msgid "" "We now need to tell :mod:`!sqlite3` when it should convert a given SQLite " "value. This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: ../../library/sqlite3.rst:2236 +#: ../../library/sqlite3.rst:2218 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:2237 +#: ../../library/sqlite3.rst:2219 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:2238 +#: ../../library/sqlite3.rst:2220 msgid "" -"Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." -"PARSE_COLNAMES``. Column names take precedence over declared types." +"Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | " +"sqlite3.PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:2242 +#: ../../library/sqlite3.rst:2224 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:2244 +#: ../../library/sqlite3.rst:2226 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2806,15 +2801,15 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2295 +#: ../../library/sqlite3.rst:2277 msgid "Adapter and converter recipes" msgstr "" -#: ../../library/sqlite3.rst:2297 +#: ../../library/sqlite3.rst:2279 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:2299 +#: ../../library/sqlite3.rst:2281 msgid "" "import datetime\n" "import sqlite3\n" @@ -2852,23 +2847,23 @@ msgid "" "sqlite3.register_converter(\"timestamp\", convert_timestamp)" msgstr "" -#: ../../library/sqlite3.rst:2359 +#: ../../library/sqlite3.rst:2341 msgid "How to use connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:2361 +#: ../../library/sqlite3.rst:2343 msgid "" -"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" -"meth:`~Connection.executescript` methods of the :class:`Connection` class, " -"your code can be written more concisely because you don't have to create the " -"(often superfluous) :class:`Cursor` objects explicitly. Instead, the :class:" -"`Cursor` objects are created implicitly and these shortcut methods return " -"the cursor objects. This way, you can execute a ``SELECT`` statement and " -"iterate over it directly using only a single call on the :class:`Connection` " -"object." +"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, " +"and :meth:`~Connection.executescript` methods of the :class:`Connection` " +"class, your code can be written more concisely because you don't have to " +"create the (often superfluous) :class:`Cursor` objects explicitly. Instead, " +"the :class:`Cursor` objects are created implicitly and these shortcut " +"methods return the cursor objects. This way, you can execute a ``SELECT`` " +"statement and iterate over it directly using only a single call on " +"the :class:`Connection` object." msgstr "" -#: ../../library/sqlite3.rst:2370 +#: ../../library/sqlite3.rst:2352 msgid "" "# Create and fill the table.\n" "con = sqlite3.connect(\":memory:\")\n" @@ -2892,11 +2887,11 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2402 +#: ../../library/sqlite3.rst:2384 msgid "How to use the connection context manager" msgstr "" -#: ../../library/sqlite3.rst:2404 +#: ../../library/sqlite3.rst:2386 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -2908,25 +2903,25 @@ msgid "" "rolling back." msgstr "" -#: ../../library/sqlite3.rst:2415 +#: ../../library/sqlite3.rst:2397 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, or if :attr:`~Connection.autocommit` is ``True``, the context " "manager does nothing." msgstr "" -#: ../../library/sqlite3.rst:2420 +#: ../../library/sqlite3.rst:2402 msgid "" "The context manager neither implicitly opens a new transaction nor closes " -"the connection. If you need a closing context manager, consider using :meth:" -"`contextlib.closing`." +"the connection. If you need a closing context manager, consider " +"using :meth:`contextlib.closing`." msgstr "" -#: ../../library/sqlite3.rst:2424 +#: ../../library/sqlite3.rst:2406 msgid "" "con = sqlite3.connect(\":memory:\")\n" -"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR " -"UNIQUE)\")\n" +"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR UNIQUE)" +"\")\n" "\n" "# Successful, con.commit() is called automatically afterwards\n" "with con:\n" @@ -2946,19 +2941,19 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2454 +#: ../../library/sqlite3.rst:2436 msgid "How to work with SQLite URIs" msgstr "" -#: ../../library/sqlite3.rst:2456 +#: ../../library/sqlite3.rst:2438 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:2458 +#: ../../library/sqlite3.rst:2440 msgid "Open a database in read-only mode:" msgstr "以唯讀模式開啟資料庫:" -#: ../../library/sqlite3.rst:2460 +#: ../../library/sqlite3.rst:2442 msgid "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" @@ -2972,13 +2967,13 @@ msgstr "" "OperationalError: attempt to write a readonly database\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2468 +#: ../../library/sqlite3.rst:2450 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: ../../library/sqlite3.rst:2471 +#: ../../library/sqlite3.rst:2453 msgid "" ">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" "Traceback (most recent call last):\n" @@ -2988,11 +2983,11 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: unable to open database file" -#: ../../library/sqlite3.rst:2478 +#: ../../library/sqlite3.rst:2460 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:2480 +#: ../../library/sqlite3.rst:2462 msgid "" "db = \"file:mem1?mode=memory&cache=shared\"\n" "con1 = sqlite3.connect(db, uri=True)\n" @@ -3018,32 +3013,32 @@ msgstr "" "con1.close()\n" "con2.close()" -#: ../../library/sqlite3.rst:2494 +#: ../../library/sqlite3.rst:2476 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:2503 +#: ../../library/sqlite3.rst:2485 msgid "How to create and use row factories" msgstr "" -#: ../../library/sqlite3.rst:2505 +#: ../../library/sqlite3.rst:2487 msgid "" -"By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :" -"class:`!tuple` does not suit your needs, you can use the :class:`sqlite3." -"Row` class or a custom :attr:`~Cursor.row_factory`." +"By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If " +"a :class:`!tuple` does not suit your needs, you can use " +"the :class:`sqlite3.Row` class or a custom :attr:`~Cursor.row_factory`." msgstr "" -#: ../../library/sqlite3.rst:2510 +#: ../../library/sqlite3.rst:2492 msgid "" -"While :attr:`!row_factory` exists as an attribute both on the :class:" -"`Cursor` and the :class:`Connection`, it is recommended to set :class:" -"`Connection.row_factory`, so all cursors created from the connection will " -"use the same row factory." +"While :attr:`!row_factory` exists as an attribute both on " +"the :class:`Cursor` and the :class:`Connection`, it is recommended to " +"set :class:`Connection.row_factory`, so all cursors created from the " +"connection will use the same row factory." msgstr "" -#: ../../library/sqlite3.rst:2515 +#: ../../library/sqlite3.rst:2497 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -3051,7 +3046,7 @@ msgid "" "attribute:" msgstr "" -#: ../../library/sqlite3.rst:2520 +#: ../../library/sqlite3.rst:2502 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" @@ -3059,11 +3054,11 @@ msgstr "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" -#: ../../library/sqlite3.rst:2525 +#: ../../library/sqlite3.rst:2507 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: ../../library/sqlite3.rst:2527 +#: ../../library/sqlite3.rst:2509 msgid "" ">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" ">>> row = res.fetchone()\n" @@ -3078,7 +3073,7 @@ msgid "" ">>> con.close()" msgstr "" -#: ../../library/sqlite3.rst:2543 +#: ../../library/sqlite3.rst:2525 msgid "" "The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the " "above example. In such cases, SQLite returns a single row with columns " @@ -3086,13 +3081,13 @@ msgid "" "alias``." msgstr "" -#: ../../library/sqlite3.rst:2548 +#: ../../library/sqlite3.rst:2530 msgid "" "You can create a custom :attr:`~Cursor.row_factory` that returns each row as " "a :class:`dict`, with column names mapped to values:" msgstr "" -#: ../../library/sqlite3.rst:2551 +#: ../../library/sqlite3.rst:2533 msgid "" "def dict_factory(cursor, row):\n" " fields = [column[0] for column in cursor.description]\n" @@ -3102,12 +3097,12 @@ msgstr "" " fields = [column[0] for column in cursor.description]\n" " return {key: value for key, value in zip(fields, row)}" -#: ../../library/sqlite3.rst:2557 +#: ../../library/sqlite3.rst:2539 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2559 +#: ../../library/sqlite3.rst:2541 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = dict_factory\n" @@ -3123,11 +3118,11 @@ msgstr "" "{'a': 1, 'b': 2}\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2568 +#: ../../library/sqlite3.rst:2550 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2570 +#: ../../library/sqlite3.rst:2552 msgid "" "from collections import namedtuple\n" "\n" @@ -3143,11 +3138,11 @@ msgstr "" " cls = namedtuple(\"Row\", fields)\n" " return cls._make(row)" -#: ../../library/sqlite3.rst:2579 +#: ../../library/sqlite3.rst:2561 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: ../../library/sqlite3.rst:2581 +#: ../../library/sqlite3.rst:2563 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = namedtuple_factory\n" @@ -3173,69 +3168,69 @@ msgstr "" "2\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2595 +#: ../../library/sqlite3.rst:2577 msgid "" -"With some adjustments, the above recipe can be adapted to use a :class:" -"`~dataclasses.dataclass`, or any other custom class, instead of a :class:" -"`~collections.namedtuple`." +"With some adjustments, the above recipe can be adapted to use " +"a :class:`~dataclasses.dataclass`, or any other custom class, instead of " +"a :class:`~collections.namedtuple`." msgstr "" -#: ../../library/sqlite3.rst:2603 +#: ../../library/sqlite3.rst:2585 msgid "How to handle non-UTF-8 text encodings" msgstr "如何處理非 UTF-8 的文字編碼" -#: ../../library/sqlite3.rst:2605 +#: ../../library/sqlite3.rst:2587 msgid "" "By default, :mod:`!sqlite3` uses :class:`str` to adapt SQLite values with " "the ``TEXT`` data type. This works well for UTF-8 encoded text, but it might " -"fail for other encodings and invalid UTF-8. You can use a custom :attr:" -"`~Connection.text_factory` to handle such cases." +"fail for other encodings and invalid UTF-8. You can use a " +"custom :attr:`~Connection.text_factory` to handle such cases." msgstr "" -#: ../../library/sqlite3.rst:2611 +#: ../../library/sqlite3.rst:2593 msgid "" "Because of SQLite's `flexible typing`_, it is not uncommon to encounter " "table columns with the ``TEXT`` data type containing non-UTF-8 encodings, or " "even arbitrary data. To demonstrate, let's assume we have a database with " "ISO-8859-2 (Latin-2) encoded text, for example a table of Czech-English " -"dictionary entries. Assuming we now have a :class:`Connection` instance :py:" -"data:`!con` connected to this database, we can decode the Latin-2 encoded " -"text using this :attr:`~Connection.text_factory`:" +"dictionary entries. Assuming we now have a :class:`Connection` " +"instance :py:data:`!con` connected to this database, we can decode the " +"Latin-2 encoded text using this :attr:`~Connection.text_factory`:" msgstr "" -#: ../../library/sqlite3.rst:2620 +#: ../../library/sqlite3.rst:2602 msgid "con.text_factory = lambda data: str(data, encoding=\"latin2\")" msgstr "con.text_factory = lambda data: str(data, encoding=\"latin2\")" -#: ../../library/sqlite3.rst:2624 +#: ../../library/sqlite3.rst:2606 msgid "" "For invalid UTF-8 or arbitrary data in stored in ``TEXT`` table columns, you " "can use the following technique, borrowed from the :ref:`unicode-howto`:" msgstr "" -#: ../../library/sqlite3.rst:2627 +#: ../../library/sqlite3.rst:2609 msgid "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" msgstr "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" -#: ../../library/sqlite3.rst:2633 +#: ../../library/sqlite3.rst:2615 msgid "" "The :mod:`!sqlite3` module API does not support strings containing " "surrogates." msgstr "" -#: ../../library/sqlite3.rst:2638 +#: ../../library/sqlite3.rst:2620 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../library/sqlite3.rst:2644 +#: ../../library/sqlite3.rst:2626 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:2650 +#: ../../library/sqlite3.rst:2632 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:2652 +#: ../../library/sqlite3.rst:2634 msgid "" ":mod:`!sqlite3` offers multiple methods of controlling whether, when and how " "database transactions are opened and closed. :ref:`sqlite3-transaction-" @@ -3243,132 +3238,133 @@ msgid "" "isolation-level` retains the pre-Python 3.12 behaviour." msgstr "" -#: ../../library/sqlite3.rst:2661 +#: ../../library/sqlite3.rst:2643 msgid "Transaction control via the ``autocommit`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2663 +#: ../../library/sqlite3.rst:2645 msgid "" -"The recommended way of controlling transaction behaviour is through the :" -"attr:`Connection.autocommit` attribute, which should preferably be set using " -"the *autocommit* parameter of :func:`connect`." +"The recommended way of controlling transaction behaviour is through " +"the :attr:`Connection.autocommit` attribute, which should preferably be set " +"using the *autocommit* parameter of :func:`connect`." msgstr "" -#: ../../library/sqlite3.rst:2668 +#: ../../library/sqlite3.rst:2650 msgid "" "It is suggested to set *autocommit* to ``False``, which implies :pep:`249`-" "compliant transaction control. This means:" msgstr "" -#: ../../library/sqlite3.rst:2672 +#: ../../library/sqlite3.rst:2654 msgid "" -":mod:`!sqlite3` ensures that a transaction is always open, so :func:" -"`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback` will " -"implicitly open a new transaction (immediately after closing the pending " -"one, for the latter two). :mod:`!sqlite3` uses ``BEGIN DEFERRED`` statements " -"when opening transactions." +":mod:`!sqlite3` ensures that a transaction is always open, " +"so :func:`connect`, :meth:`Connection.commit`, " +"and :meth:`Connection.rollback` will implicitly open a new transaction " +"(immediately after closing the pending one, for the latter two). :mod:`!" +"sqlite3` uses ``BEGIN DEFERRED`` statements when opening transactions." msgstr "" -#: ../../library/sqlite3.rst:2677 +#: ../../library/sqlite3.rst:2659 msgid "Transactions should be committed explicitly using :meth:`!commit`." msgstr "" -#: ../../library/sqlite3.rst:2678 +#: ../../library/sqlite3.rst:2660 msgid "Transactions should be rolled back explicitly using :meth:`!rollback`." msgstr "" -#: ../../library/sqlite3.rst:2679 +#: ../../library/sqlite3.rst:2661 msgid "" -"An implicit rollback is performed if the database is :meth:`~Connection." -"close`-ed with pending changes." +"An implicit rollback is performed if the database " +"is :meth:`~Connection.close`-ed with pending changes." msgstr "" -#: ../../library/sqlite3.rst:2682 +#: ../../library/sqlite3.rst:2664 msgid "" "Set *autocommit* to ``True`` to enable SQLite's `autocommit mode`_. In this " "mode, :meth:`Connection.commit` and :meth:`Connection.rollback` have no " "effect. Note that SQLite's autocommit mode is distinct from the :pep:`249`-" -"compliant :attr:`Connection.autocommit` attribute; use :attr:`Connection." -"in_transaction` to query the low-level SQLite autocommit mode." +"compliant :attr:`Connection.autocommit` attribute; " +"use :attr:`Connection.in_transaction` to query the low-level SQLite " +"autocommit mode." msgstr "" -#: ../../library/sqlite3.rst:2690 +#: ../../library/sqlite3.rst:2672 msgid "" "Set *autocommit* to :data:`LEGACY_TRANSACTION_CONTROL` to leave transaction " -"control behaviour to the :attr:`Connection.isolation_level` attribute. See :" -"ref:`sqlite3-transaction-control-isolation-level` for more information." +"control behaviour to the :attr:`Connection.isolation_level` attribute. " +"See :ref:`sqlite3-transaction-control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:2699 +#: ../../library/sqlite3.rst:2681 msgid "Transaction control via the ``isolation_level`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2703 +#: ../../library/sqlite3.rst:2685 msgid "" -"The recommended way of controlling transactions is via the :attr:" -"`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-control-" -"autocommit`." +"The recommended way of controlling transactions is via " +"the :attr:`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-" +"control-autocommit`." msgstr "" -#: ../../library/sqlite3.rst:2707 +#: ../../library/sqlite3.rst:2689 msgid "" -"If :attr:`Connection.autocommit` is set to :data:" -"`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour is " -"controlled using the :attr:`Connection.isolation_level` attribute. " +"If :attr:`Connection.autocommit` is set " +"to :data:`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour " +"is controlled using the :attr:`Connection.isolation_level` attribute. " "Otherwise, :attr:`!isolation_level` has no effect." msgstr "" -#: ../../library/sqlite3.rst:2713 +#: ../../library/sqlite3.rst:2695 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " -"``None``, new transactions are implicitly opened before :meth:`~Cursor." -"execute` and :meth:`~Cursor.executemany` executes ``INSERT``, ``UPDATE``, " -"``DELETE``, or ``REPLACE`` statements; for other statements, no implicit " -"transaction handling is performed. Use the :meth:`~Connection.commit` and :" -"meth:`~Connection.rollback` methods to respectively commit and roll back " -"pending transactions. You can choose the underlying `SQLite transaction " -"behaviour`_ — that is, whether and what type of ``BEGIN`` statements :mod:`!" -"sqlite3` implicitly executes – via the :attr:`~Connection.isolation_level` " -"attribute." +"``None``, new transactions are implicitly opened " +"before :meth:`~Cursor.execute` and :meth:`~Cursor.executemany` executes " +"``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statements; for other " +"statements, no implicit transaction handling is performed. Use " +"the :meth:`~Connection.commit` and :meth:`~Connection.rollback` methods to " +"respectively commit and roll back pending transactions. You can choose the " +"underlying `SQLite transaction behaviour`_ — that is, whether and what type " +"of ``BEGIN`` statements :mod:`!sqlite3` implicitly executes – via " +"the :attr:`~Connection.isolation_level` attribute." msgstr "" -#: ../../library/sqlite3.rst:2726 +#: ../../library/sqlite3.rst:2708 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " "`autocommit mode`_, but also allows the user to perform their own " "transaction handling using explicit SQL statements. The underlying SQLite " -"library autocommit mode can be queried using the :attr:`~Connection." -"in_transaction` attribute." +"library autocommit mode can be queried using " +"the :attr:`~Connection.in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:2734 +#: ../../library/sqlite3.rst:2716 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:2738 +#: ../../library/sqlite3.rst:2720 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:2742 +#: ../../library/sqlite3.rst:2724 msgid "" -"The recommended way of controlling transactions is now via the :attr:" -"`~Connection.autocommit` attribute." +"The recommended way of controlling transactions is now via " +"the :attr:`~Connection.autocommit` attribute." msgstr "" -#: ../../library/sqlite3.rst:1493 +#: ../../library/sqlite3.rst:1475 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/sqlite3.rst:1493 ../../library/sqlite3.rst:1494 +#: ../../library/sqlite3.rst:1475 ../../library/sqlite3.rst:1476 msgid "in SQL statements" msgstr "於 SQL 陳述式中" -#: ../../library/sqlite3.rst:1494 +#: ../../library/sqlite3.rst:1476 msgid ": (colon)" msgstr ": (冒號)" diff --git a/library/ssl.po b/library/ssl.po index c8891609fe6..d59586f6f5c 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-20 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -88,8 +88,8 @@ msgid "" "also encrypts and decrypts the data going over the socket with SSL. It " "supports additional methods such as :meth:`getpeercert`, which retrieves the " "certificate of the other side of the connection, :meth:`cipher`, which " -"retrieves the cipher being used for the secure connection or :meth:" -"`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " +"retrieves the cipher being used for the secure connection " +"or :meth:`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " "certificate chain." msgstr "" "此模組提供了一個 :class:`ssl.SSLSocket` 類別,它是從 :class:`socket.socket` " @@ -142,9 +142,10 @@ msgstr "Socket 建立" #: ../../library/ssl.rst:79 msgid "" -"Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." -"wrap_socket` method. The helper function :func:`create_default_context` " -"returns a new context with secure default settings." +"Instances of :class:`SSLSocket` must be created using " +"the :meth:`SSLContext.wrap_socket` method. The helper " +"function :func:`create_default_context` returns a new context with secure " +"default settings." msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`SSLContext.wrap_socket` 方法來建立。輔" "助函式 :func:`create_default_context` 會回傳有安全預設設定的新語境 " @@ -245,31 +246,31 @@ msgid "" "If all three are :const:`None`, this function can choose to trust the " "system's default CA certificates instead." msgstr "" -"*cafile*, *capath*, *cadata* 是用來選擇用於憑證認證的 CA 憑證,就像 :meth:" -"`SSLContext.load_verify_locations` 一樣。如果三個值都是 :const:`None`,此函式" -"會自動選擇系統預設的 CA 憑證。" +"*cafile*, *capath*, *cadata* 是用來選擇用於憑證認證的 CA 憑證,就" +"像 :meth:`SSLContext.load_verify_locations` 一樣。如果三個值都" +"是 :const:`None`,此函式會自動選擇系統預設的 CA 憑證。" # Skylull: `high encryption cipher` 可能是指 https://superuser.com/questions/1751902/how-to-check-which-ciphers-are-included-in-high-ciphers-constant # 其文中表示可能是指 128bit 以上 key length 的加密算法,需要其他來源佐證。 # 或是 https://help.fortinet.com/fweb/582/Content/FortiWeb/fortiweb-admin/supported_cipher_suites.htm#ssl_414712646_1189301 #: ../../library/ssl.rst:141 msgid "" -"The settings are: :data:`PROTOCOL_TLS_CLIENT` or :data:" -"`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` with " -"high encryption cipher suites without RC4 and without unauthenticated cipher " -"suites. Passing :const:`~Purpose.SERVER_AUTH` as *purpose* sets :data:" -"`~SSLContext.verify_mode` to :data:`CERT_REQUIRED` and either loads CA " -"certificates (when at least one of *cafile*, *capath* or *cadata* is given) " -"or uses :meth:`SSLContext.load_default_certs` to load default CA " +"The settings are: :data:`PROTOCOL_TLS_CLIENT` " +"or :data:`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` " +"with high encryption cipher suites without RC4 and without unauthenticated " +"cipher suites. Passing :const:`~Purpose.SERVER_AUTH` as *purpose* " +"sets :data:`~SSLContext.verify_mode` to :data:`CERT_REQUIRED` and either " +"loads CA certificates (when at least one of *cafile*, *capath* or *cadata* " +"is given) or uses :meth:`SSLContext.load_default_certs` to load default CA " "certificates." msgstr "" -"這些設定包含::data:`PROTOCOL_TLS_CLIENT` 或 :data:`PROTOCOL_TLS_SERVER`、:" -"data:`OP_NO_SSLv2`、以及 :data:`OP_NO_SSLv3`,使用高等加密套件但不包含 RC4 和" -"未經身份驗證的加密套件。如果將 *purpose* 設定為 :const:`~Purpose." -"SERVER_AUTH`,則會把 :data:`~SSLContext.verify_mode` 設為 :data:" -"`CERT_REQUIRED` 並使用設定的 CA 憑證(當 *cafile*、*capath* 或 *cadata* 其中一" -"個值有被設定時) 或使用預設的 CA 憑證 :meth:`SSLContext." -"load_default_certs` 。" +"這些設定包含::data:`PROTOCOL_TLS_CLIENT` " +"或 :data:`PROTOCOL_TLS_SERVER`、:data:`OP_NO_SSLv2`、以" +"及 :data:`OP_NO_SSLv3`,使用高等加密套件但不包含 RC4 和未經身份驗證的加密套" +"件。如果將 *purpose* 設定為 :const:`~Purpose.SERVER_AUTH`,則會" +"把 :data:`~SSLContext.verify_mode` 設為 :data:`CERT_REQUIRED` 並使用設定的 " +"CA 憑證(當 *cafile*、*capath* 或 *cadata* 其中一個值有被設定時) 或使用預設的 " +"CA 憑證 :meth:`SSLContext.load_default_certs` 。" #: ../../library/ssl.rst:150 msgid "" @@ -277,16 +278,16 @@ msgid "" "variable :envvar:`SSLKEYLOGFILE` is set, :func:`create_default_context` " "enables key logging." msgstr "" -"當系統有支援 :attr:`~SSLContext.keylog_filename` 並且有設定環境變數 :envvar:" -"`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記錄 " -"(logging)。" +"當系統有支援 :attr:`~SSLContext.keylog_filename` 並且有設定環境變" +"數 :envvar:`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記" +"錄 (logging)。" #: ../../library/ssl.rst:154 msgid "" -"The default settings for this context include :data:" -"`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. These make the " -"underlying OpenSSL implementation behave more like a conforming " -"implementation of :rfc:`5280`, in exchange for a small amount of " +"The default settings for this context " +"include :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. " +"These make the underlying OpenSSL implementation behave more like a " +"conforming implementation of :rfc:`5280`, in exchange for a small amount of " "incompatibility with older X.509 certificates." msgstr "" @@ -301,8 +302,8 @@ msgstr "" #: ../../library/ssl.rst:165 msgid "" -"If your application needs specific settings, you should create a :class:" -"`SSLContext` and apply the settings yourself." +"If your application needs specific settings, you should create " +"a :class:`SSLContext` and apply the settings yourself." msgstr "" "如果你的應用程式需要特殊的設定,你應該要自行建立一個 :class:`SSLContext` 並自" "行調整設定。" @@ -313,9 +314,9 @@ msgid "" "with a :class:`SSLContext` created by this function that they get an error " "stating \"Protocol or cipher suite mismatch\", it may be that they only " "support SSL3.0 which this function excludes using the :data:`OP_NO_SSLv3`. " -"SSL3.0 is widely considered to be `completely broken `_. If you still wish to continue to use this function but " -"still allow SSL 3.0 connections you can re-enable them using::" +"SSL3.0 is widely considered to be `completely broken `_. If you still wish to continue to use this " +"function but still allow SSL 3.0 connections you can re-enable them using::" msgstr "" "如果你發現某些舊的用戶端或伺服器常適用此函式建立的 :class:`SSLContext` 連線" "時,收到 \"Protocol or cipher suite mismatch\" 錯誤,這可能是因為他們的系統僅" @@ -365,16 +366,17 @@ msgstr "增加了 :envvar:`SSLKEYLOGFILE` 對密鑰日誌記錄 (logging) 的支 #: ../../library/ssl.rst:208 msgid "" -"The context now uses :data:`PROTOCOL_TLS_CLIENT` or :data:" -"`PROTOCOL_TLS_SERVER` protocol instead of generic :data:`PROTOCOL_TLS`." +"The context now uses :data:`PROTOCOL_TLS_CLIENT` " +"or :data:`PROTOCOL_TLS_SERVER` protocol instead of " +"generic :data:`PROTOCOL_TLS`." msgstr "" "目前語境使用 :data:`PROTOCOL_TLS_CLIENT` 協定或 :data:`PROTOCOL_TLS_SERVER` " "協定而非通用的 :data:`PROTOCOL_TLS`。" #: ../../library/ssl.rst:214 msgid "" -"The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:" -"`VERIFY_X509_STRICT` in its default verify flags." +"The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` " +"and :data:`VERIFY_X509_STRICT` in its default verify flags." msgstr "" #: ../../library/ssl.rst:219 @@ -391,9 +393,9 @@ msgid "" "OpenSSL library." msgstr "" "引發由底層 SSL 實作(目前由 OpenSSL 函式庫提供)所引發的錯誤訊息。這表示在覆" -"蓋底層網路連線的高階加密和身份驗證層中存在一些問題。這項錯誤是 :exc:" -"`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 OpenSSL " -"函式庫提供。" +"蓋底層網路連線的高階加密和身份驗證層中存在一些問題。這項錯誤" +"是 :exc:`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 " +"OpenSSL 函式庫提供。" #: ../../library/ssl.rst:230 msgid ":exc:`SSLError` used to be a subtype of :exc:`socket.error`." @@ -489,16 +491,16 @@ msgstr "隨機產生" #: ../../library/ssl.rst:319 msgid "" -"Return *num* cryptographically strong pseudo-random bytes. Raises an :class:" -"`SSLError` if the PRNG has not been seeded with enough data or if the " -"operation is not supported by the current RAND method. :func:`RAND_status` " -"can be used to check the status of the PRNG and :func:`RAND_add` can be used " -"to seed the PRNG." +"Return *num* cryptographically strong pseudo-random bytes. Raises " +"an :class:`SSLError` if the PRNG has not been seeded with enough data or if " +"the operation is not supported by the current RAND " +"method. :func:`RAND_status` can be used to check the status of the PRNG " +"and :func:`RAND_add` can be used to seed the PRNG." msgstr "" "回傳 *num* 個加密性強的偽隨機位元組。如果 PRNG 未使用足夠的資料做為隨機種子 " -"(seed) 或是目前的 RAND 方法不支持該操作則會導致 :class:`SSLError` 錯誤。:" -"func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可以用來" -"為 PRNG 設定隨機種子。" +"(seed) 或是目前的 RAND 方法不支持該操作則會導致 :class:`SSLError` 錯" +"誤。:func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可" +"以用來為 PRNG 設定隨機種子。" #: ../../library/ssl.rst:325 msgid "For almost all applications :func:`os.urandom` is preferable." @@ -511,20 +513,21 @@ msgid "" "Cryptographically_secure_pseudorandom_number_generator>`_, to get the " "requirements of a cryptographically strong generator." msgstr "" -"請閱讀維基百科的\\ `密碼學安全偽隨機數產生器 (CSPRNG) `_\\ 文章來了" -"解密碼學安全偽隨機數產生器的需求。" +"請閱讀維基百科的\\ `密碼學安全偽隨機數產生器 (CSPRNG) `_\\ 文章來了解密碼學" +"安全偽隨機數產生器的需求。" #: ../../library/ssl.rst:336 msgid "" "Return ``True`` if the SSL pseudo-random number generator has been seeded " -"with 'enough' randomness, and ``False`` otherwise. You can use :func:`ssl." -"RAND_egd` and :func:`ssl.RAND_add` to increase the randomness of the pseudo-" -"random number generator." +"with 'enough' randomness, and ``False`` otherwise. You can " +"use :func:`ssl.RAND_egd` and :func:`ssl.RAND_add` to increase the randomness " +"of the pseudo-random number generator." msgstr "" "如果 SSL 偽隨機數產生器已經使用「足夠的」隨機性進行隨機種子生成,則回傳 " -"``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式和 :func:" -"`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" +"``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式" +"和 :func:`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" #: ../../library/ssl.rst:343 msgid "" @@ -597,19 +600,19 @@ msgid "" "PEM-encoded string. If ``ssl_version`` is specified, uses that version of " "the SSL protocol to attempt to connect to the server. If *ca_certs* is " "specified, it should be a file containing a list of root certificates, the " -"same format as used for the *cafile* parameter in :meth:`SSLContext." -"load_verify_locations`. The call will attempt to validate the server " -"certificate against that set of root certificates, and will fail if the " -"validation attempt fails. A timeout can be specified with the ``timeout`` " -"parameter." +"same format as used for the *cafile* parameter " +"in :meth:`SSLContext.load_verify_locations`. The call will attempt to " +"validate the server certificate against that set of root certificates, and " +"will fail if the validation attempt fails. A timeout can be specified with " +"the ``timeout`` parameter." msgstr "" "輸入使用 SSL 保護的伺服器的地址 ``addr``,輸入形式為一個 pair (*hostname*, " "*port-number*),取得該伺服器的憑證,並以 PEM 編碼字串的形式回傳。如果指定了 " "``ssl_version``,則使用指定的 SSL 協定來嘗試與伺服器連線。如果指定 " -"*ca_certs*,則它應該是一個包含根憑證列表的檔案,並與 :meth:`SSLContext." -"load_verify_locations` 中的參數 *cafile* 所使用的格式相同。此呼叫將嘗試使用該" -"組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失敗。可以使用 ``timeout`` " -"參數指定超時時間。" +"*ca_certs*,則它應該是一個包含根憑證列表的檔案,並" +"與 :meth:`SSLContext.load_verify_locations` 中的參數 *cafile* 所使用的格式相" +"同。此呼叫將嘗試使用該組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失" +"敗。可以使用 ``timeout`` 參數指定超時時間。" #: ../../library/ssl.rst:399 msgid "This function is now IPv6-compatible." @@ -617,11 +620,11 @@ msgstr "此函式現在是與 IPv6 相容的。" #: ../../library/ssl.rst:402 msgid "" -"The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` to :data:" -"`PROTOCOL_TLS` for maximum compatibility with modern servers." +"The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` " +"to :data:`PROTOCOL_TLS` for maximum compatibility with modern servers." msgstr "" -"預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改為 :data:" -"`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" +"預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改" +"為 :data:`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" #: ../../library/ssl.rst:406 msgid "The *timeout* parameter was added." @@ -648,9 +651,9 @@ msgid "" "paths are the same as used by :meth:`SSLContext.set_default_verify_paths`. " "The return value is a :term:`named tuple` ``DefaultVerifyPaths``:" msgstr "" -"回傳一個具有 OpenSSL 的預設 cafile 和 capath 路徑的附名元組。這些路徑與 :" -"meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一個 :term:" -"`named tuple` ``DefaultVerifyPaths``:" +"回傳一個具有 OpenSSL 的預設 cafile 和 capath 路徑的附名元組。這些路徑" +"與 :meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一" +"個 :term:`named tuple` ``DefaultVerifyPaths``:" #: ../../library/ssl.rst:426 msgid "" @@ -696,18 +699,20 @@ msgstr "" #: ../../library/ssl.rst:441 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " -"The encoding_type specifies the encoding of cert_bytes. It is either :const:" -"`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 " -"data. Trust specifies the purpose of the certificate as a set of OIDS or " -"exactly ``True`` if the certificate is trustworthy for all purposes." +"The encoding_type specifies the encoding of cert_bytes. It is " +"either :const:`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for " +"PKCS#7 ASN.1 data. Trust specifies the purpose of the certificate as a set " +"of OIDS or exactly ``True`` if the certificate is trustworthy for all " +"purposes." msgstr "" "此函式會回傳一個元組 (cert_bytes, encoding_type, trust) 串列。encoding_type " -"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" -"`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。Trust 通過一" -"組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 ``True``。" +"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料" +"的 :const:`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" +"Trust 通過一組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 " +"``True``。" -#: ../../library/ssl.rst:448 ../../library/ssl.rst:1599 -#: ../../library/ssl.rst:1899 +#: ../../library/ssl.rst:448 ../../library/ssl.rst:1605 +#: ../../library/ssl.rst:1904 msgid "Example::" msgstr "範例: ::" @@ -732,12 +737,13 @@ msgstr "" #: ../../library/ssl.rst:464 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " -"The encoding_type specifies the encoding of cert_bytes. It is either :const:" -"`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 data." +"The encoding_type specifies the encoding of cert_bytes. It is " +"either :const:`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for " +"PKCS#7 ASN.1 data." msgstr "" "此函式會回傳一個元組 (cert_bytes, encoding_type, trust) 串列。encoding_type " -"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" -"`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" +"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料" +"的 :const:`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" #: ../../library/ssl.rst:475 msgid "Constants" @@ -752,10 +758,11 @@ msgstr "" #: ../../library/ssl.rst:483 msgid "" -"Possible value for :attr:`SSLContext.verify_mode`. Except for :const:" -"`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side sockets, " -"just about any cert is accepted. Validation errors, such as untrusted or " -"expired cert, are ignored and do not abort the TLS/SSL handshake." +"Possible value for :attr:`SSLContext.verify_mode`. Except " +"for :const:`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side " +"sockets, just about any cert is accepted. Validation errors, such as " +"untrusted or expired cert, are ignored and do not abort the TLS/SSL " +"handshake." msgstr "" ":attr:`SSLContext.verify_mode` 可能的值。除了 :attr:`SSLContext.verify_mode` " "外,這是預設的模式。對於用戶端的 sockets,幾乎任何憑證都能被允許。驗證錯誤," @@ -769,19 +776,20 @@ msgstr "" "在伺服器模式下,不會從用戶端請求任何憑證,所以用戶端不用發送任何用於用戶端憑" "證身分驗證的憑證。" -#: ../../library/ssl.rst:492 ../../library/ssl.rst:2401 +#: ../../library/ssl.rst:492 ../../library/ssl.rst:2406 msgid "See the discussion of :ref:`ssl-security` below." msgstr "參閱下方 :ref:`ssl-security` 的討論。" #: ../../library/ssl.rst:496 msgid "" -"Possible value for :attr:`SSLContext.verify_mode`. In client mode, :const:" -"`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. It is " -"recommended to use :const:`CERT_REQUIRED` for client-side sockets instead." +"Possible value for :attr:`SSLContext.verify_mode`. In client " +"mode, :const:`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. " +"It is recommended to use :const:`CERT_REQUIRED` for client-side sockets " +"instead." msgstr "" -":attr:`SSLContext.verify_mode` 可能的值。在用戶端模式下,:const:" -"`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶端 sockets " -"推薦改用 :const:`CERT_REQUIRED`。" +":attr:`SSLContext.verify_mode` 可能的值。在用戶端模式" +"下,:const:`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶" +"端 sockets 推薦改用 :const:`CERT_REQUIRED`。" #: ../../library/ssl.rst:501 msgid "" @@ -797,29 +805,30 @@ msgstr "" #: ../../library/ssl.rst:507 ../../library/ssl.rst:526 msgid "" -"Use of this setting requires a valid set of CA certificates to be passed to :" -"meth:`SSLContext.load_verify_locations`." +"Use of this setting requires a valid set of CA certificates to be passed " +"to :meth:`SSLContext.load_verify_locations`." msgstr "" -"使用此設定需要將一組有效的 CA 憑證傳送給 :meth:`SSLContext." -"load_verify_locations`。" +"使用此設定需要將一組有效的 CA 憑證傳送" +"給 :meth:`SSLContext.load_verify_locations`。" #: ../../library/ssl.rst:512 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In this mode, " -"certificates are required from the other side of the socket connection; an :" -"class:`SSLError` will be raised if no certificate is provided, or if its " +"certificates are required from the other side of the socket connection; " +"an :class:`SSLError` will be raised if no certificate is provided, or if its " "validation fails. This mode is **not** sufficient to verify a certificate in " -"client mode as it does not match hostnames. :attr:`~SSLContext." -"check_hostname` must be enabled as well to verify the authenticity of a " -"cert. :const:`PROTOCOL_TLS_CLIENT` uses :const:`CERT_REQUIRED` and enables :" -"attr:`~SSLContext.check_hostname` by default." +"client mode as it does not match " +"hostnames. :attr:`~SSLContext.check_hostname` must be enabled as well to " +"verify the authenticity of a cert. :const:`PROTOCOL_TLS_CLIENT` " +"uses :const:`CERT_REQUIRED` and enables :attr:`~SSLContext.check_hostname` " +"by default." msgstr "" ":attr:`SSLContext.verify_mode` 可能的值。在這個模式下,需要從 socket 連線的另" "一端取得憑證;如果未提供憑證或是驗證失敗,則將會導致 :class:`SSLError`。此模" -"式\\ **不能**\\ 在用戶端模式下對憑證進行驗證,因為它無法去配對主機名稱。:" -"attr:`~SSLContext.check_hostname` 也必須被開起來來驗證憑證的真實性。:const:" -"`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開啟 :attr:" -"`~SSLContext.check_hostname`。" +"式\\ **不能**\\ 在用戶端模式下對憑證進行驗證,因為它無法去配對主機名" +"稱。:attr:`~SSLContext.check_hostname` 也必須被開起來來驗證憑證的真實" +"性。:const:`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開" +"啟 :attr:`~SSLContext.check_hostname`。" #: ../../library/ssl.rst:522 msgid "" @@ -848,8 +857,8 @@ msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, only the " "peer cert is checked but none of the intermediate CA certificates. The mode " "requires a valid CRL that is signed by the peer cert's issuer (its direct " -"ancestor CA). If no proper CRL has been loaded with :attr:`SSLContext." -"load_verify_locations`, validation will fail." +"ancestor CA). If no proper CRL has been loaded " +"with :attr:`SSLContext.load_verify_locations`, validation will fail." msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。在此模式下,只會檢查同等的憑證而不" "會去檢查中間的 CA 憑證。此模式需要提供由對等憑證發行者 (它的直接上級 CA) 的有" @@ -915,8 +924,8 @@ msgstr "" #: ../../library/ssl.rst:608 msgid "" "TLS clients and servers require different default settings for secure " -"communication. The generic TLS protocol constant is deprecated in favor of :" -"data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`." +"communication. The generic TLS protocol constant is deprecated in favor " +"of :data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`." msgstr "" "TLS 的用戶端及伺服器端需要不同的預設值來實現安全通訊。通用的 TLS 協定常數已被" "廢除,並改用 :data:`PROTOCOL_TLS_CLIENT` 和 :data:`PROTOCOL_TLS_SERVER`。" @@ -962,13 +971,13 @@ msgstr "第三版的 SSL 是不安全的,強烈建議不要使用。" #: ../../library/ssl.rst:649 msgid "" "OpenSSL has deprecated all version specific protocols. Use the default " -"protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` with :" -"attr:`SSLContext.minimum_version` and :attr:`SSLContext.maximum_version` " -"instead." +"protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` " +"with :attr:`SSLContext.minimum_version` " +"and :attr:`SSLContext.maximum_version` instead." msgstr "" -"OpenSSL 已經終止了所有特定版本的協定。請改用預設的 :data:" -"`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` 和 :attr:" -"`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" +"OpenSSL 已經終止了所有特定版本的協定。請改用預設" +"的 :data:`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` " +"和 :attr:`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" #: ../../library/ssl.rst:657 msgid "Selects TLS version 1.0 as the channel encryption protocol." @@ -1041,11 +1050,13 @@ msgstr "" #: ../../library/ssl.rst:725 msgid "" -"The option is deprecated since OpenSSL 1.1.0, use the new :attr:`SSLContext." -"minimum_version` and :attr:`SSLContext.maximum_version` instead." +"The option is deprecated since OpenSSL 1.1.0, use the " +"new :attr:`SSLContext.minimum_version` " +"and :attr:`SSLContext.maximum_version` instead." msgstr "" -"該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新的 :attr:`SSLContext." -"minimum_version` 及 :attr:`SSLContext.maximum_version` 代替。" +"該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新" +"的 :attr:`SSLContext.minimum_version` 及 :attr:`SSLContext.maximum_version` " +"代替。" #: ../../library/ssl.rst:732 msgid "" @@ -1195,16 +1206,16 @@ msgid "" "Whether the OpenSSL library has built-in support for the *Application-Layer " "Protocol Negotiation* TLS extension as described in :rfc:`7301`." msgstr "" -"OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述在 :" -"rfc:`7301` 中。" +"OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述" +"在 :rfc:`7301` 中。" #: ../../library/ssl.rst:864 msgid "" "Whether the OpenSSL library has built-in support not checking subject common " "name and :attr:`SSLContext.hostname_checks_common_name` is writeable." msgstr "" -"OpenSSL 函式庫是否內建支援不檢查主題通用名稱及 :attr:`SSLContext." -"hostname_checks_common_name` 是否可寫。" +"OpenSSL 函式庫是否內建支援不檢查主題通用名稱" +"及 :attr:`SSLContext.hostname_checks_common_name` 是否可寫。" #: ../../library/ssl.rst:872 msgid "" @@ -1271,18 +1282,23 @@ msgid "Whether the OpenSSL library has built-in support for TLS-PSK." msgstr "此 OpenSSL 函式庫是否內建支援 TLS-PSK。" #: ../../library/ssl.rst:939 +#, fuzzy +msgid "Whether the OpenSSL library has built-in support for TLS-PHA." +msgstr "此 OpenSSL 函式庫是否內建支援 TLS-PSK。" + +#: ../../library/ssl.rst:945 msgid "" "List of supported TLS channel binding types. Strings in this list can be " "used as arguments to :meth:`SSLSocket.get_channel_binding`." msgstr "" -"支援的 TLS 通道綁定類型列表。列表中的字串可以作為 :meth:`SSLSocket." -"get_channel_binding` 的參數。" +"支援的 TLS 通道綁定類型列表。列表中的字串可以作" +"為 :meth:`SSLSocket.get_channel_binding` 的參數。" -#: ../../library/ssl.rst:946 +#: ../../library/ssl.rst:952 msgid "The version string of the OpenSSL library loaded by the interpreter::" msgstr "直譯器所加載的 OpenSSL 函式庫的版本字串::" -#: ../../library/ssl.rst:948 +#: ../../library/ssl.rst:954 msgid "" ">>> ssl.OPENSSL_VERSION\n" "'OpenSSL 1.0.2k 26 Jan 2017'" @@ -1290,13 +1306,13 @@ msgstr "" ">>> ssl.OPENSSL_VERSION\n" "'OpenSSL 1.0.2k 26 Jan 2017'" -#: ../../library/ssl.rst:955 +#: ../../library/ssl.rst:961 msgid "" "A tuple of five integers representing version information about the OpenSSL " "library::" msgstr "代表 OpenSSL 函式庫版本資訊的五個整數的元組: ::" -#: ../../library/ssl.rst:958 +#: ../../library/ssl.rst:964 msgid "" ">>> ssl.OPENSSL_VERSION_INFO\n" "(1, 0, 2, 11, 15)" @@ -1304,11 +1320,11 @@ msgstr "" ">>> ssl.OPENSSL_VERSION_INFO\n" "(1, 0, 2, 11, 15)" -#: ../../library/ssl.rst:965 +#: ../../library/ssl.rst:971 msgid "The raw version number of the OpenSSL library, as a single integer::" msgstr "OpenSSL 函式庫的初始版本,以單一整數表示::" -#: ../../library/ssl.rst:967 +#: ../../library/ssl.rst:973 msgid "" ">>> ssl.OPENSSL_VERSION_NUMBER\n" "268443839\n" @@ -1320,62 +1336,64 @@ msgstr "" ">>> hex(ssl.OPENSSL_VERSION_NUMBER)\n" "'0x100020bf'" -#: ../../library/ssl.rst:978 +#: ../../library/ssl.rst:984 msgid "" "Alert Descriptions from :rfc:`5246` and others. The `IANA TLS Alert Registry " "`_ contains this list and references to the RFCs where their " "meaning is defined." msgstr "" -"來自 :rfc:`5246` 和其他文件的警報描述。`IANA TLS Alert Registry `_ 包" -"含了此列表以及其含義定義所在的 RFC 的引用。" +"來自 :rfc:`5246` 和其他文件的警報描述。`IANA TLS Alert Registry `_ 包含了此列表以及其含義定義所在的 RFC 的引用。" -#: ../../library/ssl.rst:982 +#: ../../library/ssl.rst:988 msgid "" -"Used as the return value of the callback function in :meth:`SSLContext." -"set_servername_callback`." +"Used as the return value of the callback function " +"in :meth:`SSLContext.set_servername_callback`." msgstr "" "被用來做為 :meth:`SSLContext.set_servername_callback` 中回呼函式的回傳值。" -#: ../../library/ssl.rst:989 +#: ../../library/ssl.rst:995 msgid ":class:`enum.IntEnum` collection of ALERT_DESCRIPTION_* constants." msgstr ":class:`enum.IntEnum` 為 ALERT_DESCRIPTION_* 常數中的一個集合。" -#: ../../library/ssl.rst:995 +#: ../../library/ssl.rst:1001 msgid "" -"Option for :func:`create_default_context` and :meth:`SSLContext." -"load_default_certs`. This value indicates that the context may be used to " -"authenticate web servers (therefore, it will be used to create client-side " -"sockets)." +"Option for :func:`create_default_context` " +"and :meth:`SSLContext.load_default_certs`. This value indicates that the " +"context may be used to authenticate web servers (therefore, it will be used " +"to create client-side sockets)." msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁伺服器 (因此它將用於建立用戶端 socket)。" -#: ../../library/ssl.rst:1004 +#: ../../library/ssl.rst:1010 msgid "" -"Option for :func:`create_default_context` and :meth:`SSLContext." -"load_default_certs`. This value indicates that the context may be used to " -"authenticate web clients (therefore, it will be used to create server-side " -"sockets)." +"Option for :func:`create_default_context` " +"and :meth:`SSLContext.load_default_certs`. This value indicates that the " +"context may be used to authenticate web clients (therefore, it will be used " +"to create server-side sockets)." msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁用戶端 (因此,它將用於建立伺服器端的 " "socket)。" -#: ../../library/ssl.rst:1013 +#: ../../library/ssl.rst:1019 msgid ":class:`enum.IntEnum` collection of SSL_ERROR_* constants." msgstr ":class:`enum.IntEnum` 為 SSL_ERROR_* 常數中的一個集合。" -#: ../../library/ssl.rst:1019 +#: ../../library/ssl.rst:1025 msgid "" -":class:`enum.IntEnum` collection of SSL and TLS versions for :attr:" -"`SSLContext.maximum_version` and :attr:`SSLContext.minimum_version`." +":class:`enum.IntEnum` collection of SSL and TLS versions " +"for :attr:`SSLContext.maximum_version` " +"and :attr:`SSLContext.minimum_version`." msgstr "" -"用於 :attr:`SSLContext.maximum_version` 和 :attr:`SSLContext." -"minimum_version` 的 SSL 和 TLS 版本 :class:`enum.IntEnum` 集合。" +"用於 :attr:`SSLContext.maximum_version` " +"和 :attr:`SSLContext.minimum_version` 的 SSL 和 TLS 版" +"本 :class:`enum.IntEnum` 集合。" -#: ../../library/ssl.rst:1027 +#: ../../library/ssl.rst:1033 msgid "" "The minimum or maximum supported SSL or TLS version. These are magic " "constants. Their values don't reflect the lowest and highest available TLS/" @@ -1384,75 +1402,71 @@ msgstr "" "最低或最高支援的 SSL 或 TLS 版本。這些是特殊常數。它們的值並不反映可用的最低" "和最高 TLS/SSL 版本。" -#: ../../library/ssl.rst:1037 +#: ../../library/ssl.rst:1043 msgid "SSL 3.0 to TLS 1.3." msgstr "SSL 3.0 到 TLS 1.3。" -#: ../../library/ssl.rst:1041 +#: ../../library/ssl.rst:1047 msgid "" -"All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` and :attr:" -"`TLSVersion.TLSv1_3` are deprecated." +"All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` " +"and :attr:`TLSVersion.TLSv1_3` are deprecated." msgstr "" -"除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有的 :" -"class:`TLSVersion` 成員都已被棄用。" +"除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有" +"的 :class:`TLSVersion` 成員都已被棄用。" -#: ../../library/ssl.rst:1046 +#: ../../library/ssl.rst:1052 msgid "SSL Sockets" msgstr "SSL Sockets" -#: ../../library/ssl.rst:1050 +#: ../../library/ssl.rst:1056 msgid "SSL sockets provide the following methods of :ref:`socket-objects`:" msgstr "SSL sockets 提供以下 :ref:`socket-objects` 方法:" -#: ../../library/ssl.rst:1052 +#: ../../library/ssl.rst:1058 msgid ":meth:`~socket.socket.accept`" msgstr ":meth:`~socket.socket.accept`" -#: ../../library/ssl.rst:1053 +#: ../../library/ssl.rst:1059 msgid ":meth:`~socket.socket.bind`" msgstr ":meth:`~socket.socket.bind`" -#: ../../library/ssl.rst:1054 +#: ../../library/ssl.rst:1060 msgid ":meth:`~socket.socket.close`" msgstr ":meth:`~socket.socket.close`" -#: ../../library/ssl.rst:1055 +#: ../../library/ssl.rst:1061 msgid ":meth:`~socket.socket.connect`" msgstr ":meth:`~socket.socket.connect`" -#: ../../library/ssl.rst:1056 +#: ../../library/ssl.rst:1062 msgid ":meth:`~socket.socket.detach`" msgstr ":meth:`~socket.socket.detach`" -#: ../../library/ssl.rst:1057 +#: ../../library/ssl.rst:1063 msgid ":meth:`~socket.socket.fileno`" msgstr ":meth:`~socket.socket.fileno`" -#: ../../library/ssl.rst:1058 +#: ../../library/ssl.rst:1064 msgid ":meth:`~socket.socket.getpeername`, :meth:`~socket.socket.getsockname`" msgstr ":meth:`~socket.socket.getpeername`、:meth:`~socket.socket.getsockname`" -#: ../../library/ssl.rst:1059 +#: ../../library/ssl.rst:1065 msgid ":meth:`~socket.socket.getsockopt`, :meth:`~socket.socket.setsockopt`" msgstr ":meth:`~socket.socket.getsockopt`、:meth:`~socket.socket.setsockopt`" -#: ../../library/ssl.rst:1060 -msgid "" -":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:" -"`~socket.socket.setblocking`" -msgstr "" -":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:" -"`~socket.socket.setblocking`" +#: ../../library/ssl.rst:1066 +msgid ":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:`~socket.socket.setblocking`" +msgstr ":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:`~socket.socket.setblocking`" -#: ../../library/ssl.rst:1062 +#: ../../library/ssl.rst:1068 msgid ":meth:`~socket.socket.listen`" msgstr ":meth:`~socket.socket.listen`" -#: ../../library/ssl.rst:1063 +#: ../../library/ssl.rst:1069 msgid ":meth:`~socket.socket.makefile`" msgstr ":meth:`~socket.socket.makefile`" -#: ../../library/ssl.rst:1064 +#: ../../library/ssl.rst:1070 msgid "" ":meth:`~socket.socket.recv`, :meth:`~socket.socket.recv_into` (but passing a " "non-zero ``flags`` argument is not allowed)" @@ -1460,7 +1474,7 @@ msgstr "" ":meth:`~socket.socket.recv`、:meth:`~socket.socket.recv_into` (但不允許傳遞" "非零的 ``flags`` 引數)" -#: ../../library/ssl.rst:1066 +#: ../../library/ssl.rst:1072 msgid "" ":meth:`~socket.socket.send`, :meth:`~socket.socket.sendall` (with the same " "limitation)" @@ -1468,7 +1482,7 @@ msgstr "" ":meth:`~socket.socket.send`、:meth:`~socket.socket.sendall` (同樣不允許傳遞" "非零的 ``flags`` 引數)" -#: ../../library/ssl.rst:1068 +#: ../../library/ssl.rst:1074 msgid "" ":meth:`~socket.socket.sendfile` (but :mod:`os.sendfile` will be used for " "plain-text sockets only, else :meth:`~socket.socket.send` will be used)" @@ -1476,11 +1490,11 @@ msgstr "" ":meth:`~socket.socket.sendfile` (但 :mod:`os.sendfile` 只能用於純文本 " "sockets,其餘則會使用 :meth:`~socket.socket.send`)" -#: ../../library/ssl.rst:1070 +#: ../../library/ssl.rst:1076 msgid ":meth:`~socket.socket.shutdown`" msgstr ":meth:`~socket.socket.shutdown`" -#: ../../library/ssl.rst:1072 +#: ../../library/ssl.rst:1078 msgid "" "However, since the SSL (and TLS) protocol has its own framing atop of TCP, " "the SSL sockets abstraction can, in certain respects, diverge from the " @@ -1491,18 +1505,18 @@ msgstr "" "sockets 的抽象可能會與普通作業系統級別的 sockets 規範有所不同。特別是請參閱" "\\ :ref:`關於 non-blocking sockets 的說明 `。" -#: ../../library/ssl.rst:1077 +#: ../../library/ssl.rst:1083 msgid "" -"Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." -"wrap_socket` method." +"Instances of :class:`SSLSocket` must be created using " +"the :meth:`SSLContext.wrap_socket` method." msgstr "" ":class:`SSLSocket` 的實例必須使用 :meth:`SSLContext.wrap_socket` 方法建立。" -#: ../../library/ssl.rst:1080 +#: ../../library/ssl.rst:1086 msgid "The :meth:`sendfile` method was added." msgstr "新增 :meth:`sendfile` 方法。" -#: ../../library/ssl.rst:1083 +#: ../../library/ssl.rst:1089 msgid "" "The :meth:`shutdown` does not reset the socket timeout each time bytes are " "received or sent. The socket timeout is now the maximum total duration of " @@ -1511,24 +1525,25 @@ msgstr "" ":meth:`shutdown` 不會在每次接收或發送位元組時重置 socket 超時時間。現在," "socket 超時時間是關閉操作的最大總持續時間。" -#: ../../library/ssl.rst:1088 +#: ../../library/ssl.rst:1094 msgid "" -"It is deprecated to create a :class:`SSLSocket` instance directly, use :meth:" -"`SSLContext.wrap_socket` to wrap a socket." +"It is deprecated to create a :class:`SSLSocket` instance directly, " +"use :meth:`SSLContext.wrap_socket` to wrap a socket." msgstr "" -"直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使用 :meth:`SSLContext." -"wrap_socket` 來包裝 socket。" +"直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使" +"用 :meth:`SSLContext.wrap_socket` 來包裝 socket。" -#: ../../library/ssl.rst:1092 +#: ../../library/ssl.rst:1098 msgid "" -":class:`SSLSocket` instances must to created with :meth:`~SSLContext." -"wrap_socket`. In earlier versions, it was possible to create instances " -"directly. This was never documented or officially supported." +":class:`SSLSocket` instances must to created " +"with :meth:`~SSLContext.wrap_socket`. In earlier versions, it was possible " +"to create instances directly. This was never documented or officially " +"supported." msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`~SSLContext.wrap_socket` 建立。在較早" "的版本中可以直接建立實例,但這從未被記錄或正式支援。" -#: ../../library/ssl.rst:1098 +#: ../../library/ssl.rst:1104 msgid "" "Python now uses ``SSL_read_ex`` and ``SSL_write_ex`` internally. The " "functions support reading and writing of data larger than 2 GB. Writing zero-" @@ -1537,11 +1552,11 @@ msgstr "" "Python 現在內部使用了 ``SSL_read_ex`` 和 ``SSL_write_ex`` 函式。這些函式支援" "讀取和寫入大於 2 GB 的資料。寫入零長度的資料不再會導致協定違規錯誤。" -#: ../../library/ssl.rst:1103 +#: ../../library/ssl.rst:1109 msgid "SSL sockets also have the following additional methods and attributes:" msgstr "SSL sockets 還具有以下附加方法和屬性:" -#: ../../library/ssl.rst:1107 +#: ../../library/ssl.rst:1113 msgid "" "Read up to *len* bytes of data from the SSL socket and return the result as " "a ``bytes`` instance. If *buffer* is specified, then read into the buffer " @@ -1550,22 +1565,23 @@ msgstr "" "從 SSL socket 讀取 *len* 位元組的資料,並將結果以 ``bytes`` 實例的形式回傳。" "如果指定了 *buffer*,則將資料讀入緩衝區,並回傳讀取的位元組。" -#: ../../library/ssl.rst:1111 +#: ../../library/ssl.rst:1117 msgid "" -"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" -"ref:`non-blocking ` and the read would block." +"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket " +"is :ref:`non-blocking ` and the read would block." msgstr "" -"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" -"`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻塞。" +"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引" +"發 :exc:`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻" +"塞。" -#: ../../library/ssl.rst:1114 +#: ../../library/ssl.rst:1120 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`read` can also " "cause write operations." msgstr "" "由於在任何時刻都可能發生重新協商,呼叫 :meth:`read` 也可能觸發寫入操作。" -#: ../../library/ssl.rst:1117 +#: ../../library/ssl.rst:1123 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration to read up to *len* " @@ -1574,11 +1590,11 @@ msgstr "" "當接收或發送位元組時,socket 的超時時間將不再重置。現在,socket 超時時間是讀" "取最多 *len* 位元組的總最大持續時間。" -#: ../../library/ssl.rst:1122 +#: ../../library/ssl.rst:1128 msgid "Use :meth:`~SSLSocket.recv` instead of :meth:`~SSLSocket.read`." msgstr "請改用 :meth:`~SSLSocket.recv` 來替換掉 :meth:`~SSLSocket.read`。" -#: ../../library/ssl.rst:1127 +#: ../../library/ssl.rst:1133 msgid "" "Write *buf* to the SSL socket and return the number of bytes written. The " "*buf* argument must be an object supporting the buffer interface." @@ -1586,22 +1602,23 @@ msgstr "" "將 *buf* 寫入 SSL socket 並回傳寫入的位元組數量。*buf* 引數必須是支援緩衝區介" "面的物件。" -#: ../../library/ssl.rst:1130 +#: ../../library/ssl.rst:1136 msgid "" -"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" -"ref:`non-blocking ` and the write would block." +"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket " +"is :ref:`non-blocking ` and the write would block." msgstr "" -"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" -"`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻塞。" +"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引" +"發 :exc:`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻" +"塞。" -#: ../../library/ssl.rst:1133 +#: ../../library/ssl.rst:1139 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`write` can " "also cause read operations." msgstr "" "由於在任何時刻都可能發生重新協商,呼叫 :meth:`write` 也可能觸發讀取操作。" -#: ../../library/ssl.rst:1136 +#: ../../library/ssl.rst:1142 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration to write *buf*." @@ -1609,44 +1626,46 @@ msgstr "" "當接收或發送位元組時,socket 的超時時間將不再重置。現在,socket 超時時間是寫" "入 *buf* 的總最大持續時間。" -#: ../../library/ssl.rst:1140 +#: ../../library/ssl.rst:1146 msgid "Use :meth:`~SSLSocket.send` instead of :meth:`~SSLSocket.write`." msgstr "請改用 :meth:`~SSLSocket.send` 來替換掉 :meth:`~SSLSocket.write`。" -#: ../../library/ssl.rst:1145 +#: ../../library/ssl.rst:1151 msgid "" "The :meth:`~SSLSocket.read` and :meth:`~SSLSocket.write` methods are the low-" "level methods that read and write unencrypted, application-level data and " "decrypt/encrypt it to encrypted, wire-level data. These methods require an " -"active SSL connection, i.e. the handshake was completed and :meth:`SSLSocket." -"unwrap` was not called." +"active SSL connection, i.e. the handshake was completed " +"and :meth:`SSLSocket.unwrap` was not called." msgstr "" ":meth:`~SSLSocket.read` 和 :meth:`~SSLSocket.write` 方法為低階層的方法,負責" "讀取和寫入未加密的應用層資料,並將其加密/解密為加密的寫入層資料。這些方法需要" "一個已建立的 SSL 連接,即握手已完成,且未呼叫 :meth:`SSLSocket.unwrap`。" -#: ../../library/ssl.rst:1151 +#: ../../library/ssl.rst:1157 msgid "" -"Normally you should use the socket API methods like :meth:`~socket.socket." -"recv` and :meth:`~socket.socket.send` instead of these methods." +"Normally you should use the socket API methods " +"like :meth:`~socket.socket.recv` and :meth:`~socket.socket.send` instead of " +"these methods." msgstr "" "通常你應該使用像 :meth:`~socket.socket.recv` 和 :meth:`~socket.socket.send` " "這樣的 socket API 方法,而不是直接使用這些方法。" -#: ../../library/ssl.rst:1157 +#: ../../library/ssl.rst:1163 msgid "Perform the SSL setup handshake." msgstr "執行 SSL 設定握手。" -#: ../../library/ssl.rst:1159 +#: ../../library/ssl.rst:1165 msgid "" -"The handshake method also performs :func:`match_hostname` when the :attr:" -"`~SSLContext.check_hostname` attribute of the socket's :attr:`~SSLSocket." -"context` is true." +"The handshake method also performs :func:`match_hostname` when " +"the :attr:`~SSLContext.check_hostname` attribute of the " +"socket's :attr:`~SSLSocket.context` is true." msgstr "" -"當 socket 的 :attr:`~SSLSocket.context` 的 :attr:`~SSLContext." -"check_hostname` 屬性質為 true 時,握手方法也會執行 :func:`match_hostname`。" +"當 socket 的 :attr:`~SSLSocket.context` " +"的 :attr:`~SSLContext.check_hostname` 屬性質為 true 時,握手方法也會執" +"行 :func:`match_hostname`。" -#: ../../library/ssl.rst:1164 +#: ../../library/ssl.rst:1170 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration of the handshake." @@ -1654,27 +1673,27 @@ msgstr "" "Socket 超時時間已經不會在每次接收或傳送位元組時重置。現在,超時時間是握手過程" "的最大總持續時間。" -#: ../../library/ssl.rst:1168 +#: ../../library/ssl.rst:1174 msgid "" -"Hostname or IP address is matched by OpenSSL during handshake. The function :" -"func:`match_hostname` is no longer used. In case OpenSSL refuses a hostname " -"or IP address, the handshake is aborted early and a TLS alert message is " -"sent to the peer." +"Hostname or IP address is matched by OpenSSL during handshake. The " +"function :func:`match_hostname` is no longer used. In case OpenSSL refuses a " +"hostname or IP address, the handshake is aborted early and a TLS alert " +"message is sent to the peer." msgstr "" -"在握手過程中,OpenSSL 會去配對主機名稱或 IP 地址。已不再使用 :func:" -"`match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手將會提前" -"中止,並向對方發送 TLS 警報訊息。" +"在握手過程中,OpenSSL 會去配對主機名稱或 IP 地址。已不再使" +"用 :func:`match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手" +"將會提前中止,並向對方發送 TLS 警報訊息。" -#: ../../library/ssl.rst:1176 +#: ../../library/ssl.rst:1182 msgid "" "If there is no certificate for the peer on the other end of the connection, " -"return ``None``. If the SSL handshake hasn't been done yet, raise :exc:" -"`ValueError`." +"return ``None``. If the SSL handshake hasn't been done yet, " +"raise :exc:`ValueError`." msgstr "" -"如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引發 :exc:" -"`ValueError`。" +"如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引" +"發 :exc:`ValueError`。" -#: ../../library/ssl.rst:1180 +#: ../../library/ssl.rst:1186 msgid "" "If the ``binary_form`` parameter is :const:`False`, and a certificate was " "received from the peer, this method returns a :class:`dict` instance. If " @@ -1691,7 +1710,7 @@ msgstr "" "``issuer`` (簽發證書的主體)。如果證書中包含 *Subject Alternative Name* 擴充 " "(參考\\ :rfc:`3280`\\ ),字典中還會有一個 ``subjectAltName`` 鍵。" -#: ../../library/ssl.rst:1189 +#: ../../library/ssl.rst:1195 msgid "" "The ``subject`` and ``issuer`` fields are tuples containing the sequence of " "relative distinguished names (RDNs) given in the certificate's data " @@ -1702,7 +1721,7 @@ msgstr "" "names, RDNs) 序列的元組,這些 RDN 來自證書資料結構中的相應欄位。每個 RDN 都是" "一組名稱與值的對。以下是現實中的範例: ::" -#: ../../library/ssl.rst:1194 +#: ../../library/ssl.rst:1200 msgid "" "{'issuer': ((('countryName', 'IL'),),\n" " (('organizationName', 'StartCom Ltd.'),),\n" @@ -1744,7 +1763,7 @@ msgstr "" " 'subjectAltName': (('DNS', '*.eff.org'), ('DNS', 'eff.org')),\n" " 'version': 3}" -#: ../../library/ssl.rst:1213 +#: ../../library/ssl.rst:1219 msgid "" "If the ``binary_form`` parameter is :const:`True`, and a certificate was " "provided, this method returns the DER-encoded form of the entire certificate " @@ -1753,61 +1772,61 @@ msgid "" "socket's role:" msgstr "" "如果 ``binary_form`` 參數設定為 :const:`True`,且對等提供了證書,則該方法會" -"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回傳 :" -"const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" +"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回" +"傳 :const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" -#: ../../library/ssl.rst:1219 +#: ../../library/ssl.rst:1225 msgid "" "for a client SSL socket, the server will always provide a certificate, " "regardless of whether validation was required;" msgstr "對於用戶端 SSL socket,伺服器將永遠提供證書,無論是否需要進行驗證;" -#: ../../library/ssl.rst:1222 +#: ../../library/ssl.rst:1228 msgid "" "for a server SSL socket, the client will only provide a certificate when " -"requested by the server; therefore :meth:`getpeercert` will return :const:" -"`None` if you used :const:`CERT_NONE` (rather than :const:`CERT_OPTIONAL` " -"or :const:`CERT_REQUIRED`)." +"requested by the server; therefore :meth:`getpeercert` will " +"return :const:`None` if you used :const:`CERT_NONE` (rather " +"than :const:`CERT_OPTIONAL` or :const:`CERT_REQUIRED`)." msgstr "" "對於伺服器 SSL socket,用戶端僅在伺服器要求時才會提供證書;因此,如果你使用的" -"是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` 或 :const:" -"`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" +"是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` " +"或 :const:`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" -#: ../../library/ssl.rst:1227 +#: ../../library/ssl.rst:1233 msgid "See also :attr:`SSLContext.check_hostname`." msgstr "請見 :attr:`SSLContext.check_hostname`。" -#: ../../library/ssl.rst:1229 +#: ../../library/ssl.rst:1235 msgid "" "The returned dictionary includes additional items such as ``issuer`` and " "``notBefore``." msgstr "" -#: ../../library/ssl.rst:1233 +#: ../../library/ssl.rst:1239 msgid "" ":exc:`ValueError` is raised when the handshake isn't done. The returned " "dictionary includes additional X509v3 extension items such as " "``crlDistributionPoints``, ``caIssuers`` and ``OCSP`` URIs." msgstr "" -#: ../../library/ssl.rst:1238 +#: ../../library/ssl.rst:1244 msgid "IPv6 address strings no longer have a trailing new line." msgstr "" -#: ../../library/ssl.rst:1243 +#: ../../library/ssl.rst:1249 msgid "" "Returns verified certificate chain provided by the other end of the SSL " "channel as a list of DER-encoded bytes. If certificate verification was " "disabled method acts the same as :meth:`~SSLSocket.get_unverified_chain`." msgstr "" -#: ../../library/ssl.rst:1252 +#: ../../library/ssl.rst:1258 msgid "" "Returns raw certificate chain provided by the other end of the SSL channel " "as a list of DER-encoded bytes." msgstr "" -#: ../../library/ssl.rst:1259 +#: ../../library/ssl.rst:1265 msgid "" "Returns a three-value tuple containing the name of the cipher being used, " "the version of the SSL protocol that defines its use, and the number of " @@ -1815,7 +1834,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ssl.rst:1265 +#: ../../library/ssl.rst:1271 msgid "" "Return the list of ciphers available in both the client and server. Each " "entry of the returned list is a three-value tuple containing the name of the " @@ -1825,42 +1844,43 @@ msgid "" "socket." msgstr "" -#: ../../library/ssl.rst:1276 +#: ../../library/ssl.rst:1282 msgid "" "Return the compression algorithm being used as a string, or ``None`` if the " "connection isn't compressed." msgstr "" -#: ../../library/ssl.rst:1279 +#: ../../library/ssl.rst:1285 msgid "" "If the higher-level protocol supports its own compression mechanism, you can " "use :data:`OP_NO_COMPRESSION` to disable SSL-level compression." msgstr "" -#: ../../library/ssl.rst:1286 +#: ../../library/ssl.rst:1292 msgid "" "Get channel binding data for current connection, as a bytes object. Returns " "``None`` if not connected or the handshake has not been completed." msgstr "" -#: ../../library/ssl.rst:1289 +#: ../../library/ssl.rst:1295 msgid "" "The *cb_type* parameter allow selection of the desired channel binding type. " "Valid channel binding types are listed in the :data:`CHANNEL_BINDING_TYPES` " -"list. Currently only the 'tls-unique' channel binding, defined by :rfc:" -"`5929`, is supported. :exc:`ValueError` will be raised if an unsupported " -"channel binding type is requested." +"list. Currently only the 'tls-unique' channel binding, defined " +"by :rfc:`5929`, is supported. :exc:`ValueError` will be raised if an " +"unsupported channel binding type is requested." msgstr "" -#: ../../library/ssl.rst:1299 +#: ../../library/ssl.rst:1305 msgid "" -"Return the protocol that was selected during the TLS handshake. If :meth:" -"`SSLContext.set_alpn_protocols` was not called, if the other party does not " -"support ALPN, if this socket does not support any of the client's proposed " -"protocols, or if the handshake has not happened yet, ``None`` is returned." +"Return the protocol that was selected during the TLS handshake. " +"If :meth:`SSLContext.set_alpn_protocols` was not called, if the other party " +"does not support ALPN, if this socket does not support any of the client's " +"proposed protocols, or if the handshake has not happened yet, ``None`` is " +"returned." msgstr "" -#: ../../library/ssl.rst:1309 +#: ../../library/ssl.rst:1315 msgid "" "Return the higher-level protocol that was selected during the TLS/SSL " "handshake. If :meth:`SSLContext.set_npn_protocols` was not called, or if the " @@ -1868,11 +1888,11 @@ msgid "" "this will return ``None``." msgstr "" -#: ../../library/ssl.rst:1318 ../../library/ssl.rst:1687 +#: ../../library/ssl.rst:1324 ../../library/ssl.rst:1693 msgid "NPN has been superseded by ALPN" msgstr "" -#: ../../library/ssl.rst:1322 +#: ../../library/ssl.rst:1328 msgid "" "Performs the SSL shutdown handshake, which removes the TLS layer from the " "underlying socket, and returns the underlying socket object. This can be " @@ -1881,34 +1901,34 @@ msgid "" "other side of the connection, rather than the original socket." msgstr "" -#: ../../library/ssl.rst:1330 +#: ../../library/ssl.rst:1336 msgid "" "Requests post-handshake authentication (PHA) from a TLS 1.3 client. PHA can " "only be initiated for a TLS 1.3 connection from a server-side socket, after " -"the initial TLS handshake and with PHA enabled on both sides, see :attr:" -"`SSLContext.post_handshake_auth`." +"the initial TLS handshake and with PHA enabled on both sides, " +"see :attr:`SSLContext.post_handshake_auth`." msgstr "" -#: ../../library/ssl.rst:1335 +#: ../../library/ssl.rst:1341 msgid "" "The method does not perform a cert exchange immediately. The server-side " "sends a CertificateRequest during the next write event and expects the " "client to respond with a certificate on the next read event." msgstr "" -#: ../../library/ssl.rst:1339 +#: ../../library/ssl.rst:1345 msgid "" -"If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), an :exc:" -"`SSLError` is raised." +"If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), " +"an :exc:`SSLError` is raised." msgstr "" -#: ../../library/ssl.rst:1343 +#: ../../library/ssl.rst:1349 msgid "" "Only available with OpenSSL 1.1.1 and TLS 1.3 enabled. Without TLS 1.3 " "support, the method raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/ssl.rst:1350 +#: ../../library/ssl.rst:1356 msgid "" "Return the actual SSL protocol version negotiated by the connection as a " "string, or ``None`` if no secure connection is established. As of this " @@ -1917,49 +1937,49 @@ msgid "" "may define more return values." msgstr "" -#: ../../library/ssl.rst:1360 +#: ../../library/ssl.rst:1366 msgid "" "Returns the number of already decrypted bytes available for read, pending on " "the connection." msgstr "" -#: ../../library/ssl.rst:1365 +#: ../../library/ssl.rst:1371 msgid "The :class:`SSLContext` object this SSL socket is tied to." msgstr "" -#: ../../library/ssl.rst:1371 +#: ../../library/ssl.rst:1377 msgid "" "A boolean which is ``True`` for server-side sockets and ``False`` for client-" "side sockets." msgstr "" -#: ../../library/ssl.rst:1378 +#: ../../library/ssl.rst:1384 msgid "" "Hostname of the server: :class:`str` type, or ``None`` for server-side " "socket or if the hostname was not specified in the constructor." msgstr "" -#: ../../library/ssl.rst:1383 +#: ../../library/ssl.rst:1389 msgid "" "The attribute is now always ASCII text. When ``server_hostname`` is an " "internationalized domain name (IDN), this attribute now stores the A-label " -"form (``\"xn--pythn-mua.org\"``), rather than the U-label form (``\"pythön." -"org\"``)." +"form (``\"xn--pythn-mua.org\"``), rather than the U-label form " +"(``\"pythön.org\"``)." msgstr "" -#: ../../library/ssl.rst:1391 +#: ../../library/ssl.rst:1397 msgid "" "The :class:`SSLSession` for this SSL connection. The session is available " "for client and server side sockets after the TLS handshake has been " -"performed. For client sockets the session can be set before :meth:" -"`~SSLSocket.do_handshake` has been called to reuse a session." +"performed. For client sockets the session can be set " +"before :meth:`~SSLSocket.do_handshake` has been called to reuse a session." msgstr "" -#: ../../library/ssl.rst:1404 +#: ../../library/ssl.rst:1410 msgid "SSL Contexts" msgstr "" -#: ../../library/ssl.rst:1408 +#: ../../library/ssl.rst:1414 msgid "" "An SSL context holds various data longer-lived than single SSL connections, " "such as SSL configuration options, certificate(s) and private key(s). It " @@ -1967,7 +1987,7 @@ msgid "" "speed up repeated connections from the same clients." msgstr "" -#: ../../library/ssl.rst:1415 +#: ../../library/ssl.rst:1421 msgid "" "Create a new SSL context. You may pass *protocol* which must be one of the " "``PROTOCOL_*`` constants defined in this module. The parameter specifies " @@ -1978,135 +1998,134 @@ msgid "" "provides the most compatibility with other versions." msgstr "" -#: ../../library/ssl.rst:1424 +#: ../../library/ssl.rst:1430 msgid "" "Here's a table showing which versions in a client (down the side) can " "connect to which versions in a server (along the top):" msgstr "" -#: ../../library/ssl.rst:1430 +#: ../../library/ssl.rst:1436 msgid "*client* / **server**" msgstr "*client* / **server**" -#: ../../library/ssl.rst:1430 +#: ../../library/ssl.rst:1436 msgid "**SSLv2**" msgstr "**SSLv2**" -#: ../../library/ssl.rst:1430 +#: ../../library/ssl.rst:1436 msgid "**SSLv3**" msgstr "**SSLv3**" -#: ../../library/ssl.rst:1430 +#: ../../library/ssl.rst:1436 msgid "**TLS** [3]_" msgstr "**TLS** [3]_" -#: ../../library/ssl.rst:1430 +#: ../../library/ssl.rst:1436 msgid "**TLSv1**" msgstr "**TLSv1**" -#: ../../library/ssl.rst:1430 +#: ../../library/ssl.rst:1436 msgid "**TLSv1.1**" msgstr "**TLSv1.1**" -#: ../../library/ssl.rst:1430 +#: ../../library/ssl.rst:1436 msgid "**TLSv1.2**" msgstr "**TLSv1.2**" -#: ../../library/ssl.rst:1432 +#: ../../library/ssl.rst:1438 msgid "*SSLv2*" msgstr "*SSLv2*" -#: ../../library/ssl.rst:1432 ../../library/ssl.rst:1433 -#: ../../library/ssl.rst:1434 ../../library/ssl.rst:1435 -#: ../../library/ssl.rst:1436 ../../library/ssl.rst:1437 +#: ../../library/ssl.rst:1438 ../../library/ssl.rst:1439 +#: ../../library/ssl.rst:1440 ../../library/ssl.rst:1441 +#: ../../library/ssl.rst:1442 ../../library/ssl.rst:1443 msgid "yes" msgstr "" -#: ../../library/ssl.rst:1432 ../../library/ssl.rst:1433 -#: ../../library/ssl.rst:1435 ../../library/ssl.rst:1436 -#: ../../library/ssl.rst:1437 +#: ../../library/ssl.rst:1438 ../../library/ssl.rst:1439 +#: ../../library/ssl.rst:1441 ../../library/ssl.rst:1442 +#: ../../library/ssl.rst:1443 msgid "no" msgstr "" -#: ../../library/ssl.rst:1432 ../../library/ssl.rst:1434 +#: ../../library/ssl.rst:1438 ../../library/ssl.rst:1440 msgid "no [1]_" msgstr "" -#: ../../library/ssl.rst:1433 +#: ../../library/ssl.rst:1439 msgid "*SSLv3*" msgstr "*SSLv3*" -#: ../../library/ssl.rst:1433 ../../library/ssl.rst:1434 +#: ../../library/ssl.rst:1439 ../../library/ssl.rst:1440 msgid "no [2]_" msgstr "" -#: ../../library/ssl.rst:1434 +#: ../../library/ssl.rst:1440 msgid "*TLS* (*SSLv23*) [3]_" msgstr "*TLS* (*SSLv23*) [3]_" -#: ../../library/ssl.rst:1435 +#: ../../library/ssl.rst:1441 msgid "*TLSv1*" msgstr "*TLSv1*" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1442 msgid "*TLSv1.1*" msgstr "*TLSv1.1*" -#: ../../library/ssl.rst:1437 +#: ../../library/ssl.rst:1443 msgid "*TLSv1.2*" msgstr "*TLSv1.2*" -#: ../../library/ssl.rst:1440 +#: ../../library/ssl.rst:1446 msgid "Footnotes" msgstr "註解" -#: ../../library/ssl.rst:1441 +#: ../../library/ssl.rst:1447 msgid ":class:`SSLContext` disables SSLv2 with :data:`OP_NO_SSLv2` by default." msgstr ":class:`SSLContext` 預設會關閉 SSLv2 的 :data:`OP_NO_SSLv2`。" -#: ../../library/ssl.rst:1442 +#: ../../library/ssl.rst:1448 msgid ":class:`SSLContext` disables SSLv3 with :data:`OP_NO_SSLv3` by default." msgstr ":class:`SSLContext` 預設會關閉 SSLv3 的 :data:`OP_NO_SSLv3`。" -#: ../../library/ssl.rst:1443 +#: ../../library/ssl.rst:1449 msgid "" "TLS 1.3 protocol will be available with :data:`PROTOCOL_TLS` in OpenSSL >= " "1.1.1. There is no dedicated PROTOCOL constant for just TLS 1.3." msgstr "" -#: ../../library/ssl.rst:1448 +#: ../../library/ssl.rst:1454 msgid "" ":func:`create_default_context` lets the :mod:`ssl` module choose security " "settings for a given purpose." msgstr "" -#: ../../library/ssl.rst:1453 +#: ../../library/ssl.rst:1459 msgid "" -"The context is created with secure default values. The options :data:" -"`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:" -"`OP_SINGLE_DH_USE`, :data:`OP_SINGLE_ECDH_USE`, :data:`OP_NO_SSLv2`, and :" -"data:`OP_NO_SSLv3` (except for :data:`PROTOCOL_SSLv3`) are set by default. " -"The initial cipher suite list contains only ``HIGH`` ciphers, no ``NULL`` " -"ciphers and no ``MD5`` ciphers." +"The context is created with secure default values. The " +"options :data:`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:`OP_SINGLE_DH_USE`, :data:`OP_SINGLE_ECDH_USE`, :data:`OP_NO_SSLv2`, " +"and :data:`OP_NO_SSLv3` (except for :data:`PROTOCOL_SSLv3`) are set by " +"default. The initial cipher suite list contains only ``HIGH`` ciphers, no " +"``NULL`` ciphers and no ``MD5`` ciphers." msgstr "" -#: ../../library/ssl.rst:1463 +#: ../../library/ssl.rst:1469 msgid "" ":class:`SSLContext` without protocol argument is deprecated. The context " -"class will either require :data:`PROTOCOL_TLS_CLIENT` or :data:" -"`PROTOCOL_TLS_SERVER` protocol in the future." +"class will either require :data:`PROTOCOL_TLS_CLIENT` " +"or :data:`PROTOCOL_TLS_SERVER` protocol in the future." msgstr "" -#: ../../library/ssl.rst:1469 +#: ../../library/ssl.rst:1475 msgid "" "The default cipher suites now include only secure AES and ChaCha20 ciphers " "with forward secrecy and security level 2. RSA and DH keys with less than " -"2048 bits and ECC keys with less than 224 bits are prohibited. :data:" -"`PROTOCOL_TLS`, :data:`PROTOCOL_TLS_CLIENT`, and :data:`PROTOCOL_TLS_SERVER` " -"use TLS 1.2 as minimum TLS version." +"2048 bits and ECC keys with less than 224 bits are " +"prohibited. :data:`PROTOCOL_TLS`, :data:`PROTOCOL_TLS_CLIENT`, " +"and :data:`PROTOCOL_TLS_SERVER` use TLS 1.2 as minimum TLS version." msgstr "" -#: ../../library/ssl.rst:1477 +#: ../../library/ssl.rst:1483 msgid "" ":class:`SSLContext` only supports limited mutation once it has been used by " "a connection. Adding new certificates to the internal trust store is " @@ -2114,29 +2133,29 @@ msgid "" "may result in surprising behavior." msgstr "" -#: ../../library/ssl.rst:1484 +#: ../../library/ssl.rst:1490 msgid "" ":class:`SSLContext` is designed to be shared and used by multiple " "connections. Thus, it is thread-safe as long as it is not reconfigured after " "being used by a connection." msgstr "" -#: ../../library/ssl.rst:1489 +#: ../../library/ssl.rst:1495 msgid ":class:`SSLContext` objects have the following methods and attributes:" msgstr "" -#: ../../library/ssl.rst:1493 +#: ../../library/ssl.rst:1499 msgid "" "Get statistics about quantities of loaded X.509 certificates, count of X.509 " "certificates flagged as CA certificates and certificate revocation lists as " "dictionary." msgstr "" -#: ../../library/ssl.rst:1497 +#: ../../library/ssl.rst:1503 msgid "Example for a context with one CA cert and one other cert::" msgstr "" -#: ../../library/ssl.rst:1499 +#: ../../library/ssl.rst:1505 msgid "" ">>> context.cert_store_stats()\n" "{'crl': 0, 'x509_ca': 1, 'x509': 2}" @@ -2144,7 +2163,7 @@ msgstr "" ">>> context.cert_store_stats()\n" "{'crl': 0, 'x509_ca': 1, 'x509': 2}" -#: ../../library/ssl.rst:1507 +#: ../../library/ssl.rst:1513 msgid "" "Load a private key and the corresponding certificate. The *certfile* string " "must be the path to a single file in PEM format containing the certificate " @@ -2155,7 +2174,7 @@ msgid "" "more information on how the certificate is stored in the *certfile*." msgstr "" -#: ../../library/ssl.rst:1516 +#: ../../library/ssl.rst:1522 msgid "" "The *password* argument may be a function to call to get the password for " "decrypting the private key. It will only be called if the private key is " @@ -2167,33 +2186,33 @@ msgid "" "encrypted and no password is needed." msgstr "" -#: ../../library/ssl.rst:1525 +#: ../../library/ssl.rst:1531 msgid "" "If the *password* argument is not specified and a password is required, " "OpenSSL's built-in password prompting mechanism will be used to " "interactively prompt the user for a password." msgstr "" -#: ../../library/ssl.rst:1529 +#: ../../library/ssl.rst:1535 msgid "" "An :class:`SSLError` is raised if the private key doesn't match with the " "certificate." msgstr "" -#: ../../library/ssl.rst:1532 +#: ../../library/ssl.rst:1538 msgid "New optional argument *password*." msgstr "" -#: ../../library/ssl.rst:1537 +#: ../../library/ssl.rst:1543 msgid "" "Load a set of default \"certification authority\" (CA) certificates from " "default locations. On Windows it loads CA certs from the ``CA`` and ``ROOT`` " -"system stores. On all systems it calls :meth:`SSLContext." -"set_default_verify_paths`. In the future the method may load CA certificates " -"from other locations, too." +"system stores. On all systems it " +"calls :meth:`SSLContext.set_default_verify_paths`. In the future the method " +"may load CA certificates from other locations, too." msgstr "" -#: ../../library/ssl.rst:1543 +#: ../../library/ssl.rst:1549 msgid "" "The *purpose* flag specifies what kind of CA certificates are loaded. The " "default settings :const:`Purpose.SERVER_AUTH` loads certificates, that are " @@ -2202,35 +2221,36 @@ msgid "" "certificate verification on the server side." msgstr "" -#: ../../library/ssl.rst:1553 +#: ../../library/ssl.rst:1559 msgid "" "Load a set of \"certification authority\" (CA) certificates used to validate " -"other peers' certificates when :data:`verify_mode` is other than :data:" -"`CERT_NONE`. At least one of *cafile* or *capath* must be specified." +"other peers' certificates when :data:`verify_mode` is other " +"than :data:`CERT_NONE`. At least one of *cafile* or *capath* must be " +"specified." msgstr "" -#: ../../library/ssl.rst:1557 +#: ../../library/ssl.rst:1563 msgid "" "This method can also load certification revocation lists (CRLs) in PEM or " "DER format. In order to make use of CRLs, :attr:`SSLContext.verify_flags` " "must be configured properly." msgstr "" -#: ../../library/ssl.rst:1561 +#: ../../library/ssl.rst:1567 msgid "" "The *cafile* string, if present, is the path to a file of concatenated CA " "certificates in PEM format. See the discussion of :ref:`ssl-certificates` " "for more information about how to arrange the certificates in this file." msgstr "" -#: ../../library/ssl.rst:1566 +#: ../../library/ssl.rst:1572 msgid "" "The *capath* string, if present, is the path to a directory containing " "several CA certificates in PEM format, following an `OpenSSL specific layout " "`_." msgstr "" -#: ../../library/ssl.rst:1571 +#: ../../library/ssl.rst:1577 msgid "" "The *cadata* object, if present, is either an ASCII string of one or more " "PEM-encoded certificates or a :term:`bytes-like object` of DER-encoded " @@ -2238,11 +2258,11 @@ msgid "" "are ignored but at least one certificate must be present." msgstr "" -#: ../../library/ssl.rst:1576 +#: ../../library/ssl.rst:1582 msgid "New optional argument *cadata*" msgstr "" -#: ../../library/ssl.rst:1581 +#: ../../library/ssl.rst:1587 msgid "" "Get a list of loaded \"certification authority\" (CA) certificates. If the " "``binary_form`` parameter is :const:`False` each list entry is a dict like " @@ -2252,19 +2272,19 @@ msgid "" "a SSL connection." msgstr "" -#: ../../library/ssl.rst:1589 +#: ../../library/ssl.rst:1595 msgid "" "Certificates in a capath directory aren't loaded unless they have been used " "at least once." msgstr "" -#: ../../library/ssl.rst:1596 +#: ../../library/ssl.rst:1602 msgid "" -"Get a list of enabled ciphers. The list is in order of cipher priority. See :" -"meth:`SSLContext.set_ciphers`." +"Get a list of enabled ciphers. The list is in order of cipher priority. " +"See :meth:`SSLContext.set_ciphers`." msgstr "" -#: ../../library/ssl.rst:1601 +#: ../../library/ssl.rst:1607 msgid "" ">>> ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)\n" ">>> ctx.set_ciphers('ECDHE+AESGCM:!ECDSA')\n" @@ -2322,7 +2342,7 @@ msgstr "" " 'strength_bits': 128,\n" " 'symmetric': 'aes-128-gcm'}]" -#: ../../library/ssl.rst:1633 +#: ../../library/ssl.rst:1639 msgid "" "Load a set of default \"certification authority\" (CA) certificates from a " "filesystem path defined when building the OpenSSL library. Unfortunately, " @@ -2332,7 +2352,7 @@ msgid "" "configured properly." msgstr "" -#: ../../library/ssl.rst:1642 +#: ../../library/ssl.rst:1648 msgid "" "Set the available ciphers for sockets created with this context. It should " "be a string in the `OpenSSL cipher list format `_. After a successful handshake, the :meth:" -"`SSLSocket.selected_npn_protocol` method will return the agreed-upon " -"protocol." +"Layer_Protocol_Negotiation>`_. After a successful handshake, " +"the :meth:`SSLSocket.selected_npn_protocol` method will return the agreed-" +"upon protocol." msgstr "" -#: ../../library/ssl.rst:1680 +#: ../../library/ssl.rst:1686 msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_NPN` is " "``False``." msgstr "" -#: ../../library/ssl.rst:1691 +#: ../../library/ssl.rst:1697 msgid "" "Register a callback function that will be called after the TLS Client Hello " "handshake message has been received by the SSL/TLS server when the TLS " @@ -2395,14 +2415,14 @@ msgid "" "mechanism is specified in :rfc:`6066` section 3 - Server Name Indication." msgstr "" -#: ../../library/ssl.rst:1696 +#: ../../library/ssl.rst:1702 msgid "" "Only one callback can be set per ``SSLContext``. If *sni_callback* is set " "to ``None`` then the callback is disabled. Calling this function a " "subsequent time will disable the previously registered callback." msgstr "" -#: ../../library/ssl.rst:1700 +#: ../../library/ssl.rst:1706 msgid "" "The callback function will be called with three arguments; the first being " "the :class:`ssl.SSLSocket`, the second is a string that represents the " @@ -2413,48 +2433,48 @@ msgid "" "pythn-mua.org\"``)." msgstr "" -#: ../../library/ssl.rst:1708 +#: ../../library/ssl.rst:1714 msgid "" -"A typical use of this callback is to change the :class:`ssl.SSLSocket`'s :" -"attr:`SSLSocket.context` attribute to a new object of type :class:" -"`SSLContext` representing a certificate chain that matches the server name." +"A typical use of this callback is to change " +"the :class:`ssl.SSLSocket`'s :attr:`SSLSocket.context` attribute to a new " +"object of type :class:`SSLContext` representing a certificate chain that " +"matches the server name." msgstr "" -#: ../../library/ssl.rst:1713 +#: ../../library/ssl.rst:1719 msgid "" "Due to the early negotiation phase of the TLS connection, only limited " -"methods and attributes are usable like :meth:`SSLSocket." -"selected_alpn_protocol` and :attr:`SSLSocket.context`. The :meth:`SSLSocket." -"getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket." -"get_unverified_chain` :meth:`SSLSocket.cipher` and :meth:`SSLSocket." -"compression` methods require that the TLS connection has progressed beyond " -"the TLS Client Hello and therefore will not return meaningful values nor can " -"they be called safely." +"methods and attributes are usable " +"like :meth:`SSLSocket.selected_alpn_protocol` and :attr:`SSLSocket.context`. " +"The :meth:`SSLSocket.getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket.get_unverified_chain` :meth:`SSLSocket.cipher` " +"and :meth:`SSLSocket.compression` methods require that the TLS connection " +"has progressed beyond the TLS Client Hello and therefore will not return " +"meaningful values nor can they be called safely." msgstr "" -#: ../../library/ssl.rst:1722 +#: ../../library/ssl.rst:1728 msgid "" "The *sni_callback* function must return ``None`` to allow the TLS " -"negotiation to continue. If a TLS failure is required, a constant :const:" -"`ALERT_DESCRIPTION_* ` can be returned. " -"Other return values will result in a TLS fatal error with :const:" -"`ALERT_DESCRIPTION_INTERNAL_ERROR`." +"negotiation to continue. If a TLS failure is required, a " +"constant :const:`ALERT_DESCRIPTION_* ` can " +"be returned. Other return values will result in a TLS fatal error " +"with :const:`ALERT_DESCRIPTION_INTERNAL_ERROR`." msgstr "" -#: ../../library/ssl.rst:1728 +#: ../../library/ssl.rst:1734 msgid "" "If an exception is raised from the *sni_callback* function the TLS " -"connection will terminate with a fatal TLS alert message :const:" -"`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." +"connection will terminate with a fatal TLS alert " +"message :const:`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." msgstr "" -#: ../../library/ssl.rst:1732 +#: ../../library/ssl.rst:1738 msgid "" "This method will raise :exc:`NotImplementedError` if the OpenSSL library had " "OPENSSL_NO_TLSEXT defined when it was built." msgstr "" -#: ../../library/ssl.rst:1739 +#: ../../library/ssl.rst:1745 msgid "" "This is a legacy API retained for backwards compatibility. When possible, " "you should use :attr:`sni_callback` instead. The given " @@ -2463,14 +2483,14 @@ msgid "" "*server_name_callback* receives a decoded U-label (``\"pythön.org\"``)." msgstr "" -#: ../../library/ssl.rst:1745 +#: ../../library/ssl.rst:1751 msgid "" "If there is a decoding error on the server name, the TLS connection will " "terminate with an :const:`ALERT_DESCRIPTION_INTERNAL_ERROR` fatal TLS alert " "message to the client." msgstr "" -#: ../../library/ssl.rst:1753 +#: ../../library/ssl.rst:1759 msgid "" "Load the key generation parameters for Diffie-Hellman (DH) key exchange. " "Using DH key exchange improves forward secrecy at the expense of " @@ -2479,13 +2499,13 @@ msgid "" "format." msgstr "" -#: ../../library/ssl.rst:1759 +#: ../../library/ssl.rst:1765 msgid "" -"This setting doesn't apply to client sockets. You can also use the :data:" -"`OP_SINGLE_DH_USE` option to further improve security." +"This setting doesn't apply to client sockets. You can also use " +"the :data:`OP_SINGLE_DH_USE` option to further improve security." msgstr "" -#: ../../library/ssl.rst:1766 +#: ../../library/ssl.rst:1772 msgid "" "Set the curve name for Elliptic Curve-based Diffie-Hellman (ECDH) key " "exchange. ECDH is significantly faster than regular DH while arguably as " @@ -2494,52 +2514,53 @@ msgid "" "curve." msgstr "" -#: ../../library/ssl.rst:1772 +#: ../../library/ssl.rst:1778 msgid "" -"This setting doesn't apply to client sockets. You can also use the :data:" -"`OP_SINGLE_ECDH_USE` option to further improve security." +"This setting doesn't apply to client sockets. You can also use " +"the :data:`OP_SINGLE_ECDH_USE` option to further improve security." msgstr "" -#: ../../library/ssl.rst:1775 +#: ../../library/ssl.rst:1781 msgid "This method is not available if :data:`HAS_ECDH` is ``False``." msgstr "" -#: ../../library/ssl.rst:1780 +#: ../../library/ssl.rst:1786 msgid "" "`SSL/TLS & Perfect Forward Secrecy `_" msgstr "" -#: ../../library/ssl.rst:1781 +#: ../../library/ssl.rst:1787 msgid "Vincent Bernat." msgstr "" -#: ../../library/ssl.rst:1787 +#: ../../library/ssl.rst:1793 msgid "" -"Wrap an existing Python socket *sock* and return an instance of :attr:" -"`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The returned SSL " -"socket is tied to the context, its settings and certificates. *sock* must be " -"a :const:`~socket.SOCK_STREAM` socket; other socket types are unsupported." +"Wrap an existing Python socket *sock* and return an instance " +"of :attr:`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The " +"returned SSL socket is tied to the context, its settings and certificates. " +"*sock* must be a :const:`~socket.SOCK_STREAM` socket; other socket types are " +"unsupported." msgstr "" -#: ../../library/ssl.rst:1793 +#: ../../library/ssl.rst:1799 msgid "" "The parameter ``server_side`` is a boolean which identifies whether server-" "side or client-side behavior is desired from this socket." msgstr "" -#: ../../library/ssl.rst:1796 +#: ../../library/ssl.rst:1802 msgid "" "For client-side sockets, the context construction is lazy; if the underlying " "socket isn't connected yet, the context construction will be performed " "after :meth:`connect` is called on the socket. For server-side sockets, if " "the socket has no remote peer, it is assumed to be a listening socket, and " "the server-side SSL wrapping is automatically performed on client " -"connections accepted via the :meth:`accept` method. The method may raise :" -"exc:`SSLError`." +"connections accepted via the :meth:`accept` method. The method may " +"raise :exc:`SSLError`." msgstr "" -#: ../../library/ssl.rst:1804 +#: ../../library/ssl.rst:1810 msgid "" "On client connections, the optional parameter *server_hostname* specifies " "the hostname of the service which we are connecting to. This allows a " @@ -2548,87 +2569,87 @@ msgid "" "*server_hostname* will raise a :exc:`ValueError` if *server_side* is true." msgstr "" -#: ../../library/ssl.rst:1810 +#: ../../library/ssl.rst:1816 msgid "" "The parameter ``do_handshake_on_connect`` specifies whether to do the SSL " "handshake automatically after doing a :meth:`socket.connect`, or whether the " -"application program will call it explicitly, by invoking the :meth:" -"`SSLSocket.do_handshake` method. Calling :meth:`SSLSocket.do_handshake` " -"explicitly gives the program control over the blocking behavior of the " -"socket I/O involved in the handshake." +"application program will call it explicitly, by invoking " +"the :meth:`SSLSocket.do_handshake` method. " +"Calling :meth:`SSLSocket.do_handshake` explicitly gives the program control " +"over the blocking behavior of the socket I/O involved in the handshake." msgstr "" -#: ../../library/ssl.rst:1817 +#: ../../library/ssl.rst:1823 msgid "" -"The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket." -"recv` method should signal unexpected EOF from the other end of the " -"connection. If specified as :const:`True` (the default), it returns a " -"normal EOF (an empty bytes object) in response to unexpected EOF errors " -"raised from the underlying socket; if :const:`False`, it will raise the " -"exceptions back to the caller." +"The parameter ``suppress_ragged_eofs`` specifies how " +"the :meth:`SSLSocket.recv` method should signal unexpected EOF from the " +"other end of the connection. If specified as :const:`True` (the default), " +"it returns a normal EOF (an empty bytes object) in response to unexpected " +"EOF errors raised from the underlying socket; if :const:`False`, it will " +"raise the exceptions back to the caller." msgstr "" -#: ../../library/ssl.rst:1824 +#: ../../library/ssl.rst:1830 msgid "*session*, see :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:1826 +#: ../../library/ssl.rst:1832 msgid "" -"To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, use :meth:" -"`SSLContext.wrap_bio`." +"To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, " +"use :meth:`SSLContext.wrap_bio`." msgstr "" -#: ../../library/ssl.rst:1829 +#: ../../library/ssl.rst:1835 msgid "" "Always allow a server_hostname to be passed, even if OpenSSL does not have " "SNI." msgstr "" -#: ../../library/ssl.rst:1833 ../../library/ssl.rst:1860 +#: ../../library/ssl.rst:1839 ../../library/ssl.rst:1865 msgid "*session* argument was added." msgstr "新增 *session* 引數。" -#: ../../library/ssl.rst:1836 +#: ../../library/ssl.rst:1842 msgid "" "The method returns an instance of :attr:`SSLContext.sslsocket_class` instead " "of hard-coded :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1842 +#: ../../library/ssl.rst:1848 msgid "" -"The return type of :meth:`SSLContext.wrap_socket`, defaults to :class:" -"`SSLSocket`. The attribute can be assigned to on instances of :class:" -"`SSLContext` in order to return a custom subclass of :class:`SSLSocket`." +"The return type of :meth:`SSLContext.wrap_socket`, defaults " +"to :class:`SSLSocket`. The attribute can be overridden on instance of class " +"in order to return a custom subclass of :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1852 +#: ../../library/ssl.rst:1857 msgid "" -"Wrap the BIO objects *incoming* and *outgoing* and return an instance of :" -"attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " +"Wrap the BIO objects *incoming* and *outgoing* and return an instance " +"of :attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " "routines will read input data from the incoming BIO and write data to the " "outgoing BIO." msgstr "" -#: ../../library/ssl.rst:1857 +#: ../../library/ssl.rst:1862 msgid "" "The *server_side*, *server_hostname* and *session* parameters have the same " "meaning as in :meth:`SSLContext.wrap_socket`." msgstr "" -#: ../../library/ssl.rst:1863 +#: ../../library/ssl.rst:1868 msgid "" "The method returns an instance of :attr:`SSLContext.sslobject_class` instead " "of hard-coded :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1869 +#: ../../library/ssl.rst:1874 msgid "" -"The return type of :meth:`SSLContext.wrap_bio`, defaults to :class:" -"`SSLObject`. The attribute can be overridden on instance of class in order " -"to return a custom subclass of :class:`SSLObject`." +"The return type of :meth:`SSLContext.wrap_bio`, defaults " +"to :class:`SSLObject`. The attribute can be overridden on instance of class " +"in order to return a custom subclass of :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1877 +#: ../../library/ssl.rst:1882 msgid "" "Get statistics about the SSL sessions created or managed by this context. A " "dictionary is returned which maps the names of each `piece of information " @@ -2637,7 +2658,7 @@ msgid "" "the session cache since the context was created::" msgstr "" -#: ../../library/ssl.rst:1882 +#: ../../library/ssl.rst:1887 msgid "" ">>> stats = context.session_stats()\n" ">>> stats['hits'], stats['misses']\n" @@ -2647,20 +2668,21 @@ msgstr "" ">>> stats['hits'], stats['misses']\n" "(0, 0)" -#: ../../library/ssl.rst:1888 +#: ../../library/ssl.rst:1893 msgid "" "Whether to match the peer cert's hostname in :meth:`SSLSocket.do_handshake`. " -"The context's :attr:`~SSLContext.verify_mode` must be set to :data:" -"`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, and you must pass " +"The context's :attr:`~SSLContext.verify_mode` must be set " +"to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, and you must pass " "*server_hostname* to :meth:`~SSLContext.wrap_socket` in order to match the " -"hostname. Enabling hostname checking automatically sets :attr:`~SSLContext." -"verify_mode` from :data:`CERT_NONE` to :data:`CERT_REQUIRED`. It cannot be " -"set back to :data:`CERT_NONE` as long as hostname checking is enabled. The :" -"data:`PROTOCOL_TLS_CLIENT` protocol enables hostname checking by default. " -"With other protocols, hostname checking must be enabled explicitly." +"hostname. Enabling hostname checking automatically " +"sets :attr:`~SSLContext.verify_mode` from :data:`CERT_NONE` " +"to :data:`CERT_REQUIRED`. It cannot be set back to :data:`CERT_NONE` as " +"long as hostname checking is enabled. The :data:`PROTOCOL_TLS_CLIENT` " +"protocol enables hostname checking by default. With other protocols, " +"hostname checking must be enabled explicitly." msgstr "" -#: ../../library/ssl.rst:1901 +#: ../../library/ssl.rst:1906 msgid "" "import socket, ssl\n" "\n" @@ -2684,15 +2706,15 @@ msgstr "" "ssl_sock = context.wrap_socket(s, server_hostname='www.verisign.com')\n" "ssl_sock.connect(('www.verisign.com', 443))" -#: ../../library/ssl.rst:1916 +#: ../../library/ssl.rst:1921 msgid "" -":attr:`~SSLContext.verify_mode` is now automatically changed to :data:" -"`CERT_REQUIRED` when hostname checking is enabled and :attr:`~SSLContext." -"verify_mode` is :data:`CERT_NONE`. Previously the same operation would have " -"failed with a :exc:`ValueError`." +":attr:`~SSLContext.verify_mode` is now automatically changed " +"to :data:`CERT_REQUIRED` when hostname checking is enabled " +"and :attr:`~SSLContext.verify_mode` is :data:`CERT_NONE`. Previously the " +"same operation would have failed with a :exc:`ValueError`." msgstr "" -#: ../../library/ssl.rst:1923 +#: ../../library/ssl.rst:1928 msgid "" "Write TLS keys to a keylog file, whenever key material is generated or " "received. The keylog file is designed for debugging purposes only. The file " @@ -2701,56 +2723,58 @@ msgid "" "synchronized between threads, but not between processes." msgstr "" -#: ../../library/ssl.rst:1933 +#: ../../library/ssl.rst:1938 msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " -"attribute is read-only for protocols other than :const:`PROTOCOL_TLS`, :" -"const:`PROTOCOL_TLS_CLIENT`, and :const:`PROTOCOL_TLS_SERVER`." +"attribute is read-only for protocols other " +"than :const:`PROTOCOL_TLS`, :const:`PROTOCOL_TLS_CLIENT`, " +"and :const:`PROTOCOL_TLS_SERVER`." msgstr "" -#: ../../library/ssl.rst:1938 +#: ../../library/ssl.rst:1943 msgid "" -"The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext." -"minimum_version` and :attr:`SSLContext.options` all affect the supported SSL " -"and TLS versions of the context. The implementation does not prevent invalid " -"combination. For example a context with :attr:`OP_NO_TLSv1_2` in :attr:" -"`~SSLContext.options` and :attr:`~SSLContext.maximum_version` set to :attr:" -"`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." +"The " +"attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext.minimum_version` " +"and :attr:`SSLContext.options` all affect the supported SSL and TLS versions " +"of the context. The implementation does not prevent invalid combination. For " +"example a context with :attr:`OP_NO_TLSv1_2` in :attr:`~SSLContext.options` " +"and :attr:`~SSLContext.maximum_version` set to :attr:`TLSVersion.TLSv1_2` " +"will not be able to establish a TLS 1.2 connection." msgstr "" -#: ../../library/ssl.rst:1951 +#: ../../library/ssl.rst:1956 msgid "" "Like :attr:`SSLContext.maximum_version` except it is the lowest supported " "version or :attr:`TLSVersion.MINIMUM_SUPPORTED`." msgstr "" -#: ../../library/ssl.rst:1958 +#: ../../library/ssl.rst:1963 msgid "" -"Control the number of TLS 1.3 session tickets of a :const:" -"`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 " -"connections." +"Control the number of TLS 1.3 session tickets of " +"a :const:`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 " +"to 1.2 connections." msgstr "" -#: ../../library/ssl.rst:1966 +#: ../../library/ssl.rst:1971 msgid "" "An integer representing the set of SSL options enabled on this context. The " -"default value is :data:`OP_ALL`, but you can specify other options such as :" -"data:`OP_NO_SSLv2` by ORing them together." +"default value is :data:`OP_ALL`, but you can specify other options such " +"as :data:`OP_NO_SSLv2` by ORing them together." msgstr "" -#: ../../library/ssl.rst:1970 +#: ../../library/ssl.rst:1975 msgid ":attr:`SSLContext.options` returns :class:`Options` flags:" msgstr "" -#: ../../library/ssl.rst:1978 +#: ../../library/ssl.rst:1983 msgid "" "All ``OP_NO_SSL*`` and ``OP_NO_TLS*`` options have been deprecated since " -"Python 3.7. Use :attr:`SSLContext.minimum_version` and :attr:`SSLContext." -"maximum_version` instead." +"Python 3.7. Use :attr:`SSLContext.minimum_version` " +"and :attr:`SSLContext.maximum_version` instead." msgstr "" -#: ../../library/ssl.rst:1984 +#: ../../library/ssl.rst:1989 msgid "" "Enable TLS 1.3 post-handshake client authentication. Post-handshake auth is " "disabled by default and a server can only request a TLS client certificate " @@ -2758,80 +2782,81 @@ msgid "" "client certificate at any time after the handshake." msgstr "" -#: ../../library/ssl.rst:1989 +#: ../../library/ssl.rst:1994 msgid "" "When enabled on client-side sockets, the client signals the server that it " "supports post-handshake authentication." msgstr "" -#: ../../library/ssl.rst:1992 +#: ../../library/ssl.rst:1997 msgid "" "When enabled on server-side sockets, :attr:`SSLContext.verify_mode` must be " "set to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, too. The actual " -"client cert exchange is delayed until :meth:`SSLSocket." -"verify_client_post_handshake` is called and some I/O is performed." +"client cert exchange is delayed " +"until :meth:`SSLSocket.verify_client_post_handshake` is called and some I/O " +"is performed." msgstr "" -#: ../../library/ssl.rst:2002 +#: ../../library/ssl.rst:2007 msgid "" "The protocol version chosen when constructing the context. This attribute " "is read-only." msgstr "" -#: ../../library/ssl.rst:2007 +#: ../../library/ssl.rst:2012 msgid "" "Whether :attr:`~SSLContext.check_hostname` falls back to verify the cert's " "subject common name in the absence of a subject alternative name extension " "(default: true)." msgstr "" -#: ../../library/ssl.rst:2015 +#: ../../library/ssl.rst:2020 msgid "" "The flag had no effect with OpenSSL before version 1.1.1l. Python 3.8.9, " "3.9.3, and 3.10 include workarounds for previous versions." msgstr "" -#: ../../library/ssl.rst:2020 +#: ../../library/ssl.rst:2025 msgid "" "An integer representing the `security level `_ for the context. This attribute is read-" "only." msgstr "" -#: ../../library/ssl.rst:2028 +#: ../../library/ssl.rst:2033 msgid "" -"The flags for certificate verification operations. You can set flags like :" -"data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default OpenSSL does " -"neither require nor verify certificate revocation lists (CRLs)." +"The flags for certificate verification operations. You can set flags " +"like :data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default " +"OpenSSL does neither require nor verify certificate revocation lists (CRLs)." msgstr "" -#: ../../library/ssl.rst:2034 +#: ../../library/ssl.rst:2039 msgid ":attr:`SSLContext.verify_flags` returns :class:`VerifyFlags` flags:" msgstr "" -#: ../../library/ssl.rst:2042 +#: ../../library/ssl.rst:2047 msgid "" "Whether to try to verify other peers' certificates and how to behave if " -"verification fails. This attribute must be one of :data:`CERT_NONE`, :data:" -"`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." +"verification fails. This attribute must be one " +"of :data:`CERT_NONE`, :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." msgstr "" -#: ../../library/ssl.rst:2046 +#: ../../library/ssl.rst:2051 msgid ":attr:`SSLContext.verify_mode` returns :class:`VerifyMode` enum:" msgstr "" -#: ../../library/ssl.rst:2054 +#: ../../library/ssl.rst:2059 msgid "" "Enables TLS-PSK (pre-shared key) authentication on a client-side connection." msgstr "" -#: ../../library/ssl.rst:2056 ../../library/ssl.rst:2105 +#: ../../library/ssl.rst:2061 ../../library/ssl.rst:2110 msgid "" "In general, certificate based authentication should be preferred over this " "method." msgstr "" -#: ../../library/ssl.rst:2058 +#: ../../library/ssl.rst:2063 msgid "" "The parameter ``callback`` is a callable object with the signature: ``def " "callback(hint: str | None) -> tuple[str | None, bytes]``. The ``hint`` " @@ -2843,27 +2868,27 @@ msgid "" "shared key. Return a zero length PSK to reject the connection." msgstr "" -#: ../../library/ssl.rst:2068 ../../library/ssl.rst:2114 +#: ../../library/ssl.rst:2073 ../../library/ssl.rst:2119 msgid "Setting ``callback`` to :const:`None` removes any existing callback." msgstr "" -#: ../../library/ssl.rst:2071 +#: ../../library/ssl.rst:2076 msgid "When using TLS 1.3:" msgstr "" -#: ../../library/ssl.rst:2073 +#: ../../library/ssl.rst:2078 msgid "the ``hint`` parameter is always :const:`None`." msgstr "" -#: ../../library/ssl.rst:2074 +#: ../../library/ssl.rst:2079 msgid "client-identity must be a non-empty string." msgstr "" -#: ../../library/ssl.rst:2076 ../../library/ssl.rst:2123 +#: ../../library/ssl.rst:2081 ../../library/ssl.rst:2128 msgid "Example usage::" msgstr "範例用法: ::" -#: ../../library/ssl.rst:2078 +#: ../../library/ssl.rst:2083 msgid "" "context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" "context.check_hostname = False\n" @@ -2884,18 +2909,18 @@ msgid "" "context.set_psk_client_callback(callback)" msgstr "" -#: ../../library/ssl.rst:2096 ../../library/ssl.rst:2141 +#: ../../library/ssl.rst:2101 ../../library/ssl.rst:2146 msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_PSK` is " "``False``." msgstr "" -#: ../../library/ssl.rst:2103 +#: ../../library/ssl.rst:2108 msgid "" "Enables TLS-PSK (pre-shared key) authentication on a server-side connection." msgstr "" -#: ../../library/ssl.rst:2107 +#: ../../library/ssl.rst:2112 msgid "" "The parameter ``callback`` is a callable object with the signature: ``def " "callback(identity: str | None) -> bytes``. The ``identity`` parameter is an " @@ -2905,19 +2930,19 @@ msgid "" "connection." msgstr "" -#: ../../library/ssl.rst:2116 +#: ../../library/ssl.rst:2121 msgid "" "The parameter ``identity_hint`` is an optional identity hint string sent to " "the client. The string must be less than or equal to ``256`` octets when " "UTF-8 encoded." msgstr "" -#: ../../library/ssl.rst:2121 +#: ../../library/ssl.rst:2126 msgid "" "When using TLS 1.3 the ``identity_hint`` parameter is not sent to the client." msgstr "" -#: ../../library/ssl.rst:2125 +#: ../../library/ssl.rst:2130 msgid "" "context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" "context.maximum_version = ssl.TLSVersion.TLSv1_2\n" @@ -2936,11 +2961,11 @@ msgid "" "context.set_psk_server_callback(callback, 'ServerId_1')" msgstr "" -#: ../../library/ssl.rst:2153 +#: ../../library/ssl.rst:2158 msgid "Certificates" msgstr "" -#: ../../library/ssl.rst:2155 +#: ../../library/ssl.rst:2160 msgid "" "Certificates in general are part of a public-key / private-key system. In " "this system, each *principal*, (which may be a machine, or a person, or an " @@ -2951,7 +2976,7 @@ msgid "" "other part, and **only** with the other part." msgstr "" -#: ../../library/ssl.rst:2163 +#: ../../library/ssl.rst:2168 msgid "" "A certificate contains information about two principals. It contains the " "name of a *subject*, and the subject's public key. It also contains a " @@ -2965,7 +2990,7 @@ msgid "" "as two fields, called \"notBefore\" and \"notAfter\"." msgstr "" -#: ../../library/ssl.rst:2173 +#: ../../library/ssl.rst:2178 msgid "" "In the Python use of certificates, a client or server can use a certificate " "to prove who they are. The other side of a network connection can also be " @@ -2978,14 +3003,14 @@ msgid "" "take place." msgstr "" -#: ../../library/ssl.rst:2183 +#: ../../library/ssl.rst:2188 msgid "" "Python uses files to contain certificates. They should be formatted as " "\"PEM\" (see :rfc:`1422`), which is a base-64 encoded form wrapped with a " "header line and a footer line::" msgstr "" -#: ../../library/ssl.rst:2187 +#: ../../library/ssl.rst:2192 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate in base64 PEM encoding) ...\n" @@ -2995,11 +3020,11 @@ msgstr "" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2192 +#: ../../library/ssl.rst:2197 msgid "Certificate chains" msgstr "" -#: ../../library/ssl.rst:2194 +#: ../../library/ssl.rst:2199 msgid "" "The Python files which contain certificates can contain a sequence of " "certificates, sometimes called a *certificate chain*. This chain should " @@ -3015,7 +3040,7 @@ msgid "" "agency which issued the certification authority's certificate::" msgstr "" -#: ../../library/ssl.rst:2207 +#: ../../library/ssl.rst:2212 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate for your server)...\n" @@ -3037,27 +3062,27 @@ msgstr "" "... (the root certificate for the CA's issuer)...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2218 +#: ../../library/ssl.rst:2223 msgid "CA certificates" msgstr "" -#: ../../library/ssl.rst:2220 +#: ../../library/ssl.rst:2225 msgid "" "If you are going to require validation of the other side of the connection's " "certificate, you need to provide a \"CA certs\" file, filled with the " "certificate chains for each issuer you are willing to trust. Again, this " "file just contains these chains concatenated together. For validation, " "Python will use the first chain it finds in the file which matches. The " -"platform's certificates file can be used by calling :meth:`SSLContext." -"load_default_certs`, this is done automatically with :func:`." -"create_default_context`." +"platform's certificates file can be used by " +"calling :meth:`SSLContext.load_default_certs`, this is done automatically " +"with :func:`.create_default_context`." msgstr "" -#: ../../library/ssl.rst:2229 +#: ../../library/ssl.rst:2234 msgid "Combined key and certificate" msgstr "" -#: ../../library/ssl.rst:2231 +#: ../../library/ssl.rst:2236 msgid "" "Often the private key is stored in the same file as the certificate; in this " "case, only the ``certfile`` parameter to :meth:`SSLContext.load_cert_chain` " @@ -3065,7 +3090,7 @@ msgid "" "should come before the first certificate in the certificate chain::" msgstr "" -#: ../../library/ssl.rst:2237 +#: ../../library/ssl.rst:2242 msgid "" "-----BEGIN RSA PRIVATE KEY-----\n" "... (private key in base64 encoding) ...\n" @@ -3081,11 +3106,11 @@ msgstr "" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2245 +#: ../../library/ssl.rst:2250 msgid "Self-signed certificates" msgstr "" -#: ../../library/ssl.rst:2247 +#: ../../library/ssl.rst:2252 msgid "" "If you are going to create a server that provides SSL-encrypted connection " "services, you will need to acquire a certificate for that service. There " @@ -3095,7 +3120,7 @@ msgid "" "package, using something like the following::" msgstr "" -#: ../../library/ssl.rst:2254 +#: ../../library/ssl.rst:2259 msgid "" "% openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem\n" "Generating a 1024 bit RSA private key\n" @@ -3121,28 +3146,28 @@ msgid "" "%" msgstr "" -#: ../../library/ssl.rst:2276 +#: ../../library/ssl.rst:2281 msgid "" "The disadvantage of a self-signed certificate is that it is its own root " "certificate, and no one else will have it in their cache of known (and " "trusted) root certificates." msgstr "" -#: ../../library/ssl.rst:2282 +#: ../../library/ssl.rst:2287 msgid "Examples" msgstr "範例" -#: ../../library/ssl.rst:2285 +#: ../../library/ssl.rst:2290 msgid "Testing for SSL support" msgstr "" -#: ../../library/ssl.rst:2287 +#: ../../library/ssl.rst:2292 msgid "" "To test for the presence of SSL support in a Python installation, user code " "should use the following idiom::" msgstr "" -#: ../../library/ssl.rst:2290 +#: ../../library/ssl.rst:2295 msgid "" "try:\n" " import ssl\n" @@ -3152,27 +3177,27 @@ msgid "" " ... # do something that requires SSL support" msgstr "" -#: ../../library/ssl.rst:2298 +#: ../../library/ssl.rst:2303 msgid "Client-side operation" msgstr "" -#: ../../library/ssl.rst:2300 +#: ../../library/ssl.rst:2305 msgid "" "This example creates a SSL context with the recommended security settings " "for client sockets, including automatic certificate verification::" msgstr "" -#: ../../library/ssl.rst:2303 +#: ../../library/ssl.rst:2308 msgid ">>> context = ssl.create_default_context()" msgstr ">>> context = ssl.create_default_context()" -#: ../../library/ssl.rst:2305 +#: ../../library/ssl.rst:2310 msgid "" "If you prefer to tune security settings yourself, you might create a context " "from scratch (but beware that you might not get the settings right)::" msgstr "" -#: ../../library/ssl.rst:2309 +#: ../../library/ssl.rst:2314 msgid "" ">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" @@ -3180,14 +3205,14 @@ msgstr "" ">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" -#: ../../library/ssl.rst:2312 +#: ../../library/ssl.rst:2317 msgid "" "(this snippet assumes your operating system places a bundle of all CA " "certificates in ``/etc/ssl/certs/ca-bundle.crt``; if not, you'll get an " "error and have to adjust the location)" msgstr "" -#: ../../library/ssl.rst:2316 +#: ../../library/ssl.rst:2321 msgid "" "The :data:`PROTOCOL_TLS_CLIENT` protocol configures the context for cert " "validation and hostname verification. :attr:`~SSLContext.verify_mode` is set " @@ -3195,16 +3220,16 @@ msgid "" "``True``. All other protocols create SSL contexts with insecure defaults." msgstr "" -#: ../../library/ssl.rst:2321 +#: ../../library/ssl.rst:2326 msgid "" -"When you use the context to connect to a server, :const:`CERT_REQUIRED` and :" -"attr:`~SSLContext.check_hostname` validate the server certificate: it " +"When you use the context to connect to a server, :const:`CERT_REQUIRED` " +"and :attr:`~SSLContext.check_hostname` validate the server certificate: it " "ensures that the server certificate was signed with one of the CA " "certificates, checks the signature for correctness, and verifies other " "properties like validity and identity of the hostname::" msgstr "" -#: ../../library/ssl.rst:2327 +#: ../../library/ssl.rst:2332 msgid "" ">>> conn = context.wrap_socket(socket.socket(socket.AF_INET),\n" "... server_hostname=\"www.python.org\")\n" @@ -3214,30 +3239,30 @@ msgstr "" "... server_hostname=\"www.python.org\")\n" ">>> conn.connect((\"www.python.org\", 443))" -#: ../../library/ssl.rst:2331 +#: ../../library/ssl.rst:2336 msgid "You may then fetch the certificate::" msgstr "" -#: ../../library/ssl.rst:2333 +#: ../../library/ssl.rst:2338 msgid ">>> cert = conn.getpeercert()" msgstr ">>> cert = conn.getpeercert()" -#: ../../library/ssl.rst:2335 +#: ../../library/ssl.rst:2340 msgid "" "Visual inspection shows that the certificate does identify the desired " "service (that is, the HTTPS host ``www.python.org``)::" msgstr "" -#: ../../library/ssl.rst:2338 +#: ../../library/ssl.rst:2343 msgid "" ">>> pprint.pprint(cert)\n" "{'OCSP': ('http://ocsp.digicert.com',),\n" " 'caIssuers': ('http://cacerts.digicert.com/" "DigiCertSHA2ExtendedValidationServerCA.crt',),\n" -" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1." -"crl',\n" -" 'http://crl4.digicert.com/sha2-ev-server-g1." -"crl'),\n" +" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-" +"g1.crl',\n" +" 'http://crl4.digicert.com/sha2-ev-server-" +"g1.crl'),\n" " 'issuer': ((('countryName', 'US'),),\n" " (('organizationName', 'DigiCert Inc'),),\n" " (('organizationalUnitName', 'www.digicert.com'),),\n" @@ -3278,10 +3303,10 @@ msgstr "" "{'OCSP': ('http://ocsp.digicert.com',),\n" " 'caIssuers': ('http://cacerts.digicert.com/" "DigiCertSHA2ExtendedValidationServerCA.crt',),\n" -" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1." -"crl',\n" -" 'http://crl4.digicert.com/sha2-ev-server-g1." -"crl'),\n" +" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-" +"g1.crl',\n" +" 'http://crl4.digicert.com/sha2-ev-server-" +"g1.crl'),\n" " 'issuer': ((('countryName', 'US'),),\n" " (('organizationName', 'DigiCert Inc'),),\n" " (('organizationalUnitName', 'www.digicert.com'),),\n" @@ -3318,13 +3343,13 @@ msgstr "" " ('DNS', 'id.python.org')),\n" " 'version': 3}" -#: ../../library/ssl.rst:2378 +#: ../../library/ssl.rst:2383 msgid "" "Now the SSL channel is established and the certificate verified, you can " "proceed to talk with the server::" msgstr "" -#: ../../library/ssl.rst:2381 +#: ../../library/ssl.rst:2386 msgid "" ">>> conn.sendall(b\"HEAD / HTTP/1.0\\r\\nHost: linuxfr.org\\r\\n\\r\\n\")\n" ">>> pprint.pprint(conn.recv(1024).split(b\"\\r\\n\"))\n" @@ -3366,11 +3391,11 @@ msgstr "" " b'',\n" " b'']" -#: ../../library/ssl.rst:2405 +#: ../../library/ssl.rst:2410 msgid "Server-side operation" msgstr "" -#: ../../library/ssl.rst:2407 +#: ../../library/ssl.rst:2412 msgid "" "For server operation, typically you'll need to have a server certificate, " "and private key, each in a file. You'll first create a context holding the " @@ -3379,7 +3404,7 @@ msgid "" "start waiting for clients to connect::" msgstr "" -#: ../../library/ssl.rst:2413 +#: ../../library/ssl.rst:2418 msgid "" "import socket, ssl\n" "\n" @@ -3399,14 +3424,15 @@ msgstr "" "bindsocket.bind(('myaddr.example.com', 10023))\n" "bindsocket.listen(5)" -#: ../../library/ssl.rst:2422 +#: ../../library/ssl.rst:2427 msgid "" "When a client connects, you'll call :meth:`accept` on the socket to get the " -"new socket from the other end, and use the context's :meth:`SSLContext." -"wrap_socket` method to create a server-side SSL socket for the connection::" +"new socket from the other end, and use the " +"context's :meth:`SSLContext.wrap_socket` method to create a server-side SSL " +"socket for the connection::" msgstr "" -#: ../../library/ssl.rst:2426 +#: ../../library/ssl.rst:2431 msgid "" "while True:\n" " newsocket, fromaddr = bindsocket.accept()\n" @@ -3426,13 +3452,13 @@ msgstr "" " connstream.shutdown(socket.SHUT_RDWR)\n" " connstream.close()" -#: ../../library/ssl.rst:2435 +#: ../../library/ssl.rst:2440 msgid "" "Then you'll read data from the ``connstream`` and do something with it till " "you are finished with the client (or the client is finished with you)::" msgstr "" -#: ../../library/ssl.rst:2438 +#: ../../library/ssl.rst:2443 msgid "" "def deal_with_client(connstream):\n" " data = connstream.recv(1024)\n" @@ -3446,7 +3472,7 @@ msgid "" " # finished with client" msgstr "" -#: ../../library/ssl.rst:2449 +#: ../../library/ssl.rst:2454 msgid "" "And go back to listening for new client connections (of course, a real " "server would probably handle each client connection in a separate thread, or " @@ -3454,46 +3480,46 @@ msgid "" "event loop)." msgstr "" -#: ../../library/ssl.rst:2457 +#: ../../library/ssl.rst:2462 msgid "Notes on non-blocking sockets" msgstr "" -#: ../../library/ssl.rst:2459 +#: ../../library/ssl.rst:2464 msgid "" "SSL sockets behave slightly different than regular sockets in non-blocking " "mode. When working with non-blocking sockets, there are thus several things " "you need to be aware of:" msgstr "" -#: ../../library/ssl.rst:2463 +#: ../../library/ssl.rst:2468 msgid "" "Most :class:`SSLSocket` methods will raise either :exc:`SSLWantWriteError` " "or :exc:`SSLWantReadError` instead of :exc:`BlockingIOError` if an I/O " "operation would block. :exc:`SSLWantReadError` will be raised if a read " -"operation on the underlying socket is necessary, and :exc:" -"`SSLWantWriteError` for a write operation on the underlying socket. Note " -"that attempts to *write* to an SSL socket may require *reading* from the " -"underlying socket first, and attempts to *read* from the SSL socket may " +"operation on the underlying socket is necessary, " +"and :exc:`SSLWantWriteError` for a write operation on the underlying socket. " +"Note that attempts to *write* to an SSL socket may require *reading* from " +"the underlying socket first, and attempts to *read* from the SSL socket may " "require a prior *write* to the underlying socket." msgstr "" -#: ../../library/ssl.rst:2475 +#: ../../library/ssl.rst:2480 msgid "" "In earlier Python versions, the :meth:`!SSLSocket.send` method returned zero " "instead of raising :exc:`SSLWantWriteError` or :exc:`SSLWantReadError`." msgstr "" -#: ../../library/ssl.rst:2479 +#: ../../library/ssl.rst:2484 msgid "" "Calling :func:`~select.select` tells you that the OS-level socket can be " "read from (or written to), but it does not imply that there is sufficient " "data at the upper SSL layer. For example, only part of an SSL frame might " "have arrived. Therefore, you must be ready to handle :meth:`SSLSocket.recv` " -"and :meth:`SSLSocket.send` failures, and retry after another call to :func:" -"`~select.select`." +"and :meth:`SSLSocket.send` failures, and retry after another call " +"to :func:`~select.select`." msgstr "" -#: ../../library/ssl.rst:2486 +#: ../../library/ssl.rst:2491 msgid "" "Conversely, since the SSL layer has its own framing, a SSL socket may still " "have data available for reading without :func:`~select.select` being aware " @@ -3502,21 +3528,21 @@ msgid "" "call if still necessary." msgstr "" -#: ../../library/ssl.rst:2492 +#: ../../library/ssl.rst:2497 msgid "" -"(of course, similar provisions apply when using other primitives such as :" -"func:`~select.poll`, or those in the :mod:`selectors` module)" +"(of course, similar provisions apply when using other primitives such " +"as :func:`~select.poll`, or those in the :mod:`selectors` module)" msgstr "" -#: ../../library/ssl.rst:2495 +#: ../../library/ssl.rst:2500 msgid "" -"The SSL handshake itself will be non-blocking: the :meth:`SSLSocket." -"do_handshake` method has to be retried until it returns successfully. Here " -"is a synopsis using :func:`~select.select` to wait for the socket's " -"readiness::" +"The SSL handshake itself will be non-blocking: " +"the :meth:`SSLSocket.do_handshake` method has to be retried until it returns " +"successfully. Here is a synopsis using :func:`~select.select` to wait for " +"the socket's readiness::" msgstr "" -#: ../../library/ssl.rst:2500 +#: ../../library/ssl.rst:2505 msgid "" "while True:\n" " try:\n" @@ -3536,36 +3562,36 @@ msgstr "" " except ssl.SSLWantWriteError:\n" " select.select([], [sock], [])" -#: ../../library/ssl.rst:2511 +#: ../../library/ssl.rst:2516 msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets ` and provides a higher level :ref:`Streams API `. It polls for events using the :mod:`selectors` module and " -"handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` and :exc:" -"`BlockingIOError` exceptions. It runs the SSL handshake asynchronously as " -"well." +"handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` " +"and :exc:`BlockingIOError` exceptions. It runs the SSL handshake " +"asynchronously as well." msgstr "" -#: ../../library/ssl.rst:2520 +#: ../../library/ssl.rst:2525 msgid "Memory BIO Support" msgstr "記憶體 BIO 支援" -#: ../../library/ssl.rst:2524 +#: ../../library/ssl.rst:2529 msgid "" -"Ever since the SSL module was introduced in Python 2.6, the :class:" -"`SSLSocket` class has provided two related but distinct areas of " +"Ever since the SSL module was introduced in Python 2.6, " +"the :class:`SSLSocket` class has provided two related but distinct areas of " "functionality:" msgstr "" -#: ../../library/ssl.rst:2527 +#: ../../library/ssl.rst:2532 msgid "SSL protocol handling" msgstr "" -#: ../../library/ssl.rst:2528 +#: ../../library/ssl.rst:2533 msgid "Network IO" msgstr "" -#: ../../library/ssl.rst:2530 +#: ../../library/ssl.rst:2535 msgid "" "The network IO API is identical to that provided by :class:`socket.socket`, " "from which :class:`SSLSocket` also inherits. This allows an SSL socket to be " @@ -3573,19 +3599,19 @@ msgid "" "add SSL support to an existing application." msgstr "" -#: ../../library/ssl.rst:2535 +#: ../../library/ssl.rst:2540 msgid "" "Combining SSL protocol handling and network IO usually works well, but there " "are some cases where it doesn't. An example is async IO frameworks that want " "to use a different IO multiplexing model than the \"select/poll on a file " -"descriptor\" (readiness based) model that is assumed by :class:`socket." -"socket` and by the internal OpenSSL socket IO routines. This is mostly " -"relevant for platforms like Windows where this model is not efficient. For " -"this purpose, a reduced scope variant of :class:`SSLSocket` called :class:" -"`SSLObject` is provided." +"descriptor\" (readiness based) model that is assumed " +"by :class:`socket.socket` and by the internal OpenSSL socket IO routines. " +"This is mostly relevant for platforms like Windows where this model is not " +"efficient. For this purpose, a reduced scope variant of :class:`SSLSocket` " +"called :class:`SSLObject` is provided." msgstr "" -#: ../../library/ssl.rst:2546 +#: ../../library/ssl.rst:2551 msgid "" "A reduced-scope variant of :class:`SSLSocket` representing an SSL protocol " "instance that does not contain any network IO methods. This class is " @@ -3593,7 +3619,7 @@ msgid "" "for SSL through memory buffers." msgstr "" -#: ../../library/ssl.rst:2551 +#: ../../library/ssl.rst:2556 msgid "" "This class implements an interface on top of a low-level SSL object as " "implemented by OpenSSL. This object captures the state of an SSL connection " @@ -3601,7 +3627,7 @@ msgid "" "separate \"BIO\" objects which are OpenSSL's IO abstraction layer." msgstr "" -#: ../../library/ssl.rst:2556 +#: ../../library/ssl.rst:2561 msgid "" "This class has no public constructor. An :class:`SSLObject` instance must " "be created using the :meth:`~SSLContext.wrap_bio` method. This method will " @@ -3610,231 +3636,232 @@ msgid "" "instance, while the *outgoing* BIO is used to pass data the other way around." msgstr "" -#: ../../library/ssl.rst:2563 +#: ../../library/ssl.rst:2568 msgid "The following methods are available:" msgstr "" -#: ../../library/ssl.rst:2565 +#: ../../library/ssl.rst:2570 msgid ":attr:`~SSLSocket.context`" msgstr ":attr:`~SSLSocket.context`" -#: ../../library/ssl.rst:2566 +#: ../../library/ssl.rst:2571 msgid ":attr:`~SSLSocket.server_side`" msgstr ":attr:`~SSLSocket.server_side`" -#: ../../library/ssl.rst:2567 +#: ../../library/ssl.rst:2572 msgid ":attr:`~SSLSocket.server_hostname`" msgstr ":attr:`~SSLSocket.server_hostname`" -#: ../../library/ssl.rst:2568 +#: ../../library/ssl.rst:2573 msgid ":attr:`~SSLSocket.session`" msgstr ":attr:`~SSLSocket.session`" -#: ../../library/ssl.rst:2569 +#: ../../library/ssl.rst:2574 msgid ":attr:`~SSLSocket.session_reused`" msgstr ":attr:`~SSLSocket.session_reused`" -#: ../../library/ssl.rst:2570 +#: ../../library/ssl.rst:2575 msgid ":meth:`~SSLSocket.read`" msgstr ":meth:`~SSLSocket.read`" -#: ../../library/ssl.rst:2571 +#: ../../library/ssl.rst:2576 msgid ":meth:`~SSLSocket.write`" msgstr ":meth:`~SSLSocket.write`" -#: ../../library/ssl.rst:2572 +#: ../../library/ssl.rst:2577 msgid ":meth:`~SSLSocket.getpeercert`" msgstr ":meth:`~SSLSocket.getpeercert`" -#: ../../library/ssl.rst:2573 +#: ../../library/ssl.rst:2578 msgid ":meth:`~SSLSocket.get_verified_chain`" msgstr ":meth:`~SSLSocket.get_verified_chain`" -#: ../../library/ssl.rst:2574 +#: ../../library/ssl.rst:2579 msgid ":meth:`~SSLSocket.get_unverified_chain`" msgstr ":meth:`~SSLSocket.get_unverified_chain`" -#: ../../library/ssl.rst:2575 +#: ../../library/ssl.rst:2580 msgid ":meth:`~SSLSocket.selected_alpn_protocol`" msgstr ":meth:`~SSLSocket.selected_alpn_protocol`" -#: ../../library/ssl.rst:2576 +#: ../../library/ssl.rst:2581 msgid ":meth:`~SSLSocket.selected_npn_protocol`" msgstr ":meth:`~SSLSocket.selected_npn_protocol`" -#: ../../library/ssl.rst:2577 +#: ../../library/ssl.rst:2582 msgid ":meth:`~SSLSocket.cipher`" msgstr ":meth:`~SSLSocket.cipher`" -#: ../../library/ssl.rst:2578 +#: ../../library/ssl.rst:2583 msgid ":meth:`~SSLSocket.shared_ciphers`" msgstr ":meth:`~SSLSocket.shared_ciphers`" -#: ../../library/ssl.rst:2579 +#: ../../library/ssl.rst:2584 msgid ":meth:`~SSLSocket.compression`" msgstr ":meth:`~SSLSocket.compression`" -#: ../../library/ssl.rst:2580 +#: ../../library/ssl.rst:2585 msgid ":meth:`~SSLSocket.pending`" msgstr ":meth:`~SSLSocket.pending`" -#: ../../library/ssl.rst:2581 +#: ../../library/ssl.rst:2586 msgid ":meth:`~SSLSocket.do_handshake`" msgstr ":meth:`~SSLSocket.do_handshake`" -#: ../../library/ssl.rst:2582 +#: ../../library/ssl.rst:2587 msgid ":meth:`~SSLSocket.verify_client_post_handshake`" msgstr ":meth:`~SSLSocket.verify_client_post_handshake`" -#: ../../library/ssl.rst:2583 +#: ../../library/ssl.rst:2588 msgid ":meth:`~SSLSocket.unwrap`" msgstr ":meth:`~SSLSocket.unwrap`" -#: ../../library/ssl.rst:2584 +#: ../../library/ssl.rst:2589 msgid ":meth:`~SSLSocket.get_channel_binding`" msgstr ":meth:`~SSLSocket.get_channel_binding`" -#: ../../library/ssl.rst:2585 +#: ../../library/ssl.rst:2590 msgid ":meth:`~SSLSocket.version`" msgstr ":meth:`~SSLSocket.version`" -#: ../../library/ssl.rst:2587 +#: ../../library/ssl.rst:2592 msgid "" "When compared to :class:`SSLSocket`, this object lacks the following " "features:" msgstr "" -#: ../../library/ssl.rst:2590 +#: ../../library/ssl.rst:2595 msgid "" "Any form of network IO; ``recv()`` and ``send()`` read and write only to the " "underlying :class:`MemoryBIO` buffers." msgstr "" -#: ../../library/ssl.rst:2593 +#: ../../library/ssl.rst:2598 msgid "" "There is no *do_handshake_on_connect* machinery. You must always manually " "call :meth:`~SSLSocket.do_handshake` to start the handshake." msgstr "" -#: ../../library/ssl.rst:2596 +#: ../../library/ssl.rst:2601 msgid "" "There is no handling of *suppress_ragged_eofs*. All end-of-file conditions " -"that are in violation of the protocol are reported via the :exc:" -"`SSLEOFError` exception." +"that are in violation of the protocol are reported via " +"the :exc:`SSLEOFError` exception." msgstr "" -#: ../../library/ssl.rst:2600 +#: ../../library/ssl.rst:2605 msgid "" "The method :meth:`~SSLSocket.unwrap` call does not return anything, unlike " "for an SSL socket where it returns the underlying socket." msgstr "" -#: ../../library/ssl.rst:2603 +#: ../../library/ssl.rst:2608 msgid "" -"The *server_name_callback* callback passed to :meth:`SSLContext." -"set_servername_callback` will get an :class:`SSLObject` instance instead of " -"a :class:`SSLSocket` instance as its first parameter." +"The *server_name_callback* callback passed " +"to :meth:`SSLContext.set_servername_callback` will get an :class:`SSLObject` " +"instance instead of a :class:`SSLSocket` instance as its first parameter." msgstr "" -#: ../../library/ssl.rst:2607 +#: ../../library/ssl.rst:2612 msgid "Some notes related to the use of :class:`SSLObject`:" msgstr "" -#: ../../library/ssl.rst:2609 +#: ../../library/ssl.rst:2614 msgid "" "All IO on an :class:`SSLObject` is :ref:`non-blocking `. " -"This means that for example :meth:`~SSLSocket.read` will raise an :exc:" -"`SSLWantReadError` if it needs more data than the incoming BIO has available." +"This means that for example :meth:`~SSLSocket.read` will raise " +"an :exc:`SSLWantReadError` if it needs more data than the incoming BIO has " +"available." msgstr "" -#: ../../library/ssl.rst:2614 +#: ../../library/ssl.rst:2619 msgid "" -":class:`SSLObject` instances must be created with :meth:`~SSLContext." -"wrap_bio`. In earlier versions, it was possible to create instances " -"directly. This was never documented or officially supported." +":class:`SSLObject` instances must be created " +"with :meth:`~SSLContext.wrap_bio`. In earlier versions, it was possible to " +"create instances directly. This was never documented or officially supported." msgstr "" -#: ../../library/ssl.rst:2620 +#: ../../library/ssl.rst:2625 msgid "" "An SSLObject communicates with the outside world using memory buffers. The " "class :class:`MemoryBIO` provides a memory buffer that can be used for this " "purpose. It wraps an OpenSSL memory BIO (Basic IO) object:" msgstr "" -#: ../../library/ssl.rst:2626 +#: ../../library/ssl.rst:2631 msgid "" "A memory buffer that can be used to pass data between Python and an SSL " "protocol instance." msgstr "" -#: ../../library/ssl.rst:2631 +#: ../../library/ssl.rst:2636 msgid "Return the number of bytes currently in the memory buffer." msgstr "" -#: ../../library/ssl.rst:2635 +#: ../../library/ssl.rst:2640 msgid "" "A boolean indicating whether the memory BIO is current at the end-of-file " "position." msgstr "" -#: ../../library/ssl.rst:2640 +#: ../../library/ssl.rst:2645 msgid "" "Read up to *n* bytes from the memory buffer. If *n* is not specified or " "negative, all bytes are returned." msgstr "" -#: ../../library/ssl.rst:2645 +#: ../../library/ssl.rst:2650 msgid "" "Write the bytes from *buf* to the memory BIO. The *buf* argument must be an " "object supporting the buffer protocol." msgstr "" -#: ../../library/ssl.rst:2648 +#: ../../library/ssl.rst:2653 msgid "" "The return value is the number of bytes written, which is always equal to " "the length of *buf*." msgstr "" -#: ../../library/ssl.rst:2653 +#: ../../library/ssl.rst:2658 msgid "" "Write an EOF marker to the memory BIO. After this method has been called, it " "is illegal to call :meth:`~MemoryBIO.write`. The attribute :attr:`eof` will " "become true after all data currently in the buffer has been read." msgstr "" -#: ../../library/ssl.rst:2659 +#: ../../library/ssl.rst:2664 msgid "SSL session" msgstr "" -#: ../../library/ssl.rst:2665 +#: ../../library/ssl.rst:2670 msgid "Session object used by :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:2677 +#: ../../library/ssl.rst:2682 msgid "Security considerations" msgstr "" -#: ../../library/ssl.rst:2680 +#: ../../library/ssl.rst:2685 msgid "Best defaults" msgstr "" -#: ../../library/ssl.rst:2682 +#: ../../library/ssl.rst:2687 msgid "" "For **client use**, if you don't have any special requirements for your " -"security policy, it is highly recommended that you use the :func:" -"`create_default_context` function to create your SSL context. It will load " -"the system's trusted CA certificates, enable certificate validation and " -"hostname checking, and try to choose reasonably secure protocol and cipher " -"settings." +"security policy, it is highly recommended that you use " +"the :func:`create_default_context` function to create your SSL context. It " +"will load the system's trusted CA certificates, enable certificate " +"validation and hostname checking, and try to choose reasonably secure " +"protocol and cipher settings." msgstr "" -#: ../../library/ssl.rst:2689 +#: ../../library/ssl.rst:2694 msgid "" "For example, here is how you would use the :class:`smtplib.SMTP` class to " "create a trusted, secure connection to a SMTP server::" msgstr "" -#: ../../library/ssl.rst:2692 +#: ../../library/ssl.rst:2697 msgid "" ">>> import ssl, smtplib\n" ">>> smtp = smtplib.SMTP(\"mail.python.org\", port=587)\n" @@ -3848,50 +3875,50 @@ msgstr "" ">>> smtp.starttls(context=context)\n" "(220, b'2.0.0 Ready to start TLS')" -#: ../../library/ssl.rst:2698 +#: ../../library/ssl.rst:2703 msgid "" -"If a client certificate is needed for the connection, it can be added with :" -"meth:`SSLContext.load_cert_chain`." +"If a client certificate is needed for the connection, it can be added " +"with :meth:`SSLContext.load_cert_chain`." msgstr "" -#: ../../library/ssl.rst:2701 +#: ../../library/ssl.rst:2706 msgid "" -"By contrast, if you create the SSL context by calling the :class:" -"`SSLContext` constructor yourself, it will not have certificate validation " -"nor hostname checking enabled by default. If you do so, please read the " -"paragraphs below to achieve a good security level." +"By contrast, if you create the SSL context by calling " +"the :class:`SSLContext` constructor yourself, it will not have certificate " +"validation nor hostname checking enabled by default. If you do so, please " +"read the paragraphs below to achieve a good security level." msgstr "" -#: ../../library/ssl.rst:2707 +#: ../../library/ssl.rst:2712 msgid "Manual settings" msgstr "手動設定" -#: ../../library/ssl.rst:2710 +#: ../../library/ssl.rst:2715 msgid "Verifying certificates" msgstr "驗證憑證" -#: ../../library/ssl.rst:2712 +#: ../../library/ssl.rst:2717 msgid "" -"When calling the :class:`SSLContext` constructor directly, :const:" -"`CERT_NONE` is the default. Since it does not authenticate the other peer, " -"it can be insecure, especially in client mode where most of the time you " -"would like to ensure the authenticity of the server you're talking to. " -"Therefore, when in client mode, it is highly recommended to use :const:" -"`CERT_REQUIRED`. However, it is in itself not sufficient; you also have to " -"check that the server certificate, which can be obtained by calling :meth:" -"`SSLSocket.getpeercert`, matches the desired service. For many protocols " -"and applications, the service can be identified by the hostname. This common " -"check is automatically performed when :attr:`SSLContext.check_hostname` is " -"enabled." +"When calling the :class:`SSLContext` constructor " +"directly, :const:`CERT_NONE` is the default. Since it does not authenticate " +"the other peer, it can be insecure, especially in client mode where most of " +"the time you would like to ensure the authenticity of the server you're " +"talking to. Therefore, when in client mode, it is highly recommended to " +"use :const:`CERT_REQUIRED`. However, it is in itself not sufficient; you " +"also have to check that the server certificate, which can be obtained by " +"calling :meth:`SSLSocket.getpeercert`, matches the desired service. For " +"many protocols and applications, the service can be identified by the " +"hostname. This common check is automatically performed " +"when :attr:`SSLContext.check_hostname` is enabled." msgstr "" -#: ../../library/ssl.rst:2724 +#: ../../library/ssl.rst:2729 msgid "" -"Hostname matchings is now performed by OpenSSL. Python no longer uses :func:" -"`match_hostname`." +"Hostname matchings is now performed by OpenSSL. Python no longer " +"uses :func:`match_hostname`." msgstr "" -#: ../../library/ssl.rst:2728 +#: ../../library/ssl.rst:2733 msgid "" "In server mode, if you want to authenticate your clients using the SSL layer " "(rather than using a higher-level authentication mechanism), you'll also " @@ -3899,20 +3926,20 @@ msgid "" "certificate." msgstr "" -#: ../../library/ssl.rst:2734 +#: ../../library/ssl.rst:2739 msgid "Protocol versions" msgstr "協定版本" -#: ../../library/ssl.rst:2736 +#: ../../library/ssl.rst:2741 msgid "" "SSL versions 2 and 3 are considered insecure and are therefore dangerous to " "use. If you want maximum compatibility between clients and servers, it is " -"recommended to use :const:`PROTOCOL_TLS_CLIENT` or :const:" -"`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are disabled " -"by default." +"recommended to use :const:`PROTOCOL_TLS_CLIENT` " +"or :const:`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are " +"disabled by default." msgstr "" -#: ../../library/ssl.rst:2744 +#: ../../library/ssl.rst:2749 msgid "" ">>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3\n" @@ -3922,36 +3949,36 @@ msgstr "" ">>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3\n" ">>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3" -#: ../../library/ssl.rst:2749 +#: ../../library/ssl.rst:2754 msgid "" "The SSL context created above will only allow TLSv1.3 and later (if " -"supported by your system) connections to a server. :const:" -"`PROTOCOL_TLS_CLIENT` implies certificate validation and hostname checks by " -"default. You have to load certificates into the context." +"supported by your system) connections to a " +"server. :const:`PROTOCOL_TLS_CLIENT` implies certificate validation and " +"hostname checks by default. You have to load certificates into the context." msgstr "" -#: ../../library/ssl.rst:2756 +#: ../../library/ssl.rst:2761 msgid "Cipher selection" msgstr "" -#: ../../library/ssl.rst:2758 +#: ../../library/ssl.rst:2763 msgid "" "If you have advanced security requirements, fine-tuning of the ciphers " -"enabled when negotiating a SSL session is possible through the :meth:" -"`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the ssl module " -"disables certain weak ciphers by default, but you may want to further " -"restrict the cipher choice. Be sure to read OpenSSL's documentation about " -"the `cipher list format `_. If you want to check which ciphers are enabled by a given " -"cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl ciphers`` " -"command on your system." +"enabled when negotiating a SSL session is possible through " +"the :meth:`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the " +"ssl module disables certain weak ciphers by default, but you may want to " +"further restrict the cipher choice. Be sure to read OpenSSL's documentation " +"about the `cipher list format `_. If you want to check which ciphers are enabled by a " +"given cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl " +"ciphers`` command on your system." msgstr "" -#: ../../library/ssl.rst:2769 +#: ../../library/ssl.rst:2774 msgid "Multi-processing" msgstr "" -#: ../../library/ssl.rst:2771 +#: ../../library/ssl.rst:2776 msgid "" "If using this module as part of a multi-processed application (using, for " "example the :mod:`multiprocessing` or :mod:`concurrent.futures` modules), be " @@ -3962,32 +3989,32 @@ msgid "" "sufficient." msgstr "" -#: ../../library/ssl.rst:2783 +#: ../../library/ssl.rst:2788 msgid "TLS 1.3" msgstr "TLS 1.3" -#: ../../library/ssl.rst:2787 +#: ../../library/ssl.rst:2792 msgid "" "The TLS 1.3 protocol behaves slightly differently than previous version of " "TLS/SSL. Some new TLS 1.3 features are not yet available." msgstr "" -#: ../../library/ssl.rst:2790 +#: ../../library/ssl.rst:2795 msgid "" "TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20 " -"cipher suites are enabled by default. The method :meth:`SSLContext." -"set_ciphers` cannot enable or disable any TLS 1.3 ciphers yet, but :meth:" -"`SSLContext.get_ciphers` returns them." +"cipher suites are enabled by default. The " +"method :meth:`SSLContext.set_ciphers` cannot enable or disable any TLS 1.3 " +"ciphers yet, but :meth:`SSLContext.get_ciphers` returns them." msgstr "" -#: ../../library/ssl.rst:2794 +#: ../../library/ssl.rst:2799 msgid "" "Session tickets are no longer sent as part of the initial handshake and are " "handled differently. :attr:`SSLSocket.session` and :class:`SSLSession` are " "not compatible with TLS 1.3." msgstr "" -#: ../../library/ssl.rst:2797 +#: ../../library/ssl.rst:2802 msgid "" "Client-side certificates are also no longer verified during the initial " "handshake. A server can request a certificate at any time. Clients process " @@ -3995,21 +4022,21 @@ msgid "" "server." msgstr "" -#: ../../library/ssl.rst:2801 +#: ../../library/ssl.rst:2806 msgid "" "TLS 1.3 features like early data, deferred TLS client cert request, " "signature algorithm configuration, and rekeying are not supported yet." msgstr "" -#: ../../library/ssl.rst:2807 +#: ../../library/ssl.rst:2812 msgid "Class :class:`socket.socket`" msgstr ":class:`socket.socket` 類別" -#: ../../library/ssl.rst:2808 +#: ../../library/ssl.rst:2813 msgid "Documentation of underlying :mod:`socket` class" msgstr "底層 :mod:`socket` 類別的文件" -#: ../../library/ssl.rst:2810 +#: ../../library/ssl.rst:2815 msgid "" "`SSL/TLS Strong Encryption: An Introduction `_" @@ -4017,11 +4044,11 @@ msgstr "" "`SSL/TLS Strong Encryption: An Introduction `_" -#: ../../library/ssl.rst:2811 +#: ../../library/ssl.rst:2816 msgid "Intro from the Apache HTTP Server documentation" msgstr "Apache HTTP Server 文件的介紹" -#: ../../library/ssl.rst:2813 +#: ../../library/ssl.rst:2818 msgid "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" @@ -4029,19 +4056,19 @@ msgstr "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" -#: ../../library/ssl.rst:2814 +#: ../../library/ssl.rst:2819 msgid "Steve Kent" msgstr "Steve Kent" -#: ../../library/ssl.rst:2816 +#: ../../library/ssl.rst:2821 msgid ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" msgstr ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" -#: ../../library/ssl.rst:2817 +#: ../../library/ssl.rst:2822 msgid "Donald E., Jeffrey I. Schiller" msgstr "Donald E., Jeffrey I. Schiller" -#: ../../library/ssl.rst:2819 +#: ../../library/ssl.rst:2824 msgid "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" @@ -4049,11 +4076,11 @@ msgstr "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" -#: ../../library/ssl.rst:2820 +#: ../../library/ssl.rst:2825 msgid "D. Cooper" msgstr "D. Cooper" -#: ../../library/ssl.rst:2822 +#: ../../library/ssl.rst:2827 msgid "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" @@ -4061,19 +4088,19 @@ msgstr "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" -#: ../../library/ssl.rst:2823 +#: ../../library/ssl.rst:2828 msgid "T. Dierks et. al." msgstr "T. Dierks et. al." -#: ../../library/ssl.rst:2825 +#: ../../library/ssl.rst:2830 msgid ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" msgstr ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" -#: ../../library/ssl.rst:2826 +#: ../../library/ssl.rst:2831 msgid "D. Eastlake" msgstr "D. Eastlake" -#: ../../library/ssl.rst:2828 +#: ../../library/ssl.rst:2833 msgid "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" @@ -4081,11 +4108,11 @@ msgstr "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" -#: ../../library/ssl.rst:2829 +#: ../../library/ssl.rst:2834 msgid "IANA" msgstr "IANA" -#: ../../library/ssl.rst:2831 +#: ../../library/ssl.rst:2836 msgid "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" @@ -4093,11 +4120,11 @@ msgstr "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" -#: ../../library/ssl.rst:2832 +#: ../../library/ssl.rst:2837 msgid "IETF" msgstr "IETF" -#: ../../library/ssl.rst:2834 +#: ../../library/ssl.rst:2839 msgid "" "`Mozilla's Server Side TLS recommendations `_" @@ -4105,7 +4132,7 @@ msgstr "" "`Mozilla's Server Side TLS recommendations `_" -#: ../../library/ssl.rst:2835 +#: ../../library/ssl.rst:2840 msgid "Mozilla" msgstr "Mozilla" @@ -4133,10 +4160,10 @@ msgstr "Transport Layer Security(傳輸層安全)" msgid "Secure Sockets Layer" msgstr "Secure Sockets Layer(安全 socket 層)" -#: ../../library/ssl.rst:2146 +#: ../../library/ssl.rst:2151 msgid "certificates" msgstr "certificates(憑證)" -#: ../../library/ssl.rst:2148 +#: ../../library/ssl.rst:2153 msgid "X509 certificate" msgstr "X509 certificate(X509 憑證)" diff --git a/library/stdtypes.po b/library/stdtypes.po index 1900dfba584..6cca57a4839 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-28 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -65,22 +65,24 @@ msgstr "真值檢測" #: ../../library/stdtypes.rst:41 msgid "" -"Any object can be tested for truth value, for use in an :keyword:`if` or :" -"keyword:`while` condition or as operand of the Boolean operations below." +"Any object can be tested for truth value, for use in an :keyword:`if` " +"or :keyword:`while` condition or as operand of the Boolean operations below." msgstr "" -"任何物件都可以進行檢測以判斷是否為真值,以便在 :keyword:`if` 或 :keyword:" -"`while` 條件中使用,或是作為如下所述 boolean(布林)運算之運算元所用。" +"任何物件都可以進行檢測以判斷是否為真值,以便在 :keyword:`if` " +"或 :keyword:`while` 條件中使用,或是作為如下所述 boolean(布林)運算之運算元" +"所用。" #: ../../library/stdtypes.rst:46 msgid "" -"By default, an object is considered true unless its class defines either a :" -"meth:`~object.__bool__` method that returns ``False`` or a :meth:`~object." -"__len__` method that returns zero, when called with the object. [1]_ Here " -"are most of the built-in objects considered false:" +"By default, an object is considered true unless its class defines either " +"a :meth:`~object.__bool__` method that returns ``False`` or " +"a :meth:`~object.__len__` method that returns zero, when called with the " +"object. [1]_ Here are most of the built-in objects considered false:" msgstr "" -"預設情況下,一個物件會被視為真值,除非它的 class 定義了會回傳 ``False`` 的 :" -"meth:`~object.__bool__` method 或是定義了會回傳零的 :meth:`~object.__len__` " -"method。[1]_ 以下列出了大部分會被視為 false 的內建物件:" +"預設情況下,一個物件會被視為真值,除非它的 class 定義了會回傳 ``False`` " +"的 :meth:`~object.__bool__` method 或是定義了會回傳零" +"的 :meth:`~object.__len__` method。[1]_ 以下列出了大部分會被視為 false 的內建" +"物件:" #: ../../library/stdtypes.rst:56 msgid "constants defined to be false: ``None`` and ``False``" @@ -121,22 +123,22 @@ msgid "These are the Boolean operations, ordered by ascending priority:" msgstr "下方為 Boolean 運算,按優先順序排序:" #: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:144 -#: ../../library/stdtypes.rst:276 ../../library/stdtypes.rst:366 -#: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:965 -#: ../../library/stdtypes.rst:1173 +#: ../../library/stdtypes.rst:282 ../../library/stdtypes.rst:372 +#: ../../library/stdtypes.rst:422 ../../library/stdtypes.rst:1005 +#: ../../library/stdtypes.rst:1224 msgid "Operation" msgstr "運算" -#: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:276 -#: ../../library/stdtypes.rst:366 ../../library/stdtypes.rst:416 -#: ../../library/stdtypes.rst:965 ../../library/stdtypes.rst:1173 +#: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:282 +#: ../../library/stdtypes.rst:372 ../../library/stdtypes.rst:422 +#: ../../library/stdtypes.rst:1005 ../../library/stdtypes.rst:1224 msgid "Result" msgstr "結果" -#: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:276 -#: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:965 -#: ../../library/stdtypes.rst:1173 ../../library/stdtypes.rst:2647 -#: ../../library/stdtypes.rst:3867 +#: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:282 +#: ../../library/stdtypes.rst:422 ../../library/stdtypes.rst:1005 +#: ../../library/stdtypes.rst:1224 ../../library/stdtypes.rst:2841 +#: ../../library/stdtypes.rst:4101 msgid "Notes" msgstr "註解" @@ -148,9 +150,9 @@ msgstr "``x or y``" msgid "if *x* is true, then *x*, else *y*" msgstr "假如 *x* 為真,則 *x*,否則 *y*" -#: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:967 -#: ../../library/stdtypes.rst:970 ../../library/stdtypes.rst:1188 -#: ../../library/stdtypes.rst:2653 ../../library/stdtypes.rst:3873 +#: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:1007 +#: ../../library/stdtypes.rst:1010 ../../library/stdtypes.rst:1239 +#: ../../library/stdtypes.rst:2847 ../../library/stdtypes.rst:4107 msgid "\\(1)" msgstr "\\(1)" @@ -162,10 +164,10 @@ msgstr "``x and y``" msgid "if *x* is false, then *x*, else *y*" msgstr "假如 *x* 為假,則 *x*,否則 *y*" -#: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:289 -#: ../../library/stdtypes.rst:309 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:2657 ../../library/stdtypes.rst:2659 -#: ../../library/stdtypes.rst:3877 ../../library/stdtypes.rst:3879 +#: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:295 +#: ../../library/stdtypes.rst:315 ../../library/stdtypes.rst:1250 +#: ../../library/stdtypes.rst:2851 ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:4111 ../../library/stdtypes.rst:4113 msgid "\\(2)" msgstr "\\(2)" @@ -177,18 +179,18 @@ msgstr "``not x``" msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" -#: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:1219 -#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:2663 -#: ../../library/stdtypes.rst:2665 ../../library/stdtypes.rst:2667 -#: ../../library/stdtypes.rst:3881 ../../library/stdtypes.rst:3883 -#: ../../library/stdtypes.rst:3885 ../../library/stdtypes.rst:3887 +#: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:2855 +#: ../../library/stdtypes.rst:2857 ../../library/stdtypes.rst:2859 +#: ../../library/stdtypes.rst:2861 ../../library/stdtypes.rst:4115 +#: ../../library/stdtypes.rst:4117 ../../library/stdtypes.rst:4119 +#: ../../library/stdtypes.rst:4121 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:320 -#: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:1016 -#: ../../library/stdtypes.rst:1228 ../../library/stdtypes.rst:2693 -#: ../../library/stdtypes.rst:3917 +#: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:326 +#: ../../library/stdtypes.rst:440 ../../library/stdtypes.rst:1049 +#: ../../library/stdtypes.rst:1254 ../../library/stdtypes.rst:2887 +#: ../../library/stdtypes.rst:4151 msgid "Notes:" msgstr "註解:" @@ -235,9 +237,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2479 -#: ../../library/stdtypes.rst:2624 ../../library/stdtypes.rst:2647 -#: ../../library/stdtypes.rst:3844 ../../library/stdtypes.rst:3867 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2672 +#: ../../library/stdtypes.rst:2818 ../../library/stdtypes.rst:2841 +#: ../../library/stdtypes.rst:4078 ../../library/stdtypes.rst:4101 msgid "Meaning" msgstr "含義" @@ -324,23 +326,24 @@ msgid "" "Non-identical instances of a class normally compare as non-equal unless the " "class defines the :meth:`~object.__eq__` method." msgstr "" -"一個 class 的非相同實例通常會比較為不相等,除非 class 有定義 :meth:`~object." -"__eq__` method。" +"一個 class 的非相同實例通常會比較為不相等,除非 class 有定" +"義 :meth:`~object.__eq__` method。" #: ../../library/stdtypes.rst:184 msgid "" "Instances of a class cannot be ordered with respect to other instances of " "the same class, or other types of object, unless the class defines enough of " -"the methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object." -"__gt__`, and :meth:`~object.__ge__` (in general, :meth:`~object.__lt__` and :" -"meth:`~object.__eq__` are sufficient, if you want the conventional meanings " -"of the comparison operators)." +"the " +"methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " +"and :meth:`~object.__ge__` (in general, :meth:`~object.__lt__` " +"and :meth:`~object.__eq__` are sufficient, if you want the conventional " +"meanings of the comparison operators)." msgstr "" "一個 class 的實例不可以與其他相同 class 的實例或其他物件型別進行排序,除非 " -"class 定義足夠的 method ,包含 :meth:`~object.__lt__`、:meth:`~object." -"__le__`、:meth:`~object.__gt__` 及 :meth:`~object.__ge__`\\ (一般來說,使" -"用 :meth:`~object.__lt__` 及 :meth:`~object.__eq__` 就可以滿足常規意義上的比" -"較運算子)。" +"class 定義足夠的 method ,包" +"含 :meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object.__gt__` " +"及 :meth:`~object.__ge__`\\ (一般來說,使用 :meth:`~object.__lt__` " +"及 :meth:`~object.__eq__` 就可以滿足常規意義上的比較運算子)。" #: ../../library/stdtypes.rst:191 msgid "" @@ -353,8 +356,8 @@ msgstr "" #: ../../library/stdtypes.rst:199 msgid "" -"Two more operations with the same syntactic priority, :keyword:`in` and :" -"keyword:`not in`, are supported by types that are :term:`iterable` or " +"Two more operations with the same syntactic priority, :keyword:`in` " +"and :keyword:`not in`, are supported by types that are :term:`iterable` or " "implement the :meth:`~object.__contains__` method." msgstr "" "此外,擁有相同的語法優先序的 :keyword:`in` 及 :keyword:`not in` 兩種運算皆被" @@ -372,20 +375,21 @@ msgid "" "subtype of integers. Integers have unlimited precision. Floating-point " "numbers are usually implemented using :c:expr:`double` in C; information " "about the precision and internal representation of floating-point numbers " -"for the machine on which your program is running is available in :data:`sys." -"float_info`. Complex numbers have a real and imaginary part, which are each " -"a floating-point number. To extract these parts from a complex number *z*, " -"use ``z.real`` and ``z.imag``. (The standard library includes the additional " -"numeric types :mod:`fractions.Fraction`, for rationals, and :mod:`decimal." -"Decimal`, for floating-point numbers with user-definable precision.)" +"for the machine on which your program is running is available " +"in :data:`sys.float_info`. Complex numbers have a real and imaginary part, " +"which are each a floating-point number. To extract these parts from a " +"complex number *z*, use ``z.real`` and ``z.imag``. (The standard library " +"includes the additional numeric types :mod:`fractions.Fraction`, for " +"rationals, and :mod:`decimal.Decimal`, for floating-point numbers with user-" +"definable precision.)" msgstr "" "數值型別共有三種::dfn:`整數`、:dfn:`浮點數` 及 :dfn:`複數`。此外,Boolean 為" -"整數中的一個子型別。整數有無限的精度。浮點數通常使用 C 裡面的 :c:expr:" -"`double` 實作。關於在你程式所運作的機器上之浮點數的精度及內部表示法可以在 :" -"data:`sys.float_info` 進行查找。複數包含實數及虛數的部分,這兩部分各自是一個" -"浮點數。若要從一個複數 *z* 提取這兩部分,需使用 ``z.real`` 及 ``z.imag``。" -"(標準函式庫包含額外的數值型別,像是 :mod:`fractions.Fraction` 表示有理數," -"而 :mod:`decimal.Decimal` 表示可由使用者制定精度的浮點數。)" +"整數中的一個子型別。整數有無限的精度。浮點數通常使用 C 裡面" +"的 :c:expr:`double` 實作。關於在你程式所運作的機器上之浮點數的精度及內部表示" +"法可以在 :data:`sys.float_info` 進行查找。複數包含實數及虛數的部分,這兩部分" +"各自是一個浮點數。若要從一個複數 *z* 提取這兩部分,需使用 ``z.real`` 及 " +"``z.imag``。(標準函式庫包含額外的數值型別,像是 :mod:`fractions.Fraction` 表" +"示有理數,而 :mod:`decimal.Decimal` 表示可由使用者制定精度的浮點數。)" #: ../../library/stdtypes.rst:238 msgid "" @@ -402,215 +406,226 @@ msgstr "" "yield 浮點數。在數值後面加上 ``'j'`` 或是 ``'J'`` 會 yield 一個虛數(意即一個" "實數為 0 的複數)。你也可以將整數與浮點數相加以得到一個有實部與虛部的複數。" -#: ../../library/stdtypes.rst:263 +#: ../../library/stdtypes.rst:246 +msgid "" +"The constructors :func:`int`, :func:`float`, and :func:`complex` can be used " +"to produce numbers of a specific type." +msgstr "" +"建構函式: :func:`int`、:func:`float` 及 :func:`complex` 可以用來產生特定型別" +"的數字。" + +#: ../../library/stdtypes.rst:266 +#, fuzzy msgid "" "Python fully supports mixed arithmetic: when a binary arithmetic operator " "has operands of different numeric types, the operand with the \"narrower\" " "type is widened to that of the other, where integer is narrower than " -"floating point, which is narrower than complex. A comparison between numbers " -"of different types behaves as though the exact values of those numbers were " -"being compared. [2]_" +"floating point. Arithmetic with complex and real operands is defined by the " +"usual mathematical formula, for example::" msgstr "" "Python 完全支援混和運算:當一個二元運算子的運算元有不同數值型別時,「較窄」型" "別的運算元會被拓寬到另一個型別的運算元;在此處,整數窄於浮點數,浮點數又窄於" "複數。不同型別的數字間的比較等同於這些數字的精確值進行比較。[2]_" -#: ../../library/stdtypes.rst:269 +#: ../../library/stdtypes.rst:272 msgid "" -"The constructors :func:`int`, :func:`float`, and :func:`complex` can be used " -"to produce numbers of a specific type." +"x + complex(u, v) = complex(x + u, v)\n" +"x * complex(u, v) = complex(x * u, x * v)" msgstr "" -"建構函式: :func:`int`、:func:`float` 及 :func:`complex` 可以用來產生特定型別" -"的數字。" -#: ../../library/stdtypes.rst:272 +#: ../../library/stdtypes.rst:275 +msgid "" +"A comparison between numbers of different types behaves as though the exact " +"values of those numbers were being compared. [2]_" +msgstr "" + +#: ../../library/stdtypes.rst:278 msgid "" "All numeric types (except complex) support the following operations (for " "priorities of the operations, see :ref:`operator-summary`):" msgstr "" -"所有數值型別(除複數外)皆支援以下的運算(有關運算的先後順序,詳見 :ref:" -"`operator-summary`):" +"所有數值型別(除複數外)皆支援以下的運算(有關運算的先後順序,詳" +"見 :ref:`operator-summary`):" -#: ../../library/stdtypes.rst:276 +#: ../../library/stdtypes.rst:282 msgid "Full documentation" msgstr "完整文件" -#: ../../library/stdtypes.rst:278 +#: ../../library/stdtypes.rst:284 msgid "``x + y``" msgstr "``x + y``" -#: ../../library/stdtypes.rst:278 +#: ../../library/stdtypes.rst:284 msgid "sum of *x* and *y*" msgstr "*x* 及 *y* 的加總" -#: ../../library/stdtypes.rst:280 +#: ../../library/stdtypes.rst:286 msgid "``x - y``" msgstr "``x - y``" -#: ../../library/stdtypes.rst:280 +#: ../../library/stdtypes.rst:286 msgid "difference of *x* and *y*" msgstr "*x* 及 *y* 的相減" -#: ../../library/stdtypes.rst:282 +#: ../../library/stdtypes.rst:288 msgid "``x * y``" msgstr "``x * y``" -#: ../../library/stdtypes.rst:282 +#: ../../library/stdtypes.rst:288 msgid "product of *x* and *y*" msgstr "*x* 及 *y* 的相乘" -#: ../../library/stdtypes.rst:284 +#: ../../library/stdtypes.rst:290 msgid "``x / y``" msgstr "``x / y``" -#: ../../library/stdtypes.rst:284 +#: ../../library/stdtypes.rst:290 msgid "quotient of *x* and *y*" msgstr "*x* 及 *y* 相除之商" -#: ../../library/stdtypes.rst:286 +#: ../../library/stdtypes.rst:292 msgid "``x // y``" msgstr "``x // y``" -#: ../../library/stdtypes.rst:286 +#: ../../library/stdtypes.rst:292 msgid "floored quotient of *x* and *y*" msgstr "*x* 及 *y* 的整數除法" -#: ../../library/stdtypes.rst:286 +#: ../../library/stdtypes.rst:292 msgid "\\(1)\\(2)" msgstr "\\(1)\\(2)" -#: ../../library/stdtypes.rst:289 +#: ../../library/stdtypes.rst:295 msgid "``x % y``" msgstr "``x % y``" -#: ../../library/stdtypes.rst:289 +#: ../../library/stdtypes.rst:295 msgid "remainder of ``x / y``" msgstr "``x / y`` 的餘數" -#: ../../library/stdtypes.rst:291 +#: ../../library/stdtypes.rst:297 msgid "``-x``" msgstr "``-x``" -#: ../../library/stdtypes.rst:291 +#: ../../library/stdtypes.rst:297 msgid "*x* negated" msgstr "*x* 的負數" -#: ../../library/stdtypes.rst:293 +#: ../../library/stdtypes.rst:299 msgid "``+x``" msgstr "``+x``" -#: ../../library/stdtypes.rst:293 +#: ../../library/stdtypes.rst:299 msgid "*x* unchanged" msgstr "*x* 不變" -#: ../../library/stdtypes.rst:295 +#: ../../library/stdtypes.rst:301 msgid "``abs(x)``" msgstr "``abs(x)``" -#: ../../library/stdtypes.rst:295 +#: ../../library/stdtypes.rst:301 msgid "absolute value or magnitude of *x*" msgstr "*x* 的絕對值或量 (magnitude)" -#: ../../library/stdtypes.rst:295 +#: ../../library/stdtypes.rst:301 msgid ":func:`abs`" msgstr ":func:`abs`" -#: ../../library/stdtypes.rst:298 +#: ../../library/stdtypes.rst:304 msgid "``int(x)``" msgstr "``int(x)``" -#: ../../library/stdtypes.rst:298 +#: ../../library/stdtypes.rst:304 msgid "*x* converted to integer" msgstr "將 *x* 轉為整數" -#: ../../library/stdtypes.rst:298 +#: ../../library/stdtypes.rst:304 msgid "\\(3)\\(6)" msgstr "\\(3)\\(6)" -#: ../../library/stdtypes.rst:298 +#: ../../library/stdtypes.rst:304 msgid ":func:`int`" msgstr ":func:`int`" -#: ../../library/stdtypes.rst:300 +#: ../../library/stdtypes.rst:306 msgid "``float(x)``" msgstr "``float(x)``" -#: ../../library/stdtypes.rst:300 +#: ../../library/stdtypes.rst:306 msgid "*x* converted to floating point" msgstr "將 *x* 轉為浮點數" -#: ../../library/stdtypes.rst:300 +#: ../../library/stdtypes.rst:306 msgid "\\(4)\\(6)" msgstr "\\(4)\\(6)" -#: ../../library/stdtypes.rst:300 +#: ../../library/stdtypes.rst:306 msgid ":func:`float`" msgstr ":func:`float`" -#: ../../library/stdtypes.rst:302 +#: ../../library/stdtypes.rst:308 msgid "``complex(re, im)``" msgstr "``complex(re, im)``" -#: ../../library/stdtypes.rst:302 +#: ../../library/stdtypes.rst:308 msgid "" "a complex number with real part *re*, imaginary part *im*. *im* defaults to " "zero." msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" -#: ../../library/stdtypes.rst:302 ../../library/stdtypes.rst:1209 -#: ../../library/stdtypes.rst:2655 ../../library/stdtypes.rst:3904 +#: ../../library/stdtypes.rst:308 ../../library/stdtypes.rst:2849 +#: ../../library/stdtypes.rst:4138 msgid "\\(6)" msgstr "\\(6)" -#: ../../library/stdtypes.rst:302 +#: ../../library/stdtypes.rst:308 msgid ":func:`complex`" msgstr ":func:`complex`" -#: ../../library/stdtypes.rst:306 +#: ../../library/stdtypes.rst:312 msgid "``c.conjugate()``" msgstr "``c.conjugate()``" -#: ../../library/stdtypes.rst:306 +#: ../../library/stdtypes.rst:312 msgid "conjugate of the complex number *c*" msgstr "為複數 *c* 的共軛複數" -#: ../../library/stdtypes.rst:309 +#: ../../library/stdtypes.rst:315 msgid "``divmod(x, y)``" msgstr "``divmod(x, y)``" -#: ../../library/stdtypes.rst:309 +#: ../../library/stdtypes.rst:315 msgid "the pair ``(x // y, x % y)``" msgstr "一對 ``(x // y, x % y)``" -#: ../../library/stdtypes.rst:309 +#: ../../library/stdtypes.rst:315 msgid ":func:`divmod`" msgstr ":func:`divmod`" -#: ../../library/stdtypes.rst:311 +#: ../../library/stdtypes.rst:317 msgid "``pow(x, y)``" msgstr "``pow(x, y)``" -#: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313 +#: ../../library/stdtypes.rst:317 ../../library/stdtypes.rst:319 msgid "*x* to the power *y*" msgstr "*x* 的 *y* 次方" -#: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313 -#: ../../library/stdtypes.rst:1198 ../../library/stdtypes.rst:1201 -#: ../../library/stdtypes.rst:2680 ../../library/stdtypes.rst:2683 -#: ../../library/stdtypes.rst:2686 ../../library/stdtypes.rst:3900 -#: ../../library/stdtypes.rst:3907 +#: ../../library/stdtypes.rst:317 ../../library/stdtypes.rst:319 +#: ../../library/stdtypes.rst:2874 ../../library/stdtypes.rst:2877 +#: ../../library/stdtypes.rst:2880 ../../library/stdtypes.rst:4134 +#: ../../library/stdtypes.rst:4141 msgid "\\(5)" msgstr "\\(5)" -#: ../../library/stdtypes.rst:311 +#: ../../library/stdtypes.rst:317 msgid ":func:`pow`" msgstr ":func:`pow`" -#: ../../library/stdtypes.rst:313 +#: ../../library/stdtypes.rst:319 msgid "``x ** y``" msgstr "``x ** y``" -#: ../../library/stdtypes.rst:323 +#: ../../library/stdtypes.rst:329 msgid "" "Also referred to as integer division. For operands of type :class:`int`, " "the result has type :class:`int`. For operands of type :class:`float`, the " @@ -619,28 +634,28 @@ msgid "" "always rounded towards minus infinity: ``1//2`` is ``0``, ``(-1)//2`` is " "``-1``, ``1//(-2)`` is ``-1``, and ``(-1)//(-2)`` is ``0``." msgstr "" -"也被稱為整數除法。對於型別為 :class:`int` 的運算元來說,結果之型別會是 :" -"class:`int`。對於型別為 :class:`float` 的運算元來說,結果之型別會是 :class:" -"`float`。一般來說,結果會是一個整數,但其型別不一定會是 :class:`int`。結果總" -"是會往負無窮大的方向取整數值: ``1//2`` 為 ``0``、``(-1)//2`` 為 ``-1``、" -"``1//(-2)`` 為 ``-1`` 及 ``(-1)//(-2)`` 為 ``0``。" +"也被稱為整數除法。對於型別為 :class:`int` 的運算元來說,結果之型別會" +"是 :class:`int`。對於型別為 :class:`float` 的運算元來說,結果之型別會" +"是 :class:`float`。一般來說,結果會是一個整數,但其型別不一定會" +"是 :class:`int`。結果總是會往負無窮大的方向取整數值: ``1//2`` 為 ``0``、" +"``(-1)//2`` 為 ``-1``、``1//(-2)`` 為 ``-1`` 及 ``(-1)//(-2)`` 為 ``0``。" -#: ../../library/stdtypes.rst:331 +#: ../../library/stdtypes.rst:337 msgid "" "Not for complex numbers. Instead convert to floats using :func:`abs` if " "appropriate." msgstr "不可用於複數。在適當情形下,可使用 :func:`abs` 轉換為浮點數。" -#: ../../library/stdtypes.rst:342 +#: ../../library/stdtypes.rst:348 msgid "" "Conversion from :class:`float` to :class:`int` truncates, discarding the " "fractional part. See functions :func:`math.floor` and :func:`math.ceil` for " "alternative conversions." msgstr "" -"從 :class:`float` 轉換為 :class:`int` 會導致截斷並排除小數部分。詳見 :func:" -"`math.floor` 及 :func:`math.ceil` 以了解更多轉換方式。" +"從 :class:`float` 轉換為 :class:`int` 會導致截斷並排除小數部分。詳" +"見 :func:`math.floor` 及 :func:`math.ceil` 以了解更多轉換方式。" -#: ../../library/stdtypes.rst:347 +#: ../../library/stdtypes.rst:353 msgid "" "float also accepts the strings \"nan\" and \"inf\" with an optional prefix " "\"+\" or \"-\" for Not a Number (NaN) and positive or negative infinity." @@ -648,14 +663,14 @@ msgstr "" "浮點數也接受帶有可選的前綴 \"+\" 及 \"-\" 的 \"nan\" 及 \"inf\" 字串,其分別" "代表非數字(NaN)及正負無窮。" -#: ../../library/stdtypes.rst:351 +#: ../../library/stdtypes.rst:357 msgid "" "Python defines ``pow(0, 0)`` and ``0 ** 0`` to be ``1``, as is common for " "programming languages." msgstr "" "Python 將 ``pow(0, 0)`` 及 ``0 ** 0`` 定義為 ``1`` 這是程式語言的普遍做法。" -#: ../../library/stdtypes.rst:355 +#: ../../library/stdtypes.rst:361 msgid "" "The numeric literals accepted include the digits ``0`` to ``9`` or any " "Unicode equivalent (code points with the ``Nd`` property)." @@ -663,7 +678,7 @@ msgstr "" "字面數值接受包含數字 ``0`` 到 ``9`` 或任何等效的 Unicode 字元(具有 ``Nd`` 屬" "性的 code points(碼位))。" -#: ../../library/stdtypes.rst:358 +#: ../../library/stdtypes.rst:364 msgid "" "See `the Unicode Standard `_ for a complete list of code points with the ``Nd`` " @@ -672,7 +687,7 @@ msgstr "" "請參閱 `Unicode 標準 `_\\ 以了解具有 ``Nd`` 屬性的 code points 完整列表。" -#: ../../library/stdtypes.rst:362 +#: ../../library/stdtypes.rst:368 msgid "" "All :class:`numbers.Real` types (:class:`int` and :class:`float`) also " "include the following operations:" @@ -680,51 +695,51 @@ msgstr "" "所有 :class:`numbers.Real` 型別(:class:`int` 及 :class:`float`)也適用下列運" "算:" -#: ../../library/stdtypes.rst:368 +#: ../../library/stdtypes.rst:374 msgid ":func:`math.trunc(\\ x) `" msgstr ":func:`math.trunc(\\ x) `" -#: ../../library/stdtypes.rst:368 +#: ../../library/stdtypes.rst:374 msgid "*x* truncated to :class:`~numbers.Integral`" msgstr "*x* 截斷為 :class:`~numbers.Integral`" -#: ../../library/stdtypes.rst:371 +#: ../../library/stdtypes.rst:377 msgid ":func:`round(x[, n]) `" msgstr ":func:`round(x[, n]) `" -#: ../../library/stdtypes.rst:371 +#: ../../library/stdtypes.rst:377 msgid "" "*x* rounded to *n* digits, rounding half to even. If *n* is omitted, it " "defaults to 0." msgstr "*x* 進位至小數點後第 *n* 位,使用偶數捨入法。若省略 *n* ,則預設為 0。" -#: ../../library/stdtypes.rst:375 +#: ../../library/stdtypes.rst:381 msgid ":func:`math.floor(\\ x) `" msgstr ":func:`math.floor(\\ x) `" -#: ../../library/stdtypes.rst:375 +#: ../../library/stdtypes.rst:381 msgid "the greatest :class:`~numbers.Integral` <= *x*" msgstr "小於等於 *x* 的最大 :class:`~numbers.Integral`" -#: ../../library/stdtypes.rst:378 +#: ../../library/stdtypes.rst:384 msgid ":func:`math.ceil(x) `" msgstr ":func:`math.ceil(x) `" -#: ../../library/stdtypes.rst:378 +#: ../../library/stdtypes.rst:384 msgid "the least :class:`~numbers.Integral` >= *x*" msgstr "大於等於 *x* 的最小 :class:`~numbers.Integral`" -#: ../../library/stdtypes.rst:382 +#: ../../library/stdtypes.rst:388 msgid "" "For additional numeric operations see the :mod:`math` and :mod:`cmath` " "modules." msgstr "關於其他數值運算請詳見 :mod:`math` 及 :mod:`cmath` modules(模組)。" -#: ../../library/stdtypes.rst:391 +#: ../../library/stdtypes.rst:397 msgid "Bitwise Operations on Integer Types" msgstr "整數型別的位元運算" -#: ../../library/stdtypes.rst:405 +#: ../../library/stdtypes.rst:411 msgid "" "Bitwise operations only make sense for integers. The result of bitwise " "operations is calculated as though carried out in two's complement with an " @@ -733,7 +748,7 @@ msgstr "" "位元運算只對整數有意義。位元運算的計算結果就如同對二的補數執行無窮多個符號位" "元。" -#: ../../library/stdtypes.rst:409 +#: ../../library/stdtypes.rst:415 msgid "" "The priorities of the binary bitwise operations are all lower than the " "numeric operations and higher than the comparisons; the unary operation " @@ -743,104 +758,104 @@ msgstr "" "二元位元運算的優先順序皆低於數字運算,但高於比較運算;一元運算 ``~`` 與其他一" "元數值運算有一致的優先順序(``+`` 及 ``-``)。" -#: ../../library/stdtypes.rst:413 +#: ../../library/stdtypes.rst:419 msgid "This table lists the bitwise operations sorted in ascending priority:" msgstr "這個表格列出所有位元運算並以優先順序由先至後排序。" -#: ../../library/stdtypes.rst:418 +#: ../../library/stdtypes.rst:424 msgid "``x | y``" msgstr "``x | y``" -#: ../../library/stdtypes.rst:418 +#: ../../library/stdtypes.rst:424 msgid "bitwise :dfn:`or` of *x* and *y*" msgstr "*x* 及 *y* 的位元 :dfn:`或`" -#: ../../library/stdtypes.rst:418 ../../library/stdtypes.rst:421 -#: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:1223 -#: ../../library/stdtypes.rst:2669 ../../library/stdtypes.rst:2673 -#: ../../library/stdtypes.rst:3889 ../../library/stdtypes.rst:3893 +#: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:427 +#: ../../library/stdtypes.rst:430 ../../library/stdtypes.rst:2863 +#: ../../library/stdtypes.rst:2867 ../../library/stdtypes.rst:4123 +#: ../../library/stdtypes.rst:4127 msgid "\\(4)" msgstr "\\(4)" -#: ../../library/stdtypes.rst:421 +#: ../../library/stdtypes.rst:427 msgid "``x ^ y``" msgstr "``x ^ y``" -#: ../../library/stdtypes.rst:421 +#: ../../library/stdtypes.rst:427 msgid "bitwise :dfn:`exclusive or` of *x* and *y*" msgstr "*x* 及 *y* 的位元 :dfn:`邏輯互斥或`" -#: ../../library/stdtypes.rst:424 +#: ../../library/stdtypes.rst:430 msgid "``x & y``" msgstr "``x & y``" -#: ../../library/stdtypes.rst:424 +#: ../../library/stdtypes.rst:430 msgid "bitwise :dfn:`and` of *x* and *y*" msgstr "*x* 及 *y* 的位元 :dfn:`與`" -#: ../../library/stdtypes.rst:427 +#: ../../library/stdtypes.rst:433 msgid "``x << n``" msgstr "``x << n``" -#: ../../library/stdtypes.rst:427 +#: ../../library/stdtypes.rst:433 msgid "*x* shifted left by *n* bits" msgstr "*x* 往左移動 *n* 個位元" -#: ../../library/stdtypes.rst:427 +#: ../../library/stdtypes.rst:433 msgid "(1)(2)" msgstr "(1)(2)" -#: ../../library/stdtypes.rst:429 +#: ../../library/stdtypes.rst:435 msgid "``x >> n``" msgstr "``x >> n``" -#: ../../library/stdtypes.rst:429 +#: ../../library/stdtypes.rst:435 msgid "*x* shifted right by *n* bits" msgstr "*x* 往右移動 *n* 個位元" -#: ../../library/stdtypes.rst:429 +#: ../../library/stdtypes.rst:435 msgid "(1)(3)" msgstr "(1)(3)" -#: ../../library/stdtypes.rst:431 +#: ../../library/stdtypes.rst:437 msgid "``~x``" msgstr "``~x``" -#: ../../library/stdtypes.rst:431 +#: ../../library/stdtypes.rst:437 msgid "the bits of *x* inverted" msgstr "反轉 *x* 的位元" -#: ../../library/stdtypes.rst:437 +#: ../../library/stdtypes.rst:443 msgid "" "Negative shift counts are illegal and cause a :exc:`ValueError` to be raised." msgstr "負數位移是不被允許並會引發 :exc:`ValueError` 的錯誤。" -#: ../../library/stdtypes.rst:440 +#: ../../library/stdtypes.rst:446 msgid "" "A left shift by *n* bits is equivalent to multiplication by ``pow(2, n)``." msgstr "向左移動 *n* 個位元等同於乘以 ``pow(2, n)``。" -#: ../../library/stdtypes.rst:443 +#: ../../library/stdtypes.rst:449 msgid "" "A right shift by *n* bits is equivalent to floor division by ``pow(2, n)``." msgstr "向右移動 *n* 個位元等同於向下除法除以 ``pow(2, n)``。" -#: ../../library/stdtypes.rst:446 +#: ../../library/stdtypes.rst:452 msgid "" "Performing these calculations with at least one extra sign extension bit in " -"a finite two's complement representation (a working bit-width of ``1 + max(x." -"bit_length(), y.bit_length())`` or more) is sufficient to get the same " +"a finite two's complement representation (a working bit-width of ``1 + " +"max(x.bit_length(), y.bit_length())`` or more) is sufficient to get the same " "result as if there were an infinite number of sign bits." msgstr "" -"在有限的二的補數表示法中執行這些計算(一個有效位元寬度為 ``1 + max(x." -"bit_length(), y.bit_length())`` 或以上)並至少有一個額外的符號擴展位元,便足" -"以得到與無窮多個符號位元相同的結果。" +"在有限的二的補數表示法中執行這些計算(一個有效位元寬度為 ``1 + " +"max(x.bit_length(), y.bit_length())`` 或以上)並至少有一個額外的符號擴展位" +"元,便足以得到與無窮多個符號位元相同的結果。" -#: ../../library/stdtypes.rst:453 +#: ../../library/stdtypes.rst:459 msgid "Additional Methods on Integer Types" msgstr "整數型別的附加 methods" -#: ../../library/stdtypes.rst:455 +#: ../../library/stdtypes.rst:461 msgid "" "The int type implements the :class:`numbers.Integral` :term:`abstract base " "class`. In addition, it provides a few more methods:" @@ -848,13 +863,13 @@ msgstr "" "整數型別實作了 :class:`numbers.Integral` :term:`抽象基底類別 `。此外,它提供了一些 methods:" -#: ../../library/stdtypes.rst:460 +#: ../../library/stdtypes.rst:466 msgid "" "Return the number of bits necessary to represent an integer in binary, " "excluding the sign and leading zeros::" msgstr "回傳以二進位表示一個整數所需要的位元數,不包括符號及首位的零: ::" -#: ../../library/stdtypes.rst:463 +#: ../../library/stdtypes.rst:469 msgid "" ">>> n = -37\n" ">>> bin(n)\n" @@ -868,25 +883,25 @@ msgstr "" ">>> n.bit_length()\n" "6" -#: ../../library/stdtypes.rst:469 +#: ../../library/stdtypes.rst:475 msgid "" "More precisely, if ``x`` is nonzero, then ``x.bit_length()`` is the unique " "positive integer ``k`` such that ``2**(k-1) <= abs(x) < 2**k``. " "Equivalently, when ``abs(x)`` is small enough to have a correctly rounded " -"logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then ``x." -"bit_length()`` returns ``0``." +"logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then " +"``x.bit_length()`` returns ``0``." msgstr "" "更準確來說,若 ``x`` 非為零,則 ``x.bit_length()`` 會得出滿足 ``2**(k-1) <= " "abs(x) < 2**k`` 的單一正整數 ``k``。同樣地,當 ``abs(x)`` 足夠小到能正確地取" -"得捨入的對數,則 ``k = 1 + int(log(abs(x), 2))``。若 ``x`` 為零,則 ``x." -"bit_length()`` 會回傳 ``0``。" +"得捨入的對數,則 ``k = 1 + int(log(abs(x), 2))``。若 ``x`` 為零,則 " +"``x.bit_length()`` 會回傳 ``0``。" -#: ../../library/stdtypes.rst:475 ../../library/stdtypes.rst:498 -#: ../../library/stdtypes.rst:543 ../../library/stdtypes.rst:587 +#: ../../library/stdtypes.rst:481 ../../library/stdtypes.rst:504 +#: ../../library/stdtypes.rst:549 ../../library/stdtypes.rst:593 msgid "Equivalent to::" msgstr "等同於: ::" -#: ../../library/stdtypes.rst:477 +#: ../../library/stdtypes.rst:483 msgid "" "def bit_length(self):\n" " s = bin(self) # binary representation: bin(-37) --> '-0b100101'\n" @@ -894,13 +909,13 @@ msgid "" " return len(s) # len('100101') --> 6" msgstr "" -#: ../../library/stdtypes.rst:486 +#: ../../library/stdtypes.rst:492 msgid "" "Return the number of ones in the binary representation of the absolute value " "of the integer. This is also known as the population count. Example::" msgstr "回傳在絕對值表示的二進位中 1 的個數。這也被稱作母體計數。舉例來說: ::" -#: ../../library/stdtypes.rst:490 +#: ../../library/stdtypes.rst:496 msgid "" ">>> n = 19\n" ">>> bin(n)\n" @@ -918,7 +933,7 @@ msgstr "" ">>> (-n).bit_count()\n" "3" -#: ../../library/stdtypes.rst:500 +#: ../../library/stdtypes.rst:506 msgid "" "def bit_count(self):\n" " return bin(self).count(\"1\")" @@ -926,20 +941,20 @@ msgstr "" "def bit_count(self):\n" " return bin(self).count(\"1\")" -#: ../../library/stdtypes.rst:507 +#: ../../library/stdtypes.rst:513 msgid "Return an array of bytes representing an integer." msgstr "回傳表示一個整數的一列位元組。" -#: ../../library/stdtypes.rst:519 +#: ../../library/stdtypes.rst:525 msgid "" -"The integer is represented using *length* bytes, and defaults to 1. An :exc:" -"`OverflowError` is raised if the integer is not representable with the given " -"number of bytes." +"The integer is represented using *length* bytes, and defaults to 1. " +"An :exc:`OverflowError` is raised if the integer is not representable with " +"the given number of bytes." msgstr "" "此整數會使用 *length* 位元組表示,並且預設為 1。如果該整數無法用給定的位元組" "數來表示,則會引發 :exc:`OverflowError`。" -#: ../../library/stdtypes.rst:523 +#: ../../library/stdtypes.rst:529 msgid "" "The *byteorder* argument determines the byte order used to represent the " "integer, and defaults to ``\"big\"``. If *byteorder* is ``\"big\"``, the " @@ -950,7 +965,7 @@ msgstr "" "byteorder 是 ``\"big\"``,最重要的位元組位於位元組陣列的開頭。如果 byteorder " "是 ``\"little\"``,最重要的位元組位於位元組陣列的結尾。" -#: ../../library/stdtypes.rst:529 +#: ../../library/stdtypes.rst:535 msgid "" "The *signed* argument determines whether two's complement is used to " "represent the integer. If *signed* is ``False`` and a negative integer is " @@ -961,13 +976,13 @@ msgstr "" "給定了一個負整數,則會引發 :exc:`OverflowError`。*signed* 的預設值是 " "``False``。" -#: ../../library/stdtypes.rst:534 +#: ../../library/stdtypes.rst:540 msgid "" "The default values can be used to conveniently turn an integer into a single " "byte object::" msgstr "預設值可以方便地將一個整數轉換為單一位元組物件: ::" -#: ../../library/stdtypes.rst:537 +#: ../../library/stdtypes.rst:543 msgid "" ">>> (65).to_bytes()\n" "b'A'" @@ -975,15 +990,15 @@ msgstr "" ">>> (65).to_bytes()\n" "b'A'" -#: ../../library/stdtypes.rst:540 +#: ../../library/stdtypes.rst:546 msgid "" "However, when using the default arguments, don't try to convert a value " "greater than 255 or you'll get an :exc:`OverflowError`." msgstr "" -"然而,使用預設引數時,不要嘗試轉換大於 255 的值,否則你將會得到一個 :exc:" -"`OverflowError`。" +"然而,使用預設引數時,不要嘗試轉換大於 255 的值,否則你將會得到一" +"個 :exc:`OverflowError`。" -#: ../../library/stdtypes.rst:545 +#: ../../library/stdtypes.rst:551 msgid "" "def to_bytes(n, length=1, byteorder='big', signed=False):\n" " if byteorder == 'little':\n" @@ -1005,15 +1020,15 @@ msgstr "" "\n" " return bytes((n >> i*8) & 0xff for i in order)" -#: ../../library/stdtypes.rst:556 +#: ../../library/stdtypes.rst:562 msgid "Added default argument values for ``length`` and ``byteorder``." msgstr "為 ``length`` 和 ``byteorder`` 添加了預設引數值。" -#: ../../library/stdtypes.rst:561 +#: ../../library/stdtypes.rst:567 msgid "Return the integer represented by the given array of bytes." msgstr "回傳由給定的位元組陣列表示的整數。" -#: ../../library/stdtypes.rst:574 +#: ../../library/stdtypes.rst:580 msgid "" "The argument *bytes* must either be a :term:`bytes-like object` or an " "iterable producing bytes." @@ -1021,27 +1036,27 @@ msgstr "" "引數 *bytes* 必須是一個\\ :term:`類位元組物件 `\\ 或是一個" "產生位元組的可疊代物件。" -#: ../../library/stdtypes.rst:577 +#: ../../library/stdtypes.rst:583 msgid "" "The *byteorder* argument determines the byte order used to represent the " "integer, and defaults to ``\"big\"``. If *byteorder* is ``\"big\"``, the " "most significant byte is at the beginning of the byte array. If *byteorder* " "is ``\"little\"``, the most significant byte is at the end of the byte " -"array. To request the native byte order of the host system, use :data:`sys." -"byteorder` as the byte order value." +"array. To request the native byte order of the host system, " +"use :data:`sys.byteorder` as the byte order value." msgstr "" "*byteorder* 引數決定了用來表示整數的位元組順序並且預設為 ``\"big\"``。如果 " "*byteorder* 是 ``\"big\"``,最重要的位元組位於位元組陣列的開頭。如果 " "*byteorder* 是 ``\"little\"``,最重要的位元組位於位元組陣列的結尾。若要請求主" "機系統的本機位元組順序,請使用 :data:`sys.byteorder` 作為位元組順序值。" -#: ../../library/stdtypes.rst:584 +#: ../../library/stdtypes.rst:590 msgid "" "The *signed* argument indicates whether two's complement is used to " "represent the integer." msgstr "*signed* 引數指示是否使用二的補數來表示整數。" -#: ../../library/stdtypes.rst:589 +#: ../../library/stdtypes.rst:595 msgid "" "def from_bytes(bytes, byteorder='big', signed=False):\n" " if byteorder == 'little':\n" @@ -1071,11 +1086,11 @@ msgstr "" "\n" " return n" -#: ../../library/stdtypes.rst:604 +#: ../../library/stdtypes.rst:610 msgid "Added default argument value for ``byteorder``." msgstr "為 ``byteorder`` 添加了預設引數值。" -#: ../../library/stdtypes.rst:609 +#: ../../library/stdtypes.rst:615 msgid "" "Return a pair of integers whose ratio is equal to the original integer and " "has a positive denominator. The integer ratio of integers (whole numbers) " @@ -1084,17 +1099,17 @@ msgstr "" "回傳一對整數,其比率等於原始整數並且有一個正分母。整數(整個數值)的整數比率" "總是整數作為分子,並且 ``1`` 作為分母。" -#: ../../library/stdtypes.rst:618 +#: ../../library/stdtypes.rst:624 msgid "" -"Returns ``True``. Exists for duck type compatibility with :meth:`float." -"is_integer`." +"Returns ``True``. Exists for duck type compatibility " +"with :meth:`float.is_integer`." msgstr "回傳 ``True``。為了與 :meth:`float.is_integer` 的鴨子型別相容而存在。" -#: ../../library/stdtypes.rst:623 +#: ../../library/stdtypes.rst:629 msgid "Additional Methods on Float" msgstr "浮點數的附加 methods" -#: ../../library/stdtypes.rst:625 +#: ../../library/stdtypes.rst:631 msgid "" "The float type implements the :class:`numbers.Real` :term:`abstract base " "class`. float also has the following additional methods." @@ -1102,16 +1117,36 @@ msgstr "" "浮點數型別實作了 :class:`numbers.Real` :term:`抽象基底類別 `。浮點數也有下列附加 methods。" -#: ../../library/stdtypes.rst:630 +#: ../../library/stdtypes.rst:636 +msgid "" +"Class method to return a floating-point number constructed from a number *x*." +msgstr "" + +#: ../../library/stdtypes.rst:638 +msgid "" +"If the argument is an integer or a floating-point number, a floating-point " +"number with the same value (within Python's floating-point precision) is " +"returned. If the argument is outside the range of a Python float, " +"an :exc:`OverflowError` will be raised." +msgstr "" + +#: ../../library/stdtypes.rst:643 +msgid "" +"For a general Python object ``x``, ``float.from_number(x)`` delegates to " +"``x.__float__()``. If :meth:`~object.__float__` is not defined then it falls " +"back to :meth:`~object.__index__`." +msgstr "" + +#: ../../library/stdtypes.rst:653 msgid "" "Return a pair of integers whose ratio is exactly equal to the original " -"float. The ratio is in lowest terms and has a positive denominator. Raises :" -"exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs." +"float. The ratio is in lowest terms and has a positive denominator. " +"Raises :exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs." msgstr "" "回傳一對整數,其比率完全等於原始浮點數。比率是在最低條件下並且有一個正分母。" "在無窮大時引發 :exc:`OverflowError`,在 NaN 時引發 :exc:`ValueError`。" -#: ../../library/stdtypes.rst:637 +#: ../../library/stdtypes.rst:660 msgid "" "Return ``True`` if the float instance is finite with integral value, and " "``False`` otherwise::" @@ -1119,7 +1154,7 @@ msgstr "" "如果浮點數實例是有限的並且具有整數值,則回傳 ``True``,否則回傳 " "``False``: ::" -#: ../../library/stdtypes.rst:640 +#: ../../library/stdtypes.rst:663 msgid "" ">>> (-2.0).is_integer()\n" "True\n" @@ -1131,7 +1166,7 @@ msgstr "" ">>> (3.2).is_integer()\n" "False" -#: ../../library/stdtypes.rst:645 +#: ../../library/stdtypes.rst:668 msgid "" "Two methods support conversion to and from hexadecimal strings. Since " "Python's floats are stored internally as binary numbers, converting a float " @@ -1144,7 +1179,7 @@ msgstr "" "值儲存,將浮點數轉換為或從 *十進位* 字串通常涉及一個小的四捨五入誤差。相反" "地,十六進位字串允許精確表示和指定浮點數。這在除錯和數值工作中可能會有用。" -#: ../../library/stdtypes.rst:656 +#: ../../library/stdtypes.rst:679 msgid "" "Return a representation of a floating-point number as a hexadecimal string. " "For finite floating-point numbers, this representation will always include a " @@ -1153,7 +1188,7 @@ msgstr "" "回傳浮點數的十六進位字串表示。對於有限浮點數,此表示方式總是包含一個前導 " "``0x`` 及一個尾部 ``p`` 和指數。" -#: ../../library/stdtypes.rst:664 +#: ../../library/stdtypes.rst:687 msgid "" "Class method to return the float represented by a hexadecimal string *s*. " "The string *s* may have leading and trailing whitespace." @@ -1161,23 +1196,23 @@ msgstr "" "Class method 回傳由十六進位字串 *s* 表示的浮點數。字串 *s* 可能有前導及尾部的" "空白。" -#: ../../library/stdtypes.rst:669 +#: ../../library/stdtypes.rst:692 msgid "" -"Note that :meth:`float.hex` is an instance method, while :meth:`float." -"fromhex` is a class method." +"Note that :meth:`float.hex` is an instance method, " +"while :meth:`float.fromhex` is a class method." msgstr "" "請注意 :meth:`float.hex` 是一個實例 method,而 :meth:`float.fromhex` 是一個 " "class method。" -#: ../../library/stdtypes.rst:672 +#: ../../library/stdtypes.rst:695 msgid "A hexadecimal string takes the form::" msgstr "一個十六進位字串的形式如下: ::" -#: ../../library/stdtypes.rst:674 +#: ../../library/stdtypes.rst:697 msgid "[sign] ['0x'] integer ['.' fraction] ['p' exponent]" msgstr "[sign] ['0x'] integer ['.' fraction] ['p' exponent]" -#: ../../library/stdtypes.rst:676 +#: ../../library/stdtypes.rst:699 msgid "" "where the optional ``sign`` may by either ``+`` or ``-``, ``integer`` and " "``fraction`` are strings of hexadecimal digits, and ``exponent`` is a " @@ -1193,12 +1228,12 @@ msgstr "" "其中可選的 ``sign`` 可以是 ``+`` 或 ``-``,``integer`` 和 ``fraction`` 是十六" "進位數字的字串,而 ``exponent`` 是一個十進位整數並且有一個可選的前導符號。大" "小寫不重要,並且整數或小數部分至少有一個十六進位數字。這個語法與 C99 標準的" -"第 6.4.4.2 節指定的語法相似,也與 Java 1.5 以後的語法相似。特別是 :meth:" -"`float.hex` 的輸出可用作 C 或 Java 程式碼中的十六進位浮點數文字,並且 C 的 " -"``%a`` 格式字元或 Java 的 ``Double.toHexString`` 產生的十六進位字串可被 :" -"meth:`float.fromhex` 接受。" +"第 6.4.4.2 節指定的語法相似,也與 Java 1.5 以後的語法相似。特別" +"是 :meth:`float.hex` 的輸出可用作 C 或 Java 程式碼中的十六進位浮點數文字,並" +"且 C 的 ``%a`` 格式字元或 Java 的 ``Double.toHexString`` 產生的十六進位字串可" +"被 :meth:`float.fromhex` 接受。" -#: ../../library/stdtypes.rst:689 +#: ../../library/stdtypes.rst:712 msgid "" "Note that the exponent is written in decimal rather than hexadecimal, and " "that it gives the power of 2 by which to multiply the coefficient. For " @@ -1209,7 +1244,7 @@ msgstr "" "十六進位字串 ``0x3.a7p10`` 表示浮點數 ``(3 + 10./16 + 7./16**2) * 2.0**10``," "或 ``3740.0``: ::" -#: ../../library/stdtypes.rst:695 +#: ../../library/stdtypes.rst:718 msgid "" ">>> float.fromhex('0x3.a7p10')\n" "3740.0" @@ -1217,14 +1252,14 @@ msgstr "" ">>> float.fromhex('0x3.a7p10')\n" "3740.0" -#: ../../library/stdtypes.rst:699 +#: ../../library/stdtypes.rst:722 msgid "" "Applying the reverse conversion to ``3740.0`` gives a different hexadecimal " "string representing the same number::" msgstr "" "對 ``3740.0`` 應用反向轉換會給出一個不同的十六進位字串,它表示相同的數字: ::" -#: ../../library/stdtypes.rst:702 +#: ../../library/stdtypes.rst:725 msgid "" ">>> float.hex(3740.0)\n" "'0x1.d380000000000p+11'" @@ -1232,36 +1267,65 @@ msgstr "" ">>> float.hex(3740.0)\n" "'0x1.d380000000000p+11'" -#: ../../library/stdtypes.rst:709 +#: ../../library/stdtypes.rst:730 +#, fuzzy +msgid "Additional Methods on Complex" +msgstr "浮點數的附加 methods" + +#: ../../library/stdtypes.rst:732 +#, fuzzy +msgid "" +"The :class:`!complex` type implements " +"the :class:`numbers.Complex` :term:`abstract base class`. :class:`!complex` " +"also has the following additional methods." +msgstr "" +"浮點數型別實作了 :class:`numbers.Real` :term:`抽象基底類別 `。浮點數也有下列附加 methods。" + +#: ../../library/stdtypes.rst:738 +msgid "Class method to convert a number to a complex number." +msgstr "" + +#: ../../library/stdtypes.rst:740 +msgid "" +"For a general Python object ``x``, ``complex.from_number(x)`` delegates to " +"``x.__complex__()``. If :meth:`~object.__complex__` is not defined then it " +"falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " +"defined then it falls back to :meth:`~object.__index__`." +msgstr "" + +#: ../../library/stdtypes.rst:751 msgid "Hashing of numeric types" msgstr "數值型別的雜湊" -#: ../../library/stdtypes.rst:711 +#: ../../library/stdtypes.rst:753 msgid "" "For numbers ``x`` and ``y``, possibly of different types, it's a requirement " -"that ``hash(x) == hash(y)`` whenever ``x == y`` (see the :meth:`~object." -"__hash__` method documentation for more details). For ease of " -"implementation and efficiency across a variety of numeric types (including :" -"class:`int`, :class:`float`, :class:`decimal.Decimal` and :class:`fractions." -"Fraction`) Python's hash for numeric types is based on a single mathematical " -"function that's defined for any rational number, and hence applies to all " -"instances of :class:`int` and :class:`fractions.Fraction`, and all finite " -"instances of :class:`float` and :class:`decimal.Decimal`. Essentially, this " -"function is given by reduction modulo ``P`` for a fixed prime ``P``. The " -"value of ``P`` is made available to Python as the :attr:`~sys.hash_info." -"modulus` attribute of :data:`sys.hash_info`." +"that ``hash(x) == hash(y)`` whenever ``x == y`` (see " +"the :meth:`~object.__hash__` method documentation for more details). For " +"ease of implementation and efficiency across a variety of numeric types " +"(including :class:`int`, :class:`float`, :class:`decimal.Decimal` " +"and :class:`fractions.Fraction`) Python's hash for numeric types is based on " +"a single mathematical function that's defined for any rational number, and " +"hence applies to all instances of :class:`int` " +"and :class:`fractions.Fraction`, and all finite instances of :class:`float` " +"and :class:`decimal.Decimal`. Essentially, this function is given by " +"reduction modulo ``P`` for a fixed prime ``P``. The value of ``P`` is made " +"available to Python as the :attr:`~sys.hash_info.modulus` attribute " +"of :data:`sys.hash_info`." msgstr "" "對於數字 ``x`` 和 ``y``,可能是不同型別,當 ``x == y`` 時,``hash(x) == " "hash(y)`` 是一個要求( 詳見 :meth:`~object.__hash__` method 的文件以獲得更多" -"細節)。為了實作的便利性和效率跨越各種數值型別(包括 :class:`int`、:class:" -"`float`、:class:`decimal.Decimal` 和 :class:`fractions.Fraction`)Python 的數" -"值型別的雜湊是基於一個數學函式,它對於任何有理數都是定義的,因此適用於所有 :" -"class:`int` 和 :class:`fractions.Fraction` 的實例,以及所有有限的 :class:" -"`float` 和 :class:`decimal.Decimal` 的實例。基本上,這個函式是由簡化的 modulo" -"(模數) ``P`` 給出的一個固定的質數 ``P``。``P`` 的值作為 :data:`sys." -"hash_info` 的 :attr:`~sys.hash_info.modulus` 屬性提供給 Python。" +"細節)。為了實作的便利性和效率跨越各種數值型別(包" +"括 :class:`int`、:class:`float`、:class:`decimal.Decimal` " +"和 :class:`fractions.Fraction`)Python 的數值型別的雜湊是基於一個數學函式,它" +"對於任何有理數都是定義的,因此適用於所有 :class:`int` " +"和 :class:`fractions.Fraction` 的實例,以及所有有限的 :class:`float` " +"和 :class:`decimal.Decimal` 的實例。基本上,這個函式是由簡化的 modulo(模" +"數) ``P`` 給出的一個固定的質數 ``P``。``P`` 的值作為 :data:`sys.hash_info` " +"的 :attr:`~sys.hash_info.modulus` 屬性提供給 Python。" -#: ../../library/stdtypes.rst:726 +#: ../../library/stdtypes.rst:768 msgid "" "Currently, the prime used is ``P = 2**31 - 1`` on machines with 32-bit C " "longs and ``P = 2**61 - 1`` on machines with 64-bit C longs." @@ -1269,11 +1333,11 @@ msgstr "" "目前在具有 32 位元 C longs 的機器上所使用的質數是 ``P = 2**31 - 1``,而在具" "有 64 位元 C longs 的機器上為 ``P = 2**61 - 1`` 。" -#: ../../library/stdtypes.rst:729 +#: ../../library/stdtypes.rst:771 msgid "Here are the rules in detail:" msgstr "以下是詳細的規則:" -#: ../../library/stdtypes.rst:731 +#: ../../library/stdtypes.rst:773 msgid "" "If ``x = m / n`` is a nonnegative rational number and ``n`` is not divisible " "by ``P``, define ``hash(x)`` as ``m * invmod(n, P) % P``, where ``invmod(n, " @@ -1283,7 +1347,7 @@ msgstr "" "``hash(x)`` 定義為 ``m * invmod(n, P) % P``。其中 ``invmod(n, P)`` 為 ``n`` " "對模數 ``P`` 的倒數。" -#: ../../library/stdtypes.rst:735 +#: ../../library/stdtypes.rst:777 msgid "" "If ``x = m / n`` is a nonnegative rational number and ``n`` is divisible by " "``P`` (but ``m`` is not) then ``n`` has no inverse modulo ``P`` and the rule " @@ -1294,7 +1358,7 @@ msgstr "" "不行),則 ``n`` 沒有 inverse modulo(模倒數) ``P`` ,並且不適用於上述規則;" "在這種情況下,將 ``hash(x)`` 定義為常數值 ``sys.hash_info.inf``。" -#: ../../library/stdtypes.rst:740 +#: ../../library/stdtypes.rst:782 msgid "" "If ``x = m / n`` is a negative rational number define ``hash(x)`` as ``-" "hash(-x)``. If the resulting hash is ``-1``, replace it with ``-2``." @@ -1302,7 +1366,7 @@ msgstr "" "如果 ``x = m / n`` 是一個負的有理數,則將 ``hash(x)`` 定義為 ``-hash(-x)``。" "如果結果的雜湊是 ``-1``,則將其替換為 ``-2``。" -#: ../../library/stdtypes.rst:744 +#: ../../library/stdtypes.rst:786 msgid "" "The particular values ``sys.hash_info.inf`` and ``-sys.hash_info.inf`` are " "used as hash values for positive infinity or negative infinity " @@ -1311,29 +1375,31 @@ msgstr "" "特定值 ``sys.hash_info.inf`` 和 ``-sys.hash_info.inf`` (分別)被用作正無窮大" "或負無窮大的雜湊值。" -#: ../../library/stdtypes.rst:748 +#: ../../library/stdtypes.rst:790 msgid "" "For a :class:`complex` number ``z``, the hash values of the real and " -"imaginary parts are combined by computing ``hash(z.real) + sys.hash_info." -"imag * hash(z.imag)``, reduced modulo ``2**sys.hash_info.width`` so that it " -"lies in ``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - " -"1))``. Again, if the result is ``-1``, it's replaced with ``-2``." +"imaginary parts are combined by computing ``hash(z.real) + " +"sys.hash_info.imag * hash(z.imag)``, reduced modulo " +"``2**sys.hash_info.width`` so that it lies in " +"``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - 1))``. " +"Again, if the result is ``-1``, it's replaced with ``-2``." msgstr "" "對於一個 :class:`complex` 值 ``z``,實部和虛部的雜湊值藉由 ``hash(z.real) + " -"sys.hash_info.imag * hash(z.imag)`` 的計算進行組合,對 ``2**sys.hash_info." -"width`` 取模數使其介於 ``range(-2**(sys.hash_info.width - 1), 2**(sys." -"hash_info.width - 1))``。同樣地,如果結果是 ``-1``,則將其替換為 ``-2``。" +"sys.hash_info.imag * hash(z.imag)`` 的計算進行組合,對 " +"``2**sys.hash_info.width`` 取模數使其介於 ``range(-2**(sys.hash_info.width - " +"1), 2**(sys.hash_info.width - 1))``。同樣地,如果結果是 ``-1``,則將其替換為 " +"``-2``。" -#: ../../library/stdtypes.rst:756 +#: ../../library/stdtypes.rst:798 msgid "" "To clarify the above rules, here's some example Python code, equivalent to " -"the built-in hash, for computing the hash of a rational number, :class:" -"`float`, or :class:`complex`::" +"the built-in hash, for computing the hash of a rational " +"number, :class:`float`, or :class:`complex`::" msgstr "" "為了闡明上述規則,這裡有一些 Python 程式碼範例,等同於內建的雜湊,用於計算有" "理數、:class:`float` 或 :class:`complex` 的雜湊: ::" -#: ../../library/stdtypes.rst:761 +#: ../../library/stdtypes.rst:803 msgid "" "import sys, math\n" "\n" @@ -1375,8 +1441,8 @@ msgid "" "def hash_complex(z):\n" " \"\"\"Compute the hash of a complex number z.\"\"\"\n" "\n" -" hash_value = hash_float(z.real) + sys.hash_info.imag * hash_float(z." -"imag)\n" +" hash_value = hash_float(z.real) + sys.hash_info.imag * " +"hash_float(z.imag)\n" " # do a signed reduction modulo 2**sys.hash_info.width\n" " M = 2**(sys.hash_info.width - 1)\n" " hash_value = (hash_value & (M - 1)) - (hash_value & M)\n" @@ -1385,11 +1451,11 @@ msgid "" " return hash_value" msgstr "" -#: ../../library/stdtypes.rst:812 +#: ../../library/stdtypes.rst:854 msgid "Boolean Type - :class:`bool`" msgstr "Boolean 型別 - :class:`bool`" -#: ../../library/stdtypes.rst:814 +#: ../../library/stdtypes.rst:856 msgid "" "Booleans represent truth values. The :class:`bool` type has exactly two " "constant instances: ``True`` and ``False``." @@ -1397,7 +1463,7 @@ msgstr "" "Boolean 值代表 truth values(真值)。:class:`bool` 型別有兩個常數實例:" "``True`` 和 ``False``。" -#: ../../library/stdtypes.rst:822 +#: ../../library/stdtypes.rst:864 msgid "" "The built-in function :func:`bool` converts any value to a boolean, if the " "value can be interpreted as a truth value (see section :ref:`truth` above)." @@ -1405,7 +1471,7 @@ msgstr "" "內建函式 :func:`bool` 將任何值轉換為 boolean 值,如果該值可以被直譯為一個 " "truth value(真值)(見上面的\\ :ref:`truth`\\ 章節)。" -#: ../../library/stdtypes.rst:825 +#: ../../library/stdtypes.rst:867 msgid "" "For logical operations, use the :ref:`boolean operators ` ``and``, " "``or`` and ``not``. When applying the bitwise operators ``&``, ``|``, ``^`` " @@ -1418,13 +1484,13 @@ msgstr "" "傳一個等同於邏輯運算 \"and\"、\"or\"、\"xor\" 的 boolean 值。然而,應該優先使" "用邏輯運算子 ``and``、``or`` 和 ``!=`` 而不是 ``&``、``|`` 和 ``^``。" -#: ../../library/stdtypes.rst:834 +#: ../../library/stdtypes.rst:876 msgid "" "The use of the bitwise inversion operator ``~`` is deprecated and will raise " "an error in Python 3.16." msgstr "位元反轉運算子 ``~`` 的使用已被棄用並且將在 Python 3.16 中引發錯誤。" -#: ../../library/stdtypes.rst:837 +#: ../../library/stdtypes.rst:879 msgid "" ":class:`bool` is a subclass of :class:`int` (see :ref:`typesnumeric`). In " "many numeric contexts, ``False`` and ``True`` behave like the integers 0 and " @@ -1435,11 +1501,11 @@ msgstr "" "值情境中,``False`` 和 ``True`` 分別像整數 0 和 1 一樣。然而,不鼓勵依賴這一" "點;請使用 :func:`int` 進行顯式轉換。" -#: ../../library/stdtypes.rst:845 +#: ../../library/stdtypes.rst:887 msgid "Iterator Types" msgstr "疊代器型別" -#: ../../library/stdtypes.rst:853 +#: ../../library/stdtypes.rst:895 msgid "" "Python supports a concept of iteration over containers. This is implemented " "using two distinct methods; these are used to allow user-defined classes to " @@ -1450,60 +1516,61 @@ msgstr "" "用者自定義的 classes 以支援疊代。序列則總是支援這些疊代 methods,在下方有更詳" "細的描述。" -#: ../../library/stdtypes.rst:858 +#: ../../library/stdtypes.rst:900 msgid "" -"One method needs to be defined for container objects to provide :term:" -"`iterable` support:" +"One method needs to be defined for container objects to " +"provide :term:`iterable` support:" msgstr "" "需要為容器物件定義一個 method 來提供\\ :term:`可疊代物件 `\\ 支援:" -#: ../../library/stdtypes.rst:865 +#: ../../library/stdtypes.rst:907 msgid "" "Return an :term:`iterator` object. The object is required to support the " "iterator protocol described below. If a container supports different types " "of iteration, additional methods can be provided to specifically request " "iterators for those iteration types. (An example of an object supporting " "multiple forms of iteration would be a tree structure which supports both " -"breadth-first and depth-first traversal.) This method corresponds to the :c:" -"member:`~PyTypeObject.tp_iter` slot of the type structure for Python objects " -"in the Python/C API." +"breadth-first and depth-first traversal.) This method corresponds to " +"the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python " +"objects in the Python/C API." msgstr "" "回傳一個\\ :term:`疊代器 `\\ 物件。該物件需要支援下述的疊代器協定。" "如果一個容器支援不同型別的疊代,則可以提供額外的 methods 來專門請求這些疊代型" "別的疊代器。(支援多種形式疊代的物件的一個例子是支援廣度優先和深度優先遍歷的" -"樹結構。)此 method 對應 Python/C API 中 Python 物件的型別結構的 :c:member:" -"`~PyTypeObject.tp_iter` 插槽。" +"樹結構。)此 method 對應 Python/C API 中 Python 物件的型別結構" +"的 :c:member:`~PyTypeObject.tp_iter` 插槽。" -#: ../../library/stdtypes.rst:874 +#: ../../library/stdtypes.rst:916 msgid "" "The iterator objects themselves are required to support the following two " "methods, which together form the :dfn:`iterator protocol`:" msgstr "" "疊代器物件本身需要支援下列兩個 methods,他們一起形成了 :dfn:`疊代器協定`:" -#: ../../library/stdtypes.rst:880 +#: ../../library/stdtypes.rst:922 msgid "" "Return the :term:`iterator` object itself. This is required to allow both " -"containers and iterators to be used with the :keyword:`for` and :keyword:" -"`in` statements. This method corresponds to the :c:member:`~PyTypeObject." -"tp_iter` slot of the type structure for Python objects in the Python/C API." +"containers and iterators to be used with the :keyword:`for` " +"and :keyword:`in` statements. This method corresponds to " +"the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python " +"objects in the Python/C API." msgstr "" "回傳\\ :term:`疊代器 `\\ 物件本身。這是為了允許容器和疊代器都可以" "與 :keyword:`for` 和 :keyword:`in` 在陳述式中使用。此 method 對應於 Python/C " "API 中 Python 物件的型別結構的 :c:member:`~PyTypeObject.tp_iter` 插槽。" -#: ../../library/stdtypes.rst:889 +#: ../../library/stdtypes.rst:931 msgid "" "Return the next item from the :term:`iterator`. If there are no further " "items, raise the :exc:`StopIteration` exception. This method corresponds to " "the :c:member:`~PyTypeObject.tp_iternext` slot of the type structure for " "Python objects in the Python/C API." msgstr "" -"從\\ :term:`疊代器 `\\ 回傳下一個項目。如果沒有更多項目,則引發 :" -"exc:`StopIteration` 例外。此 method 對應於 Python/C API 中Python 物件的型別結" -"構的 :c:member:`~PyTypeObject.tp_iternext` 插槽。" +"從\\ :term:`疊代器 `\\ 回傳下一個項目。如果沒有更多項目,則引" +"發 :exc:`StopIteration` 例外。此 method 對應於 Python/C API 中Python 物件的型" +"別結構的 :c:member:`~PyTypeObject.tp_iternext` 插槽。" -#: ../../library/stdtypes.rst:894 +#: ../../library/stdtypes.rst:936 msgid "" "Python defines several iterator objects to support iteration over general " "and specific sequence types, dictionaries, and other more specialized " @@ -1513,35 +1580,35 @@ msgstr "" "Python 定義了幾個疊代器物件來支援對一般和特定序列型別、字典和其他更專門的形式" "的疊代。這些特定型別除了實作疊代器協定外並不重要。" -#: ../../library/stdtypes.rst:899 +#: ../../library/stdtypes.rst:941 msgid "" -"Once an iterator's :meth:`~iterator.__next__` method raises :exc:" -"`StopIteration`, it must continue to do so on subsequent calls. " +"Once an iterator's :meth:`~iterator.__next__` method " +"raises :exc:`StopIteration`, it must continue to do so on subsequent calls. " "Implementations that do not obey this property are deemed broken." msgstr "" "一旦疊代器的 :meth:`~iterator.__next__` method 引發 :exc:`StopIteration`,則" "它必須在後續呼叫中繼續這樣做。不遵守此屬性的實作被認為是有問題的。" -#: ../../library/stdtypes.rst:907 +#: ../../library/stdtypes.rst:949 msgid "Generator Types" msgstr "" -#: ../../library/stdtypes.rst:909 +#: ../../library/stdtypes.rst:951 msgid "" "Python's :term:`generator`\\s provide a convenient way to implement the " "iterator protocol. If a container object's :meth:`~object.__iter__` method " "is implemented as a generator, it will automatically return an iterator " -"object (technically, a generator object) supplying the :meth:`~iterator." -"__iter__` and :meth:`~generator.__next__` methods. More information about " -"generators can be found in :ref:`the documentation for the yield expression " -"`." +"object (technically, a generator object) supplying " +"the :meth:`~iterator.__iter__` and :meth:`~generator.__next__` methods. More " +"information about generators can be found in :ref:`the documentation for the " +"yield expression `." msgstr "" -#: ../../library/stdtypes.rst:921 +#: ../../library/stdtypes.rst:963 msgid "Sequence Types --- :class:`list`, :class:`tuple`, :class:`range`" msgstr "" -#: ../../library/stdtypes.rst:923 +#: ../../library/stdtypes.rst:965 msgid "" "There are three basic sequence types: lists, tuples, and range objects. " "Additional sequence types tailored for processing of :ref:`binary data " @@ -1549,11 +1616,11 @@ msgid "" "sections." msgstr "" -#: ../../library/stdtypes.rst:932 +#: ../../library/stdtypes.rst:974 msgid "Common Sequence Operations" msgstr "" -#: ../../library/stdtypes.rst:936 +#: ../../library/stdtypes.rst:978 msgid "" "The operations in the following table are supported by most sequence types, " "both mutable and immutable. The :class:`collections.abc.Sequence` ABC is " @@ -1561,7 +1628,7 @@ msgid "" "sequence types." msgstr "" -#: ../../library/stdtypes.rst:941 +#: ../../library/stdtypes.rst:983 msgid "" "This table lists the sequence operations sorted in ascending priority. In " "the table, *s* and *t* are sequences of the same type, *n*, *i*, *j* and *k* " @@ -1569,7 +1636,7 @@ msgid "" "restrictions imposed by *s*." msgstr "" -#: ../../library/stdtypes.rst:946 +#: ../../library/stdtypes.rst:988 msgid "" "The ``in`` and ``not in`` operations have the same priorities as the " "comparison operations. The ``+`` (concatenation) and ``*`` (repetition) " @@ -1577,129 +1644,108 @@ msgid "" "[3]_" msgstr "" -#: ../../library/stdtypes.rst:967 +#: ../../library/stdtypes.rst:1007 msgid "``x in s``" msgstr "``x in s``" -#: ../../library/stdtypes.rst:967 +#: ../../library/stdtypes.rst:1007 msgid "``True`` if an item of *s* is equal to *x*, else ``False``" msgstr "如果 *s* 的一個項目等於 *x* 則為 ``True``,否則為 ``False``" -#: ../../library/stdtypes.rst:970 +#: ../../library/stdtypes.rst:1010 msgid "``x not in s``" msgstr "``x not in s``" -#: ../../library/stdtypes.rst:970 +#: ../../library/stdtypes.rst:1010 msgid "``False`` if an item of *s* is equal to *x*, else ``True``" msgstr "如果 *s* 的一個項目等於 *x* 則為 ``False``,否則為 ``True``" -#: ../../library/stdtypes.rst:973 +#: ../../library/stdtypes.rst:1013 msgid "``s + t``" msgstr "``s + t``" -#: ../../library/stdtypes.rst:973 +#: ../../library/stdtypes.rst:1013 msgid "the concatenation of *s* and *t*" msgstr "*s* 和 *t* 的串接" -#: ../../library/stdtypes.rst:973 +#: ../../library/stdtypes.rst:1013 msgid "(6)(7)" msgstr "(6)(7)" -#: ../../library/stdtypes.rst:976 +#: ../../library/stdtypes.rst:1016 msgid "``s * n`` or ``n * s``" msgstr "``s * n`` 或 ``n * s``" -#: ../../library/stdtypes.rst:976 +#: ../../library/stdtypes.rst:1016 msgid "equivalent to adding *s* to itself *n* times" msgstr "等同於將 *s* 加到自己 *n* 次" -#: ../../library/stdtypes.rst:976 +#: ../../library/stdtypes.rst:1016 msgid "(2)(7)" msgstr "(2)(7)" -#: ../../library/stdtypes.rst:979 +#: ../../library/stdtypes.rst:1019 msgid "``s[i]``" msgstr "``s[i]``" -#: ../../library/stdtypes.rst:979 +#: ../../library/stdtypes.rst:1019 msgid "*i*\\ th item of *s*, origin 0" msgstr "*s* 的第 *i* 項,起始為 0" -#: ../../library/stdtypes.rst:979 -msgid "(3)(9)" +#: ../../library/stdtypes.rst:1019 +#, fuzzy +msgid "(3)(8)" msgstr "(3)(9)" -#: ../../library/stdtypes.rst:981 +#: ../../library/stdtypes.rst:1021 msgid "``s[i:j]``" msgstr "``s[i:j]``" -#: ../../library/stdtypes.rst:981 +#: ../../library/stdtypes.rst:1021 msgid "slice of *s* from *i* to *j*" msgstr "" -#: ../../library/stdtypes.rst:981 +#: ../../library/stdtypes.rst:1021 msgid "(3)(4)" msgstr "(3)(4)" -#: ../../library/stdtypes.rst:983 +#: ../../library/stdtypes.rst:1023 msgid "``s[i:j:k]``" msgstr "``s[i:j:k]``" -#: ../../library/stdtypes.rst:983 +#: ../../library/stdtypes.rst:1023 msgid "slice of *s* from *i* to *j* with step *k*" msgstr "" -#: ../../library/stdtypes.rst:983 +#: ../../library/stdtypes.rst:1023 msgid "(3)(5)" msgstr "(3)(5)" -#: ../../library/stdtypes.rst:986 +#: ../../library/stdtypes.rst:1026 msgid "``len(s)``" msgstr "``len(s)``" -#: ../../library/stdtypes.rst:986 +#: ../../library/stdtypes.rst:1026 msgid "length of *s*" msgstr "*s* 的長度" -#: ../../library/stdtypes.rst:988 +#: ../../library/stdtypes.rst:1028 msgid "``min(s)``" msgstr "``min(s)``" -#: ../../library/stdtypes.rst:988 +#: ../../library/stdtypes.rst:1028 msgid "smallest item of *s*" msgstr "*s* 中最小的項目" -#: ../../library/stdtypes.rst:990 +#: ../../library/stdtypes.rst:1030 msgid "``max(s)``" msgstr "``max(s)``" -#: ../../library/stdtypes.rst:990 +#: ../../library/stdtypes.rst:1030 msgid "largest item of *s*" msgstr "*s* 中最大的項目" -#: ../../library/stdtypes.rst:992 -msgid "``s.index(x[, i[, j]])``" -msgstr "``s.index(x[, i[, j]])``" - -#: ../../library/stdtypes.rst:992 -msgid "" -"index of the first occurrence of *x* in *s* (at or after index *i* and " -"before index *j*)" -msgstr "" - -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3875 -msgid "\\(8)" -msgstr "\\(8)" - -#: ../../library/stdtypes.rst:996 -msgid "``s.count(x)``" -msgstr "``s.count(x)``" - -#: ../../library/stdtypes.rst:996 -msgid "total number of occurrences of *x* in *s*" -msgstr "*s* 中 *x* 的總出現次數" - -#: ../../library/stdtypes.rst:1000 +#: ../../library/stdtypes.rst:1033 msgid "" "Sequences of the same type also support comparisons. In particular, tuples " "and lists are compared lexicographically by comparing corresponding " @@ -1708,16 +1754,16 @@ msgid "" "(For full details see :ref:`comparisons` in the language reference.)" msgstr "" -#: ../../library/stdtypes.rst:1010 +#: ../../library/stdtypes.rst:1043 msgid "" "Forward and reversed iterators over mutable sequences access values using an " "index. That index will continue to march forward (or backward) even if the " -"underlying sequence is mutated. The iterator terminates only when an :exc:" -"`IndexError` or a :exc:`StopIteration` is encountered (or when the index " -"drops below zero)." +"underlying sequence is mutated. The iterator terminates only when " +"an :exc:`IndexError` or a :exc:`StopIteration` is encountered (or when the " +"index drops below zero)." msgstr "" -#: ../../library/stdtypes.rst:1019 +#: ../../library/stdtypes.rst:1052 msgid "" "While the ``in`` and ``not in`` operations are used only for simple " "containment testing in the general case, some specialised sequences (such " @@ -1725,7 +1771,7 @@ msgid "" "subsequence testing::" msgstr "" -#: ../../library/stdtypes.rst:1024 +#: ../../library/stdtypes.rst:1057 msgid "" ">>> \"gg\" in \"eggs\"\n" "True" @@ -1733,7 +1779,7 @@ msgstr "" ">>> \"gg\" in \"eggs\"\n" "True" -#: ../../library/stdtypes.rst:1028 +#: ../../library/stdtypes.rst:1061 msgid "" "Values of *n* less than ``0`` are treated as ``0`` (which yields an empty " "sequence of the same type as *s*). Note that items in the sequence *s* are " @@ -1741,7 +1787,7 @@ msgid "" "Python programmers; consider::" msgstr "" -#: ../../library/stdtypes.rst:1033 +#: ../../library/stdtypes.rst:1066 msgid "" ">>> lists = [[]] * 3\n" ">>> lists\n" @@ -1757,7 +1803,7 @@ msgstr "" ">>> lists\n" "[[3], [3], [3]]" -#: ../../library/stdtypes.rst:1040 +#: ../../library/stdtypes.rst:1073 msgid "" "What has happened is that ``[[]]`` is a one-element list containing an empty " "list, so all three elements of ``[[]] * 3`` are references to this single " @@ -1765,7 +1811,7 @@ msgid "" "list. You can create a list of different lists this way::" msgstr "" -#: ../../library/stdtypes.rst:1045 +#: ../../library/stdtypes.rst:1078 msgid "" ">>> lists = [[] for i in range(3)]\n" ">>> lists[0].append(3)\n" @@ -1781,20 +1827,20 @@ msgstr "" ">>> lists\n" "[[3], [5], [7]]" -#: ../../library/stdtypes.rst:1052 +#: ../../library/stdtypes.rst:1085 msgid "" "Further explanation is available in the FAQ entry :ref:`faq-multidimensional-" "list`." msgstr "" -#: ../../library/stdtypes.rst:1056 +#: ../../library/stdtypes.rst:1089 msgid "" "If *i* or *j* is negative, the index is relative to the end of sequence *s*: " "``len(s) + i`` or ``len(s) + j`` is substituted. But note that ``-0`` is " "still ``0``." msgstr "" -#: ../../library/stdtypes.rst:1061 +#: ../../library/stdtypes.rst:1094 msgid "" "The slice of *s* from *i* to *j* is defined as the sequence of items with " "index *k* such that ``i <= k < j``. If *i* or *j* is greater than " @@ -1803,7 +1849,7 @@ msgid "" "to *j*, the slice is empty." msgstr "" -#: ../../library/stdtypes.rst:1068 +#: ../../library/stdtypes.rst:1101 msgid "" "The slice of *s* from *i* to *j* with step *k* is defined as the sequence of " "items with index ``x = i + n*k`` such that ``0 <= n < (j-i)/k``. In other " @@ -1816,7 +1862,7 @@ msgid "" "``None``, it is treated like ``1``." msgstr "" -#: ../../library/stdtypes.rst:1079 +#: ../../library/stdtypes.rst:1112 msgid "" "Concatenating immutable sequences always results in a new object. This " "means that building up a sequence by repeated concatenation will have a " @@ -1824,86 +1870,112 @@ msgid "" "runtime cost, you must switch to one of the alternatives below:" msgstr "" -#: ../../library/stdtypes.rst:1084 +#: ../../library/stdtypes.rst:1117 msgid "" -"if concatenating :class:`str` objects, you can build a list and use :meth:" -"`str.join` at the end or else write to an :class:`io.StringIO` instance and " -"retrieve its value when complete" +"if concatenating :class:`str` objects, you can build a list and " +"use :meth:`str.join` at the end or else write to an :class:`io.StringIO` " +"instance and retrieve its value when complete" msgstr "" -#: ../../library/stdtypes.rst:1088 +#: ../../library/stdtypes.rst:1121 msgid "" -"if concatenating :class:`bytes` objects, you can similarly use :meth:`bytes." -"join` or :class:`io.BytesIO`, or you can do in-place concatenation with a :" -"class:`bytearray` object. :class:`bytearray` objects are mutable and have " -"an efficient overallocation mechanism" +"if concatenating :class:`bytes` objects, you can similarly " +"use :meth:`bytes.join` or :class:`io.BytesIO`, or you can do in-place " +"concatenation with a :class:`bytearray` object. :class:`bytearray` objects " +"are mutable and have an efficient overallocation mechanism" msgstr "" -#: ../../library/stdtypes.rst:1093 +#: ../../library/stdtypes.rst:1126 msgid "if concatenating :class:`tuple` objects, extend a :class:`list` instead" msgstr "" -#: ../../library/stdtypes.rst:1095 +#: ../../library/stdtypes.rst:1128 msgid "for other types, investigate the relevant class documentation" msgstr "" -#: ../../library/stdtypes.rst:1099 +#: ../../library/stdtypes.rst:1132 msgid "" "Some sequence types (such as :class:`range`) only support item sequences " "that follow specific patterns, and hence don't support sequence " "concatenation or repetition." msgstr "" -#: ../../library/stdtypes.rst:1104 +#: ../../library/stdtypes.rst:1137 +msgid "An :exc:`IndexError` is raised if *i* is outside the sequence range." +msgstr "" + +#: ../../library/stdtypes.rst:1140 +#, fuzzy +msgid "Sequence Methods" +msgstr "pop()(序列方法)" + +#: ../../library/stdtypes.rst:1141 +msgid "Sequence types also support the following methods:" +msgstr "" + +#: ../../library/stdtypes.rst:1151 +#, fuzzy +msgid "Return the total number of occurrences of *value* in *sequence*." +msgstr "*s* 中 *x* 的總出現次數" + +#: ../../library/stdtypes.rst:1161 +msgid "Return the index of the first occurrence of *value* in *sequence*." +msgstr "" + +#: ../../library/stdtypes.rst:1163 ../../library/stdtypes.rst:1347 +#, fuzzy +msgid "Raises :exc:`ValueError` if *value* is not found in *sequence*." +msgstr "在 *x* 不在 *s* 中時 :meth:`remove` 會引發 :exc:`ValueError`。" + +#: ../../library/stdtypes.rst:1165 msgid "" -"``index`` raises :exc:`ValueError` when *x* is not found in *s*. Not all " -"implementations support passing the additional arguments *i* and *j*. These " -"arguments allow efficient searching of subsections of the sequence. Passing " -"the extra arguments is roughly equivalent to using ``s[i:j].index(x)``, only " -"without copying any data and with the returned index being relative to the " -"start of the sequence rather than the start of the slice." +"The *start* or *stop* arguments allow for efficient searching of subsections " +"of the sequence, beginning at *start* and ending at *stop*. This is roughly " +"equivalent to ``start + sequence[start:stop].index(value)``, only without " +"copying any data." msgstr "" -#: ../../library/stdtypes.rst:1112 -msgid "An :exc:`IndexError` is raised if *i* is outside the sequence range." +#: ../../library/stdtypes.rst:1171 +msgid "" +"Not all sequence types support passing the *start* and *stop* arguments." msgstr "" -#: ../../library/stdtypes.rst:1118 +#: ../../library/stdtypes.rst:1177 msgid "Immutable Sequence Types" msgstr "" -#: ../../library/stdtypes.rst:1125 +#: ../../library/stdtypes.rst:1184 msgid "" "The only operation that immutable sequence types generally implement that is " -"not also implemented by mutable sequence types is support for the :func:" -"`hash` built-in." +"not also implemented by mutable sequence types is support for " +"the :func:`hash` built-in." msgstr "" -#: ../../library/stdtypes.rst:1129 +#: ../../library/stdtypes.rst:1188 msgid "" "This support allows immutable sequences, such as :class:`tuple` instances, " -"to be used as :class:`dict` keys and stored in :class:`set` and :class:" -"`frozenset` instances." +"to be used as :class:`dict` keys and stored in :class:`set` " +"and :class:`frozenset` instances." msgstr "" -#: ../../library/stdtypes.rst:1133 +#: ../../library/stdtypes.rst:1192 msgid "" "Attempting to hash an immutable sequence that contains unhashable values " "will result in :exc:`TypeError`." msgstr "" -#: ../../library/stdtypes.rst:1140 +#: ../../library/stdtypes.rst:1199 msgid "Mutable Sequence Types" msgstr "" -#: ../../library/stdtypes.rst:1147 +#: ../../library/stdtypes.rst:1206 msgid "" "The operations in the following table are defined on mutable sequence types. " "The :class:`collections.abc.MutableSequence` ABC is provided to make it " "easier to correctly implement these operations on custom sequence types." msgstr "" -#: ../../library/stdtypes.rst:1151 +#: ../../library/stdtypes.rst:1210 msgid "" "In the table *s* is an instance of a mutable sequence type, *t* is any " "iterable object and *x* is an arbitrary object that meets any type and value " @@ -1911,209 +1983,188 @@ msgid "" "integers that meet the value restriction ``0 <= x <= 255``)." msgstr "" -#: ../../library/stdtypes.rst:1175 +#: ../../library/stdtypes.rst:1226 msgid "``s[i] = x``" msgstr "``s[i] = x``" -#: ../../library/stdtypes.rst:1175 +#: ../../library/stdtypes.rst:1226 msgid "item *i* of *s* is replaced by *x*" msgstr "" -#: ../../library/stdtypes.rst:1178 +#: ../../library/stdtypes.rst:1229 msgid "``del s[i]``" msgstr "``del s[i]``" -#: ../../library/stdtypes.rst:1178 +#: ../../library/stdtypes.rst:1229 msgid "removes item *i* of *s*" msgstr "移除 *s* 中的項目 *i*" -#: ../../library/stdtypes.rst:1180 +#: ../../library/stdtypes.rst:1231 msgid "``s[i:j] = t``" msgstr "``s[i:j] = t``" -#: ../../library/stdtypes.rst:1180 +#: ../../library/stdtypes.rst:1231 msgid "" "slice of *s* from *i* to *j* is replaced by the contents of the iterable *t*" msgstr "" -#: ../../library/stdtypes.rst:1184 +#: ../../library/stdtypes.rst:1235 msgid "``del s[i:j]``" msgstr "``del s[i:j]``" -#: ../../library/stdtypes.rst:1184 +#: ../../library/stdtypes.rst:1235 msgid "" "removes the elements of ``s[i:j]`` from the list (same as ``s[i:j] = []``)" msgstr "移除串列中 ``s[i:j]`` 的元素(和 ``s[i:j] = []`` 相同)" -#: ../../library/stdtypes.rst:1188 +#: ../../library/stdtypes.rst:1239 msgid "``s[i:j:k] = t``" msgstr "``s[i:j:k] = t``" -#: ../../library/stdtypes.rst:1188 +#: ../../library/stdtypes.rst:1239 msgid "the elements of ``s[i:j:k]`` are replaced by those of *t*" msgstr "``s[i:j:k]`` 的元素被 *t* 的元素取代" -#: ../../library/stdtypes.rst:1191 +#: ../../library/stdtypes.rst:1242 msgid "``del s[i:j:k]``" msgstr "``del s[i:j:k]``" -#: ../../library/stdtypes.rst:1191 +#: ../../library/stdtypes.rst:1242 msgid "removes the elements of ``s[i:j:k]`` from the list" msgstr "移除串列中 ``s[i:j:k]`` 的元素" -#: ../../library/stdtypes.rst:1194 -msgid "``s.append(x)``" -msgstr "``s.append(x)``" - -#: ../../library/stdtypes.rst:1194 -msgid "" -"appends *x* to the end of the sequence (same as ``s[len(s):len(s)] = [x]``)" -msgstr "" - -#: ../../library/stdtypes.rst:1198 -msgid "``s.clear()``" -msgstr "``s.clear()``" - -#: ../../library/stdtypes.rst:1198 -msgid "removes all items from *s* (same as ``del s[:]``)" -msgstr "移除 *s* 中的所有項目(和 ``del s[:]`` 相同)" - -#: ../../library/stdtypes.rst:1201 -msgid "``s.copy()``" -msgstr "``s.copy()``" - -#: ../../library/stdtypes.rst:1201 -msgid "creates a shallow copy of *s* (same as ``s[:]``)" -msgstr "建立 *s* 的淺層複製(和 ``s[:]`` 相同)" - -#: ../../library/stdtypes.rst:1204 -msgid "``s.extend(t)`` or ``s += t``" -msgstr "``s.extend(t)`` 或 ``s += t``" +#: ../../library/stdtypes.rst:1245 +#, fuzzy +msgid "``s += t``" +msgstr "``s + t``" -#: ../../library/stdtypes.rst:1204 +#: ../../library/stdtypes.rst:1245 msgid "" "extends *s* with the contents of *t* (for the most part the same as " "``s[len(s):len(s)] = t``)" msgstr "" -#: ../../library/stdtypes.rst:1209 +#: ../../library/stdtypes.rst:1250 msgid "``s *= n``" msgstr "``s *= n``" -#: ../../library/stdtypes.rst:1209 +#: ../../library/stdtypes.rst:1250 msgid "updates *s* with its contents repeated *n* times" msgstr "" -#: ../../library/stdtypes.rst:1212 -msgid "``s.insert(i, x)``" -msgstr "``s.insert(i, x)``" +#: ../../library/stdtypes.rst:1257 +msgid "" +"If *k* is not equal to ``1``, *t* must have the same length as the slice it " +"is replacing." +msgstr "" -#: ../../library/stdtypes.rst:1212 +#: ../../library/stdtypes.rst:1260 msgid "" -"inserts *x* into *s* at the index given by *i* (same as ``s[i:i] = [x]``)" +"The value *n* is an integer, or an object " +"implementing :meth:`~object.__index__`. Zero and negative values of *n* " +"clear the sequence. Items in the sequence are not copied; they are " +"referenced multiple times, as explained for ``s * n`` under :ref:`typesseq-" +"common`." msgstr "" -#: ../../library/stdtypes.rst:1216 -msgid "``s.pop()`` or ``s.pop(i)``" -msgstr "``s.pop()`` 或 ``s.pop(i)``" +#: ../../library/stdtypes.rst:1266 +#, fuzzy +msgid "Mutable Sequence Methods" +msgstr "mutable sequence(可變序列)" -#: ../../library/stdtypes.rst:1216 -msgid "retrieves the item at *i* and also removes it from *s*" +#: ../../library/stdtypes.rst:1267 +msgid "Mutable sequence types also support the following methods:" msgstr "" -#: ../../library/stdtypes.rst:1219 -msgid "``s.remove(x)``" -msgstr "``s.remove(x)``" - -#: ../../library/stdtypes.rst:1219 -msgid "removes the first item from *s* where ``s[i]`` is equal to *x*" +#: ../../library/stdtypes.rst:1276 +msgid "" +"Append *value* to the end of the sequence This is equivalent to writing " +"``seq[len(seq):len(seq)] = [value]``." msgstr "" -#: ../../library/stdtypes.rst:1223 -msgid "``s.reverse()``" -msgstr "``s.reverse()``" +#: ../../library/stdtypes.rst:1288 +#, fuzzy +msgid "" +"Remove all items from *sequence*. This is equivalent to writing ``del " +"sequence[:]``." +msgstr "移除 *s* 中的所有項目(和 ``del s[:]`` 相同)" -#: ../../library/stdtypes.rst:1223 -msgid "reverses the items of *s* in place" -msgstr "" +#: ../../library/stdtypes.rst:1300 +#, fuzzy +msgid "" +"Create a shallow copy of *sequence*. This is equivalent to writing " +"``sequence[:]``." +msgstr "建立 *s* 的淺層複製(和 ``s[:]`` 相同)" -#: ../../library/stdtypes.rst:1231 +#: ../../library/stdtypes.rst:1303 msgid "" -"If *k* is not equal to ``1``, *t* must have the same length as the slice it " -"is replacing." +"The :meth:`!copy` method is not part of " +"the :class:`~collections.abc.MutableSequence` :class:`~abc.ABC`, but most " +"concrete mutable sequence types provide it." msgstr "" -#: ../../library/stdtypes.rst:1234 +#: ../../library/stdtypes.rst:1314 msgid "" -"The optional argument *i* defaults to ``-1``, so that by default the last " -"item is removed and returned." +"Extend *sequence* with the contents of *iterable*. For the most part, this " +"is the same as writing ``seq[len(seq):len(seq)] = iterable``." msgstr "" -#: ../../library/stdtypes.rst:1238 -msgid ":meth:`remove` raises :exc:`ValueError` when *x* is not found in *s*." -msgstr "在 *x* 不在 *s* 中時 :meth:`remove` 會引發 :exc:`ValueError`。" - -#: ../../library/stdtypes.rst:1241 +#: ../../library/stdtypes.rst:1325 msgid "" -"The :meth:`reverse` method modifies the sequence in place for economy of " -"space when reversing a large sequence. To remind users that it operates by " -"side effect, it does not return the reversed sequence." +"Insert *value* into *sequence* at the given *index*. This is equivalent to " +"writing ``sequence[index:index] = [value]``." msgstr "" -#: ../../library/stdtypes.rst:1246 +#: ../../library/stdtypes.rst:1335 msgid "" -":meth:`clear` and :meth:`!copy` are included for consistency with the " -"interfaces of mutable containers that don't support slicing operations (such " -"as :class:`dict` and :class:`set`). :meth:`!copy` is not part of the :class:" -"`collections.abc.MutableSequence` ABC, but most concrete mutable sequence " -"classes provide it." +"Retrieve the item at *index* and also removes it from *sequence*. By " +"default, the last item in *sequence* is removed and returned." msgstr "" -#: ../../library/stdtypes.rst:1252 -msgid ":meth:`clear` and :meth:`!copy` methods." -msgstr ":meth:`clear` 和 :meth:`!copy` 方法。" +#: ../../library/stdtypes.rst:1345 +msgid "Remove the first item from *sequence* where ``sequence[i] == value``." +msgstr "" -#: ../../library/stdtypes.rst:1256 +#: ../../library/stdtypes.rst:1356 msgid "" -"The value *n* is an integer, or an object implementing :meth:`~object." -"__index__`. Zero and negative values of *n* clear the sequence. Items in " -"the sequence are not copied; they are referenced multiple times, as " -"explained for ``s * n`` under :ref:`typesseq-common`." +"Reverse the items of *sequence* in place. This method maintains economy of " +"space when reversing a large sequence. To remind users that it operates by " +"side-effect, it returns ``None``." msgstr "" -#: ../../library/stdtypes.rst:1265 +#: ../../library/stdtypes.rst:1364 msgid "Lists" msgstr "List(串列)" -#: ../../library/stdtypes.rst:1269 +#: ../../library/stdtypes.rst:1368 msgid "" "Lists are mutable sequences, typically used to store collections of " "homogeneous items (where the precise degree of similarity will vary by " "application)." msgstr "" -#: ../../library/stdtypes.rst:1275 +#: ../../library/stdtypes.rst:1374 msgid "Lists may be constructed in several ways:" msgstr "" -#: ../../library/stdtypes.rst:1277 +#: ../../library/stdtypes.rst:1376 msgid "Using a pair of square brackets to denote the empty list: ``[]``" msgstr "" -#: ../../library/stdtypes.rst:1278 +#: ../../library/stdtypes.rst:1377 msgid "" "Using square brackets, separating items with commas: ``[a]``, ``[a, b, c]``" msgstr "" -#: ../../library/stdtypes.rst:1279 +#: ../../library/stdtypes.rst:1378 msgid "Using a list comprehension: ``[x for x in iterable]``" msgstr "使用串列綜合運算式:``[x for x in iterable]``" -#: ../../library/stdtypes.rst:1280 +#: ../../library/stdtypes.rst:1379 msgid "Using the type constructor: ``list()`` or ``list(iterable)``" msgstr "使用型別建構函式:``list()`` 或 ``list(iterable)``" -#: ../../library/stdtypes.rst:1282 +#: ../../library/stdtypes.rst:1381 msgid "" "The constructor builds a list whose items are the same and in the same order " "as *iterable*'s items. *iterable* may be either a sequence, a container " @@ -2124,20 +2175,20 @@ msgid "" "new empty list, ``[]``." msgstr "" -#: ../../library/stdtypes.rst:1291 +#: ../../library/stdtypes.rst:1390 msgid "" "Many other operations also produce lists, including the :func:`sorted` built-" "in." msgstr "" -#: ../../library/stdtypes.rst:1294 +#: ../../library/stdtypes.rst:1393 msgid "" "Lists implement all of the :ref:`common ` and :ref:`mutable " "` sequence operations. Lists also provide the following " "additional method:" msgstr "" -#: ../../library/stdtypes.rst:1300 +#: ../../library/stdtypes.rst:1399 msgid "" "This method sorts the list in place, using only ``<`` comparisons between " "items. Exceptions are not suppressed - if any comparison operations fail, " @@ -2145,13 +2196,13 @@ msgid "" "partially modified state)." msgstr "" -#: ../../library/stdtypes.rst:1305 +#: ../../library/stdtypes.rst:1404 msgid "" -":meth:`sort` accepts two arguments that can only be passed by keyword (:ref:" -"`keyword-only arguments `):" +":meth:`sort` accepts two arguments that can only be passed by keyword " +"(:ref:`keyword-only arguments `):" msgstr "" -#: ../../library/stdtypes.rst:1308 +#: ../../library/stdtypes.rst:1407 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each list element (for example, ``key=str.lower``). The " @@ -2160,19 +2211,19 @@ msgid "" "list items are sorted directly without calculating a separate key value." msgstr "" -#: ../../library/stdtypes.rst:1315 +#: ../../library/stdtypes.rst:1414 msgid "" "The :func:`functools.cmp_to_key` utility is available to convert a 2.x style " "*cmp* function to a *key* function." msgstr "" -#: ../../library/stdtypes.rst:1318 +#: ../../library/stdtypes.rst:1417 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -#: ../../library/stdtypes.rst:1321 +#: ../../library/stdtypes.rst:1420 msgid "" "This method modifies the sequence in place for economy of space when sorting " "a large sequence. To remind users that it operates by side effect, it does " @@ -2180,7 +2231,7 @@ msgid "" "new sorted list instance)." msgstr "" -#: ../../library/stdtypes.rst:1326 +#: ../../library/stdtypes.rst:1425 msgid "" "The :meth:`sort` method is guaranteed to be stable. A sort is stable if it " "guarantees not to change the relative order of elements that compare equal " @@ -2188,12 +2239,12 @@ msgid "" "department, then by salary grade)." msgstr "" -#: ../../library/stdtypes.rst:1331 +#: ../../library/stdtypes.rst:1430 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/stdtypes.rst:1335 +#: ../../library/stdtypes.rst:1434 msgid "" "While a list is being sorted, the effect of attempting to mutate, or even " "inspect, the list is undefined. The C implementation of Python makes the " @@ -2201,331 +2252,716 @@ msgid "" "detect that the list has been mutated during a sort." msgstr "" -#: ../../library/stdtypes.rst:1344 -msgid "Tuples" +#: ../../library/stdtypes.rst:1443 +msgid "Tuples" +msgstr "" + +#: ../../library/stdtypes.rst:1447 +msgid "" +"Tuples are immutable sequences, typically used to store collections of " +"heterogeneous data (such as the 2-tuples produced by the :func:`enumerate` " +"built-in). Tuples are also used for cases where an immutable sequence of " +"homogeneous data is needed (such as allowing storage in a :class:`set` " +"or :class:`dict` instance)." +msgstr "" + +#: ../../library/stdtypes.rst:1455 +msgid "Tuples may be constructed in a number of ways:" +msgstr "元組可以以多種方式建構:" + +#: ../../library/stdtypes.rst:1457 +msgid "Using a pair of parentheses to denote the empty tuple: ``()``" +msgstr "使用一對圓括號表示空元組:``()``" + +#: ../../library/stdtypes.rst:1458 +msgid "Using a trailing comma for a singleton tuple: ``a,`` or ``(a,)``" +msgstr "使用末尾的逗號表示單元素元組:``a,`` 或 ``(a,)``" + +#: ../../library/stdtypes.rst:1459 +msgid "Separating items with commas: ``a, b, c`` or ``(a, b, c)``" +msgstr "使用逗號分隔項目:``a, b, c`` 或 ``(a, b, c)``" + +#: ../../library/stdtypes.rst:1460 +msgid "Using the :func:`tuple` built-in: ``tuple()`` or ``tuple(iterable)``" +msgstr "" + +#: ../../library/stdtypes.rst:1462 +msgid "" +"The constructor builds a tuple whose items are the same and in the same " +"order as *iterable*'s items. *iterable* may be either a sequence, a " +"container that supports iteration, or an iterator object. If *iterable* is " +"already a tuple, it is returned unchanged. For example, ``tuple('abc')`` " +"returns ``('a', 'b', 'c')`` and ``tuple( [1, 2, 3] )`` returns ``(1, 2, " +"3)``. If no argument is given, the constructor creates a new empty tuple, " +"``()``." +msgstr "" + +#: ../../library/stdtypes.rst:1470 +msgid "" +"Note that it is actually the comma which makes a tuple, not the parentheses. " +"The parentheses are optional, except in the empty tuple case, or when they " +"are needed to avoid syntactic ambiguity. For example, ``f(a, b, c)`` is a " +"function call with three arguments, while ``f((a, b, c))`` is a function " +"call with a 3-tuple as the sole argument." +msgstr "" + +#: ../../library/stdtypes.rst:1476 +msgid "" +"Tuples implement all of the :ref:`common ` sequence " +"operations." +msgstr "" + +#: ../../library/stdtypes.rst:1479 +msgid "" +"For heterogeneous collections of data where access by name is clearer than " +"access by index, :func:`collections.namedtuple` may be a more appropriate " +"choice than a simple tuple object." +msgstr "" + +#: ../../library/stdtypes.rst:1487 +msgid "Ranges" +msgstr "" + +#: ../../library/stdtypes.rst:1491 +msgid "" +"The :class:`range` type represents an immutable sequence of numbers and is " +"commonly used for looping a specific number of times in :keyword:`for` loops." +msgstr "" + +#: ../../library/stdtypes.rst:1498 +msgid "" +"The arguments to the range constructor must be integers (either built-" +"in :class:`int` or any object that implements the :meth:`~object.__index__` " +"special method). If the *step* argument is omitted, it defaults to ``1``. " +"If the *start* argument is omitted, it defaults to ``0``. If *step* is " +"zero, :exc:`ValueError` is raised." +msgstr "" + +#: ../../library/stdtypes.rst:1504 +msgid "" +"For a positive *step*, the contents of a range ``r`` are determined by the " +"formula ``r[i] = start + step*i`` where ``i >= 0`` and ``r[i] < stop``." +msgstr "" + +#: ../../library/stdtypes.rst:1508 +msgid "" +"For a negative *step*, the contents of the range are still determined by the " +"formula ``r[i] = start + step*i``, but the constraints are ``i >= 0`` and " +"``r[i] > stop``." +msgstr "" + +#: ../../library/stdtypes.rst:1512 +msgid "" +"A range object will be empty if ``r[0]`` does not meet the value constraint. " +"Ranges do support negative indices, but these are interpreted as indexing " +"from the end of the sequence determined by the positive indices." +msgstr "" + +#: ../../library/stdtypes.rst:1517 +msgid "" +"Ranges containing absolute values larger than :data:`sys.maxsize` are " +"permitted but some features (such as :func:`len`) may " +"raise :exc:`OverflowError`." +msgstr "" + +#: ../../library/stdtypes.rst:1521 +msgid "Range examples::" +msgstr "" + +#: ../../library/stdtypes.rst:1523 +msgid "" +">>> list(range(10))\n" +"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n" +">>> list(range(1, 11))\n" +"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n" +">>> list(range(0, 30, 5))\n" +"[0, 5, 10, 15, 20, 25]\n" +">>> list(range(0, 10, 3))\n" +"[0, 3, 6, 9]\n" +">>> list(range(0, -10, -1))\n" +"[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n" +">>> list(range(0))\n" +"[]\n" +">>> list(range(1, 0))\n" +"[]" +msgstr "" +">>> list(range(10))\n" +"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n" +">>> list(range(1, 11))\n" +"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n" +">>> list(range(0, 30, 5))\n" +"[0, 5, 10, 15, 20, 25]\n" +">>> list(range(0, 10, 3))\n" +"[0, 3, 6, 9]\n" +">>> list(range(0, -10, -1))\n" +"[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n" +">>> list(range(0))\n" +"[]\n" +">>> list(range(1, 0))\n" +"[]" + +#: ../../library/stdtypes.rst:1538 +msgid "" +"Ranges implement all of the :ref:`common ` sequence " +"operations except concatenation and repetition (due to the fact that range " +"objects can only represent sequences that follow a strict pattern and " +"repetition and concatenation will usually violate that pattern)." +msgstr "" + +#: ../../library/stdtypes.rst:1545 +msgid "" +"The value of the *start* parameter (or ``0`` if the parameter was not " +"supplied)" +msgstr "" + +#: ../../library/stdtypes.rst:1550 +msgid "The value of the *stop* parameter" +msgstr "" + +#: ../../library/stdtypes.rst:1554 +msgid "" +"The value of the *step* parameter (or ``1`` if the parameter was not " +"supplied)" +msgstr "" + +#: ../../library/stdtypes.rst:1557 +msgid "" +"The advantage of the :class:`range` type over a regular :class:`list` " +"or :class:`tuple` is that a :class:`range` object will always take the same " +"(small) amount of memory, no matter the size of the range it represents (as " +"it only stores the ``start``, ``stop`` and ``step`` values, calculating " +"individual items and subranges as needed)." +msgstr "" + +#: ../../library/stdtypes.rst:1563 +msgid "" +"Range objects implement the :class:`collections.abc.Sequence` ABC, and " +"provide features such as containment tests, element index lookup, slicing " +"and support for negative indices (see :ref:`typesseq`):" +msgstr "" + +#: ../../library/stdtypes.rst:1583 +msgid "" +"Testing range objects for equality with ``==`` and ``!=`` compares them as " +"sequences. That is, two range objects are considered equal if they " +"represent the same sequence of values. (Note that two range objects that " +"compare equal might have different :attr:`~range.start`, :attr:`~range.stop` " +"and :attr:`~range.step` attributes, for example ``range(0) == range(2, 1, " +"3)`` or ``range(0, 3, 2) == range(0, 4, 2)``.)" +msgstr "" + +#: ../../library/stdtypes.rst:1590 +msgid "" +"Implement the Sequence ABC. Support slicing and negative indices. " +"Test :class:`int` objects for membership in constant time instead of " +"iterating through all items." +msgstr "" + +#: ../../library/stdtypes.rst:1596 +msgid "" +"Define '==' and '!=' to compare range objects based on the sequence of " +"values they define (instead of comparing based on object identity)." +msgstr "" + +#: ../../library/stdtypes.rst:1601 +msgid "" +"Added the :attr:`~range.start`, :attr:`~range.stop` and :attr:`~range.step` " +"attributes." +msgstr "" + +#: ../../library/stdtypes.rst:1606 +msgid "" +"The `linspace recipe `_ shows how to implement a lazy version of range " +"suitable for floating-point applications." +msgstr "" + +#: ../../library/stdtypes.rst:1618 +msgid "Text and Binary Sequence Type Methods Summary" +msgstr "" + +#: ../../library/stdtypes.rst:1619 +msgid "" +"The following table summarizes the text and binary sequence types methods by " +"category." +msgstr "" + +#: ../../library/stdtypes.rst:1624 +msgid "Category" +msgstr "" + +#: ../../library/stdtypes.rst:1624 +#, fuzzy +msgid ":class:`str` methods" +msgstr ":class:`set`" + +#: ../../library/stdtypes.rst:1624 +#, fuzzy +msgid ":class:`bytes` and :class:`bytearray` methods" +msgstr ":class:`memoryview` 有幾個方法:" + +#: ../../library/stdtypes.rst:1626 +#, fuzzy +msgid "Formatting" +msgstr "formatting(格式化)" + +#: ../../library/stdtypes.rst:1626 +msgid ":meth:`str.format`" +msgstr "" + +#: ../../library/stdtypes.rst:1628 +msgid ":meth:`str.format_map`" +msgstr "" + +#: ../../library/stdtypes.rst:1630 +#, fuzzy +msgid ":ref:`f-strings`" +msgstr "f-string(f 字串)" + +#: ../../library/stdtypes.rst:1632 +msgid ":ref:`old-string-formatting`" +msgstr "" + +#: ../../library/stdtypes.rst:1632 +#, fuzzy +msgid ":ref:`bytes-formatting`" +msgstr "printf 風格格式化" + +#: ../../library/stdtypes.rst:1634 +msgid "Searching and Replacing" +msgstr "" + +#: ../../library/stdtypes.rst:1634 +msgid ":meth:`str.find`" +msgstr "" + +#: ../../library/stdtypes.rst:1634 +msgid ":meth:`str.rfind`" +msgstr "" + +#: ../../library/stdtypes.rst:1634 +msgid ":meth:`bytes.find`" +msgstr "" + +#: ../../library/stdtypes.rst:1634 +msgid ":meth:`bytes.rfind`" +msgstr "" + +#: ../../library/stdtypes.rst:1636 +msgid ":meth:`str.index`" +msgstr "" + +#: ../../library/stdtypes.rst:1636 +msgid ":meth:`str.rindex`" +msgstr "" + +#: ../../library/stdtypes.rst:1636 +msgid ":meth:`bytes.index`" +msgstr "" + +#: ../../library/stdtypes.rst:1636 +msgid ":meth:`bytes.rindex`" +msgstr "" + +#: ../../library/stdtypes.rst:1638 +msgid ":meth:`str.startswith`" +msgstr "" + +#: ../../library/stdtypes.rst:1638 +msgid ":meth:`bytes.startswith`" +msgstr "" + +#: ../../library/stdtypes.rst:1640 +msgid ":meth:`str.endswith`" +msgstr "" + +#: ../../library/stdtypes.rst:1640 +msgid ":meth:`bytes.endswith`" +msgstr "" + +#: ../../library/stdtypes.rst:1642 +msgid ":meth:`str.count`" +msgstr "" + +#: ../../library/stdtypes.rst:1642 +msgid ":meth:`bytes.count`" +msgstr "" + +#: ../../library/stdtypes.rst:1644 +msgid ":meth:`str.replace`" +msgstr "" + +#: ../../library/stdtypes.rst:1644 +msgid ":meth:`bytes.replace`" +msgstr "" + +#: ../../library/stdtypes.rst:1646 +msgid "Splitting and Joining" +msgstr "" + +#: ../../library/stdtypes.rst:1646 +msgid ":meth:`str.split`" +msgstr "" + +#: ../../library/stdtypes.rst:1646 +msgid ":meth:`str.rsplit`" +msgstr "" + +#: ../../library/stdtypes.rst:1646 +msgid ":meth:`bytes.split`" +msgstr "" + +#: ../../library/stdtypes.rst:1646 +msgid ":meth:`bytes.rsplit`" +msgstr "" + +#: ../../library/stdtypes.rst:1648 +#, fuzzy +msgid ":meth:`str.splitlines`" +msgstr "str.splitlines 方法" + +#: ../../library/stdtypes.rst:1648 +#, fuzzy +msgid ":meth:`bytes.splitlines`" +msgstr "bytes.splitlines 方法" + +#: ../../library/stdtypes.rst:1650 +msgid ":meth:`str.partition`" +msgstr "" + +#: ../../library/stdtypes.rst:1650 +msgid ":meth:`bytes.partition`" +msgstr "" + +#: ../../library/stdtypes.rst:1652 +msgid ":meth:`str.rpartition`" +msgstr "" + +#: ../../library/stdtypes.rst:1652 +msgid ":meth:`bytes.rpartition`" +msgstr "" + +#: ../../library/stdtypes.rst:1654 +msgid ":meth:`str.join`" +msgstr "" + +#: ../../library/stdtypes.rst:1654 +msgid ":meth:`bytes.join`" +msgstr "" + +#: ../../library/stdtypes.rst:1656 +msgid "String Classification" +msgstr "" + +#: ../../library/stdtypes.rst:1656 +msgid ":meth:`str.isalpha`" +msgstr "" + +#: ../../library/stdtypes.rst:1656 +msgid ":meth:`bytes.isalpha`" +msgstr "" + +#: ../../library/stdtypes.rst:1658 +msgid ":meth:`str.isdecimal`" +msgstr "" + +#: ../../library/stdtypes.rst:1660 +msgid ":meth:`str.isdigit`" +msgstr "" + +#: ../../library/stdtypes.rst:1660 +msgid ":meth:`bytes.isdigit`" +msgstr "" + +#: ../../library/stdtypes.rst:1662 +msgid ":meth:`str.isnumeric`" +msgstr "" + +#: ../../library/stdtypes.rst:1664 +msgid ":meth:`str.isalnum`" +msgstr "" + +#: ../../library/stdtypes.rst:1664 +msgid ":meth:`bytes.isalnum`" +msgstr "" + +#: ../../library/stdtypes.rst:1666 +msgid ":meth:`str.isidentifier`" +msgstr "" + +#: ../../library/stdtypes.rst:1668 +msgid ":meth:`str.islower`" +msgstr "" + +#: ../../library/stdtypes.rst:1668 +msgid ":meth:`bytes.islower`" +msgstr "" + +#: ../../library/stdtypes.rst:1670 +msgid ":meth:`str.isupper`" +msgstr "" + +#: ../../library/stdtypes.rst:1670 +msgid ":meth:`bytes.isupper`" +msgstr "" + +#: ../../library/stdtypes.rst:1672 +msgid ":meth:`str.istitle`" +msgstr "" + +#: ../../library/stdtypes.rst:1672 +msgid ":meth:`bytes.istitle`" +msgstr "" + +#: ../../library/stdtypes.rst:1674 +msgid ":meth:`str.isspace`" +msgstr "" + +#: ../../library/stdtypes.rst:1674 +msgid ":meth:`bytes.isspace`" +msgstr "" + +#: ../../library/stdtypes.rst:1676 +msgid ":meth:`str.isprintable`" +msgstr "" + +#: ../../library/stdtypes.rst:1678 +msgid "Case Manipulation" +msgstr "" + +#: ../../library/stdtypes.rst:1678 +msgid ":meth:`str.lower`" +msgstr "" + +#: ../../library/stdtypes.rst:1678 +msgid ":meth:`bytes.lower`" +msgstr "" + +#: ../../library/stdtypes.rst:1680 +msgid ":meth:`str.upper`" msgstr "" -#: ../../library/stdtypes.rst:1348 -msgid "" -"Tuples are immutable sequences, typically used to store collections of " -"heterogeneous data (such as the 2-tuples produced by the :func:`enumerate` " -"built-in). Tuples are also used for cases where an immutable sequence of " -"homogeneous data is needed (such as allowing storage in a :class:`set` or :" -"class:`dict` instance)." +#: ../../library/stdtypes.rst:1680 +msgid ":meth:`bytes.upper`" msgstr "" -#: ../../library/stdtypes.rst:1356 -msgid "Tuples may be constructed in a number of ways:" -msgstr "元組可以以多種方式建構:" +#: ../../library/stdtypes.rst:1682 +msgid ":meth:`str.casefold`" +msgstr "" -#: ../../library/stdtypes.rst:1358 -msgid "Using a pair of parentheses to denote the empty tuple: ``()``" -msgstr "使用一對圓括號表示空元組:``()``" +#: ../../library/stdtypes.rst:1684 +msgid ":meth:`str.capitalize`" +msgstr "" -#: ../../library/stdtypes.rst:1359 -msgid "Using a trailing comma for a singleton tuple: ``a,`` or ``(a,)``" -msgstr "使用末尾的逗號表示單元素元組:``a,`` 或 ``(a,)``" +#: ../../library/stdtypes.rst:1684 +msgid ":meth:`bytes.capitalize`" +msgstr "" -#: ../../library/stdtypes.rst:1360 -msgid "Separating items with commas: ``a, b, c`` or ``(a, b, c)``" -msgstr "使用逗號分隔項目:``a, b, c`` 或 ``(a, b, c)``" +#: ../../library/stdtypes.rst:1686 +msgid ":meth:`str.title`" +msgstr "" -#: ../../library/stdtypes.rst:1361 -msgid "Using the :func:`tuple` built-in: ``tuple()`` or ``tuple(iterable)``" +#: ../../library/stdtypes.rst:1686 +msgid ":meth:`bytes.title`" msgstr "" -#: ../../library/stdtypes.rst:1363 -msgid "" -"The constructor builds a tuple whose items are the same and in the same " -"order as *iterable*'s items. *iterable* may be either a sequence, a " -"container that supports iteration, or an iterator object. If *iterable* is " -"already a tuple, it is returned unchanged. For example, ``tuple('abc')`` " -"returns ``('a', 'b', 'c')`` and ``tuple( [1, 2, 3] )`` returns ``(1, 2, " -"3)``. If no argument is given, the constructor creates a new empty tuple, " -"``()``." +#: ../../library/stdtypes.rst:1688 +msgid ":meth:`str.swapcase`" msgstr "" -#: ../../library/stdtypes.rst:1371 -msgid "" -"Note that it is actually the comma which makes a tuple, not the parentheses. " -"The parentheses are optional, except in the empty tuple case, or when they " -"are needed to avoid syntactic ambiguity. For example, ``f(a, b, c)`` is a " -"function call with three arguments, while ``f((a, b, c))`` is a function " -"call with a 3-tuple as the sole argument." +#: ../../library/stdtypes.rst:1688 +msgid ":meth:`bytes.swapcase`" msgstr "" -#: ../../library/stdtypes.rst:1377 -msgid "" -"Tuples implement all of the :ref:`common ` sequence " -"operations." +#: ../../library/stdtypes.rst:1690 +msgid "Padding and Stripping" msgstr "" -#: ../../library/stdtypes.rst:1380 -msgid "" -"For heterogeneous collections of data where access by name is clearer than " -"access by index, :func:`collections.namedtuple` may be a more appropriate " -"choice than a simple tuple object." +#: ../../library/stdtypes.rst:1690 +msgid ":meth:`str.ljust`" msgstr "" -#: ../../library/stdtypes.rst:1388 -msgid "Ranges" +#: ../../library/stdtypes.rst:1690 +msgid ":meth:`str.rjust`" msgstr "" -#: ../../library/stdtypes.rst:1392 -msgid "" -"The :class:`range` type represents an immutable sequence of numbers and is " -"commonly used for looping a specific number of times in :keyword:`for` loops." +#: ../../library/stdtypes.rst:1690 +msgid ":meth:`bytes.ljust`" msgstr "" -#: ../../library/stdtypes.rst:1399 -msgid "" -"The arguments to the range constructor must be integers (either built-in :" -"class:`int` or any object that implements the :meth:`~object.__index__` " -"special method). If the *step* argument is omitted, it defaults to ``1``. " -"If the *start* argument is omitted, it defaults to ``0``. If *step* is " -"zero, :exc:`ValueError` is raised." +#: ../../library/stdtypes.rst:1690 +msgid ":meth:`bytes.rjust`" msgstr "" -#: ../../library/stdtypes.rst:1405 -msgid "" -"For a positive *step*, the contents of a range ``r`` are determined by the " -"formula ``r[i] = start + step*i`` where ``i >= 0`` and ``r[i] < stop``." +#: ../../library/stdtypes.rst:1692 +msgid ":meth:`str.center`" msgstr "" -#: ../../library/stdtypes.rst:1409 -msgid "" -"For a negative *step*, the contents of the range are still determined by the " -"formula ``r[i] = start + step*i``, but the constraints are ``i >= 0`` and " -"``r[i] > stop``." +#: ../../library/stdtypes.rst:1692 +msgid ":meth:`bytes.center`" msgstr "" -#: ../../library/stdtypes.rst:1413 -msgid "" -"A range object will be empty if ``r[0]`` does not meet the value constraint. " -"Ranges do support negative indices, but these are interpreted as indexing " -"from the end of the sequence determined by the positive indices." +#: ../../library/stdtypes.rst:1694 +msgid ":meth:`str.expandtabs`" msgstr "" -#: ../../library/stdtypes.rst:1418 -msgid "" -"Ranges containing absolute values larger than :data:`sys.maxsize` are " -"permitted but some features (such as :func:`len`) may raise :exc:" -"`OverflowError`." +#: ../../library/stdtypes.rst:1694 +msgid ":meth:`bytes.expandtabs`" msgstr "" -#: ../../library/stdtypes.rst:1422 -msgid "Range examples::" +#: ../../library/stdtypes.rst:1696 +msgid ":meth:`str.strip`" msgstr "" -#: ../../library/stdtypes.rst:1424 -msgid "" -">>> list(range(10))\n" -"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n" -">>> list(range(1, 11))\n" -"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n" -">>> list(range(0, 30, 5))\n" -"[0, 5, 10, 15, 20, 25]\n" -">>> list(range(0, 10, 3))\n" -"[0, 3, 6, 9]\n" -">>> list(range(0, -10, -1))\n" -"[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n" -">>> list(range(0))\n" -"[]\n" -">>> list(range(1, 0))\n" -"[]" +#: ../../library/stdtypes.rst:1696 +msgid ":meth:`bytes.strip`" msgstr "" -">>> list(range(10))\n" -"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n" -">>> list(range(1, 11))\n" -"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n" -">>> list(range(0, 30, 5))\n" -"[0, 5, 10, 15, 20, 25]\n" -">>> list(range(0, 10, 3))\n" -"[0, 3, 6, 9]\n" -">>> list(range(0, -10, -1))\n" -"[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n" -">>> list(range(0))\n" -"[]\n" -">>> list(range(1, 0))\n" -"[]" -#: ../../library/stdtypes.rst:1439 -msgid "" -"Ranges implement all of the :ref:`common ` sequence " -"operations except concatenation and repetition (due to the fact that range " -"objects can only represent sequences that follow a strict pattern and " -"repetition and concatenation will usually violate that pattern)." +#: ../../library/stdtypes.rst:1698 +msgid ":meth:`str.lstrip`" msgstr "" -#: ../../library/stdtypes.rst:1446 -msgid "" -"The value of the *start* parameter (or ``0`` if the parameter was not " -"supplied)" +#: ../../library/stdtypes.rst:1698 +msgid ":meth:`str.rstrip`" msgstr "" -#: ../../library/stdtypes.rst:1451 -msgid "The value of the *stop* parameter" +#: ../../library/stdtypes.rst:1698 +msgid ":meth:`bytes.lstrip`" msgstr "" -#: ../../library/stdtypes.rst:1455 -msgid "" -"The value of the *step* parameter (or ``1`` if the parameter was not " -"supplied)" +#: ../../library/stdtypes.rst:1698 +msgid ":meth:`bytes.rstrip`" msgstr "" -#: ../../library/stdtypes.rst:1458 -msgid "" -"The advantage of the :class:`range` type over a regular :class:`list` or :" -"class:`tuple` is that a :class:`range` object will always take the same " -"(small) amount of memory, no matter the size of the range it represents (as " -"it only stores the ``start``, ``stop`` and ``step`` values, calculating " -"individual items and subranges as needed)." +#: ../../library/stdtypes.rst:1700 +msgid "Translation and Encoding" msgstr "" -#: ../../library/stdtypes.rst:1464 -msgid "" -"Range objects implement the :class:`collections.abc.Sequence` ABC, and " -"provide features such as containment tests, element index lookup, slicing " -"and support for negative indices (see :ref:`typesseq`):" +#: ../../library/stdtypes.rst:1700 +msgid ":meth:`str.translate`" msgstr "" -#: ../../library/stdtypes.rst:1484 -msgid "" -"Testing range objects for equality with ``==`` and ``!=`` compares them as " -"sequences. That is, two range objects are considered equal if they " -"represent the same sequence of values. (Note that two range objects that " -"compare equal might have different :attr:`~range.start`, :attr:`~range.stop` " -"and :attr:`~range.step` attributes, for example ``range(0) == range(2, 1, " -"3)`` or ``range(0, 3, 2) == range(0, 4, 2)``.)" +#: ../../library/stdtypes.rst:1700 +msgid ":meth:`bytes.translate`" msgstr "" -#: ../../library/stdtypes.rst:1491 -msgid "" -"Implement the Sequence ABC. Support slicing and negative indices. Test :" -"class:`int` objects for membership in constant time instead of iterating " -"through all items." +#: ../../library/stdtypes.rst:1702 +msgid ":meth:`str.maketrans`" msgstr "" -#: ../../library/stdtypes.rst:1497 -msgid "" -"Define '==' and '!=' to compare range objects based on the sequence of " -"values they define (instead of comparing based on object identity)." +#: ../../library/stdtypes.rst:1702 +msgid ":meth:`bytes.maketrans`" msgstr "" -#: ../../library/stdtypes.rst:1502 -msgid "" -"Added the :attr:`~range.start`, :attr:`~range.stop` and :attr:`~range.step` " -"attributes." +#: ../../library/stdtypes.rst:1704 +msgid ":meth:`str.encode`" msgstr "" -#: ../../library/stdtypes.rst:1507 -msgid "" -"The `linspace recipe `_ shows how to implement a lazy version of range " -"suitable for floating-point applications." +#: ../../library/stdtypes.rst:1706 +msgid ":meth:`bytes.decode`" msgstr "" -#: ../../library/stdtypes.rst:1519 +#: ../../library/stdtypes.rst:1712 msgid "Text Sequence Type --- :class:`str`" msgstr "" -#: ../../library/stdtypes.rst:1521 +#: ../../library/stdtypes.rst:1714 msgid "" -"Textual data in Python is handled with :class:`str` objects, or :dfn:" -"`strings`. Strings are immutable :ref:`sequences ` of Unicode code " -"points. String literals are written in a variety of ways:" +"Textual data in Python is handled with :class:`str` objects, " +"or :dfn:`strings`. Strings are immutable :ref:`sequences ` of " +"Unicode code points. String literals are written in a variety of ways:" msgstr "" -#: ../../library/stdtypes.rst:1526 +#: ../../library/stdtypes.rst:1719 msgid "Single quotes: ``'allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:1527 +#: ../../library/stdtypes.rst:1720 msgid "Double quotes: ``\"allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:1528 +#: ../../library/stdtypes.rst:1721 msgid "" "Triple quoted: ``'''Three single quotes'''``, ``\"\"\"Three double " "quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:1530 +#: ../../library/stdtypes.rst:1723 msgid "" "Triple quoted strings may span multiple lines - all associated whitespace " "will be included in the string literal." msgstr "" -#: ../../library/stdtypes.rst:1533 +#: ../../library/stdtypes.rst:1726 msgid "" "String literals that are part of a single expression and have only " "whitespace between them will be implicitly converted to a single string " "literal. That is, ``(\"spam \" \"eggs\") == \"spam eggs\"``." msgstr "" -#: ../../library/stdtypes.rst:1537 +#: ../../library/stdtypes.rst:1730 msgid "" "See :ref:`strings` for more about the various forms of string literal, " "including supported :ref:`escape sequences `, and the " "``r`` (\"raw\") prefix that disables most escape sequence processing." msgstr "" -#: ../../library/stdtypes.rst:1541 +#: ../../library/stdtypes.rst:1734 msgid "" "Strings may also be created from other objects using the :class:`str` " "constructor." msgstr "" -#: ../../library/stdtypes.rst:1544 +#: ../../library/stdtypes.rst:1737 msgid "" "Since there is no separate \"character\" type, indexing a string produces " "strings of length 1. That is, for a non-empty string *s*, ``s[0] == s[0:1]``." msgstr "" -#: ../../library/stdtypes.rst:1550 +#: ../../library/stdtypes.rst:1743 msgid "" -"There is also no mutable string type, but :meth:`str.join` or :class:`io." -"StringIO` can be used to efficiently construct strings from multiple " -"fragments." +"There is also no mutable string type, but :meth:`str.join` " +"or :class:`io.StringIO` can be used to efficiently construct strings from " +"multiple fragments." msgstr "" -#: ../../library/stdtypes.rst:1554 +#: ../../library/stdtypes.rst:1747 msgid "" "For backwards compatibility with the Python 2 series, the ``u`` prefix is " "once again permitted on string literals. It has no effect on the meaning of " "string literals and cannot be combined with the ``r`` prefix." msgstr "" -#: ../../library/stdtypes.rst:1568 +#: ../../library/stdtypes.rst:1761 msgid "" "Return a :ref:`string ` version of *object*. If *object* is not " "provided, returns the empty string. Otherwise, the behavior of ``str()`` " "depends on whether *encoding* or *errors* is given, as follows." msgstr "" -#: ../../library/stdtypes.rst:1572 +#: ../../library/stdtypes.rst:1765 msgid "" -"If neither *encoding* nor *errors* is given, ``str(object)`` returns :meth:" -"`type(object).__str__(object) `, which is the \"informal\" " -"or nicely printable string representation of *object*. For string objects, " -"this is the string itself. If *object* does not have a :meth:`~object." -"__str__` method, then :func:`str` falls back to returning :func:" -"`repr(object) `." +"If neither *encoding* nor *errors* is given, ``str(object)`` " +"returns :meth:`type(object).__str__(object) `, which is the " +"\"informal\" or nicely printable string representation of *object*. For " +"string objects, this is the string itself. If *object* does not have " +"a :meth:`~object.__str__` method, then :func:`str` falls back to " +"returning :func:`repr(object) `." msgstr "" -#: ../../library/stdtypes.rst:1584 +#: ../../library/stdtypes.rst:1777 msgid "" -"If at least one of *encoding* or *errors* is given, *object* should be a :" -"term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " +"If at least one of *encoding* or *errors* is given, *object* should be " +"a :term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " "this case, if *object* is a :class:`bytes` (or :class:`bytearray`) object, " -"then ``str(bytes, encoding, errors)`` is equivalent to :meth:`bytes." -"decode(encoding, errors) `. Otherwise, the bytes object " -"underlying the buffer object is obtained before calling :meth:`bytes." -"decode`. See :ref:`binaryseq` and :ref:`bufferobjects` for information on " -"buffer objects." +"then ``str(bytes, encoding, errors)`` is equivalent " +"to :meth:`bytes.decode(encoding, errors) `. Otherwise, the " +"bytes object underlying the buffer object is obtained before " +"calling :meth:`bytes.decode`. See :ref:`binaryseq` and :ref:`bufferobjects` " +"for information on buffer objects." msgstr "" -#: ../../library/stdtypes.rst:1593 +#: ../../library/stdtypes.rst:1786 msgid "" "Passing a :class:`bytes` object to :func:`str` without the *encoding* or " "*errors* arguments falls under the first case of returning the informal " @@ -2533,7 +2969,7 @@ msgid "" "Python). For example::" msgstr "" -#: ../../library/stdtypes.rst:1598 +#: ../../library/stdtypes.rst:1791 msgid "" ">>> str(b'Zoot!')\n" "\"b'Zoot!'\"" @@ -2541,84 +2977,84 @@ msgstr "" ">>> str(b'Zoot!')\n" "\"b'Zoot!'\"" -#: ../../library/stdtypes.rst:1601 +#: ../../library/stdtypes.rst:1794 msgid "" -"For more information on the ``str`` class and its methods, see :ref:" -"`textseq` and the :ref:`string-methods` section below. To output formatted " -"strings, see the :ref:`f-strings` and :ref:`formatstrings` sections. In " -"addition, see the :ref:`stringservices` section." +"For more information on the ``str`` class and its methods, " +"see :ref:`textseq` and the :ref:`string-methods` section below. To output " +"formatted strings, see the :ref:`f-strings` and :ref:`formatstrings` " +"sections. In addition, see the :ref:`stringservices` section." msgstr "" -#: ../../library/stdtypes.rst:1613 +#: ../../library/stdtypes.rst:1806 msgid "String Methods" msgstr "" -#: ../../library/stdtypes.rst:1618 +#: ../../library/stdtypes.rst:1811 msgid "" "Strings implement all of the :ref:`common ` sequence " "operations, along with the additional methods described below." msgstr "" -#: ../../library/stdtypes.rst:1621 +#: ../../library/stdtypes.rst:1814 msgid "" "Strings also support two styles of string formatting, one providing a large " -"degree of flexibility and customization (see :meth:`str.format`, :ref:" -"`formatstrings` and :ref:`string-formatting`) and the other based on C " -"``printf`` style formatting that handles a narrower range of types and is " -"slightly harder to use correctly, but is often faster for the cases it can " -"handle (:ref:`old-string-formatting`)." +"degree of flexibility and customization " +"(see :meth:`str.format`, :ref:`formatstrings` and :ref:`string-formatting`) " +"and the other based on C ``printf`` style formatting that handles a narrower " +"range of types and is slightly harder to use correctly, but is often faster " +"for the cases it can handle (:ref:`old-string-formatting`)." msgstr "" -#: ../../library/stdtypes.rst:1628 +#: ../../library/stdtypes.rst:1821 msgid "" "The :ref:`textservices` section of the standard library covers a number of " "other modules that provide various text related utilities (including regular " "expression support in the :mod:`re` module)." msgstr "" -#: ../../library/stdtypes.rst:1634 +#: ../../library/stdtypes.rst:1827 msgid "" "Return a copy of the string with its first character capitalized and the " "rest lowercased." msgstr "" -#: ../../library/stdtypes.rst:1637 +#: ../../library/stdtypes.rst:1830 msgid "" "The first character is now put into titlecase rather than uppercase. This " "means that characters like digraphs will only have their first letter " "capitalized, instead of the full character." msgstr "" -#: ../../library/stdtypes.rst:1644 +#: ../../library/stdtypes.rst:1837 msgid "" "Return a casefolded copy of the string. Casefolded strings may be used for " "caseless matching." msgstr "" -#: ../../library/stdtypes.rst:1647 +#: ../../library/stdtypes.rst:1840 msgid "" "Casefolding is similar to lowercasing but more aggressive because it is " "intended to remove all case distinctions in a string. For example, the " "German lowercase letter ``'ß'`` is equivalent to ``\"ss\"``. Since it is " -"already lowercase, :meth:`lower` would do nothing to ``'ß'``; :meth:" -"`casefold` converts it to ``\"ss\"``." +"already lowercase, :meth:`lower` would do nothing to " +"``'ß'``; :meth:`casefold` converts it to ``\"ss\"``." msgstr "" -#: ../../library/stdtypes.rst:1653 +#: ../../library/stdtypes.rst:1846 msgid "" "The casefolding algorithm is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." +"Unicode16.0.0/core-spec/chapter-3/#G33992>`__." msgstr "" -#: ../../library/stdtypes.rst:1662 +#: ../../library/stdtypes.rst:1855 msgid "" "Return centered in a string of length *width*. Padding is done using the " "specified *fillchar* (default is an ASCII space). The original string is " "returned if *width* is less than or equal to ``len(s)``. For example::" msgstr "" -#: ../../library/stdtypes.rst:1666 +#: ../../library/stdtypes.rst:1859 msgid "" ">>> 'Python'.center(10)\n" "' Python '\n" @@ -2634,20 +3070,20 @@ msgstr "" ">>> 'Python'.center(4)\n" "'Python'" -#: ../../library/stdtypes.rst:1676 +#: ../../library/stdtypes.rst:1869 msgid "" "Return the number of non-overlapping occurrences of substring *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:1680 +#: ../../library/stdtypes.rst:1873 msgid "" "If *sub* is empty, returns the number of empty strings between characters " "which is the length of the string plus one. For example::" msgstr "" -#: ../../library/stdtypes.rst:1683 +#: ../../library/stdtypes.rst:1876 msgid "" ">>> 'spam, spam, spam'.count('spam')\n" "3\n" @@ -2671,33 +3107,33 @@ msgstr "" ">>> 'spam, spam, spam'.count('')\n" "17" -#: ../../library/stdtypes.rst:1696 +#: ../../library/stdtypes.rst:1889 msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1698 ../../library/stdtypes.rst:3043 +#: ../../library/stdtypes.rst:1891 ../../library/stdtypes.rst:3277 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." msgstr "" -#: ../../library/stdtypes.rst:1701 +#: ../../library/stdtypes.rst:1894 msgid "" "*errors* controls how encoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " "are ``'ignore'``, ``'replace'``, ``'xmlcharrefreplace'``, " -"``'backslashreplace'`` and any other name registered via :func:`codecs." -"register_error`. See :ref:`error-handlers` for details." +"``'backslashreplace'`` and any other name registered " +"via :func:`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:1708 +#: ../../library/stdtypes.rst:1901 msgid "" "For performance reasons, the value of *errors* is not checked for validity " -"unless an encoding error actually occurs, :ref:`devmode` is enabled or a :" -"ref:`debug build ` is used. For example::" +"unless an encoding error actually occurs, :ref:`devmode` is enabled or " +"a :ref:`debug build ` is used. For example::" msgstr "" -#: ../../library/stdtypes.rst:1714 +#: ../../library/stdtypes.rst:1907 msgid "" ">>> encoded_str_to_bytes = 'Python'.encode()\n" ">>> type(encoded_str_to_bytes)\n" @@ -2711,17 +3147,17 @@ msgstr "" ">>> encoded_str_to_bytes\n" "b'Python'" -#: ../../library/stdtypes.rst:1721 ../../library/stdtypes.rst:3062 +#: ../../library/stdtypes.rst:1914 ../../library/stdtypes.rst:3296 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1724 ../../library/stdtypes.rst:3065 +#: ../../library/stdtypes.rst:1917 ../../library/stdtypes.rst:3299 msgid "" -"The value of the *errors* argument is now checked in :ref:`devmode` and in :" -"ref:`debug mode `." +"The value of the *errors* argument is now checked in :ref:`devmode` and " +"in :ref:`debug mode `." msgstr "" -#: ../../library/stdtypes.rst:1731 +#: ../../library/stdtypes.rst:1924 msgid "" "Return ``True`` if the string ends with the specified *suffix*, otherwise " "return ``False``. *suffix* can also be a tuple of suffixes to look for. " @@ -2730,7 +3166,7 @@ msgid "" "equivalent to ``str[start:end].endswith(suffix)``. For example::" msgstr "" -#: ../../library/stdtypes.rst:1737 +#: ../../library/stdtypes.rst:1930 msgid "" ">>> 'Python'.endswith('on')\n" "True\n" @@ -2750,11 +3186,11 @@ msgstr "" ">>> 'Python is amazing'.endswith('is', 0, 9)\n" "True" -#: ../../library/stdtypes.rst:1746 +#: ../../library/stdtypes.rst:1939 msgid "See also :meth:`startswith` and :meth:`removesuffix`." msgstr "另請參閱 :meth:`startswith` 和 :meth:`removesuffix`。" -#: ../../library/stdtypes.rst:1751 +#: ../../library/stdtypes.rst:1944 msgid "" "Return a copy of the string where all tab characters are replaced by one or " "more spaces, depending on the current column and the given tab size. Tab " @@ -2770,7 +3206,7 @@ msgid "" "printed. For example::" msgstr "" -#: ../../library/stdtypes.rst:1764 +#: ../../library/stdtypes.rst:1957 msgid "" ">>> '01\\t012\\t0123\\t01234'.expandtabs()\n" "'01 012 0123 01234'\n" @@ -2788,7 +3224,7 @@ msgstr "" "01 012\n" "0123 01234" -#: ../../library/stdtypes.rst:1775 +#: ../../library/stdtypes.rst:1968 msgid "" "Return the lowest index in the string where substring *sub* is found within " "the slice ``s[start:end]``. Optional arguments *start* and *end* are " @@ -2796,7 +3232,7 @@ msgid "" "example::" msgstr "" -#: ../../library/stdtypes.rst:1780 +#: ../../library/stdtypes.rst:1973 msgid "" ">>> 'spam, spam, spam'.find('sp')\n" "0\n" @@ -2808,18 +3244,18 @@ msgstr "" ">>> 'spam, spam, spam'.find('sp', 5)\n" "6" -#: ../../library/stdtypes.rst:1785 +#: ../../library/stdtypes.rst:1978 msgid "See also :meth:`rfind` and :meth:`index`." msgstr "另請參閱 :meth:`rfind` 和 :meth:`index`。" -#: ../../library/stdtypes.rst:1789 +#: ../../library/stdtypes.rst:1982 msgid "" "The :meth:`~str.find` method should be used only if you need to know the " -"position of *sub*. To check if *sub* is a substring or not, use the :" -"keyword:`in` operator::" +"position of *sub*. To check if *sub* is a substring or not, use " +"the :keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:1793 +#: ../../library/stdtypes.rst:1986 msgid "" ">>> 'Py' in 'Python'\n" "True" @@ -2827,7 +3263,7 @@ msgstr "" ">>> 'Py' in 'Python'\n" "True" -#: ../../library/stdtypes.rst:1799 +#: ../../library/stdtypes.rst:1992 msgid "" "Perform a string formatting operation. The string on which this method is " "called can contain literal text or replacement fields delimited by braces " @@ -2837,70 +3273,71 @@ msgid "" "the corresponding argument." msgstr "" -#: ../../library/stdtypes.rst:1809 +#: ../../library/stdtypes.rst:2002 msgid "" "See :ref:`formatstrings` for a description of the various formatting options " "that can be specified in format strings." msgstr "" -#: ../../library/stdtypes.rst:1813 +#: ../../library/stdtypes.rst:2006 msgid "" -"When formatting a number (:class:`int`, :class:`float`, :class:`complex`, :" -"class:`decimal.Decimal` and subclasses) with the ``n`` type (ex: ``'{:n}'." -"format(1234)``), the function temporarily sets the ``LC_CTYPE`` locale to " -"the ``LC_NUMERIC`` locale to decode ``decimal_point`` and ``thousands_sep`` " -"fields of :c:func:`localeconv` if they are non-ASCII or longer than 1 byte, " -"and the ``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. " -"This temporary change affects other threads." +"When formatting a number " +"(:class:`int`, :class:`float`, :class:`complex`, :class:`decimal.Decimal` " +"and subclasses) with the ``n`` type (ex: ``'{:n}'.format(1234)``), the " +"function temporarily sets the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` " +"locale to decode ``decimal_point`` and ``thousands_sep`` fields " +"of :c:func:`localeconv` if they are non-ASCII or longer than 1 byte, and the " +"``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. This " +"temporary change affects other threads." msgstr "" -#: ../../library/stdtypes.rst:1822 +#: ../../library/stdtypes.rst:2015 msgid "" "When formatting a number with the ``n`` type, the function sets temporarily " "the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` locale in some cases." msgstr "" -#: ../../library/stdtypes.rst:1830 +#: ../../library/stdtypes.rst:2023 msgid "" "Similar to ``str.format(**mapping)``, except that ``mapping`` is used " "directly and not copied to a :class:`dict`. This is useful if for example " "``mapping`` is a dict subclass:" msgstr "" -#: ../../library/stdtypes.rst:1846 +#: ../../library/stdtypes.rst:2039 msgid "" "Like :meth:`~str.find`, but raise :exc:`ValueError` when the substring is " "not found." msgstr "" -#: ../../library/stdtypes.rst:1852 +#: ../../library/stdtypes.rst:2045 msgid "" "Return ``True`` if all characters in the string are alphanumeric and there " "is at least one character, ``False`` otherwise. A character ``c`` is " -"alphanumeric if one of the following returns ``True``: ``c.isalpha()``, ``c." -"isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." +"alphanumeric if one of the following returns ``True``: ``c.isalpha()``, " +"``c.isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." msgstr "" -#: ../../library/stdtypes.rst:1860 +#: ../../library/stdtypes.rst:2053 msgid "" "Return ``True`` if all characters in the string are alphabetic and there is " "at least one character, ``False`` otherwise. Alphabetic characters are " -"those characters defined in the Unicode character database as \"Letter\", i." -"e., those with general category property being one of \"Lm\", \"Lt\", " +"those characters defined in the Unicode character database as \"Letter\", " +"i.e., those with general category property being one of \"Lm\", \"Lt\", " "\"Lu\", \"Ll\", or \"Lo\". Note that this is different from the `Alphabetic " "property defined in the section 4.10 'Letters, Alphabetic, and Ideographic' " -"of the Unicode Standard `_." +"of the Unicode Standard `_." msgstr "" -#: ../../library/stdtypes.rst:1871 +#: ../../library/stdtypes.rst:2064 msgid "" "Return ``True`` if the string is empty or all characters in the string are " "ASCII, ``False`` otherwise. ASCII characters have code points in the range " "U+0000-U+007F." msgstr "" -#: ../../library/stdtypes.rst:1880 +#: ../../library/stdtypes.rst:2073 msgid "" "Return ``True`` if all characters in the string are decimal characters and " "there is at least one character, ``False`` otherwise. Decimal characters are " @@ -2909,7 +3346,7 @@ msgid "" "General Category \"Nd\"." msgstr "" -#: ../../library/stdtypes.rst:1890 +#: ../../library/stdtypes.rst:2083 msgid "" "Return ``True`` if all characters in the string are digits and there is at " "least one character, ``False`` otherwise. Digits include decimal characters " @@ -2919,23 +3356,23 @@ msgid "" "property value Numeric_Type=Digit or Numeric_Type=Decimal." msgstr "" -#: ../../library/stdtypes.rst:1900 +#: ../../library/stdtypes.rst:2093 msgid "" "Return ``True`` if the string is a valid identifier according to the " "language definition, section :ref:`identifiers`." msgstr "" -#: ../../library/stdtypes.rst:1903 +#: ../../library/stdtypes.rst:2096 msgid "" ":func:`keyword.iskeyword` can be used to test whether string ``s`` is a " "reserved identifier, such as :keyword:`def` and :keyword:`class`." msgstr "" -#: ../../library/stdtypes.rst:1906 +#: ../../library/stdtypes.rst:2099 msgid "Example: ::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:1909 +#: ../../library/stdtypes.rst:2102 msgid "" ">>> from keyword import iskeyword\n" "\n" @@ -2951,13 +3388,13 @@ msgstr "" ">>> 'def'.isidentifier(), iskeyword('def')\n" "(True, True)" -#: ../../library/stdtypes.rst:1919 +#: ../../library/stdtypes.rst:2112 msgid "" "Return ``True`` if all cased characters [4]_ in the string are lowercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1925 +#: ../../library/stdtypes.rst:2118 msgid "" "Return ``True`` if all characters in the string are numeric characters, and " "there is at least one character, ``False`` otherwise. Numeric characters " @@ -2967,13 +3404,13 @@ msgid "" "Numeric_Type=Decimal or Numeric_Type=Numeric." msgstr "" -#: ../../library/stdtypes.rst:1935 +#: ../../library/stdtypes.rst:2128 msgid "" "Return ``True`` if all characters in the string are printable, ``False`` if " "it contains at least one non-printable character." msgstr "" -#: ../../library/stdtypes.rst:1938 +#: ../../library/stdtypes.rst:2131 msgid "" "Here \"printable\" means the character is suitable for :func:`repr` to use " "in its output; \"non-printable\" means that :func:`repr` on built-in types " @@ -2981,7 +3418,7 @@ msgid "" "written to :data:`sys.stdout` or :data:`sys.stderr`." msgstr "" -#: ../../library/stdtypes.rst:1943 +#: ../../library/stdtypes.rst:2136 msgid "" "The printable characters are those which in the Unicode character database " "(see :mod:`unicodedata`) have a general category in group Letter, Mark, " @@ -2990,20 +3427,21 @@ msgid "" "C), except the ASCII space." msgstr "" -#: ../../library/stdtypes.rst:1952 +#: ../../library/stdtypes.rst:2145 msgid "" "Return ``True`` if there are only whitespace characters in the string and " "there is at least one character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1955 +#: ../../library/stdtypes.rst:2148 msgid "" -"A character is *whitespace* if in the Unicode character database (see :mod:" -"`unicodedata`), either its general category is ``Zs`` (\"Separator, " -"space\"), or its bidirectional class is one of ``WS``, ``B``, or ``S``." +"A character is *whitespace* if in the Unicode character database " +"(see :mod:`unicodedata`), either its general category is ``Zs`` " +"(\"Separator, space\"), or its bidirectional class is one of ``WS``, ``B``, " +"or ``S``." msgstr "" -#: ../../library/stdtypes.rst:1963 +#: ../../library/stdtypes.rst:2156 msgid "" "Return ``True`` if the string is a titlecased string and there is at least " "one character, for example uppercase characters may only follow uncased " @@ -3011,41 +3449,41 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:1970 +#: ../../library/stdtypes.rst:2163 msgid "" "Return ``True`` if all cased characters [4]_ in the string are uppercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1988 +#: ../../library/stdtypes.rst:2181 msgid "" -"Return a string which is the concatenation of the strings in *iterable*. A :" -"exc:`TypeError` will be raised if there are any non-string values in " +"Return a string which is the concatenation of the strings in *iterable*. " +"A :exc:`TypeError` will be raised if there are any non-string values in " "*iterable*, including :class:`bytes` objects. The separator between " "elements is the string providing this method." msgstr "" -#: ../../library/stdtypes.rst:1996 +#: ../../library/stdtypes.rst:2189 msgid "" "Return the string left justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2003 +#: ../../library/stdtypes.rst:2196 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "lowercase." msgstr "" -#: ../../library/stdtypes.rst:2006 +#: ../../library/stdtypes.rst:2199 msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." +"Unicode16.0.0/core-spec/chapter-3/#G33992>`__." msgstr "" -#: ../../library/stdtypes.rst:2013 +#: ../../library/stdtypes.rst:2206 msgid "" "Return a copy of the string with leading characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3054,7 +3492,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2018 +#: ../../library/stdtypes.rst:2211 msgid "" ">>> ' spacious '.lstrip()\n" "'spacious '\n" @@ -3066,13 +3504,13 @@ msgstr "" ">>> 'www.example.com'.lstrip('cmowz.')\n" "'example.com'" -#: ../../library/stdtypes.rst:2023 +#: ../../library/stdtypes.rst:2216 msgid "" "See :meth:`str.removeprefix` for a method that will remove a single prefix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2026 +#: ../../library/stdtypes.rst:2219 msgid "" ">>> 'Arthur: three!'.lstrip('Arthur: ')\n" "'ee!'\n" @@ -3084,13 +3522,13 @@ msgstr "" ">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" "'three!'" -#: ../../library/stdtypes.rst:2035 +#: ../../library/stdtypes.rst:2228 msgid "" -"This static method returns a translation table usable for :meth:`str." -"translate`." +"This static method returns a translation table usable " +"for :meth:`str.translate`." msgstr "" -#: ../../library/stdtypes.rst:2037 +#: ../../library/stdtypes.rst:2230 msgid "" "If there is only one argument, it must be a dictionary mapping Unicode " "ordinals (integers) or characters (strings of length 1) to Unicode ordinals, " @@ -3098,7 +3536,7 @@ msgid "" "converted to ordinals." msgstr "" -#: ../../library/stdtypes.rst:2042 +#: ../../library/stdtypes.rst:2235 msgid "" "If there are two arguments, they must be strings of equal length, and in the " "resulting dictionary, each character in *from* will be mapped to the " @@ -3106,7 +3544,7 @@ msgid "" "must be a string, whose characters will be mapped to ``None`` in the result." msgstr "" -#: ../../library/stdtypes.rst:2050 +#: ../../library/stdtypes.rst:2243 msgid "" "Split the string at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3114,13 +3552,13 @@ msgid "" "containing the string itself, followed by two empty strings." msgstr "" -#: ../../library/stdtypes.rst:2058 +#: ../../library/stdtypes.rst:2251 msgid "" "If the string starts with the *prefix* string, return " "``string[len(prefix):]``. Otherwise, return a copy of the original string::" msgstr "" -#: ../../library/stdtypes.rst:2062 +#: ../../library/stdtypes.rst:2255 msgid "" ">>> 'TestHook'.removeprefix('Test')\n" "'Hook'\n" @@ -3132,14 +3570,14 @@ msgstr "" ">>> 'BaseTestCase'.removeprefix('Test')\n" "'BaseTestCase'" -#: ../../library/stdtypes.rst:2072 +#: ../../library/stdtypes.rst:2265 msgid "" "If the string ends with the *suffix* string and that *suffix* is not empty, " "return ``string[:-len(suffix)]``. Otherwise, return a copy of the original " "string::" msgstr "" -#: ../../library/stdtypes.rst:2076 +#: ../../library/stdtypes.rst:2269 msgid "" ">>> 'MiscTests'.removesuffix('Tests')\n" "'Misc'\n" @@ -3151,7 +3589,7 @@ msgstr "" ">>> 'TmpDirMixin'.removesuffix('Tests')\n" "'TmpDirMixin'" -#: ../../library/stdtypes.rst:2086 +#: ../../library/stdtypes.rst:2279 msgid "" "Return a copy of the string with all occurrences of substring *old* replaced " "by *new*. If *count* is given, only the first *count* occurrences are " @@ -3159,31 +3597,31 @@ msgid "" "replaced." msgstr "" -#: ../../library/stdtypes.rst:2090 +#: ../../library/stdtypes.rst:2283 msgid "*count* is now supported as a keyword argument." msgstr "*count* 現在作為關鍵字引數被支援。" -#: ../../library/stdtypes.rst:2096 +#: ../../library/stdtypes.rst:2289 msgid "" "Return the highest index in the string where substring *sub* is found, such " "that *sub* is contained within ``s[start:end]``. Optional arguments *start* " "and *end* are interpreted as in slice notation. Return ``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2103 +#: ../../library/stdtypes.rst:2296 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found." msgstr "" -#: ../../library/stdtypes.rst:2109 +#: ../../library/stdtypes.rst:2302 msgid "" "Return the string right justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2116 +#: ../../library/stdtypes.rst:2309 msgid "" "Split the string at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3191,7 +3629,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2124 +#: ../../library/stdtypes.rst:2317 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done, the " @@ -3200,7 +3638,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2133 +#: ../../library/stdtypes.rst:2326 msgid "" "Return a copy of the string with trailing characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3209,7 +3647,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2138 +#: ../../library/stdtypes.rst:2331 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -3221,13 +3659,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2143 +#: ../../library/stdtypes.rst:2336 msgid "" "See :meth:`str.removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2146 +#: ../../library/stdtypes.rst:2339 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -3239,7 +3677,7 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2153 +#: ../../library/stdtypes.rst:2346 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -3248,30 +3686,30 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2159 +#: ../../library/stdtypes.rst:2352 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " "``['1', '', '2']``). The *sep* argument may consist of multiple characters " -"as a single delimiter (to split with multiple delimiters, use :func:`re." -"split`). Splitting an empty string with a specified separator returns " -"``['']``." -msgstr "" - -#: ../../library/stdtypes.rst:2166 ../../library/stdtypes.rst:2184 -#: ../../library/stdtypes.rst:2196 ../../library/stdtypes.rst:2248 -#: ../../library/stdtypes.rst:2316 ../../library/stdtypes.rst:2384 -#: ../../library/stdtypes.rst:3378 ../../library/stdtypes.rst:3396 -#: ../../library/stdtypes.rst:3486 ../../library/stdtypes.rst:3502 -#: ../../library/stdtypes.rst:3527 ../../library/stdtypes.rst:3541 -#: ../../library/stdtypes.rst:3569 ../../library/stdtypes.rst:3583 -#: ../../library/stdtypes.rst:3601 ../../library/stdtypes.rst:3628 -#: ../../library/stdtypes.rst:3651 ../../library/stdtypes.rst:3678 -#: ../../library/stdtypes.rst:3720 ../../library/stdtypes.rst:3744 +"as a single delimiter (to split with multiple delimiters, " +"use :func:`re.split`). Splitting an empty string with a specified separator " +"returns ``['']``." +msgstr "" + +#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:2377 +#: ../../library/stdtypes.rst:2389 ../../library/stdtypes.rst:2441 +#: ../../library/stdtypes.rst:2509 ../../library/stdtypes.rst:2577 +#: ../../library/stdtypes.rst:3612 ../../library/stdtypes.rst:3630 +#: ../../library/stdtypes.rst:3720 ../../library/stdtypes.rst:3736 +#: ../../library/stdtypes.rst:3761 ../../library/stdtypes.rst:3775 +#: ../../library/stdtypes.rst:3803 ../../library/stdtypes.rst:3817 +#: ../../library/stdtypes.rst:3835 ../../library/stdtypes.rst:3862 +#: ../../library/stdtypes.rst:3885 ../../library/stdtypes.rst:3912 +#: ../../library/stdtypes.rst:3954 ../../library/stdtypes.rst:3978 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2168 +#: ../../library/stdtypes.rst:2361 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -3291,7 +3729,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2177 +#: ../../library/stdtypes.rst:2370 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive whitespace are regarded as a single separator, " @@ -3301,7 +3739,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2186 +#: ../../library/stdtypes.rst:2379 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -3317,13 +3755,13 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2193 +#: ../../library/stdtypes.rst:2386 msgid "" "If *sep* is not specified or is ``None`` and *maxsplit* is ``0``, only " "leading runs of consecutive whitespace are considered." msgstr "" -#: ../../library/stdtypes.rst:2198 +#: ../../library/stdtypes.rst:2391 msgid "" ">>> \"\".split(None, 0)\n" "[]\n" @@ -3339,120 +3777,120 @@ msgstr "" ">>> \" foo \".split(maxsplit=0)\n" "['foo ']" -#: ../../library/stdtypes.rst:2211 +#: ../../library/stdtypes.rst:2404 msgid "" "Return a list of the lines in the string, breaking at line boundaries. Line " "breaks are not included in the resulting list unless *keepends* is given and " "true." msgstr "" -#: ../../library/stdtypes.rst:2215 +#: ../../library/stdtypes.rst:2408 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2219 +#: ../../library/stdtypes.rst:2412 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2219 +#: ../../library/stdtypes.rst:2412 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2221 +#: ../../library/stdtypes.rst:2414 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2221 +#: ../../library/stdtypes.rst:2414 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2223 +#: ../../library/stdtypes.rst:2416 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2223 +#: ../../library/stdtypes.rst:2416 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2225 +#: ../../library/stdtypes.rst:2418 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2225 +#: ../../library/stdtypes.rst:2418 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2227 +#: ../../library/stdtypes.rst:2420 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2227 +#: ../../library/stdtypes.rst:2420 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2229 +#: ../../library/stdtypes.rst:2422 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2229 +#: ../../library/stdtypes.rst:2422 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2231 +#: ../../library/stdtypes.rst:2424 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2231 +#: ../../library/stdtypes.rst:2424 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2233 +#: ../../library/stdtypes.rst:2426 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2233 +#: ../../library/stdtypes.rst:2426 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2235 +#: ../../library/stdtypes.rst:2428 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2235 +#: ../../library/stdtypes.rst:2428 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2237 +#: ../../library/stdtypes.rst:2430 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2237 +#: ../../library/stdtypes.rst:2430 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2239 +#: ../../library/stdtypes.rst:2432 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2239 +#: ../../library/stdtypes.rst:2432 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2241 +#: ../../library/stdtypes.rst:2434 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2241 +#: ../../library/stdtypes.rst:2434 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2246 +#: ../../library/stdtypes.rst:2439 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2250 +#: ../../library/stdtypes.rst:2443 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -3464,14 +3902,14 @@ msgstr "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" -#: ../../library/stdtypes.rst:2255 +#: ../../library/stdtypes.rst:2448 msgid "" "Unlike :meth:`~str.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:2259 +#: ../../library/stdtypes.rst:2452 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -3483,11 +3921,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2264 +#: ../../library/stdtypes.rst:2457 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2266 +#: ../../library/stdtypes.rst:2459 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -3499,7 +3937,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2274 +#: ../../library/stdtypes.rst:2467 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -3507,7 +3945,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2282 +#: ../../library/stdtypes.rst:2475 msgid "" "Return a copy of the string with the leading and trailing characters " "removed. The *chars* argument is a string specifying the set of characters " @@ -3516,7 +3954,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2288 +#: ../../library/stdtypes.rst:2481 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -3528,7 +3966,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2293 +#: ../../library/stdtypes.rst:2486 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -3536,7 +3974,7 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2299 +#: ../../library/stdtypes.rst:2492 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -3546,20 +3984,20 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2306 +#: ../../library/stdtypes.rst:2499 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " -"and vice versa. Note that it is not necessarily true that ``s.swapcase()." -"swapcase() == s``." +"and vice versa. Note that it is not necessarily true that " +"``s.swapcase().swapcase() == s``." msgstr "" -#: ../../library/stdtypes.rst:2313 +#: ../../library/stdtypes.rst:2506 msgid "" "Return a titlecased version of the string where words start with an " "uppercase character and the remaining characters are lowercase." msgstr "" -#: ../../library/stdtypes.rst:2318 +#: ../../library/stdtypes.rst:2511 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -3567,7 +4005,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2321 ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:2514 ../../library/stdtypes.rst:3922 msgid "" "The algorithm uses a simple language-independent definition of a word as " "groups of consecutive letters. The definition works in many contexts but it " @@ -3575,7 +4013,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2326 +#: ../../library/stdtypes.rst:2519 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -3583,19 +4021,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2329 +#: ../../library/stdtypes.rst:2522 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2332 +#: ../../library/stdtypes.rst:2525 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2528 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -3615,31 +4053,31 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2347 +#: ../../library/stdtypes.rst:2540 msgid "" "Return a copy of the string in which each character has been mapped through " "the given translation table. The table must be an object that implements " -"indexing via :meth:`~object.__getitem__`, typically a :term:`mapping` or :" -"term:`sequence`. When indexed by a Unicode ordinal (an integer), the table " -"object can do any of the following: return a Unicode ordinal or a string, to " -"map the character to one or more other characters; return ``None``, to " -"delete the character from the return string; or raise a :exc:`LookupError` " -"exception, to map the character to itself." +"indexing via :meth:`~object.__getitem__`, typically a :term:`mapping` " +"or :term:`sequence`. When indexed by a Unicode ordinal (an integer), the " +"table object can do any of the following: return a Unicode ordinal or a " +"string, to map the character to one or more other characters; return " +"``None``, to delete the character from the return string; or raise " +"a :exc:`LookupError` exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2356 +#: ../../library/stdtypes.rst:2549 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2359 +#: ../../library/stdtypes.rst:2552 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2365 +#: ../../library/stdtypes.rst:2558 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s`` " @@ -3648,14 +4086,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2371 +#: ../../library/stdtypes.rst:2564 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." +"Unicode16.0.0/core-spec/chapter-3/#G33992>`__." msgstr "" -#: ../../library/stdtypes.rst:2378 +#: ../../library/stdtypes.rst:2571 msgid "" "Return a copy of the string left filled with ASCII ``'0'`` digits to make a " "string of length *width*. A leading sign prefix (``'+'``/``'-'``) is handled " @@ -3663,7 +4101,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2386 +#: ../../library/stdtypes.rst:2579 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -3675,27 +4113,27 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2407 +#: ../../library/stdtypes.rst:2600 msgid "Formatted String Literals (f-strings)" msgstr "" -#: ../../library/stdtypes.rst:2410 +#: ../../library/stdtypes.rst:2603 msgid "" "The :keyword:`await` and :keyword:`async for` can be used in expressions " "within f-strings." msgstr "" -#: ../../library/stdtypes.rst:2413 +#: ../../library/stdtypes.rst:2606 msgid "Added the debugging operator (``=``)" msgstr "" -#: ../../library/stdtypes.rst:2415 +#: ../../library/stdtypes.rst:2608 msgid "" "Many restrictions on expressions within f-strings have been removed. " "Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../library/stdtypes.rst:2419 +#: ../../library/stdtypes.rst:2612 msgid "" "An :dfn:`f-string` (formally a :dfn:`formatted string literal`) is a string " "literal that is prefixed with ``f`` or ``F``. This type of string literal " @@ -3705,7 +4143,7 @@ msgid "" "into regular :class:`str` objects. For example:" msgstr "" -#: ../../library/stdtypes.rst:2427 +#: ../../library/stdtypes.rst:2620 msgid "" ">>> who = 'nobody'\n" ">>> nationality = 'Spanish'\n" @@ -3717,11 +4155,11 @@ msgstr "" ">>> f'{who.title()} expects the {nationality} Inquisition!'\n" "'Nobody expects the Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2434 +#: ../../library/stdtypes.rst:2627 msgid "It is also possible to use a multi line f-string:" msgstr "" -#: ../../library/stdtypes.rst:2436 +#: ../../library/stdtypes.rst:2629 msgid "" ">>> f'''This is a string\n" "... on two lines'''\n" @@ -3731,13 +4169,13 @@ msgstr "" "... on two lines'''\n" "'This is a string\\non two lines'" -#: ../../library/stdtypes.rst:2442 +#: ../../library/stdtypes.rst:2635 msgid "" "A single opening curly bracket, ``'{'``, marks a *replacement field* that " "can contain any Python expression:" msgstr "" -#: ../../library/stdtypes.rst:2445 +#: ../../library/stdtypes.rst:2638 msgid "" ">>> nationality = 'Spanish'\n" ">>> f'The {nationality} Inquisition!'\n" @@ -3747,11 +4185,11 @@ msgstr "" ">>> f'The {nationality} Inquisition!'\n" "'The Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2451 +#: ../../library/stdtypes.rst:2644 msgid "To include a literal ``{`` or ``}``, use a double bracket:" msgstr "" -#: ../../library/stdtypes.rst:2453 +#: ../../library/stdtypes.rst:2646 msgid "" ">>> x = 42\n" ">>> f'{{x}} is {x}'\n" @@ -3761,12 +4199,12 @@ msgstr "" ">>> f'{{x}} is {x}'\n" "'{x} is 42'" -#: ../../library/stdtypes.rst:2459 +#: ../../library/stdtypes.rst:2652 msgid "" "Functions can also be used, and :ref:`format specifiers `:" msgstr "" -#: ../../library/stdtypes.rst:2461 +#: ../../library/stdtypes.rst:2654 msgid "" ">>> from math import sqrt\n" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" @@ -3776,11 +4214,11 @@ msgstr "" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" "'√2 ≈ 1.41421'" -#: ../../library/stdtypes.rst:2467 +#: ../../library/stdtypes.rst:2660 msgid "Any non-string expression is converted using :func:`str`, by default:" msgstr "" -#: ../../library/stdtypes.rst:2469 +#: ../../library/stdtypes.rst:2662 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)}'\n" @@ -3790,46 +4228,46 @@ msgstr "" ">>> f'{Fraction(1, 3)}'\n" "'1/3'" -#: ../../library/stdtypes.rst:2475 +#: ../../library/stdtypes.rst:2668 msgid "" "To use an explicit conversion, use the ``!`` (exclamation mark) operator, " "followed by any of the valid formats, which are:" msgstr "" -#: ../../library/stdtypes.rst:2479 ../../library/stdtypes.rst:2647 -#: ../../library/stdtypes.rst:3867 +#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:2841 +#: ../../library/stdtypes.rst:4101 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:2481 +#: ../../library/stdtypes.rst:2674 msgid "``!a``" msgstr "``!a``" -#: ../../library/stdtypes.rst:2481 +#: ../../library/stdtypes.rst:2674 msgid ":func:`ascii`" msgstr ":func:`ascii`" -#: ../../library/stdtypes.rst:2482 +#: ../../library/stdtypes.rst:2675 msgid "``!r``" msgstr "``!r``" -#: ../../library/stdtypes.rst:2482 +#: ../../library/stdtypes.rst:2675 msgid ":func:`repr`" msgstr ":func:`repr`" -#: ../../library/stdtypes.rst:2483 +#: ../../library/stdtypes.rst:2676 msgid "``!s``" msgstr "``!s``" -#: ../../library/stdtypes.rst:2483 +#: ../../library/stdtypes.rst:2676 msgid ":func:`str`" msgstr ":func:`str`" -#: ../../library/stdtypes.rst:2486 +#: ../../library/stdtypes.rst:2679 msgid "For example:" msgstr "舉例來說:" -#: ../../library/stdtypes.rst:2488 +#: ../../library/stdtypes.rst:2681 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)!s}'\n" @@ -3849,7 +4287,7 @@ msgstr "" ">>> print(f'{question!a}')\n" "'\\xbfD\\xf3nde est\\xe1 el Presidente?'" -#: ../../library/stdtypes.rst:2499 +#: ../../library/stdtypes.rst:2692 msgid "" "While debugging it may be helpful to see both the expression and its value, " "by using the equals sign (``=``) after the expression. This preserves spaces " @@ -3857,7 +4295,7 @@ msgid "" "debugging operator uses the :func:`repr` (``!r``) conversion. For example:" msgstr "" -#: ../../library/stdtypes.rst:2505 +#: ../../library/stdtypes.rst:2698 msgid "" ">>> from fractions import Fraction\n" ">>> calculation = Fraction(1, 3)\n" @@ -3877,7 +4315,7 @@ msgstr "" ">>> f'{calculation = !s}'\n" "'calculation = 1/3'" -#: ../../library/stdtypes.rst:2516 +#: ../../library/stdtypes.rst:2709 msgid "" "Once the output has been evaluated, it can be formatted using a :ref:`format " "specifier ` following a colon (``':'``). After the expression " @@ -3887,7 +4325,7 @@ msgid "" "used as the final value for the replacement field. For example:" msgstr "" -#: ../../library/stdtypes.rst:2524 +#: ../../library/stdtypes.rst:2717 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 7):.6f}'\n" @@ -3896,22 +4334,26 @@ msgid "" "'___+1/7___'" msgstr "" -#: ../../library/stdtypes.rst:2536 +#: ../../library/stdtypes.rst:2729 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2549 +#: ../../library/stdtypes.rst:2742 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " -"dictionaries correctly). Using the newer :ref:`formatted string literals `, the :meth:`str.format` interface, or :ref:`template strings " -"` may help avoid these errors. Each of these alternatives " -"provides their own trade-offs and benefits of simplicity, flexibility, and/" -"or extensibility." +"dictionaries correctly)." +msgstr "" + +#: ../../library/stdtypes.rst:2746 +msgid "" +"Using :ref:`formatted string literals `, the :meth:`str.format` " +"interface, or :class:`string.Template` may help avoid these errors. Each of " +"these alternatives provides their own trade-offs and benefits of simplicity, " +"flexibility, and/or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2557 +#: ../../library/stdtypes.rst:2751 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -3921,13 +4363,13 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:2564 +#: ../../library/stdtypes.rst:2758 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." msgstr "" -#: ../../library/stdtypes.rst:2569 +#: ../../library/stdtypes.rst:2763 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -3935,36 +4377,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2579 ../../library/stdtypes.rst:3799 +#: ../../library/stdtypes.rst:2773 ../../library/stdtypes.rst:4033 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2582 ../../library/stdtypes.rst:3802 +#: ../../library/stdtypes.rst:2776 ../../library/stdtypes.rst:4036 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2584 ../../library/stdtypes.rst:3804 +#: ../../library/stdtypes.rst:2778 ../../library/stdtypes.rst:4038 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2587 ../../library/stdtypes.rst:3807 +#: ../../library/stdtypes.rst:2781 ../../library/stdtypes.rst:4041 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2590 ../../library/stdtypes.rst:3810 +#: ../../library/stdtypes.rst:2784 ../../library/stdtypes.rst:4044 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is read from the next element of the tuple in *values*, and the " "object to convert comes after the minimum field width and optional precision." msgstr "" -#: ../../library/stdtypes.rst:2594 ../../library/stdtypes.rst:3814 +#: ../../library/stdtypes.rst:2788 ../../library/stdtypes.rst:4048 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -3972,15 +4414,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2599 ../../library/stdtypes.rst:3819 +#: ../../library/stdtypes.rst:2793 ../../library/stdtypes.rst:4053 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2601 ../../library/stdtypes.rst:3821 +#: ../../library/stdtypes.rst:2795 ../../library/stdtypes.rst:4055 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2603 +#: ../../library/stdtypes.rst:2797 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the string *must* include a parenthesised mapping key into that " @@ -3988,293 +4430,293 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2612 ../../library/stdtypes.rst:3832 +#: ../../library/stdtypes.rst:2806 ../../library/stdtypes.rst:4066 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2615 ../../library/stdtypes.rst:3835 +#: ../../library/stdtypes.rst:2809 ../../library/stdtypes.rst:4069 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2624 ../../library/stdtypes.rst:3844 +#: ../../library/stdtypes.rst:2818 ../../library/stdtypes.rst:4078 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3846 +#: ../../library/stdtypes.rst:2820 ../../library/stdtypes.rst:4080 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3846 +#: ../../library/stdtypes.rst:2820 ../../library/stdtypes.rst:4080 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2629 ../../library/stdtypes.rst:3849 +#: ../../library/stdtypes.rst:2823 ../../library/stdtypes.rst:4083 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2629 ../../library/stdtypes.rst:3849 +#: ../../library/stdtypes.rst:2823 ../../library/stdtypes.rst:4083 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2631 ../../library/stdtypes.rst:3851 +#: ../../library/stdtypes.rst:2825 ../../library/stdtypes.rst:4085 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2631 ../../library/stdtypes.rst:3851 +#: ../../library/stdtypes.rst:2825 ../../library/stdtypes.rst:4085 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2634 ../../library/stdtypes.rst:3854 +#: ../../library/stdtypes.rst:2828 ../../library/stdtypes.rst:4088 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2634 ../../library/stdtypes.rst:3854 +#: ../../library/stdtypes.rst:2828 ../../library/stdtypes.rst:4088 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2637 ../../library/stdtypes.rst:3857 +#: ../../library/stdtypes.rst:2831 ../../library/stdtypes.rst:4091 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2637 ../../library/stdtypes.rst:3857 +#: ../../library/stdtypes.rst:2831 ../../library/stdtypes.rst:4091 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2641 ../../library/stdtypes.rst:3861 +#: ../../library/stdtypes.rst:2835 ../../library/stdtypes.rst:4095 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" -#: ../../library/stdtypes.rst:2644 ../../library/stdtypes.rst:3864 +#: ../../library/stdtypes.rst:2838 ../../library/stdtypes.rst:4098 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2649 ../../library/stdtypes.rst:3869 +#: ../../library/stdtypes.rst:2843 ../../library/stdtypes.rst:4103 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2649 ../../library/stdtypes.rst:2651 -#: ../../library/stdtypes.rst:3869 ../../library/stdtypes.rst:3871 +#: ../../library/stdtypes.rst:2843 ../../library/stdtypes.rst:2845 +#: ../../library/stdtypes.rst:4103 ../../library/stdtypes.rst:4105 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2651 ../../library/stdtypes.rst:3871 +#: ../../library/stdtypes.rst:2845 ../../library/stdtypes.rst:4105 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2653 ../../library/stdtypes.rst:3873 +#: ../../library/stdtypes.rst:2847 ../../library/stdtypes.rst:4107 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2653 ../../library/stdtypes.rst:3873 +#: ../../library/stdtypes.rst:2847 ../../library/stdtypes.rst:4107 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2655 ../../library/stdtypes.rst:3875 +#: ../../library/stdtypes.rst:2849 ../../library/stdtypes.rst:4109 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2655 ../../library/stdtypes.rst:3875 +#: ../../library/stdtypes.rst:2849 ../../library/stdtypes.rst:4109 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2657 ../../library/stdtypes.rst:3877 +#: ../../library/stdtypes.rst:2851 ../../library/stdtypes.rst:4111 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2657 ../../library/stdtypes.rst:3877 +#: ../../library/stdtypes.rst:2851 ../../library/stdtypes.rst:4111 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2659 ../../library/stdtypes.rst:3879 +#: ../../library/stdtypes.rst:2853 ../../library/stdtypes.rst:4113 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2659 ../../library/stdtypes.rst:3879 +#: ../../library/stdtypes.rst:2853 ../../library/stdtypes.rst:4113 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:3881 +#: ../../library/stdtypes.rst:2855 ../../library/stdtypes.rst:4115 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:3881 +#: ../../library/stdtypes.rst:2855 ../../library/stdtypes.rst:4115 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2663 ../../library/stdtypes.rst:3883 +#: ../../library/stdtypes.rst:2857 ../../library/stdtypes.rst:4117 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2663 ../../library/stdtypes.rst:3883 +#: ../../library/stdtypes.rst:2857 ../../library/stdtypes.rst:4117 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2665 ../../library/stdtypes.rst:3885 +#: ../../library/stdtypes.rst:2859 ../../library/stdtypes.rst:4119 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2665 ../../library/stdtypes.rst:2667 -#: ../../library/stdtypes.rst:3885 ../../library/stdtypes.rst:3887 +#: ../../library/stdtypes.rst:2859 ../../library/stdtypes.rst:2861 +#: ../../library/stdtypes.rst:4119 ../../library/stdtypes.rst:4121 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2667 ../../library/stdtypes.rst:3887 +#: ../../library/stdtypes.rst:2861 ../../library/stdtypes.rst:4121 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2669 ../../library/stdtypes.rst:3889 +#: ../../library/stdtypes.rst:2863 ../../library/stdtypes.rst:4123 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2669 ../../library/stdtypes.rst:3889 +#: ../../library/stdtypes.rst:2863 ../../library/stdtypes.rst:4123 msgid "" "Floating-point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2673 ../../library/stdtypes.rst:3893 +#: ../../library/stdtypes.rst:2867 ../../library/stdtypes.rst:4127 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2673 ../../library/stdtypes.rst:3893 +#: ../../library/stdtypes.rst:2867 ../../library/stdtypes.rst:4127 msgid "" "Floating-point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2677 ../../library/stdtypes.rst:3897 +#: ../../library/stdtypes.rst:2871 ../../library/stdtypes.rst:4131 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2677 +#: ../../library/stdtypes.rst:2871 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2680 ../../library/stdtypes.rst:3910 +#: ../../library/stdtypes.rst:2874 ../../library/stdtypes.rst:4144 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2680 +#: ../../library/stdtypes.rst:2874 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2683 ../../library/stdtypes.rst:3904 +#: ../../library/stdtypes.rst:2877 ../../library/stdtypes.rst:4138 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2683 +#: ../../library/stdtypes.rst:2877 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2686 ../../library/stdtypes.rst:3907 +#: ../../library/stdtypes.rst:2880 ../../library/stdtypes.rst:4141 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2686 +#: ../../library/stdtypes.rst:2880 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2689 ../../library/stdtypes.rst:3913 +#: ../../library/stdtypes.rst:2883 ../../library/stdtypes.rst:4147 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2689 ../../library/stdtypes.rst:3913 +#: ../../library/stdtypes.rst:2883 ../../library/stdtypes.rst:4147 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2696 ../../library/stdtypes.rst:3920 +#: ../../library/stdtypes.rst:2890 ../../library/stdtypes.rst:4154 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2700 ../../library/stdtypes.rst:3924 +#: ../../library/stdtypes.rst:2894 ../../library/stdtypes.rst:4158 msgid "" "The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on " "whether the ``'x'`` or ``'X'`` format was used) to be inserted before the " "first digit." msgstr "" -#: ../../library/stdtypes.rst:2704 ../../library/stdtypes.rst:3928 +#: ../../library/stdtypes.rst:2898 ../../library/stdtypes.rst:4162 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2707 ../../library/stdtypes.rst:3931 +#: ../../library/stdtypes.rst:2901 ../../library/stdtypes.rst:4165 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2711 ../../library/stdtypes.rst:3935 +#: ../../library/stdtypes.rst:2905 ../../library/stdtypes.rst:4169 msgid "" "The alternate form causes the result to always contain a decimal point, and " "trailing zeroes are not removed as they would otherwise be." msgstr "" -#: ../../library/stdtypes.rst:2714 ../../library/stdtypes.rst:3938 +#: ../../library/stdtypes.rst:2908 ../../library/stdtypes.rst:4172 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2718 ../../library/stdtypes.rst:3942 +#: ../../library/stdtypes.rst:2912 ../../library/stdtypes.rst:4176 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2721 ../../library/stdtypes.rst:3951 +#: ../../library/stdtypes.rst:2915 ../../library/stdtypes.rst:4185 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2723 +#: ../../library/stdtypes.rst:2917 msgid "" "Since Python strings have an explicit length, ``%s`` conversions do not " "assume that ``'\\0'`` is the end of the string." msgstr "" -#: ../../library/stdtypes.rst:2728 +#: ../../library/stdtypes.rst:2922 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2739 +#: ../../library/stdtypes.rst:2933 msgid "" -"Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" -"`memoryview`" +"Binary Sequence Types " +"--- :class:`bytes`, :class:`bytearray`, :class:`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2747 +#: ../../library/stdtypes.rst:2941 msgid "" -"The core built-in types for manipulating binary data are :class:`bytes` and :" -"class:`bytearray`. They are supported by :class:`memoryview` which uses the :" -"ref:`buffer protocol ` to access the memory of other binary " -"objects without needing to make a copy." +"The core built-in types for manipulating binary data are :class:`bytes` " +"and :class:`bytearray`. They are supported by :class:`memoryview` which uses " +"the :ref:`buffer protocol ` to access the memory of other " +"binary objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2752 +#: ../../library/stdtypes.rst:2946 msgid "" "The :mod:`array` module supports efficient storage of basic data types like " "32-bit integers and IEEE754 double-precision floating values." msgstr "" -#: ../../library/stdtypes.rst:2758 +#: ../../library/stdtypes.rst:2952 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2762 +#: ../../library/stdtypes.rst:2956 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -4282,40 +4724,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2770 +#: ../../library/stdtypes.rst:2964 msgid "" "Firstly, the syntax for bytes literals is largely the same as that for " "string literals, except that a ``b`` prefix is added:" msgstr "" -#: ../../library/stdtypes.rst:2773 +#: ../../library/stdtypes.rst:2967 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2774 +#: ../../library/stdtypes.rst:2968 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2775 +#: ../../library/stdtypes.rst:2969 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2777 +#: ../../library/stdtypes.rst:2971 msgid "" "Only ASCII characters are permitted in bytes literals (regardless of the " "declared source code encoding). Any binary values over 127 must be entered " "into bytes literals using the appropriate escape sequence." msgstr "" -#: ../../library/stdtypes.rst:2781 +#: ../../library/stdtypes.rst:2975 msgid "" "As with string literals, bytes literals may also use a ``r`` prefix to " "disable processing of escape sequences. See :ref:`strings` for more about " "the various forms of bytes literal, including supported escape sequences." msgstr "" -#: ../../library/stdtypes.rst:2785 +#: ../../library/stdtypes.rst:2979 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -4328,29 +4770,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2795 +#: ../../library/stdtypes.rst:2989 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2798 +#: ../../library/stdtypes.rst:2992 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2799 +#: ../../library/stdtypes.rst:2993 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2800 +#: ../../library/stdtypes.rst:2994 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2802 +#: ../../library/stdtypes.rst:2996 msgid "Also see the :ref:`bytes ` built-in." msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:2804 +#: ../../library/stdtypes.rst:2998 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4358,32 +4800,38 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:2810 +#: ../../library/stdtypes.rst:3004 msgid "" "This :class:`bytes` class method returns a bytes object, decoding the given " "string object. The string must contain two hexadecimal digits per byte, " "with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2817 +#: ../../library/stdtypes.rst:3011 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:2821 +#: ../../library/stdtypes.rst:3015 +msgid "" +":meth:`bytes.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-like " +"objects ` as input." +msgstr "" + +#: ../../library/stdtypes.rst:3019 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2827 ../../library/stdtypes.rst:2914 +#: ../../library/stdtypes.rst:3025 ../../library/stdtypes.rst:3116 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:2833 +#: ../../library/stdtypes.rst:3031 msgid "" "If you want to make the hex string easier to read, you can specify a single " "character separator *sep* parameter to include in the output. By default, " @@ -4392,13 +4840,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:2850 +#: ../../library/stdtypes.rst:3048 msgid "" ":meth:`bytes.hex` now supports optional *sep* and *bytes_per_sep* parameters " "to insert separators between bytes in the hex output." msgstr "" -#: ../../library/stdtypes.rst:2854 +#: ../../library/stdtypes.rst:3052 msgid "" "Since bytes objects are sequences of integers (akin to a tuple), for a bytes " "object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes " @@ -4406,58 +4854,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2859 +#: ../../library/stdtypes.rst:3057 msgid "" "The representation of bytes objects uses the literal format (``b'...'``) " "since it is often more useful than e.g. ``bytes([46, 46, 46])``. You can " "always convert a bytes object into a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2867 +#: ../../library/stdtypes.rst:3065 msgid "Bytearray Objects" msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:2871 +#: ../../library/stdtypes.rst:3069 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:2877 +#: ../../library/stdtypes.rst:3075 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:2880 +#: ../../library/stdtypes.rst:3078 msgid "Creating an empty instance: ``bytearray()``" msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:2881 +#: ../../library/stdtypes.rst:3079 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:2882 +#: ../../library/stdtypes.rst:3080 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2883 +#: ../../library/stdtypes.rst:3081 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:2885 +#: ../../library/stdtypes.rst:3083 msgid "" "As bytearray objects are mutable, they support the :ref:`mutable ` sequence operations in addition to the common bytes and bytearray " "operations described in :ref:`bytes-methods`." msgstr "" -#: ../../library/stdtypes.rst:2889 +#: ../../library/stdtypes.rst:3087 msgid "Also see the :ref:`bytearray ` built-in." msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:2891 +#: ../../library/stdtypes.rst:3089 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4465,33 +4913,66 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:2897 +#: ../../library/stdtypes.rst:3095 msgid "" "This :class:`bytearray` class method returns bytearray object, decoding the " "given string object. The string must contain two hexadecimal digits per " "byte, with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2904 +#: ../../library/stdtypes.rst:3102 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:2908 +#: ../../library/stdtypes.rst:3106 +msgid "" +":meth:`bytearray.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-" +"like objects ` as input." +msgstr "" + +#: ../../library/stdtypes.rst:3110 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2922 +#: ../../library/stdtypes.rst:3124 msgid "" "Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:2927 +#: ../../library/stdtypes.rst:3131 +msgid "" +"Resize the :class:`bytearray` to contain *size* bytes. *size* must be " +"greater than or equal to 0." +msgstr "" + +#: ../../library/stdtypes.rst:3134 +msgid "" +"If the :class:`bytearray` needs to shrink, bytes beyond *size* are truncated." +msgstr "" + +#: ../../library/stdtypes.rst:3136 +msgid "" +"If the :class:`bytearray` needs to grow, all new bytes, those beyond *size*, " +"will be set to null bytes." +msgstr "" + +#: ../../library/stdtypes.rst:3140 +#, fuzzy +msgid "This is equivalent to:" +msgstr "等同於: ::" + +#: ../../library/stdtypes.rst:3148 +#, fuzzy +msgid "Examples:" +msgstr "範例: ::" + +#: ../../library/stdtypes.rst:3161 msgid "" "Since bytearray objects are sequences of integers (akin to a list), for a " "bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be " @@ -4499,7 +4980,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2932 +#: ../../library/stdtypes.rst:3166 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -4507,11 +4988,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2941 +#: ../../library/stdtypes.rst:3175 msgid "Bytes and Bytearray Operations" msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:2946 +#: ../../library/stdtypes.rst:3180 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -4520,14 +5001,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:2954 +#: ../../library/stdtypes.rst:3188 msgid "" "The methods on bytes and bytearray objects don't accept strings as their " "arguments, just as the methods on strings don't accept bytes as their " "arguments. For example, you have to write::" msgstr "" -#: ../../library/stdtypes.rst:2958 +#: ../../library/stdtypes.rst:3192 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -4535,11 +5016,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:2961 +#: ../../library/stdtypes.rst:3195 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:2963 +#: ../../library/stdtypes.rst:3197 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -4547,60 +5028,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:2966 +#: ../../library/stdtypes.rst:3200 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" -#: ../../library/stdtypes.rst:2971 +#: ../../library/stdtypes.rst:3205 msgid "" "Using these ASCII based operations to manipulate binary data that is not " "stored in an ASCII based format may lead to data corruption." msgstr "" -#: ../../library/stdtypes.rst:2974 +#: ../../library/stdtypes.rst:3208 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:2980 +#: ../../library/stdtypes.rst:3214 msgid "" "Return the number of non-overlapping occurrences of subsequence *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:2984 ../../library/stdtypes.rst:3089 -#: ../../library/stdtypes.rst:3111 ../../library/stdtypes.rst:3177 -#: ../../library/stdtypes.rst:3190 +#: ../../library/stdtypes.rst:3218 ../../library/stdtypes.rst:3323 +#: ../../library/stdtypes.rst:3345 ../../library/stdtypes.rst:3411 +#: ../../library/stdtypes.rst:3424 msgid "" "The subsequence to search for may be any :term:`bytes-like object` or an " "integer in the range 0 to 255." msgstr "" -#: ../../library/stdtypes.rst:2987 +#: ../../library/stdtypes.rst:3221 msgid "" "If *sub* is empty, returns the number of empty slices between characters " "which is the length of the bytes object plus one." msgstr "" -#: ../../library/stdtypes.rst:2990 ../../library/stdtypes.rst:3101 -#: ../../library/stdtypes.rst:3114 ../../library/stdtypes.rst:3180 -#: ../../library/stdtypes.rst:3193 +#: ../../library/stdtypes.rst:3224 ../../library/stdtypes.rst:3335 +#: ../../library/stdtypes.rst:3348 ../../library/stdtypes.rst:3414 +#: ../../library/stdtypes.rst:3427 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:2997 +#: ../../library/stdtypes.rst:3231 msgid "" "If the binary data starts with the *prefix* string, return " "``bytes[len(prefix):]``. Otherwise, return a copy of the original binary " "data::" msgstr "" -#: ../../library/stdtypes.rst:3001 +#: ../../library/stdtypes.rst:3235 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -4612,32 +5093,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:3006 +#: ../../library/stdtypes.rst:3240 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" -#: ../../library/stdtypes.rst:3010 ../../library/stdtypes.rst:3032 -#: ../../library/stdtypes.rst:3165 ../../library/stdtypes.rst:3258 -#: ../../library/stdtypes.rst:3272 ../../library/stdtypes.rst:3302 -#: ../../library/stdtypes.rst:3316 ../../library/stdtypes.rst:3357 -#: ../../library/stdtypes.rst:3427 ../../library/stdtypes.rst:3445 -#: ../../library/stdtypes.rst:3473 ../../library/stdtypes.rst:3612 -#: ../../library/stdtypes.rst:3667 ../../library/stdtypes.rst:3710 -#: ../../library/stdtypes.rst:3731 ../../library/stdtypes.rst:3753 -#: ../../library/stdtypes.rst:3955 +#: ../../library/stdtypes.rst:3244 ../../library/stdtypes.rst:3266 +#: ../../library/stdtypes.rst:3399 ../../library/stdtypes.rst:3492 +#: ../../library/stdtypes.rst:3506 ../../library/stdtypes.rst:3536 +#: ../../library/stdtypes.rst:3550 ../../library/stdtypes.rst:3591 +#: ../../library/stdtypes.rst:3661 ../../library/stdtypes.rst:3679 +#: ../../library/stdtypes.rst:3707 ../../library/stdtypes.rst:3846 +#: ../../library/stdtypes.rst:3901 ../../library/stdtypes.rst:3944 +#: ../../library/stdtypes.rst:3965 ../../library/stdtypes.rst:3987 +#: ../../library/stdtypes.rst:4189 msgid "" "The bytearray version of this method does *not* operate in place - it always " "produces a new object, even if no changes were made." msgstr "" -#: ../../library/stdtypes.rst:3019 +#: ../../library/stdtypes.rst:3253 msgid "" "If the binary data ends with the *suffix* string and that *suffix* is not " "empty, return ``bytes[:-len(suffix)]``. Otherwise, return a copy of the " "original binary data::" msgstr "" -#: ../../library/stdtypes.rst:3023 +#: ../../library/stdtypes.rst:3257 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -4649,37 +5130,37 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:3028 +#: ../../library/stdtypes.rst:3262 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3041 +#: ../../library/stdtypes.rst:3275 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:3046 +#: ../../library/stdtypes.rst:3280 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " -"are ``'ignore'``, ``'replace'``, and any other name registered via :func:" -"`codecs.register_error`. See :ref:`error-handlers` for details." +"are ``'ignore'``, ``'replace'``, and any other name registered " +"via :func:`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:3052 +#: ../../library/stdtypes.rst:3286 msgid "" "For performance reasons, the value of *errors* is not checked for validity " -"unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" -"`debug build ` is used." +"unless a decoding error actually occurs, :ref:`devmode` is enabled or " +"a :ref:`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:3058 +#: ../../library/stdtypes.rst:3292 msgid "" -"Passing the *encoding* argument to :class:`str` allows decoding any :term:" -"`bytes-like object` directly, without needing to make a temporary :class:`!" -"bytes` or :class:`!bytearray` object." +"Passing the *encoding* argument to :class:`str` allows decoding " +"any :term:`bytes-like object` directly, without needing to make a " +"temporary :class:`!bytes` or :class:`!bytearray` object." msgstr "" -#: ../../library/stdtypes.rst:3073 +#: ../../library/stdtypes.rst:3307 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -4687,11 +5168,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3078 +#: ../../library/stdtypes.rst:3312 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3084 +#: ../../library/stdtypes.rst:3318 msgid "" "Return the lowest index in the data where the subsequence *sub* is found, " "such that *sub* is contained in the slice ``s[start:end]``. Optional " @@ -4699,14 +5180,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3094 +#: ../../library/stdtypes.rst:3328 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " -"position of *sub*. To check if *sub* is a substring or not, use the :" -"keyword:`in` operator::" +"position of *sub*. To check if *sub* is a substring or not, use " +"the :keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:3098 +#: ../../library/stdtypes.rst:3332 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -4714,13 +5195,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:3108 +#: ../../library/stdtypes.rst:3342 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:3121 +#: ../../library/stdtypes.rst:3355 msgid "" "Return a bytes or bytearray object which is the concatenation of the binary " "data sequences in *iterable*. A :exc:`TypeError` will be raised if there " @@ -4730,15 +5211,15 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:3132 +#: ../../library/stdtypes.rst:3366 msgid "" -"This static method returns a translation table usable for :meth:`bytes." -"translate` that will map each character in *from* into the character at the " -"same position in *to*; *from* and *to* must both be :term:`bytes-like " -"objects ` and have the same length." +"This static method returns a translation table usable " +"for :meth:`bytes.translate` that will map each character in *from* into the " +"character at the same position in *to*; *from* and *to* must both " +"be :term:`bytes-like objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:3143 +#: ../../library/stdtypes.rst:3377 msgid "" "Split the sequence at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4747,24 +5228,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:3150 ../../library/stdtypes.rst:3207 +#: ../../library/stdtypes.rst:3384 ../../library/stdtypes.rst:3441 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3156 +#: ../../library/stdtypes.rst:3390 msgid "" "Return a copy of the sequence with all occurrences of subsequence *old* " "replaced by *new*. If the optional argument *count* is given, only the " "first *count* occurrences are replaced." msgstr "" -#: ../../library/stdtypes.rst:3160 +#: ../../library/stdtypes.rst:3394 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3172 +#: ../../library/stdtypes.rst:3406 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -4772,13 +5253,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:3187 +#: ../../library/stdtypes.rst:3421 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3200 +#: ../../library/stdtypes.rst:3434 msgid "" "Split the sequence at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4787,7 +5268,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:3213 +#: ../../library/stdtypes.rst:3447 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -4795,11 +5276,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3218 +#: ../../library/stdtypes.rst:3452 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3224 +#: ../../library/stdtypes.rst:3458 msgid "" "Return a copy of the bytes or bytearray object where all bytes occurring in " "the optional argument *delete* are removed, and the remaining bytes have " @@ -4807,18 +5288,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3229 +#: ../../library/stdtypes.rst:3463 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3232 +#: ../../library/stdtypes.rst:3466 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3235 +#: ../../library/stdtypes.rst:3469 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -4826,11 +5307,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3238 +#: ../../library/stdtypes.rst:3472 msgid "*delete* is now supported as a keyword argument." msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3242 +#: ../../library/stdtypes.rst:3476 msgid "" "The following methods on bytes and bytearray objects have default behaviours " "that assume the use of ASCII compatible binary formats, but can still be " @@ -4839,7 +5320,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3251 +#: ../../library/stdtypes.rst:3485 msgid "" "Return a copy of the object centered in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4847,7 +5328,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3265 +#: ../../library/stdtypes.rst:3499 msgid "" "Return a copy of the object left justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4855,7 +5336,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3279 +#: ../../library/stdtypes.rst:3513 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -4864,7 +5345,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3285 +#: ../../library/stdtypes.rst:3519 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -4876,14 +5357,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3290 +#: ../../library/stdtypes.rst:3524 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removeprefix` for a method that will remove a " "single prefix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3295 +#: ../../library/stdtypes.rst:3529 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -4895,7 +5376,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3309 +#: ../../library/stdtypes.rst:3543 msgid "" "Return a copy of the object right justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4903,7 +5384,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3323 +#: ../../library/stdtypes.rst:3557 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are " @@ -4913,7 +5394,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3334 +#: ../../library/stdtypes.rst:3568 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -4922,7 +5403,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3340 +#: ../../library/stdtypes.rst:3574 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -4934,14 +5415,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3345 +#: ../../library/stdtypes.rst:3579 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removesuffix` for a method that will remove a " "single suffix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3350 +#: ../../library/stdtypes.rst:3584 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -4953,7 +5434,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3364 +#: ../../library/stdtypes.rst:3598 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given and non-negative, at most " @@ -4962,7 +5443,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3370 +#: ../../library/stdtypes.rst:3604 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " @@ -4973,7 +5454,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3380 +#: ../../library/stdtypes.rst:3614 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -4993,7 +5474,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3389 +#: ../../library/stdtypes.rst:3623 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive ASCII whitespace are regarded as a single " @@ -5003,7 +5484,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3399 +#: ../../library/stdtypes.rst:3633 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -5019,7 +5500,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3410 +#: ../../library/stdtypes.rst:3644 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *bytes* argument is a binary sequence specifying the set of " @@ -5028,7 +5509,7 @@ msgid "" "or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3417 +#: ../../library/stdtypes.rst:3651 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -5040,13 +5521,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3422 +#: ../../library/stdtypes.rst:3656 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3431 +#: ../../library/stdtypes.rst:3665 msgid "" "The following methods on bytes and bytearray objects assume the use of ASCII " "compatible binary formats and should not be applied to arbitrary binary " @@ -5054,14 +5535,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3439 +#: ../../library/stdtypes.rst:3673 msgid "" "Return a copy of the sequence with each byte interpreted as an ASCII " "character, and the first byte capitalized and the rest lowercased. Non-ASCII " "byte values are passed through unchanged." msgstr "" -#: ../../library/stdtypes.rst:3452 +#: ../../library/stdtypes.rst:3686 msgid "" "Return a copy of the sequence where all ASCII tab characters are replaced by " "one or more ASCII spaces, depending on the current column and the given tab " @@ -5077,7 +5558,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3466 +#: ../../library/stdtypes.rst:3700 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -5089,7 +5570,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3480 +#: ../../library/stdtypes.rst:3714 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -5098,7 +5579,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3488 +#: ../../library/stdtypes.rst:3722 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -5110,7 +5591,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3497 +#: ../../library/stdtypes.rst:3731 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -5118,7 +5599,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3504 +#: ../../library/stdtypes.rst:3738 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -5130,20 +5611,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3513 +#: ../../library/stdtypes.rst:3747 msgid "" "Return ``True`` if the sequence is empty or all bytes in the sequence are " "ASCII, ``False`` otherwise. ASCII bytes are in the range 0-0x7F." msgstr "" -#: ../../library/stdtypes.rst:3523 +#: ../../library/stdtypes.rst:3757 msgid "" "Return ``True`` if all bytes in the sequence are ASCII decimal digits and " "the sequence is not empty, ``False`` otherwise. ASCII decimal digits are " "those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3529 +#: ../../library/stdtypes.rst:3763 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -5155,13 +5636,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3538 +#: ../../library/stdtypes.rst:3772 msgid "" "Return ``True`` if there is at least one lowercase ASCII character in the " "sequence and no uppercase ASCII characters, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:3543 +#: ../../library/stdtypes.rst:3777 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -5173,16 +5654,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3548 ../../library/stdtypes.rst:3590 -#: ../../library/stdtypes.rst:3606 ../../library/stdtypes.rst:3656 -#: ../../library/stdtypes.rst:3725 +#: ../../library/stdtypes.rst:3782 ../../library/stdtypes.rst:3824 +#: ../../library/stdtypes.rst:3840 ../../library/stdtypes.rst:3890 +#: ../../library/stdtypes.rst:3959 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3556 +#: ../../library/stdtypes.rst:3790 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -5190,14 +5671,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3565 +#: ../../library/stdtypes.rst:3799 msgid "" "Return ``True`` if the sequence is ASCII titlecase and the sequence is not " "empty, ``False`` otherwise. See :meth:`bytes.title` for more details on the " "definition of \"titlecase\"." msgstr "" -#: ../../library/stdtypes.rst:3571 +#: ../../library/stdtypes.rst:3805 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -5209,14 +5690,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3580 +#: ../../library/stdtypes.rst:3814 msgid "" "Return ``True`` if there is at least one uppercase alphabetic ASCII " "character in the sequence and no lowercase ASCII characters, ``False`` " "otherwise." msgstr "" -#: ../../library/stdtypes.rst:3585 +#: ../../library/stdtypes.rst:3819 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -5228,13 +5709,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3598 +#: ../../library/stdtypes.rst:3832 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3603 +#: ../../library/stdtypes.rst:3837 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -5242,7 +5723,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3623 +#: ../../library/stdtypes.rst:3857 msgid "" "Return a list of the lines in the binary sequence, breaking at ASCII line " "boundaries. This method uses the :term:`universal newlines` approach to " @@ -5250,7 +5731,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3630 +#: ../../library/stdtypes.rst:3864 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -5262,14 +5743,14 @@ msgstr "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: ../../library/stdtypes.rst:3635 +#: ../../library/stdtypes.rst:3869 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:3639 +#: ../../library/stdtypes.rst:3873 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -5281,13 +5762,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3648 +#: ../../library/stdtypes.rst:3882 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" -#: ../../library/stdtypes.rst:3653 +#: ../../library/stdtypes.rst:3887 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -5295,22 +5776,22 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3660 +#: ../../library/stdtypes.rst:3894 msgid "" -"Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." -"swapcase() == bin`` for the binary versions. Case conversions are " -"symmetrical in ASCII, even though that is not generally true for arbitrary " -"Unicode code points." +"Unlike :func:`str.swapcase`, it is always the case that " +"``bin.swapcase().swapcase() == bin`` for the binary versions. Case " +"conversions are symmetrical in ASCII, even though that is not generally true " +"for arbitrary Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3674 +#: ../../library/stdtypes.rst:3908 msgid "" "Return a titlecased version of the binary sequence where words start with an " "uppercase ASCII character and the remaining characters are lowercase. " "Uncased byte values are left unmodified." msgstr "" -#: ../../library/stdtypes.rst:3680 +#: ../../library/stdtypes.rst:3914 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -5318,7 +5799,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3683 +#: ../../library/stdtypes.rst:3917 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -5326,7 +5807,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3693 +#: ../../library/stdtypes.rst:3927 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -5334,12 +5815,12 @@ msgstr "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:3696 +#: ../../library/stdtypes.rst:3930 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3698 +#: ../../library/stdtypes.rst:3932 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -5361,13 +5842,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:3717 +#: ../../library/stdtypes.rst:3951 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3722 +#: ../../library/stdtypes.rst:3956 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -5375,7 +5856,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:3738 +#: ../../library/stdtypes.rst:3972 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -5384,7 +5865,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3746 +#: ../../library/stdtypes.rst:3980 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5396,11 +5877,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:3760 +#: ../../library/stdtypes.rst:3994 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:3777 +#: ../../library/stdtypes.rst:4011 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -5408,17 +5889,17 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:3782 +#: ../../library/stdtypes.rst:4016 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " "*interpolation* operator. Given ``format % values`` (where *format* is a " "bytes object), ``%`` conversion specifications in *format* are replaced with " -"zero or more elements of *values*. The effect is similar to using the :c:" -"func:`sprintf` in the C language." +"zero or more elements of *values*. The effect is similar to using " +"the :c:func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:3789 +#: ../../library/stdtypes.rst:4023 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -5426,7 +5907,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3823 +#: ../../library/stdtypes.rst:4057 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the bytes object *must* include a parenthesised mapping key into " @@ -5434,73 +5915,77 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3897 +#: ../../library/stdtypes.rst:4109 +msgid "\\(8)" +msgstr "\\(8)" + +#: ../../library/stdtypes.rst:4131 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:3900 +#: ../../library/stdtypes.rst:4134 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:3900 +#: ../../library/stdtypes.rst:4134 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:3904 +#: ../../library/stdtypes.rst:4138 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3907 +#: ../../library/stdtypes.rst:4141 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:3910 +#: ../../library/stdtypes.rst:4144 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3910 +#: ../../library/stdtypes.rst:4144 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:3945 +#: ../../library/stdtypes.rst:4179 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3948 +#: ../../library/stdtypes.rst:4182 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3960 +#: ../../library/stdtypes.rst:4194 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:3967 +#: ../../library/stdtypes.rst:4201 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:3969 +#: ../../library/stdtypes.rst:4203 msgid "" ":class:`memoryview` objects allow Python code to access the internal data of " "an object that supports the :ref:`buffer protocol ` without " "copying." msgstr "" -#: ../../library/stdtypes.rst:3975 +#: ../../library/stdtypes.rst:4209 msgid "" "Create a :class:`memoryview` that references *object*. *object* must " "support the buffer protocol. Built-in objects that support the buffer " "protocol include :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/stdtypes.rst:3979 +#: ../../library/stdtypes.rst:4213 msgid "" "A :class:`memoryview` has the notion of an *element*, which is the atomic " "memory unit handled by the originating *object*. For many simple types such " @@ -5508,32 +5993,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:3984 +#: ../../library/stdtypes.rst:4218 msgid "" "``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which " "is the nested list representation of the view. If ``view.ndim = 1``, this is " "equal to the number of elements in the view." msgstr "" -#: ../../library/stdtypes.rst:3988 +#: ../../library/stdtypes.rst:4222 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:3991 +#: ../../library/stdtypes.rst:4225 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:3994 +#: ../../library/stdtypes.rst:4228 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:3997 +#: ../../library/stdtypes.rst:4231 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -5555,7 +6040,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:4007 +#: ../../library/stdtypes.rst:4241 msgid "" "If :class:`~memoryview.format` is one of the native format specifiers from " "the :mod:`struct` module, indexing with an integer or a tuple of integers is " @@ -5566,11 +6051,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:4016 +#: ../../library/stdtypes.rst:4250 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:4018 +#: ../../library/stdtypes.rst:4252 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -5592,13 +6077,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:4028 +#: ../../library/stdtypes.rst:4262 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:4031 +#: ../../library/stdtypes.rst:4265 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -5638,14 +6123,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:4049 +#: ../../library/stdtypes.rst:4283 msgid "" "One-dimensional memoryviews of :term:`hashable` (read-only) types with " "formats 'B', 'b' or 'c' are also hashable. The hash is defined as ``hash(m) " "== hash(m.tobytes())``::" msgstr "" -#: ../../library/stdtypes.rst:4053 +#: ../../library/stdtypes.rst:4287 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -5663,40 +6148,45 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:4061 +#: ../../library/stdtypes.rst:4295 msgid "" "One-dimensional memoryviews can now be sliced. One-dimensional memoryviews " "with formats 'B', 'b' or 'c' are now :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4065 +#: ../../library/stdtypes.rst:4299 msgid "" -"memoryview is now registered automatically with :class:`collections.abc." -"Sequence`" +"memoryview is now registered automatically " +"with :class:`collections.abc.Sequence`" msgstr "" -#: ../../library/stdtypes.rst:4069 +#: ../../library/stdtypes.rst:4303 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:4072 +#: ../../library/stdtypes.rst:4306 +msgid "memoryview is now a :term:`generic type`." +msgstr "" + +#: ../../library/stdtypes.rst:4309 msgid ":class:`memoryview` has several methods:" msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:4076 +#: ../../library/stdtypes.rst:4313 msgid "" "A memoryview and a :pep:`3118` exporter are equal if their shapes are " "equivalent and if all corresponding values are equal when the operands' " "respective format codes are interpreted using :mod:`struct` syntax." msgstr "" -#: ../../library/stdtypes.rst:4080 +#: ../../library/stdtypes.rst:4317 msgid "" -"For the subset of :mod:`struct` format strings currently supported by :meth:" -"`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" +"For the subset of :mod:`struct` format strings currently supported " +"by :meth:`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == " +"w.tolist()``::" msgstr "" -#: ../../library/stdtypes.rst:4083 +#: ../../library/stdtypes.rst:4320 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -5730,14 +6220,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:4099 +#: ../../library/stdtypes.rst:4336 msgid "" "If either format string is not supported by the :mod:`struct` module, then " "the objects will always compare as unequal (even if the format strings and " "buffer contents are identical)::" msgstr "" -#: ../../library/stdtypes.rst:4103 +#: ../../library/stdtypes.rst:4340 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -5763,25 +6253,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:4115 +#: ../../library/stdtypes.rst:4352 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:4118 +#: ../../library/stdtypes.rst:4355 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:4124 +#: ../../library/stdtypes.rst:4361 msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" -#: ../../library/stdtypes.rst:4127 +#: ../../library/stdtypes.rst:4364 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -5795,7 +6285,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:4133 +#: ../../library/stdtypes.rst:4370 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -5803,7 +6293,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:4138 +#: ../../library/stdtypes.rst:4375 msgid "" "*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the " "original array is converted to C or Fortran order. For contiguous views, 'A' " @@ -5812,13 +6302,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:4148 +#: ../../library/stdtypes.rst:4385 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:4151 +#: ../../library/stdtypes.rst:4388 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -5828,18 +6318,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:4157 +#: ../../library/stdtypes.rst:4394 msgid "" "Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:4164 +#: ../../library/stdtypes.rst:4401 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:4166 +#: ../../library/stdtypes.rst:4403 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -5857,19 +6347,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:4174 +#: ../../library/stdtypes.rst:4411 msgid "" -":meth:`tolist` now supports all single character native formats in :mod:" -"`struct` module syntax as well as multi-dimensional representations." +":meth:`tolist` now supports all single character native formats " +"in :mod:`struct` module syntax as well as multi-dimensional representations." msgstr "" -#: ../../library/stdtypes.rst:4181 +#: ../../library/stdtypes.rst:4418 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:4184 +#: ../../library/stdtypes.rst:4421 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -5895,23 +6385,23 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:4200 +#: ../../library/stdtypes.rst:4437 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " -"objects take special actions when a view is held on them (for example, a :" -"class:`bytearray` would temporarily forbid resizing); therefore, calling " +"objects take special actions when a view is held on them (for example, " +"a :class:`bytearray` would temporarily forbid resizing); therefore, calling " "release() is handy to remove these restrictions (and free any dangling " "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:4206 +#: ../../library/stdtypes.rst:4443 msgid "" "After this method has been called, any further operation on the view raises " "a :class:`ValueError` (except :meth:`release` itself which can be called " "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:4210 +#: ../../library/stdtypes.rst:4447 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -5927,13 +6417,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4217 +#: ../../library/stdtypes.rst:4454 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4220 +#: ../../library/stdtypes.rst:4457 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -5953,7 +6443,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4234 +#: ../../library/stdtypes.rst:4471 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -5962,19 +6452,19 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4240 +#: ../../library/stdtypes.rst:4477 msgid "" -"The destination format is restricted to a single element native format in :" -"mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " -"'c'). The byte length of the result must be the same as the original length. " -"Note that all byte lengths may depend on the operating system." +"The destination format is restricted to a single element native format " +"in :mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' " +"or 'c'). The byte length of the result must be the same as the original " +"length. Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4246 +#: ../../library/stdtypes.rst:4483 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4248 +#: ../../library/stdtypes.rst:4485 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -6018,11 +6508,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4269 +#: ../../library/stdtypes.rst:4506 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4271 +#: ../../library/stdtypes.rst:4508 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -6046,11 +6536,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4282 +#: ../../library/stdtypes.rst:4519 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4284 +#: ../../library/stdtypes.rst:4521 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -6100,11 +6590,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4308 +#: ../../library/stdtypes.rst:4545 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4310 +#: ../../library/stdtypes.rst:4547 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -6126,19 +6616,35 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4322 +#: ../../library/stdtypes.rst:4559 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4325 +#: ../../library/stdtypes.rst:4564 +#, fuzzy +msgid "Count the number of occurrences of *value*." +msgstr "*s* 中 *x* 的總出現次數" + +#: ../../library/stdtypes.rst:4570 +msgid "" +"Return the index of the first occurrence of *value* (at or after index " +"*start* and before index *stop*)." +msgstr "" + +#: ../../library/stdtypes.rst:4573 +#, fuzzy +msgid "Raises a :exc:`ValueError` if *value* cannot be found." +msgstr "在 *x* 不在 *s* 中時 :meth:`remove` 會引發 :exc:`ValueError`。" + +#: ../../library/stdtypes.rst:4577 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4329 +#: ../../library/stdtypes.rst:4581 msgid "The underlying object of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4331 +#: ../../library/stdtypes.rst:4583 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -6150,14 +6656,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4340 +#: ../../library/stdtypes.rst:4592 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" -#: ../../library/stdtypes.rst:4344 +#: ../../library/stdtypes.rst:4596 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -6189,11 +6695,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4359 +#: ../../library/stdtypes.rst:4611 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4361 +#: ../../library/stdtypes.rst:4613 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -6217,11 +6723,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4376 +#: ../../library/stdtypes.rst:4628 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4380 +#: ../../library/stdtypes.rst:4632 msgid "" "A string containing the format (in :mod:`struct` module style) for each " "element in the view. A memoryview can be created from exporters with " @@ -6229,17 +6735,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4385 +#: ../../library/stdtypes.rst:4637 msgid "" "format ``'B'`` is now handled according to the struct module syntax. This " "means that ``memoryview(b'abc')[0] == b'abc'[0] == 97``." msgstr "" -#: ../../library/stdtypes.rst:4391 +#: ../../library/stdtypes.rst:4643 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4393 +#: ../../library/stdtypes.rst:4645 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -6259,59 +6765,59 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4404 +#: ../../library/stdtypes.rst:4656 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4409 +#: ../../library/stdtypes.rst:4661 msgid "" "A tuple of integers the length of :attr:`ndim` giving the shape of the " "memory as an N-dimensional array." msgstr "" -#: ../../library/stdtypes.rst:4412 ../../library/stdtypes.rst:4420 +#: ../../library/stdtypes.rst:4664 ../../library/stdtypes.rst:4672 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4417 +#: ../../library/stdtypes.rst:4669 msgid "" "A tuple of integers the length of :attr:`ndim` giving the size in bytes to " "access each element for each dimension of the array." msgstr "" -#: ../../library/stdtypes.rst:4425 +#: ../../library/stdtypes.rst:4677 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4429 +#: ../../library/stdtypes.rst:4681 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4687 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4441 +#: ../../library/stdtypes.rst:4693 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4449 +#: ../../library/stdtypes.rst:4701 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4453 +#: ../../library/stdtypes.rst:4705 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " "sequence, and computing mathematical operations such as intersection, union, " "difference, and symmetric difference. (For other containers see the built-" -"in :class:`dict`, :class:`list`, and :class:`tuple` classes, and the :mod:" -"`collections` module.)" +"in :class:`dict`, :class:`list`, and :class:`tuple` classes, and " +"the :mod:`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4460 +#: ../../library/stdtypes.rst:4712 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " @@ -6319,30 +6825,30 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4465 +#: ../../library/stdtypes.rst:4717 msgid "" -"There are currently two built-in set types, :class:`set` and :class:" -"`frozenset`. The :class:`set` type is mutable --- the contents can be " -"changed using methods like :meth:`~set.add` and :meth:`~set.remove`. Since " -"it is mutable, it has no hash value and cannot be used as either a " +"There are currently two built-in set types, :class:`set` " +"and :class:`frozenset`. The :class:`set` type is mutable --- the contents " +"can be changed using methods like :meth:`~set.add` and :meth:`~set.remove`. " +"Since it is mutable, it has no hash value and cannot be used as either a " "dictionary key or as an element of another set. The :class:`frozenset` type " "is immutable and :term:`hashable` --- its contents cannot be altered after " "it is created; it can therefore be used as a dictionary key or as an element " "of another set." msgstr "" -#: ../../library/stdtypes.rst:4473 +#: ../../library/stdtypes.rst:4725 msgid "" "Non-empty sets (not frozensets) can be created by placing a comma-separated " "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" -#: ../../library/stdtypes.rst:4477 +#: ../../library/stdtypes.rst:4729 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4482 +#: ../../library/stdtypes.rst:4734 msgid "" "Return a new set or frozenset object whose elements are taken from " "*iterable*. The elements of a set must be :term:`hashable`. To represent " @@ -6350,102 +6856,102 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4488 +#: ../../library/stdtypes.rst:4740 msgid "Sets can be created by several means:" msgstr "集合可以以多種方式建立:" -#: ../../library/stdtypes.rst:4490 +#: ../../library/stdtypes.rst:4742 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4491 +#: ../../library/stdtypes.rst:4743 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4492 +#: ../../library/stdtypes.rst:4744 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4494 +#: ../../library/stdtypes.rst:4746 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4499 +#: ../../library/stdtypes.rst:4751 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4503 +#: ../../library/stdtypes.rst:4755 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4507 +#: ../../library/stdtypes.rst:4759 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4511 +#: ../../library/stdtypes.rst:4763 msgid "" "Return ``True`` if the set has no elements in common with *other*. Sets are " "disjoint if and only if their intersection is the empty set." msgstr "" -#: ../../library/stdtypes.rst:4517 +#: ../../library/stdtypes.rst:4769 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4521 +#: ../../library/stdtypes.rst:4773 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4527 +#: ../../library/stdtypes.rst:4779 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4531 +#: ../../library/stdtypes.rst:4783 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4537 +#: ../../library/stdtypes.rst:4789 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4542 +#: ../../library/stdtypes.rst:4794 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4547 +#: ../../library/stdtypes.rst:4799 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4552 +#: ../../library/stdtypes.rst:4804 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4556 +#: ../../library/stdtypes.rst:4808 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4559 +#: ../../library/stdtypes.rst:4811 msgid "" -"Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" -"meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" -"`issuperset` methods will accept any iterable as an argument. In contrast, " -"their operator based counterparts require their arguments to be sets. This " -"precludes error-prone constructions like ``set('abc') & 'cbs'`` in favor of " -"the more readable ``set('abc').intersection('cbs')``." +"Note, the non-operator versions " +"of :meth:`union`, :meth:`intersection`, :meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, " +"and :meth:`issuperset` methods will accept any iterable as an argument. In " +"contrast, their operator based counterparts require their arguments to be " +"sets. This precludes error-prone constructions like ``set('abc') & 'cbs'`` " +"in favor of the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4566 +#: ../../library/stdtypes.rst:4818 msgid "" "Both :class:`set` and :class:`frozenset` support set to set comparisons. Two " "sets are equal if and only if every element of each set is contained in the " @@ -6455,14 +6961,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4573 +#: ../../library/stdtypes.rst:4825 msgid "" "Instances of :class:`set` are compared to instances of :class:`frozenset` " "based on their members. For example, ``set('abc') == frozenset('abc')`` " "returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``." msgstr "" -#: ../../library/stdtypes.rst:4577 +#: ../../library/stdtypes.rst:4829 msgid "" "The subset and equality comparisons do not generalize to a total ordering " "function. For example, any two nonempty disjoint sets are not equal and are " @@ -6470,134 +6976,136 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4582 +#: ../../library/stdtypes.rst:4834 msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" -#: ../../library/stdtypes.rst:4585 +#: ../../library/stdtypes.rst:4837 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4587 +#: ../../library/stdtypes.rst:4839 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" -#: ../../library/stdtypes.rst:4591 +#: ../../library/stdtypes.rst:4843 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4597 +#: ../../library/stdtypes.rst:4849 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4602 +#: ../../library/stdtypes.rst:4854 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4607 +#: ../../library/stdtypes.rst:4859 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4612 +#: ../../library/stdtypes.rst:4864 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4616 +#: ../../library/stdtypes.rst:4868 msgid "Add element *elem* to the set." msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:4620 +#: ../../library/stdtypes.rst:4872 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4625 +#: ../../library/stdtypes.rst:4877 msgid "Remove element *elem* from the set if it is present." msgstr "如果 *elem* 存在於集合中則將其移除。" -#: ../../library/stdtypes.rst:4629 +#: ../../library/stdtypes.rst:4881 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4634 +#: ../../library/stdtypes.rst:4886 msgid "Remove all elements from the set." msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:4637 +#: ../../library/stdtypes.rst:4889 msgid "" -"Note, the non-operator versions of the :meth:`update`, :meth:" -"`intersection_update`, :meth:`difference_update`, and :meth:" -"`symmetric_difference_update` methods will accept any iterable as an " -"argument." +"Note, the non-operator versions of " +"the :meth:`update`, :meth:`intersection_update`, :meth:`difference_update`, " +"and :meth:`symmetric_difference_update` methods will accept any iterable as " +"an argument." msgstr "" -#: ../../library/stdtypes.rst:4642 +#: ../../library/stdtypes.rst:4894 msgid "" -"Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" -"`remove`, and :meth:`discard` methods may be a set. To support searching " -"for an equivalent frozenset, a temporary one is created from *elem*." +"Note, the *elem* argument to " +"the :meth:`~object.__contains__`, :meth:`remove`, and :meth:`discard` " +"methods may be a set. To support searching for an equivalent frozenset, a " +"temporary one is created from *elem*." msgstr "" -#: ../../library/stdtypes.rst:4651 +#: ../../library/stdtypes.rst:4903 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4661 +#: ../../library/stdtypes.rst:4913 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " -"type, the :dfn:`dictionary`. (For other containers see the built-in :class:" -"`list`, :class:`set`, and :class:`tuple` classes, and the :mod:`collections` " -"module.)" +"type, the :dfn:`dictionary`. (For other containers see the built-" +"in :class:`list`, :class:`set`, and :class:`tuple` classes, and " +"the :mod:`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4667 +#: ../../library/stdtypes.rst:4919 msgid "" -"A dictionary's keys are *almost* arbitrary values. Values that are not :" -"term:`hashable`, that is, values containing lists, dictionaries or other " -"mutable types (that are compared by value rather than by object identity) " -"may not be used as keys. Values that compare equal (such as ``1``, ``1.0``, " -"and ``True``) can be used interchangeably to index the same dictionary entry." +"A dictionary's keys are *almost* arbitrary values. Values that are " +"not :term:`hashable`, that is, values containing lists, dictionaries or " +"other mutable types (that are compared by value rather than by object " +"identity) may not be used as keys. Values that compare equal (such as ``1``, " +"``1.0``, and ``True``) can be used interchangeably to index the same " +"dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4678 +#: ../../library/stdtypes.rst:4930 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4681 +#: ../../library/stdtypes.rst:4933 msgid "Dictionaries can be created by several means:" msgstr "字典可以用數種方式建立:" -#: ../../library/stdtypes.rst:4683 +#: ../../library/stdtypes.rst:4935 msgid "" "Use a comma-separated list of ``key: value`` pairs within braces: ``{'jack': " "4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4685 +#: ../../library/stdtypes.rst:4937 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4686 +#: ../../library/stdtypes.rst:4938 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4689 +#: ../../library/stdtypes.rst:4941 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it defines a ``keys()`` method, a " @@ -6610,7 +7118,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4699 +#: ../../library/stdtypes.rst:4951 msgid "" "If keyword arguments are given, the keyword arguments and their values are " "added to the dictionary created from the positional argument. If a key " @@ -6618,13 +7126,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4704 ../../library/stdtypes.rst:4722 +#: ../../library/stdtypes.rst:4956 ../../library/stdtypes.rst:4974 msgid "" "Providing keyword arguments as in the first example only works for keys that " "are valid Python identifiers. Otherwise, any valid keys can be used." msgstr "" -#: ../../library/stdtypes.rst:4707 +#: ../../library/stdtypes.rst:4959 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " @@ -6633,7 +7141,7 @@ msgid "" "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4713 +#: ../../library/stdtypes.rst:4965 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -6653,13 +7161,13 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:4725 +#: ../../library/stdtypes.rst:4977 msgid "" "Dictionaries preserve insertion order. Note that updating a key does not " "affect the order. Keys added after deletion are inserted at the end. ::" msgstr "" -#: ../../library/stdtypes.rst:4728 +#: ../../library/stdtypes.rst:4980 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6691,44 +7199,44 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:4743 +#: ../../library/stdtypes.rst:4995 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4747 +#: ../../library/stdtypes.rst:4999 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:4752 +#: ../../library/stdtypes.rst:5004 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4756 +#: ../../library/stdtypes.rst:5008 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4760 +#: ../../library/stdtypes.rst:5012 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:4765 +#: ../../library/stdtypes.rst:5017 msgid "" "If a subclass of dict defines a method :meth:`__missing__` and *key* is not " "present, the ``d[key]`` operation calls that method with the key *key* as " "argument. The ``d[key]`` operation then returns or raises whatever is " "returned or raised by the ``__missing__(key)`` call. No other operations or " -"methods invoke :meth:`__missing__`. If :meth:`__missing__` is not defined, :" -"exc:`KeyError` is raised. :meth:`__missing__` must be a method; it cannot be " -"an instance variable::" +"methods invoke :meth:`__missing__`. If :meth:`__missing__` is not " +"defined, :exc:`KeyError` is raised. :meth:`__missing__` must be a method; it " +"cannot be an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:4773 +#: ../../library/stdtypes.rst:5025 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -6752,51 +7260,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:4784 +#: ../../library/stdtypes.rst:5036 msgid "" -"The example above shows part of the implementation of :class:`collections." -"Counter`. A different ``__missing__`` method is used by :class:`collections." -"defaultdict`." +"The example above shows part of the implementation " +"of :class:`collections.Counter`. A different ``__missing__`` method is used " +"by :class:`collections.defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:4790 +#: ../../library/stdtypes.rst:5042 msgid "Set ``d[key]`` to *value*." msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:4794 +#: ../../library/stdtypes.rst:5046 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "從 *d* 中移除 ``d[key]``。若 *key* 不在對映中則引發 :exc:`KeyError`。" -#: ../../library/stdtypes.rst:4799 +#: ../../library/stdtypes.rst:5051 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:4803 +#: ../../library/stdtypes.rst:5055 msgid "Equivalent to ``not key in d``." msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:4807 +#: ../../library/stdtypes.rst:5059 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4812 +#: ../../library/stdtypes.rst:5064 msgid "Remove all items from the dictionary." msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:4816 +#: ../../library/stdtypes.rst:5068 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4820 +#: ../../library/stdtypes.rst:5072 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:4822 +#: ../../library/stdtypes.rst:5074 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -6805,70 +7313,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:4830 +#: ../../library/stdtypes.rst:5082 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4836 +#: ../../library/stdtypes.rst:5088 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4841 +#: ../../library/stdtypes.rst:5093 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:4847 +#: ../../library/stdtypes.rst:5099 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " -"*default*. If *default* is not given and *key* is not in the dictionary, a :" -"exc:`KeyError` is raised." +"*default*. If *default* is not given and *key* is not in the dictionary, " +"a :exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:4853 +#: ../../library/stdtypes.rst:5105 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -#: ../../library/stdtypes.rst:4856 +#: ../../library/stdtypes.rst:5108 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " -"often used in set algorithms. If the dictionary is empty, calling :meth:" -"`popitem` raises a :exc:`KeyError`." +"often used in set algorithms. If the dictionary is empty, " +"calling :meth:`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4860 +#: ../../library/stdtypes.rst:5112 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:4866 +#: ../../library/stdtypes.rst:5118 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4873 +#: ../../library/stdtypes.rst:5125 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" -#: ../../library/stdtypes.rst:4881 +#: ../../library/stdtypes.rst:5133 msgid "" "Update the dictionary with the key/value pairs from *mapping* or *iterable* " "and *kwargs*, overwriting existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:4884 +#: ../../library/stdtypes.rst:5136 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -6877,20 +7385,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4892 +#: ../../library/stdtypes.rst:5144 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4895 +#: ../../library/stdtypes.rst:5147 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:4899 +#: ../../library/stdtypes.rst:5151 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -6900,25 +7408,25 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:5157 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4913 +#: ../../library/stdtypes.rst:5165 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4919 +#: ../../library/stdtypes.rst:5171 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4921 +#: ../../library/stdtypes.rst:5173 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6940,85 +7448,85 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:4931 +#: ../../library/stdtypes.rst:5183 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4936 +#: ../../library/stdtypes.rst:5188 msgid "" -":class:`types.MappingProxyType` can be used to create a read-only view of a :" -"class:`dict`." +":class:`types.MappingProxyType` can be used to create a read-only view of " +"a :class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4943 +#: ../../library/stdtypes.rst:5195 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4945 +#: ../../library/stdtypes.rst:5197 msgid "" -"The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" -"`dict.items` are *view objects*. They provide a dynamic view on the " -"dictionary's entries, which means that when the dictionary changes, the view " -"reflects these changes." +"The objects returned by :meth:`dict.keys`, :meth:`dict.values` " +"and :meth:`dict.items` are *view objects*. They provide a dynamic view on " +"the dictionary's entries, which means that when the dictionary changes, the " +"view reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4950 +#: ../../library/stdtypes.rst:5202 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4955 +#: ../../library/stdtypes.rst:5207 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4959 +#: ../../library/stdtypes.rst:5211 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4962 +#: ../../library/stdtypes.rst:5214 msgid "" "Keys and values are iterated over in insertion order. This allows the " -"creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." -"values(), d.keys())``. Another way to create the same list is ``pairs = " -"[(v, k) for (k, v) in d.items()]``." +"creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = " +"zip(d.values(), d.keys())``. Another way to create the same list is ``pairs " +"= [(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4967 +#: ../../library/stdtypes.rst:5219 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:4970 +#: ../../library/stdtypes.rst:5222 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4975 +#: ../../library/stdtypes.rst:5227 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:4980 +#: ../../library/stdtypes.rst:5232 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:4983 +#: ../../library/stdtypes.rst:5235 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4988 +#: ../../library/stdtypes.rst:5240 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4993 +#: ../../library/stdtypes.rst:5245 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -7032,11 +7540,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:5005 +#: ../../library/stdtypes.rst:5257 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:5007 +#: ../../library/stdtypes.rst:5259 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -7077,11 +7585,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:5049 +#: ../../library/stdtypes.rst:5301 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5308 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -7092,7 +7600,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:5064 +#: ../../library/stdtypes.rst:5316 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -7103,16 +7611,17 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:5069 +#: ../../library/stdtypes.rst:5321 msgid "" "An example of a context manager that returns itself is a :term:`file " -"object`. File objects return themselves from __enter__() to allow :func:" -"`open` to be used as the context expression in a :keyword:`with` statement." +"object`. File objects return themselves from __enter__() to " +"allow :func:`open` to be used as the context expression in a :keyword:`with` " +"statement." msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5325 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -7126,7 +7635,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:5083 +#: ../../library/stdtypes.rst:5335 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -7134,11 +7643,11 @@ msgid "" "the exception type, value and traceback information. Otherwise, all three " "arguments are ``None``." msgstr "" -"退出 runtime 情境並回傳布林旗標以表示是否應抑制曾發生的任何例外。如果在執行 :" -"keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " +"退出 runtime 情境並回傳布林旗標以表示是否應抑制曾發生的任何例外。如果在執" +"行 :keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:5088 +#: ../../library/stdtypes.rst:5340 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -7148,24 +7657,24 @@ msgid "" "replace any exception that occurred in the body of the :keyword:`!with` " "statement." msgstr "" -"從此方法回傳 true 值將導致 :keyword:`with` 陳述式抑制例外並繼續執行緊接著 :" -"keyword:`!with` 陳述式之後的陳述式。否則,該例外將在該方法執行完畢後繼續傳播 " -"(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" -"的任何例外。" +"從此方法回傳 true 值將導致 :keyword:`with` 陳述式抑制例外並繼續執行緊接" +"著 :keyword:`!with` 陳述式之後的陳述式。否則,該例外將在該方法執行完畢後繼續" +"傳播 (propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體" +"中發生的任何例外。" -#: ../../library/stdtypes.rst:5095 +#: ../../library/stdtypes.rst:5347 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " "successfully and does not want to suppress the raised exception. This allows " -"context management code to easily detect whether or not an :meth:`~object." -"__exit__` method has actually failed." +"context management code to easily detect whether or not " +"an :meth:`~object.__exit__` method has actually failed." msgstr "" "傳入的例外不應明確重新引發 - 取而代之的是,此方法應回傳 false 值以指示該方法" -"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" -"`__exit__` 方法是否曾實際失敗過。" +"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢" +"測 :meth:`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:5101 +#: ../../library/stdtypes.rst:5353 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -7177,22 +7686,23 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:5107 +#: ../../library/stdtypes.rst:5359 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " "generator function is decorated with the :class:`contextlib.contextmanager` " -"decorator, it will return a context manager implementing the necessary :meth:" -"`~contextmanager.__enter__` and :meth:`~contextmanager.__exit__` methods, " -"rather than the iterator produced by an undecorated generator function." +"decorator, it will return a context manager implementing the " +"necessary :meth:`~contextmanager.__enter__` " +"and :meth:`~contextmanager.__exit__` methods, rather than the iterator " +"produced by an undecorated generator function." msgstr "" "Python 的 :term:`generator` 和 :class:`contextlib.contextmanager` 裝飾器提供" -"了一種便捷的方法來實作這些協定。如果產生器函式以 :class:`contextlib." -"contextmanager` 裝飾器裝飾,它將回傳一個有實作出需要的 :meth:" -"`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" -"理器,而不是由未裝飾產生器函式產生的疊代器。" +"了一種便捷的方法來實作這些協定。如果產生器函式" +"以 :class:`contextlib.contextmanager` 裝飾器裝飾,它將回傳一個有實作出需要" +"的 :meth:`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法" +"的情境管理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:5114 +#: ../../library/stdtypes.rst:5366 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -7204,27 +7714,27 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:5122 +#: ../../library/stdtypes.rst:5374 msgid "" -"Type Annotation Types --- :ref:`Generic Alias `, :ref:" -"`Union `" +"Type Annotation Types --- :ref:`Generic Alias `, :ref:`Union `" msgstr "" -"型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" -"ref:`聯合 (Union) `" +"型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:5127 +#: ../../library/stdtypes.rst:5379 msgid "" -"The core built-in types for :term:`type annotations ` are :ref:" -"`Generic Alias ` and :ref:`Union `." +"The core built-in types for :term:`type annotations ` " +"are :ref:`Generic Alias ` and :ref:`Union `." msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:5134 +#: ../../library/stdtypes.rst:5386 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:5140 +#: ../../library/stdtypes.rst:5392 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -7240,7 +7750,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:5150 +#: ../../library/stdtypes.rst:5402 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -7248,7 +7758,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:5153 +#: ../../library/stdtypes.rst:5405 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -7256,19 +7766,19 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:5156 +#: ../../library/stdtypes.rst:5408 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " "object contains. For example, ``set[bytes]`` can be used in type annotations " -"to signify a :class:`set` in which all the elements are of type :class:" -"`bytes`." +"to signify a :class:`set` in which all the elements are of " +"type :class:`bytes`." msgstr "" "對於一個容器類別,提供給該類別的\\ :ref:`下標 `\\ 引數可以代表" -"物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" -"`set`,其中所有元素的型別都是 :class:`bytes`。" +"物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一" +"個 :class:`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:5162 +#: ../../library/stdtypes.rst:5414 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -7280,7 +7790,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:5168 +#: ../../library/stdtypes.rst:5420 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -7292,11 +7802,11 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:5174 +#: ../../library/stdtypes.rst:5426 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " -"``y`` will also be an instance of ``re.Match``, but the return values of ``y." -"group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type " +"``y`` will also be an instance of ``re.Match``, but the return values of " +"``y.group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type " "annotations, we would represent this variety of :ref:`re.Match ` objects with ``re.Match[bytes]``." msgstr "" @@ -7305,26 +7815,26 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:5180 +#: ../../library/stdtypes.rst:5432 msgid "" -"``GenericAlias`` objects are instances of the class :class:`types." -"GenericAlias`, which can also be used to create ``GenericAlias`` objects " -"directly." +"``GenericAlias`` objects are instances of the " +"class :class:`types.GenericAlias`, which can also be used to create " +"``GenericAlias`` objects directly." msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:5186 +#: ../../library/stdtypes.rst:5438 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " "expecting a :class:`list` containing :class:`float` elements::" msgstr "" "建立一個 ``GenericAlias`` 來表示一個型別 ``T``,其以型別 *X*、*Y* 等(取決於" -"所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" -"class:`list`: ::" +"所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素" +"的 :class:`list`: ::" -#: ../../library/stdtypes.rst:5191 +#: ../../library/stdtypes.rst:5443 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -7332,7 +7842,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:5194 +#: ../../library/stdtypes.rst:5446 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -7343,7 +7853,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:5199 +#: ../../library/stdtypes.rst:5451 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -7351,7 +7861,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:5202 +#: ../../library/stdtypes.rst:5454 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -7359,7 +7869,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:5205 +#: ../../library/stdtypes.rst:5457 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -7371,7 +7881,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5210 +#: ../../library/stdtypes.rst:5462 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7383,7 +7893,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:5216 +#: ../../library/stdtypes.rst:5468 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7393,13 +7903,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:5220 +#: ../../library/stdtypes.rst:5472 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5223 +#: ../../library/stdtypes.rst:5475 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7417,13 +7927,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5231 +#: ../../library/stdtypes.rst:5483 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5233 +#: ../../library/stdtypes.rst:5485 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7437,15 +7947,15 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5239 +#: ../../library/stdtypes.rst:5491 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" msgstr "" -"為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." -"__getitem__` 方法會在這種情況下引發例外: ::" +"為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器" +"的 :meth:`~object.__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5242 +#: ../../library/stdtypes.rst:5494 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7457,17 +7967,17 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5247 +#: ../../library/stdtypes.rst:5499 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " "items in the ``GenericAlias`` object's :attr:`~genericalias.__args__`. ::" msgstr "" "然而當使用\\ :ref:`型別變數 (type variable) ` 時,此類運算式是有效" -"的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." -"__args__` 中的型別變數項目一樣多: ::" +"的。索引的元素數量必須與 ``GenericAlias`` 物件" +"的 :attr:`~genericalias.__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5251 +#: ../../library/stdtypes.rst:5503 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7479,253 +7989,249 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5258 +#: ../../library/stdtypes.rst:5510 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5260 +#: ../../library/stdtypes.rst:5512 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5263 +#: ../../library/stdtypes.rst:5515 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5264 +#: ../../library/stdtypes.rst:5516 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5265 +#: ../../library/stdtypes.rst:5517 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5266 +#: ../../library/stdtypes.rst:5518 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5267 +#: ../../library/stdtypes.rst:5519 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5268 +#: ../../library/stdtypes.rst:5520 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5269 +#: ../../library/stdtypes.rst:5521 msgid ":class:`asyncio.Future`" msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5270 +#: ../../library/stdtypes.rst:5522 msgid ":class:`asyncio.Task`" msgstr ":class:`asyncio.Task`" -#: ../../library/stdtypes.rst:5271 +#: ../../library/stdtypes.rst:5523 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5272 +#: ../../library/stdtypes.rst:5524 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5273 +#: ../../library/stdtypes.rst:5525 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5274 +#: ../../library/stdtypes.rst:5526 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5275 +#: ../../library/stdtypes.rst:5527 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5276 +#: ../../library/stdtypes.rst:5528 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5277 +#: ../../library/stdtypes.rst:5529 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5278 +#: ../../library/stdtypes.rst:5530 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5279 +#: ../../library/stdtypes.rst:5531 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5280 +#: ../../library/stdtypes.rst:5532 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5281 +#: ../../library/stdtypes.rst:5533 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5282 +#: ../../library/stdtypes.rst:5534 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5283 +#: ../../library/stdtypes.rst:5535 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5284 +#: ../../library/stdtypes.rst:5536 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5285 +#: ../../library/stdtypes.rst:5537 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5286 +#: ../../library/stdtypes.rst:5538 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5287 +#: ../../library/stdtypes.rst:5539 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5288 +#: ../../library/stdtypes.rst:5540 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5289 +#: ../../library/stdtypes.rst:5541 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5290 +#: ../../library/stdtypes.rst:5542 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5291 +#: ../../library/stdtypes.rst:5543 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5292 +#: ../../library/stdtypes.rst:5544 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5293 +#: ../../library/stdtypes.rst:5545 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5294 -msgid ":class:`collections.abc.ByteString`" -msgstr ":class:`collections.abc.ByteString`" - -#: ../../library/stdtypes.rst:5295 +#: ../../library/stdtypes.rst:5546 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5296 +#: ../../library/stdtypes.rst:5547 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5297 +#: ../../library/stdtypes.rst:5548 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5298 +#: ../../library/stdtypes.rst:5549 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5299 +#: ../../library/stdtypes.rst:5550 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5300 +#: ../../library/stdtypes.rst:5551 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5301 +#: ../../library/stdtypes.rst:5552 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5302 +#: ../../library/stdtypes.rst:5553 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5303 +#: ../../library/stdtypes.rst:5554 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5304 +#: ../../library/stdtypes.rst:5555 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5305 +#: ../../library/stdtypes.rst:5556 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5306 +#: ../../library/stdtypes.rst:5557 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5307 +#: ../../library/stdtypes.rst:5558 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5308 +#: ../../library/stdtypes.rst:5559 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5309 +#: ../../library/stdtypes.rst:5560 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5310 +#: ../../library/stdtypes.rst:5561 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5311 +#: ../../library/stdtypes.rst:5562 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5312 +#: ../../library/stdtypes.rst:5563 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5313 +#: ../../library/stdtypes.rst:5564 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5314 +#: ../../library/stdtypes.rst:5565 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5315 +#: ../../library/stdtypes.rst:5566 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5316 +#: ../../library/stdtypes.rst:5567 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5317 +#: ../../library/stdtypes.rst:5568 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5318 +#: ../../library/stdtypes.rst:5569 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5323 +#: ../../library/stdtypes.rst:5574 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5325 +#: ../../library/stdtypes.rst:5576 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5329 +#: ../../library/stdtypes.rst:5580 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5331 +#: ../../library/stdtypes.rst:5582 msgid "" ">>> list[int].__origin__\n" "" @@ -7733,16 +8239,16 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5337 +#: ../../library/stdtypes.rst:5588 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " "class::" msgstr "" -"此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" -"class:`tuple`\\ (長度可以為 1): ::" +"此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型" +"別 :class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5341 +#: ../../library/stdtypes.rst:5592 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -7750,7 +8256,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5347 +#: ../../library/stdtypes.rst:5598 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -7758,7 +8264,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5350 +#: ../../library/stdtypes.rst:5601 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -7772,89 +8278,91 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5358 +#: ../../library/stdtypes.rst:5609 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " -"have correct ``__parameters__`` after substitution because :class:`typing." -"ParamSpec` is intended primarily for static type checking." +"have correct ``__parameters__`` after substitution " +"because :class:`typing.ParamSpec` is intended primarily for static type " +"checking." msgstr "" "具有 :class:`typing.ParamSpec` 參數的一個 ``GenericAlias`` 物件在替換後可能沒" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5616 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." msgstr "" -"如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" -"`~typing.TypeVarTuple`\\ )。" +"如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參" +"閱 :data:`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5373 +#: ../../library/stdtypes.rst:5624 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5374 +#: ../../library/stdtypes.rst:5625 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5376 +#: ../../library/stdtypes.rst:5627 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5377 +#: ../../library/stdtypes.rst:5628 msgid "" "Introducing the ability to natively parameterize standard-library classes, " -"provided they implement the special class method :meth:`~object." -"__class_getitem__`." +"provided they implement the special class " +"method :meth:`~object.__class_getitem__`." msgstr "" -"引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" -"`~object.__class_getitem__`。" +"引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方" +"法 :meth:`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5381 +#: ../../library/stdtypes.rst:5632 msgid "" -":ref:`Generics`, :ref:`user-defined generics ` and :" -"class:`typing.Generic`" +":ref:`Generics`, :ref:`user-defined generics ` " +"and :class:`typing.Generic`" msgstr "" -":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" -"`typing.Generic`" +":ref:`Generics`、:ref:`使用者定義泛型 `\\ " +"和 :class:`typing.Generic`" -#: ../../library/stdtypes.rst:5382 +#: ../../library/stdtypes.rst:5633 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5391 +#: ../../library/stdtypes.rst:5642 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5397 +#: ../../library/stdtypes.rst:5648 +#, fuzzy msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " "primarily for :term:`type annotations `. The union type " -"expression enables cleaner type hinting syntax compared to :data:`typing." -"Union`." +"expression enables cleaner type hinting syntax compared to " +"subscripting :class:`typing.Union`." msgstr "" "一個聯合物件可以保存多個\\ :ref:`型別物件 (type object) `\\ 之 ``|``\\ (位元 or)運算的值。這些型別主要用於\\ :term:`型別註" "釋 (type annotation) `。與 :data:`typing.Union` 相比,聯合型別運" "算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:5655 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " -"example, the following function expects an argument of type :class:`int` or :" -"class:`float`::" +"example, the following function expects an argument of type :class:`int` " +"or :class:`float`::" msgstr "" "定義一個包含 *X*、*Y* 等型別的聯合物件。``X | Y`` 表示 X 或 Y。它相當於 " -"``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" -"class:`float` 的引數: ::" +"``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` " +"或 :class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:5660 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -7862,7 +8370,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5414 +#: ../../library/stdtypes.rst:5665 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -7875,58 +8383,62 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5422 +#: ../../library/stdtypes.rst:5673 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5424 +#: ../../library/stdtypes.rst:5675 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5426 +#: ../../library/stdtypes.rst:5677 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5428 +#: ../../library/stdtypes.rst:5679 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5430 +#: ../../library/stdtypes.rst:5681 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5432 +#: ../../library/stdtypes.rst:5683 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5434 +#: ../../library/stdtypes.rst:5685 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5436 -msgid "It is compatible with :data:`typing.Union`::" +#: ../../library/stdtypes.rst:5687 +#, fuzzy +msgid "It creates instances of :class:`typing.Union`::" msgstr "它與 :data:`typing.Union` 相容: ::" -#: ../../library/stdtypes.rst:5438 -msgid "int | str == typing.Union[int, str]" +#: ../../library/stdtypes.rst:5689 +#, fuzzy +msgid "" +"int | str == typing.Union[int, str]\n" +"type(int | str) is typing.Union" msgstr "int | str == typing.Union[int, str]" -#: ../../library/stdtypes.rst:5440 +#: ../../library/stdtypes.rst:5692 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5442 +#: ../../library/stdtypes.rst:5694 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5447 +#: ../../library/stdtypes.rst:5699 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5450 +#: ../../library/stdtypes.rst:5702 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -7934,14 +8446,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5453 +#: ../../library/stdtypes.rst:5705 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5456 +#: ../../library/stdtypes.rst:5708 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -7951,24 +8463,26 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5463 +#: ../../library/stdtypes.rst:5715 +#, fuzzy msgid "" -"The user-exposed type for the union object can be accessed from :data:`types." -"UnionType` and used for :func:`isinstance` checks. An object cannot be " -"instantiated from the type::" +"The user-exposed type for the union object can be accessed " +"from :class:`typing.Union` and used for :func:`isinstance` checks::" msgstr "" -"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." -"UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別來實例化: ::" +"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透" +"過 :data:`types.UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別" +"來實例化: ::" -#: ../../library/stdtypes.rst:5467 +#: ../../library/stdtypes.rst:5718 +#, fuzzy msgid "" -">>> import types\n" -">>> isinstance(int | str, types.UnionType)\n" +">>> import typing\n" +">>> isinstance(int | str, typing.Union)\n" "True\n" -">>> types.UnionType()\n" +">>> typing.Union()\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"TypeError: cannot create 'types.UnionType' instances" +"TypeError: cannot create 'typing.Union' instances" msgstr "" ">>> import types\n" ">>> isinstance(int | str, types.UnionType)\n" @@ -7978,7 +8492,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'types.UnionType' instances" -#: ../../library/stdtypes.rst:5476 +#: ../../library/stdtypes.rst:5727 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -7987,7 +8501,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5480 +#: ../../library/stdtypes.rst:5731 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -8013,72 +8527,79 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5496 +#: ../../library/stdtypes.rst:5747 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5504 +#: ../../library/stdtypes.rst:5753 +msgid "" +"Union objects are now instances of :class:`typing.Union`. Previously, they " +"were instances of :class:`types.UnionType`, which remains an alias " +"for :class:`typing.Union`." +msgstr "" + +#: ../../library/stdtypes.rst:5760 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:5506 +#: ../../library/stdtypes.rst:5762 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5513 +#: ../../library/stdtypes.rst:5769 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5515 +#: ../../library/stdtypes.rst:5771 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " -"table. Module attributes can be assigned to. (Note that the :keyword:" -"`import` statement is not, strictly speaking, an operation on a module " -"object; ``import foo`` does not require a module object named *foo* to " -"exist, rather it requires an (external) *definition* for a module named " +"table. Module attributes can be assigned to. (Note that " +"the :keyword:`import` statement is not, strictly speaking, an operation on a " +"module object; ``import foo`` does not require a module object named *foo* " +"to exist, rather it requires an (external) *definition* for a module named " "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5522 +#: ../../library/stdtypes.rst:5778 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " "will actually change the module's symbol table, but direct assignment to " -"the :attr:`~object.__dict__` attribute is not possible (you can write ``m." -"__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write " -"``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is not " -"recommended." +"the :attr:`~object.__dict__` attribute is not possible (you can write " +"``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't " +"write ``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is " +"not recommended." msgstr "" -#: ../../library/stdtypes.rst:5530 +#: ../../library/stdtypes.rst:5786 msgid "" -"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." +"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5538 +#: ../../library/stdtypes.rst:5794 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:5540 +#: ../../library/stdtypes.rst:5796 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:5546 +#: ../../library/stdtypes.rst:5802 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5548 +#: ../../library/stdtypes.rst:5804 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5551 +#: ../../library/stdtypes.rst:5807 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -8086,36 +8607,36 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5555 +#: ../../library/stdtypes.rst:5811 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5561 +#: ../../library/stdtypes.rst:5817 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:5565 +#: ../../library/stdtypes.rst:5821 msgid "" "Methods are functions that are called using the attribute notation. There " -"are two flavors: :ref:`built-in methods ` (such as :meth:" -"`append` on lists) and :ref:`class instance method `. " -"Built-in methods are described with the types that support them." +"are two flavors: :ref:`built-in methods ` (such " +"as :meth:`~list.append` on lists) and :ref:`class instance method `. Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5570 +#: ../../library/stdtypes.rst:5827 msgid "" "If you access a method (a function defined in a class namespace) through an " -"instance, you get a special object: a :dfn:`bound method` (also called :ref:" -"`instance method `) object. When called, it will add the " -"``self`` argument to the argument list. Bound methods have two special read-" -"only attributes: :attr:`m.__self__ ` is the object on which " -"the method operates, and :attr:`m.__func__ ` is the " -"function implementing the method. Calling ``m(arg-1, arg-2, ..., arg-n)`` " -"is completely equivalent to calling ``m.__func__(m.__self__, arg-1, " -"arg-2, ..., arg-n)``." +"instance, you get a special object: a :dfn:`bound method` (also " +"called :ref:`instance method `) object. When called, it " +"will add the ``self`` argument to the argument list. Bound methods have two " +"special read-only attributes: :attr:`m.__self__ ` is the " +"object on which the method operates, and :attr:`m.__func__ " +"` is the function implementing the method. Calling " +"``m(arg-1, arg-2, ..., arg-n)`` is completely equivalent to calling " +"``m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5581 +#: ../../library/stdtypes.rst:5838 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -8126,7 +8647,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5589 +#: ../../library/stdtypes.rst:5846 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -8154,25 +8675,25 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5861 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5612 +#: ../../library/stdtypes.rst:5869 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5618 +#: ../../library/stdtypes.rst:5875 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " "objects because they don't contain a reference to their global execution " "environment. Code objects are returned by the built-in :func:`compile` " -"function and can be extracted from function objects through their :attr:" -"`~function.__code__` attribute. See also the :mod:`code` module." +"function and can be extracted from function objects through " +"their :attr:`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5625 +#: ../../library/stdtypes.rst:5882 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -8181,21 +8702,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5632 +#: ../../library/stdtypes.rst:5889 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5635 +#: ../../library/stdtypes.rst:5892 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5641 +#: ../../library/stdtypes.rst:5898 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5647 +#: ../../library/stdtypes.rst:5904 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -8203,119 +8724,119 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5652 +#: ../../library/stdtypes.rst:5909 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5658 +#: ../../library/stdtypes.rst:5915 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5660 +#: ../../library/stdtypes.rst:5917 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5664 +#: ../../library/stdtypes.rst:5921 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5671 +#: ../../library/stdtypes.rst:5928 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:5673 +#: ../../library/stdtypes.rst:5930 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " -"no special operations. There is exactly one ellipsis object, named :const:" -"`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces the :const:" -"`Ellipsis` singleton." +"no special operations. There is exactly one ellipsis object, " +"named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces " +"the :const:`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5678 +#: ../../library/stdtypes.rst:5935 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5684 +#: ../../library/stdtypes.rst:5941 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5686 +#: ../../library/stdtypes.rst:5943 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " -"more information. There is exactly one :data:`NotImplemented` object. :code:" -"`type(NotImplemented)()` produces the singleton instance." +"more information. There is exactly one :data:`NotImplemented` " +"object. :code:`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5948 msgid "It is written as :code:`NotImplemented`." msgstr "" -#: ../../library/stdtypes.rst:5697 +#: ../../library/stdtypes.rst:5954 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:5699 +#: ../../library/stdtypes.rst:5956 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5707 +#: ../../library/stdtypes.rst:5964 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5709 +#: ../../library/stdtypes.rst:5966 msgid "" "The implementation adds a few special read-only attributes to several object " -"types, where they are relevant. Some of these are not reported by the :func:" -"`dir` built-in function." +"types, where they are relevant. Some of these are not reported by " +"the :func:`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5716 +#: ../../library/stdtypes.rst:5973 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5722 +#: ../../library/stdtypes.rst:5979 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5730 +#: ../../library/stdtypes.rst:5987 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5735 +#: ../../library/stdtypes.rst:5992 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5740 +#: ../../library/stdtypes.rst:5997 msgid "" -"The :ref:`type parameters ` of generic classes, functions, and :" -"ref:`type aliases `. For classes and functions that are not " -"generic, this will be an empty tuple." +"The :ref:`type parameters ` of generic classes, functions, " +"and :ref:`type aliases `. For classes and functions that are " +"not generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:5750 +#: ../../library/stdtypes.rst:6007 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5752 +#: ../../library/stdtypes.rst:6009 msgid "" -"CPython has a global limit for converting between :class:`int` and :class:" -"`str` to mitigate denial of service attacks. This limit *only* applies to " -"decimal or other non-power-of-two number bases. Hexadecimal, octal, and " -"binary conversions are unlimited. The limit can be configured." +"CPython has a global limit for converting between :class:`int` " +"and :class:`str` to mitigate denial of service attacks. This limit *only* " +"applies to decimal or other non-power-of-two number bases. Hexadecimal, " +"octal, and binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5757 +#: ../../library/stdtypes.rst:6014 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -8325,24 +8846,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5764 +#: ../../library/stdtypes.rst:6021 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5766 +#: ../../library/stdtypes.rst:6023 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:5770 +#: ../../library/stdtypes.rst:6027 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5772 +#: ../../library/stdtypes.rst:6029 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8366,19 +8887,19 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:5792 +#: ../../library/stdtypes.rst:6049 msgid "" -"The default limit is 4300 digits as provided in :data:`sys.int_info." -"default_max_str_digits `. The lowest limit that can be " -"configured is 640 digits as provided in :data:`sys.int_info." -"str_digits_check_threshold `." +"The default limit is 4300 digits as provided " +"in :data:`sys.int_info.default_max_str_digits `. The lowest " +"limit that can be configured is 640 digits as provided " +"in :data:`sys.int_info.str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5797 +#: ../../library/stdtypes.rst:6054 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5799 +#: ../../library/stdtypes.rst:6056 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8396,84 +8917,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:5812 +#: ../../library/stdtypes.rst:6069 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:5814 +#: ../../library/stdtypes.rst:6071 msgid "" -"The limitation only applies to potentially slow conversions between :class:" -"`int` and :class:`str` or :class:`bytes`:" +"The limitation only applies to potentially slow conversions " +"between :class:`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5817 +#: ../../library/stdtypes.rst:6074 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:5818 +#: ../../library/stdtypes.rst:6075 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5819 +#: ../../library/stdtypes.rst:6076 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5820 +#: ../../library/stdtypes.rst:6077 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5821 +#: ../../library/stdtypes.rst:6078 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5824 +#: ../../library/stdtypes.rst:6081 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5826 +#: ../../library/stdtypes.rst:6083 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5827 +#: ../../library/stdtypes.rst:6084 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:5828 +#: ../../library/stdtypes.rst:6085 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:5829 +#: ../../library/stdtypes.rst:6086 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5830 +#: ../../library/stdtypes.rst:6087 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5831 +#: ../../library/stdtypes.rst:6088 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5834 +#: ../../library/stdtypes.rst:6091 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:5836 +#: ../../library/stdtypes.rst:6093 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:5839 +#: ../../library/stdtypes.rst:6096 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:5842 +#: ../../library/stdtypes.rst:6099 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8481,47 +9002,48 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:5844 +#: ../../library/stdtypes.rst:6101 msgid "" -":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" -"`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " -"env var and the ``-X`` option are set, the ``-X`` option takes precedence. A " -"value of *-1* indicates that both were unset, thus a value of :data:`sys." -"int_info.default_max_str_digits` was used during initialization." +":data:`sys.flags.int_max_str_digits` contains the value " +"of :envvar:`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. " +"If both the env var and the ``-X`` option are set, the ``-X`` option takes " +"precedence. A value of *-1* indicates that both were unset, thus a value " +"of :data:`sys.int_info.default_max_str_digits` was used during " +"initialization." msgstr "" -#: ../../library/stdtypes.rst:5850 +#: ../../library/stdtypes.rst:6107 msgid "" -"From code, you can inspect the current limit and set a new one using these :" -"mod:`sys` APIs:" +"From code, you can inspect the current limit and set a new one using " +"these :mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5853 +#: ../../library/stdtypes.rst:6110 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:5857 +#: ../../library/stdtypes.rst:6114 msgid "" -"Information about the default and minimum can be found in :data:`sys." -"int_info`:" +"Information about the default and minimum can be found " +"in :data:`sys.int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5859 +#: ../../library/stdtypes.rst:6116 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5861 +#: ../../library/stdtypes.rst:6118 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:5868 +#: ../../library/stdtypes.rst:6125 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -8533,7 +9055,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5877 +#: ../../library/stdtypes.rst:6134 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -8541,11 +9063,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5883 +#: ../../library/stdtypes.rst:6140 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:5885 +#: ../../library/stdtypes.rst:6142 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -8553,11 +9075,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5890 +#: ../../library/stdtypes.rst:6147 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5892 +#: ../../library/stdtypes.rst:6149 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -8579,38 +9101,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:6159 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5906 +#: ../../library/stdtypes.rst:6163 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:5907 +#: ../../library/stdtypes.rst:6164 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5910 +#: ../../library/stdtypes.rst:6167 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5913 +#: ../../library/stdtypes.rst:6170 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5915 +#: ../../library/stdtypes.rst:6172 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:5918 +#: ../../library/stdtypes.rst:6175 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -8620,16 +9142,16 @@ msgstr "" msgid "built-in" msgstr "built-in(內建)" -#: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:316 -#: ../../library/stdtypes.rst:393 ../../library/stdtypes.rst:950 -#: ../../library/stdtypes.rst:1120 ../../library/stdtypes.rst:1142 -#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4653 -#: ../../library/stdtypes.rst:5643 +#: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:322 +#: ../../library/stdtypes.rst:399 ../../library/stdtypes.rst:992 +#: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:1201 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:5900 msgid "types" msgstr "type(型別)" -#: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1157 -#: ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1216 +#: ../../library/stdtypes.rst:4905 msgid "statement" msgstr "statement(陳述式)" @@ -8650,12 +9172,12 @@ msgid "value" msgstr "value" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:81 -#: ../../library/stdtypes.rst:208 ../../library/stdtypes.rst:817 +#: ../../library/stdtypes.rst:208 ../../library/stdtypes.rst:859 msgid "Boolean" msgstr "Boolean(布林)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:81 -#: ../../library/stdtypes.rst:393 +#: ../../library/stdtypes.rst:399 msgid "operations" msgstr "operations(操作)" @@ -8677,8 +9199,8 @@ msgstr "False(內建物件)" #: ../../library/stdtypes.rst:64 ../../library/stdtypes.rst:98 #: ../../library/stdtypes.rst:123 ../../library/stdtypes.rst:195 -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:393 -#: ../../library/stdtypes.rst:950 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:399 +#: ../../library/stdtypes.rst:992 msgid "operator" msgstr "operator(運算子)" @@ -8690,11 +9212,11 @@ msgstr "or" msgid "and" msgstr "and" -#: ../../library/stdtypes.rst:64 ../../library/stdtypes.rst:817 +#: ../../library/stdtypes.rst:64 ../../library/stdtypes.rst:859 msgid "False" msgstr "False" -#: ../../library/stdtypes.rst:64 ../../library/stdtypes.rst:817 +#: ../../library/stdtypes.rst:64 ../../library/stdtypes.rst:859 msgid "True" msgstr "True" @@ -8747,21 +9269,21 @@ msgid "is not" msgstr "is not" #: ../../library/stdtypes.rst:163 ../../library/stdtypes.rst:208 -#: ../../library/stdtypes.rst:934 ../../library/stdtypes.rst:1120 -#: ../../library/stdtypes.rst:1142 ../../library/stdtypes.rst:1267 -#: ../../library/stdtypes.rst:1346 ../../library/stdtypes.rst:1390 -#: ../../library/stdtypes.rst:1511 ../../library/stdtypes.rst:1547 -#: ../../library/stdtypes.rst:2741 ../../library/stdtypes.rst:2760 -#: ../../library/stdtypes.rst:2869 ../../library/stdtypes.rst:4451 -#: ../../library/stdtypes.rst:4653 ../../library/stdtypes.rst:5136 -#: ../../library/stdtypes.rst:5393 ../../library/stdtypes.rst:5563 -#: ../../library/stdtypes.rst:5607 +#: ../../library/stdtypes.rst:976 ../../library/stdtypes.rst:1179 +#: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:1366 +#: ../../library/stdtypes.rst:1445 ../../library/stdtypes.rst:1489 +#: ../../library/stdtypes.rst:1610 ../../library/stdtypes.rst:1740 +#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:2954 +#: ../../library/stdtypes.rst:3067 ../../library/stdtypes.rst:4703 +#: ../../library/stdtypes.rst:4905 ../../library/stdtypes.rst:5388 +#: ../../library/stdtypes.rst:5644 ../../library/stdtypes.rst:5819 +#: ../../library/stdtypes.rst:5864 msgid "object" msgstr "object(物件)" #: ../../library/stdtypes.rst:163 ../../library/stdtypes.rst:208 -#: ../../library/stdtypes.rst:229 ../../library/stdtypes.rst:316 -#: ../../library/stdtypes.rst:335 +#: ../../library/stdtypes.rst:229 ../../library/stdtypes.rst:322 +#: ../../library/stdtypes.rst:341 msgid "numeric" msgstr "numeric(數值)" @@ -8797,16 +9319,16 @@ msgstr "__gt__()(實例方法)" msgid "__ge__() (instance method)" msgstr "__ge__()(實例方法)" -#: ../../library/stdtypes.rst:195 ../../library/stdtypes.rst:950 +#: ../../library/stdtypes.rst:195 ../../library/stdtypes.rst:992 msgid "in" msgstr "in" -#: ../../library/stdtypes.rst:195 ../../library/stdtypes.rst:950 +#: ../../library/stdtypes.rst:195 ../../library/stdtypes.rst:992 msgid "not in" msgstr "not in" #: ../../library/stdtypes.rst:208 ../../library/stdtypes.rst:229 -#: ../../library/stdtypes.rst:393 +#: ../../library/stdtypes.rst:399 msgid "integer" msgstr "integer(整數)" @@ -8842,580 +9364,603 @@ msgstr "octal(八進位)" msgid "binary" msgstr "binary(二進位)" -#: ../../library/stdtypes.rst:246 +#: ../../library/stdtypes.rst:249 msgid "arithmetic" msgstr "arithmetic(算術)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:950 -#: ../../library/stdtypes.rst:1120 ../../library/stdtypes.rst:4653 -#: ../../library/stdtypes.rst:5614 ../../library/stdtypes.rst:5628 -#: ../../library/stdtypes.rst:5643 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:992 +#: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:5871 ../../library/stdtypes.rst:5885 +#: ../../library/stdtypes.rst:5900 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/stdtypes.rst:246 +#: ../../library/stdtypes.rst:249 msgid "int" msgstr "int" -#: ../../library/stdtypes.rst:246 +#: ../../library/stdtypes.rst:249 msgid "float" msgstr "float" -#: ../../library/stdtypes.rst:246 +#: ../../library/stdtypes.rst:249 msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2617 -#: ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2811 +#: ../../library/stdtypes.rst:4071 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../library/stdtypes.rst:246 +#: ../../library/stdtypes.rst:249 msgid "unary operator" msgstr "unary operator(一元運算子)" -#: ../../library/stdtypes.rst:246 +#: ../../library/stdtypes.rst:249 msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2617 -#: ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2811 +#: ../../library/stdtypes.rst:4071 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2574 -#: ../../library/stdtypes.rst:3794 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2768 +#: ../../library/stdtypes.rst:4028 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/stdtypes.rst:246 +#: ../../library/stdtypes.rst:249 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../library/stdtypes.rst:246 +#: ../../library/stdtypes.rst:249 msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2538 -#: ../../library/stdtypes.rst:3762 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2731 +#: ../../library/stdtypes.rst:3996 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/stdtypes.rst:246 +#: ../../library/stdtypes.rst:249 msgid "**" msgstr "**" -#: ../../library/stdtypes.rst:316 ../../library/stdtypes.rst:393 -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1157 -#: ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:322 ../../library/stdtypes.rst:399 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:1216 +#: ../../library/stdtypes.rst:4905 msgid "operations on" msgstr "operations on(操作於)" -#: ../../library/stdtypes.rst:316 +#: ../../library/stdtypes.rst:322 msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" -#: ../../library/stdtypes.rst:335 ../../library/stdtypes.rst:1615 -#: ../../library/stdtypes.rst:2741 ../../library/stdtypes.rst:5643 +#: ../../library/stdtypes.rst:341 ../../library/stdtypes.rst:1808 +#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:5900 msgid "module" msgstr "模組" -#: ../../library/stdtypes.rst:335 +#: ../../library/stdtypes.rst:341 msgid "math" msgstr "math" -#: ../../library/stdtypes.rst:335 +#: ../../library/stdtypes.rst:341 msgid "floor() (in module math)" msgstr "floor()(於 math 模組)" -#: ../../library/stdtypes.rst:335 +#: ../../library/stdtypes.rst:341 msgid "ceil() (in module math)" msgstr "ceil()(於 math 模組)" -#: ../../library/stdtypes.rst:335 +#: ../../library/stdtypes.rst:341 msgid "trunc() (in module math)" msgstr "trunc()(於 math 模組)" -#: ../../library/stdtypes.rst:335 +#: ../../library/stdtypes.rst:341 msgid "conversions" msgstr "conversions(轉換)" -#: ../../library/stdtypes.rst:393 +#: ../../library/stdtypes.rst:399 msgid "bitwise" msgstr "bitwise(位元)" -#: ../../library/stdtypes.rst:393 +#: ../../library/stdtypes.rst:399 msgid "shifting" msgstr "shifting(移位)" -#: ../../library/stdtypes.rst:393 +#: ../../library/stdtypes.rst:399 msgid "masking" msgstr "masking(遮罩)" -#: ../../library/stdtypes.rst:393 +#: ../../library/stdtypes.rst:399 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../library/stdtypes.rst:393 +#: ../../library/stdtypes.rst:399 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/stdtypes.rst:393 +#: ../../library/stdtypes.rst:399 msgid "& (ampersand)" msgstr "& (和號)" -#: ../../library/stdtypes.rst:393 +#: ../../library/stdtypes.rst:399 msgid "<<" msgstr "<<" -#: ../../library/stdtypes.rst:393 +#: ../../library/stdtypes.rst:399 msgid ">>" msgstr ">>" -#: ../../library/stdtypes.rst:393 +#: ../../library/stdtypes.rst:399 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../library/stdtypes.rst:817 +#: ../../library/stdtypes.rst:859 msgid "values" msgstr "values" -#: ../../library/stdtypes.rst:847 +#: ../../library/stdtypes.rst:889 msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:5051 +#: ../../library/stdtypes.rst:889 ../../library/stdtypes.rst:5303 msgid "protocol" msgstr "protocol(協定)" -#: ../../library/stdtypes.rst:847 +#: ../../library/stdtypes.rst:889 msgid "iterator" msgstr "iterator(疊代器)" -#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:934 -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1120 -#: ../../library/stdtypes.rst:1142 ../../library/stdtypes.rst:1157 +#: ../../library/stdtypes.rst:889 ../../library/stdtypes.rst:976 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:1179 +#: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:1216 msgid "sequence" msgstr "sequence(序列)" -#: ../../library/stdtypes.rst:847 +#: ../../library/stdtypes.rst:889 msgid "iteration" msgstr "iteration(疊代)" -#: ../../library/stdtypes.rst:847 +#: ../../library/stdtypes.rst:889 msgid "container" msgstr "container(容器)" -#: ../../library/stdtypes.rst:847 +#: ../../library/stdtypes.rst:889 msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:4905 msgid "len" msgstr "len" -#: ../../library/stdtypes.rst:950 +#: ../../library/stdtypes.rst:992 msgid "min" msgstr "min" -#: ../../library/stdtypes.rst:950 +#: ../../library/stdtypes.rst:992 msgid "max" msgstr "max" -#: ../../library/stdtypes.rst:950 +#: ../../library/stdtypes.rst:992 msgid "concatenation" msgstr "concatenation(串接)" -#: ../../library/stdtypes.rst:950 +#: ../../library/stdtypes.rst:992 msgid "operation" msgstr "operation(操作)" -#: ../../library/stdtypes.rst:950 +#: ../../library/stdtypes.rst:992 msgid "repetition" msgstr "repetition(重複)" -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1157 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:1216 msgid "subscript" msgstr "subscript(下標)" -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1157 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:1216 msgid "slice" msgstr "slice(切片)" -#: ../../library/stdtypes.rst:950 -msgid "count() (sequence method)" -msgstr "count()(序列方法)" - -#: ../../library/stdtypes.rst:950 -msgid "index() (sequence method)" -msgstr "index()(序列方法)" - -#: ../../library/stdtypes.rst:1006 +#: ../../library/stdtypes.rst:1039 msgid "loop" msgstr "loop(迴圈)" -#: ../../library/stdtypes.rst:1006 +#: ../../library/stdtypes.rst:1039 msgid "over mutable sequence" msgstr "over mutable sequence(於可變序列)" -#: ../../library/stdtypes.rst:1006 +#: ../../library/stdtypes.rst:1039 msgid "mutable sequence" msgstr "mutable sequence(可變序列)" -#: ../../library/stdtypes.rst:1006 +#: ../../library/stdtypes.rst:1039 msgid "loop over" msgstr "loop over(迴圈)" -#: ../../library/stdtypes.rst:1120 +#: ../../library/stdtypes.rst:1179 msgid "immutable" msgstr "immutable(不可變)" -#: ../../library/stdtypes.rst:1120 ../../library/stdtypes.rst:1346 +#: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:1445 msgid "tuple" msgstr "tuple(元組)" -#: ../../library/stdtypes.rst:1120 +#: ../../library/stdtypes.rst:1179 msgid "hash" msgstr "hash(雜湊)" -#: ../../library/stdtypes.rst:1142 +#: ../../library/stdtypes.rst:1201 msgid "mutable" msgstr "mutable(可變)" -#: ../../library/stdtypes.rst:1142 ../../library/stdtypes.rst:1157 -#: ../../library/stdtypes.rst:1267 +#: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:1216 +#: ../../library/stdtypes.rst:1366 msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1142 ../../library/stdtypes.rst:2741 -#: ../../library/stdtypes.rst:2869 ../../library/stdtypes.rst:2943 -#: ../../library/stdtypes.rst:3762 +#: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:2935 +#: ../../library/stdtypes.rst:3067 ../../library/stdtypes.rst:3177 +#: ../../library/stdtypes.rst:3996 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4653 -#: ../../library/stdtypes.rst:5393 ../../library/stdtypes.rst:5643 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:5644 ../../library/stdtypes.rst:5900 msgid "type" msgstr "type(型別)" -#: ../../library/stdtypes.rst:1157 +#: ../../library/stdtypes.rst:1216 msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4905 msgid "del" msgstr "del" -#: ../../library/stdtypes.rst:1157 -msgid "append() (sequence method)" -msgstr "append()(序列方法)" - -#: ../../library/stdtypes.rst:1157 -msgid "clear() (sequence method)" -msgstr "clear()(序列方法)" - -#: ../../library/stdtypes.rst:1157 -msgid "copy() (sequence method)" -msgstr "copy()(序列方法)" - -#: ../../library/stdtypes.rst:1157 -msgid "extend() (sequence method)" -msgstr "extend()(序列方法)" - -#: ../../library/stdtypes.rst:1157 -msgid "insert() (sequence method)" -msgstr "insert()(序列方法)" - -#: ../../library/stdtypes.rst:1157 -msgid "pop() (sequence method)" -msgstr "pop()(序列方法)" - -#: ../../library/stdtypes.rst:1157 -msgid "remove() (sequence method)" -msgstr "remove()(序列方法)" - -#: ../../library/stdtypes.rst:1157 -msgid "reverse() (sequence method)" -msgstr "reverse()(序列方法)" - -#: ../../library/stdtypes.rst:1390 +#: ../../library/stdtypes.rst:1489 msgid "range" msgstr "range" -#: ../../library/stdtypes.rst:1511 ../../library/stdtypes.rst:1560 -#: ../../library/stdtypes.rst:1607 ../../library/stdtypes.rst:2392 -#: ../../library/stdtypes.rst:2538 +#: ../../library/stdtypes.rst:1610 ../../library/stdtypes.rst:1753 +#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2731 msgid "string" msgstr "string(字串)" -#: ../../library/stdtypes.rst:1511 +#: ../../library/stdtypes.rst:1610 msgid "text sequence type" msgstr "text sequence type(文字序列型別)" -#: ../../library/stdtypes.rst:1511 ../../library/stdtypes.rst:1560 -#: ../../library/stdtypes.rst:1580 +#: ../../library/stdtypes.rst:1610 ../../library/stdtypes.rst:1753 +#: ../../library/stdtypes.rst:1773 msgid "str (built-in class)" msgstr "str(內建類別)" -#: ../../library/stdtypes.rst:1511 +#: ../../library/stdtypes.rst:1610 msgid "(see also string)" msgstr "(亦請見 string)" -#: ../../library/stdtypes.rst:1547 +#: ../../library/stdtypes.rst:1740 msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1580 ../../library/stdtypes.rst:2733 +#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2927 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1580 ../../library/stdtypes.rst:2741 -#: ../../library/stdtypes.rst:2760 ../../library/stdtypes.rst:2943 -#: ../../library/stdtypes.rst:3762 +#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2935 +#: ../../library/stdtypes.rst:2954 ../../library/stdtypes.rst:3177 +#: ../../library/stdtypes.rst:3996 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1607 ../../library/stdtypes.rst:2943 +#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:3177 msgid "methods" msgstr "methods(方法)" -#: ../../library/stdtypes.rst:1615 +#: ../../library/stdtypes.rst:1808 msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2206 ../../library/stdtypes.rst:3616 +#: ../../library/stdtypes.rst:2399 ../../library/stdtypes.rst:3850 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2206 +#: ../../library/stdtypes.rst:2399 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid "! formatted string literal" msgstr "! formatted string literals(! 格式化字串常數)" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid "formatted string literals" msgstr "formatted string literals(格式化字串常數)" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid "! f-string" msgstr "! f-string(! f 字串)" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid "! (exclamation mark)" msgstr "! (驚嘆號)" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid "= (equals)" msgstr "= (等號)" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2585 msgid "for help in debugging using string literals" msgstr "" -#: ../../library/stdtypes.rst:2538 +#: ../../library/stdtypes.rst:2731 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2538 +#: ../../library/stdtypes.rst:2731 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2538 +#: ../../library/stdtypes.rst:2731 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2538 +#: ../../library/stdtypes.rst:2731 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2538 ../../library/stdtypes.rst:3762 +#: ../../library/stdtypes.rst:2731 ../../library/stdtypes.rst:3996 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2538 ../../library/stdtypes.rst:3762 +#: ../../library/stdtypes.rst:2731 ../../library/stdtypes.rst:3996 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2574 ../../library/stdtypes.rst:3794 +#: ../../library/stdtypes.rst:2768 ../../library/stdtypes.rst:4028 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2574 ../../library/stdtypes.rst:2617 -#: ../../library/stdtypes.rst:3794 ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:2768 ../../library/stdtypes.rst:2811 +#: ../../library/stdtypes.rst:4028 ../../library/stdtypes.rst:4071 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2574 ../../library/stdtypes.rst:3794 +#: ../../library/stdtypes.rst:2768 ../../library/stdtypes.rst:4028 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2617 ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:2811 ../../library/stdtypes.rst:4071 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2617 ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:2811 ../../library/stdtypes.rst:4071 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2733 +#: ../../library/stdtypes.rst:2927 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2741 +#: ../../library/stdtypes.rst:2935 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2741 +#: ../../library/stdtypes.rst:2935 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3616 +#: ../../library/stdtypes.rst:3850 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3616 +#: ../../library/stdtypes.rst:3850 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:3762 +#: ../../library/stdtypes.rst:3996 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:3762 +#: ../../library/stdtypes.rst:3996 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:3762 +#: ../../library/stdtypes.rst:3996 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:3762 +#: ../../library/stdtypes.rst:3996 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4451 +#: ../../library/stdtypes.rst:4703 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:4905 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:4905 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:4763 +#: ../../library/stdtypes.rst:5015 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:5051 +#: ../../library/stdtypes.rst:5303 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:5051 +#: ../../library/stdtypes.rst:5303 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:5051 +#: ../../library/stdtypes.rst:5303 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:5124 +#: ../../library/stdtypes.rst:5376 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:5124 +#: ../../library/stdtypes.rst:5376 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:5136 +#: ../../library/stdtypes.rst:5388 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:5136 +#: ../../library/stdtypes.rst:5388 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:5136 +#: ../../library/stdtypes.rst:5388 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5393 +#: ../../library/stdtypes.rst:5644 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5393 +#: ../../library/stdtypes.rst:5644 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5563 +#: ../../library/stdtypes.rst:5819 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5607 +#: ../../library/stdtypes.rst:5864 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5607 +#: ../../library/stdtypes.rst:5864 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5614 +#: ../../library/stdtypes.rst:5871 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5614 +#: ../../library/stdtypes.rst:5871 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5628 +#: ../../library/stdtypes.rst:5885 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5628 +#: ../../library/stdtypes.rst:5885 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5667 +#: ../../library/stdtypes.rst:5924 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5667 +#: ../../library/stdtypes.rst:5924 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" + +#~ msgid "``s.index(x[, i[, j]])``" +#~ msgstr "``s.index(x[, i[, j]])``" + +#~ msgid "``s.count(x)``" +#~ msgstr "``s.count(x)``" + +#~ msgid "``s.append(x)``" +#~ msgstr "``s.append(x)``" + +#~ msgid "``s.clear()``" +#~ msgstr "``s.clear()``" + +#~ msgid "``s.copy()``" +#~ msgstr "``s.copy()``" + +#~ msgid "``s.extend(t)`` or ``s += t``" +#~ msgstr "``s.extend(t)`` 或 ``s += t``" + +#~ msgid "``s.insert(i, x)``" +#~ msgstr "``s.insert(i, x)``" + +#~ msgid "``s.pop()`` or ``s.pop(i)``" +#~ msgstr "``s.pop()`` 或 ``s.pop(i)``" + +#~ msgid "``s.remove(x)``" +#~ msgstr "``s.remove(x)``" + +#~ msgid "``s.reverse()``" +#~ msgstr "``s.reverse()``" + +#~ msgid ":meth:`clear` and :meth:`!copy` methods." +#~ msgstr ":meth:`clear` 和 :meth:`!copy` 方法。" + +#~ msgid ":class:`collections.abc.ByteString`" +#~ msgstr ":class:`collections.abc.ByteString`" + +#~ msgid "count() (sequence method)" +#~ msgstr "count()(序列方法)" + +#~ msgid "index() (sequence method)" +#~ msgstr "index()(序列方法)" + +#~ msgid "append() (sequence method)" +#~ msgstr "append()(序列方法)" + +#~ msgid "clear() (sequence method)" +#~ msgstr "clear()(序列方法)" + +#~ msgid "copy() (sequence method)" +#~ msgstr "copy()(序列方法)" + +#~ msgid "extend() (sequence method)" +#~ msgstr "extend()(序列方法)" + +#~ msgid "insert() (sequence method)" +#~ msgstr "insert()(序列方法)" + +#~ msgid "remove() (sequence method)" +#~ msgstr "remove()(序列方法)" + +#~ msgid "reverse() (sequence method)" +#~ msgstr "reverse()(序列方法)" diff --git a/library/string.po b/library/string.po index c488a87a64b..6804208db20 100644 --- a/library/string.po +++ b/library/string.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-10 00:14+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -185,20 +185,22 @@ msgid "" "can happen if two replacement fields occur consecutively), then " "*literal_text* will be a zero-length string. If there is no replacement " "field, then the values of *field_name*, *format_spec* and *conversion* will " -"be ``None``." +"be ``None``. The value of *field_name* is unmodified and auto-numbering of " +"non-numbered positional fields is done by :meth:`vformat`." msgstr "" -#: ../../library/string.rst:138 +#: ../../library/string.rst:139 msgid "" -"Given *field_name* as returned by :meth:`parse` (see above), convert it to " -"an object to be formatted. Returns a tuple (obj, used_key). The default " +"Given *field_name*, convert it to an object to be formatted. Auto-numbering " +"of *field_name* returned from :meth:`parse` is done by :meth:`vformat` " +"before calling this method. Returns a tuple (obj, used_key). The default " "version takes strings of the form defined in :pep:`3101`, such as \"0[name]" -"\" or \"label.title\". *args* and *kwargs* are as passed in " -"to :meth:`vformat`. The return value *used_key* has the same meaning as the " +"\" or \"label.title\". *args* and *kwargs* are as passed in " +"to :meth:`vformat`. The return value *used_key* has the same meaning as the " "*key* parameter to :meth:`get_value`." msgstr "" -#: ../../library/string.rst:147 +#: ../../library/string.rst:149 msgid "" "Retrieve a given field value. The *key* argument will be either an integer " "or a string. If it is an integer, it represents the index of the positional " @@ -206,21 +208,21 @@ msgid "" "in *kwargs*." msgstr "" -#: ../../library/string.rst:152 +#: ../../library/string.rst:154 msgid "" "The *args* parameter is set to the list of positional arguments " "to :meth:`vformat`, and the *kwargs* parameter is set to the dictionary of " "keyword arguments." msgstr "" -#: ../../library/string.rst:156 +#: ../../library/string.rst:158 msgid "" "For compound field names, these functions are only called for the first " "component of the field name; subsequent components are handled through " "normal attribute and indexing operations." msgstr "" -#: ../../library/string.rst:160 +#: ../../library/string.rst:162 msgid "" "So for example, the field expression '0.name' would cause :meth:`get_value` " "to be called with a *key* argument of 0. The ``name`` attribute will be " @@ -228,13 +230,13 @@ msgid "" "in :func:`getattr` function." msgstr "" -#: ../../library/string.rst:165 +#: ../../library/string.rst:167 msgid "" "If the index or keyword refers to an item that does not exist, then " "an :exc:`IndexError` or :exc:`KeyError` should be raised." msgstr "" -#: ../../library/string.rst:170 +#: ../../library/string.rst:172 msgid "" "Implement checking for unused arguments if desired. The arguments to this " "function is the set of all argument keys that were actually referred to in " @@ -245,34 +247,35 @@ msgid "" "the check fails." msgstr "" -#: ../../library/string.rst:180 +#: ../../library/string.rst:182 msgid "" ":meth:`format_field` simply calls the global :func:`format` built-in. The " "method is provided so that subclasses can override it." msgstr "" -#: ../../library/string.rst:185 +#: ../../library/string.rst:187 msgid "" "Converts the value (returned by :meth:`get_field`) given a conversion type " "(as in the tuple returned by the :meth:`parse` method). The default version " "understands 's' (str), 'r' (repr) and 'a' (ascii) conversion types." msgstr "" -#: ../../library/string.rst:194 +#: ../../library/string.rst:196 msgid "Format String Syntax" msgstr "格式化文字語法" -#: ../../library/string.rst:196 +#: ../../library/string.rst:198 msgid "" "The :meth:`str.format` method and the :class:`Formatter` class share the " "same syntax for format strings (although in the case of :class:`Formatter`, " "subclasses can define their own format string syntax). The syntax is " -"related to that of :ref:`formatted string literals `, but it is " -"less sophisticated and, in particular, does not support arbitrary " -"expressions." +"related to that of :ref:`formatted string literals ` " +"and :ref:`template string literals `, but it is less " +"sophisticated and, in particular, does not support arbitrary expressions in " +"interpolations." msgstr "" -#: ../../library/string.rst:209 +#: ../../library/string.rst:212 msgid "" "Format strings contain \"replacement fields\" surrounded by curly braces ``{}" "``. Anything that is not contained in braces is considered literal text, " @@ -281,11 +284,11 @@ msgid "" "``." msgstr "" -#: ../../library/string.rst:214 +#: ../../library/string.rst:217 msgid "The grammar for a replacement field is as follows:" msgstr "" -#: ../../library/string.rst:226 +#: ../../library/string.rst:229 msgid "" "In less formal terms, the replacement field can start with a *field_name* " "that specifies the object whose value is to be formatted and inserted into " @@ -295,11 +298,11 @@ msgid "" "specify a non-default format for the replacement value." msgstr "" -#: ../../library/string.rst:233 +#: ../../library/string.rst:236 msgid "See also the :ref:`formatspec` section." msgstr "另請參閱 :ref:`formatspec` 部份。" -#: ../../library/string.rst:235 +#: ../../library/string.rst:238 msgid "" "The *field_name* itself begins with an *arg_name* that is either a number or " "a keyword. If it's a number, it refers to a positional argument, and if " @@ -316,22 +319,22 @@ msgid "" "index lookup using :meth:`~object.__getitem__`." msgstr "" -#: ../../library/string.rst:249 +#: ../../library/string.rst:252 msgid "" "The positional argument specifiers can be omitted for :meth:`str.format`, so " "``'{} {}'.format(a, b)`` is equivalent to ``'{0} {1}'.format(a, b)``." msgstr "" -#: ../../library/string.rst:253 +#: ../../library/string.rst:256 msgid "" "The positional argument specifiers can be omitted for :class:`Formatter`." msgstr "" -#: ../../library/string.rst:256 +#: ../../library/string.rst:259 msgid "Some simple format string examples::" msgstr "" -#: ../../library/string.rst:258 +#: ../../library/string.rst:261 msgid "" "\"First, thou shalt count to {0}\" # References first positional argument\n" "\"Bring me a {}\" # Implicitly references the first " @@ -344,7 +347,7 @@ msgid "" "'players'." msgstr "" -#: ../../library/string.rst:265 +#: ../../library/string.rst:270 msgid "" "The *conversion* field causes a type coercion before formatting. Normally, " "the job of formatting a value is done by the :meth:`~object.__format__` " @@ -354,7 +357,7 @@ msgid "" "calling :meth:`~object.__format__`, the normal formatting logic is bypassed." msgstr "" -#: ../../library/string.rst:272 +#: ../../library/string.rst:277 msgid "" "Three conversion flags are currently supported: ``'!s'`` which " "calls :func:`str` on the value, ``'!r'`` which calls :func:`repr` and ``'!" @@ -363,18 +366,18 @@ msgstr "" "目前支援三種轉換旗標:``'!s'`` 會對該值呼叫 :func:`str`,``'!r'`` 會對該值呼" "叫 :func:`repr`,而 ``'!a'`` 則會對該值呼叫 :func:`ascii`。" -#: ../../library/string.rst:276 +#: ../../library/string.rst:281 msgid "Some examples::" msgstr "一些範例: ::" -#: ../../library/string.rst:278 +#: ../../library/string.rst:283 msgid "" "\"Harold's a clever {0!s}\" # Calls str() on the argument first\n" "\"Bring out the holy {name!r}\" # Calls repr() on the argument first\n" "\"More {!a}\" # Calls ascii() on the argument first" msgstr "" -#: ../../library/string.rst:282 +#: ../../library/string.rst:287 msgid "" "The *format_spec* field contains a specification of how the value should be " "presented, including such details as field width, alignment, padding, " @@ -385,13 +388,13 @@ msgstr "" "數精度等細節資訊。每種值類型都可以定義自己的「格式化迷你語言 (formatting " "mini-language)」或對 *format_spec* 的解釋。" -#: ../../library/string.rst:287 +#: ../../library/string.rst:292 msgid "" "Most built-in types support a common formatting mini-language, which is " "described in the next section." msgstr "大多數內建型別都支援常見的格式化迷你語言,下一節將會詳細說明。" -#: ../../library/string.rst:290 +#: ../../library/string.rst:295 msgid "" "A *format_spec* field can also include nested replacement fields within it. " "These nested replacement fields may contain a field name, conversion flag " @@ -405,28 +408,30 @@ msgstr "" "format_spec 內部的替換欄位會在 *format_spec* 字串被直譯前被替換。這讓數值的格" "式能夠被動態地指定。" -#: ../../library/string.rst:297 +#: ../../library/string.rst:302 msgid "See the :ref:`formatexamples` section for some examples." msgstr "範例請見 :ref:`formatexamples`。" -#: ../../library/string.rst:303 +#: ../../library/string.rst:308 msgid "Format Specification Mini-Language" msgstr "格式規格 (Format Specification) 迷你語言" -#: ../../library/string.rst:305 +#: ../../library/string.rst:310 +#, fuzzy msgid "" "\"Format specifications\" are used within replacement fields contained " "within a format string to define how individual values are presented " -"(see :ref:`formatstrings` and :ref:`f-strings`). They can also be passed " -"directly to the built-in :func:`format` function. Each formattable type may " -"define how the format specification is to be interpreted." +"(see :ref:`formatstrings`, :ref:`f-strings`, and :ref:`t-strings`). They can " +"also be passed directly to the built-in :func:`format` function. Each " +"formattable type may define how the format specification is to be " +"interpreted." msgstr "" "「格式規格」在格式字串 (format string) 中包含的替換欄位中使用,以定義各個值如" -"何被呈現(請參考 :ref:`formatstrings` 和 :ref:`f-strings`)。它們也能夠直" -"接傳遞給內建的 :func:`format` 函式。每個可格式化型別 (formattable type) 可以" -"定義格式規格如何被直譯。" +"何被呈現(請參考 :ref:`formatstrings` 和 :ref:`f-strings`)。它們也能夠直接傳" +"遞給內建的 :func:`format` 函式。每個可格式化型別 (formattable type) 可以定義" +"格式規格如何被直譯。" -#: ../../library/string.rst:312 +#: ../../library/string.rst:317 msgid "" "Most built-in types implement the following options for format " "specifications, although some of the formatting options are only supported " @@ -434,7 +439,7 @@ msgid "" msgstr "" "大部分內建型別為了格式規格實作了下列選項,不過有些選項只被數值型別支援。" -#: ../../library/string.rst:315 +#: ../../library/string.rst:320 msgid "" "A general convention is that an empty format specification produces the same " "result as if you had called :func:`str` on the value. A non-empty format " @@ -443,11 +448,11 @@ msgstr "" "一般來說,輸入空格式規格會產生和對值呼叫 :func:`str` 函式相同的結果,非空的格" "式規格才會修改結果。" -#: ../../library/string.rst:319 +#: ../../library/string.rst:324 msgid "The general form of a *standard format specifier* is:" msgstr "*標準格式說明符號 (standard format specifier)* 的一般型式如下:" -#: ../../library/string.rst:333 +#: ../../library/string.rst:341 msgid "" "If a valid *align* value is specified, it can be preceded by a *fill* " "character that can be any character and defaults to a space if omitted. It " @@ -463,46 +468,46 @@ msgstr "" "*fill* 字元的,但仍可透過巢狀替換欄位的方式插入大括號。此限制不影" "響 :func:`format` 函式。" -#: ../../library/string.rst:342 +#: ../../library/string.rst:350 msgid "The meaning of the various alignment options is as follows:" msgstr "" -#: ../../library/string.rst:351 ../../library/string.rst:383 -#: ../../library/string.rst:442 +#: ../../library/string.rst:359 ../../library/string.rst:391 +#: ../../library/string.rst:457 msgid "Option" msgstr "選項" -#: ../../library/string.rst:351 ../../library/string.rst:383 -#: ../../library/string.rst:442 ../../library/string.rst:481 -#: ../../library/string.rst:492 ../../library/string.rst:527 +#: ../../library/string.rst:359 ../../library/string.rst:391 +#: ../../library/string.rst:457 ../../library/string.rst:491 +#: ../../library/string.rst:502 ../../library/string.rst:537 msgid "Meaning" msgstr "含義" -#: ../../library/string.rst:353 +#: ../../library/string.rst:361 msgid "``'<'``" msgstr "``'<'``" -#: ../../library/string.rst:353 +#: ../../library/string.rst:361 msgid "" "Forces the field to be left-aligned within the available space (this is the " "default for most objects)." msgstr "強制欄位在可用空間內靠左對齊(這是大多數物件的預設值)。" -#: ../../library/string.rst:356 +#: ../../library/string.rst:364 msgid "``'>'``" msgstr "``'>'``" -#: ../../library/string.rst:356 +#: ../../library/string.rst:364 msgid "" "Forces the field to be right-aligned within the available space (this is the " "default for numbers)." msgstr "強制欄位在可用空間內靠右對齊(這是數字的預設值)。" -#: ../../library/string.rst:359 +#: ../../library/string.rst:367 msgid "``'='``" msgstr "``'='``" -#: ../../library/string.rst:359 +#: ../../library/string.rst:367 msgid "" "Forces the padding to be placed after the sign (if any) but before the " "digits. This is used for printing fields in the form '+000000120'. This " @@ -511,15 +516,15 @@ msgid "" "immediately precedes the field width." msgstr "" -#: ../../library/string.rst:366 +#: ../../library/string.rst:374 msgid "``'^'``" msgstr "``'^'``" -#: ../../library/string.rst:366 +#: ../../library/string.rst:374 msgid "Forces the field to be centered within the available space." msgstr "強制欄位在可用空間內置中。" -#: ../../library/string.rst:370 +#: ../../library/string.rst:378 msgid "" "Note that unless a minimum field width is defined, the field width will " "always be the same size as the data to fill it, so that the alignment option " @@ -528,54 +533,54 @@ msgstr "" "請注意,除非有定義了最小欄位寬度,否則欄位寬度將始終與填充它的資料大小相同," "故在該情況下的對齊選項是沒有意義的。" -#: ../../library/string.rst:374 +#: ../../library/string.rst:382 msgid "" "The *sign* option is only valid for number types, and can be one of the " "following:" msgstr "*sign* 選項只適用於數字型別,並可為以下之一:" -#: ../../library/string.rst:385 +#: ../../library/string.rst:393 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/string.rst:385 +#: ../../library/string.rst:393 msgid "" "Indicates that a sign should be used for both positive as well as negative " "numbers." msgstr "表示正數與負數均需使用符號。" -#: ../../library/string.rst:388 +#: ../../library/string.rst:396 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/string.rst:388 +#: ../../library/string.rst:396 msgid "" "Indicates that a sign should be used only for negative numbers (this is the " "default behavior)." msgstr "表示正數應使用前導空格,負數應使用減號。" -#: ../../library/string.rst:377 ../../library/string.rst:391 +#: ../../library/string.rst:385 ../../library/string.rst:399 msgid "space" msgstr "空格" -#: ../../library/string.rst:391 +#: ../../library/string.rst:399 msgid "" "Indicates that a leading space should be used on positive numbers, and a " "minus sign on negative numbers." msgstr "表示正數應使用前導空格,負數應使用減號。" -#: ../../library/string.rst:398 +#: ../../library/string.rst:406 msgid "" "The ``'z'`` option coerces negative zero floating-point values to positive " "zero after rounding to the format precision. This option is only valid for " "floating-point presentation types." msgstr "" -#: ../../library/string.rst:402 +#: ../../library/string.rst:410 msgid "Added the ``'z'`` option (see also :pep:`682`)." msgstr "新增 ``'z'`` 選項(請見 :pep:`682`)。" -#: ../../library/string.rst:407 +#: ../../library/string.rst:415 msgid "" "The ``'#'`` option causes the \"alternate form\" to be used for the " "conversion. The alternate form is defined differently for different types. " @@ -589,7 +594,7 @@ msgid "" "and ``'G'`` conversions, trailing zeros are not removed from the result." msgstr "" -#: ../../library/string.rst:419 +#: ../../library/string.rst:427 msgid "" "The *width* is a decimal integer defining the minimum total field width, " "including any prefixes, separators, and other formatting characters. If not " @@ -598,7 +603,7 @@ msgstr "" "*width* 是一個十進位整數,定義了最小總欄位寬度,包括任何前綴、分隔符號和其他" "格式字元。如果未指定,則欄位寬度將由內容決定。" -#: ../../library/string.rst:423 +#: ../../library/string.rst:431 msgid "" "When no explicit alignment is given, preceding the *width* field by a zero " "(``'0'``) character enables sign-aware zero-padding for numeric types, " @@ -609,34 +614,50 @@ msgstr "" "為 :class:`complex` 以外的數值型別啟用有符號察覺的零填充 (sign-aware zero-" "padding)。這相當於使用 ``'0'`` 為 *fill* 字元且對齊類型為 ``'='``。" -#: ../../library/string.rst:428 +#: ../../library/string.rst:436 msgid "" "Preceding the *width* field by ``'0'`` no longer affects the default " "alignment for strings." msgstr "在 *width* 欄位前面加上 ``'0'`` 不再影響字串的預設對齊方式。" -#: ../../library/string.rst:433 +#: ../../library/string.rst:440 +msgid "" +"The *precision* is a decimal integer indicating how many digits should be " +"displayed after the decimal point for presentation types ``'f'`` and " +"``'F'``, or before and after the decimal point for presentation types " +"``'g'`` or ``'G'``. For string presentation types the field indicates the " +"maximum field size - in other words, how many characters will be used from " +"the field content. The *precision* is not allowed for integer presentation " +"types." +msgstr "" +"*precision* 是一個十進位整數,指定表示類型 ``'f'`` 和 ``'F'`` 的小數點後應顯" +"示多少位,或表示類型 ``'g'`` 或 ``'G'`` 的小數點前後應顯示多少位。對於字串表" +"示類型,該欄位指定最大欄位大小 - 換言之,將使用欄位中的多少字元。整數表示類型" +"不允許使用 *precision*。" + +#: ../../library/string.rst:448 msgid "" -"The *grouping* option after the *width* field specifies a digit group " -"separator for the integral part of a number. It can be one of the following:" +"The *grouping* option after *width* and *precision* fields specifies a digit " +"group separator for the integral and fractional parts of a number " +"respectively. It can be one of the following:" msgstr "" -#: ../../library/string.rst:444 +#: ../../library/string.rst:459 msgid "``','``" msgstr "``','``" -#: ../../library/string.rst:444 +#: ../../library/string.rst:459 msgid "" "Inserts a comma every 3 digits for integer presentation type ``'d'`` and " "floating-point presentation types, excluding ``'n'``. For other presentation " "types, this option is not supported." msgstr "" -#: ../../library/string.rst:450 +#: ../../library/string.rst:465 msgid "``'_'``" msgstr "``'_'``" -#: ../../library/string.rst:450 +#: ../../library/string.rst:465 msgid "" "Inserts an underscore every 3 digits for integer presentation type ``'d'`` " "and floating-point presentation types, excluding ``'n'``. For integer " @@ -648,117 +669,106 @@ msgstr "" "``'n'``。對於整數表示型別 ``'b'``,``'o'``,``'x'`` 和 ``'X'``,每 4 位數字會" "插入底線。對於其他表示型別來說此選項並不支援。" -#: ../../library/string.rst:460 +#: ../../library/string.rst:475 msgid "" "For a locale aware separator, use the ``'n'`` presentation type instead." msgstr "" -#: ../../library/string.rst:462 +#: ../../library/string.rst:477 msgid "Added the ``','`` option (see also :pep:`378`)." msgstr "新增 ``','`` 選項(請見 :pep:`378`)。" -#: ../../library/string.rst:465 +#: ../../library/string.rst:480 msgid "Added the ``'_'`` option (see also :pep:`515`)." msgstr "新增 ``'_'`` 選項(請見 :pep:`515`)。" -#: ../../library/string.rst:468 -msgid "" -"The *precision* is a decimal integer indicating how many digits should be " -"displayed after the decimal point for presentation types ``'f'`` and " -"``'F'``, or before and after the decimal point for presentation types " -"``'g'`` or ``'G'``. For string presentation types the field indicates the " -"maximum field size - in other words, how many characters will be used from " -"the field content. The *precision* is not allowed for integer presentation " -"types." +#: ../../library/string.rst:483 +msgid "Support the *grouping* option for the fractional part." msgstr "" -"*precision* 是一個十進位整數,指定表示類型 ``'f'`` 和 ``'F'`` 的小數點後應顯" -"示多少位,或表示類型 ``'g'`` 或 ``'G'`` 的小數點前後應顯示多少位。對於字串表" -"示類型,該欄位指定最大欄位大小 - 換言之,將使用欄位中的多少字元。整數表示類型" -"不允許使用 *precision*。" -#: ../../library/string.rst:476 +#: ../../library/string.rst:486 msgid "Finally, the *type* determines how the data should be presented." msgstr "最終,型別決定了資料將會如何呈現" -#: ../../library/string.rst:478 +#: ../../library/string.rst:488 msgid "The available string presentation types are:" msgstr "可用的字串表示型別有:" -#: ../../library/string.rst:481 ../../library/string.rst:492 -#: ../../library/string.rst:527 +#: ../../library/string.rst:491 ../../library/string.rst:502 +#: ../../library/string.rst:537 msgid "Type" msgstr "型別" -#: ../../library/string.rst:483 +#: ../../library/string.rst:493 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/string.rst:483 +#: ../../library/string.rst:493 msgid "String format. This is the default type for strings and may be omitted." msgstr "" -#: ../../library/string.rst:486 ../../library/string.rst:515 -#: ../../library/string.rst:601 +#: ../../library/string.rst:496 ../../library/string.rst:525 +#: ../../library/string.rst:611 msgid "None" msgstr "None" -#: ../../library/string.rst:486 +#: ../../library/string.rst:496 msgid "The same as ``'s'``." msgstr "與 ``'s'`` 相同。" -#: ../../library/string.rst:489 +#: ../../library/string.rst:499 msgid "The available integer presentation types are:" msgstr "" -#: ../../library/string.rst:494 +#: ../../library/string.rst:504 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/string.rst:494 +#: ../../library/string.rst:504 msgid "Binary format. Outputs the number in base 2." msgstr "" -#: ../../library/string.rst:496 +#: ../../library/string.rst:506 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/string.rst:496 +#: ../../library/string.rst:506 msgid "" "Character. Converts the integer to the corresponding unicode character " "before printing." msgstr "" -#: ../../library/string.rst:499 +#: ../../library/string.rst:509 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/string.rst:499 +#: ../../library/string.rst:509 msgid "Decimal Integer. Outputs the number in base 10." msgstr "" -#: ../../library/string.rst:501 +#: ../../library/string.rst:511 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/string.rst:501 +#: ../../library/string.rst:511 msgid "Octal format. Outputs the number in base 8." msgstr "" -#: ../../library/string.rst:503 +#: ../../library/string.rst:513 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/string.rst:503 +#: ../../library/string.rst:513 msgid "" "Hex format. Outputs the number in base 16, using lower-case letters for the " "digits above 9." msgstr "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用小寫字母。" -#: ../../library/string.rst:506 +#: ../../library/string.rst:516 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/string.rst:506 +#: ../../library/string.rst:516 msgid "" "Hex format. Outputs the number in base 16, using upper-case letters for the " "digits above 9. In case ``'#'`` is specified, the prefix ``'0x'`` will be " @@ -767,21 +777,21 @@ msgstr "" "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用大寫字母。如果指定了 " "``'#'``,則前綴 ``'0x'`` 也會被轉成大寫的 ``'0X'``。" -#: ../../library/string.rst:511 ../../library/string.rst:593 +#: ../../library/string.rst:521 ../../library/string.rst:603 msgid "``'n'``" msgstr "``'n'``" -#: ../../library/string.rst:511 +#: ../../library/string.rst:521 msgid "" "Number. This is the same as ``'d'``, except that it uses the current locale " "setting to insert the appropriate digit group separators." msgstr "" -#: ../../library/string.rst:515 +#: ../../library/string.rst:525 msgid "The same as ``'d'``." msgstr "與 ``'d'`` 相同。" -#: ../../library/string.rst:518 +#: ../../library/string.rst:528 msgid "" "In addition to the above presentation types, integers can be formatted with " "the floating-point presentation types listed below (except ``'n'`` and " @@ -789,17 +799,17 @@ msgid "" "floating-point number before formatting." msgstr "" -#: ../../library/string.rst:523 +#: ../../library/string.rst:533 msgid "" "The available presentation types for :class:`float` " "and :class:`~decimal.Decimal` values are:" msgstr "" -#: ../../library/string.rst:529 +#: ../../library/string.rst:539 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/string.rst:529 +#: ../../library/string.rst:539 msgid "" "Scientific notation. For a given precision ``p``, formats the number in " "scientific notation with the letter 'e' separating the coefficient from the " @@ -811,21 +821,21 @@ msgid "" "unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:540 +#: ../../library/string.rst:550 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/string.rst:540 +#: ../../library/string.rst:550 msgid "" "Scientific notation. Same as ``'e'`` except it uses an upper case 'E' as the " "separator character." msgstr "" -#: ../../library/string.rst:543 +#: ../../library/string.rst:553 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/string.rst:543 +#: ../../library/string.rst:553 msgid "" "Fixed-point notation. For a given precision ``p``, formats the number as a " "decimal number with exactly ``p`` digits following the decimal point. With " @@ -835,21 +845,21 @@ msgid "" "point is omitted unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:552 +#: ../../library/string.rst:562 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/string.rst:552 +#: ../../library/string.rst:562 msgid "" "Fixed-point notation. Same as ``'f'``, but converts ``nan`` to ``NAN`` and " "``inf`` to ``INF``." msgstr "" -#: ../../library/string.rst:555 +#: ../../library/string.rst:565 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/string.rst:555 +#: ../../library/string.rst:565 msgid "" "General format. For a given precision ``p >= 1``, this rounds the number to " "``p`` significant digits and then formats the result in either fixed-point " @@ -857,7 +867,7 @@ msgid "" "``0`` is treated as equivalent to a precision of ``1``." msgstr "" -#: ../../library/string.rst:562 +#: ../../library/string.rst:572 msgid "" "The precise rules are as follows: suppose that the result formatted with " "presentation type ``'e'`` and precision ``p-1`` would have exponent " @@ -870,7 +880,7 @@ msgid "" "unless the ``'#'`` option is used." msgstr "" -#: ../../library/string.rst:575 +#: ../../library/string.rst:585 msgid "" "With no precision given, uses a precision of ``6`` significant digits " "for :class:`float`. For :class:`~decimal.Decimal`, the coefficient of the " @@ -880,41 +890,41 @@ msgid "" "1, and fixed-point notation is used otherwise." msgstr "" -#: ../../library/string.rst:584 +#: ../../library/string.rst:594 msgid "" "Positive and negative infinity, positive and negative zero, and nans, are " "formatted as ``inf``, ``-inf``, ``0``, ``-0`` and ``nan`` respectively, " "regardless of the precision." msgstr "" -#: ../../library/string.rst:589 +#: ../../library/string.rst:599 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/string.rst:589 +#: ../../library/string.rst:599 msgid "" "General format. Same as ``'g'`` except switches to ``'E'`` if the number " "gets too large. The representations of infinity and NaN are uppercased, too." msgstr "" -#: ../../library/string.rst:593 +#: ../../library/string.rst:603 msgid "" "Number. This is the same as ``'g'``, except that it uses the current locale " "setting to insert the appropriate digit group separators for the integral " "part of a number." msgstr "" -#: ../../library/string.rst:598 +#: ../../library/string.rst:608 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/string.rst:598 +#: ../../library/string.rst:608 msgid "" "Percentage. Multiplies the number by 100 and displays in fixed (``'f'``) " "format, followed by a percent sign." msgstr "" -#: ../../library/string.rst:601 +#: ../../library/string.rst:611 msgid "" "For :class:`float` this is like the ``'g'`` type, except that when fixed-" "point notation is used to format the result, it always includes at least one " @@ -923,20 +933,20 @@ msgid "" "as large as needed to represent the given value faithfully." msgstr "" -#: ../../library/string.rst:609 +#: ../../library/string.rst:619 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: ../../library/string.rst:613 +#: ../../library/string.rst:623 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:617 +#: ../../library/string.rst:627 msgid "" "The result should be correctly rounded to a given precision ``p`` of digits " "after the decimal point. The rounding mode for :class:`float` matches that " @@ -944,7 +954,7 @@ msgid "" "mode of the current :ref:`context ` will be used." msgstr "" -#: ../../library/string.rst:622 +#: ../../library/string.rst:632 msgid "" "The available presentation types for :class:`complex` are the same as those " "for :class:`float` (``'%'`` is not allowed). Both the real and imaginary " @@ -956,17 +966,17 @@ msgid "" "surrounded by parentheses), possibly altered by other format modifiers." msgstr "" -#: ../../library/string.rst:635 +#: ../../library/string.rst:645 msgid "Format examples" msgstr "格式範例" -#: ../../library/string.rst:637 +#: ../../library/string.rst:647 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "本節包含 :meth:`str.format` 語法以及與舊式 ``%`` 格式的比較。" -#: ../../library/string.rst:640 +#: ../../library/string.rst:650 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " @@ -975,17 +985,17 @@ msgstr "" "此語法在大多情況下與舊式的 ``%`` 格式類似,只是增加了 ``{}`` 和 ``:`` 來取代 " "``%``。例如,``'%03.2f'`` 可以改寫為 ``'{:03.2f}'``。" -#: ../../library/string.rst:644 +#: ../../library/string.rst:654 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "新的語法還支援新的選項,將在以下的範例中說明。" -#: ../../library/string.rst:647 +#: ../../library/string.rst:657 msgid "Accessing arguments by position::" msgstr "按位置存取引數: ::" -#: ../../library/string.rst:649 +#: ../../library/string.rst:659 msgid "" ">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" "'a, b, c'\n" @@ -1010,11 +1020,11 @@ msgstr "" ">>> '{0}{1}{0}'.format('abra', 'cad') # 引數索引可以重複\n" "'abracadabra'" -#: ../../library/string.rst:660 +#: ../../library/string.rst:670 msgid "Accessing arguments by name::" msgstr "按名稱存取引數: ::" -#: ../../library/string.rst:662 +#: ../../library/string.rst:672 msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" @@ -1024,11 +1034,11 @@ msgid "" "'Coordinates: 37.24N, -115.81W'" msgstr "" -#: ../../library/string.rst:668 +#: ../../library/string.rst:678 msgid "Accessing arguments' attributes::" msgstr "存取引數的屬性: ::" -#: ../../library/string.rst:670 +#: ../../library/string.rst:680 msgid "" ">>> c = 3-5j\n" ">>> ('The complex number {0} is formed from the real part {0.real} '\n" @@ -1045,11 +1055,11 @@ msgid "" "'Point(4, 2)'" msgstr "" -#: ../../library/string.rst:683 +#: ../../library/string.rst:693 msgid "Accessing arguments' items::" msgstr "存取引數的內容: ::" -#: ../../library/string.rst:685 +#: ../../library/string.rst:695 msgid "" ">>> coord = (3, 5)\n" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" @@ -1059,11 +1069,11 @@ msgstr "" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" "'X: 3; Y: 5'" -#: ../../library/string.rst:689 +#: ../../library/string.rst:699 msgid "Replacing ``%s`` and ``%r``::" msgstr "替換 ``%s`` 和 ``%r``: ::" -#: ../../library/string.rst:691 +#: ../../library/string.rst:701 msgid "" ">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " "'test2')\n" @@ -1073,11 +1083,11 @@ msgstr "" "'test2')\n" "\"repr() shows quotes: 'test1'; str() doesn't: test2\"" -#: ../../library/string.rst:694 +#: ../../library/string.rst:704 msgid "Aligning the text and specifying a width::" msgstr "對齊文字以及指定寬度: ::" -#: ../../library/string.rst:696 +#: ../../library/string.rst:706 msgid "" ">>> '{:<30}'.format('left aligned')\n" "'left aligned '\n" @@ -1089,11 +1099,11 @@ msgid "" "'***********centered***********'" msgstr "" -#: ../../library/string.rst:705 +#: ../../library/string.rst:715 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "替換 ``%+f``、``%-f`` 和 ``% f`` 以及指定正負號: ::" -#: ../../library/string.rst:707 +#: ../../library/string.rst:717 msgid "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" @@ -1111,12 +1121,12 @@ msgstr "" "同\n" "'3.140000; -3.140000'" -#: ../../library/string.rst:714 +#: ../../library/string.rst:724 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "替換 ``%x`` 和 ``%o`` 並將其值轉換為不同的進位制: ::" -#: ../../library/string.rst:716 +#: ../../library/string.rst:726 msgid "" ">>> # format also supports binary numbers\n" ">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" @@ -1126,11 +1136,12 @@ msgid "" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" msgstr "" -#: ../../library/string.rst:723 +#: ../../library/string.rst:733 msgid "Using the comma or the underscore as a digit group separator::" msgstr "使用逗號或底線作為數字分組分隔符號: ::" -#: ../../library/string.rst:725 +#: ../../library/string.rst:735 +#, fuzzy msgid "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'\n" @@ -1139,7 +1150,13 @@ msgid "" ">>> '{:_b}'.format(1234567890)\n" "'100_1001_1001_0110_0000_0010_1101_0010'\n" ">>> '{:_x}'.format(1234567890)\n" -"'4996_02d2'" +"'4996_02d2'\n" +">>> '{:_}'.format(123456789.123456789)\n" +"'123_456_789.12345679'\n" +">>> '{:.,}'.format(123456789.123456789)\n" +"'123456789.123,456,79'\n" +">>> '{:,._}'.format(123456789.123456789)\n" +"'123,456,789.123_456_79'" msgstr "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'\n" @@ -1150,11 +1167,11 @@ msgstr "" ">>> '{:_x}'.format(1234567890)\n" "'4996_02d2'" -#: ../../library/string.rst:734 +#: ../../library/string.rst:750 msgid "Expressing a percentage::" msgstr "表示為百分比: ::" -#: ../../library/string.rst:736 +#: ../../library/string.rst:752 msgid "" ">>> points = 19\n" ">>> total = 22\n" @@ -1166,11 +1183,11 @@ msgstr "" ">>> 'Correct answers: {:.2%}'.format(points/total)\n" "'Correct answers: 86.36%'" -#: ../../library/string.rst:741 +#: ../../library/string.rst:757 msgid "Using type-specific formatting::" msgstr "作為特定型別格式: ::" -#: ../../library/string.rst:743 +#: ../../library/string.rst:759 msgid "" ">>> import datetime\n" ">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" @@ -1182,11 +1199,11 @@ msgstr "" ">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" "'2010-07-04 12:15:58'" -#: ../../library/string.rst:748 +#: ../../library/string.rst:764 msgid "Nesting arguments and more complex examples::" msgstr "巢狀引數及更多複雜範例: ::" -#: ../../library/string.rst:750 +#: ../../library/string.rst:766 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1244,11 +1261,28 @@ msgstr "" " 10 A 12 1010\n" " 11 B 13 1011" -#: ../../library/string.rst:782 -msgid "Template strings" +#: ../../library/string.rst:798 +#, fuzzy +msgid "Template strings ($-strings)" msgstr "模板字串" -#: ../../library/string.rst:784 +#: ../../library/string.rst:802 +msgid "" +"The feature described here was introduced in Python 2.4; a simple templating " +"method based upon regular expressions. It " +"predates :meth:`str.format`, :ref:`formatted string literals `, " +"and :ref:`template string literals `." +msgstr "" + +#: ../../library/string.rst:807 +msgid "" +"It is unrelated to template string literals (t-strings), which were " +"introduced in Python 3.14. These evaluate " +"to :class:`string.templatelib.Template` objects, found in " +"the :mod:`string.templatelib` module." +msgstr "" + +#: ../../library/string.rst:812 msgid "" "Template strings provide simpler string substitutions as described " "in :pep:`292`. A primary use case for template strings is for " @@ -1263,17 +1297,17 @@ msgstr "" "化工具更容易翻譯。基於模板字串建構的 i18n 函式庫範例,請參閱 `flufl.i18n " "`_ 套件。" -#: ../../library/string.rst:794 +#: ../../library/string.rst:822 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:796 +#: ../../library/string.rst:824 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:798 +#: ../../library/string.rst:826 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1283,30 +1317,30 @@ msgid "" "specification." msgstr "" -#: ../../library/string.rst:805 +#: ../../library/string.rst:833 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: ../../library/string.rst:809 +#: ../../library/string.rst:837 msgid "" "Any other appearance of ``$`` in the string will result in " "a :exc:`ValueError` being raised." msgstr "" -#: ../../library/string.rst:812 +#: ../../library/string.rst:840 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:818 +#: ../../library/string.rst:846 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:823 +#: ../../library/string.rst:851 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -1318,7 +1352,7 @@ msgstr "" "的字典型物件。或者如果關鍵字就是佔位符號時,你也可以改提供關鍵字引數。當 " "*mapping* 跟 *kwds* 同時給定並存在重複時,*kwds* 的佔位符號會被優先使用。" -#: ../../library/string.rst:832 +#: ../../library/string.rst:860 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -1331,7 +1365,7 @@ msgstr "" "與 :meth:`substitute` 不同的是,任何包含 ``$`` 的字句會直接回傳 ``$`` 而非引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:838 +#: ../../library/string.rst:866 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -1345,7 +1379,7 @@ msgstr "" "完全安全,因為它會默默忽略格式錯誤的模板,這些模板包含了多餘的左右定界符、不" "匹配的括號,或者不是有效的 Python 識別字的佔位符號。" -#: ../../library/string.rst:848 +#: ../../library/string.rst:876 msgid "" "Returns ``False`` if the template has invalid placeholders that will " "cause :meth:`substitute` to raise :exc:`ValueError`." @@ -1353,18 +1387,18 @@ msgstr "" "如果模板有將導致 :meth:`substitute` 引發 :exc:`ValueError` 的無效佔位符號,就" "會回傳 ``False``。" -#: ../../library/string.rst:856 +#: ../../library/string.rst:884 msgid "" "Returns a list of the valid identifiers in the template, in the order they " "first appear, ignoring any invalid identifiers." msgstr "" "回傳模板中有效識別字的串列,按照它們首次出現的順序,並忽略任何無效的識別字。" -#: ../../library/string.rst:861 +#: ../../library/string.rst:889 msgid ":class:`Template` instances also provide one public data attribute:" msgstr ":class:`Template` 實例也提供一個公開的資料屬性:" -#: ../../library/string.rst:865 +#: ../../library/string.rst:893 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." @@ -1372,11 +1406,11 @@ msgstr "" "這是傳遞給建構函式 *template* 引數的物件。一般來說,你不應該改變它,但並沒有" "強制設定成唯讀。" -#: ../../library/string.rst:868 +#: ../../library/string.rst:896 msgid "Here is an example of how to use a Template::" msgstr "以下是如何使用 Template 的一個範例: ::" -#: ../../library/string.rst:870 +#: ../../library/string.rst:898 msgid "" ">>> from string import Template\n" ">>> s = Template('$who likes $what')\n" @@ -1410,7 +1444,7 @@ msgstr "" ">>> Template('$who likes $what').safe_substitute(d)\n" "'tim likes $what'" -#: ../../library/string.rst:886 +#: ../../library/string.rst:914 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1420,7 +1454,7 @@ msgstr "" "進階用法:你可以衍生 :class:`Template` 類別來自定義佔位符號語法、左右定界符字" "元,或者用於剖析模板字串的正規表示式。你可以透過覆寫這些類別屬性來達成:" -#: ../../library/string.rst:891 +#: ../../library/string.rst:919 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " @@ -1434,7 +1468,7 @@ msgstr "" "注意你不能在建立類別後修改左右定界符。(意即在子類別的命名空間中必須設置不同" "的左右定界符)" -#: ../../library/string.rst:898 +#: ../../library/string.rst:926 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1442,19 +1476,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:905 +#: ../../library/string.rst:933 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: ../../library/string.rst:909 +#: ../../library/string.rst:937 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:913 +#: ../../library/string.rst:941 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1463,7 +1497,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:921 +#: ../../library/string.rst:949 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1472,7 +1506,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:929 +#: ../../library/string.rst:957 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1481,13 +1515,13 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:935 +#: ../../library/string.rst:963 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "*escaped* -- 此群組與跳脫序列匹配,例如在預設模式下為 ``$$``。" -#: ../../library/string.rst:938 +#: ../../library/string.rst:966 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." @@ -1495,7 +1529,7 @@ msgstr "" "*named* -- 此群組與不帶大括號的佔位符號名稱匹配;它不應包含擷取群組中的左右定" "界符號。" -#: ../../library/string.rst:941 +#: ../../library/string.rst:969 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." @@ -1503,7 +1537,7 @@ msgstr "" "*braced* -- 此群組與大括號括起來的佔位符號名稱匹配;它不應在擷取群組中包含左" "右定界符或大括號。" -#: ../../library/string.rst:944 +#: ../../library/string.rst:972 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." @@ -1511,7 +1545,7 @@ msgstr "" "*invalid* -- 此群組與任何其他左右定界符模式(通常是單一左右定界符)匹配,且它" "應該出現在正規表示式的最後。" -#: ../../library/string.rst:947 +#: ../../library/string.rst:975 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." @@ -1519,11 +1553,11 @@ msgstr "" "當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:952 +#: ../../library/string.rst:980 msgid "Helper functions" msgstr "輔助函式" -#: ../../library/string.rst:956 +#: ../../library/string.rst:984 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " "using :meth:`str.capitalize`, and join the capitalized words " @@ -1537,76 +1571,76 @@ msgstr "" "不存在或為 ``None``,則連續的空白字元將替換為單一空格,並且刪除前導和尾隨空" "白;在其他情況下則使用 *sep* 來分割和連接單字。" -#: ../../library/string.rst:202 +#: ../../library/string.rst:205 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/string.rst:202 ../../library/string.rst:344 -#: ../../library/string.rst:377 ../../library/string.rst:396 -#: ../../library/string.rst:405 ../../library/string.rst:437 +#: ../../library/string.rst:205 ../../library/string.rst:352 +#: ../../library/string.rst:385 ../../library/string.rst:404 +#: ../../library/string.rst:413 ../../library/string.rst:452 msgid "in string formatting" msgstr "於字串格式化" -#: ../../library/string.rst:202 +#: ../../library/string.rst:205 msgid ". (dot)" msgstr ". (點)" -#: ../../library/string.rst:202 +#: ../../library/string.rst:205 msgid "[] (square brackets)" msgstr "[] (方括號)" -#: ../../library/string.rst:202 +#: ../../library/string.rst:205 msgid "! (exclamation)" msgstr "! (驚嘆號)" -#: ../../library/string.rst:202 +#: ../../library/string.rst:205 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/string.rst:344 +#: ../../library/string.rst:352 msgid "< (less)" msgstr "< (小於)" -#: ../../library/string.rst:344 +#: ../../library/string.rst:352 msgid "> (greater)" msgstr "> (大於)" -#: ../../library/string.rst:344 +#: ../../library/string.rst:352 msgid "= (equals)" msgstr "= (等號)" -#: ../../library/string.rst:344 +#: ../../library/string.rst:352 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/string.rst:377 +#: ../../library/string.rst:385 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../library/string.rst:377 +#: ../../library/string.rst:385 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/string.rst:396 +#: ../../library/string.rst:404 msgid "z" msgstr "z" -#: ../../library/string.rst:405 +#: ../../library/string.rst:413 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/string.rst:437 +#: ../../library/string.rst:452 msgid ", (comma)" msgstr ", (逗號)" -#: ../../library/string.rst:437 +#: ../../library/string.rst:452 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../library/string.rst:792 +#: ../../library/string.rst:820 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/string.rst:792 +#: ../../library/string.rst:820 msgid "in template strings" msgstr "於 template strings(模板字串)" diff --git a/library/string.templatelib.po b/library/string.templatelib.po new file mode 100644 index 00000000000..c2ca9834b74 --- /dev/null +++ b/library/string.templatelib.po @@ -0,0 +1,318 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/string.templatelib.rst:2 +msgid ":mod:`!string.templatelib` --- Support for template string literals" +msgstr "" + +#: ../../library/string.templatelib.rst:7 +msgid "**Source code:** :source:`Lib/string/templatelib.py`" +msgstr "" + +#: ../../library/string.templatelib.rst:13 +msgid ":ref:`Format strings `" +msgstr "" + +#: ../../library/string.templatelib.rst:14 +msgid ":ref:`Template string literal (t-string) syntax `" +msgstr "" + +#: ../../library/string.templatelib.rst:15 +msgid ":pep:`750`" +msgstr "" + +#: ../../library/string.templatelib.rst:20 +msgid "Template strings" +msgstr "" + +#: ../../library/string.templatelib.rst:24 +msgid "" +"Template strings are a mechanism for custom string processing. They have the " +"full flexibility of Python's :ref:`f-strings`, but return " +"a :class:`Template` instance that gives access to the static and " +"interpolated (in curly braces) parts of a string *before* they are combined." +msgstr "" + +#: ../../library/string.templatelib.rst:30 +msgid "" +"To write a t-string, use a ``'t'`` prefix instead of an ``'f'``, like so:" +msgstr "" + +#: ../../library/string.templatelib.rst:32 +msgid "" +">>> pi = 3.14\n" +">>> t't-strings are new in Python {pi!s}!'\n" +"Template(\n" +" strings=('t-strings are new in Python ', '!'),\n" +" interpolations=(Interpolation(3.14, 'pi', 's', ''),)\n" +")" +msgstr "" + +#: ../../library/string.templatelib.rst:42 +msgid "Types" +msgstr "" + +#: ../../library/string.templatelib.rst:46 +msgid "" +"The :class:`!Template` class describes the contents of a template string. It " +"is immutable, meaning that attributes of a template cannot be reassigned." +msgstr "" + +#: ../../library/string.templatelib.rst:49 +msgid "" +"The most common way to create a :class:`!Template` instance is to use " +"the :ref:`template string literal syntax `. This syntax is " +"identical to that of :ref:`f-strings `, except that it uses a " +"``t`` prefix in place of an ``f``:" +msgstr "" + +#: ../../library/string.templatelib.rst:59 +msgid "" +"Templates are stored as sequences of literal :attr:`~Template.strings` and " +"dynamic :attr:`~Template.interpolations`. A :attr:`~Template.values` " +"attribute holds the values of the interpolations:" +msgstr "" + +#: ../../library/string.templatelib.rst:72 +msgid "" +"The :attr:`!strings` tuple has one more element than :attr:`!interpolations` " +"and :attr:`!values`; the interpolations “belong” between the strings. This " +"may be easier to understand when tuples are aligned" +msgstr "" + +#: ../../library/string.templatelib.rst:76 +msgid "" +"template.strings: ('Ah! We do have ', '.')\n" +"template.values: ( 'Camembert', )" +msgstr "" + +#: ../../library/string.templatelib.rst:82 +#: ../../library/string.templatelib.rst:249 +msgid "Attributes" +msgstr "" + +#: ../../library/string.templatelib.rst:86 +msgid "A :class:`tuple` of the static strings in the template." +msgstr "" + +#: ../../library/string.templatelib.rst:93 +msgid "Empty strings *are* included in the tuple:" +msgstr "" + +#: ../../library/string.templatelib.rst:101 +msgid "" +"The ``strings`` tuple is never empty, and always contains one more string " +"than the ``interpolations`` and ``values`` tuples:" +msgstr "" + +#: ../../library/string.templatelib.rst:116 +msgid "A :class:`tuple` of the interpolations in the template." +msgstr "" + +#: ../../library/string.templatelib.rst:123 +msgid "" +"The ``interpolations`` tuple may be empty and always contains one fewer " +"values than the ``strings`` tuple:" +msgstr "" + +#: ../../library/string.templatelib.rst:132 +msgid "A tuple of all interpolated values in the template." +msgstr "" + +#: ../../library/string.templatelib.rst:139 +msgid "" +"The ``values`` tuple always has the same length as the ``interpolations`` " +"tuple. It is always equivalent to ``tuple(i.value for i in " +"template.interpolations)``." +msgstr "" + +#: ../../library/string.templatelib.rst:144 +#: ../../library/string.templatelib.rst:314 +msgid "Methods" +msgstr "" + +#: ../../library/string.templatelib.rst:147 +msgid "" +"While literal syntax is the most common way to create a :class:`!Template`, " +"it is also possible to create them directly using the constructor:" +msgstr "" + +#: ../../library/string.templatelib.rst:158 +msgid "" +"If multiple strings are passed consecutively, they will be concatenated into " +"a single value in the :attr:`~Template.strings` attribute. For example, the " +"following code creates a :class:`Template` with a single final string:" +msgstr "" + +#: ../../library/string.templatelib.rst:167 +msgid "" +"If multiple interpolations are passed consecutively, they will be treated as " +"separate interpolations and an empty string will be inserted between them. " +"For example, the following code creates a template with empty placeholders " +"in the :attr:`~Template.strings` attribute:" +msgstr "" + +#: ../../library/string.templatelib.rst:182 +msgid "" +"Iterate over the template, yielding each non-empty string " +"and :class:`Interpolation` in the correct order:" +msgstr "" + +#: ../../library/string.templatelib.rst:191 +msgid "Empty strings are **not** included in the iteration:" +msgstr "" + +#: ../../library/string.templatelib.rst:204 +msgid "" +"Concatenate this template with another, returning a new :class:`!Template` " +"instance:" +msgstr "" + +#: ../../library/string.templatelib.rst:211 +msgid "" +"Concatenating a :class:`!Template` and a ``str`` is **not** supported. This " +"is because it is unclear whether the string should be treated as a static " +"string or an interpolation. If you want to concatenate a :class:`!Template` " +"with a string, you should either wrap the string directly in a :class:`!" +"Template` (to treat it as a static string) or use an :class:`!Interpolation` " +"(to treat it as dynamic):" +msgstr "" + +#: ../../library/string.templatelib.rst:232 +msgid "" +"The :class:`!Interpolation` type represents an expression inside a template " +"string. It is immutable, meaning that attributes of an interpolation cannot " +"be reassigned." +msgstr "" + +#: ../../library/string.templatelib.rst:235 +msgid "" +"Interpolations support pattern matching, allowing you to match against their " +"attributes with the :ref:`match statement `:" +msgstr "" + +#: ../../library/string.templatelib.rst:253 +msgid "The evaluated value of the interpolation." +msgstr "" + +#: ../../library/string.templatelib.rst:261 +#: ../../library/string.templatelib.rst:323 +msgid "The text of a valid Python expression, or an empty string." +msgstr "" + +#: ../../library/string.templatelib.rst:263 +msgid "" +"The :attr:`.expression` is the original text of the interpolation's Python " +"expression, if the interpolation was created from a t-string literal. " +"Developers creating interpolations manually should either set this to an " +"empty string or choose a suitable valid Python expression." +msgstr "" + +#: ../../library/string.templatelib.rst:275 +msgid "The conversion to apply to the value, or ``None``." +msgstr "" + +#: ../../library/string.templatelib.rst:277 +msgid "" +"The :attr:`!conversion` is the optional conversion to apply to the value:" +msgstr "" + +#: ../../library/string.templatelib.rst:285 +msgid "" +"Unlike f-strings, where conversions are applied automatically, the expected " +"behavior with t-strings is that code that *processes* the :class:`!Template` " +"will decide how to interpret and whether to apply the :attr:`!conversion`. " +"For convenience, the :func:`convert` function can be used to mimic f-string " +"conversion semantics." +msgstr "" + +#: ../../library/string.templatelib.rst:295 +msgid "The format specification to apply to the value." +msgstr "" + +#: ../../library/string.templatelib.rst:297 +msgid "" +"The :attr:`!format_spec` is an optional, arbitrary string used as the format " +"specification to present the value:" +msgstr "" + +#: ../../library/string.templatelib.rst:305 +msgid "" +"Unlike f-strings, where format specifications are applied automatically via " +"the :func:`format` protocol, the expected behavior with t-strings is that " +"code that *processes* the interpolation will decide how to interpret and " +"whether to apply the format specification. As a result, :attr:`!format_spec` " +"values in interpolations can be arbitrary strings, including those that do " +"not conform to the :func:`format` protocol." +msgstr "" + +#: ../../library/string.templatelib.rst:320 +msgid "Create a new :class:`!Interpolation` object from component parts." +msgstr "" + +#: ../../library/string.templatelib.rst:0 +msgid "Parameters" +msgstr "" + +#: ../../library/string.templatelib.rst:322 +msgid "The evaluated, in-scope result of the interpolation." +msgstr "" + +#: ../../library/string.templatelib.rst:325 +msgid "" +"The :ref:`conversion ` to be used, one of ``None``, ``'a'``, " +"``'r'``, or ``'s'``." +msgstr "" + +#: ../../library/string.templatelib.rst:327 +msgid "" +"An optional, arbitrary string used as the :ref:`format specification " +"` to present the value." +msgstr "" + +#: ../../library/string.templatelib.rst:332 +msgid "Helper functions" +msgstr "" + +#: ../../library/string.templatelib.rst:336 +msgid "" +"Applies formatted string literal :ref:`conversion ` semantics to the given object *obj*. This is frequently useful " +"for custom template string processing logic." +msgstr "" + +#: ../../library/string.templatelib.rst:340 +msgid "Three conversion flags are currently supported:" +msgstr "" + +#: ../../library/string.templatelib.rst:342 +msgid "``'s'`` which calls :func:`str` on the value (like ``!s``)," +msgstr "" + +#: ../../library/string.templatelib.rst:343 +msgid "``'r'`` which calls :func:`repr` (like ``!r``), and" +msgstr "" + +#: ../../library/string.templatelib.rst:344 +msgid "``'a'`` which calls :func:`ascii` (like ``!a``)." +msgstr "" + +#: ../../library/string.templatelib.rst:346 +msgid "If the conversion flag is ``None``, *obj* is returned unchanged." +msgstr "" diff --git a/library/struct.po b/library/struct.po index b05f0e78c58..f8ca27ba3c0 100644 --- a/library/struct.po +++ b/library/struct.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -333,7 +333,7 @@ msgstr "" "沒有方法來指示非原生位元組順序(強制位元組交換);請使用適當的 ``'<'`` 或 " "``'>'`` 選擇。" -#: ../../library/struct.rst:198 ../../library/struct.rst:277 +#: ../../library/struct.rst:198 ../../library/struct.rst:284 msgid "Notes:" msgstr "註解:" @@ -445,7 +445,7 @@ msgstr ":c:expr:`signed char`" #: ../../library/struct.rst:244 ../../library/struct.rst:246 #: ../../library/struct.rst:248 ../../library/struct.rst:250 #: ../../library/struct.rst:253 ../../library/struct.rst:255 -#: ../../library/struct.rst:267 +#: ../../library/struct.rst:271 msgid "integer" msgstr "整數" @@ -553,7 +553,7 @@ msgid ":c:expr:`long long`" msgstr ":c:expr:`long long`" #: ../../library/struct.rst:248 ../../library/struct.rst:250 -#: ../../library/struct.rst:261 +#: ../../library/struct.rst:261 ../../library/struct.rst:263 msgid "8" msgstr "8" @@ -620,50 +620,86 @@ msgid ":c:expr:`double`" msgstr ":c:expr:`double`" #: ../../library/struct.rst:263 +msgid "``F``" +msgstr "" + +#: ../../library/struct.rst:263 +#, fuzzy +msgid ":c:expr:`float complex`" +msgstr ":c:expr:`float`" + +#: ../../library/struct.rst:263 ../../library/struct.rst:265 +msgid "complex" +msgstr "" + +#: ../../library/struct.rst:263 ../../library/struct.rst:265 +msgid "\\(10)" +msgstr "" + +#: ../../library/struct.rst:265 +msgid "``D``" +msgstr "" + +#: ../../library/struct.rst:265 +#, fuzzy +msgid ":c:expr:`double complex`" +msgstr ":c:expr:`double`" + +#: ../../library/struct.rst:265 +#, fuzzy +msgid "16" +msgstr "1" + +#: ../../library/struct.rst:267 msgid "``s``" msgstr "``s``" -#: ../../library/struct.rst:263 ../../library/struct.rst:265 +#: ../../library/struct.rst:267 ../../library/struct.rst:269 msgid ":c:expr:`char[]`" msgstr ":c:expr:`char[]`" -#: ../../library/struct.rst:263 ../../library/struct.rst:265 +#: ../../library/struct.rst:267 ../../library/struct.rst:269 msgid "bytes" msgstr "位元組" -#: ../../library/struct.rst:263 +#: ../../library/struct.rst:267 msgid "\\(9)" msgstr "\\(9)" -#: ../../library/struct.rst:265 +#: ../../library/struct.rst:269 msgid "``p``" msgstr "``p``" -#: ../../library/struct.rst:265 +#: ../../library/struct.rst:269 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/struct.rst:267 +#: ../../library/struct.rst:271 msgid "``P``" msgstr "``P``" -#: ../../library/struct.rst:267 +#: ../../library/struct.rst:271 msgid ":c:expr:`void \\*`" msgstr ":c:expr:`void \\*`" -#: ../../library/struct.rst:267 +#: ../../library/struct.rst:271 msgid "\\(5)" msgstr "\\(5)" -#: ../../library/struct.rst:270 +#: ../../library/struct.rst:274 msgid "Added support for the ``'n'`` and ``'N'`` formats." msgstr "新增 ``'n'`` 與 ``'N'`` 格式的支援。" -#: ../../library/struct.rst:273 +#: ../../library/struct.rst:277 msgid "Added support for the ``'e'`` format." msgstr "新增 ``'e'`` 格式的支援。" -#: ../../library/struct.rst:282 +#: ../../library/struct.rst:280 +#, fuzzy +msgid "Added support for the ``'F'`` and ``'D'`` formats." +msgstr "新增 ``'n'`` 與 ``'N'`` 格式的支援。" + +#: ../../library/struct.rst:289 msgid "" "The ``'?'`` conversion code corresponds to the :c:expr:`_Bool` type defined " "by C standards since C99. In standard mode, it is represented by one byte." @@ -671,7 +707,7 @@ msgstr "" "``'?'`` 轉換碼對應於自 C99 以來 C 標準定義的 :c:expr:`_Bool` 型別。在標準模式" "下,它由一個位元組表示。" -#: ../../library/struct.rst:287 +#: ../../library/struct.rst:294 msgid "" "When attempting to pack a non-integer using any of the integer conversion " "codes, if the non-integer has a :meth:`~object.__index__` method then that " @@ -680,11 +716,11 @@ msgstr "" "當嘗試使用任何整數轉換碼打包非整數時,如果非整數具" "有 :meth:`~object.__index__` 方法,則會呼叫該方法在打包之前將引數轉換為整數。" -#: ../../library/struct.rst:291 +#: ../../library/struct.rst:298 msgid "Added use of the :meth:`~object.__index__` method for non-integers." msgstr "新增對非整數使用 :meth:`~object.__index__` 方法的支援。" -#: ../../library/struct.rst:295 +#: ../../library/struct.rst:302 msgid "" "The ``'n'`` and ``'N'`` conversion codes are only available for the native " "size (selected as the default or with the ``'@'`` byte order character). For " @@ -694,7 +730,7 @@ msgstr "" "``'n'`` 和 ``'N'`` 轉換碼僅適用於原生大小(作為預設選擇或使用 ``'@'`` 位元組" "順序字元)。對於標準大小,你可以使用適合你應用程式的其他整數格式。" -#: ../../library/struct.rst:301 +#: ../../library/struct.rst:308 msgid "" "For the ``'f'``, ``'d'`` and ``'e'`` conversion codes, the packed " "representation uses the IEEE 754 binary32, binary64 or binary16 format (for " @@ -705,7 +741,7 @@ msgstr "" "binary64 或 binary16 格式(分別對應於 ``'f'``、``'d'`` 或 ``'e'``),無論平台" "使用何種浮點數格式。" -#: ../../library/struct.rst:307 +#: ../../library/struct.rst:314 msgid "" "The ``'P'`` format character is only available for the native byte ordering " "(selected as the default or with the ``'@'`` byte order character). The byte " @@ -717,7 +753,7 @@ msgstr "" "字元)。位元組順序字元 ``'='`` 根據主機系統選擇使用小端序或大端序。struct 模" "組不將其解釋為原生順序,因此 ``'P'`` 格式不可用。" -#: ../../library/struct.rst:314 +#: ../../library/struct.rst:321 msgid "" "The IEEE 754 binary16 \"half precision\" type was introduced in the 2008 " "revision of the `IEEE 754 standard `_. It has a sign " @@ -735,11 +771,11 @@ msgstr "" "short 可以用於儲存但不能用於數學運算。請參見 Wikipedia 上的\\ `半精度浮點數格" "式 `_\\ 頁面以取得更多資訊。" -#: ../../library/struct.rst:324 +#: ../../library/struct.rst:331 msgid "When packing, ``'x'`` inserts one NUL byte." msgstr "打包時,``'x'`` 插入一個 NUL 位元組。" -#: ../../library/struct.rst:327 +#: ../../library/struct.rst:334 msgid "" "The ``'p'`` format character encodes a \"Pascal string\", meaning a short " "variable-length string stored in a *fixed number of bytes*, given by the " @@ -760,7 +796,7 @@ msgstr "" "``'p'`` 格式字元消耗 ``count`` 個位元組,但回傳的字串永遠不能包含超過 255 個" "位元組。" -#: ../../library/struct.rst:339 +#: ../../library/struct.rst:346 msgid "" "For the ``'s'`` format character, the count is interpreted as the length of " "the bytes, not a repeat count like for the other format characters; for " @@ -782,7 +818,18 @@ msgstr "" "充字串以使其適合。解包時,結果位元組物件總是恰好具有指定的位元組數。作為特殊" "情況,``'0s'`` 表示單一空字串(而 ``'0c'`` 表示 0 個字元)。" -#: ../../library/struct.rst:352 +#: ../../library/struct.rst:360 +msgid "" +"For the ``'F'`` and ``'D'`` format characters, the packed representation " +"uses the IEEE 754 binary32 and binary64 format for components of the complex " +"number, regardless of the floating-point format used by the platform. Note " +"that complex types (``F`` and ``D``) are available unconditionally, despite " +"complex types being an optional feature in C. As specified in the C11 " +"standard, each complex type is represented by a two-element C array " +"containing, respectively, the real and imaginary parts." +msgstr "" + +#: ../../library/struct.rst:369 msgid "" "A format character may be preceded by an integral repeat count. For " "example, the format string ``'4h'`` means exactly the same as ``'hhhh'``." @@ -790,13 +837,13 @@ msgstr "" "格式字元前面可以加上整數重複次數。例如,格式字串 ``'4h'`` 與 ``'hhhh'`` 意思" "完全相同。" -#: ../../library/struct.rst:355 +#: ../../library/struct.rst:372 msgid "" "Whitespace characters between formats are ignored; a count and its format " "must not contain whitespace though." msgstr "格式之間的空白字元會被忽略;但是計數和其格式不能包含空白字元。" -#: ../../library/struct.rst:358 +#: ../../library/struct.rst:375 msgid "" "When packing a value ``x`` using one of the integer formats (``'b'``, " "``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``, ``'q'``, " @@ -807,7 +854,7 @@ msgstr "" "``'l'``、``'L'``、``'q'``、``'Q'``)打包數值 ``x`` 時,如果 ``x`` 超出該格式" "的有效範圍,則會觸發 :exc:`struct.error`。" -#: ../../library/struct.rst:363 +#: ../../library/struct.rst:380 msgid "" "Previously, some of the integer formats wrapped out-of-range values and " "raised :exc:`DeprecationWarning` instead of :exc:`struct.error`." @@ -815,7 +862,7 @@ msgstr "" "以前一些整數格式會環繞超出範圍的數值並引發 :exc:`DeprecationWarning` 而不" "是 :exc:`struct.error`。" -#: ../../library/struct.rst:369 +#: ../../library/struct.rst:386 msgid "" "For the ``'?'`` format character, the return value is either :const:`True` " "or :const:`False`. When packing, the truth value of the argument object is " @@ -826,11 +873,11 @@ msgstr "" "引數物件的真值。原生或標準布林值表示法中的 0 或 1 將被打包,解包時任何非零值" "都將為 ``True``。" -#: ../../library/struct.rst:379 +#: ../../library/struct.rst:396 msgid "Examples" msgstr "範例" -#: ../../library/struct.rst:382 +#: ../../library/struct.rst:399 msgid "" "Native byte order examples (designated by the ``'@'`` format prefix or lack " "of any prefix character) may not match what the reader's machine produces as " @@ -839,13 +886,13 @@ msgstr "" "原生位元組順序範例(由 ``'@'`` 格式前綴或缺少任何前綴字元指定)可能與讀者機器" "產生的結果不符,因為這取決於平台和編譯器。" -#: ../../library/struct.rst:387 +#: ../../library/struct.rst:404 msgid "" "Pack and unpack integers of three different sizes, using big endian " "ordering::" msgstr "使用大端序打包和解包三種不同大小的整數: ::" -#: ../../library/struct.rst:390 +#: ../../library/struct.rst:407 msgid "" ">>> from struct import *\n" ">>> pack(\">bhl\", 1, 2, 3)\n" @@ -863,11 +910,11 @@ msgstr "" ">>> calcsize('>bhl')\n" "7" -#: ../../library/struct.rst:398 +#: ../../library/struct.rst:415 msgid "Attempt to pack an integer which is too large for the defined field::" msgstr "嘗試打包對於定義欄位來說太大的整數: ::" -#: ../../library/struct.rst:400 +#: ../../library/struct.rst:417 msgid "" ">>> pack(\">h\", 99999)\n" "Traceback (most recent call last):\n" @@ -879,12 +926,12 @@ msgstr "" " File \"\", line 1, in \n" "struct.error: 'h' format requires -32768 <= number <= 32767" -#: ../../library/struct.rst:405 +#: ../../library/struct.rst:422 msgid "" "Demonstrate the difference between ``'s'`` and ``'c'`` format characters::" msgstr "示範 ``'s'`` 和 ``'c'`` 格式字元之間的差異: ::" -#: ../../library/struct.rst:408 +#: ../../library/struct.rst:425 msgid "" ">>> pack(\"@ccc\", b'1', b'2', b'3')\n" "b'123'\n" @@ -896,13 +943,13 @@ msgstr "" ">>> pack(\"@3s\", b'123')\n" "b'123'" -#: ../../library/struct.rst:413 +#: ../../library/struct.rst:430 msgid "" "Unpacked fields can be named by assigning them to variables or by wrapping " "the result in a named tuple::" msgstr "解包的欄位可以透過將其指派給變數或將結果包裝在具名元組中來命名: ::" -#: ../../library/struct.rst:416 +#: ../../library/struct.rst:433 msgid "" ">>> record = b'raymond \\x32\\x12\\x08\\x01\\x08'\n" ">>> name, serialnum, school, gradelevel = unpack('<10sHHb', record)\n" @@ -920,7 +967,7 @@ msgstr "" ">>> Student._make(unpack('<10sHHb', record))\n" "Student(name=b'raymond ', serialnum=4658, school=264, gradelevel=8)" -#: ../../library/struct.rst:424 +#: ../../library/struct.rst:441 msgid "" "The ordering of format characters may have an impact on size in native mode " "since padding is implicit. In standard mode, the user is responsible for " @@ -934,7 +981,7 @@ msgstr "" "``'#'`` 之後加入了三個 NUL 位元組,以將後續整數對齊到四位元組邊界。在此範例" "中,輸出是在小端序機器上產生的: ::" -#: ../../library/struct.rst:432 +#: ../../library/struct.rst:449 msgid "" ">>> pack('@ci', b'#', 0x12131415)\n" "b'#\\x00\\x00\\x00\\x15\\x14\\x13\\x12'\n" @@ -954,7 +1001,7 @@ msgstr "" ">>> calcsize('@ic')\n" "5" -#: ../../library/struct.rst:441 +#: ../../library/struct.rst:458 msgid "" "The following format ``'llh0l'`` results in two pad bytes being added at the " "end, assuming the platform's longs are aligned on 4-byte boundaries::" @@ -962,7 +1009,7 @@ msgstr "" "假設平台的 long 對齊到 4 位元組邊界,以下格式 ``'llh0l'`` 會在結尾加入兩個填" "充位元組: ::" -#: ../../library/struct.rst:444 +#: ../../library/struct.rst:461 msgid "" ">>> pack('@llh0l', 1, 2, 3)\n" "b'\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x02\\x00\\x03\\x00\\x00'" @@ -970,35 +1017,35 @@ msgstr "" ">>> pack('@llh0l', 1, 2, 3)\n" "b'\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x02\\x00\\x03\\x00\\x00'" -#: ../../library/struct.rst:450 +#: ../../library/struct.rst:467 msgid "Module :mod:`array`" msgstr ":mod:`array` 模組" -#: ../../library/struct.rst:451 +#: ../../library/struct.rst:468 msgid "Packed binary storage of homogeneous data." msgstr "同質資料的打包二進位儲存。" -#: ../../library/struct.rst:453 +#: ../../library/struct.rst:470 msgid "Module :mod:`json`" msgstr ":mod:`json` 模組" -#: ../../library/struct.rst:454 +#: ../../library/struct.rst:471 msgid "JSON encoder and decoder." msgstr "JSON 編碼器和解碼器。" -#: ../../library/struct.rst:456 +#: ../../library/struct.rst:473 msgid "Module :mod:`pickle`" msgstr ":mod:`pickle` 模組" -#: ../../library/struct.rst:457 +#: ../../library/struct.rst:474 msgid "Python object serialization." msgstr "Python 物件序列化。" -#: ../../library/struct.rst:463 +#: ../../library/struct.rst:480 msgid "Applications" msgstr "應用" -#: ../../library/struct.rst:465 +#: ../../library/struct.rst:482 msgid "" "Two main applications for the :mod:`struct` module exist, data interchange " "between Python and C code within an application or another application " @@ -1013,11 +1060,11 @@ msgstr "" "格式 `)。一般來說,為這兩個領域建構的格式字串是不同" "的。" -#: ../../library/struct.rst:476 +#: ../../library/struct.rst:493 msgid "Native Formats" msgstr "原生格式" -#: ../../library/struct.rst:478 +#: ../../library/struct.rst:495 msgid "" "When constructing format strings which mimic native layouts, the compiler " "and machine architecture determine byte ordering and padding. In such cases, " @@ -1032,12 +1079,12 @@ msgstr "" "組通常會自動插入。可能需要在格式字串的結尾使用零重複格式碼來向上舍入到正確的" "位元組邊界,以便正確對齊連續的資料區塊 (chunks)。" -#: ../../library/struct.rst:486 +#: ../../library/struct.rst:503 msgid "" "Consider these two simple examples (on a 64-bit, little-endian machine)::" msgstr "考慮這兩個簡單範例(在 64 位元小端序機器上): ::" -#: ../../library/struct.rst:489 +#: ../../library/struct.rst:506 msgid "" ">>> calcsize('@lhl')\n" "24\n" @@ -1049,7 +1096,7 @@ msgstr "" ">>> calcsize('@llh')\n" "18" -#: ../../library/struct.rst:494 +#: ../../library/struct.rst:511 msgid "" "Data is not padded to an 8-byte boundary at the end of the second format " "string without the use of extra padding. A zero-repeat format code solves " @@ -1058,7 +1105,7 @@ msgstr "" "在第二個格式字串的結尾,如果不使用額外填充,資料不會填充到 8 位元組邊界。零重" "複格式碼解決了這個問題: ::" -#: ../../library/struct.rst:498 +#: ../../library/struct.rst:515 msgid "" ">>> calcsize('@llh0l')\n" "24" @@ -1066,7 +1113,7 @@ msgstr "" ">>> calcsize('@llh0l')\n" "24" -#: ../../library/struct.rst:501 +#: ../../library/struct.rst:518 msgid "" "The ``'x'`` format code can be used to specify the repeat, but for native " "formats it is better to use a zero-repeat format like ``'0l'``." @@ -1074,17 +1121,17 @@ msgstr "" "``'x'`` 格式碼可以用來指定重複,但對於原生格式來說最好使用像 ``'0l'`` 這樣的" "零重複格式。" -#: ../../library/struct.rst:504 +#: ../../library/struct.rst:521 msgid "" "By default, native byte ordering and alignment is used, but it is better to " "be explicit and use the ``'@'`` prefix character." msgstr "預設使用原生位元組順序和對齊,但最好明確使用 ``'@'`` 前綴字元。" -#: ../../library/struct.rst:511 +#: ../../library/struct.rst:528 msgid "Standard Formats" msgstr "標準格式" -#: ../../library/struct.rst:513 +#: ../../library/struct.rst:530 msgid "" "When exchanging data beyond your process such as networking or storage, be " "precise. Specify the exact byte order, size, and alignment. Do not assume " @@ -1104,7 +1151,7 @@ msgstr "" "計師的責任。零重複格式字元不會起作用。取而代之的是使用者必須在需要的地方明確" "加入 ``'x'`` 填充位元組。重新檢視上一節的範例,我們有: ::" -#: ../../library/struct.rst:525 +#: ../../library/struct.rst:542 msgid "" ">>> calcsize('>> pack('@llh0l', 1, 2, 3) == pack('>> calcsize('>> pack('@llh0l', 1, 2, 3) == pack(' (大於)" msgid "! (exclamation)" msgstr "! (驚嘆號)" -#: ../../library/struct.rst:280 ../../library/struct.rst:367 +#: ../../library/struct.rst:287 ../../library/struct.rst:384 msgid "? (question mark)" msgstr "? (問號)" diff --git a/library/subprocess.po b/library/subprocess.po index 4b582875917..f20b95870ac 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-06 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -53,7 +53,7 @@ msgstr ":pep:`324` -- 提議 subprocess 模組的 PEP" #: ../../library/subprocess.rst:598 ../../library/subprocess.rst:605 #: ../../library/subprocess.rst:615 ../../library/subprocess.rst:624 #: ../../library/subprocess.rst:633 ../../library/subprocess.rst:639 -#: ../../library/subprocess.rst:1560 ../../library/subprocess.rst:1582 +#: ../../library/subprocess.rst:1494 ../../library/subprocess.rst:1516 #: ../../includes/wasm-mobile-notavail.rst:3 msgid "Availability" msgstr "可用性" @@ -99,19 +99,20 @@ msgid "" "the internal :class:`Popen` object is automatically created with *stdout* " "and *stderr* both set to :data:`~subprocess.PIPE`. The *stdout* and *stderr* " "arguments may not be supplied at the same time as *capture_output*. If you " -"wish to capture and combine both streams into one, set *stdout* to :data:" -"`~subprocess.PIPE` and *stderr* to :data:`~subprocess.STDOUT`, instead of " -"using *capture_output*." +"wish to capture and combine both streams into one, set *stdout* " +"to :data:`~subprocess.PIPE` and *stderr* to :data:`~subprocess.STDOUT`, " +"instead of using *capture_output*." msgstr "" #: ../../library/subprocess.rst:62 msgid "" -"A *timeout* may be specified in seconds, it is internally passed on to :meth:" -"`Popen.communicate`. If the timeout expires, the child process will be " -"killed and waited for. The :exc:`TimeoutExpired` exception will be re-raised " -"after the child process has terminated. The initial process creation itself " -"cannot be interrupted on many platform APIs so you are not guaranteed to see " -"a timeout exception until at least after however long process creation takes." +"A *timeout* may be specified in seconds, it is internally passed on " +"to :meth:`Popen.communicate`. If the timeout expires, the child process will " +"be killed and waited for. The :exc:`TimeoutExpired` exception will be re-" +"raised after the child process has terminated. The initial process creation " +"itself cannot be interrupted on many platform APIs so you are not guaranteed " +"to see a timeout exception until at least after however long process " +"creation takes." msgstr "" #: ../../library/subprocess.rst:70 @@ -119,16 +120,17 @@ msgid "" "The *input* argument is passed to :meth:`Popen.communicate` and thus to the " "subprocess's stdin. If used it must be a byte sequence, or a string if " "*encoding* or *errors* is specified or *text* is true. When used, the " -"internal :class:`Popen` object is automatically created with *stdin* set to :" -"data:`~subprocess.PIPE`, and the *stdin* argument may not be used as well." +"internal :class:`Popen` object is automatically created with *stdin* set " +"to :data:`~subprocess.PIPE`, and the *stdin* argument may not be used as " +"well." msgstr "" #: ../../library/subprocess.rst:77 msgid "" -"If *check* is true, and the process exits with a non-zero exit code, a :exc:" -"`CalledProcessError` exception will be raised. Attributes of that exception " -"hold the arguments, the exit code, and stdout and stderr if they were " -"captured." +"If *check* is true, and the process exits with a non-zero exit code, " +"a :exc:`CalledProcessError` exception will be raised. Attributes of that " +"exception hold the arguments, the exit code, and stdout and stderr if they " +"were captured." msgstr "" #: ../../library/subprocess.rst:82 @@ -146,8 +148,8 @@ msgid "" "variables for the new process; these are used instead of the default " "behavior of inheriting the current process' environment. It is passed " "directly to :class:`Popen`. This mapping can be str to str on any platform " -"or bytes to bytes on POSIX platforms much like :data:`os.environ` or :data:" -"`os.environb`." +"or bytes to bytes on POSIX platforms much like :data:`os.environ` " +"or :data:`os.environb`." msgstr "" #: ../../library/subprocess.rst:95 @@ -198,8 +200,8 @@ msgstr "" msgid "" "Changed Windows shell search order for ``shell=True``. The current directory " "and ``%PATH%`` are replaced with ``%COMSPEC%`` and ``%SystemRoot%" -"\\System32\\cmd.exe``. As a result, dropping a malicious program named ``cmd." -"exe`` into a current directory no longer works." +"\\System32\\cmd.exe``. As a result, dropping a malicious program named " +"``cmd.exe`` into a current directory no longer works." msgstr "" #: ../../library/subprocess.rst:130 @@ -226,9 +228,9 @@ msgstr "" #: ../../library/subprocess.rst:146 msgid "" -"Captured stdout from the child process. A bytes sequence, or a string if :" -"func:`run` was called with an encoding, errors, or text=True. ``None`` if " -"stdout was not captured." +"Captured stdout from the child process. A bytes sequence, or a string " +"if :func:`run` was called with an encoding, errors, or text=True. ``None`` " +"if stdout was not captured." msgstr "" #: ../../library/subprocess.rst:150 @@ -239,9 +241,9 @@ msgstr "" #: ../../library/subprocess.rst:156 msgid "" -"Captured stderr from the child process. A bytes sequence, or a string if :" -"func:`run` was called with an encoding, errors, or text=True. ``None`` if " -"stderr was not captured." +"Captured stderr from the child process. A bytes sequence, or a string " +"if :func:`run` was called with an encoding, errors, or text=True. ``None`` " +"if stderr was not captured." msgstr "" #: ../../library/subprocess.rst:162 @@ -289,10 +291,11 @@ msgstr "" #: ../../library/subprocess.rst:211 msgid "" -"Output of the child process if it was captured by :func:`run` or :func:" -"`check_output`. Otherwise, ``None``. This is always :class:`bytes` when " -"any output was captured regardless of the ``text=True`` setting. It may " -"remain ``None`` instead of ``b''`` when no output was observed." +"Output of the child process if it was captured by :func:`run` " +"or :func:`check_output`. Otherwise, ``None``. This is " +"always :class:`bytes` when any output was captured regardless of the " +"``text=True`` setting. It may remain ``None`` instead of ``b''`` when no " +"output was observed." msgstr "" #: ../../library/subprocess.rst:219 ../../library/subprocess.rst:256 @@ -313,9 +316,9 @@ msgstr "" #: ../../library/subprocess.rst:235 msgid "" -"Subclass of :exc:`SubprocessError`, raised when a process run by :func:" -"`check_call`, :func:`check_output`, or :func:`run` (with ``check=True``) " -"returns a non-zero exit status." +"Subclass of :exc:`SubprocessError`, raised when a process run " +"by :func:`check_call`, :func:`check_output`, or :func:`run` (with " +"``check=True``) returns a non-zero exit status." msgstr "" #: ../../library/subprocess.rst:242 @@ -326,8 +329,8 @@ msgstr "" #: ../../library/subprocess.rst:251 msgid "" -"Output of the child process if it was captured by :func:`run` or :func:" -"`check_output`. Otherwise, ``None``." +"Output of the child process if it was captured by :func:`run` " +"or :func:`check_output`. Otherwise, ``None``." msgstr "" #: ../../library/subprocess.rst:260 @@ -366,10 +369,10 @@ msgid "" "descriptor (a positive integer), and an existing :term:`file object` with a " "valid file descriptor. With the default settings of ``None``, no " "redirection will occur. :data:`PIPE` indicates that a new pipe to the child " -"should be created. :data:`DEVNULL` indicates that the special file :data:" -"`os.devnull` will be used. Additionally, *stderr* can be :data:`STDOUT`, " -"which indicates that the stderr data from the child process should be " -"captured into the same file handle as for *stdout*." +"should be created. :data:`DEVNULL` indicates that the special " +"file :data:`os.devnull` will be used. Additionally, *stderr* can " +"be :data:`STDOUT`, which indicates that the stderr data from the child " +"process should be captured into the same file handle as for *stdout*." msgstr "" #: ../../library/subprocess.rst:299 @@ -395,8 +398,8 @@ msgid "" "binary streams. No encoding or line ending conversion is performed." msgstr "" -#: ../../library/subprocess.rst:314 ../../library/subprocess.rst:1569 -#: ../../library/subprocess.rst:1587 +#: ../../library/subprocess.rst:314 ../../library/subprocess.rst:1503 +#: ../../library/subprocess.rst:1521 msgid "Added the *encoding* and *errors* parameters." msgstr "新增 *encoding* 與 *errors* 參數。" @@ -406,9 +409,9 @@ msgstr "" #: ../../library/subprocess.rst:322 msgid "" -"The newlines attribute of the file objects :attr:`Popen.stdin`, :attr:`Popen." -"stdout` and :attr:`Popen.stderr` are not updated by the :meth:`Popen." -"communicate` method." +"The newlines attribute of the file " +"objects :attr:`Popen.stdin`, :attr:`Popen.stdout` and :attr:`Popen.stderr` " +"are not updated by the :meth:`Popen.communicate` method." msgstr "" #: ../../library/subprocess.rst:326 @@ -419,17 +422,18 @@ msgid "" "convenient access to other shell features such as shell pipes, filename " "wildcards, environment variable expansion, and expansion of ``~`` to a " "user's home directory. However, note that Python itself offers " -"implementations of many shell-like features (in particular, :mod:`glob`, :" -"mod:`fnmatch`, :func:`os.walk`, :func:`os.path.expandvars`, :func:`os.path." -"expanduser`, and :mod:`shutil`)." +"implementations of many shell-like features (in " +"particular, :mod:`glob`, :mod:`fnmatch`, :func:`os.walk`, :func:`os.path.expandvars`, :func:`os.path.expanduser`, " +"and :mod:`shutil`)." msgstr "" #: ../../library/subprocess.rst:336 msgid "" -"When *universal_newlines* is ``True``, the class uses the encoding :func:" -"`locale.getpreferredencoding(False) ` instead " -"of ``locale.getpreferredencoding()``. See the :class:`io.TextIOWrapper` " -"class for more information on this change." +"When *universal_newlines* is ``True``, the class uses the " +"encoding :func:`locale.getpreferredencoding(False) " +"` instead of " +"``locale.getpreferredencoding()``. See the :class:`io.TextIOWrapper` class " +"for more information on this change." msgstr "" #: ../../library/subprocess.rst:344 ../../library/subprocess.rst:465 @@ -457,16 +461,16 @@ msgstr "" #: ../../library/subprocess.rst:368 msgid "" -"Execute a child program in a new process. On POSIX, the class uses :meth:" -"`os.execvpe`-like behavior to execute the child program. On Windows, the " -"class uses the Windows ``CreateProcess()`` function. The arguments to :" -"class:`Popen` are as follows." +"Execute a child program in a new process. On POSIX, the class " +"uses :meth:`os.execvpe`-like behavior to execute the child program. On " +"Windows, the class uses the Windows ``CreateProcess()`` function. The " +"arguments to :class:`Popen` are as follows." msgstr "" #: ../../library/subprocess.rst:373 msgid "" -"*args* should be a sequence of program arguments or else a single string or :" -"term:`path-like object`. By default, the program to execute is the first " +"*args* should be a sequence of program arguments or else a single string " +"or :term:`path-like object`. By default, the program to execute is the first " "item in *args* if *args* is a sequence. If *args* is a string, the " "interpretation is platform-dependent and described below. See the *shell* " "and *executable* arguments for additional differences from the default " @@ -586,8 +590,8 @@ msgid "" "when typed at the shell prompt. This includes, for example, quoting or " "backslash escaping filenames with spaces in them. If *args* is a sequence, " "the first item specifies the command string, and any additional items will " -"be treated as additional arguments to the shell itself. That is to say, :" -"class:`Popen` does the equivalent of::" +"be treated as additional arguments to the shell itself. That is to " +"say, :class:`Popen` does the equivalent of::" msgstr "" #: ../../library/subprocess.rst:455 @@ -627,8 +631,8 @@ msgstr "" #: ../../library/subprocess.rst:477 msgid "" -"negative bufsize (the default) means the system default of io." -"DEFAULT_BUFFER_SIZE will be used." +"negative bufsize (the default) means the system default of " +"io.DEFAULT_BUFFER_SIZE will be used." msgstr "" #: ../../library/subprocess.rst:480 @@ -671,10 +675,10 @@ msgid "" "descriptor (a positive integer), and an existing :term:`file object` with a " "valid file descriptor. With the default settings of ``None``, no " "redirection will occur. :data:`PIPE` indicates that a new pipe to the child " -"should be created. :data:`DEVNULL` indicates that the special file :data:" -"`os.devnull` will be used. Additionally, *stderr* can be :data:`STDOUT`, " -"which indicates that the stderr data from the applications should be " -"captured into the same file handle as for *stdout*." +"should be created. :data:`DEVNULL` indicates that the special " +"file :data:`os.devnull` will be used. Additionally, *stderr* can " +"be :data:`STDOUT`, which indicates that the stderr data from the " +"applications should be captured into the same file handle as for *stdout*." msgstr "" #: ../../library/subprocess.rst:523 @@ -716,8 +720,8 @@ msgstr "" #: ../../library/subprocess.rst:552 msgid "" "On Windows, if *close_fds* is true then no handles will be inherited by the " -"child process unless explicitly passed in the ``handle_list`` element of :" -"attr:`STARTUPINFO.lpAttributeList`, or by standard handle redirection." +"child process unless explicitly passed in the ``handle_list`` element " +"of :attr:`STARTUPINFO.lpAttributeList`, or by standard handle redirection." msgstr "" #: ../../library/subprocess.rst:556 @@ -728,16 +732,16 @@ msgstr "" #: ../../library/subprocess.rst:560 msgid "" -"On Windows the default for *close_fds* was changed from :const:`False` to :" -"const:`True` when redirecting the standard handles. It's now possible to set " -"*close_fds* to :const:`True` when redirecting the standard handles." +"On Windows the default for *close_fds* was changed from :const:`False` " +"to :const:`True` when redirecting the standard handles. It's now possible to " +"set *close_fds* to :const:`True` when redirecting the standard handles." msgstr "" #: ../../library/subprocess.rst:565 msgid "" "*pass_fds* is an optional sequence of file descriptors to keep open between " -"the parent and child. Providing any *pass_fds* forces *close_fds* to be :" -"const:`True`. (POSIX only)" +"the parent and child. Providing any *pass_fds* forces *close_fds* to " +"be :const:`True`. (POSIX only)" msgstr "" #: ../../library/subprocess.rst:569 @@ -747,10 +751,10 @@ msgstr "新增 *pass_fds* 參數。" #: ../../library/subprocess.rst:572 msgid "" "If *cwd* is not ``None``, the function changes the working directory to " -"*cwd* before executing the child. *cwd* can be a string, bytes or :term:" -"`path-like ` object. On POSIX, the function looks for " -"*executable* (or for the first item in *args*) relative to *cwd* if the " -"executable path is a relative path." +"*cwd* before executing the child. *cwd* can be a string, bytes " +"or :term:`path-like ` object. On POSIX, the function " +"looks for *executable* (or for the first item in *args*) relative to *cwd* " +"if the executable path is a relative path." msgstr "" #: ../../library/subprocess.rst:578 @@ -835,8 +839,8 @@ msgid "" "If *env* is not ``None``, it must be a mapping that defines the environment " "variables for the new process; these are used instead of the default " "behavior of inheriting the current process' environment. This mapping can be " -"str to str on any platform or bytes to bytes on POSIX platforms much like :" -"data:`os.environ` or :data:`os.environb`." +"str to str on any platform or bytes to bytes on POSIX platforms much " +"like :data:`os.environ` or :data:`os.environb`." msgstr "" #: ../../library/subprocess.rst:650 @@ -951,8 +955,8 @@ msgstr "" #: ../../library/subprocess.rst:701 ../../library/subprocess.rst:703 msgid "" -"Popen and the other functions in this module that use it raise an :ref:" -"`auditing event ` ``subprocess.Popen`` with arguments " +"Popen and the other functions in this module that use it raise " +"an :ref:`auditing event ` ``subprocess.Popen`` with arguments " "``executable``, ``args``, ``cwd``, and ``env``. The value for ``args`` may " "be a single string or a list of strings, depending on platform." msgstr "" @@ -972,8 +976,8 @@ msgid "" "Popen can use :func:`os.posix_spawn` in some cases for better performance. " "On Windows Subsystem for Linux and QEMU User Emulation, Popen constructor " "using :func:`os.posix_spawn` no longer raise an exception on errors like " -"missing program, but the child process fails with a non-zero :attr:`~Popen." -"returncode`." +"missing program, but the child process fails with a non-" +"zero :attr:`~Popen.returncode`." msgstr "" #: ../../library/subprocess.rst:724 @@ -990,11 +994,11 @@ msgstr "" msgid "" "The most common exception raised is :exc:`OSError`. This occurs, for " "example, when trying to execute a non-existent file. Applications should " -"prepare for :exc:`OSError` exceptions. Note that, when ``shell=True``, :exc:" -"`OSError` will be raised by the child only if the selected shell itself was " -"not found. To determine if the shell failed to find the requested " -"application, it is necessary to check the return code or output from the " -"subprocess." +"prepare for :exc:`OSError` exceptions. Note that, when " +"``shell=True``, :exc:`OSError` will be raised by the child only if the " +"selected shell itself was not found. To determine if the shell failed to " +"find the requested application, it is necessary to check the return code or " +"output from the subprocess." msgstr "" #: ../../library/subprocess.rst:736 @@ -1005,15 +1009,16 @@ msgstr "" #: ../../library/subprocess.rst:739 msgid "" -":func:`check_call` and :func:`check_output` will raise :exc:" -"`CalledProcessError` if the called process returns a non-zero return code." +":func:`check_call` and :func:`check_output` will " +"raise :exc:`CalledProcessError` if the called process returns a non-zero " +"return code." msgstr "" #: ../../library/subprocess.rst:743 msgid "" -"All of the functions and methods that accept a *timeout* parameter, such as :" -"func:`run` and :meth:`Popen.communicate` will raise :exc:`TimeoutExpired` if " -"the timeout expires before the process exits." +"All of the functions and methods that accept a *timeout* parameter, such " +"as :func:`run` and :meth:`Popen.communicate` will " +"raise :exc:`TimeoutExpired` if the timeout expires before the process exits." msgstr "" #: ../../library/subprocess.rst:747 @@ -1049,8 +1054,8 @@ msgid "" "this library. This could result in arguments being parsed according to shell " "rules, but without any escaping added by Python. If you are intentionally " "launching a batch file with arguments from untrusted sources, consider " -"passing ``shell=True`` to allow Python to escape special characters. See :gh:" -"`114539` for additional discussion." +"passing ``shell=True`` to allow Python to escape special characters. " +"See :gh:`114539` for additional discussion." msgstr "" #: ../../library/subprocess.rst:777 @@ -1063,21 +1068,21 @@ msgstr "" #: ../../library/subprocess.rst:784 msgid "" -"Check if child process has terminated. Set and return :attr:`~Popen." -"returncode` attribute. Otherwise, returns ``None``." +"Check if child process has terminated. Set and " +"return :attr:`~Popen.returncode` attribute. Otherwise, returns ``None``." msgstr "" #: ../../library/subprocess.rst:790 msgid "" -"Wait for child process to terminate. Set and return :attr:`~Popen." -"returncode` attribute." +"Wait for child process to terminate. Set and " +"return :attr:`~Popen.returncode` attribute." msgstr "" #: ../../library/subprocess.rst:793 msgid "" -"If the process does not terminate after *timeout* seconds, raise a :exc:" -"`TimeoutExpired` exception. It is safe to catch this exception and retry " -"the wait." +"If the process does not terminate after *timeout* seconds, raise " +"a :exc:`TimeoutExpired` exception. It is safe to catch this exception and " +"retry the wait." msgstr "" #: ../../library/subprocess.rst:799 @@ -1092,8 +1097,8 @@ msgstr "" msgid "" "When the ``timeout`` parameter is not ``None``, then (on POSIX) the function " "is implemented using a busy loop (non-blocking call and short sleeps). Use " -"the :mod:`asyncio` module for an asynchronous wait: see :class:`asyncio." -"create_subprocess_exec`." +"the :mod:`asyncio` module for an asynchronous wait: " +"see :class:`asyncio.create_subprocess_exec`." msgstr "" #: ../../library/subprocess.rst:811 ../../library/subprocess.rst:852 @@ -1128,9 +1133,9 @@ msgstr "" #: ../../library/subprocess.rst:832 msgid "" -"If the process does not terminate after *timeout* seconds, a :exc:" -"`TimeoutExpired` exception will be raised. Catching this exception and " -"retrying communication will not lose any output." +"If the process does not terminate after *timeout* seconds, " +"a :exc:`TimeoutExpired` exception will be raised. Catching this exception " +"and retrying communication will not lose any output." msgstr "" #: ../../library/subprocess.rst:836 @@ -1233,10 +1238,10 @@ msgstr "" #: ../../library/subprocess.rst:922 msgid "" -"Use :meth:`~Popen.communicate` rather than :attr:`.stdin.write `, :attr:`.stdout.read ` or :attr:`.stderr.read ` to avoid deadlocks due to any of the other OS pipe buffers filling " -"up and blocking the child process." +"Use :meth:`~Popen.communicate` rather than :attr:`.stdin.write " +"`, :attr:`.stdout.read ` or :attr:`.stderr.read " +"` to avoid deadlocks due to any of the other OS pipe buffers " +"filling up and blocking the child process." msgstr "" #: ../../library/subprocess.rst:930 @@ -1293,12 +1298,12 @@ msgstr "" #: ../../library/subprocess.rst:971 msgid "" "si = subprocess.STARTUPINFO()\n" -"si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess." -"STARTF_USESHOWWINDOW" +"si.dwFlags = subprocess.STARTF_USESTDHANDLES | " +"subprocess.STARTF_USESHOWWINDOW" msgstr "" "si = subprocess.STARTUPINFO()\n" -"si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess." -"STARTF_USESHOWWINDOW" +"si.dwFlags = subprocess.STARTF_USESTDHANDLES | " +"subprocess.STARTF_USESHOWWINDOW" #: ../../library/subprocess.rst:976 msgid "" @@ -1332,15 +1337,15 @@ msgstr "" #: ../../library/subprocess.rst:1003 msgid "" -":data:`SW_HIDE` is provided for this attribute. It is used when :class:" -"`Popen` is called with ``shell=True``." +":data:`SW_HIDE` is provided for this attribute. It is used " +"when :class:`Popen` is called with ``shell=True``." msgstr "" #: ../../library/subprocess.rst:1008 msgid "" "A dictionary of additional attributes for process creation as given in " -"``STARTUPINFOEX``, see `UpdateProcThreadAttribute `__." +"``STARTUPINFOEX``, see `UpdateProcThreadAttribute `__." msgstr "" #: ../../library/subprocess.rst:1012 @@ -1359,9 +1364,9 @@ msgstr "" #: ../../library/subprocess.rst:1018 msgid "" -"The handles must be temporarily made inheritable by :func:`os." -"set_handle_inheritable` when passed to the :class:`Popen` constructor, else :" -"class:`OSError` will be raised with Windows error " +"The handles must be temporarily made inheritable " +"by :func:`os.set_handle_inheritable` when passed to the :class:`Popen` " +"constructor, else :class:`OSError` will be raised with Windows error " "``ERROR_INVALID_PARAMETER`` (87)." msgstr "" @@ -1369,9 +1374,9 @@ msgstr "" msgid "" "In a multithreaded process, use caution to avoid leaking handles that are " "marked inheritable when combining this feature with concurrent calls to " -"other process creation functions that inherit all handles such as :func:`os." -"system`. This also applies to standard handle redirection, which " -"temporarily creates inheritable handles." +"other process creation functions that inherit all handles such " +"as :func:`os.system`. This also applies to standard handle redirection, " +"which temporarily creates inheritable handles." msgstr "" #: ../../library/subprocess.rst:1035 @@ -1406,9 +1411,9 @@ msgstr "" #: ../../library/subprocess.rst:1060 msgid "" -"Specifies that the :attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO." -"hStdOutput`, and :attr:`STARTUPINFO.hStdError` attributes contain additional " -"information." +"Specifies that " +"the :attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO.hStdOutput`, " +"and :attr:`STARTUPINFO.hStdError` attributes contain additional information." msgstr "" #: ../../library/subprocess.rst:1066 @@ -1562,10 +1567,11 @@ msgstr "" #: ../../library/subprocess.rst:1224 msgid "" "Run command with arguments. Wait for command to complete. If the return " -"code was zero then return, otherwise raise :exc:`CalledProcessError`. The :" -"exc:`CalledProcessError` object will have the return code in the :attr:" -"`~CalledProcessError.returncode` attribute. If :func:`check_call` was unable " -"to start the process it will propagate the exception that was raised." +"code was zero then return, otherwise raise :exc:`CalledProcessError`. " +"The :exc:`CalledProcessError` object will have the return code in " +"the :attr:`~CalledProcessError.returncode` attribute. If :func:`check_call` " +"was unable to start the process it will propagate the exception that was " +"raised." msgstr "" #: ../../library/subprocess.rst:1233 @@ -1578,10 +1584,10 @@ msgstr "" #: ../../library/subprocess.rst:1268 msgid "" -"If the return code was non-zero it raises a :exc:`CalledProcessError`. The :" -"exc:`CalledProcessError` object will have the return code in the :attr:" -"`~CalledProcessError.returncode` attribute and any output in the :attr:" -"`~CalledProcessError.output` attribute." +"If the return code was non-zero it raises a :exc:`CalledProcessError`. " +"The :exc:`CalledProcessError` object will have the return code in " +"the :attr:`~CalledProcessError.returncode` attribute and any output in " +"the :attr:`~CalledProcessError.output` attribute." msgstr "" #: ../../library/subprocess.rst:1273 @@ -1596,10 +1602,10 @@ msgstr "run(..., check=True, stdout=PIPE).stdout" msgid "" "The arguments shown above are merely some common ones. The full function " "signature is largely the same as that of :func:`run` - most arguments are " -"passed directly through to that interface. One API deviation from :func:" -"`run` behavior exists: passing ``input=None`` will behave the same as " -"``input=b''`` (or ``input=''``, depending on other arguments) rather than " -"using the parent's standard input file handle." +"passed directly through to that interface. One API deviation " +"from :func:`run` behavior exists: passing ``input=None`` will behave the " +"same as ``input=b''`` (or ``input=''``, depending on other arguments) rather " +"than using the parent's standard input file handle." msgstr "" #: ../../library/subprocess.rst:1284 @@ -1618,8 +1624,8 @@ msgstr "" #: ../../library/subprocess.rst:1292 msgid "" -"To also capture standard error in the result, use ``stderr=subprocess." -"STDOUT``::" +"To also capture standard error in the result, use " +"``stderr=subprocess.STDOUT``::" msgstr "" #: ../../library/subprocess.rst:1295 @@ -1657,16 +1663,16 @@ msgstr "" #: ../../library/subprocess.rst:1333 msgid "" "All \"a\" functions in this section fail (more or less) silently if the " -"executed program cannot be found; the \"b\" replacements raise :exc:" -"`OSError` instead." +"executed program cannot be found; the \"b\" replacements " +"raise :exc:`OSError` instead." msgstr "" #: ../../library/subprocess.rst:1337 msgid "" -"In addition, the replacements using :func:`check_output` will fail with a :" -"exc:`CalledProcessError` if the requested operation produces a non-zero " -"return code. The output is still available as the :attr:`~CalledProcessError." -"output` attribute of the raised exception." +"In addition, the replacements using :func:`check_output` will fail with " +"a :exc:`CalledProcessError` if the requested operation produces a non-zero " +"return code. The output is still available as " +"the :attr:`~CalledProcessError.output` attribute of the raised exception." msgstr "" #: ../../library/subprocess.rst:1342 @@ -1748,15 +1754,15 @@ msgstr "" #: ../../library/subprocess.rst:1398 msgid "" -"The :func:`call` return value is encoded differently to that of :func:`os." -"system`." +"The :func:`call` return value is encoded differently to that " +"of :func:`os.system`." msgstr "" #: ../../library/subprocess.rst:1401 msgid "" "The :func:`os.system` function ignores SIGINT and SIGQUIT signals while the " -"command is running, but the caller must do this separately when using the :" -"mod:`subprocess` module." +"command is running, but the caller must do this separately when using " +"the :mod:`subprocess` module." msgstr "" #: ../../library/subprocess.rst:1405 @@ -1768,8 +1774,8 @@ msgid "" "try:\n" " retcode = call(\"mycmd\" + \" myarg\", shell=True)\n" " if retcode < 0:\n" -" print(\"Child was terminated by signal\", -retcode, file=sys." -"stderr)\n" +" print(\"Child was terminated by signal\", -retcode, " +"file=sys.stderr)\n" " else:\n" " print(\"Child returned\", retcode, file=sys.stderr)\n" "except OSError as e:\n" @@ -1778,8 +1784,8 @@ msgstr "" "try:\n" " retcode = call(\"mycmd\" + \" myarg\", shell=True)\n" " if retcode < 0:\n" -" print(\"Child was terminated by signal\", -retcode, file=sys." -"stderr)\n" +" print(\"Child was terminated by signal\", -retcode, " +"file=sys.stderr)\n" " else:\n" " print(\"Child returned\", retcode, file=sys.stderr)\n" "except OSError as e:\n" @@ -1846,64 +1852,14 @@ msgstr "" "Popen([\"/bin/mycmd\", \"myarg\"], env={\"PATH\": \"/usr/bin\"})" #: ../../library/subprocess.rst:1447 -msgid "Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3`" -msgstr "" - -#: ../../library/subprocess.rst:1451 -msgid "" -"(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize)\n" -"==>\n" -"p = Popen(cmd, shell=True, bufsize=bufsize,\n" -" stdin=PIPE, stdout=PIPE, close_fds=True)\n" -"(child_stdin, child_stdout) = (p.stdin, p.stdout)" -msgstr "" -"(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize)\n" -"==>\n" -"p = Popen(cmd, shell=True, bufsize=bufsize,\n" -" stdin=PIPE, stdout=PIPE, close_fds=True)\n" -"(child_stdin, child_stdout) = (p.stdin, p.stdout)" - -#: ../../library/subprocess.rst:1459 -msgid "" -"(child_stdin,\n" -" child_stdout,\n" -" child_stderr) = os.popen3(cmd, mode, bufsize)\n" -"==>\n" -"p = Popen(cmd, shell=True, bufsize=bufsize,\n" -" stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)\n" -"(child_stdin,\n" -" child_stdout,\n" -" child_stderr) = (p.stdin, p.stdout, p.stderr)" -msgstr "" -"(child_stdin,\n" -" child_stdout,\n" -" child_stderr) = os.popen3(cmd, mode, bufsize)\n" -"==>\n" -"p = Popen(cmd, shell=True, bufsize=bufsize,\n" -" stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)\n" -"(child_stdin,\n" -" child_stdout,\n" -" child_stderr) = (p.stdin, p.stdout, p.stderr)" - -#: ../../library/subprocess.rst:1471 -msgid "" -"(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize)\n" -"==>\n" -"p = Popen(cmd, shell=True, bufsize=bufsize,\n" -" stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)\n" -"(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)" +msgid "Replacing :func:`os.popen`" msgstr "" -"(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize)\n" -"==>\n" -"p = Popen(cmd, shell=True, bufsize=bufsize,\n" -" stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)\n" -"(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)" -#: ../../library/subprocess.rst:1477 +#: ../../library/subprocess.rst:1449 msgid "Return code handling translates as follows::" msgstr "" -#: ../../library/subprocess.rst:1479 +#: ../../library/subprocess.rst:1451 msgid "" "pipe = os.popen(cmd, 'w')\n" "...\n" @@ -1929,76 +1885,11 @@ msgstr "" "if process.wait() != 0:\n" " print(\"There were some errors\")" -#: ../../library/subprocess.rst:1493 -msgid "Replacing functions from the :mod:`!popen2` module" -msgstr "" - -#: ../../library/subprocess.rst:1497 -msgid "" -"If the cmd argument to popen2 functions is a string, the command is executed " -"through /bin/sh. If it is a list, the command is directly executed." -msgstr "" - -#: ../../library/subprocess.rst:1502 -msgid "" -"(child_stdout, child_stdin) = popen2.popen2(\"somestring\", bufsize, mode)\n" -"==>\n" -"p = Popen(\"somestring\", shell=True, bufsize=bufsize,\n" -" stdin=PIPE, stdout=PIPE, close_fds=True)\n" -"(child_stdout, child_stdin) = (p.stdout, p.stdin)" -msgstr "" -"(child_stdout, child_stdin) = popen2.popen2(\"somestring\", bufsize, mode)\n" -"==>\n" -"p = Popen(\"somestring\", shell=True, bufsize=bufsize,\n" -" stdin=PIPE, stdout=PIPE, close_fds=True)\n" -"(child_stdout, child_stdin) = (p.stdout, p.stdin)" - -#: ../../library/subprocess.rst:1510 -msgid "" -"(child_stdout, child_stdin) = popen2.popen2([\"mycmd\", \"myarg\"], bufsize, " -"mode)\n" -"==>\n" -"p = Popen([\"mycmd\", \"myarg\"], bufsize=bufsize,\n" -" stdin=PIPE, stdout=PIPE, close_fds=True)\n" -"(child_stdout, child_stdin) = (p.stdout, p.stdin)" -msgstr "" -"(child_stdout, child_stdin) = popen2.popen2([\"mycmd\", \"myarg\"], bufsize, " -"mode)\n" -"==>\n" -"p = Popen([\"mycmd\", \"myarg\"], bufsize=bufsize,\n" -" stdin=PIPE, stdout=PIPE, close_fds=True)\n" -"(child_stdout, child_stdin) = (p.stdout, p.stdin)" - -#: ../../library/subprocess.rst:1516 -msgid "" -":class:`popen2.Popen3` and :class:`popen2.Popen4` basically work as :class:" -"`subprocess.Popen`, except that:" -msgstr "" - -#: ../../library/subprocess.rst:1519 -msgid ":class:`Popen` raises an exception if the execution fails." -msgstr "" - -#: ../../library/subprocess.rst:1521 -msgid "The *capturestderr* argument is replaced with the *stderr* argument." -msgstr "" - -#: ../../library/subprocess.rst:1523 -msgid "``stdin=PIPE`` and ``stdout=PIPE`` must be specified." -msgstr "" - -#: ../../library/subprocess.rst:1525 -msgid "" -"popen2 closes all file descriptors by default, but you have to specify " -"``close_fds=True`` with :class:`Popen` to guarantee this behavior on all " -"platforms or past Python versions." -msgstr "" - -#: ../../library/subprocess.rst:1531 +#: ../../library/subprocess.rst:1465 msgid "Legacy Shell Invocation Functions" msgstr "" -#: ../../library/subprocess.rst:1533 +#: ../../library/subprocess.rst:1467 msgid "" "This module also provides the following legacy functions from the 2.x " "``commands`` module. These operations implicitly invoke the system shell and " @@ -2006,11 +1897,11 @@ msgid "" "handling consistency are valid for these functions." msgstr "" -#: ../../library/subprocess.rst:1540 +#: ../../library/subprocess.rst:1474 msgid "Return ``(exitcode, output)`` of executing *cmd* in a shell." msgstr "" -#: ../../library/subprocess.rst:1542 +#: ../../library/subprocess.rst:1476 msgid "" "Execute the string *cmd* in a shell with :meth:`Popen.check_output` and " "return a 2-tuple ``(exitcode, output)``. *encoding* and *errors* are used to " @@ -2018,13 +1909,13 @@ msgid "" "details." msgstr "" -#: ../../library/subprocess.rst:1547 +#: ../../library/subprocess.rst:1481 msgid "" "A trailing newline is stripped from the output. The exit code for the " "command can be interpreted as the return code of subprocess. Example::" msgstr "" -#: ../../library/subprocess.rst:1551 +#: ../../library/subprocess.rst:1485 msgid "" ">>> subprocess.getstatusoutput('ls /bin/ls')\n" "(0, '/bin/ls')\n" @@ -2044,28 +1935,28 @@ msgstr "" ">>> subprocess.getstatusoutput('/bin/kill $$')\n" "(-15, '')" -#: ../../library/subprocess.rst:1562 +#: ../../library/subprocess.rst:1496 msgid "Windows support was added." msgstr "新增對 Windows 的支援。" -#: ../../library/subprocess.rst:1565 +#: ../../library/subprocess.rst:1499 msgid "" "The function now returns (exitcode, output) instead of (status, output) as " -"it did in Python 3.3.3 and earlier. exitcode has the same value as :attr:" -"`~Popen.returncode`." +"it did in Python 3.3.3 and earlier. exitcode has the same value " +"as :attr:`~Popen.returncode`." msgstr "" -#: ../../library/subprocess.rst:1574 +#: ../../library/subprocess.rst:1508 msgid "Return output (stdout and stderr) of executing *cmd* in a shell." msgstr "" -#: ../../library/subprocess.rst:1576 +#: ../../library/subprocess.rst:1510 msgid "" "Like :func:`getstatusoutput`, except the exit code is ignored and the return " "value is a string containing the command's output. Example::" msgstr "" -#: ../../library/subprocess.rst:1579 +#: ../../library/subprocess.rst:1513 msgid "" ">>> subprocess.getoutput('ls /bin/ls')\n" "'/bin/ls'" @@ -2073,26 +1964,26 @@ msgstr "" ">>> subprocess.getoutput('ls /bin/ls')\n" "'/bin/ls'" -#: ../../library/subprocess.rst:1584 +#: ../../library/subprocess.rst:1518 msgid "Windows support added" msgstr "新增對 Windows 的支援" -#: ../../library/subprocess.rst:1592 +#: ../../library/subprocess.rst:1526 msgid "Notes" msgstr "註解" -#: ../../library/subprocess.rst:1597 +#: ../../library/subprocess.rst:1531 msgid "Timeout Behavior" msgstr "" -#: ../../library/subprocess.rst:1599 +#: ../../library/subprocess.rst:1533 msgid "" -"When using the ``timeout`` parameter in functions like :func:`run`, :meth:" -"`Popen.wait`, or :meth:`Popen.communicate`, users should be aware of the " -"following behaviors:" +"When using the ``timeout`` parameter in functions " +"like :func:`run`, :meth:`Popen.wait`, or :meth:`Popen.communicate`, users " +"should be aware of the following behaviors:" msgstr "" -#: ../../library/subprocess.rst:1603 +#: ../../library/subprocess.rst:1537 msgid "" "**Process Creation Delay**: The initial process creation itself cannot be " "interrupted on many platform APIs. This means that even when specifying a " @@ -2100,7 +1991,7 @@ msgid "" "after however long process creation takes." msgstr "" -#: ../../library/subprocess.rst:1608 +#: ../../library/subprocess.rst:1542 msgid "" "**Extremely Small Timeout Values**: Setting very small timeout values (such " "as a few milliseconds) may result in almost immediate :exc:`TimeoutExpired` " @@ -2108,42 +1999,42 @@ msgid "" "time." msgstr "" -#: ../../library/subprocess.rst:1615 +#: ../../library/subprocess.rst:1549 msgid "Converting an argument sequence to a string on Windows" msgstr "" -#: ../../library/subprocess.rst:1617 +#: ../../library/subprocess.rst:1551 msgid "" "On Windows, an *args* sequence is converted to a string that can be parsed " "using the following rules (which correspond to the rules used by the MS C " "runtime):" msgstr "" -#: ../../library/subprocess.rst:1621 +#: ../../library/subprocess.rst:1555 msgid "" "Arguments are delimited by white space, which is either a space or a tab." msgstr "" -#: ../../library/subprocess.rst:1624 +#: ../../library/subprocess.rst:1558 msgid "" "A string surrounded by double quotation marks is interpreted as a single " "argument, regardless of white space contained within. A quoted string can " "be embedded in an argument." msgstr "" -#: ../../library/subprocess.rst:1629 +#: ../../library/subprocess.rst:1563 msgid "" "A double quotation mark preceded by a backslash is interpreted as a literal " "double quotation mark." msgstr "" -#: ../../library/subprocess.rst:1632 +#: ../../library/subprocess.rst:1566 msgid "" "Backslashes are interpreted literally, unless they immediately precede a " "double quotation mark." msgstr "" -#: ../../library/subprocess.rst:1635 +#: ../../library/subprocess.rst:1569 msgid "" "If backslashes immediately precede a double quotation mark, every pair of " "backslashes is interpreted as a literal backslash. If the number of " @@ -2151,19 +2042,20 @@ msgid "" "mark as described in rule 3." msgstr "" -#: ../../library/subprocess.rst:1644 +#: ../../library/subprocess.rst:1578 msgid ":mod:`shlex`" msgstr ":mod:`shlex`" -#: ../../library/subprocess.rst:1645 +#: ../../library/subprocess.rst:1579 msgid "Module which provides function to parse and escape command lines." msgstr "" -#: ../../library/subprocess.rst:1652 -msgid "Disabling use of ``vfork()`` or ``posix_spawn()``" +#: ../../library/subprocess.rst:1585 +#, fuzzy +msgid "Disable use of ``posix_spawn()``" msgstr "停用 ``vfork()`` 或 ``posix_spawn()``" -#: ../../library/subprocess.rst:1654 +#: ../../library/subprocess.rst:1587 msgid "" "On Linux, :mod:`subprocess` defaults to using the ``vfork()`` system call " "internally when it is safe to do so rather than ``fork()``. This greatly " @@ -2172,46 +2064,23 @@ msgstr "" "在 Linux 上,:mod:`subprocess` 在安全的情況下預設會在內部使用 ``vfork()`` 系" "統呼叫,而不是 ``fork()``,這顯著地提高了性能。" -#: ../../library/subprocess.rst:1658 -msgid "" -"If you ever encounter a presumed highly unusual situation where you need to " -"prevent ``vfork()`` from being used by Python, you can set the :const:" -"`subprocess._USE_VFORK` attribute to a false value." -msgstr "" -"如果你遇到了一個推定為極異常的情況,需要防止 Python 使用 ``vfork()``,你可以" -"將 :const:`subprocess._USE_VFORK` 屬性設為 false 值。" - -#: ../../library/subprocess.rst:1664 -msgid "subprocess._USE_VFORK = False # See CPython issue gh-NNNNNN." -msgstr "subprocess._USE_VFORK = False # 見 CPython 問題 gh-NNNNNN." - -#: ../../library/subprocess.rst:1666 -msgid "" -"Setting this has no impact on use of ``posix_spawn()`` which could use " -"``vfork()`` internally within its libc implementation. There is a similar :" -"const:`subprocess._USE_POSIX_SPAWN` attribute if you need to prevent use of " -"that." -msgstr "" -"設定它並不會影響 ``posix_spawn()`` 的使用,它可以在其 libc 實作內部使用 " -"``vfork()``。如果你需要封鎖該屬性的使用,則有一個類似的 :const:`subprocess." -"_USE_POSIX_SPAWN` 屬性。" - -#: ../../library/subprocess.rst:1673 +#: ../../library/subprocess.rst:1593 msgid "subprocess._USE_POSIX_SPAWN = False # See CPython issue gh-NNNNNN." msgstr "subprocess._USE_POSIX_SPAWN = False # 見 CPython 問題 gh-NNNNNN." -#: ../../library/subprocess.rst:1675 +#: ../../library/subprocess.rst:1595 +#, fuzzy msgid "" -"It is safe to set these to false on any Python version. They will have no " -"effect on older versions when unsupported. Do not assume the attributes are " -"available to read. Despite their names, a true value does not indicate that " -"the corresponding function will be used, only that it may be." +"It is safe to set this to false on any Python version. It will have no " +"effect on older or newer versions where unsupported. Do not assume the " +"attribute is available to read. Despite the name, a true value does not " +"indicate the corresponding function will be used, only that it may be." msgstr "" "在任何 Python 版本上將這些設定為 false 都是安全的。當不受支援時,它們對舊版本" "沒有影響。不要假設屬性可供讀取。儘管有它們的名稱,真實值並不表示將使用相應的" "函式,而只是表示可能會使用。" -#: ../../library/subprocess.rst:1680 +#: ../../library/subprocess.rst:1600 msgid "" "Please file issues any time you have to use these private knobs with a way " "to reproduce the issue you were seeing. Link to that issue from a comment in " @@ -2220,14 +2089,10 @@ msgstr "" "每當你需要使用這些私有開關以重現你所看到的問題時,請隨時提出問題 (file " "issues)。從程式碼中的註解連結到該問題。" -#: ../../library/subprocess.rst:1684 +#: ../../library/subprocess.rst:1604 msgid "``_USE_POSIX_SPAWN``" msgstr "``_USE_POSIX_SPAWN``" -#: ../../library/subprocess.rst:1685 -msgid "``_USE_VFORK``" -msgstr "``_USE_VFORK``" - #: ../../library/subprocess.rst:296 msgid "universal newlines" msgstr "universal newlines" @@ -2235,3 +2100,104 @@ msgstr "universal newlines" #: ../../library/subprocess.rst:296 msgid "subprocess module" msgstr "subprocess 模組" + +#~ msgid "" +#~ "(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize)\n" +#~ "==>\n" +#~ "p = Popen(cmd, shell=True, bufsize=bufsize,\n" +#~ " stdin=PIPE, stdout=PIPE, close_fds=True)\n" +#~ "(child_stdin, child_stdout) = (p.stdin, p.stdout)" +#~ msgstr "" +#~ "(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize)\n" +#~ "==>\n" +#~ "p = Popen(cmd, shell=True, bufsize=bufsize,\n" +#~ " stdin=PIPE, stdout=PIPE, close_fds=True)\n" +#~ "(child_stdin, child_stdout) = (p.stdin, p.stdout)" + +#~ msgid "" +#~ "(child_stdin,\n" +#~ " child_stdout,\n" +#~ " child_stderr) = os.popen3(cmd, mode, bufsize)\n" +#~ "==>\n" +#~ "p = Popen(cmd, shell=True, bufsize=bufsize,\n" +#~ " stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)\n" +#~ "(child_stdin,\n" +#~ " child_stdout,\n" +#~ " child_stderr) = (p.stdin, p.stdout, p.stderr)" +#~ msgstr "" +#~ "(child_stdin,\n" +#~ " child_stdout,\n" +#~ " child_stderr) = os.popen3(cmd, mode, bufsize)\n" +#~ "==>\n" +#~ "p = Popen(cmd, shell=True, bufsize=bufsize,\n" +#~ " stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)\n" +#~ "(child_stdin,\n" +#~ " child_stdout,\n" +#~ " child_stderr) = (p.stdin, p.stdout, p.stderr)" + +#~ msgid "" +#~ "(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize)\n" +#~ "==>\n" +#~ "p = Popen(cmd, shell=True, bufsize=bufsize,\n" +#~ " stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)\n" +#~ "(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)" +#~ msgstr "" +#~ "(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize)\n" +#~ "==>\n" +#~ "p = Popen(cmd, shell=True, bufsize=bufsize,\n" +#~ " stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)\n" +#~ "(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)" + +#~ msgid "" +#~ "(child_stdout, child_stdin) = popen2.popen2(\"somestring\", bufsize, " +#~ "mode)\n" +#~ "==>\n" +#~ "p = Popen(\"somestring\", shell=True, bufsize=bufsize,\n" +#~ " stdin=PIPE, stdout=PIPE, close_fds=True)\n" +#~ "(child_stdout, child_stdin) = (p.stdout, p.stdin)" +#~ msgstr "" +#~ "(child_stdout, child_stdin) = popen2.popen2(\"somestring\", bufsize, " +#~ "mode)\n" +#~ "==>\n" +#~ "p = Popen(\"somestring\", shell=True, bufsize=bufsize,\n" +#~ " stdin=PIPE, stdout=PIPE, close_fds=True)\n" +#~ "(child_stdout, child_stdin) = (p.stdout, p.stdin)" + +#~ msgid "" +#~ "(child_stdout, child_stdin) = popen2.popen2([\"mycmd\", \"myarg\"], " +#~ "bufsize, mode)\n" +#~ "==>\n" +#~ "p = Popen([\"mycmd\", \"myarg\"], bufsize=bufsize,\n" +#~ " stdin=PIPE, stdout=PIPE, close_fds=True)\n" +#~ "(child_stdout, child_stdin) = (p.stdout, p.stdin)" +#~ msgstr "" +#~ "(child_stdout, child_stdin) = popen2.popen2([\"mycmd\", \"myarg\"], " +#~ "bufsize, mode)\n" +#~ "==>\n" +#~ "p = Popen([\"mycmd\", \"myarg\"], bufsize=bufsize,\n" +#~ " stdin=PIPE, stdout=PIPE, close_fds=True)\n" +#~ "(child_stdout, child_stdin) = (p.stdout, p.stdin)" + +#~ msgid "" +#~ "If you ever encounter a presumed highly unusual situation where you need " +#~ "to prevent ``vfork()`` from being used by Python, you can set " +#~ "the :const:`subprocess._USE_VFORK` attribute to a false value." +#~ msgstr "" +#~ "如果你遇到了一個推定為極異常的情況,需要防止 Python 使用 ``vfork()``,你可" +#~ "以將 :const:`subprocess._USE_VFORK` 屬性設為 false 值。" + +#~ msgid "subprocess._USE_VFORK = False # See CPython issue gh-NNNNNN." +#~ msgstr "subprocess._USE_VFORK = False # 見 CPython 問題 gh-NNNNNN." + +#~ msgid "" +#~ "Setting this has no impact on use of ``posix_spawn()`` which could use " +#~ "``vfork()`` internally within its libc implementation. There is a " +#~ "similar :const:`subprocess._USE_POSIX_SPAWN` attribute if you need to " +#~ "prevent use of that." +#~ msgstr "" +#~ "設定它並不會影響 ``posix_spawn()`` 的使用,它可以在其 libc 實作內部使用 " +#~ "``vfork()``。如果你需要封鎖該屬性的使用,則有一個類似" +#~ "的 :const:`subprocess._USE_POSIX_SPAWN` 屬性。" + +#~ msgid "``_USE_VFORK``" +#~ msgstr "``_USE_VFORK``" diff --git a/library/symtable.po b/library/symtable.po index 86a561a35b3..269eca1a91e 100644 --- a/library/symtable.po +++ b/library/symtable.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -112,8 +112,8 @@ msgstr "" #: ../../library/symtable.rst:88 msgid "" -"Return the type of the symbol table. Possible values are members of the :" -"class:`SymbolTableType` enumeration." +"Return the type of the symbol table. Possible values are members of " +"the :class:`SymbolTableType` enumeration." msgstr "回傳符號表的類型。可能的值為 :class:`SymbolTableType` 列舉的成員。" #: ../../library/symtable.rst:91 @@ -148,14 +148,14 @@ msgid "" "``'top'`` if the table is global (:meth:`get_type` returns ``'module'``). " "For type parameter scopes (which are used for generic classes, functions, " "and type aliases), it is the name of the underlying class, function, or type " -"alias. For type alias scopes, it is the name of the type alias. For :class:" -"`~typing.TypeVar` bound scopes, it is the name of the ``TypeVar``." +"alias. For type alias scopes, it is the name of the type alias. " +"For :class:`~typing.TypeVar` bound scopes, it is the name of the ``TypeVar``." msgstr "" "回傳表的名稱。如果表用於類別,則這是類別的名稱;如果表用於函式,則這是函式的" "名稱;如果表是全域的,則為 ``'top'`` (:meth:`get_type` 會回傳 " "``'module'``)。對於型別參數作用域(用於泛型類別、函式和型別別名),它是底層" -"類別、函式或型別別名的名稱。對於型別別名作用域,它是型別別名的名稱。對於 :" -"class:`~typing.TypeVar` 綁定作用域,它會是 ``TypeVar`` 的名稱。" +"類別、函式或型別別名的名稱。對於型別別名作用域,它是型別別名的名稱。對" +"於 :class:`~typing.TypeVar` 綁定作用域,它會是 ``TypeVar`` 的名稱。" #: ../../library/symtable.rst:118 msgid "Return the number of the first line in the block this table represents." @@ -179,8 +179,8 @@ msgstr "" #: ../../library/symtable.rst:135 msgid "" -"Return a view object containing the names of symbols in the table. See the :" -"ref:`documentation of view objects `." +"Return a view object containing the names of symbols in the table. See " +"the :ref:`documentation of view objects `." msgstr "" "回傳包含表中符號之名稱的視圖物件 (view object)。請參閱\\ :ref:`視圖物件的文" "件 `。" @@ -199,8 +199,8 @@ msgstr "回傳巢狀符號表的串列。" #: ../../library/symtable.rst:153 msgid "" -"A namespace for a function or method. This class inherits from :class:" -"`SymbolTable`." +"A namespace for a function or method. This class inherits " +"from :class:`SymbolTable`." msgstr "一個函式或方法的命名空間。該類別繼承自 :class:`SymbolTable`。" #: ../../library/symtable.rst:158 @@ -258,7 +258,30 @@ msgstr "" msgid "For example:" msgstr "舉例來說:" -#: ../../library/symtable.rst:215 +#: ../../library/symtable.rst:206 +msgid "" +">>> import symtable\n" +">>> st = symtable.symtable('''\n" +"... def outer(): pass\n" +"...\n" +"... class A:\n" +"... def f():\n" +"... def w(): pass\n" +"...\n" +"... def g(self): pass\n" +"...\n" +"... @classmethod\n" +"... async def h(cls): pass\n" +"...\n" +"... global outer\n" +"... def outer(self): pass\n" +"... ''', 'test', 'exec')\n" +">>> class_A = st.get_children()[2]\n" +">>> class_A.get_methods()\n" +"('f', 'g', 'h')" +msgstr "" + +#: ../../library/symtable.rst:228 msgid "" "Although ``A().f()`` raises :exc:`TypeError` at runtime, ``A.f`` is still " "considered as a method-like function." @@ -266,51 +289,56 @@ msgstr "" "儘管 ``A().f()`` 會在 runtime 引發 :exc:`TypeError`,但 ``A.f`` 仍然被視為類" "似方法的函式。" -#: ../../library/symtable.rst:220 +#: ../../library/symtable.rst:236 msgid "" "An entry in a :class:`SymbolTable` corresponding to an identifier in the " "source. The constructor is not public." msgstr "" ":class:`SymbolTable` 中的條目對應於來源中的識別器。建構函式不是公開的。" -#: ../../library/symtable.rst:225 +#: ../../library/symtable.rst:241 msgid "Return the symbol's name." msgstr "回傳符號的名稱。" -#: ../../library/symtable.rst:229 +#: ../../library/symtable.rst:245 msgid "Return ``True`` if the symbol is used in its block." msgstr "如果該符號在其區塊中使用,則回傳 ``True``。" -#: ../../library/symtable.rst:233 +#: ../../library/symtable.rst:249 msgid "Return ``True`` if the symbol is created from an import statement." msgstr "如果符號是從 import 陳述式建立的,則回傳 ``True``。" -#: ../../library/symtable.rst:237 +#: ../../library/symtable.rst:253 msgid "Return ``True`` if the symbol is a parameter." msgstr "如果符號是一個參數,則回傳 ``True``。" -#: ../../library/symtable.rst:241 +#: ../../library/symtable.rst:257 +#, fuzzy +msgid "Return ``True`` if the symbol is a type parameter." +msgstr "如果符號是一個參數,則回傳 ``True``。" + +#: ../../library/symtable.rst:263 msgid "Return ``True`` if the symbol is global." msgstr "如果符號是全域的,則回傳 ``True``。" -#: ../../library/symtable.rst:245 +#: ../../library/symtable.rst:267 msgid "Return ``True`` if the symbol is nonlocal." msgstr "如果符號是非區域的,則回傳 ``True``。" -#: ../../library/symtable.rst:249 +#: ../../library/symtable.rst:271 msgid "" "Return ``True`` if the symbol is declared global with a global statement." msgstr "如果使用全域陳述式將符號聲明為全域的,則回傳 ``True``。" -#: ../../library/symtable.rst:253 +#: ../../library/symtable.rst:275 msgid "Return ``True`` if the symbol is local to its block." msgstr "如果符號是其區塊的區域符號,則回傳 ``True``。" -#: ../../library/symtable.rst:257 +#: ../../library/symtable.rst:279 msgid "Return ``True`` if the symbol is annotated." msgstr "如果符號有被註釋,則回傳 ``True``。" -#: ../../library/symtable.rst:263 +#: ../../library/symtable.rst:285 msgid "" "Return ``True`` if the symbol is referenced in its block, but not assigned " "to." @@ -318,25 +346,63 @@ msgstr "" "如果該符號在其區塊中被參照 (referenced) 但未被賦值 (assigned),則回傳 " "``True``。" -#: ../../library/symtable.rst:268 +#: ../../library/symtable.rst:290 +#, fuzzy +msgid "" +"Return *True* if a class-scoped symbol is free from the perspective of a " +"method." +msgstr "如果符號是從 import 陳述式建立的,則回傳 ``True``。" + +#: ../../library/symtable.rst:293 +msgid "Consider the following example::" +msgstr "" + +#: ../../library/symtable.rst:295 +msgid "" +"def f():\n" +" x = 1 # function-scoped\n" +" class C:\n" +" x = 2 # class-scoped\n" +" def method(self):\n" +" return x" +msgstr "" + +#: ../../library/symtable.rst:302 +msgid "" +"In this example, the class-scoped symbol ``x`` is considered to be free from " +"the perspective of ``C.method``, thereby allowing the latter to return *1* " +"at runtime and not *2*." +msgstr "" + +#: ../../library/symtable.rst:310 msgid "Return ``True`` if the symbol is assigned to in its block." msgstr "如果該符號被賦值到其區塊中,則回傳 ``True``。" -#: ../../library/symtable.rst:272 +#: ../../library/symtable.rst:314 +#, fuzzy +msgid "Return ``True`` if the symbol is a comprehension iteration variable." +msgstr "如果符號是一個參數,則回傳 ``True``。" + +#: ../../library/symtable.rst:320 +#, fuzzy +msgid "Return ``True`` if the symbol is a cell in an inlined comprehension." +msgstr "如果符號是從 import 陳述式建立的,則回傳 ``True``。" + +#: ../../library/symtable.rst:326 msgid "Return ``True`` if name binding introduces new namespace." msgstr "如果名稱綁定引入 (introduce) 新的命名空間,則回傳 ``True``。" -#: ../../library/symtable.rst:274 +#: ../../library/symtable.rst:328 msgid "" "If the name is used as the target of a function or class statement, this " "will be true." msgstr "如果名稱用作函式或類別陳述式的目標,則這將會是 true。" -#: ../../library/symtable.rst:277 +#: ../../library/symtable.rst:331 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/symtable.rst:279 +#: ../../library/symtable.rst:333 msgid "" ">>> table = symtable.symtable(\"def some_func(): pass\", \"string\", " "\"exec\")\n" @@ -348,7 +414,7 @@ msgstr "" ">>> table.lookup(\"some_func\").is_namespace()\n" "True" -#: ../../library/symtable.rst:283 +#: ../../library/symtable.rst:337 msgid "" "Note that a single name can be bound to multiple objects. If the result is " "``True``, the name may also be bound to other objects, like an int or list, " @@ -357,11 +423,11 @@ msgstr "" "請注意,單個名稱可以綁定到多個物件。如果結果為 ``True``,則該名稱也可能被綁定" "到其他物件,例如 int 或 list,而不會引入新的命名空間。" -#: ../../library/symtable.rst:289 +#: ../../library/symtable.rst:343 msgid "Return a list of namespaces bound to this name." msgstr "回傳綁定到該名稱的命名空間的串列。" -#: ../../library/symtable.rst:293 +#: ../../library/symtable.rst:347 msgid "" "Return the namespace bound to this name. If more than one or no namespace is " "bound to this name, a :exc:`ValueError` is raised." @@ -369,20 +435,20 @@ msgstr "" "回傳綁定到該名稱的命名空間。如果該名稱綁定了多個命名空間或沒有命名空間,則會" "引發 :exc:`ValueError`。" -#: ../../library/symtable.rst:300 +#: ../../library/symtable.rst:354 msgid "Command-Line Usage" msgstr "命令列用法" -#: ../../library/symtable.rst:304 +#: ../../library/symtable.rst:358 msgid "" "The :mod:`symtable` module can be executed as a script from the command line." msgstr ":mod:`symtable` 模組可以從命令列作為腳本執行。" -#: ../../library/symtable.rst:306 +#: ../../library/symtable.rst:360 msgid "python -m symtable [infile...]" msgstr "python -m symtable [infile...]" -#: ../../library/symtable.rst:310 +#: ../../library/symtable.rst:364 msgid "" "Symbol tables are generated for the specified Python source files and dumped " "to stdout. If no input file is specified, the content is read from stdin." diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index 357c7407c48..3f1296d8d12 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-18 00:17+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-10-21 17:51+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,8 +27,8 @@ msgid "" "``import sys`` and then use ``sys.monitoring``." msgstr "" ":mod:`sys.monitoring` 是 :mod:`sys` 模組內的一個命名空間,不是一個獨立的模" -"組,所以不需要 ``import sys.monitoring``,只需 ``import sys`` 然後使用 ``sys." -"monitoring``。" +"組,所以不需要 ``import sys.monitoring``,只需 ``import sys`` 然後使用 " +"``sys.monitoring``。" #: ../../library/sys.monitoring.rst:19 msgid "" @@ -97,20 +97,17 @@ msgstr "" "*tool_id* 正在使用,則引發 :exc:`ValueError`。" #: ../../library/sys.monitoring.rst:55 -msgid "Should be called once a tool no longer requires *tool_id*." -msgstr "一旦工具不再需要 *tool_id* 就應該被呼叫。" +msgid "Unregister all events and callback functions associated with *tool_id*." +msgstr "" #: ../../library/sys.monitoring.rst:59 +#, fuzzy msgid "" -":func:`free_tool_id` will not disable global or local events associated with " -"*tool_id*, nor will it unregister any callback functions. This function is " -"only intended to be used to notify the VM that the particular *tool_id* is " -"no longer in use." -msgstr "" -":func:`free_tool_id` 不會停用與 *tool_id* 相關的全域或區域事件,也不會取消註" -"冊任何回呼函式。這個函式只是用來通知虛擬機器 (VM) 不再使用特定的 *tool_id*。" +"Should be called once a tool no longer requires *tool_id*. Will " +"call :func:`clear_tool_id` before releasing *tool_id*." +msgstr "一旦工具不再需要 *tool_id* 就應該被呼叫。" -#: ../../library/sys.monitoring.rst:66 +#: ../../library/sys.monitoring.rst:64 msgid "" "Returns the name of the tool if *tool_id* is in use, otherwise it returns " "``None``. *tool_id* must be in the range 0 to 5 inclusive." @@ -118,7 +115,7 @@ msgstr "" "如果 *tool_id* 正在使用,則回傳該工具的名稱,否則回傳 ``None``。*tool_id* 必" "須在 0 到 5(含)範圍內。" -#: ../../library/sys.monitoring.rst:70 +#: ../../library/sys.monitoring.rst:68 msgid "" "All IDs are treated the same by the VM with regard to events, but the " "following IDs are pre-defined to make co-operation of tools easier::" @@ -126,7 +123,7 @@ msgstr "" "對於事件,虛擬機器對所有 ID 的處理都是相同的,但預先定義了以下 ID,以使工具間" "的協作更容易: ::" -#: ../../library/sys.monitoring.rst:73 +#: ../../library/sys.monitoring.rst:71 msgid "" "sys.monitoring.DEBUGGER_ID = 0\n" "sys.monitoring.COVERAGE_ID = 1\n" @@ -138,80 +135,96 @@ msgstr "" "sys.monitoring.PROFILER_ID = 2\n" "sys.monitoring.OPTIMIZER_ID = 5" -#: ../../library/sys.monitoring.rst:80 +#: ../../library/sys.monitoring.rst:78 msgid "Events" msgstr "事件" -#: ../../library/sys.monitoring.rst:82 +#: ../../library/sys.monitoring.rst:80 msgid "The following events are supported:" msgstr "支援以下事件:" +#: ../../library/sys.monitoring.rst:84 +#, fuzzy +msgid "A conditional branch goes left." +msgstr "採取(或不採取)一個條件分支。" + #: ../../library/sys.monitoring.rst:86 -msgid "A conditional branch is taken (or not)." +msgid "" +"It is up to the tool to determine how to present \"left\" and \"right\" " +"branches. There is no guarantee which branch is \"left\" and which is " +"\"right\", except that it will be consistent for the duration of the program." +msgstr "" + +#: ../../library/sys.monitoring.rst:92 +#, fuzzy +msgid "A conditional branch goes right." msgstr "採取(或不採取)一個條件分支。" -#: ../../library/sys.monitoring.rst:90 +#: ../../library/sys.monitoring.rst:96 msgid "A call in Python code (event occurs before the call)." msgstr "Python 程式碼中的呼叫(事件發生在呼叫之前)。" -#: ../../library/sys.monitoring.rst:94 +#: ../../library/sys.monitoring.rst:100 msgid "" "An exception raised from any callable, except for Python functions (event " "occurs after the exit)." msgstr "從任何可呼叫物件引發的例外,除 Python 函式外(事件發生在退出之後)。" -#: ../../library/sys.monitoring.rst:98 +#: ../../library/sys.monitoring.rst:104 msgid "" "Return from any callable, except for Python functions (event occurs after " "the return)." msgstr "從任何可呼叫函式回傳,除 Python 函式外(事件發生在回傳之後)。" -#: ../../library/sys.monitoring.rst:102 +#: ../../library/sys.monitoring.rst:108 msgid "An exception is handled." msgstr "一個例外被處理。" -#: ../../library/sys.monitoring.rst:106 +#: ../../library/sys.monitoring.rst:112 msgid "A VM instruction is about to be executed." msgstr "虛擬機器指令即將被執行。" -#: ../../library/sys.monitoring.rst:110 +#: ../../library/sys.monitoring.rst:116 msgid "An unconditional jump in the control flow graph is made." msgstr "在控制流程圖中進行無條件跳轉。" -#: ../../library/sys.monitoring.rst:114 +#: ../../library/sys.monitoring.rst:120 msgid "" "An instruction is about to be executed that has a different line number from " "the preceding instruction." msgstr "即將執行的指令與前一條指令的列號不同。" -#: ../../library/sys.monitoring.rst:118 +#: ../../library/sys.monitoring.rst:124 msgid "" "Resumption of a Python function (for generator and coroutine functions), " "except for ``throw()`` calls." msgstr "Python 函式的繼續執行(對於產生器和協程函式),除了 ``throw()`` 呼叫。" -#: ../../library/sys.monitoring.rst:122 +#: ../../library/sys.monitoring.rst:128 msgid "" "Return from a Python function (occurs immediately before the return, the " "callee's frame will be on the stack)." msgstr "" "從 Python 函式回傳(發生在即將回傳之前,被呼叫者的 frame 將位於堆疊上)。" -#: ../../library/sys.monitoring.rst:126 +#: ../../library/sys.monitoring.rst:132 msgid "" "Start of a Python function (occurs immediately after the call, the callee's " "frame will be on the stack)" msgstr "Python 函式的開始(在呼叫後立即發生,被呼叫者的 frame 將位於堆疊上)" -#: ../../library/sys.monitoring.rst:130 +#: ../../library/sys.monitoring.rst:136 msgid "A Python function is resumed by a ``throw()`` call." msgstr "Python 函式透過 ``throw()`` 呼叫來繼續。" -#: ../../library/sys.monitoring.rst:134 -msgid "Exit from a Python function during exception unwinding." -msgstr "在例外展開 (unwind) 期間從 Python 函式退出。" +#: ../../library/sys.monitoring.rst:140 +msgid "" +"Exit from a Python function during exception unwinding. This includes " +"exceptions raised directly within the function and that are allowed to " +"continue to propagate." +msgstr "" -#: ../../library/sys.monitoring.rst:138 +#: ../../library/sys.monitoring.rst:145 msgid "" "Yield from a Python function (occurs immediately before the yield, the " "callee's frame will be on the stack)." @@ -219,20 +232,20 @@ msgstr "" "來自 Python 函式的 yield(在即將 yield 之前發生,被呼叫者的 frame 將位於堆疊" "上)。" -#: ../../library/sys.monitoring.rst:142 +#: ../../library/sys.monitoring.rst:149 msgid "" -"An exception is raised, except those that cause a :monitoring-event:" -"`STOP_ITERATION` event." +"An exception is raised, except those that cause a :monitoring-" +"event:`STOP_ITERATION` event." msgstr "" "例外被引發,除了那些會導致 :monitoring-event:`STOP_ITERATION` 的事件外。" -#: ../../library/sys.monitoring.rst:146 +#: ../../library/sys.monitoring.rst:153 msgid "" "An exception is re-raised, for example at the end of a :keyword:`finally` " "block." msgstr "例外被重新引發 (re-raise),例如在 :keyword:`finally` 區塊的最後。" -#: ../../library/sys.monitoring.rst:150 +#: ../../library/sys.monitoring.rst:157 msgid "" "An artificial :exc:`StopIteration` is raised; see `the STOP_ITERATION " "event`_." @@ -240,11 +253,11 @@ msgstr "" "一個人為的 :exc:`StopIteration` 被引發;請參閱 `STOP_ITERATION 事件 `_。" -#: ../../library/sys.monitoring.rst:153 +#: ../../library/sys.monitoring.rst:160 msgid "More events may be added in the future." msgstr "將來可能會新增更多事件。" -#: ../../library/sys.monitoring.rst:155 +#: ../../library/sys.monitoring.rst:162 msgid "" "These events are attributes of the :mod:`!sys.monitoring.events` namespace. " "Each event is represented as a power-of-2 integer constant. To define a set " @@ -257,11 +270,11 @@ msgstr "" "要指定 :monitoring-event:`PY_RETURN` 和 :monitoring-event:`PY_START` 兩個事" "件,請使用運算式 ``PY_RETURN | PY_START``。" -#: ../../library/sys.monitoring.rst:163 +#: ../../library/sys.monitoring.rst:170 msgid "An alias for ``0`` so users can do explicit comparisons like::" msgstr "``0`` 的別名,以便使用者可以進行明確比較,例如: ::" -#: ../../library/sys.monitoring.rst:165 +#: ../../library/sys.monitoring.rst:172 msgid "" "if get_events(DEBUGGER_ID) == NO_EVENTS:\n" " ..." @@ -269,15 +282,15 @@ msgstr "" "if get_events(DEBUGGER_ID) == NO_EVENTS:\n" " ..." -#: ../../library/sys.monitoring.rst:168 -msgid "Events are divided into three groups:" -msgstr "事件被分為三組:" +#: ../../library/sys.monitoring.rst:175 +msgid "Setting this event deactivates all events." +msgstr "" -#: ../../library/sys.monitoring.rst:173 +#: ../../library/sys.monitoring.rst:180 msgid "Local events" msgstr "區域事件" -#: ../../library/sys.monitoring.rst:175 +#: ../../library/sys.monitoring.rst:182 msgid "" "Local events are associated with normal execution of the program and happen " "at clearly defined locations. All local events can be disabled. The local " @@ -286,114 +299,135 @@ msgstr "" "區域事件與程式的正常執行相關,並發生在明確定義的位置。所有區域事件都可以被停" "用。區域事件有:" -#: ../../library/sys.monitoring.rst:179 +#: ../../library/sys.monitoring.rst:186 msgid ":monitoring-event:`PY_START`" msgstr ":monitoring-event:`PY_START`" -#: ../../library/sys.monitoring.rst:180 +#: ../../library/sys.monitoring.rst:187 msgid ":monitoring-event:`PY_RESUME`" msgstr ":monitoring-event:`PY_RESUME`" -#: ../../library/sys.monitoring.rst:181 +#: ../../library/sys.monitoring.rst:188 msgid ":monitoring-event:`PY_RETURN`" msgstr ":monitoring-event:`PY_RETURN`" -#: ../../library/sys.monitoring.rst:182 +#: ../../library/sys.monitoring.rst:189 msgid ":monitoring-event:`PY_YIELD`" msgstr ":monitoring-event:`PY_YIELD`" -#: ../../library/sys.monitoring.rst:183 +#: ../../library/sys.monitoring.rst:190 msgid ":monitoring-event:`CALL`" msgstr ":monitoring-event:`CALL`" -#: ../../library/sys.monitoring.rst:184 +#: ../../library/sys.monitoring.rst:191 msgid ":monitoring-event:`LINE`" msgstr ":monitoring-event:`LINE`" -#: ../../library/sys.monitoring.rst:185 +#: ../../library/sys.monitoring.rst:192 msgid ":monitoring-event:`INSTRUCTION`" msgstr ":monitoring-event:`INSTRUCTION`" -#: ../../library/sys.monitoring.rst:186 +#: ../../library/sys.monitoring.rst:193 msgid ":monitoring-event:`JUMP`" msgstr ":monitoring-event:`JUMP`" -#: ../../library/sys.monitoring.rst:187 -msgid ":monitoring-event:`BRANCH`" +#: ../../library/sys.monitoring.rst:194 +#, fuzzy +msgid ":monitoring-event:`BRANCH_LEFT`" msgstr ":monitoring-event:`BRANCH`" -#: ../../library/sys.monitoring.rst:188 +#: ../../library/sys.monitoring.rst:195 +#, fuzzy +msgid ":monitoring-event:`BRANCH_RIGHT`" +msgstr ":monitoring-event:`BRANCH`" + +#: ../../library/sys.monitoring.rst:196 msgid ":monitoring-event:`STOP_ITERATION`" msgstr ":monitoring-event:`STOP_ITERATION`" -#: ../../library/sys.monitoring.rst:191 +#: ../../library/sys.monitoring.rst:199 +msgid "Deprecated event" +msgstr "" + +#: ../../library/sys.monitoring.rst:201 +msgid "``BRANCH``" +msgstr "" + +#: ../../library/sys.monitoring.rst:203 +msgid "" +"The ``BRANCH`` event is deprecated in 3.14. Using :monitoring-" +"event:`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT` events will give " +"much better performance as they can be disabled independently." +msgstr "" + +#: ../../library/sys.monitoring.rst:209 msgid "Ancillary events" msgstr "附屬事件 (ancillary events)" -#: ../../library/sys.monitoring.rst:193 +#: ../../library/sys.monitoring.rst:211 msgid "" "Ancillary events can be monitored like other events, but are controlled by " "another event:" msgstr "附屬事件可以像其他事件一樣被監控,但由另一個事件所控制:" -#: ../../library/sys.monitoring.rst:196 +#: ../../library/sys.monitoring.rst:214 msgid ":monitoring-event:`C_RAISE`" msgstr ":monitoring-event:`C_RAISE`" -#: ../../library/sys.monitoring.rst:197 +#: ../../library/sys.monitoring.rst:215 msgid ":monitoring-event:`C_RETURN`" msgstr ":monitoring-event:`C_RETURN`" -#: ../../library/sys.monitoring.rst:199 +#: ../../library/sys.monitoring.rst:217 msgid "" "The :monitoring-event:`C_RETURN` and :monitoring-event:`C_RAISE` events are " -"controlled by the :monitoring-event:`CALL` event. :monitoring-event:" -"`C_RETURN` and :monitoring-event:`C_RAISE` events will only be seen if the " -"corresponding :monitoring-event:`CALL` event is being monitored." +"controlled by the :monitoring-event:`CALL` event. :monitoring-" +"event:`C_RETURN` and :monitoring-event:`C_RAISE` events will only be seen if " +"the corresponding :monitoring-event:`CALL` event is being monitored." msgstr "" -":monitoring-event:`C_RETURN` 和 :monitoring-event:`C_RAISE` 事件由 :" -"monitoring-event:`CALL` 事件控制。只有當對應的 :monitoring-event:`CALL` 事件" -"受到監控時,才會看到 :monitoring-event:`C_RETURN` 和 :monitoring-event:" -"`C_RAISE` 事件。" +":monitoring-event:`C_RETURN` 和 :monitoring-event:`C_RAISE` 事件" +"由 :monitoring-event:`CALL` 事件控制。只有當對應的 :monitoring-event:`CALL` " +"事件受到監控時,才會看到 :monitoring-event:`C_RETURN` 和 :monitoring-" +"event:`C_RAISE` 事件。" -#: ../../library/sys.monitoring.rst:205 +#: ../../library/sys.monitoring.rst:223 msgid "Other events" msgstr "其他事件" -#: ../../library/sys.monitoring.rst:207 +#: ../../library/sys.monitoring.rst:225 msgid "" "Other events are not necessarily tied to a specific location in the program " "and cannot be individually disabled." msgstr "其他事件不一定與程式中的特定位置相關聯,也不能單獨停用。" -#: ../../library/sys.monitoring.rst:210 +#: ../../library/sys.monitoring.rst:228 msgid "The other events that can be monitored are:" msgstr "其他可以監控的事件有:" -#: ../../library/sys.monitoring.rst:212 +#: ../../library/sys.monitoring.rst:230 msgid ":monitoring-event:`PY_THROW`" msgstr ":monitoring-event:`PY_THROW`" -#: ../../library/sys.monitoring.rst:213 +#: ../../library/sys.monitoring.rst:231 msgid ":monitoring-event:`PY_UNWIND`" msgstr ":monitoring-event:`PY_UNWIND`" -#: ../../library/sys.monitoring.rst:214 +#: ../../library/sys.monitoring.rst:232 msgid ":monitoring-event:`RAISE`" msgstr ":monitoring-event:`RAISE`" -#: ../../library/sys.monitoring.rst:215 +#: ../../library/sys.monitoring.rst:233 msgid ":monitoring-event:`EXCEPTION_HANDLED`" msgstr ":monitoring-event:`EXCEPTION_HANDLED`" -#: ../../library/sys.monitoring.rst:219 +#: ../../library/sys.monitoring.rst:237 msgid "The STOP_ITERATION event" msgstr "STOP_ITERATION 事件" -#: ../../library/sys.monitoring.rst:221 +#: ../../library/sys.monitoring.rst:239 msgid "" -":pep:`PEP 380 <380#use-of-stopiteration-to-return-values>` specifies that a :" -"exc:`StopIteration` exception is raised when returning a value from a " +":pep:`PEP 380 <380#use-of-stopiteration-to-return-values>` specifies that " +"a :exc:`StopIteration` exception is raised when returning a value from a " "generator or coroutine. However, this is a very inefficient way to return a " "value, so some Python implementations, notably CPython 3.12+, do not raise " "an exception unless it would be visible to other code." @@ -403,7 +437,7 @@ msgstr "" "式,因此有一些 Python 實作(特別是 CPython 3.12+)不會引發例外,除非它對其他" "程式碼是可見的。" -#: ../../library/sys.monitoring.rst:227 +#: ../../library/sys.monitoring.rst:245 msgid "" "To allow tools to monitor for real exceptions without slowing down " "generators and coroutines, the :monitoring-event:`STOP_ITERATION` event is " @@ -414,65 +448,76 @@ msgstr "" "event:`STOP_ITERATION` 事件。與 :monitoring-event:`RAISE` 不同,:monitoring-" "event:`STOP_ITERATION` 可以區域停用。" -#: ../../library/sys.monitoring.rst:233 +#: ../../library/sys.monitoring.rst:250 +msgid "" +"Note that the :monitoring-event:`STOP_ITERATION` event and the :monitoring-" +"event:`RAISE` event for a :exc:`StopIteration` exception are equivalent, and " +"are treated as interchangeable when generating events. Implementations will " +"favor :monitoring-event:`STOP_ITERATION` for performance reasons, but may " +"generate a :monitoring-event:`RAISE` event with a :exc:`StopIteration`." +msgstr "" + +#: ../../library/sys.monitoring.rst:258 msgid "Turning events on and off" msgstr "開啟和關閉事件" -#: ../../library/sys.monitoring.rst:235 +#: ../../library/sys.monitoring.rst:260 +#, fuzzy msgid "" "In order to monitor an event, it must be turned on and a corresponding " "callback must be registered. Events can be turned on or off by setting the " -"events either globally or for a particular code object." +"events either globally and/or for a particular code object. An event will " +"trigger only once, even if it is turned on both globally and locally." msgstr "" "為了監控一個事件,必須打開它並註冊相應的回呼。可以透過將事件設定為全域或只為" "特定程式碼物件來開啟或關閉事件。" -#: ../../library/sys.monitoring.rst:242 +#: ../../library/sys.monitoring.rst:267 msgid "Setting events globally" msgstr "全域設定事件" -#: ../../library/sys.monitoring.rst:244 +#: ../../library/sys.monitoring.rst:269 msgid "" "Events can be controlled globally by modifying the set of events being " "monitored." msgstr "可以透過修改正在監控的事件集合來全域地控制事件。" -#: ../../library/sys.monitoring.rst:248 +#: ../../library/sys.monitoring.rst:273 msgid "Returns the ``int`` representing all the active events." msgstr "回傳代表所有有效事件的 ``int``。" -#: ../../library/sys.monitoring.rst:252 +#: ../../library/sys.monitoring.rst:277 msgid "" -"Activates all events which are set in *event_set*. Raises a :exc:" -"`ValueError` if *tool_id* is not in use." +"Activates all events which are set in *event_set*. Raises " +"a :exc:`ValueError` if *tool_id* is not in use." msgstr "" -"啟動 *event_set* 中設定的所有事件。如果 *tool_id* 並未正在被使用,則引發 :" -"exc:`ValueError`。" +"啟動 *event_set* 中設定的所有事件。如果 *tool_id* 並未正在被使用,則引" +"發 :exc:`ValueError`。" -#: ../../library/sys.monitoring.rst:255 +#: ../../library/sys.monitoring.rst:280 msgid "No events are active by default." msgstr "預設沒有有效事件。" -#: ../../library/sys.monitoring.rst:258 +#: ../../library/sys.monitoring.rst:283 msgid "Per code object events" msgstr "各別程式碼物件事件" -#: ../../library/sys.monitoring.rst:260 +#: ../../library/sys.monitoring.rst:285 msgid "" "Events can also be controlled on a per code object basis. The functions " "defined below which accept a :class:`types.CodeType` should be prepared to " "accept a look-alike object from functions which are not defined in Python " "(see :ref:`c-api-monitoring`)." msgstr "" -"事件還可以基於各別程式碼物件進行控制。下面定義的、接受 :class:`types." -"CodeType` 的函式應該準備好接受來自 Python 中未定義函式的類似物件(請參閱 :" -"ref:`c-api-monitoring`)。" +"事件還可以基於各別程式碼物件進行控制。下面定義的、接" +"受 :class:`types.CodeType` 的函式應該準備好接受來自 Python 中未定義函式的類似" +"物件(請參閱 :ref:`c-api-monitoring`)。" -#: ../../library/sys.monitoring.rst:267 +#: ../../library/sys.monitoring.rst:292 msgid "Returns all the local events for *code*" msgstr "回傳 *code* 的所有區域事件" -#: ../../library/sys.monitoring.rst:271 +#: ../../library/sys.monitoring.rst:296 msgid "" "Activates all the local events for *code* which are set in *event_set*. " "Raises a :exc:`ValueError` if *tool_id* is not in use." @@ -480,34 +525,27 @@ msgstr "" "啟動 *event_set* 中針對 *code* 設定的所有區域事件。如果 *tool_id* 並未正在被" "使用,則引發 :exc:`ValueError`。" -#: ../../library/sys.monitoring.rst:274 -msgid "" -"Local events add to global events, but do not mask them. In other words, all " -"global events will trigger for a code object, regardless of the local events." -msgstr "" -"區域事件會加入到全域事件中,但不會掩蓋它們。換句話說,無論區域事件如何,所有" -"全域事件都將為程式碼物件觸發。" - -#: ../../library/sys.monitoring.rst:280 +#: ../../library/sys.monitoring.rst:301 msgid "Disabling events" msgstr "停用事件" -#: ../../library/sys.monitoring.rst:284 +#: ../../library/sys.monitoring.rst:305 msgid "" "A special value that can be returned from a callback function to disable " "events for the current code location." msgstr "可以從回呼函式回傳的特殊值,以停用目前程式碼位置的事件。" -#: ../../library/sys.monitoring.rst:287 +#: ../../library/sys.monitoring.rst:308 msgid "" -"Local events can be disabled for a specific code location by returning :data:" -"`sys.monitoring.DISABLE` from a callback function. This does not change " -"which events are set, or any other code locations for the same event." +"Local events can be disabled for a specific code location by " +"returning :data:`sys.monitoring.DISABLE` from a callback function. This does " +"not change which events are set, or any other code locations for the same " +"event." msgstr "" "可透過回呼函式回傳 :data:`sys.monitoring.DISABLE` 來停用特定程式碼位置的區域" "事件。這不會改變被設定的事件,或相同事件的任何其他程式碼位置。" -#: ../../library/sys.monitoring.rst:291 +#: ../../library/sys.monitoring.rst:312 msgid "" "Disabling events for specific locations is very important for high " "performance monitoring. For example, a program can be run under a debugger " @@ -517,25 +555,21 @@ msgstr "" "停用特定位置的事件對於高效能監控非常重要。舉例來說,如果除少數斷點外,偵錯器" "可以停用所有監控,那麼在偵錯器下執行程式就不會有任何開銷 (overhead)。" -#: ../../library/sys.monitoring.rst:298 +#: ../../library/sys.monitoring.rst:319 msgid "" "Enable all the events that were disabled by :data:`sys.monitoring.DISABLE` " "for all tools." msgstr "為所有工具啟用由 :data:`sys.monitoring.DISABLE` 停用的所有事件。" -#: ../../library/sys.monitoring.rst:305 +#: ../../library/sys.monitoring.rst:326 msgid "Registering callback functions" msgstr "註冊回呼函式" -#: ../../library/sys.monitoring.rst:307 -msgid "To register a callable for events call" -msgstr "用來註冊對事件呼叫的可呼叫物件" - -#: ../../library/sys.monitoring.rst:311 +#: ../../library/sys.monitoring.rst:330 msgid "Registers the callable *func* for the *event* with the given *tool_id*" msgstr "使用給定的 *tool_id* 來註冊對 *event* 的可呼叫物件 *func*" -#: ../../library/sys.monitoring.rst:313 +#: ../../library/sys.monitoring.rst:332 msgid "" "If another callback was registered for the given *tool_id* and *event*, it " "is unregistered and returned. Otherwise :func:`register_callback` returns " @@ -544,138 +578,201 @@ msgstr "" "如果給定的 *tool_id* 和 *event* 已經註冊了另一個回呼,則會取消註冊並回傳。否" "則 :func:`register_callback` 會回傳 ``None``。" -#: ../../library/sys.monitoring.rst:317 +#: ../../library/sys.monitoring.rst:336 msgid "" -"Raises an :ref:`auditing event ` ``sys.monitoring." -"register_callback`` with argument ``func``." +"Raises an :ref:`auditing event ` " +"``sys.monitoring.register_callback`` with argument ``func``." msgstr "" "以 ``func`` 引數引發一個\\ :ref:`稽核事件 (auditing event) ` " "``sys.monitoring.register_callback``。" -#: ../../library/sys.monitoring.rst:319 +#: ../../library/sys.monitoring.rst:338 msgid "" -"Functions can be unregistered by calling ``sys.monitoring." -"register_callback(tool_id, event, None)``." +"Functions can be unregistered by calling " +"``sys.monitoring.register_callback(tool_id, event, None)``." msgstr "" "可以透過呼叫 ``sys.monitoring.register_callback(tool_id, event, None)`` 來取" "消註冊函式。" -#: ../../library/sys.monitoring.rst:322 +#: ../../library/sys.monitoring.rst:341 msgid "Callback functions can be registered and unregistered at any time." msgstr "回呼函式可以隨時被註冊和取消註冊。" -#: ../../library/sys.monitoring.rst:326 +#: ../../library/sys.monitoring.rst:343 +msgid "" +"Callbacks are called only once regardless if the event is turned on both " +"globally and locally. As such, if an event could be turned on for both " +"global and local events by your code then the callback needs to be written " +"to handle either trigger." +msgstr "" + +#: ../../library/sys.monitoring.rst:350 msgid "Callback function arguments" msgstr "回呼函式引數" -#: ../../library/sys.monitoring.rst:330 +#: ../../library/sys.monitoring.rst:354 msgid "" "A special value that is passed to a callback function to indicate that there " "are no arguments to the call." msgstr "傳遞給回呼函式的特殊值,表示該呼叫沒有引數。" -#: ../../library/sys.monitoring.rst:333 +#: ../../library/sys.monitoring.rst:357 +#, fuzzy msgid "" "When an active event occurs, the registered callback function is called. " -"Different events will provide the callback function with different " -"arguments, as follows:" +"Callback functions returning an object other than :data:`DISABLE` will have " +"no effect. Different events will provide the callback function with " +"different arguments, as follows:" msgstr "" "當有效事件發生時,已註冊的回呼函式會被呼叫。不同的事件會為回呼函式提供不同的" "引數,如下所示:" -#: ../../library/sys.monitoring.rst:336 +#: ../../library/sys.monitoring.rst:361 msgid ":monitoring-event:`PY_START` and :monitoring-event:`PY_RESUME`::" msgstr ":monitoring-event:`PY_START` 和 :monitoring-event:`PY_RESUME`: ::" -#: ../../library/sys.monitoring.rst:338 ../../library/sys.monitoring.rst:369 -msgid "func(code: CodeType, instruction_offset: int) -> DISABLE | Any" +#: ../../library/sys.monitoring.rst:363 ../../library/sys.monitoring.rst:400 +#, fuzzy +msgid "func(code: CodeType, instruction_offset: int) -> object" msgstr "func(code: CodeType, instruction_offset: int) -> DISABLE | Any" -#: ../../library/sys.monitoring.rst:340 +#: ../../library/sys.monitoring.rst:365 msgid ":monitoring-event:`PY_RETURN` and :monitoring-event:`PY_YIELD`::" msgstr ":monitoring-event:`PY_RETURN` 和 :monitoring-event:`PY_YIELD`: ::" -#: ../../library/sys.monitoring.rst:342 -msgid "" -"func(code: CodeType, instruction_offset: int, retval: object) -> DISABLE | " -"Any" +#: ../../library/sys.monitoring.rst:367 +#, fuzzy +msgid "func(code: CodeType, instruction_offset: int, retval: object) -> object" msgstr "" "func(code: CodeType, instruction_offset: int, retval: object) -> DISABLE | " "Any" -#: ../../library/sys.monitoring.rst:344 +#: ../../library/sys.monitoring.rst:369 +#, fuzzy msgid "" -":monitoring-event:`CALL`, :monitoring-event:`C_RAISE` and :monitoring-event:" -"`C_RETURN`::" +":monitoring-event:`CALL`, :monitoring-event:`C_RAISE` and :monitoring-" +"event:`C_RETURN` (*arg0* can be :data:`MISSING` specifically)::" msgstr "" -":monitoring-event:`CALL`、:monitoring-event:`C_RAISE` 和 :monitoring-event:" -"`C_RETURN`: ::" +":monitoring-event:`CALL`、:monitoring-event:`C_RAISE` 和 :monitoring-" +"event:`C_RETURN`: ::" -#: ../../library/sys.monitoring.rst:346 +#: ../../library/sys.monitoring.rst:372 +#, fuzzy msgid "" -"func(code: CodeType, instruction_offset: int, callable: object, arg0: object " -"| MISSING) -> DISABLE | Any" +"func(code: CodeType, instruction_offset: int, callable: object, arg0: " +"object) -> object" msgstr "" "func(code: CodeType, instruction_offset: int, callable: object, arg0: object " "| MISSING) -> DISABLE | Any" -#: ../../library/sys.monitoring.rst:348 +#: ../../library/sys.monitoring.rst:374 msgid "" -"If there are no arguments, *arg0* is set to :data:`sys.monitoring.MISSING`." -msgstr "如果沒有引數,*arg0* 將被設定為 :data:`sys.monitoring.MISSING`。" +"*code* represents the code object where the call is being made, while " +"*callable* is the object that is about to be called (and thus triggered the " +"event). If there are no arguments, *arg0* is set " +"to :data:`sys.monitoring.MISSING`." +msgstr "" -#: ../../library/sys.monitoring.rst:350 +#: ../../library/sys.monitoring.rst:379 +msgid "" +"For instance methods, *callable* will be the function object as found on the " +"class with *arg0* set to the instance (i.e. the ``self`` argument to the " +"method)." +msgstr "" + +#: ../../library/sys.monitoring.rst:383 msgid "" -":monitoring-event:`RAISE`, :monitoring-event:`RERAISE`, :monitoring-event:" -"`EXCEPTION_HANDLED`, :monitoring-event:`PY_UNWIND`, :monitoring-event:" -"`PY_THROW` and :monitoring-event:`STOP_ITERATION`::" +":monitoring-event:`RAISE`, :monitoring-event:`RERAISE`, :monitoring-" +"event:`EXCEPTION_HANDLED`, :monitoring-event:`PY_UNWIND`, :monitoring-" +"event:`PY_THROW` and :monitoring-event:`STOP_ITERATION`::" msgstr "" -":monitoring-event:`RAISE`、:monitoring-event:`RERAISE`、:monitoring-event:" -"`EXCEPTION_HANDLED`、:monitoring-event:`PY_UNWIND`、:monitoring-event:" -"`PY_THROW` 和 :monitoring-event:`STOP_ITERATION`: ::" +":monitoring-event:`RAISE`、:monitoring-event:`RERAISE`、:monitoring-" +"event:`EXCEPTION_HANDLED`、:monitoring-event:`PY_UNWIND`、:monitoring-" +"event:`PY_THROW` 和 :monitoring-event:`STOP_ITERATION`: ::" -#: ../../library/sys.monitoring.rst:353 +#: ../../library/sys.monitoring.rst:386 +#, fuzzy msgid "" "func(code: CodeType, instruction_offset: int, exception: BaseException) -> " -"DISABLE | Any" +"object" msgstr "" "func(code: CodeType, instruction_offset: int, exception: BaseException) -> " "DISABLE | Any" -#: ../../library/sys.monitoring.rst:355 +#: ../../library/sys.monitoring.rst:388 msgid ":monitoring-event:`LINE`::" msgstr ":monitoring-event:`LINE`: ::" -#: ../../library/sys.monitoring.rst:357 -msgid "func(code: CodeType, line_number: int) -> DISABLE | Any" +#: ../../library/sys.monitoring.rst:390 +#, fuzzy +msgid "func(code: CodeType, line_number: int) -> object" msgstr "func(code: CodeType, line_number: int) -> DISABLE | Any" -#: ../../library/sys.monitoring.rst:359 -msgid ":monitoring-event:`BRANCH` and :monitoring-event:`JUMP`::" -msgstr ":monitoring-event:`BRANCH` 和 :monitoring-event:`JUMP`: ::" +#: ../../library/sys.monitoring.rst:392 +#, fuzzy +msgid "" +":monitoring-event:`BRANCH_LEFT`, :monitoring-event:`BRANCH_RIGHT` " +"and :monitoring-event:`JUMP`::" +msgstr "" +":monitoring-event:`CALL`、:monitoring-event:`C_RAISE` 和 :monitoring-" +"event:`C_RETURN`: ::" -#: ../../library/sys.monitoring.rst:361 +#: ../../library/sys.monitoring.rst:394 +#, fuzzy msgid "" "func(code: CodeType, instruction_offset: int, destination_offset: int) -> " -"DISABLE | Any" +"object" msgstr "" "func(code: CodeType, instruction_offset: int, destination_offset: int) -> " "DISABLE | Any" -#: ../../library/sys.monitoring.rst:363 -msgid "" -"Note that the *destination_offset* is where the code will next execute. For " -"an untaken branch this will be the offset of the instruction following the " -"branch." +#: ../../library/sys.monitoring.rst:396 +#, fuzzy +msgid "Note that the *destination_offset* is where the code will next execute." msgstr "" "請注意,*destination_offset* 是程式碼接下來要執行的地方。對於未採用的分支,這" "將是該分支之後的指令的偏移量。" -#: ../../library/sys.monitoring.rst:367 +#: ../../library/sys.monitoring.rst:398 msgid ":monitoring-event:`INSTRUCTION`::" msgstr ":monitoring-event:`INSTRUCTION`: ::" #~ msgid "" -#~ "Registering or unregistering a callback function will generate a :func:" -#~ "`sys.audit` event." +#~ ":func:`free_tool_id` will not disable global or local events associated " +#~ "with *tool_id*, nor will it unregister any callback functions. This " +#~ "function is only intended to be used to notify the VM that the particular " +#~ "*tool_id* is no longer in use." +#~ msgstr "" +#~ ":func:`free_tool_id` 不會停用與 *tool_id* 相關的全域或區域事件,也不會取消" +#~ "註冊任何回呼函式。這個函式只是用來通知虛擬機器 (VM) 不再使用特定的 " +#~ "*tool_id*。" + +#~ msgid "Exit from a Python function during exception unwinding." +#~ msgstr "在例外展開 (unwind) 期間從 Python 函式退出。" + +#~ msgid "Events are divided into three groups:" +#~ msgstr "事件被分為三組:" + +#~ msgid "" +#~ "Local events add to global events, but do not mask them. In other words, " +#~ "all global events will trigger for a code object, regardless of the local " +#~ "events." +#~ msgstr "" +#~ "區域事件會加入到全域事件中,但不會掩蓋它們。換句話說,無論區域事件如何,所" +#~ "有全域事件都將為程式碼物件觸發。" + +#~ msgid "To register a callable for events call" +#~ msgstr "用來註冊對事件呼叫的可呼叫物件" + +#~ msgid "" +#~ "If there are no arguments, *arg0* is set " +#~ "to :data:`sys.monitoring.MISSING`." +#~ msgstr "如果沒有引數,*arg0* 將被設定為 :data:`sys.monitoring.MISSING`。" + +#~ msgid ":monitoring-event:`BRANCH` and :monitoring-event:`JUMP`::" +#~ msgstr ":monitoring-event:`BRANCH` 和 :monitoring-event:`JUMP`: ::" + +#~ msgid "" +#~ "Registering or unregistering a callback function will generate " +#~ "a :func:`sys.audit` event." #~ msgstr "註冊或取消註冊回呼函式將產生 :func:`sys.audit` 事件。" diff --git a/library/sys.po b/library/sys.po index d47573d9111..beea3d47c38 100644 --- a/library/sys.po +++ b/library/sys.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-23 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-04-26 02:54+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,12 +43,12 @@ msgid "" "removed)." msgstr "" -#: ../../library/sys.rst:25 ../../library/sys.rst:299 ../../library/sys.rst:369 -#: ../../library/sys.rst:760 ../../library/sys.rst:778 -#: ../../library/sys.rst:1022 ../../library/sys.rst:1524 -#: ../../library/sys.rst:1765 ../../library/sys.rst:1780 -#: ../../library/sys.rst:1788 ../../library/sys.rst:1804 -#: ../../library/sys.rst:2048 +#: ../../library/sys.rst:25 ../../library/sys.rst:298 ../../library/sys.rst:368 +#: ../../library/sys.rst:789 ../../library/sys.rst:807 +#: ../../library/sys.rst:1056 ../../library/sys.rst:1662 +#: ../../library/sys.rst:1905 ../../library/sys.rst:1920 +#: ../../library/sys.rst:1928 ../../library/sys.rst:1966 +#: ../../library/sys.rst:1982 ../../library/sys.rst:2229 msgid "Availability" msgstr "可用性" @@ -76,8 +76,8 @@ msgid "" "particular, malicious code can trivially disable or bypass hooks added using " "this function. At a minimum, any security-sensitive hooks must be added " "using the C API :c:func:`PySys_AddAuditHook` before initialising the " -"runtime, and any modules allowing arbitrary memory modification (such as :" -"mod:`ctypes`) should be completely removed or closely monitored." +"runtime, and any modules allowing arbitrary memory modification (such " +"as :mod:`ctypes`) should be completely removed or closely monitored." msgstr "" #: ../../library/sys.rst:49 ../../library/sys.rst:51 @@ -88,10 +88,10 @@ msgid "" "and the exception suppressed. As a result, callers cannot assume that their " "hook has been added unless they control all existing hooks." msgstr "" -"呼叫 :func:`sys.addaudithook` 本身會引發一個不帶任何引數、名為 ``sys." -"addaudithook`` 的稽核事件。如果任何現有的 hook 引發從 :class:`RuntimeError` " -"衍生的例外,則不會添加新的 hook 並抑制異常。因此,除非呼叫者控制所有已存在的 " -"hook,他們不能假設他們的 hook 已被添加。" +"呼叫 :func:`sys.addaudithook` 本身會引發一個不帶任何引數、名為 " +"``sys.addaudithook`` 的稽核事件。如果任何現有的 hook 引發" +"從 :class:`RuntimeError` 衍生的例外,則不會添加新的 hook 並抑制異常。因此,除" +"非呼叫者控制所有已存在的 hook,他們不能假設他們的 hook 已被添加。" #: ../../library/sys.rst:58 msgid "" @@ -171,8 +171,8 @@ msgstr "" #: ../../library/sys.rst:119 msgid "" -"Hooks are added using the :func:`sys.addaudithook` or :c:func:" -"`PySys_AddAuditHook` functions." +"Hooks are added using the :func:`sys.addaudithook` " +"or :c:func:`PySys_AddAuditHook` functions." msgstr "" #: ../../library/sys.rst:122 @@ -190,86 +190,94 @@ msgstr "" #: ../../library/sys.rst:133 msgid "" -"Set during Python startup, before ``site.py`` is run, to the same value as :" -"data:`exec_prefix`. If not running in a :ref:`virtual environment `, the values will stay the same; if ``site.py`` finds that a virtual " -"environment is in use, the values of :data:`prefix` and :data:`exec_prefix` " -"will be changed to point to the virtual environment, whereas :data:" -"`base_prefix` and :data:`base_exec_prefix` will remain pointing to the base " -"Python installation (the one which the virtual environment was created from)." +"Equivalent to :data:`exec_prefix`, but referring to the base Python " +"installation." +msgstr "" + +#: ../../library/sys.rst:135 +msgid "" +"When running under :ref:`sys-path-init-virtual-" +"environments`, :data:`exec_prefix` gets overwritten to the virtual " +"environment prefix. :data:`base_exec_prefix`, conversely, does not change, " +"and always points to the base Python installation. Refer to :ref:`sys-path-" +"init-virtual-environments` for more information." +msgstr "" + +#: ../../library/sys.rst:146 +msgid "" +"Equivalent to :data:`prefix`, but referring to the base Python installation." msgstr "" -#: ../../library/sys.rst:147 +#: ../../library/sys.rst:148 msgid "" -"Set during Python startup, before ``site.py`` is run, to the same value as :" -"data:`prefix`. If not running in a :ref:`virtual environment `, " -"the values will stay the same; if ``site.py`` finds that a virtual " -"environment is in use, the values of :data:`prefix` and :data:`exec_prefix` " -"will be changed to point to the virtual environment, whereas :data:" -"`base_prefix` and :data:`base_exec_prefix` will remain pointing to the base " -"Python installation (the one which the virtual environment was created from)." +"When running under :ref:`virtual environment `, :data:`prefix` " +"gets overwritten to the virtual environment prefix. :data:`base_prefix`, " +"conversely, does not change, and always points to the base Python " +"installation. Refer to :ref:`sys-path-init-virtual-environments` for more " +"information." msgstr "" -#: ../../library/sys.rst:160 +#: ../../library/sys.rst:159 msgid "" "An indicator of the native byte order. This will have the value ``'big'`` " "on big-endian (most-significant byte first) platforms, and ``'little'`` on " "little-endian (least-significant byte first) platforms." msgstr "" -#: ../../library/sys.rst:167 +#: ../../library/sys.rst:166 msgid "" "A tuple of strings containing the names of all modules that are compiled " "into this Python interpreter. (This information is not available in any " "other way --- ``modules.keys()`` only lists the imported modules.)" msgstr "" -#: ../../library/sys.rst:171 +#: ../../library/sys.rst:170 msgid "See also the :data:`sys.stdlib_module_names` list." msgstr "另請參閱 :data:`sys.stdlib_module_names` 清單。" -#: ../../library/sys.rst:176 +#: ../../library/sys.rst:175 msgid "" "Call ``func(*args)``, while tracing is enabled. The tracing state is saved, " "and restored afterwards. This is intended to be called from a debugger from " "a checkpoint, to recursively debug or profile some other code." msgstr "" -#: ../../library/sys.rst:180 +#: ../../library/sys.rst:179 msgid "" -"Tracing is suspended while calling a tracing function set by :func:" -"`settrace` or :func:`setprofile` to avoid infinite recursion. :func:`!" -"call_tracing` enables explicit recursion of the tracing function." +"Tracing is suspended while calling a tracing function set " +"by :func:`settrace` or :func:`setprofile` to avoid infinite " +"recursion. :func:`!call_tracing` enables explicit recursion of the tracing " +"function." msgstr "" -#: ../../library/sys.rst:187 +#: ../../library/sys.rst:186 msgid "A string containing the copyright pertaining to the Python interpreter." msgstr "" -#: ../../library/sys.rst:192 +#: ../../library/sys.rst:191 msgid "" "Clear the internal type cache. The type cache is used to speed up attribute " "and method lookups. Use the function *only* to drop unnecessary references " "during reference leak debugging." msgstr "" -#: ../../library/sys.rst:196 ../../library/sys.rst:223 -#: ../../library/sys.rst:236 +#: ../../library/sys.rst:195 ../../library/sys.rst:222 +#: ../../library/sys.rst:235 msgid "" "This function should be used for internal and specialized purposes only." msgstr "" -#: ../../library/sys.rst:198 +#: ../../library/sys.rst:197 msgid "Use the more general :func:`_clear_internal_caches` function instead." msgstr "" -#: ../../library/sys.rst:204 +#: ../../library/sys.rst:203 msgid "" "Clear all internal performance-related caches. Use this function *only* to " "release unnecessary references and memory blocks when hunting for leaks." msgstr "" -#: ../../library/sys.rst:212 +#: ../../library/sys.rst:211 msgid "" "Return a dictionary mapping each thread's identifier to the topmost stack " "frame currently active in that thread at the time the function is called. " @@ -277,7 +285,7 @@ msgid "" "given such a frame." msgstr "" -#: ../../library/sys.rst:217 +#: ../../library/sys.rst:216 msgid "" "This is most useful for debugging deadlock: this function does not require " "the deadlocked threads' cooperation, and such threads' call stacks are " @@ -286,14 +294,14 @@ msgid "" "by the time calling code examines the frame." msgstr "" -#: ../../library/sys.rst:225 +#: ../../library/sys.rst:224 msgid "" "Raises an :ref:`auditing event ` ``sys._current_frames`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys._current_frames``。" -#: ../../library/sys.rst:229 +#: ../../library/sys.rst:228 msgid "" "Return a dictionary mapping each thread's identifier to the topmost " "exception currently active in that thread at the time the function is " @@ -301,32 +309,32 @@ msgid "" "included in the result dictionary." msgstr "" -#: ../../library/sys.rst:234 +#: ../../library/sys.rst:233 msgid "This is most useful for statistical profiling." msgstr "" -#: ../../library/sys.rst:238 +#: ../../library/sys.rst:237 msgid "" "Raises an :ref:`auditing event ` ``sys._current_exceptions`` with " "no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." -"_current_exceptions``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` " +"``sys._current_exceptions``。" -#: ../../library/sys.rst:240 +#: ../../library/sys.rst:239 msgid "" "Each value in the dictionary is now a single exception instance, rather than " "a 3-tuple as returned from ``sys.exc_info()``." msgstr "" -#: ../../library/sys.rst:246 +#: ../../library/sys.rst:245 msgid "" "This hook function is called by built-in :func:`breakpoint`. By default, it " "drops you into the :mod:`pdb` debugger, but it can be set to any other " "function so that you can choose which debugger gets used." msgstr "" -#: ../../library/sys.rst:250 +#: ../../library/sys.rst:249 msgid "" "The signature of this function is dependent on what it calls. For example, " "the default binding (e.g. ``pdb.set_trace()``) expects no arguments, but you " @@ -336,78 +344,79 @@ msgid "" "returns is returned from ``breakpoint()``." msgstr "" -#: ../../library/sys.rst:257 +#: ../../library/sys.rst:256 msgid "" -"The default implementation first consults the environment variable :envvar:" -"`PYTHONBREAKPOINT`. If that is set to ``\"0\"`` then this function returns " -"immediately; i.e. it is a no-op. If the environment variable is not set, or " -"is set to the empty string, ``pdb.set_trace()`` is called. Otherwise this " -"variable should name a function to run, using Python's dotted-import " -"nomenclature, e.g. ``package.subpackage.module.function``. In this case, " +"The default implementation first consults the environment " +"variable :envvar:`PYTHONBREAKPOINT`. If that is set to ``\"0\"`` then this " +"function returns immediately; i.e. it is a no-op. If the environment " +"variable is not set, or is set to the empty string, ``pdb.set_trace()`` is " +"called. Otherwise this variable should name a function to run, using " +"Python's dotted-import nomenclature, e.g. " +"``package.subpackage.module.function``. In this case, " "``package.subpackage.module`` would be imported and the resulting module " "must have a callable named ``function()``. This is run, passing in " -"``*args`` and ``**kws``, and whatever ``function()`` returns, ``sys." -"breakpointhook()`` returns to the built-in :func:`breakpoint` function." +"``*args`` and ``**kws``, and whatever ``function()`` returns, " +"``sys.breakpointhook()`` returns to the built-in :func:`breakpoint` function." msgstr "" -#: ../../library/sys.rst:269 +#: ../../library/sys.rst:268 msgid "" -"Note that if anything goes wrong while importing the callable named by :" -"envvar:`PYTHONBREAKPOINT`, a :exc:`RuntimeWarning` is reported and the " +"Note that if anything goes wrong while importing the callable named " +"by :envvar:`PYTHONBREAKPOINT`, a :exc:`RuntimeWarning` is reported and the " "breakpoint is ignored." msgstr "" -#: ../../library/sys.rst:273 +#: ../../library/sys.rst:272 msgid "" -"Also note that if ``sys.breakpointhook()`` is overridden programmatically, :" -"envvar:`PYTHONBREAKPOINT` is *not* consulted." +"Also note that if ``sys.breakpointhook()`` is overridden " +"programmatically, :envvar:`PYTHONBREAKPOINT` is *not* consulted." msgstr "" -#: ../../library/sys.rst:280 +#: ../../library/sys.rst:279 msgid "" "Print low-level information to stderr about the state of CPython's memory " "allocator." msgstr "" -#: ../../library/sys.rst:283 +#: ../../library/sys.rst:282 msgid "" "If Python is :ref:`built in debug mode ` (:option:`configure --" "with-pydebug option <--with-pydebug>`), it also performs some expensive " "internal consistency checks." msgstr "" -#: ../../library/sys.rst:291 +#: ../../library/sys.rst:290 msgid "" "This function is specific to CPython. The exact output format is not " "defined here, and may change." msgstr "" -#: ../../library/sys.rst:297 +#: ../../library/sys.rst:296 msgid "Integer specifying the handle of the Python DLL." msgstr "" -#: ../../library/sys.rst:304 +#: ../../library/sys.rst:303 msgid "" -"If *value* is not ``None``, this function prints ``repr(value)`` to ``sys." -"stdout``, and saves *value* in ``builtins._``. If ``repr(value)`` is not " -"encodable to ``sys.stdout.encoding`` with ``sys.stdout.errors`` error " -"handler (which is probably ``'strict'``), encode it to ``sys.stdout." -"encoding`` with ``'backslashreplace'`` error handler." +"If *value* is not ``None``, this function prints ``repr(value)`` to " +"``sys.stdout``, and saves *value* in ``builtins._``. If ``repr(value)`` is " +"not encodable to ``sys.stdout.encoding`` with ``sys.stdout.errors`` error " +"handler (which is probably ``'strict'``), encode it to " +"``sys.stdout.encoding`` with ``'backslashreplace'`` error handler." msgstr "" -#: ../../library/sys.rst:310 +#: ../../library/sys.rst:309 msgid "" -"``sys.displayhook`` is called on the result of evaluating an :term:" -"`expression` entered in an interactive Python session. The display of these " -"values can be customized by assigning another one-argument function to ``sys." -"displayhook``." +"``sys.displayhook`` is called on the result of evaluating " +"an :term:`expression` entered in an interactive Python session. The display " +"of these values can be customized by assigning another one-argument function " +"to ``sys.displayhook``." msgstr "" -#: ../../library/sys.rst:314 +#: ../../library/sys.rst:313 msgid "Pseudo-code::" msgstr "" -#: ../../library/sys.rst:316 +#: ../../library/sys.rst:315 msgid "" "def displayhook(value):\n" " if value is None:\n" @@ -428,33 +437,33 @@ msgid "" " builtins._ = value" msgstr "" -#: ../../library/sys.rst:334 +#: ../../library/sys.rst:333 msgid "Use ``'backslashreplace'`` error handler on :exc:`UnicodeEncodeError`." msgstr "" -#: ../../library/sys.rst:340 +#: ../../library/sys.rst:339 msgid "" "If this is true, Python won't try to write ``.pyc`` files on the import of " "source modules. This value is initially set to ``True`` or ``False`` " -"depending on the :option:`-B` command line option and the :envvar:" -"`PYTHONDONTWRITEBYTECODE` environment variable, but you can set it yourself " -"to control bytecode file generation." +"depending on the :option:`-B` command line option and " +"the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable, but you can set " +"it yourself to control bytecode file generation." msgstr "" -#: ../../library/sys.rst:349 +#: ../../library/sys.rst:348 msgid "" "A :term:`named tuple` holding information about the environment on the " "*wasm32-emscripten* platform. The named tuple is provisional and may change " "in the future." msgstr "" -#: ../../library/sys.rst:355 +#: ../../library/sys.rst:354 msgid "" "Emscripten version as tuple of ints (major, minor, micro), e.g. ``(3, 1, " "8)``." msgstr "" -#: ../../library/sys.rst:359 +#: ../../library/sys.rst:358 msgid "" "Runtime string, e.g. browser user agent, ``'Node.js v14.18.2'``, or " "``'UNKNOWN'``." @@ -462,15 +471,15 @@ msgstr "" "運行環境字串,例如瀏覽器使用者代理 (browser user agent) ``'Node.js " "v14.18.2'`` 或 ``'UNKNOWN'``。" -#: ../../library/sys.rst:363 +#: ../../library/sys.rst:362 msgid "``True`` if Python is compiled with Emscripten pthreads support." msgstr "" -#: ../../library/sys.rst:367 +#: ../../library/sys.rst:366 msgid "``True`` if Python is compiled with shared memory support." msgstr "" -#: ../../library/sys.rst:376 +#: ../../library/sys.rst:375 msgid "" "If this is set (not ``None``), Python will write bytecode-cache ``.pyc`` " "files to (and read them from) a parallel directory tree rooted at this " @@ -481,25 +490,25 @@ msgid "" "with the same pycache prefix (if any) that you will use at runtime." msgstr "" -#: ../../library/sys.rst:384 +#: ../../library/sys.rst:383 msgid "" "A relative path is interpreted relative to the current working directory." msgstr "" -#: ../../library/sys.rst:386 +#: ../../library/sys.rst:385 msgid "" "This value is initially set based on the value of the :option:`-X` " -"``pycache_prefix=PATH`` command-line option or the :envvar:" -"`PYTHONPYCACHEPREFIX` environment variable (command-line takes precedence). " -"If neither are set, it is ``None``." +"``pycache_prefix=PATH`` command-line option or " +"the :envvar:`PYTHONPYCACHEPREFIX` environment variable (command-line takes " +"precedence). If neither are set, it is ``None``." msgstr "" -#: ../../library/sys.rst:396 +#: ../../library/sys.rst:395 msgid "" "This function prints out a given traceback and exception to ``sys.stderr``." msgstr "" -#: ../../library/sys.rst:398 +#: ../../library/sys.rst:397 msgid "" "When an exception other than :exc:`SystemExit` is raised and uncaught, the " "interpreter calls ``sys.excepthook`` with three arguments, the exception " @@ -510,24 +519,24 @@ msgid "" "argument function to ``sys.excepthook``." msgstr "" -#: ../../library/sys.rst:405 ../../library/sys.rst:407 +#: ../../library/sys.rst:404 ../../library/sys.rst:406 msgid "" "Raise an auditing event ``sys.excepthook`` with arguments ``hook``, " "``type``, ``value``, ``traceback`` when an uncaught exception occurs. If no " "hook has been set, ``hook`` may be ``None``. If any hook raises an exception " "derived from :class:`RuntimeError` the call to the hook will be suppressed. " -"Otherwise, the audit hook exception will be reported as unraisable and ``sys." -"excepthook`` will be called." +"Otherwise, the audit hook exception will be reported as unraisable and " +"``sys.excepthook`` will be called." msgstr "" -#: ../../library/sys.rst:416 +#: ../../library/sys.rst:415 msgid "" "The :func:`sys.unraisablehook` function handles unraisable exceptions and " -"the :func:`threading.excepthook` function handles exception raised by :func:" -"`threading.Thread.run`." +"the :func:`threading.excepthook` function handles exception raised " +"by :func:`threading.Thread.run`." msgstr "" -#: ../../library/sys.rst:426 +#: ../../library/sys.rst:425 msgid "" "These objects contain the original values of ``breakpointhook``, " "``displayhook``, ``excepthook``, and ``unraisablehook`` at the start of the " @@ -536,15 +545,15 @@ msgid "" "get replaced with broken or alternative objects." msgstr "" -#: ../../library/sys.rst:432 +#: ../../library/sys.rst:431 msgid "__breakpointhook__" msgstr "__breakpointhook__" -#: ../../library/sys.rst:435 +#: ../../library/sys.rst:434 msgid "__unraisablehook__" msgstr "__unraisablehook__" -#: ../../library/sys.rst:441 +#: ../../library/sys.rst:440 msgid "" "This function, when called while an exception handler is executing (such as " "an ``except`` or ``except*`` clause), returns the exception instance that " @@ -552,56 +561,66 @@ msgid "" "another, only the exception handled by the innermost handler is accessible." msgstr "" -#: ../../library/sys.rst:446 +#: ../../library/sys.rst:445 msgid "If no exception handler is executing, this function returns ``None``." msgstr "" -#: ../../library/sys.rst:453 +#: ../../library/sys.rst:452 msgid "" "This function returns the old-style representation of the handled exception. " "If an exception ``e`` is currently handled (so :func:`exception` would " -"return ``e``), :func:`exc_info` returns the tuple ``(type(e), e, e." -"__traceback__)``. That is, a tuple containing the type of the exception (a " -"subclass of :exc:`BaseException`), the exception itself, and a :ref:" -"`traceback object ` which typically encapsulates the call " -"stack at the point where the exception last occurred." +"return ``e``), :func:`exc_info` returns the tuple ``(type(e), e, " +"e.__traceback__)``. That is, a tuple containing the type of the exception (a " +"subclass of :exc:`BaseException`), the exception itself, and " +"a :ref:`traceback object ` which typically encapsulates " +"the call stack at the point where the exception last occurred." msgstr "" -#: ../../library/sys.rst:464 +#: ../../library/sys.rst:463 msgid "" "If no exception is being handled anywhere on the stack, this function return " "a tuple containing three ``None`` values." msgstr "" -#: ../../library/sys.rst:467 +#: ../../library/sys.rst:466 msgid "" "The ``type`` and ``traceback`` fields are now derived from the ``value`` " "(the exception instance), so when an exception is modified while it is being " -"handled, the changes are reflected in the results of subsequent calls to :" -"func:`exc_info`." +"handled, the changes are reflected in the results of subsequent calls " +"to :func:`exc_info`." msgstr "" -#: ../../library/sys.rst:475 +#: ../../library/sys.rst:474 msgid "" "A string giving the site-specific directory prefix where the platform-" "dependent Python files are installed; by default, this is also ``'/usr/" "local'``. This can be set at build time with the ``--exec-prefix`` argument " "to the :program:`configure` script. Specifically, all configuration files " -"(e.g. the :file:`pyconfig.h` header file) are installed in the directory :" -"file:`{exec_prefix}/lib/python{X.Y}/config`, and shared library modules are " -"installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, where *X.Y* " -"is the version number of Python, for example ``3.2``." +"(e.g. the :file:`pyconfig.h` header file) are installed in the " +"directory :file:`{exec_prefix}/lib/python{X.Y}/config`, and shared library " +"modules are installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, " +"where *X.Y* is the version number of Python, for example ``3.2``." msgstr "" -#: ../../library/sys.rst:486 +#: ../../library/sys.rst:485 msgid "" -"If a :ref:`virtual environment ` is in effect, this value will be " -"changed in ``site.py`` to point to the virtual environment. The value for " -"the Python installation will still be available, via :data:" -"`base_exec_prefix`." +"If a :ref:`virtual environment ` is in effect, " +"this :data:`exec_prefix` will point to the virtual environment. The value " +"for the Python installation will still be available, " +"via :data:`base_exec_prefix`. Refer to :ref:`sys-path-init-virtual-" +"environments` for more information." msgstr "" -#: ../../library/sys.rst:494 +#: ../../library/sys.rst:492 ../../library/sys.rst:1627 +msgid "" +"When running under a :ref:`virtual environment `, :data:`prefix` " +"and :data:`exec_prefix` are now set to the virtual environment prefix by " +"the :ref:`path initialization `, instead of :mod:`site`. This " +"means that :data:`prefix` and :data:`exec_prefix` always point to the " +"virtual environment, even when :mod:`site` is disabled (:option:`-S`)." +msgstr "" + +#: ../../library/sys.rst:501 msgid "" "A string giving the absolute path of the executable binary for the Python " "interpreter, on systems where this makes sense. If Python is unable to " @@ -609,13 +628,13 @@ msgid "" "empty string or ``None``." msgstr "" -#: ../../library/sys.rst:502 +#: ../../library/sys.rst:509 msgid "" "Raise a :exc:`SystemExit` exception, signaling an intention to exit the " "interpreter." msgstr "" -#: ../../library/sys.rst:504 +#: ../../library/sys.rst:511 msgid "" "The optional argument *arg* can be an integer giving the exit status " "(defaulting to zero), or another type of object. If it is an integer, zero " @@ -631,7 +650,7 @@ msgid "" "way to exit a program when an error occurs." msgstr "" -#: ../../library/sys.rst:517 +#: ../../library/sys.rst:524 msgid "" "Since :func:`exit` ultimately \"only\" raises an exception, it will only " "exit the process when called from the main thread, and the exception is not " @@ -640,113 +659,130 @@ msgid "" "an outer level." msgstr "" -#: ../../library/sys.rst:522 +#: ../../library/sys.rst:529 msgid "" -"If an error occurs in the cleanup after the Python interpreter has caught :" -"exc:`SystemExit` (such as an error flushing buffered data in the standard " -"streams), the exit status is changed to 120." +"If an error occurs in the cleanup after the Python interpreter has " +"caught :exc:`SystemExit` (such as an error flushing buffered data in the " +"standard streams), the exit status is changed to 120." msgstr "" -#: ../../library/sys.rst:530 +#: ../../library/sys.rst:537 msgid "" -"The :term:`named tuple` *flags* exposes the status of command line flags. " -"The attributes are read only." +"The :term:`named tuple` *flags* exposes the status of command line flags. " +"Flags should only be accessed only by name and not by index. The attributes " +"are read only." msgstr "" -#: ../../library/sys.rst:536 +#: ../../library/sys.rst:544 msgid ":option:`-d`" msgstr ":option:`-d`" -#: ../../library/sys.rst:539 ../../library/sys.rst:542 +#: ../../library/sys.rst:547 ../../library/sys.rst:550 msgid ":option:`-i`" msgstr ":option:`-i`" -#: ../../library/sys.rst:545 +#: ../../library/sys.rst:553 msgid ":option:`-I`" msgstr ":option:`-I`" -#: ../../library/sys.rst:548 +#: ../../library/sys.rst:556 msgid ":option:`-O` or :option:`-OO`" msgstr ":option:`-O` 或 :option:`-OO`" -#: ../../library/sys.rst:551 +#: ../../library/sys.rst:559 msgid ":option:`-B`" msgstr ":option:`-B`" -#: ../../library/sys.rst:554 +#: ../../library/sys.rst:562 msgid ":option:`-s`" msgstr ":option:`-s`" -#: ../../library/sys.rst:557 +#: ../../library/sys.rst:565 msgid ":option:`-S`" msgstr ":option:`-S`" -#: ../../library/sys.rst:560 +#: ../../library/sys.rst:568 msgid ":option:`-E`" msgstr ":option:`-E`" -#: ../../library/sys.rst:563 +#: ../../library/sys.rst:571 msgid ":option:`-v`" msgstr ":option:`-v`" -#: ../../library/sys.rst:566 +#: ../../library/sys.rst:574 msgid ":option:`-b`" msgstr ":option:`-b`" -#: ../../library/sys.rst:569 +#: ../../library/sys.rst:577 msgid ":option:`-q`" msgstr ":option:`-q`" -#: ../../library/sys.rst:572 +#: ../../library/sys.rst:580 msgid ":option:`-R`" msgstr ":option:`-R`" -#: ../../library/sys.rst:575 +#: ../../library/sys.rst:583 msgid ":option:`-X dev <-X>` (:ref:`Python Development Mode `)" msgstr ":option:`-X dev <-X>` (:ref:`Python 開發模式 `)" -#: ../../library/sys.rst:578 +#: ../../library/sys.rst:586 msgid ":option:`-X utf8 <-X>`" msgstr ":option:`-X utf8 <-X>`" -#: ../../library/sys.rst:581 +#: ../../library/sys.rst:589 msgid ":option:`-P`" msgstr ":option:`-P`" -#: ../../library/sys.rst:584 +#: ../../library/sys.rst:592 msgid "" ":option:`-X int_max_str_digits <-X>` (:ref:`integer string conversion length " "limitation `)" msgstr "" -#: ../../library/sys.rst:588 +#: ../../library/sys.rst:596 msgid ":option:`-X warn_default_encoding <-X>`" msgstr ":option:`-X warn_default_encoding <-X>`" -#: ../../library/sys.rst:590 +#: ../../library/sys.rst:599 +msgid ":option:`-X gil <-X>` and :envvar:`PYTHON_GIL`" +msgstr "" + +#: ../../library/sys.rst:602 +msgid "" +":option:`-X thread_inherit_context <-X>` " +"and :envvar:`PYTHON_THREAD_INHERIT_CONTEXT`" +msgstr "" + +#: ../../library/sys.rst:606 +msgid "" +":option:`-X context_aware_warnings <-X>` " +"and :envvar:`PYTHON_CONTEXT_AWARE_WARNINGS`" +msgstr "" + +#: ../../library/sys.rst:610 msgid "Added ``quiet`` attribute for the new :option:`-q` flag." msgstr "新增 ``quiet`` 屬性,用於新的 :option:`-q` 旗標。" -#: ../../library/sys.rst:593 +#: ../../library/sys.rst:613 msgid "The ``hash_randomization`` attribute." msgstr "``hash_randomization`` 屬性。" -#: ../../library/sys.rst:596 +#: ../../library/sys.rst:616 msgid "Removed obsolete ``division_warning`` attribute." msgstr "移除過時的 ``division_warning`` 屬性。" -#: ../../library/sys.rst:599 +#: ../../library/sys.rst:619 msgid "Added ``isolated`` attribute for :option:`-I` ``isolated`` flag." msgstr "新增 ``isolated`` 屬性,用於 :option:`-I` ``isolated`` 旗標。" -#: ../../library/sys.rst:602 +#: ../../library/sys.rst:622 msgid "" "Added the ``dev_mode`` attribute for the new :ref:`Python Development Mode " "` and the ``utf8_mode`` attribute for the new :option:`-X` " "``utf8`` flag." msgstr "" -#: ../../library/sys.rst:607 +#: ../../library/sys.rst:627 msgid "" "Added ``warn_default_encoding`` attribute for :option:`-X` " "``warn_default_encoding`` flag." @@ -754,15 +790,30 @@ msgstr "" "新增 ``warn_default_encoding`` 屬性,用於 :option:`-X` " "``warn_default_encoding`` 旗標。" -#: ../../library/sys.rst:610 +#: ../../library/sys.rst:630 msgid "Added the ``safe_path`` attribute for :option:`-P` option." msgstr "新增 ``safe_path`` 屬性,用於 :option:`-P` 選項。" -#: ../../library/sys.rst:613 +#: ../../library/sys.rst:633 msgid "Added the ``int_max_str_digits`` attribute." msgstr "新增 ``int_max_str_digits`` 屬性。" -#: ../../library/sys.rst:619 +#: ../../library/sys.rst:636 +#, fuzzy +msgid "Added the ``gil`` attribute." +msgstr "新增 ``int_max_str_digits`` 屬性。" + +#: ../../library/sys.rst:639 +#, fuzzy +msgid "Added the ``thread_inherit_context`` attribute." +msgstr "新增 ``int_max_str_digits`` 屬性。" + +#: ../../library/sys.rst:642 +#, fuzzy +msgid "Added the ``context_aware_warnings`` attribute." +msgstr "新增 ``int_max_str_digits`` 屬性。" + +#: ../../library/sys.rst:648 msgid "" "A :term:`named tuple` holding information about the float type. It contains " "low level information about the precision and internal representation. The " @@ -772,169 +823,169 @@ msgid "" "floating types', for details." msgstr "" -#: ../../library/sys.rst:626 +#: ../../library/sys.rst:655 msgid "Attributes of the :data:`!float_info` :term:`named tuple`" msgstr "" -#: ../../library/sys.rst:629 +#: ../../library/sys.rst:658 msgid "attribute" msgstr "屬性" -#: ../../library/sys.rst:630 +#: ../../library/sys.rst:659 msgid "float.h macro" msgstr "float.h macro" -#: ../../library/sys.rst:631 +#: ../../library/sys.rst:660 msgid "explanation" msgstr "解釋" -#: ../../library/sys.rst:634 +#: ../../library/sys.rst:663 msgid ":c:macro:`!DBL_EPSILON`" msgstr ":c:macro:`!DBL_EPSILON`" -#: ../../library/sys.rst:635 +#: ../../library/sys.rst:664 msgid "" "difference between 1.0 and the least value greater than 1.0 that is " "representable as a float." msgstr "" -#: ../../library/sys.rst:638 +#: ../../library/sys.rst:667 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`。" -#: ../../library/sys.rst:641 +#: ../../library/sys.rst:670 msgid ":c:macro:`!DBL_DIG`" msgstr ":c:macro:`!DBL_DIG`" -#: ../../library/sys.rst:642 +#: ../../library/sys.rst:671 msgid "" "The maximum number of decimal digits that can be faithfully represented in a " "float; see below." msgstr "" -#: ../../library/sys.rst:646 +#: ../../library/sys.rst:675 msgid ":c:macro:`!DBL_MANT_DIG`" msgstr ":c:macro:`!DBL_MANT_DIG`" -#: ../../library/sys.rst:647 +#: ../../library/sys.rst:676 msgid "" "Float precision: the number of base-``radix`` digits in the significand of a " "float." msgstr "" -#: ../../library/sys.rst:651 +#: ../../library/sys.rst:680 msgid ":c:macro:`!DBL_MAX`" msgstr ":c:macro:`!DBL_MAX`" -#: ../../library/sys.rst:652 +#: ../../library/sys.rst:681 msgid "The maximum representable positive finite float." msgstr "" -#: ../../library/sys.rst:655 +#: ../../library/sys.rst:684 msgid ":c:macro:`!DBL_MAX_EXP`" msgstr ":c:macro:`!DBL_MAX_EXP`" -#: ../../library/sys.rst:656 +#: ../../library/sys.rst:685 msgid "" "The maximum integer *e* such that ``radix**(e-1)`` is a representable finite " "float." msgstr "" -#: ../../library/sys.rst:660 +#: ../../library/sys.rst:689 msgid ":c:macro:`!DBL_MAX_10_EXP`" msgstr ":c:macro:`!DBL_MAX_10_EXP`" -#: ../../library/sys.rst:661 +#: ../../library/sys.rst:690 msgid "" "The maximum integer *e* such that ``10**e`` is in the range of representable " "finite floats." msgstr "" -#: ../../library/sys.rst:665 +#: ../../library/sys.rst:694 msgid ":c:macro:`!DBL_MIN`" msgstr ":c:macro:`!DBL_MIN`" -#: ../../library/sys.rst:666 +#: ../../library/sys.rst:695 msgid "The minimum representable positive *normalized* float." msgstr "" -#: ../../library/sys.rst:668 +#: ../../library/sys.rst:697 msgid "" "Use :func:`math.ulp(0.0) ` to get the smallest positive " "*denormalized* representable float." msgstr "" -#: ../../library/sys.rst:672 +#: ../../library/sys.rst:701 msgid ":c:macro:`!DBL_MIN_EXP`" msgstr ":c:macro:`!DBL_MIN_EXP`" -#: ../../library/sys.rst:673 +#: ../../library/sys.rst:702 msgid "" "The minimum integer *e* such that ``radix**(e-1)`` is a normalized float." msgstr "" -#: ../../library/sys.rst:677 +#: ../../library/sys.rst:706 msgid ":c:macro:`!DBL_MIN_10_EXP`" msgstr ":c:macro:`!DBL_MIN_10_EXP`" -#: ../../library/sys.rst:678 +#: ../../library/sys.rst:707 msgid "The minimum integer *e* such that ``10**e`` is a normalized float." msgstr "" -#: ../../library/sys.rst:681 +#: ../../library/sys.rst:710 msgid ":c:macro:`!FLT_RADIX`" msgstr ":c:macro:`!FLT_RADIX`" -#: ../../library/sys.rst:682 +#: ../../library/sys.rst:711 msgid "The radix of exponent representation." msgstr "" -#: ../../library/sys.rst:685 +#: ../../library/sys.rst:714 msgid ":c:macro:`!FLT_ROUNDS`" msgstr ":c:macro:`!FLT_ROUNDS`" -#: ../../library/sys.rst:686 +#: ../../library/sys.rst:715 msgid "" "An integer representing the rounding mode for floating-point arithmetic. " "This reflects the value of the system :c:macro:`!FLT_ROUNDS` macro at " "interpreter startup time:" msgstr "" -#: ../../library/sys.rst:690 +#: ../../library/sys.rst:719 msgid "``-1``: indeterminable" msgstr "" -#: ../../library/sys.rst:691 +#: ../../library/sys.rst:720 msgid "``0``: toward zero" msgstr "" -#: ../../library/sys.rst:692 +#: ../../library/sys.rst:721 msgid "``1``: to nearest" msgstr "" -#: ../../library/sys.rst:693 +#: ../../library/sys.rst:722 msgid "``2``: toward positive infinity" msgstr "" -#: ../../library/sys.rst:694 +#: ../../library/sys.rst:723 msgid "``3``: toward negative infinity" msgstr "" -#: ../../library/sys.rst:696 +#: ../../library/sys.rst:725 msgid "" "All other values for :c:macro:`!FLT_ROUNDS` characterize implementation-" "defined rounding behavior." msgstr "" -#: ../../library/sys.rst:699 +#: ../../library/sys.rst:728 msgid "" "The attribute :attr:`sys.float_info.dig` needs further explanation. If " -"``s`` is any string representing a decimal number with at most :attr:`!sys." -"float_info.dig` significant digits, then converting ``s`` to a float and " +"``s`` is any string representing a decimal number with at most :attr:`!" +"sys.float_info.dig` significant digits, then converting ``s`` to a float and " "back again will recover a string representing the same decimal value::" msgstr "" -#: ../../library/sys.rst:705 +#: ../../library/sys.rst:734 msgid "" ">>> import sys\n" ">>> sys.float_info.dig\n" @@ -944,20 +995,20 @@ msgid "" "'3.14159265358979'" msgstr "" -#: ../../library/sys.rst:712 +#: ../../library/sys.rst:741 msgid "" "But for strings with more than :attr:`sys.float_info.dig` significant " "digits, this isn't always true::" msgstr "" -#: ../../library/sys.rst:715 +#: ../../library/sys.rst:744 msgid "" ">>> s = '9876543211234567' # 16 significant digits is too many!\n" ">>> format(float(s), '.16g') # conversion changes value\n" "'9876543211234568'" msgstr "" -#: ../../library/sys.rst:721 +#: ../../library/sys.rst:750 msgid "" "A string indicating how the :func:`repr` function behaves for floats. If " "the string has value ``'short'`` then for a finite float ``x``, ``repr(x)`` " @@ -967,56 +1018,56 @@ msgid "" "same way as it did in versions of Python prior to 3.1." msgstr "" -#: ../../library/sys.rst:734 +#: ../../library/sys.rst:763 msgid "" "Return the number of memory blocks currently allocated by the interpreter, " "regardless of their size. This function is mainly useful for tracking and " "debugging memory leaks. Because of the interpreter's internal caches, the " -"result can vary from call to call; you may have to call :func:" -"`_clear_internal_caches` and :func:`gc.collect` to get more predictable " -"results." +"result can vary from call to call; you may have to " +"call :func:`_clear_internal_caches` and :func:`gc.collect` to get more " +"predictable results." msgstr "" -#: ../../library/sys.rst:741 +#: ../../library/sys.rst:770 msgid "" "If a Python build or implementation cannot reasonably compute this " "information, :func:`getallocatedblocks` is allowed to return 0 instead." msgstr "" -#: ../../library/sys.rst:749 +#: ../../library/sys.rst:778 msgid "Return the number of unicode objects that have been interned." msgstr "" -#: ../../library/sys.rst:756 +#: ../../library/sys.rst:785 msgid "" "Return the build-time API level of Android as an integer. This represents " "the minimum version of Android this build of Python can run on. For runtime " "version information, see :func:`platform.android_ver`." msgstr "" -#: ../../library/sys.rst:767 +#: ../../library/sys.rst:796 msgid "" "Return ``'utf-8'``. This is the name of the default string encoding, used in " "methods like :meth:`str.encode`." msgstr "" -#: ../../library/sys.rst:773 +#: ../../library/sys.rst:802 msgid "" "Return the current value of the flags that are used for :c:func:`dlopen` " "calls. Symbolic names for the flag values can be found in the :mod:`os` " "module (:samp:`RTLD_{xxx}` constants, e.g. :const:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:783 +#: ../../library/sys.rst:812 msgid "" "Get the :term:`filesystem encoding `: " "the encoding used with the :term:`filesystem error handler ` to convert between Unicode filenames and bytes " -"filenames. The filesystem error handler is returned from :func:" -"`getfilesystemencodeerrors`." +"filenames. The filesystem error handler is returned " +"from :func:`getfilesystemencodeerrors`." msgstr "" -#: ../../library/sys.rst:789 +#: ../../library/sys.rst:818 msgid "" "For best compatibility, str should be used for filenames in all cases, " "although representing filenames as bytes is also supported. Functions " @@ -1024,107 +1075,113 @@ msgid "" "internally convert to the system's preferred representation." msgstr "" -#: ../../library/sys.rst:794 ../../library/sys.rst:822 +#: ../../library/sys.rst:823 ../../library/sys.rst:851 msgid "" ":func:`os.fsencode` and :func:`os.fsdecode` should be used to ensure that " "the correct encoding and errors mode are used." msgstr "" -#: ../../library/sys.rst:797 ../../library/sys.rst:825 +#: ../../library/sys.rst:826 ../../library/sys.rst:854 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " -"startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." -"filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :" -"c:type:`PyConfig`." +"startup by the :c:func:`PyConfig_Read` function: " +"see :c:member:`~PyConfig.filesystem_encoding` " +"and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." msgstr "" -#: ../../library/sys.rst:802 +#: ../../library/sys.rst:831 msgid ":func:`getfilesystemencoding` result cannot be ``None`` anymore." msgstr ":func:`getfilesystemencoding` 的結果不再為 ``None``。" -#: ../../library/sys.rst:805 +#: ../../library/sys.rst:834 msgid "" -"Windows is no longer guaranteed to return ``'mbcs'``. See :pep:`529` and :" -"func:`_enablelegacywindowsfsencoding` for more information." +"Windows is no longer guaranteed to return ``'mbcs'``. See :pep:`529` " +"and :func:`_enablelegacywindowsfsencoding` for more information." msgstr "" -#: ../../library/sys.rst:809 +#: ../../library/sys.rst:838 msgid "" "Return ``'utf-8'`` if the :ref:`Python UTF-8 Mode ` is enabled." msgstr "" -#: ../../library/sys.rst:816 +#: ../../library/sys.rst:845 msgid "" "Get the :term:`filesystem error handler `: the error handler used with the :term:`filesystem encoding " "` to convert between Unicode " -"filenames and bytes filenames. The filesystem encoding is returned from :" -"func:`getfilesystemencoding`." +"filenames and bytes filenames. The filesystem encoding is returned " +"from :func:`getfilesystemencoding`." msgstr "" -#: ../../library/sys.rst:834 +#: ../../library/sys.rst:863 msgid "" "Returns the current value for the :ref:`integer string conversion length " "limitation `. See also :func:`set_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:841 +#: ../../library/sys.rst:870 msgid "" "Return the reference count of the *object*. The count returned is generally " "one higher than you might expect, because it includes the (temporary) " "reference as an argument to :func:`getrefcount`." msgstr "" -#: ../../library/sys.rst:845 +#: ../../library/sys.rst:874 msgid "" "Note that the returned value may not actually reflect how many references to " -"the object are actually held. For example, some objects are :term:" -"`immortal` and have a very high refcount that does not reflect the actual " -"number of references. Consequently, do not rely on the returned value to be " -"accurate, other than a value of 0 or 1." +"the object are actually held. For example, some objects " +"are :term:`immortal` and have a very high refcount that does not reflect the " +"actual number of references. Consequently, do not rely on the returned " +"value to be accurate, other than a value of 0 or 1." +msgstr "" + +#: ../../library/sys.rst:882 +msgid "" +":term:`Immortal ` objects with a large reference count can be " +"identified via :func:`_is_immortal`." msgstr "" -#: ../../library/sys.rst:851 +#: ../../library/sys.rst:885 msgid "" "Immortal objects have very large refcounts that do not match the actual " "number of references to the object." msgstr "" -#: ../../library/sys.rst:857 +#: ../../library/sys.rst:891 msgid "" "Return the current value of the recursion limit, the maximum depth of the " "Python interpreter stack. This limit prevents infinite recursion from " -"causing an overflow of the C stack and crashing Python. It can be set by :" -"func:`setrecursionlimit`." +"causing an overflow of the C stack and crashing Python. It can be set " +"by :func:`setrecursionlimit`." msgstr "" -#: ../../library/sys.rst:865 +#: ../../library/sys.rst:899 msgid "" "Return the size of an object in bytes. The object can be any type of object. " "All built-in objects will return correct results, but this does not have to " "hold true for third-party extensions as it is implementation specific." msgstr "" -#: ../../library/sys.rst:870 +#: ../../library/sys.rst:904 msgid "" "Only the memory consumption directly attributed to the object is accounted " "for, not the memory consumption of objects it refers to." msgstr "" -#: ../../library/sys.rst:873 +#: ../../library/sys.rst:907 msgid "" "If given, *default* will be returned if the object does not provide means to " "retrieve the size. Otherwise a :exc:`TypeError` will be raised." msgstr "" -#: ../../library/sys.rst:876 +#: ../../library/sys.rst:910 msgid "" ":func:`getsizeof` calls the object's ``__sizeof__`` method and adds an " "additional garbage collector overhead if the object is managed by the " "garbage collector." msgstr "" -#: ../../library/sys.rst:880 +#: ../../library/sys.rst:914 msgid "" "See `recursive sizeof recipe `_ for an example of " @@ -1132,13 +1189,13 @@ msgid "" "their contents." msgstr "" -#: ../../library/sys.rst:886 +#: ../../library/sys.rst:920 msgid "" -"Return the interpreter's \"thread switch interval\" in seconds; see :func:" -"`setswitchinterval`." +"Return the interpreter's \"thread switch interval\" in seconds; " +"see :func:`setswitchinterval`." msgstr "" -#: ../../library/sys.rst:894 +#: ../../library/sys.rst:928 msgid "" "Return a frame object from the call stack. If optional integer *depth* is " "given, return the frame object that many calls below the top of the stack. " @@ -1147,21 +1204,21 @@ msgid "" "stack." msgstr "" -#: ../../library/sys.rst:899 +#: ../../library/sys.rst:933 msgid "" "Raises an :ref:`auditing event ` ``sys._getframe`` with argument " "``frame``." msgstr "" -"引發一個附帶引數 ``frame`` 的\\ :ref:`稽核事件 ` ``sys." -"_getframe``。" +"引發一個附帶引數 ``frame`` 的\\ :ref:`稽核事件 ` " +"``sys._getframe``。" -#: ../../library/sys.rst:903 ../../library/sys.rst:919 +#: ../../library/sys.rst:937 ../../library/sys.rst:953 msgid "" "This function should be used for internal and specialized purposes only. It " "is not guaranteed to exist in all implementations of Python." msgstr "" -#: ../../library/sys.rst:909 +#: ../../library/sys.rst:943 msgid "" "Return the name of a module from the call stack. If optional integer " "*depth* is given, return the module that many calls below the top of the " @@ -1170,56 +1227,57 @@ msgid "" "returning the module at the top of the call stack." msgstr "" -#: ../../library/sys.rst:915 +#: ../../library/sys.rst:949 msgid "" "Raises an :ref:`auditing event ` ``sys._getframemodulename`` with " "argument ``depth``." msgstr "" -"引發一個附帶引數 ``depth`` 的\\ :ref:`稽核事件 ` ``sys." -"_getframemodulename``。" +"引發一個附帶引數 ``depth`` 的\\ :ref:`稽核事件 ` " +"``sys._getframemodulename``。" -#: ../../library/sys.rst:927 +#: ../../library/sys.rst:961 msgid "" "This function only exists if CPython was built using the specialized " "configure option :option:`--with-trace-refs`. It is intended only for " "debugging garbage-collection issues." msgstr "" -#: ../../library/sys.rst:931 +#: ../../library/sys.rst:965 msgid "" "Return a list of up to *limit* dynamically allocated Python objects. If " "*type* is given, only objects of that exact type (not subtypes) are included." msgstr "" -#: ../../library/sys.rst:935 +#: ../../library/sys.rst:969 msgid "" "Objects from the list are not safe to use. Specifically, the result will " "include objects from all interpreters that share their object allocator " -"state (that is, ones created with :c:member:`PyInterpreterConfig." -"use_main_obmalloc` set to 1 or using :c:func:`Py_NewInterpreter`, and the :" -"ref:`main interpreter `). Mixing objects from " -"different interpreters may lead to crashes or other unexpected behavior." +"state (that is, ones created " +"with :c:member:`PyInterpreterConfig.use_main_obmalloc` set to 1 or " +"using :c:func:`Py_NewInterpreter`, and the :ref:`main interpreter `). Mixing objects from different interpreters may lead " +"to crashes or other unexpected behavior." msgstr "" -#: ../../library/sys.rst:946 +#: ../../library/sys.rst:980 ../../library/sys.rst:1384 msgid "" "This function should be used for specialized purposes only. It is not " "guaranteed to exist in all implementations of Python." msgstr "" -#: ../../library/sys.rst:951 +#: ../../library/sys.rst:985 msgid "The result may include objects from other interpreters." msgstr "" -#: ../../library/sys.rst:960 +#: ../../library/sys.rst:994 msgid "Get the profiler function as set by :func:`setprofile`." msgstr "" -#: ../../library/sys.rst:969 +#: ../../library/sys.rst:1003 msgid "Get the trace function as set by :func:`settrace`." msgstr "" -#: ../../library/sys.rst:973 +#: ../../library/sys.rst:1007 msgid "" "The :func:`gettrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -1227,66 +1285,66 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:981 +#: ../../library/sys.rst:1015 msgid "" "Return a named tuple describing the Windows version currently running. The " "named elements are *major*, *minor*, *build*, *platform*, *service_pack*, " "*service_pack_minor*, *service_pack_major*, *suite_mask*, *product_type* and " "*platform_version*. *service_pack* contains a string, *platform_version* a 3-" "tuple and all other values are integers. The components can also be accessed " -"by name, so ``sys.getwindowsversion()[0]`` is equivalent to ``sys." -"getwindowsversion().major``. For compatibility with prior versions, only the " -"first 5 elements are retrievable by indexing." +"by name, so ``sys.getwindowsversion()[0]`` is equivalent to " +"``sys.getwindowsversion().major``. For compatibility with prior versions, " +"only the first 5 elements are retrievable by indexing." msgstr "" -#: ../../library/sys.rst:992 +#: ../../library/sys.rst:1026 msgid "*platform* will be ``2`` (VER_PLATFORM_WIN32_NT)." msgstr "" -#: ../../library/sys.rst:994 +#: ../../library/sys.rst:1028 msgid "*product_type* may be one of the following values:" msgstr "" -#: ../../library/sys.rst:997 +#: ../../library/sys.rst:1031 msgid "Constant" msgstr "" -#: ../../library/sys.rst:997 +#: ../../library/sys.rst:1031 msgid "Meaning" msgstr "含義" -#: ../../library/sys.rst:999 +#: ../../library/sys.rst:1033 msgid "``1`` (VER_NT_WORKSTATION)" msgstr "``1`` (VER_NT_WORKSTATION)" -#: ../../library/sys.rst:999 +#: ../../library/sys.rst:1033 msgid "The system is a workstation." msgstr "" -#: ../../library/sys.rst:1001 +#: ../../library/sys.rst:1035 msgid "``2`` (VER_NT_DOMAIN_CONTROLLER)" msgstr "``2`` (VER_NT_DOMAIN_CONTROLLER)" -#: ../../library/sys.rst:1001 +#: ../../library/sys.rst:1035 msgid "The system is a domain controller." msgstr "" -#: ../../library/sys.rst:1004 +#: ../../library/sys.rst:1038 msgid "``3`` (VER_NT_SERVER)" msgstr "``3`` (VER_NT_SERVER)" -#: ../../library/sys.rst:1004 +#: ../../library/sys.rst:1038 msgid "The system is a server, but not a domain controller." msgstr "" -#: ../../library/sys.rst:1008 +#: ../../library/sys.rst:1042 msgid "" "This function wraps the Win32 :c:func:`!GetVersionEx` function; see the " "Microsoft documentation on :c:func:`!OSVERSIONINFOEX` for more information " "about these fields." msgstr "" -#: ../../library/sys.rst:1012 +#: ../../library/sys.rst:1046 msgid "" "*platform_version* returns the major version, minor version and build number " "of the current operating system, rather than the version that is being " @@ -1294,98 +1352,98 @@ msgid "" "feature detection." msgstr "" -#: ../../library/sys.rst:1018 +#: ../../library/sys.rst:1052 msgid "" "*platform_version* derives the version from kernel32.dll which can be of a " "different version than the OS version. Please use :mod:`platform` module for " "achieving accurate OS version." msgstr "" -#: ../../library/sys.rst:1024 +#: ../../library/sys.rst:1058 msgid "" "Changed to a named tuple and added *service_pack_minor*, " "*service_pack_major*, *suite_mask*, and *product_type*." msgstr "" -#: ../../library/sys.rst:1028 +#: ../../library/sys.rst:1062 msgid "Added *platform_version*" msgstr "新增 *platform_version*" -#: ../../library/sys.rst:1034 +#: ../../library/sys.rst:1068 msgid "" -"Returns an *asyncgen_hooks* object, which is similar to a :class:" -"`~collections.namedtuple` of the form ``(firstiter, finalizer)``, where " -"*firstiter* and *finalizer* are expected to be either ``None`` or functions " -"which take an :term:`asynchronous generator iterator` as an argument, and " -"are used to schedule finalization of an asynchronous generator by an event " -"loop." +"Returns an *asyncgen_hooks* object, which is similar to " +"a :class:`~collections.namedtuple` of the form ``(firstiter, finalizer)``, " +"where *firstiter* and *finalizer* are expected to be either ``None`` or " +"functions which take an :term:`asynchronous generator iterator` as an " +"argument, and are used to schedule finalization of an asynchronous generator " +"by an event loop." msgstr "" -#: ../../library/sys.rst:1041 +#: ../../library/sys.rst:1075 msgid "See :pep:`525` for more details." msgstr "更多細節請見 :pep:`525`。" -#: ../../library/sys.rst:1045 ../../library/sys.rst:1736 +#: ../../library/sys.rst:1079 ../../library/sys.rst:1874 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" msgstr "" -#: ../../library/sys.rst:1051 +#: ../../library/sys.rst:1085 msgid "" -"Get the current coroutine origin tracking depth, as set by :func:" -"`set_coroutine_origin_tracking_depth`." +"Get the current coroutine origin tracking depth, as set " +"by :func:`set_coroutine_origin_tracking_depth`." msgstr "" -#: ../../library/sys.rst:1057 ../../library/sys.rst:1757 +#: ../../library/sys.rst:1091 ../../library/sys.rst:1895 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." msgstr "" -#: ../../library/sys.rst:1063 +#: ../../library/sys.rst:1097 msgid "" "A :term:`named tuple` giving parameters of the numeric hash implementation. " "For more details about hashing of numeric types, see :ref:`numeric-hash`." msgstr "" -#: ../../library/sys.rst:1069 +#: ../../library/sys.rst:1103 msgid "The width in bits used for hash values" msgstr "" -#: ../../library/sys.rst:1073 +#: ../../library/sys.rst:1107 msgid "The prime modulus P used for numeric hash scheme" msgstr "" -#: ../../library/sys.rst:1077 +#: ../../library/sys.rst:1111 msgid "The hash value returned for a positive infinity" msgstr "" -#: ../../library/sys.rst:1081 +#: ../../library/sys.rst:1115 msgid "(This attribute is no longer used)" msgstr "" -#: ../../library/sys.rst:1085 +#: ../../library/sys.rst:1119 msgid "The multiplier used for the imaginary part of a complex number" msgstr "" -#: ../../library/sys.rst:1089 +#: ../../library/sys.rst:1123 msgid "The name of the algorithm for hashing of str, bytes, and memoryview" msgstr "" -#: ../../library/sys.rst:1093 +#: ../../library/sys.rst:1127 msgid "The internal output size of the hash algorithm" msgstr "" -#: ../../library/sys.rst:1097 +#: ../../library/sys.rst:1131 msgid "The size of the seed key of the hash algorithm" msgstr "" -#: ../../library/sys.rst:1101 +#: ../../library/sys.rst:1135 msgid "Added *algorithm*, *hash_bits* and *seed_bits*" msgstr "新增 *algorithm*、*hash_bits* 與 *seed_bits*" -#: ../../library/sys.rst:1107 +#: ../../library/sys.rst:1141 msgid "" "The version number encoded as a single integer. This is guaranteed to " "increase with each version, including proper support for non-production " @@ -1393,7 +1451,7 @@ msgid "" "version 1.5.2, use::" msgstr "" -#: ../../library/sys.rst:1111 +#: ../../library/sys.rst:1145 msgid "" "if sys.hexversion >= 0x010502F0:\n" " # use some advanced feature\n" @@ -1403,7 +1461,7 @@ msgid "" " ..." msgstr "" -#: ../../library/sys.rst:1118 +#: ../../library/sys.rst:1152 msgid "" "This is called ``hexversion`` since it only really looks meaningful when " "viewed as the result of passing it to the built-in :func:`hex` function. " @@ -1411,25 +1469,25 @@ msgid "" "human-friendly encoding of the same information." msgstr "" -#: ../../library/sys.rst:1123 +#: ../../library/sys.rst:1157 msgid "More details of ``hexversion`` can be found at :ref:`apiabiversion`." msgstr "" -#: ../../library/sys.rst:1128 +#: ../../library/sys.rst:1162 msgid "" "An object containing information about the implementation of the currently " "running Python interpreter. The following attributes are required to exist " "in all Python implementations." msgstr "" -#: ../../library/sys.rst:1132 +#: ../../library/sys.rst:1166 msgid "" "*name* is the implementation's identifier, e.g. ``'cpython'``. The actual " "string is defined by the Python implementation, but it is guaranteed to be " "lower case." msgstr "" -#: ../../library/sys.rst:1136 +#: ../../library/sys.rst:1170 msgid "" "*version* is a named tuple, in the same format as :data:`sys.version_info`. " "It represents the version of the Python *implementation*. This has a " @@ -1441,13 +1499,13 @@ msgid "" "the same value, since it is the reference implementation." msgstr "" -#: ../../library/sys.rst:1146 +#: ../../library/sys.rst:1180 msgid "" -"*hexversion* is the implementation version in hexadecimal format, like :data:" -"`sys.hexversion`." +"*hexversion* is the implementation version in hexadecimal format, " +"like :data:`sys.hexversion`." msgstr "" -#: ../../library/sys.rst:1149 +#: ../../library/sys.rst:1183 msgid "" "*cache_tag* is the tag used by the import machinery in the filenames of " "cached modules. By convention, it would be a composite of the " @@ -1456,59 +1514,76 @@ msgid "" "set to ``None``, it indicates that module caching should be disabled." msgstr "" -#: ../../library/sys.rst:1156 +#: ../../library/sys.rst:1190 +msgid "" +"*supports_isolated_interpreters* is a boolean value, whether this " +"implementation supports multiple isolated interpreters. It is ``True`` for " +"CPython on most platforms. Platforms with this support implement the low-" +"level :mod:`!_interpreters` module." +msgstr "" + +#: ../../library/sys.rst:1197 +msgid ":pep:`684`, :pep:`734`, and :mod:`concurrent.interpreters`." +msgstr "" + +#: ../../library/sys.rst:1199 msgid "" ":data:`sys.implementation` may contain additional attributes specific to the " "Python implementation. These non-standard attributes must start with an " -"underscore, and are not described here. Regardless of its contents, :data:" -"`sys.implementation` will not change during a run of the interpreter, nor " -"between implementation versions. (It may change between Python language " -"versions, however.) See :pep:`421` for more information." +"underscore, and are not described here. Regardless of its " +"contents, :data:`sys.implementation` will not change during a run of the " +"interpreter, nor between implementation versions. (It may change between " +"Python language versions, however.) See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:1167 +#: ../../library/sys.rst:1208 +msgid "Added ``supports_isolated_interpreters`` field." +msgstr "" + +#: ../../library/sys.rst:1213 msgid "" "The addition of new required attributes must go through the normal PEP " "process. See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:1172 +#: ../../library/sys.rst:1218 msgid "" "A :term:`named tuple` that holds information about Python's internal " "representation of integers. The attributes are read only." msgstr "" -#: ../../library/sys.rst:1177 +#: ../../library/sys.rst:1223 msgid "" "The number of bits held in each digit. Python integers are stored internally " "in base ``2**int_info.bits_per_digit``." msgstr "" -#: ../../library/sys.rst:1182 +#: ../../library/sys.rst:1228 msgid "The size in bytes of the C type used to represent a digit." msgstr "" -#: ../../library/sys.rst:1186 +#: ../../library/sys.rst:1232 msgid "" "The default value for :func:`sys.get_int_max_str_digits` when it is not " "otherwise explicitly configured." msgstr "" -#: ../../library/sys.rst:1191 +#: ../../library/sys.rst:1237 msgid "" -"The minimum non-zero value for :func:`sys.set_int_max_str_digits`, :envvar:" -"`PYTHONINTMAXSTRDIGITS`, or :option:`-X int_max_str_digits <-X>`." +"The minimum non-zero value " +"for :func:`sys.set_int_max_str_digits`, :envvar:`PYTHONINTMAXSTRDIGITS`, " +"or :option:`-X int_max_str_digits <-X>`." msgstr "" -#: ../../library/sys.rst:1198 +#: ../../library/sys.rst:1244 msgid "" -"Added :attr:`~int_info.default_max_str_digits` and :attr:`~int_info." -"str_digits_check_threshold`." +"Added :attr:`~int_info.default_max_str_digits` " +"and :attr:`~int_info.str_digits_check_threshold`." msgstr "" -"新增 :attr:`~int_info.default_max_str_digits` 和 :attr:`~int_info." -"str_digits_check_threshold`。" +"新增 :attr:`~int_info.default_max_str_digits` " +"和 :attr:`~int_info.str_digits_check_threshold`。" -#: ../../library/sys.rst:1204 +#: ../../library/sys.rst:1250 msgid "" "When this attribute exists, its value is automatically called (with no " "arguments) when the interpreter is launched in :ref:`interactive mode `." msgstr "" -#: ../../library/sys.rst:1210 ../../library/sys.rst:1212 +#: ../../library/sys.rst:1256 ../../library/sys.rst:1258 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_interactivehook`` " "with the hook object as the argument when the hook is called on startup." msgstr "" -#: ../../library/sys.rst:1221 +#: ../../library/sys.rst:1267 msgid "" "Enter *string* in the table of \"interned\" strings and return the interned " "string -- which is *string* itself or a copy. Interning strings is useful to " @@ -1535,33 +1610,96 @@ msgid "" "attributes have interned keys." msgstr "" -#: ../../library/sys.rst:1229 +#: ../../library/sys.rst:1275 msgid "" "Interned strings are not :term:`immortal`; you must keep a reference to the " "return value of :func:`intern` around to benefit from it." msgstr "" -#: ../../library/sys.rst:1235 +#: ../../library/sys.rst:1281 msgid "" "Return :const:`True` if the :term:`GIL` is enabled and :const:`False` if it " "is disabled." msgstr "" -#: ../../library/sys.rst:1242 ../../library/sys.rst:1274 +#: ../../library/sys.rst:1288 ../../library/sys.rst:1396 msgid "It is not guaranteed to exist in all implementations of Python." msgstr "" -#: ../../library/sys.rst:1246 +#: ../../library/sys.rst:1292 msgid "" "Return :const:`True` if the main Python interpreter is :term:`shutting down " "`. Return :const:`False` otherwise." msgstr "" -#: ../../library/sys.rst:1249 +#: ../../library/sys.rst:1295 msgid "See also the :exc:`PythonFinalizationError` exception." msgstr "另請參閱 :exc:`PythonFinalizationError` 例外。" -#: ../../library/sys.rst:1255 +#: ../../library/sys.rst:1301 +msgid "Utilities for observing just-in-time compilation." +msgstr "" + +#: ../../library/sys.rst:1305 +msgid "" +"JIT compilation is an *experimental implementation detail* of CPython. " +"``sys._jit`` is not guaranteed to exist or behave the same way in all Python " +"implementations, versions, or build configurations." +msgstr "" + +#: ../../library/sys.rst:1313 +msgid "" +"Return ``True`` if the current Python executable supports JIT compilation, " +"and ``False`` otherwise. This can be controlled by building CPython with " +"the ``--experimental-jit`` option on Windows, and the :option:`--enable-" +"experimental-jit` option on all other platforms." +msgstr "" + +#: ../../library/sys.rst:1320 +msgid "" +"Return ``True`` if JIT compilation is enabled for the current Python process " +"(implies :func:`sys._jit.is_available`), and ``False`` otherwise. If JIT " +"compilation is available, this can be controlled by setting " +"the :envvar:`PYTHON_JIT` environment variable to ``0`` (disabled) or ``1`` " +"(enabled) at interpreter startup." +msgstr "" + +#: ../../library/sys.rst:1328 +msgid "" +"Return ``True`` if the topmost Python frame is currently executing JIT code " +"(implies :func:`sys._jit.is_enabled`), and ``False`` otherwise." +msgstr "" + +#: ../../library/sys.rst:1333 +msgid "" +"This function is intended for testing and debugging the JIT itself. It " +"should be avoided for any other purpose." +msgstr "" + +#: ../../library/sys.rst:1338 +msgid "" +"Due to the nature of tracing JIT compilers, repeated calls to this function " +"may give surprising results. For example, branching on its return value will " +"likely lead to unexpected behavior (if doing so causes JIT code to be " +"entered or exited):" +msgstr "" + +#: ../../library/sys.rst:1343 +msgid "" +">>> for warmup in range(BIG_NUMBER):\n" +"... # This line is \"hot\", and is eventually JIT-compiled:\n" +"... if sys._jit.is_active():\n" +"... # This line is \"cold\", and is run in the interpreter:\n" +"... assert sys._jit.is_active()\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 5, in \n" +" assert sys._jit.is_active()\n" +" ~~~~~~~~~~~~~~~~~~^^\n" +"AssertionError" +msgstr "" + +#: ../../library/sys.rst:1359 msgid "" "This variable is not always defined; it is set to the exception instance " "when an exception is not handled and the interpreter prints an error message " @@ -1572,86 +1710,100 @@ msgid "" "more information.)" msgstr "" -#: ../../library/sys.rst:1267 +#: ../../library/sys.rst:1371 +msgid "" +"Return :const:`True` if the given object is :term:`immortal`, :const:`False` " +"otherwise." +msgstr "" + +#: ../../library/sys.rst:1376 +msgid "" +"Objects that are immortal (and thus return ``True`` upon being passed to " +"this function) are not guaranteed to be immortal in future versions, and " +"vice versa for mortal objects." +msgstr "" + +#: ../../library/sys.rst:1389 msgid "" "Return :const:`True` if the given string is \"interned\", :const:`False` " "otherwise." msgstr "" -#: ../../library/sys.rst:1281 +#: ../../library/sys.rst:1403 msgid "" "These three variables are deprecated; use :data:`sys.last_exc` instead. They " -"hold the legacy representation of ``sys.last_exc``, as returned from :func:" -"`exc_info` above." +"hold the legacy representation of ``sys.last_exc``, as returned " +"from :func:`exc_info` above." msgstr "" -#: ../../library/sys.rst:1287 +#: ../../library/sys.rst:1409 msgid "" "An integer giving the maximum value a variable of type :c:type:`Py_ssize_t` " "can take. It's usually ``2**31 - 1`` on a 32-bit platform and ``2**63 - 1`` " "on a 64-bit platform." msgstr "" -#: ../../library/sys.rst:1294 +#: ../../library/sys.rst:1416 msgid "" "An integer giving the value of the largest Unicode code point, i.e. " "``1114111`` (``0x10FFFF`` in hexadecimal)." msgstr "" -#: ../../library/sys.rst:1297 +#: ../../library/sys.rst:1419 msgid "" "Before :pep:`393`, ``sys.maxunicode`` used to be either ``0xFFFF`` or " "``0x10FFFF``, depending on the configuration option that specified whether " "Unicode characters were stored as UCS-2 or UCS-4." msgstr "" -#: ../../library/sys.rst:1305 +#: ../../library/sys.rst:1427 msgid "" -"A list of :term:`meta path finder` objects that have their :meth:`~importlib." -"abc.MetaPathFinder.find_spec` methods called to see if one of the objects " -"can find the module to be imported. By default, it holds entries that " -"implement Python's default import semantics. The :meth:`~importlib.abc." -"MetaPathFinder.find_spec` method is called with at least the absolute name " -"of the module being imported. If the module to be imported is contained in a " -"package, then the parent package's :attr:`~module.__path__` attribute is " -"passed in as a second argument. The method returns a :term:`module spec`, or " -"``None`` if the module cannot be found." +"A list of :term:`meta path finder` objects that have " +"their :meth:`~importlib.abc.MetaPathFinder.find_spec` methods called to see " +"if one of the objects can find the module to be imported. By default, it " +"holds entries that implement Python's default import semantics. " +"The :meth:`~importlib.abc.MetaPathFinder.find_spec` method is called with at " +"least the absolute name of the module being imported. If the module to be " +"imported is contained in a package, then the parent " +"package's :attr:`~module.__path__` attribute is passed in as a second " +"argument. The method returns a :term:`module spec`, or ``None`` if the " +"module cannot be found." msgstr "" -#: ../../library/sys.rst:1318 +#: ../../library/sys.rst:1440 msgid ":class:`importlib.abc.MetaPathFinder`" msgstr ":class:`importlib.abc.MetaPathFinder`" -#: ../../library/sys.rst:1319 +#: ../../library/sys.rst:1441 msgid "" -"The abstract base class defining the interface of finder objects on :data:" -"`meta_path`." +"The abstract base class defining the interface of finder objects " +"on :data:`meta_path`." msgstr "" -#: ../../library/sys.rst:1321 +#: ../../library/sys.rst:1443 msgid ":class:`importlib.machinery.ModuleSpec`" msgstr ":class:`importlib.machinery.ModuleSpec`" -#: ../../library/sys.rst:1322 +#: ../../library/sys.rst:1444 msgid "" "The concrete class which :meth:`~importlib.abc.MetaPathFinder.find_spec` " "should return instances of." msgstr "" -#: ../../library/sys.rst:1328 +#: ../../library/sys.rst:1450 msgid "" -":term:`Module specs ` were introduced in Python 3.4, by :pep:" -"`451`." +":term:`Module specs ` were introduced in Python 3.4, " +"by :pep:`451`." msgstr "" -#: ../../library/sys.rst:1333 +#: ../../library/sys.rst:1455 msgid "" -"Removed the fallback that looked for a :meth:`!find_module` method if a :" -"data:`meta_path` entry didn't have a :meth:`~importlib.abc.MetaPathFinder." -"find_spec` method." +"Removed the fallback that looked for a :meth:`!find_module` method if " +"a :data:`meta_path` entry didn't have " +"a :meth:`~importlib.abc.MetaPathFinder.find_spec` method." msgstr "" -#: ../../library/sys.rst:1339 +#: ../../library/sys.rst:1461 msgid "" "This is a dictionary that maps module names to modules which have already " "been loaded. This can be manipulated to force reloading of modules and " @@ -1663,13 +1815,13 @@ msgid "" "other threads." msgstr "" -#: ../../library/sys.rst:1351 +#: ../../library/sys.rst:1473 msgid "" "The list of the original command line arguments passed to the Python " "executable." msgstr "" -#: ../../library/sys.rst:1354 +#: ../../library/sys.rst:1476 msgid "" "The elements of :data:`sys.orig_argv` are the arguments to the Python " "interpreter, while the elements of :data:`sys.argv` are the arguments to the " @@ -1677,68 +1829,68 @@ msgid "" "in :data:`sys.orig_argv` and missing from :data:`sys.argv`." msgstr "" -#: ../../library/sys.rst:1366 +#: ../../library/sys.rst:1488 msgid "" "A list of strings that specifies the search path for modules. Initialized " "from the environment variable :envvar:`PYTHONPATH`, plus an installation-" "dependent default." msgstr "" -#: ../../library/sys.rst:1370 +#: ../../library/sys.rst:1492 msgid "" "By default, as initialized upon program startup, a potentially unsafe path " "is prepended to :data:`sys.path` (*before* the entries inserted as a result " "of :envvar:`PYTHONPATH`):" msgstr "" -#: ../../library/sys.rst:1374 +#: ../../library/sys.rst:1496 msgid "" "``python -m module`` command line: prepend the current working directory." msgstr "" -#: ../../library/sys.rst:1376 +#: ../../library/sys.rst:1498 msgid "" "``python script.py`` command line: prepend the script's directory. If it's a " "symbolic link, resolve symbolic links." msgstr "" -#: ../../library/sys.rst:1378 +#: ../../library/sys.rst:1500 msgid "" "``python -c code`` and ``python`` (REPL) command lines: prepend an empty " "string, which means the current working directory." msgstr "" -#: ../../library/sys.rst:1381 +#: ../../library/sys.rst:1503 msgid "" "To not prepend this potentially unsafe path, use the :option:`-P` command " "line option or the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" -#: ../../library/sys.rst:1384 +#: ../../library/sys.rst:1506 msgid "" "A program is free to modify this list for its own purposes. Only strings " "should be added to :data:`sys.path`; all other data types are ignored during " "import." msgstr "" -#: ../../library/sys.rst:1390 +#: ../../library/sys.rst:1512 msgid "" -"Module :mod:`site` This describes how to use .pth files to extend :data:`sys." -"path`." +"Module :mod:`site` This describes how to use .pth files to " +"extend :data:`sys.path`." msgstr "" -#: ../../library/sys.rst:1395 +#: ../../library/sys.rst:1517 msgid "" -"A list of callables that take a path argument to try to create a :term:" -"`finder` for the path. If a finder can be created, it is to be returned by " -"the callable, else raise :exc:`ImportError`." +"A list of callables that take a path argument to try to create " +"a :term:`finder` for the path. If a finder can be created, it is to be " +"returned by the callable, else raise :exc:`ImportError`." msgstr "" -#: ../../library/sys.rst:1399 ../../library/sys.rst:1410 +#: ../../library/sys.rst:1521 ../../library/sys.rst:1532 msgid "Originally specified in :pep:`302`." msgstr "" -#: ../../library/sys.rst:1404 +#: ../../library/sys.rst:1526 msgid "" "A dictionary acting as a cache for :term:`finder` objects. The keys are " "paths that have been passed to :data:`sys.path_hooks` and the values are the " @@ -1746,174 +1898,189 @@ msgid "" "is found on :data:`sys.path_hooks` then ``None`` is stored." msgstr "" -#: ../../library/sys.rst:1415 +#: ../../library/sys.rst:1537 msgid "A string containing a platform identifier. Known values are:" msgstr "" -#: ../../library/sys.rst:1418 +#: ../../library/sys.rst:1540 msgid "System" msgstr "" -#: ../../library/sys.rst:1418 +#: ../../library/sys.rst:1540 msgid "``platform`` value" msgstr "" -#: ../../library/sys.rst:1420 +#: ../../library/sys.rst:1542 msgid "AIX" msgstr "AIX" -#: ../../library/sys.rst:1420 +#: ../../library/sys.rst:1542 msgid "``'aix'``" msgstr "``'aix'``" -#: ../../library/sys.rst:1421 +#: ../../library/sys.rst:1543 msgid "Android" msgstr "Android" -#: ../../library/sys.rst:1421 +#: ../../library/sys.rst:1543 msgid "``'android'``" msgstr "``'android'``" -#: ../../library/sys.rst:1422 +#: ../../library/sys.rst:1544 msgid "Emscripten" msgstr "Emscripten" -#: ../../library/sys.rst:1422 +#: ../../library/sys.rst:1544 msgid "``'emscripten'``" msgstr "``'emscripten'``" -#: ../../library/sys.rst:1423 +#: ../../library/sys.rst:1545 +msgid "FreeBSD" +msgstr "" + +#: ../../library/sys.rst:1545 +#, fuzzy +msgid "``'freebsd'``" +msgstr "``'android'``" + +#: ../../library/sys.rst:1546 msgid "iOS" msgstr "iOS" -#: ../../library/sys.rst:1423 +#: ../../library/sys.rst:1546 msgid "``'ios'``" msgstr "``'ios'``" -#: ../../library/sys.rst:1424 +#: ../../library/sys.rst:1547 msgid "Linux" msgstr "Linux" -#: ../../library/sys.rst:1424 +#: ../../library/sys.rst:1547 msgid "``'linux'``" msgstr "``'linux'``" -#: ../../library/sys.rst:1425 +#: ../../library/sys.rst:1548 msgid "macOS" msgstr "macOS" -#: ../../library/sys.rst:1425 +#: ../../library/sys.rst:1548 msgid "``'darwin'``" msgstr "``'darwin'``" -#: ../../library/sys.rst:1426 +#: ../../library/sys.rst:1549 msgid "Windows" msgstr "Windows" -#: ../../library/sys.rst:1426 +#: ../../library/sys.rst:1549 msgid "``'win32'``" msgstr "``'win32'``" -#: ../../library/sys.rst:1427 +#: ../../library/sys.rst:1550 msgid "Windows/Cygwin" msgstr "Windows/Cygwin" -#: ../../library/sys.rst:1427 +#: ../../library/sys.rst:1550 msgid "``'cygwin'``" msgstr "``'cygwin'``" -#: ../../library/sys.rst:1428 +#: ../../library/sys.rst:1551 msgid "WASI" msgstr "WASI" -#: ../../library/sys.rst:1428 +#: ../../library/sys.rst:1551 msgid "``'wasi'``" msgstr "``'wasi'``" -#: ../../library/sys.rst:1431 +#: ../../library/sys.rst:1554 msgid "" "On Unix systems not listed in the table, the value is the lowercased OS name " "as returned by ``uname -s``, with the first part of the version as returned " -"by ``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, *at the time " -"when Python was built*. Unless you want to test for a specific system " -"version, it is therefore recommended to use the following idiom::" +"by ``uname -r`` appended, e.g. ``'sunos5'``, *at the time when Python was " +"built*. Unless you want to test for a specific system version, it is " +"therefore recommended to use the following idiom::" msgstr "" -#: ../../library/sys.rst:1437 +#: ../../library/sys.rst:1560 msgid "" -"if sys.platform.startswith('freebsd'):\n" -" # FreeBSD-specific code here..." +"if sys.platform.startswith('sunos'):\n" +" # SunOS-specific code here..." msgstr "" -#: ../../library/sys.rst:1440 +#: ../../library/sys.rst:1563 msgid "" "On Linux, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``." msgstr "" -#: ../../library/sys.rst:1444 +#: ../../library/sys.rst:1567 msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``." msgstr "" -#: ../../library/sys.rst:1448 +#: ../../library/sys.rst:1571 msgid "" "On Android, :data:`sys.platform` now returns ``'android'`` rather than " "``'linux'``." msgstr "" -#: ../../library/sys.rst:1454 +#: ../../library/sys.rst:1575 +msgid "" +"On FreeBSD, :data:`sys.platform` doesn't contain the major version anymore. " +"It is always ``'freebsd'``, instead of ``'freebsd13'`` or ``'freebsd14'``." +msgstr "" + +#: ../../library/sys.rst:1581 msgid "" ":data:`os.name` has a coarser granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" -#: ../../library/sys.rst:1457 +#: ../../library/sys.rst:1584 msgid "" "The :mod:`platform` module provides detailed checks for the system's " "identity." msgstr "" -#: ../../library/sys.rst:1463 +#: ../../library/sys.rst:1590 msgid "" "Name of the platform-specific library directory. It is used to build the " "path of standard library and the paths of installed extension modules." msgstr "" -#: ../../library/sys.rst:1466 +#: ../../library/sys.rst:1593 msgid "" "It is equal to ``\"lib\"`` on most platforms. On Fedora and SuSE, it is " -"equal to ``\"lib64\"`` on 64-bit platforms which gives the following ``sys." -"path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" +"equal to ``\"lib64\"`` on 64-bit platforms which gives the following " +"``sys.path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" msgstr "" -#: ../../library/sys.rst:1470 +#: ../../library/sys.rst:1597 msgid "" "``/usr/lib64/pythonX.Y/``: Standard library (like ``os.py`` of the :mod:`os` " "module)" msgstr "" -#: ../../library/sys.rst:1472 +#: ../../library/sys.rst:1599 msgid "" "``/usr/lib64/pythonX.Y/lib-dynload/``: C extension modules of the standard " "library (like the :mod:`errno` module, the exact filename is platform " "specific)" msgstr "" -#: ../../library/sys.rst:1475 +#: ../../library/sys.rst:1602 msgid "" -"``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not :data:`sys." -"platlibdir`): Third-party modules" +"``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, " +"not :data:`sys.platlibdir`): Third-party modules" msgstr "" -#: ../../library/sys.rst:1477 +#: ../../library/sys.rst:1604 msgid "" "``/usr/lib64/pythonX.Y/site-packages/``: C extension modules of third-party " "packages" msgstr "" -#: ../../library/sys.rst:1485 +#: ../../library/sys.rst:1612 msgid "" "A string giving the site-specific directory prefix where the platform " "independent Python files are installed; on Unix, the default is :file:`/usr/" @@ -1922,14 +2089,15 @@ msgid "" "derived paths." msgstr "" -#: ../../library/sys.rst:1491 +#: ../../library/sys.rst:1620 msgid "" -"If a :ref:`virtual environment ` is in effect, this value will be " -"changed in ``site.py`` to point to the virtual environment. The value for " -"the Python installation will still be available, via :data:`base_prefix`." +"If a :ref:`virtual environment ` is in effect, this :data:`prefix` " +"will point to the virtual environment. The value for the Python installation " +"will still be available, via :data:`base_prefix`. Refer to :ref:`sys-path-" +"init-virtual-environments` for more information." msgstr "" -#: ../../library/sys.rst:1506 +#: ../../library/sys.rst:1644 msgid "" "Strings specifying the primary and secondary prompt of the interpreter. " "These are only defined if the interpreter is in interactive mode. Their " @@ -1939,25 +2107,25 @@ msgid "" "used to implement a dynamic prompt." msgstr "" -#: ../../library/sys.rst:1516 +#: ../../library/sys.rst:1654 msgid "" "Set the flags used by the interpreter for :c:func:`dlopen` calls, such as " "when the interpreter loads extension modules. Among other things, this will " "enable a lazy resolving of symbols when importing a module, if called as " "``sys.setdlopenflags(0)``. To share symbols across extension modules, call " "as ``sys.setdlopenflags(os.RTLD_GLOBAL)``. Symbolic names for the flag " -"values can be found in the :mod:`os` module (:samp:`RTLD_{xxx}` constants, e." -"g. :const:`os.RTLD_LAZY`)." +"values can be found in the :mod:`os` module (:samp:`RTLD_{xxx}` constants, " +"e.g. :const:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:1528 +#: ../../library/sys.rst:1666 msgid "" "Set the :ref:`integer string conversion length limitation " -"` used by this interpreter. See also :func:" -"`get_int_max_str_digits`." +"` used by this interpreter. See " +"also :func:`get_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:1540 +#: ../../library/sys.rst:1678 msgid "" "Set the system's profile function, which allows you to implement a Python " "source code profiler in Python. See chapter :ref:`profile` for more " @@ -1972,14 +2140,14 @@ msgid "" "in the profile function will cause itself unset." msgstr "" -#: ../../library/sys.rst:1552 +#: ../../library/sys.rst:1690 msgid "" -"The same tracing mechanism is used for :func:`!setprofile` as :func:" -"`settrace`. To trace calls with :func:`!setprofile` inside a tracing " -"function (e.g. in a debugger breakpoint), see :func:`call_tracing`." +"The same tracing mechanism is used for :func:`!setprofile` " +"as :func:`settrace`. To trace calls with :func:`!setprofile` inside a " +"tracing function (e.g. in a debugger breakpoint), see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1556 +#: ../../library/sys.rst:1694 msgid "" "Profile functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1987,71 +2155,71 @@ msgid "" "depends on the event type." msgstr "" -#: ../../library/sys.rst:1561 ../../library/sys.rst:1648 +#: ../../library/sys.rst:1699 ../../library/sys.rst:1786 msgid "The events have the following meaning:" msgstr "" -#: ../../library/sys.rst:1563 ../../library/sys.rst:1650 +#: ../../library/sys.rst:1701 ../../library/sys.rst:1788 msgid "``'call'``" msgstr "``'call'``" -#: ../../library/sys.rst:1564 +#: ../../library/sys.rst:1702 msgid "" "A function is called (or some other code block entered). The profile " "function is called; *arg* is ``None``." msgstr "" -#: ../../library/sys.rst:1567 ../../library/sys.rst:1665 +#: ../../library/sys.rst:1705 ../../library/sys.rst:1803 msgid "``'return'``" msgstr "``'return'``" -#: ../../library/sys.rst:1568 +#: ../../library/sys.rst:1706 msgid "" "A function (or other code block) is about to return. The profile function " "is called; *arg* is the value that will be returned, or ``None`` if the " "event is caused by an exception being raised." msgstr "" -#: ../../library/sys.rst:1572 +#: ../../library/sys.rst:1710 msgid "``'c_call'``" msgstr "``'c_call'``" -#: ../../library/sys.rst:1573 +#: ../../library/sys.rst:1711 msgid "" "A C function is about to be called. This may be an extension function or a " "built-in. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1576 +#: ../../library/sys.rst:1714 msgid "``'c_return'``" msgstr "``'c_return'``" -#: ../../library/sys.rst:1577 +#: ../../library/sys.rst:1715 msgid "A C function has returned. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1579 +#: ../../library/sys.rst:1717 msgid "``'c_exception'``" msgstr "``'c_exception'``" -#: ../../library/sys.rst:1580 +#: ../../library/sys.rst:1718 msgid "A C function has raised an exception. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1582 +#: ../../library/sys.rst:1720 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.setprofile``。" -#: ../../library/sys.rst:1587 +#: ../../library/sys.rst:1725 msgid "" "Set the maximum depth of the Python interpreter stack to *limit*. This " "limit prevents infinite recursion from causing an overflow of the C stack " "and crashing Python." msgstr "" -#: ../../library/sys.rst:1591 +#: ../../library/sys.rst:1729 msgid "" "The highest possible limit is platform-dependent. A user may need to set " "the limit higher when they have a program that requires deep recursion and a " @@ -2059,19 +2227,19 @@ msgid "" "because a too-high limit can lead to a crash." msgstr "" -#: ../../library/sys.rst:1596 +#: ../../library/sys.rst:1734 msgid "" -"If the new limit is too low at the current recursion depth, a :exc:" -"`RecursionError` exception is raised." +"If the new limit is too low at the current recursion depth, " +"a :exc:`RecursionError` exception is raised." msgstr "" -#: ../../library/sys.rst:1599 +#: ../../library/sys.rst:1737 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" -#: ../../library/sys.rst:1606 +#: ../../library/sys.rst:1744 msgid "" "Set the interpreter's thread switch interval (in seconds). This floating-" "point value determines the ideal duration of the \"timeslices\" allocated to " @@ -2082,24 +2250,24 @@ msgid "" "scheduler." msgstr "" -#: ../../library/sys.rst:1623 +#: ../../library/sys.rst:1761 msgid "" "Set the system's trace function, which allows you to implement a Python " "source code debugger in Python. The function is thread-specific; for a " "debugger to support multiple threads, it must register a trace function " -"using :func:`settrace` for each thread being debugged or use :func:" -"`threading.settrace`." +"using :func:`settrace` for each thread being debugged or " +"use :func:`threading.settrace`." msgstr "" -#: ../../library/sys.rst:1628 +#: ../../library/sys.rst:1766 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " -"*frame* is the :ref:`current stack frame `. *event* is a " -"string: ``'call'``, ``'line'``, ``'return'``, ``'exception'`` or " -"``'opcode'``. *arg* depends on the event type." +"*frame* is the current stack frame. *event* is a string: ``'call'``, " +"``'line'``, ``'return'``, ``'exception'`` or ``'opcode'``. *arg* depends on " +"the event type." msgstr "" -#: ../../library/sys.rst:1633 +#: ../../library/sys.rst:1771 msgid "" "The trace function is invoked (with *event* set to ``'call'``) whenever a " "new local scope is entered; it should return a reference to a local trace " @@ -2107,36 +2275,36 @@ msgid "" "traced." msgstr "" -#: ../../library/sys.rst:1638 +#: ../../library/sys.rst:1776 msgid "" "The local trace function should return a reference to itself, or to another " "function which would then be used as the local trace function for the scope." msgstr "" -#: ../../library/sys.rst:1641 +#: ../../library/sys.rst:1779 msgid "" "If there is any error occurred in the trace function, it will be unset, just " "like ``settrace(None)`` is called." msgstr "" -#: ../../library/sys.rst:1645 +#: ../../library/sys.rst:1783 msgid "" "Tracing is disabled while calling the trace function (e.g. a function set " "by :func:`!settrace`). For recursive tracing see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1651 +#: ../../library/sys.rst:1789 msgid "" "A function is called (or some other code block entered). The global trace " "function is called; *arg* is ``None``; the return value specifies the local " "trace function." msgstr "" -#: ../../library/sys.rst:1655 +#: ../../library/sys.rst:1793 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/sys.rst:1656 +#: ../../library/sys.rst:1794 msgid "" "The interpreter is about to execute a new line of code or re-execute the " "condition of a loop. The local trace function is called; *arg* is ``None``; " @@ -2146,7 +2314,7 @@ msgid "" "to :const:`False` on that :ref:`frame `." msgstr "" -#: ../../library/sys.rst:1666 +#: ../../library/sys.rst:1804 msgid "" "A function (or other code block) is about to return. The local trace " "function is called; *arg* is the value that will be returned, or ``None`` if " @@ -2154,62 +2322,62 @@ msgid "" "return value is ignored." msgstr "" -#: ../../library/sys.rst:1671 +#: ../../library/sys.rst:1809 msgid "``'exception'``" msgstr "``'exception'``" -#: ../../library/sys.rst:1672 +#: ../../library/sys.rst:1810 msgid "" "An exception has occurred. The local trace function is called; *arg* is a " "tuple ``(exception, value, traceback)``; the return value specifies the new " "local trace function." msgstr "" -#: ../../library/sys.rst:1676 +#: ../../library/sys.rst:1814 msgid "``'opcode'``" msgstr "``'opcode'``" -#: ../../library/sys.rst:1677 +#: ../../library/sys.rst:1815 msgid "" "The interpreter is about to execute a new opcode (see :mod:`dis` for opcode " "details). The local trace function is called; *arg* is ``None``; the return " "value specifies the new local trace function. Per-opcode events are not " -"emitted by default: they must be explicitly requested by setting :attr:" -"`~frame.f_trace_opcodes` to :const:`True` on the :ref:`frame `." +"emitted by default: they must be explicitly requested by " +"setting :attr:`~frame.f_trace_opcodes` to :const:`True` on the :ref:`frame " +"`." msgstr "" -#: ../../library/sys.rst:1684 +#: ../../library/sys.rst:1822 msgid "" "Note that as an exception is propagated down the chain of callers, an " "``'exception'`` event is generated at each level." msgstr "" -#: ../../library/sys.rst:1687 +#: ../../library/sys.rst:1825 msgid "" "For more fine-grained usage, it's possible to set a trace function by " "assigning ``frame.f_trace = tracefunc`` explicitly, rather than relying on " "it being set indirectly via the return value from an already installed trace " "function. This is also required for activating the trace function on the " "current frame, which :func:`settrace` doesn't do. Note that in order for " -"this to work, a global tracing function must have been installed with :func:" -"`settrace` in order to enable the runtime tracing machinery, but it doesn't " -"need to be the same tracing function (e.g. it could be a low overhead " -"tracing function that simply returns ``None`` to disable itself immediately " -"on each frame)." +"this to work, a global tracing function must have been installed " +"with :func:`settrace` in order to enable the runtime tracing machinery, but " +"it doesn't need to be the same tracing function (e.g. it could be a low " +"overhead tracing function that simply returns ``None`` to disable itself " +"immediately on each frame)." msgstr "" -#: ../../library/sys.rst:1698 +#: ../../library/sys.rst:1836 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" -#: ../../library/sys.rst:1700 +#: ../../library/sys.rst:1838 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.settrace``。" -#: ../../library/sys.rst:1704 +#: ../../library/sys.rst:1842 msgid "" "The :func:`settrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -2217,51 +2385,51 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:1711 +#: ../../library/sys.rst:1849 msgid "" -"``'opcode'`` event type added; :attr:`~frame.f_trace_lines` and :attr:" -"`~frame.f_trace_opcodes` attributes added to frames" +"``'opcode'`` event type added; :attr:`~frame.f_trace_lines` " +"and :attr:`~frame.f_trace_opcodes` attributes added to frames" msgstr "" -#: ../../library/sys.rst:1716 +#: ../../library/sys.rst:1854 msgid "" -"Accepts two optional keyword arguments which are callables that accept an :" -"term:`asynchronous generator iterator` as an argument. The *firstiter* " +"Accepts two optional keyword arguments which are callables that accept " +"an :term:`asynchronous generator iterator` as an argument. The *firstiter* " "callable will be called when an asynchronous generator is iterated for the " "first time. The *finalizer* will be called when an asynchronous generator is " "about to be garbage collected." msgstr "" -#: ../../library/sys.rst:1722 +#: ../../library/sys.rst:1860 msgid "" -"Raises an :ref:`auditing event ` ``sys." -"set_asyncgen_hooks_firstiter`` with no arguments." +"Raises an :ref:`auditing event ` " +"``sys.set_asyncgen_hooks_firstiter`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." -"set_asyncgen_hooks_firstiter``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` " +"``sys.set_asyncgen_hooks_firstiter``。" -#: ../../library/sys.rst:1724 +#: ../../library/sys.rst:1862 msgid "" -"Raises an :ref:`auditing event ` ``sys." -"set_asyncgen_hooks_finalizer`` with no arguments." +"Raises an :ref:`auditing event ` " +"``sys.set_asyncgen_hooks_finalizer`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." -"set_asyncgen_hooks_finalizer``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` " +"``sys.set_asyncgen_hooks_finalizer``。" -#: ../../library/sys.rst:1726 +#: ../../library/sys.rst:1864 msgid "" "Two auditing events are raised because the underlying API consists of two " "calls, each of which must raise its own event." msgstr "" -#: ../../library/sys.rst:1729 +#: ../../library/sys.rst:1867 msgid "" "See :pep:`525` for more details, and for a reference example of a " -"*finalizer* method see the implementation of ``asyncio.Loop." -"shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" +"*finalizer* method see the implementation of " +"``asyncio.Loop.shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" msgstr "" -#: ../../library/sys.rst:1741 +#: ../../library/sys.rst:1879 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " @@ -2270,111 +2438,155 @@ msgid "" "disabled, ``cr_origin`` will be ``None``." msgstr "" -#: ../../library/sys.rst:1748 +#: ../../library/sys.rst:1886 msgid "" "To enable, pass a *depth* value greater than zero; this sets the number of " -"frames whose information will be captured. To disable, pass set *depth* to " -"zero." +"frames whose information will be captured. To disable, set *depth* to zero." msgstr "" -#: ../../library/sys.rst:1752 +#: ../../library/sys.rst:1890 msgid "This setting is thread-specific." msgstr "" -#: ../../library/sys.rst:1762 +#: ../../library/sys.rst:1900 msgid "" "Activate the stack profiler trampoline *backend*. The only supported backend " "is ``\"perf\"``." msgstr "" -#: ../../library/sys.rst:1771 +#: ../../library/sys.rst:1903 +msgid "Stack trampolines cannot be activated if the JIT is active." +msgstr "" + +#: ../../library/sys.rst:1911 msgid ":ref:`perf_profiling`" msgstr ":ref:`perf_profiling`" -#: ../../library/sys.rst:1772 +#: ../../library/sys.rst:1912 msgid "https://perf.wiki.kernel.org" msgstr "https://perf.wiki.kernel.org" -#: ../../library/sys.rst:1776 +#: ../../library/sys.rst:1916 msgid "Deactivate the current stack profiler trampoline backend." msgstr "" -#: ../../library/sys.rst:1778 +#: ../../library/sys.rst:1918 msgid "If no stack profiler is activated, this function has no effect." msgstr "" -#: ../../library/sys.rst:1786 +#: ../../library/sys.rst:1926 msgid "Return ``True`` if a stack profiler trampoline is active." msgstr "" -#: ../../library/sys.rst:1794 +#: ../../library/sys.rst:1935 +msgid "" +"Executes *script*, a file containing Python code in the remote process with " +"the given *pid*." +msgstr "" + +#: ../../library/sys.rst:1938 +msgid "" +"This function returns immediately, and the code will be executed by the " +"target process's main thread at the next available opportunity, similarly to " +"how signals are handled. There is no interface to determine when the code " +"has been executed. The caller is responsible for making sure that the file " +"still exists whenever the remote process tries to read it and that it hasn't " +"been overwritten." +msgstr "" + +#: ../../library/sys.rst:1945 +msgid "" +"The remote process must be running a CPython interpreter of the same major " +"and minor version as the local process. If either the local or remote " +"interpreter is pre-release (alpha, beta, or release candidate) then the " +"local and remote interpreters must be the same exact version." +msgstr "" + +#: ../../library/sys.rst:1950 ../../library/sys.rst:1952 +msgid "" +"When the code is executed in the remote process, an :ref:`auditing event " +"` ``sys.remote_exec`` is raised with the *pid* and the path to the " +"script file. This event is raised in the process that " +"called :func:`sys.remote_exec`." +msgstr "" + +#: ../../library/sys.rst:1957 ../../library/sys.rst:1959 +msgid "" +"When the script is executed in the remote process, an :ref:`auditing event " +"` ``cpython.remote_debugger_script`` is raised with the path in " +"the remote process. This event is raised in the remote process, not the one " +"that called :func:`sys.remote_exec`." +msgstr "" + +#: ../../library/sys.rst:1972 msgid "" "Changes the :term:`filesystem encoding and error handler` to 'mbcs' and " "'replace' respectively, for consistency with versions of Python prior to 3.6." msgstr "" -#: ../../library/sys.rst:1798 +#: ../../library/sys.rst:1976 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" -#: ../../library/sys.rst:1801 +#: ../../library/sys.rst:1979 msgid "" -"See also :func:`sys.getfilesystemencoding` and :func:`sys." -"getfilesystemencodeerrors`." +"See also :func:`sys.getfilesystemencoding` " +"and :func:`sys.getfilesystemencodeerrors`." msgstr "" -#: ../../library/sys.rst:1807 +#: ../../library/sys.rst:1985 msgid "" "Changing the filesystem encoding after Python startup is risky because the " "old fsencoding or paths encoded by the old fsencoding may be cached " "somewhere. Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1811 +#: ../../library/sys.rst:1989 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../library/sys.rst:1814 +#: ../../library/sys.rst:1992 msgid "Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1821 +#: ../../library/sys.rst:1999 msgid "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -#: ../../library/sys.rst:1824 +#: ../../library/sys.rst:2002 msgid "" -"``stdin`` is used for all interactive input (including calls to :func:" -"`input`);" +"``stdin`` is used for all interactive input (including calls " +"to :func:`input`);" msgstr "" -#: ../../library/sys.rst:1826 +#: ../../library/sys.rst:2004 msgid "" "``stdout`` is used for the output of :func:`print` and :term:`expression` " "statements and for the prompts of :func:`input`;" msgstr "" -#: ../../library/sys.rst:1828 +#: ../../library/sys.rst:2006 msgid "The interpreter's own prompts and its error messages go to ``stderr``." msgstr "" -#: ../../library/sys.rst:1830 +#: ../../library/sys.rst:2008 msgid "" "These streams are regular :term:`text files ` like those returned " "by the :func:`open` function. Their parameters are chosen as follows:" msgstr "" -#: ../../library/sys.rst:1834 +#: ../../library/sys.rst:2012 msgid "" -"The encoding and error handling are is initialized from :c:member:`PyConfig." -"stdio_encoding` and :c:member:`PyConfig.stdio_errors`." +"The encoding and error handling are is initialized " +"from :c:member:`PyConfig.stdio_encoding` " +"and :c:member:`PyConfig.stdio_errors`." msgstr "" -#: ../../library/sys.rst:1837 +#: ../../library/sys.rst:2015 msgid "" "On Windows, UTF-8 is used for the console device. Non-character devices " "such as disk files and pipes use the system locale encoding (i.e. the ANSI " @@ -2385,44 +2597,45 @@ msgid "" "initially attached to a console." msgstr "" -#: ../../library/sys.rst:1846 +#: ../../library/sys.rst:2024 msgid "" "The special behaviour of the console can be overridden by setting the " "environment variable PYTHONLEGACYWINDOWSSTDIO before starting Python. In " "that case, the console codepages are used as for any other character device." msgstr "" -#: ../../library/sys.rst:1851 +#: ../../library/sys.rst:2029 msgid "" -"Under all platforms, you can override the character encoding by setting the :" -"envvar:`PYTHONIOENCODING` environment variable before starting Python or by " -"using the new :option:`-X` ``utf8`` command line option and :envvar:" -"`PYTHONUTF8` environment variable. However, for the Windows console, this " -"only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." +"Under all platforms, you can override the character encoding by setting " +"the :envvar:`PYTHONIOENCODING` environment variable before starting Python " +"or by using the new :option:`-X` ``utf8`` command line option " +"and :envvar:`PYTHONUTF8` environment variable. However, for the Windows " +"console, this only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also " +"set." msgstr "" -#: ../../library/sys.rst:1858 +#: ../../library/sys.rst:2036 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" "buffered in both cases. You can make both streams unbuffered by passing " -"the :option:`-u` command-line option or setting the :envvar:" -"`PYTHONUNBUFFERED` environment variable." +"the :option:`-u` command-line option or setting " +"the :envvar:`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../library/sys.rst:1864 +#: ../../library/sys.rst:2042 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" -#: ../../library/sys.rst:1870 +#: ../../library/sys.rst:2048 msgid "" "To write or read binary data from/to the standard streams, use the " "underlying binary :data:`~io.TextIOBase.buffer` object. For example, to " "write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``." msgstr "" -#: ../../library/sys.rst:1874 +#: ../../library/sys.rst:2052 msgid "" "However, if you are writing a library (and do not control in which context " "its code will be executed), be aware that the standard streams may be " @@ -2430,7 +2643,7 @@ msgid "" "support the :attr:`!buffer` attribute." msgstr "" -#: ../../library/sys.rst:1884 +#: ../../library/sys.rst:2062 msgid "" "These objects contain the original values of ``stdin``, ``stderr`` and " "``stdout`` at the start of the program. They are used during finalization, " @@ -2438,7 +2651,7 @@ msgid "" "``sys.std*`` object has been redirected." msgstr "" -#: ../../library/sys.rst:1889 +#: ../../library/sys.rst:2067 msgid "" "It can also be used to restore the actual files to known working file " "objects in case they have been overwritten with a broken object. However, " @@ -2446,7 +2659,7 @@ msgid "" "before replacing it, and restore the saved object." msgstr "" -#: ../../library/sys.rst:1895 +#: ../../library/sys.rst:2073 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2454,12 +2667,12 @@ msgid "" "to a console and Python apps started with :program:`pythonw`." msgstr "" -#: ../../library/sys.rst:1903 +#: ../../library/sys.rst:2081 msgid "" "A frozenset of strings containing the names of standard library modules." msgstr "" -#: ../../library/sys.rst:1905 +#: ../../library/sys.rst:2083 msgid "" "It is the same on all platforms. Modules which are not available on some " "platforms and modules disabled at Python build are also listed. All module " @@ -2467,7 +2680,7 @@ msgid "" "modules are excluded." msgstr "" -#: ../../library/sys.rst:1910 +#: ../../library/sys.rst:2088 msgid "" "For packages, only the main package is listed: sub-packages and sub-modules " "are not listed. For example, the ``email`` package is listed, but the " @@ -2475,60 +2688,60 @@ msgid "" "listed." msgstr "" -#: ../../library/sys.rst:1915 +#: ../../library/sys.rst:2093 msgid "See also the :data:`sys.builtin_module_names` list." msgstr "另請參閱 :attr:`sys.builtin_module_names` 清單。" -#: ../../library/sys.rst:1922 +#: ../../library/sys.rst:2100 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "" -#: ../../library/sys.rst:1927 +#: ../../library/sys.rst:2105 msgid "The name of the thread implementation:" msgstr "" -#: ../../library/sys.rst:1929 +#: ../../library/sys.rst:2107 msgid "``\"nt\"``: Windows threads" msgstr "``\"nt\"``: Windows 執行緒" -#: ../../library/sys.rst:1930 +#: ../../library/sys.rst:2108 msgid "``\"pthread\"``: POSIX threads" msgstr "``\"pthread\"``: POSIX 執行緒" -#: ../../library/sys.rst:1931 +#: ../../library/sys.rst:2109 msgid "" "``\"pthread-stubs\"``: stub POSIX threads (on WebAssembly platforms without " "threading support)" msgstr "" -#: ../../library/sys.rst:1933 +#: ../../library/sys.rst:2111 msgid "``\"solaris\"``: Solaris threads" msgstr "" -#: ../../library/sys.rst:1937 +#: ../../library/sys.rst:2115 msgid "The name of the lock implementation:" msgstr "" -#: ../../library/sys.rst:1939 +#: ../../library/sys.rst:2117 msgid "``\"semaphore\"``: a lock uses a semaphore" msgstr "" -#: ../../library/sys.rst:1940 +#: ../../library/sys.rst:2118 msgid "``\"mutex+cond\"``: a lock uses a mutex and a condition variable" msgstr "" -#: ../../library/sys.rst:1941 +#: ../../library/sys.rst:2119 msgid "``None`` if this information is unknown" msgstr "為 ``None`` 表示此資訊未知" -#: ../../library/sys.rst:1945 +#: ../../library/sys.rst:2123 msgid "" "The name and version of the thread library. It is a string, or ``None`` if " "this information is unknown." msgstr "" -#: ../../library/sys.rst:1953 +#: ../../library/sys.rst:2131 msgid "" "When this variable is set to an integer value, it determines the maximum " "number of levels of traceback information printed when an unhandled " @@ -2537,73 +2750,73 @@ msgid "" "are printed." msgstr "" -#: ../../library/sys.rst:1961 +#: ../../library/sys.rst:2139 msgid "Handle an unraisable exception." msgstr "處理一個不可被引發的例外。" -#: ../../library/sys.rst:1963 +#: ../../library/sys.rst:2141 msgid "" "Called when an exception has occurred but there is no way for Python to " "handle it. For example, when a destructor raises an exception or during " "garbage collection (:func:`gc.collect`)." msgstr "" -#: ../../library/sys.rst:1967 +#: ../../library/sys.rst:2145 msgid "The *unraisable* argument has the following attributes:" msgstr "*unraisable* 引數具有以下屬性:" -#: ../../library/sys.rst:1969 +#: ../../library/sys.rst:2147 msgid ":attr:`!exc_type`: Exception type." msgstr ":attr:`!exc_type`: 例外型別。" -#: ../../library/sys.rst:1970 +#: ../../library/sys.rst:2148 msgid ":attr:`!exc_value`: Exception value, can be ``None``." msgstr ":attr:`!exc_value`: 例外值,可以為 ``None``。" -#: ../../library/sys.rst:1971 +#: ../../library/sys.rst:2149 msgid ":attr:`!exc_traceback`: Exception traceback, can be ``None``." msgstr ":attr:`!exc_traceback`: 例外追蹤,可以為 ``None``。" -#: ../../library/sys.rst:1972 +#: ../../library/sys.rst:2150 msgid ":attr:`!err_msg`: Error message, can be ``None``." msgstr ":attr:`!err_msg`: 錯誤訊息,可以為 ``None``。" -#: ../../library/sys.rst:1973 +#: ../../library/sys.rst:2151 msgid ":attr:`!object`: Object causing the exception, can be ``None``." msgstr ":attr:`!object`: 導致例外的物件,可以為 ``None``。" -#: ../../library/sys.rst:1975 +#: ../../library/sys.rst:2153 msgid "" "The default hook formats :attr:`!err_msg` and :attr:`!object` as: " -"``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message if :" -"attr:`!err_msg` is ``None``." +"``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message " +"if :attr:`!err_msg` is ``None``." msgstr "" -#: ../../library/sys.rst:1979 +#: ../../library/sys.rst:2157 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" -#: ../../library/sys.rst:1984 +#: ../../library/sys.rst:2162 msgid ":func:`excepthook` which handles uncaught exceptions." msgstr "處理未被捕捉到例外的 :func:`excepthook`。" -#: ../../library/sys.rst:1988 +#: ../../library/sys.rst:2166 msgid "" "Storing :attr:`!exc_value` using a custom hook can create a reference cycle. " "It should be cleared explicitly to break the reference cycle when the " "exception is no longer needed." msgstr "" -#: ../../library/sys.rst:1992 +#: ../../library/sys.rst:2170 msgid "" "Storing :attr:`!object` using a custom hook can resurrect it if it is set to " "an object which is being finalized. Avoid storing :attr:`!object` after the " "custom hook completes to avoid resurrecting objects." msgstr "" -#: ../../library/sys.rst:1996 ../../library/sys.rst:1998 +#: ../../library/sys.rst:2174 ../../library/sys.rst:2176 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments *hook*, " "*unraisable* when an exception that cannot be handled occurs. The " @@ -2611,7 +2824,7 @@ msgid "" "hook has been set, *hook* may be ``None``." msgstr "" -#: ../../library/sys.rst:2007 +#: ../../library/sys.rst:2185 msgid "" "A string containing the version number of the Python interpreter plus " "additional information on the build number and compiler used. This string " @@ -2620,35 +2833,41 @@ msgid "" "functions provided by the :mod:`platform` module." msgstr "" -#: ../../library/sys.rst:2016 +#: ../../library/sys.rst:2194 msgid "" -"The C API version for this interpreter. Programmers may find this useful " -"when debugging version conflicts between Python and extension modules." +"The C API version, equivalent to the C macro :c:macro:`PYTHON_API_VERSION`. " +"Defined for backwards compatibility." msgstr "" -#: ../../library/sys.rst:2022 +#: ../../library/sys.rst:2197 +msgid "" +"Currently, this constant is not updated in new Python versions, and is not " +"useful for versioning. This may change in the future." +msgstr "" + +#: ../../library/sys.rst:2203 msgid "" "A tuple containing the five components of the version number: *major*, " "*minor*, *micro*, *releaselevel*, and *serial*. All values except " "*releaselevel* are integers; the release level is ``'alpha'``, ``'beta'``, " "``'candidate'``, or ``'final'``. The ``version_info`` value corresponding " "to the Python version 2.0 is ``(2, 0, 0, 'final', 0)``. The components can " -"also be accessed by name, so ``sys.version_info[0]`` is equivalent to ``sys." -"version_info.major`` and so on." +"also be accessed by name, so ``sys.version_info[0]`` is equivalent to " +"``sys.version_info.major`` and so on." msgstr "" -#: ../../library/sys.rst:2030 +#: ../../library/sys.rst:2211 msgid "Added named component attributes." msgstr "新增了附名的元件屬性。" -#: ../../library/sys.rst:2035 +#: ../../library/sys.rst:2216 msgid "" "This is an implementation detail of the warnings framework; do not modify " "this value. Refer to the :mod:`warnings` module for more information on the " "warnings framework." msgstr "" -#: ../../library/sys.rst:2042 +#: ../../library/sys.rst:2223 msgid "" "The version number used to form registry keys on Windows platforms. This is " "stored as string resource 1000 in the Python DLL. The value is normally the " @@ -2657,20 +2876,20 @@ msgid "" "has no effect on the registry keys used by Python." msgstr "" -#: ../../library/sys.rst:2054 +#: ../../library/sys.rst:2235 msgid "" "Namespace containing functions and constants for register callbacks and " "controlling monitoring events. See :mod:`sys.monitoring` for details." msgstr "" -#: ../../library/sys.rst:2060 +#: ../../library/sys.rst:2241 msgid "" "A dictionary of the various implementation-specific flags passed through " "the :option:`-X` command-line option. Option names are either mapped to " "their values, if given explicitly, or to :const:`True`. Example:" msgstr "" -#: ../../library/sys.rst:2064 +#: ../../library/sys.rst:2245 msgid "" "$ ./python -Xa=b -Xc\n" "Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)\n" @@ -2690,18 +2909,18 @@ msgstr "" ">>> sys._xoptions\n" "{'a': 'b', 'c': True}" -#: ../../library/sys.rst:2076 +#: ../../library/sys.rst:2257 msgid "" "This is a CPython-specific way of accessing options passed through :option:`-" "X`. Other implementations may export them through other means, or not at " "all." msgstr "" -#: ../../library/sys.rst:2084 +#: ../../library/sys.rst:2265 msgid "Citations" msgstr "引用" -#: ../../library/sys.rst:2085 +#: ../../library/sys.rst:2266 msgid "" "ISO/IEC 9899:1999. \"Programming languages -- C.\" A public draft of this " "standard is available at https://www.open-std.org/jtc1/sc22/wg14/www/docs/" @@ -2714,58 +2933,58 @@ msgstr "" msgid "auditing" msgstr "" -#: ../../library/sys.rst:462 +#: ../../library/sys.rst:461 msgid "object" msgstr "object(物件)" -#: ../../library/sys.rst:462 +#: ../../library/sys.rst:461 msgid "traceback" msgstr "traceback" -#: ../../library/sys.rst:956 ../../library/sys.rst:1536 +#: ../../library/sys.rst:990 ../../library/sys.rst:1674 msgid "profile function" msgstr "" -#: ../../library/sys.rst:956 ../../library/sys.rst:1536 +#: ../../library/sys.rst:990 ../../library/sys.rst:1674 msgid "profiler" msgstr "" -#: ../../library/sys.rst:965 ../../library/sys.rst:1619 +#: ../../library/sys.rst:999 ../../library/sys.rst:1757 msgid "trace function" msgstr "" -#: ../../library/sys.rst:965 ../../library/sys.rst:1619 +#: ../../library/sys.rst:999 ../../library/sys.rst:1757 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/sys.rst:1364 +#: ../../library/sys.rst:1486 msgid "module" msgstr "module(模組)" -#: ../../library/sys.rst:1364 +#: ../../library/sys.rst:1486 msgid "search" msgstr "search(搜尋)" -#: ../../library/sys.rst:1364 +#: ../../library/sys.rst:1486 msgid "path" msgstr "path(路徑)" -#: ../../library/sys.rst:1500 +#: ../../library/sys.rst:1638 msgid "interpreter prompts" msgstr "interpreter prompts(直譯器提示)" -#: ../../library/sys.rst:1500 +#: ../../library/sys.rst:1638 msgid "prompts, interpreter" msgstr "prompts, interpreter(提示、直譯器)" -#: ../../library/sys.rst:1500 +#: ../../library/sys.rst:1638 msgid ">>>" msgstr ">>>" -#: ../../library/sys.rst:1500 +#: ../../library/sys.rst:1638 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/sys.rst:1500 +#: ../../library/sys.rst:1638 msgid "..." msgstr "..." diff --git a/library/sys_path_init.po b/library/sys_path_init.po index 060912a646e..9a18a6ce115 100644 --- a/library/sys_path_init.po +++ b/library/sys_path_init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "" msgid "" "The first entry in the module search path is the directory that contains the " "input script, if there is one. Otherwise, the first entry is the current " -"directory, which is the case when executing the interactive shell, a :option:" -"`-c` command, or :option:`-m` module." +"directory, which is the case when executing the interactive shell, " +"a :option:`-c` command, or :option:`-m` module." msgstr "" #: ../../library/sys_path_init.rst:14 @@ -73,69 +73,103 @@ msgstr "" #: ../../library/sys_path_init.rst:37 msgid "" "Once ``home`` is determined, the ``prefix`` directory is found by first " -"looking for :file:`python{majorversion}{minorversion}.zip` (``python311." -"zip``). On Windows the zip archive is searched for in ``home`` and on Unix " -"the archive is expected to be in :file:`lib`. Note that the expected zip " -"archive location is added to the module search path even if the archive does " -"not exist. If no archive was found, Python on Windows will continue the " -"search for ``prefix`` by looking for :file:`Lib\\\\os.py`. Python on Unix " -"will look for :file:`lib/python{majorversion}.{minorversion}/os.py` (``lib/" -"python3.11/os.py``). On Windows ``prefix`` and ``exec_prefix`` are the same, " -"however on other platforms :file:`lib/python{majorversion}.{minorversion}/" -"lib-dynload` (``lib/python3.11/lib-dynload``) is searched for and used as an " -"anchor for ``exec_prefix``. On some platforms :file:`lib` may be :file:" -"`lib64` or another value, see :data:`sys.platlibdir` and :envvar:" -"`PYTHONPLATLIBDIR`." +"looking for :file:`python{majorversion}{minorversion}.zip` " +"(``python311.zip``). On Windows the zip archive is searched for in ``home`` " +"and on Unix the archive is expected to be in :file:`lib`. Note that the " +"expected zip archive location is added to the module search path even if the " +"archive does not exist. If no archive was found, Python on Windows will " +"continue the search for ``prefix`` by looking for :file:`Lib\\\\os.py`. " +"Python on Unix will look for :file:`lib/python{majorversion}.{minorversion}/" +"os.py` (``lib/python3.11/os.py``). On Windows ``prefix`` and ``exec_prefix`` " +"are the same, however on other platforms :file:`lib/python{majorversion}." +"{minorversion}/lib-dynload` (``lib/python3.11/lib-dynload``) is searched for " +"and used as an anchor for ``exec_prefix``. On some platforms :file:`lib` may " +"be :file:`lib64` or another value, see :data:`sys.platlibdir` " +"and :envvar:`PYTHONPLATLIBDIR`." msgstr "" #: ../../library/sys_path_init.rst:50 msgid "" -"Once found, ``prefix`` and ``exec_prefix`` are available at :data:`sys." -"prefix` and :data:`sys.exec_prefix` respectively." +"Once found, ``prefix`` and ``exec_prefix`` are available " +"at :data:`sys.base_prefix` and :data:`sys.base_exec_prefix` respectively." msgstr "" #: ../../library/sys_path_init.rst:53 msgid "" +"If :envvar:`PYTHONHOME` is not set, and a ``pyvenv.cfg`` file is found " +"alongside the main executable, or in its parent " +"directory, :data:`sys.prefix` and :data:`sys.exec_prefix` get set to the " +"directory containing ``pyvenv.cfg``, otherwise they are set to the same " +"value as :data:`sys.base_prefix` and :data:`sys.base_exec_prefix`, " +"respectively. This is used by :ref:`sys-path-init-virtual-environments`." +msgstr "" + +#: ../../library/sys_path_init.rst:60 +msgid "" "Finally, the :mod:`site` module is processed and :file:`site-packages` " "directories are added to the module search path. A common way to customize " "the search path is to create :mod:`sitecustomize` or :mod:`usercustomize` " "modules as described in the :mod:`site` module documentation." msgstr "" -#: ../../library/sys_path_init.rst:60 +#: ../../library/sys_path_init.rst:67 msgid "" -"Certain command line options may further affect path calculations. See :" -"option:`-E`, :option:`-I`, :option:`-s` and :option:`-S` for further details." +"Certain command line options may further affect path calculations. " +"See :option:`-E`, :option:`-I`, :option:`-s` and :option:`-S` for further " +"details." msgstr "" -#: ../../library/sys_path_init.rst:64 -msgid "Virtual environments" +#: ../../library/sys_path_init.rst:72 +msgid "" +":data:`sys.prefix` and :data:`sys.exec_prefix` are now set to the " +"``pyvenv.cfg`` directory during the path initialization. This was previously " +"done by :mod:`site`, therefore affected by :option:`-S`." +msgstr "" + +#: ../../library/sys_path_init.rst:79 +#, fuzzy +msgid "Virtual Environments" msgstr "虛擬環境" -#: ../../library/sys_path_init.rst:66 +#: ../../library/sys_path_init.rst:81 msgid "" -"If Python is run in a virtual environment (as described at :ref:`tut-venv`) " -"then ``prefix`` and ``exec_prefix`` are specific to the virtual environment." +"Virtual environments place a ``pyvenv.cfg`` file in their prefix, which " +"causes :data:`sys.prefix` and :data:`sys.exec_prefix` to point to them, " +"instead of the base installation." msgstr "" -#: ../../library/sys_path_init.rst:69 +#: ../../library/sys_path_init.rst:85 msgid "" -"If a ``pyvenv.cfg`` file is found alongside the main executable, or in the " -"directory one level above the executable, the following variations apply:" +"The ``prefix`` and ``exec_prefix`` values of the base installation are " +"available at :data:`sys.base_prefix` and :data:`sys.base_exec_prefix`." msgstr "" -#: ../../library/sys_path_init.rst:72 +#: ../../library/sys_path_init.rst:88 +msgid "" +"As well as being used as a marker to identify virtual environments, " +"``pyvenv.cfg`` may also be used to configure the :mod:`site` initialization. " +"Please refer to :mod:`site`'s :ref:`virtual environments documentation `." +msgstr "" + +#: ../../library/sys_path_init.rst:95 +msgid ":envvar:`PYTHONHOME` overrides the ``pyvenv.cfg`` detection." +msgstr "" + +#: ../../library/sys_path_init.rst:99 msgid "" -"If ``home`` is an absolute path and :envvar:`PYTHONHOME` is not set, this " -"path is used instead of the path to the main executable when deducing " -"``prefix`` and ``exec_prefix``." +"There are other ways how \"virtual environments\" could be implemented, this " +"documentation refers implementations based on the ``pyvenv.cfg`` mechanism, " +"such as :mod:`venv`. Most virtual environment implementations follow the " +"model set by :mod:`venv`, but there may be exotic implementations that " +"diverge from it." msgstr "" -#: ../../library/sys_path_init.rst:77 +#: ../../library/sys_path_init.rst:106 msgid "_pth files" msgstr "_pth 檔案" -#: ../../library/sys_path_init.rst:79 +#: ../../library/sys_path_init.rst:108 msgid "" "To completely override :data:`sys.path` create a ``._pth`` file with the " "same name as the shared library or executable (``python._pth`` or " @@ -146,7 +180,7 @@ msgid "" "allows paths to be restricted for any program loading the runtime if desired." msgstr "" -#: ../../library/sys_path_init.rst:87 +#: ../../library/sys_path_init.rst:116 msgid "" "When the file exists, all registry and environment variables are ignored, " "isolated mode is enabled, and :mod:`site` is not imported unless one line in " @@ -156,28 +190,28 @@ msgid "" "arbitrary code cannot be specified." msgstr "" -#: ../../library/sys_path_init.rst:94 +#: ../../library/sys_path_init.rst:123 msgid "" "Note that ``.pth`` files (without leading underscore) will be processed " "normally by the :mod:`site` module when ``import site`` has been specified." msgstr "" -#: ../../library/sys_path_init.rst:98 +#: ../../library/sys_path_init.rst:127 msgid "Embedded Python" msgstr "" -#: ../../library/sys_path_init.rst:100 +#: ../../library/sys_path_init.rst:129 msgid "" -"If Python is embedded within another application :c:func:" -"`Py_InitializeFromConfig` and the :c:type:`PyConfig` structure can be used " -"to initialize Python. The path specific details are described at :ref:`init-" -"path-config`." +"If Python is embedded within another " +"application :c:func:`Py_InitializeFromConfig` and the :c:type:`PyConfig` " +"structure can be used to initialize Python. The path specific details are " +"described at :ref:`init-path-config`." msgstr "" -#: ../../library/sys_path_init.rst:106 +#: ../../library/sys_path_init.rst:135 msgid ":ref:`windows_finding_modules` for detailed Windows notes." msgstr ":ref:`windows_finding_modules` 有關於 Windows 的詳細資訊。" -#: ../../library/sys_path_init.rst:107 +#: ../../library/sys_path_init.rst:136 msgid ":ref:`using-on-unix` for Unix details." msgstr ":ref:`using-on-unix` 有關於 Unix 的詳細資訊。" diff --git a/library/tarfile.po b/library/tarfile.po index 9442373297d..1195df69ab0 100644 --- a/library/tarfile.po +++ b/library/tarfile.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-21 00:18+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -40,8 +40,8 @@ msgstr "" #: ../../library/tarfile.rst:21 msgid "" -"reads and writes :mod:`gzip`, :mod:`bz2` and :mod:`lzma` compressed archives " -"if the respective modules are available." +"reads and writes :mod:`gzip`, :mod:`bz2`, :mod:`compression.zstd`, " +"and :mod:`lzma` compressed archives if the respective modules are available." msgstr "" #: ../../library/tarfile.rst:24 @@ -74,19 +74,30 @@ msgstr "新增對 :mod:`lzma` 壓縮的支援。" msgid "" "Archives are extracted using a :ref:`filter `, " "which makes it possible to either limit surprising/dangerous features, or to " -"acknowledge that they are expected and the archive is fully trusted. By " -"default, archives are fully trusted, but this default is deprecated and " -"slated to change in Python 3.14." +"acknowledge that they are expected and the archive is fully trusted." msgstr "" -#: ../../library/tarfile.rst:49 +#: ../../library/tarfile.rst:44 +msgid "" +"Set the default extraction filter to :func:`data `, which " +"disallows some dangerous features such as links to absolute paths or paths " +"outside of the destination. Previously, the filter strategy was equivalent " +"to :func:`fully_trusted `." +msgstr "" + +#: ../../library/tarfile.rst:52 +#, fuzzy +msgid "Added support for Zstandard compression using :mod:`compression.zstd`." +msgstr "新增對 :mod:`lzma` 壓縮的支援。" + +#: ../../library/tarfile.rst:56 msgid "" "Return a :class:`TarFile` object for the pathname *name*. For detailed " "information on :class:`TarFile` objects and the keyword arguments that are " "allowed, see :ref:`tarfile-objects`." msgstr "" -#: ../../library/tarfile.rst:53 +#: ../../library/tarfile.rst:60 msgid "" "*mode* has to be a string of the form ``'filemode[:compression]'``, it " "defaults to ``'r'``. Here is a full list of mode combinations:" @@ -94,357 +105,425 @@ msgstr "" "*mode* 必須是 ``'filemode[:compression]'`` 形式的字串,預設為 ``'r'``。以下是" "所有可能的模式組合:" -#: ../../library/tarfile.rst:57 +#: ../../library/tarfile.rst:64 msgid "mode" msgstr "模式" -#: ../../library/tarfile.rst:57 +#: ../../library/tarfile.rst:64 msgid "action" msgstr "操作" -#: ../../library/tarfile.rst:59 +#: ../../library/tarfile.rst:66 msgid "``'r'`` or ``'r:*'``" msgstr "``'r'`` 或 ``'r:*'``" -#: ../../library/tarfile.rst:59 +#: ../../library/tarfile.rst:66 msgid "Open for reading with transparent compression (recommended)." msgstr "" -#: ../../library/tarfile.rst:62 +#: ../../library/tarfile.rst:69 msgid "``'r:'``" msgstr "``'r:'``" -#: ../../library/tarfile.rst:62 +#: ../../library/tarfile.rst:69 msgid "Open for reading exclusively without compression." msgstr "" -#: ../../library/tarfile.rst:65 +#: ../../library/tarfile.rst:72 msgid "``'r:gz'``" msgstr "``'r:gz'``" -#: ../../library/tarfile.rst:65 +#: ../../library/tarfile.rst:72 msgid "Open for reading with gzip compression." msgstr "開啟以讀取 gzip 壓縮。" -#: ../../library/tarfile.rst:67 +#: ../../library/tarfile.rst:74 msgid "``'r:bz2'``" msgstr "``'r:bz2'``" -#: ../../library/tarfile.rst:67 +#: ../../library/tarfile.rst:74 msgid "Open for reading with bzip2 compression." msgstr "開啟以讀取 bzip2 壓縮。" -#: ../../library/tarfile.rst:69 +#: ../../library/tarfile.rst:76 msgid "``'r:xz'``" msgstr "``'r:xz'``" -#: ../../library/tarfile.rst:69 +#: ../../library/tarfile.rst:76 msgid "Open for reading with lzma compression." msgstr "開啟以讀取 lzma 壓縮。" -#: ../../library/tarfile.rst:71 +#: ../../library/tarfile.rst:78 +#, fuzzy +msgid "``'r:zst'``" +msgstr "``'r:gz'``" + +#: ../../library/tarfile.rst:78 +#, fuzzy +msgid "Open for reading with Zstandard compression." +msgstr "開啟以讀取 lzma 壓縮。" + +#: ../../library/tarfile.rst:80 msgid "``'x'`` or ``'x:'``" msgstr "``'x'`` 或 ``'x:'``" -#: ../../library/tarfile.rst:71 +#: ../../library/tarfile.rst:80 msgid "" -"Create a tarfile exclusively without compression. Raise a :exc:" -"`FileExistsError` exception if it already exists." +"Create a tarfile exclusively without compression. Raise " +"a :exc:`FileExistsError` exception if it already exists." msgstr "" -#: ../../library/tarfile.rst:76 +#: ../../library/tarfile.rst:85 msgid "``'x:gz'``" msgstr "``'x:gz'``" -#: ../../library/tarfile.rst:76 +#: ../../library/tarfile.rst:85 msgid "" "Create a tarfile with gzip compression. Raise a :exc:`FileExistsError` " "exception if it already exists." msgstr "" -#: ../../library/tarfile.rst:80 +#: ../../library/tarfile.rst:89 msgid "``'x:bz2'``" msgstr "``'x:bz2'``" -#: ../../library/tarfile.rst:80 +#: ../../library/tarfile.rst:89 msgid "" "Create a tarfile with bzip2 compression. Raise a :exc:`FileExistsError` " "exception if it already exists." msgstr "" -#: ../../library/tarfile.rst:84 +#: ../../library/tarfile.rst:93 msgid "``'x:xz'``" msgstr "``'x:xz'``" -#: ../../library/tarfile.rst:84 +#: ../../library/tarfile.rst:93 msgid "" "Create a tarfile with lzma compression. Raise a :exc:`FileExistsError` " "exception if it already exists." msgstr "" -#: ../../library/tarfile.rst:88 +#: ../../library/tarfile.rst:97 +#, fuzzy +msgid "``'x:zst'``" +msgstr "``'x:gz'``" + +#: ../../library/tarfile.rst:97 +msgid "" +"Create a tarfile with Zstandard compression. Raise a :exc:`FileExistsError` " +"exception if it already exists." +msgstr "" + +#: ../../library/tarfile.rst:101 msgid "``'a'`` or ``'a:'``" msgstr "``'a'`` 或 ``'a:'``" -#: ../../library/tarfile.rst:88 +#: ../../library/tarfile.rst:101 msgid "" "Open for appending with no compression. The file is created if it does not " "exist." msgstr "" -#: ../../library/tarfile.rst:91 +#: ../../library/tarfile.rst:104 msgid "``'w'`` or ``'w:'``" msgstr "``'w'`` 或 ``'w:'``" -#: ../../library/tarfile.rst:91 +#: ../../library/tarfile.rst:104 msgid "Open for uncompressed writing." msgstr "" -#: ../../library/tarfile.rst:94 +#: ../../library/tarfile.rst:107 msgid "``'w:gz'``" msgstr "``'w:gz'``" -#: ../../library/tarfile.rst:94 +#: ../../library/tarfile.rst:107 msgid "Open for gzip compressed writing." msgstr "開啟以用於 gzip 壓縮寫入。" -#: ../../library/tarfile.rst:96 +#: ../../library/tarfile.rst:109 msgid "``'w:bz2'``" msgstr "``'w:bz2'``" -#: ../../library/tarfile.rst:96 +#: ../../library/tarfile.rst:109 msgid "Open for bzip2 compressed writing." msgstr "開啟以用於 bzip2 壓縮寫入。" -#: ../../library/tarfile.rst:98 +#: ../../library/tarfile.rst:111 msgid "``'w:xz'``" msgstr "``'w:xz'``" -#: ../../library/tarfile.rst:98 +#: ../../library/tarfile.rst:111 msgid "Open for lzma compressed writing." msgstr "開啟以用於 lzma 壓縮寫入。" -#: ../../library/tarfile.rst:101 +#: ../../library/tarfile.rst:113 +#, fuzzy +msgid "``'w:zst'``" +msgstr "``'w:gz'``" + +#: ../../library/tarfile.rst:113 +#, fuzzy +msgid "Open for Zstandard compressed writing." +msgstr "開啟以用於 lzma 壓縮寫入。" + +#: ../../library/tarfile.rst:116 msgid "" "Note that ``'a:gz'``, ``'a:bz2'`` or ``'a:xz'`` is not possible. If *mode* " -"is not suitable to open a certain (compressed) file for reading, :exc:" -"`ReadError` is raised. Use *mode* ``'r'`` to avoid this. If a compression " -"method is not supported, :exc:`CompressionError` is raised." +"is not suitable to open a certain (compressed) file for " +"reading, :exc:`ReadError` is raised. Use *mode* ``'r'`` to avoid this. If a " +"compression method is not supported, :exc:`CompressionError` is raised." msgstr "" -#: ../../library/tarfile.rst:106 +#: ../../library/tarfile.rst:121 msgid "" "If *fileobj* is specified, it is used as an alternative to a :term:`file " "object` opened in binary mode for *name*. It is supposed to be at position 0." msgstr "" -#: ../../library/tarfile.rst:109 +#: ../../library/tarfile.rst:124 msgid "" "For modes ``'w:gz'``, ``'x:gz'``, ``'w|gz'``, ``'w:bz2'``, ``'x:bz2'``, ``'w|" "bz2'``, :func:`tarfile.open` accepts the keyword argument *compresslevel* " "(default ``9``) to specify the compression level of the file." msgstr "" -#: ../../library/tarfile.rst:113 +#: ../../library/tarfile.rst:128 msgid "" -"For modes ``'w:xz'`` and ``'x:xz'``, :func:`tarfile.open` accepts the " -"keyword argument *preset* to specify the compression level of the file." +"For modes ``'w:xz'``, ``'x:xz'`` and ``'w|xz'``, :func:`tarfile.open` " +"accepts the keyword argument *preset* to specify the compression level of " +"the file." msgstr "" -#: ../../library/tarfile.rst:116 +#: ../../library/tarfile.rst:131 +msgid "" +"For modes ``'w:zst'``, ``'x:zst'`` and ``'w|zst'``, :func:`tarfile.open` " +"accepts the keyword argument *level* to specify the compression level of the " +"file. The keyword argument *options* may also be passed, providing advanced " +"Zstandard compression parameters described " +"by :class:`~compression.zstd.CompressionParameter`. The keyword argument " +"*zstd_dict* can be passed to provide a :class:`~compression.zstd.ZstdDict`, " +"a Zstandard dictionary used to improve compression of smaller amounts of " +"data." +msgstr "" + +#: ../../library/tarfile.rst:140 msgid "" "For special purposes, there is a second format for *mode*: ``'filemode|" "[compression]'``. :func:`tarfile.open` will return a :class:`TarFile` " "object that processes its data as a stream of blocks. No random seeking " -"will be done on the file. If given, *fileobj* may be any object that has a :" -"meth:`~io.RawIOBase.read` or :meth:`~io.RawIOBase.write` method (depending " -"on the *mode*) that works with bytes. *bufsize* specifies the blocksize and " -"defaults to ``20 * 512`` bytes. Use this variant in combination with e.g. " -"``sys.stdin.buffer``, a socket :term:`file object` or a tape device. " -"However, such a :class:`TarFile` object is limited in that it does not allow " -"random access, see :ref:`tar-examples`. The currently possible modes:" +"will be done on the file. If given, *fileobj* may be any object that has " +"a :meth:`~io.RawIOBase.read` or :meth:`~io.RawIOBase.write` method " +"(depending on the *mode*) that works with bytes. *bufsize* specifies the " +"blocksize and defaults to ``20 * 512`` bytes. Use this variant in " +"combination with e.g. ``sys.stdin.buffer``, a socket :term:`file object` or " +"a tape device. However, such a :class:`TarFile` object is limited in that it " +"does not allow random access, see :ref:`tar-examples`. The currently " +"possible modes:" msgstr "" -#: ../../library/tarfile.rst:130 +#: ../../library/tarfile.rst:154 msgid "Mode" msgstr "模式" -#: ../../library/tarfile.rst:130 +#: ../../library/tarfile.rst:154 msgid "Action" msgstr "操作" -#: ../../library/tarfile.rst:132 +#: ../../library/tarfile.rst:156 msgid "``'r|*'``" msgstr "``'r|*'``" -#: ../../library/tarfile.rst:132 +#: ../../library/tarfile.rst:156 msgid "Open a *stream* of tar blocks for reading with transparent compression." msgstr "" -#: ../../library/tarfile.rst:135 +#: ../../library/tarfile.rst:159 msgid "``'r|'``" msgstr "``'r|'``" -#: ../../library/tarfile.rst:135 +#: ../../library/tarfile.rst:159 msgid "Open a *stream* of uncompressed tar blocks for reading." msgstr "" -#: ../../library/tarfile.rst:138 +#: ../../library/tarfile.rst:162 msgid "``'r|gz'``" msgstr "``'r|gz'``" -#: ../../library/tarfile.rst:138 +#: ../../library/tarfile.rst:162 msgid "Open a gzip compressed *stream* for reading." msgstr "" -#: ../../library/tarfile.rst:141 +#: ../../library/tarfile.rst:165 msgid "``'r|bz2'``" msgstr "``'r|bz2'``" -#: ../../library/tarfile.rst:141 +#: ../../library/tarfile.rst:165 msgid "Open a bzip2 compressed *stream* for reading." msgstr "" -#: ../../library/tarfile.rst:144 +#: ../../library/tarfile.rst:168 msgid "``'r|xz'``" msgstr "``'r|xz'``" -#: ../../library/tarfile.rst:144 +#: ../../library/tarfile.rst:168 msgid "Open an lzma compressed *stream* for reading." msgstr "" -#: ../../library/tarfile.rst:147 +#: ../../library/tarfile.rst:171 +#, fuzzy +msgid "``'r|zst'``" +msgstr "``'r|gz'``" + +#: ../../library/tarfile.rst:171 +msgid "Open a Zstandard compressed *stream* for reading." +msgstr "" + +#: ../../library/tarfile.rst:174 msgid "``'w|'``" msgstr "``'w|'``" -#: ../../library/tarfile.rst:147 +#: ../../library/tarfile.rst:174 msgid "Open an uncompressed *stream* for writing." msgstr "" -#: ../../library/tarfile.rst:149 +#: ../../library/tarfile.rst:176 msgid "``'w|gz'``" msgstr "``'w|gz'``" -#: ../../library/tarfile.rst:149 +#: ../../library/tarfile.rst:176 msgid "Open a gzip compressed *stream* for writing." msgstr "" -#: ../../library/tarfile.rst:152 +#: ../../library/tarfile.rst:179 msgid "``'w|bz2'``" msgstr "``'w|bz2'``" -#: ../../library/tarfile.rst:152 +#: ../../library/tarfile.rst:179 msgid "Open a bzip2 compressed *stream* for writing." msgstr "" -#: ../../library/tarfile.rst:155 +#: ../../library/tarfile.rst:182 msgid "``'w|xz'``" msgstr "``'w|xz'``" -#: ../../library/tarfile.rst:155 +#: ../../library/tarfile.rst:182 msgid "Open an lzma compressed *stream* for writing." msgstr "" -#: ../../library/tarfile.rst:159 ../../library/tarfile.rst:435 +#: ../../library/tarfile.rst:185 +#, fuzzy +msgid "``'w|zst'``" +msgstr "``'w|gz'``" + +#: ../../library/tarfile.rst:185 +#, fuzzy +msgid "Open a Zstandard compressed *stream* for writing." +msgstr "開啟以用於 lzma 壓縮寫入。" + +#: ../../library/tarfile.rst:189 ../../library/tarfile.rst:468 msgid "The ``'x'`` (exclusive creation) mode was added." msgstr "" -#: ../../library/tarfile.rst:162 ../../library/tarfile.rst:438 -#: ../../library/tarfile.rst:683 +#: ../../library/tarfile.rst:192 ../../library/tarfile.rst:471 +#: ../../library/tarfile.rst:719 msgid "The *name* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/tarfile.rst:165 +#: ../../library/tarfile.rst:195 msgid "The *compresslevel* keyword argument also works for streams." msgstr "" -#: ../../library/tarfile.rst:172 +#: ../../library/tarfile.rst:198 +msgid "The *preset* keyword argument also works for streams." +msgstr "" + +#: ../../library/tarfile.rst:205 msgid "" "Class for reading and writing tar archives. Do not use this class directly: " "use :func:`tarfile.open` instead. See :ref:`tarfile-objects`." msgstr "" -#: ../../library/tarfile.rst:178 +#: ../../library/tarfile.rst:211 msgid "" -"Return :const:`True` if *name* is a tar archive file, that the :mod:" -"`tarfile` module can read. *name* may be a :class:`str`, file, or file-like " -"object." +"Return :const:`True` if *name* is a tar archive file, that " +"the :mod:`tarfile` module can read. *name* may be a :class:`str`, file, or " +"file-like object." msgstr "" -#: ../../library/tarfile.rst:181 +#: ../../library/tarfile.rst:214 msgid "Support for file and file-like objects." msgstr "對檔案和類檔案物件的支援。" -#: ../../library/tarfile.rst:185 +#: ../../library/tarfile.rst:218 msgid "The :mod:`tarfile` module defines the following exceptions:" msgstr ":mod:`tarfile` 模組定義了以下例外:" -#: ../../library/tarfile.rst:190 +#: ../../library/tarfile.rst:223 msgid "Base class for all :mod:`tarfile` exceptions." msgstr "所有 :mod:`tarfile` 例外的基底類別。" -#: ../../library/tarfile.rst:195 +#: ../../library/tarfile.rst:228 msgid "" "Is raised when a tar archive is opened, that either cannot be handled by " "the :mod:`tarfile` module or is somehow invalid." msgstr "" -#: ../../library/tarfile.rst:201 +#: ../../library/tarfile.rst:234 msgid "" "Is raised when a compression method is not supported or when the data cannot " "be decoded properly." msgstr "" -#: ../../library/tarfile.rst:207 +#: ../../library/tarfile.rst:240 msgid "" -"Is raised for the limitations that are typical for stream-like :class:" -"`TarFile` objects." +"Is raised for the limitations that are typical for stream-" +"like :class:`TarFile` objects." msgstr "" -#: ../../library/tarfile.rst:213 +#: ../../library/tarfile.rst:246 msgid "" "Is raised for *non-fatal* errors when using :meth:`TarFile.extract`, but " "only if :attr:`TarFile.errorlevel`\\ ``== 2``." msgstr "" -#: ../../library/tarfile.rst:219 +#: ../../library/tarfile.rst:252 msgid "Is raised by :meth:`TarInfo.frombuf` if the buffer it gets is invalid." msgstr "" -#: ../../library/tarfile.rst:224 +#: ../../library/tarfile.rst:257 msgid "" "Base class for members :ref:`refused ` by filters." msgstr "" -#: ../../library/tarfile.rst:229 +#: ../../library/tarfile.rst:262 msgid "" -"Information about the member that the filter refused to extract, as :ref:" -"`TarInfo `." +"Information about the member that the filter refused to extract, " +"as :ref:`TarInfo `." msgstr "" -#: ../../library/tarfile.rst:234 +#: ../../library/tarfile.rst:267 msgid "Raised to refuse extracting a member with an absolute path." msgstr "" -#: ../../library/tarfile.rst:238 +#: ../../library/tarfile.rst:271 msgid "Raised to refuse extracting a member outside the destination directory." msgstr "" -#: ../../library/tarfile.rst:242 +#: ../../library/tarfile.rst:275 msgid "Raised to refuse extracting a special file (e.g. a device or pipe)." msgstr "" -#: ../../library/tarfile.rst:246 +#: ../../library/tarfile.rst:279 msgid "Raised to refuse extracting a symbolic link with an absolute path." msgstr "" -#: ../../library/tarfile.rst:250 +#: ../../library/tarfile.rst:283 msgid "" "Raised to refuse extracting a symbolic link pointing outside the destination " "directory." msgstr "" -#: ../../library/tarfile.rst:255 +#: ../../library/tarfile.rst:288 msgid "" "Raised to refuse emulating a link (hard or symbolic) by extracting another " "archive member, when that member would be rejected by the filter location. " @@ -452,159 +531,159 @@ msgid "" "as :attr:`!BaseException.__context__`." msgstr "" -#: ../../library/tarfile.rst:263 +#: ../../library/tarfile.rst:296 msgid "The following constants are available at the module level:" msgstr "" -#: ../../library/tarfile.rst:267 +#: ../../library/tarfile.rst:300 msgid "" "The default character encoding: ``'utf-8'`` on Windows, the value returned " "by :func:`sys.getfilesystemencoding` otherwise." msgstr "" -#: ../../library/tarfile.rst:273 +#: ../../library/tarfile.rst:306 msgid "A regular file :attr:`~TarInfo.type`." msgstr "一個普通檔案 :attr:`~TarInfo.type`。" -#: ../../library/tarfile.rst:277 +#: ../../library/tarfile.rst:310 msgid "A link (inside tarfile) :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:281 +#: ../../library/tarfile.rst:314 msgid "A symbolic link :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:285 +#: ../../library/tarfile.rst:318 msgid "A character special device :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:289 +#: ../../library/tarfile.rst:322 msgid "A block special device :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:293 +#: ../../library/tarfile.rst:326 msgid "A directory :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:297 +#: ../../library/tarfile.rst:330 msgid "A FIFO special device :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:301 +#: ../../library/tarfile.rst:334 msgid "A contiguous file :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:305 +#: ../../library/tarfile.rst:338 msgid "A GNU tar longname :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:309 +#: ../../library/tarfile.rst:342 msgid "A GNU tar longlink :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:313 +#: ../../library/tarfile.rst:346 msgid "A GNU tar sparse file :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:316 +#: ../../library/tarfile.rst:349 msgid "" -"Each of the following constants defines a tar archive format that the :mod:" -"`tarfile` module is able to create. See section :ref:`tar-formats` for " -"details." +"Each of the following constants defines a tar archive format that " +"the :mod:`tarfile` module is able to create. See section :ref:`tar-formats` " +"for details." msgstr "" -#: ../../library/tarfile.rst:323 +#: ../../library/tarfile.rst:356 msgid "POSIX.1-1988 (ustar) format." msgstr "POSIX.1-1988 (ustar) 格式。" -#: ../../library/tarfile.rst:328 +#: ../../library/tarfile.rst:361 msgid "GNU tar format." msgstr "GNU tar 格式。" -#: ../../library/tarfile.rst:333 +#: ../../library/tarfile.rst:366 msgid "POSIX.1-2001 (pax) format." msgstr "POSIX.1-2001 (pax) 格式。" -#: ../../library/tarfile.rst:338 +#: ../../library/tarfile.rst:371 msgid "" -"The default format for creating archives. This is currently :const:" -"`PAX_FORMAT`." +"The default format for creating archives. This is " +"currently :const:`PAX_FORMAT`." msgstr "" -#: ../../library/tarfile.rst:340 +#: ../../library/tarfile.rst:373 msgid "" -"The default format for new archives was changed to :const:`PAX_FORMAT` from :" -"const:`GNU_FORMAT`." +"The default format for new archives was changed to :const:`PAX_FORMAT` " +"from :const:`GNU_FORMAT`." msgstr "" -#: ../../library/tarfile.rst:347 +#: ../../library/tarfile.rst:380 msgid "Module :mod:`zipfile`" msgstr ":mod:`zipfile` 模組" -#: ../../library/tarfile.rst:348 +#: ../../library/tarfile.rst:381 msgid "Documentation of the :mod:`zipfile` standard module." msgstr ":mod:`zipfile` 標準模組的文件。" -#: ../../library/tarfile.rst:350 +#: ../../library/tarfile.rst:383 msgid ":ref:`archiving-operations`" msgstr ":ref:`archiving-operations`" -#: ../../library/tarfile.rst:351 +#: ../../library/tarfile.rst:384 msgid "" "Documentation of the higher-level archiving facilities provided by the " "standard :mod:`shutil` module." msgstr "" -#: ../../library/tarfile.rst:354 +#: ../../library/tarfile.rst:387 msgid "" "`GNU tar manual, Basic Tar Format `_" msgstr "" -#: ../../library/tarfile.rst:355 +#: ../../library/tarfile.rst:388 msgid "Documentation for tar archive files, including GNU tar extensions." msgstr "" -#: ../../library/tarfile.rst:361 +#: ../../library/tarfile.rst:394 msgid "TarFile Objects" msgstr "TarFile 物件" -#: ../../library/tarfile.rst:363 +#: ../../library/tarfile.rst:396 msgid "" "The :class:`TarFile` object provides an interface to a tar archive. A tar " "archive is a sequence of blocks. An archive member (a stored file) is made " "up of a header block followed by data blocks. It is possible to store a file " -"in a tar archive several times. Each archive member is represented by a :" -"class:`TarInfo` object, see :ref:`tarinfo-objects` for details." +"in a tar archive several times. Each archive member is represented by " +"a :class:`TarInfo` object, see :ref:`tarinfo-objects` for details." msgstr "" -#: ../../library/tarfile.rst:369 +#: ../../library/tarfile.rst:402 msgid "" -"A :class:`TarFile` object can be used as a context manager in a :keyword:" -"`with` statement. It will automatically be closed when the block is " -"completed. Please note that in the event of an exception an archive opened " -"for writing will not be finalized; only the internally used file object will " -"be closed. See the :ref:`tar-examples` section for a use case." +"A :class:`TarFile` object can be used as a context manager in " +"a :keyword:`with` statement. It will automatically be closed when the block " +"is completed. Please note that in the event of an exception an archive " +"opened for writing will not be finalized; only the internally used file " +"object will be closed. See the :ref:`tar-examples` section for a use case." msgstr "" -#: ../../library/tarfile.rst:375 +#: ../../library/tarfile.rst:408 msgid "Added support for the context management protocol." msgstr "新增對情境管理協定的支援。" -#: ../../library/tarfile.rst:380 +#: ../../library/tarfile.rst:413 msgid "" "All following arguments are optional and can be accessed as instance " "attributes as well." msgstr "" -#: ../../library/tarfile.rst:383 +#: ../../library/tarfile.rst:416 msgid "" "*name* is the pathname of the archive. *name* may be a :term:`path-like " "object`. It can be omitted if *fileobj* is given. In this case, the file " "object's :attr:`!name` attribute is used if it exists." msgstr "" -#: ../../library/tarfile.rst:387 +#: ../../library/tarfile.rst:420 msgid "" "*mode* is either ``'r'`` to read from an existing archive, ``'a'`` to append " "data to an existing file, ``'w'`` to create a new file overwriting an " @@ -612,18 +691,18 @@ msgid "" "exist." msgstr "" -#: ../../library/tarfile.rst:391 +#: ../../library/tarfile.rst:424 msgid "" "If *fileobj* is given, it is used for reading or writing data. If it can be " "determined, *mode* is overridden by *fileobj*'s mode. *fileobj* will be used " "from position 0." msgstr "" -#: ../../library/tarfile.rst:397 +#: ../../library/tarfile.rst:430 msgid "*fileobj* is not closed, when :class:`TarFile` is closed." msgstr "" -#: ../../library/tarfile.rst:399 +#: ../../library/tarfile.rst:432 msgid "" "*format* controls the archive format for writing. It must be one of the " "constants :const:`USTAR_FORMAT`, :const:`GNU_FORMAT` or :const:`PAX_FORMAT` " @@ -631,20 +710,20 @@ msgid "" "detected, even if different formats are present in a single archive." msgstr "" -#: ../../library/tarfile.rst:404 +#: ../../library/tarfile.rst:437 msgid "" "The *tarinfo* argument can be used to replace the default :class:`TarInfo` " "class with a different one." msgstr "" -#: ../../library/tarfile.rst:407 +#: ../../library/tarfile.rst:440 msgid "" "If *dereference* is :const:`False`, add symbolic and hard links to the " "archive. If it is :const:`True`, add the content of the target files to the " "archive. This has no effect on systems that do not support symbolic links." msgstr "" -#: ../../library/tarfile.rst:411 +#: ../../library/tarfile.rst:444 msgid "" "If *ignore_zeros* is :const:`False`, treat an empty block as the end of the " "archive. If it is :const:`True`, skip empty (and invalid) blocks and try to " @@ -652,77 +731,77 @@ msgid "" "concatenated or damaged archives." msgstr "" -#: ../../library/tarfile.rst:415 +#: ../../library/tarfile.rst:448 msgid "" "*debug* can be set from ``0`` (no debug messages) up to ``3`` (all debug " "messages). The messages are written to ``sys.stderr``." msgstr "" -#: ../../library/tarfile.rst:418 +#: ../../library/tarfile.rst:451 msgid "" "*errorlevel* controls how extraction errors are handled, see :attr:`the " "corresponding attribute `." msgstr "" -#: ../../library/tarfile.rst:421 +#: ../../library/tarfile.rst:454 msgid "" "The *encoding* and *errors* arguments define the character encoding to be " "used for reading or writing the archive and how conversion errors are going " -"to be handled. The default settings will work for most users. See section :" -"ref:`tar-unicode` for in-depth information." +"to be handled. The default settings will work for most users. See " +"section :ref:`tar-unicode` for in-depth information." msgstr "" -#: ../../library/tarfile.rst:426 +#: ../../library/tarfile.rst:459 msgid "" "The *pax_headers* argument is an optional dictionary of strings which will " "be added as a pax global header if *format* is :const:`PAX_FORMAT`." msgstr "" -#: ../../library/tarfile.rst:429 +#: ../../library/tarfile.rst:462 msgid "" "If *stream* is set to :const:`True` then while reading the archive info " "about files in the archive are not cached, saving memory." msgstr "" -#: ../../library/tarfile.rst:432 ../../library/tarfile.rst:752 +#: ../../library/tarfile.rst:465 ../../library/tarfile.rst:788 msgid "Use ``'surrogateescape'`` as the default for the *errors* argument." msgstr "使用 ``'surrogateescape'`` 作為 *errors* 引數的預設值。" -#: ../../library/tarfile.rst:441 +#: ../../library/tarfile.rst:474 msgid "Add the *stream* parameter." msgstr "新增 *stream* 參數。" -#: ../../library/tarfile.rst:446 +#: ../../library/tarfile.rst:479 msgid "" "Alternative constructor. The :func:`tarfile.open` function is actually a " "shortcut to this classmethod." msgstr "" -#: ../../library/tarfile.rst:452 +#: ../../library/tarfile.rst:485 msgid "" "Return a :class:`TarInfo` object for member *name*. If *name* can not be " "found in the archive, :exc:`KeyError` is raised." msgstr "" -#: ../../library/tarfile.rst:457 +#: ../../library/tarfile.rst:490 msgid "" "If a member occurs more than once in the archive, its last occurrence is " "assumed to be the most up-to-date version." msgstr "" -#: ../../library/tarfile.rst:463 +#: ../../library/tarfile.rst:496 msgid "" "Return the members of the archive as a list of :class:`TarInfo` objects. The " "list has the same order as the members in the archive." msgstr "" -#: ../../library/tarfile.rst:469 +#: ../../library/tarfile.rst:502 msgid "" "Return the members as a list of their names. It has the same order as the " "list returned by :meth:`getmembers`." msgstr "" -#: ../../library/tarfile.rst:475 +#: ../../library/tarfile.rst:508 msgid "" "Print a table of contents to ``sys.stdout``. If *verbose* is :const:`False`, " "only the names of the members are printed. If it is :const:`True`, output " @@ -730,18 +809,18 @@ msgid "" "given, it must be a subset of the list returned by :meth:`getmembers`." msgstr "" -#: ../../library/tarfile.rst:480 +#: ../../library/tarfile.rst:513 msgid "Added the *members* parameter." msgstr "新增 *members* 參數。" -#: ../../library/tarfile.rst:486 +#: ../../library/tarfile.rst:519 msgid "" -"Return the next member of the archive as a :class:`TarInfo` object, when :" -"class:`TarFile` is opened for reading. Return :const:`None` if there is no " -"more available." +"Return the next member of the archive as a :class:`TarInfo` object, " +"when :class:`TarFile` is opened for reading. Return :const:`None` if there " +"is no more available." msgstr "" -#: ../../library/tarfile.rst:493 +#: ../../library/tarfile.rst:526 msgid "" "Extract all members from the archive to the current working directory or " "directory *path*. If optional *members* is given, it must be a subset of the " @@ -753,49 +832,52 @@ msgid "" "fail." msgstr "" -#: ../../library/tarfile.rst:501 +#: ../../library/tarfile.rst:534 msgid "" "If *numeric_owner* is :const:`True`, the uid and gid numbers from the " "tarfile are used to set the owner/group for the extracted files. Otherwise, " "the named values from the tarfile are used." msgstr "" -#: ../../library/tarfile.rst:505 +#: ../../library/tarfile.rst:538 msgid "" "The *filter* argument specifies how ``members`` are modified or rejected " "before extraction. See :ref:`tarfile-extraction-filter` for details. It is " -"recommended to set this explicitly depending on which *tar* features you " -"need to support." +"recommended to set this explicitly only if specific *tar* features are " +"required, or as ``filter='data'`` to support Python versions with a less " +"secure default (3.13 and lower)." msgstr "" -#: ../../library/tarfile.rst:513 -msgid "" -"Never extract archives from untrusted sources without prior inspection. It " -"is possible that files are created outside of *path*, e.g. members that have " -"absolute filenames starting with ``\"/\"`` or filenames with two dots ``\".." -"\"``." +#: ../../library/tarfile.rst:547 +msgid "Never extract archives from untrusted sources without prior inspection." msgstr "" -#: ../../library/tarfile.rst:518 ../../library/tarfile.rst:551 +#: ../../library/tarfile.rst:549 msgid "" -"Set ``filter='data'`` to prevent the most dangerous security issues, and " -"read the :ref:`tarfile-extraction-filter` section for details." +"Since Python 3.14, the default (:func:`data `) will prevent the " +"most dangerous security issues. However, it will not prevent *all* " +"unintended or insecure behavior. Read the :ref:`tarfile-extraction-filter` " +"section for details." msgstr "" -#: ../../library/tarfile.rst:521 ../../library/tarfile.rst:557 +#: ../../library/tarfile.rst:554 ../../library/tarfile.rst:591 msgid "Added the *numeric_owner* parameter." msgstr "新增 *numeric_owner* 參數。" -#: ../../library/tarfile.rst:524 ../../library/tarfile.rst:560 +#: ../../library/tarfile.rst:557 ../../library/tarfile.rst:594 msgid "The *path* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/tarfile.rst:527 ../../library/tarfile.rst:563 -#: ../../library/tarfile.rst:645 +#: ../../library/tarfile.rst:560 ../../library/tarfile.rst:597 +#: ../../library/tarfile.rst:681 msgid "Added the *filter* parameter." msgstr "新增 *filter* 參數。" -#: ../../library/tarfile.rst:533 +#: ../../library/tarfile.rst:563 +msgid "The *filter* parameter now defaults to ``'data'``." +msgstr "" + +#: ../../library/tarfile.rst:569 msgid "" "Extract a member from the archive to the current working directory, using " "its full name. Its file information is extracted as accurately as possible. " @@ -804,27 +886,29 @@ msgid "" "File attributes (owner, mtime, mode) are set unless *set_attrs* is false." msgstr "" -#: ../../library/tarfile.rst:539 +#: ../../library/tarfile.rst:575 msgid "" -"The *numeric_owner* and *filter* arguments are the same as for :meth:" -"`extractall`." +"The *numeric_owner* and *filter* arguments are the same as " +"for :meth:`extractall`." msgstr "" -#: ../../library/tarfile.rst:544 +#: ../../library/tarfile.rst:580 msgid "" "The :meth:`extract` method does not take care of several extraction issues. " "In most cases you should consider using the :meth:`extractall` method." msgstr "" -#: ../../library/tarfile.rst:549 -msgid "See the warning for :meth:`extractall`." -msgstr "參閱 :meth:`extractall` 的警告。" +#: ../../library/tarfile.rst:585 +msgid "" +"Never extract archives from untrusted sources without prior inspection. See " +"the warning for :meth:`extractall` for details." +msgstr "" -#: ../../library/tarfile.rst:554 +#: ../../library/tarfile.rst:588 msgid "Added the *set_attrs* parameter." msgstr "增加 *set_attrs* 參數。" -#: ../../library/tarfile.rst:569 +#: ../../library/tarfile.rst:603 msgid "" "Extract a member from the archive as a file object. *member* may be a " "filename or a :class:`TarInfo` object. If *member* is a regular file or a " @@ -833,73 +917,65 @@ msgid "" "the archive, :exc:`KeyError` is raised." msgstr "" -#: ../../library/tarfile.rst:575 +#: ../../library/tarfile.rst:609 msgid "Return an :class:`io.BufferedReader` object." msgstr "" -#: ../../library/tarfile.rst:578 +#: ../../library/tarfile.rst:612 msgid "" "The returned :class:`io.BufferedReader` object has the :attr:`!mode` " "attribute which is always equal to ``'rb'``." msgstr "" -#: ../../library/tarfile.rst:585 +#: ../../library/tarfile.rst:619 msgid "" -"If *errorlevel* is ``0``, errors are ignored when using :meth:`TarFile." -"extract` and :meth:`TarFile.extractall`. Nevertheless, they appear as error " -"messages in the debug output when *debug* is greater than 0. If ``1`` (the " -"default), all *fatal* errors are raised as :exc:`OSError` or :exc:" -"`FilterError` exceptions. If ``2``, all *non-fatal* errors are raised as :" -"exc:`TarError` exceptions as well." +"If *errorlevel* is ``0``, errors are ignored when " +"using :meth:`TarFile.extract` and :meth:`TarFile.extractall`. Nevertheless, " +"they appear as error messages in the debug output when *debug* is greater " +"than 0. If ``1`` (the default), all *fatal* errors are raised " +"as :exc:`OSError` or :exc:`FilterError` exceptions. If ``2``, all *non-" +"fatal* errors are raised as :exc:`TarError` exceptions as well." msgstr "" -#: ../../library/tarfile.rst:593 +#: ../../library/tarfile.rst:627 msgid "" "Some exceptions, e.g. ones caused by wrong argument types or data " "corruption, are always raised." msgstr "" -#: ../../library/tarfile.rst:596 +#: ../../library/tarfile.rst:630 msgid "" -"Custom :ref:`extraction filters ` should raise :" -"exc:`FilterError` for *fatal* errors and :exc:`ExtractError` for *non-fatal* " -"ones." +"Custom :ref:`extraction filters ` should " +"raise :exc:`FilterError` for *fatal* errors and :exc:`ExtractError` for *non-" +"fatal* ones." msgstr "" -#: ../../library/tarfile.rst:600 +#: ../../library/tarfile.rst:634 msgid "" "Note that when an exception is raised, the archive may be partially " "extracted. It is the user’s responsibility to clean up." msgstr "" -#: ../../library/tarfile.rst:607 +#: ../../library/tarfile.rst:641 msgid "" "The :ref:`extraction filter ` used as a default " -"for the *filter* argument of :meth:`~TarFile.extract` and :meth:`~TarFile." -"extractall`." +"for the *filter* argument of :meth:`~TarFile.extract` " +"and :meth:`~TarFile.extractall`." msgstr "" -#: ../../library/tarfile.rst:611 +#: ../../library/tarfile.rst:645 msgid "" "The attribute may be ``None`` or a callable. String names are not allowed " "for this attribute, unlike the *filter* argument to :meth:`~TarFile.extract`." msgstr "" -#: ../../library/tarfile.rst:615 -msgid "" -"If ``extraction_filter`` is ``None`` (the default), calling an extraction " -"method without a *filter* argument will raise a ``DeprecationWarning``, and " -"fall back to the :func:`fully_trusted ` filter, whose " -"dangerous behavior matches previous versions of Python." -msgstr "" - -#: ../../library/tarfile.rst:621 +#: ../../library/tarfile.rst:649 msgid "" -"In Python 3.14+, leaving ``extraction_filter=None`` will cause extraction " -"methods to use the :func:`data ` filter by default." +"If ``extraction_filter`` is ``None`` (the default), extraction methods will " +"use the :func:`data ` filter by default." msgstr "" -#: ../../library/tarfile.rst:624 +#: ../../library/tarfile.rst:652 msgid "" "The attribute may be set on instances or overridden in subclasses. It also " "is possible to set it on the ``TarFile`` class itself to set a global " @@ -909,37 +985,45 @@ msgid "" "wrapped in :func:`staticmethod` to prevent injection of a ``self`` argument." msgstr "" -#: ../../library/tarfile.rst:634 +#: ../../library/tarfile.rst:662 +msgid "" +"The default filter is set to :func:`data `, which disallows " +"some dangerous features such as links to absolute paths or paths outside of " +"the destination. Previously, the default was equivalent " +"to :func:`fully_trusted `." +msgstr "" + +#: ../../library/tarfile.rst:670 msgid "" "Add the file *name* to the archive. *name* may be any type of file " "(directory, fifo, symbolic link, etc.). If given, *arcname* specifies an " "alternative name for the file in the archive. Directories are added " -"recursively by default. This can be avoided by setting *recursive* to :const:" -"`False`. Recursion adds entries in sorted order. If *filter* is given, it " -"should be a function that takes a :class:`TarInfo` object argument and " -"returns the changed :class:`TarInfo` object. If it instead returns :const:" -"`None` the :class:`TarInfo` object will be excluded from the archive. See :" -"ref:`tar-examples` for an example." +"recursively by default. This can be avoided by setting *recursive* " +"to :const:`False`. Recursion adds entries in sorted order. If *filter* is " +"given, it should be a function that takes a :class:`TarInfo` object argument " +"and returns the changed :class:`TarInfo` object. If it instead " +"returns :const:`None` the :class:`TarInfo` object will be excluded from the " +"archive. See :ref:`tar-examples` for an example." msgstr "" -#: ../../library/tarfile.rst:648 +#: ../../library/tarfile.rst:684 msgid "Recursion adds entries in sorted order." msgstr "" -#: ../../library/tarfile.rst:654 +#: ../../library/tarfile.rst:690 msgid "" "Add the :class:`TarInfo` object *tarinfo* to the archive. If *tarinfo* " -"represents a non zero-size regular file, the *fileobj* argument should be a :" -"term:`binary file`, and ``tarinfo.size`` bytes are read from it and added to " -"the archive. You can create :class:`TarInfo` objects directly, or by using :" -"meth:`gettarinfo`." +"represents a non zero-size regular file, the *fileobj* argument should be " +"a :term:`binary file`, and ``tarinfo.size`` bytes are read from it and added " +"to the archive. You can create :class:`TarInfo` objects directly, or by " +"using :meth:`gettarinfo`." msgstr "" -#: ../../library/tarfile.rst:661 +#: ../../library/tarfile.rst:697 msgid "*fileobj* must be given for non-zero-sized regular files." msgstr "" -#: ../../library/tarfile.rst:666 +#: ../../library/tarfile.rst:702 msgid "" "Create a :class:`TarInfo` object from the result of :func:`os.stat` or " "equivalent on an existing file. The file is either named by *name*, or " @@ -950,31 +1034,31 @@ msgid "" "The name should be a text string." msgstr "" -#: ../../library/tarfile.rst:675 +#: ../../library/tarfile.rst:711 msgid "" "You can modify some of the :class:`TarInfo`’s attributes before you add it " "using :meth:`addfile`. If the file object is not an ordinary file object " -"positioned at the beginning of the file, attributes such as :attr:`~TarInfo." -"size` may need modifying. This is the case for objects such as :class:" -"`~gzip.GzipFile`. The :attr:`~TarInfo.name` may also be modified, in which " -"case *arcname* could be a dummy string." +"positioned at the beginning of the file, attributes such " +"as :attr:`~TarInfo.size` may need modifying. This is the case for objects " +"such as :class:`~gzip.GzipFile`. The :attr:`~TarInfo.name` may also be " +"modified, in which case *arcname* could be a dummy string." msgstr "" -#: ../../library/tarfile.rst:689 +#: ../../library/tarfile.rst:725 msgid "" "Close the :class:`TarFile`. In write mode, two finishing zero blocks are " "appended to the archive." msgstr "" -#: ../../library/tarfile.rst:696 +#: ../../library/tarfile.rst:732 msgid "A dictionary containing key-value pairs of pax global headers." msgstr "" -#: ../../library/tarfile.rst:703 +#: ../../library/tarfile.rst:739 msgid "TarInfo Objects" msgstr "TarInfo 物件" -#: ../../library/tarfile.rst:705 +#: ../../library/tarfile.rst:741 msgid "" "A :class:`TarInfo` object represents one member in a :class:`TarFile`. Aside " "from storing all required attributes of a file (like file type, size, time, " @@ -982,228 +1066,228 @@ msgid "" "type. It does *not* contain the file's data itself." msgstr "" -#: ../../library/tarfile.rst:710 +#: ../../library/tarfile.rst:746 msgid "" -":class:`TarInfo` objects are returned by :class:`TarFile`'s methods :meth:" -"`~TarFile.getmember`, :meth:`~TarFile.getmembers` and :meth:`~TarFile." -"gettarinfo`." +":class:`TarInfo` objects are returned by :class:`TarFile`'s " +"methods :meth:`~TarFile.getmember`, :meth:`~TarFile.getmembers` " +"and :meth:`~TarFile.gettarinfo`." msgstr "" -#: ../../library/tarfile.rst:714 +#: ../../library/tarfile.rst:750 msgid "" -"Modifying the objects returned by :meth:`~TarFile.getmember` or :meth:" -"`~TarFile.getmembers` will affect all subsequent operations on the archive. " -"For cases where this is unwanted, you can use :mod:`copy.copy() ` or " -"call the :meth:`~TarInfo.replace` method to create a modified copy in one " -"step." +"Modifying the objects returned by :meth:`~TarFile.getmember` " +"or :meth:`~TarFile.getmembers` will affect all subsequent operations on the " +"archive. For cases where this is unwanted, you can use :mod:`copy.copy() " +"` or call the :meth:`~TarInfo.replace` method to create a modified " +"copy in one step." msgstr "" -#: ../../library/tarfile.rst:720 +#: ../../library/tarfile.rst:756 msgid "" "Several attributes can be set to ``None`` to indicate that a piece of " "metadata is unused or unknown. Different :class:`TarInfo` methods handle " "``None`` differently:" msgstr "" -#: ../../library/tarfile.rst:724 +#: ../../library/tarfile.rst:760 msgid "" "The :meth:`~TarFile.extract` or :meth:`~TarFile.extractall` methods will " "ignore the corresponding metadata, leaving it set to a default." msgstr "" -#: ../../library/tarfile.rst:726 +#: ../../library/tarfile.rst:762 msgid ":meth:`~TarFile.addfile` will fail." msgstr "" -#: ../../library/tarfile.rst:727 +#: ../../library/tarfile.rst:763 msgid ":meth:`~TarFile.list` will print a placeholder string." msgstr "" -#: ../../library/tarfile.rst:731 +#: ../../library/tarfile.rst:767 msgid "Create a :class:`TarInfo` object." msgstr "" -#: ../../library/tarfile.rst:736 +#: ../../library/tarfile.rst:772 msgid "Create and return a :class:`TarInfo` object from string buffer *buf*." msgstr "" -#: ../../library/tarfile.rst:738 +#: ../../library/tarfile.rst:774 msgid "Raises :exc:`HeaderError` if the buffer is invalid." msgstr "" -#: ../../library/tarfile.rst:743 +#: ../../library/tarfile.rst:779 msgid "" "Read the next member from the :class:`TarFile` object *tarfile* and return " "it as a :class:`TarInfo` object." msgstr "" -#: ../../library/tarfile.rst:749 +#: ../../library/tarfile.rst:785 msgid "" "Create a string buffer from a :class:`TarInfo` object. For information on " "the arguments see the constructor of the :class:`TarFile` class." msgstr "" -#: ../../library/tarfile.rst:756 +#: ../../library/tarfile.rst:792 msgid "A ``TarInfo`` object has the following public data attributes:" msgstr "一個 ``TarInfo`` 物件具有以下公開資料屬性:" -#: ../../library/tarfile.rst:762 +#: ../../library/tarfile.rst:798 msgid "Name of the archive member." msgstr "" -#: ../../library/tarfile.rst:768 +#: ../../library/tarfile.rst:804 msgid "Size in bytes." msgstr "" -#: ../../library/tarfile.rst:774 +#: ../../library/tarfile.rst:810 msgid "" -"Time of last modification in seconds since the :ref:`epoch `, as in :" -"attr:`os.stat_result.st_mtime`." +"Time of last modification in seconds since the :ref:`epoch `, as " +"in :attr:`os.stat_result.st_mtime`." msgstr "" -#: ../../library/tarfile.rst:779 ../../library/tarfile.rst:790 -#: ../../library/tarfile.rst:822 ../../library/tarfile.rst:833 -#: ../../library/tarfile.rst:844 ../../library/tarfile.rst:855 +#: ../../library/tarfile.rst:815 ../../library/tarfile.rst:826 +#: ../../library/tarfile.rst:858 ../../library/tarfile.rst:869 +#: ../../library/tarfile.rst:880 ../../library/tarfile.rst:891 msgid "" -"Can be set to ``None`` for :meth:`~TarFile.extract` and :meth:`~TarFile." -"extractall`, causing extraction to skip applying this attribute." +"Can be set to ``None`` for :meth:`~TarFile.extract` " +"and :meth:`~TarFile.extractall`, causing extraction to skip applying this " +"attribute." msgstr "" -#: ../../library/tarfile.rst:786 +#: ../../library/tarfile.rst:822 msgid "Permission bits, as for :func:`os.chmod`." msgstr "" -#: ../../library/tarfile.rst:796 +#: ../../library/tarfile.rst:832 msgid "" -"File type. *type* is usually one of these constants: :const:`REGTYPE`, :" -"const:`AREGTYPE`, :const:`LNKTYPE`, :const:`SYMTYPE`, :const:`DIRTYPE`, :" -"const:`FIFOTYPE`, :const:`CONTTYPE`, :const:`CHRTYPE`, :const:`BLKTYPE`, :" -"const:`GNUTYPE_SPARSE`. To determine the type of a :class:`TarInfo` object " -"more conveniently, use the ``is*()`` methods below." +"File type. *type* is usually one of these " +"constants: :const:`REGTYPE`, :const:`AREGTYPE`, :const:`LNKTYPE`, :const:`SYMTYPE`, :const:`DIRTYPE`, :const:`FIFOTYPE`, :const:`CONTTYPE`, :const:`CHRTYPE`, :const:`BLKTYPE`, :const:`GNUTYPE_SPARSE`. " +"To determine the type of a :class:`TarInfo` object more conveniently, use " +"the ``is*()`` methods below." msgstr "" -#: ../../library/tarfile.rst:806 +#: ../../library/tarfile.rst:842 msgid "" "Name of the target file name, which is only present in :class:`TarInfo` " "objects of type :const:`LNKTYPE` and :const:`SYMTYPE`." msgstr "" -#: ../../library/tarfile.rst:809 +#: ../../library/tarfile.rst:845 msgid "" "For symbolic links (``SYMTYPE``), the *linkname* is relative to the " "directory that contains the link. For hard links (``LNKTYPE``), the " "*linkname* is relative to the root of the archive." msgstr "" -#: ../../library/tarfile.rst:818 +#: ../../library/tarfile.rst:854 msgid "User ID of the user who originally stored this member." msgstr "" -#: ../../library/tarfile.rst:829 +#: ../../library/tarfile.rst:865 msgid "Group ID of the user who originally stored this member." msgstr "" -#: ../../library/tarfile.rst:840 +#: ../../library/tarfile.rst:876 msgid "User name." msgstr "" -#: ../../library/tarfile.rst:851 +#: ../../library/tarfile.rst:887 msgid "Group name." msgstr "" -#: ../../library/tarfile.rst:862 +#: ../../library/tarfile.rst:898 msgid "Header checksum." msgstr "" -#: ../../library/tarfile.rst:868 +#: ../../library/tarfile.rst:904 msgid "Device major number." msgstr "" -#: ../../library/tarfile.rst:874 +#: ../../library/tarfile.rst:910 msgid "Device minor number." msgstr "" -#: ../../library/tarfile.rst:880 +#: ../../library/tarfile.rst:916 msgid "The tar header starts here." msgstr "" -#: ../../library/tarfile.rst:886 +#: ../../library/tarfile.rst:922 msgid "The file's data starts here." msgstr "" -#: ../../library/tarfile.rst:891 +#: ../../library/tarfile.rst:927 msgid "Sparse member information." msgstr "" -#: ../../library/tarfile.rst:897 +#: ../../library/tarfile.rst:933 msgid "" "A dictionary containing key-value pairs of an associated pax extended header." msgstr "" -#: ../../library/tarfile.rst:905 +#: ../../library/tarfile.rst:941 msgid "" "Return a *new* copy of the :class:`!TarInfo` object with the given " "attributes changed. For example, to return a ``TarInfo`` with the group name " "set to ``'staff'``, use::" msgstr "" -#: ../../library/tarfile.rst:909 +#: ../../library/tarfile.rst:945 msgid "new_tarinfo = old_tarinfo.replace(gname='staff')" msgstr "new_tarinfo = old_tarinfo.replace(gname='staff')" -#: ../../library/tarfile.rst:911 +#: ../../library/tarfile.rst:947 msgid "" -"By default, a deep copy is made. If *deep* is false, the copy is shallow, i." -"e. ``pax_headers`` and any custom attributes are shared with the original " +"By default, a deep copy is made. If *deep* is false, the copy is shallow, " +"i.e. ``pax_headers`` and any custom attributes are shared with the original " "``TarInfo`` object." msgstr "" -#: ../../library/tarfile.rst:915 +#: ../../library/tarfile.rst:951 msgid "A :class:`TarInfo` object also provides some convenient query methods:" msgstr "" -#: ../../library/tarfile.rst:920 +#: ../../library/tarfile.rst:956 msgid "Return :const:`True` if the :class:`TarInfo` object is a regular file." msgstr "" -#: ../../library/tarfile.rst:925 +#: ../../library/tarfile.rst:961 msgid "Same as :meth:`isfile`." msgstr "" -#: ../../library/tarfile.rst:930 +#: ../../library/tarfile.rst:966 msgid "Return :const:`True` if it is a directory." msgstr "如果它是一個目錄,則回傳 :const:`True`。" -#: ../../library/tarfile.rst:935 +#: ../../library/tarfile.rst:971 msgid "Return :const:`True` if it is a symbolic link." msgstr "如果它是一個符號連結,則回傳 :const:`True`。" -#: ../../library/tarfile.rst:940 +#: ../../library/tarfile.rst:976 msgid "Return :const:`True` if it is a hard link." msgstr "" -#: ../../library/tarfile.rst:945 +#: ../../library/tarfile.rst:981 msgid "Return :const:`True` if it is a character device." msgstr "如果它是一個字元裝置,則回傳 :const:`True`。" -#: ../../library/tarfile.rst:950 +#: ../../library/tarfile.rst:986 msgid "Return :const:`True` if it is a block device." msgstr "如果它是一個區塊裝置,則回傳 :const:`True`。" -#: ../../library/tarfile.rst:955 +#: ../../library/tarfile.rst:991 msgid "Return :const:`True` if it is a FIFO." msgstr "如果它是一個 FIFO,則回傳 :const:`True`。" -#: ../../library/tarfile.rst:960 +#: ../../library/tarfile.rst:996 msgid "" "Return :const:`True` if it is one of character device, block device or FIFO." msgstr "如果它是一個字元裝置、區塊裝置或 FIFO,則回傳 :const:`True`。" -#: ../../library/tarfile.rst:966 +#: ../../library/tarfile.rst:1002 msgid "Extraction filters" msgstr "" -#: ../../library/tarfile.rst:970 +#: ../../library/tarfile.rst:1006 msgid "" "The *tar* format is designed to capture all details of a UNIX-like " "filesystem, which makes it very powerful. Unfortunately, the features make " @@ -1213,225 +1297,237 @@ msgid "" "components, or symlinks that affect later members)." msgstr "" -#: ../../library/tarfile.rst:978 +#: ../../library/tarfile.rst:1014 msgid "" "In most cases, the full functionality is not needed. Therefore, *tarfile* " "supports extraction filters: a mechanism to limit functionality, and thus " "mitigate some of the security issues." msgstr "" -#: ../../library/tarfile.rst:984 +#: ../../library/tarfile.rst:1020 +msgid "" +"None of the available filters blocks *all* dangerous archive features. Never " +"extract archives from untrusted sources without prior inspection. See " +"also :ref:`tarfile-further-verification`." +msgstr "" + +#: ../../library/tarfile.rst:1026 msgid ":pep:`706`" msgstr ":pep:`706`" -#: ../../library/tarfile.rst:985 +#: ../../library/tarfile.rst:1027 msgid "Contains further motivation and rationale behind the design." msgstr "" -#: ../../library/tarfile.rst:987 +#: ../../library/tarfile.rst:1029 msgid "" -"The *filter* argument to :meth:`TarFile.extract` or :meth:`~TarFile." -"extractall` can be:" +"The *filter* argument to :meth:`TarFile.extract` " +"or :meth:`~TarFile.extractall` can be:" msgstr "" -#: ../../library/tarfile.rst:990 +#: ../../library/tarfile.rst:1032 msgid "" "the string ``'fully_trusted'``: Honor all metadata as specified in the " "archive. Should be used if the user trusts the archive completely, or " "implements their own complex verification." msgstr "" -#: ../../library/tarfile.rst:995 +#: ../../library/tarfile.rst:1037 msgid "" "the string ``'tar'``: Honor most *tar*-specific features (i.e. features of " "UNIX-like filesystems), but block features that are very likely to be " "surprising or malicious. See :func:`tar_filter` for details." msgstr "" -#: ../../library/tarfile.rst:999 +#: ../../library/tarfile.rst:1041 msgid "" "the string ``'data'``: Ignore or block most features specific to UNIX-like " -"filesystems. Intended for extracting cross-platform data archives. See :func:" -"`data_filter` for details." +"filesystems. Intended for extracting cross-platform data archives. " +"See :func:`data_filter` for details." msgstr "" -#: ../../library/tarfile.rst:1003 +#: ../../library/tarfile.rst:1045 msgid "``None`` (default): Use :attr:`TarFile.extraction_filter`." msgstr "" -#: ../../library/tarfile.rst:1005 +#: ../../library/tarfile.rst:1047 msgid "" -"If that is also ``None`` (the default), raise a ``DeprecationWarning``, and " -"fall back to the ``'fully_trusted'`` filter, whose dangerous behavior " -"matches previous versions of Python." +"If that is also ``None`` (the default), the ``'data'`` filter will be used." msgstr "" -#: ../../library/tarfile.rst:1009 +#: ../../library/tarfile.rst:1051 msgid "" -"In Python 3.14, the ``'data'`` filter will become the default instead. It's " -"possible to switch earlier; see :attr:`TarFile.extraction_filter`." +"The default filter is set to :func:`data `. Previously, the " +"default was equivalent to :func:`fully_trusted `." msgstr "" -#: ../../library/tarfile.rst:1012 +#: ../../library/tarfile.rst:1055 msgid "" -"A callable which will be called for each extracted member with a :ref:" -"`TarInfo ` describing the member and the destination path " -"to where the archive is extracted (i.e. the same path is used for all " +"A callable which will be called for each extracted member with " +"a :ref:`TarInfo ` describing the member and the destination " +"path to where the archive is extracted (i.e. the same path is used for all " "members)::" msgstr "" -#: ../../library/tarfile.rst:1017 +#: ../../library/tarfile.rst:1060 msgid "filter(member: TarInfo, path: str, /) -> TarInfo | None" msgstr "filter(member: TarInfo, path: str, /) -> TarInfo | None" -#: ../../library/tarfile.rst:1019 +#: ../../library/tarfile.rst:1062 msgid "" "The callable is called just before each member is extracted, so it can take " "the current state of the disk into account. It can:" msgstr "" -#: ../../library/tarfile.rst:1023 +#: ../../library/tarfile.rst:1066 msgid "" "return a :class:`TarInfo` object which will be used instead of the metadata " "in the archive, or" msgstr "" -#: ../../library/tarfile.rst:1025 +#: ../../library/tarfile.rst:1068 msgid "return ``None``, in which case the member will be skipped, or" msgstr "" -#: ../../library/tarfile.rst:1026 +#: ../../library/tarfile.rst:1069 msgid "" -"raise an exception to abort the operation or skip the member, depending on :" -"attr:`~TarFile.errorlevel`. Note that when extraction is aborted, :meth:" -"`~TarFile.extractall` may leave the archive partially extracted. It does not " -"attempt to clean up." +"raise an exception to abort the operation or skip the member, depending " +"on :attr:`~TarFile.errorlevel`. Note that when extraction is " +"aborted, :meth:`~TarFile.extractall` may leave the archive partially " +"extracted. It does not attempt to clean up." msgstr "" -#: ../../library/tarfile.rst:1032 +#: ../../library/tarfile.rst:1075 msgid "Default named filters" msgstr "" -#: ../../library/tarfile.rst:1034 +#: ../../library/tarfile.rst:1077 msgid "" "The pre-defined, named filters are available as functions, so they can be " "reused in custom filters:" msgstr "" -#: ../../library/tarfile.rst:1039 +#: ../../library/tarfile.rst:1082 msgid "Return *member* unchanged." msgstr "" -#: ../../library/tarfile.rst:1041 +#: ../../library/tarfile.rst:1084 msgid "This implements the ``'fully_trusted'`` filter." msgstr "" -#: ../../library/tarfile.rst:1045 +#: ../../library/tarfile.rst:1088 msgid "Implements the ``'tar'`` filter." msgstr "" -#: ../../library/tarfile.rst:1047 +#: ../../library/tarfile.rst:1090 msgid "Strip leading slashes (``/`` and :data:`os.sep`) from filenames." msgstr "" -#: ../../library/tarfile.rst:1048 +#: ../../library/tarfile.rst:1091 msgid "" ":ref:`Refuse ` to extract files with absolute " "paths (in case the name is absolute even after stripping slashes, e.g. ``C:/" "foo`` on Windows). This raises :class:`~tarfile.AbsolutePathError`." msgstr "" -#: ../../library/tarfile.rst:1052 +#: ../../library/tarfile.rst:1095 msgid "" ":ref:`Refuse ` to extract files whose absolute " "path (after following symlinks) would end up outside the destination. This " "raises :class:`~tarfile.OutsideDestinationError`." msgstr "" -#: ../../library/tarfile.rst:1055 +#: ../../library/tarfile.rst:1098 msgid "" -"Clear high mode bits (setuid, setgid, sticky) and group/other write bits (:" -"const:`~stat.S_IWGRP` | :const:`~stat.S_IWOTH`)." +"Clear high mode bits (setuid, setgid, sticky) and group/other write bits " +"(:const:`~stat.S_IWGRP` | :const:`~stat.S_IWOTH`)." msgstr "" -#: ../../library/tarfile.rst:1058 ../../library/tarfile.rst:1097 +#: ../../library/tarfile.rst:1101 ../../library/tarfile.rst:1140 msgid "Return the modified ``TarInfo`` member." msgstr "" -#: ../../library/tarfile.rst:1062 +#: ../../library/tarfile.rst:1105 msgid "" "Implements the ``'data'`` filter. In addition to what ``tar_filter`` does:" msgstr "" -#: ../../library/tarfile.rst:1065 +#: ../../library/tarfile.rst:1108 msgid "" -"Normalize link targets (:attr:`TarInfo.linkname`) using :func:`os.path." -"normpath`. Note that this removes internal ``..`` components, which may " -"change the meaning of the link if the path in :attr:`!TarInfo.linkname` " -"traverses symbolic links." +"Normalize link targets (:attr:`TarInfo.linkname`) " +"using :func:`os.path.normpath`. Note that this removes internal ``..`` " +"components, which may change the meaning of the link if the path in :attr:`!" +"TarInfo.linkname` traverses symbolic links." msgstr "" -#: ../../library/tarfile.rst:1071 +#: ../../library/tarfile.rst:1114 msgid "" ":ref:`Refuse ` to extract links (hard or soft) " "that link to absolute paths, or ones that link outside the destination." msgstr "" -#: ../../library/tarfile.rst:1074 +#: ../../library/tarfile.rst:1117 msgid "" -"This raises :class:`~tarfile.AbsoluteLinkError` or :class:`~tarfile." -"LinkOutsideDestinationError`." +"This raises :class:`~tarfile.AbsoluteLinkError` " +"or :class:`~tarfile.LinkOutsideDestinationError`." msgstr "" -#: ../../library/tarfile.rst:1077 +#: ../../library/tarfile.rst:1120 msgid "" "Note that such files are refused even on platforms that do not support " "symbolic links." msgstr "" -#: ../../library/tarfile.rst:1080 +#: ../../library/tarfile.rst:1123 msgid "" ":ref:`Refuse ` to extract device files (including " "pipes). This raises :class:`~tarfile.SpecialFileError`." msgstr "" -#: ../../library/tarfile.rst:1084 +#: ../../library/tarfile.rst:1127 msgid "For regular files, including hard links:" msgstr "" -#: ../../library/tarfile.rst:1086 +#: ../../library/tarfile.rst:1129 msgid "" -"Set the owner read and write permissions (:const:`~stat.S_IRUSR` | :const:" -"`~stat.S_IWUSR`)." +"Set the owner read and write permissions (:const:`~stat.S_IRUSR` " +"| :const:`~stat.S_IWUSR`)." msgstr "" -#: ../../library/tarfile.rst:1088 +#: ../../library/tarfile.rst:1131 msgid "" -"Remove the group & other executable permission (:const:`~stat.S_IXGRP` | :" -"const:`~stat.S_IXOTH`) if the owner doesn’t have it (:const:`~stat.S_IXUSR`)." +"Remove the group & other executable permission (:const:`~stat.S_IXGRP` " +"| :const:`~stat.S_IXOTH`) if the owner doesn’t have it " +"(:const:`~stat.S_IXUSR`)." msgstr "" -#: ../../library/tarfile.rst:1092 +#: ../../library/tarfile.rst:1135 msgid "" "For other files (directories), set ``mode`` to ``None``, so that extraction " "methods skip applying permission bits." msgstr "" -#: ../../library/tarfile.rst:1094 +#: ../../library/tarfile.rst:1137 msgid "" "Set user and group info (``uid``, ``gid``, ``uname``, ``gname``) to " "``None``, so that extraction methods skip setting it." msgstr "" -#: ../../library/tarfile.rst:1101 +#: ../../library/tarfile.rst:1142 +msgid "" +"Note that this filter does not block *all* dangerous archive features. " +"See :ref:`tarfile-further-verification` for details." +msgstr "" + +#: ../../library/tarfile.rst:1147 msgid "Link targets are now normalized." msgstr "" -#: ../../library/tarfile.rst:1107 +#: ../../library/tarfile.rst:1153 msgid "Filter errors" msgstr "" -#: ../../library/tarfile.rst:1109 +#: ../../library/tarfile.rst:1155 msgid "" "When a filter refuses to extract a file, it will raise an appropriate " "exception, a subclass of :class:`~tarfile.FilterError`. This will abort the " @@ -1440,11 +1536,11 @@ msgid "" "continue." msgstr "" -#: ../../library/tarfile.rst:1117 +#: ../../library/tarfile.rst:1165 msgid "Hints for further verification" msgstr "" -#: ../../library/tarfile.rst:1119 +#: ../../library/tarfile.rst:1167 msgid "" "Even with ``filter='data'``, *tarfile* is not suited for extracting " "untrusted files without prior inspection. Among other issues, the pre-" @@ -1452,73 +1548,73 @@ msgid "" "additional checks." msgstr "" -#: ../../library/tarfile.rst:1124 +#: ../../library/tarfile.rst:1172 msgid "Here is an incomplete list of things to consider:" msgstr "" -#: ../../library/tarfile.rst:1126 +#: ../../library/tarfile.rst:1174 msgid "" -"Extract to a :func:`new temporary directory ` to prevent e." -"g. exploiting pre-existing links, and to make it easier to clean up after a " -"failed extraction." +"Extract to a :func:`new temporary directory ` to prevent " +"e.g. exploiting pre-existing links, and to make it easier to clean up after " +"a failed extraction." msgstr "" -#: ../../library/tarfile.rst:1129 +#: ../../library/tarfile.rst:1177 msgid "Disallow symbolic links if you do not need the functionality." msgstr "" -#: ../../library/tarfile.rst:1130 +#: ../../library/tarfile.rst:1178 msgid "" "When working with untrusted data, use external (e.g. OS-level) limits on " "disk, memory and CPU usage." msgstr "" -#: ../../library/tarfile.rst:1132 +#: ../../library/tarfile.rst:1180 msgid "" "Check filenames against an allow-list of characters (to filter out control " -"characters, confusables, foreign path separators, etc.)." +"characters, confusables, foreign path separators, and so on)." msgstr "" -#: ../../library/tarfile.rst:1135 +#: ../../library/tarfile.rst:1183 msgid "" "Check that filenames have expected extensions (discouraging files that " "execute when you “click on them”, or extension-less files like Windows " "special device names)." msgstr "" -#: ../../library/tarfile.rst:1137 +#: ../../library/tarfile.rst:1186 msgid "" "Limit the number of extracted files, total size of extracted data, filename " "length (including symlink length), and size of individual files." msgstr "" -#: ../../library/tarfile.rst:1139 +#: ../../library/tarfile.rst:1188 msgid "Check for files that would be shadowed on case-insensitive filesystems." msgstr "" -#: ../../library/tarfile.rst:1141 +#: ../../library/tarfile.rst:1190 msgid "Also note that:" msgstr "" -#: ../../library/tarfile.rst:1143 +#: ../../library/tarfile.rst:1192 msgid "" "Tar files may contain multiple versions of the same file. Later ones are " "expected to overwrite any earlier ones. This feature is crucial to allow " "updating tape archives, but can be abused maliciously." msgstr "" -#: ../../library/tarfile.rst:1147 +#: ../../library/tarfile.rst:1196 msgid "" "*tarfile* does not protect against issues with “live” data, e.g. an attacker " "tinkering with the destination (or source) directory while extraction (or " "archiving) is in progress." msgstr "" -#: ../../library/tarfile.rst:1153 +#: ../../library/tarfile.rst:1202 msgid "Supporting older Python versions" msgstr "" -#: ../../library/tarfile.rst:1155 +#: ../../library/tarfile.rst:1204 msgid "" "Extraction filters were added to Python 3.12, but may be backported to older " "versions as security updates. To check whether the feature is available, use " @@ -1526,18 +1622,18 @@ msgid "" "version." msgstr "" -#: ../../library/tarfile.rst:1160 +#: ../../library/tarfile.rst:1209 msgid "" "The following examples show how to support Python versions with and without " "the feature. Note that setting ``extraction_filter`` will affect any " "subsequent operations." msgstr "" -#: ../../library/tarfile.rst:1164 +#: ../../library/tarfile.rst:1213 msgid "Fully trusted archive::" msgstr "" -#: ../../library/tarfile.rst:1166 +#: ../../library/tarfile.rst:1215 msgid "" "my_tarfile.extraction_filter = (lambda member, path: member)\n" "my_tarfile.extractall()" @@ -1545,13 +1641,13 @@ msgstr "" "my_tarfile.extraction_filter = (lambda member, path: member)\n" "my_tarfile.extractall()" -#: ../../library/tarfile.rst:1169 +#: ../../library/tarfile.rst:1218 msgid "" "Use the ``'data'`` filter if available, but revert to Python 3.11 behavior " "(``'fully_trusted'``) if this feature is not available::" msgstr "" -#: ../../library/tarfile.rst:1172 +#: ../../library/tarfile.rst:1221 msgid "" "my_tarfile.extraction_filter = getattr(tarfile, 'data_filter',\n" " (lambda member, path: member))\n" @@ -1561,19 +1657,19 @@ msgstr "" " (lambda member, path: member))\n" "my_tarfile.extractall()" -#: ../../library/tarfile.rst:1176 +#: ../../library/tarfile.rst:1225 msgid "Use the ``'data'`` filter; *fail* if it is not available::" msgstr "" -#: ../../library/tarfile.rst:1178 +#: ../../library/tarfile.rst:1227 msgid "my_tarfile.extractall(filter=tarfile.data_filter)" msgstr "my_tarfile.extractall(filter=tarfile.data_filter)" -#: ../../library/tarfile.rst:1180 +#: ../../library/tarfile.rst:1229 msgid "or::" msgstr "或: ::" -#: ../../library/tarfile.rst:1182 +#: ../../library/tarfile.rst:1231 msgid "" "my_tarfile.extraction_filter = tarfile.data_filter\n" "my_tarfile.extractall()" @@ -1581,11 +1677,11 @@ msgstr "" "my_tarfile.extraction_filter = tarfile.data_filter\n" "my_tarfile.extractall()" -#: ../../library/tarfile.rst:1185 +#: ../../library/tarfile.rst:1234 msgid "Use the ``'data'`` filter; *warn* if it is not available::" msgstr "" -#: ../../library/tarfile.rst:1187 +#: ../../library/tarfile.rst:1236 msgid "" "if hasattr(tarfile, 'data_filter'):\n" " my_tarfile.extractall(filter='data')\n" @@ -1601,18 +1697,18 @@ msgstr "" " warn_the_user('Extracting may be unsafe; consider updating Python')\n" " my_tarfile.extractall()" -#: ../../library/tarfile.rst:1196 +#: ../../library/tarfile.rst:1245 msgid "Stateful extraction filter example" msgstr "" -#: ../../library/tarfile.rst:1198 +#: ../../library/tarfile.rst:1247 msgid "" "While *tarfile*'s extraction methods take a simple *filter* callable, custom " "filters may be more complex objects with an internal state. It may be useful " "to write these as context managers, to be used like this::" msgstr "" -#: ../../library/tarfile.rst:1202 +#: ../../library/tarfile.rst:1251 msgid "" "with StatefulFilter() as filter_func:\n" " tar.extractall(path, filter=filter_func)" @@ -1620,11 +1716,11 @@ msgstr "" "with StatefulFilter() as filter_func:\n" " tar.extractall(path, filter=filter_func)" -#: ../../library/tarfile.rst:1205 +#: ../../library/tarfile.rst:1254 msgid "Such a filter can be written as, for example::" msgstr "" -#: ../../library/tarfile.rst:1207 +#: ../../library/tarfile.rst:1256 msgid "" "class StatefulFilter:\n" " def __init__(self):\n" @@ -1654,107 +1750,108 @@ msgstr "" " def __exit__(self, *exc_info):\n" " print(f'{self.file_count} files extracted')" -#: ../../library/tarfile.rst:1227 +#: ../../library/tarfile.rst:1276 msgid "Command-Line Interface" msgstr "命令列介面" -#: ../../library/tarfile.rst:1231 +#: ../../library/tarfile.rst:1280 msgid "" "The :mod:`tarfile` module provides a simple command-line interface to " "interact with tar archives." msgstr "" -#: ../../library/tarfile.rst:1234 +#: ../../library/tarfile.rst:1283 msgid "" -"If you want to create a new tar archive, specify its name after the :option:" -"`-c` option and then list the filename(s) that should be included:" +"If you want to create a new tar archive, specify its name after " +"the :option:`-c` option and then list the filename(s) that should be " +"included:" msgstr "" -#: ../../library/tarfile.rst:1237 +#: ../../library/tarfile.rst:1286 msgid "$ python -m tarfile -c monty.tar spam.txt eggs.txt" msgstr "$ python -m tarfile -c monty.tar spam.txt eggs.txt" -#: ../../library/tarfile.rst:1241 +#: ../../library/tarfile.rst:1290 msgid "Passing a directory is also acceptable:" msgstr "" -#: ../../library/tarfile.rst:1243 +#: ../../library/tarfile.rst:1292 msgid "$ python -m tarfile -c monty.tar life-of-brian_1979/" msgstr "$ python -m tarfile -c monty.tar life-of-brian_1979/" -#: ../../library/tarfile.rst:1247 +#: ../../library/tarfile.rst:1296 msgid "" -"If you want to extract a tar archive into the current directory, use the :" -"option:`-e` option:" +"If you want to extract a tar archive into the current directory, use " +"the :option:`-e` option:" msgstr "" -#: ../../library/tarfile.rst:1250 +#: ../../library/tarfile.rst:1299 msgid "$ python -m tarfile -e monty.tar" msgstr "$ python -m tarfile -e monty.tar" -#: ../../library/tarfile.rst:1254 +#: ../../library/tarfile.rst:1303 msgid "" "You can also extract a tar archive into a different directory by passing the " "directory's name:" msgstr "" -#: ../../library/tarfile.rst:1257 +#: ../../library/tarfile.rst:1306 msgid "$ python -m tarfile -e monty.tar other-dir/" msgstr "$ python -m tarfile -e monty.tar other-dir/" -#: ../../library/tarfile.rst:1261 +#: ../../library/tarfile.rst:1310 msgid "For a list of the files in a tar archive, use the :option:`-l` option:" msgstr "" -#: ../../library/tarfile.rst:1263 +#: ../../library/tarfile.rst:1312 msgid "$ python -m tarfile -l monty.tar" msgstr "$ python -m tarfile -l monty.tar" -#: ../../library/tarfile.rst:1269 +#: ../../library/tarfile.rst:1318 msgid "Command-line options" msgstr "命令列選項" -#: ../../library/tarfile.rst:1274 +#: ../../library/tarfile.rst:1323 msgid "List files in a tarfile." msgstr "" -#: ../../library/tarfile.rst:1279 +#: ../../library/tarfile.rst:1328 msgid "Create tarfile from source files." msgstr "" -#: ../../library/tarfile.rst:1284 +#: ../../library/tarfile.rst:1333 msgid "" "Extract tarfile into the current directory if *output_dir* is not specified." msgstr "" -#: ../../library/tarfile.rst:1289 +#: ../../library/tarfile.rst:1338 msgid "Test whether the tarfile is valid or not." msgstr "" -#: ../../library/tarfile.rst:1293 +#: ../../library/tarfile.rst:1342 msgid "Verbose output." msgstr "" -#: ../../library/tarfile.rst:1297 +#: ../../library/tarfile.rst:1346 msgid "" "Specifies the *filter* for ``--extract``. See :ref:`tarfile-extraction-" "filter` for details. Only string names are accepted (that is, " "``fully_trusted``, ``tar``, and ``data``)." msgstr "" -#: ../../library/tarfile.rst:1305 +#: ../../library/tarfile.rst:1354 msgid "Examples" msgstr "範例" -#: ../../library/tarfile.rst:1308 +#: ../../library/tarfile.rst:1357 msgid "Reading examples" msgstr "" -#: ../../library/tarfile.rst:1310 +#: ../../library/tarfile.rst:1359 msgid "How to extract an entire tar archive to the current working directory::" msgstr "" -#: ../../library/tarfile.rst:1312 +#: ../../library/tarfile.rst:1361 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar.gz\")\n" @@ -1766,13 +1863,13 @@ msgstr "" "tar.extractall(filter='data')\n" "tar.close()" -#: ../../library/tarfile.rst:1317 +#: ../../library/tarfile.rst:1366 msgid "" "How to extract a subset of a tar archive with :meth:`TarFile.extractall` " "using a generator function instead of a list::" msgstr "" -#: ../../library/tarfile.rst:1320 +#: ../../library/tarfile.rst:1369 msgid "" "import os\n" "import tarfile\n" @@ -1798,13 +1895,13 @@ msgstr "" "tar.extractall(members=py_files(tar))\n" "tar.close()" -#: ../../library/tarfile.rst:1332 +#: ../../library/tarfile.rst:1381 msgid "" "How to read a gzip compressed tar archive and display some member " "information::" msgstr "" -#: ../../library/tarfile.rst:1334 +#: ../../library/tarfile.rst:1383 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar.gz\", \"r:gz\")\n" @@ -1820,15 +1917,15 @@ msgid "" "tar.close()" msgstr "" -#: ../../library/tarfile.rst:1347 +#: ../../library/tarfile.rst:1396 msgid "Writing examples" msgstr "" -#: ../../library/tarfile.rst:1349 +#: ../../library/tarfile.rst:1398 msgid "How to create an uncompressed tar archive from a list of filenames::" msgstr "" -#: ../../library/tarfile.rst:1351 +#: ../../library/tarfile.rst:1400 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar\", \"w\")\n" @@ -1842,11 +1939,11 @@ msgstr "" " tar.add(name)\n" "tar.close()" -#: ../../library/tarfile.rst:1357 +#: ../../library/tarfile.rst:1406 msgid "The same example using the :keyword:`with` statement::" msgstr "" -#: ../../library/tarfile.rst:1359 +#: ../../library/tarfile.rst:1408 msgid "" "import tarfile\n" "with tarfile.open(\"sample.tar\", \"w\") as tar:\n" @@ -1858,13 +1955,13 @@ msgstr "" " for name in [\"foo\", \"bar\", \"quux\"]:\n" " tar.add(name)" -#: ../../library/tarfile.rst:1364 +#: ../../library/tarfile.rst:1413 msgid "" "How to create and write an archive to stdout using :data:`sys.stdout.buffer " "` in the *fileobj* parameter in :meth:`TarFile.add`::" msgstr "" -#: ../../library/tarfile.rst:1368 +#: ../../library/tarfile.rst:1417 msgid "" "import sys\n" "import tarfile\n" @@ -1880,13 +1977,13 @@ msgstr "" " for name in [\"foo\", \"bar\", \"quux\"]:\n" " tar.add(name)" -#: ../../library/tarfile.rst:1374 +#: ../../library/tarfile.rst:1423 msgid "" "How to create an archive and reset the user information using the *filter* " "parameter in :meth:`TarFile.add`::" msgstr "" -#: ../../library/tarfile.rst:1377 +#: ../../library/tarfile.rst:1426 msgid "" "import tarfile\n" "def reset(tarinfo):\n" @@ -1906,17 +2003,17 @@ msgstr "" "tar.add(\"foo\", filter=reset)\n" "tar.close()" -#: ../../library/tarfile.rst:1390 +#: ../../library/tarfile.rst:1439 msgid "Supported tar formats" msgstr "支援的 tar 格式" -#: ../../library/tarfile.rst:1392 +#: ../../library/tarfile.rst:1441 msgid "" "There are three tar formats that can be created with the :mod:`tarfile` " "module:" msgstr "" -#: ../../library/tarfile.rst:1394 +#: ../../library/tarfile.rst:1443 msgid "" "The POSIX.1-1988 ustar format (:const:`USTAR_FORMAT`). It supports filenames " "up to a length of at best 256 characters and linknames up to 100 characters. " @@ -1924,7 +2021,7 @@ msgid "" "supported format." msgstr "" -#: ../../library/tarfile.rst:1399 +#: ../../library/tarfile.rst:1448 msgid "" "The GNU tar format (:const:`GNU_FORMAT`). It supports long filenames and " "linknames, files bigger than 8 GiB and sparse files. It is the de facto " @@ -1932,7 +2029,7 @@ msgid "" "extensions for long names, sparse file support is read-only." msgstr "" -#: ../../library/tarfile.rst:1404 +#: ../../library/tarfile.rst:1453 msgid "" "The POSIX.1-2001 pax format (:const:`PAX_FORMAT`). It is the most flexible " "format with virtually no limits. It supports long filenames and linknames, " @@ -1943,7 +2040,7 @@ msgid "" "*ustar* format. It is the current default format for new archives." msgstr "" -#: ../../library/tarfile.rst:1412 +#: ../../library/tarfile.rst:1461 msgid "" "It extends the existing *ustar* format with extra headers for information " "that cannot be stored otherwise. There are two flavours of pax headers: " @@ -1952,13 +2049,13 @@ msgid "" "in a pax header is encoded in *UTF-8* for portability reasons." msgstr "" -#: ../../library/tarfile.rst:1418 +#: ../../library/tarfile.rst:1467 msgid "" "There are some more variants of the tar format which can be read, but not " "created:" msgstr "" -#: ../../library/tarfile.rst:1421 +#: ../../library/tarfile.rst:1470 msgid "" "The ancient V7 format. This is the first tar format from Unix Seventh " "Edition, storing only regular files and directories. Names must not be " @@ -1967,17 +2064,17 @@ msgid "" "ASCII characters." msgstr "" -#: ../../library/tarfile.rst:1426 +#: ../../library/tarfile.rst:1475 msgid "" "The SunOS tar extended format. This format is a variant of the POSIX.1-2001 " "pax format, but is not compatible." msgstr "" -#: ../../library/tarfile.rst:1432 +#: ../../library/tarfile.rst:1481 msgid "Unicode issues" msgstr "" -#: ../../library/tarfile.rst:1434 +#: ../../library/tarfile.rst:1483 msgid "" "The tar format was originally conceived to make backups on tape drives with " "the main focus on preserving file system information. Nowadays tar archives " @@ -1992,13 +2089,13 @@ msgid "" "It stores non-ASCII metadata using the universal character encoding *UTF-8*." msgstr "" -#: ../../library/tarfile.rst:1446 +#: ../../library/tarfile.rst:1495 msgid "" "The details of character conversion in :mod:`tarfile` are controlled by the " "*encoding* and *errors* keyword arguments of the :class:`TarFile` class." msgstr "" -#: ../../library/tarfile.rst:1449 +#: ../../library/tarfile.rst:1498 msgid "" "*encoding* defines the character encoding to use for the metadata in the " "archive. The default value is :func:`sys.getfilesystemencoding` or " @@ -2007,7 +2104,7 @@ msgid "" "not set appropriately, this conversion may fail." msgstr "" -#: ../../library/tarfile.rst:1455 +#: ../../library/tarfile.rst:1504 msgid "" "The *errors* argument defines how characters are treated that cannot be " "converted. Possible values are listed in section :ref:`error-handlers`. The " @@ -2015,10 +2112,13 @@ msgid "" "system calls, see :ref:`os-filenames`." msgstr "" -#: ../../library/tarfile.rst:1460 +#: ../../library/tarfile.rst:1509 msgid "" "For :const:`PAX_FORMAT` archives (the default), *encoding* is generally not " "needed because all the metadata is stored using *UTF-8*. *encoding* is only " "used in the rare cases when binary pax headers are decoded or when strings " "with surrogate characters are stored." msgstr "" + +#~ msgid "See the warning for :meth:`extractall`." +#~ msgstr "參閱 :meth:`extractall` 的警告。" diff --git a/library/test.po b/library/test.po index 77d4a423c3d..ce8c1539537 100644 --- a/library/test.po +++ b/library/test.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,9 +34,9 @@ msgstr "" #: ../../library/test.rst:18 msgid "" "The :mod:`test` package contains all regression tests for Python as well as " -"the modules :mod:`test.support` and :mod:`test.regrtest`. :mod:`test." -"support` is used to enhance your tests while :mod:`test.regrtest` drives the " -"testing suite." +"the modules :mod:`test.support` " +"and :mod:`test.regrtest`. :mod:`test.support` is used to enhance your tests " +"while :mod:`test.regrtest` drives the testing suite." msgstr "" #: ../../library/test.rst:23 @@ -122,9 +122,9 @@ msgstr "" #: ../../library/test.rst:88 msgid "" -"This code pattern allows the testing suite to be run by :mod:`test." -"regrtest`, on its own as a script that supports the :mod:`unittest` CLI, or " -"via the ``python -m unittest`` CLI." +"This code pattern allows the testing suite to be run " +"by :mod:`test.regrtest`, on its own as a script that supports " +"the :mod:`unittest` CLI, or via the ``python -m unittest`` CLI." msgstr "" #: ../../library/test.rst:92 @@ -230,11 +230,11 @@ msgstr "" #: ../../library/test.rst:145 msgid "" -"When using this pattern, remember that all classes that inherit from :class:" -"`unittest.TestCase` are run as tests. The :class:`!" +"When using this pattern, remember that all classes that inherit " +"from :class:`unittest.TestCase` are run as tests. The :class:`!" "TestFuncAcceptsSequencesMixin` class in the example above does not have any " -"data and so can't be run by itself, thus it does not inherit from :class:" -"`unittest.TestCase`." +"data and so can't be run by itself, thus it does not inherit " +"from :class:`unittest.TestCase`." msgstr "" #: ../../library/test.rst:153 @@ -255,14 +255,14 @@ msgid "" "test suite, thanks to the :option:`-m` option: :program:`python -m test`. " "Under the hood, it uses :mod:`test.regrtest`; the call :program:`python -m " "test.regrtest` used in previous Python versions still works. Running the " -"script by itself automatically starts running all regression tests in the :" -"mod:`test` package. It does this by finding all modules in the package whose " -"name starts with ``test_``, importing them, and executing the function :func:" -"`test_main` if present or loading the tests via unittest.TestLoader." -"loadTestsFromModule if ``test_main`` does not exist. The names of tests to " -"execute may also be passed to the script. Specifying a single regression " -"test (:program:`python -m test test_spam`) will minimize output and only " -"print whether the test passed or failed." +"script by itself automatically starts running all regression tests in " +"the :mod:`test` package. It does this by finding all modules in the package " +"whose name starts with ``test_``, importing them, and executing the " +"function :func:`test_main` if present or loading the tests via " +"unittest.TestLoader.loadTestsFromModule if ``test_main`` does not exist. " +"The names of tests to execute may also be passed to the script. Specifying a " +"single regression test (:program:`python -m test test_spam`) will minimize " +"output and only print whether the test passed or failed." msgstr "" #: ../../library/test.rst:178 @@ -282,147 +282,173 @@ msgstr "" msgid "" "Some other ways to execute the regression tests depend on what platform the " "tests are being executed on. On Unix, you can run :program:`make test` at " -"the top-level directory where Python was built. On Windows, executing :" -"program:`rt.bat` from your :file:`PCbuild` directory will run all regression " -"tests." +"the top-level directory where Python was built. On Windows, " +"executing :program:`rt.bat` from your :file:`PCbuild` directory will run all " +"regression tests." +msgstr "" + +#: ../../library/test.rst:195 +msgid "" +"Output is colorized by default and can be :ref:`controlled using environment " +"variables `." msgstr "" -#: ../../library/test.rst:197 +#: ../../library/test.rst:201 msgid ":mod:`test.support` --- Utilities for the Python test suite" msgstr ":mod:`test.support` --- Python 測試套件的工具" -#: ../../library/test.rst:203 +#: ../../library/test.rst:207 msgid "" "The :mod:`test.support` module provides support for Python's regression test " "suite." msgstr ":mod:`test.support` 模組提供 Python 回歸測試套件的支援。" -#: ../../library/test.rst:208 +#: ../../library/test.rst:212 msgid "" ":mod:`test.support` is not a public module. It is documented here to help " "Python developers write tests. The API of this module is subject to change " "without backwards compatibility concerns between releases." msgstr "" -#: ../../library/test.rst:213 +#: ../../library/test.rst:217 msgid "This module defines the following exceptions:" msgstr "此模組定義了以下例外:" -#: ../../library/test.rst:217 +#: ../../library/test.rst:221 msgid "" -"Exception to be raised when a test fails. This is deprecated in favor of :" -"mod:`unittest`\\ -based tests and :class:`unittest.TestCase`'s assertion " +"Exception to be raised when a test fails. This is deprecated in favor " +"of :mod:`unittest`\\ -based tests and :class:`unittest.TestCase`'s assertion " "methods." msgstr "" -#: ../../library/test.rst:224 +#: ../../library/test.rst:228 msgid "" "Subclass of :exc:`unittest.SkipTest`. Raised when a resource (such as a " "network connection) is not available. Raised by the :func:`requires` " "function." msgstr "" -#: ../../library/test.rst:229 +#: ../../library/test.rst:233 msgid "The :mod:`test.support` module defines the following constants:" msgstr ":mod:`test.support` 模組定義了以下常數:" -#: ../../library/test.rst:233 +#: ../../library/test.rst:237 msgid "" "``True`` when verbose output is enabled. Should be checked when more " -"detailed information is desired about a running test. *verbose* is set by :" -"mod:`test.regrtest`." +"detailed information is desired about a running test. *verbose* is set " +"by :mod:`test.regrtest`." msgstr "" -#: ../../library/test.rst:240 +#: ../../library/test.rst:244 msgid "``True`` if the running interpreter is Jython." msgstr "如果執行的直譯器是 Jython,則為 ``True``。" -#: ../../library/test.rst:245 -msgid "``True`` if the system is Android." +#: ../../library/test.rst:249 +#, fuzzy +msgid "``True`` if ``sys.platform`` is ``android``." msgstr "如果系統是 Android,則為 ``True``。" -#: ../../library/test.rst:250 +#: ../../library/test.rst:254 +msgid "``True`` if ``sys.platform`` is ``emscripten``." +msgstr "" + +#: ../../library/test.rst:259 +#, fuzzy +msgid "``True`` if ``sys.platform`` is ``wasi``." +msgstr "如果系統是 Android,則為 ``True``。" + +#: ../../library/test.rst:264 +msgid "``True`` if ``sys.platform`` is ``ios``, ``tvos``, or ``watchos``." +msgstr "" + +#: ../../library/test.rst:269 +msgid "" +"``True`` if ``sys.platform`` is ``darwin`` or ``is_apple_mobile`` is " +"``True``." +msgstr "" + +#: ../../library/test.rst:274 msgid "Path for shell if not on Windows; otherwise ``None``." msgstr "" -#: ../../library/test.rst:255 +#: ../../library/test.rst:279 msgid "" "Timeout in seconds for tests using a network server listening on the network " "local loopback interface like ``127.0.0.1``." msgstr "" -#: ../../library/test.rst:258 +#: ../../library/test.rst:282 msgid "" "The timeout is long enough to prevent test failure: it takes into account " "that the client and the server can run in different threads or even " "different processes." msgstr "" -#: ../../library/test.rst:262 +#: ../../library/test.rst:286 msgid "" -"The timeout should be long enough for :meth:`~socket.socket.connect`, :meth:" -"`~socket.socket.recv` and :meth:`~socket.socket.send` methods of :class:" -"`socket.socket`." +"The timeout should be long enough " +"for :meth:`~socket.socket.connect`, :meth:`~socket.socket.recv` " +"and :meth:`~socket.socket.send` methods of :class:`socket.socket`." msgstr "" -#: ../../library/test.rst:266 +#: ../../library/test.rst:290 msgid "Its default value is 5 seconds." msgstr "預設值為 5 秒。" -#: ../../library/test.rst:268 +#: ../../library/test.rst:292 msgid "See also :data:`INTERNET_TIMEOUT`." msgstr "另請參閱 :data:`INTERNET_TIMEOUT`。" -#: ../../library/test.rst:273 +#: ../../library/test.rst:297 msgid "Timeout in seconds for network requests going to the internet." msgstr "" -#: ../../library/test.rst:275 +#: ../../library/test.rst:299 msgid "" "The timeout is short enough to prevent a test to wait for too long if the " "internet request is blocked for whatever reason." msgstr "" -#: ../../library/test.rst:278 +#: ../../library/test.rst:302 msgid "" "Usually, a timeout using :data:`INTERNET_TIMEOUT` should not mark a test as " -"failed, but skip the test instead: see :func:`~test.support.socket_helper." -"transient_internet`." +"failed, but skip the test instead: " +"see :func:`~test.support.socket_helper.transient_internet`." msgstr "" -#: ../../library/test.rst:282 +#: ../../library/test.rst:306 msgid "Its default value is 1 minute." msgstr "預設值為 1 分鐘。" -#: ../../library/test.rst:284 +#: ../../library/test.rst:308 msgid "See also :data:`LOOPBACK_TIMEOUT`." msgstr "另請參閱 :data:`LOOPBACK_TIMEOUT`。" -#: ../../library/test.rst:289 +#: ../../library/test.rst:313 msgid "" "Timeout in seconds to mark a test as failed if the test takes \"too long\"." msgstr "" -#: ../../library/test.rst:291 +#: ../../library/test.rst:315 msgid "" "The timeout value depends on the regrtest ``--timeout`` command line option." msgstr "" -#: ../../library/test.rst:293 +#: ../../library/test.rst:317 msgid "" "If a test using :data:`SHORT_TIMEOUT` starts to fail randomly on slow " "buildbots, use :data:`LONG_TIMEOUT` instead." msgstr "" -#: ../../library/test.rst:296 +#: ../../library/test.rst:320 msgid "Its default value is 30 seconds." msgstr "預設值為 30 秒。" -#: ../../library/test.rst:301 +#: ../../library/test.rst:325 msgid "Timeout in seconds to detect when a test hangs." msgstr "" -#: ../../library/test.rst:303 +#: ../../library/test.rst:327 msgid "" "It is long enough to reduce the risk of test failure on the slowest Python " "buildbots. It should not be used to mark a test as failed if the test takes " @@ -430,135 +456,135 @@ msgid "" "command line option." msgstr "" -#: ../../library/test.rst:308 +#: ../../library/test.rst:332 msgid "Its default value is 5 minutes." msgstr "預設值為 5 分鐘。" -#: ../../library/test.rst:310 +#: ../../library/test.rst:334 msgid "" -"See also :data:`LOOPBACK_TIMEOUT`, :data:`INTERNET_TIMEOUT` and :data:" -"`SHORT_TIMEOUT`." +"See also :data:`LOOPBACK_TIMEOUT`, :data:`INTERNET_TIMEOUT` " +"and :data:`SHORT_TIMEOUT`." msgstr "" -"請參閱 :data:`LOOPBACK_TIMEOUT`、:data:`INTERNET_TIMEOUT` 和 :data:" -"`SHORT_TIMEOUT`。" +"請參閱 :data:`LOOPBACK_TIMEOUT`、:data:`INTERNET_TIMEOUT` " +"和 :data:`SHORT_TIMEOUT`。" -#: ../../library/test.rst:316 +#: ../../library/test.rst:340 msgid "Set when tests can be skipped when they are not useful for PGO." msgstr "" -#: ../../library/test.rst:321 +#: ../../library/test.rst:345 msgid "" "A constant that is likely larger than the underlying OS pipe buffer size, to " "make writes blocking." msgstr "" -#: ../../library/test.rst:327 +#: ../../library/test.rst:351 msgid "" "``True`` if Python was built with the :c:macro:`Py_DEBUG` macro defined, " "that is, if Python was :ref:`built in debug mode `." msgstr "" -#: ../../library/test.rst:336 +#: ../../library/test.rst:360 msgid "" "A constant that is likely larger than the underlying OS socket buffer size, " "to make writes blocking." msgstr "" -#: ../../library/test.rst:342 +#: ../../library/test.rst:366 msgid "Set to the top level directory that contains :mod:`test.support`." msgstr "設定為包含 :mod:`test.support` 的頂層目錄。" -#: ../../library/test.rst:347 +#: ../../library/test.rst:371 msgid "Set to the top level directory for the test package." msgstr "設定為測試套件的頂層目錄。" -#: ../../library/test.rst:352 +#: ../../library/test.rst:376 msgid "Set to the ``data`` directory within the test package." msgstr "設定為測試套件中的 ``data`` 目錄。" -#: ../../library/test.rst:357 +#: ../../library/test.rst:381 msgid "Set to :data:`sys.maxsize` for big memory tests." msgstr "設定為 :data:`sys.maxsize` 以進行大記憶體測試。" -#: ../../library/test.rst:362 +#: ../../library/test.rst:386 msgid "" "Set by :func:`set_memlimit` as the memory limit for big memory tests. " "Limited by :data:`MAX_Py_ssize_t`." msgstr "" -#: ../../library/test.rst:368 +#: ../../library/test.rst:392 msgid "" "Set by :func:`set_memlimit` as the memory limit for big memory tests. Not " "limited by :data:`MAX_Py_ssize_t`." msgstr "" -#: ../../library/test.rst:374 +#: ../../library/test.rst:398 msgid "" -"Set to ``True`` if Python is built without docstrings (the :c:macro:" -"`WITH_DOC_STRINGS` macro is not defined). See the :option:`configure --" -"without-doc-strings <--without-doc-strings>` option." +"Set to ``True`` if Python is built without docstrings " +"(the :c:macro:`WITH_DOC_STRINGS` macro is not defined). See " +"the :option:`configure --without-doc-strings <--without-doc-strings>` option." msgstr "" -#: ../../library/test.rst:378 +#: ../../library/test.rst:402 msgid "See also the :data:`HAVE_DOCSTRINGS` variable." msgstr "另請參閱 :data:`HAVE_DOCSTRINGS` 變數。" -#: ../../library/test.rst:383 +#: ../../library/test.rst:407 msgid "" -"Set to ``True`` if function docstrings are available. See the :option:" -"`python -OO <-O>` option, which strips docstrings of functions implemented " -"in Python." +"Set to ``True`` if function docstrings are available. See " +"the :option:`python -OO <-O>` option, which strips docstrings of functions " +"implemented in Python." msgstr "" -#: ../../library/test.rst:386 +#: ../../library/test.rst:410 msgid "See also the :data:`MISSING_C_DOCSTRINGS` variable." msgstr "請參閱 :data:`MISSING_C_DOCSTRINGS` 變數。" -#: ../../library/test.rst:391 +#: ../../library/test.rst:415 msgid "Define the URL of a dedicated HTTP server for the network tests." msgstr "" -#: ../../library/test.rst:396 +#: ../../library/test.rst:420 msgid "Object that is equal to anything. Used to test mixed type comparison." msgstr "" -#: ../../library/test.rst:401 +#: ../../library/test.rst:425 msgid "" "Object that is not equal to anything (even to :data:`ALWAYS_EQ`). Used to " "test mixed type comparison." msgstr "" -#: ../../library/test.rst:407 +#: ../../library/test.rst:431 msgid "" "Object that is greater than anything (except itself). Used to test mixed " "type comparison." msgstr "" -#: ../../library/test.rst:413 +#: ../../library/test.rst:437 msgid "" "Object that is less than anything (except itself). Used to test mixed type " "comparison." msgstr "" -#: ../../library/test.rst:417 +#: ../../library/test.rst:441 msgid "The :mod:`test.support` module defines the following functions:" msgstr ":mod:`test.support` 模組定義了以下函式:" -#: ../../library/test.rst:421 +#: ../../library/test.rst:445 msgid "Run the loop body until ``break`` stops the loop." msgstr "執行迴圈主體直到 ``break`` 停止迴圈。" -#: ../../library/test.rst:423 +#: ../../library/test.rst:447 msgid "" "After *timeout* seconds, raise an :exc:`AssertionError` if *error* is true, " "or just stop the loop if *error* is false." msgstr "" -#: ../../library/test.rst:426 +#: ../../library/test.rst:450 msgid "Example::" msgstr "範例: ::" -#: ../../library/test.rst:428 +#: ../../library/test.rst:452 msgid "" "for _ in support.busy_retry(support.SHORT_TIMEOUT):\n" " if check():\n" @@ -568,11 +594,11 @@ msgstr "" " if check():\n" " break" -#: ../../library/test.rst:432 ../../library/test.rst:456 +#: ../../library/test.rst:456 ../../library/test.rst:480 msgid "Example of error=False usage::" msgstr "error=False 用法範例: ::" -#: ../../library/test.rst:434 +#: ../../library/test.rst:458 msgid "" "for _ in support.busy_retry(support.SHORT_TIMEOUT, error=False):\n" " if check():\n" @@ -586,26 +612,26 @@ msgstr "" "else:\n" " raise RuntimeError('my custom error')" -#: ../../library/test.rst:442 +#: ../../library/test.rst:466 msgid "Wait strategy that applies exponential backoff." msgstr "" -#: ../../library/test.rst:444 +#: ../../library/test.rst:468 msgid "" "Run the loop body until ``break`` stops the loop. Sleep at each loop " "iteration, but not at the first iteration. The sleep delay is doubled at " "each iteration (up to *max_delay* seconds)." msgstr "" -#: ../../library/test.rst:448 +#: ../../library/test.rst:472 msgid "See :func:`busy_retry` documentation for the parameters usage." msgstr "請見 :func:`busy_retry` 文件以瞭解參數用法。" -#: ../../library/test.rst:450 +#: ../../library/test.rst:474 msgid "Example raising an exception after SHORT_TIMEOUT seconds::" msgstr "在 SHORT_TIMEOUT 秒後引發例外的範例: ::" -#: ../../library/test.rst:452 +#: ../../library/test.rst:476 msgid "" "for _ in support.sleeping_retry(support.SHORT_TIMEOUT):\n" " if check():\n" @@ -615,7 +641,7 @@ msgstr "" " if check():\n" " break" -#: ../../library/test.rst:458 +#: ../../library/test.rst:482 msgid "" "for _ in support.sleeping_retry(support.SHORT_TIMEOUT, error=False):\n" " if check():\n" @@ -629,22 +655,22 @@ msgstr "" "else:\n" " raise RuntimeError('my custom error')" -#: ../../library/test.rst:466 +#: ../../library/test.rst:490 msgid "" "Return ``True`` if *resource* is enabled and available. The list of " "available resources is only set when :mod:`test.regrtest` is executing the " "tests." msgstr "" -#: ../../library/test.rst:473 +#: ../../library/test.rst:497 msgid "Return ``True`` if Python was not built with ``-O0`` or ``-Og``." msgstr "如果 Python 不是使用 ``-O0`` 或 ``-Og`` 建置則回傳 ``True``。" -#: ../../library/test.rst:478 +#: ../../library/test.rst:502 msgid "Return :const:`_testcapi.WITH_PYMALLOC`." msgstr "回傳 :const:`_testcapi.WITH_PYMALLOC`。" -#: ../../library/test.rst:483 +#: ../../library/test.rst:507 msgid "" "Raise :exc:`ResourceDenied` if *resource* is not available. *msg* is the " "argument to :exc:`ResourceDenied` if it is raised. Always returns ``True`` " @@ -652,88 +678,88 @@ msgid "" "tests are executed by :mod:`test.regrtest`." msgstr "" -#: ../../library/test.rst:491 +#: ../../library/test.rst:515 msgid "Return a repr of *dict* with keys sorted." msgstr "" -#: ../../library/test.rst:496 +#: ../../library/test.rst:520 msgid "" "Return the path to the file named *filename*. If no match is found " "*filename* is returned. This does not equal a failure since it could be the " "path to the file." msgstr "" -#: ../../library/test.rst:500 +#: ../../library/test.rst:524 msgid "" "Setting *subdir* indicates a relative path to use to find the file rather " "than looking directly in the path directories." msgstr "" -#: ../../library/test.rst:506 +#: ../../library/test.rst:530 msgid "Get size of a page in bytes." msgstr "" -#: ../../library/test.rst:513 +#: ../../library/test.rst:537 msgid "" "Set the :func:`sys.setswitchinterval` to the given *interval*. Defines a " "minimum interval for Android systems to prevent the system from hanging." msgstr "" -#: ../../library/test.rst:519 +#: ../../library/test.rst:543 msgid "" "Use this check to guard CPython's implementation-specific tests or to run " "them only on the implementations guarded by the arguments. This function " "returns ``True`` or ``False`` depending on the host platform. Example usage::" msgstr "" -#: ../../library/test.rst:524 +#: ../../library/test.rst:548 msgid "" "check_impl_detail() # Only on CPython (default).\n" "check_impl_detail(jython=True) # Only on Jython.\n" "check_impl_detail(cpython=False) # Everywhere except CPython." msgstr "" -#: ../../library/test.rst:531 +#: ../../library/test.rst:555 msgid "" "Set the values for :data:`max_memuse` and :data:`real_max_memuse` for big " "memory tests." msgstr "" -#: ../../library/test.rst:537 +#: ../../library/test.rst:561 msgid "" "Store the value from *stdout*. It is meant to hold the stdout at the time " "the regrtest began." msgstr "" -#: ../../library/test.rst:543 +#: ../../library/test.rst:567 msgid "" -"Return the original stdout set by :func:`record_original_stdout` or ``sys." -"stdout`` if it's not set." +"Return the original stdout set by :func:`record_original_stdout` or " +"``sys.stdout`` if it's not set." msgstr "" -#: ../../library/test.rst:549 +#: ../../library/test.rst:573 msgid "" "Return a list of command line arguments reproducing the current settings in " "``sys.flags`` and ``sys.warnoptions``." msgstr "" -#: ../../library/test.rst:555 +#: ../../library/test.rst:579 msgid "" "Return a list of command line arguments reproducing the current optimization " "settings in ``sys.flags``." msgstr "" -#: ../../library/test.rst:563 +#: ../../library/test.rst:587 msgid "" -"A context managers that temporarily replaces the named stream with :class:" -"`io.StringIO` object." +"A context managers that temporarily replaces the named stream " +"with :class:`io.StringIO` object." msgstr "" -#: ../../library/test.rst:566 +#: ../../library/test.rst:590 msgid "Example use with output streams::" msgstr "使用輸出串流的範例: ::" -#: ../../library/test.rst:568 +#: ../../library/test.rst:592 msgid "" "with captured_stdout() as stdout, captured_stderr() as stderr:\n" " print(\"hello\")\n" @@ -747,11 +773,11 @@ msgstr "" "assert stdout.getvalue() == \"hello\\n\"\n" "assert stderr.getvalue() == \"error\\n\"" -#: ../../library/test.rst:574 +#: ../../library/test.rst:598 msgid "Example use with input stream::" msgstr "使用輸入串流的範例: ::" -#: ../../library/test.rst:576 +#: ../../library/test.rst:600 msgid "" "with captured_stdin() as stdin:\n" " stdin.write('hello\\n')\n" @@ -761,11 +787,11 @@ msgid "" "self.assertEqual(captured, \"hello\")" msgstr "" -#: ../../library/test.rst:586 +#: ../../library/test.rst:610 msgid "A context manager that temporary disables :mod:`faulthandler`." msgstr "" -#: ../../library/test.rst:591 +#: ../../library/test.rst:615 msgid "" "Force as many objects as possible to be collected. This is needed because " "timely deallocation is not guaranteed by the garbage collector. This means " @@ -773,22 +799,22 @@ msgid "" "remain alive for longer than expected." msgstr "" -#: ../../library/test.rst:599 +#: ../../library/test.rst:623 msgid "" "A context manager that disables the garbage collector on entry. On exit, the " "garbage collector is restored to its prior state." msgstr "" -#: ../../library/test.rst:605 +#: ../../library/test.rst:629 msgid "Context manager to swap out an attribute with a new object." msgstr "" -#: ../../library/test.rst:607 ../../library/test.rst:625 -#: ../../library/test.rst:866 ../../library/test.rst:1332 +#: ../../library/test.rst:631 ../../library/test.rst:649 +#: ../../library/test.rst:904 ../../library/test.rst:1370 msgid "Usage::" msgstr "用法: ::" -#: ../../library/test.rst:609 +#: ../../library/test.rst:633 msgid "" "with swap_attr(obj, \"attr\", 5):\n" " ..." @@ -796,24 +822,24 @@ msgstr "" "with swap_attr(obj, \"attr\", 5):\n" " ..." -#: ../../library/test.rst:612 +#: ../../library/test.rst:636 msgid "" "This will set ``obj.attr`` to 5 for the duration of the ``with`` block, " "restoring the old value at the end of the block. If ``attr`` doesn't exist " "on ``obj``, it will be created and then deleted at the end of the block." msgstr "" -#: ../../library/test.rst:617 ../../library/test.rst:635 +#: ../../library/test.rst:641 ../../library/test.rst:659 msgid "" "The old value (or ``None`` if it doesn't exist) will be assigned to the " "target of the \"as\" clause, if there is one." msgstr "" -#: ../../library/test.rst:623 +#: ../../library/test.rst:647 msgid "Context manager to swap out an item with a new object." msgstr "" -#: ../../library/test.rst:627 +#: ../../library/test.rst:651 msgid "" "with swap_item(obj, \"item\", 5):\n" " ..." @@ -821,80 +847,80 @@ msgstr "" "with swap_item(obj, \"item\", 5):\n" " ..." -#: ../../library/test.rst:630 +#: ../../library/test.rst:654 msgid "" "This will set ``obj[\"item\"]`` to 5 for the duration of the ``with`` block, " "restoring the old value at the end of the block. If ``item`` doesn't exist " "on ``obj``, it will be created and then deleted at the end of the block." msgstr "" -#: ../../library/test.rst:641 +#: ../../library/test.rst:665 msgid "" -"Call the ``flush()`` method on :data:`sys.stdout` and then on :data:`sys." -"stderr`. It can be used to make sure that the logs order is consistent " -"before writing into stderr." +"Call the ``flush()`` method on :data:`sys.stdout` and then " +"on :data:`sys.stderr`. It can be used to make sure that the logs order is " +"consistent before writing into stderr." msgstr "" -#: ../../library/test.rst:650 +#: ../../library/test.rst:674 msgid "" "Print a warning into :data:`sys.__stderr__`. Format the message as: " "``f\"Warning -- {msg}\"``. If *msg* is made of multiple lines, add " "``\"Warning -- \"`` prefix to each line." msgstr "" -#: ../../library/test.rst:659 +#: ../../library/test.rst:683 msgid "" "Wait until process *pid* completes and check that the process exit code is " "*exitcode*." msgstr "" -#: ../../library/test.rst:662 +#: ../../library/test.rst:686 msgid "" "Raise an :exc:`AssertionError` if the process exit code is not equal to " "*exitcode*." msgstr "如果行程退出代號不等於 *exitcode* 則引發 :exc:`AssertionError`。" -#: ../../library/test.rst:665 +#: ../../library/test.rst:689 msgid "" "If the process runs longer than *timeout* seconds (:data:`SHORT_TIMEOUT` by " "default), kill the process and raise an :exc:`AssertionError`. The timeout " "feature is not available on Windows." msgstr "" -#: ../../library/test.rst:674 +#: ../../library/test.rst:698 msgid "" "Return the size of the :c:type:`PyObject` whose structure members are " "defined by *fmt*. The returned value includes the size of the Python object " "header and alignment." msgstr "" -#: ../../library/test.rst:680 +#: ../../library/test.rst:704 msgid "" "Return the size of the :c:type:`PyVarObject` whose structure members are " "defined by *fmt*. The returned value includes the size of the Python object " "header and alignment." msgstr "" -#: ../../library/test.rst:686 +#: ../../library/test.rst:710 msgid "" "For testcase *test*, assert that the ``sys.getsizeof`` for *o* plus the GC " "header size equals *size*." msgstr "" -#: ../../library/test.rst:692 +#: ../../library/test.rst:716 msgid "" -"A decorator to conditionally mark tests with :func:`unittest." -"expectedFailure`. Any use of this decorator should have an associated " -"comment identifying the relevant tracker issue." +"A decorator to conditionally mark tests " +"with :func:`unittest.expectedFailure`. Any use of this decorator should have " +"an associated comment identifying the relevant tracker issue." msgstr "" -#: ../../library/test.rst:699 +#: ../../library/test.rst:723 msgid "" "A decorator that skips the decorated test on TLS certification validation " "failures." msgstr "" -#: ../../library/test.rst:704 +#: ../../library/test.rst:728 msgid "" "A decorator for running a function in a different locale, correctly " "resetting it after it has finished. *catstr* is the locale category as a " @@ -902,85 +928,91 @@ msgid "" "sequentially, and the first valid locale will be used." msgstr "" -#: ../../library/test.rst:712 +#: ../../library/test.rst:736 msgid "" "A decorator for running a function in a specific timezone, correctly " "resetting it after it has finished." msgstr "" -#: ../../library/test.rst:718 +#: ../../library/test.rst:742 msgid "" "Decorator for the minimum version when running test on FreeBSD. If the " "FreeBSD version is less than the minimum, the test is skipped." msgstr "" -#: ../../library/test.rst:724 +#: ../../library/test.rst:748 msgid "" "Decorator for the minimum version when running test on Linux. If the Linux " "version is less than the minimum, the test is skipped." msgstr "" -#: ../../library/test.rst:730 +#: ../../library/test.rst:754 msgid "" "Decorator for the minimum version when running test on macOS. If the macOS " "version is less than the minimum, the test is skipped." msgstr "" -#: ../../library/test.rst:736 +#: ../../library/test.rst:760 msgid "" "Decorator for skipping tests on the free-threaded build. If the :term:`GIL` " "is disabled, the test is skipped." msgstr "" -#: ../../library/test.rst:742 +#: ../../library/test.rst:766 msgid "Decorator for skipping tests on non-IEEE 754 platforms." msgstr "" -#: ../../library/test.rst:747 +#: ../../library/test.rst:771 msgid "Decorator for skipping tests if :mod:`zlib` doesn't exist." msgstr "如果 :mod:`zlib` 不存在則跳過測試的裝飾器。" -#: ../../library/test.rst:752 +#: ../../library/test.rst:776 msgid "Decorator for skipping tests if :mod:`gzip` doesn't exist." msgstr "如果 :mod:`gzip` 不存在則跳過測試的裝飾器。" -#: ../../library/test.rst:757 +#: ../../library/test.rst:781 msgid "Decorator for skipping tests if :mod:`bz2` doesn't exist." msgstr "如果 :mod:`bz2` 不存在則跳過測試的裝飾器。" -#: ../../library/test.rst:762 +#: ../../library/test.rst:786 msgid "Decorator for skipping tests if :mod:`lzma` doesn't exist." msgstr "如果 :mod:`lzma` 不存在則跳過測試的裝飾器。" -#: ../../library/test.rst:767 +#: ../../library/test.rst:791 msgid "Decorator for skipping tests if *resource* is not available." msgstr "如果 *resource* 不可用則跳過測試的裝飾器。" -#: ../../library/test.rst:772 +#: ../../library/test.rst:796 msgid "Decorator for only running the test if :data:`HAVE_DOCSTRINGS`." msgstr "" -#: ../../library/test.rst:777 +#: ../../library/test.rst:801 msgid "" "Decorator for only running the test if :ref:`Limited C API ` " "is available." msgstr "" -#: ../../library/test.rst:783 +#: ../../library/test.rst:807 msgid "Decorator for tests only applicable to CPython." msgstr "" -#: ../../library/test.rst:788 +#: ../../library/test.rst:812 msgid "" "Decorator for invoking :func:`check_impl_detail` on *guards*. If that " "returns ``False``, then uses *msg* as the reason for skipping the test." msgstr "" -#: ../../library/test.rst:794 +#: ../../library/test.rst:817 +msgid "" +"Decorator for marking tests as thread-unsafe. This test always runs in one " +"thread even when invoked with ``--parallel-threads``." +msgstr "" + +#: ../../library/test.rst:823 msgid "Decorator to temporarily turn off tracing for the duration of the test." msgstr "" -#: ../../library/test.rst:799 +#: ../../library/test.rst:828 msgid "" "Decorator for tests which involve reference counting. The decorator does " "not run the test if it is not run by CPython. Any trace function is unset " @@ -988,11 +1020,11 @@ msgid "" "trace function." msgstr "" -#: ../../library/test.rst:807 +#: ../../library/test.rst:836 msgid "Decorator for bigmem tests." msgstr "大記憶體測試的裝飾器。" -#: ../../library/test.rst:809 +#: ../../library/test.rst:838 msgid "" "*size* is a requested size for the test (in arbitrary, test-interpreted " "units.) *memuse* is the number of bytes per unit for the test, or a good " @@ -1000,7 +1032,7 @@ msgid "" "each, could be decorated with ``@bigmemtest(size=_4G, memuse=2)``." msgstr "" -#: ../../library/test.rst:814 +#: ../../library/test.rst:843 msgid "" "The *size* argument is normally passed to the decorated test method as an " "extra argument. If *dry_run* is ``True``, the value passed to the test " @@ -1008,11 +1040,20 @@ msgid "" "means the test doesn't support dummy runs when ``-M`` is not specified." msgstr "" -#: ../../library/test.rst:822 +#: ../../library/test.rst:851 msgid "Decorator for tests that fill the address space." msgstr "" -#: ../../library/test.rst:827 +#: ../../library/test.rst:856 +msgid "" +"Return ``False`` if there is no evidence the interpreter was compiled with " +"``musl``, otherwise return a version triple, either ``(0, 0, 0)`` if the " +"version is unknown, or the actual version if it is known. Intended for use " +"in ``skip`` decorators. ``emscripten`` and ``wasi`` are assumed to be " +"compiled with ``musl``; otherwise ``platform.libc_ver`` is checked." +msgstr "" + +#: ../../library/test.rst:865 msgid "" "Test for syntax errors in *statement* by attempting to compile *statement*. " "*testcase* is the :mod:`unittest` instance for the test. *errtext* is the " @@ -1022,44 +1063,44 @@ msgid "" "of the exception." msgstr "" -#: ../../library/test.rst:837 +#: ../../library/test.rst:875 msgid "Open *url*. If open fails, raises :exc:`TestFailed`." msgstr "" -#: ../../library/test.rst:842 +#: ../../library/test.rst:880 msgid "" "Use this at the end of ``test_main`` whenever sub-processes are started. " "This will help ensure that no extra children (zombies) stick around to hog " "resources and create problems when looking for refleaks." msgstr "" -#: ../../library/test.rst:849 +#: ../../library/test.rst:887 msgid "" "Get an attribute, raising :exc:`unittest.SkipTest` if :exc:`AttributeError` " "is raised." msgstr "" -#: ../../library/test.rst:855 +#: ../../library/test.rst:893 msgid "" -"Context manager catching unraisable exception using :func:`sys." -"unraisablehook`." +"Context manager catching unraisable exception " +"using :func:`sys.unraisablehook`." msgstr "" -#: ../../library/test.rst:858 +#: ../../library/test.rst:896 msgid "" "Storing the exception value (``cm.unraisable.exc_value``) creates a " "reference cycle. The reference cycle is broken explicitly when the context " "manager exits." msgstr "" -#: ../../library/test.rst:862 +#: ../../library/test.rst:900 msgid "" "Storing the object (``cm.unraisable.object``) can resurrect it if it is set " "to an object which is being finalized. Exiting the context manager clears " "the stored object." msgstr "" -#: ../../library/test.rst:868 +#: ../../library/test.rst:906 msgid "" "with support.catch_unraisable_exception() as cm:\n" " # code creating an \"unraisable exception\"\n" @@ -1072,7 +1113,7 @@ msgid "" "# (to break a reference cycle)" msgstr "" -#: ../../library/test.rst:883 +#: ../../library/test.rst:921 msgid "" "Generic implementation of the :mod:`unittest` ``load_tests`` protocol for " "use in test packages. *pkg_dir* is the root directory of the package; " @@ -1081,7 +1122,7 @@ msgid "" "the following::" msgstr "" -#: ../../library/test.rst:889 +#: ../../library/test.rst:927 msgid "" "import os\n" "from test.support import load_package_tests\n" @@ -1095,14 +1136,14 @@ msgstr "" "def load_tests(*args):\n" " return load_package_tests(os.path.dirname(__file__), *args)" -#: ../../library/test.rst:898 +#: ../../library/test.rst:936 msgid "" "Returns the set of attributes, functions or methods of *ref_api* not found " "on *other_api*, except for a defined list of items to be ignored in this " "check specified in *ignore*." msgstr "" -#: ../../library/test.rst:902 +#: ../../library/test.rst:940 msgid "" "By default this skips private attributes beginning with '_' but includes all " "magic methods, i.e. those starting and ending in '__'." @@ -1110,42 +1151,42 @@ msgstr "" "這預設會跳過以 '_' 開頭的私有屬性,但會包含所有魔術方法,即以 '__' 開頭和結尾" "的方法。" -#: ../../library/test.rst:910 +#: ../../library/test.rst:948 msgid "" "Override *object_to_patch.attr_name* with *new_value*. Also add cleanup " "procedure to *test_instance* to restore *object_to_patch* for *attr_name*. " "The *attr_name* should be a valid attribute for *object_to_patch*." msgstr "" -#: ../../library/test.rst:918 +#: ../../library/test.rst:956 msgid "" -"Run *code* in subinterpreter. Raise :exc:`unittest.SkipTest` if :mod:" -"`tracemalloc` is enabled." +"Run *code* in subinterpreter. Raise :exc:`unittest.SkipTest` " +"if :mod:`tracemalloc` is enabled." msgstr "" -#: ../../library/test.rst:924 +#: ../../library/test.rst:962 msgid "Assert instances of *cls* are deallocated after iterating." msgstr "" -#: ../../library/test.rst:929 +#: ../../library/test.rst:967 msgid "" "Check for the existence of the compiler executables whose names are listed " "in *cmd_names* or all the compiler executables when *cmd_names* is empty and " "return the first missing executable or ``None`` when none is found missing." msgstr "" -#: ../../library/test.rst:937 +#: ../../library/test.rst:975 msgid "" "Assert that the ``__all__`` variable of *module* contains all public names." msgstr "" -#: ../../library/test.rst:939 +#: ../../library/test.rst:977 msgid "" "The module's public names (its API) are detected automatically based on " "whether they match the public name convention and were defined in *module*." msgstr "" -#: ../../library/test.rst:943 +#: ../../library/test.rst:981 msgid "" "The *name_of_module* argument can specify (as a string or tuple thereof) " "what module(s) an API could be defined in order to be detected as a public " @@ -1153,25 +1194,25 @@ msgid "" "other modules, possibly a C backend (like ``csv`` and its ``_csv``)." msgstr "" -#: ../../library/test.rst:948 +#: ../../library/test.rst:986 msgid "" "The *extra* argument can be a set of names that wouldn't otherwise be " -"automatically detected as \"public\", like objects without a proper :attr:" -"`~definition.__module__` attribute. If provided, it will be added to the " -"automatically detected ones." +"automatically detected as \"public\", like objects without a " +"proper :attr:`~definition.__module__` attribute. If provided, it will be " +"added to the automatically detected ones." msgstr "" -#: ../../library/test.rst:952 +#: ../../library/test.rst:990 msgid "" "The *not_exported* argument can be a set of names that must not be treated " "as part of the public API even though their names indicate otherwise." msgstr "" -#: ../../library/test.rst:955 ../../library/test.rst:1582 +#: ../../library/test.rst:993 ../../library/test.rst:1630 msgid "Example use::" msgstr "用法範例: ::" -#: ../../library/test.rst:957 +#: ../../library/test.rst:995 msgid "" "import bar\n" "import foo\n" @@ -1191,129 +1232,131 @@ msgid "" " extra=extra, not_exported=not_exported)" msgstr "" -#: ../../library/test.rst:978 +#: ../../library/test.rst:1016 msgid "" "Skip tests if the :mod:`multiprocessing.synchronize` module is missing, if " "there is no available semaphore implementation, or if creating a lock raises " "an :exc:`OSError`." msgstr "" -#: ../../library/test.rst:987 +#: ../../library/test.rst:1025 msgid "Assert that type *tp* cannot be instantiated using *args* and *kwds*." msgstr "" -#: ../../library/test.rst:994 +#: ../../library/test.rst:1032 msgid "" -"This function returns a context manager that will change the global :func:" -"`sys.set_int_max_str_digits` setting for the duration of the context to " -"allow execution of test code that needs a different limit on the number of " -"digits when converting between an integer and string." +"This function returns a context manager that will change the " +"global :func:`sys.set_int_max_str_digits` setting for the duration of the " +"context to allow execution of test code that needs a different limit on the " +"number of digits when converting between an integer and string." msgstr "" -#: ../../library/test.rst:1002 +#: ../../library/test.rst:1040 msgid "The :mod:`test.support` module defines the following classes:" msgstr ":mod:`test.support` 模組定義了以下類別:" -#: ../../library/test.rst:1007 +#: ../../library/test.rst:1045 msgid "" "A context manager used to try to prevent crash dialog popups on tests that " "are expected to crash a subprocess." msgstr "" -#: ../../library/test.rst:1010 +#: ../../library/test.rst:1048 msgid "" "On Windows, it disables Windows Error Reporting dialogs using `SetErrorMode " "`_." msgstr "" -#: ../../library/test.rst:1013 +#: ../../library/test.rst:1051 msgid "" -"On UNIX, :func:`resource.setrlimit` is used to set :const:`resource." -"RLIMIT_CORE`'s soft limit to 0 to prevent coredump file creation." +"On UNIX, :func:`resource.setrlimit` is used to " +"set :const:`resource.RLIMIT_CORE`'s soft limit to 0 to prevent coredump file " +"creation." msgstr "" -#: ../../library/test.rst:1017 +#: ../../library/test.rst:1055 msgid "" "On both platforms, the old value is restored by :meth:`~object.__exit__`." msgstr "在兩個平台上,舊值會被 :meth:`~object.__exit__` 還原。" -#: ../../library/test.rst:1022 +#: ../../library/test.rst:1060 msgid "" "Class to save and restore signal handlers registered by the Python signal " "handler." msgstr "" -#: ../../library/test.rst:1027 +#: ../../library/test.rst:1065 msgid "" "Save the signal handlers to a dictionary mapping signal numbers to the " "current signal handler." msgstr "" -#: ../../library/test.rst:1032 +#: ../../library/test.rst:1070 msgid "" "Set the signal numbers from the :meth:`save` dictionary to the saved handler." msgstr "" -#: ../../library/test.rst:1040 +#: ../../library/test.rst:1078 msgid "Try to match a single dict with the supplied arguments." msgstr "" -#: ../../library/test.rst:1045 +#: ../../library/test.rst:1083 msgid "Try to match a single stored value (*dv*) with a supplied value (*v*)." msgstr "" -#: ../../library/test.rst:1049 +#: ../../library/test.rst:1087 msgid ":mod:`test.support.socket_helper` --- Utilities for socket tests" msgstr ":mod:`test.support.socket_helper` --- 用於 socket 測試的工具" -#: ../../library/test.rst:1055 +#: ../../library/test.rst:1093 msgid "" "The :mod:`test.support.socket_helper` module provides support for socket " "tests." msgstr "" -#: ../../library/test.rst:1062 +#: ../../library/test.rst:1100 msgid "Set to ``True`` if IPv6 is enabled on this host, ``False`` otherwise." msgstr "" -#: ../../library/test.rst:1067 +#: ../../library/test.rst:1105 msgid "" "Returns an unused port that should be suitable for binding. This is " "achieved by creating a temporary socket with the same family and type as the " -"``sock`` parameter (default is :const:`~socket.AF_INET`, :const:`~socket." -"SOCK_STREAM`), and binding it to the specified host address (defaults to " -"``0.0.0.0``) with the port set to 0, eliciting an unused ephemeral port from " -"the OS. The temporary socket is then closed and deleted, and the ephemeral " -"port is returned." +"``sock`` parameter (default " +"is :const:`~socket.AF_INET`, :const:`~socket.SOCK_STREAM`), and binding it " +"to the specified host address (defaults to ``0.0.0.0``) with the port set to " +"0, eliciting an unused ephemeral port from the OS. The temporary socket is " +"then closed and deleted, and the ephemeral port is returned." msgstr "" -#: ../../library/test.rst:1076 +#: ../../library/test.rst:1114 msgid "" "Either this method or :func:`bind_port` should be used for any tests where a " "server socket needs to be bound to a particular port for the duration of the " "test. Which one to use depends on whether the calling code is creating a " "Python socket, or if an unused port needs to be provided in a constructor or " "passed to an external program (i.e. the ``-accept`` argument to openssl's " -"s_server mode). Always prefer :func:`bind_port` over :func:" -"`find_unused_port` where possible. Using a hard coded port is discouraged " -"since it can make multiple instances of the test impossible to run " -"simultaneously, which is a problem for buildbots." +"s_server mode). Always prefer :func:`bind_port` " +"over :func:`find_unused_port` where possible. Using a hard coded port is " +"discouraged since it can make multiple instances of the test impossible to " +"run simultaneously, which is a problem for buildbots." msgstr "" -#: ../../library/test.rst:1090 +#: ../../library/test.rst:1128 msgid "" "Bind the socket to a free port and return the port number. Relies on " "ephemeral ports in order to ensure we are using an unbound port. This is " "important as many tests may be running simultaneously, especially in a " -"buildbot environment. This method raises an exception if the ``sock." -"family`` is :const:`~socket.AF_INET` and ``sock.type`` is :const:`~socket." -"SOCK_STREAM`, and the socket has :const:`~socket.SO_REUSEADDR` or :const:" -"`~socket.SO_REUSEPORT` set on it. Tests should never set these socket " -"options for TCP/IP sockets. The only case for setting these options is " -"testing multicasting via multiple UDP sockets." +"buildbot environment. This method raises an exception if the " +"``sock.family`` is :const:`~socket.AF_INET` and ``sock.type`` " +"is :const:`~socket.SOCK_STREAM`, and the socket " +"has :const:`~socket.SO_REUSEADDR` or :const:`~socket.SO_REUSEPORT` set on " +"it. Tests should never set these socket options for TCP/IP sockets. The only " +"case for setting these options is testing multicasting via multiple UDP " +"sockets." msgstr "" -#: ../../library/test.rst:1101 +#: ../../library/test.rst:1139 msgid "" "Additionally, if the :const:`~socket.SO_EXCLUSIVEADDRUSE` socket option is " "available (i.e. on Windows), it will be set on the socket. This will " @@ -1321,59 +1364,59 @@ msgid "" "test." msgstr "" -#: ../../library/test.rst:1109 +#: ../../library/test.rst:1147 msgid "" -"Bind a Unix socket, raising :exc:`unittest.SkipTest` if :exc:" -"`PermissionError` is raised." +"Bind a Unix socket, raising :exc:`unittest.SkipTest` " +"if :exc:`PermissionError` is raised." msgstr "" -#: ../../library/test.rst:1115 +#: ../../library/test.rst:1153 msgid "" "A decorator for running tests that require a functional ``bind()`` for Unix " "sockets." msgstr "" -#: ../../library/test.rst:1121 +#: ../../library/test.rst:1159 msgid "" "A context manager that raises :exc:`~test.support.ResourceDenied` when " "various issues with the internet connection manifest themselves as " "exceptions." msgstr "" -#: ../../library/test.rst:1127 +#: ../../library/test.rst:1165 msgid "" ":mod:`test.support.script_helper` --- Utilities for the Python execution " "tests" msgstr ":mod:`test.support.script_helper` --- 用於 Python 執行測試的工具" -#: ../../library/test.rst:1133 +#: ../../library/test.rst:1171 msgid "" "The :mod:`test.support.script_helper` module provides support for Python's " "script execution tests." msgstr "" ":mod:`test.support.script_helper` 模組提供 Python 的腳本執行測試的支援。" -#: ../../library/test.rst:1138 +#: ../../library/test.rst:1176 msgid "" "Return ``True`` if ``sys.executable interpreter`` requires environment " "variables in order to be able to run at all." msgstr "" -#: ../../library/test.rst:1141 +#: ../../library/test.rst:1179 msgid "" "This is designed to be used with ``@unittest.skipIf()`` to annotate tests " "that need to use an ``assert_python*()`` function to launch an isolated mode " "(``-I``) or no environment mode (``-E``) sub-interpreter process." msgstr "" -#: ../../library/test.rst:1145 +#: ../../library/test.rst:1183 msgid "" "A normal build & test does not run into this situation but it can happen " "when trying to run the standard library test suite from an interpreter that " "doesn't have an obvious home with Python's current home finding logic." msgstr "" -#: ../../library/test.rst:1149 +#: ../../library/test.rst:1187 msgid "" "Setting :envvar:`PYTHONHOME` is one way to get most of the testsuite to run " "in that situation. :envvar:`PYTHONPATH` or :envvar:`PYTHONUSERSITE` are " @@ -1381,85 +1424,85 @@ msgid "" "interpreter can start." msgstr "" -#: ../../library/test.rst:1157 +#: ../../library/test.rst:1195 msgid "" "Set up the environment based on *env_vars* for running the interpreter in a " "subprocess. The values can include ``__isolated``, ``__cleanenv``, " "``__cwd``, and ``TERM``." msgstr "" -#: ../../library/test.rst:1161 ../../library/test.rst:1177 -#: ../../library/test.rst:1189 +#: ../../library/test.rst:1199 ../../library/test.rst:1215 +#: ../../library/test.rst:1227 msgid "The function no longer strips whitespaces from *stderr*." msgstr "此函式不再從 *stderr* 中移除空白。" -#: ../../library/test.rst:1167 +#: ../../library/test.rst:1205 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* succeeds (``rc == 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" -#: ../../library/test.rst:1171 +#: ../../library/test.rst:1209 msgid "" "If the *__cleanenv* keyword-only parameter is set, *env_vars* is used as a " "fresh environment." msgstr "" -#: ../../library/test.rst:1174 +#: ../../library/test.rst:1212 msgid "" "Python is started in isolated mode (command line option ``-I``), except if " "the *__isolated* keyword-only parameter is set to ``False``." msgstr "" -#: ../../library/test.rst:1183 +#: ../../library/test.rst:1221 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* fails (``rc != 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" -#: ../../library/test.rst:1187 +#: ../../library/test.rst:1225 msgid "See :func:`assert_python_ok` for more options." msgstr "更多選項請見 :func:`assert_python_ok`。" -#: ../../library/test.rst:1195 +#: ../../library/test.rst:1233 msgid "Run a Python subprocess with the given arguments." msgstr "" -#: ../../library/test.rst:1197 +#: ../../library/test.rst:1235 msgid "" -"*kw* is extra keyword args to pass to :func:`subprocess.Popen`. Returns a :" -"class:`subprocess.Popen` object." +"*kw* is extra keyword args to pass to :func:`subprocess.Popen`. Returns " +"a :class:`subprocess.Popen` object." msgstr "" -#: ../../library/test.rst:1203 +#: ../../library/test.rst:1241 msgid "" "Run the given :class:`subprocess.Popen` process until completion and return " "stdout." msgstr "" -#: ../../library/test.rst:1209 +#: ../../library/test.rst:1247 msgid "" "Create script containing *source* in path *script_dir* and " "*script_basename*. If *omit_suffix* is ``False``, append ``.py`` to the " "name. Return the full script path." msgstr "" -#: ../../library/test.rst:1216 +#: ../../library/test.rst:1254 msgid "" "Create zip file at *zip_dir* and *zip_basename* with extension ``zip`` which " "contains the files in *script_name*. *name_in_zip* is the archive name. " "Return a tuple containing ``(full path, full path of archive name)``." msgstr "" -#: ../../library/test.rst:1223 +#: ../../library/test.rst:1261 msgid "" "Create a directory named *pkg_dir* containing an ``__init__`` file with " "*init_source* as its contents." msgstr "" -#: ../../library/test.rst:1230 +#: ../../library/test.rst:1268 msgid "" "Create a zip package directory with a path of *zip_dir* and *zip_basename* " "containing an empty ``__init__`` file and a file *script_basename* " @@ -1468,62 +1511,62 @@ msgid "" "path and the archive name for the zip file." msgstr "" -#: ../../library/test.rst:1238 +#: ../../library/test.rst:1276 msgid "" ":mod:`test.support.bytecode_helper` --- Support tools for testing correct " "bytecode generation" msgstr "" ":mod:`test.support.bytecode_helper` --- 用於測試位元組碼能正確產生的支援工具" -#: ../../library/test.rst:1243 +#: ../../library/test.rst:1281 msgid "" "The :mod:`test.support.bytecode_helper` module provides support for testing " "and inspecting bytecode generation." msgstr "" ":mod:`test.support.bytecode_helper` 模組提供測試和檢查位元組碼產生的支援。" -#: ../../library/test.rst:1248 +#: ../../library/test.rst:1286 msgid "The module defines the following class:" msgstr "此模組定義了以下類別:" -#: ../../library/test.rst:1252 +#: ../../library/test.rst:1290 msgid "This class has custom assertion methods for inspecting bytecode." msgstr "" -#: ../../library/test.rst:1256 +#: ../../library/test.rst:1294 msgid "Return the disassembly of *co* as string." msgstr "" -#: ../../library/test.rst:1261 +#: ../../library/test.rst:1299 msgid "" "Return instr if *opname* is found, otherwise throws :exc:`AssertionError`." msgstr "" -#: ../../library/test.rst:1266 +#: ../../library/test.rst:1304 msgid "Throws :exc:`AssertionError` if *opname* is found." msgstr "" -#: ../../library/test.rst:1270 +#: ../../library/test.rst:1308 msgid ":mod:`test.support.threading_helper` --- Utilities for threading tests" msgstr "" -#: ../../library/test.rst:1275 +#: ../../library/test.rst:1313 msgid "" "The :mod:`test.support.threading_helper` module provides support for " "threading tests." msgstr "" -#: ../../library/test.rst:1282 +#: ../../library/test.rst:1320 msgid "" "Join a *thread* within *timeout*. Raise an :exc:`AssertionError` if thread " "is still alive after *timeout* seconds." msgstr "" -#: ../../library/test.rst:1288 +#: ../../library/test.rst:1326 msgid "Decorator to ensure the threads are cleaned up even if the test fails." msgstr "" -#: ../../library/test.rst:1293 +#: ../../library/test.rst:1331 msgid "" "Context manager to start *threads*, which is a sequence of threads. *unlock* " "is a function called after the threads are started, even if an exception was " @@ -1531,57 +1574,57 @@ msgid "" "will attempt to join the started threads upon exit." msgstr "" -#: ../../library/test.rst:1301 +#: ../../library/test.rst:1339 msgid "" "Cleanup up threads not specified in *original_values*. Designed to emit a " "warning if a test leaves running threads in the background." msgstr "" -#: ../../library/test.rst:1307 +#: ../../library/test.rst:1345 msgid "Return current thread count and copy of dangling threads." msgstr "" -#: ../../library/test.rst:1312 +#: ../../library/test.rst:1350 msgid "" "Context manager to wait until all threads created in the ``with`` statement " "exit." msgstr "" -#: ../../library/test.rst:1318 +#: ../../library/test.rst:1356 msgid "" -"Context manager catching :class:`threading.Thread` exception using :func:" -"`threading.excepthook`." +"Context manager catching :class:`threading.Thread` exception " +"using :func:`threading.excepthook`." msgstr "" -#: ../../library/test.rst:1321 +#: ../../library/test.rst:1359 msgid "Attributes set when an exception is caught:" msgstr "當捕捉到例外時會設定的屬性:" -#: ../../library/test.rst:1323 +#: ../../library/test.rst:1361 msgid "``exc_type``" msgstr "``exc_type``" -#: ../../library/test.rst:1324 +#: ../../library/test.rst:1362 msgid "``exc_value``" msgstr "``exc_value``" -#: ../../library/test.rst:1325 +#: ../../library/test.rst:1363 msgid "``exc_traceback``" msgstr "``exc_traceback``" -#: ../../library/test.rst:1326 +#: ../../library/test.rst:1364 msgid "``thread``" msgstr "``thread``" -#: ../../library/test.rst:1328 +#: ../../library/test.rst:1366 msgid "See :func:`threading.excepthook` documentation." msgstr "參閱 :func:`threading.excepthook` 文件。" -#: ../../library/test.rst:1330 +#: ../../library/test.rst:1368 msgid "These attributes are deleted at the context manager exit." msgstr "這些屬性會在離開情境管理器時被刪除。" -#: ../../library/test.rst:1334 +#: ../../library/test.rst:1372 msgid "" "with threading_helper.catch_threading_exception() as cm:\n" " # code spawning a thread which raises an exception\n" @@ -1596,29 +1639,35 @@ msgid "" "# (to avoid reference cycles)" msgstr "" -#: ../../library/test.rst:1350 +#: ../../library/test.rst:1389 +msgid "" +"Run the worker function concurrently in multiple threads. Re-raises an " +"exception if any thread raises one, after all threads have finished." +msgstr "" + +#: ../../library/test.rst:1395 msgid ":mod:`test.support.os_helper` --- Utilities for os tests" msgstr ":mod:`test.support.os_helper` --- 用於 os 測試的工具" -#: ../../library/test.rst:1355 +#: ../../library/test.rst:1400 msgid "The :mod:`test.support.os_helper` module provides support for os tests." msgstr ":mod:`test.support.os_helper` 模組提供 os 測試的支援。" -#: ../../library/test.rst:1362 +#: ../../library/test.rst:1407 msgid "A non-ASCII character encodable by :func:`os.fsencode`." msgstr "" -#: ../../library/test.rst:1367 +#: ../../library/test.rst:1412 msgid "Set to :func:`os.getcwd`." msgstr "設定為 :func:`os.getcwd`。" -#: ../../library/test.rst:1372 +#: ../../library/test.rst:1417 msgid "" "Set to a name that is safe to use as the name of a temporary file. Any " "temporary file that is created should be closed and unlinked (removed)." msgstr "" -#: ../../library/test.rst:1378 +#: ../../library/test.rst:1423 msgid "" "Set to a filename containing the :data:`FS_NONASCII` character, if it " "exists. This guarantees that if the filename exists, it can be encoded and " @@ -1626,25 +1675,25 @@ msgid "" "a non-ASCII filename to be easily skipped on platforms where they can't work." msgstr "" -#: ../../library/test.rst:1386 +#: ../../library/test.rst:1431 msgid "" "Set to a filename (str type) that should not be able to be encoded by file " "system encoding in strict mode. It may be ``None`` if it's not possible to " "generate such a filename." msgstr "" -#: ../../library/test.rst:1393 +#: ../../library/test.rst:1438 msgid "" "Set to a filename (bytes type) that should not be able to be decoded by file " "system encoding in strict mode. It may be ``None`` if it's not possible to " "generate such a filename." msgstr "" -#: ../../library/test.rst:1400 +#: ../../library/test.rst:1445 msgid "Set to a non-ASCII name for a temporary file." msgstr "" -#: ../../library/test.rst:1405 +#: ../../library/test.rst:1450 msgid "" "Class used to temporarily set or unset environment variables. Instances can " "be used as a context manager and have a complete dictionary interface for " @@ -1653,153 +1702,160 @@ msgid "" "instance will be rolled back." msgstr "" -#: ../../library/test.rst:1411 +#: ../../library/test.rst:1456 msgid "Added dictionary interface." msgstr "新增字典介面。" -#: ../../library/test.rst:1417 +#: ../../library/test.rst:1462 msgid "" -"Simple :term:`path-like object`. It implements the :meth:`~os.PathLike." -"__fspath__` method which just returns the *path* argument. If *path* is an " -"exception, it will be raised in :meth:`!__fspath__`." +"Simple :term:`path-like object`. It implements " +"the :meth:`~os.PathLike.__fspath__` method which just returns the *path* " +"argument. If *path* is an exception, it will be raised in :meth:`!" +"__fspath__`." msgstr "" -#: ../../library/test.rst:1425 +#: ../../library/test.rst:1470 msgid "" "Temporarily set the environment variable ``envvar`` to the value of " "``value``." msgstr "" -#: ../../library/test.rst:1431 -msgid "Temporarily unset the environment variable ``envvar``." +#: ../../library/test.rst:1476 +#, fuzzy +msgid "Temporarily unset one or more environment variables." msgstr "暫時取消環境變數 ``envvar``。" -#: ../../library/test.rst:1436 +#: ../../library/test.rst:1478 +#, fuzzy +msgid "More than one environment variable can be unset." +msgstr "暫時取消環境變數 ``envvar``。" + +#: ../../library/test.rst:1484 msgid "Return ``True`` if the OS supports symbolic links, ``False`` otherwise." msgstr "如果作業系統支援符號連結則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/test.rst:1442 +#: ../../library/test.rst:1490 msgid "Return ``True`` if the OS supports xattr, ``False`` otherwise." msgstr "如果作業系統支援 xattr 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/test.rst:1448 +#: ../../library/test.rst:1496 msgid "" "A context manager that temporarily changes the current working directory to " "*path* and yields the directory." msgstr "" -#: ../../library/test.rst:1451 +#: ../../library/test.rst:1499 msgid "" "If *quiet* is ``False``, the context manager raises an exception on error. " "Otherwise, it issues only a warning and keeps the current working directory " "the same." msgstr "" -#: ../../library/test.rst:1458 +#: ../../library/test.rst:1506 msgid "" "Create an empty file with *filename*. If it already exists, truncate it." msgstr "" -#: ../../library/test.rst:1463 +#: ../../library/test.rst:1511 msgid "Count the number of open file descriptors." msgstr "" -#: ../../library/test.rst:1468 +#: ../../library/test.rst:1516 msgid "Return ``True`` if the file system for *directory* is case-insensitive." msgstr "" -#: ../../library/test.rst:1473 +#: ../../library/test.rst:1521 msgid "" "Create an invalid file descriptor by opening and closing a temporary file, " "and returning its descriptor." msgstr "" -#: ../../library/test.rst:1479 +#: ../../library/test.rst:1527 msgid "" "Call :func:`os.rmdir` on *filename*. On Windows platforms, this is wrapped " "with a wait loop that checks for the existence of the file, which is needed " "due to antivirus programs that can hold files open and prevent deletion." msgstr "" -#: ../../library/test.rst:1487 +#: ../../library/test.rst:1535 msgid "" -"Call :func:`shutil.rmtree` on *path* or call :func:`os.lstat` and :func:`os." -"rmdir` to remove a path and its contents. As with :func:`rmdir`, on Windows " -"platforms this is wrapped with a wait loop that checks for the existence of " -"the files." +"Call :func:`shutil.rmtree` on *path* or call :func:`os.lstat` " +"and :func:`os.rmdir` to remove a path and its contents. As " +"with :func:`rmdir`, on Windows platforms this is wrapped with a wait loop " +"that checks for the existence of the files." msgstr "" -#: ../../library/test.rst:1495 +#: ../../library/test.rst:1543 msgid "A decorator for running tests that require support for symbolic links." msgstr "" -#: ../../library/test.rst:1500 +#: ../../library/test.rst:1548 msgid "A decorator for running tests that require support for xattr." msgstr "" -#: ../../library/test.rst:1505 +#: ../../library/test.rst:1553 msgid "" "A context manager that temporarily creates a new directory and changes the " "current working directory (CWD)." msgstr "" -#: ../../library/test.rst:1508 +#: ../../library/test.rst:1556 msgid "" "The context manager creates a temporary directory in the current directory " "with name *name* before temporarily changing the current working directory. " -"If *name* is ``None``, the temporary directory is created using :func:" -"`tempfile.mkdtemp`." +"If *name* is ``None``, the temporary directory is created " +"using :func:`tempfile.mkdtemp`." msgstr "" -#: ../../library/test.rst:1513 +#: ../../library/test.rst:1561 msgid "" "If *quiet* is ``False`` and it is not possible to create or change the CWD, " "an error is raised. Otherwise, only a warning is raised and the original " "CWD is used." msgstr "" -#: ../../library/test.rst:1520 +#: ../../library/test.rst:1568 msgid "" "A context manager that creates a temporary directory at *path* and yields " "the directory." msgstr "" -#: ../../library/test.rst:1523 +#: ../../library/test.rst:1571 msgid "" -"If *path* is ``None``, the temporary directory is created using :func:" -"`tempfile.mkdtemp`. If *quiet* is ``False``, the context manager raises an " -"exception on error. Otherwise, if *path* is specified and cannot be " -"created, only a warning is issued." +"If *path* is ``None``, the temporary directory is created " +"using :func:`tempfile.mkdtemp`. If *quiet* is ``False``, the context " +"manager raises an exception on error. Otherwise, if *path* is specified and " +"cannot be created, only a warning is issued." msgstr "" -#: ../../library/test.rst:1531 +#: ../../library/test.rst:1579 msgid "A context manager that temporarily sets the process umask." msgstr "" -#: ../../library/test.rst:1536 +#: ../../library/test.rst:1584 msgid "" "Call :func:`os.unlink` on *filename*. As with :func:`rmdir`, on Windows " "platforms, this is wrapped with a wait loop that checks for the existence of " "the file." msgstr "" -#: ../../library/test.rst:1542 +#: ../../library/test.rst:1590 msgid ":mod:`test.support.import_helper` --- Utilities for import tests" msgstr ":mod:`test.support.import_helper` --- 用於 import 測試的工具" -#: ../../library/test.rst:1547 +#: ../../library/test.rst:1595 msgid "" "The :mod:`test.support.import_helper` module provides support for import " "tests." msgstr ":mod:`test.support.import_helper` 模組提供 import 測試的支援。" -#: ../../library/test.rst:1554 +#: ../../library/test.rst:1602 msgid "" "Remove the module named *module_name* from ``sys.modules`` and delete any " "byte-compiled files of the module." msgstr "" -#: ../../library/test.rst:1560 +#: ../../library/test.rst:1608 msgid "" "This function imports and returns a fresh copy of the named Python module by " "removing the named module from ``sys.modules`` before doing the import. Note " @@ -1807,39 +1863,39 @@ msgid "" "operation." msgstr "" -#: ../../library/test.rst:1565 +#: ../../library/test.rst:1613 msgid "" "*fresh* is an iterable of additional module names that are also removed from " "the ``sys.modules`` cache before doing the import." msgstr "" -#: ../../library/test.rst:1568 +#: ../../library/test.rst:1616 msgid "" "*blocked* is an iterable of module names that are replaced with ``None`` in " "the module cache during the import to ensure that attempts to import them " "raise :exc:`ImportError`." msgstr "" -#: ../../library/test.rst:1572 +#: ../../library/test.rst:1620 msgid "" "The named module and any modules named in the *fresh* and *blocked* " "parameters are saved before starting the import and then reinserted into " "``sys.modules`` when the fresh import is complete." msgstr "" -#: ../../library/test.rst:1576 +#: ../../library/test.rst:1624 msgid "" "Module and package deprecation messages are suppressed during this import if " "*deprecated* is ``True``." msgstr "" -#: ../../library/test.rst:1579 +#: ../../library/test.rst:1627 msgid "" "This function will raise :exc:`ImportError` if the named module cannot be " "imported." msgstr "如果無法引入指定的模組則此函式會引發 :exc:`ImportError`。" -#: ../../library/test.rst:1584 +#: ../../library/test.rst:1632 msgid "" "# Get copies of the warnings module for testing without affecting the\n" "# version being used by the rest of the test suite. One copy uses the\n" @@ -1849,14 +1905,14 @@ msgid "" "c_warnings = import_fresh_module('warnings', fresh=['_warnings'])" msgstr "" -#: ../../library/test.rst:1596 +#: ../../library/test.rst:1644 msgid "" "This function imports and returns the named module. Unlike a normal import, " "this function raises :exc:`unittest.SkipTest` if the module cannot be " "imported." msgstr "" -#: ../../library/test.rst:1600 +#: ../../library/test.rst:1648 msgid "" "Module and package deprecation messages are suppressed during this import if " "*deprecated* is ``True``. If a module is required on a platform but " @@ -1864,21 +1920,21 @@ msgid "" "which will be compared against :data:`sys.platform`." msgstr "" -#: ../../library/test.rst:1610 +#: ../../library/test.rst:1658 msgid "Return a copy of :data:`sys.modules`." msgstr "回傳 :data:`sys.modules` 的複本。" -#: ../../library/test.rst:1615 +#: ../../library/test.rst:1663 msgid "" "Remove modules except for *oldmodules* and ``encodings`` in order to " "preserve internal cache." msgstr "" -#: ../../library/test.rst:1621 +#: ../../library/test.rst:1669 msgid "Delete *name* from ``sys.modules``." msgstr "從 ``sys.modules`` 中刪除 *name*。" -#: ../../library/test.rst:1626 +#: ../../library/test.rst:1674 msgid "" "Move a :pep:`3147`/:pep:`488` pyc file to its legacy pyc location and return " "the file system path to the legacy pyc file. The *source* value is the file " @@ -1886,91 +1942,92 @@ msgid "" "3147/488 pyc file must exist." msgstr "" -#: ../../library/test.rst:1634 +#: ../../library/test.rst:1682 msgid "" "A context manager to force import to return a new module reference. This is " -"useful for testing module-level behaviors, such as the emission of a :exc:" -"`DeprecationWarning` on import. Example usage::" +"useful for testing module-level behaviors, such as the emission of " +"a :exc:`DeprecationWarning` on import. Example usage::" msgstr "" -#: ../../library/test.rst:1638 +#: ../../library/test.rst:1686 msgid "" "with CleanImport('foo'):\n" " importlib.import_module('foo') # New reference." msgstr "" -#: ../../library/test.rst:1644 +#: ../../library/test.rst:1692 msgid "A context manager to temporarily add directories to :data:`sys.path`." msgstr "" -#: ../../library/test.rst:1646 +#: ../../library/test.rst:1694 msgid "" "This makes a copy of :data:`sys.path`, appends any directories given as " "positional arguments, then reverts :data:`sys.path` to the copied settings " "when the context ends." msgstr "" -#: ../../library/test.rst:1650 +#: ../../library/test.rst:1698 msgid "" "Note that *all* :data:`sys.path` modifications in the body of the context " "manager, including replacement of the object, will be reverted at the end of " "the block." msgstr "" -#: ../../library/test.rst:1656 +#: ../../library/test.rst:1704 msgid ":mod:`test.support.warnings_helper` --- Utilities for warnings tests" msgstr ":mod:`test.support.warnings_helper` --- 用於 warnings 測試的工具" -#: ../../library/test.rst:1661 +#: ../../library/test.rst:1709 msgid "" "The :mod:`test.support.warnings_helper` module provides support for warnings " "tests." msgstr ":mod:`test.support.warnings_helper` 模組提供 warnings 測試的支援。" -#: ../../library/test.rst:1668 +#: ../../library/test.rst:1716 msgid "" -"Suppress warnings that are instances of *category*, which must be :exc:" -"`Warning` or a subclass. Roughly equivalent to :func:`warnings." -"catch_warnings` with :meth:`warnings.simplefilter('ignore', " -"category=category) `. For example::" +"Suppress warnings that are instances of *category*, which must " +"be :exc:`Warning` or a subclass. Roughly equivalent " +"to :func:`warnings.catch_warnings` " +"with :meth:`warnings.simplefilter('ignore', category=category) " +"`. For example::" msgstr "" -#: ../../library/test.rst:1674 +#: ../../library/test.rst:1722 msgid "" "@warning_helper.ignore_warnings(category=DeprecationWarning)\n" "def test_suppress_warning():\n" " # do something" msgstr "" -#: ../../library/test.rst:1683 +#: ../../library/test.rst:1731 msgid "" "Context manager to check that no :exc:`ResourceWarning` was raised. You " "must remove the object which may emit :exc:`ResourceWarning` before the end " "of the context manager." msgstr "" -#: ../../library/test.rst:1690 +#: ../../library/test.rst:1738 msgid "" "Test for syntax warning in *statement* by attempting to compile *statement*. " "Test also that the :exc:`SyntaxWarning` is emitted only once, and that it " "will be converted to a :exc:`SyntaxError` when turned into error. *testcase* " "is the :mod:`unittest` instance for the test. *errtext* is the regular " -"expression which should match the string representation of the emitted :exc:" -"`SyntaxWarning` and raised :exc:`SyntaxError`. If *lineno* is not ``None``, " -"compares to the line of the warning and exception. If *offset* is not " -"``None``, compares to the offset of the exception." +"expression which should match the string representation of the " +"emitted :exc:`SyntaxWarning` and raised :exc:`SyntaxError`. If *lineno* is " +"not ``None``, compares to the line of the warning and exception. If *offset* " +"is not ``None``, compares to the offset of the exception." msgstr "" -#: ../../library/test.rst:1704 +#: ../../library/test.rst:1752 msgid "" "A convenience wrapper for :func:`warnings.catch_warnings` that makes it " "easier to test that a warning was correctly raised. It is approximately " -"equivalent to calling ``warnings.catch_warnings(record=True)`` with :meth:" -"`warnings.simplefilter` set to ``always`` and with the option to " +"equivalent to calling ``warnings.catch_warnings(record=True)`` " +"with :meth:`warnings.simplefilter` set to ``always`` and with the option to " "automatically validate the results that are recorded." msgstr "" -#: ../../library/test.rst:1710 +#: ../../library/test.rst:1758 msgid "" "``check_warnings`` accepts 2-tuples of the form ``(\"message regexp\", " "WarningCategory)`` as positional arguments. If one or more *filters* are " @@ -1982,19 +2039,19 @@ msgid "" "*quiet* to ``True``." msgstr "" -#: ../../library/test.rst:1719 +#: ../../library/test.rst:1767 msgid "If no arguments are specified, it defaults to::" msgstr "如果沒有指定引數,預設為: ::" -#: ../../library/test.rst:1721 +#: ../../library/test.rst:1769 msgid "check_warnings((\"\", Warning), quiet=True)" msgstr "check_warnings((\"\", Warning), quiet=True)" -#: ../../library/test.rst:1723 +#: ../../library/test.rst:1771 msgid "In this case all warnings are caught and no errors are raised." msgstr "" -#: ../../library/test.rst:1725 +#: ../../library/test.rst:1773 msgid "" "On entry to the context manager, a :class:`WarningRecorder` instance is " "returned. The underlying warnings list from :func:`~warnings.catch_warnings` " @@ -2006,17 +2063,17 @@ msgid "" "return ``None``." msgstr "" -#: ../../library/test.rst:1734 +#: ../../library/test.rst:1782 msgid "" "The recorder object also has a :meth:`reset` method, which clears the " "warnings list." msgstr "" -#: ../../library/test.rst:1737 +#: ../../library/test.rst:1785 msgid "The context manager is designed to be used like this::" msgstr "" -#: ../../library/test.rst:1739 +#: ../../library/test.rst:1787 msgid "" "with check_warnings((\"assertion is always true\", SyntaxWarning),\n" " (\"\", UserWarning)):\n" @@ -2024,19 +2081,19 @@ msgid "" " warnings.warn(UserWarning(\"Hide me!\"))" msgstr "" -#: ../../library/test.rst:1744 +#: ../../library/test.rst:1792 msgid "" "In this case if either warning was not raised, or some other warning was " "raised, :func:`check_warnings` would raise an error." msgstr "" -#: ../../library/test.rst:1747 +#: ../../library/test.rst:1795 msgid "" "When a test needs to look more deeply into the warnings, rather than just " "checking whether or not they occurred, code like this can be used::" msgstr "" -#: ../../library/test.rst:1750 +#: ../../library/test.rst:1798 msgid "" "with check_warnings(quiet=True) as w:\n" " warnings.warn(\"foo\")\n" @@ -2058,18 +2115,18 @@ msgstr "" " w.reset()\n" " assert len(w.warnings) == 0" -#: ../../library/test.rst:1761 +#: ../../library/test.rst:1809 msgid "" "Here all warnings will be caught, and the test code tests the captured " "warnings directly." msgstr "" -#: ../../library/test.rst:1764 +#: ../../library/test.rst:1812 msgid "New optional arguments *filters* and *quiet*." msgstr "新的可選引數 *filters* 和 *quiet*。" -#: ../../library/test.rst:1770 +#: ../../library/test.rst:1818 msgid "" -"Class used to record warnings for unit tests. See documentation of :func:" -"`check_warnings` above for more details." +"Class used to record warnings for unit tests. See documentation " +"of :func:`check_warnings` above for more details." msgstr "" diff --git a/library/threading.po b/library/threading.po index 24de59c26df..2e3f3a3eb44 100644 --- a/library/threading.po +++ b/library/threading.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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,7 +32,7 @@ msgid "" msgstr "" #: ../../library/threading.rst:194 ../../library/threading.rst:293 -#: ../../library/threading.rst:641 ../../includes/wasm-notavail.rst:3 +#: ../../library/threading.rst:678 ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "可用性" @@ -136,9 +136,10 @@ msgid "" "lock>`, only one thread can execute Python code at once (even though certain " "performance-oriented libraries might overcome this limitation). If you want " "your application to make better use of the computational resources of multi-" -"core machines, you are advised to use :mod:`multiprocessing` or :class:" -"`concurrent.futures.ProcessPoolExecutor`. However, threading is still an " -"appropriate model if you want to run multiple I/O-bound tasks simultaneously." +"core machines, you are advised to use :mod:`multiprocessing` " +"or :class:`concurrent.futures.ProcessPoolExecutor`. However, threading is " +"still an appropriate model if you want to run multiple I/O-bound tasks " +"simultaneously." msgstr "" #: ../../library/threading.rst:95 @@ -158,9 +159,9 @@ msgstr "" #: ../../library/threading.rst:105 msgid "" -"As of Python 3.13, experimental :term:`free-threaded ` " -"builds can disable the GIL, enabling true parallel execution of threads, but " -"this feature is not available by default (see :pep:`703`)." +"As of Python 3.13, :term:`free-threaded ` builds can disable " +"the GIL, enabling true parallel execution of threads, but this feature is " +"not available by default (see :pep:`703`)." msgstr "" #: ../../library/threading.rst:112 @@ -284,10 +285,10 @@ msgstr "新增對 GNU/kFreeBSD 的支援。" #: ../../library/threading.rst:204 msgid "" "Return a list of all :class:`Thread` objects currently active. The list " -"includes daemonic threads and dummy thread objects created by :func:" -"`current_thread`. It excludes terminated threads and threads that have not " -"yet been started. However, the main thread is always part of the result, " -"even when terminated." +"includes daemonic threads and dummy thread objects created " +"by :func:`current_thread`. It excludes terminated threads and threads that " +"have not yet been started. However, the main thread is always part of the " +"result, even when terminated." msgstr "" #: ../../library/threading.rst:213 @@ -348,9 +349,9 @@ msgid "" "*size* argument specifies the stack size to be used for subsequently created " "threads, and must be 0 (use platform or configured default) or a positive " "integer value of at least 32,768 (32 KiB). If *size* is not specified, 0 is " -"used. If changing the thread stack size is unsupported, a :exc:" -"`RuntimeError` is raised. If the specified stack size is invalid, a :exc:" -"`ValueError` is raised and the stack size is unmodified. 32 KiB is " +"used. If changing the thread stack size is unsupported, " +"a :exc:`RuntimeError` is raised. If the specified stack size is invalid, " +"a :exc:`ValueError` is raised and the stack size is unmodified. 32 KiB is " "currently the minimum supported stack size value to guarantee sufficient " "stack space for the interpreter itself. Note that some platforms may have " "particular restrictions on values for the stack size, such as requiring a " @@ -373,8 +374,8 @@ msgstr "此模組也定義了以下常數:" msgid "" "The maximum value allowed for the *timeout* parameter of blocking functions " "(:meth:`Lock.acquire`, :meth:`RLock.acquire`, :meth:`Condition.wait`, etc.). " -"Specifying a timeout greater than this value will raise an :exc:" -"`OverflowError`." +"Specifying a timeout greater than this value will raise " +"an :exc:`OverflowError`." msgstr "" #: ../../library/threading.rst:310 @@ -491,17 +492,17 @@ msgstr "" #: ../../library/threading.rst:367 msgid "" -"Of course, values you get from a :class:`local` object, including their :" -"attr:`~object.__dict__` attribute, are for whatever thread was current at " -"the time the attribute was read. For that reason, you generally don't want " -"to save these values across threads, as they apply only to the thread they " -"came from." +"Of course, values you get from a :class:`local` object, including " +"their :attr:`~object.__dict__` attribute, are for whatever thread was " +"current at the time the attribute was read. For that reason, you generally " +"don't want to save these values across threads, as they apply only to the " +"thread they came from." msgstr "" #: ../../library/threading.rst:373 msgid "" -"You can create custom :class:`local` objects by subclassing the :class:" -"`local` class::" +"You can create custom :class:`local` objects by subclassing " +"the :class:`local` class::" msgstr "" #: ../../library/threading.rst:376 @@ -691,8 +692,8 @@ msgstr "" msgid "" "Once the thread's activity is started, the thread is considered 'alive'. It " "stops being alive when its :meth:`~Thread.run` method terminates -- either " -"normally, or by raising an unhandled exception. The :meth:`~Thread." -"is_alive` method tests whether the thread is alive." +"normally, or by raising an unhandled exception. " +"The :meth:`~Thread.is_alive` method tests whether the thread is alive." msgstr "" #: ../../library/threading.rst:475 @@ -710,9 +711,9 @@ msgstr "" #: ../../library/threading.rst:482 msgid "" -"If the :meth:`~Thread.run` method raises an exception, :func:`threading." -"excepthook` is called to handle it. By default, :func:`threading.excepthook` " -"ignores silently :exc:`SystemExit`." +"If the :meth:`~Thread.run` method raises an " +"exception, :func:`threading.excepthook` is called to handle it. By " +"default, :func:`threading.excepthook` ignores silently :exc:`SystemExit`." msgstr "" #: ../../library/threading.rst:486 @@ -796,41 +797,70 @@ msgstr "" #: ../../library/threading.rst:535 msgid "" +"*context* is the :class:`~contextvars.Context` value to use when starting " +"the thread. The default value is ``None`` which indicates that " +"the :data:`sys.flags.thread_inherit_context` flag controls the behaviour. " +"If the flag is true, threads will start with a copy of the context of the " +"caller of :meth:`~Thread.start`. If false, they will start with an empty " +"context. To explicitly start with an empty context, pass a new instance " +"of :class:`~contextvars.Context()`. To explicitly start with a copy of the " +"current context, pass the value from :func:`~contextvars.copy_context`. The " +"flag defaults true on free-threaded builds and false otherwise." +msgstr "" + +#: ../../library/threading.rst:545 +msgid "" "If the subclass overrides the constructor, it must make sure to invoke the " "base class constructor (``Thread.__init__()``) before doing anything else to " "the thread." msgstr "" -#: ../../library/threading.rst:539 +#: ../../library/threading.rst:549 msgid "Added the *daemon* parameter." msgstr "新增 *daemon* 參數。" -#: ../../library/threading.rst:542 +#: ../../library/threading.rst:552 msgid "Use the *target* name if *name* argument is omitted." msgstr "" -#: ../../library/threading.rst:547 +#: ../../library/threading.rst:555 +#, fuzzy +msgid "Added the *context* parameter." +msgstr "新增 *daemon* 參數。" + +#: ../../library/threading.rst:560 msgid "Start the thread's activity." msgstr "" -#: ../../library/threading.rst:549 +#: ../../library/threading.rst:562 msgid "" "It must be called at most once per thread object. It arranges for the " "object's :meth:`~Thread.run` method to be invoked in a separate thread of " "control." msgstr "" -#: ../../library/threading.rst:553 +#: ../../library/threading.rst:566 msgid "" "This method will raise a :exc:`RuntimeError` if called more than once on the " "same thread object." msgstr "" -#: ../../library/threading.rst:558 +#: ../../library/threading.rst:569 +msgid "" +"If supported, set the operating system thread name " +"to :attr:`threading.Thread.name`. The name can be truncated depending on the " +"operating system thread name limits." +msgstr "" + +#: ../../library/threading.rst:573 +msgid "Set the operating system thread name." +msgstr "" + +#: ../../library/threading.rst:578 msgid "Method representing the thread's activity." msgstr "" -#: ../../library/threading.rst:560 +#: ../../library/threading.rst:580 msgid "" "You may override this method in a subclass. The standard :meth:`run` method " "invokes the callable object passed to the object's constructor as the " @@ -838,17 +868,17 @@ msgid "" "the *args* and *kwargs* arguments, respectively." msgstr "" -#: ../../library/threading.rst:565 +#: ../../library/threading.rst:585 msgid "" -"Using list or tuple as the *args* argument which passed to the :class:" -"`Thread` could achieve the same effect." +"Using list or tuple as the *args* argument which passed to " +"the :class:`Thread` could achieve the same effect." msgstr "" -#: ../../library/threading.rst:568 +#: ../../library/threading.rst:588 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/threading.rst:570 +#: ../../library/threading.rst:590 msgid "" ">>> from threading import Thread\n" ">>> t = Thread(target=print, args=[1])\n" @@ -866,7 +896,7 @@ msgstr "" ">>> t.run()\n" "1" -#: ../../library/threading.rst:582 +#: ../../library/threading.rst:602 msgid "" "Wait until the thread terminates. This blocks the calling thread until the " "thread whose :meth:`~Thread.join` method is called terminates -- either " @@ -874,27 +904,27 @@ msgid "" "occurs." msgstr "" -#: ../../library/threading.rst:587 +#: ../../library/threading.rst:607 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds (or " "fractions thereof). As :meth:`~Thread.join` always returns ``None``, you " "must call :meth:`~Thread.is_alive` after :meth:`~Thread.join` to decide " -"whether a timeout happened -- if the thread is still alive, the :meth:" -"`~Thread.join` call timed out." +"whether a timeout happened -- if the thread is still alive, " +"the :meth:`~Thread.join` call timed out." msgstr "" -#: ../../library/threading.rst:594 +#: ../../library/threading.rst:614 msgid "" "When the *timeout* argument is not present or ``None``, the operation will " "block until the thread terminates." msgstr "" -#: ../../library/threading.rst:597 +#: ../../library/threading.rst:617 msgid "A thread can be joined many times." msgstr "" -#: ../../library/threading.rst:599 +#: ../../library/threading.rst:619 msgid "" ":meth:`~Thread.join` raises a :exc:`RuntimeError` if an attempt is made to " "join the current thread as that would cause a deadlock. It is also an error " @@ -902,20 +932,46 @@ msgid "" "do so raise the same exception." msgstr "" -#: ../../library/threading.rst:606 +#: ../../library/threading.rst:624 +msgid "" +"If an attempt is made to join a running daemonic thread in late stages " +"of :term:`Python finalization ` :meth:`!join` raises " +"a :exc:`PythonFinalizationError`." +msgstr "" + +#: ../../library/threading.rst:630 +msgid "May raise :exc:`PythonFinalizationError`." +msgstr "" + +#: ../../library/threading.rst:634 msgid "" "A string used for identification purposes only. It has no semantics. " "Multiple threads may be given the same name. The initial name is set by the " "constructor." msgstr "" -#: ../../library/threading.rst:613 +#: ../../library/threading.rst:638 +msgid "" +"On some platforms, the thread name is set at the operating system level when " +"the thread starts, so that it is visible in task managers. This name may be " +"truncated to fit in a system-specific limit (for example, 15 bytes on Linux " +"or 63 bytes on macOS)." +msgstr "" + +#: ../../library/threading.rst:643 +msgid "" +"Changes to *name* are only reflected at the OS level when the currently " +"running thread is renamed. (Setting the *name* attribute of a different " +"thread only updates the Python Thread object.)" +msgstr "" + +#: ../../library/threading.rst:650 msgid "" "Deprecated getter/setter API for :attr:`~Thread.name`; use it directly as a " "property instead." msgstr "" -#: ../../library/threading.rst:620 +#: ../../library/threading.rst:657 msgid "" "The 'thread identifier' of this thread or ``None`` if the thread has not " "been started. This is a nonzero integer. See the :func:`get_ident` " @@ -924,7 +980,7 @@ msgid "" "thread has exited." msgstr "" -#: ../../library/threading.rst:628 +#: ../../library/threading.rst:665 msgid "" "The Thread ID (``TID``) of this thread, as assigned by the OS (kernel). This " "is a non-negative integer, or ``None`` if the thread has not been started. " @@ -933,102 +989,102 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: ../../library/threading.rst:637 +#: ../../library/threading.rst:674 msgid "" "Similar to Process IDs, Thread IDs are only valid (guaranteed unique system-" "wide) from the time the thread is created until the thread has been " "terminated." msgstr "" -#: ../../library/threading.rst:647 +#: ../../library/threading.rst:684 msgid "Return whether the thread is alive." msgstr "" -#: ../../library/threading.rst:649 +#: ../../library/threading.rst:686 msgid "" "This method returns ``True`` just before the :meth:`~Thread.run` method " "starts until just after the :meth:`~Thread.run` method terminates. The " "module function :func:`.enumerate` returns a list of all alive threads." msgstr "" -#: ../../library/threading.rst:655 +#: ../../library/threading.rst:692 msgid "" "A boolean value indicating whether this thread is a daemon thread (``True``) " "or not (``False``). This must be set before :meth:`~Thread.start` is " "called, otherwise :exc:`RuntimeError` is raised. Its initial value is " "inherited from the creating thread; the main thread is not a daemon thread " -"and therefore all threads created in the main thread default to :attr:" -"`~Thread.daemon` = ``False``." +"and therefore all threads created in the main thread default " +"to :attr:`~Thread.daemon` = ``False``." msgstr "" -#: ../../library/threading.rst:662 +#: ../../library/threading.rst:699 msgid "" "The entire Python program exits when no alive non-daemon threads are left." msgstr "" -#: ../../library/threading.rst:667 +#: ../../library/threading.rst:704 msgid "" "Deprecated getter/setter API for :attr:`~Thread.daemon`; use it directly as " "a property instead." msgstr "" -#: ../../library/threading.rst:676 +#: ../../library/threading.rst:713 msgid "Lock objects" msgstr "Lock 物件" -#: ../../library/threading.rst:678 +#: ../../library/threading.rst:715 msgid "" "A primitive lock is a synchronization primitive that is not owned by a " "particular thread when locked. In Python, it is currently the lowest level " -"synchronization primitive available, implemented directly by the :mod:" -"`_thread` extension module." +"synchronization primitive available, implemented directly by " +"the :mod:`_thread` extension module." msgstr "" "原始鎖 (primitive lock) 是一種同步原語 (synchronization primitive),在鎖定時" -"不屬於特定執行緒。在 Python 中,它是目前可用的最低階同步原語,直接由 :mod:" -"`_thread` 擴充模組實作。" +"不屬於特定執行緒。在 Python 中,它是目前可用的最低階同步原語,直接" +"由 :mod:`_thread` 擴充模組實作。" -#: ../../library/threading.rst:683 +#: ../../library/threading.rst:720 msgid "" "A primitive lock is in one of two states, \"locked\" or \"unlocked\". It is " -"created in the unlocked state. It has two basic methods, :meth:`~Lock." -"acquire` and :meth:`~Lock.release`. When the state is unlocked, :meth:" -"`~Lock.acquire` changes the state to locked and returns immediately. When " -"the state is locked, :meth:`~Lock.acquire` blocks until a call to :meth:" -"`~Lock.release` in another thread changes it to unlocked, then the :meth:" -"`~Lock.acquire` call resets it to locked and returns. The :meth:`~Lock." -"release` method should only be called in the locked state; it changes the " -"state to unlocked and returns immediately. If an attempt is made to release " -"an unlocked lock, a :exc:`RuntimeError` will be raised." +"created in the unlocked state. It has two basic " +"methods, :meth:`~Lock.acquire` and :meth:`~Lock.release`. When the state is " +"unlocked, :meth:`~Lock.acquire` changes the state to locked and returns " +"immediately. When the state is locked, :meth:`~Lock.acquire` blocks until a " +"call to :meth:`~Lock.release` in another thread changes it to unlocked, then " +"the :meth:`~Lock.acquire` call resets it to locked and returns. " +"The :meth:`~Lock.release` method should only be called in the locked state; " +"it changes the state to unlocked and returns immediately. If an attempt is " +"made to release an unlocked lock, a :exc:`RuntimeError` will be raised." msgstr "" "原始鎖會處於兩種狀態之一:「鎖定 (locked)」或「未鎖定 (unclocked)」,建立時會" -"處於未鎖定狀態。它有兩個基本方法 :meth:`~Lock.acquire` 和 :meth:`~Lock." -"release`。當狀態為未鎖定時,:meth:`~Lock.acquire` 會將狀態變更為鎖定並立即回" -"傳。當狀態被鎖定時,:meth:`~Lock.acquire` 會阻塞 (block),直到另一個執行緒中" -"對 :meth:`~Lock.release` 的呼叫將其更改為未鎖定狀態,然後 :meth:`~Lock." -"acquire` 呼叫會將其重置為鎖定並回傳。:meth:`~Lock.release` 方法只能在鎖定狀態" -"下呼叫;它將狀態更改為未鎖定並立即回傳。如果嘗試釋放未鎖定的鎖,則會引發 :" -"exc:`RuntimeError`。" - -#: ../../library/threading.rst:694 +"處於未鎖定狀態。它有兩個基本方法 :meth:`~Lock.acquire` " +"和 :meth:`~Lock.release`。當狀態為未鎖定時,:meth:`~Lock.acquire` 會將狀態變" +"更為鎖定並立即回傳。當狀態被鎖定時,:meth:`~Lock.acquire` 會阻塞 (block),直" +"到另一個執行緒中對 :meth:`~Lock.release` 的呼叫將其更改為未鎖定狀態,然" +"後 :meth:`~Lock.acquire` 呼叫會將其重置為鎖定並回傳。:meth:`~Lock.release` 方" +"法只能在鎖定狀態下呼叫;它將狀態更改為未鎖定並立即回傳。如果嘗試釋放未鎖定的" +"鎖,則會引發 :exc:`RuntimeError`。" + +#: ../../library/threading.rst:731 msgid "Locks also support the :ref:`context management protocol `." msgstr "鎖也支援\\ :ref:`情境管理協定 `。" -#: ../../library/threading.rst:696 +#: ../../library/threading.rst:733 msgid "" "When more than one thread is blocked in :meth:`~Lock.acquire` waiting for " -"the state to turn to unlocked, only one thread proceeds when a :meth:`~Lock." -"release` call resets the state to unlocked; which one of the waiting threads " -"proceeds is not defined, and may vary across implementations." +"the state to turn to unlocked, only one thread proceeds when " +"a :meth:`~Lock.release` call resets the state to unlocked; which one of the " +"waiting threads proceeds is not defined, and may vary across implementations." msgstr "" -"當多個執行緒阻塞在 :meth:`~Lock.acquire` 中等待狀態轉變為未鎖定,此時若呼叫 :" -"meth:`~Lock.release` 將狀態重置為未鎖定,則只會有一個執行緒繼續進行;哪一個等" -"待執行緒會繼續進行是未定義的,並且可能因實作而異。" +"當多個執行緒阻塞在 :meth:`~Lock.acquire` 中等待狀態轉變為未鎖定,此時若呼" +"叫 :meth:`~Lock.release` 將狀態重置為未鎖定,則只會有一個執行緒繼續進行;哪一" +"個等待執行緒會繼續進行是未定義的,並且可能因實作而異。" -#: ../../library/threading.rst:701 +#: ../../library/threading.rst:738 msgid "All methods are executed atomically." msgstr "所有方法均以最小不可分割的操作方式 (atomically) 執行。" -#: ../../library/threading.rst:706 +#: ../../library/threading.rst:743 msgid "" "The class implementing primitive lock objects. Once a thread has acquired a " "lock, subsequent attempts to acquire it block, until it is released; any " @@ -1037,7 +1093,7 @@ msgstr "" "實作原始鎖物件的類別。一旦執行緒獲得了鎖,後續再嘗試獲得它就會被阻塞,直到鎖" "被釋放;任何執行緒都可以去釋放它。" -#: ../../library/threading.rst:710 +#: ../../library/threading.rst:747 msgid "" "``Lock`` is now a class. In earlier Pythons, ``Lock`` was a factory function " "which returned an instance of the underlying private lock type." @@ -1045,11 +1101,11 @@ msgstr "" "``Lock`` 現在是一個類別。在早期的 Python 中,``Lock`` 是一個會回傳底層私有鎖" "型別實例的工廠函式。" -#: ../../library/threading.rst:718 ../../library/threading.rst:809 +#: ../../library/threading.rst:755 ../../library/threading.rst:849 msgid "Acquire a lock, blocking or non-blocking." msgstr "阻塞或非阻塞地取得鎖。" -#: ../../library/threading.rst:720 +#: ../../library/threading.rst:757 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default), " "block until the lock is unlocked, then set it to locked and return ``True``." @@ -1057,7 +1113,7 @@ msgstr "" "當以 *blocking* 引數設為 ``True``\\ (預設值)來叫用,將會阻塞直到鎖被解鎖," "然後將其設為鎖定並回傳 ``True``。" -#: ../../library/threading.rst:723 +#: ../../library/threading.rst:760 msgid "" "When invoked with the *blocking* argument set to ``False``, do not block. If " "a call with *blocking* set to ``True`` would block, return ``False`` " @@ -1067,7 +1123,7 @@ msgstr "" "``True`` 的呼叫會阻塞,則立即回傳 ``False``;否則將鎖設為鎖定並回傳 " "``True``。" -#: ../../library/threading.rst:727 +#: ../../library/threading.rst:764 msgid "" "When invoked with the floating-point *timeout* argument set to a positive " "value, block for at most the number of seconds specified by *timeout* and as " @@ -1079,7 +1135,7 @@ msgstr "" "塞 *timeout* 指定的秒數。``-1`` 的 *timeout* 引數代表指定為不會停止的等待。" "當 *blocking* 為 ``False`` 時禁止指定 *timeout*。" -#: ../../library/threading.rst:733 +#: ../../library/threading.rst:770 msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not (for example if the *timeout* expired)." @@ -1087,24 +1143,29 @@ msgstr "" "如果成功取得鎖,則回傳值為 ``True``,否則回傳值為 ``False``\\ (例如像是 " "*timeout* 已逾期)。" -#: ../../library/threading.rst:736 ../../library/threading.rst:847 -#: ../../library/threading.rst:1094 +#: ../../library/threading.rst:773 ../../library/threading.rst:887 +#: ../../library/threading.rst:1147 msgid "The *timeout* parameter is new." msgstr "新的 *timeout* 參數。" -#: ../../library/threading.rst:739 +#: ../../library/threading.rst:776 msgid "" "Lock acquisition can now be interrupted by signals on POSIX if the " "underlying threading implementation supports it." msgstr "如果底層執行緒實作支援的話,鎖的取得現在可以被 POSIX 上的訊號中斷。" -#: ../../library/threading.rst:746 +#: ../../library/threading.rst:780 +#, fuzzy +msgid "Lock acquisition can now be interrupted by signals on Windows." +msgstr "如果底層執行緒實作支援的話,鎖的取得現在可以被 POSIX 上的訊號中斷。" + +#: ../../library/threading.rst:786 msgid "" "Release a lock. This can be called from any thread, not only the thread " "which has acquired the lock." msgstr "釋放鎖。這可以從任何執行緒呼叫,而不是只有獲得鎖的執行緒。" -#: ../../library/threading.rst:749 +#: ../../library/threading.rst:789 msgid "" "When the lock is locked, reset it to unlocked, and return. If any other " "threads are blocked waiting for the lock to become unlocked, allow exactly " @@ -1113,23 +1174,23 @@ msgstr "" "當鎖被鎖定時,將其重置為未鎖定然後回傳。如果任何其他執行緒在等待鎖被解鎖時被" "阻塞,只允許其中一個執行緒繼續進行。" -#: ../../library/threading.rst:753 +#: ../../library/threading.rst:793 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." msgstr "當在未鎖定的鎖上叫用時,會引發 :exc:`RuntimeError`" -#: ../../library/threading.rst:755 ../../library/threading.rst:863 +#: ../../library/threading.rst:795 ../../library/threading.rst:903 msgid "There is no return value." msgstr "沒有回傳值。" -#: ../../library/threading.rst:759 +#: ../../library/threading.rst:799 msgid "Return ``True`` if the lock is acquired." msgstr "如果有取得了鎖,則回傳 ``True``。" -#: ../../library/threading.rst:766 +#: ../../library/threading.rst:806 msgid "RLock objects" msgstr "RLock 物件" -#: ../../library/threading.rst:768 +#: ../../library/threading.rst:808 msgid "" "A reentrant lock is a synchronization primitive that may be acquired " "multiple times by the same thread. Internally, it uses the concepts of " @@ -1142,26 +1203,26 @@ msgstr "" "「遞迴等級 (recursion level)」的概念。在鎖定狀態下,某個執行緒會擁有鎖;在未" "鎖定狀態下則沒有執行緒擁有它。" -#: ../../library/threading.rst:774 +#: ../../library/threading.rst:814 msgid "" -"Threads call a lock's :meth:`~RLock.acquire` method to lock it, and its :" -"meth:`~Lock.release` method to unlock it." +"Threads call a lock's :meth:`~RLock.acquire` method to lock it, and " +"its :meth:`~Lock.release` method to unlock it." msgstr "" -"執行緒呼叫鎖的 :meth:`~RLock.acquire` 方法來鎖定它,並呼叫它的 :meth:`~Lock." -"release` 方法來解鎖它。" +"執行緒呼叫鎖的 :meth:`~RLock.acquire` 方法來鎖定它,並呼叫它" +"的 :meth:`~Lock.release` 方法來解鎖它。" -#: ../../library/threading.rst:779 +#: ../../library/threading.rst:819 msgid "" "Reentrant locks support the :ref:`context management protocol `, " -"so it is recommended to use :keyword:`with` instead of manually calling :" -"meth:`~RLock.acquire` and :meth:`~RLock.release` to handle acquiring and " -"releasing the lock for a block of code." +"so it is recommended to use :keyword:`with` instead of manually " +"calling :meth:`~RLock.acquire` and :meth:`~RLock.release` to handle " +"acquiring and releasing the lock for a block of code." msgstr "" "可重入鎖支援\\ :ref:`情境管理協定`,因此建議使用 :keyword:`with` " "而不是手動呼叫 :meth:`~RLock.acquire` 和 :meth:`~RLock.release` 來對程式碼區" "塊處理鎖的獲得和釋放。" -#: ../../library/threading.rst:784 +#: ../../library/threading.rst:824 msgid "" "RLock's :meth:`~RLock.acquire`/:meth:`~RLock.release` call pairs may be " "nested, unlike Lock's :meth:`~Lock.acquire`/:meth:`~Lock.release`. Only the " @@ -1174,7 +1235,7 @@ msgstr "" "個 :meth:`~RLock.release`\\ (最外面一對的 :meth:`~Lock.release`)會將鎖重置" "為未鎖定狀態,並允許在 :meth:`~RLock.acquire` 中阻塞的另一個執行緒繼續進行。" -#: ../../library/threading.rst:790 +#: ../../library/threading.rst:830 msgid "" ":meth:`~RLock.acquire`/:meth:`~RLock.release` must be used in pairs: each " "acquire must have a release in the thread that has acquired the lock. " @@ -1185,7 +1246,7 @@ msgstr "" "已獲得鎖的執行緒中有一個釋放。如果鎖釋放的次數不能和取得的次數一樣的話,可能" "會導致死鎖 (deadlock)。" -#: ../../library/threading.rst:797 +#: ../../library/threading.rst:837 msgid "" "This class implements reentrant lock objects. A reentrant lock must be " "released by the thread that acquired it. Once a thread has acquired a " @@ -1196,7 +1257,7 @@ msgstr "" "得了可重入鎖,同一個執行緒可以再次獲得它而不會阻塞;執行緒每次獲得它也都必須" "釋放它一次。" -#: ../../library/threading.rst:802 +#: ../../library/threading.rst:842 msgid "" "Note that ``RLock`` is actually a factory function which returns an instance " "of the most efficient version of the concrete RLock class that is supported " @@ -1205,11 +1266,11 @@ msgstr "" "請注意,``RLock`` 實際上是一個工廠函式,它會回傳平台有支援的特定 RLock 類別的" "最高效率版本的實例。" -#: ../../library/threading.rst:813 +#: ../../library/threading.rst:853 msgid ":ref:`Using RLock as a context manager `" msgstr ":ref:`將 RLock 用作為情境管理器 `" -#: ../../library/threading.rst:814 +#: ../../library/threading.rst:854 msgid "" "Recommended over manual :meth:`!acquire` and :meth:`release` calls whenever " "practical." @@ -1217,16 +1278,16 @@ msgstr "" "若是使用場景合理,和手動呼叫 :meth:`!acquire` 和 :meth:`release` 相比,會是更" "為推薦的使用方式。" -#: ../../library/threading.rst:818 +#: ../../library/threading.rst:858 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default):" msgstr "當以 *blocking* 引數設為 ``True``\\ (預設值)來呼叫:" -#: ../../library/threading.rst:820 ../../library/threading.rst:832 +#: ../../library/threading.rst:860 ../../library/threading.rst:872 msgid "If no thread owns the lock, acquire the lock and return immediately." msgstr "如果沒有執行緒擁有鎖,則獲得鎖並立即回傳。" -#: ../../library/threading.rst:822 +#: ../../library/threading.rst:862 msgid "" "If another thread owns the lock, block until we are able to acquire lock, or " "*timeout*, if set to a positive float value." @@ -1234,32 +1295,32 @@ msgstr "" "如果另一個執行緒擁有鎖,則阻塞直到能夠取得鎖,或者達到 *timeout*\\ (如果設定" "為正浮點值)。" -#: ../../library/threading.rst:825 +#: ../../library/threading.rst:865 msgid "" "If the same thread owns the lock, acquire the lock again, and return " "immediately. This is the difference between :class:`Lock` and :class:`!" "RLock`; :class:`Lock` handles this case the same as the previous, blocking " "until the lock can be acquired." msgstr "" -"如果同一個執行緒擁有鎖,則再次取得鎖,並立即回傳。這就是 :class:`Lock` 和 :" -"class:`!RLock` 之間的差別;:class:`Lock` 處理方式與上一種情況相同,會阻塞直到" -"能夠取得鎖。" +"如果同一個執行緒擁有鎖,則再次取得鎖,並立即回傳。這就是 :class:`Lock` " +"和 :class:`!RLock` 之間的差別;:class:`Lock` 處理方式與上一種情況相同,會阻塞" +"直到能夠取得鎖。" -#: ../../library/threading.rst:830 +#: ../../library/threading.rst:870 msgid "When invoked with the *blocking* argument set to ``False``:" msgstr "當以 *blocking* 引數設為 ``False`` 來呼叫:" -#: ../../library/threading.rst:834 +#: ../../library/threading.rst:874 msgid "If another thread owns the lock, return immediately." msgstr "如果另一個執行緒擁有該鎖,則立即回傳。" -#: ../../library/threading.rst:836 +#: ../../library/threading.rst:876 msgid "" "If the same thread owns the lock, acquire the lock again and return " "immediately." msgstr "如果同一個執行緒擁有鎖,則再次取得鎖並立即回傳。" -#: ../../library/threading.rst:839 +#: ../../library/threading.rst:879 msgid "" "In all cases, if the thread was able to acquire the lock, return ``True``. " "If the thread was unable to acquire the lock (i.e. if not blocking or the " @@ -1268,7 +1329,7 @@ msgstr "" "在所有情況下,如果執行緒能夠取得鎖則回傳 ``True``。如果執行緒無法取得鎖(即沒" "有阻塞或已達超時限制)則回傳 ``False``。" -#: ../../library/threading.rst:843 +#: ../../library/threading.rst:883 msgid "" "If called multiple times, failing to call :meth:`~RLock.release` as many " "times may lead to deadlock. Consider using :class:`!RLock` as a context " @@ -1277,7 +1338,7 @@ msgstr "" "如果多次呼叫,又未能呼叫相同次數的 :meth:`~RLock.release`,則可能會導致死鎖。" "考慮將 :class:`!RLock` 作為情境管理器使用,而不是直接呼叫 acquire/release。" -#: ../../library/threading.rst:853 +#: ../../library/threading.rst:893 msgid "" "Release a lock, decrementing the recursion level. If after the decrement it " "is zero, reset the lock to unlocked (not owned by any thread), and if any " @@ -1289,20 +1350,24 @@ msgstr "" "並且如果任何其他執行緒被阻塞以等待鎖變成未鎖定狀態,則僅允許其中一個執行緒繼" "續進行。如果遞減後遞迴等級仍然非零,則鎖會保持鎖定並由呼叫它的執行緒所擁有。" -#: ../../library/threading.rst:859 +#: ../../library/threading.rst:899 msgid "" -"Only call this method when the calling thread owns the lock. A :exc:" -"`RuntimeError` is raised if this method is called when the lock is not " -"acquired." +"Only call this method when the calling thread owns the lock. " +"A :exc:`RuntimeError` is raised if this method is called when the lock is " +"not acquired." msgstr "" -"僅當呼叫的執行緒擁有鎖時才能呼叫此方法。如果在未取得鎖時呼叫此方法則會引發 :" -"exc:`RuntimeError`。" +"僅當呼叫的執行緒擁有鎖時才能呼叫此方法。如果在未取得鎖時呼叫此方法則會引" +"發 :exc:`RuntimeError`。" -#: ../../library/threading.rst:869 +#: ../../library/threading.rst:908 ../../library/threading.rst:1007 +msgid "Return a boolean indicating whether this object is locked right now." +msgstr "" + +#: ../../library/threading.rst:916 msgid "Condition objects" msgstr "" -#: ../../library/threading.rst:871 +#: ../../library/threading.rst:918 msgid "" "A condition variable is always associated with some kind of lock; this can " "be passed in or one will be created by default. Passing one in is useful " @@ -1310,32 +1375,33 @@ msgid "" "of the condition object: you don't have to track it separately." msgstr "" -#: ../../library/threading.rst:876 +#: ../../library/threading.rst:923 msgid "" "A condition variable obeys the :ref:`context management protocol `: using the ``with`` statement acquires the associated lock for the " -"duration of the enclosed block. The :meth:`~Condition.acquire` and :meth:" -"`~Condition.release` methods also call the corresponding methods of the " -"associated lock." +"duration of the enclosed block. The :meth:`~Condition.acquire` " +"and :meth:`~Condition.release` methods also call the corresponding methods " +"of the associated lock." msgstr "" -#: ../../library/threading.rst:882 +#: ../../library/threading.rst:929 msgid "" -"Other methods must be called with the associated lock held. The :meth:" -"`~Condition.wait` method releases the lock, and then blocks until another " -"thread awakens it by calling :meth:`~Condition.notify` or :meth:`~Condition." -"notify_all`. Once awakened, :meth:`~Condition.wait` re-acquires the lock " -"and returns. It is also possible to specify a timeout." +"Other methods must be called with the associated lock held. " +"The :meth:`~Condition.wait` method releases the lock, and then blocks until " +"another thread awakens it by calling :meth:`~Condition.notify` " +"or :meth:`~Condition.notify_all`. Once awakened, :meth:`~Condition.wait` re-" +"acquires the lock and returns. It is also possible to specify a timeout." msgstr "" -#: ../../library/threading.rst:888 +#: ../../library/threading.rst:935 msgid "" "The :meth:`~Condition.notify` method wakes up one of the threads waiting for " -"the condition variable, if any are waiting. The :meth:`~Condition." -"notify_all` method wakes up all threads waiting for the condition variable." +"the condition variable, if any are waiting. " +"The :meth:`~Condition.notify_all` method wakes up all threads waiting for " +"the condition variable." msgstr "" -#: ../../library/threading.rst:892 +#: ../../library/threading.rst:939 msgid "" "Note: the :meth:`~Condition.notify` and :meth:`~Condition.notify_all` " "methods don't release the lock; this means that the thread or threads " @@ -1344,19 +1410,19 @@ msgid "" "or :meth:`~Condition.notify_all` finally relinquishes ownership of the lock." msgstr "" -#: ../../library/threading.rst:898 +#: ../../library/threading.rst:945 msgid "" "The typical programming style using condition variables uses the lock to " "synchronize access to some shared state; threads that are interested in a " "particular change of state call :meth:`~Condition.wait` repeatedly until " -"they see the desired state, while threads that modify the state call :meth:" -"`~Condition.notify` or :meth:`~Condition.notify_all` when they change the " -"state in such a way that it could possibly be a desired state for one of the " -"waiters. For example, the following code is a generic producer-consumer " -"situation with unlimited buffer capacity::" +"they see the desired state, while threads that modify the state " +"call :meth:`~Condition.notify` or :meth:`~Condition.notify_all` when they " +"change the state in such a way that it could possibly be a desired state for " +"one of the waiters. For example, the following code is a generic producer-" +"consumer situation with unlimited buffer capacity::" msgstr "" -#: ../../library/threading.rst:907 +#: ../../library/threading.rst:954 msgid "" "# Consume one item\n" "with cv:\n" @@ -1370,17 +1436,17 @@ msgid "" " cv.notify()" msgstr "" -#: ../../library/threading.rst:918 +#: ../../library/threading.rst:965 msgid "" "The ``while`` loop checking for the application's condition is necessary " "because :meth:`~Condition.wait` can return after an arbitrary long time, and " "the condition which prompted the :meth:`~Condition.notify` call may no " -"longer hold true. This is inherent to multi-threaded programming. The :" -"meth:`~Condition.wait_for` method can be used to automate the condition " +"longer hold true. This is inherent to multi-threaded programming. " +"The :meth:`~Condition.wait_for` method can be used to automate the condition " "checking, and eases the computation of timeouts::" msgstr "" -#: ../../library/threading.rst:925 +#: ../../library/threading.rst:972 msgid "" "# Consume an item\n" "with cv:\n" @@ -1388,54 +1454,54 @@ msgid "" " get_an_available_item()" msgstr "" -#: ../../library/threading.rst:930 +#: ../../library/threading.rst:977 msgid "" -"To choose between :meth:`~Condition.notify` and :meth:`~Condition." -"notify_all`, consider whether one state change can be interesting for only " -"one or several waiting threads. E.g. in a typical producer-consumer " -"situation, adding one item to the buffer only needs to wake up one consumer " -"thread." +"To choose between :meth:`~Condition.notify` " +"and :meth:`~Condition.notify_all`, consider whether one state change can be " +"interesting for only one or several waiting threads. E.g. in a typical " +"producer-consumer situation, adding one item to the buffer only needs to " +"wake up one consumer thread." msgstr "" -#: ../../library/threading.rst:938 +#: ../../library/threading.rst:985 msgid "" "This class implements condition variable objects. A condition variable " "allows one or more threads to wait until they are notified by another thread." msgstr "" -#: ../../library/threading.rst:941 +#: ../../library/threading.rst:988 msgid "" "If the *lock* argument is given and not ``None``, it must be a :class:`Lock` " "or :class:`RLock` object, and it is used as the underlying lock. Otherwise, " "a new :class:`RLock` object is created and used as the underlying lock." msgstr "" -#: ../../library/threading.rst:945 ../../library/threading.rst:1069 -#: ../../library/threading.rst:1115 ../../library/threading.rst:1167 -#: ../../library/threading.rst:1235 +#: ../../library/threading.rst:992 ../../library/threading.rst:1122 +#: ../../library/threading.rst:1168 ../../library/threading.rst:1220 +#: ../../library/threading.rst:1288 msgid "changed from a factory function to a class." msgstr "" -#: ../../library/threading.rst:950 +#: ../../library/threading.rst:997 msgid "" "Acquire the underlying lock. This method calls the corresponding method on " "the underlying lock; the return value is whatever that method returns." msgstr "" -#: ../../library/threading.rst:955 +#: ../../library/threading.rst:1002 msgid "" "Release the underlying lock. This method calls the corresponding method on " "the underlying lock; there is no return value." msgstr "" -#: ../../library/threading.rst:960 +#: ../../library/threading.rst:1013 msgid "" "Wait until notified or until a timeout occurs. If the calling thread has not " "acquired the lock when this method is called, a :exc:`RuntimeError` is " "raised." msgstr "" -#: ../../library/threading.rst:964 +#: ../../library/threading.rst:1017 msgid "" "This method releases the underlying lock, and then blocks until it is " "awakened by a :meth:`notify` or :meth:`notify_all` call for the same " @@ -1443,41 +1509,41 @@ msgid "" "Once awakened or timed out, it re-acquires the lock and returns." msgstr "" -#: ../../library/threading.rst:969 +#: ../../library/threading.rst:1022 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds (or " "fractions thereof)." msgstr "" -#: ../../library/threading.rst:973 +#: ../../library/threading.rst:1026 msgid "" -"When the underlying lock is an :class:`RLock`, it is not released using its :" -"meth:`release` method, since this may not actually unlock the lock when it " -"was acquired multiple times recursively. Instead, an internal interface of " -"the :class:`RLock` class is used, which really unlocks it even when it has " -"been recursively acquired several times. Another internal interface is then " -"used to restore the recursion level when the lock is reacquired." +"When the underlying lock is an :class:`RLock`, it is not released using " +"its :meth:`release` method, since this may not actually unlock the lock when " +"it was acquired multiple times recursively. Instead, an internal interface " +"of the :class:`RLock` class is used, which really unlocks it even when it " +"has been recursively acquired several times. Another internal interface is " +"then used to restore the recursion level when the lock is reacquired." msgstr "" -#: ../../library/threading.rst:981 +#: ../../library/threading.rst:1034 msgid "" "The return value is ``True`` unless a given *timeout* expired, in which case " "it is ``False``." msgstr "" -#: ../../library/threading.rst:984 ../../library/threading.rst:1200 +#: ../../library/threading.rst:1037 ../../library/threading.rst:1253 msgid "Previously, the method always returned ``None``." msgstr "" -#: ../../library/threading.rst:989 +#: ../../library/threading.rst:1042 msgid "" "Wait until a condition evaluates to true. *predicate* should be a callable " "which result will be interpreted as a boolean value. A *timeout* may be " "provided giving the maximum time to wait." msgstr "" -#: ../../library/threading.rst:993 +#: ../../library/threading.rst:1046 msgid "" "This utility method may call :meth:`wait` repeatedly until the predicate is " "satisfied, or until a timeout occurs. The return value is the last return " @@ -1485,13 +1551,13 @@ msgid "" "out." msgstr "" -#: ../../library/threading.rst:998 +#: ../../library/threading.rst:1051 msgid "" "Ignoring the timeout feature, calling this method is roughly equivalent to " "writing::" msgstr "" -#: ../../library/threading.rst:1001 +#: ../../library/threading.rst:1054 msgid "" "while not predicate():\n" " cv.wait()" @@ -1499,27 +1565,27 @@ msgstr "" "while not predicate():\n" " cv.wait()" -#: ../../library/threading.rst:1004 +#: ../../library/threading.rst:1057 msgid "" "Therefore, the same rules apply as with :meth:`wait`: The lock must be held " "when called and is re-acquired on return. The predicate is evaluated with " "the lock held." msgstr "" -#: ../../library/threading.rst:1012 +#: ../../library/threading.rst:1065 msgid "" "By default, wake up one thread waiting on this condition, if any. If the " -"calling thread has not acquired the lock when this method is called, a :exc:" -"`RuntimeError` is raised." +"calling thread has not acquired the lock when this method is called, " +"a :exc:`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:1016 +#: ../../library/threading.rst:1069 msgid "" "This method wakes up at most *n* of the threads waiting for the condition " "variable; it is a no-op if no threads are waiting." msgstr "" -#: ../../library/threading.rst:1019 +#: ../../library/threading.rst:1072 msgid "" "The current implementation wakes up exactly *n* threads, if at least *n* " "threads are waiting. However, it's not safe to rely on this behavior. A " @@ -1527,52 +1593,52 @@ msgid "" "threads." msgstr "" -#: ../../library/threading.rst:1024 +#: ../../library/threading.rst:1077 msgid "" "Note: an awakened thread does not actually return from its :meth:`wait` call " "until it can reacquire the lock. Since :meth:`notify` does not release the " "lock, its caller should." msgstr "" -#: ../../library/threading.rst:1030 +#: ../../library/threading.rst:1083 msgid "" -"Wake up all threads waiting on this condition. This method acts like :meth:" -"`notify`, but wakes up all waiting threads instead of one. If the calling " -"thread has not acquired the lock when this method is called, a :exc:" -"`RuntimeError` is raised." +"Wake up all threads waiting on this condition. This method acts " +"like :meth:`notify`, but wakes up all waiting threads instead of one. If the " +"calling thread has not acquired the lock when this method is called, " +"a :exc:`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:1035 +#: ../../library/threading.rst:1088 msgid "The method ``notifyAll`` is a deprecated alias for this method." msgstr "" -#: ../../library/threading.rst:1041 +#: ../../library/threading.rst:1094 msgid "Semaphore objects" msgstr "Semaphore 物件" -#: ../../library/threading.rst:1043 +#: ../../library/threading.rst:1096 msgid "" "This is one of the oldest synchronization primitives in the history of " "computer science, invented by the early Dutch computer scientist Edsger W. " -"Dijkstra (he used the names ``P()`` and ``V()`` instead of :meth:`~Semaphore." -"acquire` and :meth:`~Semaphore.release`)." +"Dijkstra (he used the names ``P()`` and ``V()`` instead " +"of :meth:`~Semaphore.acquire` and :meth:`~Semaphore.release`)." msgstr "" -#: ../../library/threading.rst:1048 +#: ../../library/threading.rst:1101 msgid "" -"A semaphore manages an internal counter which is decremented by each :meth:" -"`~Semaphore.acquire` call and incremented by each :meth:`~Semaphore.release` " -"call. The counter can never go below zero; when :meth:`~Semaphore.acquire` " -"finds that it is zero, it blocks, waiting until some other thread calls :" -"meth:`~Semaphore.release`." +"A semaphore manages an internal counter which is decremented by " +"each :meth:`~Semaphore.acquire` call and incremented by " +"each :meth:`~Semaphore.release` call. The counter can never go below zero; " +"when :meth:`~Semaphore.acquire` finds that it is zero, it blocks, waiting " +"until some other thread calls :meth:`~Semaphore.release`." msgstr "" -#: ../../library/threading.rst:1054 +#: ../../library/threading.rst:1107 msgid "" "Semaphores also support the :ref:`context management protocol `." msgstr "" -#: ../../library/threading.rst:1059 +#: ../../library/threading.rst:1112 msgid "" "This class implements semaphore objects. A semaphore manages an atomic " "counter representing the number of :meth:`release` calls minus the number " @@ -1581,75 +1647,75 @@ msgid "" "If not given, *value* defaults to 1." msgstr "" -#: ../../library/threading.rst:1065 +#: ../../library/threading.rst:1118 msgid "" "The optional argument gives the initial *value* for the internal counter; it " "defaults to ``1``. If the *value* given is less than 0, :exc:`ValueError` is " "raised." msgstr "" -#: ../../library/threading.rst:1074 +#: ../../library/threading.rst:1127 msgid "Acquire a semaphore." msgstr "" -#: ../../library/threading.rst:1076 +#: ../../library/threading.rst:1129 msgid "When invoked without arguments:" msgstr "" -#: ../../library/threading.rst:1078 +#: ../../library/threading.rst:1131 msgid "" "If the internal counter is larger than zero on entry, decrement it by one " "and return ``True`` immediately." msgstr "" -#: ../../library/threading.rst:1080 +#: ../../library/threading.rst:1133 msgid "" -"If the internal counter is zero on entry, block until awoken by a call to :" -"meth:`~Semaphore.release`. Once awoken (and the counter is greater than 0), " -"decrement the counter by 1 and return ``True``. Exactly one thread will be " -"awoken by each call to :meth:`~Semaphore.release`. The order in which " +"If the internal counter is zero on entry, block until awoken by a call " +"to :meth:`~Semaphore.release`. Once awoken (and the counter is greater than " +"0), decrement the counter by 1 and return ``True``. Exactly one thread will " +"be awoken by each call to :meth:`~Semaphore.release`. The order in which " "threads are awoken should not be relied on." msgstr "" -#: ../../library/threading.rst:1086 +#: ../../library/threading.rst:1139 msgid "" "When invoked with *blocking* set to ``False``, do not block. If a call " "without an argument would block, return ``False`` immediately; otherwise, do " "the same thing as when called without arguments, and return ``True``." msgstr "" -#: ../../library/threading.rst:1090 +#: ../../library/threading.rst:1143 msgid "" "When invoked with a *timeout* other than ``None``, it will block for at most " "*timeout* seconds. If acquire does not complete successfully in that " "interval, return ``False``. Return ``True`` otherwise." msgstr "" -#: ../../library/threading.rst:1099 +#: ../../library/threading.rst:1152 msgid "" "Release a semaphore, incrementing the internal counter by *n*. When it was " "zero on entry and other threads are waiting for it to become larger than " "zero again, wake up *n* of those threads." msgstr "" -#: ../../library/threading.rst:1103 +#: ../../library/threading.rst:1156 msgid "Added the *n* parameter to release multiple waiting threads at once." msgstr "" -#: ../../library/threading.rst:1109 +#: ../../library/threading.rst:1162 msgid "" "Class implementing bounded semaphore objects. A bounded semaphore checks to " -"make sure its current value doesn't exceed its initial value. If it does, :" -"exc:`ValueError` is raised. In most situations semaphores are used to guard " -"resources with limited capacity. If the semaphore is released too many " -"times it's a sign of a bug. If not given, *value* defaults to 1." +"make sure its current value doesn't exceed its initial value. If it " +"does, :exc:`ValueError` is raised. In most situations semaphores are used to " +"guard resources with limited capacity. If the semaphore is released too " +"many times it's a sign of a bug. If not given, *value* defaults to 1." msgstr "" -#: ../../library/threading.rst:1122 +#: ../../library/threading.rst:1175 msgid ":class:`Semaphore` example" msgstr ":class:`Semaphore` 範例" -#: ../../library/threading.rst:1124 +#: ../../library/threading.rst:1177 msgid "" "Semaphores are often used to guard resources with limited capacity, for " "example, a database server. In any situation where the size of the resource " @@ -1657,7 +1723,7 @@ msgid "" "threads, your main thread would initialize the semaphore::" msgstr "" -#: ../../library/threading.rst:1129 +#: ../../library/threading.rst:1182 msgid "" "maxconnections = 5\n" "# ...\n" @@ -1667,13 +1733,13 @@ msgstr "" "# ...\n" "pool_sema = BoundedSemaphore(value=maxconnections)" -#: ../../library/threading.rst:1133 +#: ../../library/threading.rst:1186 msgid "" "Once spawned, worker threads call the semaphore's acquire and release " "methods when they need to connect to the server::" msgstr "" -#: ../../library/threading.rst:1136 +#: ../../library/threading.rst:1189 msgid "" "with pool_sema:\n" " conn = connectdb()\n" @@ -1689,61 +1755,62 @@ msgstr "" " finally:\n" " conn.close()" -#: ../../library/threading.rst:1143 +#: ../../library/threading.rst:1196 msgid "" "The use of a bounded semaphore reduces the chance that a programming error " "which causes the semaphore to be released more than it's acquired will go " "undetected." msgstr "" -#: ../../library/threading.rst:1150 +#: ../../library/threading.rst:1203 msgid "Event objects" msgstr "" -#: ../../library/threading.rst:1152 +#: ../../library/threading.rst:1205 msgid "" "This is one of the simplest mechanisms for communication between threads: " "one thread signals an event and other threads wait for it." msgstr "" -#: ../../library/threading.rst:1155 +#: ../../library/threading.rst:1208 msgid "" -"An event object manages an internal flag that can be set to true with the :" -"meth:`~Event.set` method and reset to false with the :meth:`~Event.clear` " -"method. The :meth:`~Event.wait` method blocks until the flag is true." +"An event object manages an internal flag that can be set to true with " +"the :meth:`~Event.set` method and reset to false with " +"the :meth:`~Event.clear` method. The :meth:`~Event.wait` method blocks " +"until the flag is true." msgstr "" -#: ../../library/threading.rst:1162 +#: ../../library/threading.rst:1215 msgid "" "Class implementing event objects. An event manages a flag that can be set " -"to true with the :meth:`~Event.set` method and reset to false with the :meth:" -"`clear` method. The :meth:`wait` method blocks until the flag is true. The " -"flag is initially false." +"to true with the :meth:`~Event.set` method and reset to false with " +"the :meth:`clear` method. The :meth:`wait` method blocks until the flag is " +"true. The flag is initially false." msgstr "" -#: ../../library/threading.rst:1172 +#: ../../library/threading.rst:1225 msgid "Return ``True`` if and only if the internal flag is true." msgstr "" -#: ../../library/threading.rst:1174 +#: ../../library/threading.rst:1227 msgid "The method ``isSet`` is a deprecated alias for this method." msgstr "" -#: ../../library/threading.rst:1178 +#: ../../library/threading.rst:1231 msgid "" "Set the internal flag to true. All threads waiting for it to become true are " "awakened. Threads that call :meth:`wait` once the flag is true will not " "block at all." msgstr "" -#: ../../library/threading.rst:1184 +#: ../../library/threading.rst:1237 msgid "" "Reset the internal flag to false. Subsequently, threads calling :meth:`wait` " "will block until :meth:`.set` is called to set the internal flag to true " "again." msgstr "" -#: ../../library/threading.rst:1190 +#: ../../library/threading.rst:1243 msgid "" "Block as long as the internal flag is false and the timeout, if given, has " "not expired. The return value represents the reason that this blocking " @@ -1752,26 +1819,26 @@ msgid "" "become true within the given wait time." msgstr "" -#: ../../library/threading.rst:1196 +#: ../../library/threading.rst:1249 msgid "" "When the timeout argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds, or " "fractions thereof." msgstr "" -#: ../../library/threading.rst:1207 +#: ../../library/threading.rst:1260 msgid "Timer objects" msgstr "Timer 物件" -#: ../../library/threading.rst:1209 +#: ../../library/threading.rst:1262 msgid "" "This class represents an action that should be run only after a certain " -"amount of time has passed --- a timer. :class:`Timer` is a subclass of :" -"class:`Thread` and as such also functions as an example of creating custom " -"threads." +"amount of time has passed --- a timer. :class:`Timer` is a subclass " +"of :class:`Thread` and as such also functions as an example of creating " +"custom threads." msgstr "" -#: ../../library/threading.rst:1213 +#: ../../library/threading.rst:1266 msgid "" "Timers are started, as with threads, by calling their :meth:`Timer.start " "` method. The timer can be stopped (before its action has " @@ -1780,11 +1847,11 @@ msgid "" "interval specified by the user." msgstr "" -#: ../../library/threading.rst:1219 +#: ../../library/threading.rst:1272 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/threading.rst:1221 +#: ../../library/threading.rst:1274 msgid "" "def hello():\n" " print(\"hello, world\")\n" @@ -1798,7 +1865,7 @@ msgstr "" "t = Timer(30.0, hello)\n" "t.start() # 30 秒後會印出 \"hello, world\"" -#: ../../library/threading.rst:1230 +#: ../../library/threading.rst:1283 msgid "" "Create a timer that will run *function* with arguments *args* and keyword " "arguments *kwargs*, after *interval* seconds have passed. If *args* is " @@ -1806,17 +1873,17 @@ msgid "" "``None`` (the default) then an empty dict will be used." msgstr "" -#: ../../library/threading.rst:1240 +#: ../../library/threading.rst:1293 msgid "" "Stop the timer, and cancel the execution of the timer's action. This will " "only work if the timer is still in its waiting stage." msgstr "" -#: ../../library/threading.rst:1245 +#: ../../library/threading.rst:1298 msgid "Barrier objects" msgstr "Barrier 物件" -#: ../../library/threading.rst:1249 +#: ../../library/threading.rst:1302 msgid "" "This class provides a simple synchronization primitive for use by a fixed " "number of threads that need to wait for each other. Each of the threads " @@ -1825,18 +1892,18 @@ msgid "" "calls. At this point, the threads are released simultaneously." msgstr "" -#: ../../library/threading.rst:1255 +#: ../../library/threading.rst:1308 msgid "" "The barrier can be reused any number of times for the same number of threads." msgstr "" -#: ../../library/threading.rst:1257 +#: ../../library/threading.rst:1310 msgid "" "As an example, here is a simple way to synchronize a client and server " "thread::" msgstr "" -#: ../../library/threading.rst:1259 +#: ../../library/threading.rst:1312 msgid "" "b = Barrier(2, timeout=5)\n" "\n" @@ -1868,7 +1935,7 @@ msgstr "" " connection = make_connection()\n" " process_client_connection(connection)" -#: ../../library/threading.rst:1277 +#: ../../library/threading.rst:1330 msgid "" "Create a barrier object for *parties* number of threads. An *action*, when " "provided, is a callable to be called by one of the threads when they are " @@ -1876,7 +1943,7 @@ msgid "" "the :meth:`wait` method." msgstr "" -#: ../../library/threading.rst:1284 +#: ../../library/threading.rst:1337 msgid "" "Pass the barrier. When all the threads party to the barrier have called " "this function, they are all released simultaneously. If a *timeout* is " @@ -1884,14 +1951,14 @@ msgid "" "constructor." msgstr "" -#: ../../library/threading.rst:1289 +#: ../../library/threading.rst:1342 msgid "" "The return value is an integer in the range 0 to *parties* -- 1, different " "for each thread. This can be used to select a thread to do some special " "housekeeping, e.g.::" msgstr "" -#: ../../library/threading.rst:1293 +#: ../../library/threading.rst:1346 msgid "" "i = barrier.wait()\n" "if i == 0:\n" @@ -1903,37 +1970,37 @@ msgstr "" " # 只會有一個執行緒會印出這個\n" " print(\"passed the barrier\")" -#: ../../library/threading.rst:1298 +#: ../../library/threading.rst:1351 msgid "" "If an *action* was provided to the constructor, one of the threads will have " "called it prior to being released. Should this call raise an error, the " "barrier is put into the broken state." msgstr "" -#: ../../library/threading.rst:1302 +#: ../../library/threading.rst:1355 msgid "If the call times out, the barrier is put into the broken state." msgstr "" -#: ../../library/threading.rst:1304 +#: ../../library/threading.rst:1357 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a thread is waiting." msgstr "" -#: ../../library/threading.rst:1309 +#: ../../library/threading.rst:1362 msgid "" "Return the barrier to the default, empty state. Any threads waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" -#: ../../library/threading.rst:1312 +#: ../../library/threading.rst:1365 msgid "" "Note that using this function may require some external synchronization if " "there are other threads whose state is unknown. If a barrier is broken it " "may be better to just leave it and create a new one." msgstr "" -#: ../../library/threading.rst:1318 +#: ../../library/threading.rst:1371 msgid "" "Put the barrier into a broken state. This causes any active or future calls " "to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for " @@ -1941,36 +2008,36 @@ msgid "" "application." msgstr "" -#: ../../library/threading.rst:1323 +#: ../../library/threading.rst:1376 msgid "" "It may be preferable to simply create the barrier with a sensible *timeout* " "value to automatically guard against one of the threads going awry." msgstr "" -#: ../../library/threading.rst:1329 +#: ../../library/threading.rst:1382 msgid "The number of threads required to pass the barrier." msgstr "" -#: ../../library/threading.rst:1333 +#: ../../library/threading.rst:1386 msgid "The number of threads currently waiting in the barrier." msgstr "" -#: ../../library/threading.rst:1337 +#: ../../library/threading.rst:1390 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -#: ../../library/threading.rst:1342 +#: ../../library/threading.rst:1395 msgid "" -"This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" -"`Barrier` object is reset or broken." +"This exception, a subclass of :exc:`RuntimeError`, is raised when " +"the :class:`Barrier` object is reset or broken." msgstr "" -#: ../../library/threading.rst:1349 +#: ../../library/threading.rst:1402 msgid "" "Using locks, conditions, and semaphores in the :keyword:`!with` statement" msgstr "" -#: ../../library/threading.rst:1351 +#: ../../library/threading.rst:1404 msgid "" "All of the objects provided by this module that have ``acquire`` and " "``release`` methods can be used as context managers for a :keyword:`with` " @@ -1979,7 +2046,7 @@ msgid "" "following snippet::" msgstr "" -#: ../../library/threading.rst:1357 +#: ../../library/threading.rst:1410 msgid "" "with some_lock:\n" " # do something..." @@ -1987,11 +2054,11 @@ msgstr "" "with some_lock:\n" " # 做某些事情..." -#: ../../library/threading.rst:1360 +#: ../../library/threading.rst:1413 msgid "is equivalent to::" msgstr "" -#: ../../library/threading.rst:1362 +#: ../../library/threading.rst:1415 msgid "" "some_lock.acquire()\n" "try:\n" @@ -2005,11 +2072,11 @@ msgstr "" "finally:\n" " some_lock.release()" -#: ../../library/threading.rst:1368 +#: ../../library/threading.rst:1421 msgid "" -"Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, :class:" -"`Semaphore`, and :class:`BoundedSemaphore` objects may be used as :keyword:" -"`with` statement context managers." +"Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, :class:`Semaphore`, " +"and :class:`BoundedSemaphore` objects may be used as :keyword:`with` " +"statement context managers." msgstr "" #: ../../library/threading.rst:222 ../../library/threading.rst:240 diff --git a/library/token.po b/library/token.po index 120e3cfe6e9..7a7a8c94148 100644 --- a/library/token.po +++ b/library/token.po @@ -7,7 +7,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-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -92,8 +92,8 @@ msgstr "" #: ../../library/token.rst:70 msgid "" -"A generic token value that indicates an :ref:`operator ` or :ref:" -"`delimiter `." +"A generic token value that indicates an :ref:`operator ` " +"or :ref:`delimiter `." msgstr "" #: ../../library/token.rst:75 @@ -138,7 +138,7 @@ msgid "" "strings>`." msgstr "" -#: ../../library/token.rst:111 +#: ../../library/token.rst:111 ../../library/token.rst:140 msgid "" "The token string includes the prefix and the opening quote(s), but none of " "the contents of the literal." @@ -153,82 +153,108 @@ msgstr "" #: ../../library/token.rst:121 msgid "" "Replacement fields (that is, the non-literal parts of f-strings) use the " -"same tokens as other expressions, and are delimited by :data:`LBRACE`, :data:" -"`RBRACE`, :data:`EXCLAMATION` and :data:`COLON` tokens." +"same tokens as other expressions, and are delimited " +"by :data:`LBRACE`, :data:`RBRACE`, :data:`EXCLAMATION` and :data:`COLON` " +"tokens." msgstr "" #: ../../library/token.rst:128 msgid "Token value used to indicate the end of a :ref:`f-string `." msgstr "" -#: ../../library/token.rst:132 +#: ../../library/token.rst:132 ../../library/token.rst:165 msgid "The token string contains the closing quote(s)." msgstr "" #: ../../library/token.rst:136 -msgid "Token value that indicates the end of input." +msgid "" +"Token value used to indicate the beginning of a template string literal." +msgstr "" + +#: ../../library/token.rst:147 +msgid "" +"Token value used for literal text inside a template string literal including " +"format specifications." +msgstr "" + +#: ../../library/token.rst:152 +msgid "" +"Replacement fields (that is, the non-literal parts of t-strings) use the " +"same tokens as other expressions, and are delimited " +"by :data:`LBRACE`, :data:`RBRACE`, :data:`EXCLAMATION` and :data:`COLON` " +"tokens." msgstr "" -#: ../../library/token.rst:140 +#: ../../library/token.rst:161 +msgid "Token value used to indicate the end of a template string literal." +msgstr "" + +#: ../../library/token.rst:171 +msgid "" +"Token value that indicates the end of input. Used in :ref:`top-level grammar " +"rules `." +msgstr "" + +#: ../../library/token.rst:176 msgid "" "Token value that indicates the encoding used to decode the source bytes into " "text. The first token returned by :func:`tokenize.tokenize` will always be " "an ``ENCODING`` token." msgstr "" -#: ../../library/token.rst:146 +#: ../../library/token.rst:182 msgid "" -"This token type isn't used by the C tokenizer but is needed for the :mod:" -"`tokenize` module." +"This token type isn't used by the C tokenizer but is needed for " +"the :mod:`tokenize` module." msgstr "" -#: ../../library/token.rst:150 +#: ../../library/token.rst:186 msgid "" "The following token types are not produced by the :mod:`tokenize` module, " "and are defined for special uses in the tokenizer or parser:" msgstr "" -#: ../../library/token.rst:155 +#: ../../library/token.rst:191 msgid "" "Token value indicating that a ``type: ignore`` comment was recognized. Such " -"tokens are produced instead of regular :data:`COMMENT` tokens only with the :" -"data:`~ast.PyCF_TYPE_COMMENTS` flag." +"tokens are produced instead of regular :data:`COMMENT` tokens only with " +"the :data:`~ast.PyCF_TYPE_COMMENTS` flag." msgstr "" -#: ../../library/token.rst:161 +#: ../../library/token.rst:197 msgid "" "Token value indicating that a type comment was recognized. Such tokens are " -"produced instead of regular :data:`COMMENT` tokens only with the :data:`~ast." -"PyCF_TYPE_COMMENTS` flag." +"produced instead of regular :data:`COMMENT` tokens only with " +"the :data:`~ast.PyCF_TYPE_COMMENTS` flag." msgstr "" -#: ../../library/token.rst:167 +#: ../../library/token.rst:203 msgid "Token value indicating a :ref:`soft keyword `." msgstr "" -#: ../../library/token.rst:169 +#: ../../library/token.rst:205 msgid "" "The tokenizer never produces this value. To check for a soft keyword, pass " "a :data:`NAME` token's string to :func:`keyword.issoftkeyword`." msgstr "" -#: ../../library/token.rst:175 +#: ../../library/token.rst:211 msgid "Token value used to indicate wrong input." msgstr "" -#: ../../library/token.rst:177 +#: ../../library/token.rst:213 msgid "" "The :mod:`tokenize` module generally indicates errors by raising exceptions " "instead of emitting this token. It can also emit tokens such as :data:`OP` " "or :data:`NAME` with strings that are later rejected by the parser." msgstr "" -#: ../../library/token.rst:185 +#: ../../library/token.rst:221 msgid "" -"The remaining tokens represent specific :ref:`operators ` and :" -"ref:`delimiters `. (The :mod:`tokenize` module reports these as :" -"data:`OP`; see ``exact_type`` in the :mod:`tokenize` documentation for " -"details.)" +"The remaining tokens represent specific :ref:`operators ` " +"and :ref:`delimiters `. (The :mod:`tokenize` module reports " +"these as :data:`OP`; see ``exact_type`` in the :mod:`tokenize` documentation " +"for details.)" msgstr "" #: ../../library/token-list.inc:7 @@ -431,46 +457,46 @@ msgstr "``\":=\"``" msgid "``\"!\"``" msgstr "``\"!\"``" -#: ../../library/token.rst:193 +#: ../../library/token.rst:229 msgid "The following non-token constants are provided:" msgstr "" -#: ../../library/token.rst:197 +#: ../../library/token.rst:233 msgid "The number of token types defined in this module." msgstr "" -#: ../../library/token.rst:204 +#: ../../library/token.rst:240 msgid "" "A dictionary mapping the string representation of a token to its numeric " "code." msgstr "" -#: ../../library/token.rst:209 +#: ../../library/token.rst:245 msgid "Added :data:`!AWAIT` and :data:`!ASYNC` tokens." msgstr "" -#: ../../library/token.rst:212 +#: ../../library/token.rst:248 msgid "Added :data:`COMMENT`, :data:`NL` and :data:`ENCODING` tokens." msgstr "" -#: ../../library/token.rst:215 +#: ../../library/token.rst:251 msgid "" "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens. \"async\" and \"await\" " "are now tokenized as :data:`NAME` tokens." msgstr "" -#: ../../library/token.rst:219 +#: ../../library/token.rst:255 msgid "" -"Added :data:`TYPE_COMMENT`, :data:`TYPE_IGNORE`, :data:`COLONEQUAL`. Added :" -"data:`!AWAIT` and :data:`!ASYNC` tokens back (they're needed to support " -"parsing older Python versions for :func:`ast.parse` with ``feature_version`` " -"set to 6 or lower)." +"Added :data:`TYPE_COMMENT`, :data:`TYPE_IGNORE`, :data:`COLONEQUAL`. " +"Added :data:`!AWAIT` and :data:`!ASYNC` tokens back (they're needed to " +"support parsing older Python versions for :func:`ast.parse` with " +"``feature_version`` set to 6 or lower)." msgstr "" -#: ../../library/token.rst:225 +#: ../../library/token.rst:261 msgid "Added :data:`EXCLAMATION`." msgstr "新增 :data:`EXCLAMATION`。" -#: ../../library/token.rst:228 +#: ../../library/token.rst:264 msgid "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens again." msgstr "" diff --git a/library/tomllib.po b/library/tomllib.po index 45bf2403d2b..108936b315a 100644 --- a/library/tomllib.po +++ b/library/tomllib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 23:08+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-11-18 01:56+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,8 +32,8 @@ msgid "" "Minimal Language, `https://toml.io `_). This module " "does not support writing TOML." msgstr "" -"此模組提供了剖析 TOML 1.0.0 (Tom's Obvious Minimal Language, `https://toml." -"io `_) 的一個介面,此模組並不支援寫入 TOML。" +"此模組提供了剖析 TOML 1.0.0 (Tom's Obvious Minimal Language, `https://" +"toml.io `_) 的一個介面,此模組並不支援寫入 TOML。" #: ../../library/tomllib.rst:22 msgid "" @@ -61,25 +61,25 @@ msgstr "此模組定義了以下函式:" #: ../../library/tomllib.rst:39 msgid "" "Read a TOML file. The first argument should be a readable and binary file " -"object. Return a :class:`dict`. Convert TOML types to Python using this :ref:" -"`conversion table `." +"object. Return a :class:`dict`. Convert TOML types to Python using " +"this :ref:`conversion table `." msgstr "" -"讀取一個 TOML 檔案。第一個引數應為一個可讀取的二進位檔案物件。回傳一個 :" -"class:`dict`。用這個\\ :ref:`轉換表 `\\ 將 TOML 型別轉換成 " -"Python 的。" +"讀取一個 TOML 檔案。第一個引數應為一個可讀取的二進位檔案物件。回傳一" +"個 :class:`dict`。用這個\\ :ref:`轉換表 `\\ 將 TOML 型別轉" +"換成 Python 的。" #: ../../library/tomllib.rst:43 msgid "" "*parse_float* will be called with the string of every TOML float to be " "decoded. By default, this is equivalent to ``float(num_str)``. This can be " -"used to use another datatype or parser for TOML floats (e.g. :class:`decimal." -"Decimal`). The callable must not return a :class:`dict` or a :class:`list`, " -"else a :exc:`ValueError` is raised." +"used to use another datatype or parser for TOML floats " +"(e.g. :class:`decimal.Decimal`). The callable must not return " +"a :class:`dict` or a :class:`list`, else a :exc:`ValueError` is raised." msgstr "" "*parse_float* 會被呼叫於要解碼的每個 TOML 浮點數字串。預設情況下,這相當於 " -"``float(num_str)``。若有使用另一種資料型別或剖析器的 TOML 浮點數(例如 :" -"class:`decimal.Decimal`),這就派得上用場。可呼叫物件不得回傳 :class:`dict` " -"或 :class:`list`,否則會引發 :exc:`ValueError`。" +"``float(num_str)``。若有使用另一種資料型別或剖析器的 TOML 浮點數(例" +"如 :class:`decimal.Decimal`),這就派得上用場。可呼叫物件不得回" +"傳 :class:`dict` 或 :class:`list`,否則會引發 :exc:`ValueError`。" #: ../../library/tomllib.rst:49 ../../library/tomllib.rst:58 msgid "A :exc:`TOMLDecodeError` will be raised on an invalid TOML document." @@ -100,18 +100,49 @@ msgid "The following exceptions are available:" msgstr "以下為可用的例外:" #: ../../library/tomllib.rst:65 -msgid "Subclass of :exc:`ValueError`." -msgstr ":exc:`ValueError` 的子類別。" +msgid "Subclass of :exc:`ValueError` with the following additional attributes:" +msgstr "" #: ../../library/tomllib.rst:69 +msgid "The unformatted error message." +msgstr "" + +#: ../../library/tomllib.rst:73 +msgid "The TOML document being parsed." +msgstr "" + +#: ../../library/tomllib.rst:77 +msgid "The index of *doc* where parsing failed." +msgstr "" + +#: ../../library/tomllib.rst:81 +msgid "The line corresponding to *pos*." +msgstr "" + +#: ../../library/tomllib.rst:85 +msgid "The column corresponding to *pos*." +msgstr "" + +#: ../../library/tomllib.rst:87 +msgid "" +"Added the *msg*, *doc* and *pos* parameters. Added " +"the :attr:`msg`, :attr:`doc`, :attr:`pos`, :attr:`lineno` and :attr:`colno` " +"attributes." +msgstr "" + +#: ../../library/tomllib.rst:91 +msgid "Passing free-form positional arguments is deprecated." +msgstr "" + +#: ../../library/tomllib.rst:96 msgid "Examples" msgstr "範例" -#: ../../library/tomllib.rst:71 +#: ../../library/tomllib.rst:98 msgid "Parsing a TOML file::" msgstr "剖析一個 TOML 檔案: ::" -#: ../../library/tomllib.rst:73 +#: ../../library/tomllib.rst:100 msgid "" "import tomllib\n" "\n" @@ -123,11 +154,11 @@ msgstr "" "with open(\"pyproject.toml\", \"rb\") as f:\n" " data = tomllib.load(f)" -#: ../../library/tomllib.rst:78 +#: ../../library/tomllib.rst:105 msgid "Parsing a TOML string::" msgstr "剖析一個 TOML 字串: ::" -#: ../../library/tomllib.rst:80 +#: ../../library/tomllib.rst:107 msgid "" "import tomllib\n" "\n" @@ -147,114 +178,117 @@ msgstr "" "\n" "data = tomllib.loads(toml_str)" -#: ../../library/tomllib.rst:91 +#: ../../library/tomllib.rst:118 msgid "Conversion Table" msgstr "轉換表" -#: ../../library/tomllib.rst:96 +#: ../../library/tomllib.rst:123 msgid "TOML" msgstr "TOML" -#: ../../library/tomllib.rst:96 +#: ../../library/tomllib.rst:123 msgid "Python" msgstr "Python" -#: ../../library/tomllib.rst:98 +#: ../../library/tomllib.rst:125 msgid "TOML document" msgstr "TOML 文件" -#: ../../library/tomllib.rst:98 ../../library/tomllib.rst:118 -#: ../../library/tomllib.rst:120 +#: ../../library/tomllib.rst:125 ../../library/tomllib.rst:145 +#: ../../library/tomllib.rst:147 msgid "dict" msgstr "dict" -#: ../../library/tomllib.rst:100 +#: ../../library/tomllib.rst:127 msgid "string" msgstr "string" -#: ../../library/tomllib.rst:100 +#: ../../library/tomllib.rst:127 msgid "str" msgstr "str" -#: ../../library/tomllib.rst:102 +#: ../../library/tomllib.rst:129 msgid "integer" msgstr "integer" -#: ../../library/tomllib.rst:102 +#: ../../library/tomllib.rst:129 msgid "int" msgstr "int" -#: ../../library/tomllib.rst:104 +#: ../../library/tomllib.rst:131 msgid "float" msgstr "float" -#: ../../library/tomllib.rst:104 +#: ../../library/tomllib.rst:131 msgid "float (configurable with *parse_float*)" msgstr "float(可透過 *parse_float* 調整)" -#: ../../library/tomllib.rst:106 +#: ../../library/tomllib.rst:133 msgid "boolean" msgstr "boolean" -#: ../../library/tomllib.rst:106 +#: ../../library/tomllib.rst:133 msgid "bool" msgstr "bool" -#: ../../library/tomllib.rst:108 +#: ../../library/tomllib.rst:135 msgid "offset date-time" msgstr "偏移日期時間 (offset date-time)" -#: ../../library/tomllib.rst:108 +#: ../../library/tomllib.rst:135 msgid "" -"datetime.datetime (``tzinfo`` attribute set to an instance of ``datetime." -"timezone``)" +"datetime.datetime (``tzinfo`` attribute set to an instance of " +"``datetime.timezone``)" msgstr "" "datetime.datetime(設定 ``tzinfo`` 屬性為 ``datetime.timezone`` 的實例)" -#: ../../library/tomllib.rst:110 +#: ../../library/tomllib.rst:137 msgid "local date-time" msgstr "本地日期時間 (local date-time)" -#: ../../library/tomllib.rst:110 +#: ../../library/tomllib.rst:137 msgid "datetime.datetime (``tzinfo`` attribute set to ``None``)" msgstr "datetime.datetime(設定 ``tzinfo`` 為 ``None``)" -#: ../../library/tomllib.rst:112 +#: ../../library/tomllib.rst:139 msgid "local date" msgstr "本地日期 (local date)" -#: ../../library/tomllib.rst:112 +#: ../../library/tomllib.rst:139 msgid "datetime.date" msgstr "datetime.date" -#: ../../library/tomllib.rst:114 +#: ../../library/tomllib.rst:141 msgid "local time" msgstr "本地時間 (local time)" -#: ../../library/tomllib.rst:114 +#: ../../library/tomllib.rst:141 msgid "datetime.time" msgstr "datetime.time" -#: ../../library/tomllib.rst:116 +#: ../../library/tomllib.rst:143 msgid "array" msgstr "array" -#: ../../library/tomllib.rst:116 +#: ../../library/tomllib.rst:143 msgid "list" msgstr "list" -#: ../../library/tomllib.rst:118 +#: ../../library/tomllib.rst:145 msgid "table" msgstr "table" -#: ../../library/tomllib.rst:120 +#: ../../library/tomllib.rst:147 msgid "inline table" msgstr "行內表格 (inline table)" -#: ../../library/tomllib.rst:122 +#: ../../library/tomllib.rst:149 msgid "array of tables" msgstr "表格陣列 (array of tables)" -#: ../../library/tomllib.rst:122 +#: ../../library/tomllib.rst:149 msgid "list of dicts" msgstr "dict 串列 (list of dicts)" + +#~ msgid "Subclass of :exc:`ValueError`." +#~ msgstr ":exc:`ValueError` 的子類別。" diff --git a/library/traceback.po b/library/traceback.po index 39b35589486..613ff0ff81d 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-03 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,8 +41,8 @@ msgstr "" #: ../../library/traceback.rst:23 msgid "" "The module uses :ref:`traceback objects ` --- these are " -"objects of type :class:`types.TracebackType`, which are assigned to the :" -"attr:`~BaseException.__traceback__` field of :class:`BaseException` " +"objects of type :class:`types.TracebackType`, which are assigned to " +"the :attr:`~BaseException.__traceback__` field of :class:`BaseException` " "instances." msgstr "" @@ -76,18 +76,24 @@ msgstr "" #: ../../library/traceback.rst:41 msgid "" -":class:`TracebackException` class and its helper classes :class:" -"`StackSummary` and :class:`FrameSummary`. These offer both more flexibility " -"in the output generated and the ability to store the information necessary " -"for later formatting without holding references to actual exception and " -"traceback objects." +":class:`TracebackException` class and its helper " +"classes :class:`StackSummary` and :class:`FrameSummary`. These offer both " +"more flexibility in the output generated and the ability to store the " +"information necessary for later formatting without holding references to " +"actual exception and traceback objects." msgstr "" -#: ../../library/traceback.rst:49 -msgid "Module-Level Functions" +#: ../../library/traceback.rst:47 +msgid "" +"Output is colorized by default and can be :ref:`controlled using environment " +"variables `." msgstr "" #: ../../library/traceback.rst:53 +msgid "Module-Level Functions" +msgstr "" + +#: ../../library/traceback.rst:57 msgid "" "Print up to *limit* stack trace entries from :ref:`traceback object " "` *tb* (starting from the caller's frame) if *limit* is " @@ -98,81 +104,81 @@ msgid "" "output." msgstr "" -#: ../../library/traceback.rst:64 +#: ../../library/traceback.rst:68 msgid "" -"The meaning of the *limit* parameter is different than the meaning of :const:" -"`sys.tracebacklimit`. A negative *limit* value corresponds to a positive " -"value of :const:`!sys.tracebacklimit`, whereas the behaviour of a positive " -"*limit* value cannot be achieved with :const:`!sys.tracebacklimit`." +"The meaning of the *limit* parameter is different than the meaning " +"of :const:`sys.tracebacklimit`. A negative *limit* value corresponds to a " +"positive value of :const:`!sys.tracebacklimit`, whereas the behaviour of a " +"positive *limit* value cannot be achieved with :const:`!sys.tracebacklimit`." msgstr "" -#: ../../library/traceback.rst:70 ../../library/traceback.rst:135 +#: ../../library/traceback.rst:74 ../../library/traceback.rst:139 msgid "Added negative *limit* support." msgstr "新增負數 *limit* 的支援。" -#: ../../library/traceback.rst:77 +#: ../../library/traceback.rst:81 msgid "" "Print exception information and stack trace entries from :ref:`traceback " -"object ` *tb* to *file*. This differs from :func:" -"`print_tb` in the following ways:" +"object ` *tb* to *file*. This differs " +"from :func:`print_tb` in the following ways:" msgstr "" -#: ../../library/traceback.rst:82 +#: ../../library/traceback.rst:86 msgid "" "if *tb* is not ``None``, it prints a header ``Traceback (most recent call " "last):``" msgstr "" -#: ../../library/traceback.rst:85 +#: ../../library/traceback.rst:89 msgid "it prints the exception type and *value* after the stack trace" msgstr "" -#: ../../library/traceback.rst:89 +#: ../../library/traceback.rst:93 msgid "" "if *type(value)* is :exc:`SyntaxError` and *value* has the appropriate " "format, it prints the line where the syntax error occurred with a caret " "indicating the approximate position of the error." msgstr "" -#: ../../library/traceback.rst:93 +#: ../../library/traceback.rst:97 msgid "" "Since Python 3.10, instead of passing *value* and *tb*, an exception object " "can be passed as the first argument. If *value* and *tb* are provided, the " "first argument is ignored in order to provide backwards compatibility." msgstr "" -#: ../../library/traceback.rst:97 +#: ../../library/traceback.rst:101 msgid "" "The optional *limit* argument has the same meaning as for :func:`print_tb`. " -"If *chain* is true (the default), then chained exceptions (the :attr:" -"`~BaseException.__cause__` or :attr:`~BaseException.__context__` attributes " -"of the exception) will be printed as well, like the interpreter itself does " -"when printing an unhandled exception." +"If *chain* is true (the default), then chained exceptions " +"(the :attr:`~BaseException.__cause__` or :attr:`~BaseException.__context__` " +"attributes of the exception) will be printed as well, like the interpreter " +"itself does when printing an unhandled exception." msgstr "" -#: ../../library/traceback.rst:104 ../../library/traceback.rst:215 +#: ../../library/traceback.rst:108 ../../library/traceback.rst:219 msgid "The *etype* argument is ignored and inferred from the type of *value*." msgstr "" -#: ../../library/traceback.rst:107 ../../library/traceback.rst:195 +#: ../../library/traceback.rst:111 ../../library/traceback.rst:199 msgid "" "The *etype* parameter has been renamed to *exc* and is now positional-only." msgstr "" -#: ../../library/traceback.rst:114 +#: ../../library/traceback.rst:118 msgid "" "This is a shorthand for ``print_exception(sys.exception(), limit=limit, " "file=file, chain=chain)``." msgstr "" -#: ../../library/traceback.rst:120 +#: ../../library/traceback.rst:124 msgid "" "This is a shorthand for ``print_exception(sys.last_exc, limit=limit, " "file=file, chain=chain)``. In general it will work only after an exception " "has reached an interactive prompt (see :data:`sys.last_exc`)." msgstr "" -#: ../../library/traceback.rst:127 +#: ../../library/traceback.rst:131 msgid "" "Print up to *limit* stack trace entries (starting from the invocation point) " "if *limit* is positive. Otherwise, print the last ``abs(limit)`` entries. " @@ -182,45 +188,45 @@ msgid "" "for :func:`print_tb`." msgstr "" -#: ../../library/traceback.rst:141 +#: ../../library/traceback.rst:145 msgid "" "Return a :class:`StackSummary` object representing a list of \"pre-" "processed\" stack trace entries extracted from the :ref:`traceback object " "` *tb*. It is useful for alternate formatting of stack " -"traces. The optional *limit* argument has the same meaning as for :func:" -"`print_tb`. A \"pre-processed\" stack trace entry is a :class:" -"`FrameSummary` object containing attributes :attr:`~FrameSummary.filename`, :" -"attr:`~FrameSummary.lineno`, :attr:`~FrameSummary.name`, and :attr:" -"`~FrameSummary.line` representing the information that is usually printed " -"for a stack trace." +"traces. The optional *limit* argument has the same meaning as " +"for :func:`print_tb`. A \"pre-processed\" stack trace entry is " +"a :class:`FrameSummary` object containing " +"attributes :attr:`~FrameSummary.filename`, :attr:`~FrameSummary.lineno`, :attr:`~FrameSummary.name`, " +"and :attr:`~FrameSummary.line` representing the information that is usually " +"printed for a stack trace." msgstr "" -#: ../../library/traceback.rst:154 +#: ../../library/traceback.rst:158 msgid "" "Extract the raw traceback from the current :ref:`stack frame `. The return value has the same format as for :func:`extract_tb`. " -"The optional *f* and *limit* arguments have the same meaning as for :func:" -"`print_stack`." +"The optional *f* and *limit* arguments have the same meaning as " +"for :func:`print_stack`." msgstr "" -#: ../../library/traceback.rst:162 +#: ../../library/traceback.rst:166 msgid "" -"Print the list of tuples as returned by :func:`extract_tb` or :func:" -"`extract_stack` as a formatted stack trace to the given file. If *file* is " -"``None``, the output is written to :data:`sys.stderr`." +"Print the list of tuples as returned by :func:`extract_tb` " +"or :func:`extract_stack` as a formatted stack trace to the given file. If " +"*file* is ``None``, the output is written to :data:`sys.stderr`." msgstr "" -#: ../../library/traceback.rst:169 +#: ../../library/traceback.rst:173 msgid "" -"Given a list of tuples or :class:`FrameSummary` objects as returned by :func:" -"`extract_tb` or :func:`extract_stack`, return a list of strings ready for " -"printing. Each string in the resulting list corresponds to the item with " -"the same index in the argument list. Each string ends in a newline; the " -"strings may contain internal newlines as well, for those items whose source " -"text line is not ``None``." +"Given a list of tuples or :class:`FrameSummary` objects as returned " +"by :func:`extract_tb` or :func:`extract_stack`, return a list of strings " +"ready for printing. Each string in the resulting list corresponds to the " +"item with the same index in the argument list. Each string ends in a " +"newline; the strings may contain internal newlines as well, for those items " +"whose source text line is not ``None``." msgstr "" -#: ../../library/traceback.rst:179 +#: ../../library/traceback.rst:183 msgid "" "Format the exception part of a traceback using an exception value such as " "given by :data:`sys.last_value`. The return value is a list of strings, " @@ -231,31 +237,31 @@ msgid "" "contains the exception's :attr:`notes `." msgstr "" -#: ../../library/traceback.rst:187 +#: ../../library/traceback.rst:191 msgid "" "Since Python 3.10, instead of passing *value*, an exception object can be " "passed as the first argument. If *value* is provided, the first argument is " "ignored in order to provide backwards compatibility." msgstr "" -#: ../../library/traceback.rst:191 ../../library/traceback.rst:422 +#: ../../library/traceback.rst:195 ../../library/traceback.rst:431 msgid "" -"When *show_group* is ``True``, and the exception is an instance of :exc:" -"`BaseExceptionGroup`, the nested exceptions are included as well, " +"When *show_group* is ``True``, and the exception is an instance " +"of :exc:`BaseExceptionGroup`, the nested exceptions are included as well, " "recursively, with indentation relative to their nesting depth." msgstr "" -#: ../../library/traceback.rst:199 +#: ../../library/traceback.rst:203 msgid "" "The returned list now includes any :attr:`notes ` " "attached to the exception." msgstr "" -#: ../../library/traceback.rst:203 +#: ../../library/traceback.rst:207 msgid "*show_group* parameter was added." msgstr "" -#: ../../library/traceback.rst:209 +#: ../../library/traceback.rst:213 msgid "" "Format a stack trace and the exception information. The arguments have the " "same meaning as the corresponding arguments to :func:`print_exception`. The " @@ -264,69 +270,76 @@ msgid "" "printed, exactly the same text is printed as does :func:`print_exception`." msgstr "" -#: ../../library/traceback.rst:218 +#: ../../library/traceback.rst:222 msgid "" -"This function's behavior and signature were modified to match :func:" -"`print_exception`." +"This function's behavior and signature were modified to " +"match :func:`print_exception`." msgstr "" -#: ../../library/traceback.rst:225 +#: ../../library/traceback.rst:229 msgid "" "This is like ``print_exc(limit)`` but returns a string instead of printing " "to a file." msgstr "" -#: ../../library/traceback.rst:231 +#: ../../library/traceback.rst:235 msgid "A shorthand for ``format_list(extract_tb(tb, limit))``." msgstr "``format_list(extract_tb(tb, limit))`` 的簡寫。" -#: ../../library/traceback.rst:236 +#: ../../library/traceback.rst:240 msgid "A shorthand for ``format_list(extract_stack(f, limit))``." msgstr "``format_list(extract_stack(f, limit))`` 的簡寫。" -#: ../../library/traceback.rst:240 +#: ../../library/traceback.rst:244 msgid "" "Clears the local variables of all the stack frames in a :ref:`traceback " "` *tb* by calling the :meth:`~frame.clear` method of " "each :ref:`frame object `." msgstr "" -#: ../../library/traceback.rst:249 +#: ../../library/traceback.rst:253 msgid "" "Walk a stack following :attr:`f.f_back ` from the given frame, " "yielding the frame and line number for each frame. If *f* is ``None``, the " "current stack is used. This helper is used with :meth:`StackSummary.extract`." msgstr "" -#: ../../library/traceback.rst:258 +#: ../../library/traceback.rst:260 +msgid "" +"This function previously returned a generator that would walk the stack when " +"first iterated over. The generator returned now is the state of the stack " +"when ``walk_stack`` is called." +msgstr "" + +#: ../../library/traceback.rst:267 msgid "" "Walk a traceback following :attr:`~traceback.tb_next` yielding the frame and " -"line number for each frame. This helper is used with :meth:`StackSummary." -"extract`." +"line number for each frame. This helper is used " +"with :meth:`StackSummary.extract`." msgstr "" -#: ../../library/traceback.rst:266 +#: ../../library/traceback.rst:275 msgid ":class:`!TracebackException` Objects" msgstr ":class:`!TracebackException` 物件" -#: ../../library/traceback.rst:270 +#: ../../library/traceback.rst:279 msgid "" ":class:`!TracebackException` objects are created from actual exceptions to " "capture data for later printing. They offer a more lightweight method of " -"storing this information by avoiding holding references to :ref:" -"`traceback` and :ref:`frame` objects. In " -"addition, they expose more options to configure the output compared to the " -"module-level functions described above." +"storing this information by avoiding holding references " +"to :ref:`traceback` and :ref:`frame` " +"objects. In addition, they expose more options to configure the output " +"compared to the module-level functions described above." msgstr "" -#: ../../library/traceback.rst:279 +#: ../../library/traceback.rst:288 msgid "" "Capture an exception for later rendering. The meaning of *limit*, " "*lookup_lines* and *capture_locals* are as for the :class:`StackSummary` " "class." msgstr "" -#: ../../library/traceback.rst:283 +#: ../../library/traceback.rst:292 msgid "" "If *compact* is true, only data that is required by :class:`!" "TracebackException`'s :meth:`format` method is saved in the class " @@ -334,12 +347,12 @@ msgid "" "if :attr:`__cause__` is ``None`` and :attr:`__suppress_context__` is false." msgstr "" -#: ../../library/traceback.rst:289 ../../library/traceback.rst:390 +#: ../../library/traceback.rst:298 ../../library/traceback.rst:399 msgid "" "Note that when locals are captured, they are also shown in the traceback." msgstr "" -#: ../../library/traceback.rst:291 +#: ../../library/traceback.rst:300 msgid "" "*max_group_width* and *max_group_depth* control the formatting of exception " "groups (see :exc:`BaseExceptionGroup`). The depth refers to the nesting " @@ -348,128 +361,128 @@ msgid "" "limit is exceeded." msgstr "" -#: ../../library/traceback.rst:297 +#: ../../library/traceback.rst:306 msgid "Added the *compact* parameter." msgstr "新增 *compact* 參數。" -#: ../../library/traceback.rst:300 +#: ../../library/traceback.rst:309 msgid "Added the *max_group_width* and *max_group_depth* parameters." msgstr "新增 *max_group_width* 和 *max_group_depth* 參數。" -#: ../../library/traceback.rst:305 +#: ../../library/traceback.rst:314 msgid "" -"A :class:`!TracebackException` of the original :attr:`~BaseException." -"__cause__`." +"A :class:`!TracebackException` of the " +"original :attr:`~BaseException.__cause__`." msgstr "" -#: ../../library/traceback.rst:310 +#: ../../library/traceback.rst:319 msgid "" -"A :class:`!TracebackException` of the original :attr:`~BaseException." -"__context__`." +"A :class:`!TracebackException` of the " +"original :attr:`~BaseException.__context__`." msgstr "" -#: ../../library/traceback.rst:315 +#: ../../library/traceback.rst:324 msgid "" -"If ``self`` represents an :exc:`ExceptionGroup`, this field holds a list of :" -"class:`!TracebackException` instances representing the nested exceptions. " -"Otherwise it is ``None``." +"If ``self`` represents an :exc:`ExceptionGroup`, this field holds a list " +"of :class:`!TracebackException` instances representing the nested " +"exceptions. Otherwise it is ``None``." msgstr "" -#: ../../library/traceback.rst:323 +#: ../../library/traceback.rst:332 msgid "" "The :attr:`~BaseException.__suppress_context__` value from the original " "exception." msgstr "" -#: ../../library/traceback.rst:328 +#: ../../library/traceback.rst:337 msgid "" "The :attr:`~BaseException.__notes__` value from the original exception, or " "``None`` if the exception does not have any notes. If it is not ``None`` is " "it formatted in the traceback after the exception string." msgstr "" -#: ../../library/traceback.rst:337 +#: ../../library/traceback.rst:346 msgid "A :class:`StackSummary` representing the traceback." msgstr "" -#: ../../library/traceback.rst:341 +#: ../../library/traceback.rst:350 msgid "The class of the original traceback." msgstr "" -#: ../../library/traceback.rst:347 +#: ../../library/traceback.rst:356 msgid "String display of the class of the original exception." msgstr "" -#: ../../library/traceback.rst:353 +#: ../../library/traceback.rst:362 msgid "For syntax errors - the file name where the error occurred." msgstr "" -#: ../../library/traceback.rst:357 +#: ../../library/traceback.rst:366 msgid "For syntax errors - the line number where the error occurred." msgstr "" -#: ../../library/traceback.rst:361 +#: ../../library/traceback.rst:370 msgid "" "For syntax errors - the end line number where the error occurred. Can be " "``None`` if not present." msgstr "" -#: ../../library/traceback.rst:368 +#: ../../library/traceback.rst:377 msgid "For syntax errors - the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:372 +#: ../../library/traceback.rst:381 msgid "For syntax errors - the offset into the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:376 +#: ../../library/traceback.rst:385 msgid "" "For syntax errors - the end offset into the text where the error occurred. " "Can be ``None`` if not present." msgstr "" -#: ../../library/traceback.rst:383 +#: ../../library/traceback.rst:392 msgid "For syntax errors - the compiler error message." msgstr "" -#: ../../library/traceback.rst:387 +#: ../../library/traceback.rst:396 msgid "" "Capture an exception for later rendering. *limit*, *lookup_lines* and " "*capture_locals* are as for the :class:`StackSummary` class." msgstr "" -#: ../../library/traceback.rst:394 +#: ../../library/traceback.rst:403 msgid "" "Print to *file* (default ``sys.stderr``) the exception information returned " "by :meth:`format`." msgstr "" -#: ../../library/traceback.rst:401 +#: ../../library/traceback.rst:410 msgid "Format the exception." msgstr "" -#: ../../library/traceback.rst:403 +#: ../../library/traceback.rst:412 msgid "" "If *chain* is not ``True``, :attr:`__cause__` and :attr:`__context__` will " "not be formatted." msgstr "" -#: ../../library/traceback.rst:406 +#: ../../library/traceback.rst:415 msgid "" "The return value is a generator of strings, each ending in a newline and " "some containing internal newlines. :func:`~traceback.print_exception` is a " "wrapper around this method which just prints the lines to a file." msgstr "" -#: ../../library/traceback.rst:412 +#: ../../library/traceback.rst:421 msgid "Format the exception part of the traceback." msgstr "" -#: ../../library/traceback.rst:414 +#: ../../library/traceback.rst:423 msgid "The return value is a generator of strings, each ending in a newline." msgstr "" -#: ../../library/traceback.rst:416 +#: ../../library/traceback.rst:425 msgid "" "When *show_group* is ``False``, the generator emits the exception's message " "followed by its notes (if it has any). The exception message is normally a " @@ -478,55 +491,56 @@ msgid "" "the syntax error occurred." msgstr "" -#: ../../library/traceback.rst:426 +#: ../../library/traceback.rst:435 msgid "" "The exception's :attr:`notes ` are now included in " "the output." msgstr "" -#: ../../library/traceback.rst:430 +#: ../../library/traceback.rst:439 msgid "Added the *show_group* parameter." msgstr "新增 *show_group* 參數。" -#: ../../library/traceback.rst:435 +#: ../../library/traceback.rst:444 msgid ":class:`!StackSummary` Objects" msgstr ":class:`!StackSummary` 物件" -#: ../../library/traceback.rst:439 +#: ../../library/traceback.rst:448 msgid "" ":class:`!StackSummary` objects represent a call stack ready for formatting." msgstr "" -#: ../../library/traceback.rst:445 +#: ../../library/traceback.rst:454 msgid "" "Construct a :class:`!StackSummary` object from a frame generator (such as is " "returned by :func:`~traceback.walk_stack` or :func:`~traceback.walk_tb`)." msgstr "" -#: ../../library/traceback.rst:449 +#: ../../library/traceback.rst:458 msgid "" "If *limit* is supplied, only this many frames are taken from *frame_gen*. If " "*lookup_lines* is ``False``, the returned :class:`FrameSummary` objects will " "not have read their lines in yet, making the cost of creating the :class:`!" "StackSummary` cheaper (which may be valuable if it may not actually get " -"formatted). If *capture_locals* is ``True`` the local variables in each :" -"class:`!FrameSummary` are captured as object representations." +"formatted). If *capture_locals* is ``True`` the local variables in " +"each :class:`!FrameSummary` are captured as object representations." msgstr "" -#: ../../library/traceback.rst:457 +#: ../../library/traceback.rst:466 msgid "" "Exceptions raised from :func:`repr` on a local variable (when " "*capture_locals* is ``True``) are no longer propagated to the caller." msgstr "" -#: ../../library/traceback.rst:463 +#: ../../library/traceback.rst:472 msgid "" -"Construct a :class:`!StackSummary` object from a supplied list of :class:" -"`FrameSummary` objects or old-style list of tuples. Each tuple should be a " -"4-tuple with *filename*, *lineno*, *name*, *line* as the elements." +"Construct a :class:`!StackSummary` object from a supplied list " +"of :class:`FrameSummary` objects or old-style list of tuples. Each tuple " +"should be a 4-tuple with *filename*, *lineno*, *name*, *line* as the " +"elements." msgstr "" -#: ../../library/traceback.rst:470 +#: ../../library/traceback.rst:479 msgid "" "Returns a list of strings ready for printing. Each string in the resulting " "list corresponds to a single :ref:`frame ` from the stack. " @@ -534,18 +548,18 @@ msgid "" "well, for those items with source text lines." msgstr "" -#: ../../library/traceback.rst:476 +#: ../../library/traceback.rst:485 msgid "" "For long sequences of the same frame and line, the first few repetitions are " "shown, followed by a summary line stating the exact number of further " "repetitions." msgstr "" -#: ../../library/traceback.rst:480 +#: ../../library/traceback.rst:489 msgid "Long sequences of repeated frames are now abbreviated." msgstr "" -#: ../../library/traceback.rst:485 +#: ../../library/traceback.rst:494 msgid "" "Returns a string for printing one of the :ref:`frames ` " "involved in the stack. This method is called for each :class:`FrameSummary` " @@ -553,92 +567,92 @@ msgid "" "the frame is omitted from the output." msgstr "" -#: ../../library/traceback.rst:495 +#: ../../library/traceback.rst:504 msgid ":class:`!FrameSummary` Objects" msgstr ":class:`!FrameSummary` 物件" -#: ../../library/traceback.rst:499 +#: ../../library/traceback.rst:508 msgid "" "A :class:`!FrameSummary` object represents a single :ref:`frame ` in a :ref:`traceback `." msgstr "" -#: ../../library/traceback.rst:506 +#: ../../library/traceback.rst:515 msgid "" "Represents a single :ref:`frame ` in the :ref:`traceback " "` or stack that is being formatted or printed. It may " "optionally have a stringified version of the frame's locals included in it. " -"If *lookup_line* is ``False``, the source code is not looked up until the :" -"class:`!FrameSummary` has the :attr:`~FrameSummary.line` attribute accessed " -"(which also happens when casting it to a :class:`tuple`). :attr:" -"`~FrameSummary.line` may be directly provided, and will prevent line lookups " -"happening at all. *locals* is an optional local variable mapping, and if " -"supplied the variable representations are stored in the summary for later " -"display." +"If *lookup_line* is ``False``, the source code is not looked up until " +"the :class:`!FrameSummary` has the :attr:`~FrameSummary.line` attribute " +"accessed (which also happens when casting it to " +"a :class:`tuple`). :attr:`~FrameSummary.line` may be directly provided, and " +"will prevent line lookups happening at all. *locals* is an optional local " +"variable mapping, and if supplied the variable representations are stored in " +"the summary for later display." msgstr "" -#: ../../library/traceback.rst:517 +#: ../../library/traceback.rst:526 msgid ":class:`!FrameSummary` instances have the following attributes:" msgstr "" -#: ../../library/traceback.rst:521 +#: ../../library/traceback.rst:530 msgid "" -"The filename of the source code for this frame. Equivalent to accessing :" -"attr:`f.f_code.co_filename ` on a :ref:`frame object " -"` *f*." +"The filename of the source code for this frame. Equivalent to " +"accessing :attr:`f.f_code.co_filename ` on " +"a :ref:`frame object ` *f*." msgstr "" -#: ../../library/traceback.rst:527 +#: ../../library/traceback.rst:536 msgid "The line number of the source code for this frame." msgstr "" -#: ../../library/traceback.rst:531 +#: ../../library/traceback.rst:540 msgid "" -"Equivalent to accessing :attr:`f.f_code.co_name ` on a :" -"ref:`frame object ` *f*." +"Equivalent to accessing :attr:`f.f_code.co_name ` on " +"a :ref:`frame object ` *f*." msgstr "" -#: ../../library/traceback.rst:536 +#: ../../library/traceback.rst:545 msgid "" "A string representing the source code for this frame, with leading and " "trailing whitespace stripped. If the source is not available, it is ``None``." msgstr "" -#: ../../library/traceback.rst:542 +#: ../../library/traceback.rst:551 msgid "" "The last line number of the source code for this frame. By default, it is " "set to ``lineno`` and indexation starts from 1." msgstr "" -#: ../../library/traceback.rst:545 +#: ../../library/traceback.rst:554 msgid "The default value changed from ``None`` to ``lineno``." msgstr "" -#: ../../library/traceback.rst:550 +#: ../../library/traceback.rst:559 msgid "" "The column number of the source code for this frame. By default, it is " "``None`` and indexation starts from 0." msgstr "" -#: ../../library/traceback.rst:555 +#: ../../library/traceback.rst:564 msgid "" "The last column number of the source code for this frame. By default, it is " "``None`` and indexation starts from 0." msgstr "" -#: ../../library/traceback.rst:562 +#: ../../library/traceback.rst:571 msgid "Examples of Using the Module-Level Functions" msgstr "" -#: ../../library/traceback.rst:564 +#: ../../library/traceback.rst:573 msgid "" "This simple example implements a basic read-eval-print loop, similar to (but " "less useful than) the standard Python interactive interpreter loop. For a " -"more complete implementation of the interpreter loop, refer to the :mod:" -"`code` module. ::" +"more complete implementation of the interpreter loop, refer to " +"the :mod:`code` module. ::" msgstr "" -#: ../../library/traceback.rst:569 +#: ../../library/traceback.rst:578 msgid "" "import sys, traceback\n" "\n" @@ -657,13 +671,13 @@ msgid "" " run_user_code(envdir)" msgstr "" -#: ../../library/traceback.rst:586 +#: ../../library/traceback.rst:595 msgid "" "The following example demonstrates the different ways to print and format " "the exception and traceback:" msgstr "" -#: ../../library/traceback.rst:589 +#: ../../library/traceback.rst:598 msgid "" "import sys, traceback\n" "\n" @@ -695,11 +709,11 @@ msgid "" " print(\"*** tb_lineno:\", exc.__traceback__.tb_lineno)" msgstr "" -#: ../../library/traceback.rst:620 +#: ../../library/traceback.rst:629 msgid "The output for the example would look similar to this:" msgstr "" -#: ../../library/traceback.rst:622 +#: ../../library/traceback.rst:631 msgid "" "*** print_tb:\n" " File \"\", line 10, in \n" @@ -728,8 +742,8 @@ msgid "" "IndexError: tuple index out of range\n" "*** format_exception:\n" "['Traceback (most recent call last):\\n',\n" -" ' File \"\", line 10, in \\n " -"lumberjack()\\n ~~~~~~~~~~^^\\n',\n" +" ' File \"\", line 10, in \\n lumberjack()" +"\\n ~~~~~~~~~~^^\\n',\n" " ' File \"\", line 4, in lumberjack\\n " "bright_side_of_life()\\n ~~~~~~~~~~~~~~~~~~~^^\\n',\n" " ' File \"\", line 7, in bright_side_of_life\\n " @@ -740,8 +754,8 @@ msgid "" " , line 4 in lumberjack>,\n" " , line 7 in bright_side_of_life>]\n" "*** format_tb:\n" -"[' File \"\", line 10, in \\n " -"lumberjack()\\n ~~~~~~~~~~^^\\n',\n" +"[' File \"\", line 10, in \\n lumberjack()" +"\\n ~~~~~~~~~~^^\\n',\n" " ' File \"\", line 4, in lumberjack\\n " "bright_side_of_life()\\n ~~~~~~~~~~~~~~~~~~~^^\\n',\n" " ' File \"\", line 7, in bright_side_of_life\\n " @@ -749,13 +763,13 @@ msgid "" "*** tb_lineno: 10" msgstr "" -#: ../../library/traceback.rst:667 +#: ../../library/traceback.rst:676 msgid "" "The following example shows the different ways to print and format the " "stack::" msgstr "" -#: ../../library/traceback.rst:669 +#: ../../library/traceback.rst:678 msgid "" ">>> import traceback\n" ">>> def another_function():\n" @@ -777,10 +791,10 @@ msgid "" " ('', 3, 'another_function', 'lumberstack()'),\n" " ('', 7, 'lumberstack', 'print(repr(traceback.extract_stack()))')]\n" "[' File \"\", line 10, in \\n another_function()\\n',\n" -" ' File \"\", line 3, in another_function\\n " -"lumberstack()\\n',\n" -" ' File \"\", line 8, in lumberstack\\n print(repr(traceback." -"format_stack()))\\n']" +" ' File \"\", line 3, in another_function\\n lumberstack()" +"\\n',\n" +" ' File \"\", line 8, in lumberstack\\n " +"print(repr(traceback.format_stack()))\\n']" msgstr "" ">>> import traceback\n" ">>> def another_function():\n" @@ -802,16 +816,16 @@ msgstr "" " ('', 3, 'another_function', 'lumberstack()'),\n" " ('', 7, 'lumberstack', 'print(repr(traceback.extract_stack()))')]\n" "[' File \"\", line 10, in \\n another_function()\\n',\n" -" ' File \"\", line 3, in another_function\\n " -"lumberstack()\\n',\n" -" ' File \"\", line 8, in lumberstack\\n print(repr(traceback." -"format_stack()))\\n']" +" ' File \"\", line 3, in another_function\\n lumberstack()" +"\\n',\n" +" ' File \"\", line 8, in lumberstack\\n " +"print(repr(traceback.format_stack()))\\n']" -#: ../../library/traceback.rst:693 +#: ../../library/traceback.rst:702 msgid "This last example demonstrates the final few formatting functions:" msgstr "" -#: ../../library/traceback.rst:695 +#: ../../library/traceback.rst:704 msgid "" ">>> import traceback\n" ">>> traceback.format_list([('spam.py', 3, '', 'spam.eggs()'),\n" @@ -823,15 +837,15 @@ msgid "" "['IndexError: tuple index out of range\\n']" msgstr "" -#: ../../library/traceback.rst:709 +#: ../../library/traceback.rst:718 msgid "Examples of Using :class:`TracebackException`" msgstr ":class:`TracebackException` 的使用範例" -#: ../../library/traceback.rst:711 +#: ../../library/traceback.rst:720 msgid "With the helper class, we have more options::" msgstr "" -#: ../../library/traceback.rst:713 +#: ../../library/traceback.rst:722 msgid "" ">>> import sys\n" ">>> from traceback import TracebackException\n" @@ -868,8 +882,8 @@ msgid "" "IndexError: tuple index out of range\n" "\n" ">>> # capture_locals adds local variables in frames\n" -">>> TracebackException.from_exception(exc, limit=-2, capture_locals=True)." -"print()\n" +">>> TracebackException.from_exception(exc, limit=-2, " +"capture_locals=True).print()\n" "Traceback (most recent call last):\n" " File \"\", line 6, in lumberjack\n" " bright_side_of_life()\n" @@ -919,10 +933,10 @@ msgstr "object(物件)" msgid "traceback" msgstr "traceback" -#: ../../library/traceback.rst:87 +#: ../../library/traceback.rst:91 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/traceback.rst:87 +#: ../../library/traceback.rst:91 msgid "marker" msgstr "marker(標記)" diff --git a/library/turtle.po b/library/turtle.po index 037a2eacaa5..2dbd9aad98f 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-03 00:14+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,11 +26,11 @@ msgstr ":mod:`!turtle` --- 龜圖學 (Turtle graphics)" msgid "**Source code:** :source:`Lib/turtle.py`" msgstr "**原始碼:**\\ :source:`Lib/turtle.py`" -#: ../../library/turtle.rst:20 +#: ../../library/turtle.rst:25 msgid "Introduction" msgstr "介紹" -#: ../../library/turtle.rst:22 +#: ../../library/turtle.rst:27 msgid "" "Turtle graphics is an implementation of `the popular geometric drawing tools " "introduced in Logo `_, " @@ -40,11 +40,11 @@ msgstr "" "的,一個 `以 Logo 程式語言撰寫的廣受歡迎的幾何繪圖工具 `_。" -#: ../../library/turtle.rst:29 +#: ../../library/turtle.rst:34 msgid "Get started" msgstr "" -#: ../../library/turtle.rst:31 +#: ../../library/turtle.rst:36 msgid "" "Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an " "``import turtle``, give it the command ``turtle.forward(15)``, and it moves " @@ -53,26 +53,26 @@ msgid "" "degrees clockwise." msgstr "" -#: ../../library/turtle.rst:38 +#: ../../library/turtle.rst:43 msgid "" "Turtle can draw intricate shapes using programs that repeat simple moves." msgstr "龜可以使用重複簡單動作之程式來畫出複雜的形狀。" -#: ../../library/turtle.rst:44 +#: ../../library/turtle.rst:49 msgid "" "In Python, turtle graphics provides a representation of a physical " "\"turtle\" (a little robot with a pen) that draws on a sheet of paper on the " "floor." msgstr "" -#: ../../library/turtle.rst:47 +#: ../../library/turtle.rst:52 msgid "" "It's an effective and well-proven way for learners to encounter programming " "concepts and interaction with software, as it provides instant, visible " "feedback. It also provides convenient access to graphical output in general." msgstr "" -#: ../../library/turtle.rst:52 +#: ../../library/turtle.rst:57 msgid "" "Turtle drawing was originally created as an educational tool, to be used by " "teachers in the classroom. For the programmer who needs to produce some " @@ -80,62 +80,62 @@ msgid "" "introducing more complex or external libraries into their work." msgstr "" -#: ../../library/turtle.rst:61 +#: ../../library/turtle.rst:66 msgid "Tutorial" msgstr "教學" -#: ../../library/turtle.rst:63 +#: ../../library/turtle.rst:68 msgid "" "New users should start here. In this tutorial we'll explore some of the " "basics of turtle drawing." msgstr "" -#: ../../library/turtle.rst:68 +#: ../../library/turtle.rst:73 msgid "Starting a turtle environment" msgstr "啟動一個烏龜環境" -#: ../../library/turtle.rst:70 +#: ../../library/turtle.rst:75 msgid "In a Python shell, import all the objects of the ``turtle`` module::" msgstr "在 Python shell 中,引入 ``turtle`` 模組中所有物件: ::" -#: ../../library/turtle.rst:72 +#: ../../library/turtle.rst:77 msgid "from turtle import *" msgstr "from turtle import *" -#: ../../library/turtle.rst:74 +#: ../../library/turtle.rst:79 msgid "" "If you run into a ``No module named '_tkinter'`` error, you'll have to " "install the :mod:`Tk interface package ` on your system." msgstr "" -#: ../../library/turtle.rst:79 +#: ../../library/turtle.rst:84 msgid "Basic drawing" msgstr "基本繪圖" -#: ../../library/turtle.rst:81 +#: ../../library/turtle.rst:86 msgid "Send the turtle forward 100 steps::" msgstr "" -#: ../../library/turtle.rst:83 +#: ../../library/turtle.rst:88 msgid "forward(100)" msgstr "forward(100)" -#: ../../library/turtle.rst:85 +#: ../../library/turtle.rst:90 msgid "" "You should see (most likely, in a new window on your display) a line drawn " "by the turtle, heading East. Change the direction of the turtle, so that it " "turns 120 degrees left (anti-clockwise)::" msgstr "" -#: ../../library/turtle.rst:89 +#: ../../library/turtle.rst:94 msgid "left(120)" msgstr "left(120)" -#: ../../library/turtle.rst:91 +#: ../../library/turtle.rst:96 msgid "Let's continue by drawing a triangle::" msgstr "" -#: ../../library/turtle.rst:93 +#: ../../library/turtle.rst:98 msgid "" "forward(100)\n" "left(120)\n" @@ -145,81 +145,81 @@ msgstr "" "left(120)\n" "forward(100)" -#: ../../library/turtle.rst:97 +#: ../../library/turtle.rst:102 msgid "" "Notice how the turtle, represented by an arrow, points in different " "directions as you steer it." msgstr "" -#: ../../library/turtle.rst:100 +#: ../../library/turtle.rst:105 msgid "" "Experiment with those commands, and also with ``backward()`` and ``right()``." msgstr "" -#: ../../library/turtle.rst:105 ../../library/turtle.rst:334 -#: ../../library/turtle.rst:1024 +#: ../../library/turtle.rst:110 ../../library/turtle.rst:364 +#: ../../library/turtle.rst:1058 msgid "Pen control" msgstr "" -#: ../../library/turtle.rst:107 +#: ../../library/turtle.rst:112 msgid "" "Try changing the color - for example, ``color('blue')`` - and width of the " "line - for example, ``width(3)`` - and then drawing again." msgstr "" -#: ../../library/turtle.rst:110 +#: ../../library/turtle.rst:115 msgid "" "You can also move the turtle around without drawing, by lifting up the pen: " "``up()`` before moving. To start drawing again, use ``down()``." msgstr "" -#: ../../library/turtle.rst:115 +#: ../../library/turtle.rst:120 msgid "The turtle's position" msgstr "" -#: ../../library/turtle.rst:117 +#: ../../library/turtle.rst:122 msgid "" "Send your turtle back to its starting-point (useful if it has disappeared " "off-screen)::" msgstr "" -#: ../../library/turtle.rst:120 +#: ../../library/turtle.rst:125 msgid "home()" msgstr "home()" -#: ../../library/turtle.rst:122 +#: ../../library/turtle.rst:127 msgid "" "The home position is at the center of the turtle's screen. If you ever need " "to know them, get the turtle's x-y coordinates with::" msgstr "" -#: ../../library/turtle.rst:125 +#: ../../library/turtle.rst:130 msgid "pos()" msgstr "pos()" -#: ../../library/turtle.rst:127 +#: ../../library/turtle.rst:132 msgid "Home is at ``(0, 0)``." msgstr "" -#: ../../library/turtle.rst:129 +#: ../../library/turtle.rst:134 msgid "" "And after a while, it will probably help to clear the window so we can start " "anew::" msgstr "" -#: ../../library/turtle.rst:132 +#: ../../library/turtle.rst:137 msgid "clearscreen()" msgstr "clearscreen()" -#: ../../library/turtle.rst:136 +#: ../../library/turtle.rst:141 msgid "Making algorithmic patterns" msgstr "" -#: ../../library/turtle.rst:138 +#: ../../library/turtle.rst:143 msgid "Using loops, it's possible to build up geometric patterns::" msgstr "" -#: ../../library/turtle.rst:140 +#: ../../library/turtle.rst:145 msgid "" "for steps in range(100):\n" " for c in ('blue', 'red', 'green'):\n" @@ -233,17 +233,17 @@ msgstr "" " forward(steps)\n" " right(30)" -#: ../../library/turtle.rst:147 +#: ../../library/turtle.rst:152 msgid "\\ - which of course, are limited only by the imagination!" msgstr "" -#: ../../library/turtle.rst:149 +#: ../../library/turtle.rst:154 msgid "" "Let's draw the star shape at the top of this page. We want red lines, filled " "in with yellow::" msgstr "" -#: ../../library/turtle.rst:152 +#: ../../library/turtle.rst:157 msgid "" "color('red')\n" "fillcolor('yellow')" @@ -251,21 +251,21 @@ msgstr "" "color('red')\n" "fillcolor('yellow')" -#: ../../library/turtle.rst:155 +#: ../../library/turtle.rst:160 msgid "" "Just as ``up()`` and ``down()`` determine whether lines will be drawn, " "filling can be turned on and off::" msgstr "" -#: ../../library/turtle.rst:158 +#: ../../library/turtle.rst:163 msgid "begin_fill()" msgstr "begin_fill()" -#: ../../library/turtle.rst:160 +#: ../../library/turtle.rst:165 msgid "Next we'll create a loop::" msgstr "" -#: ../../library/turtle.rst:162 +#: ../../library/turtle.rst:167 msgid "" "while True:\n" " forward(200)\n" @@ -279,39 +279,39 @@ msgstr "" " if abs(pos()) < 1:\n" " break" -#: ../../library/turtle.rst:168 +#: ../../library/turtle.rst:173 msgid "" "``abs(pos()) < 1`` is a good way to know when the turtle is back at its home " "position." msgstr "" -#: ../../library/turtle.rst:171 +#: ../../library/turtle.rst:176 msgid "Finally, complete the filling::" msgstr "" -#: ../../library/turtle.rst:173 +#: ../../library/turtle.rst:178 msgid "end_fill()" msgstr "end_fill()" -#: ../../library/turtle.rst:175 +#: ../../library/turtle.rst:180 msgid "" "(Note that filling only actually takes place when you give the " "``end_fill()`` command.)" msgstr "" -#: ../../library/turtle.rst:182 +#: ../../library/turtle.rst:187 msgid "How to..." msgstr "" -#: ../../library/turtle.rst:184 +#: ../../library/turtle.rst:189 msgid "This section covers some typical turtle use-cases and approaches." msgstr "" -#: ../../library/turtle.rst:188 +#: ../../library/turtle.rst:193 msgid "Get started as quickly as possible" msgstr "" -#: ../../library/turtle.rst:190 +#: ../../library/turtle.rst:195 msgid "" "One of the joys of turtle graphics is the immediate, visual feedback that's " "available from simple commands - it's an excellent way to introduce children " @@ -319,21 +319,21 @@ msgid "" "course)." msgstr "" -#: ../../library/turtle.rst:195 +#: ../../library/turtle.rst:200 msgid "" "The turtle module makes this possible by exposing all its basic " "functionality as functions, available with ``from turtle import *``. " "The :ref:`turtle graphics tutorial ` covers this approach." msgstr "" -#: ../../library/turtle.rst:199 +#: ../../library/turtle.rst:204 msgid "" "It's worth noting that many of the turtle commands also have even more terse " "equivalents, such as ``fd()`` for :func:`forward`. These are especially " "useful when working with learners for whom typing is not a skill." msgstr "" -#: ../../library/turtle.rst:205 +#: ../../library/turtle.rst:210 msgid "" "You'll need to have the :mod:`Tk interface package ` installed on " "your system for turtle graphics to work. Be warned that this is not always " @@ -341,11 +341,47 @@ msgid "" "graphics with a learner." msgstr "" -#: ../../library/turtle.rst:212 +#: ../../library/turtle.rst:217 +msgid "Automatically begin and end filling" +msgstr "" + +#: ../../library/turtle.rst:219 +msgid "" +"Starting with Python 3.14, you can use the :func:`fill` :term:`context " +"manager` instead of :func:`begin_fill` and :func:`end_fill` to automatically " +"begin and end fill. Here is an example::" +msgstr "" + +#: ../../library/turtle.rst:223 +msgid "" +"with fill():\n" +" for i in range(4):\n" +" forward(100)\n" +" right(90)\n" +"\n" +"forward(200)" +msgstr "" + +#: ../../library/turtle.rst:230 +msgid "The code above is equivalent to::" +msgstr "" + +#: ../../library/turtle.rst:232 +msgid "" +"begin_fill()\n" +"for i in range(4):\n" +" forward(100)\n" +" right(90)\n" +"end_fill()\n" +"\n" +"forward(200)" +msgstr "" + +#: ../../library/turtle.rst:242 msgid "Use the ``turtle`` module namespace" msgstr "" -#: ../../library/turtle.rst:214 +#: ../../library/turtle.rst:244 msgid "" "Using ``from turtle import *`` is convenient - but be warned that it imports " "a rather large collection of objects, and if you're doing anything but " @@ -354,7 +390,7 @@ msgid "" "might be imported)." msgstr "" -#: ../../library/turtle.rst:220 +#: ../../library/turtle.rst:250 msgid "" "The solution is to use ``import turtle`` - ``fd()`` becomes ``turtle.fd()``, " "``width()`` becomes ``turtle.width()`` and so on. (If typing \"turtle\" over " @@ -362,17 +398,17 @@ msgid "" "instead.)" msgstr "" -#: ../../library/turtle.rst:227 +#: ../../library/turtle.rst:257 msgid "Use turtle graphics in a script" msgstr "" -#: ../../library/turtle.rst:229 +#: ../../library/turtle.rst:259 msgid "" "It's recommended to use the ``turtle`` module namespace as described " "immediately above, for example::" msgstr "" -#: ../../library/turtle.rst:232 +#: ../../library/turtle.rst:262 msgid "" "import turtle as t\n" "from random import random\n" @@ -392,33 +428,33 @@ msgstr "" " t.right(angle)\n" " t.fd(steps)" -#: ../../library/turtle.rst:241 +#: ../../library/turtle.rst:271 msgid "" "Another step is also required though - as soon as the script ends, Python " "will also close the turtle's window. Add::" msgstr "" -#: ../../library/turtle.rst:244 +#: ../../library/turtle.rst:274 msgid "t.mainloop()" msgstr "t.mainloop()" -#: ../../library/turtle.rst:246 +#: ../../library/turtle.rst:276 msgid "" "to the end of the script. The script will now wait to be dismissed and will " "not exit until it is terminated, for example by closing the turtle graphics " "window." msgstr "" -#: ../../library/turtle.rst:252 +#: ../../library/turtle.rst:282 msgid "Use object-oriented turtle graphics" msgstr "" -#: ../../library/turtle.rst:254 +#: ../../library/turtle.rst:284 msgid "" ":ref:`Explanation of the object-oriented interface `" msgstr "" -#: ../../library/turtle.rst:256 +#: ../../library/turtle.rst:286 msgid "" "Other than for very basic introductory purposes, or for trying things out as " "quickly as possible, it's more usual and much more powerful to use the " @@ -426,18 +462,18 @@ msgid "" "multiple turtles on screen at once." msgstr "" -#: ../../library/turtle.rst:261 +#: ../../library/turtle.rst:291 msgid "" "In this approach, the various turtle commands are methods of objects (mostly " "of ``Turtle`` objects). You *can* use the object-oriented approach in the " "shell, but it would be more typical in a Python script." msgstr "" -#: ../../library/turtle.rst:265 +#: ../../library/turtle.rst:295 msgid "The example above then becomes::" msgstr "" -#: ../../library/turtle.rst:267 +#: ../../library/turtle.rst:297 msgid "" "from turtle import Turtle\n" "from random import random\n" @@ -463,43 +499,43 @@ msgstr "" "\n" "t.screen.mainloop()" -#: ../../library/turtle.rst:279 +#: ../../library/turtle.rst:309 msgid "" "Note the last line. ``t.screen`` is an instance of the :class:`Screen` that " "a Turtle instance exists on; it's created automatically along with the " "turtle." msgstr "" -#: ../../library/turtle.rst:283 +#: ../../library/turtle.rst:313 msgid "The turtle's screen can be customised, for example::" msgstr "" -#: ../../library/turtle.rst:285 +#: ../../library/turtle.rst:315 msgid "" "t.screen.title('Object-oriented turtle demo')\n" "t.screen.bgcolor(\"orange\")" msgstr "" -#: ../../library/turtle.rst:290 +#: ../../library/turtle.rst:320 msgid "Turtle graphics reference" msgstr "" -#: ../../library/turtle.rst:294 +#: ../../library/turtle.rst:324 msgid "" "In the following documentation the argument list for functions is given. " "Methods, of course, have the additional first argument *self* which is " "omitted here." msgstr "" -#: ../../library/turtle.rst:300 +#: ../../library/turtle.rst:330 msgid "Turtle methods" msgstr "" -#: ../../library/turtle.rst:302 ../../library/turtle.rst:441 +#: ../../library/turtle.rst:332 ../../library/turtle.rst:475 msgid "Turtle motion" msgstr "" -#: ../../library/turtle.rst:303 +#: ../../library/turtle.rst:333 msgid "Move and draw" msgstr "" @@ -543,7 +579,7 @@ msgstr ":func:`setheading` | :func:`seth`" msgid ":func:`home`" msgstr ":func:`home`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2709 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2832 msgid ":func:`circle`" msgstr ":func:`circle`" @@ -551,7 +587,7 @@ msgstr ":func:`circle`" msgid ":func:`dot`" msgstr ":func:`dot`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2687 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2810 msgid ":func:`stamp`" msgstr ":func:`stamp`" @@ -571,7 +607,7 @@ msgstr ":func:`undo`" msgid ":func:`speed`" msgstr ":func:`speed`" -#: ../../library/turtle.rst:322 ../../library/turtle.rst:873 +#: ../../library/turtle.rst:352 ../../library/turtle.rst:907 msgid "Tell Turtle's state" msgstr "" @@ -599,7 +635,7 @@ msgstr ":func:`heading`" msgid ":func:`distance`" msgstr ":func:`distance`" -#: ../../library/turtle.rst:330 +#: ../../library/turtle.rst:360 msgid "Setting and measurement" msgstr "" @@ -611,7 +647,7 @@ msgstr ":func:`degrees`" msgid ":func:`radians`" msgstr ":func:`radians`" -#: ../../library/turtle.rst:335 ../../library/turtle.rst:1027 +#: ../../library/turtle.rst:365 ../../library/turtle.rst:1061 msgid "Drawing state" msgstr "" @@ -635,7 +671,7 @@ msgstr ":func:`pen`" msgid ":func:`isdown`" msgstr ":func:`isdown`" -#: ../../library/turtle.rst:342 ../../library/turtle.rst:1119 +#: ../../library/turtle.rst:372 ../../library/turtle.rst:1153 msgid "Color control" msgstr "" @@ -651,7 +687,7 @@ msgstr ":func:`pencolor`" msgid ":func:`fillcolor`" msgstr ":func:`fillcolor`" -#: ../../library/turtle.rst:347 ../../library/turtle.rst:1251 +#: ../../library/turtle.rst:377 ../../library/turtle.rst:1285 msgid "Filling" msgstr "" @@ -659,6 +695,11 @@ msgstr "" msgid ":func:`filling`" msgstr ":func:`filling`" +#: ../../library/turtle.rst:0 +#, fuzzy +msgid ":func:`fill`" +msgstr ":func:`filling`" + #: ../../library/turtle.rst:0 msgid ":func:`begin_fill`" msgstr ":func:`begin_fill`" @@ -667,7 +708,7 @@ msgstr ":func:`begin_fill`" msgid ":func:`end_fill`" msgstr ":func:`end_fill`" -#: ../../library/turtle.rst:352 ../../library/turtle.rst:1298 +#: ../../library/turtle.rst:383 ../../library/turtle.rst:1355 msgid "More drawing control" msgstr "" @@ -683,11 +724,11 @@ msgstr ":func:`clear`" msgid ":func:`write`" msgstr ":func:`write`" -#: ../../library/turtle.rst:357 ../../library/turtle.rst:1344 +#: ../../library/turtle.rst:388 ../../library/turtle.rst:1401 msgid "Turtle state" msgstr "" -#: ../../library/turtle.rst:358 ../../library/turtle.rst:1347 +#: ../../library/turtle.rst:389 ../../library/turtle.rst:1404 msgid "Visibility" msgstr "" @@ -703,7 +744,7 @@ msgstr ":func:`hideturtle` | :func:`ht`" msgid ":func:`isvisible`" msgstr ":func:`isvisible`" -#: ../../library/turtle.rst:363 ../../library/turtle.rst:1386 +#: ../../library/turtle.rst:394 ../../library/turtle.rst:1443 msgid "Appearance" msgstr "" @@ -739,11 +780,11 @@ msgstr ":func:`shapetransform`" msgid ":func:`get_shapepoly`" msgstr ":func:`get_shapepoly`" -#: ../../library/turtle.rst:373 ../../library/turtle.rst:1569 +#: ../../library/turtle.rst:404 ../../library/turtle.rst:1626 msgid "Using events" msgstr "" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2681 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2804 msgid ":func:`onclick`" msgstr ":func:`onclick`" @@ -751,14 +792,19 @@ msgstr ":func:`onclick`" msgid ":func:`onrelease`" msgstr ":func:`onrelease`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2664 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2787 msgid ":func:`ondrag`" msgstr ":func:`ondrag`" -#: ../../library/turtle.rst:378 ../../library/turtle.rst:1643 +#: ../../library/turtle.rst:409 ../../library/turtle.rst:1700 msgid "Special Turtle methods" msgstr "" +#: ../../library/turtle.rst:0 +#, fuzzy +msgid ":func:`poly`" +msgstr ":func:`end_poly`" + #: ../../library/turtle.rst:0 msgid ":func:`begin_poly`" msgstr ":func:`begin_poly`" @@ -771,7 +817,7 @@ msgstr ":func:`end_poly`" msgid ":func:`get_poly`" msgstr ":func:`get_poly`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2703 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2826 msgid ":func:`clone`" msgstr ":func:`clone`" @@ -791,11 +837,11 @@ msgstr ":func:`setundobuffer`" msgid ":func:`undobufferentries`" msgstr ":func:`undobufferentries`" -#: ../../library/turtle.rst:390 +#: ../../library/turtle.rst:422 msgid "Methods of TurtleScreen/Screen" msgstr "" -#: ../../library/turtle.rst:392 ../../library/turtle.rst:1797 +#: ../../library/turtle.rst:424 ../../library/turtle.rst:1871 msgid "Window control" msgstr "" @@ -823,10 +869,15 @@ msgstr ":func:`screensize`" msgid ":func:`setworldcoordinates`" msgstr ":func:`setworldcoordinates`" -#: ../../library/turtle.rst:400 ../../library/turtle.rst:1920 +#: ../../library/turtle.rst:432 ../../library/turtle.rst:1995 msgid "Animation control" msgstr "" +#: ../../library/turtle.rst:0 +#, fuzzy +msgid ":func:`no_animation`" +msgstr ":func:`radians`" + #: ../../library/turtle.rst:0 msgid ":func:`delay`" msgstr ":func:`delay`" @@ -839,7 +890,7 @@ msgstr ":func:`tracer`" msgid ":func:`update`" msgstr ":func:`update`" -#: ../../library/turtle.rst:405 ../../library/turtle.rst:1973 +#: ../../library/turtle.rst:438 ../../library/turtle.rst:2065 msgid "Using screen events" msgstr "" @@ -867,7 +918,7 @@ msgstr ":func:`ontimer`" msgid ":func:`mainloop` | :func:`done`" msgstr ":func:`mainloop` | :func:`done`" -#: ../../library/turtle.rst:413 ../../library/turtle.rst:2118 +#: ../../library/turtle.rst:446 ../../library/turtle.rst:2210 msgid "Settings and special methods" msgstr "" @@ -903,7 +954,7 @@ msgstr ":func:`window_height`" msgid ":func:`window_width`" msgstr ":func:`window_width`" -#: ../../library/turtle.rst:423 ../../library/turtle.rst:2082 +#: ../../library/turtle.rst:456 ../../library/turtle.rst:2174 msgid "Input methods" msgstr "" @@ -915,7 +966,7 @@ msgstr ":func:`textinput`" msgid ":func:`numinput`" msgstr ":func:`numinput`" -#: ../../library/turtle.rst:427 +#: ../../library/turtle.rst:460 msgid "Methods specific to Screen" msgstr "" @@ -927,6 +978,11 @@ msgstr ":func:`bye`" msgid ":func:`exitonclick`" msgstr ":func:`exitonclick`" +#: ../../library/turtle.rst:0 +#, fuzzy +msgid ":func:`save`" +msgstr ":func:`shape`" + #: ../../library/turtle.rst:0 msgid ":func:`setup`" msgstr ":func:`setup`" @@ -935,11 +991,11 @@ msgstr ":func:`setup`" msgid ":func:`title`" msgstr ":func:`title`" -#: ../../library/turtle.rst:435 +#: ../../library/turtle.rst:469 msgid "Methods of RawTurtle/Turtle and corresponding functions" msgstr "" -#: ../../library/turtle.rst:437 +#: ../../library/turtle.rst:471 msgid "" "Most of the examples in this section refer to a Turtle instance called " "``turtle``." @@ -949,19 +1005,19 @@ msgstr "" msgid "Parameters" msgstr "參數" -#: ../../library/turtle.rst:446 ../../library/turtle.rst:491 -#: ../../library/turtle.rst:516 ../../library/turtle.rst:614 -#: ../../library/turtle.rst:637 ../../library/turtle.rst:660 +#: ../../library/turtle.rst:480 ../../library/turtle.rst:525 +#: ../../library/turtle.rst:550 ../../library/turtle.rst:648 +#: ../../library/turtle.rst:671 ../../library/turtle.rst:694 msgid "a number (integer or float)" msgstr "" -#: ../../library/turtle.rst:448 +#: ../../library/turtle.rst:482 msgid "" "Move the turtle forward by the specified *distance*, in the direction the " "turtle is headed." msgstr "" -#: ../../library/turtle.rst:451 +#: ../../library/turtle.rst:485 msgid "" ">>> turtle.position()\n" "(0.00,0.00)\n" @@ -981,18 +1037,18 @@ msgstr "" ">>> turtle.position()\n" "(-50.00,0.00)" -#: ../../library/turtle.rst:468 ../../library/turtle.rst:710 -#: ../../library/turtle.rst:977 ../../library/turtle.rst:1485 +#: ../../library/turtle.rst:502 ../../library/turtle.rst:744 +#: ../../library/turtle.rst:1011 ../../library/turtle.rst:1542 msgid "a number" msgstr "" -#: ../../library/turtle.rst:470 +#: ../../library/turtle.rst:504 msgid "" "Move the turtle backward by *distance*, opposite to the direction the turtle " "is headed. Do not change the turtle's heading." msgstr "" -#: ../../library/turtle.rst:478 +#: ../../library/turtle.rst:512 msgid "" ">>> turtle.position()\n" "(0.00,0.00)\n" @@ -1006,14 +1062,14 @@ msgstr "" ">>> turtle.position()\n" "(-30.00,0.00)" -#: ../../library/turtle.rst:493 +#: ../../library/turtle.rst:527 msgid "" "Turn turtle right by *angle* units. (Units are by default degrees, but can " "be set via the :func:`degrees` and :func:`radians` functions.) Angle " "orientation depends on the turtle mode, see :func:`mode`." msgstr "" -#: ../../library/turtle.rst:503 +#: ../../library/turtle.rst:537 msgid "" ">>> turtle.heading()\n" "22.0\n" @@ -1027,14 +1083,14 @@ msgstr "" ">>> turtle.heading()\n" "337.0" -#: ../../library/turtle.rst:518 +#: ../../library/turtle.rst:552 msgid "" "Turn turtle left by *angle* units. (Units are by default degrees, but can " "be set via the :func:`degrees` and :func:`radians` functions.) Angle " "orientation depends on the turtle mode, see :func:`mode`." msgstr "" -#: ../../library/turtle.rst:528 +#: ../../library/turtle.rst:562 msgid "" ">>> turtle.heading()\n" "22.0\n" @@ -1048,28 +1104,28 @@ msgstr "" ">>> turtle.heading()\n" "67.0" -#: ../../library/turtle.rst:542 +#: ../../library/turtle.rst:576 msgid "a number or a pair/vector of numbers" msgstr "" -#: ../../library/turtle.rst:543 ../../library/turtle.rst:576 -#: ../../library/turtle.rst:577 +#: ../../library/turtle.rst:577 ../../library/turtle.rst:610 +#: ../../library/turtle.rst:611 msgid "a number or ``None``" msgstr "" -#: ../../library/turtle.rst:545 +#: ../../library/turtle.rst:579 msgid "" "If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` " "(e.g. as returned by :func:`pos`)." msgstr "" -#: ../../library/turtle.rst:548 +#: ../../library/turtle.rst:582 msgid "" "Move turtle to an absolute position. If the pen is down, draw line. Do not " "change the turtle's orientation." msgstr "" -#: ../../library/turtle.rst:557 +#: ../../library/turtle.rst:591 msgid "" ">>> tp = turtle.pos()\n" ">>> tp\n" @@ -1097,11 +1153,11 @@ msgstr "" ">>> turtle.pos()\n" "(0.00,0.00)" -#: ../../library/turtle.rst:578 +#: ../../library/turtle.rst:612 msgid "a boolean" msgstr "" -#: ../../library/turtle.rst:580 +#: ../../library/turtle.rst:614 msgid "" "Move turtle to an absolute position. Unlike goto(x, y), a line will not be " "drawn. The turtle's orientation does not change. If currently filling, the " @@ -1111,7 +1167,7 @@ msgid "" "barrier like in goto(x, y)." msgstr "" -#: ../../library/turtle.rst:593 +#: ../../library/turtle.rst:627 msgid "" ">>> tp = turtle.pos()\n" ">>> tp\n" @@ -1139,12 +1195,12 @@ msgstr "" ">>> turtle.pos()\n" "(20.00,30.00)" -#: ../../library/turtle.rst:616 +#: ../../library/turtle.rst:650 msgid "" "Set the turtle's first coordinate to *x*, leave second coordinate unchanged." msgstr "" -#: ../../library/turtle.rst:625 +#: ../../library/turtle.rst:659 msgid "" ">>> turtle.position()\n" "(0.00,240.00)\n" @@ -1158,12 +1214,12 @@ msgstr "" ">>> turtle.position()\n" "(10.00,240.00)" -#: ../../library/turtle.rst:639 +#: ../../library/turtle.rst:673 msgid "" "Set the turtle's second coordinate to *y*, leave first coordinate unchanged." msgstr "" -#: ../../library/turtle.rst:647 +#: ../../library/turtle.rst:681 msgid "" ">>> turtle.position()\n" "(0.00,40.00)\n" @@ -1177,53 +1233,53 @@ msgstr "" ">>> turtle.position()\n" "(0.00,-10.00)" -#: ../../library/turtle.rst:662 +#: ../../library/turtle.rst:696 msgid "" "Set the orientation of the turtle to *to_angle*. Here are some common " "directions in degrees:" msgstr "" -#: ../../library/turtle.rst:666 +#: ../../library/turtle.rst:700 msgid "standard mode" msgstr "" -#: ../../library/turtle.rst:666 +#: ../../library/turtle.rst:700 msgid "logo mode" msgstr "" -#: ../../library/turtle.rst:668 +#: ../../library/turtle.rst:702 msgid "0 - east" msgstr "" -#: ../../library/turtle.rst:668 +#: ../../library/turtle.rst:702 msgid "0 - north" msgstr "" -#: ../../library/turtle.rst:669 +#: ../../library/turtle.rst:703 msgid "90 - north" msgstr "" -#: ../../library/turtle.rst:669 +#: ../../library/turtle.rst:703 msgid "90 - east" msgstr "" -#: ../../library/turtle.rst:670 +#: ../../library/turtle.rst:704 msgid "180 - west" msgstr "" -#: ../../library/turtle.rst:670 +#: ../../library/turtle.rst:704 msgid "180 - south" msgstr "" -#: ../../library/turtle.rst:671 +#: ../../library/turtle.rst:705 msgid "270 - south" msgstr "" -#: ../../library/turtle.rst:671 +#: ../../library/turtle.rst:705 msgid "270 - west" msgstr "" -#: ../../library/turtle.rst:674 +#: ../../library/turtle.rst:708 msgid "" ">>> turtle.setheading(90)\n" ">>> turtle.heading()\n" @@ -1233,13 +1289,13 @@ msgstr "" ">>> turtle.heading()\n" "90.0" -#: ../../library/turtle.rst:684 +#: ../../library/turtle.rst:718 msgid "" "Move turtle to the origin -- coordinates (0,0) -- and set its heading to its " "start-orientation (which depends on the mode, see :func:`mode`)." msgstr "" -#: ../../library/turtle.rst:694 +#: ../../library/turtle.rst:728 msgid "" ">>> turtle.heading()\n" "90.0\n" @@ -1261,15 +1317,15 @@ msgstr "" ">>> turtle.heading()\n" "0.0" -#: ../../library/turtle.rst:711 +#: ../../library/turtle.rst:745 msgid "a number (or ``None``)" msgstr "" -#: ../../library/turtle.rst:712 ../../library/turtle.rst:805 +#: ../../library/turtle.rst:746 ../../library/turtle.rst:839 msgid "an integer (or ``None``)" msgstr "" -#: ../../library/turtle.rst:714 +#: ../../library/turtle.rst:748 msgid "" "Draw a circle with given *radius*. The center is *radius* units left of the " "turtle; *extent* -- an angle -- determines which part of the circle is " @@ -1280,14 +1336,14 @@ msgid "" "changed by the amount of *extent*." msgstr "" -#: ../../library/turtle.rst:722 +#: ../../library/turtle.rst:756 msgid "" "As the circle is approximated by an inscribed regular polygon, *steps* " "determines the number of steps to use. If not given, it will be calculated " "automatically. May be used to draw regular polygons." msgstr "" -#: ../../library/turtle.rst:726 +#: ../../library/turtle.rst:760 msgid "" ">>> turtle.home()\n" ">>> turtle.position()\n" @@ -1306,21 +1362,21 @@ msgid "" "180.0" msgstr "" -#: ../../library/turtle.rst:748 +#: ../../library/turtle.rst:782 msgid "an integer >= 1 (if given)" msgstr "" -#: ../../library/turtle.rst:749 +#: ../../library/turtle.rst:783 msgid "a colorstring or a numeric color tuple" msgstr "" -#: ../../library/turtle.rst:751 +#: ../../library/turtle.rst:785 msgid "" "Draw a circular dot with diameter *size*, using *color*. If *size* is not " "given, the maximum of pensize+4 and 2*pensize is used." msgstr "" -#: ../../library/turtle.rst:755 +#: ../../library/turtle.rst:789 msgid "" ">>> turtle.home()\n" ">>> turtle.dot()\n" @@ -1338,14 +1394,14 @@ msgstr "" ">>> turtle.heading()\n" "0.0" -#: ../../library/turtle.rst:769 +#: ../../library/turtle.rst:803 msgid "" "Stamp a copy of the turtle shape onto the canvas at the current turtle " "position. Return a stamp_id for that stamp, which can be used to delete it " "by calling ``clearstamp(stamp_id)``." msgstr "" -#: ../../library/turtle.rst:773 +#: ../../library/turtle.rst:807 msgid "" ">>> turtle.color(\"blue\")\n" ">>> stamp_id = turtle.stamp()\n" @@ -1355,15 +1411,15 @@ msgstr "" ">>> stamp_id = turtle.stamp()\n" ">>> turtle.fd(50)" -#: ../../library/turtle.rst:783 +#: ../../library/turtle.rst:817 msgid "an integer, must be return value of previous :func:`stamp` call" msgstr "" -#: ../../library/turtle.rst:786 +#: ../../library/turtle.rst:820 msgid "Delete stamp with given *stampid*." msgstr "" -#: ../../library/turtle.rst:788 +#: ../../library/turtle.rst:822 msgid "" ">>> turtle.position()\n" "(150.00,-0.00)\n" @@ -1387,14 +1443,14 @@ msgstr "" ">>> turtle.position()\n" "(200.00,-0.00)" -#: ../../library/turtle.rst:807 +#: ../../library/turtle.rst:841 msgid "" "Delete all or first/last *n* of turtle's stamps. If *n* is ``None``, delete " "all stamps, if *n* > 0 delete first *n* stamps, else if *n* < 0 delete last " "*n* stamps." msgstr "" -#: ../../library/turtle.rst:811 +#: ../../library/turtle.rst:845 msgid "" ">>> for i in range(8):\n" "... unused_stamp_id = turtle.stamp()\n" @@ -1410,13 +1466,13 @@ msgstr "" ">>> turtle.clearstamps(-2)\n" ">>> turtle.clearstamps()" -#: ../../library/turtle.rst:823 +#: ../../library/turtle.rst:857 msgid "" "Undo (repeatedly) the last turtle action(s). Number of available undo " "actions is determined by the size of the undobuffer." msgstr "" -#: ../../library/turtle.rst:826 +#: ../../library/turtle.rst:860 msgid "" ">>> for i in range(4):\n" "... turtle.fd(50); turtle.lt(80)\n" @@ -1430,55 +1486,55 @@ msgstr "" ">>> for i in range(8):\n" "... turtle.undo()" -#: ../../library/turtle.rst:838 +#: ../../library/turtle.rst:872 msgid "an integer in the range 0..10 or a speedstring (see below)" msgstr "" -#: ../../library/turtle.rst:840 +#: ../../library/turtle.rst:874 msgid "" "Set the turtle's speed to an integer value in the range 0..10. If no " "argument is given, return current speed." msgstr "" -#: ../../library/turtle.rst:843 +#: ../../library/turtle.rst:877 msgid "" "If input is a number greater than 10 or smaller than 0.5, speed is set to " "0. Speedstrings are mapped to speedvalues as follows:" msgstr "" -#: ../../library/turtle.rst:846 +#: ../../library/turtle.rst:880 msgid "\"fastest\": 0" msgstr "" -#: ../../library/turtle.rst:847 +#: ../../library/turtle.rst:881 msgid "\"fast\": 10" msgstr "" -#: ../../library/turtle.rst:848 +#: ../../library/turtle.rst:882 msgid "\"normal\": 6" msgstr "" -#: ../../library/turtle.rst:849 +#: ../../library/turtle.rst:883 msgid "\"slow\": 3" msgstr "" -#: ../../library/turtle.rst:850 +#: ../../library/turtle.rst:884 msgid "\"slowest\": 1" msgstr "" -#: ../../library/turtle.rst:852 +#: ../../library/turtle.rst:886 msgid "" "Speeds from 1 to 10 enforce increasingly faster animation of line drawing " "and turtle turning." msgstr "" -#: ../../library/turtle.rst:855 +#: ../../library/turtle.rst:889 msgid "" "Attention: *speed* = 0 means that *no* animation takes place. forward/back " "makes turtle jump and likewise left/right make the turtle turn instantly." msgstr "" -#: ../../library/turtle.rst:859 +#: ../../library/turtle.rst:893 msgid "" ">>> turtle.speed()\n" "3\n" @@ -1498,12 +1554,12 @@ msgstr "" ">>> turtle.speed()\n" "9" -#: ../../library/turtle.rst:878 +#: ../../library/turtle.rst:912 msgid "" "Return the turtle's current location (x,y) (as a :class:`Vec2D` vector)." msgstr "" -#: ../../library/turtle.rst:880 +#: ../../library/turtle.rst:914 msgid "" ">>> turtle.pos()\n" "(440.00,-0.00)" @@ -1511,15 +1567,15 @@ msgstr "" ">>> turtle.pos()\n" "(440.00,-0.00)" -#: ../../library/turtle.rst:889 ../../library/turtle.rst:952 +#: ../../library/turtle.rst:923 ../../library/turtle.rst:986 msgid "a number or a pair/vector of numbers or a turtle instance" msgstr "" -#: ../../library/turtle.rst:890 ../../library/turtle.rst:953 +#: ../../library/turtle.rst:924 ../../library/turtle.rst:987 msgid "a number if *x* is a number, else ``None``" msgstr "" -#: ../../library/turtle.rst:892 +#: ../../library/turtle.rst:926 msgid "" "Return the angle between the line from turtle position to position specified " "by (x,y), the vector or the other turtle. This depends on the turtle's " @@ -1527,7 +1583,7 @@ msgid "" "\"logo\"." msgstr "" -#: ../../library/turtle.rst:896 +#: ../../library/turtle.rst:930 msgid "" ">>> turtle.goto(10, 10)\n" ">>> turtle.towards(0,0)\n" @@ -1537,11 +1593,11 @@ msgstr "" ">>> turtle.towards(0,0)\n" "225.0" -#: ../../library/turtle.rst:906 +#: ../../library/turtle.rst:940 msgid "Return the turtle's x coordinate." msgstr "" -#: ../../library/turtle.rst:908 +#: ../../library/turtle.rst:942 msgid "" ">>> turtle.home()\n" ">>> turtle.left(50)\n" @@ -1559,11 +1615,11 @@ msgstr "" ">>> print(round(turtle.xcor(), 5))\n" "64.27876" -#: ../../library/turtle.rst:922 +#: ../../library/turtle.rst:956 msgid "Return the turtle's y coordinate." msgstr "" -#: ../../library/turtle.rst:924 +#: ../../library/turtle.rst:958 msgid "" ">>> turtle.home()\n" ">>> turtle.left(60)\n" @@ -1581,13 +1637,13 @@ msgstr "" ">>> print(round(turtle.ycor(), 5))\n" "86.60254" -#: ../../library/turtle.rst:938 +#: ../../library/turtle.rst:972 msgid "" "Return the turtle's current heading (value depends on the turtle mode, " "see :func:`mode`)." msgstr "" -#: ../../library/turtle.rst:941 +#: ../../library/turtle.rst:975 msgid "" ">>> turtle.home()\n" ">>> turtle.left(67)\n" @@ -1599,13 +1655,13 @@ msgstr "" ">>> turtle.heading()\n" "67.0" -#: ../../library/turtle.rst:955 +#: ../../library/turtle.rst:989 msgid "" "Return the distance from the turtle to (x,y), the given vector, or the given " "other turtle, in turtle step units." msgstr "" -#: ../../library/turtle.rst:958 +#: ../../library/turtle.rst:992 msgid "" ">>> turtle.home()\n" ">>> turtle.distance(30,40)\n" @@ -1627,17 +1683,17 @@ msgstr "" ">>> turtle.distance(joe)\n" "77.0" -#: ../../library/turtle.rst:973 +#: ../../library/turtle.rst:1007 msgid "Settings for measurement" msgstr "" -#: ../../library/turtle.rst:979 +#: ../../library/turtle.rst:1013 msgid "" "Set angle measurement units, i.e. set number of \"degrees\" for a full " "circle. Default value is 360 degrees." msgstr "" -#: ../../library/turtle.rst:982 +#: ../../library/turtle.rst:1016 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1654,13 +1710,13 @@ msgid "" "90.0" msgstr "" -#: ../../library/turtle.rst:1002 +#: ../../library/turtle.rst:1036 msgid "" "Set the angle measurement units to radians. Equivalent to " "``degrees(2*math.pi)``." msgstr "" -#: ../../library/turtle.rst:1005 +#: ../../library/turtle.rst:1039 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1678,87 +1734,87 @@ msgstr "" ">>> turtle.heading()\n" "1.5707963267948966" -#: ../../library/turtle.rst:1033 +#: ../../library/turtle.rst:1067 msgid "Pull the pen down -- drawing when moving." msgstr "" -#: ../../library/turtle.rst:1040 +#: ../../library/turtle.rst:1074 msgid "Pull the pen up -- no drawing when moving." msgstr "" -#: ../../library/turtle.rst:1046 +#: ../../library/turtle.rst:1080 msgid "a positive number" msgstr "" -#: ../../library/turtle.rst:1048 +#: ../../library/turtle.rst:1082 msgid "" "Set the line thickness to *width* or return it. If resizemode is set to " "\"auto\" and turtleshape is a polygon, that polygon is drawn with the same " "line thickness. If no argument is given, the current pensize is returned." msgstr "" -#: ../../library/turtle.rst:1052 +#: ../../library/turtle.rst:1086 msgid "" ">>> turtle.pensize()\n" "1\n" ">>> turtle.pensize(10) # from here on lines of width 10 are drawn" msgstr "" -#: ../../library/turtle.rst:1062 +#: ../../library/turtle.rst:1096 msgid "a dictionary with some or all of the below listed keys" msgstr "" -#: ../../library/turtle.rst:1063 +#: ../../library/turtle.rst:1097 msgid "one or more keyword-arguments with the below listed keys as keywords" msgstr "" -#: ../../library/turtle.rst:1065 +#: ../../library/turtle.rst:1099 msgid "" "Return or set the pen's attributes in a \"pen-dictionary\" with the " "following key/value pairs:" msgstr "" -#: ../../library/turtle.rst:1068 +#: ../../library/turtle.rst:1102 msgid "\"shown\": True/False" msgstr "" -#: ../../library/turtle.rst:1069 +#: ../../library/turtle.rst:1103 msgid "\"pendown\": True/False" msgstr "" -#: ../../library/turtle.rst:1070 +#: ../../library/turtle.rst:1104 msgid "\"pencolor\": color-string or color-tuple" msgstr "" -#: ../../library/turtle.rst:1071 +#: ../../library/turtle.rst:1105 msgid "\"fillcolor\": color-string or color-tuple" msgstr "" -#: ../../library/turtle.rst:1072 +#: ../../library/turtle.rst:1106 msgid "\"pensize\": positive number" msgstr "" -#: ../../library/turtle.rst:1073 +#: ../../library/turtle.rst:1107 msgid "\"speed\": number in range 0..10" msgstr "" -#: ../../library/turtle.rst:1074 +#: ../../library/turtle.rst:1108 msgid "\"resizemode\": \"auto\" or \"user\" or \"noresize\"" msgstr "" -#: ../../library/turtle.rst:1075 +#: ../../library/turtle.rst:1109 msgid "\"stretchfactor\": (positive number, positive number)" msgstr "" -#: ../../library/turtle.rst:1076 +#: ../../library/turtle.rst:1110 msgid "\"outline\": positive number" msgstr "" -#: ../../library/turtle.rst:1077 +#: ../../library/turtle.rst:1111 msgid "\"tilt\": number" msgstr "" -#: ../../library/turtle.rst:1079 +#: ../../library/turtle.rst:1113 msgid "" "This dictionary can be used as argument for a subsequent call to :func:`pen` " "to restore the former pen-state. Moreover one or more of these attributes " @@ -1766,7 +1822,7 @@ msgid "" "attributes in one statement." msgstr "" -#: ../../library/turtle.rst:1084 +#: ../../library/turtle.rst:1118 msgid "" ">>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n" ">>> sorted(turtle.pen().items())\n" @@ -1798,11 +1854,11 @@ msgstr "" ">>> sorted(turtle.pen().items())[:3]\n" "[('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red')]" -#: ../../library/turtle.rst:1105 +#: ../../library/turtle.rst:1139 msgid "Return ``True`` if pen is down, ``False`` if it's up." msgstr "" -#: ../../library/turtle.rst:1107 +#: ../../library/turtle.rst:1141 msgid "" ">>> turtle.penup()\n" ">>> turtle.isdown()\n" @@ -1818,62 +1874,62 @@ msgstr "" ">>> turtle.isdown()\n" "True" -#: ../../library/turtle.rst:1123 +#: ../../library/turtle.rst:1157 msgid "Return or set the pencolor." msgstr "" -#: ../../library/turtle.rst:1125 ../../library/turtle.rst:1174 +#: ../../library/turtle.rst:1159 ../../library/turtle.rst:1208 msgid "Four input formats are allowed:" msgstr "" -#: ../../library/turtle.rst:1127 +#: ../../library/turtle.rst:1161 msgid "``pencolor()``" msgstr "``pencolor()``" -#: ../../library/turtle.rst:1128 +#: ../../library/turtle.rst:1162 msgid "" "Return the current pencolor as color specification string or as a tuple (see " "example). May be used as input to another color/pencolor/fillcolor call." msgstr "" -#: ../../library/turtle.rst:1132 +#: ../../library/turtle.rst:1166 msgid "``pencolor(colorstring)``" msgstr "``pencolor(colorstring)``" -#: ../../library/turtle.rst:1133 +#: ../../library/turtle.rst:1167 msgid "" "Set pencolor to *colorstring*, which is a Tk color specification string, " "such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: ../../library/turtle.rst:1136 +#: ../../library/turtle.rst:1170 msgid "``pencolor((r, g, b))``" msgstr "``pencolor((r, g, b))``" -#: ../../library/turtle.rst:1137 +#: ../../library/turtle.rst:1171 msgid "" "Set pencolor to the RGB color represented by the tuple of *r*, *g*, and " "*b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where " "colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: ../../library/turtle.rst:1141 +#: ../../library/turtle.rst:1175 msgid "``pencolor(r, g, b)``" msgstr "``pencolor(r, g, b)``" -#: ../../library/turtle.rst:1142 +#: ../../library/turtle.rst:1176 msgid "" "Set pencolor to the RGB color represented by *r*, *g*, and *b*. Each of " "*r*, *g*, and *b* must be in the range 0..colormode." msgstr "" -#: ../../library/turtle.rst:1145 +#: ../../library/turtle.rst:1179 msgid "" "If turtleshape is a polygon, the outline of that polygon is drawn with the " "newly set pencolor." msgstr "" -#: ../../library/turtle.rst:1148 +#: ../../library/turtle.rst:1182 msgid "" ">>> colormode()\n" "1.0\n" @@ -1911,59 +1967,59 @@ msgstr "" ">>> turtle.pencolor()\n" "(50.0, 193.0, 143.0)" -#: ../../library/turtle.rst:1172 +#: ../../library/turtle.rst:1206 msgid "Return or set the fillcolor." msgstr "" -#: ../../library/turtle.rst:1176 +#: ../../library/turtle.rst:1210 msgid "``fillcolor()``" msgstr "``fillcolor()``" -#: ../../library/turtle.rst:1177 +#: ../../library/turtle.rst:1211 msgid "" "Return the current fillcolor as color specification string, possibly in " "tuple format (see example). May be used as input to another color/pencolor/" "fillcolor call." msgstr "" -#: ../../library/turtle.rst:1181 +#: ../../library/turtle.rst:1215 msgid "``fillcolor(colorstring)``" msgstr "``fillcolor(colorstring)``" -#: ../../library/turtle.rst:1182 +#: ../../library/turtle.rst:1216 msgid "" "Set fillcolor to *colorstring*, which is a Tk color specification string, " "such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: ../../library/turtle.rst:1185 +#: ../../library/turtle.rst:1219 msgid "``fillcolor((r, g, b))``" msgstr "``fillcolor((r, g, b))``" -#: ../../library/turtle.rst:1186 +#: ../../library/turtle.rst:1220 msgid "" "Set fillcolor to the RGB color represented by the tuple of *r*, *g*, and " "*b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where " "colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: ../../library/turtle.rst:1190 +#: ../../library/turtle.rst:1224 msgid "``fillcolor(r, g, b)``" msgstr "``fillcolor(r, g, b)``" -#: ../../library/turtle.rst:1191 +#: ../../library/turtle.rst:1225 msgid "" "Set fillcolor to the RGB color represented by *r*, *g*, and *b*. Each of " "*r*, *g*, and *b* must be in the range 0..colormode." msgstr "" -#: ../../library/turtle.rst:1194 +#: ../../library/turtle.rst:1228 msgid "" "If turtleshape is a polygon, the interior of that polygon is drawn with the " "newly set fillcolor." msgstr "" -#: ../../library/turtle.rst:1197 +#: ../../library/turtle.rst:1231 msgid "" ">>> turtle.fillcolor(\"violet\")\n" ">>> turtle.fillcolor()\n" @@ -1989,55 +2045,55 @@ msgstr "" ">>> turtle.fillcolor()\n" "(255.0, 255.0, 255.0)" -#: ../../library/turtle.rst:1215 +#: ../../library/turtle.rst:1249 msgid "Return or set pencolor and fillcolor." msgstr "" -#: ../../library/turtle.rst:1217 +#: ../../library/turtle.rst:1251 msgid "" "Several input formats are allowed. They use 0 to 3 arguments as follows:" msgstr "" -#: ../../library/turtle.rst:1220 +#: ../../library/turtle.rst:1254 msgid "``color()``" msgstr "``color()``" -#: ../../library/turtle.rst:1221 +#: ../../library/turtle.rst:1255 msgid "" "Return the current pencolor and the current fillcolor as a pair of color " "specification strings or tuples as returned by :func:`pencolor` " "and :func:`fillcolor`." msgstr "" -#: ../../library/turtle.rst:1225 +#: ../../library/turtle.rst:1259 msgid "``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)``" msgstr "``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)``" -#: ../../library/turtle.rst:1226 +#: ../../library/turtle.rst:1260 msgid "" "Inputs as in :func:`pencolor`, set both, fillcolor and pencolor, to the " "given value." msgstr "" -#: ../../library/turtle.rst:1229 +#: ../../library/turtle.rst:1263 msgid "" "``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))``" msgstr "" "``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))``" -#: ../../library/turtle.rst:1230 +#: ../../library/turtle.rst:1264 msgid "" "Equivalent to ``pencolor(colorstring1)`` and ``fillcolor(colorstring2)`` and " "analogously if the other input format is used." msgstr "" -#: ../../library/turtle.rst:1233 +#: ../../library/turtle.rst:1267 msgid "" "If turtleshape is a polygon, outline and interior of that polygon is drawn " "with the newly set colors." msgstr "" -#: ../../library/turtle.rst:1236 +#: ../../library/turtle.rst:1270 msgid "" ">>> turtle.color(\"red\", \"green\")\n" ">>> turtle.color()\n" @@ -2053,15 +2109,15 @@ msgstr "" ">>> color()\n" "((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))" -#: ../../library/turtle.rst:1247 +#: ../../library/turtle.rst:1281 msgid "See also: Screen method :func:`colormode`." msgstr "" -#: ../../library/turtle.rst:1261 +#: ../../library/turtle.rst:1295 msgid "Return fillstate (``True`` if filling, ``False`` else)." msgstr "" -#: ../../library/turtle.rst:1263 +#: ../../library/turtle.rst:1297 msgid "" ">>> turtle.begin_fill()\n" ">>> if turtle.filling():\n" @@ -2075,23 +2131,29 @@ msgstr "" "... else:\n" "... turtle.pensize(3)" -#: ../../library/turtle.rst:1276 -msgid "To be called just before drawing a shape to be filled." +#: ../../library/turtle.rst:1308 +msgid "Fill the shape drawn in the ``with turtle.fill():`` block." msgstr "" -#: ../../library/turtle.rst:1281 -msgid "Fill the shape drawn after the last call to :func:`begin_fill`." +#: ../../library/turtle.rst:1310 +#, fuzzy +msgid "" +">>> turtle.color(\"black\", \"red\")\n" +">>> with turtle.fill():\n" +"... turtle.circle(80)" msgstr "" +">>> turtle.color(\"black\", \"red\")\n" +">>> turtle.begin_fill()\n" +">>> turtle.circle(80)\n" +">>> turtle.end_fill()" -#: ../../library/turtle.rst:1283 +#: ../../library/turtle.rst:1317 msgid "" -"Whether or not overlap regions for self-intersecting polygons or multiple " -"shapes are filled depends on the operating system graphics, type of overlap, " -"and number of overlaps. For example, the Turtle star above may be either " -"all yellow or have some white regions." +"Using :func:`!fill` is equivalent to adding the :func:`begin_fill` before " +"the fill-block and :func:`end_fill` after the fill-block:" msgstr "" -#: ../../library/turtle.rst:1288 +#: ../../library/turtle.rst:1320 ../../library/turtle.rst:1345 msgid "" ">>> turtle.color(\"black\", \"red\")\n" ">>> turtle.begin_fill()\n" @@ -2103,13 +2165,29 @@ msgstr "" ">>> turtle.circle(80)\n" ">>> turtle.end_fill()" -#: ../../library/turtle.rst:1302 +#: ../../library/turtle.rst:1333 +msgid "To be called just before drawing a shape to be filled." +msgstr "" + +#: ../../library/turtle.rst:1338 +msgid "Fill the shape drawn after the last call to :func:`begin_fill`." +msgstr "" + +#: ../../library/turtle.rst:1340 +msgid "" +"Whether or not overlap regions for self-intersecting polygons or multiple " +"shapes are filled depends on the operating system graphics, type of overlap, " +"and number of overlaps. For example, the Turtle star above may be either " +"all yellow or have some white regions." +msgstr "" + +#: ../../library/turtle.rst:1359 msgid "" "Delete the turtle's drawings from the screen, re-center the turtle and set " "variables to the default values." msgstr "" -#: ../../library/turtle.rst:1305 +#: ../../library/turtle.rst:1362 msgid "" ">>> turtle.goto(0,-22)\n" ">>> turtle.left(100)\n" @@ -2135,30 +2213,30 @@ msgstr "" ">>> turtle.heading()\n" "0.0" -#: ../../library/turtle.rst:1323 +#: ../../library/turtle.rst:1380 msgid "" "Delete the turtle's drawings from the screen. Do not move turtle. State " "and position of the turtle as well as drawings of other turtles are not " "affected." msgstr "" -#: ../../library/turtle.rst:1329 +#: ../../library/turtle.rst:1386 msgid "object to be written to the TurtleScreen" msgstr "" -#: ../../library/turtle.rst:1330 +#: ../../library/turtle.rst:1387 msgid "True/False" msgstr "True/False" -#: ../../library/turtle.rst:1331 +#: ../../library/turtle.rst:1388 msgid "one of the strings \"left\", \"center\" or right\"" msgstr "" -#: ../../library/turtle.rst:1332 +#: ../../library/turtle.rst:1389 msgid "a triple (fontname, fontsize, fonttype)" msgstr "" -#: ../../library/turtle.rst:1334 +#: ../../library/turtle.rst:1391 msgid "" "Write text - the string representation of *arg* - at the current turtle " "position according to *align* (\"left\", \"center\" or \"right\") and with " @@ -2166,34 +2244,34 @@ msgid "" "corner of the text. By default, *move* is ``False``." msgstr "" -#: ../../library/turtle.rst:1352 +#: ../../library/turtle.rst:1409 msgid "" "Make the turtle invisible. It's a good idea to do this while you're in the " "middle of doing some complex drawing, because hiding the turtle speeds up " "the drawing observably." msgstr "" -#: ../../library/turtle.rst:1356 +#: ../../library/turtle.rst:1413 msgid ">>> turtle.hideturtle()" msgstr ">>> turtle.hideturtle()" -#: ../../library/turtle.rst:1365 +#: ../../library/turtle.rst:1422 msgid "Make the turtle visible." msgstr "" -#: ../../library/turtle.rst:1367 +#: ../../library/turtle.rst:1424 msgid ">>> turtle.showturtle()" msgstr ">>> turtle.showturtle()" -#: ../../library/turtle.rst:1375 +#: ../../library/turtle.rst:1432 msgid "Return ``True`` if the Turtle is shown, ``False`` if it's hidden." msgstr "" -#: ../../library/turtle.rst:1390 +#: ../../library/turtle.rst:1447 msgid "a string which is a valid shapename" msgstr "" -#: ../../library/turtle.rst:1392 +#: ../../library/turtle.rst:1449 msgid "" "Set turtle shape to shape with given *name* or, if name is not given, return " "name of current shape. Shape with *name* must exist in the TurtleScreen's " @@ -2203,7 +2281,7 @@ msgid "" "method :func:`register_shape`." msgstr "" -#: ../../library/turtle.rst:1398 +#: ../../library/turtle.rst:1455 msgid "" ">>> turtle.shape()\n" "'classic'\n" @@ -2217,40 +2295,40 @@ msgstr "" ">>> turtle.shape()\n" "'turtle'" -#: ../../library/turtle.rst:1410 +#: ../../library/turtle.rst:1467 msgid "one of the strings \"auto\", \"user\", \"noresize\"" msgstr "" -#: ../../library/turtle.rst:1412 +#: ../../library/turtle.rst:1469 msgid "" "Set resizemode to one of the values: \"auto\", \"user\", \"noresize\". If " "*rmode* is not given, return current resizemode. Different resizemodes have " "the following effects:" msgstr "" -#: ../../library/turtle.rst:1416 +#: ../../library/turtle.rst:1473 msgid "" "\"auto\": adapts the appearance of the turtle corresponding to the value of " "pensize." msgstr "" -#: ../../library/turtle.rst:1417 +#: ../../library/turtle.rst:1474 msgid "" "\"user\": adapts the appearance of the turtle according to the values of " "stretchfactor and outlinewidth (outline), which are set by :func:`shapesize`." msgstr "" -#: ../../library/turtle.rst:1420 +#: ../../library/turtle.rst:1477 msgid "\"noresize\": no adaption of the turtle's appearance takes place." msgstr "" -#: ../../library/turtle.rst:1422 +#: ../../library/turtle.rst:1479 msgid "" "``resizemode(\"user\")`` is called by :func:`shapesize` when used with " "arguments." msgstr "" -#: ../../library/turtle.rst:1424 +#: ../../library/turtle.rst:1481 msgid "" ">>> turtle.resizemode()\n" "'noresize'\n" @@ -2264,12 +2342,12 @@ msgstr "" ">>> turtle.resizemode()\n" "'auto'" -#: ../../library/turtle.rst:1437 ../../library/turtle.rst:1438 -#: ../../library/turtle.rst:1439 +#: ../../library/turtle.rst:1494 ../../library/turtle.rst:1495 +#: ../../library/turtle.rst:1496 msgid "positive number" msgstr "" -#: ../../library/turtle.rst:1441 +#: ../../library/turtle.rst:1498 msgid "" "Return or set the pen's attributes x/y-stretchfactors and/or outline. Set " "resizemode to \"user\". If and only if resizemode is set to \"user\", the " @@ -2279,7 +2357,7 @@ msgid "" "determines the width of the shape's outline." msgstr "" -#: ../../library/turtle.rst:1448 +#: ../../library/turtle.rst:1505 msgid "" ">>> turtle.shapesize()\n" "(1.0, 1.0, 1)\n" @@ -2301,12 +2379,12 @@ msgstr "" ">>> turtle.shapesize()\n" "(5, 5, 8)" -#: ../../library/turtle.rst:1464 ../../library/turtle.rst:2101 -#: ../../library/turtle.rst:2102 ../../library/turtle.rst:2103 +#: ../../library/turtle.rst:1521 ../../library/turtle.rst:2193 +#: ../../library/turtle.rst:2194 ../../library/turtle.rst:2195 msgid "number (optional)" msgstr "" -#: ../../library/turtle.rst:1466 +#: ../../library/turtle.rst:1523 msgid "" "Set or return the current shearfactor. Shear the turtleshape according to " "the given shearfactor shear, which is the tangent of the shear angle. Do " @@ -2315,7 +2393,7 @@ msgid "" "by which lines parallel to the heading of the turtle are sheared." msgstr "" -#: ../../library/turtle.rst:1473 +#: ../../library/turtle.rst:1530 msgid "" ">>> turtle.shape(\"circle\")\n" ">>> turtle.shapesize(5,2)\n" @@ -2329,13 +2407,13 @@ msgstr "" ">>> turtle.shearfactor()\n" "0.5" -#: ../../library/turtle.rst:1487 +#: ../../library/turtle.rst:1544 msgid "" "Rotate the turtleshape by *angle* from its current tilt-angle, but do *not* " "change the turtle's heading (direction of movement)." msgstr "" -#: ../../library/turtle.rst:1490 +#: ../../library/turtle.rst:1547 msgid "" ">>> turtle.reset()\n" ">>> turtle.shape(\"circle\")\n" @@ -2353,13 +2431,13 @@ msgstr "" ">>> turtle.tilt(30)\n" ">>> turtle.fd(50)" -#: ../../library/turtle.rst:1504 ../../library/turtle.rst:1527 -#: ../../library/turtle.rst:1528 ../../library/turtle.rst:1529 -#: ../../library/turtle.rst:1530 +#: ../../library/turtle.rst:1561 ../../library/turtle.rst:1584 +#: ../../library/turtle.rst:1585 ../../library/turtle.rst:1586 +#: ../../library/turtle.rst:1587 msgid "a number (optional)" msgstr "" -#: ../../library/turtle.rst:1506 +#: ../../library/turtle.rst:1563 msgid "" "Set or return the current tilt-angle. If angle is given, rotate the " "turtleshape to point in the direction specified by angle, regardless of its " @@ -2369,7 +2447,7 @@ msgid "" "turtle (its direction of movement)." msgstr "" -#: ../../library/turtle.rst:1514 +#: ../../library/turtle.rst:1571 msgid "" ">>> turtle.reset()\n" ">>> turtle.shape(\"circle\")\n" @@ -2385,11 +2463,11 @@ msgstr "" ">>> turtle.tiltangle()\n" "45.0" -#: ../../library/turtle.rst:1532 +#: ../../library/turtle.rst:1589 msgid "Set or return the current transformation matrix of the turtle shape." msgstr "" -#: ../../library/turtle.rst:1534 +#: ../../library/turtle.rst:1591 msgid "" "If none of the matrix elements are given, return the transformation matrix " "as a tuple of 4 elements. Otherwise set the given elements and transform the " @@ -2399,7 +2477,7 @@ msgid "" "tiltangle according to the given matrix." msgstr "" -#: ../../library/turtle.rst:1543 +#: ../../library/turtle.rst:1600 msgid "" ">>> turtle = Turtle()\n" ">>> turtle.shape(\"square\")\n" @@ -2415,13 +2493,13 @@ msgstr "" ">>> turtle.shapetransform()\n" "(4.0, -1.0, -0.0, 2.0)" -#: ../../library/turtle.rst:1556 +#: ../../library/turtle.rst:1613 msgid "" "Return the current shape polygon as tuple of coordinate pairs. This can be " "used to define a new shape or components of a compound shape." msgstr "" -#: ../../library/turtle.rst:1559 +#: ../../library/turtle.rst:1616 msgid "" ">>> turtle.shape(\"square\")\n" ">>> turtle.shapetransform(4, -1, 0, 2)\n" @@ -2433,33 +2511,33 @@ msgstr "" ">>> turtle.get_shapepoly()\n" "((50, -20), (30, 20), (-50, 20), (-30, -20))" -#: ../../library/turtle.rst:1574 ../../library/turtle.rst:1596 -#: ../../library/turtle.rst:1621 ../../library/turtle.rst:2025 +#: ../../library/turtle.rst:1631 ../../library/turtle.rst:1653 +#: ../../library/turtle.rst:1678 ../../library/turtle.rst:2117 msgid "" "a function with two arguments which will be called with the coordinates of " "the clicked point on the canvas" msgstr "" -#: ../../library/turtle.rst:1576 ../../library/turtle.rst:1598 -#: ../../library/turtle.rst:1623 ../../library/turtle.rst:2027 +#: ../../library/turtle.rst:1633 ../../library/turtle.rst:1655 +#: ../../library/turtle.rst:1680 ../../library/turtle.rst:2119 msgid "number of the mouse-button, defaults to 1 (left mouse button)" msgstr "" -#: ../../library/turtle.rst:1577 ../../library/turtle.rst:1599 -#: ../../library/turtle.rst:1624 ../../library/turtle.rst:2028 +#: ../../library/turtle.rst:1634 ../../library/turtle.rst:1656 +#: ../../library/turtle.rst:1681 ../../library/turtle.rst:2120 msgid "" "``True`` or ``False`` -- if ``True``, a new binding will be added, otherwise " "it will replace a former binding" msgstr "" -#: ../../library/turtle.rst:1580 +#: ../../library/turtle.rst:1637 msgid "" "Bind *fun* to mouse-click events on this turtle. If *fun* is ``None``, " "existing bindings are removed. Example for the anonymous turtle, i.e. the " "procedural way:" msgstr "" -#: ../../library/turtle.rst:1584 +#: ../../library/turtle.rst:1641 msgid "" ">>> def turn(x, y):\n" "... left(180)\n" @@ -2468,13 +2546,13 @@ msgid "" ">>> onclick(None) # event-binding will be removed" msgstr "" -#: ../../library/turtle.rst:1602 +#: ../../library/turtle.rst:1659 msgid "" "Bind *fun* to mouse-button-release events on this turtle. If *fun* is " "``None``, existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:1605 +#: ../../library/turtle.rst:1662 msgid "" ">>> class MyTurtle(Turtle):\n" "... def glow(self,x,y):\n" @@ -2488,45 +2566,65 @@ msgid "" ">>> turtle.onrelease(turtle.unglow) # releasing turns it to transparent." msgstr "" -#: ../../library/turtle.rst:1627 +#: ../../library/turtle.rst:1684 msgid "" "Bind *fun* to mouse-move events on this turtle. If *fun* is ``None``, " "existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:1630 +#: ../../library/turtle.rst:1687 msgid "" "Remark: Every sequence of mouse-move-events on a turtle is preceded by a " "mouse-click event on that turtle." msgstr "" -#: ../../library/turtle.rst:1633 +#: ../../library/turtle.rst:1690 msgid ">>> turtle.ondrag(turtle.goto)" msgstr ">>> turtle.ondrag(turtle.goto)" -#: ../../library/turtle.rst:1638 +#: ../../library/turtle.rst:1695 msgid "" "Subsequently, clicking and dragging the Turtle will move it across the " "screen thereby producing handdrawings (if pen is down)." msgstr "" -#: ../../library/turtle.rst:1647 +#: ../../library/turtle.rst:1705 +msgid "" +"Record the vertices of a polygon drawn in the ``with turtle.poly():`` block. " +"The first and last vertices will be connected." +msgstr "" + +#: ../../library/turtle.rst:1708 +#, fuzzy +msgid "" +">>> with turtle.poly():\n" +"... turtle.forward(100)\n" +"... turtle.right(60)\n" +"... turtle.forward(100)" +msgstr "" +">>> for i in range(4):\n" +"... turtle.fd(50); turtle.lt(80)\n" +"...\n" +">>> for i in range(8):\n" +"... turtle.undo()" + +#: ../../library/turtle.rst:1721 msgid "" "Start recording the vertices of a polygon. Current turtle position is first " "vertex of polygon." msgstr "" -#: ../../library/turtle.rst:1653 +#: ../../library/turtle.rst:1727 msgid "" "Stop recording the vertices of a polygon. Current turtle position is last " "vertex of polygon. This will be connected with the first vertex." msgstr "" -#: ../../library/turtle.rst:1659 +#: ../../library/turtle.rst:1733 msgid "Return the last recorded polygon." msgstr "" -#: ../../library/turtle.rst:1661 +#: ../../library/turtle.rst:1735 msgid "" ">>> turtle.home()\n" ">>> turtle.begin_poly()\n" @@ -2550,13 +2648,13 @@ msgstr "" ">>> p = turtle.get_poly()\n" ">>> register_shape(\"myFavouriteShape\", p)" -#: ../../library/turtle.rst:1678 +#: ../../library/turtle.rst:1752 msgid "" "Create and return a clone of the turtle with same position, heading and " "turtle properties." msgstr "" -#: ../../library/turtle.rst:1681 +#: ../../library/turtle.rst:1755 msgid "" ">>> mick = Turtle()\n" ">>> joe = mick.clone()" @@ -2564,13 +2662,13 @@ msgstr "" ">>> mick = Turtle()\n" ">>> joe = mick.clone()" -#: ../../library/turtle.rst:1691 +#: ../../library/turtle.rst:1765 msgid "" "Return the Turtle object itself. Only reasonable use: as a function to " "return the \"anonymous turtle\":" msgstr "" -#: ../../library/turtle.rst:1694 +#: ../../library/turtle.rst:1768 msgid "" ">>> pet = getturtle()\n" ">>> pet.fd(50)\n" @@ -2582,13 +2680,13 @@ msgstr "" ">>> pet\n" "" -#: ../../library/turtle.rst:1705 +#: ../../library/turtle.rst:1779 msgid "" "Return the :class:`TurtleScreen` object the turtle is drawing on. " "TurtleScreen methods can then be called for that object." msgstr "" -#: ../../library/turtle.rst:1708 +#: ../../library/turtle.rst:1782 msgid "" ">>> ts = turtle.getscreen()\n" ">>> ts\n" @@ -2600,11 +2698,11 @@ msgstr "" "\n" ">>> ts.bgcolor(\"pink\")" -#: ../../library/turtle.rst:1719 +#: ../../library/turtle.rst:1793 msgid "an integer or ``None``" msgstr "一個整數或 ``None``" -#: ../../library/turtle.rst:1721 +#: ../../library/turtle.rst:1795 msgid "" "Set or disable undobuffer. If *size* is an integer, an empty undobuffer of " "given size is installed. *size* gives the maximum number of turtle actions " @@ -2612,15 +2710,15 @@ msgid "" "``None``, the undobuffer is disabled." msgstr "" -#: ../../library/turtle.rst:1726 +#: ../../library/turtle.rst:1800 msgid ">>> turtle.setundobuffer(42)" msgstr ">>> turtle.setundobuffer(42)" -#: ../../library/turtle.rst:1734 +#: ../../library/turtle.rst:1808 msgid "Return number of entries in the undobuffer." msgstr "" -#: ../../library/turtle.rst:1736 +#: ../../library/turtle.rst:1810 msgid "" ">>> while undobufferentries():\n" "... undo()" @@ -2628,32 +2726,32 @@ msgstr "" ">>> while undobufferentries():\n" "... undo()" -#: ../../library/turtle.rst:1747 +#: ../../library/turtle.rst:1821 msgid "Compound shapes" msgstr "" -#: ../../library/turtle.rst:1749 +#: ../../library/turtle.rst:1823 msgid "" "To use compound turtle shapes, which consist of several polygons of " "different color, you must use the helper class :class:`Shape` explicitly as " "described below:" msgstr "" -#: ../../library/turtle.rst:1753 +#: ../../library/turtle.rst:1827 msgid "Create an empty Shape object of type \"compound\"." msgstr "" -#: ../../library/turtle.rst:1754 +#: ../../library/turtle.rst:1828 msgid "" "Add as many components to this object as desired, using " "the :meth:`~Shape.addcomponent` method." msgstr "" -#: ../../library/turtle.rst:1757 +#: ../../library/turtle.rst:1831 msgid "For example:" msgstr "舉例來說:" -#: ../../library/turtle.rst:1759 +#: ../../library/turtle.rst:1833 msgid "" ">>> s = Shape(\"compound\")\n" ">>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5))\n" @@ -2667,11 +2765,11 @@ msgstr "" ">>> poly2 = ((0,0),(10,-5),(-10,-5))\n" ">>> s.addcomponent(poly2, \"blue\", \"red\")" -#: ../../library/turtle.rst:1768 +#: ../../library/turtle.rst:1842 msgid "Now add the Shape to the Screen's shapelist and use it:" msgstr "" -#: ../../library/turtle.rst:1770 +#: ../../library/turtle.rst:1844 msgid "" ">>> register_shape(\"myshape\", s)\n" ">>> shape(\"myshape\")" @@ -2679,34 +2777,34 @@ msgstr "" ">>> register_shape(\"myshape\", s)\n" ">>> shape(\"myshape\")" -#: ../../library/turtle.rst:1779 +#: ../../library/turtle.rst:1853 msgid "" "The :class:`Shape` class is used internally by the :func:`register_shape` " "method in different ways. The application programmer has to deal with the " "Shape class *only* when using compound shapes like shown above!" msgstr "" -#: ../../library/turtle.rst:1785 +#: ../../library/turtle.rst:1859 msgid "Methods of TurtleScreen/Screen and corresponding functions" msgstr "" -#: ../../library/turtle.rst:1787 +#: ../../library/turtle.rst:1861 msgid "" "Most of the examples in this section refer to a TurtleScreen instance called " "``screen``." msgstr "" -#: ../../library/turtle.rst:1801 +#: ../../library/turtle.rst:1875 msgid "" "a color string or three numbers in the range 0..colormode or a 3-tuple of " "such numbers" msgstr "" -#: ../../library/turtle.rst:1805 +#: ../../library/turtle.rst:1879 msgid "Set or return background color of the TurtleScreen." msgstr "" -#: ../../library/turtle.rst:1807 +#: ../../library/turtle.rst:1881 msgid "" ">>> screen.bgcolor(\"orange\")\n" ">>> screen.bgcolor()\n" @@ -2722,11 +2820,13 @@ msgstr "" ">>> screen.bgcolor()\n" "(128.0, 0.0, 128.0)" -#: ../../library/turtle.rst:1820 -msgid "a string, name of a gif-file or ``\"nopic\"``, or ``None``" +#: ../../library/turtle.rst:1894 +msgid "" +"a string, name of an image file (PNG, GIF, PGM, and PPM) or ``\"nopic\"``, " +"or ``None``" msgstr "" -#: ../../library/turtle.rst:1822 +#: ../../library/turtle.rst:1897 msgid "" "Set background image or return name of current backgroundimage. If " "*picname* is a filename, set the corresponding image as background. If " @@ -2734,7 +2834,7 @@ msgid "" "*picname* is ``None``, return the filename of the current backgroundimage. ::" msgstr "" -#: ../../library/turtle.rst:1827 +#: ../../library/turtle.rst:1902 msgid "" ">>> screen.bgpic()\n" "'nopic'\n" @@ -2748,44 +2848,44 @@ msgstr "" ">>> screen.bgpic()\n" "\"landscape.gif\"" -#: ../../library/turtle.rst:1838 +#: ../../library/turtle.rst:1913 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``clearscreen``. The global function ``clear`` is a different one " "derived from the Turtle method ``clear``." msgstr "" -#: ../../library/turtle.rst:1845 +#: ../../library/turtle.rst:1920 msgid "" "Delete all drawings and all turtles from the TurtleScreen. Reset the now " "empty TurtleScreen to its initial state: white background, no background " "image, no event bindings and tracing on." msgstr "" -#: ../../library/turtle.rst:1854 +#: ../../library/turtle.rst:1929 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``resetscreen``. The global function ``reset`` is another one derived " "from the Turtle method ``reset``." msgstr "" -#: ../../library/turtle.rst:1861 +#: ../../library/turtle.rst:1936 msgid "Reset all Turtles on the Screen to their initial state." msgstr "" -#: ../../library/turtle.rst:1866 +#: ../../library/turtle.rst:1941 msgid "positive integer, new width of canvas in pixels" msgstr "" -#: ../../library/turtle.rst:1867 +#: ../../library/turtle.rst:1942 msgid "positive integer, new height of canvas in pixels" msgstr "" -#: ../../library/turtle.rst:1868 +#: ../../library/turtle.rst:1943 msgid "colorstring or color-tuple, new background color" msgstr "" -#: ../../library/turtle.rst:1870 +#: ../../library/turtle.rst:1945 msgid "" "If no arguments are given, return current (canvaswidth, canvasheight). Else " "resize the canvas the turtles are drawing on. Do not alter the drawing " @@ -2794,40 +2894,40 @@ msgid "" "outside the canvas before." msgstr "" -#: ../../library/turtle.rst:1882 +#: ../../library/turtle.rst:1957 msgid "e.g. to search for an erroneously escaped turtle ;-)" msgstr "" -#: ../../library/turtle.rst:1887 +#: ../../library/turtle.rst:1962 msgid "a number, x-coordinate of lower left corner of canvas" msgstr "" -#: ../../library/turtle.rst:1888 +#: ../../library/turtle.rst:1963 msgid "a number, y-coordinate of lower left corner of canvas" msgstr "" -#: ../../library/turtle.rst:1889 +#: ../../library/turtle.rst:1964 msgid "a number, x-coordinate of upper right corner of canvas" msgstr "" -#: ../../library/turtle.rst:1890 +#: ../../library/turtle.rst:1965 msgid "a number, y-coordinate of upper right corner of canvas" msgstr "" -#: ../../library/turtle.rst:1892 +#: ../../library/turtle.rst:1967 msgid "" "Set up user-defined coordinate system and switch to mode \"world\" if " "necessary. This performs a ``screen.reset()``. If mode \"world\" is " "already active, all drawings are redrawn according to the new coordinates." msgstr "" -#: ../../library/turtle.rst:1896 +#: ../../library/turtle.rst:1971 msgid "" "**ATTENTION**: in user-defined coordinate systems angles may appear " "distorted." msgstr "" -#: ../../library/turtle.rst:1899 +#: ../../library/turtle.rst:1974 msgid "" ">>> screen.reset()\n" ">>> screen.setworldcoordinates(-50,-7.5,50,7.5)\n" @@ -2838,22 +2938,44 @@ msgid "" "... left(45); fd(2) # a regular octagon" msgstr "" -#: ../../library/turtle.rst:1924 +#: ../../library/turtle.rst:1999 +msgid "" +"Temporarily disable turtle animation. The code written inside the " +"``no_animation`` block will not be animated; once the code block is exited, " +"the drawing will appear." +msgstr "" + +#: ../../library/turtle.rst:2003 +#, fuzzy +msgid "" +">>> with screen.no_animation():\n" +"... for dist in range(2, 400, 2):\n" +"... fd(dist)\n" +"... rt(90)" +msgstr "" +">>> screen.tracer(8, 25)\n" +">>> dist = 2\n" +">>> for i in range(200):\n" +"... fd(dist)\n" +"... rt(90)\n" +"... dist += 2" + +#: ../../library/turtle.rst:2016 msgid "positive integer" msgstr "" -#: ../../library/turtle.rst:1926 +#: ../../library/turtle.rst:2018 msgid "" "Set or return the drawing *delay* in milliseconds. (This is approximately " "the time interval between two consecutive canvas updates.) The longer the " "drawing delay, the slower the animation." msgstr "" -#: ../../library/turtle.rst:1930 +#: ../../library/turtle.rst:2022 msgid "Optional argument:" msgstr "" -#: ../../library/turtle.rst:1932 +#: ../../library/turtle.rst:2024 msgid "" ">>> screen.delay()\n" "10\n" @@ -2867,11 +2989,11 @@ msgstr "" ">>> screen.delay()\n" "5" -#: ../../library/turtle.rst:1944 ../../library/turtle.rst:1945 +#: ../../library/turtle.rst:2036 ../../library/turtle.rst:2037 msgid "nonnegative integer" msgstr "" -#: ../../library/turtle.rst:1947 +#: ../../library/turtle.rst:2039 msgid "" "Turn turtle animation on/off and set delay for update drawings. If *n* is " "given, only each n-th regular screen update is really performed. (Can be " @@ -2880,7 +3002,7 @@ msgid "" "delay value (see :func:`delay`)." msgstr "" -#: ../../library/turtle.rst:1954 +#: ../../library/turtle.rst:2046 msgid "" ">>> screen.tracer(8, 25)\n" ">>> dist = 2\n" @@ -2896,37 +3018,37 @@ msgstr "" "... rt(90)\n" "... dist += 2" -#: ../../library/turtle.rst:1967 +#: ../../library/turtle.rst:2059 msgid "Perform a TurtleScreen update. To be used when tracer is turned off." msgstr "" -#: ../../library/turtle.rst:1969 +#: ../../library/turtle.rst:2061 msgid "See also the RawTurtle/Turtle method :func:`speed`." msgstr "另請參閱 RawTurtle/Turtle 的 :func:`speed` 方法。" -#: ../../library/turtle.rst:1977 +#: ../../library/turtle.rst:2069 msgid "" "Set focus on TurtleScreen (in order to collect key-events). Dummy arguments " "are provided in order to be able to pass :func:`listen` to the onclick " "method." msgstr "" -#: ../../library/turtle.rst:1984 ../../library/turtle.rst:2004 +#: ../../library/turtle.rst:2076 ../../library/turtle.rst:2096 msgid "a function with no arguments or ``None``" msgstr "" -#: ../../library/turtle.rst:1985 ../../library/turtle.rst:2005 +#: ../../library/turtle.rst:2077 ../../library/turtle.rst:2097 msgid "a string: key (e.g. \"a\") or key-symbol (e.g. \"space\")" msgstr "" -#: ../../library/turtle.rst:1987 +#: ../../library/turtle.rst:2079 msgid "" "Bind *fun* to key-release event of key. If *fun* is ``None``, event " "bindings are removed. Remark: in order to be able to register key-events, " "TurtleScreen must have the focus. (See method :func:`listen`.)" msgstr "" -#: ../../library/turtle.rst:1991 +#: ../../library/turtle.rst:2083 msgid "" ">>> def f():\n" "... fd(50)\n" @@ -2942,14 +3064,14 @@ msgstr "" ">>> screen.onkey(f, \"Up\")\n" ">>> screen.listen()" -#: ../../library/turtle.rst:2007 +#: ../../library/turtle.rst:2099 msgid "" "Bind *fun* to key-press event of key if key is given, or to any key-press-" "event if no key is given. Remark: in order to be able to register key-" "events, TurtleScreen must have focus. (See method :func:`listen`.)" msgstr "" -#: ../../library/turtle.rst:2012 +#: ../../library/turtle.rst:2104 msgid "" ">>> def f():\n" "... fd(50)\n" @@ -2963,19 +3085,19 @@ msgstr "" ">>> screen.onkey(f, \"Up\")\n" ">>> screen.listen()" -#: ../../library/turtle.rst:2031 +#: ../../library/turtle.rst:2123 msgid "" "Bind *fun* to mouse-click events on this screen. If *fun* is ``None``, " "existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:2034 +#: ../../library/turtle.rst:2126 msgid "" "Example for a TurtleScreen instance named ``screen`` and a Turtle instance " "named ``turtle``:" msgstr "" -#: ../../library/turtle.rst:2037 +#: ../../library/turtle.rst:2129 msgid "" ">>> screen.onclick(turtle.goto) # Subsequently clicking into the " "TurtleScreen will\n" @@ -2984,26 +3106,26 @@ msgid "" ">>> screen.onclick(None) # remove event binding again" msgstr "" -#: ../../library/turtle.rst:2045 +#: ../../library/turtle.rst:2137 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``onscreenclick``. The global function ``onclick`` is another one " "derived from the Turtle method ``onclick``." msgstr "" -#: ../../library/turtle.rst:2052 +#: ../../library/turtle.rst:2144 msgid "a function with no arguments" msgstr "" -#: ../../library/turtle.rst:2053 +#: ../../library/turtle.rst:2145 msgid "a number >= 0" msgstr "" -#: ../../library/turtle.rst:2055 +#: ../../library/turtle.rst:2147 msgid "Install a timer that calls *fun* after *t* milliseconds." msgstr "" -#: ../../library/turtle.rst:2057 +#: ../../library/turtle.rst:2149 msgid "" ">>> running = True\n" ">>> def f():\n" @@ -3015,7 +3137,7 @@ msgid "" ">>> running = False" msgstr "" -#: ../../library/turtle.rst:2073 +#: ../../library/turtle.rst:2165 msgid "" "Starts event loop - calling Tkinter's mainloop function. Must be the last " "statement in a turtle graphics program. Must *not* be used if a script is " @@ -3023,16 +3145,16 @@ msgid "" "turtle graphics. ::" msgstr "" -#: ../../library/turtle.rst:2078 +#: ../../library/turtle.rst:2170 msgid ">>> screen.mainloop()" msgstr ">>> screen.mainloop()" -#: ../../library/turtle.rst:2086 ../../library/turtle.rst:2087 -#: ../../library/turtle.rst:2099 ../../library/turtle.rst:2100 +#: ../../library/turtle.rst:2178 ../../library/turtle.rst:2179 +#: ../../library/turtle.rst:2191 ../../library/turtle.rst:2192 msgid "string" msgstr "string(字串)" -#: ../../library/turtle.rst:2089 +#: ../../library/turtle.rst:2181 msgid "" "Pop up a dialog window for input of a string. Parameter title is the title " "of the dialog window, prompt is a text mostly describing what information to " @@ -3040,11 +3162,11 @@ msgid "" "``None``. ::" msgstr "" -#: ../../library/turtle.rst:2094 +#: ../../library/turtle.rst:2186 msgid ">>> screen.textinput(\"NIM\", \"Name of first player:\")" msgstr ">>> screen.textinput(\"NIM\", \"Name of first player:\")" -#: ../../library/turtle.rst:2105 +#: ../../library/turtle.rst:2197 msgid "" "Pop up a dialog window for input of a number. title is the title of the " "dialog window, prompt is a text mostly describing what numerical information " @@ -3055,7 +3177,7 @@ msgid "" "return ``None``. ::" msgstr "" -#: ../../library/turtle.rst:2114 +#: ../../library/turtle.rst:2206 msgid "" ">>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, " "maxval=10000)" @@ -3063,17 +3185,17 @@ msgstr "" ">>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, " "maxval=10000)" -#: ../../library/turtle.rst:2122 +#: ../../library/turtle.rst:2214 msgid "one of the strings \"standard\", \"logo\" or \"world\"" msgstr "" -#: ../../library/turtle.rst:2124 +#: ../../library/turtle.rst:2216 msgid "" "Set turtle mode (\"standard\", \"logo\" or \"world\") and perform reset. If " "mode is not given, current mode is returned." msgstr "" -#: ../../library/turtle.rst:2127 +#: ../../library/turtle.rst:2219 msgid "" "Mode \"standard\" is compatible with old :mod:`turtle`. Mode \"logo\" is " "compatible with most Logo turtle graphics. Mode \"world\" uses user-defined " @@ -3081,60 +3203,60 @@ msgid "" "if ``x/y`` unit-ratio doesn't equal 1." msgstr "" -#: ../../library/turtle.rst:2133 +#: ../../library/turtle.rst:2225 msgid "Mode" msgstr "" -#: ../../library/turtle.rst:2133 +#: ../../library/turtle.rst:2225 msgid "Initial turtle heading" msgstr "" -#: ../../library/turtle.rst:2133 +#: ../../library/turtle.rst:2225 msgid "positive angles" msgstr "" -#: ../../library/turtle.rst:2135 +#: ../../library/turtle.rst:2227 msgid "\"standard\"" msgstr "" -#: ../../library/turtle.rst:2135 +#: ../../library/turtle.rst:2227 msgid "to the right (east)" msgstr "" -#: ../../library/turtle.rst:2135 +#: ../../library/turtle.rst:2227 msgid "counterclockwise" msgstr "" -#: ../../library/turtle.rst:2136 +#: ../../library/turtle.rst:2228 msgid "\"logo\"" msgstr "" -#: ../../library/turtle.rst:2136 +#: ../../library/turtle.rst:2228 msgid "upward (north)" msgstr "" -#: ../../library/turtle.rst:2136 +#: ../../library/turtle.rst:2228 msgid "clockwise" msgstr "" -#: ../../library/turtle.rst:2139 +#: ../../library/turtle.rst:2231 msgid "" ">>> mode(\"logo\") # resets turtle heading to north\n" ">>> mode()\n" "'logo'" msgstr "" -#: ../../library/turtle.rst:2149 +#: ../../library/turtle.rst:2241 msgid "one of the values 1.0 or 255" msgstr "" -#: ../../library/turtle.rst:2151 +#: ../../library/turtle.rst:2243 msgid "" "Return the colormode or set it to 1.0 or 255. Subsequently *r*, *g*, *b* " "values of color triples have to be in the range 0..*cmode*." msgstr "" -#: ../../library/turtle.rst:2154 +#: ../../library/turtle.rst:2246 msgid "" ">>> screen.colormode(1)\n" ">>> turtle.pencolor(240, 160, 80)\n" @@ -3160,13 +3282,13 @@ msgstr "" "255\n" ">>> turtle.pencolor(240,160,80)" -#: ../../library/turtle.rst:2172 +#: ../../library/turtle.rst:2264 msgid "" "Return the Canvas of this TurtleScreen. Useful for insiders who know what " "to do with a Tkinter Canvas." msgstr "" -#: ../../library/turtle.rst:2175 +#: ../../library/turtle.rst:2267 msgid "" ">>> cv = screen.getcanvas()\n" ">>> cv\n" @@ -3176,11 +3298,11 @@ msgstr "" ">>> cv\n" "" -#: ../../library/turtle.rst:2185 +#: ../../library/turtle.rst:2277 msgid "Return a list of names of all currently available turtle shapes." msgstr "" -#: ../../library/turtle.rst:2187 +#: ../../library/turtle.rst:2279 msgid "" ">>> screen.getshapes()\n" "['arrow', 'blank', 'circle', ..., 'turtle']" @@ -3188,53 +3310,70 @@ msgstr "" ">>> screen.getshapes()\n" "['arrow', 'blank', 'circle', ..., 'turtle']" -#: ../../library/turtle.rst:2197 -msgid "There are three different ways to call this function:" +#: ../../library/turtle.rst:2289 +msgid "There are four different ways to call this function:" msgstr "" -#: ../../library/turtle.rst:2199 +#: ../../library/turtle.rst:2291 msgid "" -"*name* is the name of a gif-file and *shape* is ``None``: Install the " -"corresponding image shape. ::" +"*name* is the name of an image file (PNG, GIF, PGM, and PPM) and *shape* is " +"``None``: Install the corresponding image shape. ::" msgstr "" -#: ../../library/turtle.rst:2202 +#: ../../library/turtle.rst:2294 msgid ">>> screen.register_shape(\"turtle.gif\")" msgstr ">>> screen.register_shape(\"turtle.gif\")" -#: ../../library/turtle.rst:2205 +#: ../../library/turtle.rst:2297 ../../library/turtle.rst:2306 msgid "" "Image shapes *do not* rotate when turning the turtle, so they do not display " "the heading of the turtle!" msgstr "" -#: ../../library/turtle.rst:2208 +#: ../../library/turtle.rst:2300 +msgid "" +"*name* is an arbitrary string and *shape* is the name of an image file (PNG, " +"GIF, PGM, and PPM): Install the corresponding image shape. ::" +msgstr "" + +#: ../../library/turtle.rst:2303 +#, fuzzy +msgid ">>> screen.register_shape(\"turtle\", \"turtle.gif\")" +msgstr ">>> screen.register_shape(\"turtle.gif\")" + +#: ../../library/turtle.rst:2309 msgid "" "*name* is an arbitrary string and *shape* is a tuple of pairs of " "coordinates: Install the corresponding polygon shape." msgstr "" -#: ../../library/turtle.rst:2211 +#: ../../library/turtle.rst:2312 msgid ">>> screen.register_shape(\"triangle\", ((5,-3), (0,5), (-5,-3)))" msgstr ">>> screen.register_shape(\"triangle\", ((5,-3), (0,5), (-5,-3)))" -#: ../../library/turtle.rst:2216 +#: ../../library/turtle.rst:2317 msgid "" "*name* is an arbitrary string and *shape* is a (compound) :class:`Shape` " "object: Install the corresponding compound shape." msgstr "" -#: ../../library/turtle.rst:2219 +#: ../../library/turtle.rst:2320 msgid "" "Add a turtle shape to TurtleScreen's shapelist. Only thusly registered " "shapes can be used by issuing the command ``shape(shapename)``." msgstr "" -#: ../../library/turtle.rst:2225 +#: ../../library/turtle.rst:2323 +msgid "" +"Added support for PNG, PGM, and PPM image formats. Both a shape name and an " +"image file name can be specified." +msgstr "" + +#: ../../library/turtle.rst:2330 msgid "Return the list of turtles on the screen." msgstr "" -#: ../../library/turtle.rst:2227 +#: ../../library/turtle.rst:2332 msgid "" ">>> for turtle in screen.turtles():\n" "... turtle.color(\"red\")" @@ -3242,11 +3381,11 @@ msgstr "" ">>> for turtle in screen.turtles():\n" "... turtle.color(\"red\")" -#: ../../library/turtle.rst:2236 +#: ../../library/turtle.rst:2341 msgid "Return the height of the turtle window. ::" msgstr "" -#: ../../library/turtle.rst:2238 +#: ../../library/turtle.rst:2343 msgid "" ">>> screen.window_height()\n" "480" @@ -3254,11 +3393,11 @@ msgstr "" ">>> screen.window_height()\n" "480" -#: ../../library/turtle.rst:2244 +#: ../../library/turtle.rst:2349 msgid "Return the width of the turtle window. ::" msgstr "" -#: ../../library/turtle.rst:2246 +#: ../../library/turtle.rst:2351 msgid "" ">>> screen.window_width()\n" "640" @@ -3266,19 +3405,19 @@ msgstr "" ">>> screen.window_width()\n" "640" -#: ../../library/turtle.rst:2253 +#: ../../library/turtle.rst:2358 msgid "Methods specific to Screen, not inherited from TurtleScreen" msgstr "" -#: ../../library/turtle.rst:2257 +#: ../../library/turtle.rst:2362 msgid "Shut the turtlegraphics window." msgstr "" -#: ../../library/turtle.rst:2262 +#: ../../library/turtle.rst:2367 msgid "Bind ``bye()`` method to mouse clicks on the Screen." msgstr "" -#: ../../library/turtle.rst:2265 +#: ../../library/turtle.rst:2370 msgid "" "If the value \"using_IDLE\" in the configuration dictionary is ``False`` " "(default value), also enter mainloop. Remark: If IDLE with the ``-n`` " @@ -3287,38 +3426,59 @@ msgid "" "the client script." msgstr "" -#: ../../library/turtle.rst:2274 +#: ../../library/turtle.rst:2379 +msgid "Save the current turtle drawing (and turtles) as a PostScript file." +msgstr "" + +#: ../../library/turtle.rst:2381 +msgid "the path of the saved PostScript file" +msgstr "" + +#: ../../library/turtle.rst:2382 +msgid "" +"if ``False`` and there already exists a file with the given filename, then " +"the function will raise a ``FileExistsError``. If it is ``True``, the file " +"will be overwritten." +msgstr "" + +#: ../../library/turtle.rst:2387 +msgid "" +">>> screen.save(\"my_drawing.ps\")\n" +">>> screen.save(\"my_drawing.ps\", overwrite=True)" +msgstr "" + +#: ../../library/turtle.rst:2397 msgid "" "Set the size and position of the main window. Default values of arguments " "are stored in the configuration dictionary and can be changed via " "a :file:`turtle.cfg` file." msgstr "" -#: ../../library/turtle.rst:2278 +#: ../../library/turtle.rst:2401 msgid "" "if an integer, a size in pixels, if a float, a fraction of the screen; " "default is 50% of screen" msgstr "" -#: ../../library/turtle.rst:2280 +#: ../../library/turtle.rst:2403 msgid "" "if an integer, the height in pixels, if a float, a fraction of the screen; " "default is 75% of screen" msgstr "" -#: ../../library/turtle.rst:2282 +#: ../../library/turtle.rst:2405 msgid "" "if positive, starting position in pixels from the left edge of the screen, " "if negative from the right edge, if ``None``, center window horizontally" msgstr "" -#: ../../library/turtle.rst:2285 +#: ../../library/turtle.rst:2408 msgid "" "if positive, starting position in pixels from the top edge of the screen, if " "negative from the bottom edge, if ``None``, center window vertically" msgstr "" -#: ../../library/turtle.rst:2289 +#: ../../library/turtle.rst:2412 msgid "" ">>> screen.setup (width=200, height=200, startx=0, starty=0)\n" ">>> # sets window to 200x200 pixels, in upper left of screen\n" @@ -3326,129 +3486,129 @@ msgid "" ">>> # sets window to 75% of screen by 50% of screen and centers" msgstr "" -#: ../../library/turtle.rst:2300 +#: ../../library/turtle.rst:2423 msgid "a string that is shown in the titlebar of the turtle graphics window" msgstr "" -#: ../../library/turtle.rst:2303 +#: ../../library/turtle.rst:2426 msgid "Set title of turtle window to *titlestring*." msgstr "" -#: ../../library/turtle.rst:2305 +#: ../../library/turtle.rst:2428 msgid ">>> screen.title(\"Welcome to the turtle zoo!\")" msgstr ">>> screen.title(\"Welcome to the turtle zoo!\")" -#: ../../library/turtle.rst:2312 +#: ../../library/turtle.rst:2435 msgid "Public classes" msgstr "" -#: ../../library/turtle.rst:2318 +#: ../../library/turtle.rst:2441 msgid "" "a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or " "a :class:`TurtleScreen`" msgstr "" -#: ../../library/turtle.rst:2321 +#: ../../library/turtle.rst:2444 msgid "" "Create a turtle. The turtle has all methods described above as \"methods of " "Turtle/RawTurtle\"." msgstr "" -#: ../../library/turtle.rst:2327 +#: ../../library/turtle.rst:2450 msgid "" "Subclass of RawTurtle, has the same interface but draws on a " "default :class:`Screen` object created automatically when needed for the " "first time." msgstr "" -#: ../../library/turtle.rst:2333 +#: ../../library/turtle.rst:2456 msgid "a :class:`!tkinter.Canvas`" msgstr "" -#: ../../library/turtle.rst:2335 +#: ../../library/turtle.rst:2458 msgid "" "Provides screen oriented methods like :func:`bgcolor` etc. that are " "described above." msgstr "" -#: ../../library/turtle.rst:2340 +#: ../../library/turtle.rst:2463 msgid "" "Subclass of TurtleScreen, with :ref:`four methods added `." msgstr "" -#: ../../library/turtle.rst:2345 +#: ../../library/turtle.rst:2468 msgid "" "some Tkinter widget to contain the ScrolledCanvas, i.e. a Tkinter-canvas " "with scrollbars added" msgstr "" -#: ../../library/turtle.rst:2348 +#: ../../library/turtle.rst:2471 msgid "" "Used by class Screen, which thus automatically provides a ScrolledCanvas as " "playground for the turtles." msgstr "" -#: ../../library/turtle.rst:2353 +#: ../../library/turtle.rst:2476 msgid "one of the strings \"polygon\", \"image\", \"compound\"" msgstr "" -#: ../../library/turtle.rst:2355 +#: ../../library/turtle.rst:2478 msgid "" "Data structure modeling shapes. The pair ``(type_, data)`` must follow this " "specification:" msgstr "" -#: ../../library/turtle.rst:2360 +#: ../../library/turtle.rst:2483 msgid "*type_*" msgstr "*type_*" -#: ../../library/turtle.rst:2360 +#: ../../library/turtle.rst:2483 msgid "*data*" msgstr "*data*" -#: ../../library/turtle.rst:2362 +#: ../../library/turtle.rst:2485 msgid "\"polygon\"" msgstr "\"polygon\"" -#: ../../library/turtle.rst:2362 +#: ../../library/turtle.rst:2485 msgid "a polygon-tuple, i.e. a tuple of pairs of coordinates" msgstr "" -#: ../../library/turtle.rst:2363 +#: ../../library/turtle.rst:2486 msgid "\"image\"" msgstr "\"image\"" -#: ../../library/turtle.rst:2363 +#: ../../library/turtle.rst:2486 msgid "an image (in this form only used internally!)" msgstr "" -#: ../../library/turtle.rst:2364 +#: ../../library/turtle.rst:2487 msgid "\"compound\"" msgstr "\"compound\"" -#: ../../library/turtle.rst:2364 +#: ../../library/turtle.rst:2487 msgid "" "``None`` (a compound shape has to be constructed using " "the :meth:`addcomponent` method)" msgstr "" -#: ../../library/turtle.rst:2370 +#: ../../library/turtle.rst:2493 msgid "a polygon, i.e. a tuple of pairs of numbers" msgstr "" -#: ../../library/turtle.rst:2371 +#: ../../library/turtle.rst:2494 msgid "a color the *poly* will be filled with" msgstr "" -#: ../../library/turtle.rst:2372 +#: ../../library/turtle.rst:2495 msgid "a color for the poly's outline (if given)" msgstr "" -#: ../../library/turtle.rst:2374 +#: ../../library/turtle.rst:2497 msgid "Example:" msgstr "例如:" -#: ../../library/turtle.rst:2376 +#: ../../library/turtle.rst:2499 msgid "" ">>> poly = ((0,0),(10,-5),(0,10),(-10,-5))\n" ">>> s = Shape(\"compound\")\n" @@ -3456,63 +3616,63 @@ msgid "" ">>> # ... add more components and then use register_shape()" msgstr "" -#: ../../library/turtle.rst:2384 +#: ../../library/turtle.rst:2507 msgid "See :ref:`compoundshapes`." msgstr "請見\\ :ref:`compoundshapes`。" -#: ../../library/turtle.rst:2389 +#: ../../library/turtle.rst:2512 msgid "" "A two-dimensional vector class, used as a helper class for implementing " "turtle graphics. May be useful for turtle graphics programs too. Derived " "from tuple, so a vector is a tuple!" msgstr "" -#: ../../library/turtle.rst:2393 +#: ../../library/turtle.rst:2516 msgid "Provides (for *a*, *b* vectors, *k* number):" msgstr "" -#: ../../library/turtle.rst:2395 +#: ../../library/turtle.rst:2518 msgid "``a + b`` vector addition" msgstr "``a + b`` 向量加法" -#: ../../library/turtle.rst:2396 +#: ../../library/turtle.rst:2519 msgid "``a - b`` vector subtraction" msgstr "``a - b`` 向量減法" -#: ../../library/turtle.rst:2397 +#: ../../library/turtle.rst:2520 msgid "``a * b`` inner product" msgstr "``a * b`` 內積" -#: ../../library/turtle.rst:2398 +#: ../../library/turtle.rst:2521 msgid "``k * a`` and ``a * k`` multiplication with scalar" msgstr "" -#: ../../library/turtle.rst:2399 +#: ../../library/turtle.rst:2522 msgid "``abs(a)`` absolute value of a" msgstr "``abs(a)`` a 的絕對值" -#: ../../library/turtle.rst:2400 +#: ../../library/turtle.rst:2523 msgid "``a.rotate(angle)`` rotation" msgstr "``a.rotate(angle)`` 旋轉" -#: ../../library/turtle.rst:2406 +#: ../../library/turtle.rst:2529 msgid "Explanation" msgstr "解釋" -#: ../../library/turtle.rst:2408 +#: ../../library/turtle.rst:2531 msgid "" "A turtle object draws on a screen object, and there a number of key classes " "in the turtle object-oriented interface that can be used to create them and " "relate them to each other." msgstr "" -#: ../../library/turtle.rst:2412 +#: ../../library/turtle.rst:2535 msgid "" "A :class:`Turtle` instance will automatically create a :class:`Screen` " "instance if one is not already present." msgstr "" -#: ../../library/turtle.rst:2415 +#: ../../library/turtle.rst:2538 msgid "" "``Turtle`` is a subclass of :class:`RawTurtle`, which *doesn't* " "automatically create a drawing surface - a *canvas* will need to be provided " @@ -3520,7 +3680,7 @@ msgid "" "tkinter.Canvas`, :class:`ScrolledCanvas` or :class:`TurtleScreen`." msgstr "" -#: ../../library/turtle.rst:2421 +#: ../../library/turtle.rst:2544 msgid "" ":class:`TurtleScreen` is the basic drawing surface for a " "turtle. :class:`Screen` is a subclass of ``TurtleScreen``, and " @@ -3530,7 +3690,7 @@ msgid "" "an argument." msgstr "" -#: ../../library/turtle.rst:2428 +#: ../../library/turtle.rst:2551 msgid "" "The functional interface for turtle graphics uses the various methods of " "``Turtle`` and ``TurtleScreen``/``Screen``. Behind the scenes, a screen " @@ -3539,38 +3699,38 @@ msgid "" "created whenever any of the functions derived from a Turtle method is called." msgstr "" -#: ../../library/turtle.rst:2434 +#: ../../library/turtle.rst:2557 msgid "" "To use multiple turtles on a screen, the object-oriented interface must be " "used." msgstr "" -#: ../../library/turtle.rst:2439 +#: ../../library/turtle.rst:2562 msgid "Help and configuration" msgstr "" -#: ../../library/turtle.rst:2442 +#: ../../library/turtle.rst:2565 msgid "How to use help" msgstr "" -#: ../../library/turtle.rst:2444 +#: ../../library/turtle.rst:2567 msgid "" "The public methods of the Screen and Turtle classes are documented " "extensively via docstrings. So these can be used as online-help via the " "Python help facilities:" msgstr "" -#: ../../library/turtle.rst:2448 +#: ../../library/turtle.rst:2571 msgid "" "When using IDLE, tooltips show the signatures and first lines of the " "docstrings of typed in function-/method calls." msgstr "" -#: ../../library/turtle.rst:2451 +#: ../../library/turtle.rst:2574 msgid "Calling :func:`help` on methods or functions displays the docstrings::" msgstr "" -#: ../../library/turtle.rst:2453 +#: ../../library/turtle.rst:2576 msgid "" ">>> help(Screen.bgcolor)\n" "Help on method bgcolor in module turtle:\n" @@ -3630,13 +3790,13 @@ msgstr "" "\n" " >>> turtle.penup()" -#: ../../library/turtle.rst:2482 +#: ../../library/turtle.rst:2605 msgid "" "The docstrings of the functions which are derived from methods have a " "modified form::" msgstr "" -#: ../../library/turtle.rst:2485 +#: ../../library/turtle.rst:2608 msgid "" ">>> help(bgcolor)\n" "Help on function bgcolor in module turtle:\n" @@ -3700,28 +3860,28 @@ msgstr "" " Example:\n" " >>> penup()" -#: ../../library/turtle.rst:2516 +#: ../../library/turtle.rst:2639 msgid "" "These modified docstrings are created automatically together with the " "function definitions that are derived from the methods at import time." msgstr "" -#: ../../library/turtle.rst:2521 +#: ../../library/turtle.rst:2644 msgid "Translation of docstrings into different languages" msgstr "" -#: ../../library/turtle.rst:2523 +#: ../../library/turtle.rst:2646 msgid "" "There is a utility to create a dictionary the keys of which are the method " "names and the values of which are the docstrings of the public methods of " "the classes Screen and Turtle." msgstr "" -#: ../../library/turtle.rst:2529 +#: ../../library/turtle.rst:2652 msgid "a string, used as filename" msgstr "" -#: ../../library/turtle.rst:2531 +#: ../../library/turtle.rst:2654 msgid "" "Create and write docstring-dictionary to a Python script with the given " "filename. This function has to be called explicitly (it is not used by the " @@ -3730,37 +3890,37 @@ msgid "" "for translation of the docstrings into different languages." msgstr "" -#: ../../library/turtle.rst:2537 +#: ../../library/turtle.rst:2660 msgid "" "If you (or your students) want to use :mod:`turtle` with online help in your " "native language, you have to translate the docstrings and save the resulting " "file as e.g. :file:`turtle_docstringdict_german.py`." msgstr "" -#: ../../library/turtle.rst:2541 +#: ../../library/turtle.rst:2664 msgid "" "If you have an appropriate entry in your :file:`turtle.cfg` file this " "dictionary will be read in at import time and will replace the original " "English docstrings." msgstr "" -#: ../../library/turtle.rst:2544 +#: ../../library/turtle.rst:2667 msgid "" "At the time of this writing there are docstring dictionaries in German and " "in Italian. (Requests please to glingl@aon.at.)" msgstr "" -#: ../../library/turtle.rst:2550 +#: ../../library/turtle.rst:2673 msgid "How to configure Screen and Turtles" msgstr "" -#: ../../library/turtle.rst:2552 +#: ../../library/turtle.rst:2675 msgid "" "The built-in default configuration mimics the appearance and behaviour of " "the old turtle module in order to retain best possible compatibility with it." msgstr "" -#: ../../library/turtle.rst:2555 +#: ../../library/turtle.rst:2678 msgid "" "If you want to use a different configuration which better reflects the " "features of this module or which better fits to your needs, e.g. for use in " @@ -3769,12 +3929,12 @@ msgid "" "settings." msgstr "" -#: ../../library/turtle.rst:2560 +#: ../../library/turtle.rst:2683 msgid "" "The built in configuration would correspond to the following ``turtle.cfg``:" msgstr "" -#: ../../library/turtle.rst:2562 +#: ../../library/turtle.rst:2685 msgid "" "width = 0.5\n" "height = 0.75\n" @@ -3818,42 +3978,42 @@ msgstr "" "title = Python Turtle Graphics\n" "using_IDLE = False" -#: ../../library/turtle.rst:2585 +#: ../../library/turtle.rst:2708 msgid "Short explanation of selected entries:" msgstr "" -#: ../../library/turtle.rst:2587 +#: ../../library/turtle.rst:2710 msgid "" "The first four lines correspond to the arguments of the :func:`Screen.setup " "` method." msgstr "" -#: ../../library/turtle.rst:2589 +#: ../../library/turtle.rst:2712 msgid "" "Line 5 and 6 correspond to the arguments of the " "method :func:`Screen.screensize `." msgstr "" -#: ../../library/turtle.rst:2591 +#: ../../library/turtle.rst:2714 msgid "" "*shape* can be any of the built-in shapes, e.g: arrow, turtle, etc. For " "more info try ``help(shape)``." msgstr "" -#: ../../library/turtle.rst:2593 +#: ../../library/turtle.rst:2716 msgid "" "If you want to use no fill color (i.e. make the turtle transparent), you " "have to write ``fillcolor = \"\"`` (but all nonempty strings must not have " "quotes in the cfg file)." msgstr "" -#: ../../library/turtle.rst:2596 +#: ../../library/turtle.rst:2719 msgid "" "If you want to reflect the turtle its state, you have to use ``resizemode = " "auto``." msgstr "" -#: ../../library/turtle.rst:2598 +#: ../../library/turtle.rst:2721 msgid "" "If you set e.g. ``language = italian`` the " "docstringdict :file:`turtle_docstringdict_italian.py` will be loaded at " @@ -3861,7 +4021,7 @@ msgid "" "as :mod:`turtle`)." msgstr "" -#: ../../library/turtle.rst:2601 +#: ../../library/turtle.rst:2724 msgid "" "The entries *exampleturtle* and *examplescreen* define the names of these " "objects as they occur in the docstrings. The transformation of method-" @@ -3869,309 +4029,309 @@ msgid "" "docstrings." msgstr "" -#: ../../library/turtle.rst:2605 +#: ../../library/turtle.rst:2728 msgid "" "*using_IDLE*: Set this to ``True`` if you regularly work with IDLE and its " "``-n`` switch (\"no subprocess\"). This will prevent :func:`exitonclick` to " "enter the mainloop." msgstr "" -#: ../../library/turtle.rst:2609 +#: ../../library/turtle.rst:2732 msgid "" "There can be a :file:`turtle.cfg` file in the directory where :mod:`turtle` " "is stored and an additional one in the current working directory. The " "latter will override the settings of the first one." msgstr "" -#: ../../library/turtle.rst:2613 +#: ../../library/turtle.rst:2736 msgid "" "The :file:`Lib/turtledemo` directory contains a :file:`turtle.cfg` file. " "You can study it as an example and see its effects when running the demos " "(preferably not from within the demo-viewer)." msgstr "" -#: ../../library/turtle.rst:2619 +#: ../../library/turtle.rst:2742 msgid ":mod:`turtledemo` --- Demo scripts" msgstr "" -#: ../../library/turtle.rst:2624 +#: ../../library/turtle.rst:2747 msgid "" "The :mod:`turtledemo` package includes a set of demo scripts. These scripts " "can be run and viewed using the supplied demo viewer as follows::" msgstr "" -#: ../../library/turtle.rst:2627 +#: ../../library/turtle.rst:2750 msgid "python -m turtledemo" msgstr "python -m turtledemo" -#: ../../library/turtle.rst:2629 +#: ../../library/turtle.rst:2752 msgid "" "Alternatively, you can run the demo scripts individually. For example, ::" msgstr "" -#: ../../library/turtle.rst:2631 +#: ../../library/turtle.rst:2754 msgid "python -m turtledemo.bytedesign" msgstr "python -m turtledemo.bytedesign" -#: ../../library/turtle.rst:2633 +#: ../../library/turtle.rst:2756 msgid "The :mod:`turtledemo` package directory contains:" msgstr "" -#: ../../library/turtle.rst:2635 +#: ../../library/turtle.rst:2758 msgid "" "A demo viewer :file:`__main__.py` which can be used to view the sourcecode " "of the scripts and run them at the same time." msgstr "" -#: ../../library/turtle.rst:2637 +#: ../../library/turtle.rst:2760 msgid "" "Multiple scripts demonstrating different features of the :mod:`turtle` " "module. Examples can be accessed via the Examples menu. They can also be " "run standalone." msgstr "" -#: ../../library/turtle.rst:2640 +#: ../../library/turtle.rst:2763 msgid "" "A :file:`turtle.cfg` file which serves as an example of how to write and use " "such files." msgstr "" -#: ../../library/turtle.rst:2643 +#: ../../library/turtle.rst:2766 msgid "The demo scripts are:" msgstr "" -#: ../../library/turtle.rst:2650 +#: ../../library/turtle.rst:2773 msgid "Name" msgstr "" -#: ../../library/turtle.rst:2650 +#: ../../library/turtle.rst:2773 msgid "Description" msgstr "描述" -#: ../../library/turtle.rst:2650 +#: ../../library/turtle.rst:2773 msgid "Features" msgstr "" -#: ../../library/turtle.rst:2652 +#: ../../library/turtle.rst:2775 msgid "bytedesign" msgstr "" -#: ../../library/turtle.rst:2652 +#: ../../library/turtle.rst:2775 msgid "complex classical turtle graphics pattern" msgstr "" -#: ../../library/turtle.rst:2652 +#: ../../library/turtle.rst:2775 msgid ":func:`tracer`, delay, :func:`update`" msgstr "" -#: ../../library/turtle.rst:2655 +#: ../../library/turtle.rst:2778 msgid "chaos" msgstr "" -#: ../../library/turtle.rst:2655 +#: ../../library/turtle.rst:2778 msgid "" "graphs Verhulst dynamics, shows that computer's computations can generate " "results sometimes against the common sense expectations" msgstr "" -#: ../../library/turtle.rst:2655 +#: ../../library/turtle.rst:2778 msgid "world coordinates" msgstr "" -#: ../../library/turtle.rst:2661 +#: ../../library/turtle.rst:2784 msgid "clock" msgstr "" -#: ../../library/turtle.rst:2661 +#: ../../library/turtle.rst:2784 msgid "analog clock showing time of your computer" msgstr "" -#: ../../library/turtle.rst:2661 +#: ../../library/turtle.rst:2784 msgid "turtles as clock's hands, ontimer" msgstr "" -#: ../../library/turtle.rst:2664 +#: ../../library/turtle.rst:2787 msgid "colormixer" msgstr "" -#: ../../library/turtle.rst:2664 +#: ../../library/turtle.rst:2787 msgid "experiment with r, g, b" msgstr "" -#: ../../library/turtle.rst:2666 +#: ../../library/turtle.rst:2789 msgid "forest" msgstr "" -#: ../../library/turtle.rst:2666 +#: ../../library/turtle.rst:2789 msgid "3 breadth-first trees" msgstr "" -#: ../../library/turtle.rst:2666 +#: ../../library/turtle.rst:2789 msgid "randomization" msgstr "" -#: ../../library/turtle.rst:2668 +#: ../../library/turtle.rst:2791 msgid "fractalcurves" msgstr "" -#: ../../library/turtle.rst:2668 +#: ../../library/turtle.rst:2791 msgid "Hilbert & Koch curves" msgstr "" -#: ../../library/turtle.rst:2668 +#: ../../library/turtle.rst:2791 msgid "recursion" msgstr "" -#: ../../library/turtle.rst:2670 +#: ../../library/turtle.rst:2793 msgid "lindenmayer" msgstr "" -#: ../../library/turtle.rst:2670 +#: ../../library/turtle.rst:2793 msgid "ethnomathematics (indian kolams)" msgstr "" -#: ../../library/turtle.rst:2670 +#: ../../library/turtle.rst:2793 msgid "L-System" msgstr "" -#: ../../library/turtle.rst:2673 +#: ../../library/turtle.rst:2796 msgid "minimal_hanoi" msgstr "minimal_hanoi" -#: ../../library/turtle.rst:2673 +#: ../../library/turtle.rst:2796 msgid "Towers of Hanoi" msgstr "" -#: ../../library/turtle.rst:2673 +#: ../../library/turtle.rst:2796 msgid "Rectangular Turtles as Hanoi discs (shape, shapesize)" msgstr "" -#: ../../library/turtle.rst:2677 +#: ../../library/turtle.rst:2800 msgid "nim" msgstr "" -#: ../../library/turtle.rst:2677 +#: ../../library/turtle.rst:2800 msgid "" "play the classical nim game with three heaps of sticks against the computer." msgstr "" -#: ../../library/turtle.rst:2677 +#: ../../library/turtle.rst:2800 msgid "turtles as nimsticks, event driven (mouse, keyboard)" msgstr "" -#: ../../library/turtle.rst:2681 +#: ../../library/turtle.rst:2804 msgid "paint" msgstr "" -#: ../../library/turtle.rst:2681 +#: ../../library/turtle.rst:2804 msgid "super minimalistic drawing program" msgstr "" -#: ../../library/turtle.rst:2684 +#: ../../library/turtle.rst:2807 msgid "peace" msgstr "" -#: ../../library/turtle.rst:2684 +#: ../../library/turtle.rst:2807 msgid "elementary" msgstr "" -#: ../../library/turtle.rst:2684 +#: ../../library/turtle.rst:2807 msgid "turtle: appearance and animation" msgstr "" -#: ../../library/turtle.rst:2687 +#: ../../library/turtle.rst:2810 msgid "penrose" msgstr "" -#: ../../library/turtle.rst:2687 +#: ../../library/turtle.rst:2810 msgid "aperiodic tiling with kites and darts" msgstr "" -#: ../../library/turtle.rst:2690 +#: ../../library/turtle.rst:2813 msgid "planet_and_moon" msgstr "planet_and_moon" -#: ../../library/turtle.rst:2690 +#: ../../library/turtle.rst:2813 msgid "simulation of gravitational system" msgstr "" -#: ../../library/turtle.rst:2690 +#: ../../library/turtle.rst:2813 msgid "compound shapes, :class:`Vec2D`" msgstr "" -#: ../../library/turtle.rst:2693 +#: ../../library/turtle.rst:2816 msgid "rosette" msgstr "" -#: ../../library/turtle.rst:2693 +#: ../../library/turtle.rst:2816 msgid "a pattern from the wikipedia article on turtle graphics" msgstr "" -#: ../../library/turtle.rst:2693 +#: ../../library/turtle.rst:2816 msgid ":func:`clone`, :func:`undo`" msgstr ":func:`clone`, :func:`undo`" -#: ../../library/turtle.rst:2696 +#: ../../library/turtle.rst:2819 msgid "round_dance" msgstr "round_dance" -#: ../../library/turtle.rst:2696 +#: ../../library/turtle.rst:2819 msgid "dancing turtles rotating pairwise in opposite direction" msgstr "" -#: ../../library/turtle.rst:2696 +#: ../../library/turtle.rst:2819 msgid "compound shapes, clone shapesize, tilt, get_shapepoly, update" msgstr "" -#: ../../library/turtle.rst:2700 +#: ../../library/turtle.rst:2823 msgid "sorting_animate" msgstr "sorting_animate" -#: ../../library/turtle.rst:2700 +#: ../../library/turtle.rst:2823 msgid "visual demonstration of different sorting methods" msgstr "" -#: ../../library/turtle.rst:2700 +#: ../../library/turtle.rst:2823 msgid "simple alignment, randomization" msgstr "" -#: ../../library/turtle.rst:2703 +#: ../../library/turtle.rst:2826 msgid "tree" msgstr "" -#: ../../library/turtle.rst:2703 +#: ../../library/turtle.rst:2826 msgid "a (graphical) breadth first tree (using generators)" msgstr "" -#: ../../library/turtle.rst:2706 +#: ../../library/turtle.rst:2829 msgid "two_canvases" msgstr "two_canvases" -#: ../../library/turtle.rst:2706 +#: ../../library/turtle.rst:2829 msgid "simple design" msgstr "" -#: ../../library/turtle.rst:2706 +#: ../../library/turtle.rst:2829 msgid "turtles on two canvases" msgstr "" -#: ../../library/turtle.rst:2709 +#: ../../library/turtle.rst:2832 msgid "yinyang" msgstr "" -#: ../../library/turtle.rst:2709 +#: ../../library/turtle.rst:2832 msgid "another elementary example" msgstr "" -#: ../../library/turtle.rst:2712 +#: ../../library/turtle.rst:2835 msgid "Have fun!" msgstr "" -#: ../../library/turtle.rst:2716 +#: ../../library/turtle.rst:2839 msgid "Changes since Python 2.6" msgstr "" -#: ../../library/turtle.rst:2718 +#: ../../library/turtle.rst:2841 msgid "" "The methods :func:`Turtle.tracer `, :func:`Turtle.window_width " "` and :func:`Turtle.window_height ` have been " @@ -4182,14 +4342,14 @@ msgid "" "methods.)" msgstr "" -#: ../../library/turtle.rst:2726 +#: ../../library/turtle.rst:2849 msgid "" "The method :func:`!Turtle.fill` has been eliminated. The behaviour " "of :func:`begin_fill` and :func:`end_fill` have changed slightly: now every " "filling process must be completed with an ``end_fill()`` call." msgstr "" -#: ../../library/turtle.rst:2731 +#: ../../library/turtle.rst:2854 msgid "" "A method :func:`Turtle.filling ` has been added. It returns a " "boolean value: ``True`` if a filling process is under way, ``False`` " @@ -4197,11 +4357,11 @@ msgid "" "in Python 2.6." msgstr "" -#: ../../library/turtle.rst:2737 +#: ../../library/turtle.rst:2860 msgid "Changes since Python 3.0" msgstr "" -#: ../../library/turtle.rst:2739 +#: ../../library/turtle.rst:2862 msgid "" "The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` " "and :func:`get_shapepoly` have been added. Thus the full range of regular " @@ -4210,33 +4370,27 @@ msgid "" "used to get or set the tilt angle." msgstr "" -#: ../../library/turtle.rst:2745 +#: ../../library/turtle.rst:2868 msgid "" "The :class:`Screen` method :func:`onkeypress` has been added as a complement " "to :func:`onkey`. As the latter binds actions to the key release event, an " "alias: :func:`onkeyrelease` was also added for it." msgstr "" -#: ../../library/turtle.rst:2749 +#: ../../library/turtle.rst:2872 msgid "" "The method :func:`Screen.mainloop ` has been added, so there is no " "longer a need to use the standalone :func:`mainloop` function when working " "with :class:`Screen` and :class:`Turtle` objects." msgstr "" -#: ../../library/turtle.rst:2753 +#: ../../library/turtle.rst:2876 msgid "" "Two input methods have been added: :func:`Screen.textinput ` " "and :func:`Screen.numinput `. These pop up input dialogs and " "return strings and numbers respectively." msgstr "" -#: ../../library/turtle.rst:2757 -msgid "" -"Two example scripts :file:`tdemo_nim.py` and :file:`tdemo_round_dance.py` " -"have been added to the :file:`Lib/turtledemo` directory." -msgstr "" - #~ msgid ":func:`settiltangle`" #~ msgstr ":func:`settiltangle`" diff --git a/library/types.po b/library/types.po index 7d9a6f6bb4d..226554390a9 100644 --- a/library/types.po +++ b/library/types.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,8 +35,8 @@ msgstr "" #: ../../library/types.rst:14 msgid "" "It also defines names for some object types that are used by the standard " -"Python interpreter, but not exposed as builtins like :class:`int` or :class:" -"`str` are." +"Python interpreter, but not exposed as builtins like :class:`int` " +"or :class:`str` are." msgstr "" #: ../../library/types.rst:18 @@ -121,12 +121,12 @@ msgstr "" #: ../../library/types.rst:76 msgid "" -"This function looks for items in *bases* that are not instances of :class:" -"`type`, and returns a tuple where each such object that has an :meth:" -"`~object.__mro_entries__` method is replaced with an unpacked result of " -"calling this method. If a *bases* item is an instance of :class:`type`, or " -"it doesn't have an :meth:`!__mro_entries__` method, then it is included in " -"the return tuple unchanged." +"This function looks for items in *bases* that are not instances " +"of :class:`type`, and returns a tuple where each such object that has " +"an :meth:`~object.__mro_entries__` method is replaced with an unpacked " +"result of calling this method. If a *bases* item is an instance " +"of :class:`type`, or it doesn't have an :meth:`!__mro_entries__` method, " +"then it is included in the return tuple unchanged." msgstr "" #: ../../library/types.rst:87 @@ -237,8 +237,8 @@ msgstr "" #: ../../library/types.rst:156 msgid "" -"The type of user-defined functions and functions created by :keyword:" -"`lambda` expressions." +"The type of user-defined functions and functions created " +"by :keyword:`lambda` expressions." msgstr "" #: ../../library/types.rst:159 @@ -246,8 +246,8 @@ msgid "" "Raises an :ref:`auditing event ` ``function.__new__`` with " "argument ``code``." msgstr "" -"引發一個附帶引數 ``code`` 的\\ :ref:`稽核事件 ` ``function." -"__new__``。" +"引發一個附帶引數 ``code`` 的\\ :ref:`稽核事件 ` " +"``function.__new__``。" #: ../../library/types.rst:161 msgid "" @@ -275,8 +275,8 @@ msgstr "" #: ../../library/types.rst:191 msgid "" -"The type of :ref:`code objects ` such as returned by :func:" -"`compile`." +"The type of :ref:`code objects ` such as returned " +"by :func:`compile`." msgstr "" #: ../../library/types.rst:193 @@ -315,8 +315,8 @@ msgstr "" #: ../../library/types.rst:222 msgid "" -"The type of methods of some built-in data types and base classes such as :" -"meth:`object.__init__` or :meth:`object.__lt__`." +"The type of methods of some built-in data types and base classes such " +"as :meth:`object.__init__` or :meth:`object.__lt__`." msgstr "" #: ../../library/types.rst:230 @@ -427,25 +427,29 @@ msgid "The type of :ref:`union type expressions`." msgstr "" #: ../../library/types.rst:319 +msgid "This is now an alias for :class:`typing.Union`." +msgstr "" + +#: ../../library/types.rst:323 msgid "" -"The type of traceback objects such as found in ``sys.exception()." -"__traceback__``." +"The type of traceback objects such as found in " +"``sys.exception().__traceback__``." msgstr "" -#: ../../library/types.rst:321 +#: ../../library/types.rst:325 msgid "" "See :ref:`the language reference ` for details of the " "available attributes and operations, and guidance on creating tracebacks " "dynamically." msgstr "" -#: ../../library/types.rst:328 +#: ../../library/types.rst:332 msgid "" -"The type of :ref:`frame objects ` such as found in :attr:`tb." -"tb_frame ` if ``tb`` is a traceback object." +"The type of :ref:`frame objects ` such as found " +"in :attr:`tb.tb_frame ` if ``tb`` is a traceback object." msgstr "" -#: ../../library/types.rst:334 +#: ../../library/types.rst:338 msgid "" "The type of objects defined in extension modules with ``PyGetSetDef``, such " "as :attr:`FrameType.f_locals ` or ``array.array.typecode``. " @@ -454,7 +458,7 @@ msgid "" "modules." msgstr "" -#: ../../library/types.rst:343 +#: ../../library/types.rst:347 msgid "" "The type of objects defined in extension modules with ``PyMemberDef``, such " "as ``datetime.timedelta.days``. This type is used as descriptor for simple " @@ -463,7 +467,7 @@ msgid "" "modules." msgstr "" -#: ../../library/types.rst:348 +#: ../../library/types.rst:352 msgid "" "In addition, when a class is defined with a :attr:`~object.__slots__` " "attribute, then for each slot, an instance of :class:`!MemberDescriptorType` " @@ -471,114 +475,115 @@ msgid "" "in the class's :attr:`~type.__dict__`." msgstr "" -#: ../../library/types.rst:354 +#: ../../library/types.rst:358 msgid "" "In other implementations of Python, this type may be identical to " "``GetSetDescriptorType``." msgstr "" -#: ../../library/types.rst:359 +#: ../../library/types.rst:363 msgid "" "Read-only proxy of a mapping. It provides a dynamic view on the mapping's " "entries, which means that when the mapping changes, the view reflects these " "changes." msgstr "" -#: ../../library/types.rst:367 +#: ../../library/types.rst:371 msgid "" "Updated to support the new union (``|``) operator from :pep:`584`, which " "simply delegates to the underlying mapping." msgstr "" -#: ../../library/types.rst:372 +#: ../../library/types.rst:376 msgid "" "Return ``True`` if the underlying mapping has a key *key*, else ``False``." msgstr "" -#: ../../library/types.rst:377 +#: ../../library/types.rst:381 msgid "" -"Return the item of the underlying mapping with key *key*. Raises a :exc:" -"`KeyError` if *key* is not in the underlying mapping." +"Return the item of the underlying mapping with key *key*. Raises " +"a :exc:`KeyError` if *key* is not in the underlying mapping." msgstr "" -#: ../../library/types.rst:382 +#: ../../library/types.rst:386 msgid "" "Return an iterator over the keys of the underlying mapping. This is a " "shortcut for ``iter(proxy.keys())``." msgstr "" -#: ../../library/types.rst:387 +#: ../../library/types.rst:391 msgid "Return the number of items in the underlying mapping." msgstr "" -#: ../../library/types.rst:391 +#: ../../library/types.rst:395 msgid "Return a shallow copy of the underlying mapping." msgstr "" -#: ../../library/types.rst:395 +#: ../../library/types.rst:399 msgid "" "Return the value for *key* if *key* is in the underlying mapping, else " "*default*. If *default* is not given, it defaults to ``None``, so that this " "method never raises a :exc:`KeyError`." msgstr "" -#: ../../library/types.rst:401 +#: ../../library/types.rst:405 msgid "" "Return a new view of the underlying mapping's items (``(key, value)`` pairs)." msgstr "" -#: ../../library/types.rst:406 +#: ../../library/types.rst:410 msgid "Return a new view of the underlying mapping's keys." msgstr "" -#: ../../library/types.rst:410 +#: ../../library/types.rst:414 msgid "Return a new view of the underlying mapping's values." msgstr "" -#: ../../library/types.rst:414 +#: ../../library/types.rst:418 msgid "Return a reverse iterator over the keys of the underlying mapping." msgstr "" -#: ../../library/types.rst:420 +#: ../../library/types.rst:424 msgid "Return a hash of the underlying mapping." msgstr "" -#: ../../library/types.rst:426 +#: ../../library/types.rst:430 msgid "The type of :ref:`capsule objects `." msgstr "" -#: ../../library/types.rst:432 +#: ../../library/types.rst:436 msgid "Additional Utility Classes and Functions" msgstr "" -#: ../../library/types.rst:436 +#: ../../library/types.rst:440 msgid "" "A simple :class:`object` subclass that provides attribute access to its " "namespace, as well as a meaningful repr." msgstr "" -#: ../../library/types.rst:439 +#: ../../library/types.rst:443 msgid "" "Unlike :class:`object`, with :class:`!SimpleNamespace` you can add and " "remove attributes." msgstr "" -#: ../../library/types.rst:442 +#: ../../library/types.rst:446 msgid "" -":py:class:`SimpleNamespace` objects may be initialized in the same way as :" -"class:`dict`: either with keyword arguments, with a single positional " +":py:class:`SimpleNamespace` objects may be initialized in the same way " +"as :class:`dict`: either with keyword arguments, with a single positional " "argument, or with both. When initialized with keyword arguments, those are " "directly added to the underlying namespace. Alternatively, when initialized " "with a positional argument, the underlying namespace will be updated with " -"key-value pairs from that argument (either a mapping object or an :term:" -"`iterable` object producing key-value pairs). All such keys must be strings." +"key-value pairs from that argument (either a mapping object or " +"an :term:`iterable` object producing key-value pairs). All such keys must be " +"strings." msgstr "" -#: ../../library/types.rst:453 +#: ../../library/types.rst:457 msgid "The type is roughly equivalent to the following code::" msgstr "" -#: ../../library/types.rst:455 +#: ../../library/types.rst:459 msgid "" "class SimpleNamespace:\n" " def __init__(self, mapping_or_iterable=(), /, **kwargs):\n" @@ -610,33 +615,33 @@ msgstr "" " return self.__dict__ == other.__dict__\n" " return NotImplemented" -#: ../../library/types.rst:469 +#: ../../library/types.rst:473 msgid "" "``SimpleNamespace`` may be useful as a replacement for ``class NS: pass``. " "However, for a structured record type use :func:`~collections.namedtuple` " "instead." msgstr "" -#: ../../library/types.rst:473 +#: ../../library/types.rst:477 msgid "" ":class:`!SimpleNamespace` objects are supported by :func:`copy.replace`." msgstr "" -#: ../../library/types.rst:477 +#: ../../library/types.rst:481 msgid "" "Attribute order in the repr changed from alphabetical to insertion (like " "``dict``)." msgstr "" -#: ../../library/types.rst:481 +#: ../../library/types.rst:485 msgid "Added support for an optional positional argument." msgstr "" -#: ../../library/types.rst:486 +#: ../../library/types.rst:490 msgid "Route attribute access on a class to __getattr__." msgstr "" -#: ../../library/types.rst:488 +#: ../../library/types.rst:492 msgid "" "This is a descriptor, used to define attributes that act differently when " "accessed through an instance and through a class. Instance access remains " @@ -644,32 +649,32 @@ msgid "" "class's __getattr__ method; this is done by raising AttributeError." msgstr "" -#: ../../library/types.rst:493 +#: ../../library/types.rst:497 msgid "" "This allows one to have properties active on an instance, and have virtual " "attributes on the class with the same name (see :class:`enum.Enum` for an " "example)." msgstr "" -#: ../../library/types.rst:500 +#: ../../library/types.rst:504 msgid "Coroutine Utility Functions" msgstr "" -#: ../../library/types.rst:504 +#: ../../library/types.rst:508 msgid "" -"This function transforms a :term:`generator` function into a :term:" -"`coroutine function` which returns a generator-based coroutine. The " +"This function transforms a :term:`generator` function into " +"a :term:`coroutine function` which returns a generator-based coroutine. The " "generator-based coroutine is still a :term:`generator iterator`, but is also " "considered to be a :term:`coroutine` object and is :term:`awaitable`. " "However, it may not necessarily implement the :meth:`~object.__await__` " "method." msgstr "" -#: ../../library/types.rst:511 +#: ../../library/types.rst:515 msgid "If *gen_func* is a generator function, it will be modified in-place." msgstr "" -#: ../../library/types.rst:513 +#: ../../library/types.rst:517 msgid "" "If *gen_func* is not a generator function, it will be wrapped. If it returns " "an instance of :class:`collections.abc.Generator`, the instance will be " diff --git a/library/typing.po b/library/typing.po index 4d79f0b6981..acb94c3bf75 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-09 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-07-11 11:12+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,8 +55,8 @@ msgstr "" msgid "" "The function ``surface_area_of_cube`` takes an argument expected to be an " "instance of :class:`float`, as indicated by the :term:`type hint` " -"``edge_length: float``. The function is expected to return an instance of :" -"class:`str`, as indicated by the ``-> str`` hint." +"``edge_length: float``. The function is expected to return an instance " +"of :class:`str`, as indicated by the ``-> str`` hint." msgstr "" "函式 ``surface_area_of_cube`` 需要一個引數且預期是一個 :class:`float` 的實" "例,如 ``edge_length: float`` 所指出的\\ :term:`型別提示 `。這個函" @@ -73,17 +73,17 @@ msgstr "" #: ../../library/typing.rst:42 msgid "" -"New features are frequently added to the ``typing`` module. The :pypi:" -"`typing_extensions` package provides backports of these new features to " -"older versions of Python." +"New features are frequently added to the ``typing`` module. " +"The :pypi:`typing_extensions` package provides backports of these new " +"features to older versions of Python." msgstr "" "新功能會頻繁的新增至 ``typing`` 模組中。:pypi:`typing_extensions` 套件為這些" "新功能提供了 backport(向後移植的)版本,提供給舊版本的 Python 使用。" #: ../../library/typing.rst:48 msgid "" -"`Typing cheat sheet `_" +"`Typing cheat sheet `_" msgstr "" "`型別小抄 (Typing cheat sheet) `_" @@ -97,8 +97,8 @@ msgid "" "Type System Reference section of `the mypy docs `_" msgstr "" -"`mypy 文件 `_\\ 的 型別系" -"統參考資料 (Type System Reference) 章節" +"`mypy 文件 `_\\ 的 型別系統" +"參考資料 (Type System Reference) 章節" #: ../../library/typing.rst:52 msgid "" @@ -129,12 +129,11 @@ msgstr "Python 型別系統的技術規範" #: ../../library/typing.rst:66 msgid "" "The canonical, up-to-date specification of the Python type system can be " -"found at `Specification for the Python type system `_." +"found at `Specification for the Python type system `_." msgstr "" -"關於 Python 型別系統標準的 (canonical)、最新的技術規範可以在\\ `Python 型別" -"系統的技術規範 `_\\ 找" -"到。" +"關於 Python 型別系統標準的 (canonical)、最新的技術規範可以在\\ `Python 型別系" +"統的技術規範 `_\\ 找到。" #: ../../library/typing.rst:72 msgid "Type aliases" @@ -146,9 +145,9 @@ msgid "" "an instance of :class:`TypeAliasType`. In this example, ``Vector`` and " "``list[float]`` will be treated equivalently by static type checkers::" msgstr "" -"一個型別別名被定義來使用 :keyword:`type` 陳述式,其建立了 :class:" -"`TypeAliasType` 的實例。在這個範例中,``Vector`` 及 ``list[float]`` 會被當作" -"和靜態型別檢查器一樣同等對待: ::" +"一個型別別名被定義來使用 :keyword:`type` 陳述式,其建立" +"了 :class:`TypeAliasType` 的實例。在這個範例中,``Vector`` 及 " +"``list[float]`` 會被當作和靜態型別檢查器一樣同等對待: ::" #: ../../library/typing.rst:79 msgid "" @@ -380,18 +379,19 @@ msgstr "註釋 callable 物件" #: ../../library/typing.rst:210 msgid "" -"Functions -- or other :term:`callable` objects -- can be annotated using :" -"class:`collections.abc.Callable` or deprecated :data:`typing.Callable`. " -"``Callable[[int], str]`` signifies a function that takes a single parameter " -"of type :class:`int` and returns a :class:`str`." +"Functions -- or other :term:`callable` objects -- can be annotated " +"using :class:`collections.abc.Callable` or " +"deprecated :data:`typing.Callable`. ``Callable[[int], str]`` signifies a " +"function that takes a single parameter of type :class:`int` and returns " +"a :class:`str`." msgstr "" -"函式,或者是其他 :term:`callable` 物件,可以使用 :class:`collections.abc." -"Callable` 或以棄用的 :data:`typing.Callable` 進行註釋。 ``Callable[[int], " -"str]`` 象徵為一個函式,可以接受一個型別為 :class:`int` 的引數,並回傳一個 :" -"class:`str`。" +"函式,或者是其他 :term:`callable` 物件,可以使" +"用 :class:`collections.abc.Callable` 或以棄用的 :data:`typing.Callable` 進行" +"註釋。 ``Callable[[int], str]`` 象徵為一個函式,可以接受一個型別" +"為 :class:`int` 的引數,並回傳一個 :class:`str`。" -#: ../../library/typing.rst:215 ../../library/typing.rst:3161 -#: ../../library/typing.rst:3341 +#: ../../library/typing.rst:215 ../../library/typing.rst:3281 +#: ../../library/typing.rst:3461 msgid "For example:" msgstr "舉例來說:" @@ -452,8 +452,8 @@ msgid "" "``Callable`` cannot express complex signatures such as functions that take a " "variadic number of arguments, :ref:`overloaded functions `, or " "functions that have keyword-only parameters. However, these signatures can " -"be expressed by defining a :class:`Protocol` class with a :meth:`~object." -"__call__` method:" +"be expressed by defining a :class:`Protocol` class with " +"a :meth:`~object.__call__` method:" msgstr "" "``Callable`` 不如有可變數量引數的函式、:func:`overloaded functions " "`、或是僅限關鍵字參數的函式,可以表示複雜簽名。然而,這些簽名可以透" @@ -501,13 +501,13 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:285 ../../library/typing.rst:3831 +#: ../../library/typing.rst:285 ../../library/typing.rst:3965 msgid "" -"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" -"pep:`612` for more details." +"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. " +"See :pep:`612` for more details." msgstr "" -"``Callable`` 現已支援 :class:`ParamSpec` 以及 :data:`Concatenate`。請參閱 :" -"pep:`612` 閱讀詳細內容。" +"``Callable`` 現已支援 :class:`ParamSpec` 以及 :data:`Concatenate`。請參" +"閱 :pep:`612` 閱讀詳細內容。" #: ../../library/typing.rst:290 msgid "" @@ -612,9 +612,10 @@ msgstr "" #: ../../library/typing.rst:356 msgid "" ":class:`list` only accepts one type argument, so a type checker would emit " -"an error on the ``y`` assignment above. Similarly, :class:`~collections.abc." -"Mapping` only accepts two type arguments: the first indicates the type of " -"the keys, and the second indicates the type of the values." +"an error on the ``y`` assignment above. " +"Similarly, :class:`~collections.abc.Mapping` only accepts two type " +"arguments: the first indicates the type of the keys, and the second " +"indicates the type of the values." msgstr "" ":class:`list` 只接受一個型別引數,所以型別檢查器可能在上述 ``y`` 賦值 " "(assignment) 觸發錯誤。類似的範例,:class:`~collections.abc.Mapping` 只接受兩" @@ -625,8 +626,8 @@ msgstr "" msgid "" "Unlike most other Python containers, however, it is common in idiomatic " "Python code for tuples to have elements which are not all of the same type. " -"For this reason, tuples are special-cased in Python's typing system. :class:" -"`tuple` accepts *any number* of type arguments::" +"For this reason, tuples are special-cased in Python's typing " +"system. :class:`tuple` accepts *any number* of type arguments::" msgstr "" "然而,與其他多數的 Python 容器不同,在慣用的 (idiomatic) Python 程式碼中,元" "組可以擁有不完全相同型別的元素是相當常見的。為此,元組在 Python 的加註型別系" @@ -686,9 +687,10 @@ msgstr "類別物件的型別" #: ../../library/typing.rst:403 msgid "" "A variable annotated with ``C`` may accept a value of type ``C``. In " -"contrast, a variable annotated with ``type[C]`` (or deprecated :class:" -"`typing.Type[C] `) may accept values that are classes themselves -- " -"specifically, it will accept the *class object* of ``C``. For example::" +"contrast, a variable annotated with ``type[C]`` (or " +"deprecated :class:`typing.Type[C] `) may accept values that are " +"classes themselves -- specifically, it will accept the *class object* of " +"``C``. For example::" msgstr "" "一個變數被註釋為 ``C`` 可以接受一個型別為 ``C`` 的值。相對的,一個變數備註解" "為 ``type[C]`` \\ (或已棄用的 :class:`typing.Type[C] `)\\ 可以接受本" @@ -727,8 +729,9 @@ msgstr "" #: ../../library/typing.rst:429 msgid "" -"The only legal parameters for :class:`type` are classes, :data:`Any`, :ref:" -"`type variables `, and unions of any of these types. For example::" +"The only legal parameters for :class:`type` are " +"classes, :data:`Any`, :ref:`type variables `, and unions of any of " +"these types. For example::" msgstr "" ":class:`type` 僅有的合法參數是類別、:data:`Any`、:ref:`型別變數 " "`\\ 以及這些型別任意組合成的聯集。舉例來說: ::" @@ -746,8 +749,8 @@ msgstr "" #: ../../library/typing.rst:441 msgid "" -"``type[Any]`` is equivalent to :class:`type`, which is the root of Python's :" -"ref:`metaclass hierarchy `." +"``type[Any]`` is equivalent to :class:`type`, which is the root of " +"Python's :ref:`metaclass hierarchy `." msgstr "" "``type[Any]`` 等價於 :class:`type` ,其為 Python :ref:`metaclass 階層結構 " "(hierachy) `。" @@ -758,9 +761,9 @@ msgstr "" #: ../../library/typing.rst:450 msgid "" -"A generator can be annotated using the generic type :class:" -"`Generator[YieldType, SendType, ReturnType] `. " -"For example::" +"A generator can be annotated using the generic " +"type :class:`Generator[YieldType, SendType, ReturnType] " +"`. For example::" msgstr "" #: ../../library/typing.rst:454 @@ -811,8 +814,9 @@ msgstr "" #: ../../library/typing.rst:478 msgid "" "Simple generators that only ever yield values can also be annotated as " -"having a return type of either :class:`Iterable[YieldType] ` or :class:`Iterator[YieldType] `::" +"having a return type of either :class:`Iterable[YieldType] " +"` or :class:`Iterator[YieldType] " +"`::" msgstr "" #: ../../library/typing.rst:483 @@ -831,8 +835,8 @@ msgstr "" msgid "" "Async generators are handled in a similar fashion, but don't expect a " "``ReturnType`` type argument (:class:`AsyncGenerator[YieldType, SendType] " -"`). The ``SendType`` argument defaults to :" -"const:`!None`, so the following definitions are equivalent::" +"`). The ``SendType`` argument defaults " +"to :const:`!None`, so the following definitions are equivalent::" msgstr "" #: ../../library/typing.rst:494 @@ -859,9 +863,9 @@ msgstr "" #: ../../library/typing.rst:504 msgid "" -"As in the synchronous case, :class:`AsyncIterable[YieldType] ` and :class:`AsyncIterator[YieldType] ` are available as well::" +"As in the synchronous case, :class:`AsyncIterable[YieldType] " +"` and :class:`AsyncIterator[YieldType] " +"` are available as well::" msgstr "" #: ../../library/typing.rst:509 @@ -952,8 +956,8 @@ msgstr "" #: ../../library/typing.rst:557 msgid "" "Generic classes implicitly inherit from :class:`Generic`. For compatibility " -"with Python 3.11 and lower, it is also possible to inherit explicitly from :" -"class:`Generic` to indicate a generic class::" +"with Python 3.11 and lower, it is also possible to inherit explicitly " +"from :class:`Generic` to indicate a generic class::" msgstr "" "泛型類別隱性繼承了 :class:`Generic`。為了相容 Python 3.11 及更早版本,也可以" "明確的繼承 :class:`Generic` 並指出是一個泛型類別: ::" @@ -998,8 +1002,8 @@ msgstr "" #: ../../library/typing.rst:577 msgid "" -"A generic type can have any number of type variables. All varieties of :" -"class:`TypeVar` are permissible as parameters for a generic type::" +"A generic type can have any number of type variables. All varieties " +"of :class:`TypeVar` are permissible as parameters for a generic type::" msgstr "" "一個泛型型別可以有任意數量的型別變數。所有種類的 :class:`TypeVar` 都可以作為" "泛型型別的參數: ::" @@ -1178,9 +1182,9 @@ msgid "" "substitute a :class:`ParamSpec`::" msgstr "" "使用者定義的參數運算式 (parameter expression) 泛型一樣有支援,透過 ``[**P]`` " -"格式的參數規格變數來進行表示。對於上述作為參數規格變數的型別變數,將持續被 :" -"mod:`!typing` 模組視為一個特定的型別變數。對此,其中一個例外是一個型別列表可" -"以替代 :class:`ParamSpec`: ::" +"格式的參數規格變數來進行表示。對於上述作為參數規格變數的型別變數,將持續" +"被 :mod:`!typing` 模組視為一個特定的型別變數。對此,其中一個例外是一個型別列" +"表可以替代 :class:`ParamSpec`: ::" #: ../../library/typing.rst:671 msgid "" @@ -1258,11 +1262,11 @@ msgstr "" #: ../../library/typing.rst:703 msgid "" -":class:`Generic` can now be parameterized over parameter expressions. See :" -"class:`ParamSpec` and :pep:`612` for more details." +":class:`Generic` can now be parameterized over parameter expressions. " +"See :class:`ParamSpec` and :pep:`612` for more details." msgstr "" -":class:`Generic` 現在可以透過參數運算式來進行參數化。詳細內容請見 :class:" -"`ParamSpec` 以及 :pep:`612`。" +":class:`Generic` 現在可以透過參數運算式來進行參數化。詳細內容請" +"見 :class:`ParamSpec` 以及 :pep:`612`。" #: ../../library/typing.rst:707 msgid "" @@ -1285,8 +1289,8 @@ msgid "" "every type as being compatible with :data:`Any` and :data:`Any` as being " "compatible with every type." msgstr "" -":data:`Any` 是一種特別的型別。一個靜態型別檢查器會將每個型別視為可相容於 :" -"data:`Any` 且 :data:`Any` 也可以相容於每個型別。" +":data:`Any` 是一種特別的型別。一個靜態型別檢查器會將每個型別視為可相容" +"於 :data:`Any` 且 :data:`Any` 也可以相容於每個型別。" #: ../../library/typing.rst:720 msgid "" @@ -1316,11 +1320,11 @@ msgstr "" #: ../../library/typing.rst:738 msgid "" -"Notice that no type checking is performed when assigning a value of type :" -"data:`Any` to a more precise type. For example, the static type checker did " -"not report an error when assigning ``a`` to ``s`` even though ``s`` was " -"declared to be of type :class:`str` and receives an :class:`int` value at " -"runtime!" +"Notice that no type checking is performed when assigning a value of " +"type :data:`Any` to a more precise type. For example, the static type " +"checker did not report an error when assigning ``a`` to ``s`` even though " +"``s`` was declared to be of type :class:`str` and receives an :class:`int` " +"value at runtime!" msgstr "" "請注意,當賦予型別為 :data:`Any` 的值更精確的型別時,將不會執行任何型別檢查。" "舉例來說,靜態型別檢查器不會在 runtime 中,將 ``a`` 賦值給 ``s`` 的情況下回報" @@ -1361,8 +1365,8 @@ msgid "" "subtype of every other type." msgstr "" ":data:`Any` 的行為對比 :class:`object` 的行為。與 :data:`Any` 相似,所有的型" -"別會作為 :class:`object` 的子型別。然而,不像 :data:`Any`,反之不亦然::" -"class:`object` 並\\ *不是*\\一個其他型別的子型別。" +"別會作為 :class:`object` 的子型別。然而,不像 :data:`Any`,反之不亦" +"然::class:`object` 並\\ *不是*\\一個其他型別的子型別。" #: ../../library/typing.rst:765 msgid "" @@ -1419,16 +1423,16 @@ msgstr "" #: ../../library/typing.rst:798 msgid "" -"This requirement previously also applied to abstract base classes, such as :" -"class:`~collections.abc.Iterable`. The problem with this approach is that a " -"class had to be explicitly marked to support them, which is unpythonic and " -"unlike what one would normally do in idiomatic dynamically typed Python " -"code. For example, this conforms to :pep:`484`::" +"This requirement previously also applied to abstract base classes, such " +"as :class:`~collections.abc.Iterable`. The problem with this approach is " +"that a class had to be explicitly marked to support them, which is " +"unpythonic and unlike what one would normally do in idiomatic dynamically " +"typed Python code. For example, this conforms to :pep:`484`::" msgstr "" "這個需求之前也被運用在抽象基底類別,例如 :class:`~collections.abc.Iterable`。" "這種方式的問題在於,一個類別需要顯式的標記來支援他們,這並不符合 Python 風" -"格,也不像一個常見的慣用動態型別 Python 程式碼。舉例來說,下列程式碼符合 :" -"pep:`484`: ::" +"格,也不像一個常見的慣用動態型別 Python 程式碼。舉例來說,下列程式碼符" +"合 :pep:`484`: ::" #: ../../library/typing.rst:804 msgid "" @@ -1556,10 +1560,10 @@ msgstr "" "不可以將此兩種混合。" #: ../../library/typing.rst:868 ../../library/typing.rst:986 -#: ../../library/typing.rst:1043 ../../library/typing.rst:1215 -#: ../../library/typing.rst:1302 ../../library/typing.rst:1344 -#: ../../library/typing.rst:1553 ../../library/typing.rst:1614 -#: ../../library/typing.rst:3098 ../../library/typing.rst:3326 +#: ../../library/typing.rst:1043 ../../library/typing.rst:1223 +#: ../../library/typing.rst:1310 ../../library/typing.rst:1352 +#: ../../library/typing.rst:1561 ../../library/typing.rst:1622 +#: ../../library/typing.rst:3218 ../../library/typing.rst:3446 msgid "For example::" msgstr "舉例來說: ::" @@ -1575,9 +1579,10 @@ msgstr "" #: ../../library/typing.rst:877 msgid "" -"Note that, despite its name, ``AnyStr`` has nothing to do with the :class:" -"`Any` type, nor does it mean \"any string\". In particular, ``AnyStr`` and " -"``str | bytes`` are different from each other and have different use cases::" +"Note that, despite its name, ``AnyStr`` has nothing to do with " +"the :class:`Any` type, nor does it mean \"any string\". In particular, " +"``AnyStr`` and ``str | bytes`` are different from each other and have " +"different use cases::" msgstr "" "請注意,儘管他的名稱相近,``AnyStr`` 與 :class:`Any` 型別無關,更不代表是「任" "何字串」的意思。尤其,``AnyStr`` 與 ``str | bytes`` 兩者不同且具有不同的使用" @@ -1599,8 +1604,8 @@ msgstr "" #: ../../library/typing.rst:892 msgid "" "Deprecated in favor of the new :ref:`type parameter syntax `. " -"Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See :" -"pep:`695` for more details." +"Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. " +"See :pep:`695` for more details." msgstr "" #: ../../library/typing.rst:897 @@ -1626,7 +1631,7 @@ msgstr "" "此。然而,若是一個型別僅為 ``str`` 的物件則不相容。一個字串若是透過組合多個 " "``LiteralString`` 型別的物件建立,則此字串也可以視為 ``LiteralString``。" -#: ../../library/typing.rst:912 ../../library/typing.rst:2185 +#: ../../library/typing.rst:912 ../../library/typing.rst:2243 msgid "Example:" msgstr "舉例來說: ::" @@ -1662,16 +1667,16 @@ msgstr "更多細節請見 :pep:`675`。" #: ../../library/typing.rst:940 msgid "" -":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." +":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." msgstr "" ":data:`!Never` 和 :data:`!NoReturn` 表示\\ `底部型別 (bottom type) `_,為一個沒有任何成員的型別。" #: ../../library/typing.rst:944 msgid "" -"They can be used to indicate that a function never returns, such as :func:" -"`sys.exit`::" +"They can be used to indicate that a function never returns, such " +"as :func:`sys.exit`::" msgstr "它們可以被用來代表一個不會回傳的函式,像是 :func:`sys.exit`: ::" #: ../../library/typing.rst:947 @@ -1691,8 +1696,8 @@ msgid "" "Or to define a function that should never be called, as there are no valid " "arguments, such as :func:`assert_never`::" msgstr "" -"或被用來定義一個不應被呼叫的函式,因為不會有有效的引數,、像是 :func:" -"`assert_never`: ::" +"或被用來定義一個不應被呼叫的函式,因為不會有有效的引數,、像" +"是 :func:`assert_never`: ::" #: ../../library/typing.rst:956 msgid "" @@ -1877,17 +1882,17 @@ msgstr "更多細節請見 :pep:`613`。" msgid "" ":data:`TypeAlias` is deprecated in favor of the :keyword:`type` statement, " "which creates instances of :class:`TypeAliasType` and which natively " -"supports forward references. Note that while :data:`TypeAlias` and :class:" -"`TypeAliasType` serve similar purposes and have similar names, they are " -"distinct and the latter is not the type of the former. Removal of :data:" -"`TypeAlias` is not currently planned, but users are encouraged to migrate " -"to :keyword:`type` statements." -msgstr "" -":data:`TypeAlias` 被棄用,請改用 :keyword:`type` 陳述式來建立 :class:" -"`TypeAliasType` 的實例,其自然可以支援傳遞參照的使用。請注意,雖然 :data:" -"`TypeAlias` 以及 :class:`TypeAliasType` 提供相似的用途且具有相似的名稱,他們" -"是不同的,且後者不是前者的型別。現在還沒有移除 :data:`TypeAlias` 的計畫,但鼓" -"勵使用者們遷移 (migrate) 至 :keyword:`type` 陳述式。" +"supports forward references. Note that while :data:`TypeAlias` " +"and :class:`TypeAliasType` serve similar purposes and have similar names, " +"they are distinct and the latter is not the type of the former. Removal " +"of :data:`TypeAlias` is not currently planned, but users are encouraged to " +"migrate to :keyword:`type` statements." +msgstr "" +":data:`TypeAlias` 被棄用,請改用 :keyword:`type` 陳述式來建" +"立 :class:`TypeAliasType` 的實例,其自然可以支援傳遞參照的使用。請注意,雖" +"然 :data:`TypeAlias` 以及 :class:`TypeAliasType` 提供相似的用途且具有相似的名" +"稱,他們是不同的,且後者不是前者的型別。現在還沒有移除 :data:`TypeAlias` 的計" +"畫,但鼓勵使用者們遷移 (migrate) 至 :keyword:`type` 陳述式。" #: ../../library/typing.rst:1084 msgid "Special forms" @@ -1950,7 +1955,7 @@ msgstr "單一引數的聯集會消失不見,舉例來說: ::" msgid "Union[int] == int # The constructor actually returns int" msgstr "Union[int] == int # 實際上建構函式會回傳 int" -#: ../../library/typing.rst:1111 ../../library/typing.rst:1245 +#: ../../library/typing.rst:1111 ../../library/typing.rst:1253 msgid "Redundant arguments are skipped, e.g.::" msgstr "多餘的引數會被略過,舉例來說: ::" @@ -1985,11 +1990,20 @@ msgid "" msgstr "" "現在可以將聯集寫成 ``X | Y``。請見\\ :ref:`聯集型別運算式 `。" -#: ../../library/typing.rst:1132 +#: ../../library/typing.rst:1130 +msgid "" +":class:`types.UnionType` is now an alias for :class:`Union`, and both " +"``Union[int, str]`` and ``int | str`` create instances of the same class. To " +"check whether an object is a ``Union`` at runtime, use ``isinstance(obj, " +"Union)``. For compatibility with earlier versions of Python, use " +"``get_origin(obj) is typing.Union or get_origin(obj) is types.UnionType``." +msgstr "" + +#: ../../library/typing.rst:1140 msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)." msgstr "``Optional[X]`` 與 ``X | None`` 是相等的(或是 ``Union[X, None]``)。" -#: ../../library/typing.rst:1134 +#: ../../library/typing.rst:1142 msgid "" "Note that this is not the same concept as an optional argument, which is one " "that has a default. An optional argument with a default does not require " @@ -2000,7 +2014,7 @@ msgstr "" "有預設值的選擇性引數的型別註釋中不具有 ``Optional`` 限定符 (qualifier),單純" "的因為它就是選擇性的。舉例來說: ::" -#: ../../library/typing.rst:1139 +#: ../../library/typing.rst:1147 msgid "" "def foo(arg: int = 0) -> None:\n" " ..." @@ -2008,7 +2022,7 @@ msgstr "" "def foo(arg: int = 0) -> None:\n" " ..." -#: ../../library/typing.rst:1142 +#: ../../library/typing.rst:1150 msgid "" "On the other hand, if an explicit value of ``None`` is allowed, the use of " "``Optional`` is appropriate, whether the argument is optional or not. For " @@ -2017,7 +2031,7 @@ msgstr "" "另一方面,如果一個顯性的值 ``None`` 是被允許的,不論引數是不是選擇性的," "``Optional`` 都適用。舉例來說: ::" -#: ../../library/typing.rst:1146 +#: ../../library/typing.rst:1154 msgid "" "def foo(arg: Optional[int] = None) -> None:\n" " ..." @@ -2025,7 +2039,7 @@ msgstr "" "def foo(arg: Optional[int] = None) -> None:\n" " ..." -#: ../../library/typing.rst:1149 +#: ../../library/typing.rst:1157 msgid "" "Optional can now be written as ``X | None``. See :ref:`union type " "expressions`." @@ -2033,11 +2047,11 @@ msgstr "" "現在可以將 Optional 寫成 ``X | None``。請見\\ :ref:`聯集型別運算式 `。" -#: ../../library/typing.rst:1155 +#: ../../library/typing.rst:1163 msgid "Special form for annotating higher-order functions." msgstr "用於註釋高階函式的特別型式。" -#: ../../library/typing.rst:1157 +#: ../../library/typing.rst:1165 msgid "" "``Concatenate`` can be used in conjunction with :ref:`Callable ` and :class:`ParamSpec` to annotate a higher-order callable which " @@ -2047,23 +2061,23 @@ msgid "" "a :ref:`Callable `. The last parameter to " "``Concatenate`` must be a :class:`ParamSpec` or ellipsis (``...``)." msgstr "" -"``Concatenate`` 可以被用在\\ :ref:`可呼叫物件 `\\ 與 :" -"class:`ParamSpec` 的接合 (conjunction) 並註釋一個高階的 Callable 物件可以新" -"增、移除、轉換另一個 Callable 物件的參數。使用方法是依照這個格式 " +"``Concatenate`` 可以被用在\\ :ref:`可呼叫物件 `\\ " +"與 :class:`ParamSpec` 的接合 (conjunction) 並註釋一個高階的 Callable 物件可以" +"新增、移除、轉換另一個 Callable 物件的參數。使用方法是依照這個格式 " "``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``。``Concatenate`` " "目前只在 :ref:`Callable 物件 `\\ 中第一個引數使用時有" "效。``Concatenate`` 的最後一個參數必須為一個 :class:`ParamSpec` 或是刪節號 " "(``...``)。" -#: ../../library/typing.rst:1166 +#: ../../library/typing.rst:1174 msgid "" -"For example, to annotate a decorator ``with_lock`` which provides a :class:" -"`threading.Lock` to the decorated function, ``Concatenate`` can be used to " -"indicate that ``with_lock`` expects a callable which takes in a ``Lock`` as " -"the first argument, and returns a callable with a different type signature. " -"In this case, the :class:`ParamSpec` indicates that the returned callable's " -"parameter types are dependent on the parameter types of the callable being " -"passed in::" +"For example, to annotate a decorator ``with_lock`` which provides " +"a :class:`threading.Lock` to the decorated function, ``Concatenate`` can be " +"used to indicate that ``with_lock`` expects a callable which takes in a " +"``Lock`` as the first argument, and returns a callable with a different type " +"signature. In this case, the :class:`ParamSpec` indicates that the returned " +"callable's parameter types are dependent on the parameter types of the " +"callable being passed in::" msgstr "" "舉例來說,註釋一個為裝飾過後的函式提供 :class:`threading.Lock` 的裝飾器 " "``with_lock``,``Concatenate`` 可以用於指出 ``with_lock`` 預期一個 Callable " @@ -2071,7 +2085,7 @@ msgstr "" "Callable 物件。在這種情況下,:class:`ParamSpec` 指出回傳的 Callable 物件的參" "數型別會依賴傳遞的 Callable 物件的參數型別: ::" -#: ../../library/typing.rst:1174 +#: ../../library/typing.rst:1182 msgid "" "from collections.abc import Callable\n" "from threading import Lock\n" @@ -2099,32 +2113,32 @@ msgid "" "sum_threadsafe([1.1, 2.2, 3.3])" msgstr "" -#: ../../library/typing.rst:1202 ../../library/typing.rst:2153 +#: ../../library/typing.rst:1210 ../../library/typing.rst:2211 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)" msgstr ":pep:`612` -- 參數技術規範變數" -#: ../../library/typing.rst:1204 +#: ../../library/typing.rst:1212 msgid ":class:`ParamSpec`" msgstr ":class:`ParamSpec`" -#: ../../library/typing.rst:1205 ../../library/typing.rst:2156 +#: ../../library/typing.rst:1213 ../../library/typing.rst:2214 msgid ":ref:`annotating-callables`" msgstr ":ref:`annotating-callables`" -#: ../../library/typing.rst:1209 +#: ../../library/typing.rst:1217 msgid "Special typing form to define \"literal types\"." msgstr "特殊型別格式,用於定義「文本型別 (literal type)」。" -#: ../../library/typing.rst:1211 +#: ../../library/typing.rst:1219 msgid "" "``Literal`` can be used to indicate to type checkers that the annotated " "object has a value equivalent to one of the provided literals." msgstr "" "``Literal`` 可以用於型別檢查器並指出註釋物件具有一個與提供的文本相同的值。" -#: ../../library/typing.rst:1217 +#: ../../library/typing.rst:1225 msgid "" "def validate_simple(data: Any) -> Literal[True]: # always returns True\n" " ...\n" @@ -2137,7 +2151,7 @@ msgid "" "open_helper('/other/path', 'typo') # Error in type checker" msgstr "" -#: ../../library/typing.rst:1227 +#: ../../library/typing.rst:1235 msgid "" "``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is " "allowed as type argument to ``Literal[...]``, but type checkers may impose " @@ -2147,29 +2161,29 @@ msgstr "" "``Literal[...]`` 的型別引數,但型別檢查器可能會加強限制。更多有關文本型別的詳" "細資訊請看 :pep:`586`。" -#: ../../library/typing.rst:1231 +#: ../../library/typing.rst:1239 msgid "Additional details:" msgstr "其他細節:" -#: ../../library/typing.rst:1233 +#: ../../library/typing.rst:1241 msgid "The arguments must be literal values and there must be at least one." msgstr "引數必須為文本值且必須有至少一個。" -#: ../../library/typing.rst:1235 +#: ../../library/typing.rst:1243 msgid "Nested ``Literal`` types are flattened, e.g.::" msgstr "巢狀的 ``Literal`` 會是扁平化的 (flattened),舉例來說: ::" -#: ../../library/typing.rst:1237 +#: ../../library/typing.rst:1245 msgid "assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]" msgstr "assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]" -#: ../../library/typing.rst:1239 +#: ../../library/typing.rst:1247 msgid "" "However, this does not apply to ``Literal`` types referenced through a type " "alias, to avoid forcing evaluation of the underlying :class:`TypeAliasType`::" msgstr "" -#: ../../library/typing.rst:1242 +#: ../../library/typing.rst:1250 msgid "" "type A = Literal[1, 2]\n" "assert Literal[A, 3] != Literal[1, 2, 3]" @@ -2177,27 +2191,27 @@ msgstr "" "type A = Literal[1, 2]\n" "assert Literal[A, 3] != Literal[1, 2, 3]" -#: ../../library/typing.rst:1247 +#: ../../library/typing.rst:1255 msgid "assert Literal[1, 2, 1] == Literal[1, 2]" msgstr "assert Literal[1, 2, 1] == Literal[1, 2]" -#: ../../library/typing.rst:1249 +#: ../../library/typing.rst:1257 msgid "When comparing literals, the argument order is ignored, e.g.::" msgstr "當比較文本時,引數的順序會被忽略,舉例來說: ::" -#: ../../library/typing.rst:1251 +#: ../../library/typing.rst:1259 msgid "assert Literal[1, 2] == Literal[2, 1]" msgstr "assert Literal[1, 2] == Literal[2, 1]" -#: ../../library/typing.rst:1253 +#: ../../library/typing.rst:1261 msgid "You cannot subclass or instantiate a ``Literal``." msgstr "你不能建立 ``Literal`` 的子類別或是實例。" -#: ../../library/typing.rst:1255 +#: ../../library/typing.rst:1263 msgid "You cannot write ``Literal[X][Y]``." msgstr "你不能寫成 ``Literal[X][Y]``。" -#: ../../library/typing.rst:1259 +#: ../../library/typing.rst:1267 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " @@ -2208,11 +2222,11 @@ msgstr "" "比較不再依照相依性排序。``Literal`` 物件現在會在相等性比較期間,若任一個其中" "的參數無法 :term:`hashable` 時,則會引發一個 :exc:`TypeError` 例外。" -#: ../../library/typing.rst:1267 +#: ../../library/typing.rst:1275 msgid "Special type construct to mark class variables." msgstr "特殊型別建構,用來標記類別變數。" -#: ../../library/typing.rst:1269 +#: ../../library/typing.rst:1277 msgid "" "As introduced in :pep:`526`, a variable annotation wrapped in ClassVar " "indicates that a given attribute is intended to be used as a class variable " @@ -2222,7 +2236,7 @@ msgstr "" "定的屬性 (attribute) 意圖被當作類別變數使用,且不該被設定成該類別的實例。使用" "方法如下: ::" -#: ../../library/typing.rst:1273 +#: ../../library/typing.rst:1281 msgid "" "class Starship:\n" " stats: ClassVar[dict[str, int]] = {} # class variable\n" @@ -2232,38 +2246,39 @@ msgstr "" " stats: ClassVar[dict[str, int]] = {} # 類別變數\n" " damage: int = 10 # 實例變數" -#: ../../library/typing.rst:1277 +#: ../../library/typing.rst:1285 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr ":data:`ClassVar` 只接受型別請不得使用下標。" -#: ../../library/typing.rst:1279 +#: ../../library/typing.rst:1287 msgid "" -":data:`ClassVar` is not a class itself, and should not be used with :func:" -"`isinstance` or :func:`issubclass`. :data:`ClassVar` does not change Python " -"runtime behavior, but it can be used by third-party type checkers. For " -"example, a type checker might flag the following code as an error::" +":data:`ClassVar` is not a class itself, and should not be used " +"with :func:`isinstance` or :func:`issubclass`. :data:`ClassVar` does not " +"change Python runtime behavior, but it can be used by third-party type " +"checkers. For example, a type checker might flag the following code as an " +"error::" msgstr "" -":data:`ClassVar` 並不代表該類別本身,而且不應該和 :func:`isinstance` 或是 :" -"func:`issubclass` 一起使用。:data:`ClassVar` 不會改變 Python runtime 的行為," -"但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方的程" -"式碼為一個錯誤: ::" +":data:`ClassVar` 並不代表該類別本身,而且不應該和 :func:`isinstance` 或" +"是 :func:`issubclass` 一起使用。:data:`ClassVar` 不會改變 Python runtime 的行" +"為,但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方" +"的程式碼為一個錯誤: ::" -#: ../../library/typing.rst:1285 +#: ../../library/typing.rst:1293 msgid "" "enterprise_d = Starship(3000)\n" "enterprise_d.stats = {} # Error, setting class variable on instance\n" "Starship.stats = {} # This is OK" msgstr "" -#: ../../library/typing.rst:1293 +#: ../../library/typing.rst:1301 msgid ":data:`ClassVar` can now be nested in :data:`Final` and vice versa." msgstr "" -#: ../../library/typing.rst:1297 +#: ../../library/typing.rst:1305 msgid "Special typing construct to indicate final names to type checkers." msgstr "特殊型別建構,用來指出給型別檢查器的最終名稱。" -#: ../../library/typing.rst:1299 +#: ../../library/typing.rst:1307 msgid "" "Final names cannot be reassigned in any scope. Final names declared in class " "scopes cannot be overridden in subclasses." @@ -2271,7 +2286,7 @@ msgstr "" "最終名稱不可以在任何作用域 (scope) 中重新賦值。在類別作用域中宣告的最終名稱," "不得在子類別中進行覆寫 (override)。" -#: ../../library/typing.rst:1304 +#: ../../library/typing.rst:1312 msgid "" "MAX_SIZE: Final = 9000\n" "MAX_SIZE += 1 # Error reported by type checker\n" @@ -2283,46 +2298,46 @@ msgid "" " TIMEOUT = 1 # Error reported by type checker" msgstr "" -#: ../../library/typing.rst:1313 ../../library/typing.rst:3114 +#: ../../library/typing.rst:1321 ../../library/typing.rst:3234 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" "這些屬性 (property) 不會在 runtime 時進行檢查。更多詳細資訊請看 :pep:`591`。" -#: ../../library/typing.rst:1320 +#: ../../library/typing.rst:1328 msgid ":data:`Final` can now be nested in :data:`ClassVar` and vice versa." msgstr "" -#: ../../library/typing.rst:1324 +#: ../../library/typing.rst:1332 msgid "Special typing construct to mark a :class:`TypedDict` key as required." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是必須的。" -#: ../../library/typing.rst:1326 +#: ../../library/typing.rst:1334 msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." msgstr "" -"主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` 與 :" -"pep:`655`。" +"主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` " +"與 :pep:`655`。" -#: ../../library/typing.rst:1333 +#: ../../library/typing.rst:1341 msgid "" "Special typing construct to mark a :class:`TypedDict` key as potentially " "missing." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是可能消失的。" -#: ../../library/typing.rst:1336 +#: ../../library/typing.rst:1344 msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" -#: ../../library/typing.rst:1342 +#: ../../library/typing.rst:1350 msgid "" "A special typing construct to mark an item of a :class:`TypedDict` as read-" "only." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 的項目是唯讀的。" -#: ../../library/typing.rst:1346 +#: ../../library/typing.rst:1354 msgid "" "class Movie(TypedDict):\n" " title: ReadOnly[str]\n" @@ -2340,19 +2355,19 @@ msgstr "" " m[\"year\"] = 1999 # allowed\n" " m[\"title\"] = \"The Matrix\" # 型別檢查器錯誤" -#: ../../library/typing.rst:1354 +#: ../../library/typing.rst:1362 msgid "There is no runtime checking for this property." msgstr "這些屬性 (property) 不會在 runtime 時進行檢查。" -#: ../../library/typing.rst:1356 +#: ../../library/typing.rst:1364 msgid "See :class:`TypedDict` and :pep:`705` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`705`。" -#: ../../library/typing.rst:1362 +#: ../../library/typing.rst:1370 msgid "Special typing form to add context-specific metadata to an annotation." msgstr "" -#: ../../library/typing.rst:1364 +#: ../../library/typing.rst:1372 msgid "" "Add metadata ``x`` to a given type ``T`` by using the annotation " "``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by " @@ -2360,7 +2375,7 @@ msgid "" "a :attr:`!__metadata__` attribute." msgstr "" -#: ../../library/typing.rst:1369 +#: ../../library/typing.rst:1377 msgid "" "If a library or tool encounters an annotation ``Annotated[T, x]`` and has no " "special logic for the metadata, it should ignore the metadata and simply " @@ -2369,7 +2384,7 @@ msgid "" "system." msgstr "" -#: ../../library/typing.rst:1375 +#: ../../library/typing.rst:1383 msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " @@ -2379,7 +2394,7 @@ msgid "" "for a function or class." msgstr "" -#: ../../library/typing.rst:1382 +#: ../../library/typing.rst:1390 msgid "" "The responsibility of how to interpret the metadata lies with the tool or " "library encountering an ``Annotated`` annotation. A tool or library " @@ -2387,13 +2402,13 @@ msgid "" "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" -#: ../../library/typing.rst:1390 +#: ../../library/typing.rst:1398 msgid "" "Here is an example of how you might use ``Annotated`` to add metadata to " "type annotations if you were doing range analysis:" msgstr "" -#: ../../library/typing.rst:1393 +#: ../../library/typing.rst:1401 msgid "" "@dataclass\n" "class ValueRange:\n" @@ -2411,14 +2426,14 @@ msgstr "" "T1 = Annotated[int, ValueRange(-10, 5)]\n" "T2 = Annotated[T1, ValueRange(-20, 3)]" -#: ../../library/typing.rst:1403 +#: ../../library/typing.rst:1411 msgid "" "The first argument to ``Annotated`` must be a valid type. Multiple metadata " "elements can be supplied as ``Annotated`` supports variadic arguments. The " "order of the metadata elements is preserved and matters for equality checks::" msgstr "" -#: ../../library/typing.rst:1407 +#: ../../library/typing.rst:1415 msgid "" "@dataclass\n" "class ctype:\n" @@ -2438,20 +2453,20 @@ msgstr "" "\n" "assert a1 != a2 # 順序是有意義的" -#: ../../library/typing.rst:1416 +#: ../../library/typing.rst:1424 msgid "" "It is up to the tool consuming the annotations to decide whether the client " "is allowed to add multiple metadata elements to one annotation and how to " "merge those annotations." msgstr "" -#: ../../library/typing.rst:1420 +#: ../../library/typing.rst:1428 msgid "" "Nested ``Annotated`` types are flattened. The order of the metadata elements " "starts with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:1423 +#: ../../library/typing.rst:1431 msgid "" "assert Annotated[Annotated[int, ValueRange(3, 10)], ctype(\"char\")] == " "Annotated[\n" @@ -2463,14 +2478,14 @@ msgstr "" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" -#: ../../library/typing.rst:1427 +#: ../../library/typing.rst:1435 msgid "" "However, this does not apply to ``Annotated`` types referenced through a " -"type alias, to avoid forcing evaluation of the underlying :class:" -"`TypeAliasType`::" +"type alias, to avoid forcing evaluation of the " +"underlying :class:`TypeAliasType`::" msgstr "" -#: ../../library/typing.rst:1430 +#: ../../library/typing.rst:1438 msgid "" "type From3To10[T] = Annotated[T, ValueRange(3, 10)]\n" "assert Annotated[From3To10[int], ctype(\"char\")] != Annotated[\n" @@ -2482,11 +2497,11 @@ msgstr "" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" -#: ../../library/typing.rst:1435 +#: ../../library/typing.rst:1443 msgid "Duplicated metadata elements are not removed::" msgstr "" -#: ../../library/typing.rst:1437 +#: ../../library/typing.rst:1445 msgid "" "assert Annotated[int, ValueRange(3, 10)] != Annotated[\n" " int, ValueRange(3, 10), ValueRange(3, 10)\n" @@ -2496,11 +2511,11 @@ msgstr "" " int, ValueRange(3, 10), ValueRange(3, 10)\n" "]" -#: ../../library/typing.rst:1441 +#: ../../library/typing.rst:1449 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" -#: ../../library/typing.rst:1443 +#: ../../library/typing.rst:1451 msgid "" "@dataclass\n" "class MaxLen:\n" @@ -2514,11 +2529,11 @@ msgid "" "type V = Vec[int]" msgstr "" -#: ../../library/typing.rst:1455 +#: ../../library/typing.rst:1463 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" msgstr "" -#: ../../library/typing.rst:1457 +#: ../../library/typing.rst:1465 msgid "" "type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " "Ann1] # NOT valid" @@ -2526,19 +2541,19 @@ msgstr "" "type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " "Ann1] # 無效" -#: ../../library/typing.rst:1459 +#: ../../library/typing.rst:1467 msgid "" "where ``T1``, ``T2``, ... are :class:`TypeVars `. This is invalid " "as only one type should be passed to Annotated." msgstr "" -#: ../../library/typing.rst:1462 +#: ../../library/typing.rst:1470 msgid "" "By default, :func:`get_type_hints` strips the metadata from annotations. " "Pass ``include_extras=True`` to have the metadata preserved:" msgstr "" -#: ../../library/typing.rst:1465 +#: ../../library/typing.rst:1473 msgid "" ">>> from typing import Annotated, get_type_hints\n" ">>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n" @@ -2556,13 +2571,13 @@ msgstr "" ">>> get_type_hints(func, include_extras=True)\n" "{'x': typing.Annotated[int, 'metadata'], 'return': }" -#: ../../library/typing.rst:1475 +#: ../../library/typing.rst:1483 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: ../../library/typing.rst:1478 +#: ../../library/typing.rst:1486 msgid "" ">>> from typing import Annotated\n" ">>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n" @@ -2578,13 +2593,13 @@ msgstr "" ">>> X.__metadata__\n" "('very', 'important', 'metadata')" -#: ../../library/typing.rst:1487 +#: ../../library/typing.rst:1495 msgid "" -"If you want to retrieve the original type wrapped by ``Annotated``, use the :" -"attr:`!__origin__` attribute:" +"If you want to retrieve the original type wrapped by ``Annotated``, use " +"the :attr:`!__origin__` attribute:" msgstr "" -#: ../../library/typing.rst:1490 +#: ../../library/typing.rst:1498 msgid "" ">>> from typing import Annotated, get_origin\n" ">>> Password = Annotated[str, \"secret\"]\n" @@ -2596,11 +2611,11 @@ msgstr "" ">>> Password.__origin__\n" "" -#: ../../library/typing.rst:1497 +#: ../../library/typing.rst:1505 msgid "Note that using :func:`get_origin` will return ``Annotated`` itself:" msgstr "" -#: ../../library/typing.rst:1499 +#: ../../library/typing.rst:1507 msgid "" ">>> get_origin(Password)\n" "typing.Annotated" @@ -2608,20 +2623,20 @@ msgstr "" ">>> get_origin(Password)\n" "typing.Annotated" -#: ../../library/typing.rst:1506 +#: ../../library/typing.rst:1514 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:1507 +#: ../../library/typing.rst:1515 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1514 ../../library/typing.rst:1598 +#: ../../library/typing.rst:1522 ../../library/typing.rst:1606 msgid "" "Special typing construct for marking user-defined type predicate functions." msgstr "" -#: ../../library/typing.rst:1516 +#: ../../library/typing.rst:1524 msgid "" "``TypeIs`` can be used to annotate the return type of a user-defined type " "predicate function. ``TypeIs`` only accepts a single type argument. At " @@ -2629,7 +2644,7 @@ msgid "" "one positional argument." msgstr "" -#: ../../library/typing.rst:1521 +#: ../../library/typing.rst:1529 msgid "" "``TypeIs`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -2639,7 +2654,7 @@ msgid "" "predicate\"::" msgstr "" -#: ../../library/typing.rst:1527 +#: ../../library/typing.rst:1535 msgid "" "def is_str(val: str | float):\n" " # \"isinstance\" type predicate\n" @@ -2651,40 +2666,40 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1536 +#: ../../library/typing.rst:1544 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " -"type predicate. Such a function should use ``TypeIs[...]`` or :data:" -"`TypeGuard` as its return type to alert static type checkers to this " -"intention. ``TypeIs`` usually has more intuitive behavior than " +"type predicate. Such a function should use ``TypeIs[...]`` " +"or :data:`TypeGuard` as its return type to alert static type checkers to " +"this intention. ``TypeIs`` usually has more intuitive behavior than " "``TypeGuard``, but it cannot be used when the input and output types are " "incompatible (e.g., ``list[object]`` to ``list[int]``) or when the function " "does not return ``True`` for all instances of the narrowed type." msgstr "" -#: ../../library/typing.rst:1544 +#: ../../library/typing.rst:1552 msgid "" "Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " "given function:" msgstr "" -#: ../../library/typing.rst:1547 ../../library/typing.rst:1608 +#: ../../library/typing.rst:1555 ../../library/typing.rst:1616 msgid "The return value is a boolean." msgstr "回傳值是一個布林值。" -#: ../../library/typing.rst:1548 +#: ../../library/typing.rst:1556 msgid "" "If the return value is ``True``, the type of its argument is the " "intersection of the argument's original type and ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1550 +#: ../../library/typing.rst:1558 msgid "" "If the return value is ``False``, the type of its argument is narrowed to " "exclude ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1555 +#: ../../library/typing.rst:1563 msgid "" "from typing import assert_type, final, TypeIs\n" "\n" @@ -2708,7 +2723,7 @@ msgid "" " assert_type(arg, Unrelated)" msgstr "" -#: ../../library/typing.rst:1576 +#: ../../library/typing.rst:1584 msgid "" "The type inside ``TypeIs`` must be consistent with the type of the " "function's argument; if it is not, static type checkers will raise an " @@ -2717,27 +2732,27 @@ msgid "" "functions in a type-safe manner." msgstr "" -#: ../../library/typing.rst:1582 +#: ../../library/typing.rst:1590 msgid "" "If a ``TypeIs`` function is a class or instance method, then the type in " "``TypeIs`` maps to the type of the second parameter (after ``cls`` or " "``self``)." msgstr "" -#: ../../library/typing.rst:1586 +#: ../../library/typing.rst:1594 msgid "" "In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``, means that " "if ``foo(arg)`` returns ``True``, then ``arg`` is an instance of ``TypeB``, " "and if it returns ``False``, it is not an instance of ``TypeB``." msgstr "" -#: ../../library/typing.rst:1590 +#: ../../library/typing.rst:1598 msgid "" -"``TypeIs`` also works with type variables. For more information, see :pep:" -"`742` (Narrowing types with ``TypeIs``)." +"``TypeIs`` also works with type variables. For more information, " +"see :pep:`742` (Narrowing types with ``TypeIs``)." msgstr "" -#: ../../library/typing.rst:1600 +#: ../../library/typing.rst:1608 msgid "" "Type predicate functions are user-defined functions that return whether " "their argument is an instance of a particular type. ``TypeGuard`` works " @@ -2745,25 +2760,25 @@ msgid "" "checking behavior (see below)." msgstr "" -#: ../../library/typing.rst:1605 +#: ../../library/typing.rst:1613 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1609 +#: ../../library/typing.rst:1617 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1612 +#: ../../library/typing.rst:1620 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: ../../library/typing.rst:1616 +#: ../../library/typing.rst:1624 msgid "" "def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" " '''Determines whether all objects in the list are strings'''\n" @@ -2778,11 +2793,11 @@ msgid "" " print(\"Not a list of strings!\")" msgstr "" -#: ../../library/typing.rst:1628 +#: ../../library/typing.rst:1636 msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" msgstr "``TypeIs`` 和 ``TypeGuard`` 在以下幾個方面有所不同:" -#: ../../library/typing.rst:1630 +#: ../../library/typing.rst:1638 msgid "" "``TypeIs`` requires the narrowed type to be a subtype of the input type, " "while ``TypeGuard`` does not. The main reason is to allow for things like " @@ -2790,7 +2805,7 @@ msgid "" "subtype of the former, since ``list`` is invariant." msgstr "" -#: ../../library/typing.rst:1634 +#: ../../library/typing.rst:1642 msgid "" "When a ``TypeGuard`` function returns ``True``, type checkers narrow the " "type of the variable to exactly the ``TypeGuard`` type. When a ``TypeIs`` " @@ -2799,7 +2814,7 @@ msgid "" "type. (Technically, this is known as an intersection type.)" msgstr "" -#: ../../library/typing.rst:1638 +#: ../../library/typing.rst:1646 msgid "" "When a ``TypeGuard`` function returns ``False``, type checkers cannot narrow " "the type of the variable at all. When a ``TypeIs`` function returns " @@ -2807,18 +2822,18 @@ msgid "" "``TypeIs`` type." msgstr "" -#: ../../library/typing.rst:1647 +#: ../../library/typing.rst:1655 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1649 +#: ../../library/typing.rst:1657 msgid "" "For example, using the unpack operator ``*`` on a :ref:`type variable tuple " "` is equivalent to using ``Unpack`` to mark the type variable " "tuple as having been unpacked::" msgstr "" -#: ../../library/typing.rst:1653 +#: ../../library/typing.rst:1661 msgid "" "Ts = TypeVarTuple('Ts')\n" "tup: tuple[*Ts]\n" @@ -2826,7 +2841,7 @@ msgid "" "tup: tuple[Unpack[Ts]]" msgstr "" -#: ../../library/typing.rst:1658 +#: ../../library/typing.rst:1666 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -2834,7 +2849,7 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1664 +#: ../../library/typing.rst:1672 msgid "" "# In older versions of Python, TypeVarTuple and Unpack\n" "# are located in the `typing_extensions` backports package.\n" @@ -2845,13 +2860,13 @@ msgid "" "tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" msgstr "" -#: ../../library/typing.rst:1672 +#: ../../library/typing.rst:1680 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" -#: ../../library/typing.rst:1675 +#: ../../library/typing.rst:1683 msgid "" "from typing import TypedDict, Unpack\n" "\n" @@ -2864,23 +2879,23 @@ msgid "" "def foo(**kwargs: Unpack[Movie]): ..." msgstr "" -#: ../../library/typing.rst:1685 +#: ../../library/typing.rst:1693 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" -#: ../../library/typing.rst:1690 +#: ../../library/typing.rst:1698 msgid "Building generic types and type aliases" msgstr "" -#: ../../library/typing.rst:1692 +#: ../../library/typing.rst:1700 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types and " "type aliases." msgstr "" -#: ../../library/typing.rst:1696 +#: ../../library/typing.rst:1704 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " @@ -2888,17 +2903,17 @@ msgid "" "syntax, as documented below." msgstr "" -#: ../../library/typing.rst:1703 +#: ../../library/typing.rst:1711 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1705 +#: ../../library/typing.rst:1713 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" -#: ../../library/typing.rst:1708 +#: ../../library/typing.rst:1716 msgid "" "class Mapping[KT, VT]:\n" " def __getitem__(self, key: KT) -> VT:\n" @@ -2910,17 +2925,17 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1713 +#: ../../library/typing.rst:1721 msgid "" "Such a class implicitly inherits from ``Generic``. The runtime semantics of " "this syntax are discussed in the :ref:`Language Reference `." msgstr "" -#: ../../library/typing.rst:1717 +#: ../../library/typing.rst:1725 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1719 +#: ../../library/typing.rst:1727 msgid "" "def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" " try:\n" @@ -2934,20 +2949,20 @@ msgstr "" " except KeyError:\n" " return default" -#: ../../library/typing.rst:1725 +#: ../../library/typing.rst:1733 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -#: ../../library/typing.rst:1728 +#: ../../library/typing.rst:1736 msgid "" "For backwards compatibility, generic classes can also be declared by " "explicitly inheriting from ``Generic``. In this case, the type parameters " "must be declared separately::" msgstr "" -#: ../../library/typing.rst:1733 +#: ../../library/typing.rst:1741 msgid "" "KT = TypeVar('KT')\n" "VT = TypeVar('VT')\n" @@ -2965,18 +2980,18 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1745 +#: ../../library/typing.rst:1753 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1747 +#: ../../library/typing.rst:1755 msgid "" "The preferred way to construct a type variable is via the dedicated syntax " "for :ref:`generic functions `, :ref:`generic classes " "`, and :ref:`generic type aliases `::" msgstr "" -#: ../../library/typing.rst:1752 +#: ../../library/typing.rst:1760 msgid "" "class Sequence[T]: # T is a TypeVar\n" " ..." @@ -2984,13 +2999,13 @@ msgstr "" "class Sequence[T]: # T 是一個 TypeVar\n" " ..." -#: ../../library/typing.rst:1755 +#: ../../library/typing.rst:1763 msgid "" "This syntax can also be used to create bounded and constrained type " "variables::" msgstr "" -#: ../../library/typing.rst:1758 +#: ../../library/typing.rst:1766 msgid "" "class StrSequence[S: str]: # S is a TypeVar with a `str` upper bound;\n" " ... # we can say that S is \"bounded by `str`\"\n" @@ -3001,13 +3016,13 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1765 +#: ../../library/typing.rst:1773 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" -#: ../../library/typing.rst:1767 +#: ../../library/typing.rst:1775 msgid "" "T = TypeVar('T') # Can be anything\n" "S = TypeVar('S', bound=str) # Can be any subtype of str\n" @@ -3017,7 +3032,7 @@ msgstr "" "S = TypeVar('S', bound=str) # 可以是任何 str 的子型別\n" "A = TypeVar('A', str, bytes) # 必須是 str 或 bytes" -#: ../../library/typing.rst:1771 +#: ../../library/typing.rst:1779 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -3025,7 +3040,7 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1777 +#: ../../library/typing.rst:1785 msgid "" "def repeat[T](x: T, n: int) -> Sequence[T]:\n" " \"\"\"Return a list containing n references to x.\"\"\"\n" @@ -3043,13 +3058,13 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:1792 +#: ../../library/typing.rst:1800 msgid "" "Note that type variables can be *bounded*, *constrained*, or neither, but " "cannot be both bounded *and* constrained." msgstr "" -#: ../../library/typing.rst:1795 +#: ../../library/typing.rst:1803 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -3059,14 +3074,14 @@ msgid "" "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" -#: ../../library/typing.rst:1803 +#: ../../library/typing.rst:1811 msgid "" "Bounded type variables and constrained type variables have different " "semantics in several important ways. Using a *bounded* type variable means " "that the ``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1807 +#: ../../library/typing.rst:1815 msgid "" "x = print_capitalized('a string')\n" "reveal_type(x) # revealed type is str\n" @@ -3080,13 +3095,13 @@ msgid "" "z = print_capitalized(45) # error: int is not a subtype of str" msgstr "" -#: ../../library/typing.rst:1818 +#: ../../library/typing.rst:1826 msgid "" "The upper bound of a type variable can be a concrete type, abstract type " "(ABC or Protocol), or even a union of types::" msgstr "" -#: ../../library/typing.rst:1821 +#: ../../library/typing.rst:1829 msgid "" "# Can be anything with an __abs__ method\n" "def print_abs[T: SupportsAbs](arg: T) -> None:\n" @@ -3097,13 +3112,13 @@ msgid "" "V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" -#: ../../library/typing.rst:1830 +#: ../../library/typing.rst:1838 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" -#: ../../library/typing.rst:1833 +#: ../../library/typing.rst:1841 msgid "" "a = concatenate('one', 'two')\n" "reveal_type(a) # revealed type is str\n" @@ -3116,88 +3131,120 @@ msgid "" "or bytes in a function call, but not both" msgstr "" -#: ../../library/typing.rst:1841 +#: ../../library/typing.rst:1849 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "在 runtime ``isinstance(x, T)`` 會引發 :exc:`TypeError`。" -#: ../../library/typing.rst:1845 +#: ../../library/typing.rst:1853 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1849 +#: ../../library/typing.rst:1857 msgid "Whether the type var has been explicitly marked as covariant." msgstr "" -#: ../../library/typing.rst:1853 +#: ../../library/typing.rst:1861 msgid "Whether the type var has been explicitly marked as contravariant." msgstr "" -#: ../../library/typing.rst:1857 +#: ../../library/typing.rst:1865 msgid "" "Whether the type variable's variance should be inferred by type checkers." msgstr "" -#: ../../library/typing.rst:1863 +#: ../../library/typing.rst:1871 msgid "The upper bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1867 +#: ../../library/typing.rst:1875 msgid "" "For type variables created through :ref:`type parameter syntax `, the bound is evaluated only when the attribute is accessed, not " "when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1873 +#: ../../library/typing.rst:1881 +msgid "" +"An :term:`evaluate function` corresponding to the :attr:`~TypeVar.__bound__` " +"attribute. When called directly, this method supports only " +"the :attr:`~annotationlib.Format.VALUE` format, which is equivalent to " +"accessing the :attr:`~TypeVar.__bound__` attribute directly, but the method " +"object can be passed to :func:`annotationlib.call_evaluate_function` to " +"evaluate the value in a different format." +msgstr "" + +#: ../../library/typing.rst:1891 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1877 +#: ../../library/typing.rst:1895 msgid "" "For type variables created through :ref:`type parameter syntax `, the constraints are evaluated only when the attribute is accessed, " "not when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1883 +#: ../../library/typing.rst:1901 +msgid "" +"An :term:`evaluate function` corresponding to " +"the :attr:`~TypeVar.__constraints__` attribute. When called directly, this " +"method supports only the :attr:`~annotationlib.Format.VALUE` format, which " +"is equivalent to accessing the :attr:`~TypeVar.__constraints__` attribute " +"directly, but the method object can be passed " +"to :func:`annotationlib.call_evaluate_function` to evaluate the value in a " +"different format." +msgstr "" + +#: ../../library/typing.rst:1911 msgid "" "The default value of the type variable, or :data:`typing.NoDefault` if it " "has no default." msgstr "" -#: ../../library/typing.rst:1890 +#: ../../library/typing.rst:1918 +msgid "" +"An :term:`evaluate function` corresponding to " +"the :attr:`~TypeVar.__default__` attribute. When called directly, this " +"method supports only the :attr:`~annotationlib.Format.VALUE` format, which " +"is equivalent to accessing the :attr:`~TypeVar.__default__` attribute " +"directly, but the method object can be passed " +"to :func:`annotationlib.call_evaluate_function` to evaluate the value in a " +"different format." +msgstr "" + +#: ../../library/typing.rst:1928 msgid "" "Return whether or not the type variable has a default value. This is " -"equivalent to checking whether :attr:`__default__` is not the :data:`typing." -"NoDefault` singleton, except that it does not force evaluation of the :ref:" -"`lazily evaluated ` default value." +"equivalent to checking whether :attr:`__default__` is not " +"the :data:`typing.NoDefault` singleton, except that it does not force " +"evaluation of the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:1899 +#: ../../library/typing.rst:1937 msgid "" "Type variables can now be declared using the :ref:`type parameter ` syntax introduced by :pep:`695`. The ``infer_variance`` parameter " "was added." msgstr "" -#: ../../library/typing.rst:1905 ../../library/typing.rst:2044 -#: ../../library/typing.rst:2146 +#: ../../library/typing.rst:1943 ../../library/typing.rst:2092 +#: ../../library/typing.rst:2204 msgid "Support for default values was added." msgstr "新增對預設值的支援。" -#: ../../library/typing.rst:1911 +#: ../../library/typing.rst:1949 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1914 +#: ../../library/typing.rst:1952 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" -#: ../../library/typing.rst:1917 +#: ../../library/typing.rst:1955 msgid "" "def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " "T]:\n" @@ -3207,11 +3254,11 @@ msgstr "" "T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1920 +#: ../../library/typing.rst:1958 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" msgstr "" -#: ../../library/typing.rst:1922 +#: ../../library/typing.rst:1960 msgid "" "T = TypeVar(\"T\")\n" "Ts = TypeVarTuple(\"Ts\")\n" @@ -3225,7 +3272,7 @@ msgstr "" "def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1928 +#: ../../library/typing.rst:1966 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -3233,7 +3280,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1933 +#: ../../library/typing.rst:1971 msgid "" "# T is bound to int, Ts is bound to ()\n" "# Return value is (1,), which has type tuple[int]\n" @@ -3253,7 +3300,7 @@ msgid "" "move_first_element_to_last(tup=())" msgstr "" -#: ../../library/typing.rst:1950 +#: ../../library/typing.rst:1988 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -3263,13 +3310,13 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:1958 +#: ../../library/typing.rst:1996 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:1961 +#: ../../library/typing.rst:1999 msgid "" "x: Ts # Not valid\n" "x: tuple[Ts] # Not valid\n" @@ -3279,13 +3326,13 @@ msgstr "" "x: tuple[Ts] # 無效\n" "x: tuple[*Ts] # 正確的做法" -#: ../../library/typing.rst:1965 +#: ../../library/typing.rst:2003 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" -#: ../../library/typing.rst:1968 +#: ../../library/typing.rst:2006 msgid "" "class Array[*Shape]:\n" " def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" @@ -3297,12 +3344,12 @@ msgstr "" " def __abs__(self) -> \"Array[*Shape]\": ...\n" " def get_shape(self) -> tuple[*Shape]: ..." -#: ../../library/typing.rst:1973 +#: ../../library/typing.rst:2011 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:1975 +#: ../../library/typing.rst:2013 msgid "" "class Array[DType, *Shape]: # This is fine\n" " pass\n" @@ -3317,13 +3364,13 @@ msgid "" "int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" msgstr "" -#: ../../library/typing.rst:1989 +#: ../../library/typing.rst:2027 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" -#: ../../library/typing.rst:1992 +#: ../../library/typing.rst:2030 msgid "" "x: tuple[*Ts, *Ts] # Not valid\n" "class Array[*Shape, *Shape]: # Not valid\n" @@ -3333,13 +3380,13 @@ msgstr "" "class Array[*Shape, *Shape]: # 無效\n" " pass" -#: ../../library/typing.rst:1996 +#: ../../library/typing.rst:2034 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:1999 +#: ../../library/typing.rst:2037 msgid "" "def call_soon[*Ts](\n" " callback: Callable[[*Ts], None],\n" @@ -3355,7 +3402,7 @@ msgstr "" " ...\n" " callback(*args)" -#: ../../library/typing.rst:2006 +#: ../../library/typing.rst:2044 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -3364,61 +3411,72 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:2013 +#: ../../library/typing.rst:2051 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:2017 +#: ../../library/typing.rst:2055 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:2021 +#: ../../library/typing.rst:2059 msgid "" "The default value of the type variable tuple, or :data:`typing.NoDefault` if " "it has no default." msgstr "" -#: ../../library/typing.rst:2028 +#: ../../library/typing.rst:2066 +msgid "" +"An :term:`evaluate function` corresponding to " +"the :attr:`~TypeVarTuple.__default__` attribute. When called directly, this " +"method supports only the :attr:`~annotationlib.Format.VALUE` format, which " +"is equivalent to accessing the :attr:`~TypeVarTuple.__default__` attribute " +"directly, but the method object can be passed " +"to :func:`annotationlib.call_evaluate_function` to evaluate the value in a " +"different format." +msgstr "" + +#: ../../library/typing.rst:2076 msgid "" "Return whether or not the type variable tuple has a default value. This is " -"equivalent to checking whether :attr:`__default__` is not the :data:`typing." -"NoDefault` singleton, except that it does not force evaluation of the :ref:" -"`lazily evaluated ` default value." +"equivalent to checking whether :attr:`__default__` is not " +"the :data:`typing.NoDefault` singleton, except that it does not force " +"evaluation of the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2039 +#: ../../library/typing.rst:2087 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2048 +#: ../../library/typing.rst:2096 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -#: ../../library/typing.rst:2051 +#: ../../library/typing.rst:2099 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" -#: ../../library/typing.rst:2054 +#: ../../library/typing.rst:2102 msgid "type IntFunc[**P] = Callable[P, int]" msgstr "type IntFunc[**P] = Callable[P, int]" -#: ../../library/typing.rst:2056 +#: ../../library/typing.rst:2104 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" -#: ../../library/typing.rst:2059 +#: ../../library/typing.rst:2107 msgid "P = ParamSpec('P')" msgstr "P = ParamSpec('P')" -#: ../../library/typing.rst:2061 +#: ../../library/typing.rst:2109 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -3428,7 +3486,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:2068 +#: ../../library/typing.rst:2116 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -3436,7 +3494,7 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:2073 +#: ../../library/typing.rst:2121 msgid "" "from collections.abc import Callable\n" "import logging\n" @@ -3454,97 +3512,109 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:2088 +#: ../../library/typing.rst:2136 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However " "this causes two problems:" msgstr "" -#: ../../library/typing.rst:2092 +#: ../../library/typing.rst:2140 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: ../../library/typing.rst:2094 +#: ../../library/typing.rst:2142 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: ../../library/typing.rst:2101 +#: ../../library/typing.rst:2149 msgid "" -"Since ``ParamSpec`` captures both positional and keyword parameters, ``P." -"args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " +"Since ``ParamSpec`` captures both positional and keyword parameters, " +"``P.args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " "components. ``P.args`` represents the tuple of positional parameters in a " "given call and should only be used to annotate ``*args``. ``P.kwargs`` " "represents the mapping of keyword parameters to their values in a given " "call, and should be only be used to annotate ``**kwargs``. Both attributes " "require the annotated parameter to be in scope. At runtime, ``P.args`` and " -"``P.kwargs`` are instances respectively of :class:`ParamSpecArgs` and :class:" -"`ParamSpecKwargs`." +"``P.kwargs`` are instances respectively of :class:`ParamSpecArgs` " +"and :class:`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:2113 +#: ../../library/typing.rst:2161 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:2117 +#: ../../library/typing.rst:2165 msgid "" -"The default value of the parameter specification, or :data:`typing." -"NoDefault` if it has no default." +"The default value of the parameter specification, " +"or :data:`typing.NoDefault` if it has no default." msgstr "" -#: ../../library/typing.rst:2124 +#: ../../library/typing.rst:2172 +msgid "" +"An :term:`evaluate function` corresponding to " +"the :attr:`~ParamSpec.__default__` attribute. When called directly, this " +"method supports only the :attr:`~annotationlib.Format.VALUE` format, which " +"is equivalent to accessing the :attr:`~ParamSpec.__default__` attribute " +"directly, but the method object can be passed " +"to :func:`annotationlib.call_evaluate_function` to evaluate the value in a " +"different format." +msgstr "" + +#: ../../library/typing.rst:2182 msgid "" "Return whether or not the parameter specification has a default value. This " -"is equivalent to checking whether :attr:`__default__` is not the :data:" -"`typing.NoDefault` singleton, except that it does not force evaluation of " -"the :ref:`lazily evaluated ` default value." +"is equivalent to checking whether :attr:`__default__` is not " +"the :data:`typing.NoDefault` singleton, except that it does not force " +"evaluation of the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2131 +#: ../../library/typing.rst:2189 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " -"generic types. The ``bound`` argument is also accepted, similar to :class:" -"`TypeVar`. However the actual semantics of these keywords are yet to be " -"decided." +"generic types. The ``bound`` argument is also accepted, similar " +"to :class:`TypeVar`. However the actual semantics of these keywords are yet " +"to be decided." msgstr "" -#: ../../library/typing.rst:2141 +#: ../../library/typing.rst:2199 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2149 +#: ../../library/typing.rst:2207 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:2155 +#: ../../library/typing.rst:2213 msgid ":data:`Concatenate`" msgstr ":data:`Concatenate`" -#: ../../library/typing.rst:2161 +#: ../../library/typing.rst:2219 msgid "" -"Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." -"args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " -"``P.kwargs`` is an instance of ``ParamSpecKwargs``. They are intended for " -"runtime introspection and have no special meaning to static type checkers." +"Arguments and keyword arguments attributes of a :class:`ParamSpec`. The " +"``P.args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, " +"and ``P.kwargs`` is an instance of ``ParamSpecKwargs``. They are intended " +"for runtime introspection and have no special meaning to static type " +"checkers." msgstr "" -#: ../../library/typing.rst:2166 +#: ../../library/typing.rst:2224 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:2169 +#: ../../library/typing.rst:2227 msgid "" ">>> from typing import ParamSpec, get_origin\n" ">>> P = ParamSpec(\"P\")\n" @@ -3560,11 +3630,11 @@ msgstr "" ">>> get_origin(P.kwargs) is P\n" "True" -#: ../../library/typing.rst:2183 +#: ../../library/typing.rst:2241 msgid "The type of type aliases created through the :keyword:`type` statement." msgstr "" -#: ../../library/typing.rst:2187 +#: ../../library/typing.rst:2245 msgid "" ">>> type Alias = int\n" ">>> type(Alias)\n" @@ -3574,11 +3644,11 @@ msgstr "" ">>> type(Alias)\n" "" -#: ../../library/typing.rst:2197 +#: ../../library/typing.rst:2255 msgid "The name of the type alias:" msgstr "" -#: ../../library/typing.rst:2199 +#: ../../library/typing.rst:2257 msgid "" ">>> type Alias = int\n" ">>> Alias.__name__\n" @@ -3588,11 +3658,11 @@ msgstr "" ">>> Alias.__name__\n" "'Alias'" -#: ../../library/typing.rst:2207 +#: ../../library/typing.rst:2265 msgid "The module in which the type alias was defined::" msgstr "" -#: ../../library/typing.rst:2209 +#: ../../library/typing.rst:2267 msgid "" ">>> type Alias = int\n" ">>> Alias.__module__\n" @@ -3602,13 +3672,13 @@ msgstr "" ">>> Alias.__module__\n" "'__main__'" -#: ../../library/typing.rst:2215 +#: ../../library/typing.rst:2273 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" -#: ../../library/typing.rst:2218 +#: ../../library/typing.rst:2276 msgid "" ">>> type ListOrSet[T] = list[T] | set[T]\n" ">>> ListOrSet.__type_params__\n" @@ -3624,14 +3694,14 @@ msgstr "" ">>> NotGeneric.__type_params__\n" "()" -#: ../../library/typing.rst:2229 +#: ../../library/typing.rst:2287 msgid "" "The type alias's value. This is :ref:`lazily evaluated `, " "so names used in the definition of the alias are not resolved until the " "``__value__`` attribute is accessed:" msgstr "" -#: ../../library/typing.rst:2233 +#: ../../library/typing.rst:2291 msgid "" ">>> type Mutually = Recursive\n" ">>> type Recursive = Mutually\n" @@ -3655,27 +3725,71 @@ msgstr "" ">>> Recursive.__value__\n" "Mutually" -#: ../../library/typing.rst:2247 +#: ../../library/typing.rst:2306 +msgid "" +"An :term:`evaluate function` corresponding to the :attr:`__value__` " +"attribute. When called directly, this method supports only " +"the :attr:`~annotationlib.Format.VALUE` format, which is equivalent to " +"accessing the :attr:`__value__` attribute directly, but the method object " +"can be passed to :func:`annotationlib.call_evaluate_function` to evaluate " +"the value in a different format:" +msgstr "" + +#: ../../library/typing.rst:2312 +msgid "" +">>> type Alias = undefined\n" +">>> Alias.__value__\n" +"Traceback (most recent call last):\n" +"...\n" +"NameError: name 'undefined' is not defined\n" +">>> from annotationlib import Format, call_evaluate_function\n" +">>> Alias.evaluate_value(Format.VALUE)\n" +"Traceback (most recent call last):\n" +"...\n" +"NameError: name 'undefined' is not defined\n" +">>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)\n" +"ForwardRef('undefined')" +msgstr "" + +#: ../../library/typing.rst:2330 +msgid "Unpacking" +msgstr "" + +#: ../../library/typing.rst:2331 +msgid "" +"Type aliases support star unpacking using the ``*Alias`` syntax. This is " +"equivalent to using ``Unpack[Alias]`` directly:" +msgstr "" + +#: ../../library/typing.rst:2334 +msgid "" +">>> type Alias = tuple[int, str]\n" +">>> type Unpacked = tuple[bool, *Alias]\n" +">>> Unpacked.__value__\n" +"tuple[bool, typing.Unpack[Alias]]" +msgstr "" + +#: ../../library/typing.rst:2345 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:2249 +#: ../../library/typing.rst:2347 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" -#: ../../library/typing.rst:2255 +#: ../../library/typing.rst:2353 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:2257 ../../library/typing.rst:2349 -#: ../../library/typing.rst:3397 +#: ../../library/typing.rst:2355 ../../library/typing.rst:2451 +#: ../../library/typing.rst:3545 msgid "Usage::" msgstr "用法: ::" -#: ../../library/typing.rst:2259 +#: ../../library/typing.rst:2357 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3685,20 +3799,20 @@ msgstr "" " name: str\n" " id: int" -#: ../../library/typing.rst:2263 +#: ../../library/typing.rst:2361 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../library/typing.rst:2265 +#: ../../library/typing.rst:2363 msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" msgstr "Employee = collections.namedtuple('Employee', ['name', 'id'])" -#: ../../library/typing.rst:2267 +#: ../../library/typing.rst:2365 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:2269 +#: ../../library/typing.rst:2367 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3714,12 +3828,12 @@ msgstr "" "employee = Employee('Guido')\n" "assert employee.id == 3" -#: ../../library/typing.rst:2276 +#: ../../library/typing.rst:2374 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:2278 +#: ../../library/typing.rst:2376 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -3728,11 +3842,11 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:2284 +#: ../../library/typing.rst:2382 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:2286 +#: ../../library/typing.rst:2384 msgid "" "class Employee(NamedTuple):\n" " \"\"\"Represents an employee.\"\"\"\n" @@ -3743,11 +3857,11 @@ msgid "" " return f''" msgstr "" -#: ../../library/typing.rst:2294 +#: ../../library/typing.rst:2392 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:2296 +#: ../../library/typing.rst:2394 msgid "" "class Group[T](NamedTuple):\n" " key: T\n" @@ -3757,11 +3871,11 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2300 +#: ../../library/typing.rst:2398 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:2302 +#: ../../library/typing.rst:2400 msgid "" "# For creating a generic NamedTuple on Python 3.11\n" "T = TypeVar(\"T\")\n" @@ -3774,38 +3888,45 @@ msgid "" "Employee = NamedTuple('Employee', [('name', str), ('id', int)])" msgstr "" -#: ../../library/typing.rst:2312 +#: ../../library/typing.rst:2410 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:2315 +#: ../../library/typing.rst:2413 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:2318 +#: ../../library/typing.rst:2416 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:2322 +#: ../../library/typing.rst:2420 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:2326 +#: ../../library/typing.rst:2424 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:2329 +#: ../../library/typing.rst:2427 +msgid "" +"Using :func:`super` (and the ``__class__`` :term:`closure variable`) in " +"methods of ``NamedTuple`` subclasses is unsupported and causes " +"a :class:`TypeError`." +msgstr "" + +#: ../../library/typing.rst:2431 msgid "" "The undocumented keyword argument syntax for creating NamedTuple classes " "(``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be disallowed " "in 3.15. Use the class-based syntax or the functional syntax instead." msgstr "" -#: ../../library/typing.rst:2334 +#: ../../library/typing.rst:2436 msgid "" "When using the functional syntax to create a NamedTuple class, failing to " "pass a value to the 'fields' parameter (``NT = NamedTuple(\"NT\")``) is " @@ -3815,48 +3936,48 @@ msgid "" "NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." msgstr "" -#: ../../library/typing.rst:2344 +#: ../../library/typing.rst:2446 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:2346 +#: ../../library/typing.rst:2448 msgid "" "A ``NewType`` is considered a distinct type by a typechecker. At runtime, " "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: ../../library/typing.rst:2351 +#: ../../library/typing.rst:2453 msgid "" "UserId = NewType('UserId', int) # Declare the NewType \"UserId\"\n" "first_user = UserId(1) # \"UserId\" returns the argument unchanged at " "runtime" msgstr "" -#: ../../library/typing.rst:2356 +#: ../../library/typing.rst:2458 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:2360 +#: ../../library/typing.rst:2462 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:2364 +#: ../../library/typing.rst:2466 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:2368 +#: ../../library/typing.rst:2470 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:2373 +#: ../../library/typing.rst:2475 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:2375 +#: ../../library/typing.rst:2477 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:2377 +#: ../../library/typing.rst:2479 msgid "" "class Proto(Protocol):\n" " def meth(self) -> int:\n" @@ -3866,13 +3987,13 @@ msgstr "" " def meth(self) -> int:\n" " ..." -#: ../../library/typing.rst:2381 +#: ../../library/typing.rst:2483 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:2384 +#: ../../library/typing.rst:2486 msgid "" "class C:\n" " def meth(self) -> int:\n" @@ -3884,20 +4005,20 @@ msgid "" "func(C()) # Passes static type check" msgstr "" -#: ../../library/typing.rst:2393 +#: ../../library/typing.rst:2495 msgid "" -"See :pep:`544` for more details. Protocol classes decorated with :func:" -"`runtime_checkable` (described later) act as simple-minded runtime protocols " -"that check only the presence of given attributes, ignoring their type " -"signatures. Protocol classes without this decorator cannot be used as the " -"second argument to :func:`isinstance` or :func:`issubclass`." +"See :pep:`544` for more details. Protocol classes decorated " +"with :func:`runtime_checkable` (described later) act as simple-minded " +"runtime protocols that check only the presence of given attributes, ignoring " +"their type signatures. Protocol classes without this decorator cannot be " +"used as the second argument to :func:`isinstance` or :func:`issubclass`." msgstr "" -#: ../../library/typing.rst:2399 +#: ../../library/typing.rst:2501 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:2401 +#: ../../library/typing.rst:2503 msgid "" "class GenProto[T](Protocol):\n" " def meth(self) -> T:\n" @@ -3907,13 +4028,13 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2405 +#: ../../library/typing.rst:2507 msgid "" "In code that needs to be compatible with Python 3.11 or older, generic " "Protocols can be written as follows::" msgstr "" -#: ../../library/typing.rst:2408 +#: ../../library/typing.rst:2510 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -3927,19 +4048,19 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2418 +#: ../../library/typing.rst:2520 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:2420 +#: ../../library/typing.rst:2522 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This allows a simple-minded structural check, very similar to \"one trick " -"ponies\" in :mod:`collections.abc` such as :class:`~collections.abc." -"Iterable`. For example::" +"ponies\" in :mod:`collections.abc` such " +"as :class:`~collections.abc.Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:2424 +#: ../../library/typing.rst:2526 msgid "" "@runtime_checkable\n" "class Closable(Protocol):\n" @@ -3967,23 +4088,23 @@ msgstr "" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" -#: ../../library/typing.rst:2437 +#: ../../library/typing.rst:2539 msgid "" "This decorator raises :exc:`TypeError` when applied to a non-protocol class." msgstr "" -#: ../../library/typing.rst:2441 +#: ../../library/typing.rst:2543 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " -"methods or attributes, not their type signatures or types. For example, :" -"class:`ssl.SSLObject` is a class, therefore it passes an :func:`issubclass` " -"check against :ref:`Callable `. However, the ``ssl." -"SSLObject.__init__`` method exists only to raise a :exc:`TypeError` with a " -"more informative message, therefore making it impossible to call " -"(instantiate) :class:`ssl.SSLObject`." +"methods or attributes, not their type signatures or types. For " +"example, :class:`ssl.SSLObject` is a class, therefore it passes " +"an :func:`issubclass` check against :ref:`Callable `. " +"However, the ``ssl.SSLObject.__init__`` method exists only to raise " +"a :exc:`TypeError` with a more informative message, therefore making it " +"impossible to call (instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:2452 +#: ../../library/typing.rst:2554 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -3991,7 +4112,7 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:2460 +#: ../../library/typing.rst:2562 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -4001,22 +4122,23 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" -#: ../../library/typing.rst:2469 +#: ../../library/typing.rst:2571 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " "onto a runtime-checkable protocol will still work, but will have no impact " -"on :func:`isinstance` checks comparing objects to the protocol. See :ref:" -"`What's new in Python 3.12 ` for more details." +"on :func:`isinstance` checks comparing objects to the protocol. " +"See :ref:`What's new in Python 3.12 ` for more " +"details." msgstr "" -#: ../../library/typing.rst:2480 +#: ../../library/typing.rst:2582 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:2483 +#: ../../library/typing.rst:2585 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -4024,7 +4146,7 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:2489 +#: ../../library/typing.rst:2591 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -4037,25 +4159,25 @@ msgid "" "assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" -#: ../../library/typing.rst:2499 +#: ../../library/typing.rst:2601 msgid "" "An alternative way to create a ``TypedDict`` is by using function-call " "syntax. The second argument must be a literal :class:`dict`::" msgstr "" -#: ../../library/typing.rst:2502 +#: ../../library/typing.rst:2604 msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" msgstr "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -#: ../../library/typing.rst:2504 +#: ../../library/typing.rst:2606 msgid "" -"This functional syntax allows defining keys which are not valid :ref:" -"`identifiers `, for example because they are keywords or " -"contain hyphens, or when key names must not be :ref:`mangled ` like regular private names::" +"This functional syntax allows defining keys which are not " +"valid :ref:`identifiers `, for example because they are " +"keywords or contain hyphens, or when key names must not be :ref:`mangled " +"` like regular private names::" msgstr "" -#: ../../library/typing.rst:2509 +#: ../../library/typing.rst:2611 msgid "" "# raises SyntaxError\n" "class Point2D(TypedDict):\n" @@ -4070,13 +4192,13 @@ msgid "" "Definition = TypedDict('Definition', {'__schema': str}) # not mangled" msgstr "" -#: ../../library/typing.rst:2521 +#: ../../library/typing.rst:2623 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" -#: ../../library/typing.rst:2524 +#: ../../library/typing.rst:2626 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -4096,19 +4218,19 @@ msgstr "" "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': " "NotRequired[str]})" -#: ../../library/typing.rst:2532 +#: ../../library/typing.rst:2634 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2535 +#: ../../library/typing.rst:2637 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2538 +#: ../../library/typing.rst:2640 msgid "" "class Point2D(TypedDict, total=False):\n" " x: int\n" @@ -4124,7 +4246,7 @@ msgstr "" "# 替代語法\n" "Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" -#: ../../library/typing.rst:2545 +#: ../../library/typing.rst:2647 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -4132,13 +4254,13 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2550 +#: ../../library/typing.rst:2652 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2553 +#: ../../library/typing.rst:2655 msgid "" "class Point2D(TypedDict, total=False):\n" " x: Required[int]\n" @@ -4164,13 +4286,13 @@ msgstr "" " 'label': str\n" "}, total=False)" -#: ../../library/typing.rst:2565 +#: ../../library/typing.rst:2667 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:2569 +#: ../../library/typing.rst:2671 msgid "" "class Point3D(Point2D):\n" " z: int" @@ -4178,13 +4300,13 @@ msgstr "" "class Point3D(Point2D):\n" " z: int" -#: ../../library/typing.rst:2572 +#: ../../library/typing.rst:2674 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2575 +#: ../../library/typing.rst:2677 msgid "" "class Point3D(TypedDict):\n" " x: int\n" @@ -4196,13 +4318,13 @@ msgstr "" " y: int\n" " z: int" -#: ../../library/typing.rst:2580 +#: ../../library/typing.rst:2682 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2583 +#: ../../library/typing.rst:2685 msgid "" "class X(TypedDict):\n" " x: int\n" @@ -4228,11 +4350,11 @@ msgstr "" "\n" "class XZ(X, Z): pass # 引發 TypeError" -#: ../../library/typing.rst:2595 +#: ../../library/typing.rst:2697 msgid "A ``TypedDict`` can be generic::" msgstr "" -#: ../../library/typing.rst:2597 +#: ../../library/typing.rst:2699 msgid "" "class Group[T](TypedDict):\n" " key: T\n" @@ -4242,13 +4364,13 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2601 +#: ../../library/typing.rst:2703 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" -#: ../../library/typing.rst:2604 +#: ../../library/typing.rst:2706 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -4262,19 +4384,20 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2612 +#: ../../library/typing.rst:2714 msgid "" -"A ``TypedDict`` can be introspected via annotations dicts (see :ref:" -"`annotations-howto` for more information on annotations best practices), :" -"attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." +"A ``TypedDict`` can be introspected via annotations dicts " +"(see :ref:`annotations-howto` for more information on annotations best " +"practices), :attr:`__total__`, :attr:`__required_keys__`, " +"and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:2618 +#: ../../library/typing.rst:2720 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2621 +#: ../../library/typing.rst:2723 msgid "" ">>> from typing import TypedDict\n" ">>> class Point2D(TypedDict): pass\n" @@ -4298,7 +4421,7 @@ msgstr "" ">>> Point3D.__total__\n" "True" -#: ../../library/typing.rst:2634 +#: ../../library/typing.rst:2736 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " @@ -4309,21 +4432,21 @@ msgid "" "introspection." msgstr "" -#: ../../library/typing.rst:2647 +#: ../../library/typing.rst:2749 msgid "" -"``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" -"class:`frozenset` objects containing required and non-required keys, " +"``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` " +"return :class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2650 +#: ../../library/typing.rst:2752 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" -#: ../../library/typing.rst:2653 +#: ../../library/typing.rst:2755 msgid "" "For backwards compatibility with Python 3.10 and below, it is also possible " "to use inheritance to declare both required and non-required keys in the " @@ -4332,7 +4455,7 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2660 +#: ../../library/typing.rst:2762 msgid "" ">>> class Point2D(TypedDict, total=False):\n" "... x: int\n" @@ -4358,7 +4481,7 @@ msgstr "" ">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" "True" -#: ../../library/typing.rst:2678 +#: ../../library/typing.rst:2780 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -4367,48 +4490,50 @@ msgid "" "attributes may be incorrect." msgstr "" -#: ../../library/typing.rst:2684 +#: ../../library/typing.rst:2786 msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" msgstr "" -#: ../../library/typing.rst:2688 +#: ../../library/typing.rst:2790 msgid "" "A :class:`frozenset` containing the names of all read-only keys. Keys are " "read-only if they carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2695 +#: ../../library/typing.rst:2797 msgid "" "A :class:`frozenset` containing the names of all mutable keys. Keys are " "mutable if they do not carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2700 +#: ../../library/typing.rst:2802 msgid "" -"See :pep:`589` for more examples and detailed rules of using ``TypedDict``." +"See the `TypedDict `_ section in the typing documentation for more " +"examples and detailed rules." msgstr "" -#: ../../library/typing.rst:2704 +#: ../../library/typing.rst:2806 msgid "" -"Added support for marking individual keys as :data:`Required` or :data:" -"`NotRequired`. See :pep:`655`." +"Added support for marking individual keys as :data:`Required` " +"or :data:`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2708 +#: ../../library/typing.rst:2810 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2711 +#: ../../library/typing.rst:2813 msgid "" "Removed support for the keyword-argument method of creating ``TypedDict``\\ " "s." msgstr "" -#: ../../library/typing.rst:2714 +#: ../../library/typing.rst:2816 msgid "Support for the :data:`ReadOnly` qualifier was added." msgstr "" -#: ../../library/typing.rst:2717 +#: ../../library/typing.rst:2819 msgid "" "When using the functional syntax to create a TypedDict class, failing to " "pass a value to the 'fields' parameter (``TD = TypedDict(\"TD\")``) is " @@ -4418,106 +4543,134 @@ msgid "" "TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." msgstr "" -#: ../../library/typing.rst:2726 +#: ../../library/typing.rst:2828 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2728 +#: ../../library/typing.rst:2830 msgid "" "The following protocols are provided by the :mod:`!typing` module. All are " "decorated with :func:`@runtime_checkable `." msgstr "" -#: ../../library/typing.rst:2733 +#: ../../library/typing.rst:2835 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2738 +#: ../../library/typing.rst:2840 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2742 +#: ../../library/typing.rst:2844 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2746 +#: ../../library/typing.rst:2848 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2750 +#: ../../library/typing.rst:2852 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2756 +#: ../../library/typing.rst:2858 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2760 +#: ../../library/typing.rst:2862 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2764 -msgid "ABCs for working with IO" +#: ../../library/typing.rst:2868 +msgid "ABCs and Protocols for working with I/O" msgstr "" -#: ../../library/typing.rst:2770 +#: ../../library/typing.rst:2874 msgid "" -"Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " +"Generic class ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " -"by :func:`open`." +"by :func:`open`. Please note that these classes are not protocols, and their " +"interface is fairly broad." +msgstr "" + +#: ../../library/typing.rst:2880 +msgid "" +"The protocols :class:`io.Reader` and :class:`io.Writer` offer a simpler " +"alternative for argument types, when only the ``read()`` or ``write()`` " +"methods are accessed, respectively::" +msgstr "" + +#: ../../library/typing.rst:2884 +msgid "" +"def read_and_write(reader: Reader[str], writer: Writer[bytes]):\n" +" data = reader.read()\n" +" writer.write(data.encode())" msgstr "" -#: ../../library/typing.rst:2776 +#: ../../library/typing.rst:2888 +msgid "" +"Also consider using :class:`collections.abc.Iterable` for iterating over the " +"lines of an input stream::" +msgstr "" + +#: ../../library/typing.rst:2891 +msgid "" +"def read_config(stream: Iterable[str]):\n" +" for line in stream:\n" +" ..." +msgstr "" + +#: ../../library/typing.rst:2896 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2780 +#: ../../library/typing.rst:2900 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2782 +#: ../../library/typing.rst:2902 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: ../../library/typing.rst:2789 +#: ../../library/typing.rst:2909 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2791 +#: ../../library/typing.rst:2911 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" -#: ../../library/typing.rst:2794 +#: ../../library/typing.rst:2914 msgid "" "When a static type checker encounters a call to ``assert_type()``, it emits " "an error if the value is not of the specified type::" msgstr "" -#: ../../library/typing.rst:2797 +#: ../../library/typing.rst:2917 msgid "" "def greet(name: str) -> None:\n" " assert_type(name, str) # OK, inferred type of `name` is `str`\n" " assert_type(name, int) # type checker error" msgstr "" -#: ../../library/typing.rst:2801 +#: ../../library/typing.rst:2921 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" -#: ../../library/typing.rst:2804 +#: ../../library/typing.rst:2924 msgid "" "def complex_function(arg: object):\n" " # Do some complex type-narrowing logic,\n" @@ -4527,16 +4680,16 @@ msgid "" " assert_type(arg, int)" msgstr "" -#: ../../library/typing.rst:2815 +#: ../../library/typing.rst:2935 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2817 +#: ../../library/typing.rst:2937 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:2819 +#: ../../library/typing.rst:2939 msgid "" "def int_or_str(arg: int | str) -> None:\n" " match arg:\n" @@ -4556,14 +4709,14 @@ msgstr "" " case _ as unreachable:\n" " assert_never(unreachable)" -#: ../../library/typing.rst:2828 +#: ../../library/typing.rst:2948 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" -#: ../../library/typing.rst:2833 +#: ../../library/typing.rst:2953 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -4573,47 +4726,47 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2841 +#: ../../library/typing.rst:2961 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2844 +#: ../../library/typing.rst:2964 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about exhaustiveness " "checking with static typing." msgstr "" -#: ../../library/typing.rst:2852 +#: ../../library/typing.rst:2972 msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -#: ../../library/typing.rst:2854 +#: ../../library/typing.rst:2974 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the inferred type of the argument. For example::" msgstr "" -#: ../../library/typing.rst:2857 +#: ../../library/typing.rst:2977 msgid "" "x: int = 1\n" "reveal_type(x) # Revealed type is \"builtins.int\"" msgstr "" -#: ../../library/typing.rst:2860 +#: ../../library/typing.rst:2980 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2863 +#: ../../library/typing.rst:2983 msgid "" -"At runtime, this function prints the runtime type of its argument to :data:" -"`sys.stderr` and returns the argument unchanged (allowing the call to be " -"used within an expression)::" +"At runtime, this function prints the runtime type of its argument " +"to :data:`sys.stderr` and returns the argument unchanged (allowing the call " +"to be used within an expression)::" msgstr "" -#: ../../library/typing.rst:2867 +#: ../../library/typing.rst:2987 msgid "" "x = reveal_type(1) # prints \"Runtime type is int\"\n" "print(x) # prints \"1\"" @@ -4621,13 +4774,13 @@ msgstr "" "x = reveal_type(1) # 印出 \"Runtime type is int\"\n" "print(x) # 印出 \"1\"" -#: ../../library/typing.rst:2870 +#: ../../library/typing.rst:2990 msgid "" "Note that the runtime type may be different from (more or less specific " "than) the type statically inferred by a type checker." msgstr "" -#: ../../library/typing.rst:2873 +#: ../../library/typing.rst:2993 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " @@ -4635,13 +4788,13 @@ msgid "" "clearly." msgstr "" -#: ../../library/typing.rst:2884 +#: ../../library/typing.rst:3004 msgid "" -"Decorator to mark an object as providing :func:`dataclass `-like behavior." +"Decorator to mark an object as providing :func:`dataclass " +"`-like behavior." msgstr "" -#: ../../library/typing.rst:2887 +#: ../../library/typing.rst:3007 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -4650,11 +4803,11 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:2894 +#: ../../library/typing.rst:3014 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:2896 +#: ../../library/typing.rst:3016 msgid "" "@dataclass_transform()\n" "def create_model[T](cls: type[T]) -> type[T]:\n" @@ -4676,11 +4829,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2908 +#: ../../library/typing.rst:3028 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:2910 +#: ../../library/typing.rst:3030 msgid "" "@dataclass_transform()\n" "class ModelBase: ...\n" @@ -4696,11 +4849,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2917 +#: ../../library/typing.rst:3037 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:2919 +#: ../../library/typing.rst:3039 msgid "" "@dataclass_transform()\n" "class ModelMeta(type): ...\n" @@ -4720,15 +4873,15 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2928 +#: ../../library/typing.rst:3048 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " -"similarly to classes created with :func:`@dataclasses.dataclass `. For example, type checkers will assume these classes have " -"``__init__`` methods that accept ``id`` and ``name``." +"similarly to classes created with :func:`@dataclasses.dataclass " +"`. For example, type checkers will assume these " +"classes have ``__init__`` methods that accept ``id`` and ``name``." msgstr "" -#: ../../library/typing.rst:2934 +#: ../../library/typing.rst:3054 msgid "" "The decorated class, metaclass, or function may accept the following bool " "arguments which type checkers will assume have the same effect as they would " @@ -4738,7 +4891,7 @@ msgid "" "arguments (``True`` or ``False``) to be statically evaluated." msgstr "" -#: ../../library/typing.rst:2942 +#: ../../library/typing.rst:3062 msgid "" "The arguments to the ``dataclass_transform`` decorator can be used to " "customize the default behaviors of the decorated class, metaclass, or " @@ -4749,90 +4902,90 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/typing.rst:2946 +#: ../../library/typing.rst:3066 msgid "" "Indicates whether the ``eq`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``True``." msgstr "" -#: ../../library/typing.rst:2951 +#: ../../library/typing.rst:3071 msgid "" "Indicates whether the ``order`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:2956 +#: ../../library/typing.rst:3076 msgid "" "Indicates whether the ``kw_only`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:2961 +#: ../../library/typing.rst:3081 msgid "" "Indicates whether the ``frozen`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``. .. " "versionadded:: 3.12" msgstr "" -#: ../../library/typing.rst:2962 +#: ../../library/typing.rst:3082 msgid "" "Indicates whether the ``frozen`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:2968 +#: ../../library/typing.rst:3088 msgid "" "Specifies a static list of supported classes or functions that describe " "fields, similar to :func:`dataclasses.field`. Defaults to ``()``." msgstr "" -#: ../../library/typing.rst:2974 +#: ../../library/typing.rst:3094 msgid "" "Arbitrary other keyword arguments are accepted in order to allow for " "possible future extensions." msgstr "" -#: ../../library/typing.rst:2978 +#: ../../library/typing.rst:3098 msgid "" "Type checkers recognize the following optional parameters on field " "specifiers:" msgstr "" -#: ../../library/typing.rst:2981 +#: ../../library/typing.rst:3101 msgid "**Recognised parameters for field specifiers**" msgstr "" -#: ../../library/typing.rst:2985 +#: ../../library/typing.rst:3105 msgid "Parameter name" msgstr "" -#: ../../library/typing.rst:2986 +#: ../../library/typing.rst:3106 msgid "Description" msgstr "" -#: ../../library/typing.rst:2987 +#: ../../library/typing.rst:3107 msgid "``init``" msgstr "``init``" -#: ../../library/typing.rst:2988 +#: ../../library/typing.rst:3108 msgid "" "Indicates whether the field should be included in the synthesized " "``__init__`` method. If unspecified, ``init`` defaults to ``True``." msgstr "" -#: ../../library/typing.rst:2991 +#: ../../library/typing.rst:3111 msgid "``default``" msgstr "``default``" -#: ../../library/typing.rst:2992 +#: ../../library/typing.rst:3112 msgid "Provides the default value for the field." msgstr "" -#: ../../library/typing.rst:2993 +#: ../../library/typing.rst:3113 msgid "``default_factory``" msgstr "``default_factory``" -#: ../../library/typing.rst:2994 +#: ../../library/typing.rst:3114 msgid "" "Provides a runtime callback that returns the default value for the field. If " "neither ``default`` nor ``default_factory`` are specified, the field is " @@ -4840,19 +4993,19 @@ msgid "" "is instantiated." msgstr "" -#: ../../library/typing.rst:2999 +#: ../../library/typing.rst:3119 msgid "``factory``" msgstr "``factory``" -#: ../../library/typing.rst:3000 +#: ../../library/typing.rst:3120 msgid "An alias for the ``default_factory`` parameter on field specifiers." msgstr "" -#: ../../library/typing.rst:3001 +#: ../../library/typing.rst:3121 msgid "``kw_only``" msgstr "``kw_only``" -#: ../../library/typing.rst:3002 +#: ../../library/typing.rst:3122 msgid "" "Indicates whether the field should be marked as keyword-only. If ``True``, " "the field will be keyword-only. If ``False``, it will not be keyword-only. " @@ -4862,32 +5015,32 @@ msgid "" "will be used." msgstr "" -#: ../../library/typing.rst:3008 +#: ../../library/typing.rst:3128 msgid "``alias``" msgstr "``alias``" -#: ../../library/typing.rst:3009 +#: ../../library/typing.rst:3129 msgid "" "Provides an alternative name for the field. This alternative name is used in " "the synthesized ``__init__`` method." msgstr "" -#: ../../library/typing.rst:3012 +#: ../../library/typing.rst:3132 msgid "" "At runtime, this decorator records its arguments in the " "``__dataclass_transform__`` attribute on the decorated object. It has no " "other runtime effect." msgstr "" -#: ../../library/typing.rst:3016 +#: ../../library/typing.rst:3136 msgid "See :pep:`681` for more details." msgstr "更多細節請見 :pep:`681`。" -#: ../../library/typing.rst:3024 +#: ../../library/typing.rst:3144 msgid "Decorator for creating overloaded functions and methods." msgstr "" -#: ../../library/typing.rst:3026 +#: ../../library/typing.rst:3146 msgid "" "The ``@overload`` decorator allows describing functions and methods that " "support multiple different combinations of argument types. A series of " @@ -4895,23 +5048,23 @@ msgid "" "``@overload``-decorated definition (for the same function/method)." msgstr "" -#: ../../library/typing.rst:3031 +#: ../../library/typing.rst:3151 msgid "" "``@overload``-decorated definitions are for the benefit of the type checker " "only, since they will be overwritten by the non-``@overload``-decorated " "definition. The non-``@overload``-decorated definition, meanwhile, will be " "used at runtime but should be ignored by a type checker. At runtime, " -"calling an ``@overload``-decorated function directly will raise :exc:" -"`NotImplementedError`." +"calling an ``@overload``-decorated function directly will " +"raise :exc:`NotImplementedError`." msgstr "" -#: ../../library/typing.rst:3039 +#: ../../library/typing.rst:3159 msgid "" "An example of overload that gives a more precise type than can be expressed " "using a union or a type variable:" msgstr "" -#: ../../library/typing.rst:3042 +#: ../../library/typing.rst:3162 msgid "" "@overload\n" "def process(response: None) -> None:\n" @@ -4937,24 +5090,24 @@ msgstr "" "def process(response):\n" " ... # 實際的實作在這邊" -#: ../../library/typing.rst:3056 +#: ../../library/typing.rst:3176 msgid "" "See :pep:`484` for more details and comparison with other typing semantics." msgstr "" -#: ../../library/typing.rst:3058 +#: ../../library/typing.rst:3178 msgid "" -"Overloaded functions can now be introspected at runtime using :func:" -"`get_overloads`." +"Overloaded functions can now be introspected at runtime " +"using :func:`get_overloads`." msgstr "" -#: ../../library/typing.rst:3065 +#: ../../library/typing.rst:3185 msgid "" "Return a sequence of :func:`@overload `-decorated definitions for " "*func*." msgstr "" -#: ../../library/typing.rst:3068 +#: ../../library/typing.rst:3188 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -4964,32 +5117,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:3075 +#: ../../library/typing.rst:3195 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:3083 +#: ../../library/typing.rst:3203 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:3085 +#: ../../library/typing.rst:3205 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:3092 +#: ../../library/typing.rst:3212 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:3094 +#: ../../library/typing.rst:3214 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" -#: ../../library/typing.rst:3100 +#: ../../library/typing.rst:3220 msgid "" "class Base:\n" " @final\n" @@ -5019,7 +5172,7 @@ msgstr "" "class Other(Leaf): # 型別檢查器回報的錯誤\n" " ..." -#: ../../library/typing.rst:3119 +#: ../../library/typing.rst:3239 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -5029,11 +5182,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:3130 +#: ../../library/typing.rst:3250 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:3132 +#: ../../library/typing.rst:3252 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " @@ -5041,40 +5194,40 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:3138 +#: ../../library/typing.rst:3258 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:3142 +#: ../../library/typing.rst:3262 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:3144 +#: ../../library/typing.rst:3264 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:3147 +#: ../../library/typing.rst:3267 msgid "" "No type checker ever added support for ``@no_type_check_decorator``. It is " "therefore deprecated, and will be removed in Python 3.15." msgstr "" -#: ../../library/typing.rst:3153 +#: ../../library/typing.rst:3273 msgid "" "Decorator to indicate that a method in a subclass is intended to override a " "method or attribute in a superclass." msgstr "" -#: ../../library/typing.rst:3156 +#: ../../library/typing.rst:3276 msgid "" "Type checkers should emit an error if a method decorated with ``@override`` " "does not, in fact, override anything. This helps prevent bugs that may occur " "when a base class is changed without an equivalent change to a child class." msgstr "" -#: ../../library/typing.rst:3163 +#: ../../library/typing.rst:3283 msgid "" "class Base:\n" " def log_status(self) -> None:\n" @@ -5090,11 +5243,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:3178 +#: ../../library/typing.rst:3298 msgid "There is no runtime checking of this property." msgstr "" -#: ../../library/typing.rst:3180 +#: ../../library/typing.rst:3300 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -5104,22 +5257,22 @@ msgid "" "without raising an exception." msgstr "" -#: ../../library/typing.rst:3187 +#: ../../library/typing.rst:3307 msgid "See :pep:`698` for more details." msgstr "更多細節請見 :pep:`698`。" -#: ../../library/typing.rst:3194 +#: ../../library/typing.rst:3314 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:3196 +#: ../../library/typing.rst:3316 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: ../../library/typing.rst:3200 +#: ../../library/typing.rst:3320 msgid "" "@type_check_only\n" "class Response: # private or not available at runtime\n" @@ -5129,29 +5282,29 @@ msgid "" "def fetch_response() -> Response: ..." msgstr "" -#: ../../library/typing.rst:3207 +#: ../../library/typing.rst:3327 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:3211 +#: ../../library/typing.rst:3331 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:3215 +#: ../../library/typing.rst:3335 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3338 msgid "" "This is often the same as ``obj.__annotations__``, but this function makes " "the following changes to the annotations dictionary:" msgstr "" -#: ../../library/typing.rst:3221 +#: ../../library/typing.rst:3341 msgid "" "Forward references encoded as string literals or :class:`ForwardRef` objects " "are handled by evaluating them in *globalns*, *localns*, and (where " @@ -5160,17 +5313,17 @@ msgid "" "inferred from *obj*." msgstr "" -#: ../../library/typing.rst:3226 +#: ../../library/typing.rst:3346 msgid "``None`` is replaced with :class:`types.NoneType`." msgstr "" -#: ../../library/typing.rst:3227 +#: ../../library/typing.rst:3347 msgid "" "If :func:`@no_type_check ` has been applied to *obj*, an " "empty dictionary is returned." msgstr "" -#: ../../library/typing.rst:3229 +#: ../../library/typing.rst:3349 msgid "" "If *obj* is a class ``C``, the function returns a dictionary that merges " "annotations from ``C``'s base classes with those on ``C`` directly. This is " @@ -5180,62 +5333,62 @@ msgid "" "annotations on classes appearing later in the method resolution order." msgstr "" -#: ../../library/typing.rst:3236 +#: ../../library/typing.rst:3356 msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]`` " -"with ``T``, unless *include_extras* is set to ``True`` (see :class:" -"`Annotated` for more information)." +"with ``T``, unless *include_extras* is set to ``True`` " +"(see :class:`Annotated` for more information)." msgstr "" -#: ../../library/typing.rst:3240 +#: ../../library/typing.rst:3360 msgid "" -"See also :func:`inspect.get_annotations`, a lower-level function that " +"See also :func:`annotationlib.get_annotations`, a lower-level function that " "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:3245 +#: ../../library/typing.rst:3365 msgid "" "If any forward references in the annotations of *obj* are not resolvable or " -"are not valid Python code, this function will raise an exception such as :" -"exc:`NameError`. For example, this can happen with imported :ref:`type " +"are not valid Python code, this function will raise an exception such " +"as :exc:`NameError`. For example, this can happen with imported :ref:`type " "aliases ` that include forward references, or with names " "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:3251 +#: ../../library/typing.rst:3371 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." msgstr "" -"新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" -"`Annotated` 的文件。" +"新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請" +"見 :data:`Annotated` 的文件。" -#: ../../library/typing.rst:3255 +#: ../../library/typing.rst:3375 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:3262 +#: ../../library/typing.rst:3382 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3265 +#: ../../library/typing.rst:3385 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " -"it will be normalized to the original class. If ``X`` is an instance of :" -"class:`ParamSpecArgs` or :class:`ParamSpecKwargs`, return the underlying :" -"class:`ParamSpec`. Return ``None`` for unsupported objects." +"it will be normalized to the original class. If ``X`` is an instance " +"of :class:`ParamSpecArgs` or :class:`ParamSpecKwargs`, return the " +"underlying :class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3271 ../../library/typing.rst:3295 +#: ../../library/typing.rst:3391 ../../library/typing.rst:3415 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3273 +#: ../../library/typing.rst:3393 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" @@ -5253,13 +5406,13 @@ msgstr "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3287 +#: ../../library/typing.rst:3407 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: ../../library/typing.rst:3290 +#: ../../library/typing.rst:3410 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -5267,7 +5420,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3297 +#: ../../library/typing.rst:3417 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -5277,11 +5430,11 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3307 +#: ../../library/typing.rst:3427 msgid "Return the set of members defined in a :class:`Protocol`." msgstr "" -#: ../../library/typing.rst:3309 +#: ../../library/typing.rst:3429 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -5297,15 +5450,15 @@ msgstr "" ">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" "True" -#: ../../library/typing.rst:3318 +#: ../../library/typing.rst:3438 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." msgstr "" -#: ../../library/typing.rst:3324 +#: ../../library/typing.rst:3444 msgid "Determine if a type is a :class:`Protocol`." msgstr "確定一個型別是否 :class:`Protocol`。" -#: ../../library/typing.rst:3328 +#: ../../library/typing.rst:3448 msgid "" "class P(Protocol):\n" " def a(self) -> str: ...\n" @@ -5321,11 +5474,11 @@ msgstr "" "is_protocol(P) # => True\n" "is_protocol(int) # => False" -#: ../../library/typing.rst:3339 +#: ../../library/typing.rst:3459 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3343 +#: ../../library/typing.rst:3463 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5339,32 +5492,57 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3360 +#: ../../library/typing.rst:3480 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3362 +#: ../../library/typing.rst:3482 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " -"``List[ForwardRef(\"SomeClass\")]``. ``ForwardRef`` should not be " +"``List[ForwardRef(\"SomeClass\")]``. :class:`!ForwardRef` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3367 +#: ../../library/typing.rst:3487 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:3375 +#: ../../library/typing.rst:3493 +msgid "" +"This is now an alias for :class:`annotationlib.ForwardRef`. Several " +"undocumented behaviors of this class have been changed; for example, after a " +"``ForwardRef`` has been evaluated, the evaluated value is no longer cached." +msgstr "" + +#: ../../library/typing.rst:3500 +msgid "Evaluate an :class:`annotationlib.ForwardRef` as a :term:`type hint`." +msgstr "" + +#: ../../library/typing.rst:3502 +msgid "" +"This is similar to calling :meth:`annotationlib.ForwardRef.evaluate`, but " +"unlike that method, :func:`!evaluate_forward_ref` also recursively evaluates " +"forward references nested within the type hint." +msgstr "" + +#: ../../library/typing.rst:3506 +msgid "" +"See the documentation for :meth:`annotationlib.ForwardRef.evaluate` for the " +"meaning of the *owner*, *globals*, *locals*, *type_params*, and *format* " +"parameters." +msgstr "" + +#: ../../library/typing.rst:3513 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" -#: ../../library/typing.rst:3378 +#: ../../library/typing.rst:3516 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5380,22 +5558,35 @@ msgstr "" ">>> S.__default__ is None\n" "True" -#: ../../library/typing.rst:3390 +#: ../../library/typing.rst:3528 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3394 +#: ../../library/typing.rst:3532 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " -"checkers. It is ``False`` at runtime." +"checkers. It's ``False`` at runtime." +msgstr "" + +#: ../../library/typing.rst:3535 +msgid "" +"A module which is expensive to import, and which only contain types used for " +"typing annotations, can be safely imported inside an ``if TYPE_CHECKING:`` " +"block. This prevents the module from actually being imported at runtime; " +"annotations aren't eagerly evaluated (see :pep:`649`) so using undefined " +"symbols in annotations is harmless--as long as you don't later examine them. " +"Your static type analysis tool will set ``TYPE_CHECKING`` to ``True`` during " +"static type analysis, which means the module will be imported and the types " +"will be checked properly during such analysis." msgstr "" -#: ../../library/typing.rst:3399 +#: ../../library/typing.rst:3547 +#, fuzzy msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" "\n" -"def fun(arg: 'expensive_mod.SomeType') -> None:\n" +"def fun(arg: expensive_mod.SomeType) -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" msgstr "" "if TYPE_CHECKING:\n" @@ -5404,27 +5595,20 @@ msgstr "" "def fun(arg: 'expensive_mod.SomeType') -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3405 +#: ../../library/typing.rst:3553 msgid "" -"The first type annotation must be enclosed in quotes, making it a \"forward " -"reference\", to hide the ``expensive_mod`` reference from the interpreter " -"runtime. Type annotations for local variables are not evaluated, so the " -"second annotation does not need to be enclosed in quotes." +"If you occasionally need to examine type annotations at runtime which may " +"contain undefined symbols, use :meth:`annotationlib.get_annotations` with a " +"``format`` parameter of :attr:`annotationlib.Format.STRING` " +"or :attr:`annotationlib.Format.FORWARDREF` to safely retrieve the " +"annotations without raising :exc:`NameError`." msgstr "" -#: ../../library/typing.rst:3412 -msgid "" -"If ``from __future__ import annotations`` is used, annotations are not " -"evaluated at function definition time. Instead, they are stored as strings " -"in ``__annotations__``. This makes it unnecessary to use quotes around the " -"annotation (see :pep:`563`)." -msgstr "" - -#: ../../library/typing.rst:3424 +#: ../../library/typing.rst:3566 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3426 +#: ../../library/typing.rst:3568 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the :mod:`!typing` module " @@ -5433,7 +5617,7 @@ msgid "" "pre-existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3433 +#: ../../library/typing.rst:3575 msgid "" "The redundant types are deprecated as of Python 3.9. However, while the " "aliases may be removed at some point, removal of these aliases is not " @@ -5441,213 +5625,214 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3438 +#: ../../library/typing.rst:3580 msgid "" "If at some point it is decided to remove these deprecated aliases, a " "deprecation warning will be issued by the interpreter for at least two " -"releases prior to removal. The aliases are guaranteed to remain in the :mod:" -"`!typing` module without deprecation warnings until at least Python 3.14." +"releases prior to removal. The aliases are guaranteed to remain in " +"the :mod:`!typing` module without deprecation warnings until at least Python " +"3.14." msgstr "" -#: ../../library/typing.rst:3443 +#: ../../library/typing.rst:3585 msgid "" "Type checkers are encouraged to flag uses of the deprecated types if the " "program they are checking targets a minimum Python version of 3.9 or newer." msgstr "" -#: ../../library/typing.rst:3449 +#: ../../library/typing.rst:3591 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3453 +#: ../../library/typing.rst:3595 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3455 +#: ../../library/typing.rst:3597 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Mapping` rather than to " "use :class:`dict` or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:3459 +#: ../../library/typing.rst:3601 msgid "" -":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.dict ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3465 +#: ../../library/typing.rst:3607 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3467 +#: ../../library/typing.rst:3609 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " -"collection type such as :class:`~collections.abc.Sequence` or :class:" -"`~collections.abc.Iterable` rather than to use :class:`list` or :class:`!" -"typing.List`." +"collection type such as :class:`~collections.abc.Sequence` " +"or :class:`~collections.abc.Iterable` rather than to use :class:`list` " +"or :class:`!typing.List`." msgstr "" -#: ../../library/typing.rst:3472 +#: ../../library/typing.rst:3614 msgid "" -":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.list ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3478 +#: ../../library/typing.rst:3620 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3480 +#: ../../library/typing.rst:3622 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " -"collection type such as :class:`collections.abc.Set` rather than to use :" -"class:`set` or :class:`typing.Set`." +"collection type such as :class:`collections.abc.Set` rather than to " +"use :class:`set` or :class:`typing.Set`." msgstr "" -#: ../../library/typing.rst:3484 +#: ../../library/typing.rst:3626 msgid "" -":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.set ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3490 +#: ../../library/typing.rst:3632 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3492 +#: ../../library/typing.rst:3634 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3499 +#: ../../library/typing.rst:3641 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3501 +#: ../../library/typing.rst:3643 msgid "" -":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" -"`annotating-tuples` for more details." +":class:`tuple` and ``Tuple`` are special-cased in the type system; " +"see :ref:`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3504 +#: ../../library/typing.rst:3646 msgid "" -":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.tuple ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3510 +#: ../../library/typing.rst:3652 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3512 +#: ../../library/typing.rst:3654 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3517 +#: ../../library/typing.rst:3659 msgid "" -":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.type ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3524 +#: ../../library/typing.rst:3666 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3528 +#: ../../library/typing.rst:3670 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3532 +#: ../../library/typing.rst:3674 msgid "" -":class:`collections.defaultdict` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.defaultdict` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3538 +#: ../../library/typing.rst:3680 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3542 +#: ../../library/typing.rst:3684 msgid "" -":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.OrderedDict` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3548 +#: ../../library/typing.rst:3690 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3552 +#: ../../library/typing.rst:3694 msgid "" -":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.ChainMap` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3558 +#: ../../library/typing.rst:3700 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3562 +#: ../../library/typing.rst:3704 msgid "" -":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.Counter` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3568 +#: ../../library/typing.rst:3710 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3572 +#: ../../library/typing.rst:3714 msgid "" -":class:`collections.deque` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.deque` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3579 +#: ../../library/typing.rst:3721 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3584 +#: ../../library/typing.rst:3726 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3587 +#: ../../library/typing.rst:3729 msgid "" -"These types (and the corresponding functions) are generic over :data:" -"`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " +"These types (and the corresponding functions) are generic " +"over :data:`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " "``Pattern[bytes]``; ``Match`` can be specialised as ``Match[str]`` or " "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3592 +#: ../../library/typing.rst:3734 msgid "" -"Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" -"pep:`585` and :ref:`types-genericalias`." +"Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3598 +#: ../../library/typing.rst:3740 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3600 +#: ../../library/typing.rst:3742 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: ../../library/typing.rst:3604 +#: ../../library/typing.rst:3746 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:3607 +#: ../../library/typing.rst:3749 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" @@ -5655,359 +5840,350 @@ msgstr "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" -#: ../../library/typing.rst:3612 +#: ../../library/typing.rst:3754 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: ../../library/typing.rst:3622 +#: ../../library/typing.rst:3764 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3626 +#: ../../library/typing.rst:3768 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3628 -msgid "" -":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." -msgstr "" - -#: ../../library/typing.rst:3634 -msgid "" -"This type represents the types :class:`bytes`, :class:`bytearray`, and :" -"class:`memoryview` of byte sequences." -msgstr "" - -#: ../../library/typing.rst:3637 +#: ../../library/typing.rst:3770 msgid "" -"Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray " -"| memoryview``." +":class:`collections.abc.Set` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3642 +#: ../../library/typing.rst:3776 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3646 +#: ../../library/typing.rst:3780 msgid "" -":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Collection` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3652 +#: ../../library/typing.rst:3786 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3654 +#: ../../library/typing.rst:3788 msgid "" -":class:`collections.abc.Container` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Container` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3660 +#: ../../library/typing.rst:3794 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3662 +#: ../../library/typing.rst:3796 msgid "" -":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.ItemsView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3668 +#: ../../library/typing.rst:3802 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3670 +#: ../../library/typing.rst:3804 msgid "" -":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.KeysView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3676 +#: ../../library/typing.rst:3810 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3678 +#: ../../library/typing.rst:3812 msgid "" -":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Mapping` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3684 +#: ../../library/typing.rst:3818 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3686 +#: ../../library/typing.rst:3820 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3692 +#: ../../library/typing.rst:3826 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3694 +#: ../../library/typing.rst:3828 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3701 +#: ../../library/typing.rst:3835 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3703 +#: ../../library/typing.rst:3837 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3710 +#: ../../library/typing.rst:3844 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3712 +#: ../../library/typing.rst:3846 msgid "" -":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.MutableSet` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3718 +#: ../../library/typing.rst:3852 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3720 +#: ../../library/typing.rst:3854 msgid "" -":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Sequence` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3726 +#: ../../library/typing.rst:3860 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3728 +#: ../../library/typing.rst:3862 msgid "" -":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.ValuesView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3735 +#: ../../library/typing.rst:3869 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中非同步 ABC 的別名" -#: ../../library/typing.rst:3739 +#: ../../library/typing.rst:3873 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3741 +#: ../../library/typing.rst:3875 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`collections.abc.Coroutine` and ``typing.Coroutine`` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`collections.abc.Coroutine` and ``typing.Coroutine`` in type " +"annotations." msgstr "" -#: ../../library/typing.rst:3747 +#: ../../library/typing.rst:3881 msgid "" -":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Coroutine` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3753 +#: ../../library/typing.rst:3887 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3755 +#: ../../library/typing.rst:3889 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` in type " -"annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` " +"in type annotations." msgstr "" -#: ../../library/typing.rst:3761 +#: ../../library/typing.rst:3895 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3766 +#: ../../library/typing.rst:3900 msgid "The ``SendType`` parameter now has a default." msgstr "``SendType`` 參數現在有預設值。" -#: ../../library/typing.rst:3771 +#: ../../library/typing.rst:3905 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3775 +#: ../../library/typing.rst:3909 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3781 +#: ../../library/typing.rst:3915 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3785 +#: ../../library/typing.rst:3919 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3791 +#: ../../library/typing.rst:3925 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3795 +#: ../../library/typing.rst:3929 msgid "" -":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Awaitable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3802 +#: ../../library/typing.rst:3936 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3806 +#: ../../library/typing.rst:3940 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3808 +#: ../../library/typing.rst:3942 msgid "" -":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Iterable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3814 +#: ../../library/typing.rst:3948 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3816 +#: ../../library/typing.rst:3950 msgid "" -":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Iterator` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3822 +#: ../../library/typing.rst:3956 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:3824 +#: ../../library/typing.rst:3958 msgid "" -"See :ref:`annotating-callables` for details on how to use :class:" -"`collections.abc.Callable` and ``typing.Callable`` in type annotations." +"See :ref:`annotating-callables` for details on how to " +"use :class:`collections.abc.Callable` and ``typing.Callable`` in type " +"annotations." msgstr "" -#: ../../library/typing.rst:3827 +#: ../../library/typing.rst:3961 msgid "" -":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Callable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3837 +#: ../../library/typing.rst:3971 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:3839 +#: ../../library/typing.rst:3973 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`collections.abc.Generator` and ``typing.Generator`` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`collections.abc.Generator` and ``typing.Generator`` in type " +"annotations." msgstr "" -#: ../../library/typing.rst:3843 +#: ../../library/typing.rst:3977 msgid "" -":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Generator` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3847 +#: ../../library/typing.rst:3981 msgid "Default values for the send and return types were added." msgstr "" -#: ../../library/typing.rst:3852 +#: ../../library/typing.rst:3986 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:3854 +#: ../../library/typing.rst:3988 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:3859 +#: ../../library/typing.rst:3993 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:3861 +#: ../../library/typing.rst:3995 msgid "" -":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Reversible` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3867 +#: ../../library/typing.rst:4001 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:3869 +#: ../../library/typing.rst:4003 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:3875 +#: ../../library/typing.rst:4009 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:3879 +#: ../../library/typing.rst:4013 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:3881 +#: ../../library/typing.rst:4015 msgid "" -"The first type parameter, ``T_co``, represents the type returned by the :" -"meth:`~object.__enter__` method. The optional second type parameter, " +"The first type parameter, ``T_co``, represents the type returned by " +"the :meth:`~object.__enter__` method. The optional second type parameter, " "``ExitT_co``, which defaults to ``bool | None``, represents the type " "returned by the :meth:`~object.__exit__` method." msgstr "" -#: ../../library/typing.rst:3888 +#: ../../library/typing.rst:4022 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3893 +#: ../../library/typing.rst:4027 msgid "Added the optional second type parameter, ``ExitT_co``." msgstr "" -#: ../../library/typing.rst:3898 +#: ../../library/typing.rst:4032 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:3900 +#: ../../library/typing.rst:4034 msgid "" -"The first type parameter, ``T_co``, represents the type returned by the :" -"meth:`~object.__aenter__` method. The optional second type parameter, " +"The first type parameter, ``T_co``, represents the type returned by " +"the :meth:`~object.__aenter__` method. The optional second type parameter, " "``AExitT_co``, which defaults to ``bool | None``, represents the type " "returned by the :meth:`~object.__aexit__` method." msgstr "" -#: ../../library/typing.rst:3907 +#: ../../library/typing.rst:4041 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3912 +#: ../../library/typing.rst:4046 msgid "Added the optional second type parameter, ``AExitT_co``." msgstr "" -#: ../../library/typing.rst:3916 +#: ../../library/typing.rst:4050 msgid "Deprecation Timeline of Major Features" msgstr "主要功能的棄用時程表" -#: ../../library/typing.rst:3918 +#: ../../library/typing.rst:4052 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -6015,115 +6191,112 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:3925 +#: ../../library/typing.rst:4059 msgid "Feature" msgstr "" -#: ../../library/typing.rst:3926 +#: ../../library/typing.rst:4060 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:3927 +#: ../../library/typing.rst:4061 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:3928 +#: ../../library/typing.rst:4062 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:3929 +#: ../../library/typing.rst:4063 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:3930 ../../library/typing.rst:3934 +#: ../../library/typing.rst:4064 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:3931 +#: ../../library/typing.rst:4065 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:3932 +#: ../../library/typing.rst:4066 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:3933 -msgid ":class:`typing.ByteString`" -msgstr ":class:`typing.ByteString`" - -#: ../../library/typing.rst:3935 -msgid "3.14" -msgstr "3.14" - -#: ../../library/typing.rst:3936 -msgid ":gh:`91896`" -msgstr ":gh:`91896`" - -#: ../../library/typing.rst:3937 +#: ../../library/typing.rst:4067 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:3938 +#: ../../library/typing.rst:4068 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:3939 ../../library/typing.rst:3943 -#: ../../library/typing.rst:3947 +#: ../../library/typing.rst:4069 ../../library/typing.rst:4073 +#: ../../library/typing.rst:4077 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:3940 +#: ../../library/typing.rst:4070 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:3941 +#: ../../library/typing.rst:4071 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:3942 ../../library/typing.rst:3946 +#: ../../library/typing.rst:4072 ../../library/typing.rst:4076 msgid "3.12" msgstr "3.12" -#: ../../library/typing.rst:3944 +#: ../../library/typing.rst:4074 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:3945 +#: ../../library/typing.rst:4075 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:3948 +#: ../../library/typing.rst:4078 msgid ":pep:`695`" msgstr ":pep:`695`" -#: ../../library/typing.rst:3949 +#: ../../library/typing.rst:4079 msgid ":func:`@typing.no_type_check_decorator `" msgstr ":func:`@typing.no_type_check_decorator `" -#: ../../library/typing.rst:3950 ../../library/typing.rst:3954 +#: ../../library/typing.rst:4080 ../../library/typing.rst:4084 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:3951 +#: ../../library/typing.rst:4081 msgid "3.15" msgstr "3.15" -#: ../../library/typing.rst:3952 +#: ../../library/typing.rst:4082 msgid ":gh:`106309`" msgstr ":gh:`106309`" -#: ../../library/typing.rst:3953 +#: ../../library/typing.rst:4083 msgid ":data:`typing.AnyStr`" msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:3955 +#: ../../library/typing.rst:4085 msgid "3.18" msgstr "3.18" -#: ../../library/typing.rst:3956 +#: ../../library/typing.rst:4086 msgid ":gh:`105578`" msgstr ":gh:`105578`" +#~ msgid ":class:`typing.ByteString`" +#~ msgstr ":class:`typing.ByteString`" + +#~ msgid "3.14" +#~ msgstr "3.14" + +#~ msgid ":gh:`91896`" +#~ msgstr ":gh:`91896`" + #~ msgid "" #~ "@dataclass\n" #~ "class ctype:\n" diff --git a/library/unicodedata.po b/library/unicodedata.po index 84ff0267791..66018ed883e 100644 --- a/library/unicodedata.po +++ b/library/unicodedata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-01 21:59+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,8 +25,8 @@ msgstr ":mod:`!unicodedata` --- Unicode 資料庫" msgid "" "This module provides access to the Unicode Character Database (UCD) which " "defines character properties for all Unicode characters. The data contained " -"in this database is compiled from the `UCD version 15.1.0 `_." +"in this database is compiled from the `UCD version 16.0.0 `_." msgstr "" #: ../../library/unicodedata.rst:23 @@ -36,202 +36,84 @@ msgid "" "tr44/>`_. It defines the following functions:" msgstr "" -#: ../../library/unicodedata.rst:30 -msgid "" -"The :ref:`unicode-howto` for more information about Unicode and how to use " -"this module." -msgstr "" - -#: ../../library/unicodedata.rst:36 +#: ../../library/unicodedata.rst:31 msgid "" "Look up character by name. If a character with the given name is found, " -"return the corresponding character. If not found, :exc:`KeyError` is " -"raised. For example::" -msgstr "" - -#: ../../library/unicodedata.rst:40 -msgid "" -">>> unicodedata.lookup('LEFT CURLY BRACKET')\n" -"'{'" -msgstr "" -">>> unicodedata.lookup('LEFT CURLY BRACKET')\n" -"'{'" - -#: ../../library/unicodedata.rst:43 -msgid "" -"The characters returned by this function are the same as those produced by " -"``\\N`` escape sequence in string literals. For example::" -msgstr "" - -#: ../../library/unicodedata.rst:46 -msgid "" -">>> unicodedata.lookup('MIDDLE DOT') == '\\N{MIDDLE DOT}'\n" -"True" +"return the corresponding character. If not found, :exc:`KeyError` is raised." msgstr "" -">>> unicodedata.lookup('MIDDLE DOT') == '\\N{MIDDLE DOT}'\n" -"True" -#: ../../library/unicodedata.rst:49 +#: ../../library/unicodedata.rst:34 msgid "Support for name aliases [#]_ and named sequences [#]_ has been added." msgstr "已新增對名稱別名 [#]_ 和命名序列 [#]_ 的支援。" -#: ../../library/unicodedata.rst:55 +#: ../../library/unicodedata.rst:40 msgid "" "Returns the name assigned to the character *chr* as a string. If no name is " "defined, *default* is returned, or, if not given, :exc:`ValueError` is " -"raised. For example::" -msgstr "" - -#: ../../library/unicodedata.rst:59 -msgid "" -">>> unicodedata.name('½')\n" -"'VULGAR FRACTION ONE HALF'\n" -">>> unicodedata.name('\\uFFFF', 'fallback')\n" -"'fallback'" +"raised." msgstr "" -">>> unicodedata.name('½')\n" -"'VULGAR FRACTION ONE HALF'\n" -">>> unicodedata.name('\\uFFFF', 'fallback')\n" -"'fallback'" -#: ../../library/unicodedata.rst:67 +#: ../../library/unicodedata.rst:47 msgid "" "Returns the decimal value assigned to the character *chr* as integer. If no " -"such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised. For example::" -msgstr "" - -#: ../../library/unicodedata.rst:71 -msgid "" -">>> unicodedata.decimal('\\N{ARABIC-INDIC DIGIT NINE}')\n" -"9\n" -">>> unicodedata.decimal('\\N{SUPERSCRIPT NINE}', -1)\n" -"-1" +"such value is defined, *default* is returned, or, if not " +"given, :exc:`ValueError` is raised." msgstr "" -">>> unicodedata.decimal('\\N{ARABIC-INDIC DIGIT NINE}')\n" -"9\n" -">>> unicodedata.decimal('\\N{SUPERSCRIPT NINE}', -1)\n" -"-1" -#: ../../library/unicodedata.rst:79 +#: ../../library/unicodedata.rst:54 msgid "" "Returns the digit value assigned to the character *chr* as integer. If no " -"such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised::" +"such value is defined, *default* is returned, or, if not " +"given, :exc:`ValueError` is raised." msgstr "" -#: ../../library/unicodedata.rst:83 -msgid "" -">>> unicodedata.digit('\\N{SUPERSCRIPT NINE}')\n" -"9" -msgstr "" -">>> unicodedata.digit('\\N{SUPERSCRIPT NINE}')\n" -"9" - -#: ../../library/unicodedata.rst:89 +#: ../../library/unicodedata.rst:61 msgid "" "Returns the numeric value assigned to the character *chr* as float. If no " -"such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised::" +"such value is defined, *default* is returned, or, if not " +"given, :exc:`ValueError` is raised." msgstr "" -#: ../../library/unicodedata.rst:93 -msgid "" -">>> unicodedata.numeric('½')\n" -"0.5" +#: ../../library/unicodedata.rst:68 +msgid "Returns the general category assigned to the character *chr* as string." msgstr "" -">>> unicodedata.numeric('½')\n" -"0.5" -#: ../../library/unicodedata.rst:99 -msgid "" -"Returns the general category assigned to the character *chr* as string. " -"General category names consist of two letters. See the `General Category " -"Values section of the Unicode Character Database documentation `_ for a list " -"of category codes. For example::" -msgstr "" - -#: ../../library/unicodedata.rst:105 -msgid "" -">>> unicodedata.category('A') # 'L'etter, 'u'ppercase\n" -"'Lu'" -msgstr "" -">>> unicodedata.category('A') # 'L'etter, 'u'ppercase\n" -"'Lu'" - -#: ../../library/unicodedata.rst:111 +#: ../../library/unicodedata.rst:74 msgid "" "Returns the bidirectional class assigned to the character *chr* as string. " -"If no such value is defined, an empty string is returned. See the " -"`Bidirectional Class Values section of the Unicode Character Database " -"`_ " -"documentation for a list of bidirectional codes. For example::" +"If no such value is defined, an empty string is returned." msgstr "" -#: ../../library/unicodedata.rst:117 -msgid "" -">>> unicodedata.bidirectional('\\N{ARABIC-INDIC DIGIT SEVEN}') # 'A'rabic, " -"'N'umber\n" -"'AN'" -msgstr "" -">>> unicodedata.bidirectional('\\N{ARABIC-INDIC DIGIT SEVEN}') # 'A'rabic, " -"'N'umber\n" -"'AN'" - -#: ../../library/unicodedata.rst:123 +#: ../../library/unicodedata.rst:80 msgid "" "Returns the canonical combining class assigned to the character *chr* as " -"integer. Returns ``0`` if no combining class is defined. See the `Canonical " -"Combining Class Values section of the Unicode Character Database `_ " -"for more information." +"integer. Returns ``0`` if no combining class is defined." msgstr "" -#: ../../library/unicodedata.rst:132 -msgid "" -"Returns the east asian width assigned to the character *chr* as string. For " -"a list of widths and or more information, see the `Unicode Standard Annex " -"#11 `_." +#: ../../library/unicodedata.rst:86 +msgid "Returns the east asian width assigned to the character *chr* as string." msgstr "" -#: ../../library/unicodedata.rst:139 +#: ../../library/unicodedata.rst:92 msgid "" "Returns the mirrored property assigned to the character *chr* as integer. " "Returns ``1`` if the character has been identified as a \"mirrored\" " -"character in bidirectional text, ``0`` otherwise. For example::" -msgstr "" - -#: ../../library/unicodedata.rst:143 -msgid "" -">>> unicodedata.mirrored('>')\n" -"1" +"character in bidirectional text, ``0`` otherwise." msgstr "" -">>> unicodedata.mirrored('>')\n" -"1" -#: ../../library/unicodedata.rst:149 +#: ../../library/unicodedata.rst:99 msgid "" "Returns the character decomposition mapping assigned to the character *chr* " -"as string. An empty string is returned in case no such mapping is defined. " -"For example::" -msgstr "" - -#: ../../library/unicodedata.rst:153 -msgid "" -">>> unicodedata.decomposition('Ã')\n" -"'0041 0303'" +"as string. An empty string is returned in case no such mapping is defined." msgstr "" -">>> unicodedata.decomposition('Ã')\n" -"'0041 0303'" -#: ../../library/unicodedata.rst:159 +#: ../../library/unicodedata.rst:106 msgid "" "Return the normal form *form* for the Unicode string *unistr*. Valid values " "for *form* are 'NFC', 'NFKC', 'NFD', and 'NFKD'." msgstr "" -#: ../../library/unicodedata.rst:162 +#: ../../library/unicodedata.rst:109 msgid "" "The Unicode standard defines various normalization forms of a Unicode " "string, based on the definition of canonical equivalence and compatibility " @@ -241,7 +123,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../library/unicodedata.rst:168 +#: ../../library/unicodedata.rst:115 msgid "" "For each character, there are two normal forms: normal form C and normal " "form D. Normal form D (NFD) is also known as canonical decomposition, and " @@ -250,62 +132,68 @@ msgid "" "characters again." msgstr "" -#: ../../library/unicodedata.rst:173 +#: ../../library/unicodedata.rst:120 msgid "" "In addition to these two forms, there are two additional normal forms based " "on compatibility equivalence. In Unicode, certain characters are supported " "which normally would be unified with other characters. For example, U+2160 " "(ROMAN NUMERAL ONE) is really the same thing as U+0049 (LATIN CAPITAL LETTER " "I). However, it is supported in Unicode for compatibility with existing " -"character sets (for example, gb2312)." +"character sets (e.g. gb2312)." msgstr "" -#: ../../library/unicodedata.rst:180 +#: ../../library/unicodedata.rst:127 msgid "" -"The normal form KD (NFKD) will apply the compatibility decomposition, that " -"is, replace all compatibility characters with their equivalents. The normal " -"form KC (NFKC) first applies the compatibility decomposition, followed by " -"the canonical composition." +"The normal form KD (NFKD) will apply the compatibility decomposition, i.e. " +"replace all compatibility characters with their equivalents. The normal form " +"KC (NFKC) first applies the compatibility decomposition, followed by the " +"canonical composition." msgstr "" -#: ../../library/unicodedata.rst:185 +#: ../../library/unicodedata.rst:132 msgid "" "Even if two unicode strings are normalized and look the same to a human " "reader, if one has combining characters and the other doesn't, they may not " "compare equal." msgstr "" -#: ../../library/unicodedata.rst:192 +#: ../../library/unicodedata.rst:138 msgid "" "Return whether the Unicode string *unistr* is in the normal form *form*. " "Valid values for *form* are 'NFC', 'NFKC', 'NFD', and 'NFKD'." msgstr "" -#: ../../library/unicodedata.rst:198 +#: ../../library/unicodedata.rst:144 msgid "In addition, the module exposes the following constant:" msgstr "" -#: ../../library/unicodedata.rst:202 +#: ../../library/unicodedata.rst:148 msgid "The version of the Unicode database used in this module." msgstr "在此模組中使用的 Unicode 資料庫版本。" -#: ../../library/unicodedata.rst:207 +#: ../../library/unicodedata.rst:153 msgid "" "This is an object that has the same methods as the entire module, but uses " "the Unicode database version 3.2 instead, for applications that require this " "specific version of the Unicode database (such as IDNA)." msgstr "" -#: ../../library/unicodedata.rst:213 +#: ../../library/unicodedata.rst:157 +msgid "Examples:" +msgstr "" + +#: ../../library/unicodedata.rst:177 msgid "Footnotes" msgstr "註腳" -#: ../../library/unicodedata.rst:214 -msgid "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" +#: ../../library/unicodedata.rst:178 +#, fuzzy +msgid "https://www.unicode.org/Public/16.0.0/ucd/NameAliases.txt" msgstr "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" -#: ../../library/unicodedata.rst:216 -msgid "https://www.unicode.org/Public/15.1.0/ucd/NamedSequences.txt" +#: ../../library/unicodedata.rst:180 +#, fuzzy +msgid "https://www.unicode.org/Public/16.0.0/ucd/NamedSequences.txt" msgstr "https://www.unicode.org/Public/15.1.0/ucd/NamedSequences.txt" #: ../../library/unicodedata.rst:11 @@ -319,3 +207,83 @@ msgstr "character(字元)" #: ../../library/unicodedata.rst:11 msgid "database" msgstr "database(資料庫)" + +#~ msgid "" +#~ ">>> unicodedata.lookup('LEFT CURLY BRACKET')\n" +#~ "'{'" +#~ msgstr "" +#~ ">>> unicodedata.lookup('LEFT CURLY BRACKET')\n" +#~ "'{'" + +#~ msgid "" +#~ ">>> unicodedata.lookup('MIDDLE DOT') == '\\N{MIDDLE DOT}'\n" +#~ "True" +#~ msgstr "" +#~ ">>> unicodedata.lookup('MIDDLE DOT') == '\\N{MIDDLE DOT}'\n" +#~ "True" + +#~ msgid "" +#~ ">>> unicodedata.name('½')\n" +#~ "'VULGAR FRACTION ONE HALF'\n" +#~ ">>> unicodedata.name('\\uFFFF', 'fallback')\n" +#~ "'fallback'" +#~ msgstr "" +#~ ">>> unicodedata.name('½')\n" +#~ "'VULGAR FRACTION ONE HALF'\n" +#~ ">>> unicodedata.name('\\uFFFF', 'fallback')\n" +#~ "'fallback'" + +#~ msgid "" +#~ ">>> unicodedata.decimal('\\N{ARABIC-INDIC DIGIT NINE}')\n" +#~ "9\n" +#~ ">>> unicodedata.decimal('\\N{SUPERSCRIPT NINE}', -1)\n" +#~ "-1" +#~ msgstr "" +#~ ">>> unicodedata.decimal('\\N{ARABIC-INDIC DIGIT NINE}')\n" +#~ "9\n" +#~ ">>> unicodedata.decimal('\\N{SUPERSCRIPT NINE}', -1)\n" +#~ "-1" + +#~ msgid "" +#~ ">>> unicodedata.digit('\\N{SUPERSCRIPT NINE}')\n" +#~ "9" +#~ msgstr "" +#~ ">>> unicodedata.digit('\\N{SUPERSCRIPT NINE}')\n" +#~ "9" + +#~ msgid "" +#~ ">>> unicodedata.numeric('½')\n" +#~ "0.5" +#~ msgstr "" +#~ ">>> unicodedata.numeric('½')\n" +#~ "0.5" + +#~ msgid "" +#~ ">>> unicodedata.category('A') # 'L'etter, 'u'ppercase\n" +#~ "'Lu'" +#~ msgstr "" +#~ ">>> unicodedata.category('A') # 'L'etter, 'u'ppercase\n" +#~ "'Lu'" + +#~ msgid "" +#~ ">>> unicodedata.bidirectional('\\N{ARABIC-INDIC DIGIT SEVEN}') # " +#~ "'A'rabic, 'N'umber\n" +#~ "'AN'" +#~ msgstr "" +#~ ">>> unicodedata.bidirectional('\\N{ARABIC-INDIC DIGIT SEVEN}') # " +#~ "'A'rabic, 'N'umber\n" +#~ "'AN'" + +#~ msgid "" +#~ ">>> unicodedata.mirrored('>')\n" +#~ "1" +#~ msgstr "" +#~ ">>> unicodedata.mirrored('>')\n" +#~ "1" + +#~ msgid "" +#~ ">>> unicodedata.decomposition('Ã')\n" +#~ "'0041 0303'" +#~ msgstr "" +#~ ">>> unicodedata.decomposition('Ã')\n" +#~ "'0041 0303'" diff --git a/library/unittest.mock.po b/library/unittest.mock.po index fbcb6ac51a2..f8deb1273f1 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-09 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-02-19 21:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,15 +50,15 @@ msgstr "" #: ../../library/unittest.mock.rst:26 msgid "" "Additionally, mock provides a :func:`patch` decorator that handles patching " -"module and class level attributes within the scope of a test, along with :" -"const:`sentinel` for creating unique objects. See the `quick guide`_ for " -"some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" -"`patch`." +"module and class level attributes within the scope of a test, along " +"with :const:`sentinel` for creating unique objects. See the `quick guide`_ " +"for some examples of how to use :class:`Mock`, :class:`MagicMock` " +"and :func:`patch`." msgstr "" "此外,mock 還提供了一個 :func:`patch` 裝飾器,用於 patching 測試範圍內對 " -"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件的 :const:" -"`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` 和 :func:" -"`patch` 的一些範例,請參閱\\ `快速導引 `_。" +"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件" +"的 :const:`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` " +"和 :func:`patch` 的一些範例,請參閱\\ `快速導引 `_。" #: ../../library/unittest.mock.rst:32 msgid "" @@ -222,11 +222,11 @@ msgid "" "replacing, and any functions and methods (including constructors) have the " "same call signature as the real object." msgstr "" -"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用\\ :" -"ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch 的 " -"*autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock 物" -"件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函式)" -"都具有與真實物件相同的呼叫簽名(call signature)。" +"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用" +"\\ :ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch " +"的 *autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock " +"物件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函" +"式)都具有與真實物件相同的呼叫簽名(call signature)。" #: ../../library/unittest.mock.rst:177 msgid "" @@ -264,12 +264,12 @@ msgstr "" msgid "" ":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods " "pre-created and ready to use. There are also non-callable variants, useful " -"when you are mocking out objects that aren't callable: :class:" -"`NonCallableMock` and :class:`NonCallableMagicMock`" +"when you are mocking out objects that aren't " +"callable: :class:`NonCallableMock` and :class:`NonCallableMagicMock`" msgstr "" ":class:`MagicMock` 是 :class:`Mock` 的子類別,其中所有魔術方法均已預先建立並" -"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有用::class:" -"`NonCallableMock` 和 :class:`NonCallableMagicMock`" +"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有" +"用::class:`NonCallableMock` 和 :class:`NonCallableMagicMock`" #: ../../library/unittest.mock.rst:224 msgid "" @@ -279,8 +279,8 @@ msgid "" "class of :class:`Mock` using the *new_callable* argument to :func:`patch`." msgstr "" ":func:`patch` 裝飾器可以輕鬆地用 :class:`Mock` 物件臨時替換特定模組中的類別。" -"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使用 :" -"func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" +"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使" +"用 :func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" #: ../../library/unittest.mock.rst:232 msgid "" @@ -300,18 +300,18 @@ msgid "" msgstr "" "*spec*:這可以是字串的 list(串列),也可以是充當 mock 物件規格的現有物件(類" "別或實例)。如果傳入一個物件,則通過對該物件呼叫 dir 來形成字串的串列(不包括" -"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引發 :exc:" -"`AttributeError`。" +"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引" +"發 :exc:`AttributeError`。" #: ../../library/unittest.mock.rst:241 msgid "" -"If *spec* is an object (rather than a list of strings) then :attr:`~object." -"__class__` returns the class of the spec object. This allows mocks to pass :" -"func:`isinstance` tests." +"If *spec* is an object (rather than a list of strings) " +"then :attr:`~object.__class__` returns the class of the spec object. This " +"allows mocks to pass :func:`isinstance` tests." msgstr "" -"如果 *spec* 是一個物件(而不是一個字串的串列),那麼 :attr:`~object." -"__class__` 會回傳 spec 物件的類別。這允許 mocks 通過 :func:`isinstance` 測" -"試。" +"如果 *spec* 是一個物件(而不是一個字串的串列),那" +"麼 :attr:`~object.__class__` 會回傳 spec 物件的類別。這允許 mocks 通" +"過 :func:`isinstance` 測試。" #: ../../library/unittest.mock.rst:245 msgid "" @@ -320,13 +320,13 @@ msgid "" "will raise an :exc:`AttributeError`." msgstr "" "*spec_set*:*spec* 的一個更嚴格的變體。如果使用 *spec_set*,在 mock 上嘗試 " -"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引發 :exc:" -"`AttributeError`。" +"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引" +"發 :exc:`AttributeError`。" #: ../../library/unittest.mock.rst:249 msgid "" -"*side_effect*: A function to be called whenever the Mock is called. See the :" -"attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " +"*side_effect*: A function to be called whenever the Mock is called. See " +"the :attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " "dynamically changing return values. The function is called with the same " "arguments as the mock, and unless it returns :data:`DEFAULT`, the return " "value of this function is used as the return value." @@ -367,8 +367,8 @@ msgstr "" #: ../../library/unittest.mock.rst:267 msgid "" "*unsafe*: By default, accessing any attribute whose name starts with " -"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise an :exc:" -"`AttributeError`. Passing ``unsafe=True`` will allow access to these " +"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise " +"an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to these " "attributes." msgstr "" "*unsafe*:預設情況下,存取任何以 *assert*、*assret*、*asert*、*aseert* 或 " @@ -381,13 +381,13 @@ msgid "" "calling the Mock will pass the call through to the wrapped object (returning " "the real result). Attribute access on the mock will return a Mock object " "that wraps the corresponding attribute of the wrapped object (so attempting " -"to access an attribute that doesn't exist will raise an :exc:" -"`AttributeError`)." +"to access an attribute that doesn't exist will raise " +"an :exc:`AttributeError`)." msgstr "" "*wraps*:被 mock 物件包裝的項目。如果 *wraps* 不是 ``None``,那麼呼叫 Mock 將" "通過被包裝的物件(回傳真實結果)。存取 mock 的屬性將會回傳一個 Mock 物件,該" -"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引發 :exc:" -"`AttributeError`\\ )。" +"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引" +"發 :exc:`AttributeError`\\ )。" #: ../../library/unittest.mock.rst:281 msgid "" @@ -408,8 +408,8 @@ msgstr "" #: ../../library/unittest.mock.rst:288 msgid "" "Mocks can also be called with arbitrary keyword arguments. These will be " -"used to set attributes on the mock after it is created. See the :meth:" -"`configure_mock` method for details." +"used to set attributes on the mock after it is created. See " +"the :meth:`configure_mock` method for details." msgstr "" "Mocks 還可以使用任意的關鍵字引數進行呼叫。這些關鍵字引數將在建立 mock 之後用" "於設定 mock 的屬性。欲知更多,請參見 :meth:`configure_mock` 方法。" @@ -440,19 +440,19 @@ msgstr "斷言 mock 已經被使用指定的引數呼叫。" #: ../../library/unittest.mock.rst:351 msgid "" -"The assert passes if the mock has *ever* been called, unlike :meth:" -"`assert_called_with` and :meth:`assert_called_once_with` that only pass if " -"the call is the most recent one, and in the case of :meth:" -"`assert_called_once_with` it must also be the only call." +"The assert passes if the mock has *ever* been called, " +"unlike :meth:`assert_called_with` and :meth:`assert_called_once_with` that " +"only pass if the call is the most recent one, and in the case " +"of :meth:`assert_called_once_with` it must also be the only call." msgstr "" -"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` 和 :" -"meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對於 :meth:" -"`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" +"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` " +"和 :meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對" +"於 :meth:`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" #: ../../library/unittest.mock.rst:364 msgid "" -"assert the mock has been called with the specified calls. The :attr:" -"`mock_calls` list is checked for the calls." +"assert the mock has been called with the specified calls. " +"The :attr:`mock_calls` list is checked for the calls." msgstr "" "斷言 mock 已經使用指定的呼叫方式來呼叫。此斷言會檢查 :attr:`mock_calls` 串列" "中的呼叫。" @@ -553,9 +553,9 @@ msgstr "" #: ../../library/unittest.mock.rst:441 msgid "" -"Note that :meth:`reset_mock` *doesn't* clear the :attr:`return_value`, :attr:" -"`side_effect` or any child attributes you have set using normal assignment " -"by default." +"Note that :meth:`reset_mock` *doesn't* clear " +"the :attr:`return_value`, :attr:`side_effect` or any child attributes you " +"have set using normal assignment by default." msgstr "" #: ../../library/unittest.mock.rst:445 @@ -581,8 +581,8 @@ msgstr "如果 *spec_set* 為 true,那麼只能設定在規格中的屬性。" #: ../../library/unittest.mock.rst:461 msgid "" "Attach a mock as an attribute of this one, replacing its name and parent. " -"Calls to the attached mock will be recorded in the :attr:`method_calls` and :" -"attr:`mock_calls` attributes of this one." +"Calls to the attached mock will be recorded in the :attr:`method_calls` " +"and :attr:`mock_calls` attributes of this one." msgstr "" "將一個 mock 作為這個 Mock 的屬性附加,取代它的名稱和上代 (parent)。對附加的 " "mock 的呼叫將被記錄在這個 Mock 的 :attr:`method_calls` 和 :attr:`mock_calls` " @@ -679,17 +679,17 @@ msgid "" "returns :data:`DEFAULT` then the mock will return its normal value (from " "the :attr:`return_value`)." msgstr "" -"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回傳 :data:" -"`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何值。如果函" -"式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值(從 :attr:" -"`return_value` 得到)。" +"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回" +"傳 :data:`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何" +"值。如果函式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值" +"(從 :attr:`return_value` 得到)。" #: ../../library/unittest.mock.rst:583 msgid "" "If you pass in an iterable, it is used to retrieve an iterator which must " "yield a value on every call. This value can either be an exception instance " -"to be raised, or a value to be returned from the call to the mock (:data:" -"`DEFAULT` handling is identical to the function case)." +"to be raised, or a value to be returned from the call to the mock " +"(:data:`DEFAULT` handling is identical to the function case)." msgstr "" "如果你傳遞一個可疊代物件,它將被用於檢索一個疊代器,該疊代器必須在每次呼叫時" "產出 (yield) 一個值。這個值可以是要引發的例外實例,或者是對 mock 呼叫時要回傳" @@ -722,13 +722,14 @@ msgid "Setting :attr:`side_effect` to ``None`` clears it:" msgstr "將 :attr:`side_effect` 設定為 ``None`` 可以清除它:" #: ../../library/unittest.mock.rst:639 +#, fuzzy msgid "" "This is either ``None`` (if the mock hasn't been called), or the arguments " "that the mock was last called with. This will be in the form of a tuple: the " "first member, which can also be accessed through the ``args`` property, is " -"any positional arguments the mock was called with (or an empty tuple) and " -"the second member, which can also be accessed through the ``kwargs`` " -"property, is any keyword arguments (or an empty dictionary)." +"any ordered arguments the mock was called with (or an empty tuple) and the " +"second member, which can also be accessed through the ``kwargs`` property, " +"is any keyword arguments (or an empty dictionary)." msgstr "" "這會是 ``None``\\ (如果 mock 尚未被呼叫),或是 mock 上次被呼叫時使用的引" "數。這將以元組的形式呈現:第一個成員 (member),其可以通過 ``args`` 屬性存取," @@ -737,14 +738,15 @@ msgstr "" #: ../../library/unittest.mock.rst:672 msgid "" -":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :" -"attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These " -"are tuples, so they can be unpacked to get at the individual arguments and " -"make more complex assertions. See :ref:`calls as tuples `." +":attr:`call_args`, along with members of the " +"lists :attr:`call_args_list`, :attr:`method_calls` and :attr:`mock_calls` " +"are :data:`call` objects. These are tuples, so they can be unpacked to get " +"at the individual arguments and make more complex assertions. " +"See :ref:`calls as tuples `." msgstr "" -":attr:`call_args`,以及串列 :attr:`call_args_list`、:attr:`method_calls` 和 :" -"attr:`mock_calls` 的成員都是 :data:`call` 物件。這些都是元組,因此可以解包以" -"取得各個引數並進行更複雜的斷言。參見 :ref:`calls as tuples `。" #: ../../library/unittest.mock.rst:678 @@ -756,8 +758,8 @@ msgid "" "This is a list of all the calls made to the mock object in sequence (so the " "length of the list is the number of times it has been called). Before any " "calls have been made it is an empty list. The :data:`call` object can be " -"used for conveniently constructing lists of calls to compare with :attr:" -"`call_args_list`." +"used for conveniently constructing lists of calls to compare " +"with :attr:`call_args_list`." msgstr "" "這是按順序列出所有呼叫 mock 物件的串列(因此串列的長度表示它被呼叫的次數)。" "在任何呼叫發生之前,它會是一個空的串列。 :data:`call` 物件可用於方便地建構呼" @@ -828,8 +830,8 @@ msgstr "" #: ../../library/unittest.mock.rst:772 msgid "" -":attr:`!__class__` is assignable to, this allows a mock to pass an :func:" -"`isinstance` check without forcing you to use a spec:" +":attr:`!__class__` is assignable to, this allows a mock to pass " +"an :func:`isinstance` check without forcing you to use a spec:" msgstr "" ":attr:`!__class__` 可以被指定,這允許 mock 通過 :func:`isinstance` 檢查,而不" "需要強制使用 spec:" @@ -848,13 +850,13 @@ msgid "" "Mock objects that use a class or an instance as a :attr:`!spec` or :attr:`!" "spec_set` are able to pass :func:`isinstance` tests:" msgstr "" -"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通過 :" -"func:`isinstance` 測試:" +"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通" +"過 :func:`isinstance` 測試:" #: ../../library/unittest.mock.rst:796 msgid "" -"The :class:`Mock` classes have support for mocking magic methods. See :ref:" -"`magic methods ` for the full details." +"The :class:`Mock` classes have support for mocking magic methods. " +"See :ref:`magic methods ` for the full details." msgstr "" ":class:`Mock` 類別支援 mock 魔術方法。細節請參考\\ :ref:`魔術方法 `。" @@ -866,9 +868,9 @@ msgid "" "are passed to the constructor of the mock being created. The keyword " "arguments are for configuring attributes of the mock:" msgstr "" -"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對於 :func:" -"`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵字引數用" -"於配置 mock 的屬性:" +"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對" +"於 :func:`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵" +"字引數用於配置 mock 的屬性:" #: ../../library/unittest.mock.rst:810 msgid "" @@ -910,15 +912,15 @@ msgstr "" #: ../../library/unittest.mock.rst:838 msgid "" -"This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock." -"assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." -"assert_any_call`. When :ref:`auto-speccing`, it will also apply to method " -"calls on the mock object." +"This applies " +"to :meth:`~Mock.assert_called_with`, :meth:`~Mock.assert_called_once_with`, :meth:`~Mock.assert_has_calls` " +"and :meth:`~Mock.assert_any_call`. When :ref:`auto-speccing`, it will also " +"apply to method calls on the mock object." msgstr "" -"這適用於 :meth:`~Mock.assert_called_with`、:meth:`~Mock." -"assert_called_once_with`、:meth:`~Mock.assert_has_calls` 和 :meth:`~Mock." -"assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 mock 物件的方法" -"呼叫。" +"這適用" +"於 :meth:`~Mock.assert_called_with`、:meth:`~Mock.assert_called_once_with`、:meth:`~Mock.assert_has_calls` " +"和 :meth:`~Mock.assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 " +"mock 物件的方法呼叫。" #: ../../library/unittest.mock.rst:843 msgid "Added signature introspection on specced and autospecced mock objects." @@ -928,14 +930,14 @@ msgstr "" #: ../../library/unittest.mock.rst:849 msgid "" -"A mock intended to be used as a :class:`property`, or other :term:" -"`descriptor`, on a class. :class:`PropertyMock` provides :meth:`~object." -"__get__` and :meth:`~object.__set__` methods so you can specify a return " -"value when it is fetched." +"A mock intended to be used as a :class:`property`, or " +"other :term:`descriptor`, on a class. :class:`PropertyMock` " +"provides :meth:`~object.__get__` and :meth:`~object.__set__` methods so you " +"can specify a return value when it is fetched." msgstr "" -"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 mock。:" -"class:`PropertyMock` 提供了 :meth:`~object.__get__` 和 :meth:`~object." -"__set__` 方法,因此你可以在它被提取時指定回傳值。" +"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 " +"mock。:class:`PropertyMock` 提供了 :meth:`~object.__get__` " +"和 :meth:`~object.__set__` 方法,因此你可以在它被提取時指定回傳值。" #: ../../library/unittest.mock.rst:854 msgid "" @@ -985,9 +987,9 @@ msgstr "" #: ../../library/unittest.mock.rst:875 msgid "" -"Because of the way mock attributes are stored you can't directly attach a :" -"class:`PropertyMock` to a mock object. Instead you can attach it to the mock " -"type object::" +"Because of the way mock attributes are stored you can't directly attach " +"a :class:`PropertyMock` to a mock object. Instead you can attach it to the " +"mock type object::" msgstr "" "由於 mock 屬性的儲存方式,你無法直接將 :class:`PropertyMock` 附加到 mock 物" "件。但是你可以將其附加到 mock 型別的物件: ::" @@ -1090,18 +1092,18 @@ msgstr "" #: ../../library/unittest.mock.rst:940 msgid "" -"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, or :class:" -"`AsyncMock` to a class with asynchronous and synchronous functions will " -"automatically detect the synchronous functions and set them as :class:" -"`MagicMock` (if the parent mock is :class:`AsyncMock` or :class:`MagicMock`) " -"or :class:`Mock` (if the parent mock is :class:`Mock`). All asynchronous " -"functions will be :class:`AsyncMock`." +"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, " +"or :class:`AsyncMock` to a class with asynchronous and synchronous functions " +"will automatically detect the synchronous functions and set them " +"as :class:`MagicMock` (if the parent mock is :class:`AsyncMock` " +"or :class:`MagicMock`) or :class:`Mock` (if the parent mock " +"is :class:`Mock`). All asynchronous functions will be :class:`AsyncMock`." msgstr "" "將 :class:`Mock`、:class:`MagicMock` 或 :class:`AsyncMock` 的 *spec* 設定為具" -"有同步和非同步函式的類別,會自動檢測同步函式並將其設定為 :class:" -"`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` 或 :class:" -"`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock 為 :class:`Mock`\\ )。所" -"有非同步函式將被設定為 :class:`AsyncMock`。" +"有同步和非同步函式的類別,會自動檢測同步函式並將其設定" +"為 :class:`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` " +"或 :class:`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock " +"為 :class:`Mock`\\ )。所有非同步函式將被設定為 :class:`AsyncMock`。" #: ../../library/unittest.mock.rst:968 msgid "" @@ -1131,8 +1133,8 @@ msgstr "斷言 mock 曾經被使用指定的引數等待過。" #: ../../library/unittest.mock.rst:1053 msgid "" -"Assert the mock has been awaited with the specified calls. The :attr:" -"`await_args_list` list is checked for the awaits." +"Assert the mock has been awaited with the specified calls. " +"The :attr:`await_args_list` list is checked for the awaits." msgstr "" "斷言 mock 已被使用指定的呼叫進行等待。:attr:`await_args_list` 串列將被檢查以" "確認等待的內容。" @@ -1150,8 +1152,8 @@ msgid "" "If *any_order* is true then the awaits can be in any order, but they must " "all appear in :attr:`await_args_list`." msgstr "" -"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現在 :" -"attr:`await_args_list` 中。" +"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現" +"在 :attr:`await_args_list` 中。" #: ../../library/unittest.mock.rst:1080 msgid "Assert that the mock was never awaited." @@ -1159,11 +1161,11 @@ msgstr "斷言 mock 從未被等待。" #: ../../library/unittest.mock.rst:1087 msgid "" -"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to 0, :attr:" -"`await_args` to None, and clears the :attr:`await_args_list`." +"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to " +"0, :attr:`await_args` to None, and clears the :attr:`await_args_list`." msgstr "" -"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 0,:attr:" -"`await_args` 設定為 None,並清除 :attr:`await_args_list`。" +"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 " +"0,:attr:`await_args` 設定為 None,並清除 :attr:`await_args_list`。" #: ../../library/unittest.mock.rst:1092 msgid "" @@ -1173,8 +1175,8 @@ msgstr "一個整數,用來記錄 mock 物件已被等待的次數。" #: ../../library/unittest.mock.rst:1107 msgid "" "This is either ``None`` (if the mock hasn’t been awaited), or the arguments " -"that the mock was last awaited with. Functions the same as :attr:`Mock." -"call_args`." +"that the mock was last awaited with. Functions the same " +"as :attr:`Mock.call_args`." msgstr "" "這可能是 ``None``\\ (如果 mock 尚未被等待),或者是上次等待 mock 時使用的引" "數。與 :attr:`Mock.call_args` 的功能相同。" @@ -1190,9 +1192,9 @@ msgstr "" #: ../../library/unittest.mock.rst:1145 msgid "" -"A version of :class:`MagicMock` for multithreading tests. The :class:" -"`ThreadingMock` object provides extra methods to wait for a call to be " -"invoked, rather than assert on it immediately." +"A version of :class:`MagicMock` for multithreading tests. " +"The :class:`ThreadingMock` object provides extra methods to wait for a call " +"to be invoked, rather than assert on it immediately." msgstr "" #: ../../library/unittest.mock.rst:1149 @@ -1204,8 +1206,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1152 msgid "" -"You can configure the global default timeout by setting :attr:`ThreadingMock." -"DEFAULT_TIMEOUT`." +"You can configure the global default timeout by " +"setting :attr:`ThreadingMock.DEFAULT_TIMEOUT`." msgstr "" #: ../../library/unittest.mock.rst:1156 @@ -1225,14 +1227,14 @@ msgstr "等到直到 mock 被以特定引數呼叫。" #: ../../library/unittest.mock.rst:1172 msgid "" -"If a timeout was passed at the creation of the mock the function raises an :" -"exc:`AssertionError` if the call is not performed in time." +"If a timeout was passed at the creation of the mock the function raises " +"an :exc:`AssertionError` if the call is not performed in time." msgstr "" #: ../../library/unittest.mock.rst:1183 msgid "" -"Global default timeout in seconds to create instances of :class:" -"`ThreadingMock`." +"Global default timeout in seconds to create instances " +"of :class:`ThreadingMock`." msgstr "" #: ../../library/unittest.mock.rst:1189 @@ -1241,11 +1243,11 @@ msgstr "呼叫" #: ../../library/unittest.mock.rst:1191 msgid "" -"Mock objects are callable. The call will return the value set as the :attr:" -"`~Mock.return_value` attribute. The default return value is a new Mock " -"object; it is created the first time the return value is accessed (either " -"explicitly or by calling the Mock) - but it is stored and the same one " -"returned each time." +"Mock objects are callable. The call will return the value set as " +"the :attr:`~Mock.return_value` attribute. The default return value is a new " +"Mock object; it is created the first time the return value is accessed " +"(either explicitly or by calling the Mock) - but it is stored and the same " +"one returned each time." msgstr "" "Mock 物件可被呼叫。呼叫將回傳設定為 :attr:`~Mock.return_value` 屬性的值。預設" "的回傳值是一個新的 Mock 物件;它會在第一次存取回傳值時(無論是顯式存取還是透" @@ -1253,11 +1255,11 @@ msgstr "" #: ../../library/unittest.mock.rst:1197 msgid "" -"Calls made to the object will be recorded in the attributes like :attr:" -"`~Mock.call_args` and :attr:`~Mock.call_args_list`." +"Calls made to the object will be recorded in the attributes " +"like :attr:`~Mock.call_args` and :attr:`~Mock.call_args_list`." msgstr "" -"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` 和 :attr:`~Mock." -"call_args_list` 等屬性中。" +"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` " +"和 :attr:`~Mock.call_args_list` 等屬性中。" #: ../../library/unittest.mock.rst:1200 msgid "" @@ -1270,8 +1272,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1204 msgid "" -"The simplest way to make a mock raise an exception when called is to make :" -"attr:`~Mock.side_effect` an exception class or instance:" +"The simplest way to make a mock raise an exception when called is to " +"make :attr:`~Mock.side_effect` an exception class or instance:" msgstr "" "呼叫 mock 時引發例外的最簡單方式是將 :attr:`~Mock.side_effect` 設定為例外類別" "或實例:" @@ -1295,8 +1297,8 @@ msgid "" "return :data:`DEFAULT`:" msgstr "" "如果你希望 mock 仍然回傳預設的回傳值(一個新的 mock),或者是任何已設定的回傳" -"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回傳 :attr:`~Mock." -"return_value`,或回傳 :data:`DEFAULT`:" +"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回" +"傳 :attr:`~Mock.return_value`,或回傳 :data:`DEFAULT`:" #: ../../library/unittest.mock.rst:1257 msgid "" @@ -1371,8 +1373,8 @@ msgid "" "You \"block\" attributes by deleting them. Once deleted, accessing an " "attribute will raise an :exc:`AttributeError`." msgstr "" -"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引發 :exc:" -"`AttributeError`。" +"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引" +"發 :exc:`AttributeError`。" #: ../../library/unittest.mock.rst:1331 msgid "Mock names and the name attribute" @@ -1382,8 +1384,8 @@ msgstr "Mock 名稱與名稱屬性" msgid "" "Since \"name\" is an argument to the :class:`Mock` constructor, if you want " "your mock object to have a \"name\" attribute you can't just pass it in at " -"creation time. There are two alternatives. One option is to use :meth:`~Mock." -"configure_mock`::" +"creation time. There are two alternatives. One option is to " +"use :meth:`~Mock.configure_mock`::" msgstr "" "由於 \"name\" 是傳遞給 :class:`Mock` 建構函式的引數,如果你想讓你的 mock 物件" "擁有 \"name\" 屬性,你不能在建立時直接傳遞它。有兩種替代方法。其中一個選擇是" @@ -1446,8 +1448,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1381 msgid "" "Mocks created for you by :func:`patch` are automatically given names. To " -"attach mocks that have names to a parent you use the :meth:`~Mock." -"attach_mock` method::" +"attach mocks that have names to a parent you use " +"the :meth:`~Mock.attach_mock` method::" msgstr "" "由 :func:`patch` 為你建立的 mock 會自動被賦予名稱。若要將具有名稱的 mock 附加" "到上代,你可以使用 :meth:`~Mock.attach_mock` 方法: ::" @@ -1489,10 +1491,10 @@ msgid "" "a new Mock object when it expects a magic method. If you need magic method " "support see :ref:`magic methods `." msgstr "" -"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引發 :" -"exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到一個" -"魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需要魔" -"術方法的支援,請參閱\\ :ref:`魔術方法 `。" +"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引" +"發 :exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到" +"一個魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需" +"要魔術方法的支援,請參閱\\ :ref:`魔術方法 `。" #: ../../library/unittest.mock.rst:1408 msgid "The patchers" @@ -1539,10 +1541,11 @@ msgid "" "If :func:`patch` is used as a context manager the created mock is returned " "by the context manager." msgstr "" -"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換為 :class:" -"`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做為裝飾器使" -"用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函式。如果 :" -"func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回傳。" +"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換" +"為 :class:`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做" +"為裝飾器使用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函" +"式。如果 :func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回" +"傳。" #: ../../library/unittest.mock.rst:1438 msgid "" @@ -1553,14 +1556,14 @@ msgid "" "function is executed, not at decoration time." msgstr "" "*target* 應該是以 ``'package.module.ClassName'`` 形式出現的字串。*target* 會" -"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼叫 :func:" -"`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝飾器作用" -"時 (decoration time)。" +"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼" +"叫 :func:`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝" +"飾器作用時 (decoration time)。" #: ../../library/unittest.mock.rst:1444 msgid "" -"The *spec* and *spec_set* keyword arguments are passed to the :class:" -"`MagicMock` if patch is creating one for you." +"The *spec* and *spec_set* keyword arguments are passed to " +"the :class:`MagicMock` if patch is creating one for you." msgstr "" "*spec* 和 *spec_set* 關鍵字引數會傳遞給 :class:`MagicMock`,如果 patch 正在為" "你建立一個。" @@ -1576,8 +1579,9 @@ msgstr "" #: ../../library/unittest.mock.rst:1450 msgid "" "*new_callable* allows you to specify a different class, or callable object, " -"that will be called to create the *new* object. By default :class:" -"`AsyncMock` is used for async functions and :class:`MagicMock` for the rest." +"that will be called to create the *new* object. By " +"default :class:`AsyncMock` is used for async functions " +"and :class:`MagicMock` for the rest." msgstr "" "*new_callable* 允許你指定一個不同的類別或可呼叫的物件,用於被呼叫並建立 " "*new* 物件。預設情況下,對於非同步函式使用 :class:`AsyncMock`,而對於其他情況" @@ -1591,15 +1595,15 @@ msgid "" "attribute of the object being replaced. Methods and functions being mocked " "will have their arguments checked and will raise a :exc:`TypeError` if they " "are called with the wrong signature. For mocks replacing a class, their " -"return value (the 'instance') will have the same spec as the class. See the :" -"func:`create_autospec` function and :ref:`auto-speccing`." +"return value (the 'instance') will have the same spec as the class. See " +"the :func:`create_autospec` function and :ref:`auto-speccing`." msgstr "" "*spec* 的一種更強大的形式是 *autospec*。如果你設定 ``autospec=True``,則該 " "mock 將使用被替換物件的規格來建立。該 mock 的所有屬性也將具有被替換物件的對應" "屬性的規格。被 mock 的方法和函式將檢查其引數,如果呼叫時引數與規格不符(被使" "用錯誤的簽名 (signature) 呼叫),將引發 :exc:`TypeError`。對於替換類別的 " -"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參閱 :func:" -"`create_autospec` 函式和 :ref:`auto-speccing`。" +"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參" +"閱 :func:`create_autospec` 函式和 :ref:`auto-speccing`。" #: ../../library/unittest.mock.rst:1464 msgid "" @@ -1638,10 +1642,10 @@ msgid "" "Patch can be used as a :class:`~unittest.TestCase` class decorator. It works " "by decorating each test method in the class. This reduces the boilerplate " "code when your test methods share a common patchings set. :func:`patch` " -"finds tests by looking for method names that start with ``patch." -"TEST_PREFIX``. By default this is ``'test'``, which matches the way :mod:" -"`unittest` finds tests. You can specify an alternative prefix by setting " -"``patch.TEST_PREFIX``." +"finds tests by looking for method names that start with " +"``patch.TEST_PREFIX``. By default this is ``'test'``, which matches the " +"way :mod:`unittest` finds tests. You can specify an alternative prefix by " +"setting ``patch.TEST_PREFIX``." msgstr "" "patch 可以做為 :class:`~unittest.TestCase` 類別的裝飾器使用。它透過裝飾類別中" "的每個測試方法來運作。當你的測試方法共享一組常見的 patch 時,這會減少繁冗的代" @@ -1662,9 +1666,9 @@ msgstr "" #: ../../library/unittest.mock.rst:1493 msgid "" -":func:`patch` takes arbitrary keyword arguments. These will be passed to :" -"class:`AsyncMock` if the patched object is asynchronous, to :class:" -"`MagicMock` otherwise or to *new_callable* if specified." +":func:`patch` takes arbitrary keyword arguments. These will be passed " +"to :class:`AsyncMock` if the patched object is asynchronous, " +"to :class:`MagicMock` otherwise or to *new_callable* if specified." msgstr "" ":func:`patch` 接受任意的關鍵字引數。如果被 patch 的物件是非同步的,這些將會被" "傳遞給 :class:`AsyncMock`,如果是同步的則會傳遞給 :class:`MagicMock`,或如果" @@ -1704,18 +1708,18 @@ msgstr "" #: ../../library/unittest.mock.rst:1510 msgid "" "Patching a class replaces the class with a :class:`MagicMock` *instance*. If " -"the class is instantiated in the code under test then it will be the :attr:" -"`~Mock.return_value` of the mock that will be used." +"the class is instantiated in the code under test then it will be " +"the :attr:`~Mock.return_value` of the mock that will be used." msgstr "" "Patch 一個類別會以 :class:`MagicMock`\\ *實例*\\ 取代該類別。如果該類別在被" -"測試的程式碼中實例化,那麼它將是會被使用的 mock 的 :attr:`~Mock." -"return_value`。" +"測試的程式碼中實例化,那麼它將是會被使用的 mock " +"的 :attr:`~Mock.return_value`。" #: ../../library/unittest.mock.rst:1514 msgid "" -"If the class is instantiated multiple times you could use :attr:`~Mock." -"side_effect` to return a new mock each time. Alternatively you can set the " -"*return_value* to be anything you want." +"If the class is instantiated multiple times you could " +"use :attr:`~Mock.side_effect` to return a new mock each time. Alternatively " +"you can set the *return_value* to be anything you want." msgstr "" "如果該類別被實例化多次,你可以使用 :attr:`~Mock.side_effect` 來每次回傳一個新" "的 mock。 或者你可以將 *return_value* 設定成你想要的任何值。" @@ -1725,8 +1729,8 @@ msgid "" "To configure return values on methods of *instances* on the patched class " "you must do this on the :attr:`~Mock.return_value`. For example::" msgstr "" -"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須在 :attr:`~Mock." -"return_value` 上進行配置。例如: ::" +"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須" +"在 :attr:`~Mock.return_value` 上進行配置。例如: ::" #: ../../library/unittest.mock.rst:1521 msgid "" @@ -1867,16 +1871,16 @@ msgstr "" #: ../../library/unittest.mock.rst:1580 msgid "" -"As well as attributes on the created mock attributes, like the :attr:`~Mock." -"return_value` and :attr:`~Mock.side_effect`, of child mocks can also be " -"configured. These aren't syntactically valid to pass in directly as keyword " -"arguments, but a dictionary with these as keys can still be expanded into a :" -"func:`patch` call using ``**``::" +"As well as attributes on the created mock attributes, like " +"the :attr:`~Mock.return_value` and :attr:`~Mock.side_effect`, of child mocks " +"can also be configured. These aren't syntactically valid to pass in directly " +"as keyword arguments, but a dictionary with these as keys can still be " +"expanded into a :func:`patch` call using ``**``::" msgstr "" -"除了被建立的 mock 上的屬性外,還可以配置 child mock 的 :attr:`~Mock." -"return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能直接作為關鍵字引" -"數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一個 :func:`patch` 呼" -"叫: ::" +"除了被建立的 mock 上的屬性外,還可以配置 child mock " +"的 :attr:`~Mock.return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能" +"直接作為關鍵字引數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一" +"個 :func:`patch` 呼叫: ::" #: ../../library/unittest.mock.rst:1586 msgid "" @@ -1903,8 +1907,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1596 msgid "" "By default, attempting to patch a function in a module (or a method or an " -"attribute in a class) that does not exist will fail with :exc:" -"`AttributeError`::" +"attribute in a class) that does not exist will fail " +"with :exc:`AttributeError`::" msgstr "" "預設情況下,嘗試 patch 模組中不存在的函式(或類別中的方法或屬性)將會失敗,並" "引發 :exc:`AttributeError`: ::" @@ -1976,19 +1980,19 @@ msgstr "" msgid "" ":func:`patch.object` can be used as a decorator, class decorator or a " "context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* " -"and *new_callable* have the same meaning as for :func:`patch`. Like :func:" -"`patch`, :func:`patch.object` takes arbitrary keyword arguments for " -"configuring the mock object it creates." +"and *new_callable* have the same meaning as for :func:`patch`. " +"Like :func:`patch`, :func:`patch.object` takes arbitrary keyword arguments " +"for configuring the mock object it creates." msgstr "" ":func:`patch.object` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 *new*、" -"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與在 :func:" -"`patch` 中的引數具有相同的意義。與 :func:`patch` 一樣,:func:`patch.object` " -"接受任意關鍵字引數來配置它所建立的 mock 物件。" +"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與" +"在 :func:`patch` 中的引數具有相同的意義。與 :func:`patch` 一" +"樣,:func:`patch.object` 接受任意關鍵字引數來配置它所建立的 mock 物件。" #: ../../library/unittest.mock.rst:1636 msgid "" -"When used as a class decorator :func:`patch.object` honours ``patch." -"TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.object` honours " +"``patch.TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.object` 會遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" @@ -2024,12 +2028,14 @@ msgid "patch.dict" msgstr "patch.dict" #: ../../library/unittest.mock.rst:1663 +#, fuzzy msgid "" "Patch a dictionary, or dictionary like object, and restore the dictionary to " -"its original state after the test." +"its original state after the test, where the restored dictionary is a copy " +"of the dictionary as it was before the test." msgstr "Patch 字典或類字典的物件,並在測試後將字典回復到其原本的狀態。" -#: ../../library/unittest.mock.rst:1666 +#: ../../library/unittest.mock.rst:1667 msgid "" "*in_dict* can be a dictionary or a mapping like container. If it is a " "mapping then it must at least support getting, setting and deleting items " @@ -2038,13 +2044,13 @@ msgstr "" "*in_dict* 可以是一個字典或一個類對映的容器。如果它是一個對映,那麼它至少必須" "支援取得、設定、刪除項目以及對鍵的疊代。" -#: ../../library/unittest.mock.rst:1670 +#: ../../library/unittest.mock.rst:1671 msgid "" "*in_dict* can also be a string specifying the name of the dictionary, which " "will then be fetched by importing it." msgstr "*in_dict* 也可以是指定字典名稱的字串,然後透過 import 來取得該字典。" -#: ../../library/unittest.mock.rst:1673 +#: ../../library/unittest.mock.rst:1674 msgid "" "*values* can be a dictionary of values to set in the dictionary. *values* " "can also be an iterable of ``(key, value)`` pairs." @@ -2052,39 +2058,40 @@ msgstr "" "*values* 可以是要設定的值的字典。*values* 也可以是 ``(key, value)`` 對 " "(pairs) 的可疊代物件。" -#: ../../library/unittest.mock.rst:1676 +#: ../../library/unittest.mock.rst:1677 msgid "" "If *clear* is true then the dictionary will be cleared before the new values " "are set." msgstr "如果 *clear* 為 true,則在設定新值之前字典將被清除。" -#: ../../library/unittest.mock.rst:1679 +#: ../../library/unittest.mock.rst:1680 msgid "" ":func:`patch.dict` can also be called with arbitrary keyword arguments to " "set values in the dictionary." msgstr "也可以使用任意關鍵字引數呼叫 :func:`patch.dict` 以在字典中設定值。" -#: ../../library/unittest.mock.rst:1684 +#: ../../library/unittest.mock.rst:1685 msgid "" ":func:`patch.dict` now returns the patched dictionary when used as a context " "manager." msgstr ":func:`patch.dict` 現在在做為情境管理器使用時回傳被 patch 的字典。" -#: ../../library/unittest.mock.rst:1687 +#: ../../library/unittest.mock.rst:1688 msgid "" ":func:`patch.dict` can be used as a context manager, decorator or class " "decorator:" msgstr ":func:`patch.dict` 可以做為情境管理器、裝飾器或類別裝飾器使用:" -#: ../../library/unittest.mock.rst:1698 +#: ../../library/unittest.mock.rst:1699 msgid "" -"When used as a class decorator :func:`patch.dict` honours ``patch." -"TEST_PREFIX`` (default to ``'test'``) for choosing which methods to wrap:" +"When used as a class decorator :func:`patch.dict` honours " +"``patch.TEST_PREFIX`` (default to ``'test'``) for choosing which methods to " +"wrap:" msgstr "" "當作為類別裝飾器使用時,:func:`patch.dict` 會遵循 ``patch.TEST_PREFIX``\\ " "(預設為 ``'test'``\\ )來選擇要包裝的方法:" -#: ../../library/unittest.mock.rst:1709 +#: ../../library/unittest.mock.rst:1710 msgid "" "If you want to use a different prefix for your test, you can inform the " "patchers of the different prefix by setting ``patch.TEST_PREFIX``. For more " @@ -2094,7 +2101,7 @@ msgstr "" "patcher 使用不同的前綴。請參閱 :ref:`test-prefix` 以得知如何修改前綴的更多內" "容。" -#: ../../library/unittest.mock.rst:1713 +#: ../../library/unittest.mock.rst:1714 msgid "" ":func:`patch.dict` can be used to add members to a dictionary, or simply let " "a test change a dictionary, and ensure the dictionary is restored when the " @@ -2103,32 +2110,31 @@ msgstr "" ":func:`patch.dict` 可用於在字典中新增成員,或單純地讓測試更改字典,並確保在測" "試結束時將字典回復原狀。" -#: ../../library/unittest.mock.rst:1734 +#: ../../library/unittest.mock.rst:1735 msgid "" "Keywords can be used in the :func:`patch.dict` call to set values in the " "dictionary:" msgstr "可以在 :func:`patch.dict` 呼叫中使用關鍵字來設定字典中的值:" -#: ../../library/unittest.mock.rst:1744 +#: ../../library/unittest.mock.rst:1745 msgid "" ":func:`patch.dict` can be used with dictionary like objects that aren't " "actually dictionaries. At the very minimum they must support item getting, " "setting, deleting and either iteration or membership test. This corresponds " -"to the magic methods :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__` and either :meth:`~container." -"__iter__` or :meth:`~object.__contains__`." +"to the magic " +"methods :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__` " +"and either :meth:`~container.__iter__` or :meth:`~object.__contains__`." msgstr "" ":func:`patch.dict` 可以與實際上不是字典的類字典物件一起使用。最低限度它們必須" -"支援項目的取得、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中的 :meth:" -"`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object." -"__delitem__` 以及 :meth:`~container.__iter__` 或 :meth:`~object." -"__contains__`。" +"支援項目的取得、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中" +"的 :meth:`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object.__delitem__` " +"以及 :meth:`~container.__iter__` 或 :meth:`~object.__contains__`。" -#: ../../library/unittest.mock.rst:1774 +#: ../../library/unittest.mock.rst:1775 msgid "patch.multiple" msgstr "patch.multiple" -#: ../../library/unittest.mock.rst:1778 +#: ../../library/unittest.mock.rst:1779 msgid "" "Perform multiple patches in a single call. It takes the object to be patched " "(either as an object or a string to fetch the object by importing) and " @@ -2137,7 +2143,7 @@ msgstr "" "在一次呼叫中執行多個 patch。它接受被 patch 的物件(作為物件或透過 import 取得" "物件的字串)和 patch 的關鍵字引數: ::" -#: ../../library/unittest.mock.rst:1782 +#: ../../library/unittest.mock.rst:1783 msgid "" "with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" " ..." @@ -2145,18 +2151,18 @@ msgstr "" "with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" " ..." -#: ../../library/unittest.mock.rst:1785 +#: ../../library/unittest.mock.rst:1786 msgid "" "Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to " "create mocks for you. In this case the created mocks are passed into a " -"decorated function by keyword, and a dictionary is returned when :func:" -"`patch.multiple` is used as a context manager." +"decorated function by keyword, and a dictionary is returned " +"when :func:`patch.multiple` is used as a context manager." msgstr "" "如果你想要 :func:`patch.multiple` 為你建立 mock,請使用 :data:`DEFAULT` 作為" -"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且當 :" -"func:`patch.multiple` 作為情境管理器時會回傳字典。" +"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且" +"當 :func:`patch.multiple` 作為情境管理器時會回傳字典。" -#: ../../library/unittest.mock.rst:1790 +#: ../../library/unittest.mock.rst:1791 msgid "" ":func:`patch.multiple` can be used as a decorator, class decorator or a " "context manager. The arguments *spec*, *spec_set*, *create*, *autospec* and " @@ -2164,30 +2170,30 @@ msgid "" "will be applied to *all* patches done by :func:`patch.multiple`." msgstr "" ":func:`patch.multiple` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 " -"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與在 :func:" -"`patch` 中的引數具有相同的意義。這些引數將應用於由 :func:`patch.multiple` 完" -"成的\\ *所有* patch。" +"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與" +"在 :func:`patch` 中的引數具有相同的意義。這些引數將應用於" +"由 :func:`patch.multiple` 完成的\\ *所有* patch。" -#: ../../library/unittest.mock.rst:1795 +#: ../../library/unittest.mock.rst:1796 msgid "" -"When used as a class decorator :func:`patch.multiple` honours ``patch." -"TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.multiple` honours " +"``patch.TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.multiple` 遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" -#: ../../library/unittest.mock.rst:1798 +#: ../../library/unittest.mock.rst:1799 msgid "" "If you want :func:`patch.multiple` to create mocks for you, then you can " "use :data:`DEFAULT` as the value. If you use :func:`patch.multiple` as a " "decorator then the created mocks are passed into the decorated function by " "keyword. ::" msgstr "" -"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使用 :data:" -"`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼被建立的 " -"mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" +"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使" +"用 :data:`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼" +"被建立的 mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" -#: ../../library/unittest.mock.rst:1802 +#: ../../library/unittest.mock.rst:1803 msgid "" ">>> thing = object()\n" ">>> other = object()\n" @@ -2209,7 +2215,7 @@ msgstr "" "...\n" ">>> test_function()" -#: ../../library/unittest.mock.rst:1812 +#: ../../library/unittest.mock.rst:1813 msgid "" ":func:`patch.multiple` can be nested with other ``patch`` decorators, but " "put arguments passed by keyword *after* any of the standard arguments " @@ -2218,7 +2224,7 @@ msgstr "" ":func:`patch.multiple` 可以與其他 ``patch`` 裝飾器巢狀使用,但需要將透過關鍵" "字傳遞的引數放在 :func:`patch` 建立的任何標準引數\\ *之後*: ::" -#: ../../library/unittest.mock.rst:1815 +#: ../../library/unittest.mock.rst:1816 msgid "" ">>> @patch('sys.exit')\n" "... @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)\n" @@ -2238,7 +2244,7 @@ msgstr "" "...\n" ">>> test_function()" -#: ../../library/unittest.mock.rst:1824 +#: ../../library/unittest.mock.rst:1825 msgid "" "If :func:`patch.multiple` is used as a context manager, the value returned " "by the context manager is a dictionary where created mocks are keyed by " @@ -2247,7 +2253,7 @@ msgstr "" "如果 :func:`patch.multiple` 作為情境管理器使用,則情境管理器回傳的值是一個字" "典,其中被建立的 mock 會按名稱作為其鍵值: ::" -#: ../../library/unittest.mock.rst:1827 +#: ../../library/unittest.mock.rst:1828 msgid "" ">>> with patch.multiple('__main__', thing=DEFAULT, other=DEFAULT) as " "values:\n" @@ -2265,11 +2271,11 @@ msgstr "" "... assert values['other'] is other\n" "..." -#: ../../library/unittest.mock.rst:1838 +#: ../../library/unittest.mock.rst:1839 msgid "patch methods: start and stop" msgstr "patch 方法:啟動與停止" -#: ../../library/unittest.mock.rst:1840 +#: ../../library/unittest.mock.rst:1841 msgid "" "All the patchers have :meth:`!start` and :meth:`!stop` methods. These make " "it simpler to do patching in ``setUp`` methods or where you want to do " @@ -2279,18 +2285,18 @@ msgstr "" "方法中進行 patch 或在你想要在沒有巢狀使用裝飾器或 with 陳述式的情況下進行多" "個 patch 時變得更簡單。" -#: ../../library/unittest.mock.rst:1844 +#: ../../library/unittest.mock.rst:1845 msgid "" "To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` " "as normal and keep a reference to the returned ``patcher`` object. You can " "then call :meth:`!start` to put the patch in place and :meth:`!stop` to undo " "it." msgstr "" -"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` 或 :func:" -"`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼叫 :meth:" -"`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" +"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` " +"或 :func:`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼" +"叫 :meth:`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" -#: ../../library/unittest.mock.rst:1848 +#: ../../library/unittest.mock.rst:1849 msgid "" "If you are using :func:`patch` to create a mock for you then it will be " "returned by the call to ``patcher.start``. ::" @@ -2298,7 +2304,7 @@ msgstr "" "如果你使用 :func:`patch` 為你建立 mock,那麼它將透過呼叫 ``patcher.start`` 回" "傳。: ::" -#: ../../library/unittest.mock.rst:1851 +#: ../../library/unittest.mock.rst:1852 msgid "" ">>> patcher = patch('package.module.ClassName')\n" ">>> from package import module\n" @@ -2320,7 +2326,7 @@ msgstr "" ">>> assert module.ClassName is original\n" ">>> assert module.ClassName is not new_mock" -#: ../../library/unittest.mock.rst:1862 +#: ../../library/unittest.mock.rst:1863 msgid "" "A typical use case for this might be for doing multiple patches in the " "``setUp`` method of a :class:`~unittest.TestCase`::" @@ -2328,7 +2334,7 @@ msgstr "" "一個典型的用法是在一個 :class:`~unittest.TestCase` 的 ``setUp`` 方法中執行多" "個 patch: ::" -#: ../../library/unittest.mock.rst:1865 +#: ../../library/unittest.mock.rst:1866 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2364,18 +2370,18 @@ msgstr "" "...\n" ">>> MyTest('test_something').run()" -#: ../../library/unittest.mock.rst:1884 +#: ../../library/unittest.mock.rst:1885 msgid "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " -"exception is raised in the ``setUp`` then ``tearDown`` is not called. :meth:" -"`unittest.TestCase.addCleanup` makes this easier::" +"exception is raised in the ``setUp`` then ``tearDown`` is not " +"called. :meth:`unittest.TestCase.addCleanup` makes this easier::" msgstr "" "如果你使用這個技巧,你必須確保透過呼叫 ``stop`` 來 \"取消\" patch。這可能會比" "你想像的還要複雜一點,因為如果有例外在 ``setUp`` 中被引發,則 ``tearDown`` 就" "不會被呼叫。:meth:`unittest.TestCase.addCleanup` 會讓這稍微簡單一點: ::" -#: ../../library/unittest.mock.rst:1889 +#: ../../library/unittest.mock.rst:1890 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2397,34 +2403,34 @@ msgstr "" "... assert package.module.Class is self.MockClass\n" "..." -#: ../../library/unittest.mock.rst:1899 +#: ../../library/unittest.mock.rst:1900 msgid "" "As an added bonus you no longer need to keep a reference to the ``patcher`` " "object." msgstr "作為額外的好處,你不再需要保留對 ``patcher`` 物件的參照。" -#: ../../library/unittest.mock.rst:1902 +#: ../../library/unittest.mock.rst:1903 msgid "" -"It is also possible to stop all patches which have been started by using :" -"func:`patch.stopall`." +"It is also possible to stop all patches which have been started by " +"using :func:`patch.stopall`." msgstr "也可以使用 :func:`patch.stopall` 來停止所有已啟動的 patch。" -#: ../../library/unittest.mock.rst:1907 +#: ../../library/unittest.mock.rst:1908 msgid "Stop all active patches. Only stops patches started with ``start``." msgstr "停止所有運作的 patch。只停止以 ``start`` 啟動的 patch。" -#: ../../library/unittest.mock.rst:1913 +#: ../../library/unittest.mock.rst:1914 msgid "patch builtins" msgstr "patch 內建函式" -#: ../../library/unittest.mock.rst:1914 +#: ../../library/unittest.mock.rst:1915 msgid "" "You can patch any builtins within a module. The following example patches " "builtin :func:`ord`::" msgstr "" "你可以 patch 模組內的任何內建函式。以下範例 patch 內建函式 :func:`ord`: ::" -#: ../../library/unittest.mock.rst:1917 +#: ../../library/unittest.mock.rst:1918 msgid "" ">>> @patch('__main__.ord')\n" "... def test(mock_ord):\n" @@ -2442,11 +2448,11 @@ msgstr "" ">>> test()\n" "101" -#: ../../library/unittest.mock.rst:1929 +#: ../../library/unittest.mock.rst:1930 msgid "TEST_PREFIX" msgstr "TEST_PREFIX" -#: ../../library/unittest.mock.rst:1931 +#: ../../library/unittest.mock.rst:1932 msgid "" "All of the patchers can be used as class decorators. When used in this way " "they wrap every test method on the class. The patchers recognise methods " @@ -2454,19 +2460,19 @@ msgid "" "the :class:`unittest.TestLoader` finds test methods by default." msgstr "" "所有 patcher 都可以作為類別裝飾器使用。以這種方式使用時,它們包裝了類別上的每" -"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這與 :class:" -"`unittest.TestLoader` 預設尋找測試方法的方式相同。" +"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這" +"與 :class:`unittest.TestLoader` 預設尋找測試方法的方式相同。" -#: ../../library/unittest.mock.rst:1936 +#: ../../library/unittest.mock.rst:1937 msgid "" "It is possible that you want to use a different prefix for your tests. You " -"can inform the patchers of the different prefix by setting ``patch." -"TEST_PREFIX``::" +"can inform the patchers of the different prefix by setting " +"``patch.TEST_PREFIX``::" msgstr "" "你可能會想為你的測試使用不同的前綴。你可以透過設定 ``patch.TEST_PREFIX`` 來告" "知 patcher 使用不同的前綴: ::" -#: ../../library/unittest.mock.rst:1939 +#: ../../library/unittest.mock.rst:1940 msgid "" ">>> patch.TEST_PREFIX = 'foo'\n" ">>> value = 3\n" @@ -2504,21 +2510,21 @@ msgstr "" ">>> value\n" "3" -#: ../../library/unittest.mock.rst:1959 +#: ../../library/unittest.mock.rst:1960 msgid "Nesting Patch Decorators" msgstr "巢狀使用 Patch 裝飾器" -#: ../../library/unittest.mock.rst:1961 +#: ../../library/unittest.mock.rst:1962 msgid "" "If you want to perform multiple patches then you can simply stack up the " "decorators." msgstr "如果你想執行多個 patch,那麼你可以簡單地堆疊裝飾器。" -#: ../../library/unittest.mock.rst:1964 +#: ../../library/unittest.mock.rst:1965 msgid "You can stack up multiple patch decorators using this pattern:" msgstr "你可以使用這個模式來堆疊多個 patch 裝飾器:" -#: ../../library/unittest.mock.rst:1980 +#: ../../library/unittest.mock.rst:1981 msgid "" "Note that the decorators are applied from the bottom upwards. This is the " "standard way that Python applies decorators. The order of the created mocks " @@ -2527,11 +2533,11 @@ msgstr "" "請注意,裝飾器是從底部向上應用的。這是 Python 應用裝飾器的標準方式。被建立的 " "mock 傳遞到測試函式中的順序與此順序相同。" -#: ../../library/unittest.mock.rst:1988 +#: ../../library/unittest.mock.rst:1989 msgid "Where to patch" msgstr "該 patch 何處" -#: ../../library/unittest.mock.rst:1990 +#: ../../library/unittest.mock.rst:1991 msgid "" ":func:`patch` works by (temporarily) changing the object that a *name* " "points to with another one. There can be many names pointing to any " @@ -2542,7 +2548,7 @@ msgstr "" "有許多 name 指向任何單一物件,因此為了使 patch 起作用,你必須確保你 patch 了" "被測試系統使用的 name。" -#: ../../library/unittest.mock.rst:1995 +#: ../../library/unittest.mock.rst:1996 msgid "" "The basic principle is that you patch where an object is *looked up*, which " "is not necessarily the same place as where it is defined. A couple of " @@ -2551,12 +2557,12 @@ msgstr "" "基本原則是在物件\\ *被查找*\\ 的位置進行 patch,該位置不一定與其被定義的位置" "相同。幾個範例將有助於闡明這一點。" -#: ../../library/unittest.mock.rst:1999 +#: ../../library/unittest.mock.rst:2000 msgid "" "Imagine we have a project that we want to test with the following structure::" msgstr "想像一下,我們想要測試一個專案,其結構如下: ::" -#: ../../library/unittest.mock.rst:2001 +#: ../../library/unittest.mock.rst:2002 msgid "" "a.py\n" " -> Defines SomeClass\n" @@ -2572,14 +2578,14 @@ msgstr "" " -> from a import SomeClass\n" " -> some_function instantiates SomeClass" -#: ../../library/unittest.mock.rst:2008 +#: ../../library/unittest.mock.rst:2009 msgid "" "Now we want to test ``some_function`` but we want to mock out ``SomeClass`` " "using :func:`patch`. The problem is that when we import module b, which we " -"will have to do when it imports ``SomeClass`` from module a. If we use :func:" -"`patch` to mock out ``a.SomeClass`` then it will have no effect on our test; " -"module b already has a reference to the *real* ``SomeClass`` and it looks " -"like our patching had no effect." +"will have to do when it imports ``SomeClass`` from module a. If we " +"use :func:`patch` to mock out ``a.SomeClass`` then it will have no effect on " +"our test; module b already has a reference to the *real* ``SomeClass`` and " +"it looks like our patching had no effect." msgstr "" "現在我們想要測試 ``some_function``,但我們想使用 :func:`patch` mock " "``SomeClass``。問題是,當我們 import 模組 b 時(我們必須這樣做),它會從模組 " @@ -2587,7 +2593,7 @@ msgstr "" "那麼它對我們的測試就不會有任何影響;模組 b 已經有了一個\\ *真實的*\\ " "``SomeClass`` 的參照 ,看起來我們的 patch 並沒有任何效果。" -#: ../../library/unittest.mock.rst:2015 +#: ../../library/unittest.mock.rst:2016 msgid "" "The key is to patch out ``SomeClass`` where it is used (or where it is " "looked up). In this case ``some_function`` will actually look up " @@ -2598,64 +2604,64 @@ msgstr "" "``some_function`` 實際上會在我們 import 它的模組 b 中查找 ``SomeClass``。這裡" "的 patch 應該長得像這樣: ::" -#: ../../library/unittest.mock.rst:2019 +#: ../../library/unittest.mock.rst:2020 msgid "@patch('b.SomeClass')" msgstr "@patch('b.SomeClass')" -#: ../../library/unittest.mock.rst:2021 +#: ../../library/unittest.mock.rst:2022 msgid "" "However, consider the alternative scenario where instead of ``from a import " -"SomeClass`` module b does ``import a`` and ``some_function`` uses ``a." -"SomeClass``. Both of these import forms are common. In this case the class " -"we want to patch is being looked up in the module and so we have to patch " -"``a.SomeClass`` instead::" +"SomeClass`` module b does ``import a`` and ``some_function`` uses " +"``a.SomeClass``. Both of these import forms are common. In this case the " +"class we want to patch is being looked up in the module and so we have to " +"patch ``a.SomeClass`` instead::" msgstr "" "然而,考慮另一種情況,其中模組 b 並不是使用 ``from a import SomeClass``,而" "是 ``import a``,然後 ``some_function`` 使用 ``a.SomeClass``。這兩種 import " "形式都很常見。在這種情況下,我們想要 patch 的類別正在其模組中被查找,因此我們" "必須 patch ``a.SomeClass``: ::" -#: ../../library/unittest.mock.rst:2026 +#: ../../library/unittest.mock.rst:2027 msgid "@patch('a.SomeClass')" msgstr "@patch('a.SomeClass')" -#: ../../library/unittest.mock.rst:2030 +#: ../../library/unittest.mock.rst:2031 msgid "Patching Descriptors and Proxy Objects" msgstr "Patch 描述器與代理物件 (Proxy Objects)" -#: ../../library/unittest.mock.rst:2032 +#: ../../library/unittest.mock.rst:2033 msgid "" "Both patch_ and patch.object_ correctly patch and restore descriptors: class " "methods, static methods and properties. You should patch these on the " "*class* rather than an instance. They also work with *some* objects that " -"proxy attribute access, like the `django settings object `_." msgstr "" "patch_ 和 patch.object_ 都正確地 patch 和還原描述器:類別方法、靜態方法以及屬" "性。你應該在 *類別* 而不是實例上 patch 它們。它們還可以使用代理屬性存取的\\ *" -"一些*\\ 物件,例如 `django 設定物件 `_。" -#: ../../library/unittest.mock.rst:2040 +#: ../../library/unittest.mock.rst:2041 msgid "MagicMock and magic method support" msgstr "MagicMock 以及魔術方法支援" -#: ../../library/unittest.mock.rst:2045 +#: ../../library/unittest.mock.rst:2046 msgid "Mocking Magic Methods" msgstr "Mock 魔術方法" -#: ../../library/unittest.mock.rst:2047 +#: ../../library/unittest.mock.rst:2048 msgid "" -":class:`Mock` supports mocking the Python protocol methods, also known as :" -"term:`\"magic methods\" `. This allows mock objects to replace " -"containers or other objects that implement Python protocols." +":class:`Mock` supports mocking the Python protocol methods, also known " +"as :term:`\"magic methods\" `. This allows mock objects to " +"replace containers or other objects that implement Python protocols." msgstr "" ":class:`Mock` 支援 mock Python 協定方法,其也被稱作 :term:`\"魔術方法\" " "`。這允許 mock 物件替換容器或實作 Python 協定的其他物件。" -#: ../../library/unittest.mock.rst:2051 +#: ../../library/unittest.mock.rst:2052 msgid "" "Because magic methods are looked up differently from normal methods [#]_, " "this support has been specially implemented. This means that only specific " @@ -2666,7 +2672,7 @@ msgstr "" "代表著僅有特定的魔術方法被此方式支援。現在已支援清單中已經\\ *幾乎*\\ 包含了" "所有魔術方法。如果你需要 mock 任何魔術方法而其尚未被支援,請讓我們知道。" -#: ../../library/unittest.mock.rst:2056 +#: ../../library/unittest.mock.rst:2057 msgid "" "You mock magic methods by setting the method you are interested in to a " "function or a mock instance. If you are using a function then it *must* take " @@ -2675,46 +2681,46 @@ msgstr "" "你可以透過將你感興趣的方法設定為函式或 mock 實例來 mock 魔術方法。如果你使用" "函式,那麼它\\ *必須*\\ 將 ``self`` 作為第一個引數 [#]_。" -#: ../../library/unittest.mock.rst:2079 +#: ../../library/unittest.mock.rst:2080 msgid "" -"One use case for this is for mocking objects used as context managers in a :" -"keyword:`with` statement:" +"One use case for this is for mocking objects used as context managers in " +"a :keyword:`with` statement:" msgstr "一個用法是在 :keyword:`with` 陳述式中 mock 作為情境管理器使用的物件:" -#: ../../library/unittest.mock.rst:2091 +#: ../../library/unittest.mock.rst:2092 msgid "" "Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they " "are recorded in :attr:`~Mock.mock_calls`." msgstr "" -"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄在 :" -"attr:`~Mock.mock_calls` 內。" +"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄" +"在 :attr:`~Mock.mock_calls` 內。" -#: ../../library/unittest.mock.rst:2096 +#: ../../library/unittest.mock.rst:2097 msgid "" "If you use the *spec* keyword argument to create a mock then attempting to " -"set a magic method that isn't in the spec will raise an :exc:" -"`AttributeError`." +"set a magic method that isn't in the spec will raise " +"an :exc:`AttributeError`." msgstr "" "如果你使用\\ *spec*\\ 關鍵字引數來建立一個 mock,則嘗試設定規格中未包含的魔術" "方法將引發一個 :exc:`AttributeError`。" -#: ../../library/unittest.mock.rst:2099 +#: ../../library/unittest.mock.rst:2100 msgid "The full list of supported magic methods is:" msgstr "已支援的魔術方法的完整列表是:" -#: ../../library/unittest.mock.rst:2101 +#: ../../library/unittest.mock.rst:2102 msgid "``__hash__``, ``__sizeof__``, ``__repr__`` and ``__str__``" msgstr "``__hash__``、``__sizeof__``、 ``__repr__`` 和 ``__str__``" -#: ../../library/unittest.mock.rst:2102 +#: ../../library/unittest.mock.rst:2103 msgid "``__dir__``, ``__format__`` and ``__subclasses__``" msgstr "``__dir__``、 ``__format__`` 和 ``__subclasses__``" -#: ../../library/unittest.mock.rst:2103 +#: ../../library/unittest.mock.rst:2104 msgid "``__round__``, ``__floor__``, ``__trunc__`` and ``__ceil__``" msgstr "``__round__``、``__floor__``、``__trunc__`` 和 ``__ceil__``" -#: ../../library/unittest.mock.rst:2104 +#: ../../library/unittest.mock.rst:2105 msgid "" "Comparisons: ``__lt__``, ``__gt__``, ``__le__``, ``__ge__``, ``__eq__`` and " "``__ne__``" @@ -2722,7 +2728,7 @@ msgstr "" "比較方法:``__lt__``、``__gt__``、``__le__``、``__ge__``、``__eq__`` 和 " "``__ne__``" -#: ../../library/unittest.mock.rst:2106 +#: ../../library/unittest.mock.rst:2107 msgid "" "Container methods: ``__getitem__``, ``__setitem__``, ``__delitem__``, " "``__contains__``, ``__len__``, ``__iter__``, ``__reversed__`` and " @@ -2732,18 +2738,18 @@ msgstr "" "``__contains__``、``__len__``、``__iter__``、``__reversed__`` 和 " "``__missing__``" -#: ../../library/unittest.mock.rst:2109 +#: ../../library/unittest.mock.rst:2110 msgid "" "Context manager: ``__enter__``, ``__exit__``, ``__aenter__`` and " "``__aexit__``" msgstr "" "情境管理器:``__enter__``、``__exit__``、``__aenter__`` 和 ``__aexit__``" -#: ../../library/unittest.mock.rst:2110 +#: ../../library/unittest.mock.rst:2111 msgid "Unary numeric methods: ``__neg__``, ``__pos__`` and ``__invert__``" msgstr "一元數值方法:``__neg__``、``__pos__`` 和 ``__invert__``" -#: ../../library/unittest.mock.rst:2111 +#: ../../library/unittest.mock.rst:2112 msgid "" "The numeric methods (including right hand and in-place variants): " "``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__truediv__``, " @@ -2755,18 +2761,18 @@ msgstr "" "``__mod__``、``__divmod__``、``__lshift__``、``__rshift__``、``__and__``、" "``__xor__``、``__or__`` 和 ``__pow__``" -#: ../../library/unittest.mock.rst:2115 +#: ../../library/unittest.mock.rst:2116 msgid "" "Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__`` and " "``__index__``" msgstr "" "數值轉換方法:``__complex__``、``__int__``、``__float__`` 和 ``__index__``" -#: ../../library/unittest.mock.rst:2117 +#: ../../library/unittest.mock.rst:2118 msgid "Descriptor methods: ``__get__``, ``__set__`` and ``__delete__``" msgstr "描述器方法:``__get__``、``__set__`` 和 ``__delete__``" -#: ../../library/unittest.mock.rst:2118 +#: ../../library/unittest.mock.rst:2119 msgid "" "Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, " "``__getnewargs__``, ``__getstate__`` and ``__setstate__``" @@ -2774,19 +2780,19 @@ msgstr "" "Pickling:``__reduce__``、``__reduce_ex__``、``__getinitargs__``、" "``__getnewargs__``、``__getstate__`` 和 ``__setstate__``" -#: ../../library/unittest.mock.rst:2120 +#: ../../library/unittest.mock.rst:2121 msgid "File system path representation: ``__fspath__``" msgstr "檔案系統路徑表示法:``__fspath__``" -#: ../../library/unittest.mock.rst:2121 +#: ../../library/unittest.mock.rst:2122 msgid "Asynchronous iteration methods: ``__aiter__`` and ``__anext__``" msgstr "非同步疊代方法:``__aiter__`` 和 ``__anext__``" -#: ../../library/unittest.mock.rst:2123 +#: ../../library/unittest.mock.rst:2124 msgid "Added support for :func:`os.PathLike.__fspath__`." msgstr "新增對於 :func:`os.PathLike.__fspath__` 的支援。" -#: ../../library/unittest.mock.rst:2126 +#: ../../library/unittest.mock.rst:2127 msgid "" "Added support for ``__aenter__``, ``__aexit__``, ``__aiter__`` and " "``__anext__``." @@ -2794,7 +2800,7 @@ msgstr "" "新增對於 ``__aenter__``、``__aexit__``、``__aiter__`` 和 ``__anext__`` 的支" "援。" -#: ../../library/unittest.mock.rst:2130 +#: ../../library/unittest.mock.rst:2131 msgid "" "The following methods exist but are *not* supported as they are either in " "use by mock, can't be set dynamically, or can cause problems:" @@ -2802,29 +2808,29 @@ msgstr "" "以下方法存在,但「不」被支援,因為它們在被 mock 使用時,會無法動態設定,或可" "能導致問題:" -#: ../../library/unittest.mock.rst:2133 +#: ../../library/unittest.mock.rst:2134 msgid "``__getattr__``, ``__setattr__``, ``__init__`` and ``__new__``" msgstr "``__getattr__``、``__setattr__``、``__init__`` 和 ``__new__``" -#: ../../library/unittest.mock.rst:2134 +#: ../../library/unittest.mock.rst:2135 msgid "" "``__prepare__``, ``__instancecheck__``, ``__subclasscheck__``, ``__del__``" msgstr "" "``__prepare__``、``__instancecheck__``、``__subclasscheck__``、``__del__``" -#: ../../library/unittest.mock.rst:2139 +#: ../../library/unittest.mock.rst:2140 msgid "Magic Mock" msgstr "Magic Mock" -#: ../../library/unittest.mock.rst:2141 +#: ../../library/unittest.mock.rst:2142 msgid "" -"There are two ``MagicMock`` variants: :class:`MagicMock` and :class:" -"`NonCallableMagicMock`." +"There are two ``MagicMock`` variants: :class:`MagicMock` " +"and :class:`NonCallableMagicMock`." msgstr "" -"``MagicMock`` 有兩個變體::class:`MagicMock` 和 :class:" -"`NonCallableMagicMock`。" +"``MagicMock`` 有兩個變體::class:`MagicMock` " +"和 :class:`NonCallableMagicMock`。" -#: ../../library/unittest.mock.rst:2146 +#: ../../library/unittest.mock.rst:2147 msgid "" "``MagicMock`` is a subclass of :class:`Mock` with default implementations of " "most of the :term:`magic methods `. You can use ``MagicMock`` " @@ -2833,11 +2839,11 @@ msgstr "" "``MagicMock`` 是 :class:`Mock` 的子類別,其預設具有大多數\\ :term:`魔術方法 " "`\\ 的實作。你可以使用 ``MagicMock``,而無需自行配置魔術方法。" -#: ../../library/unittest.mock.rst:2150 +#: ../../library/unittest.mock.rst:2151 msgid "The constructor parameters have the same meaning as for :class:`Mock`." msgstr "建構函式參數的意義與 :class:`Mock` 中的參數相同。" -#: ../../library/unittest.mock.rst:2152 +#: ../../library/unittest.mock.rst:2153 msgid "" "If you use the *spec* or *spec_set* arguments then *only* magic methods that " "exist in the spec will be created." @@ -2845,11 +2851,11 @@ msgstr "" "如果你使用 *spec* 或 *spec_set* 引數,那麼\\ *只有*\\ 規格中存在的魔術方法會" "被建立。" -#: ../../library/unittest.mock.rst:2158 +#: ../../library/unittest.mock.rst:2159 msgid "A non-callable version of :class:`MagicMock`." msgstr ":class:`MagicMock` 的不可呼叫版本。" -#: ../../library/unittest.mock.rst:2160 +#: ../../library/unittest.mock.rst:2161 msgid "" "The constructor parameters have the same meaning as for :class:`MagicMock`, " "with the exception of *return_value* and *side_effect* which have no meaning " @@ -2858,7 +2864,7 @@ msgstr "" "建構函式參數的意義與 :class:`MagicMock` 中的參數相同,但 *return_value* 和 " "*side_effect* 除外,它們對不可呼叫的 mock 來說沒有任何意義。" -#: ../../library/unittest.mock.rst:2164 +#: ../../library/unittest.mock.rst:2165 msgid "" "The magic methods are setup with :class:`MagicMock` objects, so you can " "configure them and use them in the usual way:" @@ -2866,7 +2872,7 @@ msgstr "" "魔術方法是使用 :class:`MagicMock` 物件設定的,因此你可以配置它們並以一般的方" "法來使用它們:" -#: ../../library/unittest.mock.rst:2174 +#: ../../library/unittest.mock.rst:2175 msgid "" "By default many of the protocol methods are required to return objects of a " "specific type. These methods are preconfigured with a default return value, " @@ -2878,94 +2884,94 @@ msgstr "" "值,因此如果你對回傳值不感興趣,則無需執行任何操作即可使用它們。如果你想更改" "預設值,你仍然可以手動\\ *設定*\\ 回傳值。" -#: ../../library/unittest.mock.rst:2180 +#: ../../library/unittest.mock.rst:2181 msgid "Methods and their defaults:" msgstr "方法及其預設值:" -#: ../../library/unittest.mock.rst:2182 +#: ../../library/unittest.mock.rst:2183 msgid "``__lt__``: :data:`NotImplemented`" msgstr "``__lt__``::data:`NotImplemented`" -#: ../../library/unittest.mock.rst:2183 +#: ../../library/unittest.mock.rst:2184 msgid "``__gt__``: :data:`!NotImplemented`" msgstr "``__gt__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2184 +#: ../../library/unittest.mock.rst:2185 msgid "``__le__``: :data:`!NotImplemented`" msgstr "``__le__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2185 +#: ../../library/unittest.mock.rst:2186 msgid "``__ge__``: :data:`!NotImplemented`" msgstr "``__ge__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2186 +#: ../../library/unittest.mock.rst:2187 msgid "``__int__``: ``1``" msgstr "``__int__``:``1``" -#: ../../library/unittest.mock.rst:2187 +#: ../../library/unittest.mock.rst:2188 msgid "``__contains__``: ``False``" msgstr "``__contains__``:``False``" -#: ../../library/unittest.mock.rst:2188 +#: ../../library/unittest.mock.rst:2189 msgid "``__len__``: ``0``" msgstr "``__len__``:``0``" -#: ../../library/unittest.mock.rst:2189 +#: ../../library/unittest.mock.rst:2190 msgid "``__iter__``: ``iter([])``" msgstr "``__iter__``:``iter([])``" -#: ../../library/unittest.mock.rst:2190 +#: ../../library/unittest.mock.rst:2191 msgid "``__exit__``: ``False``" msgstr "``__exit__``:``False``" -#: ../../library/unittest.mock.rst:2191 +#: ../../library/unittest.mock.rst:2192 msgid "``__aexit__``: ``False``" msgstr "``__aexit__``:``False``" -#: ../../library/unittest.mock.rst:2192 +#: ../../library/unittest.mock.rst:2193 msgid "``__complex__``: ``1j``" msgstr "``__complex__``:``1j``" -#: ../../library/unittest.mock.rst:2193 +#: ../../library/unittest.mock.rst:2194 msgid "``__float__``: ``1.0``" msgstr "``__float__``:``1.0``" -#: ../../library/unittest.mock.rst:2194 +#: ../../library/unittest.mock.rst:2195 msgid "``__bool__``: ``True``" msgstr "``__bool__``:``True``" -#: ../../library/unittest.mock.rst:2195 +#: ../../library/unittest.mock.rst:2196 msgid "``__index__``: ``1``" msgstr "``__index__``:``1``" -#: ../../library/unittest.mock.rst:2196 +#: ../../library/unittest.mock.rst:2197 msgid "``__hash__``: default hash for the mock" msgstr "``__hash__``:mock 的預設雜湊" -#: ../../library/unittest.mock.rst:2197 +#: ../../library/unittest.mock.rst:2198 msgid "``__str__``: default str for the mock" msgstr "``__str__``:mock 的預設字串" -#: ../../library/unittest.mock.rst:2198 +#: ../../library/unittest.mock.rst:2199 msgid "``__sizeof__``: default sizeof for the mock" msgstr "``__sizeof__``:mock 的預設 sizeof" -#: ../../library/unittest.mock.rst:2200 +#: ../../library/unittest.mock.rst:2201 msgid "For example:" msgstr "舉例來說:" -#: ../../library/unittest.mock.rst:2212 +#: ../../library/unittest.mock.rst:2213 msgid "" "The two equality methods, :meth:`!__eq__` and :meth:`!__ne__`, are special. " -"They do the default equality comparison on identity, using the :attr:`~Mock." -"side_effect` attribute, unless you change their return value to return " -"something else::" +"They do the default equality comparison on identity, using " +"the :attr:`~Mock.side_effect` attribute, unless you change their return " +"value to return something else::" msgstr "" -":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使用 :attr:" -"`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非你變更它" -"們的回傳值以回傳其他內容: ::" +":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使" +"用 :attr:`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非" +"你變更它們的回傳值以回傳其他內容: ::" -#: ../../library/unittest.mock.rst:2217 +#: ../../library/unittest.mock.rst:2218 msgid "" ">>> MagicMock() == 3\n" "False\n" @@ -2985,14 +2991,14 @@ msgstr "" ">>> mock == 3\n" "True" -#: ../../library/unittest.mock.rst:2226 +#: ../../library/unittest.mock.rst:2227 msgid "" "The return value of :meth:`MagicMock.__iter__` can be any iterable object " "and isn't required to be an iterator:" msgstr "" ":meth:`MagicMock.__iter__` 的回傳值可以是任何可疊代物件,且不需是一個疊代器:" -#: ../../library/unittest.mock.rst:2236 +#: ../../library/unittest.mock.rst:2237 msgid "" "If the return value *is* an iterator, then iterating over it once will " "consume it and subsequent iterations will result in an empty list:" @@ -3000,7 +3006,7 @@ msgstr "" "如果回傳值\\ *是*\\ 一個疊代器,那麼對其進行一次疊代將消耗它,並且後續疊代將" "產生一個空串列:" -#: ../../library/unittest.mock.rst:2245 +#: ../../library/unittest.mock.rst:2246 msgid "" "``MagicMock`` has all of the supported magic methods configured except for " "some of the obscure and obsolete ones. You can still set these up if you " @@ -3009,33 +3015,33 @@ msgstr "" "``MagicMock`` 配置了所有支援的魔術方法,除了一些少見和過時的方法。如果你想" "要,你仍然可以設定這些魔術方法。" -#: ../../library/unittest.mock.rst:2248 +#: ../../library/unittest.mock.rst:2249 msgid "" "Magic methods that are supported but not setup by default in ``MagicMock`` " "are:" msgstr "``MagicMock`` 中支援但預設未設置的魔術方法包含:" -#: ../../library/unittest.mock.rst:2250 +#: ../../library/unittest.mock.rst:2251 msgid "``__subclasses__``" msgstr "``__subclasses__``" -#: ../../library/unittest.mock.rst:2251 +#: ../../library/unittest.mock.rst:2252 msgid "``__dir__``" msgstr "``__dir__``" -#: ../../library/unittest.mock.rst:2252 +#: ../../library/unittest.mock.rst:2253 msgid "``__format__``" msgstr "``__format__``" -#: ../../library/unittest.mock.rst:2253 +#: ../../library/unittest.mock.rst:2254 msgid "``__get__``, ``__set__`` and ``__delete__``" msgstr "``__get__``、``__set__`` 和 ``__delete__``" -#: ../../library/unittest.mock.rst:2254 +#: ../../library/unittest.mock.rst:2255 msgid "``__reversed__`` and ``__missing__``" msgstr "``__reversed__`` 和 ``__missing__``" -#: ../../library/unittest.mock.rst:2255 +#: ../../library/unittest.mock.rst:2256 msgid "" "``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, " "``__getstate__`` and ``__setstate__``" @@ -3043,11 +3049,11 @@ msgstr "" "``__reduce__``、``__reduce_ex__``、``__getinitargs__``、``__getnewargs__``、" "``__getstate__`` 和 ``__setstate__``" -#: ../../library/unittest.mock.rst:2257 +#: ../../library/unittest.mock.rst:2258 msgid "``__getformat__``" msgstr "``__getformat__``" -#: ../../library/unittest.mock.rst:2261 +#: ../../library/unittest.mock.rst:2262 msgid "" "Magic methods *should* be looked up on the class rather than the instance. " "Different versions of Python are inconsistent about applying this rule. The " @@ -3056,27 +3062,27 @@ msgstr "" "魔術方法\\ *應該*\\ 在類別而不是實例上被查找。不同版本的 Python 對於這條規則" "的適用並不一致。支援的協定方法應適用於所有支援的 Python 版本。" -#: ../../library/unittest.mock.rst:2265 +#: ../../library/unittest.mock.rst:2266 msgid "" "The function is basically hooked up to the class, but each ``Mock`` instance " "is kept isolated from the others." msgstr "該函式基本上與類別掛鉤,但每個 ``Mock`` 實例都與其他實例保持隔離。" -#: ../../library/unittest.mock.rst:2270 +#: ../../library/unittest.mock.rst:2271 msgid "Helpers" msgstr "輔助函式" -#: ../../library/unittest.mock.rst:2273 +#: ../../library/unittest.mock.rst:2274 msgid "sentinel" msgstr "sentinel(哨兵)" -#: ../../library/unittest.mock.rst:2277 +#: ../../library/unittest.mock.rst:2278 msgid "" "The ``sentinel`` object provides a convenient way of providing unique " "objects for your tests." msgstr "``哨兵``\\ 物件提供了一種為你的測試提供獨特物件的便利方式。" -#: ../../library/unittest.mock.rst:2280 +#: ../../library/unittest.mock.rst:2281 msgid "" "Attributes are created on demand when you access them by name. Accessing the " "same attribute will always return the same object. The objects returned have " @@ -3085,15 +3091,15 @@ msgstr "" "當你使用名稱存取屬性時,屬性會根據需要被建立。存取相同的屬性將始終回傳相同的" "物件。回傳的物件會具有合適的 repr,讓測試失敗的訊息是可閱讀的。" -#: ../../library/unittest.mock.rst:2284 +#: ../../library/unittest.mock.rst:2285 msgid "" -"The ``sentinel`` attributes now preserve their identity when they are :mod:" -"`copied ` or :mod:`pickled `." +"The ``sentinel`` attributes now preserve their identity when they " +"are :mod:`copied ` or :mod:`pickled `." msgstr "" "``哨兵``\\ 屬性現在當被\\ :mod:`複製 `\\ 或\\ :mod:`序列化 `\\ " "時會保留其識別性。" -#: ../../library/unittest.mock.rst:2288 +#: ../../library/unittest.mock.rst:2289 msgid "" "Sometimes when testing you need to test that a specific object is passed as " "an argument to another method, or returned. It can be common to create named " @@ -3104,44 +3110,43 @@ msgstr "" "名的哨兵物件來測試這一點是常見的。:data:`sentinel` 提供了一種此類建立和測試物" "件識別性的便利方式。" -#: ../../library/unittest.mock.rst:2293 +#: ../../library/unittest.mock.rst:2294 msgid "" -"In this example we monkey patch ``method`` to return ``sentinel." -"some_object``:" +"In this example we monkey patch ``method`` to return " +"``sentinel.some_object``:" msgstr "" "在這個例子中,我們 monkey patch ``method`` 以回傳 ``sentinel.some_object``:" -#: ../../library/unittest.mock.rst:2305 +#: ../../library/unittest.mock.rst:2306 msgid "DEFAULT" msgstr "DEFAULT" -#: ../../library/unittest.mock.rst:2310 +#: ../../library/unittest.mock.rst:2311 msgid "" -"The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel." -"DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to " -"indicate that the normal return value should be used." +"The :data:`DEFAULT` object is a pre-created sentinel (actually " +"``sentinel.DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions " +"to indicate that the normal return value should be used." msgstr "" -":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 ``sentinel." -"DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示正常的回傳值" -"應該被使用。" +":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 " +"``sentinel.DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示" +"正常的回傳值應該被使用。" -#: ../../library/unittest.mock.rst:2316 +#: ../../library/unittest.mock.rst:2317 msgid "call" msgstr "call" -#: ../../library/unittest.mock.rst:2320 +#: ../../library/unittest.mock.rst:2321 msgid "" ":func:`call` is a helper object for making simpler assertions, for comparing " -"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock." -"mock_calls` and :attr:`~Mock.method_calls`. :func:`call` can also be used " +"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock.mock_calls` " +"and :attr:`~Mock.method_calls`. :func:`call` can also be used " "with :meth:`~Mock.assert_has_calls`." msgstr "" -"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock." -"mock_calls` 和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更" -"簡單的斷言的輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一" -"起使用。" +"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock.mock_calls` " +"和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更簡單的斷言的" +"輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一起使用。" -#: ../../library/unittest.mock.rst:2333 +#: ../../library/unittest.mock.rst:2334 msgid "" "For a call object that represents multiple calls, :meth:`call_list` returns " "a list of all the intermediate calls as well as the final call." @@ -3149,7 +3154,7 @@ msgstr "" "對於表示多個呼叫的 call 物件,:meth:`call_list` 回傳所有中間呼叫以及最終呼叫" "的串列。" -#: ../../library/unittest.mock.rst:2337 +#: ../../library/unittest.mock.rst:2338 msgid "" "``call_list`` is particularly useful for making assertions on \"chained " "calls\". A chained call is multiple calls on a single line of code. This " @@ -3160,39 +3165,41 @@ msgstr "" "在單行程式碼進行的多次呼叫。這會導致 mock 上的 :attr:`~Mock.mock_calls` 中出" "現多個項目。手動建構呼叫序列會相當單調乏味。" -#: ../../library/unittest.mock.rst:2342 +#: ../../library/unittest.mock.rst:2343 msgid "" ":meth:`~call.call_list` can construct the sequence of calls from the same " "chained call:" msgstr ":meth:`~call.call_list` 可以從同一個鍊接呼叫建構呼叫序列:" -#: ../../library/unittest.mock.rst:2359 +#: ../../library/unittest.mock.rst:2360 msgid "" "A ``call`` object is either a tuple of (positional args, keyword args) or " "(name, positional args, keyword args) depending on how it was constructed. " "When you construct them yourself this isn't particularly interesting, but " -"the ``call`` objects that are in the :attr:`Mock.call_args`, :attr:`Mock." -"call_args_list` and :attr:`Mock.mock_calls` attributes can be introspected " -"to get at the individual arguments they contain." +"the ``call`` objects that are in " +"the :attr:`Mock.call_args`, :attr:`Mock.call_args_list` " +"and :attr:`Mock.mock_calls` attributes can be introspected to get at the " +"individual arguments they contain." msgstr "" "取決於它的建構方式,一個 ``call`` 物件會是(位置引數, 關鍵字引數)的元組,或" "是 (名稱, 位置引數, 關鍵字引數) 的元組。當你自己建構它們時,這並不是那麼有" -"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` 和 :attr:`Mock." -"mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各個引數。" +"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` " +"和 :attr:`Mock.mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各" +"個引數。" -#: ../../library/unittest.mock.rst:2366 +#: ../../library/unittest.mock.rst:2367 msgid "" -"The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock." -"call_args_list` are two-tuples of (positional args, keyword args) whereas " -"the ``call`` objects in :attr:`Mock.mock_calls`, along with ones you " -"construct yourself, are three-tuples of (name, positional args, keyword " -"args)." +"The ``call`` objects in :attr:`Mock.call_args` " +"and :attr:`Mock.call_args_list` are two-tuples of (positional args, keyword " +"args) whereas the ``call`` objects in :attr:`Mock.mock_calls`, along with " +"ones you construct yourself, are three-tuples of (name, positional args, " +"keyword args)." msgstr "" ":attr:`Mock.call_args` 和 :attr:`Mock.call_args_list` 中的 ``call`` 物件是" "(位置引數, 關鍵字引數)的二元組,而 :attr:`Mock.mock_calls` 中的 ``call`` 物" "件以及你自己建立的 ``call`` 物件是(名稱, 位置引數, 關鍵字引數)的三元組。" -#: ../../library/unittest.mock.rst:2371 +#: ../../library/unittest.mock.rst:2372 msgid "" "You can use their \"tupleness\" to pull out the individual arguments for " "more complex introspection and assertions. The positional arguments are a " @@ -3202,11 +3209,11 @@ msgstr "" "你可以利用它們作為元組的特性來提取單個引數,以進行更複雜的內省和斷言。位置引" "數是一個元組(如果沒有位置引數則為空元組),關鍵字引數是一個字典:" -#: ../../library/unittest.mock.rst:2404 +#: ../../library/unittest.mock.rst:2405 msgid "create_autospec" msgstr "create_autospec" -#: ../../library/unittest.mock.rst:2408 +#: ../../library/unittest.mock.rst:2409 msgid "" "Create a mock object using another object as a spec. Attributes on the mock " "will use the corresponding attribute on the *spec* object as their spec." @@ -3214,21 +3221,21 @@ msgstr "" "使用另一個物件作為規格建立一個 mock 物件。Mock 上的屬性將使用 *spec* 物件上的" "對應屬性作為其規格。" -#: ../../library/unittest.mock.rst:2412 +#: ../../library/unittest.mock.rst:2413 msgid "" "Functions or methods being mocked will have their arguments checked to " "ensure that they are called with the correct signature." msgstr "被 mock 的函式或方法將檢查其引數,以確保他們被使用正確的簽名來呼叫。" -#: ../../library/unittest.mock.rst:2415 +#: ../../library/unittest.mock.rst:2416 msgid "" "If *spec_set* is ``True`` then attempting to set attributes that don't exist " "on the spec object will raise an :exc:`AttributeError`." msgstr "" -"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引發 :exc:" -"`AttributeError`。" +"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引" +"發 :exc:`AttributeError`。" -#: ../../library/unittest.mock.rst:2418 +#: ../../library/unittest.mock.rst:2419 msgid "" "If a class is used as a spec then the return value of the mock (the instance " "of the class) will have the same spec. You can use a class as the spec for " @@ -3239,7 +3246,7 @@ msgstr "" "可以透過傳遞 ``instance=True`` 來使用一個類別作為一個實例物件的規格。只有當 " "mock 的實例是可呼叫物件時,回傳的 mock 才會是可呼叫物件。" -#: ../../library/unittest.mock.rst:2423 +#: ../../library/unittest.mock.rst:2424 msgid "" ":func:`create_autospec` also takes arbitrary keyword arguments that are " "passed to the constructor of the created mock." @@ -3247,27 +3254,27 @@ msgstr "" ":func:`create_autospec` 也接受任意的關鍵字引數,這些引數會傳遞給已建立的 " "mock 的建構函式。" -#: ../../library/unittest.mock.rst:2426 +#: ../../library/unittest.mock.rst:2427 msgid "" -"See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:" -"`create_autospec` and the *autospec* argument to :func:`patch`." +"See :ref:`auto-speccing` for examples of how to use auto-speccing " +"with :func:`create_autospec` and the *autospec* argument to :func:`patch`." msgstr "" "請參閱 :ref:`auto-speccing` 以得知如何以 :func:`create_autospec` 使用自動規格" "以及如何在 :func:`patch` 中使用 *autospec* 引數的範例。" -#: ../../library/unittest.mock.rst:2432 +#: ../../library/unittest.mock.rst:2433 msgid "" ":func:`create_autospec` now returns an :class:`AsyncMock` if the target is " "an async function." msgstr "" -"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一個 :class:" -"`AsyncMock`。" +"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一" +"個 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:2437 +#: ../../library/unittest.mock.rst:2438 msgid "ANY" msgstr "ANY" -#: ../../library/unittest.mock.rst:2441 +#: ../../library/unittest.mock.rst:2442 msgid "" "Sometimes you may need to make assertions about *some* of the arguments in a " "call to mock, but either not care about some of the arguments or want to " @@ -3277,30 +3284,31 @@ msgstr "" "有時你可能需要對 mock 的呼叫中的\\ *某些*\\ 引數進行斷言,但你不在意其他的某" "些引數,或想將它們單獨從 :attr:`~Mock.call_args` 中取出並進行更加複雜的斷言。" -#: ../../library/unittest.mock.rst:2446 +#: ../../library/unittest.mock.rst:2447 msgid "" "To ignore certain arguments you can pass in objects that compare equal to " -"*everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock." -"assert_called_once_with` will then succeed no matter what was passed in." +"*everything*. Calls to :meth:`~Mock.assert_called_with` " +"and :meth:`~Mock.assert_called_once_with` will then succeed no matter what " +"was passed in." msgstr "" "要忽略某些引數,你可以傳入對\\ *所有物件*\\ 來說都相等的物件。那麼無論傳入什" -"麼內容,對 :meth:`~Mock.assert_used_with` 和 :meth:`~Mock." -"assert_used_once_with` 的呼叫都會成功。" +"麼內容,對 :meth:`~Mock.assert_used_with` " +"和 :meth:`~Mock.assert_used_once_with` 的呼叫都會成功。" -#: ../../library/unittest.mock.rst:2455 +#: ../../library/unittest.mock.rst:2456 msgid "" -":data:`ANY` can also be used in comparisons with call lists like :attr:" -"`~Mock.mock_calls`:" +":data:`ANY` can also be used in comparisons with call lists " +"like :attr:`~Mock.mock_calls`:" msgstr "" ":data:`ANY` 也可以用來與呼叫串列進行比較,例如 :attr:`~Mock.mock_calls`:" -#: ../../library/unittest.mock.rst:2465 +#: ../../library/unittest.mock.rst:2466 msgid "" ":data:`ANY` is not limited to comparisons with call objects and so can also " "be used in test assertions::" msgstr ":data:`ANY` 不只能與呼叫物件比較,其也可以在測試斷言中使用: ::" -#: ../../library/unittest.mock.rst:2468 +#: ../../library/unittest.mock.rst:2469 msgid "" "class TestStringMethods(unittest.TestCase):\n" "\n" @@ -3314,24 +3322,24 @@ msgstr "" " s = 'hello world'\n" " self.assertEqual(s.split(), ['hello', ANY])" -#: ../../library/unittest.mock.rst:2476 +#: ../../library/unittest.mock.rst:2477 msgid "FILTER_DIR" msgstr "FILTER_DIR" -#: ../../library/unittest.mock.rst:2480 +#: ../../library/unittest.mock.rst:2481 msgid "" ":data:`FILTER_DIR` is a module level variable that controls the way mock " "objects respond to :func:`dir`. The default is ``True``, which uses the " "filtering described below, to only show useful members. If you dislike this " -"filtering, or need to switch it off for diagnostic purposes, then set ``mock." -"FILTER_DIR = False``." +"filtering, or need to switch it off for diagnostic purposes, then set " +"``mock.FILTER_DIR = False``." msgstr "" ":data:`FILTER_DIR` 是一個模組級別的變數,用於控制 mock 物件回應 :func:`dir` " "的方式。其預設值為 ``True``,它使用以下描述的過濾方式來只顯示有用的成員。如果" "你不喜歡這個過濾方式,或由於診斷意圖而需要將其關閉,請設定 ``mock.FILTER_DIR " "= False``。" -#: ../../library/unittest.mock.rst:2486 +#: ../../library/unittest.mock.rst:2487 msgid "" "With filtering on, ``dir(some_mock)`` shows only useful attributes and will " "include any dynamically created attributes that wouldn't normally be shown. " @@ -3343,7 +3351,7 @@ msgstr "" "的任何動態建立的屬性。如果 mock 是使用 *spec*\\ (或 *autospec*\\ )來建立" "的,那麼源頭的所有屬性都會顯示,即使它們尚未被存取:" -#: ../../library/unittest.mock.rst:2492 +#: ../../library/unittest.mock.rst:2493 msgid "" ">>> dir(Mock())\n" "['assert_any_call',\n" @@ -3381,7 +3389,7 @@ msgstr "" " 'BaseHandler',\n" " ..." -#: ../../library/unittest.mock.rst:2513 +#: ../../library/unittest.mock.rst:2514 msgid "" "Many of the not-very-useful (private to :class:`Mock` rather than the thing " "being mocked) underscore and double underscore prefixed attributes have been " @@ -3393,7 +3401,7 @@ msgstr "" "雙底線前綴屬性已從在 :class:`Mock` 上呼叫 :func:`dir` 的結果中濾除。如果你不" "喜歡這種特性,可以透過設定模組級別開關 :data:`FILTER_DIR` 來將其關閉:" -#: ../../library/unittest.mock.rst:2519 +#: ../../library/unittest.mock.rst:2520 msgid "" ">>> from unittest import mock\n" ">>> mock.FILTER_DIR = False\n" @@ -3419,21 +3427,21 @@ msgstr "" " '__class__',\n" " ..." -#: ../../library/unittest.mock.rst:2534 +#: ../../library/unittest.mock.rst:2535 msgid "" "Alternatively you can just use ``vars(my_mock)`` (instance members) and " "``dir(type(my_mock))`` (type members) to bypass the filtering irrespective " "of :const:`FILTER_DIR`." msgstr "" "或者,你可以只使用 ``vars(my_mock)``\\ (實例成員)和 " -"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考慮 :const:" -"`FILTER_DIR`。" +"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考" +"慮 :const:`FILTER_DIR`。" -#: ../../library/unittest.mock.rst:2540 +#: ../../library/unittest.mock.rst:2541 msgid "mock_open" msgstr "mock_open" -#: ../../library/unittest.mock.rst:2544 +#: ../../library/unittest.mock.rst:2545 msgid "" "A helper function to create a mock to replace the use of :func:`open`. It " "works for :func:`open` called directly or used as a context manager." @@ -3441,7 +3449,7 @@ msgstr "" "用於建立取代 :func:`open` 用途的 mock 的輔助函式。它適用於直接呼叫或用作情境" "管理器的 :func:`open`。" -#: ../../library/unittest.mock.rst:2547 +#: ../../library/unittest.mock.rst:2548 msgid "" "The *mock* argument is the mock object to configure. If ``None`` (the " "default) then a :class:`MagicMock` will be created for you, with the API " @@ -3450,41 +3458,43 @@ msgstr "" "*mock* 引數是要配置的 mock 物件。如果其為 ``None``\\ (預設值),那麼就會為你" "建立一個 :class:`MagicMock`,其 API 限制在標準檔案處理上可用的方法或屬性。" -#: ../../library/unittest.mock.rst:2551 -msgid "" -"*read_data* is a string for the :meth:`~io.RawIOBase.read`, :meth:`~io." -"IOBase.readline`, and :meth:`~io.IOBase.readlines` methods of the file " -"handle to return. Calls to those methods will take data from *read_data* " -"until it is depleted. The mock of these methods is pretty simplistic: every " -"time the *mock* is called, the *read_data* is rewound to the start. If you " -"need more control over the data that you are feeding to the tested code you " -"will need to customize this mock for yourself. When that is insufficient, " -"one of the in-memory filesystem packages on `PyPI `_ can " -"offer a realistic filesystem for testing." -msgstr "" -"*read_data* 是檔案處理方法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase." -"readline` 和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 " -"*read_data* 取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 " -"*mock* 時,*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行" -"更多控制,你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測" -"試的真實檔案系統。" - -#: ../../library/unittest.mock.rst:2561 +#: ../../library/unittest.mock.rst:2552 +msgid "" +"*read_data* is a string for " +"the :meth:`~io.RawIOBase.read`, :meth:`~io.IOBase.readline`, " +"and :meth:`~io.IOBase.readlines` methods of the file handle to return. " +"Calls to those methods will take data from *read_data* until it is " +"depleted. The mock of these methods is pretty simplistic: every time the " +"*mock* is called, the *read_data* is rewound to the start. If you need more " +"control over the data that you are feeding to the tested code you will need " +"to customize this mock for yourself. When that is insufficient, one of the " +"in-memory filesystem packages on `PyPI `_ can offer a " +"realistic filesystem for testing." +msgstr "" +"*read_data* 是檔案處理方" +"法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase.readline` " +"和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 *read_data* " +"取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 *mock* 時," +"*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行更多控制," +"你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的" +"其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測試的真實檔" +"案系統。" + +#: ../../library/unittest.mock.rst:2562 msgid "" "Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. " "The mock of :meth:`~io.RawIOBase.read` changed to consume *read_data* rather " "than returning it on each call." msgstr "" -"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支援。:" -"meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼叫時回" -"傳它。" +"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支" +"援。:meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼" +"叫時回傳它。" -#: ../../library/unittest.mock.rst:2566 +#: ../../library/unittest.mock.rst:2567 msgid "*read_data* is now reset on each call to the *mock*." msgstr "現在,每次呼叫 *mock* 時都會重置 *read_data*。" -#: ../../library/unittest.mock.rst:2569 +#: ../../library/unittest.mock.rst:2570 msgid "" "Added :meth:`~container.__iter__` to implementation so that iteration (such " "as in for loops) correctly consumes *read_data*." @@ -3492,7 +3502,7 @@ msgstr "" "新增 :meth:`~container.__iter__` 到實作中,以便使疊代(例如在 for 迴圈中)正" "確地消耗 *read_data*。" -#: ../../library/unittest.mock.rst:2573 +#: ../../library/unittest.mock.rst:2574 msgid "" "Using :func:`open` as a context manager is a great way to ensure your file " "handles are closed properly and is becoming common::" @@ -3500,7 +3510,7 @@ msgstr "" "使用 :func:`open` 作為情境管理器是確保檔案處理正確關閉的好方式,且這種方式正" "在變得普遍: ::" -#: ../../library/unittest.mock.rst:2576 +#: ../../library/unittest.mock.rst:2577 msgid "" "with open('/some/path', 'w') as f:\n" " f.write('something')" @@ -3508,17 +3518,17 @@ msgstr "" "with open('/some/path', 'w') as f:\n" " f.write('something')" -#: ../../library/unittest.mock.rst:2579 +#: ../../library/unittest.mock.rst:2580 msgid "" "The issue is that even if you mock out the call to :func:`open` it is the " -"*returned object* that is used as a context manager (and has :meth:`~object." -"__enter__` and :meth:`~object.__exit__` called)." +"*returned object* that is used as a context manager (and " +"has :meth:`~object.__enter__` and :meth:`~object.__exit__` called)." msgstr "" "問題是,即使你 mock 了對 :func:`open` 的呼叫,它也是作為情境管理器使用的\\ *" "回傳物件*\\ (且其 :meth:`~object.__enter__` 和 :meth:`~ object.__exit__` 已" "被呼叫)。" -#: ../../library/unittest.mock.rst:2583 +#: ../../library/unittest.mock.rst:2584 msgid "" "Mocking context managers with a :class:`MagicMock` is common enough and " "fiddly enough that a helper function is useful. ::" @@ -3526,7 +3536,7 @@ msgstr "" "使用 :class:`MagicMock` mock 情境管理器相當常見並且精細,因此輔助函式就非常有" "用: ::" -#: ../../library/unittest.mock.rst:2586 +#: ../../library/unittest.mock.rst:2587 msgid "" ">>> m = mock_open()\n" ">>> with patch('__main__.open', m):\n" @@ -3556,11 +3566,11 @@ msgstr "" ">>> handle = m()\n" ">>> handle.write.assert_called_once_with('some stuff')" -#: ../../library/unittest.mock.rst:2600 +#: ../../library/unittest.mock.rst:2601 msgid "And for reading files::" msgstr "以及讀取檔案: ::" -#: ../../library/unittest.mock.rst:2602 +#: ../../library/unittest.mock.rst:2603 msgid "" ">>> with patch('__main__.open', mock_open(read_data='bibble')) as m:\n" "... with open('foo') as h:\n" @@ -3576,29 +3586,29 @@ msgstr "" ">>> m.assert_called_once_with('foo')\n" ">>> assert result == 'bibble'" -#: ../../library/unittest.mock.rst:2613 +#: ../../library/unittest.mock.rst:2614 msgid "Autospeccing" msgstr "Autospeccing(自動規格)" -#: ../../library/unittest.mock.rst:2615 +#: ../../library/unittest.mock.rst:2616 msgid "" "Autospeccing is based on the existing :attr:`!spec` feature of mock. It " "limits the api of mocks to the api of an original object (the spec), but it " "is recursive (implemented lazily) so that attributes of mocks only have the " "same api as the attributes of the spec. In addition mocked functions / " -"methods have the same call signature as the original so they raise a :exc:" -"`TypeError` if they are called incorrectly." +"methods have the same call signature as the original so they raise " +"a :exc:`TypeError` if they are called incorrectly." msgstr "" "自動規格以 mock 現有的 :attr:`!spec` 功能作為基礎。它將 mock 的 api 限制為原" "始物件(規格)的 api,但它是遞迴的(惰性 (lazily) 實現),因此 mock 的屬性僅" "具有與規格的屬性相同的 api。此外,被 mock 的函式/方法具有與原始的函式/方法相" "同的呼叫簽名,因此如果它們被不正確地呼叫,就會引發 :exc:`TypeError`。" -#: ../../library/unittest.mock.rst:2622 +#: ../../library/unittest.mock.rst:2623 msgid "Before I explain how auto-speccing works, here's why it is needed." msgstr "在解釋自動規格如何運作之前,我們先解釋為什麼需要它。" -#: ../../library/unittest.mock.rst:2624 +#: ../../library/unittest.mock.rst:2625 msgid "" ":class:`Mock` is a very powerful and flexible object, but it suffers from a " "flaw which is general to mocking. If you refactor some of your code, rename " @@ -3611,7 +3621,7 @@ msgstr "" "實物件的程式碼測試仍然會通過。這意味著即使你的程式碼壞了,但測試仍可以全部通" "過。" -#: ../../library/unittest.mock.rst:2632 +#: ../../library/unittest.mock.rst:2633 msgid "" "Before 3.5, tests with a typo in the word assert would silently pass when " "they should raise an error. You can still achieve this behavior by passing " @@ -3620,7 +3630,7 @@ msgstr "" "在 3.5 之前,當測試應該引發錯誤時,斷言單字中存在拼字錯誤的測驗會默默地通過。" "你仍可以透過將 ``unsafe=True`` 傳遞給 Mock 來實作此行為。" -#: ../../library/unittest.mock.rst:2635 +#: ../../library/unittest.mock.rst:2636 msgid "" "Note that this is another reason why you need integration tests as well as " "unit tests. Testing everything in isolation is all fine and dandy, but if " @@ -3630,7 +3640,7 @@ msgstr "" "謹記這是你需要有整合測試和單元測試的另一個原因。單獨測試所有內容都很好,但如" "果你不測試你的單元是如何「連接在一起」的,那麼測試還是有機會發現很多錯誤。" -#: ../../library/unittest.mock.rst:2640 +#: ../../library/unittest.mock.rst:2641 msgid "" ":mod:`unittest.mock` already provides a feature to help with this, called " "speccing. If you use a class or instance as the :attr:`!spec` for a mock " @@ -3640,13 +3650,13 @@ msgstr "" "如果你使用類別或實例作為 mock 的 :attr:`!spec`,那麼你在 mock 上只能存取真實" "類別中存在的屬性:" -#: ../../library/unittest.mock.rst:2651 +#: ../../library/unittest.mock.rst:2652 msgid "" "The spec only applies to the mock itself, so we still have the same issue " "with any methods on the mock:" msgstr "該規格僅適用於 mock 本身,因此在 mock 上的任何方法仍然有相同的問題:" -#: ../../library/unittest.mock.rst:2654 +#: ../../library/unittest.mock.rst:2655 msgid "" ">>> mock.header_items()\n" "\n" @@ -3656,10 +3666,10 @@ msgstr "" "\n" ">>> mock.header_items.assret_called_with() # 故意的錯字!" -#: ../../library/unittest.mock.rst:2660 +#: ../../library/unittest.mock.rst:2661 msgid "" -"Auto-speccing solves this problem. You can either pass ``autospec=True`` to :" -"func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " +"Auto-speccing solves this problem. You can either pass ``autospec=True`` " +"to :func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " "function to create a mock with a spec. If you use the ``autospec=True`` " "argument to :func:`patch` then the object that is being replaced will be " "used as the spec object. Because the speccing is done \"lazily\" (the spec " @@ -3667,18 +3677,18 @@ msgid "" "complex or deeply nested objects (like modules that import modules that " "import modules) without a big performance hit." msgstr "" -"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞給 :func:`patch` / :" -"func:`patch.object` 或使用 :func:`create_autospec` 函式建立帶有規格的 mock。" -"如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取代的物件將作為規格" -"物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時作為屬性被建立" -"的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引用的模組)一起" -"使用,而不會過於影響性能。" +"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞" +"給 :func:`patch` / :func:`patch.object` 或使用 :func:`create_autospec` 函式建" +"立帶有規格的 mock。如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取" +"代的物件將作為規格物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時" +"作為屬性被建立的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引" +"用的模組)一起使用,而不會過於影響性能。" -#: ../../library/unittest.mock.rst:2669 +#: ../../library/unittest.mock.rst:2670 msgid "Here's an example of it in use::" msgstr "這是一個正在使用的例子: ::" -#: ../../library/unittest.mock.rst:2671 +#: ../../library/unittest.mock.rst:2672 msgid "" ">>> from urllib import request\n" ">>> patcher = patch('__main__.request', autospec=True)\n" @@ -3696,17 +3706,17 @@ msgstr "" ">>> mock_request.Request\n" "" -#: ../../library/unittest.mock.rst:2679 +#: ../../library/unittest.mock.rst:2680 msgid "" -"You can see that :class:`!request.Request` has a spec. :class:`!request." -"Request` takes two arguments in the constructor (one of which is *self*). " -"Here's what happens if we try to call it incorrectly::" +"You can see that :class:`!request.Request` has a spec. :class:`!" +"request.Request` takes two arguments in the constructor (one of which is " +"*self*). Here's what happens if we try to call it incorrectly::" msgstr "" "你可以看到 :class:`!request.Request` 有一個規格。:class:`!request.Request` 在" "建構函式中接受兩個引數(其中之一是 *self*\\ )。如果我們錯誤地呼叫它,會發生" "以下情況: ::" -#: ../../library/unittest.mock.rst:2683 +#: ../../library/unittest.mock.rst:2684 msgid "" ">>> req = request.Request()\n" "Traceback (most recent call last):\n" @@ -3718,13 +3728,13 @@ msgstr "" " ...\n" "TypeError: () takes at least 2 arguments (1 given)" -#: ../../library/unittest.mock.rst:2688 +#: ../../library/unittest.mock.rst:2689 msgid "" "The spec also applies to instantiated classes (i.e. the return value of " "specced mocks)::" msgstr "此規格也適用於實例化的類別(即有規格的 mock 的回傳值): ::" -#: ../../library/unittest.mock.rst:2691 +#: ../../library/unittest.mock.rst:2692 msgid "" ">>> req = request.Request('foo')\n" ">>> req\n" @@ -3734,7 +3744,7 @@ msgstr "" ">>> req\n" "" -#: ../../library/unittest.mock.rst:2695 +#: ../../library/unittest.mock.rst:2696 msgid "" ":class:`!Request` objects are not callable, so the return value of " "instantiating our mocked out :class:`!request.Request` is a non-callable " @@ -3745,7 +3755,7 @@ msgstr "" "request.Request` 的回傳值是不可呼叫的 mock。規格到位後,斷言中的任何拼字錯誤" "都會引發正確的錯誤: ::" -#: ../../library/unittest.mock.rst:2699 +#: ../../library/unittest.mock.rst:2700 msgid "" ">>> req.add_header('spam', 'eggs')\n" "\n" @@ -3763,7 +3773,7 @@ msgstr "" "AttributeError: Mock object has no attribute 'assret_called_with'\n" ">>> req.add_header.assert_called_with('spam', 'eggs')" -#: ../../library/unittest.mock.rst:2707 +#: ../../library/unittest.mock.rst:2708 msgid "" "In many cases you will just be able to add ``autospec=True`` to your " "existing :func:`patch` calls and then be protected against bugs due to typos " @@ -3772,15 +3782,15 @@ msgstr "" "在許多情況下,你只需要將 ``autospec=True`` 新增至現有的 :func:`patch` 呼叫" "中,然後就可以防止因拼字錯誤和 api 變更而導致的錯誤。" -#: ../../library/unittest.mock.rst:2711 +#: ../../library/unittest.mock.rst:2712 msgid "" -"As well as using *autospec* through :func:`patch` there is a :func:" -"`create_autospec` for creating autospecced mocks directly:" +"As well as using *autospec* through :func:`patch` there is " +"a :func:`create_autospec` for creating autospecced mocks directly:" msgstr "" -"除了透過 :func:`patch` 使用 *autospec* 之外,還有一個 :func:" -"`create_autospec` 用於直接建立有自動規格的 mock:" +"除了透過 :func:`patch` 使用 *autospec* 之外,還有一" +"個 :func:`create_autospec` 用於直接建立有自動規格的 mock:" -#: ../../library/unittest.mock.rst:2719 +#: ../../library/unittest.mock.rst:2720 msgid "" "This isn't without caveats and limitations however, which is why it is not " "the default behaviour. In order to know what attributes are available on the " @@ -3797,7 +3807,7 @@ msgstr "" "描述器,那麼你可能無法使用 autospec。換句話說,設計你的物件讓內省是安全的 " "[#]_ 會比較好。" -#: ../../library/unittest.mock.rst:2728 +#: ../../library/unittest.mock.rst:2729 msgid "" "A more serious problem is that it is common for instance attributes to be " "created in the :meth:`~object.__init__` method and not to exist on the class " @@ -3808,7 +3818,7 @@ msgstr "" "而其根本不存在於類別中。*autospec* 無法知道任何動態建立的屬性,並將 api 限制" "為可見的屬性。: ::" -#: ../../library/unittest.mock.rst:2733 +#: ../../library/unittest.mock.rst:2734 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3834,7 +3844,7 @@ msgstr "" " ...\n" "AttributeError: Mock object has no attribute 'a'" -#: ../../library/unittest.mock.rst:2745 +#: ../../library/unittest.mock.rst:2746 msgid "" "There are a few different ways of resolving this problem. The easiest, but " "not necessarily the least annoying, way is to simply set the required " @@ -3846,7 +3856,7 @@ msgstr "" "在 mock 上設定所需的屬性。因為雖然 *autospec* 不允許你取得規格中不存在的屬" "性,但是它不會阻止你設定它們: ::" -#: ../../library/unittest.mock.rst:2751 +#: ../../library/unittest.mock.rst:2752 msgid "" ">>> with patch('__main__.Something', autospec=True):\n" "... thing = Something()\n" @@ -3858,7 +3868,7 @@ msgstr "" "... thing.a = 33\n" "..." -#: ../../library/unittest.mock.rst:2756 +#: ../../library/unittest.mock.rst:2757 msgid "" "There is a more aggressive version of both *spec* and *autospec* that *does* " "prevent you setting non-existent attributes. This is useful if you want to " @@ -3869,7 +3879,7 @@ msgstr "" "屬性。如果你想確保你的程式碼僅能\\ *設定*\\ 有效的屬性,那麼這會很有用,但顯" "然它也順便阻止了這個特殊情況:" -#: ../../library/unittest.mock.rst:2769 +#: ../../library/unittest.mock.rst:2770 msgid "" "Probably the best way of solving the problem is to add class attributes as " "default values for instance members initialised in :meth:`~object.__init__`. " @@ -3881,7 +3891,7 @@ msgstr "" "的實例成員的預設值。請注意,如果你僅在 :meth:`!__init__` 中設定預設屬性,那麼" "透過類別屬性(當然在實例之間共用)提供它們也會更快。例如:" -#: ../../library/unittest.mock.rst:2775 +#: ../../library/unittest.mock.rst:2776 msgid "" "class Something:\n" " a = 33" @@ -3889,7 +3899,7 @@ msgstr "" "class Something:\n" " a = 33" -#: ../../library/unittest.mock.rst:2780 +#: ../../library/unittest.mock.rst:2781 msgid "" "This brings up another issue. It is relatively common to provide a default " "value of ``None`` for members that will later be an object of a different " @@ -3905,7 +3915,7 @@ msgstr "" "他型別的成員,因此自動規格不會對設定為 ``None`` 的成員使用規格。這些會只是普" "通的 mock(通常是 MagicMocks):" -#: ../../library/unittest.mock.rst:2795 +#: ../../library/unittest.mock.rst:2796 msgid "" "If modifying your production classes to add defaults isn't to your liking " "then there are more options. One of these is simply to use an instance as " @@ -3921,7 +3931,7 @@ msgstr "" "你使用替代物件作為規格。值得慶幸的是 :func:`patch` 支援這一點 - 你可以簡單地" "將替代物件作為 *autospec* 引數傳遞: ::" -#: ../../library/unittest.mock.rst:2803 +#: ../../library/unittest.mock.rst:2804 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3947,7 +3957,7 @@ msgstr "" ">>> mock.a\n" "" -#: ../../library/unittest.mock.rst:2816 +#: ../../library/unittest.mock.rst:2817 msgid "" "This only applies to classes or already instantiated objects. Calling a " "mocked class to create a mock instance *does not* create a real instance. It " @@ -3956,11 +3966,11 @@ msgstr "" "這只適用於類別或已經實例化的物件。呼叫一個被 mock 的類別來建立一個 mock 實例" "\\ *不會*\\ 建立真的實例。它僅查找屬性及對 :func:`dir` 的呼叫。" -#: ../../library/unittest.mock.rst:2821 +#: ../../library/unittest.mock.rst:2822 msgid "Sealing mocks" msgstr "密封 mock" -#: ../../library/unittest.mock.rst:2830 +#: ../../library/unittest.mock.rst:2831 msgid "" "Seal will disable the automatic creation of mocks when accessing an " "attribute of the mock being sealed or any of its attributes that are already " @@ -3969,7 +3979,7 @@ msgstr "" "當存取被密封的 mock 的屬性或其任何已經遞迴 mock 的屬性時,seal 將停用 mock 的" "自動建立。" -#: ../../library/unittest.mock.rst:2833 +#: ../../library/unittest.mock.rst:2834 msgid "" "If a mock instance with a name or a spec is assigned to an attribute it " "won't be considered in the sealing chain. This allows one to prevent seal " @@ -3978,7 +3988,7 @@ msgstr "" "如果將具有名稱或規格的 mock 實例指派給屬性,則不會出現在密封鏈中。這表示可藉" "由固定 mock 物件的一部分來防止密封。: ::" -#: ../../library/unittest.mock.rst:2837 +#: ../../library/unittest.mock.rst:2838 msgid "" ">>> mock = Mock()\n" ">>> mock.submock.attribute1 = 2\n" @@ -3996,52 +4006,52 @@ msgstr "" ">>> mock.submock.attribute2 # This will raise AttributeError.\n" ">>> mock.not_submock.attribute2 # This won't raise." -#: ../../library/unittest.mock.rst:2849 +#: ../../library/unittest.mock.rst:2850 msgid "" "Order of precedence of :attr:`!side_effect`, :attr:`!return_value` and " "*wraps*" msgstr ":attr:`!side_effect`、:attr:`!return_value` 和 *wraps* 的優先順序" -#: ../../library/unittest.mock.rst:2851 +#: ../../library/unittest.mock.rst:2852 msgid "The order of their precedence is:" msgstr "它們的優先順序是:" -#: ../../library/unittest.mock.rst:2853 +#: ../../library/unittest.mock.rst:2854 msgid ":attr:`~Mock.side_effect`" msgstr ":attr:`~Mock.side_effect`" -#: ../../library/unittest.mock.rst:2854 +#: ../../library/unittest.mock.rst:2855 msgid ":attr:`~Mock.return_value`" msgstr ":attr:`~Mock.return_value`" -#: ../../library/unittest.mock.rst:2855 +#: ../../library/unittest.mock.rst:2856 msgid "*wraps*" msgstr "*wraps*" -#: ../../library/unittest.mock.rst:2857 +#: ../../library/unittest.mock.rst:2858 msgid "" -"If all three are set, mock will return the value from :attr:`~Mock." -"side_effect`, ignoring :attr:`~Mock.return_value` and the wrapped object " -"altogether. If any two are set, the one with the higher precedence will " -"return the value. Regardless of the order of which was set first, the order " -"of precedence remains unchanged." +"If all three are set, mock will return the value " +"from :attr:`~Mock.side_effect`, ignoring :attr:`~Mock.return_value` and the " +"wrapped object altogether. If any two are set, the one with the higher " +"precedence will return the value. Regardless of the order of which was set " +"first, the order of precedence remains unchanged." msgstr "" "如果這三個都有設定,mock 將會回傳來自 :attr:`~Mock.side_effect` 的值,並忽" "略 :attr:`~Mock.return_value` 和被包裝物件。如果設定了任兩項,則優先順序較高" "的一項將回傳該值。無論先設定哪個順序,優先順序都保持不變。" -#: ../../library/unittest.mock.rst:2875 +#: ../../library/unittest.mock.rst:2876 msgid "" "As ``None`` is the default value of :attr:`~Mock.side_effect`, if you " "reassign its value back to ``None``, the order of precedence will be checked " -"between :attr:`~Mock.return_value` and the wrapped object, ignoring :attr:" -"`~Mock.side_effect`." +"between :attr:`~Mock.return_value` and the wrapped object, " +"ignoring :attr:`~Mock.side_effect`." msgstr "" "由於 ``None`` 是 :attr:`~Mock.side_effect` 的預設值,如果將其值重新賦值回為 " "``None``,則會檢查 :attr:`~Mock.return_value` 和被包裝物件之間的優先順序,忽" "略 :attr:`~Mock.side_effect`。" -#: ../../library/unittest.mock.rst:2884 +#: ../../library/unittest.mock.rst:2885 msgid "" "If the value being returned by :attr:`~Mock.side_effect` is :data:`DEFAULT`, " "it is ignored and the order of precedence moves to the successor to obtain " @@ -4050,21 +4060,21 @@ msgstr "" "如果 :attr:`~Mock.side_effect` 回傳的值是 :data:`DEFAULT`,它將被忽略,並且優" "先順序被移動到後面一個以獲得要回傳的值。" -#: ../../library/unittest.mock.rst:2893 +#: ../../library/unittest.mock.rst:2894 msgid "" -"When :class:`Mock` wraps an object, the default value of :attr:`~Mock." -"return_value` will be :data:`DEFAULT`." +"When :class:`Mock` wraps an object, the default value " +"of :attr:`~Mock.return_value` will be :data:`DEFAULT`." msgstr "" -"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將為 :" -"data:`DEFAULT`。" +"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將" +"為 :data:`DEFAULT`。" -#: ../../library/unittest.mock.rst:2902 +#: ../../library/unittest.mock.rst:2903 msgid "" "The order of precedence will ignore this value and it will move to the last " "successor which is the wrapped object." msgstr "優先順序將忽略該值,並將移動到最後一個,即被包裝物件。" -#: ../../library/unittest.mock.rst:2905 +#: ../../library/unittest.mock.rst:2906 msgid "" "As the real call is being made to the wrapped object, creating an instance " "of this mock will return the real instance of the class. The positional " @@ -4073,7 +4083,7 @@ msgstr "" "當對被包裝物件進行真正的呼叫時,建立此 mock 的實例將回傳該類別的真實實例。必" "須傳遞被包裝物件所需的位置引數(如果存在)。" -#: ../../library/unittest.mock.rst:2923 +#: ../../library/unittest.mock.rst:2924 msgid "" "But if you assign ``None`` to it, this will not be ignored as it is an " "explicit assignment. So, the order of precedence will not move to the " @@ -4082,13 +4092,13 @@ msgstr "" "但如果你為其賦予 ``None`` 則不會被忽略,因為它是明確賦值。因此,優先順序不會" "移至被包裝物件。" -#: ../../library/unittest.mock.rst:2931 +#: ../../library/unittest.mock.rst:2932 msgid "" "Even if you set all three at once when initializing the mock, the order of " "precedence remains the same:" msgstr "即使你在初始化 mock 時同時設定所有三個,優先順序也保持不變:" -#: ../../library/unittest.mock.rst:2948 +#: ../../library/unittest.mock.rst:2949 msgid "" "If :attr:`~Mock.side_effect` is exhausted, the order of precedence will not " "cause a value to be obtained from the successors. Instead, ``StopIteration`` " @@ -4099,18 +4109,18 @@ msgstr "" #~ msgid "" #~ "This can be useful where you want to make a series of assertions that " -#~ "reuse the same object. Note that :meth:`reset_mock` *doesn't* clear the :" -#~ "attr:`return_value`, :attr:`side_effect` or any child attributes you have " -#~ "set using normal assignment by default. In case you want to reset :attr:" -#~ "`return_value` or :attr:`side_effect`, then pass the corresponding " -#~ "parameter as ``True``. Child mocks and the return value mock (if any) are " -#~ "reset as well." +#~ "reuse the same object. Note that :meth:`reset_mock` *doesn't* clear " +#~ "the :attr:`return_value`, :attr:`side_effect` or any child attributes you " +#~ "have set using normal assignment by default. In case you want to " +#~ "reset :attr:`return_value` or :attr:`side_effect`, then pass the " +#~ "corresponding parameter as ``True``. Child mocks and the return value " +#~ "mock (if any) are reset as well." #~ msgstr "" #~ "這在你想要進行一系列重複使用同一物件的斷言時非常有用。請注意,預設情況" -#~ "下,:meth:`reset_mock` *不會*\\ 清除 :attr:`return_value`、:attr:" -#~ "`side_effect` 或使用普通賦值設定的任何子屬性。如果你想要重置 :attr:" -#~ "`return_value` 或 :attr:`side_effect`,則將相應的參數設置為 ``True``。" -#~ "Child mock 和回傳值 mock(如果有的話)也會被重置。" +#~ "下,:meth:`reset_mock` *不會*\\ 清" +#~ "除 :attr:`return_value`、:attr:`side_effect` 或使用普通賦值設定的任何子屬" +#~ "性。如果你想要重置 :attr:`return_value` 或 :attr:`side_effect`,則將相應的" +#~ "參數設置為 ``True``。Child mock 和回傳值 mock(如果有的話)也會被重置。" #~ msgid "*return_value*, and *side_effect* are keyword-only arguments." #~ msgstr "*return_value* 和 *side_effect* 是僅限關鍵字引數。" diff --git a/library/unittest.po b/library/unittest.po index 4fa631c5c0c..02b2ef821fe 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-04 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-10-16 06:03+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,8 +34,8 @@ msgid "" "(If you are already familiar with the basic concepts of testing, you might " "want to skip to :ref:`the list of assert methods `.)" msgstr "" -"(假如你已經熟悉相關基礎的測試概念,你可能會希望跳過以下段落,直接參考 :ref:" -"`assert 方法清單 `。)" +"(假如你已經熟悉相關基礎的測試概念,你可能會希望跳過以下段落,直接參" +"考 :ref:`assert 方法清單 `。)" #: ../../library/unittest.rst:19 msgid "" @@ -110,33 +110,33 @@ msgstr "" ":dfn:`test runner` 是一個編排測試執行與提供結果給使用者的一個元件。執行器可以" "使用圖形化介面,文字介面或是回傳一個特別值用來標示出執行測試的結果。" -#: ../../library/unittest.rst:52 +#: ../../library/unittest.rst:51 msgid "Module :mod:`doctest`" msgstr ":mod:`doctest` 模組" -#: ../../library/unittest.rst:53 +#: ../../library/unittest.rst:52 msgid "Another test-support module with a very different flavor." msgstr "另一個執行測試的模組,但使用不一樣的測試方法與規範。" -#: ../../library/unittest.rst:55 +#: ../../library/unittest.rst:54 msgid "" -"`Simple Smalltalk Testing: With Patterns `_" +"`Simple Smalltalk Testing: With Patterns `_" msgstr "" -"`Simple Smalltalk Testing: With Patterns `_" +"`Simple Smalltalk Testing: With Patterns `_" -#: ../../library/unittest.rst:56 +#: ../../library/unittest.rst:55 msgid "" "Kent Beck's original paper on testing frameworks using the pattern shared " "by :mod:`unittest`." msgstr "Kent Beck 的原始論文討論使用 :mod:`unittest` 這樣模式的測試框架。" -#: ../../library/unittest.rst:59 +#: ../../library/unittest.rst:58 msgid "`pytest `_" msgstr "`pytest `_" -#: ../../library/unittest.rst:60 +#: ../../library/unittest.rst:59 msgid "" "Third-party unittest framework with a lighter-weight syntax for writing " "tests. For example, ``assert func(10) == 42``." @@ -144,7 +144,7 @@ msgstr "" "第三方的單元測試框架,但在撰寫測試時使用更輕量的語法。例如: ``assert " "func(10) == 42``。" -#: ../../library/unittest.rst:63 +#: ../../library/unittest.rst:62 msgid "" "`The Python Testing Tools Taxonomy `_" @@ -152,7 +152,7 @@ msgstr "" "`The Python Testing Tools Taxonomy `_" -#: ../../library/unittest.rst:64 +#: ../../library/unittest.rst:63 msgid "" "An extensive list of Python testing tools including functional testing " "frameworks and mock object libraries." @@ -160,7 +160,7 @@ msgstr "" "一份詳細的 Python 測試工具列表,包含 functional testing 框架和mock object 函" "式庫。" -#: ../../library/unittest.rst:67 +#: ../../library/unittest.rst:66 msgid "" "`Testing in Python Mailing List `_" @@ -168,13 +168,13 @@ msgstr "" "`Testing in Python Mailing List `_" -#: ../../library/unittest.rst:68 +#: ../../library/unittest.rst:67 msgid "" "A special-interest-group for discussion of testing, and testing tools, in " "Python." msgstr "一個專門興趣的群組用來討論 Python 中的測試方式與測試工具。" -#: ../../library/unittest.rst:71 +#: ../../library/unittest.rst:70 msgid "" "The script :file:`Tools/unittestgui/unittestgui.py` in the Python source " "distribution is a GUI tool for test discovery and execution. This is " @@ -185,11 +185,11 @@ msgid "" "features/actions>`_, or `AppVeyor `_." msgstr "" -#: ../../library/unittest.rst:83 +#: ../../library/unittest.rst:82 msgid "Basic example" msgstr "簡單範例" -#: ../../library/unittest.rst:85 +#: ../../library/unittest.rst:84 msgid "" "The :mod:`unittest` module provides a rich set of tools for constructing and " "running tests. This section demonstrates that a small subset of the tools " @@ -198,11 +198,11 @@ msgstr "" ":mod:`unittest` 模組提供一系列豐富的工具用來建構與執行測試。本節將展示這一系" "列工具中一部份,它們已能滿足大部份使用者需求。" -#: ../../library/unittest.rst:89 +#: ../../library/unittest.rst:88 msgid "Here is a short script to test three string methods::" msgstr "這是一段簡短的腳本用來測試 3 個字串方法: ::" -#: ../../library/unittest.rst:91 +#: ../../library/unittest.rst:90 msgid "" "import unittest\n" "\n" @@ -226,7 +226,7 @@ msgid "" " unittest.main()" msgstr "" -#: ../../library/unittest.rst:113 +#: ../../library/unittest.rst:112 msgid "" "A test case is created by subclassing :class:`unittest.TestCase`. The three " "individual tests are defined with methods whose names start with the letters " @@ -237,22 +237,22 @@ msgstr "" "定義了三個獨立的物件方法,名稱皆以 ``test`` 開頭。這樣的命名方式能告知 test " "runner 哪些物件方法為定義的測試。" -#: ../../library/unittest.rst:118 +#: ../../library/unittest.rst:117 msgid "" "The crux of each test is a call to :meth:`~TestCase.assertEqual` to check " -"for an expected result; :meth:`~TestCase.assertTrue` or :meth:`~TestCase." -"assertFalse` to verify a condition; or :meth:`~TestCase.assertRaises` to " -"verify that a specific exception gets raised. These methods are used " -"instead of the :keyword:`assert` statement so the test runner can accumulate " -"all test results and produce a report." +"for an expected result; :meth:`~TestCase.assertTrue` " +"or :meth:`~TestCase.assertFalse` to verify a condition; " +"or :meth:`~TestCase.assertRaises` to verify that a specific exception gets " +"raised. These methods are used instead of the :keyword:`assert` statement " +"so the test runner can accumulate all test results and produce a report." msgstr "" -"每個測試的關鍵為呼叫 :meth:`~TestCase.assertEqual` 來確認是否為期望的結果; :" -"meth:`~TestCase.assertTrue` 或是 :meth:`~TestCase.assertFalse` 用來驗證一個條" -"件式; :meth:`~TestCase.assertRaises` 用來驗證是否觸發一個特定的 exception。" -"使用這些物件方法來取代 :keyword:`assert` 陳述句,將能使 test runner 收集所有" -"的測試結果並產生一個報表。" +"每個測試的關鍵為呼叫 :meth:`~TestCase.assertEqual` 來確認是否為期望的結" +"果; :meth:`~TestCase.assertTrue` 或是 :meth:`~TestCase.assertFalse` 用來驗證" +"一個條件式; :meth:`~TestCase.assertRaises` 用來驗證是否觸發一個特定的 " +"exception。使用這些物件方法來取代 :keyword:`assert` 陳述句,將能使 test " +"runner 收集所有的測試結果並產生一個報表。" -#: ../../library/unittest.rst:125 +#: ../../library/unittest.rst:124 msgid "" "The :meth:`~TestCase.setUp` and :meth:`~TestCase.tearDown` methods allow you " "to define instructions that will be executed before and after each test " @@ -260,7 +260,7 @@ msgid "" "tests`." msgstr "" -#: ../../library/unittest.rst:129 +#: ../../library/unittest.rst:128 msgid "" "The final block shows a simple way to run the tests. :func:`unittest.main` " "provides a command-line interface to the test script. When run from the " @@ -269,7 +269,7 @@ msgstr "" "最後將顯示一個簡單的方法去執行測試 :func:`unittest.main` 提供一個命令列介面測" "試腳本。當透過命令列執行,輸出結果將會像是: ::" -#: ../../library/unittest.rst:133 +#: ../../library/unittest.rst:132 msgid "" "...\n" "----------------------------------------------------------------------\n" @@ -283,16 +283,16 @@ msgstr "" "\n" "OK" -#: ../../library/unittest.rst:139 +#: ../../library/unittest.rst:138 msgid "" -"Passing the ``-v`` option to your test script will instruct :func:`unittest." -"main` to enable a higher level of verbosity, and produce the following " -"output::" +"Passing the ``-v`` option to your test script will " +"instruct :func:`unittest.main` to enable a higher level of verbosity, and " +"produce the following output::" msgstr "" "在測試時加入 ``-v`` 選項將指示 :func:`unittest.main` 提高 verbosity 層級,產" "生以下的輸出: ::" -#: ../../library/unittest.rst:142 +#: ../../library/unittest.rst:141 msgid "" "test_isupper (__main__.TestStringMethods.test_isupper) ... ok\n" "test_split (__main__.TestStringMethods.test_split) ... ok\n" @@ -312,7 +312,7 @@ msgstr "" "\n" "OK" -#: ../../library/unittest.rst:151 +#: ../../library/unittest.rst:150 msgid "" "The above examples show the most commonly used :mod:`unittest` features " "which are sufficient to meet many everyday testing needs. The remainder of " @@ -321,23 +321,23 @@ msgstr "" "以上的例子顯示大多數使用 :mod:`unittest` 特徵足以滿足大多數日常測試的需求。接" "下來第一部分文件的剩餘部分將繼續探索完整特徵設定。" -#: ../../library/unittest.rst:155 +#: ../../library/unittest.rst:154 msgid "" "The behavior of returning a value from a test method (other than the default " "``None`` value), is now deprecated." msgstr "" -#: ../../library/unittest.rst:163 +#: ../../library/unittest.rst:162 msgid "Command-Line Interface" msgstr "命令列介面" -#: ../../library/unittest.rst:165 +#: ../../library/unittest.rst:164 msgid "" "The unittest module can be used from the command line to run tests from " "modules, classes or even individual test methods::" msgstr "單元測試模組可以透過命令列執行測試模組,物件甚至個別的測試方法: ::" -#: ../../library/unittest.rst:168 +#: ../../library/unittest.rst:167 msgid "" "python -m unittest test_module1 test_module2\n" "python -m unittest test_module.TestClass\n" @@ -347,21 +347,21 @@ msgstr "" "python -m unittest test_module.TestClass\n" "python -m unittest test_module.TestClass.test_method" -#: ../../library/unittest.rst:172 +#: ../../library/unittest.rst:171 msgid "" "You can pass in a list with any combination of module names, and fully " "qualified class or method names." msgstr "你可以通過一個串列與任何模組名稱的組合,完全符合類別與方法的名稱。" -#: ../../library/unittest.rst:175 +#: ../../library/unittest.rst:174 msgid "Test modules can be specified by file path as well::" msgstr "測試模組可以根據檔案路徑指定: ::" -#: ../../library/unittest.rst:177 +#: ../../library/unittest.rst:176 msgid "python -m unittest tests/test_something.py" msgstr "python -m unittest tests/test_something.py" -#: ../../library/unittest.rst:179 +#: ../../library/unittest.rst:178 msgid "" "This allows you to use the shell filename completion to specify the test " "module. The file specified must still be importable as a module. The path is " @@ -370,53 +370,59 @@ msgid "" "importable as a module you should execute the file directly instead." msgstr "" "這允許你使用 shell 檔案名稱補完功能 (filename completion) 來指定測試模組。給" -"定的檔案路徑必須亦能被當作模組 import。此路徑轉換為模組名稱的方式為移除 '." -"py' 並將路徑分隔符 (path separator) 轉換成 '.'。 假如你的測試檔案無法被 " +"定的檔案路徑必須亦能被當作模組 import。此路徑轉換為模組名稱的方式為移除 " +"'.py' 並將路徑分隔符 (path separator) 轉換成 '.'。 假如你的測試檔案無法被 " "import 成模組,你應該直接執行該測試檔案。" -#: ../../library/unittest.rst:185 +#: ../../library/unittest.rst:184 msgid "" "You can run tests with more detail (higher verbosity) by passing in the -v " "flag::" msgstr "" "通過增加 -v 的旗標數,可以在你執行測試時得到更多細節(更高的 verbosity): ::" -#: ../../library/unittest.rst:187 +#: ../../library/unittest.rst:186 msgid "python -m unittest -v test_module" msgstr "python -m unittest -v test_module" -#: ../../library/unittest.rst:189 +#: ../../library/unittest.rst:188 msgid "" "When executed without arguments :ref:`unittest-test-discovery` is started::" msgstr "若執行時不代任何引數,將執行 :ref:`unittest-test-discovery`: ::" -#: ../../library/unittest.rst:191 +#: ../../library/unittest.rst:190 msgid "python -m unittest" msgstr "python -m unittest" -#: ../../library/unittest.rst:193 +#: ../../library/unittest.rst:192 msgid "For a list of all the command-line options::" msgstr "列出所有命令列選項: ::" -#: ../../library/unittest.rst:195 +#: ../../library/unittest.rst:194 msgid "python -m unittest -h" msgstr "python -m unittest -h" -#: ../../library/unittest.rst:197 +#: ../../library/unittest.rst:196 msgid "" "In earlier versions it was only possible to run individual test methods and " "not modules or classes." msgstr "在早期的版本可以個別執行測試方法和不需要模組或是類別。" -#: ../../library/unittest.rst:203 +#: ../../library/unittest.rst:200 +msgid "" +"Output is colorized by default and can be :ref:`controlled using environment " +"variables `." +msgstr "" + +#: ../../library/unittest.rst:205 msgid "Command-line options" msgstr "命令列模式選項" -#: ../../library/unittest.rst:205 +#: ../../library/unittest.rst:207 msgid ":program:`unittest` supports these command-line options:" msgstr ":program:`unittest` 支援以下命令列選項:" -#: ../../library/unittest.rst:211 +#: ../../library/unittest.rst:213 msgid "" "The standard output and standard error streams are buffered during the test " "run. Output during a passing test is discarded. Output is echoed normally on " @@ -426,7 +432,7 @@ msgstr "" "出在測試通過時被丟棄。若是測試錯誤或失則,這些輸出將會正常地被印出,並且被加" "入至錯誤訊息中。" -#: ../../library/unittest.rst:217 +#: ../../library/unittest.rst:219 msgid "" ":kbd:`Control-C` during the test run waits for the current test to end and " "then reports all the results so far. A second :kbd:`Control-C` raises the " @@ -435,91 +441,91 @@ msgstr "" ":kbd:`Control-C` 測試執行過程中等待正確的測試結果並回報目前為止所有的測試結" "果。第二個 :kbd:`Control-C` 拋出一般例外 :exc:`KeyboardInterrupt`。" -#: ../../library/unittest.rst:221 +#: ../../library/unittest.rst:223 msgid "" "See `Signal Handling`_ for the functions that provide this functionality." msgstr "參照 `Signal Handling`_ 針對函式提供的功能。" -#: ../../library/unittest.rst:225 +#: ../../library/unittest.rst:227 msgid "Stop the test run on the first error or failure." msgstr "在第一次錯誤或是失敗停止執行測試。" -#: ../../library/unittest.rst:229 +#: ../../library/unittest.rst:231 msgid "" "Only run test methods and classes that match the pattern or substring. This " "option may be used multiple times, in which case all test cases that match " "any of the given patterns are included." msgstr "" -#: ../../library/unittest.rst:233 +#: ../../library/unittest.rst:235 msgid "" "Patterns that contain a wildcard character (``*``) are matched against the " "test name using :meth:`fnmatch.fnmatchcase`; otherwise simple case-sensitive " "substring matching is used." msgstr "" -#: ../../library/unittest.rst:237 +#: ../../library/unittest.rst:239 msgid "" "Patterns are matched against the fully qualified test method name as " "imported by the test loader." msgstr "" -#: ../../library/unittest.rst:240 +#: ../../library/unittest.rst:242 msgid "" "For example, ``-k foo`` matches ``foo_tests.SomeTest.test_something``, " -"``bar_tests.SomeTest.test_foo``, but not ``bar_tests.FooTest." -"test_something``." +"``bar_tests.SomeTest.test_foo``, but not " +"``bar_tests.FooTest.test_something``." msgstr "" -#: ../../library/unittest.rst:245 +#: ../../library/unittest.rst:247 msgid "Show local variables in tracebacks." msgstr "透過 traceback 顯示本地變數。" -#: ../../library/unittest.rst:249 +#: ../../library/unittest.rst:251 msgid "Show the N slowest test cases (N=0 for all)." msgstr "" -#: ../../library/unittest.rst:251 +#: ../../library/unittest.rst:253 msgid "The command-line options ``-b``, ``-c`` and ``-f`` were added." msgstr "增加命令列模式選項 ``-b`` 、 ``-c`` 與 ``-f``。" -#: ../../library/unittest.rst:254 +#: ../../library/unittest.rst:256 msgid "The command-line option ``--locals``." msgstr "命令列選項 ``--locals``。" -#: ../../library/unittest.rst:257 +#: ../../library/unittest.rst:259 msgid "The command-line option ``-k``." msgstr "命令列選項 ``-k``。" -#: ../../library/unittest.rst:260 +#: ../../library/unittest.rst:262 msgid "The command-line option ``--durations``." msgstr "命令列選項 ``--durations``。" -#: ../../library/unittest.rst:263 +#: ../../library/unittest.rst:265 msgid "" "The command line can also be used for test discovery, for running all of the " "tests in a project or just a subset." msgstr "" "對執行所有的專案或是一個子集合測試,命令列模式可以可以被用來做測試探索。" -#: ../../library/unittest.rst:269 +#: ../../library/unittest.rst:271 msgid "Test Discovery" msgstr "Test Discovery(測試探索)" -#: ../../library/unittest.rst:273 +#: ../../library/unittest.rst:275 msgid "" "Unittest supports simple test discovery. In order to be compatible with test " -"discovery, all of the test files must be :ref:`modules ` or :" -"ref:`packages ` importable from the top-level directory of the " -"project (this means that their filenames must be valid :ref:`identifiers " +"discovery, all of the test files must be :ref:`modules ` " +"or :ref:`packages ` importable from the top-level directory of " +"the project (this means that their filenames must be valid :ref:`identifiers " "`)." msgstr "" "單元測試支援簡單的 test discovery(測試探索)。為了相容於測試探索,所有的測試" "檔案都要是\\ :ref:`模組 `\\ 或是\\ :ref:`套件 `," -"並能從專案的最上層目錄中 import(代表它們的檔案名稱必須是有效的 :ref:" -"`identifiers `\\ )。" +"並能從專案的最上層目錄中 import(代表它們的檔案名稱必須是有效" +"的 :ref:`identifiers `\\ )。" -#: ../../library/unittest.rst:279 +#: ../../library/unittest.rst:281 msgid "" "Test discovery is implemented in :meth:`TestLoader.discover`, but can also " "be used from the command line. The basic command-line usage is::" @@ -527,7 +533,7 @@ msgstr "" "Test discovery(測試探索)實作在 :meth:`TestLoader.discover`,但也可以被用於" "命令列模式。基本的命令列模式用法如下: ::" -#: ../../library/unittest.rst:282 +#: ../../library/unittest.rst:284 msgid "" "cd project_directory\n" "python -m unittest discover" @@ -535,7 +541,7 @@ msgstr "" "cd project_directory\n" "python -m unittest discover" -#: ../../library/unittest.rst:287 +#: ../../library/unittest.rst:289 msgid "" "As a shortcut, ``python -m unittest`` is the equivalent of ``python -m " "unittest discover``. If you want to pass arguments to test discovery the " @@ -545,27 +551,27 @@ msgstr "" "discover``。假如你想傳遞引數至探索測試的話,一定要明確地加入 ``discover`` 子" "指令。" -#: ../../library/unittest.rst:291 +#: ../../library/unittest.rst:293 msgid "The ``discover`` sub-command has the following options:" msgstr "``discover`` 子命令有以下幾個選項:" -#: ../../library/unittest.rst:297 +#: ../../library/unittest.rst:299 msgid "Verbose output" msgstr "詳細 (verbose) 輸出" -#: ../../library/unittest.rst:301 +#: ../../library/unittest.rst:303 msgid "Directory to start discovery (``.`` default)" msgstr "開始尋找的資料夾(預設為 ``.``\\ )" -#: ../../library/unittest.rst:305 +#: ../../library/unittest.rst:307 msgid "Pattern to match test files (``test*.py`` default)" msgstr "匹配測試檔案的模式(預設為 ``test*.py``\\ )" -#: ../../library/unittest.rst:309 +#: ../../library/unittest.rst:311 msgid "Top level directory of project (defaults to start directory)" msgstr "專案的最高階層目錄(預設為開始的資料夾)" -#: ../../library/unittest.rst:311 +#: ../../library/unittest.rst:313 msgid "" "The :option:`-s`, :option:`-p`, and :option:`-t` options can be passed in as " "positional arguments in that order. The following two command lines are " @@ -574,7 +580,7 @@ msgstr "" ":option:`-s`, :option:`-p`, 和 :option:`-t` 選項依照傳遞位置作為引數排序順" "序。以下兩個命令列被視為等價: ::" -#: ../../library/unittest.rst:315 +#: ../../library/unittest.rst:317 msgid "" "python -m unittest discover -s project_directory -p \"*_test.py\"\n" "python -m unittest discover project_directory \"*_test.py\"" @@ -582,7 +588,7 @@ msgstr "" "python -m unittest discover -s project_directory -p \"*_test.py\"\n" "python -m unittest discover project_directory \"*_test.py\"" -#: ../../library/unittest.rst:318 +#: ../../library/unittest.rst:320 msgid "" "As well as being a path it is possible to pass a package name, for example " "``myproject.subpackage.test``, as the start directory. The package name you " @@ -590,7 +596,7 @@ msgid "" "as the start directory." msgstr "" -#: ../../library/unittest.rst:325 +#: ../../library/unittest.rst:327 msgid "" "Test discovery loads tests by importing them. Once test discovery has found " "all the test files from the start directory you specify it turns the paths " @@ -598,94 +604,79 @@ msgid "" "imported as ``foo.bar.baz``." msgstr "" -#: ../../library/unittest.rst:330 +#: ../../library/unittest.rst:332 msgid "" "If you have a package installed globally and attempt test discovery on a " "different copy of the package then the import *could* happen from the wrong " "place. If this happens test discovery will warn you and exit." msgstr "" -#: ../../library/unittest.rst:334 +#: ../../library/unittest.rst:336 msgid "" "If you supply the start directory as a package name rather than a path to a " "directory then discover assumes that whichever location it imports from is " "the location you intended, so you will not get the warning." msgstr "" -#: ../../library/unittest.rst:339 +#: ../../library/unittest.rst:341 msgid "" "Test modules and packages can customize test loading and discovery by " "through the `load_tests protocol`_." msgstr "" -#: ../../library/unittest.rst:342 -msgid "" -"Test discovery supports :term:`namespace packages ` for " -"the start directory. Note that you need to specify the top level directory " -"too (e.g. ``python -m unittest discover -s root/namespace -t root``)." +#: ../../library/unittest.rst:344 +msgid "Test discovery supports :term:`namespace packages `." msgstr "" -#: ../../library/unittest.rst:348 +#: ../../library/unittest.rst:347 msgid "" -":mod:`unittest` dropped the :term:`namespace packages ` " -"support in Python 3.11. It has been broken since Python 3.7. Start directory " -"and subdirectories containing tests must be regular package that have " +"Test discovery dropped the :term:`namespace packages ` " +"support. It has been broken since Python 3.7. Start directory and its " +"subdirectories containing tests must be regular package that have " "``__init__.py`` file." msgstr "" -#: ../../library/unittest.rst:354 +#: ../../library/unittest.rst:353 msgid "" -"Directories containing start directory still can be a namespace package. In " -"this case, you need to specify start directory as dotted package name, and " -"target directory explicitly. For example::" +"If the start directory is the dotted name of the package, the ancestor " +"packages can be namespace packages." msgstr "" -#: ../../library/unittest.rst:358 +#: ../../library/unittest.rst:356 msgid "" -"# proj/ <-- current directory\n" -"# namespace/\n" -"# mypkg/\n" -"# __init__.py\n" -"# test_mypkg.py\n" -"\n" -"python -m unittest discover -s namespace.mypkg -t ." +"Test discovery supports :term:`namespace package` as start directory again. " +"To avoid scanning directories unrelated to Python, tests are not searched in " +"subdirectories that do not contain ``__init__.py``." msgstr "" -"# proj/ <-- current directory\n" -"# namespace/\n" -"# mypkg/\n" -"# __init__.py\n" -"# test_mypkg.py\n" -"\n" -"python -m unittest discover -s namespace.mypkg -t ." -#: ../../library/unittest.rst:370 +#: ../../library/unittest.rst:365 msgid "Organizing test code" msgstr "" -#: ../../library/unittest.rst:372 +#: ../../library/unittest.rst:367 msgid "" "The basic building blocks of unit testing are :dfn:`test cases` --- single " -"scenarios that must be set up and checked for correctness. In :mod:" -"`unittest`, test cases are represented by :class:`unittest.TestCase` " -"instances. To make your own test cases you must write subclasses of :class:" -"`TestCase` or use :class:`FunctionTestCase`." +"scenarios that must be set up and checked for correctness. " +"In :mod:`unittest`, test cases are represented by :class:`unittest.TestCase` " +"instances. To make your own test cases you must write subclasses " +"of :class:`TestCase` or use :class:`FunctionTestCase`." msgstr "" -#: ../../library/unittest.rst:378 +#: ../../library/unittest.rst:373 msgid "" "The testing code of a :class:`TestCase` instance should be entirely self " "contained, such that it can be run either in isolation or in arbitrary " "combination with any number of other test cases." msgstr "" -#: ../../library/unittest.rst:382 +#: ../../library/unittest.rst:377 msgid "" "The simplest :class:`TestCase` subclass will simply implement a test method " "(i.e. a method whose name starts with ``test``) in order to perform specific " "testing code::" msgstr "" -#: ../../library/unittest.rst:386 +#: ../../library/unittest.rst:381 msgid "" "import unittest\n" "\n" @@ -701,7 +692,7 @@ msgstr "" " widget = Widget('The widget')\n" " self.assertEqual(widget.size(), (50, 50))" -#: ../../library/unittest.rst:393 +#: ../../library/unittest.rst:388 msgid "" "Note that in order to test something, we use one of the :ref:`assert\\* " "methods ` provided by the :class:`TestCase` base class. If " @@ -710,15 +701,15 @@ msgid "" "other exceptions will be treated as :dfn:`errors`." msgstr "" -#: ../../library/unittest.rst:399 +#: ../../library/unittest.rst:394 msgid "" "Tests can be numerous, and their set-up can be repetitive. Luckily, we can " -"factor out set-up code by implementing a method called :meth:`~TestCase." -"setUp`, which the testing framework will automatically call for every single " -"test we run::" +"factor out set-up code by implementing a method " +"called :meth:`~TestCase.setUp`, which the testing framework will " +"automatically call for every single test we run::" msgstr "" -#: ../../library/unittest.rst:404 +#: ../../library/unittest.rst:399 msgid "" "import unittest\n" "\n" @@ -750,26 +741,26 @@ msgstr "" " self.assertEqual(self.widget.size(), (100,150),\n" " 'wrong size after resize')" -#: ../../library/unittest.rst:420 +#: ../../library/unittest.rst:415 msgid "" "The order in which the various tests will be run is determined by sorting " "the test method names with respect to the built-in ordering for strings." msgstr "" -#: ../../library/unittest.rst:424 +#: ../../library/unittest.rst:419 msgid "" "If the :meth:`~TestCase.setUp` method raises an exception while the test is " "running, the framework will consider the test to have suffered an error, and " "the test method will not be executed." msgstr "" -#: ../../library/unittest.rst:428 +#: ../../library/unittest.rst:423 msgid "" "Similarly, we can provide a :meth:`~TestCase.tearDown` method that tidies up " "after the test method has been run::" msgstr "" -#: ../../library/unittest.rst:431 +#: ../../library/unittest.rst:426 msgid "" "import unittest\n" "\n" @@ -789,38 +780,38 @@ msgstr "" " def tearDown(self):\n" " self.widget.dispose()" -#: ../../library/unittest.rst:440 +#: ../../library/unittest.rst:435 msgid "" "If :meth:`~TestCase.setUp` succeeded, :meth:`~TestCase.tearDown` will be run " "whether the test method succeeded or not." msgstr "" -#: ../../library/unittest.rst:443 +#: ../../library/unittest.rst:438 msgid "" "Such a working environment for the testing code is called a :dfn:`test " "fixture`. A new TestCase instance is created as a unique test fixture used " -"to execute each individual test method. Thus :meth:`~TestCase.setUp`, :meth:" -"`~TestCase.tearDown`, and :meth:`~TestCase.__init__` will be called once per " -"test." +"to execute each individual test method. " +"Thus :meth:`~TestCase.setUp`, :meth:`~TestCase.tearDown`, " +"and :meth:`~TestCase.__init__` will be called once per test." msgstr "" -#: ../../library/unittest.rst:449 +#: ../../library/unittest.rst:444 msgid "" "It is recommended that you use TestCase implementations to group tests " "together according to the features they test. :mod:`unittest` provides a " -"mechanism for this: the :dfn:`test suite`, represented by :mod:`unittest`'s :" -"class:`TestSuite` class. In most cases, calling :func:`unittest.main` will " -"do the right thing and collect all the module's test cases for you and " -"execute them." +"mechanism for this: the :dfn:`test suite`, represented " +"by :mod:`unittest`'s :class:`TestSuite` class. In most cases, " +"calling :func:`unittest.main` will do the right thing and collect all the " +"module's test cases for you and execute them." msgstr "" -#: ../../library/unittest.rst:456 +#: ../../library/unittest.rst:451 msgid "" "However, should you want to customize the building of your test suite, you " "can do it yourself::" msgstr "" -#: ../../library/unittest.rst:459 +#: ../../library/unittest.rst:454 msgid "" "def suite():\n" " suite = unittest.TestSuite()\n" @@ -842,7 +833,7 @@ msgstr "" " runner = unittest.TextTestRunner()\n" " runner.run(suite())" -#: ../../library/unittest.rst:469 +#: ../../library/unittest.rst:464 msgid "" "You can place the definitions of test cases and test suites in the same " "modules as the code they are to test (such as :file:`widget.py`), but there " @@ -850,63 +841,63 @@ msgid "" "as :file:`test_widget.py`:" msgstr "" -#: ../../library/unittest.rst:474 +#: ../../library/unittest.rst:469 msgid "The test module can be run standalone from the command line." msgstr "" -#: ../../library/unittest.rst:476 +#: ../../library/unittest.rst:471 msgid "The test code can more easily be separated from shipped code." msgstr "" -#: ../../library/unittest.rst:478 +#: ../../library/unittest.rst:473 msgid "" "There is less temptation to change test code to fit the code it tests " "without a good reason." msgstr "" -#: ../../library/unittest.rst:481 +#: ../../library/unittest.rst:476 msgid "" "Test code should be modified much less frequently than the code it tests." msgstr "" -#: ../../library/unittest.rst:483 +#: ../../library/unittest.rst:478 msgid "Tested code can be refactored more easily." msgstr "" -#: ../../library/unittest.rst:485 +#: ../../library/unittest.rst:480 msgid "" "Tests for modules written in C must be in separate modules anyway, so why " "not be consistent?" msgstr "" -#: ../../library/unittest.rst:488 +#: ../../library/unittest.rst:483 msgid "" "If the testing strategy changes, there is no need to change the source code." msgstr "" -#: ../../library/unittest.rst:494 +#: ../../library/unittest.rst:489 msgid "Re-using old test code" msgstr "" -#: ../../library/unittest.rst:496 +#: ../../library/unittest.rst:491 msgid "" "Some users will find that they have existing test code that they would like " "to run from :mod:`unittest`, without converting every old test function to " "a :class:`TestCase` subclass." msgstr "" -#: ../../library/unittest.rst:500 +#: ../../library/unittest.rst:495 msgid "" "For this reason, :mod:`unittest` provides a :class:`FunctionTestCase` class. " "This subclass of :class:`TestCase` can be used to wrap an existing test " "function. Set-up and tear-down functions can also be provided." msgstr "" -#: ../../library/unittest.rst:504 +#: ../../library/unittest.rst:499 msgid "Given the following test function::" msgstr "" -#: ../../library/unittest.rst:506 +#: ../../library/unittest.rst:501 msgid "" "def testSomething():\n" " something = makeSomething()\n" @@ -918,13 +909,13 @@ msgstr "" " assert something.name is not None\n" " # ..." -#: ../../library/unittest.rst:511 +#: ../../library/unittest.rst:506 msgid "" "one can create an equivalent test case instance as follows, with optional " "set-up and tear-down methods::" msgstr "" -#: ../../library/unittest.rst:514 +#: ../../library/unittest.rst:509 msgid "" "testcase = unittest.FunctionTestCase(testSomething,\n" " setUp=makeSomethingDB,\n" @@ -934,7 +925,7 @@ msgstr "" " setUp=makeSomethingDB,\n" " tearDown=deleteSomethingDB)" -#: ../../library/unittest.rst:520 +#: ../../library/unittest.rst:515 msgid "" "Even though :class:`FunctionTestCase` can be used to quickly convert an " "existing test base over to a :mod:`unittest`\\ -based system, this approach " @@ -942,19 +933,20 @@ msgid "" "subclasses will make future test refactorings infinitely easier." msgstr "" -#: ../../library/unittest.rst:525 +#: ../../library/unittest.rst:520 msgid "" -"In some cases, the existing tests may have been written using the :mod:" -"`doctest` module. If so, :mod:`doctest` provides a :class:`DocTestSuite` " -"class that can automatically build :class:`unittest.TestSuite` instances " -"from the existing :mod:`doctest`\\ -based tests." +"In some cases, the existing tests may have been written using " +"the :mod:`doctest` module. If so, :mod:`doctest` provides " +"a :class:`DocTestSuite` class that can automatically " +"build :class:`unittest.TestSuite` instances from the " +"existing :mod:`doctest`\\ -based tests." msgstr "" -#: ../../library/unittest.rst:534 +#: ../../library/unittest.rst:529 msgid "Skipping tests and expected failures" msgstr "" -#: ../../library/unittest.rst:538 +#: ../../library/unittest.rst:533 msgid "" "Unittest supports skipping individual test methods and even whole classes of " "tests. In addition, it supports marking a test as an \"expected failure,\" " @@ -962,19 +954,19 @@ msgid "" "on a :class:`TestResult`." msgstr "" -#: ../../library/unittest.rst:543 +#: ../../library/unittest.rst:538 msgid "" -"Skipping a test is simply a matter of using the :func:`skip` :term:" -"`decorator` or one of its conditional variants, calling :meth:`TestCase." -"skipTest` within a :meth:`~TestCase.setUp` or test method, or raising :exc:" -"`SkipTest` directly." +"Skipping a test is simply a matter of using " +"the :func:`skip` :term:`decorator` or one of its conditional variants, " +"calling :meth:`TestCase.skipTest` within a :meth:`~TestCase.setUp` or test " +"method, or raising :exc:`SkipTest` directly." msgstr "" -#: ../../library/unittest.rst:547 +#: ../../library/unittest.rst:542 msgid "Basic skipping looks like this::" msgstr "" -#: ../../library/unittest.rst:549 +#: ../../library/unittest.rst:544 msgid "" "class MyTestCase(unittest.TestCase):\n" "\n" @@ -1001,11 +993,11 @@ msgid "" " pass" msgstr "" -#: ../../library/unittest.rst:572 +#: ../../library/unittest.rst:567 msgid "This is the output of running the example above in verbose mode::" msgstr "" -#: ../../library/unittest.rst:574 +#: ../../library/unittest.rst:569 msgid "" "test_format (__main__.MyTestCase.test_format) ... skipped 'not supported in " "this library version'\n" @@ -1022,11 +1014,11 @@ msgid "" "OK (skipped=4)" msgstr "" -#: ../../library/unittest.rst:584 +#: ../../library/unittest.rst:579 msgid "Classes can be skipped just like methods::" msgstr "" -#: ../../library/unittest.rst:586 +#: ../../library/unittest.rst:581 msgid "" "@unittest.skip(\"showing class skipping\")\n" "class MySkippedTestCase(unittest.TestCase):\n" @@ -1034,17 +1026,17 @@ msgid "" " pass" msgstr "" -#: ../../library/unittest.rst:591 +#: ../../library/unittest.rst:586 msgid "" ":meth:`TestCase.setUp` can also skip the test. This is useful when a " "resource that needs to be set up is not available." msgstr "" -#: ../../library/unittest.rst:594 +#: ../../library/unittest.rst:589 msgid "Expected failures use the :func:`expectedFailure` decorator. ::" msgstr "" -#: ../../library/unittest.rst:596 +#: ../../library/unittest.rst:591 msgid "" "class ExpectedFailureTestCase(unittest.TestCase):\n" " @unittest.expectedFailure\n" @@ -1056,14 +1048,14 @@ msgstr "" " def test_fail(self):\n" " self.assertEqual(1, 0, \"broken\")" -#: ../../library/unittest.rst:601 +#: ../../library/unittest.rst:596 msgid "" "It's easy to roll your own skipping decorators by making a decorator that " "calls :func:`skip` on the test when it wants it to be skipped. This " "decorator skips the test unless the passed object has a certain attribute::" msgstr "" -#: ../../library/unittest.rst:605 +#: ../../library/unittest.rst:600 msgid "" "def skipUnlessHasattr(obj, attr):\n" " if hasattr(obj, attr):\n" @@ -1075,27 +1067,27 @@ msgstr "" " return lambda func: func\n" " return unittest.skip(\"{!r} doesn't have {!r}\".format(obj, attr))" -#: ../../library/unittest.rst:610 +#: ../../library/unittest.rst:605 msgid "" "The following decorators and exception implement test skipping and expected " "failures:" msgstr "" -#: ../../library/unittest.rst:614 +#: ../../library/unittest.rst:609 msgid "" "Unconditionally skip the decorated test. *reason* should describe why the " "test is being skipped." msgstr "" -#: ../../library/unittest.rst:619 +#: ../../library/unittest.rst:614 msgid "Skip the decorated test if *condition* is true." msgstr "" -#: ../../library/unittest.rst:623 +#: ../../library/unittest.rst:618 msgid "Skip the decorated test unless *condition* is true." msgstr "" -#: ../../library/unittest.rst:627 +#: ../../library/unittest.rst:622 msgid "" "Mark the test as an expected failure or error. If the test fails or errors " "in the test function itself (rather than in one of the :dfn:`test fixture` " @@ -1103,40 +1095,41 @@ msgid "" "be considered a failure." msgstr "" -#: ../../library/unittest.rst:634 +#: ../../library/unittest.rst:629 msgid "This exception is raised to skip a test." msgstr "" -#: ../../library/unittest.rst:636 +#: ../../library/unittest.rst:631 msgid "" "Usually you can use :meth:`TestCase.skipTest` or one of the skipping " "decorators instead of raising this directly." msgstr "" -#: ../../library/unittest.rst:639 +#: ../../library/unittest.rst:634 msgid "" -"Skipped tests will not have :meth:`~TestCase.setUp` or :meth:`~TestCase." -"tearDown` run around them. Skipped classes will not have :meth:`~TestCase." -"setUpClass` or :meth:`~TestCase.tearDownClass` run. Skipped modules will not " -"have :func:`setUpModule` or :func:`tearDownModule` run." +"Skipped tests will not have :meth:`~TestCase.setUp` " +"or :meth:`~TestCase.tearDown` run around them. Skipped classes will not " +"have :meth:`~TestCase.setUpClass` or :meth:`~TestCase.tearDownClass` run. " +"Skipped modules will not have :func:`setUpModule` or :func:`tearDownModule` " +"run." msgstr "" -#: ../../library/unittest.rst:647 +#: ../../library/unittest.rst:642 msgid "Distinguishing test iterations using subtests" msgstr "" -#: ../../library/unittest.rst:651 +#: ../../library/unittest.rst:646 msgid "" "When there are very small differences among your tests, for instance some " "parameters, unittest allows you to distinguish them inside the body of a " "test method using the :meth:`~TestCase.subTest` context manager." msgstr "" -#: ../../library/unittest.rst:655 +#: ../../library/unittest.rst:650 msgid "For example, the following test::" msgstr "舉例來說,以下測試: ::" -#: ../../library/unittest.rst:657 +#: ../../library/unittest.rst:652 msgid "" "class NumbersTest(unittest.TestCase):\n" "\n" @@ -1149,11 +1142,11 @@ msgid "" " self.assertEqual(i % 2, 0)" msgstr "" -#: ../../library/unittest.rst:667 +#: ../../library/unittest.rst:662 msgid "will produce the following output::" msgstr "會有以下輸出: ::" -#: ../../library/unittest.rst:669 +#: ../../library/unittest.rst:664 msgid "" "======================================================================\n" "FAIL: test_even (__main__.NumbersTest.test_even) (i=1)\n" @@ -1215,14 +1208,14 @@ msgstr "" " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" "AssertionError: 1 != 0" -#: ../../library/unittest.rst:699 +#: ../../library/unittest.rst:694 msgid "" "Without using a subtest, execution would stop after the first failure, and " "the error would be less easy to diagnose because the value of ``i`` wouldn't " "be displayed::" msgstr "" -#: ../../library/unittest.rst:703 +#: ../../library/unittest.rst:698 msgid "" "======================================================================\n" "FAIL: test_even (__main__.NumbersTest.test_even)\n" @@ -1240,19 +1233,19 @@ msgstr "" " self.assertEqual(i % 2, 0)\n" "AssertionError: 1 != 0" -#: ../../library/unittest.rst:715 +#: ../../library/unittest.rst:710 msgid "Classes and functions" msgstr "類別與函式" -#: ../../library/unittest.rst:717 +#: ../../library/unittest.rst:712 msgid "This section describes in depth the API of :mod:`unittest`." msgstr "" -#: ../../library/unittest.rst:723 +#: ../../library/unittest.rst:718 msgid "Test cases" msgstr "" -#: ../../library/unittest.rst:727 +#: ../../library/unittest.rst:722 msgid "" "Instances of the :class:`TestCase` class represent the logical test units in " "the :mod:`unittest` universe. This class is intended to be used as a base " @@ -1262,21 +1255,21 @@ msgid "" "report various kinds of failure." msgstr "" -#: ../../library/unittest.rst:734 +#: ../../library/unittest.rst:729 msgid "" "Each instance of :class:`TestCase` will run a single base method: the method " "named *methodName*. In most uses of :class:`TestCase`, you will neither " "change the *methodName* nor reimplement the default ``runTest()`` method." msgstr "" -#: ../../library/unittest.rst:739 +#: ../../library/unittest.rst:734 msgid "" ":class:`TestCase` can be instantiated successfully without providing a " "*methodName*. This makes it easier to experiment with :class:`TestCase` from " "the interactive interpreter." msgstr "" -#: ../../library/unittest.rst:744 +#: ../../library/unittest.rst:739 msgid "" ":class:`TestCase` instances provide three groups of methods: one group used " "to run the test, another used by the test implementation to check conditions " @@ -1284,39 +1277,39 @@ msgid "" "test itself to be gathered." msgstr "" -#: ../../library/unittest.rst:749 +#: ../../library/unittest.rst:744 msgid "Methods in the first group (running the test) are:" msgstr "" -#: ../../library/unittest.rst:753 +#: ../../library/unittest.rst:748 msgid "" "Method called to prepare the test fixture. This is called immediately " -"before calling the test method; other than :exc:`AssertionError` or :exc:" -"`SkipTest`, any exception raised by this method will be considered an error " -"rather than a test failure. The default implementation does nothing." +"before calling the test method; other than :exc:`AssertionError` " +"or :exc:`SkipTest`, any exception raised by this method will be considered " +"an error rather than a test failure. The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:761 +#: ../../library/unittest.rst:756 msgid "" "Method called immediately after the test method has been called and the " "result recorded. This is called even if the test method raised an " "exception, so the implementation in subclasses may need to be particularly " -"careful about checking internal state. Any exception, other than :exc:" -"`AssertionError` or :exc:`SkipTest`, raised by this method will be " +"careful about checking internal state. Any exception, other " +"than :exc:`AssertionError` or :exc:`SkipTest`, raised by this method will be " "considered an additional error rather than a test failure (thus increasing " "the total number of reported errors). This method will only be called if " "the :meth:`setUp` succeeds, regardless of the outcome of the test method. " "The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:774 +#: ../../library/unittest.rst:769 msgid "" "A class method called before tests in an individual class are run. " "``setUpClass`` is called with the class as the only argument and must be " "decorated as a :func:`classmethod`::" msgstr "" -#: ../../library/unittest.rst:778 +#: ../../library/unittest.rst:773 msgid "" "@classmethod\n" "def setUpClass(cls):\n" @@ -1326,18 +1319,18 @@ msgstr "" "def setUpClass(cls):\n" " ..." -#: ../../library/unittest.rst:782 ../../library/unittest.rst:797 +#: ../../library/unittest.rst:777 ../../library/unittest.rst:792 msgid "See `Class and Module Fixtures`_ for more details." msgstr "更多細節請見 `Class and Module Fixtures`_。" -#: ../../library/unittest.rst:789 +#: ../../library/unittest.rst:784 msgid "" "A class method called after tests in an individual class have run. " "``tearDownClass`` is called with the class as the only argument and must be " "decorated as a :meth:`classmethod`::" msgstr "" -#: ../../library/unittest.rst:793 +#: ../../library/unittest.rst:788 msgid "" "@classmethod\n" "def tearDownClass(cls):\n" @@ -1347,7 +1340,7 @@ msgstr "" "def tearDownClass(cls):\n" " ..." -#: ../../library/unittest.rst:804 +#: ../../library/unittest.rst:799 msgid "" "Run the test, collecting the result into the :class:`TestResult` object " "passed as *result*. If *result* is omitted or ``None``, a temporary result " @@ -1355,199 +1348,226 @@ msgid "" "used. The result object is returned to :meth:`run`'s caller." msgstr "" -#: ../../library/unittest.rst:810 +#: ../../library/unittest.rst:805 msgid "" "The same effect may be had by simply calling the :class:`TestCase` instance." msgstr "" -#: ../../library/unittest.rst:813 +#: ../../library/unittest.rst:808 msgid "" "Previous versions of ``run`` did not return the result. Neither did calling " "an instance." msgstr "" -#: ../../library/unittest.rst:819 +#: ../../library/unittest.rst:814 msgid "" "Calling this during a test method or :meth:`setUp` skips the current test. " "See :ref:`unittest-skipping` for more information." msgstr "" -#: ../../library/unittest.rst:827 +#: ../../library/unittest.rst:822 msgid "" "Return a context manager which executes the enclosed code block as a " "subtest. *msg* and *params* are optional, arbitrary values which are " "displayed whenever a subtest fails, allowing you to identify them clearly." msgstr "" -#: ../../library/unittest.rst:832 +#: ../../library/unittest.rst:827 msgid "" "A test case can contain any number of subtest declarations, and they can be " "arbitrarily nested." msgstr "" -#: ../../library/unittest.rst:835 +#: ../../library/unittest.rst:830 msgid "See :ref:`subtests` for more information." msgstr "更多資訊請見 :ref:`subtests`。" -#: ../../library/unittest.rst:842 +#: ../../library/unittest.rst:837 msgid "" "Run the test without collecting the result. This allows exceptions raised " "by the test to be propagated to the caller, and can be used to support " "running tests under a debugger." msgstr "" -#: ../../library/unittest.rst:848 +#: ../../library/unittest.rst:843 msgid "" "The :class:`TestCase` class provides several assert methods to check for and " "report failures. The following table lists the most commonly used methods " "(see the tables below for more assert methods):" msgstr "" -#: ../../library/unittest.rst:853 ../../library/unittest.rst:974 -#: ../../library/unittest.rst:1188 ../../library/unittest.rst:1312 +#: ../../library/unittest.rst:848 ../../library/unittest.rst:984 +#: ../../library/unittest.rst:1198 ../../library/unittest.rst:1368 msgid "Method" msgstr "方法" -#: ../../library/unittest.rst:853 ../../library/unittest.rst:974 -#: ../../library/unittest.rst:1188 +#: ../../library/unittest.rst:848 ../../library/unittest.rst:984 +#: ../../library/unittest.rst:1198 msgid "Checks that" msgstr "" -#: ../../library/unittest.rst:853 ../../library/unittest.rst:974 -#: ../../library/unittest.rst:1188 ../../library/unittest.rst:1312 +#: ../../library/unittest.rst:848 ../../library/unittest.rst:984 +#: ../../library/unittest.rst:1198 ../../library/unittest.rst:1368 msgid "New in" msgstr "" -#: ../../library/unittest.rst:855 +#: ../../library/unittest.rst:850 msgid ":meth:`assertEqual(a, b) `" msgstr ":meth:`assertEqual(a, b) `" -#: ../../library/unittest.rst:855 +#: ../../library/unittest.rst:850 msgid "``a == b``" msgstr "``a == b``" -#: ../../library/unittest.rst:858 +#: ../../library/unittest.rst:853 msgid ":meth:`assertNotEqual(a, b) `" msgstr ":meth:`assertNotEqual(a, b) `" -#: ../../library/unittest.rst:858 +#: ../../library/unittest.rst:853 msgid "``a != b``" msgstr "``a != b``" -#: ../../library/unittest.rst:861 +#: ../../library/unittest.rst:856 msgid ":meth:`assertTrue(x) `" msgstr ":meth:`assertTrue(x) `" -#: ../../library/unittest.rst:861 +#: ../../library/unittest.rst:856 msgid "``bool(x) is True``" msgstr "``bool(x) is True``" -#: ../../library/unittest.rst:864 +#: ../../library/unittest.rst:859 msgid ":meth:`assertFalse(x) `" msgstr ":meth:`assertFalse(x) `" -#: ../../library/unittest.rst:864 +#: ../../library/unittest.rst:859 msgid "``bool(x) is False``" msgstr "``bool(x) is False``" -#: ../../library/unittest.rst:867 +#: ../../library/unittest.rst:862 msgid ":meth:`assertIs(a, b) `" msgstr ":meth:`assertIs(a, b) `" -#: ../../library/unittest.rst:867 +#: ../../library/unittest.rst:862 msgid "``a is b``" msgstr "``a is b``" -#: ../../library/unittest.rst:867 ../../library/unittest.rst:870 -#: ../../library/unittest.rst:873 ../../library/unittest.rst:876 -#: ../../library/unittest.rst:879 ../../library/unittest.rst:882 -#: ../../library/unittest.rst:979 ../../library/unittest.rst:1196 -#: ../../library/unittest.rst:1199 ../../library/unittest.rst:1202 -#: ../../library/unittest.rst:1205 ../../library/unittest.rst:1208 -#: ../../library/unittest.rst:1314 ../../library/unittest.rst:1317 -#: ../../library/unittest.rst:1320 ../../library/unittest.rst:1323 -#: ../../library/unittest.rst:1326 ../../library/unittest.rst:1329 +#: ../../library/unittest.rst:862 ../../library/unittest.rst:865 +#: ../../library/unittest.rst:868 ../../library/unittest.rst:871 +#: ../../library/unittest.rst:874 ../../library/unittest.rst:877 +#: ../../library/unittest.rst:989 ../../library/unittest.rst:1206 +#: ../../library/unittest.rst:1209 ../../library/unittest.rst:1212 +#: ../../library/unittest.rst:1215 ../../library/unittest.rst:1218 +#: ../../library/unittest.rst:1370 ../../library/unittest.rst:1373 +#: ../../library/unittest.rst:1376 ../../library/unittest.rst:1379 +#: ../../library/unittest.rst:1382 ../../library/unittest.rst:1385 msgid "3.1" msgstr "3.1" -#: ../../library/unittest.rst:870 +#: ../../library/unittest.rst:865 msgid ":meth:`assertIsNot(a, b) `" msgstr ":meth:`assertIsNot(a, b) `" -#: ../../library/unittest.rst:870 +#: ../../library/unittest.rst:865 msgid "``a is not b``" msgstr "``a is not b``" -#: ../../library/unittest.rst:873 +#: ../../library/unittest.rst:868 msgid ":meth:`assertIsNone(x) `" msgstr ":meth:`assertIsNone(x) `" -#: ../../library/unittest.rst:873 +#: ../../library/unittest.rst:868 msgid "``x is None``" msgstr "``x is None``" -#: ../../library/unittest.rst:876 +#: ../../library/unittest.rst:871 msgid ":meth:`assertIsNotNone(x) `" msgstr ":meth:`assertIsNotNone(x) `" -#: ../../library/unittest.rst:876 +#: ../../library/unittest.rst:871 msgid "``x is not None``" msgstr "``x is not None``" -#: ../../library/unittest.rst:879 +#: ../../library/unittest.rst:874 msgid ":meth:`assertIn(a, b) `" msgstr ":meth:`assertIn(a, b) `" -#: ../../library/unittest.rst:879 +#: ../../library/unittest.rst:874 msgid "``a in b``" msgstr "``a in b``" -#: ../../library/unittest.rst:882 +#: ../../library/unittest.rst:877 msgid ":meth:`assertNotIn(a, b) `" msgstr ":meth:`assertNotIn(a, b) `" -#: ../../library/unittest.rst:882 +#: ../../library/unittest.rst:877 msgid "``a not in b``" msgstr "``a not in b``" -#: ../../library/unittest.rst:885 +#: ../../library/unittest.rst:880 msgid ":meth:`assertIsInstance(a, b) `" msgstr ":meth:`assertIsInstance(a, b) `" -#: ../../library/unittest.rst:885 +#: ../../library/unittest.rst:880 msgid "``isinstance(a, b)``" msgstr "``isinstance(a, b)``" -#: ../../library/unittest.rst:885 ../../library/unittest.rst:888 -#: ../../library/unittest.rst:982 ../../library/unittest.rst:985 -#: ../../library/unittest.rst:1211 ../../library/unittest.rst:1214 +#: ../../library/unittest.rst:880 ../../library/unittest.rst:883 +#: ../../library/unittest.rst:992 ../../library/unittest.rst:995 +#: ../../library/unittest.rst:1221 ../../library/unittest.rst:1224 msgid "3.2" msgstr "3.2" -#: ../../library/unittest.rst:888 +#: ../../library/unittest.rst:883 msgid ":meth:`assertNotIsInstance(a, b) `" msgstr ":meth:`assertNotIsInstance(a, b) `" -#: ../../library/unittest.rst:888 +#: ../../library/unittest.rst:883 msgid "``not isinstance(a, b)``" msgstr "``not isinstance(a, b)``" -#: ../../library/unittest.rst:892 +#: ../../library/unittest.rst:886 +#, fuzzy +msgid ":meth:`assertIsSubclass(a, b) `" +msgstr ":meth:`assertIs(a, b) `" + +#: ../../library/unittest.rst:886 +#, fuzzy +msgid "``issubclass(a, b)``" +msgstr "``isinstance(a, b)``" + +#: ../../library/unittest.rst:886 ../../library/unittest.rst:889 +#: ../../library/unittest.rst:1228 ../../library/unittest.rst:1231 +#: ../../library/unittest.rst:1234 ../../library/unittest.rst:1237 +#: ../../library/unittest.rst:1240 ../../library/unittest.rst:1243 +msgid "3.14" +msgstr "" + +#: ../../library/unittest.rst:889 +#, fuzzy +msgid ":meth:`assertNotIsSubclass(a, b) `" +msgstr ":meth:`assertNotIn(a, b) `" + +#: ../../library/unittest.rst:889 +#, fuzzy +msgid "``not issubclass(a, b)``" +msgstr "``not isinstance(a, b)``" + +#: ../../library/unittest.rst:893 msgid "" "All the assert methods accept a *msg* argument that, if specified, is used " "as the error message on failure (see also :data:`longMessage`). Note that " -"the *msg* keyword argument can be passed to :meth:`assertRaises`, :meth:" -"`assertRaisesRegex`, :meth:`assertWarns`, :meth:`assertWarnsRegex` only when " -"they are used as a context manager." +"the *msg* keyword argument can be passed " +"to :meth:`assertRaises`, :meth:`assertRaisesRegex`, :meth:`assertWarns`, :meth:`assertWarnsRegex` " +"only when they are used as a context manager." msgstr "" -#: ../../library/unittest.rst:900 +#: ../../library/unittest.rst:901 msgid "" "Test that *first* and *second* are equal. If the values do not compare " "equal, the test will fail." msgstr "" -#: ../../library/unittest.rst:903 +#: ../../library/unittest.rst:904 msgid "" "In addition, if *first* and *second* are the exact same type and one of " "list, tuple, dict, set, frozenset or str or any type that a subclass " @@ -1557,27 +1577,27 @@ msgid "" "methods>`)." msgstr "" -#: ../../library/unittest.rst:910 +#: ../../library/unittest.rst:911 msgid "Added the automatic calling of type-specific equality function." msgstr "" -#: ../../library/unittest.rst:913 +#: ../../library/unittest.rst:914 msgid "" ":meth:`assertMultiLineEqual` added as the default type equality function for " "comparing strings." msgstr "" -#: ../../library/unittest.rst:920 +#: ../../library/unittest.rst:921 msgid "" "Test that *first* and *second* are not equal. If the values do compare " "equal, the test will fail." msgstr "" -#: ../../library/unittest.rst:926 +#: ../../library/unittest.rst:927 msgid "Test that *expr* is true (or false)." msgstr "" -#: ../../library/unittest.rst:928 +#: ../../library/unittest.rst:929 msgid "" "Note that this is equivalent to ``bool(expr) is True`` and not to ``expr is " "True`` (use ``assertIs(expr, True)`` for the latter). This method should " @@ -1586,115 +1606,122 @@ msgid "" "provide a better error message in case of failure." msgstr "" -#: ../../library/unittest.rst:938 +#: ../../library/unittest.rst:939 msgid "Test that *first* and *second* are (or are not) the same object." msgstr "" -#: ../../library/unittest.rst:946 +#: ../../library/unittest.rst:947 msgid "Test that *expr* is (or is not) ``None``." msgstr "" -#: ../../library/unittest.rst:954 +#: ../../library/unittest.rst:955 msgid "Test that *member* is (or is not) in *container*." msgstr "" -#: ../../library/unittest.rst:962 +#: ../../library/unittest.rst:963 msgid "" "Test that *obj* is (or is not) an instance of *cls* (which can be a class or " "a tuple of classes, as supported by :func:`isinstance`). To check for the " "exact type, use :func:`assertIs(type(obj), cls) `." msgstr "" -#: ../../library/unittest.rst:970 +#: ../../library/unittest.rst:973 +msgid "" +"Test that *cls* is (or is not) a subclass of *superclass* (which can be a " +"class or a tuple of classes, as supported by :func:`issubclass`). To check " +"for the exact type, use :func:`assertIs(cls, superclass) `." +msgstr "" + +#: ../../library/unittest.rst:980 msgid "" "It is also possible to check the production of exceptions, warnings, and log " "messages using the following methods:" msgstr "" -#: ../../library/unittest.rst:976 +#: ../../library/unittest.rst:986 msgid ":meth:`assertRaises(exc, fun, *args, **kwds) `" msgstr ":meth:`assertRaises(exc, fun, *args, **kwds) `" -#: ../../library/unittest.rst:976 +#: ../../library/unittest.rst:986 msgid "``fun(*args, **kwds)`` raises *exc*" msgstr "``fun(*args, **kwds)`` 會引發 *exc*" -#: ../../library/unittest.rst:979 +#: ../../library/unittest.rst:989 msgid "" -":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) `" +":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) " +"`" msgstr "" -":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) `" +":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) " +"`" -#: ../../library/unittest.rst:979 +#: ../../library/unittest.rst:989 msgid "``fun(*args, **kwds)`` raises *exc* and the message matches regex *r*" msgstr "" -#: ../../library/unittest.rst:982 +#: ../../library/unittest.rst:992 msgid ":meth:`assertWarns(warn, fun, *args, **kwds) `" msgstr ":meth:`assertWarns(warn, fun, *args, **kwds) `" -#: ../../library/unittest.rst:982 +#: ../../library/unittest.rst:992 msgid "``fun(*args, **kwds)`` raises *warn*" msgstr "``fun(*args, **kwds)`` 會引發 *warn*" -#: ../../library/unittest.rst:985 +#: ../../library/unittest.rst:995 msgid "" -":meth:`assertWarnsRegex(warn, r, fun, *args, **kwds) `" +":meth:`assertWarnsRegex(warn, r, fun, *args, **kwds) " +"`" msgstr "" -#: ../../library/unittest.rst:985 +#: ../../library/unittest.rst:995 msgid "``fun(*args, **kwds)`` raises *warn* and the message matches regex *r*" msgstr "" -#: ../../library/unittest.rst:988 +#: ../../library/unittest.rst:998 msgid ":meth:`assertLogs(logger, level) `" msgstr ":meth:`assertLogs(logger, level) `" -#: ../../library/unittest.rst:988 +#: ../../library/unittest.rst:998 msgid "The ``with`` block logs on *logger* with minimum *level*" msgstr "" -#: ../../library/unittest.rst:988 +#: ../../library/unittest.rst:998 msgid "3.4" msgstr "3.4" -#: ../../library/unittest.rst:991 +#: ../../library/unittest.rst:1001 msgid ":meth:`assertNoLogs(logger, level) `" msgstr ":meth:`assertNoLogs(logger, level) `" -#: ../../library/unittest.rst:991 +#: ../../library/unittest.rst:1001 msgid "The ``with`` block does not log on" msgstr "" -#: ../../library/unittest.rst:992 +#: ../../library/unittest.rst:1002 msgid "*logger* with minimum *level*" msgstr "" -#: ../../library/unittest.rst:991 +#: ../../library/unittest.rst:1001 msgid "3.10" msgstr "3.10" -#: ../../library/unittest.rst:998 +#: ../../library/unittest.rst:1008 msgid "" "Test that an exception is raised when *callable* is called with any " -"positional or keyword arguments that are also passed to :meth:" -"`assertRaises`. The test passes if *exception* is raised, is an error if " -"another exception is raised, or fails if no exception is raised. To catch " -"any of a group of exceptions, a tuple containing the exception classes may " -"be passed as *exception*." +"positional or keyword arguments that are also passed " +"to :meth:`assertRaises`. The test passes if *exception* is raised, is an " +"error if another exception is raised, or fails if no exception is raised. To " +"catch any of a group of exceptions, a tuple containing the exception classes " +"may be passed as *exception*." msgstr "" -#: ../../library/unittest.rst:1005 +#: ../../library/unittest.rst:1015 msgid "" "If only the *exception* and possibly the *msg* arguments are given, return a " "context manager so that the code under test can be written inline rather " "than as a function::" msgstr "" -#: ../../library/unittest.rst:1009 +#: ../../library/unittest.rst:1019 msgid "" "with self.assertRaises(SomeException):\n" " do_something()" @@ -1702,20 +1729,20 @@ msgstr "" "with self.assertRaises(SomeException):\n" " do_something()" -#: ../../library/unittest.rst:1012 +#: ../../library/unittest.rst:1022 msgid "" "When used as a context manager, :meth:`assertRaises` accepts the additional " "keyword argument *msg*." msgstr "" -#: ../../library/unittest.rst:1015 +#: ../../library/unittest.rst:1025 msgid "" -"The context manager will store the caught exception object in its :attr:" -"`exception` attribute. This can be useful if the intention is to perform " -"additional checks on the exception raised::" +"The context manager will store the caught exception object in " +"its :attr:`exception` attribute. This can be useful if the intention is to " +"perform additional checks on the exception raised::" msgstr "" -#: ../../library/unittest.rst:1019 +#: ../../library/unittest.rst:1029 msgid "" "with self.assertRaises(SomeException) as cm:\n" " do_something()\n" @@ -1729,28 +1756,28 @@ msgstr "" "the_exception = cm.exception\n" "self.assertEqual(the_exception.error_code, 3)" -#: ../../library/unittest.rst:1025 +#: ../../library/unittest.rst:1035 msgid "Added the ability to use :meth:`assertRaises` as a context manager." msgstr "新增 :meth:`assertRaises` 可作為情境管理器使用的能力。" -#: ../../library/unittest.rst:1028 +#: ../../library/unittest.rst:1038 msgid "Added the :attr:`exception` attribute." msgstr "新增 :attr:`exception` 屬性。" -#: ../../library/unittest.rst:1031 ../../library/unittest.rst:1057 -#: ../../library/unittest.rst:1098 ../../library/unittest.rst:1121 +#: ../../library/unittest.rst:1041 ../../library/unittest.rst:1067 +#: ../../library/unittest.rst:1108 ../../library/unittest.rst:1131 msgid "Added the *msg* keyword argument when used as a context manager." msgstr "新增作為情境管理器使用時的 *msg* 引數。" -#: ../../library/unittest.rst:1038 +#: ../../library/unittest.rst:1048 msgid "" "Like :meth:`assertRaises` but also tests that *regex* matches on the string " "representation of the raised exception. *regex* may be a regular expression " -"object or a string containing a regular expression suitable for use by :func:" -"`re.search`. Examples::" +"object or a string containing a regular expression suitable for use " +"by :func:`re.search`. Examples::" msgstr "" -#: ../../library/unittest.rst:1043 +#: ../../library/unittest.rst:1053 msgid "" "self.assertRaisesRegex(ValueError, \"invalid literal for.*XYZ'$\",\n" " int, 'XYZ')" @@ -1758,11 +1785,11 @@ msgstr "" "self.assertRaisesRegex(ValueError, \"invalid literal for.*XYZ'$\",\n" " int, 'XYZ')" -#: ../../library/unittest.rst:1046 ../../library/unittest.rst:1114 +#: ../../library/unittest.rst:1056 ../../library/unittest.rst:1124 msgid "or::" msgstr "或是: ::" -#: ../../library/unittest.rst:1048 +#: ../../library/unittest.rst:1058 msgid "" "with self.assertRaisesRegex(ValueError, 'literal'):\n" " int('XYZ')" @@ -1770,31 +1797,31 @@ msgstr "" "with self.assertRaisesRegex(ValueError, 'literal'):\n" " int('XYZ')" -#: ../../library/unittest.rst:1051 +#: ../../library/unittest.rst:1061 msgid "Added under the name ``assertRaisesRegexp``." msgstr "以 ``assertRaisesRegexp`` 為名新增。" -#: ../../library/unittest.rst:1054 +#: ../../library/unittest.rst:1064 msgid "Renamed to :meth:`assertRaisesRegex`." msgstr "重新命名為 :meth:`assertRaisesRegex`。" -#: ../../library/unittest.rst:1064 +#: ../../library/unittest.rst:1074 msgid "" "Test that a warning is triggered when *callable* is called with any " -"positional or keyword arguments that are also passed to :meth:" -"`assertWarns`. The test passes if *warning* is triggered and fails if it " -"isn't. Any exception is an error. To catch any of a group of warnings, a " -"tuple containing the warning classes may be passed as *warnings*." +"positional or keyword arguments that are also passed " +"to :meth:`assertWarns`. The test passes if *warning* is triggered and fails " +"if it isn't. Any exception is an error. To catch any of a group of " +"warnings, a tuple containing the warning classes may be passed as *warnings*." msgstr "" -#: ../../library/unittest.rst:1071 +#: ../../library/unittest.rst:1081 msgid "" "If only the *warning* and possibly the *msg* arguments are given, return a " "context manager so that the code under test can be written inline rather " "than as a function::" msgstr "" -#: ../../library/unittest.rst:1075 +#: ../../library/unittest.rst:1085 msgid "" "with self.assertWarns(SomeWarning):\n" " do_something()" @@ -1802,21 +1829,22 @@ msgstr "" "with self.assertWarns(SomeWarning):\n" " do_something()" -#: ../../library/unittest.rst:1078 +#: ../../library/unittest.rst:1088 msgid "" "When used as a context manager, :meth:`assertWarns` accepts the additional " "keyword argument *msg*." msgstr "" -#: ../../library/unittest.rst:1081 +#: ../../library/unittest.rst:1091 msgid "" -"The context manager will store the caught warning object in its :attr:" -"`warning` attribute, and the source line which triggered the warnings in " -"the :attr:`filename` and :attr:`lineno` attributes. This can be useful if " -"the intention is to perform additional checks on the warning caught::" +"The context manager will store the caught warning object in " +"its :attr:`warning` attribute, and the source line which triggered the " +"warnings in the :attr:`filename` and :attr:`lineno` attributes. This can be " +"useful if the intention is to perform additional checks on the warning " +"caught::" msgstr "" -#: ../../library/unittest.rst:1087 +#: ../../library/unittest.rst:1097 msgid "" "with self.assertWarns(SomeWarning) as cm:\n" " do_something()\n" @@ -1830,21 +1858,21 @@ msgstr "" "self.assertIn('myfile.py', cm.filename)\n" "self.assertEqual(320, cm.lineno)" -#: ../../library/unittest.rst:1093 +#: ../../library/unittest.rst:1103 msgid "" "This method works regardless of the warning filters in place when it is " "called." msgstr "" -#: ../../library/unittest.rst:1105 +#: ../../library/unittest.rst:1115 msgid "" "Like :meth:`assertWarns` but also tests that *regex* matches on the message " "of the triggered warning. *regex* may be a regular expression object or a " -"string containing a regular expression suitable for use by :func:`re." -"search`. Example::" +"string containing a regular expression suitable for use " +"by :func:`re.search`. Example::" msgstr "" -#: ../../library/unittest.rst:1110 +#: ../../library/unittest.rst:1120 msgid "" "self.assertWarnsRegex(DeprecationWarning,\n" " r'legacy_function\\(\\) is deprecated',\n" @@ -1854,7 +1882,7 @@ msgstr "" " r'legacy_function\\(\\) is deprecated',\n" " legacy_function, 'XYZ')" -#: ../../library/unittest.rst:1116 +#: ../../library/unittest.rst:1126 msgid "" "with self.assertWarnsRegex(RuntimeWarning, 'unsafe frobnicating'):\n" " frobnicate('/etc/passwd')" @@ -1862,55 +1890,55 @@ msgstr "" "with self.assertWarnsRegex(RuntimeWarning, 'unsafe frobnicating'):\n" " frobnicate('/etc/passwd')" -#: ../../library/unittest.rst:1126 +#: ../../library/unittest.rst:1136 msgid "" "A context manager to test that at least one message is logged on the " "*logger* or one of its children, with at least the given *level*." msgstr "" -#: ../../library/unittest.rst:1130 +#: ../../library/unittest.rst:1140 msgid "" -"If given, *logger* should be a :class:`logging.Logger` object or a :class:" -"`str` giving the name of a logger. The default is the root logger, which " -"will catch all messages that were not blocked by a non-propagating " +"If given, *logger* should be a :class:`logging.Logger` object or " +"a :class:`str` giving the name of a logger. The default is the root logger, " +"which will catch all messages that were not blocked by a non-propagating " "descendent logger." msgstr "" -#: ../../library/unittest.rst:1135 ../../library/unittest.rst:1176 +#: ../../library/unittest.rst:1145 ../../library/unittest.rst:1186 msgid "" "If given, *level* should be either a numeric logging level or its string " "equivalent (for example either ``\"ERROR\"`` or :const:`logging.ERROR`). " "The default is :const:`logging.INFO`." msgstr "" -#: ../../library/unittest.rst:1139 +#: ../../library/unittest.rst:1149 msgid "" "The test passes if at least one message emitted inside the ``with`` block " "matches the *logger* and *level* conditions, otherwise it fails." msgstr "" -#: ../../library/unittest.rst:1142 +#: ../../library/unittest.rst:1152 msgid "" "The object returned by the context manager is a recording helper which keeps " "tracks of the matching log messages. It has two attributes:" msgstr "" -#: ../../library/unittest.rst:1148 +#: ../../library/unittest.rst:1158 msgid "" "A list of :class:`logging.LogRecord` objects of the matching log messages." msgstr "" -#: ../../library/unittest.rst:1153 +#: ../../library/unittest.rst:1163 msgid "" "A list of :class:`str` objects with the formatted output of matching " "messages." msgstr "" -#: ../../library/unittest.rst:1156 +#: ../../library/unittest.rst:1166 msgid "Example::" msgstr "範例: ::" -#: ../../library/unittest.rst:1158 +#: ../../library/unittest.rst:1168 msgid "" "with self.assertLogs('foo', level='INFO') as cm:\n" " logging.getLogger('foo').info('first message')\n" @@ -1924,136 +1952,194 @@ msgstr "" "self.assertEqual(cm.output, ['INFO:foo:first message',\n" " 'ERROR:foo.bar:second message'])" -#: ../../library/unittest.rst:1168 +#: ../../library/unittest.rst:1178 msgid "" "A context manager to test that no messages are logged on the *logger* or one " "of its children, with at least the given *level*." msgstr "" -#: ../../library/unittest.rst:1172 +#: ../../library/unittest.rst:1182 msgid "" -"If given, *logger* should be a :class:`logging.Logger` object or a :class:" -"`str` giving the name of a logger. The default is the root logger, which " -"will catch all messages." +"If given, *logger* should be a :class:`logging.Logger` object or " +"a :class:`str` giving the name of a logger. The default is the root logger, " +"which will catch all messages." msgstr "" -#: ../../library/unittest.rst:1180 +#: ../../library/unittest.rst:1190 msgid "" "Unlike :meth:`assertLogs`, nothing will be returned by the context manager." msgstr "" -#: ../../library/unittest.rst:1185 +#: ../../library/unittest.rst:1195 msgid "" "There are also other methods used to perform more specific checks, such as:" msgstr "" -#: ../../library/unittest.rst:1190 +#: ../../library/unittest.rst:1200 msgid ":meth:`assertAlmostEqual(a, b) `" msgstr ":meth:`assertAlmostEqual(a, b) `" -#: ../../library/unittest.rst:1190 +#: ../../library/unittest.rst:1200 msgid "``round(a-b, 7) == 0``" msgstr "``round(a-b, 7) == 0``" -#: ../../library/unittest.rst:1193 +#: ../../library/unittest.rst:1203 msgid ":meth:`assertNotAlmostEqual(a, b) `" msgstr ":meth:`assertNotAlmostEqual(a, b) `" -#: ../../library/unittest.rst:1193 +#: ../../library/unittest.rst:1203 msgid "``round(a-b, 7) != 0``" msgstr "``round(a-b, 7) != 0``" -#: ../../library/unittest.rst:1196 +#: ../../library/unittest.rst:1206 msgid ":meth:`assertGreater(a, b) `" msgstr ":meth:`assertGreater(a, b) `" -#: ../../library/unittest.rst:1196 +#: ../../library/unittest.rst:1206 msgid "``a > b``" msgstr "``a > b``" -#: ../../library/unittest.rst:1199 +#: ../../library/unittest.rst:1209 msgid ":meth:`assertGreaterEqual(a, b) `" msgstr ":meth:`assertGreaterEqual(a, b) `" -#: ../../library/unittest.rst:1199 +#: ../../library/unittest.rst:1209 msgid "``a >= b``" msgstr "``a >= b``" -#: ../../library/unittest.rst:1202 +#: ../../library/unittest.rst:1212 msgid ":meth:`assertLess(a, b) `" msgstr ":meth:`assertLess(a, b) `" -#: ../../library/unittest.rst:1202 +#: ../../library/unittest.rst:1212 msgid "``a < b``" msgstr "``a < b``" -#: ../../library/unittest.rst:1205 +#: ../../library/unittest.rst:1215 msgid ":meth:`assertLessEqual(a, b) `" msgstr ":meth:`assertLessEqual(a, b) `" -#: ../../library/unittest.rst:1205 +#: ../../library/unittest.rst:1215 msgid "``a <= b``" msgstr "``a <= b``" -#: ../../library/unittest.rst:1208 +#: ../../library/unittest.rst:1218 msgid ":meth:`assertRegex(s, r) `" msgstr ":meth:`assertRegex(s, r) `" -#: ../../library/unittest.rst:1208 +#: ../../library/unittest.rst:1218 msgid "``r.search(s)``" msgstr "``r.search(s)``" -#: ../../library/unittest.rst:1211 +#: ../../library/unittest.rst:1221 msgid ":meth:`assertNotRegex(s, r) `" msgstr ":meth:`assertNotRegex(s, r) `" -#: ../../library/unittest.rst:1211 +#: ../../library/unittest.rst:1221 msgid "``not r.search(s)``" msgstr "``not r.search(s)``" -#: ../../library/unittest.rst:1214 +#: ../../library/unittest.rst:1224 msgid ":meth:`assertCountEqual(a, b) `" msgstr ":meth:`assertCountEqual(a, b) `" -#: ../../library/unittest.rst:1214 +#: ../../library/unittest.rst:1224 msgid "" "*a* and *b* have the same elements in the same number, regardless of their " "order." msgstr "" -#: ../../library/unittest.rst:1223 +#: ../../library/unittest.rst:1228 +#, fuzzy +msgid ":meth:`assertStartsWith(a, b) `" +msgstr ":meth:`assertIs(a, b) `" + +#: ../../library/unittest.rst:1228 +msgid "``a.startswith(b)``" +msgstr "" + +#: ../../library/unittest.rst:1231 +#, fuzzy +msgid ":meth:`assertNotStartsWith(a, b) `" +msgstr ":meth:`assertNotIn(a, b) `" + +#: ../../library/unittest.rst:1231 +#, fuzzy +msgid "``not a.startswith(b)``" +msgstr "``not r.search(s)``" + +#: ../../library/unittest.rst:1234 +#, fuzzy +msgid ":meth:`assertEndsWith(a, b) `" +msgstr ":meth:`assertIs(a, b) `" + +#: ../../library/unittest.rst:1234 +msgid "``a.endswith(b)``" +msgstr "" + +#: ../../library/unittest.rst:1237 +#, fuzzy +msgid ":meth:`assertNotEndsWith(a, b) `" +msgstr ":meth:`assertNotIn(a, b) `" + +#: ../../library/unittest.rst:1237 +#, fuzzy +msgid "``not a.endswith(b)``" +msgstr "``not r.search(s)``" + +#: ../../library/unittest.rst:1240 +#, fuzzy +msgid ":meth:`assertHasAttr(a, b) `" +msgstr ":meth:`assertIs(a, b) `" + +#: ../../library/unittest.rst:1240 +#, fuzzy +msgid "``hastattr(a, b)``" +msgstr "``isinstance(a, b)``" + +#: ../../library/unittest.rst:1243 +#, fuzzy +msgid ":meth:`assertNotHasAttr(a, b) `" +msgstr ":meth:`assertNotIn(a, b) `" + +#: ../../library/unittest.rst:1243 +#, fuzzy +msgid "``not hastattr(a, b)``" +msgstr "``not isinstance(a, b)``" + +#: ../../library/unittest.rst:1251 msgid "" "Test that *first* and *second* are approximately (or not approximately) " "equal by computing the difference, rounding to the given number of decimal " "*places* (default 7), and comparing to zero. Note that these methods round " -"the values to the given number of *decimal places* (i.e. like the :func:" -"`round` function) and not *significant digits*." +"the values to the given number of *decimal places* (i.e. like " +"the :func:`round` function) and not *significant digits*." msgstr "" -#: ../../library/unittest.rst:1229 +#: ../../library/unittest.rst:1257 msgid "" "If *delta* is supplied instead of *places* then the difference between " "*first* and *second* must be less or equal to (or greater than) *delta*." msgstr "" -#: ../../library/unittest.rst:1232 +#: ../../library/unittest.rst:1260 msgid "Supplying both *delta* and *places* raises a :exc:`TypeError`." msgstr "" -#: ../../library/unittest.rst:1234 +#: ../../library/unittest.rst:1262 msgid "" ":meth:`assertAlmostEqual` automatically considers almost equal objects that " "compare equal. :meth:`assertNotAlmostEqual` automatically fails if the " "objects compare equal. Added the *delta* keyword argument." msgstr "" -#: ../../library/unittest.rst:1245 +#: ../../library/unittest.rst:1273 msgid "" "Test that *first* is respectively >, >=, < or <= than *second* depending on " "the method name. If not, the test will fail::" msgstr "" -#: ../../library/unittest.rst:1248 +#: ../../library/unittest.rst:1276 msgid "" ">>> self.assertGreaterEqual(3, 4)\n" "AssertionError: \"3\" unexpectedly not greater than or equal to \"4\"" @@ -2061,7 +2147,7 @@ msgstr "" ">>> self.assertGreaterEqual(3, 4)\n" "AssertionError: \"3\" unexpectedly not greater than or equal to \"4\"" -#: ../../library/unittest.rst:1257 +#: ../../library/unittest.rst:1285 msgid "" "Test that a *regex* search matches (or does not match) *text*. In case of " "failure, the error message will include the pattern and the *text* (or the " @@ -2070,28 +2156,28 @@ msgid "" "suitable for use by :func:`re.search`." msgstr "" -#: ../../library/unittest.rst:1263 +#: ../../library/unittest.rst:1291 msgid "Added under the name ``assertRegexpMatches``." msgstr "以 ``assertRegexpMatches`` 為名新增。" -#: ../../library/unittest.rst:1265 +#: ../../library/unittest.rst:1293 msgid "" -"The method ``assertRegexpMatches()`` has been renamed to :meth:`." -"assertRegex`." +"The method ``assertRegexpMatches()`` has been renamed " +"to :meth:`.assertRegex`." msgstr "``assertRegexpMatches()`` 方法已重新命名為 :meth:`.assertRegex`。" -#: ../../library/unittest.rst:1268 +#: ../../library/unittest.rst:1296 msgid ":meth:`.assertNotRegex`." msgstr ":meth:`.assertNotRegex`。" -#: ../../library/unittest.rst:1274 +#: ../../library/unittest.rst:1302 msgid "" "Test that sequence *first* contains the same elements as *second*, " "regardless of their order. When they don't, an error message listing the " "differences between the sequences will be generated." msgstr "" -#: ../../library/unittest.rst:1278 +#: ../../library/unittest.rst:1306 msgid "" "Duplicate elements are *not* ignored when comparing *first* and *second*. It " "verifies whether each element has the same count in both sequences. " @@ -2099,7 +2185,23 @@ msgid "" "but works with sequences of unhashable objects as well." msgstr "" -#: ../../library/unittest.rst:1289 +#: ../../library/unittest.rst:1318 +msgid "" +"Test that the Unicode or byte string *s* starts (or does not start) with a " +"*prefix*. *prefix* can also be a tuple of strings to try." +msgstr "" + +#: ../../library/unittest.rst:1328 +msgid "" +"Test that the Unicode or byte string *s* ends (or does not end) with a " +"*suffix*. *suffix* can also be a tuple of strings to try." +msgstr "" + +#: ../../library/unittest.rst:1338 +msgid "Test that the object *obj* has (or has not) an attribute *name*." +msgstr "" + +#: ../../library/unittest.rst:1345 msgid "" "The :meth:`assertEqual` method dispatches the equality check for objects of " "the same type to different type-specific methods. These methods are already " @@ -2107,77 +2209,77 @@ msgid "" "register new methods using :meth:`addTypeEqualityFunc`:" msgstr "" -#: ../../library/unittest.rst:1296 +#: ../../library/unittest.rst:1352 msgid "" "Registers a type-specific method called by :meth:`assertEqual` to check if " "two objects of exactly the same *typeobj* (not subclasses) compare equal. " "*function* must take two positional arguments and a third msg=None keyword " -"argument just as :meth:`assertEqual` does. It must raise :data:`self." -"failureException(msg) ` when inequality between the first " -"two parameters is detected -- possibly providing useful information and " -"explaining the inequalities in details in the error message." +"argument just as :meth:`assertEqual` does. It must " +"raise :data:`self.failureException(msg) ` when inequality " +"between the first two parameters is detected -- possibly providing useful " +"information and explaining the inequalities in details in the error message." msgstr "" -#: ../../library/unittest.rst:1307 +#: ../../library/unittest.rst:1363 msgid "" -"The list of type-specific methods automatically used by :meth:`~TestCase." -"assertEqual` are summarized in the following table. Note that it's usually " -"not necessary to invoke these methods directly." +"The list of type-specific methods automatically used " +"by :meth:`~TestCase.assertEqual` are summarized in the following table. " +"Note that it's usually not necessary to invoke these methods directly." msgstr "" -#: ../../library/unittest.rst:1312 +#: ../../library/unittest.rst:1368 msgid "Used to compare" msgstr "" -#: ../../library/unittest.rst:1314 +#: ../../library/unittest.rst:1370 msgid ":meth:`assertMultiLineEqual(a, b) `" msgstr ":meth:`assertMultiLineEqual(a, b) `" -#: ../../library/unittest.rst:1314 +#: ../../library/unittest.rst:1370 msgid "strings" msgstr "字串" -#: ../../library/unittest.rst:1317 +#: ../../library/unittest.rst:1373 msgid ":meth:`assertSequenceEqual(a, b) `" msgstr ":meth:`assertSequenceEqual(a, b) `" -#: ../../library/unittest.rst:1317 +#: ../../library/unittest.rst:1373 msgid "sequences" msgstr "序列" -#: ../../library/unittest.rst:1320 +#: ../../library/unittest.rst:1376 msgid ":meth:`assertListEqual(a, b) `" msgstr ":meth:`assertListEqual(a, b) `" -#: ../../library/unittest.rst:1320 +#: ../../library/unittest.rst:1376 msgid "lists" msgstr "串列" -#: ../../library/unittest.rst:1323 +#: ../../library/unittest.rst:1379 msgid ":meth:`assertTupleEqual(a, b) `" msgstr ":meth:`assertTupleEqual(a, b) `" -#: ../../library/unittest.rst:1323 +#: ../../library/unittest.rst:1379 msgid "tuples" msgstr "元組" -#: ../../library/unittest.rst:1326 +#: ../../library/unittest.rst:1382 msgid ":meth:`assertSetEqual(a, b) `" msgstr ":meth:`assertSetEqual(a, b) `" -#: ../../library/unittest.rst:1326 +#: ../../library/unittest.rst:1382 msgid "sets or frozensets" msgstr "集合或凍結集合" -#: ../../library/unittest.rst:1329 +#: ../../library/unittest.rst:1385 msgid ":meth:`assertDictEqual(a, b) `" msgstr ":meth:`assertDictEqual(a, b) `" -#: ../../library/unittest.rst:1329 +#: ../../library/unittest.rst:1385 msgid "dicts" msgstr "字典" -#: ../../library/unittest.rst:1337 +#: ../../library/unittest.rst:1393 msgid "" "Test that the multiline string *first* is equal to the string *second*. When " "not equal a diff of the two strings highlighting the differences will be " @@ -2185,7 +2287,7 @@ msgid "" "strings with :meth:`assertEqual`." msgstr "" -#: ../../library/unittest.rst:1347 +#: ../../library/unittest.rst:1403 msgid "" "Tests that two sequences are equal. If a *seq_type* is supplied, both " "*first* and *second* must be instances of *seq_type* or a failure will be " @@ -2193,13 +2295,13 @@ msgid "" "shows the difference between the two." msgstr "" -#: ../../library/unittest.rst:1352 +#: ../../library/unittest.rst:1408 msgid "" "This method is not called directly by :meth:`assertEqual`, but it's used to " "implement :meth:`assertListEqual` and :meth:`assertTupleEqual`." msgstr "" -#: ../../library/unittest.rst:1362 +#: ../../library/unittest.rst:1418 msgid "" "Tests that two lists or tuples are equal. If not, an error message is " "constructed that shows only the differences between the two. An error is " @@ -2207,47 +2309,47 @@ msgid "" "are used by default when comparing lists or tuples with :meth:`assertEqual`." msgstr "" -#: ../../library/unittest.rst:1373 +#: ../../library/unittest.rst:1429 msgid "" "Tests that two sets are equal. If not, an error message is constructed that " "lists the differences between the sets. This method is used by default when " "comparing sets or frozensets with :meth:`assertEqual`." msgstr "" -#: ../../library/unittest.rst:1377 +#: ../../library/unittest.rst:1433 msgid "" -"Fails if either of *first* or *second* does not have a :meth:`set." -"difference` method." +"Fails if either of *first* or *second* does not have " +"a :meth:`set.difference` method." msgstr "" -#: ../../library/unittest.rst:1385 +#: ../../library/unittest.rst:1441 msgid "" "Test that two dictionaries are equal. If not, an error message is " "constructed that shows the differences in the dictionaries. This method will " "be used by default to compare dictionaries in calls to :meth:`assertEqual`." msgstr "" -#: ../../library/unittest.rst:1396 +#: ../../library/unittest.rst:1452 msgid "" "Finally the :class:`TestCase` provides the following methods and attributes:" msgstr "" -#: ../../library/unittest.rst:1401 +#: ../../library/unittest.rst:1457 msgid "" "Signals a test failure unconditionally, with *msg* or ``None`` for the error " "message." msgstr "" -#: ../../library/unittest.rst:1407 +#: ../../library/unittest.rst:1463 msgid "" "This class attribute gives the exception raised by the test method. If a " "test framework needs to use a specialized exception, possibly to carry " "additional information, it must subclass this exception in order to \"play " -"fair\" with the framework. The initial value of this attribute is :exc:" -"`AssertionError`." +"fair\" with the framework. The initial value of this attribute " +"is :exc:`AssertionError`." msgstr "" -#: ../../library/unittest.rst:1416 +#: ../../library/unittest.rst:1472 msgid "" "This class attribute determines what happens when a custom failure message " "is passed as the msg argument to an assertXYY call that fails. ``True`` is " @@ -2256,80 +2358,80 @@ msgid "" "replaces the standard message." msgstr "" -#: ../../library/unittest.rst:1422 +#: ../../library/unittest.rst:1478 msgid "" "The class setting can be overridden in individual test methods by assigning " "an instance attribute, self.longMessage, to ``True`` or ``False`` before " "calling the assert methods." msgstr "" -#: ../../library/unittest.rst:1426 +#: ../../library/unittest.rst:1482 msgid "The class setting gets reset before each test call." msgstr "" -#: ../../library/unittest.rst:1433 +#: ../../library/unittest.rst:1489 msgid "" "This attribute controls the maximum length of diffs output by assert methods " "that report diffs on failure. It defaults to 80*8 characters. Assert methods " "affected by this attribute are :meth:`assertSequenceEqual` (including all " -"the sequence comparison methods that delegate to it), :meth:" -"`assertDictEqual` and :meth:`assertMultiLineEqual`." +"the sequence comparison methods that delegate to " +"it), :meth:`assertDictEqual` and :meth:`assertMultiLineEqual`." msgstr "" -#: ../../library/unittest.rst:1440 +#: ../../library/unittest.rst:1496 msgid "" "Setting ``maxDiff`` to ``None`` means that there is no maximum length of " "diffs." msgstr "" -#: ../../library/unittest.rst:1446 +#: ../../library/unittest.rst:1502 msgid "" "Testing frameworks can use the following methods to collect information on " "the test:" msgstr "" -#: ../../library/unittest.rst:1452 +#: ../../library/unittest.rst:1508 msgid "" -"Return the number of tests represented by this test object. For :class:" -"`TestCase` instances, this will always be ``1``." +"Return the number of tests represented by this test object. " +"For :class:`TestCase` instances, this will always be ``1``." msgstr "" -#: ../../library/unittest.rst:1458 +#: ../../library/unittest.rst:1514 msgid "" "Return an instance of the test result class that should be used for this " "test case class (if no other result instance is provided to the :meth:`run` " "method)." msgstr "" -#: ../../library/unittest.rst:1462 +#: ../../library/unittest.rst:1518 msgid "" -"For :class:`TestCase` instances, this will always be an instance of :class:" -"`TestResult`; subclasses of :class:`TestCase` should override this as " -"necessary." +"For :class:`TestCase` instances, this will always be an instance " +"of :class:`TestResult`; subclasses of :class:`TestCase` should override this " +"as necessary." msgstr "" -#: ../../library/unittest.rst:1469 +#: ../../library/unittest.rst:1525 msgid "" "Return a string identifying the specific test case. This is usually the " "full name of the test method, including the module and class name." msgstr "" -#: ../../library/unittest.rst:1475 +#: ../../library/unittest.rst:1531 msgid "" "Returns a description of the test, or ``None`` if no description has been " "provided. The default implementation of this method returns the first line " "of the test method's docstring, if available, or ``None``." msgstr "" -#: ../../library/unittest.rst:1480 +#: ../../library/unittest.rst:1536 msgid "" "In 3.1 this was changed to add the test name to the short description even " "in the presence of a docstring. This caused compatibility issues with " -"unittest extensions and adding the test name was moved to the :class:" -"`TextTestResult` in Python 3.2." +"unittest extensions and adding the test name was moved to " +"the :class:`TextTestResult` in Python 3.2." msgstr "" -#: ../../library/unittest.rst:1489 +#: ../../library/unittest.rst:1545 msgid "" "Add a function to be called after :meth:`tearDown` to cleanup resources used " "during the test. Functions will be called in reverse order to the order they " @@ -2338,39 +2440,40 @@ msgid "" "added." msgstr "" -#: ../../library/unittest.rst:1495 +#: ../../library/unittest.rst:1551 msgid "" "If :meth:`setUp` fails, meaning that :meth:`tearDown` is not called, then " "any cleanup functions added will still be called." msgstr "" -#: ../../library/unittest.rst:1503 +#: ../../library/unittest.rst:1559 msgid "" -"Enter the supplied :term:`context manager`. If successful, also add its :" -"meth:`~object.__exit__` method as a cleanup function by :meth:`addCleanup` " -"and return the result of the :meth:`~object.__enter__` method." +"Enter the supplied :term:`context manager`. If successful, also add " +"its :meth:`~object.__exit__` method as a cleanup function " +"by :meth:`addCleanup` and return the result of the :meth:`~object.__enter__` " +"method." msgstr "" -#: ../../library/unittest.rst:1513 +#: ../../library/unittest.rst:1569 msgid "" -"This method is called unconditionally after :meth:`tearDown`, or after :meth:" -"`setUp` if :meth:`setUp` raises an exception." +"This method is called unconditionally after :meth:`tearDown`, or " +"after :meth:`setUp` if :meth:`setUp` raises an exception." msgstr "" -#: ../../library/unittest.rst:1516 +#: ../../library/unittest.rst:1572 msgid "" -"It is responsible for calling all the cleanup functions added by :meth:" -"`addCleanup`. If you need cleanup functions to be called *prior* to :meth:" -"`tearDown` then you can call :meth:`doCleanups` yourself." +"It is responsible for calling all the cleanup functions added " +"by :meth:`addCleanup`. If you need cleanup functions to be called *prior* " +"to :meth:`tearDown` then you can call :meth:`doCleanups` yourself." msgstr "" -#: ../../library/unittest.rst:1521 +#: ../../library/unittest.rst:1577 msgid "" ":meth:`doCleanups` pops methods off the stack of cleanup functions one at a " "time, so it can be called at any time." msgstr "" -#: ../../library/unittest.rst:1529 +#: ../../library/unittest.rst:1585 msgid "" "Add a function to be called after :meth:`tearDownClass` to cleanup resources " "used during the test class. Functions will be called in reverse order to the " @@ -2379,61 +2482,62 @@ msgid "" "when they are added." msgstr "" -#: ../../library/unittest.rst:1535 +#: ../../library/unittest.rst:1591 msgid "" "If :meth:`setUpClass` fails, meaning that :meth:`tearDownClass` is not " "called, then any cleanup functions added will still be called." msgstr "" -#: ../../library/unittest.rst:1543 +#: ../../library/unittest.rst:1599 msgid "" -"Enter the supplied :term:`context manager`. If successful, also add its :" -"meth:`~object.__exit__` method as a cleanup function by :meth:" -"`addClassCleanup` and return the result of the :meth:`~object.__enter__` " -"method." +"Enter the supplied :term:`context manager`. If successful, also add " +"its :meth:`~object.__exit__` method as a cleanup function " +"by :meth:`addClassCleanup` and return the result of " +"the :meth:`~object.__enter__` method." msgstr "" -#: ../../library/unittest.rst:1553 +#: ../../library/unittest.rst:1609 msgid "" -"This method is called unconditionally after :meth:`tearDownClass`, or after :" -"meth:`setUpClass` if :meth:`setUpClass` raises an exception." +"This method is called unconditionally after :meth:`tearDownClass`, or " +"after :meth:`setUpClass` if :meth:`setUpClass` raises an exception." msgstr "" -#: ../../library/unittest.rst:1556 +#: ../../library/unittest.rst:1612 msgid "" -"It is responsible for calling all the cleanup functions added by :meth:" -"`addClassCleanup`. If you need cleanup functions to be called *prior* to :" -"meth:`tearDownClass` then you can call :meth:`doClassCleanups` yourself." +"It is responsible for calling all the cleanup functions added " +"by :meth:`addClassCleanup`. If you need cleanup functions to be called " +"*prior* to :meth:`tearDownClass` then you can call :meth:`doClassCleanups` " +"yourself." msgstr "" -#: ../../library/unittest.rst:1561 +#: ../../library/unittest.rst:1617 msgid "" ":meth:`doClassCleanups` pops methods off the stack of cleanup functions one " "at a time, so it can be called at any time." msgstr "" -#: ../../library/unittest.rst:1569 +#: ../../library/unittest.rst:1625 msgid "" "This class provides an API similar to :class:`TestCase` and also accepts " "coroutines as test functions." msgstr "" -#: ../../library/unittest.rst:1576 +#: ../../library/unittest.rst:1632 msgid "" "The *loop_factory* passed to :class:`asyncio.Runner`. Override in subclasses " "with :class:`asyncio.EventLoop` to avoid using the asyncio policy system." msgstr "" -#: ../../library/unittest.rst:1585 +#: ../../library/unittest.rst:1641 msgid "" -"Method called to prepare the test fixture. This is called after :meth:" -"`setUp`. This is called immediately before calling the test method; other " -"than :exc:`AssertionError` or :exc:`SkipTest`, any exception raised by this " -"method will be considered an error rather than a test failure. The default " -"implementation does nothing." +"Method called to prepare the test fixture. This is called " +"after :meth:`setUp`. This is called immediately before calling the test " +"method; other than :exc:`AssertionError` or :exc:`SkipTest`, any exception " +"raised by this method will be considered an error rather than a test " +"failure. The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1594 +#: ../../library/unittest.rst:1650 msgid "" "Method called immediately after the test method has been called and the " "result recorded. This is called before :meth:`tearDown`. This is called " @@ -2446,33 +2550,33 @@ msgid "" "the outcome of the test method. The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1606 +#: ../../library/unittest.rst:1662 msgid "This method accepts a coroutine that can be used as a cleanup function." msgstr "" -#: ../../library/unittest.rst:1611 +#: ../../library/unittest.rst:1667 msgid "" "Enter the supplied :term:`asynchronous context manager`. If successful, " -"also add its :meth:`~object.__aexit__` method as a cleanup function by :meth:" -"`addAsyncCleanup` and return the result of the :meth:`~object.__aenter__` " -"method." +"also add its :meth:`~object.__aexit__` method as a cleanup function " +"by :meth:`addAsyncCleanup` and return the result of " +"the :meth:`~object.__aenter__` method." msgstr "" -#: ../../library/unittest.rst:1621 +#: ../../library/unittest.rst:1677 msgid "" -"Sets up a new event loop to run the test, collecting the result into the :" -"class:`TestResult` object passed as *result*. If *result* is omitted or " -"``None``, a temporary result object is created (by calling the :meth:" -"`defaultTestResult` method) and used. The result object is returned to :meth:" -"`run`'s caller. At the end of the test all the tasks in the event loop are " -"cancelled." +"Sets up a new event loop to run the test, collecting the result into " +"the :class:`TestResult` object passed as *result*. If *result* is omitted " +"or ``None``, a temporary result object is created (by calling " +"the :meth:`defaultTestResult` method) and used. The result object is " +"returned to :meth:`run`'s caller. At the end of the test all the tasks in " +"the event loop are cancelled." msgstr "" -#: ../../library/unittest.rst:1629 +#: ../../library/unittest.rst:1685 msgid "An example illustrating the order::" msgstr "" -#: ../../library/unittest.rst:1631 +#: ../../library/unittest.rst:1687 msgid "" "from unittest import IsolatedAsyncioTestCase\n" "\n" @@ -2491,8 +2595,8 @@ msgid "" "\n" " async def test_response(self):\n" " events.append(\"test_response\")\n" -" response = await self._async_connection.get(\"https://example." -"com\")\n" +" response = await self._async_connection.get(\"https://" +"example.com\")\n" " self.assertEqual(response.status_code, 200)\n" " self.addAsyncCleanup(self.on_cleanup)\n" "\n" @@ -2526,8 +2630,8 @@ msgstr "" "\n" " async def test_response(self):\n" " events.append(\"test_response\")\n" -" response = await self._async_connection.get(\"https://example." -"com\")\n" +" response = await self._async_connection.get(\"https://" +"example.com\")\n" " self.assertEqual(response.status_code, 200)\n" " self.addAsyncCleanup(self.on_cleanup)\n" "\n" @@ -2544,27 +2648,27 @@ msgstr "" "if __name__ == \"__main__\":\n" " unittest.main()" -#: ../../library/unittest.rst:1665 +#: ../../library/unittest.rst:1721 msgid "" "After running the test, ``events`` would contain ``[\"setUp\", " "\"asyncSetUp\", \"test_response\", \"asyncTearDown\", \"tearDown\", " "\"cleanup\"]``." msgstr "" -#: ../../library/unittest.rst:1670 +#: ../../library/unittest.rst:1726 msgid "" "This class implements the portion of the :class:`TestCase` interface which " "allows the test runner to drive the test, but does not provide the methods " "which test code can use to check and report errors. This is used to create " -"test cases using legacy test code, allowing it to be integrated into a :mod:" -"`unittest`-based test framework." +"test cases using legacy test code, allowing it to be integrated into " +"a :mod:`unittest`-based test framework." msgstr "" -#: ../../library/unittest.rst:1680 +#: ../../library/unittest.rst:1736 msgid "Grouping tests" msgstr "" -#: ../../library/unittest.rst:1684 +#: ../../library/unittest.rst:1740 msgid "" "This class represents an aggregation of individual test cases and test " "suites. The class presents the interface needed by the test runner to allow " @@ -2572,14 +2676,14 @@ msgid "" "is the same as iterating over the suite, running each test individually." msgstr "" -#: ../../library/unittest.rst:1689 +#: ../../library/unittest.rst:1745 msgid "" "If *tests* is given, it must be an iterable of individual test cases or " "other test suites that will be used to build the suite initially. Additional " "methods are provided to add test cases and suites to the collection later on." msgstr "" -#: ../../library/unittest.rst:1693 +#: ../../library/unittest.rst:1749 msgid "" ":class:`TestSuite` objects behave much like :class:`TestCase` objects, " "except they do not actually implement a test. Instead, they are used to " @@ -2588,47 +2692,48 @@ msgid "" "instances:" msgstr "" -#: ../../library/unittest.rst:1701 +#: ../../library/unittest.rst:1757 msgid "Add a :class:`TestCase` or :class:`TestSuite` to the suite." msgstr "" -#: ../../library/unittest.rst:1706 +#: ../../library/unittest.rst:1762 msgid "" -"Add all the tests from an iterable of :class:`TestCase` and :class:" -"`TestSuite` instances to this test suite." +"Add all the tests from an iterable of :class:`TestCase` " +"and :class:`TestSuite` instances to this test suite." msgstr "" -#: ../../library/unittest.rst:1709 +#: ../../library/unittest.rst:1765 msgid "" "This is equivalent to iterating over *tests*, calling :meth:`addTest` for " "each element." msgstr "" -#: ../../library/unittest.rst:1712 +#: ../../library/unittest.rst:1768 msgid ":class:`TestSuite` shares the following methods with :class:`TestCase`:" msgstr "" -#: ../../library/unittest.rst:1717 +#: ../../library/unittest.rst:1773 msgid "" "Run the tests associated with this suite, collecting the result into the " -"test result object passed as *result*. Note that unlike :meth:`TestCase." -"run`, :meth:`TestSuite.run` requires the result object to be passed in." +"test result object passed as *result*. Note that " +"unlike :meth:`TestCase.run`, :meth:`TestSuite.run` requires the result " +"object to be passed in." msgstr "" -#: ../../library/unittest.rst:1725 +#: ../../library/unittest.rst:1781 msgid "" "Run the tests associated with this suite without collecting the result. This " "allows exceptions raised by the test to be propagated to the caller and can " "be used to support running tests under a debugger." msgstr "" -#: ../../library/unittest.rst:1732 +#: ../../library/unittest.rst:1788 msgid "" "Return the number of tests represented by this test object, including all " "individual tests and sub-suites." msgstr "" -#: ../../library/unittest.rst:1738 +#: ../../library/unittest.rst:1794 msgid "" "Tests grouped by a :class:`TestSuite` are always accessed by iteration. " "Subclasses can lazily provide tests by overriding :meth:`!__iter__`. Note " @@ -2640,44 +2745,44 @@ msgid "" "overrides :meth:`TestSuite._removeTestAtIndex` to preserve test references." msgstr "" -#: ../../library/unittest.rst:1748 +#: ../../library/unittest.rst:1804 msgid "" "In earlier versions the :class:`TestSuite` accessed tests directly rather " "than through iteration, so overriding :meth:`!__iter__` wasn't sufficient " "for providing tests." msgstr "" -#: ../../library/unittest.rst:1753 +#: ../../library/unittest.rst:1809 msgid "" -"In earlier versions the :class:`TestSuite` held references to each :class:" -"`TestCase` after :meth:`TestSuite.run`. Subclasses can restore that behavior " -"by overriding :meth:`TestSuite._removeTestAtIndex`." +"In earlier versions the :class:`TestSuite` held references to " +"each :class:`TestCase` after :meth:`TestSuite.run`. Subclasses can restore " +"that behavior by overriding :meth:`TestSuite._removeTestAtIndex`." msgstr "" -#: ../../library/unittest.rst:1758 +#: ../../library/unittest.rst:1814 msgid "" "In the typical usage of a :class:`TestSuite` object, the :meth:`run` method " "is invoked by a :class:`TestRunner` rather than by the end-user test harness." msgstr "" -#: ../../library/unittest.rst:1763 +#: ../../library/unittest.rst:1819 msgid "Loading and running tests" msgstr "" -#: ../../library/unittest.rst:1767 +#: ../../library/unittest.rst:1823 msgid "" "The :class:`TestLoader` class is used to create test suites from classes and " "modules. Normally, there is no need to create an instance of this class; " -"the :mod:`unittest` module provides an instance that can be shared as :data:" -"`unittest.defaultTestLoader`. Using a subclass or instance, however, allows " -"customization of some configurable properties." +"the :mod:`unittest` module provides an instance that can be shared " +"as :data:`unittest.defaultTestLoader`. Using a subclass or instance, " +"however, allows customization of some configurable properties." msgstr "" -#: ../../library/unittest.rst:1773 +#: ../../library/unittest.rst:1829 msgid ":class:`TestLoader` objects have the following attributes:" msgstr "" -#: ../../library/unittest.rst:1778 +#: ../../library/unittest.rst:1834 msgid "" "A list of the non-fatal errors encountered while loading tests. Not reset by " "the loader at any point. Fatal errors are signalled by the relevant method " @@ -2685,33 +2790,33 @@ msgid "" "synthetic test that will raise the original error when run." msgstr "" -#: ../../library/unittest.rst:1787 +#: ../../library/unittest.rst:1843 msgid ":class:`TestLoader` objects have the following methods:" msgstr "" -#: ../../library/unittest.rst:1792 +#: ../../library/unittest.rst:1848 msgid "" -"Return a suite of all test cases contained in the :class:`TestCase`\\ -" -"derived :class:`testCaseClass`." +"Return a suite of all test cases contained in the :class:`TestCase`\\ " +"-derived :class:`testCaseClass`." msgstr "" -#: ../../library/unittest.rst:1795 +#: ../../library/unittest.rst:1851 msgid "" -"A test case instance is created for each method named by :meth:" -"`getTestCaseNames`. By default these are the method names beginning with " -"``test``. If :meth:`getTestCaseNames` returns no methods, but the :meth:" -"`runTest` method is implemented, a single test case is created for that " -"method instead." +"A test case instance is created for each method named " +"by :meth:`getTestCaseNames`. By default these are the method names beginning " +"with ``test``. If :meth:`getTestCaseNames` returns no methods, but " +"the :meth:`runTest` method is implemented, a single test case is created for " +"that method instead." msgstr "" -#: ../../library/unittest.rst:1804 +#: ../../library/unittest.rst:1860 msgid "" "Return a suite of all test cases contained in the given module. This method " "searches *module* for classes derived from :class:`TestCase` and creates an " "instance of the class for each test method defined for the class." msgstr "" -#: ../../library/unittest.rst:1811 +#: ../../library/unittest.rst:1867 msgid "" "While using a hierarchy of :class:`TestCase`\\ -derived classes can be " "convenient in sharing fixtures and helper functions, defining test methods " @@ -2720,7 +2825,7 @@ msgid "" "fixtures are different and defined in subclasses." msgstr "" -#: ../../library/unittest.rst:1817 +#: ../../library/unittest.rst:1873 msgid "" "If a module provides a ``load_tests`` function it will be called to load the " "tests. This allows modules to customize test loading. This is the " @@ -2728,72 +2833,72 @@ msgid "" "argument to ``load_tests``." msgstr "" -#: ../../library/unittest.rst:1822 +#: ../../library/unittest.rst:1878 msgid "Support for ``load_tests`` added." msgstr "" -#: ../../library/unittest.rst:1825 +#: ../../library/unittest.rst:1881 msgid "Support for a keyword-only argument *pattern* has been added." msgstr "" -#: ../../library/unittest.rst:1828 +#: ../../library/unittest.rst:1884 msgid "" "The undocumented and unofficial *use_load_tests* parameter has been removed." msgstr "" -#: ../../library/unittest.rst:1835 +#: ../../library/unittest.rst:1891 msgid "Return a suite of all test cases given a string specifier." msgstr "" -#: ../../library/unittest.rst:1837 +#: ../../library/unittest.rst:1893 msgid "" "The specifier *name* is a \"dotted name\" that may resolve either to a " -"module, a test case class, a test method within a test case class, a :class:" -"`TestSuite` instance, or a callable object which returns a :class:`TestCase` " -"or :class:`TestSuite` instance. These checks are applied in the order " -"listed here; that is, a method on a possible test case class will be picked " -"up as \"a test method within a test case class\", rather than \"a callable " -"object\"." +"module, a test case class, a test method within a test case class, " +"a :class:`TestSuite` instance, or a callable object which returns " +"a :class:`TestCase` or :class:`TestSuite` instance. These checks are " +"applied in the order listed here; that is, a method on a possible test case " +"class will be picked up as \"a test method within a test case class\", " +"rather than \"a callable object\"." msgstr "" -#: ../../library/unittest.rst:1845 +#: ../../library/unittest.rst:1901 msgid "" -"For example, if you have a module :mod:`SampleTests` containing a :class:" -"`TestCase`\\ -derived class :class:`SampleTestCase` with three test methods " -"(:meth:`test_one`, :meth:`test_two`, and :meth:`test_three`), the specifier " -"``'SampleTests.SampleTestCase'`` would cause this method to return a suite " -"which will run all three test methods. Using the specifier ``'SampleTests." -"SampleTestCase.test_two'`` would cause it to return a test suite which will " -"run only the :meth:`test_two` test method. The specifier can refer to " -"modules and packages which have not been imported; they will be imported as " -"a side-effect." +"For example, if you have a module :mod:`SampleTests` containing " +"a :class:`TestCase`\\ -derived class :class:`SampleTestCase` with three test " +"methods (:meth:`test_one`, :meth:`test_two`, and :meth:`test_three`), the " +"specifier ``'SampleTests.SampleTestCase'`` would cause this method to return " +"a suite which will run all three test methods. Using the specifier " +"``'SampleTests.SampleTestCase.test_two'`` would cause it to return a test " +"suite which will run only the :meth:`test_two` test method. The specifier " +"can refer to modules and packages which have not been imported; they will be " +"imported as a side-effect." msgstr "" -#: ../../library/unittest.rst:1855 +#: ../../library/unittest.rst:1911 msgid "The method optionally resolves *name* relative to the given *module*." msgstr "" -#: ../../library/unittest.rst:1857 +#: ../../library/unittest.rst:1913 msgid "" "If an :exc:`ImportError` or :exc:`AttributeError` occurs while traversing " "*name* then a synthetic test that raises that error when run will be " "returned. These errors are included in the errors accumulated by self.errors." msgstr "" -#: ../../library/unittest.rst:1866 +#: ../../library/unittest.rst:1922 msgid "" "Similar to :meth:`loadTestsFromName`, but takes a sequence of names rather " "than a single name. The return value is a test suite which supports all the " "tests defined for each name." msgstr "" -#: ../../library/unittest.rst:1873 +#: ../../library/unittest.rst:1929 msgid "" "Return a sorted sequence of method names found within *testCaseClass*; this " "should be a subclass of :class:`TestCase`." msgstr "" -#: ../../library/unittest.rst:1879 +#: ../../library/unittest.rst:1935 msgid "" "Find all the test modules by recursing into subdirectories from the " "specified start directory, and return a TestSuite object containing them. " @@ -2802,14 +2907,14 @@ msgid "" "Python identifiers) will be loaded." msgstr "" -#: ../../library/unittest.rst:1885 +#: ../../library/unittest.rst:1941 msgid "" "All test modules must be importable from the top level of the project. If " "the start directory is not the top level directory then *top_level_dir* must " "be specified separately." msgstr "" -#: ../../library/unittest.rst:1889 +#: ../../library/unittest.rst:1945 msgid "" "If importing a module fails, for example due to a syntax error, then this " "will be recorded as a single error and discovery will continue. If the " @@ -2817,7 +2922,7 @@ msgid "" "as a skip instead of an error." msgstr "" -#: ../../library/unittest.rst:1894 +#: ../../library/unittest.rst:1950 msgid "" "If a package (a directory containing a file named :file:`__init__.py`) is " "found, the package will be checked for a ``load_tests`` function. If this " @@ -2827,103 +2932,107 @@ msgid "" "itself calls ``loader.discover``." msgstr "" -#: ../../library/unittest.rst:1902 +#: ../../library/unittest.rst:1958 msgid "" "If ``load_tests`` exists then discovery does *not* recurse into the package, " "``load_tests`` is responsible for loading all tests in the package." msgstr "" -#: ../../library/unittest.rst:1906 +#: ../../library/unittest.rst:1962 msgid "" "The pattern is deliberately not stored as a loader attribute so that " "packages can continue discovery themselves." msgstr "" -#: ../../library/unittest.rst:1909 +#: ../../library/unittest.rst:1965 msgid "" "*top_level_dir* is stored internally, and used as a default to any nested " "calls to ``discover()``. That is, if a package's ``load_tests`` calls " "``loader.discover()``, it does not need to pass this argument." msgstr "" -#: ../../library/unittest.rst:1913 +#: ../../library/unittest.rst:1969 msgid "*start_dir* can be a dotted module name as well as a directory." msgstr "" -#: ../../library/unittest.rst:1917 +#: ../../library/unittest.rst:1973 msgid "" "Modules that raise :exc:`SkipTest` on import are recorded as skips, not " "errors." msgstr "" -#: ../../library/unittest.rst:1921 +#: ../../library/unittest.rst:1977 msgid "*start_dir* can be a :term:`namespace packages `." msgstr "" -#: ../../library/unittest.rst:1924 +#: ../../library/unittest.rst:1979 msgid "" "Paths are sorted before being imported so that execution order is the same " "even if the underlying file system's ordering is not dependent on file name." msgstr "" -#: ../../library/unittest.rst:1929 +#: ../../library/unittest.rst:1983 msgid "" "Found packages are now checked for ``load_tests`` regardless of whether " "their path matches *pattern*, because it is impossible for a package name to " "match the default pattern." msgstr "" -#: ../../library/unittest.rst:1934 +#: ../../library/unittest.rst:1988 msgid "" "*start_dir* can not be a :term:`namespace packages `. It " -"has been broken since Python 3.7 and Python 3.11 officially remove it." +"has been broken since Python 3.7, and Python 3.11 officially removes it." msgstr "" -#: ../../library/unittest.rst:1938 +#: ../../library/unittest.rst:1992 msgid "*top_level_dir* is only stored for the duration of *discover* call." msgstr "" -#: ../../library/unittest.rst:1942 +#: ../../library/unittest.rst:1995 +msgid "*start_dir* can once again be a :term:`namespace package`." +msgstr "" + +#: ../../library/unittest.rst:1998 msgid "" "The following attributes of a :class:`TestLoader` can be configured either " "by subclassing or assignment on an instance:" msgstr "" -#: ../../library/unittest.rst:1948 +#: ../../library/unittest.rst:2004 msgid "" "String giving the prefix of method names which will be interpreted as test " "methods. The default value is ``'test'``." msgstr "" -#: ../../library/unittest.rst:1951 +#: ../../library/unittest.rst:2007 msgid "" "This affects :meth:`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1957 +#: ../../library/unittest.rst:2013 msgid "" -"Function to be used to compare method names when sorting them in :meth:" -"`getTestCaseNames` and all the ``loadTestsFrom*`` methods." +"Function to be used to compare method names when sorting them " +"in :meth:`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1963 +#: ../../library/unittest.rst:2019 msgid "" "Callable object that constructs a test suite from a list of tests. No " -"methods on the resulting object are needed. The default value is the :class:" -"`TestSuite` class." +"methods on the resulting object are needed. The default value is " +"the :class:`TestSuite` class." msgstr "" -#: ../../library/unittest.rst:1967 ../../library/unittest.rst:1980 +#: ../../library/unittest.rst:2023 ../../library/unittest.rst:2036 msgid "This affects all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1971 +#: ../../library/unittest.rst:2027 msgid "" "List of Unix shell-style wildcard test name patterns that test methods have " "to match to be included in test suites (see ``-k`` option)." msgstr "" -#: ../../library/unittest.rst:1974 +#: ../../library/unittest.rst:2030 msgid "" "If this attribute is not ``None`` (the default), all test methods to be " "included in test suites must match one of the patterns in this list. Note " @@ -2932,83 +3041,83 @@ msgid "" "have to be converted using ``*`` wildcards." msgstr "" -#: ../../library/unittest.rst:1987 +#: ../../library/unittest.rst:2043 msgid "" "This class is used to compile information about which tests have succeeded " "and which have failed." msgstr "" -#: ../../library/unittest.rst:1990 +#: ../../library/unittest.rst:2046 msgid "" -"A :class:`TestResult` object stores the results of a set of tests. The :" -"class:`TestCase` and :class:`TestSuite` classes ensure that results are " +"A :class:`TestResult` object stores the results of a set of tests. " +"The :class:`TestCase` and :class:`TestSuite` classes ensure that results are " "properly recorded; test authors do not need to worry about recording the " "outcome of tests." msgstr "" -#: ../../library/unittest.rst:1995 +#: ../../library/unittest.rst:2051 msgid "" -"Testing frameworks built on top of :mod:`unittest` may want access to the :" -"class:`TestResult` object generated by running a set of tests for reporting " -"purposes; a :class:`TestResult` instance is returned by the :meth:" -"`TestRunner.run` method for this purpose." +"Testing frameworks built on top of :mod:`unittest` may want access to " +"the :class:`TestResult` object generated by running a set of tests for " +"reporting purposes; a :class:`TestResult` instance is returned by " +"the :meth:`TestRunner.run` method for this purpose." msgstr "" -#: ../../library/unittest.rst:2000 +#: ../../library/unittest.rst:2056 msgid "" ":class:`TestResult` instances have the following attributes that will be of " "interest when inspecting the results of running a set of tests:" msgstr "" -#: ../../library/unittest.rst:2006 +#: ../../library/unittest.rst:2062 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test which raised an " "unexpected exception." msgstr "" -#: ../../library/unittest.rst:2012 +#: ../../library/unittest.rst:2068 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test where a failure " "was explicitly signalled using the :ref:`assert\\* methods `." msgstr "" -#: ../../library/unittest.rst:2018 +#: ../../library/unittest.rst:2074 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding the reason for skipping the test." msgstr "" -#: ../../library/unittest.rst:2025 +#: ../../library/unittest.rst:2081 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents an expected failure or " "error of the test case." msgstr "" -#: ../../library/unittest.rst:2031 +#: ../../library/unittest.rst:2087 msgid "" "A list containing :class:`TestCase` instances that were marked as expected " "failures, but succeeded." msgstr "" -#: ../../library/unittest.rst:2036 +#: ../../library/unittest.rst:2092 msgid "" "A list containing 2-tuples of test case names and floats representing the " "elapsed time of each test which was run." msgstr "" -#: ../../library/unittest.rst:2043 +#: ../../library/unittest.rst:2099 msgid "" "Set to ``True`` when the execution of tests should stop by :meth:`stop`." msgstr "" -#: ../../library/unittest.rst:2047 +#: ../../library/unittest.rst:2103 msgid "The total number of tests run so far." msgstr "" -#: ../../library/unittest.rst:2051 +#: ../../library/unittest.rst:2107 msgid "" "If set to true, ``sys.stdout`` and ``sys.stderr`` will be buffered in " "between :meth:`startTest` and :meth:`stopTest` being called. Collected " @@ -3017,37 +3126,37 @@ msgid "" "error message." msgstr "" -#: ../../library/unittest.rst:2060 +#: ../../library/unittest.rst:2116 msgid "" "If set to true :meth:`stop` will be called on the first failure or error, " "halting the test run." msgstr "" -#: ../../library/unittest.rst:2067 +#: ../../library/unittest.rst:2123 msgid "If set to true then local variables will be shown in tracebacks." msgstr "" -#: ../../library/unittest.rst:2073 +#: ../../library/unittest.rst:2129 msgid "" "Return ``True`` if all tests run so far have passed, otherwise returns " "``False``." msgstr "" -#: ../../library/unittest.rst:2076 +#: ../../library/unittest.rst:2132 msgid "" "Returns ``False`` if there were any :attr:`unexpectedSuccesses` from tests " "marked with the :func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2082 +#: ../../library/unittest.rst:2138 msgid "" "This method can be called to signal that the set of tests being run should " -"be aborted by setting the :attr:`shouldStop` attribute to ``True``. :class:" -"`TestRunner` objects should respect this flag and return without running any " -"additional tests." +"be aborted by setting the :attr:`shouldStop` attribute to " +"``True``. :class:`TestRunner` objects should respect this flag and return " +"without running any additional tests." msgstr "" -#: ../../library/unittest.rst:2087 +#: ../../library/unittest.rst:2143 msgid "" "For example, this feature is used by the :class:`TextTestRunner` class to " "stop the test framework when the user signals an interrupt from the " @@ -3055,7 +3164,7 @@ msgid "" "implementations can use this in a similar manner." msgstr "" -#: ../../library/unittest.rst:2092 +#: ../../library/unittest.rst:2148 msgid "" "The following methods of the :class:`TestResult` class are used to maintain " "the internal data structures, and may be extended in subclasses to support " @@ -3063,141 +3172,141 @@ msgid "" "tools which support interactive reporting while tests are being run." msgstr "" -#: ../../library/unittest.rst:2100 +#: ../../library/unittest.rst:2156 msgid "Called when the test case *test* is about to be run." msgstr "" -#: ../../library/unittest.rst:2104 +#: ../../library/unittest.rst:2160 msgid "" "Called after the test case *test* has been executed, regardless of the " "outcome." msgstr "" -#: ../../library/unittest.rst:2109 +#: ../../library/unittest.rst:2165 msgid "Called once before any tests are executed." msgstr "" -#: ../../library/unittest.rst:2116 +#: ../../library/unittest.rst:2172 msgid "Called once after all tests are executed." msgstr "" -#: ../../library/unittest.rst:2123 +#: ../../library/unittest.rst:2179 msgid "" "Called when the test case *test* raises an unexpected exception. *err* is a " "tuple of the form returned by :func:`sys.exc_info`: ``(type, value, " "traceback)``." msgstr "" -#: ../../library/unittest.rst:2127 +#: ../../library/unittest.rst:2183 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`errors` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2134 +#: ../../library/unittest.rst:2190 msgid "" "Called when the test case *test* signals a failure. *err* is a tuple of the " "form returned by :func:`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2137 +#: ../../library/unittest.rst:2193 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`failures` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2144 +#: ../../library/unittest.rst:2200 msgid "Called when the test case *test* succeeds." msgstr "" -#: ../../library/unittest.rst:2146 +#: ../../library/unittest.rst:2202 msgid "The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:2151 +#: ../../library/unittest.rst:2207 msgid "" "Called when the test case *test* is skipped. *reason* is the reason the " "test gave for skipping." msgstr "" -#: ../../library/unittest.rst:2154 +#: ../../library/unittest.rst:2210 msgid "" "The default implementation appends a tuple ``(test, reason)`` to the " "instance's :attr:`skipped` attribute." msgstr "" -#: ../../library/unittest.rst:2160 +#: ../../library/unittest.rst:2216 msgid "" -"Called when the test case *test* fails or errors, but was marked with the :" -"func:`expectedFailure` decorator." +"Called when the test case *test* fails or errors, but was marked with " +"the :func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2163 +#: ../../library/unittest.rst:2219 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`expectedFailures` attribute, where *formatted_err* is a " "formatted traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2170 +#: ../../library/unittest.rst:2226 msgid "" "Called when the test case *test* was marked with the :func:`expectedFailure` " "decorator, but succeeded." msgstr "" -#: ../../library/unittest.rst:2173 +#: ../../library/unittest.rst:2229 msgid "" -"The default implementation appends the test to the instance's :attr:" -"`unexpectedSuccesses` attribute." +"The default implementation appends the test to the " +"instance's :attr:`unexpectedSuccesses` attribute." msgstr "" -#: ../../library/unittest.rst:2179 +#: ../../library/unittest.rst:2235 msgid "" "Called when a subtest finishes. *test* is the test case corresponding to " "the test method. *subtest* is a custom :class:`TestCase` instance " "describing the subtest." msgstr "" -#: ../../library/unittest.rst:2183 +#: ../../library/unittest.rst:2239 msgid "" "If *outcome* is :const:`None`, the subtest succeeded. Otherwise, it failed " -"with an exception where *outcome* is a tuple of the form returned by :func:" -"`sys.exc_info`: ``(type, value, traceback)``." +"with an exception where *outcome* is a tuple of the form returned " +"by :func:`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2187 +#: ../../library/unittest.rst:2243 msgid "" "The default implementation does nothing when the outcome is a success, and " "records subtest failures as normal failures." msgstr "" -#: ../../library/unittest.rst:2194 +#: ../../library/unittest.rst:2250 msgid "" "Called when the test case finishes. *elapsed* is the time represented in " "seconds, and it includes the execution of cleanup functions." msgstr "" -#: ../../library/unittest.rst:2201 +#: ../../library/unittest.rst:2257 msgid "" -"A concrete implementation of :class:`TestResult` used by the :class:" -"`TextTestRunner`. Subclasses should accept ``**kwargs`` to ensure " +"A concrete implementation of :class:`TestResult` used by " +"the :class:`TextTestRunner`. Subclasses should accept ``**kwargs`` to ensure " "compatibility as the interface changes." msgstr "" -#: ../../library/unittest.rst:2207 +#: ../../library/unittest.rst:2263 msgid "Added the *durations* keyword parameter." msgstr "新增 *durations* 關鍵字參數。" -#: ../../library/unittest.rst:2212 +#: ../../library/unittest.rst:2268 msgid "" "Instance of the :class:`TestLoader` class intended to be shared. If no " "customization of the :class:`TestLoader` is needed, this instance can be " "used instead of repeatedly creating new instances." msgstr "" -#: ../../library/unittest.rst:2221 +#: ../../library/unittest.rst:2277 msgid "" "A basic test runner implementation that outputs results to a stream. If " "*stream* is ``None``, the default, :data:`sys.stderr` is used as the output " @@ -3208,42 +3317,42 @@ msgid "" "unittest." msgstr "" -#: ../../library/unittest.rst:2228 +#: ../../library/unittest.rst:2284 msgid "" -"By default this runner shows :exc:`DeprecationWarning`, :exc:" -"`PendingDeprecationWarning`, :exc:`ResourceWarning` and :exc:`ImportWarning` " -"even if they are :ref:`ignored by default `. This behavior " -"can be overridden using Python's :option:`!-Wd` or :option:`!-Wa` options " -"(see :ref:`Warning control `) and leaving *warnings* to " -"``None``." +"By default this runner " +"shows :exc:`DeprecationWarning`, :exc:`PendingDeprecationWarning`, :exc:`ResourceWarning` " +"and :exc:`ImportWarning` even if they are :ref:`ignored by default `. This behavior can be overridden using Python's :option:`!-Wd` " +"or :option:`!-Wa` options (see :ref:`Warning control `) " +"and leaving *warnings* to ``None``." msgstr "" -#: ../../library/unittest.rst:2236 +#: ../../library/unittest.rst:2292 msgid "Added the *warnings* parameter." msgstr "新增 *warnings* 參數。" -#: ../../library/unittest.rst:2239 +#: ../../library/unittest.rst:2295 msgid "" "The default stream is set to :data:`sys.stderr` at instantiation time rather " "than import time." msgstr "" -#: ../../library/unittest.rst:2243 +#: ../../library/unittest.rst:2299 msgid "Added the *tb_locals* parameter." msgstr "新增 *tb_locals* 參數。" -#: ../../library/unittest.rst:2246 +#: ../../library/unittest.rst:2302 msgid "Added the *durations* parameter." msgstr "新增 *durations* 參數。" -#: ../../library/unittest.rst:2251 +#: ../../library/unittest.rst:2307 msgid "" "This method returns the instance of ``TestResult`` used by :meth:`run`. It " "is not intended to be called directly, but can be overridden in subclasses " "to provide a custom ``TestResult``." msgstr "" -#: ../../library/unittest.rst:2255 +#: ../../library/unittest.rst:2311 msgid "" "``_makeResult()`` instantiates the class or callable passed in the " "``TextTestRunner`` constructor as the ``resultclass`` argument. It defaults " @@ -3251,19 +3360,19 @@ msgid "" "class is instantiated with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2260 +#: ../../library/unittest.rst:2316 msgid "stream, descriptions, verbosity" msgstr "" -#: ../../library/unittest.rst:2264 +#: ../../library/unittest.rst:2320 msgid "" "This method is the main public interface to the ``TextTestRunner``. This " -"method takes a :class:`TestSuite` or :class:`TestCase` instance. A :class:" -"`TestResult` is created by calling :func:`_makeResult` and the test(s) are " -"run and the results printed to stdout." +"method takes a :class:`TestSuite` or :class:`TestCase` instance. " +"A :class:`TestResult` is created by calling :func:`_makeResult` and the " +"test(s) are run and the results printed to stdout." msgstr "" -#: ../../library/unittest.rst:2275 +#: ../../library/unittest.rst:2331 msgid "" "A command-line program that loads a set of tests from *module* and runs " "them; this is primarily for making test modules conveniently executable. The " @@ -3271,7 +3380,7 @@ msgid "" "of a test script::" msgstr "" -#: ../../library/unittest.rst:2280 +#: ../../library/unittest.rst:2336 msgid "" "if __name__ == '__main__':\n" " unittest.main()" @@ -3279,13 +3388,13 @@ msgstr "" "if __name__ == '__main__':\n" " unittest.main()" -#: ../../library/unittest.rst:2283 +#: ../../library/unittest.rst:2339 msgid "" "You can run tests with more detailed information by passing in the verbosity " "argument::" msgstr "" -#: ../../library/unittest.rst:2286 +#: ../../library/unittest.rst:2342 msgid "" "if __name__ == '__main__':\n" " unittest.main(verbosity=2)" @@ -3293,7 +3402,7 @@ msgstr "" "if __name__ == '__main__':\n" " unittest.main(verbosity=2)" -#: ../../library/unittest.rst:2289 +#: ../../library/unittest.rst:2345 msgid "" "The *defaultTest* argument is either the name of a single test or an " "iterable of test names to run if no test names are specified via *argv*. If " @@ -3301,14 +3410,14 @@ msgid "" "tests found in *module* are run." msgstr "" -#: ../../library/unittest.rst:2294 +#: ../../library/unittest.rst:2350 msgid "" "The *argv* argument can be a list of options passed to the program, with the " "first element being the program name. If not specified or ``None``, the " "values of :data:`sys.argv` are used." msgstr "" -#: ../../library/unittest.rst:2298 +#: ../../library/unittest.rst:2354 msgid "" "The *testRunner* argument can either be a test runner class or an already " "created instance of it. By default ``main`` calls :func:`sys.exit` with an " @@ -3316,20 +3425,20 @@ msgid "" "code of 5 indicates that no tests were run or skipped." msgstr "" -#: ../../library/unittest.rst:2303 +#: ../../library/unittest.rst:2359 msgid "" "The *testLoader* argument has to be a :class:`TestLoader` instance, and " "defaults to :data:`defaultTestLoader`." msgstr "" -#: ../../library/unittest.rst:2306 +#: ../../library/unittest.rst:2362 msgid "" "``main`` supports being used from the interactive interpreter by passing in " "the argument ``exit=False``. This displays the result on standard output " "without calling :func:`sys.exit`::" msgstr "" -#: ../../library/unittest.rst:2310 +#: ../../library/unittest.rst:2366 msgid "" ">>> from unittest import main\n" ">>> main(module='test_module', exit=False)" @@ -3337,13 +3446,13 @@ msgstr "" ">>> from unittest import main\n" ">>> main(module='test_module', exit=False)" -#: ../../library/unittest.rst:2313 +#: ../../library/unittest.rst:2369 msgid "" "The *failfast*, *catchbreak* and *buffer* parameters have the same effect as " "the same-name `command-line options`_." msgstr "" -#: ../../library/unittest.rst:2316 +#: ../../library/unittest.rst:2372 msgid "" "The *warnings* argument specifies the :ref:`warning filter ` " "that should be used while running the tests. If it's not specified, it will " @@ -3352,60 +3461,60 @@ msgid "" "to ``'default'``." msgstr "" -#: ../../library/unittest.rst:2322 +#: ../../library/unittest.rst:2378 msgid "" "Calling ``main`` returns an object with the ``result`` attribute that " "contains the result of the tests run as a :class:`unittest.TestResult`." msgstr "" -#: ../../library/unittest.rst:2325 +#: ../../library/unittest.rst:2381 msgid "The *exit* parameter was added." msgstr "新增 *exit* 參數。" -#: ../../library/unittest.rst:2328 +#: ../../library/unittest.rst:2384 msgid "" "The *verbosity*, *failfast*, *catchbreak*, *buffer* and *warnings* " "parameters were added." msgstr "" -#: ../../library/unittest.rst:2332 +#: ../../library/unittest.rst:2388 msgid "" "The *defaultTest* parameter was changed to also accept an iterable of test " "names." msgstr "" -#: ../../library/unittest.rst:2340 +#: ../../library/unittest.rst:2396 msgid "load_tests Protocol" msgstr "load_tests 協定" -#: ../../library/unittest.rst:2344 +#: ../../library/unittest.rst:2400 msgid "" "Modules or packages can customize how tests are loaded from them during " "normal test runs or test discovery by implementing a function called " "``load_tests``." msgstr "" -#: ../../library/unittest.rst:2347 +#: ../../library/unittest.rst:2403 msgid "" -"If a test module defines ``load_tests`` it will be called by :meth:" -"`TestLoader.loadTestsFromModule` with the following arguments::" +"If a test module defines ``load_tests`` it will be called " +"by :meth:`TestLoader.loadTestsFromModule` with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2350 ../../library/unittest.rst:2382 +#: ../../library/unittest.rst:2406 ../../library/unittest.rst:2438 msgid "load_tests(loader, standard_tests, pattern)" msgstr "load_tests(loader, standard_tests, pattern)" -#: ../../library/unittest.rst:2352 +#: ../../library/unittest.rst:2408 msgid "" "where *pattern* is passed straight through from ``loadTestsFromModule``. It " "defaults to ``None``." msgstr "" -#: ../../library/unittest.rst:2355 +#: ../../library/unittest.rst:2411 msgid "It should return a :class:`TestSuite`." msgstr "它應該回傳一個 :class:`TestSuite`。" -#: ../../library/unittest.rst:2357 +#: ../../library/unittest.rst:2413 msgid "" "*loader* is the instance of :class:`TestLoader` doing the loading. " "*standard_tests* are the tests that would be loaded by default from the " @@ -3414,13 +3523,13 @@ msgid "" "packages as part of test discovery." msgstr "" -#: ../../library/unittest.rst:2363 +#: ../../library/unittest.rst:2419 msgid "" -"A typical ``load_tests`` function that loads tests from a specific set of :" -"class:`TestCase` classes may look like::" +"A typical ``load_tests`` function that loads tests from a specific set " +"of :class:`TestCase` classes may look like::" msgstr "" -#: ../../library/unittest.rst:2366 +#: ../../library/unittest.rst:2422 msgid "" "test_cases = (TestCase1, TestCase2, TestCase3)\n" "\n" @@ -3440,31 +3549,32 @@ msgstr "" " suite.addTests(tests)\n" " return suite" -#: ../../library/unittest.rst:2375 +#: ../../library/unittest.rst:2431 msgid "" "If discovery is started in a directory containing a package, either from the " -"command line or by calling :meth:`TestLoader.discover`, then the package :" -"file:`__init__.py` will be checked for ``load_tests``. If that function " -"does not exist, discovery will recurse into the package as though it were " -"just another directory. Otherwise, discovery of the package's tests will be " -"left up to ``load_tests`` which is called with the following arguments::" +"command line or by calling :meth:`TestLoader.discover`, then the " +"package :file:`__init__.py` will be checked for ``load_tests``. If that " +"function does not exist, discovery will recurse into the package as though " +"it were just another directory. Otherwise, discovery of the package's tests " +"will be left up to ``load_tests`` which is called with the following " +"arguments::" msgstr "" -#: ../../library/unittest.rst:2384 +#: ../../library/unittest.rst:2440 msgid "" "This should return a :class:`TestSuite` representing all the tests from the " -"package. (``standard_tests`` will only contain tests collected from :file:" -"`__init__.py`.)" +"package. (``standard_tests`` will only contain tests collected " +"from :file:`__init__.py`.)" msgstr "" -#: ../../library/unittest.rst:2388 +#: ../../library/unittest.rst:2444 msgid "" "Because the pattern is passed into ``load_tests`` the package is free to " "continue (and potentially modify) test discovery. A 'do nothing' " "``load_tests`` function for a test package would look like::" msgstr "" -#: ../../library/unittest.rst:2392 +#: ../../library/unittest.rst:2448 msgid "" "def load_tests(loader, standard_tests, pattern):\n" " # top level directory cached on loader instance\n" @@ -3474,45 +3584,45 @@ msgid "" " return standard_tests" msgstr "" -#: ../../library/unittest.rst:2399 +#: ../../library/unittest.rst:2455 msgid "" "Discovery no longer checks package names for matching *pattern* due to the " "impossibility of package names matching the default pattern." msgstr "" -#: ../../library/unittest.rst:2406 +#: ../../library/unittest.rst:2462 msgid "Class and Module Fixtures" msgstr "" -#: ../../library/unittest.rst:2408 +#: ../../library/unittest.rst:2464 msgid "" "Class and module level fixtures are implemented in :class:`TestSuite`. When " "the test suite encounters a test from a new class then :meth:`tearDownClass` " -"from the previous class (if there is one) is called, followed by :meth:" -"`setUpClass` from the new class." +"from the previous class (if there is one) is called, followed " +"by :meth:`setUpClass` from the new class." msgstr "" -#: ../../library/unittest.rst:2413 +#: ../../library/unittest.rst:2469 msgid "" "Similarly if a test is from a different module from the previous test then " "``tearDownModule`` from the previous module is run, followed by " "``setUpModule`` from the new module." msgstr "" -#: ../../library/unittest.rst:2417 +#: ../../library/unittest.rst:2473 msgid "" "After all the tests have run the final ``tearDownClass`` and " "``tearDownModule`` are run." msgstr "" -#: ../../library/unittest.rst:2420 +#: ../../library/unittest.rst:2476 msgid "" "Note that shared fixtures do not play well with [potential] features like " "test parallelization and they break test isolation. They should be used with " "care." msgstr "" -#: ../../library/unittest.rst:2423 +#: ../../library/unittest.rst:2479 msgid "" "The default ordering of tests created by the unittest test loaders is to " "group all tests from the same modules and classes together. This will lead " @@ -3522,14 +3632,14 @@ msgid "" "functions may be called multiple times in a single test run." msgstr "" -#: ../../library/unittest.rst:2430 +#: ../../library/unittest.rst:2486 msgid "" "Shared fixtures are not intended to work with suites with non-standard " "ordering. A ``BaseTestSuite`` still exists for frameworks that don't want to " "support shared fixtures." msgstr "" -#: ../../library/unittest.rst:2434 +#: ../../library/unittest.rst:2490 msgid "" "If there are any exceptions raised during one of the shared fixture " "functions the test is reported as an error. Because there is no " @@ -3539,15 +3649,15 @@ msgid "" "matter, but if you are a framework author it may be relevant." msgstr "" -#: ../../library/unittest.rst:2443 +#: ../../library/unittest.rst:2499 msgid "setUpClass and tearDownClass" msgstr "setUpClass 和 tearDownClass" -#: ../../library/unittest.rst:2445 +#: ../../library/unittest.rst:2501 msgid "These must be implemented as class methods::" msgstr "" -#: ../../library/unittest.rst:2447 +#: ../../library/unittest.rst:2503 msgid "" "import unittest\n" "\n" @@ -3571,31 +3681,31 @@ msgstr "" " def tearDownClass(cls):\n" " cls._connection.destroy()" -#: ../../library/unittest.rst:2458 +#: ../../library/unittest.rst:2514 msgid "" "If you want the ``setUpClass`` and ``tearDownClass`` on base classes called " -"then you must call up to them yourself. The implementations in :class:" -"`TestCase` are empty." +"then you must call up to them yourself. The implementations " +"in :class:`TestCase` are empty." msgstr "" -#: ../../library/unittest.rst:2462 +#: ../../library/unittest.rst:2518 msgid "" "If an exception is raised during a ``setUpClass`` then the tests in the " "class are not run and the ``tearDownClass`` is not run. Skipped classes will " -"not have ``setUpClass`` or ``tearDownClass`` run. If the exception is a :exc:" -"`SkipTest` exception then the class will be reported as having been skipped " -"instead of as an error." +"not have ``setUpClass`` or ``tearDownClass`` run. If the exception is " +"a :exc:`SkipTest` exception then the class will be reported as having been " +"skipped instead of as an error." msgstr "" -#: ../../library/unittest.rst:2470 +#: ../../library/unittest.rst:2526 msgid "setUpModule and tearDownModule" msgstr "setUpModule 和 tearDownModule" -#: ../../library/unittest.rst:2476 +#: ../../library/unittest.rst:2532 msgid "These should be implemented as functions::" msgstr "" -#: ../../library/unittest.rst:2478 +#: ../../library/unittest.rst:2534 msgid "" "def setUpModule():\n" " createConnection()\n" @@ -3609,7 +3719,7 @@ msgstr "" "def tearDownModule():\n" " closeConnection()" -#: ../../library/unittest.rst:2484 +#: ../../library/unittest.rst:2540 msgid "" "If an exception is raised in a ``setUpModule`` then none of the tests in the " "module will be run and the ``tearDownModule`` will not be run. If the " @@ -3617,59 +3727,60 @@ msgid "" "having been skipped instead of as an error." msgstr "" -#: ../../library/unittest.rst:2489 +#: ../../library/unittest.rst:2545 msgid "" "To add cleanup code that must be run even in the case of an exception, use " "``addModuleCleanup``:" msgstr "" -#: ../../library/unittest.rst:2495 +#: ../../library/unittest.rst:2551 msgid "" "Add a function to be called after :func:`tearDownModule` to cleanup " "resources used during the test class. Functions will be called in reverse " "order to the order they are added (:abbr:`LIFO (last-in, first-out)`). They " -"are called with any arguments and keyword arguments passed into :meth:" -"`addModuleCleanup` when they are added." +"are called with any arguments and keyword arguments passed " +"into :meth:`addModuleCleanup` when they are added." msgstr "" -#: ../../library/unittest.rst:2501 +#: ../../library/unittest.rst:2557 msgid "" "If :meth:`setUpModule` fails, meaning that :func:`tearDownModule` is not " "called, then any cleanup functions added will still be called." msgstr "" -#: ../../library/unittest.rst:2509 +#: ../../library/unittest.rst:2565 msgid "" -"Enter the supplied :term:`context manager`. If successful, also add its :" -"meth:`~object.__exit__` method as a cleanup function by :func:" -"`addModuleCleanup` and return the result of the :meth:`~object.__enter__` " -"method." +"Enter the supplied :term:`context manager`. If successful, also add " +"its :meth:`~object.__exit__` method as a cleanup function " +"by :func:`addModuleCleanup` and return the result of " +"the :meth:`~object.__enter__` method." msgstr "" -#: ../../library/unittest.rst:2519 +#: ../../library/unittest.rst:2575 msgid "" "This function is called unconditionally after :func:`tearDownModule`, or " "after :func:`setUpModule` if :func:`setUpModule` raises an exception." msgstr "" -#: ../../library/unittest.rst:2522 +#: ../../library/unittest.rst:2578 msgid "" -"It is responsible for calling all the cleanup functions added by :func:" -"`addModuleCleanup`. If you need cleanup functions to be called *prior* to :" -"func:`tearDownModule` then you can call :func:`doModuleCleanups` yourself." +"It is responsible for calling all the cleanup functions added " +"by :func:`addModuleCleanup`. If you need cleanup functions to be called " +"*prior* to :func:`tearDownModule` then you can call :func:`doModuleCleanups` " +"yourself." msgstr "" -#: ../../library/unittest.rst:2527 +#: ../../library/unittest.rst:2583 msgid "" ":func:`doModuleCleanups` pops methods off the stack of cleanup functions one " "at a time, so it can be called at any time." msgstr "" -#: ../../library/unittest.rst:2534 +#: ../../library/unittest.rst:2590 msgid "Signal Handling" msgstr "" -#: ../../library/unittest.rst:2538 +#: ../../library/unittest.rst:2594 msgid "" "The :option:`-c/--catch ` command-line option to unittest, " "along with the ``catchbreak`` parameter to :func:`unittest.main`, provide " @@ -3679,60 +3790,60 @@ msgid "" "A second control-c will raise a :exc:`KeyboardInterrupt` in the usual way." msgstr "" -#: ../../library/unittest.rst:2545 +#: ../../library/unittest.rst:2601 msgid "" "The control-c handling signal handler attempts to remain compatible with " "code or tests that install their own :const:`signal.SIGINT` handler. If the " -"``unittest`` handler is called but *isn't* the installed :const:`signal." -"SIGINT` handler, i.e. it has been replaced by the system under test and " -"delegated to, then it calls the default handler. This will normally be the " -"expected behavior by code that replaces an installed handler and delegates " -"to it. For individual tests that need ``unittest`` control-c handling " -"disabled the :func:`removeHandler` decorator can be used." +"``unittest`` handler is called but *isn't* the " +"installed :const:`signal.SIGINT` handler, i.e. it has been replaced by the " +"system under test and delegated to, then it calls the default handler. This " +"will normally be the expected behavior by code that replaces an installed " +"handler and delegates to it. For individual tests that need ``unittest`` " +"control-c handling disabled the :func:`removeHandler` decorator can be used." msgstr "" -#: ../../library/unittest.rst:2554 +#: ../../library/unittest.rst:2610 msgid "" "There are a few utility functions for framework authors to enable control-c " "handling functionality within test frameworks." msgstr "" -#: ../../library/unittest.rst:2559 +#: ../../library/unittest.rst:2615 msgid "" "Install the control-c handler. When a :const:`signal.SIGINT` is received " "(usually in response to the user pressing control-c) all registered results " "have :meth:`~TestResult.stop` called." msgstr "" -#: ../../library/unittest.rst:2566 +#: ../../library/unittest.rst:2622 msgid "" "Register a :class:`TestResult` object for control-c handling. Registering a " "result stores a weak reference to it, so it doesn't prevent the result from " "being garbage collected." msgstr "" -#: ../../library/unittest.rst:2570 +#: ../../library/unittest.rst:2626 msgid "" "Registering a :class:`TestResult` object has no side-effects if control-c " "handling is not enabled, so test frameworks can unconditionally register all " "results they create independently of whether or not handling is enabled." msgstr "" -#: ../../library/unittest.rst:2577 +#: ../../library/unittest.rst:2633 msgid "" -"Remove a registered result. Once a result has been removed then :meth:" -"`~TestResult.stop` will no longer be called on that result object in " -"response to a control-c." +"Remove a registered result. Once a result has been removed " +"then :meth:`~TestResult.stop` will no longer be called on that result object " +"in response to a control-c." msgstr "" -#: ../../library/unittest.rst:2584 +#: ../../library/unittest.rst:2640 msgid "" "When called without arguments this function removes the control-c handler if " "it has been installed. This function can also be used as a test decorator to " "temporarily remove the handler while the test is being executed::" msgstr "" -#: ../../library/unittest.rst:2588 +#: ../../library/unittest.rst:2644 msgid "" "@unittest.removeHandler\n" "def test_signal_handling(self):\n" @@ -3741,3 +3852,20 @@ msgstr "" "@unittest.removeHandler\n" "def test_signal_handling(self):\n" " ..." + +#~ msgid "" +#~ "# proj/ <-- current directory\n" +#~ "# namespace/\n" +#~ "# mypkg/\n" +#~ "# __init__.py\n" +#~ "# test_mypkg.py\n" +#~ "\n" +#~ "python -m unittest discover -s namespace.mypkg -t ." +#~ msgstr "" +#~ "# proj/ <-- current directory\n" +#~ "# namespace/\n" +#~ "# mypkg/\n" +#~ "# __init__.py\n" +#~ "# test_mypkg.py\n" +#~ "\n" +#~ "python -m unittest discover -s namespace.mypkg -t ." diff --git a/library/urllib.parse.po b/library/urllib.parse.po index b5476ab9632..4d592117662 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-16 00:16+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -189,74 +189,74 @@ msgid "" "accessed by index or as named attributes, which are:" msgstr "" -#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 -#: ../../library/urllib.parse.rst:432 +#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:436 msgid "Attribute" msgstr "屬性" -#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 -#: ../../library/urllib.parse.rst:432 +#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:436 msgid "Index" msgstr "" -#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 -#: ../../library/urllib.parse.rst:432 +#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:436 msgid "Value" msgstr "" -#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 -#: ../../library/urllib.parse.rst:432 +#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:436 msgid "Value if not present" msgstr "" -#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:312 +#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:316 msgid ":attr:`scheme`" msgstr ":attr:`scheme`" -#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:312 -#: ../../library/urllib.parse.rst:434 +#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:316 +#: ../../library/urllib.parse.rst:438 msgid "0" msgstr "0" -#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:312 +#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:316 msgid "URL scheme specifier" msgstr "" -#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:312 +#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:316 msgid "*scheme* parameter" msgstr "" -#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:318 msgid ":attr:`netloc`" msgstr ":attr:`netloc`" -#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:314 -#: ../../library/urllib.parse.rst:436 +#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:318 +#: ../../library/urllib.parse.rst:440 msgid "1" msgstr "1" -#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:318 msgid "Network location part" msgstr "" #: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:127 #: ../../library/urllib.parse.rst:129 ../../library/urllib.parse.rst:132 -#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:314 -#: ../../library/urllib.parse.rst:316 ../../library/urllib.parse.rst:318 -#: ../../library/urllib.parse.rst:320 ../../library/urllib.parse.rst:434 -#: ../../library/urllib.parse.rst:436 +#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:318 +#: ../../library/urllib.parse.rst:320 ../../library/urllib.parse.rst:322 +#: ../../library/urllib.parse.rst:324 ../../library/urllib.parse.rst:438 +#: ../../library/urllib.parse.rst:440 msgid "empty string" msgstr "" -#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:316 +#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:320 msgid ":attr:`path`" msgstr ":attr:`path`" -#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:316 +#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:320 msgid "2" msgstr "2" -#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:316 +#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:320 msgid "Hierarchical path" msgstr "" @@ -264,7 +264,7 @@ msgstr "" msgid ":attr:`params`" msgstr ":attr:`params`" -#: ../../library/urllib.parse.rst:129 ../../library/urllib.parse.rst:318 +#: ../../library/urllib.parse.rst:129 ../../library/urllib.parse.rst:322 msgid "3" msgstr "3" @@ -272,20 +272,20 @@ msgstr "3" msgid "Parameters for last path element" msgstr "" -#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:318 +#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:322 msgid ":attr:`query`" msgstr ":attr:`query`" -#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:324 msgid "4" msgstr "4" -#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:318 +#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:322 msgid "Query component" msgstr "" -#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:320 -#: ../../library/urllib.parse.rst:436 +#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:324 +#: ../../library/urllib.parse.rst:440 msgid ":attr:`fragment`" msgstr ":attr:`fragment`" @@ -293,64 +293,64 @@ msgstr ":attr:`fragment`" msgid "5" msgstr "5" -#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:320 -#: ../../library/urllib.parse.rst:436 +#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:324 +#: ../../library/urllib.parse.rst:440 msgid "Fragment identifier" msgstr "" -#: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:322 +#: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:326 msgid ":attr:`username`" msgstr ":attr:`username`" -#: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:322 +#: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:326 msgid "User name" msgstr "" #: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:138 #: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:142 -#: ../../library/urllib.parse.rst:322 ../../library/urllib.parse.rst:324 #: ../../library/urllib.parse.rst:326 ../../library/urllib.parse.rst:328 +#: ../../library/urllib.parse.rst:330 ../../library/urllib.parse.rst:332 msgid ":const:`None`" msgstr ":const:`None`" -#: ../../library/urllib.parse.rst:138 ../../library/urllib.parse.rst:324 +#: ../../library/urllib.parse.rst:138 ../../library/urllib.parse.rst:328 msgid ":attr:`password`" msgstr ":attr:`password`" -#: ../../library/urllib.parse.rst:138 ../../library/urllib.parse.rst:324 +#: ../../library/urllib.parse.rst:138 ../../library/urllib.parse.rst:328 msgid "Password" msgstr "" -#: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:326 +#: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:330 msgid ":attr:`hostname`" msgstr ":attr:`hostname`" -#: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:326 +#: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:330 msgid "Host name (lower case)" msgstr "" -#: ../../library/urllib.parse.rst:142 ../../library/urllib.parse.rst:328 +#: ../../library/urllib.parse.rst:142 ../../library/urllib.parse.rst:332 msgid ":attr:`port`" msgstr ":attr:`port`" -#: ../../library/urllib.parse.rst:142 ../../library/urllib.parse.rst:328 +#: ../../library/urllib.parse.rst:142 ../../library/urllib.parse.rst:332 msgid "Port number as integer, if present" msgstr "" -#: ../../library/urllib.parse.rst:146 ../../library/urllib.parse.rst:332 +#: ../../library/urllib.parse.rst:146 ../../library/urllib.parse.rst:336 msgid "" "Reading the :attr:`port` attribute will raise a :exc:`ValueError` if an " "invalid port is specified in the URL. See section :ref:`urlparse-result-" "object` for more information on the result object." msgstr "" -#: ../../library/urllib.parse.rst:150 ../../library/urllib.parse.rst:336 +#: ../../library/urllib.parse.rst:150 ../../library/urllib.parse.rst:340 msgid "" "Unmatched square brackets in the :attr:`netloc` attribute will raise " "a :exc:`ValueError`." msgstr "" -#: ../../library/urllib.parse.rst:153 ../../library/urllib.parse.rst:339 +#: ../../library/urllib.parse.rst:153 ../../library/urllib.parse.rst:343 msgid "" "Characters in the :attr:`netloc` attribute that decompose under NFKC " "normalization (as used by the IDNA encoding) into any of ``/``, ``?``, " @@ -407,13 +407,13 @@ msgid "" "that support fragments existed." msgstr "" -#: ../../library/urllib.parse.rst:188 ../../library/urllib.parse.rst:353 +#: ../../library/urllib.parse.rst:188 ../../library/urllib.parse.rst:357 msgid "" "Out-of-range port numbers now raise :exc:`ValueError`, instead of " "returning :const:`None`." msgstr "" -#: ../../library/urllib.parse.rst:192 ../../library/urllib.parse.rst:357 +#: ../../library/urllib.parse.rst:192 ../../library/urllib.parse.rst:361 msgid "" "Characters that affect netloc parsing under NFKC normalization will now " "raise :exc:`ValueError`." @@ -427,7 +427,7 @@ msgid "" "values are lists of values for each name." msgstr "" -#: ../../library/urllib.parse.rst:204 ../../library/urllib.parse.rst:249 +#: ../../library/urllib.parse.rst:204 ../../library/urllib.parse.rst:253 msgid "" "The optional argument *keep_blank_values* is a flag indicating whether blank " "values in percent-encoded queries should be treated as blank strings. A true " @@ -436,28 +436,28 @@ msgid "" "treated as if they were not included." msgstr "" -#: ../../library/urllib.parse.rst:210 ../../library/urllib.parse.rst:255 +#: ../../library/urllib.parse.rst:210 ../../library/urllib.parse.rst:259 msgid "" "The optional argument *strict_parsing* is a flag indicating what to do with " "parsing errors. If false (the default), errors are silently ignored. If " "true, errors raise a :exc:`ValueError` exception." msgstr "" -#: ../../library/urllib.parse.rst:214 ../../library/urllib.parse.rst:259 +#: ../../library/urllib.parse.rst:214 ../../library/urllib.parse.rst:263 msgid "" "The optional *encoding* and *errors* parameters specify how to decode " "percent-encoded sequences into Unicode characters, as accepted by " "the :meth:`bytes.decode` method." msgstr "" -#: ../../library/urllib.parse.rst:218 ../../library/urllib.parse.rst:263 +#: ../../library/urllib.parse.rst:218 ../../library/urllib.parse.rst:267 msgid "" "The optional argument *max_num_fields* is the maximum number of fields to " "read. If set, then throws a :exc:`ValueError` if there are more than " "*max_num_fields* fields read." msgstr "" -#: ../../library/urllib.parse.rst:222 ../../library/urllib.parse.rst:267 +#: ../../library/urllib.parse.rst:222 ../../library/urllib.parse.rst:271 msgid "" "The optional argument *separator* is the symbol to use for separating the " "query arguments. It defaults to ``&``." @@ -469,15 +469,15 @@ msgid "" "parameter set to ``True``) to convert such dictionaries into query strings." msgstr "" -#: ../../library/urllib.parse.rst:230 ../../library/urllib.parse.rst:273 +#: ../../library/urllib.parse.rst:230 ../../library/urllib.parse.rst:277 msgid "Add *encoding* and *errors* parameters." msgstr "新增 *encoding* 和 *errors* 參數。" -#: ../../library/urllib.parse.rst:233 ../../library/urllib.parse.rst:276 +#: ../../library/urllib.parse.rst:233 ../../library/urllib.parse.rst:280 msgid "Added *max_num_fields* parameter." msgstr "新增 *max_num_fields* 參數。" -#: ../../library/urllib.parse.rst:236 ../../library/urllib.parse.rst:279 +#: ../../library/urllib.parse.rst:236 ../../library/urllib.parse.rst:283 msgid "" "Added *separator* parameter with the default value of ``&``. Python versions " "earlier than Python 3.10 allowed using both ``;`` and ``&`` as query " @@ -485,20 +485,26 @@ msgid "" "key, with ``&`` as the default separator." msgstr "" -#: ../../library/urllib.parse.rst:245 +#: ../../library/urllib.parse.rst:242 ../../library/urllib.parse.rst:761 +msgid "" +"Accepting objects with false values (like ``0`` and ``[]``) except empty " +"strings and byte-like objects and ``None`` is now deprecated." +msgstr "" + +#: ../../library/urllib.parse.rst:249 msgid "" "Parse a query string given as a string argument (data of " "type :mimetype:`application/x-www-form-urlencoded`). Data are returned as a " "list of name, value pairs." msgstr "" -#: ../../library/urllib.parse.rst:270 +#: ../../library/urllib.parse.rst:274 msgid "" "Use the :func:`urllib.parse.urlencode` function to convert such lists of " "pairs into query strings." msgstr "" -#: ../../library/urllib.parse.rst:288 +#: ../../library/urllib.parse.rst:292 msgid "" "Construct a URL from a tuple as returned by ``urlparse()``. The *parts* " "argument can be any six-item iterable. This may result in a slightly " @@ -507,7 +513,7 @@ msgid "" "states that these are equivalent)." msgstr "" -#: ../../library/urllib.parse.rst:297 +#: ../../library/urllib.parse.rst:301 msgid "" "This is similar to :func:`urlparse`, but does not split the params from the " "URL. This should generally be used instead of :func:`urlparse` if the more " @@ -517,41 +523,41 @@ msgid "" "returns a 5-item :term:`named tuple`::" msgstr "" -#: ../../library/urllib.parse.rst:304 +#: ../../library/urllib.parse.rst:308 msgid "" "(addressing scheme, network location, path, query, fragment identifier)." msgstr "" "(addressing scheme, network location, path, query, fragment identifier)." -#: ../../library/urllib.parse.rst:306 ../../library/urllib.parse.rst:428 +#: ../../library/urllib.parse.rst:310 ../../library/urllib.parse.rst:432 msgid "" "The return value is a :term:`named tuple`, its items can be accessed by " "index or as named attributes:" msgstr "" -#: ../../library/urllib.parse.rst:344 +#: ../../library/urllib.parse.rst:348 msgid "" "Following some of the `WHATWG spec`_ that updates RFC 3986, leading C0 " "control and space characters are stripped from the URL. ``\\n``, ``\\r`` and " "tab ``\\t`` characters are removed from the URL at any position." msgstr "" -#: ../../library/urllib.parse.rst:350 +#: ../../library/urllib.parse.rst:354 msgid "" ":func:`urlsplit` does not perform validation. See :ref:`URL parsing " "security ` for details." msgstr "" -#: ../../library/urllib.parse.rst:361 +#: ../../library/urllib.parse.rst:365 msgid "ASCII newline and tab characters are stripped from the URL." msgstr "" -#: ../../library/urllib.parse.rst:364 +#: ../../library/urllib.parse.rst:368 msgid "" "Leading WHATWG C0 control and space characters are stripped from the URL." msgstr "" -#: ../../library/urllib.parse.rst:371 +#: ../../library/urllib.parse.rst:375 msgid "" "Combine the elements of a tuple as returned by :func:`urlsplit` into a " "complete URL as a string. The *parts* argument can be any five-item " @@ -560,7 +566,7 @@ msgid "" "a ? with an empty query; the RFC states that these are equivalent)." msgstr "" -#: ../../library/urllib.parse.rst:380 +#: ../../library/urllib.parse.rst:384 msgid "" "Construct a full (\"absolute\") URL by combining a \"base URL\" (*base*) " "with another URL (*url*). Informally, this uses components of the base URL, " @@ -568,20 +574,20 @@ msgid "" "path, to provide missing components in the relative URL. For example:" msgstr "" -#: ../../library/urllib.parse.rst:389 +#: ../../library/urllib.parse.rst:393 msgid "" "The *allow_fragments* argument has the same meaning and default as " "for :func:`urlparse`." msgstr "" -#: ../../library/urllib.parse.rst:394 +#: ../../library/urllib.parse.rst:398 msgid "" "If *url* is an absolute URL (that is, it starts with ``//`` or ``scheme://" "``), the *url*'s hostname and/or scheme will be present in the result. For " "example:" msgstr "" -#: ../../library/urllib.parse.rst:397 +#: ../../library/urllib.parse.rst:401 msgid "" ">>> urljoin('http://www.cwi.nl/%7Eguido/Python.html',\n" "... '//www.python.org/%7Eguido')\n" @@ -591,13 +597,13 @@ msgstr "" "... '//www.python.org/%7Eguido')\n" "'http://www.python.org/%7Eguido'" -#: ../../library/urllib.parse.rst:403 +#: ../../library/urllib.parse.rst:407 msgid "" "If you do not want that behavior, preprocess the *url* with :func:`urlsplit` " "and :func:`urlunsplit`, removing possible *scheme* and *netloc* parts." msgstr "" -#: ../../library/urllib.parse.rst:408 +#: ../../library/urllib.parse.rst:412 msgid "" "Because an absolute URL may be passed as the ``url`` parameter, it is " "generally **not secure** to use ``urljoin`` with an attacker-controlled " @@ -606,11 +612,11 @@ msgid "" "``urljoin`` will be the absolute URL." msgstr "" -#: ../../library/urllib.parse.rst:418 +#: ../../library/urllib.parse.rst:422 msgid "Behavior updated to match the semantics defined in :rfc:`3986`." msgstr "" -#: ../../library/urllib.parse.rst:423 +#: ../../library/urllib.parse.rst:427 msgid "" "If *url* contains a fragment identifier, return a modified version of *url* " "with no fragment identifier, and the fragment identifier as a separate " @@ -618,25 +624,25 @@ msgid "" "unmodified and an empty string." msgstr "" -#: ../../library/urllib.parse.rst:434 +#: ../../library/urllib.parse.rst:438 msgid ":attr:`url`" msgstr ":attr:`url`" -#: ../../library/urllib.parse.rst:434 +#: ../../library/urllib.parse.rst:438 msgid "URL with no fragment" msgstr "" -#: ../../library/urllib.parse.rst:439 +#: ../../library/urllib.parse.rst:443 msgid "" "See section :ref:`urlparse-result-object` for more information on the result " "object." msgstr "" -#: ../../library/urllib.parse.rst:442 +#: ../../library/urllib.parse.rst:446 msgid "Result is a structured object rather than a simple 2-tuple." msgstr "" -#: ../../library/urllib.parse.rst:447 +#: ../../library/urllib.parse.rst:451 msgid "" "Extract the url from a wrapped URL (that is, a string formatted as " "````, ````, ``URL:scheme://host/" @@ -644,11 +650,11 @@ msgid "" "returned without changes." msgstr "" -#: ../../library/urllib.parse.rst:455 +#: ../../library/urllib.parse.rst:459 msgid "URL parsing security" msgstr "" -#: ../../library/urllib.parse.rst:457 +#: ../../library/urllib.parse.rst:461 msgid "" "The :func:`urlsplit` and :func:`urlparse` APIs do not perform **validation** " "of inputs. They may not raise errors on inputs that other applications " @@ -657,14 +663,14 @@ msgid "" "rather than purity." msgstr "" -#: ../../library/urllib.parse.rst:463 +#: ../../library/urllib.parse.rst:467 msgid "" "Instead of raising an exception on unusual input, they may instead return " "some component parts as empty strings. Or components may contain more than " "perhaps they should." msgstr "" -#: ../../library/urllib.parse.rst:467 +#: ../../library/urllib.parse.rst:471 msgid "" "We recommend that users of these APIs where the values may be used anywhere " "with security implications code defensively. Do some verification within " @@ -673,7 +679,7 @@ msgid "" "that ``hostname``? etc." msgstr "" -#: ../../library/urllib.parse.rst:473 +#: ../../library/urllib.parse.rst:477 msgid "" "What constitutes a URL is not universally well defined. Different " "applications have different needs and desired constraints. For instance the " @@ -685,11 +691,11 @@ msgid "" "API behavior changes." msgstr "" -#: ../../library/urllib.parse.rst:484 +#: ../../library/urllib.parse.rst:488 msgid "Parsing ASCII Encoded Bytes" msgstr "" -#: ../../library/urllib.parse.rst:486 +#: ../../library/urllib.parse.rst:490 msgid "" "The URL parsing functions were originally designed to operate on character " "strings only. In practice, it is useful to be able to manipulate properly " @@ -698,14 +704,14 @@ msgid "" "and :class:`bytearray` objects in addition to :class:`str` objects." msgstr "" -#: ../../library/urllib.parse.rst:492 +#: ../../library/urllib.parse.rst:496 msgid "" "If :class:`str` data is passed in, the result will also contain " "only :class:`str` data. If :class:`bytes` or :class:`bytearray` data is " "passed in, the result will contain only :class:`bytes` data." msgstr "" -#: ../../library/urllib.parse.rst:496 +#: ../../library/urllib.parse.rst:500 msgid "" "Attempting to mix :class:`str` data with :class:`bytes` " "or :class:`bytearray` in a single function call will result in " @@ -713,7 +719,7 @@ msgid "" "values will trigger :exc:`UnicodeDecodeError`." msgstr "" -#: ../../library/urllib.parse.rst:501 +#: ../../library/urllib.parse.rst:505 msgid "" "To support easier conversion of result objects between :class:`str` " "and :class:`bytes`, all return values from URL parsing functions provide " @@ -727,14 +733,14 @@ msgid "" "methods)." msgstr "" -#: ../../library/urllib.parse.rst:512 +#: ../../library/urllib.parse.rst:516 msgid "" "Applications that need to operate on potentially improperly quoted URLs that " "may contain non-ASCII data will need to do their own decoding from bytes to " "characters before invoking the URL parsing methods." msgstr "" -#: ../../library/urllib.parse.rst:516 +#: ../../library/urllib.parse.rst:520 msgid "" "The behaviour described in this section applies only to the URL parsing " "functions. The URL quoting functions use their own rules when producing or " @@ -742,15 +748,15 @@ msgid "" "URL quoting functions." msgstr "" -#: ../../library/urllib.parse.rst:521 +#: ../../library/urllib.parse.rst:525 msgid "URL parsing functions now accept ASCII encoded byte sequences" msgstr "" -#: ../../library/urllib.parse.rst:528 +#: ../../library/urllib.parse.rst:532 msgid "Structured Parse Results" msgstr "" -#: ../../library/urllib.parse.rst:530 +#: ../../library/urllib.parse.rst:534 msgid "" "The result objects from the :func:`urlparse`, :func:`urlsplit` " "and :func:`urldefrag` functions are subclasses of the :class:`tuple` type. " @@ -759,7 +765,7 @@ msgid "" "section, as well as an additional method:" msgstr "" -#: ../../library/urllib.parse.rst:538 +#: ../../library/urllib.parse.rst:542 msgid "" "Return the re-combined version of the original URL as a string. This may " "differ from the original URL in that the scheme may be normalized to lower " @@ -767,72 +773,72 @@ msgid "" "queries, and fragment identifiers will be removed." msgstr "" -#: ../../library/urllib.parse.rst:543 +#: ../../library/urllib.parse.rst:547 msgid "" "For :func:`urldefrag` results, only empty fragment identifiers will be " "removed. For :func:`urlsplit` and :func:`urlparse` results, all noted " "changes will be made to the URL returned by this method." msgstr "" -#: ../../library/urllib.parse.rst:547 +#: ../../library/urllib.parse.rst:551 msgid "" "The result of this method remains unchanged if passed back through the " "original parsing function:" msgstr "" -#: ../../library/urllib.parse.rst:560 +#: ../../library/urllib.parse.rst:564 msgid "" "The following classes provide the implementations of the structured parse " "results when operating on :class:`str` objects:" msgstr "" -#: ../../library/urllib.parse.rst:565 +#: ../../library/urllib.parse.rst:569 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`DefragResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:573 +#: ../../library/urllib.parse.rst:577 msgid "" "Concrete class for :func:`urlparse` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`ParseResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:579 +#: ../../library/urllib.parse.rst:583 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`SplitResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:584 +#: ../../library/urllib.parse.rst:588 msgid "" "The following classes provide the implementations of the parse results when " "operating on :class:`bytes` or :class:`bytearray` objects:" msgstr "" -#: ../../library/urllib.parse.rst:589 +#: ../../library/urllib.parse.rst:593 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`DefragResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:597 +#: ../../library/urllib.parse.rst:601 msgid "" "Concrete class for :func:`urlparse` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`ParseResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:605 +#: ../../library/urllib.parse.rst:609 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`SplitResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:613 +#: ../../library/urllib.parse.rst:617 msgid "URL Quoting" msgstr "" -#: ../../library/urllib.parse.rst:615 +#: ../../library/urllib.parse.rst:619 msgid "" "The URL quoting functions focus on taking program data and making it safe " "for use as URL components by quoting special characters and appropriately " @@ -841,7 +847,7 @@ msgid "" "isn't already covered by the URL parsing functions above." msgstr "" -#: ../../library/urllib.parse.rst:623 +#: ../../library/urllib.parse.rst:627 msgid "" "Replace special characters in *string* using the :samp:`%{xx}` escape. " "Letters, digits, and the characters ``'_.-~'`` are never quoted. By default, " @@ -850,18 +856,18 @@ msgid "" "not be quoted --- its default value is ``'/'``." msgstr "" -#: ../../library/urllib.parse.rst:629 ../../library/urllib.parse.rst:675 -#: ../../library/urllib.parse.rst:704 +#: ../../library/urllib.parse.rst:633 ../../library/urllib.parse.rst:679 +#: ../../library/urllib.parse.rst:708 msgid "*string* may be either a :class:`str` or a :class:`bytes` object." msgstr "" -#: ../../library/urllib.parse.rst:631 +#: ../../library/urllib.parse.rst:635 msgid "" "Moved from :rfc:`2396` to :rfc:`3986` for quoting URL strings. \"~\" is now " "included in the set of unreserved characters." msgstr "" -#: ../../library/urllib.parse.rst:635 +#: ../../library/urllib.parse.rst:639 msgid "" "The optional *encoding* and *errors* parameters specify how to deal with non-" "ASCII characters, as accepted by the :meth:`str.encode` method. *encoding* " @@ -871,17 +877,17 @@ msgid "" "a :class:`TypeError` is raised." msgstr "" -#: ../../library/urllib.parse.rst:643 +#: ../../library/urllib.parse.rst:647 msgid "" "Note that ``quote(string, safe, encoding, errors)`` is equivalent to " "``quote_from_bytes(string.encode(encoding, errors), safe)``." msgstr "" -#: ../../library/urllib.parse.rst:646 +#: ../../library/urllib.parse.rst:650 msgid "Example: ``quote('/El Niño/')`` yields ``'/El%20Ni%C3%B1o/'``." msgstr "" -#: ../../library/urllib.parse.rst:651 +#: ../../library/urllib.parse.rst:655 msgid "" "Like :func:`quote`, but also replace spaces with plus signs, as required for " "quoting HTML form values when building up a query string to go into a URL. " @@ -889,21 +895,21 @@ msgid "" "*safe*. It also does not have *safe* default to ``'/'``." msgstr "" -#: ../../library/urllib.parse.rst:656 +#: ../../library/urllib.parse.rst:660 msgid "Example: ``quote_plus('/El Niño/')`` yields ``'%2FEl+Ni%C3%B1o%2F'``." msgstr "" -#: ../../library/urllib.parse.rst:661 +#: ../../library/urllib.parse.rst:665 msgid "" "Like :func:`quote`, but accepts a :class:`bytes` object rather than " "a :class:`str`, and does not perform string-to-bytes encoding." msgstr "" -#: ../../library/urllib.parse.rst:664 +#: ../../library/urllib.parse.rst:668 msgid "Example: ``quote_from_bytes(b'a&\\xef')`` yields ``'a%26%EF'``." msgstr "" -#: ../../library/urllib.parse.rst:670 +#: ../../library/urllib.parse.rst:674 msgid "" "Replace :samp:`%{xx}` escapes with their single-character equivalent. The " "optional *encoding* and *errors* parameters specify how to decode percent-" @@ -911,52 +917,52 @@ msgid "" "the :meth:`bytes.decode` method." msgstr "" -#: ../../library/urllib.parse.rst:677 +#: ../../library/urllib.parse.rst:681 msgid "" "*encoding* defaults to ``'utf-8'``. *errors* defaults to ``'replace'``, " "meaning invalid sequences are replaced by a placeholder character." msgstr "" -#: ../../library/urllib.parse.rst:681 +#: ../../library/urllib.parse.rst:685 msgid "Example: ``unquote('/El%20Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "" -#: ../../library/urllib.parse.rst:683 +#: ../../library/urllib.parse.rst:687 msgid "" "*string* parameter supports bytes and str objects (previously only str)." msgstr "" -#: ../../library/urllib.parse.rst:691 +#: ../../library/urllib.parse.rst:695 msgid "" "Like :func:`unquote`, but also replace plus signs with spaces, as required " "for unquoting HTML form values." msgstr "" -#: ../../library/urllib.parse.rst:694 +#: ../../library/urllib.parse.rst:698 msgid "*string* must be a :class:`str`." msgstr "" -#: ../../library/urllib.parse.rst:696 +#: ../../library/urllib.parse.rst:700 msgid "Example: ``unquote_plus('/El+Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "" -#: ../../library/urllib.parse.rst:701 +#: ../../library/urllib.parse.rst:705 msgid "" "Replace :samp:`%{xx}` escapes with their single-octet equivalent, and return " "a :class:`bytes` object." msgstr "" -#: ../../library/urllib.parse.rst:706 +#: ../../library/urllib.parse.rst:710 msgid "" "If it is a :class:`str`, unescaped non-ASCII characters in *string* are " "encoded into UTF-8 bytes." msgstr "" -#: ../../library/urllib.parse.rst:709 +#: ../../library/urllib.parse.rst:713 msgid "Example: ``unquote_to_bytes('a%26%EF')`` yields ``b'a&\\xef'``." msgstr "" -#: ../../library/urllib.parse.rst:715 +#: ../../library/urllib.parse.rst:719 msgid "" "Convert a mapping object or a sequence of two-element tuples, which may " "contain :class:`str` or :class:`bytes` objects, to a percent-encoded ASCII " @@ -965,7 +971,7 @@ msgid "" "be encoded to bytes, otherwise it would result in a :exc:`TypeError`." msgstr "" -#: ../../library/urllib.parse.rst:722 +#: ../../library/urllib.parse.rst:726 msgid "" "The resulting string is a series of ``key=value`` pairs separated by ``'&'`` " "characters, where both *key* and *value* are quoted using the *quote_via* " @@ -978,7 +984,7 @@ msgid "" "``quote`` and specify a value for *safe*." msgstr "" -#: ../../library/urllib.parse.rst:732 +#: ../../library/urllib.parse.rst:736 msgid "" "When a sequence of two-element tuples is used as the *query* argument, the " "first element of each tuple is a key and the second is a value. The value " @@ -989,49 +995,49 @@ msgid "" "order of parameter tuples in the sequence." msgstr "" -#: ../../library/urllib.parse.rst:740 +#: ../../library/urllib.parse.rst:744 msgid "" "The *safe*, *encoding*, and *errors* parameters are passed down to " "*quote_via* (the *encoding* and *errors* parameters are only passed when a " "query element is a :class:`str`)." msgstr "" -#: ../../library/urllib.parse.rst:744 +#: ../../library/urllib.parse.rst:748 msgid "" "To reverse this encoding process, :func:`parse_qs` and :func:`parse_qsl` are " "provided in this module to parse query strings into Python data structures." msgstr "" -#: ../../library/urllib.parse.rst:747 +#: ../../library/urllib.parse.rst:751 msgid "" "Refer to :ref:`urllib examples ` to find out how " "the :func:`urllib.parse.urlencode` method can be used for generating the " "query string of a URL or data for a POST request." msgstr "" -#: ../../library/urllib.parse.rst:751 +#: ../../library/urllib.parse.rst:755 msgid "*query* supports bytes and string objects." msgstr "" -#: ../../library/urllib.parse.rst:754 +#: ../../library/urllib.parse.rst:758 msgid "Added the *quote_via* parameter." msgstr "新增 *quote_via* 參數。" -#: ../../library/urllib.parse.rst:760 +#: ../../library/urllib.parse.rst:768 msgid "`WHATWG`_ - URL Living standard" msgstr "" -#: ../../library/urllib.parse.rst:761 +#: ../../library/urllib.parse.rst:769 msgid "" "Working Group for the URL Standard that defines URLs, domains, IP addresses, " "the application/x-www-form-urlencoded format, and their API." msgstr "" -#: ../../library/urllib.parse.rst:764 +#: ../../library/urllib.parse.rst:772 msgid ":rfc:`3986` - Uniform Resource Identifiers" msgstr "" -#: ../../library/urllib.parse.rst:765 +#: ../../library/urllib.parse.rst:773 msgid "" "This is the current standard (STD66). Any changes to urllib.parse module " "should conform to this. Certain deviations could be observed, which are " @@ -1039,49 +1045,49 @@ msgid "" "requirements as commonly observed in major browsers." msgstr "" -#: ../../library/urllib.parse.rst:770 +#: ../../library/urllib.parse.rst:778 msgid ":rfc:`2732` - Format for Literal IPv6 Addresses in URL's." msgstr "" -#: ../../library/urllib.parse.rst:771 +#: ../../library/urllib.parse.rst:779 msgid "This specifies the parsing requirements of IPv6 URLs." msgstr "" -#: ../../library/urllib.parse.rst:773 +#: ../../library/urllib.parse.rst:781 msgid ":rfc:`2396` - Uniform Resource Identifiers (URI): Generic Syntax" msgstr "" -#: ../../library/urllib.parse.rst:774 +#: ../../library/urllib.parse.rst:782 msgid "" "Document describing the generic syntactic requirements for both Uniform " "Resource Names (URNs) and Uniform Resource Locators (URLs)." msgstr "" -#: ../../library/urllib.parse.rst:777 +#: ../../library/urllib.parse.rst:785 msgid ":rfc:`2368` - The mailto URL scheme." msgstr "" -#: ../../library/urllib.parse.rst:778 +#: ../../library/urllib.parse.rst:786 msgid "Parsing requirements for mailto URL schemes." msgstr "" -#: ../../library/urllib.parse.rst:780 +#: ../../library/urllib.parse.rst:788 msgid ":rfc:`1808` - Relative Uniform Resource Locators" msgstr "" ":rfc:`1808` - 相對的統一資源定位器 (Relative Uniform Resource Locators)" -#: ../../library/urllib.parse.rst:781 +#: ../../library/urllib.parse.rst:789 msgid "" "This Request For Comments includes the rules for joining an absolute and a " "relative URL, including a fair number of \"Abnormal Examples\" which govern " "the treatment of border cases." msgstr "" -#: ../../library/urllib.parse.rst:785 +#: ../../library/urllib.parse.rst:793 msgid ":rfc:`1738` - Uniform Resource Locators (URL)" msgstr ":rfc:`1738` - 統一資源定位器 (URL, Uniform Resource Locators)" -#: ../../library/urllib.parse.rst:786 +#: ../../library/urllib.parse.rst:794 msgid "This specifies the formal syntax and semantics of absolute URLs." msgstr "" diff --git a/library/urllib.request.po b/library/urllib.request.po index b3f58efff70..8e30b3bd0be 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-04 00:19+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-04-21 17:59+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,8 +42,8 @@ msgid "" "The `Requests package `_ is " "recommended for a higher-level HTTP client interface." msgstr "" -"有關於更高階的 HTTP 用戶端介面,推薦使用 `Requests 套件 `_。" +"有關於更高階的 HTTP 用戶端介面,推薦使用 `Requests 套件 `_。" #: ../../library/urllib.request.rst:26 msgid "" @@ -74,8 +74,8 @@ msgid "" "Open *url*, which can be either a string containing a valid, properly " "encoded URL, or a :class:`Request` object." msgstr "" -"打開 *url*,其值可以是一個包含有效且適當編碼 URL 的字串或是一個 :class:" -"`Request` 物件。" +"打開 *url*,其值可以是一個包含有效且適當編碼 URL 的字串或是一" +"個 :class:`Request` 物件。" #: ../../library/urllib.request.rst:42 msgid "" @@ -108,8 +108,8 @@ msgstr "" #: ../../library/urllib.request.rst:54 msgid "" "If *context* is specified, it must be a :class:`ssl.SSLContext` instance " -"describing the various SSL options. See :class:`~http.client." -"HTTPSConnection` for more details." +"describing the various SSL options. " +"See :class:`~http.client.HTTPSConnection` for more details." msgstr "" "若 *context* 有被指定時,它必須是一個 :class:`ssl.SSLContext` 的實例並描述著" "各種 SSL 選項。更多細節請見 :class:`~http.client.HTTPSConnection`。" @@ -117,140 +117,141 @@ msgstr "" #: ../../library/urllib.request.rst:58 msgid "" "This function always returns an object which can work as a :term:`context " -"manager` and has the properties *url*, *headers*, and *status*. See :class:" -"`urllib.response.addinfourl` for more detail on these properties." +"manager` and has the properties *url*, *headers*, and *status*. " +"See :class:`urllib.response.addinfourl` for more detail on these properties." msgstr "" "這個函式總是回傳一個可作為 :term:`context manager` 使用的物件,並有著特性 " -"(property) *url*、*headers* 與 *status*。欲知更多這些特性細節請參見 :class:" -"`urllib.response.addinfourl`。" +"(property) *url*、*headers* 與 *status*。欲知更多這些特性細節請參" +"見 :class:`urllib.response.addinfourl`。" #: ../../library/urllib.request.rst:62 msgid "" -"For HTTP and HTTPS URLs, this function returns a :class:`http.client." -"HTTPResponse` object slightly modified. In addition to the three new methods " -"above, the msg attribute contains the same information as the :attr:`~http." -"client.HTTPResponse.reason` attribute --- the reason phrase returned by " -"server --- instead of the response headers as it is specified in the " -"documentation for :class:`~http.client.HTTPResponse`." +"For HTTP and HTTPS URLs, this function returns " +"a :class:`http.client.HTTPResponse` object slightly modified. In addition to " +"the three new methods above, the msg attribute contains the same information " +"as the :attr:`~http.client.HTTPResponse.reason` attribute --- the reason " +"phrase returned by server --- instead of the response headers as it is " +"specified in the documentation for :class:`~http.client.HTTPResponse`." msgstr "" -"對於 HTTP 與 HTTPS 的 URLs,這個函式回傳一個稍有不同的 :class:`http.client." -"HTTPResponse` 物件。除了上述提到的三個方法外,另有 msg 屬性並有著與 :attr:" -"`~http.client.HTTPResponse.reason` 相同的資訊 --- 由伺服器回傳的原因敘述 " -"(reason phrase),而不是在 :class:`~http.client.HTTPResponse` 文件中提到的回" -"應 headers。" +"對於 HTTP 與 HTTPS 的 URLs,這個函式回傳一個稍有不同" +"的 :class:`http.client.HTTPResponse` 物件。除了上述提到的三個方法外,另有 " +"msg 屬性並有著與 :attr:`~http.client.HTTPResponse.reason` 相同的資訊 --- 由伺" +"服器回傳的原因敘述 (reason phrase),而不是" +"在 :class:`~http.client.HTTPResponse` 文件中提到的回應 headers。" #: ../../library/urllib.request.rst:70 +#, fuzzy msgid "" -"For FTP, file, and data URLs and requests explicitly handled by legacy :" -"class:`URLopener` and :class:`FancyURLopener` classes, this function returns " +"For FTP, file, and data URLs, this function returns " "a :class:`urllib.response.addinfourl` object." msgstr "" -"對於 FTP、檔案、資料的 URLs、以及那些由傳統 classes :class:`URLopener` 與 :" -"class:`FancyURLopener` 所處理的請求,這個函式會回傳一個 :class:`urllib." -"response.addinfourl` 物件。" +"對於 FTP、檔案、資料的 URLs、以及那些由傳統 classes :class:`URLopener` " +"與 :class:`FancyURLopener` 所處理的請求,這個函式會回傳一" +"個 :class:`urllib.response.addinfourl` 物件。" -#: ../../library/urllib.request.rst:74 +#: ../../library/urllib.request.rst:73 msgid "Raises :exc:`~urllib.error.URLError` on protocol errors." msgstr "當遇到協定上的錯誤時會引發 :exc:`~urllib.error.URLError`。" -#: ../../library/urllib.request.rst:76 +#: ../../library/urllib.request.rst:75 msgid "" "Note that ``None`` may be returned if no handler handles the request (though " -"the default installed global :class:`OpenerDirector` uses :class:" -"`UnknownHandler` to ensure this never happens)." +"the default installed global :class:`OpenerDirector` " +"uses :class:`UnknownHandler` to ensure this never happens)." msgstr "" "請注意若沒有 handler 處理請求時,``None`` 值將會被回傳。(即使有預設的全域類" "別 :class:`OpenerDirector` 使用 :class:`UnknownHandler` 來確保這種情況不會發" "生)" -#: ../../library/urllib.request.rst:80 +#: ../../library/urllib.request.rst:79 msgid "" "In addition, if proxy settings are detected (for example, when a ``*_proxy`` " -"environment variable like :envvar:`!http_proxy` is set), :class:" -"`ProxyHandler` is default installed and makes sure the requests are handled " -"through the proxy." +"environment variable like :envvar:`!http_proxy` is " +"set), :class:`ProxyHandler` is default installed and makes sure the requests " +"are handled through the proxy." msgstr "" "另外,若有偵測到代理服務的設定(例如當 ``*_proxy`` 環境變數像是::envvar:!" "http_proxy` 有被設置時),:class:`ProxyHandler` 會被預設使用以確保請求有透過" "代理服務來處理。" -#: ../../library/urllib.request.rst:85 +#: ../../library/urllib.request.rst:84 msgid "" "The legacy ``urllib.urlopen`` function from Python 2.6 and earlier has been " "discontinued; :func:`urllib.request.urlopen` corresponds to the old " "``urllib2.urlopen``. Proxy handling, which was done by passing a dictionary " -"parameter to ``urllib.urlopen``, can be obtained by using :class:" -"`ProxyHandler` objects." +"parameter to ``urllib.urlopen``, can be obtained by " +"using :class:`ProxyHandler` objects." msgstr "" -"Python 2.6 或更早版本的遺留函式 ``urllib.urlopen`` 已經不再被維護;新函式 :" -"func:`urllib.request.urlopen` 對應到舊函式 ``urllib2.urlopen``。有關代理服務" -"的處理,以往是透過傳遞 dictionary(字典)參數給 ``urllib.urlopen`` 來取得的," -"現在則可以透過 :class:`ProxyHandler` 物件來取得。" +"Python 2.6 或更早版本的遺留函式 ``urllib.urlopen`` 已經不再被維護;新函" +"式 :func:`urllib.request.urlopen` 對應到舊函式 ``urllib2.urlopen``。有關代理" +"服務的處理,以往是透過傳遞 dictionary(字典)參數給 ``urllib.urlopen`` 來取得" +"的,現在則可以透過 :class:`ProxyHandler` 物件來取得。" -#: ../../library/urllib.request.rst:91 ../../library/urllib.request.rst:93 +#: ../../library/urllib.request.rst:90 ../../library/urllib.request.rst:92 msgid "" -"The default opener raises an :ref:`auditing event ` ``urllib." -"Request`` with arguments ``fullurl``, ``data``, ``headers``, ``method`` " -"taken from the request object." +"The default opener raises an :ref:`auditing event ` " +"``urllib.Request`` with arguments ``fullurl``, ``data``, ``headers``, " +"``method`` taken from the request object." msgstr "" "預設的 opener 會觸發一個 :ref:`auditing event ` ``urllib.Request`` " "與其從請求物件中所獲得的引數 ``fullurl``、``data``、``headers``、``method``。" -#: ../../library/urllib.request.rst:97 +#: ../../library/urllib.request.rst:96 msgid "*cafile* and *capath* were added." msgstr "新增 *cafile* 與 *capath*。" -#: ../../library/urllib.request.rst:100 +#: ../../library/urllib.request.rst:99 msgid "" -"HTTPS virtual hosts are now supported if possible (that is, if :const:`ssl." -"HAS_SNI` is true)." +"HTTPS virtual hosts are now supported if possible (that is, " +"if :const:`ssl.HAS_SNI` is true)." msgstr "" "HTTPS 虛擬主機 (virtual hosts) 現已支援,只要 :const:`ssl.HAS_SNI` 的值為 " "true。" -#: ../../library/urllib.request.rst:103 +#: ../../library/urllib.request.rst:102 msgid "*data* can be an iterable object." msgstr "*data* 可以是一個可疊代物件。" -#: ../../library/urllib.request.rst:105 +#: ../../library/urllib.request.rst:104 msgid "*cadefault* was added." msgstr "*cadefault* 被新增。" -#: ../../library/urllib.request.rst:108 +#: ../../library/urllib.request.rst:107 msgid "*context* was added." msgstr "*context* 被新增。" -#: ../../library/urllib.request.rst:111 +#: ../../library/urllib.request.rst:110 msgid "" -"HTTPS connection now send an ALPN extension with protocol indicator " -"``http/1.1`` when no *context* is given. Custom *context* should set ALPN " -"protocols with :meth:`~ssl.SSLContext.set_alpn_protocols`." +"HTTPS connection now send an ALPN extension with protocol indicator ``http/" +"1.1`` when no *context* is given. Custom *context* should set ALPN protocols " +"with :meth:`~ssl.SSLContext.set_alpn_protocols`." msgstr "" -"當 *context* 沒有被指定時,HTTPS 連線現在會傳送一個帶有協定指示器 " -"``http/1.1`` 的 ALPN 擴充 (extension)。自訂的 *context* 應該利用 :meth:`~ssl." -"SSLContext.set_alpn_protocols` 來自行設定 ALPN 協定。" +"當 *context* 沒有被指定時,HTTPS 連線現在會傳送一個帶有協定指示器 ``http/" +"1.1`` 的 ALPN 擴充 (extension)。自訂的 *context* 應該利" +"用 :meth:`~ssl.SSLContext.set_alpn_protocols` 來自行設定 ALPN 協定。" -#: ../../library/urllib.request.rst:116 +#: ../../library/urllib.request.rst:115 msgid "" "Remove *cafile*, *capath* and *cadefault* parameters: use the *context* " "parameter instead." msgstr "" -#: ../../library/urllib.request.rst:123 +#: ../../library/urllib.request.rst:122 msgid "" "Install an :class:`OpenerDirector` instance as the default global opener. " "Installing an opener is only necessary if you want urlopen to use that " -"opener; otherwise, simply call :meth:`OpenerDirector.open` instead of :func:" -"`~urllib.request.urlopen`. The code does not check for a real :class:" -"`OpenerDirector`, and any class with the appropriate interface will work." +"opener; otherwise, simply call :meth:`OpenerDirector.open` instead " +"of :func:`~urllib.request.urlopen`. The code does not check for a " +"real :class:`OpenerDirector`, and any class with the appropriate interface " +"will work." msgstr "" "安裝一個 :class:`OpenerDirector` 實例作為預設的全域 opener。僅在當你想要讓 " -"urlopen 使用該 opener 時安裝一個 opener,否則的話應直接呼叫 :meth:" -"`OpenerDirector.open` 而非 :func:`~urllib.request.urlopen`。程式碼不會檢查 " -"class 是否真的為 :class:`OpenerDirector`,而是任何具有正確介面的 class 都能適" -"用。" +"urlopen 使用該 opener 時安裝一個 opener,否則的話應直接呼" +"叫 :meth:`OpenerDirector.open` 而非 :func:`~urllib.request.urlopen`。程式碼不" +"會檢查 class 是否真的為 :class:`OpenerDirector`,而是任何具有正確介面的 " +"class 都能適用。" -#: ../../library/urllib.request.rst:133 +#: ../../library/urllib.request.rst:132 msgid "" "Return an :class:`OpenerDirector` instance, which chains the handlers in the " "order given. *handler*\\s can be either instances of :class:`BaseHandler`, " @@ -258,21 +259,17 @@ msgid "" "call the constructor without any parameters). Instances of the following " "classes will be in front of the *handler*\\s, unless the *handler*\\s " "contain them, instances of them or subclasses of them: :class:`ProxyHandler` " -"(if proxy settings are detected), :class:`UnknownHandler`, :class:" -"`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:" -"`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :class:" -"`HTTPErrorProcessor`." +"(if proxy settings are " +"detected), :class:`UnknownHandler`, :class:`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :class:`HTTPErrorProcessor`." msgstr "" "回傳一個 :class:`OpenerDirector` 實例,以給定的順序把 handlers 串接起來。" "*handler*\\s 可以是 :class:`BaseHandler` 的實例,亦或是 :class:`BaseHandler` " "的 subclasses(這個情況下必須有不帶參數的建構函式能夠被呼叫)。以下 classes " "的實例順位會在 *handler*\\s 之前,除非 *handler*\\s 已經包含它們,是它們的實" "例,或是它們的 subclasses::class:`ProxyHandler`\\ (如果代理服務設定被偵測" -"到)、:class:`UnknownHandler`、:class:`HTTPHandler`、:class:" -"`HTTPDefaultErrorHandler`、:class:`HTTPRedirectHandler`、:class:" -"`FTPHandler`、:class:`FileHandler`、:class:`HTTPErrorProcessor`。" +"到)、:class:`UnknownHandler`、:class:`HTTPHandler`、:class:`HTTPDefaultErrorHandler`、:class:`HTTPRedirectHandler`、:class:`FTPHandler`、:class:`FileHandler`、:class:`HTTPErrorProcessor`。" -#: ../../library/urllib.request.rst:143 +#: ../../library/urllib.request.rst:142 msgid "" "If the Python installation has SSL support (i.e., if the :mod:`ssl` module " "can be imported), :class:`HTTPSHandler` will also be added." @@ -280,7 +277,7 @@ msgstr "" "如果 Python 安裝時已帶有 SSL 支援(如果 :mod:`ssl` module 能夠被 import)," "則 :class:`HTTPSHandler` 也在上述 class 之中。" -#: ../../library/urllib.request.rst:146 +#: ../../library/urllib.request.rst:145 msgid "" "A :class:`BaseHandler` subclass may also change its :attr:`handler_order` " "attribute to modify its position in the handlers list." @@ -288,19 +285,28 @@ msgstr "" "一個 :class:`BaseHandler` 的 subclass 可能透過改變其 :attr:`handler_order` 屬" "性來調整它在 handlers list 中的位置。" -#: ../../library/urllib.request.rst:152 +#: ../../library/urllib.request.rst:151 msgid "" -"Convert the given local path to a ``file:`` URL. This function uses :func:" -"`~urllib.parse.quote` function to encode the path. For historical reasons, " -"the return value omits the ``file:`` scheme prefix. This example shows the " -"function being used on Windows::" +"Convert the given local path to a ``file:`` URL. This function " +"uses :func:`~urllib.parse.quote` function to encode the path." msgstr "" -#: ../../library/urllib.request.rst:157 +#: ../../library/urllib.request.rst:154 +msgid "" +"If *add_scheme* is false (the default), the return value omits the ``file:`` " +"scheme prefix. Set *add_scheme* to true to return a complete URL." +msgstr "" + +#: ../../library/urllib.request.rst:157 ../../library/urllib.request.rst:195 +msgid "This example shows the function being used on Windows::" +msgstr "" + +#: ../../library/urllib.request.rst:159 +#, fuzzy msgid "" ">>> from urllib.request import pathname2url\n" ">>> path = 'C:\\\\Program Files'\n" -">>> 'file:' + pathname2url(path)\n" +">>> pathname2url(path, add_scheme=True)\n" "'file:///C:/Program%20Files'" msgstr "" ">>> from urllib.request import pathname2url\n" @@ -308,19 +314,54 @@ msgstr "" ">>> 'file:' + pathname2url(path)\n" "'file:///C:/Program%20Files'" -#: ../../library/urllib.request.rst:165 +#: ../../library/urllib.request.rst:164 ../../library/urllib.request.rst:202 msgid "" -"Convert the given ``file:`` URL to a local path. This function uses :func:" -"`~urllib.parse.unquote` to decode the URL. For historical reasons, the given " -"value *must* omit the ``file:`` scheme prefix. This example shows the " -"function being used on Windows::" +"Windows drive letters are no longer converted to uppercase, and ``:`` " +"characters not following a drive letter no longer cause an :exc:`OSError` " +"exception to be raised on Windows." msgstr "" -#: ../../library/urllib.request.rst:170 +#: ../../library/urllib.request.rst:169 +msgid "" +"Paths beginning with a slash are converted to URLs with authority sections. " +"For example, the path ``/etc/hosts`` is converted to the URL ``///etc/" +"hosts``." +msgstr "" + +#: ../../library/urllib.request.rst:174 +msgid "The *add_scheme* parameter was added." +msgstr "" + +#: ../../library/urllib.request.rst:180 +msgid "" +"Convert the given ``file:`` URL to a local path. This function " +"uses :func:`~urllib.parse.unquote` to decode the URL." +msgstr "" + +#: ../../library/urllib.request.rst:183 +msgid "" +"If *require_scheme* is false (the default), the given value should omit a " +"``file:`` scheme prefix. If *require_scheme* is set to true, the given value " +"should include the prefix; a :exc:`~urllib.error.URLError` is raised if it " +"doesn't." +msgstr "" + +#: ../../library/urllib.request.rst:188 +msgid "" +"The URL authority is discarded if it is empty, ``localhost``, or the local " +"hostname. Otherwise, if *resolve_host* is set to true, the authority is " +"resolved using :func:`socket.gethostbyname` and discarded if it matches a " +"local IP address (as per :rfc:`RFC 8089 §3 <8089#section-3>`). If the " +"authority is still unhandled, then on Windows a UNC path is returned, and on " +"other platforms a :exc:`~urllib.error.URLError` is raised." +msgstr "" + +#: ../../library/urllib.request.rst:197 +#, fuzzy msgid "" ">>> from urllib.request import url2pathname\n" ">>> url = 'file:///C:/Program%20Files'\n" -">>> url2pathname(url.removeprefix('file:'))\n" +">>> url2pathname(url, require_scheme=True)\n" "'C:\\\\Program Files'" msgstr "" ">>> from urllib.request import url2pathname\n" @@ -328,7 +369,23 @@ msgstr "" ">>> url2pathname(url.removeprefix('file:'))\n" "'C:\\\\Program Files'" -#: ../../library/urllib.request.rst:177 +#: ../../library/urllib.request.rst:207 +msgid "" +"The URL authority is discarded if it matches the local hostname. Otherwise, " +"if the authority isn't empty or ``localhost``, then on Windows a UNC path is " +"returned (as before), and on other platforms a :exc:`~urllib.error.URLError` " +"is raised." +msgstr "" + +#: ../../library/urllib.request.rst:213 +msgid "The URL query and fragment components are discarded if present." +msgstr "" + +#: ../../library/urllib.request.rst:216 +msgid "The *require_scheme* and *resolve_host* parameters were added." +msgstr "" + +#: ../../library/urllib.request.rst:222 msgid "" "This helper function returns a dictionary of scheme to proxy server URL " "mappings. It scans the environment for variables named ``_proxy``, " @@ -343,7 +400,7 @@ msgstr "" "Configuration) 或是 Windows 系統中的 Windows Systems Registry 尋找代理服務設" "定。如果大小寫的環境變數同時存在且值有不同,小寫的環境變數會被選用。" -#: ../../library/urllib.request.rst:187 +#: ../../library/urllib.request.rst:232 msgid "" "If the environment variable ``REQUEST_METHOD`` is set, which usually " "indicates your script is running in a CGI environment, the environment " @@ -360,19 +417,19 @@ msgstr "" "``ProxyHandler``,亦或是確認變數名稱是小寫的(或至少 ``_proxy`` 後綴是小寫" "的)。" -#: ../../library/urllib.request.rst:196 +#: ../../library/urllib.request.rst:241 msgid "The following classes are provided:" msgstr "提供了以下的 classes:" -#: ../../library/urllib.request.rst:200 +#: ../../library/urllib.request.rst:245 msgid "This class is an abstraction of a URL request." msgstr "這個 class 是一個 URL 請求的抽象 class。" -#: ../../library/urllib.request.rst:202 +#: ../../library/urllib.request.rst:247 msgid "*url* should be a string containing a valid, properly encoded URL." msgstr "*url* 是一個包含有效且適當編碼的 URL 字串。" -#: ../../library/urllib.request.rst:204 +#: ../../library/urllib.request.rst:249 msgid "" "*data* must be an object specifying additional data to send to the server, " "or ``None`` if no such data is needed. Currently HTTP requests are the only " @@ -393,25 +450,25 @@ msgstr "" "``Transfer-Encoding: chunked`` 則會被用來傳送檔案或是其它可疊代物件 " "(iterables)。" -#: ../../library/urllib.request.rst:214 +#: ../../library/urllib.request.rst:259 msgid "" -"For an HTTP POST request method, *data* should be a buffer in the standard :" -"mimetype:`application/x-www-form-urlencoded` format. The :func:`urllib." -"parse.urlencode` function takes a mapping or sequence of 2-tuples and " -"returns an ASCII string in this format. It should be encoded to bytes before " -"being used as the *data* parameter." +"For an HTTP POST request method, *data* should be a buffer in the " +"standard :mimetype:`application/x-www-form-urlencoded` format. " +"The :func:`urllib.parse.urlencode` function takes a mapping or sequence of 2-" +"tuples and returns an ASCII string in this format. It should be encoded to " +"bytes before being used as the *data* parameter." msgstr "" "對於一個 HTTP POST 請求方法,*data* 應為一個標準 :mimetype:`application/x-" "www-form-urlencoded` 格式的 buffer。:func:`urllib.parse.urlencode` 方法接受一" "個 mapping 或是 sequence(序列)的 2-tuples,並回傳一個對應格式的 ASCII 字" "串。在被作為 *data* 參數前它應該被編碼成位元組串。" -#: ../../library/urllib.request.rst:220 +#: ../../library/urllib.request.rst:265 msgid "" -"*headers* should be a dictionary, and will be treated as if :meth:" -"`add_header` was called with each key and value as arguments. This is often " -"used to \"spoof\" the ``User-Agent`` header value, which is used by a " -"browser to identify itself -- some HTTP servers only allow requests coming " +"*headers* should be a dictionary, and will be treated as " +"if :meth:`add_header` was called with each key and value as arguments. This " +"is often used to \"spoof\" the ``User-Agent`` header value, which is used by " +"a browser to identify itself -- some HTTP servers only allow requests coming " "from common browsers as opposed to scripts. For example, Mozilla Firefox may " "identify itself as ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 " "Firefox/2.0.0.11\"``, while :mod:`urllib`'s default user agent string is " @@ -422,12 +479,11 @@ msgstr "" "叫 :meth:`add_header`。經常用於「偽裝」 ``User-Agent`` header 的值,這個 " "header 是用來讓一個瀏覽器向伺服器表明自己的身分 --- 有些 HTTP 伺服器僅允許來" "自普通瀏覽器的請求,而不接受來自程式腳本的請求。例如,Mozilla Firefox 會將 " -"header 的值設為 ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 " -"Firefox/2.0.0.11\"``,而 :mod:`urllib` 的值則是 ``\"Python-urllib/2.6\"``\\ " -"(在 Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳" -"送。" +"header 的值設為 ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/" +"2.0.0.11\"``,而 :mod:`urllib` 的值則是 ``\"Python-urllib/2.6\"``\\ (在 " +"Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳送。" -#: ../../library/urllib.request.rst:231 +#: ../../library/urllib.request.rst:276 msgid "" "An appropriate ``Content-Type`` header should be included if the *data* " "argument is present. If this header has not been provided and *data* is not " @@ -438,28 +494,28 @@ msgstr "" "個 header 沒有被提供且 *data* 也不為 ``None`` 時,預設值 ``Content-Type: " "application/x-www-form-urlencoded`` 會被新增至請求中。" -#: ../../library/urllib.request.rst:236 +#: ../../library/urllib.request.rst:281 msgid "" "The next two arguments are only of interest for correct handling of third-" "party HTTP cookies:" msgstr "" "接下來的兩個引數的介紹提供給那些有興趣正確處理第三方 HTTP cookies 的使用者:" -#: ../../library/urllib.request.rst:239 +#: ../../library/urllib.request.rst:284 msgid "" "*origin_req_host* should be the request-host of the origin transaction, as " -"defined by :rfc:`2965`. It defaults to ``http.cookiejar." -"request_host(self)``. This is the host name or IP address of the original " -"request that was initiated by the user. For example, if the request is for " -"an image in an HTML document, this should be the request-host of the request " -"for the page containing the image." +"defined by :rfc:`2965`. It defaults to " +"``http.cookiejar.request_host(self)``. This is the host name or IP address " +"of the original request that was initiated by the user. For example, if the " +"request is for an image in an HTML document, this should be the request-host " +"of the request for the page containing the image." msgstr "" -"*origin_req_host* 應為原始傳輸互動的請求主機 (request-host),如同在 :rfc:" -"`2965` 中的定義。預設值為 ``http.cookiejar.request_host(self)``。這是使用者發" -"起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中的一個影" -"像,則這個屬性應為請求包含影像頁面的請求主機。" +"*origin_req_host* 應為原始傳輸互動的請求主機 (request-host),如同" +"在 :rfc:`2965` 中的定義。預設值為 ``http.cookiejar.request_host(self)``。這是" +"使用者發起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中" +"的一個影像,則這個屬性應為請求包含影像頁面的請求主機。" -#: ../../library/urllib.request.rst:247 +#: ../../library/urllib.request.rst:292 msgid "" "*unverifiable* should indicate whether the request is unverifiable, as " "defined by :rfc:`2965`. It defaults to ``False``. An unverifiable request " @@ -472,14 +528,14 @@ msgstr "" "URL,例如一個對於 HTML 文件中的影像所做的請求,而使用者沒有機會去批准是否能自" "動擷取影像,則這個值應該為 true。" -#: ../../library/urllib.request.rst:254 +#: ../../library/urllib.request.rst:299 msgid "" "*method* should be a string that indicates the HTTP request method that will " -"be used (e.g. ``'HEAD'``). If provided, its value is stored in the :attr:" -"`~Request.method` attribute and is used by :meth:`get_method`. The default " -"is ``'GET'`` if *data* is ``None`` or ``'POST'`` otherwise. Subclasses may " -"indicate a different default method by setting the :attr:`~Request.method` " -"attribute in the class itself." +"be used (e.g. ``'HEAD'``). If provided, its value is stored in " +"the :attr:`~Request.method` attribute and is used by :meth:`get_method`. The " +"default is ``'GET'`` if *data* is ``None`` or ``'POST'`` otherwise. " +"Subclasses may indicate a different default method by setting " +"the :attr:`~Request.method` attribute in the class itself." msgstr "" "*method* 應為一個標示 HTTP 請求方法的字串(例如:``'HEAD'``)。如果有提供值," "則會被存在 :attr:`~Request.method` 屬性中且被 :meth:`get_method` 所使用。當 " @@ -487,7 +543,7 @@ msgstr "" "Subclasses 可以透過設置其 :attr:`~Request.method` 屬性來設定不一樣的預設請求" "方法。" -#: ../../library/urllib.request.rst:262 +#: ../../library/urllib.request.rst:307 msgid "" "The request will not work as expected if the data object is unable to " "deliver its content more than once (e.g. a file or an iterable that can " @@ -501,15 +557,15 @@ msgstr "" "新嘗試傳送,則該請求不會正常運作。*data* 會接在 headers 之後被送至 HTTP 伺服" "器。此函式庫沒有支援 100-continue expectation。" -#: ../../library/urllib.request.rst:269 +#: ../../library/urllib.request.rst:314 msgid ":attr:`Request.method` argument is added to the Request class." msgstr "新增 :attr:`Request.method` 引數到 Request class。" -#: ../../library/urllib.request.rst:272 +#: ../../library/urllib.request.rst:317 msgid "Default :attr:`Request.method` may be indicated at the class level." msgstr "能夠在 class 中設置預設的 :attr:`Request.method`。" -#: ../../library/urllib.request.rst:275 +#: ../../library/urllib.request.rst:320 msgid "" "Do not raise an error if the ``Content-Length`` has not been provided and " "*data* is neither ``None`` nor a bytes object. Fall back to use chunked " @@ -519,34 +575,34 @@ msgstr "" "串物件,則不會觸發錯誤,並 fall back(後備)使用分塊傳輸編碼 (chunked " "transfer encoding)。" -#: ../../library/urllib.request.rst:282 +#: ../../library/urllib.request.rst:327 msgid "" "The :class:`OpenerDirector` class opens URLs via :class:`BaseHandler`\\ s " "chained together. It manages the chaining of handlers, and recovery from " "errors." msgstr "" -#: ../../library/urllib.request.rst:288 +#: ../../library/urllib.request.rst:333 msgid "" "This is the base class for all registered handlers --- and handles only the " "simple mechanics of registration." msgstr "" -#: ../../library/urllib.request.rst:294 +#: ../../library/urllib.request.rst:339 msgid "" "A class which defines a default handler for HTTP error responses; all " "responses are turned into :exc:`~urllib.error.HTTPError` exceptions." msgstr "" -#: ../../library/urllib.request.rst:300 +#: ../../library/urllib.request.rst:345 msgid "A class to handle redirections." msgstr "" -#: ../../library/urllib.request.rst:305 +#: ../../library/urllib.request.rst:350 msgid "A class to handle HTTP Cookies." msgstr "" -#: ../../library/urllib.request.rst:310 +#: ../../library/urllib.request.rst:355 msgid "" "Cause requests to go through a proxy. If *proxies* is given, it must be a " "dictionary mapping protocol names to URLs of proxies. The default is to read " @@ -557,11 +613,11 @@ msgid "" "Configuration Framework." msgstr "" -#: ../../library/urllib.request.rst:318 +#: ../../library/urllib.request.rst:363 msgid "To disable autodetected proxy pass an empty dictionary." msgstr "" -#: ../../library/urllib.request.rst:320 +#: ../../library/urllib.request.rst:365 msgid "" "The :envvar:`no_proxy` environment variable can be used to specify hosts " "which shouldn't be reached via proxy; if set, it should be a comma-separated " @@ -569,24 +625,24 @@ msgid "" "``cern.ch,ncsa.uiuc.edu,some.host:8080``." msgstr "" -#: ../../library/urllib.request.rst:327 +#: ../../library/urllib.request.rst:372 msgid "" "``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; see " "the documentation on :func:`~urllib.request.getproxies`." msgstr "" -#: ../../library/urllib.request.rst:333 +#: ../../library/urllib.request.rst:378 msgid "Keep a database of ``(realm, uri) -> (user, password)`` mappings." msgstr "" -#: ../../library/urllib.request.rst:338 +#: ../../library/urllib.request.rst:383 msgid "" "Keep a database of ``(realm, uri) -> (user, password)`` mappings. A realm " "of ``None`` is considered a catch-all realm, which is searched if no other " "realm fits." msgstr "" -#: ../../library/urllib.request.rst:345 +#: ../../library/urllib.request.rst:390 msgid "" "A variant of :class:`HTTPPasswordMgrWithDefaultRealm` that also has a " "database of ``uri -> is_authenticated`` mappings. Can be used by a " @@ -594,13 +650,13 @@ msgid "" "immediately instead of waiting for a ``401`` response first." msgstr "" -#: ../../library/urllib.request.rst:355 +#: ../../library/urllib.request.rst:400 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " -"that is compatible with :class:`HTTPPasswordMgr`; refer to section :ref:" -"`http-password-mgr` for information on the interface that must be " -"supported. If *passwd_mgr* also provides ``is_authenticated`` and " +"that is compatible with :class:`HTTPPasswordMgr`; refer to " +"section :ref:`http-password-mgr` for information on the interface that must " +"be supported. If *passwd_mgr* also provides ``is_authenticated`` and " "``update_authenticated`` methods (see :ref:`http-password-mgr-with-prior-" "auth`), then the handler will use the ``is_authenticated`` result for a " "given URI to determine whether or not to send authentication credentials " @@ -613,11 +669,11 @@ msgid "" "will automatically include the authentication credentials." msgstr "" -#: ../../library/urllib.request.rst:372 +#: ../../library/urllib.request.rst:417 msgid "Added ``is_authenticated`` support." msgstr "新增 ``is_authenticated`` 的支援。" -#: ../../library/urllib.request.rst:378 +#: ../../library/urllib.request.rst:423 msgid "" "Handle authentication with the remote host. *password_mgr*, if given, should " "be something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -626,7 +682,7 @@ msgid "" "presented with a wrong Authentication scheme." msgstr "" -#: ../../library/urllib.request.rst:387 ../../library/urllib.request.rst:421 +#: ../../library/urllib.request.rst:432 ../../library/urllib.request.rst:469 msgid "" "Handle authentication with the proxy. *password_mgr*, if given, should be " "something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -634,15 +690,20 @@ msgid "" "be supported." msgstr "" -#: ../../library/urllib.request.rst:395 +#: ../../library/urllib.request.rst:440 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " -"that is compatible with :class:`HTTPPasswordMgr`; refer to section :ref:" -"`http-password-mgr` for information on the interface that must be supported." +"that is compatible with :class:`HTTPPasswordMgr`; refer to " +"section :ref:`http-password-mgr` for information on the interface that must " +"be supported." +msgstr "" + +#: ../../library/urllib.request.rst:446 +msgid "Added support for HTTP digest authentication algorithm ``SHA-256``." msgstr "" -#: ../../library/urllib.request.rst:404 +#: ../../library/urllib.request.rst:452 msgid "" "Handle authentication with the remote host. *password_mgr*, if given, should " "be something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -655,108 +716,108 @@ msgid "" "Digest or Basic." msgstr "" -#: ../../library/urllib.request.rst:414 +#: ../../library/urllib.request.rst:462 msgid "Raise :exc:`ValueError` on unsupported Authentication Scheme." msgstr "" -#: ../../library/urllib.request.rst:429 +#: ../../library/urllib.request.rst:477 msgid "A class to handle opening of HTTP URLs." msgstr "" -#: ../../library/urllib.request.rst:434 +#: ../../library/urllib.request.rst:482 msgid "" "A class to handle opening of HTTPS URLs. *context* and *check_hostname* " "have the same meaning as in :class:`http.client.HTTPSConnection`." msgstr "" -#: ../../library/urllib.request.rst:437 +#: ../../library/urllib.request.rst:485 msgid "*context* and *check_hostname* were added." msgstr "新增 *context* 與 *check_hostname*。" -#: ../../library/urllib.request.rst:443 +#: ../../library/urllib.request.rst:491 msgid "Open local files." msgstr "" -#: ../../library/urllib.request.rst:447 +#: ../../library/urllib.request.rst:495 msgid "Open data URLs." msgstr "" -#: ../../library/urllib.request.rst:453 +#: ../../library/urllib.request.rst:501 msgid "Open FTP URLs." msgstr "打開 FTP URLs。" -#: ../../library/urllib.request.rst:458 +#: ../../library/urllib.request.rst:506 msgid "" "Open FTP URLs, keeping a cache of open FTP connections to minimize delays." msgstr "" -#: ../../library/urllib.request.rst:463 +#: ../../library/urllib.request.rst:511 msgid "A catch-all class to handle unknown URLs." msgstr "" -#: ../../library/urllib.request.rst:468 ../../library/urllib.request.rst:1177 +#: ../../library/urllib.request.rst:516 ../../library/urllib.request.rst:1225 msgid "Process HTTP error responses." msgstr "" -#: ../../library/urllib.request.rst:474 +#: ../../library/urllib.request.rst:522 msgid "Request Objects" msgstr "Request 物件" -#: ../../library/urllib.request.rst:476 +#: ../../library/urllib.request.rst:524 msgid "" "The following methods describe :class:`Request`'s public interface, and so " "all may be overridden in subclasses. It also defines several public " "attributes that can be used by clients to inspect the parsed request." msgstr "" -#: ../../library/urllib.request.rst:483 +#: ../../library/urllib.request.rst:531 msgid "The original URL passed to the constructor." msgstr "" -#: ../../library/urllib.request.rst:487 +#: ../../library/urllib.request.rst:535 msgid "" -"Request.full_url is a property with setter, getter and a deleter. Getting :" -"attr:`~Request.full_url` returns the original request URL with the fragment, " -"if it was present." +"Request.full_url is a property with setter, getter and a deleter. " +"Getting :attr:`~Request.full_url` returns the original request URL with the " +"fragment, if it was present." msgstr "" -#: ../../library/urllib.request.rst:493 +#: ../../library/urllib.request.rst:541 msgid "The URI scheme." msgstr "" -#: ../../library/urllib.request.rst:497 +#: ../../library/urllib.request.rst:545 msgid "" "The URI authority, typically a host, but may also contain a port separated " "by a colon." msgstr "" -#: ../../library/urllib.request.rst:502 +#: ../../library/urllib.request.rst:550 msgid "The original host for the request, without port." msgstr "" -#: ../../library/urllib.request.rst:506 +#: ../../library/urllib.request.rst:554 msgid "" "The URI path. If the :class:`Request` uses a proxy, then selector will be " "the full URL that is passed to the proxy." msgstr "" -#: ../../library/urllib.request.rst:511 +#: ../../library/urllib.request.rst:559 msgid "The entity body for the request, or ``None`` if not specified." msgstr "" -#: ../../library/urllib.request.rst:513 +#: ../../library/urllib.request.rst:561 msgid "" "Changing value of :attr:`Request.data` now deletes \"Content-Length\" header " "if it was previously set or calculated." msgstr "" -#: ../../library/urllib.request.rst:519 +#: ../../library/urllib.request.rst:567 msgid "" -"boolean, indicates whether the request is unverifiable as defined by :rfc:" -"`2965`." +"boolean, indicates whether the request is unverifiable as defined " +"by :rfc:`2965`." msgstr "" -#: ../../library/urllib.request.rst:524 +#: ../../library/urllib.request.rst:572 msgid "" "The HTTP request method to use. By default its value is :const:`None`, " "which means that :meth:`~Request.get_method` will do its normal computation " @@ -767,25 +828,25 @@ msgid "" "argument." msgstr "" -#: ../../library/urllib.request.rst:534 +#: ../../library/urllib.request.rst:582 msgid "" "A default value can now be set in subclasses; previously it could only be " "set via the constructor argument." msgstr "" -#: ../../library/urllib.request.rst:541 +#: ../../library/urllib.request.rst:589 msgid "" -"Return a string indicating the HTTP request method. If :attr:`Request." -"method` is not ``None``, return its value, otherwise return ``'GET'`` if :" -"attr:`Request.data` is ``None``, or ``'POST'`` if it's not. This is only " -"meaningful for HTTP requests." +"Return a string indicating the HTTP request method. " +"If :attr:`Request.method` is not ``None``, return its value, otherwise " +"return ``'GET'`` if :attr:`Request.data` is ``None``, or ``'POST'`` if it's " +"not. This is only meaningful for HTTP requests." msgstr "" -#: ../../library/urllib.request.rst:546 +#: ../../library/urllib.request.rst:594 msgid "get_method now looks at the value of :attr:`Request.method`." msgstr "" -#: ../../library/urllib.request.rst:552 +#: ../../library/urllib.request.rst:600 msgid "" "Add another header to the request. Headers are currently ignored by all " "handlers except HTTP handlers, where they are added to the list of headers " @@ -797,121 +858,121 @@ msgid "" "headers added using this method are also added to redirected requests." msgstr "" -#: ../../library/urllib.request.rst:564 +#: ../../library/urllib.request.rst:612 msgid "Add a header that will not be added to a redirected request." msgstr "" -#: ../../library/urllib.request.rst:569 +#: ../../library/urllib.request.rst:617 msgid "" "Return whether the instance has the named header (checks both regular and " "unredirected)." msgstr "" -#: ../../library/urllib.request.rst:575 +#: ../../library/urllib.request.rst:623 msgid "" "Remove named header from the request instance (both from regular and " "unredirected headers)." msgstr "" -#: ../../library/urllib.request.rst:583 +#: ../../library/urllib.request.rst:631 msgid "Return the URL given in the constructor." msgstr "" -#: ../../library/urllib.request.rst:587 +#: ../../library/urllib.request.rst:635 msgid "Returns :attr:`Request.full_url`" msgstr "回傳 :attr:`Request.full_url`" -#: ../../library/urllib.request.rst:592 +#: ../../library/urllib.request.rst:640 msgid "" "Prepare the request by connecting to a proxy server. The *host* and *type* " "will replace those of the instance, and the instance's selector will be the " "original URL given in the constructor." msgstr "" -#: ../../library/urllib.request.rst:599 +#: ../../library/urllib.request.rst:647 msgid "" "Return the value of the given header. If the header is not present, return " "the default value." msgstr "" -#: ../../library/urllib.request.rst:605 +#: ../../library/urllib.request.rst:653 msgid "" "Return a list of tuples (header_name, header_value) of the Request headers." msgstr "" -#: ../../library/urllib.request.rst:607 +#: ../../library/urllib.request.rst:655 msgid "" "The request methods add_data, has_data, get_data, get_type, get_host, " "get_selector, get_origin_req_host and is_unverifiable that were deprecated " "since 3.3 have been removed." msgstr "" -#: ../../library/urllib.request.rst:616 +#: ../../library/urllib.request.rst:664 msgid "OpenerDirector Objects" msgstr "OpenerDirector 物件" -#: ../../library/urllib.request.rst:618 +#: ../../library/urllib.request.rst:666 msgid ":class:`OpenerDirector` instances have the following methods:" msgstr ":class:`OpenerDirector` 物件有以下的方法:" -#: ../../library/urllib.request.rst:623 +#: ../../library/urllib.request.rst:671 msgid "" "*handler* should be an instance of :class:`BaseHandler`. The following " "methods are searched, and added to the possible chains (note that HTTP " "errors are a special case). Note that, in the following, *protocol* should " -"be replaced with the actual protocol to handle, for example :meth:" -"`http_response` would be the HTTP protocol response handler. Also *type* " -"should be replaced with the actual HTTP code, for example :meth:" -"`http_error_404` would handle HTTP 404 errors." +"be replaced with the actual protocol to handle, for " +"example :meth:`http_response` would be the HTTP protocol response handler. " +"Also *type* should be replaced with the actual HTTP code, for " +"example :meth:`http_error_404` would handle HTTP 404 errors." msgstr "" -#: ../../library/urllib.request.rst:631 +#: ../../library/urllib.request.rst:679 msgid "" ":meth:`!_open` --- signal that the handler knows how to open " "*protocol* URLs." msgstr "" -#: ../../library/urllib.request.rst:634 +#: ../../library/urllib.request.rst:682 msgid "See |protocol_open|_ for more information." msgstr "更多資訊請見 |protocol_open|_。" -#: ../../library/urllib.request.rst:636 +#: ../../library/urllib.request.rst:684 msgid "" ":meth:`!http_error_\\` --- signal that the handler knows how to " "handle HTTP errors with HTTP error code *type*." msgstr "" -#: ../../library/urllib.request.rst:639 +#: ../../library/urllib.request.rst:687 msgid "See |http_error_nnn|_ for more information." msgstr "更多資訊請見 |http_error_nnn|_。" -#: ../../library/urllib.request.rst:641 +#: ../../library/urllib.request.rst:689 msgid "" ":meth:`!_error` --- signal that the handler knows how to handle " "errors from (non-\\ ``http``) *protocol*." msgstr "" -#: ../../library/urllib.request.rst:644 +#: ../../library/urllib.request.rst:692 msgid "" ":meth:`!_request` --- signal that the handler knows how to pre-" "process *protocol* requests." msgstr "" -#: ../../library/urllib.request.rst:647 +#: ../../library/urllib.request.rst:695 msgid "See |protocol_request|_ for more information." msgstr "更多資訊請見 |protocol_request|_。" -#: ../../library/urllib.request.rst:649 +#: ../../library/urllib.request.rst:697 msgid "" ":meth:`!_response` --- signal that the handler knows how to post-" "process *protocol* responses." msgstr "" -#: ../../library/urllib.request.rst:652 +#: ../../library/urllib.request.rst:700 msgid "See |protocol_response|_ for more information." msgstr "更多資訊請見 |protocol_response|_。" -#: ../../library/urllib.request.rst:661 +#: ../../library/urllib.request.rst:709 msgid "" "Open the given *url* (which can be a request object or a string), optionally " "passing the given *data*. Arguments, return values and exceptions raised are " @@ -923,7 +984,7 @@ msgid "" "HTTP, HTTPS and FTP connections." msgstr "" -#: ../../library/urllib.request.rst:673 +#: ../../library/urllib.request.rst:721 msgid "" "Handle an error of the given protocol. This will call the registered error " "handlers for the given protocol with the given arguments (which are protocol " @@ -932,313 +993,317 @@ msgid "" "http_error_\\` methods of the handler classes." msgstr "" -#: ../../library/urllib.request.rst:679 +#: ../../library/urllib.request.rst:727 msgid "" "Return values and exceptions raised are the same as those of :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:681 +#: ../../library/urllib.request.rst:729 msgid "OpenerDirector objects open URLs in three stages:" msgstr "" -#: ../../library/urllib.request.rst:683 +#: ../../library/urllib.request.rst:731 msgid "" "The order in which these methods are called within each stage is determined " "by sorting the handler instances." msgstr "" -#: ../../library/urllib.request.rst:686 +#: ../../library/urllib.request.rst:734 msgid "" "Every handler with a method named like :meth:`!_request` has that " "method called to pre-process the request." msgstr "" -#: ../../library/urllib.request.rst:689 +#: ../../library/urllib.request.rst:737 msgid "" "Handlers with a method named like :meth:`!_open` are called to " -"handle the request. This stage ends when a handler either returns a non-\\ :" -"const:`None` value (ie. a response), or raises an exception (usually :exc:" -"`~urllib.error.URLError`). Exceptions are allowed to propagate." +"handle the request. This stage ends when a handler either returns a non-" +"\\ :const:`None` value (ie. a response), or raises an exception " +"(usually :exc:`~urllib.error.URLError`). Exceptions are allowed to " +"propagate." msgstr "" -#: ../../library/urllib.request.rst:694 +#: ../../library/urllib.request.rst:742 msgid "" -"In fact, the above algorithm is first tried for methods named :meth:" -"`~BaseHandler.default_open`. If all such methods return :const:`None`, the " -"algorithm is repeated for methods named like :meth:`!_open`. If " -"all such methods return :const:`None`, the algorithm is repeated for methods " +"In fact, the above algorithm is first tried for methods " +"named :meth:`~BaseHandler.default_open`. If all such methods " +"return :const:`None`, the algorithm is repeated for methods named " +"like :meth:`!_open`. If all such methods return :const:`None`, " +"the algorithm is repeated for methods " "named :meth:`~BaseHandler.unknown_open`." msgstr "" -#: ../../library/urllib.request.rst:700 +#: ../../library/urllib.request.rst:748 msgid "" "Note that the implementation of these methods may involve calls of the " -"parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` and :" -"meth:`~OpenerDirector.error` methods." +"parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` " +"and :meth:`~OpenerDirector.error` methods." msgstr "" -#: ../../library/urllib.request.rst:704 +#: ../../library/urllib.request.rst:752 msgid "" "Every handler with a method named like :meth:`!_response` has that " "method called to post-process the response." msgstr "" -#: ../../library/urllib.request.rst:711 +#: ../../library/urllib.request.rst:759 msgid "BaseHandler Objects" msgstr "BaseHandler 物件" -#: ../../library/urllib.request.rst:713 +#: ../../library/urllib.request.rst:761 msgid "" ":class:`BaseHandler` objects provide a couple of methods that are directly " "useful, and others that are meant to be used by derived classes. These are " "intended for direct use:" msgstr "" -#: ../../library/urllib.request.rst:720 +#: ../../library/urllib.request.rst:768 msgid "Add a director as parent." msgstr "" -#: ../../library/urllib.request.rst:725 +#: ../../library/urllib.request.rst:773 msgid "Remove any parents." msgstr "" -#: ../../library/urllib.request.rst:727 +#: ../../library/urllib.request.rst:775 msgid "" "The following attribute and methods should only be used by classes derived " "from :class:`BaseHandler`." msgstr "" -#: ../../library/urllib.request.rst:732 +#: ../../library/urllib.request.rst:780 msgid "" "The convention has been adopted that subclasses defining :meth:`!" -"_request` or :meth:`!_response` methods are named :class:" -"`!\\*Processor`; all others are named :class:`!\\*Handler`." +"_request` or :meth:`!_response` methods are " +"named :class:`!\\*Processor`; all others are named :class:`!\\*Handler`." msgstr "" -#: ../../library/urllib.request.rst:739 +#: ../../library/urllib.request.rst:787 msgid "" "A valid :class:`OpenerDirector`, which can be used to open using a different " "protocol, or handle errors." msgstr "" -#: ../../library/urllib.request.rst:745 +#: ../../library/urllib.request.rst:793 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to catch all URLs." msgstr "" -#: ../../library/urllib.request.rst:748 +#: ../../library/urllib.request.rst:796 msgid "" -"This method, if implemented, will be called by the parent :class:" -"`OpenerDirector`. It should return a file-like object as described in the " -"return value of the :meth:`~OpenerDirector.open` method of :class:" -"`OpenerDirector`, or ``None``. It should raise :exc:`~urllib.error." -"URLError`, unless a truly exceptional thing happens (for example, :exc:" -"`MemoryError` should not be mapped to :exc:`~urllib.error.URLError`)." +"This method, if implemented, will be called by the " +"parent :class:`OpenerDirector`. It should return a file-like object as " +"described in the return value of the :meth:`~OpenerDirector.open` method " +"of :class:`OpenerDirector`, or ``None``. It should " +"raise :exc:`~urllib.error.URLError`, unless a truly exceptional thing " +"happens (for example, :exc:`MemoryError` should not be mapped " +"to :exc:`~urllib.error.URLError`)." msgstr "" -#: ../../library/urllib.request.rst:755 +#: ../../library/urllib.request.rst:803 msgid "This method will be called before any protocol-specific open method." msgstr "" -#: ../../library/urllib.request.rst:762 +#: ../../library/urllib.request.rst:810 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to handle URLs with the given protocol." msgstr "" -#: ../../library/urllib.request.rst:765 +#: ../../library/urllib.request.rst:813 msgid "" -"This method, if defined, will be called by the parent :class:" -"`OpenerDirector`. Return values should be the same as for :meth:" -"`~BaseHandler.default_open`." +"This method, if defined, will be called by the " +"parent :class:`OpenerDirector`. Return values should be the same as " +"for :meth:`~BaseHandler.default_open`." msgstr "" -#: ../../library/urllib.request.rst:771 +#: ../../library/urllib.request.rst:819 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to catch all URLs with no specific registered handler " "to open it." msgstr "" -#: ../../library/urllib.request.rst:775 +#: ../../library/urllib.request.rst:823 msgid "" -"This method, if implemented, will be called by the :attr:`parent` :class:" -"`OpenerDirector`. Return values should be the same as for :meth:" -"`default_open`." +"This method, if implemented, will be called by " +"the :attr:`parent` :class:`OpenerDirector`. Return values should be the " +"same as for :meth:`default_open`." msgstr "" -#: ../../library/urllib.request.rst:782 +#: ../../library/urllib.request.rst:830 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "override it if they intend to provide a catch-all for otherwise unhandled " -"HTTP errors. It will be called automatically by the :class:" -"`OpenerDirector` getting the error, and should not normally be called in " -"other circumstances." +"HTTP errors. It will be called automatically by " +"the :class:`OpenerDirector` getting the error, and should not normally be " +"called in other circumstances." msgstr "" -#: ../../library/urllib.request.rst:787 +#: ../../library/urllib.request.rst:835 msgid "" ":class:`OpenerDirector` will call this method with five positional arguments:" msgstr ":class:`OpenerDirector` 會以五個位置引數呼叫此方法:" -#: ../../library/urllib.request.rst:789 +#: ../../library/urllib.request.rst:837 msgid "a :class:`Request` object," msgstr "一個 :class:`Request` 物件" -#: ../../library/urllib.request.rst:790 +#: ../../library/urllib.request.rst:838 msgid "a file-like object with the HTTP error body," msgstr "一個類檔案物件,包含 HTTP 錯誤主體," -#: ../../library/urllib.request.rst:791 +#: ../../library/urllib.request.rst:839 msgid "the three-digit code of the error, as a string," msgstr "HTTP 錯誤的三位數代號字串," -#: ../../library/urllib.request.rst:792 +#: ../../library/urllib.request.rst:840 msgid "the user-visible explanation of the code, as a string, and" msgstr "HTTP 錯誤代號的使用者可見解釋字串,以及" -#: ../../library/urllib.request.rst:793 +#: ../../library/urllib.request.rst:841 msgid "the headers of the error, as a mapping object." msgstr "HTTP 錯誤的標頭,為一個對映物件。" -#: ../../library/urllib.request.rst:795 +#: ../../library/urllib.request.rst:843 msgid "" -"Return values and exceptions raised should be the same as those of :func:" -"`urlopen`." +"Return values and exceptions raised should be the same as those " +"of :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:802 +#: ../../library/urllib.request.rst:850 msgid "" "*nnn* should be a three-digit HTTP error code. This method is also not " "defined in :class:`BaseHandler`, but will be called, if it exists, on an " "instance of a subclass, when an HTTP error with code *nnn* occurs." msgstr "" -#: ../../library/urllib.request.rst:806 +#: ../../library/urllib.request.rst:854 msgid "Subclasses should override this method to handle specific HTTP errors." msgstr "" -#: ../../library/urllib.request.rst:808 +#: ../../library/urllib.request.rst:856 msgid "" -"Arguments, return values and exceptions raised should be the same as for :" -"meth:`~BaseHandler.http_error_default`." +"Arguments, return values and exceptions raised should be the same as " +"for :meth:`~BaseHandler.http_error_default`." msgstr "" -#: ../../library/urllib.request.rst:816 +#: ../../library/urllib.request.rst:864 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to pre-process requests of the given protocol." msgstr "" -#: ../../library/urllib.request.rst:819 +#: ../../library/urllib.request.rst:867 msgid "" -"This method, if defined, will be called by the parent :class:" -"`OpenerDirector`. *req* will be a :class:`Request` object. The return value " -"should be a :class:`Request` object." +"This method, if defined, will be called by the " +"parent :class:`OpenerDirector`. *req* will be a :class:`Request` object. The " +"return value should be a :class:`Request` object." msgstr "" -#: ../../library/urllib.request.rst:828 +#: ../../library/urllib.request.rst:876 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to post-process responses of the given protocol." msgstr "" -#: ../../library/urllib.request.rst:831 +#: ../../library/urllib.request.rst:879 msgid "" -"This method, if defined, will be called by the parent :class:" -"`OpenerDirector`. *req* will be a :class:`Request` object. *response* will " -"be an object implementing the same interface as the return value of :func:" -"`urlopen`. The return value should implement the same interface as the " -"return value of :func:`urlopen`." +"This method, if defined, will be called by the " +"parent :class:`OpenerDirector`. *req* will be a :class:`Request` object. " +"*response* will be an object implementing the same interface as the return " +"value of :func:`urlopen`. The return value should implement the same " +"interface as the return value of :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:841 +#: ../../library/urllib.request.rst:889 msgid "HTTPRedirectHandler Objects" msgstr "HTTPRedirectHandler 物件" -#: ../../library/urllib.request.rst:845 +#: ../../library/urllib.request.rst:893 msgid "" "Some HTTP redirections require action from this module's client code. If " "this is the case, :exc:`~urllib.error.HTTPError` is raised. See :rfc:`2616` " "for details of the precise meanings of the various redirection codes." msgstr "" -#: ../../library/urllib.request.rst:849 +#: ../../library/urllib.request.rst:897 msgid "" "An :exc:`~urllib.error.HTTPError` exception raised as a security " "consideration if the HTTPRedirectHandler is presented with a redirected URL " "which is not an HTTP, HTTPS or FTP URL." msgstr "" -#: ../../library/urllib.request.rst:856 +#: ../../library/urllib.request.rst:904 msgid "" "Return a :class:`Request` or ``None`` in response to a redirect. This is " "called by the default implementations of the :meth:`!http_error_30\\*` " "methods when a redirection is received from the server. If a redirection " "should take place, return a new :class:`Request` to allow :meth:`!" -"http_error_30\\*` to perform the redirect to *newurl*. Otherwise, raise :" -"exc:`~urllib.error.HTTPError` if no other handler should try to handle this " -"URL, or return ``None`` if you can't but another handler might." +"http_error_30\\*` to perform the redirect to *newurl*. Otherwise, " +"raise :exc:`~urllib.error.HTTPError` if no other handler should try to " +"handle this URL, or return ``None`` if you can't but another handler might." msgstr "" -#: ../../library/urllib.request.rst:866 +#: ../../library/urllib.request.rst:914 msgid "" -"The default implementation of this method does not strictly follow :rfc:" -"`2616`, which says that 301 and 302 responses to ``POST`` requests must not " -"be automatically redirected without confirmation by the user. In reality, " -"browsers do allow automatic redirection of these responses, changing the " -"POST to a ``GET``, and the default implementation reproduces this behavior." +"The default implementation of this method does not strictly " +"follow :rfc:`2616`, which says that 301 and 302 responses to ``POST`` " +"requests must not be automatically redirected without confirmation by the " +"user. In reality, browsers do allow automatic redirection of these " +"responses, changing the POST to a ``GET``, and the default implementation " +"reproduces this behavior." msgstr "" -#: ../../library/urllib.request.rst:875 +#: ../../library/urllib.request.rst:923 msgid "" "Redirect to the ``Location:`` or ``URI:`` URL. This method is called by the " "parent :class:`OpenerDirector` when getting an HTTP 'moved permanently' " "response." msgstr "" -#: ../../library/urllib.request.rst:881 +#: ../../library/urllib.request.rst:929 msgid "" "The same as :meth:`http_error_301`, but called for the 'found' response." msgstr "" -#: ../../library/urllib.request.rst:886 +#: ../../library/urllib.request.rst:934 msgid "" "The same as :meth:`http_error_301`, but called for the 'see other' response." msgstr "" -#: ../../library/urllib.request.rst:891 +#: ../../library/urllib.request.rst:939 msgid "" "The same as :meth:`http_error_301`, but called for the 'temporary redirect' " "response. It does not allow changing the request method from ``POST`` to " "``GET``." msgstr "" -#: ../../library/urllib.request.rst:898 +#: ../../library/urllib.request.rst:946 msgid "" "The same as :meth:`http_error_301`, but called for the 'permanent redirect' " "response. It does not allow changing the request method from ``POST`` to " "``GET``." msgstr "" -#: ../../library/urllib.request.rst:908 +#: ../../library/urllib.request.rst:956 msgid "HTTPCookieProcessor Objects" msgstr "HTTPCookieProcessor 物件" -#: ../../library/urllib.request.rst:910 +#: ../../library/urllib.request.rst:958 msgid ":class:`HTTPCookieProcessor` instances have one attribute:" msgstr ":class:`HTTPCookieProcessor` 實例有一個屬性:" -#: ../../library/urllib.request.rst:914 +#: ../../library/urllib.request.rst:962 msgid "The :class:`http.cookiejar.CookieJar` in which cookies are stored." msgstr "存放 cookies 的 :class:`http.cookiejar.CookieJar`。" -#: ../../library/urllib.request.rst:920 +#: ../../library/urllib.request.rst:968 msgid "ProxyHandler Objects" msgstr "ProxyHandler 物件" -#: ../../library/urllib.request.rst:926 +#: ../../library/urllib.request.rst:974 msgid "" "The :class:`ProxyHandler` will have a method :meth:`!_open` for " "every *protocol* which has a proxy in the *proxies* dictionary given in the " @@ -1247,17 +1312,17 @@ msgid "" "actually execute the protocol." msgstr "" -#: ../../library/urllib.request.rst:936 +#: ../../library/urllib.request.rst:984 msgid "HTTPPasswordMgr Objects" msgstr "HTTPPasswordMgr 物件" -#: ../../library/urllib.request.rst:938 +#: ../../library/urllib.request.rst:986 msgid "" -"These methods are available on :class:`HTTPPasswordMgr` and :class:" -"`HTTPPasswordMgrWithDefaultRealm` objects." +"These methods are available on :class:`HTTPPasswordMgr` " +"and :class:`HTTPPasswordMgrWithDefaultRealm` objects." msgstr "" -#: ../../library/urllib.request.rst:944 +#: ../../library/urllib.request.rst:992 msgid "" "*uri* can be either a single URI, or a sequence of URIs. *realm*, *user* and " "*passwd* must be strings. This causes ``(user, passwd)`` to be used as " @@ -1265,65 +1330,65 @@ msgid "" "of the given URIs is given." msgstr "" -#: ../../library/urllib.request.rst:952 +#: ../../library/urllib.request.rst:1000 msgid "" "Get user/password for given realm and URI, if any. This method will return " "``(None, None)`` if there is no matching user/password." msgstr "" -#: ../../library/urllib.request.rst:955 +#: ../../library/urllib.request.rst:1003 msgid "" "For :class:`HTTPPasswordMgrWithDefaultRealm` objects, the realm ``None`` " "will be searched if the given *realm* has no matching user/password." msgstr "" -#: ../../library/urllib.request.rst:962 +#: ../../library/urllib.request.rst:1010 msgid "HTTPPasswordMgrWithPriorAuth Objects" msgstr "HTTPPasswordMgrWithPriorAuth 物件" -#: ../../library/urllib.request.rst:964 +#: ../../library/urllib.request.rst:1012 msgid "" "This password manager extends :class:`HTTPPasswordMgrWithDefaultRealm` to " "support tracking URIs for which authentication credentials should always be " "sent." msgstr "" -#: ../../library/urllib.request.rst:971 +#: ../../library/urllib.request.rst:1019 msgid "" -"*realm*, *uri*, *user*, *passwd* are as for :meth:`HTTPPasswordMgr." -"add_password`. *is_authenticated* sets the initial value of the " -"``is_authenticated`` flag for the given URI or list of URIs. If " -"*is_authenticated* is specified as ``True``, *realm* is ignored." +"*realm*, *uri*, *user*, *passwd* are as " +"for :meth:`HTTPPasswordMgr.add_password`. *is_authenticated* sets the " +"initial value of the ``is_authenticated`` flag for the given URI or list of " +"URIs. If *is_authenticated* is specified as ``True``, *realm* is ignored." msgstr "" -#: ../../library/urllib.request.rst:979 +#: ../../library/urllib.request.rst:1027 msgid "Same as for :class:`HTTPPasswordMgrWithDefaultRealm` objects" msgstr "" -#: ../../library/urllib.request.rst:985 +#: ../../library/urllib.request.rst:1033 msgid "" "Update the ``is_authenticated`` flag for the given *uri* or list of URIs." msgstr "" -#: ../../library/urllib.request.rst:991 +#: ../../library/urllib.request.rst:1039 msgid "" "Returns the current state of the ``is_authenticated`` flag for the given URI." msgstr "" -#: ../../library/urllib.request.rst:998 +#: ../../library/urllib.request.rst:1046 msgid "AbstractBasicAuthHandler Objects" msgstr "AbstractBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:1003 +#: ../../library/urllib.request.rst:1051 msgid "" "Handle an authentication request by getting a user/password pair, and re-" "trying the request. *authreq* should be the name of the header where the " "information about the realm is included in the request, *host* specifies the " -"URL and path to authenticate for, *req* should be the (failed) :class:" -"`Request` object, and *headers* should be the error headers." +"URL and path to authenticate for, *req* should be the " +"(failed) :class:`Request` object, and *headers* should be the error headers." msgstr "" -#: ../../library/urllib.request.rst:1009 +#: ../../library/urllib.request.rst:1057 msgid "" "*host* is either an authority (e.g. ``\"python.org\"``) or a URL containing " "an authority component (e.g. ``\"http://python.org/\"``). In either case, " @@ -1331,24 +1396,24 @@ msgid "" "and ``\"python.org:80\"`` are fine, ``\"joe:password@python.org\"`` is not)." msgstr "" -#: ../../library/urllib.request.rst:1018 +#: ../../library/urllib.request.rst:1066 msgid "HTTPBasicAuthHandler Objects" msgstr "HTTPBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:1023 ../../library/urllib.request.rst:1034 -#: ../../library/urllib.request.rst:1059 ../../library/urllib.request.rst:1070 +#: ../../library/urllib.request.rst:1071 ../../library/urllib.request.rst:1082 +#: ../../library/urllib.request.rst:1107 ../../library/urllib.request.rst:1118 msgid "Retry the request with authentication information, if available." msgstr "" -#: ../../library/urllib.request.rst:1029 +#: ../../library/urllib.request.rst:1077 msgid "ProxyBasicAuthHandler Objects" msgstr "ProxyBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:1040 +#: ../../library/urllib.request.rst:1088 msgid "AbstractDigestAuthHandler Objects" msgstr "AbstractDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1045 +#: ../../library/urllib.request.rst:1093 msgid "" "*authreq* should be the name of the header where the information about the " "realm is included in the request, *host* should be the host to authenticate " @@ -1356,55 +1421,55 @@ msgid "" "should be the error headers." msgstr "" -#: ../../library/urllib.request.rst:1054 +#: ../../library/urllib.request.rst:1102 msgid "HTTPDigestAuthHandler Objects" msgstr "HTTPDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1065 +#: ../../library/urllib.request.rst:1113 msgid "ProxyDigestAuthHandler Objects" msgstr "ProxyDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1076 +#: ../../library/urllib.request.rst:1124 msgid "HTTPHandler Objects" msgstr "HTTPHandler 物件" -#: ../../library/urllib.request.rst:1081 +#: ../../library/urllib.request.rst:1129 msgid "" -"Send an HTTP request, which can be either GET or POST, depending on ``req." -"data``." +"Send an HTTP request, which can be either GET or POST, depending on " +"``req.data``." msgstr "" -#: ../../library/urllib.request.rst:1088 +#: ../../library/urllib.request.rst:1136 msgid "HTTPSHandler Objects" msgstr "HTTPSHandler 物件" -#: ../../library/urllib.request.rst:1093 +#: ../../library/urllib.request.rst:1141 msgid "" -"Send an HTTPS request, which can be either GET or POST, depending on ``req." -"data``." +"Send an HTTPS request, which can be either GET or POST, depending on " +"``req.data``." msgstr "" -#: ../../library/urllib.request.rst:1100 +#: ../../library/urllib.request.rst:1148 msgid "FileHandler Objects" msgstr "FileHandler 物件" -#: ../../library/urllib.request.rst:1105 +#: ../../library/urllib.request.rst:1153 msgid "" "Open the file locally, if there is no host name, or the host name is " "``'localhost'``." msgstr "" -#: ../../library/urllib.request.rst:1108 +#: ../../library/urllib.request.rst:1156 msgid "" "This method is applicable only for local hostnames. When a remote hostname " "is given, a :exc:`~urllib.error.URLError` is raised." msgstr "" -#: ../../library/urllib.request.rst:1116 +#: ../../library/urllib.request.rst:1164 msgid "DataHandler Objects" msgstr "DataHandler 物件" -#: ../../library/urllib.request.rst:1120 +#: ../../library/urllib.request.rst:1168 msgid "" "Read a data URL. This kind of URL contains the content encoded in the URL " "itself. The data URL syntax is specified in :rfc:`2397`. This implementation " @@ -1414,83 +1479,83 @@ msgid "" "implementation will raise a :exc:`ValueError` in that case." msgstr "" -#: ../../library/urllib.request.rst:1131 +#: ../../library/urllib.request.rst:1179 msgid "FTPHandler Objects" msgstr "FTPHandler 物件" -#: ../../library/urllib.request.rst:1136 +#: ../../library/urllib.request.rst:1184 msgid "" "Open the FTP file indicated by *req*. The login is always done with empty " "username and password." msgstr "" -#: ../../library/urllib.request.rst:1143 +#: ../../library/urllib.request.rst:1191 msgid "CacheFTPHandler Objects" msgstr "CacheFTPHandler 物件" -#: ../../library/urllib.request.rst:1145 +#: ../../library/urllib.request.rst:1193 msgid "" ":class:`CacheFTPHandler` objects are :class:`FTPHandler` objects with the " "following additional methods:" msgstr "" -#: ../../library/urllib.request.rst:1151 +#: ../../library/urllib.request.rst:1199 msgid "Set timeout of connections to *t* seconds." msgstr "" -#: ../../library/urllib.request.rst:1156 +#: ../../library/urllib.request.rst:1204 msgid "Set maximum number of cached connections to *m*." msgstr "" -#: ../../library/urllib.request.rst:1162 +#: ../../library/urllib.request.rst:1210 msgid "UnknownHandler Objects" msgstr "UnknownHandler 物件" -#: ../../library/urllib.request.rst:1167 +#: ../../library/urllib.request.rst:1215 msgid "Raise a :exc:`~urllib.error.URLError` exception." msgstr "" -#: ../../library/urllib.request.rst:1173 +#: ../../library/urllib.request.rst:1221 msgid "HTTPErrorProcessor Objects" msgstr "HTTPErrorProcessor 物件" -#: ../../library/urllib.request.rst:1179 +#: ../../library/urllib.request.rst:1227 msgid "For 200 error codes, the response object is returned immediately." msgstr "" -#: ../../library/urllib.request.rst:1181 +#: ../../library/urllib.request.rst:1229 msgid "" "For non-200 error codes, this simply passes the job on to the :meth:`!" "http_error_\\` handler methods, via :meth:`OpenerDirector.error`. " -"Eventually, :class:`HTTPDefaultErrorHandler` will raise an :exc:`~urllib." -"error.HTTPError` if no other handler handles the error." +"Eventually, :class:`HTTPDefaultErrorHandler` will raise " +"an :exc:`~urllib.error.HTTPError` if no other handler handles the error." msgstr "" -#: ../../library/urllib.request.rst:1189 +#: ../../library/urllib.request.rst:1237 msgid "Process HTTPS error responses." msgstr "" -#: ../../library/urllib.request.rst:1191 +#: ../../library/urllib.request.rst:1239 msgid "The behavior is same as :meth:`http_response`." msgstr "" -#: ../../library/urllib.request.rst:1197 +#: ../../library/urllib.request.rst:1245 msgid "Examples" msgstr "範例" -#: ../../library/urllib.request.rst:1199 +#: ../../library/urllib.request.rst:1247 msgid "" "In addition to the examples below, more examples are given in :ref:`urllib-" "howto`." msgstr "" -#: ../../library/urllib.request.rst:1202 +#: ../../library/urllib.request.rst:1250 msgid "" "This example gets the python.org main page and displays the first 300 bytes " "of it::" msgstr "" -#: ../../library/urllib.request.rst:1205 +#: ../../library/urllib.request.rst:1253 msgid "" ">>> import urllib.request\n" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" @@ -1502,7 +1567,7 @@ msgid "" "class=\"no-js ie8 lt-ie9\">" msgstr "" -#: ../../library/urllib.request.rst:1211 +#: ../../library/urllib.request.rst:1259 msgid "" "Note that urlopen returns a bytes object. This is because there is no way " "for urlopen to automatically determine the encoding of the byte stream it " @@ -1511,26 +1576,26 @@ msgid "" "appropriate encoding." msgstr "" -#: ../../library/urllib.request.rst:1217 +#: ../../library/urllib.request.rst:1265 msgid "" "The following HTML spec document, https://html.spec.whatwg.org/#charset, " "lists the various ways in which an HTML or an XML document could have " "specified its encoding information." msgstr "" -#: ../../library/urllib.request.rst:1221 +#: ../../library/urllib.request.rst:1269 msgid "" "For additional information, see the W3C document: https://www.w3.org/" "International/questions/qa-html-encoding-declarations." msgstr "" -#: ../../library/urllib.request.rst:1223 +#: ../../library/urllib.request.rst:1271 msgid "" "As the python.org website uses *utf-8* encoding as specified in its meta " "tag, we will use the same for decoding the bytes object::" msgstr "" -#: ../../library/urllib.request.rst:1226 +#: ../../library/urllib.request.rst:1274 msgid "" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" "... print(f.read(100).decode('utf-8'))\n" @@ -1548,13 +1613,13 @@ msgstr "" "[endif]-->\n" ">> import urllib.request\n" ">>> f = urllib.request.urlopen('http://www.python.org/')\n" @@ -1580,14 +1645,14 @@ msgstr "" "[endif]-->\n" " About IDLE` dialog." +"import by other programs, it gets improvements with every release. " +"See :file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since " +"3.4.0, as well as changes made in future 3.5.x releases. This file is also " +"available from the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" #: ../../whatsnew/3.5.rst:1232 @@ -1959,12 +1964,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:1239 msgid "" -"The :mod:`imaplib` module now supports :rfc:`5161` (ENABLE Extension) and :" -"rfc:`6855` (UTF-8 Support) via the :meth:`IMAP4.enable() ` method. A new :attr:`IMAP4.utf8_enabled ` attribute tracks whether or not :rfc:`6855` support is " -"enabled. (Contributed by Milan Oberkirch, R. David Murray, and Maciej Szulik " -"in :issue:`21800`.)" +"The :mod:`imaplib` module now supports :rfc:`5161` (ENABLE Extension) " +"and :rfc:`6855` (UTF-8 Support) via the :meth:`IMAP4.enable() " +"` method. A new :attr:`IMAP4.utf8_enabled " +"` attribute tracks whether or not :rfc:`6855` " +"support is enabled. (Contributed by Milan Oberkirch, R. David Murray, and " +"Maciej Szulik in :issue:`21800`.)" msgstr "" #: ../../whatsnew/3.5.rst:1246 @@ -1980,10 +1985,10 @@ msgstr "imghdr" #: ../../whatsnew/3.5.rst:1254 msgid "" -"The :func:`!what` function now recognizes the `OpenEXR `_ format (contributed by Martin Vignali and Claudiu Popa in :issue:" -"`20295`), and the `WebP `_ format " -"(contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" +"The :func:`!what` function now recognizes the `OpenEXR `_ format (contributed by Martin Vignali and Claudiu Popa " +"in :issue:`20295`), and the `WebP `_ " +"format (contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" msgstr "" #: ../../whatsnew/3.5.rst:1262 @@ -1999,11 +2004,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:1268 msgid "" -"The :func:`abc.InspectLoader.source_to_code() ` method is now a static method. This makes it easier to " -"initialize a module object with code compiled from a string by running " -"``exec(code, module.__dict__)``. (Contributed by Brett Cannon in :issue:" -"`21156`.)" +"The :func:`abc.InspectLoader.source_to_code() " +"` method is now a static " +"method. This makes it easier to initialize a module object with code " +"compiled from a string by running ``exec(code, module.__dict__)``. " +"(Contributed by Brett Cannon in :issue:`21156`.)" msgstr "" #: ../../whatsnew/3.5.rst:1274 @@ -2022,15 +2027,15 @@ msgstr "inspect" #: ../../whatsnew/3.5.rst:1284 msgid "" "Both the :class:`~inspect.Signature` and :class:`~inspect.Parameter` classes " -"are now picklable and hashable. (Contributed by Yury Selivanov in :issue:" -"`20726` and :issue:`20334`.)" +"are now picklable and hashable. (Contributed by Yury Selivanov " +"in :issue:`20726` and :issue:`20334`.)" msgstr "" #: ../../whatsnew/3.5.rst:1288 msgid "" -"A new :meth:`BoundArguments.apply_defaults() ` method provides a way to set default values for missing " -"arguments::" +"A new :meth:`BoundArguments.apply_defaults() " +"` method provides a way to set " +"default values for missing arguments::" msgstr "" #: ../../whatsnew/3.5.rst:1292 @@ -2053,34 +2058,34 @@ msgstr "(由 Yury Selivanov 在 :issue:`24190` 中貢獻。)" #: ../../whatsnew/3.5.rst:1300 msgid "" -"A new class method :meth:`Signature.from_callable() ` makes subclassing of :class:`~inspect.Signature` easier. " -"(Contributed by Yury Selivanov and Eric Snow in :issue:`17373`.)" +"A new class method :meth:`Signature.from_callable() " +"` makes subclassing " +"of :class:`~inspect.Signature` easier. (Contributed by Yury Selivanov and " +"Eric Snow in :issue:`17373`.)" msgstr "" #: ../../whatsnew/3.5.rst:1305 msgid "" "The :func:`~inspect.signature` function now accepts a *follow_wrapped* " "optional keyword argument, which, when set to ``False``, disables automatic " -"following of ``__wrapped__`` links. (Contributed by Yury Selivanov in :issue:" -"`20691`.)" +"following of ``__wrapped__`` links. (Contributed by Yury Selivanov " +"in :issue:`20691`.)" msgstr "" #: ../../whatsnew/3.5.rst:1310 msgid "" "A set of new functions to inspect :term:`coroutine functions ` and :term:`coroutine objects ` has been added: :func:" -"`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, :func:" -"`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`, and :func:" -"`~inspect.getcoroutinestate`. (Contributed by Yury Selivanov in :issue:" -"`24017` and :issue:`24400`.)" +"function>` and :term:`coroutine objects ` has been " +"added: :func:`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, :func:`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`, " +"and :func:`~inspect.getcoroutinestate`. (Contributed by Yury Selivanov " +"in :issue:`24017` and :issue:`24400`.)" msgstr "" #: ../../whatsnew/3.5.rst:1318 msgid "" -"The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect." -"getouterframes`, and :func:`~inspect.getinnerframes` functions now return a " -"list of named tuples. (Contributed by Daniel Shahaf in :issue:`16808`.)" +"The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect.getouterframes`, " +"and :func:`~inspect.getinnerframes` functions now return a list of named " +"tuples. (Contributed by Daniel Shahaf in :issue:`16808`.)" msgstr "" #: ../../whatsnew/3.5.rst:1325 @@ -2090,10 +2095,10 @@ msgstr "io" #: ../../whatsnew/3.5.rst:1327 msgid "" "A new :meth:`BufferedIOBase.readinto1() ` " -"method, that uses at most one call to the underlying raw stream's :meth:" -"`RawIOBase.read() ` or :meth:`RawIOBase.readinto() ` methods. (Contributed by Nikolaus Rath in :issue:" -"`20578`.)" +"method, that uses at most one call to the underlying raw " +"stream's :meth:`RawIOBase.read() ` " +"or :meth:`RawIOBase.readinto() ` methods. " +"(Contributed by Nikolaus Rath in :issue:`20578`.)" msgstr "" #: ../../whatsnew/3.5.rst:1335 @@ -2127,9 +2132,9 @@ msgstr "(由 Peter Moody 和 Antoine Pitrou 在 :issue:`16531` 中貢獻。) #: ../../whatsnew/3.5.rst:1349 msgid "" -"A new :attr:`~ipaddress.IPv4Address.reverse_pointer` attribute for the :" -"class:`~ipaddress.IPv4Address` and :class:`~ipaddress.IPv6Address` classes " -"returns the name of the reverse DNS PTR record::" +"A new :attr:`~ipaddress.IPv4Address.reverse_pointer` attribute for " +"the :class:`~ipaddress.IPv4Address` and :class:`~ipaddress.IPv6Address` " +"classes returns the name of the reverse DNS PTR record::" msgstr "" #: ../../whatsnew/3.5.rst:1353 @@ -2162,14 +2167,14 @@ msgstr "json" msgid "" "The :mod:`json.tool` command line interface now preserves the order of keys " "in JSON objects passed in input. The new ``--sort-keys`` option can be used " -"to sort the keys alphabetically. (Contributed by Berker Peksag in :issue:" -"`21650`.)" +"to sort the keys alphabetically. (Contributed by Berker Peksag " +"in :issue:`21650`.)" msgstr "" #: ../../whatsnew/3.5.rst:1372 msgid "" -"JSON decoder now raises :exc:`~json.JSONDecodeError` instead of :exc:" -"`ValueError` to provide better context information about the error. " +"JSON decoder now raises :exc:`~json.JSONDecodeError` instead " +"of :exc:`ValueError` to provide better context information about the error. " "(Contributed by Serhiy Storchaka in :issue:`19361`.)" msgstr "" @@ -2229,10 +2234,10 @@ msgstr "logging" #: ../../whatsnew/3.5.rst:1409 msgid "" -"All logging methods (:class:`~logging.Logger` :meth:`~logging.Logger.log`, :" -"meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:" -"`~logging.Logger.debug`, etc.), now accept exception instances as an " -"*exc_info* argument, in addition to boolean values and exception tuples::" +"All logging methods " +"(:class:`~logging.Logger` :meth:`~logging.Logger.log`, :meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:`~logging.Logger.debug`, " +"etc.), now accept exception instances as an *exc_info* argument, in addition " +"to boolean values and exception tuples::" msgstr "" #: ../../whatsnew/3.5.rst:1415 @@ -2259,8 +2264,8 @@ msgstr "(由 Yury Selivanov 在 :issue:`20537` 中貢獻。)" msgid "" "The :class:`handlers.HTTPHandler ` class now " "accepts an optional :class:`ssl.SSLContext` instance to configure SSL " -"settings used in an HTTP connection. (Contributed by Alex Gaynor in :issue:" -"`22788`.)" +"settings used in an HTTP connection. (Contributed by Alex Gaynor " +"in :issue:`22788`.)" msgstr "" #: ../../whatsnew/3.5.rst:1429 @@ -2288,9 +2293,9 @@ msgstr "math" #: ../../whatsnew/3.5.rst:1447 msgid "" -"Two new constants have been added to the :mod:`math` module: :data:`~math." -"inf` and :data:`~math.nan`. (Contributed by Mark Dickinson in :issue:" -"`23185`.)" +"Two new constants have been added to the :mod:`math` " +"module: :data:`~math.inf` and :data:`~math.nan`. (Contributed by Mark " +"Dickinson in :issue:`23185`.)" msgstr "" #: ../../whatsnew/3.5.rst:1450 @@ -2314,9 +2319,10 @@ msgstr "multiprocessing" #: ../../whatsnew/3.5.rst:1461 msgid "" -":func:`sharedctypes.synchronized() ` objects now support the :term:`context manager` protocol. " -"(Contributed by Charles-François Natali in :issue:`21565`.)" +":func:`sharedctypes.synchronized() " +"` objects now support " +"the :term:`context manager` protocol. (Contributed by Charles-François " +"Natali in :issue:`21565`.)" msgstr "" #: ../../whatsnew/3.5.rst:1467 @@ -2325,16 +2331,16 @@ msgstr "operator" #: ../../whatsnew/3.5.rst:1469 msgid "" -":func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and :func:" -"`~operator.methodcaller` objects now support pickling. (Contributed by Josh " -"Rosenberg and Serhiy Storchaka in :issue:`22955`.)" +":func:`~operator.attrgetter`, :func:`~operator.itemgetter`, " +"and :func:`~operator.methodcaller` objects now support pickling. " +"(Contributed by Josh Rosenberg and Serhiy Storchaka in :issue:`22955`.)" msgstr "" #: ../../whatsnew/3.5.rst:1473 msgid "" "New :func:`~operator.matmul` and :func:`~operator.imatmul` functions to " -"perform matrix multiplication. (Contributed by Benjamin Peterson in :issue:" -"`21176`.)" +"perform matrix multiplication. (Contributed by Benjamin Peterson " +"in :issue:`21176`.)" msgstr "" #: ../../whatsnew/3.5.rst:1479 @@ -2343,21 +2349,22 @@ msgstr "os" #: ../../whatsnew/3.5.rst:1481 msgid "" -"The new :func:`~os.scandir` function returning an iterator of :class:`~os." -"DirEntry` objects has been added. If possible, :func:`~os.scandir` extracts " -"file attributes while scanning a directory, removing the need to perform " -"subsequent system calls to determine file type or attributes, which may " -"significantly improve performance. (Contributed by Ben Hoyt with the help " -"of Victor Stinner in :issue:`22524`.)" +"The new :func:`~os.scandir` function returning an iterator " +"of :class:`~os.DirEntry` objects has been added. If " +"possible, :func:`~os.scandir` extracts file attributes while scanning a " +"directory, removing the need to perform subsequent system calls to determine " +"file type or attributes, which may significantly improve performance. " +"(Contributed by Ben Hoyt with the help of Victor Stinner in :issue:`22524`.)" msgstr "" #: ../../whatsnew/3.5.rst:1488 msgid "" -"On Windows, a new :attr:`stat_result.st_file_attributes ` attribute is now available. It corresponds to the " -"``dwFileAttributes`` member of the ``BY_HANDLE_FILE_INFORMATION`` structure " -"returned by ``GetFileInformationByHandle()``. (Contributed by Ben Hoyt in :" -"issue:`21719`.)" +"On Windows, a new :attr:`stat_result.st_file_attributes " +"` attribute is now available. It " +"corresponds to the ``dwFileAttributes`` member of the " +"``BY_HANDLE_FILE_INFORMATION`` structure returned by " +"``GetFileInformationByHandle()``. (Contributed by Ben Hoyt " +"in :issue:`21719`.)" msgstr "" #: ../../whatsnew/3.5.rst:1494 @@ -2371,8 +2378,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:1499 msgid "" "New :func:`~os.get_blocking` and :func:`~os.set_blocking` functions allow " -"getting and setting a file descriptor's blocking mode (:const:`~os." -"O_NONBLOCK`.) (Contributed by Victor Stinner in :issue:`22054`.)" +"getting and setting a file descriptor's blocking mode " +"(:const:`~os.O_NONBLOCK`.) (Contributed by Victor Stinner in :issue:`22054`.)" msgstr "" #: ../../whatsnew/3.5.rst:1503 @@ -2380,14 +2387,14 @@ msgid "" "The :func:`~os.truncate` and :func:`~os.ftruncate` functions are now " "supported on Windows. (Contributed by Steve Dower in :issue:`23668`.)" msgstr "" -"Windows 現在支援 :func:`~os.truncate` 和 :func:`~os.ftruncate` 函式。(由 Steve " -"Dower 在 :issue:`23668` 中貢獻。)" +"Windows 現在支援 :func:`~os.truncate` 和 :func:`~os.ftruncate` 函式。(由 " +"Steve Dower 在 :issue:`23668` 中貢獻。)" #: ../../whatsnew/3.5.rst:1506 msgid "" "There is a new :func:`os.path.commonpath` function returning the longest " -"common sub-path of each passed pathname. Unlike the :func:`os.path." -"commonprefix` function, it always returns a valid path::" +"common sub-path of each passed pathname. Unlike " +"the :func:`os.path.commonprefix` function, it always returns a valid path::" msgstr "" #: ../../whatsnew/3.5.rst:1511 @@ -2455,24 +2462,25 @@ msgstr "" msgid "" "A new :meth:`Path.home() ` class method can be used to " "get a :class:`~pathlib.Path` instance representing the user’s home " -"directory. (Contributed by Victor Salgado and Mayank Tripathi in :issue:" -"`19777`.)" +"directory. (Contributed by Victor Salgado and Mayank Tripathi " +"in :issue:`19777`.)" msgstr "" #: ../../whatsnew/3.5.rst:1548 msgid "" -"New :meth:`Path.write_text() `, :meth:`Path." -"read_text() `, :meth:`Path.write_bytes() `, :meth:`Path.read_bytes() ` " -"methods to simplify read/write operations on files." +"New :meth:`Path.write_text() " +"`, :meth:`Path.read_text() " +"`, :meth:`Path.write_bytes() " +"`, :meth:`Path.read_bytes() " +"` methods to simplify read/write operations on " +"files." msgstr "" #: ../../whatsnew/3.5.rst:1554 msgid "" "The following code snippet will create or rewrite existing file ``~/" "spam42``::" -msgstr "" -"以下程式碼片段將會建立或重寫已存在的檔案 ``~/spam42``: ::" +msgstr "以下程式碼片段將會建立或重寫已存在的檔案 ``~/spam42``: ::" #: ../../whatsnew/3.5.rst:1557 msgid "" @@ -2558,11 +2566,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1604 msgid "" -"The :class:`re.error ` exceptions have new attributes, :" -"attr:`~re.PatternError.msg`, :attr:`~re.PatternError.pattern`, :attr:`~re." -"PatternError.pos`, :attr:`~re.PatternError.lineno`, and :attr:`~re." -"PatternError.colno`, that provide better context information about the " -"error::" +"The :class:`re.error ` exceptions have new " +"attributes, :attr:`~re.PatternError.msg`, :attr:`~re.PatternError.pattern`, :attr:`~re.PatternError.pos`, :attr:`~re.PatternError.lineno`, " +"and :attr:`~re.PatternError.colno`, that provide better context information " +"about the error::" msgstr "" #: ../../whatsnew/3.5.rst:1610 @@ -2625,8 +2632,8 @@ msgid "" "The :func:`~shutil.make_archive` function now supports the *xztar* format. " "(Contributed by Serhiy Storchaka in :issue:`5411`.)" msgstr "" -":func:`~shutil.make_archive` 函式現在支援 *xztar* 格式。(由 Serhiy Storchaka " -"在 :issue:`5411` 中貢獻。)" +":func:`~shutil.make_archive` 函式現在支援 *xztar* 格式。(由 Serhiy " +"Storchaka 在 :issue:`5411` 中貢獻。)" #: ../../whatsnew/3.5.rst:1651 msgid "signal" @@ -2664,9 +2671,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:1676 msgid "" -"The :class:`!SMTPServer` class now advertises the ``8BITMIME`` extension (:" -"rfc:`6152`) if *decode_data* has been set ``True``. If the client specifies " -"``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to :meth:`!" +"The :class:`!SMTPServer` class now advertises the ``8BITMIME`` extension " +"(:rfc:`6152`) if *decode_data* has been set ``True``. If the client " +"specifies ``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to :meth:`!" "SMTPServer.process_message` via the *mail_options* keyword. (Contributed by " "Milan Oberkirch and R. David Murray in :issue:`21795`.)" msgstr "" @@ -2703,16 +2710,16 @@ msgstr "" msgid "" "The :meth:`SMTP.set_debuglevel() ` method now " "accepts an additional debuglevel (2), which enables timestamps in debug " -"messages. (Contributed by Gavin Chappell and Maciej Szulik in :issue:" -"`16914`.)" +"messages. (Contributed by Gavin Chappell and Maciej Szulik " +"in :issue:`16914`.)" msgstr "" #: ../../whatsnew/3.5.rst:1707 msgid "" -"Both the :meth:`SMTP.sendmail() ` and :meth:`SMTP." -"send_message() ` methods now support :rfc:`6531` " -"(SMTPUTF8). (Contributed by Milan Oberkirch and R. David Murray in :issue:" -"`22027`.)" +"Both the :meth:`SMTP.sendmail() ` " +"and :meth:`SMTP.send_message() ` methods now " +"support :rfc:`6531` (SMTPUTF8). (Contributed by Milan Oberkirch and R. David " +"Murray in :issue:`22027`.)" msgstr "" #: ../../whatsnew/3.5.rst:1714 @@ -2721,8 +2728,9 @@ msgstr "sndhdr" #: ../../whatsnew/3.5.rst:1716 msgid "" -"The :func:`!what` and :func:`!whathdr` functions now return a :func:" -"`~collections.namedtuple`. (Contributed by Claudiu Popa in :issue:`18615`.)" +"The :func:`!what` and :func:`!whathdr` functions now return " +"a :func:`~collections.namedtuple`. (Contributed by Claudiu Popa " +"in :issue:`18615`.)" msgstr "" #: ../../whatsnew/3.5.rst:1722 @@ -2738,10 +2746,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1727 msgid "" "A new :meth:`socket.sendfile() ` method allows " -"sending a file over a socket by using the high-performance :func:`os." -"sendfile` function on UNIX, resulting in uploads being from 2 to 3 times " -"faster than when using plain :meth:`socket.send() `. " -"(Contributed by Giampaolo Rodola' in :issue:`17552`.)" +"sending a file over a socket by using the high-" +"performance :func:`os.sendfile` function on UNIX, resulting in uploads being " +"from 2 to 3 times faster than when using plain :meth:`socket.send() " +"`. (Contributed by Giampaolo Rodola' in :issue:`17552`.)" msgstr "" #: ../../whatsnew/3.5.rst:1733 @@ -2755,9 +2763,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:1738 msgid "" "The *backlog* argument of the :meth:`socket.listen() ` " -"method is now optional. By default it is set to :data:`SOMAXCONN ` or to ``128``, whichever is less. (Contributed by Charles-" -"François Natali in :issue:`21455`.)" +"method is now optional. By default it is set to :data:`SOMAXCONN " +"` or to ``128``, whichever is less. (Contributed by " +"Charles-François Natali in :issue:`21455`.)" msgstr "" #: ../../whatsnew/3.5.rst:1745 @@ -2775,11 +2783,12 @@ msgstr "(由 Geert Jansen 在 :issue:`21965` 中貢獻。)" #: ../../whatsnew/3.5.rst:1754 msgid "" "The new :class:`~ssl.SSLObject` class has been added to provide SSL protocol " -"support for cases when the network I/O capabilities of :class:`~ssl." -"SSLSocket` are not necessary or are suboptimal. ``SSLObject`` represents an " -"SSL protocol instance, but does not implement any network I/O methods, and " -"instead provides a memory buffer interface. The new :class:`~ssl.MemoryBIO` " -"class can be used to pass data between Python and an SSL protocol instance." +"support for cases when the network I/O capabilities " +"of :class:`~ssl.SSLSocket` are not necessary or are suboptimal. " +"``SSLObject`` represents an SSL protocol instance, but does not implement " +"any network I/O methods, and instead provides a memory buffer interface. " +"The new :class:`~ssl.MemoryBIO` class can be used to pass data between " +"Python and an SSL protocol instance." msgstr "" #: ../../whatsnew/3.5.rst:1761 @@ -2806,23 +2815,23 @@ msgstr "(由 Benjamin Peterson 在 :issue:`20188` 中貢獻。)" #: ../../whatsnew/3.5.rst:1774 msgid "" "Where OpenSSL support is present, the :mod:`ssl` module now implements the " -"*Application-Layer Protocol Negotiation* TLS extension as described in :rfc:" -"`7301`." +"*Application-Layer Protocol Negotiation* TLS extension as described " +"in :rfc:`7301`." msgstr "" #: ../../whatsnew/3.5.rst:1778 msgid "" -"The new :meth:`SSLContext.set_alpn_protocols() ` can be used to specify which protocols a socket should " -"advertise during the TLS handshake." +"The new :meth:`SSLContext.set_alpn_protocols() " +"` can be used to specify which protocols " +"a socket should advertise during the TLS handshake." msgstr "" #: ../../whatsnew/3.5.rst:1782 msgid "" -"The new :meth:`SSLSocket.selected_alpn_protocol() ` returns the protocol that was selected during the " -"TLS handshake. The :const:`~ssl.HAS_ALPN` flag indicates whether ALPN " -"support is present." +"The new :meth:`SSLSocket.selected_alpn_protocol() " +"` returns the protocol that was " +"selected during the TLS handshake. The :const:`~ssl.HAS_ALPN` flag indicates " +"whether ALPN support is present." msgstr "" #: ../../whatsnew/3.5.rst:1789 @@ -2832,22 +2841,23 @@ msgstr "其他變更" #: ../../whatsnew/3.5.rst:1791 msgid "" "There is a new :meth:`SSLSocket.version() ` method to " -"query the actual protocol version in use. (Contributed by Antoine Pitrou in :" -"issue:`20421`.)" +"query the actual protocol version in use. (Contributed by Antoine Pitrou " +"in :issue:`20421`.)" msgstr "" #: ../../whatsnew/3.5.rst:1795 msgid "" -"The :class:`~ssl.SSLSocket` class now implements a :meth:`!SSLSocket." -"sendfile` method. (Contributed by Giampaolo Rodola' in :issue:`17552`.)" +"The :class:`~ssl.SSLSocket` class now implements a :meth:`!" +"SSLSocket.sendfile` method. (Contributed by Giampaolo Rodola' " +"in :issue:`17552`.)" msgstr "" #: ../../whatsnew/3.5.rst:1799 msgid "" -"The :meth:`!SSLSocket.send` method now raises either the :exc:`ssl." -"SSLWantReadError` or :exc:`ssl.SSLWantWriteError` exception on a non-" -"blocking socket if the operation would block. Previously, it would return " -"``0``. (Contributed by Nikolaus Rath in :issue:`20951`.)" +"The :meth:`!SSLSocket.send` method now raises either " +"the :exc:`ssl.SSLWantReadError` or :exc:`ssl.SSLWantWriteError` exception on " +"a non-blocking socket if the operation would block. Previously, it would " +"return ``0``. (Contributed by Nikolaus Rath in :issue:`20951`.)" msgstr "" #: ../../whatsnew/3.5.rst:1804 @@ -2861,18 +2871,19 @@ msgstr "" msgid "" "New :meth:`!SSLObject.shared_ciphers` and :meth:`SSLSocket.shared_ciphers() " "` methods return the list of ciphers sent by " -"the client during the handshake. (Contributed by Benjamin Peterson in :issue:" -"`23186`.)" +"the client during the handshake. (Contributed by Benjamin Peterson " +"in :issue:`23186`.)" msgstr "" #: ../../whatsnew/3.5.rst:1813 msgid "" -"The :meth:`SSLSocket.do_handshake() `, :meth:" -"`SSLSocket.read() `, :meth:`!SSLSocket.shutdown`, and :" -"meth:`SSLSocket.write() ` methods of the :class:`~ssl." -"SSLSocket` class no longer reset the socket timeout every time bytes are " -"received or sent. The socket timeout is now the maximum total duration of " -"the method. (Contributed by Victor Stinner in :issue:`23853`.)" +"The :meth:`SSLSocket.do_handshake() " +"`, :meth:`SSLSocket.read() " +"`, :meth:`!SSLSocket.shutdown`, " +"and :meth:`SSLSocket.write() ` methods of " +"the :class:`~ssl.SSLSocket` class no longer reset the socket timeout every " +"time bytes are received or sent. The socket timeout is now the maximum total " +"duration of the method. (Contributed by Victor Stinner in :issue:`23853`.)" msgstr "" #: ../../whatsnew/3.5.rst:1821 @@ -2880,7 +2891,8 @@ msgid "" "The :func:`!match_hostname` function now supports matching of IP addresses. " "(Contributed by Antoine Pitrou in :issue:`23239`.)" msgstr "" -":func:`!match_hostname` 函式現在支援 IP 位址的比對。(由 Antoine Pitrou 在 :issue:`23239` 中貢獻。)" +":func:`!match_hostname` 函式現在支援 IP 位址的比對。(由 Antoine Pitrou " +"在 :issue:`23239` 中貢獻。)" #: ../../whatsnew/3.5.rst:1826 msgid "sqlite3" @@ -2907,10 +2919,11 @@ msgid "" "does not need to maintain compatibility with earlier Python versions. " "(Contributed by Thomas Kluyver in :issue:`23342`.)" msgstr "" -"新增 :func:`~subprocess.run` 函式。它運行指定的命令並回傳一個 " -":class:`~subprocess.CompletedProcess` 物件,該物件描述了一個已完成的行程。" -"新的 API 更加一致,並且是以較為推薦方法來叫用子行程,適用於不需要與早期 Python 版本保" -"持相容性的 Python 程式碼。(由 Thomas Kluyver 在 :issue:`23342` 中貢獻。)" +"新增 :func:`~subprocess.run` 函式。它運行指定的命令並回傳一" +"個 :class:`~subprocess.CompletedProcess` 物件,該物件描述了一個已完成的行程。" +"新的 API 更加一致,並且是以較為推薦方法來叫用子行程,適用於不需要與早期 " +"Python 版本保持相容性的 Python 程式碼。(由 Thomas Kluyver 在 :issue:`23342` " +"中貢獻。)" #: ../../whatsnew/3.5.rst:1849 msgid "" @@ -2968,8 +2981,8 @@ msgstr "sysconfig" #: ../../whatsnew/3.5.rst:1881 msgid "" "The name of the user scripts directory on Windows now includes the first two " -"components of the Python version. (Contributed by Paul Moore in :issue:" -"`23437`.)" +"components of the Python version. (Contributed by Paul Moore " +"in :issue:`23437`.)" msgstr "" #: ../../whatsnew/3.5.rst:1887 @@ -2979,16 +2992,16 @@ msgstr "tarfile" #: ../../whatsnew/3.5.rst:1889 msgid "" "The *mode* argument of the :func:`~tarfile.open` function now accepts " -"``\"x\"`` to request exclusive creation. (Contributed by Berker Peksag in :" -"issue:`21717`.)" +"``\"x\"`` to request exclusive creation. (Contributed by Berker Peksag " +"in :issue:`21717`.)" msgstr "" #: ../../whatsnew/3.5.rst:1892 msgid "" -"The :meth:`TarFile.extractall() ` and :meth:" -"`TarFile.extract() ` methods now take a keyword " -"argument *numeric_owner*. If set to ``True``, the extracted files and " -"directories will be owned by the numeric ``uid`` and ``gid`` from the " +"The :meth:`TarFile.extractall() ` " +"and :meth:`TarFile.extract() ` methods now take a " +"keyword argument *numeric_owner*. If set to ``True``, the extracted files " +"and directories will be owned by the numeric ``uid`` and ``gid`` from the " "tarfile. If set to ``False`` (the default, and the behavior in versions " "prior to 3.5), they will be owned by the named user and group in the " "tarfile. (Contributed by Michael Vogt and Eric Smith in :issue:`23193`.)" @@ -3008,9 +3021,10 @@ msgstr "threading" #: ../../whatsnew/3.5.rst:1909 msgid "" -"Both the :meth:`Lock.acquire() ` and :meth:`RLock." -"acquire() ` methods now use a monotonic clock for " -"timeout management. (Contributed by Victor Stinner in :issue:`22043`.)" +"Both the :meth:`Lock.acquire() ` " +"and :meth:`RLock.acquire() ` methods now use a " +"monotonic clock for timeout management. (Contributed by Victor Stinner " +"in :issue:`22043`.)" msgstr "" #: ../../whatsnew/3.5.rst:1916 @@ -3022,7 +3036,8 @@ msgid "" "The :func:`~time.monotonic` function is now always available. (Contributed " "by Victor Stinner in :issue:`22043`.)" msgstr "" -":func:`~time.monotonic` 函式現在總是可用的。(由 Victor Stinner 在 :issue:`22043` 中貢獻。)" +":func:`~time.monotonic` 函式現在總是可用的。(由 Victor Stinner " +"在 :issue:`22043` 中貢獻。)" #: ../../whatsnew/3.5.rst:1923 msgid "timeit" @@ -3067,9 +3082,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1953 msgid "" -"New lightweight classes: :class:`~traceback.TracebackException`, :class:" -"`~traceback.StackSummary`, and :class:`~traceback.FrameSummary`. " -"(Contributed by Robert Collins in :issue:`17911`.)" +"New lightweight " +"classes: :class:`~traceback.TracebackException`, :class:`~traceback.StackSummary`, " +"and :class:`~traceback.FrameSummary`. (Contributed by Robert Collins " +"in :issue:`17911`.)" msgstr "" #: ../../whatsnew/3.5.rst:1957 @@ -3086,16 +3102,16 @@ msgstr "types" #: ../../whatsnew/3.5.rst:1965 msgid "" "A new :func:`~types.coroutine` function to transform :term:`generator " -"` and :class:`generator-like ` objects into :term:`awaitables `. (Contributed by " -"Yury Selivanov in :issue:`24017`.)" +"` and :class:`generator-like " +"` objects into :term:`awaitables `. " +"(Contributed by Yury Selivanov in :issue:`24017`.)" msgstr "" #: ../../whatsnew/3.5.rst:1971 msgid "" -"A new type called :class:`~types.CoroutineType`, which is used for :term:" -"`coroutine` objects created by :keyword:`async def` functions. (Contributed " -"by Yury Selivanov in :issue:`24400`.)" +"A new type called :class:`~types.CoroutineType`, which is used " +"for :term:`coroutine` objects created by :keyword:`async def` functions. " +"(Contributed by Yury Selivanov in :issue:`24400`.)" msgstr "" #: ../../whatsnew/3.5.rst:1977 @@ -3107,7 +3123,8 @@ msgid "" "The :mod:`unicodedata` module now uses data from `Unicode 8.0.0 `_." msgstr "" -":mod:`unicodedata` 模組現在使用來自 `Unicode 8.0.0 `_ 的資料。" +":mod:`unicodedata` 模組現在使用來自 `Unicode 8.0.0 `_ 的資料。" #: ../../whatsnew/3.5.rst:1984 msgid "unittest" @@ -3115,13 +3132,13 @@ msgstr "unittest" #: ../../whatsnew/3.5.rst:1986 msgid "" -"The :meth:`TestLoader.loadTestsFromModule() ` method now accepts a keyword-only argument *pattern* " -"which is passed to ``load_tests`` as the third argument. Found packages are " -"now checked for ``load_tests`` regardless of whether their path matches " -"*pattern*, because it is impossible for a package name to match the default " -"pattern. (Contributed by Robert Collins and Barry A. Warsaw in :issue:" -"`16662`.)" +"The :meth:`TestLoader.loadTestsFromModule() " +"` method now accepts a keyword-only " +"argument *pattern* which is passed to ``load_tests`` as the third argument. " +"Found packages are now checked for ``load_tests`` regardless of whether " +"their path matches *pattern*, because it is impossible for a package name to " +"match the default pattern. (Contributed by Robert Collins and Barry A. " +"Warsaw in :issue:`16662`.)" msgstr "" #: ../../whatsnew/3.5.rst:1993 @@ -3154,24 +3171,24 @@ msgstr "" #: ../../whatsnew/3.5.rst:2012 msgid "" -"A new :meth:`Mock.assert_not_called() ` method to check if the mock object was called. " -"(Contributed by Kushal Das in :issue:`21262`.)" +"A new :meth:`Mock.assert_not_called() " +"` method to check if the mock object " +"was called. (Contributed by Kushal Das in :issue:`21262`.)" msgstr "" #: ../../whatsnew/3.5.rst:2016 msgid "" -"The :class:`~unittest.mock.MagicMock` class now supports :meth:`~object." -"__truediv__`, :meth:`~object.__divmod__` and :meth:`~object.__matmul__` " -"operators. (Contributed by Johannes Baiter in :issue:`20968`, and Håkan " -"Lövdahl in :issue:`23581` and :issue:`23568`.)" +"The :class:`~unittest.mock.MagicMock` class now " +"supports :meth:`~object.__truediv__`, :meth:`~object.__divmod__` " +"and :meth:`~object.__matmul__` operators. (Contributed by Johannes Baiter " +"in :issue:`20968`, and Håkan Lövdahl in :issue:`23581` and :issue:`23568`.)" msgstr "" #: ../../whatsnew/3.5.rst:2022 msgid "" -"It is no longer necessary to explicitly pass ``create=True`` to the :func:" -"`~unittest.mock.patch` function when patching builtin names. (Contributed by " -"Kushal Das in :issue:`17660`.)" +"It is no longer necessary to explicitly pass ``create=True`` to " +"the :func:`~unittest.mock.patch` function when patching builtin names. " +"(Contributed by Kushal Das in :issue:`17660`.)" msgstr "" #: ../../whatsnew/3.5.rst:2028 @@ -3180,35 +3197,38 @@ msgstr "urllib" #: ../../whatsnew/3.5.rst:2030 msgid "" -"A new :class:`request.HTTPPasswordMgrWithPriorAuth ` class allows HTTP Basic Authentication " -"credentials to be managed so as to eliminate unnecessary ``401`` response " -"handling, or to unconditionally send credentials on the first request in " -"order to communicate with servers that return a ``404`` response instead of " -"a ``401`` if the ``Authorization`` header is not sent. (Contributed by Matej " -"Cepl in :issue:`19494` and Akshit Khurana in :issue:`7159`.)" +"A new :class:`request.HTTPPasswordMgrWithPriorAuth " +"` class allows HTTP Basic " +"Authentication credentials to be managed so as to eliminate unnecessary " +"``401`` response handling, or to unconditionally send credentials on the " +"first request in order to communicate with servers that return a ``404`` " +"response instead of a ``401`` if the ``Authorization`` header is not sent. " +"(Contributed by Matej Cepl in :issue:`19494` and Akshit Khurana " +"in :issue:`7159`.)" msgstr "" #: ../../whatsnew/3.5.rst:2039 msgid "" -"A new *quote_via* argument for the :func:`parse.urlencode() ` function provides a way to control the encoding of query parts " -"if needed. (Contributed by Samwyse and Arnon Yaari in :issue:`13866`.)" +"A new *quote_via* argument for the :func:`parse.urlencode() " +"` function provides a way to control the encoding of " +"query parts if needed. (Contributed by Samwyse and Arnon Yaari " +"in :issue:`13866`.)" msgstr "" #: ../../whatsnew/3.5.rst:2044 msgid "" -"The :func:`request.urlopen() ` function accepts an :" -"class:`ssl.SSLContext` object as a *context* argument, which will be used " -"for the HTTPS connection. (Contributed by Alex Gaynor in :issue:`22366`.)" +"The :func:`request.urlopen() ` function accepts " +"an :class:`ssl.SSLContext` object as a *context* argument, which will be " +"used for the HTTPS connection. (Contributed by Alex Gaynor " +"in :issue:`22366`.)" msgstr "" #: ../../whatsnew/3.5.rst:2048 msgid "" -"The :func:`parse.urljoin() ` was updated to use the :" -"rfc:`3986` semantics for the resolution of relative URLs, rather than :rfc:" -"`1808` and :rfc:`2396`. (Contributed by Demian Brecht and Senthil Kumaran " -"in :issue:`22118`.)" +"The :func:`parse.urljoin() ` was updated to use " +"the :rfc:`3986` semantics for the resolution of relative URLs, rather " +"than :rfc:`1808` and :rfc:`2396`. (Contributed by Demian Brecht and Senthil " +"Kumaran in :issue:`22118`.)" msgstr "" #: ../../whatsnew/3.5.rst:2055 @@ -3217,9 +3237,9 @@ msgstr "wsgiref" #: ../../whatsnew/3.5.rst:2057 msgid "" -"The *headers* argument of the :class:`headers.Headers ` class constructor is now optional. (Contributed by Pablo Torres " -"Navarrete and SilentGhost in :issue:`5800`.)" +"The *headers* argument of the :class:`headers.Headers " +"` class constructor is now optional. (Contributed " +"by Pablo Torres Navarrete and SilentGhost in :issue:`5800`.)" msgstr "" #: ../../whatsnew/3.5.rst:2063 @@ -3246,9 +3266,9 @@ msgstr "xml.sax" #: ../../whatsnew/3.5.rst:2077 msgid "" -"SAX parsers now support a character stream of the :class:`xmlreader." -"InputSource ` object. (Contributed by Serhiy " -"Storchaka in :issue:`2175`.)" +"SAX parsers now support a character stream of " +"the :class:`xmlreader.InputSource ` object. " +"(Contributed by Serhiy Storchaka in :issue:`2175`.)" msgstr "" #: ../../whatsnew/3.5.rst:2081 @@ -3256,8 +3276,8 @@ msgid "" ":func:`~xml.sax.parseString` now accepts a :class:`str` instance. " "(Contributed by Serhiy Storchaka in :issue:`10590`.)" msgstr "" -":func:`~xml.sax.parseString` 現在接受一個 :class:`str` 實例。" -"(由 Serhiy Storchaka 在 :issue:`10590` 中貢獻。)" +":func:`~xml.sax.parseString` 現在接受一個 :class:`str` 實例。(由 Serhiy " +"Storchaka 在 :issue:`10590` 中貢獻。)" #: ../../whatsnew/3.5.rst:2086 msgid "zipfile" @@ -3282,10 +3302,10 @@ msgstr "其他模組層級的變更" #: ../../whatsnew/3.5.rst:2099 msgid "" -"Many functions in the :mod:`mmap`, :mod:`!ossaudiodev`, :mod:`socket`, :mod:" -"`ssl`, and :mod:`codecs` modules now accept writable :term:`bytes-like " -"objects `. (Contributed by Serhiy Storchaka in :issue:" -"`23001`.)" +"Many functions in the :mod:`mmap`, :mod:`!" +"ossaudiodev`, :mod:`socket`, :mod:`ssl`, and :mod:`codecs` modules now " +"accept writable :term:`bytes-like objects `. (Contributed " +"by Serhiy Storchaka in :issue:`23001`.)" msgstr "" #: ../../whatsnew/3.5.rst:2106 @@ -3295,9 +3315,9 @@ msgstr "最佳化" #: ../../whatsnew/3.5.rst:2108 msgid "" "The :func:`os.walk` function has been sped up by 3 to 5 times on POSIX " -"systems, and by 7 to 20 times on Windows. This was done using the new :func:" -"`os.scandir` function, which exposes file information from the underlying " -"``readdir`` or ``FindFirstFile``/``FindNextFile`` system calls. " +"systems, and by 7 to 20 times on Windows. This was done using the " +"new :func:`os.scandir` function, which exposes file information from the " +"underlying ``readdir`` or ``FindFirstFile``/``FindNextFile`` system calls. " "(Contributed by Ben Hoyt with help from Victor Stinner in :issue:`23605`.)" msgstr "" @@ -3305,19 +3325,18 @@ msgstr "" msgid "" "Construction of ``bytes(int)`` (filled by zero bytes) is faster and uses " "less memory for large objects. ``calloc()`` is used instead of ``malloc()`` " -"to allocate memory for these objects. (Contributed by Victor Stinner in :" -"issue:`21233`.)" +"to allocate memory for these objects. (Contributed by Victor Stinner " +"in :issue:`21233`.)" msgstr "" #: ../../whatsnew/3.5.rst:2119 msgid "" -"Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` and :" -"class:`~ipaddress.IPv6Network` have been massively sped up, such as :meth:" -"`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, :" -"func:`~ipaddress.summarize_address_range`, :func:`~ipaddress." -"collapse_addresses`. The speed up can range from 3 to 15 times. (Contributed " -"by Antoine Pitrou, Michel Albert, and Markus in :issue:`21486`, :issue:" -"`21487`, :issue:`20826`, :issue:`23266`.)" +"Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` " +"and :class:`~ipaddress.IPv6Network` have been massively sped up, such " +"as :meth:`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, :func:`~ipaddress.summarize_address_range`, :func:`~ipaddress.collapse_addresses`. " +"The speed up can range from 3 to 15 times. (Contributed by Antoine Pitrou, " +"Michel Albert, and Markus " +"in :issue:`21486`, :issue:`21487`, :issue:`20826`, :issue:`23266`.)" msgstr "" #: ../../whatsnew/3.5.rst:2127 @@ -3329,16 +3348,16 @@ msgstr "" #: ../../whatsnew/3.5.rst:2130 msgid "" "Many operations on :class:`io.BytesIO` are now 50% to 100% faster. " -"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson in :" -"issue:`22003`.)" +"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson " +"in :issue:`22003`.)" msgstr "" #: ../../whatsnew/3.5.rst:2134 msgid "" "The :func:`marshal.dumps` function is now faster: 65--85% with versions 3 " "and 4, 20--25% with versions 0 to 2 on typical data, and up to 5 times in " -"best cases. (Contributed by Serhiy Storchaka in :issue:`20416` and :issue:" -"`23344`.)" +"best cases. (Contributed by Serhiy Storchaka in :issue:`20416` " +"and :issue:`23344`.)" msgstr "" #: ../../whatsnew/3.5.rst:2139 @@ -3363,16 +3382,16 @@ msgstr "" #: ../../whatsnew/3.5.rst:2149 msgid "" "The :c:func:`PyObject_IsInstance` and :c:func:`PyObject_IsSubclass` " -"functions have been sped up in the common case that the second argument has :" -"class:`type` as its metaclass. (Contributed Georg Brandl by in :issue:" -"`22540`.)" +"functions have been sped up in the common case that the second argument " +"has :class:`type` as its metaclass. (Contributed Georg Brandl by " +"in :issue:`22540`.)" msgstr "" #: ../../whatsnew/3.5.rst:2154 msgid "" "Method caching was slightly improved, yielding up to 5% performance " -"improvement in some benchmarks. (Contributed by Antoine Pitrou in :issue:" -"`22847`.)" +"improvement in some benchmarks. (Contributed by Antoine Pitrou " +"in :issue:`22847`.)" msgstr "" #: ../../whatsnew/3.5.rst:2158 @@ -3392,14 +3411,16 @@ msgid "" "Instantiation of :class:`fractions.Fraction` is now up to 30% faster. " "(Contributed by Stefan Behnel in :issue:`22464`.)" msgstr "" -":class:`fractions.Fraction` 的實例化現在快了 30%。(由 Stefan Behnel 在 :issue:`22464` 中貢獻。)" +":class:`fractions.Fraction` 的實例化現在快了 30%。(由 Stefan Behnel " +"在 :issue:`22464` 中貢獻。)" #: ../../whatsnew/3.5.rst:2167 msgid "" -"String methods :meth:`~str.find`, :meth:`~str.rfind`, :meth:`~str.split`, :" -"meth:`~str.partition` and the :keyword:`in` string operator are now " -"significantly faster for searching 1-character substrings. (Contributed by " -"Serhiy Storchaka in :issue:`23573`.)" +"String " +"methods :meth:`~str.find`, :meth:`~str.rfind`, :meth:`~str.split`, :meth:`~str.partition` " +"and the :keyword:`in` string operator are now significantly faster for " +"searching 1-character substrings. (Contributed by Serhiy Storchaka " +"in :issue:`23573`.)" msgstr "" #: ../../whatsnew/3.5.rst:2174 @@ -3445,15 +3466,15 @@ msgstr "(由 Victor Stinner 在 :issue:`18395` 中貢獻。)" #: ../../whatsnew/3.5.rst:2191 msgid "" "A new :c:func:`PyCodec_NameReplaceErrors` function to replace the unicode " -"encode error with ``\\N{...}`` escapes. (Contributed by Serhiy Storchaka in :" -"issue:`19676`.)" +"encode error with ``\\N{...}`` escapes. (Contributed by Serhiy Storchaka " +"in :issue:`19676`.)" msgstr "" #: ../../whatsnew/3.5.rst:2195 msgid "" "A new :c:func:`PyErr_FormatV` function similar to :c:func:`PyErr_Format`, " -"but accepts a :c:type:`va_list` argument. (Contributed by Antoine Pitrou in :" -"issue:`18711`.)" +"but accepts a :c:type:`va_list` argument. (Contributed by Antoine Pitrou " +"in :issue:`18711`.)" msgstr "" #: ../../whatsnew/3.5.rst:2199 @@ -3461,29 +3482,29 @@ msgid "" "A new :c:data:`PyExc_RecursionError` exception. (Contributed by Georg Brandl " "in :issue:`19235`.)" msgstr "" -"新增 :c:data:`PyExc_RecursionError` 例外。(由 Georg Brandl 在 :issue:`19235` 中貢獻。)" +"新增 :c:data:`PyExc_RecursionError` 例外。(由 Georg Brandl " +"在 :issue:`19235` 中貢獻。)" #: ../../whatsnew/3.5.rst:2202 msgid "" "New :c:func:`PyModule_FromDefAndSpec`, :c:func:`PyModule_FromDefAndSpec2`, " "and :c:func:`PyModule_ExecDef` functions introduced by :pep:`489` -- multi-" -"phase extension module initialization. (Contributed by Petr Viktorin in :" -"issue:`24268`.)" +"phase extension module initialization. (Contributed by Petr Viktorin " +"in :issue:`24268`.)" msgstr "" #: ../../whatsnew/3.5.rst:2207 msgid "" -"New :c:func:`PyNumber_MatrixMultiply` and :c:func:" -"`PyNumber_InPlaceMatrixMultiply` functions to perform matrix multiplication. " -"(Contributed by Benjamin Peterson in :issue:`21176`. See also :pep:`465` " -"for details.)" +"New :c:func:`PyNumber_MatrixMultiply` " +"and :c:func:`PyNumber_InPlaceMatrixMultiply` functions to perform matrix " +"multiplication. (Contributed by Benjamin Peterson in :issue:`21176`. See " +"also :pep:`465` for details.)" msgstr "" #: ../../whatsnew/3.5.rst:2213 msgid "" "The :c:member:`PyTypeObject.tp_finalize` slot is now part of the stable ABI." -msgstr "" -":c:member:`PyTypeObject.tp_finalize` 插槽現在是穩定 ABI 的一部分。" +msgstr ":c:member:`PyTypeObject.tp_finalize` 插槽現在是穩定 ABI 的一部分。" #: ../../whatsnew/3.5.rst:2215 msgid "" @@ -3585,8 +3606,8 @@ msgstr "已棄用的 Python 行為" msgid "" "Raising the :exc:`StopIteration` exception inside a generator will now " "generate a silent :exc:`PendingDeprecationWarning`, which will become a non-" -"silent deprecation warning in Python 3.6 and will trigger a :exc:" -"`RuntimeError` in Python 3.7. See :ref:`PEP 479: Change StopIteration " +"silent deprecation warning in Python 3.6 and will trigger " +"a :exc:`RuntimeError` in Python 3.7. See :ref:`PEP 479: Change StopIteration " "handling inside generators ` for details." msgstr "" @@ -3612,8 +3633,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:2296 msgid "" -"The :func:`!asyncio.async` function is deprecated in favor of :func:" -"`~asyncio.ensure_future`." +"The :func:`!asyncio.async` function is deprecated in favor " +"of :func:`~asyncio.ensure_future`." msgstr "" #: ../../whatsnew/3.5.rst:2299 @@ -3627,19 +3648,20 @@ msgstr "" #: ../../whatsnew/3.5.rst:2305 msgid "" -"Directly assigning values to the :attr:`~http.cookies.Morsel.key`, :attr:" -"`~http.cookies.Morsel.value` and :attr:`~http.cookies.Morsel.coded_value` " -"of :class:`http.cookies.Morsel` objects is deprecated. Use the :meth:`~http." -"cookies.Morsel.set` method instead. In addition, the undocumented " -"*LegalChars* parameter of :meth:`~http.cookies.Morsel.set` is deprecated, " -"and is now ignored." +"Directly assigning values to " +"the :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel.value` " +"and :attr:`~http.cookies.Morsel.coded_value` of :class:`http.cookies.Morsel` " +"objects is deprecated. Use the :meth:`~http.cookies.Morsel.set` method " +"instead. In addition, the undocumented *LegalChars* parameter " +"of :meth:`~http.cookies.Morsel.set` is deprecated, and is now ignored." msgstr "" #: ../../whatsnew/3.5.rst:2312 msgid "" -"Passing a format string as keyword argument *format_string* to the :meth:" -"`~string.Formatter.format` method of the :class:`string.Formatter` class has " -"been deprecated. (Contributed by Serhiy Storchaka in :issue:`23671`.)" +"Passing a format string as keyword argument *format_string* to " +"the :meth:`~string.Formatter.format` method of the :class:`string.Formatter` " +"class has been deprecated. (Contributed by Serhiy Storchaka " +"in :issue:`23671`.)" msgstr "" #: ../../whatsnew/3.5.rst:2317 @@ -3653,9 +3675,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:2322 msgid "" "The previously undocumented ``from_function`` and ``from_builtin`` methods " -"of :class:`inspect.Signature` are deprecated. Use the new :meth:`Signature." -"from_callable() ` method instead. " -"(Contributed by Yury Selivanov in :issue:`24248`.)" +"of :class:`inspect.Signature` are deprecated. Use the " +"new :meth:`Signature.from_callable() ` " +"method instead. (Contributed by Yury Selivanov in :issue:`24248`.)" msgstr "" #: ../../whatsnew/3.5.rst:2327 @@ -3666,10 +3688,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:2330 msgid "" -"The :mod:`inspect` :func:`~inspect.getfullargspec`, :func:`~inspect." -"getcallargs`, and :func:`!formatargspec` functions are deprecated in favor " -"of the :func:`inspect.signature` API. (Contributed by Yury Selivanov in :" -"issue:`20438`.)" +"The :mod:`inspect` :func:`~inspect.getfullargspec`, :func:`~inspect.getcallargs`, " +"and :func:`!formatargspec` functions are deprecated in favor of " +"the :func:`inspect.signature` API. (Contributed by Yury Selivanov " +"in :issue:`20438`.)" msgstr "" #: ../../whatsnew/3.5.rst:2335 @@ -3694,10 +3716,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:2346 msgid "" -"The undocumented and unofficial *use_load_tests* default argument of the :" -"meth:`unittest.TestLoader.loadTestsFromModule` method now is deprecated and " -"ignored. (Contributed by Robert Collins and Barry A. Warsaw in :issue:" -"`16662`.)" +"The undocumented and unofficial *use_load_tests* default argument of " +"the :meth:`unittest.TestLoader.loadTestsFromModule` method now is deprecated " +"and ignored. (Contributed by Robert Collins and Barry A. Warsaw " +"in :issue:`16662`.)" msgstr "" #: ../../whatsnew/3.5.rst:2353 @@ -3787,16 +3809,16 @@ msgstr "" msgid "" "Before Python 3.5, a :class:`datetime.time` object was considered to be " "false if it represented midnight in UTC. This behavior was considered " -"obscure and error-prone and has been removed in Python 3.5. See :issue:" -"`13936` for full details." +"obscure and error-prone and has been removed in Python 3.5. " +"See :issue:`13936` for full details." msgstr "" #: ../../whatsnew/3.5.rst:2408 msgid "" -"The :meth:`!ssl.SSLSocket.send` method now raises either :exc:`ssl." -"SSLWantReadError` or :exc:`ssl.SSLWantWriteError` on a non-blocking socket " -"if the operation would block. Previously, it would return ``0``. " -"(Contributed by Nikolaus Rath in :issue:`20951`.)" +"The :meth:`!ssl.SSLSocket.send` method now raises " +"either :exc:`ssl.SSLWantReadError` or :exc:`ssl.SSLWantWriteError` on a non-" +"blocking socket if the operation would block. Previously, it would return " +"``0``. (Contributed by Nikolaus Rath in :issue:`20951`.)" msgstr "" #: ../../whatsnew/3.5.rst:2413 @@ -3810,12 +3832,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:2420 msgid "" -"The deprecated \"strict\" mode and argument of :class:`~html.parser." -"HTMLParser`, :meth:`!HTMLParser.error`, and the :exc:`!HTMLParserError` " -"exception have been removed. (Contributed by Ezio Melotti in :issue:" -"`15114`.) The *convert_charrefs* argument of :class:`~html.parser." -"HTMLParser` is now ``True`` by default. (Contributed by Berker Peksag in :" -"issue:`21047`.)" +"The deprecated \"strict\" mode and argument " +"of :class:`~html.parser.HTMLParser`, :meth:`!HTMLParser.error`, and " +"the :exc:`!HTMLParserError` exception have been removed. (Contributed by " +"Ezio Melotti in :issue:`15114`.) The *convert_charrefs* argument " +"of :class:`~html.parser.HTMLParser` is now ``True`` by default. " +"(Contributed by Berker Peksag in :issue:`21047`.)" msgstr "" #: ../../whatsnew/3.5.rst:2426 @@ -3829,11 +3851,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:2432 msgid "" -"If the current directory is set to a directory that no longer exists then :" -"exc:`FileNotFoundError` will no longer be raised and instead :meth:" -"`~importlib.machinery.FileFinder.find_spec` will return ``None`` **without** " -"caching ``None`` in :data:`sys.path_importer_cache`, which is different than " -"the typical case (:issue:`22834`)." +"If the current directory is set to a directory that no longer exists " +"then :exc:`FileNotFoundError` will no longer be raised and " +"instead :meth:`~importlib.machinery.FileFinder.find_spec` will return " +"``None`` **without** caching ``None`` in :data:`sys.path_importer_cache`, " +"which is different than the typical case (:issue:`22834`)." msgstr "" #: ../../whatsnew/3.5.rst:2438 @@ -3868,28 +3890,29 @@ msgstr "" #: ../../whatsnew/3.5.rst:2459 msgid "" "The :class:`http.cookies.Morsel` dict-like interface has been made self " -"consistent: morsel comparison now takes the :attr:`~http.cookies.Morsel." -"key` and :attr:`~http.cookies.Morsel.value` into account, :meth:`~http." -"cookies.Morsel.copy` now results in a :class:`~http.cookies.Morsel` instance " -"rather than a :class:`dict`, and :meth:`~http.cookies.Morsel.update` will " -"now raise an exception if any of the keys in the update dictionary are " -"invalid. In addition, the undocumented *LegalChars* parameter of :func:" -"`~http.cookies.Morsel.set` is deprecated and is now ignored. (Contributed " -"by Demian Brecht in :issue:`2211`.)" +"consistent: morsel comparison now takes " +"the :attr:`~http.cookies.Morsel.key` and :attr:`~http.cookies.Morsel.value` " +"into account, :meth:`~http.cookies.Morsel.copy` now results in " +"a :class:`~http.cookies.Morsel` instance rather than a :class:`dict`, " +"and :meth:`~http.cookies.Morsel.update` will now raise an exception if any " +"of the keys in the update dictionary are invalid. In addition, the " +"undocumented *LegalChars* parameter of :func:`~http.cookies.Morsel.set` is " +"deprecated and is now ignored. (Contributed by Demian Brecht " +"in :issue:`2211`.)" msgstr "" #: ../../whatsnew/3.5.rst:2469 msgid "" ":pep:`488` has removed ``.pyo`` files from Python and introduced the " -"optional ``opt-`` tag in ``.pyc`` file names. The :func:`importlib.util." -"cache_from_source` has gained an *optimization* parameter to help control " -"the ``opt-`` tag. Because of this, the *debug_override* parameter of the " -"function is now deprecated. ``.pyo`` files are also no longer supported as a " -"file argument to the Python interpreter and thus serve no purpose when " -"distributed on their own (i.e. sourceless code distribution). Due to the " -"fact that the magic number for bytecode has changed in Python 3.5, all old " -"``.pyo`` files from previous versions of Python are invalid regardless of " -"this PEP." +"optional ``opt-`` tag in ``.pyc`` file names. " +"The :func:`importlib.util.cache_from_source` has gained an *optimization* " +"parameter to help control the ``opt-`` tag. Because of this, the " +"*debug_override* parameter of the function is now deprecated. ``.pyo`` files " +"are also no longer supported as a file argument to the Python interpreter " +"and thus serve no purpose when distributed on their own (i.e. sourceless " +"code distribution). Due to the fact that the magic number for bytecode has " +"changed in Python 3.5, all old ``.pyo`` files from previous versions of " +"Python are invalid regardless of this PEP." msgstr "" #: ../../whatsnew/3.5.rst:2480 @@ -3933,16 +3956,17 @@ msgid "" "duplicated if the inherited documentation is appropriate. To suppress an " "inherited string, an empty string must be specified (or the documentation " "may be filled in). This change affects the output of the :mod:`pydoc` " -"module and the :func:`help` function. (Contributed by Serhiy Storchaka in :" -"issue:`15582`.)" +"module and the :func:`help` function. (Contributed by Serhiy Storchaka " +"in :issue:`15582`.)" msgstr "" #: ../../whatsnew/3.5.rst:2507 msgid "" "Nested :func:`functools.partial` calls are now flattened. If you were " -"relying on the previous behavior, you can now either add an attribute to a :" -"func:`functools.partial` object or you can create a subclass of :func:" -"`functools.partial`. (Contributed by Alexander Belopolsky in :issue:`7830`.)" +"relying on the previous behavior, you can now either add an attribute to " +"a :func:`functools.partial` object or you can create a subclass " +"of :func:`functools.partial`. (Contributed by Alexander Belopolsky " +"in :issue:`7830`.)" msgstr "" #: ../../whatsnew/3.5.rst:2514 @@ -3958,8 +3982,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:2521 msgid "" -"The :c:type:`!PyMemAllocator` structure was renamed to :c:type:" -"`PyMemAllocatorEx` and a new ``calloc`` field was added." +"The :c:type:`!PyMemAllocator` structure was renamed " +"to :c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "" #: ../../whatsnew/3.5.rst:2524 @@ -3974,17 +3998,17 @@ msgstr "" msgid "" "Because the lack of the :attr:`~type.__module__` attribute breaks pickling " "and introspection, a deprecation warning is now raised for builtin types " -"without the :attr:`~type.__module__` attribute. This will be an :exc:" -"`AttributeError` in the future. (Contributed by Serhiy Storchaka in :issue:" -"`20204`.)" +"without the :attr:`~type.__module__` attribute. This will be " +"an :exc:`AttributeError` in the future. (Contributed by Serhiy Storchaka " +"in :issue:`20204`.)" msgstr "" #: ../../whatsnew/3.5.rst:2535 msgid "" -"As part of the :pep:`492` implementation, the ``tp_reserved`` slot of :c:" -"type:`PyTypeObject` was replaced with a :c:member:`~PyTypeObject." -"tp_as_async` slot. Refer to :ref:`coro-objects` for new types, structures " -"and functions." +"As part of the :pep:`492` implementation, the ``tp_reserved`` slot " +"of :c:type:`PyTypeObject` was replaced with " +"a :c:member:`~PyTypeObject.tp_as_async` slot. Refer to :ref:`coro-objects` " +"for new types, structures and functions." msgstr "" #: ../../whatsnew/3.5.rst:2542 @@ -4012,8 +4036,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:2556 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" #: ../../whatsnew/3.5.rst:2559 ../../whatsnew/3.5.rst:2572 diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index 9550eabaa90..ffb1399fae8 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-04 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -27,9 +27,10 @@ msgid "Elvis Pranskevichus , Yury Selivanov " msgstr "Elvis Pranskevichus , Yury Selivanov " #: ../../whatsnew/3.6.rst:47 +#, fuzzy msgid "" "This article explains the new features in Python 3.6, compared to 3.5. " -"Python 3.6 was released on December 23, 2016.  See the `changelog `_ for a full list of changes." msgstr "" "本文介紹了 Python 3.6 與 3.5 相比多了哪些新功能。Python 3.6 已於 2016 年 12 " @@ -84,12 +85,12 @@ msgstr "CPython 實作改進:" #: ../../whatsnew/3.6.rst:80 msgid "" -"The :ref:`dict ` type has been reimplemented to use a :ref:" -"`more compact representation ` based on `a proposal " -"by Raymond Hettinger `_ and similar to the `PyPy dict implementation`_. " -"This resulted in dictionaries using 20% to 25% less memory when compared to " -"Python 3.5." +"The :ref:`dict ` type has been reimplemented to use " +"a :ref:`more compact representation ` based on `a " +"proposal by Raymond Hettinger `_ and similar to the `PyPy dict " +"implementation`_. This resulted in dictionaries using 20% to 25% less " +"memory when compared to Python 3.5." msgstr "" #: ../../whatsnew/3.6.rst:87 @@ -217,8 +218,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:159 msgid "" "``python.exe`` and ``pythonw.exe`` have been marked as long-path aware, " -"which means that the 260 character path limit may no longer apply. See :ref:" -"`removing the MAX_PATH limitation ` for details." +"which means that the 260 character path limit may no longer apply. " +"See :ref:`removing the MAX_PATH limitation ` for details." msgstr "" #: ../../whatsnew/3.6.rst:163 @@ -230,9 +231,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:167 msgid "" -"A ``python36.zip`` file now works as a landmark to infer :envvar:" -"`PYTHONHOME`. See :ref:`the documentation ` for " -"more information." +"A ``python36.zip`` file now works as a landmark to " +"infer :envvar:`PYTHONHOME`. See :ref:`the documentation " +"` for more information." msgstr "" #: ../../whatsnew/3.6.rst:176 @@ -245,8 +246,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:183 msgid "" -":pep:`498` introduces a new kind of string literals: *f-strings*, or :ref:" -"`formatted string literals `." +":pep:`498` introduces a new kind of string literals: *f-strings*, " +"or :ref:`formatted string literals `." msgstr "" #: ../../whatsnew/3.6.rst:186 @@ -494,9 +495,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:348 msgid "" -"In order to allow zero-argument :func:`super` calls to work correctly from :" -"meth:`~object.__init_subclass__` implementations, custom metaclasses must " -"ensure that the new ``__classcell__`` namespace entry is propagated to " +"In order to allow zero-argument :func:`super` calls to work correctly " +"from :meth:`~object.__init_subclass__` implementations, custom metaclasses " +"must ensure that the new ``__classcell__`` namespace entry is propagated to " "``type.__new__`` (as described in :ref:`class-object-creation`)." msgstr "" @@ -518,13 +519,13 @@ msgstr "" #: ../../whatsnew/3.6.rst:366 msgid "" -":pep:`487` extends the descriptor protocol to include the new optional :meth:" -"`~object.__set_name__` method. Whenever a new class is defined, the new " -"method will be called on all descriptors included in the definition, " -"providing them with a reference to the class being defined and the name " -"given to the descriptor within the class namespace. In other words, " -"instances of descriptors can now know the attribute name of the descriptor " -"in the owner class::" +":pep:`487` extends the descriptor protocol to include the new " +"optional :meth:`~object.__set_name__` method. Whenever a new class is " +"defined, the new method will be called on all descriptors included in the " +"definition, providing them with a reference to the class being defined and " +"the name given to the descriptor within the class namespace. In other " +"words, instances of descriptors can now know the attribute name of the " +"descriptor in the owner class::" msgstr "" #: ../../whatsnew/3.6.rst:374 @@ -556,13 +557,13 @@ msgstr "" #: ../../whatsnew/3.6.rst:404 msgid "" -"File system paths have historically been represented as :class:`str` or :" -"class:`bytes` objects. This has led to people who write code which operate " -"on file system paths to assume that such objects are only one of those two " -"types (an :class:`int` representing a file descriptor does not count as that " -"is not a file path). Unfortunately that assumption prevents alternative " -"object representations of file system paths like :mod:`pathlib` from working " -"with pre-existing code, including Python's standard library." +"File system paths have historically been represented as :class:`str` " +"or :class:`bytes` objects. This has led to people who write code which " +"operate on file system paths to assume that such objects are only one of " +"those two types (an :class:`int` representing a file descriptor does not " +"count as that is not a file path). Unfortunately that assumption prevents " +"alternative object representations of file system paths like :mod:`pathlib` " +"from working with pre-existing code, including Python's standard library." msgstr "" #: ../../whatsnew/3.6.rst:413 @@ -572,8 +573,8 @@ msgid "" "method, an object signals that it represents a path. An object can then " "provide a low-level representation of a file system path as a :class:`str` " "or :class:`bytes` object. This means an object is considered :term:`path-" -"like ` if it implements :class:`os.PathLike` or is a :" -"class:`str` or :class:`bytes` object which represents a file system path. " +"like ` if it implements :class:`os.PathLike` or is " +"a :class:`str` or :class:`bytes` object which represents a file system path. " "Code can use :func:`os.fspath`, :func:`os.fsdecode`, or :func:`os.fsencode` " "to explicitly get a :class:`str` and/or :class:`bytes` representation of a " "path-like object." @@ -581,26 +582,28 @@ msgstr "" #: ../../whatsnew/3.6.rst:426 msgid "" -"The built-in :func:`open` function has been updated to accept :class:`os." -"PathLike` objects, as have all relevant functions in the :mod:`os` and :mod:" -"`os.path` modules, and most other functions and classes in the standard " -"library. The :class:`os.DirEntry` class and relevant classes in :mod:" -"`pathlib` have also been updated to implement :class:`os.PathLike`." +"The built-in :func:`open` function has been updated to " +"accept :class:`os.PathLike` objects, as have all relevant functions in " +"the :mod:`os` and :mod:`os.path` modules, and most other functions and " +"classes in the standard library. The :class:`os.DirEntry` class and " +"relevant classes in :mod:`pathlib` have also been updated to " +"implement :class:`os.PathLike`." msgstr "" #: ../../whatsnew/3.6.rst:433 msgid "" "The hope is that updating the fundamental functions for operating on file " -"system paths will lead to third-party code to implicitly support all :term:" -"`path-like objects ` without any code changes, or at least " -"very minimal ones (e.g. calling :func:`os.fspath` at the beginning of code " -"before operating on a path-like object)." +"system paths will lead to third-party code to implicitly support " +"all :term:`path-like objects ` without any code changes, " +"or at least very minimal ones (e.g. calling :func:`os.fspath` at the " +"beginning of code before operating on a path-like object)." msgstr "" #: ../../whatsnew/3.6.rst:440 msgid "" -"Here are some examples of how the new interface allows for :class:`pathlib." -"Path` to be used more easily and transparently with pre-existing code::" +"Here are some examples of how the new interface allows " +"for :class:`pathlib.Path` to be used more easily and transparently with pre-" +"existing code::" msgstr "" #: ../../whatsnew/3.6.rst:444 @@ -660,9 +663,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:476 msgid "" -":pep:`495` adds the new *fold* attribute to instances of :class:`datetime." -"datetime` and :class:`datetime.time` classes to differentiate between two " -"moments in time for which local times are the same::" +":pep:`495` adds the new *fold* attribute to instances " +"of :class:`datetime.datetime` and :class:`datetime.time` classes to " +"differentiate between two moments in time for which local times are the " +"same::" msgstr "" #: ../../whatsnew/3.6.rst:480 @@ -721,17 +725,17 @@ msgstr "" msgid "" "Prior to Python 3.6, data loss could result when using bytes paths on " "Windows. With this change, using bytes to represent paths is now supported " -"on Windows, provided those bytes are encoded with the encoding returned by :" -"func:`sys.getfilesystemencoding`, which now defaults to ``'utf-8'``." +"on Windows, provided those bytes are encoded with the encoding returned " +"by :func:`sys.getfilesystemencoding`, which now defaults to ``'utf-8'``." msgstr "" #: ../../whatsnew/3.6.rst:516 msgid "" -"Applications that do not use str to represent paths should use :func:`os." -"fsencode` and :func:`os.fsdecode` to ensure their bytes are correctly " -"encoded. To revert to the previous behaviour, set :envvar:" -"`PYTHONLEGACYWINDOWSFSENCODING` or call :func:`sys." -"_enablelegacywindowsfsencoding`." +"Applications that do not use str to represent paths should " +"use :func:`os.fsencode` and :func:`os.fsdecode` to ensure their bytes are " +"correctly encoded. To revert to the previous behaviour, " +"set :envvar:`PYTHONLEGACYWINDOWSFSENCODING` or " +"call :func:`sys._enablelegacywindowsfsencoding`." msgstr "" #: ../../whatsnew/3.6.rst:522 @@ -747,8 +751,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:531 msgid "" "The default console on Windows will now accept all Unicode characters and " -"provide correctly read str objects to Python code. ``sys.stdin``, ``sys." -"stdout`` and ``sys.stderr`` now default to utf-8 encoding." +"provide correctly read str objects to Python code. ``sys.stdin``, " +"``sys.stdout`` and ``sys.stderr`` now default to utf-8 encoding." msgstr "" #: ../../whatsnew/3.6.rst:535 @@ -779,8 +783,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:554 msgid "" -"Also, the effective default class *execution* namespace (returned from :ref:" -"`type.__prepare__() `) is now an insertion-order-preserving mapping." +"Also, the effective default class *execution* namespace (returned " +"from :ref:`type.__prepare__() `) is now an insertion-order-" +"preserving mapping." msgstr "" #: ../../whatsnew/3.6.rst:560 @@ -814,9 +819,9 @@ msgid "" "The :ref:`dict ` type now uses a \"compact\" representation " "based on `a proposal by Raymond Hettinger `_ which was `first implemented by PyPy " -"`_. The memory usage of the new :func:`dict` is between 20% and 25% " -"smaller compared to Python 3.5." +"`_. The memory usage of the new :func:`dict` is between 20% and " +"25% smaller compared to Python 3.5." msgstr "" #: ../../whatsnew/3.6.rst:591 @@ -827,8 +832,8 @@ msgid "" "language for a few releases before changing the language spec to mandate " "order-preserving semantics for all current and future Python " "implementations; this also helps preserve backwards-compatibility with older " -"versions of the language where random iteration order is still in effect, e." -"g. Python 3.5)." +"versions of the language where random iteration order is still in effect, " +"e.g. Python 3.5)." msgstr "" #: ../../whatsnew/3.6.rst:600 @@ -903,8 +908,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:647 msgid "" -"Detect violations of the Python memory allocator API. For example, :c:func:" -"`PyObject_Free` called on a memory block allocated by :c:func:`PyMem_Malloc`." +"Detect violations of the Python memory allocator API. For " +"example, :c:func:`PyObject_Free` called on a memory block allocated " +"by :c:func:`PyMem_Malloc`." msgstr "" #: ../../whatsnew/3.6.rst:650 @@ -943,8 +949,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:666 msgid "" -"On error, the debug hooks on Python memory allocators now use the :mod:" -"`tracemalloc` module to get the traceback where a memory block was allocated." +"On error, the debug hooks on Python memory allocators now use " +"the :mod:`tracemalloc` module to get the traceback where a memory block was " +"allocated." msgstr "" #: ../../whatsnew/3.6.rst:670 @@ -1085,8 +1092,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:742 msgid "" "A ``global`` or ``nonlocal`` statement must now textually appear before the " -"first use of the affected name in the same scope. Previously this was a :exc:" -"`SyntaxWarning`." +"first use of the affected name in the same scope. Previously this was " +"a :exc:`SyntaxWarning`." msgstr "" #: ../../whatsnew/3.6.rst:746 @@ -1094,8 +1101,8 @@ msgid "" "It is now possible to set a :ref:`special method ` to ``None`` " "to indicate that the corresponding operation is not available. For example, " "if a class sets :meth:`~object.__iter__` to ``None``, the class is not " -"iterable. (Contributed by Andrew Barnert and Ivan Levkivskyi in :issue:" -"`25958`.)" +"iterable. (Contributed by Andrew Barnert and Ivan Levkivskyi " +"in :issue:`25958`.)" msgstr "" #: ../../whatsnew/3.6.rst:752 @@ -1107,10 +1114,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:757 msgid "" -"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass of :" -"exc:`ImportError`) when it cannot find a module. Code that currently checks " -"for ImportError (in try-except) will still work. (Contributed by Eric Snow " -"in :issue:`15767`.)" +"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass " +"of :exc:`ImportError`) when it cannot find a module. Code that currently " +"checks for ImportError (in try-except) will still work. (Contributed by Eric " +"Snow in :issue:`15767`.)" msgstr "" #: ../../whatsnew/3.6.rst:762 @@ -1139,8 +1146,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:781 msgid "" "Note that the pseudo-random generators in the :mod:`random` module should " -"*NOT* be used for security purposes. Use :mod:`secrets` on Python 3.6+ and :" -"func:`os.urandom` on Python 3.5 and earlier." +"*NOT* be used for security purposes. Use :mod:`secrets` on Python 3.6+ " +"and :func:`os.urandom` on Python 3.5 and earlier." msgstr "" #: ../../whatsnew/3.6.rst:787 @@ -1245,9 +1252,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:850 msgid "" -"New :meth:`loop.get_exception_handler() ` method to get the current exception handler. " -"(Contributed by Yury Selivanov in :issue:`27040`.)" +"New :meth:`loop.get_exception_handler() " +"` method to get the current exception " +"handler. (Contributed by Yury Selivanov in :issue:`27040`.)" msgstr "" #: ../../whatsnew/3.6.rst:854 @@ -1259,9 +1266,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:859 msgid "" -"The performance of :meth:`StreamReader.readexactly() ` has been improved. (Contributed by Mark Korenberg in :issue:" -"`28370`.)" +"The performance of :meth:`StreamReader.readexactly() " +"` has been improved. (Contributed by Mark " +"Korenberg in :issue:`28370`.)" msgstr "" #: ../../whatsnew/3.6.rst:863 @@ -1281,16 +1288,16 @@ msgstr "" #: ../../whatsnew/3.6.rst:874 msgid "" -":meth:`Future.set_exception ` will now raise :" -"exc:`TypeError` when passed an instance of the :exc:`StopIteration` " +":meth:`Future.set_exception ` will now " +"raise :exc:`TypeError` when passed an instance of the :exc:`StopIteration` " "exception. (Contributed by Chris Angelico in :issue:`26221`.)" msgstr "" #: ../../whatsnew/3.6.rst:879 msgid "" -"New :meth:`loop.connect_accepted_socket() ` method to be used by servers that accept " -"connections outside of asyncio, but that use asyncio to handle them. " +"New :meth:`loop.connect_accepted_socket() " +"` method to be used by servers that " +"accept connections outside of asyncio, but that use asyncio to handle them. " "(Contributed by Jim Fulton in :issue:`27392`.)" msgstr "" @@ -1338,10 +1345,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:914 msgid "" -"New constants: :const:`cmath.inf` and :const:`cmath.nan` to match :const:" -"`math.inf` and :const:`math.nan`, and also :const:`cmath.infj` and :const:" -"`cmath.nanj` to match the format used by complex repr. (Contributed by Mark " -"Dickinson in :issue:`23229`.)" +"New constants: :const:`cmath.inf` and :const:`cmath.nan` to " +"match :const:`math.inf` and :const:`math.nan`, and also :const:`cmath.infj` " +"and :const:`cmath.nanj` to match the format used by complex repr. " +"(Contributed by Mark Dickinson in :issue:`23229`.)" msgstr "" #: ../../whatsnew/3.6.rst:921 @@ -1365,16 +1372,16 @@ msgstr "" #: ../../whatsnew/3.6.rst:931 msgid "" "The new :class:`~collections.abc.AsyncGenerator` abstract base class " -"represents asynchronous generators. (Contributed by Yury Selivanov in :issue:" -"`28720`.)" +"represents asynchronous generators. (Contributed by Yury Selivanov " +"in :issue:`28720`.)" msgstr "" #: ../../whatsnew/3.6.rst:935 msgid "" "The :func:`~collections.namedtuple` function now accepts an optional keyword " -"argument *module*, which, when specified, is used for the :attr:`~type." -"__module__` attribute of the returned named tuple class. (Contributed by " -"Raymond Hettinger in :issue:`17941`.)" +"argument *module*, which, when specified, is used for " +"the :attr:`~type.__module__` attribute of the returned named tuple class. " +"(Contributed by Raymond Hettinger in :issue:`17941`.)" msgstr "" #: ../../whatsnew/3.6.rst:940 ../../whatsnew/3.6.rst:2297 @@ -1410,9 +1417,9 @@ msgid "" "The :class:`contextlib.AbstractContextManager` class has been added to " "provide an abstract base class for context managers. It provides a sensible " "default implementation for ``__enter__()`` which returns ``self`` and leaves " -"``__exit__()`` an abstract method. A matching class has been added to the :" -"mod:`typing` module as :class:`typing.ContextManager`. (Contributed by Brett " -"Cannon in :issue:`25609`.)" +"``__exit__()`` an abstract method. A matching class has been added to " +"the :mod:`typing` module as :class:`typing.ContextManager`. (Contributed by " +"Brett Cannon in :issue:`25609`.)" msgstr "" #: ../../whatsnew/3.6.rst:971 @@ -1431,10 +1438,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:981 msgid "" -"The :meth:`datetime.strftime() ` and :meth:`date." -"strftime() ` methods now support ISO 8601 date " -"directives ``%G``, ``%u`` and ``%V``. (Contributed by Ashley Anderson in :" -"issue:`12006`.)" +"The :meth:`datetime.strftime() ` " +"and :meth:`date.strftime() ` methods now support ISO " +"8601 date directives ``%G``, ``%u`` and ``%V``. (Contributed by Ashley " +"Anderson in :issue:`12006`.)" msgstr "" #: ../../whatsnew/3.6.rst:986 @@ -1448,8 +1455,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:991 msgid "" "The :meth:`datetime.combine() ` now accepts an " -"optional *tzinfo* argument. (Contributed by Alexander Belopolsky in :issue:" -"`27661`.)" +"optional *tzinfo* argument. (Contributed by Alexander Belopolsky " +"in :issue:`27661`.)" msgstr "" #: ../../whatsnew/3.6.rst:997 @@ -1459,9 +1466,9 @@ msgstr "decimal" #: ../../whatsnew/3.6.rst:999 msgid "" "New :meth:`Decimal.as_integer_ratio() ` " -"method that returns a pair ``(n, d)`` of integers that represent the given :" -"class:`~decimal.Decimal` instance as a fraction, in lowest terms and with a " -"positive denominator::" +"method that returns a pair ``(n, d)`` of integers that represent the " +"given :class:`~decimal.Decimal` instance as a fraction, in lowest terms and " +"with a positive denominator::" msgstr "" #: ../../whatsnew/3.6.rst:1004 @@ -1482,9 +1489,9 @@ msgstr "distutils" #: ../../whatsnew/3.6.rst:1014 msgid "" -"The ``default_format`` attribute has been removed from ``distutils.command." -"sdist.sdist`` and the ``formats`` attribute defaults to ``['gztar']``. " -"Although not anticipated, any code relying on the presence of " +"The ``default_format`` attribute has been removed from " +"``distutils.command.sdist.sdist`` and the ``formats`` attribute defaults to " +"``['gztar']``. Although not anticipated, any code relying on the presence of " "``default_format`` may need to be adapted. See :issue:`27819` for more " "details." msgstr "" @@ -1498,8 +1505,8 @@ msgid "" "The new email API, enabled via the *policy* keyword to various constructors, " "is no longer provisional. The :mod:`email` documentation has been " "reorganized and rewritten to focus on the new API, while retaining the old " -"documentation for the legacy API. (Contributed by R. David Murray in :issue:" -"`24277`.)" +"documentation for the legacy API. (Contributed by R. David Murray " +"in :issue:`24277`.)" msgstr "" #: ../../whatsnew/3.6.rst:1029 @@ -1516,12 +1523,13 @@ msgstr "" #: ../../whatsnew/3.6.rst:1035 msgid "" -"There is a new :mod:`~email.policy` attribute, :attr:`~email.policy.Policy." -"message_factory`, that controls what class is used by default when the " -"parser creates new message objects. For the :attr:`email.policy.compat32` " -"policy this is :class:`~email.message.Message`, for the new policies it is :" -"class:`~email.message.EmailMessage`. (Contributed by R. David Murray in :" -"issue:`20476`.)" +"There is a new :mod:`~email.policy` " +"attribute, :attr:`~email.policy.Policy.message_factory`, that controls what " +"class is used by default when the parser creates new message objects. For " +"the :attr:`email.policy.compat32` policy this " +"is :class:`~email.message.Message`, for the new policies it " +"is :class:`~email.message.EmailMessage`. (Contributed by R. David Murray " +"in :issue:`20476`.)" msgstr "" #: ../../whatsnew/3.6.rst:1044 @@ -1541,16 +1549,16 @@ msgstr "enum" #: ../../whatsnew/3.6.rst:1054 msgid "" -"Two new enumeration base classes have been added to the :mod:`enum` module: :" -"class:`~enum.Flag` and :class:`~enum.IntFlag`. Both are used to define " -"constants that can be combined using the bitwise operators. (Contributed by " -"Ethan Furman in :issue:`23591`.)" +"Two new enumeration base classes have been added to the :mod:`enum` " +"module: :class:`~enum.Flag` and :class:`~enum.IntFlag`. Both are used to " +"define constants that can be combined using the bitwise operators. " +"(Contributed by Ethan Furman in :issue:`23591`.)" msgstr "" #: ../../whatsnew/3.6.rst:1059 msgid "" -"Many standard library modules have been updated to use the :class:`~enum." -"IntFlag` class for their constants." +"Many standard library modules have been updated to use " +"the :class:`~enum.IntFlag` class for their constants." msgstr "" #: ../../whatsnew/3.6.rst:1062 @@ -1621,19 +1629,19 @@ msgstr "" #: ../../whatsnew/3.6.rst:1102 msgid "" -"The SHA-3 hash functions :func:`~hashlib.sha3_224`, :func:`~hashlib." -"sha3_256`, :func:`~hashlib.sha3_384`, :func:`~hashlib.sha3_512`, and SHAKE " -"hash functions :func:`~hashlib.shake_128` and :func:`~hashlib.shake_256` " -"were added. (Contributed by Christian Heimes in :issue:`16113`. Keccak Code " -"Package by Guido Bertoni, Joan Daemen, Michaël Peeters, Gilles Van Assche, " -"and Ronny Van Keer.)" +"The SHA-3 hash " +"functions :func:`~hashlib.sha3_224`, :func:`~hashlib.sha3_256`, :func:`~hashlib.sha3_384`, :func:`~hashlib.sha3_512`, " +"and SHAKE hash functions :func:`~hashlib.shake_128` " +"and :func:`~hashlib.shake_256` were added. (Contributed by Christian Heimes " +"in :issue:`16113`. Keccak Code Package by Guido Bertoni, Joan Daemen, " +"Michaël Peeters, Gilles Van Assche, and Ronny Van Keer.)" msgstr "" #: ../../whatsnew/3.6.rst:1109 msgid "" "The password-based key derivation function :func:`~hashlib.scrypt` is now " -"available with OpenSSL 1.1.0 and newer. (Contributed by Christian Heimes in :" -"issue:`27928`.)" +"available with OpenSSL 1.1.0 and newer. (Contributed by Christian Heimes " +"in :issue:`27928`.)" msgstr "" #: ../../whatsnew/3.6.rst:1114 @@ -1642,10 +1650,10 @@ msgstr "http.client" #: ../../whatsnew/3.6.rst:1116 msgid "" -":meth:`HTTPConnection.request() ` and :" -"meth:`~http.client.HTTPConnection.endheaders` both now support chunked " -"encoding request bodies. (Contributed by Demian Brecht and Rolf Krahl in :" -"issue:`12319`.)" +":meth:`HTTPConnection.request() ` " +"and :meth:`~http.client.HTTPConnection.endheaders` both now support chunked " +"encoding request bodies. (Contributed by Demian Brecht and Rolf Krahl " +"in :issue:`12319`.)" msgstr "" #: ../../whatsnew/3.6.rst:1123 @@ -1668,10 +1676,10 @@ msgid "" "renaming of files with partial uppercase names is similar to the renaming " "of, for instance, Tkinter and TkFont to tkinter and tkinter.font in 3.0. As " "a result, imports of idlelib files that worked in 3.5 will usually not work " -"in 3.6. At least a module name change will be needed (see idlelib/README." -"txt), sometimes more. (Name changes contributed by Al Swiegart and Terry " -"Reedy in :issue:`24225`. Most idlelib patches since have been and will be " -"part of the process.)" +"in 3.6. At least a module name change will be needed (see idlelib/" +"README.txt), sometimes more. (Name changes contributed by Al Swiegart and " +"Terry Reedy in :issue:`24225`. Most idlelib patches since have been and " +"will be part of the process.)" msgstr "" #: ../../whatsnew/3.6.rst:1141 @@ -1687,8 +1695,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1147 msgid "" -"Multiple fixes for autocompletion. (Contributed by Louie Lu in :issue:" -"`15786`.)" +"Multiple fixes for autocompletion. (Contributed by Louie Lu " +"in :issue:`15786`.)" msgstr "" #: ../../whatsnew/3.6.rst:1149 @@ -1739,8 +1747,8 @@ msgid "" "Editor code context option revised. Box displays all context lines up to " "maxlines. Clicking on a context line jumps the editor to that line. " "Context colors for custom themes is added to Highlights tab of Settings " -"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy in :issue:" -"`33642`, :issue:`33768`, and :issue:`33679`.)" +"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy " +"in :issue:`33642`, :issue:`33768`, and :issue:`33679`.)" msgstr "" #: ../../whatsnew/3.6.rst:1182 @@ -1772,26 +1780,26 @@ msgstr "importlib" #: ../../whatsnew/3.6.rst:1201 msgid "" -"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass of :" -"exc:`ImportError`) when it cannot find a module. Code that current checks " -"for ``ImportError`` (in try-except) will still work. (Contributed by Eric " -"Snow in :issue:`15767`.)" +"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass " +"of :exc:`ImportError`) when it cannot find a module. Code that current " +"checks for ``ImportError`` (in try-except) will still work. (Contributed by " +"Eric Snow in :issue:`15767`.)" msgstr "" #: ../../whatsnew/3.6.rst:1206 msgid "" -":class:`importlib.util.LazyLoader` now calls :meth:`~importlib.abc.Loader." -"create_module` on the wrapped loader, removing the restriction that :class:" -"`importlib.machinery.BuiltinImporter` and :class:`importlib.machinery." -"ExtensionFileLoader` couldn't be used with :class:`importlib.util." -"LazyLoader`." +":class:`importlib.util.LazyLoader` now " +"calls :meth:`~importlib.abc.Loader.create_module` on the wrapped loader, " +"removing the restriction that :class:`importlib.machinery.BuiltinImporter` " +"and :class:`importlib.machinery.ExtensionFileLoader` couldn't be used " +"with :class:`importlib.util.LazyLoader`." msgstr "" #: ../../whatsnew/3.6.rst:1212 msgid "" -":func:`importlib.util.cache_from_source`, :func:`importlib.util." -"source_from_cache`, and :func:`importlib.util.spec_from_file_location` now " -"accept a :term:`path-like object`." +":func:`importlib.util.cache_from_source`, :func:`importlib.util.source_from_cache`, " +"and :func:`importlib.util.spec_from_file_location` now accept a :term:`path-" +"like object`." msgstr "" #: ../../whatsnew/3.6.rst:1219 @@ -1808,12 +1816,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:1226 msgid "" -"To reduce code churn when upgrading from Python 2.7 and the legacy :func:" -"`inspect.getargspec` API, the previously documented deprecation of :func:" -"`inspect.getfullargspec` has been reversed. While this function is " -"convenient for single/source Python 2/3 code bases, the richer :func:" -"`inspect.signature` interface remains the recommended approach for new code. " -"(Contributed by Nick Coghlan in :issue:`27172`)" +"To reduce code churn when upgrading from Python 2.7 and the " +"legacy :func:`inspect.getargspec` API, the previously documented deprecation " +"of :func:`inspect.getfullargspec` has been reversed. While this function is " +"convenient for single/source Python 2/3 code bases, the " +"richer :func:`inspect.signature` interface remains the recommended approach " +"for new code. (Contributed by Nick Coghlan in :issue:`27172`)" msgstr "" #: ../../whatsnew/3.6.rst:1235 @@ -1833,10 +1841,10 @@ msgstr "logging" #: ../../whatsnew/3.6.rst:1245 msgid "" -"The new :meth:`WatchedFileHandler.reopenIfNeeded() ` method has been added to add the ability " -"to check if the log file needs to be reopened. (Contributed by Marian Horban " -"in :issue:`24884`.)" +"The new :meth:`WatchedFileHandler.reopenIfNeeded() " +"` method has been added " +"to add the ability to check if the log file needs to be reopened. " +"(Contributed by Marian Horban in :issue:`24884`.)" msgstr "" #: ../../whatsnew/3.6.rst:1252 @@ -1856,9 +1864,9 @@ msgstr "multiprocessing" #: ../../whatsnew/3.6.rst:1262 msgid "" -":ref:`Proxy Objects ` returned by :func:" -"`multiprocessing.Manager` can now be nested. (Contributed by Davin Potts in :" -"issue:`6766`.)" +":ref:`Proxy Objects ` returned " +"by :func:`multiprocessing.Manager` can now be nested. (Contributed by Davin " +"Potts in :issue:`6766`.)" msgstr "" #: ../../whatsnew/3.6.rst:1268 ../../whatsnew/3.6.rst:2021 @@ -1878,11 +1886,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:1276 msgid "" -"A new :meth:`~os.scandir.close` method allows explicitly closing a :func:" -"`~os.scandir` iterator. The :func:`~os.scandir` iterator now supports the :" -"term:`context manager` protocol. If a :func:`!scandir` iterator is neither " -"exhausted nor explicitly closed a :exc:`ResourceWarning` will be emitted in " -"its destructor. (Contributed by Serhiy Storchaka in :issue:`25994`.)" +"A new :meth:`~os.scandir.close` method allows explicitly closing " +"a :func:`~os.scandir` iterator. The :func:`~os.scandir` iterator now " +"supports the :term:`context manager` protocol. If a :func:`!scandir` " +"iterator is neither exhausted nor explicitly closed a :exc:`ResourceWarning` " +"will be emitted in its destructor. (Contributed by Serhiy Storchaka " +"in :issue:`25994`.)" msgstr "" #: ../../whatsnew/3.6.rst:1286 @@ -1972,24 +1981,24 @@ msgstr "re" #: ../../whatsnew/3.6.rst:1347 msgid "" -"Added support of modifier spans in regular expressions. Examples: ``'(?i:" -"p)ython'`` matches ``'python'`` and ``'Python'``, but not ``'PYTHON'``; ``'(?" -"i)g(?-i:v)r'`` matches ``'GvR'`` and ``'gvr'``, but not ``'GVR'``. " +"Added support of modifier spans in regular expressions. Examples: ``'(?" +"i:p)ython'`` matches ``'python'`` and ``'Python'``, but not ``'PYTHON'``; " +"``'(?i)g(?-i:v)r'`` matches ``'GvR'`` and ``'gvr'``, but not ``'GVR'``. " "(Contributed by Serhiy Storchaka in :issue:`433028`.)" msgstr "" #: ../../whatsnew/3.6.rst:1352 msgid "" "Match object groups can be accessed by ``__getitem__``, which is equivalent " -"to ``group()``. So ``mo['name']`` is now equivalent to ``mo." -"group('name')``. (Contributed by Eric Smith in :issue:`24454`.)" +"to ``group()``. So ``mo['name']`` is now equivalent to " +"``mo.group('name')``. (Contributed by Eric Smith in :issue:`24454`.)" msgstr "" #: ../../whatsnew/3.6.rst:1356 msgid "" -":class:`~re.Match` objects now support :meth:`index-like objects ` as group indices. (Contributed by Jeroen Demeyer and Xiang Zhang " -"in :issue:`27177`.)" +":class:`~re.Match` objects now support :meth:`index-like objects " +"` as group indices. (Contributed by Jeroen Demeyer and " +"Xiang Zhang in :issue:`27177`.)" msgstr "" #: ../../whatsnew/3.6.rst:1363 @@ -1999,8 +2008,8 @@ msgstr "readline" #: ../../whatsnew/3.6.rst:1365 msgid "" "Added :func:`~readline.set_auto_history` to enable or disable automatic " -"addition of input to the history list. (Contributed by Tyler Crompton in :" -"issue:`26870`.)" +"addition of input to the history list. (Contributed by Tyler Crompton " +"in :issue:`26870`.)" msgstr "" #: ../../whatsnew/3.6.rst:1371 @@ -2011,8 +2020,8 @@ msgstr "rlcompleter" msgid "" "Private and special attribute names now are omitted unless the prefix starts " "with underscores. A space or a colon is added after some completed " -"keywords. (Contributed by Serhiy Storchaka in :issue:`25011` and :issue:" -"`25209`.)" +"keywords. (Contributed by Serhiy Storchaka in :issue:`25011` " +"and :issue:`25209`.)" msgstr "" #: ../../whatsnew/3.6.rst:1379 @@ -2054,9 +2063,9 @@ msgstr "socket" #: ../../whatsnew/3.6.rst:1406 msgid "" -"The :func:`~socket.socket.ioctl` function now supports the :const:`~socket." -"SIO_LOOPBACK_FAST_PATH` control code. (Contributed by Daniel Stokes in :" -"issue:`26536`.)" +"The :func:`~socket.socket.ioctl` function now supports " +"the :const:`~socket.SIO_LOOPBACK_FAST_PATH` control code. (Contributed by " +"Daniel Stokes in :issue:`26536`.)" msgstr "" #: ../../whatsnew/3.6.rst:1410 @@ -2069,16 +2078,16 @@ msgstr "" #: ../../whatsnew/3.6.rst:1414 msgid "" "The :meth:`~socket.socket.setsockopt` now supports the ``setsockopt(level, " -"optname, None, optlen: int)`` form. (Contributed by Christian Heimes in :" -"issue:`27744`.)" +"optname, None, optlen: int)`` form. (Contributed by Christian Heimes " +"in :issue:`27744`.)" msgstr "" #: ../../whatsnew/3.6.rst:1418 msgid "" "The socket module now supports the address family :const:`~socket.AF_ALG` to " -"interface with Linux Kernel crypto API. ``ALG_*``, ``SOL_ALG`` and :meth:" -"`~socket.socket.sendmsg_afalg` were added. (Contributed by Christian Heimes " -"in :issue:`27744` with support from Victor Stinner.)" +"interface with Linux Kernel crypto API. ``ALG_*``, ``SOL_ALG`` " +"and :meth:`~socket.socket.sendmsg_afalg` were added. (Contributed by " +"Christian Heimes in :issue:`27744` with support from Victor Stinner.)" msgstr "" #: ../../whatsnew/3.6.rst:1424 @@ -2093,19 +2102,19 @@ msgstr "socketserver" #: ../../whatsnew/3.6.rst:1431 msgid "" -"Servers based on the :mod:`socketserver` module, including those defined in :" -"mod:`http.server`, :mod:`xmlrpc.server` and :mod:`wsgiref.simple_server`, " -"now support the :term:`context manager` protocol. (Contributed by Aviv " -"Palivoda in :issue:`26404`.)" +"Servers based on the :mod:`socketserver` module, including those defined " +"in :mod:`http.server`, :mod:`xmlrpc.server` " +"and :mod:`wsgiref.simple_server`, now support the :term:`context manager` " +"protocol. (Contributed by Aviv Palivoda in :issue:`26404`.)" msgstr "" #: ../../whatsnew/3.6.rst:1437 msgid "" -"The :attr:`wfile ` attribute of :" -"class:`~socketserver.StreamRequestHandler` classes now implements the :class:" -"`io.BufferedIOBase` writable interface. In particular, calling :meth:`~io." -"BufferedIOBase.write` is now guaranteed to send the data in full. " -"(Contributed by Martin Panter in :issue:`26721`.)" +"The :attr:`wfile ` attribute " +"of :class:`~socketserver.StreamRequestHandler` classes now implements " +"the :class:`io.BufferedIOBase` writable interface. In particular, " +"calling :meth:`~io.BufferedIOBase.write` is now guaranteed to send the data " +"in full. (Contributed by Martin Panter in :issue:`26721`.)" msgstr "" #: ../../whatsnew/3.6.rst:1445 ../../whatsnew/3.6.rst:2037 @@ -2121,8 +2130,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1450 msgid "" "3DES has been removed from the default cipher suites and ChaCha20 Poly1305 " -"cipher suites have been added. (Contributed by Christian Heimes in :issue:" -"`27850` and :issue:`27766`.)" +"cipher suites have been added. (Contributed by Christian Heimes " +"in :issue:`27850` and :issue:`27766`.)" msgstr "" #: ../../whatsnew/3.6.rst:1454 @@ -2147,8 +2156,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:1467 msgid "" -"All constants and flags have been converted to :class:`~enum.IntEnum` and :" -"class:`~enum.IntFlag`. (Contributed by Christian Heimes in :issue:`28025`.)" +"All constants and flags have been converted to :class:`~enum.IntEnum` " +"and :class:`~enum.IntFlag`. (Contributed by Christian Heimes " +"in :issue:`28025`.)" msgstr "" #: ../../whatsnew/3.6.rst:1471 @@ -2159,9 +2169,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:1475 msgid "" -"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable and :meth:`ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :gh:`78851`.)" +"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :gh:`78851`.)" msgstr "" #: ../../whatsnew/3.6.rst:1481 @@ -2181,8 +2192,8 @@ msgstr "struct" #: ../../whatsnew/3.6.rst:1490 msgid "" ":mod:`struct` now supports IEEE 754 half-precision floats via the ``'e'`` " -"format specifier. (Contributed by Eli Stevens, Mark Dickinson in :issue:" -"`11734`.)" +"format specifier. (Contributed by Eli Stevens, Mark Dickinson " +"in :issue:`11734`.)" msgstr "" #: ../../whatsnew/3.6.rst:1496 @@ -2193,9 +2204,9 @@ msgstr "subprocess" msgid "" ":class:`subprocess.Popen` destructor now emits a :exc:`ResourceWarning` " "warning if the child process is still running. Use the context manager " -"protocol (``with proc: ...``) or explicitly call the :meth:`~subprocess." -"Popen.wait` method to read the exit status of the child process. " -"(Contributed by Victor Stinner in :issue:`26741`.)" +"protocol (``with proc: ...``) or explicitly call " +"the :meth:`~subprocess.Popen.wait` method to read the exit status of the " +"child process. (Contributed by Victor Stinner in :issue:`26741`.)" msgstr "" #: ../../whatsnew/3.6.rst:1504 @@ -2351,22 +2362,22 @@ msgstr "" msgid "" "The :mod:`typing` module has a much improved support for generic type " "aliases. For example ``Dict[str, Tuple[S, T]]`` is now a valid type " -"annotation. (Contributed by Guido van Rossum in `Github #195 `_.)" +"annotation. (Contributed by Guido van Rossum in `Github #195 `_.)" msgstr "" #: ../../whatsnew/3.6.rst:1614 msgid "" -"The :class:`typing.ContextManager` class has been added for representing :" -"class:`contextlib.AbstractContextManager`. (Contributed by Brett Cannon in :" -"issue:`25609`.)" +"The :class:`typing.ContextManager` class has been added for " +"representing :class:`contextlib.AbstractContextManager`. (Contributed by " +"Brett Cannon in :issue:`25609`.)" msgstr "" #: ../../whatsnew/3.6.rst:1618 msgid "" -"The :class:`typing.Collection` class has been added for representing :class:" -"`collections.abc.Collection`. (Contributed by Ivan Levkivskyi in :issue:" -"`27598`.)" +"The :class:`typing.Collection` class has been added for " +"representing :class:`collections.abc.Collection`. (Contributed by Ivan " +"Levkivskyi in :issue:`27598`.)" msgstr "" #: ../../whatsnew/3.6.rst:1622 @@ -2375,16 +2386,16 @@ msgid "" "variables. As introduced in :pep:`526`, a variable annotation wrapped in " "ClassVar indicates that a given attribute is intended to be used as a class " "variable and should not be set on instances of that class. (Contributed by " -"Ivan Levkivskyi in `Github #280 `_.)" +"Ivan Levkivskyi in `Github #280 `_.)" msgstr "" #: ../../whatsnew/3.6.rst:1629 msgid "" "A new :const:`~typing.TYPE_CHECKING` constant that is assumed to be ``True`` " "by the static type checkers, but is ``False`` at runtime. (Contributed by " -"Guido van Rossum in `Github #230 `_.)" +"Guido van Rossum in `Github #230 `_.)" msgstr "" #: ../../whatsnew/3.6.rst:1634 @@ -2432,10 +2443,10 @@ msgstr ":class:`~unittest.mock.Mock` 類別有以下改進:" #: ../../whatsnew/3.6.rst:1660 msgid "" -"Two new methods, :meth:`Mock.assert_called() ` and :meth:`Mock.assert_called_once() ` to check if the mock object was called. (Contributed by " -"Amit Saha in :issue:`26323`.)" +"Two new methods, :meth:`Mock.assert_called() " +"` and :meth:`Mock.assert_called_once() " +"` to check if the mock object was " +"called. (Contributed by Amit Saha in :issue:`26323`.)" msgstr "" #: ../../whatsnew/3.6.rst:1666 @@ -2452,10 +2463,10 @@ msgstr "urllib.request" #: ../../whatsnew/3.6.rst:1675 msgid "" "If a HTTP request has a file or iterable body (other than a bytes object) " -"but no ``Content-Length`` header, rather than throwing an error, :class:" -"`AbstractHTTPHandler ` now falls back to use " -"chunked transfer encoding. (Contributed by Demian Brecht and Rolf Krahl in :" -"issue:`12319`.)" +"but no ``Content-Length`` header, rather than throwing an " +"error, :class:`AbstractHTTPHandler ` now falls " +"back to use chunked transfer encoding. (Contributed by Demian Brecht and " +"Rolf Krahl in :issue:`12319`.)" msgstr "" #: ../../whatsnew/3.6.rst:1683 @@ -2486,11 +2497,11 @@ msgstr "warnings" #: ../../whatsnew/3.6.rst:1701 msgid "" -"A new optional *source* parameter has been added to the :func:`warnings." -"warn_explicit` function: the destroyed object which emitted a :exc:" -"`ResourceWarning`. A *source* attribute has also been added to :class:`!" -"warnings.WarningMessage` (contributed by Victor Stinner in :issue:`26568` " -"and :issue:`26567`)." +"A new optional *source* parameter has been added to " +"the :func:`warnings.warn_explicit` function: the destroyed object which " +"emitted a :exc:`ResourceWarning`. A *source* attribute has also been added " +"to :class:`!warnings.WarningMessage` (contributed by Victor Stinner " +"in :issue:`26568` and :issue:`26567`)." msgstr "" #: ../../whatsnew/3.6.rst:1707 @@ -2548,9 +2559,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:1730 msgid "" -"The \"Object allocated at\" traceback is new and is only displayed if :mod:" -"`tracemalloc` is tracing Python memory allocations and if the :mod:" -"`warnings` module was already imported." +"The \"Object allocated at\" traceback is new and is only displayed " +"if :mod:`tracemalloc` is tracing Python memory allocations and if " +"the :mod:`warnings` module was already imported." msgstr "" #: ../../whatsnew/3.6.rst:1736 @@ -2569,9 +2580,9 @@ msgstr "winsound" #: ../../whatsnew/3.6.rst:1745 msgid "" -"Allowed keyword arguments to be passed to :func:`Beep `, :" -"func:`MessageBeep `, and :func:`PlaySound ` (:issue:`27982`)." +"Allowed keyword arguments to be passed to :func:`Beep " +"`, :func:`MessageBeep `, " +"and :func:`PlaySound ` (:issue:`27982`)." msgstr "" #: ../../whatsnew/3.6.rst:1751 @@ -2624,8 +2635,8 @@ msgstr "最佳化" msgid "" "The Python interpreter now uses a 16-bit wordcode instead of bytecode which " "made a number of opcode optimizations possible. (Contributed by Demur Rumed " -"with input and reviews from Serhiy Storchaka and Victor Stinner in :issue:" -"`26647` and :issue:`28050`.)" +"with input and reviews from Serhiy Storchaka and Victor Stinner " +"in :issue:`26647` and :issue:`28050`.)" msgstr "" #: ../../whatsnew/3.6.rst:1790 @@ -2657,8 +2668,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1804 msgid "" "The ASCII and the Latin1 encoders are now up to 3 times as fast for the " -"error handler ``surrogateescape`` (Contributed by Victor Stinner in :issue:" -"`25227`)." +"error handler ``surrogateescape`` (Contributed by Victor Stinner " +"in :issue:`25227`)." msgstr "" #: ../../whatsnew/3.6.rst:1808 @@ -2690,8 +2701,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1822 msgid "" "Optimize :meth:`bytes.fromhex` and :meth:`bytearray.fromhex`: they are now " -"between 2x and 3.5x faster. (Contributed by Victor Stinner in :issue:" -"`25401`)." +"between 2x and 3.5x faster. (Contributed by Victor Stinner " +"in :issue:`25401`)." msgstr "" #: ../../whatsnew/3.6.rst:1825 @@ -2702,19 +2713,19 @@ msgstr "" #: ../../whatsnew/3.6.rst:1828 msgid "" -"Allocator functions of the :c:func:`PyMem_Malloc` domain (:c:macro:" -"`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc memory allocator ` " -"instead of :c:func:`malloc` function of the C library. The pymalloc " -"allocator is optimized for objects smaller or equal to 512 bytes with a " -"short lifetime, and use :c:func:`malloc` for larger memory blocks. " +"Allocator functions of the :c:func:`PyMem_Malloc` domain " +"(:c:macro:`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc memory allocator " +"` instead of :c:func:`malloc` function of the C library. The " +"pymalloc allocator is optimized for objects smaller or equal to 512 bytes " +"with a short lifetime, and use :c:func:`malloc` for larger memory blocks. " "(Contributed by Victor Stinner in :issue:`26249`)." msgstr "" #: ../../whatsnew/3.6.rst:1835 msgid "" ":func:`pickle.load` and :func:`pickle.loads` are now up to 10% faster when " -"deserializing many small objects (Contributed by Victor Stinner in :issue:" -"`27056`)." +"deserializing many small objects (Contributed by Victor Stinner " +"in :issue:`27056`)." msgstr "" #: ../../whatsnew/3.6.rst:1839 @@ -2728,30 +2739,30 @@ msgstr "" #: ../../whatsnew/3.6.rst:1845 msgid "" -"Optimized :func:`~glob.glob` and :func:`~glob.iglob` functions in the :mod:" -"`glob` module; they are now about 3--6 times faster. (Contributed by Serhiy " -"Storchaka in :issue:`25596`)." +"Optimized :func:`~glob.glob` and :func:`~glob.iglob` functions in " +"the :mod:`glob` module; they are now about 3--6 times faster. (Contributed " +"by Serhiy Storchaka in :issue:`25596`)." msgstr "" #: ../../whatsnew/3.6.rst:1849 msgid "" "Optimized globbing in :mod:`pathlib` by using :func:`os.scandir`; it is now " -"about 1.5--4 times faster. (Contributed by Serhiy Storchaka in :issue:" -"`26032`)." +"about 1.5--4 times faster. (Contributed by Serhiy Storchaka " +"in :issue:`26032`)." msgstr "" #: ../../whatsnew/3.6.rst:1853 msgid "" ":class:`xml.etree.ElementTree` parsing, iteration and deepcopy performance " -"has been significantly improved. (Contributed by Serhiy Storchaka in :issue:" -"`25638`, :issue:`25873`, and :issue:`25869`.)" +"has been significantly improved. (Contributed by Serhiy Storchaka " +"in :issue:`25638`, :issue:`25873`, and :issue:`25869`.)" msgstr "" #: ../../whatsnew/3.6.rst:1858 msgid "" "Creation of :class:`fractions.Fraction` instances from floats and decimals " -"is now 2 to 3 times faster. (Contributed by Serhiy Storchaka in :issue:" -"`25971`.)" +"is now 2 to 3 times faster. (Contributed by Serhiy Storchaka " +"in :issue:`25971`.)" msgstr "" #: ../../whatsnew/3.6.rst:1864 @@ -2762,8 +2773,8 @@ msgstr "建置和 C API 變更" msgid "" "Python now requires some C99 support in the toolchain to build. Most " "notably, Python now uses standard integer types and macros in place of " -"custom macros like ``PY_LONG_LONG``. For more information, see :pep:`7` and :" -"issue:`17884`." +"custom macros like ``PY_LONG_LONG``. For more information, see :pep:`7` " +"and :issue:`17884`." msgstr "" #: ../../whatsnew/3.6.rst:1871 @@ -2771,8 +2782,8 @@ msgid "" "Cross-compiling CPython with the Android NDK and the Android API level set " "to 21 (Android 5.0 Lollipop) or greater runs successfully. While Android is " "not yet a supported platform, the Python test suite runs on the Android " -"emulator with only about 16 tests failures. See the Android meta-issue :" -"issue:`26865`." +"emulator with only about 16 tests failures. See the Android meta-" +"issue :issue:`26865`." msgstr "" #: ../../whatsnew/3.6.rst:1876 @@ -2819,8 +2830,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1901 msgid "" -"The new :c:func:`PyErr_ResourceWarning` function can be used to generate a :" -"exc:`ResourceWarning` providing the source of the resource allocation. " +"The new :c:func:`PyErr_ResourceWarning` function can be used to generate " +"a :exc:`ResourceWarning` providing the source of the resource allocation. " "(Contributed by Victor Stinner in :issue:`26567`.)" msgstr "" @@ -2896,9 +2907,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:1951 msgid "" "A backslash-character pair that is not a valid escape sequence now generates " -"a :exc:`DeprecationWarning`. Although this will eventually become a :exc:" -"`SyntaxError`, that will not be for several Python releases. (Contributed by " -"Emanuel Barry in :issue:`27364`.)" +"a :exc:`DeprecationWarning`. Although this will eventually become " +"a :exc:`SyntaxError`, that will not be for several Python releases. " +"(Contributed by Emanuel Barry in :issue:`27364`.)" msgstr "" #: ../../whatsnew/3.6.rst:1956 @@ -2949,8 +2960,8 @@ msgstr "" msgid "" "The undocumented ``extra_path`` argument to the ``distutils.Distribution`` " "constructor is now considered deprecated and will raise a warning if set. " -"Support for this parameter will be removed in a future Python release. See :" -"issue:`27919` for details." +"Support for this parameter will be removed in a future Python release. " +"See :issue:`27919` for details." msgstr "" #: ../../whatsnew/3.6.rst:1999 @@ -2965,12 +2976,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:2009 msgid "" -"The :meth:`importlib.machinery.SourceFileLoader.load_module` and :meth:" -"`importlib.machinery.SourcelessFileLoader.load_module` methods are now " -"deprecated. They were the only remaining implementations of :meth:`importlib." -"abc.Loader.load_module` in :mod:`importlib` that had not been deprecated in " -"previous versions of Python in favour of :meth:`importlib.abc.Loader." -"exec_module`." +"The :meth:`importlib.machinery.SourceFileLoader.load_module` " +"and :meth:`importlib.machinery.SourcelessFileLoader.load_module` methods are " +"now deprecated. They were the only remaining implementations " +"of :meth:`importlib.abc.Loader.load_module` in :mod:`importlib` that had not " +"been deprecated in previous versions of Python in favour " +"of :meth:`importlib.abc.Loader.exec_module`." msgstr "" #: ../../whatsnew/3.6.rst:2016 @@ -2984,8 +2995,8 @@ msgstr "" msgid "" "Undocumented support of general :term:`bytes-like objects ` as paths in :mod:`os` functions, :func:`compile` and similar " -"functions is now deprecated. (Contributed by Serhiy Storchaka in :issue:" -"`25791` and :issue:`26754`.)" +"functions is now deprecated. (Contributed by Serhiy Storchaka " +"in :issue:`25791` and :issue:`26754`.)" msgstr "" #: ../../whatsnew/3.6.rst:2031 @@ -3006,9 +3017,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:2043 msgid "" "SSL-related arguments like ``certfile``, ``keyfile`` and ``check_hostname`` " -"in :mod:`ftplib`, :mod:`http.client`, :mod:`imaplib`, :mod:`poplib`, and :" -"mod:`smtplib` have been deprecated in favor of ``context``. (Contributed by " -"Christian Heimes in :issue:`28022`.)" +"in :mod:`ftplib`, :mod:`http.client`, :mod:`imaplib`, :mod:`poplib`, " +"and :mod:`smtplib` have been deprecated in favor of ``context``. " +"(Contributed by Christian Heimes in :issue:`28022`.)" msgstr "" #: ../../whatsnew/3.6.rst:2048 @@ -3039,9 +3050,10 @@ msgstr "xml" #: ../../whatsnew/3.6.rst:2073 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :gh:`61441`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :gh:`61441`.)" msgstr "" #: ../../whatsnew/3.6.rst:2080 @@ -3051,9 +3063,9 @@ msgstr "C API 的已棄用函式和型別" #: ../../whatsnew/3.6.rst:2082 msgid "" "Undocumented functions :c:func:`!PyUnicode_AsEncodedObject`, :c:func:`!" -"PyUnicode_AsDecodedObject`, :c:func:`!PyUnicode_AsEncodedUnicode` and :c:" -"func:`!PyUnicode_AsDecodedUnicode` are deprecated now. Use the :ref:`generic " -"codec based API ` instead." +"PyUnicode_AsDecodedObject`, :c:func:`!PyUnicode_AsEncodedUnicode` " +"and :c:func:`!PyUnicode_AsDecodedUnicode` are deprecated now. Use " +"the :ref:`generic codec based API ` instead." msgstr "" #: ../../whatsnew/3.6.rst:2089 @@ -3080,46 +3092,47 @@ msgstr "API 與功能的移除" #: ../../whatsnew/3.6.rst:2104 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter in regular " -"expressions will now cause an error. In replacement templates for :func:`re." -"sub` they are still allowed, but deprecated. The :const:`re.LOCALE` flag can " -"now only be used with binary patterns." +"expressions will now cause an error. In replacement templates " +"for :func:`re.sub` they are still allowed, but deprecated. " +"The :const:`re.LOCALE` flag can now only be used with binary patterns." msgstr "" #: ../../whatsnew/3.6.rst:2109 msgid "" -"``inspect.getmoduleinfo()`` was removed (was deprecated since CPython 3.3). :" -"func:`inspect.getmodulename` should be used for obtaining the module name " -"for a given path. (Contributed by Yury Selivanov in :issue:`13248`.)" +"``inspect.getmoduleinfo()`` was removed (was deprecated since CPython " +"3.3). :func:`inspect.getmodulename` should be used for obtaining the module " +"name for a given path. (Contributed by Yury Selivanov in :issue:`13248`.)" msgstr "" #: ../../whatsnew/3.6.rst:2114 msgid "" "``traceback.Ignore`` class and ``traceback.usage``, ``traceback.modname``, " -"``traceback.fullmodname``, ``traceback.find_lines_from_code``, ``traceback." -"find_lines``, ``traceback.find_strings``, ``traceback." -"find_executable_lines`` methods were removed from the :mod:`traceback` " -"module. They were undocumented methods deprecated since Python 3.2 and " -"equivalent functionality is available from private methods." +"``traceback.fullmodname``, ``traceback.find_lines_from_code``, " +"``traceback.find_lines``, ``traceback.find_strings``, " +"``traceback.find_executable_lines`` methods were removed from " +"the :mod:`traceback` module. They were undocumented methods deprecated since " +"Python 3.2 and equivalent functionality is available from private methods." msgstr "" ":mod:`traceback` 模組中的 ``traceback.Ignore`` 類別和 ``traceback.usage``、" -"``traceback.modname``、``traceback.fullmodname``、``traceback." -"find_lines_from_code``、``traceback.find_lines``、``traceback.find_strings`` " -"和 ``traceback.find_executable_lines`` 方法已被移除。它們是自 Python 3.2 以來" -"已棄用的未記錄方法,等效的功能現在可從私有方法獲得。" +"``traceback.modname``、``traceback.fullmodname``、" +"``traceback.find_lines_from_code``、``traceback.find_lines``、" +"``traceback.find_strings`` 和 ``traceback.find_executable_lines`` 方法已被移" +"除。它們是自 Python 3.2 以來已棄用的未記錄方法,等效的功能現在可從私有方法獲" +"得。" #: ../../whatsnew/3.6.rst:2121 msgid "" -"The ``tk_menuBar()`` and ``tk_bindForTraversal()`` dummy methods in :mod:" -"`tkinter` widget classes were removed (corresponding Tk commands were " -"obsolete since Tk 4.0)." +"The ``tk_menuBar()`` and ``tk_bindForTraversal()`` dummy methods " +"in :mod:`tkinter` widget classes were removed (corresponding Tk commands " +"were obsolete since Tk 4.0)." msgstr "" #: ../../whatsnew/3.6.rst:2125 msgid "" "The :meth:`~zipfile.ZipFile.open` method of the :class:`zipfile.ZipFile` " "class no longer supports the ``'U'`` mode (was deprecated since Python 3.4). " -"Use :class:`io.TextIOWrapper` for reading compressed text files in :term:" -"`universal newlines` mode." +"Use :class:`io.TextIOWrapper` for reading compressed text files " +"in :term:`universal newlines` mode." msgstr "" #: ../../whatsnew/3.6.rst:2130 @@ -3156,8 +3169,8 @@ msgid "" "The output of a special Python build with defined ``COUNT_ALLOCS``, " "``SHOW_ALLOC_COUNT`` or ``SHOW_TRACK_COUNT`` macros is now off by default. " "It can be re-enabled using the ``-X showalloccount`` option. It now outputs " -"to ``stderr`` instead of ``stdout``. (Contributed by Serhiy Storchaka in :" -"issue:`23034`.)" +"to ``stderr`` instead of ``stdout``. (Contributed by Serhiy Storchaka " +"in :issue:`23034`.)" msgstr "" #: ../../whatsnew/3.6.rst:2158 @@ -3167,8 +3180,8 @@ msgstr "Python API 的變更" #: ../../whatsnew/3.6.rst:2160 msgid "" ":func:`open() ` will no longer allow combining the ``'U'`` mode flag " -"with ``'+'``. (Contributed by Jeff Balogh and John O'Connor in :issue:" -"`2091`.)" +"with ``'+'``. (Contributed by Jeff Balogh and John O'Connor " +"in :issue:`2091`.)" msgstr "" #: ../../whatsnew/3.6.rst:2164 @@ -3185,8 +3198,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:2170 msgid "" -"When :meth:`importlib.abc.Loader.exec_module` is defined, :meth:`importlib." -"abc.Loader.create_module` must also be defined." +"When :meth:`importlib.abc.Loader.exec_module` is " +"defined, :meth:`importlib.abc.Loader.create_module` must also be defined." msgstr "" #: ../../whatsnew/3.6.rst:2173 @@ -3199,13 +3212,14 @@ msgstr "" msgid "" "The format of the :attr:`~codeobject.co_lnotab` attribute of code objects " "changed to support a negative line number delta. By default, Python does not " -"emit bytecode with a negative line number delta. Functions using :attr:" -"`frame.f_lineno`, ``PyFrame_GetLineNumber()`` or ``PyCode_Addr2Line()`` are " -"not affected. Functions directly decoding :attr:`!co_lnotab` should be " -"updated to use a signed 8-bit integer type for the line number delta, but " -"this is only required to support applications using a negative line number " -"delta. See ``Objects/lnotab_notes.txt`` for the :attr:`!co_lnotab` format " -"and how to decode it, and see the :pep:`511` for the rationale." +"emit bytecode with a negative line number delta. Functions " +"using :attr:`frame.f_lineno`, ``PyFrame_GetLineNumber()`` or " +"``PyCode_Addr2Line()`` are not affected. Functions directly decoding :attr:`!" +"co_lnotab` should be updated to use a signed 8-bit integer type for the line " +"number delta, but this is only required to support applications using a " +"negative line number delta. See ``Objects/lnotab_notes.txt`` for the :attr:`!" +"co_lnotab` format and how to decode it, and see the :pep:`511` for the " +"rationale." msgstr "" #: ../../whatsnew/3.6.rst:2187 @@ -3218,27 +3232,27 @@ msgstr "" #: ../../whatsnew/3.6.rst:2192 msgid "" -"Reading the :attr:`!port` attribute of :func:`urllib.parse.urlsplit` and :" -"func:`~urllib.parse.urlparse` results now raises :exc:`ValueError` for out-" -"of-range values, rather than returning :const:`None`. See :issue:`20059`." +"Reading the :attr:`!port` attribute of :func:`urllib.parse.urlsplit` " +"and :func:`~urllib.parse.urlparse` results now raises :exc:`ValueError` for " +"out-of-range values, rather than returning :const:`None`. " +"See :issue:`20059`." msgstr "" #: ../../whatsnew/3.6.rst:2197 msgid "" -"The :mod:`!imp` module now raises a :exc:`DeprecationWarning` instead of :" -"exc:`PendingDeprecationWarning`." +"The :mod:`!imp` module now raises a :exc:`DeprecationWarning` instead " +"of :exc:`PendingDeprecationWarning`." msgstr "" #: ../../whatsnew/3.6.rst:2200 msgid "" -"The following modules have had missing APIs added to their :attr:`~module." -"__all__` attributes to match the documented APIs: :mod:`calendar`, :mod:`!" -"cgi`, :mod:`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:" -"`fileinput`, :mod:`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:" -"`mimetypes`, :mod:`optparse`, :mod:`plistlib`, :mod:`!smtpd`, :mod:" -"`subprocess`, :mod:`tarfile`, :mod:`threading` and :mod:`wave`. This means " -"they will export new symbols when ``import *`` is used. (Contributed by Joel " -"Taddei and Jacek Kołodziej in :issue:`23883`.)" +"The following modules have had missing APIs added to " +"their :attr:`~module.__all__` attributes to match the documented " +"APIs: :mod:`calendar`, :mod:`!" +"cgi`, :mod:`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:`fileinput`, :mod:`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:`mimetypes`, :mod:`optparse`, :mod:`plistlib`, :mod:`!" +"smtpd`, :mod:`subprocess`, :mod:`tarfile`, :mod:`threading` " +"and :mod:`wave`. This means they will export new symbols when ``import *`` " +"is used. (Contributed by Joel Taddei and Jacek Kołodziej in :issue:`23883`.)" msgstr "" #: ../../whatsnew/3.6.rst:2211 @@ -3250,26 +3264,27 @@ msgstr "" #: ../../whatsnew/3.6.rst:2215 msgid "" -"When a relative import is performed and no parent package is known, then :" -"exc:`ImportError` will be raised. Previously, :exc:`SystemError` could be " -"raised. (Contributed by Brett Cannon in :issue:`18018`.)" +"When a relative import is performed and no parent package is known, " +"then :exc:`ImportError` will be raised. Previously, :exc:`SystemError` could " +"be raised. (Contributed by Brett Cannon in :issue:`18018`.)" msgstr "" #: ../../whatsnew/3.6.rst:2219 msgid "" -"Servers based on the :mod:`socketserver` module, including those defined in :" -"mod:`http.server`, :mod:`xmlrpc.server` and :mod:`wsgiref.simple_server`, " -"now only catch exceptions derived from :exc:`Exception`. Therefore if a " -"request handler raises an exception like :exc:`SystemExit` or :exc:" -"`KeyboardInterrupt`, :meth:`~socketserver.BaseServer.handle_error` is no " -"longer called, and the exception will stop a single-threaded server. " +"Servers based on the :mod:`socketserver` module, including those defined " +"in :mod:`http.server`, :mod:`xmlrpc.server` " +"and :mod:`wsgiref.simple_server`, now only catch exceptions derived " +"from :exc:`Exception`. Therefore if a request handler raises an exception " +"like :exc:`SystemExit` " +"or :exc:`KeyboardInterrupt`, :meth:`~socketserver.BaseServer.handle_error` " +"is no longer called, and the exception will stop a single-threaded server. " "(Contributed by Martin Panter in :issue:`23430`.)" msgstr "" #: ../../whatsnew/3.6.rst:2228 msgid "" -":func:`!spwd.getspnam` now raises a :exc:`PermissionError` instead of :exc:" -"`KeyError` if the user doesn't have privileges." +":func:`!spwd.getspnam` now raises a :exc:`PermissionError` instead " +"of :exc:`KeyError` if the user doesn't have privileges." msgstr "" #: ../../whatsnew/3.6.rst:2231 @@ -3291,17 +3306,19 @@ msgstr "" #: ../../whatsnew/3.6.rst:2243 msgid "" -"All optional arguments of the :func:`~json.dump`, :func:`~json.dumps`, :func:" -"`~json.load` and :func:`~json.loads` functions and :class:`~json." -"JSONEncoder` and :class:`~json.JSONDecoder` class constructors in the :mod:" -"`json` module are now :ref:`keyword-only `. " -"(Contributed by Serhiy Storchaka in :issue:`18726`.)" +"All optional arguments of " +"the :func:`~json.dump`, :func:`~json.dumps`, :func:`~json.load` " +"and :func:`~json.loads` functions and :class:`~json.JSONEncoder` " +"and :class:`~json.JSONDecoder` class constructors in the :mod:`json` module " +"are now :ref:`keyword-only `. (Contributed by Serhiy " +"Storchaka in :issue:`18726`.)" msgstr "" -"在 :mod:`json` 模組中,:func:`~json.dump`、:func:`~json.dumps`、:func:`~json." -"load` 和 :func:`~json.loads` 函式以及 :class:`~json.JSONEncoder` 和 :class:" -"`~json.JSONDecoder` 類別建構函式的所有可選引數現在都是\\ :ref:`僅限關鍵字 " -"`\\ 引數。(由 Serhiy Storchaka 在 :issue:`18726` 中" -"貢獻。)" +"在 :mod:`json` 模組" +"中,:func:`~json.dump`、:func:`~json.dumps`、:func:`~json.load` " +"和 :func:`~json.loads` 函式以及 :class:`~json.JSONEncoder` " +"和 :class:`~json.JSONDecoder` 類別建構函式的所有可選引數現在都是\\ :ref:`僅限" +"關鍵字 `\\ 引數。(由 Serhiy Storchaka " +"在 :issue:`18726` 中貢獻。)" #: ../../whatsnew/3.6.rst:2250 msgid "" @@ -3311,15 +3328,16 @@ msgstr "" #: ../../whatsnew/3.6.rst:2253 msgid "" -"As part of :pep:`487`, the handling of keyword arguments passed to :class:" -"`type` (other than the metaclass hint, ``metaclass``) is now consistently " -"delegated to :meth:`object.__init_subclass__`. This means that :meth:`type." -"__new__ ` and :meth:`type.__init__ ` both " -"now accept arbitrary keyword arguments, but :meth:`object.__init_subclass__` " -"(which is called from :meth:`type.__new__ `) will reject " -"them by default. Custom metaclasses accepting additional keyword arguments " -"will need to adjust their calls to :meth:`type.__new__ ` " -"(whether direct or via :class:`super`) accordingly." +"As part of :pep:`487`, the handling of keyword arguments passed " +"to :class:`type` (other than the metaclass hint, ``metaclass``) is now " +"consistently delegated to :meth:`object.__init_subclass__`. This means " +"that :meth:`type.__new__ ` and :meth:`type.__init__ " +"` both now accept arbitrary keyword arguments, " +"but :meth:`object.__init_subclass__` (which is called " +"from :meth:`type.__new__ `) will reject them by default. " +"Custom metaclasses accepting additional keyword arguments will need to " +"adjust their calls to :meth:`type.__new__ ` (whether direct " +"or via :class:`super`) accordingly." msgstr "" #: ../../whatsnew/3.6.rst:2264 @@ -3348,26 +3366,27 @@ msgstr "" #: ../../whatsnew/3.6.rst:2280 msgid "" -"In the :mod:`urllib.request` module and the :meth:`http.client." -"HTTPConnection.request` method, if no Content-Length header field has been " -"specified and the request body is a file object, it is now sent with HTTP " -"1.1 chunked encoding. If a file object has to be sent to a HTTP 1.0 server, " -"the Content-Length value now has to be specified by the caller. (Contributed " -"by Demian Brecht and Rolf Krahl with tweaks from Martin Panter in :issue:" -"`12319`.)" +"In the :mod:`urllib.request` module and " +"the :meth:`http.client.HTTPConnection.request` method, if no Content-Length " +"header field has been specified and the request body is a file object, it is " +"now sent with HTTP 1.1 chunked encoding. If a file object has to be sent to " +"a HTTP 1.0 server, the Content-Length value now has to be specified by the " +"caller. (Contributed by Demian Brecht and Rolf Krahl with tweaks from Martin " +"Panter in :issue:`12319`.)" msgstr "" #: ../../whatsnew/3.6.rst:2289 msgid "" -"The :class:`~csv.DictReader` now returns rows of type :class:`~collections." -"OrderedDict`. (Contributed by Steve Holden in :issue:`27842`.)" +"The :class:`~csv.DictReader` now returns rows of " +"type :class:`~collections.OrderedDict`. (Contributed by Steve Holden " +"in :issue:`27842`.)" msgstr "" #: ../../whatsnew/3.6.rst:2293 msgid "" -"The :const:`!crypt.METHOD_CRYPT` will no longer be added to ``crypt." -"methods`` if unsupported by the platform. (Contributed by Victor Stinner in :" -"issue:`25287`.)" +"The :const:`!crypt.METHOD_CRYPT` will no longer be added to " +"``crypt.methods`` if unsupported by the platform. (Contributed by Victor " +"Stinner in :issue:`25287`.)" msgstr "" #: ../../whatsnew/3.6.rst:2301 @@ -3411,8 +3430,8 @@ msgid "" "unrecognized compression values. Previously a plain :exc:`RuntimeError` was " "raised. Additionally, calling :class:`~zipfile.ZipFile` methods on a closed " "ZipFile or calling the :meth:`~zipfile.ZipFile.write` method on a ZipFile " -"created with mode ``'r'`` will raise a :exc:`ValueError`. Previously, a :exc:" -"`RuntimeError` was raised in those scenarios." +"created with mode ``'r'`` will raise a :exc:`ValueError`. Previously, " +"a :exc:`RuntimeError` was raised in those scenarios." msgstr "" #: ../../whatsnew/3.6.rst:2331 @@ -3429,13 +3448,14 @@ msgstr "" msgid "" "With the introduction of :exc:`ModuleNotFoundError`, import system consumers " "may start expecting import system replacements to raise that more specific " -"exception when appropriate, rather than the less-specific :exc:" -"`ImportError`. To provide future compatibility with such consumers, " -"implementers of alternative import systems that completely replace :func:" -"`__import__` will need to update their implementations to raise the new " -"subclass when a module can't be found at all. Implementers of compliant " -"plugins to the default import system shouldn't need to make any changes, as " -"the default import system will raise the new subclass when appropriate." +"exception when appropriate, rather than the less-" +"specific :exc:`ImportError`. To provide future compatibility with such " +"consumers, implementers of alternative import systems that completely " +"replace :func:`__import__` will need to update their implementations to " +"raise the new subclass when a module can't be found at all. Implementers of " +"compliant plugins to the default import system shouldn't need to make any " +"changes, as the default import system will raise the new subclass when " +"appropriate." msgstr "" #: ../../whatsnew/3.6.rst:2350 @@ -3477,15 +3497,15 @@ msgstr "" msgid "" "The new :opcode:`!FORMAT_VALUE` and :opcode:`BUILD_STRING` opcodes as part " "of the :ref:`formatted string literal ` implementation. " -"(Contributed by Eric Smith in :issue:`25483` and Serhiy Storchaka in :issue:" -"`27078`.)" +"(Contributed by Eric Smith in :issue:`25483` and Serhiy Storchaka " +"in :issue:`27078`.)" msgstr "" #: ../../whatsnew/3.6.rst:2376 msgid "" -"The new :opcode:`BUILD_CONST_KEY_MAP` opcode to optimize the creation of " -"dictionaries with constant keys. (Contributed by Serhiy Storchaka in :issue:" -"`27140`.)" +"The new :opcode:`!BUILD_CONST_KEY_MAP` opcode to optimize the creation of " +"dictionaries with constant keys. (Contributed by Serhiy Storchaka " +"in :issue:`27140`.)" msgstr "" #: ../../whatsnew/3.6.rst:2380 @@ -3493,11 +3513,11 @@ msgid "" "The function call opcodes have been heavily reworked for better performance " "and simpler implementation. The :opcode:`MAKE_FUNCTION`, :opcode:`!" "CALL_FUNCTION`, :opcode:`!CALL_FUNCTION_KW` and :opcode:`!" -"BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the new :opcode:" -"`CALL_FUNCTION_EX` and :opcode:`!BUILD_TUPLE_UNPACK_WITH_CALL` have been " -"added, and ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and " -"``MAKE_CLOSURE`` opcodes have been removed. (Contributed by Demur Rumed in :" -"issue:`27095`, and Serhiy Storchaka in :issue:`27213`, :issue:`28257`.)" +"BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the " +"new :opcode:`CALL_FUNCTION_EX` and :opcode:`!BUILD_TUPLE_UNPACK_WITH_CALL` " +"have been added, and ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and " +"``MAKE_CLOSURE`` opcodes have been removed. (Contributed by Demur Rumed " +"in :issue:`27095`, and Serhiy Storchaka in :issue:`27213`, :issue:`28257`.)" msgstr "" #: ../../whatsnew/3.6.rst:2391 @@ -3532,8 +3552,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:2411 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" #: ../../whatsnew/3.6.rst:2414 ../../whatsnew/3.6.rst:2427 @@ -3563,8 +3583,8 @@ msgstr "Python 3.6.4 中顯著的變更" msgid "" "The ``PyExc_RecursionErrorInst`` singleton that was part of the public API " "has been removed as its members being never cleared may cause a segfault " -"during finalization of the interpreter. (Contributed by Xavier de Gaye in :" -"issue:`22898` and :issue:`30697`.)" +"during finalization of the interpreter. (Contributed by Xavier de Gaye " +"in :issue:`22898` and :issue:`30697`.)" msgstr "" #: ../../whatsnew/3.6.rst:2442 @@ -3602,12 +3622,12 @@ msgstr "Python 3.6.10 中顯著的變更" #: ../../whatsnew/3.6.rst:2463 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.6.rst:2471 @@ -3617,13 +3637,14 @@ msgstr "Python 3.6.13 中顯著的變更" #: ../../whatsnew/3.6.rst:2473 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.6.rst:2484 @@ -3645,6 +3666,6 @@ msgid "" "forms of attacks. Following the WHATWG specification that updates RFC 3986, " "ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are stripped from " "the URL by the parser :func:`urllib.parse` preventing such attacks. The " -"removal characters are controlled by a new module level variable ``urllib." -"parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"removal characters are controlled by a new module level variable " +"``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" diff --git a/whatsnew/3.8.po b/whatsnew/3.8.po index 58317416716..58cb622de8e 100644 --- a/whatsnew/3.8.po +++ b/whatsnew/3.8.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-04 00:15+0000\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,8 +32,8 @@ msgstr "Raymond Hettinger" #: ../../whatsnew/3.8.rst:47 msgid "" "This article explains the new features in Python 3.8, compared to 3.7. " -"Python 3.8 was released on October 14, 2019. For full details, see the :ref:" -"`changelog `." +"Python 3.8 was released on October 14, 2019. For full details, see " +"the :ref:`changelog `." msgstr "" "本文介紹了 Python 3.8 與 3.7 相比多了哪些新功能。Python 3.8 已於 2019 年 10 " "月 14 日發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" @@ -54,8 +54,9 @@ msgstr "" msgid "" "There is new syntax ``:=`` that assigns values to variables as part of a " "larger expression. It is affectionately known as \"the walrus operator\" due " -"to its resemblance to `the eyes and tusks of a walrus `_." +"to its resemblance to `the eyes and tusks of a walrus `_." msgstr "" #: ../../whatsnew/3.8.rst:82 @@ -140,8 +141,8 @@ msgid "" "There is a new function parameter syntax ``/`` to indicate that some " "function parameters must be specified positionally and cannot be used as " "keyword arguments. This is the same notation shown by ``help()`` for C " -"functions annotated with Larry Hastings' `Argument Clinic `__ tool." +"functions annotated with Larry Hastings' `Argument Clinic `__ tool." msgstr "" #: ../../whatsnew/3.8.rst:128 @@ -276,8 +277,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:201 msgid "" -"The location of the cache is reported in :data:`sys.pycache_prefix` (:const:" -"`None` indicates the default location in ``__pycache__`` subdirectories)." +"The location of the cache is reported in :data:`sys.pycache_prefix` " +"(:const:`None` indicates the default location in ``__pycache__`` " +"subdirectories)." msgstr "" #: ../../whatsnew/3.8.rst:205 @@ -300,10 +302,10 @@ msgid "" "Release builds and :ref:`debug builds ` are now ABI compatible: " "defining the ``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` " "macro, which introduces the only ABI incompatibility. The ``Py_TRACE_REFS`` " -"macro, which adds the :func:`sys.getobjects` function and the :envvar:" -"`PYTHONDUMPREFS` environment variable, can be set using the new :option:`./" -"configure --with-trace-refs <--with-trace-refs>` build option. (Contributed " -"by Victor Stinner in :issue:`36465`.)" +"macro, which adds the :func:`sys.getobjects` function and " +"the :envvar:`PYTHONDUMPREFS` environment variable, can be set using the " +"new :option:`./configure --with-trace-refs <--with-trace-refs>` build " +"option. (Contributed by Victor Stinner in :issue:`36465`.)" msgstr "" #: ../../whatsnew/3.8.rst:223 @@ -345,8 +347,8 @@ msgid "" "On the other hand, ``pkg-config python3.8 --libs`` no longer contains ``-" "lpython3.8``. C extensions must not be linked to libpython (except on " "Android and Cygwin, whose cases are handled by the script); this change is " -"backward incompatible on purpose. (Contributed by Victor Stinner in :issue:" -"`36721`.)" +"backward incompatible on purpose. (Contributed by Victor Stinner " +"in :issue:`36721`.)" msgstr "" #: ../../whatsnew/3.8.rst:256 @@ -580,8 +582,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:354 msgid "" ":ref:`vectorcall` is added to the Python/C API. It is meant to formalize " -"existing optimizations which were already done for various classes. Any :ref:" -"`static type ` implementing a callable can use this protocol." +"existing optimizations which were already done for various classes. " +"Any :ref:`static type ` implementing a callable can use this " +"protocol." msgstr "" #: ../../whatsnew/3.8.rst:360 @@ -596,8 +599,8 @@ msgstr "完整敘述請見 :pep:`590`。" #: ../../whatsnew/3.8.rst:365 msgid "" -"(Contributed by Jeroen Demeyer, Mark Shannon and Petr Viktorin in :issue:" -"`36974`.)" +"(Contributed by Jeroen Demeyer, Mark Shannon and Petr Viktorin " +"in :issue:`36974`.)" msgstr "" "(由 Jeroen Demeyer、Mark Shannon 和 Petr Viktorin 在 :issue:`36974` 中貢" "獻。)" @@ -643,19 +646,19 @@ msgstr "" #: ../../whatsnew/3.8.rst:393 msgid "" "The :class:`bool`, :class:`int`, and :class:`fractions.Fraction` types now " -"have an :meth:`~int.as_integer_ratio` method like that found in :class:" -"`float` and :class:`decimal.Decimal`. This minor API extension makes it " -"possible to write ``numerator, denominator = x.as_integer_ratio()`` and have " -"it work across multiple numeric types. (Contributed by Lisa Roach in :issue:" -"`33073` and Raymond Hettinger in :issue:`37819`.)" +"have an :meth:`~int.as_integer_ratio` method like that found " +"in :class:`float` and :class:`decimal.Decimal`. This minor API extension " +"makes it possible to write ``numerator, denominator = x.as_integer_ratio()`` " +"and have it work across multiple numeric types. (Contributed by Lisa Roach " +"in :issue:`33073` and Raymond Hettinger in :issue:`37819`.)" msgstr "" #: ../../whatsnew/3.8.rst:401 msgid "" "Constructors of :class:`int`, :class:`float` and :class:`complex` will now " "use the :meth:`~object.__index__` special method, if available and the " -"corresponding method :meth:`~object.__int__`, :meth:`~object.__float__` or :" -"meth:`~object.__complex__` is not available. (Contributed by Serhiy " +"corresponding method :meth:`~object.__int__`, :meth:`~object.__float__` " +"or :meth:`~object.__complex__` is not available. (Contributed by Serhiy " "Storchaka in :issue:`20092`.)" msgstr "" @@ -684,8 +687,8 @@ msgstr "(由 Jonathan Eunice 和 Serhiy Storchaka 在 :issue:`30688` 中貢獻 #: ../../whatsnew/3.8.rst:416 msgid "" -"Dict and dictviews are now iterable in reversed insertion order using :func:" -"`reversed`. (Contributed by Rémi Lapeyre in :issue:`33462`.)" +"Dict and dictviews are now iterable in reversed insertion order " +"using :func:`reversed`. (Contributed by Rémi Lapeyre in :issue:`33462`.)" msgstr "" #: ../../whatsnew/3.8.rst:419 @@ -693,8 +696,8 @@ msgid "" "The syntax allowed for keyword names in function calls was further " "restricted. In particular, ``f((keyword)=arg)`` is no longer allowed. It was " "never intended to permit more than a bare name on the left-hand side of a " -"keyword argument assignment term. (Contributed by Benjamin Peterson in :" -"issue:`34641`.)" +"keyword argument assignment term. (Contributed by Benjamin Peterson " +"in :issue:`34641`.)" msgstr "" #: ../../whatsnew/3.8.rst:425 @@ -705,11 +708,12 @@ msgid "" msgstr "" #: ../../whatsnew/3.8.rst:430 +#, fuzzy msgid "" ">>> def parse(family):\n" -" lastname, *members = family.split()\n" -" return lastname.upper(), *members\n" -"\n" +"... lastname, *members = family.split()\n" +"... return lastname.upper(), *members\n" +"...\n" ">>> parse('simpsons homer marge bart lisa maggie')\n" "('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'maggie')" msgstr "" @@ -734,12 +738,13 @@ msgstr "" #: ../../whatsnew/3.8.rst:445 msgid "" -"Arithmetic operations between subclasses of :class:`datetime.date` or :class:" -"`datetime.datetime` and :class:`datetime.timedelta` objects now return an " -"instance of the subclass, rather than the base class. This also affects the " -"return type of operations whose implementation (directly or indirectly) " -"uses :class:`datetime.timedelta` arithmetic, such as :meth:`~datetime." -"datetime.astimezone`. (Contributed by Paul Ganssle in :issue:`32417`.)" +"Arithmetic operations between subclasses of :class:`datetime.date` " +"or :class:`datetime.datetime` and :class:`datetime.timedelta` objects now " +"return an instance of the subclass, rather than the base class. This also " +"affects the return type of operations whose implementation (directly or " +"indirectly) uses :class:`datetime.timedelta` arithmetic, such " +"as :meth:`~datetime.datetime.astimezone`. (Contributed by Paul Ganssle " +"in :issue:`32417`.)" msgstr "" #: ../../whatsnew/3.8.rst:453 @@ -754,12 +759,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:460 msgid "" -"Some advanced styles of programming require updating the :class:`types." -"CodeType` object for an existing function. Since code objects are " -"immutable, a new code object needs to be created, one that is modeled on the " -"existing code object. With 19 parameters, this was somewhat tedious. Now, " -"the new ``replace()`` method makes it possible to create a clone with a few " -"altered parameters." +"Some advanced styles of programming require updating " +"the :class:`types.CodeType` object for an existing function. Since code " +"objects are immutable, a new code object needs to be created, one that is " +"modeled on the existing code object. With 19 parameters, this was somewhat " +"tedious. Now, the new ``replace()`` method makes it possible to create a " +"clone with a few altered parameters." msgstr "" #: ../../whatsnew/3.8.rst:467 @@ -881,9 +886,9 @@ msgid "" "elements long. Formerly, five was the limit. The new, optional sixth " "element is a callable with a ``(obj, state)`` signature. This allows the " "direct control over the state-updating behavior of a specific object. If " -"not *None*, this callable will have priority over the object's :meth:" -"`~object.__setstate__` method. (Contributed by Pierre Glaser and Olivier " -"Grisel in :issue:`35900`.)" +"not *None*, this callable will have priority over the " +"object's :meth:`~object.__setstate__` method. (Contributed by Pierre Glaser " +"and Olivier Grisel in :issue:`35900`.)" msgstr "" #: ../../whatsnew/3.8.rst:543 @@ -950,8 +955,8 @@ msgstr ":func:`ast.parse` 函式有一些新旗標:" #: ../../whatsnew/3.8.rst:584 msgid "" -"``type_comments=True`` causes it to return the text of :pep:`484` and :pep:" -"`526` type comments associated with certain AST nodes;" +"``type_comments=True`` causes it to return the text of :pep:`484` " +"and :pep:`526` type comments associated with certain AST nodes;" msgstr "" #: ../../whatsnew/3.8.rst:587 @@ -963,8 +968,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:590 msgid "" "``feature_version=(3, N)`` allows specifying an earlier Python 3 version. " -"For example, ``feature_version=(3, 4)`` will treat :keyword:`async` and :" -"keyword:`await` as non-reserved words." +"For example, ``feature_version=(3, 4)`` will treat :keyword:`async` " +"and :keyword:`await` as non-reserved words." msgstr "" #: ../../whatsnew/3.8.rst:594 @@ -1036,8 +1041,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:629 msgid "" -"The actual implementation is significantly more complex. Thus, :func:" -"`asyncio.run` should be the preferred way of running asyncio programs." +"The actual implementation is significantly more complex. " +"Thus, :func:`asyncio.run` should be the preferred way of running asyncio " +"programs." msgstr "" #: ../../whatsnew/3.8.rst:632 @@ -1078,16 +1084,17 @@ msgstr "(由 Yury Selivanov 在 :issue:`37028` 中貢獻。)" #: ../../whatsnew/3.8.rst:651 ../../whatsnew/3.8.rst:1973 msgid "" -"The exception :class:`asyncio.CancelledError` now inherits from :class:" -"`BaseException` rather than :class:`Exception` and no longer inherits from :" -"class:`concurrent.futures.CancelledError`. (Contributed by Yury Selivanov " -"in :issue:`32528`.)" +"The exception :class:`asyncio.CancelledError` now inherits " +"from :class:`BaseException` rather than :class:`Exception` and no longer " +"inherits from :class:`concurrent.futures.CancelledError`. (Contributed by " +"Yury Selivanov in :issue:`32528`.)" msgstr "" #: ../../whatsnew/3.8.rst:656 msgid "" -"On Windows, the default event loop is now :class:`~asyncio." -"ProactorEventLoop`. (Contributed by Victor Stinner in :issue:`34687`.)" +"On Windows, the default event loop is " +"now :class:`~asyncio.ProactorEventLoop`. (Contributed by Victor Stinner " +"in :issue:`34687`.)" msgstr "" #: ../../whatsnew/3.8.rst:659 @@ -1098,9 +1105,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:662 msgid "" -":class:`~asyncio.ProactorEventLoop` can now be interrupted by :exc:" -"`KeyboardInterrupt` (\"CTRL+C\"). (Contributed by Vladimir Matveev in :issue:" -"`23057`.)" +":class:`~asyncio.ProactorEventLoop` can now be interrupted " +"by :exc:`KeyboardInterrupt` (\"CTRL+C\"). (Contributed by Vladimir Matveev " +"in :issue:`23057`.)" msgstr "" #: ../../whatsnew/3.8.rst:666 @@ -1112,12 +1119,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:670 msgid "" "Asyncio tasks can now be named, either by passing the ``name`` keyword " -"argument to :func:`asyncio.create_task` or the :meth:`~asyncio.loop." -"create_task` event loop method, or by calling the :meth:`~asyncio.Task." -"set_name` method on the task object. The task name is visible in the " -"``repr()`` output of :class:`asyncio.Task` and can also be retrieved using " -"the :meth:`~asyncio.Task.get_name` method. (Contributed by Alex Grönholm in :" -"issue:`34270`.)" +"argument to :func:`asyncio.create_task` or " +"the :meth:`~asyncio.loop.create_task` event loop method, or by calling " +"the :meth:`~asyncio.Task.set_name` method on the task object. The task name " +"is visible in the ``repr()`` output of :class:`asyncio.Task` and can also be " +"retrieved using the :meth:`~asyncio.Task.get_name` method. (Contributed by " +"Alex Grönholm in :issue:`34270`.)" msgstr "" #: ../../whatsnew/3.8.rst:678 @@ -1136,12 +1143,12 @@ msgstr "builtins(內建)" #: ../../whatsnew/3.8.rst:690 msgid "" -"The :func:`compile` built-in has been improved to accept the ``ast." -"PyCF_ALLOW_TOP_LEVEL_AWAIT`` flag. With this new flag passed, :func:" -"`compile` will allow top-level ``await``, ``async for`` and ``async with`` " -"constructs that are usually considered invalid syntax. Asynchronous code " -"object marked with the ``CO_COROUTINE`` flag may then be returned. " -"(Contributed by Matthias Bussonnier in :issue:`34616`)" +"The :func:`compile` built-in has been improved to accept the " +"``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` flag. With this new flag " +"passed, :func:`compile` will allow top-level ``await``, ``async for`` and " +"``async with`` constructs that are usually considered invalid syntax. " +"Asynchronous code object marked with the ``CO_COROUTINE`` flag may then be " +"returned. (Contributed by Matthias Bussonnier in :issue:`34616`)" msgstr "" #: ../../whatsnew/3.8.rst:699 @@ -1150,13 +1157,13 @@ msgstr "collections" #: ../../whatsnew/3.8.rst:701 msgid "" -"The :meth:`~collections.somenamedtuple._asdict` method for :func:" -"`collections.namedtuple` now returns a :class:`dict` instead of a :class:" -"`collections.OrderedDict`. This works because regular dicts have guaranteed " -"ordering since Python 3.7. If the extra features of :class:`OrderedDict` are " -"required, the suggested remediation is to cast the result to the desired " -"type: ``OrderedDict(nt._asdict())``. (Contributed by Raymond Hettinger in :" -"issue:`35864`.)" +"The :meth:`~collections.somenamedtuple._asdict` method " +"for :func:`collections.namedtuple` now returns a :class:`dict` instead of " +"a :class:`collections.OrderedDict`. This works because regular dicts have " +"guaranteed ordering since Python 3.7. If the extra features " +"of :class:`OrderedDict` are required, the suggested remediation is to cast " +"the result to the desired type: ``OrderedDict(nt._asdict())``. (Contributed " +"by Raymond Hettinger in :issue:`35864`.)" msgstr "" #: ../../whatsnew/3.8.rst:711 @@ -1215,8 +1222,9 @@ msgid "" "parameter to specify flags for the underlying ``LoadLibraryEx`` call. The " "default flags are set to only load DLL dependencies from trusted locations, " "including the path where the DLL is stored (if a full or partial path is " -"used to load the initial DLL) and paths added by :func:`~os." -"add_dll_directory`. (Contributed by Steve Dower in :issue:`36085`.)" +"used to load the initial DLL) and paths added " +"by :func:`~os.add_dll_directory`. (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" #: ../../whatsnew/3.8.rst:754 @@ -1225,11 +1233,12 @@ msgstr "datetime" #: ../../whatsnew/3.8.rst:756 msgid "" -"Added new alternate constructors :meth:`datetime.date.fromisocalendar` and :" -"meth:`datetime.datetime.fromisocalendar`, which construct :class:`~datetime." -"date` and :class:`~datetime.datetime` objects respectively from ISO year, " -"week number, and weekday; these are the inverse of each class's " -"``isocalendar`` method. (Contributed by Paul Ganssle in :issue:`36004`.)" +"Added new alternate constructors :meth:`datetime.date.fromisocalendar` " +"and :meth:`datetime.datetime.fromisocalendar`, which " +"construct :class:`~datetime.date` and :class:`~datetime.datetime` objects " +"respectively from ISO year, week number, and weekday; these are the inverse " +"of each class's ``isocalendar`` method. (Contributed by Paul Ganssle " +"in :issue:`36004`.)" msgstr "" #: ../../whatsnew/3.8.rst:764 @@ -1302,8 +1311,8 @@ msgstr "(由 Carl Meyer 在 :issue:`21145` 中貢獻)" #: ../../whatsnew/3.8.rst:796 msgid "" "Added a new :func:`functools.singledispatchmethod` decorator that converts " -"methods into :term:`generic functions ` using :term:" -"`single dispatch`::" +"methods into :term:`generic functions ` " +"using :term:`single dispatch`::" msgstr "" #: ../../whatsnew/3.8.rst:800 @@ -1414,8 +1423,8 @@ msgid "" "Added optional line numbers for IDLE editor windows. Windows open without " "line numbers unless set otherwise in the General tab of the configuration " "dialog. Line numbers for an existing window are shown and hidden in the " -"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar in :issue:" -"`17535`.)" +"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar " +"in :issue:`17535`.)" msgstr "" #: ../../whatsnew/3.8.rst:869 @@ -1434,8 +1443,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:878 msgid "" -"Add option to toggle cursor blink off. (Contributed by Zackery Spytz in :" -"issue:`4603`.)" +"Add option to toggle cursor blink off. (Contributed by Zackery Spytz " +"in :issue:`4603`.)" msgstr "" #: ../../whatsnew/3.8.rst:881 @@ -1594,8 +1603,8 @@ msgstr "(由 Pablo Galindo 在 :issue:`35606` 中貢獻。)" #: ../../whatsnew/3.8.rst:975 msgid "" -"Added two new combinatoric functions :func:`math.perm` and :func:`math." -"comb`::" +"Added two new combinatoric functions :func:`math.perm` " +"and :func:`math.comb`::" msgstr "" #: ../../whatsnew/3.8.rst:977 @@ -1611,8 +1620,8 @@ msgid "" "(Contributed by Yash Aggarwal, Keller Fuchs, Serhiy Storchaka, and Raymond " "Hettinger in :issue:`37128`, :issue:`37178`, and :issue:`35431`.)" msgstr "" -"(由 Yash Aggarwal、Keller Fuchs、Serhiy Storchaka 和 Raymond Hettinger 在 :" -"issue:`37128`、:issue:`37178` 和 :issue:`35431` 中貢獻。)" +"(由 Yash Aggarwal、Keller Fuchs、Serhiy Storchaka 和 Raymond Hettinger " +"在 :issue:`37128`、:issue:`37178` 和 :issue:`35431` 中貢獻。)" #: ../../whatsnew/3.8.rst:985 msgid "" @@ -1655,8 +1664,8 @@ msgstr "mmap" #: ../../whatsnew/3.8.rst:1006 msgid "" "The :class:`mmap.mmap` class now has an :meth:`~mmap.mmap.madvise` method to " -"access the ``madvise()`` system call. (Contributed by Zackery Spytz in :" -"issue:`32941`.)" +"access the ``madvise()`` system call. (Contributed by Zackery Spytz " +"in :issue:`32941`.)" msgstr "" #: ../../whatsnew/3.8.rst:1012 @@ -1683,8 +1692,8 @@ msgstr "os" msgid "" "Added new function :func:`~os.add_dll_directory` on Windows for providing " "additional search paths for native dependencies when importing extension " -"modules or loading DLLs using :mod:`ctypes`. (Contributed by Steve Dower in :" -"issue:`36085`.)" +"modules or loading DLLs using :mod:`ctypes`. (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" #: ../../whatsnew/3.8.rst:1029 @@ -1700,11 +1709,11 @@ msgid "" "symlinks and directory junctions) has been delegated to the operating " "system. Specifically, :func:`os.stat` will now traverse anything supported " "by the operating system, while :func:`os.lstat` will only open reparse " -"points that identify as \"name surrogates\" while others are opened as for :" -"func:`os.stat`. In all cases, :attr:`os.stat_result.st_mode` will only have " -"``S_IFLNK`` set for symbolic links and not other kinds of reparse points. To " -"identify other kinds of reparse point, check the new :attr:`os.stat_result." -"st_reparse_tag` attribute." +"points that identify as \"name surrogates\" while others are opened as " +"for :func:`os.stat`. In all cases, :attr:`os.stat_result.st_mode` will only " +"have ``S_IFLNK`` set for symbolic links and not other kinds of reparse " +"points. To identify other kinds of reparse point, check the " +"new :attr:`os.stat_result.st_reparse_tag` attribute." msgstr "" #: ../../whatsnew/3.8.rst:1042 @@ -1712,8 +1721,8 @@ msgid "" "On Windows, :func:`os.readlink` is now able to read directory junctions. " "Note that :func:`~os.path.islink` will return ``False`` for directory " "junctions, and so code that checks ``islink`` first will continue to treat " -"junctions as directories, while code that handles errors from :func:`os." -"readlink` may now treat junctions as links." +"junctions as directories, while code that handles errors " +"from :func:`os.readlink` may now treat junctions as links." msgstr "" #: ../../whatsnew/3.8.rst:1048 ../../whatsnew/3.8.rst:1073 @@ -1726,21 +1735,21 @@ msgstr "os.path" #: ../../whatsnew/3.8.rst:1054 msgid "" -":mod:`os.path` functions that return a boolean result like :func:`~os.path." -"exists`, :func:`~os.path.lexists`, :func:`~os.path.isdir`, :func:`~os.path." -"isfile`, :func:`~os.path.islink`, and :func:`~os.path.ismount` now return " -"``False`` instead of raising :exc:`ValueError` or its subclasses :exc:" -"`UnicodeEncodeError` and :exc:`UnicodeDecodeError` for paths that contain " -"characters or bytes unrepresentable at the OS level. (Contributed by Serhiy " -"Storchaka in :issue:`33721`.)" +":mod:`os.path` functions that return a boolean result " +"like :func:`~os.path.exists`, :func:`~os.path.lexists`, :func:`~os.path.isdir`, :func:`~os.path.isfile`, :func:`~os.path.islink`, " +"and :func:`~os.path.ismount` now return ``False`` instead of " +"raising :exc:`ValueError` or its subclasses :exc:`UnicodeEncodeError` " +"and :exc:`UnicodeDecodeError` for paths that contain characters or bytes " +"unrepresentable at the OS level. (Contributed by Serhiy Storchaka " +"in :issue:`33721`.)" msgstr "" #: ../../whatsnew/3.8.rst:1062 ../../whatsnew/3.8.rst:1968 msgid "" ":func:`~os.path.expanduser` on Windows now prefers the :envvar:`USERPROFILE` " "environment variable and does not use :envvar:`HOME`, which is not normally " -"set for regular user accounts. (Contributed by Anthony Sottile in :issue:" -"`36264`.)" +"set for regular user accounts. (Contributed by Anthony Sottile " +"in :issue:`36264`.)" msgstr "" #: ../../whatsnew/3.8.rst:1067 @@ -1761,14 +1770,12 @@ msgstr "pathlib" #: ../../whatsnew/3.8.rst:1079 msgid "" -":mod:`pathlib.Path` methods that return a boolean result like :meth:" -"`~pathlib.Path.exists`, :meth:`~pathlib.Path.is_dir`, :meth:`~pathlib.Path." -"is_file`, :meth:`~pathlib.Path.is_mount`, :meth:`~pathlib.Path.is_symlink`, :" -"meth:`~pathlib.Path.is_block_device`, :meth:`~pathlib.Path.is_char_device`, :" -"meth:`~pathlib.Path.is_fifo`, :meth:`~pathlib.Path.is_socket` now return " -"``False`` instead of raising :exc:`ValueError` or its subclass :exc:" -"`UnicodeEncodeError` for paths that contain characters unrepresentable at " -"the OS level. (Contributed by Serhiy Storchaka in :issue:`33721`.)" +":mod:`pathlib.Path` methods that return a boolean result " +"like :meth:`~pathlib.Path.exists`, :meth:`~pathlib.Path.is_dir`, :meth:`~pathlib.Path.is_file`, :meth:`~pathlib.Path.is_mount`, :meth:`~pathlib.Path.is_symlink`, :meth:`~pathlib.Path.is_block_device`, :meth:`~pathlib.Path.is_char_device`, :meth:`~pathlib.Path.is_fifo`, :meth:`~pathlib.Path.is_socket` " +"now return ``False`` instead of raising :exc:`ValueError` or its " +"subclass :exc:`UnicodeEncodeError` for paths that contain characters " +"unrepresentable at the OS level. (Contributed by Serhiy Storchaka " +"in :issue:`33721`.)" msgstr "" #: ../../whatsnew/3.8.rst:1089 @@ -1786,10 +1793,11 @@ msgstr "pickle" #: ../../whatsnew/3.8.rst:1100 msgid "" -":mod:`pickle` extensions subclassing the C-optimized :class:`~pickle." -"Pickler` can now override the pickling logic of functions and classes by " -"defining the special :meth:`~pickle.Pickler.reducer_override` method. " -"(Contributed by Pierre Glaser and Olivier Grisel in :issue:`35900`.)" +":mod:`pickle` extensions subclassing the C-" +"optimized :class:`~pickle.Pickler` can now override the pickling logic of " +"functions and classes by defining the " +"special :meth:`~pickle.Pickler.reducer_override` method. (Contributed by " +"Pierre Glaser and Olivier Grisel in :issue:`35900`.)" msgstr "" #: ../../whatsnew/3.8.rst:1107 @@ -1799,8 +1807,8 @@ msgstr "plistlib" #: ../../whatsnew/3.8.rst:1109 msgid "" "Added new :class:`plistlib.UID` and enabled support for reading and writing " -"NSKeyedArchiver-encoded binary plists. (Contributed by Jon Janzen in :issue:" -"`26707`.)" +"NSKeyedArchiver-encoded binary plists. (Contributed by Jon Janzen " +"in :issue:`26707`.)" msgstr "" #: ../../whatsnew/3.8.rst:1115 @@ -1825,8 +1833,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:1126 msgid "" ">>> from pprint import pprint, pp\n" -">>> d = dict(source='input.txt', operation='filter', destination='output." -"txt')\n" +">>> d = dict(source='input.txt', operation='filter', " +"destination='output.txt')\n" ">>> pp(d, width=40) # Original order\n" "{'source': 'input.txt',\n" " 'operation': 'filter',\n" @@ -1857,8 +1865,8 @@ msgstr "shlex" #: ../../whatsnew/3.8.rst:1150 msgid "" -"The new :func:`shlex.join` function acts as the inverse of :func:`shlex." -"split`. (Contributed by Bo Bayles in :issue:`32102`.)" +"The new :func:`shlex.join` function acts as the inverse " +"of :func:`shlex.split`. (Contributed by Bo Bayles in :issue:`32102`.)" msgstr "" #: ../../whatsnew/3.8.rst:1155 @@ -1882,8 +1890,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:1165 msgid "" ":func:`shutil.rmtree` on Windows now removes directory junctions without " -"recursively removing their contents first. (Contributed by Steve Dower in :" -"issue:`37834`.)" +"recursively removing their contents first. (Contributed by Steve Dower " +"in :issue:`37834`.)" msgstr "" #: ../../whatsnew/3.8.rst:1171 @@ -1900,9 +1908,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1178 msgid "" -"The :func:`socket.if_nameindex`, :func:`socket.if_nametoindex`, and :func:" -"`socket.if_indextoname` functions have been implemented on Windows. " -"(Contributed by Zackery Spytz in :issue:`37007`.)" +"The :func:`socket.if_nameindex`, :func:`socket.if_nametoindex`, " +"and :func:`socket.if_indextoname` functions have been implemented on " +"Windows. (Contributed by Zackery Spytz in :issue:`37007`.)" msgstr "" #: ../../whatsnew/3.8.rst:1184 @@ -1911,9 +1919,10 @@ msgstr "ssl" #: ../../whatsnew/3.8.rst:1186 msgid "" -"Added :attr:`~ssl.SSLContext.post_handshake_auth` to enable and :meth:`~ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :issue:`34670`.)" +"Added :attr:`~ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`~ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :issue:`34670`.)" msgstr "" #: ../../whatsnew/3.8.rst:1193 @@ -1922,9 +1931,9 @@ msgstr "statistics" #: ../../whatsnew/3.8.rst:1195 msgid "" -"Added :func:`statistics.fmean` as a faster, floating-point variant of :func:" -"`statistics.mean`. (Contributed by Raymond Hettinger and Steven D'Aprano " -"in :issue:`35904`.)" +"Added :func:`statistics.fmean` as a faster, floating-point variant " +"of :func:`statistics.mean`. (Contributed by Raymond Hettinger and Steven " +"D'Aprano in :issue:`35904`.)" msgstr "" #: ../../whatsnew/3.8.rst:1199 @@ -1932,8 +1941,8 @@ msgid "" "Added :func:`statistics.geometric_mean` (Contributed by Raymond Hettinger " "in :issue:`27181`.)" msgstr "" -"新增 :func:`statistics.geometric_mean`\\ (由 Raymond Hettinger 在 :issue:" -"`27181` 中貢獻。)" +"新增 :func:`statistics.geometric_mean`\\ (由 Raymond Hettinger " +"在 :issue:`27181` 中貢獻。)" #: ../../whatsnew/3.8.rst:1202 msgid "" @@ -2012,20 +2021,21 @@ msgstr "threading" #: ../../whatsnew/3.8.rst:1262 msgid "" -"Add a new :func:`threading.excepthook` function which handles uncaught :meth:" -"`threading.Thread.run` exception. It can be overridden to control how " -"uncaught :meth:`threading.Thread.run` exceptions are handled. (Contributed " -"by Victor Stinner in :issue:`1230540`.)" +"Add a new :func:`threading.excepthook` function which handles " +"uncaught :meth:`threading.Thread.run` exception. It can be overridden to " +"control how uncaught :meth:`threading.Thread.run` exceptions are handled. " +"(Contributed by Victor Stinner in :issue:`1230540`.)" msgstr "" #: ../../whatsnew/3.8.rst:1267 msgid "" -"Add a new :func:`threading.get_native_id` function and a :data:`~threading." -"Thread.native_id` attribute to the :class:`threading.Thread` class. These " -"return the native integral Thread ID of the current thread assigned by the " -"kernel. This feature is only available on certain platforms, see :func:" -"`get_native_id ` for more information. (Contributed " -"by Jake Tesler in :issue:`36084`.)" +"Add a new :func:`threading.get_native_id` function and " +"a :data:`~threading.Thread.native_id` attribute to " +"the :class:`threading.Thread` class. These return the native integral Thread " +"ID of the current thread assigned by the kernel. This feature is only " +"available on certain platforms, see :func:`get_native_id " +"` for more information. (Contributed by Jake Tesler " +"in :issue:`36084`.)" msgstr "" #: ../../whatsnew/3.8.rst:1277 @@ -2060,8 +2070,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:1299 msgid "" "The :class:`!tkinter.PhotoImage` class now has :meth:`!transparency_get` " -"and :meth:`!transparency_set` methods. (Contributed by Zackery Spytz in :" -"issue:`25451`.)" +"and :meth:`!transparency_set` methods. (Contributed by Zackery Spytz " +"in :issue:`25451`.)" msgstr "" #: ../../whatsnew/3.8.rst:1306 @@ -2084,10 +2094,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1317 msgid "" -"A dictionary type with per-key types. See :pep:`589` and :class:`typing." -"TypedDict`. TypedDict uses only string keys. By default, every key is " -"required to be present. Specify \"total=False\" to allow keys to be " -"optional::" +"A dictionary type with per-key types. See :pep:`589` " +"and :class:`typing.TypedDict`. TypedDict uses only string keys. By default, " +"every key is required to be present. Specify \"total=False\" to allow keys " +"to be optional::" msgstr "" #: ../../whatsnew/3.8.rst:1322 @@ -2119,9 +2129,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1334 msgid "" -"\"Final\" variables, functions, methods and classes. See :pep:`591`, :class:" -"`typing.Final` and :func:`typing.final`. The final qualifier instructs a " -"static type checker to restrict subclassing, overriding, or reassignment::" +"\"Final\" variables, functions, methods and classes. " +"See :pep:`591`, :class:`typing.Final` and :func:`typing.final`. The final " +"qualifier instructs a static type checker to restrict subclassing, " +"overriding, or reassignment::" msgstr "" #: ../../whatsnew/3.8.rst:1339 @@ -2130,9 +2141,9 @@ msgstr "pi: Final[float] = 3.1415926536" #: ../../whatsnew/3.8.rst:1341 msgid "" -"Protocol definitions. See :pep:`544`, :class:`typing.Protocol` and :func:" -"`typing.runtime_checkable`. Simple ABCs like :class:`typing.SupportsInt` " -"are now ``Protocol`` subclasses." +"Protocol definitions. See :pep:`544`, :class:`typing.Protocol` " +"and :func:`typing.runtime_checkable`. Simple ABCs " +"like :class:`typing.SupportsInt` are now ``Protocol`` subclasses." msgstr "" #: ../../whatsnew/3.8.rst:1345 @@ -2169,16 +2180,17 @@ msgstr "unittest" msgid "" "Added :class:`~unittest.mock.AsyncMock` to support an asynchronous version " "of :class:`~unittest.mock.Mock`. Appropriate new assert functions for " -"testing have been added as well. (Contributed by Lisa Roach in :issue:" -"`26467`)." +"testing have been added as well. (Contributed by Lisa Roach " +"in :issue:`26467`)." msgstr "" #: ../../whatsnew/3.8.rst:1370 msgid "" -"Added :func:`~unittest.addModuleCleanup` and :meth:`~unittest.TestCase." -"addClassCleanup` to unittest to support cleanups for :func:`~unittest." -"setUpModule` and :meth:`~unittest.TestCase.setUpClass`. (Contributed by Lisa " -"Roach in :issue:`24412`.)" +"Added :func:`~unittest.addModuleCleanup` " +"and :meth:`~unittest.TestCase.addClassCleanup` to unittest to support " +"cleanups for :func:`~unittest.setUpModule` " +"and :meth:`~unittest.TestCase.setUpClass`. (Contributed by Lisa Roach " +"in :issue:`24412`.)" msgstr "" #: ../../whatsnew/3.8.rst:1376 @@ -2266,9 +2278,10 @@ msgstr "xml" #: ../../whatsnew/3.8.rst:1424 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :issue:`17239`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :issue:`17239`.)" msgstr "" #: ../../whatsnew/3.8.rst:1429 @@ -2281,19 +2294,20 @@ msgstr "" #: ../../whatsnew/3.8.rst:1434 msgid "" -"The :mod:`xml.etree.ElementTree` module provides a new function :func:`~xml." -"etree.ElementTree.canonicalize` that implements C14N 2.0. (Contributed by " -"Stefan Behnel in :issue:`13611`.)" +"The :mod:`xml.etree.ElementTree` module provides a new " +"function :func:`~xml.etree.ElementTree.canonicalize` that implements C14N " +"2.0. (Contributed by Stefan Behnel in :issue:`13611`.)" msgstr "" #: ../../whatsnew/3.8.rst:1438 msgid "" "The target object of :class:`xml.etree.ElementTree.XMLParser` can receive " "namespace declaration events through the new callback methods ``start_ns()`` " -"and ``end_ns()``. Additionally, the :class:`xml.etree.ElementTree." -"TreeBuilder` target can be configured to process events about comments and " -"processing instructions to include them in the generated tree. (Contributed " -"by Stefan Behnel in :issue:`36676` and :issue:`36673`.)" +"and ``end_ns()``. Additionally, " +"the :class:`xml.etree.ElementTree.TreeBuilder` target can be configured to " +"process events about comments and processing instructions to include them in " +"the generated tree. (Contributed by Stefan Behnel in :issue:`36676` " +"and :issue:`36673`.)" msgstr "" #: ../../whatsnew/3.8.rst:1448 @@ -2340,15 +2354,15 @@ msgstr "(由 Joannah Nanjekye 和 Victor Stinner 在 :issue:`35537` 中貢獻 #: ../../whatsnew/3.8.rst:1471 msgid "" -":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:" -"`shutil.copytree` and :func:`shutil.move` use platform-specific \"fast-" -"copy\" syscalls on Linux and macOS in order to copy the file more " -"efficiently. \"fast-copy\" means that the copying operation occurs within " -"the kernel, avoiding the use of userspace buffers in Python as in \"``outfd." -"write(infd.read())``\". On Windows :func:`shutil.copyfile` uses a bigger " -"default buffer size (1 MiB instead of 16 KiB) and a :func:`memoryview`-based " -"variant of :func:`shutil.copyfileobj` is used. The speedup for copying a 512 " -"MiB file within the same partition is about +26% on Linux, +50% on macOS and " +":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:`shutil.copytree` " +"and :func:`shutil.move` use platform-specific \"fast-copy\" syscalls on " +"Linux and macOS in order to copy the file more efficiently. \"fast-copy\" " +"means that the copying operation occurs within the kernel, avoiding the use " +"of userspace buffers in Python as in \"``outfd.write(infd.read())``\". On " +"Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " +"instead of 16 KiB) and a :func:`memoryview`-based variant " +"of :func:`shutil.copyfileobj` is used. The speedup for copying a 512 MiB " +"file within the same partition is about +26% on Linux, +50% on macOS and " "+40% on Windows. Also, much less CPU cycles are consumed. See :ref:`shutil-" "platform-dependent-efficient-copy-operations` section. (Contributed by " "Giampaolo Rodolà in :issue:`33671`.)" @@ -2420,15 +2434,15 @@ msgstr "" msgid "" "Reduced an overhead of converting arguments passed to many builtin functions " "and methods. This sped up calling some simple builtin functions and methods " -"up to 20--50%. (Contributed by Serhiy Storchaka in :issue:`23867`, :issue:" -"`35582` and :issue:`36127`.)" +"up to 20--50%. (Contributed by Serhiy Storchaka " +"in :issue:`23867`, :issue:`35582` and :issue:`36127`.)" msgstr "" #: ../../whatsnew/3.8.rst:1531 msgid "" "``LOAD_GLOBAL`` instruction now uses new \"per opcode cache\" mechanism. It " -"is about 40% faster now. (Contributed by Yury Selivanov and Inada Naoki in :" -"issue:`26219`.)" +"is about 40% faster now. (Contributed by Yury Selivanov and Inada Naoki " +"in :issue:`26219`.)" msgstr "" #: ../../whatsnew/3.8.rst:1537 @@ -2439,8 +2453,8 @@ msgstr "建置和 C API 變更" msgid "" "Default :data:`sys.abiflags` became an empty string: the ``m`` flag for " "pymalloc became useless (builds with and without pymalloc are ABI " -"compatible) and so has been removed. (Contributed by Victor Stinner in :" -"issue:`36707`.)" +"compatible) and so has been removed. (Contributed by Victor Stinner " +"in :issue:`36707`.)" msgstr "" #: ../../whatsnew/3.8.rst:1543 @@ -2542,8 +2556,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:1587 msgid "" "The result of :c:func:`PyExceptionClass_Name` is now of type ``const char " -"*`` rather of ``char *``. (Contributed by Serhiy Storchaka in :issue:" -"`33818`.)" +"*`` rather of ``char *``. (Contributed by Serhiy Storchaka " +"in :issue:`33818`.)" msgstr "" #: ../../whatsnew/3.8.rst:1591 @@ -2571,27 +2585,28 @@ msgstr "(由 Antoine Pitrou 在 :issue:`32430` 中貢獻。)" #: ../../whatsnew/3.8.rst:1606 msgid "" -"Functions that convert Python number to C integer like :c:func:" -"`PyLong_AsLong` and argument parsing functions like :c:func:" -"`PyArg_ParseTuple` with integer converting format units like ``'i'`` will " -"now use the :meth:`~object.__index__` special method instead of :meth:" -"`~object.__int__`, if available. The deprecation warning will be emitted " -"for objects with the ``__int__()`` method but without the ``__index__()`` " -"method (like :class:`~decimal.Decimal` and :class:`~fractions.Fraction`). :" -"c:func:`PyNumber_Check` will now return ``1`` for objects implementing " -"``__index__()``. :c:func:`PyNumber_Long`, :c:func:`PyNumber_Float` and :c:" -"func:`PyFloat_AsDouble` also now use the ``__index__()`` method if " -"available. (Contributed by Serhiy Storchaka in :issue:`36048` and :issue:" -"`20092`.)" +"Functions that convert Python number to C integer " +"like :c:func:`PyLong_AsLong` and argument parsing functions " +"like :c:func:`PyArg_ParseTuple` with integer converting format units like " +"``'i'`` will now use the :meth:`~object.__index__` special method instead " +"of :meth:`~object.__int__`, if available. The deprecation warning will be " +"emitted for objects with the ``__int__()`` method but without the " +"``__index__()`` method (like :class:`~decimal.Decimal` " +"and :class:`~fractions.Fraction`). :c:func:`PyNumber_Check` will now return " +"``1`` for objects implementing " +"``__index__()``. :c:func:`PyNumber_Long`, :c:func:`PyNumber_Float` " +"and :c:func:`PyFloat_AsDouble` also now use the ``__index__()`` method if " +"available. (Contributed by Serhiy Storchaka in :issue:`36048` " +"and :issue:`20092`.)" msgstr "" #: ../../whatsnew/3.8.rst:1620 msgid "" -"Heap-allocated type objects will now increase their reference count in :c:" -"func:`PyObject_Init` (and its parallel macro ``PyObject_INIT``) instead of " -"in :c:func:`PyType_GenericAlloc`. Types that modify instance allocation or " -"deallocation may need to be adjusted. (Contributed by Eddie Elizondo in :" -"issue:`35810`.)" +"Heap-allocated type objects will now increase their reference count " +"in :c:func:`PyObject_Init` (and its parallel macro ``PyObject_INIT``) " +"instead of in :c:func:`PyType_GenericAlloc`. Types that modify instance " +"allocation or deallocation may need to be adjusted. (Contributed by Eddie " +"Elizondo in :issue:`35810`.)" msgstr "" #: ../../whatsnew/3.8.rst:1626 @@ -2605,8 +2620,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1631 msgid "" ":c:func:`!Py_SetPath` now sets :data:`sys.executable` to the program full " -"path (:c:func:`Py_GetProgramFullPath`) rather than to the program name (:c:" -"func:`Py_GetProgramName`). (Contributed by Victor Stinner in :issue:`38234`.)" +"path (:c:func:`Py_GetProgramFullPath`) rather than to the program name " +"(:c:func:`Py_GetProgramName`). (Contributed by Victor Stinner " +"in :issue:`38234`.)" msgstr "" #: ../../whatsnew/3.8.rst:1638 @@ -2616,38 +2632,40 @@ msgstr "已棄用" #: ../../whatsnew/3.8.rst:1640 msgid "" "The distutils ``bdist_wininst`` command is now deprecated, use " -"``bdist_wheel`` (wheel packages) instead. (Contributed by Victor Stinner in :" -"issue:`37481`.)" +"``bdist_wheel`` (wheel packages) instead. (Contributed by Victor Stinner " +"in :issue:`37481`.)" msgstr "" #: ../../whatsnew/3.8.rst:1644 msgid "" -"Deprecated methods ``getchildren()`` and ``getiterator()`` in the :mod:`~xml." -"etree.ElementTree` module now emit a :exc:`DeprecationWarning` instead of :" -"exc:`PendingDeprecationWarning`. They will be removed in Python 3.9. " -"(Contributed by Serhiy Storchaka in :issue:`29209`.)" +"Deprecated methods ``getchildren()`` and ``getiterator()`` in " +"the :mod:`~xml.etree.ElementTree` module now emit " +"a :exc:`DeprecationWarning` instead of :exc:`PendingDeprecationWarning`. " +"They will be removed in Python 3.9. (Contributed by Serhiy Storchaka " +"in :issue:`29209`.)" msgstr "" #: ../../whatsnew/3.8.rst:1650 msgid "" -"Passing an object that is not an instance of :class:`concurrent.futures." -"ThreadPoolExecutor` to :meth:`loop.set_default_executor() ` is deprecated and will be prohibited in Python 3.9. " -"(Contributed by Elvis Pranskevichus in :issue:`34075`.)" +"Passing an object that is not an instance " +"of :class:`concurrent.futures.ThreadPoolExecutor` " +"to :meth:`loop.set_default_executor() ` " +"is deprecated and will be prohibited in Python 3.9. (Contributed by Elvis " +"Pranskevichus in :issue:`34075`.)" msgstr "" #: ../../whatsnew/3.8.rst:1656 msgid "" -"The :meth:`~object.__getitem__` methods of :class:`xml.dom.pulldom." -"DOMEventStream`, :class:`wsgiref.util.FileWrapper` and :class:`fileinput." -"FileInput` have been deprecated." +"The :meth:`~object.__getitem__` methods " +"of :class:`xml.dom.pulldom.DOMEventStream`, :class:`wsgiref.util.FileWrapper` " +"and :class:`fileinput.FileInput` have been deprecated." msgstr "" #: ../../whatsnew/3.8.rst:1660 msgid "" "Implementations of these methods have been ignoring their *index* parameter, " -"and returning the next item instead. (Contributed by Berker Peksag in :issue:" -"`9372`.)" +"and returning the next item instead. (Contributed by Berker Peksag " +"in :issue:`9372`.)" msgstr "" #: ../../whatsnew/3.8.rst:1664 @@ -2669,28 +2687,25 @@ msgstr "" msgid "" ":class:`ast.NodeVisitor` methods ``visit_Num()``, ``visit_Str()``, " "``visit_Bytes()``, ``visit_NameConstant()`` and ``visit_Ellipsis()`` are " -"deprecated now and will not be called in future Python versions. Add the :" -"meth:`~ast.NodeVisitor.visit_Constant` method to handle all constant nodes. " -"(Contributed by Serhiy Storchaka in :issue:`36917`.)" +"deprecated now and will not be called in future Python versions. Add " +"the :meth:`~ast.NodeVisitor.visit_Constant` method to handle all constant " +"nodes. (Contributed by Serhiy Storchaka in :issue:`36917`.)" msgstr "" #: ../../whatsnew/3.8.rst:1680 msgid "" "The :deco:`!asyncio.coroutine` :term:`decorator` is deprecated and will be " -"removed in version 3.10. Instead of ``@asyncio.coroutine``, use :keyword:" -"`async def` instead. (Contributed by Andrew Svetlov in :issue:`36921`.)" +"removed in version 3.10. Instead of ``@asyncio.coroutine``, " +"use :keyword:`async def` instead. (Contributed by Andrew Svetlov " +"in :issue:`36921`.)" msgstr "" #: ../../whatsnew/3.8.rst:1685 msgid "" "In :mod:`asyncio`, the explicit passing of a *loop* argument has been " -"deprecated and will be removed in version 3.10 for the following: :func:" -"`asyncio.sleep`, :func:`asyncio.gather`, :func:`asyncio.shield`, :func:" -"`asyncio.wait_for`, :func:`asyncio.wait`, :func:`asyncio.as_completed`, :" -"class:`asyncio.Task`, :class:`asyncio.Lock`, :class:`asyncio.Event`, :class:" -"`asyncio.Condition`, :class:`asyncio.Semaphore`, :class:`asyncio." -"BoundedSemaphore`, :class:`asyncio.Queue`, :func:`asyncio." -"create_subprocess_exec`, and :func:`asyncio.create_subprocess_shell`." +"deprecated and will be removed in version 3.10 for the " +"following: :func:`asyncio.sleep`, :func:`asyncio.gather`, :func:`asyncio.shield`, :func:`asyncio.wait_for`, :func:`asyncio.wait`, :func:`asyncio.as_completed`, :class:`asyncio.Task`, :class:`asyncio.Lock`, :class:`asyncio.Event`, :class:`asyncio.Condition`, :class:`asyncio.Semaphore`, :class:`asyncio.BoundedSemaphore`, :class:`asyncio.Queue`, :func:`asyncio.create_subprocess_exec`, " +"and :func:`asyncio.create_subprocess_shell`." msgstr "" #: ../../whatsnew/3.8.rst:1695 @@ -2703,22 +2718,22 @@ msgstr "" #: ../../whatsnew/3.8.rst:1699 msgid "" "The following functions and methods are deprecated in the :mod:`gettext` " -"module: :func:`!lgettext`, :func:`!ldgettext`, :func:`!lngettext` and :func:" -"`!ldngettext`. They return encoded bytes, and it's possible that you will " -"get unexpected Unicode-related exceptions if there are encoding problems " -"with the translated strings. It's much better to use alternatives which " -"return Unicode strings in Python 3. These functions have been broken for a " -"long time." +"module: :func:`!lgettext`, :func:`!ldgettext`, :func:`!lngettext` " +"and :func:`!ldngettext`. They return encoded bytes, and it's possible that " +"you will get unexpected Unicode-related exceptions if there are encoding " +"problems with the translated strings. It's much better to use alternatives " +"which return Unicode strings in Python 3. These functions have been broken " +"for a long time." msgstr "" #: ../../whatsnew/3.8.rst:1707 msgid "" -"Function :func:`!bind_textdomain_codeset`, methods :meth:`!NullTranslations." -"output_charset` and :meth:`!NullTranslations.set_output_charset`, and the " -"*codeset* parameter of functions :func:`~gettext.translation` and :func:" -"`~gettext.install` are also deprecated, since they are only used for the " -"``l*gettext()`` functions. (Contributed by Serhiy Storchaka in :issue:" -"`33710`.)" +"Function :func:`!bind_textdomain_codeset`, methods :meth:`!" +"NullTranslations.output_charset` and :meth:`!" +"NullTranslations.set_output_charset`, and the *codeset* parameter of " +"functions :func:`~gettext.translation` and :func:`~gettext.install` are also " +"deprecated, since they are only used for the ``l*gettext()`` functions. " +"(Contributed by Serhiy Storchaka in :issue:`33710`.)" msgstr "" #: ../../whatsnew/3.8.rst:1715 @@ -2730,11 +2745,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:1719 msgid "" "Many builtin and extension functions that take integer arguments will now " -"emit a deprecation warning for :class:`~decimal.Decimal`\\ s, :class:" -"`~fractions.Fraction`\\ s and any other objects that can be converted to " -"integers only with a loss (e.g. that have the :meth:`~object.__int__` method " -"but do not have the :meth:`~object.__index__` method). In future version " -"they will be errors. (Contributed by Serhiy Storchaka in :issue:`36048`.)" +"emit a deprecation warning for :class:`~decimal.Decimal`\\ " +"s, :class:`~fractions.Fraction`\\ s and any other objects that can be " +"converted to integers only with a loss (e.g. that have " +"the :meth:`~object.__int__` method but do not have " +"the :meth:`~object.__index__` method). In future version they will be " +"errors. (Contributed by Serhiy Storchaka in :issue:`36048`.)" msgstr "" #: ../../whatsnew/3.8.rst:1727 @@ -2743,9 +2759,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1729 msgid "" -"*func* in :func:`functools.partialmethod`, :func:`weakref.finalize`, :meth:" -"`profile.Profile.runcall`, :meth:`!cProfile.Profile.runcall`, :meth:`bdb.Bdb." -"runcall`, :meth:`trace.Trace.runfunc` and :func:`curses.wrapper`." +"*func* " +"in :func:`functools.partialmethod`, :func:`weakref.finalize`, :meth:`profile.Profile.runcall`, :meth:`!" +"cProfile.Profile.runcall`, :meth:`bdb.Bdb.runcall`, :meth:`trace.Trace.runfunc` " +"and :func:`curses.wrapper`." msgstr "" #: ../../whatsnew/3.8.rst:1733 @@ -2754,22 +2771,23 @@ msgstr "" #: ../../whatsnew/3.8.rst:1734 msgid "" -"*fn* in the :meth:`~concurrent.futures.Executor.submit` method of :class:" -"`concurrent.futures.ThreadPoolExecutor` and :class:`concurrent.futures." -"ProcessPoolExecutor`." +"*fn* in the :meth:`~concurrent.futures.Executor.submit` method " +"of :class:`concurrent.futures.ThreadPoolExecutor` " +"and :class:`concurrent.futures.ProcessPoolExecutor`." msgstr "" #: ../../whatsnew/3.8.rst:1737 msgid "" -"*callback* in :meth:`contextlib.ExitStack.callback`, :meth:`!contextlib." -"AsyncExitStack.callback` and :meth:`contextlib.AsyncExitStack." -"push_async_callback`." +"*callback* in :meth:`contextlib.ExitStack.callback`, :meth:`!" +"contextlib.AsyncExitStack.callback` " +"and :meth:`contextlib.AsyncExitStack.push_async_callback`." msgstr "" #: ../../whatsnew/3.8.rst:1740 msgid "" -"*c* and *typeid* in the :meth:`!create` method of :class:`!multiprocessing." -"managers.Server` and :class:`!multiprocessing.managers.SharedMemoryServer`." +"*c* and *typeid* in the :meth:`!create` method of :class:`!" +"multiprocessing.managers.Server` and :class:`!" +"multiprocessing.managers.SharedMemoryServer`." msgstr "" #: ../../whatsnew/3.8.rst:1743 @@ -2814,9 +2832,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1767 msgid "" "The function :func:`!time.clock` has been removed, after having been " -"deprecated since Python 3.3: use :func:`time.perf_counter` or :func:`time." -"process_time` instead, depending on your requirements, to have well-defined " -"behavior. (Contributed by Matthias Bussonnier in :issue:`36895`.)" +"deprecated since Python 3.3: use :func:`time.perf_counter` " +"or :func:`time.process_time` instead, depending on your requirements, to " +"have well-defined behavior. (Contributed by Matthias Bussonnier " +"in :issue:`36895`.)" msgstr "" #: ../../whatsnew/3.8.rst:1773 @@ -2849,14 +2868,15 @@ msgstr "" #: ../../whatsnew/3.8.rst:1789 msgid "" -"Removed the ``doctype()`` method of :class:`~xml.etree.ElementTree." -"XMLParser`. (Contributed by Serhiy Storchaka in :issue:`29209`.)" +"Removed the ``doctype()`` method " +"of :class:`~xml.etree.ElementTree.XMLParser`. (Contributed by Serhiy " +"Storchaka in :issue:`29209`.)" msgstr "" #: ../../whatsnew/3.8.rst:1792 msgid "" -"\"unicode_internal\" codec is removed. (Contributed by Inada Naoki in :issue:" -"`36297`.)" +"\"unicode_internal\" codec is removed. (Contributed by Inada Naoki " +"in :issue:`36297`.)" msgstr "" #: ../../whatsnew/3.8.rst:1795 @@ -2867,16 +2887,17 @@ msgstr "" #: ../../whatsnew/3.8.rst:1799 msgid "" -"The ``bufsize`` keyword argument of :func:`fileinput.input` and :func:" -"`fileinput.FileInput` which was ignored and deprecated since Python 3.6 has " -"been removed. :issue:`36952` (Contributed by Matthias Bussonnier.)" +"The ``bufsize`` keyword argument of :func:`fileinput.input` " +"and :func:`fileinput.FileInput` which was ignored and deprecated since " +"Python 3.6 has been removed. :issue:`36952` (Contributed by Matthias " +"Bussonnier.)" msgstr "" #: ../../whatsnew/3.8.rst:1803 msgid "" -"The functions :func:`!sys.set_coroutine_wrapper` and :func:`!sys." -"get_coroutine_wrapper` deprecated in Python 3.7 have been removed; :issue:" -"`36933` (Contributed by Matthias Bussonnier.)" +"The functions :func:`!sys.set_coroutine_wrapper` and :func:`!" +"sys.get_coroutine_wrapper` deprecated in Python 3.7 have been " +"removed; :issue:`36933` (Contributed by Matthias Bussonnier.)" msgstr "" #: ../../whatsnew/3.8.rst:1809 @@ -2907,8 +2928,8 @@ msgid "" "(``is`` and ``is not``) are used with certain types of literals (e.g. " "strings, numbers). These can often work by accident in CPython, but are not " "guaranteed by the language spec. The warning advises users to use equality " -"tests (``==`` and ``!=``) instead. (Contributed by Serhiy Storchaka in :" -"issue:`34850`.)" +"tests (``==`` and ``!=``) instead. (Contributed by Serhiy Storchaka " +"in :issue:`34850`.)" msgstr "" #: ../../whatsnew/3.8.rst:1830 @@ -2921,12 +2942,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:1835 msgid "" -"Removed ``__str__`` implementations from builtin types :class:`bool`, :class:" -"`int`, :class:`float`, :class:`complex` and few classes from the standard " -"library. They now inherit ``__str__()`` from :class:`object`. As result, " -"defining the ``__repr__()`` method in the subclass of these classes will " -"affect their string representation. (Contributed by Serhiy Storchaka in :" -"issue:`36793`.)" +"Removed ``__str__`` implementations from builtin " +"types :class:`bool`, :class:`int`, :class:`float`, :class:`complex` and few " +"classes from the standard library. They now inherit ``__str__()`` " +"from :class:`object`. As result, defining the ``__repr__()`` method in the " +"subclass of these classes will affect their string representation. " +"(Contributed by Serhiy Storchaka in :issue:`36793`.)" msgstr "" #: ../../whatsnew/3.8.rst:1842 @@ -2934,18 +2955,19 @@ msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix3'`` .. ``'aix7'``. Since older " "Python versions include the version number, so it is recommended to always " -"use ``sys.platform.startswith('aix')``. (Contributed by M. Felt in :issue:" -"`36588`.)" +"use ``sys.platform.startswith('aix')``. (Contributed by M. Felt " +"in :issue:`36588`.)" msgstr "" #: ../../whatsnew/3.8.rst:1848 msgid "" ":c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_AcquireThread` now " "terminate the current thread if called while the interpreter is finalizing, " -"making them consistent with :c:func:`PyEval_RestoreThread`, :c:func:" -"`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`. If this behavior is " -"not desired, guard the call by checking :c:func:`!_Py_IsFinalizing` or :func:" -"`sys.is_finalizing`. (Contributed by Joannah Nanjekye in :issue:`36475`.)" +"making them consistent " +"with :c:func:`PyEval_RestoreThread`, :c:func:`Py_END_ALLOW_THREADS`, " +"and :c:func:`PyGILState_Ensure`. If this behavior is not desired, guard the " +"call by checking :c:func:`!_Py_IsFinalizing` or :func:`sys.is_finalizing`. " +"(Contributed by Joannah Nanjekye in :issue:`36475`.)" msgstr "" #: ../../whatsnew/3.8.rst:1858 ../../whatsnew/3.8.rst:2324 @@ -2964,19 +2986,19 @@ msgstr "" msgid "" ":class:`subprocess.Popen` can now use :func:`os.posix_spawn` in some cases " "for better performance. On Windows Subsystem for Linux and QEMU User " -"Emulation, the :class:`~subprocess.Popen` constructor using :func:`os." -"posix_spawn` no longer raises an exception on errors like \"missing " -"program\". Instead the child process fails with a non-zero :attr:" -"`~subprocess.Popen.returncode`. (Contributed by Joannah Nanjekye and Victor " -"Stinner in :issue:`35537`.)" +"Emulation, the :class:`~subprocess.Popen` constructor " +"using :func:`os.posix_spawn` no longer raises an exception on errors like " +"\"missing program\". Instead the child process fails with a non-" +"zero :attr:`~subprocess.Popen.returncode`. (Contributed by Joannah Nanjekye " +"and Victor Stinner in :issue:`35537`.)" msgstr "" #: ../../whatsnew/3.8.rst:1873 msgid "" "The *preexec_fn* argument of * :class:`subprocess.Popen` is no longer " "compatible with subinterpreters. The use of the parameter in a " -"subinterpreter now raises :exc:`RuntimeError`. (Contributed by Eric Snow in :" -"issue:`34651`, modified by Christian Heimes in :issue:`37951`.)" +"subinterpreter now raises :exc:`RuntimeError`. (Contributed by Eric Snow " +"in :issue:`34651`, modified by Christian Heimes in :issue:`37951`.)" msgstr "" #: ../../whatsnew/3.8.rst:1879 @@ -2994,46 +3016,48 @@ msgstr "" #: ../../whatsnew/3.8.rst:1892 msgid "" -"The :meth:`~tkinter.ttk.Treeview.selection` method of the :class:`tkinter." -"ttk.Treeview` class no longer takes arguments. Using it with arguments for " -"changing the selection was deprecated in Python 3.6. Use specialized " -"methods like :meth:`~tkinter.ttk.Treeview.selection_set` for changing the " -"selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)" +"The :meth:`~tkinter.ttk.Treeview.selection` method of " +"the :class:`tkinter.ttk.Treeview` class no longer takes arguments. Using it " +"with arguments for changing the selection was deprecated in Python 3.6. Use " +"specialized methods like :meth:`~tkinter.ttk.Treeview.selection_set` for " +"changing the selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)" msgstr "" #: ../../whatsnew/3.8.rst:1898 msgid "" -"The :meth:`~xml.dom.minidom.Node.writexml`, :meth:`~xml.dom.minidom.Node." -"toxml` and :meth:`~xml.dom.minidom.Node.toprettyxml` methods of :mod:`xml." -"dom.minidom` and the :meth:`~xml.etree.ElementTree.ElementTree.write` method " +"The :meth:`~xml.dom.minidom.Node.writexml`, :meth:`~xml.dom.minidom.Node.toxml` " +"and :meth:`~xml.dom.minidom.Node.toprettyxml` methods " +"of :mod:`xml.dom.minidom` and " +"the :meth:`~xml.etree.ElementTree.ElementTree.write` method " "of :mod:`xml.etree.ElementTree` now preserve the attribute order specified " -"by the user. (Contributed by Diego Rojas and Raymond Hettinger in :issue:" -"`34160`.)" +"by the user. (Contributed by Diego Rojas and Raymond Hettinger " +"in :issue:`34160`.)" msgstr "" #: ../../whatsnew/3.8.rst:1905 msgid "" -"A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-only. :func:" -"`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates a database " -"if it does not exist. (Contributed by Serhiy Storchaka in :issue:`32749`.)" +"A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-" +"only. :func:`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates " +"a database if it does not exist. (Contributed by Serhiy Storchaka " +"in :issue:`32749`.)" msgstr "" #: ../../whatsnew/3.8.rst:1910 msgid "" -"The ``doctype()`` method defined in a subclass of :class:`~xml.etree." -"ElementTree.XMLParser` will no longer be called and will emit a :exc:" -"`RuntimeWarning` instead of a :exc:`DeprecationWarning`. Define the :meth:" -"`doctype() ` method on a target " -"for handling an XML doctype declaration. (Contributed by Serhiy Storchaka " -"in :issue:`29209`.)" +"The ``doctype()`` method defined in a subclass " +"of :class:`~xml.etree.ElementTree.XMLParser` will no longer be called and " +"will emit a :exc:`RuntimeWarning` instead of a :exc:`DeprecationWarning`. " +"Define the :meth:`doctype() ` " +"method on a target for handling an XML doctype declaration. (Contributed by " +"Serhiy Storchaka in :issue:`29209`.)" msgstr "" #: ../../whatsnew/3.8.rst:1917 msgid "" "A :exc:`RuntimeError` is now raised when the custom metaclass doesn't " -"provide the ``__classcell__`` entry in the namespace passed to ``type." -"__new__``. A :exc:`DeprecationWarning` was emitted in Python 3.6--3.7. " -"(Contributed by Serhiy Storchaka in :issue:`23722`.)" +"provide the ``__classcell__`` entry in the namespace passed to " +"``type.__new__``. A :exc:`DeprecationWarning` was emitted in Python " +"3.6--3.7. (Contributed by Serhiy Storchaka in :issue:`23722`.)" msgstr "" #: ../../whatsnew/3.8.rst:1922 @@ -3044,10 +3068,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1925 msgid "" -":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:" -"`shutil.copytree` and :func:`shutil.move` use platform-specific \"fast-" -"copy\" syscalls (see :ref:`shutil-platform-dependent-efficient-copy-" -"operations` section)." +":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:`shutil.copytree` " +"and :func:`shutil.move` use platform-specific \"fast-copy\" syscalls " +"(see :ref:`shutil-platform-dependent-efficient-copy-operations` section)." msgstr "" #: ../../whatsnew/3.8.rst:1930 @@ -3092,18 +3115,19 @@ msgstr "" #: ../../whatsnew/3.8.rst:1957 msgid "" -"Deleting a key from a read-only :mod:`dbm` database (:mod:`dbm.dumb`, :mod:" -"`dbm.gnu` or :mod:`dbm.ndbm`) raises :attr:`!error` (:exc:`dbm.dumb.error`, :" -"exc:`dbm.gnu.error` or :exc:`dbm.ndbm.error`) instead of :exc:`KeyError`. " -"(Contributed by Xiang Zhang in :issue:`33106`.)" +"Deleting a key from a read-only :mod:`dbm` database " +"(:mod:`dbm.dumb`, :mod:`dbm.gnu` or :mod:`dbm.ndbm`) raises :attr:`!error` " +"(:exc:`dbm.dumb.error`, :exc:`dbm.gnu.error` or :exc:`dbm.ndbm.error`) " +"instead of :exc:`KeyError`. (Contributed by Xiang Zhang in :issue:`33106`.)" msgstr "" #: ../../whatsnew/3.8.rst:1962 msgid "" -"Simplified AST for literals. All constants will be represented as :class:" -"`ast.Constant` instances. Instantiating old classes ``Num``, ``Str``, " -"``Bytes``, ``NameConstant`` and ``Ellipsis`` will return an instance of " -"``Constant``. (Contributed by Serhiy Storchaka in :issue:`32892`.)" +"Simplified AST for literals. All constants will be represented " +"as :class:`ast.Constant` instances. Instantiating old classes ``Num``, " +"``Str``, ``Bytes``, ``NameConstant`` and ``Ellipsis`` will return an " +"instance of ``Constant``. (Contributed by Serhiy Storchaka " +"in :issue:`32892`.)" msgstr "" #: ../../whatsnew/3.8.rst:1978 @@ -3129,15 +3153,16 @@ msgstr "" msgid "" "DLL dependencies for extension modules and DLLs loaded with :mod:`ctypes` on " "Windows are now resolved more securely. Only the system paths, the directory " -"containing the DLL or PYD file, and directories added with :func:`~os." -"add_dll_directory` are searched for load-time dependencies. Specifically, :" -"envvar:`PATH` and the current working directory are no longer used, and " -"modifications to these will no longer have any effect on normal DLL " -"resolution. If your application relies on these mechanisms, you should check " -"for :func:`~os.add_dll_directory` and if it exists, use it to add your DLLs " -"directory while loading your library. Note that Windows 7 users will need to " -"ensure that Windows Update KB2533623 has been installed (this is also " -"verified by the installer). (Contributed by Steve Dower in :issue:`36085`.)" +"containing the DLL or PYD file, and directories added " +"with :func:`~os.add_dll_directory` are searched for load-time dependencies. " +"Specifically, :envvar:`PATH` and the current working directory are no longer " +"used, and modifications to these will no longer have any effect on normal " +"DLL resolution. If your application relies on these mechanisms, you should " +"check for :func:`~os.add_dll_directory` and if it exists, use it to add your " +"DLLs directory while loading your library. Note that Windows 7 users will " +"need to ensure that Windows Update KB2533623 has been installed (this is " +"also verified by the installer). (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" #: ../../whatsnew/3.8.rst:2004 @@ -3195,21 +3220,22 @@ msgstr "" #: ../../whatsnew/3.8.rst:2040 msgid "" -"Use of ``#`` variants of formats in parsing or building value (e.g. :c:func:" -"`PyArg_ParseTuple`, :c:func:`Py_BuildValue`, :c:func:" -"`PyObject_CallFunction`, etc.) without ``PY_SSIZE_T_CLEAN`` defined raises " -"``DeprecationWarning`` now. It will be removed in 3.10 or 4.0. Read :ref:" -"`arg-parsing` for detail. (Contributed by Inada Naoki in :issue:`36381`.)" +"Use of ``#`` variants of formats in parsing or building value " +"(e.g. :c:func:`PyArg_ParseTuple`, :c:func:`Py_BuildValue`, :c:func:`PyObject_CallFunction`, " +"etc.) without ``PY_SSIZE_T_CLEAN`` defined raises ``DeprecationWarning`` " +"now. It will be removed in 3.10 or 4.0. Read :ref:`arg-parsing` for detail. " +"(Contributed by Inada Naoki in :issue:`36381`.)" msgstr "" #: ../../whatsnew/3.8.rst:2046 msgid "" -"Instances of heap-allocated types (such as those created with :c:func:" -"`PyType_FromSpec`) hold a reference to their type object. Increasing the " -"reference count of these type objects has been moved from :c:func:" -"`PyType_GenericAlloc` to the more low-level functions, :c:func:" -"`PyObject_Init` and :c:macro:`!PyObject_INIT`. This makes types created " -"through :c:func:`PyType_FromSpec` behave like other classes in managed code." +"Instances of heap-allocated types (such as those created " +"with :c:func:`PyType_FromSpec`) hold a reference to their type object. " +"Increasing the reference count of these type objects has been moved " +"from :c:func:`PyType_GenericAlloc` to the more low-level " +"functions, :c:func:`PyObject_Init` and :c:macro:`!PyObject_INIT`. This makes " +"types created through :c:func:`PyType_FromSpec` behave like other classes in " +"managed code." msgstr "" #: ../../whatsnew/3.8.rst:2054 @@ -3233,10 +3259,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:2065 msgid "" "Remove :c:macro:`Py_INCREF` on the type object after allocating an instance " -"- if any. This may happen after calling :c:macro:`PyObject_New`, :c:macro:" -"`PyObject_NewVar`, :c:func:`PyObject_GC_New`, :c:func:`PyObject_GC_NewVar`, " -"or any other custom allocator that uses :c:func:`PyObject_Init` or :c:macro:" -"`!PyObject_INIT`." +"- if any. This may happen after " +"calling :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, :c:func:`PyObject_GC_New`, :c:func:`PyObject_GC_NewVar`, " +"or any other custom allocator that uses :c:func:`PyObject_Init` " +"or :c:macro:`!PyObject_INIT`." msgstr "" #: ../../whatsnew/3.8.rst:2072 ../../whatsnew/3.8.rst:2091 @@ -3301,9 +3327,10 @@ msgid "" "The interpreter does not pretend to support binary compatibility of " "extension types across feature releases, anymore. A :c:type:`PyTypeObject` " "exported by a third-party extension module is supposed to have all the slots " -"expected in the current Python version, including :c:member:`~PyTypeObject." -"tp_finalize` (:c:macro:`Py_TPFLAGS_HAVE_FINALIZE` is not checked anymore " -"before reading :c:member:`~PyTypeObject.tp_finalize`)." +"expected in the current Python version, " +"including :c:member:`~PyTypeObject.tp_finalize` " +"(:c:macro:`Py_TPFLAGS_HAVE_FINALIZE` is not checked anymore before " +"reading :c:member:`~PyTypeObject.tp_finalize`)." msgstr "" #: ../../whatsnew/3.8.rst:2125 @@ -3337,10 +3364,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:2140 msgid "" "The location of an installed :file:`pythonXY.dll` will depend on the " -"installation options and the version and language of Windows. See :ref:" -"`using-on-windows` for more information. The resulting library should be " -"placed in the same directory as :file:`pythonXY.lib`, which is generally " -"the :file:`libs` directory under your Python installation." +"installation options and the version and language of Windows. " +"See :ref:`using-on-windows` for more information. The resulting library " +"should be placed in the same directory as :file:`pythonXY.lib`, which is " +"generally the :file:`libs` directory under your Python installation." msgstr "" #: ../../whatsnew/3.8.rst:2146 @@ -3370,8 +3397,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:2164 msgid "" -"(Contributed by Mark Shannon, Antoine Pitrou and Serhiy Storchaka in :issue:" -"`17611`.)" +"(Contributed by Mark Shannon, Antoine Pitrou and Serhiy Storchaka " +"in :issue:`17611`.)" msgstr "" "(由 Mark Shannon、Antoine Pitrou 和 Serhiy Storchaka 在 :issue:`17611` 中貢" "獻。)" @@ -3569,12 +3596,12 @@ msgstr "Python 3.8.1 中顯著的變更" #: ../../whatsnew/3.8.rst:2242 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.8.rst:2250 @@ -3607,13 +3634,14 @@ msgstr "Python 3.8.8 中顯著的變更" #: ../../whatsnew/3.8.rst:2267 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.8.rst:2278 @@ -3652,9 +3680,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:2302 msgid "" -"(Originally contributed by Ronald Oussoren and Lawrence D'Anna in :gh:" -"`85272`, with fixes by FX Coudert and Eli Rykoff, and backported to 3.8 by " -"Maxime Bélanger and Ned Deily)" +"(Originally contributed by Ronald Oussoren and Lawrence D'Anna " +"in :gh:`85272`, with fixes by FX Coudert and Eli Rykoff, and backported to " +"3.8 by Maxime Bélanger and Ned Deily)" msgstr "" #: ../../whatsnew/3.8.rst:2310 @@ -3664,11 +3692,12 @@ msgstr "urllib.parse" #: ../../whatsnew/3.8.rst:2312 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " -"forms of attacks. Following the WHATWG specification that updates :rfc:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :issue:`43882`)" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such attacks. The removal characters are controlled by a new " +"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " +"(See :issue:`43882`)" msgstr "" #: ../../whatsnew/3.8.rst:2321 diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index f584f4f1fdd..6a2f8c50e87 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -7,7 +7,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-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,8 +32,8 @@ msgstr "Łukasz Langa" #: ../../whatsnew/3.9.rst:45 msgid "" "This article explains the new features in Python 3.9, compared to 3.8. " -"Python 3.9 was released on October 5, 2020. For full details, see the :ref:" -"`changelog `." +"Python 3.9 was released on October 5, 2020. For full details, see " +"the :ref:`changelog `." msgstr "" "本文介紹了 Python 3.9 與 3.8 相比多了哪些新功能。Python 3.9 已於 2020 年 10 " "月 5 日發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" @@ -109,19 +109,19 @@ msgstr "" #: ../../whatsnew/3.9.rst:84 msgid "" -"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!_bz2`, :" -"mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!_functools`, :" -"mod:`!_json`, :mod:`!_locale`, :mod:`math`, :mod:`operator`, :mod:" -"`resource`, :mod:`time`, :mod:`!_weakref`) now use multiphase initialization " -"as defined by PEP 489;" +"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!" +"_bz2`, :mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!" +"_functools`, :mod:`!_json`, :mod:`!" +"_locale`, :mod:`math`, :mod:`operator`, :mod:`resource`, :mod:`time`, :mod:`!" +"_weakref`) now use multiphase initialization as defined by PEP 489;" msgstr "" #: ../../whatsnew/3.9.rst:89 msgid "" -"a number of standard library modules (:mod:`!audioop`, :mod:`ast`, :mod:" -"`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!_posixsubprocess`, :mod:" -"`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) are now " -"using the stable ABI defined by PEP 384." +"a number of standard library modules (:mod:`!" +"audioop`, :mod:`ast`, :mod:`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!" +"_posixsubprocess`, :mod:`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) " +"are now using the stable ABI defined by PEP 384." msgstr "" #: ../../whatsnew/3.9.rst:94 @@ -182,9 +182,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:126 msgid "" "Aliases to :ref:`Abstract Base Classes ` " -"in the :mod:`collections` module, like ``collections.Mapping`` alias to :" -"class:`collections.abc.Mapping`, are kept for one last release for backward " -"compatibility. They will be removed from Python 3.10." +"in the :mod:`collections` module, like ``collections.Mapping`` alias " +"to :class:`collections.abc.Mapping`, are kept for one last release for " +"backward compatibility. They will be removed from Python 3.10." msgstr "" #: ../../whatsnew/3.9.rst:131 @@ -200,7 +200,7 @@ msgid "" "Python as well. Consult the :ref:`removed-in-python-39` section." msgstr "" -#: ../../whatsnew/3.9.rst:140 ../../whatsnew/3.9.rst:1271 +#: ../../whatsnew/3.9.rst:140 ../../whatsnew/3.9.rst:1272 msgid "New Features" msgstr "新增功能" @@ -210,8 +210,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:145 msgid "" -"Merge (``|``) and update (``|=``) operators have been added to the built-in :" -"class:`dict` class. Those complement the existing ``dict.update`` and " +"Merge (``|``) and update (``|=``) operators have been added to the built-" +"in :class:`dict` class. Those complement the existing ``dict.update`` and " "``{**d1, **d2}`` methods of merging dictionaries." msgstr "" @@ -237,8 +237,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:158 msgid "" -"See :pep:`584` for a full description. (Contributed by Brandt Bucher in :" -"issue:`36144`.)" +"See :pep:`584` for a full description. (Contributed by Brandt Bucher " +"in :issue:`36144`.)" msgstr "" #: ../../whatsnew/3.9.rst:162 @@ -247,12 +247,12 @@ msgstr "" #: ../../whatsnew/3.9.rst:164 msgid "" -":meth:`str.removeprefix(prefix)` and :meth:`str." -"removesuffix(suffix)` have been added to easily remove an " -"unneeded prefix or a suffix from a string. Corresponding ``bytes``, " -"``bytearray``, and ``collections.UserString`` methods have also been added. " -"See :pep:`616` for a full description. (Contributed by Dennis Sweeney in :" -"issue:`39939`.)" +":meth:`str.removeprefix(prefix)` " +"and :meth:`str.removesuffix(suffix)` have been added to " +"easily remove an unneeded prefix or a suffix from a string. Corresponding " +"``bytes``, ``bytearray``, and ``collections.UserString`` methods have also " +"been added. See :pep:`616` for a full description. (Contributed by Dennis " +"Sweeney in :issue:`39939`.)" msgstr "" #: ../../whatsnew/3.9.rst:172 @@ -329,28 +329,28 @@ msgstr "其他語言更動" #: ../../whatsnew/3.9.rst:218 msgid "" -":func:`__import__` now raises :exc:`ImportError` instead of :exc:" -"`ValueError`, which used to occur when a relative import went past its top-" -"level package. (Contributed by Ngalim Siregar in :issue:`37444`.)" +":func:`__import__` now raises :exc:`ImportError` instead " +"of :exc:`ValueError`, which used to occur when a relative import went past " +"its top-level package. (Contributed by Ngalim Siregar in :issue:`37444`.)" msgstr "" #: ../../whatsnew/3.9.rst:223 msgid "" "Python now gets the absolute path of the script filename specified on the " -"command line (ex: ``python3 script.py``): the ``__file__`` attribute of the :" -"mod:`__main__` module became an absolute path, rather than a relative path. " -"These paths now remain valid after the current directory is changed by :func:" -"`os.chdir`. As a side effect, the traceback also displays the absolute path " -"for :mod:`__main__` module frames in this case. (Contributed by Victor " -"Stinner in :issue:`20443`.)" +"command line (ex: ``python3 script.py``): the ``__file__`` attribute of " +"the :mod:`__main__` module became an absolute path, rather than a relative " +"path. These paths now remain valid after the current directory is changed " +"by :func:`os.chdir`. As a side effect, the traceback also displays the " +"absolute path for :mod:`__main__` module frames in this case. (Contributed " +"by Victor Stinner in :issue:`20443`.)" msgstr "" #: ../../whatsnew/3.9.rst:231 msgid "" "In the :ref:`Python Development Mode ` and in :ref:`debug build " "`, the *encoding* and *errors* arguments are now checked for " -"string encoding and decoding operations. Examples: :func:`open`, :meth:`str." -"encode` and :meth:`bytes.decode`." +"string encoding and decoding operations. " +"Examples: :func:`open`, :meth:`str.encode` and :meth:`bytes.decode`." msgstr "" #: ../../whatsnew/3.9.rst:236 @@ -386,25 +386,26 @@ msgstr "" #: ../../whatsnew/3.9.rst:256 msgid "" -"Parallel running of :meth:`~agen.aclose` / :meth:`~agen.asend` / :meth:" -"`~agen.athrow` is now prohibited, and ``ag_running`` now reflects the actual " -"running status of the async generator. (Contributed by Yury Selivanov in :" -"issue:`30773`.)" +"Parallel running " +"of :meth:`~agen.aclose` / :meth:`~agen.asend` / :meth:`~agen.athrow` is now " +"prohibited, and ``ag_running`` now reflects the actual running status of the " +"async generator. (Contributed by Yury Selivanov in :issue:`30773`.)" msgstr "" #: ../../whatsnew/3.9.rst:261 msgid "" "Unexpected errors in calling the ``__iter__`` method are no longer masked by " -"``TypeError`` in the :keyword:`in` operator and functions :func:`~operator." -"contains`, :func:`~operator.indexOf` and :func:`~operator.countOf` of the :" -"mod:`operator` module. (Contributed by Serhiy Storchaka in :issue:`40824`.)" +"``TypeError`` in the :keyword:`in` operator and " +"functions :func:`~operator.contains`, :func:`~operator.indexOf` " +"and :func:`~operator.countOf` of the :mod:`operator` module. (Contributed by " +"Serhiy Storchaka in :issue:`40824`.)" msgstr "" #: ../../whatsnew/3.9.rst:267 msgid "" "Unparenthesized lambda expressions can no longer be the expression part in " -"an ``if`` clause in comprehensions and generator expressions. See :issue:" -"`41848` and :issue:`43755` for details." +"an ``if`` clause in comprehensions and generator expressions. " +"See :issue:`41848` and :issue:`43755` for details." msgstr "" #: ../../whatsnew/3.9.rst:273 @@ -418,8 +419,9 @@ msgstr "zoneinfo" #: ../../whatsnew/3.9.rst:278 msgid "" "The :mod:`zoneinfo` module brings support for the IANA time zone database to " -"the standard library. It adds :class:`zoneinfo.ZoneInfo`, a concrete :class:" -"`datetime.tzinfo` implementation backed by the system's time zone data." +"the standard library. It adds :class:`zoneinfo.ZoneInfo`, a " +"concrete :class:`datetime.tzinfo` implementation backed by the system's time " +"zone data." msgstr "" #: ../../whatsnew/3.9.rst:284 @@ -465,10 +467,10 @@ msgstr "graphlib" #: ../../whatsnew/3.9.rst:315 msgid "" -"A new module, :mod:`graphlib`, was added that contains the :class:`graphlib." -"TopologicalSorter` class to offer functionality to perform topological " -"sorting of graphs. (Contributed by Pablo Galindo, Tim Peters and Larry " -"Hastings in :issue:`17005`.)" +"A new module, :mod:`graphlib`, was added that contains " +"the :class:`graphlib.TopologicalSorter` class to offer functionality to " +"perform topological sorting of graphs. (Contributed by Pablo Galindo, Tim " +"Peters and Larry Hastings in :issue:`17005`.)" msgstr "" #: ../../whatsnew/3.9.rst:322 @@ -482,8 +484,8 @@ msgstr "ast" #: ../../whatsnew/3.9.rst:327 msgid "" "Added the *indent* option to :func:`~ast.dump` which allows it to produce a " -"multiline indented output. (Contributed by Serhiy Storchaka in :issue:" -"`37995`.)" +"multiline indented output. (Contributed by Serhiy Storchaka " +"in :issue:`37995`.)" msgstr "" #: ../../whatsnew/3.9.rst:331 @@ -506,26 +508,27 @@ msgstr "asyncio" #: ../../whatsnew/3.9.rst:342 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.9.rst:349 msgid "" -"Added a new :term:`coroutine` :meth:`~asyncio.loop." -"shutdown_default_executor` that schedules a shutdown for the default " -"executor that waits on the :class:`~concurrent.futures.ThreadPoolExecutor` " -"to finish closing. Also, :func:`asyncio.run` has been updated to use the " -"new :term:`coroutine`. (Contributed by Kyle Stanley in :issue:`34037`.)" +"Added a " +"new :term:`coroutine` :meth:`~asyncio.loop.shutdown_default_executor` that " +"schedules a shutdown for the default executor that waits on " +"the :class:`~concurrent.futures.ThreadPoolExecutor` to finish closing. " +"Also, :func:`asyncio.run` has been updated to use the new :term:`coroutine`. " +"(Contributed by Kyle Stanley in :issue:`34037`.)" msgstr "" #: ../../whatsnew/3.9.rst:355 msgid "" -"Added :class:`asyncio.PidfdChildWatcher`, a Linux-specific child watcher " +"Added :class:`!asyncio.PidfdChildWatcher`, a Linux-specific child watcher " "implementation that polls process file descriptors. (:issue:`38692`)" msgstr "" @@ -533,9 +536,10 @@ msgstr "" msgid "" "Added a new :term:`coroutine` :func:`asyncio.to_thread`. It is mainly used " "for running IO-bound functions in a separate thread to avoid blocking the " -"event loop, and essentially works as a high-level version of :meth:`~asyncio." -"loop.run_in_executor` that can directly take keyword arguments. (Contributed " -"by Kyle Stanley and Yury Selivanov in :issue:`32309`.)" +"event loop, and essentially works as a high-level version " +"of :meth:`~asyncio.loop.run_in_executor` that can directly take keyword " +"arguments. (Contributed by Kyle Stanley and Yury Selivanov " +"in :issue:`32309`.)" msgstr "" #: ../../whatsnew/3.9.rst:364 @@ -549,8 +553,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:369 msgid "" ":mod:`asyncio` now raises :exc:`TypeError` when calling incompatible methods " -"with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael in :issue:" -"`37404`.)" +"with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael " +"in :issue:`37404`.)" msgstr "" #: ../../whatsnew/3.9.rst:374 @@ -569,8 +573,8 @@ msgid "" "Added new options for path manipulation in resulting ``.pyc`` files: " "*stripdir*, *prependdir*, *limit_sl_dest* parameters and -s, -p, -e command " "line options. Added the possibility to specify the option for an " -"optimization level multiple times. (Contributed by Lumír 'Frenzy' Balhar in :" -"issue:`38112`.)" +"optimization level multiple times. (Contributed by Lumír 'Frenzy' Balhar " +"in :issue:`38112`.)" msgstr "" #: ../../whatsnew/3.9.rst:384 @@ -579,10 +583,11 @@ msgstr "concurrent.futures" #: ../../whatsnew/3.9.rst:386 msgid "" -"Added a new *cancel_futures* parameter to :meth:`concurrent.futures.Executor." -"shutdown` that cancels all pending futures which have not started running, " -"instead of waiting for them to complete before shutting down the executor. " -"(Contributed by Kyle Stanley in :issue:`39349`.)" +"Added a new *cancel_futures* parameter " +"to :meth:`concurrent.futures.Executor.shutdown` that cancels all pending " +"futures which have not started running, instead of waiting for them to " +"complete before shutting down the executor. (Contributed by Kyle Stanley " +"in :issue:`39349`.)" msgstr "" #: ../../whatsnew/3.9.rst:392 @@ -607,9 +612,9 @@ msgstr "curses" #: ../../whatsnew/3.9.rst:405 msgid "" -"Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:" -"`curses.get_tabsize`, and :func:`curses.set_tabsize` functions. (Contributed " -"by Anthony Sottile in :issue:`38312`.)" +"Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:`curses.get_tabsize`, " +"and :func:`curses.set_tabsize` functions. (Contributed by Anthony Sottile " +"in :issue:`38312`.)" msgstr "" #: ../../whatsnew/3.9.rst:410 @@ -618,10 +623,10 @@ msgstr "datetime" #: ../../whatsnew/3.9.rst:411 msgid "" -"The :meth:`~datetime.date.isocalendar` of :class:`datetime.date` and :meth:" -"`~datetime.datetime.isocalendar` of :class:`datetime.datetime` methods now " -"returns a :func:`~collections.namedtuple` instead of a :class:`tuple`. " -"(Contributed by Donghee Na in :issue:`24416`.)" +"The :meth:`~datetime.date.isocalendar` of :class:`datetime.date` " +"and :meth:`~datetime.datetime.isocalendar` of :class:`datetime.datetime` " +"methods now returns a :func:`~collections.namedtuple` instead of " +"a :class:`tuple`. (Contributed by Donghee Na in :issue:`24416`.)" msgstr "" #: ../../whatsnew/3.9.rst:417 @@ -642,8 +647,8 @@ msgstr "fcntl" #: ../../whatsnew/3.9.rst:426 msgid "" "Added constants :const:`!fcntl.F_OFD_GETLK`, :const:`!fcntl.F_OFD_SETLK` " -"and :const:`!fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na in :issue:" -"`38602`.)" +"and :const:`!fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na " +"in :issue:`38602`.)" msgstr "" #: ../../whatsnew/3.9.rst:431 @@ -652,10 +657,10 @@ msgstr "ftplib" #: ../../whatsnew/3.9.rst:433 msgid "" -":class:`~ftplib.FTP` and :class:`~ftplib.FTP_TLS` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~ftplib.FTP` and :class:`~ftplib.FTP_TLS` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:438 @@ -667,15 +672,15 @@ msgid "" "When the garbage collector makes a collection in which some objects " "resurrect (they are reachable from outside the isolated cycles after the " "finalizers have been executed), do not block the collection of all objects " -"that are still unreachable. (Contributed by Pablo Galindo and Tim Peters in :" -"issue:`38379`.)" +"that are still unreachable. (Contributed by Pablo Galindo and Tim Peters " +"in :issue:`38379`.)" msgstr "" #: ../../whatsnew/3.9.rst:445 msgid "" "Added a new function :func:`gc.is_finalized` to check if an object has been " -"finalized by the garbage collector. (Contributed by Pablo Galindo in :issue:" -"`39322`.)" +"finalized by the garbage collector. (Contributed by Pablo Galindo " +"in :issue:`39322`.)" msgstr "" #: ../../whatsnew/3.9.rst:450 @@ -713,8 +718,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:472 msgid "" -"Added option to toggle cursor blink off. (Contributed by Zackery Spytz in :" -"issue:`4603`.)" +"Added option to toggle cursor blink off. (Contributed by Zackery Spytz " +"in :issue:`4603`.)" msgstr "" #: ../../whatsnew/3.9.rst:475 @@ -736,8 +741,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:483 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " -"hooks were previously ignored. (Contributed by Ken Hilton in :issue:" -"`43008`.)" +"hooks were previously ignored. (Contributed by Ken Hilton " +"in :issue:`43008`.)" msgstr "" #: ../../whatsnew/3.9.rst:487 @@ -749,10 +754,10 @@ msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " "tab. Make space for new options and shorten the dialog. The latter makes " -"the dialog better fit small screens. (Contributed by Terry Jan Reedy in :" -"issue:`40468`.) Move the indent space setting from the Font tab to the new " -"Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy in :issue:" -"`33962`.)" +"the dialog better fit small screens. (Contributed by Terry Jan Reedy " +"in :issue:`40468`.) Move the indent space setting from the Font tab to the " +"new Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy " +"in :issue:`33962`.)" msgstr "" #: ../../whatsnew/3.9.rst:497 @@ -768,11 +773,11 @@ msgstr "imaplib" #: ../../whatsnew/3.9.rst:503 msgid "" ":class:`~imaplib.IMAP4` and :class:`~imaplib.IMAP4_SSL` now have an optional " -"*timeout* parameter for their constructors. Also, the :meth:`~imaplib.IMAP4." -"open` method now has an optional *timeout* parameter with this change. The " -"overridden methods of :class:`~imaplib.IMAP4_SSL` and :class:`~imaplib." -"IMAP4_stream` were applied to this change. (Contributed by Donghee Na in :" -"issue:`38615`.)" +"*timeout* parameter for their constructors. Also, " +"the :meth:`~imaplib.IMAP4.open` method now has an optional *timeout* " +"parameter with this change. The overridden methods " +"of :class:`~imaplib.IMAP4_SSL` and :class:`~imaplib.IMAP4_stream` were " +"applied to this change. (Contributed by Donghee Na in :issue:`38615`.)" msgstr "" #: ../../whatsnew/3.9.rst:510 @@ -791,10 +796,10 @@ msgstr "importlib" #: ../../whatsnew/3.9.rst:520 msgid "" -"To improve consistency with import statements, :func:`importlib.util." -"resolve_name` now raises :exc:`ImportError` instead of :exc:`ValueError` for " -"invalid relative import attempts. (Contributed by Ngalim Siregar in :issue:" -"`37444`.)" +"To improve consistency with import " +"statements, :func:`importlib.util.resolve_name` now " +"raises :exc:`ImportError` instead of :exc:`ValueError` for invalid relative " +"import attempts. (Contributed by Ngalim Siregar in :issue:`37444`.)" msgstr "" #: ../../whatsnew/3.9.rst:525 @@ -823,8 +828,8 @@ msgstr "inspect" #: ../../whatsnew/3.9.rst:539 msgid "" ":attr:`inspect.BoundArguments.arguments` is changed from ``OrderedDict`` to " -"regular dict. (Contributed by Inada Naoki in :issue:`36350` and :issue:" -"`39775`.)" +"regular dict. (Contributed by Inada Naoki in :issue:`36350` " +"and :issue:`39775`.)" msgstr "" #: ../../whatsnew/3.9.rst:543 @@ -840,16 +845,16 @@ msgstr "" #: ../../whatsnew/3.9.rst:547 msgid "" "Scoped IPv6 addresses can be parsed using :class:`ipaddress.IPv6Address`. If " -"present, scope zone ID is available through the :attr:`~ipaddress." -"IPv6Address.scope_id` attribute. (Contributed by Oleksandr Pavliuk in :issue:" -"`34788`.)" +"present, scope zone ID is available through " +"the :attr:`~ipaddress.IPv6Address.scope_id` attribute. (Contributed by " +"Oleksandr Pavliuk in :issue:`34788`.)" msgstr "" #: ../../whatsnew/3.9.rst:551 msgid "" "Starting with Python 3.9.5 the :mod:`ipaddress` module no longer accepts any " -"leading zeros in IPv4 address strings. (Contributed by Christian Heimes in :" -"issue:`36384`)." +"leading zeros in IPv4 address strings. (Contributed by Christian Heimes " +"in :issue:`36384`)." msgstr "" #: ../../whatsnew/3.9.rst:556 @@ -888,9 +893,9 @@ msgstr "multiprocessing" #: ../../whatsnew/3.9.rst:577 msgid "" -"The :class:`multiprocessing.SimpleQueue` class has a new :meth:" -"`~multiprocessing.SimpleQueue.close` method to explicitly close the queue. " -"(Contributed by Victor Stinner in :issue:`30966`.)" +"The :class:`multiprocessing.SimpleQueue` class has a " +"new :meth:`~multiprocessing.SimpleQueue.close` method to explicitly close " +"the queue. (Contributed by Victor Stinner in :issue:`30966`.)" msgstr "" #: ../../whatsnew/3.9.rst:583 @@ -916,8 +921,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:595 msgid "" -"Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) and :const:" -"`os.P_PIDFD` (:issue:`38713`) for process management with file descriptors." +"Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) " +"and :const:`os.P_PIDFD` (:issue:`38713`) for process management with file " +"descriptors." msgstr "" #: ../../whatsnew/3.9.rst:599 @@ -944,8 +950,8 @@ msgstr "pathlib" #: ../../whatsnew/3.9.rst:613 msgid "" -"Added :meth:`pathlib.Path.readlink` which acts similarly to :func:`os." -"readlink`. (Contributed by Girts Folkmanis in :issue:`30618`)" +"Added :meth:`pathlib.Path.readlink` which acts similarly " +"to :func:`os.readlink`. (Contributed by Girts Folkmanis in :issue:`30618`)" msgstr "" #: ../../whatsnew/3.9.rst:618 @@ -964,10 +970,10 @@ msgstr "poplib" #: ../../whatsnew/3.9.rst:626 msgid "" -":class:`~poplib.POP3` and :class:`~poplib.POP3_SSL` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~poplib.POP3` and :class:`~poplib.POP3_SSL` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:631 @@ -1008,8 +1014,8 @@ msgstr "signal" #: ../../whatsnew/3.9.rst:653 msgid "" "Exposed the Linux-specific :func:`signal.pidfd_send_signal` for sending to " -"signals to a process using a file descriptor instead of a pid. (:issue:" -"`38712`)" +"signals to a process using a file descriptor instead of a pid. " +"(:issue:`38712`)" msgstr "" #: ../../whatsnew/3.9.rst:657 @@ -1018,10 +1024,10 @@ msgstr "smtplib" #: ../../whatsnew/3.9.rst:659 msgid "" -":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:663 @@ -1036,9 +1042,9 @@ msgstr "socket" #: ../../whatsnew/3.9.rst:669 msgid "" -"The :mod:`socket` module now exports the :const:`~socket." -"CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. (Contributed by " -"Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" +"The :mod:`socket` module now exports " +"the :const:`~socket.CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. " +"(Contributed by Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" msgstr "" #: ../../whatsnew/3.9.rst:673 @@ -1049,9 +1055,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:676 msgid "" -"The socket module now has the :func:`socket.send_fds` and :func:`socket." -"recv_fds` functions. (Contributed by Joannah Nanjekye, Shinya Okano and " -"Victor Stinner in :issue:`28724`.)" +"The socket module now has the :func:`socket.send_fds` " +"and :func:`socket.recv_fds` functions. (Contributed by Joannah Nanjekye, " +"Shinya Okano and Victor Stinner in :issue:`28724`.)" msgstr "" #: ../../whatsnew/3.9.rst:682 @@ -1098,7 +1104,7 @@ msgid "" "(Contributed by Huon Wilson in :issue:`40630`.)" msgstr "" -#: ../../whatsnew/3.9.rst:710 ../../whatsnew/3.9.rst:1493 +#: ../../whatsnew/3.9.rst:710 ../../whatsnew/3.9.rst:1494 msgid "typing" msgstr "typing" @@ -1139,10 +1145,11 @@ msgstr "xml" #: ../../whatsnew/3.9.rst:735 msgid "" -"White space characters within attributes are now preserved when serializing :" -"mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer normalized to " -"\"\\n\". This is the result of discussion about how to interpret section " -"2.11 of XML spec. (Contributed by Mefistotelis in :issue:`39011`.)" +"White space characters within attributes are now preserved when " +"serializing :mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer " +"normalized to \"\\n\". This is the result of discussion about how to " +"interpret section 2.11 of XML spec. (Contributed by Mefistotelis " +"in :issue:`39011`.)" msgstr "" #: ../../whatsnew/3.9.rst:743 @@ -1182,8 +1189,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:762 msgid "" "Previously, the bytecode evaluation loop was interrupted at each instruction " -"until the main thread handles signals. (Contributed by Victor Stinner in :" -"issue:`40010`.)" +"until the main thread handles signals. (Contributed by Victor Stinner " +"in :issue:`40010`.)" msgstr "" #: ../../whatsnew/3.9.rst:766 @@ -1201,10 +1208,11 @@ msgstr "" #: ../../whatsnew/3.9.rst:774 msgid "" -"A number of Python builtins (:class:`range`, :class:`tuple`, :class:`set`, :" -"class:`frozenset`, :class:`list`, :class:`dict`) are now sped up by using :" -"pep:`590` vectorcall protocol. (Contributed by Donghee Na, Mark Shannon, " -"Jeroen Demeyer and Petr Viktorin in :issue:`37207`.)" +"A number of Python builtins " +"(:class:`range`, :class:`tuple`, :class:`set`, :class:`frozenset`, :class:`list`, :class:`dict`) " +"are now sped up by using :pep:`590` vectorcall protocol. (Contributed by " +"Donghee Na, Mark Shannon, Jeroen Demeyer and Petr Viktorin " +"in :issue:`37207`.)" msgstr "" #: ../../whatsnew/3.9.rst:779 @@ -1395,10 +1403,10 @@ msgid "" "These results were generated from the variable access benchmark script at: " "``Tools/scripts/var_access_benchmark.py``. The benchmark script displays " "timings in nanoseconds. The benchmarks were measured on an `Intel® Core™ " -"i7-4960HQ processor `_ running the macOS 64-bit builds found at `python.org `_." +"i7-4960HQ processor `_ running " +"the macOS 64-bit builds found at `python.org `_." msgstr "" #: ../../whatsnew/3.9.rst:853 @@ -1408,8 +1416,8 @@ msgstr "已棄用" #: ../../whatsnew/3.9.rst:855 msgid "" "The distutils ``bdist_msi`` command is now deprecated, use ``bdist_wheel`` " -"(wheel packages) instead. (Contributed by Hugo van Kemenade in :issue:" -"`39586`.)" +"(wheel packages) instead. (Contributed by Hugo van Kemenade " +"in :issue:`39586`.)" msgstr "" #: ../../whatsnew/3.9.rst:859 @@ -1431,8 +1439,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:870 msgid "" -"The Public C API functions :c:func:`!PyParser_SimpleParseStringFlags`, :c:" -"func:`!PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" +"The Public C API functions :c:func:`!" +"PyParser_SimpleParseStringFlags`, :c:func:`!" +"PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" "PyParser_SimpleParseFileFlags` and :c:func:`!PyNode_Compile` are deprecated " "and will be removed in Python 3.10 together with the old parser." msgstr "" @@ -1450,8 +1459,9 @@ msgid "" "The :mod:`random` module currently accepts any hashable type as a possible " "seed value. Unfortunately, some of those types are not guaranteed to have a " "deterministic hash value. After Python 3.9, the module will restrict its " -"seeds to :const:`None`, :class:`int`, :class:`float`, :class:`str`, :class:" -"`bytes`, and :class:`bytearray`." +"seeds " +"to :const:`None`, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, " +"and :class:`bytearray`." msgstr "" #: ../../whatsnew/3.9.rst:887 @@ -1459,8 +1469,8 @@ msgid "" "Opening the :class:`~gzip.GzipFile` file for writing without specifying the " "*mode* argument is deprecated. In future Python versions it will always be " "opened for reading by default. Specify the *mode* argument for opening it " -"for writing and silencing a warning. (Contributed by Serhiy Storchaka in :" -"issue:`28286`.)" +"for writing and silencing a warning. (Contributed by Serhiy Storchaka " +"in :issue:`28286`.)" msgstr "" #: ../../whatsnew/3.9.rst:893 @@ -1509,17 +1519,17 @@ msgid "" ":mod:`ast` classes ``Suite``, ``Param``, ``AugLoad`` and ``AugStore`` are " "considered deprecated and will be removed in future Python versions. They " "were not generated by the parser and not accepted by the code generator in " -"Python 3. (Contributed by Batuhan Taskaya in :issue:`39639` and :issue:" -"`39969` and Serhiy Storchaka in :issue:`39988`.)" +"Python 3. (Contributed by Batuhan Taskaya in :issue:`39639` " +"and :issue:`39969` and Serhiy Storchaka in :issue:`39988`.)" msgstr "" #: ../../whatsnew/3.9.rst:923 msgid "" "The :c:func:`!PyEval_InitThreads` and :c:func:`!PyEval_ThreadsInitialized` " -"functions are now deprecated and will be removed in Python 3.11. Calling :c:" -"func:`!PyEval_InitThreads` now does nothing. The :term:`GIL` is initialized " -"by :c:func:`Py_Initialize` since Python 3.7. (Contributed by Victor Stinner " -"in :issue:`39877`.)" +"functions are now deprecated and will be removed in Python 3.11. " +"Calling :c:func:`!PyEval_InitThreads` now does nothing. The :term:`GIL` is " +"initialized by :c:func:`Py_Initialize` since Python 3.7. (Contributed by " +"Victor Stinner in :issue:`39877`.)" msgstr "" #: ../../whatsnew/3.9.rst:929 @@ -1531,8 +1541,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:932 msgid "" ":func:`!smtpd.MailmanProxy` is now deprecated as it is unusable without an " -"external module, ``mailman``. (Contributed by Samuel Colvin in :issue:" -"`35800`.)" +"external module, ``mailman``. (Contributed by Samuel Colvin " +"in :issue:`35800`.)" msgstr "" #: ../../whatsnew/3.9.rst:935 @@ -1551,7 +1561,7 @@ msgid "" "(Contributed by Raymond Hettinger in :issue:`40465`)" msgstr "" -#: ../../whatsnew/3.9.rst:952 ../../whatsnew/3.9.rst:1407 +#: ../../whatsnew/3.9.rst:952 ../../whatsnew/3.9.rst:1408 msgid "Removed" msgstr "已移除" @@ -1566,8 +1576,8 @@ msgid "" "removed. These methods are deprecated since Python 3.3. Generally, these " "extensions are not supported or not enabled by NNTP server administrators. " "For ``xgtitle()``, please use :meth:`!nntplib.NNTP.descriptions` or :meth:`!" -"nntplib.NNTP.description` instead. (Contributed by Donghee Na in :issue:" -"`39366`.)" +"nntplib.NNTP.description` instead. (Contributed by Donghee Na " +"in :issue:`39366`.)" msgstr "" #: ../../whatsnew/3.9.rst:963 @@ -1588,9 +1598,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:973 msgid "" "The ``sys.getcheckinterval()`` and ``sys.setcheckinterval()`` functions have " -"been removed. They were deprecated since Python 3.2. Use :func:`sys." -"getswitchinterval` and :func:`sys.setswitchinterval` instead. (Contributed " -"by Victor Stinner in :issue:`37392`.)" +"been removed. They were deprecated since Python 3.2. " +"Use :func:`sys.getswitchinterval` and :func:`sys.setswitchinterval` instead. " +"(Contributed by Victor Stinner in :issue:`37392`.)" msgstr "" #: ../../whatsnew/3.9.rst:978 @@ -1624,21 +1634,23 @@ msgstr "" #: ../../whatsnew/3.9.rst:996 msgid "" -"Methods ``getchildren()`` and ``getiterator()`` of classes :class:`~xml." -"etree.ElementTree.ElementTree` and :class:`~xml.etree.ElementTree.Element` " -"in the :mod:`~xml.etree.ElementTree` module have been removed. They were " -"deprecated in Python 3.2. Use ``iter(x)`` or ``list(x)`` instead of ``x." -"getchildren()`` and ``x.iter()`` or ``list(x.iter())`` instead of ``x." -"getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" +"Methods ``getchildren()`` and ``getiterator()`` of " +"classes :class:`~xml.etree.ElementTree.ElementTree` " +"and :class:`~xml.etree.ElementTree.Element` in " +"the :mod:`~xml.etree.ElementTree` module have been removed. They were " +"deprecated in Python 3.2. Use ``iter(x)`` or ``list(x)`` instead of " +"``x.getchildren()`` and ``x.iter()`` or ``list(x.iter())`` instead of " +"``x.getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" msgstr "" #: ../../whatsnew/3.9.rst:1004 msgid "" "The old :mod:`plistlib` API has been removed, it was deprecated since Python " -"3.4. Use the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:" -"`~plistlib.dump`, and :func:`~plistlib.dumps` functions. Additionally, the " -"*use_builtin_types* parameter was removed, standard :class:`bytes` objects " -"are always used instead. (Contributed by Jon Janzen in :issue:`36409`.)" +"3.4. Use " +"the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:`~plistlib.dump`, " +"and :func:`~plistlib.dumps` functions. Additionally, the *use_builtin_types* " +"parameter was removed, standard :class:`bytes` objects are always used " +"instead. (Contributed by Jon Janzen in :issue:`36409`.)" msgstr "" #: ../../whatsnew/3.9.rst:1010 @@ -1652,9 +1664,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1015 msgid "" "``base64.encodestring()`` and ``base64.decodestring()``, aliases deprecated " -"since Python 3.1, have been removed: use :func:`base64.encodebytes` and :" -"func:`base64.decodebytes` instead. (Contributed by Victor Stinner in :issue:" -"`39351`.)" +"since Python 3.1, have been removed: use :func:`base64.encodebytes` " +"and :func:`base64.decodebytes` instead. (Contributed by Victor Stinner " +"in :issue:`39351`.)" msgstr "" #: ../../whatsnew/3.9.rst:1020 @@ -1675,9 +1687,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1029 msgid "" "The *encoding* parameter of :func:`json.loads` has been removed. As of " -"Python 3.1, it was deprecated and ignored; using it has emitted a :exc:" -"`DeprecationWarning` since Python 3.8. (Contributed by Inada Naoki in :issue:" -"`39377`)" +"Python 3.1, it was deprecated and ignored; using it has emitted " +"a :exc:`DeprecationWarning` since Python 3.8. (Contributed by Inada Naoki " +"in :issue:`39377`)" msgstr "" #: ../../whatsnew/3.9.rst:1034 @@ -1691,18 +1703,18 @@ msgstr "" #: ../../whatsnew/3.9.rst:1039 msgid "" "The :func:`!sys.getcounts` function, the ``-X showalloccount`` command line " -"option and the ``show_alloc_count`` field of the C structure :c:type:" -"`PyConfig` have been removed. They required a special Python build by " -"defining ``COUNT_ALLOCS`` macro. (Contributed by Victor Stinner in :issue:" -"`39489`.)" +"option and the ``show_alloc_count`` field of the C " +"structure :c:type:`PyConfig` have been removed. They required a special " +"Python build by defining ``COUNT_ALLOCS`` macro. (Contributed by Victor " +"Stinner in :issue:`39489`.)" msgstr "" #: ../../whatsnew/3.9.rst:1045 msgid "" "The ``_field_types`` attribute of the :class:`typing.NamedTuple` class has " "been removed. It was deprecated since Python 3.8. Use the " -"``__annotations__`` attribute instead. (Contributed by Serhiy Storchaka in :" -"issue:`40182`.)" +"``__annotations__`` attribute instead. (Contributed by Serhiy Storchaka " +"in :issue:`40182`.)" msgstr "" #: ../../whatsnew/3.9.rst:1050 @@ -1715,8 +1727,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:1054 msgid "" "The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " -"have been removed. They were deprecated since Python 3.7 and you can use :" -"func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead. " +"have been removed. They were deprecated since Python 3.7 and you can " +"use :func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead. " "(Contributed by Rémi Lapeyre in :issue:`40967`)" msgstr "" @@ -1728,7 +1740,7 @@ msgid "" "unicode characters." msgstr "" -#: ../../whatsnew/3.9.rst:1066 ../../whatsnew/3.9.rst:1333 +#: ../../whatsnew/3.9.rst:1066 ../../whatsnew/3.9.rst:1334 msgid "Porting to Python 3.9" msgstr "移植至 Python 3.9" @@ -1744,10 +1756,11 @@ msgstr "Python API 的變更" #: ../../whatsnew/3.9.rst:1075 msgid "" -":func:`__import__` and :func:`importlib.util.resolve_name` now raise :exc:" -"`ImportError` where it previously raised :exc:`ValueError`. Callers catching " -"the specific exception type and supporting both Python 3.9 and earlier " -"versions will need to catch both using ``except (ImportError, ValueError):``." +":func:`__import__` and :func:`importlib.util.resolve_name` now " +"raise :exc:`ImportError` where it previously raised :exc:`ValueError`. " +"Callers catching the specific exception type and supporting both Python 3.9 " +"and earlier versions will need to catch both using ``except (ImportError, " +"ValueError):``." msgstr "" #: ../../whatsnew/3.9.rst:1080 @@ -1758,8 +1771,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1083 msgid "" -"The :meth:`select.epoll.unregister` method no longer ignores the :const:" -"`~errno.EBADF` error. (Contributed by Victor Stinner in :issue:`39239`.)" +"The :meth:`select.epoll.unregister` method no longer ignores " +"the :const:`~errno.EBADF` error. (Contributed by Victor Stinner " +"in :issue:`39239`.)" msgstr "" #: ../../whatsnew/3.9.rst:1087 @@ -1793,10 +1807,10 @@ msgstr "" #: ../../whatsnew/3.9.rst:1105 msgid "" -":meth:`asyncio.loop.shutdown_default_executor` has been added to :class:" -"`~asyncio.AbstractEventLoop`, meaning alternative event loops that inherit " -"from it should have this method defined. (Contributed by Kyle Stanley in :" -"issue:`34037`.)" +":meth:`asyncio.loop.shutdown_default_executor` has been added " +"to :class:`~asyncio.AbstractEventLoop`, meaning alternative event loops that " +"inherit from it should have this method defined. (Contributed by Kyle " +"Stanley in :issue:`34037`.)" msgstr "" #: ../../whatsnew/3.9.rst:1110 @@ -1820,18 +1834,19 @@ msgid "" "The :func:`logging.getLogger` API now returns the root logger when passed " "the name ``'root'``, whereas previously it returned a non-root logger named " "``'root'``. This could affect cases where user code explicitly wants a non-" -"root logger named ``'root'``, or instantiates a logger using ``logging." -"getLogger(__name__)`` in some top-level module called ``'root.py'``. " -"(Contributed by Vinay Sajip in :issue:`37742`.)" +"root logger named ``'root'``, or instantiates a logger using " +"``logging.getLogger(__name__)`` in some top-level module called " +"``'root.py'``. (Contributed by Vinay Sajip in :issue:`37742`.)" msgstr "" #: ../../whatsnew/3.9.rst:1127 msgid "" -"Division handling of :class:`~pathlib.PurePath` now returns :data:" -"`NotImplemented` instead of raising a :exc:`TypeError` when passed something " -"other than an instance of ``str`` or :class:`~pathlib.PurePath`. This " -"allows creating compatible classes that don't inherit from those mentioned " -"types. (Contributed by Roger Aiudi in :issue:`34775`)." +"Division handling of :class:`~pathlib.PurePath` now " +"returns :data:`NotImplemented` instead of raising a :exc:`TypeError` when " +"passed something other than an instance of ``str`` " +"or :class:`~pathlib.PurePath`. This allows creating compatible classes that " +"don't inherit from those mentioned types. (Contributed by Roger Aiudi " +"in :issue:`34775`)." msgstr "" #: ../../whatsnew/3.9.rst:1133 @@ -1846,11 +1861,11 @@ msgstr "" #: ../../whatsnew/3.9.rst:1141 msgid "" -":func:`codecs.lookup` now normalizes the encoding name the same way as :func:" -"`encodings.normalize_encoding`, except that :func:`codecs.lookup` also " -"converts the name to lower case. For example, ``\"latex+latin1\"`` encoding " -"name is now normalized to ``\"latex_latin1\"``. (Contributed by Jordon Xu " -"in :issue:`37751`.)" +":func:`codecs.lookup` now normalizes the encoding name the same way " +"as :func:`encodings.normalize_encoding`, except that :func:`codecs.lookup` " +"also converts the name to lower case. For example, ``\"latex+latin1\"`` " +"encoding name is now normalized to ``\"latex_latin1\"``. (Contributed by " +"Jordon Xu in :issue:`37751`.)" msgstr "" #: ../../whatsnew/3.9.rst:1149 @@ -1863,15 +1878,17 @@ msgid "" "with :c:func:`PyType_FromSpec` and similar APIs) hold a reference to their " "type object since Python 3.8. As indicated in the \"Changes in the C API\" " "of Python 3.8, for the vast majority of cases, there should be no side " -"effect but for types that have a custom :c:member:`~PyTypeObject." -"tp_traverse` function, ensure that all custom ``tp_traverse`` functions of " -"heap-allocated types visit the object's type." +"effect but for types that have a " +"custom :c:member:`~PyTypeObject.tp_traverse` function, ensure that all " +"custom ``tp_traverse`` functions of heap-allocated types visit the object's " +"type." msgstr "" #: ../../whatsnew/3.9.rst:1161 msgid "" "int\n" -"foo_traverse(foo_struct *self, visitproc visit, void *arg) {\n" +"foo_traverse(PyObject *self, visitproc visit, void *arg)\n" +"{\n" "// Rest of the traverse function\n" "#if PY_VERSION_HEX >= 0x03090000\n" " // This was not needed before Python 3.9 (Python issue 35810 and 40217)\n" @@ -1880,7 +1897,7 @@ msgid "" "}" msgstr "" -#: ../../whatsnew/3.9.rst:1172 +#: ../../whatsnew/3.9.rst:1173 msgid "" "If your traverse function delegates to ``tp_traverse`` of its base class (or " "another type), ensure that ``Py_TYPE(self)`` is visited only once. Note that " @@ -1888,19 +1905,19 @@ msgid "" "``tp_traverse``." msgstr "" -#: ../../whatsnew/3.9.rst:1177 +#: ../../whatsnew/3.9.rst:1178 msgid "For example, if your ``tp_traverse`` function includes:" msgstr "" -#: ../../whatsnew/3.9.rst:1179 +#: ../../whatsnew/3.9.rst:1180 msgid "base->tp_traverse(self, visit, arg)" msgstr "base->tp_traverse(self, visit, arg)" -#: ../../whatsnew/3.9.rst:1183 +#: ../../whatsnew/3.9.rst:1184 msgid "then add:" msgstr "" -#: ../../whatsnew/3.9.rst:1185 +#: ../../whatsnew/3.9.rst:1186 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)\n" @@ -1912,89 +1929,89 @@ msgid "" "#else" msgstr "" -#: ../../whatsnew/3.9.rst:1196 +#: ../../whatsnew/3.9.rst:1197 msgid "(See :issue:`35810` and :issue:`40217` for more information.)" msgstr "(更多資訊請見 :issue:`35810` 與 :issue:`40217`。)" -#: ../../whatsnew/3.9.rst:1198 +#: ../../whatsnew/3.9.rst:1199 msgid "" "The functions ``PyEval_CallObject``, ``PyEval_CallFunction``, " "``PyEval_CallMethod`` and ``PyEval_CallObjectWithKeywords`` are deprecated. " -"Use :c:func:`PyObject_Call` and its variants instead. (See more details in :" -"issue:`29548`.)" +"Use :c:func:`PyObject_Call` and its variants instead. (See more details " +"in :issue:`29548`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1204 +#: ../../whatsnew/3.9.rst:1205 msgid "CPython bytecode changes" msgstr "CPython 位元組碼變更" -#: ../../whatsnew/3.9.rst:1206 +#: ../../whatsnew/3.9.rst:1207 msgid "" -"The :opcode:`LOAD_ASSERTION_ERROR` opcode was added for handling the :" -"keyword:`assert` statement. Previously, the assert statement would not work " -"correctly if the :exc:`AssertionError` exception was being shadowed. " +"The :opcode:`!LOAD_ASSERTION_ERROR` opcode was added for handling " +"the :keyword:`assert` statement. Previously, the assert statement would not " +"work correctly if the :exc:`AssertionError` exception was being shadowed. " "(Contributed by Zackery Spytz in :issue:`34880`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1211 +#: ../../whatsnew/3.9.rst:1212 msgid "" "The :opcode:`COMPARE_OP` opcode was split into four distinct instructions:" msgstr "" -#: ../../whatsnew/3.9.rst:1213 +#: ../../whatsnew/3.9.rst:1214 msgid "``COMPARE_OP`` for rich comparisons" msgstr "" -#: ../../whatsnew/3.9.rst:1214 +#: ../../whatsnew/3.9.rst:1215 msgid "``IS_OP`` for 'is' and 'is not' tests" msgstr "" -#: ../../whatsnew/3.9.rst:1215 +#: ../../whatsnew/3.9.rst:1216 msgid "``CONTAINS_OP`` for 'in' and 'not in' tests" msgstr "" -#: ../../whatsnew/3.9.rst:1216 +#: ../../whatsnew/3.9.rst:1217 msgid "" "``JUMP_IF_NOT_EXC_MATCH`` for checking exceptions in 'try-except' statements." msgstr "" -#: ../../whatsnew/3.9.rst:1219 +#: ../../whatsnew/3.9.rst:1220 msgid "(Contributed by Mark Shannon in :issue:`39156`.)" msgstr "(由 Mark Shannon 在 :issue:`39156` 中貢獻。)" -#: ../../whatsnew/3.9.rst:1223 +#: ../../whatsnew/3.9.rst:1224 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.9.rst:1225 +#: ../../whatsnew/3.9.rst:1226 msgid "" "Added ``--with-platlibdir`` option to the ``configure`` script: name of the " -"platform-specific library directory, stored in the new :data:`sys." -"platlibdir` attribute. See :data:`sys.platlibdir` attribute for more " -"information. (Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis " -"and Victor Stinner in :issue:`1294959`.)" +"platform-specific library directory, stored in the " +"new :data:`sys.platlibdir` attribute. See :data:`sys.platlibdir` attribute " +"for more information. (Contributed by Jan Matějek, Matěj Cepl, Charalampos " +"Stratakis and Victor Stinner in :issue:`1294959`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1231 +#: ../../whatsnew/3.9.rst:1232 msgid "" "The ``COUNT_ALLOCS`` special build macro has been removed. (Contributed by " "Victor Stinner in :issue:`39489`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1234 +#: ../../whatsnew/3.9.rst:1235 msgid "" "On non-Windows platforms, the :c:func:`!setenv` and :c:func:`!unsetenv` " "functions are now required to build Python. (Contributed by Victor Stinner " "in :issue:`39395`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1238 +#: ../../whatsnew/3.9.rst:1239 msgid "" "On non-Windows platforms, creating ``bdist_wininst`` installers is now " "officially unsupported. (See :issue:`10945` for more details.)" msgstr "" -#: ../../whatsnew/3.9.rst:1241 +#: ../../whatsnew/3.9.rst:1242 msgid "" "When building Python on macOS from source, ``_tkinter`` now links with non-" "system Tcl and Tk frameworks if they are installed in ``/Library/" @@ -2005,13 +2022,13 @@ msgid "" "(Contributed by Ned Deily in :issue:`34956`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1250 +#: ../../whatsnew/3.9.rst:1251 msgid "" "Python can now be built for Windows 10 ARM64. (Contributed by Steve Dower " "in :issue:`33125`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1253 +#: ../../whatsnew/3.9.rst:1254 msgid "" "Some individual tests are now skipped when ``--pgo`` is used. The tests in " "question increased the PGO task time significantly and likely didn't help " @@ -2027,43 +2044,43 @@ msgid "" "details.)" msgstr "" -#: ../../whatsnew/3.9.rst:1268 +#: ../../whatsnew/3.9.rst:1269 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.9.rst:1273 +#: ../../whatsnew/3.9.rst:1274 msgid "" ":pep:`573`: Added :c:func:`PyType_FromModuleAndSpec` to associate a module " "with a class; :c:func:`PyType_GetModule` and :c:func:`PyType_GetModuleState` " -"to retrieve the module and its state; and :c:type:`PyCMethod` and :c:macro:" -"`METH_METHOD` to allow a method to access the class it was defined in. " -"(Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" +"to retrieve the module and its state; and :c:type:`PyCMethod` " +"and :c:macro:`METH_METHOD` to allow a method to access the class it was " +"defined in. (Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1280 +#: ../../whatsnew/3.9.rst:1281 msgid "" -"Added :c:func:`PyFrame_GetCode` function: get a frame code. Added :c:func:" -"`PyFrame_GetBack` function: get the frame next outer frame. (Contributed by " -"Victor Stinner in :issue:`40421`.)" +"Added :c:func:`PyFrame_GetCode` function: get a frame code. " +"Added :c:func:`PyFrame_GetBack` function: get the frame next outer frame. " +"(Contributed by Victor Stinner in :issue:`40421`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1284 +#: ../../whatsnew/3.9.rst:1285 msgid "" "Added :c:func:`PyFrame_GetLineNumber` to the limited C API. (Contributed by " "Victor Stinner in :issue:`40421`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1287 +#: ../../whatsnew/3.9.rst:1288 msgid "" -"Added :c:func:`PyThreadState_GetInterpreter` and :c:func:" -"`PyInterpreterState_Get` functions to get the interpreter. Added :c:func:" -"`PyThreadState_GetFrame` function to get the current frame of a Python " -"thread state. Added :c:func:`PyThreadState_GetID` function: get the unique " -"identifier of a Python thread state. (Contributed by Victor Stinner in :" -"issue:`39947`.)" +"Added :c:func:`PyThreadState_GetInterpreter` " +"and :c:func:`PyInterpreterState_Get` functions to get the interpreter. " +"Added :c:func:`PyThreadState_GetFrame` function to get the current frame of " +"a Python thread state. Added :c:func:`PyThreadState_GetID` function: get the " +"unique identifier of a Python thread state. (Contributed by Victor Stinner " +"in :issue:`39947`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1295 +#: ../../whatsnew/3.9.rst:1296 msgid "" "Added a new public :c:func:`PyObject_CallNoArgs` function to the C API, " "which calls a callable Python object without any arguments. It is the most " @@ -2071,11 +2088,11 @@ msgid "" "(Contributed by Victor Stinner in :issue:`37194`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1300 ../../whatsnew/3.9.rst:1418 +#: ../../whatsnew/3.9.rst:1301 ../../whatsnew/3.9.rst:1419 msgid "Changes in the limited C API (if ``Py_LIMITED_API`` macro is defined):" msgstr "" -#: ../../whatsnew/3.9.rst:1302 +#: ../../whatsnew/3.9.rst:1303 msgid "" "Provide :c:func:`Py_EnterRecursiveCall` and :c:func:`Py_LeaveRecursiveCall` " "as regular functions for the limited API. Previously, there were defined as " @@ -2084,69 +2101,70 @@ msgid "" "the limited C API)." msgstr "" -#: ../../whatsnew/3.9.rst:1308 +#: ../../whatsnew/3.9.rst:1309 msgid "" "``PyObject_INIT()`` and ``PyObject_INIT_VAR()`` become regular \"opaque\" " "function to hide implementation details." msgstr "" -#: ../../whatsnew/3.9.rst:1311 ../../whatsnew/3.9.rst:1445 +#: ../../whatsnew/3.9.rst:1312 ../../whatsnew/3.9.rst:1446 msgid "(Contributed by Victor Stinner in :issue:`38644` and :issue:`39542`.)" msgstr "(由 Victor Stinner 在 38644 和 39542 中貢獻。)" -#: ../../whatsnew/3.9.rst:1313 +#: ../../whatsnew/3.9.rst:1314 msgid "" "The :c:func:`PyModule_AddType` function is added to help adding a type to a " "module. (Contributed by Donghee Na in :issue:`40024`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1317 +#: ../../whatsnew/3.9.rst:1318 msgid "" -"Added the functions :c:func:`PyObject_GC_IsTracked` and :c:func:" -"`PyObject_GC_IsFinalized` to the public API to allow to query if Python " -"objects are being currently tracked or have been already finalized by the " -"garbage collector respectively. (Contributed by Pablo Galindo Salgado in :" -"issue:`40241`.)" +"Added the functions :c:func:`PyObject_GC_IsTracked` " +"and :c:func:`PyObject_GC_IsFinalized` to the public API to allow to query if " +"Python objects are being currently tracked or have been already finalized by " +"the garbage collector respectively. (Contributed by Pablo Galindo Salgado " +"in :issue:`40241`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1323 +#: ../../whatsnew/3.9.rst:1324 msgid "" "Added :c:func:`!_PyObject_FunctionStr` to get a user-friendly string " -"representation of a function-like object. (Patch by Jeroen Demeyer in :issue:" -"`37645`.)" +"representation of a function-like object. (Patch by Jeroen Demeyer " +"in :issue:`37645`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1327 +#: ../../whatsnew/3.9.rst:1328 msgid "" "Added :c:func:`PyObject_CallOneArg` for calling an object with one " "positional argument (Patch by Jeroen Demeyer in :issue:`37483`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1335 +#: ../../whatsnew/3.9.rst:1336 msgid "" "``PyInterpreterState.eval_frame`` (:pep:`523`) now requires a new mandatory " -"*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner in :" -"issue:`38500`.)" +"*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner " +"in :issue:`38500`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1339 +#: ../../whatsnew/3.9.rst:1340 msgid "" -"Extension modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:" -"`~PyModuleDef.m_clear` and :c:member:`~PyModuleDef.m_free` functions of :c:" -"type:`PyModuleDef` are no longer called if the module state was requested " -"but is not allocated yet. This is the case immediately after the module is " -"created and before the module is executed (:c:data:`Py_mod_exec` function). " -"More precisely, these functions are not called if :c:member:`~PyModuleDef." -"m_size` is greater than 0 and the module state (as returned by :c:func:" -"`PyModule_GetState`) is ``NULL``." +"Extension " +"modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:`~PyModuleDef.m_clear` " +"and :c:member:`~PyModuleDef.m_free` functions of :c:type:`PyModuleDef` are " +"no longer called if the module state was requested but is not allocated yet. " +"This is the case immediately after the module is created and before the " +"module is executed (:c:data:`Py_mod_exec` function). More precisely, these " +"functions are not called if :c:member:`~PyModuleDef.m_size` is greater than " +"0 and the module state (as returned by :c:func:`PyModule_GetState`) is " +"``NULL``." msgstr "" -#: ../../whatsnew/3.9.rst:1348 +#: ../../whatsnew/3.9.rst:1349 msgid "" "Extension modules without module state (``m_size <= 0``) are not affected." msgstr "" -#: ../../whatsnew/3.9.rst:1350 +#: ../../whatsnew/3.9.rst:1351 msgid "" "If :c:func:`Py_AddPendingCall` is called in a subinterpreter, the function " "is now scheduled to be called from the subinterpreter, rather than being " @@ -2154,7 +2172,7 @@ msgid "" "of scheduled calls. (Contributed by Victor Stinner in :issue:`39984`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1356 +#: ../../whatsnew/3.9.rst:1357 msgid "" "The Windows registry is no longer used to initialize :data:`sys.path` when " "the ``-E`` option is used (if :c:member:`PyConfig.use_environment` is set to " @@ -2162,92 +2180,93 @@ msgid "" "by Zackery Spytz in :issue:`8901`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1361 +#: ../../whatsnew/3.9.rst:1362 msgid "" "The global variable :c:data:`PyStructSequence_UnnamedField` is now a " "constant and refers to a constant string. (Contributed by Serhiy Storchaka " "in :issue:`38650`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1365 +#: ../../whatsnew/3.9.rst:1366 msgid "" "The :c:type:`!PyGC_Head` structure is now opaque. It is only defined in the " -"internal C API (``pycore_gc.h``). (Contributed by Victor Stinner in :issue:" -"`40241`.)" +"internal C API (``pycore_gc.h``). (Contributed by Victor Stinner " +"in :issue:`40241`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1369 +#: ../../whatsnew/3.9.rst:1370 msgid "" -"The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``, :c:" -"func:`!PyUnicode_FromUnicode`, :c:func:`!PyUnicode_AsUnicode`, " -"``_PyUnicode_AsUnicode``, and :c:func:`!PyUnicode_AsUnicodeAndSize` are " -"marked as deprecated in C. They have been deprecated by :pep:`393` since " -"Python 3.3. (Contributed by Inada Naoki in :issue:`36346`.)" +"The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, " +"``PyUnicode_WSTR_LENGTH``, :c:func:`!PyUnicode_FromUnicode`, :c:func:`!" +"PyUnicode_AsUnicode`, ``_PyUnicode_AsUnicode``, and :c:func:`!" +"PyUnicode_AsUnicodeAndSize` are marked as deprecated in C. They have been " +"deprecated by :pep:`393` since Python 3.3. (Contributed by Inada Naoki " +"in :issue:`36346`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1376 +#: ../../whatsnew/3.9.rst:1377 msgid "" "The :c:func:`Py_FatalError` function is replaced with a macro which logs " "automatically the name of the current function, unless the " -"``Py_LIMITED_API`` macro is defined. (Contributed by Victor Stinner in :" -"issue:`39882`.)" +"``Py_LIMITED_API`` macro is defined. (Contributed by Victor Stinner " +"in :issue:`39882`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1381 +#: ../../whatsnew/3.9.rst:1382 msgid "" "The vectorcall protocol now requires that the caller passes only strings as " "keyword names. (See :issue:`37540` for more information.)" msgstr "" -#: ../../whatsnew/3.9.rst:1384 +#: ../../whatsnew/3.9.rst:1385 msgid "" "Implementation details of a number of macros and functions are now hidden:" msgstr "" -#: ../../whatsnew/3.9.rst:1386 +#: ../../whatsnew/3.9.rst:1387 msgid ":c:func:`PyObject_IS_GC` macro was converted to a function." msgstr "" -#: ../../whatsnew/3.9.rst:1388 +#: ../../whatsnew/3.9.rst:1389 msgid "" -"The :c:func:`!PyObject_NEW` macro becomes an alias to the :c:macro:" -"`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro becomes an " -"alias to the :c:macro:`PyObject_NewVar` macro. They no longer access " -"directly the :c:member:`PyTypeObject.tp_basicsize` member." +"The :c:func:`!PyObject_NEW` macro becomes an alias to " +"the :c:macro:`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro " +"becomes an alias to the :c:macro:`PyObject_NewVar` macro. They no longer " +"access directly the :c:member:`PyTypeObject.tp_basicsize` member." msgstr "" -#: ../../whatsnew/3.9.rst:1393 +#: ../../whatsnew/3.9.rst:1394 msgid "" ":c:func:`!PyObject_GET_WEAKREFS_LISTPTR` macro was converted to a function: " "the macro accessed directly the :c:member:`PyTypeObject.tp_weaklistoffset` " "member." msgstr "" -#: ../../whatsnew/3.9.rst:1397 +#: ../../whatsnew/3.9.rst:1398 msgid "" ":c:func:`PyObject_CheckBuffer` macro was converted to a function: the macro " "accessed directly the :c:member:`PyTypeObject.tp_as_buffer` member." msgstr "" -#: ../../whatsnew/3.9.rst:1400 +#: ../../whatsnew/3.9.rst:1401 msgid "" ":c:func:`PyIndex_Check` is now always declared as an opaque function to hide " "implementation details: removed the ``PyIndex_Check()`` macro. The macro " "accessed directly the :c:member:`PyTypeObject.tp_as_number` member." msgstr "" -#: ../../whatsnew/3.9.rst:1404 +#: ../../whatsnew/3.9.rst:1405 msgid "(See :issue:`40170` for more details.)" msgstr "(更多資訊請見 :issue:`40170`。)" -#: ../../whatsnew/3.9.rst:1409 +#: ../../whatsnew/3.9.rst:1410 msgid "" "Excluded ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of " -"``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner in :issue:" -"`38835`.)" +"``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner " +"in :issue:`38835`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1413 +#: ../../whatsnew/3.9.rst:1414 msgid "" "The ``tp_print`` slot of :ref:`PyTypeObject ` has been " "removed. It was used for printing objects to files in Python 2.7 and before. " @@ -2255,89 +2274,89 @@ msgid "" "Demeyer in :issue:`36974`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1420 +#: ../../whatsnew/3.9.rst:1421 msgid "Excluded the following functions from the limited C API:" msgstr "" -#: ../../whatsnew/3.9.rst:1422 +#: ../../whatsnew/3.9.rst:1423 msgid "" -"``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye in :issue:" -"`37878`.)" +"``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye " +"in :issue:`37878`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1424 +#: ../../whatsnew/3.9.rst:1425 msgid "``_Py_CheckRecursionLimit``" msgstr "``_Py_CheckRecursionLimit``" -#: ../../whatsnew/3.9.rst:1425 +#: ../../whatsnew/3.9.rst:1426 msgid "``_Py_NewReference()``" msgstr "``_Py_NewReference()``" -#: ../../whatsnew/3.9.rst:1426 +#: ../../whatsnew/3.9.rst:1427 msgid "``_Py_ForgetReference()``" msgstr "``_Py_ForgetReference()``" -#: ../../whatsnew/3.9.rst:1427 +#: ../../whatsnew/3.9.rst:1428 msgid "``_PyTraceMalloc_NewReference()``" msgstr "``_PyTraceMalloc_NewReference()``" -#: ../../whatsnew/3.9.rst:1428 +#: ../../whatsnew/3.9.rst:1429 msgid "``_Py_GetRefTotal()``" msgstr "``_Py_GetRefTotal()``" -#: ../../whatsnew/3.9.rst:1429 +#: ../../whatsnew/3.9.rst:1430 msgid "The trashcan mechanism which never worked in the limited C API." msgstr "" -#: ../../whatsnew/3.9.rst:1430 +#: ../../whatsnew/3.9.rst:1431 msgid "``PyTrash_UNWIND_LEVEL``" msgstr "``PyTrash_UNWIND_LEVEL``" -#: ../../whatsnew/3.9.rst:1431 +#: ../../whatsnew/3.9.rst:1432 msgid "``Py_TRASHCAN_BEGIN_CONDITION``" msgstr "``Py_TRASHCAN_BEGIN_CONDITION``" -#: ../../whatsnew/3.9.rst:1432 +#: ../../whatsnew/3.9.rst:1433 msgid "``Py_TRASHCAN_BEGIN``" msgstr "``Py_TRASHCAN_BEGIN``" -#: ../../whatsnew/3.9.rst:1433 +#: ../../whatsnew/3.9.rst:1434 msgid "``Py_TRASHCAN_END``" msgstr "``Py_TRASHCAN_END``" -#: ../../whatsnew/3.9.rst:1434 +#: ../../whatsnew/3.9.rst:1435 msgid "``Py_TRASHCAN_SAFE_BEGIN``" msgstr "``Py_TRASHCAN_SAFE_BEGIN``" -#: ../../whatsnew/3.9.rst:1435 +#: ../../whatsnew/3.9.rst:1436 msgid "``Py_TRASHCAN_SAFE_END``" msgstr "``Py_TRASHCAN_SAFE_END``" -#: ../../whatsnew/3.9.rst:1437 +#: ../../whatsnew/3.9.rst:1438 msgid "Moved following functions and definitions to the internal C API:" msgstr "" -#: ../../whatsnew/3.9.rst:1439 +#: ../../whatsnew/3.9.rst:1440 msgid "``_PyDebug_PrintTotalRefs()``" msgstr "``_PyDebug_PrintTotalRefs()``" -#: ../../whatsnew/3.9.rst:1440 +#: ../../whatsnew/3.9.rst:1441 msgid "``_Py_PrintReferences()``" msgstr "``_Py_PrintReferences()``" -#: ../../whatsnew/3.9.rst:1441 +#: ../../whatsnew/3.9.rst:1442 msgid "``_Py_PrintReferenceAddresses()``" msgstr "``_Py_PrintReferenceAddresses()``" -#: ../../whatsnew/3.9.rst:1442 +#: ../../whatsnew/3.9.rst:1443 msgid "``_Py_tracemalloc_config``" msgstr "``_Py_tracemalloc_config``" -#: ../../whatsnew/3.9.rst:1443 +#: ../../whatsnew/3.9.rst:1444 msgid "``_Py_AddToAllObjects()`` (specific to ``Py_TRACE_REFS`` build)" msgstr "" -#: ../../whatsnew/3.9.rst:1447 +#: ../../whatsnew/3.9.rst:1448 msgid "" "Removed ``_PyRuntime.getframe`` hook and removed ``_PyThreadState_GetFrame`` " "macro which was an alias to ``_PyRuntime.getframe``. They were only exposed " @@ -2345,72 +2364,72 @@ msgid "" "(Contributed by Victor Stinner in :issue:`39946`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1452 +#: ../../whatsnew/3.9.rst:1453 msgid "" "Removed the following functions from the C API. Call :c:func:`PyGC_Collect` " "explicitly to clear all free lists. (Contributed by Inada Naoki and Victor " "Stinner in :issue:`37340`, :issue:`38896` and :issue:`40428`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1457 +#: ../../whatsnew/3.9.rst:1458 msgid "``PyAsyncGen_ClearFreeLists()``" msgstr "``PyAsyncGen_ClearFreeLists()``" -#: ../../whatsnew/3.9.rst:1458 +#: ../../whatsnew/3.9.rst:1459 msgid "``PyContext_ClearFreeList()``" msgstr "``PyContext_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1459 +#: ../../whatsnew/3.9.rst:1460 msgid "``PyDict_ClearFreeList()``" msgstr "``PyDict_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1460 +#: ../../whatsnew/3.9.rst:1461 msgid "``PyFloat_ClearFreeList()``" msgstr "``PyFloat_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1461 +#: ../../whatsnew/3.9.rst:1462 msgid "``PyFrame_ClearFreeList()``" msgstr "``PyFrame_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1462 +#: ../../whatsnew/3.9.rst:1463 msgid "``PyList_ClearFreeList()``" msgstr "``PyList_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1463 +#: ../../whatsnew/3.9.rst:1464 msgid "" "``PyMethod_ClearFreeList()`` and ``PyCFunction_ClearFreeList()``: the free " "lists of bound method objects have been removed." msgstr "" -#: ../../whatsnew/3.9.rst:1465 +#: ../../whatsnew/3.9.rst:1466 msgid "" "``PySet_ClearFreeList()``: the set free list has been removed in Python 3.4." msgstr "" -#: ../../whatsnew/3.9.rst:1467 +#: ../../whatsnew/3.9.rst:1468 msgid "``PyTuple_ClearFreeList()``" msgstr "``PyTuple_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1468 +#: ../../whatsnew/3.9.rst:1469 msgid "" "``PyUnicode_ClearFreeList()``: the Unicode free list has been removed in " "Python 3.3." msgstr "" -#: ../../whatsnew/3.9.rst:1471 +#: ../../whatsnew/3.9.rst:1472 msgid "" "Removed ``_PyUnicode_ClearStaticStrings()`` function. (Contributed by Victor " "Stinner in :issue:`39465`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1474 +#: ../../whatsnew/3.9.rst:1475 msgid "" "Removed ``Py_UNICODE_MATCH``. It has been deprecated by :pep:`393`, and " "broken since Python 3.3. The :c:func:`PyUnicode_Tailmatch` function can be " "used instead. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1479 +#: ../../whatsnew/3.9.rst:1480 msgid "" "Cleaned header files of interfaces defined but with no implementation. The " "public API symbols being removed are: " @@ -2419,30 +2438,31 @@ msgid "" "``_Py_InitializeFromWideArgs``, ``_PyFloat_Repr``, ``_PyFloat_Digits``, " "``_PyFloat_DigitsInit``, ``PyFrame_ExtendStack``, ``_PyAIterWrapper_Type``, " "``PyNullImporter_Type``, ``PyCmpWrapper_Type``, ``PySortWrapper_Type``, " -"``PyNoArgsFunction``. (Contributed by Pablo Galindo Salgado in :issue:" -"`39372`.)" +"``PyNoArgsFunction``. (Contributed by Pablo Galindo Salgado " +"in :issue:`39372`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1490 +#: ../../whatsnew/3.9.rst:1491 msgid "Notable changes in Python 3.9.1" msgstr "Python 3.9.1 中顯著的變更" -#: ../../whatsnew/3.9.rst:1495 +#: ../../whatsnew/3.9.rst:1496 msgid "" -"The behavior of :class:`typing.Literal` was changed to conform with :pep:" -"`586` and to match the behavior of static type checkers specified in the PEP." +"The behavior of :class:`typing.Literal` was changed to conform " +"with :pep:`586` and to match the behavior of static type checkers specified " +"in the PEP." msgstr "" -#: ../../whatsnew/3.9.rst:1498 +#: ../../whatsnew/3.9.rst:1499 msgid "``Literal`` now de-duplicates parameters." msgstr "" -#: ../../whatsnew/3.9.rst:1499 +#: ../../whatsnew/3.9.rst:1500 msgid "" "Equality comparisons between ``Literal`` objects are now order independent." msgstr "" -#: ../../whatsnew/3.9.rst:1500 +#: ../../whatsnew/3.9.rst:1501 msgid "" "``Literal`` comparisons now respect types. For example, ``Literal[0] == " "Literal[False]`` previously evaluated to ``True``. It is now ``False``. To " @@ -2450,7 +2470,7 @@ msgid "" "differentiating types." msgstr "" -#: ../../whatsnew/3.9.rst:1504 +#: ../../whatsnew/3.9.rst:1505 msgid "" "``Literal`` objects will now raise a :exc:`TypeError` exception during " "equality comparisons if any of their parameters are not :term:`hashable`. " @@ -2458,7 +2478,7 @@ msgid "" "error::" msgstr "" -#: ../../whatsnew/3.9.rst:1509 +#: ../../whatsnew/3.9.rst:1510 msgid "" ">>> from typing import Literal\n" ">>> Literal[{0}]\n" @@ -2474,15 +2494,15 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: unhashable type: 'set'" -#: ../../whatsnew/3.9.rst:1516 +#: ../../whatsnew/3.9.rst:1517 msgid "(Contributed by Yurii Karabas in :issue:`42345`.)" msgstr "(由 Yurii Karabas 在 :issue:`42345` 中貢獻。)" -#: ../../whatsnew/3.9.rst:1519 +#: ../../whatsnew/3.9.rst:1520 msgid "macOS 11.0 (Big Sur) and Apple Silicon Mac support" msgstr "" -#: ../../whatsnew/3.9.rst:1521 +#: ../../whatsnew/3.9.rst:1522 msgid "" "As of 3.9.1, Python now fully supports building and running on macOS 11.0 " "(Big Sur) and on Apple Silicon Macs (based on the ``ARM64`` architecture). A " @@ -2494,55 +2514,57 @@ msgid "" "version in use at runtime (\"weaklinking\")." msgstr "" -#: ../../whatsnew/3.9.rst:1530 +#: ../../whatsnew/3.9.rst:1531 msgid "(Contributed by Ronald Oussoren and Lawrence D'Anna in :issue:`41100`.)" msgstr "(由 Ronald Oussoren 和 Lawrence D'Anna 在 :issue:`41100` 中貢獻。)" -#: ../../whatsnew/3.9.rst:1533 +#: ../../whatsnew/3.9.rst:1534 msgid "Notable changes in Python 3.9.2" msgstr "Python 3.9.2 中顯著的變更" -#: ../../whatsnew/3.9.rst:1536 +#: ../../whatsnew/3.9.rst:1537 msgid "collections.abc" msgstr "collections.abc" -#: ../../whatsnew/3.9.rst:1538 +#: ../../whatsnew/3.9.rst:1539 msgid "" ":class:`collections.abc.Callable` generic now flattens type parameters, " "similar to what :data:`typing.Callable` currently does. This means that " "``collections.abc.Callable[[int, str], str]`` will have ``__args__`` of " "``(int, str, str)``; previously this was ``([int, str], str)``. To allow " "this change, :class:`types.GenericAlias` can now be subclassed, and a " -"subclass will be returned when subscripting the :class:`collections.abc." -"Callable` type. Code which accesses the arguments via :func:`typing." -"get_args` or ``__args__`` need to account for this change. A :exc:" -"`DeprecationWarning` may be emitted for invalid forms of parameterizing :" -"class:`collections.abc.Callable` which may have passed silently in Python " -"3.9.1. This :exc:`DeprecationWarning` will become a :exc:`TypeError` in " -"Python 3.10. (Contributed by Ken Jin in :issue:`42195`.)" +"subclass will be returned when subscripting " +"the :class:`collections.abc.Callable` type. Code which accesses the " +"arguments via :func:`typing.get_args` or ``__args__`` need to account for " +"this change. A :exc:`DeprecationWarning` may be emitted for invalid forms " +"of parameterizing :class:`collections.abc.Callable` which may have passed " +"silently in Python 3.9.1. This :exc:`DeprecationWarning` will become " +"a :exc:`TypeError` in Python 3.10. (Contributed by Ken Jin " +"in :issue:`42195`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1552 ../../whatsnew/3.9.rst:1577 +#: ../../whatsnew/3.9.rst:1553 ../../whatsnew/3.9.rst:1578 msgid "urllib.parse" msgstr "urllib.parse" -#: ../../whatsnew/3.9.rst:1554 +#: ../../whatsnew/3.9.rst:1555 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1565 +#: ../../whatsnew/3.9.rst:1566 msgid "Notable changes in Python 3.9.3" msgstr "Python 3.9.3 中顯著的變更" -#: ../../whatsnew/3.9.rst:1567 +#: ../../whatsnew/3.9.rst:1568 msgid "" "A security fix alters the :class:`ftplib.FTP` behavior to not trust the IPv4 " "address sent from the remote server when setting up a passive data channel. " @@ -2551,25 +2573,26 @@ msgid "" "instance to ``True``. (See :gh:`87451`)" msgstr "" -#: ../../whatsnew/3.9.rst:1574 +#: ../../whatsnew/3.9.rst:1575 msgid "Notable changes in Python 3.9.5" msgstr "Python 3.9.5 中顯著的變更" -#: ../../whatsnew/3.9.rst:1579 +#: ../../whatsnew/3.9.rst:1580 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " -"forms of attacks. Following the WHATWG specification that updates :rfc:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such attacks. The removal characters are controlled by a new " +"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " +"(See :gh:`88048`)" msgstr "" -#: ../../whatsnew/3.9.rst:1587 +#: ../../whatsnew/3.9.rst:1588 msgid "Notable security feature in 3.9.14" msgstr "" -#: ../../whatsnew/3.9.rst:1589 +#: ../../whatsnew/3.9.rst:1590 msgid "" "Converting between :class:`int` and :class:`str` in bases other than 2 " "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " @@ -2582,15 +2605,15 @@ msgid "" "digits in string form." msgstr "" -#: ../../whatsnew/3.9.rst:1600 +#: ../../whatsnew/3.9.rst:1601 msgid "Notable changes in 3.9.17" msgstr "Python 3.9.17 中顯著的變更" -#: ../../whatsnew/3.9.rst:1603 +#: ../../whatsnew/3.9.rst:1604 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.9.rst:1605 +#: ../../whatsnew/3.9.rst:1606 msgid "" "The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`, " "have a new a *filter* argument that allows limiting tar features than may be " diff --git a/whatsnew/index.po b/whatsnew/index.po index 3d82a190e05..89b1ecce37a 100644 --- a/whatsnew/index.po +++ b/whatsnew/index.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-07-07 11:37+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,7 +35,7 @@ msgstr "" "的重大改變的地方。對於希望在新版本釋出時立即了解版本差異的使用者們來說,這些" "說明被歸類為「必讀」的等級。" -#: ../../whatsnew/index.rst:37 +#: ../../whatsnew/index.rst:38 msgid "" "The \"Changelog\" is an HTML version of the :pypi:`file built` from " "the contents of the :source:`Misc/NEWS.d` directory tree, which contains " From c3e8d8ac23006525b06a55c7edc012de4a32e01d Mon Sep 17 00:00:00 2001 From: "Matt.Wang" Date: Mon, 8 Sep 2025 15:48:01 +0800 Subject: [PATCH 03/28] resolve 3.14 merging fuzzy entries --- about.po | 4 +- bugs.po | 10 +- c-api/abstract.po | 5 +- c-api/allocation.po | 82 +- c-api/apiabiversion.po | 155 +-- c-api/arg.po | 10 +- c-api/bool.po | 4 +- c-api/buffer.po | 5 +- c-api/bytearray.po | 10 +- c-api/bytes.po | 11 +- c-api/call.po | 4 +- c-api/capsule.po | 5 +- c-api/cell.po | 5 +- c-api/code.po | 11 +- c-api/codec.po | 4 +- c-api/complex.po | 4 +- c-api/concrete.po | 5 +- c-api/contextvars.po | 5 +- c-api/conversion.po | 15 +- c-api/coro.po | 5 +- c-api/datetime.po | 5 +- c-api/descriptor.po | 5 +- c-api/dict.po | 5 +- c-api/exceptions.po | 10 +- c-api/extension-modules.po | 30 +- c-api/file.po | 24 +- c-api/float.po | 5 +- c-api/frame.po | 4 +- c-api/function.po | 5 +- c-api/gcsupport.po | 5 +- c-api/gen.po | 5 +- c-api/hash.po | 11 +- c-api/import.po | 7 +- c-api/index.po | 5 +- c-api/init.po | 20 +- c-api/init_config.po | 423 +++--- c-api/intro.po | 11 +- c-api/iter.po | 60 +- c-api/iterator.po | 5 +- c-api/lifecycle.po | 19 +- c-api/list.po | 4 +- c-api/long.po | 4 +- c-api/mapping.po | 22 +- c-api/marshal.po | 4 +- c-api/memory.po | 17 +- c-api/memoryview.po | 5 +- c-api/method.po | 4 +- c-api/module.po | 10 +- c-api/monitoring.po | 16 +- c-api/none.po | 5 +- c-api/number.po | 5 +- c-api/object.po | 16 +- c-api/objimpl.po | 5 +- c-api/perfmaps.po | 7 +- c-api/refcounting.po | 4 +- c-api/reflection.po | 5 +- c-api/sequence.po | 7 +- c-api/set.po | 5 +- c-api/slice.po | 5 +- c-api/stable.po | 4 +- c-api/structures.po | 4 +- c-api/sys.po | 5 +- c-api/time.po | 25 +- c-api/tuple.po | 5 +- c-api/type.po | 12 +- c-api/typehints.po | 4 +- c-api/typeobj.po | 64 +- c-api/unicode.po | 58 +- c-api/utilities.po | 5 +- c-api/veryhigh.po | 5 +- c-api/weakref.po | 5 +- contents.po | 5 +- copyright.po | 14 +- deprecations/c-api-pending-removal-in-3.14.po | 157 +-- deprecations/c-api-pending-removal-in-3.15.po | 151 ++- deprecations/c-api-pending-removal-in-3.16.po | 4 +- deprecations/c-api-pending-removal-in-3.18.po | 56 +- .../c-api-pending-removal-in-future.po | 32 +- deprecations/index.po | 603 +++------ deprecations/pending-removal-in-3.13.po | 5 +- deprecations/pending-removal-in-3.14.po | 35 +- deprecations/pending-removal-in-3.15.po | 12 +- deprecations/pending-removal-in-3.16.po | 57 +- deprecations/pending-removal-in-3.17.po | 9 +- deprecations/pending-removal-in-3.19.po | 7 +- deprecations/pending-removal-in-future.po | 41 +- distributing/index.po | 5 +- extending/building.po | 79 +- extending/embedding.po | 5 +- extending/extending.po | 4 +- extending/index.po | 4 +- extending/newtypes.po | 52 +- extending/newtypes_tutorial.po | 67 +- extending/windows.po | 15 +- faq/design.po | 9 +- faq/extending.po | 78 +- faq/general.po | 5 +- faq/gui.po | 4 +- faq/index.po | 5 +- faq/installed.po | 5 +- faq/library.po | 69 +- faq/programming.po | 4 +- faq/windows.po | 4 +- glossary.po | 110 +- howto/a-conceptual-overview-of-asyncio.po | 4 +- howto/annotations.po | 12 +- howto/argparse-optparse.po | 4 +- howto/argparse.po | 4 +- howto/clinic.po | 5 +- howto/cporting.po | 5 +- howto/curses.po | 5 +- howto/descriptor.po | 8 +- howto/enum.po | 34 +- howto/free-threading-extensions.po | 10 +- howto/free-threading-python.po | 7 +- howto/functional.po | 4 +- howto/gdb_helpers.po | 4 +- howto/index.po | 7 +- howto/instrumentation.po | 4 +- howto/ipaddress.po | 4 +- howto/isolating-extensions.po | 5 +- howto/logging-cookbook.po | 13 +- howto/logging.po | 7 +- howto/mro.po | 4 +- howto/perf_profiling.po | 4 +- howto/pyporting.po | 5 +- howto/regex.po | 4 +- howto/remote_debugging.po | 1 - howto/sockets.po | 4 +- howto/sorting.po | 13 +- howto/timerfd.po | 4 +- howto/unicode.po | 5 +- howto/urllib2.po | 4 +- installing/index.po | 4 +- library/__future__.po | 4 +- library/__main__.po | 27 +- library/_thread.po | 9 +- library/abc.po | 5 +- library/aifc.po | 4 +- library/allos.po | 4 +- library/annotationlib.po | 293 +++-- library/archiving.po | 10 +- library/argparse.po | 50 +- library/array.po | 4 +- library/ast.po | 82 +- library/asynchat.po | 4 +- library/asyncio-api-index.po | 4 +- library/asyncio-dev.po | 13 +- library/asyncio-eventloop.po | 11 +- library/asyncio-exceptions.po | 4 +- library/asyncio-extending.po | 4 +- library/asyncio-future.po | 8 +- library/asyncio-graph.po | 39 +- library/asyncio-llapi-index.po | 7 +- library/asyncio-platforms.po | 15 +- library/asyncio-policy.po | 5 +- library/asyncio-protocol.po | 5 +- library/asyncio-queue.po | 4 +- library/asyncio-runner.po | 12 +- library/asyncio-stream.po | 4 +- library/asyncio-subprocess.po | 27 +- library/asyncio-sync.po | 4 +- library/asyncio-task.po | 18 +- library/asyncio.po | 4 +- library/asyncore.po | 4 +- library/atexit.po | 4 +- library/audioop.po | 4 +- library/audit_events.po | 11 +- library/base64.po | 5 +- library/bdb.po | 8 +- library/binary.po | 5 +- library/binascii.po | 5 +- library/bisect.po | 10 +- library/builtins.po | 4 +- library/bz2.po | 5 +- library/calendar.po | 5 +- library/cgi.po | 4 +- library/cgitb.po | 4 +- library/chunk.po | 4 +- library/cmath.po | 21 +- library/cmd.po | 5 +- library/cmdline.po | 13 +- library/cmdlinelibs.po | 4 +- library/code.po | 4 +- library/codecs.po | 10 +- library/codeop.po | 4 +- library/collections.abc.po | 17 +- library/collections.po | 23 +- library/colorsys.po | 4 +- library/compileall.po | 5 +- library/compression.po | 3 +- library/compression.zstd.po | 58 +- library/concurrency.po | 5 +- library/concurrent.futures.po | 41 +- library/concurrent.interpreters.po | 43 +- library/concurrent.po | 11 +- library/configparser.po | 26 +- library/constants.po | 11 +- library/contextlib.po | 5 +- library/contextvars.po | 12 +- library/copy.po | 4 +- library/copyreg.po | 4 +- library/crypt.po | 4 +- library/crypto.po | 4 +- library/csv.po | 4 +- library/ctypes.po | 42 +- library/curses.ascii.po | 5 +- library/curses.panel.po | 5 +- library/curses.po | 5 +- library/custominterp.po | 5 +- library/dataclasses.po | 32 +- library/datatypes.po | 4 +- library/datetime.po | 13 +- library/dbm.po | 10 +- library/debug.po | 5 +- library/decimal.po | 18 +- library/development.po | 5 +- library/devmode.po | 4 +- library/dialog.po | 5 +- library/difflib.po | 4 +- library/dis.po | 473 +++---- library/distribution.po | 5 +- library/distutils.po | 4 +- library/doctest.po | 4 +- library/email.charset.po | 4 +- library/email.compat32-message.po | 4 +- library/email.contentmanager.po | 5 +- library/email.encoders.po | 4 +- library/email.errors.po | 5 +- library/email.examples.po | 5 +- library/email.generator.po | 5 +- library/email.header.po | 4 +- library/email.headerregistry.po | 5 +- library/email.iterators.po | 5 +- library/email.message.po | 5 +- library/email.mime.po | 5 +- library/email.parser.po | 4 +- library/email.po | 5 +- library/email.policy.po | 4 +- library/email.utils.po | 5 +- library/ensurepip.po | 5 +- library/enum.po | 29 +- library/errno.po | 31 +- library/exceptions.po | 4 +- library/faulthandler.po | 4 +- library/fcntl.po | 5 +- library/filecmp.po | 5 +- library/fileformats.po | 5 +- library/fileinput.po | 5 +- library/filesys.po | 4 +- library/fnmatch.po | 5 +- library/fractions.po | 11 +- library/frameworks.po | 4 +- library/ftplib.po | 4 +- library/functional.po | 4 +- library/functions.po | 357 ++--- library/functools.po | 38 +- library/gc.po | 28 +- library/getopt.po | 28 +- library/getpass.po | 27 +- library/gettext.po | 5 +- library/glob.po | 4 +- library/graphlib.po | 5 +- library/grp.po | 5 +- library/gzip.po | 4 +- library/hashlib.po | 4 +- library/heapq.po | 76 +- library/hmac.po | 4 +- library/html.entities.po | 4 +- library/html.parser.po | 4 +- library/html.po | 5 +- library/http.client.po | 4 +- library/http.cookiejar.po | 4 +- library/http.cookies.po | 7 +- library/http.po | 214 +-- library/http.server.po | 20 +- library/i18n.po | 5 +- library/idle.po | 6 +- library/imaplib.po | 4 +- library/imghdr.po | 4 +- library/imp.po | 4 +- library/importlib.metadata.po | 25 +- library/importlib.po | 5 +- library/importlib.resources.abc.po | 4 +- library/importlib.resources.po | 4 +- library/index.po | 4 +- library/inspect.po | 207 +-- library/internet.po | 5 +- library/intro.po | 5 +- library/io.po | 14 +- library/ipaddress.po | 4 +- library/ipc.po | 5 +- library/itertools.po | 10 +- library/json.po | 82 +- library/keyword.po | 4 +- library/language.po | 4 +- library/linecache.po | 5 +- library/locale.po | 4 +- library/logging.config.po | 4 +- library/logging.handlers.po | 7 +- library/logging.po | 4 +- library/lzma.po | 4 +- library/mailbox.po | 4 +- library/mailcap.po | 4 +- library/markup.po | 4 +- library/marshal.po | 32 +- library/math.po | 14 +- library/mimetypes.po | 6 +- library/mm.po | 4 +- library/mmap.po | 4 +- library/modulefinder.po | 4 +- library/modules.po | 4 +- library/msilib.po | 4 +- library/msvcrt.po | 5 +- library/multiprocessing.po | 19 +- library/multiprocessing.shared_memory.po | 4 +- library/netdata.po | 4 +- library/netrc.po | 4 +- library/nis.po | 4 +- library/nntplib.po | 4 +- library/numbers.po | 4 +- library/numeric.po | 5 +- library/operator.po | 23 +- library/optparse.po | 4 +- library/os.path.po | 150 +-- library/os.po | 17 +- library/ossaudiodev.po | 4 +- library/pathlib.po | 44 +- library/pdb.po | 58 +- library/persistence.po | 4 +- library/pickle.po | 30 +- library/pickletools.po | 8 +- library/pipes.po | 4 +- library/pkgutil.po | 37 +- library/platform.po | 115 +- library/plistlib.po | 5 +- library/poplib.po | 5 +- library/posix.po | 4 +- library/pprint.po | 4 +- library/profile.po | 4 +- library/pty.po | 4 +- library/pwd.po | 5 +- library/py_compile.po | 4 +- library/pyclbr.po | 5 +- library/pydoc.po | 8 +- library/pyexpat.po | 4 +- library/python.po | 5 +- library/queue.po | 5 +- library/quopri.po | 4 +- library/random.po | 4 +- library/re.po | 5 +- library/readline.po | 5 +- library/removed.po | 4 +- library/reprlib.po | 4 +- library/resource.po | 4 +- library/rlcompleter.po | 5 +- library/runpy.po | 5 +- library/sched.po | 4 +- library/secrets.po | 4 +- library/security_warnings.po | 4 +- library/select.po | 8 +- library/selectors.po | 4 +- library/shelve.po | 4 +- library/shlex.po | 5 +- library/shutil.po | 7 +- library/signal.po | 4 +- library/site.po | 5 +- library/smtpd.po | 4 +- library/smtplib.po | 5 +- library/sndhdr.po | 4 +- library/socket.po | 4 +- library/socketserver.po | 4 +- library/spwd.po | 4 +- library/sqlite3.po | 4 +- library/ssl.po | 15 +- library/stat.po | 5 +- library/statistics.po | 4 +- library/stdtypes.po | 984 +++++++------- library/string.po | 19 +- library/string.templatelib.po | 19 +- library/stringprep.po | 8 +- library/struct.po | 22 +- library/subprocess.po | 123 +- library/sunau.po | 4 +- library/superseded.po | 4 +- library/symtable.po | 37 +- library/sys.monitoring.po | 103 +- library/sys.po | 33 +- library/sys_path_init.po | 5 +- library/sysconfig.po | 4 +- library/syslog.po | 5 +- library/tabnanny.po | 5 +- library/tarfile.po | 31 +- library/telnetlib.po | 4 +- library/tempfile.po | 4 +- library/termios.po | 5 +- library/test.po | 21 +- library/text.po | 5 +- library/textwrap.po | 4 +- library/threading.po | 10 +- library/time.po | 4 +- library/timeit.po | 4 +- library/tk.po | 4 +- library/tkinter.colorchooser.po | 4 +- library/tkinter.dnd.po | 5 +- library/tkinter.font.po | 5 +- library/tkinter.messagebox.po | 5 +- library/tkinter.po | 5 +- library/tkinter.scrolledtext.po | 5 +- library/tkinter.ttk.po | 5 +- library/token.po | 4 +- library/tokenize.po | 4 +- library/tomllib.po | 7 +- library/trace.po | 5 +- library/traceback.po | 5 +- library/tracemalloc.po | 5 +- library/tty.po | 5 +- library/turtle.po | 50 +- library/types.po | 5 +- library/typing.po | 357 ++--- library/unicodedata.po | 92 +- library/unittest.mock-examples.po | 4 +- library/unittest.mock.po | 28 +- library/unittest.po | 52 +- library/unix.po | 4 +- library/urllib.error.po | 4 +- library/urllib.parse.po | 4 +- library/urllib.po | 5 +- library/urllib.request.po | 21 +- library/urllib.robotparser.po | 4 +- library/uu.po | 4 +- library/uuid.po | 119 +- library/venv.po | 12 +- library/warnings.po | 27 +- library/wave.po | 5 +- library/weakref.po | 5 +- library/webbrowser.po | 8 +- library/windows.po | 4 +- library/winreg.po | 5 +- library/winsound.po | 11 +- library/wsgiref.po | 4 +- library/xdrlib.po | 4 +- library/xml.dom.minidom.po | 4 +- library/xml.dom.po | 5 +- library/xml.dom.pulldom.po | 4 +- library/xml.etree.elementtree.po | 4 +- library/xml.po | 4 +- library/xml.sax.handler.po | 5 +- library/xml.sax.po | 4 +- library/xml.sax.reader.po | 5 +- library/xml.sax.utils.po | 5 +- library/xmlrpc.client.po | 4 +- library/xmlrpc.po | 4 +- library/xmlrpc.server.po | 5 +- library/zipapp.po | 4 +- library/zipfile.po | 42 +- library/zipimport.po | 4 +- library/zlib.po | 5 +- library/zoneinfo.po | 4 +- license.po | 59 +- reference/compound_stmts.po | 956 +++++++------- reference/datamodel.po | 51 +- reference/executionmodel.po | 4 +- reference/expressions.po | 5 +- reference/grammar.po | 5 +- reference/import.po | 4 +- reference/index.po | 5 +- reference/introduction.po | 11 +- reference/lexical_analysis.po | 103 +- reference/simple_stmts.po | 4 +- reference/toplevel_components.po | 4 +- sphinx.po | 4 +- tutorial/appendix.po | 5 +- tutorial/appetite.po | 5 +- tutorial/classes.po | 5 +- tutorial/controlflow.po | 39 +- tutorial/datastructures.po | 20 +- tutorial/errors.po | 12 +- tutorial/floatingpoint.po | 4 +- tutorial/index.po | 5 +- tutorial/inputoutput.po | 12 +- tutorial/interactive.po | 4 +- tutorial/interpreter.po | 13 +- tutorial/introduction.po | 9 +- tutorial/modules.po | 4 +- tutorial/stdlib.po | 7 +- tutorial/stdlib2.po | 7 +- tutorial/venv.po | 5 +- tutorial/whatnow.po | 5 +- using/android.po | 4 +- using/cmdline.po | 22 +- using/configure.po | 23 +- using/editors.po | 5 +- using/index.po | 5 +- using/ios.po | 4 +- using/mac.po | 4 +- using/unix.po | 4 +- using/windows.po | 104 +- whatsnew/2.0.po | 4 +- whatsnew/2.1.po | 4 +- whatsnew/2.2.po | 4 +- whatsnew/2.3.po | 4 +- whatsnew/2.4.po | 4 +- whatsnew/2.5.po | 4 +- whatsnew/2.6.po | 4 +- whatsnew/2.7.po | 4 +- whatsnew/3.0.po | 4 +- whatsnew/3.1.po | 24 +- whatsnew/3.10.po | 16 +- whatsnew/3.11.po | 25 +- whatsnew/3.12.po | 373 +++--- whatsnew/3.13.po | 460 +++---- whatsnew/3.14.po | 836 ++++++++---- whatsnew/3.2.po | 10 +- whatsnew/3.3.po | 4 +- whatsnew/3.4.po | 1144 +++++++++-------- whatsnew/3.5.po | 9 +- whatsnew/3.6.po | 11 +- whatsnew/3.7.po | 6 +- whatsnew/3.8.po | 15 +- whatsnew/3.9.po | 8 +- whatsnew/changelog.po | 4 +- whatsnew/index.po | 4 +- 523 files changed, 6545 insertions(+), 7837 deletions(-) diff --git a/about.po b/about.po index a95b16de88a..0ebe85514ff 100644 --- a/about.po +++ b/about.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -11,7 +11,7 @@ # hsiao yi , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-01-01 00:15+0000\n" "PO-Revision-Date: 2022-05-12 00:11+0800\n" diff --git a/bugs.po b/bugs.po index 669b63a6744..615b5d684a4 100644 --- a/bugs.po +++ b/bugs.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -11,7 +10,7 @@ # Steven Hsu , 2021-2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-08-31 12:34+0800\n" @@ -53,15 +52,14 @@ msgid "Documentation bugs" msgstr "說明文件的錯誤" #: ../../bugs.rst:18 -#, fuzzy msgid "" "If you find a bug in this documentation or would like to propose an " "improvement, please submit a bug report on the :ref:`issue tracker `. If you have a suggestion on how to fix it, include that as " "well." msgstr "" -"如果你在這份說明文件中發現了錯誤並想要幫助我們改進,請將錯誤報告提交到" -"\\ :ref:`追蹤系統 (tracker) `。如果你有相應的修正建議,請" +"如果你在這份說明文件中發現了錯誤並想要提出改進方案,請將錯誤報告提交到" +"\\ :ref:`錯誤追蹤系統 (issue tracker) `。如果你有相應的修正建議,請" "一併提交。(譯者註:如果是繁體中文說明文件翻譯相關的錯誤,請提交到 https://" "github.com/python/python-docs-zh-tw/issues。)" diff --git a/c-api/abstract.po b/c-api/abstract.po index 87e9a0091e1..ef695f4ea5d 100644 --- a/c-api/abstract.po +++ b/c-api/abstract.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-12-09 21:20+0800\n" diff --git a/c-api/allocation.po b/c-api/allocation.po index 8eb4ca8b495..25affaa91f6 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-10-16 15:35+0800\n" @@ -64,7 +64,6 @@ msgid "" msgstr "" #: ../../c-api/allocation.rst:48 -#, fuzzy msgid "" "Allocates a new Python object using the C structure type *TYPE* and the " "Python type object *typeobj* (``PyTypeObject*``) by " @@ -73,9 +72,9 @@ msgid "" "object (i.e. its reference count will be one)." msgstr "" "使用 C 結構型別 *TYPE* 和 Python 型別物件 *typeobj* (``PyTypeObject*``) 分配" -"一個新的 Python 物件。未在該 Python 物件標頭 (header) 中定義的欄位不會被初始" -"化;呼叫者會擁有那個對於物件的唯一參照(物件的參照計數為一)。記憶體分配大小" -"由 type 物件的 :c:member:`~PyTypeObject.tp_basicsize` 欄位來指定。" +"一個新的 Python 物件。它會呼叫 :c:func:`PyObject_Malloc` 來分配記憶體," +"並且會像 :c:func:`PyObject_Init` 一樣初始化它。呼叫者會擁有該物件的唯一參照" +"(也就是它的參照計數會是 1)。" #: ../../c-api/allocation.rst:54 ../../c-api/allocation.rst:107 msgid "" @@ -97,16 +96,18 @@ msgid "" "(:meth:`~object.__new__`), or :c:member:`~PyTypeObject.tp_init` " "(:meth:`~object.__init__`)." msgstr "" +"這個巨集不會呼叫 :c:member:`~PyTypeObject.tp_alloc`、:c:member:`~PyTypeObject.tp_new` " +"(:meth:`~object.__new__`)、或 :c:member:`~PyTypeObject.tp_init` " +"(:meth:`~object.__init__`)。" #: ../../c-api/allocation.rst:65 -#, fuzzy msgid "" "This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set " "in :c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_New` " "instead." msgstr "" -"注意,如果 *typeobj* 有 :c:macro:`Py_TPFLAGS_HAVE_GC` 設定,則此函式不適用。" -"對於這種物件,請改用 :c:func:`PyObject_GC_New`。" +"這不能用於有在 :c:member:`~PyTypeObject.tp_flags` 中設定 " +":c:macro:`Py_TPFLAGS_HAVE_GC` 的物件;請改用 :c:macro:`PyObject_GC_New`。" #: ../../c-api/allocation.rst:68 msgid "" @@ -130,27 +131,27 @@ msgstr "" #: ../../c-api/allocation.rst:83 msgid "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);" -msgstr "" +msgstr "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);" #: ../../c-api/allocation.rst:87 ../../c-api/allocation.rst:137 msgid ":c:func:`PyObject_Free`" -msgstr "" +msgstr ":c:func:`PyObject_Free`" #: ../../c-api/allocation.rst:88 msgid ":c:macro:`PyObject_GC_New`" -msgstr "" +msgstr ":c:macro:`PyObject_GC_New`" #: ../../c-api/allocation.rst:89 ../../c-api/allocation.rst:139 msgid ":c:func:`PyType_GenericAlloc`" -msgstr "" +msgstr ":c:func:`PyType_GenericAlloc`" #: ../../c-api/allocation.rst:90 ../../c-api/allocation.rst:140 msgid ":c:member:`~PyTypeObject.tp_alloc`" -msgstr "" +msgstr ":c:member:`~PyTypeObject.tp_alloc`" #: ../../c-api/allocation.rst:95 msgid "Like :c:macro:`PyObject_New` except:" -msgstr "" +msgstr "和 :c:macro:`PyObject_New` 類似,但有以下差異:" #: ../../c-api/allocation.rst:97 msgid "" @@ -161,7 +162,7 @@ msgstr "" #: ../../c-api/allocation.rst:100 msgid "The memory is initialized like :c:func:`PyObject_InitVar`." -msgstr "" +msgstr "記憶體會像 :c:func:`PyObject_InitVar` 一樣被初始化。" #: ../../c-api/allocation.rst:102 msgid "" @@ -172,14 +173,13 @@ msgid "" msgstr "" #: ../../c-api/allocation.rst:114 -#, fuzzy msgid "" "This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set " "in :c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_NewVar` " "instead." msgstr "" -"注意,如果 *typeobj* 有 :c:macro:`Py_TPFLAGS_HAVE_GC` 設定,則此函式不適用。" -"對於這種物件,請改用 :c:func:`PyObject_GC_NewVar`。" +"這不能用於有在 :c:member:`~PyTypeObject.tp_flags` 中設定 " +":c:macro:`Py_TPFLAGS_HAVE_GC` 的物件;請改用 :c:macro:`PyObject_GC_NewVar`。" #: ../../c-api/allocation.rst:118 msgid "" @@ -191,14 +191,15 @@ msgstr "" msgid "" "PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);" msgstr "" +"PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);" #: ../../c-api/allocation.rst:138 msgid ":c:macro:`PyObject_GC_NewVar`" -msgstr "" +msgstr ":c:macro:`PyObject_GC_NewVar`" #: ../../c-api/allocation.rst:145 msgid "Same as :c:func:`PyObject_Free`." -msgstr "" +msgstr "和 :c:func:`PyObject_Free` 相同。" #: ../../c-api/allocation.rst:149 msgid "" @@ -216,42 +217,3 @@ msgstr ":ref:`moduleobjects`" #: ../../c-api/allocation.rst:157 msgid "To allocate and create extension modules." msgstr "分配記憶體和建立擴充模組。" - -#~ msgid "" -#~ "Initialize a newly allocated object *op* with its type and initial " -#~ "reference. Returns the initialized object. Other fields of the object " -#~ "are not affected." -#~ msgstr "" -#~ "用它的型別和初始參照來初始化新分配物件 *op*。已初始化的物件會被回傳。物件" -#~ "的其他欄位不受影響。" - -#~ msgid "" -#~ "Allocate a new Python object using the C structure type *TYPE* and the " -#~ "Python type object *typeobj* (``PyTypeObject*``). Fields not defined by " -#~ "the Python object header are not initialized. The allocated memory " -#~ "allows for the *TYPE* structure plus *size* (``Py_ssize_t``) fields of " -#~ "the size given by the :c:member:`~PyTypeObject.tp_itemsize` field of " -#~ "*typeobj*. This is useful for implementing objects like tuples, which " -#~ "are able to determine their size at construction time. Embedding the " -#~ "array of fields into the same allocation decreases the number of " -#~ "allocations, improving the memory management efficiency." -#~ msgstr "" -#~ "使用 C 的結構型別 *TYPE* 和 Python 的型別物件 *typeobj* " -#~ "(``PyTypeObject*``) 分配一個新的 Python 物件。未在該 Python 物件標頭中定義" -#~ "的欄位不會被初始化。記憶體空間預留了 *TYPE* 結構大小再加上 *typeobj* 物件" -#~ "中 :c:member:`~PyTypeObject.tp_itemsize` 欄位提供的 *size* " -#~ "(``Py_ssize_t``) 欄位的值。這對於實現如 tuple 這種能夠在建立期間決定自己大" -#~ "小的物件是很實用的。將欄位的陣列嵌入到相同的記憶體分配中可以減少記憶體分配" -#~ "的次數,這提高了記憶體管理的效率。" - -#~ msgid "" -#~ "Releases memory allocated to an object using :c:macro:`PyObject_New` " -#~ "or :c:macro:`PyObject_NewVar`. This is normally called from " -#~ "the :c:member:`~PyTypeObject.tp_dealloc` handler specified in the " -#~ "object's type. The fields of the object should not be accessed after " -#~ "this call as the memory is no longer a valid Python object." -#~ msgstr "" -#~ "釋放由 :c:macro:`PyObject_New` 或者 :c:macro:`PyObject_NewVar` 分配給物件" -#~ "的記憶體。這通常是在物件型別所指定的 :c:member:`~PyTypeObject.tp_dealloc` " -#~ "handler 中呼叫。呼叫這個函式以後,物件的各欄位都不可以被存取,因為原本分配" -#~ "的記憶體已不再是一個有效的 Python 物件。" diff --git a/c-api/apiabiversion.po b/c-api/apiabiversion.po index 5155b4fb0dd..ac7a67f22c8 100644 --- a/c-api/apiabiversion.po +++ b/c-api/apiabiversion.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-01-24 22:34+0800\n" @@ -29,14 +29,13 @@ msgid "Build-time version constants" msgstr "" #: ../../c-api/apiabiversion.rst:13 -#, fuzzy msgid "" "CPython exposes its version number in the following macros. Note that these " "correspond to the version code is **built** with. See :c:var:`Py_Version` " "for the version used at **run time**." msgstr "" "CPython 透過以下巨集 (macro) 公開其版本號。請注意,對應到的是\\ **建置 " -"(built)** 所用到的版本,並不一定是\\ **執行環境 (run time)** 所使用的版本。" +"(built)** 所用到的版本。關於\\ **run time** 所使用的版本,請見 :c:var:`Py_Version`。" #: ../../c-api/apiabiversion.rst:17 msgid "" @@ -68,14 +67,12 @@ msgid "The ``2`` in ``3.4.1a2``. Zero for final releases." msgstr "在 ``3.4.1a2`` 中的 ``2``。零則為最終發布版本。" #: ../../c-api/apiabiversion.rst:43 -#, fuzzy msgid "" "The Python version number encoded in a single integer. " "See :c:func:`Py_PACK_FULL_VERSION` for the encoding details." -msgstr "被編碼為單一整數的 Python 版本號。" +msgstr "被編碼為單一整數的 Python 版本號。詳見 :c:func:`Py_PACK_FULL_VERSION` 以了解編碼詳細資訊。" #: ../../c-api/apiabiversion.rst:46 -#, fuzzy msgid "" "Use this for numeric comparisons, for example, ``#if PY_VERSION_HEX >= ...``." msgstr "使用它進行數值比較,例如 ``#if PY_VERSION_HEX >= ...``。" @@ -85,20 +82,18 @@ msgid "Run-time version" msgstr "" #: ../../c-api/apiabiversion.rst:55 -#, fuzzy msgid "" "The Python runtime version number encoded in a single constant integer. " "See :c:func:`Py_PACK_FULL_VERSION` for the encoding details. This contains " "the Python version used at run time." msgstr "" -"編碼為單個常數整數的 Python 執行環境版本號,格式與 :c:macro:`PY_VERSION_HEX` " -"巨集相同。這包含在執行環境使用的 Python 版本。" +"編碼為單個常數整數的 Python runtime 版本號。詳見 :c:func:`Py_PACK_FULL_VERSION` " +"以了解編碼詳細資訊。這包含在 runtime 使用的 Python 版本。" #: ../../c-api/apiabiversion.rst:59 -#, fuzzy msgid "" "Use this for numeric comparisons, for example, ``if (Py_Version >= ...)``." -msgstr "使用它進行數值比較,例如 ``#if PY_VERSION_HEX >= ...``。" +msgstr "使用它進行數值比較,例如 ``if (Py_Version >= ...)``。" #: ../../c-api/apiabiversion.rst:65 msgid "Bit-packing macros" @@ -112,7 +107,7 @@ msgstr "" #: ../../c-api/apiabiversion.rst:75 msgid "Argument" -msgstr "" +msgstr "引數" #: ../../c-api/apiabiversion.rst:73 msgid "No. of bits" @@ -131,32 +126,29 @@ msgid "Example values" msgstr "" #: ../../c-api/apiabiversion.rst:75 ../../c-api/apiabiversion.rst:93 -#, fuzzy msgid "``3.4.1a2``" -msgstr "``3.4.1a2`` 中的值" +msgstr "``3.4.1a2``" #: ../../c-api/apiabiversion.rst:75 ../../c-api/apiabiversion.rst:95 msgid "``3.10.0``" -msgstr "" +msgstr "``3.10.0``" #: ../../c-api/apiabiversion.rst:77 msgid "*major*" -msgstr "" +msgstr "*major*" #: ../../c-api/apiabiversion.rst:77 ../../c-api/apiabiversion.rst:79 #: ../../c-api/apiabiversion.rst:81 msgid "8" -msgstr "" +msgstr "8" #: ../../c-api/apiabiversion.rst:77 -#, fuzzy msgid "``0xFF000000``" -msgstr "``0x03``" +msgstr "``0xFF000000``" #: ../../c-api/apiabiversion.rst:77 -#, fuzzy msgid "24" -msgstr "2" +msgstr "24" #: ../../c-api/apiabiversion.rst:77 msgid "``0x03``" @@ -167,97 +159,88 @@ msgid "*minor*" msgstr "" #: ../../c-api/apiabiversion.rst:79 -#, fuzzy msgid "``0x00FF0000``" -msgstr "``0x03``" +msgstr "``0x00FF0000``" #: ../../c-api/apiabiversion.rst:79 -#, fuzzy msgid "16" -msgstr "1" +msgstr "16" #: ../../c-api/apiabiversion.rst:79 msgid "``0x04``" msgstr "``0x04``" #: ../../c-api/apiabiversion.rst:79 -#, fuzzy msgid "``0x0A``" -msgstr "``0xA``" +msgstr "``0x0A``" #: ../../c-api/apiabiversion.rst:81 msgid "*micro*" -msgstr "" +msgstr "*micro*" #: ../../c-api/apiabiversion.rst:81 -#, fuzzy msgid "``0x0000FF00``" -msgstr "``0x03``" +msgstr "``0x0000FF00``" #: ../../c-api/apiabiversion.rst:81 msgid "``0x01``" msgstr "``0x01``" #: ../../c-api/apiabiversion.rst:81 -#, fuzzy msgid "``0x00``" -msgstr "``0x03``" +msgstr "``0x00``" #: ../../c-api/apiabiversion.rst:83 msgid "*release_level*" -msgstr "" +msgstr "*release_level*" #: ../../c-api/apiabiversion.rst:83 ../../c-api/apiabiversion.rst:85 msgid "4" msgstr "4" #: ../../c-api/apiabiversion.rst:83 -#, fuzzy msgid "``0x000000F0``" -msgstr "``0x03``" +msgstr "``0x000000F0``" #: ../../c-api/apiabiversion.rst:83 msgid "``0xA``" msgstr "``0xA``" #: ../../c-api/apiabiversion.rst:83 -#, fuzzy msgid "``0xF``" -msgstr "``0xA``" +msgstr "``0xF``" #: ../../c-api/apiabiversion.rst:85 msgid "*release_serial*" -msgstr "" +msgstr "*release_serial*" #: ../../c-api/apiabiversion.rst:85 -#, fuzzy msgid "``0x0000000F``" -msgstr "``0x03``" +msgstr "``0x0000000F``" #: ../../c-api/apiabiversion.rst:85 msgid "0" -msgstr "" +msgstr "0" #: ../../c-api/apiabiversion.rst:85 msgid "``0x2``" msgstr "``0x2``" #: ../../c-api/apiabiversion.rst:85 -#, fuzzy msgid "``0x0``" -msgstr "``0x03``" +msgstr "``0x0``" #: ../../c-api/apiabiversion.rst:88 msgid "For example:" -msgstr "" +msgstr "例如:" #: ../../c-api/apiabiversion.rst:91 msgid "Version" -msgstr "" +msgstr "版本" #: ../../c-api/apiabiversion.rst:91 msgid "``Py_PACK_FULL_VERSION`` arguments" -msgstr "" +msgstr "``Py_PACK_FULL_VERSION`` 引數" #: ../../c-api/apiabiversion.rst:91 msgid "Encoded version" @@ -265,21 +248,19 @@ msgstr "" #: ../../c-api/apiabiversion.rst:93 msgid "``(3, 4, 1, 0xA, 2)``" -msgstr "" +msgstr "``(3, 4, 1, 0xA, 2)``" #: ../../c-api/apiabiversion.rst:93 -#, fuzzy msgid "``0x030401a2``" -msgstr "``0x03``" +msgstr "``0x030401a2``" #: ../../c-api/apiabiversion.rst:95 msgid "``(3, 10, 0, 0xF, 0)``" -msgstr "" +msgstr "``(3, 10, 0, 0xF, 0)``" #: ../../c-api/apiabiversion.rst:95 -#, fuzzy msgid "``0x030a00f0``" -msgstr "``0x03``" +msgstr "``0x030a00f0``" #: ../../c-api/apiabiversion.rst:98 msgid "" @@ -298,6 +279,14 @@ msgid "" " (((SERIAL) & 0xf) << 0))\n" "#endif" msgstr "" +"#ifndef Py_PACK_FULL_VERSION\n" +"#define Py_PACK_FULL_VERSION(X, Y, Z, LEVEL, SERIAL) ( \\\n" +" (((X) & 0xff) << 24) | \\\n" +" (((Y) & 0xff) << 16) | \\\n" +" (((Z) & 0xff) << 8) | \\\n" +" (((LEVEL) & 0xf) << 4) | \\\n" +" (((SERIAL) & 0xf) << 0))\n" +"#endif" #: ../../c-api/apiabiversion.rst:112 msgid "" @@ -311,63 +300,3 @@ msgid "" "does not correspond to any Python release, but is useful in numeric " "comparisons." msgstr "" - -#~ msgid "" -#~ "The underlying version information can be found by treating it as a 32 " -#~ "bit number in the following manner:" -#~ msgstr "所代表的版本資訊可以用以下規則將其看做是一個 32 位元數字來獲得:" - -#~ msgid "Bytes" -#~ msgstr "位元組串" - -#~ msgid "Bits (big endian order)" -#~ msgstr "位元(大端位元組序 (big endian order))" - -#~ msgid "Meaning" -#~ msgstr "意義" - -#~ msgid "1-8" -#~ msgstr "1-8" - -#~ msgid "``PY_MAJOR_VERSION``" -#~ msgstr "``PY_MAJOR_VERSION``" - -#~ msgid "9-16" -#~ msgstr "9-16" - -#~ msgid "``PY_MINOR_VERSION``" -#~ msgstr "``PY_MINOR_VERSION``" - -#~ msgid "3" -#~ msgstr "3" - -#~ msgid "17-24" -#~ msgstr "17-24" - -#~ msgid "``PY_MICRO_VERSION``" -#~ msgstr "``PY_MICRO_VERSION``" - -#~ msgid "25-28" -#~ msgstr "25-28" - -#~ msgid "``PY_RELEASE_LEVEL``" -#~ msgstr "``PY_RELEASE_LEVEL``" - -#~ msgid "29-32" -#~ msgstr "29-32" - -#~ msgid "``PY_RELEASE_SERIAL``" -#~ msgstr "``PY_RELEASE_SERIAL``" - -#~ msgid "" -#~ "Thus ``3.4.1a2`` is hexversion ``0x030401a2`` and ``3.10.0`` is " -#~ "hexversion ``0x030a00f0``." -#~ msgstr "" -#~ "因此 ``3.4.1a2`` 代表 hexversion ``0x030401a2``、``3.10.0`` 代表 " -#~ "hexversion ``0x030a00f0``。" - -#~ msgid "This version is also available via the symbol :c:var:`Py_Version`." -#~ msgstr "該版本也可透過符號 :c:var:`Py_Version` 獲得。" - -#~ msgid "All the given macros are defined in :source:`Include/patchlevel.h`." -#~ msgstr "所有提到的巨集都定義在 :source:`Include/patchlevel.h`。" diff --git a/c-api/arg.po b/c-api/arg.po index f532f43f222..61c618181fc 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-10-16 03:21+0800\n" @@ -693,9 +693,8 @@ msgid "" msgstr "" #: ../../c-api/arg.rst:366 -#, fuzzy msgid "``(items)`` (sequence) [*matching-items*]" -msgstr "``(items)`` (:class:`tuple`) [*matching-items*]" +msgstr "``(items)`` (sequence) [*matching-items*]" #: ../../c-api/arg.rst:367 msgid "" @@ -1146,9 +1145,8 @@ msgid "Convert a C :c:type:`Py_ssize_t` to a Python integer." msgstr "將一個 C 的 :c:type:`Py_ssize_t` 轉換成 Python 整數。" #: ../../c-api/arg.rst:672 -#, fuzzy msgid "Convert a C :c:expr:`int` to a Python :class:`bool` object." -msgstr "將一個 C 的 :c:expr:`long int` 轉換成 Python 整數物件。" +msgstr "將一個 C 的 :c:expr:`int` 轉換成 Python :class:`bool` 物件。" #: ../../c-api/arg.rst:674 msgid "" diff --git a/c-api/bool.po b/c-api/bool.po index 5c1cf65dac8..9b11893bcc9 100644 --- a/c-api/bool.po +++ b/c-api/bool.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-12-09 20:47+0800\n" diff --git a/c-api/buffer.po b/c-api/buffer.po index 52489947570..a83b0f40b05 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-05-02 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" diff --git a/c-api/bytearray.po b/c-api/bytearray.po index c8f8a7b9ad9..9853f9a6398 100644 --- a/c-api/bytearray.po +++ b/c-api/bytearray.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-08-12 11:42+0800\n" @@ -95,16 +94,15 @@ msgstr "" "總是會多附加一個空位元組。" #: ../../c-api/bytearray.rst:76 -#, fuzzy msgid "" "Resize the internal buffer of *bytearray* to *len*. Failure is a ``-1`` " "return with an exception set." -msgstr "將 *bytearray* 的內部緩衝區大小調整為 *len*。" +msgstr "將 *bytearray* 的內部緩衝區大小調整為 *len*。失敗時會回傳 ``-1`` 並設定例外。" #: ../../c-api/bytearray.rst:79 msgid "" "A negative *len* will now result in an exception being set and -1 returned." -msgstr "" +msgstr "負的 *len* 現在會設定例外並回傳 -1。" #: ../../c-api/bytearray.rst:84 msgid "Macros" diff --git a/c-api/bytes.po b/c-api/bytes.po index 473c26b43ef..d7238295b85 100644 --- a/c-api/bytes.po +++ b/c-api/bytes.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:04+0000\n" @@ -252,7 +251,7 @@ msgstr "" #: ../../c-api/bytes.rst:134 msgid "Similar to :c:func:`PyBytes_Size`, but without error checking." -msgstr "" +msgstr "和 :c:func:`PyBytes_Size` 類似,但不進行錯誤檢查。" #: ../../c-api/bytes.rst:139 msgid "" @@ -267,7 +266,7 @@ msgstr "" #: ../../c-api/bytes.rst:151 msgid "Similar to :c:func:`PyBytes_AsString`, but without error checking." -msgstr "" +msgstr "和 :c:func:`PyBytes_AsString` 類似,但不進行錯誤檢查。" #: ../../c-api/bytes.rst:156 msgid "" @@ -316,7 +315,7 @@ msgstr "" #: ../../c-api/bytes.rst:194 msgid "Similar to ``sep.join(iterable)`` in Python." -msgstr "" +msgstr "類似 Python 中的 ``sep.join(iterable)``。" #: ../../c-api/bytes.rst:196 msgid "" diff --git a/c-api/call.po b/c-api/call.po index ada203379cd..deda7d818bf 100644 --- a/c-api/call.po +++ b/c-api/call.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-10-16 03:20+0800\n" diff --git a/c-api/capsule.po b/c-api/capsule.po index 8962dc66fc4..a322f2fd227 100644 --- a/c-api/capsule.po +++ b/c-api/capsule.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-29 00:17+0000\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" diff --git a/c-api/cell.po b/c-api/cell.po index 1b56cd0661b..cf1e495fc8f 100644 --- a/c-api/cell.po +++ b/c-api/cell.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 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" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-10 00:04+0000\n" "PO-Revision-Date: 2022-10-16 15:33+0800\n" diff --git a/c-api/code.po b/c-api/code.po index 154ccc88aee..46a1a245faf 100644 --- a/c-api/code.po +++ b/c-api/code.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" @@ -325,14 +324,12 @@ msgid ":py:data:`inspect.CO_ASYNC_GENERATOR`" msgstr ":py:data:`inspect.CO_ASYNC_GENERATOR`" #: ../../c-api/code.rst:259 -#, fuzzy msgid ":py:data:`inspect.CO_HAS_DOCSTRING`" -msgstr ":py:data:`inspect.CO_COROUTINE`" +msgstr ":py:data:`inspect.CO_HAS_DOCSTRING`" #: ../../c-api/code.rst:261 -#, fuzzy msgid ":py:data:`inspect.CO_METHOD`" -msgstr ":py:data:`inspect.CO_NESTED`" +msgstr ":py:data:`inspect.CO_METHOD`" #: ../../c-api/code.rst:264 msgid "no effect (:py:data:`__future__.division`)" diff --git a/c-api/codec.po b/c-api/codec.po index 6fd7c61a7fd..19e1d21e7f1 100644 --- a/c-api/codec.po +++ b/c-api/codec.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 00:03+0000\n" "PO-Revision-Date: 2023-07-24 17:51+0000\n" diff --git a/c-api/complex.po b/c-api/complex.po index c74dd1a358a..ca8067e5f32 100644 --- a/c-api/complex.po +++ b/c-api/complex.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/c-api/concrete.po b/c-api/concrete.po index cafd42eadc1..e9bba3e2a5d 100644 --- a/c-api/concrete.po +++ b/c-api/concrete.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" "PO-Revision-Date: 2022-11-13 20:37+0800\n" diff --git a/c-api/contextvars.po b/c-api/contextvars.po index b634c911432..35ec1c9bd0e 100644 --- a/c-api/contextvars.po +++ b/c-api/contextvars.po @@ -1,9 +1,8 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-06-27 00:11+0800\n" diff --git a/c-api/conversion.po b/c-api/conversion.po index 633c29b437a..2bc4186ebc6 100644 --- a/c-api/conversion.po +++ b/c-api/conversion.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-12-11 18:26+0000\n" @@ -35,7 +35,7 @@ msgid "" "page :manpage:`snprintf(3)`." msgstr "" "根據格式字串 *format* 和額外引數,輸出不超過 *size* 位元組給 *str*。請參閱 " -"Unix 手冊頁面 :manpage:`snprintf(3)`。" +"Unix 使用手冊 :manpage:`snprintf(3)`。" #: ../../c-api/conversion.rst:19 msgid "" @@ -44,7 +44,7 @@ msgid "" "page :manpage:`vsnprintf(3)`." msgstr "" "根據格式字串 *format* 和變數引數串列 *va*,輸出不超過 *size* 位元組給 *str*。" -"Unix 手冊頁面 :manpage:`vsnprintf(3)`。" +"Unix 使用手冊 :manpage:`vsnprintf(3)`。" #: ../../c-api/conversion.rst:23 msgid "" @@ -136,7 +136,7 @@ msgstr "" #: ../../c-api/conversion.rst:68 msgid "See also the Unix man page :manpage:`strtoul(3)`." -msgstr "也請見 Unix 手冊頁面 :manpage:`strtoul(3)`。" +msgstr "也請見 Unix 使用手冊 :manpage:`strtoul(3)`。" #: ../../c-api/conversion.rst:75 msgid "" @@ -153,7 +153,7 @@ msgstr "" #: ../../c-api/conversion.rst:82 msgid "See also the Unix man page :manpage:`strtol(3)`." -msgstr "也請見 Unix 手冊頁面 :manpage:`strtol(3)`。" +msgstr "也請見 Unix 使用手冊 :manpage:`strtol(3)`。" #: ../../c-api/conversion.rst:89 msgid "" @@ -189,7 +189,6 @@ msgstr "" "指向字串的開頭,引發 ValueError 並回傳 ``-1.0``。" #: ../../c-api/conversion.rst:106 -#, fuzzy msgid "" "If ``s`` represents a value that is too large to store in a float (for " "example, ``\"1e500\"`` is such a string on many platforms) then if " @@ -201,7 +200,7 @@ msgid "" msgstr "" "如果 ``s`` 表示的值太大而無法儲存在浮點數中(例如 ``\"1e500\"`` 在許多平台上" "都是這樣的字串),如果 ``overflow_exception`` 為 ``NULL`` 則回傳 " -"``Py_HUGE_VAL``\\ (會帶有適當的符號)並且不設定任何例外。否則, " +"``Py_INFINITY``\\ (會帶有適當的符號)並且不設定任何例外。否則, " "``overflow_exception`` 必須指向一個 Python 例外物件;引發該例外並回傳 " "``-1.0``。在這兩種情況下,將 ``*endptr`` 設定為指向轉換後的值之後的第一個字" "元。" diff --git a/c-api/coro.po b/c-api/coro.po index 1a5f027a6d0..5ee67a7822a 100644 --- a/c-api/coro.po +++ b/c-api/coro.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date: 2021-12-09 21:15+0800\n" diff --git a/c-api/datetime.po b/c-api/datetime.po index 60f4918fdc2..2689e72e405 100644 --- a/c-api/datetime.po +++ b/c-api/datetime.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-08-22 00:03+0000\n" "PO-Revision-Date: 2023-07-01 04:14+0800\n" diff --git a/c-api/descriptor.po b/c-api/descriptor.po index 314623827e9..112cee717d7 100644 --- a/c-api/descriptor.po +++ b/c-api/descriptor.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-10-26 16:47+0000\n" "PO-Revision-Date: 2021-12-09 20:56+0800\n" diff --git a/c-api/dict.po b/c-api/dict.po index c0e86e7f564..d730a330b96 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/c-api/exceptions.po b/c-api/exceptions.po index 03fb297eac7..745cded9574 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:05+0000\n" @@ -942,9 +942,8 @@ msgid "" msgstr "" #: ../../c-api/exceptions.rst:869 -#, fuzzy msgid ":attr:`UnicodeError.start`" -msgstr ":exc:`UnicodeError`" +msgstr ":attr:`UnicodeError.start`" #: ../../c-api/exceptions.rst:875 msgid "" @@ -978,9 +977,8 @@ msgid "" msgstr "" #: ../../c-api/exceptions.rst:902 -#, fuzzy msgid ":attr:`UnicodeError.end`" -msgstr ":exc:`UnicodeError`" +msgstr ":attr:`UnicodeError.end`" #: ../../c-api/exceptions.rst:908 msgid "Return the *reason* attribute of the given exception object." diff --git a/c-api/extension-modules.po b/c-api/extension-modules.po index 1260e7dc5a9..b93feceed8f 100644 --- a/c-api/extension-modules.po +++ b/c-api/extension-modules.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -167,6 +166,12 @@ msgid "" " suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" " return b'PyInit' + suffix" msgstr "" +"def initfunc_name(name):\n" +" try:\n" +" suffix = b'_' + name.encode('ascii')\n" +" except UnicodeEncodeError:\n" +" suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" +" return b'PyInit' + suffix" #: ../../c-api/extension-modules.rst:115 msgid "" @@ -207,6 +212,17 @@ msgid "" " return PyModuleDef_Init(&spam_module);\n" "}" msgstr "" +"static struct PyModuleDef spam_module = {\n" +" .m_base = PyModuleDef_HEAD_INIT,\n" +" .m_name = \"spam\",\n" +" ...\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_spam(void)\n" +"{\n" +" return PyModuleDef_Init(&spam_module);\n" +"}" #: ../../c-api/extension-modules.rst:140 msgid "" @@ -318,6 +334,18 @@ msgid "" ">>> one.error is two.error\n" "True" msgstr "" +">>> import sys\n" +">>> import _testsinglephase as one\n" +">>> del sys.modules['_testsinglephase']\n" +">>> import _testsinglephase as two\n" +">>> one is two\n" +"False\n" +">>> one.__dict__ is two.__dict__\n" +"False\n" +">>> one.sum is two.sum\n" +"True\n" +">>> one.error is two.error\n" +"True" #: ../../c-api/extension-modules.rst:229 msgid "" diff --git a/c-api/file.po b/c-api/file.po index cb40f45c722..2fda6db2da3 100644 --- a/c-api/file.po +++ b/c-api/file.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-04-24 20:38+0800\n" @@ -43,7 +43,6 @@ msgstr "" "錯誤報告;建議第三方程式碼改為存取 :mod:`io` API。" #: ../../c-api/file.rst:22 -#, fuzzy msgid "" "Create a Python file object from the file descriptor of an already opened " "file *fd*. The arguments *name*, *encoding*, *errors* and *newline* can be " @@ -83,7 +82,6 @@ msgstr "" "須回傳一個整數,它作為檔案描述器值回傳。設定例外並在失敗時回傳 ``-1``。" #: ../../c-api/file.rst:52 -#, fuzzy msgid "" "Equivalent to ``p.readline([n])``, this function reads one line from the " "object *p*. *p* may be a file object or any object with a :meth:`~io.IOBase." @@ -95,10 +93,10 @@ msgid "" "regardless of length, but :exc:`EOFError` is raised if the end of the file " "is reached immediately." msgstr "" -"相當於 ``p.readline([n])``,這個函式從物件 *p* 中讀取一行。 *p* 可以是檔案對" -"像或任何具有 :meth:`~io.IOBase.readline` 方法的物件。如果 *n* 為 ``0``,則只" -"讀取一行,而不管該行的長度。如果 *n* 大於 ``0``,則不會從檔案中讀取超過 *n* " -"個位元組;可以回傳部分行。在這兩種情況下,如果立即到達檔案末尾,則回傳一個空" +"相當於 ``p.readline([n])``,這個函式從物件 *p* 中讀取一行。 *p* 可以是檔案物" +"件或任何具有 :meth:`~io.IOBase.readline` 方法的物件。如果 *n* 為 ``0``,則不管該行" +"的長度都只會讀取一行。如果 *n* 大於 ``0``,則不會從檔案中讀取超過 *n* " +"個位元組;可以回傳該行的一部分。在這兩種情況下,如果立即到達檔案末尾,則回傳一個空" "字串。但是,如果 *n* 小於 ``0``,無論長度如何,都會讀取一行,但如果立即到達檔" "案末尾,則會引發 :exc:`EOFError`。" @@ -115,13 +113,12 @@ msgid "The *handler* is a function of type:" msgstr "" #: ../../c-api/file.rst:73 -#, fuzzy msgid "" "Equivalent of :c:expr:`PyObject *(\\*)(PyObject *path, void *userData)`, " "where *path* is guaranteed to be :c:type:`PyUnicodeObject`." msgstr "" -"處理程式是 :c:expr:`PyObject *(\\*)(PyObject *path, void *userData)` 型別的函" -"式,其中 *path* 保證為 :c:type:`PyUnicodeObject`。" +"相當於 :c:expr:`PyObject *(\\*)(PyObject *path, void *userData)`," +"其中 *path* 保證為 :c:type:`PyUnicodeObject`。" #: ../../c-api/file.rst:77 msgid "" @@ -142,14 +139,13 @@ msgstr "" "它們已知有被凍結或在 ``sys.modules`` 中可用。" #: ../../c-api/file.rst:85 -#, fuzzy msgid "" "Once a hook has been set, it cannot be removed or replaced, and later calls " "to :c:func:`PyFile_SetOpenCodeHook` will fail. On failure, the function " "returns -1 and sets an exception if the interpreter has been initialized." msgstr "" -"一旦設定了一個掛鉤函式,它就不能被刪除或替換,以後呼叫 :c:func:" -"`PyFile_SetOpenCodeHook` 將失敗。失敗時,函式回傳 -1 並在直譯器已初始化時設定" +"一旦設定了一個掛鉤函式,它就不能被刪除或替換,且後續對 :c:func:" +"`PyFile_SetOpenCodeHook` 的呼叫將會失敗。失敗時,函式回傳 -1 且若直譯器已初始化便會設定" "例外。" #: ../../c-api/file.rst:89 diff --git a/c-api/float.po b/c-api/float.po index 03d7378c58b..6fe2dfed354 100644 --- a/c-api/float.po +++ b/c-api/float.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/c-api/frame.po b/c-api/frame.po index 1bbe0b32c78..c8ea01bfab7 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-12-12 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/c-api/function.po b/c-api/function.po index 9328805cc2d..dd441c9f9b0 100644 --- a/c-api/function.po +++ b/c-api/function.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2022-11-12 15:45+0800\n" diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index 74fd2d5c1f8..f11d4492235 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:31+0000\n" diff --git a/c-api/gen.po b/c-api/gen.po index a1d498d11c9..b6f8b20dfba 100644 --- a/c-api/gen.po +++ b/c-api/gen.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date: 2022-10-16 15:33+0800\n" diff --git a/c-api/hash.po b/c-api/hash.po index 87d5bc0a8e3..780b001cbbe 100644 --- a/c-api/hash.po +++ b/c-api/hash.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-04-30 00:20+0800\n" @@ -113,11 +113,11 @@ msgstr "" #: ../../c-api/hash.rst:104 msgid "*len* must be greater than or equal to ``0``." -msgstr "" +msgstr "*len* 必須大於或等於 ``0``。" #: ../../c-api/hash.rst:106 msgid "This function always succeeds." -msgstr "" +msgstr "此函式總是會成功執行。" #: ../../c-api/hash.rst:113 msgid "" @@ -130,6 +130,3 @@ msgstr "" #: ../../c-api/hash.rst:118 msgid "In CPython, it is equivalent to :c:func:`Py_HashPointer`." msgstr "在 CPython 中,它等價於 :c:func:`Py_HashPointer`。" - -#~ msgid "Hash function." -#~ msgstr "雜湊函式。" diff --git a/c-api/import.po b/c-api/import.po index 72d0365616b..00cfc9eefef 100644 --- a/c-api/import.po +++ b/c-api/import.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" @@ -389,7 +388,7 @@ msgstr "" #: ../../c-api/import.rst:334 msgid "Names must be Python :class:`str` objects." -msgstr "" +msgstr "名稱必須是 Python :class:`str` 物件。" #: ../../c-api/import.rst:336 msgid "" diff --git a/c-api/index.po b/c-api/index.po index 7e0a7df3091..024b9747ea9 100644 --- a/c-api/index.po +++ b/c-api/index.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-07-05 21:11+0800\n" diff --git a/c-api/init.po b/c-api/init.po index cf945d75b91..771928aae59 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Adrian Liaw , 2018 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" @@ -1173,11 +1173,10 @@ msgid "" msgstr "" #: ../../c-api/init.rst:920 -#, fuzzy msgid "" "Use :c:func:`PyConfig_Get(\"home\") ` or " "the :envvar:`PYTHONHOME` environment variable instead." -msgstr "改為取得 :c:member:`PyConfig.home` 或 :envvar:`PYTHONHOME` 環境變數。" +msgstr "改為使用 :c:func:`PyConfig_Get(\"home\") ` 或 :envvar:`PYTHONHOME` 環境變數。" #: ../../c-api/init.rst:928 msgid "Thread State and the Global Interpreter Lock" @@ -1918,9 +1917,8 @@ msgstr "" #: ../../c-api/init.rst:1530 ../../c-api/init.rst:2117 #: ../../c-api/init.rst:2124 ../../c-api/init.rst:2143 #: ../../c-api/init.rst:2150 -#, fuzzy msgid "The caller must have an :term:`attached thread state`." -msgstr "呼叫者必須持有 :term:`GIL`。" +msgstr "呼叫者必須擁有一個 :term:`attached thread state`。" #: ../../c-api/init.rst:1537 msgid "" @@ -3122,15 +3120,14 @@ msgid "Locks the mutex *m* and begins a critical section." msgstr "" #: ../../c-api/init.rst:2538 -#, fuzzy msgid "" "{\n" " PyCriticalSection _py_cs;\n" " PyCriticalSection_BeginMutex(&_py_cs, m)" msgstr "" "{\n" -" PyCriticalSection _py_cs;\n" -" PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" +" PyCriticalSection _py_cs;\n" +" PyCriticalSection_BeginMutex(&_py_cs, m)" #: ../../c-api/init.rst:2542 msgid "" @@ -3180,15 +3177,14 @@ msgid "Locks the mutexes *m1* and *m2* and begins a critical section." msgstr "" #: ../../c-api/init.rst:2584 -#, fuzzy msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2)" msgstr "" "{\n" -" PyCriticalSection _py_cs;\n" -" PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" +" PyCriticalSection2 _py_cs2;\n" +" PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2)" #: ../../c-api/init.rst:2588 msgid "" diff --git a/c-api/init_config.po b/c-api/init_config.po index abd8231ebaf..bef46bbdf1b 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -23,13 +22,12 @@ msgid "Python Initialization Configuration" msgstr "Python 初始化設定" #: ../../c-api/init_config.rst:13 -#, fuzzy msgid "PyInitConfig C API" -msgstr "PyConfig" +msgstr "PyInitConfig C API" #: ../../c-api/init_config.rst:17 msgid "Python can be initialized with :c:func:`Py_InitializeFromInitConfig`." -msgstr "" +msgstr "Python 可以使用 :c:func:`Py_InitializeFromInitConfig` 來初始化。" #: ../../c-api/init_config.rst:19 ../../c-api/init_config.rst:650 msgid "" @@ -94,9 +92,8 @@ msgid "" msgstr "" #: ../../c-api/init_config.rst:71 -#, fuzzy msgid "Create Config" -msgstr "PyPreConfig" +msgstr "建立設定" #: ../../c-api/init_config.rst:75 msgid "Opaque structure to configure the Python initialization." @@ -117,9 +114,8 @@ msgid "Return ``NULL`` on memory allocation failure." msgstr "" #: ../../c-api/init_config.rst:90 -#, fuzzy msgid "Free memory of the initialization configuration *config*." -msgstr "Python 初始化設定" +msgstr "" #: ../../c-api/init_config.rst:92 msgid "If *config* is ``NULL``, no operation is performed." @@ -127,23 +123,23 @@ msgstr "" #: ../../c-api/init_config.rst:96 msgid "Error Handling" -msgstr "" +msgstr "錯誤處理" #: ../../c-api/init_config.rst:100 msgid "Get the *config* error message." -msgstr "" +msgstr "取得 *config* 錯誤訊息。" #: ../../c-api/init_config.rst:102 msgid "Set *\\*err_msg* and return ``1`` if an error is set." -msgstr "" +msgstr "如果設定了錯誤,則設置 *\\*err_msg* 並回傳 ``1``。" #: ../../c-api/init_config.rst:103 msgid "Set *\\*err_msg* to ``NULL`` and return ``0`` otherwise." -msgstr "" +msgstr "如果沒有設定錯誤,則設定 *\\*err_msg* 為 ``NULL`` 並回傳 ``0``。" #: ../../c-api/init_config.rst:105 msgid "An error message is an UTF-8 encoded string." -msgstr "" +msgstr "錯誤訊息是 UTF-8 編碼的字串。" #: ../../c-api/init_config.rst:107 msgid "If *config* has an exit code, format the exit code as an error message." @@ -271,7 +267,7 @@ msgstr "" #: ../../c-api/init_config.rst:217 ../../c-api/init_config.rst:232 #: ../../c-api/init_config.rst:248 ../../c-api/init_config.rst:591 msgid "Return ``0`` on success." -msgstr "" +msgstr "成功時回傳 ``0``。" #: ../../c-api/init_config.rst:205 msgid "" @@ -287,7 +283,7 @@ msgstr "" #: ../../c-api/init_config.rst:222 msgid "Module" -msgstr "" +msgstr "模組" #: ../../c-api/init_config.rst:226 msgid "Add a built-in extension module to the table of built-in modules." @@ -308,16 +304,15 @@ msgstr "" #: ../../c-api/init_config.rst:238 msgid "Similar to the :c:func:`PyImport_AppendInittab` function." -msgstr "" +msgstr "和 :c:func:`PyImport_AppendInittab` 函式類似。" #: ../../c-api/init_config.rst:242 msgid "Initialize Python" -msgstr "" +msgstr "初始化 Python" #: ../../c-api/init_config.rst:246 -#, fuzzy msgid "Initialize Python from the initialization configuration." -msgstr "Python 初始化設定" +msgstr "" #: ../../c-api/init_config.rst:250 msgid "Set an exit code in *config* and return ``-1`` if Python wants to exit." @@ -333,11 +328,11 @@ msgstr "" #: ../../c-api/init_config.rst:264 msgid "Option" -msgstr "" +msgstr "選項" #: ../../c-api/init_config.rst:265 msgid "PyConfig/PyPreConfig member" -msgstr "" +msgstr "PyConfig/PyPreConfig 成員" #: ../../c-api/init_config.rst:266 msgid "Type" @@ -349,12 +344,11 @@ msgstr "" #: ../../c-api/init_config.rst:268 msgid "``\"allocator\"``" -msgstr "" +msgstr "``\"allocator\"``" #: ../../c-api/init_config.rst:269 -#, fuzzy msgid ":c:member:`allocator `" -msgstr ":c:member:`PyConfig.platlibdir`" +msgstr ":c:member:`allocator `" #: ../../c-api/init_config.rst:270 ../../c-api/init_config.rst:294 #: ../../c-api/init_config.rst:322 ../../c-api/init_config.rst:358 @@ -362,7 +356,7 @@ msgstr ":c:member:`PyConfig.platlibdir`" #: ../../c-api/init_config.rst:406 ../../c-api/init_config.rst:494 #: ../../c-api/init_config.rst:522 ../../c-api/init_config.rst:576 msgid "``int``" -msgstr "" +msgstr "``int``" #: ../../c-api/init_config.rst:271 ../../c-api/init_config.rst:291 #: ../../c-api/init_config.rst:299 ../../c-api/init_config.rst:303 @@ -388,22 +382,21 @@ msgstr "" #: ../../c-api/init_config.rst:519 ../../c-api/init_config.rst:527 #: ../../c-api/init_config.rst:543 msgid "Read-only" -msgstr "" +msgstr "唯讀" #: ../../c-api/init_config.rst:272 msgid "``\"argv\"``" -msgstr "" +msgstr "``\"argv\"``" #: ../../c-api/init_config.rst:273 -#, fuzzy msgid ":c:member:`argv `" -msgstr ":c:member:`PyConfig.parse_argv`" +msgstr ":c:member:`argv `" #: ../../c-api/init_config.rst:274 ../../c-api/init_config.rst:402 #: ../../c-api/init_config.rst:410 ../../c-api/init_config.rst:530 #: ../../c-api/init_config.rst:578 msgid "``list[str]``" -msgstr "" +msgstr "``list[str]``" #: ../../c-api/init_config.rst:275 ../../c-api/init_config.rst:279 #: ../../c-api/init_config.rst:283 ../../c-api/init_config.rst:287 @@ -418,17 +411,15 @@ msgstr "" #: ../../c-api/init_config.rst:523 ../../c-api/init_config.rst:531 #: ../../c-api/init_config.rst:535 ../../c-api/init_config.rst:539 msgid "Public" -msgstr "" +msgstr "公開" #: ../../c-api/init_config.rst:276 -#, fuzzy msgid "``\"base_exec_prefix\"``" -msgstr ":data:`sys.base_exec_prefix`。" +msgstr "``\"base_exec_prefix\"``" #: ../../c-api/init_config.rst:277 -#, fuzzy msgid ":c:member:`base_exec_prefix `" -msgstr ":c:member:`PyConfig.base_exec_prefix`" +msgstr ":c:member:`base_exec_prefix `" #: ../../c-api/init_config.rst:278 ../../c-api/init_config.rst:282 #: ../../c-api/init_config.rst:286 ../../c-api/init_config.rst:298 @@ -442,35 +433,31 @@ msgstr ":c:member:`PyConfig.base_exec_prefix`" #: ../../c-api/init_config.rst:482 ../../c-api/init_config.rst:486 #: ../../c-api/init_config.rst:490 ../../c-api/init_config.rst:577 msgid "``str``" -msgstr "" +msgstr "``str``" #: ../../c-api/init_config.rst:280 msgid "``\"base_executable\"``" -msgstr "" +msgstr "``\"base_executable\"``" #: ../../c-api/init_config.rst:281 -#, fuzzy msgid ":c:member:`base_executable `" -msgstr ":c:member:`PyConfig.base_executable`" +msgstr ":c:member:`base_executable `" #: ../../c-api/init_config.rst:284 -#, fuzzy msgid "``\"base_prefix\"``" -msgstr ":data:`sys.base_prefix`。" +msgstr "``\"base_prefix\"``" #: ../../c-api/init_config.rst:285 -#, fuzzy msgid ":c:member:`base_prefix `" -msgstr ":c:member:`PyConfig.base_prefix`" +msgstr ":c:member:`base_prefix `" #: ../../c-api/init_config.rst:288 msgid "``\"buffered_stdio\"``" -msgstr "" +msgstr "``\"buffered_stdio\"``" #: ../../c-api/init_config.rst:289 -#, fuzzy msgid ":c:member:`buffered_stdio `" -msgstr ":c:member:`PyConfig.base_prefix`" +msgstr ":c:member:`buffered_stdio `" #: ../../c-api/init_config.rst:290 ../../c-api/init_config.rst:302 #: ../../c-api/init_config.rst:306 ../../c-api/init_config.rst:310 @@ -491,579 +478,519 @@ msgstr ":c:member:`PyConfig.base_prefix`" #: ../../c-api/init_config.rst:534 ../../c-api/init_config.rst:542 #: ../../c-api/init_config.rst:575 msgid "``bool``" -msgstr "" +msgstr "``bool``" #: ../../c-api/init_config.rst:292 msgid "``\"bytes_warning\"``" -msgstr "" +msgstr "``\"bytes_warning\"``" #: ../../c-api/init_config.rst:293 -#, fuzzy msgid ":c:member:`bytes_warning `" -msgstr ":c:member:`PyConfig.pathconfig_warnings`" +msgstr ":c:member:`bytes_warning `" #: ../../c-api/init_config.rst:296 msgid "``\"check_hash_pycs_mode\"``" -msgstr "" +msgstr "``\"check_hash_pycs_mode\"``" #: ../../c-api/init_config.rst:297 msgid ":c:member:`check_hash_pycs_mode `" -msgstr "" +msgstr ":c:member:`check_hash_pycs_mode `" #: ../../c-api/init_config.rst:300 msgid "``\"code_debug_ranges\"``" -msgstr "" +msgstr "``\"code_debug_ranges\"``" #: ../../c-api/init_config.rst:301 msgid ":c:member:`code_debug_ranges `" -msgstr "" +msgstr ":c:member:`code_debug_ranges `" #: ../../c-api/init_config.rst:304 msgid "``\"coerce_c_locale\"``" -msgstr "" +msgstr "``\"coerce_c_locale\"``" #: ../../c-api/init_config.rst:305 -#, fuzzy msgid ":c:member:`coerce_c_locale `" -msgstr ":c:member:`PyConfig.executable`" +msgstr ":c:member:`coerce_c_locale `" #: ../../c-api/init_config.rst:308 msgid "``\"coerce_c_locale_warn\"``" -msgstr "" +msgstr "``\"coerce_c_locale_warn\"``" #: ../../c-api/init_config.rst:309 msgid ":c:member:`coerce_c_locale_warn `" -msgstr "" +msgstr ":c:member:`coerce_c_locale_warn `" #: ../../c-api/init_config.rst:312 msgid "``\"configure_c_stdio\"``" -msgstr "" +msgstr "``\"configure_c_stdio\"``" #: ../../c-api/init_config.rst:313 msgid ":c:member:`configure_c_stdio `" -msgstr "" +msgstr ":c:member:`configure_c_stdio `" #: ../../c-api/init_config.rst:316 msgid "``\"configure_locale\"``" -msgstr "" +msgstr "``\"configure_locale\"``" #: ../../c-api/init_config.rst:317 msgid ":c:member:`configure_locale `" -msgstr "" +msgstr ":c:member:`configure_locale `" #: ../../c-api/init_config.rst:320 msgid "``\"cpu_count\"``" -msgstr "" +msgstr "``\"cpu_count\"``" #: ../../c-api/init_config.rst:321 -#, fuzzy msgid ":c:member:`cpu_count `" -msgstr ":c:member:`PyConfig.use_environment`" +msgstr ":c:member:`cpu_count `" #: ../../c-api/init_config.rst:324 msgid "``\"dev_mode\"``" -msgstr "" +msgstr "``\"dev_mode\"``" #: ../../c-api/init_config.rst:325 -#, fuzzy msgid ":c:member:`dev_mode `" -msgstr ":c:member:`PyConfig.dev_mode`" +msgstr ":c:member:`dev_mode `" #: ../../c-api/init_config.rst:328 msgid "``\"dump_refs\"``" -msgstr "" +msgstr "``\"dump_refs\"``" #: ../../c-api/init_config.rst:329 -#, fuzzy msgid ":c:member:`dump_refs `" -msgstr ":c:member:`PyConfig.prefix`" +msgstr ":c:member:`dump_refs `" #: ../../c-api/init_config.rst:332 msgid "``\"dump_refs_file\"``" -msgstr "" +msgstr "``\"dump_refs_file\"``" #: ../../c-api/init_config.rst:333 -#, fuzzy msgid ":c:member:`dump_refs_file `" -msgstr ":c:member:`PyConfig.prefix`" +msgstr ":c:member:`dump_refs_file `" #: ../../c-api/init_config.rst:336 msgid "``\"exec_prefix\"``" -msgstr "" +msgstr "``\"exec_prefix\"``" #: ../../c-api/init_config.rst:337 -#, fuzzy msgid ":c:member:`exec_prefix `" -msgstr ":c:member:`PyConfig.exec_prefix`" +msgstr ":c:member:`exec_prefix `" #: ../../c-api/init_config.rst:340 msgid "``\"executable\"``" -msgstr "" +msgstr "``\"executable\"``" #: ../../c-api/init_config.rst:341 -#, fuzzy msgid ":c:member:`executable `" -msgstr ":c:member:`PyConfig.executable`" +msgstr ":c:member:`executable `" #: ../../c-api/init_config.rst:344 msgid "``\"faulthandler\"``" -msgstr "" +msgstr "``\"faulthandler\"``" #: ../../c-api/init_config.rst:345 -#, fuzzy msgid ":c:member:`faulthandler `" -msgstr ":c:member:`PyConfig.executable`" +msgstr ":c:member:`faulthandler `" #: ../../c-api/init_config.rst:348 msgid "``\"filesystem_encoding\"``" -msgstr "" +msgstr "``\"filesystem_encoding\"``" #: ../../c-api/init_config.rst:349 -#, fuzzy msgid ":c:member:`filesystem_encoding `" -msgstr "將 :c:member:`PyConfig.filesystem_encoding` 設為 ``\"mbcs\"``、" +msgstr ":c:member:`filesystem_encoding `" #: ../../c-api/init_config.rst:352 msgid "``\"filesystem_errors\"``" -msgstr "" +msgstr "``\"filesystem_errors\"``" #: ../../c-api/init_config.rst:353 -#, fuzzy msgid ":c:member:`filesystem_errors `" -msgstr "將 :c:member:`PyConfig.filesystem_errors` 設為 ``\"replace\"``。" +msgstr ":c:member:`filesystem_errors `" #: ../../c-api/init_config.rst:356 msgid "``\"hash_seed\"``" -msgstr "" +msgstr "``\"hash_seed\"``" #: ../../c-api/init_config.rst:357 -#, fuzzy msgid ":c:member:`hash_seed `" -msgstr ":c:member:`PyConfig.home`" +msgstr ":c:member:`hash_seed `" #: ../../c-api/init_config.rst:360 msgid "``\"home\"``" -msgstr "" +msgstr "``\"home\"``" #: ../../c-api/init_config.rst:361 -#, fuzzy msgid ":c:member:`home `" -msgstr ":c:member:`PyConfig.home`" +msgstr ":c:member:`home `" #: ../../c-api/init_config.rst:364 msgid "``\"import_time\"``" -msgstr "" +msgstr "``\"import_time\"``" #: ../../c-api/init_config.rst:365 -#, fuzzy msgid ":c:member:`import_time `" -msgstr ":c:member:`PyConfig.program_name`" +msgstr ":c:member:`import_time `" #: ../../c-api/init_config.rst:368 -#, fuzzy msgid "``\"inspect\"``" -msgstr "``\"strict\"``" +msgstr "``\"inspect\"``" #: ../../c-api/init_config.rst:369 -#, fuzzy msgid ":c:member:`inspect `" -msgstr ":c:member:`PyConfig.isolated`" +msgstr ":c:member:`inspect `" #: ../../c-api/init_config.rst:372 msgid "``\"install_signal_handlers\"``" -msgstr "" +msgstr "``\"install_signal_handlers\"``" #: ../../c-api/init_config.rst:373 msgid ":c:member:`install_signal_handlers `" -msgstr "" +msgstr ":c:member:`install_signal_handlers `" #: ../../c-api/init_config.rst:376 msgid "``\"int_max_str_digits\"``" -msgstr "" +msgstr "``\"int_max_str_digits\"``" #: ../../c-api/init_config.rst:377 msgid ":c:member:`int_max_str_digits `" -msgstr "" +msgstr ":c:member:`int_max_str_digits `" #: ../../c-api/init_config.rst:380 msgid "``\"interactive\"``" -msgstr "" +msgstr "``\"interactive\"``" #: ../../c-api/init_config.rst:381 -#, fuzzy msgid ":c:member:`interactive `" -msgstr ":c:member:`PyConfig.isolated`" +msgstr ":c:member:`interactive `" #: ../../c-api/init_config.rst:384 msgid "``\"isolated\"``" -msgstr "" +msgstr "``\"isolated\"``" #: ../../c-api/init_config.rst:385 -#, fuzzy msgid ":c:member:`isolated `" -msgstr ":c:member:`PyConfig.isolated`" +msgstr ":c:member:`isolated `" #: ../../c-api/init_config.rst:388 msgid "``\"legacy_windows_fs_encoding\"``" -msgstr "" +msgstr "``\"legacy_windows_fs_encoding\"``" #: ../../c-api/init_config.rst:389 -#, fuzzy msgid "" ":c:member:`legacy_windows_fs_encoding " "`" -msgstr "也請見 :c:member:`PyConfig.legacy_windows_stdio`。" +msgstr "" +":c:member:`legacy_windows_fs_encoding " +"`" #: ../../c-api/init_config.rst:392 msgid "``\"legacy_windows_stdio\"``" -msgstr "" +msgstr "``\"legacy_windows_stdio\"``" #: ../../c-api/init_config.rst:393 -#, fuzzy msgid ":c:member:`legacy_windows_stdio `" -msgstr "也請見 :c:member:`PyConfig.legacy_windows_stdio`。" +msgstr ":c:member:`legacy_windows_stdio `" #: ../../c-api/init_config.rst:396 msgid "``\"malloc_stats\"``" -msgstr "" +msgstr "``\"malloc_stats\"``" #: ../../c-api/init_config.rst:397 -#, fuzzy msgid ":c:member:`malloc_stats `" -msgstr ":c:member:`PyConfig.isolated`" +msgstr ":c:member:`malloc_stats `" #: ../../c-api/init_config.rst:400 msgid "``\"module_search_paths\"``" -msgstr "" +msgstr "``\"module_search_paths\"``" #: ../../c-api/init_config.rst:401 -#, fuzzy msgid ":c:member:`module_search_paths `" -msgstr ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig.module_search_paths`" +msgstr ":c:member:`module_search_paths `" #: ../../c-api/init_config.rst:404 msgid "``\"optimization_level\"``" -msgstr "" +msgstr "``\"optimization_level\"``" #: ../../c-api/init_config.rst:405 msgid ":c:member:`optimization_level `" -msgstr "" +msgstr ":c:member:`optimization_level `" #: ../../c-api/init_config.rst:408 msgid "``\"orig_argv\"``" -msgstr "" +msgstr "``\"orig_argv\"``" #: ../../c-api/init_config.rst:409 -#, fuzzy msgid ":c:member:`orig_argv `" -msgstr ":c:member:`PyConfig.parse_argv`" +msgstr ":c:member:`orig_argv `" #: ../../c-api/init_config.rst:412 msgid "``\"parse_argv\"``" -msgstr "" +msgstr "``\"parse_argv\"``" #: ../../c-api/init_config.rst:413 -#, fuzzy msgid ":c:member:`parse_argv `" -msgstr ":c:member:`PyConfig.parse_argv`" +msgstr ":c:member:`parse_argv `" #: ../../c-api/init_config.rst:416 msgid "``\"parser_debug\"``" -msgstr "" +msgstr "``\"parser_debug\"``" #: ../../c-api/init_config.rst:417 -#, fuzzy msgid ":c:member:`parser_debug `" -msgstr ":c:member:`PyConfig.parse_argv`" +msgstr ":c:member:`parser_debug `" #: ../../c-api/init_config.rst:420 -#, fuzzy msgid "``\"pathconfig_warnings\"``" -msgstr ":c:member:`PyConfig.pathconfig_warnings`" +msgstr "``\"pathconfig_warnings\"``" #: ../../c-api/init_config.rst:421 -#, fuzzy msgid ":c:member:`pathconfig_warnings `" -msgstr ":c:member:`PyConfig.pathconfig_warnings`" +msgstr ":c:member:`pathconfig_warnings `" #: ../../c-api/init_config.rst:424 msgid "``\"perf_profiling\"``" -msgstr "" +msgstr "``\"perf_profiling\"``" #: ../../c-api/init_config.rst:425 -#, fuzzy msgid ":c:member:`perf_profiling `" -msgstr ":c:member:`PyConfig.base_prefix`" +msgstr ":c:member:`perf_profiling `" #: ../../c-api/init_config.rst:428 msgid "``\"platlibdir\"``" -msgstr "" +msgstr "``\"platlibdir\"``" #: ../../c-api/init_config.rst:429 -#, fuzzy msgid ":c:member:`platlibdir `" -msgstr ":c:member:`PyConfig.platlibdir`" +msgstr ":c:member:`platlibdir `" #: ../../c-api/init_config.rst:432 msgid "``\"prefix\"``" -msgstr "" +msgstr "``\"prefix\"``" #: ../../c-api/init_config.rst:433 -#, fuzzy msgid ":c:member:`prefix `" -msgstr ":c:member:`PyConfig.prefix`" +msgstr ":c:member:`prefix `" #: ../../c-api/init_config.rst:436 -#, fuzzy msgid "``\"program_name\"``" msgstr "``\"surrogateescape\"``" #: ../../c-api/init_config.rst:437 -#, fuzzy msgid ":c:member:`program_name `" -msgstr ":c:member:`PyConfig.program_name`" +msgstr ":c:member:`program_name `" #: ../../c-api/init_config.rst:440 msgid "``\"pycache_prefix\"``" -msgstr "" +msgstr "``\"pycache_prefix\"``" #: ../../c-api/init_config.rst:441 -#, fuzzy msgid ":c:member:`pycache_prefix `" -msgstr ":c:member:`PyConfig.base_prefix`" +msgstr ":c:member:`pycache_prefix `" #: ../../c-api/init_config.rst:444 -#, fuzzy msgid "``\"quiet\"``" -msgstr "``\"strict\"``" +msgstr "``\"quiet\"``" #: ../../c-api/init_config.rst:445 -#, fuzzy msgid ":c:member:`quiet `" -msgstr ":c:member:`PyConfig.home`" +msgstr ":c:member:`quiet `" #: ../../c-api/init_config.rst:448 msgid "``\"run_command\"``" -msgstr "" +msgstr "``\"run_command\"``" #: ../../c-api/init_config.rst:449 -#, fuzzy msgid ":c:member:`run_command `" -msgstr ":c:member:`PyConfig.home`" +msgstr ":c:member:`run_command `" #: ../../c-api/init_config.rst:452 msgid "``\"run_filename\"``" -msgstr "" +msgstr "``\"run_filename\"``" #: ../../c-api/init_config.rst:453 -#, fuzzy msgid ":c:member:`run_filename `" -msgstr ":c:member:`PyConfig.program_name`" +msgstr ":c:member:`run_filename `" #: ../../c-api/init_config.rst:456 msgid "``\"run_module\"``" -msgstr "" +msgstr "``\"run_module\"``" #: ../../c-api/init_config.rst:457 -#, fuzzy msgid ":c:member:`run_module `" -msgstr ":c:member:`PyConfig.dev_mode`" +msgstr ":c:member:`run_module `" #: ../../c-api/init_config.rst:460 msgid "``\"run_presite\"``" -msgstr "" +msgstr "``\"run_presite\"``" #: ../../c-api/init_config.rst:461 -#, fuzzy msgid ":c:member:`run_presite `" -msgstr ":c:member:`PyConfig.prefix`" +msgstr ":c:member:`run_presite `" #: ../../c-api/init_config.rst:464 msgid "``\"safe_path\"``" -msgstr "" +msgstr "``\"safe_path\"``" #: ../../c-api/init_config.rst:465 -#, fuzzy msgid ":c:member:`safe_path `" -msgstr "將 :c:member:`~PyConfig.safe_path` 設定為 ``1``。" +msgstr ":c:member:`safe_path `" #: ../../c-api/init_config.rst:468 -#, fuzzy msgid "``\"show_ref_count\"``" -msgstr "``\"strict\"``" +msgstr "``\"show_ref_count\"``" #: ../../c-api/init_config.rst:469 -#, fuzzy msgid ":c:member:`show_ref_count `" -msgstr ":c:member:`PyConfig.home`" +msgstr ":c:member:`show_ref_count `" #: ../../c-api/init_config.rst:472 -#, fuzzy msgid "``\"site_import\"``" -msgstr "``\"strict\"``" +msgstr "``\"site_import\"``" #: ../../c-api/init_config.rst:473 -#, fuzzy msgid ":c:member:`site_import `" -msgstr "將 :c:member:`~PyConfig.site_import` 設定為 ``0``。" +msgstr ":c:member:`site_import `" #: ../../c-api/init_config.rst:476 msgid "``\"skip_source_first_line\"``" -msgstr "" +msgstr "``\"skip_source_first_line\"``" #: ../../c-api/init_config.rst:477 -#, fuzzy msgid ":c:member:`skip_source_first_line `" -msgstr "也請見 :c:member:`PyConfig.skip_source_first_line` 選項。" +msgstr ":c:member:`skip_source_first_line `" #: ../../c-api/init_config.rst:480 -#, fuzzy msgid "``\"stdio_encoding\"``" -msgstr "``\"strict\"``" +msgstr "``\"stdio_encoding\"``" #: ../../c-api/init_config.rst:481 -#, fuzzy msgid ":c:member:`stdio_encoding `" -msgstr ":c:member:`PyConfig.dev_mode`" +msgstr ":c:member:`stdio_encoding `" #: ../../c-api/init_config.rst:484 -#, fuzzy msgid "``\"stdio_errors\"``" -msgstr "``\"strict\"``" +msgstr "``\"stdio_errors\"``" #: ../../c-api/init_config.rst:485 -#, fuzzy msgid ":c:member:`stdio_errors `" -msgstr ":c:member:`PyConfig.platlibdir`" +msgstr ":c:member:`stdio_errors `" #: ../../c-api/init_config.rst:488 -#, fuzzy msgid "``\"stdlib_dir\"``" -msgstr "``\"strict\"``" +msgstr "``\"stdlib_dir\"``" #: ../../c-api/init_config.rst:489 -#, fuzzy msgid ":c:member:`stdlib_dir `" -msgstr ":c:member:`PyConfig.platlibdir`" +msgstr ":c:member:`stdlib_dir `" #: ../../c-api/init_config.rst:492 msgid "``\"tracemalloc\"``" -msgstr "" +msgstr "``\"tracemalloc\"``" #: ../../c-api/init_config.rst:493 -#, fuzzy msgid ":c:member:`tracemalloc `" -msgstr ":c:member:`PyConfig.dev_mode`" +msgstr ":c:member:`tracemalloc `" #: ../../c-api/init_config.rst:496 msgid "``\"use_environment\"``" -msgstr "" +msgstr "``\"use_environment\"``" #: ../../c-api/init_config.rst:497 -#, fuzzy msgid ":c:member:`use_environment `" -msgstr ":c:member:`PyConfig.use_environment`" +msgstr ":c:member:`use_environment `" #: ../../c-api/init_config.rst:500 msgid "``\"use_frozen_modules\"``" -msgstr "" +msgstr "``\"use_frozen_modules\"``" #: ../../c-api/init_config.rst:501 -#, fuzzy msgid ":c:member:`use_frozen_modules `" -msgstr ":c:member:`PyConfig.use_environment`" +msgstr ":c:member:`use_frozen_modules `" #: ../../c-api/init_config.rst:504 msgid "``\"use_hash_seed\"``" -msgstr "" +msgstr "``\"use_hash_seed\"``" #: ../../c-api/init_config.rst:505 -#, fuzzy msgid ":c:member:`use_hash_seed `" -msgstr ":c:member:`PyConfig.isolated`" +msgstr ":c:member:`use_hash_seed `" #: ../../c-api/init_config.rst:508 msgid "``\"use_system_logger\"``" -msgstr "" +msgstr "``\"use_system_logger\"``" #: ../../c-api/init_config.rst:509 msgid ":c:member:`use_system_logger `" -msgstr "" +msgstr ":c:member:`use_system_logger `" #: ../../c-api/init_config.rst:512 msgid "``\"user_site_directory\"``" -msgstr "" +msgstr "``\"user_site_directory\"``" #: ../../c-api/init_config.rst:513 -#, fuzzy msgid ":c:member:`user_site_directory `" -msgstr ":c:member:`PyConfig.use_environment`" +msgstr ":c:member:`user_site_directory `" #: ../../c-api/init_config.rst:516 msgid "``\"utf8_mode\"``" -msgstr "" +msgstr "``\"utf8_mode\"``" #: ../../c-api/init_config.rst:517 -#, fuzzy msgid ":c:member:`utf8_mode `" -msgstr "將 :c:member:`PyPreConfig.utf8_mode` 設為 ``0``、" +msgstr ":c:member:`utf8_mode `" #: ../../c-api/init_config.rst:520 msgid "``\"verbose\"``" -msgstr "" +msgstr "``\"verbose\"``" #: ../../c-api/init_config.rst:521 -#, fuzzy msgid ":c:member:`verbose `" -msgstr ":c:member:`PyConfig.home`" +msgstr ":c:member:`verbose `" #: ../../c-api/init_config.rst:524 msgid "``\"warn_default_encoding\"``" -msgstr "" +msgstr "``\"warn_default_encoding\"``" #: ../../c-api/init_config.rst:525 msgid ":c:member:`warn_default_encoding `" -msgstr "" +msgstr ":c:member:`warn_default_encoding `" #: ../../c-api/init_config.rst:528 msgid "``\"warnoptions\"``" -msgstr "" +msgstr "``\"warnoptions\"``" #: ../../c-api/init_config.rst:529 -#, fuzzy msgid ":c:member:`warnoptions `" -msgstr ":c:member:`PyConfig.pathconfig_warnings`" +msgstr ":c:member:`warnoptions `" #: ../../c-api/init_config.rst:532 msgid "``\"write_bytecode\"``" -msgstr "" +msgstr "``\"write_bytecode\"``" #: ../../c-api/init_config.rst:533 -#, fuzzy msgid ":c:member:`write_bytecode `" -msgstr ":c:member:`PyConfig.dev_mode`" +msgstr ":c:member:`write_bytecode `" #: ../../c-api/init_config.rst:536 msgid "``\"xoptions\"``" -msgstr "" +msgstr "``\"xoptions\"``" #: ../../c-api/init_config.rst:537 -#, fuzzy msgid ":c:member:`xoptions `" -msgstr ":c:member:`PyConfig.prefix`" +msgstr ":c:member:`xoptions `" #: ../../c-api/init_config.rst:538 ../../c-api/init_config.rst:579 msgid "``dict[str, str]``" -msgstr "" +msgstr "``dict[str, str]``" #: ../../c-api/init_config.rst:540 msgid "``\"_pystats\"``" -msgstr "" +msgstr "``\"_pystats\"``" #: ../../c-api/init_config.rst:541 -#, fuzzy msgid ":c:member:`_pystats `" -msgstr ":c:member:`PyConfig.isolated`" +msgstr ":c:member:`_pystats `" #: ../../c-api/init_config.rst:545 msgid "Visibility:" @@ -1139,15 +1066,15 @@ msgstr "" #: ../../c-api/init_config.rst:614 msgid "Raise a :exc:`ValueError` if there is no option *name*." -msgstr "" +msgstr "如果沒有選項 *name*,則引發 :exc:`ValueError`。" #: ../../c-api/init_config.rst:615 msgid "Raise a :exc:`ValueError` if *value* is an invalid value." -msgstr "" +msgstr "如果 *value* 是無效值,則引發 :exc:`ValueError`。" #: ../../c-api/init_config.rst:616 msgid "Raise a :exc:`ValueError` if the option is read-only (cannot be set)." -msgstr "" +msgstr "如果選項是唯讀的(無法設定),則引發 :exc:`ValueError`。" #: ../../c-api/init_config.rst:617 msgid "Raise a :exc:`TypeError` if *value* has not the proper type." @@ -1160,9 +1087,8 @@ msgid "" msgstr "" #: ../../c-api/init_config.rst:630 -#, fuzzy msgid "PyConfig C API" -msgstr "PyConfig" +msgstr "PyConfig C API" #: ../../c-api/init_config.rst:634 msgid "" @@ -1319,11 +1245,11 @@ msgstr "" #: ../../c-api/init_config.rst:771 msgid "Success." -msgstr "" +msgstr "成功。" #: ../../c-api/init_config.rst:775 msgid "Initialization error with a message." -msgstr "" +msgstr "附帶訊息的初始化錯誤。" #: ../../c-api/init_config.rst:777 msgid "*err_msg* must not be ``NULL``." @@ -2162,9 +2088,8 @@ msgid "Filename where to dump Python references." msgstr "" #: ../../c-api/init_config.rst:1361 -#, fuzzy msgid "Set by the :envvar:`PYTHONDUMPREFSFILE` environment variable." -msgstr "由 :envvar:`PYTHONHOME` 環境變數設定。" +msgstr "由 :envvar:`PYTHONDUMPREFSFILE` 環境變數設定。" #: ../../c-api/init_config.rst:1369 msgid "" @@ -2293,9 +2218,8 @@ msgid "If non-zero, use frozen modules." msgstr "" #: ../../c-api/init_config.rst:1449 -#, fuzzy msgid "Set by the :envvar:`PYTHON_FROZEN_MODULES` environment variable." -msgstr "由 :envvar:`PYTHONHOME` 環境變數設定。" +msgstr "由 :envvar:`PYTHON_FROZEN_MODULES` 環境變數設定。" #: ../../c-api/init_config.rst:1451 msgid "" @@ -2345,11 +2269,10 @@ msgid "" msgstr "" #: ../../c-api/init_config.rst:1484 -#, fuzzy msgid "" "Set by the :option:`-X importtime <-X>` option and " "the :envvar:`PYTHONPROFILEIMPORTTIME` environment variable." -msgstr "由 :envvar:`PYTHONHOME` 環境變數設定。" +msgstr "由 :option:`-X importtime <-X>` 選項與 :envvar:`PYTHONPROFILEIMPORTTIME` 環境變數設定。" #: ../../c-api/init_config.rst:1491 msgid "Added support for ``import_time = 2``" diff --git a/c-api/intro.po b/c-api/intro.po index 0a7c66966a9..1a3e1e2a639 100644 --- a/c-api/intro.po +++ b/c-api/intro.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-04-25 18:01+0800\n" @@ -211,7 +211,6 @@ msgid "Useful macros" msgstr "有用的巨集" #: ../../c-api/intro.rst:113 -#, fuzzy msgid "" "Several useful macros are defined in the Python header files. Many are " "defined closer to where they are useful (for " @@ -220,8 +219,8 @@ msgid "" "listing." msgstr "" "Python 標頭檔中定義了幾個有用的巨集,大多被定義在它們有用的地方附近(例" -"如 :c:macro:`Py_RETURN_NONE`),其他是更通用的工具程式。以下並不一定是完整的" -"列表。" +"如 :c:macro:`Py_RETURN_NONE`、:c:macro:`PyMODINIT_FUNC`),其他是更通用的工具程式。" +"以下並不一定是完整的列表。" #: ../../c-api/intro.rst:122 msgid "Return the absolute value of ``x``." @@ -1009,7 +1008,7 @@ msgstr "" "外狀態。此外,兩種存取例外狀態方法的語義都發生了變化,因此捕獲例外的函式將保" "存和恢復其執行緒的例外狀態,從而保留其呼叫者的例外狀態。這可以防止例外處理程" "式碼中的常見錯誤,這些錯誤是由看似無辜的函式覆蓋了正在處理的例外而引起的;它" -"還替回溯中被堆疊幀 (stack frame) 參照的物件減少了通常不需要的生命週期延長。" +"還替回溯中被堆疊框 (stack frame) 參照的物件減少了通常不需要的生命週期延長。" #: ../../c-api/intro.rst:628 msgid "" diff --git a/c-api/iter.po b/c-api/iter.po index fe89d62ab93..37c2a713c78 100644 --- a/c-api/iter.po +++ b/c-api/iter.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-07-01 03:44+0800\n" @@ -29,13 +29,12 @@ msgid "There are two functions specifically for working with iterators." msgstr "有兩個專門用於疊代器的函式。" #: ../../c-api/iter.rst:12 -#, fuzzy msgid "" "Return non-zero if the object *o* can be safely passed " "to :c:func:`PyIter_NextItem` and ``0`` otherwise. This function always " "succeeds." msgstr "" -"如果物件 *o* 可以安全地傳遞給 :c:func:`PyIter_Next` 則回傳非零 (non-zero),否" +"如果物件 *o* 可以安全地傳遞給 :c:func:`PyIter_NextItem` 則回傳非零 (non-zero),否" "則回傳 0。這個函式一定會執行成功。" #: ../../c-api/iter.rst:18 @@ -59,6 +58,7 @@ msgid "" "This is an older version of :c:func:`!PyIter_NextItem`, which is retained " "for backwards compatibility. Prefer :c:func:`PyIter_NextItem`." msgstr "" +"這是 :c:func:`!PyIter_NextItem` 的舊版本,為了向後相容而保留。請優先使用 :c:func:`PyIter_NextItem`。" #: ../../c-api/iter.rst:38 msgid "" @@ -97,55 +97,3 @@ msgid "" "``PYGEN_ERROR`` if iterator has raised and exception. *presult* is set to " "``NULL``." msgstr "如果疊代器引發例外則為 ``PYGEN_ERROR``。 *presult* 被設定為 ``NULL``。" - -#~ msgid "" -#~ "To write a loop which iterates over an iterator, the C code should look " -#~ "something like this::" -#~ msgstr "要編寫一個疊代於疊代器的迴圈,C 程式碼應該會像這樣:" - -#~ msgid "" -#~ "PyObject *iterator = PyObject_GetIter(obj);\n" -#~ "PyObject *item;\n" -#~ "\n" -#~ "if (iterator == NULL) {\n" -#~ " /* propagate error */\n" -#~ "}\n" -#~ "\n" -#~ "while ((item = PyIter_Next(iterator))) {\n" -#~ " /* do something with item */\n" -#~ " ...\n" -#~ " /* release reference when done */\n" -#~ " Py_DECREF(item);\n" -#~ "}\n" -#~ "\n" -#~ "Py_DECREF(iterator);\n" -#~ "\n" -#~ "if (PyErr_Occurred()) {\n" -#~ " /* propagate error */\n" -#~ "}\n" -#~ "else {\n" -#~ " /* 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" -#~ "}" diff --git a/c-api/iterator.po b/c-api/iterator.po index 3675b02e9a7..a83e08ee22d 100644 --- a/c-api/iterator.po +++ b/c-api/iterator.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-24 00:03+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/c-api/lifecycle.po b/c-api/lifecycle.po index cb4d6221aa9..1a3bb772c47 100644 --- a/c-api/lifecycle.po +++ b/c-api/lifecycle.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -19,7 +18,7 @@ msgstr "" #: ../../c-api/lifecycle.rst:6 msgid "Object Life Cycle" -msgstr "" +msgstr "物件生命週期" #: ../../c-api/lifecycle.rst:8 msgid "" @@ -31,7 +30,7 @@ msgstr "" #: ../../c-api/lifecycle.rst:15 msgid "Life Events" -msgstr "" +msgstr "生命事件" #: ../../c-api/lifecycle.rst:17 msgid "" @@ -47,15 +46,15 @@ msgstr "" #: ../../c-api/lifecycle.rst:70 msgid "Explanation:" -msgstr "" +msgstr "說明:" #: ../../c-api/lifecycle.rst:72 msgid "When a new object is constructed by calling its type:" -msgstr "" +msgstr "當一個新物件透過其型別來建構時:" #: ../../c-api/lifecycle.rst:74 msgid ":c:member:`~PyTypeObject.tp_new` is called to create a new object." -msgstr "" +msgstr ":c:member:`~PyTypeObject.tp_new` 會被呼叫來建立一個新物件。" #: ../../c-api/lifecycle.rst:75 msgid "" @@ -74,11 +73,11 @@ msgstr "" #: ../../c-api/lifecycle.rst:83 msgid "After :c:member:`!tp_init` completes, the object is ready to use." -msgstr "" +msgstr "在 :c:member:`!tp_init` 完成後,該物件即可使用。" #: ../../c-api/lifecycle.rst:84 msgid "Some time after the last reference to an object is removed:" -msgstr "" +msgstr "在最後一個對物件的參照被移除一段時間後:" #: ../../c-api/lifecycle.rst:86 msgid "" @@ -333,11 +332,11 @@ msgstr "" #: ../../c-api/lifecycle.rst:244 msgid "Functions" -msgstr "" +msgstr "函式" #: ../../c-api/lifecycle.rst:246 msgid "To allocate and free memory, see :ref:`allocating-objects`." -msgstr "" +msgstr "要分配和釋放記憶體,請參見 :ref:`allocating-objects`。" #: ../../c-api/lifecycle.rst:251 msgid "" diff --git a/c-api/list.po b/c-api/list.po index 5b7fb4a6e10..71c0d61e56a 100644 --- a/c-api/list.po +++ b/c-api/list.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-08-24 00:55+0800\n" diff --git a/c-api/long.po b/c-api/long.po index dd65775f51d..e428371f79b 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" diff --git a/c-api/mapping.po b/c-api/mapping.po index 49e8987a803..819cc04b26b 100644 --- a/c-api/mapping.po +++ b/c-api/mapping.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-05-11 14:32+0800\n" @@ -75,13 +75,12 @@ msgid "" msgstr "" #: ../../c-api/mapping.rst:53 -#, fuzzy msgid "" "This is the same as :c:func:`PyMapping_GetOptionalItem`, but *key* is " "specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " "a :c:expr:`PyObject*`." msgstr "" -"這與 :c:func:`PyMapping_HasKey` 相同,但 *key* 被指定為 :c:expr:`const " +"這與 :c:func:`PyMapping_GetOptionalItem` 相同,但 *key* 被指定為 :c:expr:`const " "char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" #: ../../c-api/mapping.rst:62 @@ -107,23 +106,21 @@ msgstr "" "char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" #: ../../c-api/mapping.rst:81 -#, fuzzy msgid "" "Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. " "This is equivalent to the Python expression ``key in o``. On failure, return " "``-1``." msgstr "" "如果對映物件具有鍵 *key* 則回傳 ``1``,否則回傳 ``0``。這相當於 Python 運算" -"式 ``key in o``。這個函式總會是成功的。" +"式 ``key in o``。失敗時回傳 ``-1``。" #: ../../c-api/mapping.rst:90 -#, fuzzy msgid "" "This is the same as :c:func:`PyMapping_HasKeyWithError`, but *key* is " "specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " "a :c:expr:`PyObject*`." msgstr "" -"這與 :c:func:`PyMapping_HasKey` 相同,但 *key* 被指定為 :c:expr:`const " +"這與 :c:func:`PyMapping_HasKeyWithError` 相同,但 *key* 被指定為 :c:expr:`const " "char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" #: ../../c-api/mapping.rst:99 @@ -136,7 +133,6 @@ msgstr "" "式 ``key in o``。這個函式總會是成功的。" #: ../../c-api/mapping.rst:105 -#, fuzzy msgid "" "Exceptions which occur when this calls :meth:`~object.__getitem__` method " "are silently ignored. For proper error handling, use :c:func:" @@ -144,7 +140,8 @@ msgid "" "`PyObject_GetItem()` instead." msgstr "" "當它呼叫 :meth:`~object.__getitem__` 方法時發生的例外將被默默忽略。為了適當地" -"處理錯誤,請改用 :c:func:`PyObject_GetItem()`。" +"處理錯誤,請改用 :c:func:`PyMapping_HasKeyWithError`、" +":c:func:`PyMapping_GetOptionalItem` 或 :c:func:`PyObject_GetItem()`。" #: ../../c-api/mapping.rst:113 msgid "" @@ -156,7 +153,6 @@ msgstr "" "char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" #: ../../c-api/mapping.rst:119 -#, fuzzy msgid "" "Exceptions that occur when this calls :meth:`~object.__getitem__` method or " "while creating the temporary :class:`str` object are silently ignored. For " @@ -165,8 +161,8 @@ msgid "" "instead." msgstr "" "當它呼叫 :meth:`~object.__getitem__` 方法或建立臨時 :class:`str` 物件時發生的" -"例外將被默默忽略。為了適當地處理錯誤,請改用 :c:func:" -"`PyMapping_GetItemString`。" +"例外將被默默忽略。為了適當地處理錯誤,請改用 :c:func:`PyMapping_HasKeyStringWithError`、" +":c:func:`PyMapping_GetOptionalItemString` 或 :c:func:`PyMapping_GetItemString`。" #: ../../c-api/mapping.rst:129 msgid "" diff --git a/c-api/marshal.po b/c-api/marshal.po index 17d79cf0436..60485dbc0a5 100644 --- a/c-api/marshal.po +++ b/c-api/marshal.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-06-28 02:44+0800\n" diff --git a/c-api/memory.po b/c-api/memory.po index b9a444d9d60..3074068991f 100644 --- a/c-api/memory.po +++ b/c-api/memory.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" @@ -498,24 +497,20 @@ msgid ":c:func:`PyObject_Calloc`" msgstr ":c:func:`PyObject_Calloc`" #: ../../c-api/memory.rst:392 -#, fuzzy msgid ":c:macro:`PyObject_New`" -msgstr ":c:func:`PyObject_Free`" +msgstr ":c:macro:`PyObject_New`" #: ../../c-api/memory.rst:393 -#, fuzzy msgid ":c:macro:`PyObject_NewVar`" -msgstr ":c:func:`PyObject_Free`" +msgstr ":c:macro:`PyObject_NewVar`" #: ../../c-api/memory.rst:394 -#, fuzzy msgid ":c:func:`PyType_GenericAlloc`" -msgstr ":c:func:`PyMem_Realloc`" +msgstr ":c:func:`PyType_GenericAlloc`" #: ../../c-api/memory.rst:395 -#, fuzzy msgid ":c:member:`~PyTypeObject.tp_free`" -msgstr ":c:func:`PyObject_Free`" +msgstr ":c:member:`~PyTypeObject.tp_free`" #: ../../c-api/memory.rst:401 msgid "Default Memory Allocators" diff --git a/c-api/memoryview.po b/c-api/memoryview.po index 0221f2b2b81..28bd6dc68ef 100644 --- a/c-api/memoryview.po +++ b/c-api/memoryview.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-01-30 00:03+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/c-api/method.po b/c-api/method.po index 15837238166..8a650771d5d 100644 --- a/c-api/method.po +++ b/c-api/method.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-24 00:03+0000\n" "PO-Revision-Date: 2022-01-24 22:22+0800\n" diff --git a/c-api/module.po b/c-api/module.po index 9da989c9f84..02c45934aac 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" @@ -131,9 +131,8 @@ msgid "" msgstr "" #: ../../c-api/module.rst:133 -#, fuzzy msgid "Module definitions" -msgstr "模組物件" +msgstr "模組定義" #: ../../c-api/module.rst:135 msgid "" @@ -283,9 +282,8 @@ msgid "" msgstr "" #: ../../c-api/module.rst:267 -#, fuzzy msgid "Module slots" -msgstr "模組查找" +msgstr "模組槽 (Module slots)" #: ../../c-api/module.rst:273 msgid "A slot ID, chosen from the available values explained below." diff --git a/c-api/monitoring.po b/c-api/monitoring.po index c038e4ee306..c542038550b 100644 --- a/c-api/monitoring.po +++ b/c-api/monitoring.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -106,14 +106,12 @@ msgid "Fire a ``JUMP`` event." msgstr "發出一個 ``JUMP`` 事件。" #: ../../c-api/monitoring.rst:80 -#, fuzzy msgid "Fire a ``BRANCH_LEFT`` event." -msgstr "發出一個 ``BRANCH`` 事件。" +msgstr "發出一個 ``BRANCH_LEFT`` 事件。" #: ../../c-api/monitoring.rst:85 -#, fuzzy msgid "Fire a ``BRANCH_RIGHT`` event." -msgstr "發出一個 ``BRANCH`` 事件。" +msgstr "發出一個 ``BRANCH_RIGHT`` 事件。" #: ../../c-api/monitoring.rst:90 msgid "Fire a ``C_RETURN`` event." @@ -217,14 +215,12 @@ msgid "Event" msgstr "事件" #: ../../c-api/monitoring.rst:176 -#, fuzzy msgid ":monitoring-event:`BRANCH_LEFT`" -msgstr ":monitoring-event:`BRANCH`" +msgstr ":monitoring-event:`BRANCH_LEFT`" #: ../../c-api/monitoring.rst:177 -#, fuzzy msgid ":monitoring-event:`BRANCH_RIGHT`" -msgstr ":monitoring-event:`BRANCH`" +msgstr ":monitoring-event:`BRANCH_RIGHT`" #: ../../c-api/monitoring.rst:178 msgid ":monitoring-event:`CALL`" diff --git a/c-api/none.po b/c-api/none.po index 2a360b0167b..675650b0201 100644 --- a/c-api/none.po +++ b/c-api/none.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/number.po b/c-api/number.po index 83e14a4b313..66d782afb55 100644 --- a/c-api/number.po +++ b/c-api/number.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/object.po b/c-api/object.po index 14cfc4164c2..29f4268ec26 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" @@ -778,7 +777,7 @@ msgstr "" #: ../../c-api/object.rst:638 msgid "my_func([1, 2, 3])" -msgstr "" +msgstr "my_func([1, 2, 3])" #: ../../c-api/object.rst:640 msgid "" @@ -791,10 +790,12 @@ msgid "" "my_list = [1, 2, 3]\n" "my_func(my_list)" msgstr "" +"my_list = [1, 2, 3]\n" +"my_func(my_list)" #: ../../c-api/object.rst:646 msgid "See also the function :c:func:`Py_REFCNT`." -msgstr "" +msgstr "另請參閱 :c:func:`Py_REFCNT` 函式。" #: ../../c-api/object.rst:652 msgid "" @@ -836,6 +837,11 @@ msgid "" "}\n" "return 0;" msgstr "" +"if (Py_REFCNT(op) > 0) {\n" +" Py_INCREF(op);\n" +" return 1;\n" +"}\n" +"return 0;" #: ../../c-api/object.rst:681 msgid "" diff --git a/c-api/objimpl.po b/c-api/objimpl.po index b468c229482..e01909fd1f9 100644 --- a/c-api/objimpl.po +++ b/c-api/objimpl.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2025-07-14 02:51+0000\n" diff --git a/c-api/perfmaps.po b/c-api/perfmaps.po index c5be72a4b78..026a9131c84 100644 --- a/c-api/perfmaps.po +++ b/c-api/perfmaps.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-05-11 14:42+0800\n" @@ -49,11 +49,10 @@ msgstr "" "庫和功能所使用。" #: ../../c-api/perfmaps.rst:19 -#, fuzzy msgid "" "Note that holding an :term:`attached thread state` is not required for these " "APIs." -msgstr "請注意,這些 API 不需要持有全域直譯器鎖 (GIL)。" +msgstr "請注意,這些 API 不需要持有 :term:`attached thread state`。" #: ../../c-api/perfmaps.rst:23 msgid "" diff --git a/c-api/refcounting.po b/c-api/refcounting.po index f8a7c045290..3ad5095d4d8 100644 --- a/c-api/refcounting.po +++ b/c-api/refcounting.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-08-06 14:19+0800\n" diff --git a/c-api/reflection.po b/c-api/reflection.po index 458793da311..ceb70a288b7 100644 --- a/c-api/reflection.po +++ b/c-api/reflection.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/c-api/sequence.po b/c-api/sequence.po index 36140ff4d95..912fea56bfa 100644 --- a/c-api/sequence.po +++ b/c-api/sequence.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" @@ -124,7 +123,7 @@ msgstr "" #: ../../c-api/sequence.rst:110 msgid "Alias for :c:func:`PySequence_Contains`." -msgstr "" +msgstr ":c:func:`PySequence_Contains` 的別名。" #: ../../c-api/sequence.rst:112 msgid "" diff --git a/c-api/set.po b/c-api/set.po index e094b1ee324..2bdbc213493 100644 --- a/c-api/set.po +++ b/c-api/set.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-11-27 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/slice.po b/c-api/slice.po index fbac58a43a4..57288261d15 100644 --- a/c-api/slice.po +++ b/c-api/slice.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-18 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/stable.po b/c-api/stable.po index 58abc22d741..5e4a3dc643c 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-01-24 21:07+0800\n" diff --git a/c-api/structures.po b/c-api/structures.po index 5c7f00a97f3..e23e123b639 100644 --- a/c-api/structures.po +++ b/c-api/structures.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/sys.po b/c-api/sys.po index 0b6eca8780a..104d0205df6 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/time.po b/c-api/time.po index cfd6272fe08..4ec17128643 100644 --- a/c-api/time.po +++ b/c-api/time.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-05-25 04:26+0800\n" @@ -100,12 +100,11 @@ msgstr "" "統上,整數溢位很可能是由於錯誤設定的系統時間所造成。)" #: ../../c-api/time.rst:58 -#, fuzzy msgid "" "As any other C API (unless otherwise specified), the functions must be " "called with an :term:`attached thread state`." msgstr "" -"如同任何其他 C API(除非另有指定),必須在持有 :term:`GIL` 的情況下呼叫函式。" +"如同任何其他 C API(除非另有指定),必須在具有 :term:`attached thread state` 的情況下呼叫函式。" #: ../../c-api/time.rst:63 msgid "" @@ -133,18 +132,16 @@ msgid "Raw Clock Functions" msgstr "原始時鐘函式" #: ../../c-api/time.rst:80 -#, fuzzy msgid "" "Similar to clock functions, but don't set an exception on error and don't " "require the caller to have an :term:`attached thread state`." -msgstr "類似於時鐘函式,但不會在出錯時設定例外,也不需要讓呼叫者持有 GIL。" +msgstr "類似於時鐘函式,但不會在出錯時設定例外,也不需要呼叫者擁有 :term:`attached thread state`。" #: ../../c-api/time.rst:83 msgid "On success, the functions return ``0``." msgstr "成功時函式會回傳 ``0``。" #: ../../c-api/time.rst:85 -#, fuzzy msgid "" "On failure, they set ``*result`` to ``0`` and return ``-1``, *without* " "setting an exception. To get the cause of the error, :term:`attach `\\ 一個 :term:`thread state`," +"並呼叫常規(非 ``Raw``)函式。請注意,常規函式可能會在 ``Raw`` 的函式失敗後成功。" #: ../../c-api/time.rst:92 -#, fuzzy msgid "" "Similar to :c:func:`PyTime_Monotonic`, but don't set an exception on error " "and don't require an :term:`attached thread state`." msgstr "" -"類似於 :c:func:`PyTime_Monotonic`,但不會在出錯時設定例外,也不需要持有 GIL。" +"類似於 :c:func:`PyTime_Monotonic`,但不會在錯誤時設定例外,也不需要擁有 :term:`attached thread state`。" #: ../../c-api/time.rst:97 -#, fuzzy msgid "" "Similar to :c:func:`PyTime_PerfCounter`, but don't set an exception on error " "and don't require an :term:`attached thread state`." msgstr "" -"類似於 :c:func:`PyTime_PerfCounter`,但不會在出錯時設定例外,也不需要持有 " -"GIL。" +"類似於 :c:func:`PyTime_PerfCounter`,但不會在錯誤時設定例外,也不需要擁有 :term:`attached thread state`。" #: ../../c-api/time.rst:102 -#, fuzzy msgid "" "Similar to :c:func:`PyTime_Time`, but don't set an exception on error and " "don't require an :term:`attached thread state`." msgstr "" -"類似於 :c:func:`PyTime_Time`,但不會在出錯時設定例外,也不需要持有 GIL。" +"類似於 :c:func:`PyTime_Time`,但不會在錯誤時設定例外,也不需要擁有 :term:`attached thread state`。" #: ../../c-api/time.rst:107 msgid "Conversion functions" diff --git a/c-api/tuple.po b/c-api/tuple.po index 070a3ed7de3..83d9284a8e8 100644 --- a/c-api/tuple.po +++ b/c-api/tuple.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/c-api/type.po b/c-api/type.po index 949784ee9e7..a3c70ae54df 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" @@ -345,23 +345,23 @@ msgstr "" #: ../../c-api/type.rst:298 msgid "If not found, set *\\*result* to ``NULL`` and return ``0``." -msgstr "" +msgstr "如果沒找到,則將 *\\*result* 設為 ``NULL`` 並回傳 ``0``。" #: ../../c-api/type.rst:299 msgid "" "On error, set *\\*result* to ``NULL`` and return ``-1`` with an exception " "set." -msgstr "" +msgstr "在發生錯誤時,將 *\\*result* 設為 ``NULL`` 並回傳 ``-1``,同時設定例外。" #: ../../c-api/type.rst:302 msgid "" "The *result* argument may be ``NULL``, in which case *\\*result* is not set. " "Use this if you need only the return value." -msgstr "" +msgstr "如果 *result* 引數為 ``NULL``,則不會設定 *\\*result*。如果你只需要回傳值,請使用此選項。" #: ../../c-api/type.rst:305 msgid "The *token* argument may not be ``NULL``." -msgstr "" +msgstr "*token* 引數不可為 ``NULL``。" #: ../../c-api/type.rst:311 msgid "Attempt to assign a version tag to the given type." diff --git a/c-api/typehints.po b/c-api/typehints.po index 3e3361c14e5..113e15ecbc4 100644 --- a/c-api/typehints.po +++ b/c-api/typehints.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-10-16 16:16+0800\n" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index a95f2923a2e..a77ed49a211 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" @@ -1105,7 +1105,6 @@ msgid ":c:func:`getbufferproc`" msgstr ":c:func:`getbufferproc`" #: ../../c-api/typeobj.rst:328 -#, fuzzy msgid "__buffer__" msgstr "__buffer__" @@ -1301,9 +1300,8 @@ msgid "" msgstr "" #: ../../c-api/typeobj.rst:495 -#, fuzzy msgid ":c:member:`PyObject.ob_refcnt`" -msgstr ":c:member:`~PyTypeObject.tp_repr`" +msgstr ":c:member:`PyObject.ob_refcnt`" #: ../../c-api/typeobj.rst:497 msgid "" @@ -1356,9 +1354,8 @@ msgid "This field is not inherited by subtypes." msgstr "" #: ../../c-api/typeobj.rst:509 -#, fuzzy msgid ":c:member:`PyObject.ob_type`" -msgstr ":c:member:`~PyTypeObject.tp_new`" +msgstr ":c:member:`PyObject.ob_type`" #: ../../c-api/typeobj.rst:511 msgid "" @@ -1399,9 +1396,8 @@ msgid "PyVarObject Slots" msgstr "" #: ../../c-api/typeobj.rst:535 -#, fuzzy msgid ":c:member:`PyVarObject.ob_size`" -msgstr ":c:member:`~PyTypeObject.tp_itemsize`" +msgstr ":c:member:`PyVarObject.ob_size`" #: ../../c-api/typeobj.rst:537 msgid "" @@ -1695,7 +1691,6 @@ msgid "" msgstr "" #: ../../c-api/typeobj.rst:740 -#, fuzzy msgid "" "static void\n" "foo_dealloc(PyObject *op)\n" @@ -1706,10 +1701,13 @@ msgid "" " Py_TYPE(self)->tp_free(self);\n" "}" msgstr "" -"static void foo_dealloc(foo_object *self) {\n" -" PyObject_GC_UnTrack(self);\n" -" Py_CLEAR(self->ref);\n" -" Py_TYPE(self)->tp_free((PyObject *)self);\n" +"static void\n" +"foo_dealloc(PyObject *op)\n" +"{\n" +" foo_object *self = (foo_object *) op;\n" +" PyObject_GC_UnTrack(self);\n" +" Py_CLEAR(self->ref);\n" +" Py_TYPE(self)->tp_free(self);\n" "}" #: ../../c-api/typeobj.rst:749 @@ -1721,9 +1719,8 @@ msgid "" msgstr "" #: ../../c-api/typeobj.rst:754 -#, fuzzy msgid "Example::" -msgstr "範例" +msgstr "範例: ::" #: ../../c-api/typeobj.rst:756 msgid "" @@ -2568,7 +2565,6 @@ msgid "" msgstr "" #: ../../c-api/typeobj.rst:1488 -#, fuzzy msgid "" "static int\n" "local_traverse(PyObject *op, visitproc visit, void *arg)\n" @@ -2581,8 +2577,9 @@ msgid "" "}" msgstr "" "static int\n" -"local_traverse(localobject *self, visitproc visit, void *arg)\n" +"local_traverse(PyObject *op, visitproc visit, void *arg)\n" "{\n" +" localobject *self = (localobject *) op;\n" " Py_VISIT(self->args);\n" " Py_VISIT(self->kw);\n" " Py_VISIT(self->dict);\n" @@ -2671,11 +2668,10 @@ msgid "" msgstr "" #: ../../c-api/typeobj.rst:1548 -#, fuzzy msgid "" "The :c:member:`~PyTypeObject.tp_traverse` function can be called from any " "thread." -msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" +msgstr ":c:member:`~PyTypeObject.tp_traverse` 函式可以從任何執行緒呼叫。" #: ../../c-api/typeobj.rst:1553 msgid "" @@ -2741,11 +2737,10 @@ msgid "" msgstr "" #: ../../c-api/typeobj.rst:1603 -#, fuzzy msgid "" "The :c:member:`~PyTypeObject.tp_clear` function can be called from any " "thread." -msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" +msgstr ":c:member:`~PyTypeObject.tp_clear` 函式可以從任何執行緒呼叫。" #: ../../c-api/typeobj.rst:1608 msgid "" @@ -2859,7 +2854,6 @@ msgid "" msgstr "" #: ../../c-api/typeobj.rst:1670 -#, fuzzy msgid "" "static int\n" "local_clear(PyObject *op)\n" @@ -2873,8 +2867,9 @@ msgid "" "}" msgstr "" "static int\n" -"local_clear(localobject *self)\n" +"local_clear(PyObject *op)\n" "{\n" +" localobject *self = (localobject *) op;\n" " Py_CLEAR(self->key);\n" " Py_CLEAR(self->args);\n" " Py_CLEAR(self->kw);\n" @@ -3844,13 +3839,12 @@ msgid ":pep:`442`: \"Safe object finalization\"" msgstr "" #: ../../c-api/typeobj.rst:2448 -#, fuzzy msgid ":c:func:`PyObject_CallFinalizer`" -msgstr ":c:member:`~PyTypeObject.tp_finalize`" +msgstr ":c:func:`PyObject_CallFinalizer`" #: ../../c-api/typeobj.rst:2449 msgid ":c:func:`PyObject_CallFinalizerFromDealloc`" -msgstr "" +msgstr ":c:func:`PyObject_CallFinalizerFromDealloc`" #: ../../c-api/typeobj.rst:2454 msgid "" @@ -4385,7 +4379,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2895 msgid "PyObject *am_await(PyObject *self);" -msgstr "" +msgstr "PyObject *am_await(PyObject *self);" #: ../../c-api/typeobj.rst:2897 msgid "" @@ -4555,6 +4549,20 @@ msgid "" " .tp_repr = (reprfunc)myobj_repr,\n" "};" msgstr "" +"typedef struct {\n" +" PyObject_HEAD\n" +" const char *data;\n" +"} MyObject;\n" +"\n" +"static PyTypeObject MyObject_Type = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"mymod.MyObject\",\n" +" .tp_basicsize = sizeof(MyObject),\n" +" .tp_doc = PyDoc_STR(\"My objects\"),\n" +" .tp_new = myobj_new,\n" +" .tp_dealloc = (destructor)myobj_dealloc,\n" +" .tp_repr = (reprfunc)myobj_repr,\n" +"};" #: ../../c-api/typeobj.rst:3072 msgid "" diff --git a/c-api/unicode.po b/c-api/unicode.po index 31444c21c29..6a742dde0bd 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Liang-Bo Wang , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" @@ -362,9 +361,8 @@ msgid "" msgstr "" #: ../../c-api/unicode.rst:337 -#, fuzzy msgid "must not be hashed," -msgstr "*sep* 不得為空。" +msgstr "" #: ../../c-api/unicode.rst:338 msgid "" @@ -903,9 +901,8 @@ msgid "" msgstr "" #: ../../c-api/unicode.rst:637 -#, fuzzy msgid "On error, set *\\*p_left* to ``NULL`` and set an exception." -msgstr "於錯誤發生時回傳 ``NULL`` 並設定例外。" +msgstr "於錯誤發生時,將 *\\*p_left* 設為 ``NULL`` 並設定例外。" #: ../../c-api/unicode.rst:639 msgid "On success, set *\\*p_left* to a new strong reference to the result." @@ -1004,11 +1001,10 @@ msgid "" msgstr "" #: ../../c-api/unicode.rst:730 -#, fuzzy msgid "" "Write a *character* to the string *unicode* at the zero-based *index*. " "Return ``0`` on success, ``-1`` on error with an exception set." -msgstr "成功時回傳 ``0``,發生錯誤時設定例外並回傳 ``-1``。" +msgstr "" #: ../../c-api/unicode.rst:733 msgid "" @@ -1959,21 +1955,20 @@ msgid "" msgstr "" #: ../../c-api/unicode.rst:1601 -#, fuzzy msgid "The :c:func:`PyUnicode_Equal` function." -msgstr ":c:func:`Py_EncodeLocale` 函式。" +msgstr ":c:func:`PyUnicode_Equal` 函式。" #: ../../c-api/unicode.rst:1606 msgid "Test if two strings are equal:" -msgstr "" +msgstr "測試兩個字串是否相等:" #: ../../c-api/unicode.rst:1608 msgid "Return ``1`` if *a* is equal to *b*." -msgstr "" +msgstr "如果 *a* 等於 *b*,則回傳 ``1``。" #: ../../c-api/unicode.rst:1609 msgid "Return ``0`` if *a* is not equal to *b*." -msgstr "" +msgstr "如果 *a* 不等於 *b*,則回傳 ``0``。" #: ../../c-api/unicode.rst:1610 msgid "" @@ -1992,9 +1987,8 @@ msgid "" msgstr "" #: ../../c-api/unicode.rst:1620 -#, fuzzy msgid "The :c:func:`PyUnicode_Compare` function." -msgstr ":c:func:`Py_EncodeLocale` 函式。" +msgstr ":c:func:`PyUnicode_Compare` 函式。" #: ../../c-api/unicode.rst:1627 msgid "" @@ -2143,7 +2137,7 @@ msgstr "" #: ../../c-api/unicode.rst:1741 msgid "PyUnicodeWriter" -msgstr "" +msgstr "PyUnicodeWriter" #: ../../c-api/unicode.rst:1743 msgid "" @@ -2152,9 +2146,8 @@ msgid "" msgstr "" #: ../../c-api/unicode.rst:1750 -#, fuzzy msgid "A Unicode writer instance." -msgstr "一個 Unicode 物件。" +msgstr "一個 Unicode 寫入器實例。" #: ../../c-api/unicode.rst:1752 msgid "" @@ -2177,9 +2170,8 @@ msgid "" msgstr "" #: ../../c-api/unicode.rst:1764 ../../c-api/unicode.rst:1770 -#, fuzzy msgid "Set an exception and return ``NULL`` on error." -msgstr "發生錯誤時,設定例外並回傳 ``-1``。" +msgstr "發生錯誤時,設定例外並回傳 ``NULL``。" #: ../../c-api/unicode.rst:1768 msgid "" @@ -2207,11 +2199,10 @@ msgstr "" #: ../../c-api/unicode.rst:1832 ../../c-api/unicode.rst:1839 #: ../../c-api/unicode.rst:1846 ../../c-api/unicode.rst:1857 #: ../../c-api/unicode.rst:1864 ../../c-api/unicode.rst:1883 -#, fuzzy msgid "" "On success, return ``0``. On error, set an exception, leave the writer " "unchanged, and return ``-1``." -msgstr "發生錯誤時,設定例外並回傳 ``-1``。" +msgstr "成功時回傳 ``0``,發生錯誤時設定例外、保持寫入器不變,並回傳 ``-1``。" #: ../../c-api/unicode.rst:1791 msgid "" @@ -2228,7 +2219,7 @@ msgstr "" #: ../../c-api/unicode.rst:1799 msgid "See also :c:func:`PyUnicodeWriter_DecodeUTF8Stateful`." -msgstr "" +msgstr "另請參閱 :c:func:`PyUnicodeWriter_DecodeUTF8Stateful`。" #: ../../c-api/unicode.rst:1803 msgid "Write the ASCII string *str* into *writer*." @@ -2280,13 +2271,11 @@ msgid "" msgstr "" #: ../../c-api/unicode.rst:1862 -#, fuzzy msgid "" "Similar to :c:func:`PyUnicode_FromFormat`, but write the output directly " "into *writer*." msgstr "" -"類似於 :c:func:`PyUnicode_DecodeLocaleAndSize`,但使用 :c:func:`!strlen` 計算" -"字串長度。" +"類似於 :c:func:`PyUnicode_FromFormat`,但是直接將輸出寫入 *writer*。" #: ../../c-api/unicode.rst:1869 msgid "" @@ -2309,15 +2298,15 @@ msgstr "" #: ../../c-api/unicode.rst:1886 msgid "See also :c:func:`PyUnicodeWriter_WriteUTF8`." -msgstr "" +msgstr "另請參閱 :c:func:`PyUnicodeWriter_WriteUTF8`。" #: ../../c-api/unicode.rst:1889 msgid "Deprecated API" -msgstr "" +msgstr "已棄用的 API" #: ../../c-api/unicode.rst:1891 msgid "The following API is deprecated." -msgstr "" +msgstr "以下 API 已棄用。" #: ../../c-api/unicode.rst:1895 msgid "" @@ -2334,11 +2323,10 @@ msgid "" msgstr "" #: ../../c-api/unicode.rst:1909 -#, fuzzy msgid "" "Do nothing and return ``0``. This API is kept only for backward " "compatibility, but there are no plans to remove it." -msgstr "回傳 ``0``。此 API 僅保留以維持向後相容性。" +msgstr "" #: ../../c-api/unicode.rst:1915 msgid "" @@ -2348,17 +2336,13 @@ msgid "" msgstr "" #: ../../c-api/unicode.rst:1923 -#, fuzzy msgid "" "Do nothing and return ``1``. This API is kept only for backward " "compatibility, but there are no plans to remove it." -msgstr "回傳 ``0``。此 API 僅保留以維持向後相容性。" +msgstr "" #: ../../c-api/unicode.rst:1929 msgid "" "This API does nothing since Python 3.12. Previously, this could be called to " "check if :c:func:`PyUnicode_READY` is necessary." msgstr "" - -#~ msgid "This API does nothing since Python 3.12." -#~ msgstr "自 Python 3.12 起,此 API 不再執行任何動作。" diff --git a/c-api/utilities.po b/c-api/utilities.po index 4775a245ec9..4510d3cca32 100644 --- a/c-api/utilities.po +++ b/c-api/utilities.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-01-31 17:38+0800\n" diff --git a/c-api/veryhigh.po b/c-api/veryhigh.po index 4901187f50d..2deb1dabda2 100644 --- a/c-api/veryhigh.po +++ b/c-api/veryhigh.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-03 00:19+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" diff --git a/c-api/weakref.po b/c-api/weakref.po index 441c3b57644..8f12902575b 100644 --- a/c-api/weakref.po +++ b/c-api/weakref.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/contents.po b/contents.po index 3312166d6f2..c7d37814e74 100644 --- a/contents.po +++ b/contents.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/copyright.po b/copyright.po index 446dbefebfa..b19aacbaaf3 100644 --- a/copyright.po +++ b/copyright.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -9,7 +8,7 @@ # meowmeowcat , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2021-06-25 20:17+0800\n" @@ -32,26 +31,25 @@ msgid "Python and this documentation is:" msgstr "Python 和這份說明文件的版權:" #: ../../copyright.rst:7 -#, fuzzy msgid "Copyright © 2001 Python Software Foundation. All rights reserved." -msgstr "Copyright © 2001-2024 Python Software Foundation. All rights reserved." +msgstr "Copyright © 2001 Python 軟體基金會。保留所有權利。" #: ../../copyright.rst:9 msgid "Copyright © 2000 BeOpen.com. All rights reserved." -msgstr "Copyright © 2000 BeOpen.com 保留一切權利。" +msgstr "Copyright © 2000 BeOpen.com 保留所有權利。" #: ../../copyright.rst:11 msgid "" "Copyright © 1995-2000 Corporation for National Research Initiatives. All " "rights reserved." msgstr "" -"Copyright © 1995-2000 Corporation for National Research Initiatives 保留一切" +"Copyright © 1995-2000 Corporation for National Research Initiatives 保留所有" "權利。" #: ../../copyright.rst:14 msgid "" "Copyright © 1991-1995 Stichting Mathematisch Centrum. All rights reserved." -msgstr "Copyright © 1991-1995 Stichting Mathematisch Centrum 保留一切權利。" +msgstr "Copyright © 1991-1995 Stichting Mathematisch Centrum 保留所有權利。" #: ../../copyright.rst:18 msgid "" diff --git a/deprecations/c-api-pending-removal-in-3.14.po b/deprecations/c-api-pending-removal-in-3.14.po index 795792b32c0..8a9ae15c7ce 100644 --- a/deprecations/c-api-pending-removal-in-3.14.po +++ b/deprecations/c-api-pending-removal-in-3.14.po @@ -1,9 +1,9 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -16,7 +16,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 -#, fuzzy msgid "Pending removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" @@ -35,155 +34,3 @@ msgid "" msgstr "" "使用可變基底建立\\ :c:data:`不可變型別 ` " "(:gh:`95388`)。" - -#~ msgid "" -#~ "Functions to configure Python's initialization, deprecated in Python 3.11:" -#~ msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" - -#~ msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." -#~ msgstr "" -#~ ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" - -#~ msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." -#~ msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" - -#~ msgid "" -#~ ":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " -#~ "instead." -#~ msgstr "" -#~ ":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` " -#~ "設定。" - -#~ msgid "" -#~ ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." -#~ msgstr "" -#~ ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" - -#~ msgid "" -#~ "The :c:func:`Py_InitializeFromConfig` API should be used " -#~ "with :c:type:`PyConfig` instead." -#~ msgstr "" -#~ ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" - -#~ msgid "Global configuration variables:" -#~ msgstr "全域設定變數:" - -#~ msgid "" -#~ ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` instead." -#~ msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" - -#~ msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` instead." -#~ msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" - -#~ msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` instead." -#~ msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" - -#~ msgid "" -#~ ":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` instead." -#~ msgstr "" -#~ ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" - -#~ msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` instead." -#~ msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" - -#~ msgid "" -#~ ":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " -#~ "instead." -#~ msgstr "" -#~ ":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" - -#~ msgid "" -#~ ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` instead." -#~ msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" - -#~ msgid "" -#~ ":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " -#~ "instead." -#~ msgstr "" -#~ ":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" - -#~ msgid "" -#~ ":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " -#~ "instead." -#~ msgstr "" -#~ ":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" - -#~ msgid "" -#~ ":c:var:`Py_IgnoreEnvironmentFlag`: " -#~ "Use :c:member:`PyConfig.use_environment` instead." -#~ msgstr "" -#~ ":c:var:`Py_IgnoreEnvironmentFlag`:請改" -#~ "用 :c:member:`PyConfig.use_environment`。" - -#~ msgid "" -#~ ":c:var:`Py_DontWriteBytecodeFlag`: " -#~ "Use :c:member:`PyConfig.write_bytecode` instead." -#~ msgstr "" -#~ ":c:var:`Py_DontWriteBytecodeFlag`:請改" -#~ "用 :c:member:`PyConfig.write_bytecode`。" - -#~ msgid "" -#~ ":c:var:`Py_NoUserSiteDirectory`: " -#~ "Use :c:member:`PyConfig.user_site_directory` instead." -#~ msgstr "" -#~ ":c:var:`Py_NoUserSiteDirectory`:請改" -#~ "用 :c:member:`PyConfig.user_site_directory`。" - -#~ msgid "" -#~ ":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " -#~ "instead." -#~ msgstr "" -#~ ":c:var:`Py_UnbufferedStdioFlag`:請改" -#~ "用 :c:member:`PyConfig.buffered_stdio`。" - -#~ msgid "" -#~ ":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " -#~ "and :c:member:`PyConfig.hash_seed` instead." -#~ msgstr "" -#~ ":c:var:`Py_HashRandomizationFlag`:請改" -#~ "用 :c:member:`PyConfig.use_hash_seed` 和 :c:member:`PyConfig.hash_seed`。" - -#~ msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` instead." -#~ msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" - -#~ msgid "" -#~ ":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -#~ "Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` instead." -#~ msgstr "" -#~ ":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -#~ "用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" - -#~ msgid "" -#~ ":c:var:`Py_LegacyWindowsStdioFlag`: " -#~ "Use :c:member:`PyConfig.legacy_windows_stdio` instead." -#~ msgstr "" -#~ ":c:var:`Py_LegacyWindowsStdioFlag`:請改" -#~ "用 :c:member:`PyConfig.legacy_windows_stdio`。" - -#~ msgid "" -#~ ":c:var:`!Py_FileSystemDefaultEncoding`: " -#~ "Use :c:member:`PyConfig.filesystem_encoding` instead." -#~ msgstr "" -#~ ":c:var:`!Py_FileSystemDefaultEncoding`:請改" -#~ "用 :c:member:`PyConfig.filesystem_encoding`。" - -#~ msgid "" -#~ ":c:var:`!Py_HasFileSystemDefaultEncoding`: " -#~ "Use :c:member:`PyConfig.filesystem_encoding` instead." -#~ msgstr "" -#~ ":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" -#~ "用 :c:member:`PyConfig.filesystem_encoding`。" - -#~ msgid "" -#~ ":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -#~ "Use :c:member:`PyConfig.filesystem_errors` instead." -#~ msgstr "" -#~ ":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -#~ "用 :c:member:`PyConfig.filesystem_errors`。" - -#~ msgid "" -#~ ":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. " -#~ "(see :c:func:`Py_PreInitialize`)" -#~ msgstr "" -#~ ":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" -#~ "見 :c:func:`Py_PreInitialize`)" diff --git a/deprecations/c-api-pending-removal-in-3.15.po b/deprecations/c-api-pending-removal-in-3.15.po index 39e99973edc..34f2be4674d 100644 --- a/deprecations/c-api-pending-removal-in-3.15.po +++ b/deprecations/c-api-pending-removal-in-3.15.po @@ -1,9 +1,9 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -16,7 +16,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:2 -#, fuzzy msgid "Pending removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" @@ -35,6 +34,10 @@ msgid "" "`__ can be used to " "get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." msgstr "" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" +"用 :c:func:`PyWeakref_GetRef`。可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.12 和更早版本取" +"得 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 msgid "" @@ -45,12 +48,10 @@ msgstr "" "用 :c:type:`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 -#, fuzzy msgid "" ":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改" -"用 :c:func:`PyImport_ImportModule`。" +":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 msgid "" @@ -58,14 +59,15 @@ msgid "" "Note that some codecs (for example, \"base64\") may return a type other " "than :class:`str`, such as :class:`bytes`." msgstr "" +":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`;請注" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`str` 的型別,例" +"如 :class:`bytes`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 -#, fuzzy msgid "" ":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改" -"用 :c:func:`PyImport_ImportModule`。" +":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 msgid "" @@ -73,18 +75,21 @@ msgid "" "Note that some codecs (for example, \"base64\") may return a type other " "than :class:`bytes`, such as :class:`str`." msgstr "" +":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`;請注" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`bytes` 的型別,例" +"如 :class:`str`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 -#, fuzzy msgid "Python initialization functions, deprecated in Python 3.13:" -msgstr "Python 初始化函式:" +msgstr "Python 初始化函式,自 Python 3.13 起已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:24 -#, fuzzy msgid "" ":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " "` (:data:`sys.path`) instead." -msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" +msgstr "" +":c:func:`Py_GetPath`:請改用 :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:27 msgid "" @@ -93,6 +98,10 @@ msgid "" "Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) " "if :ref:`virtual environments ` need to be handled." msgstr "" +":c:func:`Py_GetPrefix`:請改用 :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`)。如果需要處理\\ :ref:`虛擬環境 " +"`,請改用 :c:func:`PyConfig_Get(\"prefix\") ` " +"(:data:`sys.prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:32 msgid "" @@ -102,64 +111,68 @@ msgid "" "(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " "be handled." msgstr "" +":c:func:`Py_GetExecPrefix`:請改" +"用 :c:func:`PyConfig_Get(\"base_exec_prefix\") ` " +"(:data:`sys.base_exec_prefix`)。如果需要處理\\ :ref:`虛擬環境 `,請" +"改用 :c:func:`PyConfig_Get(\"exec_prefix\") ` " +"(:data:`sys.exec_prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:38 -#, fuzzy msgid "" ":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." -msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" +msgstr "" +":c:func:`Py_GetProgramFullPath`:請改" +"用 :c:func:`PyConfig_Get(\"executable\") ` " +"(:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:41 -#, fuzzy msgid "" ":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." -msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" +msgstr "" +":c:func:`Py_GetProgramName`:請改用 :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:44 -#, fuzzy msgid "" ":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " "` or the :envvar:`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " -"或 :envvar:`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:func:`PyConfig_Get(\"home\") " +"` 或 :envvar:`PYTHONHOME` 環境變數。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:48 msgid "" "The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." msgstr "" +"`pythoncapi-compat 專案 `__ 可" +"以用來為 Python 3.13 和更早版本取得 :c:func:`PyConfig_Get`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:52 msgid "" "Functions to configure Python's initialization, deprecated in Python 3.11:" -msgstr "" +msgstr "用於配置 Python 初始化的函式,自 Python 3.11 起已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:54 -#, fuzzy msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." -msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" +msgstr ":c:func:`!PySys_SetArgvEx()`:請改用 :c:member:`PyConfig.argv`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:56 -#, fuzzy msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." -msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" +msgstr ":c:func:`!PySys_SetArgv()`:請改用 :c:member:`PyConfig.argv`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:58 -#, fuzzy msgid "" ":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " "instead." -msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" +msgstr "" +":c:func:`!Py_SetProgramName()`:請改用 :c:member:`PyConfig.program_name`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:60 -#, fuzzy msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." -msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " -"或 :envvar:`PYTHONHOME` 環境變數。" +msgstr ":c:func:`!Py_SetPythonHome()`:請改用 :c:member:`PyConfig.home`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:62 msgid "" @@ -174,76 +187,101 @@ msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used " "with :c:type:`PyConfig` instead." msgstr "" +"應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:68 msgid "Global configuration variables:" -msgstr "" +msgstr "全域配置變數:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:70 msgid "" ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` " "or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." msgstr "" +":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug` " +"或 :c:func:`PyConfig_Get(\"parser_debug\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:73 msgid "" ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` " "or :c:func:`PyConfig_Get(\"verbose\") ` instead." msgstr "" +":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose` " +"或 :c:func:`PyConfig_Get(\"verbose\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:76 msgid "" ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` " "or :c:func:`PyConfig_Get(\"quiet\") ` instead." msgstr "" +":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet` " +"或 :c:func:`PyConfig_Get(\"quiet\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:79 msgid "" ":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` " "or :c:func:`PyConfig_Get(\"interactive\") ` instead." msgstr "" +":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive` " +"或 :c:func:`PyConfig_Get(\"interactive\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:82 msgid "" ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` " "or :c:func:`PyConfig_Get(\"inspect\") ` instead." msgstr "" +":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect` " +"或 :c:func:`PyConfig_Get(\"inspect\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:85 msgid "" ":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " "or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." msgstr "" +":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level` " +"或 :c:func:`PyConfig_Get(\"optimization_level\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:88 msgid "" ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` " "or :c:func:`PyConfig_Get(\"site_import\") ` instead." msgstr "" +":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import` " +"或 :c:func:`PyConfig_Get(\"site_import\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:91 msgid "" ":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " "or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." msgstr "" +":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning` " +"或 :c:func:`PyConfig_Get(\"bytes_warning\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:94 msgid "" ":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " "or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" +":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings` " +"或 :c:func:`PyConfig_Get(\"pathconfig_warnings\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:97 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "or :c:func:`PyConfig_Get(\"use_environment\") ` instead." msgstr "" +":c:var:`Py_IgnoreEnvironmentFlag`:請改" +"用 :c:member:`PyConfig.use_environment` " +"或 :c:func:`PyConfig_Get(\"use_environment\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:100 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." msgstr "" +":c:var:`Py_DontWriteBytecodeFlag`:請改" +"用 :c:member:`PyConfig.write_bytecode` " +"或 :c:func:`PyConfig_Get(\"write_bytecode\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:103 msgid "" @@ -251,12 +289,17 @@ msgid "" "Use :c:member:`PyConfig.user_site_directory` " "or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." msgstr "" +":c:var:`Py_NoUserSiteDirectory`:請改" +"用 :c:member:`PyConfig.user_site_directory` " +"或 :c:func:`PyConfig_Get(\"user_site_directory\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:106 msgid "" ":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " "or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." msgstr "" +":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio` " +"或 :c:func:`PyConfig_Get(\"buffered_stdio\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:109 msgid "" @@ -264,12 +307,17 @@ msgid "" "and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " "` instead." msgstr "" +":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " +"和 :c:member:`PyConfig.hash_seed` 或 :c:func:`PyConfig_Get(\"hash_seed\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:113 msgid "" ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` " "or :c:func:`PyConfig_Get(\"isolated\") ` instead." msgstr "" +":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated` " +"或 :c:func:`PyConfig_Get(\"isolated\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:116 msgid "" @@ -278,6 +326,9 @@ msgid "" "or :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") ` " "instead." msgstr "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" +"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding` " +"或 :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:119 msgid "" @@ -285,6 +336,9 @@ msgid "" "Use :c:member:`PyConfig.legacy_windows_stdio` " "or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." msgstr "" +":c:var:`Py_LegacyWindowsStdioFlag`:請改" +"用 :c:member:`PyConfig.legacy_windows_stdio` " +"或 :c:func:`PyConfig_Get(\"legacy_windows_stdio\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:122 msgid "" @@ -293,6 +347,10 @@ msgid "" "Use :c:member:`PyConfig.filesystem_encoding` " "or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." msgstr "" +":c:var:`!Py_FileSystemDefaultEncoding`、:c:var:`!" +"Py_HasFileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding` " +"或 :c:func:`PyConfig_Get(\"filesystem_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:125 msgid "" @@ -300,6 +358,9 @@ msgid "" "Use :c:member:`PyConfig.filesystem_errors` " "or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." msgstr "" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" +"用 :c:member:`PyConfig.filesystem_errors` " +"或 :c:func:`PyConfig_Get(\"filesystem_errors\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:128 msgid "" @@ -307,6 +368,9 @@ msgid "" "or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. " "(see :c:func:`Py_PreInitialize`)" msgstr "" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode` " +"或 :c:func:`PyConfig_Get(\"utf8_mode\") `。(請參" +"閱 :c:func:`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:133 msgid "" @@ -314,24 +378,5 @@ msgid "" "with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can " "be used to get these options at runtime." msgstr "" - -#~ msgid "" -#~ ":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " -#~ "Use :c:func:`PyWeakref_GetRef` instead." -#~ msgstr "" -#~ ":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" -#~ "用 :c:func:`PyWeakref_GetRef`。" - -#~ msgid "" -#~ ":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " -#~ "and :data:`sys.exec_prefix` instead." -#~ msgstr "" -#~ ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " -#~ "與 :data:`sys.exec_prefix`。" - -#~ msgid "" -#~ ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` " -#~ "and :data:`sys.prefix` instead." -#~ msgstr "" -#~ ":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " -#~ "與 :data:`sys.prefix`。" +"應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API 來設定" +"這些選項。或者也可以使用 :c:func:`PyConfig_Get` 在執行時取得這些選項。" diff --git a/deprecations/c-api-pending-removal-in-3.16.po b/deprecations/c-api-pending-removal-in-3.16.po index adc146223cf..f6d770d35a4 100644 --- a/deprecations/c-api-pending-removal-in-3.16.po +++ b/deprecations/c-api-pending-removal-in-3.16.po @@ -1,9 +1,9 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-03 00:17+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/deprecations/c-api-pending-removal-in-3.18.po b/deprecations/c-api-pending-removal-in-3.18.po index 686c89004ab..f4c5782835a 100644 --- a/deprecations/c-api-pending-removal-in-3.18.po +++ b/deprecations/c-api-pending-removal-in-3.18.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -19,51 +18,59 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:2 msgid "Pending removal in Python 3.18" -msgstr "" +msgstr "Python 3.18 中待移除的項目" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:4 msgid "Deprecated private functions (:gh:`128863`):" -msgstr "" +msgstr "被棄用的私有函式 (:gh:`128863`):" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:6 msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." -msgstr "" +msgstr ":c:func:`!_PyBytes_Join`:請改用 :c:func:`PyBytes_Join`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 msgid "" ":c:func:`!_PyDict_GetItemStringWithError`: " "use :c:func:`PyDict_GetItemStringRef`." msgstr "" +":c:func:`!_PyDict_GetItemStringWithError`:請改" +"用 :c:func:`PyDict_GetItemStringRef`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 msgid ":c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`." -msgstr "" +msgstr ":c:func:`!_PyDict_Pop()`:請改用 :c:func:`PyDict_Pop`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." -msgstr "" +msgstr ":c:func:`!_PyLong_Sign()`:請改用 :c:func:`PyLong_GetSign`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 msgid "" ":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: " "use :c:func:`PyLongWriter_Create`." msgstr "" +":c:func:`!_PyLong_FromDigits` 和 :c:func:`!_PyLong_New`:請改" +"用 :c:func:`PyLongWriter_Create`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:12 msgid "" ":c:func:`!_PyThreadState_UncheckedGet`: " "use :c:func:`PyThreadState_GetUnchecked`." msgstr "" +":c:func:`!_PyThreadState_UncheckedGet`:請改" +"用 :c:func:`PyThreadState_GetUnchecked`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." -msgstr "" +msgstr ":c:func:`!_PyUnicode_AsString`:請改用 :c:func:`PyUnicode_AsUTF8`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 msgid "" ":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " "with :c:func:`writer = PyUnicodeWriter_Create(0) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Init`:將 ``_PyUnicodeWriter_Init(&writer)`` 替換" +"為 :c:func:`writer = PyUnicodeWriter_Create(0) `。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:17 msgid "" @@ -71,6 +78,8 @@ msgid "" "``_PyUnicodeWriter_Finish(&writer)`` " "with :c:func:`PyUnicodeWriter_Finish(writer) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Finish`:將 ``_PyUnicodeWriter_Finish(&writer)`` " +"替換為 :c:func:`PyUnicodeWriter_Finish(writer) `。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:20 msgid "" @@ -78,6 +87,9 @@ msgid "" "``_PyUnicodeWriter_Dealloc(&writer)`` " "with :c:func:`PyUnicodeWriter_Discard(writer) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Dealloc`:將 " +"``_PyUnicodeWriter_Dealloc(&writer)`` 替換" +"為 :c:func:`PyUnicodeWriter_Discard(writer) `。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:23 msgid "" @@ -86,6 +98,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteChar`:將 " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:26 msgid "" @@ -94,6 +110,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteStr(writer, str) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteStr`:將 " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteStr(writer, str) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:29 msgid "" @@ -102,6 +122,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`:將 " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:32 msgid "" @@ -110,6 +134,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteASCIIString`:將 " +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:35 msgid "" @@ -118,25 +146,31 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteLatin1String`:將 " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:38 msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." -msgstr "" +msgstr ":c:func:`!_PyUnicodeWriter_Prepare`:(無替代方案)。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." -msgstr "" +msgstr ":c:func:`!_PyUnicodeWriter_PrepareKind`:(無替代方案)。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." -msgstr "" +msgstr ":c:func:`!_Py_HashPointer`:請改用 :c:func:`Py_HashPointer`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." -msgstr "" +msgstr ":c:func:`!_Py_fopen_obj`:請改用 :c:func:`Py_fopen`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:43 msgid "" "The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older." msgstr "" +"可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.13 及更早版本取得這些新的公開函式。" diff --git a/deprecations/c-api-pending-removal-in-future.po b/deprecations/c-api-pending-removal-in-future.po index f1cab235508..59952a6fbec 100644 --- a/deprecations/c-api-pending-removal-in-future.po +++ b/deprecations/c-api-pending-removal-in-future.po @@ -1,9 +1,9 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -16,7 +16,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/c-api-pending-removal-in-future.rst:2 -#, fuzzy msgid "Pending removal in future versions" msgstr "未來版本中的待移除項目" @@ -122,30 +121,3 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-future.rst:41 msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" - -#~ msgid "" -#~ ":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` " -#~ "instead." -#~ msgstr "" -#~ ":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" - -#~ msgid "" -#~ ":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` " -#~ "instead." -#~ msgstr "" -#~ ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" - -#~ msgid "" -#~ ":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` " -#~ "instead." -#~ msgstr "" -#~ ":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" - -#~ msgid "" -#~ ":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` " -#~ "instead." -#~ msgstr "" -#~ ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" - -#~ msgid ":c:member:`!PyDictObject.ma_version_tag` member." -#~ msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" diff --git a/deprecations/index.po b/deprecations/index.po index 6cc906f99d5..a8107540c4e 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -1,9 +1,9 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -21,9 +21,8 @@ msgstr "已棄用項目" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:2 #: ../../deprecations/pending-removal-in-3.15.rst:2 -#, fuzzy msgid "Pending removal in Python 3.15" -msgstr "Python 3.16 中待移除的項目" +msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:4 #: ../../deprecations/pending-removal-in-3.16.rst:4 @@ -190,7 +189,6 @@ msgid ":mod:`typing`:" msgstr ":mod:`typing`:" #: ../../deprecations/pending-removal-in-3.15.rst:82 -#, fuzzy msgid "" "The undocumented keyword argument syntax for " "creating :class:`~typing.NamedTuple` classes (for example, ``Point = " @@ -240,19 +238,18 @@ msgstr "" "和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:107 -#, fuzzy msgid ":mod:`zipimport`:" -msgstr ":mod:`importlib`:" +msgstr ":mod:`zipimport`:" #: ../../deprecations/pending-removal-in-3.15.rst:109 -#, fuzzy msgid "" ":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python " "3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " "by Jiahao Li in :gh:`125746`.)" msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" -"用 :meth:`~zipimport.zipimporter.exec_module`。" +":meth:`~zipimport.zipimporter.load_module` 自 Python 3.10 被棄用。請改" +"用 :meth:`~zipimport.zipimporter.exec_module`。(由 Jiahao Li " +"於 :gh:`125746` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" @@ -288,13 +285,12 @@ msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.16.rst:21 -#, fuzzy msgid "" ":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " "Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" -":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" +":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除;請改" "用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " "於 :gh:`122875` 貢獻。)" @@ -303,40 +299,44 @@ msgid "" ":mod:`asyncio` policy system is deprecated and will be removed in Python " "3.16. In particular, the following classes and functions are deprecated:" msgstr "" +":mod:`asyncio` 策略系統已被棄用並將在 Python 3.16 中移除。特別是以下類別和函" +"式已被棄用:" #: ../../deprecations/pending-removal-in-3.16.rst:29 msgid ":class:`asyncio.AbstractEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.AbstractEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:30 msgid ":class:`asyncio.DefaultEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.DefaultEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:31 msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.WindowsSelectorEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:32 msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.WindowsProactorEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:33 msgid ":func:`asyncio.get_event_loop_policy`" -msgstr "" +msgstr ":func:`asyncio.get_event_loop_policy`" #: ../../deprecations/pending-removal-in-3.16.rst:34 msgid ":func:`asyncio.set_event_loop_policy`" -msgstr "" +msgstr ":func:`asyncio.set_event_loop_policy`" #: ../../deprecations/pending-removal-in-3.16.rst:36 msgid "" "Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " "*loop_factory* to use the desired event loop implementation." msgstr "" +"使用者應該使用 :func:`asyncio.run` 或 :class:`asyncio.Runner` 搭配 " +"*loop_factory* 來使用所需的事件迴圈實作。" #: ../../deprecations/pending-removal-in-3.16.rst:39 msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" -msgstr "" +msgstr "例如在 Windows 上使用 :class:`asyncio.SelectorEventLoop`: ::" #: ../../deprecations/pending-removal-in-3.16.rst:41 msgid "" @@ -347,10 +347,16 @@ msgid "" "\n" "asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" msgstr "" +"import asyncio\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" #: ../../deprecations/pending-removal-in-3.16.rst:48 msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" -msgstr "" +msgstr "(由 Kumar Aditya 於 :gh:`127949` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:50 #: ../../deprecations/pending-removal-in-future.rst:16 @@ -371,9 +377,8 @@ msgstr "" "``~int(x)`` (``~int(x)``)。" #: ../../deprecations/pending-removal-in-3.16.rst:59 -#, fuzzy msgid ":mod:`functools`:" -msgstr ":mod:`ctypes`:" +msgstr ":mod:`functools`:" #: ../../deprecations/pending-removal-in-3.16.rst:61 msgid "" @@ -381,11 +386,12 @@ msgid "" "*function* or *sequence* as keyword arguments has been deprecated since " "Python 3.14." msgstr "" +"自 Python 3.14 起,使用 *function* 或 *sequence* 關鍵字引數呼" +"叫 :func:`functools.reduce` 的 Python 實作已被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:64 -#, fuzzy msgid ":mod:`logging`:" -msgstr ":mod:`typing`:" +msgstr ":mod:`logging`:" #: ../../deprecations/pending-removal-in-3.16.rst:66 msgid "" @@ -393,11 +399,12 @@ msgid "" "and scheduled for removal in Python 3.16. Define handlers with the *stream* " "argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" msgstr "" +"對具有 *strm* 引數的自訂日誌記錄處理函式的支援已被棄用,並計劃在 Python 3.16 " +"中移除。請改用 *stream* 引數。(由 Mariusz Felisiak 於 :gh:`115032` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:70 -#, fuzzy msgid ":mod:`mimetypes`:" -msgstr ":mod:`types`:" +msgstr ":mod:`mimetypes`:" #: ../../deprecations/pending-removal-in-3.16.rst:72 msgid "" @@ -406,6 +413,9 @@ msgid "" "and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " "Kemenade in :gh:`75223`.)" msgstr "" +"有效的副檔名以 '.' 開頭或對 :meth:`mimetypes.MimeTypes.add_type` 為空字串。未" +"加點的副檔名已被棄用,並將在 Python 3.16 中引發 :exc:`ValueError`。(由 Hugo " +"van Kemenade 於 :gh:`75223` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:78 msgid ":mod:`shutil`:" @@ -446,14 +456,13 @@ msgstr "" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" #: ../../deprecations/pending-removal-in-3.16.rst:98 -#, fuzzy msgid "" "The :func:`!sysconfig.expand_makefile_vars` function has been deprecated " "since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " "instead." msgstr "" -"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" -"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" +"自 Python 3.14 起,:func:`!sysconfig.expand_makefile_vars` 函式已被棄用。請改" +"用 :func:`sysconfig.get_paths` 的 ``vars`` 引數。" #: ../../deprecations/pending-removal-in-3.16.rst:102 msgid ":mod:`tarfile`:" @@ -468,9 +477,8 @@ msgstr "" "棄用。" #: ../../deprecations/pending-removal-in-3.17.rst:2 -#, fuzzy msgid "Pending removal in Python 3.17" -msgstr "Python 3.16 中待移除的項目" +msgstr "Python 3.17 中待移除的項目" #: ../../deprecations/pending-removal-in-3.17.rst:6 msgid "" @@ -481,11 +489,14 @@ msgid "" "helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " "of relying on private implementation details." msgstr "" +"在 Python 3.14 之前,舊式聯集是使用私有類別 ``typing._UnionGenericAlias`` 實" +"作的。這個類別不再被需要,但為了向後相容性而保留,並計劃將在 Python 3.17 中移" +"除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " +"和 :func:`typing.get_args`,或者依賴私有實作細節。" #: ../../deprecations/pending-removal-in-3.19.rst:2 -#, fuzzy msgid "Pending removal in Python 3.19" -msgstr "Python 3.16 中待移除的項目" +msgstr "Python 3.19 中待移除的項目" #: ../../deprecations/pending-removal-in-3.19.rst:6 msgid "" @@ -493,10 +504,11 @@ msgid "" "setting :attr:`~ctypes.Structure._pack_` but " "not :attr:`~ctypes.Structure._layout_` on non-Windows platforms." msgstr "" +"在非 Windows 平台上,透過設定 :attr:`~ctypes.Structure._pack_` 而沒有設" +"定 :attr:`~ctypes.Structure._layout_` 來隱式地切換到與 MSVC 相容的結構佈局。" #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 -#, fuzzy msgid "Pending removal in future versions" msgstr "未來版本中的待移除項目" @@ -507,25 +519,25 @@ msgid "" msgstr "以下 API 將在未來被移除,雖然目前尚未安排移除日期。" #: ../../deprecations/pending-removal-in-future.rst:7 -#, fuzzy msgid ":mod:`argparse`:" -msgstr ":mod:`array`:" +msgstr ":mod:`argparse`:" #: ../../deprecations/pending-removal-in-future.rst:9 -#, fuzzy msgid "" "Nesting argument groups and nesting mutually exclusive groups are deprecated." -msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" +msgstr "巢狀引數群組和巢狀互斥群組已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:11 msgid "" "Passing the undocumented keyword argument *prefix_chars* " "to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." msgstr "" +"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞" +"給 :meth:`~argparse.ArgumentParser.add_argument_group` 的做法現在已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:14 msgid "The :class:`argparse.FileType` type converter is deprecated." -msgstr "" +msgstr ":class:`argparse.FileType` 型別轉換器已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:18 msgid "``bool(NotImplemented)``." @@ -615,6 +627,7 @@ msgid "" ":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " "(:gh:`133038`)" msgstr "" +":mod:`codecs`:請改用 :func:`open` 而非 :func:`codecs.open`。(:gh:`133038`)" #: ../../deprecations/pending-removal-in-future.rst:52 msgid "" @@ -828,6 +841,9 @@ msgid "" "this private class, a compatibility shim will be provided until at least " "Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" msgstr "" +"內部類別 ``typing._UnionGenericAlias`` 不再用於實作 :class:`typing.Union`。為" +"了保持與此私有類別使用者的相容性,直到至少 Python 3.17 都將提供一個相容性 " +"shim。(由 Jelle Zijlstra 於 :gh:`105499` 貢獻。)" #: ../../deprecations/pending-removal-in-future.rst:132 msgid "" @@ -910,9 +926,10 @@ msgid "" ":func:`sys._clear_type_cache` is deprecated: " "use :func:`sys._clear_internal_caches` instead." msgstr "" +":func:`sys._clear_type_cache` 已被棄用:請改" +"用 :func:`sys._clear_internal_caches`。" #: ../../deprecations/index.rst:15 -#, fuzzy msgid "C API deprecations" msgstr "C API 的棄用項目" @@ -931,6 +948,10 @@ msgid "" "`__ can be used to " "get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." msgstr "" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" +"用 :c:func:`PyWeakref_GetRef`。可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.12 和更早版本取" +"得 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 msgid "" @@ -952,6 +973,9 @@ msgid "" "Note that some codecs (for example, \"base64\") may return a type other " "than :class:`str`, such as :class:`bytes`." msgstr "" +":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`;請注" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`str` 的型別,例" +"如 :class:`bytes`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid "" @@ -965,18 +989,21 @@ msgid "" "Note that some codecs (for example, \"base64\") may return a type other " "than :class:`bytes`, such as :class:`str`." msgstr "" +":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`;請注" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`bytes` 的型別,例" +"如 :class:`str`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 -#, fuzzy msgid "Python initialization functions, deprecated in Python 3.13:" -msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" +msgstr "Python 初始化函式,自 Python 3.13 起已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:24 -#, fuzzy msgid "" ":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " "` (:data:`sys.path`) instead." -msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" +msgstr "" +":c:func:`Py_GetPath`:請改用 :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:27 msgid "" @@ -985,6 +1012,10 @@ msgid "" "Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) " "if :ref:`virtual environments ` need to be handled." msgstr "" +":c:func:`Py_GetPrefix`:請改用 :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`)。如果需要處理\\ :ref:`虛擬環境 " +"`,請改用 :c:func:`PyConfig_Get(\"prefix\") ` " +"(:data:`sys.prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:32 msgid "" @@ -994,60 +1025,68 @@ msgid "" "(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " "be handled." msgstr "" +":c:func:`Py_GetExecPrefix`:請改" +"用 :c:func:`PyConfig_Get(\"base_exec_prefix\") ` " +"(:data:`sys.base_exec_prefix`)。如果需要處理\\ :ref:`虛擬環境 `,請" +"改用 :c:func:`PyConfig_Get(\"exec_prefix\") ` " +"(:data:`sys.exec_prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:38 -#, fuzzy msgid "" ":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." -msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" +msgstr "" +":c:func:`Py_GetProgramFullPath`:請改" +"用 :c:func:`PyConfig_Get(\"executable\") ` " +"(:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:41 -#, fuzzy msgid "" ":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." -msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" +msgstr "" +":c:func:`Py_GetProgramName`:請改用 :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:44 -#, fuzzy msgid "" ":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " "` or the :envvar:`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " -"或 :envvar:`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:func:`PyConfig_Get(\"home\") " +"` 或 :envvar:`PYTHONHOME` 環境變數。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:48 msgid "" "The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." msgstr "" +"`pythoncapi-compat 專案 `__ 可" +"以用來為 Python 3.13 和更早版本取得 :c:func:`PyConfig_Get`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:52 msgid "" "Functions to configure Python's initialization, deprecated in Python 3.11:" -msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" +msgstr "用於配置 Python 初始化的函式,自 Python 3.11 起已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:54 msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." -msgstr ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" +msgstr ":c:func:`!PySys_SetArgvEx()`:請改用 :c:member:`PyConfig.argv`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:56 msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." -msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" +msgstr ":c:func:`!PySys_SetArgv()`:請改用 :c:member:`PyConfig.argv`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:58 msgid "" ":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " "instead." msgstr "" -":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設" -"定。" +":c:func:`!Py_SetProgramName()`:請改用 :c:member:`PyConfig.program_name`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:60 msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." -msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" +msgstr ":c:func:`!Py_SetPythonHome()`:請改用 :c:member:`PyConfig.home`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:62 msgid "" @@ -1062,133 +1101,139 @@ msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used " "with :c:type:`PyConfig` instead." msgstr "" -":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" +"應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:68 msgid "Global configuration variables:" -msgstr "全域設定變數:" +msgstr "全域配置變數:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:70 -#, fuzzy msgid "" ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` " "or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." -msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" +msgstr "" +":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug` " +"或 :c:func:`PyConfig_Get(\"parser_debug\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:73 -#, fuzzy msgid "" ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` " "or :c:func:`PyConfig_Get(\"verbose\") ` instead." -msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" +msgstr "" +":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose` " +"或 :c:func:`PyConfig_Get(\"verbose\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:76 -#, fuzzy msgid "" ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` " "or :c:func:`PyConfig_Get(\"quiet\") ` instead." -msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" +msgstr "" +":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet` " +"或 :c:func:`PyConfig_Get(\"quiet\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:79 -#, fuzzy msgid "" ":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` " "or :c:func:`PyConfig_Get(\"interactive\") ` instead." -msgstr ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" +msgstr "" +":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive` " +"或 :c:func:`PyConfig_Get(\"interactive\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:82 -#, fuzzy msgid "" ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` " "or :c:func:`PyConfig_Get(\"inspect\") ` instead." -msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" +msgstr "" +":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect` " +"或 :c:func:`PyConfig_Get(\"inspect\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:85 -#, fuzzy msgid "" ":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " "or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." msgstr "" -":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" +":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level` " +"或 :c:func:`PyConfig_Get(\"optimization_level\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:88 -#, fuzzy msgid "" ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` " "or :c:func:`PyConfig_Get(\"site_import\") ` instead." -msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" +msgstr "" +":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import` " +"或 :c:func:`PyConfig_Get(\"site_import\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:91 -#, fuzzy msgid "" ":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " "or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." msgstr "" -":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" +":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning` " +"或 :c:func:`PyConfig_Get(\"bytes_warning\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:94 -#, fuzzy msgid "" ":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " "or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" -":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" +":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings` " +"或 :c:func:`PyConfig_Get(\"pathconfig_warnings\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:97 -#, fuzzy msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "or :c:func:`PyConfig_Get(\"use_environment\") ` instead." msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment`。" +"用 :c:member:`PyConfig.use_environment` " +"或 :c:func:`PyConfig_Get(\"use_environment\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:100 -#, fuzzy msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`:請改" -"用 :c:member:`PyConfig.write_bytecode`。" +"用 :c:member:`PyConfig.write_bytecode` " +"或 :c:func:`PyConfig_Get(\"write_bytecode\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:103 -#, fuzzy msgid "" ":c:var:`Py_NoUserSiteDirectory`: " "Use :c:member:`PyConfig.user_site_directory` " "or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." msgstr "" ":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory`。" +"用 :c:member:`PyConfig.user_site_directory` " +"或 :c:func:`PyConfig_Get(\"user_site_directory\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:106 -#, fuzzy msgid "" ":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " "or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." msgstr "" -":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio`。" +":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio` " +"或 :c:func:`PyConfig_Get(\"buffered_stdio\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:109 -#, fuzzy msgid "" ":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " "` instead." msgstr "" ":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " -"和 :c:member:`PyConfig.hash_seed`。" +"和 :c:member:`PyConfig.hash_seed` 或 :c:func:`PyConfig_Get(\"hash_seed\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:113 -#, fuzzy msgid "" ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` " "or :c:func:`PyConfig_Get(\"isolated\") ` instead." -msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" +msgstr "" +":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated` " +"或 :c:func:`PyConfig_Get(\"isolated\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:116 -#, fuzzy msgid "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: " "Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` " @@ -1196,111 +1241,115 @@ msgid "" "instead." msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" +"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding` " +"或 :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:119 -#, fuzzy msgid "" ":c:var:`Py_LegacyWindowsStdioFlag`: " "Use :c:member:`PyConfig.legacy_windows_stdio` " "or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`。" +"用 :c:member:`PyConfig.legacy_windows_stdio` " +"或 :c:func:`PyConfig_Get(\"legacy_windows_stdio\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:122 -#, fuzzy msgid "" ":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" "Py_HasFileSystemDefaultEncoding`: " "Use :c:member:`PyConfig.filesystem_encoding` " "or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncoding`、:c:var:`!" +"Py_HasFileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding` " +"或 :c:func:`PyConfig_Get(\"filesystem_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:125 -#, fuzzy msgid "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: " "Use :c:member:`PyConfig.filesystem_errors` " "or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors`。" +"用 :c:member:`PyConfig.filesystem_errors` " +"或 :c:func:`PyConfig_Get(\"filesystem_errors\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:128 -#, fuzzy msgid "" ":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` " "or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. " "(see :c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" -"見 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode` " +"或 :c:func:`PyConfig_Get(\"utf8_mode\") `。(請參" +"閱 :c:func:`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:133 -#, fuzzy msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used " "with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can " "be used to get these options at runtime." msgstr "" -":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" +"應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API 來設定" +"這些選項。或者也可以使用 :c:func:`PyConfig_Get` 在執行時取得這些選項。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:2 -#, fuzzy msgid "Pending removal in Python 3.18" -msgstr "Python 3.16 中待移除的項目" +msgstr "Python 3.18 中待移除的項目" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:4 msgid "Deprecated private functions (:gh:`128863`):" -msgstr "" +msgstr "被棄用的私有函式 (:gh:`128863`):" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:6 -#, fuzzy msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." -msgstr ":c:func:`PyThread_create_key`:請改用 :c:func:`PyThread_tss_alloc`。" +msgstr ":c:func:`!_PyBytes_Join`:請改用 :c:func:`PyBytes_Join`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 msgid "" ":c:func:`!_PyDict_GetItemStringWithError`: " "use :c:func:`PyDict_GetItemStringRef`." msgstr "" +":c:func:`!_PyDict_GetItemStringWithError`:請改" +"用 :c:func:`PyDict_GetItemStringRef`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 -#, fuzzy msgid ":c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`." -msgstr ":c:func:`!PyErr_Display`:請改用 :c:func:`PyErr_DisplayException`。" +msgstr ":c:func:`!_PyDict_Pop()`:請改用 :c:func:`PyDict_Pop`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." -msgstr "" +msgstr ":c:func:`!_PyLong_Sign()`:請改用 :c:func:`PyLong_GetSign`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 msgid "" ":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: " "use :c:func:`PyLongWriter_Create`." msgstr "" +":c:func:`!_PyLong_FromDigits` 和 :c:func:`!_PyLong_New`:請改" +"用 :c:func:`PyLongWriter_Create`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:12 -#, fuzzy msgid "" ":c:func:`!_PyThreadState_UncheckedGet`: " "use :c:func:`PyThreadState_GetUnchecked`." -msgstr ":c:func:`PyThread_set_key_value`:請改用 :c:func:`PyThread_tss_set`。" +msgstr "" +":c:func:`!_PyThreadState_UncheckedGet`:請改" +"用 :c:func:`PyThreadState_GetUnchecked`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 -#, fuzzy msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." -msgstr "" -":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" +msgstr ":c:func:`!_PyUnicode_AsString`:請改用 :c:func:`PyUnicode_AsUTF8`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 msgid "" ":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " "with :c:func:`writer = PyUnicodeWriter_Create(0) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Init`:將 ``_PyUnicodeWriter_Init(&writer)`` 替換" +"為 :c:func:`writer = PyUnicodeWriter_Create(0) `。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:17 msgid "" @@ -1308,6 +1357,8 @@ msgid "" "``_PyUnicodeWriter_Finish(&writer)`` " "with :c:func:`PyUnicodeWriter_Finish(writer) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Finish`:將 ``_PyUnicodeWriter_Finish(&writer)`` " +"替換為 :c:func:`PyUnicodeWriter_Finish(writer) `。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:20 msgid "" @@ -1315,6 +1366,9 @@ msgid "" "``_PyUnicodeWriter_Dealloc(&writer)`` " "with :c:func:`PyUnicodeWriter_Discard(writer) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Dealloc`:將 " +"``_PyUnicodeWriter_Dealloc(&writer)`` 替換" +"為 :c:func:`PyUnicodeWriter_Discard(writer) `。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:23 msgid "" @@ -1323,6 +1377,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteChar`:將 " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:26 msgid "" @@ -1331,6 +1389,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteStr(writer, str) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteStr`:將 " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteStr(writer, str) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:29 msgid "" @@ -1339,6 +1401,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`:將 " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:32 msgid "" @@ -1347,6 +1413,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteASCIIString`:將 " +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:35 msgid "" @@ -1355,31 +1425,34 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteLatin1String`:將 " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:38 msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." -msgstr "" +msgstr ":c:func:`!_PyUnicodeWriter_Prepare`:(無替代方案)。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." -msgstr "" +msgstr ":c:func:`!_PyUnicodeWriter_PrepareKind`:(無替代方案)。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 -#, fuzzy msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." -msgstr ":c:func:`PyErr_Restore`:請改用 :c:func:`PyErr_SetRaisedException`。" +msgstr ":c:func:`!_Py_HashPointer`:請改用 :c:func:`Py_HashPointer`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 -#, fuzzy msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." -msgstr "" -":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" +msgstr ":c:func:`!_Py_fopen_obj`:請改用 :c:func:`Py_fopen`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:43 msgid "" "The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older." msgstr "" +"可以使用 `pythoncapi-compat project `__ 來取得這些於 Python 3.13 及更早版本的新公開函式。" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -1483,287 +1556,3 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-future.rst:41 msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" - -#~ msgid "Pending Removal in Python 3.14" -#~ msgstr "Python 3.14 中待移除的項目" - -#~ msgid "" -#~ ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters " -#~ "of :class:`!argparse.BooleanOptionalAction` are deprecated and will be " -#~ "removed in 3.14. (Contributed by Nikita Sobolev in :gh:`92248`.)" -#~ msgstr "" -#~ ":mod:`argparse`::class:`!argparse.BooleanOptionalAction` 的 *type*、" -#~ "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita " -#~ "Sobolev 於 :gh:`92248` 貢獻。)" - -#~ msgid "" -#~ ":mod:`ast`: The following features have been deprecated in documentation " -#~ "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " -#~ "runtime when they are accessed or used, and will be removed in Python " -#~ "3.14:" -#~ msgstr "" -#~ ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時" -#~ "會於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" - -#~ msgid ":class:`!ast.Num`" -#~ msgstr ":class:`!ast.Num`" - -#~ msgid ":class:`!ast.Str`" -#~ msgstr ":class:`!ast.Str`" - -#~ msgid ":class:`!ast.Bytes`" -#~ msgstr ":class:`!ast.Bytes`" - -#~ msgid ":class:`!ast.NameConstant`" -#~ msgstr ":class:`!ast.NameConstant`" - -#~ msgid ":class:`!ast.Ellipsis`" -#~ msgstr ":class:`!ast.Ellipsis`" - -#~ msgid "" -#~ "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " -#~ "in :gh:`90953`.)" -#~ msgstr "" -#~ "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢" -#~ "獻。)" - -#~ msgid "" -#~ "The child watcher " -#~ "classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` " -#~ "and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed " -#~ "in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" -#~ msgstr "" -#~ "已棄用並將在 Python 3.14 中移除的 child watcher 類" -#~ "別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " -#~ "和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" -#~ "獻。)" - -#~ msgid "" -#~ ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -#~ "and :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are " -#~ "deprecated and will be removed in Python 3.14. (Contributed by Kumar " -#~ "Aditya in :gh:`94597`.)" -#~ msgstr "" -#~ ":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -#~ "和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將" -#~ "在 Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" - -#~ msgid "" -#~ "The :meth:`~asyncio.get_event_loop` method of the default event loop " -#~ "policy now emits a :exc:`DeprecationWarning` if there is no current event " -#~ "loop set and it decides to create one. (Contributed by Serhiy Storchaka " -#~ "and Guido van Rossum in :gh:`100160`.)" -#~ msgstr "" -#~ "預設事件迴圈策略的 :meth:`~asyncio.get_event_loop` 方法現在會在沒有設定目" -#~ "前事件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy " -#~ "Storchaka 和 Guido van Rossum 於 :gh:`100160` 貢獻。)" - -#~ msgid "" -#~ ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " -#~ "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -#~ "typing, prefer a union, like ``bytes | bytearray``, " -#~ "or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -#~ "in :gh:`91896`.)" -#~ msgstr "" -#~ ":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" -#~ "用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使" -#~ "用時,請改用聯集,如 ``bytes | bytearray``," -#~ "或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" -#~ "獻。)" - -#~ msgid "" -#~ ":mod:`email`: Deprecated the *isdst* parameter " -#~ "in :func:`email.utils.localtime`. (Contributed by Alan Williams " -#~ "in :gh:`72346`.)" -#~ msgstr "" -#~ ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。" -#~ "(由 Alan Williams 於 :gh:`72346` 貢獻。)" - -#~ msgid ":mod:`importlib.abc` deprecated classes:" -#~ msgstr ":mod:`importlib.abc` 的已棄用類別:" - -#~ msgid ":class:`!importlib.abc.ResourceReader`" -#~ msgstr ":class:`!importlib.abc.ResourceReader`" - -#~ msgid ":class:`!importlib.abc.Traversable`" -#~ msgstr ":class:`!importlib.abc.Traversable`" - -#~ msgid ":class:`!importlib.abc.TraversableResources`" -#~ msgstr ":class:`!importlib.abc.TraversableResources`" - -#~ msgid "Use :mod:`importlib.resources.abc` classes instead:" -#~ msgstr "請改用 :mod:`importlib.resources.abc` 類別:" - -#~ msgid ":class:`importlib.resources.abc.Traversable`" -#~ msgstr ":class:`importlib.resources.abc.Traversable`" - -#~ msgid ":class:`importlib.resources.abc.TraversableResources`" -#~ msgstr ":class:`importlib.resources.abc.TraversableResources`" - -#~ msgid "" -#~ "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" -#~ msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" - -#~ msgid "" -#~ ":mod:`itertools` had undocumented, inefficient, historically buggy, and " -#~ "inconsistent support for copy, deepcopy, and pickle operations. This will " -#~ "be removed in 3.14 for a significant reduction in code volume and " -#~ "maintenance burden. (Contributed by Raymond Hettinger in :gh:`101588`.)" -#~ msgstr "" -#~ ":mod:`itertools` 有不以文件記錄、效率低下、過去常有 bug 且不一致的 copy、" -#~ "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負" -#~ "擔。 (由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" - -#~ msgid "" -#~ ":mod:`multiprocessing`: The default start method will change to a safer " -#~ "one on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` " -#~ "is currently the default (:gh:`84559`). Adding a runtime warning about " -#~ "this was deemed too disruptive as the majority of code is not expected to " -#~ "care. Use the :func:`~multiprocessing.get_context` " -#~ "or :func:`~multiprocessing.set_start_method` APIs to explicitly specify " -#~ "when your code *requires* ``'fork'``. See :ref:`multiprocessing-start-" -#~ "methods`." -#~ msgstr "" -#~ ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS " -#~ "POSIX 平台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。" -#~ "對此增加一個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" -#~ "用 :func:`~multiprocessing.get_context` " -#~ "或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時" -#~ "\\ *需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" - -#~ msgid "" -#~ ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " -#~ "and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments " -#~ "is deprecated." -#~ msgstr "" -#~ ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " -#~ "和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" - -#~ msgid "" -#~ ":mod:`pkgutil`: :func:`~pkgutil.find_loader` " -#~ "and :func:`~pkgutil.get_loader` now raise :exc:`DeprecationWarning`; " -#~ "use :func:`importlib.util.find_spec` instead. (Contributed by Nikita " -#~ "Sobolev in :gh:`97850`.)" -#~ msgstr "" -#~ ":mod:`pkgutil`::func:`~pkgutil.find_loader` " -#~ "和 :func:`~pkgutil.get_loader` 現在會引發 :exc:`DeprecationWarning`;請改" -#~ "用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" -#~ "獻。)" - -#~ msgid ":mod:`pty`:" -#~ msgstr ":mod:`pty`:" - -#~ msgid "``master_open()``: use :func:`pty.openpty`." -#~ msgstr "``master_open()``:請用 :func:`pty.openpty`。" - -#~ msgid "``slave_open()``: use :func:`pty.openpty`." -#~ msgstr "``slave_open()``:請用 :func:`pty.openpty`。" - -#~ msgid ":mod:`sqlite3`:" -#~ msgstr ":mod:`sqlite3`:" - -#~ msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." -#~ msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" - -#~ msgid "" -#~ ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " -#~ "if :ref:`named placeholders ` are used and " -#~ "*parameters* is a sequence instead of a :class:`dict`." -#~ msgstr "" -#~ ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如" -#~ "果使用 :ref:`named placeholders ` 且 *parameters* 是" -#~ "序列而不是 :class:`dict`。" - -#~ msgid "" -#~ ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, " -#~ "now causes a :exc:`DeprecationWarning` to be emitted when it is used." -#~ msgstr "" -#~ ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在" -#~ "在使用時會發出 :exc:`DeprecationWarning`。" - -#~ msgid "" -#~ ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -#~ "intended to be a public API. (Contributed by Gregory P. Smith " -#~ "in :gh:`88168`.)" -#~ msgstr "" -#~ ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 " -#~ "API。(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" - -#~ msgid "Pending Removal in Python 3.15" -#~ msgstr "Python 3.15 中待移除的項目" - -#~ msgid "" -#~ ":mod:`urllib.request`: :class:`~urllib.request.URLopener` " -#~ "and :class:`~urllib.request.FancyURLopener` style of invoking requests is " -#~ "deprecated. Use newer :func:`~urllib.request.urlopen` functions and " -#~ "methods." -#~ msgstr "" -#~ ":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " -#~ "和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" -#~ "的 :func:`~urllib.request.urlopen` 函式和方法。" - -#~ msgid "" -#~ "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension " -#~ "modules (:pep:`699`; :gh:`101193`)." -#~ msgstr "" -#~ ":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " -#~ "(:pep:`699`;:gh:`101193`)。" - -#~ msgid "" -#~ "Creating :c:data:`immutable types ` with " -#~ "mutable bases (:gh:`95388`)." -#~ msgstr "" -#~ "使用可變基底建立\\ :c:data:`不可變型別 ` " -#~ "(:gh:`95388`)。" - -#~ msgid "" -#~ ":c:var:`!Py_FileSystemDefaultEncoding`: " -#~ "Use :c:member:`PyConfig.filesystem_encoding` instead." -#~ msgstr "" -#~ ":c:var:`!Py_FileSystemDefaultEncoding`:請改" -#~ "用 :c:member:`PyConfig.filesystem_encoding`。" - -#~ msgid "" -#~ ":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " -#~ "Use :c:func:`PyWeakref_GetRef` instead." -#~ msgstr "" -#~ ":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" -#~ "用 :c:func:`PyWeakref_GetRef`。" - -#~ msgid "Python initialization functions:" -#~ msgstr "Python 初始化函式:" - -#~ msgid "" -#~ ":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " -#~ "and :data:`sys.exec_prefix` instead." -#~ msgstr "" -#~ ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " -#~ "與 :data:`sys.exec_prefix`。" - -#~ msgid "" -#~ ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` " -#~ "and :data:`sys.prefix` instead." -#~ msgstr "" -#~ ":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " -#~ "與 :data:`sys.prefix`。" - -#~ msgid "" -#~ ":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` " -#~ "instead." -#~ msgstr "" -#~ ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" - -#~ msgid "" -#~ ":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` " -#~ "instead." -#~ msgstr "" -#~ ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" - -#~ msgid ":c:member:`!PyDictObject.ma_version_tag` member." -#~ msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" - -#~ msgid "The bundled copy of ``libmpdecimal``." -#~ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" - -#~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" -#~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" diff --git a/deprecations/pending-removal-in-3.13.po b/deprecations/pending-removal-in-3.13.po index cd7fdaa63be..ead0f19e440 100644 --- a/deprecations/pending-removal-in-3.13.po +++ b/deprecations/pending-removal-in-3.13.po @@ -1,9 +1,9 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -16,7 +16,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/pending-removal-in-3.13.rst:2 -#, fuzzy msgid "Pending removal in Python 3.13" msgstr "Python 3.13 中待移除的項目" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index 4e30f36fbf2..12e8980e524 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -1,9 +1,9 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -16,7 +16,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/pending-removal-in-3.14.rst:2 -#, fuzzy msgid "Pending removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" @@ -71,20 +70,18 @@ msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.14.rst:24 -#, fuzzy msgid "" "The child watcher classes :class:`!asyncio.MultiLoopChildWatcher`, :class:`!" "asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` " "and :class:`!asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類" -"別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " -"和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" -"獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`!" +"asyncio.MultiLoopChildWatcher`、:class:`!asyncio.FastChildWatcher`、:class:`!" +"asyncio.AbstractChildWatcher` 和 :class:`!asyncio.SafeChildWatcher`。 (由 " +"Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:30 -#, fuzzy msgid "" ":func:`!asyncio.set_child_watcher`, :func:`!" "asyncio.get_child_watcher`, :meth:`!" @@ -92,9 +89,11 @@ msgid "" "asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated and will " "be removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " -"Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`!asyncio.set_child_watcher`、:func:`!" +"asyncio.get_child_watcher`、:meth:`!" +"asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`!" +"asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python " +"3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" @@ -108,7 +107,6 @@ msgstr "" "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:41 -#, fuzzy msgid "" ":mod:`collections.abc`: Deprecated :class:`!collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -116,7 +114,7 @@ msgid "" "or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " "in :gh:`91896`.)" msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" +":mod:`collections.abc`:已棄用 :class:`!collections.abc.ByteString`。請改" "用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" "時,請改用聯集,如 ``bytes | bytearray``," "或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" @@ -201,13 +199,12 @@ msgstr "" "和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 -#, fuzzy msgid "" ":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" -":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " +":mod:`pkgutil`::func:`!pkgutil.find_loader` 和 :func:`!pkgutil.get_loader` " "現在會引發 :exc:`DeprecationWarning`;請改" "用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" "獻。)" @@ -229,9 +226,8 @@ msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" #: ../../deprecations/pending-removal-in-3.14.rst:93 -#, fuzzy msgid ":data:`!version` and :data:`!version_info`." -msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" +msgstr ":data:`!version` 和 :data:`!version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" @@ -244,12 +240,11 @@ msgstr "" "而不是 :class:`dict`。" #: ../../deprecations/pending-removal-in-3.14.rst:99 -#, fuzzy msgid "" ":mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." msgstr "" -":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" +":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`!typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" #: ../../deprecations/pending-removal-in-3.14.rst:102 diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index 60fcf80232e..0d86e896d68 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -1,9 +1,9 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -16,7 +16,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/pending-removal-in-3.15.rst:2 -#, fuzzy msgid "Pending removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" @@ -180,7 +179,6 @@ msgid ":mod:`typing`:" msgstr ":mod:`typing`:" #: ../../deprecations/pending-removal-in-3.15.rst:82 -#, fuzzy msgid "" "The undocumented keyword argument syntax for " "creating :class:`~typing.NamedTuple` classes (for example, ``Point = " @@ -230,9 +228,8 @@ msgstr "" "和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:107 -#, fuzzy msgid ":mod:`zipimport`:" -msgstr ":mod:`importlib`:" +msgstr ":mod:`zipimport`:" #: ../../deprecations/pending-removal-in-3.15.rst:109 msgid "" @@ -240,3 +237,6 @@ msgid "" "3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " "by Jiahao Li in :gh:`125746`.)" msgstr "" +":meth:`~zipimport.zipimporter.load_module` 自 Python 3.10 被棄用。請改" +"用 :meth:`~zipimport.zipimporter.exec_module`。(由 Jiahao Li " +"於 :gh:`125746` 貢獻。)" diff --git a/deprecations/pending-removal-in-3.16.po b/deprecations/pending-removal-in-3.16.po index ba516174a94..f2590b23cd8 100644 --- a/deprecations/pending-removal-in-3.16.po +++ b/deprecations/pending-removal-in-3.16.po @@ -1,9 +1,9 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -53,13 +53,12 @@ msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.16.rst:21 -#, fuzzy msgid "" ":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " "Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" -":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" +":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除;請改" "用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " "於 :gh:`122875` 貢獻。)" @@ -68,40 +67,44 @@ msgid "" ":mod:`asyncio` policy system is deprecated and will be removed in Python " "3.16. In particular, the following classes and functions are deprecated:" msgstr "" +":mod:`asyncio` 策略系統已被棄用並將在 Python 3.16 中移除。特別是以下類別和函" +"式已被棄用:" #: ../../deprecations/pending-removal-in-3.16.rst:29 msgid ":class:`asyncio.AbstractEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.AbstractEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:30 msgid ":class:`asyncio.DefaultEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.DefaultEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:31 msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.WindowsSelectorEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:32 msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.WindowsProactorEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:33 msgid ":func:`asyncio.get_event_loop_policy`" -msgstr "" +msgstr ":func:`asyncio.get_event_loop_policy`" #: ../../deprecations/pending-removal-in-3.16.rst:34 msgid ":func:`asyncio.set_event_loop_policy`" -msgstr "" +msgstr ":func:`asyncio.set_event_loop_policy`" #: ../../deprecations/pending-removal-in-3.16.rst:36 msgid "" "Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " "*loop_factory* to use the desired event loop implementation." msgstr "" +"使用者應該使用 :func:`asyncio.run` 或 :class:`asyncio.Runner` 搭配 " +"*loop_factory* 來使用所需的事件迴圈實作。" #: ../../deprecations/pending-removal-in-3.16.rst:39 msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" -msgstr "" +msgstr "例如在 Windows 上使用 :class:`asyncio.SelectorEventLoop`: ::" #: ../../deprecations/pending-removal-in-3.16.rst:41 msgid "" @@ -112,10 +115,16 @@ msgid "" "\n" "asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" msgstr "" +"import asyncio\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" #: ../../deprecations/pending-removal-in-3.16.rst:48 msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" -msgstr "" +msgstr "(由 Kumar Aditya 於 :gh:`127949` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:50 msgid ":mod:`builtins`:" @@ -135,9 +144,8 @@ msgstr "" "``~int(x)`` (``~int(x)``)。" #: ../../deprecations/pending-removal-in-3.16.rst:59 -#, fuzzy msgid ":mod:`functools`:" -msgstr ":mod:`shutil`:" +msgstr ":mod:`functools`:" #: ../../deprecations/pending-removal-in-3.16.rst:61 msgid "" @@ -145,11 +153,12 @@ msgid "" "*function* or *sequence* as keyword arguments has been deprecated since " "Python 3.14." msgstr "" +"自 Python 3.14 起,使用 *function* 或 *sequence* 關鍵字引數呼" +"叫 :func:`functools.reduce` 的 Python 實作已被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:64 -#, fuzzy msgid ":mod:`logging`:" -msgstr ":mod:`builtins`:" +msgstr ":mod:`logging`:" #: ../../deprecations/pending-removal-in-3.16.rst:66 msgid "" @@ -157,11 +166,12 @@ msgid "" "and scheduled for removal in Python 3.16. Define handlers with the *stream* " "argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" msgstr "" +"對具有 *strm* 引數的自訂日誌記錄處理函式的支援已被棄用,並計劃在 Python 3.16 " +"中移除。請改用 *stream* 引數。(由 Mariusz Felisiak 於 :gh:`115032` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:70 -#, fuzzy msgid ":mod:`mimetypes`:" -msgstr ":mod:`sys`:" +msgstr ":mod:`mimetypes`:" #: ../../deprecations/pending-removal-in-3.16.rst:72 msgid "" @@ -170,6 +180,9 @@ msgid "" "and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " "Kemenade in :gh:`75223`.)" msgstr "" +"有效的副檔名以 '.' 開頭或對 :meth:`mimetypes.MimeTypes.add_type` 為空字串。未" +"加點的副檔名已被棄用,並將在 Python 3.16 中引發 :exc:`ValueError`。(由 Hugo " +"van Kemenade 於 :gh:`75223` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:78 msgid ":mod:`shutil`:" @@ -210,19 +223,17 @@ msgstr "" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" #: ../../deprecations/pending-removal-in-3.16.rst:96 -#, fuzzy msgid ":mod:`sysconfig`:" -msgstr ":mod:`sys`:" +msgstr ":mod:`sysconfig`:" #: ../../deprecations/pending-removal-in-3.16.rst:98 -#, fuzzy msgid "" "The :func:`!sysconfig.expand_makefile_vars` function has been deprecated " "since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " "instead." msgstr "" -"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" -"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" +"自 Python 3.14 起,:func:`!sysconfig.expand_makefile_vars` 函式已被棄用。請改" +"用 :func:`sysconfig.get_paths` 的 ``vars`` 引數。" #: ../../deprecations/pending-removal-in-3.16.rst:102 msgid ":mod:`tarfile`:" diff --git a/deprecations/pending-removal-in-3.17.po b/deprecations/pending-removal-in-3.17.po index a9a9e110993..cbf597dea40 100644 --- a/deprecations/pending-removal-in-3.17.po +++ b/deprecations/pending-removal-in-3.17.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -19,11 +18,11 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.17.rst:2 msgid "Pending removal in Python 3.17" -msgstr "" +msgstr "Python 3.17 中待移除的項目" #: ../../deprecations/pending-removal-in-3.17.rst:4 msgid ":mod:`typing`:" -msgstr "" +msgstr ":mod:`typing`:" #: ../../deprecations/pending-removal-in-3.17.rst:6 msgid "" @@ -34,3 +33,7 @@ msgid "" "helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " "of relying on private implementation details." msgstr "" +"在 Python 3.14 之前,舊式聯集是使用私有類別 ``typing._UnionGenericAlias`` 實" +"作的。這個類別不再被需要,但為了向後相容性而保留,並計劃將在 Python 3.17 中移" +"除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " +"和 :func:`typing.get_args`,或者依賴私有實作細節。" diff --git a/deprecations/pending-removal-in-3.19.po b/deprecations/pending-removal-in-3.19.po index 920a3d29431..79fc1b949ed 100644 --- a/deprecations/pending-removal-in-3.19.po +++ b/deprecations/pending-removal-in-3.19.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -19,11 +18,11 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.19.rst:2 msgid "Pending removal in Python 3.19" -msgstr "" +msgstr "Python 3.19 中待移除的項目" #: ../../deprecations/pending-removal-in-3.19.rst:4 msgid ":mod:`ctypes`:" -msgstr "" +msgstr ":mod:`ctypes`:" #: ../../deprecations/pending-removal-in-3.19.rst:6 msgid "" @@ -31,3 +30,5 @@ msgid "" "setting :attr:`~ctypes.Structure._pack_` but " "not :attr:`~ctypes.Structure._layout_` on non-Windows platforms." msgstr "" +"在非 Windows 平台上,透過設定 :attr:`~ctypes.Structure._pack_` 而沒有設" +"定 :attr:`~ctypes.Structure._layout_` 來隱式地切換到與 MSVC 相容的結構佈局。" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po index d69ef44f022..60bdaf627e0 100644 --- a/deprecations/pending-removal-in-future.po +++ b/deprecations/pending-removal-in-future.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -17,7 +17,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/pending-removal-in-future.rst:2 -#, fuzzy msgid "Pending removal in future versions" msgstr "未來版本中的待移除項目" @@ -28,25 +27,25 @@ msgid "" msgstr "以下 API 將在未來被移除,雖然目前尚未安排移除日期。" #: ../../deprecations/pending-removal-in-future.rst:7 -#, fuzzy msgid ":mod:`argparse`:" -msgstr ":mod:`datetime`:" +msgstr ":mod:`argparse`:" #: ../../deprecations/pending-removal-in-future.rst:9 -#, fuzzy msgid "" "Nesting argument groups and nesting mutually exclusive groups are deprecated." -msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" +msgstr "巢狀引數群組和巢狀互斥群組已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:11 msgid "" "Passing the undocumented keyword argument *prefix_chars* " "to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." msgstr "" +"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞" +"給 :meth:`~argparse.ArgumentParser.add_argument_group` 的做法現在已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:14 msgid "The :class:`argparse.FileType` type converter is deprecated." -msgstr "" +msgstr ":class:`argparse.FileType` 型別轉換器已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:16 msgid ":mod:`builtins`:" @@ -140,6 +139,7 @@ msgid "" ":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " "(:gh:`133038`)" msgstr "" +":mod:`codecs`:請改用 :func:`open` 而非 :func:`codecs.open`。(:gh:`133038`)" #: ../../deprecations/pending-removal-in-future.rst:52 msgid "" @@ -357,6 +357,9 @@ msgid "" "this private class, a compatibility shim will be provided until at least " "Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" msgstr "" +"內部類別 ``typing._UnionGenericAlias`` 不再用於實作 :class:`typing.Union`。為" +"了保持與此私有類別使用者的相容性,直到至少 Python 3.17 都將提供一個相容性 " +"shim。(由 Jelle Zijlstra 於 :gh:`105499` 貢獻。)" #: ../../deprecations/pending-removal-in-future.rst:132 msgid "" @@ -439,23 +442,5 @@ msgid "" ":func:`sys._clear_type_cache` is deprecated: " "use :func:`sys._clear_internal_caches` instead." msgstr "" - -#~ msgid "" -#~ ":mod:`urllib.request`: :class:`~urllib.request.URLopener` " -#~ "and :class:`~urllib.request.FancyURLopener` style of invoking requests is " -#~ "deprecated. Use newer :func:`~urllib.request.urlopen` functions and " -#~ "methods." -#~ msgstr "" -#~ ":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " -#~ "和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" -#~ "的 :func:`~urllib.request.urlopen` 函式和方法。" - -#~ msgid "" -#~ ":meth:`zipimport.zipimporter.load_module` is deprecated: " -#~ "use :meth:`~zipimport.zipimporter.exec_module` instead." -#~ msgstr "" -#~ ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" -#~ "用 :meth:`~zipimport.zipimporter.exec_module`。" - -#~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" -#~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" +":func:`sys._clear_type_cache` 已被棄用:請改" +"用 :func:`sys._clear_internal_caches`。" diff --git a/distributing/index.po b/distributing/index.po index 6ef90c29d0b..6b969cb0e49 100644 --- a/distributing/index.po +++ b/distributing/index.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-08-18 00:03+0000\n" "PO-Revision-Date: 2021-07-04 18:06+0800\n" diff --git a/extending/building.po b/extending/building.po index da70bd607f2..42cf78789f0 100644 --- a/extending/building.po +++ b/extending/building.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-02-07 14:09+0000\n" @@ -24,7 +24,6 @@ msgid "Building C and C++ Extensions" msgstr "建立 C 與 C++ 擴充套件" #: ../../extending/building.rst:9 -#, fuzzy msgid "" "A C extension for CPython is a shared library (for example, a ``.so`` file " "on Linux, ``.pyd`` on Windows), which exports an *initialization function*." @@ -34,7 +33,7 @@ msgstr "" #: ../../extending/building.rst:12 msgid "See :ref:`extension-modules` for details." -msgstr "" +msgstr "詳見 :ref:`extension-modules`。" #: ../../extending/building.rst:21 msgid "Building C and C++ Extensions with setuptools" @@ -53,73 +52,5 @@ msgid "" "The :mod:`distutils` module, which was included in the standard library " "until Python 3.12, is now maintained as part of Setuptools." msgstr "" - -#~ msgid "" -#~ "To be importable, the shared library must be available " -#~ "on :envvar:`PYTHONPATH`, and must be named after the module name, with an " -#~ "appropriate extension. When using setuptools, the correct filename is " -#~ "generated automatically." -#~ msgstr "" -#~ "要能夠被引入,共用函式庫必須在 :envvar:`PYTHONPATH` 上可用,並且必須以模組" -#~ "名稱命名,並且必須有適當的副檔名。使用 setuptools 時,正確的檔名會自動產" -#~ "生。" - -#~ msgid "The initialization function has the signature:" -#~ msgstr "初始化函式具有簽名:" - -#~ msgid "" -#~ "It returns either a fully initialized module, or a :c:type:`PyModuleDef` " -#~ "instance. See :ref:`initializing-modules` for details." -#~ msgstr "" -#~ "它回傳一個完全初始化的模組,或一個 :c:type:`PyModuleDef` 實例。詳細資訊請" -#~ "參見 :ref:`initializing-modules`。" - -#~ msgid "" -#~ "For modules with ASCII-only names, the function must be " -#~ "named :samp:`PyInit_{}`, with ```` replaced by the name of " -#~ "the module. When using :ref:`multi-phase-initialization`, non-ASCII " -#~ "module names are allowed. In this case, the initialization function name " -#~ "is :samp:`PyInitU_{}`, with ```` encoded using Python's " -#~ "*punycode* encoding with hyphens replaced by underscores. In Python::" -#~ msgstr "" -#~ "對於僅包含 ASCII 名稱的模組,函式必須以 :samp:`PyInit_{}` 命名,其" -#~ "中 ```` 要替換為模組的名稱。當使用 :ref:`multi-phase-" -#~ "initialization` 時,允許非 ASCII 模組名稱。在這種情況下,初始化函式名稱" -#~ "是 :samp:`PyInitU_{}`,其中 ```` 使用 Python 的 *punycode* 編" -#~ "碼,並將連字符號替換為底線。在 Python 中: ::" - -#~ msgid "" -#~ "def initfunc_name(name):\n" -#~ " try:\n" -#~ " suffix = b'_' + name.encode('ascii')\n" -#~ " except UnicodeEncodeError:\n" -#~ " suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" -#~ " return b'PyInit' + suffix" -#~ msgstr "" -#~ "def initfunc_name(name):\n" -#~ " try:\n" -#~ " suffix = b'_' + name.encode('ascii')\n" -#~ " except UnicodeEncodeError:\n" -#~ " suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" -#~ " return b'PyInit' + suffix" - -#~ msgid "" -#~ "It is possible to export multiple modules from a single shared library by " -#~ "defining multiple initialization functions. However, importing them " -#~ "requires using symbolic links or a custom importer, because by default " -#~ "only the function corresponding to the filename is found. See the " -#~ "*\"Multiple modules in one library\"* section in :pep:`489` for details." -#~ msgstr "" -#~ "可以透過定義多個初始化函式,來從單一共用函式庫中匯出多個模組。然而要引入它" -#~ "們需要使用符號連結或自訂引入器,因為預設只會找到對應於檔名的函式。詳細資訊" -#~ "請參見 :pep:`489` 中的 *\"Multiple modules in one library\"* 部分。" - -#~ msgid "" -#~ "Python 3.12 and newer no longer come with distutils. Please refer to the " -#~ "``setuptools`` documentation at https://setuptools.readthedocs.io/en/" -#~ "latest/setuptools.html to learn more about how build and distribute C/C++ " -#~ "extensions with setuptools." -#~ msgstr "" -#~ "Python 3.12 與之後的版本不再帶有 distutils。請在 https://" -#~ "setuptools.readthedocs.io/en/latest/setuptools.html 上參閱 ``setuptools`` " -#~ "文件,以了解如何使用 setuptools 建置和發佈 C/C++ 擴充套件。" +"直到 Python 3.12 版本前,:mod:`distutils` 模組都被包含在標準函式庫中," +"現在是作為 Setuptools 的一部分來維護。" \ No newline at end of file diff --git a/extending/embedding.po b/extending/embedding.po index f08b001e48a..9f73a09dfe0 100644 --- a/extending/embedding.po +++ b/extending/embedding.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2018-05-23 14:09+0000\n" diff --git a/extending/extending.po b/extending/extending.po index 808fb602376..597ae13de89 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # Matt Wang , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-02-17 14:34+0000\n" diff --git a/extending/index.po b/extending/index.po index 757994de4f7..8b55a614933 100644 --- a/extending/index.po +++ b/extending/index.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2021-07-06 22:18+0800\n" diff --git a/extending/newtypes.po b/extending/newtypes.po index f3524b065d5..6ddb5552cfb 100644 --- a/extending/newtypes.po +++ b/extending/newtypes.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:34+0000\n" @@ -209,7 +208,6 @@ msgid "" msgstr "" #: ../../extending/newtypes.rst:72 -#, fuzzy msgid "" "static void\n" "newdatatype_dealloc(PyObject *op)\n" @@ -220,10 +218,11 @@ msgid "" "}" msgstr "" "static void\n" -"newdatatype_dealloc(newdatatypeobject *obj)\n" +"newdatatype_dealloc(PyObject *op)\n" "{\n" -" free(obj->obj_UnderlyingDatatypePtr);\n" -" Py_TYPE(obj)->tp_free((PyObject *)obj);\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" free(self->obj_UnderlyingDatatypePtr);\n" +" Py_TYPE(self)->tp_free(self);\n" "}" #: ../../extending/newtypes.rst:80 @@ -233,7 +232,6 @@ msgid "" msgstr "" #: ../../extending/newtypes.rst:83 -#, fuzzy msgid "" "static void\n" "newdatatype_dealloc(PyObject *op)\n" @@ -246,12 +244,13 @@ msgid "" "}" msgstr "" "static void\n" -"newdatatype_dealloc(newdatatypeobject *obj)\n" +"newdatatype_dealloc(PyObject *op)\n" "{\n" -" PyObject_GC_UnTrack(obj);\n" -" Py_CLEAR(obj->other_obj);\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" PyObject_GC_UnTrack(op);\n" +" Py_CLEAR(self->other_obj);\n" " ...\n" -" Py_TYPE(obj)->tp_free((PyObject *)obj);\n" +" Py_TYPE(self)->tp_free(self);\n" "}" #: ../../extending/newtypes.rst:97 @@ -354,7 +353,6 @@ msgid "" msgstr "" #: ../../extending/newtypes.rst:174 -#, fuzzy msgid "" "static PyObject *\n" "newdatatype_repr(PyObject *op)\n" @@ -365,10 +363,11 @@ msgid "" "}" msgstr "" "static PyObject *\n" -"newdatatype_repr(newdatatypeobject *obj)\n" +"newdatatype_repr(PyObject *op)\n" "{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" " return PyUnicode_FromFormat(\"Repr-ified_newdatatype{{size:%d}}\",\n" -" obj->obj_UnderlyingDatatypePtr->size);\n" +" self->obj_UnderlyingDatatypePtr->size);\n" "}" #: ../../extending/newtypes.rst:182 @@ -395,7 +394,6 @@ msgid "Here is a simple example::" msgstr "以下是個簡單的範例: ::" #: ../../extending/newtypes.rst:195 -#, fuzzy msgid "" "static PyObject *\n" "newdatatype_str(PyObject *op)\n" @@ -406,10 +404,11 @@ msgid "" "}" msgstr "" "static PyObject *\n" -"newdatatype_str(newdatatypeobject *obj)\n" +"newdatatype_str(PyObject *op)\n" "{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" " return PyUnicode_FromFormat(\"Stringified_newdatatype{{size:%d}}\",\n" -" obj->obj_UnderlyingDatatypePtr->size);\n" +" self->obj_UnderlyingDatatypePtr->size);\n" "}" #: ../../extending/newtypes.rst:206 @@ -778,7 +777,6 @@ msgid "" msgstr "" #: ../../extending/newtypes.rst:448 -#, fuzzy msgid "" "static Py_hash_t\n" "newdatatype_hash(PyObject *op)\n" @@ -793,12 +791,14 @@ msgid "" "}" msgstr "" "static Py_hash_t\n" -"newdatatype_hash(newdatatypeobject *obj)\n" +"newdatatype_hash(PyObject *op)\n" "{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" " Py_hash_t result;\n" -" result = obj->some_size + 32767 * obj->some_number;\n" -" if (result == -1)\n" -" result = -2;\n" +" result = self->some_size + 32767 * self->some_number;\n" +" if (result == -1) {\n" +" result = -2;\n" +" }\n" " return result;\n" "}" @@ -853,7 +853,6 @@ msgid "Here is a toy ``tp_call`` implementation::" msgstr "" #: ../../extending/newtypes.rst:489 -#, fuzzy msgid "" "static PyObject *\n" "newdatatype_call(PyObject *op, PyObject *args, PyObject *kwds)\n" @@ -875,8 +874,9 @@ msgid "" "}" msgstr "" "static PyObject *\n" -"newdatatype_call(newdatatypeobject *obj, PyObject *args, PyObject *kwds)\n" +"newdatatype_call(PyObject *op, PyObject *args, PyObject *kwds)\n" "{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" " PyObject *result;\n" " const char *arg1;\n" " const char *arg2;\n" @@ -887,7 +887,7 @@ msgstr "" " }\n" " result = PyUnicode_FromFormat(\n" " \"Returning -- value: [%d] arg1: [%s] arg2: [%s] arg3: [%s]\\n\",\n" -" obj->obj_UnderlyingDatatypePtr->size,\n" +" self->obj_UnderlyingDatatypePtr->size,\n" " arg1, arg2, arg3);\n" " return result;\n" "}" diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index cf1a681eaaa..73dfa0052db 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -1,8 +1,8 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" @@ -654,7 +654,6 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:254 -#, fuzzy msgid "" "static void\n" "Custom_dealloc(PyObject *op)\n" @@ -666,11 +665,12 @@ msgid "" "}" msgstr "" "static void\n" -"Custom_dealloc(CustomObject *self)\n" +"Custom_dealloc(PyObject *op)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " Py_XDECREF(self->first);\n" " Py_XDECREF(self->last);\n" -" Py_TYPE(self)->tp_free((PyObject *) self);\n" +" Py_TYPE(self)->tp_free(self);\n" "}" #: ../../extending/newtypes_tutorial.rst:263 @@ -678,9 +678,8 @@ msgid "which is assigned to the :c:member:`~PyTypeObject.tp_dealloc` member::" msgstr "" #: ../../extending/newtypes_tutorial.rst:265 -#, fuzzy msgid ".tp_dealloc = Custom_dealloc," -msgstr ".tp_dealloc = (destructor) Custom_dealloc," +msgstr ".tp_dealloc = Custom_dealloc," #: ../../extending/newtypes_tutorial.rst:267 msgid "" @@ -711,7 +710,6 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:289 -#, fuzzy msgid "" "Custom_dealloc(CustomObject *self)\n" "{\n" @@ -722,13 +720,14 @@ msgid "" "...\n" ".tp_dealloc = (destructor) Custom_dealloc," msgstr "" -"static void\n" "Custom_dealloc(CustomObject *self)\n" "{\n" " Py_XDECREF(self->first);\n" " Py_XDECREF(self->last);\n" " Py_TYPE(self)->tp_free((PyObject *) self);\n" -"}" +"}\n" +"...\n" +".tp_dealloc = (destructor) Custom_dealloc," #: ../../extending/newtypes_tutorial.rst:298 msgid "" @@ -868,7 +867,6 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:377 -#, fuzzy msgid "" "static int\n" "Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" @@ -898,8 +896,9 @@ msgid "" "}" msgstr "" "static int\n" -"Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" " PyObject *first = NULL, *last = NULL, *tmp;\n" "\n" @@ -928,9 +927,8 @@ msgid "by filling the :c:member:`~PyTypeObject.tp_init` slot. ::" msgstr "" #: ../../extending/newtypes_tutorial.rst:406 -#, fuzzy msgid ".tp_init = Custom_init," -msgstr ".tp_init = (initproc) Custom_init," +msgstr ".tp_init = Custom_init," #: ../../extending/newtypes_tutorial.rst:408 msgid "" @@ -1053,7 +1051,6 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:477 -#, fuzzy msgid "" "static PyObject *\n" "Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))\n" @@ -1071,8 +1068,9 @@ msgid "" "}" msgstr "" "static PyObject *\n" -"Custom_name(CustomObject *self, PyObject *Py_UNUSED(ignored))\n" +"Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " if (self->first == NULL) {\n" " PyErr_SetString(PyExc_AttributeError, \"first\");\n" " return NULL;\n" @@ -1497,7 +1495,6 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:638 -#, fuzzy msgid "" "static int\n" "Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" @@ -1527,12 +1524,13 @@ msgid "" "}" msgstr "" "static int\n" -"Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" " PyObject *first = NULL, *last = NULL, *tmp;\n" "\n" -" if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|OOi\", kwlist,\n" +" if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|UUi\", kwlist,\n" " &first, &last,\n" " &self->number))\n" " return -1;\n" @@ -1541,13 +1539,13 @@ msgstr "" " tmp = self->first;\n" " Py_INCREF(first);\n" " self->first = first;\n" -" Py_XDECREF(tmp);\n" +" Py_DECREF(tmp);\n" " }\n" " if (last) {\n" " tmp = self->last;\n" " Py_INCREF(last);\n" " self->last = last;\n" -" Py_XDECREF(tmp);\n" +" Py_DECREF(tmp);\n" " }\n" " return 0;\n" "}" @@ -1851,7 +1849,6 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:719 -#, fuzzy msgid "" "static int\n" "Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" @@ -1872,8 +1869,9 @@ msgid "" "}" msgstr "" "static int\n" -"Custom_traverse(CustomObject *self, visitproc visit, void *arg)\n" +"Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " int vret;\n" " if (self->first) {\n" " vret = visit(self->first, arg);\n" @@ -1905,7 +1903,6 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:747 -#, fuzzy msgid "" "static int\n" "Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" @@ -1917,8 +1914,9 @@ msgid "" "}" msgstr "" "static int\n" -"Custom_traverse(CustomObject *self, visitproc visit, void *arg)\n" +"Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " Py_VISIT(self->first);\n" " Py_VISIT(self->last);\n" " return 0;\n" @@ -1937,7 +1935,6 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:763 -#, fuzzy msgid "" "static int\n" "Custom_clear(PyObject *op)\n" @@ -1949,8 +1946,9 @@ msgid "" "}" msgstr "" "static int\n" -"Custom_clear(CustomObject *self)\n" +"Custom_clear(PyObject *op)\n" "{\n" +" CustomObject *self = (CustomObject *) op;\n" " Py_CLEAR(self->first);\n" " Py_CLEAR(self->last);\n" " return 0;\n" @@ -2000,7 +1998,6 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:798 -#, fuzzy msgid "" "static void\n" "Custom_dealloc(PyObject *op)\n" @@ -2011,11 +2008,11 @@ msgid "" "}" msgstr "" "static void\n" -"Custom_dealloc(CustomObject *self)\n" +"Custom_dealloc(PyObject *op)\n" "{\n" -" PyObject_GC_UnTrack(self);\n" -" Custom_clear(self);\n" -" Py_TYPE(self)->tp_free((PyObject *) self);\n" +" PyObject_GC_UnTrack(op);\n" +" (void)Custom_clear(op);\n" +" Py_TYPE(op)->tp_free(op);\n" "}" #: ../../extending/newtypes_tutorial.rst:806 @@ -2197,7 +2194,6 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:858 -#, fuzzy msgid "" "static int\n" "SubList_init(PyObject *op, PyObject *args, PyObject *kwds)\n" @@ -2210,9 +2206,10 @@ msgid "" "}" msgstr "" "static int\n" -"SubList_init(SubListObject *self, PyObject *args, PyObject *kwds)\n" +"SubList_init(PyObject *op, PyObject *args, PyObject *kwds)\n" "{\n" -" if (PyList_Type.tp_init((PyObject *) self, args, kwds) < 0)\n" +" SubListObject *self = (SubListObject *) op;\n" +" if (PyList_Type.tp_init(op, args, kwds) < 0)\n" " return -1;\n" " self->state = 0;\n" " return 0;\n" diff --git a/extending/windows.po b/extending/windows.po index a98c46d3b49..39a4c461b15 100644 --- a/extending/windows.po +++ b/extending/windows.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" @@ -178,13 +177,12 @@ msgid "" msgstr "" #: ../../extending/windows.rst:129 -#, fuzzy msgid "" "cl /LD /I/python/include spam.c\n" "cl /LD /I/python/include ni.c spam.lib" msgstr "" -"cl /LD /I/python/include spam.c ../libs/pythonXY.lib\n" -"cl /LD /I/python/include ni.c spam.lib ../libs/pythonXY.lib" +"cl /LD /I/python/include spam.c\n" +"cl /LD /I/python/include ni.c spam.lib" #: ../../extending/windows.rst:132 msgid "" @@ -208,13 +206,12 @@ msgid "" msgstr "" #: ../../extending/windows.rst:147 -#, fuzzy msgid "" "cl /LD /DPy_NO_LINK_LIB /I/python/include spam.c ../libs/pythonXY.lib\n" "cl /LD /DPy_NO_LINK_LIB /I/python/include ni.c spam.lib ../libs/pythonXY.lib" msgstr "" -"cl /LD /I/python/include spam.c ../libs/pythonXY.lib\n" -"cl /LD /I/python/include ni.c spam.lib ../libs/pythonXY.lib" +"cl /LD /DPy_NO_LINK_LIB /I/python/include spam.c ../libs/pythonXY.lib\n" +"cl /LD /DPy_NO_LINK_LIB /I/python/include ni.c spam.lib ../libs/pythonXY.lib" #: ../../extending/windows.rst:150 msgid "" diff --git a/faq/design.po b/faq/design.po index daaf57a38be..ed94fb70691 100644 --- a/faq/design.po +++ b/faq/design.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # Steven Hsu , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-08-31 11:34+0800\n" @@ -1172,7 +1172,6 @@ msgstr "" "用來建構詳盡徹底的測試套件來測試模組裡的每一行程式碼。" #: ../../faq/design.rst:589 -#, fuzzy msgid "" "An appropriate testing discipline can help build large complex applications " "in Python as well as having interface specifications would. In fact, it can " @@ -1185,8 +1184,8 @@ msgid "" msgstr "" "就像介面規範一樣,一個適當的測試規則在建造大型又複雜的 Python 應用程式時可以" "幫上忙。事實上,他可能可以有更好的表現,因為介面規範無法測試程式的特定屬性。" -"舉例來說,:meth:`!list.append` 方法應該要在某個內部的串列最後面加上新的元素," -"而介面規範沒辦法測試你的 :meth:`!list.append` 是不是真的有正確的實作,但這在" +"舉例來說,:meth:`list.append` 方法應該要在某個內部的串列最後面加上新的元素," +"而介面規範沒辦法測試你的 :meth:`list.append` 是不是真的有正確的實作,但這在" "測試套件裡是件很簡單的事。" #: ../../faq/design.rst:597 diff --git a/faq/extending.po b/faq/extending.po index 1b0e3995d4e..8eef4ca9250 100644 --- a/faq/extending.po +++ b/faq/extending.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2023-02-18 13:08+0800\n" @@ -76,7 +75,6 @@ msgid "How can I execute arbitrary Python statements from C?" msgstr "如何從 C 執行任意 Python 陳述式?" #: ../../faq/extending.rst:48 -#, fuzzy msgid "" "The highest-level function to do this is :c:func:`PyRun_SimpleString` which " "takes a single string argument to be executed in the context of the module " @@ -85,53 +83,49 @@ msgid "" "func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` in " "``Python/pythonrun.c``." msgstr "" -"執行此操作的最高級別函式是 :c:func:`PyRun_SimpleString`,它採用單個字串引數在" -"模組 ``__main__`` 的上下文中執行,並回傳 ``0`` 表示成功,``- 1`` 發生例外時" -"(包括 :exc:`SyntaxError`)。如果你想要更多的控制,使用 :c:func:" -"`PyRun_String`;在 ``Python/pythonrun.c`` 中查看 :c:func:" -"`PyRun_SimpleString` 的原始碼。" +"執行此操作的最高階函式是 :c:func:`PyRun_SimpleString`,它接受一個要在模組 " +"``__main__`` 的情境中執行的單一字串引數,成功時回傳 ``0``,發生例外(包" +"括 :exc:`SyntaxError`)時回傳 ``-1``。如果你想要更多控制,請使用 :c:" +"func:`PyRun_String`;請參閱 ``Python/pythonrun.c`` 中 :c:func:`PyRun_SimpleString` 的" +"原始碼。" #: ../../faq/extending.rst:57 -#, fuzzy msgid "How can I evaluate an arbitrary Python expression from C?" msgstr "如何計算來自 C 的任意 Python 運算式?" #: ../../faq/extending.rst:59 -#, fuzzy msgid "" "Call the function :c:func:`PyRun_String` from the previous question with the " "start symbol :c:data:`Py_eval_input`; it parses an expression, evaluates it " "and returns its value." msgstr "" -"呼叫上一個問題中的函式 :c:func:`PyRun_String` 開始符號 :c:data:" -"`Py_eval_input`;它解析一個運算式,對其求值並回傳它的值。" +"呼叫前一個問題中的 :c:func:`PyRun_String` 函式,並使用起始符號 :c:" +"data:`Py_eval_input`;它會剖析一個運算式,計算它並回傳它的值。" #: ../../faq/extending.rst:65 msgid "How do I extract C values from a Python object?" msgstr "如何從 Python 物件中提取 C 值?" #: ../../faq/extending.rst:67 -#, fuzzy msgid "" "That depends on the object's type. If it's a tuple, :c:func:`PyTuple_Size` " "returns its length and :c:func:`PyTuple_GetItem` returns the item at a " "specified index. Lists have similar functions, :c:func:`PyList_Size` and :c:" "func:`PyList_GetItem`." msgstr "" -"這取決於物件的型別。如果它是一個元組,:c:func:`PyTuple_Size` 回傳它的長度,:" -"c:func:`PyTuple_GetItem` 回傳指定索引的項目。列表具有類似的函式:c:func:" +"這取決於物件的型別。如果它是一個元組,:c:func:`PyTuple_Size` 會回傳它的長度,:" +"c:func:`PyTuple_GetItem` 則回傳指定索引的項目。串列具有類似的函式 :c:func:" "`PyList_Size` 和 :c:func:`PyList_GetItem`。" #: ../../faq/extending.rst:72 -#, fuzzy msgid "" "For bytes, :c:func:`PyBytes_Size` returns its length and :c:func:" "`PyBytes_AsStringAndSize` provides a pointer to its value and its length. " "Note that Python bytes objects may contain null bytes so C's :c:func:`!" "strlen` should not be used." msgstr "" -"對於位元組,:c:func:`PyBytes_Size` 回傳它的長度,:c:func:" -"`PyBytes_AsStringAndSize` 提供指向它的值和長度的指標。請注意,Python 位元組物" +"對於位元組,:c:func:`PyBytes_Size` 會回傳它的長度,:c:func:" +"`PyBytes_AsStringAndSize` 則提供指向該值與該長度的指標。請注意,Python 位元組物" "件可能包含空位元組,因此不應使用 C 的 :c:func:`!strlen`。" #: ../../faq/extending.rst:77 @@ -144,7 +138,6 @@ msgstr "" "`PyBytes_Check`、:c:func:`PyTuple_Check`、:c:func:`PyList_Check` 等函式。" #: ../../faq/extending.rst:80 -#, fuzzy msgid "" "There is also a high-level API to Python objects which is provided by the so-" "called 'abstract' interface -- read ``Include/abstract.h`` for further " @@ -153,10 +146,10 @@ msgid "" "as many other useful protocols such as numbers (:c:func:`PyNumber_Index` et " "al.) and mappings in the PyMapping APIs." msgstr "" -"還有一個針對 Python 物件的高級 API,它由所謂的「抽象」介面提供——閱讀 " -"``Include/abstract.h`` 了解更多詳細資訊。它允許使用 :c:func:" -"`PySequence_Length`、:c:func:`PySequence_GetItem` 等呼叫以及許多其他有用的協" -"議(例如數字 (:c:func:`PyNumber_Index) ` 等)和 PyMapping API 中的對映。" +"還有一個針對 Python 物件的高階 API,它由所謂的「抽象」介面所提供 —— 請閱讀 " +"``Include/abstract.h`` 以了解更多詳細資訊。它允許使用 :c:func:`PySequence_Length`" +"、:c:func:`PySequence_GetItem` 等函式的呼叫以及許多其他有用的協定,例如數值" +"(:c:func:`PyNumber_Index` 等)和 PyMapping API 中的對映,來與任何類型的 Python 序列做介接。" #: ../../faq/extending.rst:89 msgid "How do I use Py_BuildValue() to create a tuple of arbitrary length?" @@ -171,7 +164,6 @@ msgid "How do I call an object's method from C?" msgstr "如何從 C 呼叫物件的方法?" #: ../../faq/extending.rst:97 -#, fuzzy msgid "" "The :c:func:`PyObject_CallMethod` function can be used to call an arbitrary " "method of an object. The parameters are the object, the name of the method " @@ -179,7 +171,7 @@ msgid "" "the argument values::" msgstr "" ":c:func:`PyObject_CallMethod` 函式可用於呼叫物件的任意方法。參數是物件、要呼" -"叫的方法的名稱、與 :c:func:`Py_BuildValue` 一起使用的格式字串,以及引數" +"叫的方法名稱、與 :c:func:`Py_BuildValue` 一起使用的格式字串,以及引數" "值: ::" #: ../../faq/extending.rst:102 @@ -245,16 +237,15 @@ msgid "" msgstr "我如何捕捉 PyErr_Print() 的輸出(或任何印出到 stdout/stderr 的東西)?" #: ../../faq/extending.rst:129 -#, fuzzy msgid "" "In Python code, define an object that supports the ``write()`` method. " "Assign this object to :data:`sys.stdout` and :data:`sys.stderr`. Call " "print_error, or just allow the standard traceback mechanism to work. Then, " "the output will go wherever your ``write()`` method sends it." msgstr "" -"在 Python 程式碼中,定義一個支援 ``write()`` 方法的物件。將此物件分配給 :" +"在 Python 程式碼中定義一個支援 ``write()`` 方法的物件。將此物件分配給 :" "data:`sys.stdout` 和 :data:`sys.stderr`。呼叫 print_error,或者只允許標準的回" -"溯機制起作用。然後,輸出將到達你的 ``write()`` 方法發送它的任何地方。" +"溯機制起作用。然後,輸出將會傳送到你的 ``write()`` 方法所指定的位置。" #: ../../faq/extending.rst:134 msgid "The easiest way to do this is to use the :class:`io.StringIO` class:" @@ -349,11 +340,10 @@ msgid "attr = PyObject_GetAttrString(module, \"\");" msgstr "attr = PyObject_GetAttrString(module, \"\");" #: ../../faq/extending.rst:184 -#, fuzzy msgid "" "Calling :c:func:`PyObject_SetAttrString` to assign to variables in the " "module also works." -msgstr "呼叫 :c:func:`PyObject_SetAttrString` 以分配給模組中的變數也可以。" +msgstr "呼叫 :c:func:`PyObject_SetAttrString` 來分配模組中的變數也有效。" #: ../../faq/extending.rst:189 msgid "How do I interface to C++ objects from Python?" @@ -382,7 +372,6 @@ msgid "I added a module using the Setup file and the make fails; why?" msgstr "我使用安裝檔案新增了一個模組,但 make 失敗了;為什麼?" #: ../../faq/extending.rst:203 -#, fuzzy msgid "" "Setup must end in a newline, if there is no newline there, the build process " "fails. (Fixing this requires some ugly shell script hackery, and this bug " @@ -396,7 +385,6 @@ msgid "How do I debug an extension?" msgstr "如何為擴充套件除錯?" #: ../../faq/extending.rst:211 -#, fuzzy msgid "" "When using GDB with dynamically loaded extensions, you can't set a " "breakpoint in your extension until your extension is loaded." @@ -433,13 +421,10 @@ msgstr "" "我想在我的 Linux 系統上編譯一個 Python 模組,但是缺少一些檔案。為什麼?" #: ../../faq/extending.rst:234 -#, fuzzy msgid "" "Most packaged versions of Python omit some files required for compiling " "Python extensions." -msgstr "" -"大多數打包版本的 Python 不包含 :file:`/usr/lib/python2.{x}/config/` 目錄,該" -"目錄包含編譯 Python 擴充所需的各種檔案。" +msgstr "大多數打包版本的 Python 省略了編譯 Python 擴充所需的一些檔案。" #: ../../faq/extending.rst:237 msgid "For Red Hat, install the python3-devel RPM to get the necessary files." @@ -454,7 +439,6 @@ msgid "How do I tell \"incomplete input\" from \"invalid input\"?" msgstr "如何從「無效輸入」區分出「不完整輸入」?" #: ../../faq/extending.rst:244 -#, fuzzy msgid "" "Sometimes you want to emulate the Python interactive interpreter's behavior, " "where it gives you a continuation prompt when the input is incomplete (e.g. " @@ -462,9 +446,9 @@ msgid "" "parentheses or triple string quotes), but it gives you a syntax error " "message immediately when the input is invalid." msgstr "" -"有時你想模擬 Python 交互式直譯器的行為,當輸入不完整時它會給你一個繼續提示" -"(例如,你鍵入了 \"if\" 陳述句的開頭或者你沒有關閉你的括號或三重字串引號)," -"但是當輸入無效時,它會立即為你提供語法錯誤消息。" +"有時你會想模擬 Python 交互式直譯器的行為,當輸入不完整時(例如,當你輸入了 \"if\" 陳述式的" +"開頭或者你沒有關閉你的括號或三重字串引號)它會給你一個繼續提示字元," +"但是當輸入無效時,它會立即為你提供語法錯誤訊息。" #: ../../faq/extending.rst:250 msgid "" @@ -475,7 +459,6 @@ msgstr "" "為。像是 IDLE 就有使用它。" #: ../../faq/extending.rst:253 -#, fuzzy msgid "" "The easiest way to do it in C is to call :c:func:`PyRun_InteractiveLoop` " "(perhaps in a separate thread) and let the Python interpreter handle the " @@ -483,25 +466,24 @@ msgid "" "to point at your custom input function. See ``Modules/readline.c`` and " "``Parser/myreadline.c`` for more hints." msgstr "" -"在 C 中執行此操作的最簡單方法是呼叫:c:func:`PyRun_InteractiveLoop`(可能在單" +"在 C 中執行此操作的最簡單方法是呼叫 :c:func:`PyRun_InteractiveLoop`\\ (可能是在單" "獨的執行緒中)並讓 Python 直譯器為你處理輸入。你還可以將 :c:func:" "`PyOS_ReadlineFunctionPointer` 設定為指向你的自定義輸入函式。有關更多提示,請" -"參閱``Modules/readline.c`` 和``Parser/myreadline.c``。" +"參閱 ``Modules/readline.c`` 和 ``Parser/myreadline.c``。" #: ../../faq/extending.rst:260 msgid "How do I find undefined g++ symbols __builtin_new or __pure_virtual?" msgstr "如何找到未定義的 g++ 符號 __builtin_new 或 __pure_virtual?" #: ../../faq/extending.rst:262 -#, fuzzy msgid "" "To dynamically load g++ extension modules, you must recompile Python, relink " "it using g++ (change LINKCC in the Python Modules Makefile), and link your " "extension module using g++ (e.g., ``g++ -shared -o mymodule.so mymodule.o``)." msgstr "" -"要動態載入 g++ 擴充模組,你必須重新編譯 Python,使用 g++ 重新鏈接它(更改 " -"Python 模組 Makefile 中的 LINKCC),並使用 g++ 鏈接你的擴充模組(例如,``g++ " -"-shared -o mymodule.so mymodule.o` `)。" +"要動態載入 g++ 擴充模組,你必須重新編譯 Python,並使用 g++ 重新鏈接它(更改 " +"Python 模組 Makefile 中的 LINKCC),且使用 g++ 鏈接你的擴充模組(例如,``g++ " +"-shared -o mymodule.so mymodule.o``)。" #: ../../faq/extending.rst:268 msgid "" diff --git a/faq/general.po b/faq/general.po index f32417f5f03..16c2897ed61 100644 --- a/faq/general.po +++ b/faq/general.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # Steven Hsu , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-06-23 16:56+0800\n" diff --git a/faq/gui.po b/faq/gui.po index 98bd3c188e1..4d0009f175c 100644 --- a/faq/gui.po +++ b/faq/gui.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Steven Hsu, 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-07-02 17:41+0800\n" diff --git a/faq/index.po b/faq/index.po index 37bec953169..914e8e08c4c 100644 --- a/faq/index.po +++ b/faq/index.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Adrian Liaw , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/faq/installed.po b/faq/installed.po index 260bb53d3cc..f6a7bc424f6 100644 --- a/faq/installed.po +++ b/faq/installed.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-24 00:11+0000\n" "PO-Revision-Date: 2021-12-09 21:50+0800\n" diff --git a/faq/library.po b/faq/library.po index fc5cdbebc16..605d9d59d05 100644 --- a/faq/library.po +++ b/faq/library.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-02-18 13:22+0800\n" @@ -37,26 +37,24 @@ msgid "How do I find a module or application to perform task X?" msgstr "我如何找到執行任務 X 的模組或應用程式?" #: ../../faq/library.rst:17 -#, fuzzy msgid "" "Check :ref:`the Library Reference ` to see if there's a " "relevant standard library module. (Eventually you'll learn what's in the " "standard library and will be able to skip this step.)" msgstr "" -"檢查 :ref:`函式庫參考 ` 以查看是否有相關的標準函式庫模組。 " -"(最終你將了解標準函式庫中的內容,並且能夠跳過這一步。)" +"查看\\ :ref:`函式庫參照 `\\ 以了解是否有相關的標準函式庫模組。 " +"(當你熟悉標準函式庫中的內容後就可以能跳過這一步。)" #: ../../faq/library.rst:21 -#, fuzzy msgid "" "For third-party packages, search the `Python Package Index `_ or try `Google `_ or another web search " "engine. Searching for \"Python\" plus a keyword or two for your topic of " "interest will usually find something helpful." msgstr "" -"對於第三方包,搜尋`Python 包索引`_ 或嘗試`Google `_ 或其他網路搜尋引擎。搜尋 \"Python\" 加上你感興趣的主題的一" -"兩個關鍵字通常會找到有用的東西。" +"對於第三方套件,搜尋 `Python 套件索引 `_\\ 或嘗試使用 `Google " +"`_ 或其他網路搜尋引擎。搜尋 \"Python\" 加上你感興趣主題的一" +"兩個關鍵字,通常能夠找到有用的東西。" #: ../../faq/library.rst:28 msgid "Where is the math.py (socket.py, regex.py, etc.) source file?" @@ -135,11 +133,10 @@ msgid "#!/usr/local/bin/python" msgstr "#!/usr/local/bin/python" #: ../../faq/library.rst:61 -#, fuzzy msgid "" "as the very first line of your file, using the pathname for where the Python " "interpreter is installed on your platform." -msgstr "作為檔案的第一行,使用 Python 直譯器在你的平台上的安裝位置的路徑名。" +msgstr "作為檔案的第一行,使用 Python 直譯器安裝在你的平台上的路徑名稱。" #: ../../faq/library.rst:64 #, fuzzy @@ -235,22 +232,20 @@ msgid "Is there an equivalent to C's onexit() in Python?" msgstr "Python 中是否有等同於 C 的 onexit() 的函式?" #: ../../faq/library.rst:113 -#, fuzzy msgid "" "The :mod:`atexit` module provides a register function that is similar to " "C's :c:func:`!onexit`." -msgstr ":mod:`atexit` 模組提供了一個類似於 C :c:func:`onexit` 的註冊器函式。" +msgstr ":mod:`atexit` 模組提供了一個類似於 C :c:func:`!onexit` 的註冊函式。" #: ../../faq/library.rst:118 msgid "Why don't my signal handlers work?" msgstr "為什麼我的訊號處理程式不起作用?" #: ../../faq/library.rst:120 -#, fuzzy msgid "" "The most common problem is that the signal handler is declared with the " "wrong argument list. It is called as ::" -msgstr "最常見的問題是訊號處理程式是用錯誤的引數列表聲明的。它被稱為: ::" +msgstr "最常見的問題是訊號處理程式是用錯誤的引數串列聲明的。它以以下形式來呼叫: ::" #: ../../faq/library.rst:123 msgid "handler(signum, frame)" @@ -287,12 +282,11 @@ msgstr "" "它們,將輸出與文件字串中給出的預期輸出進行比較。" #: ../../faq/library.rst:141 -#, fuzzy msgid "" "The :mod:`unittest` module is a fancier testing framework modelled on Java " "and Smalltalk testing frameworks." msgstr "" -":mod:`unittest` 模組是一個更高階的測試框架,它以 Java 和 Smalltalk 測試框架為" +":mod:`unittest` 模組是一個更炫目的測試框架,它以 Java 和 Smalltalk 測試框架為" "模型。" #: ../../faq/library.rst:144 @@ -394,13 +388,12 @@ msgid "How do I get a single keypress at a time?" msgstr "我如何一次獲得一個按鍵?" #: ../../faq/library.rst:190 -#, fuzzy msgid "" "For Unix variants there are several solutions. It's straightforward to do " "this using curses, but curses is a fairly large module to learn." msgstr "" -"對於 Unix 變體,有幾種解決方案。使用 curses 執行此操作很簡單,但 curses 是一" -"個需要學習的相當大的模組。" +"對於 Unix 變體有幾種解決方案。使用 curses 執行此操作很直觀,但 curses 是一" +"個學習成本較大的模組。" #: ../../faq/library.rst:234 msgid "Threads" @@ -435,12 +428,11 @@ msgstr "" "間做任何工作。" #: ../../faq/library.rst:250 -#, fuzzy msgid "" "A simple fix is to add a sleep to the end of the program that's long enough " "for all the threads to finish::" msgstr "" -"一個簡單的修復方法是在程式末尾新增一個足夠長的睡眠,讓所有執行緒都完成: ::" +"一個簡單的修復方式是在程式末尾新增一個足夠長的 sleep,讓所有執行緒都完成: ::" #: ../../faq/library.rst:253 msgid "" @@ -480,9 +472,8 @@ msgstr "" "緒。" #: ../../faq/library.rst:269 -#, fuzzy msgid "A simple fix is to add a tiny sleep to the start of the run function::" -msgstr "一個簡單的修復方法是在運行函式的開頭新增一個小睡眠: ::" +msgstr "一個簡單的修復方式是在運行函式的開頭新增一個小 sleep: ::" #: ../../faq/library.rst:271 msgid "" @@ -637,9 +628,8 @@ msgstr "" "強大的介面。" #: ../../faq/library.rst:363 -#, fuzzy msgid "What kinds of global value mutation are thread-safe?" -msgstr "什麼樣的全域值突變是執行緒安全的?" +msgstr "什麼樣的全域值變化是執行緒安全的?" #: ../../faq/library.rst:365 #, fuzzy @@ -879,15 +869,14 @@ msgstr "" "數)。" #: ../../faq/library.rst:484 -#, fuzzy msgid "" "The :mod:`shutil` module also contains a number of functions to work on " "files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, " "and :func:`~shutil.rmtree`." msgstr "" -":mod:`shutil` 模組還包含許多用於處理檔案的函式,包" -"括:func:`~shutil.copyfile`、:func:`~shutil.copytree` " -"和:func:`~shutil.rmtree`。" +":mod:`shutil` 模組還包含許多用於檔案處理的函式,包" +"括 :func:`~shutil.copyfile`、:func:`~shutil.copytree` " +"和 :func:`~shutil.rmtree`。" #: ../../faq/library.rst:490 msgid "How do I copy a file?" @@ -1096,25 +1085,23 @@ msgstr "" "Python 有許多模組可以幫助你構建伺服器端和用戶端 Web 系統。" #: ../../faq/library.rst:596 -#, fuzzy msgid "" "A summary of available frameworks is maintained by Paul Boddie at https://" "wiki.python.org/moin/WebProgramming\\ ." msgstr "" -"可用框架的摘要由 Paul Boddie 在 https://wiki.python.org/moin/" -"WebProgramming\\ 維護。" +"Paul Boddie 有在 https://wiki.python.org/moin/" +"WebProgramming\\ 維護可用框架的摘要。" #: ../../faq/library.rst:601 msgid "What module should I use to help with generating HTML?" msgstr "我應該使用什麼模組來輔助產生 HTML?" #: ../../faq/library.rst:605 -#, fuzzy msgid "" "You can find a collection of useful links on the `Web Programming wiki page " "`_." msgstr "" -"你可以在 \"Web 編寫程式維基頁面 \" 上找到一組有用的鏈接。" #: ../../faq/library.rst:610 @@ -1171,16 +1158,15 @@ msgstr "" "server.quit()" #: ../../faq/library.rst:634 -#, fuzzy msgid "" "A Unix-only alternative uses sendmail. The location of the sendmail program " "varies between systems; sometimes it is ``/usr/lib/sendmail``, sometimes ``/" "usr/sbin/sendmail``. The sendmail manual page will help you out. Here's " "some sample code::" msgstr "" -"一個僅適用於 Unix 的替代方案使用 sendmail。 sendmail 程式的位置因係統而異;有" -"時是 \"/usr/lib/sendmail\" ,有時是 \"/usr/sbin/sendmail\" 。 sendmail 手冊頁" -"將幫助你。這是一些示例程式碼: ::" +"使用 sendmail 是僅適用於 Unix 的替代方案。sendmail 程式的位置會因系統而異;有" +"時是 ``/usr/lib/sendmail``,有時是 ``/usr/sbin/sendmail``。sendmail 使用手冊" +"將能夠幫助你。這是一些範例程式碼: ::" #: ../../faq/library.rst:639 msgid "" @@ -1199,7 +1185,6 @@ msgid "" msgstr "" #: ../../faq/library.rst:654 -#, fuzzy msgid "How do I avoid blocking in the connect() method of a socket?" msgstr "如何避免阻塞 socket 的 connect() 方法?" @@ -1270,8 +1255,8 @@ msgid "" "the :mod:`sqlite3` module, which provides a lightweight disk-based " "relational database." msgstr "" -"基於磁盤的雜湊介面,例如 :mod:`DBM ` 和 :mod:`GDBM ` 也包" -"含在標準 Python 中。還有 :mod:`sqlite3` 模組,它提供了一個輕量級的基於磁盤的" +"基於磁碟的雜湊介面,例如 :mod:`DBM ` 和 :mod:`GDBM ` 也包" +"含在標準 Python 中。還有 :mod:`sqlite3` 模組,它提供了一個輕量級的基於磁碟的" "關係資料庫。" #: ../../faq/library.rst:695 diff --git a/faq/programming.po b/faq/programming.po index d06dc53f9ec..3eb7dcd192a 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # hsiao yi , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-04-25 14:17+0800\n" diff --git a/faq/windows.po b/faq/windows.po index 34374de463f..9c39108b538 100644 --- a/faq/windows.po +++ b/faq/windows.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-11-09 17:25+0800\n" diff --git a/glossary.po b/glossary.po index 5b32ce95462..72d8b77df6e 100644 --- a/glossary.po +++ b/glossary.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # Translators: # Steven Hsu , 2021-2022 # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" @@ -87,9 +87,8 @@ msgstr "" "組)。你可以使用 :mod:`abc` 模組建立自己的 ABC。" #: ../../glossary.rst:38 -#, fuzzy msgid "annotate function" -msgstr "annotation(註釋)" +msgstr "annotate function(註釋函式)" #: ../../glossary.rst:40 msgid "" @@ -113,27 +112,24 @@ msgstr "" "為 :term:`type hint`\\ (型別提示)。" #: ../../glossary.rst:50 -#, fuzzy msgid "" "Annotations of local variables cannot be accessed at runtime, but " "annotations of global variables, class attributes, and functions can be " "retrieved by calling :func:`annotationlib.get_annotations` on modules, " "classes, and functions, respectively." msgstr "" -"在執行環境 (runtime),區域變數的註釋無法被存取,但全域變數、class 屬性和函式" -"的註解,會分別被儲存在模組、class 和函式的 :attr:`__annotations__` 特殊屬性" -"中。" +"在 runtime 的區域變數註釋無法被存取,但全域變數、類別屬性和函式" +"的註釋,分別能夠以對模組、類別和函式呼叫 :func:`annotationlib.get_annotations` 來取得。" #: ../../glossary.rst:55 -#, fuzzy msgid "" "See :term:`variable annotation`, :term:`function " "annotation`, :pep:`484`, :pep:`526`, and :pep:`649`, which describe this " "functionality. Also see :ref:`annotations-howto` for best practices on " "working with annotations." msgstr "" -"請參閱 :term:`variable annotation`、:term:`function annotation`、:pep:`484` " -"和 :pep:`526`,這些章節皆有此功能的說明。關於註釋的最佳實踐方法也請參" +"請參閱 :term:`variable annotation`、:term:`function annotation`、:pep:`484`" +"、:pep:`526` 和 :pep:`649`,這些章節皆有此功能的說明。關於註釋的最佳實踐方法也請參" "閱 :ref:`annotations-howto`。" #: ../../glossary.rst:59 @@ -1025,9 +1021,8 @@ msgstr "" "的 :term:`LBYL` 風格形成了對比。" #: ../../glossary.rst:450 -#, fuzzy msgid "evaluate function" -msgstr "key function(鍵函式)" +msgstr "evaluate function(求值函式)" #: ../../glossary.rst:452 msgid "" @@ -1073,18 +1068,16 @@ msgid "f-string" msgstr "f-string(f 字串)" #: ../../glossary.rst:469 -#, fuzzy msgid "f-strings" -msgstr "f-string(f 字串)" +msgstr "f-strings(f 字串)" #: ../../glossary.rst:471 -#, fuzzy msgid "" "String literals prefixed with ``f`` or ``F`` are commonly called \"f-" "strings\" which is short for :ref:`formatted string literals `. " "See also :pep:`498`." msgstr "" -"以 ``'f'`` 或 ``'F'`` 為前綴的字串文本通常被稱為「f 字串」,它是\\ :ref:`格式" +"以 ``f`` 或 ``F`` 為前綴的字串文本通常被稱為「f 字串」,它是\\ :ref:`格式" "化的字串文本 `\\ 的縮寫。另請參閱 :pep:`498`。" #: ../../glossary.rst:474 @@ -2862,7 +2855,6 @@ msgstr "" "鍵,而不是整數。" #: ../../glossary.rst:1249 -#, fuzzy msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " "richer interface that goes beyond just :meth:`~object.__getitem__` " @@ -2875,8 +2867,7 @@ msgid "" msgstr "" "抽象基底類別 (abstract base class) :class:`collections.abc.Sequence` 定義了一" "個更加豐富的介面,並不僅止於 :meth:`~object.__getitem__` " -"和 :meth:`~object.__len__`,還增加了 :meth:`!count`、:meth:`!" -"index`、:meth:`~object.__contains__` 和 :meth:`~object.__reversed__`。實作此" +"和 :meth:`~object.__len__`,還增加了 :meth:`~sequence.count`、:meth:`~sequence.index`、:meth:`~object.__contains__` 和 :meth:`~object.__reversed__`。實作此" "擴充介面的型別,可以使用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於" "序列方法的文件,請見\\ :ref:`常見序列操作 `。" @@ -3056,23 +3047,20 @@ msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" #: ../../glossary.rst:1331 -#, fuzzy msgid "t-string" -msgstr "f-string(f 字串)" +msgstr "t-string(t 字串)" #: ../../glossary.rst:1332 -#, fuzzy msgid "t-strings" -msgstr "f-string(f 字串)" +msgstr "t-strings(t 字串)" #: ../../glossary.rst:1334 -#, fuzzy msgid "" "String literals prefixed with ``t`` or ``T`` are commonly called \"t-" "strings\" which is short for :ref:`template string literals `." msgstr "" -"以 ``'f'`` 或 ``'F'`` 為前綴的字串文本通常被稱為「f 字串」,它是\\ :ref:`格式" -"化的字串文本 `\\ 的縮寫。另請參閱 :pep:`498`。" +"以 ``t`` 或 ``T`` 為前綴的字串文本通常被稱為「t 字串」,它是\\ :ref:`模板" +"化的字串文本 `\\ 的縮寫。" #: ../../glossary.rst:1337 msgid "text encoding" @@ -3084,7 +3072,7 @@ msgid "" "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " "serialized as a sequence of bytes." msgstr "" -"Python 中的字串是一個 Unicode 碼點 (code point) 的序列(範圍在 ``U+0000`` -- " +"Python 中的字串是一個 Unicode 編碼位置 (code point) 的序列(範圍在 ``U+0000`` -- " "``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一個位元組序列。" #: ../../glossary.rst:1343 @@ -3434,69 +3422,3 @@ msgstr "magic" #: ../../glossary.rst:1288 msgid "special" msgstr "special" - -#~ msgid "" -#~ "An object which controls the environment seen in a :keyword:`with` " -#~ "statement by defining :meth:`~object.__enter__` " -#~ "and :meth:`~object.__exit__` methods. See :pep:`343`." -#~ msgstr "" -#~ "一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定" -#~ "義 :meth:`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。" -#~ "請參閱 :pep:`343`。" - -#~ msgid "" -#~ "A variable which can have different values depending on its context. This " -#~ "is similar to Thread-Local Storage in which each execution thread may " -#~ "have a different value for a variable. However, with context variables, " -#~ "there may be several contexts in one execution thread and the main usage " -#~ "for context variables is to keep track of variables in concurrent " -#~ "asynchronous tasks. See :mod:`contextvars`." -#~ msgstr "" -#~ "一個變數,其值可以根據上下文的情境而有所不同。這類似執行緒區域儲存區 " -#~ "(Thread-Local Storage),在其中,一個變數在每個執行緒可能具有不同的值。然" -#~ "而,關於情境變數,在一個執行緒中可能會有多個情境,而情境變數的主要用途,是" -#~ "在並行的非同步任務 (concurrent asynchronous task) 中,對於變數狀態的追蹤。" -#~ "請參閱 :mod:`contextvars`。" - -#~ msgid "" -#~ "The main difference between a \"soft\" and a (regular) \"hard\" " -#~ "deprecation is that the soft deprecation does not imply scheduling the " -#~ "removal of the deprecated API." -#~ msgstr "" -#~ "「軟性」棄用和(常規的)「硬性」棄用之間的主要區別在於,軟性棄用並不代表已" -#~ "經確定要什麼時候刪除已棄用的 API。" - -#~ msgid "" -#~ "Another difference is that a soft deprecation does not issue a warning." -#~ msgstr "另一個區別是軟性棄用不會發出警告。" - -#~ msgid "2to3" -#~ msgstr "2to3" - -#~ msgid "" -#~ "A tool that tries to convert Python 2.x code to Python 3.x code by " -#~ "handling most of the incompatibilities which can be detected by parsing " -#~ "the source and traversing the parse tree." -#~ msgstr "" -#~ "一個試著將 Python 2.x 程式碼轉換為 Python 3.x 程式碼的工具,它是透過處理大" -#~ "部分的不相容性來達成此目的,而這些不相容性能夠透過剖析原始碼和遍歷剖析樹而" -#~ "被檢測出來。" - -#~ msgid "" -#~ "2to3 is available in the standard library as :mod:`lib2to3`; a standalone " -#~ "entry point is provided as :file:`Tools/scripts/2to3`. See :ref:`2to3-" -#~ "reference`." -#~ msgstr "" -#~ "2to3 在可以標準函式庫中以 :mod:`lib2to3` 被使用;它提供了一個獨立的入口" -#~ "點,在 :file:`Tools/scripts/2to3`。請參閱 :ref:`2to3-reference`。" - -#~ msgid "" -#~ "Past efforts to create a \"free-threaded\" interpreter (one which locks " -#~ "shared data at a much finer granularity) have not been successful because " -#~ "performance suffered in the common single-processor case. It is believed " -#~ "that overcoming this performance issue would make the implementation much " -#~ "more complicated and therefore costlier to maintain." -#~ msgstr "" -#~ "過去對於建立「無限制執行緒」直譯器(以更高的精細度鎖定共享資料的直譯器)的" -#~ "努力並未成功,因為在一般的單一處理器情況下,效能會有所損失。一般認為,若要" -#~ "克服這個效能問題,會使實作變得複雜許多,進而付出更高的維護成本。" diff --git a/howto/a-conceptual-overview-of-asyncio.po b/howto/a-conceptual-overview-of-asyncio.po index ce462ac5e76..d816f8941e8 100644 --- a/howto/a-conceptual-overview-of-asyncio.po +++ b/howto/a-conceptual-overview-of-asyncio.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-10 00:19+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/howto/annotations.po b/howto/annotations.po index 76796e10bf4..14d53f0aea8 100644 --- a/howto/annotations.po +++ b/howto/annotations.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-11-08 23:11+0800\n" @@ -73,7 +72,6 @@ msgid "Accessing The Annotations Dict Of An Object In Python 3.10 And Newer" msgstr "在 Python 3.10 及更高版本中存取物件的註釋字典" #: ../../howto/annotations.rst:35 -#, fuzzy msgid "" "Python 3.10 adds a new function to the standard " "library: :func:`inspect.get_annotations`. In Python versions 3.10 through " @@ -82,7 +80,7 @@ msgid "" "also \"un-stringize\" stringized annotations for you." msgstr "" "Python 3.10 在標準函式庫中新增了一個新函式::func:`inspect.get_annotations`。" -"在 Python 3.10 及更高版本中,呼叫此函式是存取任何支援註釋的物件的註釋字典的最" +"在 Python 3.10 到 3.13,呼叫此函式是存取任何支援註釋的物件的註釋字典的最" "佳實踐。此函式也可以為你「取消字串化 (un-stringize)」字串化註釋。" #: ../../howto/annotations.rst:42 @@ -386,14 +384,12 @@ msgid "" msgstr "" #: ../../howto/annotations.rst:196 -#, fuzzy msgid "" "If you do directly access the ``__annotations__`` member of an object, you " "should ensure that it's a dictionary before attempting to examine its " "contents." msgstr "" -"如果直接存取物件的 ``__annotations__`` 成員,則應在嘗試檢查其內容之前確保它是" -"字典。" +"如果直接存取物件的 ``__annotations__`` 成員,則應確保它是字典,然後再嘗試檢查其內容。" #: ../../howto/annotations.rst:200 msgid "You should avoid modifying ``__annotations__`` dicts." diff --git a/howto/argparse-optparse.po b/howto/argparse-optparse.po index 62fdf4ecdd2..6d64dccdf78 100644 --- a/howto/argparse-optparse.po +++ b/howto/argparse-optparse.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/howto/argparse.po b/howto/argparse.po index 5f4710c87fc..b40a18cb2c5 100644 --- a/howto/argparse.po +++ b/howto/argparse.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -10,7 +10,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2023-12-11 17:33+0800\n" diff --git a/howto/clinic.po b/howto/clinic.po index 4deac0b4299..091628bfa06 100644 --- a/howto/clinic.po +++ b/howto/clinic.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-13 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/cporting.po b/howto/cporting.po index 06a67dd24b2..63e3f6d9df5 100644 --- a/howto/cporting.po +++ b/howto/cporting.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/curses.po b/howto/curses.po index 5c22aaf3798..5d6fd880510 100644 --- a/howto/curses.po +++ b/howto/curses.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-04-11 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/descriptor.po b/howto/descriptor.po index be80d2835dd..a706a11acaa 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -1,13 +1,13 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-09 05:11+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -618,7 +618,7 @@ msgid "" "\n" " def validate(self, value):\n" " if not isinstance(value, str):\n" -" raise TypeError(f'Expected {value!r} to be an str')\n" +" raise TypeError(f'Expected {value!r} to be a str')\n" " if self.minsize is not None and len(value) < self.minsize:\n" " raise ValueError(\n" " f'Expected {value!r} to be no smaller than {self.minsize!" diff --git a/howto/enum.po b/howto/enum.po index 8898d65b1a2..275ee13dff9 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -2724,6 +2724,22 @@ msgid "" ">>> DType(9)\n" "" msgstr "" +">>> class MultiValueEnum(Enum):\n" +"... def __new__(cls, value, *values):\n" +"... self = object.__new__(cls)\n" +"... self._value_ = value\n" +"... for v in values:\n" +"... self._add_value_alias_(v)\n" +"... return self\n" +"...\n" +">>> class DType(MultiValueEnum):\n" +"... float32 = 'f', 8\n" +"... double64 = 'd', 9\n" +"...\n" +">>> DType('f')\n" +"\n" +">>> DType(9)\n" +"" #: ../../howto/enum.rst:1506 msgid "Planet" @@ -2786,6 +2802,20 @@ msgid "" "[, ]" msgstr "" +">>> from datetime import timedelta\n" +">>> class Period(timedelta, Enum):\n" +"... \"不同長度的時間\"\n" +"... _ignore_ = 'Period i'\n" +"... Period = vars()\n" +"... for i in range(367):\n" +"... Period['day_%d' % i] = i\n" +"...\n" +">>> list(Period)[:2]\n" +"[, ]\n" +">>> list(Period)[-2:]\n" +"[, ]" #: ../../howto/enum.rst:1558 msgid "Subclassing EnumType" diff --git a/howto/free-threading-extensions.po b/howto/free-threading-extensions.po index 3c0d6333244..dcbc3e89400 100644 --- a/howto/free-threading-extensions.po +++ b/howto/free-threading-extensions.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -339,14 +339,12 @@ msgid ":c:func:`PyImport_AddModuleRef`" msgstr ":c:func:`PyImport_AddModuleRef`" #: ../../howto/free-threading-extensions.rst:182 -#, fuzzy msgid ":c:func:`PyCell_GET`" -msgstr ":c:func:`PyList_GET_ITEM`" +msgstr ":c:func:`PyCell_GET`" #: ../../howto/free-threading-extensions.rst:182 -#, fuzzy msgid ":c:func:`PyCell_Get`" -msgstr ":c:func:`PyWeakref_GetRef`" +msgstr ":c:func:`PyCell_Get`" #: ../../howto/free-threading-extensions.rst:185 msgid "" diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po index e6b91d1f28f..ac3bcc5d1fc 100644 --- a/howto/free-threading-python.po +++ b/howto/free-threading-python.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -18,9 +18,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../howto/free-threading-python.rst:5 -#, fuzzy msgid "Python support for free threading" -msgstr "Python 自由執行緒的實驗性支援" +msgstr "Python 自由執行緒的支援" #: ../../howto/free-threading-python.rst:7 msgid "" diff --git a/howto/functional.po b/howto/functional.po index f3022836611..1be2a0486f5 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-04 00:16+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/gdb_helpers.po b/howto/gdb_helpers.po index 1fb852831b6..76983819c82 100644 --- a/howto/gdb_helpers.po +++ b/howto/gdb_helpers.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-12-06 00:14+0000\n" "PO-Revision-Date: 2024-05-11 14:42+0800\n" diff --git a/howto/index.po b/howto/index.po index 7dd04cc3afb..399d00a18aa 100644 --- a/howto/index.po +++ b/howto/index.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2021-07-05 12:45+0800\n" @@ -143,6 +143,5 @@ msgid ":ref:`perf_profiling`" msgstr ":ref:`perf_profiling`" #: ../../howto/index.rst:74 -#, fuzzy msgid ":ref:`remote-debugging`" -msgstr ":ref:`logging-howto`" +msgstr ":ref:`remote-debugging`" diff --git a/howto/instrumentation.po b/howto/instrumentation.po index be4be21d271..961dac6817f 100644 --- a/howto/instrumentation.po +++ b/howto/instrumentation.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-04 00:15+0000\n" "PO-Revision-Date: 2023-08-17 22:17+0800\n" diff --git a/howto/ipaddress.po b/howto/ipaddress.po index b4124f004d5..c6fc1ac7bb5 100644 --- a/howto/ipaddress.po +++ b/howto/ipaddress.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2024-07-20 16:09+0800\n" diff --git a/howto/isolating-extensions.po b/howto/isolating-extensions.po index bdaa2710231..9464ff1c9d7 100644 --- a/howto/isolating-extensions.po +++ b/howto/isolating-extensions.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-03 00:17+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index 1b408fc9f1c..9d926063b6a 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" @@ -3904,7 +3903,6 @@ msgid "When run, this produces a file with exactly two lines:" msgstr "" #: ../../howto/logging-cookbook.rst:2973 -#, fuzzy msgid "" "28/01/2015 07:21:23|INFO|Sample message|\n" "28/01/2015 07:21:23|ERROR|ZeroDivisionError: division by zero|'Traceback " @@ -3912,10 +3910,9 @@ msgid "" "= 1 / 0\\nZeroDivisionError: division by zero'|" msgstr "" "28/01/2015 07:21:23|INFO|Sample message|\n" -"28/01/2015 07:21:23|ERROR|ZeroDivisionError: integer division or modulo by " -"zero|'Traceback (most recent call last):\\n File \"logtest7.py\", line 30, " -"in main\\n x = 1 / 0\\nZeroDivisionError: integer division or modulo by " -"zero'|" +"28/01/2015 07:21:23|ERROR|ZeroDivisionError: division by zero|'Traceback " +"(most recent call last):\\n File \"logtest7.py\", line 30, in main\\n x " +"= 1 / 0\\nZeroDivisionError: division by zero'|" #: ../../howto/logging-cookbook.rst:2978 msgid "" diff --git a/howto/logging.po b/howto/logging.po index 20dd6141011..95d042135d8 100644 --- a/howto/logging.po +++ b/howto/logging.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # 文俊 高 , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" @@ -121,7 +120,7 @@ msgstr "" #: ../../howto/logging.rst:60 msgid "Raise an exception" -msgstr "" +msgstr "引發一個例外" #: ../../howto/logging.rst:63 msgid "" diff --git a/howto/mro.po b/howto/mro.po index 1f107b45fd2..e492034a8ed 100644 --- a/howto/mro.po +++ b/howto/mro.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-01-22 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index 07ffef15b49..d606afed568 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-04-19 00:14+0000\n" "PO-Revision-Date: 2023-12-09 17:39+0800\n" diff --git a/howto/pyporting.po b/howto/pyporting.po index 61899804cc1..7220c627b30 100644 --- a/howto/pyporting.po +++ b/howto/pyporting.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # jerrychen , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-31 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" diff --git a/howto/regex.po b/howto/regex.po index 46d4aa1e615..eaf264222e5 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Kai-han Chang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" diff --git a/howto/remote_debugging.po b/howto/remote_debugging.po index 2d3c169e1b1..2ae74b8ad27 100644 --- a/howto/remote_debugging.po +++ b/howto/remote_debugging.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. diff --git a/howto/sockets.po b/howto/sockets.po index b9a3acd4d5b..3c072f6315e 100644 --- a/howto/sockets.po +++ b/howto/sockets.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.11\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-08-12 15:16+0800\n" diff --git a/howto/sorting.po b/howto/sorting.po index 7b3038d4b0a..40f6d215fc8 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-12-20 19:16+0800\n" @@ -111,7 +111,6 @@ msgid "Key Functions" msgstr "鍵函式 (key functions)" #: ../../howto/sorting.rst:50 -#, fuzzy msgid "" "The :meth:`list.sort` method and the " "functions :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nsmallest`, " @@ -119,15 +118,15 @@ msgid "" "other callable) to be called on each list element prior to making " "comparisons." msgstr "" -":meth:`list.sort` 和 :func:`sorted` 都有一個參數 *key* 可以指定一個函式(或其" -"它可呼叫物件 (callable)),這個函式會在每個串列元素做比較前被呼叫。" +":meth:`list.sort` 方法和 :func:`sorted`、:func:`min`、:func:`max`、:func:`heapq.nsmallest` 及" +" :func:`heapq.nlargest` 函式都有一個參數 *key* 可以指定一個函式(或其" +"它可呼叫物件 (callable)),其會在每個串列元素做比較前被呼叫。" #: ../../howto/sorting.rst:56 -#, fuzzy msgid "" "For example, here's a case-insensitive string comparison " "using :meth:`str.casefold`:" -msgstr "例如這裡有一個不區分大小寫的字串比對:" +msgstr "例如使用 :meth:`str.casefold` 來做不區分大小寫的字串比對:" #: ../../howto/sorting.rst:59 msgid "" diff --git a/howto/timerfd.po b/howto/timerfd.po index 31cd12792d7..cc60b1f9514 100644 --- a/howto/timerfd.po +++ b/howto/timerfd.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # Translators: # GitHub Copilot, 2025 # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-12-19 10:00+0000\n" diff --git a/howto/unicode.po b/howto/unicode.po index 66eab41171e..7d33256d991 100644 --- a/howto/unicode.po +++ b/howto/unicode.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" diff --git a/howto/urllib2.po b/howto/urllib2.po index c712f8230aa..ed567cbbf0f 100644 --- a/howto/urllib2.po +++ b/howto/urllib2.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Phate , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2022-06-27 09:36+0800\n" diff --git a/installing/index.po b/installing/index.po index eab5a621795..cef15e95ed7 100644 --- a/installing/index.po +++ b/installing/index.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-06-27 09:37+0800\n" diff --git a/library/__future__.po b/library/__future__.po index ab72c73d7db..57538c7c3f0 100644 --- a/library/__future__.po +++ b/library/__future__.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-02-06 02:12+0000\n" diff --git a/library/__main__.po b/library/__main__.po index 76d8492ec26..684307463a6 100644 --- a/library/__main__.po +++ b/library/__main__.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-12-21 14:49+0800\n" @@ -541,7 +541,6 @@ msgid "Here is an example module that consumes the ``__main__`` namespace::" msgstr "這是一個使用 ``__main__`` 命名空間的範例模組:" #: ../../library/__main__.rst:284 -#, fuzzy msgid "" "# namely.py\n" "\n" @@ -567,10 +566,7 @@ msgstr "" " if not did_user_define_their_name():\n" " raise ValueError('Define the variable `my_name`!')\n" "\n" -" if '__file__' in dir(__main__):\n" -" print(__main__.my_name, \"found in file\", __main__.__file__)\n" -" else:\n" -" print(__main__.my_name)" +" print(__main__.my_name)" #: ../../library/__main__.rst:297 msgid "Example usage of this module could be as follows::" @@ -634,13 +630,12 @@ msgstr "" "復程式後,現在它以狀態碼 0 結束,表示成功:" #: ../../library/__main__.rst:327 -#, fuzzy msgid "" "$ python start.py\n" "Dinsdale" msgstr "" "$ python start.py\n" -"Define the variable `my_name`!" +"Dinsdale" #: ../../library/__main__.rst:332 msgid "" @@ -714,17 +709,3 @@ msgid "" "The ``__main__`` scope is used in the implementation of :mod:`pdb` " "and :mod:`rlcompleter`." msgstr "``__main__`` 作用域用於 :mod:`pdb` 和 :mod:`rlcompleter` 的實作。" - -#~ msgid "" -#~ "$ python start.py\n" -#~ "Dinsdale found in file /path/to/start.py" -#~ msgstr "" -#~ "$ python start.py\n" -#~ "Dinsdale found in file /path/to/start.py" - -#~ msgid "" -#~ "Note that in this case the ``__main__`` scope doesn't contain a " -#~ "``__file__`` attribute as it's interactive." -#~ msgstr "" -#~ "請注意,在這種情況下, ``__main__`` 作用域不包含 ``__file__`` 屬性,因為它" -#~ "是互動式的。" diff --git a/library/_thread.po b/library/_thread.po index 56330b261ed..14f33180948 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" @@ -204,7 +204,7 @@ msgstr "" "執行緒要使用的堆疊大小,必須是 0(使用平台或配置的預設值)或至少 32,768(32 " "KiB)的正整數值。如果未指定 *size*,則使用 0。如果不支持更改執行緒堆疊大小," "則會引發 :exc:`RuntimeError` 錯誤。如果指定的堆疊大小無效,則會引" -"發 :exc:`ValueError` 錯誤,並且堆疊大小不會被修改。目前,32 KiB 是保證解譯器" +"發 :exc:`ValueError` 錯誤,並且堆疊大小不會被修改。目前,32 KiB 是保證直譯器" "本身具有足夠堆疊空間所支持的最小堆疊大小值。請注意,某些平台對於堆疊大小的值" "可能有特定的限制,例如要求最小堆疊大小 > 32 KiB,或要求按系統記憶體頁面大小的" "倍數進行分配。應參考平台文件以取得更多訊息(4 KiB 頁面是比較普遍的;在缺乏更" @@ -273,9 +273,8 @@ msgid "Lock acquires can now be interrupted by signals on POSIX." msgstr "現在取得鎖的操作可以被 POSIX 訊號中斷。" #: ../../library/_thread.rst:190 -#, fuzzy msgid "Lock acquires can now be interrupted by signals on Windows." -msgstr "現在取得鎖的操作可以被 POSIX 訊號中斷。" +msgstr "" #: ../../library/_thread.rst:196 msgid "" diff --git a/library/abc.po b/library/abc.po index 9a2d736b8dc..8d089e46861 100644 --- a/library/abc.po +++ b/library/abc.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-27 00:15+0000\n" "PO-Revision-Date: 2022-11-16 03:29+0800\n" diff --git a/library/aifc.po b/library/aifc.po index 2cfcb0d41fc..a9e6d774606 100644 --- a/library/aifc.po +++ b/library/aifc.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/allos.po b/library/allos.po index 59c9cddfde1..eb96940124c 100644 --- a/library/allos.po +++ b/library/allos.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-02-15 17:54+0800\n" diff --git a/library/annotationlib.po b/library/annotationlib.po index b201ca0b504..6725f78e2f2 100644 --- a/library/annotationlib.po +++ b/library/annotationlib.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-09 05:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -81,66 +80,72 @@ msgid "" "functions `." msgstr "" -#: ../../library/annotationlib.rst:52 +#: ../../library/annotationlib.rst:51 +msgid "" +"Most functionality in this module can execute arbitrary code; see :ref:`the " +"security section ` for more information." +msgstr "" + +#: ../../library/annotationlib.rst:56 msgid "" ":pep:`649` proposed the current model for how annotations work in Python." msgstr "" -#: ../../library/annotationlib.rst:54 +#: ../../library/annotationlib.rst:58 msgid "" ":pep:`749` expanded on various aspects of :pep:`649` and introduced " "the :mod:`!annotationlib` module." msgstr "" -#: ../../library/annotationlib.rst:57 +#: ../../library/annotationlib.rst:61 msgid "" ":ref:`annotations-howto` provides best practices for working with " "annotations." msgstr "" -#: ../../library/annotationlib.rst:60 +#: ../../library/annotationlib.rst:64 msgid "" ":pypi:`typing-extensions` provides a backport of :func:`get_annotations` " "that works on earlier versions of Python." msgstr "" -#: ../../library/annotationlib.rst:64 +#: ../../library/annotationlib.rst:68 msgid "Annotation semantics" msgstr "" -#: ../../library/annotationlib.rst:66 +#: ../../library/annotationlib.rst:70 msgid "" "The way annotations are evaluated has changed over the history of Python 3, " "and currently still depends on a :ref:`future import `. There have " "been execution models for annotations:" msgstr "" -#: ../../library/annotationlib.rst:70 +#: ../../library/annotationlib.rst:74 msgid "" "*Stock semantics* (default in Python 3.0 through 3.13; see :pep:`3107` " "and :pep:`526`): Annotations are evaluated eagerly, as they are encountered " "in the source code." msgstr "" -#: ../../library/annotationlib.rst:73 +#: ../../library/annotationlib.rst:77 msgid "" "*Stringified annotations* (used with ``from __future__ import annotations`` " "in Python 3.7 and newer; see :pep:`563`): Annotations are stored as strings " "only." msgstr "" -#: ../../library/annotationlib.rst:76 +#: ../../library/annotationlib.rst:80 msgid "" "*Deferred evaluation* (default in Python 3.14 and newer; see :pep:`649` " "and :pep:`749`): Annotations are evaluated lazily, only when they are " "accessed." msgstr "" -#: ../../library/annotationlib.rst:79 +#: ../../library/annotationlib.rst:83 msgid "As an example, consider the following program::" msgstr "" -#: ../../library/annotationlib.rst:81 +#: ../../library/annotationlib.rst:85 msgid "" "def func(a: Cls) -> None:\n" " print(a)\n" @@ -150,30 +155,30 @@ msgid "" "print(func.__annotations__)" msgstr "" -#: ../../library/annotationlib.rst:88 +#: ../../library/annotationlib.rst:92 msgid "This will behave as follows:" msgstr "" -#: ../../library/annotationlib.rst:90 +#: ../../library/annotationlib.rst:94 msgid "" "Under stock semantics (Python 3.13 and earlier), it will throw " "a :exc:`NameError` at the line where ``func`` is defined, because ``Cls`` is " "an undefined name at that point." msgstr "" -#: ../../library/annotationlib.rst:93 +#: ../../library/annotationlib.rst:97 msgid "" "Under stringified annotations (if ``from __future__ import annotations`` is " "used), it will print ``{'a': 'Cls', 'return': 'None'}``." msgstr "" -#: ../../library/annotationlib.rst:95 +#: ../../library/annotationlib.rst:99 msgid "" "Under deferred evaluation (Python 3.14 and later), it will print ``{'a': " ", 'return': None}``." msgstr "" -#: ../../library/annotationlib.rst:98 +#: ../../library/annotationlib.rst:102 msgid "" "Stock semantics were used when function annotations were first introduced in " "Python 3.0 (by :pep:`3107`) because this was the simplest, most obvious way " @@ -194,11 +199,11 @@ msgid "" "eventually be removed." msgstr "" -#: ../../library/annotationlib.rst:117 +#: ../../library/annotationlib.rst:121 msgid "Classes" msgstr "" -#: ../../library/annotationlib.rst:121 +#: ../../library/annotationlib.rst:125 msgid "" "An :class:`~enum.IntEnum` describing the formats in which annotations can be " "returned. Members of the enum, or their equivalent integer values, can be " @@ -206,11 +211,11 @@ msgid "" "well as to :attr:`~object.__annotate__` functions." msgstr "" -#: ../../library/annotationlib.rst:129 +#: ../../library/annotationlib.rst:133 msgid "Values are the result of evaluating the annotation expressions." msgstr "" -#: ../../library/annotationlib.rst:134 +#: ../../library/annotationlib.rst:138 msgid "" "Special value used to signal that an annotate function is being evaluated in " "a special environment with fake globals. When passed this value, annotate " @@ -221,30 +226,30 @@ msgid "" "module." msgstr "" -#: ../../library/annotationlib.rst:145 +#: ../../library/annotationlib.rst:149 msgid "" "Values are real annotation values (as per :attr:`Format.VALUE` format) for " "defined values, and :class:`ForwardRef` proxies for undefined values. Real " "objects may contain references to :class:`ForwardRef` proxy objects." msgstr "" -#: ../../library/annotationlib.rst:153 +#: ../../library/annotationlib.rst:157 msgid "" "Values are the text string of the annotation as it appears in the source " "code, up to modifications including, but not restricted to, whitespace " "normalizations and constant values optimizations." msgstr "" -#: ../../library/annotationlib.rst:157 +#: ../../library/annotationlib.rst:161 msgid "" "The exact values of these strings may change in future versions of Python." msgstr "" -#: ../../library/annotationlib.rst:163 +#: ../../library/annotationlib.rst:167 msgid "A proxy object for forward references in annotations." msgstr "" -#: ../../library/annotationlib.rst:165 +#: ../../library/annotationlib.rst:169 msgid "" "Instances of this class are returned when the :attr:`~Format.FORWARDREF` " "format is used and annotations contain a name that cannot be resolved. This " @@ -252,18 +257,18 @@ msgid "" "class is referenced before it is defined." msgstr "" -#: ../../library/annotationlib.rst:172 +#: ../../library/annotationlib.rst:176 msgid "" "A string containing the code that was evaluated to produce " "the :class:`~ForwardRef`. The string may not be exactly equivalent to the " "original source." msgstr "" -#: ../../library/annotationlib.rst:178 +#: ../../library/annotationlib.rst:182 msgid "Evaluate the forward reference, returning its value." msgstr "" -#: ../../library/annotationlib.rst:180 +#: ../../library/annotationlib.rst:184 msgid "" "If the *format* argument is :attr:`~Format.VALUE` (the default), this method " "may throw an exception, such as :exc:`NameError`, if the forward reference " @@ -279,7 +284,7 @@ msgid "" "return :attr:`~ForwardRef.__forward_arg__`." msgstr "" -#: ../../library/annotationlib.rst:192 +#: ../../library/annotationlib.rst:196 msgid "" "The *owner* parameter provides the preferred mechanism for passing scope " "information to this method. The owner of a :class:`~ForwardRef` is the " @@ -287,7 +292,7 @@ msgid "" "derives, such as a module object, type object, or function object." msgstr "" -#: ../../library/annotationlib.rst:197 +#: ../../library/annotationlib.rst:201 msgid "" "The *globals*, *locals*, and *type_params* parameters provide a more precise " "mechanism for influencing the names that are available when " @@ -302,7 +307,7 @@ msgid "" "*type_params* should be set to ``C.__type_params__``." msgstr "" -#: ../../library/annotationlib.rst:208 +#: ../../library/annotationlib.rst:212 msgid "" ":class:`~ForwardRef` instances returned by :func:`get_annotations` retain " "references to information about the scope they originated from, so calling " @@ -312,18 +317,18 @@ msgid "" "be necessary to evaluate them successfully." msgstr "" -#: ../../library/annotationlib.rst:215 +#: ../../library/annotationlib.rst:219 msgid "" "If no *owner*, *globals*, *locals*, or *type_params* are provided and " "the :class:`~ForwardRef` does not contain information about its origin, " "empty globals and locals dictionaries are used." msgstr "" -#: ../../library/annotationlib.rst:223 +#: ../../library/annotationlib.rst:227 msgid "Functions" msgstr "" -#: ../../library/annotationlib.rst:227 +#: ../../library/annotationlib.rst:231 msgid "" "Convert an annotations dict containing runtime values to a dict containing " "only strings. If the values are not already strings, they are converted " @@ -332,13 +337,13 @@ msgid "" "have access to the code creating the annotations." msgstr "" -#: ../../library/annotationlib.rst:234 +#: ../../library/annotationlib.rst:238 msgid "" "For example, this is used to implement the :attr:`~Format.STRING` " "for :class:`typing.TypedDict` classes created through the functional syntax:" msgstr "" -#: ../../library/annotationlib.rst:237 +#: ../../library/annotationlib.rst:241 msgid "" ">>> from typing import TypedDict\n" ">>> Movie = TypedDict(\"movie\", {\"name\": str, \"year\": int})\n" @@ -346,14 +351,14 @@ msgid "" "{'name': 'str', 'year': 'int'}" msgstr "" -#: ../../library/annotationlib.rst:248 +#: ../../library/annotationlib.rst:252 msgid "" "Call the :term:`annotate function` *annotate* with the given *format*, a " "member of the :class:`Format` enum, and return the annotations dictionary " "produced by the function." msgstr "" -#: ../../library/annotationlib.rst:252 +#: ../../library/annotationlib.rst:256 msgid "" "This helper function is required because annotate functions generated by the " "compiler for functions, classes, and modules only support " @@ -364,21 +369,21 @@ msgid "" "evaluate annotations while a class is being constructed." msgstr "" -#: ../../library/annotationlib.rst:261 +#: ../../library/annotationlib.rst:265 msgid "" "*owner* is the object that owns the annotation function, usually a function, " "class, or module. If provided, it is used in the :attr:`~Format.FORWARDREF` " "format to produce a :class:`ForwardRef` object that carries more information." msgstr "" -#: ../../library/annotationlib.rst:268 +#: ../../library/annotationlib.rst:272 msgid "" ":PEP:`PEP 649 <649#the-stringizer-and-the-fake-globals-environment>` " "contains an explanation of the implementation technique used by this " "function." msgstr "" -#: ../../library/annotationlib.rst:276 +#: ../../library/annotationlib.rst:280 msgid "" "Call the :term:`evaluate function` *evaluate* with the given *format*, a " "member of the :class:`Format` enum, and return the value produced by the " @@ -387,55 +392,55 @@ msgid "" "function returns a single value." msgstr "" -#: ../../library/annotationlib.rst:282 +#: ../../library/annotationlib.rst:286 msgid "" "This is intended for use with the evaluate functions generated for lazily " "evaluated elements related to type aliases and type parameters:" msgstr "" -#: ../../library/annotationlib.rst:285 +#: ../../library/annotationlib.rst:289 msgid ":meth:`typing.TypeAliasType.evaluate_value`, the value of type aliases" msgstr "" -#: ../../library/annotationlib.rst:286 +#: ../../library/annotationlib.rst:290 msgid ":meth:`typing.TypeVar.evaluate_bound`, the bound of type variables" msgstr "" -#: ../../library/annotationlib.rst:287 +#: ../../library/annotationlib.rst:291 msgid "" ":meth:`typing.TypeVar.evaluate_constraints`, the constraints of type " "variables" msgstr "" -#: ../../library/annotationlib.rst:289 +#: ../../library/annotationlib.rst:293 msgid "" ":meth:`typing.TypeVar.evaluate_default`, the default value of type variables" msgstr "" -#: ../../library/annotationlib.rst:291 +#: ../../library/annotationlib.rst:295 msgid "" ":meth:`typing.ParamSpec.evaluate_default`, the default value of parameter " "specifications" msgstr "" -#: ../../library/annotationlib.rst:293 +#: ../../library/annotationlib.rst:297 msgid "" ":meth:`typing.TypeVarTuple.evaluate_default`, the default value of type " "variable tuples" msgstr "" -#: ../../library/annotationlib.rst:296 +#: ../../library/annotationlib.rst:300 msgid "" "*owner* is the object that owns the evaluate function, such as the type " "alias or type variable object." msgstr "" -#: ../../library/annotationlib.rst:299 +#: ../../library/annotationlib.rst:303 msgid "" "*format* can be used to control the format in which the value is returned:" msgstr "" -#: ../../library/annotationlib.rst:301 +#: ../../library/annotationlib.rst:305 msgid "" ">>> type Alias = undefined\n" ">>> call_evaluate_function(Alias.evaluate_value, Format.VALUE)\n" @@ -448,7 +453,7 @@ msgid "" "'undefined'" msgstr "" -#: ../../library/annotationlib.rst:317 +#: ../../library/annotationlib.rst:321 msgid "" "Retrieve the :term:`annotate function` from a class namespace dictionary " "*namespace*. Return :const:`!None` if the namespace does not contain an " @@ -458,31 +463,31 @@ msgid "" "` for an example using this function in a metaclass." msgstr "" -#: ../../library/annotationlib.rst:327 +#: ../../library/annotationlib.rst:331 msgid "Compute the annotations dict for an object." msgstr "" -#: ../../library/annotationlib.rst:329 +#: ../../library/annotationlib.rst:333 msgid "" "*obj* may be a callable, class, module, or other object " "with :attr:`~object.__annotate__` or :attr:`~object.__annotations__` " "attributes. Passing any other object raises :exc:`TypeError`." msgstr "" -#: ../../library/annotationlib.rst:333 +#: ../../library/annotationlib.rst:337 msgid "" "The *format* parameter controls the format in which annotations are " "returned, and must be a member of the :class:`Format` enum or its integer " "equivalent. The different formats work as follows:" msgstr "" -#: ../../library/annotationlib.rst:337 +#: ../../library/annotationlib.rst:341 msgid "" "VALUE: :attr:`!object.__annotations__` is tried first; if that does not " "exist, the :attr:`!object.__annotate__` function is called if it exists." msgstr "" -#: ../../library/annotationlib.rst:339 +#: ../../library/annotationlib.rst:343 msgid "" "FORWARDREF: If :attr:`!object.__annotations__` exists and can be evaluated " "successfully, it is used; otherwise, the :attr:`!object.__annotate__` " @@ -491,25 +496,25 @@ msgid "" "raised." msgstr "" -#: ../../library/annotationlib.rst:343 +#: ../../library/annotationlib.rst:347 msgid "" "STRING: If :attr:`!object.__annotate__` exists, it is called first; " "otherwise, :attr:`!object.__annotations__` is used and stringified " "using :func:`annotations_to_string`." msgstr "" -#: ../../library/annotationlib.rst:347 +#: ../../library/annotationlib.rst:351 msgid "" "Returns a dict. :func:`!get_annotations` returns a new dict every time it's " "called; calling it twice on the same object will return two different but " "equivalent dicts." msgstr "" -#: ../../library/annotationlib.rst:351 +#: ../../library/annotationlib.rst:355 msgid "This function handles several details for you:" msgstr "" -#: ../../library/annotationlib.rst:353 +#: ../../library/annotationlib.rst:357 msgid "" "If *eval_str* is true, values of type :class:`!str` will be un-stringized " "using :func:`eval`. This is intended for use with stringized annotations " @@ -517,33 +522,33 @@ msgid "" "to true with formats other than :attr:`Format.VALUE`." msgstr "" -#: ../../library/annotationlib.rst:358 +#: ../../library/annotationlib.rst:362 msgid "" "If *obj* doesn't have an annotations dict, returns an empty dict. (Functions " "and methods always have an annotations dict; classes, modules, and other " "types of callables may not.)" msgstr "" -#: ../../library/annotationlib.rst:362 +#: ../../library/annotationlib.rst:366 msgid "" "Ignores inherited annotations on classes, as well as annotations on " "metaclasses. If a class doesn't have its own annotations dict, returns an " "empty dict." msgstr "" -#: ../../library/annotationlib.rst:365 +#: ../../library/annotationlib.rst:369 msgid "" "All accesses to object members and dict values are done using ``getattr()`` " "and ``dict.get()`` for safety." msgstr "" -#: ../../library/annotationlib.rst:368 +#: ../../library/annotationlib.rst:372 msgid "" "*eval_str* controls whether or not values of type :class:`!str` are replaced " "with the result of calling :func:`eval` on those values:" msgstr "" -#: ../../library/annotationlib.rst:371 +#: ../../library/annotationlib.rst:375 msgid "" "If eval_str is true, :func:`eval` is called on values of type :class:`!str`. " "(Note that :func:`!get_annotations` doesn't catch exceptions; " @@ -551,13 +556,13 @@ msgid "" "the :func:`!get_annotations` call.)" msgstr "" -#: ../../library/annotationlib.rst:375 +#: ../../library/annotationlib.rst:379 msgid "" "If *eval_str* is false (the default), values of type :class:`!str` are " "unchanged." msgstr "" -#: ../../library/annotationlib.rst:378 +#: ../../library/annotationlib.rst:382 msgid "" "*globals* and *locals* are passed in to :func:`eval`; see the documentation " "for :func:`eval` for more information. If *globals* or *locals* is :const:`!" @@ -565,18 +570,18 @@ msgid "" "contingent on ``type(obj)``:" msgstr "" -#: ../../library/annotationlib.rst:383 +#: ../../library/annotationlib.rst:387 msgid "If *obj* is a module, *globals* defaults to ``obj.__dict__``." msgstr "" -#: ../../library/annotationlib.rst:384 +#: ../../library/annotationlib.rst:388 msgid "" "If *obj* is a class, *globals* defaults to " "``sys.modules[obj.__module__].__dict__`` and *locals* defaults to the *obj* " "class namespace." msgstr "" -#: ../../library/annotationlib.rst:387 +#: ../../library/annotationlib.rst:391 msgid "" "If *obj* is a callable, *globals* defaults to :attr:`obj.__globals__ " "`, although if *obj* is a wrapped function " @@ -584,14 +589,14 @@ msgid "" "object, it is unwrapped until a non-wrapped function is found." msgstr "" -#: ../../library/annotationlib.rst:393 +#: ../../library/annotationlib.rst:397 msgid "" "Calling :func:`!get_annotations` is best practice for accessing the " "annotations dict of any object. See :ref:`annotations-howto` for more " "information on annotations best practices." msgstr "" -#: ../../library/annotationlib.rst:397 +#: ../../library/annotationlib.rst:401 msgid "" ">>> def f(a: int, b: str) -> float:\n" "... pass\n" @@ -599,14 +604,14 @@ msgid "" "{'a': , 'b': , 'return': }" msgstr "" -#: ../../library/annotationlib.rst:408 +#: ../../library/annotationlib.rst:412 msgid "" "Convert an arbitrary Python value to a format suitable for use by " "the :attr:`~Format.STRING` format. This calls :func:`repr` for most objects, " "but has special handling for some objects, such as type objects." msgstr "" -#: ../../library/annotationlib.rst:412 +#: ../../library/annotationlib.rst:416 msgid "" "This is meant as a helper for user-provided annotate functions that support " "the :attr:`~Format.STRING` format but do not have access to the code " @@ -615,15 +620,15 @@ msgid "" "commonly encountered in annotations." msgstr "" -#: ../../library/annotationlib.rst:422 +#: ../../library/annotationlib.rst:426 msgid "Recipes" msgstr "" -#: ../../library/annotationlib.rst:427 +#: ../../library/annotationlib.rst:431 msgid "Using annotations in a metaclass" msgstr "" -#: ../../library/annotationlib.rst:429 +#: ../../library/annotationlib.rst:433 msgid "" "A :ref:`metaclass ` may want to inspect or even modify the " "annotations in a class body during class creation. Doing so requires " @@ -637,21 +642,21 @@ msgid "" "names that cannot yet be resolved when the class is created." msgstr "" -#: ../../library/annotationlib.rst:440 +#: ../../library/annotationlib.rst:444 msgid "" "To modify the annotations, it is best to create a wrapper annotate function " "that calls the original annotate function, makes any necessary adjustments, " "and returns the result." msgstr "" -#: ../../library/annotationlib.rst:444 +#: ../../library/annotationlib.rst:448 msgid "" "Below is an example of a metaclass that filters out " "all :class:`typing.ClassVar` annotations from the class and puts them in a " "separate attribute:" msgstr "" -#: ../../library/annotationlib.rst:447 +#: ../../library/annotationlib.rst:451 msgid "" "import annotationlib\n" "import typing\n" @@ -702,25 +707,25 @@ msgid "" " return typ" msgstr "" -#: ../../library/annotationlib.rst:495 +#: ../../library/annotationlib.rst:499 msgid "Limitations of the ``STRING`` format" msgstr "" -#: ../../library/annotationlib.rst:497 +#: ../../library/annotationlib.rst:501 msgid "" "The :attr:`~Format.STRING` format is meant to approximate the source code of " "the annotation, but the implementation strategy used means that it is not " "always possible to recover the exact source code." msgstr "" -#: ../../library/annotationlib.rst:501 +#: ../../library/annotationlib.rst:505 msgid "" "First, the stringifier of course cannot recover any information that is not " "present in the compiled code, including comments, whitespace, " "parenthesization, and operations that get simplified by the compiler." msgstr "" -#: ../../library/annotationlib.rst:505 +#: ../../library/annotationlib.rst:509 msgid "" "Second, the stringifier can intercept almost all operations that involve " "names looked up in some scope, but it cannot intercept operations that " @@ -730,7 +735,7 @@ msgid "" "access to any globals or builtins. For example:" msgstr "" -#: ../../library/annotationlib.rst:511 +#: ../../library/annotationlib.rst:515 msgid "" ">>> def f(x: (1).__class__.__base__.__subclasses__()" "[-1].__init__.__builtins__[\"print\"](\"Hello world\")): pass\n" @@ -740,13 +745,13 @@ msgid "" "{'x': 'None'}" msgstr "" -#: ../../library/annotationlib.rst:520 +#: ../../library/annotationlib.rst:524 msgid "" "This particular example works as of the time of writing, but it relies on " "implementation details and is not guaranteed to work in the future." msgstr "" -#: ../../library/annotationlib.rst:523 +#: ../../library/annotationlib.rst:527 msgid "" "Among the different kinds of expressions that exist in Python, as " "represented by the :mod:`ast` module, some expressions are supported, " @@ -755,169 +760,169 @@ msgid "" "output or an error." msgstr "" -#: ../../library/annotationlib.rst:528 +#: ../../library/annotationlib.rst:532 msgid "The following are supported (sometimes with caveats):" msgstr "" -#: ../../library/annotationlib.rst:530 +#: ../../library/annotationlib.rst:534 msgid ":class:`ast.BinOp`" msgstr "" -#: ../../library/annotationlib.rst:531 +#: ../../library/annotationlib.rst:535 msgid ":class:`ast.UnaryOp`" msgstr "" -#: ../../library/annotationlib.rst:533 +#: ../../library/annotationlib.rst:537 msgid "" ":class:`ast.Invert` (``~``), :class:`ast.UAdd` (``+``), " "and :class:`ast.USub` (``-``) are supported" msgstr "" -#: ../../library/annotationlib.rst:534 +#: ../../library/annotationlib.rst:538 msgid ":class:`ast.Not` (``not``) is not supported" msgstr "" -#: ../../library/annotationlib.rst:536 +#: ../../library/annotationlib.rst:540 msgid ":class:`ast.Dict` (except when using ``**`` unpacking)" msgstr "" -#: ../../library/annotationlib.rst:537 +#: ../../library/annotationlib.rst:541 msgid ":class:`ast.Set`" msgstr "" -#: ../../library/annotationlib.rst:538 +#: ../../library/annotationlib.rst:542 msgid ":class:`ast.Compare`" msgstr "" -#: ../../library/annotationlib.rst:540 +#: ../../library/annotationlib.rst:544 msgid ":class:`ast.Eq` and :class:`ast.NotEq` are supported" msgstr "" -#: ../../library/annotationlib.rst:541 +#: ../../library/annotationlib.rst:545 msgid "" ":class:`ast.Lt`, :class:`ast.LtE`, :class:`ast.Gt`, and :class:`ast.GtE` are " "supported, but the operand may be flipped" msgstr "" -#: ../../library/annotationlib.rst:542 +#: ../../library/annotationlib.rst:546 msgid "" ":class:`ast.Is`, :class:`ast.IsNot`, :class:`ast.In`, and :class:`ast.NotIn` " "are not supported" msgstr "" -#: ../../library/annotationlib.rst:544 +#: ../../library/annotationlib.rst:548 msgid ":class:`ast.Call` (except when using ``**`` unpacking)" msgstr "" -#: ../../library/annotationlib.rst:545 +#: ../../library/annotationlib.rst:549 msgid "" ":class:`ast.Constant` (though not the exact representation of the constant; " "for example, escape sequences in strings are lost; hexadecimal numbers are " "converted to decimal)" msgstr "" -#: ../../library/annotationlib.rst:547 +#: ../../library/annotationlib.rst:551 msgid ":class:`ast.Attribute` (assuming the value is not a constant)" msgstr "" -#: ../../library/annotationlib.rst:548 +#: ../../library/annotationlib.rst:552 msgid ":class:`ast.Subscript` (assuming the value is not a constant)" msgstr "" -#: ../../library/annotationlib.rst:549 +#: ../../library/annotationlib.rst:553 msgid ":class:`ast.Starred` (``*`` unpacking)" msgstr "" -#: ../../library/annotationlib.rst:550 +#: ../../library/annotationlib.rst:554 msgid ":class:`ast.Name`" msgstr "" -#: ../../library/annotationlib.rst:551 +#: ../../library/annotationlib.rst:555 msgid ":class:`ast.List`" msgstr "" -#: ../../library/annotationlib.rst:552 +#: ../../library/annotationlib.rst:556 msgid ":class:`ast.Tuple`" msgstr "" -#: ../../library/annotationlib.rst:553 +#: ../../library/annotationlib.rst:557 msgid ":class:`ast.Slice`" msgstr "" -#: ../../library/annotationlib.rst:555 +#: ../../library/annotationlib.rst:559 msgid "" "The following are unsupported, but throw an informative error when " "encountered by the stringifier:" msgstr "" -#: ../../library/annotationlib.rst:558 +#: ../../library/annotationlib.rst:562 msgid "" ":class:`ast.FormattedValue` (f-strings; error is not detected if conversion " "specifiers like ``!r`` are used)" msgstr "" -#: ../../library/annotationlib.rst:560 +#: ../../library/annotationlib.rst:564 msgid ":class:`ast.JoinedStr` (f-strings)" msgstr "" -#: ../../library/annotationlib.rst:562 +#: ../../library/annotationlib.rst:566 msgid "The following are unsupported and result in incorrect output:" msgstr "" -#: ../../library/annotationlib.rst:564 +#: ../../library/annotationlib.rst:568 msgid ":class:`ast.BoolOp` (``and`` and ``or``)" msgstr "" -#: ../../library/annotationlib.rst:565 +#: ../../library/annotationlib.rst:569 msgid ":class:`ast.IfExp`" msgstr "" -#: ../../library/annotationlib.rst:566 +#: ../../library/annotationlib.rst:570 msgid ":class:`ast.Lambda`" msgstr "" -#: ../../library/annotationlib.rst:567 +#: ../../library/annotationlib.rst:571 msgid ":class:`ast.ListComp`" msgstr "" -#: ../../library/annotationlib.rst:568 +#: ../../library/annotationlib.rst:572 msgid ":class:`ast.SetComp`" msgstr "" -#: ../../library/annotationlib.rst:569 +#: ../../library/annotationlib.rst:573 msgid ":class:`ast.DictComp`" msgstr "" -#: ../../library/annotationlib.rst:570 +#: ../../library/annotationlib.rst:574 msgid ":class:`ast.GeneratorExp`" msgstr "" -#: ../../library/annotationlib.rst:572 +#: ../../library/annotationlib.rst:576 msgid "" "The following are disallowed in annotation scopes and therefore not relevant:" msgstr "" -#: ../../library/annotationlib.rst:574 +#: ../../library/annotationlib.rst:578 msgid ":class:`ast.NamedExpr` (``:=``)" msgstr "" -#: ../../library/annotationlib.rst:575 +#: ../../library/annotationlib.rst:579 msgid ":class:`ast.Await`" msgstr "" -#: ../../library/annotationlib.rst:576 +#: ../../library/annotationlib.rst:580 msgid ":class:`ast.Yield`" msgstr "" -#: ../../library/annotationlib.rst:577 +#: ../../library/annotationlib.rst:581 msgid ":class:`ast.YieldFrom`" msgstr "" -#: ../../library/annotationlib.rst:581 +#: ../../library/annotationlib.rst:585 msgid "Limitations of the ``FORWARDREF`` format" msgstr "" -#: ../../library/annotationlib.rst:583 +#: ../../library/annotationlib.rst:587 msgid "" "The :attr:`~Format.FORWARDREF` format aims to produce real values as much as " "possible, with anything that cannot be resolved replaced " @@ -927,11 +932,11 @@ msgid "" "exceptions when evaluated using the :attr:`~Format.FORWARDREF` format." msgstr "" -#: ../../library/annotationlib.rst:590 +#: ../../library/annotationlib.rst:594 msgid "Below are a few examples of the behavior with unsupported expressions:" msgstr "" -#: ../../library/annotationlib.rst:592 +#: ../../library/annotationlib.rst:596 msgid "" ">>> from annotationlib import get_annotations, Format\n" ">>> def zerodiv(x: 1 / 0): ...\n" @@ -947,3 +952,31 @@ msgid "" ">>> get_annotations(ifexp, format=Format.STRING)\n" "{'x': '1'}" msgstr "" + +#: ../../library/annotationlib.rst:615 +msgid "Security implications of introspecting annotations" +msgstr "" + +#: ../../library/annotationlib.rst:617 +msgid "" +"Much of the functionality in this module involves executing code related to " +"annotations, which can then do arbitrary things. For " +"example, :func:`get_annotations` may call an arbitrary :term:`annotate " +"function`, and :meth:`ForwardRef.evaluate` may call :func:`eval` on an " +"arbitrary string. Code contained in an annotation might make arbitrary " +"system calls, enter an infinite loop, or perform any other operation. This " +"is also true for any access of the :attr:`~object.__annotations__` " +"attribute, and for various functions in the :mod:`typing` module that work " +"with annotations, such as :func:`typing.get_type_hints`." +msgstr "" + +#: ../../library/annotationlib.rst:626 +msgid "" +"Any security issue arising from this also applies immediately after " +"importing code that may contain untrusted annotations: importing code can " +"always cause arbitrary operations to be performed. However, it is unsafe to " +"accept strings or other input from an untrusted source and pass them to any " +"of the APIs for introspecting annotations, for example by editing an " +"``__annotations__`` dictionary or directly creating a :class:`ForwardRef` " +"object." +msgstr "" diff --git a/library/archiving.po b/library/archiving.po index 2a6622b8716..2051ce20cc8 100644 --- a/library/archiving.po +++ b/library/archiving.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-02-18 14:22+0800\n" @@ -25,13 +24,12 @@ msgid "Data Compression and Archiving" msgstr "資料壓縮與保存" #: ../../library/archiving.rst:7 -#, fuzzy msgid "" "The modules described in this chapter support data compression with the " "zlib, gzip, bzip2, lzma, and zstd algorithms, and the creation of ZIP- and " "tar-format archives. See also :ref:`archiving-operations` provided by " "the :mod:`shutil` module." msgstr "" -"本章中描述的模組支援使用 zlib、gzip、bzip2 和 lzma 演算法進行資料壓縮,以及建" -"立 ZIP 和 tar 格式的存檔。另請參閱 :mod:`shutil` 模組提供的 :ref:`archiving-" +"本章中描述的模組支援使用 zlib、gzip、bzip2、lzma 和 zstd 演算法進行資料壓縮,以及" +"建立 ZIP 和 tar 格式的存檔。另請參閱 :mod:`shutil` 模組提供的 :ref:`archiving-" "operations`。" diff --git a/library/argparse.po b/library/argparse.po index 2b6b092ccca..7f010326db8 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" @@ -133,11 +133,10 @@ msgid "" msgstr "" #: ../../library/argparse.rst:83 -#, fuzzy msgid "" "prog_ - The name of the program (default: generated from the ``__main__`` " "module attributes and ``sys.argv[0]``)" -msgstr "prog_ - 程式的名稱(預設值:``os.path.basename(sys.argv[0])``)" +msgstr "prog_ - 程式的名稱(預設值:從 ``__main__`` 模組屬性和 ``sys.argv[0]`` 產生)" #: ../../library/argparse.rst:86 msgid "" @@ -230,9 +229,8 @@ msgid "*exit_on_error* parameter was added." msgstr "新增 *exit_on_error* 參數。" #: ../../library/argparse.rst:134 -#, fuzzy msgid "*suggest_on_error* and *color* parameters were added." -msgstr "新增 *exit_on_error* 參數。" +msgstr "新增 *suggest_on_error* 和 *color* 參數。" #: ../../library/argparse.rst:137 ../../library/argparse.rst:684 msgid "The following sections describe how each of these are used." @@ -1026,9 +1024,8 @@ msgstr "" "Catching an argumentError" #: ../../library/argparse.rst:596 -#, fuzzy msgid "suggest_on_error" -msgstr "exit_on_error" +msgstr "suggest_on_error" #: ../../library/argparse.rst:598 msgid "" @@ -1236,7 +1233,6 @@ msgid "" msgstr "" #: ../../library/argparse.rst:729 -#, fuzzy msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo-bar')\n" @@ -1249,20 +1245,16 @@ msgid "" " -h, --help show this help message and exit\n" " --foo-bar FOO-BAR" msgstr "" -">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument('--foo')\n" -">>> parser.add_argument('bar')\n" -">>> parser.parse_args('X --foo Y'.split())\n" -"Namespace(bar='X', foo='Y')\n" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('--foo-bar')\n" +">>> parser.parse_args(['--foo-bar', 'FOO-BAR']\n" +"Namespace(foo_bar='FOO-BAR')\n" ">>> parser.print_help()\n" -"usage: [-h] [--foo FOO] bar\n" -"\n" -"positional arguments:\n" -" bar\n" +"usage: [-h] [--foo-bar FOO-BAR]\n" "\n" -"options:\n" +"optional arguments:\n" " -h, --help show this help message and exit\n" -" --foo FOO" +" --foo-bar FOO-BAR" #: ../../library/argparse.rst:744 msgid "action" @@ -1579,7 +1571,6 @@ msgid "" msgstr "" #: ../../library/argparse.rst:918 -#, fuzzy msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?')\n" @@ -1592,14 +1583,14 @@ msgid "" "Namespace(infile=None, outfile=None)" msgstr "" ">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" -">>> parser.add_argument('bar', nargs='?', default='d')\n" -">>> parser.parse_args(['XX', '--foo', 'YY'])\n" -"Namespace(bar='XX', foo='YY')\n" -">>> parser.parse_args(['XX', '--foo'])\n" -"Namespace(bar='XX', foo='c')\n" +">>> parser.add_argument('infile', nargs='?')\n" +">>> parser.add_argument('outfile', nargs='?')\n" +">>> parser.parse_args(['input.txt', 'output.txt'])\n" +"Namespace(infile='input.txt', outfile='output.txt')\n" +">>> parser.parse_args(['input.txt'])\n" +"Namespace(infile='input.txt', outfile=None)\n" ">>> parser.parse_args([])\n" -"Namespace(bar='d', foo='d')" +"Namespace(infile=None, outfile=None)" #: ../../library/argparse.rst:930 msgid "" @@ -1853,7 +1844,6 @@ msgid "Common built-in types and functions can be used as type converters:" msgstr "" #: ../../library/argparse.rst:1076 -#, fuzzy msgid "" "import argparse\n" "import pathlib\n" @@ -1873,8 +1863,6 @@ msgstr "" "parser.add_argument('distance', type=float)\n" "parser.add_argument('street', type=ascii)\n" "parser.add_argument('code_point', type=ord)\n" -"parser.add_argument('dest_file', type=argparse.FileType('w', " -"encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" #: ../../library/argparse.rst:1088 diff --git a/library/array.po b/library/array.po index feccab889ac..a7880c1bdc0 100644 --- a/library/array.po +++ b/library/array.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +8,7 @@ # Benson Chen , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-30 00:18+0000\n" "PO-Revision-Date: 2021-11-23 18:40+0800\n" diff --git a/library/ast.po b/library/ast.po index 1ee0a5780ee..7c52be3473c 100644 --- a/library/ast.po +++ b/library/ast.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" @@ -18,7 +18,6 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../library/ast.rst:2 -#, fuzzy msgid ":mod:`!ast` --- Abstract syntax trees" msgstr ":mod:`!ast` --- 抽象語法樹 (Abstract Syntax Trees)" @@ -52,7 +51,6 @@ msgstr "" "函式將抽象語法樹編譯成 Python 程式碼物件。" #: ../../library/ast.rst:33 -#, fuzzy msgid "Abstract grammar" msgstr "抽象文法 (Abstract Grammar)" @@ -263,7 +261,7 @@ msgid "" "abstract: only instances of specific constructor nodes are ever created." msgstr "" "抽象文法中為每個左側符號定義了一個類別(例如 :class:`ast.stmt` " -"或 :class:`ast.expr`\\ )。此外,也為每個右側的建構函式 (constructor) 定義了" +"或 :class:`ast.expr`)。此外,也為每個右側的建構函式 (constructor) 定義了" "一個類別;這些類別繼承自左側樹的類別。例如,:class:`ast.BinOp` 繼承" "自 :class:`ast.expr`。對於具有替代方案(即為「和 (sums)」)的生產規則,左側類" "別是抽象的:僅有特定建構函式節點的實例會被建立。" @@ -657,19 +655,16 @@ msgid "-1: no formatting" msgstr "-1: 無格式化" #: ../../library/ast.rst:293 -#, fuzzy msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` formatting" -msgstr "97: ``!a`` ascii 格式化" +msgstr "97 (``ord('a')``):``!a`` :func:`ASCII ` 格式化" #: ../../library/ast.rst:294 -#, fuzzy msgid "114 (``ord('r')``): ``!r`` :func:`repr` formatting" -msgstr "114:``!r`` 重複格式化化" +msgstr "114 (``ord('r')``):``!r`` :func:`repr` 格式化" #: ../../library/ast.rst:295 -#, fuzzy msgid "115 (``ord('s')``): ``!s`` :func:`string ` formatting" -msgstr "115: ``!s`` 字串格式化" +msgstr "115 (``ord('s')``):``!s`` :func:`string ` 格式化" #: ../../library/ast.rst:297 msgid "" @@ -737,7 +732,6 @@ msgid "" msgstr "" #: ../../library/ast.rst:337 -#, fuzzy msgid "" ">>> expr = ast.parse('t\"{name} finished {place:ordinal}\"', mode='eval')\n" ">>> print(ast.dump(expr, indent=4))\n" @@ -757,25 +751,23 @@ msgid "" " values=[\n" " Constant(value='ordinal')]))]))" msgstr "" -">>> print(ast.dump(ast.parse('f\"sin({a}) is {sin(a):.3}\"', mode='eval'), " -"indent=4))\n" +">>> expr = ast.parse('t\"{name} finished {place:ordinal}\"', mode='eval')\n" +">>> print(ast.dump(expr, indent=4))\n" "Expression(\n" -" body=JoinedStr(\n" +" body=TemplateStr(\n" " values=[\n" -" Constant(value='sin('),\n" -" FormattedValue(\n" -" value=Name(id='a', ctx=Load()),\n" +" Interpolation(\n" +" value=Name(id='name', ctx=Load()),\n" +" str='name',\n" " conversion=-1),\n" -" Constant(value=') is '),\n" -" FormattedValue(\n" -" value=Call(\n" -" func=Name(id='sin', ctx=Load()),\n" -" args=[\n" -" Name(id='a', ctx=Load())]),\n" +" Constant(value=' finished '),\n" +" Interpolation(\n" +" value=Name(id='place', ctx=Load()),\n" +" str='place',\n" " conversion=-1,\n" " format_spec=JoinedStr(\n" " values=[\n" -" Constant(value='.3')]))]))" +" Constant(value='ordinal')]))]))" #: ../../library/ast.rst:361 msgid "" @@ -783,11 +775,10 @@ msgid "" msgstr "" #: ../../library/ast.rst:363 -#, fuzzy msgid "" "``value`` is any expression node (such as a literal, a variable, or a " "function call). This has the same meaning as ``FormattedValue.value``." -msgstr "``value`` 為任何運算式節點(例如文字、變數或函式呼叫)。" +msgstr "``value`` 為任何運算式節點(例如文字、變數或函式呼叫)。這和 ``FormattedValue.value`` 的意思相同。" #: ../../library/ast.rst:366 msgid "" @@ -795,28 +786,26 @@ msgid "" msgstr "" #: ../../library/ast.rst:369 -#, fuzzy msgid "-1: no conversion" -msgstr "-1: 無格式化" +msgstr "-1:無規範" #: ../../library/ast.rst:370 msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` conversion" -msgstr "" +msgstr "97 (``ord('a')``):``!a`` :func:`ASCII ` 轉換" #: ../../library/ast.rst:371 msgid "114 (``ord('r')``): ``!r`` :func:`repr` conversion" -msgstr "" +msgstr "114 (``ord('r')``):``!r`` :func:`repr` 轉換" #: ../../library/ast.rst:372 msgid "115 (``ord('s')``): ``!s`` :func:`string ` conversion" -msgstr "" +msgstr "115 (``ord('s')``):``!s`` :func:`string ` 轉換" #: ../../library/ast.rst:374 msgid "This has the same meaning as ``FormattedValue.conversion``." -msgstr "" +msgstr "這與 ``FormattedValue.conversion`` 的意思相同。" #: ../../library/ast.rst:375 -#, fuzzy msgid "" "``format_spec`` is a :class:`JoinedStr` node representing the formatting of " "the value, or ``None`` if no format was specified. Both ``conversion`` and " @@ -824,7 +813,8 @@ msgid "" "``FormattedValue.format_spec``." msgstr "" "``format_spec`` 是一個 :class:`JoinedStr` 節點,表示值的格式,若未指定格式則" -"為 ``None``。``conversion`` 和 ``format_spec`` 可以同時設定。" +"為 ``None``。``conversion`` 和 ``format_spec`` 可以同時設定。這與 " +"``FormattedValue.format_spec`` 的意思相同。" #: ../../library/ast.rst:384 msgid "" @@ -1136,7 +1126,7 @@ msgid "" "values." msgstr "" "布林運算 'or' 或 'and'。``op`` 是 :class:`Or` 或 :class:`And`。``values`` 是" -"有所涉及的值。使用同一運算子的連續操作(例如 ``a or b or c``\\ )會被折疊為具" +"有所涉及的值。使用同一運算子的連續操作(例如 ``a or b or c``)會被折疊為具" "有多個值的一個節點。" #: ../../library/ast.rst:595 @@ -1398,7 +1388,7 @@ msgid "" "occur only inside the *slice* field of :class:`Subscript`, either directly " "or as an element of :class:`Tuple`." msgstr "" -"常規切片(形式為 ``lower:upper`` 或 ``lower:upper:step``\\ )。只能直接或者或" +"常規切片(形式為 ``lower:upper`` 或 ``lower:upper:step``)。只能直接或者或" "者作為 :class:`Tuple` 的元素出現在 :class:`Subscript` 的 *slice* 欄位內。" #: ../../library/ast.rst:766 @@ -1432,7 +1422,7 @@ msgid "" "representing the part that will be evaluated for each item." msgstr "" "串列和集合綜合運算、生成器運算式和字典綜合運算。``elt``\\ (或 ``key`` 和 " -"``value``\\ )是單個節點,表示各個項目會被求值 (evaluate) 的部分。" +"``value``)是單個節點,表示各個項目會被求值 (evaluate) 的部分。" #: ../../library/ast.rst:790 msgid "``generators`` is a list of :class:`comprehension` nodes." @@ -3906,7 +3896,6 @@ msgstr "" "和 :class:`With` 相同的欄位。僅在 :class:`AsyncFunctionDef` 主體中有效。" #: ../../library/ast.rst:2207 -#, fuzzy msgid "" "When a string is parsed by :func:`ast.parse`, operator nodes (subclasses " "of :class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast.boolop` " @@ -3915,12 +3904,11 @@ msgid "" "(for example, :class:`ast.Add`)." msgstr "" "當字串被 :func:`ast.parse` 剖析時,回傳樹的運算子節點" -"(\\ :class:`ast.operator`、:class:`ast.unaryop`、:class:`ast.cmpop`、:class: :class:`ast.boolop` " -"和 :class:`ast.expr_context`\\ )將是單例。對其中之一的更改將反映在所有其他出" -"現的相同值中(例如 :class:`ast.Add`\\ )。" +"(:class:`ast.operator`、:class:`ast.unaryop`、:class:`ast.cmpop`、:class:`ast.boolop` " +"和 :class:`ast.expr_context` 的子類別)將是單例。對其中之一的更改將反映在所有其他出" +"現的相同值中(例如 :class:`ast.Add`)。" #: ../../library/ast.rst:2215 -#, fuzzy msgid ":mod:`ast` helpers" msgstr ":mod:`ast` 輔助程式" @@ -4152,7 +4140,7 @@ msgid "" msgstr "" "取得生成 *node* 的 *source* 的原始碼片段。如果某些位置資訊" "(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` " -"或 :attr:`~ast.AST.end_col_offset`\\ )遺漏,則回傳 ``None``。" +"或 :attr:`~ast.AST.end_col_offset`)遺漏,則回傳 ``None``。" #: ../../library/ast.rst:2352 msgid "" @@ -4357,7 +4345,7 @@ msgid "" "with the new sub-tree to recalculate the location information::" msgstr "" "如果 :class:`NodeTransformer` 引進了新節點(不屬於原始樹的一部分),但沒有給" -"它們提供位置資訊(例如 :attr:`~ast.AST.lineno`\\ ),則應使用新的子樹呼" +"它們提供位置資訊(例如 :attr:`~ast.AST.lineno`),則應使用新的子樹呼" "叫 :func:`fix_missing_locations` 以重新計算位置資訊: ::" #: ../../library/ast.rst:2475 @@ -4404,7 +4392,7 @@ msgstr "" "如果 *indent* 是非負整數或字串,那麼樹將使用該縮排級別來做漂亮印出 (pretty-" "print)。縮排級別 0、負數或 ``\"\"`` 只會插入換列符號 (newlines)。``None``\\ " "(預設值)代表選擇單列表示。使用正整數縮排可以在每個級別縮排相同數量的空格。" -"如果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個級別。" +"如果 *indent* 是一個字串(例如 ``\"\\t\"``),則該字串用於縮排每個級別。" #: ../../library/ast.rst:2500 msgid "" @@ -4475,7 +4463,6 @@ msgstr "" " type_ignores=[])" #: ../../library/ast.rst:2541 -#, fuzzy msgid "Compiler flags" msgstr "編譯器旗標" @@ -4529,7 +4516,6 @@ msgid "" msgstr "" #: ../../library/ast.rst:2590 -#, fuzzy msgid "Command-line usage" msgstr "命令列用法" diff --git a/library/asynchat.po b/library/asynchat.po index cd03892c966..465364123a9 100644 --- a/library/asynchat.po +++ b/library/asynchat.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/asyncio-api-index.po b/library/asyncio-api-index.po index dee0c33f50b..a58fb67be6f 100644 --- a/library/asyncio-api-index.po +++ b/library/asyncio-api-index.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-31 08:13+0000\n" "PO-Revision-Date: 2022-01-27 21:25+0800\n" diff --git a/library/asyncio-dev.po b/library/asyncio-dev.po index 2b6078527fd..38c77951476 100644 --- a/library/asyncio-dev.po +++ b/library/asyncio-dev.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-02-18 14:17+0800\n" @@ -198,7 +198,6 @@ msgid "To handle signals the event loop must be run in the main thread." msgstr "為了能夠處理訊號,事件迴圈必須於主執行緒中運行。" #: ../../library/asyncio-dev.rst:101 -#, fuzzy msgid "" "The :meth:`loop.run_in_executor` method can be used with " "a :class:`concurrent.futures.ThreadPoolExecutor` " @@ -207,7 +206,8 @@ msgid "" "loop runs in." msgstr "" ":meth:`loop.run_in_executor` 方法可以" -"和 :class:`concurrent.futures.ThreadPoolExecutor` 一起使用,這能夠在作業系統" +"和 :class:`concurrent.futures.ThreadPoolExecutor` 或 " +":class:`~concurrent.futures.InterpreterPoolExecutor` 一起使用,這能夠在作業系統" "上另一個不同的執行緒中執行阻塞程式,且避免阻塞執行事件迴圈的執行緒。" #: ../../library/asyncio-dev.rst:107 @@ -245,15 +245,14 @@ msgstr "" "式,那麼所有並行非同步 Tasks 和 IO 操作都會被延遲 1 秒。" #: ../../library/asyncio-dev.rst:128 -#, fuzzy msgid "" "An executor can be used to run a task in a different thread, including in a " "different interpreter, or even in a different process to avoid blocking the " "OS thread with the event loop. See the :meth:`loop.run_in_executor` method " "for more details." msgstr "" -"一個 executor(執行器)可以被用來在不同的執行緒、或甚至不同的行程中執行任務," -"以避免使用事件迴圈阻塞 OS 執行緒。詳情請見 :meth:`loop.run_in_executor` 方" +"一個 executor(執行器)可以被用來在不同的執行緒(包含不同直譯器)、或甚至不同的行程中執行任務," +"以避免事件迴圈阻塞了 OS 執行緒。詳情請見 :meth:`loop.run_in_executor` 方" "法。" #: ../../library/asyncio-dev.rst:138 diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index 0e7e3a5aa7c..0c8a6558752 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" @@ -117,9 +117,8 @@ msgstr "" "函式手動建立和關閉事件迴圈。" #: ../../library/asyncio-eventloop.rst:62 -#, fuzzy msgid "Raises a :exc:`RuntimeError` if there is no current event loop." -msgstr "如果沒有運行的事件迴圈,則引發 :exc:`RuntimeError`。" +msgstr "如果沒有目前的事件迴圈,則引發 :exc:`RuntimeError`。" #: ../../library/asyncio-eventloop.rst:67 msgid "" @@ -2084,7 +2083,6 @@ msgstr "" "(\\ :class:`~concurrent.futures.ThreadPoolExecutor`)設定預設值。" #: ../../library/asyncio-eventloop.rst:1421 -#, fuzzy msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " "*executor* must be an instance " @@ -2092,7 +2090,8 @@ msgid "" "includes :class:`~concurrent.futures.InterpreterPoolExecutor`." msgstr "" "將 *executor* 設置為 :meth:`run_in_executor` 使用的預設執行器。*executor* 必" -"須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" +"須是 :class:`~concurrent.futures.ThreadPoolExecutor`\\ " +"(也包含 :class:`~concurrent.futures.InterpreterPoolExecutor`)的實例。" #: ../../library/asyncio-eventloop.rst:1426 msgid "" diff --git a/library/asyncio-exceptions.po b/library/asyncio-exceptions.po index e08327656e2..ddcb5a4f752 100644 --- a/library/asyncio-exceptions.po +++ b/library/asyncio-exceptions.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-06 00:19+0000\n" "PO-Revision-Date: 2022-01-31 21:41+0800\n" diff --git a/library/asyncio-extending.po b/library/asyncio-extending.po index f7a1ab412f2..1f8b54e078e 100644 --- a/library/asyncio-extending.po +++ b/library/asyncio-extending.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/asyncio-future.po b/library/asyncio-future.po index 0b0c496481d..c2812e4b70e 100644 --- a/library/asyncio-future.po +++ b/library/asyncio-future.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-01-25 01:29+0800\n" @@ -99,12 +99,12 @@ msgid "" msgstr "將參照 (reference) 儲存至此函式的結果,用以防止任務在執行中消失。" #: ../../library/asyncio-future.rst:57 -#, fuzzy msgid "" "See also the :func:`create_task` function which is the preferred way for " "creating new tasks or use :class:`asyncio.TaskGroup` which keeps reference " "to the task internally." -msgstr "請見 :func:`create_task` 函式,它是建立新 Task 的推薦方法。" +msgstr "請見 :func:`create_task` 函式,它是建立新 Task 的推薦方法。或者使用 " +":class:`asyncio.TaskGroup`,它會在內部保留對 Task 的參照。" #: ../../library/asyncio-future.rst:61 msgid "The function accepts any :term:`awaitable` object." diff --git a/library/asyncio-graph.po b/library/asyncio-graph.po index ce9e8e24336..59b3e1cfb8d 100644 --- a/library/asyncio-graph.po +++ b/library/asyncio-graph.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -23,7 +22,7 @@ msgstr "" #: ../../library/asyncio-graph.rst:10 msgid "**Source code:** :source:`Lib/asyncio/graph.py`" -msgstr "" +msgstr "**原始碼:**\\ :source:`Lib/asyncio/graph.py`" #: ../../library/asyncio-graph.rst:14 msgid "" @@ -77,11 +76,11 @@ msgstr "" #: ../../library/asyncio-graph.rst:49 msgid "**Example:**" -msgstr "" +msgstr "**範例:**" #: ../../library/asyncio-graph.rst:51 msgid "The following Python code:" -msgstr "" +msgstr "以下 Python 程式碼:" #: ../../library/asyncio-graph.rst:53 msgid "" @@ -96,10 +95,20 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"\n" +"async def test():\n" +" asyncio.print_call_graph()\n" +"\n" +"async def main():\n" +" async with asyncio.TaskGroup() as g:\n" +" g.create_task(test(), name='test')\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-graph.rst:66 msgid "will print::" -msgstr "" +msgstr "會印出: ::" #: ../../library/asyncio-graph.rst:68 msgid "" @@ -112,6 +121,14 @@ msgid "" " | File 'taskgroups.py', line 107, in async TaskGroup.__aexit__()\n" " | File 't2.py', line 7, in async main()" msgstr "" +"* Task(name='test', id=0x1039f0fe0)\n" +"+ Call stack:\n" +"| File 't2.py', line 4, in async test()\n" +"+ Awaited by:\n" +" * Task(name='Task-1', id=0x103a5e060)\n" +" + Call stack:\n" +" | File 'taskgroups.py', line 107, in async TaskGroup.__aexit__()\n" +" | File 't2.py', line 7, in async main()" #: ../../library/asyncio-graph.rst:79 msgid "" @@ -134,11 +151,11 @@ msgstr "" #: ../../library/asyncio-graph.rst:97 msgid "Returns a ``FutureCallGraph`` data class object:" -msgstr "" +msgstr "會回傳一個 ``FutureCallGraph`` 資料類別物件:" #: ../../library/asyncio-graph.rst:99 msgid "``FutureCallGraph(future, call_stack, awaited_by)``" -msgstr "" +msgstr "``FutureCallGraph(future, call_stack, awaited_by)``" #: ../../library/asyncio-graph.rst:101 msgid "" @@ -148,15 +165,15 @@ msgstr "" #: ../../library/asyncio-graph.rst:104 msgid "``call_stack`` is a tuple of ``FrameCallGraphEntry`` objects." -msgstr "" +msgstr "``call_stack`` 是一個由 ``FrameCallGraphEntry`` 物件組成的元組。" #: ../../library/asyncio-graph.rst:106 msgid "``awaited_by`` is a tuple of ``FutureCallGraph`` objects." -msgstr "" +msgstr "``awaited_by`` 是一個由 ``FutureCallGraph`` 物件組成的元組。" #: ../../library/asyncio-graph.rst:108 msgid "``FrameCallGraphEntry(frame)``" -msgstr "" +msgstr "``FrameCallGraphEntry(frame)``" #: ../../library/asyncio-graph.rst:110 msgid "" @@ -166,7 +183,7 @@ msgstr "" #: ../../library/asyncio-graph.rst:115 msgid "Low level utility functions" -msgstr "" +msgstr "低階工具函式" #: ../../library/asyncio-graph.rst:117 msgid "" diff --git a/library/asyncio-llapi-index.po b/library/asyncio-llapi-index.po index 555d9dd6d5f..6ddd9f538cd 100644 --- a/library/asyncio-llapi-index.po +++ b/library/asyncio-llapi-index.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-10-12 11:27+0800\n" @@ -199,9 +199,8 @@ msgid "Invoke a callback *at* the given time." msgstr "在給定時間\\ *當下*\\ 呼叫回呼函式。" #: ../../library/asyncio-llapi-index.rst:99 -#, fuzzy msgid "Thread/Interpreter/Process Pool" -msgstr "執行緒 (Thread)/行程池 (Process Pool)" +msgstr "執行緒 (Thread)/直譯器 (Interpreter)/行程池 (Process Pool)" #: ../../library/asyncio-llapi-index.rst:104 msgid "``await`` :meth:`loop.run_in_executor`" diff --git a/library/asyncio-platforms.po b/library/asyncio-platforms.po index 8f1332f00a0..781b0afe801 100644 --- a/library/asyncio-platforms.po +++ b/library/asyncio-platforms.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # @@ -8,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-01-17 11:37+0800\n" @@ -195,13 +194,3 @@ msgstr "" "selector = selectors.SelectSelector()\n" "loop = asyncio.SelectorEventLoop(selector)\n" "asyncio.set_event_loop(loop)" - -#~ msgid "" -#~ "The :meth:`policy.set_child_watcher() " -#~ "` function is also not " -#~ "supported, as :class:`ProactorEventLoop` has a different mechanism to " -#~ "watch child processes." -#~ msgstr "" -#~ "也不支援 :meth:`policy.set_child_watcher() " -#~ "` 函" -#~ "式,:class:`ProactorEventLoop` 在監視子行程上有不同的機制。" diff --git a/library/asyncio-policy.po b/library/asyncio-policy.po index 459eb052ef2..e954684ad8d 100644 --- a/library/asyncio-policy.po +++ b/library/asyncio-policy.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/asyncio-protocol.po b/library/asyncio-protocol.po index 9b98f921a4d..a8034290eb5 100644 --- a/library/asyncio-protocol.po +++ b/library/asyncio-protocol.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-17 00:18+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index 03c675e1b18..29ef9ec4533 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-02-20 18:34+0800\n" diff --git a/library/asyncio-runner.po b/library/asyncio-runner.po index 31d811354f0..6ae58e897cf 100644 --- a/library/asyncio-runner.po +++ b/library/asyncio-runner.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -43,21 +43,19 @@ msgid "Running an asyncio Program" msgstr "運行一個 asyncio 程式" #: ../../library/asyncio-runner.rst:27 -#, fuzzy msgid "Execute *coro* in an asyncio event loop and return the result." -msgstr "執行\\ :term:`協程 (coroutine) ` *coro* 並回傳結果。" +msgstr "在 asyncio 事件迴圈中執行 *coro* 並回傳結果。" #: ../../library/asyncio-runner.rst:29 ../../library/asyncio-runner.rst:121 msgid "The argument can be any awaitable object." -msgstr "" +msgstr "該引數可以是任何可等待物件 (awaitable object)。" #: ../../library/asyncio-runner.rst:31 -#, fuzzy msgid "" "This function runs the awaitable, taking care of managing the asyncio event " "loop, *finalizing asynchronous generators*, and closing the executor." msgstr "" -"這個函式負責運行被傳入的協程、管理 asyncio 的事件迴圈、*終結非同步產生器*,以" +"這個函式負責運行被傳入的可等待物件、管理 asyncio 的事件迴圈、*終結非同步產生器*\\ 以" "及關閉執行器。" #: ../../library/asyncio-runner.rst:35 ../../library/asyncio-runner.rst:131 diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index 07e98be812c..0ed40b78cb9 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2022-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-19 00:16+0000\n" "PO-Revision-Date: 2022-10-31 16:28+0800\n" diff --git a/library/asyncio-subprocess.po b/library/asyncio-subprocess.po index 621d063238d..ff9476760ae 100644 --- a/library/asyncio-subprocess.po +++ b/library/asyncio-subprocess.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" @@ -83,7 +82,7 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:40 msgid "will print::" -msgstr "" +msgstr "會印出: ::" #: ../../library/asyncio-subprocess.rst:42 msgid "" @@ -129,7 +128,7 @@ msgstr "建立子行程" #: ../../library/asyncio-subprocess.rst:68 msgid "Create a subprocess." -msgstr "" +msgstr "建立一個子行程。" #: ../../library/asyncio-subprocess.rst:70 #: ../../library/asyncio-subprocess.rst:89 @@ -143,7 +142,7 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:74 #: ../../library/asyncio-subprocess.rst:93 msgid "Return a :class:`~asyncio.subprocess.Process` instance." -msgstr "" +msgstr "回傳一個 :class:`~asyncio.subprocess.Process` 實例。" #: ../../library/asyncio-subprocess.rst:76 msgid "" @@ -153,11 +152,11 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:79 #: ../../library/asyncio-subprocess.rst:107 msgid "Removed the *loop* parameter." -msgstr "" +msgstr "移除了 *loop* 參數。" #: ../../library/asyncio-subprocess.rst:87 msgid "Run the *cmd* shell command." -msgstr "" +msgstr "執行 *cmd* shell 命令。" #: ../../library/asyncio-subprocess.rst:95 msgid "" @@ -227,7 +226,7 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:157 msgid "Interacting with Subprocesses" -msgstr "" +msgstr "與子行程互動" #: ../../library/asyncio-subprocess.rst:159 msgid "" @@ -310,15 +309,15 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:214 msgid "closes *stdin*;" -msgstr "" +msgstr "關閉 *stdin*;" #: ../../library/asyncio-subprocess.rst:215 msgid "read data from *stdout* and *stderr*, until EOF is reached;" -msgstr "" +msgstr "從 *stdout* 和 *stderr* 讀取資料,直到 EOF;" #: ../../library/asyncio-subprocess.rst:216 msgid "wait for process to terminate." -msgstr "" +msgstr "等待行程終止。" #: ../../library/asyncio-subprocess.rst:218 msgid "" @@ -328,7 +327,7 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:221 msgid "Return a tuple ``(stdout_data, stderr_data)``." -msgstr "" +msgstr "回傳一個 ``(stdout_data, stderr_data)`` 元組。" #: ../../library/asyncio-subprocess.rst:223 msgid "" @@ -450,7 +449,7 @@ msgstr "" #: ../../library/asyncio-subprocess.rst:315 msgid "Subprocess and Threads" -msgstr "子行程與線程" +msgstr "子行程與執行緒" #: ../../library/asyncio-subprocess.rst:317 msgid "" diff --git a/library/asyncio-sync.po b/library/asyncio-sync.po index cee3fe67891..4d524fee3b0 100644 --- a/library/asyncio-sync.po +++ b/library/asyncio-sync.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-17 00:18+0000\n" "PO-Revision-Date: 2022-02-09 19:27+0800\n" diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 69da550c629..061f1ca20a3 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" @@ -455,9 +455,8 @@ msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" #: ../../library/asyncio-task.rst:299 -#, fuzzy msgid "Added the *eager_start* parameter by passing on all *kwargs*." -msgstr "新增 *eager_start* 參數。" +msgstr "" #: ../../library/asyncio-task.rst:304 msgid "Task Cancellation" @@ -539,6 +538,12 @@ msgid "" " print(f\"Both tasks have completed now: {task1.result()}, " "{task2.result()}\")" msgstr "" +"async def main():\n" +" async with asyncio.TaskGroup() as tg:\n" +" task1 = tg.create_task(some_coro(...))\n" +" task2 = tg.create_task(another_coro(...))\n" +" print(f\"Both tasks have completed now: {task1.result()}, " +"{task2.result()}\")" #: ../../library/asyncio-task.rst:366 msgid "" @@ -677,6 +682,9 @@ msgid "" "Task 2: start\n" "Task 1: done" msgstr "" +"Task 1: start\n" +"Task 2: start\n" +"Task 1: done" #: ../../library/asyncio-task.rst:478 msgid "Sleeping" @@ -747,7 +755,7 @@ msgstr "移除 *loop* 參數。" #: ../../library/asyncio-task.rst:518 msgid "Raises :exc:`ValueError` if *delay* is :data:`~math.nan`." -msgstr "" +msgstr "如果 *delay* 是 :data:`~math.nan`,則引發 :exc:`ValueError`。" #: ../../library/asyncio-task.rst:523 msgid "Running Tasks Concurrently" diff --git a/library/asyncio.po b/library/asyncio.po index 62b4ee60dce..d302ddf643d 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +8,7 @@ # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-07-06 17:13+0800\n" diff --git a/library/asyncore.po b/library/asyncore.po index 98419d8bc42..39efa7aab0b 100644 --- a/library/asyncore.po +++ b/library/asyncore.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/atexit.po b/library/atexit.po index d671623db51..3d2dfc378c7 100644 --- a/library/atexit.po +++ b/library/atexit.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-01-31 07:13+0000\n" diff --git a/library/audioop.po b/library/audioop.po index 7e17882da92..9fd2a98adb8 100644 --- a/library/audioop.po +++ b/library/audioop.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/audit_events.po b/library/audit_events.po index d02a27507c4..215970aa6e1 100644 --- a/library/audit_events.po +++ b/library/audit_events.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2021-12-06 21:50+0800\n" @@ -121,11 +120,11 @@ msgstr "``handle``, ``exit_code``" #: ../../library/audit_events.rst:46 msgid "_posixsubprocess.fork_exec" -msgstr "" +msgstr "_posixsubprocess.fork_exec" #: ../../library/audit_events.rst:46 msgid "``exec_list``, ``args``, ``env``" -msgstr "" +msgstr "``exec_list``, ``args``, ``env``" #: ../../library/audit_events.rst:48 msgid "ctypes.PyObj_FromPtr" @@ -137,7 +136,7 @@ msgstr "``obj``" #: ../../library/audit_events.rst:51 msgid "The ``_posixsubprocess.fork_exec`` internal audit event." -msgstr "" +msgstr "內部稽核事件 ``_posixsubprocess.fork_exec``。" #: ../../library/audit_events.rst:3 msgid "audit events" diff --git a/library/base64.po b/library/base64.po index 59e5ded526a..5607863d9b5 100644 --- a/library/base64.po +++ b/library/base64.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Inndy, 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" diff --git a/library/bdb.po b/library/bdb.po index 08ecf48ba3b..37f55c0b11b 100644 --- a/library/bdb.po +++ b/library/bdb.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" @@ -207,9 +206,8 @@ msgid "Added the *skip* parameter." msgstr "新增 *skip* 引數。" #: ../../library/bdb.rst:148 -#, fuzzy msgid "Added the *backend* parameter." -msgstr "新增 *skip* 引數。" +msgstr "新增 *backend* 參數。" #: ../../library/bdb.rst:151 msgid "" diff --git a/library/binary.po b/library/binary.po index 5c36e1bf9ce..2b91220f39f 100644 --- a/library/binary.po +++ b/library/binary.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/binascii.po b/library/binascii.po index 48302802ab3..4cae1df2e34 100644 --- a/library/binascii.po +++ b/library/binascii.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" diff --git a/library/bisect.po b/library/bisect.po index 2b3e26b4c36..5d583395d6b 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +8,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-08-01 12:53+0800\n" @@ -140,13 +140,12 @@ msgid "Insert *x* in *a* in sorted order." msgstr "將元素 *x* 插入 list *a*,並維持順序。" #: ../../library/bisect.rst:85 -#, fuzzy msgid "" "This function first runs :py:func:`~bisect.bisect_left` to locate an " "insertion point. Next, it runs the :meth:`~sequence.insert` method on *a* to " "insert *x* at the appropriate position to maintain sort order." msgstr "" -"此函式先使用 :py:func:`~bisect.bisect_left` 搜尋插入位置,接著用 :meth:`!" +"此函式先使用 :py:func:`~bisect.bisect_left` 搜尋插入位置,接著用 :meth:`~sequence." "insert` 於 *a* 以將 *x* 插入,並維持添加元素後的順序。" #: ../../library/bisect.rst:89 ../../library/bisect.rst:109 @@ -172,13 +171,12 @@ msgstr "" "面(右邊)。" #: ../../library/bisect.rst:105 -#, fuzzy msgid "" "This function first runs :py:func:`~bisect.bisect_right` to locate an " "insertion point. Next, it runs the :meth:`~sequence.insert` method on *a* to " "insert *x* at the appropriate position to maintain sort order." msgstr "" -"此函式先使用 :py:func:`~bisect.bisect_right` 搜尋插入位置,接著用 :meth:`!" +"此函式先使用 :py:func:`~bisect.bisect_right` 搜尋插入位置,接著用 :meth:`~sequence." "insert` 於 *a* 以將 *x* 插入,並維持添加元素後的順序。" #: ../../library/bisect.rst:120 diff --git a/library/builtins.po b/library/builtins.po index ab36c9d83d1..77bd54a9de8 100644 --- a/library/builtins.po +++ b/library/builtins.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2022-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2022-02-15 20:55+0800\n" diff --git a/library/bz2.po b/library/bz2.po index f0ec58fb6a9..80e47865d88 100644 --- a/library/bz2.po +++ b/library/bz2.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" diff --git a/library/calendar.po b/library/calendar.po index eec862b56b1..1a974b314f1 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" @@ -703,7 +703,6 @@ msgid "Low-level time related functions." msgstr "底層的時間相關函式。" #: ../../library/calendar.rst:578 -#, fuzzy msgid "Command-line usage" msgstr "命令列用法" diff --git a/library/cgi.po b/library/cgi.po index 5333d176a08..0731e1b5017 100644 --- a/library/cgi.po +++ b/library/cgi.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/cgitb.po b/library/cgitb.po index bc357c01bae..2e8508be52f 100644 --- a/library/cgitb.po +++ b/library/cgitb.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/chunk.po b/library/chunk.po index 981361eca29..2a720ed4241 100644 --- a/library/chunk.po +++ b/library/chunk.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/cmath.po b/library/cmath.po index a69b9e006c8..cf69d27a6e8 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-03-14 09:26+0800\n" @@ -54,7 +54,6 @@ msgstr "" "的分枝切割,我們則查看實部的符號。" #: ../../library/cmath.rst:26 -#, fuzzy msgid "" "For example, the :func:`cmath.sqrt` function has a branch cut along the " "negative real axis. An argument of ``-2-0j`` is treated as though it lies " @@ -62,32 +61,29 @@ msgid "" "axis::" msgstr "" "例如 :func:`cmath.sqrt` 函式具有一條沿負實軸的分枝切割。 引數 " -"``complex(-2.0, -0.0)`` 被視為位於分枝切割 *下方* 處理,因此給出的結果在負虛" +"``-2-0j`` 被視為位於分枝切割 *下方* 處理,因此給出的結果在負虛" "軸上: ::" #: ../../library/cmath.rst:31 -#, fuzzy msgid "" ">>> cmath.sqrt(-2-0j)\n" "-1.4142135623730951j" msgstr "" -">>> cmath.sqrt(complex(-2.0, -0.0))\n" +">>> cmath.sqrt(-2-0j)\n" "-1.4142135623730951j" #: ../../library/cmath.rst:34 -#, fuzzy msgid "" "But an argument of ``-2+0j`` is treated as though it lies above the branch " "cut::" -msgstr "但是引數 ``complex(-2.0, 0.0)`` 會被當成位於分枝切割上方處理: ::" +msgstr "但是引數 ``-2+0j`` 會被當成位於分枝切割上方處理: ::" #: ../../library/cmath.rst:37 -#, fuzzy msgid "" ">>> cmath.sqrt(-2+0j)\n" "1.4142135623730951j" msgstr "" -">>> cmath.sqrt(complex(-2.0, 0.0))\n" +">>> cmath.sqrt(-2+0j)\n" "1.4142135623730951j" #: ../../library/cmath.rst:42 @@ -400,16 +396,15 @@ msgstr "" "``z.imag`` 為零: ::" #: ../../library/cmath.rst:117 -#, fuzzy msgid "" ">>> phase(-1+0j)\n" "3.141592653589793\n" ">>> phase(-1-0j)\n" "-3.141592653589793" msgstr "" -">>> phase(complex(-1.0, 0.0))\n" +">>> phase(-1+0j)\n" "3.141592653589793\n" -">>> phase(complex(-1.0, -0.0))\n" +">>> phase(-1-0j)\n" "-3.141592653589793" #: ../../library/cmath.rst:125 diff --git a/library/cmd.po b/library/cmd.po index 347b67d8923..219ddb51b8a 100644 --- a/library/cmd.po +++ b/library/cmd.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Dr-XYZ , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2025-05-19 20:25+0800\n" diff --git a/library/cmdline.po b/library/cmdline.po index 2c1ac869394..c4a7cbc07b4 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-10-14 16:03+0800\n" @@ -98,23 +98,20 @@ msgid ":ref:`inspect `" msgstr ":ref:`inspect `" #: ../../library/cmdline.rst:27 -#, fuzzy msgid ":ref:`json `" -msgstr ":ref:`json.tool `" +msgstr ":ref:`json `" #: ../../library/cmdline.rst:28 -#, fuzzy msgid ":ref:`mimetypes `" -msgstr ":ref:`dis `" +msgstr ":ref:`mimetypes `" #: ../../library/cmdline.rst:29 msgid ":mod:`pdb`" msgstr ":mod:`pdb`" #: ../../library/cmdline.rst:30 -#, fuzzy msgid ":ref:`pickle `" -msgstr ":ref:`pickletools `" +msgstr ":ref:`pickle `" #: ../../library/cmdline.rst:31 msgid ":ref:`pickletools `" diff --git a/library/cmdlinelibs.po b/library/cmdlinelibs.po index 7cce8dba348..ffd411006fa 100644 --- a/library/cmdlinelibs.po +++ b/library/cmdlinelibs.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-16 00:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/code.po b/library/code.po index ee8ae46c299..ab57c96d384 100644 --- a/library/code.po +++ b/library/code.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-07-13 14:40+0000\n" diff --git a/library/codecs.po b/library/codecs.po index 507140edae6..e9bfa3e9fe1 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" @@ -2892,9 +2892,3 @@ msgstr "\\N" #: ../../library/codecs.rst:413 msgid "surrogatepass" msgstr "surrogatepass" - -#~ msgid "*input* must be a :class:`bytes` object." -#~ msgstr "*input* 必須是 :class:`bytes` 物件。" - -#~ msgid "*input* must be a :term:`bytes-like object`." -#~ msgstr "*input* 必須是 :term:`bytes-like object`。" diff --git a/library/codeop.po b/library/codeop.po index 36b73d432c3..61d65f13996 100644 --- a/library/codeop.po +++ b/library/codeop.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2024-09-24 20:28+0000\n" diff --git a/library/collections.abc.po b/library/collections.abc.po index f91aa57671f..1999abb4ab5 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" @@ -68,6 +68,10 @@ msgid "" ">>> isinstance(C(), Sequence)\n" "True" msgstr "" +">>> issubclass(C, Sequence)\n" +"True\n" +">>> isinstance(C(), Sequence)\n" +"True" #: ../../library/collections.abc.rst:50 msgid "" @@ -99,6 +103,10 @@ msgid "" ">>> isinstance(D(), Sequence)\n" "True" msgstr "" +">>> issubclass(D, Sequence)\n" +"True\n" +">>> isinstance(D(), Sequence)\n" +"True" #: ../../library/collections.abc.rst:76 msgid "" @@ -173,7 +181,7 @@ msgstr "" #: ../../library/collections.abc.rst:120 msgid "Abstract Methods" -msgstr "" +msgstr "抽象方法" #: ../../library/collections.abc.rst:120 msgid "Mixin Methods" @@ -782,6 +790,3 @@ msgstr "" #: ../../library/collections.abc.rst:447 msgid "For more about ABCs, see the :mod:`abc` module and :pep:`3119`." msgstr "關於 ABC 的更多資訊請見 :mod:`abc` module 和 :pep:`3119`。" - -#~ msgid ":class:`ByteString`" -#~ msgstr ":class:`ByteString`" diff --git a/library/collections.po b/library/collections.po index 3fd7d6091d3..637cf57e017 100644 --- a/library/collections.po +++ b/library/collections.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,9 +7,9 @@ # Matt Wang , 2022-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\n" "PO-Revision-Date: 2024-01-22 21:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1201,11 +1201,11 @@ msgstr ":class:`defaultdict` 物件支援以下實例變數:" #: ../../library/collections.rst:761 msgid "" -"This attribute is used by the :meth:`__missing__` method; it is initialized " -"from the first argument to the constructor, if present, or to ``None``, if " -"absent." +"This attribute is used by the :meth:`~defaultdict.__missing__` method; it is " +"initialized from the first argument to the constructor, if present, or to " +"``None``, if absent." msgstr "" -"此屬性為 :meth:`__missing__` 方法所使用。如果有引數被傳入建構函式,則此屬性會" +"此屬性為 :meth:`~defaultdict.__missing__` 方法所使用。如果有引數被傳入建構函式,則此屬性會" "被初始化成第一個引數,如未提供引數則被初始化為 ``None``。" #: ../../library/collections.rst:765 ../../library/collections.rst:1192 @@ -1226,7 +1226,6 @@ msgstr "" "值對序列轉換為包含 list 之字典:" #: ../../library/collections.rst:784 -#, fuzzy msgid "" "When each key is encountered for the first time, it is not already in the " "mapping; so an entry is automatically created using " @@ -1240,10 +1239,10 @@ msgid "" msgstr "" "當每個鍵第一次被存取時,它還沒有存在於對映中,所以會自動呼" "叫 :attr:`~defaultdict.default_factory` 方法來回傳一個空的 :class:`list` 以建" -"立一個條目,:meth:`!list.append` 操作後續會再新增值到這個新的列表裡。當再次存" -"取該鍵時,就如普通字典般操作(回傳該鍵所對應到的 list),:meth:`!" -"list.append` 也會新增另一個值到 list 中。和使用與其等價" -"的 :meth:`dict.setdefault` 相比,這個技巧更加快速和簡單:" +"立一個條目,:meth:`list.append` 操作後續會再新增值到這個新的列表裡。當再次存" +"取該鍵時,就如普通字典般操作(回傳該鍵所對應到的 list),:meth:`list.append` " +"也會新增另一個值到 list 中。和使用與其等價的 :meth:`dict.setdefault` 相比,這" +"個技巧更加快速和簡單:" #: ../../library/collections.rst:799 msgid "" diff --git a/library/colorsys.po b/library/colorsys.po index 3bf03343123..2259120e20f 100644 --- a/library/colorsys.po +++ b/library/colorsys.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-02-15 20:58+0800\n" diff --git a/library/compileall.po b/library/compileall.po index 645f85c5df9..c15b01fef67 100644 --- a/library/compileall.po +++ b/library/compileall.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" diff --git a/library/compression.po b/library/compression.po index bfc26a2ad7e..8bedbc98d67 100644 --- a/library/compression.po +++ b/library/compression.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -19,7 +18,7 @@ msgstr "" #: ../../library/compression.rst:2 msgid "The :mod:`!compression` package" -msgstr "" +msgstr ":mod:`!compression` 套件" #: ../../library/compression.rst:6 msgid "" diff --git a/library/compression.zstd.po b/library/compression.zstd.po index aa111409847..c6dcd7a7a93 100644 --- a/library/compression.zstd.po +++ b/library/compression.zstd.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -21,10 +20,11 @@ msgstr "" msgid "" ":mod:`!compression.zstd` --- Compression compatible with the Zstandard format" msgstr "" +":mod:`!compression.zstd` --- 與 Zstandard 格式相容的壓縮" #: ../../library/compression.zstd.rst:10 msgid "**Source code:** :source:`Lib/compression/zstd/__init__.py`" -msgstr "" +msgstr "**原始碼:**\\ :source:`Lib/compression/zstd/__init__.py`" #: ../../library/compression.zstd.rst:14 msgid "" @@ -40,7 +40,7 @@ msgstr "" #: ../../library/compression.zstd.rst:23 msgid "The :mod:`!compression.zstd` module contains:" -msgstr "" +msgstr ":mod:`!compression.zstd` 模組包含:" #: ../../library/compression.zstd.rst:25 msgid "" @@ -75,7 +75,7 @@ msgstr "" #: ../../library/compression.zstd.rst:38 msgid "Exceptions" -msgstr "" +msgstr "例外" #: ../../library/compression.zstd.rst:42 msgid "" @@ -465,7 +465,7 @@ msgstr "" #: ../../library/compression.zstd.rst:363 msgid "Zstandard dictionaries" -msgstr "" +msgstr "Zstandard 字典" #: ../../library/compression.zstd.rst:368 msgid "" @@ -814,7 +814,7 @@ msgstr "" #: ../../library/compression.zstd.rst:604 msgid ":class:`Strategy`" -msgstr "" +msgstr ":class:`Strategy`" #: ../../library/compression.zstd.rst:608 msgid "" @@ -997,6 +997,12 @@ msgid "" "options = {DecompressionParameter.window_log_max: upper}\n" "decompress(data, options=options)" msgstr "" +"data = compress(b'Some very long buffer of bytes...')\n" +"\n" +"_lower, upper = DecompressionParameter.window_log_max.bounds()\n" +"\n" +"options = {DecompressionParameter.window_log_max: upper}\n" +"decompress(data, options=options)" #: ../../library/compression.zstd.rst:745 msgid "" @@ -1068,11 +1074,11 @@ msgstr "" #: ../../library/compression.zstd.rst:831 msgid "Examples" -msgstr "" +msgstr "範例" #: ../../library/compression.zstd.rst:833 msgid "Reading in a compressed file:" -msgstr "" +msgstr "讀取壓縮檔案:" #: ../../library/compression.zstd.rst:835 msgid "" @@ -1081,6 +1087,10 @@ msgid "" "with zstd.open(\"file.zst\") as f:\n" " file_content = f.read()" msgstr "" +"from compression import zstd\n" +"\n" +"with zstd.open(\"file.zst\") as f:\n" +" file_content = f.read()" #: ../../library/compression.zstd.rst:842 msgid "Creating a compressed file:" @@ -1094,6 +1104,11 @@ msgid "" "with zstd.open(\"file.zst\", \"w\") as f:\n" " f.write(data)" msgstr "" +"from compression import zstd\n" +"\n" +"data = b\"Insert Data Here\"\n" +"with zstd.open(\"file.zst\", \"w\") as f:\n" +" f.write(data)" #: ../../library/compression.zstd.rst:852 msgid "Compressing data in memory:" @@ -1106,6 +1121,10 @@ msgid "" "data_in = b\"Insert Data Here\"\n" "data_out = zstd.compress(data_in)" msgstr "" +"from compression import zstd\n" +"\n" +"data_in = b\"Insert Data Here\"\n" +"data_out = zstd.compress(data_in)" #: ../../library/compression.zstd.rst:861 msgid "Incremental compression:" @@ -1123,6 +1142,15 @@ msgid "" "# Concatenate all the partial results:\n" "result = b\"\".join([out1, out2, out3, out4])" msgstr "" +"from compression import zstd\n" +"\n" +"comp = zstd.ZstdCompressor()\n" +"out1 = comp.compress(b\"Some data\\n\")\n" +"out2 = comp.compress(b\"Another piece of data\\n\")\n" +"out3 = comp.compress(b\"Even more data\\n\")\n" +"out4 = comp.flush()\n" +"# Concatenate all the partial results:\n" +"result = b\"\".join([out1, out2, out3, out4])" #: ../../library/compression.zstd.rst:875 msgid "Writing compressed data to an already-open file:" @@ -1138,6 +1166,13 @@ msgid "" " zstf.write(b\"This *will* be compressed\\n\")\n" " f.write(b\"Not compressed\\n\")" msgstr "" +"from compression import zstd\n" +"\n" +"with open(\"myfile\", \"wb\") as f:\n" +" f.write(b\"This data will not be compressed\\n\")\n" +" with zstd.open(f, \"w\") as zstf:\n" +" zstf.write(b\"This *will* be compressed\\n\")\n" +" f.write(b\"Not compressed\\n\")" #: ../../library/compression.zstd.rst:887 msgid "Creating a compressed file using compression parameters:" @@ -1153,3 +1188,10 @@ msgid "" "with zstd.open(\"file.zst\", \"w\", options=options) as f:\n" " f.write(b\"Mind if I squeeze in?\")" msgstr "" +"from compression import zstd\n" +"\n" +"options = {\n" +" zstd.CompressionParameter.checksum_flag: 1\n" +"}\n" +"with zstd.open(\"file.zst\", \"w\", options=options) as f:\n" +" f.write(b\"Mind if I squeeze in?\")" diff --git a/library/concurrency.po b/library/concurrency.po index 7374fccb7f6..aee93b82e77 100644 --- a/library/concurrency.po +++ b/library/concurrency.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2021-11-23 13:36+0800\n" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index e064fad7e0a..447755e4423 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-01-24 03:33+0800\n" @@ -24,14 +24,13 @@ msgid ":mod:`!concurrent.futures` --- Launching parallel tasks" msgstr ":mod:`!concurrent.futures` --- 啟動平行任務" #: ../../library/concurrent.futures.rst:9 -#, fuzzy msgid "" "**Source code:** :source:`Lib/concurrent/futures/thread.py`, :source:`Lib/" "concurrent/futures/process.py`, and :source:`Lib/concurrent/futures/" "interpreter.py`" msgstr "" -"**原始碼:**\\ :source:`Lib/concurrent/futures/thread.py` 與 :source:`Lib/" -"concurrent/futures/process.py`" +"**原始碼:**\\ :source:`Lib/concurrent/futures/thread.py`、:source:`Lib/" +"concurrent/futures/process.py` 與 :source:`Lib/concurrent/futures/interpreter.py`" #: ../../library/concurrent.futures.rst:15 msgid "" @@ -42,14 +41,13 @@ msgstr "" "執行可呼叫物件 (callable) 。" #: ../../library/concurrent.futures.rst:18 -#, fuzzy msgid "" "The asynchronous execution can be performed with threads, " "using :class:`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`, or " "separate processes, using :class:`ProcessPoolExecutor`. Each implements the " "same interface, which is defined by the abstract :class:`Executor` class." msgstr "" -"非同步執行可以透過 :class:`ThreadPoolExecutor` 來使用執行緒 (thread) 執行,或" +"非同步執行可以透過 :class:`ThreadPoolExecutor` 或 :class:`InterpreterPoolExecutor` 來使用執行緒 (thread) 執行,或" "透過 :class:`ProcessPoolExecutor` 來使用單獨行程 (process) 執行。兩者都實作了" "相同的介面,該介面由抽象的 :class:`Executor` 類別定義。" @@ -134,7 +132,6 @@ msgid "" msgstr "如果 *fn* 呼叫引發例外,則當從疊代器中檢索到它的值時將引發該例外。" #: ../../library/concurrent.futures.rst:65 -#, fuzzy msgid "" "When using :class:`ProcessPoolExecutor`, this method chops *iterables* into " "a number of chunks which it submits to the pool as separate tasks. The " @@ -148,17 +145,15 @@ msgstr "" "(chunks),並將其作為獨立的任務來提交給池 (pool)。可以透過將 *chunksize* 設定" "為正整數來指定這些分塊的(約略)大小。對於非常長的可疊代物件,*chunksize* 使" "用較大的值(與預設大小 1 相比)可以顯著提高性能。對" -"於 :class:`ThreadPoolExecutor`,*chunksize* 無效。" +"於 :class:`ThreadPoolExecutor` 和 :class:`InterpreterPoolExecutor`,*chunksize* 無效。" #: ../../library/concurrent.futures.rst:74 -#, fuzzy msgid "Added the *chunksize* parameter." -msgstr "新增 *chunksize* 引數。" +msgstr "新增 *chunksize* 參數。" #: ../../library/concurrent.futures.rst:77 -#, fuzzy msgid "Added the *buffersize* parameter." -msgstr "新增 *chunksize* 引數。" +msgstr "新增 *buffersize* 參數。" #: ../../library/concurrent.futures.rst:82 msgid "" @@ -207,15 +202,13 @@ msgstr "" "future 將在此方法回傳之前完成。剩餘的 future 被取消。" #: ../../library/concurrent.futures.rst:104 -#, fuzzy msgid "" "You can avoid having to call this method explicitly if you use " "the :keyword:`with` statement, which will shutdown the :class:`Executor` " "(waiting as if :meth:`Executor.shutdown` were called with *wait* set to " "``True``)::" msgstr "" -"如果透過 :keyword:`with` 陳述式來將 executor 作為\\ :term:`情境管理器 " -"`\\ 使用,你就可以不用明確地呼叫此方法,這將會自己關" +"如果使用 :keyword:`with` 陳述式,那你就可以不用明確地呼叫此方法,這將會自己關" "閉 :class:`Executor`\\(如同呼叫 :meth:`Executor.shutdown` 時 *wait* 被設定" "為 ``True`` 般等待): ::" @@ -442,9 +435,8 @@ msgid "" msgstr "" #: ../../library/concurrent.futures.rst:240 -#, fuzzy msgid "InterpreterPoolExecutor" -msgstr "ThreadPoolExecutor" +msgstr "InterpreterPoolExecutor" #: ../../library/concurrent.futures.rst:242 msgid "" @@ -706,17 +698,12 @@ msgid "" msgstr "" #: ../../library/concurrent.futures.rst:409 -#, fuzzy msgid "" "The default process start method (see :ref:`multiprocessing-start-methods`) " "changed away from *fork*. If you require the *fork* start method " "for :class:`ProcessPoolExecutor` you must explicitly pass " "``mp_context=multiprocessing.get_context(\"fork\")``." msgstr "" -"預設的 :mod:`multiprocessing` 啟動方法(請參閱 :ref:`multiprocessing-start-" -"methods`\\ )將不再是 Python 3.14 中的 *fork*。需要 *fork* 用於" -"其 :class:`ProcessPoolExecutor` 的程式碼應透過傳遞 " -"``mp_context=multiprocessing.get_context(\"fork\")`` 參數來明確指定。" #: ../../library/concurrent.futures.rst:417 msgid "" @@ -1133,15 +1120,14 @@ msgstr "" "敗時會引發此例外類別。" #: ../../library/concurrent.futures.rst:709 -#, fuzzy msgid "" "Derived from :exc:`~concurrent.futures.thread.BrokenThreadPool`, this " "exception class is raised when one of the workers of " "a :class:`~concurrent.futures.InterpreterPoolExecutor` has failed " "initializing." msgstr "" -"衍生自 :exc:`~concurrent.futures.BrokenExecutor`," -"當 :class:`~concurrent.futures.ThreadPoolExecutor` 的其中一個 worker 初始化失" +"衍生自 :exc:`~concurrent.futures.thread.BrokenThreadPool`," +"當 :class:`~concurrent.futures.InterpreterPoolExecutor` 的其中一個 worker 初始化失" "敗時會引發此例外類別。" #: ../../library/concurrent.futures.rst:718 @@ -1163,6 +1149,3 @@ msgstr "" "為 :exc:`RuntimeError`)," "當 :class:`~concurrent.futures.ProcessPoolExecutor` 的其中一個 worker 以不乾" "淨的方式終止時將引發此例外類別(例如它是從外面被 kill 掉的)。" - -#~ msgid "the *iterables* are collected immediately rather than lazily;" -#~ msgstr "*iterables* 立即被收集而不是延遲 (lazily) 收集;" diff --git a/library/concurrent.interpreters.po b/library/concurrent.interpreters.po index 6fae74559fc..d9f5bee41ad 100644 --- a/library/concurrent.interpreters.po +++ b/library/concurrent.interpreters.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -20,11 +19,11 @@ msgstr "" #: ../../library/concurrent.interpreters.rst:2 msgid "" ":mod:`!concurrent.interpreters` --- Multiple interpreters in the same process" -msgstr "" +msgstr ":mod:`!concurrent.interpreters` --- 在同一個行程中使用多個直譯器" #: ../../library/concurrent.interpreters.rst:12 msgid "**Source code:** :source:`Lib/concurrent/interpreters`" -msgstr "" +msgstr "**原始碼:**\\ :source:`Lib/concurrent/interpreters`" #: ../../library/concurrent.interpreters.rst:16 msgid "" @@ -50,7 +49,7 @@ msgstr "" #: ../../library/concurrent.interpreters.rst:31 msgid ":class:`~concurrent.futures.InterpreterPoolExecutor`" -msgstr "" +msgstr ":class:`~concurrent.futures.InterpreterPoolExecutor`" #: ../../library/concurrent.interpreters.rst:32 msgid "combines threads with interpreters in a familiar interface." @@ -58,7 +57,7 @@ msgstr "" #: ../../library/concurrent.interpreters.rst:36 msgid ":ref:`isolating-extensions-howto`" -msgstr "" +msgstr ":ref:`isolating-extensions-howto`" #: ../../library/concurrent.interpreters.rst:37 msgid "how to update an extension module to support multiple interpreters" @@ -66,19 +65,19 @@ msgstr "" #: ../../library/concurrent.interpreters.rst:39 msgid ":pep:`554`" -msgstr "" +msgstr ":pep:`554`" #: ../../library/concurrent.interpreters.rst:41 msgid ":pep:`734`" -msgstr "" +msgstr ":pep:`734`" #: ../../library/concurrent.interpreters.rst:43 msgid ":pep:`684`" -msgstr "" +msgstr ":pep:`684`" #: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "可用性" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -241,7 +240,7 @@ msgstr "" #: ../../library/concurrent.interpreters.rst:162 msgid "Communication Between Interpreters" -msgstr "" +msgstr "直譯器之間的溝通" #: ../../library/concurrent.interpreters.rst:164 msgid "" @@ -280,27 +279,27 @@ msgstr "" #: ../../library/concurrent.interpreters.rst:189 msgid ":const:`None`" -msgstr "" +msgstr ":const:`None`" #: ../../library/concurrent.interpreters.rst:190 msgid ":class:`bool` (:const:`True` and :const:`False`)" -msgstr "" +msgstr ":class:`bool`\\ (:const:`True` 和 :const:`False`)" #: ../../library/concurrent.interpreters.rst:191 msgid ":class:`bytes`" -msgstr "" +msgstr ":class:`bytes`" #: ../../library/concurrent.interpreters.rst:192 msgid ":class:`str`" -msgstr "" +msgstr ":class:`str`" #: ../../library/concurrent.interpreters.rst:193 msgid ":class:`int`" -msgstr "" +msgstr ":class:`int`" #: ../../library/concurrent.interpreters.rst:194 msgid ":class:`float`" -msgstr "" +msgstr ":class:`float`" #: ../../library/concurrent.interpreters.rst:195 msgid ":class:`tuple` (of similarly supported objects)" @@ -314,11 +313,11 @@ msgstr "" #: ../../library/concurrent.interpreters.rst:200 msgid ":class:`memoryview`" -msgstr "" +msgstr ":class:`memoryview`" #: ../../library/concurrent.interpreters.rst:201 msgid ":class:`Queue`" -msgstr "" +msgstr ":class:`Queue`" #: ../../library/concurrent.interpreters.rst:205 msgid "Reference" @@ -423,7 +422,7 @@ msgstr "" #: ../../library/concurrent.interpreters.rst:290 msgid "Exceptions" -msgstr "" +msgstr "例外" #: ../../library/concurrent.interpreters.rst:294 msgid "" @@ -455,7 +454,7 @@ msgstr "" #: ../../library/concurrent.interpreters.rst:320 msgid "Communicating Between Interpreters" -msgstr "" +msgstr "在直譯器之間溝通" #: ../../library/concurrent.interpreters.rst:324 msgid "" @@ -482,11 +481,11 @@ msgstr "" #: ../../library/concurrent.interpreters.rst:352 msgid "Basic usage" -msgstr "" +msgstr "基本用法" #: ../../library/concurrent.interpreters.rst:354 msgid "Creating an interpreter and running code in it::" -msgstr "" +msgstr "建立一個直譯器並在其中運行程式碼: ::" #: ../../library/concurrent.interpreters.rst:356 msgid "" diff --git a/library/concurrent.po b/library/concurrent.po index 113943d2b09..109a8dc4178 100644 --- a/library/concurrent.po +++ b/library/concurrent.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" @@ -25,7 +24,7 @@ msgstr ":mod:`!concurrent` 套件" #: ../../library/concurrent.rst:4 msgid "This package contains the following modules:" -msgstr "" +msgstr "此套件包含下列模組:" #: ../../library/concurrent.rst:6 msgid ":mod:`concurrent.futures` -- Launching parallel tasks" @@ -35,6 +34,4 @@ msgstr ":mod:`concurrent.futures` -- 啟動平行任務" msgid "" ":mod:`concurrent.interpreters` -- Multiple interpreters in the same process" msgstr "" - -#~ msgid "Currently, there is only one module in this package:" -#~ msgstr "目前此套件只有一個模組:" +":mod:`concurrent.interpreters` -- 在同一行程中使用多個直譯器" diff --git a/library/configparser.po b/library/configparser.po index dd63f347beb..8bd1c846380 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" @@ -396,6 +396,9 @@ msgid "" "... fallback='No such things as monsters')\n" "'No such things as monsters'" msgstr "" +">>> config.get('forge.example', 'monster',\n" +"... fallback='No such things as monsters')\n" +"'No such things as monsters'" #: ../../library/configparser.rst:252 msgid "" @@ -424,7 +427,7 @@ msgstr "" #: ../../library/configparser.rst:268 msgid "Supported INI File Structure" -msgstr "" +msgstr "支援的 INI 檔案結構" #: ../../library/configparser.rst:270 msgid "" @@ -719,19 +722,19 @@ msgstr "" #: ../../library/configparser.rst:482 msgid "``DEFAULTSECT`` cannot be removed from the parser:" -msgstr "" +msgstr "``DEFAULTSECT`` 不能從剖析器中移除:" #: ../../library/configparser.rst:484 msgid "trying to delete it raises :exc:`ValueError`," -msgstr "" +msgstr "嘗試刪除它會引發 :exc:`ValueError`," #: ../../library/configparser.rst:486 msgid "``parser.clear()`` leaves it intact," -msgstr "" +msgstr "``parser.clear()`` 會保持它不變," #: ../../library/configparser.rst:488 msgid "``parser.popitem()`` never returns it." -msgstr "" +msgstr "``parser.popitem()`` 永遠不會回傳它。" #: ../../library/configparser.rst:490 msgid "" @@ -1030,6 +1033,11 @@ msgid "" "\n" " this = is still a part of the multiline value of 'key'" msgstr "" +"[Section]\n" +"key = multiline\n" +" value with a gotcha\n" +"\n" +" this = is still a part of the multiline value of 'key'" #: ../../library/configparser.rst:695 msgid "" @@ -1460,7 +1468,7 @@ msgstr "" #: ../../library/configparser.rst:1028 msgid "The default *dict_type* is :class:`collections.OrderedDict`." -msgstr "" +msgstr "預設的 *dict_type* 是 :class:`collections.OrderedDict`。" #: ../../library/configparser.rst:1031 ../../library/configparser.rst:1324 msgid "" @@ -1831,7 +1839,7 @@ msgstr "" #: ../../library/configparser.rst:1357 msgid "Added support for :const:`UNNAMED_SECTION`." -msgstr "" +msgstr "新增對 :const:`UNNAMED_SECTION` 的支援。" #: ../../library/configparser.rst:1363 msgid "" diff --git a/library/constants.po b/library/constants.po index b468b41e6e0..a22d36e5099 100644 --- a/library/constants.po +++ b/library/constants.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2021-11-19 23:36+0800\n" @@ -111,15 +110,13 @@ msgid "Evaluating :data:`!NotImplemented` in a boolean context was deprecated." msgstr "" #: ../../library/constants.rst:59 -#, fuzzy msgid "" "Evaluating :data:`!NotImplemented` in a boolean context now raises " "a :exc:`TypeError`. It previously evaluated to :const:`True` and emitted " "a :exc:`DeprecationWarning` since Python 3.9." msgstr "" -"在 boolean(布林)上下文中解讀 :data:`!NotImplemented` 已經被棄用。雖然目前會" -"被解讀成 true,但會發出一個 :exc:`DeprecationWarning`。在未來版本的 Python 將" -"會拋出 :exc:`TypeError`。" +"在 boolean(布林)上下文中解讀 :data:`!NotImplemented` 現在會引發 :exc:`TypeError`。" +"過去自 Python 3.9 以來,這會被解讀成 :const:`True`,並發出 :exc:`DeprecationWarning`" #: ../../library/constants.rst:68 msgid "" diff --git a/library/contextlib.po b/library/contextlib.po index a7be4735e6c..3f6522fa014 100644 --- a/library/contextlib.po +++ b/library/contextlib.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-04-11 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" diff --git a/library/contextvars.po b/library/contextvars.po index a610416d741..99e9c78a456 100644 --- a/library/contextvars.po +++ b/library/contextvars.po @@ -1,8 +1,8 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-07-30 22:06+0800\n" @@ -186,10 +186,16 @@ msgid "" "\n" "assert var.get() == 'default value'" msgstr "" +"var = ContextVar('var', default='default value')\n" +"\n" +"with var.set('new value'):\n" +" assert var.get() == 'new value'\n" +"\n" +"assert var.get() == 'default value'" #: ../../library/contextvars.rst:117 msgid "Added support for usage as a context manager." -msgstr "" +msgstr "新增對用作情境管理器的支援。" #: ../../library/contextvars.rst:121 msgid "" diff --git a/library/copy.po b/library/copy.po index d3d49fd63fa..0d7aa89b793 100644 --- a/library/copy.po +++ b/library/copy.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2022-01-20 18:49+0800\n" diff --git a/library/copyreg.po b/library/copyreg.po index d0f8976f36a..eb99e7b7fc0 100644 --- a/library/copyreg.po +++ b/library/copyreg.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2023-12-29 00:29+0000\n" diff --git a/library/crypt.po b/library/crypt.po index c8e1251bc01..b8cf2e9438a 100644 --- a/library/crypt.po +++ b/library/crypt.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/crypto.po b/library/crypto.po index acdd2c02bfe..86e4a6c1df1 100644 --- a/library/crypto.po +++ b/library/crypto.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-02-15 18:06+0800\n" diff --git a/library/csv.po b/library/csv.po index 14bd975c650..f4fc801561a 100644 --- a/library/csv.po +++ b/library/csv.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-11-08 15:06+0800\n" diff --git a/library/ctypes.po b/library/ctypes.po index 07aaffbca6b..e930f5d30e1 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" @@ -687,14 +687,12 @@ msgid "" msgstr "" #: ../../library/ctypes.rst:291 -#, fuzzy msgid ":class:`c_float_complex`" -msgstr ":class:`c_float`" +msgstr ":class:`c_float_complex`" #: ../../library/ctypes.rst:291 -#, fuzzy msgid ":c:expr:`float complex`" -msgstr ":c:expr:`float`" +msgstr ":c:expr:`float complex`" #: ../../library/ctypes.rst:291 ../../library/ctypes.rst:293 #: ../../library/ctypes.rst:295 @@ -702,24 +700,20 @@ msgid "complex" msgstr "" #: ../../library/ctypes.rst:293 -#, fuzzy msgid ":class:`c_double_complex`" -msgstr ":class:`c_double`" +msgstr ":class:`c_double_complex`" #: ../../library/ctypes.rst:293 -#, fuzzy msgid ":c:expr:`double complex`" -msgstr ":c:expr:`double`" +msgstr ":c:expr:`double complex`" #: ../../library/ctypes.rst:295 -#, fuzzy msgid ":class:`c_longdouble_complex`" -msgstr ":class:`c_longdouble`" +msgstr ":class:`c_longdouble_complex`" #: ../../library/ctypes.rst:295 -#, fuzzy msgid ":c:expr:`long double complex`" -msgstr ":c:expr:`long double`" +msgstr ":c:expr:`long double complex`" #: ../../library/ctypes.rst:299 msgid "" @@ -1403,7 +1397,6 @@ msgid "" msgstr "" #: ../../library/ctypes.rst:679 -#, fuzzy msgid "" ">>> POINT.x\n" "\n" @@ -1411,10 +1404,10 @@ msgid "" "\n" ">>>" msgstr "" -">>> print(POINT.x)\n" -"\n" -">>> print(POINT.y)\n" -"\n" +">>> POINT.x\n" +"\n" +">>> POINT.y\n" +"\n" ">>>" #: ../../library/ctypes.rst:690 @@ -1473,7 +1466,6 @@ msgid "" msgstr "" #: ../../library/ctypes.rst:728 -#, fuzzy msgid "" ">>> class Int(Structure):\n" "... _fields_ = [(\"first_16\", c_int, 16),\n" @@ -1489,10 +1481,9 @@ msgstr "" "... (\"second_16\", c_int, 16)]\n" "...\n" ">>> print(Int.first_16)\n" -"\n" +"\n" ">>> print(Int.second_16)\n" -"\n" -">>>" +"" #: ../../library/ctypes.rst:737 msgid "" @@ -3939,13 +3930,12 @@ msgid "" msgstr "" #: ../../library/ctypes.rst:2324 -#, fuzzy msgid "" "Raises an :ref:`auditing event ` ``ctypes.memoryview_at`` with " "arguments ``address``, ``size``, ``readonly``." msgstr "" -"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` " -"``ctypes.string_at``。" +"引發一個附帶引數 ``address``、``size`` 與 ``readonly`` 的\\ :ref:`稽核事件 ` " +"``ctypes.memoryview_at``。" #: ../../library/ctypes.rst:2332 msgid "Data types" diff --git a/library/curses.ascii.po b/library/curses.ascii.po index 9c57ae467b0..bc02ebebee2 100644 --- a/library/curses.ascii.po +++ b/library/curses.ascii.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" diff --git a/library/curses.panel.po b/library/curses.panel.po index 4419591d4dc..6be0d1be8a8 100644 --- a/library/curses.panel.po +++ b/library/curses.panel.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" diff --git a/library/curses.po b/library/curses.po index 1f8c07299e4..10b29c30bb4 100644 --- a/library/curses.po +++ b/library/curses.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" diff --git a/library/custominterp.po b/library/custominterp.po index ddfef2e2750..1f661fe658f 100644 --- a/library/custominterp.po +++ b/library/custominterp.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-07-06 00:17+0000\n" "PO-Revision-Date: 2025-06-28 10:57+0800\n" diff --git a/library/dataclasses.po b/library/dataclasses.po index 6bb6afd865f..9eeb64a3812 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\n" "PO-Revision-Date: 2023-02-11 15:02+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -72,6 +72,11 @@ msgid "" " self.unit_price = unit_price\n" " self.quantity_on_hand = quantity_on_hand" msgstr "" +"def __init__(self, name: str, unit_price: float, quantity_on_hand: int = " +"0):\n" +" self.name = name\n" +" self.unit_price = unit_price\n" +" self.quantity_on_hand = quantity_on_hand" #: ../../library/dataclasses.rst:41 #, fuzzy @@ -172,17 +177,15 @@ msgid "The parameters to ``@dataclass`` are:" msgstr "``@dataclass`` 的參數是:" #: ../../library/dataclasses.rst:89 -#, fuzzy msgid "" "*init*: If true (the default), a :meth:`~object.__init__` method will be " "generated." msgstr "*init*:如果為真(預設值),將生成一個 :meth:`~object.__init__` 方法。" #: ../../library/dataclasses.rst:92 -#, fuzzy msgid "" "If the class already defines :meth:`!__init__`, this parameter is ignored." -msgstr "如果該類別已經定義了 :meth:`!__init__`,則忽略此參數。" +msgstr "如果該類別已經定義了 :meth:`!__init__`,則此參數會被忽略。" #: ../../library/dataclasses.rst:95 #, fuzzy @@ -783,7 +786,7 @@ msgstr "要建立淺複製,可以使用以下解決方法:" #: ../../library/dataclasses.rst:395 msgid "{field.name: getattr(obj, field.name) for field in fields(obj)}" -msgstr "" +msgstr "{field.name: getattr(obj, field.name) for field in fields(obj)}" #: ../../library/dataclasses.rst:397 #, fuzzy @@ -865,11 +868,11 @@ msgstr "" #, fuzzy msgid "" "This function is not strictly required, because any Python mechanism for " -"creating a new class with :attr:`!__annotations__` can then apply " +"creating a new class with :attr:`~object.__annotations__` can then apply " "the :func:`@dataclass ` function to convert that class to a " "dataclass. This function is provided as a convenience. For example::" msgstr "" -"這個函式不是嚴格要求的,因為任何使用 ``__annotations__`` 建立新類別的 Python " +"這個函式不是嚴格要求的,因為任何使用 :attr:`~object.__annotations__` 建立新類別的 Python " "機制都可以應用 :func:`dataclass` 函式將該類別轉換為資料類別。提供此功能是為了" "方便。例如: ::" @@ -1718,14 +1721,3 @@ msgid "" msgstr "" "請注意,如果一個欄位用描述器型別註釋,但未分配描述器對像作為其預設值,則該欄" "位將像普通欄位一樣工作。" - -#, fuzzy -#~ msgid "" -#~ "Calling no-arg :func:`super` in dataclasses using ``slots=True`` will " -#~ "result in the following exception being raised: ``TypeError: super(type, " -#~ "obj): obj must be an instance or subtype of type``. The two-" -#~ "arg :func:`super` is a valid workaround. See :gh:`90562` for full details." -#~ msgstr "" -#~ "``slots``:如果為 true(預設為 ``False``),將生" -#~ "成 :attr:`~object.__slots__` 屬性並回傳新類別而不是原始類別。如果 :attr:`!" -#~ "__slots__` 已經在類別中定義,則 :exc:`TypeError` 被引發。" diff --git a/library/datatypes.po b/library/datatypes.po index 82edc28c58a..c6980edfad2 100644 --- a/library/datatypes.po +++ b/library/datatypes.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-20 18:08+0800\n" "PO-Revision-Date: 2022-02-11 12:12+0800\n" diff --git a/library/datetime.po b/library/datetime.po index bfaefd335b2..1185a7c7125 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" @@ -965,9 +965,8 @@ msgid "" msgstr "" #: ../../library/datetime.rst:586 -#, fuzzy msgid "date(*(time.strptime(date_string, format)[0:3]))" -msgstr "datetime(*(time.strptime(date_string, format)[0:6]))" +msgstr "date(*(time.strptime(date_string, format)[0:3]))" #: ../../library/datetime.rst:588 msgid "" @@ -2669,9 +2668,8 @@ msgid "" msgstr "" #: ../../library/datetime.rst:1897 -#, fuzzy msgid "Other constructors:" -msgstr "建構函式:" +msgstr "其他建構函式:" #: ../../library/datetime.rst:1901 msgid "" @@ -2754,9 +2752,8 @@ msgid "" msgstr "" #: ../../library/datetime.rst:1946 -#, fuzzy msgid "time(*(time.strptime(date_string, format)[3:6]))" -msgstr "datetime(*(time.strptime(date_string, format)[0:6]))" +msgstr "time(*(time.strptime(date_string, format)[3:6]))" #: ../../library/datetime.rst:1948 msgid "" diff --git a/library/dbm.po b/library/dbm.po index d3ec55e4406..7dfd3dbb89d 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # jerrychen , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" @@ -428,9 +428,8 @@ msgid "Close the GDBM database." msgstr "關閉 GDBM 資料庫。" #: ../../library/dbm.rst:298 -#, fuzzy msgid "Remove all items from the GDBM database." -msgstr "關閉 GDBM 資料庫。" +msgstr "移除 GDBM 資料庫的所有項目。" #: ../../library/dbm.rst:304 msgid ":mod:`dbm.ndbm` --- New Database Manager" @@ -492,9 +491,8 @@ msgid "Close the NDBM database." msgstr "關閉 NDBM 資料庫。" #: ../../library/dbm.rst:375 -#, fuzzy msgid "Remove all items from the NDBM database." -msgstr "關閉 NDBM 資料庫。" +msgstr "移除 NDBM 資料庫的所有項目。" #: ../../library/dbm.rst:381 msgid ":mod:`dbm.dumb` --- Portable DBM implementation" diff --git a/library/debug.po b/library/debug.po index e6d1cd53393..17ff8f43eda 100644 --- a/library/debug.po +++ b/library/debug.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-20 18:08+0800\n" "PO-Revision-Date: 2021-12-08 00:47+0800\n" diff --git a/library/decimal.po b/library/decimal.po index ae074242e04..83b16cccf96 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" @@ -861,7 +860,6 @@ msgid "" msgstr "" #: ../../library/decimal.rst:609 -#, fuzzy msgid "" ">>> Decimal.from_number(314)\n" "Decimal('314')\n" @@ -870,14 +868,12 @@ msgid "" ">>> Decimal.from_number(Decimal('3.14'))\n" "Decimal('3.14')" msgstr "" -">>> Decimal.from_float(0.1)\n" +">>> Decimal.from_number(314)\n" +"Decimal('314')\n" +">>> Decimal.from_number(0.1)\n" "Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" -">>> Decimal.from_float(float('nan'))\n" -"Decimal('NaN')\n" -">>> Decimal.from_float(float('inf'))\n" -"Decimal('Infinity')\n" -">>> Decimal.from_float(float('-inf'))\n" -"Decimal('-Infinity')" +">>> Decimal.from_number(Decimal('3.14'))\n" +"Decimal('3.14')" #: ../../library/decimal.rst:622 msgid "" diff --git a/library/development.po b/library/development.po index 0272023235a..9e47eced753 100644 --- a/library/development.po +++ b/library/development.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/library/devmode.po b/library/devmode.po index d624765024b..59d251bae13 100644 --- a/library/devmode.po +++ b/library/devmode.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2024-05-03 02:14+0800\n" diff --git a/library/dialog.po b/library/dialog.po index 34608654673..9e4abefdb9b 100644 --- a/library/dialog.po +++ b/library/dialog.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/difflib.po b/library/difflib.po index f47345cb456..3296ad6fc80 100644 --- a/library/difflib.po +++ b/library/difflib.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-08 00:17+0000\n" "PO-Revision-Date: 2016-11-19 00:29+0000\n" diff --git a/library/dis.po b/library/dis.po index 90d5e49e350..a786deae559 100644 --- a/library/dis.po +++ b/library/dis.po @@ -1,13 +1,13 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # splasky Chang , 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\n" "PO-Revision-Date: 2018-07-27 16:55+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -117,7 +117,6 @@ msgid "" msgstr "" #: ../../library/dis.rst:73 -#, fuzzy msgid "" ">>> dis.dis(myfunc)\n" " 2 RESUME 0\n" @@ -131,7 +130,7 @@ msgstr "" " 2 RESUME 0\n" "\n" " 3 LOAD_GLOBAL 1 (len + NULL)\n" -" LOAD_FAST 0 (alist)\n" +" LOAD_FAST_BORROW 0 (alist)\n" " CALL 1\n" " RETURN_VALUE" @@ -148,9 +147,8 @@ msgid "The :mod:`dis` module can be invoked as a script from the command line:" msgstr "" #: ../../library/dis.rst:92 -#, fuzzy msgid "python -m dis [-h] [-C] [-O] [-P] [-S] [infile]" -msgstr "python -m dis [-h] [-C] [-O] [infile]" +msgstr "python -m dis [-h] [-C] [-O] [-P] [-S] [infile]" #: ../../library/dis.rst:96 msgid "The following options are accepted:" @@ -285,22 +283,19 @@ msgid "Added the *show_caches* and *adaptive* parameters." msgstr "新增 *show_caches* 與 *adaptive* 參數。" #: ../../library/dis.rst:202 -#, fuzzy msgid "Added the *show_offsets* parameter" msgstr "新增 *show_offsets* 參數。" #: ../../library/dis.rst:205 ../../library/dis.rst:304 #: ../../library/dis.rst:326 ../../library/dis.rst:362 -#, fuzzy msgid "Added the *show_positions* parameter." -msgstr "新增 *show_offsets* 參數。" +msgstr "新增 *show_positions* 參數。" #: ../../library/dis.rst:208 msgid "Example:" msgstr "範例:" #: ../../library/dis.rst:210 -#, fuzzy msgid "" ">>> bytecode = dis.Bytecode(myfunc)\n" ">>> for instr in bytecode:\n" @@ -318,7 +313,7 @@ msgstr "" "...\n" "RESUME\n" "LOAD_GLOBAL\n" -"LOAD_FAST\n" +"LOAD_FAST_BORROW\n" "CALL\n" "RETURN_VALUE" @@ -771,8 +766,8 @@ msgstr "實作 ``STACK[-1] = -STACK[-1]``。" msgid "Implements ``STACK[-1] = not STACK[-1]``." msgstr "實作 ``STACK[-1] = not STACK[-1]``。" -#: ../../library/dis.rst:665 ../../library/dis.rst:1367 -#: ../../library/dis.rst:1383 +#: ../../library/dis.rst:665 ../../library/dis.rst:1372 +#: ../../library/dis.rst:1388 msgid "This instruction now requires an exact :class:`bool` operand." msgstr "" @@ -838,10 +833,10 @@ msgstr "" #: ../../library/dis.rst:738 ../../library/dis.rst:750 #: ../../library/dis.rst:828 ../../library/dis.rst:838 #: ../../library/dis.rst:848 ../../library/dis.rst:1054 -#: ../../library/dis.rst:1065 ../../library/dis.rst:1210 -#: ../../library/dis.rst:1222 ../../library/dis.rst:1234 +#: ../../library/dis.rst:1065 ../../library/dis.rst:1215 +#: ../../library/dis.rst:1227 ../../library/dis.rst:1239 msgid "Implements::" -msgstr "" +msgstr "實作了: ::" #: ../../library/dis.rst:722 msgid "" @@ -1143,7 +1138,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/dis.rst:1006 ../../library/dis.rst:1748 +#: ../../library/dis.rst:1006 ../../library/dis.rst:1753 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." @@ -1249,23 +1244,28 @@ msgstr "" #: ../../library/dis.rst:1091 msgid "" +"Works as :opcode:`LOAD_CONST`, but is more efficient for immortal objects." +msgstr "" + +#: ../../library/dis.rst:1096 +msgid "" "Pushes the integer ``i`` onto the stack. ``i`` must be in ``range(256)``" msgstr "" -#: ../../library/dis.rst:1099 +#: ../../library/dis.rst:1104 msgid "" "Pushes the value associated with ``co_names[namei]`` onto the stack. The " "name is looked up within the locals, then the globals, then the builtins." msgstr "" -#: ../../library/dis.rst:1105 +#: ../../library/dis.rst:1110 msgid "" "Pushes a reference to the locals dictionary onto the stack. This is used to " "prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` " "and :opcode:`LOAD_FROM_DICT_OR_GLOBALS`." msgstr "" -#: ../../library/dis.rst:1114 +#: ../../library/dis.rst:1119 msgid "" "Pops a mapping off the stack and looks up the value for ``co_names[namei]``. " "If the name is not found there, looks it up in the globals and then the " @@ -1274,52 +1274,50 @@ msgid "" "bodies." msgstr "" -#: ../../library/dis.rst:1125 +#: ../../library/dis.rst:1130 msgid "" "Constructs a new :class:`~string.templatelib.Template` instance from a tuple " "of strings and a tuple of interpolations and pushes the resulting object " "onto the stack::" msgstr "" -#: ../../library/dis.rst:1129 -#, fuzzy +#: ../../library/dis.rst:1134 msgid "" "interpolations = STACK.pop()\n" "strings = STACK.pop()\n" "STACK.append(_build_template(strings, interpolations))" msgstr "" -"step = STACK.pop()\n" -"end = STACK.pop()\n" -"start = STACK.pop()\n" -"STACK.append(slice(start, end, step))" +"interpolations = STACK.pop()\n" +"strings = STACK.pop()\n" +"STACK.append(_build_template(strings, interpolations))" -#: ../../library/dis.rst:1138 +#: ../../library/dis.rst:1143 msgid "" "Constructs a new :class:`~string.templatelib.Interpolation` instance from a " "value and its source expression and pushes the resulting object onto the " "stack." msgstr "" -#: ../../library/dis.rst:1142 +#: ../../library/dis.rst:1147 msgid "" "If no conversion or format specification is present, ``format`` is set to " "``2``." msgstr "" -#: ../../library/dis.rst:1145 +#: ../../library/dis.rst:1150 msgid "" "If the low bit of ``format`` is set, it indicates that the interpolation " "contains a format specification." msgstr "" -#: ../../library/dis.rst:1148 +#: ../../library/dis.rst:1153 msgid "" "If ``format >> 2`` is non-zero, it indicates that the interpolation contains " "a conversion. The value of ``format >> 2`` is the conversion type (``0`` for " "no conversion, ``1`` for ``!s``, ``2`` for ``!r``, and ``3`` for ``!a``)::" msgstr "" -#: ../../library/dis.rst:1153 +#: ../../library/dis.rst:1158 msgid "" "conversion = format >> 2\n" "if format & 1:\n" @@ -1331,14 +1329,23 @@ msgid "" "STACK.append(_build_interpolation(value, expression, conversion, " "format_spec))" msgstr "" +"conversion = format >> 2\n" +"if format & 1:\n" +" format_spec = STACK.pop()\n" +"else:\n" +" format_spec = None\n" +"expression = STACK.pop()\n" +"value = STACK.pop()\n" +"STACK.append(_build_interpolation(value, expression, conversion, " +"format_spec))" -#: ../../library/dis.rst:1167 +#: ../../library/dis.rst:1172 msgid "" "Creates a tuple consuming *count* items from the stack, and pushes the " "resulting tuple onto the stack::" msgstr "" -#: ../../library/dis.rst:1170 +#: ../../library/dis.rst:1175 msgid "" "if count == 0:\n" " value = ()\n" @@ -1356,34 +1363,34 @@ msgstr "" "\n" "STACK.append(value)" -#: ../../library/dis.rst:1181 +#: ../../library/dis.rst:1186 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." msgstr "" -#: ../../library/dis.rst:1186 +#: ../../library/dis.rst:1191 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a set." msgstr "" -#: ../../library/dis.rst:1191 +#: ../../library/dis.rst:1196 msgid "" "Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so " "that the dictionary holds *count* entries: ``{..., STACK[-4]: STACK[-3], " "STACK[-2]: STACK[-1]}``." msgstr "" -#: ../../library/dis.rst:1195 +#: ../../library/dis.rst:1200 msgid "" "The dictionary is created from stack items instead of creating an empty " "dictionary pre-sized to hold *count* items." msgstr "" -#: ../../library/dis.rst:1202 +#: ../../library/dis.rst:1207 msgid "" "Concatenates *count* strings from the stack and pushes the resulting string " "onto the stack." msgstr "" -#: ../../library/dis.rst:1212 +#: ../../library/dis.rst:1217 msgid "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" @@ -1391,11 +1398,11 @@ msgstr "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" -#: ../../library/dis.rst:1215 +#: ../../library/dis.rst:1220 msgid "Used to build lists." msgstr "" -#: ../../library/dis.rst:1224 +#: ../../library/dis.rst:1229 msgid "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" @@ -1403,11 +1410,11 @@ msgstr "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" -#: ../../library/dis.rst:1227 +#: ../../library/dis.rst:1232 msgid "Used to build sets." msgstr "" -#: ../../library/dis.rst:1236 +#: ../../library/dis.rst:1241 msgid "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" @@ -1415,21 +1422,21 @@ msgstr "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" -#: ../../library/dis.rst:1239 +#: ../../library/dis.rst:1244 msgid "Used to build dicts." msgstr "" -#: ../../library/dis.rst:1246 +#: ../../library/dis.rst:1251 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." msgstr "" -#: ../../library/dis.rst:1253 +#: ../../library/dis.rst:1258 msgid "" "If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with " "``getattr(STACK[-1], co_names[namei>>1])``." msgstr "" -#: ../../library/dis.rst:1256 +#: ../../library/dis.rst:1261 msgid "" "If the low bit of ``namei`` is set, this will attempt to load a method named " "``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is " @@ -1441,76 +1448,76 @@ msgid "" "pushed." msgstr "" -#: ../../library/dis.rst:1265 +#: ../../library/dis.rst:1270 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is pushed to " "the stack before the attribute or unbound method respectively." msgstr "" -#: ../../library/dis.rst:1272 +#: ../../library/dis.rst:1277 msgid "" "This opcode implements :func:`super`, both in its zero-argument and two-" "argument forms (e.g. ``super().method()``, ``super().attr`` and ``super(cls, " "self).method()``, ``super(cls, self).attr``)." msgstr "" -#: ../../library/dis.rst:1276 +#: ../../library/dis.rst:1281 msgid "It pops three values from the stack (from top of stack down):" msgstr "" -#: ../../library/dis.rst:1278 +#: ../../library/dis.rst:1283 msgid "``self``: the first argument to the current method" msgstr "" -#: ../../library/dis.rst:1279 +#: ../../library/dis.rst:1284 msgid "``cls``: the class within which the current method was defined" msgstr "" -#: ../../library/dis.rst:1280 +#: ../../library/dis.rst:1285 msgid "the global ``super``" msgstr "" -#: ../../library/dis.rst:1282 +#: ../../library/dis.rst:1287 msgid "" "With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`, " "except that ``namei`` is shifted left by 2 bits instead of 1." msgstr "" -#: ../../library/dis.rst:1285 +#: ../../library/dis.rst:1290 msgid "" "The low bit of ``namei`` signals to attempt a method load, as " "with :opcode:`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded " "method. When it is unset a single value is pushed to the stack." msgstr "" -#: ../../library/dis.rst:1289 +#: ../../library/dis.rst:1294 msgid "" "The second-low bit of ``namei``, if set, means that this was a two-argument " "call to :func:`super` (unset means zero-argument)." msgstr "" -#: ../../library/dis.rst:1297 +#: ../../library/dis.rst:1302 msgid "" "Performs a Boolean operation. The operation name can be found in " "``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set " "(``opname & 16``), the result should be coerced to ``bool``." msgstr "" -#: ../../library/dis.rst:1301 +#: ../../library/dis.rst:1306 msgid "" "The fifth-lowest bit of the oparg now indicates a forced conversion " "to :class:`bool`." msgstr "" -#: ../../library/dis.rst:1308 +#: ../../library/dis.rst:1313 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1315 +#: ../../library/dis.rst:1320 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1322 +#: ../../library/dis.rst:1327 msgid "" "Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are " "popped and provide the *fromlist* and *level* arguments " @@ -1519,62 +1526,62 @@ msgid "" "subsequent :opcode:`STORE_FAST` instruction modifies the namespace." msgstr "" -#: ../../library/dis.rst:1330 +#: ../../library/dis.rst:1335 msgid "" "Loads the attribute ``co_names[namei]`` from the module found in " "``STACK[-1]``. The resulting object is pushed onto the stack, to be " "subsequently stored by a :opcode:`STORE_FAST` instruction." msgstr "" -#: ../../library/dis.rst:1337 +#: ../../library/dis.rst:1342 msgid "Increments bytecode counter by *delta*." msgstr "" -#: ../../library/dis.rst:1342 +#: ../../library/dis.rst:1347 msgid "Decrements bytecode counter by *delta*. Checks for interrupts." msgstr "" -#: ../../library/dis.rst:1349 +#: ../../library/dis.rst:1354 msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" -#: ../../library/dis.rst:1356 +#: ../../library/dis.rst:1361 msgid "" "If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1359 ../../library/dis.rst:1375 +#: ../../library/dis.rst:1364 ../../library/dis.rst:1380 msgid "" "The oparg is now a relative delta rather than an absolute target. This " "opcode is a pseudo-instruction, replaced in final bytecode by the directed " "versions (forward/backward)." msgstr "" -#: ../../library/dis.rst:1364 ../../library/dis.rst:1380 -#: ../../library/dis.rst:1393 ../../library/dis.rst:1404 +#: ../../library/dis.rst:1369 ../../library/dis.rst:1385 +#: ../../library/dis.rst:1398 ../../library/dis.rst:1409 msgid "This is no longer a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1372 +#: ../../library/dis.rst:1377 msgid "" "If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1388 +#: ../../library/dis.rst:1393 msgid "" "If ``STACK[-1]`` is not ``None``, increments the bytecode counter by " "*delta*. ``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1399 +#: ../../library/dis.rst:1404 msgid "" "If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1409 +#: ../../library/dis.rst:1414 msgid "" "``STACK[-1]`` is an :term:`iterator`. Call its :meth:`~iterator.__next__` " "method. If this yields a new value, push it on the stack (leaving the " @@ -1582,103 +1589,103 @@ msgid "" "code counter is incremented by *delta*." msgstr "" -#: ../../library/dis.rst:1414 +#: ../../library/dis.rst:1419 msgid "Up until 3.11 the iterator was popped when it was exhausted." msgstr "" -#: ../../library/dis.rst:1419 +#: ../../library/dis.rst:1424 msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1421 +#: ../../library/dis.rst:1426 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` is pushed to the stack " "before the global variable." msgstr "" -#: ../../library/dis.rst:1427 +#: ../../library/dis.rst:1432 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1429 +#: ../../library/dis.rst:1434 msgid "" "This opcode is now only used in situations where the local variable is " "guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`." msgstr "" -#: ../../library/dis.rst:1435 +#: ../../library/dis.rst:1440 msgid "" "Pushes a borrowed reference to the local ``co_varnames[var_num]`` onto the " "stack." msgstr "" -#: ../../library/dis.rst:1442 +#: ../../library/dis.rst:1447 msgid "" "Pushes references to ``co_varnames[var_nums >> 4]`` and " "``co_varnames[var_nums & 15]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1450 +#: ../../library/dis.rst:1455 msgid "" "Pushes borrowed references to ``co_varnames[var_nums >> 4]`` and " "``co_varnames[var_nums & 15]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1457 +#: ../../library/dis.rst:1462 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " "raising an :exc:`UnboundLocalError` if the local variable has not been " "initialized." msgstr "" -#: ../../library/dis.rst:1465 +#: ../../library/dis.rst:1470 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " "pushes ``NULL`` onto the stack if the local variable has not been " "initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" -#: ../../library/dis.rst:1473 +#: ../../library/dis.rst:1478 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1477 +#: ../../library/dis.rst:1482 msgid "" "Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]`` and ``STACK[-2]`` " "into ``co_varnames[var_nums & 15]``." msgstr "" -#: ../../library/dis.rst:1484 +#: ../../library/dis.rst:1489 msgid "" "Stores ``STACK.pop()`` into the local ``co_varnames[var_nums >> 4]`` and " "pushes a reference to the local ``co_varnames[var_nums & 15]`` onto the " "stack." msgstr "" -#: ../../library/dis.rst:1492 +#: ../../library/dis.rst:1497 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1497 +#: ../../library/dis.rst:1502 msgid "" "Creates a new cell in slot ``i``. If that slot is nonempty then that value " "is stored into the new cell." msgstr "" -#: ../../library/dis.rst:1505 +#: ../../library/dis.rst:1510 msgid "" "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" -#: ../../library/dis.rst:1508 ../../library/dis.rst:1530 -#: ../../library/dis.rst:1541 +#: ../../library/dis.rst:1513 ../../library/dis.rst:1535 +#: ../../library/dis.rst:1546 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -#: ../../library/dis.rst:1514 +#: ../../library/dis.rst:1519 msgid "" "Pops a mapping off the stack and looks up the name associated with slot " "``i`` of the \"fast locals\" storage in this mapping. If the name is not " @@ -1689,112 +1696,112 @@ msgid "" "class bodies." msgstr "" -#: ../../library/dis.rst:1527 +#: ../../library/dis.rst:1532 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1536 +#: ../../library/dis.rst:1541 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" -#: ../../library/dis.rst:1547 +#: ../../library/dis.rst:1552 msgid "" "Copies the ``n`` :term:`free (closure) variables ` from " "the closure into the frame. Removes the need for special code on the " "caller's side when calling closures." msgstr "" -#: ../../library/dis.rst:1556 +#: ../../library/dis.rst:1561 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: ../../library/dis.rst:1559 +#: ../../library/dis.rst:1564 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: ../../library/dis.rst:1560 +#: ../../library/dis.rst:1565 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1561 +#: ../../library/dis.rst:1566 msgid "" "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " "``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1567 +#: ../../library/dis.rst:1572 msgid "" "Calls a callable object with the number of arguments specified by ``argc``. " "On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1570 ../../library/dis.rst:1594 +#: ../../library/dis.rst:1575 ../../library/dis.rst:1599 msgid "The callable" msgstr "" -#: ../../library/dis.rst:1571 ../../library/dis.rst:1595 +#: ../../library/dis.rst:1576 ../../library/dis.rst:1600 msgid "``self`` or ``NULL``" msgstr "``self`` 或 ``NULL``" -#: ../../library/dis.rst:1572 ../../library/dis.rst:1596 +#: ../../library/dis.rst:1577 ../../library/dis.rst:1601 msgid "The remaining positional arguments" msgstr "剩餘的位置引數" -#: ../../library/dis.rst:1574 +#: ../../library/dis.rst:1579 msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -#: ../../library/dis.rst:1576 +#: ../../library/dis.rst:1581 msgid "" "``CALL`` pops all arguments and the callable object off the stack, calls the " "callable object with those arguments, and pushes the return value returned " "by the callable object." msgstr "" -#: ../../library/dis.rst:1582 +#: ../../library/dis.rst:1587 msgid "The callable now always appears at the same position on the stack." msgstr "" -#: ../../library/dis.rst:1585 +#: ../../library/dis.rst:1590 msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -#: ../../library/dis.rst:1591 +#: ../../library/dis.rst:1596 msgid "" "Calls a callable object with the number of arguments specified by ``argc``, " "including one or more named arguments. On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1597 +#: ../../library/dis.rst:1602 msgid "The named arguments" msgstr "" -#: ../../library/dis.rst:1598 +#: ../../library/dis.rst:1603 msgid "A :class:`tuple` of keyword argument names" msgstr "" -#: ../../library/dis.rst:1600 +#: ../../library/dis.rst:1605 msgid "" "``argc`` is the total of the positional and named arguments, excluding " "``self``. The length of the tuple of keyword argument names is the number of " "named arguments." msgstr "" -#: ../../library/dis.rst:1603 +#: ../../library/dis.rst:1608 msgid "" "``CALL_KW`` pops all arguments, the keyword names, and the callable object " "off the stack, calls the callable object with those arguments, and pushes " "the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1612 +#: ../../library/dis.rst:1617 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1806,33 +1813,33 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1627 +#: ../../library/dis.rst:1632 msgid "" "Pushes a ``NULL`` to the stack. Used in the call sequence to match the " "``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1636 +#: ../../library/dis.rst:1641 msgid "" "Pushes a new function object on the stack built from the code object at " "``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:1638 +#: ../../library/dis.rst:1643 msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: ../../library/dis.rst:1641 +#: ../../library/dis.rst:1646 msgid "Qualified name at ``STACK[-1]`` was removed." msgstr "" -#: ../../library/dis.rst:1644 +#: ../../library/dis.rst:1649 msgid "" "Extra function attributes on the stack, signaled by oparg flags, were " "removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" -#: ../../library/dis.rst:1651 +#: ../../library/dis.rst:1656 msgid "" "Sets an attribute on a function object. Expects the function at " "``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " @@ -1840,42 +1847,42 @@ msgid "" "attribute to set:" msgstr "" -#: ../../library/dis.rst:1655 +#: ../../library/dis.rst:1660 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: ../../library/dis.rst:1657 +#: ../../library/dis.rst:1662 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: ../../library/dis.rst:1658 +#: ../../library/dis.rst:1663 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1659 +#: ../../library/dis.rst:1664 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: ../../library/dis.rst:1668 +#: ../../library/dis.rst:1673 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" -#: ../../library/dis.rst:1670 +#: ../../library/dis.rst:1675 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" -#: ../../library/dis.rst:1674 +#: ../../library/dis.rst:1679 msgid "if it is 3, implements::" msgstr "" -#: ../../library/dis.rst:1676 +#: ../../library/dis.rst:1681 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" @@ -1887,11 +1894,11 @@ msgstr "" "start = STACK.pop()\n" "STACK.append(slice(start, end, step))" -#: ../../library/dis.rst:1681 +#: ../../library/dis.rst:1686 msgid "See the :func:`slice` built-in function for more information." msgstr "" -#: ../../library/dis.rst:1686 +#: ../../library/dis.rst:1691 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " @@ -1899,11 +1906,11 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: ../../library/dis.rst:1694 +#: ../../library/dis.rst:1699 msgid "Convert value to a string, depending on ``oparg``::" msgstr "" -#: ../../library/dis.rst:1696 +#: ../../library/dis.rst:1701 msgid "" "value = STACK.pop()\n" "result = func(value)\n" @@ -1913,28 +1920,28 @@ msgstr "" "result = func(value)\n" "STACK.append(result)" -#: ../../library/dis.rst:1700 +#: ../../library/dis.rst:1705 msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" -#: ../../library/dis.rst:1701 +#: ../../library/dis.rst:1706 msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" -#: ../../library/dis.rst:1702 +#: ../../library/dis.rst:1707 msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" -#: ../../library/dis.rst:1704 ../../library/dis.rst:1717 -#: ../../library/dis.rst:1730 +#: ../../library/dis.rst:1709 ../../library/dis.rst:1722 +#: ../../library/dis.rst:1735 msgid "Used for implementing formatted string literals (f-strings)." msgstr "" -#: ../../library/dis.rst:1711 +#: ../../library/dis.rst:1716 msgid "Formats the value on top of stack::" msgstr "" -#: ../../library/dis.rst:1713 +#: ../../library/dis.rst:1718 msgid "" "value = STACK.pop()\n" "result = value.__format__(\"\")\n" @@ -1944,11 +1951,11 @@ msgstr "" "result = value.__format__(\"\")\n" "STACK.append(result)" -#: ../../library/dis.rst:1723 +#: ../../library/dis.rst:1728 msgid "Formats the given value with the given format spec::" msgstr "" -#: ../../library/dis.rst:1725 +#: ../../library/dis.rst:1730 msgid "" "spec = STACK.pop()\n" "value = STACK.pop()\n" @@ -1960,14 +1967,14 @@ msgstr "" "result = value.__format__(spec)\n" "STACK.append(result)" -#: ../../library/dis.rst:1737 +#: ../../library/dis.rst:1742 msgid "" "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " "class being matched against, and ``STACK[-3]`` is the match subject. " "*count* is the number of positional sub-patterns." msgstr "" -#: ../../library/dis.rst:1741 +#: ../../library/dis.rst:1746 msgid "" "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " "instance of ``STACK[-2]`` and has the positional and keyword attributes " @@ -1975,219 +1982,219 @@ msgid "" "Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:1755 +#: ../../library/dis.rst:1760 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -#: ../../library/dis.rst:1757 +#: ../../library/dis.rst:1762 msgid "" "The ``context`` operand consists of two parts. The lowest two bits indicate " "where the ``RESUME`` occurs:" msgstr "" -#: ../../library/dis.rst:1760 +#: ../../library/dis.rst:1765 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" -#: ../../library/dis.rst:1762 +#: ../../library/dis.rst:1767 msgid "``1`` After a ``yield`` expression" msgstr "" -#: ../../library/dis.rst:1763 +#: ../../library/dis.rst:1768 msgid "``2`` After a ``yield from`` expression" msgstr "" -#: ../../library/dis.rst:1764 +#: ../../library/dis.rst:1769 msgid "``3`` After an ``await`` expression" msgstr "" -#: ../../library/dis.rst:1766 +#: ../../library/dis.rst:1771 msgid "" "The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " "otherwise." msgstr "" -#: ../../library/dis.rst:1771 +#: ../../library/dis.rst:1776 msgid "The oparg value changed to include information about except-depth" msgstr "" -#: ../../library/dis.rst:1777 +#: ../../library/dis.rst:1782 msgid "" "Create a generator, coroutine, or async generator from the current frame. " "Used as first opcode of in code object for the above mentioned callables. " "Clear the current frame and return the newly created generator." msgstr "" -#: ../../library/dis.rst:1786 +#: ../../library/dis.rst:1791 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" -#: ../../library/dis.rst:1789 +#: ../../library/dis.rst:1794 msgid "" "If the call raises :exc:`StopIteration`, pop the top value from the stack, " "push the exception's ``value`` attribute, and increment the bytecode counter " "by *delta*." msgstr "" -#: ../../library/dis.rst:1798 +#: ../../library/dis.rst:1803 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes in the range [0,255] which don't use their argument and those that " "do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -#: ../../library/dis.rst:1802 +#: ../../library/dis.rst:1807 msgid "" "If your application uses pseudo instructions or specialized instructions, " "use the :data:`hasarg` collection instead." msgstr "" -#: ../../library/dis.rst:1805 +#: ../../library/dis.rst:1810 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -#: ../../library/dis.rst:1809 +#: ../../library/dis.rst:1814 msgid "" "Pseudo instructions were added to the :mod:`dis` module, and for them it is " "not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use " "their arg." msgstr "" -#: ../../library/dis.rst:1814 +#: ../../library/dis.rst:1819 msgid "Use :data:`hasarg` instead." msgstr "" -#: ../../library/dis.rst:1819 +#: ../../library/dis.rst:1824 msgid "" "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " "argument and sets ``STACK[-1]`` to the result. Used to implement " "functionality that is not performance critical." msgstr "" -#: ../../library/dis.rst:1823 ../../library/dis.rst:1877 +#: ../../library/dis.rst:1828 ../../library/dis.rst:1882 msgid "The operand determines which intrinsic function is called:" msgstr "" -#: ../../library/dis.rst:1826 ../../library/dis.rst:1880 +#: ../../library/dis.rst:1831 ../../library/dis.rst:1885 msgid "Operand" msgstr "運算元" -#: ../../library/dis.rst:1826 ../../library/dis.rst:1880 +#: ../../library/dis.rst:1831 ../../library/dis.rst:1885 msgid "Description" msgstr "描述" -#: ../../library/dis.rst:1828 +#: ../../library/dis.rst:1833 msgid "``INTRINSIC_1_INVALID``" msgstr "``INTRINSIC_1_INVALID``" -#: ../../library/dis.rst:1828 ../../library/dis.rst:1882 +#: ../../library/dis.rst:1833 ../../library/dis.rst:1887 msgid "Not valid" msgstr "" -#: ../../library/dis.rst:1830 +#: ../../library/dis.rst:1835 msgid "``INTRINSIC_PRINT``" msgstr "``INTRINSIC_PRINT``" -#: ../../library/dis.rst:1830 +#: ../../library/dis.rst:1835 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" -#: ../../library/dis.rst:1833 +#: ../../library/dis.rst:1838 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "``INTRINSIC_IMPORT_STAR``" -#: ../../library/dis.rst:1833 +#: ../../library/dis.rst:1838 msgid "Performs ``import *`` for the named module." msgstr "" -#: ../../library/dis.rst:1836 +#: ../../library/dis.rst:1841 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "``INTRINSIC_STOPITERATION_ERROR``" -#: ../../library/dis.rst:1836 +#: ../../library/dis.rst:1841 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: ../../library/dis.rst:1839 +#: ../../library/dis.rst:1844 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "``INTRINSIC_ASYNC_GEN_WRAP``" -#: ../../library/dis.rst:1839 +#: ../../library/dis.rst:1844 msgid "Wraps an async generator value" msgstr "" -#: ../../library/dis.rst:1841 +#: ../../library/dis.rst:1846 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "``INTRINSIC_UNARY_POSITIVE``" -#: ../../library/dis.rst:1841 +#: ../../library/dis.rst:1846 msgid "Performs the unary ``+`` operation" msgstr "" -#: ../../library/dis.rst:1844 +#: ../../library/dis.rst:1849 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "``INTRINSIC_LIST_TO_TUPLE``" -#: ../../library/dis.rst:1844 +#: ../../library/dis.rst:1849 msgid "Converts a list to a tuple" msgstr "" -#: ../../library/dis.rst:1846 +#: ../../library/dis.rst:1851 msgid "``INTRINSIC_TYPEVAR``" msgstr "``INTRINSIC_TYPEVAR``" -#: ../../library/dis.rst:1846 +#: ../../library/dis.rst:1851 msgid "Creates a :class:`typing.TypeVar`" msgstr "" -#: ../../library/dis.rst:1848 +#: ../../library/dis.rst:1853 msgid "``INTRINSIC_PARAMSPEC``" msgstr "``INTRINSIC_PARAMSPEC``" -#: ../../library/dis.rst:1848 +#: ../../library/dis.rst:1853 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" -#: ../../library/dis.rst:1851 +#: ../../library/dis.rst:1856 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "``INTRINSIC_TYPEVARTUPLE``" -#: ../../library/dis.rst:1851 +#: ../../library/dis.rst:1856 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" -#: ../../library/dis.rst:1854 +#: ../../library/dis.rst:1859 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "``INTRINSIC_SUBSCRIPT_GENERIC``" -#: ../../library/dis.rst:1854 +#: ../../library/dis.rst:1859 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" -#: ../../library/dis.rst:1857 +#: ../../library/dis.rst:1862 msgid "``INTRINSIC_TYPEALIAS``" msgstr "``INTRINSIC_TYPEALIAS``" -#: ../../library/dis.rst:1857 +#: ../../library/dis.rst:1862 msgid "" "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " "statement. The argument is a tuple of the type alias's name, type " "parameters, and value." msgstr "" -#: ../../library/dis.rst:1869 +#: ../../library/dis.rst:1874 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" -#: ../../library/dis.rst:1872 +#: ../../library/dis.rst:1877 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" @@ -2199,43 +2206,43 @@ msgstr "" "result = intrinsic2(arg1, arg2)\n" "STACK.append(result)" -#: ../../library/dis.rst:1882 +#: ../../library/dis.rst:1887 msgid "``INTRINSIC_2_INVALID``" msgstr "``INTRINSIC_2_INVALID``" -#: ../../library/dis.rst:1884 +#: ../../library/dis.rst:1889 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "``INTRINSIC_PREP_RERAISE_STAR``" -#: ../../library/dis.rst:1884 +#: ../../library/dis.rst:1889 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" -#: ../../library/dis.rst:1888 +#: ../../library/dis.rst:1893 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "``INTRINSIC_TYPEVAR_WITH_BOUND``" -#: ../../library/dis.rst:1888 +#: ../../library/dis.rst:1893 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" -#: ../../library/dis.rst:1891 +#: ../../library/dis.rst:1896 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -#: ../../library/dis.rst:1891 +#: ../../library/dis.rst:1896 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" -#: ../../library/dis.rst:1895 +#: ../../library/dis.rst:1900 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -#: ../../library/dis.rst:1895 +#: ../../library/dis.rst:1900 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -#: ../../library/dis.rst:1904 +#: ../../library/dis.rst:1909 msgid "" "Performs special method lookup on ``STACK[-1]``. If " "``type(STACK[-1]).__xxx__`` is a method, leave ``type(STACK[-1]).__xxx__; " @@ -2243,25 +2250,25 @@ msgid "" "leave ``STACK[-1].__xxx__; NULL`` on the stack." msgstr "" -#: ../../library/dis.rst:1913 +#: ../../library/dis.rst:1918 msgid "**Pseudo-instructions**" msgstr "" -#: ../../library/dis.rst:1915 +#: ../../library/dis.rst:1920 msgid "" "These opcodes do not appear in Python bytecode. They are used by the " "compiler but are replaced by real opcodes or removed before bytecode is " "generated." msgstr "" -#: ../../library/dis.rst:1920 +#: ../../library/dis.rst:1925 msgid "" "Set up an exception handler for the following code block. If an exception " "occurs, the value stack level is restored to its current state and control " "is transferred to the exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1927 +#: ../../library/dis.rst:1932 msgid "" "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " "instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " @@ -2270,14 +2277,14 @@ msgid "" "exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1936 +#: ../../library/dis.rst:1941 msgid "" "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " "from the stack before control is transferred to the exception handler at " "``target``." msgstr "" -#: ../../library/dis.rst:1940 +#: ../../library/dis.rst:1945 msgid "" "This variant is used in :keyword:`with` and :keyword:`async with` " "constructs, which push the return value of the context " @@ -2285,83 +2292,83 @@ msgid "" "stack." msgstr "" -#: ../../library/dis.rst:1947 +#: ../../library/dis.rst:1952 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -#: ../../library/dis.rst:1953 +#: ../../library/dis.rst:1958 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" -#: ../../library/dis.rst:1959 +#: ../../library/dis.rst:1964 msgid "" "Conditional jumps which do not impact the stack. Replaced by the sequence " "``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``." msgstr "" -#: ../../library/dis.rst:1964 +#: ../../library/dis.rst:1969 msgid "" "Pushes a reference to the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1967 +#: ../../library/dis.rst:1972 msgid "" "Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." msgstr "" -#: ../../library/dis.rst:1969 +#: ../../library/dis.rst:1974 msgid "This opcode is now a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1975 +#: ../../library/dis.rst:1980 msgid "" "Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode with a " "flag set in the arg." msgstr "" -#: ../../library/dis.rst:1982 +#: ../../library/dis.rst:1987 msgid "Opcode collections" msgstr "" -#: ../../library/dis.rst:1984 +#: ../../library/dis.rst:1989 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: ../../library/dis.rst:1987 +#: ../../library/dis.rst:1992 msgid "" "The collections now contain pseudo instructions and instrumented " "instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " "and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" -#: ../../library/dis.rst:1994 +#: ../../library/dis.rst:1999 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: ../../library/dis.rst:1999 +#: ../../library/dis.rst:2004 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: ../../library/dis.rst:2004 +#: ../../library/dis.rst:2009 msgid "Sequence of all compare operation names." msgstr "" -#: ../../library/dis.rst:2009 +#: ../../library/dis.rst:2014 msgid "Sequence of bytecodes that use their argument." msgstr "" -#: ../../library/dis.rst:2016 +#: ../../library/dis.rst:2021 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: ../../library/dis.rst:2021 +#: ../../library/dis.rst:2026 msgid "" "Sequence of bytecodes that access a :term:`free (closure) variable `. 'free' in this context refers to names in the current scope that " @@ -2370,47 +2377,47 @@ msgid "" "scopes." msgstr "" -#: ../../library/dis.rst:2029 +#: ../../library/dis.rst:2034 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: ../../library/dis.rst:2034 +#: ../../library/dis.rst:2039 msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" -#: ../../library/dis.rst:2041 +#: ../../library/dis.rst:2046 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: ../../library/dis.rst:2046 +#: ../../library/dis.rst:2051 msgid "Sequence of bytecodes of Boolean operations." msgstr "" -#: ../../library/dis.rst:2050 +#: ../../library/dis.rst:2055 msgid "Sequence of bytecodes that set an exception handler." msgstr "" -#: ../../library/dis.rst:2057 +#: ../../library/dis.rst:2062 msgid "Sequence of bytecodes that have a relative jump target." msgstr "" -#: ../../library/dis.rst:2059 +#: ../../library/dis.rst:2064 msgid "All jumps are now relative. Use :data:`hasjump`." msgstr "" -#: ../../library/dis.rst:2065 +#: ../../library/dis.rst:2070 msgid "Sequence of bytecodes that have an absolute jump target." msgstr "" -#: ../../library/dis.rst:2067 +#: ../../library/dis.rst:2072 msgid "All jumps are now relative. This list is empty." msgstr "" -#: ../../library/dis.rst:1666 +#: ../../library/dis.rst:1671 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/dis.rst:1666 +#: ../../library/dis.rst:1671 msgid "slice" msgstr "slice(切片)" diff --git a/library/distribution.po b/library/distribution.po index ef9d7dfdf89..ec4ebd2237d 100644 --- a/library/distribution.po +++ b/library/distribution.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" diff --git a/library/distutils.po b/library/distutils.po index 5705c4cc8a3..c73c27804e9 100644 --- a/library/distutils.po +++ b/library/distutils.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/doctest.po b/library/doctest.po index 4ddd44aa896..11f8553e6db 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" diff --git a/library/email.charset.po b/library/email.charset.po index 34d62860339..d5fa76c9228 100644 --- a/library/email.charset.po +++ b/library/email.charset.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" diff --git a/library/email.compat32-message.po b/library/email.compat32-message.po index 1be28eae02b..f7a5f594604 100644 --- a/library/email.compat32-message.po +++ b/library/email.compat32-message.po @@ -1,8 +1,8 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-07 17:47+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" diff --git a/library/email.contentmanager.po b/library/email.contentmanager.po index 3ecae144865..694d14c518f 100644 --- a/library/email.contentmanager.po +++ b/library/email.contentmanager.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-01-19 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" diff --git a/library/email.encoders.po b/library/email.encoders.po index 851f162ded3..6aa55e07106 100644 --- a/library/email.encoders.po +++ b/library/email.encoders.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: 2024-05-03 03:44+0000\n" diff --git a/library/email.errors.po b/library/email.errors.po index 2709c6bc47f..8ff458b07f9 100644 --- a/library/email.errors.po +++ b/library/email.errors.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" diff --git a/library/email.examples.po b/library/email.examples.po index f0275174436..a6699ca3907 100644 --- a/library/email.examples.po +++ b/library/email.examples.po @@ -1,9 +1,8 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-04-08 00:14+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" diff --git a/library/email.generator.po b/library/email.generator.po index 64c675911dc..3ab3635a491 100644 --- a/library/email.generator.po +++ b/library/email.generator.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" diff --git a/library/email.header.po b/library/email.header.po index 2492b8b82e6..6cf77fc3c82 100644 --- a/library/email.header.po +++ b/library/email.header.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" diff --git a/library/email.headerregistry.po b/library/email.headerregistry.po index 79898d5d743..450f84fe068 100644 --- a/library/email.headerregistry.po +++ b/library/email.headerregistry.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" diff --git a/library/email.iterators.po b/library/email.iterators.po index 71843281fbf..5a0856c0186 100644 --- a/library/email.iterators.po +++ b/library/email.iterators.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-11-19 00:30+0000\n" diff --git a/library/email.message.po b/library/email.message.po index 6be5abfbdc0..3c38c5cd97a 100644 --- a/library/email.message.po +++ b/library/email.message.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" diff --git a/library/email.mime.po b/library/email.mime.po index 2cd526c301f..e51a1ffd94c 100644 --- a/library/email.mime.po +++ b/library/email.mime.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:00+0000\n" diff --git a/library/email.parser.po b/library/email.parser.po index 9bcf6914776..6decb9220c0 100644 --- a/library/email.parser.po +++ b/library/email.parser.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-14 11:31+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/email.po b/library/email.po index da6d04ebe5e..f0bad9cfcbb 100644 --- a/library/email.po +++ b/library/email.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/email.policy.po b/library/email.policy.po index 526811754f1..1f7507a8772 100644 --- a/library/email.policy.po +++ b/library/email.policy.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-01-06 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/email.utils.po b/library/email.utils.po index cf165d9bc23..37cc9eb5001 100644 --- a/library/email.utils.po +++ b/library/email.utils.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/ensurepip.po b/library/ensurepip.po index 9055ad0aacd..7e92f48d4f9 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/enum.po b/library/enum.po index f62dae906da..fd17ead394b 100644 --- a/library/enum.po +++ b/library/enum.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-12-21 13:50+0800\n" @@ -551,18 +551,18 @@ msgstr "" "[, , ]" #: ../../library/enum.rst:256 -#, fuzzy msgid "" "Adds a new name as an alias to an existing member. Raises " "a :exc:`NameError` if the name is already assigned to a different member." -msgstr "如果該名稱已被指派給不同的成員,則會引發 :exc:`NameError`。" +msgstr "" +"為已存在的成員新增一個名稱作為別名。如果該名稱已經被指派給不同的成員,則會引發 :exc:`NameError`。" #: ../../library/enum.rst:261 -#, fuzzy msgid "" "Adds a new value as an alias to an existing member. Raises " "a :exc:`ValueError` if the value is already linked with a different member." -msgstr "如果該值已與不同成員連結,則會引發 :exc:`ValueError`。" +msgstr "" +"為已存在的成員新增一個值作為別名。如果該值已經被連結到不同的成員,則會引發 :exc:`ValueError`。" #: ../../library/enum.rst:266 msgid "" @@ -1194,9 +1194,8 @@ msgid "" msgstr ":class:`Flag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" #: ../../library/enum.rst:653 -#, fuzzy msgid "The *repr()* of zero-valued flags has changed. It is now:" -msgstr "值為 0 的旗標的 *repr()* 已改變。現在是: ::" +msgstr "值為 0 的旗標的 *repr()* 已改變。現在是:" #: ../../library/enum.rst:661 msgid "" @@ -1235,18 +1234,16 @@ msgid "" msgstr "結果不是合法的 *IntFlag*:結果會根據 :class:`FlagBoundary` 的設定" #: ../../library/enum.rst:686 -#, fuzzy msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now::" -msgstr "未命名且值為 0 的旗標的 :func:`repr` 已改變。現在是:" +msgstr "未命名且值為 0 的旗標的 :func:`repr` 已改變。現在是: ::" #: ../../library/enum.rst:688 -#, fuzzy msgid "" ">>> Color(0)\n" "" msgstr "" -">>> Color['BLUE']\n" -"" +">>> Color(0)\n" +"" #: ../../library/enum.rst:693 msgid "" @@ -1561,18 +1558,16 @@ msgid "Supported ``_sunder_`` names" msgstr "支援的 ``_sunder_`` 名稱" #: ../../library/enum.rst:882 -#, fuzzy msgid "" ":meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing " "member." -msgstr ":meth:`~Enum._add_alias_` -- 新增一個名稱作為現有成員的別名。" +msgstr ":meth:`~EnumType._add_alias_` -- 新增一個名稱作為現有成員的別名。" #: ../../library/enum.rst:884 -#, fuzzy msgid "" ":meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an " "existing member." -msgstr ":meth:`~Enum._add_value_alias_` -- 新增一個值作為現有成員的別名。" +msgstr ":meth:`~EnumType._add_value_alias_` -- 新增一個值作為現有成員的別名。" #: ../../library/enum.rst:886 msgid ":attr:`~Enum._name_` -- name of the member" diff --git a/library/errno.po b/library/errno.po index 58a75aa3b73..822df7939fb 100644 --- a/library/errno.po +++ b/library/errno.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" @@ -417,7 +416,7 @@ msgstr "" #: ../../library/errno.rst:471 msgid "Too many users" -msgstr "" +msgstr "使用者數量過多" #: ../../library/errno.rst:476 msgid "Socket operation on non-socket" @@ -639,19 +638,19 @@ msgstr "" #: ../../library/errno.rst:751 msgid "Device error" -msgstr "" +msgstr "裝置錯誤" #: ../../library/errno.rst:758 msgid "Inappropriate file type or format" -msgstr "" +msgstr "不適當的檔案類型或格式" #: ../../library/errno.rst:765 msgid "Need authenticator" -msgstr "" +msgstr "需要驗證器" #: ../../library/errno.rst:772 msgid "Attribute not found" -msgstr "" +msgstr "找不到屬性" #: ../../library/errno.rst:779 msgid "Policy not found" @@ -659,7 +658,7 @@ msgstr "" #: ../../library/errno.rst:786 msgid "Too many processes" -msgstr "" +msgstr "行程數量過多" #: ../../library/errno.rst:793 msgid "Bad procedure for program" @@ -675,19 +674,19 @@ msgstr "" #: ../../library/errno.rst:814 msgid "Device power is off" -msgstr "" +msgstr "裝置電源關閉" #: ../../library/errno.rst:821 msgid "RPC struct is bad" -msgstr "" +msgstr "RPC 結構不正確" #: ../../library/errno.rst:828 msgid "RPC version wrong" -msgstr "" +msgstr "RPC 版本錯誤" #: ../../library/errno.rst:835 msgid "Shared library version mismatch" -msgstr "" +msgstr "共享函式庫版本不匹配" #: ../../library/errno.rst:842 msgid "" @@ -701,12 +700,12 @@ msgstr "可用性" #: ../../library/errno.rst:852 msgid "Operation canceled" -msgstr "" +msgstr "操作已取消" #: ../../library/errno.rst:859 msgid "Owner died" -msgstr "" +msgstr "擁有者過世" #: ../../library/errno.rst:866 msgid "State not recoverable" -msgstr "" +msgstr "狀態無法恢復" diff --git a/library/exceptions.po b/library/exceptions.po index 8704cb18934..a928b9ed964 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-12-20 16:57+0800\n" diff --git a/library/faulthandler.po b/library/faulthandler.po index 12b954ea311..9a1ae1bc93e 100644 --- a/library/faulthandler.po +++ b/library/faulthandler.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/fcntl.po b/library/fcntl.po index 4bbdcd57538..7f8e4b7a7f9 100644 --- a/library/fcntl.po +++ b/library/fcntl.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/library/filecmp.po b/library/filecmp.po index 03990f1fdc9..72f95f82823 100644 --- a/library/filecmp.po +++ b/library/filecmp.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/fileformats.po b/library/fileformats.po index 9da51697742..03c53fa5e1c 100644 --- a/library/fileformats.po +++ b/library/fileformats.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2025-06-28 00:51+0800\n" diff --git a/library/fileinput.po b/library/fileinput.po index 6c58733102c..377e8618708 100644 --- a/library/fileinput.po +++ b/library/fileinput.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/filesys.po b/library/filesys.po index 9c42ea3858e..f3eff555d9f 100644 --- a/library/filesys.po +++ b/library/filesys.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Allen Wu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2021-11-22 20:13+0800\n" diff --git a/library/fnmatch.po b/library/fnmatch.po index fb01ac7540d..5c17ff5a544 100644 --- a/library/fnmatch.po +++ b/library/fnmatch.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" diff --git a/library/fractions.po b/library/fractions.po index 819ee0581e4..722ae18f1a3 100644 --- a/library/fractions.po +++ b/library/fractions.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2016-01-31 07:18+0000\n" @@ -187,13 +186,11 @@ msgid "" msgstr "" #: ../../library/fractions.rst:118 -#, fuzzy msgid "" "The :class:`Fraction` constructor now accepts any objects with the :meth:`!" "as_integer_ratio` method." msgstr "" -":class:`Fraction` 建構函式現在可接受 :class:`float` " -"和 :class:`decimal.Decimal` 實例。" +":class:`Fraction` 建構函式現在可接受任何具有 :meth:`!as_integer_ratio` 方法的物件。" #: ../../library/fractions.rst:124 msgid "Numerator of the Fraction in lowest term." @@ -359,4 +356,4 @@ msgstr "" #: ../../library/fractions.rst:20 msgid "as_integer_ratio()" -msgstr "" +msgstr "as_integer_ratio()" diff --git a/library/frameworks.po b/library/frameworks.po index 7f997c290b1..a3767f24976 100644 --- a/library/frameworks.po +++ b/library/frameworks.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-16 00:16+0000\n" "PO-Revision-Date: 2025-06-27 13:41+0800\n" diff --git a/library/ftplib.po b/library/ftplib.po index 8c47a8eb7eb..1e37450f777 100644 --- a/library/ftplib.po +++ b/library/ftplib.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2023-04-26 19:44+0800\n" diff --git a/library/functional.po b/library/functional.po index 89f98aafb8e..b5ba495525c 100644 --- a/library/functional.po +++ b/library/functional.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/library/functions.po b/library/functions.po index ffc64e8e318..9b4e6313e8a 100644 --- a/library/functions.po +++ b/library/functions.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # Translators: # Adrian Liaw , 2018 @@ -8,9 +8,9 @@ # Steven Hsu , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-09 05:11+0800\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1850,17 +1850,15 @@ msgstr "" "115" #: ../../library/functions.rst:1021 -#, fuzzy msgid "" "If the argument defines :meth:`~object.__int__`, ``int(x)`` returns " "``x.__int__()``. If the argument defines :meth:`~object.__index__`, it " "returns ``x.__index__()``. For floating-point numbers, this truncates " "towards zero." msgstr "" -"如果引數定義了 :meth:`~object.__int__`,則 ``int(x)`` 回傳 ``x.__int__()``。" -"如果引數定義了 :meth:`~object.__index__` 則回傳 ``x.__index__()``。如果引數定" -"義了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數,則會向零" -"的方向無條件捨去。" +"如果引數定義了 :meth:`~object.__int__`,則 ``int(x)`` 會回傳 ``x.__int__()``。" +"如果引數定義了 :meth:`~object.__index__` 則回傳 ``x.__index__()``。對於浮點" +"數,則會向零的方向無條件捨去。" #: ../../library/functions.rst:1026 msgid "" @@ -1939,10 +1937,9 @@ msgstr "" "\\ :ref:`整數字串轉換的長度限制 `\\ 說明文件。" #: ../../library/functions.rst:1069 -#, fuzzy msgid "" ":func:`int` no longer delegates to the :meth:`~object.__trunc__` method." -msgstr "對 :meth:`~object.__trunc__` 的委派已棄用。" +msgstr ":func:`int` 不再委派給 :meth:`~object.__trunc__` method。" #: ../../library/functions.rst:1074 msgid "" @@ -2138,7 +2135,6 @@ msgid "" msgstr "" #: ../../library/functions.rst:1207 -#, fuzzy msgid "" "Return an iterator that applies *function* to every item of *iterable*, " "yielding the results. If additional *iterables* arguments are passed, " @@ -2149,16 +2145,16 @@ msgid "" "cases where the function inputs are already arranged into argument tuples, " "see :func:`itertools.starmap`." msgstr "" -"產生一個將 *function* 應用於 *iterable* 中所有元素,並收集回傳結果的 " -"iterator。如果傳遞了額外的 *iterables* 引數,則 *function* 必須接受相同個數的" -"引數,並使用所有從 iterables 中同時取得的元素。當有多個 iterables 時,最短的 " -"iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," +"產生一個將 *function* 應用於 *iterable* 中所有項目並 yield 回傳結果的" +"疊代器。如果傳遞了額外的 *iterables* 引數,則 *function* 必須接受相同個數的" +"引數,且 *function* 會平行地被應用於所有可疊代物件的項目。當有多個可疊代物件時,項目最少的" +"可疊代物件耗盡時疊代器也會結束。如果 *strict* 為 ``True`` 且其中一個" +"可疊代物件在其他可疊代物件之前耗盡,則會拋出 :exc:`ValueError`。如果函式的輸入已經被編排為引數的元組," "請參閱 :func:`itertools.starmap`。" #: ../../library/functions.rst:1216 -#, fuzzy msgid "Added the *strict* parameter." -msgstr "增加了 *closure* 參數。" +msgstr "增加了 *strict* 參數。" #: ../../library/functions.rst:1224 msgid "" @@ -2455,17 +2451,15 @@ msgstr "" "下:" #: ../../library/functions.rst:1405 -#, fuzzy msgid "" "Binary files are buffered in fixed-size chunks; the size of the buffer is " "``max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)`` when the device block " "size is available. On most systems, the buffer will typically be 128 " "kilobytes long." msgstr "" -"二進制檔案會以固定大小的區塊進行緩衝;緩衝區的大小是使用啟發式嘗試 " -"(heuristic trying) 來決定底層設備的「區塊大小」,並會回退" -"到 :attr:`io.DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 " -"8192 個位元組。" +"二進位檔案會以固定大小的區塊進行緩衝;緩衝區的大小為 " +"``max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)``,當裝置區塊大小可用時。" +"在大多數系統上,緩衝區的長度通常為 128 KB。" #: ../../library/functions.rst:1410 msgid "" @@ -2751,18 +2745,28 @@ msgid "The ``'U'`` mode has been removed." msgstr "``'U'`` 模式被移除。" #: ../../library/functions.rst:1564 -#, fuzzy +msgid "Return the ordinal value of a character." +msgstr "" + +#: ../../library/functions.rst:1566 msgid "" -"Given a string representing one Unicode character, return an integer " -"representing the Unicode code point of that character. For example, " -"``ord('a')`` returns the integer ``97`` and ``ord('€')`` (Euro sign) returns " -"``8364``. This is the inverse of :func:`chr`." +"If the argument is a one-character string, return the Unicode code point of " +"that character. For example, ``ord('a')`` returns the integer ``97`` and " +"``ord('€')`` (Euro sign) returns ``8364``. This is the inverse " +"of :func:`chr`." msgstr "" "如果引數是單字元字串,則回傳該字元的 Unicode 編碼位置。例如 ``ord('a')`` 回傳" "整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這是 :func:`chr` 的逆" "函式。" -#: ../../library/functions.rst:1572 +#: ../../library/functions.rst:1571 +msgid "" +"If the argument is a :class:`bytes` or :class:`bytearray` object of length " +"1, return its single byte value. For example, ``ord(b'a')`` returns the " +"integer ``97``." +msgstr "" + +#: ../../library/functions.rst:1578 msgid "" "Return *base* to the power *exp*; if *mod* is present, return *base* to the " "power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " @@ -2773,8 +2777,7 @@ msgstr "" "*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" -#: ../../library/functions.rst:1577 -#, fuzzy +#: ../../library/functions.rst:1583 msgid "" "The arguments must have numeric types. With mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " @@ -2788,17 +2791,17 @@ msgid "" "or :class:`float` with an integral exponent, a float result is delivered. " "For example, ``pow(-9, 2.0)`` returns ``81.0``." msgstr "" -"當引數為內建數值型別,且用於混合型別的運算元,會套用二元算術運算子的強制轉型 " +"引數必須為數值型別。當運算元型別為混合型別時,會套用二元算術運算子的強制轉型 " "(coercion) 規則。對於 :class:`int` 運算元,運算結果會(在強制轉型後)與運算元" "的型別相同,除非第二個引數是負數;在這種情況下,所有的引數都會被轉換為浮點數" "並得到浮點數的結果。例如,``pow(10, 2)`` 會回傳 ``100``,但 ``pow(10, -2)`` " "會回傳 ``0.01``。如果底數 (base) 是型別為 :class:`int` 或 :class:`float` 的負" -"數且指數 (exponent) 不是整數,則會得到一個複數的結果,例如 ``pow(-9, 0.5)`` " -"會回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` " -"或 :class:`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 " +"數且指數 (exponent) 為非整數,則會傳回複數結果。例如 ``pow(-9, 0.5)`` " +"會回傳一個接近 ``3j`` 的值。然而,如果底數 (base) 是型別為 :class:`int` " +"或 :class:`float` 的負數且指數為整數,則會傳回浮點數結果。例如 " "``pow(-9, 2.0)`` 會回傳 ``81.0``。" -#: ../../library/functions.rst:1589 +#: ../../library/functions.rst:1595 msgid "" "For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must " "also be of integer type and *mod* must be nonzero. If *mod* is present and " @@ -2811,11 +2814,11 @@ msgstr "" "與 *mod* 互質。在這種情況下,會回傳 ``pow(inv_base, -exp, mod)``,其中 " "*inv_base* 是 *base* 對 *mod* 的模倒數 (inverse modulo)。" -#: ../../library/functions.rst:1595 +#: ../../library/functions.rst:1601 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "以下是一個計算 ``38`` 對 ``97`` 取模倒數的範例: ::" -#: ../../library/functions.rst:1597 +#: ../../library/functions.rst:1603 msgid "" ">>> pow(38, -1, mod=97)\n" "23\n" @@ -2827,7 +2830,7 @@ msgstr "" ">>> 23 * 38 % 97 == 1\n" "True" -#: ../../library/functions.rst:1602 +#: ../../library/functions.rst:1608 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." @@ -2835,12 +2838,12 @@ msgstr "" "對於 :class:`int` 運算元,現在 ``pow`` 的三引數形式允許第二個引數為負數,也容" "許模倒數的計算。" -#: ../../library/functions.rst:1607 +#: ../../library/functions.rst:1613 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "允許關鍵字引數。在此之前只支援位置引數。" -#: ../../library/functions.rst:1614 +#: ../../library/functions.rst:1620 msgid "" "Print *objects* to the text stream *file*, separated by *sep* and followed " "by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " @@ -2849,7 +2852,7 @@ msgstr "" "將 *objects* 列印到文字資料串流 *file*,用 *sep* 分隔並以 *end* 結尾。如果有" "給定 *sep*、*end*、*file* 和 *flush*,那麼它們必須是關鍵字引數的形式。" -#: ../../library/functions.rst:1618 +#: ../../library/functions.rst:1624 msgid "" "All non-keyword arguments are converted to strings like :func:`str` does and " "written to the stream, separated by *sep* and followed by *end*. Both *sep* " @@ -2862,7 +2865,7 @@ msgstr "" "以是 ``None``,這表示使用預設值。如果沒有給定 *objects*,:func:`print` 就只會" "寫入 *end*。" -#: ../../library/functions.rst:1624 +#: ../../library/functions.rst:1630 msgid "" "The *file* argument must be an object with a ``write(string)`` method; if it " "is not present or ``None``, :data:`sys.stdout` will be used. Since printed " @@ -2874,7 +2877,7 @@ msgstr "" "串,所以 :func:`print` 不能用於二進位模式的檔案物件。對於此類物件,請改用 " "``file.write(...)``。" -#: ../../library/functions.rst:1629 +#: ../../library/functions.rst:1635 msgid "" "Output buffering is usually determined by *file*. However, if *flush* is " "true, the stream is forcibly flushed." @@ -2882,15 +2885,15 @@ msgstr "" "輸出緩衝通常會由 *file* 決定。但是如果 *flush* 為 true,則資料串流會被強制清" "除。" -#: ../../library/functions.rst:1633 +#: ../../library/functions.rst:1639 msgid "Added the *flush* keyword argument." msgstr "增加了 *flush* 關鍵字引數。" -#: ../../library/functions.rst:1639 +#: ../../library/functions.rst:1645 msgid "Return a property attribute." msgstr "回傳 property 屬性。" -#: ../../library/functions.rst:1641 +#: ../../library/functions.rst:1647 msgid "" "*fget* is a function for getting an attribute value. *fset* is a function " "for setting an attribute value. *fdel* is a function for deleting an " @@ -2899,11 +2902,11 @@ msgstr "" "*fget* 是一個用於取得屬性值的函式,*fset* 是一個用於設定屬性值的函式,*fdel* " "是一個用於刪除屬性值的函式,而 *doc* 會為該屬性建立一個說明字串。" -#: ../../library/functions.rst:1645 +#: ../../library/functions.rst:1651 msgid "A typical use is to define a managed attribute ``x``::" msgstr "一個典型的用途是定義一個受管理的屬性 ``x``: ::" -#: ../../library/functions.rst:1647 +#: ../../library/functions.rst:1653 msgid "" "class C:\n" " def __init__(self):\n" @@ -2935,7 +2938,7 @@ msgstr "" "\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" -#: ../../library/functions.rst:1662 +#: ../../library/functions.rst:1668 msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." @@ -2943,7 +2946,7 @@ msgstr "" "如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會叫用取得器 (getter),``c.x = " "value`` 會呼叫設定器 (setter),而 ``del c.x`` 會叫用刪除器 (deleter)。" -#: ../../library/functions.rst:1665 +#: ../../library/functions.rst:1671 msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " @@ -2954,7 +2957,7 @@ msgstr "" "*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使" "用 :func:`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" -#: ../../library/functions.rst:1669 +#: ../../library/functions.rst:1675 msgid "" "class Parrot:\n" " def __init__(self):\n" @@ -2966,14 +2969,14 @@ msgid "" " return self._voltage" msgstr "" -#: ../../library/functions.rst:1678 +#: ../../library/functions.rst:1684 msgid "" "The ``@property`` decorator turns the :meth:`!voltage` method into a " "\"getter\" for a read-only attribute with the same name, and it sets the " "docstring for *voltage* to \"Get the current voltage.\"" msgstr "" -#: ../../library/functions.rst:1686 +#: ../../library/functions.rst:1692 msgid "" "A property object has ``getter``, ``setter``, and ``deleter`` methods usable " "as decorators that create a copy of the property with the corresponding " @@ -2981,7 +2984,7 @@ msgid "" "with an example:" msgstr "" -#: ../../library/functions.rst:1691 +#: ../../library/functions.rst:1697 msgid "" "class C:\n" " def __init__(self):\n" @@ -3017,36 +3020,36 @@ msgstr "" " def x(self):\n" " del self._x" -#: ../../library/functions.rst:1710 +#: ../../library/functions.rst:1716 msgid "" "This code is exactly equivalent to the first example. Be sure to give the " "additional functions the same name as the original property (``x`` in this " "case.)" msgstr "" -#: ../../library/functions.rst:1714 +#: ../../library/functions.rst:1720 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." msgstr "" -#: ../../library/functions.rst:1717 +#: ../../library/functions.rst:1723 msgid "The docstrings of property objects are now writeable." msgstr "" -#: ../../library/functions.rst:1722 +#: ../../library/functions.rst:1728 msgid "" "Attribute holding the name of the property. The name of the property can be " "changed at runtime." msgstr "" -#: ../../library/functions.rst:1733 +#: ../../library/functions.rst:1739 msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1739 +#: ../../library/functions.rst:1745 msgid "" "Return a string containing a printable representation of an object. For " "many types, this function makes an attempt to return a string that would " @@ -3059,11 +3062,11 @@ msgid "" "raise :exc:`RuntimeError`." msgstr "" -#: ../../library/functions.rst:1750 +#: ../../library/functions.rst:1756 msgid "This class has a custom representation that can be evaluated::" msgstr "" -#: ../../library/functions.rst:1752 +#: ../../library/functions.rst:1758 msgid "" "class Person:\n" " def __init__(self, name, age):\n" @@ -3081,7 +3084,7 @@ msgstr "" " def __repr__(self):\n" " return f\"Person('{self.name}', {self.age})\"" -#: ../../library/functions.rst:1763 +#: ../../library/functions.rst:1769 msgid "" "Return a reverse :term:`iterator`. The argument must be an object which has " "a :meth:`~object.__reversed__` method or supports the sequence protocol " @@ -3089,14 +3092,14 @@ msgid "" "method with integer arguments starting at ``0``)." msgstr "" -#: ../../library/functions.rst:1771 +#: ../../library/functions.rst:1777 msgid "" "Return *number* rounded to *ndigits* precision after the decimal point. If " "*ndigits* is omitted or is ``None``, it returns the nearest integer to its " "input." msgstr "" -#: ../../library/functions.rst:1775 +#: ../../library/functions.rst:1781 msgid "" "For the built-in types supporting :func:`round`, values are rounded to the " "closest multiple of 10 to the power minus *ndigits*; if two multiples are " @@ -3107,13 +3110,13 @@ msgid "" "``None``. Otherwise, the return value has the same type as *number*." msgstr "" -#: ../../library/functions.rst:1784 +#: ../../library/functions.rst:1790 msgid "" "For a general Python object ``number``, ``round`` delegates to " "``number.__round__``." msgstr "" -#: ../../library/functions.rst:1789 +#: ../../library/functions.rst:1795 msgid "" "The behavior of :func:`round` for floats can be surprising: for example, " "``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is " @@ -3122,21 +3125,21 @@ msgid "" "information." msgstr "" -#: ../../library/functions.rst:1800 +#: ../../library/functions.rst:1806 msgid "" "Return a new :class:`set` object, optionally with elements taken from " "*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" "set` for documentation about this class." msgstr "" -#: ../../library/functions.rst:1804 +#: ../../library/functions.rst:1810 msgid "" "For other containers see the built-" "in :class:`frozenset`, :class:`list`, :class:`tuple`, and :class:`dict` " "classes, as well as the :mod:`collections` module." msgstr "" -#: ../../library/functions.rst:1811 +#: ../../library/functions.rst:1817 msgid "" "This is the counterpart of :func:`getattr`. The arguments are an object, a " "string, and an arbitrary value. The string may name an existing attribute " @@ -3145,7 +3148,7 @@ msgid "" "is equivalent to ``x.foobar = 123``." msgstr "" -#: ../../library/functions.rst:1817 +#: ../../library/functions.rst:1823 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " "unless the object chooses to enforce that, for example in a " @@ -3154,21 +3157,21 @@ msgid "" "dot notation, but is accessible through :func:`getattr` etc.." msgstr "" -#: ../../library/functions.rst:1825 +#: ../../library/functions.rst:1831 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " "with two leading underscores) name in order to set it with :func:`setattr`." msgstr "" -#: ../../library/functions.rst:1834 +#: ../../library/functions.rst:1840 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " "``None``." msgstr "" -#: ../../library/functions.rst:1838 +#: ../../library/functions.rst:1844 msgid "" "Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, " "and :attr:`!step` which merely return the argument values (or their " @@ -3176,7 +3179,7 @@ msgid "" "by NumPy and other third-party packages." msgstr "" -#: ../../library/functions.rst:1847 +#: ../../library/functions.rst:1853 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " "example: ``a[start:stop:step]`` or ``a[start:stop, i]``. " @@ -3184,23 +3187,23 @@ msgid "" "an :term:`iterator`." msgstr "" -#: ../../library/functions.rst:1852 +#: ../../library/functions.rst:1858 msgid "" "Slice objects are now :term:`hashable` " "(provided :attr:`~slice.start`, :attr:`~slice.stop`, and :attr:`~slice.step` " "are hashable)." msgstr "" -#: ../../library/functions.rst:1858 +#: ../../library/functions.rst:1864 msgid "Return a new sorted list from the items in *iterable*." msgstr "" -#: ../../library/functions.rst:1860 +#: ../../library/functions.rst:1866 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" -#: ../../library/functions.rst:1862 +#: ../../library/functions.rst:1868 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each element in *iterable* (for example, " @@ -3208,19 +3211,19 @@ msgid "" "directly)." msgstr "" -#: ../../library/functions.rst:1866 +#: ../../library/functions.rst:1872 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -#: ../../library/functions.rst:1869 +#: ../../library/functions.rst:1875 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." msgstr "" -#: ../../library/functions.rst:1872 +#: ../../library/functions.rst:1878 msgid "" "The built-in :func:`sorted` function is guaranteed to be stable. A sort is " "stable if it guarantees not to change the relative order of elements that " @@ -3228,7 +3231,7 @@ msgid "" "example, sort by department, then by salary grade)." msgstr "" -#: ../../library/functions.rst:1877 +#: ../../library/functions.rst:1883 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -3240,22 +3243,22 @@ msgid "" "method." msgstr "" -#: ../../library/functions.rst:1886 +#: ../../library/functions.rst:1892 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functions.rst:1890 +#: ../../library/functions.rst:1896 msgid "Transform a method into a static method." msgstr "" -#: ../../library/functions.rst:1892 +#: ../../library/functions.rst:1898 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -#: ../../library/functions.rst:1895 +#: ../../library/functions.rst:1901 msgid "" "class C:\n" " @staticmethod\n" @@ -3265,7 +3268,7 @@ msgstr "" " @staticmethod\n" " def f(arg1, arg2, argN): ..." -#: ../../library/functions.rst:1899 +#: ../../library/functions.rst:1905 msgid "" "The ``@staticmethod`` form is a function :term:`decorator` -- " "see :ref:`function` for details." @@ -3273,7 +3276,7 @@ msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" -#: ../../library/functions.rst:1902 +#: ../../library/functions.rst:1908 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " "an instance (such as ``C().f()``). Moreover, the static " @@ -3281,14 +3284,14 @@ msgid "" "definition (such as ``f()``)." msgstr "" -#: ../../library/functions.rst:1907 +#: ../../library/functions.rst:1913 msgid "" "Static methods in Python are similar to those found in Java or C++. Also, " "see :func:`classmethod` for a variant that is useful for creating alternate " "class constructors." msgstr "" -#: ../../library/functions.rst:1911 +#: ../../library/functions.rst:1917 msgid "" "Like all decorators, it is also possible to call ``staticmethod`` as a " "regular function and do something with its result. This is needed in some " @@ -3297,7 +3300,7 @@ msgid "" "cases, use this idiom::" msgstr "" -#: ../../library/functions.rst:1917 +#: ../../library/functions.rst:1923 msgid "" "def regular_function():\n" " ...\n" @@ -3311,11 +3314,11 @@ msgstr "" "class C:\n" " method = staticmethod(regular_function)" -#: ../../library/functions.rst:1923 +#: ../../library/functions.rst:1929 msgid "For more information on static methods, see :ref:`types`." msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" -#: ../../library/functions.rst:1925 +#: ../../library/functions.rst:1931 msgid "" "Static methods now inherit the method attributes " "(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " @@ -3327,25 +3330,25 @@ msgstr "" "和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性," "且為如一般函式的可呼叫物件。" -#: ../../library/functions.rst:1943 +#: ../../library/functions.rst:1949 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" -#: ../../library/functions.rst:1945 +#: ../../library/functions.rst:1951 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -#: ../../library/functions.rst:1951 +#: ../../library/functions.rst:1957 msgid "" "Sums *start* and the items of an *iterable* from left to right and returns " "the total. The *iterable*'s items are normally numbers, and the start value " "is not allowed to be a string." msgstr "" -#: ../../library/functions.rst:1955 +#: ../../library/functions.rst:1961 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " "preferred, fast way to concatenate a sequence of strings is by calling " @@ -3354,43 +3357,43 @@ msgid "" "consider using :func:`itertools.chain`." msgstr "" -#: ../../library/functions.rst:1961 +#: ../../library/functions.rst:1967 msgid "The *start* parameter can be specified as a keyword argument." msgstr "*start* 參數可被指定為關鍵字引數。" -#: ../../library/functions.rst:1964 +#: ../../library/functions.rst:1970 msgid "" "Summation of floats switched to an algorithm that gives higher accuracy and " "better commutativity on most builds." msgstr "" -#: ../../library/functions.rst:1967 +#: ../../library/functions.rst:1973 msgid "" "Added specialization for summation of complexes, using same algorithm as for " "summation of floats." msgstr "" -#: ../../library/functions.rst:1975 +#: ../../library/functions.rst:1981 msgid "" "Return a proxy object that delegates method calls to a parent or sibling " "class of *type*. This is useful for accessing inherited methods that have " "been overridden in a class." msgstr "" -#: ../../library/functions.rst:1979 +#: ../../library/functions.rst:1985 msgid "" "The *object_or_type* determines the :term:`method resolution order` to be " "searched. The search starts from the class right after the *type*." msgstr "" -#: ../../library/functions.rst:1983 +#: ../../library/functions.rst:1989 msgid "" "For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C " "-> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -#: ../../library/functions.rst:1987 +#: ../../library/functions.rst:1993 msgid "" "The :attr:`~type.__mro__` attribute of the class corresponding to " "*object_or_type* lists the method resolution search order used by " @@ -3398,7 +3401,7 @@ msgid "" "change whenever the inheritance hierarchy is updated." msgstr "" -#: ../../library/functions.rst:1992 +#: ../../library/functions.rst:1998 msgid "" "If the second argument is omitted, the super object returned is unbound. If " "the second argument is an object, ``isinstance(obj, type)`` must be true. " @@ -3406,7 +3409,7 @@ msgid "" "(this is useful for classmethods)." msgstr "" -#: ../../library/functions.rst:1997 +#: ../../library/functions.rst:2003 msgid "" "When called directly within an ordinary method of a class, both arguments " "may be omitted (\"zero-argument :func:`!super`\"). In this case, *type* will " @@ -3416,7 +3419,7 @@ msgid "" "including generator expressions, which implicitly create nested functions.)" msgstr "" -#: ../../library/functions.rst:2004 +#: ../../library/functions.rst:2010 msgid "" "There are two typical use cases for *super*. In a class hierarchy with " "single inheritance, *super* can be used to refer to parent classes without " @@ -3424,7 +3427,7 @@ msgid "" "closely parallels the use of *super* in other programming languages." msgstr "" -#: ../../library/functions.rst:2009 +#: ../../library/functions.rst:2015 msgid "" "The second use case is to support cooperative multiple inheritance in a " "dynamic execution environment. This use case is unique to Python and is not " @@ -3437,11 +3440,11 @@ msgid "" "classes that are unknown prior to runtime)." msgstr "" -#: ../../library/functions.rst:2019 +#: ../../library/functions.rst:2025 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" -#: ../../library/functions.rst:2021 +#: ../../library/functions.rst:2027 msgid "" "class C(B):\n" " def method(self, arg):\n" @@ -3449,14 +3452,14 @@ msgid "" " # super(C, self).method(arg)" msgstr "" -#: ../../library/functions.rst:2026 +#: ../../library/functions.rst:2032 msgid "" "In addition to method lookups, :func:`super` also works for attribute " "lookups. One possible use case for this is calling :term:`descriptors " "` in a parent or sibling class." msgstr "" -#: ../../library/functions.rst:2030 +#: ../../library/functions.rst:2036 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -3466,7 +3469,7 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" -#: ../../library/functions.rst:2038 +#: ../../library/functions.rst:2044 msgid "" "Also note that, aside from the zero argument form, :func:`super` is not " "limited to use inside methods. The two argument form specifies the " @@ -3476,39 +3479,39 @@ msgid "" "accessing the current instance for ordinary methods." msgstr "" -#: ../../library/functions.rst:2045 +#: ../../library/functions.rst:2051 msgid "" "For practical suggestions on how to design cooperative classes " "using :func:`super`, see `guide to using super() `_." msgstr "" -#: ../../library/functions.rst:2049 +#: ../../library/functions.rst:2055 msgid "" ":class:`super` objects are now :mod:`pickleable ` " "and :mod:`copyable `." msgstr "" -#: ../../library/functions.rst:2058 +#: ../../library/functions.rst:2064 msgid "" "Rather than being a function, :class:`tuple` is actually an immutable " "sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:2067 +#: ../../library/functions.rst:2073 msgid "" "With one argument, return the type of an *object*. The return value is a " "type object and generally the same object as returned " "by :attr:`object.__class__`." msgstr "" -#: ../../library/functions.rst:2071 +#: ../../library/functions.rst:2077 msgid "" "The :func:`isinstance` built-in function is recommended for testing the type " "of an object, because it takes subclasses into account." msgstr "" -#: ../../library/functions.rst:2074 +#: ../../library/functions.rst:2080 msgid "" "With three arguments, return a new type object. This is essentially a " "dynamic form of the :keyword:`class` statement. The *name* string is the " @@ -3521,21 +3524,21 @@ msgid "" "identical :class:`!type` objects:" msgstr "" -#: ../../library/functions.rst:2089 +#: ../../library/functions.rst:2095 msgid "See also:" msgstr "" -#: ../../library/functions.rst:2091 +#: ../../library/functions.rst:2097 msgid "" ":ref:`Documentation on attributes and methods on classes `." msgstr "" -#: ../../library/functions.rst:2092 +#: ../../library/functions.rst:2098 msgid ":ref:`bltin-type-objects`" msgstr ":ref:`bltin-type-objects`" -#: ../../library/functions.rst:2094 +#: ../../library/functions.rst:2100 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -3543,23 +3546,23 @@ msgid "" "would." msgstr "" -#: ../../library/functions.rst:2099 +#: ../../library/functions.rst:2105 msgid "See also :ref:`class-customization`." msgstr "另請參閱 :ref:`class-customization`。" -#: ../../library/functions.rst:2101 +#: ../../library/functions.rst:2107 msgid "" "Subclasses of :class:`!type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" -#: ../../library/functions.rst:2108 +#: ../../library/functions.rst:2114 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " "or any other object with a :attr:`!__dict__` attribute." msgstr "" -#: ../../library/functions.rst:2111 +#: ../../library/functions.rst:2117 msgid "" "Objects such as modules and instances have an " "updateable :attr:`~object.__dict__` attribute; however, other objects may " @@ -3568,34 +3571,34 @@ msgid "" "updates)." msgstr "" -#: ../../library/functions.rst:2116 +#: ../../library/functions.rst:2122 msgid "Without an argument, :func:`vars` acts like :func:`locals`." msgstr "" -#: ../../library/functions.rst:2118 +#: ../../library/functions.rst:2124 msgid "" "A :exc:`TypeError` exception is raised if an object is specified but it " "doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " "defines the :attr:`~object.__slots__` attribute)." msgstr "" -#: ../../library/functions.rst:2124 +#: ../../library/functions.rst:2130 msgid "" "The result of calling this function without an argument has been updated as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:2130 +#: ../../library/functions.rst:2136 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." msgstr "" -#: ../../library/functions.rst:2133 +#: ../../library/functions.rst:2139 msgid "Example::" msgstr "例如: ::" -#: ../../library/functions.rst:2135 +#: ../../library/functions.rst:2141 msgid "" ">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" "... print(item)\n" @@ -3611,27 +3614,27 @@ msgstr "" "(2, 'spice')\n" "(3, 'everything nice')" -#: ../../library/functions.rst:2142 +#: ../../library/functions.rst:2148 msgid "" "More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " "tuple contains the *i*-th element from each of the argument iterables." msgstr "" -#: ../../library/functions.rst:2145 +#: ../../library/functions.rst:2151 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " "columns into rows. This is similar to `transposing a matrix `_." msgstr "" -#: ../../library/functions.rst:2149 +#: ../../library/functions.rst:2155 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " "iterated on, e.g. by a :keyword:`!for` loop or by wrapping in " "a :class:`list`." msgstr "" -#: ../../library/functions.rst:2153 +#: ../../library/functions.rst:2159 msgid "" "One thing to consider is that the iterables passed to :func:`zip` could have " "different lengths; sometimes by design, and sometimes because of a bug in " @@ -3639,14 +3642,14 @@ msgid "" "approaches to dealing with this issue:" msgstr "" -#: ../../library/functions.rst:2158 +#: ../../library/functions.rst:2164 msgid "" "By default, :func:`zip` stops when the shortest iterable is exhausted. It " "will ignore the remaining items in the longer iterables, cutting off the " "result to the length of the shortest iterable::" msgstr "" -#: ../../library/functions.rst:2162 +#: ../../library/functions.rst:2168 msgid "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" @@ -3654,14 +3657,14 @@ msgstr "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" -#: ../../library/functions.rst:2165 +#: ../../library/functions.rst:2171 msgid "" ":func:`zip` is often used in cases where the iterables are assumed to be of " "equal length. In such cases, it's recommended to use the ``strict=True`` " "option. Its output is the same as regular :func:`zip`::" msgstr "" -#: ../../library/functions.rst:2169 +#: ../../library/functions.rst:2175 msgid "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" @@ -3669,37 +3672,37 @@ msgstr "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" -#: ../../library/functions.rst:2172 +#: ../../library/functions.rst:2178 msgid "" "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " "is exhausted before the others:" msgstr "" -#: ../../library/functions.rst:2190 +#: ../../library/functions.rst:2196 msgid "" "Without the ``strict=True`` argument, any bug that results in iterables of " "different lengths will be silenced, possibly manifesting as a hard-to-find " "bug in another part of the program." msgstr "" -#: ../../library/functions.rst:2194 +#: ../../library/functions.rst:2200 msgid "" "Shorter iterables can be padded with a constant value to make all the " "iterables have the same length. This is done " "by :func:`itertools.zip_longest`." msgstr "" -#: ../../library/functions.rst:2198 +#: ../../library/functions.rst:2204 msgid "" "Edge cases: With a single iterable argument, :func:`zip` returns an iterator " "of 1-tuples. With no arguments, it returns an empty iterator." msgstr "" -#: ../../library/functions.rst:2201 +#: ../../library/functions.rst:2207 msgid "Tips and tricks:" msgstr "" -#: ../../library/functions.rst:2203 +#: ../../library/functions.rst:2209 msgid "" "The left-to-right evaluation order of the iterables is guaranteed. This " "makes possible an idiom for clustering a data series into n-length groups " @@ -3708,13 +3711,13 @@ msgid "" "iterator. This has the effect of dividing the input into n-length chunks." msgstr "" -#: ../../library/functions.rst:2209 +#: ../../library/functions.rst:2215 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -#: ../../library/functions.rst:2212 +#: ../../library/functions.rst:2218 msgid "" ">>> x = [1, 2, 3]\n" ">>> y = [4, 5, 6]\n" @@ -3732,17 +3735,17 @@ msgstr "" ">>> x == list(x2) and y == list(y2)\n" "True" -#: ../../library/functions.rst:2220 +#: ../../library/functions.rst:2226 msgid "Added the ``strict`` argument." msgstr "增加了 ``strict`` 引數。" -#: ../../library/functions.rst:2232 +#: ../../library/functions.rst:2238 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2235 +#: ../../library/functions.rst:2241 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -3754,7 +3757,7 @@ msgid "" "discouraged in favor of :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2244 +#: ../../library/functions.rst:2250 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -3764,7 +3767,7 @@ msgid "" "determine the package context of the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2251 +#: ../../library/functions.rst:2257 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -3773,7 +3776,7 @@ msgid "" "details)." msgstr "" -#: ../../library/functions.rst:2257 +#: ../../library/functions.rst:2263 msgid "" "When the *name* variable is of the form ``package.module``, normally, the " "top-level package (the name up till the first dot) is returned, *not* the " @@ -3781,37 +3784,37 @@ msgid "" "given, the module named by *name* is returned." msgstr "" -#: ../../library/functions.rst:2262 +#: ../../library/functions.rst:2268 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" msgstr "" -#: ../../library/functions.rst:2265 +#: ../../library/functions.rst:2271 msgid "spam = __import__('spam', globals(), locals(), [], 0)" msgstr "spam = __import__('spam', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2267 +#: ../../library/functions.rst:2273 msgid "The statement ``import spam.ham`` results in this call::" msgstr "" -#: ../../library/functions.rst:2269 +#: ../../library/functions.rst:2275 msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2271 +#: ../../library/functions.rst:2277 msgid "" "Note how :func:`__import__` returns the toplevel module here because this is " "the object that is bound to a name by the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2274 +#: ../../library/functions.rst:2280 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" msgstr "" -#: ../../library/functions.rst:2277 +#: ../../library/functions.rst:2283 msgid "" "_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" "eggs = _temp.eggs\n" @@ -3821,36 +3824,36 @@ msgstr "" "eggs = _temp.eggs\n" "saus = _temp.sausage" -#: ../../library/functions.rst:2281 +#: ../../library/functions.rst:2287 msgid "" "Here, the ``spam.ham`` module is returned from :func:`__import__`. From " "this object, the names to import are retrieved and assigned to their " "respective names." msgstr "" -#: ../../library/functions.rst:2285 +#: ../../library/functions.rst:2291 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2288 +#: ../../library/functions.rst:2294 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." msgstr "" -#: ../../library/functions.rst:2292 +#: ../../library/functions.rst:2298 msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." msgstr "" -#: ../../library/functions.rst:2297 +#: ../../library/functions.rst:2303 msgid "Footnotes" msgstr "註解" -#: ../../library/functions.rst:2298 +#: ../../library/functions.rst:2304 msgid "" "Note that the parser only accepts the Unix-style end of line convention. If " "you are reading the code from a file, make sure to use newline conversion " @@ -3863,7 +3866,7 @@ msgstr "" msgid "Boolean" msgstr "Boolean(布林值)" -#: ../../library/functions.rst:154 ../../library/functions.rst:2065 +#: ../../library/functions.rst:154 ../../library/functions.rst:2071 msgid "type" msgstr "type(型別)" @@ -3887,7 +3890,7 @@ msgstr "Infinity(無窮)" msgid "__format__" msgstr "__format__" -#: ../../library/functions.rst:820 ../../library/functions.rst:1933 +#: ../../library/functions.rst:820 ../../library/functions.rst:1939 msgid "string" msgstr "string(字串)" @@ -3939,7 +3942,7 @@ msgstr "buffering(緩衝)" msgid "text mode" msgstr "text mode(文字模式)" -#: ../../library/functions.rst:1516 ../../library/functions.rst:2226 +#: ../../library/functions.rst:1516 ../../library/functions.rst:2232 msgid "module" msgstr "module(模組)" @@ -3947,22 +3950,22 @@ msgstr "module(模組)" msgid "sys" msgstr "sys" -#: ../../library/functions.rst:1933 +#: ../../library/functions.rst:1939 msgid "str() (built-in function)" msgstr "str() (內建函式)" -#: ../../library/functions.rst:2065 +#: ../../library/functions.rst:2071 msgid "object" msgstr "object(物件)" -#: ../../library/functions.rst:2226 +#: ../../library/functions.rst:2232 msgid "statement" msgstr "statement(陳述式)" -#: ../../library/functions.rst:2226 +#: ../../library/functions.rst:2232 msgid "import" msgstr "import(引入)" -#: ../../library/functions.rst:2226 +#: ../../library/functions.rst:2232 msgid "builtins" msgstr "builtins(內建)" diff --git a/library/functools.po b/library/functools.po index 3363535f85c..b803598b208 100644 --- a/library/functools.po +++ b/library/functools.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-05-11 16:02+0800\n" @@ -624,7 +624,6 @@ msgstr "" "*keywords*。大致相當於: ::" #: ../../library/functools.rst:354 -#, fuzzy msgid "" "def partial(func, /, *args, **keywords):\n" " def newfunc(*more_args, **more_keywords):\n" @@ -635,16 +634,14 @@ msgid "" " return newfunc" msgstr "" "def partial(func, /, *args, **keywords):\n" -" def newfunc(*fargs, **fkeywords):\n" -" newkeywords = {**keywords, **fkeywords}\n" -" return func(*args, *fargs, **newkeywords)\n" +" def newfunc(*more_args, **more_keywords):\n" +" return func(*args, *more_args, **(keywords | more_keywords))\n" " newfunc.func = func\n" " newfunc.args = args\n" " newfunc.keywords = keywords\n" " return newfunc" #: ../../library/functools.rst:362 -#, fuzzy msgid "" "The :func:`!partial` function is used for partial function application which " "\"freezes\" some portion of a function's arguments and/or keywords resulting " @@ -652,7 +649,7 @@ msgid "" "can be used to create a callable that behaves like the :func:`int` function " "where the *base* argument defaults to ``2``:" msgstr "" -":func:`partial` 用於部分函式應用程序,它「凍結」函式引數和/或關鍵字的某些部" +":func:`!partial` 用於部分函式應用程序,它「凍結」函式引數和/或關鍵字的某些部" "分,從而產生具有簡化簽名的新物件。例如,:func:`partial` 可用來建立可呼叫函" "式,其行為類似於 :func:`int` 函式,其中 *base* 引數預設為 2:" @@ -833,7 +830,6 @@ msgid "Roughly equivalent to::" msgstr "大致相當於: ::" #: ../../library/functools.rst:474 -#, fuzzy msgid "" "initial_missing = object()\n" "\n" @@ -849,7 +845,7 @@ msgid "" msgstr "" "initial_missing = object()\n" "\n" -"def reduce(function, iterable, initial=initial_missing, /):\n" +"def reduce(function, iterable, /, initial=initial_missing):\n" " it = iter(iterable)\n" " if initial is initial_missing:\n" " value = next(it)\n" @@ -944,9 +940,8 @@ msgstr "" "... print(i, elem)" #: ../../library/functools.rst:529 -#, fuzzy msgid ":class:`typing.Union` can also be used::" -msgstr "也可以使用 :data:`types.UnionType` 和 :data:`typing.Union`: ::" +msgstr "也可以使用 :data:`typing.Union`: ::" #: ../../library/functools.rst:531 msgid "" @@ -1223,11 +1218,10 @@ msgid "" msgstr ":func:`~singledispatch.register` 屬性現在支援使用型別註釋。" #: ../../library/functools.rst:664 -#, fuzzy msgid "" "The :func:`~singledispatch.register` attribute now " "supports :class:`typing.Union` as a type annotation." -msgstr ":func:`~singledispatch.register` 屬性現在支援使用型別註釋。" +msgstr ":func:`~singledispatch.register` 屬性現在支援使用 :class:`typing.Union` 型別註釋。" #: ../../library/functools.rst:671 msgid "" @@ -1494,7 +1488,6 @@ msgid "" msgstr "呼叫 :class:`partial` 物件時將提供的關鍵字引數。" #: ../../library/functools.rst:825 -#, fuzzy msgid "" ":class:`partial` objects are like :ref:`function objects ` in that they are callable, weak referenceable, and can have " @@ -1503,15 +1496,6 @@ msgid "" "are not created automatically." msgstr "" ":class:`partial` 物件與\\ :ref:`函式物件 `\\ 類似,因為它" -"們是可呼叫的、可弱參照的 (weak referencable) 且可以具有屬性。有一些重要的區" -"別,例如,:attr:`~function.__name__` 和 :attr:`function.__doc__` 屬性不會自動" -"建立。此外,類別中定義的 :class:`partial` 物件的行為類似於靜態方法,並且在實" -"例屬性查找期間不會轉換為繫結方法。" - -#~ msgid "" -#~ "The :func:`~singledispatch.register` attribute now " -#~ "supports :data:`types.UnionType` and :data:`typing.Union` as type " -#~ "annotations." -#~ msgstr "" -#~ ":func:`~singledispatch.register` 屬性現在支援以 :data:`types.UnionType` " -#~ "和 :data:`typing.Union` 作為型別註釋。" +"們是可呼叫的、可弱參照的 (weak referencable) 且可以具有屬性的。但有一些重要的區" +"別,例如,:attr:`~definition.__name__` 和 :attr:`~definition.__doc__` 屬性不會自動" +"建立。" diff --git a/library/gc.po b/library/gc.po index 62e6600b51a..9d53e9812a8 100644 --- a/library/gc.po +++ b/library/gc.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-04-24 21:25+0800\n" @@ -63,23 +63,21 @@ msgid "Return ``True`` if automatic collection is enabled." msgstr "如果啟用了自動回收則回傳 ``True``。" #: ../../library/gc.rst:43 -#, fuzzy msgid "" "Perform a collection. The optional argument *generation* may be an integer " "specifying which generation to collect (from 0 to 2). A :exc:`ValueError` " "is raised if the generation number is invalid. The sum of collected objects " "and uncollectable objects is returned." msgstr "" -"若被呼叫時沒有引數,則啟動完整垃圾回收。可選的引數 *generation* 可以是一個指" -"明需要回收哪一代垃圾的整數(從 0 到 2)。當引數 *generation* 無效時,會引" -"發 :exc:`ValueError` 例外。發現的不可達物件數目會被回傳。" +"啟動垃圾回收。可選的引數 *generation* 可以是一個指" +"明需要回收哪一代垃圾的整數(從 0 到 2)。當 generation 數值無效時,會引" +"發 :exc:`ValueError` 例外。可回收物件與不可回收物件的總和會被回傳。" #: ../../library/gc.rst:48 -#, fuzzy msgid "" "Calling ``gc.collect(0)`` will perform a GC collection on the young " "generation." -msgstr "當直譯器已經執行收集時呼叫 ``gc.collect()`` 的效果是未定義的。" +msgstr "" #: ../../library/gc.rst:50 msgid "" @@ -127,28 +125,25 @@ msgid "Return the debugging flags currently set." msgstr "回傳目前設置的除錯旗標。" #: ../../library/gc.rst:82 -#, fuzzy msgid "" "Returns a list of all objects tracked by the collector, excluding the list " "returned. If *generation* is not ``None``, return only the objects as " "follows:" msgstr "" "回傳一個包含回收器正在追蹤的所有物件的 list,除去所回傳的 list。如果 " -"*generation* 不為 ``None``,只回傳回收器正在追蹤且屬於該代的物件。" +"*generation* 不為 ``None``,只回傳以下物件。" #: ../../library/gc.rst:85 -#, fuzzy msgid "0: All objects in the young generation" -msgstr "回傳永久代中的物件數量。" +msgstr "0: 年輕代中的所有物件。" #: ../../library/gc.rst:86 msgid "1: No objects, as there is no generation 1 (as of Python 3.14)" -msgstr "" +msgstr "1: 沒有物件,因為不存在第 1 代(截至 Python 3.14)" #: ../../library/gc.rst:87 -#, fuzzy msgid "2: All objects in the old generation" -msgstr "回傳永久代中的物件數量。" +msgstr "2: 年老代中的所有物件。" #: ../../library/gc.rst:89 msgid "New *generation* parameter." @@ -342,7 +337,6 @@ msgstr "" "只含有原子性的鍵和值的字典)上的足跡: ::" #: ../../library/gc.rst:203 -#, fuzzy msgid "" ">>> gc.is_tracked(0)\n" "False\n" @@ -364,8 +358,6 @@ msgstr "" ">>> gc.is_tracked({})\n" "False\n" ">>> gc.is_tracked({\"a\": 1})\n" -"False\n" -">>> gc.is_tracked({\"a\": []})\n" "True" #: ../../library/gc.rst:219 diff --git a/library/getopt.po b/library/getopt.po index 3326714d586..d96dc477a0e 100644 --- a/library/getopt.po +++ b/library/getopt.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2016-01-31 07:19+0000\n" @@ -214,7 +214,6 @@ msgid "Optional arguments should be specified explicitly:" msgstr "" #: ../../library/getopt.rst:147 -#, fuzzy msgid "" ">>> s = '-Con -C --color=off --color a1 a2'\n" ">>> args = s.split()\n" @@ -226,13 +225,13 @@ msgid "" ">>> args\n" "['a1', 'a2']" msgstr "" -">>> import getopt\n" -">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" +">>> s = '-Con -C --color=off --color a1 a2'\n" +">>> args = s.split()\n" ">>> args\n" -"['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']\n" -">>> optlist, args = getopt.getopt(args, 'abc:d:')\n" +"['-Con', '-C', '--color=off', '--color', 'a1', 'a2']\n" +">>> optlist, args = getopt.getopt(args, 'C::', ['color=?'])\n" ">>> optlist\n" -"[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]\n" +"[('-C', 'on'), ('-C', ''), ('--color', 'off'), ('--color', '')]\n" ">>> args\n" "['a1', 'a2']" @@ -241,7 +240,6 @@ msgid "The order of options and non-option arguments can be preserved:" msgstr "" #: ../../library/getopt.rst:161 -#, fuzzy msgid "" ">>> s = 'a1 -x a2 a3 a4 --long a5 a6'\n" ">>> args = s.split()\n" @@ -253,15 +251,15 @@ msgid "" ">>> args\n" "['a6']" msgstr "" -">>> import getopt\n" -">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" +">>> s = 'a1 -x a2 a3 a4 --long a5 a6'\n" +">>> args = s.split()\n" ">>> args\n" -"['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']\n" -">>> optlist, args = getopt.getopt(args, 'abc:d:')\n" +"['a1', '-x', 'a2', 'a3', 'a4', '--long', 'a5', 'a6']\n" +">>> optlist, args = getopt.gnu_getopt(args, '-x:', ['long='])\n" ">>> optlist\n" -"[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]\n" +"[(None, ['a1']), ('-x', 'a2'), (None, ['a3', 'a4']), ('--long', 'a5')]\n" ">>> args\n" -"['a1', 'a2']" +"['a6']" #: ../../library/getopt.rst:173 msgid "In a script, typical usage is something like this:" diff --git a/library/getpass.po b/library/getpass.po index 8329e99e6c6..706e6b8c265 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,9 +6,9 @@ # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\n" "PO-Revision-Date: 2022-02-11 12:04+0800\n" "Last-Translator: Weilin Du\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -84,19 +84,28 @@ msgstr "" "如果你從 IDLE 內部呼叫 getpass,輸入可能會在你啟動 IDLE 的終端機中完成,而非" "在 IDLE 視窗中。" -#: ../../library/getpass.rst:42 +#: ../../library/getpass.rst:43 +msgid "" +"On Unix systems, when *echo_char* is set, the terminal will be configured to " +"operate in :manpage:`noncanonical mode " +"`. In particular, this means " +"that line editing shortcuts such as :kbd:`Ctrl+U` will not work and may " +"insert unexpected characters into the input." +msgstr "" + +#: ../../library/getpass.rst:50 msgid "Added the *echo_char* parameter for keyboard feedback." msgstr "" -#: ../../library/getpass.rst:47 +#: ../../library/getpass.rst:55 msgid "A :exc:`UserWarning` subclass issued when password input may be echoed." msgstr "當密碼輸入可能被回音時會發出的 :exc:`UserWarning` 子類別。" -#: ../../library/getpass.rst:52 +#: ../../library/getpass.rst:60 msgid "Return the \"login name\" of the user." msgstr "回傳使用者的\"登入名稱\"。" -#: ../../library/getpass.rst:54 +#: ../../library/getpass.rst:62 msgid "" "This function checks the environment " "variables :envvar:`LOGNAME`, :envvar:`USER`, :envvar:`!LNAME` " @@ -110,10 +119,10 @@ msgstr "" "設定,則在支援 :mod:`pwd` 模組的系統上將會回傳來自密碼資料庫的登入名稱,否則" "將引發一個 :exc:`OSError` 例外。" -#: ../../library/getpass.rst:61 +#: ../../library/getpass.rst:69 msgid "In general, this function should be preferred over :func:`os.getlogin`." msgstr "大部分情況下,此函式應該要比 :func:`os.getlogin` 優先使用。" -#: ../../library/getpass.rst:63 +#: ../../library/getpass.rst:71 msgid "Previously, various exceptions beyond just :exc:`OSError` were raised." msgstr "在過去,除了 :exc:`OSError` 外還會引發各種例外。" diff --git a/library/gettext.po b/library/gettext.po index 3c6b357a303..bc20d1e31f4 100644 --- a/library/gettext.po +++ b/library/gettext.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" diff --git a/library/glob.po b/library/glob.po index 0bdd842e894..6eba211699a 100644 --- a/library/glob.po +++ b/library/glob.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-01-24 01:21+0800\n" diff --git a/library/graphlib.po b/library/graphlib.po index 13d0b1c9392..7f1227d59fc 100644 --- a/library/graphlib.po +++ b/library/graphlib.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-01-04 16:35+0800\n" diff --git a/library/grp.po b/library/grp.po index cb3b4333c2d..8c5ae5e20d3 100644 --- a/library/grp.po +++ b/library/grp.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2025-06-28 17:17+0800\n" diff --git a/library/gzip.po b/library/gzip.po index 353c4c69890..ef7e20773d4 100644 --- a/library/gzip.po +++ b/library/gzip.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Adrian Liaw , 2018 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" diff --git a/library/hashlib.po b/library/hashlib.po index 358886b4334..9c32394b8f0 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-04-24 05:58+0000\n" "PO-Revision-Date: 2024-05-11 16:03+0800\n" diff --git a/library/heapq.po b/library/heapq.po index 85e8229e23d..9808eef359b 100644 --- a/library/heapq.po +++ b/library/heapq.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # 周 忠毅 , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-07-01 18:20+0800\n" @@ -37,17 +37,15 @@ msgstr "" "queue) 演算法。" #: ../../library/heapq.rst:19 -#, fuzzy msgid "" "Min-heaps are binary trees for which every parent node has a value less than " "or equal to any of its children. We refer to this condition as the heap " "invariant." msgstr "" -"Heap(堆積)是一顆二元樹,樹上所有父節點的值都小於等於他的子節點的值,我們將" -"這種情況稱為堆積的性質不變。" +"最小堆積 (min-heap) 是一顆二元樹,樹上每個父節點的值都小於或等於其子節點的值。" +"我們將這種情況稱為堆積性質不變 (heap invariant)。" #: ../../library/heapq.rst:23 -#, fuzzy msgid "" "For min-heaps, this implementation uses lists for which ``heap[k] <= " "heap[2*k+1]`` and ``heap[k] <= heap[2*k+2]`` for all *k* for which the " @@ -55,9 +53,10 @@ msgid "" "property of a min-heap is that its smallest element is always the root, " "``heap[0]``." msgstr "" -"使用陣列實作,對於所有從0開始的 *k* 都滿足 ``heap[k] <= heap[2*k+1]`` 和 " -"``heap[k] <= heap[2*k+2]`` 。為了比較節點的值,不存在的元素被視為無限大。" -"heap 存在一個有趣的性質:樹上最小的元素永遠會在根節點 ``heap[0]`` 上。" +"對於最小堆積,此實作使用串列,對於所有存在的被比較元素,*k* 都滿足 " +"``heap[k] <= heap[2*k+1]`` 和 ``heap[k] <= heap[2*k+2]``。" +"元素是從零開始計數。最小堆積有一個有趣的性質:最小的元素永遠在根節點 " +"``heap[0]``。" #: ../../library/heapq.rst:29 msgid "" @@ -70,7 +69,6 @@ msgid "" msgstr "" #: ../../library/heapq.rst:36 -#, fuzzy msgid "" "The :mod:`!heapq` API differs from textbook heap algorithms in two aspects: " "(a) We use zero-based indexing. This makes the relationship between the " @@ -80,21 +78,20 @@ msgid "" "implementation favors min-heaps as they better correspond to " "Python :class:`lists `." msgstr "" -"下方的 API 跟一般教科書的 heap queue 演算法有兩個方面不同:第一,我們的索引" -"從 0 開始計算,這會父節點與子節點之間的關係產生很微小的差異,但更符合 Python " -"從 0 開始索引的設計。第二,我們的 pop 方法會回傳最小的元素而不是最大的元素 " -"( 在教科書中被稱作 \"min heap\",而 \"max heap\" 因為他很適合做原地排序,所" -"以更常出現在教科書中 )。" +":mod:`!heapq` API 與教科書上的堆積演算法在兩個方面不同:" +"(a) 我們使用從零開始的索引。這使得節點索引和其子節點索引之間的關係變得" +"不那麼明顯,但由於 Python 使用從零開始的索引,所以這樣更適合。" +"(b) 教科書通常專注於最大堆積,因為它們適合原地排序。我們的實作偏向於" +"最小堆積,因為它們更符合 Python :class:`串列 `。" #: ../../library/heapq.rst:43 -#, fuzzy msgid "" "These two aspects make it possible to view the heap as a regular Python list " "without surprises: ``heap[0]`` is the smallest item, and ``heap.sort()`` " "maintains the heap invariant!" msgstr "" -"這兩個特性使得把 heap 當作一個標準的 Python list 檢視時不會出現意外:" -"``heap[0]`` 是最小的物件,``heap.sort()`` 能保持 heap 的性質不變!" +"這兩個特性使得可以將堆積視為一個普通的 Python 串列而不會有意外:" +"``heap[0]`` 是最小的元素,而 ``heap.sort()`` 維持堆積性質不變!" #: ../../library/heapq.rst:47 msgid "" @@ -110,35 +107,31 @@ msgid "" msgstr "" #: ../../library/heapq.rst:54 -#, fuzzy msgid "" "To create a heap, use a list initialized as ``[]``, or transform an existing " "list into a min-heap or max-heap using the :func:`heapify` " "or :func:`heapify_max` functions, respectively." msgstr "" -"建立一個 heap 可以使用 list 初始化為 ``[]``,或者使用函式 :func:`heapify` 將" -"一個已經有元素的 list轉成一個 heap。" +"要建立一個堆積,使用初始化為 ``[]`` 的串列,或者分別使用 :func:`heapify` " +"或 :func:`heapify_max` 函式將現有的串列轉換為最小堆積或最大堆積。" #: ../../library/heapq.rst:58 -#, fuzzy msgid "The following functions are provided for min-heaps:" -msgstr "此模組提供下面的函式" +msgstr "提供了以下針對最小堆積的函式:" #: ../../library/heapq.rst:63 -#, fuzzy msgid "" "Push the value *item* onto the *heap*, maintaining the min-heap invariant." -msgstr "把 *item* 放進 *heap*,並保持 heap 性質不變。" +msgstr "將值 *item* 推入 *heap*,並維持最小堆積性質不變。" #: ../../library/heapq.rst:68 -#, fuzzy msgid "" "Pop and return the smallest item from the *heap*, maintaining the min-heap " "invariant. If the heap is empty, :exc:`IndexError` is raised. To access " "the smallest item without popping it, use ``heap[0]``." msgstr "" -"從 *heap* 取出並回傳最小的元素,同時保持 heap 性質不變。如果 heap 是空的會產" -"生 :exc:`IndexError` 錯誤。只存取最小元素但不取出可以使用 ``heap[0]`` 。" +"從 *heap* 取出並回傳最小的元素,維持最小堆積性質不變。如果堆積為空," +"會引發 :exc:`IndexError`。若要在不取出的情況下存取最小元素,請使用 ``heap[0]``。" #: ../../library/heapq.rst:75 msgid "" @@ -150,9 +143,8 @@ msgstr "" "叫 :func:`heappush` 之後呼叫 :func:`heappop` 更有效率。" #: ../../library/heapq.rst:82 -#, fuzzy msgid "Transform list *x* into a min-heap, in-place, in linear time." -msgstr "在線性時間內將 list *x* 轉為 heap,且過程不會申請額外記憶體。" +msgstr "在線性時間內將串列 *x* 原地轉換為最小堆積。" #: ../../library/heapq.rst:87 msgid "" @@ -186,51 +178,45 @@ msgstr "" "那個,並將大的留在 heap 內。" #: ../../library/heapq.rst:101 -#, fuzzy msgid "For max-heaps, the following functions are provided:" -msgstr "此模組提供下面的函式" +msgstr "提供以下針對最大堆積的函式:" #: ../../library/heapq.rst:106 -#, fuzzy msgid "Transform list *x* into a max-heap, in-place, in linear time." -msgstr "在線性時間內將 list *x* 轉為 heap,且過程不會申請額外記憶體。" +msgstr "在線性時間內將串列 *x* 原地轉換為最大堆積。" #: ../../library/heapq.rst:113 -#, fuzzy msgid "" "Push the value *item* onto the max-heap *heap*, maintaining the max-heap " "invariant." -msgstr "把 *item* 放進 *heap*,並保持 heap 性質不變。" +msgstr "將值 *item* 推入最大堆積 *heap*,維持最大堆積性質不變。" #: ../../library/heapq.rst:121 -#, fuzzy msgid "" "Pop and return the largest item from the max-heap *heap*, maintaining the " "max-heap invariant. If the max-heap is empty, :exc:`IndexError` is raised. " "To access the largest item without popping it, use ``maxheap[0]``." msgstr "" -"從 *heap* 取出並回傳最小的元素,同時保持 heap 性質不變。如果 heap 是空的會產" -"生 :exc:`IndexError` 錯誤。只存取最小元素但不取出可以使用 ``heap[0]`` 。" +"從最大堆積 *heap* 取出並回傳最大的元素,維持最大堆積性質不變。如果最大堆積為空," +"會引發 :exc:`IndexError`。若要在不取出的情況下存取最大元素,請使用 ``maxheap[0]``。" #: ../../library/heapq.rst:130 -#, fuzzy msgid "" "Push *item* on the max-heap *heap*, then pop and return the largest item " "from *heap*. The combined action runs more efficiently " "than :func:`heappush_max` followed by a separate call to :func:`heappop_max`." msgstr "" -"將 *item* 放入 heap ,接著從 *heap* 取出並回傳最小的元素。這個組合函式比呼" -"叫 :func:`heappush` 之後呼叫 :func:`heappop` 更有效率。" +"將 *item* 推入 max-heap *heap*,然後取出並回傳 *heap* 中最大的元素。" +"這個組合動作比先呼叫 :func:`heappush_max` 再單獨呼叫 :func:`heappop_max` 更有效率。" #: ../../library/heapq.rst:140 -#, fuzzy msgid "" "Pop and return the largest item from the max-heap *heap* and also push the " "new *item*. The max-heap size doesn't change. If the max-heap is " "empty, :exc:`IndexError` is raised." msgstr "" -"從 *heap* 取出並回傳最小的元素,接著將新的 *item* 放進heap。heap 的大小不會改" -"變。如果 heap 是空的會產生 :exc:`IndexError` 錯誤。" +"從最大堆積 *heap* 取出並回傳最大的元素,同時推入新的 *item*。" +"最大堆積的大小不會改變。如果最大堆積為空,會引發 :exc:`IndexError`。" #: ../../library/heapq.rst:145 msgid "" diff --git a/library/hmac.po b/library/hmac.po index dfd8a8d4d69..15f3869b86c 100644 --- a/library/hmac.po +++ b/library/hmac.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-04 00:15+0000\n" "PO-Revision-Date: 2022-03-30 00:16+0800\n" diff --git a/library/html.entities.po b/library/html.entities.po index 1131e507aa2..4f108d3e57c 100644 --- a/library/html.entities.po +++ b/library/html.entities.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-06-27 09:38+0800\n" diff --git a/library/html.parser.po b/library/html.parser.po index da6a091b3e8..a054929fb1a 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-05-08 00:15+0000\n" "PO-Revision-Date: 2023-05-04 22:54+0800\n" diff --git a/library/html.po b/library/html.po index a8f42a99738..52907a6a55b 100644 --- a/library/html.po +++ b/library/html.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/http.client.po b/library/http.client.po index c3e3da13b68..27cb45904bc 100644 --- a/library/http.client.po +++ b/library/http.client.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" diff --git a/library/http.cookiejar.po b/library/http.cookiejar.po index fdbe6b46e92..81e266d64ed 100644 --- a/library/http.cookiejar.po +++ b/library/http.cookiejar.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-06 07:38+0000\n" "PO-Revision-Date: 2025-06-28 00:56+0800\n" diff --git a/library/http.cookies.po b/library/http.cookies.po index c9aeb1e8e3c..a464d0750d8 100644 --- a/library/http.cookies.po +++ b/library/http.cookies.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-12-24 18:49+0800\n" @@ -281,9 +281,8 @@ msgid "Added support for the :attr:`samesite` attribute." msgstr "新增對 :attr:`samesite` 屬性的支援。" #: ../../library/http.cookies.rst:185 -#, fuzzy msgid "Added support for the :attr:`partitioned` attribute." -msgstr "新增對 :attr:`samesite` 屬性的支援。" +msgstr "新增對 :attr:`partitioned` 屬性的支援。" #: ../../library/http.cookies.rst:191 msgid "The value of the cookie." diff --git a/library/http.po b/library/http.po index 72639c5787c..e2e24bae355 100644 --- a/library/http.po +++ b/library/http.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" @@ -144,9 +144,8 @@ msgid "``CONTINUE``" msgstr "``CONTINUE``" #: ../../library/http.rst:62 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.2.1" -msgstr "HTTP/1.1 :rfc:`7231`,6.2.1 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.2.1" #: ../../library/http.rst:63 msgid "``101``" @@ -157,9 +156,8 @@ msgid "``SWITCHING_PROTOCOLS``" msgstr "``SWITCHING_PROTOCOLS``" #: ../../library/http.rst:63 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.2.2" -msgstr "HTTP/1.1 :rfc:`7231`,6.2.2 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.2.2" #: ../../library/http.rst:64 msgid "``102``" @@ -194,9 +192,8 @@ msgid "``OK``" msgstr "``OK``" #: ../../library/http.rst:66 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.3.1" -msgstr "HTTP/1.1 :rfc:`7231`,6.3.1 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.3.1" #: ../../library/http.rst:67 msgid "``201``" @@ -207,9 +204,8 @@ msgid "``CREATED``" msgstr "``CREATED``" #: ../../library/http.rst:67 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.3.2" -msgstr "HTTP/1.1 :rfc:`7231`,6.3.2 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.3.2" #: ../../library/http.rst:68 msgid "``202``" @@ -220,9 +216,8 @@ msgid "``ACCEPTED``" msgstr "``ACCEPTED``" #: ../../library/http.rst:68 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.3.3" -msgstr "HTTP/1.1 :rfc:`7231`,6.3.3 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.3.3" #: ../../library/http.rst:69 msgid "``203``" @@ -233,9 +228,8 @@ msgid "``NON_AUTHORITATIVE_INFORMATION``" msgstr "``NON_AUTHORITATIVE_INFORMATION``" #: ../../library/http.rst:69 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.3.4" -msgstr "HTTP/1.1 :rfc:`7231`,6.3.4 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.3.4" #: ../../library/http.rst:70 msgid "``204``" @@ -246,9 +240,8 @@ msgid "``NO_CONTENT``" msgstr "``NO_CONTENT``" #: ../../library/http.rst:70 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.3.5" -msgstr "HTTP/1.1 :rfc:`7231`,6.3.5 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.3.5" #: ../../library/http.rst:71 msgid "``205``" @@ -259,9 +252,8 @@ msgid "``RESET_CONTENT``" msgstr "``RESET_CONTENT``" #: ../../library/http.rst:71 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.3.6" -msgstr "HTTP/1.1 :rfc:`7231`,6.3.6 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.3.6" #: ../../library/http.rst:72 msgid "``206``" @@ -272,9 +264,8 @@ msgid "``PARTIAL_CONTENT``" msgstr "``PARTIAL_CONTENT``" #: ../../library/http.rst:72 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.3.7" -msgstr "HTTP/1.1 :rfc:`7231`,4.3.7 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.3.7" #: ../../library/http.rst:73 msgid "``207``" @@ -321,9 +312,8 @@ msgid "``MULTIPLE_CHOICES``" msgstr "``MULTIPLE_CHOICES``" #: ../../library/http.rst:76 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.4.1" -msgstr "HTTP/1.1 :rfc:`7231`,6.4.1 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.4.1" #: ../../library/http.rst:77 msgid "``301``" @@ -334,9 +324,8 @@ msgid "``MOVED_PERMANENTLY``" msgstr "``MOVED_PERMANENTLY``" #: ../../library/http.rst:77 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.4.2" -msgstr "HTTP/1.1 :rfc:`7231`,6.4.2 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.4.2" #: ../../library/http.rst:78 msgid "``302``" @@ -347,9 +336,8 @@ msgid "``FOUND``" msgstr "``FOUND``" #: ../../library/http.rst:78 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.4.3" -msgstr "HTTP/1.1 :rfc:`7231`,6.4.3 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.4.3" #: ../../library/http.rst:79 msgid "``303``" @@ -360,9 +348,8 @@ msgid "``SEE_OTHER``" msgstr "``SEE_OTHER``" #: ../../library/http.rst:79 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.4.4" -msgstr "HTTP/1.1 :rfc:`7231`,6.4.4 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.4.4" #: ../../library/http.rst:80 msgid "``304``" @@ -373,9 +360,8 @@ msgid "``NOT_MODIFIED``" msgstr "``NOT_MODIFIED``" #: ../../library/http.rst:80 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.4.5" -msgstr "HTTP/1.1 :rfc:`7231`,6.4.5 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.4.5" #: ../../library/http.rst:81 msgid "``305``" @@ -386,9 +372,8 @@ msgid "``USE_PROXY``" msgstr "``USE_PROXY``" #: ../../library/http.rst:81 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.4.6" -msgstr "HTTP/1.1 :rfc:`7231`,6.3.6 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.4.6" #: ../../library/http.rst:82 msgid "``307``" @@ -399,9 +384,8 @@ msgid "``TEMPORARY_REDIRECT``" msgstr "``TEMPORARY_REDIRECT``" #: ../../library/http.rst:82 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.4.8" -msgstr "HTTP/1.1 :rfc:`7231`,6.4.1 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.4.8" #: ../../library/http.rst:83 msgid "``308``" @@ -412,9 +396,8 @@ msgid "``PERMANENT_REDIRECT``" msgstr "``PERMANENT_REDIRECT``" #: ../../library/http.rst:83 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.4.9" -msgstr "HTTP/1.1 :rfc:`7231`,6.4.1 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.4.9" #: ../../library/http.rst:84 msgid "``400``" @@ -425,9 +408,8 @@ msgid "``BAD_REQUEST``" msgstr "``BAD_REQUEST``" #: ../../library/http.rst:84 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.1" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.1 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.1" #: ../../library/http.rst:85 msgid "``401``" @@ -438,9 +420,8 @@ msgid "``UNAUTHORIZED``" msgstr "``UNAUTHORIZED``" #: ../../library/http.rst:85 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.2" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.2" #: ../../library/http.rst:86 msgid "``402``" @@ -451,9 +432,8 @@ msgid "``PAYMENT_REQUIRED``" msgstr "``PAYMENT_REQUIRED``" #: ../../library/http.rst:86 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.3" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.3 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.3" #: ../../library/http.rst:87 msgid "``403``" @@ -464,9 +444,8 @@ msgid "``FORBIDDEN``" msgstr "``FORBIDDEN``" #: ../../library/http.rst:87 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.4" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.4 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.4" #: ../../library/http.rst:88 msgid "``404``" @@ -477,9 +456,8 @@ msgid "``NOT_FOUND``" msgstr "``NOT_FOUND``" #: ../../library/http.rst:88 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.5" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.5 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.5" #: ../../library/http.rst:89 msgid "``405``" @@ -490,9 +468,8 @@ msgid "``METHOD_NOT_ALLOWED``" msgstr "``METHOD_NOT_ALLOWED``" #: ../../library/http.rst:89 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.6" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.6 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.6" #: ../../library/http.rst:90 msgid "``406``" @@ -503,9 +480,8 @@ msgid "``NOT_ACCEPTABLE``" msgstr "``NOT_ACCEPTABLE``" #: ../../library/http.rst:90 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.7" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.7 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.7" #: ../../library/http.rst:91 msgid "``407``" @@ -516,9 +492,8 @@ msgid "``PROXY_AUTHENTICATION_REQUIRED``" msgstr "``PROXY_AUTHENTICATION_REQUIRED``" #: ../../library/http.rst:91 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.8" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.8 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.8" #: ../../library/http.rst:92 msgid "``408``" @@ -529,9 +504,8 @@ msgid "``REQUEST_TIMEOUT``" msgstr "``REQUEST_TIMEOUT``" #: ../../library/http.rst:92 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.9" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.9 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.9" #: ../../library/http.rst:93 msgid "``409``" @@ -542,9 +516,8 @@ msgid "``CONFLICT``" msgstr "``CONFLICT``" #: ../../library/http.rst:93 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.10" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.10 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.10" #: ../../library/http.rst:94 msgid "``410``" @@ -555,9 +528,8 @@ msgid "``GONE``" msgstr "``GONE``" #: ../../library/http.rst:94 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.11" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.11 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.11" #: ../../library/http.rst:95 msgid "``411``" @@ -568,9 +540,8 @@ msgid "``LENGTH_REQUIRED``" msgstr "``LENGTH_REQUIRED``" #: ../../library/http.rst:95 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.12" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.12 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.12" #: ../../library/http.rst:96 msgid "``412``" @@ -581,9 +552,8 @@ msgid "``PRECONDITION_FAILED``" msgstr "``PRECONDITION_FAILED``" #: ../../library/http.rst:96 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.13" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.13 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.13" #: ../../library/http.rst:97 msgid "``413``" @@ -594,9 +564,8 @@ msgid "``CONTENT_TOO_LARGE``" msgstr "``CONTENT_TOO_LARGE``" #: ../../library/http.rst:97 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.14" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.14 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.14" #: ../../library/http.rst:98 msgid "``414``" @@ -607,9 +576,8 @@ msgid "``URI_TOO_LONG``" msgstr "``URI_TOO_LONG``" #: ../../library/http.rst:98 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.15" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.15 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.15" #: ../../library/http.rst:99 msgid "``415``" @@ -620,9 +588,8 @@ msgid "``UNSUPPORTED_MEDIA_TYPE``" msgstr "``UNSUPPORTED_MEDIA_TYPE``" #: ../../library/http.rst:99 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.16" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.1 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.16" #: ../../library/http.rst:100 msgid "``416``" @@ -633,9 +600,8 @@ msgid "``RANGE_NOT_SATISFIABLE``" msgstr "``RANGE_NOT_SATISFIABLE``" #: ../../library/http.rst:100 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.17" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.1 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.17" #: ../../library/http.rst:101 msgid "``417``" @@ -646,9 +612,8 @@ msgid "``EXPECTATION_FAILED``" msgstr "``EXPECTATION_FAILED``" #: ../../library/http.rst:101 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.18" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.1 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.18" #: ../../library/http.rst:102 msgid "``418``" @@ -671,23 +636,20 @@ msgid "``MISDIRECTED_REQUEST``" msgstr "``MISDIRECTED_REQUEST``" #: ../../library/http.rst:103 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.20" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.20" #: ../../library/http.rst:104 msgid "``422``" msgstr "``422``" #: ../../library/http.rst:104 -#, fuzzy msgid "``UNPROCESSABLE_CONTENT``" -msgstr "``UNPROCESSABLE_ENTITY``" +msgstr "``UNPROCESSABLE_CONTENT``" #: ../../library/http.rst:104 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.21" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.21" #: ../../library/http.rst:105 msgid "``423``" @@ -734,9 +696,8 @@ msgid "``UPGRADE_REQUIRED``" msgstr "``UPGRADE_REQUIRED``" #: ../../library/http.rst:108 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.5.22" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.5.22" #: ../../library/http.rst:109 msgid "``428``" @@ -788,9 +749,8 @@ msgid "``INTERNAL_SERVER_ERROR``" msgstr "``INTERNAL_SERVER_ERROR``" #: ../../library/http.rst:113 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.6.1" -msgstr "HTTP/1.1 :rfc:`7231`,6.6.1 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.6.1" #: ../../library/http.rst:114 msgid "``501``" @@ -801,9 +761,8 @@ msgid "``NOT_IMPLEMENTED``" msgstr "``NOT_IMPLEMENTED``" #: ../../library/http.rst:114 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.6.2" -msgstr "HTTP/1.1 :rfc:`7231`,6.6.2 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.6.2" #: ../../library/http.rst:115 msgid "``502``" @@ -814,9 +773,8 @@ msgid "``BAD_GATEWAY``" msgstr "``BAD_GATEWAY``" #: ../../library/http.rst:115 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.6.3" -msgstr "HTTP/1.1 :rfc:`7231`,6.6.3 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.6.3" #: ../../library/http.rst:116 msgid "``503``" @@ -827,9 +785,8 @@ msgid "``SERVICE_UNAVAILABLE``" msgstr "``SERVICE_UNAVAILABLE``" #: ../../library/http.rst:116 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.6.4" -msgstr "HTTP/1.1 :rfc:`7231`,6.6.4 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.6.4" #: ../../library/http.rst:117 msgid "``504``" @@ -840,9 +797,8 @@ msgid "``GATEWAY_TIMEOUT``" msgstr "``GATEWAY_TIMEOUT``" #: ../../library/http.rst:117 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.6.5" -msgstr "HTTP/1.1 :rfc:`7231`,6.6.5 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.6.5" #: ../../library/http.rst:118 msgid "``505``" @@ -853,9 +809,8 @@ msgid "``HTTP_VERSION_NOT_SUPPORTED``" msgstr "``HTTP_VERSION_NOT_SUPPORTED``" #: ../../library/http.rst:118 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15.6.6" -msgstr "HTTP/1.1 :rfc:`7231`,6.6.6 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15.6.6" #: ../../library/http.rst:119 msgid "``506``" @@ -980,9 +935,8 @@ msgstr "``100 <= status <= 199``" #: ../../library/http.rst:154 ../../library/http.rst:155 #: ../../library/http.rst:156 ../../library/http.rst:157 #: ../../library/http.rst:158 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 15" -msgstr "HTTP/2 :rfc:`7540`,9.1.2 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 15" #: ../../library/http.rst:155 msgid "``is_success``" @@ -1101,72 +1055,64 @@ msgid "``GET``" msgstr "``GET``" #: ../../library/http.rst:210 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 9.3.1" -msgstr "HTTP/1.1 :rfc:`7231`,6.3.1 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.1" #: ../../library/http.rst:211 msgid "``HEAD``" msgstr "``HEAD``" #: ../../library/http.rst:211 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 9.3.2" -msgstr "HTTP/2 :rfc:`7540`,9.1.2 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.2" #: ../../library/http.rst:212 msgid "``POST``" msgstr "``POST``" #: ../../library/http.rst:212 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 9.3.3" -msgstr "HTTP/1.1 :rfc:`7231`,6.3.3 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.3" #: ../../library/http.rst:213 msgid "``PUT``" msgstr "``PUT``" #: ../../library/http.rst:213 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 9.3.4" -msgstr "HTTP/1.1 :rfc:`7231`,6.3.4 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.4" #: ../../library/http.rst:214 msgid "``DELETE``" msgstr "``DELETE``" #: ../../library/http.rst:214 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 9.3.5" -msgstr "HTTP/1.1 :rfc:`7231`,6.3.5 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.5" #: ../../library/http.rst:215 msgid "``CONNECT``" msgstr "``CONNECT``" #: ../../library/http.rst:215 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 9.3.6" -msgstr "HTTP/1.1 :rfc:`7231`,6.3.6 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.6" #: ../../library/http.rst:216 msgid "``OPTIONS``" msgstr "``OPTIONS``" #: ../../library/http.rst:216 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 9.3.7" -msgstr "HTTP/1.1 :rfc:`7231`,4.3.7 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.7" #: ../../library/http.rst:217 msgid "``TRACE``" msgstr "``TRACE``" #: ../../library/http.rst:217 -#, fuzzy msgid "HTTP Semantics :rfc:`9110`, Section 9.3.8" -msgstr "HTTP/1.1 :rfc:`7231`,4.3.8 節" +msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.8" #: ../../library/http.rst:218 msgid "``PATCH``" @@ -1187,51 +1133,3 @@ msgstr "protocol(協定)" #: ../../library/http.rst:9 msgid "http (standard module)" msgstr "http(標準模組)" - -#~ msgid "HTTP/1.1 :rfc:`7233`, Section 4.1" -#~ msgstr "HTTP/1.1 :rfc:`7233`,4.1 節" - -#~ msgid "HTTP/1.1 :rfc:`7232`, Section 4.1" -#~ msgstr "HTTP/1.1 :rfc:`7232`,4.1 節" - -#~ msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.7" -#~ msgstr "HTTP/1.1 :rfc:`7231`,6.4.7 節" - -#~ msgid "Permanent Redirect :rfc:`7238`, Section 3 (Experimental)" -#~ msgstr "永久重定向 :rfc:`7238`,3 節(實驗性)" - -#~ msgid "HTTP/1.1 Authentication :rfc:`7235`, Section 3.1" -#~ msgstr "HTTP/1.1 身分驗證 (Authentication) :rfc:`7235`,3.1 節" - -#~ msgid "HTTP/1.1 Authentication :rfc:`7235`, Section 3.2" -#~ msgstr "HTTP/1.1 身分驗證 :rfc:`7235`,3.2 節" - -#~ msgid "HTTP/1.1 :rfc:`7232`, Section 4.2" -#~ msgstr "HTTP/1.1 :rfc:`7232`,4.2 節" - -#~ msgid "HTTP/1.1 Range Requests :rfc:`7233`, Section 4.4" -#~ msgstr "HTTP/1.1 範圍請求 (Range Requests) :rfc:`7233`,4.4 節" - -#~ msgid "WebDAV :rfc:`4918`, Section 11.2" -#~ msgstr "WebDAV :rfc:`4918`,11.2 節" - -#~ msgid "HTTP/1.1 :rfc:`7231`, Section 6" -#~ msgstr "HTTP/1.1 :rfc:`7231`,6 節" - -#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.1" -#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.1 節" - -#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.2" -#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.2 節" - -#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.3" -#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.3 節" - -#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.4" -#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.4 節" - -#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.5" -#~ msgstr "HTTP/1.1 :rfc:`7231`,6.3.5 節" - -#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.6" -#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.6 節" diff --git a/library/http.server.po b/library/http.server.po index 6829e5a0c18..657c18cda9c 100644 --- a/library/http.server.po +++ b/library/http.server.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" @@ -746,9 +746,8 @@ msgid "Specifies a TLS certificate chain for HTTPS connections::" msgstr "" #: ../../library/http.server.rst:588 -#, fuzzy msgid "python -m http.server --tls-cert fullchain.pem" -msgstr "python -m http.server --cgi" +msgstr "python -m http.server --tls-cert fullchain.pem" #: ../../library/http.server.rst:594 msgid "Specifies a private key file for HTTPS connections." @@ -769,6 +768,10 @@ msgid "" " --tls-key key.pem \\\n" " --tls-password-file password.txt" msgstr "" +"python -m http.server \\\n" +" --tls-cert cert.pem \\\n" +" --tls-key key.pem \\\n" +" --tls-password-file password.txt" #: ../../library/http.server.rst:609 msgid "This option requires `--tls-cert`` to be specified." @@ -829,12 +832,3 @@ msgstr "http.server" #: ../../library/http.server.rst:619 msgid "security" msgstr "security(安全)" - -#~ msgid "Added the ``--bind`` option." -#~ msgstr "新增 ``--bind`` 選項。" - -#~ msgid "Added the ``--directory`` option." -#~ msgstr "新增 ``--directory`` 選項。" - -#~ msgid "Added the ``--protocol`` option." -#~ msgstr "新增 ``--protocol`` 選項。" diff --git a/library/i18n.po b/library/i18n.po index e2fd6fc3c2e..7bfaa7b6647 100644 --- a/library/i18n.po +++ b/library/i18n.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/library/idle.po b/library/idle.po index e68ee42b2fb..3aaf2acd70e 100644 --- a/library/idle.po +++ b/library/idle.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-25 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" @@ -44,7 +44,7 @@ msgid "" "Python shell window (interactive interpreter) with colorizing of code input, " "output, and error messages" msgstr "" -"Python shell window(互動式解譯器)提供有色彩的程式碼輸入、輸出和錯誤訊息" +"Python shell window(互動式直譯器)提供有色彩的程式碼輸入、輸出和錯誤訊息" #: ../../library/idle.rst:29 msgid "" diff --git a/library/imaplib.po b/library/imaplib.po index 33a19495d6a..fb45e859d2c 100644 --- a/library/imaplib.po +++ b/library/imaplib.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" diff --git a/library/imghdr.po b/library/imghdr.po index 3f80af2be52..0aef685a5da 100644 --- a/library/imghdr.po +++ b/library/imghdr.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/imp.po b/library/imp.po index e90534acb99..0983c15a311 100644 --- a/library/imp.po +++ b/library/imp.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index 8fc210ce373..343df65b1c8 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -721,6 +721,8 @@ msgid "" ">>> dist.origin.url\n" "'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl'" msgstr "" +">>> dist.origin.url\n" +"'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl'" #: ../../library/importlib.metadata.rst:456 msgid "The ``.origin`` property was added." @@ -818,7 +820,7 @@ msgstr "" #: ../../library/importlib.metadata.rst:516 msgid "Example" -msgstr "" +msgstr "範例" #: ../../library/importlib.metadata.rst:518 msgid "Imagine a custom finder that loads Python modules from a database::" @@ -835,6 +837,14 @@ msgid "" "\n" "sys.meta_path.append(DatabaseImporter(connect_db(...)))" msgstr "" +"class DatabaseImporter(importlib.abc.MetaPathFinder):\n" +" def __init__(self, db):\n" +" self.db = db\n" +"\n" +" def find_spec(self, fullname, target=None) -> ModuleSpec:\n" +" return self.db.spec_from_name(fullname)\n" +"\n" +"sys.meta_path.append(DatabaseImporter(connect_db(...)))" #: ../../library/importlib.metadata.rst:529 msgid "" @@ -855,6 +865,15 @@ msgid "" " for dist_record in self.db.query_distributions(query):\n" " yield DatabaseDistribution(dist_record)" msgstr "" +"from importlib.metadata import DistributionFinder\n" +"\n" +"class DatabaseImporter(DistributionFinder):\n" +" ...\n" +"\n" +" def find_distributions(self, context=DistributionFinder.Context()):\n" +" query = dict(name=context.name) if context.name else {}\n" +" for dist_record in self.db.query_distributions(query):\n" +" yield DatabaseDistribution(dist_record)" #: ../../library/importlib.metadata.rst:544 msgid "" diff --git a/library/importlib.po b/library/importlib.po index c1c15fb8d5e..03ed501d9f6 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" diff --git a/library/importlib.resources.abc.po b/library/importlib.resources.abc.po index 0f8fe4133b4..786d5f0050e 100644 --- a/library/importlib.resources.abc.po +++ b/library/importlib.resources.abc.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/importlib.resources.po b/library/importlib.resources.po index 89712e7d8a1..dd268a9bdb3 100644 --- a/library/importlib.resources.po +++ b/library/importlib.resources.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/index.po b/library/index.po index 45c84d8fd6a..e386492e795 100644 --- a/library/index.po +++ b/library/index.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-11-10 00:19+0000\n" "PO-Revision-Date: 2021-07-04 22:55+0800\n" diff --git a/library/inspect.po b/library/inspect.po index b821883c2d9..fa571e54255 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -1,13 +1,12 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -315,7 +314,7 @@ msgstr "" #: ../../library/inspect.rst:153 msgid "f_generator" -msgstr "" +msgstr "f_generator" #: ../../library/inspect.rst:153 msgid "" @@ -332,9 +331,8 @@ msgid "tracing function for this frame, or ``None``" msgstr "" #: ../../library/inspect.rst:162 -#, fuzzy msgid "f_trace_lines" -msgstr "f_trace" +msgstr "f_trace_lines" #: ../../library/inspect.rst:162 msgid "" @@ -342,9 +340,8 @@ msgid "" msgstr "" #: ../../library/inspect.rst:167 -#, fuzzy msgid "f_trace_opcodes" -msgstr "f_trace" +msgstr "f_trace_opcodes" #: ../../library/inspect.rst:167 msgid "indicate whether per-opcode events are requested" @@ -647,9 +644,8 @@ msgid "Add ``__builtins__`` attribute to functions." msgstr "新增函式的 ``__builtins__`` 屬性。" #: ../../library/inspect.rst:321 -#, fuzzy msgid "Add ``f_generator`` attribute to frames." -msgstr "新增協程的 ``cr_origin`` 屬性。" +msgstr "新增 ``f_generator`` 屬性到 frame。" #: ../../library/inspect.rst:325 msgid "" @@ -718,9 +714,8 @@ msgid "Return ``True`` if the object is a bound method written in Python." msgstr "" #: ../../library/inspect.rst:389 -#, fuzzy msgid "Return ``True`` if the object is a :term:`package`." -msgstr "如果物件是程式碼,則回傳 ``True``。" +msgstr "如果物件是 :term:`package`,則回傳 ``True``。" #: ../../library/inspect.rst:396 msgid "" @@ -1716,7 +1711,7 @@ msgid "" "This method was previously documented as deprecated in favour " "of :func:`signature` in Python 3.5, but that decision has been reversed in " "order to restore a clearly supported standard interface for single-source " -"Python 2/3 code migrating away from the legacy :func:`getargspec` API." +"Python 2/3 code migrating away from the legacy :func:`!getargspec` API." msgstr "" #: ../../library/inspect.rst:1192 @@ -1844,15 +1839,21 @@ msgstr "" #: ../../library/inspect.rst:1294 msgid "" +"This function may execute arbitrary code contained in annotations. " +"See :ref:`annotationlib-security` for more information." +msgstr "" + +#: ../../library/inspect.rst:1299 +msgid "" "This function is now an alias for :func:`annotationlib.get_annotations`. " "Calling it as ``inspect.get_annotations`` will continue to work." msgstr "" -#: ../../library/inspect.rst:1302 +#: ../../library/inspect.rst:1307 msgid "The interpreter stack" msgstr "直譯器堆疊" -#: ../../library/inspect.rst:1304 +#: ../../library/inspect.rst:1309 msgid "" "Some of the following functions return :class:`FrameInfo` objects. For " "backwards compatibility these objects allow tuple-like operations on all " @@ -1860,95 +1861,95 @@ msgid "" "may be removed in the future." msgstr "" -#: ../../library/inspect.rst:1313 +#: ../../library/inspect.rst:1318 msgid "The :ref:`frame object ` that the record corresponds to." msgstr "" -#: ../../library/inspect.rst:1317 +#: ../../library/inspect.rst:1322 msgid "" "The file name associated with the code being executed by the frame this " "record corresponds to." msgstr "" -#: ../../library/inspect.rst:1322 +#: ../../library/inspect.rst:1327 msgid "" "The line number of the current line associated with the code being executed " "by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1327 +#: ../../library/inspect.rst:1332 msgid "" "The function name that is being executed by the frame this record " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1331 +#: ../../library/inspect.rst:1336 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1336 ../../library/inspect.rst:1375 +#: ../../library/inspect.rst:1341 ../../library/inspect.rst:1380 msgid "" "The index of the current line being executed in the :attr:`code_context` " "list." msgstr "" -#: ../../library/inspect.rst:1340 +#: ../../library/inspect.rst:1345 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1344 +#: ../../library/inspect.rst:1349 msgid "Return a :term:`named tuple` instead of a :class:`tuple`." msgstr "" -#: ../../library/inspect.rst:1347 +#: ../../library/inspect.rst:1352 msgid "" ":class:`!FrameInfo` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1356 +#: ../../library/inspect.rst:1361 msgid "" "The file name associated with the code being executed by the frame this " "traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1361 +#: ../../library/inspect.rst:1366 msgid "" "The line number of the current line associated with the code being executed " "by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1366 +#: ../../library/inspect.rst:1371 msgid "" "The function name that is being executed by the frame this traceback " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1370 +#: ../../library/inspect.rst:1375 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1379 +#: ../../library/inspect.rst:1384 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1384 +#: ../../library/inspect.rst:1389 msgid "" ":class:`!Traceback` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1391 +#: ../../library/inspect.rst:1396 msgid "" "Keeping references to frame objects, as found in the first element of the " "frame records these functions return, can cause your program to create " @@ -1960,7 +1961,7 @@ msgid "" "consumption which occurs." msgstr "" -#: ../../library/inspect.rst:1399 +#: ../../library/inspect.rst:1404 msgid "" "Though the cycle detector will catch these, destruction of the frames (and " "local variables) can be made deterministic by removing the cycle in " @@ -1969,7 +1970,7 @@ msgid "" "example::" msgstr "" -#: ../../library/inspect.rst:1404 +#: ../../library/inspect.rst:1409 msgid "" "def handle_stackframe_without_leak():\n" " frame = inspect.currentframe()\n" @@ -1979,31 +1980,31 @@ msgid "" " del frame" msgstr "" -#: ../../library/inspect.rst:1411 +#: ../../library/inspect.rst:1416 msgid "" "If you want to keep the frame around (for example to print a traceback " "later), you can also break reference cycles by using the :meth:`frame.clear` " "method." msgstr "" -#: ../../library/inspect.rst:1415 +#: ../../library/inspect.rst:1420 msgid "" "The optional *context* argument supported by most of these functions " "specifies the number of lines of context to return, which are centered " "around the current line." msgstr "" -#: ../../library/inspect.rst:1422 +#: ../../library/inspect.rst:1427 msgid "" "Get information about a frame or traceback object. A :class:`Traceback` " "object is returned." msgstr "" -#: ../../library/inspect.rst:1425 +#: ../../library/inspect.rst:1430 msgid "A :class:`Traceback` object is returned instead of a named tuple." msgstr "" -#: ../../library/inspect.rst:1430 +#: ../../library/inspect.rst:1435 msgid "" "Get a list of :class:`FrameInfo` objects for a frame and all outer frames. " "These frames represent the calls that lead to the creation of *frame*. The " @@ -2011,19 +2012,19 @@ msgid "" "represents the outermost call on *frame*'s stack." msgstr "" -#: ../../library/inspect.rst:1435 ../../library/inspect.rst:1450 -#: ../../library/inspect.rst:1476 ../../library/inspect.rst:1491 +#: ../../library/inspect.rst:1440 ../../library/inspect.rst:1455 +#: ../../library/inspect.rst:1481 ../../library/inspect.rst:1496 msgid "" "A list of :term:`named tuples ` ``FrameInfo(frame, filename, " "lineno, function, code_context, index)`` is returned." msgstr "" -#: ../../library/inspect.rst:1440 ../../library/inspect.rst:1455 -#: ../../library/inspect.rst:1481 ../../library/inspect.rst:1496 +#: ../../library/inspect.rst:1445 ../../library/inspect.rst:1460 +#: ../../library/inspect.rst:1486 ../../library/inspect.rst:1501 msgid "A list of :class:`FrameInfo` objects is returned." msgstr "回傳一個 :class:`FrameInfo` 物件串列。" -#: ../../library/inspect.rst:1445 +#: ../../library/inspect.rst:1450 msgid "" "Get a list of :class:`FrameInfo` objects for a traceback's frame and all " "inner frames. These frames represent calls made as a consequence of " @@ -2031,11 +2032,11 @@ msgid "" "represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1460 +#: ../../library/inspect.rst:1465 msgid "Return the frame object for the caller's stack frame." msgstr "" -#: ../../library/inspect.rst:1464 +#: ../../library/inspect.rst:1469 msgid "" "This function relies on Python stack frame support in the interpreter, which " "isn't guaranteed to exist in all implementations of Python. If running in " @@ -2043,14 +2044,14 @@ msgid "" "``None``." msgstr "" -#: ../../library/inspect.rst:1472 +#: ../../library/inspect.rst:1477 msgid "" "Return a list of :class:`FrameInfo` objects for the caller's stack. The " "first entry in the returned list represents the caller; the last entry " "represents the outermost call on the stack." msgstr "" -#: ../../library/inspect.rst:1486 +#: ../../library/inspect.rst:1491 msgid "" "Return a list of :class:`FrameInfo` objects for the stack between the " "current frame and the frame in which an exception currently being handled " @@ -2058,11 +2059,11 @@ msgid "" "entry represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1500 +#: ../../library/inspect.rst:1505 msgid "Fetching attributes statically" msgstr "" -#: ../../library/inspect.rst:1502 +#: ../../library/inspect.rst:1507 msgid "" "Both :func:`getattr` and :func:`hasattr` can trigger code execution when " "fetching or checking for the existence of attributes. Descriptors, like " @@ -2070,20 +2071,20 @@ msgid "" "and :meth:`~object.__getattribute__` may be called." msgstr "" -#: ../../library/inspect.rst:1508 +#: ../../library/inspect.rst:1513 msgid "" "For cases where you want passive introspection, like documentation tools, " "this can be inconvenient. :func:`getattr_static` has the same signature " "as :func:`getattr` but avoids executing code when it fetches attributes." msgstr "" -#: ../../library/inspect.rst:1514 +#: ../../library/inspect.rst:1519 msgid "" "Retrieve attributes without triggering dynamic lookup via the descriptor " "protocol, :meth:`~object.__getattr__` or :meth:`~object.__getattribute__`." msgstr "" -#: ../../library/inspect.rst:1518 +#: ../../library/inspect.rst:1523 msgid "" "Note: this function may not be able to retrieve all attributes that getattr " "can fetch (like dynamically created attributes) and may find attributes that " @@ -2091,27 +2092,27 @@ msgid "" "return descriptors objects instead of instance members." msgstr "" -#: ../../library/inspect.rst:1524 +#: ../../library/inspect.rst:1529 msgid "" "If the instance :attr:`~object.__dict__` is shadowed by another member (for " "example a property) then this function will be unable to find instance " "members." msgstr "" -#: ../../library/inspect.rst:1530 +#: ../../library/inspect.rst:1535 msgid "" ":func:`getattr_static` does not resolve descriptors, for example slot " "descriptors or getset descriptors on objects implemented in C. The " "descriptor object is returned instead of the underlying attribute." msgstr "" -#: ../../library/inspect.rst:1534 +#: ../../library/inspect.rst:1539 msgid "" "You can handle these with code like the following. Note that for arbitrary " "getset descriptors invoking these may trigger code execution::" msgstr "" -#: ../../library/inspect.rst:1538 +#: ../../library/inspect.rst:1543 msgid "" "# example code for resolving the builtin descriptor types\n" "class _foo:\n" @@ -2134,11 +2135,11 @@ msgid "" " pass" msgstr "" -#: ../../library/inspect.rst:1560 +#: ../../library/inspect.rst:1565 msgid "Current State of Generators, Coroutines, and Asynchronous Generators" msgstr "" -#: ../../library/inspect.rst:1562 +#: ../../library/inspect.rst:1567 msgid "" "When implementing coroutine schedulers and for other advanced uses of " "generators, it is useful to determine whether a generator is currently " @@ -2147,32 +2148,32 @@ msgid "" "generator to be determined easily." msgstr "" -#: ../../library/inspect.rst:1570 +#: ../../library/inspect.rst:1575 msgid "Get current state of a generator-iterator." msgstr "" -#: ../../library/inspect.rst:1572 ../../library/inspect.rst:1588 -#: ../../library/inspect.rst:1605 +#: ../../library/inspect.rst:1577 ../../library/inspect.rst:1593 +#: ../../library/inspect.rst:1610 msgid "Possible states are:" msgstr "" -#: ../../library/inspect.rst:1574 +#: ../../library/inspect.rst:1579 msgid "GEN_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1575 +#: ../../library/inspect.rst:1580 msgid "GEN_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1576 +#: ../../library/inspect.rst:1581 msgid "GEN_SUSPENDED: Currently suspended at a yield expression." msgstr "" -#: ../../library/inspect.rst:1577 +#: ../../library/inspect.rst:1582 msgid "GEN_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1583 +#: ../../library/inspect.rst:1588 msgid "" "Get current state of a coroutine object. The function is intended to be " "used with coroutine objects created by :keyword:`async def` functions, but " @@ -2180,23 +2181,23 @@ msgid "" "``cr_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1590 +#: ../../library/inspect.rst:1595 msgid "CORO_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1591 +#: ../../library/inspect.rst:1596 msgid "CORO_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1592 +#: ../../library/inspect.rst:1597 msgid "CORO_SUSPENDED: Currently suspended at an await expression." msgstr "" -#: ../../library/inspect.rst:1593 +#: ../../library/inspect.rst:1598 msgid "CORO_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1599 +#: ../../library/inspect.rst:1604 msgid "" "Get current state of an asynchronous generator object. The function is " "intended to be used with asynchronous iterator objects created " @@ -2205,30 +2206,30 @@ msgid "" "``ag_running`` and ``ag_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1607 +#: ../../library/inspect.rst:1612 msgid "AGEN_CREATED: Waiting to start execution." msgstr "AGEN_CREATED: 等待開始執行。" -#: ../../library/inspect.rst:1608 +#: ../../library/inspect.rst:1613 msgid "AGEN_RUNNING: Currently being executed by the interpreter." msgstr "AGEN_RUNNING: 目前正在被直譯器執行。" -#: ../../library/inspect.rst:1609 +#: ../../library/inspect.rst:1614 msgid "AGEN_SUSPENDED: Currently suspended at a yield expression." msgstr "AGEN_SUSPENDED: 目前於 yield 運算式暫停。" -#: ../../library/inspect.rst:1610 +#: ../../library/inspect.rst:1615 msgid "AGEN_CLOSED: Execution has completed." msgstr "AGEN_CLOSED: 執行已完成。" -#: ../../library/inspect.rst:1614 +#: ../../library/inspect.rst:1619 msgid "" "The current internal state of the generator can also be queried. This is " "mostly useful for testing purposes, to ensure that internal state is being " "updated as expected:" msgstr "" -#: ../../library/inspect.rst:1620 +#: ../../library/inspect.rst:1625 msgid "" "Get the mapping of live local variables in *generator* to their current " "values. A dictionary is returned that maps from variable names to values. " @@ -2236,14 +2237,14 @@ msgid "" "generator, and all the same caveats apply." msgstr "" -#: ../../library/inspect.rst:1625 +#: ../../library/inspect.rst:1630 msgid "" "If *generator* is a :term:`generator` with no currently associated frame, " "then an empty dictionary is returned. :exc:`TypeError` is raised if " "*generator* is not a Python generator object." msgstr "" -#: ../../library/inspect.rst:1631 +#: ../../library/inspect.rst:1636 msgid "" "This function relies on the generator exposing a Python stack frame for " "introspection, which isn't guaranteed to be the case in all implementations " @@ -2251,90 +2252,90 @@ msgid "" "dictionary." msgstr "" -#: ../../library/inspect.rst:1640 +#: ../../library/inspect.rst:1645 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for coroutine objects created by :keyword:`async def` functions." msgstr "" -#: ../../library/inspect.rst:1647 +#: ../../library/inspect.rst:1652 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for asynchronous generator objects created by :keyword:`async def` functions " "which use the :keyword:`yield` statement." msgstr "" -#: ../../library/inspect.rst:1657 +#: ../../library/inspect.rst:1662 msgid "Code Objects Bit Flags" msgstr "" -#: ../../library/inspect.rst:1659 +#: ../../library/inspect.rst:1664 msgid "" "Python code objects have a :attr:`~codeobject.co_flags` attribute, which is " "a bitmap of the following flags:" msgstr "" -#: ../../library/inspect.rst:1664 +#: ../../library/inspect.rst:1669 msgid "The code object is optimized, using fast locals." msgstr "" -#: ../../library/inspect.rst:1668 +#: ../../library/inspect.rst:1673 msgid "" "If set, a new dict will be created for the frame's :attr:`~frame.f_locals` " "when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1673 +#: ../../library/inspect.rst:1678 msgid "The code object has a variable positional parameter (``*args``-like)." msgstr "" -#: ../../library/inspect.rst:1677 +#: ../../library/inspect.rst:1682 msgid "The code object has a variable keyword parameter (``**kwargs``-like)." msgstr "" -#: ../../library/inspect.rst:1681 +#: ../../library/inspect.rst:1686 msgid "The flag is set when the code object is a nested function." msgstr "" -#: ../../library/inspect.rst:1685 +#: ../../library/inspect.rst:1690 msgid "" "The flag is set when the code object is a generator function, i.e. a " "generator object is returned when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1690 +#: ../../library/inspect.rst:1695 msgid "" "The flag is set when the code object is a coroutine function. When the code " "object is executed it returns a coroutine object. See :pep:`492` for more " "details." msgstr "" -#: ../../library/inspect.rst:1698 +#: ../../library/inspect.rst:1703 msgid "" "The flag is used to transform generators into generator-based coroutines. " "Generator objects with this flag can be used in ``await`` expression, and " "can ``yield from`` coroutine objects. See :pep:`492` for more details." msgstr "" -#: ../../library/inspect.rst:1707 +#: ../../library/inspect.rst:1712 msgid "" "The flag is set when the code object is an asynchronous generator function. " "When the code object is executed it returns an asynchronous generator " "object. See :pep:`525` for more details." msgstr "" -#: ../../library/inspect.rst:1715 +#: ../../library/inspect.rst:1720 msgid "" "The flag is set when there is a docstring for the code object in the source " "code. If set, it will be the first item in :attr:`~codeobject.co_consts`." msgstr "" -#: ../../library/inspect.rst:1723 +#: ../../library/inspect.rst:1728 msgid "" "The flag is set when the code object is a function defined in class scope." msgstr "" -#: ../../library/inspect.rst:1729 +#: ../../library/inspect.rst:1734 msgid "" "The flags are specific to CPython, and may not be defined in other Python " "implementations. Furthermore, the flags are an implementation detail, and " @@ -2342,39 +2343,39 @@ msgid "" "use public APIs from the :mod:`inspect` module for any introspection needs." msgstr "" -#: ../../library/inspect.rst:1737 +#: ../../library/inspect.rst:1742 msgid "Buffer flags" msgstr "" -#: ../../library/inspect.rst:1741 +#: ../../library/inspect.rst:1746 msgid "" "This is an :class:`enum.IntFlag` that represents the flags that can be " "passed to the :meth:`~object.__buffer__` method of objects implementing " "the :ref:`buffer protocol `." msgstr "" -#: ../../library/inspect.rst:1745 +#: ../../library/inspect.rst:1750 msgid "The meaning of the flags is explained at :ref:`buffer-request-types`." msgstr "" -#: ../../library/inspect.rst:1772 +#: ../../library/inspect.rst:1777 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/inspect.rst:1774 +#: ../../library/inspect.rst:1779 msgid "" "The :mod:`inspect` module also provides a basic introspection capability " "from the command line." msgstr "" -#: ../../library/inspect.rst:1779 +#: ../../library/inspect.rst:1784 msgid "" "By default, accepts the name of a module and prints the source of that " "module. A class or function within the module can be printed instead by " "appended a colon and the qualified name of the target object." msgstr "" -#: ../../library/inspect.rst:1785 +#: ../../library/inspect.rst:1790 msgid "" "Print information about the specified object rather than the source code" msgstr "" diff --git a/library/internet.po b/library/internet.po index 7df27a1a2af..4a840ed9b01 100644 --- a/library/internet.po +++ b/library/internet.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" "PO-Revision-Date: 2023-08-15 22:14+0800\n" diff --git a/library/intro.po b/library/intro.po index b620131be32..8869ea87567 100644 --- a/library/intro.po +++ b/library/intro.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 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" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2021-10-26 17:01+0800\n" diff --git a/library/io.po b/library/io.po index 17d1920ef56..17f269c3d36 100644 --- a/library/io.po +++ b/library/io.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-12-08 00:08+0800\n" @@ -1829,16 +1829,15 @@ msgid "" msgstr "" #: ../../library/io.rst:1167 -#, fuzzy msgid "" "Read data from the input stream and return it. If *size* is specified, it " "should be an integer, and at most *size* items (bytes/characters) will be " "read." -msgstr "從串流讀取並回傳一行。如果指定了 *size*,則最多讀取 *size* 個位元組。" +msgstr "" #: ../../library/io.rst:1171 ../../library/io.rst:1190 msgid "For example::" -msgstr "" +msgstr "例如: ::" #: ../../library/io.rst:1173 msgid "" @@ -1846,6 +1845,9 @@ msgid "" " data = reader.read(11)\n" " assert isinstance(data, str)" msgstr "" +"def read_it(reader: Reader[str]):\n" +" data = reader.read(11)\n" +" assert isinstance(data, str)" #: ../../library/io.rst:1179 msgid "" @@ -1865,6 +1867,8 @@ msgid "" "def write_binary(writer: Writer[bytes]):\n" " writer.write(b\"Hello world!\\n\")" msgstr "" +"def write_binary(writer: Writer[bytes]):\n" +" writer.write(b\"Hello world!\\n\")" #: ../../library/io.rst:1195 msgid "" diff --git a/library/ipaddress.po b/library/ipaddress.po index 55181cc2211..26ac4a22525 100644 --- a/library/ipaddress.po +++ b/library/ipaddress.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" diff --git a/library/ipc.po b/library/ipc.po index 487fef910e0..11785ca1c06 100644 --- a/library/ipc.po +++ b/library/ipc.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-09-20 15:25+0800\n" "PO-Revision-Date: 2025-06-27 18:54+0800\n" diff --git a/library/itertools.po b/library/itertools.po index 7cf3251f8ca..c598207cd4b 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" @@ -319,9 +319,8 @@ msgid "it1, it2, ... itn splits one iterator into n" msgstr "it1, it2, ... itn,將一個疊代器分成 n 個" #: ../../library/itertools.rst:61 -#, fuzzy msgid "``tee('ABC', 2) → A B C, A B C``" -msgstr "``cycle('ABCD') → A B C D A B C D ...``" +msgstr "``tee('ABC', 2) → A B C, A B C``" #: ../../library/itertools.rst:62 msgid ":func:`zip_longest`" @@ -412,9 +411,8 @@ msgid "``AB AC AD BC BD CD``" msgstr "``AB AC AD BC BD CD``" #: ../../library/itertools.rst:82 -#, fuzzy msgid "``combinations_with_replacement('ABCD', 2)``" -msgstr "``combinations_with_replacement('ABCD', 2)``" +msgstr "``combinations_with_replacement('ABCD', 2)``" #: ../../library/itertools.rst:82 msgid "``AA AB AC AD BB BC BD CC CD DD``" diff --git a/library/json.po b/library/json.po index b4521b9773f..98996caed79 100644 --- a/library/json.po +++ b/library/json.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # SkyLull , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-08-05 15:25+0800\n" @@ -246,12 +246,10 @@ msgid "" msgstr "" #: ../../library/json.rst:124 -#, fuzzy msgid "Using :mod:`json` from the shell to validate and pretty-print:" -msgstr "在命令列介面裡使用 :mod:`json.tool` 來驗證 JSON 語法和美化呈現方式:" +msgstr "在 shell 使用 :mod:`json` 來驗證和美化印出:" #: ../../library/json.rst:126 -#, fuzzy msgid "" "$ echo '{\"json\":\"obj\"}' | python -m json\n" "{\n" @@ -260,11 +258,11 @@ msgid "" "$ echo '{1.2:3.4}' | python -m json\n" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" msgstr "" -"$ echo '{\"json\":\"obj\"}' | python -m json.tool\n" +"$ echo '{\"json\":\"obj\"}' | python -m json\n" "{\n" " \"json\": \"obj\"\n" "}\n" -"$ echo '{1.2:3.4}' | python -m json.tool\n" +"$ echo '{1.2:3.4}' | python -m json\n" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" #: ../../library/json.rst:135 @@ -465,7 +463,6 @@ msgid "" msgstr "" #: ../../library/json.rst:285 -#, fuzzy msgid "" "If set, a function that is called with the result of any JSON object literal " "decoded (a :class:`dict`). The return value of this function will be used " @@ -473,13 +470,11 @@ msgid "" "decoders, for example `JSON-RPC `_ class hinting. " "Default ``None``." msgstr "" -"*object_hook* 是一個可選引數,其接受一個函式作為輸入。原始的字串解碼結果(一" -"個 :class:`dict`\\ )將被傳入這個函式、並使用 *object_hook* 的回傳值來取代原" -"先的 :class:`dict` 輸出。此功能可用於實作自訂解碼器(例如 `JSON-RPC `_ 類別提示)。" +"如果有設定,會用解碼後的 JSON 物件字面值的結果(一個 :class:`dict`)來呼叫此函式。" +"此函式的回傳值將用來取代 :class:`dict`。此功能可用於實作自訂解碼器," +"例如 `JSON-RPC `_ 類別提示。預設為 ``None``。" #: ../../library/json.rst:295 -#, fuzzy msgid "" "If set, a function that is called with the result of any JSON object literal " "decoded with an ordered list of pairs. The return value of this function " @@ -487,65 +482,56 @@ msgid "" "implement custom decoders. If *object_hook* is also set, *object_pairs_hook* " "takes priority. Default ``None``." msgstr "" -"*object_pairs_hook* 是一個可選引數,其接受一個函式作為輸入。原始的有序對串列" -"(ordered list of pairs)解碼結果將被傳入這個函式、並使用 " -"*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作" -"自訂解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" +"如果有設定,會用任何 JSON 物件字面值以有序對串列解碼的結果來呼叫此函式。" +"此函式的回傳值將用來取代 :class:`dict`。此功能可用於實作自訂解碼器。" +"如果也設定了 *object_hook*,以 *object_pairs_hook* 優先。預設為 ``None``。" #: ../../library/json.rst:305 -#, fuzzy msgid "" "If set, a function that is called with the string of every JSON float to be " "decoded. If ``None`` (the default), it is equivalent to ``float(num_str)``. " "This can be used to parse JSON floats into custom datatypes, for " "example :class:`decimal.Decimal`." msgstr "" -"*parse_float* 為可選函式,每個要被解碼的 JSON 浮點數字串都會改用這個參數給定" -"的函式來進行解碼。預設情況這等效於 ``float(num_str)``。這個參數可用於將 JSON " -"中的浮點數解碼或剖析為另一種資料型別(例如 :class:`decimal.Decimal`\\ )。" +"如果有設定,會用每個要被解碼的 JSON 浮點數字串來呼叫此函式。" +"如果為 ``None``\\ (預設值),則等同於 ``float(num_str)``。" +"此功能可用於將 JSON 浮點數剖析為自訂資料型別,例如 :class:`decimal.Decimal`。" #: ../../library/json.rst:313 -#, fuzzy msgid "" "If set, a function that is called with the string of every JSON int to be " "decoded. If ``None`` (the default), it is equivalent to ``int(num_str)``. " "This can be used to parse JSON integers into custom datatypes, for " "example :class:`float`." msgstr "" -"*parse_int* 為可選函式,當解碼 JSON 整數字串時會被呼叫。預設情況等效於 " -"``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別" -"(例如 :class:`float`)。" +"如果有設定,會用每個要被解碼的 JSON 整數字串來呼叫此函式。" +"如果為 ``None``\\ (預設值),則等同於 ``int(num_str)``。" +"此功能可用於將 JSON 整數剖析為自訂資料型別,例如 :class:`float`。" #: ../../library/json.rst:321 -#, fuzzy msgid "" "If set, a function that is called with one of the following strings: ``'-" "Infinity'``, ``'Infinity'``, or ``'NaN'``. This can be used to raise an " "exception if invalid JSON numbers are encountered. Default ``None``." msgstr "" -"*parse_constant* 為可選函式,在解碼時若遭遇字串 ``'-Infinity'``、" -"``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函式來進行解碼。這" -"也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。" +"如果有設定,會用以下字串之一來呼叫此函式:``'-Infinity'``、" +"``'Infinity'`` 或 ``'NaN'``。此功能可用於在遇到無效的 JSON 數字時引發例外。" +"預設為 ``None``。" #: ../../library/json.rst:0 msgid "Raises" msgstr "" #: ../../library/json.rst:329 -#, fuzzy msgid "When the data being deserialized is not a valid JSON document." -msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" -"發 :exc:`JSONDecodeError` 例外。" +msgstr "當被去序列化的資料不是有效的 JSON 文件時。" #: ../../library/json.rst:332 -#, fuzzy msgid "" "When the data being deserialized does not contain UTF-8, UTF-16 or UTF-32 " "encoded data." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" -"發 :exc:`JSONDecodeError` 例外。" +"當被去序列化的資料不包含 UTF-8、UTF-16 或 UTF-32 編碼資料時。" #: ../../library/json.rst:338 msgid "Added the optional *object_pairs_hook* parameter." @@ -575,16 +561,15 @@ msgstr "" "這能防止阻斷服務攻擊 (Denial of Service attacks)。" #: ../../library/json.rst:355 -#, fuzzy msgid "" "Identical to :func:`load`, but instead of a file-like object, deserialize " "*s* (a :class:`str`, :class:`bytes` or :class:`bytearray` instance " "containing a JSON document) to a Python object using this :ref:`conversion " "table `." msgstr "" -"使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件" -"的 :class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去" -"序列化(deserialize)為一個 Python 物件" +"與 :func:`load` 相同,但不是類檔案物件,而是使用\\ :ref:`轉換表 `\\ " +"將 *s*\\ (一個包含 JSON 文件的 :class:`str`、:class:`bytes` 或 :class:`bytearray` 實例)" +"去序列化為 Python 物件。" #: ../../library/json.rst:360 msgid "" @@ -1253,7 +1238,6 @@ msgstr "" "值、或是序列化特殊數字型別的實例時(例如 :class:`decimal.Decimal`)尤其重要。" #: ../../library/json.rst:737 -#, fuzzy msgid "Command-line interface" msgstr "命令列介面" @@ -1278,7 +1262,6 @@ msgstr "" "和 :data:`sys.stdout` 將各自做為輸入和輸出的預設值。" #: ../../library/json.rst:753 -#, fuzzy msgid "" "$ echo '{\"json\": \"obj\"}' | python -m json\n" "{\n" @@ -1287,11 +1270,11 @@ msgid "" "$ echo '{1.2:3.4}' | python -m json\n" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" msgstr "" -"$ echo '{\"json\":\"obj\"}' | python -m json.tool\n" +"$ echo '{\"json\": \"obj\"}' | python -m json\n" "{\n" " \"json\": \"obj\"\n" "}\n" -"$ echo '{1.2:3.4}' | python -m json.tool\n" +"$ echo '{1.2:3.4}' | python -m json\n" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" #: ../../library/json.rst:762 @@ -1310,7 +1293,6 @@ msgid "" msgstr "" #: ../../library/json.rst:774 -#, fuzzy msgid "Command-line options" msgstr "命令列選項" @@ -1319,7 +1301,6 @@ msgid "The JSON file to be validated or pretty-printed:" msgstr "將被用於校驗或美化呈現的 JSON 文件:" #: ../../library/json.rst:780 -#, fuzzy msgid "" "$ python -m json mp_films.json\n" "[\n" @@ -1333,7 +1314,7 @@ msgid "" " }\n" "]" msgstr "" -"$ python -m json.tool mp_films.json\n" +"$ python -m json mp_films.json\n" "[\n" " {\n" " \"title\": \"And Now for Something Completely Different\",\n" @@ -1393,10 +1374,3 @@ msgstr "" "如 `RFC 7159 更正 `_ " "所述,JSON 允許字串中出現 U+2028(列分隔符)和 U+2029(段落分隔符)字元,而 " "JavaScript(截至 ECMAScript 5.1 版)則不允許。" - -#~ msgid "" -#~ "The :mod:`json.tool` module provides a simple command line interface to " -#~ "validate and pretty-print JSON objects." -#~ msgstr "" -#~ ":mod:`json.tool` 模組提供了一個簡易的命令列介面以供校驗與美化呈現 JSON 物" -#~ "件。" diff --git a/library/keyword.po b/library/keyword.po index 975d58fd62a..a875a597f4d 100644 --- a/library/keyword.po +++ b/library/keyword.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-01-18 14:55+0800\n" diff --git a/library/language.po b/library/language.po index bed2481ca47..8bbd9fa9f4c 100644 --- a/library/language.po +++ b/library/language.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/linecache.po b/library/linecache.po index 6daa425307e..8e7f152f09b 100644 --- a/library/linecache.po +++ b/library/linecache.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-07-07 23:50+0800\n" diff --git a/library/locale.po b/library/locale.po index 19317a1cc58..03f8db33d22 100644 --- a/library/locale.po +++ b/library/locale.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" diff --git a/library/logging.config.po b/library/logging.config.po index a3e26920da2..29d54ac575b 100644 --- a/library/logging.config.po +++ b/library/logging.config.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" diff --git a/library/logging.handlers.po b/library/logging.handlers.po index adbc3760f8c..ee1ffae2a31 100644 --- a/library/logging.handlers.po +++ b/library/logging.handlers.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" @@ -865,9 +865,8 @@ msgid "*socktype* was added." msgstr "新增 *socktype*。" #: ../../library/logging.handlers.rst:661 -#, fuzzy msgid "*timeout* was added." -msgstr "新增 *socktype*。" +msgstr "新增 *timeout*。" #: ../../library/logging.handlers.rst:666 msgid "Closes the socket to the remote host." diff --git a/library/logging.po b/library/logging.po index fd274a0b1ef..03043fcd0e2 100644 --- a/library/logging.po +++ b/library/logging.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Andy Dai , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-03-28 22:40+0800\n" diff --git a/library/lzma.po b/library/lzma.po index 164401e87f3..f7ff47f4513 100644 --- a/library/lzma.po +++ b/library/lzma.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" diff --git a/library/mailbox.po b/library/mailbox.po index 44c110bdc82..2a44b786f77 100644 --- a/library/mailbox.po +++ b/library/mailbox.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-03-24 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" diff --git a/library/mailcap.po b/library/mailcap.po index cfbe289d7ac..bc8b0fd5a2b 100644 --- a/library/mailcap.po +++ b/library/mailcap.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/markup.po b/library/markup.po index 357746f4d15..d8d245e99a9 100644 --- a/library/markup.po +++ b/library/markup.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/marshal.po b/library/marshal.po index 5e42c9cbe6a..c525f3826a1 100644 --- a/library/marshal.po +++ b/library/marshal.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-04-24 21:28+0800\n" @@ -266,19 +266,17 @@ msgid "In addition, the following constants are defined:" msgstr "此外,還定義了以下常數:" #: ../../library/marshal.rst:159 -#, fuzzy msgid "" "Indicates the format that the module uses. Version 0 is the historical first " "version; subsequent versions add new features. Generally, a new version " "becomes the default when it is introduced." msgstr "" -"表示模組所使用的格式。第 0 版為歷史格式,第 1 版共享了駐留字串 (interned " -"string),第 2 版對浮點數使用二進位制格式。第 3 版添加了對於物件實例化和遞迴的" -"支援。目前使用的是第 4 版。" +"表示模組所使用的格式。第 0 版為歷史上第一版本;後續版本會新增功能。當引入新版本時," +"它通常會成為預設版本。" #: ../../library/marshal.rst:165 msgid "Version" -msgstr "" +msgstr "版本" #: ../../library/marshal.rst:165 msgid "Available since" @@ -290,23 +288,23 @@ msgstr "" #: ../../library/marshal.rst:167 msgid "1" -msgstr "" +msgstr "1" #: ../../library/marshal.rst:167 msgid "Python 2.4" -msgstr "" +msgstr "Python 2.4" #: ../../library/marshal.rst:167 msgid "Sharing interned strings" -msgstr "" +msgstr "共享駐留字串" #: ../../library/marshal.rst:169 msgid "2" -msgstr "" +msgstr "2" #: ../../library/marshal.rst:169 msgid "Python 2.5" -msgstr "" +msgstr "Python 2.5" #: ../../library/marshal.rst:169 msgid "Binary representation of floats" @@ -314,11 +312,11 @@ msgstr "" #: ../../library/marshal.rst:171 msgid "3" -msgstr "" +msgstr "3" #: ../../library/marshal.rst:171 ../../library/marshal.rst:173 msgid "Python 3.4" -msgstr "" +msgstr "Python 3.4" #: ../../library/marshal.rst:171 msgid "Support for object instancing and recursion" @@ -326,7 +324,7 @@ msgstr "" #: ../../library/marshal.rst:173 msgid "4" -msgstr "" +msgstr "4" #: ../../library/marshal.rst:173 msgid "Efficient representation of short strings" @@ -334,11 +332,11 @@ msgstr "" #: ../../library/marshal.rst:175 msgid "5" -msgstr "" +msgstr "5" #: ../../library/marshal.rst:175 msgid "Python 3.14" -msgstr "" +msgstr "Python 3.14" #: ../../library/marshal.rst:175 msgid "Support for :class:`slice` objects" diff --git a/library/math.po b/library/math.po index 20bba05b80e..0205aae3079 100644 --- a/library/math.po +++ b/library/math.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" @@ -1212,9 +1212,8 @@ msgid "Raises :exc:`ValueError` if the inputs do not have the same length." msgstr "" #: ../../library/math.rst:609 -#, fuzzy msgid "sum(map(operator.mul, p, q, strict=True))" -msgstr "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" +msgstr "sum(map(operator.mul, p, q, strict=True))" #: ../../library/math.rst:611 msgid "" @@ -1428,10 +1427,3 @@ msgstr ":mod:`cmath` 模組" #: ../../library/math.rst:839 msgid "Complex number versions of many of these functions." msgstr "" - -#~ msgid "" -#~ "Return *n* factorial as an integer. Raises :exc:`ValueError` if *n* is " -#~ "not integral or is negative." -#~ msgstr "" -#~ "以整數回傳 *n* 的階乘。若 *n* 非整數型別或其值為負會引" -#~ "發 :exc:`ValueError`。" diff --git a/library/mimetypes.po b/library/mimetypes.po index bc0e22fbf34..7a4af89faa2 100644 --- a/library/mimetypes.po +++ b/library/mimetypes.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2016-11-19 00:32+0000\n" @@ -247,7 +246,6 @@ msgstr "" "'application/x-tar-gz'" #: ../../library/mimetypes.rst:195 -#, fuzzy msgid "MimeTypes objects" msgstr "MimeTypes 物件" diff --git a/library/mm.po b/library/mm.po index eefa2312a6f..72377cab099 100644 --- a/library/mm.po +++ b/library/mm.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-01-18 14:54+0800\n" diff --git a/library/mmap.po b/library/mmap.po index 59781f63a91..be083b8ab9f 100644 --- a/library/mmap.po +++ b/library/mmap.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" diff --git a/library/modulefinder.po b/library/modulefinder.po index ae4cd98992d..fd679ecc19a 100644 --- a/library/modulefinder.po +++ b/library/modulefinder.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2024-05-11 14:42+0800\n" diff --git a/library/modules.po b/library/modules.po index 551ff94e39d..50d1c2f66f1 100644 --- a/library/modules.po +++ b/library/modules.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" diff --git a/library/msilib.po b/library/msilib.po index 45d08527db4..9b0f1773430 100644 --- a/library/msilib.po +++ b/library/msilib.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/msvcrt.po b/library/msvcrt.po index a59619b149c..a706e3af3cd 100644 --- a/library/msvcrt.po +++ b/library/msvcrt.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index d3c7c7ebfc0..15f6ddc7039 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" @@ -683,7 +683,6 @@ msgid "" msgstr "" #: ../../library/multiprocessing.rst:395 -#, fuzzy msgid "" "from multiprocessing import Process, Manager\n" "\n" @@ -711,33 +710,37 @@ msgid "" msgstr "" "from multiprocessing import Process, Manager\n" "\n" -"def f(d, l):\n" +"def f(d, l, s):\n" " d[1] = '1'\n" " d['2'] = 2\n" " d[0.25] = None\n" " l.reverse()\n" +" s.add('a')\n" +" s.add('b')\n" "\n" "if __name__ == '__main__':\n" " with Manager() as manager:\n" " d = manager.dict()\n" " l = manager.list(range(10))\n" +" s = manager.set()\n" "\n" -" p = Process(target=f, args=(d, l))\n" +" p = Process(target=f, args=(d, l, s))\n" " p.start()\n" " p.join()\n" "\n" " print(d)\n" -" print(l)" +" print(l)\n" +" print(s)" #: ../../library/multiprocessing.rst:421 -#, fuzzy msgid "" "{0.25: None, 1: '1', '2': 2}\n" "[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n" "{'a', 'b'}" msgstr "" "{0.25: None, 1: '1', '2': 2}\n" -"[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]" +"[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n" +"{'a', 'b'}" #: ../../library/multiprocessing.rst:425 msgid "" diff --git a/library/multiprocessing.shared_memory.po b/library/multiprocessing.shared_memory.po index 86ded1a7f31..6891ca31d70 100644 --- a/library/multiprocessing.shared_memory.po +++ b/library/multiprocessing.shared_memory.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-12-11 00:03+0800\n" diff --git a/library/netdata.po b/library/netdata.po index 079730d3d73..6d6d8a02351 100644 --- a/library/netdata.po +++ b/library/netdata.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-10-26 16:47+0000\n" "PO-Revision-Date: 2023-01-23 23:33+0800\n" diff --git a/library/netrc.po b/library/netrc.po index b19a56f6d24..f8c60acade6 100644 --- a/library/netrc.po +++ b/library/netrc.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" diff --git a/library/nis.po b/library/nis.po index e2e5bb1c791..0653673b96a 100644 --- a/library/nis.po +++ b/library/nis.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/nntplib.po b/library/nntplib.po index 908464fbce9..ac1de5a57cf 100644 --- a/library/nntplib.po +++ b/library/nntplib.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/numbers.po b/library/numbers.po index 33bd765f186..9715ceb1a09 100644 --- a/library/numbers.po +++ b/library/numbers.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-11-16 04:57+0800\n" diff --git a/library/numeric.po b/library/numeric.po index 064f8e05300..3e885f53721 100644 --- a/library/numeric.po +++ b/library/numeric.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" diff --git a/library/operator.po b/library/operator.po index 9193a8fc7eb..14942f783dc 100644 --- a/library/operator.po +++ b/library/operator.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-02-18 14:49+0800\n" @@ -108,14 +107,12 @@ msgid "Return ``a is not b``. Tests object identity." msgstr "回傳 ``a is not b``。測試物件識別性。" #: ../../library/operator.rst:85 -#, fuzzy msgid "Return ``a is None``. Tests object identity." -msgstr "回傳 ``a is b``。測試物件識別性。" +msgstr "回傳 ``a is None``。測試物件識別性。" #: ../../library/operator.rst:92 -#, fuzzy msgid "Return ``a is not None``. Tests object identity." -msgstr "回傳 ``a is not b``。測試物件識別性。" +msgstr "回傳 ``a is not None``。測試物件識別性。" #: ../../library/operator.rst:97 msgid "The mathematical and bitwise operations are the most numerous:" @@ -594,24 +591,20 @@ msgid "``is_not(a, b)``" msgstr "``is_not(a, b)``" #: ../../library/operator.rst:422 -#, fuzzy msgid "``a is None``" -msgstr "``a is b``" +msgstr "``a is None``" #: ../../library/operator.rst:422 -#, fuzzy msgid "``is_none(a)``" -msgstr "``is_not(a, b)``" +msgstr "``is_none(a)``" #: ../../library/operator.rst:424 -#, fuzzy msgid "``a is not None``" -msgstr "``a is not b``" +msgstr "``a is not None``" #: ../../library/operator.rst:424 -#, fuzzy msgid "``is_not_none(a)``" -msgstr "``is_not(a, b)``" +msgstr "``is_not_none(a)``" #: ../../library/operator.rst:426 msgid "Indexed Assignment" diff --git a/library/optparse.po b/library/optparse.po index f759497dfe5..42e4ab6d592 100644 --- a/library/optparse.po +++ b/library/optparse.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" diff --git a/library/os.path.po b/library/os.path.po index 40cc7fa38e4..abe7d839738 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -1,12 +1,12 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-16 00:16+0000\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\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-" @@ -37,9 +37,9 @@ msgid "" "module. The path parameters can be passed as strings, or bytes, or any " "object implementing the :class:`os.PathLike` protocol." msgstr "" -"該模組實現了一些有用的路徑名操作函式。若要讀取或寫入檔案,請參閱 :func:" -"`open` 函式,要存取檔案系統,請參閱 :mod:`os` 模組。路徑參數可以以字串、位元" -"組或任何依照 :class:`os.PathLike` 協定實作的物件傳遞。" +"該模組實現了一些有用的路徑名操作函式。若要讀取或寫入檔案,請參" +"閱 :func:`open` 函式,要存取檔案系統,請參閱 :mod:`os` 模組。路徑參數可以以字" +"串、位元組或任何依照 :class:`os.PathLike` 協定實作的物件傳遞。" #: ../../library/os.path.rst:19 msgid "" @@ -68,12 +68,12 @@ msgstr "" #: ../../library/os.path.rst:37 msgid "" "Since different operating systems have different path name conventions, " -"there are several versions of this module in the standard library. The :mod:" -"`os.path` module is always the path module suitable for the operating system " -"Python is running on, and therefore usable for local paths. However, you " -"can also import and use the individual modules if you want to manipulate a " -"path that is *always* in one of the different formats. They all have the " -"same interface:" +"there are several versions of this module in the standard library. " +"The :mod:`os.path` module is always the path module suitable for the " +"operating system Python is running on, and therefore usable for local " +"paths. However, you can also import and use the individual modules if you " +"want to manipulate a path that is *always* in one of the different formats. " +"They all have the same interface:" msgstr "" "由於不同的作業系統具有不同的路徑命名慣例,在標準函式庫中的路徑模組有數個版本" "可供使用,而 :mod:`os.path` 模組都會是運行 Python 之作業系統所適用本地路徑。" @@ -81,23 +81,22 @@ msgstr "" "並使用對應的模組。它們都具有相同的介面:" #: ../../library/os.path.rst:45 -msgid ":mod:`posixpath` for UNIX-style paths" -msgstr ":mod:`posixpath` 用於 UNIX 形式的路徑" +msgid ":mod:`!posixpath` for UNIX-style paths" +msgstr ":mod:`!posixpath` 用於 UNIX 形式的路徑" #: ../../library/os.path.rst:46 -msgid ":mod:`ntpath` for Windows paths" -msgstr ":mod:`ntpath` 用於 Windows 的路徑" +msgid ":mod:`!ntpath` for Windows paths" +msgstr ":mod:`!ntpath` 用於 Windows 的路徑" #: ../../library/os.path.rst:51 msgid "" -":func:`exists`, :func:`lexists`, :func:`isdir`, :func:`isfile`, :func:" -"`islink`, and :func:`ismount` now return ``False`` instead of raising an " -"exception for paths that contain characters or bytes unrepresentable at the " -"OS level." +":func:`exists`, :func:`lexists`, :func:`isdir`, :func:`isfile`, :func:`islink`, " +"and :func:`ismount` now return ``False`` instead of raising an exception for " +"paths that contain characters or bytes unrepresentable at the OS level." msgstr "" -"對於包含有作業系統層級無法表示之字元或位元組的路徑,:func:`exists`、:func:" -"`lexists`、:func:`isdir`、:func:`isfile`、:func:`islink` 和 :func:`ismount` " -"函式現在會回傳 ``False``,而不是引發例外。" +"對於包含有作業系統層級無法表示之字元或位元組的路" +"徑,:func:`exists`、:func:`lexists`、:func:`isdir`、:func:`isfile`、:func:`islink` " +"和 :func:`ismount` 函式現在會回傳 ``False``,而不是引發例外。" #: ../../library/os.path.rst:59 msgid "" @@ -105,8 +104,8 @@ msgid "" "platforms, this is equivalent to calling the function :func:`normpath` as " "follows: ``normpath(join(os.getcwd(), path))``." msgstr "" -"回傳經正規化的絕對路徑名 *path* 。在大多數平台上,這等效於按照以下方式呼叫 :" -"func:`normpath` 函式:``normpath(join(os.getcwd(), path))``。" +"回傳經正規化的絕對路徑名 *path* 。在大多數平台上,這等效於按照以下方式呼" +"叫 :func:`normpath` 函式:``normpath(join(os.getcwd(), path))``。" #: ../../library/os.path.rst:63 ../../library/os.path.rst:76 #: ../../library/os.path.rst:117 ../../library/os.path.rst:126 @@ -134,8 +133,8 @@ msgid "" msgstr "" "回傳路徑名 *path* 的基底名稱。這是將 *path* 傳遞給函式 :func:`split` 後回傳結" "果中的第二個元素。請注意,此函式的結果與 Unix 的 :program:`basename` 程式不" -"同;對於 ``'/foo/bar/'``,:program:`basename` 回傳 ``'bar'``,而 :func:" -"`basename` 函式回傳空字串(``''``)。" +"同;對於 ``'/foo/bar/'``,:program:`basename` 回傳 ``'bar'``," +"而 :func:`basename` 函式回傳空字串(``''``)。" #: ../../library/os.path.rst:82 msgid "" @@ -145,8 +144,8 @@ msgid "" "empty. Unlike :func:`commonprefix`, this returns a valid path." msgstr "" "回傳可疊代物件 *paths* 中每個路徑名稱的最長共同子路徑。如果 *paths* 同時包含" -"絕對路徑名稱和相對路徑名稱、*paths* 位於不同的驅動機或 *paths* 為空,則引發 :" -"exc:`ValueError`。與 :func:`commonprefix` 不同,此函式回傳的是有效路徑。" +"絕對路徑名稱和相對路徑名稱、*paths* 位於不同的驅動機或 *paths* 為空,則引" +"發 :exc:`ValueError`。與 :func:`commonprefix` 不同,此函式回傳的是有效路徑。" #: ../../library/os.path.rst:90 msgid "Accepts a sequence of :term:`path-like objects `." @@ -218,11 +217,11 @@ msgstr "" #: ../../library/os.path.rst:148 msgid "" "Return ``True`` if *path* refers to an existing path, including broken " -"symbolic links. Equivalent to :func:`exists` on platforms lacking :func:" -"`os.lstat`." +"symbolic links. Equivalent to :func:`exists` on platforms " +"lacking :func:`os.lstat`." msgstr "" -"如果 *path* 是一個存在的路徑則回傳 ``True``,對已損壞的符號連結也是。在缺乏 :" -"func:`os.lstat` 的平台上,與 :func:`exists` 函式等效。" +"如果 *path* 是一個存在的路徑則回傳 ``True``,對已損壞的符號連結也是。在缺" +"乏 :func:`os.lstat` 的平台上,與 :func:`exists` 函式等效。" #: ../../library/os.path.rst:160 msgid "" @@ -234,10 +233,11 @@ msgstr "" #: ../../library/os.path.rst:165 msgid "" -"On Unix, an initial ``~`` is replaced by the environment variable :envvar:" -"`HOME` if it is set; otherwise the current user's home directory is looked " -"up in the password directory through the built-in module :mod:`pwd`. An " -"initial ``~user`` is looked up directly in the password directory." +"On Unix, an initial ``~`` is replaced by the environment " +"variable :envvar:`HOME` if it is set; otherwise the current user's home " +"directory is looked up in the password directory through the built-in " +"module :mod:`pwd`. An initial ``~user`` is looked up directly in the " +"password directory." msgstr "" "在 Unix 上,如果環境變數 :envvar:`HOME` 有被設置,則將初始的 ``~`` 替換為該變" "數的值;否則將使用內建模組 :mod:`pwd` 在密碼目錄中查找目前使用者的家目錄。對" @@ -288,9 +288,9 @@ msgstr "" #: ../../library/os.path.rst:204 msgid "" "Return the time of last access of *path*. The return value is a floating-" -"point number giving the number of seconds since the epoch (see the :mod:" -"`time` module). Raise :exc:`OSError` if the file does not exist or is " -"inaccessible." +"point number giving the number of seconds since the epoch (see " +"the :mod:`time` module). Raise :exc:`OSError` if the file does not exist " +"or is inaccessible." msgstr "" "回傳 *path* 的最後存取時間。回傳值是一個浮點數,表示自紀元(參見 :mod:`time` " "模組)以來的秒數。如果檔案不存在或無法存取,則引發 :exc:`OSError`。" @@ -323,8 +323,8 @@ msgid "" "Return the size, in bytes, of *path*. Raise :exc:`OSError` if the file does " "not exist or is inaccessible." msgstr "" -"回傳 *path* 的大小(以位元組為單位)。如果檔案不存在或無法存取,則引發 :exc:" -"`OSError`。" +"回傳 *path* 的大小(以位元組為單位)。如果檔案不存在或無法存取,則引" +"發 :exc:`OSError`。" #: ../../library/os.path.rst:242 msgid "" @@ -349,8 +349,8 @@ msgid "" "true for the same path." msgstr "" "如果 *path* 是一個\\ :func:`已存在的 `\\ 常規檔案,則回傳 ``True``。" -"這將跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` 和 :func:" -"`isfile` 的結果為真。" +"這將跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` " +"和 :func:`isfile` 的結果為真。" #: ../../library/os.path.rst:266 msgid "" @@ -395,13 +395,14 @@ msgid "" "the input path." msgstr "" "如果路徑名 *path* 是一個掛載點 (:dfn:`mount point`),則回傳 ``True``:即在檔" -"案系統中掛載了不同的檔案系統。在 POSIX 系統上,該函式檢查 *path* 的父目錄 :" -"file:`{path}/..` 是否位於不同的設備上,或者 :file:`{path}/..` 和 *path* 是否" -"指向同一設備上的相同 i-node --- 這應該能夠檢測出所有 Unix 和 POSIX 變體的掛載" -"點。但無法可靠地檢測出相同檔案系統上的綁定掛載點 (bind mount)。在 Linux 系統" -"上,即使它們不是掛載點,也會始終回傳 ``True`` 給 btrfs 子卷(subvolumes)。" -"在 Windows 上,以驅動機字母開頭的根目錄和 UNC 共享路徑始終是掛載點,對於任何" -"其他路徑,會呼叫 ``GetVolumePathName`` 函式來檢查它是否與輸入路徑不同。" +"案系統中掛載了不同的檔案系統。在 POSIX 系統上,該函式檢查 *path* 的父目" +"錄 :file:`{path}/..` 是否位於不同的設備上,或者 :file:`{path}/..` 和 *path* " +"是否指向同一設備上的相同 i-node --- 這應該能夠檢測出所有 Unix 和 POSIX 變體的" +"掛載點。但無法可靠地檢測出相同檔案系統上的綁定掛載點 (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." @@ -427,8 +428,9 @@ msgid "" "windows/dev-drive/>`_ for information on enabling and creating Dev Drives." msgstr "" "可能會對無效的路徑引發錯誤,例如,沒有可識別的驅動機的路徑,但在不支援 Dev 磁" -"碟機的平台上返回 ``False``。請參閱 `Windows 文件 `_\\ 以了解有關啟用和建立 Dev 驅動機的資訊。" +"碟機的平台上返回 ``False``。請參閱 `Windows 文件 `_\\ 以了解有關啟用和建立 Dev 驅動機的" +"資訊。" #: ../../library/os.path.rst:328 msgid "" @@ -481,9 +483,9 @@ msgid "" "On Windows, the drive is not reset when a rooted path segment (e.g., " "``r'\\foo'``) is encountered. If a segment is on a different drive or is an " "absolute path, all previous segments are ignored and the drive is reset. " -"Note that since there is a current directory for each drive, ``os.path." -"join(\"c:\", \"foo\")`` represents a path relative to the current directory " -"on drive :file:`C:` (:file:`c:foo`), not :file:`c:\\\\foo`." +"Note that since there is a current directory for each drive, " +"``os.path.join(\"c:\", \"foo\")`` represents a path relative to the current " +"directory on drive :file:`C:` (:file:`c:foo`), not :file:`c:\\\\foo`." msgstr "" "在 Windows 上,當遇到根路徑段(例如,``r'\\foo'``)時,驅動機不會被重置。如果" "一個段位於不同的驅動機上,或者是絕對路徑,則將忽略所有之前的段並重置驅動機。" @@ -527,10 +529,10 @@ msgid "" "leading characters shall be treated as a single character." msgstr "" "在 POSIX 系統中,根據 `IEEE Std 1003.1 2013 版; 4.13 Pathname Resolution " -"`_ 標準,如果一個路徑名恰好以兩個斜線開頭,則在前導字元後的第" -"一個部分可能會以由實作品自行定義的方式解釋,雖然多於兩個前導字元應該被視為單" -"個字元。" +"`_ 標準,如果一個路徑名恰好以兩個斜線開頭,則在前導" +"字元後的第一個部分可能會以由實作品自行定義的方式解釋,雖然多於兩個前導字元應" +"該被視為單個字元。" #: ../../library/os.path.rst:407 msgid "" @@ -573,10 +575,10 @@ msgstr "" #: ../../library/os.path.rst:428 msgid "" -"If *strict* is :py:data:`os.path.ALLOW_MISSING`, errors other than :exc:" -"`FileNotFoundError` are re-raised (as with ``strict=True``). Thus, the " -"returned path will not contain any symbolic links, but the named file and " -"some of its parent directories may be missing." +"If *strict* is :py:data:`os.path.ALLOW_MISSING`, errors other " +"than :exc:`FileNotFoundError` are re-raised (as with ``strict=True``). Thus, " +"the returned path will not contain any symbolic links, but the named file " +"and some of its parent directories may be missing." msgstr "" #: ../../library/os.path.rst:434 @@ -656,13 +658,14 @@ msgstr "如果文件描述符 *fp1* 和 *fp2* 指向同一個檔案,則回傳 #: ../../library/os.path.rst:503 msgid "" "Return ``True`` if the stat tuples *stat1* and *stat2* refer to the same " -"file. These structures may have been returned by :func:`os.fstat`, :func:`os." -"lstat`, or :func:`os.stat`. This function implements the underlying " -"comparison used by :func:`samefile` and :func:`sameopenfile`." +"file. These structures may have been returned " +"by :func:`os.fstat`, :func:`os.lstat`, or :func:`os.stat`. This function " +"implements the underlying comparison used by :func:`samefile` " +"and :func:`sameopenfile`." msgstr "" "如果 stat 值組 *stat1* 和 *stat2* 指向同一個檔案,則回傳 ``True``。這些結構可" -"能由 :func:`os.fstat`、:func:`os.lstat` 或 :func:`os.stat` 回傳。此函式使用 :" -"func:`samefile` 和 :func:`sameopenfile` 實現了底層比較。" +"能由 :func:`os.fstat`、:func:`os.lstat` 或 :func:`os.stat` 回傳。此函式使" +"用 :func:`samefile` 和 :func:`sameopenfile` 實現了底層比較。" #: ../../library/os.path.rst:514 msgid "" @@ -681,8 +684,8 @@ msgstr "" "結尾,則 *tail* 將為空。如果 *path* 中沒有斜線,則 *head* 將為空。如果 " "*path* 為空,則 *head* 和 *tail* 都為空。除非 *head* 是根目錄(僅有一個或多個" "斜線),否則從 *head* 中刪除尾部的斜線。在所有情況下,``join(head, tail)`` 回" -"傳指向與 *path* 相同位置的路徑(但字串可能不同)。還可以參考函式 :func:" -"`dirname` 和 :func:`basename`。" +"傳指向與 *path* 相同位置的路徑(但字串可能不同)。還可以參考函" +"式 :func:`dirname` 和 :func:`basename`。" #: ../../library/os.path.rst:530 msgid "" @@ -752,9 +755,8 @@ msgid "" msgstr "" "在 POSIX 系統上,*drive* 始終為空。*root* 可能為空(如果 *path* 是相對路" "徑),一個斜線(如果 *path* 是絕對路徑),或者兩個斜線(根據 `IEEE Std " -"1003.1-2017; 4.13 Pathname Resolution `_ 的實作定義)。例" -"如: ::" +"1003.1-2017; 4.13 Pathname Resolution `_ 的實作定義)。例如: ::" #: ../../library/os.path.rst:567 msgid "" diff --git a/library/os.po b/library/os.po index a97fe057bfc..b9c13b0f20a 100644 --- a/library/os.po +++ b/library/os.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-04-29 15:24+0800\n" @@ -460,9 +460,8 @@ msgid "" msgstr "" #: ../../library/os.rst:227 -#, fuzzy msgid "The :func:`os.reload_environ` function." -msgstr ":func:`~os.setns` 函式。" +msgstr ":func:`os.reload_environ` 函式。" #: ../../library/os.rst:229 ../../library/os.rst:245 msgid "" @@ -743,9 +742,8 @@ msgid "" msgstr "" #: ../../library/os.rst:587 ../../library/os.rst:837 -#, fuzzy msgid "See also the :func:`os.reload_environ` function." -msgstr "也請見 :func:`sched_getaffinity` 函式。" +msgstr "也請見 :func:`os.reload_environ` 函式。" #: ../../library/os.rst:591 msgid "" @@ -2021,9 +2019,8 @@ msgid "" msgstr "" #: ../../library/os.rst:1809 -#, fuzzy msgid "The :manpage:`splice(2)` man page." -msgstr ":manpage:`timerfd_create(2)` 手冊頁。" +msgstr ":manpage:`splice(2)` 使用手冊。" #: ../../library/os.rst:1824 msgid "" @@ -4566,7 +4563,7 @@ msgstr "" #: ../../library/os.rst:4005 msgid "The :manpage:`timerfd_create(2)` man page." -msgstr ":manpage:`timerfd_create(2)` 手冊頁。" +msgstr ":manpage:`timerfd_create(2)` 使用手冊。" #: ../../library/os.rst:4014 msgid "" @@ -5241,7 +5238,7 @@ msgstr "" #: ../../library/os.rst:4647 msgid "See the :manpage:`pidfd_open(2)` man page for more details." -msgstr "更多細節請見 :manpage:`pidfd_open(2)` 手冊頁。" +msgstr "更多細節請見 :manpage:`pidfd_open(2)` 使用手冊。" #: ../../library/os.rst:4654 msgid "" diff --git a/library/ossaudiodev.po b/library/ossaudiodev.po index 6154c77b2ea..c7b19fc6725 100644 --- a/library/ossaudiodev.po +++ b/library/ossaudiodev.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/pathlib.po b/library/pathlib.po index cfa4f7c927f..293165e97a3 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -1,12 +1,12 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\n" "PO-Revision-Date: 2024-12-23 19:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -617,10 +617,10 @@ msgstr "純路徑提供以下方法與屬性:" #: ../../library/pathlib.rst:313 msgid "" "The implementation of the :mod:`os.path` module used for low-level path " -"parsing and joining: either :mod:`posixpath` or :mod:`ntpath`." +"parsing and joining: either :mod:`!posixpath` or :mod:`!ntpath`." msgstr "" -"用於底層路徑剖析和結合的 :mod:`os.path` 模組的實作:可能是 :mod:`posixpath` " -"或 :mod:`ntpath`。" +"用於底層路徑剖析和結合的 :mod:`os.path` 模組的實作:可能是 :mod:`!posixpath` " +"或 :mod:`!ntpath`。" #: ../../library/pathlib.rst:320 msgid "A string representing the drive letter or name, if any::" @@ -1651,14 +1651,11 @@ msgstr "" "'file:///c:/Windows'" #: ../../library/pathlib.rst:897 -#, fuzzy msgid "" "Calling this method from :class:`PurePath` rather than :class:`Path` is " "possible but deprecated. The method's use of :func:`os.fsencode` makes it " "strictly impure." msgstr "" -"因為歷史上的原因,此方法也可以從 :class:`PurePath` 物件上使用。然而,它使" -"用 :func:`os.fsencode` 而讓它完全不純粹。" #: ../../library/pathlib.rst:903 msgid "Expanding and resolving paths" @@ -2675,19 +2672,16 @@ msgstr "" "中,則是引發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:1580 -#, fuzzy msgid "Copying, moving and deleting" -msgstr "重新命名和刪除" +msgstr "複製、移動和刪除" #: ../../library/pathlib.rst:1584 -#, fuzzy msgid "" "Copy this file or directory tree to the given *target*, and return a " "new :class:`!Path` instance pointing to *target*." msgstr "" -"將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的" -"新 :class:`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條" -"件地取代。" +"將此檔案或目錄樹複製到給定的 *target*,並回傳一個指向 *target* 的新 :class:`!" +"Path` 實例。" #: ../../library/pathlib.rst:1587 msgid "" @@ -2785,14 +2779,12 @@ msgstr "" "件地取代。" #: ../../library/pathlib.rst:1661 -#, fuzzy msgid "" "Move this file or directory tree to the given *target*, and return a " "new :class:`!Path` instance pointing to *target*." msgstr "" -"將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的" -"新 :class:`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條" -"件地取代。" +"將此檔案或目錄樹移動到給定的 *target*,並回傳一個指向 *target* 的新 :class:`!" +"Path` 實例。" #: ../../library/pathlib.rst:1664 msgid "" @@ -3566,11 +3558,12 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:1964 -#, fuzzy msgid "" "Return ``True`` if the path is an existing file or directory, or any other " "kind of file; return ``False`` if the path doesn't exist." -msgstr "如果路徑指向存在的檔案或目錄則回傳 ``True``。" +msgstr "" +"如果路徑是個存在的檔案、目錄或任何其他類型的檔案則回傳 ``True``,如果路徑不存" +"在則回傳 ``False``。" #: ../../library/pathlib.rst:1967 msgid "" @@ -3579,14 +3572,11 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:1972 -#, fuzzy msgid "" "Return ``True`` if the path is a directory, or a symbolic link pointing to a " "directory; return ``False`` if the path is (or points to) any other kind of " "file, or if it doesn't exist." msgstr "" -"如果該路徑指向一個 Unix socket(或者是一個指向 Unix socket 的符號連結)則會回" -"傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" #: ../../library/pathlib.rst:1976 msgid "" @@ -3596,14 +3586,11 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:1982 -#, fuzzy msgid "" "Return ``True`` if the path is a file, or a symbolic link pointing to a " "file; return ``False`` if the path is (or points to) a directory or other " "non-file, or if it doesn't exist." msgstr "" -"如果該路徑指向一個 Unix socket(或者是一個指向 Unix socket 的符號連結)則會回" -"傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" #: ../../library/pathlib.rst:1986 msgid "" @@ -3613,14 +3600,11 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:1992 -#, fuzzy msgid "" "Return ``True`` if the path is a symbolic link (even if broken); return " "``False`` if the path is a directory or any kind of file, or if it doesn't " "exist." msgstr "" -"如果該路徑指向一個 FIFO(或者是一個指向 FIFO 的符號連結)則會回傳 ``True``," -"如果指向其他類型的檔案則回傳 ``False``。" #: ../../library/pathlib.rst:11 msgid "path" diff --git a/library/pdb.po b/library/pdb.po index 5b30e3e5f49..ff23c1b7767 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-10-19 17:39+0800\n" @@ -159,9 +159,8 @@ msgid "" msgstr "你還可以從命令列叫用 :mod:`pdb` 來偵錯其他腳本。例如: ::" #: ../../library/pdb.rst:84 -#, fuzzy msgid "python -m pdb [-c command] (-m module | -p pid | pyfile) [args ...]" -msgstr "python -m pdb [-c command] (-m module | pyfile) [args ...]" +msgstr "python -m pdb [-c command] (-m module | -p pid | pyfile) [args ...]" #: ../../library/pdb.rst:86 msgid "" @@ -210,9 +209,8 @@ msgid "" msgstr "" #: ../../library/pdb.rst:118 -#, fuzzy msgid "python -m pdb -p 1234" -msgstr "python -m pdb myscript.py" +msgstr "python -m pdb -p 1234" #: ../../library/pdb.rst:122 msgid "" @@ -337,7 +335,6 @@ msgstr "" "後立即出現。" #: ../../library/pdb.rst:192 -#, fuzzy msgid "" "Enter the debugger at the calling stack frame. This is useful to hard-code " "a breakpoint at a given point in a program, even if the code is not " @@ -348,7 +345,8 @@ msgid "" msgstr "" "在呼叫此函式的 stack frame 進入偵錯器。用於在程式中給定之處寫死 (hard-code) " "一個斷點,即便該程式碼不在偵錯狀態(如斷言失敗時)。如有給定 *header*,它將在" -"偵錯正要開始前被印出到控制台。" +"偵錯正要開始前被印出到控制台。如果給定了 *commands* 引數," +"它會是在偵錯器啟動時要執行的命令清單。" #: ../../library/pdb.rst:200 msgid "The keyword-only argument *header*." @@ -361,9 +359,8 @@ msgid "" msgstr ":func:`set_trace` 將立即進入偵錯器,而不是在下一列要執行的程式碼中。" #: ../../library/pdb.rst:207 -#, fuzzy msgid "The *commands* argument." -msgstr "*readrc* 引數。" +msgstr "*commands* 引數。" #: ../../library/pdb.rst:213 msgid "" @@ -376,6 +373,8 @@ msgid "" "async def f():\n" " await pdb.set_trace_async()" msgstr "" +"async def f():\n" +" await pdb.set_trace_async()" #: ../../library/pdb.rst:221 msgid "" @@ -523,19 +522,16 @@ msgid "The *readrc* argument." msgstr "*readrc* 引數。" #: ../../library/pdb.rst:314 -#, fuzzy msgid "Added the *mode* argument." -msgstr "新增了 *skip* 參數。" +msgstr "新增了 *mode* 引數。" #: ../../library/pdb.rst:317 -#, fuzzy msgid "Added the *backend* argument." -msgstr "新增了 *skip* 參數。" +msgstr "新增了 *backend* 引數。" #: ../../library/pdb.rst:320 -#, fuzzy msgid "Added the *colorize* argument." -msgstr "新增了 *skip* 參數。" +msgstr "新增了 *colorize* 引數。" #: ../../library/pdb.rst:323 msgid "" @@ -637,9 +633,8 @@ msgstr "" "將被清除,因此與使用 ``foo = 1`` 等普通變數相比,它不太會去干擾你的程式。" #: ../../library/pdb.rst:382 -#, fuzzy msgid "There are four preset *convenience variables*:" -msgstr "共有三個預先設定的\\ *便利變數*:" +msgstr "共有四個預先設定的\\ *便利變數*:" #: ../../library/pdb.rst:384 msgid "``$_frame``: the current frame you are debugging" @@ -662,9 +657,8 @@ msgid "Added the *convenience variable* feature." msgstr "新增了\\ *便利變數*\\ 功能。" #: ../../library/pdb.rst:393 -#, fuzzy msgid "Added the ``$_asynctask`` convenience variable." -msgstr "新增了\\ *便利變數*\\ 功能。" +msgstr "新增了 ``$_asynctask`` 便利變數。" #: ../../library/pdb.rst:400 msgid "" @@ -711,7 +705,6 @@ msgstr "" "息則必須輸入 ``help exec``。" #: ../../library/pdb.rst:427 -#, fuzzy msgid "" "Print a stack trace, with the most recent frame at the bottom. if *count* " "is 0, print the current frame entry. If *count* is negative, print the least " @@ -719,8 +712,9 @@ msgid "" "*count* frames. An arrow (``>``) indicates the current frame, which " "determines the context of most commands." msgstr "" -"印出 stack trace,最新的 frame 會位於底部。箭頭(``>``)表示目前的 frame,它" -"也決定了大多數命令的情境。" +"印出 stack trace,最新的 frame 會位於底部。如果 *count* 為 0,則印出目前的 frame 條目。" +"如果 *count* 為負數,印出最舊的 *count* 個 frame。如果 *count* 為正數," +"印出最新的 *count* 個 frame。箭頭(``>``)表示目前的 frame,它也決定了大多數命令的情境。" #: ../../library/pdb.rst:433 msgid "*count* argument is added." @@ -743,7 +737,6 @@ msgstr "" "frame)。" #: ../../library/pdb.rst:448 -#, fuzzy msgid "" "With a *lineno* argument, set a break at line *lineno* in the current file. " "The line number may be prefixed with a *filename* and a colon, to specify a " @@ -881,7 +874,6 @@ msgstr "" "或 :pdbcmd:`step` 命令,或其他可以繼續執行程式的命令。" #: ../../library/pdb.rst:525 -#, fuzzy msgid "" "Specifying any command resuming execution " "(currently :pdbcmd:`continue`, :pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`until`, :pdbcmd:`jump`, :pdbcmd:`quit` " @@ -892,7 +884,7 @@ msgid "" "list to execute." msgstr "" "如果指定了某個繼續執行程式的命令(目前包" -"括 :pdbcmd:`continue`、:pdbcmd:`step`、:pdbcmd:`next`、:pdbcmd:`return`、:pdbcmd:`jump`、:pdbcmd:`quit` " +"括 :pdbcmd:`continue`、:pdbcmd:`step`、:pdbcmd:`next`、:pdbcmd:`return`、:pdbcmd:`until`、:pdbcmd:`jump`、:pdbcmd:`quit` " "及它們的縮寫)將終止命令列表(就像該命令後馬上跟著 end)。因為在任何時候繼續" "執行下去(即使是簡單的 next 或 step),都可能會遇到另一個斷點,該斷點可能具有" "自己的命令列表,這會導致無法確定要執行哪個列表。" @@ -1288,11 +1280,10 @@ msgid "" msgstr "" #: ../../library/pdb.rst:782 -#, fuzzy msgid "" "Quit from the debugger. The program being executed is aborted. An end-of-" "file input is equivalent to :pdbcmd:`quit`." -msgstr "離開偵錯器,執行中的程式會被中止。" +msgstr "離開偵錯器,執行中的程式會被中止。輸入檔案結尾 (end-of-file) 相當於 :pdbcmd:`quit`。" #: ../../library/pdb.rst:785 msgid "" @@ -1457,14 +1448,3 @@ msgstr "debugger(偵錯器)" #: ../../library/pdb.rst:396 msgid "configuration" msgstr "configuration(設定)" - -#~ msgid "" -#~ "If you use the ``silent`` command in the command list, the usual message " -#~ "about stopping at a breakpoint is not printed. This may be desirable for " -#~ "breakpoints that are to print a specific message and then continue. If " -#~ "none of the other commands print anything, you see no sign that the " -#~ "breakpoint was reached." -#~ msgstr "" -#~ "如果你在命令列表中使用 ``silent`` 命令,則平常會有的那些關於停止於斷點處的" -#~ "訊息就不會印出。對於要印出特定訊息再繼續的斷點來說,這可能會是需要的功能。" -#~ "如果其他命令都沒有印出任何內容,那你就看不到已到達斷點的跡象。" diff --git a/library/persistence.po b/library/persistence.po index 7e6edefbbdf..c4e707d4204 100644 --- a/library/persistence.po +++ b/library/persistence.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/pickle.po b/library/pickle.po index da8f3d678e4..e13aa653175 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Skylull, 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" @@ -304,7 +304,6 @@ msgstr "" "被 2.x 版本的 Python 拆封。在 3.0~3.7 的 Python 預設使用 3 版協定。" #: ../../library/pickle.rst:157 -#, fuzzy msgid "" "Protocol version 4 was added in Python 3.4. It adds support for very large " "objects, pickling more kinds of objects, and some data format " @@ -312,11 +311,10 @@ msgid "" "to :pep:`3154` for information about improvements brought by protocol 4." msgstr "" "版本 4 的協定在 Python 3.4 被新增。現在能支援超大物件的封裝、更多種型別的物件" -"以及針對部份資料格式的儲存進行最佳化。從 Python 3.8 起,預設使用第 4 版協定。" +"以及針對部份資料格式的儲存進行最佳化。從 Python 3.8 到 3.13,預設使用第 4 版協定。" "請參閱 :pep:`3154` 以了解第 4 版協定改進的細節。" #: ../../library/pickle.rst:163 -#, fuzzy msgid "" "Protocol version 5 was added in Python 3.8. It adds support for out-of-band " "data and speedup for in-band data. It is the default protocol starting with " @@ -324,7 +322,7 @@ msgid "" "by protocol 5." msgstr "" "版本 5 的協定在 Python 3.8 被新增。現在能支援帶外資料(Out-of-band data)並加" -"速帶內資料的處理速度。請參閱 :pep:`574` 以了解第 5 版協定改進的細節。" +"速帶內資料的處理速度。自 3.14 起這是預設使用的協定。請參閱 :pep:`574` 以了解第 5 版協定改進的細節。" # SkyLull: [T] # persistent -> 持久 @@ -387,7 +385,6 @@ msgstr "" "及 :class:`Pickler` 建構式。" #: ../../library/pickle.rst:201 -#, fuzzy msgid "" "An integer, the default :ref:`protocol version ` used for " "pickling. May be less than :data:`HIGHEST_PROTOCOL`. Currently the default " @@ -396,9 +393,10 @@ msgid "" "where :pep:`3118`-compatible data can be transmitted separately from the " "main pickle stream." msgstr "" -"一個整數,指示用於序列化的預設\\ :ref:`協定版本 `。有可能小" -"於 :data:`HIGHEST_PROTOCOL`。目前的預設協定版本為 4,是在 Python 3.4 中首次引" -"入的,且與先前版本不相容。" +"一個整數,用於 pickle 的預設 :ref:`協定版本 `。可能小於 " +":data:`HIGHEST_PROTOCOL`。目前預設協定是 5,在 Python 3.8 中引入,與之前的版本不相容。" +"此版本引入了對 out-of-band buffer 的支援,其中 :pep:`3118` 相容的資料可以與主要 " +"pickle 串流分開傳輸。" #: ../../library/pickle.rst:210 msgid "The default protocol is 3." @@ -409,9 +407,8 @@ msgid "The default protocol is 4." msgstr "預設協定版本為 4。" #: ../../library/pickle.rst:218 -#, fuzzy msgid "The default protocol is 5." -msgstr "預設協定版本為 3。" +msgstr "預設協定是 5。" #: ../../library/pickle.rst:220 msgid "" @@ -1335,7 +1332,6 @@ msgstr "" # SkyLull: [T] # signature: https://jo-jo.medium.com/c-c-%E5%B9%BC%E5%B9%BC%E7%8F%AD-%E7%B0%BD%E7%AB%A0signature-fa9b04e1a3e2 #: ../../library/pickle.rst:731 -#, fuzzy msgid "" "Optionally, an iterator (and not a sequence) yielding successive items. " "These items will be appended to the object either using ``obj.append(item)`` " @@ -1349,7 +1345,7 @@ msgstr "" "可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 " "``obj.append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被" "附加到物件中。主要用於串列(list)子類別,但只要其他類別具有相應" -"的 :ref:`append 和 extend 方法 `\\ 以及相同的函式簽章" +"的 :meth:`~sequence.append` 和 :meth:`~sequence.extend` 方法以及相同的函式簽章" "(signature)就也可以使用。 (是否會呼叫 :meth:`!append` 或 :meth:`!extend` " "方法將取決於所選用的 pickle 協定版本以及要附加的項目數量,因此必須同時支援這" "兩種方法。)" @@ -2427,9 +2423,8 @@ msgstr "" " data = pickle.load(f)" #: ../../library/pickle.rst:1216 -#, fuzzy msgid "Command-line interface" -msgstr "模組介面" +msgstr "命令列介面" #: ../../library/pickle.rst:1218 msgid "" @@ -2445,9 +2440,8 @@ msgid "python -m pickle pickle_file [pickle_file ...]" msgstr "" #: ../../library/pickle.rst:1228 -#, fuzzy msgid "The following option is accepted:" -msgstr "下列型別可以被封裝:" +msgstr "接受以下選項:" #: ../../library/pickle.rst:1234 msgid "" diff --git a/library/pickletools.po b/library/pickletools.po index 5e4ecb6fee0..ba821122504 100644 --- a/library/pickletools.po +++ b/library/pickletools.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" @@ -42,7 +42,6 @@ msgstr "" "發現 :mod:`pickletools` 模組。" #: ../../library/pickletools.rst:23 -#, fuzzy msgid "Command-line usage" msgstr "命令列用法" @@ -92,7 +91,6 @@ msgstr "" "highest protocol among opcodes = 2" #: ../../library/pickletools.rst:52 -#, fuzzy msgid "Command-line options" msgstr "命令列選項" @@ -114,7 +112,6 @@ msgid "" msgstr "當拆解多個物件時,會在拆解間保留備忘錄。" #: ../../library/pickletools.rst:75 -#, fuzzy msgid "" "When more than one pickle file is specified, print given preamble before " "each disassembly." @@ -127,7 +124,6 @@ msgid "" msgstr "" #: ../../library/pickletools.rst:85 -#, fuzzy msgid "Programmatic interface" msgstr "程式化介面" diff --git a/library/pipes.po b/library/pipes.po index 5abbbde3db0..7d97d0ca7a1 100644 --- a/library/pipes.po +++ b/library/pipes.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/pkgutil.po b/library/pkgutil.po index 42fa73f805a..77e0dd834ee 100644 --- a/library/pkgutil.po +++ b/library/pkgutil.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-03-08 16:07+0000\n" @@ -361,36 +361,3 @@ msgid "" msgstr "" ":exc:`AttributeError` -- 如果在遍歷引入套件中的物件層次結構以取得所需物件時發" "生失敗。" - -#~ msgid "Retrieve a module :term:`loader` for the given *fullname*." -#~ msgstr "取得給定之 *fullname* 的模組 :term:`loader`。" - -#~ msgid "" -#~ "This is a backwards compatibility wrapper " -#~ "around :func:`importlib.util.find_spec` that converts most failures " -#~ "to :exc:`ImportError` and only returns the loader rather than the " -#~ "full :class:`importlib.machinery.ModuleSpec`." -#~ msgstr "" -#~ "這是一個 :func:`importlib.util.find_spec` 的向後相容包裝器,它將大多數的失" -#~ "敗轉換為 :exc:`ImportError` 並且僅回傳載入器而不是完整" -#~ "的 :class:`importlib.machinery.ModuleSpec`。" - -#~ msgid "Updated to be based on :pep:`451`" -#~ msgstr "基於 :pep:`451` 來更新" - -#~ msgid "Use :func:`importlib.util.find_spec` instead." -#~ msgstr "改用 :func:`importlib.util.find_spec`。" - -#~ msgid "Get a :term:`loader` object for *module_or_name*." -#~ msgstr "取得 *module_or_name* 的 :term:`loader` 物件。" - -#~ msgid "" -#~ "If the module or package is accessible via the normal import mechanism, a " -#~ "wrapper around the relevant part of that machinery is returned. Returns " -#~ "``None`` if the module cannot be found or imported. If the named module " -#~ "is not already imported, its containing package (if any) is imported, in " -#~ "order to establish the package ``__path__``." -#~ msgstr "" -#~ "如果可以透過正常引入機制存取模組或套件,則回傳該機制相關部分的包裝器。如果" -#~ "找不到或無法引入模組,則回傳 ``None``。如果指定的模組尚未被引入,則引入其" -#~ "包含的套件(如有存在)以建立套件 ``__path__``。" diff --git a/library/platform.po b/library/platform.po index 094d59ed603..7e2ed8e70b6 100644 --- a/library/platform.po +++ b/library/platform.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,9 +6,9 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-09 05:11+0800\n" "PO-Revision-Date: 2022-06-11 14:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -298,14 +298,21 @@ msgid ":attr:`processor` is resolved late instead of immediately." msgstr ":attr:`processor` 會延遲解析,並非立即解析。" #: ../../library/platform.rst:192 +msgid "" +"Clear out the internal cache of information, such as the :func:`uname`. This " +"is typically useful when the platform's :func:`node` is changed by an " +"external process and one needs to retrieve the updated value." +msgstr "" + +#: ../../library/platform.rst:200 msgid "Java platform" msgstr "Java 平台" -#: ../../library/platform.rst:197 +#: ../../library/platform.rst:205 msgid "Version interface for Jython." msgstr "Jython 的版本介面。" -#: ../../library/platform.rst:199 +#: ../../library/platform.rst:207 msgid "" "Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a " "tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple " @@ -317,17 +324,17 @@ msgstr "" "os_version, os_arch)``。無法確定的值將被設為由參數所給定的預設值(預設均為 " "``''``\\ )。" -#: ../../library/platform.rst:204 +#: ../../library/platform.rst:212 msgid "" "It was largely untested, had a confusing API, and was only useful for Jython " "support." msgstr "" -#: ../../library/platform.rst:210 +#: ../../library/platform.rst:218 msgid "Windows platform" msgstr "Windows 平台" -#: ../../library/platform.rst:215 +#: ../../library/platform.rst:223 msgid "" "Get additional version information from the Windows Registry and return a " "tuple ``(release, version, csd, ptype)`` referring to OS release, version " @@ -339,7 +346,7 @@ msgstr "" "``(release, version, csd, ptype)``,它代表 OS 發行版、版本號、CSD 級別 " "(service pack) 和 OS 類型(多個/單個處理器)。" -#: ../../library/platform.rst:221 +#: ../../library/platform.rst:229 msgid "" "As a hint: *ptype* is ``'Uniprocessor Free'`` on single processor NT " "machines and ``'Multiprocessor Free'`` on multi processor machines. The " @@ -352,7 +359,7 @@ msgstr "" "錯程式。它也可能以 ``'Checked'`` 表示,代表該 OS 版本使用了除錯程式,即檢查引" "數、範圍等的程式。" -#: ../../library/platform.rst:229 +#: ../../library/platform.rst:237 msgid "" "Returns a string representing the current Windows edition, or ``None`` if " "the value cannot be determined. Possible values include but are not limited " @@ -362,7 +369,7 @@ msgstr "" "回傳一個代表目前 Windows 版本的字串。可能的值包括但不限於 ``'Enterprise'``、" "``'IoTUAP'``、``'ServerStandard'`` 和 ``'nanoserver'``。" -#: ../../library/platform.rst:237 +#: ../../library/platform.rst:245 msgid "" "Return ``True`` if the Windows edition returned by :func:`win32_edition` is " "recognized as an IoT edition." @@ -370,11 +377,11 @@ msgstr "" "如果 :func:`win32_edition` 回傳的 Windows 版本被識別為 IoT 版則回傳 " "``True``。" -#: ../../library/platform.rst:244 +#: ../../library/platform.rst:252 msgid "macOS platform" msgstr "macOS 平台" -#: ../../library/platform.rst:248 +#: ../../library/platform.rst:256 msgid "" "Get macOS version information and return it as tuple ``(release, " "versioninfo, machine)`` with *versioninfo* being a tuple ``(version, " @@ -384,53 +391,53 @@ msgstr "" "其中 *versioninfo* 是一個 tuple ``(version, dev_stage, " "non_release_version)``。" -#: ../../library/platform.rst:252 +#: ../../library/platform.rst:260 msgid "" "Entries which cannot be determined are set to ``''``. All tuple entries are " "strings." msgstr "無法確定的條目會被設為 ``''``。所有 tuple 條目均為字串。" -#: ../../library/platform.rst:256 +#: ../../library/platform.rst:264 msgid "iOS platform" msgstr "iOS 平台" -#: ../../library/platform.rst:260 +#: ../../library/platform.rst:268 msgid "" "Get iOS version information and return it as " "a :func:`~collections.namedtuple` with the following attributes:" msgstr "" -#: ../../library/platform.rst:263 +#: ../../library/platform.rst:271 msgid "``system`` is the OS name; either ``'iOS'`` or ``'iPadOS'``." msgstr "``system`` 是 OS 名稱;可能是 ``'iOS'`` 或 ``'iPadOS'``。" -#: ../../library/platform.rst:264 +#: ../../library/platform.rst:272 msgid "``release`` is the iOS version number as a string (e.g., ``'17.2'``)." msgstr "" -#: ../../library/platform.rst:265 +#: ../../library/platform.rst:273 msgid "" "``model`` is the device model identifier; this will be a string like " "``'iPhone13,2'`` for a physical device, or ``'iPhone'`` on a simulator." msgstr "" -#: ../../library/platform.rst:267 +#: ../../library/platform.rst:275 msgid "" "``is_simulator`` is a boolean describing if the app is running on a " "simulator or a physical device." msgstr "" -#: ../../library/platform.rst:270 +#: ../../library/platform.rst:278 msgid "" "Entries which cannot be determined are set to the defaults given as " "parameters." msgstr "無法確定的條目會被設定為以參數給定的預設值。" -#: ../../library/platform.rst:275 +#: ../../library/platform.rst:283 msgid "Unix platforms" msgstr "Unix 平台" -#: ../../library/platform.rst:279 +#: ../../library/platform.rst:287 msgid "" "Tries to determine the libc version against which the file executable " "(defaults to the Python interpreter) is linked. Returns a tuple of strings " @@ -440,7 +447,7 @@ msgstr "" "嘗試確認可執行檔案(預設為 Python 直譯器)所連結到的 libc 版本。回傳一個字串 " "tuple ``(lib, version)``,當查詢失敗時其預設值將被設為給定的參數值。" -#: ../../library/platform.rst:283 +#: ../../library/platform.rst:291 msgid "" "Note that this function has intimate knowledge of how different libc " "versions add symbols to the executable is probably only usable for " @@ -449,15 +456,15 @@ msgstr "" "請注意,此函式對於不同 libc 版本如何為可執行檔案新增符號的方式有深層的關聯," "可能僅適用於以 :program:`gcc` 編譯出來的可執行檔案。" -#: ../../library/platform.rst:287 +#: ../../library/platform.rst:295 msgid "The file is read and scanned in chunks of *chunksize* bytes." msgstr "檔案會以 *chunksize* 位元組大小的分塊 (chunk) 來讀取和掃描。" -#: ../../library/platform.rst:291 +#: ../../library/platform.rst:299 msgid "Linux platforms" msgstr "Linux 平台" -#: ../../library/platform.rst:295 +#: ../../library/platform.rst:303 msgid "" "Get operating system identification from ``os-release`` file and return it " "as a dict. The ``os-release`` file is a `freedesktop.org standard `_、並在大多數 Linux 發行版上可用。一個重要的例外" "是 Android 和基於 Android 的發行版。" -#: ../../library/platform.rst:301 +#: ../../library/platform.rst:309 msgid "" "Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor ``/" "usr/lib/os-release`` can be read." @@ -478,7 +485,7 @@ msgstr "" "當 ``/etc/os-release`` 與 ``/usr/lib/os-release`` 均無法被讀取時將引" "發 :exc:`OSError` 或其子類別。" -#: ../../library/platform.rst:304 +#: ../../library/platform.rst:312 msgid "" "On success, the function returns a dictionary where keys and values are " "strings. Values have their special characters like ``\"`` and ``$`` " @@ -491,7 +498,7 @@ msgstr "" "``PRETTY_NAME`` 總會按照標準來定義。所有其他欄位都是可選的。根據不同廠商可能" "會包括額外的欄位。" -#: ../../library/platform.rst:310 +#: ../../library/platform.rst:318 msgid "" "Note that fields like ``NAME``, ``VERSION``, and ``VARIANT`` are strings " "suitable for presentation to users. Programs should use fields like ``ID``, " @@ -502,11 +509,11 @@ msgstr "" "串。程式應當使用 ``ID``、``ID_LIKE``、``VERSION_ID`` 或 ``VARIANT_ID`` 等欄位" "來標識 Linux 發行版。" -#: ../../library/platform.rst:315 +#: ../../library/platform.rst:323 msgid "Example::" msgstr "範例: ::" -#: ../../library/platform.rst:317 +#: ../../library/platform.rst:325 msgid "" "def get_like_distro():\n" " info = platform.freedesktop_os_release()\n" @@ -517,103 +524,95 @@ msgid "" " return ids" msgstr "" -#: ../../library/platform.rst:329 +#: ../../library/platform.rst:337 msgid "Android platform" msgstr "Android 平台" -#: ../../library/platform.rst:334 +#: ../../library/platform.rst:342 msgid "" "Get Android device information. Returns a :func:`~collections.namedtuple` " "with the following attributes. Values which cannot be determined are set to " "the defaults given as parameters." msgstr "" -#: ../../library/platform.rst:338 +#: ../../library/platform.rst:346 msgid "``release`` - Android version, as a string (e.g. ``\"14\"``)." msgstr "" -#: ../../library/platform.rst:340 +#: ../../library/platform.rst:348 msgid "" "``api_level`` - API level of the running device, as an integer (e.g. ``34`` " "for Android 14). To get the API level which Python was built against, " "see :func:`sys.getandroidapilevel`." msgstr "" -#: ../../library/platform.rst:344 +#: ../../library/platform.rst:352 msgid "" "``manufacturer`` - `Manufacturer name `__." msgstr "" -#: ../../library/platform.rst:347 +#: ../../library/platform.rst:355 msgid "" "``model`` - `Model name `__ – typically the marketing name or model number." msgstr "" -#: ../../library/platform.rst:351 +#: ../../library/platform.rst:359 msgid "" "``device`` - `Device name `__ – typically the model number or a codename." msgstr "" -#: ../../library/platform.rst:355 +#: ../../library/platform.rst:363 msgid "" "``is_emulator`` - ``True`` if the device is an emulator; ``False`` if it's a " "physical device." msgstr "" -#: ../../library/platform.rst:358 +#: ../../library/platform.rst:366 msgid "" "Google maintains a `list of known model and device names `__." msgstr "" -#: ../../library/platform.rst:366 +#: ../../library/platform.rst:374 msgid "Command-line usage" msgstr "命令列用法" -#: ../../library/platform.rst:368 +#: ../../library/platform.rst:376 msgid "" ":mod:`platform` can also be invoked directly using the :option:`-m` switch " "of the interpreter::" msgstr "" -#: ../../library/platform.rst:371 +#: ../../library/platform.rst:379 msgid "python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]" msgstr "python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]" -#: ../../library/platform.rst:373 +#: ../../library/platform.rst:381 msgid "The following options are accepted:" msgstr "可接受以下選項:" -#: ../../library/platform.rst:379 +#: ../../library/platform.rst:387 msgid "" "Print terse information about the platform. This is equivalent to " "calling :func:`platform.platform` with the *terse* argument set to ``True``." msgstr "" -#: ../../library/platform.rst:384 +#: ../../library/platform.rst:392 msgid "" "Print platform information without system/OS name aliasing. This is " "equivalent to calling :func:`platform.platform` with the *aliased* argument " "set to ``True``." msgstr "" -#: ../../library/platform.rst:388 +#: ../../library/platform.rst:396 msgid "" "You can also pass one or more positional arguments (``terse``, " "``nonaliased``) to explicitly control the output format. These behave " "similarly to their corresponding options." msgstr "" -#: ../../library/platform.rst:393 -msgid "Miscellaneous" -msgstr "" - -#: ../../library/platform.rst:397 -msgid "" -"Clear out the internal cache of information, such as the :func:`uname`. This " -"is typically useful when the platform's :func:`node` is changed by an " -"external process and one needs to retrieve the updated value." -msgstr "" +#~ msgid "Miscellaneous" +#~ msgstr "雜項" diff --git a/library/plistlib.po b/library/plistlib.po index 3884d2ca087..7525bc142c7 100644 --- a/library/plistlib.po +++ b/library/plistlib.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2016-01-31 07:27+0000\n" diff --git a/library/poplib.po b/library/poplib.po index d4e44ecb172..97c9dfd7d83 100644 --- a/library/poplib.po +++ b/library/poplib.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" diff --git a/library/posix.po b/library/posix.po index b9f4d109659..89cb774b4d2 100644 --- a/library/posix.po +++ b/library/posix.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2023-01-24 00:05+0800\n" diff --git a/library/pprint.po b/library/pprint.po index 4af53841603..7a0e5fc47a3 100644 --- a/library/pprint.po +++ b/library/pprint.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-15 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" diff --git a/library/profile.po b/library/profile.po index 4d84edf4230..91d1beb1a03 100644 --- a/library/profile.po +++ b/library/profile.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-17 00:18+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" diff --git a/library/pty.po b/library/pty.po index 95d91da398e..36287eab348 100644 --- a/library/pty.po +++ b/library/pty.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2016-11-19 00:33+0000\n" diff --git a/library/pwd.po b/library/pwd.po index 598dfe3ff8a..12652ba0bb6 100644 --- a/library/pwd.po +++ b/library/pwd.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2023-05-20 16:08+0800\n" diff --git a/library/py_compile.po b/library/py_compile.po index c7c02a8446a..993a79112bc 100644 --- a/library/py_compile.po +++ b/library/py_compile.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" diff --git a/library/pyclbr.po b/library/pyclbr.po index 8a1f455cb7a..d7edc9beaef 100644 --- a/library/pyclbr.po +++ b/library/pyclbr.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2025-07-09 13:16+0800\n" diff --git a/library/pydoc.po b/library/pydoc.po index 821369f0e5e..282de3c1a11 100644 --- a/library/pydoc.po +++ b/library/pydoc.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Dr-XYZ , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-30 00:13+0000\n" "PO-Revision-Date: 2025-07-17 17:00+0800\n" @@ -81,7 +81,7 @@ msgid "" "file, then documentation is produced for that file." msgstr "" "在 shell 提示字元下,將會顯示 :mod:`sys` 模組的文件,其風格類似於 Unix :" -"program:`man` 命令所顯示的手冊頁面。:program:`pydoc` 的引數可以是函式、模組或" +"program:`man` 命令所顯示的使用手冊。:program:`pydoc` 的引數可以是函式、模組或" "套件的名稱,或是一個指向模組中或套件中模組內的類別、方法或函式的點號參照 (dotted reference)。如" "果 :program:`pydoc` 的引數看起來像一個路徑(也就是說,它包含你作業系統的路徑" "分隔符,例如 Unix 中的斜線),並且指向一個已存在的 Python 原始碼檔案,那麼就" @@ -191,7 +191,7 @@ msgid "" msgstr "" "核心模組的文件被假定存放在 ``https://docs.python.org/X.Y/library/``,其中 " "``X`` 和 ``Y`` 是 Python 直譯器的主版本號和次版本號。這可以透過將 :envvar:`!" -"PYTHONDOCS` 環境變數設定為不同的 URL 或包含函式庫參考手冊頁面的本機目錄來覆" +"PYTHONDOCS` 環境變數設定為不同的 URL 或包含函式庫參考使用手冊的本機目錄來覆" "寫。" #: ../../library/pydoc.rst:98 diff --git a/library/pyexpat.po b/library/pyexpat.po index adbf2937581..f126531d45f 100644 --- a/library/pyexpat.po +++ b/library/pyexpat.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" diff --git a/library/python.po b/library/python.po index 54a3e5e79d6..3c1a65b1256 100644 --- a/library/python.po +++ b/library/python.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" @@ -35,3 +35,4 @@ msgid "" "See the :mod:`concurrent.interpreters` module, which similarly exposes core " "runtime functionality." msgstr "" +"請參閱 :mod:`concurrent.interpreters` 模組,它同樣揭露了核心的 runtime 功能。" diff --git a/library/queue.po b/library/queue.po index ef13ffbcf5d..37d2064deae 100644 --- a/library/queue.po +++ b/library/queue.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-09-27 00:12+0800\n" diff --git a/library/quopri.po b/library/quopri.po index f4dccd0e0d2..50ddf5f0575 100644 --- a/library/quopri.po +++ b/library/quopri.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2023-07-01 14:59+0800\n" diff --git a/library/random.po b/library/random.po index beb245217da..05bc501e92f 100644 --- a/library/random.po +++ b/library/random.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Dr.XYZ , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2025-03-07 19:17+0800\n" diff --git a/library/re.po b/library/re.po index 97394eb1b7d..3144c750c06 100644 --- a/library/re.po +++ b/library/re.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leo Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-09-16 14:49+0800\n" diff --git a/library/readline.po b/library/readline.po index f26d45fc2be..cccb0ce363a 100644 --- a/library/readline.po +++ b/library/readline.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" diff --git a/library/removed.po b/library/removed.po index c13cb4637f9..93019a15d09 100644 --- a/library/removed.po +++ b/library/removed.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/reprlib.po b/library/reprlib.po index ee821761315..cdd7b781f3f 100644 --- a/library/reprlib.po +++ b/library/reprlib.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/resource.po b/library/resource.po index 4bbf3d4a18a..5dc559f7885 100644 --- a/library/resource.po +++ b/library/resource.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" diff --git a/library/rlcompleter.po b/library/rlcompleter.po index c40e220e6e3..aecd565c788 100644 --- a/library/rlcompleter.po +++ b/library/rlcompleter.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/runpy.po b/library/runpy.po index 3ff8f9771d0..c03ca834889 100644 --- a/library/runpy.po +++ b/library/runpy.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2016-11-19 00:33+0000\n" diff --git a/library/sched.po b/library/sched.po index 2fa14ca9242..0f131c8b9ec 100644 --- a/library/sched.po +++ b/library/sched.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-05-09 16:09+0000\n" diff --git a/library/secrets.po b/library/secrets.po index 3677d7f231b..d06c17d6867 100644 --- a/library/secrets.po +++ b/library/secrets.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # bonzo , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2022-11-30 13:42+0800\n" diff --git a/library/security_warnings.po b/library/security_warnings.po index 498084b77aa..0d4d2cc5805 100644 --- a/library/security_warnings.po +++ b/library/security_warnings.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2023-08-21 02:41+0000\n" diff --git a/library/select.po b/library/select.po index 05a6a9bd438..9c6bd9622f0 100644 --- a/library/select.po +++ b/library/select.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" @@ -471,9 +470,8 @@ msgid "Ignored." msgstr "" #: ../../library/select.rst:320 -#, fuzzy msgid ":const:`EPOLLWAKEUP`" -msgstr ":const:`EPOLLHUP`" +msgstr ":const:`EPOLLWAKEUP`" #: ../../library/select.rst:320 msgid "Prevents sleep during event waiting." diff --git a/library/selectors.po b/library/selectors.po index bb86594fdb2..f2ff1211e86 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" diff --git a/library/shelve.po b/library/shelve.po index 868c1e555ec..ab84e4b28ab 100644 --- a/library/shelve.po +++ b/library/shelve.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" diff --git a/library/shlex.po b/library/shlex.po index 2ba7f9fb434..30aafe8cbac 100644 --- a/library/shlex.po +++ b/library/shlex.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" diff --git a/library/shutil.po b/library/shutil.po index f4375bf8936..c50c958d1c4 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" @@ -1198,7 +1198,6 @@ msgid "" msgstr "" #: ../../library/shutil.rst:861 -#, fuzzy msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1220,7 +1219,7 @@ msgstr "" "... root_dir='tmp/root',\n" "... base_dir='structure/content',\n" "... )\n" -"'/Users/tarek/myarchive.tar'" +"'/Users/tarek/my_archive.tar'" #: ../../library/shutil.rst:872 msgid "Listing the files in the resulting archive gives us:" diff --git a/library/signal.po b/library/signal.po index 5ac672a65d5..1d05f6b606a 100644 --- a/library/signal.po +++ b/library/signal.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-04-15 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" diff --git a/library/site.po b/library/site.po index 924a1f9278b..551feaa4e00 100644 --- a/library/site.po +++ b/library/site.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" diff --git a/library/smtpd.po b/library/smtpd.po index 1bd616eb4c3..f3ec095b1b7 100644 --- a/library/smtpd.po +++ b/library/smtpd.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/smtplib.po b/library/smtplib.po index 6dba7d27ec2..e16d62ed9d3 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-12 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" diff --git a/library/sndhdr.po b/library/sndhdr.po index 1f2b9ff4763..1cc5272b721 100644 --- a/library/sndhdr.po +++ b/library/sndhdr.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/socket.po b/library/socket.po index d570420e8ae..5a2604cb141 100644 --- a/library/socket.po +++ b/library/socket.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-12-30 23:45+0800\n" diff --git a/library/socketserver.po b/library/socketserver.po index 3a381adc735..e2e1ed211f7 100644 --- a/library/socketserver.po +++ b/library/socketserver.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" diff --git a/library/spwd.po b/library/spwd.po index adcb3a75916..f984a9251d5 100644 --- a/library/spwd.po +++ b/library/spwd.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/sqlite3.po b/library/sqlite3.po index 04ec4d7edd7..027f5d04322 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" diff --git a/library/ssl.po b/library/ssl.po index d59586f6f5c..ed5e9b69338 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" @@ -1282,9 +1282,8 @@ msgid "Whether the OpenSSL library has built-in support for TLS-PSK." msgstr "此 OpenSSL 函式庫是否內建支援 TLS-PSK。" #: ../../library/ssl.rst:939 -#, fuzzy msgid "Whether the OpenSSL library has built-in support for TLS-PHA." -msgstr "此 OpenSSL 函式庫是否內建支援 TLS-PSK。" +msgstr "此 OpenSSL 函式庫是否內建支援 TLS-PHA。" #: ../../library/ssl.rst:945 msgid "" @@ -2201,7 +2200,7 @@ msgstr "" #: ../../library/ssl.rst:1538 msgid "New optional argument *password*." -msgstr "" +msgstr "新增可選引數 *password*。" #: ../../library/ssl.rst:1543 msgid "" @@ -2260,7 +2259,7 @@ msgstr "" #: ../../library/ssl.rst:1582 msgid "New optional argument *cadata*" -msgstr "" +msgstr "新增可選引數 *cadata*" #: ../../library/ssl.rst:1587 msgid "" @@ -2765,7 +2764,7 @@ msgstr "" #: ../../library/ssl.rst:1975 msgid ":attr:`SSLContext.options` returns :class:`Options` flags:" -msgstr "" +msgstr ":attr:`SSLContext.options` 會回傳 :class:`Options` 旗標:" #: ../../library/ssl.rst:1983 msgid "" @@ -2843,7 +2842,7 @@ msgstr "" #: ../../library/ssl.rst:2051 msgid ":attr:`SSLContext.verify_mode` returns :class:`VerifyMode` enum:" -msgstr "" +msgstr ":attr:`SSLContext.verify_mode` 會回傳 :class:`VerifyMode` 列舉:" #: ../../library/ssl.rst:2059 msgid "" diff --git a/library/stat.po b/library/stat.po index dfd50167873..0034b006e3d 100644 --- a/library/stat.po +++ b/library/stat.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2016-11-19 00:34+0000\n" diff --git a/library/statistics.po b/library/statistics.po index 30c55ed953d..c957d1b2f2a 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # KentHsu , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2023-07-22 21:15+0800\n" diff --git a/library/stdtypes.po b/library/stdtypes.po index 6cca57a4839..9192ab4199a 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,9 +7,9 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -415,7 +415,6 @@ msgstr "" "的數字。" #: ../../library/stdtypes.rst:266 -#, fuzzy msgid "" "Python fully supports mixed arithmetic: when a binary arithmetic operator " "has operands of different numeric types, the operand with the \"narrower\" " @@ -424,14 +423,16 @@ msgid "" "usual mathematical formula, for example::" msgstr "" "Python 完全支援混和運算:當一個二元運算子的運算元有不同數值型別時,「較窄」型" -"別的運算元會被拓寬到另一個型別的運算元;在此處,整數窄於浮點數,浮點數又窄於" -"複數。不同型別的數字間的比較等同於這些數字的精確值進行比較。[2]_" +"別的運算元會被拓寬到另一個型別的運算元;在此處,整數窄於浮點數。複數及實數運" +"算元的運算是由一般的數學公式所定義,例如: ::" #: ../../library/stdtypes.rst:272 msgid "" "x + complex(u, v) = complex(x + u, v)\n" "x * complex(u, v) = complex(x * u, x * v)" msgstr "" +"x + complex(u, v) = complex(x + u, v)\n" +"x * complex(u, v) = complex(x * u, x * v)" #: ../../library/stdtypes.rst:275 msgid "" @@ -676,7 +677,7 @@ msgid "" "Unicode equivalent (code points with the ``Nd`` property)." msgstr "" "字面數值接受包含數字 ``0`` 到 ``9`` 或任何等效的 Unicode 字元(具有 ``Nd`` 屬" -"性的 code points(碼位))。" +"性的 code points(編碼位置))。" #: ../../library/stdtypes.rst:364 msgid "" @@ -853,7 +854,7 @@ msgstr "" #: ../../library/stdtypes.rst:459 msgid "Additional Methods on Integer Types" -msgstr "整數型別的附加 methods" +msgstr "整數型別的附加方法" #: ../../library/stdtypes.rst:461 msgid "" @@ -861,7 +862,7 @@ msgid "" "class`. In addition, it provides a few more methods:" msgstr "" "整數型別實作了 :class:`numbers.Integral` :term:`抽象基底類別 `。此外,它提供了一些 methods:" +"class>`。此外,它提供了一些方法:" #: ../../library/stdtypes.rst:466 msgid "" @@ -1107,7 +1108,7 @@ msgstr "回傳 ``True``。為了與 :meth:`float.is_integer` 的鴨子型別相 #: ../../library/stdtypes.rst:629 msgid "Additional Methods on Float" -msgstr "浮點數的附加 methods" +msgstr "浮點數的附加方法" #: ../../library/stdtypes.rst:631 msgid "" @@ -1115,7 +1116,7 @@ msgid "" "class`. float also has the following additional methods." msgstr "" "浮點數型別實作了 :class:`numbers.Real` :term:`抽象基底類別 `。浮點數也有下列附加 methods。" +"class>`。浮點數也有下列附加方法。" #: ../../library/stdtypes.rst:636 msgid "" @@ -1268,23 +1269,21 @@ msgstr "" "'0x1.d380000000000p+11'" #: ../../library/stdtypes.rst:730 -#, fuzzy msgid "Additional Methods on Complex" -msgstr "浮點數的附加 methods" +msgstr "複數的附加方法" #: ../../library/stdtypes.rst:732 -#, fuzzy msgid "" "The :class:`!complex` type implements " "the :class:`numbers.Complex` :term:`abstract base class`. :class:`!complex` " "also has the following additional methods." msgstr "" -"浮點數型別實作了 :class:`numbers.Real` :term:`抽象基底類別 `。浮點數也有下列附加 methods。" +":class:`!complex` 型別實作了 :class:`numbers.Complex` :term:`抽象基底類別 " +"`。:class:`!complex` 也有下列附加方法。" #: ../../library/stdtypes.rst:738 msgid "Class method to convert a number to a complex number." -msgstr "" +msgstr "將一個數字轉換為複數的類別方法。" #: ../../library/stdtypes.rst:740 msgid "" @@ -1693,9 +1692,8 @@ msgid "*i*\\ th item of *s*, origin 0" msgstr "*s* 的第 *i* 項,起始為 0" #: ../../library/stdtypes.rst:1019 -#, fuzzy msgid "(3)(8)" -msgstr "(3)(9)" +msgstr "(3)(8)" #: ../../library/stdtypes.rst:1021 msgid "``s[i:j]``" @@ -1905,27 +1903,24 @@ msgid "An :exc:`IndexError` is raised if *i* is outside the sequence range." msgstr "" #: ../../library/stdtypes.rst:1140 -#, fuzzy msgid "Sequence Methods" -msgstr "pop()(序列方法)" +msgstr "序列方法" #: ../../library/stdtypes.rst:1141 msgid "Sequence types also support the following methods:" -msgstr "" +msgstr "序列型別也支援以下方法:" #: ../../library/stdtypes.rst:1151 -#, fuzzy msgid "Return the total number of occurrences of *value* in *sequence*." -msgstr "*s* 中 *x* 的總出現次數" +msgstr "回傳 *sequence* 中 *value* 出現的總次數。" #: ../../library/stdtypes.rst:1161 msgid "Return the index of the first occurrence of *value* in *sequence*." -msgstr "" +msgstr "回傳 *sequence* 中 *value* 首次出現的索引。" #: ../../library/stdtypes.rst:1163 ../../library/stdtypes.rst:1347 -#, fuzzy msgid "Raises :exc:`ValueError` if *value* is not found in *sequence*." -msgstr "在 *x* 不在 *s* 中時 :meth:`remove` 會引發 :exc:`ValueError`。" +msgstr "當 *value* 不在 *sequence* 中時引發 :exc:`ValueError`。" #: ../../library/stdtypes.rst:1165 msgid "" @@ -1942,7 +1937,7 @@ msgstr "" #: ../../library/stdtypes.rst:1177 msgid "Immutable Sequence Types" -msgstr "" +msgstr "不可變序列型別" #: ../../library/stdtypes.rst:1184 msgid "" @@ -1966,7 +1961,7 @@ msgstr "" #: ../../library/stdtypes.rst:1199 msgid "Mutable Sequence Types" -msgstr "" +msgstr "可變序列型別" #: ../../library/stdtypes.rst:1206 msgid "" @@ -2034,9 +2029,8 @@ msgid "removes the elements of ``s[i:j:k]`` from the list" msgstr "移除串列中 ``s[i:j:k]`` 的元素" #: ../../library/stdtypes.rst:1245 -#, fuzzy msgid "``s += t``" -msgstr "``s + t``" +msgstr "``s += t``" #: ../../library/stdtypes.rst:1245 msgid "" @@ -2068,13 +2062,12 @@ msgid "" msgstr "" #: ../../library/stdtypes.rst:1266 -#, fuzzy msgid "Mutable Sequence Methods" -msgstr "mutable sequence(可變序列)" +msgstr "可變序列方法" #: ../../library/stdtypes.rst:1267 msgid "Mutable sequence types also support the following methods:" -msgstr "" +msgstr "可變序列型別也支援以下方法:" #: ../../library/stdtypes.rst:1276 msgid "" @@ -2083,18 +2076,16 @@ msgid "" msgstr "" #: ../../library/stdtypes.rst:1288 -#, fuzzy msgid "" "Remove all items from *sequence*. This is equivalent to writing ``del " "sequence[:]``." -msgstr "移除 *s* 中的所有項目(和 ``del s[:]`` 相同)" +msgstr "移除 *sequence* 中的所有項目,這和 ``del sequence[:]`` 相同。" #: ../../library/stdtypes.rst:1300 -#, fuzzy msgid "" "Create a shallow copy of *sequence*. This is equivalent to writing " "``sequence[:]``." -msgstr "建立 *s* 的淺層複製(和 ``s[:]`` 相同)" +msgstr "建立 *sequence* 的淺層複製,這和 ``sequence[:]`` 相同。" #: ../../library/stdtypes.rst:1303 msgid "" @@ -2488,378 +2479,371 @@ msgstr "" #: ../../library/stdtypes.rst:1624 msgid "Category" -msgstr "" +msgstr "分類" #: ../../library/stdtypes.rst:1624 -#, fuzzy msgid ":class:`str` methods" -msgstr ":class:`set`" +msgstr ":class:`str` 方法" #: ../../library/stdtypes.rst:1624 -#, fuzzy msgid ":class:`bytes` and :class:`bytearray` methods" -msgstr ":class:`memoryview` 有幾個方法:" +msgstr ":class:`bytes` 和 :class:`bytearray` 方法" #: ../../library/stdtypes.rst:1626 -#, fuzzy msgid "Formatting" -msgstr "formatting(格式化)" +msgstr "格式化" #: ../../library/stdtypes.rst:1626 msgid ":meth:`str.format`" -msgstr "" +msgstr ":meth:`str.format`" #: ../../library/stdtypes.rst:1628 msgid ":meth:`str.format_map`" -msgstr "" +msgstr ":meth:`str.format_map`" #: ../../library/stdtypes.rst:1630 -#, fuzzy msgid ":ref:`f-strings`" -msgstr "f-string(f 字串)" +msgstr ":ref:`f-strings`" #: ../../library/stdtypes.rst:1632 msgid ":ref:`old-string-formatting`" -msgstr "" +msgstr ":ref:`old-string-formatting`" #: ../../library/stdtypes.rst:1632 -#, fuzzy msgid ":ref:`bytes-formatting`" -msgstr "printf 風格格式化" +msgstr ":ref:`bytes-formatting`" #: ../../library/stdtypes.rst:1634 msgid "Searching and Replacing" -msgstr "" +msgstr "搜尋和取代" #: ../../library/stdtypes.rst:1634 msgid ":meth:`str.find`" -msgstr "" +msgstr ":meth:`str.find`" #: ../../library/stdtypes.rst:1634 msgid ":meth:`str.rfind`" -msgstr "" +msgstr ":meth:`str.rfind`" #: ../../library/stdtypes.rst:1634 msgid ":meth:`bytes.find`" -msgstr "" +msgstr ":meth:`bytes.find`" #: ../../library/stdtypes.rst:1634 msgid ":meth:`bytes.rfind`" -msgstr "" +msgstr ":meth:`bytes.rfind`" #: ../../library/stdtypes.rst:1636 msgid ":meth:`str.index`" -msgstr "" +msgstr ":meth:`str.index`" #: ../../library/stdtypes.rst:1636 msgid ":meth:`str.rindex`" -msgstr "" +msgstr ":meth:`str.rindex`" #: ../../library/stdtypes.rst:1636 msgid ":meth:`bytes.index`" -msgstr "" +msgstr ":meth:`bytes.index`" #: ../../library/stdtypes.rst:1636 msgid ":meth:`bytes.rindex`" -msgstr "" +msgstr ":meth:`bytes.rindex`" #: ../../library/stdtypes.rst:1638 msgid ":meth:`str.startswith`" -msgstr "" +msgstr ":meth:`str.startswith`" #: ../../library/stdtypes.rst:1638 msgid ":meth:`bytes.startswith`" -msgstr "" +msgstr ":meth:`bytes.startswith`" #: ../../library/stdtypes.rst:1640 msgid ":meth:`str.endswith`" -msgstr "" +msgstr ":meth:`str.endswith`" #: ../../library/stdtypes.rst:1640 msgid ":meth:`bytes.endswith`" -msgstr "" +msgstr ":meth:`bytes.endswith`" #: ../../library/stdtypes.rst:1642 msgid ":meth:`str.count`" -msgstr "" +msgstr ":meth:`str.count`" #: ../../library/stdtypes.rst:1642 msgid ":meth:`bytes.count`" -msgstr "" +msgstr ":meth:`bytes.count`" #: ../../library/stdtypes.rst:1644 msgid ":meth:`str.replace`" -msgstr "" +msgstr ":meth:`str.replace`" #: ../../library/stdtypes.rst:1644 msgid ":meth:`bytes.replace`" -msgstr "" +msgstr ":meth:`bytes.replace`" #: ../../library/stdtypes.rst:1646 msgid "Splitting and Joining" -msgstr "" +msgstr "分割和連接" #: ../../library/stdtypes.rst:1646 msgid ":meth:`str.split`" -msgstr "" +msgstr ":meth:`str.split`" #: ../../library/stdtypes.rst:1646 msgid ":meth:`str.rsplit`" -msgstr "" +msgstr ":meth:`str.rsplit`" #: ../../library/stdtypes.rst:1646 msgid ":meth:`bytes.split`" -msgstr "" +msgstr ":meth:`bytes.split`" #: ../../library/stdtypes.rst:1646 msgid ":meth:`bytes.rsplit`" -msgstr "" +msgstr ":meth:`bytes.rsplit`" #: ../../library/stdtypes.rst:1648 -#, fuzzy msgid ":meth:`str.splitlines`" -msgstr "str.splitlines 方法" +msgstr ":meth:`str.splitlines`" #: ../../library/stdtypes.rst:1648 -#, fuzzy msgid ":meth:`bytes.splitlines`" -msgstr "bytes.splitlines 方法" +msgstr ":meth:`bytes.splitlines`" #: ../../library/stdtypes.rst:1650 msgid ":meth:`str.partition`" -msgstr "" +msgstr ":meth:`str.partition`" #: ../../library/stdtypes.rst:1650 msgid ":meth:`bytes.partition`" -msgstr "" +msgstr ":meth:`bytes.partition`" #: ../../library/stdtypes.rst:1652 msgid ":meth:`str.rpartition`" -msgstr "" +msgstr ":meth:`str.rpartition`" #: ../../library/stdtypes.rst:1652 msgid ":meth:`bytes.rpartition`" -msgstr "" +msgstr ":meth:`bytes.rpartition`" #: ../../library/stdtypes.rst:1654 msgid ":meth:`str.join`" -msgstr "" +msgstr ":meth:`str.join`" #: ../../library/stdtypes.rst:1654 msgid ":meth:`bytes.join`" -msgstr "" +msgstr ":meth:`bytes.join`" #: ../../library/stdtypes.rst:1656 msgid "String Classification" -msgstr "" +msgstr "字串分類" #: ../../library/stdtypes.rst:1656 msgid ":meth:`str.isalpha`" -msgstr "" +msgstr ":meth:`str.isalpha`" #: ../../library/stdtypes.rst:1656 msgid ":meth:`bytes.isalpha`" -msgstr "" +msgstr ":meth:`bytes.isalpha`" #: ../../library/stdtypes.rst:1658 msgid ":meth:`str.isdecimal`" -msgstr "" +msgstr ":meth:`str.isdecimal`" #: ../../library/stdtypes.rst:1660 msgid ":meth:`str.isdigit`" -msgstr "" +msgstr ":meth:`str.isdigit`" #: ../../library/stdtypes.rst:1660 msgid ":meth:`bytes.isdigit`" -msgstr "" +msgstr ":meth:`bytes.isdigit`" #: ../../library/stdtypes.rst:1662 msgid ":meth:`str.isnumeric`" -msgstr "" +msgstr ":meth:`str.isnumeric`" #: ../../library/stdtypes.rst:1664 msgid ":meth:`str.isalnum`" -msgstr "" +msgstr ":meth:`str.isalnum`" #: ../../library/stdtypes.rst:1664 msgid ":meth:`bytes.isalnum`" -msgstr "" +msgstr ":meth:`bytes.isalnum`" #: ../../library/stdtypes.rst:1666 msgid ":meth:`str.isidentifier`" -msgstr "" +msgstr ":meth:`str.isidentifier`" #: ../../library/stdtypes.rst:1668 msgid ":meth:`str.islower`" -msgstr "" +msgstr ":meth:`str.islower`" #: ../../library/stdtypes.rst:1668 msgid ":meth:`bytes.islower`" -msgstr "" +msgstr ":meth:`bytes.islower`" #: ../../library/stdtypes.rst:1670 msgid ":meth:`str.isupper`" -msgstr "" +msgstr ":meth:`str.isupper`" #: ../../library/stdtypes.rst:1670 msgid ":meth:`bytes.isupper`" -msgstr "" +msgstr ":meth:`bytes.isupper`" #: ../../library/stdtypes.rst:1672 msgid ":meth:`str.istitle`" -msgstr "" +msgstr ":meth:`str.istitle`" #: ../../library/stdtypes.rst:1672 msgid ":meth:`bytes.istitle`" -msgstr "" +msgstr ":meth:`bytes.istitle`" #: ../../library/stdtypes.rst:1674 msgid ":meth:`str.isspace`" -msgstr "" +msgstr ":meth:`str.isspace`" #: ../../library/stdtypes.rst:1674 msgid ":meth:`bytes.isspace`" -msgstr "" +msgstr ":meth:`bytes.isspace`" #: ../../library/stdtypes.rst:1676 msgid ":meth:`str.isprintable`" -msgstr "" +msgstr ":meth:`str.isprintable`" #: ../../library/stdtypes.rst:1678 msgid "Case Manipulation" -msgstr "" +msgstr "大小寫操作" #: ../../library/stdtypes.rst:1678 msgid ":meth:`str.lower`" -msgstr "" +msgstr ":meth:`str.lower`" #: ../../library/stdtypes.rst:1678 msgid ":meth:`bytes.lower`" -msgstr "" +msgstr ":meth:`bytes.lower`" #: ../../library/stdtypes.rst:1680 msgid ":meth:`str.upper`" -msgstr "" +msgstr ":meth:`str.upper`" #: ../../library/stdtypes.rst:1680 msgid ":meth:`bytes.upper`" -msgstr "" +msgstr ":meth:`bytes.upper`" #: ../../library/stdtypes.rst:1682 msgid ":meth:`str.casefold`" -msgstr "" +msgstr ":meth:`str.casefold`" #: ../../library/stdtypes.rst:1684 msgid ":meth:`str.capitalize`" -msgstr "" +msgstr ":meth:`str.capitalize`" #: ../../library/stdtypes.rst:1684 msgid ":meth:`bytes.capitalize`" -msgstr "" +msgstr ":meth:`bytes.capitalize`" #: ../../library/stdtypes.rst:1686 msgid ":meth:`str.title`" -msgstr "" +msgstr ":meth:`str.title`" #: ../../library/stdtypes.rst:1686 msgid ":meth:`bytes.title`" -msgstr "" +msgstr ":meth:`bytes.title`" #: ../../library/stdtypes.rst:1688 msgid ":meth:`str.swapcase`" -msgstr "" +msgstr ":meth:`str.swapcase`" #: ../../library/stdtypes.rst:1688 msgid ":meth:`bytes.swapcase`" -msgstr "" +msgstr ":meth:`bytes.swapcase`" #: ../../library/stdtypes.rst:1690 msgid "Padding and Stripping" -msgstr "" +msgstr "填充和去除空白" #: ../../library/stdtypes.rst:1690 msgid ":meth:`str.ljust`" -msgstr "" +msgstr ":meth:`str.ljust`" #: ../../library/stdtypes.rst:1690 msgid ":meth:`str.rjust`" -msgstr "" +msgstr ":meth:`str.rjust`" #: ../../library/stdtypes.rst:1690 msgid ":meth:`bytes.ljust`" -msgstr "" +msgstr ":meth:`bytes.ljust`" #: ../../library/stdtypes.rst:1690 msgid ":meth:`bytes.rjust`" -msgstr "" +msgstr ":meth:`bytes.rjust`" #: ../../library/stdtypes.rst:1692 msgid ":meth:`str.center`" -msgstr "" +msgstr ":meth:`str.center`" #: ../../library/stdtypes.rst:1692 msgid ":meth:`bytes.center`" -msgstr "" +msgstr ":meth:`bytes.center`" #: ../../library/stdtypes.rst:1694 msgid ":meth:`str.expandtabs`" -msgstr "" +msgstr ":meth:`str.expandtabs`" #: ../../library/stdtypes.rst:1694 msgid ":meth:`bytes.expandtabs`" -msgstr "" +msgstr ":meth:`bytes.expandtabs`" #: ../../library/stdtypes.rst:1696 msgid ":meth:`str.strip`" -msgstr "" +msgstr ":meth:`str.strip`" #: ../../library/stdtypes.rst:1696 msgid ":meth:`bytes.strip`" -msgstr "" +msgstr ":meth:`bytes.strip`" #: ../../library/stdtypes.rst:1698 msgid ":meth:`str.lstrip`" -msgstr "" +msgstr ":meth:`str.lstrip`" #: ../../library/stdtypes.rst:1698 msgid ":meth:`str.rstrip`" -msgstr "" +msgstr ":meth:`str.rstrip`" #: ../../library/stdtypes.rst:1698 msgid ":meth:`bytes.lstrip`" -msgstr "" +msgstr ":meth:`bytes.lstrip`" #: ../../library/stdtypes.rst:1698 msgid ":meth:`bytes.rstrip`" -msgstr "" +msgstr ":meth:`bytes.rstrip`" #: ../../library/stdtypes.rst:1700 msgid "Translation and Encoding" -msgstr "" +msgstr "翻譯和編碼" #: ../../library/stdtypes.rst:1700 msgid ":meth:`str.translate`" -msgstr "" +msgstr ":meth:`str.translate`" #: ../../library/stdtypes.rst:1700 msgid ":meth:`bytes.translate`" -msgstr "" +msgstr ":meth:`bytes.translate`" #: ../../library/stdtypes.rst:1702 msgid ":meth:`str.maketrans`" -msgstr "" +msgstr ":meth:`str.maketrans`" #: ../../library/stdtypes.rst:1702 msgid ":meth:`bytes.maketrans`" -msgstr "" +msgstr ":meth:`bytes.maketrans`" #: ../../library/stdtypes.rst:1704 msgid ":meth:`str.encode`" -msgstr "" +msgstr ":meth:`str.encode`" #: ../../library/stdtypes.rst:1706 msgid ":meth:`bytes.decode`" -msgstr "" +msgstr ":meth:`bytes.decode`" #: ../../library/stdtypes.rst:1712 msgid "Text Sequence Type --- :class:`str`" @@ -2987,7 +2971,7 @@ msgstr "" #: ../../library/stdtypes.rst:1806 msgid "String Methods" -msgstr "" +msgstr "字串方法" #: ../../library/stdtypes.rst:1811 msgid "" @@ -4963,14 +4947,12 @@ msgid "" msgstr "" #: ../../library/stdtypes.rst:3140 -#, fuzzy msgid "This is equivalent to:" -msgstr "等同於: ::" +msgstr "等同於:" #: ../../library/stdtypes.rst:3148 -#, fuzzy msgid "Examples:" -msgstr "範例: ::" +msgstr "範例:" #: ../../library/stdtypes.rst:3161 msgid "" @@ -6621,9 +6603,8 @@ msgid "The source format is no longer restricted when casting to a byte view." msgstr "" #: ../../library/stdtypes.rst:4564 -#, fuzzy msgid "Count the number of occurrences of *value*." -msgstr "*s* 中 *x* 的總出現次數" +msgstr "計算 *value* 的出現次數" #: ../../library/stdtypes.rst:4570 msgid "" @@ -6632,9 +6613,8 @@ msgid "" msgstr "" #: ../../library/stdtypes.rst:4573 -#, fuzzy msgid "Raises a :exc:`ValueError` if *value* cannot be found." -msgstr "在 *x* 不在 *s* 中時 :meth:`remove` 會引發 :exc:`ValueError`。" +msgstr "在找不到 *value* 時引發 :exc:`ValueError`。" #: ../../library/stdtypes.rst:4577 msgid "There are also several readonly attributes available:" @@ -6642,7 +6622,7 @@ msgstr "" #: ../../library/stdtypes.rst:4581 msgid "The underlying object of the memoryview::" -msgstr "" +msgstr "memoryview 的底層物件: ::" #: ../../library/stdtypes.rst:4583 msgid "" @@ -7227,13 +7207,14 @@ msgstr "" #: ../../library/stdtypes.rst:5017 msgid "" -"If a subclass of dict defines a method :meth:`__missing__` and *key* is not " -"present, the ``d[key]`` operation calls that method with the key *key* as " -"argument. The ``d[key]`` operation then returns or raises whatever is " -"returned or raised by the ``__missing__(key)`` call. No other operations or " -"methods invoke :meth:`__missing__`. If :meth:`__missing__` is not " -"defined, :exc:`KeyError` is raised. :meth:`__missing__` must be a method; it " -"cannot be an instance variable::" +"If a subclass of dict defines a method :meth:`~object.__missing__` and *key* " +"is not present, the ``d[key]`` operation calls that method with the key " +"*key* as argument. The ``d[key]`` operation then returns or raises whatever " +"is returned or raised by the ``__missing__(key)`` call. No other operations " +"or methods invoke :meth:`~object.__missing__`. " +"If :meth:`~object.__missing__` is not defined, :exc:`KeyError` is " +"raised. :meth:`~object.__missing__` must be a method; it cannot be an " +"instance variable::" msgstr "" #: ../../library/stdtypes.rst:5025 @@ -7263,48 +7244,48 @@ msgstr "" #: ../../library/stdtypes.rst:5036 msgid "" "The example above shows part of the implementation " -"of :class:`collections.Counter`. A different ``__missing__`` method is used " -"by :class:`collections.defaultdict`." +"of :class:`collections.Counter`. A different :meth:`!__missing__` method is " +"used by :class:`collections.defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:5042 +#: ../../library/stdtypes.rst:5043 msgid "Set ``d[key]`` to *value*." msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:5046 +#: ../../library/stdtypes.rst:5047 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "從 *d* 中移除 ``d[key]``。若 *key* 不在對映中則引發 :exc:`KeyError`。" -#: ../../library/stdtypes.rst:5051 +#: ../../library/stdtypes.rst:5052 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:5055 +#: ../../library/stdtypes.rst:5056 msgid "Equivalent to ``not key in d``." msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:5059 +#: ../../library/stdtypes.rst:5060 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5064 +#: ../../library/stdtypes.rst:5065 msgid "Remove all items from the dictionary." msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:5068 +#: ../../library/stdtypes.rst:5069 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5072 +#: ../../library/stdtypes.rst:5073 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:5074 +#: ../../library/stdtypes.rst:5075 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -7313,70 +7294,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:5082 +#: ../../library/stdtypes.rst:5083 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:5088 +#: ../../library/stdtypes.rst:5089 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5093 +#: ../../library/stdtypes.rst:5094 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:5099 +#: ../../library/stdtypes.rst:5100 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " "*default*. If *default* is not given and *key* is not in the dictionary, " "a :exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:5105 +#: ../../library/stdtypes.rst:5106 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -#: ../../library/stdtypes.rst:5108 +#: ../../library/stdtypes.rst:5109 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " "often used in set algorithms. If the dictionary is empty, " "calling :meth:`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:5112 +#: ../../library/stdtypes.rst:5113 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:5118 +#: ../../library/stdtypes.rst:5119 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5125 +#: ../../library/stdtypes.rst:5126 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" -#: ../../library/stdtypes.rst:5133 +#: ../../library/stdtypes.rst:5134 msgid "" "Update the dictionary with the key/value pairs from *mapping* or *iterable* " "and *kwargs*, overwriting existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:5136 +#: ../../library/stdtypes.rst:5137 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -7385,20 +7366,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:5144 +#: ../../library/stdtypes.rst:5145 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5147 +#: ../../library/stdtypes.rst:5148 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:5151 +#: ../../library/stdtypes.rst:5152 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -7408,25 +7389,25 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:5157 +#: ../../library/stdtypes.rst:5158 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:5165 +#: ../../library/stdtypes.rst:5166 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:5171 +#: ../../library/stdtypes.rst:5172 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:5173 +#: ../../library/stdtypes.rst:5174 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7448,21 +7429,21 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:5183 +#: ../../library/stdtypes.rst:5184 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5188 +#: ../../library/stdtypes.rst:5189 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of " "a :class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:5195 +#: ../../library/stdtypes.rst:5196 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:5197 +#: ../../library/stdtypes.rst:5198 msgid "" "The objects returned by :meth:`dict.keys`, :meth:`dict.values` " "and :meth:`dict.items` are *view objects*. They provide a dynamic view on " @@ -7470,23 +7451,23 @@ msgid "" "view reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:5202 +#: ../../library/stdtypes.rst:5203 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:5207 +#: ../../library/stdtypes.rst:5208 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5211 +#: ../../library/stdtypes.rst:5212 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5214 +#: ../../library/stdtypes.rst:5215 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = " @@ -7494,39 +7475,39 @@ msgid "" "= [(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:5219 +#: ../../library/stdtypes.rst:5220 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:5222 +#: ../../library/stdtypes.rst:5223 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:5227 +#: ../../library/stdtypes.rst:5228 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:5232 +#: ../../library/stdtypes.rst:5233 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:5235 +#: ../../library/stdtypes.rst:5236 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5240 +#: ../../library/stdtypes.rst:5241 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:5245 +#: ../../library/stdtypes.rst:5246 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -7540,11 +7521,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:5257 +#: ../../library/stdtypes.rst:5258 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:5259 +#: ../../library/stdtypes.rst:5260 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -7585,11 +7566,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:5301 +#: ../../library/stdtypes.rst:5302 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:5308 +#: ../../library/stdtypes.rst:5309 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -7600,7 +7581,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:5316 +#: ../../library/stdtypes.rst:5317 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -7611,7 +7592,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:5321 +#: ../../library/stdtypes.rst:5322 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to " @@ -7621,7 +7602,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:5325 +#: ../../library/stdtypes.rst:5326 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -7635,7 +7616,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:5335 +#: ../../library/stdtypes.rst:5336 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -7647,7 +7628,7 @@ msgstr "" "行 :keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:5340 +#: ../../library/stdtypes.rst:5341 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -7662,7 +7643,7 @@ msgstr "" "傳播 (propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體" "中發生的任何例外。" -#: ../../library/stdtypes.rst:5347 +#: ../../library/stdtypes.rst:5348 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -7674,7 +7655,7 @@ msgstr "" "已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢" "測 :meth:`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:5353 +#: ../../library/stdtypes.rst:5354 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -7686,7 +7667,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:5359 +#: ../../library/stdtypes.rst:5360 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -7702,7 +7683,7 @@ msgstr "" "的 :meth:`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法" "的情境管理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:5366 +#: ../../library/stdtypes.rst:5367 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -7714,7 +7695,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:5374 +#: ../../library/stdtypes.rst:5375 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:`Union `" @@ -7722,7 +7703,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:5379 +#: ../../library/stdtypes.rst:5380 msgid "" "The core built-in types for :term:`type annotations ` " "are :ref:`Generic Alias ` and :ref:`Union `." @@ -7730,11 +7711,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:5386 +#: ../../library/stdtypes.rst:5387 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:5392 +#: ../../library/stdtypes.rst:5393 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -7750,7 +7731,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:5402 +#: ../../library/stdtypes.rst:5403 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -7758,7 +7739,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:5405 +#: ../../library/stdtypes.rst:5406 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -7766,7 +7747,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:5408 +#: ../../library/stdtypes.rst:5409 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " @@ -7778,7 +7759,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一" "個 :class:`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:5414 +#: ../../library/stdtypes.rst:5415 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -7790,7 +7771,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:5420 +#: ../../library/stdtypes.rst:5421 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -7802,7 +7783,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:5426 +#: ../../library/stdtypes.rst:5427 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " "``y`` will also be an instance of ``re.Match``, but the return values of " @@ -7815,7 +7796,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:5432 +#: ../../library/stdtypes.rst:5433 msgid "" "``GenericAlias`` objects are instances of the " "class :class:`types.GenericAlias`, which can also be used to create " @@ -7824,7 +7805,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:5438 +#: ../../library/stdtypes.rst:5439 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -7834,7 +7815,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素" "的 :class:`list`: ::" -#: ../../library/stdtypes.rst:5443 +#: ../../library/stdtypes.rst:5444 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -7842,7 +7823,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:5446 +#: ../../library/stdtypes.rst:5447 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -7853,7 +7834,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:5451 +#: ../../library/stdtypes.rst:5452 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -7861,7 +7842,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:5454 +#: ../../library/stdtypes.rst:5455 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -7869,7 +7850,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:5457 +#: ../../library/stdtypes.rst:5458 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -7881,7 +7862,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5462 +#: ../../library/stdtypes.rst:5463 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7893,7 +7874,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:5468 +#: ../../library/stdtypes.rst:5469 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7903,13 +7884,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:5472 +#: ../../library/stdtypes.rst:5473 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5475 +#: ../../library/stdtypes.rst:5476 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7927,13 +7908,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5483 +#: ../../library/stdtypes.rst:5484 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5485 +#: ../../library/stdtypes.rst:5486 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7947,7 +7928,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5491 +#: ../../library/stdtypes.rst:5492 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -7955,7 +7936,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器" "的 :meth:`~object.__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5494 +#: ../../library/stdtypes.rst:5495 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7967,7 +7948,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5499 +#: ../../library/stdtypes.rst:5500 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -7977,7 +7958,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件" "的 :attr:`~genericalias.__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5503 +#: ../../library/stdtypes.rst:5504 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7989,249 +7970,249 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5510 +#: ../../library/stdtypes.rst:5511 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5512 +#: ../../library/stdtypes.rst:5513 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5515 +#: ../../library/stdtypes.rst:5516 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5516 +#: ../../library/stdtypes.rst:5517 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5517 +#: ../../library/stdtypes.rst:5518 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5518 +#: ../../library/stdtypes.rst:5519 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5519 +#: ../../library/stdtypes.rst:5520 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5520 +#: ../../library/stdtypes.rst:5521 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5521 +#: ../../library/stdtypes.rst:5522 msgid ":class:`asyncio.Future`" msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5522 +#: ../../library/stdtypes.rst:5523 msgid ":class:`asyncio.Task`" msgstr ":class:`asyncio.Task`" -#: ../../library/stdtypes.rst:5523 +#: ../../library/stdtypes.rst:5524 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5524 +#: ../../library/stdtypes.rst:5525 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5525 +#: ../../library/stdtypes.rst:5526 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5526 +#: ../../library/stdtypes.rst:5527 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5527 +#: ../../library/stdtypes.rst:5528 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5528 +#: ../../library/stdtypes.rst:5529 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5529 +#: ../../library/stdtypes.rst:5530 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5530 +#: ../../library/stdtypes.rst:5531 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5531 +#: ../../library/stdtypes.rst:5532 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5532 +#: ../../library/stdtypes.rst:5533 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5533 +#: ../../library/stdtypes.rst:5534 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5534 +#: ../../library/stdtypes.rst:5535 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5535 +#: ../../library/stdtypes.rst:5536 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5536 +#: ../../library/stdtypes.rst:5537 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5537 +#: ../../library/stdtypes.rst:5538 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5538 +#: ../../library/stdtypes.rst:5539 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5539 +#: ../../library/stdtypes.rst:5540 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5540 +#: ../../library/stdtypes.rst:5541 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5541 +#: ../../library/stdtypes.rst:5542 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5542 +#: ../../library/stdtypes.rst:5543 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5543 +#: ../../library/stdtypes.rst:5544 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5544 +#: ../../library/stdtypes.rst:5545 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5545 +#: ../../library/stdtypes.rst:5546 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5546 +#: ../../library/stdtypes.rst:5547 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5547 +#: ../../library/stdtypes.rst:5548 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5548 +#: ../../library/stdtypes.rst:5549 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5549 +#: ../../library/stdtypes.rst:5550 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5550 +#: ../../library/stdtypes.rst:5551 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5551 +#: ../../library/stdtypes.rst:5552 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5552 +#: ../../library/stdtypes.rst:5553 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5553 +#: ../../library/stdtypes.rst:5554 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5554 +#: ../../library/stdtypes.rst:5555 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5555 +#: ../../library/stdtypes.rst:5556 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5556 +#: ../../library/stdtypes.rst:5557 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5557 +#: ../../library/stdtypes.rst:5558 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5558 +#: ../../library/stdtypes.rst:5559 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5559 +#: ../../library/stdtypes.rst:5560 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5560 +#: ../../library/stdtypes.rst:5561 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5561 +#: ../../library/stdtypes.rst:5562 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5562 +#: ../../library/stdtypes.rst:5563 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5563 +#: ../../library/stdtypes.rst:5564 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5564 +#: ../../library/stdtypes.rst:5565 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5565 +#: ../../library/stdtypes.rst:5566 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5566 +#: ../../library/stdtypes.rst:5567 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5567 +#: ../../library/stdtypes.rst:5568 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5568 +#: ../../library/stdtypes.rst:5569 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5569 +#: ../../library/stdtypes.rst:5570 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5574 +#: ../../library/stdtypes.rst:5575 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5576 +#: ../../library/stdtypes.rst:5577 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5580 +#: ../../library/stdtypes.rst:5581 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5582 +#: ../../library/stdtypes.rst:5583 msgid "" ">>> list[int].__origin__\n" "" @@ -8239,7 +8220,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5588 +#: ../../library/stdtypes.rst:5589 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " @@ -8248,7 +8229,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型" "別 :class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5592 +#: ../../library/stdtypes.rst:5593 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -8256,7 +8237,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5598 +#: ../../library/stdtypes.rst:5599 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -8264,7 +8245,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5601 +#: ../../library/stdtypes.rst:5602 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -8278,7 +8259,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5609 +#: ../../library/stdtypes.rst:5610 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution " @@ -8289,7 +8270,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5616 +#: ../../library/stdtypes.rst:5617 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -8297,19 +8278,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參" "閱 :data:`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5624 +#: ../../library/stdtypes.rst:5625 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5625 +#: ../../library/stdtypes.rst:5626 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5627 +#: ../../library/stdtypes.rst:5628 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5628 +#: ../../library/stdtypes.rst:5629 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class " @@ -8318,7 +8299,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方" "法 :meth:`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5632 +#: ../../library/stdtypes.rst:5633 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` " "and :class:`typing.Generic`" @@ -8326,19 +8307,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ " "和 :class:`typing.Generic`" -#: ../../library/stdtypes.rst:5633 +#: ../../library/stdtypes.rst:5634 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5642 +#: ../../library/stdtypes.rst:5643 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5648 -#, fuzzy +#: ../../library/stdtypes.rst:5649 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -8348,10 +8328,10 @@ msgid "" msgstr "" "一個聯合物件可以保存多個\\ :ref:`型別物件 (type object) `\\ 之 ``|``\\ (位元 or)運算的值。這些型別主要用於\\ :term:`型別註" -"釋 (type annotation) `。與 :data:`typing.Union` 相比,聯合型別運" -"算式可以讓型別提示語法更清晰簡潔。" +"釋 (type annotation) `。與下標 :data:`typing.Union` 相比,聯合型" +"別運算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5655 +#: ../../library/stdtypes.rst:5656 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " @@ -8362,7 +8342,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` " "或 :class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5660 +#: ../../library/stdtypes.rst:5661 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -8370,7 +8350,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5665 +#: ../../library/stdtypes.rst:5666 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -8383,62 +8363,62 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5673 +#: ../../library/stdtypes.rst:5674 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5675 +#: ../../library/stdtypes.rst:5676 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5677 +#: ../../library/stdtypes.rst:5678 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5679 +#: ../../library/stdtypes.rst:5680 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5681 +#: ../../library/stdtypes.rst:5682 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5683 +#: ../../library/stdtypes.rst:5684 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5685 +#: ../../library/stdtypes.rst:5686 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5687 -#, fuzzy +#: ../../library/stdtypes.rst:5688 msgid "It creates instances of :class:`typing.Union`::" -msgstr "它與 :data:`typing.Union` 相容: ::" +msgstr "它會建立 :class:`types.UnionType` 的實例: ::" -#: ../../library/stdtypes.rst:5689 -#, fuzzy +#: ../../library/stdtypes.rst:5690 msgid "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" -msgstr "int | str == typing.Union[int, str]" +msgstr "" +"int | str == typing.Union[int, str]\n" +"type(int | str) is typing.Union" -#: ../../library/stdtypes.rst:5692 +#: ../../library/stdtypes.rst:5693 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5694 +#: ../../library/stdtypes.rst:5695 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5699 +#: ../../library/stdtypes.rst:5700 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5702 +#: ../../library/stdtypes.rst:5703 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -8446,14 +8426,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5705 +#: ../../library/stdtypes.rst:5706 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5708 +#: ../../library/stdtypes.rst:5709 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -8463,18 +8443,15 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5715 -#, fuzzy +#: ../../library/stdtypes.rst:5716 msgid "" "The user-exposed type for the union object can be accessed " "from :class:`typing.Union` and used for :func:`isinstance` checks::" msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透" -"過 :data:`types.UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別" -"來實例化: ::" +"過 :data:`types.UnionType` 存取並用於 :func:`isinstance` 檢查: ::" -#: ../../library/stdtypes.rst:5718 -#, fuzzy +#: ../../library/stdtypes.rst:5719 msgid "" ">>> import typing\n" ">>> isinstance(int | str, typing.Union)\n" @@ -8484,15 +8461,15 @@ msgid "" " File \"\", line 1, in \n" "TypeError: cannot create 'typing.Union' instances" msgstr "" -">>> import types\n" -">>> isinstance(int | str, types.UnionType)\n" +">>> import typing\n" +">>> isinstance(int | str, typing.Union)\n" "True\n" -">>> types.UnionType()\n" +">>> typing.Union()\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"TypeError: cannot create 'types.UnionType' instances" +"TypeError: cannot create 'typing.Union' instances" -#: ../../library/stdtypes.rst:5727 +#: ../../library/stdtypes.rst:5728 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -8501,7 +8478,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5731 +#: ../../library/stdtypes.rst:5732 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -8527,32 +8504,32 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5747 +#: ../../library/stdtypes.rst:5748 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5753 +#: ../../library/stdtypes.rst:5754 msgid "" "Union objects are now instances of :class:`typing.Union`. Previously, they " "were instances of :class:`types.UnionType`, which remains an alias " "for :class:`typing.Union`." msgstr "" -#: ../../library/stdtypes.rst:5760 +#: ../../library/stdtypes.rst:5761 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:5762 +#: ../../library/stdtypes.rst:5763 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5769 +#: ../../library/stdtypes.rst:5770 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5771 +#: ../../library/stdtypes.rst:5772 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " @@ -8563,7 +8540,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5778 +#: ../../library/stdtypes.rst:5779 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -8574,32 +8551,32 @@ msgid "" "not recommended." msgstr "" -#: ../../library/stdtypes.rst:5786 +#: ../../library/stdtypes.rst:5787 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5794 +#: ../../library/stdtypes.rst:5795 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:5796 +#: ../../library/stdtypes.rst:5797 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:5802 +#: ../../library/stdtypes.rst:5803 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5804 +#: ../../library/stdtypes.rst:5805 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5807 +#: ../../library/stdtypes.rst:5808 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -8607,15 +8584,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5811 +#: ../../library/stdtypes.rst:5812 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5817 +#: ../../library/stdtypes.rst:5818 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:5821 +#: ../../library/stdtypes.rst:5822 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such " @@ -8623,7 +8600,7 @@ msgid "" "methods>`. Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5827 +#: ../../library/stdtypes.rst:5828 msgid "" "If you access a method (a function defined in a class namespace) through an " "instance, you get a special object: a :dfn:`bound method` (also " @@ -8636,7 +8613,7 @@ msgid "" "``m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5838 +#: ../../library/stdtypes.rst:5839 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -8647,7 +8624,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5846 +#: ../../library/stdtypes.rst:5847 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -8675,15 +8652,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5861 +#: ../../library/stdtypes.rst:5862 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5869 +#: ../../library/stdtypes.rst:5870 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5875 +#: ../../library/stdtypes.rst:5876 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -8693,7 +8670,7 @@ msgid "" "their :attr:`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5882 +#: ../../library/stdtypes.rst:5883 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -8702,21 +8679,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5889 +#: ../../library/stdtypes.rst:5890 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5892 +#: ../../library/stdtypes.rst:5893 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5898 +#: ../../library/stdtypes.rst:5899 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5904 +#: ../../library/stdtypes.rst:5905 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -8724,30 +8701,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5909 +#: ../../library/stdtypes.rst:5910 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5915 +#: ../../library/stdtypes.rst:5916 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5917 +#: ../../library/stdtypes.rst:5918 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5921 +#: ../../library/stdtypes.rst:5922 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5928 +#: ../../library/stdtypes.rst:5929 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:5930 +#: ../../library/stdtypes.rst:5931 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " "no special operations. There is exactly one ellipsis object, " @@ -8755,15 +8732,15 @@ msgid "" "the :const:`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5935 +#: ../../library/stdtypes.rst:5936 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5941 +#: ../../library/stdtypes.rst:5942 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5943 +#: ../../library/stdtypes.rst:5944 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " @@ -8771,64 +8748,64 @@ msgid "" "object. :code:`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5948 +#: ../../library/stdtypes.rst:5949 msgid "It is written as :code:`NotImplemented`." -msgstr "" +msgstr "它被寫為 :code:`NotImplemented`。" -#: ../../library/stdtypes.rst:5954 +#: ../../library/stdtypes.rst:5955 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:5956 +#: ../../library/stdtypes.rst:5957 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5964 +#: ../../library/stdtypes.rst:5965 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5966 +#: ../../library/stdtypes.rst:5967 msgid "" "The implementation adds a few special read-only attributes to several object " "types, where they are relevant. Some of these are not reported by " "the :func:`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5973 +#: ../../library/stdtypes.rst:5974 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5979 +#: ../../library/stdtypes.rst:5980 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5987 +#: ../../library/stdtypes.rst:5988 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5992 +#: ../../library/stdtypes.rst:5993 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5997 +#: ../../library/stdtypes.rst:5998 msgid "" "The :ref:`type parameters ` of generic classes, functions, " "and :ref:`type aliases `. For classes and functions that are " "not generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:6007 +#: ../../library/stdtypes.rst:6008 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:6009 +#: ../../library/stdtypes.rst:6010 msgid "" "CPython has a global limit for converting between :class:`int` " "and :class:`str` to mitigate denial of service attacks. This limit *only* " @@ -8836,7 +8813,7 @@ msgid "" "octal, and binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:6014 +#: ../../library/stdtypes.rst:6015 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -8846,24 +8823,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:6021 +#: ../../library/stdtypes.rst:6022 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:6023 +#: ../../library/stdtypes.rst:6024 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:6027 +#: ../../library/stdtypes.rst:6028 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:6029 +#: ../../library/stdtypes.rst:6030 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8887,7 +8864,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:6049 +#: ../../library/stdtypes.rst:6050 msgid "" "The default limit is 4300 digits as provided " "in :data:`sys.int_info.default_max_str_digits `. The lowest " @@ -8895,11 +8872,11 @@ msgid "" "in :data:`sys.int_info.str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:6054 +#: ../../library/stdtypes.rst:6055 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:6056 +#: ../../library/stdtypes.rst:6057 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8917,84 +8894,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:6069 +#: ../../library/stdtypes.rst:6070 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:6071 +#: ../../library/stdtypes.rst:6072 msgid "" "The limitation only applies to potentially slow conversions " "between :class:`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:6074 +#: ../../library/stdtypes.rst:6075 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:6075 +#: ../../library/stdtypes.rst:6076 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:6076 +#: ../../library/stdtypes.rst:6077 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:6077 +#: ../../library/stdtypes.rst:6078 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:6078 +#: ../../library/stdtypes.rst:6079 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:6081 +#: ../../library/stdtypes.rst:6082 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:6083 +#: ../../library/stdtypes.rst:6084 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:6084 +#: ../../library/stdtypes.rst:6085 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:6085 +#: ../../library/stdtypes.rst:6086 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:6086 +#: ../../library/stdtypes.rst:6087 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:6087 +#: ../../library/stdtypes.rst:6088 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:6088 +#: ../../library/stdtypes.rst:6089 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:6091 +#: ../../library/stdtypes.rst:6092 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:6093 +#: ../../library/stdtypes.rst:6094 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:6096 +#: ../../library/stdtypes.rst:6097 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:6099 +#: ../../library/stdtypes.rst:6100 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -9002,7 +8979,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:6101 +#: ../../library/stdtypes.rst:6102 msgid "" ":data:`sys.flags.int_max_str_digits` contains the value " "of :envvar:`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. " @@ -9012,38 +8989,38 @@ msgid "" "initialization." msgstr "" -#: ../../library/stdtypes.rst:6107 +#: ../../library/stdtypes.rst:6108 msgid "" "From code, you can inspect the current limit and set a new one using " "these :mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:6110 +#: ../../library/stdtypes.rst:6111 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:6114 +#: ../../library/stdtypes.rst:6115 msgid "" "Information about the default and minimum can be found " "in :data:`sys.int_info`:" msgstr "" -#: ../../library/stdtypes.rst:6116 +#: ../../library/stdtypes.rst:6117 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:6118 +#: ../../library/stdtypes.rst:6119 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:6125 +#: ../../library/stdtypes.rst:6126 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -9055,7 +9032,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:6134 +#: ../../library/stdtypes.rst:6135 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -9063,11 +9040,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:6140 +#: ../../library/stdtypes.rst:6141 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:6142 +#: ../../library/stdtypes.rst:6143 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -9075,11 +9052,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:6147 +#: ../../library/stdtypes.rst:6148 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:6149 +#: ../../library/stdtypes.rst:6150 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -9101,38 +9078,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:6159 +#: ../../library/stdtypes.rst:6160 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:6163 +#: ../../library/stdtypes.rst:6164 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:6164 +#: ../../library/stdtypes.rst:6165 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:6167 +#: ../../library/stdtypes.rst:6168 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:6170 +#: ../../library/stdtypes.rst:6171 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:6172 +#: ../../library/stdtypes.rst:6173 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:6175 +#: ../../library/stdtypes.rst:6176 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -9146,7 +9123,7 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:399 ../../library/stdtypes.rst:992 #: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:1201 #: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4905 -#: ../../library/stdtypes.rst:5900 +#: ../../library/stdtypes.rst:5901 msgid "types" msgstr "type(型別)" @@ -9275,9 +9252,9 @@ msgstr "is not" #: ../../library/stdtypes.rst:1610 ../../library/stdtypes.rst:1740 #: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:2954 #: ../../library/stdtypes.rst:3067 ../../library/stdtypes.rst:4703 -#: ../../library/stdtypes.rst:4905 ../../library/stdtypes.rst:5388 -#: ../../library/stdtypes.rst:5644 ../../library/stdtypes.rst:5819 -#: ../../library/stdtypes.rst:5864 +#: ../../library/stdtypes.rst:4905 ../../library/stdtypes.rst:5389 +#: ../../library/stdtypes.rst:5645 ../../library/stdtypes.rst:5820 +#: ../../library/stdtypes.rst:5865 msgid "object" msgstr "object(物件)" @@ -9370,8 +9347,8 @@ msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:992 #: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:4905 -#: ../../library/stdtypes.rst:5871 ../../library/stdtypes.rst:5885 -#: ../../library/stdtypes.rst:5900 +#: ../../library/stdtypes.rst:5872 ../../library/stdtypes.rst:5886 +#: ../../library/stdtypes.rst:5901 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -9438,7 +9415,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:341 ../../library/stdtypes.rst:1808 -#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:5900 +#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:5901 msgid "module" msgstr "模組" @@ -9506,7 +9483,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:889 ../../library/stdtypes.rst:5303 +#: ../../library/stdtypes.rst:889 ../../library/stdtypes.rst:5304 msgid "protocol" msgstr "protocol(協定)" @@ -9608,7 +9585,7 @@ msgid "bytearray" msgstr "bytearray(位元組陣列)" #: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4905 -#: ../../library/stdtypes.rst:5644 ../../library/stdtypes.rst:5900 +#: ../../library/stdtypes.rst:5645 ../../library/stdtypes.rst:5901 msgid "type" msgstr "type(型別)" @@ -9826,141 +9803,78 @@ msgstr "dictionary(字典)" msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:5303 +#: ../../library/stdtypes.rst:5304 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:5303 +#: ../../library/stdtypes.rst:5304 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:5303 +#: ../../library/stdtypes.rst:5304 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:5376 +#: ../../library/stdtypes.rst:5377 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:5376 +#: ../../library/stdtypes.rst:5377 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:5388 +#: ../../library/stdtypes.rst:5389 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:5388 +#: ../../library/stdtypes.rst:5389 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:5388 +#: ../../library/stdtypes.rst:5389 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5644 +#: ../../library/stdtypes.rst:5645 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5644 +#: ../../library/stdtypes.rst:5645 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5819 +#: ../../library/stdtypes.rst:5820 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5864 +#: ../../library/stdtypes.rst:5865 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5864 +#: ../../library/stdtypes.rst:5865 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5871 +#: ../../library/stdtypes.rst:5872 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5871 +#: ../../library/stdtypes.rst:5872 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5885 +#: ../../library/stdtypes.rst:5886 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5885 +#: ../../library/stdtypes.rst:5886 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5924 +#: ../../library/stdtypes.rst:5925 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5924 +#: ../../library/stdtypes.rst:5925 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" - -#~ msgid "``s.index(x[, i[, j]])``" -#~ msgstr "``s.index(x[, i[, j]])``" - -#~ msgid "``s.count(x)``" -#~ msgstr "``s.count(x)``" - -#~ msgid "``s.append(x)``" -#~ msgstr "``s.append(x)``" - -#~ msgid "``s.clear()``" -#~ msgstr "``s.clear()``" - -#~ msgid "``s.copy()``" -#~ msgstr "``s.copy()``" - -#~ msgid "``s.extend(t)`` or ``s += t``" -#~ msgstr "``s.extend(t)`` 或 ``s += t``" - -#~ msgid "``s.insert(i, x)``" -#~ msgstr "``s.insert(i, x)``" - -#~ msgid "``s.pop()`` or ``s.pop(i)``" -#~ msgstr "``s.pop()`` 或 ``s.pop(i)``" - -#~ msgid "``s.remove(x)``" -#~ msgstr "``s.remove(x)``" - -#~ msgid "``s.reverse()``" -#~ msgstr "``s.reverse()``" - -#~ msgid ":meth:`clear` and :meth:`!copy` methods." -#~ msgstr ":meth:`clear` 和 :meth:`!copy` 方法。" - -#~ msgid ":class:`collections.abc.ByteString`" -#~ msgstr ":class:`collections.abc.ByteString`" - -#~ msgid "count() (sequence method)" -#~ msgstr "count()(序列方法)" - -#~ msgid "index() (sequence method)" -#~ msgstr "index()(序列方法)" - -#~ msgid "append() (sequence method)" -#~ msgstr "append()(序列方法)" - -#~ msgid "clear() (sequence method)" -#~ msgstr "clear()(序列方法)" - -#~ msgid "copy() (sequence method)" -#~ msgstr "copy()(序列方法)" - -#~ msgid "extend() (sequence method)" -#~ msgstr "extend()(序列方法)" - -#~ msgid "insert() (sequence method)" -#~ msgstr "insert()(序列方法)" - -#~ msgid "remove() (sequence method)" -#~ msgstr "remove()(序列方法)" - -#~ msgid "reverse() (sequence method)" -#~ msgstr "reverse()(序列方法)" diff --git a/library/string.po b/library/string.po index 6804208db20..b4e0ea7563d 100644 --- a/library/string.po +++ b/library/string.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" @@ -417,7 +417,6 @@ msgid "Format Specification Mini-Language" msgstr "格式規格 (Format Specification) 迷你語言" #: ../../library/string.rst:310 -#, fuzzy msgid "" "\"Format specifications\" are used within replacement fields contained " "within a format string to define how individual values are presented " @@ -427,7 +426,7 @@ msgid "" "interpreted." msgstr "" "「格式規格」在格式字串 (format string) 中包含的替換欄位中使用,以定義各個值如" -"何被呈現(請參考 :ref:`formatstrings` 和 :ref:`f-strings`)。它們也能夠直接傳" +"何被呈現(請參考 :ref:`formatstrings`、:ref:`f-strings` 和 :ref:`t-strings`)。它們也能夠直接傳" "遞給內建的 :func:`format` 函式。每個可格式化型別 (formattable type) 可以定義" "格式規格如何被直譯。" @@ -1141,7 +1140,6 @@ msgid "Using the comma or the underscore as a digit group separator::" msgstr "使用逗號或底線作為數字分組分隔符號: ::" #: ../../library/string.rst:735 -#, fuzzy msgid "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'\n" @@ -1165,7 +1163,13 @@ msgstr "" ">>> '{:_b}'.format(1234567890)\n" "'100_1001_1001_0110_0000_0010_1101_0010'\n" ">>> '{:_x}'.format(1234567890)\n" -"'4996_02d2'" +"'4996_02d2'\n" +">>> '{:_}'.format(123456789.123456789)\n" +"'123_456_789.12345679'\n" +">>> '{:.,}'.format(123456789.123456789)\n" +"'123456789.123,456,79'\n" +">>> '{:,._}'.format(123456789.123456789)\n" +"'123,456,789.123_456_79'" #: ../../library/string.rst:750 msgid "Expressing a percentage::" @@ -1262,9 +1266,8 @@ msgstr "" " 11 B 13 1011" #: ../../library/string.rst:798 -#, fuzzy msgid "Template strings ($-strings)" -msgstr "模板字串" +msgstr "模板字串 ($-strings)" #: ../../library/string.rst:802 msgid "" diff --git a/library/string.templatelib.po b/library/string.templatelib.po index c2ca9834b74..6986f76fb45 100644 --- a/library/string.templatelib.po +++ b/library/string.templatelib.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -19,11 +18,11 @@ msgstr "" #: ../../library/string.templatelib.rst:2 msgid ":mod:`!string.templatelib` --- Support for template string literals" -msgstr "" +msgstr ":mod:`!string.templatelib` --- 對模板字串字面值的支援" #: ../../library/string.templatelib.rst:7 msgid "**Source code:** :source:`Lib/string/templatelib.py`" -msgstr "" +msgstr "**原始碼:**\\ :source:`Lib/string/templatelib.py`" #: ../../library/string.templatelib.rst:13 msgid ":ref:`Format strings `" @@ -35,11 +34,11 @@ msgstr "" #: ../../library/string.templatelib.rst:15 msgid ":pep:`750`" -msgstr "" +msgstr ":pep:`750`" #: ../../library/string.templatelib.rst:20 msgid "Template strings" -msgstr "" +msgstr "模板字串" #: ../../library/string.templatelib.rst:24 msgid "" @@ -63,6 +62,12 @@ msgid "" " interpolations=(Interpolation(3.14, 'pi', 's', ''),)\n" ")" msgstr "" +">>> pi = 3.14\n" +">>> t't-strings are new in Python {pi!s}!'\n" +"Template(\n" +" strings=('t-strings are new in Python ', '!'),\n" +" interpolations=(Interpolation(3.14, 'pi', 's', ''),)\n" +")" #: ../../library/string.templatelib.rst:42 msgid "Types" @@ -101,6 +106,8 @@ msgid "" "template.strings: ('Ah! We do have ', '.')\n" "template.values: ( 'Camembert', )" msgstr "" +"template.strings: ('Ah! We do have ', '.')\n" +"template.values: ( 'Camembert', )" #: ../../library/string.templatelib.rst:82 #: ../../library/string.templatelib.rst:249 @@ -145,7 +152,7 @@ msgstr "" #: ../../library/string.templatelib.rst:144 #: ../../library/string.templatelib.rst:314 msgid "Methods" -msgstr "" +msgstr "方法" #: ../../library/string.templatelib.rst:147 msgid "" diff --git a/library/stringprep.po b/library/stringprep.po index 5abe72f6a67..78c266b53ac 100644 --- a/library/stringprep.po +++ b/library/stringprep.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2025-02-17 00:34+0000\n" @@ -88,7 +88,7 @@ msgid "" "Determine whether *code* is in tableA.1 (Unassigned code points in Unicode " "3.2)." msgstr "" -"判斷 *code* 是否在 tableA.1(Unicode 3.2 中未指定的碼位 (code point))中。" +"判斷 *code* 是否在 tableA.1(Unicode 3.2 中未指定的編碼位置 (code point))中。" #: ../../library/stringprep.rst:49 msgid "Determine whether *code* is in tableB.1 (Commonly mapped to nothing)." @@ -144,7 +144,7 @@ msgstr "判斷 *code* 是否在 tableC.3(私有使用)中。" #: ../../library/stringprep.rst:103 msgid "Determine whether *code* is in tableC.4 (Non-character code points)." -msgstr "判斷 *code* 是否在 tableC.4(非字元碼位)中。" +msgstr "判斷 *code* 是否在 tableC.4(非字元編碼位置)中。" #: ../../library/stringprep.rst:108 msgid "Determine whether *code* is in tableC.5 (Surrogate codes)." diff --git a/library/struct.po b/library/struct.po index f8ca27ba3c0..bb5be9d7954 100644 --- a/library/struct.po +++ b/library/struct.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" @@ -621,12 +621,11 @@ msgstr ":c:expr:`double`" #: ../../library/struct.rst:263 msgid "``F``" -msgstr "" +msgstr "``F``" #: ../../library/struct.rst:263 -#, fuzzy msgid ":c:expr:`float complex`" -msgstr ":c:expr:`float`" +msgstr ":c:expr:`float complex`" #: ../../library/struct.rst:263 ../../library/struct.rst:265 msgid "complex" @@ -634,21 +633,19 @@ msgstr "" #: ../../library/struct.rst:263 ../../library/struct.rst:265 msgid "\\(10)" -msgstr "" +msgstr "\\(10)" #: ../../library/struct.rst:265 msgid "``D``" -msgstr "" +msgstr "``D``" #: ../../library/struct.rst:265 -#, fuzzy msgid ":c:expr:`double complex`" -msgstr ":c:expr:`double`" +msgstr ":c:expr:`double complex`" #: ../../library/struct.rst:265 -#, fuzzy msgid "16" -msgstr "1" +msgstr "16" #: ../../library/struct.rst:267 msgid "``s``" @@ -695,9 +692,8 @@ msgid "Added support for the ``'e'`` format." msgstr "新增 ``'e'`` 格式的支援。" #: ../../library/struct.rst:280 -#, fuzzy msgid "Added support for the ``'F'`` and ``'D'`` formats." -msgstr "新增 ``'n'`` 與 ``'N'`` 格式的支援。" +msgstr "新增 ``'F'`` 與 ``'D'`` 格式的支援。" #: ../../library/struct.rst:289 msgid "" diff --git a/library/subprocess.po b/library/subprocess.po index f20b95870ac..31035462266 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" @@ -1732,7 +1732,7 @@ msgstr "output = check_output(\"dmesg | grep hda\", shell=True)" #: ../../library/subprocess.rst:1387 msgid "Replacing :func:`os.system`" -msgstr "" +msgstr "取代 :func:`os.system`" #: ../../library/subprocess.rst:1391 msgid "" @@ -1825,7 +1825,7 @@ msgstr "" #: ../../library/subprocess.rst:1432 msgid "Vector example::" -msgstr "" +msgstr "向量範例: ::" #: ../../library/subprocess.rst:1434 msgid "" @@ -1839,7 +1839,7 @@ msgstr "" #: ../../library/subprocess.rst:1438 msgid "Environment example::" -msgstr "" +msgstr "環境範例: ::" #: ../../library/subprocess.rst:1440 msgid "" @@ -1853,7 +1853,7 @@ msgstr "" #: ../../library/subprocess.rst:1447 msgid "Replacing :func:`os.popen`" -msgstr "" +msgstr "取代 :func:`os.popen`" #: ../../library/subprocess.rst:1449 msgid "Return code handling translates as follows::" @@ -2051,9 +2051,8 @@ msgid "Module which provides function to parse and escape command lines." msgstr "" #: ../../library/subprocess.rst:1585 -#, fuzzy msgid "Disable use of ``posix_spawn()``" -msgstr "停用 ``vfork()`` 或 ``posix_spawn()``" +msgstr "停用 ``posix_spawn()``" #: ../../library/subprocess.rst:1587 msgid "" @@ -2066,18 +2065,17 @@ msgstr "" #: ../../library/subprocess.rst:1593 msgid "subprocess._USE_POSIX_SPAWN = False # See CPython issue gh-NNNNNN." -msgstr "subprocess._USE_POSIX_SPAWN = False # 見 CPython 問題 gh-NNNNNN." +msgstr "subprocess._USE_POSIX_SPAWN = False # 見 CPython 問題 gh-NNNNNN。" #: ../../library/subprocess.rst:1595 -#, fuzzy msgid "" "It is safe to set this to false on any Python version. It will have no " "effect on older or newer versions where unsupported. Do not assume the " "attribute is available to read. Despite the name, a true value does not " "indicate the corresponding function will be used, only that it may be." msgstr "" -"在任何 Python 版本上將這些設定為 false 都是安全的。當不受支援時,它們對舊版本" -"沒有影響。不要假設屬性可供讀取。儘管有它們的名稱,真實值並不表示將使用相應的" +"在任何 Python 版本上將這個設定為 false 都是安全的。當不受支援時,它對舊版本或沒有支援的新版本" +"沒有影響。不要假設屬性可供讀取。儘管它的名稱是這樣,真實值並不表示將使用相應的" "函式,而只是表示可能會使用。" #: ../../library/subprocess.rst:1600 @@ -2100,104 +2098,3 @@ msgstr "universal newlines" #: ../../library/subprocess.rst:296 msgid "subprocess module" msgstr "subprocess 模組" - -#~ msgid "" -#~ "(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize)\n" -#~ "==>\n" -#~ "p = Popen(cmd, shell=True, bufsize=bufsize,\n" -#~ " stdin=PIPE, stdout=PIPE, close_fds=True)\n" -#~ "(child_stdin, child_stdout) = (p.stdin, p.stdout)" -#~ msgstr "" -#~ "(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize)\n" -#~ "==>\n" -#~ "p = Popen(cmd, shell=True, bufsize=bufsize,\n" -#~ " stdin=PIPE, stdout=PIPE, close_fds=True)\n" -#~ "(child_stdin, child_stdout) = (p.stdin, p.stdout)" - -#~ msgid "" -#~ "(child_stdin,\n" -#~ " child_stdout,\n" -#~ " child_stderr) = os.popen3(cmd, mode, bufsize)\n" -#~ "==>\n" -#~ "p = Popen(cmd, shell=True, bufsize=bufsize,\n" -#~ " stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)\n" -#~ "(child_stdin,\n" -#~ " child_stdout,\n" -#~ " child_stderr) = (p.stdin, p.stdout, p.stderr)" -#~ msgstr "" -#~ "(child_stdin,\n" -#~ " child_stdout,\n" -#~ " child_stderr) = os.popen3(cmd, mode, bufsize)\n" -#~ "==>\n" -#~ "p = Popen(cmd, shell=True, bufsize=bufsize,\n" -#~ " stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)\n" -#~ "(child_stdin,\n" -#~ " child_stdout,\n" -#~ " child_stderr) = (p.stdin, p.stdout, p.stderr)" - -#~ msgid "" -#~ "(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize)\n" -#~ "==>\n" -#~ "p = Popen(cmd, shell=True, bufsize=bufsize,\n" -#~ " stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)\n" -#~ "(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)" -#~ msgstr "" -#~ "(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize)\n" -#~ "==>\n" -#~ "p = Popen(cmd, shell=True, bufsize=bufsize,\n" -#~ " stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)\n" -#~ "(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)" - -#~ msgid "" -#~ "(child_stdout, child_stdin) = popen2.popen2(\"somestring\", bufsize, " -#~ "mode)\n" -#~ "==>\n" -#~ "p = Popen(\"somestring\", shell=True, bufsize=bufsize,\n" -#~ " stdin=PIPE, stdout=PIPE, close_fds=True)\n" -#~ "(child_stdout, child_stdin) = (p.stdout, p.stdin)" -#~ msgstr "" -#~ "(child_stdout, child_stdin) = popen2.popen2(\"somestring\", bufsize, " -#~ "mode)\n" -#~ "==>\n" -#~ "p = Popen(\"somestring\", shell=True, bufsize=bufsize,\n" -#~ " stdin=PIPE, stdout=PIPE, close_fds=True)\n" -#~ "(child_stdout, child_stdin) = (p.stdout, p.stdin)" - -#~ msgid "" -#~ "(child_stdout, child_stdin) = popen2.popen2([\"mycmd\", \"myarg\"], " -#~ "bufsize, mode)\n" -#~ "==>\n" -#~ "p = Popen([\"mycmd\", \"myarg\"], bufsize=bufsize,\n" -#~ " stdin=PIPE, stdout=PIPE, close_fds=True)\n" -#~ "(child_stdout, child_stdin) = (p.stdout, p.stdin)" -#~ msgstr "" -#~ "(child_stdout, child_stdin) = popen2.popen2([\"mycmd\", \"myarg\"], " -#~ "bufsize, mode)\n" -#~ "==>\n" -#~ "p = Popen([\"mycmd\", \"myarg\"], bufsize=bufsize,\n" -#~ " stdin=PIPE, stdout=PIPE, close_fds=True)\n" -#~ "(child_stdout, child_stdin) = (p.stdout, p.stdin)" - -#~ msgid "" -#~ "If you ever encounter a presumed highly unusual situation where you need " -#~ "to prevent ``vfork()`` from being used by Python, you can set " -#~ "the :const:`subprocess._USE_VFORK` attribute to a false value." -#~ msgstr "" -#~ "如果你遇到了一個推定為極異常的情況,需要防止 Python 使用 ``vfork()``,你可" -#~ "以將 :const:`subprocess._USE_VFORK` 屬性設為 false 值。" - -#~ msgid "subprocess._USE_VFORK = False # See CPython issue gh-NNNNNN." -#~ msgstr "subprocess._USE_VFORK = False # 見 CPython 問題 gh-NNNNNN." - -#~ msgid "" -#~ "Setting this has no impact on use of ``posix_spawn()`` which could use " -#~ "``vfork()`` internally within its libc implementation. There is a " -#~ "similar :const:`subprocess._USE_POSIX_SPAWN` attribute if you need to " -#~ "prevent use of that." -#~ msgstr "" -#~ "設定它並不會影響 ``posix_spawn()`` 的使用,它可以在其 libc 實作內部使用 " -#~ "``vfork()``。如果你需要封鎖該屬性的使用,則有一個類似" -#~ "的 :const:`subprocess._USE_POSIX_SPAWN` 屬性。" - -#~ msgid "``_USE_VFORK``" -#~ msgstr "``_USE_VFORK``" diff --git a/library/sunau.po b/library/sunau.po index b9809625144..bfbae03a44a 100644 --- a/library/sunau.po +++ b/library/sunau.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/superseded.po b/library/superseded.po index 29096f637a1..1691e7d24c7 100644 --- a/library/superseded.po +++ b/library/superseded.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2025-06-28 12:28+0800\n" diff --git a/library/symtable.po b/library/symtable.po index 269eca1a91e..9f51cb5510b 100644 --- a/library/symtable.po +++ b/library/symtable.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" @@ -280,6 +280,25 @@ msgid "" ">>> class_A.get_methods()\n" "('f', 'g', 'h')" msgstr "" +">>> import symtable\n" +">>> st = symtable.symtable('''\n" +"... def outer(): pass\n" +"...\n" +"... class A:\n" +"... def f():\n" +"... def w(): pass\n" +"...\n" +"... def g(self): pass\n" +"...\n" +"... @classmethod\n" +"... async def h(cls): pass\n" +"...\n" +"... global outer\n" +"... def outer(self): pass\n" +"... ''', 'test', 'exec')\n" +">>> class_A = st.get_children()[2]\n" +">>> class_A.get_methods()\n" +"('f', 'g', 'h')" #: ../../library/symtable.rst:228 msgid "" @@ -313,9 +332,8 @@ msgid "Return ``True`` if the symbol is a parameter." msgstr "如果符號是一個參數,則回傳 ``True``。" #: ../../library/symtable.rst:257 -#, fuzzy msgid "Return ``True`` if the symbol is a type parameter." -msgstr "如果符號是一個參數,則回傳 ``True``。" +msgstr "如果符號是一個型別參數,則回傳 ``True``。" #: ../../library/symtable.rst:263 msgid "Return ``True`` if the symbol is global." @@ -347,15 +365,14 @@ msgstr "" "``True``。" #: ../../library/symtable.rst:290 -#, fuzzy msgid "" "Return *True* if a class-scoped symbol is free from the perspective of a " "method." -msgstr "如果符號是從 import 陳述式建立的,則回傳 ``True``。" +msgstr "" #: ../../library/symtable.rst:293 msgid "Consider the following example::" -msgstr "" +msgstr "參考以下範例: ::" #: ../../library/symtable.rst:295 msgid "" @@ -379,14 +396,12 @@ msgid "Return ``True`` if the symbol is assigned to in its block." msgstr "如果該符號被賦值到其區塊中,則回傳 ``True``。" #: ../../library/symtable.rst:314 -#, fuzzy msgid "Return ``True`` if the symbol is a comprehension iteration variable." -msgstr "如果符號是一個參數,則回傳 ``True``。" +msgstr "" #: ../../library/symtable.rst:320 -#, fuzzy msgid "Return ``True`` if the symbol is a cell in an inlined comprehension." -msgstr "如果符號是從 import 陳述式建立的,則回傳 ``True``。" +msgstr "" #: ../../library/symtable.rst:326 msgid "Return ``True`` if name binding introduces new namespace." diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index 3f1296d8d12..922eacc4382 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # Translators: # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-10-21 17:51+0800\n" @@ -101,11 +101,10 @@ msgid "Unregister all events and callback functions associated with *tool_id*." msgstr "" #: ../../library/sys.monitoring.rst:59 -#, fuzzy msgid "" "Should be called once a tool no longer requires *tool_id*. Will " "call :func:`clear_tool_id` before releasing *tool_id*." -msgstr "一旦工具不再需要 *tool_id* 就應該被呼叫。" +msgstr "一旦工具不再需要 *tool_id* 就應該被呼叫。在釋放 *tool_id* 之前會呼叫 :func:`clear_tool_id`。" #: ../../library/sys.monitoring.rst:64 msgid "" @@ -144,9 +143,8 @@ msgid "The following events are supported:" msgstr "支援以下事件:" #: ../../library/sys.monitoring.rst:84 -#, fuzzy msgid "A conditional branch goes left." -msgstr "採取(或不採取)一個條件分支。" +msgstr "一個條件分支往左。" #: ../../library/sys.monitoring.rst:86 msgid "" @@ -156,9 +154,8 @@ msgid "" msgstr "" #: ../../library/sys.monitoring.rst:92 -#, fuzzy msgid "A conditional branch goes right." -msgstr "採取(或不採取)一個條件分支。" +msgstr "一個條件分支往右。" #: ../../library/sys.monitoring.rst:96 msgid "A call in Python code (event occurs before the call)." @@ -332,14 +329,12 @@ msgid ":monitoring-event:`JUMP`" msgstr ":monitoring-event:`JUMP`" #: ../../library/sys.monitoring.rst:194 -#, fuzzy msgid ":monitoring-event:`BRANCH_LEFT`" -msgstr ":monitoring-event:`BRANCH`" +msgstr ":monitoring-event:`BRANCH_LEFT`" #: ../../library/sys.monitoring.rst:195 -#, fuzzy msgid ":monitoring-event:`BRANCH_RIGHT`" -msgstr ":monitoring-event:`BRANCH`" +msgstr ":monitoring-event:`BRANCH_RIGHT`" #: ../../library/sys.monitoring.rst:196 msgid ":monitoring-event:`STOP_ITERATION`" @@ -462,15 +457,14 @@ msgid "Turning events on and off" msgstr "開啟和關閉事件" #: ../../library/sys.monitoring.rst:260 -#, fuzzy msgid "" "In order to monitor an event, it must be turned on and a corresponding " "callback must be registered. Events can be turned on or off by setting the " "events either globally and/or for a particular code object. An event will " "trigger only once, even if it is turned on both globally and locally." msgstr "" -"為了監控一個事件,必須打開它並註冊相應的回呼。可以透過將事件設定為全域或只為" -"特定程式碼物件來開啟或關閉事件。" +"為了監控一個事件,必須打開它並註冊相應的回呼。可以透過將事件設定為全域與/或只為" +"特定程式碼物件來開啟或關閉事件。即使事件在全域和區域都被打開,事件也只會觸發一次。" #: ../../library/sys.monitoring.rst:267 msgid "Setting events globally" @@ -617,53 +611,46 @@ msgid "" msgstr "傳遞給回呼函式的特殊值,表示該呼叫沒有引數。" #: ../../library/sys.monitoring.rst:357 -#, fuzzy msgid "" "When an active event occurs, the registered callback function is called. " "Callback functions returning an object other than :data:`DISABLE` will have " "no effect. Different events will provide the callback function with " "different arguments, as follows:" msgstr "" -"當有效事件發生時,已註冊的回呼函式會被呼叫。不同的事件會為回呼函式提供不同的" -"引數,如下所示:" +"當有效事件發生時,已註冊的回呼函式會被呼叫。回傳非 :data:`DISABLE` 物件的回呼函式將不會有任何效" +"果。不同的事件會為回呼函式提供不同的引數,如下所示:" #: ../../library/sys.monitoring.rst:361 msgid ":monitoring-event:`PY_START` and :monitoring-event:`PY_RESUME`::" msgstr ":monitoring-event:`PY_START` 和 :monitoring-event:`PY_RESUME`: ::" #: ../../library/sys.monitoring.rst:363 ../../library/sys.monitoring.rst:400 -#, fuzzy msgid "func(code: CodeType, instruction_offset: int) -> object" -msgstr "func(code: CodeType, instruction_offset: int) -> DISABLE | Any" +msgstr "func(code: CodeType, instruction_offset: int) -> object" #: ../../library/sys.monitoring.rst:365 msgid ":monitoring-event:`PY_RETURN` and :monitoring-event:`PY_YIELD`::" msgstr ":monitoring-event:`PY_RETURN` 和 :monitoring-event:`PY_YIELD`: ::" #: ../../library/sys.monitoring.rst:367 -#, fuzzy msgid "func(code: CodeType, instruction_offset: int, retval: object) -> object" -msgstr "" -"func(code: CodeType, instruction_offset: int, retval: object) -> DISABLE | " -"Any" +msgstr "func(code: CodeType, instruction_offset: int, retval: object) -> object" #: ../../library/sys.monitoring.rst:369 -#, fuzzy msgid "" ":monitoring-event:`CALL`, :monitoring-event:`C_RAISE` and :monitoring-" "event:`C_RETURN` (*arg0* can be :data:`MISSING` specifically)::" msgstr "" ":monitoring-event:`CALL`、:monitoring-event:`C_RAISE` 和 :monitoring-" -"event:`C_RETURN`: ::" +"event:`C_RETURN`\\ (*arg0* 可以特別是 :data:`MISSING`): ::" #: ../../library/sys.monitoring.rst:372 -#, fuzzy msgid "" "func(code: CodeType, instruction_offset: int, callable: object, arg0: " "object) -> object" msgstr "" -"func(code: CodeType, instruction_offset: int, callable: object, arg0: object " -"| MISSING) -> DISABLE | Any" +"func(code: CodeType, instruction_offset: int, callable: object, arg0: " +"object) -> object" #: ../../library/sys.monitoring.rst:374 msgid "" @@ -691,88 +678,42 @@ msgstr "" "event:`PY_THROW` 和 :monitoring-event:`STOP_ITERATION`: ::" #: ../../library/sys.monitoring.rst:386 -#, fuzzy msgid "" "func(code: CodeType, instruction_offset: int, exception: BaseException) -> " "object" msgstr "" "func(code: CodeType, instruction_offset: int, exception: BaseException) -> " -"DISABLE | Any" +"object" #: ../../library/sys.monitoring.rst:388 msgid ":monitoring-event:`LINE`::" msgstr ":monitoring-event:`LINE`: ::" #: ../../library/sys.monitoring.rst:390 -#, fuzzy msgid "func(code: CodeType, line_number: int) -> object" -msgstr "func(code: CodeType, line_number: int) -> DISABLE | Any" +msgstr "func(code: CodeType, line_number: int) -> object" #: ../../library/sys.monitoring.rst:392 -#, fuzzy msgid "" ":monitoring-event:`BRANCH_LEFT`, :monitoring-event:`BRANCH_RIGHT` " "and :monitoring-event:`JUMP`::" msgstr "" -":monitoring-event:`CALL`、:monitoring-event:`C_RAISE` 和 :monitoring-" -"event:`C_RETURN`: ::" +":monitoring-event:`BRANCH_LEFT`, :monitoring-event:`BRANCH_RIGHT` " +"and :monitoring-event:`JUMP`::" #: ../../library/sys.monitoring.rst:394 -#, fuzzy msgid "" "func(code: CodeType, instruction_offset: int, destination_offset: int) -> " "object" msgstr "" "func(code: CodeType, instruction_offset: int, destination_offset: int) -> " -"DISABLE | Any" +"object" #: ../../library/sys.monitoring.rst:396 -#, fuzzy msgid "Note that the *destination_offset* is where the code will next execute." msgstr "" -"請注意,*destination_offset* 是程式碼接下來要執行的地方。對於未採用的分支,這" -"將是該分支之後的指令的偏移量。" +"請注意,*destination_offset* 是程式碼接下來要執行的地方。" #: ../../library/sys.monitoring.rst:398 msgid ":monitoring-event:`INSTRUCTION`::" msgstr ":monitoring-event:`INSTRUCTION`: ::" - -#~ msgid "" -#~ ":func:`free_tool_id` will not disable global or local events associated " -#~ "with *tool_id*, nor will it unregister any callback functions. This " -#~ "function is only intended to be used to notify the VM that the particular " -#~ "*tool_id* is no longer in use." -#~ msgstr "" -#~ ":func:`free_tool_id` 不會停用與 *tool_id* 相關的全域或區域事件,也不會取消" -#~ "註冊任何回呼函式。這個函式只是用來通知虛擬機器 (VM) 不再使用特定的 " -#~ "*tool_id*。" - -#~ msgid "Exit from a Python function during exception unwinding." -#~ msgstr "在例外展開 (unwind) 期間從 Python 函式退出。" - -#~ msgid "Events are divided into three groups:" -#~ msgstr "事件被分為三組:" - -#~ msgid "" -#~ "Local events add to global events, but do not mask them. In other words, " -#~ "all global events will trigger for a code object, regardless of the local " -#~ "events." -#~ msgstr "" -#~ "區域事件會加入到全域事件中,但不會掩蓋它們。換句話說,無論區域事件如何,所" -#~ "有全域事件都將為程式碼物件觸發。" - -#~ msgid "To register a callable for events call" -#~ msgstr "用來註冊對事件呼叫的可呼叫物件" - -#~ msgid "" -#~ "If there are no arguments, *arg0* is set " -#~ "to :data:`sys.monitoring.MISSING`." -#~ msgstr "如果沒有引數,*arg0* 將被設定為 :data:`sys.monitoring.MISSING`。" - -#~ msgid ":monitoring-event:`BRANCH` and :monitoring-event:`JUMP`::" -#~ msgstr ":monitoring-event:`BRANCH` 和 :monitoring-event:`JUMP`: ::" - -#~ msgid "" -#~ "Registering or unregistering a callback function will generate " -#~ "a :func:`sys.audit` event." -#~ msgstr "註冊或取消註冊回呼函式將產生 :func:`sys.audit` 事件。" diff --git a/library/sys.po b/library/sys.po index beea3d47c38..1f291b5ae4d 100644 --- a/library/sys.po +++ b/library/sys.po @@ -1,13 +1,12 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-09 05:11+0800\n" "PO-Revision-Date: 2023-04-26 02:54+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -799,19 +798,16 @@ msgid "Added the ``int_max_str_digits`` attribute." msgstr "新增 ``int_max_str_digits`` 屬性。" #: ../../library/sys.rst:636 -#, fuzzy msgid "Added the ``gil`` attribute." -msgstr "新增 ``int_max_str_digits`` 屬性。" +msgstr "新增 ``gil`` 屬性。" #: ../../library/sys.rst:639 -#, fuzzy msgid "Added the ``thread_inherit_context`` attribute." -msgstr "新增 ``int_max_str_digits`` 屬性。" +msgstr "新增 ``thread_inherit_context`` 屬性。" #: ../../library/sys.rst:642 -#, fuzzy msgid "Added the ``context_aware_warnings`` attribute." -msgstr "新增 ``int_max_str_digits`` 屬性。" +msgstr "新增 ``context_aware_warnings`` 屬性。" #: ../../library/sys.rst:648 msgid "" @@ -1904,11 +1900,11 @@ msgstr "" #: ../../library/sys.rst:1540 msgid "System" -msgstr "" +msgstr "系統" #: ../../library/sys.rst:1540 msgid "``platform`` value" -msgstr "" +msgstr "``platform`` 值" #: ../../library/sys.rst:1542 msgid "AIX" @@ -1936,12 +1932,11 @@ msgstr "``'emscripten'``" #: ../../library/sys.rst:1545 msgid "FreeBSD" -msgstr "" +msgstr "FreeBSD" #: ../../library/sys.rst:1545 -#, fuzzy msgid "``'freebsd'``" -msgstr "``'android'``" +msgstr "``'freebsd'``" #: ../../library/sys.rst:1546 msgid "iOS" @@ -2005,6 +2000,8 @@ msgid "" "if sys.platform.startswith('sunos'):\n" " # SunOS-specific code here..." msgstr "" +"if sys.platform.startswith('sunos'):\n" +" # 這裡會是 SunOS 專屬的程式碼..." #: ../../library/sys.rst:1563 msgid "" @@ -2262,9 +2259,9 @@ msgstr "" #: ../../library/sys.rst:1766 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " -"*frame* is the current stack frame. *event* is a string: ``'call'``, " -"``'line'``, ``'return'``, ``'exception'`` or ``'opcode'``. *arg* depends on " -"the event type." +"*frame* is the :ref:`current stack frame `. *event* is a " +"string: ``'call'``, ``'line'``, ``'return'``, ``'exception'`` or " +"``'opcode'``. *arg* depends on the event type." msgstr "" #: ../../library/sys.rst:1771 diff --git a/library/sys_path_init.po b/library/sys_path_init.po index 9a18a6ce115..544a5913067 100644 --- a/library/sys_path_init.po +++ b/library/sys_path_init.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -127,7 +127,6 @@ msgid "" msgstr "" #: ../../library/sys_path_init.rst:79 -#, fuzzy msgid "Virtual Environments" msgstr "虛擬環境" diff --git a/library/sysconfig.po b/library/sysconfig.po index f8b98b310e5..e529b88de4c 100644 --- a/library/sysconfig.po +++ b/library/sysconfig.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-04-29 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" diff --git a/library/syslog.po b/library/syslog.po index 903b926241f..24047c64bd3 100644 --- a/library/syslog.po +++ b/library/syslog.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/tabnanny.po b/library/tabnanny.po index 0ed61a596b6..2fda3195607 100644 --- a/library/tabnanny.po +++ b/library/tabnanny.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-11-17 21:19+0800\n" diff --git a/library/tarfile.po b/library/tarfile.po index 1195df69ab0..07886ed8ffa 100644 --- a/library/tarfile.po +++ b/library/tarfile.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Adrian Liaw , 2018 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" @@ -86,9 +86,8 @@ msgid "" msgstr "" #: ../../library/tarfile.rst:52 -#, fuzzy msgid "Added support for Zstandard compression using :mod:`compression.zstd`." -msgstr "新增對 :mod:`lzma` 壓縮的支援。" +msgstr "新增對 Zstandard 壓縮的支援(使用 :mod:`compression.zstd`)。" #: ../../library/tarfile.rst:56 msgid "" @@ -154,14 +153,12 @@ msgid "Open for reading with lzma compression." msgstr "開啟以讀取 lzma 壓縮。" #: ../../library/tarfile.rst:78 -#, fuzzy msgid "``'r:zst'``" -msgstr "``'r:gz'``" +msgstr "``'r:zst'``" #: ../../library/tarfile.rst:78 -#, fuzzy msgid "Open for reading with Zstandard compression." -msgstr "開啟以讀取 lzma 壓縮。" +msgstr "開啟以讀取 Zstandard 壓縮。" #: ../../library/tarfile.rst:80 msgid "``'x'`` or ``'x:'``" @@ -204,9 +201,8 @@ msgid "" msgstr "" #: ../../library/tarfile.rst:97 -#, fuzzy msgid "``'x:zst'``" -msgstr "``'x:gz'``" +msgstr "``'x:zst'``" #: ../../library/tarfile.rst:97 msgid "" @@ -257,14 +253,12 @@ msgid "Open for lzma compressed writing." msgstr "開啟以用於 lzma 壓縮寫入。" #: ../../library/tarfile.rst:113 -#, fuzzy msgid "``'w:zst'``" -msgstr "``'w:gz'``" +msgstr "``'w:zst'``" #: ../../library/tarfile.rst:113 -#, fuzzy msgid "Open for Zstandard compressed writing." -msgstr "開啟以用於 lzma 壓縮寫入。" +msgstr "開啟以用於 Zstandard 壓縮寫入。" #: ../../library/tarfile.rst:116 msgid "" @@ -370,9 +364,8 @@ msgid "Open an lzma compressed *stream* for reading." msgstr "" #: ../../library/tarfile.rst:171 -#, fuzzy msgid "``'r|zst'``" -msgstr "``'r|gz'``" +msgstr "``'r|zst'``" #: ../../library/tarfile.rst:171 msgid "Open a Zstandard compressed *stream* for reading." @@ -411,14 +404,12 @@ msgid "Open an lzma compressed *stream* for writing." msgstr "" #: ../../library/tarfile.rst:185 -#, fuzzy msgid "``'w|zst'``" -msgstr "``'w|gz'``" +msgstr "``'w|zst'``" #: ../../library/tarfile.rst:185 -#, fuzzy msgid "Open a Zstandard compressed *stream* for writing." -msgstr "開啟以用於 lzma 壓縮寫入。" +msgstr "開啟以用於 Zstandard 壓縮寫入。" #: ../../library/tarfile.rst:189 ../../library/tarfile.rst:468 msgid "The ``'x'`` (exclusive creation) mode was added." diff --git a/library/telnetlib.po b/library/telnetlib.po index 0888e999458..c34b20d185d 100644 --- a/library/telnetlib.po +++ b/library/telnetlib.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/tempfile.po b/library/tempfile.po index e497bab54ca..1901125786c 100644 --- a/library/tempfile.po +++ b/library/tempfile.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2021-2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-06-12 15:17+0800\n" diff --git a/library/termios.po b/library/termios.po index 8d743a51646..b8010cfc05e 100644 --- a/library/termios.po +++ b/library/termios.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" diff --git a/library/test.po b/library/test.po index ce8c1539537..30c80964b7d 100644 --- a/library/test.po +++ b/library/test.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" @@ -344,22 +343,20 @@ msgid "``True`` if the running interpreter is Jython." msgstr "如果執行的直譯器是 Jython,則為 ``True``。" #: ../../library/test.rst:249 -#, fuzzy msgid "``True`` if ``sys.platform`` is ``android``." -msgstr "如果系統是 Android,則為 ``True``。" +msgstr "如果 ``sys.platform`` 是 ``android`` 則為 ``True``。" #: ../../library/test.rst:254 msgid "``True`` if ``sys.platform`` is ``emscripten``." -msgstr "" +msgstr "如果 ``sys.platform`` 是 ``emscripten`` 則為 ``True``。" #: ../../library/test.rst:259 -#, fuzzy msgid "``True`` if ``sys.platform`` is ``wasi``." -msgstr "如果系統是 Android,則為 ``True``。" +msgstr "如果 ``sys.platform`` 是 ``wasi`` 則為 ``True``。" #: ../../library/test.rst:264 msgid "``True`` if ``sys.platform`` is ``ios``, ``tvos``, or ``watchos``." -msgstr "" +msgstr "如果 ``sys.platform`` 是 ``ios``、``tvos`` 或 ``watchos`` 則為 ``True``。" #: ../../library/test.rst:269 msgid "" @@ -1721,14 +1718,12 @@ msgid "" msgstr "" #: ../../library/test.rst:1476 -#, fuzzy msgid "Temporarily unset one or more environment variables." -msgstr "暫時取消環境變數 ``envvar``。" +msgstr "暫時取消一個或多個環境變數。" #: ../../library/test.rst:1478 -#, fuzzy msgid "More than one environment variable can be unset." -msgstr "暫時取消環境變數 ``envvar``。" +msgstr "可以取消多於一個環境變數。" #: ../../library/test.rst:1484 msgid "Return ``True`` if the OS supports symbolic links, ``False`` otherwise." diff --git a/library/text.po b/library/text.po index 4170b9d6b22..0b8dd0485c6 100644 --- a/library/text.po +++ b/library/text.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Jordan Su , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-10-17 22:18+0800\n" diff --git a/library/textwrap.po b/library/textwrap.po index 659303b7f86..7d04efaac39 100644 --- a/library/textwrap.po +++ b/library/textwrap.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/threading.po b/library/threading.po index 2e3f3a3eb44..4b68b7633fa 100644 --- a/library/threading.po +++ b/library/threading.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" @@ -824,9 +824,8 @@ msgid "Use the *target* name if *name* argument is omitted." msgstr "" #: ../../library/threading.rst:555 -#, fuzzy msgid "Added the *context* parameter." -msgstr "新增 *daemon* 參數。" +msgstr "新增 *context* 參數。" #: ../../library/threading.rst:560 msgid "Start the thread's activity." @@ -1155,9 +1154,8 @@ msgid "" msgstr "如果底層執行緒實作支援的話,鎖的取得現在可以被 POSIX 上的訊號中斷。" #: ../../library/threading.rst:780 -#, fuzzy msgid "Lock acquisition can now be interrupted by signals on Windows." -msgstr "如果底層執行緒實作支援的話,鎖的取得現在可以被 POSIX 上的訊號中斷。" +msgstr "" #: ../../library/threading.rst:786 msgid "" diff --git a/library/time.po b/library/time.po index ea4d5b5d306..ae1603fb315 100644 --- a/library/time.po +++ b/library/time.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-10 00:19+0000\n" "PO-Revision-Date: 2024-11-20 15:25+0800\n" diff --git a/library/timeit.po b/library/timeit.po index a52e2b76e17..c3534ed8b58 100644 --- a/library/timeit.po +++ b/library/timeit.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-05-20 13:21+0800\n" diff --git a/library/tk.po b/library/tk.po index 67478fb57a7..ed4ee797921 100644 --- a/library/tk.po +++ b/library/tk.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-16 00:16+0000\n" "PO-Revision-Date: 2023-06-24 17:09+0800\n" diff --git a/library/tkinter.colorchooser.po b/library/tkinter.colorchooser.po index f85fe7c89d7..3880f52bd3d 100644 --- a/library/tkinter.colorchooser.po +++ b/library/tkinter.colorchooser.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2024-02-15 12:16+0800\n" diff --git a/library/tkinter.dnd.po b/library/tkinter.dnd.po index 542cf6f49cd..9e86c93f280 100644 --- a/library/tkinter.dnd.po +++ b/library/tkinter.dnd.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # Dr-XYZ , 2025 # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2025-08-21 00:00+0800\n" diff --git a/library/tkinter.font.po b/library/tkinter.font.po index 5560f481758..23fe238c812 100644 --- a/library/tkinter.font.po +++ b/library/tkinter.font.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2024-02-15 23:09+0800\n" diff --git a/library/tkinter.messagebox.po b/library/tkinter.messagebox.po index c6ba507cf31..902c5303b94 100644 --- a/library/tkinter.messagebox.po +++ b/library/tkinter.messagebox.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2024-02-22 15:59+0800\n" diff --git a/library/tkinter.po b/library/tkinter.po index 1c8a3e73df0..70c31480caf 100644 --- a/library/tkinter.po +++ b/library/tkinter.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Dr-XYZ , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2025-07-13 20:00+0800\n" diff --git a/library/tkinter.scrolledtext.po b/library/tkinter.scrolledtext.po index 40768327643..35df81f5b46 100644 --- a/library/tkinter.scrolledtext.po +++ b/library/tkinter.scrolledtext.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2016-11-19 00:35+0000\n" diff --git a/library/tkinter.ttk.po b/library/tkinter.ttk.po index 6dc70586476..8f286505c8c 100644 --- a/library/tkinter.ttk.po +++ b/library/tkinter.ttk.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/token.po b/library/token.po index 7a7a8c94148..ac5d1963331 100644 --- a/library/token.po +++ b/library/token.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Adrian Liaw , 2018 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/tokenize.po b/library/tokenize.po index c5081d3b155..90da94efa3f 100644 --- a/library/tokenize.po +++ b/library/tokenize.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-01-20 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/tomllib.po b/library/tomllib.po index 108936b315a..b3491cfeb0c 100644 --- a/library/tomllib.po +++ b/library/tomllib.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-11-18 01:56+0800\n" @@ -289,6 +289,3 @@ msgstr "表格陣列 (array of tables)" #: ../../library/tomllib.rst:149 msgid "list of dicts" msgstr "dict 串列 (list of dicts)" - -#~ msgid "Subclass of :exc:`ValueError`." -#~ msgstr ":exc:`ValueError` 的子類別。" diff --git a/library/trace.po b/library/trace.po index 628ba22bb83..22e399f3d27 100644 --- a/library/trace.po +++ b/library/trace.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Dr-XYZ , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2025-05-28 14:00+0800\n" diff --git a/library/traceback.po b/library/traceback.po index 613ff0ff81d..f8ae57c03bf 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/tracemalloc.po b/library/tracemalloc.po index aa9a9baf2b9..08f02032557 100644 --- a/library/tracemalloc.po +++ b/library/tracemalloc.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/tty.po b/library/tty.po index 20433b70828..3b6313452a8 100644 --- a/library/tty.po +++ b/library/tty.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2025-06-28 20:38+0800\n" diff --git a/library/turtle.po b/library/turtle.po index 2dbd9aad98f..b134109998e 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Renyuan Lyu , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" @@ -696,9 +696,8 @@ msgid ":func:`filling`" msgstr ":func:`filling`" #: ../../library/turtle.rst:0 -#, fuzzy msgid ":func:`fill`" -msgstr ":func:`filling`" +msgstr ":func:`fill`" #: ../../library/turtle.rst:0 msgid ":func:`begin_fill`" @@ -801,9 +800,8 @@ msgid "Special Turtle methods" msgstr "" #: ../../library/turtle.rst:0 -#, fuzzy msgid ":func:`poly`" -msgstr ":func:`end_poly`" +msgstr ":func:`poly`" #: ../../library/turtle.rst:0 msgid ":func:`begin_poly`" @@ -874,9 +872,8 @@ msgid "Animation control" msgstr "" #: ../../library/turtle.rst:0 -#, fuzzy msgid ":func:`no_animation`" -msgstr ":func:`radians`" +msgstr ":func:`no_animation`" #: ../../library/turtle.rst:0 msgid ":func:`delay`" @@ -979,9 +976,8 @@ msgid ":func:`exitonclick`" msgstr ":func:`exitonclick`" #: ../../library/turtle.rst:0 -#, fuzzy msgid ":func:`save`" -msgstr ":func:`shape`" +msgstr ":func:`save`" #: ../../library/turtle.rst:0 msgid ":func:`setup`" @@ -2136,16 +2132,14 @@ msgid "Fill the shape drawn in the ``with turtle.fill():`` block." msgstr "" #: ../../library/turtle.rst:1310 -#, fuzzy msgid "" ">>> turtle.color(\"black\", \"red\")\n" ">>> with turtle.fill():\n" "... turtle.circle(80)" msgstr "" ">>> turtle.color(\"black\", \"red\")\n" -">>> turtle.begin_fill()\n" -">>> turtle.circle(80)\n" -">>> turtle.end_fill()" +">>> with turtle.fill():\n" +"... turtle.circle(80)" #: ../../library/turtle.rst:1317 msgid "" @@ -2595,18 +2589,16 @@ msgid "" msgstr "" #: ../../library/turtle.rst:1708 -#, fuzzy msgid "" ">>> with turtle.poly():\n" "... turtle.forward(100)\n" "... turtle.right(60)\n" "... turtle.forward(100)" msgstr "" -">>> for i in range(4):\n" -"... turtle.fd(50); turtle.lt(80)\n" -"...\n" -">>> for i in range(8):\n" -"... turtle.undo()" +">>> with turtle.poly():\n" +"... turtle.forward(100)\n" +"... turtle.right(60)\n" +"... turtle.forward(100)" #: ../../library/turtle.rst:1721 msgid "" @@ -2946,19 +2938,16 @@ msgid "" msgstr "" #: ../../library/turtle.rst:2003 -#, fuzzy msgid "" ">>> with screen.no_animation():\n" "... for dist in range(2, 400, 2):\n" "... fd(dist)\n" "... rt(90)" msgstr "" -">>> screen.tracer(8, 25)\n" -">>> dist = 2\n" -">>> for i in range(200):\n" -"... fd(dist)\n" -"... rt(90)\n" -"... dist += 2" +">>> with screen.no_animation():\n" +"... for dist in range(2, 400, 2):\n" +"... fd(dist)\n" +"... rt(90)" #: ../../library/turtle.rst:2016 msgid "positive integer" @@ -3337,9 +3326,8 @@ msgid "" msgstr "" #: ../../library/turtle.rst:2303 -#, fuzzy msgid ">>> screen.register_shape(\"turtle\", \"turtle.gif\")" -msgstr ">>> screen.register_shape(\"turtle.gif\")" +msgstr ">>> screen.register_shape(\"turtle\", \"turtle.gif\")" #: ../../library/turtle.rst:2309 msgid "" @@ -3446,6 +3434,8 @@ msgid "" ">>> screen.save(\"my_drawing.ps\")\n" ">>> screen.save(\"my_drawing.ps\", overwrite=True)" msgstr "" +">>> screen.save(\"my_drawing.ps\")\n" +">>> screen.save(\"my_drawing.ps\", overwrite=True)" #: ../../library/turtle.rst:2397 msgid "" @@ -3523,7 +3513,7 @@ msgstr "" #: ../../library/turtle.rst:2456 msgid "a :class:`!tkinter.Canvas`" -msgstr "" +msgstr "一個 :class:`!tkinter.Canvas`" #: ../../library/turtle.rst:2458 msgid "" diff --git a/library/types.po b/library/types.po index 226554390a9..cdb571f226e 100644 --- a/library/types.po +++ b/library/types.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" diff --git a/library/typing.po b/library/typing.po index acb94c3bf75..bd592d68321 100644 --- a/library/typing.po +++ b/library/typing.po @@ -1,12 +1,12 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-09 05:11+0800\n" "PO-Revision-Date: 2024-07-11 11:12+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -391,7 +391,7 @@ msgstr "" "為 :class:`int` 的引數,並回傳一個 :class:`str`。" #: ../../library/typing.rst:215 ../../library/typing.rst:3281 -#: ../../library/typing.rst:3461 +#: ../../library/typing.rst:3466 msgid "For example:" msgstr "舉例來說:" @@ -501,7 +501,7 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:285 ../../library/typing.rst:3965 +#: ../../library/typing.rst:285 ../../library/typing.rst:3975 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. " "See :pep:`612` for more details." @@ -1563,7 +1563,7 @@ msgstr "" #: ../../library/typing.rst:1043 ../../library/typing.rst:1223 #: ../../library/typing.rst:1310 ../../library/typing.rst:1352 #: ../../library/typing.rst:1561 ../../library/typing.rst:1622 -#: ../../library/typing.rst:3218 ../../library/typing.rst:3446 +#: ../../library/typing.rst:3218 ../../library/typing.rst:3451 msgid "For example::" msgstr "舉例來說: ::" @@ -3785,7 +3785,7 @@ msgid "Typed version of :func:`collections.namedtuple`." msgstr "" #: ../../library/typing.rst:2355 ../../library/typing.rst:2451 -#: ../../library/typing.rst:3545 +#: ../../library/typing.rst:3555 msgid "Usage::" msgstr "用法: ::" @@ -5346,7 +5346,13 @@ msgid "" "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:3365 +#: ../../library/typing.rst:3365 ../../library/typing.rst:3516 +msgid "" +"This function may execute arbitrary code contained in annotations. " +"See :ref:`annotationlib-security` for more information." +msgstr "" + +#: ../../library/typing.rst:3370 msgid "" "If any forward references in the annotations of *obj* are not resolvable or " "are not valid Python code, this function will raise an exception such " @@ -5355,7 +5361,7 @@ msgid "" "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:3371 +#: ../../library/typing.rst:3376 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." @@ -5363,20 +5369,20 @@ msgstr "" "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請" "見 :data:`Annotated` 的文件。" -#: ../../library/typing.rst:3375 +#: ../../library/typing.rst:3380 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:3382 +#: ../../library/typing.rst:3387 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3385 +#: ../../library/typing.rst:3390 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " "it will be normalized to the original class. If ``X`` is an instance " @@ -5384,11 +5390,11 @@ msgid "" "underlying :class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3391 ../../library/typing.rst:3415 +#: ../../library/typing.rst:3396 ../../library/typing.rst:3420 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3393 +#: ../../library/typing.rst:3398 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" @@ -5406,13 +5412,13 @@ msgstr "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3407 +#: ../../library/typing.rst:3412 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: ../../library/typing.rst:3410 +#: ../../library/typing.rst:3415 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -5420,7 +5426,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3417 +#: ../../library/typing.rst:3422 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -5430,11 +5436,11 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3427 +#: ../../library/typing.rst:3432 msgid "Return the set of members defined in a :class:`Protocol`." msgstr "" -#: ../../library/typing.rst:3429 +#: ../../library/typing.rst:3434 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -5450,15 +5456,15 @@ msgstr "" ">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" "True" -#: ../../library/typing.rst:3438 +#: ../../library/typing.rst:3443 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." msgstr "" -#: ../../library/typing.rst:3444 +#: ../../library/typing.rst:3449 msgid "Determine if a type is a :class:`Protocol`." msgstr "確定一個型別是否 :class:`Protocol`。" -#: ../../library/typing.rst:3448 +#: ../../library/typing.rst:3453 msgid "" "class P(Protocol):\n" " def a(self) -> str: ...\n" @@ -5474,11 +5480,11 @@ msgstr "" "is_protocol(P) # => True\n" "is_protocol(int) # => False" -#: ../../library/typing.rst:3459 +#: ../../library/typing.rst:3464 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3463 +#: ../../library/typing.rst:3468 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5492,57 +5498,57 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3480 +#: ../../library/typing.rst:3485 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3482 +#: ../../library/typing.rst:3487 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. :class:`!ForwardRef` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3487 +#: ../../library/typing.rst:3492 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:3493 +#: ../../library/typing.rst:3498 msgid "" "This is now an alias for :class:`annotationlib.ForwardRef`. Several " "undocumented behaviors of this class have been changed; for example, after a " "``ForwardRef`` has been evaluated, the evaluated value is no longer cached." msgstr "" -#: ../../library/typing.rst:3500 +#: ../../library/typing.rst:3505 msgid "Evaluate an :class:`annotationlib.ForwardRef` as a :term:`type hint`." msgstr "" -#: ../../library/typing.rst:3502 +#: ../../library/typing.rst:3507 msgid "" "This is similar to calling :meth:`annotationlib.ForwardRef.evaluate`, but " "unlike that method, :func:`!evaluate_forward_ref` also recursively evaluates " "forward references nested within the type hint." msgstr "" -#: ../../library/typing.rst:3506 +#: ../../library/typing.rst:3511 msgid "" "See the documentation for :meth:`annotationlib.ForwardRef.evaluate` for the " "meaning of the *owner*, *globals*, *locals*, *type_params*, and *format* " "parameters." msgstr "" -#: ../../library/typing.rst:3513 +#: ../../library/typing.rst:3523 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" -#: ../../library/typing.rst:3516 +#: ../../library/typing.rst:3526 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5558,17 +5564,17 @@ msgstr "" ">>> S.__default__ is None\n" "True" -#: ../../library/typing.rst:3528 +#: ../../library/typing.rst:3538 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3532 +#: ../../library/typing.rst:3542 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It's ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3535 +#: ../../library/typing.rst:3545 msgid "" "A module which is expensive to import, and which only contain types used for " "typing annotations, can be safely imported inside an ``if TYPE_CHECKING:`` " @@ -5580,8 +5586,7 @@ msgid "" "will be checked properly during such analysis." msgstr "" -#: ../../library/typing.rst:3547 -#, fuzzy +#: ../../library/typing.rst:3557 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -5592,10 +5597,10 @@ msgstr "" "if TYPE_CHECKING:\n" " import expensive_mod\n" "\n" -"def fun(arg: 'expensive_mod.SomeType') -> None:\n" +"def fun(arg: expensive_mod.SomeType) -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3553 +#: ../../library/typing.rst:3563 msgid "" "If you occasionally need to examine type annotations at runtime which may " "contain undefined symbols, use :meth:`annotationlib.get_annotations` with a " @@ -5604,11 +5609,11 @@ msgid "" "annotations without raising :exc:`NameError`." msgstr "" -#: ../../library/typing.rst:3566 +#: ../../library/typing.rst:3576 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3568 +#: ../../library/typing.rst:3578 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the :mod:`!typing` module " @@ -5617,7 +5622,7 @@ msgid "" "pre-existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3575 +#: ../../library/typing.rst:3585 msgid "" "The redundant types are deprecated as of Python 3.9. However, while the " "aliases may be removed at some point, removal of these aliases is not " @@ -5625,7 +5630,7 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3580 +#: ../../library/typing.rst:3590 msgid "" "If at some point it is decided to remove these deprecated aliases, a " "deprecation warning will be issued by the interpreter for at least two " @@ -5634,38 +5639,38 @@ msgid "" "3.14." msgstr "" -#: ../../library/typing.rst:3585 +#: ../../library/typing.rst:3595 msgid "" "Type checkers are encouraged to flag uses of the deprecated types if the " "program they are checking targets a minimum Python version of 3.9 or newer." msgstr "" -#: ../../library/typing.rst:3591 +#: ../../library/typing.rst:3601 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3595 +#: ../../library/typing.rst:3605 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3597 +#: ../../library/typing.rst:3607 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Mapping` rather than to " "use :class:`dict` or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:3601 +#: ../../library/typing.rst:3611 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3607 +#: ../../library/typing.rst:3617 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3609 +#: ../../library/typing.rst:3619 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Sequence` " @@ -5673,136 +5678,136 @@ msgid "" "or :class:`!typing.List`." msgstr "" -#: ../../library/typing.rst:3614 +#: ../../library/typing.rst:3624 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3620 +#: ../../library/typing.rst:3630 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3622 +#: ../../library/typing.rst:3632 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`collections.abc.Set` rather than to " "use :class:`set` or :class:`typing.Set`." msgstr "" -#: ../../library/typing.rst:3626 +#: ../../library/typing.rst:3636 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3632 +#: ../../library/typing.rst:3642 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3634 +#: ../../library/typing.rst:3644 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3641 +#: ../../library/typing.rst:3651 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3643 +#: ../../library/typing.rst:3653 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; " "see :ref:`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3646 +#: ../../library/typing.rst:3656 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3652 +#: ../../library/typing.rst:3662 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3654 +#: ../../library/typing.rst:3664 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3659 +#: ../../library/typing.rst:3669 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3666 +#: ../../library/typing.rst:3676 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3670 +#: ../../library/typing.rst:3680 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3674 +#: ../../library/typing.rst:3684 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3680 +#: ../../library/typing.rst:3690 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3684 +#: ../../library/typing.rst:3694 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3690 +#: ../../library/typing.rst:3700 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3694 +#: ../../library/typing.rst:3704 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3700 +#: ../../library/typing.rst:3710 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3704 +#: ../../library/typing.rst:3714 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3710 +#: ../../library/typing.rst:3720 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3714 +#: ../../library/typing.rst:3724 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3721 +#: ../../library/typing.rst:3731 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3726 +#: ../../library/typing.rst:3736 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3729 +#: ../../library/typing.rst:3739 msgid "" "These types (and the corresponding functions) are generic " "over :data:`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -5810,29 +5815,29 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3734 +#: ../../library/typing.rst:3744 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3740 +#: ../../library/typing.rst:3750 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3742 +#: ../../library/typing.rst:3752 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: ../../library/typing.rst:3746 +#: ../../library/typing.rst:3756 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:3749 +#: ../../library/typing.rst:3759 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" @@ -5840,306 +5845,306 @@ msgstr "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" -#: ../../library/typing.rst:3754 +#: ../../library/typing.rst:3764 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: ../../library/typing.rst:3764 +#: ../../library/typing.rst:3774 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3768 +#: ../../library/typing.rst:3778 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3770 +#: ../../library/typing.rst:3780 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3776 +#: ../../library/typing.rst:3786 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3780 +#: ../../library/typing.rst:3790 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3786 +#: ../../library/typing.rst:3796 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3788 +#: ../../library/typing.rst:3798 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3794 +#: ../../library/typing.rst:3804 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3796 +#: ../../library/typing.rst:3806 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3802 +#: ../../library/typing.rst:3812 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3804 +#: ../../library/typing.rst:3814 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3810 +#: ../../library/typing.rst:3820 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3812 +#: ../../library/typing.rst:3822 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3818 +#: ../../library/typing.rst:3828 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3820 +#: ../../library/typing.rst:3830 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3826 +#: ../../library/typing.rst:3836 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3828 +#: ../../library/typing.rst:3838 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3835 +#: ../../library/typing.rst:3845 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3837 +#: ../../library/typing.rst:3847 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3844 +#: ../../library/typing.rst:3854 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3846 +#: ../../library/typing.rst:3856 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3852 +#: ../../library/typing.rst:3862 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3854 +#: ../../library/typing.rst:3864 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3860 +#: ../../library/typing.rst:3870 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3862 +#: ../../library/typing.rst:3872 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3869 +#: ../../library/typing.rst:3879 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中非同步 ABC 的別名" -#: ../../library/typing.rst:3873 +#: ../../library/typing.rst:3883 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3875 +#: ../../library/typing.rst:3885 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on " "using :class:`collections.abc.Coroutine` and ``typing.Coroutine`` in type " "annotations." msgstr "" -#: ../../library/typing.rst:3881 +#: ../../library/typing.rst:3891 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3887 +#: ../../library/typing.rst:3897 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3889 +#: ../../library/typing.rst:3899 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on " "using :class:`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` " "in type annotations." msgstr "" -#: ../../library/typing.rst:3895 +#: ../../library/typing.rst:3905 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3900 +#: ../../library/typing.rst:3910 msgid "The ``SendType`` parameter now has a default." msgstr "``SendType`` 參數現在有預設值。" -#: ../../library/typing.rst:3905 +#: ../../library/typing.rst:3915 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3909 +#: ../../library/typing.rst:3919 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3915 +#: ../../library/typing.rst:3925 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3919 +#: ../../library/typing.rst:3929 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3925 +#: ../../library/typing.rst:3935 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3929 +#: ../../library/typing.rst:3939 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3936 +#: ../../library/typing.rst:3946 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3940 +#: ../../library/typing.rst:3950 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3942 +#: ../../library/typing.rst:3952 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3948 +#: ../../library/typing.rst:3958 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3950 +#: ../../library/typing.rst:3960 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3956 +#: ../../library/typing.rst:3966 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:3958 +#: ../../library/typing.rst:3968 msgid "" "See :ref:`annotating-callables` for details on how to " "use :class:`collections.abc.Callable` and ``typing.Callable`` in type " "annotations." msgstr "" -#: ../../library/typing.rst:3961 +#: ../../library/typing.rst:3971 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3971 +#: ../../library/typing.rst:3981 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:3973 +#: ../../library/typing.rst:3983 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on " "using :class:`collections.abc.Generator` and ``typing.Generator`` in type " "annotations." msgstr "" -#: ../../library/typing.rst:3977 +#: ../../library/typing.rst:3987 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3981 +#: ../../library/typing.rst:3991 msgid "Default values for the send and return types were added." msgstr "" -#: ../../library/typing.rst:3986 +#: ../../library/typing.rst:3996 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:3988 +#: ../../library/typing.rst:3998 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:3993 +#: ../../library/typing.rst:4003 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:3995 +#: ../../library/typing.rst:4005 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4001 +#: ../../library/typing.rst:4011 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:4003 +#: ../../library/typing.rst:4013 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:4009 +#: ../../library/typing.rst:4019 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:4013 +#: ../../library/typing.rst:4023 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:4015 +#: ../../library/typing.rst:4025 msgid "" "The first type parameter, ``T_co``, represents the type returned by " "the :meth:`~object.__enter__` method. The optional second type parameter, " @@ -6147,21 +6152,21 @@ msgid "" "returned by the :meth:`~object.__exit__` method." msgstr "" -#: ../../library/typing.rst:4022 +#: ../../library/typing.rst:4032 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4027 +#: ../../library/typing.rst:4037 msgid "Added the optional second type parameter, ``ExitT_co``." msgstr "" -#: ../../library/typing.rst:4032 +#: ../../library/typing.rst:4042 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:4034 +#: ../../library/typing.rst:4044 msgid "" "The first type parameter, ``T_co``, represents the type returned by " "the :meth:`~object.__aenter__` method. The optional second type parameter, " @@ -6169,21 +6174,21 @@ msgid "" "returned by the :meth:`~object.__aexit__` method." msgstr "" -#: ../../library/typing.rst:4041 +#: ../../library/typing.rst:4051 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4046 +#: ../../library/typing.rst:4056 msgid "Added the optional second type parameter, ``AExitT_co``." msgstr "" -#: ../../library/typing.rst:4050 +#: ../../library/typing.rst:4060 msgid "Deprecation Timeline of Major Features" msgstr "主要功能的棄用時程表" -#: ../../library/typing.rst:4052 +#: ../../library/typing.rst:4062 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -6191,100 +6196,100 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:4059 +#: ../../library/typing.rst:4069 msgid "Feature" msgstr "" -#: ../../library/typing.rst:4060 +#: ../../library/typing.rst:4070 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:4061 +#: ../../library/typing.rst:4071 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:4062 +#: ../../library/typing.rst:4072 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:4063 +#: ../../library/typing.rst:4073 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:4064 +#: ../../library/typing.rst:4074 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:4065 +#: ../../library/typing.rst:4075 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:4066 +#: ../../library/typing.rst:4076 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:4067 +#: ../../library/typing.rst:4077 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:4068 +#: ../../library/typing.rst:4078 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:4069 ../../library/typing.rst:4073 -#: ../../library/typing.rst:4077 +#: ../../library/typing.rst:4079 ../../library/typing.rst:4083 +#: ../../library/typing.rst:4087 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:4070 +#: ../../library/typing.rst:4080 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:4071 +#: ../../library/typing.rst:4081 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:4072 ../../library/typing.rst:4076 +#: ../../library/typing.rst:4082 ../../library/typing.rst:4086 msgid "3.12" msgstr "3.12" -#: ../../library/typing.rst:4074 +#: ../../library/typing.rst:4084 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:4075 +#: ../../library/typing.rst:4085 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:4078 +#: ../../library/typing.rst:4088 msgid ":pep:`695`" msgstr ":pep:`695`" -#: ../../library/typing.rst:4079 +#: ../../library/typing.rst:4089 msgid ":func:`@typing.no_type_check_decorator `" msgstr ":func:`@typing.no_type_check_decorator `" -#: ../../library/typing.rst:4080 ../../library/typing.rst:4084 +#: ../../library/typing.rst:4090 ../../library/typing.rst:4094 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:4081 +#: ../../library/typing.rst:4091 msgid "3.15" msgstr "3.15" -#: ../../library/typing.rst:4082 +#: ../../library/typing.rst:4092 msgid ":gh:`106309`" msgstr ":gh:`106309`" -#: ../../library/typing.rst:4083 +#: ../../library/typing.rst:4093 msgid ":data:`typing.AnyStr`" msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:4085 +#: ../../library/typing.rst:4095 msgid "3.18" msgstr "3.18" -#: ../../library/typing.rst:4086 +#: ../../library/typing.rst:4096 msgid ":gh:`105578`" msgstr ":gh:`105578`" diff --git a/library/unicodedata.po b/library/unicodedata.po index 66018ed883e..a061cf62bfd 100644 --- a/library/unicodedata.po +++ b/library/unicodedata.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" @@ -180,21 +180,19 @@ msgstr "" #: ../../library/unicodedata.rst:157 msgid "Examples:" -msgstr "" +msgstr "範例:" #: ../../library/unicodedata.rst:177 msgid "Footnotes" msgstr "註腳" #: ../../library/unicodedata.rst:178 -#, fuzzy msgid "https://www.unicode.org/Public/16.0.0/ucd/NameAliases.txt" -msgstr "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" +msgstr "https://www.unicode.org/Public/16.0.0/ucd/NameAliases.txt" #: ../../library/unicodedata.rst:180 -#, fuzzy msgid "https://www.unicode.org/Public/16.0.0/ucd/NamedSequences.txt" -msgstr "https://www.unicode.org/Public/15.1.0/ucd/NamedSequences.txt" +msgstr "https://www.unicode.org/Public/16.0.0/ucd/NamedSequences.txt" #: ../../library/unicodedata.rst:11 msgid "Unicode" @@ -207,83 +205,3 @@ msgstr "character(字元)" #: ../../library/unicodedata.rst:11 msgid "database" msgstr "database(資料庫)" - -#~ msgid "" -#~ ">>> unicodedata.lookup('LEFT CURLY BRACKET')\n" -#~ "'{'" -#~ msgstr "" -#~ ">>> unicodedata.lookup('LEFT CURLY BRACKET')\n" -#~ "'{'" - -#~ msgid "" -#~ ">>> unicodedata.lookup('MIDDLE DOT') == '\\N{MIDDLE DOT}'\n" -#~ "True" -#~ msgstr "" -#~ ">>> unicodedata.lookup('MIDDLE DOT') == '\\N{MIDDLE DOT}'\n" -#~ "True" - -#~ msgid "" -#~ ">>> unicodedata.name('½')\n" -#~ "'VULGAR FRACTION ONE HALF'\n" -#~ ">>> unicodedata.name('\\uFFFF', 'fallback')\n" -#~ "'fallback'" -#~ msgstr "" -#~ ">>> unicodedata.name('½')\n" -#~ "'VULGAR FRACTION ONE HALF'\n" -#~ ">>> unicodedata.name('\\uFFFF', 'fallback')\n" -#~ "'fallback'" - -#~ msgid "" -#~ ">>> unicodedata.decimal('\\N{ARABIC-INDIC DIGIT NINE}')\n" -#~ "9\n" -#~ ">>> unicodedata.decimal('\\N{SUPERSCRIPT NINE}', -1)\n" -#~ "-1" -#~ msgstr "" -#~ ">>> unicodedata.decimal('\\N{ARABIC-INDIC DIGIT NINE}')\n" -#~ "9\n" -#~ ">>> unicodedata.decimal('\\N{SUPERSCRIPT NINE}', -1)\n" -#~ "-1" - -#~ msgid "" -#~ ">>> unicodedata.digit('\\N{SUPERSCRIPT NINE}')\n" -#~ "9" -#~ msgstr "" -#~ ">>> unicodedata.digit('\\N{SUPERSCRIPT NINE}')\n" -#~ "9" - -#~ msgid "" -#~ ">>> unicodedata.numeric('½')\n" -#~ "0.5" -#~ msgstr "" -#~ ">>> unicodedata.numeric('½')\n" -#~ "0.5" - -#~ msgid "" -#~ ">>> unicodedata.category('A') # 'L'etter, 'u'ppercase\n" -#~ "'Lu'" -#~ msgstr "" -#~ ">>> unicodedata.category('A') # 'L'etter, 'u'ppercase\n" -#~ "'Lu'" - -#~ msgid "" -#~ ">>> unicodedata.bidirectional('\\N{ARABIC-INDIC DIGIT SEVEN}') # " -#~ "'A'rabic, 'N'umber\n" -#~ "'AN'" -#~ msgstr "" -#~ ">>> unicodedata.bidirectional('\\N{ARABIC-INDIC DIGIT SEVEN}') # " -#~ "'A'rabic, 'N'umber\n" -#~ "'AN'" - -#~ msgid "" -#~ ">>> unicodedata.mirrored('>')\n" -#~ "1" -#~ msgstr "" -#~ ">>> unicodedata.mirrored('>')\n" -#~ "1" - -#~ msgid "" -#~ ">>> unicodedata.decomposition('Ã')\n" -#~ "'0041 0303'" -#~ msgstr "" -#~ ">>> unicodedata.decomposition('Ã')\n" -#~ "'0041 0303'" diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index cb271a4ff9f..3cb7515ac22 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-05-06 08:22+0800\n" diff --git a/library/unittest.mock.po b/library/unittest.mock.po index f8deb1273f1..e5af3c35d62 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-02-19 21:27+0800\n" @@ -722,7 +722,6 @@ msgid "Setting :attr:`side_effect` to ``None`` clears it:" msgstr "將 :attr:`side_effect` 設定為 ``None`` 可以清除它:" #: ../../library/unittest.mock.rst:639 -#, fuzzy msgid "" "This is either ``None`` (if the mock hasn't been called), or the arguments " "that the mock was last called with. This will be in the form of a tuple: the " @@ -733,7 +732,7 @@ msgid "" msgstr "" "這會是 ``None``\\ (如果 mock 尚未被呼叫),或是 mock 上次被呼叫時使用的引" "數。這將以元組的形式呈現:第一個成員 (member),其可以通過 ``args`` 屬性存取," -"是 mock 被呼叫時傳遞的所有位置引數(或一個空元組)。第二個成員,其可以通過 " +"是 mock 被呼叫時傳遞的所有有序引數(或一個空元組)。第二個成員,其可以通過 " "``kwargs`` 屬性存取,是所有關鍵字引數(或一個空字典)。" #: ../../library/unittest.mock.rst:672 @@ -2028,12 +2027,11 @@ msgid "patch.dict" msgstr "patch.dict" #: ../../library/unittest.mock.rst:1663 -#, fuzzy msgid "" "Patch a dictionary, or dictionary like object, and restore the dictionary to " "its original state after the test, where the restored dictionary is a copy " "of the dictionary as it was before the test." -msgstr "Patch 字典或類字典的物件,並在測試後將字典回復到其原本的狀態。" +msgstr "Patch 字典或類字典的物件,並在測試後將字典回復到其原本的狀態,其中回復的字典是測試前字典的複本。" #: ../../library/unittest.mock.rst:1667 msgid "" @@ -4106,21 +4104,3 @@ msgid "" msgstr "" "如果 :attr:`~Mock.side_effect` 已耗盡,則優先順序將不會使值由後面取得。相反地" "這會引發 ``StopIteration`` 例外。" - -#~ msgid "" -#~ "This can be useful where you want to make a series of assertions that " -#~ "reuse the same object. Note that :meth:`reset_mock` *doesn't* clear " -#~ "the :attr:`return_value`, :attr:`side_effect` or any child attributes you " -#~ "have set using normal assignment by default. In case you want to " -#~ "reset :attr:`return_value` or :attr:`side_effect`, then pass the " -#~ "corresponding parameter as ``True``. Child mocks and the return value " -#~ "mock (if any) are reset as well." -#~ msgstr "" -#~ "這在你想要進行一系列重複使用同一物件的斷言時非常有用。請注意,預設情況" -#~ "下,:meth:`reset_mock` *不會*\\ 清" -#~ "除 :attr:`return_value`、:attr:`side_effect` 或使用普通賦值設定的任何子屬" -#~ "性。如果你想要重置 :attr:`return_value` 或 :attr:`side_effect`,則將相應的" -#~ "參數設置為 ``True``。Child mock 和回傳值 mock(如果有的話)也會被重置。" - -#~ msgid "*return_value*, and *side_effect* are keyword-only arguments." -#~ msgstr "*return_value* 和 *side_effect* 是僅限關鍵字引數。" diff --git a/library/unittest.po b/library/unittest.po index 02b2ef821fe..88d0e389c31 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # Jason , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-10-16 06:03+0800\n" @@ -1526,31 +1526,27 @@ msgid "``not isinstance(a, b)``" msgstr "``not isinstance(a, b)``" #: ../../library/unittest.rst:886 -#, fuzzy msgid ":meth:`assertIsSubclass(a, b) `" -msgstr ":meth:`assertIs(a, b) `" +msgstr ":meth:`assertIsSubclass(a, b) `" #: ../../library/unittest.rst:886 -#, fuzzy msgid "``issubclass(a, b)``" -msgstr "``isinstance(a, b)``" +msgstr "``issubclass(a, b)``" #: ../../library/unittest.rst:886 ../../library/unittest.rst:889 #: ../../library/unittest.rst:1228 ../../library/unittest.rst:1231 #: ../../library/unittest.rst:1234 ../../library/unittest.rst:1237 #: ../../library/unittest.rst:1240 ../../library/unittest.rst:1243 msgid "3.14" -msgstr "" +msgstr "3.14" #: ../../library/unittest.rst:889 -#, fuzzy msgid ":meth:`assertNotIsSubclass(a, b) `" -msgstr ":meth:`assertNotIn(a, b) `" +msgstr ":meth:`assertNotIsSubclass(a, b) `" #: ../../library/unittest.rst:889 -#, fuzzy msgid "``not issubclass(a, b)``" -msgstr "``not isinstance(a, b)``" +msgstr "``not issubclass(a, b)``" #: ../../library/unittest.rst:893 msgid "" @@ -2050,62 +2046,52 @@ msgid "" msgstr "" #: ../../library/unittest.rst:1228 -#, fuzzy msgid ":meth:`assertStartsWith(a, b) `" -msgstr ":meth:`assertIs(a, b) `" +msgstr ":meth:`assertStartsWith(a, b) `" #: ../../library/unittest.rst:1228 msgid "``a.startswith(b)``" -msgstr "" +msgstr "``a.startswith(b)``" #: ../../library/unittest.rst:1231 -#, fuzzy msgid ":meth:`assertNotStartsWith(a, b) `" -msgstr ":meth:`assertNotIn(a, b) `" +msgstr ":meth:`assertNotStartsWith(a, b) `" #: ../../library/unittest.rst:1231 -#, fuzzy msgid "``not a.startswith(b)``" -msgstr "``not r.search(s)``" +msgstr "``not a.startswith(b)``" #: ../../library/unittest.rst:1234 -#, fuzzy msgid ":meth:`assertEndsWith(a, b) `" -msgstr ":meth:`assertIs(a, b) `" +msgstr ":meth:`assertEndsWith(a, b) `" #: ../../library/unittest.rst:1234 msgid "``a.endswith(b)``" -msgstr "" +msgstr "``a.endswith(b)``" #: ../../library/unittest.rst:1237 -#, fuzzy msgid ":meth:`assertNotEndsWith(a, b) `" -msgstr ":meth:`assertNotIn(a, b) `" +msgstr ":meth:`assertNotEndsWith(a, b) `" #: ../../library/unittest.rst:1237 -#, fuzzy msgid "``not a.endswith(b)``" -msgstr "``not r.search(s)``" +msgstr "``not a.endswith(b)``" #: ../../library/unittest.rst:1240 -#, fuzzy msgid ":meth:`assertHasAttr(a, b) `" -msgstr ":meth:`assertIs(a, b) `" +msgstr ":meth:`assertHasAttr(a, b) `" #: ../../library/unittest.rst:1240 -#, fuzzy msgid "``hastattr(a, b)``" -msgstr "``isinstance(a, b)``" +msgstr "``hastattr(a, b)``" #: ../../library/unittest.rst:1243 -#, fuzzy msgid ":meth:`assertNotHasAttr(a, b) `" -msgstr ":meth:`assertNotIn(a, b) `" +msgstr ":meth:`assertNotHasAttr(a, b) `" #: ../../library/unittest.rst:1243 -#, fuzzy msgid "``not hastattr(a, b)``" -msgstr "``not isinstance(a, b)``" +msgstr "``not hastattr(a, b)``" #: ../../library/unittest.rst:1251 msgid "" diff --git a/library/unix.po b/library/unix.po index aa639254850..1316f383c6c 100644 --- a/library/unix.po +++ b/library/unix.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-16 00:16+0000\n" "PO-Revision-Date: 2022-02-15 18:42+0800\n" diff --git a/library/urllib.error.po b/library/urllib.error.po index 550aa37d83b..4ae1d93b071 100644 --- a/library/urllib.error.po +++ b/library/urllib.error.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-06-11 15:34+0800\n" diff --git a/library/urllib.parse.po b/library/urllib.parse.po index 4d592117662..caab72679e8 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" diff --git a/library/urllib.po b/library/urllib.po index 858dce4dac2..3ec804856e8 100644 --- a/library/urllib.po +++ b/library/urllib.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-01-31 18:04+0800\n" diff --git a/library/urllib.request.po b/library/urllib.request.po index 8e30b3bd0be..c421bfa7b4a 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Adrian Liaw , 2018 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-04-21 17:59+0800\n" @@ -140,13 +140,11 @@ msgstr "" "在 :class:`~http.client.HTTPResponse` 文件中提到的回應 headers。" #: ../../library/urllib.request.rst:70 -#, fuzzy msgid "" "For FTP, file, and data URLs, this function returns " "a :class:`urllib.response.addinfourl` object." msgstr "" -"對於 FTP、檔案、資料的 URLs、以及那些由傳統 classes :class:`URLopener` " -"與 :class:`FancyURLopener` 所處理的請求,這個函式會回傳一" +"對於 FTP、檔案及資料的 URLs,這個函式會回傳一" "個 :class:`urllib.response.addinfourl` 物件。" #: ../../library/urllib.request.rst:73 @@ -302,7 +300,6 @@ msgid "This example shows the function being used on Windows::" msgstr "" #: ../../library/urllib.request.rst:159 -#, fuzzy msgid "" ">>> from urllib.request import pathname2url\n" ">>> path = 'C:\\\\Program Files'\n" @@ -311,7 +308,7 @@ msgid "" msgstr "" ">>> from urllib.request import pathname2url\n" ">>> path = 'C:\\\\Program Files'\n" -">>> 'file:' + pathname2url(path)\n" +">>> pathname2url(path, add_scheme=True)\n" "'file:///C:/Program%20Files'" #: ../../library/urllib.request.rst:164 ../../library/urllib.request.rst:202 @@ -357,7 +354,6 @@ msgid "" msgstr "" #: ../../library/urllib.request.rst:197 -#, fuzzy msgid "" ">>> from urllib.request import url2pathname\n" ">>> url = 'file:///C:/Program%20Files'\n" @@ -366,7 +362,7 @@ msgid "" msgstr "" ">>> from urllib.request import url2pathname\n" ">>> url = 'file:///C:/Program%20Files'\n" -">>> url2pathname(url.removeprefix('file:'))\n" +">>> url2pathname(url, require_scheme=True)\n" "'C:\\\\Program Files'" #: ../../library/urllib.request.rst:207 @@ -1873,7 +1869,6 @@ msgid "" msgstr "" #: ../../library/urllib.request.rst:1412 -#, fuzzy msgid "" ">>> import urllib.request\n" ">>> proxies = {'http': 'http://proxy.example.com:8080/'}\n" @@ -1885,7 +1880,8 @@ msgid "" msgstr "" ">>> import urllib.request\n" ">>> proxies = {'http': 'http://proxy.example.com:8080/'}\n" -">>> opener = urllib.request.FancyURLopener(proxies)\n" +">>> opener = " +"urllib.request.build_opener(urllib.request.ProxyHandler(proxies))\n" ">>> with opener.open(\"http://www.python.org\") as f:\n" "... f.read().decode('utf-8')\n" "..." @@ -1897,7 +1893,6 @@ msgid "" msgstr "" #: ../../library/urllib.request.rst:1421 -#, fuzzy msgid "" ">>> import urllib.request\n" ">>> opener = urllib.request.build_opener(urllib.request.ProxyHandler({}}))\n" @@ -1906,7 +1901,7 @@ msgid "" "..." msgstr "" ">>> import urllib.request\n" -">>> opener = urllib.request.FancyURLopener({})\n" +">>> opener = urllib.request.build_opener(urllib.request.ProxyHandler({}}))\n" ">>> with opener.open(\"http://www.python.org/\") as f:\n" "... f.read().decode('utf-8')\n" "..." diff --git a/library/urllib.robotparser.po b/library/urllib.robotparser.po index 7f42925a3f2..a51ec7aa92d 100644 --- a/library/urllib.robotparser.po +++ b/library/urllib.robotparser.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-01-27 13:40+0800\n" diff --git a/library/uu.po b/library/uu.po index 574b21d479c..a1f7a6c9710 100644 --- a/library/uu.po +++ b/library/uu.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/uuid.po b/library/uuid.po index d2856f34a65..a5f92c45ce4 100644 --- a/library/uuid.po +++ b/library/uuid.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" @@ -19,9 +18,8 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../library/uuid.rst:2 -#, fuzzy msgid ":mod:`!uuid` --- UUID objects according to :rfc:`9562`" -msgstr ":mod:`!uuid` --- :rfc:`4122` 定義的 UUID 物件" +msgstr ":mod:`!uuid` --- :rfc:`9562` 定義的 UUID 物件" #: ../../library/uuid.rst:9 msgid "**Source code:** :source:`Lib/uuid.py`" @@ -117,7 +115,6 @@ msgstr "" "UUID(int=0x12345678123456781234567812345678)" #: ../../library/uuid.rst:68 -#, fuzzy msgid "" "Exactly one of *hex*, *bytes*, *bytes_le*, *fields*, or *int* must be given. " "The *version* argument is optional; if given, the resulting UUID will have " @@ -125,7 +122,7 @@ msgid "" "in the given *hex*, *bytes*, *bytes_le*, *fields*, or *int*." msgstr "" "必須正好給定其中一個引數 *hex*、*bytes*、*bytes_le*、*fields* 或 *int*。" -"*version* 引數是選用的;如果給定了該引數,生成的 UUID 將根據 :rfc:`4122` 設置" +"*version* 引數是選用的;如果給定了該引數,生成的 UUID 將根據 :rfc:`9562` 設置" "其變體 (variant) 和版本號,覆蓋掉給定的 *hex*、*bytes*、*bytes_le*、*fields* " "或 *int* 中的位元。" @@ -183,24 +180,20 @@ msgid "Meaning" msgstr "意義" #: ../../library/uuid.rst:106 -#, fuzzy msgid "The first 32 bits of the UUID. Only relevant to version 1." -msgstr "UUID 的前 32 位元。" +msgstr "UUID 的前 32 位元。只與版本 1 有關。" #: ../../library/uuid.rst:109 ../../library/uuid.rst:112 -#, fuzzy msgid "The next 16 bits of the UUID. Only relevant to version 1." -msgstr "UUID 接下來的 16 位元。" +msgstr "UUID 接下來的 16 位元。只與版本 1 有關。" #: ../../library/uuid.rst:115 ../../library/uuid.rst:118 -#, fuzzy msgid "The next 8 bits of the UUID. Only relevant to versions 1 and 6." -msgstr "UUID 接下來的 8 位元。" +msgstr "UUID 接下來的 8 位元。只與版本 1 和 6 有關。" #: ../../library/uuid.rst:121 -#, fuzzy msgid "The last 48 bits of the UUID. Only relevant to version 1." -msgstr "UUID 最後的 48 位元。" +msgstr "UUID 最後的 48 位元。只與版本 1 有關。" #: ../../library/uuid.rst:124 msgid "" @@ -210,9 +203,8 @@ msgid "" msgstr "" #: ../../library/uuid.rst:130 -#, fuzzy msgid "The 14-bit sequence number. Only relevant to versions 1 and 6." -msgstr "14 位元的序列號。" +msgstr "14 位元的序列號。只與版本 1 和 6 有關。" #: ../../library/uuid.rst:135 msgid "The UUID as a 32-character lowercase hexadecimal string." @@ -223,9 +215,8 @@ msgid "The UUID as a 128-bit integer." msgstr "UUID 以 128 位元的整數表示。" #: ../../library/uuid.rst:145 -#, fuzzy msgid "The UUID as a URN as specified in :rfc:`9562`." -msgstr "UUID 以 :rfc:`4122` 中指定的 URN 形式表示。" +msgstr "UUID 以 :rfc:`9562` 中指定的 URN 形式表示。" #: ../../library/uuid.rst:150 msgid "" @@ -239,15 +230,14 @@ msgstr "" "或 :const:`RESERVED_FUTURE` 其中一個常數。" #: ../../library/uuid.rst:157 -#, fuzzy msgid "" "The UUID version number (1 through 8, meaningful only when the variant " "is :const:`RFC_4122`)." -msgstr "UUID 的版本號(1 到 5,只有當變體是 :const:`RFC_4122` 時才有意義)。" +msgstr "UUID 的版本號(1 到 8,只有當變體是 :const:`RFC_4122` 時才有意義)。" #: ../../library/uuid.rst:160 msgid "Added UUID versions 6, 7 and 8." -msgstr "" +msgstr "新增了 UUID 版本 6、7 和 8。" #: ../../library/uuid.rst:166 msgid "" @@ -309,12 +299,12 @@ msgid "" msgstr "" #: ../../library/uuid.rst:209 -#, fuzzy msgid "" "Generate a UUID based on the MD5 hash of a namespace identifier (which is a " "UUID) and a name (which is a :class:`bytes` object or a string that will be " "encoded using UTF-8) according to :rfc:`RFC 9562, §5.3 <9562#section-5.3>`." msgstr "" +"根據 :rfc:`RFC 9562, §5.3 <9562#section-5.3>`," "基於命名空間識別碼 (namespace identifier)(一個 UUID)和名稱(一" "個 :class:`bytes` 物件或使用 UTF-8 編碼的字串)的 MD5 hash 來生成 UUID。" @@ -325,13 +315,13 @@ msgid "" msgstr "" #: ../../library/uuid.rst:223 -#, fuzzy msgid "" "Generate a UUID based on the SHA-1 hash of a namespace identifier (which is " "a UUID) and a name (which is a :class:`bytes` object or a string that will " "be encoded using UTF-8) according to :rfc:`RFC 9562, §5.5 " "<9562#section-5.5>`." msgstr "" +"根據 :rfc:`RFC 9562, §5.5 <9562#section-5.5>`," "基於命名空間識別碼(一個 UUID)和名稱(一個 :class:`bytes` 物件或使用 UTF-8 " "編碼的字串)的 SHA-1 hash 來生成 UUID。" @@ -436,9 +426,8 @@ msgid "Reserved for future definition." msgstr "保留供未來定義使用。" #: ../../library/uuid.rst:327 -#, fuzzy msgid "The :mod:`uuid` module defines the special Nil and Max UUID values:" -msgstr ":mod:`uuid` 模組定義了以下函式:" +msgstr ":mod:`uuid` 模組定義了特殊的 Nil 和 Max UUID 值:" #: ../../library/uuid.rst:332 msgid "" @@ -453,10 +442,9 @@ msgid "" msgstr "" #: ../../library/uuid.rst:348 -#, fuzzy msgid ":rfc:`9562` - A Universally Unique IDentifier (UUID) URN Namespace" msgstr "" -":rfc:`4122` - 通用唯一辨識碼 (UUID, Universally Unique IDentifier) 的 URN 命" +":rfc:`9562` - 通用唯一辨識碼 (UUID, Universally Unique IDentifier) 的 URN 命" "名空間" #: ../../library/uuid.rst:349 @@ -477,12 +465,12 @@ msgid "" msgstr ":mod:`uuid` 模組可以在命令列下作為腳本來執行。" #: ../../library/uuid.rst:362 -#, fuzzy msgid "" "python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5,uuid6,uuid7,uuid8}] [-n " "NAMESPACE] [-N NAME]" msgstr "" -"python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-n NAMESPACE] [-N NAME]" +"python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5,uuid6,uuid7,uuid8}] [-n " +"NAMESPACE] [-N NAME]" #: ../../library/uuid.rst:366 msgid "The following options are accepted:" @@ -520,9 +508,8 @@ msgid "" msgstr "用於生成 uuid 的名稱。只有 :func:`uuid3` / :func:`uuid5` 函式會需要。" #: ../../library/uuid.rst:399 -#, fuzzy msgid "Generate *num* fresh UUIDs." -msgstr "生成一個隨機的 UUID。" +msgstr "生成 *num* 個新 UUID。" #: ../../library/uuid.rst:407 msgid "Example" @@ -533,7 +520,6 @@ msgid "Here are some examples of typical usage of the :mod:`uuid` module::" msgstr "以下是一些 :mod:`uuid` 模組的典型使用範例: ::" #: ../../library/uuid.rst:411 -#, fuzzy msgid "" ">>> import uuid\n" "\n" @@ -625,21 +611,45 @@ msgstr "" "\n" ">>> # 從 16 位元組的字串生成 UUID\n" ">>> uuid.UUID(bytes=x.bytes)\n" -"UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')" +"UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')\n" +"\n" +">>> # 取得 Nil UUID\n" +">>> uuid.NIL\n" +"UUID('00000000-0000-0000-0000-000000000000')\n" +"\n" +">>> # 取得 Max UUID\n" +">>> uuid.MAX\n" +"UUID('ffffffff-ffff-ffff-ffff-ffffffffffff')\n" +"\n" +">>> # 和 UUIDv1 相同但欄位重新排序以改善資料庫區域性\n" +">>> uuid.uuid6()\n" +"UUID('1f0799c0-98b9-62db-92c6-a0d365b91053')\n" +"\n" +">>> # 取得 UUIDv7 建立(本地)時間的毫秒時間戳\n" +">>> u = uuid.uuid7()\n" +">>> u.time\n" +"1743936859822\n" +"\n" +">>> # 取得 UUIDv7 建立(本地)時間的 datetime 物件\n" +">>> import datetime as dt\n" +">>> dt.datetime.fromtimestamp(u.time / 1000)\n" +"datetime.datetime(...)\n" +"\n" +">>> # 建立一個具有自訂區塊的 UUID\n" +">>> uuid.uuid8(0x12345678, 0x9abcdef0, 0x11223344)\n" +"UUID('00001234-5678-8ef0-8000-000011223344')" #: ../../library/uuid.rst:474 msgid "Command-Line Example" msgstr "命令列的範例" #: ../../library/uuid.rst:476 -#, fuzzy msgid "" "Here are some examples of typical usage of the :mod:`uuid` command-line " "interface:" msgstr "以下是一些 :mod:`uuid` 命令列介面的典型使用範例:" #: ../../library/uuid.rst:478 -#, fuzzy msgid "" "# generate a random UUID - by default uuid4() is used\n" "$ python -m uuid\n" @@ -653,37 +663,14 @@ msgid "" "# generate 42 random UUIDs\n" "$ python -m uuid -C 42" msgstr "" -"# 生成一個隨機的 uuid - 預設使用 uuid4()\n" +"# 生成一個隨機的 UUID - 預設使用 uuid4()\n" "$ python -m uuid\n" "\n" -"# 使用 uuid1() 生成一組 uuid\n" +"# 使用 uuid1() 生成一組 UUID\n" "$ python -m uuid -u uuid1\n" "\n" -"# 使用 uuid5 生成一組 uuid\n" -"$ python -m uuid -u uuid5 -n @url -N example.com" - -#~ msgid "" -#~ "This module provides immutable :class:`UUID` objects (the :class:`UUID` " -#~ "class) and the " -#~ "functions :func:`uuid1`, :func:`uuid3`, :func:`uuid4`, :func:`uuid5` for " -#~ "generating version 1, 3, 4, and 5 UUIDs as specified in :rfc:`4122`." -#~ msgstr "" -#~ "這個模組提供了不可變的 :class:`UUID` 物件(:class:`UUID` 類別)" -#~ "和 :func:`uuid1`、:func:`uuid3`、:func:`uuid4`、:func:`uuid5` 等函式,用於" -#~ "生成 :rfc:`4122` 定義的第 1、3、4、5 版本的 UUID。" - -#~ msgid "The 60-bit timestamp." -#~ msgstr "60 位元的時間戳。" - -#~ msgid "" -#~ "Generate a UUID from a host ID, sequence number, and the current time. If " -#~ "*node* is not given, :func:`getnode` is used to obtain the hardware " -#~ "address. If *clock_seq* is given, it is used as the sequence number; " -#~ "otherwise a random 14-bit sequence number is chosen." -#~ msgstr "" -#~ "從主機 ID、序列號和目前時間生成 UUID。如果未給定 *node*,將使" -#~ "用 :func:`getnode` 取得硬體位址。如果給定 *clock_seq*,會將其用作序列號;" -#~ "否則將使用一個隨機 14 位元的序列號。" - -#~ msgid "Specifies the UUID layout given in :rfc:`4122`." -#~ msgstr "使用在 :rfc:`4122` 中給定的 UUID 佈局。" +"# 使用 uuid5 生成一組 UUID\n" +"$ python -m uuid -u uuid5 -n @url -N example.com\n" +"\n" +"# 生成 42 個隨機 UUID\n" +"$ python -m uuid -C 42" diff --git a/library/venv.po b/library/venv.po index eab27e88ffa..40603b46efd 100644 --- a/library/venv.po +++ b/library/venv.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Dr-XYZ , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-05-23 10:20+0800\n" @@ -29,7 +29,6 @@ msgid "**Source code:** :source:`Lib/venv/`" msgstr "**原始碼:**\\ :source:`Lib/venv/`" #: ../../library/venv.rst:21 -#, fuzzy msgid "" "The :mod:`!venv` module supports creating lightweight \"virtual " "environments\", each with their own independent set of Python packages " @@ -44,7 +43,9 @@ msgstr "" ":mod:`!venv` 模組支援建立輕量級的「虛擬環境」,每個虛擬環境都有獨立安裝在" "其 :mod:`site` 目錄中的一組 Python 套件。虛擬環境是建立在既有的 Python 安裝上" "(稱為該虛擬環境的「基底」Python)之上,預設會與基底環境中的套件隔離,使得僅" -"能存取明確安裝在虛擬環境中的套件。" +"能存取明確安裝在虛擬環境中的套件。更多資訊請參閱 :ref:`sys-path-init-virtual-" +"environments` 以及 :mod:`site` 的\\ :ref:`虛擬環境文件 `。" #: ../../library/venv.rst:32 msgid "" @@ -138,7 +139,6 @@ msgid "python -m venv /path/to/new/virtual/environment" msgstr "python -m venv /path/to/new/virtual/environment" #: ../../library/venv.rst:74 -#, fuzzy msgid "" "This creates the target directory (including parent directories as needed) " "and places a :file:`pyvenv.cfg` file in it with a ``home`` key pointing to " @@ -154,7 +154,7 @@ msgstr "" "徑的 ``home`` 鍵。它同時會建立一個 :file:`bin` (在 Windows 上" "為 :file:`Scripts`)子目錄,其中包含一個 Python 二進位檔案的副本/符號連結(根" "據建立環境時使用的平台或引數而定)。此外,它還會建立一個 :file:`lib/" -"pythonX.Y/site-packages` 子目錄(在 Windows 上為 :file:`Lib\\\\site-" +"pythonX.Y/site-packages` 子目錄(在 Windows 上為 :file:`Lib\\site-" "packages`)。如果指定的目錄已存在,則將重新使用該目錄。" #: ../../library/venv.rst:84 diff --git a/library/warnings.po b/library/warnings.po index cbd3a3fee73..ab4a15267cf 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Dr-XYZ , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-07-14 13:00+0800\n" @@ -335,13 +335,12 @@ msgid "always print matching warnings" msgstr "總是印出匹配的警告" #: ../../library/warnings.rst:150 -#, fuzzy msgid "``\"all\"``" -msgstr "``\"always\"``" +msgstr "``\"all\"``" #: ../../library/warnings.rst:150 msgid "alias to \"always\"" -msgstr "" +msgstr "\"always\" 的別名" #: ../../library/warnings.rst:152 msgid "``\"module\"``" @@ -704,7 +703,6 @@ msgstr "" " fxn()" #: ../../library/warnings.rst:326 -#, fuzzy msgid "" "While within the context manager all warnings will simply be ignored. This " "allows you to use known-deprecated code without having to see the warning " @@ -713,8 +711,7 @@ msgid "" msgstr "" "在情境管理器中,所有警告都將被直接忽略。這允許你在使用已知的已棄用程式碼時不" "必看到警告,同時又不會抑制其他可能不知道自己正在使用已棄用程式碼的程式碼所發" -"出的警告。注意:這只能在單一執行緒的應用程式中得到保證。如果兩個或多個執行緒" -"同時使用 :class:`catch_warnings` 情境管理器,其行為是未定義的。" +"出的警告。" #: ../../library/warnings.rst:333 ../../library/warnings.rst:375 #: ../../library/warnings.rst:625 @@ -784,7 +781,6 @@ msgstr "" "過濾器,這個警告都不會再出現,除非與該警告相關的警告註冊表已被清除。" #: ../../library/warnings.rst:368 -#, fuzzy msgid "" "Once the context manager exits, the warnings filter is restored to its state " "when the context was entered. This prevents tests from changing the warnings " @@ -792,10 +788,7 @@ msgid "" "results." msgstr "" "一旦情境管理器退出,警告過濾器就會恢復到進入情境時的狀態。這可以防止測試在不" -"同測試之間以意想不到的方式更改警告過濾器,從而導致不確定的測試結果。模組中" -"的 :func:`showwarning` 函式也會恢復到其原始值。注意:這只能在單一執行緒的應用" -"程式中得到保證。如果兩個或多個執行緒同時使用 :class:`catch_warnings` 情境管理" -"器,其行為是未定義的。" +"同測試之間以意想不到的方式更改警告過濾器,從而導致不確定的測試結果。" #: ../../library/warnings.rst:379 msgid "" @@ -916,7 +909,7 @@ msgid "" "stacklevel)``. To cause a warning to be attributed to the caller from " "outside of the current package you might write::" msgstr "" -"*skip_file_prefixes* 關鍵字引數可用於指示在計算堆疊層級時應忽略哪些堆疊幀。當" +"*skip_file_prefixes* 關鍵字引數可用於指示在計算堆疊層級時應忽略哪些堆疊框。當" "你希望警告總是在套件外部的呼叫點出現,而固定的 *stacklevel* 不適用於所有呼叫" "路徑或難以維護時,這會很有用。如果提供,它必須是一個字串的元組。當提供前綴" "時,stacklevel 會被隱式地覆寫為 ``max(2, stacklevel)``。要讓警告歸因於目前套" @@ -953,14 +946,13 @@ msgstr "" " lower.one_way(**kw)" #: ../../library/warnings.rst:462 -#, fuzzy msgid "" "This makes the warning refer to both the ``example.lower.one_way()`` and " "``package.higher.another_way()`` call sites only from calling code living " "outside of ``example`` package." msgstr "" "這使得警告只會從存在於 ``example`` 套件之外的呼叫程式碼中,指向 " -"``example.lower.one_way()`` 和 ``example.higher.another_way()`` 的呼叫點。" +"``example.lower.one_way()`` 和 ``package.higher.another_way()`` 的呼叫點。" #: ../../library/warnings.rst:466 ../../library/warnings.rst:492 msgid "" @@ -1214,9 +1206,8 @@ msgid "Added the *action*, *category*, *lineno*, and *append* parameters." msgstr "新增 *action*、*category*、*lineno* 和 *append* 參數。" #: ../../library/warnings.rst:638 -#, fuzzy msgid "Concurrent safety of Context Managers" -msgstr "可用的情境管理器" +msgstr "情境管理器的並行安全性" #: ../../library/warnings.rst:640 msgid "" diff --git a/library/wave.po b/library/wave.po index f397aec31bb..fa5d5eedf64 100644 --- a/library/wave.po +++ b/library/wave.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" diff --git a/library/weakref.po b/library/weakref.po index b1adbed3a3f..d9d887dcdd2 100644 --- a/library/weakref.po +++ b/library/weakref.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2024-05-22 20:58+0800\n" diff --git a/library/webbrowser.po b/library/webbrowser.po index f9ff28fb495..e367346580b 100644 --- a/library/webbrowser.po +++ b/library/webbrowser.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-09-24 18:27+0000\n" @@ -48,7 +48,6 @@ msgstr "" "到使用者退出瀏覽器。" #: ../../library/webbrowser.rst:23 -#, fuzzy msgid "" "If the environment variable :envvar:`BROWSER` exists, it is interpreted as " "the :data:`os.pathsep`-separated list of browsers to try ahead of the " @@ -61,7 +60,8 @@ msgid "" msgstr "" "如果環境變數 :envvar:`BROWSER` 存在,它會被直譯為以 :data:`os.pathsep` 分隔的" "瀏覽器串列,以在平台預設值之前嘗試。當串列部分的值包含字串 ``%s`` 時,它會被" -"直譯為字面瀏覽器命令列,並使用引數 URL 替換 ``%s``;如果該部分不包含 ``%s``," +"直譯為字面瀏覽器命令列,並使用引數 URL 替換 ``%s``;如果值是指向已註冊瀏覽器之一的單個字,則" +"此瀏覽器會被新增到搜尋串列的前面;如果該部分不包含 ``%s``," "則它僅被直譯為要啟動的瀏覽器的名稱。 [1]_" #: ../../library/webbrowser.rst:34 diff --git a/library/windows.po b/library/windows.po index a77a8f584e6..2012b6d5f45 100644 --- a/library/windows.po +++ b/library/windows.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-02-15 18:37+0800\n" diff --git a/library/winreg.po b/library/winreg.po index fa46e096f85..f8ca0a02065 100644 --- a/library/winreg.po +++ b/library/winreg.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" diff --git a/library/winsound.po b/library/winsound.po index 0c3c5b91bd8..020f1d5c3fc 100644 --- a/library/winsound.po +++ b/library/winsound.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Dr-XYZ , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-05-19 23:00+0800\n" @@ -232,15 +231,15 @@ msgstr "" #: ../../library/winsound.rst:147 msgid "Triggers a SoundSentry event when the sound is played." -msgstr "" +msgstr "當音效被播放時,會觸發 SoundSentry 事件。" #: ../../library/winsound.rst:154 msgid "The sound is played synchronously. This is the default behavior." -msgstr "" +msgstr "音效會同步播放。這是預設行為。" #: ../../library/winsound.rst:161 msgid "Assign the sound to the audio session for system notification sounds." -msgstr "" +msgstr "將音效指派給系統通知音效的音訊工作階段 (audio session)。" #: ../../library/winsound.rst:168 ../../library/winsound.rst:188 #: ../../library/winsound.rst:200 diff --git a/library/wsgiref.po b/library/wsgiref.po index a35424b61e6..9a81e2abcc2 100644 --- a/library/wsgiref.po +++ b/library/wsgiref.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-25 00:14+0000\n" "PO-Revision-Date: 2023-12-09 21:29+0800\n" diff --git a/library/xdrlib.po b/library/xdrlib.po index 383e29047e8..dd80c0eef3e 100644 --- a/library/xdrlib.po +++ b/library/xdrlib.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/xml.dom.minidom.po b/library/xml.dom.minidom.po index ee2ea5fccb4..c826ec5f0ab 100644 --- a/library/xml.dom.minidom.po +++ b/library/xml.dom.minidom.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" diff --git a/library/xml.dom.po b/library/xml.dom.po index 650d019f11e..c3146150863 100644 --- a/library/xml.dom.po +++ b/library/xml.dom.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xml.dom.pulldom.po b/library/xml.dom.pulldom.po index bc91d5c0667..1b0a8c2c5ac 100644 --- a/library/xml.dom.pulldom.po +++ b/library/xml.dom.pulldom.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Adrian Liaw , 2018 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xml.etree.elementtree.po b/library/xml.etree.elementtree.po index bfd50c500cc..b85ee6b991f 100644 --- a/library/xml.etree.elementtree.po +++ b/library/xml.etree.elementtree.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xml.po b/library/xml.po index 9793de3e4ff..c108ce336b9 100644 --- a/library/xml.po +++ b/library/xml.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2023-08-21 02:16+0000\n" diff --git a/library/xml.sax.handler.po b/library/xml.sax.handler.po index ccd1def70d5..d808995c743 100644 --- a/library/xml.sax.handler.po +++ b/library/xml.sax.handler.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-04 00:15+0000\n" "PO-Revision-Date: 2016-11-19 00:36+0000\n" diff --git a/library/xml.sax.po b/library/xml.sax.po index 84e8592adbf..1df680f2aa4 100644 --- a/library/xml.sax.po +++ b/library/xml.sax.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Liang-Bo Wang , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2016-11-19 00:36+0000\n" diff --git a/library/xml.sax.reader.po b/library/xml.sax.reader.po index 7ec25804670..c1d03e25444 100644 --- a/library/xml.sax.reader.po +++ b/library/xml.sax.reader.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xml.sax.utils.po b/library/xml.sax.utils.po index 4434364d925..54b14ffaf62 100644 --- a/library/xml.sax.utils.po +++ b/library/xml.sax.utils.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2025-07-10 23:59+0800\n" diff --git a/library/xmlrpc.client.po b/library/xmlrpc.client.po index 11a0724cc9d..6533d9e6829 100644 --- a/library/xmlrpc.client.po +++ b/library/xmlrpc.client.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xmlrpc.po b/library/xmlrpc.po index 67ae4e4fe65..63f4391ea3e 100644 --- a/library/xmlrpc.po +++ b/library/xmlrpc.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-12-11 00:14+0000\n" "PO-Revision-Date: 2022-02-16 01:58+0800\n" diff --git a/library/xmlrpc.server.po b/library/xmlrpc.server.po index 2f9746ce243..7ea3d87f109 100644 --- a/library/xmlrpc.server.po +++ b/library/xmlrpc.server.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/zipapp.po b/library/zipapp.po index 15bbb401103..8f95f561802 100644 --- a/library/zipapp.po +++ b/library/zipapp.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Dr-XYZ , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2025-07-13 16:00+0800\n" diff --git a/library/zipfile.po b/library/zipfile.po index 7bbcf6c3b28..e6324e74766 100644 --- a/library/zipfile.po +++ b/library/zipfile.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Dr-XYZ , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2025-06-26 20:00+0800\n" @@ -163,11 +162,10 @@ msgid "" msgstr "用於 LZMA 壓縮方法的數值常數。這需要 :mod:`lzma` 模組。" #: ../../library/zipfile.rst:134 -#, fuzzy msgid "" "The numeric constant for Zstandard compression. This requires " "the :mod:`compression.zstd` module." -msgstr "用於 BZIP2 壓縮方法的數值常數。這需要 :mod:`bz2` 模組。" +msgstr "用於 Zstandard 壓縮方法的數值常數。這需要 :mod:`compression.zstd` 模組。" #: ../../library/zipfile.rst:139 msgid "" @@ -179,7 +177,6 @@ msgid "" msgstr "" #: ../../library/zipfile.rst:149 -#, fuzzy msgid "" "The ZIP file format specification has included support for bzip2 compression " "since 2001, for LZMA compression since 2006, and Zstandard compression since " @@ -187,9 +184,9 @@ msgid "" "these compression methods, and may either refuse to process the ZIP file " "altogether, or fail to extract individual files." msgstr "" -"ZIP 檔案格式規範自 2001 年起已包含對 bzip2 壓縮的支援,並自 2006 年起支援 " -"LZMA 壓縮。然而,某些工具(包括舊版的 Python)不支援這些壓縮方法,可能會完全" -"拒絕處理該 ZIP 檔案,或無法解壓縮個別檔案。" +"ZIP 檔案格式規範自 2001 年起已包含對 bzip2 壓縮的支援、自 2006 年起支援 " +"LZMA 壓縮、自 2020 年起支援 Zstandard 壓縮。然而某些工具(包括舊版的 Python)" +"不支援這些壓縮方法,可能會完全拒絕處理該 ZIP 檔案,或無法解壓縮個別檔案。" #: ../../library/zipfile.rst:157 msgid "`PKZIP Application Note`_" @@ -248,7 +245,6 @@ msgstr "" "(seekable)。" #: ../../library/zipfile.rst:191 -#, fuzzy msgid "" "*compression* is the ZIP compression method to use when writing the archive, " "and should " @@ -261,10 +257,10 @@ msgid "" "available, :exc:`RuntimeError` is raised. The default is :const:`ZIP_STORED`." msgstr "" "*compression* 是寫入封存檔案時要使用的 ZIP 壓縮方法,應" -"為 :const:`ZIP_STORED`、:const:`ZIP_DEFLATED`、:const:`ZIP_BZIP2` " -"或 :const:`ZIP_LZMA`;無法識別的值將導致引發 :exc:`NotImplementedError`。如果" -"指定了 :const:`ZIP_DEFLATED`、:const:`ZIP_BZIP2` 或 :const:`ZIP_LZMA`,但對應" -"的模組(:mod:`zlib`、:mod:`bz2` 或 :mod:`lzma`)不可用,則會引" +"為 :const:`ZIP_STORED`、:const:`ZIP_DEFLATED`、:const:`ZIP_BZIP2`、" +":const:`ZIP_LZMA` 或 :const:`ZIP_ZSTANDARD`;無法識別的值將導致引發 :exc:`NotImplementedError`。如果" +"指定了 :const:`ZIP_DEFLATED`、:const:`ZIP_BZIP2`、:const:`ZIP_LZMA` 或 :const:`ZIP_ZSTANDARD`,但對應" +"的模組(:mod:`zlib`、:mod:`bz2`、:mod:`lzma` 或 :mod:`compression.zstd`)不可用,則會引" "發 :exc:`RuntimeError`。預設為 :const:`ZIP_STORED`。" #: ../../library/zipfile.rst:200 @@ -279,7 +275,6 @@ msgstr "" "要 ZIP64 擴充時,:mod:`zipfile` 將會引發一個例外。" #: ../../library/zipfile.rst:205 -#, fuzzy msgid "" "The *compresslevel* parameter controls the compression level to use when " "writing files to the archive. When using :const:`ZIP_STORED` " @@ -297,7 +292,10 @@ msgstr "" "用 :const:`ZIP_STORED` 或 :const:`ZIP_LZMA` 時,它沒有效果。當使" "用 :const:`ZIP_DEFLATED` 時,接受整數 ``0`` 到 ``9``\\ (更多資訊請參" "閱 :class:`zlib `)。當使用 :const:`ZIP_BZIP2` 時,接受整" -"數 ``1`` 到 ``9``\\ (更多資訊請參閱 :class:`bz2 `)。" +"數 ``1`` 到 ``9``\\ (更多資訊請參閱 :class:`bz2 `)。當" +"使用 :const:`ZIP_ZSTANDARD` 時,通常接受整數 ``-131072`` 到 ``22``\\ (" +"更多關於檢索有效值及其含義,請參閱 :attr:`CompressionParameter.compression_level " +"`)。" #: ../../library/zipfile.rst:217 ../../library/zipfile.rst:799 msgid "" @@ -648,7 +646,6 @@ msgid "" msgstr "設定 *pwd*\\ (一個 :class:`bytes` 物件)為解壓縮加密檔案的預設密碼。" #: ../../library/zipfile.rst:432 -#, fuzzy msgid "" "Return the bytes of the file *name* in the archive. *name* is the name of " "the file in the archive, or a :class:`ZipInfo` object. The archive must be " @@ -664,8 +661,8 @@ msgstr "" "個 :class:`ZipInfo` 物件。封存檔案必須以讀取或附加模式開啟。*pwd* 是用於加密" "檔案的密碼,為一個 :class:`bytes` 物件,如果指定,將會覆寫" "用 :meth:`setpassword` 設定的預設密碼。在一個使" -"用 :const:`ZIP_STORED`、:const:`ZIP_DEFLATED`、:const:`ZIP_BZIP2` " -"或 :const:`ZIP_LZMA` 以外壓縮方法的 ZipFile 上呼叫 :meth:`read` 將會引" +"用 :const:`ZIP_STORED`、:const:`ZIP_DEFLATED`、:const:`ZIP_BZIP2`、" +":const:`ZIP_LZMA` 或 :const:`ZIP_ZSTANDARD` 以外壓縮方法的 ZipFile 上呼叫 :meth:`read` 將會引" "發 :exc:`NotImplementedError`。如果對應的壓縮模組不可用,也會引發一個錯誤。" #: ../../library/zipfile.rst:442 @@ -1220,13 +1217,11 @@ msgid "Name of the file in the archive." msgstr "封存檔案中檔案的名稱。" #: ../../library/zipfile.rst:832 -#, fuzzy msgid "" "The time and date of the last modification to the archive member. This is a " "tuple of six values:" msgstr "" -"封存成員的最後修改時間和日期。這是一個包含六個值的元組,代表 ZIP 檔案中心目錄" -"的「最後 [修改] 檔案時間」和「最後 [修改] 檔案日期」欄位。" +"封存成員的最後修改時間和日期。這是一個包含六個值的元組:" #: ../../library/zipfile.rst:836 msgid "Index" @@ -1504,6 +1499,3 @@ msgid "" msgstr "" "不了解預設的解壓縮行為可能導致非預期的解壓縮結果。例如,當兩次解壓縮同一個封" "存檔案時,它會不經詢問就覆寫檔案。" - -#~ msgid "The tuple contains:" -#~ msgstr "該元組包含:" diff --git a/library/zipimport.po b/library/zipimport.po index eb4a541dff7..28c18c861b8 100644 --- a/library/zipimport.po +++ b/library/zipimport.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Dr-XYZ , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-01 00:19+0000\n" "PO-Revision-Date: 2025-06-29 00:00+0800\n" diff --git a/library/zlib.po b/library/zlib.po index 611b1431492..0429d60bb1e 100644 --- a/library/zlib.po +++ b/library/zlib.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-12-28 20:58+0800\n" diff --git a/library/zoneinfo.po b/library/zoneinfo.po index 17e24bde89f..1639615084c 100644 --- a/library/zoneinfo.po +++ b/library/zoneinfo.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Dr-XYZ , 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2025-06-21 20:00+0800\n" diff --git a/license.po b/license.po index fb16bd6c843..30fd22c2e6e 100644 --- a/license.po +++ b/license.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-06-27 09:40+0800\n" @@ -280,7 +280,6 @@ msgid "PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2" msgstr "PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2" #: ../../license.rst:98 -#, fuzzy msgid "" "1. This LICENSE AGREEMENT is between the Python Software Foundation " "(\"PSF\"), and\n" @@ -358,7 +357,7 @@ msgstr "" " distribute, and otherwise use Python alone or in any derivative\n" " version, provided, however, that PSF's License Agreement and PSF's notice " "of\n" -" copyright, i.e., \"Copyright © 2001-2024 Python Software Foundation; All " +" copyright, i.e., \"Copyright © 2001 Python Software Foundation; All " "Rights\n" " Reserved\" are retained in Python alone or in any derivative version\n" " prepared by Licensee.\n" @@ -2518,7 +2517,6 @@ msgid "" msgstr "" #: ../../license.rst:1145 -#, fuzzy msgid "" "Copyright (c) 2020-present, Ma Lin and contributors.\n" "All rights reserved.\n" @@ -2556,29 +2554,38 @@ msgid "" "USE\n" "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." msgstr "" -"Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n" +"Copyright (c) 2020-present, Ma Lin and contributors.\n" "All rights reserved.\n" "\n" "Redistribution and use in source and binary forms, with or without\n" -"modification, are permitted provided that the following conditions\n" -"are met:\n" -"1. Redistributions of source code must retain the above copyright\n" -" notice, this list of conditions and the following disclaimer.\n" -"2. Redistributions in binary form must reproduce the above copyright\n" -" notice, this list of conditions and the following disclaimer in the\n" -" documentation and/or other materials provided with the distribution.\n" -"3. Neither the name of the project nor the names of its contributors\n" -" may be used to endorse or promote products derived from this software\n" -" without specific prior written permission.\n" +"modification, are permitted provided that the following conditions are met:\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS \"AS IS\" AND\n" -"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" -"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" -"ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n" +"1. Redistributions of source code must retain the above copyright notice, " +"this\n" +" list of conditions and the following disclaimer.\n" +"\n" +"2. Redistributions in binary form must reproduce the above copyright " +"notice,\n" +" this list of conditions and the following disclaimer in the " +"documentation\n" +" and/or other materials provided with the distribution.\n" +"\n" +"3. Neither the name of the copyright holder nor the names of its\n" +" contributors may be used to endorse or promote products derived from\n" +" this software without specific prior written permission.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS " +"IS\"\n" +"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE " +"ARE\n" +"DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE " +"LIABLE\n" "FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" -"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" -"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" -"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" -"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" -"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" -"SUCH DAMAGE." +"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n" +"SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n" +"CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT " +"LIABILITY,\n" +"OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE " +"USE\n" +"OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 6e18f96433e..4b3a5146d24 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -1,12 +1,12 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -461,18 +461,18 @@ msgstr ":keyword:`!finally` 子句" msgid "" "If :keyword:`!finally` is present, it specifies a 'cleanup' handler. " "The :keyword:`try` clause is executed, including any :keyword:`except` " -"and :keyword:`else` clauses. If an exception occurs in any of the clauses " -"and is not handled, the exception is temporarily saved. The :keyword:`!" -"finally` clause is executed. If there is a saved exception it is re-raised " -"at the end of the :keyword:`!finally` clause. If the :keyword:`!finally` " -"clause raises another exception, the saved exception is set as the context " -"of the new exception. If the :keyword:`!finally` clause executes " -"a :keyword:`return`, :keyword:`break` or :keyword:`continue` statement, the " -"saved exception is discarded. For example, this function returns 42." +"and :keyword:`else ` clauses. If an exception occurs in any of " +"the clauses and is not handled, the exception is temporarily saved. " +"The :keyword:`!finally` clause is executed. If there is a saved exception " +"it is re-raised at the end of the :keyword:`!finally` clause. If " +"the :keyword:`!finally` clause raises another exception, the saved exception " +"is set as the context of the new exception. If the :keyword:`!finally` " +"clause executes a :keyword:`return`, :keyword:`break` or :keyword:`continue` " +"statement, the saved exception is discarded. For example, this function " +"returns 42." msgstr "" -#: ../../reference/compound_stmts.rst:429 -#, fuzzy +#: ../../reference/compound_stmts.rst:431 msgid "" "def f():\n" " try:\n" @@ -480,22 +480,19 @@ msgid "" " finally:\n" " return 42" msgstr "" -">>> def f():\n" -"... try:\n" -"... 1/0\n" -"... finally:\n" -"... return 42\n" -"...\n" -">>> f()\n" -"42" +"def f():\n" +" try:\n" +" 1/0\n" +" finally:\n" +" return 42" -#: ../../reference/compound_stmts.rst:437 +#: ../../reference/compound_stmts.rst:439 msgid "" "The exception information is not available to the program during execution " "of the :keyword:`!finally` clause." msgstr "" -#: ../../reference/compound_stmts.rst:445 +#: ../../reference/compound_stmts.rst:447 msgid "" "When a :keyword:`return`, :keyword:`break` or :keyword:`continue` statement " "is executed in the :keyword:`try` suite of a :keyword:`!try`...\\ :keyword:`!" @@ -503,7 +500,7 @@ msgid "" "way out.'" msgstr "" -#: ../../reference/compound_stmts.rst:449 +#: ../../reference/compound_stmts.rst:451 msgid "" "The return value of a function is determined by the last :keyword:`return` " "statement executed. Since the :keyword:`!finally` clause always executes, " @@ -512,8 +509,7 @@ msgid "" "'finally'." msgstr "" -#: ../../reference/compound_stmts.rst:454 -#, fuzzy +#: ../../reference/compound_stmts.rst:456 msgid "" "def foo():\n" " try:\n" @@ -521,33 +517,30 @@ msgid "" " finally:\n" " return 'finally'" msgstr "" -">>> def foo():\n" -"... try:\n" -"... return 'try'\n" -"... finally:\n" -"... return 'finally'\n" -"...\n" -">>> foo()\n" -"'finally'" +"def foo():\n" +" try:\n" +" return 'try'\n" +" finally:\n" +" return 'finally'" -#: ../../reference/compound_stmts.rst:462 +#: ../../reference/compound_stmts.rst:464 msgid "" "Prior to Python 3.8, a :keyword:`continue` statement was illegal in " "the :keyword:`!finally` clause due to a problem with the implementation." msgstr "" -#: ../../reference/compound_stmts.rst:466 +#: ../../reference/compound_stmts.rst:468 msgid "" "The compiler emits a :exc:`SyntaxWarning` when " "a :keyword:`return`, :keyword:`break` or :keyword:`continue` appears in " "a :keyword:`!finally` block (see :pep:`765`)." msgstr "" -#: ../../reference/compound_stmts.rst:476 +#: ../../reference/compound_stmts.rst:478 msgid "The :keyword:`!with` statement" msgstr ":keyword:`!with` 陳述式" -#: ../../reference/compound_stmts.rst:485 +#: ../../reference/compound_stmts.rst:487 msgid "" "The :keyword:`with` statement is used to wrap the execution of a block with " "methods defined by a context manager (see section :ref:`context-managers`). " @@ -555,38 +548,38 @@ msgid "" "\\ :keyword:`finally` usage patterns to be encapsulated for convenient reuse." msgstr "" -#: ../../reference/compound_stmts.rst:495 +#: ../../reference/compound_stmts.rst:497 msgid "" "The execution of the :keyword:`with` statement with one \"item\" proceeds as " "follows:" msgstr "" -#: ../../reference/compound_stmts.rst:497 +#: ../../reference/compound_stmts.rst:499 msgid "" "The context expression (the expression given in the :token:`~python-" "grammar:with_item`) is evaluated to obtain a context manager." msgstr "" -#: ../../reference/compound_stmts.rst:500 +#: ../../reference/compound_stmts.rst:502 msgid "" "The context manager's :meth:`~object.__enter__` is loaded for later use." msgstr "" -#: ../../reference/compound_stmts.rst:502 +#: ../../reference/compound_stmts.rst:504 msgid "The context manager's :meth:`~object.__exit__` is loaded for later use." msgstr "" -#: ../../reference/compound_stmts.rst:504 +#: ../../reference/compound_stmts.rst:506 msgid "The context manager's :meth:`~object.__enter__` method is invoked." msgstr "" -#: ../../reference/compound_stmts.rst:506 +#: ../../reference/compound_stmts.rst:508 msgid "" "If a target was included in the :keyword:`with` statement, the return value " "from :meth:`~object.__enter__` is assigned to it." msgstr "" -#: ../../reference/compound_stmts.rst:511 +#: ../../reference/compound_stmts.rst:513 msgid "" "The :keyword:`with` statement guarantees that if " "the :meth:`~object.__enter__` method returns without an error, " @@ -595,11 +588,11 @@ msgid "" "as an error occurring within the suite would be. See step 7 below." msgstr "" -#: ../../reference/compound_stmts.rst:517 +#: ../../reference/compound_stmts.rst:519 msgid "The suite is executed." msgstr "" -#: ../../reference/compound_stmts.rst:519 +#: ../../reference/compound_stmts.rst:521 msgid "" "The context manager's :meth:`~object.__exit__` method is invoked. If an " "exception caused the suite to be exited, its type, value, and traceback are " @@ -607,7 +600,7 @@ msgid "" "three :const:`None` arguments are supplied." msgstr "" -#: ../../reference/compound_stmts.rst:524 +#: ../../reference/compound_stmts.rst:526 msgid "" "If the suite was exited due to an exception, and the return value from " "the :meth:`~object.__exit__` method was false, the exception is reraised. " @@ -615,20 +608,20 @@ msgid "" "continues with the statement following the :keyword:`with` statement." msgstr "" -#: ../../reference/compound_stmts.rst:529 +#: ../../reference/compound_stmts.rst:531 msgid "" "If the suite was exited for any reason other than an exception, the return " "value from :meth:`~object.__exit__` is ignored, and execution proceeds at " "the normal location for the kind of exit that was taken." msgstr "" -#: ../../reference/compound_stmts.rst:533 -#: ../../reference/compound_stmts.rst:1550 -#: ../../reference/compound_stmts.rst:1591 +#: ../../reference/compound_stmts.rst:535 +#: ../../reference/compound_stmts.rst:1552 +#: ../../reference/compound_stmts.rst:1593 msgid "The following code::" msgstr "以下程式碼: ::" -#: ../../reference/compound_stmts.rst:535 +#: ../../reference/compound_stmts.rst:537 msgid "" "with EXPRESSION as TARGET:\n" " SUITE" @@ -636,13 +629,13 @@ msgstr "" "with EXPRESSION as TARGET:\n" " SUITE" -#: ../../reference/compound_stmts.rst:538 -#: ../../reference/compound_stmts.rst:563 -#: ../../reference/compound_stmts.rst:1596 +#: ../../reference/compound_stmts.rst:540 +#: ../../reference/compound_stmts.rst:565 +#: ../../reference/compound_stmts.rst:1598 msgid "is semantically equivalent to::" msgstr "在語義上等同於: ::" -#: ../../reference/compound_stmts.rst:540 +#: ../../reference/compound_stmts.rst:542 msgid "" "manager = (EXPRESSION)\n" "enter = type(manager).__enter__\n" @@ -678,13 +671,13 @@ msgstr "" " if not hit_except:\n" " exit(manager, None, None, None)" -#: ../../reference/compound_stmts.rst:557 +#: ../../reference/compound_stmts.rst:559 msgid "" "With more than one item, the context managers are processed as if " "multiple :keyword:`with` statements were nested::" msgstr "" -#: ../../reference/compound_stmts.rst:560 +#: ../../reference/compound_stmts.rst:562 msgid "" "with A() as a, B() as b:\n" " SUITE" @@ -692,7 +685,7 @@ msgstr "" "with A() as a, B() as b:\n" " SUITE" -#: ../../reference/compound_stmts.rst:565 +#: ../../reference/compound_stmts.rst:567 msgid "" "with A() as a:\n" " with B() as b:\n" @@ -702,13 +695,13 @@ msgstr "" " with B() as b:\n" " SUITE" -#: ../../reference/compound_stmts.rst:569 +#: ../../reference/compound_stmts.rst:571 msgid "" "You can also write multi-item context managers in multiple lines if the " "items are surrounded by parentheses. For example::" msgstr "" -#: ../../reference/compound_stmts.rst:572 +#: ../../reference/compound_stmts.rst:574 msgid "" "with (\n" " A() as a,\n" @@ -722,88 +715,88 @@ msgstr "" "):\n" " SUITE" -#: ../../reference/compound_stmts.rst:578 +#: ../../reference/compound_stmts.rst:580 msgid "Support for multiple context expressions." msgstr "" -#: ../../reference/compound_stmts.rst:581 +#: ../../reference/compound_stmts.rst:583 msgid "" "Support for using grouping parentheses to break the statement in multiple " "lines." msgstr "" -#: ../../reference/compound_stmts.rst:586 +#: ../../reference/compound_stmts.rst:588 msgid ":pep:`343` - The \"with\" statement" msgstr "" -#: ../../reference/compound_stmts.rst:587 +#: ../../reference/compound_stmts.rst:589 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/compound_stmts.rst:593 +#: ../../reference/compound_stmts.rst:595 msgid "The :keyword:`!match` statement" msgstr ":keyword:`!match` 陳述式" -#: ../../reference/compound_stmts.rst:607 +#: ../../reference/compound_stmts.rst:609 msgid "The match statement is used for pattern matching. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:616 +#: ../../reference/compound_stmts.rst:618 msgid "" "This section uses single quotes to denote :ref:`soft keywords `." msgstr "" -#: ../../reference/compound_stmts.rst:619 +#: ../../reference/compound_stmts.rst:621 msgid "" "Pattern matching takes a pattern as input (following ``case``) and a subject " "value (following ``match``). The pattern (which may contain subpatterns) is " "matched against the subject value. The outcomes are:" msgstr "" -#: ../../reference/compound_stmts.rst:623 +#: ../../reference/compound_stmts.rst:625 msgid "A match success or failure (also termed a pattern success or failure)." msgstr "" -#: ../../reference/compound_stmts.rst:625 +#: ../../reference/compound_stmts.rst:627 msgid "" "Possible binding of matched values to a name. The prerequisites for this " "are further discussed below." msgstr "" -#: ../../reference/compound_stmts.rst:628 +#: ../../reference/compound_stmts.rst:630 msgid "" "The ``match`` and ``case`` keywords are :ref:`soft keywords `." msgstr "" -#: ../../reference/compound_stmts.rst:632 -#: ../../reference/compound_stmts.rst:1189 +#: ../../reference/compound_stmts.rst:634 +#: ../../reference/compound_stmts.rst:1191 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../reference/compound_stmts.rst:633 -#: ../../reference/compound_stmts.rst:1190 +#: ../../reference/compound_stmts.rst:635 +#: ../../reference/compound_stmts.rst:1192 msgid ":pep:`636` -- Structural Pattern Matching: Tutorial" msgstr "" -#: ../../reference/compound_stmts.rst:637 +#: ../../reference/compound_stmts.rst:639 msgid "Overview" msgstr "" -#: ../../reference/compound_stmts.rst:639 +#: ../../reference/compound_stmts.rst:641 msgid "Here's an overview of the logical flow of a match statement:" msgstr "" -#: ../../reference/compound_stmts.rst:642 +#: ../../reference/compound_stmts.rst:644 msgid "" "The subject expression ``subject_expr`` is evaluated and a resulting subject " "value obtained. If the subject expression contains a comma, a tuple is " "constructed using :ref:`the standard rules `." msgstr "" -#: ../../reference/compound_stmts.rst:646 +#: ../../reference/compound_stmts.rst:648 msgid "" "Each pattern in a ``case_block`` is attempted to match with the subject " "value. The specific rules for success or failure are described below. The " @@ -813,7 +806,7 @@ msgid "" "outlive the executed block and can be used after the match statement**." msgstr "" -#: ../../reference/compound_stmts.rst:655 +#: ../../reference/compound_stmts.rst:657 msgid "" "During failed pattern matches, some subpatterns may succeed. Do not rely on " "bindings being made for a failed match. Conversely, do not rely on " @@ -822,38 +815,38 @@ msgid "" "made to allow different implementations to add optimizations." msgstr "" -#: ../../reference/compound_stmts.rst:662 +#: ../../reference/compound_stmts.rst:664 msgid "" "If the pattern succeeds, the corresponding guard (if present) is evaluated. " "In this case all name bindings are guaranteed to have happened." msgstr "" -#: ../../reference/compound_stmts.rst:665 +#: ../../reference/compound_stmts.rst:667 msgid "" "If the guard evaluates as true or is missing, the ``block`` inside " "``case_block`` is executed." msgstr "" -#: ../../reference/compound_stmts.rst:668 +#: ../../reference/compound_stmts.rst:670 msgid "Otherwise, the next ``case_block`` is attempted as described above." msgstr "" -#: ../../reference/compound_stmts.rst:670 +#: ../../reference/compound_stmts.rst:672 msgid "If there are no further case blocks, the match statement is completed." msgstr "" -#: ../../reference/compound_stmts.rst:674 +#: ../../reference/compound_stmts.rst:676 msgid "" "Users should generally never rely on a pattern being evaluated. Depending " "on implementation, the interpreter may cache values or use other " "optimizations which skip repeated evaluations." msgstr "" -#: ../../reference/compound_stmts.rst:678 +#: ../../reference/compound_stmts.rst:680 msgid "A sample match statement::" msgstr "" -#: ../../reference/compound_stmts.rst:680 +#: ../../reference/compound_stmts.rst:682 msgid "" ">>> flag = False\n" ">>> match (100, 200):\n" @@ -869,56 +862,56 @@ msgid "" "Case 3, y: 200" msgstr "" -#: ../../reference/compound_stmts.rst:694 +#: ../../reference/compound_stmts.rst:696 msgid "" "In this case, ``if flag`` is a guard. Read more about that in the next " "section." msgstr "" -#: ../../reference/compound_stmts.rst:697 +#: ../../reference/compound_stmts.rst:699 msgid "Guards" msgstr "" -#: ../../reference/compound_stmts.rst:704 +#: ../../reference/compound_stmts.rst:706 msgid "" "A ``guard`` (which is part of the ``case``) must succeed for code inside the " "``case`` block to execute. It takes the form: :keyword:`if` followed by an " "expression." msgstr "" -#: ../../reference/compound_stmts.rst:709 +#: ../../reference/compound_stmts.rst:711 msgid "The logical flow of a ``case`` block with a ``guard`` follows:" msgstr "" -#: ../../reference/compound_stmts.rst:711 +#: ../../reference/compound_stmts.rst:713 msgid "" "Check that the pattern in the ``case`` block succeeded. If the pattern " "failed, the ``guard`` is not evaluated and the next ``case`` block is " "checked." msgstr "" -#: ../../reference/compound_stmts.rst:715 +#: ../../reference/compound_stmts.rst:717 msgid "If the pattern succeeded, evaluate the ``guard``." msgstr "" -#: ../../reference/compound_stmts.rst:717 +#: ../../reference/compound_stmts.rst:719 msgid "" "If the ``guard`` condition evaluates as true, the case block is selected." msgstr "" -#: ../../reference/compound_stmts.rst:720 +#: ../../reference/compound_stmts.rst:722 msgid "" "If the ``guard`` condition evaluates as false, the case block is not " "selected." msgstr "" -#: ../../reference/compound_stmts.rst:723 +#: ../../reference/compound_stmts.rst:725 msgid "" "If the ``guard`` raises an exception during evaluation, the exception " "bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:726 +#: ../../reference/compound_stmts.rst:728 msgid "" "Guards are allowed to have side effects as they are expressions. Guard " "evaluation must proceed from the first to the last case block, one at a " @@ -927,17 +920,17 @@ msgid "" "block is selected." msgstr "" -#: ../../reference/compound_stmts.rst:736 +#: ../../reference/compound_stmts.rst:738 msgid "Irrefutable Case Blocks" msgstr "" -#: ../../reference/compound_stmts.rst:740 +#: ../../reference/compound_stmts.rst:742 msgid "" "An irrefutable case block is a match-all case block. A match statement may " "have at most one irrefutable case block, and it must be last." msgstr "" -#: ../../reference/compound_stmts.rst:743 +#: ../../reference/compound_stmts.rst:745 msgid "" "A case block is considered irrefutable if it has no guard and its pattern is " "irrefutable. A pattern is considered irrefutable if we can prove from its " @@ -945,47 +938,47 @@ msgid "" "irrefutable:" msgstr "" -#: ../../reference/compound_stmts.rst:748 +#: ../../reference/compound_stmts.rst:750 msgid ":ref:`as-patterns` whose left-hand side is irrefutable" msgstr "" -#: ../../reference/compound_stmts.rst:750 +#: ../../reference/compound_stmts.rst:752 msgid ":ref:`or-patterns` containing at least one irrefutable pattern" msgstr "" -#: ../../reference/compound_stmts.rst:752 +#: ../../reference/compound_stmts.rst:754 msgid ":ref:`capture-patterns`" msgstr ":ref:`capture-patterns`" -#: ../../reference/compound_stmts.rst:754 +#: ../../reference/compound_stmts.rst:756 msgid ":ref:`wildcard-patterns`" msgstr ":ref:`wildcard-patterns`" -#: ../../reference/compound_stmts.rst:756 +#: ../../reference/compound_stmts.rst:758 msgid "parenthesized irrefutable patterns" msgstr "" -#: ../../reference/compound_stmts.rst:760 +#: ../../reference/compound_stmts.rst:762 msgid "Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:767 +#: ../../reference/compound_stmts.rst:769 msgid "This section uses grammar notations beyond standard EBNF:" msgstr "" -#: ../../reference/compound_stmts.rst:769 +#: ../../reference/compound_stmts.rst:771 msgid "the notation ``SEP.RULE+`` is shorthand for ``RULE (SEP RULE)*``" msgstr "" -#: ../../reference/compound_stmts.rst:771 +#: ../../reference/compound_stmts.rst:773 msgid "the notation ``!RULE`` is shorthand for a negative lookahead assertion" msgstr "" -#: ../../reference/compound_stmts.rst:774 +#: ../../reference/compound_stmts.rst:776 msgid "The top-level syntax for ``patterns`` is:" msgstr "" -#: ../../reference/compound_stmts.rst:788 +#: ../../reference/compound_stmts.rst:790 msgid "" "The descriptions below will include a description \"in simple terms\" of " "what a pattern does for illustration purposes (credits to Raymond Hettinger " @@ -995,70 +988,70 @@ msgid "" "forms." msgstr "" -#: ../../reference/compound_stmts.rst:798 +#: ../../reference/compound_stmts.rst:800 msgid "OR Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:800 +#: ../../reference/compound_stmts.rst:802 msgid "" "An OR pattern is two or more patterns separated by vertical bars ``|``. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:806 +#: ../../reference/compound_stmts.rst:808 msgid "" "Only the final subpattern may be :ref:`irrefutable `, and " "each subpattern must bind the same set of names to avoid ambiguity." msgstr "" -#: ../../reference/compound_stmts.rst:809 +#: ../../reference/compound_stmts.rst:811 msgid "" "An OR pattern matches each of its subpatterns in turn to the subject value, " "until one succeeds. The OR pattern is then considered successful. " "Otherwise, if none of the subpatterns succeed, the OR pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:813 +#: ../../reference/compound_stmts.rst:815 msgid "" "In simple terms, ``P1 | P2 | ...`` will try to match ``P1``, if it fails it " "will try to match ``P2``, succeeding immediately if any succeeds, failing " "otherwise." msgstr "" -#: ../../reference/compound_stmts.rst:819 +#: ../../reference/compound_stmts.rst:821 msgid "AS Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:821 +#: ../../reference/compound_stmts.rst:823 msgid "" "An AS pattern matches an OR pattern on the left of the :keyword:`as` keyword " "against a subject. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:827 +#: ../../reference/compound_stmts.rst:829 msgid "" "If the OR pattern fails, the AS pattern fails. Otherwise, the AS pattern " "binds the subject to the name on the right of the as keyword and succeeds. " "``capture_pattern`` cannot be a ``_``." msgstr "" -#: ../../reference/compound_stmts.rst:831 +#: ../../reference/compound_stmts.rst:833 msgid "" "In simple terms ``P as NAME`` will match with ``P``, and on success it will " "set ``NAME = ``." msgstr "" -#: ../../reference/compound_stmts.rst:838 +#: ../../reference/compound_stmts.rst:840 msgid "Literal Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:840 +#: ../../reference/compound_stmts.rst:842 msgid "" "A literal pattern corresponds to most :ref:`literals ` in Python. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:853 +#: ../../reference/compound_stmts.rst:855 msgid "" "The rule ``strings`` and the token ``NUMBER`` are defined in " "the :doc:`standard Python grammar <./grammar>`. Triple-quoted strings are " @@ -1066,42 +1059,42 @@ msgid "" "and :ref:`t-strings` are not supported." msgstr "" -#: ../../reference/compound_stmts.rst:858 +#: ../../reference/compound_stmts.rst:860 msgid "" "The forms ``signed_number '+' NUMBER`` and ``signed_number '-' NUMBER`` are " "for expressing :ref:`complex numbers `; they require a real " "number on the left and an imaginary number on the right. E.g. ``3 + 4j``." msgstr "" -#: ../../reference/compound_stmts.rst:862 +#: ../../reference/compound_stmts.rst:864 msgid "" "In simple terms, ``LITERAL`` will succeed only if `` == LITERAL``. " "For the singletons ``None``, ``True`` and ``False``, the :keyword:`is` " "operator is used." msgstr "" -#: ../../reference/compound_stmts.rst:868 +#: ../../reference/compound_stmts.rst:870 msgid "Capture Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:870 +#: ../../reference/compound_stmts.rst:872 msgid "A capture pattern binds the subject value to a name. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:876 +#: ../../reference/compound_stmts.rst:878 msgid "" "A single underscore ``_`` is not a capture pattern (this is what ``!'_'`` " "expresses). It is instead treated as a :token:`~python-" "grammar:wildcard_pattern`." msgstr "" -#: ../../reference/compound_stmts.rst:880 +#: ../../reference/compound_stmts.rst:882 msgid "" "In a given pattern, a given name can only be bound once. E.g. ``case x, " "x: ...`` is invalid while ``case [x] | x: ...`` is allowed." msgstr "" -#: ../../reference/compound_stmts.rst:883 +#: ../../reference/compound_stmts.rst:885 msgid "" "Capture patterns always succeed. The binding follows scoping rules " "established by the assignment expression operator in :pep:`572`; the name " @@ -1109,55 +1102,55 @@ msgid "" "there's an applicable :keyword:`global` or :keyword:`nonlocal` statement." msgstr "" -#: ../../reference/compound_stmts.rst:888 +#: ../../reference/compound_stmts.rst:890 msgid "" "In simple terms ``NAME`` will always succeed and it will set ``NAME = " "``." msgstr "" -#: ../../reference/compound_stmts.rst:893 +#: ../../reference/compound_stmts.rst:895 msgid "Wildcard Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:895 +#: ../../reference/compound_stmts.rst:897 msgid "" "A wildcard pattern always succeeds (matches anything) and binds no name. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:901 +#: ../../reference/compound_stmts.rst:903 msgid "" "``_`` is a :ref:`soft keyword ` within any pattern, but only " "within patterns. It is an identifier, as usual, even within ``match`` " "subject expressions, ``guard``\\ s, and ``case`` blocks." msgstr "" -#: ../../reference/compound_stmts.rst:905 +#: ../../reference/compound_stmts.rst:907 msgid "In simple terms, ``_`` will always succeed." msgstr "" -#: ../../reference/compound_stmts.rst:910 +#: ../../reference/compound_stmts.rst:912 msgid "Value Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:912 +#: ../../reference/compound_stmts.rst:914 msgid "A value pattern represents a named value in Python. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:920 +#: ../../reference/compound_stmts.rst:922 msgid "" "The dotted name in the pattern is looked up using standard Python :ref:`name " "resolution rules `. The pattern succeeds if the value found " "compares equal to the subject value (using the ``==`` equality operator)." msgstr "" -#: ../../reference/compound_stmts.rst:925 +#: ../../reference/compound_stmts.rst:927 msgid "" "In simple terms ``NAME1.NAME2`` will succeed only if `` == " "NAME1.NAME2``" msgstr "" -#: ../../reference/compound_stmts.rst:929 +#: ../../reference/compound_stmts.rst:931 msgid "" "If the same value occurs multiple times in the same match statement, the " "interpreter may cache the first value found and reuse it rather than repeat " @@ -1165,44 +1158,44 @@ msgid "" "given match statement." msgstr "" -#: ../../reference/compound_stmts.rst:937 +#: ../../reference/compound_stmts.rst:939 msgid "Group Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:939 +#: ../../reference/compound_stmts.rst:941 msgid "" "A group pattern allows users to add parentheses around patterns to emphasize " "the intended grouping. Otherwise, it has no additional syntax. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:946 +#: ../../reference/compound_stmts.rst:948 msgid "In simple terms ``(P)`` has the same effect as ``P``." msgstr "" -#: ../../reference/compound_stmts.rst:951 +#: ../../reference/compound_stmts.rst:953 msgid "Sequence Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:953 +#: ../../reference/compound_stmts.rst:955 msgid "" "A sequence pattern contains several subpatterns to be matched against " "sequence elements. The syntax is similar to the unpacking of a list or tuple." msgstr "" -#: ../../reference/compound_stmts.rst:964 +#: ../../reference/compound_stmts.rst:966 msgid "" "There is no difference if parentheses or square brackets are used for " "sequence patterns (i.e. ``(...)`` vs ``[...]`` )." msgstr "" -#: ../../reference/compound_stmts.rst:968 +#: ../../reference/compound_stmts.rst:970 msgid "" "A single pattern enclosed in parentheses without a trailing comma (e.g. ``(3 " "| 4)``) is a :ref:`group pattern `. While a single pattern " "enclosed in square brackets (e.g. ``[3 | 4]``) is still a sequence pattern." msgstr "" -#: ../../reference/compound_stmts.rst:973 +#: ../../reference/compound_stmts.rst:975 msgid "" "At most one star subpattern may be in a sequence pattern. The star " "subpattern may occur in any position. If no star subpattern is present, the " @@ -1210,40 +1203,40 @@ msgid "" "variable-length sequence pattern." msgstr "" -#: ../../reference/compound_stmts.rst:978 +#: ../../reference/compound_stmts.rst:980 msgid "" "The following is the logical flow for matching a sequence pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:981 +#: ../../reference/compound_stmts.rst:983 msgid "" "If the subject value is not a sequence [#]_, the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:984 +#: ../../reference/compound_stmts.rst:986 msgid "" "If the subject value is an instance of ``str``, ``bytes`` or ``bytearray`` " "the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:987 +#: ../../reference/compound_stmts.rst:989 msgid "" "The subsequent steps depend on whether the sequence pattern is fixed or " "variable-length." msgstr "" -#: ../../reference/compound_stmts.rst:990 +#: ../../reference/compound_stmts.rst:992 msgid "If the sequence pattern is fixed-length:" msgstr "" -#: ../../reference/compound_stmts.rst:992 +#: ../../reference/compound_stmts.rst:994 msgid "" "If the length of the subject sequence is not equal to the number of " "subpatterns, the sequence pattern fails" msgstr "" -#: ../../reference/compound_stmts.rst:995 +#: ../../reference/compound_stmts.rst:997 msgid "" "Subpatterns in the sequence pattern are matched to their corresponding items " "in the subject sequence from left to right. Matching stops as soon as a " @@ -1251,375 +1244,375 @@ msgid "" "corresponding item, the sequence pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1000 +#: ../../reference/compound_stmts.rst:1002 msgid "Otherwise, if the sequence pattern is variable-length:" msgstr "" -#: ../../reference/compound_stmts.rst:1002 +#: ../../reference/compound_stmts.rst:1004 msgid "" "If the length of the subject sequence is less than the number of non-star " "subpatterns, the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:1005 +#: ../../reference/compound_stmts.rst:1007 msgid "" "The leading non-star subpatterns are matched to their corresponding items as " "for fixed-length sequences." msgstr "" -#: ../../reference/compound_stmts.rst:1008 +#: ../../reference/compound_stmts.rst:1010 msgid "" "If the previous step succeeds, the star subpattern matches a list formed of " "the remaining subject items, excluding the remaining items corresponding to " "non-star subpatterns following the star subpattern." msgstr "" -#: ../../reference/compound_stmts.rst:1012 +#: ../../reference/compound_stmts.rst:1014 msgid "" "Remaining non-star subpatterns are matched to their corresponding subject " "items, as for a fixed-length sequence." msgstr "" -#: ../../reference/compound_stmts.rst:1015 +#: ../../reference/compound_stmts.rst:1017 msgid "" "The length of the subject sequence is obtained via :func:`len` (i.e. via " -"the :meth:`__len__` protocol). This length may be cached by the interpreter " -"in a similar manner as :ref:`value patterns `." +"the :meth:`~object.__len__` protocol). This length may be cached by the " +"interpreter in a similar manner as :ref:`value patterns `." msgstr "" -#: ../../reference/compound_stmts.rst:1021 +#: ../../reference/compound_stmts.rst:1023 msgid "" "In simple terms ``[P1, P2, P3,`` ... ``, P]`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1024 +#: ../../reference/compound_stmts.rst:1026 msgid "check ```` is a sequence" msgstr "" -#: ../../reference/compound_stmts.rst:1025 +#: ../../reference/compound_stmts.rst:1027 msgid "``len(subject) == ``" msgstr "``len(subject) == ``" -#: ../../reference/compound_stmts.rst:1026 +#: ../../reference/compound_stmts.rst:1028 msgid "" "``P1`` matches ``[0]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:1027 +#: ../../reference/compound_stmts.rst:1029 msgid "" "``P2`` matches ``[1]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:1028 +#: ../../reference/compound_stmts.rst:1030 msgid "... and so on for the corresponding pattern/element." msgstr "" -#: ../../reference/compound_stmts.rst:1033 +#: ../../reference/compound_stmts.rst:1035 msgid "Mapping Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:1035 +#: ../../reference/compound_stmts.rst:1037 msgid "" "A mapping pattern contains one or more key-value patterns. The syntax is " "similar to the construction of a dictionary. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:1046 +#: ../../reference/compound_stmts.rst:1048 msgid "" "At most one double star pattern may be in a mapping pattern. The double " "star pattern must be the last subpattern in the mapping pattern." msgstr "" -#: ../../reference/compound_stmts.rst:1049 +#: ../../reference/compound_stmts.rst:1051 msgid "" "Duplicate keys in mapping patterns are disallowed. Duplicate literal keys " "will raise a :exc:`SyntaxError`. Two keys that otherwise have the same value " "will raise a :exc:`ValueError` at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1053 +#: ../../reference/compound_stmts.rst:1055 msgid "" "The following is the logical flow for matching a mapping pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:1056 +#: ../../reference/compound_stmts.rst:1058 msgid "If the subject value is not a mapping [#]_,the mapping pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:1058 +#: ../../reference/compound_stmts.rst:1060 msgid "" "If every key given in the mapping pattern is present in the subject mapping, " "and the pattern for each key matches the corresponding item of the subject " "mapping, the mapping pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1062 +#: ../../reference/compound_stmts.rst:1064 msgid "" "If duplicate keys are detected in the mapping pattern, the pattern is " "considered invalid. A :exc:`SyntaxError` is raised for duplicate literal " "values; or a :exc:`ValueError` for named keys of the same value." msgstr "" -#: ../../reference/compound_stmts.rst:1066 +#: ../../reference/compound_stmts.rst:1068 msgid "" "Key-value pairs are matched using the two-argument form of the mapping " "subject's ``get()`` method. Matched key-value pairs must already be present " -"in the mapping, and not created on-the-fly via :meth:`__missing__` " +"in the mapping, and not created on-the-fly via :meth:`~object.__missing__` " "or :meth:`~object.__getitem__`." msgstr "" -#: ../../reference/compound_stmts.rst:1071 +#: ../../reference/compound_stmts.rst:1073 msgid "" "In simple terms ``{KEY1: P1, KEY2: P2, ... }`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1074 +#: ../../reference/compound_stmts.rst:1076 msgid "check ```` is a mapping" msgstr "" -#: ../../reference/compound_stmts.rst:1075 +#: ../../reference/compound_stmts.rst:1077 msgid "``KEY1 in ``" msgstr "``KEY1 in ``" -#: ../../reference/compound_stmts.rst:1076 +#: ../../reference/compound_stmts.rst:1078 msgid "``P1`` matches ``[KEY1]``" msgstr "" -#: ../../reference/compound_stmts.rst:1077 +#: ../../reference/compound_stmts.rst:1079 msgid "... and so on for the corresponding KEY/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:1083 +#: ../../reference/compound_stmts.rst:1085 msgid "Class Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:1085 +#: ../../reference/compound_stmts.rst:1087 msgid "" "A class pattern represents a class and its positional and keyword arguments " "(if any). Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:1096 +#: ../../reference/compound_stmts.rst:1098 msgid "The same keyword should not be repeated in class patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1098 +#: ../../reference/compound_stmts.rst:1100 msgid "" "The following is the logical flow for matching a class pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:1101 +#: ../../reference/compound_stmts.rst:1103 msgid "" "If ``name_or_attr`` is not an instance of the builtin :class:`type` , " "raise :exc:`TypeError`." msgstr "" -#: ../../reference/compound_stmts.rst:1104 +#: ../../reference/compound_stmts.rst:1106 msgid "" "If the subject value is not an instance of ``name_or_attr`` (tested " "via :func:`isinstance`), the class pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:1107 +#: ../../reference/compound_stmts.rst:1109 msgid "" "If no pattern arguments are present, the pattern succeeds. Otherwise, the " "subsequent steps depend on whether keyword or positional argument patterns " "are present." msgstr "" -#: ../../reference/compound_stmts.rst:1111 +#: ../../reference/compound_stmts.rst:1113 msgid "" "For a number of built-in types (specified below), a single positional " "subpattern is accepted which will match the entire subject; for these types " "keyword patterns also work as for other types." msgstr "" -#: ../../reference/compound_stmts.rst:1115 +#: ../../reference/compound_stmts.rst:1117 msgid "" "If only keyword patterns are present, they are processed as follows, one by " "one:" msgstr "" -#: ../../reference/compound_stmts.rst:1118 +#: ../../reference/compound_stmts.rst:1120 msgid "I. The keyword is looked up as an attribute on the subject." msgstr "" -#: ../../reference/compound_stmts.rst:1120 +#: ../../reference/compound_stmts.rst:1122 msgid "" "If this raises an exception other than :exc:`AttributeError`, the exception " "bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1123 +#: ../../reference/compound_stmts.rst:1125 msgid "If this raises :exc:`AttributeError`, the class pattern has failed." msgstr "" -#: ../../reference/compound_stmts.rst:1125 +#: ../../reference/compound_stmts.rst:1127 msgid "" "Else, the subpattern associated with the keyword pattern is matched against " "the subject's attribute value. If this fails, the class pattern fails; if " "this succeeds, the match proceeds to the next keyword." msgstr "" -#: ../../reference/compound_stmts.rst:1130 +#: ../../reference/compound_stmts.rst:1132 msgid "II. If all keyword patterns succeed, the class pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1132 +#: ../../reference/compound_stmts.rst:1134 msgid "" "If any positional patterns are present, they are converted to keyword " "patterns using the :data:`~object.__match_args__` attribute on the class " "``name_or_attr`` before matching:" msgstr "" -#: ../../reference/compound_stmts.rst:1136 +#: ../../reference/compound_stmts.rst:1138 msgid "" "I. The equivalent of ``getattr(cls, \"__match_args__\", ())`` is called." msgstr "" -#: ../../reference/compound_stmts.rst:1138 +#: ../../reference/compound_stmts.rst:1140 msgid "If this raises an exception, the exception bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1140 +#: ../../reference/compound_stmts.rst:1142 msgid "" "If the returned value is not a tuple, the conversion fails " "and :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1143 +#: ../../reference/compound_stmts.rst:1145 msgid "" "If there are more positional patterns than " "``len(cls.__match_args__)``, :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1146 +#: ../../reference/compound_stmts.rst:1148 msgid "" "Otherwise, positional pattern ``i`` is converted to a keyword pattern using " "``__match_args__[i]`` as the keyword. ``__match_args__[i]`` must be a " "string; if not :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1150 +#: ../../reference/compound_stmts.rst:1152 msgid "If there are duplicate keywords, :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1152 +#: ../../reference/compound_stmts.rst:1154 msgid ":ref:`class-pattern-matching`" msgstr ":ref:`class-pattern-matching`" -#: ../../reference/compound_stmts.rst:1154 +#: ../../reference/compound_stmts.rst:1156 msgid "" "II. Once all positional patterns have been converted to keyword patterns," msgstr "" -#: ../../reference/compound_stmts.rst:1155 +#: ../../reference/compound_stmts.rst:1157 msgid "the match proceeds as if there were only keyword patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1157 +#: ../../reference/compound_stmts.rst:1159 msgid "" "For the following built-in types the handling of positional subpatterns is " "different:" msgstr "" -#: ../../reference/compound_stmts.rst:1160 +#: ../../reference/compound_stmts.rst:1162 msgid ":class:`bool`" msgstr ":class:`bool`" -#: ../../reference/compound_stmts.rst:1161 +#: ../../reference/compound_stmts.rst:1163 msgid ":class:`bytearray`" msgstr ":class:`bytearray`" -#: ../../reference/compound_stmts.rst:1162 +#: ../../reference/compound_stmts.rst:1164 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../reference/compound_stmts.rst:1163 +#: ../../reference/compound_stmts.rst:1165 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../reference/compound_stmts.rst:1164 +#: ../../reference/compound_stmts.rst:1166 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../reference/compound_stmts.rst:1165 +#: ../../reference/compound_stmts.rst:1167 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../reference/compound_stmts.rst:1166 +#: ../../reference/compound_stmts.rst:1168 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../reference/compound_stmts.rst:1167 -#: ../../reference/compound_stmts.rst:1925 +#: ../../reference/compound_stmts.rst:1169 +#: ../../reference/compound_stmts.rst:1927 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../reference/compound_stmts.rst:1168 +#: ../../reference/compound_stmts.rst:1170 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../reference/compound_stmts.rst:1169 +#: ../../reference/compound_stmts.rst:1171 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../reference/compound_stmts.rst:1170 -#: ../../reference/compound_stmts.rst:1928 +#: ../../reference/compound_stmts.rst:1172 +#: ../../reference/compound_stmts.rst:1930 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../reference/compound_stmts.rst:1172 +#: ../../reference/compound_stmts.rst:1174 msgid "" "These classes accept a single positional argument, and the pattern there is " "matched against the whole object rather than an attribute. For example " "``int(0|1)`` matches the value ``0``, but not the value ``0.0``." msgstr "" -#: ../../reference/compound_stmts.rst:1176 +#: ../../reference/compound_stmts.rst:1178 msgid "" "In simple terms ``CLS(P1, attr=P2)`` matches only if the following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1178 +#: ../../reference/compound_stmts.rst:1180 msgid "``isinstance(, CLS)``" msgstr "``isinstance(, CLS)``" -#: ../../reference/compound_stmts.rst:1179 +#: ../../reference/compound_stmts.rst:1181 msgid "convert ``P1`` to a keyword pattern using ``CLS.__match_args__``" msgstr "" -#: ../../reference/compound_stmts.rst:1180 +#: ../../reference/compound_stmts.rst:1182 msgid "For each keyword argument ``attr=P2``:" msgstr "" -#: ../../reference/compound_stmts.rst:1182 +#: ../../reference/compound_stmts.rst:1184 msgid "``hasattr(, \"attr\")``" msgstr "``hasattr(, \"attr\")``" -#: ../../reference/compound_stmts.rst:1183 +#: ../../reference/compound_stmts.rst:1185 msgid "``P2`` matches ``.attr``" msgstr "" -#: ../../reference/compound_stmts.rst:1185 +#: ../../reference/compound_stmts.rst:1187 msgid "... and so on for the corresponding keyword argument/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:1200 +#: ../../reference/compound_stmts.rst:1202 msgid "Function definitions" msgstr "函式定義" -#: ../../reference/compound_stmts.rst:1215 +#: ../../reference/compound_stmts.rst:1217 msgid "" "A function definition defines a user-defined function object (see " "section :ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1237 +#: ../../reference/compound_stmts.rst:1239 msgid "" "A function definition is an executable statement. Its execution binds the " "function name in the current local namespace to a function object (a wrapper " @@ -1628,13 +1621,13 @@ msgid "" "used when the function is called." msgstr "" -#: ../../reference/compound_stmts.rst:1243 +#: ../../reference/compound_stmts.rst:1245 msgid "" "The function definition does not execute the function body; this gets " "executed only when the function is called. [#]_" msgstr "" -#: ../../reference/compound_stmts.rst:1249 +#: ../../reference/compound_stmts.rst:1251 msgid "" "A function definition may be wrapped by one or more :term:`decorator` " "expressions. Decorator expressions are evaluated when the function is " @@ -1645,7 +1638,7 @@ msgid "" "example, the following code ::" msgstr "" -#: ../../reference/compound_stmts.rst:1256 +#: ../../reference/compound_stmts.rst:1258 msgid "" "@f1(arg)\n" "@f2\n" @@ -1655,12 +1648,12 @@ msgstr "" "@f2\n" "def func(): pass" -#: ../../reference/compound_stmts.rst:1260 -#: ../../reference/compound_stmts.rst:1449 +#: ../../reference/compound_stmts.rst:1262 +#: ../../reference/compound_stmts.rst:1451 msgid "is roughly equivalent to ::" msgstr "大致等價於: ::" -#: ../../reference/compound_stmts.rst:1262 +#: ../../reference/compound_stmts.rst:1264 msgid "" "def func(): pass\n" "func = f1(arg)(f2(func))" @@ -1668,20 +1661,20 @@ msgstr "" "def func(): pass\n" "func = f1(arg)(f2(func))" -#: ../../reference/compound_stmts.rst:1265 +#: ../../reference/compound_stmts.rst:1267 msgid "" "except that the original function is not temporarily bound to the name " "``func``." msgstr "" -#: ../../reference/compound_stmts.rst:1267 +#: ../../reference/compound_stmts.rst:1269 msgid "" "Functions may be decorated with any valid :token:`~python-" "grammar:assignment_expression`. Previously, the grammar was much more " "restrictive; see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1274 msgid "" "A list of :ref:`type parameters ` may be given in square " "brackets between the function's name and the opening parenthesis for its " @@ -1691,12 +1684,12 @@ msgid "" "functions` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1279 -#: ../../reference/compound_stmts.rst:1468 +#: ../../reference/compound_stmts.rst:1281 +#: ../../reference/compound_stmts.rst:1470 msgid "Type parameter lists are new in Python 3.12." msgstr "" -#: ../../reference/compound_stmts.rst:1287 +#: ../../reference/compound_stmts.rst:1289 msgid "" "When one or more :term:`parameters ` have the form *parameter* " "``=`` *expression*, the function is said to have \"default parameter values." @@ -1707,7 +1700,7 @@ msgid "" "syntactic restriction that is not expressed by the grammar." msgstr "" -#: ../../reference/compound_stmts.rst:1295 +#: ../../reference/compound_stmts.rst:1297 msgid "" "**Default parameter values are evaluated from left to right when the " "function definition is executed.** This means that the expression is " @@ -1720,7 +1713,7 @@ msgid "" "the default, and explicitly test for it in the body of the function, e.g.::" msgstr "" -#: ../../reference/compound_stmts.rst:1305 +#: ../../reference/compound_stmts.rst:1307 msgid "" "def whats_on_the_telly(penguin=None):\n" " if penguin is None:\n" @@ -1729,7 +1722,7 @@ msgid "" " return penguin" msgstr "" -#: ../../reference/compound_stmts.rst:1316 +#: ../../reference/compound_stmts.rst:1318 msgid "" "Function call semantics are described in more detail in " "section :ref:`calls`. A function call always assigns values to all " @@ -1745,13 +1738,13 @@ msgid "" "passed by positional arguments." msgstr "" -#: ../../reference/compound_stmts.rst:1328 +#: ../../reference/compound_stmts.rst:1330 msgid "" "The ``/`` function parameter syntax may be used to indicate positional-only " "parameters. See :pep:`570` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1337 +#: ../../reference/compound_stmts.rst:1339 msgid "" "Parameters may have an :term:`annotation ` of the form " "\"``: expression``\" following the parameter name. Any parameter may have " @@ -1764,13 +1757,13 @@ msgid "" "information on annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1345 +#: ../../reference/compound_stmts.rst:1347 msgid "" "Parameters of the form \"``*identifier``\" may have an annotation \"``: " "*expression``\". See :pep:`646`." msgstr "" -#: ../../reference/compound_stmts.rst:1351 +#: ../../reference/compound_stmts.rst:1353 msgid "" "It is also possible to create anonymous functions (functions not bound to a " "name), for immediate use in expressions. This uses lambda expressions, " @@ -1782,7 +1775,7 @@ msgid "" "execution of multiple statements and annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1359 +#: ../../reference/compound_stmts.rst:1361 msgid "" "**Programmer's note:** Functions are first-class objects. A \"``def``\" " "statement executed inside a function definition defines a local function " @@ -1791,61 +1784,61 @@ msgid "" "See section :ref:`naming` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1367 +#: ../../reference/compound_stmts.rst:1369 msgid ":pep:`3107` - Function Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1368 +#: ../../reference/compound_stmts.rst:1370 msgid "The original specification for function annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1370 +#: ../../reference/compound_stmts.rst:1372 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../reference/compound_stmts.rst:1371 +#: ../../reference/compound_stmts.rst:1373 msgid "Definition of a standard meaning for annotations: type hints." msgstr "定義註釋的標準意義:型別提示。" -#: ../../reference/compound_stmts.rst:1373 +#: ../../reference/compound_stmts.rst:1375 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr ":pep:`526` - 變數註釋的語法" -#: ../../reference/compound_stmts.rst:1374 +#: ../../reference/compound_stmts.rst:1376 msgid "" "Ability to type hint variable declarations, including class variables and " "instance variables." msgstr "" -#: ../../reference/compound_stmts.rst:1377 +#: ../../reference/compound_stmts.rst:1379 msgid ":pep:`563` - Postponed Evaluation of Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1378 +#: ../../reference/compound_stmts.rst:1380 msgid "" "Support for forward references within annotations by preserving annotations " "in a string form at runtime instead of eager evaluation." msgstr "" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1383 msgid ":pep:`318` - Decorators for Functions and Methods" msgstr "" -#: ../../reference/compound_stmts.rst:1382 +#: ../../reference/compound_stmts.rst:1384 msgid "" "Function and method decorators were introduced. Class decorators were " "introduced in :pep:`3129`." msgstr "" -#: ../../reference/compound_stmts.rst:1388 +#: ../../reference/compound_stmts.rst:1390 msgid "Class definitions" msgstr "類別定義" -#: ../../reference/compound_stmts.rst:1403 +#: ../../reference/compound_stmts.rst:1405 msgid "A class definition defines a class object (see section :ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1410 +#: ../../reference/compound_stmts.rst:1412 msgid "" "A class definition is an executable statement. The inheritance list usually " "gives a list of base classes (see :ref:`metaclasses` for more advanced " @@ -1854,7 +1847,7 @@ msgid "" "default, from the base class :class:`object`; hence, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1416 +#: ../../reference/compound_stmts.rst:1418 msgid "" "class Foo:\n" " pass" @@ -1862,11 +1855,11 @@ msgstr "" "class Foo:\n" " pass" -#: ../../reference/compound_stmts.rst:1419 +#: ../../reference/compound_stmts.rst:1421 msgid "is equivalent to ::" msgstr "" -#: ../../reference/compound_stmts.rst:1421 +#: ../../reference/compound_stmts.rst:1423 msgid "" "class Foo(object):\n" " pass" @@ -1874,7 +1867,7 @@ msgstr "" "class Foo(object):\n" " pass" -#: ../../reference/compound_stmts.rst:1424 +#: ../../reference/compound_stmts.rst:1426 msgid "" "The class's suite is then executed in a new execution frame " "(see :ref:`naming`), using a newly created local namespace and the original " @@ -1886,7 +1879,7 @@ msgid "" "this class object in the original local namespace." msgstr "" -#: ../../reference/compound_stmts.rst:1433 +#: ../../reference/compound_stmts.rst:1435 msgid "" "The order in which attributes are defined in the class body is preserved in " "the new class's :attr:`~type.__dict__`. Note that this is reliable only " @@ -1894,17 +1887,17 @@ msgid "" "using the definition syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1438 +#: ../../reference/compound_stmts.rst:1440 msgid "" "Class creation can be customized heavily using :ref:`metaclasses " "`." msgstr "" -#: ../../reference/compound_stmts.rst:1443 +#: ../../reference/compound_stmts.rst:1445 msgid "Classes can also be decorated: just like when decorating functions, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1445 +#: ../../reference/compound_stmts.rst:1447 msgid "" "@f1(arg)\n" "@f2\n" @@ -1914,7 +1907,7 @@ msgstr "" "@f2\n" "class Foo: pass" -#: ../../reference/compound_stmts.rst:1451 +#: ../../reference/compound_stmts.rst:1453 msgid "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" @@ -1922,20 +1915,20 @@ msgstr "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" -#: ../../reference/compound_stmts.rst:1454 +#: ../../reference/compound_stmts.rst:1456 msgid "" "The evaluation rules for the decorator expressions are the same as for " "function decorators. The result is then bound to the class name." msgstr "" -#: ../../reference/compound_stmts.rst:1457 +#: ../../reference/compound_stmts.rst:1459 msgid "" "Classes may be decorated with any valid :token:`~python-" "grammar:assignment_expression`. Previously, the grammar was much more " "restrictive; see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1462 +#: ../../reference/compound_stmts.rst:1464 msgid "" "A list of :ref:`type parameters ` may be given in square " "brackets immediately after the class's name. This indicates to static type " @@ -1944,7 +1937,7 @@ msgid "" "See :ref:`generic-classes` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1471 +#: ../../reference/compound_stmts.rst:1473 msgid "" "**Programmer's note:** Variables defined in the class definition are class " "attributes; they are shared by instances. Instance attributes can be set in " @@ -1957,35 +1950,35 @@ msgid "" "implementation details." msgstr "" -#: ../../reference/compound_stmts.rst:1483 +#: ../../reference/compound_stmts.rst:1485 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/compound_stmts.rst:1484 +#: ../../reference/compound_stmts.rst:1486 msgid "" "The proposal that changed the declaration of metaclasses to the current " "syntax, and the semantics for how classes with metaclasses are constructed." msgstr "" -#: ../../reference/compound_stmts.rst:1488 +#: ../../reference/compound_stmts.rst:1490 msgid ":pep:`3129` - Class Decorators" msgstr ":pep:`3129` - 類別裝飾器" -#: ../../reference/compound_stmts.rst:1489 +#: ../../reference/compound_stmts.rst:1491 msgid "" "The proposal that added class decorators. Function and method decorators " "were introduced in :pep:`318`." msgstr "" -#: ../../reference/compound_stmts.rst:1496 +#: ../../reference/compound_stmts.rst:1498 msgid "Coroutines" msgstr "協程" -#: ../../reference/compound_stmts.rst:1504 +#: ../../reference/compound_stmts.rst:1506 msgid "Coroutine function definition" msgstr "協程函式定義" -#: ../../reference/compound_stmts.rst:1514 +#: ../../reference/compound_stmts.rst:1516 msgid "" "Execution of Python coroutines can be suspended and resumed at many points " "(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` " @@ -1993,23 +1986,23 @@ msgid "" "function." msgstr "" -#: ../../reference/compound_stmts.rst:1518 +#: ../../reference/compound_stmts.rst:1520 msgid "" "Functions defined with ``async def`` syntax are always coroutine functions, " "even if they do not contain ``await`` or ``async`` keywords." msgstr "" -#: ../../reference/compound_stmts.rst:1521 +#: ../../reference/compound_stmts.rst:1523 msgid "" "It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1524 +#: ../../reference/compound_stmts.rst:1526 msgid "An example of a coroutine function::" msgstr "一個協程函式範例: ::" -#: ../../reference/compound_stmts.rst:1526 +#: ../../reference/compound_stmts.rst:1528 msgid "" "async def func(param1, param2):\n" " do_stuff()\n" @@ -2019,30 +2012,30 @@ msgstr "" " do_stuff()\n" " await some_coroutine()" -#: ../../reference/compound_stmts.rst:1530 +#: ../../reference/compound_stmts.rst:1532 msgid "" "``await`` and ``async`` are now keywords; previously they were only treated " "as such inside the body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1538 +#: ../../reference/compound_stmts.rst:1540 msgid "The :keyword:`!async for` statement" msgstr ":keyword:`!async for` 陳述式" -#: ../../reference/compound_stmts.rst:1543 +#: ../../reference/compound_stmts.rst:1545 msgid "" "An :term:`asynchronous iterable` provides an ``__aiter__`` method that " "directly returns an :term:`asynchronous iterator`, which can call " "asynchronous code in its ``__anext__`` method." msgstr "" -#: ../../reference/compound_stmts.rst:1547 +#: ../../reference/compound_stmts.rst:1549 msgid "" "The ``async for`` statement allows convenient iteration over asynchronous " "iterables." msgstr "" -#: ../../reference/compound_stmts.rst:1552 +#: ../../reference/compound_stmts.rst:1554 msgid "" "async for TARGET in ITER:\n" " SUITE\n" @@ -2054,11 +2047,11 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1557 +#: ../../reference/compound_stmts.rst:1559 msgid "Is semantically equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1559 +#: ../../reference/compound_stmts.rst:1561 msgid "" "iter = (ITER)\n" "iter = type(iter).__aiter__(iter)\n" @@ -2088,28 +2081,28 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1573 +#: ../../reference/compound_stmts.rst:1575 msgid "" "See also :meth:`~object.__aiter__` and :meth:`~object.__anext__` for details." msgstr "更多細節請見 :meth:`~object.__aiter__` 與 :meth:`~object.__anext__`。" -#: ../../reference/compound_stmts.rst:1575 +#: ../../reference/compound_stmts.rst:1577 msgid "" "It is a :exc:`SyntaxError` to use an ``async for`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1583 +#: ../../reference/compound_stmts.rst:1585 msgid "The :keyword:`!async with` statement" msgstr ":keyword:`!async with` 陳述式" -#: ../../reference/compound_stmts.rst:1588 +#: ../../reference/compound_stmts.rst:1590 msgid "" "An :term:`asynchronous context manager` is a :term:`context manager` that is " "able to suspend execution in its *enter* and *exit* methods." msgstr "" -#: ../../reference/compound_stmts.rst:1593 +#: ../../reference/compound_stmts.rst:1595 msgid "" "async with EXPRESSION as TARGET:\n" " SUITE" @@ -2117,7 +2110,7 @@ msgstr "" "async with EXPRESSION as TARGET:\n" " SUITE" -#: ../../reference/compound_stmts.rst:1598 +#: ../../reference/compound_stmts.rst:1600 msgid "" "manager = (EXPRESSION)\n" "aenter = type(manager).__aenter__\n" @@ -2153,44 +2146,44 @@ msgstr "" " if not hit_except:\n" " await aexit(manager, None, None, None)" -#: ../../reference/compound_stmts.rst:1615 +#: ../../reference/compound_stmts.rst:1617 msgid "" "See also :meth:`~object.__aenter__` and :meth:`~object.__aexit__` for " "details." msgstr "更多細節請見 :meth:`~object.__aenter__` 與 :meth:`~object.__aexit__`。" -#: ../../reference/compound_stmts.rst:1617 +#: ../../reference/compound_stmts.rst:1619 msgid "" "It is a :exc:`SyntaxError` to use an ``async with`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1622 +#: ../../reference/compound_stmts.rst:1624 msgid ":pep:`492` - Coroutines with async and await syntax" msgstr "" -#: ../../reference/compound_stmts.rst:1623 +#: ../../reference/compound_stmts.rst:1625 msgid "" "The proposal that made coroutines a proper standalone concept in Python, and " "added supporting syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1629 +#: ../../reference/compound_stmts.rst:1631 msgid "Type parameter lists" msgstr "" -#: ../../reference/compound_stmts.rst:1633 +#: ../../reference/compound_stmts.rst:1635 msgid "Support for default values was added (see :pep:`696`)." msgstr "" -#: ../../reference/compound_stmts.rst:1646 +#: ../../reference/compound_stmts.rst:1648 msgid "" ":ref:`Functions ` (including :ref:`coroutines `), :ref:`classes ` and :ref:`type aliases ` may contain a " "type parameter list::" msgstr "" -#: ../../reference/compound_stmts.rst:1650 +#: ../../reference/compound_stmts.rst:1652 msgid "" "def max[T](args: list[T]) -> T:\n" " ...\n" @@ -2222,7 +2215,7 @@ msgstr "" "\n" "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1665 +#: ../../reference/compound_stmts.rst:1667 msgid "" "Semantically, this indicates that the function, class, or type alias is " "generic over a type variable. This information is primarily used by static " @@ -2230,7 +2223,7 @@ msgid "" "generic counterparts." msgstr "" -#: ../../reference/compound_stmts.rst:1670 +#: ../../reference/compound_stmts.rst:1672 msgid "" "Type parameters are declared in square brackets (``[]``) immediately after " "the name of the function, class, or type alias. The type parameters are " @@ -2242,37 +2235,37 @@ msgid "" "wraps the creation of the generic object." msgstr "" -#: ../../reference/compound_stmts.rst:1679 +#: ../../reference/compound_stmts.rst:1681 msgid "" "Generic functions, classes, and type aliases have " "a :attr:`~definition.__type_params__` attribute listing their type " "parameters." msgstr "" -#: ../../reference/compound_stmts.rst:1682 +#: ../../reference/compound_stmts.rst:1684 msgid "Type parameters come in three kinds:" msgstr "" -#: ../../reference/compound_stmts.rst:1684 +#: ../../reference/compound_stmts.rst:1686 msgid "" ":data:`typing.TypeVar`, introduced by a plain name (e.g., ``T``). " "Semantically, this represents a single type to a type checker." msgstr "" -#: ../../reference/compound_stmts.rst:1686 +#: ../../reference/compound_stmts.rst:1688 msgid "" ":data:`typing.TypeVarTuple`, introduced by a name prefixed with a single " "asterisk (e.g., ``*Ts``). Semantically, this stands for a tuple of any " "number of types." msgstr "" -#: ../../reference/compound_stmts.rst:1689 +#: ../../reference/compound_stmts.rst:1691 msgid "" ":data:`typing.ParamSpec`, introduced by a name prefixed with two asterisks " "(e.g., ``**P``). Semantically, this stands for the parameters of a callable." msgstr "" -#: ../../reference/compound_stmts.rst:1692 +#: ../../reference/compound_stmts.rst:1694 msgid "" ":data:`typing.TypeVar` declarations can define *bounds* and *constraints* " "with a colon (``:``) followed by an expression. A single expression after " @@ -2284,7 +2277,7 @@ msgid "" "variables can only take on one of the types in the list of constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1701 +#: ../../reference/compound_stmts.rst:1703 msgid "" "For :data:`!typing.TypeVar`\\ s declared using the type parameter list " "syntax, the bound and constraints are not evaluated when the generic object " @@ -2294,13 +2287,13 @@ msgid "" "`." msgstr "" -#: ../../reference/compound_stmts.rst:1707 +#: ../../reference/compound_stmts.rst:1709 msgid "" ":data:`typing.TypeVarTuple`\\ s and :data:`typing.ParamSpec`\\ s cannot have " "bounds or constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1710 +#: ../../reference/compound_stmts.rst:1712 msgid "" "All three flavors of type parameters can also have a *default value*, which " "is used when the type parameter is not explicitly provided. This is added by " @@ -2313,13 +2306,13 @@ msgid "" "attribute is set to the special sentinel object :data:`typing.NoDefault`." msgstr "" -#: ../../reference/compound_stmts.rst:1720 +#: ../../reference/compound_stmts.rst:1722 msgid "" "The following example indicates the full set of allowed type parameter " "declarations::" msgstr "" -#: ../../reference/compound_stmts.rst:1722 +#: ../../reference/compound_stmts.rst:1724 msgid "" "def overly_generic[\n" " SimpleTypeVar,\n" @@ -2351,24 +2344,24 @@ msgstr "" " *e: SimpleTypeVarTuple,\n" "): ..." -#: ../../reference/compound_stmts.rst:1740 +#: ../../reference/compound_stmts.rst:1742 msgid "Generic functions" msgstr "" -#: ../../reference/compound_stmts.rst:1742 +#: ../../reference/compound_stmts.rst:1744 msgid "Generic functions are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1744 +#: ../../reference/compound_stmts.rst:1746 msgid "def func[T](arg: T): ..." msgstr "def func[T](arg: T): ..." -#: ../../reference/compound_stmts.rst:1746 -#: ../../reference/compound_stmts.rst:1806 +#: ../../reference/compound_stmts.rst:1748 +#: ../../reference/compound_stmts.rst:1808 msgid "This syntax is equivalent to::" msgstr "語法大致等價於: ::" -#: ../../reference/compound_stmts.rst:1748 +#: ../../reference/compound_stmts.rst:1750 msgid "" "annotation-def TYPE_PARAMS_OF_func():\n" " T = typing.TypeVar(\"T\")\n" @@ -2384,7 +2377,7 @@ msgstr "" " return func\n" "func = TYPE_PARAMS_OF_func()" -#: ../../reference/compound_stmts.rst:1755 +#: ../../reference/compound_stmts.rst:1757 msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope `, which is not actually bound to any name at runtime. (One other " @@ -2393,20 +2386,20 @@ msgid "" "of :data:`typing.TypeVar` directly.)" msgstr "" -#: ../../reference/compound_stmts.rst:1761 +#: ../../reference/compound_stmts.rst:1763 msgid "" "The annotations of generic functions are evaluated within the annotation " "scope used for declaring the type parameters, but the function's defaults " "and decorators are not." msgstr "" -#: ../../reference/compound_stmts.rst:1765 +#: ../../reference/compound_stmts.rst:1767 msgid "" "The following example illustrates the scoping rules for these cases, as well " "as for additional flavors of type parameters::" msgstr "" -#: ../../reference/compound_stmts.rst:1768 +#: ../../reference/compound_stmts.rst:1770 msgid "" "@decorator\n" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" @@ -2416,13 +2409,13 @@ msgstr "" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" " ..." -#: ../../reference/compound_stmts.rst:1772 +#: ../../reference/compound_stmts.rst:1774 msgid "" "Except for the :ref:`lazy evaluation ` of " "the :class:`~typing.TypeVar` bound, this is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1775 +#: ../../reference/compound_stmts.rst:1777 msgid "" "DEFAULT_OF_arg = some_default\n" "\n" @@ -2444,25 +2437,25 @@ msgid "" "func = decorator(TYPE_PARAMS_OF_func())" msgstr "" -#: ../../reference/compound_stmts.rst:1794 +#: ../../reference/compound_stmts.rst:1796 msgid "" "The capitalized names like ``DEFAULT_OF_arg`` are not actually bound at " "runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1800 +#: ../../reference/compound_stmts.rst:1802 msgid "Generic classes" msgstr "" -#: ../../reference/compound_stmts.rst:1802 +#: ../../reference/compound_stmts.rst:1804 msgid "Generic classes are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1804 +#: ../../reference/compound_stmts.rst:1806 msgid "class Bag[T]: ..." msgstr "class Bag[T]: ..." -#: ../../reference/compound_stmts.rst:1808 +#: ../../reference/compound_stmts.rst:1810 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2480,14 +2473,14 @@ msgstr "" " return Bag\n" "Bag = TYPE_PARAMS_OF_Bag()" -#: ../../reference/compound_stmts.rst:1816 +#: ../../reference/compound_stmts.rst:1818 msgid "" "Here again ``annotation-def`` (not a real keyword) indicates " "an :ref:`annotation scope `, and the name " "``TYPE_PARAMS_OF_Bag`` is not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1820 +#: ../../reference/compound_stmts.rst:1822 msgid "" "Generic classes implicitly inherit from :data:`typing.Generic`. The base " "classes and keyword arguments of generic classes are evaluated within the " @@ -2495,7 +2488,7 @@ msgid "" "that scope. This is illustrated by this example::" msgstr "" -#: ../../reference/compound_stmts.rst:1826 +#: ../../reference/compound_stmts.rst:1828 msgid "" "@decorator\n" "class Bag(Base[T], arg=T): ..." @@ -2503,11 +2496,11 @@ msgstr "" "@decorator\n" "class Bag(Base[T], arg=T): ..." -#: ../../reference/compound_stmts.rst:1829 +#: ../../reference/compound_stmts.rst:1831 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../reference/compound_stmts.rst:1831 +#: ../../reference/compound_stmts.rst:1833 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2525,27 +2518,27 @@ msgstr "" " return Bag\n" "Bag = decorator(TYPE_PARAMS_OF_Bag())" -#: ../../reference/compound_stmts.rst:1842 +#: ../../reference/compound_stmts.rst:1844 msgid "Generic type aliases" msgstr "" -#: ../../reference/compound_stmts.rst:1844 +#: ../../reference/compound_stmts.rst:1846 msgid "" "The :keyword:`type` statement can also be used to create a generic type " "alias::" msgstr "" -#: ../../reference/compound_stmts.rst:1846 +#: ../../reference/compound_stmts.rst:1848 msgid "type ListOrSet[T] = list[T] | set[T]" msgstr "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1848 +#: ../../reference/compound_stmts.rst:1850 msgid "" "Except for the :ref:`lazy evaluation ` of the value, this " "is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1851 +#: ../../reference/compound_stmts.rst:1853 msgid "" "annotation-def TYPE_PARAMS_OF_ListOrSet():\n" " T = typing.TypeVar(\"T\")\n" @@ -2558,44 +2551,45 @@ msgid "" "ListOrSet = TYPE_PARAMS_OF_ListOrSet()" msgstr "" -#: ../../reference/compound_stmts.rst:1860 +#: ../../reference/compound_stmts.rst:1862 msgid "" "Here, ``annotation-def`` (not a real keyword) indicates an :ref:`annotation " "scope `. The capitalized names like " "``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1867 -#, fuzzy +#: ../../reference/compound_stmts.rst:1869 msgid "Annotations" -msgstr "annotations(註釋)" +msgstr "註釋" -#: ../../reference/compound_stmts.rst:1869 +#: ../../reference/compound_stmts.rst:1871 msgid "Annotations are now lazily evaluated by default." msgstr "" -#: ../../reference/compound_stmts.rst:1872 +#: ../../reference/compound_stmts.rst:1874 msgid "" "Variables and function parameters may carry :term:`annotations " "`, created by adding a colon after the name, followed by an " "expression::" msgstr "" -#: ../../reference/compound_stmts.rst:1875 +#: ../../reference/compound_stmts.rst:1877 msgid "" "x: annotation = 1\n" "def f(param: annotation): ..." msgstr "" +"x: annotation = 1\n" +"def f(param: annotation): ..." -#: ../../reference/compound_stmts.rst:1878 +#: ../../reference/compound_stmts.rst:1880 msgid "Functions may also carry a return annotation following an arrow::" msgstr "" -#: ../../reference/compound_stmts.rst:1880 +#: ../../reference/compound_stmts.rst:1882 msgid "def f() -> annotation: ..." -msgstr "" +msgstr "def f() -> annotation: ..." -#: ../../reference/compound_stmts.rst:1882 +#: ../../reference/compound_stmts.rst:1884 msgid "" "Annotations are conventionally used for :term:`type hints `, but " "this is not enforced by the language, and in general annotations may contain " @@ -2605,7 +2599,7 @@ msgid "" "or :func:`functools.singledispatch`)." msgstr "" -#: ../../reference/compound_stmts.rst:1888 +#: ../../reference/compound_stmts.rst:1890 msgid "" "By default, annotations are lazily evaluated in an :ref:`annotation scope " "`. This means that they are not evaluated when the code " @@ -2614,21 +2608,25 @@ msgid "" "The :mod:`annotationlib` module provides tools for evaluating annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1893 +#: ../../reference/compound_stmts.rst:1895 msgid "" "If the :ref:`future statement ` ``from __future__ import " "annotations`` is present, all annotations are instead stored as strings::" msgstr "" -#: ../../reference/compound_stmts.rst:1896 +#: ../../reference/compound_stmts.rst:1898 msgid "" ">>> from __future__ import annotations\n" ">>> def f(param: annotation): ...\n" ">>> f.__annotations__\n" "{'param': 'annotation'}" msgstr "" +">>> from __future__ import annotations\n" +">>> def f(param: annotation): ...\n" +">>> f.__annotations__\n" +"{'param': 'annotation'}" -#: ../../reference/compound_stmts.rst:1901 +#: ../../reference/compound_stmts.rst:1903 msgid "" "This future statement will be deprecated and removed in a future version of " "Python, but not before Python 3.13 reaches its end of life (see :pep:`749`). " @@ -2637,98 +2635,98 @@ msgid "" "are less likely to be able to resolve annotations at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1909 +#: ../../reference/compound_stmts.rst:1911 msgid "Footnotes" msgstr "註解" -#: ../../reference/compound_stmts.rst:1910 +#: ../../reference/compound_stmts.rst:1912 msgid "" "The exception is propagated to the invocation stack unless there is " "a :keyword:`finally` clause which happens to raise another exception. That " "new exception causes the old one to be lost." msgstr "" -#: ../../reference/compound_stmts.rst:1914 +#: ../../reference/compound_stmts.rst:1916 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1916 +#: ../../reference/compound_stmts.rst:1918 msgid "a class that inherits from :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1917 +#: ../../reference/compound_stmts.rst:1919 msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1918 +#: ../../reference/compound_stmts.rst:1920 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1919 -#: ../../reference/compound_stmts.rst:1938 +#: ../../reference/compound_stmts.rst:1921 +#: ../../reference/compound_stmts.rst:1940 msgid "a class that inherits from any of the above" msgstr "" -#: ../../reference/compound_stmts.rst:1921 +#: ../../reference/compound_stmts.rst:1923 msgid "The following standard library classes are sequences:" msgstr "" -#: ../../reference/compound_stmts.rst:1923 +#: ../../reference/compound_stmts.rst:1925 msgid ":class:`array.array`" msgstr ":class:`array.array`" -#: ../../reference/compound_stmts.rst:1924 +#: ../../reference/compound_stmts.rst:1926 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../reference/compound_stmts.rst:1926 +#: ../../reference/compound_stmts.rst:1928 msgid ":class:`memoryview`" msgstr ":class:`memoryview`" -#: ../../reference/compound_stmts.rst:1927 +#: ../../reference/compound_stmts.rst:1929 msgid ":class:`range`" msgstr ":class:`range`" -#: ../../reference/compound_stmts.rst:1930 +#: ../../reference/compound_stmts.rst:1932 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1933 +#: ../../reference/compound_stmts.rst:1935 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1935 +#: ../../reference/compound_stmts.rst:1937 msgid "a class that inherits from :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1936 +#: ../../reference/compound_stmts.rst:1938 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1937 +#: ../../reference/compound_stmts.rst:1939 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1940 +#: ../../reference/compound_stmts.rst:1942 msgid "" "The standard library classes :class:`dict` " "and :class:`types.MappingProxyType` are mappings." msgstr "" -#: ../../reference/compound_stmts.rst:1943 +#: ../../reference/compound_stmts.rst:1945 msgid "" "A string literal appearing as the first statement in the function body is " "transformed into the function's :attr:`~function.__doc__` attribute and " "therefore the function's :term:`docstring`." msgstr "" -#: ../../reference/compound_stmts.rst:1947 +#: ../../reference/compound_stmts.rst:1949 msgid "" "A string literal appearing as the first statement in the class body is " "transformed into the namespace's :attr:`~type.__doc__` item and therefore " @@ -2746,14 +2744,14 @@ msgstr "compound(複合)" #: ../../reference/compound_stmts.rst:169 #: ../../reference/compound_stmts.rst:207 #: ../../reference/compound_stmts.rst:393 -#: ../../reference/compound_stmts.rst:440 -#: ../../reference/compound_stmts.rst:478 -#: ../../reference/compound_stmts.rst:595 -#: ../../reference/compound_stmts.rst:1202 -#: ../../reference/compound_stmts.rst:1390 -#: ../../reference/compound_stmts.rst:1500 -#: ../../reference/compound_stmts.rst:1534 -#: ../../reference/compound_stmts.rst:1579 +#: ../../reference/compound_stmts.rst:442 +#: ../../reference/compound_stmts.rst:480 +#: ../../reference/compound_stmts.rst:597 +#: ../../reference/compound_stmts.rst:1204 +#: ../../reference/compound_stmts.rst:1392 +#: ../../reference/compound_stmts.rst:1502 +#: ../../reference/compound_stmts.rst:1536 +#: ../../reference/compound_stmts.rst:1581 msgid "statement" msgstr "statement(陳述式)" @@ -2789,7 +2787,7 @@ msgstr "" msgid "else" msgstr "else" -#: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:595 +#: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:597 msgid "if" msgstr "if" @@ -2799,9 +2797,9 @@ msgstr "if" #: ../../reference/compound_stmts.rst:330 #: ../../reference/compound_stmts.rst:393 #: ../../reference/compound_stmts.rst:411 -#: ../../reference/compound_stmts.rst:478 -#: ../../reference/compound_stmts.rst:595 -#: ../../reference/compound_stmts.rst:1510 +#: ../../reference/compound_stmts.rst:480 +#: ../../reference/compound_stmts.rst:597 +#: ../../reference/compound_stmts.rst:1512 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2812,21 +2810,21 @@ msgstr "elif" #: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:111 #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:207 -#: ../../reference/compound_stmts.rst:478 -#: ../../reference/compound_stmts.rst:595 -#: ../../reference/compound_stmts.rst:1202 -#: ../../reference/compound_stmts.rst:1332 -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:480 +#: ../../reference/compound_stmts.rst:597 +#: ../../reference/compound_stmts.rst:1204 +#: ../../reference/compound_stmts.rst:1334 +#: ../../reference/compound_stmts.rst:1392 msgid ": (colon)" msgstr ": (冒號)" #: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:111 #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:207 -#: ../../reference/compound_stmts.rst:478 -#: ../../reference/compound_stmts.rst:595 -#: ../../reference/compound_stmts.rst:1202 -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:480 +#: ../../reference/compound_stmts.rst:597 +#: ../../reference/compound_stmts.rst:1204 +#: ../../reference/compound_stmts.rst:1392 msgid "compound statement" msgstr "compound statement(複合陳述式)" @@ -2842,14 +2840,14 @@ msgstr "loop(迴圈)" #: ../../reference/compound_stmts.rst:129 #: ../../reference/compound_stmts.rst:169 #: ../../reference/compound_stmts.rst:393 -#: ../../reference/compound_stmts.rst:440 +#: ../../reference/compound_stmts.rst:442 msgid "break" msgstr "break" #: ../../reference/compound_stmts.rst:129 #: ../../reference/compound_stmts.rst:169 #: ../../reference/compound_stmts.rst:393 -#: ../../reference/compound_stmts.rst:440 +#: ../../reference/compound_stmts.rst:442 msgid "continue" msgstr "continue" @@ -2871,8 +2869,8 @@ msgstr "list(串列)" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:301 -#: ../../reference/compound_stmts.rst:1202 -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:1204 +#: ../../reference/compound_stmts.rst:1392 msgid "object" msgstr "object(物件)" @@ -2903,8 +2901,8 @@ msgstr "finally" #: ../../reference/compound_stmts.rst:207 #: ../../reference/compound_stmts.rst:268 -#: ../../reference/compound_stmts.rst:478 -#: ../../reference/compound_stmts.rst:595 +#: ../../reference/compound_stmts.rst:480 +#: ../../reference/compound_stmts.rst:597 msgid "as" msgstr "as" @@ -2929,212 +2927,212 @@ msgid "except_star" msgstr "except_star" #: ../../reference/compound_stmts.rst:393 -#: ../../reference/compound_stmts.rst:440 +#: ../../reference/compound_stmts.rst:442 msgid "return" msgstr "return (回傳)" -#: ../../reference/compound_stmts.rst:478 +#: ../../reference/compound_stmts.rst:480 msgid "with" msgstr "with" -#: ../../reference/compound_stmts.rst:478 +#: ../../reference/compound_stmts.rst:480 msgid "with statement" msgstr "with statement(with 陳述式)" -#: ../../reference/compound_stmts.rst:478 -#: ../../reference/compound_stmts.rst:1202 -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:480 +#: ../../reference/compound_stmts.rst:1204 +#: ../../reference/compound_stmts.rst:1392 msgid ", (comma)" msgstr ", (逗號)" -#: ../../reference/compound_stmts.rst:595 +#: ../../reference/compound_stmts.rst:597 msgid "match" msgstr "match" -#: ../../reference/compound_stmts.rst:595 +#: ../../reference/compound_stmts.rst:597 msgid "case" msgstr "case" -#: ../../reference/compound_stmts.rst:595 +#: ../../reference/compound_stmts.rst:597 msgid "pattern matching" msgstr "pattern matching(模式匹配)" -#: ../../reference/compound_stmts.rst:595 +#: ../../reference/compound_stmts.rst:597 msgid "match statement" msgstr "match statement(匹配陳述式)" -#: ../../reference/compound_stmts.rst:699 +#: ../../reference/compound_stmts.rst:701 msgid "guard" msgstr "guard" -#: ../../reference/compound_stmts.rst:738 +#: ../../reference/compound_stmts.rst:740 msgid "irrefutable case block" msgstr "" -#: ../../reference/compound_stmts.rst:738 +#: ../../reference/compound_stmts.rst:740 msgid "case block" msgstr "" -#: ../../reference/compound_stmts.rst:762 +#: ../../reference/compound_stmts.rst:764 msgid "! patterns" msgstr "" -#: ../../reference/compound_stmts.rst:762 +#: ../../reference/compound_stmts.rst:764 msgid "AS pattern, OR pattern, capture pattern, wildcard pattern" msgstr "" -#: ../../reference/compound_stmts.rst:1193 -#: ../../reference/compound_stmts.rst:1282 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1284 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/compound_stmts.rst:1193 -#: ../../reference/compound_stmts.rst:1202 -#: ../../reference/compound_stmts.rst:1246 -#: ../../reference/compound_stmts.rst:1282 -#: ../../reference/compound_stmts.rst:1311 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1204 +#: ../../reference/compound_stmts.rst:1248 +#: ../../reference/compound_stmts.rst:1284 +#: ../../reference/compound_stmts.rst:1313 msgid "function definition" msgstr "function definition(函式定義)" -#: ../../reference/compound_stmts.rst:1202 +#: ../../reference/compound_stmts.rst:1204 msgid "def" msgstr "def" -#: ../../reference/compound_stmts.rst:1202 -#: ../../reference/compound_stmts.rst:1332 +#: ../../reference/compound_stmts.rst:1204 +#: ../../reference/compound_stmts.rst:1334 msgid "function" msgstr "function (函式)" -#: ../../reference/compound_stmts.rst:1202 -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:1204 +#: ../../reference/compound_stmts.rst:1392 msgid "definition" msgstr "definition(定義)" -#: ../../reference/compound_stmts.rst:1202 -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:1204 +#: ../../reference/compound_stmts.rst:1392 msgid "name" msgstr "name(名稱)" -#: ../../reference/compound_stmts.rst:1202 -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:1204 +#: ../../reference/compound_stmts.rst:1392 msgid "binding" msgstr "binding(綁定)" -#: ../../reference/compound_stmts.rst:1202 +#: ../../reference/compound_stmts.rst:1204 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/compound_stmts.rst:1202 -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:1204 +#: ../../reference/compound_stmts.rst:1392 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../reference/compound_stmts.rst:1202 +#: ../../reference/compound_stmts.rst:1204 msgid "parameter list" msgstr "parameter list(參數列表)" -#: ../../reference/compound_stmts.rst:1246 -#: ../../reference/compound_stmts.rst:1440 +#: ../../reference/compound_stmts.rst:1248 +#: ../../reference/compound_stmts.rst:1442 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/compound_stmts.rst:1282 +#: ../../reference/compound_stmts.rst:1284 msgid "default" msgstr "default(預設)" -#: ../../reference/compound_stmts.rst:1282 +#: ../../reference/compound_stmts.rst:1284 msgid "value" msgstr "value(值)" -#: ../../reference/compound_stmts.rst:1282 +#: ../../reference/compound_stmts.rst:1284 msgid "argument" msgstr "argument(引數)" -#: ../../reference/compound_stmts.rst:1282 +#: ../../reference/compound_stmts.rst:1284 msgid "= (equals)" msgstr "= (等號)" -#: ../../reference/compound_stmts.rst:1311 +#: ../../reference/compound_stmts.rst:1313 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/compound_stmts.rst:1311 +#: ../../reference/compound_stmts.rst:1313 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/compound_stmts.rst:1311 +#: ../../reference/compound_stmts.rst:1313 msgid "**" msgstr "**" -#: ../../reference/compound_stmts.rst:1332 +#: ../../reference/compound_stmts.rst:1334 msgid "annotations" msgstr "annotations(註釋)" -#: ../../reference/compound_stmts.rst:1332 +#: ../../reference/compound_stmts.rst:1334 msgid "->" msgstr "->" -#: ../../reference/compound_stmts.rst:1332 +#: ../../reference/compound_stmts.rst:1334 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../reference/compound_stmts.rst:1349 +#: ../../reference/compound_stmts.rst:1351 msgid "lambda" msgstr "lambda" -#: ../../reference/compound_stmts.rst:1349 +#: ../../reference/compound_stmts.rst:1351 msgid "expression" msgstr "expression(運算式)" -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:1392 msgid "class" msgstr "class(類別)" -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:1392 msgid "execution" msgstr "execution(執行)" -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:1392 msgid "frame" msgstr "frame" -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:1392 msgid "inheritance" msgstr "inheritance(繼承)" -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:1392 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../reference/compound_stmts.rst:1390 -#: ../../reference/compound_stmts.rst:1440 +#: ../../reference/compound_stmts.rst:1392 +#: ../../reference/compound_stmts.rst:1442 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/compound_stmts.rst:1390 +#: ../../reference/compound_stmts.rst:1392 msgid "expression list" msgstr "expression list(表達式列表)" -#: ../../reference/compound_stmts.rst:1500 +#: ../../reference/compound_stmts.rst:1502 msgid "async def" msgstr "async def" -#: ../../reference/compound_stmts.rst:1510 +#: ../../reference/compound_stmts.rst:1512 msgid "async" msgstr "async" -#: ../../reference/compound_stmts.rst:1510 +#: ../../reference/compound_stmts.rst:1512 msgid "await" msgstr "await" -#: ../../reference/compound_stmts.rst:1534 +#: ../../reference/compound_stmts.rst:1536 msgid "async for" msgstr "async for" -#: ../../reference/compound_stmts.rst:1579 +#: ../../reference/compound_stmts.rst:1581 msgid "async with" msgstr "async with" -#: ../../reference/compound_stmts.rst:1636 +#: ../../reference/compound_stmts.rst:1638 msgid "type parameters" msgstr "type parameter(型別參數)" diff --git a/reference/datamodel.po b/reference/datamodel.po index c3dfe65eb51..0097c0fda53 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,9 +6,9 @@ # Kisaragi Hiu , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\n" "PO-Revision-Date: 2024-09-24 19:03+0900\n" "Last-Translator: Kisaragi Hiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -255,15 +255,14 @@ msgid "Evaluating :data:`NotImplemented` in a boolean context was deprecated." msgstr "" #: ../../reference/datamodel.rst:179 -#, fuzzy msgid "" "Evaluating :data:`NotImplemented` in a boolean context now raises " "a :exc:`TypeError`. It previously evaluated to :const:`True` and emitted " "a :exc:`DeprecationWarning` since Python 3.9." msgstr "" -"在預期布林值的情境中計算 :data:`NotImplemented` 的行為已棄用。雖然目前它會計" -"算為 true,它也會同時發出 :exc:`DeprecationWarning`。從某個未來 Python 版本開" -"始這將會引發 :exc:`TypeError`。" +"在預期布林值的情境中計算 :data:`NotImplemented` 現在會引發 :exc:`TypeError`。" +"它先前會計算為 :const:`True`,並自 Python 3.9 起會發" +"出 :exc:`DeprecationWarning`。" #: ../../reference/datamodel.rst:186 ../../reference/datamodel.rst:187 msgid "Ellipsis" @@ -578,7 +577,7 @@ msgstr "Set(集合)" msgid "" "These represent a mutable set. They are created by the built-in :func:`set` " "constructor and can be modified afterwards by several methods, such " -"as :meth:`~set.add`." +"as :meth:`add `." msgstr "" #: ../../reference/datamodel.rst:459 @@ -1473,14 +1472,11 @@ msgid "" msgstr "" #: ../../reference/datamodel.rst:1254 -#, fuzzy msgid "" "The :term:`annotate function` for this class, or ``None`` if the class has " "no annotations. See also: :attr:`__annotate__ attributes " "`." msgstr "" -"模組的文件字串,若不可用則為 ``None``。請見 :attr:`__doc__ attributes " -"`。" #: ../../reference/datamodel.rst:1261 msgid "" @@ -1497,8 +1493,8 @@ msgstr "" #: ../../reference/datamodel.rst:1273 msgid "" "The line number of the first line of the class definition, including " -"decorators. Setting the :attr:`__module__` attribute removes the :attr:`!" -"__firstlineno__` item from the type's dictionary." +"decorators. Setting the :attr:`~type.__module__` attribute removes " +"the :attr:`!__firstlineno__` item from the type's dictionary." msgstr "" #: ../../reference/datamodel.rst:1281 @@ -2199,9 +2195,9 @@ msgid "" "When implementing a class that emulates any built-in type, it is important " "that the emulation only be implemented to the degree that it makes sense for " "the object being modelled. For example, some sequences may work well with " -"retrieval of individual elements, but extracting a slice may not make " -"sense. (One example of this is the :class:`~xml.dom.NodeList` interface in " -"the W3C's Document Object Model.)" +"retrieval of individual elements, but extracting a slice may not make sense. " +"(One example of this is the :ref:`NodeList ` interface " +"in the W3C's Document Object Model.)" msgstr "" #: ../../reference/datamodel.rst:1914 @@ -3167,7 +3163,7 @@ msgstr "" #: ../../reference/datamodel.rst:2700 msgid "" -"When a class is created, :meth:`type.__new__` scans the class variables and " +"When a class is created, :meth:`!type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" @@ -3785,9 +3781,9 @@ msgid "" "of :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, " "and :meth:`!keys`. Mutable sequences should provide " "methods :meth:`~sequence.append`, :meth:`~sequence.count`, :meth:`~sequence.index`, :meth:`~sequence.extend`, :meth:`~sequence.insert`, :meth:`~sequence.pop`, :meth:`~sequence.remove`, :meth:`~sequence.reverse` " -"and :meth:`~sequence.sort`, like Python standard :class:`list` objects. " -"Finally, sequence types should implement addition (meaning concatenation) " -"and multiplication (meaning repetition) by defining the " +"and :meth:`!sort`, like Python standard :class:`list` objects. Finally, " +"sequence types should implement addition (meaning concatenation) and " +"multiplication (meaning repetition) by defining the " "methods :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object.__iadd__`, :meth:`~object.__mul__`, :meth:`~object.__rmul__` " "and :meth:`~object.__imul__` described below; they should not define other " "numerical operators. It is recommended that both mappings and sequences " @@ -4235,9 +4231,8 @@ msgid "ABC for buffer types." msgstr "" #: ../../reference/datamodel.rst:3600 -#, fuzzy msgid "Annotations" -msgstr "invocation(呼叫)" +msgstr "" #: ../../reference/datamodel.rst:3602 msgid "" @@ -5088,9 +5083,8 @@ msgid "__annotations__ (function attribute)" msgstr "__annotations__ (函式屬性)" #: ../../reference/datamodel.rst:579 -#, fuzzy msgid "__annotate__ (function attribute)" -msgstr "__annotations__ (函式屬性)" +msgstr "__annotate__ (函式屬性)" #: ../../reference/datamodel.rst:579 msgid "__kwdefaults__ (function attribute)" @@ -5197,9 +5191,8 @@ msgid "__annotations__ (module attribute)" msgstr "__annotations__ (模組屬性)" #: ../../reference/datamodel.rst:895 -#, fuzzy msgid "__annotate__ (module attribute)" -msgstr "__annotations__ (模組屬性)" +msgstr "__annotate__ (模組屬性)" #: ../../reference/datamodel.rst:1121 msgid "__dict__ (module attribute)" @@ -5250,9 +5243,8 @@ msgid "__annotations__ (class attribute)" msgstr "__annotations__ (類別屬性)" #: ../../reference/datamodel.rst:1183 -#, fuzzy msgid "__annotate__ (class attribute)" -msgstr "__annotations__ (類別屬性)" +msgstr "__annotate__ (類別屬性)" #: ../../reference/datamodel.rst:1183 msgid "__type_params__ (class attribute)" @@ -5439,9 +5431,8 @@ msgid "f_builtins (frame attribute)" msgstr "f_builtins (frame 屬性)" #: ../../reference/datamodel.rst:1634 -#, fuzzy msgid "f_generator (frame attribute)" -msgstr "f_lineno (frame 屬性)" +msgstr "f_generator (frame 屬性)" #: ../../reference/datamodel.rst:1685 msgid "f_trace (frame attribute)" diff --git a/reference/executionmodel.po b/reference/executionmodel.po index a7a6de91022..a1c3731f11f 100644 --- a/reference/executionmodel.po +++ b/reference/executionmodel.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" diff --git a/reference/expressions.po b/reference/expressions.po index 9bdfb6b54fd..47cbe34e6f7 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" diff --git a/reference/grammar.po b/reference/grammar.po index 173627a3ae7..bef1399bd2f 100644 --- a/reference/grammar.po +++ b/reference/grammar.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" diff --git a/reference/import.po b/reference/import.po index 9bd743cb9c0..169855ac59a 100644 --- a/reference/import.po +++ b/reference/import.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-11-06 14:55+0800\n" diff --git a/reference/index.po b/reference/index.po index 9f265f75e96..8a6a6e7eca9 100644 --- a/reference/index.po +++ b/reference/index.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-07-06 22:07+0800\n" diff --git a/reference/introduction.po b/reference/introduction.po index 3f2dbeb0009..762487aea6c 100644 --- a/reference/introduction.po +++ b/reference/introduction.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" @@ -316,9 +315,8 @@ msgid "This does *not* mean that there is an empty first alternative." msgstr "" #: ../../reference/introduction.rst:202 -#, fuzzy msgid "Lexical and Syntactic definitions" -msgstr "lexical definitions(詞法定義)" +msgstr "詞法和語法定義" #: ../../reference/introduction.rst:204 msgid "" @@ -365,6 +363,3 @@ msgstr "notation(標記法)" #: ../../reference/introduction.rst:197 msgid "lexical definitions" msgstr "lexical definitions(詞法定義)" - -#~ msgid "ASCII" -#~ msgstr "ASCII" diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index 178ef8e4f6e..f2ddf07d1bb 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" @@ -461,9 +461,8 @@ msgid "Unicode category ```` - letter numbers" msgstr "" #: ../../reference/lexical_analysis.rst:346 -#, fuzzy msgid "{``\"_\"``} - the underscore" -msgstr "_ (底線)" +msgstr "{``\"_\"``} - 底線" #: ../../reference/lexical_analysis.rst:347 msgid "" @@ -749,9 +748,8 @@ msgid "" msgstr "" #: ../../reference/lexical_analysis.rst:557 -#, fuzzy msgid "Triple-quoted strings" -msgstr "triple-quoted string(三引號字串)" +msgstr "三引號字串" #: ../../reference/lexical_analysis.rst:559 msgid "" @@ -760,9 +758,8 @@ msgid "" msgstr "" #: ../../reference/lexical_analysis.rst:563 -#, fuzzy msgid "\"\"\"This is a triple-quoted string.\"\"\"" -msgstr "triple-quoted string(三引號字串)" +msgstr "\"\"\"這是一個三引號字串。\"\"\"" #: ../../reference/lexical_analysis.rst:565 msgid "" @@ -773,7 +770,7 @@ msgstr "" #: ../../reference/lexical_analysis.rst:569 msgid "\"\"\"This string has \"quotes\" inside.\"\"\"" -msgstr "" +msgstr "\"\"\"這個字串裡面有 \"引號\"。\"\"\"" #: ../../reference/lexical_analysis.rst:571 msgid "Unescaped newlines are also allowed and retained::" @@ -800,6 +797,8 @@ msgid "" "b\"data\"\n" "f'{result=}'" msgstr "" +"b\"data\"\n" +"f'{result=}'" #: ../../reference/lexical_analysis.rst:592 msgid "The allowed prefixes are:" @@ -1040,9 +1039,8 @@ msgid "" msgstr "" #: ../../reference/lexical_analysis.rst:724 -#, fuzzy msgid "Escaped characters" -msgstr "source character set(原始字元集合)" +msgstr "跳脫字元" #: ../../reference/lexical_analysis.rst:726 msgid "" @@ -1056,6 +1054,8 @@ msgid "" ">>> print('C:\\\\Program Files')\n" "C:\\Program Files" msgstr "" +">>> print('C:\\\\Program Files')\n" +"C:\\Program Files" #: ../../reference/lexical_analysis.rst:733 msgid "" @@ -1068,11 +1068,12 @@ msgid "" ">>> print('\\' and \\\"')\n" "' and \"" msgstr "" +">>> print('\\' and \\\"')\n" +"' and \"" #: ../../reference/lexical_analysis.rst:742 -#, fuzzy msgid "Octal character" -msgstr "hash character(井字號)" +msgstr "八進位字元" #: ../../reference/lexical_analysis.rst:744 msgid "" @@ -1085,6 +1086,8 @@ msgid "" ">>> '\\120'\n" "'P'" msgstr "" +">>> '\\120'\n" +"'P'" #: ../../reference/lexical_analysis.rst:750 msgid "Up to three octal digits (0 through 7) are accepted." @@ -1111,9 +1114,8 @@ msgid "" msgstr "" #: ../../reference/lexical_analysis.rst:767 -#, fuzzy msgid "Hexadecimal character" -msgstr "hexadecimal literal(十六進位常數)" +msgstr "十六進位字元" #: ../../reference/lexical_analysis.rst:769 msgid "" @@ -1126,10 +1128,12 @@ msgid "" ">>> '\\x50'\n" "'P'" msgstr "" +">>> '\\x50'\n" +"'P'" #: ../../reference/lexical_analysis.rst:775 msgid "Unlike in Standard C, exactly two hex digits are required." -msgstr "" +msgstr "與標準 C 不同,這裡需要剛好兩個十六進位數字。" #: ../../reference/lexical_analysis.rst:783 msgid "Named Unicode character" @@ -1148,22 +1152,26 @@ msgid "" ">>> '\\N{SNAKE}'\n" "'🐍'" msgstr "" +">>> '\\N{LATIN CAPITAL LETTER P}'\n" +"'P'\n" +">>> '\\N{SNAKE}'\n" +"'🐍'" #: ../../reference/lexical_analysis.rst:793 msgid "This sequence cannot appear in :ref:`bytes literals `." msgstr "" #: ../../reference/lexical_analysis.rst:795 -#, fuzzy msgid "" "Support for `name aliases `__ has been added." -msgstr "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" +msgstr "" +"已新增對\\ `名稱別名 (name alias) `__\\ 的支援。" #: ../../reference/lexical_analysis.rst:802 -#, fuzzy msgid "Hexadecimal Unicode characters" -msgstr "hexadecimal literal(十六進位常數)" +msgstr "十六進位 Unicode 字元" #: ../../reference/lexical_analysis.rst:804 msgid "" @@ -1180,15 +1188,18 @@ msgid "" ">>> '\\U0001f40d'\n" "'🐍'" msgstr "" +">>> '\\u1234'\n" +"'ሴ'\n" +">>> '\\U0001f40d'\n" +"'🐍'" #: ../../reference/lexical_analysis.rst:817 msgid "These sequences cannot appear in :ref:`bytes literals `." msgstr "" #: ../../reference/lexical_analysis.rst:823 -#, fuzzy msgid "Unrecognized escape sequences" -msgstr "unrecognized escape sequence(無法辨識的跳脫序列)" +msgstr "無法辨識的跳脫序列" #: ../../reference/lexical_analysis.rst:825 msgid "" @@ -1203,6 +1214,10 @@ msgid "" ">>> list('\\q')\n" "['\\\\', 'q']" msgstr "" +">>> print('\\q')\n" +"\\q\n" +">>> list('\\q')\n" +"['\\\\', 'q']" #: ../../reference/lexical_analysis.rst:833 msgid "" @@ -1222,9 +1237,8 @@ msgid "" msgstr "" #: ../../reference/lexical_analysis.rst:853 -#, fuzzy msgid "Bytes literals" -msgstr "bytes literal(位元組常數)" +msgstr "位元組常數" #: ../../reference/lexical_analysis.rst:855 msgid "" @@ -1242,6 +1256,10 @@ msgid "" ">>> list(b'\\x89PNG\\r\\n\\x1a\\n')\n" "[137, 80, 78, 71, 13, 10, 26, 10]" msgstr "" +">>> b'\\x89PNG\\r\\n\\x1a\\n'\n" +"b'\\x89PNG\\r\\n\\x1a\\n'\n" +">>> list(b'\\x89PNG\\r\\n\\x1a\\n')\n" +"[137, 80, 78, 71, 13, 10, 26, 10]" #: ../../reference/lexical_analysis.rst:868 msgid "" @@ -1250,9 +1268,8 @@ msgid "" msgstr "" #: ../../reference/lexical_analysis.rst:879 -#, fuzzy msgid "Raw string literals" -msgstr "raw string literal(原始字串常數)" +msgstr "原始字串常數" #: ../../reference/lexical_analysis.rst:881 msgid "" @@ -1268,6 +1285,8 @@ msgid "" ">>> r'\\d{4}-\\d{2}-\\d{2}'\n" "'\\\\d{4}-\\\\d{2}-\\\\d{2}'" msgstr "" +">>> r'\\d{4}-\\d{2}-\\d{2}'\n" +"'\\\\d{4}-\\\\d{2}-\\\\d{2}'" #: ../../reference/lexical_analysis.rst:893 msgid "" @@ -1335,6 +1354,9 @@ msgid "" "... + 3}\"\n" "'abc5'" msgstr "" +">>> f\"abc{a # This is a comment }\"\n" +"... + 3}\"\n" +"'abc5'" #: ../../reference/lexical_analysis.rst:972 msgid "" @@ -1495,6 +1517,11 @@ msgid "" ">>> foo.__doc__ is None\n" "True" msgstr "" +">>> def foo():\n" +"... f\"Not a docstring\"\n" +"...\n" +">>> foo.__doc__ is None\n" +"True" #: ../../reference/lexical_analysis.rst:1079 msgid "" @@ -1503,9 +1530,8 @@ msgid "" msgstr "" #: ../../reference/lexical_analysis.rst:1087 -#, fuzzy msgid "t-strings" -msgstr "f-string(f 字串)" +msgstr "t-string(t 字串)" #: ../../reference/lexical_analysis.rst:1091 msgid "" @@ -1795,7 +1821,6 @@ msgid "" msgstr "" #: ../../reference/lexical_analysis.rst:1325 -#, fuzzy msgid "" "4.2j\n" "3.14j\n" @@ -1804,7 +1829,14 @@ msgid "" "1e100j\n" "3.14e-10j\n" "3.14_15_93j" -msgstr "3.14j 10.j 10j .001j 1e100j 3.14e-10j 3.14_15_93j" +msgstr "" +"4.2j\n" +"3.14j\n" +"10.j\n" +".001j\n" +"1e100j\n" +"3.14e-10j\n" +"3.14_15_93j" #: ../../reference/lexical_analysis.rst:1333 msgid "" @@ -1862,14 +1894,12 @@ msgid "The following tokens serve as delimiters in the grammar:" msgstr "" #: ../../reference/lexical_analysis.rst:1380 -#, fuzzy msgid "" "( ) [ ] { }\n" ", : ! . ; @ =" msgstr "" -"+ - * ** / // % @\n" -"<< >> & | ^ ~ :=\n" -"< > <= >= == !=" +"( ) [ ] { }\n" +", : ! . ; @ =" #: ../../reference/lexical_analysis.rst:1385 msgid "The period can also occur in floating-point and imaginary literals." @@ -1883,7 +1913,7 @@ msgstr "" #: ../../reference/lexical_analysis.rst:1392 msgid "..." -msgstr "" +msgstr "..." #: ../../reference/lexical_analysis.rst:1396 msgid "" @@ -1892,13 +1922,10 @@ msgid "" msgstr "" #: ../../reference/lexical_analysis.rst:1399 -#, fuzzy msgid "" "-> += -= *= /= //= %=\n" "@= &= |= ^= >>= <<= **=" msgstr "" -"( ) [ ] { }\n" -", : ! . ; @ =\n" "-> += -= *= /= //= %=\n" "@= &= |= ^= >>= <<= **=" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index 7f99444a8dd..6c659547246 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" diff --git a/reference/toplevel_components.po b/reference/toplevel_components.po index 1d07c2ac55a..4d0ce6166de 100644 --- a/reference/toplevel_components.po +++ b/reference/toplevel_components.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-12-01 01:37+0800\n" diff --git a/sphinx.po b/sphinx.po index df4d7162716..48878694c5e 100644 --- a/sphinx.po +++ b/sphinx.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Steven Hsu , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2023-03-15 10:19+0800\n" diff --git a/tutorial/appendix.po b/tutorial/appendix.po index 3e9e025ca8e..f2aa9140f9d 100644 --- a/tutorial/appendix.po +++ b/tutorial/appendix.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Weilin Du, 2025 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-08-15 00:17+0000\n" "PO-Revision-Date: 2025-07-13 14:05+0800\n" diff --git a/tutorial/appetite.po b/tutorial/appetite.po index 42d5ffb0b0c..4b307e07ab8 100644 --- a/tutorial/appetite.po +++ b/tutorial/appetite.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # Liang-Bo Wang , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-24 00:11+0000\n" "PO-Revision-Date: 2021-10-03 17:39+0800\n" diff --git a/tutorial/classes.po b/tutorial/classes.po index 7a7c57c7c35..6027cb8443b 100644 --- a/tutorial/classes.po +++ b/tutorial/classes.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-12-26 23:12+0800\n" @@ -659,7 +659,6 @@ msgstr "" "有效的屬性名稱:資料屬性 (data attribute) 和 method。" #: ../../tutorial/classes.rst:328 -#, fuzzy msgid "" "*Data attributes* correspond to \"instance variables\" in Smalltalk, and to " "\"data members\" in C++. Data attributes need not be declared; like local " diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index c1c0e99ad6d..31f47ad6674 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,9 +8,9 @@ # Steven Hsu , 2021-2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\n" "PO-Revision-Date: 2022-07-24 14:52+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -579,7 +579,6 @@ msgid ":keyword:`!match` Statements" msgstr ":keyword:`!match` 陳述式" #: ../../tutorial/controlflow.rst:286 -#, fuzzy msgid "" "A :keyword:`match` statement takes an expression and compares its value to " "successive patterns given as one or more case blocks. This is superficially " @@ -593,7 +592,8 @@ msgstr "" "進行比較,這些模式是以一個或多個 case 區塊來表示。表面上,這類似 C、Java 或 " "JavaScript(以及許多其他語言)中的 switch 陳述式,但它與 Rust 或 Haskell 等語" "言中的模式匹配 (pattern matching) 更為相近。只有第一個匹配成功的模式會被執" -"行,而它也可以將成分(序列元素或物件屬性)從值中提取到變數中。" +"行,而它也可以將成分(序列元素或物件屬性)從值中提取到變數中。如果沒有任何的 " +"case 匹配成功,則不會執行任何的分支。" #: ../../tutorial/controlflow.rst:295 msgid "" @@ -627,13 +627,12 @@ msgstr "" " return \"Something's wrong with the internet\"" #: ../../tutorial/controlflow.rst:308 -#, fuzzy msgid "" "Note the last block: the \"variable name\" ``_`` acts as a *wildcard* and " "never fails to match." msgstr "" "請注意最後一段:「變數名稱」\\ ``_`` 是作為\\ *通用字元 (wildcard)*\\ 的角" -"色,且永遠不會匹配失敗。如果沒有 case 匹配成功,則不會執行任何的分支。" +"色,且永遠不會匹配失敗。" #: ../../tutorial/controlflow.rst:311 msgid "" @@ -1162,7 +1161,6 @@ msgstr "" "``None``。" #: ../../tutorial/controlflow.rst:557 -#, fuzzy msgid "" "The statement ``result.append(a)`` calls a *method* of the list object " "``result``. A method is a function that 'belongs' to an object and is named " @@ -1181,9 +1179,9 @@ msgstr "" "``obj`` 為某個物件(亦可為一運算式),而 ``methodname`` 為該 method 的名稱," "並由該物件的型別所定義。不同的型別定義不同的 method。不同型別的 method 可以擁" "有一樣的名稱而不會讓 Python 混淆。(你可以使用 *class*\\ (類別)定義自己的物" -"件型別和 method,見 :ref:`tut-classes`\\ )範例中的 :meth:`!append` method 定" -"義在 list 物件中;它會在該 list 的末端加入一個新的元素。這個例子等同於 " -"``result = result + [a]``,但更有效率。" +"件型別和 method,見 :ref:`tut-classes`\\ )範例中的 :meth:`~list.append` " +"method 定義在 list 物件中;它會在該 list 的末端加入一個新的元素。這個例子等同" +"於 ``result = result + [a]``,但更有效率。" #: ../../tutorial/controlflow.rst:572 msgid "More on Defining Functions" @@ -2187,17 +2185,18 @@ msgstr "" #: ../../tutorial/controlflow.rst:1077 msgid "" -":term:`Annotations ` are stored in the :attr:`!" -"__annotations__` attribute of the function as a dictionary and have no " -"effect on any other part of the function. Parameter annotations are defined " -"by a colon after the parameter name, followed by an expression evaluating to " -"the value of the annotation. Return annotations are defined by a literal ``-" -">``, followed by an expression, between the parameter list and the colon " -"denoting the end of the :keyword:`def` statement. The following example has " -"a required argument, an optional argument, and the return value annotated::" +":term:`Annotations ` are stored in " +"the :attr:`~object.__annotations__` attribute of the function as a " +"dictionary and have no effect on any other part of the function. Parameter " +"annotations are defined by a colon after the parameter name, followed by an " +"expression evaluating to the value of the annotation. Return annotations " +"are defined by a literal ``->``, followed by an expression, between the " +"parameter list and the colon denoting the end of the :keyword:`def` " +"statement. The following example has a required argument, an optional " +"argument, and the return value annotated::" msgstr "" ":term:`註釋 `\\ 以 dictionary(字典)的形式存放在函式" -"的 :attr:`!__annotations__` 屬性中,且不會影響函式的任何其他部分。參數註釋的" +"的 :attr:`~object.__annotations__` 屬性中,且不會影響函式的任何其他部分。參數註釋的" "定義方式是在參數名稱後加一個冒號,冒號後面跟著一個對註釋求值的運算式。回傳註" "釋的定義方式是在參數列表和 :keyword:`def` 陳述式結尾的冒號中間,用一個 ``-" ">`` 文字接著一個運算式。以下範例註釋了一個必要引數、一個選擇性引數,以及回傳" diff --git a/tutorial/datastructures.po b/tutorial/datastructures.po index 3db19f4abab..fe3bb8c4e8b 100644 --- a/tutorial/datastructures.po +++ b/tutorial/datastructures.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -10,7 +10,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2024-01-22 21:43+0800\n" @@ -94,12 +94,11 @@ msgid "Remove all items from the list. Similar to ``del a[:]``." msgstr "刪除 list 中所有項目。與 ``del a[:]`` 類似。" #: ../../tutorial/datastructures.rst:65 -#, fuzzy msgid "" "Return zero-based index of the first occurrence of *x* in the list. Raises " "a :exc:`ValueError` if there is no such item." msgstr "" -"回傳 list 中第一個值等於 *x* 的項目之索引值(從零開始的索引)。若 list 中無此" +"回傳 list 中第一個出現 *x* 的(從零開始的)索引值。若 list 中無此" "項目,則丟出 :exc:`ValueError` 錯誤。" #: ../../tutorial/datastructures.rst:68 @@ -212,7 +211,6 @@ msgid "Using Lists as Stacks" msgstr "將 List 作為 Stack(堆疊)使用" #: ../../tutorial/datastructures.rst:143 -#, fuzzy msgid "" "The list methods make it very easy to use a list as a stack, where the last " "element added is the first element retrieved (\"last-in, first-out\"). To " @@ -222,7 +220,7 @@ msgid "" msgstr "" "List 的操作方法使得它非常簡單可以用來實作 stack(堆疊)。Stack 為一個遵守最後" "加入元素最先被取回(後進先出,\"last-in, first-out\")規則的資料結構。你可以" -"使用方法 :meth:`!append` 將一個項目放到堆疊的頂層。而使用方法 :meth:`!pop` 且" +"使用方法 :meth:`~list.append` 將一個項目放到堆疊的頂層。而使用方法 :meth:`~list.pop` 且" "不給定索引值去取得堆疊最上面的項目。舉例而言: ::" #: ../../tutorial/datastructures.rst:148 @@ -625,7 +623,6 @@ msgid "The :keyword:`!del` statement" msgstr ":keyword:`!del` 陳述式" #: ../../tutorial/datastructures.rst:342 -#, fuzzy msgid "" "There is a way to remove an item from a list given its index instead of its " "value: the :keyword:`del` statement. This differs from " @@ -635,7 +632,7 @@ msgid "" "For example::" msgstr "" "有一個方法可以藉由索引而不是值來刪除 list 中的項目::keyword:`del` 陳述式。這" -"和 :meth:`!pop` method 傳回一個值不同,:keyword:`!del` 陳述式可以用來刪除 " +"和 :meth:`~list.pop` method 傳回一個值不同,:keyword:`!del` 陳述式可以用來刪除 " "list 中的片段或者清空整個 list(我們之前藉由指派一個空的 list 給想刪除的片段" "來完成這件事)。例如: ::" @@ -933,7 +930,6 @@ msgid "Dictionaries" msgstr "字典(Dictionary)" #: ../../tutorial/datastructures.rst:495 -#, fuzzy msgid "" "Another useful data type built into Python is the *dictionary* " "(see :ref:`typesmapping`). Dictionaries are sometimes found in other " @@ -953,8 +949,8 @@ msgstr "" "的類型;字串和數字都可以當作鍵。Tuple 也可以當作鍵,如果他們只含有字串、數字" "或 tuple;若一個 tuple 直接或間接地含有任何可變的物件,它就不能當作鍵。你無法" "使用 list 當作鍵,因為 list 可以經由索引指派 (index assignment)、切片指派 " -"(slice assignment) 或是像 :meth:`!append` 和 :meth:`!extend` 等 method 被修" -"改。" +"(slice assignment) 或是像 :meth:`~list.append` 和 :meth:`~list.extend` 等" +"方法被修改。" #: ../../tutorial/datastructures.rst:506 msgid "" @@ -1392,7 +1388,7 @@ msgstr "" "相同,則比較下一項,以此類推,直到其中一個序列完全用完。如果被拿出來比較的兩" "項本身又是相同的序列類型,則詞典式比較會遞迴地執行。如果兩個序列所有的項目都" "相等,則此兩個序列被認為是相等的。如果其中一個序列是另一個的子序列,則較短的" -"那個序列為較小的序列。字串的詞典式順序使用 Unicode 的碼位 (code point) 編號來" +"那個序列為較小的序列。字串的詞典式順序使用 Unicode 的編碼位置 (code point) 編號來" "排序個別字元。以下是一些相同序列類型的比較: ::" #: ../../tutorial/datastructures.rst:716 diff --git a/tutorial/errors.po b/tutorial/errors.po index 55ad975a059..3a2853974f9 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-10-24 14:54+0800\n" @@ -879,7 +879,6 @@ msgstr "" "樣地,該例外會在 :keyword:`!finally` 子句執行後被重新引發。" #: ../../tutorial/errors.rst:419 -#, fuzzy msgid "" "If the :keyword:`!finally` clause executes " "a :keyword:`break`, :keyword:`continue` or :keyword:`return` statement, " @@ -888,7 +887,8 @@ msgid "" "it (see :pep:`765`)." msgstr "" "如果 :keyword:`!finally` 子句執行 :keyword:`break`、:keyword:`continue` " -"或 :keyword:`return` 陳述式,則例外不會被重新引發。" +"或 :keyword:`return` 陳述式,則例外不會被重新引發。這可能會令人困惑,因此不建議這麼做。" +"從 3.14 版本開始,編譯器會為此發出 :exc:`SyntaxWarning`\\ (詳見 :pep:`765`)。" #: ../../tutorial/errors.rst:425 msgid "" @@ -902,7 +902,6 @@ msgstr "" "break`、:keyword:`!continue` 或 :keyword:`!return` 陳述式之前先執行。" #: ../../tutorial/errors.rst:431 -#, fuzzy msgid "" "If a :keyword:`!finally` clause includes a :keyword:`!return` statement, the " "returned value will be the one from the :keyword:`!finally` " @@ -913,7 +912,8 @@ msgid "" msgstr "" "如果 :keyword:`!finally` 子句中包含 :keyword:`!return` 陳述式,則回傳值會是來" "自 :keyword:`!finally` 子句的 :keyword:`!return` 陳述式的回傳值,而不是來" -"自 :keyword:`!try` 子句的 :keyword:`!return` 陳述式的回傳值。" +"自 :keyword:`!try` 子句的 :keyword:`!return` 陳述式的回傳值。這可能會令人困惑,因此不建議這麼做。" +"從 3.14 版本開始,編譯器會為此發出 :exc:`SyntaxWarning`\\ (詳見 :pep:`765`)。" #: ../../tutorial/errors.rst:439 msgid "For example::" diff --git a/tutorial/floatingpoint.po b/tutorial/floatingpoint.po index 32a61b128d3..9d1ea9a51cb 100644 --- a/tutorial/floatingpoint.po +++ b/tutorial/floatingpoint.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +8,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-06-22 14:43+0800\n" diff --git a/tutorial/index.po b/tutorial/index.po index 7203f4c06c3..be7fc43431d 100644 --- a/tutorial/index.po +++ b/tutorial/index.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ # woodrow-shen , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: 2018-06-17 11:39+0000\n" diff --git a/tutorial/inputoutput.po b/tutorial/inputoutput.po index 89cf3f6aec0..a0b49f48697 100644 --- a/tutorial/inputoutput.po +++ b/tutorial/inputoutput.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Steven Hsu , 2021-2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-10-05 10:26+0800\n" @@ -206,7 +206,6 @@ msgstr "" "\"(32.5, 40000, ('spam', 'eggs'))\"" #: ../../tutorial/inputoutput.rst:98 -#, fuzzy msgid "" "The :mod:`string` module contains support for a simple templating approach " "based upon regular expressions, via :class:`string.Template`. This offers " @@ -214,9 +213,10 @@ msgid "" "``$x`` and replacing them with values from a dictionary. This syntax is easy " "to use, although it offers much less control for formatting." msgstr "" -":mod:`string` 模組包含一個 :class:`~string.Template` class(類別),提供了將" -"值替代為字串的另一種方法。該方法使用 ``$x`` 佔位符號,並以 dictionary 的值進" -"行取代,但對格式的控制明顯較少。" +":mod:`string` 模組包含一個基於正規表示式 (regular expressions)、透過 :class:`string.Template` 的" +"簡單模板化手段的支援。這提供了另一種將值替換到字串中的方式," +"使用像 ``$x`` 這樣的佔位符號,並用來自字典的值取代它們。這種語法較易用,但" +"它在格式化方面提供的控制較少。" #: ../../tutorial/inputoutput.rst:115 msgid "Formatted String Literals" diff --git a/tutorial/interactive.po b/tutorial/interactive.po index fc1e052dc37..95ce80bd1e8 100644 --- a/tutorial/interactive.po +++ b/tutorial/interactive.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2021-06-28 20:45+0800\n" diff --git a/tutorial/interpreter.po b/tutorial/interpreter.po index f368e68f6b8..a1a06fd25c4 100644 --- a/tutorial/interpreter.po +++ b/tutorial/interpreter.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Liang-Bo Wang , 2015-2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2021-05-18 16:28+0800\n" @@ -40,9 +39,8 @@ msgstr "" "shell 的搜尋路徑中就可以透過輸入指令來啟動它:" #: ../../tutorial/interpreter.rst:17 -#, fuzzy msgid "python3.14" -msgstr "python3.13" +msgstr "python3.14" #: ../../tutorial/interpreter.rst:21 msgid "" @@ -191,7 +189,6 @@ msgstr "" "符: ::" #: ../../tutorial/interpreter.rst:98 -#, fuzzy msgid "" "$ python3.14\n" "Python 3.14 (default, April 4 2024, 09:25:04)\n" @@ -200,8 +197,8 @@ msgid "" "information.\n" ">>>" msgstr "" -"$ python3.13\n" -"Python 3.13 (default, April 4 2023, 09:25:04)\n" +"$ python3.14\n" +"Python 3.14 (default, April 4 2024, 09:25:04)\n" "[GCC 10.2.0] on linux\n" "Type \"help\", \"copyright\", \"credits\" or \"license\" for more " "information.\n" diff --git a/tutorial/introduction.po b/tutorial/introduction.po index c583ccf3ce7..0867c7836f0 100644 --- a/tutorial/introduction.po +++ b/tutorial/introduction.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # Steven Hsu , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-10-16 03:20+0800\n" @@ -935,13 +935,12 @@ msgstr "" "[1, 8, 27, 64, 125]" #: ../../tutorial/introduction.rst:422 -#, fuzzy msgid "" "You can also add new items at the end of the list, by using " "the :meth:`list.append` *method* (we will see more about methods later)::" msgstr "" -"你也可以在 list 的最後加入新元素,透過使用 :meth:`!list.append` *方法* " -"(method)(我們稍後會看到更多方法的說明): ::" +"你也可以在 list 的最後加入新元素,透過使用 :meth:`list.append` *方法*\\ " +"(我們稍後會看到更多方法的說明): ::" #: ../../tutorial/introduction.rst:425 msgid "" diff --git a/tutorial/modules.po b/tutorial/modules.po index e993181e243..1d12aaf2539 100644 --- a/tutorial/modules.po +++ b/tutorial/modules.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +8,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-07-22 00:17+0000\n" "PO-Revision-Date: 2022-10-23 20:30+0800\n" diff --git a/tutorial/stdlib.po b/tutorial/stdlib.po index d1a6ab387e1..8b4cba6824b 100644 --- a/tutorial/stdlib.po +++ b/tutorial/stdlib.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -11,7 +11,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-01-31 18:14+0800\n" @@ -40,7 +40,6 @@ msgid "" msgstr ":mod:`os` 模組提供了數十個與作業系統溝通的函式: ::" #: ../../tutorial/stdlib.rst:16 -#, fuzzy msgid "" ">>> import os\n" ">>> os.getcwd() # Return the current working directory\n" @@ -51,7 +50,7 @@ msgid "" msgstr "" ">>> import os\n" ">>> os.getcwd() # 回傳目前的工作目錄\n" -"'C:\\\\Python313'\n" +"'C:\\\\Python314'\n" ">>> os.chdir('/server/accesslogs') # 改變目前的工作目錄\n" ">>> os.system('mkdir today') # 在系統 shell 中執行 mkdir 指令\n" "0" diff --git a/tutorial/stdlib2.po b/tutorial/stdlib2.po index eae09b2bd50..4025feca112 100644 --- a/tutorial/stdlib2.po +++ b/tutorial/stdlib2.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2021-06-19 14:24+0800\n" @@ -547,7 +547,6 @@ msgstr "" "昂貴的物件: ::" #: ../../tutorial/stdlib2.rst:263 -#, fuzzy msgid "" ">>> import weakref, gc\n" ">>> class A:\n" @@ -591,7 +590,7 @@ msgstr "" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " d['primary'] # 項目被自動移除\n" -" File \"C:/python313/lib/weakref.py\", line 46, in __getitem__\n" +" File \"C:/python314/lib/weakref.py\", line 46, in __getitem__\n" " o = self.data[key]()\n" "KeyError: 'primary'" diff --git a/tutorial/venv.po b/tutorial/venv.po index 408392a22a2..f909335ba25 100644 --- a/tutorial/venv.po +++ b/tutorial/venv.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-10-16 05:35+0800\n" diff --git a/tutorial/whatnow.po b/tutorial/whatnow.po index fdb1401fbdc..f3bf2b44a0e 100644 --- a/tutorial/whatnow.po +++ b/tutorial/whatnow.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ # meowmeowcat , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-10-16 05:37+0800\n" diff --git a/using/android.po b/using/android.po index fca1fb0dfcb..15bf987a453 100644 --- a/using/android.po +++ b/using/android.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-06-27 07:36+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/using/cmdline.po b/using/cmdline.po index 6f2778acae6..915ab0b05ab 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -1,12 +1,12 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-09 05:11+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -526,8 +526,8 @@ msgstr "" #: ../../using/cmdline.rst:371 msgid "" "Turn on hash randomization. This option only has an effect if " -"the :envvar:`PYTHONHASHSEED` environment variable is set to ``0``, since " -"hash randomization is enabled by default." +"the :envvar:`PYTHONHASHSEED` environment variable is set to anything other " +"than ``random``, since hash randomization is enabled by default." msgstr "" #: ../../using/cmdline.rst:375 @@ -771,9 +771,8 @@ msgid "" msgstr "" #: ../../using/cmdline.rst:548 -#, fuzzy msgid "See also :envvar:`PYTHONPROFILEIMPORTTIME`." -msgstr "另請參閱 :envvar:`PYTHONNOUSERSITE`。" +msgstr "另請參閱 :envvar:`PYTHONPROFILEIMPORTTIME`。" #: ../../using/cmdline.rst:554 msgid "" @@ -1559,9 +1558,8 @@ msgid "" msgstr "" #: ../../using/cmdline.rst:1221 -#, fuzzy msgid "See also the :option:`-X disable_remote_debug` command-line option." -msgstr "另請參閱 :option:`-X frozen_modules <-X>` 命令列選項。" +msgstr "另請參閱 :option:`-X disable_remote_debug` 命令列選項。" #: ../../using/cmdline.rst:1227 msgid "" @@ -1655,9 +1653,8 @@ msgid "" msgstr "" #: ../../using/cmdline.rst:1318 -#, fuzzy msgid "See also the :option:`-X tlbc <-X>` command-line option." -msgstr "另請參閱 :option:`-X cpu_count <-X>` 命令列選項。" +msgstr "另請參閱 :option:`-X tlbc <-X>` 命令列選項。" #: ../../using/cmdline.rst:1323 msgid "Debug-mode variables" @@ -1708,6 +1705,3 @@ msgstr "" #: ../../using/cmdline.rst:1357 msgid "Needs Python configured with the :option:`--with-pydebug` build option." msgstr "" - -#~ msgid "Options you shouldn't use" -#~ msgstr "你不該使用的選項" diff --git a/using/configure.po b/using/configure.po index 2b3d469d4ab..4ef6c36bae6 100644 --- a/using/configure.po +++ b/using/configure.po @@ -1,9 +1,9 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -55,12 +55,11 @@ msgid "Support for threads." msgstr "thread 的支援。" #: ../../using/configure.rst:25 -#, fuzzy msgid "" "OpenSSL 1.1.1 is the minimum version and OpenSSL 3.0.16 is the recommended " "minimum version for the :mod:`ssl` and :mod:`hashlib` extension modules." msgstr "" -"OpenSSL 1.1.1 是最低版本,OpenSSL 3.0.9 是 :mod:`ssl` 與 :mod:`hashlib` 擴充" +"OpenSSL 1.1.1 是最低版本,OpenSSL 3.0.16 是 :mod:`ssl` 與 :mod:`hashlib` 擴充" "模組的建議最低版本。" #: ../../using/configure.rst:28 @@ -121,9 +120,8 @@ msgid "Autoconf 2.71, aclocal 1.16.5 and SQLite 3.15.2 are now required." msgstr "" #: ../../using/configure.rst:64 -#, fuzzy msgid "Autoconf 2.72 is now required." -msgstr "Tcl/Tk version 8.3.1 現在是必要的。" +msgstr "Autoconf 2.72 現在是必要的。" #: ../../using/configure.rst:67 msgid "" @@ -1794,9 +1792,8 @@ msgid "``TESTTIMEOUT``: timeout in seconds (default: 10 minutes)." msgstr "``TESTTIMEOUT``:秒數表示的超時設定(預設值:10 分鐘)。" #: ../../using/configure.rst:1220 -#, fuzzy msgid "make ci" -msgstr "make" +msgstr "make ci" #: ../../using/configure.rst:1222 msgid "" @@ -2202,13 +2199,3 @@ msgid "" "clean build. **Use with care**, as it will delete all files not checked into " "Git, including your new, uncommitted work." msgstr "" - -#~ msgid "``node``: NODERAWFS and pthread support." -#~ msgstr "``node``:對 NODERAWFS 和 pthread 支援。" - -#~ msgid "``build_wasm`` (configured with ``--with-emscripten-target``)" -#~ msgstr "``build_wasm``\\ (使用 ``--with-emscripten-target`` 配置)" - -#~ msgid "" -#~ "Enable AddressSanitizer memory error detector, ``asan`` (default is no)." -#~ msgstr "啟用 AddressSanitizer 記憶體錯誤偵測器 ``asan``\\ (預設不啟用)。" diff --git a/using/editors.po b/using/editors.po index 7aca16ba10d..9c366a4cd1b 100644 --- a/using/editors.po +++ b/using/editors.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-13 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/using/index.po b/using/index.po index f702f15a0e0..5bd7a135967 100644 --- a/using/index.po +++ b/using/index.po @@ -1,12 +1,11 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-07-06 22:21+0800\n" diff --git a/using/ios.po b/using/ios.po index 313a255fe91..ec5df85db60 100644 --- a/using/ios.po +++ b/using/ios.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/using/mac.po b/using/mac.po index a05f820a6a0..9bd187a3112 100644 --- a/using/mac.po +++ b/using/mac.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +8,7 @@ # Matt Wang , 2022, 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-08-31 22:26+0800\n" diff --git a/using/unix.po b/using/unix.po index e33e46374aa..cc436ee93e8 100644 --- a/using/unix.po +++ b/using/unix.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Matt Wang , 2022-2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-03-20 00:14+0000\n" "PO-Revision-Date: 2023-03-27 12:40+0800\n" diff --git a/using/windows.po b/using/windows.po index 9f0cda55362..d06767b1e60 100644 --- a/using/windows.po +++ b/using/windows.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" @@ -91,12 +91,11 @@ msgstr "" #: ../../using/windows.rst:64 msgid "Python Install Manager" -msgstr "" +msgstr "Python 安裝管理員" #: ../../using/windows.rst:67 -#, fuzzy msgid "Installation" -msgstr "安裝步驟" +msgstr "安裝" #: ../../using/windows.rst:69 msgid "" @@ -161,7 +160,7 @@ msgstr "" #: ../../using/windows.rst:107 msgid "Basic Use" -msgstr "" +msgstr "基本使用" #: ../../using/windows.rst:109 msgid "" @@ -220,6 +219,12 @@ msgid "" "$> py -m this\n" "..." msgstr "" +"$> py\n" +"...\n" +"$> python my-script.py\n" +"...\n" +"$> py -m this\n" +"..." #: ../../using/windows.rst:149 msgid "" @@ -244,6 +249,8 @@ msgid "" "$> py -V:3.14 ...\n" "$> py -V:3-arm64 ..." msgstr "" +"$> py -V:3.14 ...\n" +"$> py -V:3-arm64 ..." #: ../../using/windows.rst:165 msgid "" @@ -259,6 +266,8 @@ msgid "" "$> py -V:Distributor\\1.0 ...\n" "$> py -V:distrib/ ..." msgstr "" +"$> py -V:Distributor\\1.0 ...\n" +"$> py -V:distrib/ ..." #: ../../using/windows.rst:176 msgid "" @@ -305,6 +314,9 @@ msgid "" "$> py help install\n" "$> py install /?" msgstr "" +"$> py help\n" +"$> py help install\n" +"$> py install /?" #: ../../using/windows.rst:210 msgid "" @@ -324,13 +336,15 @@ msgstr "" #: ../../using/windows.rst:222 msgid "Listing Runtimes" -msgstr "" +msgstr "列出 Runtimes" #: ../../using/windows.rst:224 msgid "" "$> py list [-f=|--format=] [-1|--one] [--online|-s=|--source=] " "[...]" msgstr "" +"$> py list [-f=|--format=] [-1|--one] [--online|-s=|--source=] " +"[...]" #: ../../using/windows.rst:228 msgid "" @@ -376,7 +390,7 @@ msgstr "" #: ../../using/windows.rst:253 msgid "$> py list --online 3.14" -msgstr "" +msgstr "$> py list --online 3.14" #: ../../using/windows.rst:257 msgid "" @@ -386,15 +400,16 @@ msgid "" msgstr "" #: ../../using/windows.rst:263 -#, fuzzy msgid "Installing Runtimes" -msgstr "安裝步驟" +msgstr "安裝 Runtimes" #: ../../using/windows.rst:265 msgid "" "$> py install [-s=|--source=] [-f|--force] [-u|--update] [--dry-run] " "[...]" msgstr "" +"$> py install [-s=|--source=] [-f|--force] [-u|--update] [--dry-run] " +"[...]" #: ../../using/windows.rst:269 msgid "" @@ -441,12 +456,11 @@ msgstr "" #: ../../using/windows.rst:294 msgid "$> py install ... [-t=|--target=] " -msgstr "" +msgstr "$> py install ... [-t=|--target=] " #: ../../using/windows.rst:302 -#, fuzzy msgid "Offline Installs" -msgstr "SimpleInstall" +msgstr "離線安裝" #: ../../using/windows.rst:304 msgid "" @@ -456,7 +470,7 @@ msgstr "" #: ../../using/windows.rst:307 msgid "$> py install --download= ... ..." -msgstr "" +msgstr "$> py install --download= ... ..." #: ../../using/windows.rst:311 msgid "" @@ -468,7 +482,7 @@ msgstr "" #: ../../using/windows.rst:316 msgid "$> py install --source=\"\\index.json\" ..." -msgstr "" +msgstr "$> py install --source=\"\\index.json\" ..." #: ../../using/windows.rst:320 msgid "" @@ -493,13 +507,12 @@ msgid "" msgstr "" #: ../../using/windows.rst:334 -#, fuzzy msgid "Uninstalling Runtimes" -msgstr "安裝步驟" +msgstr "解除安裝 Runtimes" #: ../../using/windows.rst:336 msgid "$> py uninstall [-y|--yes] ..." -msgstr "" +msgstr "$> py uninstall [-y|--yes] ..." #: ../../using/windows.rst:340 msgid "" @@ -536,9 +549,8 @@ msgid "" msgstr "" #: ../../using/windows.rst:365 -#, fuzzy msgid "Configuration" -msgstr "設定 Python" +msgstr "設定" #: ../../using/windows.rst:367 msgid "" @@ -755,28 +767,24 @@ msgid "" msgstr "" #: ../../using/windows.rst:478 -#, fuzzy msgid "``/usr/bin/env ``" -msgstr "``/usr/bin/env``" +msgstr "``/usr/bin/env ``" #: ../../using/windows.rst:479 -#, fuzzy msgid "``/usr/bin/env -S ``" -msgstr "``/usr/bin/env``" +msgstr "``/usr/bin/env -S ``" #: ../../using/windows.rst:480 -#, fuzzy msgid "``/usr/bin/``" -msgstr "``/usr/bin/env``" +msgstr "``/usr/bin/``" #: ../../using/windows.rst:481 -#, fuzzy msgid "``/usr/local/bin/``" -msgstr "``/usr/local/bin/python``" +msgstr "``/usr/local/bin/``" #: ../../using/windows.rst:482 msgid "````" -msgstr "" +msgstr "````" #: ../../using/windows.rst:484 ../../using/windows.rst:1754 msgid "For example, if the first line of your script starts with" @@ -848,9 +856,8 @@ msgid "" msgstr "" #: ../../using/windows.rst:545 -#, fuzzy msgid "Advanced Installation" -msgstr "安裝步驟" +msgstr "進階安裝" #: ../../using/windows.rst:547 msgid "" @@ -945,6 +952,10 @@ msgid "" "$> Get-AppxPackage PythonSoftwareFoundation.PythonManager | Remove-" "AppxPackage" msgstr "" +"$> Add-AppxPackage C:\\Downloads\\python-manager-25.0.msix\n" +"...\n" +"$> Get-AppxPackage PythonSoftwareFoundation.PythonManager | Remove-" +"AppxPackage" #: ../../using/windows.rst:608 msgid "" @@ -959,6 +970,8 @@ msgid "" "$> Add-AppxPackage -AppInstallerFile https://www.python.org/ftp/python/" "pymanager/pymanager.appinstaller" msgstr "" +"$> Add-AppxPackage -AppInstallerFile https://www.python.org/ftp/python/" +"pymanager/pymanager.appinstaller" #: ../../using/windows.rst:617 msgid "" @@ -1037,7 +1050,7 @@ msgstr "" #: ../../using/windows.rst:679 msgid "``base_config``" -msgstr "" +msgstr "``base_config``" #: ../../using/windows.rst:680 msgid "" @@ -1047,7 +1060,7 @@ msgstr "" #: ../../using/windows.rst:684 msgid "``user_config``" -msgstr "" +msgstr "``user_config``" #: ../../using/windows.rst:685 msgid "The second configuration file to read." @@ -1055,7 +1068,7 @@ msgstr "" #: ../../using/windows.rst:687 msgid "``additional_config``" -msgstr "" +msgstr "``additional_config``" #: ../../using/windows.rst:688 msgid "The third configuration file to read." @@ -1063,7 +1076,7 @@ msgstr "" #: ../../using/windows.rst:690 msgid "``registry_override_key``" -msgstr "" +msgstr "``registry_override_key``" #: ../../using/windows.rst:691 msgid "" @@ -1073,7 +1086,7 @@ msgstr "" #: ../../using/windows.rst:694 msgid "``bundled_dir``" -msgstr "" +msgstr "``bundled_dir``" #: ../../using/windows.rst:695 msgid "Read-only directory containing locally cached files." @@ -1081,7 +1094,7 @@ msgstr "" #: ../../using/windows.rst:697 msgid "``install.fallback_source``" -msgstr "" +msgstr "``install.fallback_source``" #: ../../using/windows.rst:698 msgid "" @@ -1090,7 +1103,7 @@ msgstr "" #: ../../using/windows.rst:700 msgid "``install.enable_shortcut_kinds``" -msgstr "" +msgstr "``install.enable_shortcut_kinds``" #: ../../using/windows.rst:701 msgid "" @@ -1100,7 +1113,7 @@ msgstr "" #: ../../using/windows.rst:704 msgid "``install.disable_shortcut_kinds``" -msgstr "" +msgstr "``install.disable_shortcut_kinds``" #: ../../using/windows.rst:705 msgid "" @@ -1111,7 +1124,7 @@ msgstr "" #: ../../using/windows.rst:709 msgid "``pep514_root``" -msgstr "" +msgstr "``pep514_root``" #: ../../using/windows.rst:710 msgid "" @@ -1121,7 +1134,7 @@ msgstr "" #: ../../using/windows.rst:713 msgid "``start_folder``" -msgstr "" +msgstr "``start_folder``" #: ../../using/windows.rst:714 msgid "" @@ -1131,7 +1144,7 @@ msgstr "" #: ../../using/windows.rst:718 msgid "``virtual_env``" -msgstr "" +msgstr "``virtual_env``" #: ../../using/windows.rst:719 msgid "" @@ -1141,7 +1154,7 @@ msgstr "" #: ../../using/windows.rst:723 msgid "``shebang_can_run_anything_silently``" -msgstr "" +msgstr "``shebang_can_run_anything_silently``" #: ../../using/windows.rst:724 msgid "" @@ -1177,6 +1190,9 @@ msgid "" "$> py install 3.14t-arm64\n" "$> py install 3.14t-32" msgstr "" +"$> py install 3.14t\n" +"$> py install 3.14t-arm64\n" +"$> py install 3.14t-32" #: ../../using/windows.rst:748 msgid "" @@ -1340,7 +1356,7 @@ msgstr "" #: ../../using/windows.rst:863 msgid "$> py install 3.14-embed --target=runtime" -msgstr "" +msgstr "$> py install 3.14-embed --target=runtime" #: ../../using/windows.rst:867 msgid "" diff --git a/whatsnew/2.0.po b/whatsnew/2.0.po index 193cabf846b..d0ddd75b840 100644 --- a/whatsnew/2.0.po +++ b/whatsnew/2.0.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" diff --git a/whatsnew/2.1.po b/whatsnew/2.1.po index abd0fcd0697..ca603c6a983 100644 --- a/whatsnew/2.1.po +++ b/whatsnew/2.1.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" diff --git a/whatsnew/2.2.po b/whatsnew/2.2.po index 0dd37108b2e..da0fe0b2b44 100644 --- a/whatsnew/2.2.po +++ b/whatsnew/2.2.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index 48d3561118f..afd96e5a772 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" diff --git a/whatsnew/2.4.po b/whatsnew/2.4.po index 0d58bc66af2..779152ff689 100644 --- a/whatsnew/2.4.po +++ b/whatsnew/2.4.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" diff --git a/whatsnew/2.5.po b/whatsnew/2.5.po index dc93ea0d808..083bbdf74a2 100644 --- a/whatsnew/2.5.po +++ b/whatsnew/2.5.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" diff --git a/whatsnew/2.6.po b/whatsnew/2.6.po index 1713efdf72b..f5166820681 100644 --- a/whatsnew/2.6.po +++ b/whatsnew/2.6.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index 3beb33ffce8..b61992560bb 100644 --- a/whatsnew/2.7.po +++ b/whatsnew/2.7.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-04 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" diff --git a/whatsnew/3.0.po b/whatsnew/3.0.po index c97c812aa04..e23e8bd1141 100644 --- a/whatsnew/3.0.po +++ b/whatsnew/3.0.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" diff --git a/whatsnew/3.1.po b/whatsnew/3.1.po index ad08fd5c54b..d1e07a6740c 100644 --- a/whatsnew/3.1.po +++ b/whatsnew/3.1.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" @@ -30,7 +30,6 @@ msgid "Raymond Hettinger" msgstr "Raymond Hettinger" #: ../../whatsnew/3.1.rst:49 -#, fuzzy msgid "" "This article explains the new features in Python 3.1, compared to 3.0. " "Python 3.1 was released on June 27, 2009." @@ -137,6 +136,14 @@ msgid "" ">>> format(Decimal('1234567.89'), ',f')\n" "'1,234,567.89'" msgstr "" +">>> format(1234567, ',d')\n" +"'1,234,567'\n" +">>> format(1234567.89, ',.2f')\n" +"'1,234,567.89'\n" +">>> format(12345.6 + 8901234.12j, ',f')\n" +"'12,345.600000+8,901,234.120000j'\n" +">>> format(Decimal('1234567.89'), ',f')\n" +"'1,234,567.89'" #: ../../whatsnew/3.1.rst:123 msgid "" @@ -363,7 +370,7 @@ msgstr "(由 Eric Smith 和 Mark Dickinson 貢獻;:issue:`1580`)" #: ../../whatsnew/3.1.rst:247 msgid "New, Improved, and Deprecated Modules" -msgstr "" +msgstr "新增、改進和棄用的模組" #: ../../whatsnew/3.1.rst:249 msgid "" @@ -406,6 +413,9 @@ msgid "" ">>> with gzip.GzipFile(filename, \"wb\") as f:\n" "... f.write(b\"xxx\")" msgstr "" +">>> # 在寫入後自動關閉檔案\n" +">>> with gzip.GzipFile(filename, \"wb\") as f:\n" +"... f.write(b\"xxx\")" #: ../../whatsnew/3.1.rst:270 msgid "(Contributed by Antoine Pitrou.)" @@ -516,6 +526,8 @@ msgid "" "The :func:`re.sub`, :func:`re.subn` and :func:`re.split` functions now " "accept a flags parameter." msgstr "" +"The :func:`re.sub`、:func:`re.subn` 和 :func:`re.split` 函式現在接受一個 " +"flags 參數。" #: ../../whatsnew/3.1.rst:328 msgid "(Contributed by Gregory Smith.)" @@ -572,6 +584,8 @@ msgid "" "(Suggested by Antoine Pitrou and Jesse Noller. Implemented by Jack " "Diederich; :issue:`5228`.)" msgstr "" +"(由 Antoine Pitrou 和 Jesse Noller 建議。由 Jack Diederich 實" +"作;:issue:`5228`。)" #: ../../whatsnew/3.1.rst:356 msgid "" @@ -649,6 +663,8 @@ msgid "" "The :mod:`io` module has three new constants for the :meth:`~io.IOBase.seek` " "method: :data:`~os.SEEK_SET`, :data:`~os.SEEK_CUR`, and :data:`~os.SEEK_END`." msgstr "" +"The :mod:`io` 模組為 :meth:`~io.IOBase.seek` 方法新增了三個常" +"數::data:`~os.SEEK_SET`、:data:`~os.SEEK_CUR` 和 :data:`~os.SEEK_END`。" #: ../../whatsnew/3.1.rst:399 msgid "The :data:`sys.version_info` tuple is now a named tuple::" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index 9c18f07e869..7b0820cb3a7 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-06-26 03:02+0800\n" @@ -1286,7 +1286,6 @@ msgid "PEP 604: New Type Union Operator" msgstr "PEP 604:新型聯集運算子" #: ../../whatsnew/3.10.rst:724 -#, fuzzy msgid "" "A new type union operator was introduced which enables the syntax ``X | Y``. " "This provides a cleaner way of expressing 'either type X or type Y' instead " @@ -1294,16 +1293,15 @@ msgid "" msgstr "" "引入了一種新的聯集運算子,該運算子啟用像是 ``X | Y`` 的語法。這提供了一種在型" "別提示中更清晰的方式來表達「型別 X 或型別 Y」,來取代使" -"用 :data:`typing.Union`。" +"用 :class:`typing.Union`。" #: ../../whatsnew/3.10.rst:728 -#, fuzzy msgid "" "In previous versions of Python, to apply a type hint for functions accepting " "arguments of multiple types, :class:`typing.Union` was used::" msgstr "" -"在以前版本的 Python 中,要使用接受多種型別參數之型別提示的函式,要使" -"用 :data:`typing.Union`: ::" +"在以前版本的 Python 中,要使用接受多種型別之引數的型別提示的函式,要使" +"用 :class:`typing.Union`: ::" #: ../../whatsnew/3.10.rst:731 msgid "" @@ -4643,7 +4641,7 @@ msgstr "" #: ../../whatsnew/3.10.rst:2329 msgid "Notable security feature in 3.10.7" -msgstr "" +msgstr "Python 3.10.7 中顯著的安全性功能" #: ../../whatsnew/3.10.rst:2331 msgid "" @@ -4660,7 +4658,7 @@ msgstr "" #: ../../whatsnew/3.10.rst:2342 msgid "Notable security feature in 3.10.8" -msgstr "" +msgstr "Python 3.10.8 中顯著的安全性功能" #: ../../whatsnew/3.10.rst:2344 msgid "" diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index 2bf66bb498f..71e9f4f35b7 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # Translators: # Matt Wang , 2022-2023 # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2023-05-28 18:21+0800\n" @@ -1277,13 +1277,12 @@ msgid "functools" msgstr "functools" #: ../../whatsnew/3.11.rst:743 -#, fuzzy msgid "" ":func:`functools.singledispatch` now supports :class:`types.UnionType` " "and :class:`typing.Union` as annotations to the dispatch argument.::" msgstr "" -":func:`functools.singledispatch` 現在支援 :data:`types.UnionType` " -"和 :data:`typing.Union` 作為調度 (dispatch) 引數的標註。 ::" +":func:`functools.singledispatch` 現在支援 :class:`types.UnionType` " +"和 :class:`typing.Union` 作為調度 (dispatch) 引數的標註。 ::" #: ../../whatsnew/3.11.rst:746 msgid "" @@ -1388,7 +1387,7 @@ msgstr "" #: ../../whatsnew/3.11.rst:810 msgid "IDLE and idlelib" -msgstr "IDLE 與 idlelib" +msgstr "IDLE 和 idlelib" #: ../../whatsnew/3.11.rst:812 msgid "" @@ -1604,7 +1603,7 @@ msgid "" "+``, ``{m,n}+``) are now supported in regular expressions. (Contributed by " "Jeffrey C. Jacobs and Serhiy Storchaka in :issue:`433030`.)" msgstr "" -"現在規則運算式 (regular expression) 是有支援原子性群組 (atomic grouping) " +"現在正規表示式 (regular expression) 是有支援原子性群組 (atomic grouping) " "(``(?>...)``) 和佔有性量詞 (possessive quantifier) (``*+``, ``++``, ``?+``, " "``{m,n}+``) 的。(由 Jeffrey C. Jacobs 和 Serhiy Storchaka " "在 :issue:`433030` 中貢獻。)" @@ -2241,13 +2240,12 @@ msgstr "" "於 :gh:`68264` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1294 -#, fuzzy msgid "" "Resizing lists is streamlined for the common case, speeding " "up :meth:`list.append` by ≈15% and simple :term:`list comprehension`\\s by " "up to 20-30% (Contributed by Dennis Sweeney in :gh:`91165`.)" msgstr "" -"調整 list 大小在常見情況下增進了效能,為 :meth:`!list.append` 加快了約 15% 並" +"調整 list 大小在常見情況下增進了效能,為 :meth:`list.append` 加快了約 15% 並" "為簡單的 :term:`list comprehension` 加快了高達 20-30%(由 Dennis Sweeney " "在 :gh:`91165` 中貢獻。)" @@ -3149,9 +3147,8 @@ msgid ":opcode:`!SETUP_ASYNC_WITH`" msgstr ":opcode:`!SETUP_ASYNC_WITH`" #: ../../whatsnew/3.11.rst:1673 -#, fuzzy msgid ":opcode:`!BEFORE_WITH`" -msgstr ":opcode:`BEFORE_WITH`" +msgstr ":opcode:`!BEFORE_WITH`" #: ../../whatsnew/3.11.rst:1673 msgid ":keyword:`with` block setup" @@ -3499,7 +3496,7 @@ msgid "" "for syntax violating these rules. (Contributed by Serhiy Storchaka " "in :gh:`91760`.)" msgstr "" -"現在將對\\ :ref:`規則運算式 `\\ 中的數值群組參照 (numerical group " +"現在將對\\ :ref:`正規表示式 `\\ 中的數值群組參照 (numerical group " "references) 和群組名稱套用更嚴格的規則。現在只接受 ASCII 數字序列作為數值參" "照,並且 :class:`bytes` 模式 (pattern) 的群組名稱和替換字串中只能包含 ASCII " "字母、數字和底線。目前,會針對違反這些規則的語法發出棄用警告。(由 Serhiy " @@ -4223,8 +4220,8 @@ msgid "" "been deprecated since Python 3.6. (Contributed by Serhiy Storchaka " "in :issue:`47066`.)" msgstr "" -"在 :mod:`re` :ref:`re-syntax` 中,全域行內旗標(例如 ``(?i)``)現在只能在規則" -"運算式的開頭使用。自 Python 3.6 以來,在其他地方使用它們已被棄用。(由 " +"在 :mod:`re` :ref:`re-syntax` 中,全域行內旗標(例如 ``(?i)``)現在只能在正規" +"表示式的開頭使用。自 Python 3.6 以來,在其他地方使用它們已被棄用。(由 " "Serhiy Storchaka 在 :issue:`47066` 中貢獻。)" #: ../../whatsnew/3.11.rst:2106 diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index a590c98dfcc..94467dfda20 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -400,6 +400,7 @@ msgid "" "(PEP written by Eric Traut. Implementation by Jelle Zijlstra, Eric Traut, " "and others in :gh:`103764`.)" msgstr "" +"(PEP 由 Eric Traut 撰寫。由 Jelle Zijlstra、Eric Traut 和其他人在 :gh:`103764` 中實作。)" #: ../../whatsnew/3.12.rst:245 msgid "PEP 701: Syntactic formalization of f-strings" @@ -1811,12 +1812,11 @@ msgstr "" "於 :gh:`103497` 中貢獻。)" #: ../../whatsnew/3.12.rst:1134 -#, fuzzy msgid "" "Add the ``RETURN_CONST`` instruction. (Contributed by Wenyang Wang " "in :gh:`101632`.)" msgstr "" -"新增 :opcode:`RETURN_CONST` 指令。(由 Wenyang Wang 於 :gh:`101632` 中貢" +"新增 ``RETURN_CONST`` 指令。(由 Wenyang Wang 於 :gh:`101632` 中貢" "獻。)" #: ../../whatsnew/3.12.rst:1137 @@ -1904,21 +1904,19 @@ msgstr ":mod:`asyncio`:" #: ../../whatsnew/3.12.rst:1173 #: ../../deprecations/pending-removal-in-3.14.rst:24 -#, fuzzy msgid "" "The child watcher classes :class:`!asyncio.MultiLoopChildWatcher`, :class:`!" "asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` " "and :class:`!asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類" -"別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " -"和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" -"獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`!" +"asyncio.MultiLoopChildWatcher`、:class:`!asyncio.FastChildWatcher`、:class:`!" +"asyncio.AbstractChildWatcher` 和 :class:`!asyncio.SafeChildWatcher`。 (由 " +"Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../whatsnew/3.12.rst:1179 #: ../../deprecations/pending-removal-in-3.14.rst:30 -#, fuzzy msgid "" ":func:`!asyncio.set_child_watcher`, :func:`!" "asyncio.get_child_watcher`, :meth:`!" @@ -1926,9 +1924,11 @@ msgid "" "asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated and will " "be removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " -"Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`!asyncio.set_child_watcher`、:func:`!" +"asyncio.get_child_watcher`、:meth:`!" +"asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`!" +"asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python " +"3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../whatsnew/3.12.rst:1185 #: ../../deprecations/pending-removal-in-3.14.rst:36 @@ -1955,7 +1955,6 @@ msgstr "" "Roshan 於 :gh:`103636` 貢獻。)" #: ../../whatsnew/3.12.rst:1194 -#, fuzzy msgid "" ":mod:`collections.abc`: Deprecated :class:`!collections.abc.ByteString`. " "Prefer :class:`Sequence` or :class:`collections.abc.Buffer`. For use in " @@ -1963,11 +1962,10 @@ msgid "" "or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " "in :gh:`91896`.)" msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" -"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" -"時,請改用聯集,如 ``bytes | bytearray``," -"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" -"獻。)" +":mod:`collections.abc`:已棄用 :class:`!collections.abc.ByteString`。請改" +"用 :class:`Sequence` 或 :class:`collections.abc.Buffer`。在 typing 中使用時," +"請改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。" +"(由 Shantanu Jain 於 :gh:`91896` 貢獻。)" #: ../../whatsnew/3.12.rst:1199 msgid "" @@ -2053,14 +2051,13 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1240 -#, fuzzy msgid "" ":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " "are deprecated and will be removed in Python 3.14; " "use :func:`importlib.util.find_spec` instead. (Contributed by Nikita Sobolev " "in :gh:`97850`.)" msgstr "" -":mod:`pkgutil`::func:`pkgutil.find_loader` 和 :func:`pkgutil.get_loader` 已" +":mod:`pkgutil`::func:`!pkgutil.find_loader` 和 :func:`!pkgutil.get_loader` 已" "被棄用並將在 Python 3.14 中移除;請改用 :func:`importlib.util.find_spec`。" "(由 Nikita Sobolev 於 :gh:`97850` 中貢獻。)" @@ -2170,14 +2167,14 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1304 -#, fuzzy msgid "" ":class:`!typing.ByteString`, deprecated since Python 3.9, now causes " "a :exc:`DeprecationWarning` to be emitted when it is used. (Contributed by " "Alex Waygood in :gh:`91896`.)" msgstr "" -":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" -"使用時會發出 :exc:`DeprecationWarning`。" +"自 Python 3.9 起已被棄用的 :class:`!typing.ByteString` 現在在" +"使用時會發出 :exc:`DeprecationWarning`。(由 Alex Waygood 於 :gh:`91896` " +"中貢獻。)" #: ../../whatsnew/3.12.rst:1308 msgid "" @@ -2233,9 +2230,8 @@ msgstr "" "可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.13.rst:2 -#, fuzzy msgid "Pending removal in Python 3.13" -msgstr "Python 3.16 中待移除的項目" +msgstr "Python 3.13 中待移除的項目" #: ../../deprecations/pending-removal-in-3.13.rst:4 msgid "Modules (see :pep:`594`):" @@ -2409,9 +2405,8 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 #: ../../deprecations/pending-removal-in-3.14.rst:2 -#, fuzzy msgid "Pending removal in Python 3.14" -msgstr "Python 3.16 中待移除的項目" +msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/pending-removal-in-3.14.rst:9 msgid "" @@ -2423,7 +2418,6 @@ msgstr "" "於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" #: ../../deprecations/pending-removal-in-3.14.rst:41 -#, fuzzy msgid "" ":mod:`collections.abc`: Deprecated :class:`!collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -2431,7 +2425,7 @@ msgid "" "or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " "in :gh:`91896`.)" msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" +":mod:`collections.abc`:已棄用 :class:`!collections.abc.ByteString`。請改" "用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" "時,請改用聯集,如 ``bytes | bytearray``," "或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" @@ -2488,13 +2482,12 @@ msgstr "" "和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 -#, fuzzy msgid "" ":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" -":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " +":mod:`pkgutil`::func:`!pkgutil.find_loader` 和 :func:`!pkgutil.get_loader` " "現在會引發 :exc:`DeprecationWarning`;請改" "用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" "獻。)" @@ -2512,9 +2505,8 @@ msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" #: ../../deprecations/pending-removal-in-3.14.rst:93 -#, fuzzy msgid ":data:`!version` and :data:`!version_info`." -msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" +msgstr ":data:`!version` 和 :data:`!version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" @@ -2527,12 +2519,11 @@ msgstr "" "而不是 :class:`dict`。" #: ../../deprecations/pending-removal-in-3.14.rst:99 -#, fuzzy msgid "" ":mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." msgstr "" -":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" +":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`!typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" #: ../../deprecations/pending-removal-in-3.14.rst:102 @@ -2546,9 +2537,8 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:2 #: ../../deprecations/pending-removal-in-3.15.rst:2 -#, fuzzy msgid "Pending removal in Python 3.15" -msgstr "Python 3.16 中待移除的項目" +msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:4 #: ../../deprecations/pending-removal-in-3.16.rst:4 @@ -2709,7 +2699,6 @@ msgstr "" "於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:82 -#, fuzzy msgid "" "The undocumented keyword argument syntax for " "creating :class:`~typing.NamedTuple` classes (for example, ``Point = " @@ -2759,19 +2748,18 @@ msgstr "" "和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:107 -#, fuzzy msgid ":mod:`zipimport`:" -msgstr ":mod:`importlib`:" +msgstr ":mod:`zipimport`:" #: ../../deprecations/pending-removal-in-3.15.rst:109 -#, fuzzy msgid "" ":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python " "3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " "by Jiahao Li in :gh:`125746`.)" msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" -"用 :meth:`~zipimport.zipimporter.exec_module`。" +":meth:`~zipimport.zipimporter.load_module` 自 Python 3.10 被棄用。請改" +"用 :meth:`~zipimport.zipimporter.exec_module`。(由 Jiahao Li " +"於 :gh:`125746` 貢獻。)" #: ../../deprecations/c-api-pending-removal-in-3.16.rst:2 #: ../../deprecations/pending-removal-in-3.16.rst:2 @@ -2804,13 +2792,12 @@ msgstr "" "來取代 Unicode 字元。" #: ../../deprecations/pending-removal-in-3.16.rst:21 -#, fuzzy msgid "" ":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " "Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" -":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" +":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除;請改" "用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " "於 :gh:`122875` 貢獻。)" @@ -2819,40 +2806,44 @@ msgid "" ":mod:`asyncio` policy system is deprecated and will be removed in Python " "3.16. In particular, the following classes and functions are deprecated:" msgstr "" +":mod:`asyncio` 策略系統已被棄用並將在 Python 3.16 中移除。特別是以下類別和函" +"式已被棄用:" #: ../../deprecations/pending-removal-in-3.16.rst:29 msgid ":class:`asyncio.AbstractEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.AbstractEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:30 msgid ":class:`asyncio.DefaultEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.DefaultEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:31 msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.WindowsSelectorEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:32 msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.WindowsProactorEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:33 msgid ":func:`asyncio.get_event_loop_policy`" -msgstr "" +msgstr ":func:`asyncio.get_event_loop_policy`" #: ../../deprecations/pending-removal-in-3.16.rst:34 msgid ":func:`asyncio.set_event_loop_policy`" -msgstr "" +msgstr ":func:`asyncio.set_event_loop_policy`" #: ../../deprecations/pending-removal-in-3.16.rst:36 msgid "" "Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " "*loop_factory* to use the desired event loop implementation." msgstr "" +"使用者應該使用 :func:`asyncio.run` 或 :class:`asyncio.Runner` 搭配 " +"*loop_factory* 來使用所需的事件迴圈實作。" #: ../../deprecations/pending-removal-in-3.16.rst:39 msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" -msgstr "" +msgstr "例如在 Windows 上使用 :class:`asyncio.SelectorEventLoop`: ::" #: ../../deprecations/pending-removal-in-3.16.rst:41 msgid "" @@ -2863,11 +2854,16 @@ msgid "" "\n" "asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" msgstr "" +"import asyncio\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" #: ../../deprecations/pending-removal-in-3.16.rst:48 -#, fuzzy msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" -msgstr "(由 Pradyun Gedam 於 :gh:`95299` 中貢獻。)" +msgstr "(由 Kumar Aditya 於 :gh:`127949` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:50 #: ../../deprecations/pending-removal-in-future.rst:16 @@ -2888,9 +2884,8 @@ msgstr "" "``~int(x)`` (``~int(x)``)。" #: ../../deprecations/pending-removal-in-3.16.rst:59 -#, fuzzy msgid ":mod:`functools`:" -msgstr ":mod:`os`:" +msgstr ":mod:`functools`:" #: ../../deprecations/pending-removal-in-3.16.rst:61 msgid "" @@ -2898,11 +2893,12 @@ msgid "" "*function* or *sequence* as keyword arguments has been deprecated since " "Python 3.14." msgstr "" +"自 Python 3.14 起,使用 *function* 或 *sequence* 關鍵字引數呼" +"叫 :func:`functools.reduce` 的 Python 實作已被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:64 -#, fuzzy msgid ":mod:`logging`:" -msgstr ":mod:`typing`:" +msgstr ":mod:`logging`:" #: ../../deprecations/pending-removal-in-3.16.rst:66 msgid "" @@ -2910,11 +2906,12 @@ msgid "" "and scheduled for removal in Python 3.16. Define handlers with the *stream* " "argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" msgstr "" +"對具有 *strm* 引數的自訂日誌記錄處理函式的支援已被棄用,並計劃在 Python 3.16 " +"中移除。請改用 *stream* 引數。(由 Mariusz Felisiak 於 :gh:`115032` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:70 -#, fuzzy msgid ":mod:`mimetypes`:" -msgstr ":mod:`types`:" +msgstr ":mod:`mimetypes`:" #: ../../deprecations/pending-removal-in-3.16.rst:72 msgid "" @@ -2923,6 +2920,9 @@ msgid "" "and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " "Kemenade in :gh:`75223`.)" msgstr "" +"有效的副檔名以 '.' 開頭或對 :meth:`mimetypes.MimeTypes.add_type` 為空字串。未" +"加點的副檔名已被棄用,並將在 Python 3.16 中引發 :exc:`ValueError`。(由 Hugo " +"van Kemenade 於 :gh:`75223` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:78 msgid ":mod:`shutil`:" @@ -2963,14 +2963,13 @@ msgstr "" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" #: ../../deprecations/pending-removal-in-3.16.rst:98 -#, fuzzy msgid "" "The :func:`!sysconfig.expand_makefile_vars` function has been deprecated " "since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " "instead." msgstr "" -"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" -"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" +"自 Python 3.14 起,:func:`!sysconfig.expand_makefile_vars` 函式已被棄用。請改" +"用 :func:`sysconfig.get_paths` 的 ``vars`` 引數。" #: ../../deprecations/pending-removal-in-3.16.rst:102 msgid ":mod:`tarfile`:" @@ -2985,9 +2984,8 @@ msgstr "" "棄用。" #: ../../deprecations/pending-removal-in-3.17.rst:2 -#, fuzzy msgid "Pending removal in Python 3.17" -msgstr "Python 3.16 中待移除的項目" +msgstr "Python 3.17 中待移除的項目" #: ../../deprecations/pending-removal-in-3.17.rst:6 msgid "" @@ -2998,10 +2996,13 @@ msgid "" "helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " "of relying on private implementation details." msgstr "" +"在 Python 3.14 之前,舊式聯集是使用私有類別 ``typing._UnionGenericAlias`` 實" +"作的。這個類別不再被需要,但為了向後相容性而保留,並計劃將在 Python 3.17 中移" +"除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " +"和 :func:`typing.get_args`,或者依賴私有實作細節。" #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 -#, fuzzy msgid "Pending removal in future versions" msgstr "未來版本中的待移除項目" @@ -3012,25 +3013,25 @@ msgid "" msgstr "以下 API 將在未來被移除,雖然目前尚未安排移除日期。" #: ../../deprecations/pending-removal-in-future.rst:7 -#, fuzzy msgid ":mod:`argparse`:" -msgstr ":mod:`array`:" +msgstr ":mod:`argparse`:" #: ../../deprecations/pending-removal-in-future.rst:9 -#, fuzzy msgid "" "Nesting argument groups and nesting mutually exclusive groups are deprecated." -msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" +msgstr "巢狀引數群組和巢狀互斥群組已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:11 msgid "" "Passing the undocumented keyword argument *prefix_chars* " "to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." msgstr "" +"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞" +"給 :meth:`~argparse.ArgumentParser.add_argument_group` 的做法現在已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:14 msgid "The :class:`argparse.FileType` type converter is deprecated." -msgstr "" +msgstr ":class:`argparse.FileType` 型別轉換器已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:18 msgid "``bool(NotImplemented)``." @@ -3109,6 +3110,7 @@ msgid "" ":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " "(:gh:`133038`)" msgstr "" +":mod:`codecs`:請改用 :func:`open` 而非 :func:`codecs.open`。(:gh:`133038`)" #: ../../deprecations/pending-removal-in-future.rst:52 msgid "" @@ -3322,6 +3324,9 @@ msgid "" "this private class, a compatibility shim will be provided until at least " "Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" msgstr "" +"內部類別 ``typing._UnionGenericAlias`` 不再用於實作 :class:`typing.Union`。為" +"了保持與此私有類別使用者的相容性,直到至少 Python 3.17 都將提供一個相容性 " +"shim。(由 Jelle Zijlstra 於 :gh:`105499` 貢獻。)" #: ../../deprecations/pending-removal-in-future.rst:132 msgid "" @@ -3404,6 +3409,8 @@ msgid "" ":func:`sys._clear_type_cache` is deprecated: " "use :func:`sys._clear_internal_caches` instead." msgstr "" +":func:`sys._clear_type_cache` 已被棄用:請改" +"用 :func:`sys._clear_internal_caches`。" #: ../../whatsnew/3.12.rst:1357 ../../whatsnew/3.12.rst:2241 msgid "Removed" @@ -5229,6 +5236,10 @@ msgid "" "`__ can be used to " "get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." msgstr "" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" +"用 :c:func:`PyWeakref_GetRef`。可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.12 和更早版本取" +"得 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 msgid "" @@ -5250,6 +5261,9 @@ msgid "" "Note that some codecs (for example, \"base64\") may return a type other " "than :class:`str`, such as :class:`bytes`." msgstr "" +":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`;請注" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`str` 的型別,例" +"如 :class:`bytes`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid "" @@ -5263,18 +5277,21 @@ msgid "" "Note that some codecs (for example, \"base64\") may return a type other " "than :class:`bytes`, such as :class:`str`." msgstr "" +":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`;請注" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`bytes` 的型別,例" +"如 :class:`str`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 -#, fuzzy msgid "Python initialization functions, deprecated in Python 3.13:" -msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" +msgstr "Python 初始化函式,自 Python 3.13 起已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:24 -#, fuzzy msgid "" ":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " "` (:data:`sys.path`) instead." -msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" +msgstr "" +":c:func:`Py_GetPath`:請改用 :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:27 msgid "" @@ -5283,6 +5300,10 @@ msgid "" "Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) " "if :ref:`virtual environments ` need to be handled." msgstr "" +":c:func:`Py_GetPrefix`:請改用 :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`)。如果需要處理\\ :ref:`虛擬環境 " +"`,請改用 :c:func:`PyConfig_Get(\"prefix\") ` " +"(:data:`sys.prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:32 msgid "" @@ -5292,60 +5313,68 @@ msgid "" "(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " "be handled." msgstr "" +":c:func:`Py_GetExecPrefix`:請改" +"用 :c:func:`PyConfig_Get(\"base_exec_prefix\") ` " +"(:data:`sys.base_exec_prefix`)。如果需要處理\\ :ref:`虛擬環境 `,請" +"改用 :c:func:`PyConfig_Get(\"exec_prefix\") ` " +"(:data:`sys.exec_prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:38 -#, fuzzy msgid "" ":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." -msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" +msgstr "" +":c:func:`Py_GetProgramFullPath`:請改" +"用 :c:func:`PyConfig_Get(\"executable\") ` " +"(:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:41 -#, fuzzy msgid "" ":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." -msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" +msgstr "" +":c:func:`Py_GetProgramName`:請改用 :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:44 -#, fuzzy msgid "" ":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " "` or the :envvar:`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " -"或 :envvar:`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:func:`PyConfig_Get(\"home\") " +"` 或 :envvar:`PYTHONHOME` 環境變數。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:48 msgid "" "The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." msgstr "" +"`pythoncapi-compat 專案 `__ 可" +"以用來為 Python 3.13 和更早版本取得 :c:func:`PyConfig_Get`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:52 msgid "" "Functions to configure Python's initialization, deprecated in Python 3.11:" -msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" +msgstr "用於配置 Python 初始化的函式,自 Python 3.11 起已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:54 msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." -msgstr ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" +msgstr ":c:func:`!PySys_SetArgvEx()`:請改用 :c:member:`PyConfig.argv`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:56 msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." -msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" +msgstr ":c:func:`!PySys_SetArgv()`:請改用 :c:member:`PyConfig.argv`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:58 msgid "" ":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " "instead." msgstr "" -":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設" -"定。" +":c:func:`!Py_SetProgramName()`:請改用 :c:member:`PyConfig.program_name`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:60 msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." -msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" +msgstr ":c:func:`!Py_SetPythonHome()`:請改用 :c:member:`PyConfig.home`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:62 msgid "" @@ -5360,133 +5389,139 @@ msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used " "with :c:type:`PyConfig` instead." msgstr "" -":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" +"應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:68 msgid "Global configuration variables:" -msgstr "全域設定變數:" +msgstr "全域配置變數:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:70 -#, fuzzy msgid "" ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` " "or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." -msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" +msgstr "" +":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug` " +"或 :c:func:`PyConfig_Get(\"parser_debug\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:73 -#, fuzzy msgid "" ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` " "or :c:func:`PyConfig_Get(\"verbose\") ` instead." -msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" +msgstr "" +":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose` " +"或 :c:func:`PyConfig_Get(\"verbose\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:76 -#, fuzzy msgid "" ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` " "or :c:func:`PyConfig_Get(\"quiet\") ` instead." -msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" +msgstr "" +":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet` " +"或 :c:func:`PyConfig_Get(\"quiet\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:79 -#, fuzzy msgid "" ":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` " "or :c:func:`PyConfig_Get(\"interactive\") ` instead." -msgstr ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" +msgstr "" +":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive` " +"或 :c:func:`PyConfig_Get(\"interactive\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:82 -#, fuzzy msgid "" ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` " "or :c:func:`PyConfig_Get(\"inspect\") ` instead." -msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" +msgstr "" +":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect` " +"或 :c:func:`PyConfig_Get(\"inspect\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:85 -#, fuzzy msgid "" ":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " "or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." msgstr "" -":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" +":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level` " +"或 :c:func:`PyConfig_Get(\"optimization_level\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:88 -#, fuzzy msgid "" ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` " "or :c:func:`PyConfig_Get(\"site_import\") ` instead." -msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" +msgstr "" +":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import` " +"或 :c:func:`PyConfig_Get(\"site_import\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:91 -#, fuzzy msgid "" ":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " "or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." msgstr "" -":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" +":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning` " +"或 :c:func:`PyConfig_Get(\"bytes_warning\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:94 -#, fuzzy msgid "" ":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " "or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" -":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" +":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings` " +"或 :c:func:`PyConfig_Get(\"pathconfig_warnings\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:97 -#, fuzzy msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "or :c:func:`PyConfig_Get(\"use_environment\") ` instead." msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment`。" +"用 :c:member:`PyConfig.use_environment` " +"或 :c:func:`PyConfig_Get(\"use_environment\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:100 -#, fuzzy msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`:請改" -"用 :c:member:`PyConfig.write_bytecode`。" +"用 :c:member:`PyConfig.write_bytecode` " +"或 :c:func:`PyConfig_Get(\"write_bytecode\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:103 -#, fuzzy msgid "" ":c:var:`Py_NoUserSiteDirectory`: " "Use :c:member:`PyConfig.user_site_directory` " "or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." msgstr "" ":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory`。" +"用 :c:member:`PyConfig.user_site_directory` " +"或 :c:func:`PyConfig_Get(\"user_site_directory\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:106 -#, fuzzy msgid "" ":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " "or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." msgstr "" -":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio`。" +":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio` " +"或 :c:func:`PyConfig_Get(\"buffered_stdio\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:109 -#, fuzzy msgid "" ":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " "` instead." msgstr "" ":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " -"和 :c:member:`PyConfig.hash_seed`。" +"和 :c:member:`PyConfig.hash_seed` 或 :c:func:`PyConfig_Get(\"hash_seed\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:113 -#, fuzzy msgid "" ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` " "or :c:func:`PyConfig_Get(\"isolated\") ` instead." -msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" +msgstr "" +":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated` " +"或 :c:func:`PyConfig_Get(\"isolated\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:116 -#, fuzzy msgid "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: " "Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` " @@ -5494,58 +5529,59 @@ msgid "" "instead." msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" +"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding` " +"或 :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:119 -#, fuzzy msgid "" ":c:var:`Py_LegacyWindowsStdioFlag`: " "Use :c:member:`PyConfig.legacy_windows_stdio` " "or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`。" +"用 :c:member:`PyConfig.legacy_windows_stdio` " +"或 :c:func:`PyConfig_Get(\"legacy_windows_stdio\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:122 -#, fuzzy msgid "" ":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" "Py_HasFileSystemDefaultEncoding`: " "Use :c:member:`PyConfig.filesystem_encoding` " "or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncoding`、:c:var:`!" +"Py_HasFileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding` " +"或 :c:func:`PyConfig_Get(\"filesystem_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:125 -#, fuzzy msgid "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: " "Use :c:member:`PyConfig.filesystem_errors` " "or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors`。" +"用 :c:member:`PyConfig.filesystem_errors` " +"或 :c:func:`PyConfig_Get(\"filesystem_errors\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:128 -#, fuzzy msgid "" ":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` " "or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. " "(see :c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" -"見 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode` " +"或 :c:func:`PyConfig_Get(\"utf8_mode\") `。(請參" +"閱 :c:func:`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:133 -#, fuzzy msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used " "with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can " "be used to get these options at runtime." msgstr "" -":c:func:`Py_InitializeFromConfig` API 應改為與 :c:type:`PyConfig` 一起使用。" -"(由 Victor Stinner 於 :gh:`77782` 中貢獻。)" +"應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API 來設定" +"這些選項。或者也可以使用 :c:func:`PyConfig_Get` 在執行時取得這些選項。" #: ../../deprecations/c-api-pending-removal-in-3.16.rst:4 msgid "The bundled copy of ``libmpdec``." @@ -5711,68 +5747,3 @@ msgid "" msgstr "" "移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner " "於 :gh:`85858` 中貢獻。)" - -#~ msgid "Pending Removal in Python 3.13" -#~ msgstr "Python 3.13 中待移除的項目" - -#~ msgid "Pending Removal in Python 3.14" -#~ msgstr "Python 3.14 中待移除的項目" - -#~ msgid "Pending Removal in Python 3.15" -#~ msgstr "Python 3.15 中待移除的項目" - -#~ msgid "" -#~ ":mod:`urllib.request`: :class:`~urllib.request.URLopener` " -#~ "and :class:`~urllib.request.FancyURLopener` style of invoking requests is " -#~ "deprecated. Use newer :func:`~urllib.request.urlopen` functions and " -#~ "methods." -#~ msgstr "" -#~ ":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " -#~ "和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" -#~ "的 :func:`~urllib.request.urlopen` 函式和方法。" - -#~ msgid "" -#~ ":c:var:`!Py_FileSystemDefaultEncoding`: " -#~ "Use :c:member:`PyConfig.filesystem_encoding` instead." -#~ msgstr "" -#~ ":c:var:`!Py_FileSystemDefaultEncoding`:請改" -#~ "用 :c:member:`PyConfig.filesystem_encoding`。" - -#~ msgid "" -#~ ":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " -#~ "Use :c:func:`PyWeakref_GetRef` instead." -#~ msgstr "" -#~ ":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" -#~ "用 :c:func:`PyWeakref_GetRef`。" - -#~ msgid "Python initialization functions:" -#~ msgstr "Python 初始化函式:" - -#~ msgid "" -#~ ":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " -#~ "and :data:`sys.exec_prefix` instead." -#~ msgstr "" -#~ ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " -#~ "與 :data:`sys.exec_prefix`。" - -#~ msgid "" -#~ ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` " -#~ "and :data:`sys.prefix` instead." -#~ msgstr "" -#~ ":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " -#~ "與 :data:`sys.prefix`。" - -#~ msgid "" -#~ ":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` " -#~ "instead." -#~ msgstr "" -#~ ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" - -#~ msgid "" -#~ ":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` " -#~ "instead." -#~ msgstr "" -#~ ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" - -#~ msgid ":c:member:`!PyDictObject.ma_version_tag` member." -#~ msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index 3311852609f..a48e3cc151e 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -3053,9 +3053,8 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 #: ../../deprecations/pending-removal-in-3.14.rst:2 -#, fuzzy msgid "Pending removal in Python 3.14" -msgstr "Python 3.16 中待移除的項目" +msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/pending-removal-in-3.14.rst:4 msgid "" @@ -3109,20 +3108,18 @@ msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.14.rst:24 -#, fuzzy msgid "" "The child watcher classes :class:`!asyncio.MultiLoopChildWatcher`, :class:`!" "asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` " "and :class:`!asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類" -"別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " -"和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" -"獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`!" +"asyncio.MultiLoopChildWatcher`、:class:`!asyncio.FastChildWatcher`、:class:`!" +"asyncio.AbstractChildWatcher` 和 :class:`!asyncio.SafeChildWatcher`。 (由 " +"Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:30 -#, fuzzy msgid "" ":func:`!asyncio.set_child_watcher`, :func:`!" "asyncio.get_child_watcher`, :meth:`!" @@ -3130,9 +3127,11 @@ msgid "" "asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated and will " "be removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " -"Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`!asyncio.set_child_watcher`、:func:`!" +"asyncio.get_child_watcher`、:meth:`!" +"asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`!" +"asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python " +"3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" @@ -3146,7 +3145,6 @@ msgstr "" "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:41 -#, fuzzy msgid "" ":mod:`collections.abc`: Deprecated :class:`!collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -3154,7 +3152,7 @@ msgid "" "or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " "in :gh:`91896`.)" msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" +":mod:`collections.abc`:已棄用 :class:`!collections.abc.ByteString`。請改" "用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" "時,請改用聯集,如 ``bytes | bytearray``," "或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" @@ -3239,13 +3237,12 @@ msgstr "" "和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 -#, fuzzy msgid "" ":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" -":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " +":mod:`pkgutil`::func:`!pkgutil.find_loader` 和 :func:`!pkgutil.get_loader` " "現在會引發 :exc:`DeprecationWarning`;請改" "用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" "獻。)" @@ -3263,9 +3260,8 @@ msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" #: ../../deprecations/pending-removal-in-3.14.rst:93 -#, fuzzy msgid ":data:`!version` and :data:`!version_info`." -msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" +msgstr ":data:`!version` 和 :data:`!version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" @@ -3278,12 +3274,11 @@ msgstr "" "而不是 :class:`dict`。" #: ../../deprecations/pending-removal-in-3.14.rst:99 -#, fuzzy msgid "" ":mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." msgstr "" -":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" +":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`!typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" #: ../../deprecations/pending-removal-in-3.14.rst:102 @@ -3297,9 +3292,8 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:2 #: ../../deprecations/pending-removal-in-3.15.rst:2 -#, fuzzy msgid "Pending removal in Python 3.15" -msgstr "Python 3.16 中待移除的項目" +msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:4 #: ../../deprecations/pending-removal-in-3.16.rst:4 @@ -3444,7 +3438,6 @@ msgstr "" "於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:82 -#, fuzzy msgid "" "The undocumented keyword argument syntax for " "creating :class:`~typing.NamedTuple` classes (for example, ``Point = " @@ -3490,19 +3483,18 @@ msgstr "" "和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:107 -#, fuzzy msgid ":mod:`zipimport`:" -msgstr ":mod:`importlib`:" +msgstr ":mod:`zipimport`:" #: ../../deprecations/pending-removal-in-3.15.rst:109 -#, fuzzy msgid "" ":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python " "3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " "by Jiahao Li in :gh:`125746`.)" msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" -"用 :meth:`~zipimport.zipimporter.exec_module`。" +":meth:`~zipimport.zipimporter.load_module` 自 Python 3.10 被棄用。請改" +"用 :meth:`~zipimport.zipimporter.exec_module`。(由 Jiahao Li " +"於 :gh:`125746` 貢獻。)" #: ../../deprecations/c-api-pending-removal-in-3.16.rst:2 #: ../../deprecations/pending-removal-in-3.16.rst:2 @@ -3531,13 +3523,12 @@ msgstr "" "來取代 Unicode 字元。" #: ../../deprecations/pending-removal-in-3.16.rst:21 -#, fuzzy msgid "" ":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " "Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" -":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" +":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除;請改" "用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " "於 :gh:`122875` 貢獻。)" @@ -3546,40 +3537,44 @@ msgid "" ":mod:`asyncio` policy system is deprecated and will be removed in Python " "3.16. In particular, the following classes and functions are deprecated:" msgstr "" +":mod:`asyncio` 策略系統已被棄用並將在 Python 3.16 中移除。特別是以下類別和函" +"式已被棄用:" #: ../../deprecations/pending-removal-in-3.16.rst:29 msgid ":class:`asyncio.AbstractEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.AbstractEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:30 msgid ":class:`asyncio.DefaultEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.DefaultEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:31 msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.WindowsSelectorEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:32 msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.WindowsProactorEventLoopPolicy`" #: ../../deprecations/pending-removal-in-3.16.rst:33 msgid ":func:`asyncio.get_event_loop_policy`" -msgstr "" +msgstr ":func:`asyncio.get_event_loop_policy`" #: ../../deprecations/pending-removal-in-3.16.rst:34 msgid ":func:`asyncio.set_event_loop_policy`" -msgstr "" +msgstr ":func:`asyncio.set_event_loop_policy`" #: ../../deprecations/pending-removal-in-3.16.rst:36 msgid "" "Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " "*loop_factory* to use the desired event loop implementation." msgstr "" +"使用者應該使用 :func:`asyncio.run` 或 :class:`asyncio.Runner` 搭配 " +"*loop_factory* 來使用所需的事件迴圈實作。" #: ../../deprecations/pending-removal-in-3.16.rst:39 msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" -msgstr "" +msgstr "例如在 Windows 上使用 :class:`asyncio.SelectorEventLoop`: ::" #: ../../deprecations/pending-removal-in-3.16.rst:41 msgid "" @@ -3590,11 +3585,16 @@ msgid "" "\n" "asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" msgstr "" +"import asyncio\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" #: ../../deprecations/pending-removal-in-3.16.rst:48 -#, fuzzy msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" -msgstr "(由 Irit Katriel 在 :gh:`111997` 中貢獻。)" +msgstr "(由 Kumar Aditya 於 :gh:`127949` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:50 #: ../../deprecations/pending-removal-in-future.rst:16 @@ -3615,9 +3615,8 @@ msgstr "" "``~int(x)`` (``~int(x)``)。" #: ../../deprecations/pending-removal-in-3.16.rst:59 -#, fuzzy msgid ":mod:`functools`:" -msgstr ":mod:`ctypes`:" +msgstr ":mod:`functools`:" #: ../../deprecations/pending-removal-in-3.16.rst:61 msgid "" @@ -3625,11 +3624,12 @@ msgid "" "*function* or *sequence* as keyword arguments has been deprecated since " "Python 3.14." msgstr "" +"自 Python 3.14 起,使用 *function* 或 *sequence* 關鍵字引數呼" +"叫 :func:`functools.reduce` 的 Python 實作已被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:64 -#, fuzzy msgid ":mod:`logging`:" -msgstr ":mod:`typing`:" +msgstr ":mod:`logging`:" #: ../../deprecations/pending-removal-in-3.16.rst:66 msgid "" @@ -3637,6 +3637,8 @@ msgid "" "and scheduled for removal in Python 3.16. Define handlers with the *stream* " "argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" msgstr "" +"對具有 *strm* 引數的自訂日誌記錄處理函式的支援已被棄用,並計劃在 Python 3.16 " +"中移除。請改用 *stream* 引數。(由 Mariusz Felisiak 於 :gh:`115032` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:72 msgid "" @@ -3645,6 +3647,9 @@ msgid "" "and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " "Kemenade in :gh:`75223`.)" msgstr "" +"有效的副檔名以 '.' 開頭或對 :meth:`mimetypes.MimeTypes.add_type` 為空字串。未" +"加點的副檔名已被棄用,並將在 Python 3.16 中引發 :exc:`ValueError`。(由 Hugo " +"van Kemenade 於 :gh:`75223` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:78 msgid ":mod:`shutil`:" @@ -3681,14 +3686,13 @@ msgstr "" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" #: ../../deprecations/pending-removal-in-3.16.rst:98 -#, fuzzy msgid "" "The :func:`!sysconfig.expand_makefile_vars` function has been deprecated " "since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " "instead." msgstr "" -"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" -"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" +"自 Python 3.14 起,:func:`!sysconfig.expand_makefile_vars` 函式已被棄用。請改" +"用 :func:`sysconfig.get_paths` 的 ``vars`` 引數。" #: ../../deprecations/pending-removal-in-3.16.rst:104 msgid "" @@ -3699,9 +3703,8 @@ msgstr "" "棄用。" #: ../../deprecations/pending-removal-in-3.17.rst:2 -#, fuzzy msgid "Pending removal in Python 3.17" -msgstr "Python 3.16 中待移除的項目" +msgstr "Python 3.17 中待移除的項目" #: ../../deprecations/pending-removal-in-3.17.rst:6 msgid "" @@ -3712,10 +3715,13 @@ msgid "" "helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " "of relying on private implementation details." msgstr "" +"在 Python 3.14 之前,舊式聯集是使用私有類別 ``typing._UnionGenericAlias`` 實" +"作的。這個類別不再被需要,但為了向後相容性而保留,並計劃將在 Python 3.17 中移" +"除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " +"和 :func:`typing.get_args`,或者依賴私有實作細節。" #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 -#, fuzzy msgid "Pending removal in future versions" msgstr "未來版本中的待移除項目" @@ -3726,25 +3732,25 @@ msgid "" msgstr "以下 API 將在未來被移除,雖然目前尚未安排移除日期。" #: ../../deprecations/pending-removal-in-future.rst:7 -#, fuzzy msgid ":mod:`argparse`:" -msgstr ":mod:`re`:" +msgstr ":mod:`argparse`:" #: ../../deprecations/pending-removal-in-future.rst:9 -#, fuzzy msgid "" "Nesting argument groups and nesting mutually exclusive groups are deprecated." -msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" +msgstr "巢狀引數群組和巢狀互斥群組已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:11 msgid "" "Passing the undocumented keyword argument *prefix_chars* " "to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." msgstr "" +"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞" +"給 :meth:`~argparse.ArgumentParser.add_argument_group` 的做法現在已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:14 msgid "The :class:`argparse.FileType` type converter is deprecated." -msgstr "" +msgstr ":class:`argparse.FileType` 型別轉換器已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:18 msgid "``bool(NotImplemented)``." @@ -3834,6 +3840,7 @@ msgid "" ":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " "(:gh:`133038`)" msgstr "" +":mod:`codecs`:請改用 :func:`open` 而非 :func:`codecs.open`。(:gh:`133038`)" #: ../../deprecations/pending-removal-in-future.rst:52 msgid "" @@ -4047,6 +4054,9 @@ msgid "" "this private class, a compatibility shim will be provided until at least " "Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" msgstr "" +"內部類別 ``typing._UnionGenericAlias`` 不再用於實作 :class:`typing.Union`。為" +"了保持與此私有類別使用者的相容性,直到至少 Python 3.17 都將提供一個相容性 " +"shim。(由 Jelle Zijlstra 於 :gh:`105499` 貢獻。)" #: ../../deprecations/pending-removal-in-future.rst:132 msgid "" @@ -4129,10 +4139,12 @@ msgid "" ":func:`sys._clear_type_cache` is deprecated: " "use :func:`sys._clear_internal_caches` instead." msgstr "" +":func:`sys._clear_type_cache` 已被棄用:請改" +"用 :func:`sys._clear_internal_caches`。" #: ../../whatsnew/3.13.rst:2033 msgid "CPython Bytecode Changes" -msgstr "" +msgstr "CPython 位元組碼變更" #: ../../whatsnew/3.13.rst:2035 msgid "" @@ -4186,9 +4198,8 @@ msgid ":c:func:`PyMonitoring_FireJumpEvent`" msgstr ":c:func:`PyMonitoring_FireJumpEvent`" #: ../../whatsnew/3.13.rst:2059 -#, fuzzy msgid "``PyMonitoring_FireBranchEvent``" -msgstr ":c:func:`PyMonitoring_FireBranchEvent`" +msgstr "``PyMonitoring_FireBranchEvent``" #: ../../whatsnew/3.13.rst:2060 msgid ":c:func:`PyMonitoring_FireCReturnEvent`" @@ -5101,19 +5112,16 @@ msgstr "" "用 :c:func:`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 -#, fuzzy msgid "" ":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " "Use :c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project " "`__ can be used to " "get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." msgstr "" -"棄用 :c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT` 函式,這" -"些函式會回傳一個\\ :term:`借用參照 `。請改用新" -"的 :c:func:`PyWeakref_GetRef` 函式,這個函式會回傳一個\\ :term:`強參照 " -"`。`pythoncapi-compat 專案`_\\ 可以用於在 Python 3.12 和更" -"舊的版本中取得 :c:func:`PyWeakref_GetRef`。(由 Victor Stinner " -"在 :gh:`105927` 中貢獻。)" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" +"用 :c:func:`PyWeakref_GetRef`。可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.12 和更早版本取" +"得 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 msgid "" @@ -5135,6 +5143,9 @@ msgid "" "Note that some codecs (for example, \"base64\") may return a type other " "than :class:`str`, such as :class:`bytes`." msgstr "" +":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`;請注" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`str` 的型別,例" +"如 :class:`bytes`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid "" @@ -5148,19 +5159,21 @@ msgid "" "Note that some codecs (for example, \"base64\") may return a type other " "than :class:`bytes`, such as :class:`str`." msgstr "" +":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`;請注" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`bytes` 的型別,例" +"如 :class:`str`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 -#, fuzzy msgid "Python initialization functions, deprecated in Python 3.13:" -msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" +msgstr "Python 初始化函式,自 Python 3.13 起已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:24 -#, fuzzy msgid "" ":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " "` (:data:`sys.path`) instead." msgstr "" -":c:func:`!Py_SetPath`:請改用 :c:member:`PyConfig.module_search_paths`。" +":c:func:`Py_GetPath`:請改用 :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:27 msgid "" @@ -5169,6 +5182,10 @@ msgid "" "Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) " "if :ref:`virtual environments ` need to be handled." msgstr "" +":c:func:`Py_GetPrefix`:請改用 :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`)。如果需要處理\\ :ref:`虛擬環境 " +"`,請改用 :c:func:`PyConfig_Get(\"prefix\") ` " +"(:data:`sys.prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:32 msgid "" @@ -5178,196 +5195,207 @@ msgid "" "(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " "be handled." msgstr "" +":c:func:`Py_GetExecPrefix`:請改" +"用 :c:func:`PyConfig_Get(\"base_exec_prefix\") ` " +"(:data:`sys.base_exec_prefix`)。如果需要處理\\ :ref:`虛擬環境 `,請" +"改用 :c:func:`PyConfig_Get(\"exec_prefix\") ` " +"(:data:`sys.exec_prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:38 -#, fuzzy msgid "" ":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." -msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" +msgstr "" +":c:func:`Py_GetProgramFullPath`:請改" +"用 :c:func:`PyConfig_Get(\"executable\") ` " +"(:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:41 -#, fuzzy msgid "" ":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." -msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" +msgstr "" +":c:func:`Py_GetProgramName`:請改用 :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:44 -#, fuzzy msgid "" ":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " "` or the :envvar:`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " -"或 :envvar:`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:func:`PyConfig_Get(\"home\") " +"` 或 :envvar:`PYTHONHOME` 環境變數。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:48 -#, fuzzy msgid "" "The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." msgstr "" -"可以使用 `pythoncapi-compat 專案`_\\ 來在 Python 3.12 及更舊的版本中取用大部" -"分的這些新函式。" +"`pythoncapi-compat 專案 `__ 可" +"以用來為 Python 3.13 和更早版本取得 :c:func:`PyConfig_Get`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:52 msgid "" "Functions to configure Python's initialization, deprecated in Python 3.11:" -msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" +msgstr "用於配置 Python 初始化的函式,自 Python 3.11 起已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:54 msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." -msgstr ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" +msgstr ":c:func:`!PySys_SetArgvEx()`:請改用 :c:member:`PyConfig.argv`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:56 msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." -msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" +msgstr ":c:func:`!PySys_SetArgv()`:請改用 :c:member:`PyConfig.argv`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:58 msgid "" ":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " "instead." msgstr "" -":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設" -"定。" +":c:func:`!Py_SetProgramName()`:請改用 :c:member:`PyConfig.program_name`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:60 msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." -msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" +msgstr ":c:func:`!Py_SetPythonHome()`:請改用 :c:member:`PyConfig.home`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:65 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used " "with :c:type:`PyConfig` instead." msgstr "" -":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" +"應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:68 msgid "Global configuration variables:" -msgstr "全域設定變數:" +msgstr "全域配置變數:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:70 -#, fuzzy msgid "" ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` " "or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." -msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" +msgstr "" +":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug` " +"或 :c:func:`PyConfig_Get(\"parser_debug\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:73 -#, fuzzy msgid "" ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` " "or :c:func:`PyConfig_Get(\"verbose\") ` instead." -msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" +msgstr "" +":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose` " +"或 :c:func:`PyConfig_Get(\"verbose\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:76 -#, fuzzy msgid "" ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` " "or :c:func:`PyConfig_Get(\"quiet\") ` instead." -msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" +msgstr "" +":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet` " +"或 :c:func:`PyConfig_Get(\"quiet\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:79 -#, fuzzy msgid "" ":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` " "or :c:func:`PyConfig_Get(\"interactive\") ` instead." -msgstr ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" +msgstr "" +":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive` " +"或 :c:func:`PyConfig_Get(\"interactive\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:82 -#, fuzzy msgid "" ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` " "or :c:func:`PyConfig_Get(\"inspect\") ` instead." -msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" +msgstr "" +":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect` " +"或 :c:func:`PyConfig_Get(\"inspect\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:85 -#, fuzzy msgid "" ":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " "or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." msgstr "" -":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" +":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level` " +"或 :c:func:`PyConfig_Get(\"optimization_level\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:88 -#, fuzzy msgid "" ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` " "or :c:func:`PyConfig_Get(\"site_import\") ` instead." -msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" +msgstr "" +":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import` " +"或 :c:func:`PyConfig_Get(\"site_import\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:91 -#, fuzzy msgid "" ":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " "or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." msgstr "" -":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" +":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning` " +"或 :c:func:`PyConfig_Get(\"bytes_warning\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:94 -#, fuzzy msgid "" ":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " "or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" -":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" +":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings` " +"或 :c:func:`PyConfig_Get(\"pathconfig_warnings\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:97 -#, fuzzy msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "or :c:func:`PyConfig_Get(\"use_environment\") ` instead." msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment`。" +"用 :c:member:`PyConfig.use_environment` " +"或 :c:func:`PyConfig_Get(\"use_environment\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:100 -#, fuzzy msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`:請改" -"用 :c:member:`PyConfig.write_bytecode`。" +"用 :c:member:`PyConfig.write_bytecode` " +"或 :c:func:`PyConfig_Get(\"write_bytecode\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:103 -#, fuzzy msgid "" ":c:var:`Py_NoUserSiteDirectory`: " "Use :c:member:`PyConfig.user_site_directory` " "or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." msgstr "" ":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory`。" +"用 :c:member:`PyConfig.user_site_directory` " +"或 :c:func:`PyConfig_Get(\"user_site_directory\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:106 -#, fuzzy msgid "" ":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " "or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." msgstr "" -":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio`。" +":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio` " +"或 :c:func:`PyConfig_Get(\"buffered_stdio\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:109 -#, fuzzy msgid "" ":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " "` instead." msgstr "" ":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " -"和 :c:member:`PyConfig.hash_seed`。" +"和 :c:member:`PyConfig.hash_seed` 或 :c:func:`PyConfig_Get(\"hash_seed\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:113 -#, fuzzy msgid "" ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` " "or :c:func:`PyConfig_Get(\"isolated\") ` instead." -msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" +msgstr "" +":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated` " +"或 :c:func:`PyConfig_Get(\"isolated\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:116 -#, fuzzy msgid "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: " "Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` " @@ -5375,118 +5403,119 @@ msgid "" "instead." msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" +"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding` " +"或 :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:119 -#, fuzzy msgid "" ":c:var:`Py_LegacyWindowsStdioFlag`: " "Use :c:member:`PyConfig.legacy_windows_stdio` " "or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`。" +"用 :c:member:`PyConfig.legacy_windows_stdio` " +"或 :c:func:`PyConfig_Get(\"legacy_windows_stdio\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:122 -#, fuzzy msgid "" ":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" "Py_HasFileSystemDefaultEncoding`: " "Use :c:member:`PyConfig.filesystem_encoding` " "or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncoding`、:c:var:`!" +"Py_HasFileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding` " +"或 :c:func:`PyConfig_Get(\"filesystem_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:125 -#, fuzzy msgid "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: " "Use :c:member:`PyConfig.filesystem_errors` " "or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors`。" +"用 :c:member:`PyConfig.filesystem_errors` " +"或 :c:func:`PyConfig_Get(\"filesystem_errors\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:128 -#, fuzzy msgid "" ":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` " "or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. " "(see :c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" -"見 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode` " +"或 :c:func:`PyConfig_Get(\"utf8_mode\") `。(請參" +"閱 :c:func:`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:133 -#, fuzzy msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used " "with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can " "be used to get these options at runtime." msgstr "" -":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" +"應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API 來設定" +"這些選項。或者也可以使用 :c:func:`PyConfig_Get` 在執行時取得這些選項。" #: ../../deprecations/c-api-pending-removal-in-3.16.rst:4 msgid "The bundled copy of ``libmpdec``." msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:2 -#, fuzzy msgid "Pending removal in Python 3.18" -msgstr "Python 3.16 中待移除的項目" +msgstr "Python 3.18 中待移除的項目" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:4 msgid "Deprecated private functions (:gh:`128863`):" -msgstr "" +msgstr "被棄用的私有函式 (:gh:`128863`):" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:6 -#, fuzzy msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." -msgstr ":c:func:`!PyCFunction_Call`:請改用 :c:func:`PyCFunction_Call`。" +msgstr ":c:func:`!_PyBytes_Join`:請改用 :c:func:`PyBytes_Join`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 -#, fuzzy msgid "" ":c:func:`!_PyDict_GetItemStringWithError`: " "use :c:func:`PyDict_GetItemStringRef`." -msgstr "``_PyDict_GetItemWithError()``::c:func:`PyDict_GetItemRef`;" +msgstr "" +":c:func:`!_PyDict_GetItemStringWithError`:請改" +"用 :c:func:`PyDict_GetItemStringRef`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 -#, fuzzy msgid ":c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`." -msgstr "" -"``_PyDict_Pop()``::c:func:`PyDict_Pop` 或 :c:func:`PyDict_PopString`;" +msgstr ":c:func:`!_PyDict_Pop()`:請改用 :c:func:`PyDict_Pop`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 -#, fuzzy msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." -msgstr "``_PyLong_AsInt()``::c:func:`PyLong_AsInt`;" +msgstr ":c:func:`!_PyLong_Sign()`:請改用 :c:func:`PyLong_GetSign`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 msgid "" ":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: " "use :c:func:`PyLongWriter_Create`." msgstr "" +":c:func:`!_PyLong_FromDigits` 和 :c:func:`!_PyLong_New`:請改" +"用 :c:func:`PyLongWriter_Create`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:12 -#, fuzzy msgid "" ":c:func:`!_PyThreadState_UncheckedGet`: " "use :c:func:`PyThreadState_GetUnchecked`." -msgstr "``_PyThreadState_UncheckedGet()``::c:func:`PyThreadState_GetUnchecked()`;" +msgstr "" +":c:func:`!_PyThreadState_UncheckedGet`:請改" +"用 :c:func:`PyThreadState_GetUnchecked`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 -#, fuzzy msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." -msgstr "" -":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" +msgstr ":c:func:`!_PyUnicode_AsString`:請改用 :c:func:`PyUnicode_AsUTF8`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 msgid "" ":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " "with :c:func:`writer = PyUnicodeWriter_Create(0) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Init`:將 ``_PyUnicodeWriter_Init(&writer)`` 替換" +"為 :c:func:`writer = PyUnicodeWriter_Create(0) `。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:17 msgid "" @@ -5494,6 +5523,8 @@ msgid "" "``_PyUnicodeWriter_Finish(&writer)`` " "with :c:func:`PyUnicodeWriter_Finish(writer) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Finish`:將 ``_PyUnicodeWriter_Finish(&writer)`` " +"替換為 :c:func:`PyUnicodeWriter_Finish(writer) `。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:20 msgid "" @@ -5501,6 +5532,9 @@ msgid "" "``_PyUnicodeWriter_Dealloc(&writer)`` " "with :c:func:`PyUnicodeWriter_Discard(writer) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Dealloc`:將 " +"``_PyUnicodeWriter_Dealloc(&writer)`` 替換" +"為 :c:func:`PyUnicodeWriter_Discard(writer) `。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:23 msgid "" @@ -5509,6 +5543,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteChar`:將 " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:26 msgid "" @@ -5517,6 +5555,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteStr(writer, str) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteStr`:將 " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteStr(writer, str) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:29 msgid "" @@ -5525,6 +5567,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`:將 " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:32 msgid "" @@ -5533,6 +5579,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteASCIIString`:將 " +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:35 msgid "" @@ -5541,34 +5591,34 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteLatin1String`:將 " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:38 msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." -msgstr "" +msgstr ":c:func:`!_PyUnicodeWriter_Prepare`:(無替代方案)。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." -msgstr "" +msgstr ":c:func:`!_PyUnicodeWriter_PrepareKind`:(無替代方案)。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 -#, fuzzy msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." -msgstr "``_Py_HashPointer()``::c:func:`Py_HashPointer`;" +msgstr ":c:func:`!_Py_HashPointer`:請改用 :c:func:`Py_HashPointer`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 -#, fuzzy msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." -msgstr "" -":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" +msgstr ":c:func:`!_Py_fopen_obj`:請改用 :c:func:`Py_fopen`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:43 -#, fuzzy msgid "" "The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older." msgstr "" -"可以使用 `pythoncapi-compat 專案`_\\ 來在 Python 3.12 及更舊的版本中取用大部" -"分的這些新函式。" +"可以使用 `pythoncapi-compat project `__ 來取得這些於 Python 3.13 及更早版本的新公開函式。" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -5703,6 +5753,8 @@ msgid "" "``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " "(Contributed by Brett Cannon in :gh:`115192`.)" msgstr "" +"``wasm32-emscripten`` 不再是 :pep:`11` 支援的平台。(由 Brett Cannon " +"在 :gh:`115192` 貢獻。)" #: ../../whatsnew/3.13.rst:2577 msgid "" @@ -5842,6 +5894,8 @@ msgid "" ":class:`mailbox.Maildir` now ignores files with a leading dot (``.``). " "(Contributed by Zackery Spytz in :gh:`65559`.)" msgstr "" +":class:`mailbox.Maildir` 現在會忽略以點號 (``.``) 開頭的檔案。 (由 Zackery " +"Spytz 在 :gh:`65559` 貢獻。)" #: ../../whatsnew/3.13.rst:2673 msgid "" @@ -6139,93 +6193,5 @@ msgid "" msgstr "" "使用 :file:`configure` :option:`--with-pydebug` 建置的 Python 現在支" "援 :option:`-X presite=package.module <-X>` 命令列選項。如果使用它就會指定一" -"個應該在解譯器生命週期的早期階段、在執行 ``site.py`` 之前被引入的模組。(由 " +"個應該在直譯器生命週期的早期階段、在執行 ``site.py`` 之前被引入的模組。(由 " "Łukasz Langa 在 :gh:`110769` 中貢獻。)" - -#~ msgid "Pending Removal in Python 3.14" -#~ msgstr "Python 3.14 中待移除的項目" - -#~ msgid "Pending Removal in Python 3.15" -#~ msgstr "Python 3.15 中待移除的項目" - -#~ msgid "" -#~ ":mod:`urllib.request`: :class:`~urllib.request.URLopener` " -#~ "and :class:`~urllib.request.FancyURLopener` style of invoking requests is " -#~ "deprecated. Use newer :func:`~urllib.request.urlopen` functions and " -#~ "methods." -#~ msgstr "" -#~ ":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " -#~ "和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" -#~ "的 :func:`~urllib.request.urlopen` 函式和方法。" - -#~ msgid "" -#~ ":c:var:`!Py_FileSystemDefaultEncoding`: " -#~ "Use :c:member:`PyConfig.filesystem_encoding` instead." -#~ msgstr "" -#~ ":c:var:`!Py_FileSystemDefaultEncoding`:請改" -#~ "用 :c:member:`PyConfig.filesystem_encoding`。" - -#~ msgid "" -#~ ":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " -#~ "Use :c:func:`PyWeakref_GetRef` instead." -#~ msgstr "" -#~ ":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" -#~ "用 :c:func:`PyWeakref_GetRef`。" - -#~ msgid "Python initialization functions:" -#~ msgstr "Python 初始化函式:" - -#~ msgid "" -#~ ":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " -#~ "and :data:`sys.exec_prefix` instead." -#~ msgstr "" -#~ ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " -#~ "與 :data:`sys.exec_prefix`。" - -#~ msgid "" -#~ ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` " -#~ "and :data:`sys.prefix` instead." -#~ msgstr "" -#~ ":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " -#~ "與 :data:`sys.prefix`。" - -#~ msgid "" -#~ ":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` " -#~ "instead." -#~ msgstr "" -#~ ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" - -#~ msgid "" -#~ ":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` " -#~ "instead." -#~ msgstr "" -#~ ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" - -#~ msgid ":c:member:`!PyDictObject.ma_version_tag` member." -#~ msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" - -#~ msgid "Notable changes in 3.13.1" -#~ msgstr "Python 3.13.1 中顯著的變更" - -#~ msgid "" -#~ "The previously undocumented special function :func:`sys.getobjects`, " -#~ "which only exists in specialized builds of Python, may now return objects " -#~ "from other interpreters than the one it's called in." -#~ msgstr "" -#~ "先前未以文件記錄的特殊函式 :func:`sys.getobjects`,只存在於 Python 的特殊" -#~ "建置中,現在可能會回傳來自於呼叫它的直譯器之外的物件。" - -#~ msgid "Notable changes in 3.13.4" -#~ msgstr "Python 3.13.4 中顯著的變更" - -#~ msgid "tarfile" -#~ msgstr "tarfile" - -#~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" -#~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" - -#~ msgid "" -#~ ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated " -#~ "and ignored." -#~ msgstr "" -#~ ":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" diff --git a/whatsnew/3.14.po b/whatsnew/3.14.po index 7fd5b6d8ef6..259c8bc51c3 100644 --- a/whatsnew/3.14.po +++ b/whatsnew/3.14.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -23,7 +22,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:0 msgid "Editor" -msgstr "" +msgstr "編輯者" #: ../../whatsnew/3.14.rst:5 msgid "Hugo van Kemenade" @@ -671,7 +670,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:450 msgid "(Contributed by Matt Wozniski and Pablo Galindo in :gh:`131591`.)" -msgstr "" +msgstr "(由 Matt Wozniski and Pablo Galindo 於 :gh:`131591` 貢獻。)" #: ../../whatsnew/3.14.rst:459 msgid "PEP 758 – Allow except and except* expressions without parentheses" @@ -706,11 +705,11 @@ msgstr "" #: ../../whatsnew/3.14.rst:481 msgid "(Contributed by Pablo Galindo and Brett Cannon in :gh:`131831`.)" -msgstr "" +msgstr "(由 Pablo Galindo 和 Brett Cannon 於 :gh:`131831` 貢獻。)" #: ../../whatsnew/3.14.rst:484 msgid ":pep:`758`." -msgstr "" +msgstr ":pep:`758`。" #: ../../whatsnew/3.14.rst:490 msgid "PEP 649 and 749: deferred evaluation of annotations" @@ -868,7 +867,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:593 msgid "Improved error messages" -msgstr "" +msgstr "改善錯誤訊息" #: ../../whatsnew/3.14.rst:595 msgid "" @@ -1120,7 +1119,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:783 ../../whatsnew/3.14.rst:2889 #: ../../whatsnew/3.14.rst:2908 msgid "(Contributed by Victor Stinner in :gh:`107954`.)" -msgstr "" +msgstr "(由 Victor Stinner 於 :gh:`107954` 貢獻。)" #: ../../whatsnew/3.14.rst:786 msgid ":pep:`741`." @@ -1442,7 +1441,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1016 msgid "(Contributed by Łukasz Langa in :gh:`131507`.)" -msgstr "" +msgstr "(由 Łukasz Langa 於 :gh:`131507` 貢獻。)" #: ../../whatsnew/3.14.rst:1022 msgid "Binary releases for the experimental just-in-time compiler" @@ -1486,7 +1485,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1046 msgid ":pep:`744`" -msgstr "" +msgstr ":pep:`744`" #: ../../whatsnew/3.14.rst:1049 msgid "Concurrent safe warnings control" @@ -1505,7 +1504,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1059 msgid "(Contributed by Neil Schemenauer and Kumar Aditya in :gh:`130010`.)" -msgstr "" +msgstr "(由 Neil Schemenauer 和 Kumar Aditya 於 :gh:`130010` 貢獻。)" #: ../../whatsnew/3.14.rst:1064 msgid "Incremental garbage collection" @@ -1541,7 +1540,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1082 ../../whatsnew/3.14.rst:2332 msgid "(Contributed by Mark Shannon in :gh:`108362`.)" -msgstr "" +msgstr "(由 Mark Shannon 於 :gh:`108362` 貢獻。)" #: ../../whatsnew/3.14.rst:1085 msgid "Platform support" @@ -1776,7 +1775,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1240 ../../whatsnew/3.14.rst:2397 msgid "argparse" -msgstr "" +msgstr "argparse" #: ../../whatsnew/3.14.rst:1242 msgid "" @@ -1804,7 +1803,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1262 ../../whatsnew/3.14.rst:2416 msgid "ast" -msgstr "" +msgstr "ast" #: ../../whatsnew/3.14.rst:1264 msgid "" @@ -1846,7 +1845,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1286 ../../whatsnew/3.14.rst:2258 #: ../../whatsnew/3.14.rst:2447 msgid "asyncio" -msgstr "" +msgstr "asyncio" #: ../../whatsnew/3.14.rst:1288 msgid "" @@ -1876,7 +1875,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1312 msgid "calendar" -msgstr "" +msgstr "calendar" #: ../../whatsnew/3.14.rst:1314 msgid "" @@ -1888,7 +1887,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1322 msgid "concurrent.futures" -msgstr "" +msgstr "concurrent.futures" #: ../../whatsnew/3.14.rst:1326 msgid "" @@ -1924,7 +1923,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1349 ../../whatsnew/3.14.rst:1779 msgid "(Contributed by Gregory P. Smith in :gh:`84559`.)" -msgstr "" +msgstr "(由 Gregory P. Smith 於 :gh:`84559` 貢獻。)" #: ../../whatsnew/3.14.rst:1351 msgid "" @@ -1945,7 +1944,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1364 msgid "configparser" -msgstr "" +msgstr "configparser" #: ../../whatsnew/3.14.rst:1366 msgid "" @@ -1958,7 +1957,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1373 msgid "contextvars" -msgstr "" +msgstr "contextvars" #: ../../whatsnew/3.14.rst:1375 msgid "" @@ -1968,7 +1967,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1380 msgid "ctypes" -msgstr "" +msgstr "ctypes" #: ../../whatsnew/3.14.rst:1382 msgid "" @@ -2052,7 +2051,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1434 msgid "curses" -msgstr "" +msgstr "curses" #: ../../whatsnew/3.14.rst:1436 msgid "" @@ -2063,7 +2062,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1442 msgid "datetime" -msgstr "" +msgstr "datetime" #: ../../whatsnew/3.14.rst:1444 msgid "" @@ -2073,7 +2072,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1448 msgid "decimal" -msgstr "" +msgstr "decimal" #: ../../whatsnew/3.14.rst:1450 msgid "" @@ -2091,7 +2090,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1459 ../../whatsnew/3.14.rst:2294 msgid "difflib" -msgstr "" +msgstr "difflib" #: ../../whatsnew/3.14.rst:1461 msgid "" @@ -2102,7 +2101,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1466 msgid "dis" -msgstr "" +msgstr "dis" #: ../../whatsnew/3.14.rst:1468 msgid "" @@ -2114,19 +2113,19 @@ msgstr "" #: ../../whatsnew/3.14.rst:1473 msgid ":class:`dis.Bytecode`" -msgstr "" +msgstr ":class:`dis.Bytecode`" #: ../../whatsnew/3.14.rst:1474 msgid ":func:`dis.dis`" -msgstr "" +msgstr ":func:`dis.dis`" #: ../../whatsnew/3.14.rst:1475 msgid ":func:`dis.distb`" -msgstr "" +msgstr ":func:`dis.distb`" #: ../../whatsnew/3.14.rst:1476 msgid ":func:`dis.disassemble`" -msgstr "" +msgstr ":func:`dis.disassemble`" #: ../../whatsnew/3.14.rst:1478 msgid "" @@ -2142,7 +2141,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1487 msgid "errno" -msgstr "" +msgstr "errno" #: ../../whatsnew/3.14.rst:1489 msgid "" @@ -2152,7 +2151,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1494 msgid "faulthandler" -msgstr "" +msgstr "faulthandler" #: ../../whatsnew/3.14.rst:1496 msgid "" @@ -2164,7 +2163,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1503 msgid "fnmatch" -msgstr "" +msgstr "fnmatch" #: ../../whatsnew/3.14.rst:1505 msgid "" @@ -2174,7 +2173,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1510 msgid "fractions" -msgstr "" +msgstr "fractions" #: ../../whatsnew/3.14.rst:1512 msgid "" @@ -2192,7 +2191,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1522 msgid "functools" -msgstr "" +msgstr "functools" #: ../../whatsnew/3.14.rst:1524 msgid "" @@ -2209,7 +2208,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1535 msgid "getopt" -msgstr "" +msgstr "getopt" #: ../../whatsnew/3.14.rst:1537 msgid "" @@ -2225,7 +2224,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1545 msgid "getpass" -msgstr "" +msgstr "getpass" #: ../../whatsnew/3.14.rst:1547 msgid "" @@ -2237,7 +2236,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1554 msgid "graphlib" -msgstr "" +msgstr "graphlib" #: ../../whatsnew/3.14.rst:1556 msgid "" @@ -2248,7 +2247,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1562 msgid "heapq" -msgstr "" +msgstr "heapq" #: ../../whatsnew/3.14.rst:1564 msgid "Add functions for working with max-heaps:" @@ -2256,27 +2255,27 @@ msgstr "" #: ../../whatsnew/3.14.rst:1566 msgid ":func:`heapq.heapify_max`," -msgstr "" +msgstr ":func:`heapq.heapify_max`," #: ../../whatsnew/3.14.rst:1567 msgid ":func:`heapq.heappush_max`," -msgstr "" +msgstr ":func:`heapq.heappush_max`," #: ../../whatsnew/3.14.rst:1568 msgid ":func:`heapq.heappop_max`," -msgstr "" +msgstr ":func:`heapq.heappop_max`," #: ../../whatsnew/3.14.rst:1569 msgid ":func:`heapq.heapreplace_max`" -msgstr "" +msgstr ":func:`heapq.heapreplace_max`" #: ../../whatsnew/3.14.rst:1570 msgid ":func:`heapq.heappushpop_max`" -msgstr "" +msgstr ":func:`heapq.heappushpop_max`" #: ../../whatsnew/3.14.rst:1574 msgid "hmac" -msgstr "" +msgstr "hmac" #: ../../whatsnew/3.14.rst:1576 msgid "" @@ -2287,7 +2286,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1582 msgid "http" -msgstr "" +msgstr "http" #: ../../whatsnew/3.14.rst:1584 msgid "" @@ -2320,11 +2319,11 @@ msgstr "" #: ../../whatsnew/3.14.rst:1597 msgid "(Contributed by Semyon Moroz in :gh:`85162`.)" -msgstr "" +msgstr "(由 Semyon Moroz 於 :gh:`85162` 貢獻。)" #: ../../whatsnew/3.14.rst:1601 msgid "imaplib" -msgstr "" +msgstr "imaplib" #: ../../whatsnew/3.14.rst:1603 msgid "" @@ -2335,7 +2334,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1609 msgid "inspect" -msgstr "" +msgstr "inspect" #: ../../whatsnew/3.14.rst:1611 msgid "" @@ -2359,7 +2358,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1625 ../../whatsnew/3.14.rst:2336 msgid "io" -msgstr "" +msgstr "io" #: ../../whatsnew/3.14.rst:1627 msgid "" @@ -2379,7 +2378,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1638 msgid "json" -msgstr "" +msgstr "json" #: ../../whatsnew/3.14.rst:1640 msgid "" @@ -2405,7 +2404,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1658 msgid "linecache" -msgstr "" +msgstr "linecache" #: ../../whatsnew/3.14.rst:1660 msgid "" @@ -2415,7 +2414,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1665 msgid "logging.handlers" -msgstr "" +msgstr "logging.handlers" #: ../../whatsnew/3.14.rst:1667 msgid "" @@ -2433,7 +2432,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1677 msgid "math" -msgstr "" +msgstr "math" #: ../../whatsnew/3.14.rst:1679 msgid "" @@ -2443,7 +2442,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1684 msgid "mimetypes" -msgstr "" +msgstr "mimetypes" #: ../../whatsnew/3.14.rst:1686 msgid "" @@ -2472,15 +2471,15 @@ msgstr "" #: ../../whatsnew/3.14.rst:1698 msgid "WOFF 1.0 ``font/woff``" -msgstr "" +msgstr "WOFF 1.0 ``font/woff``" #: ../../whatsnew/3.14.rst:1699 msgid "WOFF 2.0 ``font/woff2``" -msgstr "" +msgstr "WOFF 2.0 ``font/woff2``" #: ../../whatsnew/3.14.rst:1701 msgid "(Contributed by Sahil Prajapati and Hugo van Kemenade in :gh:`84852`.)" -msgstr "" +msgstr "(由 Sahil Prajapati and Hugo van Kemenade 於 :gh:`84852` 貢獻。)" #: ../../whatsnew/3.14.rst:1703 msgid "" @@ -2502,7 +2501,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1710 msgid "(Contributed by Hugo van Kemenade in :gh:`89416`.)" -msgstr "" +msgstr "(由 Hugo van Kemenade 於 :gh:`89416` 貢獻。)" #: ../../whatsnew/3.14.rst:1712 msgid "Add MIME types for images with RFCs:" @@ -2537,7 +2536,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1721 msgid "(Contributed by Hugo van Kemenade in :gh:`85957`.)" -msgstr "" +msgstr "(由 Hugo van Kemenade 於 :gh:`85957` 貢獻。)" #: ../../whatsnew/3.14.rst:1723 msgid "More MIME type changes:" @@ -2636,7 +2635,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1753 msgid "(Contributed by Hugo van Kemenade in :gh:`129965`.)" -msgstr "" +msgstr "(由 Hugo van Kemenade 於 :gh:`129965` 貢獻。)" #: ../../whatsnew/3.14.rst:1755 msgid "" @@ -2647,7 +2646,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1761 msgid "multiprocessing" -msgstr "" +msgstr "multiprocessing" #: ../../whatsnew/3.14.rst:1765 msgid "" @@ -2692,7 +2691,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1794 msgid "(Contributed by Roy Hyunjin Han for :gh:`103134`.)" -msgstr "" +msgstr "(由 Roy Hyunjin Han 於 :gh:`103134` 貢獻。)" #: ../../whatsnew/3.14.rst:1796 msgid "" @@ -2712,7 +2711,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1807 msgid "operator" -msgstr "" +msgstr "operator" #: ../../whatsnew/3.14.rst:1809 msgid "" @@ -2724,7 +2723,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1817 msgid "os" -msgstr "" +msgstr "os" #: ../../whatsnew/3.14.rst:1819 msgid "" @@ -2749,7 +2748,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1835 msgid "os.path" -msgstr "" +msgstr "os.path" #: ../../whatsnew/3.14.rst:1837 msgid "" @@ -2763,7 +2762,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1845 ../../whatsnew/3.14.rst:2345 #: ../../whatsnew/3.14.rst:2605 msgid "pathlib" -msgstr "" +msgstr "pathlib" #: ../../whatsnew/3.14.rst:1847 msgid "" @@ -2791,7 +2790,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1855 msgid "(Contributed by Barney Gale in :gh:`73991`.)" -msgstr "" +msgstr "(由 Barney Gale 於 :gh:`73991` 貢獻。)" #: ../../whatsnew/3.14.rst:1857 msgid "" @@ -2805,7 +2804,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1867 ../../whatsnew/3.14.rst:2353 msgid "pdb" -msgstr "" +msgstr "pdb" #: ../../whatsnew/3.14.rst:1869 msgid "" @@ -2876,7 +2875,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1914 msgid "pickle" -msgstr "" +msgstr "pickle" #: ../../whatsnew/3.14.rst:1916 msgid "" @@ -2892,7 +2891,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1925 msgid "platform" -msgstr "" +msgstr "platform" #: ../../whatsnew/3.14.rst:1927 msgid "" @@ -2902,7 +2901,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1932 msgid "pydoc" -msgstr "" +msgstr "pydoc" #: ../../whatsnew/3.14.rst:1934 msgid "" @@ -2913,7 +2912,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1940 msgid "socket" -msgstr "" +msgstr "socket" #: ../../whatsnew/3.14.rst:1942 msgid "Improve and fix support for Bluetooth sockets." @@ -2970,7 +2969,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1966 msgid "ssl" -msgstr "" +msgstr "ssl" #: ../../whatsnew/3.14.rst:1968 msgid "" @@ -2981,7 +2980,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1974 msgid "struct" -msgstr "" +msgstr "struct" #: ../../whatsnew/3.14.rst:1976 msgid "" @@ -2992,7 +2991,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:1983 msgid "symtable" -msgstr "" +msgstr "symtable" #: ../../whatsnew/3.14.rst:1985 msgid "Expose the following :class:`symtable.Symbol` methods:" @@ -3000,23 +2999,23 @@ msgstr "" #: ../../whatsnew/3.14.rst:1987 msgid ":meth:`~symtable.Symbol.is_comp_cell`" -msgstr "" +msgstr ":meth:`~symtable.Symbol.is_comp_cell`" #: ../../whatsnew/3.14.rst:1988 msgid ":meth:`~symtable.Symbol.is_comp_iter`" -msgstr "" +msgstr ":meth:`~symtable.Symbol.is_comp_iter`" #: ../../whatsnew/3.14.rst:1989 msgid ":meth:`~symtable.Symbol.is_free_class`" -msgstr "" +msgstr ":meth:`~symtable.Symbol.is_free_class`" #: ../../whatsnew/3.14.rst:1991 msgid "(Contributed by Bénédikt Tran in :gh:`120029`.)" -msgstr "" +msgstr "(由 Bénédikt Tran 於 :gh:`120029` 貢獻。)" #: ../../whatsnew/3.14.rst:1995 msgid "sys" -msgstr "" +msgstr "sys" #: ../../whatsnew/3.14.rst:1997 msgid "" @@ -3045,7 +3044,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2012 msgid "sys.monitoring" -msgstr "" +msgstr "sys.monitoring" #: ../../whatsnew/3.14.rst:2014 msgid "" @@ -3055,7 +3054,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2019 msgid "sysconfig" -msgstr "" +msgstr "sysconfig" #: ../../whatsnew/3.14.rst:2021 msgid "" @@ -3065,7 +3064,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2026 msgid "tarfile" -msgstr "" +msgstr "tarfile" #: ../../whatsnew/3.14.rst:2028 msgid "" @@ -3101,7 +3100,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2048 msgid "threading" -msgstr "" +msgstr "threading" #: ../../whatsnew/3.14.rst:2050 msgid "" @@ -3112,7 +3111,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2056 msgid "tkinter" -msgstr "" +msgstr "tkinter" #: ../../whatsnew/3.14.rst:2058 msgid "" @@ -3129,7 +3128,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2067 msgid "turtle" -msgstr "" +msgstr "turtle" #: ../../whatsnew/3.14.rst:2069 msgid "" @@ -3140,7 +3139,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2075 msgid "types" -msgstr "" +msgstr "types" #: ../../whatsnew/3.14.rst:2077 msgid "" @@ -3151,7 +3150,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2083 ../../whatsnew/3.14.rst:2651 msgid "typing" -msgstr "" +msgstr "typing" #: ../../whatsnew/3.14.rst:2087 msgid "" @@ -3219,7 +3218,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2122 msgid "(Contributed by Jelle Zijlstra in :gh:`105499`.)" -msgstr "" +msgstr "(由 Jelle Zijlstra 於 :gh:`105499` 貢獻。)" #: ../../whatsnew/3.14.rst:2124 msgid ":class:`typing.TypeAliasType` now supports star unpacking." @@ -3227,7 +3226,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2128 msgid "unicodedata" -msgstr "" +msgstr "unicodedata" #: ../../whatsnew/3.14.rst:2130 msgid "The Unicode database has been updated to Unicode 16.0.0." @@ -3235,7 +3234,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2136 msgid "unittest" -msgstr "" +msgstr "unittest" #: ../../whatsnew/3.14.rst:2138 msgid "" @@ -3280,11 +3279,11 @@ msgstr "" #: ../../whatsnew/3.14.rst:2162 msgid "(Contributed by Serhiy Storchaka in :gh:`71339`.)" -msgstr "" +msgstr "(由 Serhiy Storchaka 於 :gh:`71339` 貢獻。)" #: ../../whatsnew/3.14.rst:2166 ../../whatsnew/3.14.rst:2658 msgid "urllib" -msgstr "" +msgstr "urllib" #: ../../whatsnew/3.14.rst:2168 msgid "" @@ -3352,11 +3351,11 @@ msgstr "" #: ../../whatsnew/3.14.rst:2196 msgid "(Contributed by Barney Gale in :gh:`125866`.)" -msgstr "" +msgstr "(由 Barney Gale 於 :gh:`125866` 貢獻。)" #: ../../whatsnew/3.14.rst:2200 ../../whatsnew/3.14.rst:2365 msgid "uuid" -msgstr "" +msgstr "uuid" #: ../../whatsnew/3.14.rst:2202 msgid "" @@ -3381,7 +3380,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2216 msgid "webbrowser" -msgstr "" +msgstr "webbrowser" #: ../../whatsnew/3.14.rst:2218 msgid "" @@ -3398,7 +3397,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2227 msgid "zipfile" -msgstr "" +msgstr "zipfile" #: ../../whatsnew/3.14.rst:2229 msgid "" @@ -3417,7 +3416,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2244 msgid "Optimizations" -msgstr "" +msgstr "最佳化" #: ../../whatsnew/3.14.rst:2246 msgid "" @@ -3452,7 +3451,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2277 msgid "base64" -msgstr "" +msgstr "base64" #: ../../whatsnew/3.14.rst:2279 msgid "" @@ -3462,7 +3461,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2285 msgid "bdb" -msgstr "" +msgstr "bdb" #: ../../whatsnew/3.14.rst:2287 msgid "" @@ -3479,7 +3478,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2301 msgid "gc" -msgstr "" +msgstr "gc" #: ../../whatsnew/3.14.rst:2303 msgid "" @@ -3583,11 +3582,11 @@ msgstr "" #: ../../whatsnew/3.14.rst:2390 msgid "(Contributed by Steve Dower in :gh:`91349`.)" -msgstr "" +msgstr "(由 Steve Dower 於 :gh:`91349` 貢獻。)" #: ../../whatsnew/3.14.rst:2394 ../../whatsnew/3.14.rst:3079 msgid "Removed" -msgstr "" +msgstr "已移除" #: ../../whatsnew/3.14.rst:2399 msgid "" @@ -3647,7 +3646,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2434 msgid "(Contributed by Alex Waygood in :gh:`119562`.)" -msgstr "" +msgstr "(由 Alex Waygood 於 :gh:`119562` 貢獻。)" #: ../../whatsnew/3.14.rst:2436 msgid "" @@ -3717,7 +3716,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2463 msgid "(Contributed by Kumar Aditya in :gh:`120804`.)" -msgstr "" +msgstr "(由 Kumar Aditya 於 :gh:`120804` 貢獻。)" #: ../../whatsnew/3.14.rst:2465 msgid "" @@ -3727,7 +3726,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2469 msgid "(Contributed by Kumar Aditya in :gh:`126353`.)" -msgstr "" +msgstr "(由 Kumar Aditya 於 :gh:`126353` 貢獻。)" #: ../../whatsnew/3.14.rst:2474 msgid "" @@ -3834,7 +3833,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2565 msgid "collections.abc" -msgstr "" +msgstr "collections.abc" #: ../../whatsnew/3.14.rst:2567 ../../whatsnew/3.14.rst:2653 msgid "" @@ -3844,7 +3843,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2573 msgid "email" -msgstr "" +msgstr "email" #: ../../whatsnew/3.14.rst:2575 msgid "" @@ -3880,11 +3879,11 @@ msgstr "" #: ../../whatsnew/3.14.rst:2592 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" -msgstr "" +msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" #: ../../whatsnew/3.14.rst:2596 msgid "itertools" -msgstr "" +msgstr "itertools" #: ../../whatsnew/3.14.rst:2598 msgid "" @@ -3934,7 +3933,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2636 msgid "sqlite3" -msgstr "" +msgstr "sqlite3" #: ../../whatsnew/3.14.rst:2638 msgid "" @@ -3977,12 +3976,12 @@ msgstr "" #: ../../whatsnew/3.14.rst:2677 ../../whatsnew/3.14.rst:2996 msgid "Deprecated" -msgstr "" +msgstr "已棄用" #: ../../whatsnew/3.14.rst:2679 #: ../../deprecations/pending-removal-in-future.rst:7 msgid ":mod:`argparse`:" -msgstr "" +msgstr ":mod:`argparse`:" #: ../../whatsnew/3.14.rst:2681 msgid "" @@ -4001,7 +4000,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2690 #: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" -msgstr "" +msgstr ":mod:`asyncio`:" #: ../../whatsnew/3.14.rst:2692 #: ../../deprecations/pending-removal-in-3.16.rst:21 @@ -4010,6 +4009,9 @@ msgid "" "Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" +":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除;請改" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " +"於 :gh:`122875` 貢獻。)" #: ../../whatsnew/3.14.rst:2697 #: ../../deprecations/pending-removal-in-3.16.rst:26 @@ -4017,36 +4019,38 @@ msgid "" ":mod:`asyncio` policy system is deprecated and will be removed in Python " "3.16. In particular, the following classes and functions are deprecated:" msgstr "" +":mod:`asyncio` 策略系統已被棄用並將在 Python 3.16 中移除。特別是以下類別和函" +"式已被棄用:" #: ../../whatsnew/3.14.rst:2700 #: ../../deprecations/pending-removal-in-3.16.rst:29 msgid ":class:`asyncio.AbstractEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.AbstractEventLoopPolicy`" #: ../../whatsnew/3.14.rst:2701 #: ../../deprecations/pending-removal-in-3.16.rst:30 msgid ":class:`asyncio.DefaultEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.DefaultEventLoopPolicy`" #: ../../whatsnew/3.14.rst:2702 #: ../../deprecations/pending-removal-in-3.16.rst:31 msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.WindowsSelectorEventLoopPolicy`" #: ../../whatsnew/3.14.rst:2703 #: ../../deprecations/pending-removal-in-3.16.rst:32 msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" -msgstr "" +msgstr ":class:`asyncio.WindowsProactorEventLoopPolicy`" #: ../../whatsnew/3.14.rst:2704 #: ../../deprecations/pending-removal-in-3.16.rst:33 msgid ":func:`asyncio.get_event_loop_policy`" -msgstr "" +msgstr ":func:`asyncio.get_event_loop_policy`" #: ../../whatsnew/3.14.rst:2705 #: ../../deprecations/pending-removal-in-3.16.rst:34 msgid ":func:`asyncio.set_event_loop_policy`" -msgstr "" +msgstr ":func:`asyncio.set_event_loop_policy`" #: ../../whatsnew/3.14.rst:2707 #: ../../deprecations/pending-removal-in-3.16.rst:36 @@ -4054,11 +4058,13 @@ msgid "" "Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " "*loop_factory* to use the desired event loop implementation." msgstr "" +"使用者應該使用 :func:`asyncio.run` 或 :class:`asyncio.Runner` 搭配 " +"*loop_factory* 來使用所需的事件迴圈實作。" #: ../../whatsnew/3.14.rst:2710 #: ../../deprecations/pending-removal-in-3.16.rst:39 msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" -msgstr "" +msgstr "例如在 Windows 上使用 :class:`asyncio.SelectorEventLoop`: ::" #: ../../whatsnew/3.14.rst:2712 #: ../../deprecations/pending-removal-in-3.16.rst:41 @@ -4070,11 +4076,17 @@ msgid "" "\n" "asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" msgstr "" +"import asyncio\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" #: ../../whatsnew/3.14.rst:2719 #: ../../deprecations/pending-removal-in-3.16.rst:48 msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" -msgstr "" +msgstr "(由 Kumar Aditya 於 :gh:`127949` 貢獻。)" #: ../../whatsnew/3.14.rst:2721 msgid "" @@ -4094,7 +4106,7 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:16 #: ../../deprecations/pending-removal-in-3.19.rst:4 msgid ":mod:`ctypes`:" -msgstr "" +msgstr ":mod:`ctypes`:" #: ../../whatsnew/3.14.rst:2733 msgid "" @@ -4196,12 +4208,12 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:2 #: ../../deprecations/pending-removal-in-3.15.rst:2 msgid "Pending removal in Python 3.15" -msgstr "" +msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:4 #: ../../deprecations/pending-removal-in-3.16.rst:4 msgid "The import system:" -msgstr "" +msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" @@ -4210,6 +4222,9 @@ msgid "" "deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " "into consideration by the import system or standard library. (:gh:`97879`)" msgstr "" +"在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " +"` 的做法已被棄用。在 Python 3.15 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__cached__`。(:gh:`97879`)" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" @@ -4219,16 +4234,20 @@ msgid "" "take into consideration by the import system or standard library. " "(:gh:`97879`)" msgstr "" +"在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " +"` 的做法已被棄用。在 Python 3.15 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__package__`。(:gh:`97879`)" #: ../../deprecations/pending-removal-in-3.15.rst:18 msgid "" "The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " "since Python 3.13." msgstr "" +"自 Python 3.13 起,未記錄的 :func:`!ctypes.SetPointerType` 函式已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:21 msgid ":mod:`http.server`:" -msgstr "" +msgstr ":mod:`http.server`:" #: ../../deprecations/pending-removal-in-3.15.rst:23 msgid "" @@ -4236,25 +4255,30 @@ msgid "" "been deprecated since Python 3.13. No direct replacement exists. *Anything* " "is better than CGI to interface a web server with a request handler." msgstr "" +"過時且很少使用的 :class:`~http.server.CGIHTTPRequestHandler` 自 Python 3.13 " +"起已被棄用。不存在直接的替代。*任何東西*\\ 都比 CGI 更好地將 Web 伺服器與請求" +"處理程序介接起來。" #: ../../deprecations/pending-removal-in-3.15.rst:29 msgid "" "The :option:`!--cgi` flag to the :program:`python -m http.server` command-" "line interface has been deprecated since Python 3.13." msgstr "" +"自 Python 3.13 起,:program:`python -m http.server` 命令列介面的 :option:`!--" +"cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 #: ../../deprecations/pending-removal-in-future.rst:64 msgid ":mod:`importlib`:" -msgstr "" +msgstr ":mod:`importlib`:" #: ../../deprecations/pending-removal-in-3.15.rst:34 msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "" +msgstr "``load_module()`` method:請改用 ``exec_module()``。" #: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":class:`locale`:" -msgstr "" +msgstr ":class:`locale`:" #: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" @@ -4265,20 +4289,27 @@ msgid "" "and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " "in :gh:`111187`.)" msgstr "" +":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" +"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " +"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" -msgstr "" +msgstr ":mod:`pathlib`:" #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " "Use :func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" +"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" -msgstr "" +msgstr ":mod:`platform`:" #: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" @@ -4286,21 +4317,25 @@ msgid "" "function is only useful for Jython support, has a confusing API, and is " "largely untested." msgstr "" +"自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" +"援有用,具有令人困惑的 API,基本上未經測試。" #: ../../deprecations/pending-removal-in-3.15.rst:58 #: ../../deprecations/pending-removal-in-3.16.rst:96 msgid ":mod:`sysconfig`:" -msgstr "" +msgstr ":mod:`sysconfig`:" #: ../../deprecations/pending-removal-in-3.15.rst:60 msgid "" "The *check_home* argument of :func:`sysconfig.is_python_build` has been " "deprecated since Python 3.12." msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 引數自 Python 3.12 起已被棄" +"用。" #: ../../deprecations/pending-removal-in-3.15.rst:63 msgid ":mod:`threading`:" -msgstr "" +msgstr ":mod:`threading`:" #: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" @@ -4309,10 +4344,13 @@ msgid "" "not permit any arguments, but the C version allows any number of positional " "or keyword arguments, ignoring every argument." msgstr "" +":func:`~threading.RLock` 在 Python 3.15 中將不接受任何引數。自 Python 3.14 " +"起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" +"任意數量的位置或關鍵字引數,並忽略每個引數。" #: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`types`:" -msgstr "" +msgstr ":mod:`types`:" #: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" @@ -4321,11 +4359,15 @@ msgid "" "but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" +":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" +"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " +"於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:80 #: ../../deprecations/pending-removal-in-3.17.rst:4 msgid ":mod:`typing`:" -msgstr "" +msgstr ":mod:`typing`:" #: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" @@ -4334,6 +4376,9 @@ msgid "" "NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " "3.13. Use the class-based syntax or the functional syntax instead." msgstr "" +"用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " +"(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" +"用基於類別的語法或函式語法 (functional syntax)。" #: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" @@ -4343,6 +4388,10 @@ msgid "" "since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " "TypedDict(\"TD\", {})`` to create a TypedDict with zero field." msgstr "" +"當使用 :class:`~typing.TypedDict` 的函式語法時,未傳遞值給 *fields* 參數 " +"(``TD = TypedDict(\"TD\")``) 或傳遞 ``None`` (``TD = TypedDict(\"TD\", " +"None)``) 的做法自 Python 3.13 起已被棄用。請使用 ``class TD(TypedDict): " +"pass`` 或 ``TD = TypedDict(\"TD\", {})`` 來建立具有零個欄位的 TypedDict。" #: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" @@ -4350,10 +4399,13 @@ msgid "" "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " "it has yet to be supported by any major type checker." msgstr "" +"自 Python 3.13 起,:func:`typing.no_type_check_decorator` 裝飾器函式已被棄" +"用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" +"援。" #: ../../deprecations/pending-removal-in-3.15.rst:100 msgid ":mod:`wave`:" -msgstr "" +msgstr ":mod:`wave`:" #: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" @@ -4362,10 +4414,13 @@ msgid "" "the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " "deprecated since Python 3.13." msgstr "" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" +"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " +"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:107 msgid ":mod:`zipimport`:" -msgstr "" +msgstr ":mod:`zipimport`:" #: ../../deprecations/pending-removal-in-3.15.rst:109 msgid "" @@ -4373,11 +4428,14 @@ msgid "" "3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " "by Jiahao Li in :gh:`125746`.)" msgstr "" +":meth:`~zipimport.zipimporter.load_module` 自 Python 3.10 被棄用。請改" +"用 :meth:`~zipimport.zipimporter.exec_module`。(由 Jiahao Li " +"於 :gh:`125746` 貢獻。)" #: ../../deprecations/c-api-pending-removal-in-3.16.rst:2 #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" -msgstr "" +msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" @@ -4386,10 +4444,13 @@ msgid "" "deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " "taken into consideration by the import system or the standard library." msgstr "" +"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " +"` 的做法將於 Python 3.16 被棄用。在 " +"Python 3.16 中,引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__`。" #: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" -msgstr "" +msgstr ":mod:`array`:" #: ../../deprecations/pending-removal-in-3.16.rst:13 msgid "" @@ -4397,11 +4458,14 @@ msgid "" "documentation since Python 3.3 and at runtime since Python 3.13. Use the " "``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." msgstr "" +"自 Python 3.3 起,``'u'`` 格式碼 (:c:type:`wchar_t`) 在文件中已被棄用,自 " +"Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " +"來取代 Unicode 字元。" #: ../../deprecations/pending-removal-in-3.16.rst:50 #: ../../deprecations/pending-removal-in-future.rst:16 msgid ":mod:`builtins`:" -msgstr "" +msgstr ":mod:`builtins`:" #: ../../deprecations/pending-removal-in-3.16.rst:52 msgid "" @@ -4411,10 +4475,14 @@ msgid "" "of a Boolean. In the rare case that you need the bitwise inversion of the " "underlying integer, convert to ``int`` explicitly (``~int(x)``)." msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" #: ../../deprecations/pending-removal-in-3.16.rst:59 msgid ":mod:`functools`:" -msgstr "" +msgstr ":mod:`functools`:" #: ../../deprecations/pending-removal-in-3.16.rst:61 msgid "" @@ -4422,10 +4490,12 @@ msgid "" "*function* or *sequence* as keyword arguments has been deprecated since " "Python 3.14." msgstr "" +"自 Python 3.14 起,使用 *function* 或 *sequence* 關鍵字引數呼" +"叫 :func:`functools.reduce` 的 Python 實作已被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:64 msgid ":mod:`logging`:" -msgstr "" +msgstr ":mod:`logging`:" #: ../../deprecations/pending-removal-in-3.16.rst:66 msgid "" @@ -4433,10 +4503,12 @@ msgid "" "and scheduled for removal in Python 3.16. Define handlers with the *stream* " "argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" msgstr "" +"對具有 *strm* 引數的自訂日誌記錄處理函式的支援已被棄用,並計劃在 Python 3.16 " +"中移除。請改用 *stream* 引數。(由 Mariusz Felisiak 於 :gh:`115032` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:70 msgid ":mod:`mimetypes`:" -msgstr "" +msgstr ":mod:`mimetypes`:" #: ../../deprecations/pending-removal-in-3.16.rst:72 msgid "" @@ -4445,10 +4517,13 @@ msgid "" "and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " "Kemenade in :gh:`75223`.)" msgstr "" +"有效的副檔名以 '.' 開頭或對 :meth:`mimetypes.MimeTypes.add_type` 為空字串。未" +"加點的副檔名已被棄用,並將在 Python 3.16 中引發 :exc:`ValueError`。(由 Hugo " +"van Kemenade 於 :gh:`75223` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:78 msgid ":mod:`shutil`:" -msgstr "" +msgstr ":mod:`shutil`:" #: ../../deprecations/pending-removal-in-3.16.rst:80 msgid "" @@ -4456,20 +4531,24 @@ msgid "" "has not been used by any function in :mod:`!shutil` since Python 3.4, and is " "now an alias of :exc:`RuntimeError`." msgstr "" +"自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" +"未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" #: ../../deprecations/pending-removal-in-3.16.rst:85 msgid ":mod:`symtable`:" -msgstr "" +msgstr ":mod:`symtable`:" #: ../../deprecations/pending-removal-in-3.16.rst:87 msgid "" "The :meth:`Class.get_methods ` method has been " "deprecated since Python 3.14." msgstr "" +"自 Python 3.14 起,:meth:`Class.get_methods ` 方" +"法已被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:90 msgid ":mod:`sys`:" -msgstr "" +msgstr ":mod:`sys`:" #: ../../deprecations/pending-removal-in-3.16.rst:92 msgid "" @@ -4477,6 +4556,8 @@ msgid "" "since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable instead." msgstr "" +"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" +"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" #: ../../deprecations/pending-removal-in-3.16.rst:98 msgid "" @@ -4484,20 +4565,24 @@ msgid "" "since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " "instead." msgstr "" +"自 Python 3.14 起,:func:`!sysconfig.expand_makefile_vars` 函式已被棄用。請改" +"用 :func:`sysconfig.get_paths` 的 ``vars`` 引數。" #: ../../deprecations/pending-removal-in-3.16.rst:102 msgid ":mod:`tarfile`:" -msgstr "" +msgstr ":mod:`tarfile`:" #: ../../deprecations/pending-removal-in-3.16.rst:104 msgid "" "The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " "deprecated since Python 3.13." msgstr "" +"自 Python 3.13 起,未以文件記錄和未被使用的 :attr:`!TarFile.tarfile` 屬性已被" +"棄用。" #: ../../deprecations/pending-removal-in-3.17.rst:2 msgid "Pending removal in Python 3.17" -msgstr "" +msgstr "Python 3.17 中待移除的項目" #: ../../deprecations/pending-removal-in-3.17.rst:6 msgid "" @@ -4508,10 +4593,14 @@ msgid "" "helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " "of relying on private implementation details." msgstr "" +"在 Python 3.14 之前,舊式聯集是使用私有類別 ``typing._UnionGenericAlias`` 實" +"作的。這個類別不再被需要,但為了向後相容性而保留,並計劃將在 Python 3.17 中移" +"除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " +"和 :func:`typing.get_args`,或者依賴私有實作細節。" #: ../../deprecations/pending-removal-in-3.19.rst:2 msgid "Pending removal in Python 3.19" -msgstr "" +msgstr "Python 3.19 中待移除的項目" #: ../../deprecations/pending-removal-in-3.19.rst:6 msgid "" @@ -4519,36 +4608,40 @@ msgid "" "setting :attr:`~ctypes.Structure._pack_` but " "not :attr:`~ctypes.Structure._layout_` on non-Windows platforms." msgstr "" +"在非 Windows 平台上,透過設定 :attr:`~ctypes.Structure._pack_` 而沒有設" +"定 :attr:`~ctypes.Structure._layout_` 來隱式地切換到與 MSVC 相容的結構佈局。" #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 msgid "Pending removal in future versions" -msgstr "" +msgstr "未來版本中的待移除項目" #: ../../deprecations/pending-removal-in-future.rst:4 msgid "" "The following APIs will be removed in the future, although there is " "currently no date scheduled for their removal." -msgstr "" +msgstr "以下 API 將在未來被移除,雖然目前尚未安排移除日期。" #: ../../deprecations/pending-removal-in-future.rst:9 msgid "" "Nesting argument groups and nesting mutually exclusive groups are deprecated." -msgstr "" +msgstr "巢狀引數群組和巢狀互斥群組已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:11 msgid "" "Passing the undocumented keyword argument *prefix_chars* " "to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." msgstr "" +"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞" +"給 :meth:`~argparse.ArgumentParser.add_argument_group` 的做法現在已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:14 msgid "The :class:`argparse.FileType` type converter is deprecated." -msgstr "" +msgstr ":class:`argparse.FileType` 型別轉換器已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:18 msgid "``bool(NotImplemented)``." -msgstr "" +msgstr "``bool(NotImplemented)``。" #: ../../deprecations/pending-removal-in-future.rst:19 msgid "" @@ -4556,6 +4649,8 @@ msgid "" "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " "argument signature." msgstr "" +"產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" +"請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" #: ../../deprecations/pending-removal-in-future.rst:22 msgid "" @@ -4568,6 +4663,12 @@ msgid "" "and :keyword:`or`. In a future release it will be changed to a syntax " "error. (:gh:`87999`)" msgstr "" +"目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " +"1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" +"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " +"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" +"法錯誤。(:gh:`87999`)" #: ../../deprecations/pending-removal-in-future.rst:30 msgid "" @@ -4575,6 +4676,8 @@ msgid "" "these methods will be required to return an instance of a strict subclass " "of :class:`int`." msgstr "" +"``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" +"傳 :class:`int` 的嚴格子類別實例。" #: ../../deprecations/pending-removal-in-future.rst:33 msgid "" @@ -4582,6 +4685,8 @@ msgid "" "of :class:`float`: these methods will be required to return an instance " "of :class:`float`." msgstr "" +"回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" +"傳 :class:`float` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:36 msgid "" @@ -4589,10 +4694,12 @@ msgid "" "of :class:`complex`: these methods will be required to return an instance " "of :class:`complex`." msgstr "" +"回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" +"回傳 :class:`complex` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:39 msgid "Delegation of ``int()`` to ``__trunc__()`` method." -msgstr "" +msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" #: ../../deprecations/pending-removal-in-future.rst:40 msgid "" @@ -4601,6 +4708,8 @@ msgid "" "as a single positional argument. (Contributed by Serhiy Storchaka " "in :gh:`109218`.)" msgstr "" +"在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" +"它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" #: ../../deprecations/pending-removal-in-future.rst:45 msgid "" @@ -4609,79 +4718,95 @@ msgid "" "and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " "in :gh:`103636`.)" msgstr "" +":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" +"被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " +"Roshan 於 :gh:`103636` 貢獻。)" #: ../../deprecations/pending-removal-in-future.rst:50 msgid "" ":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " "(:gh:`133038`)" msgstr "" +":mod:`codecs`:請改用 :func:`open` 而非 :func:`codecs.open`。(:gh:`133038`)" #: ../../deprecations/pending-removal-in-future.rst:52 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" +":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" #: ../../deprecations/pending-removal-in-future.rst:55 msgid ":mod:`datetime`:" -msgstr "" +msgstr ":mod:`datetime`:" #: ../../deprecations/pending-removal-in-future.rst:57 msgid "" ":meth:`~datetime.datetime.utcnow`: use " "``datetime.datetime.now(tz=datetime.UTC)``." msgstr "" +":meth:`~datetime.datetime.utcnow`:請改用 " +"``datetime.datetime.now(tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:59 msgid "" ":meth:`~datetime.datetime.utcfromtimestamp`: use " "``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:62 msgid ":mod:`gettext`: Plural value must be an integer." -msgstr "" +msgstr ":mod:`gettext`:複數值必須是整數。" #: ../../deprecations/pending-removal-in-future.rst:66 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." msgstr "" +":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" +"用 *optimization* 參數。" #: ../../deprecations/pending-removal-in-future.rst:69 msgid ":mod:`importlib.metadata`:" -msgstr "" +msgstr ":mod:`importlib.metadata`:" #: ../../deprecations/pending-removal-in-future.rst:71 msgid "``EntryPoints`` tuple interface." -msgstr "" +msgstr "``EntryPoints`` 元組介面。" #: ../../deprecations/pending-removal-in-future.rst:72 msgid "Implicit ``None`` on return values." -msgstr "" +msgstr "回傳值上的隱式 ``None``。" #: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" +"用 :meth:`~logging.warning`。" #: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" +":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" #: ../../deprecations/pending-removal-in-future.rst:80 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." -msgstr "" +msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" #: ../../deprecations/pending-removal-in-future.rst:82 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." msgstr "" +":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" +"實例。" #: ../../deprecations/pending-removal-in-future.rst:85 msgid "" @@ -4691,109 +4816,123 @@ msgid "" "replacement strings can now only contain ASCII letters and digits and " "underscore. (Contributed by Serhiy Storchaka in :gh:`91760`.)" msgstr "" +":mod:`re`:現在對正規表示式中的數值群組參照和群組名稱用了更嚴格的規則。現在只" +"有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" +"包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" #: ../../deprecations/pending-removal-in-future.rst:92 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." -msgstr "" +msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" #: ../../deprecations/pending-removal-in-future.rst:94 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." msgstr "" +":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" +"棄用;請改用 *onexc* 參數。" #: ../../deprecations/pending-removal-in-future.rst:97 msgid ":mod:`ssl` options and protocols:" -msgstr "" +msgstr ":mod:`ssl` 選項和協定:" #: ../../deprecations/pending-removal-in-future.rst:99 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." -msgstr "" +msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:100 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " "and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " +"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" #: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.OP_NO_SSL*`` options" -msgstr "" +msgstr "``ssl.OP_NO_SSL*`` 選項" #: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.OP_NO_TLS*`` options" -msgstr "" +msgstr "``ssl.OP_NO_TLS*`` 選項" #: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.PROTOCOL_SSLv3``" -msgstr "" +msgstr "``ssl.PROTOCOL_SSLv3``" #: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.PROTOCOL_TLS``" -msgstr "" +msgstr "``ssl.PROTOCOL_TLS``" #: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.PROTOCOL_TLSv1``" -msgstr "" +msgstr "``ssl.PROTOCOL_TLSv1``" #: ../../deprecations/pending-removal-in-future.rst:108 msgid "``ssl.PROTOCOL_TLSv1_1``" -msgstr "" +msgstr "``ssl.PROTOCOL_TLSv1_1``" #: ../../deprecations/pending-removal-in-future.rst:109 msgid "``ssl.PROTOCOL_TLSv1_2``" -msgstr "" +msgstr "``ssl.PROTOCOL_TLSv1_2``" #: ../../deprecations/pending-removal-in-future.rst:110 msgid "``ssl.TLSVersion.SSLv3``" -msgstr "" +msgstr "``ssl.TLSVersion.SSLv3``" #: ../../deprecations/pending-removal-in-future.rst:111 msgid "``ssl.TLSVersion.TLSv1``" -msgstr "" +msgstr "``ssl.TLSVersion.TLSv1``" #: ../../deprecations/pending-removal-in-future.rst:112 msgid "``ssl.TLSVersion.TLSv1_1``" -msgstr "" +msgstr "``ssl.TLSVersion.TLSv1_1``" #: ../../deprecations/pending-removal-in-future.rst:114 msgid ":mod:`threading` methods:" -msgstr "" +msgstr ":mod:`threading` 方法:" #: ../../deprecations/pending-removal-in-future.rst:116 msgid "" ":meth:`!threading.Condition.notifyAll`: " "use :meth:`~threading.Condition.notify_all`." msgstr "" +":meth:`!threading.Condition.notifyAll`:請" +"用 :meth:`~threading.Condition.notify_all`。" #: ../../deprecations/pending-removal-in-future.rst:117 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." -msgstr "" +msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" #: ../../deprecations/pending-removal-in-future.rst:118 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " "use :attr:`threading.Thread.daemon` attribute." msgstr "" +":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" +"用 :attr:`threading.Thread.daemon` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:120 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " "use :attr:`threading.Thread.name` attribute." msgstr "" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" +"用 :attr:`threading.Thread.name` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:122 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" +":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" #: ../../deprecations/pending-removal-in-future.rst:123 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." -msgstr "" +msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" #: ../../deprecations/pending-removal-in-future.rst:125 msgid ":class:`typing.Text` (:gh:`92332`)." -msgstr "" +msgstr ":class:`typing.Text` (:gh:`92332`)。" #: ../../deprecations/pending-removal-in-future.rst:127 msgid "" @@ -4802,68 +4941,74 @@ msgid "" "this private class, a compatibility shim will be provided until at least " "Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" msgstr "" +"內部類別 ``typing._UnionGenericAlias`` 不再用於實作 :class:`typing.Union`。為" +"了保持與此私有類別使用者的相容性,直到至少 Python 3.17 都將提供一個相容性 " +"shim。(由 Jelle Zijlstra 於 :gh:`105499` 貢獻。)" #: ../../deprecations/pending-removal-in-future.rst:132 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." msgstr "" +":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" +"被棄用。" #: ../../deprecations/pending-removal-in-future.rst:135 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" +":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" #: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splitattr()``" -msgstr "" +msgstr "``splitattr()``" #: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splithost()``" -msgstr "" +msgstr "``splithost()``" #: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitnport()``" -msgstr "" +msgstr "``splitnport()``" #: ../../deprecations/pending-removal-in-future.rst:140 msgid "``splitpasswd()``" -msgstr "" +msgstr "``splitpasswd()``" #: ../../deprecations/pending-removal-in-future.rst:141 msgid "``splitport()``" -msgstr "" +msgstr "``splitport()``" #: ../../deprecations/pending-removal-in-future.rst:142 msgid "``splitquery()``" -msgstr "" +msgstr "``splitquery()``" #: ../../deprecations/pending-removal-in-future.rst:143 msgid "``splittag()``" -msgstr "" +msgstr "``splittag()``" #: ../../deprecations/pending-removal-in-future.rst:144 msgid "``splittype()``" -msgstr "" +msgstr "``splittype()``" #: ../../deprecations/pending-removal-in-future.rst:145 msgid "``splituser()``" -msgstr "" +msgstr "``splituser()``" #: ../../deprecations/pending-removal-in-future.rst:146 msgid "``splitvalue()``" -msgstr "" +msgstr "``splitvalue()``" #: ../../deprecations/pending-removal-in-future.rst:147 msgid "``to_bytes()``" -msgstr "" +msgstr "``to_bytes()``" #: ../../deprecations/pending-removal-in-future.rst:149 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." -msgstr "" +msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" #: ../../deprecations/pending-removal-in-future.rst:152 msgid "" @@ -4872,16 +5017,21 @@ msgid "" "release it will always return ``True``. Prefer explicit ``len(elem)`` or " "``elem is not None`` tests instead." msgstr "" +":mod:`xml.etree.ElementTree`:已棄用" +"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" +"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" #: ../../deprecations/pending-removal-in-future.rst:157 msgid "" ":func:`sys._clear_type_cache` is deprecated: " "use :func:`sys._clear_internal_caches` instead." msgstr "" +":func:`sys._clear_type_cache` 已被棄用:請改" +"用 :func:`sys._clear_internal_caches`。" #: ../../whatsnew/3.14.rst:2817 msgid "CPython bytecode changes" -msgstr "" +msgstr "CPython 位元組碼變更" #: ../../whatsnew/3.14.rst:2819 msgid "" @@ -4891,7 +5041,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:2824 msgid "C API changes" -msgstr "" +msgstr "C API 變更" #: ../../whatsnew/3.14.rst:2829 msgid "" @@ -4907,59 +5057,59 @@ msgstr "" #: ../../whatsnew/3.14.rst:2835 msgid ":c:func:`PyUnicodeWriter_Create`" -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_Create`" #: ../../whatsnew/3.14.rst:2836 msgid ":c:func:`PyUnicodeWriter_DecodeUTF8Stateful`" -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_DecodeUTF8Stateful`" #: ../../whatsnew/3.14.rst:2837 msgid ":c:func:`PyUnicodeWriter_Discard`" -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_Discard`" #: ../../whatsnew/3.14.rst:2838 msgid ":c:func:`PyUnicodeWriter_Finish`" -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_Finish`" #: ../../whatsnew/3.14.rst:2839 msgid ":c:func:`PyUnicodeWriter_Format`" -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_Format`" #: ../../whatsnew/3.14.rst:2840 msgid ":c:func:`PyUnicodeWriter_WriteASCII`" -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_WriteASCII`" #: ../../whatsnew/3.14.rst:2841 msgid ":c:func:`PyUnicodeWriter_WriteChar`" -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_WriteChar`" #: ../../whatsnew/3.14.rst:2842 msgid ":c:func:`PyUnicodeWriter_WriteRepr`" -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_WriteRepr`" #: ../../whatsnew/3.14.rst:2843 msgid ":c:func:`PyUnicodeWriter_WriteStr`" -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_WriteStr`" #: ../../whatsnew/3.14.rst:2844 msgid ":c:func:`PyUnicodeWriter_WriteSubstring`" -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_WriteSubstring`" #: ../../whatsnew/3.14.rst:2845 msgid ":c:func:`PyUnicodeWriter_WriteUCS4`" -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_WriteUCS4`" #: ../../whatsnew/3.14.rst:2846 msgid ":c:func:`PyUnicodeWriter_WriteUTF8`" -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_WriteUTF8`" #: ../../whatsnew/3.14.rst:2847 msgid ":c:func:`PyUnicodeWriter_WriteWideChar`" -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_WriteWideChar`" #: ../../whatsnew/3.14.rst:2849 msgid "(Contributed by Victor Stinner in :gh:`119182`.)" -msgstr "" +msgstr "(由 Victor Stinner 於 :gh:`119182` 貢獻。)" #: ../../whatsnew/3.14.rst:2851 msgid "" @@ -4984,39 +5134,39 @@ msgstr "" #: ../../whatsnew/3.14.rst:2863 msgid ":c:func:`PyLong_AsInt32`" -msgstr "" +msgstr ":c:func:`PyLong_AsInt32`" #: ../../whatsnew/3.14.rst:2864 msgid ":c:func:`PyLong_AsInt64`" -msgstr "" +msgstr ":c:func:`PyLong_AsInt64`" #: ../../whatsnew/3.14.rst:2865 msgid ":c:func:`PyLong_AsUInt32`" -msgstr "" +msgstr ":c:func:`PyLong_AsUInt32`" #: ../../whatsnew/3.14.rst:2866 msgid ":c:func:`PyLong_AsUInt64`" -msgstr "" +msgstr ":c:func:`PyLong_AsUInt64`" #: ../../whatsnew/3.14.rst:2867 msgid ":c:func:`PyLong_FromInt32`" -msgstr "" +msgstr ":c:func:`PyLong_FromInt32`" #: ../../whatsnew/3.14.rst:2868 msgid ":c:func:`PyLong_FromInt64`" -msgstr "" +msgstr ":c:func:`PyLong_FromInt64`" #: ../../whatsnew/3.14.rst:2869 msgid ":c:func:`PyLong_FromUInt32`" -msgstr "" +msgstr ":c:func:`PyLong_FromUInt32`" #: ../../whatsnew/3.14.rst:2870 msgid ":c:func:`PyLong_FromUInt64`" -msgstr "" +msgstr ":c:func:`PyLong_FromUInt64`" #: ../../whatsnew/3.14.rst:2872 msgid "(Contributed by Victor Stinner in :gh:`120389`.)" -msgstr "" +msgstr "(由 Victor Stinner 於 :gh:`120389` 貢獻。)" #: ../../whatsnew/3.14.rst:2874 msgid "" @@ -5039,19 +5189,19 @@ msgstr "" #: ../../whatsnew/3.14.rst:2884 msgid ":c:func:`PyConfig_Get`" -msgstr "" +msgstr ":c:func:`PyConfig_Get`" #: ../../whatsnew/3.14.rst:2885 msgid ":c:func:`PyConfig_GetInt`" -msgstr "" +msgstr ":c:func:`PyConfig_GetInt`" #: ../../whatsnew/3.14.rst:2886 msgid ":c:func:`PyConfig_Set`" -msgstr "" +msgstr ":c:func:`PyConfig_Set`" #: ../../whatsnew/3.14.rst:2887 msgid ":c:func:`PyConfig_Names`" -msgstr "" +msgstr ":c:func:`PyConfig_Names`" #: ../../whatsnew/3.14.rst:2891 msgid "Add functions to configure the Python initialization (:pep:`741`):" @@ -5059,59 +5209,59 @@ msgstr "" #: ../../whatsnew/3.14.rst:2893 msgid ":c:func:`Py_InitializeFromInitConfig`" -msgstr "" +msgstr ":c:func:`Py_InitializeFromInitConfig`" #: ../../whatsnew/3.14.rst:2894 msgid ":c:func:`PyInitConfig_AddModule`" -msgstr "" +msgstr ":c:func:`PyInitConfig_AddModule`" #: ../../whatsnew/3.14.rst:2895 msgid ":c:func:`PyInitConfig_Create`" -msgstr "" +msgstr ":c:func:`PyInitConfig_Create`" #: ../../whatsnew/3.14.rst:2896 msgid ":c:func:`PyInitConfig_Free`" -msgstr "" +msgstr ":c:func:`PyInitConfig_Free`" #: ../../whatsnew/3.14.rst:2897 msgid ":c:func:`PyInitConfig_FreeStrList`" -msgstr "" +msgstr ":c:func:`PyInitConfig_FreeStrList`" #: ../../whatsnew/3.14.rst:2898 msgid ":c:func:`PyInitConfig_GetError`" -msgstr "" +msgstr ":c:func:`PyInitConfig_GetError`" #: ../../whatsnew/3.14.rst:2899 msgid ":c:func:`PyInitConfig_GetExitCode`" -msgstr "" +msgstr ":c:func:`PyInitConfig_GetExitCode`" #: ../../whatsnew/3.14.rst:2900 msgid ":c:func:`PyInitConfig_GetInt`" -msgstr "" +msgstr ":c:func:`PyInitConfig_GetInt`" #: ../../whatsnew/3.14.rst:2901 msgid ":c:func:`PyInitConfig_GetStr`" -msgstr "" +msgstr ":c:func:`PyInitConfig_GetStr`" #: ../../whatsnew/3.14.rst:2902 msgid ":c:func:`PyInitConfig_GetStrList`" -msgstr "" +msgstr ":c:func:`PyInitConfig_GetStrList`" #: ../../whatsnew/3.14.rst:2903 msgid ":c:func:`PyInitConfig_HasOption`" -msgstr "" +msgstr ":c:func:`PyInitConfig_HasOption`" #: ../../whatsnew/3.14.rst:2904 msgid ":c:func:`PyInitConfig_SetInt`" -msgstr "" +msgstr ":c:func:`PyInitConfig_SetInt`" #: ../../whatsnew/3.14.rst:2905 msgid ":c:func:`PyInitConfig_SetStr`" -msgstr "" +msgstr ":c:func:`PyInitConfig_SetStr`" #: ../../whatsnew/3.14.rst:2906 msgid ":c:func:`PyInitConfig_SetStrList`" -msgstr "" +msgstr ":c:func:`PyInitConfig_SetStrList`" #: ../../whatsnew/3.14.rst:2910 msgid "" @@ -5120,31 +5270,31 @@ msgstr "" #: ../../whatsnew/3.14.rst:2912 msgid ":c:func:`PyLong_GetNativeLayout`" -msgstr "" +msgstr ":c:func:`PyLong_GetNativeLayout`" #: ../../whatsnew/3.14.rst:2913 msgid ":c:func:`PyLong_Export`" -msgstr "" +msgstr ":c:func:`PyLong_Export`" #: ../../whatsnew/3.14.rst:2914 msgid ":c:func:`PyLong_FreeExport`" -msgstr "" +msgstr ":c:func:`PyLong_FreeExport`" #: ../../whatsnew/3.14.rst:2915 msgid ":c:func:`PyLongWriter_Create`" -msgstr "" +msgstr ":c:func:`PyLongWriter_Create`" #: ../../whatsnew/3.14.rst:2916 msgid ":c:func:`PyLongWriter_Finish`" -msgstr "" +msgstr ":c:func:`PyLongWriter_Finish`" #: ../../whatsnew/3.14.rst:2917 msgid ":c:func:`PyLongWriter_Discard`" -msgstr "" +msgstr ":c:func:`PyLongWriter_Discard`" #: ../../whatsnew/3.14.rst:2919 msgid "(Contributed by Sergey B Kirpichev and Victor Stinner in :gh:`102471`.)" -msgstr "" +msgstr "(由 Sergey B Kirpichev 和 Victor Stinner 於 :gh:`102471` 貢獻。)" #: ../../whatsnew/3.14.rst:2921 msgid "" @@ -5308,7 +5458,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:3028 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:6 msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." -msgstr "" +msgstr ":c:func:`!_PyBytes_Join`:請改用 :c:func:`PyBytes_Join`。" #: ../../whatsnew/3.14.rst:3029 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 @@ -5316,6 +5466,8 @@ msgid "" ":c:func:`!_PyDict_GetItemStringWithError`: " "use :c:func:`PyDict_GetItemStringRef`." msgstr "" +":c:func:`!_PyDict_GetItemStringWithError`:請改" +"用 :c:func:`PyDict_GetItemStringRef`。" #: ../../whatsnew/3.14.rst:3030 msgid ":c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`." @@ -5324,7 +5476,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:3031 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." -msgstr "" +msgstr ":c:func:`!_PyLong_Sign()`:請改用 :c:func:`PyLong_GetSign`。" #: ../../whatsnew/3.14.rst:3032 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 @@ -5332,6 +5484,8 @@ msgid "" ":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: " "use :c:func:`PyLongWriter_Create`." msgstr "" +":c:func:`!_PyLong_FromDigits` 和 :c:func:`!_PyLong_New`:請改" +"用 :c:func:`PyLongWriter_Create`。" #: ../../whatsnew/3.14.rst:3034 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:12 @@ -5339,11 +5493,13 @@ msgid "" ":c:func:`!_PyThreadState_UncheckedGet`: " "use :c:func:`PyThreadState_GetUnchecked`." msgstr "" +":c:func:`!_PyThreadState_UncheckedGet`:請改" +"用 :c:func:`PyThreadState_GetUnchecked`。" #: ../../whatsnew/3.14.rst:3035 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." -msgstr "" +msgstr ":c:func:`!_PyUnicode_AsString`:請改用 :c:func:`PyUnicode_AsUTF8`。" #: ../../whatsnew/3.14.rst:3036 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 @@ -5351,6 +5507,8 @@ msgid "" ":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " "with :c:func:`writer = PyUnicodeWriter_Create(0) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Init`:將 ``_PyUnicodeWriter_Init(&writer)`` 替換" +"為 :c:func:`writer = PyUnicodeWriter_Create(0) `。" #: ../../whatsnew/3.14.rst:3039 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:17 @@ -5359,6 +5517,8 @@ msgid "" "``_PyUnicodeWriter_Finish(&writer)`` " "with :c:func:`PyUnicodeWriter_Finish(writer) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Finish`:將 ``_PyUnicodeWriter_Finish(&writer)`` " +"替換為 :c:func:`PyUnicodeWriter_Finish(writer) `。" #: ../../whatsnew/3.14.rst:3042 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:20 @@ -5367,6 +5527,9 @@ msgid "" "``_PyUnicodeWriter_Dealloc(&writer)`` " "with :c:func:`PyUnicodeWriter_Discard(writer) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Dealloc`:將 " +"``_PyUnicodeWriter_Dealloc(&writer)`` 替換" +"為 :c:func:`PyUnicodeWriter_Discard(writer) `。" #: ../../whatsnew/3.14.rst:3045 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:23 @@ -5376,6 +5539,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteChar`:將 " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " +"`。" #: ../../whatsnew/3.14.rst:3048 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:26 @@ -5385,6 +5552,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteStr(writer, str) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteStr`:將 " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteStr(writer, str) " +"`。" #: ../../whatsnew/3.14.rst:3051 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:29 @@ -5394,6 +5565,10 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`:將 " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`。" #: ../../whatsnew/3.14.rst:3054 msgid "" @@ -5411,16 +5586,20 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteLatin1String`:將 " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`。" #: ../../whatsnew/3.14.rst:3060 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." -msgstr "" +msgstr ":c:func:`!_Py_HashPointer`:請改用 :c:func:`Py_HashPointer`。" #: ../../whatsnew/3.14.rst:3061 #: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." -msgstr "" +msgstr ":c:func:`!_Py_fopen_obj`:請改用 :c:func:`Py_fopen`。" #: ../../whatsnew/3.14.rst:3063 msgid "" @@ -5434,6 +5613,8 @@ msgid "" "The :c:func:`PyImport_ImportModuleNoBlock`: " "Use :c:func:`PyImport_ImportModule` instead." msgstr "" +":c:func:`PyImport_ImportModuleNoBlock`:請改" +"用 :c:func:`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 msgid "" @@ -5442,17 +5623,24 @@ msgid "" "`__ can be used to " "get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." msgstr "" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" +"用 :c:func:`PyWeakref_GetRef`。可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.12 和更早版本取" +"得 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 msgid "" ":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " "Use :c:type:`wchar_t` instead." msgstr "" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" +"用 :c:type:`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 msgid "" ":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." msgstr "" +":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 msgid "" @@ -5460,11 +5648,15 @@ msgid "" "Note that some codecs (for example, \"base64\") may return a type other " "than :class:`str`, such as :class:`bytes`." msgstr "" +":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`;請注" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`str` 的型別,例" +"如 :class:`bytes`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid "" ":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." msgstr "" +":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 msgid "" @@ -5472,16 +5664,21 @@ msgid "" "Note that some codecs (for example, \"base64\") may return a type other " "than :class:`bytes`, such as :class:`str`." msgstr "" +":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`;請注" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`bytes` 的型別,例" +"如 :class:`str`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 msgid "Python initialization functions, deprecated in Python 3.13:" -msgstr "" +msgstr "Python 初始化函式,自 Python 3.13 起已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:24 msgid "" ":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " "` (:data:`sys.path`) instead." msgstr "" +":c:func:`Py_GetPath`:請改用 :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:27 msgid "" @@ -5490,6 +5687,10 @@ msgid "" "Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) " "if :ref:`virtual environments ` need to be handled." msgstr "" +":c:func:`Py_GetPrefix`:請改用 :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`)。如果需要處理\\ :ref:`虛擬環境 " +"`,請改用 :c:func:`PyConfig_Get(\"prefix\") ` " +"(:data:`sys.prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:32 msgid "" @@ -5499,135 +5700,177 @@ msgid "" "(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " "be handled." msgstr "" +":c:func:`Py_GetExecPrefix`:請改" +"用 :c:func:`PyConfig_Get(\"base_exec_prefix\") ` " +"(:data:`sys.base_exec_prefix`)。如果需要處理\\ :ref:`虛擬環境 `,請" +"改用 :c:func:`PyConfig_Get(\"exec_prefix\") ` " +"(:data:`sys.exec_prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:38 msgid "" ":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." msgstr "" +":c:func:`Py_GetProgramFullPath`:請改" +"用 :c:func:`PyConfig_Get(\"executable\") ` " +"(:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:41 msgid "" ":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." msgstr "" +":c:func:`Py_GetProgramName`:請改用 :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:44 msgid "" ":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " "` or the :envvar:`PYTHONHOME` environment variable instead." msgstr "" +":c:func:`Py_GetPythonHome`:請改用 :c:func:`PyConfig_Get(\"home\") " +"` 或 :envvar:`PYTHONHOME` 環境變數。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:48 msgid "" "The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." msgstr "" +"`pythoncapi-compat 專案 `__ 可" +"以用來為 Python 3.13 和更早版本取得 :c:func:`PyConfig_Get`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:52 msgid "" "Functions to configure Python's initialization, deprecated in Python 3.11:" -msgstr "" +msgstr "用於配置 Python 初始化的函式,自 Python 3.11 起已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:54 msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." -msgstr "" +msgstr ":c:func:`!PySys_SetArgvEx()`:請改用 :c:member:`PyConfig.argv`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:56 msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." -msgstr "" +msgstr ":c:func:`!PySys_SetArgv()`:請改用 :c:member:`PyConfig.argv`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:58 msgid "" ":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " "instead." msgstr "" +":c:func:`!Py_SetProgramName()`:請改用 :c:member:`PyConfig.program_name`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:60 msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." -msgstr "" +msgstr ":c:func:`!Py_SetPythonHome()`:請改用 :c:member:`PyConfig.home`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:62 msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " +"和 :data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:65 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used " "with :c:type:`PyConfig` instead." msgstr "" +"應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:68 msgid "Global configuration variables:" -msgstr "" +msgstr "全域配置變數:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:70 msgid "" ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` " "or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." msgstr "" +":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug` " +"或 :c:func:`PyConfig_Get(\"parser_debug\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:73 msgid "" ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` " "or :c:func:`PyConfig_Get(\"verbose\") ` instead." msgstr "" +":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose` " +"或 :c:func:`PyConfig_Get(\"verbose\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:76 msgid "" ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` " "or :c:func:`PyConfig_Get(\"quiet\") ` instead." msgstr "" +":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet` " +"或 :c:func:`PyConfig_Get(\"quiet\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:79 msgid "" ":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` " "or :c:func:`PyConfig_Get(\"interactive\") ` instead." msgstr "" +":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive` " +"或 :c:func:`PyConfig_Get(\"interactive\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:82 msgid "" ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` " "or :c:func:`PyConfig_Get(\"inspect\") ` instead." msgstr "" +":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect` " +"或 :c:func:`PyConfig_Get(\"inspect\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:85 msgid "" ":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " "or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." msgstr "" +":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level` " +"或 :c:func:`PyConfig_Get(\"optimization_level\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:88 msgid "" ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` " "or :c:func:`PyConfig_Get(\"site_import\") ` instead." msgstr "" +":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import` " +"或 :c:func:`PyConfig_Get(\"site_import\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:91 msgid "" ":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " "or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." msgstr "" +":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning` " +"或 :c:func:`PyConfig_Get(\"bytes_warning\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:94 msgid "" ":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " "or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" +":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings` " +"或 :c:func:`PyConfig_Get(\"pathconfig_warnings\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:97 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "or :c:func:`PyConfig_Get(\"use_environment\") ` instead." msgstr "" +":c:var:`Py_IgnoreEnvironmentFlag`:請改" +"用 :c:member:`PyConfig.use_environment` " +"或 :c:func:`PyConfig_Get(\"use_environment\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:100 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." msgstr "" +":c:var:`Py_DontWriteBytecodeFlag`:請改" +"用 :c:member:`PyConfig.write_bytecode` " +"或 :c:func:`PyConfig_Get(\"write_bytecode\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:103 msgid "" @@ -5635,12 +5878,17 @@ msgid "" "Use :c:member:`PyConfig.user_site_directory` " "or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." msgstr "" +":c:var:`Py_NoUserSiteDirectory`:請改" +"用 :c:member:`PyConfig.user_site_directory` " +"或 :c:func:`PyConfig_Get(\"user_site_directory\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:106 msgid "" ":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " "or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." msgstr "" +":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio` " +"或 :c:func:`PyConfig_Get(\"buffered_stdio\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:109 msgid "" @@ -5648,12 +5896,17 @@ msgid "" "and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " "` instead." msgstr "" +":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " +"和 :c:member:`PyConfig.hash_seed` 或 :c:func:`PyConfig_Get(\"hash_seed\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:113 msgid "" ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` " "or :c:func:`PyConfig_Get(\"isolated\") ` instead." msgstr "" +":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated` " +"或 :c:func:`PyConfig_Get(\"isolated\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:116 msgid "" @@ -5662,6 +5915,9 @@ msgid "" "or :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") ` " "instead." msgstr "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" +"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding` " +"或 :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:119 msgid "" @@ -5669,6 +5925,9 @@ msgid "" "Use :c:member:`PyConfig.legacy_windows_stdio` " "or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." msgstr "" +":c:var:`Py_LegacyWindowsStdioFlag`:請改" +"用 :c:member:`PyConfig.legacy_windows_stdio` " +"或 :c:func:`PyConfig_Get(\"legacy_windows_stdio\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:122 msgid "" @@ -5677,6 +5936,10 @@ msgid "" "Use :c:member:`PyConfig.filesystem_encoding` " "or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." msgstr "" +":c:var:`!Py_FileSystemDefaultEncoding`、:c:var:`!" +"Py_HasFileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding` " +"或 :c:func:`PyConfig_Get(\"filesystem_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:125 msgid "" @@ -5684,6 +5947,9 @@ msgid "" "Use :c:member:`PyConfig.filesystem_errors` " "or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." msgstr "" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" +"用 :c:member:`PyConfig.filesystem_errors` " +"或 :c:func:`PyConfig_Get(\"filesystem_errors\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:128 msgid "" @@ -5691,6 +5957,9 @@ msgid "" "or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. " "(see :c:func:`Py_PreInitialize`)" msgstr "" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode` " +"或 :c:func:`PyConfig_Get(\"utf8_mode\") `。(請參" +"閱 :c:func:`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:133 msgid "" @@ -5698,22 +5967,24 @@ msgid "" "with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can " "be used to get these options at runtime." msgstr "" +"應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API 來設定" +"這些選項。或者也可以使用 :c:func:`PyConfig_Get` 在執行時取得這些選項。" #: ../../deprecations/c-api-pending-removal-in-3.16.rst:4 msgid "The bundled copy of ``libmpdec``." -msgstr "" +msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:2 msgid "Pending removal in Python 3.18" -msgstr "" +msgstr "Python 3.18 中待移除的項目" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:4 msgid "Deprecated private functions (:gh:`128863`):" -msgstr "" +msgstr "被棄用的私有函式 (:gh:`128863`):" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 msgid ":c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`." -msgstr "" +msgstr ":c:func:`!_PyDict_Pop()`:請改用 :c:func:`PyDict_Pop`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:32 msgid "" @@ -5722,114 +5993,129 @@ msgid "" "with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteASCIIString`:將 " +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` 替換" +"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:38 msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." -msgstr "" +msgstr ":c:func:`!_PyUnicodeWriter_Prepare`:(無替代方案)。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." -msgstr "" +msgstr ":c:func:`!_PyUnicodeWriter_PrepareKind`:(無替代方案)。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:43 msgid "" "The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older." msgstr "" +"可以使用 `pythoncapi-compat project `__ 來取得這些於 Python 3.13 及更早版本的新公開函式。" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" "The following APIs are deprecated and will be removed, although there is " "currently no date scheduled for their removal." -msgstr "" +msgstr "下列 API 已被棄用並將會被移除,不過目前尚未訂定移除日期。" #: ../../deprecations/c-api-pending-removal-in-future.rst:7 msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." -msgstr "" +msgstr ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`:自 Python 3.8 起不再需要" #: ../../deprecations/c-api-pending-removal-in-future.rst:9 msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." -msgstr "" +msgstr ":c:func:`PyErr_Fetch`:請改用 :c:func:`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:11 msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" +":c:func:`PyErr_NormalizeException`:請改" +"用 :c:func:`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" ":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." -msgstr "" +msgstr ":c:func:`PyErr_Restore`:請改用 :c:func:`PyErr_SetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:15 msgid "" ":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " "instead." msgstr "" +":c:func:`PyModule_GetFilename`:請改用 :c:func:`PyModule_GetFilenameObject`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:17 msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." -msgstr "" +msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" ":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " "and :c:func:`PySlice_AdjustIndices` instead." msgstr "" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " +"和 :c:func:`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" -msgstr "" +msgstr ":c:func:`PyUnicode_READY`:自 Python 3.12 起不再需要" #: ../../deprecations/c-api-pending-removal-in-future.rst:23 msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." -msgstr "" +msgstr ":c:func:`!PyErr_Display`:請改用 :c:func:`PyErr_DisplayException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:25 msgid "" ":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " "instead." msgstr "" +":c:func:`!_PyErr_ChainExceptions`:請改用 ``_PyErr_ChainExceptions1``。" #: ../../deprecations/c-api-pending-removal-in-future.rst:27 msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" +"叫 :c:func:`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:29 msgid "Thread Local Storage (TLS) API:" -msgstr "" +msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" #: ../../deprecations/c-api-pending-removal-in-future.rst:31 msgid "" ":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." -msgstr "" +msgstr ":c:func:`PyThread_create_key`:請改用 :c:func:`PyThread_tss_alloc`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:33 msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." -msgstr "" +msgstr ":c:func:`PyThread_delete_key`:請改用 :c:func:`PyThread_tss_free`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:35 msgid "" ":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." -msgstr "" +msgstr ":c:func:`PyThread_set_key_value`:請改用 :c:func:`PyThread_tss_set`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid "" ":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." -msgstr "" +msgstr ":c:func:`PyThread_get_key_value`:請改用 :c:func:`PyThread_tss_get`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:39 msgid "" ":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " "instead." msgstr "" +":c:func:`PyThread_delete_key_value`:請改用 :c:func:`PyThread_tss_delete`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:41 msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." -msgstr "" +msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" #: ../../whatsnew/3.14.rst:3081 msgid "" @@ -5862,7 +6148,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:3101 msgid "Build Changes" -msgstr "" +msgstr "建置變更" #: ../../whatsnew/3.14.rst:3103 msgid "" @@ -5956,17 +6242,17 @@ msgstr "" #: ../../whatsnew/3.14.rst:3167 msgid "Porting to Python 3.14" -msgstr "" +msgstr "移植至 Python 3.14" #: ../../whatsnew/3.14.rst:3169 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." -msgstr "" +msgstr "本節列出了前面描述的更改以及可能需要更改程式碼的其他錯誤修復。" #: ../../whatsnew/3.14.rst:3174 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.14.rst:3176 msgid "" @@ -6005,7 +6291,7 @@ msgstr "" #: ../../whatsnew/3.14.rst:3204 msgid "Changes in the C API" -msgstr "" +msgstr "C API 中的改動" #: ../../whatsnew/3.14.rst:3206 msgid "" diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index eef8f7784ef..b4524edadd8 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -1,12 +1,12 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -665,8 +665,8 @@ msgid "" "string formatting with any of Python's many dictionary-like objects such " "as :class:`~collections.defaultdict`, :class:`~shelve.Shelf`, :class:`~configparser.ConfigParser`, " "or :mod:`dbm`. It is also useful with custom :class:`dict` subclasses that " -"normalize keys before look-up or that supply a :meth:`__missing__` method " -"for unknown keys::" +"normalize keys before look-up or that supply a :meth:`~object.__missing__` " +"method for unknown keys::" msgstr "" #: ../../whatsnew/3.2.rst:463 diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index c77caa6c6fe..fb111a823ee 100644 --- a/whatsnew/3.3.po +++ b/whatsnew/3.3.po @@ -1,10 +1,10 @@ -# Copyright (C) 2001-2025, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 71ff532e883..1b81d3cb2fc 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -1,12 +1,12 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-04 00:15+0000\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -71,8 +71,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:89 msgid "" -"command line option for :ref:`isolated mode ` (:" -"issue:`16499`)." +"command line option for :ref:`isolated mode ` " +"(:issue:`16499`)." msgstr "" #: ../../whatsnew/3.4.rst:91 @@ -83,8 +83,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:93 msgid "" -":ref:`A ModuleSpec Type ` for the Import System (:pep:" -"`451`). (Affects importer authors.)" +":ref:`A ModuleSpec Type ` for the Import System " +"(:pep:`451`). (Affects importer authors.)" msgstr "" #: ../../whatsnew/3.4.rst:95 @@ -102,35 +102,35 @@ msgid "" ":mod:`asyncio`: :ref:`New provisional API for asynchronous IO ` (:pep:`3156`)." msgstr "" -":mod:`asyncio`: :ref:`新的用於非同步 IO 的臨時 API ` (:" -"pep:`3156`)。" +":mod:`asyncio`: :ref:`新的用於非同步 IO 的臨時 API ` " +"(:pep:`3156`)。" #: ../../whatsnew/3.4.rst:102 msgid "" ":mod:`ensurepip`: :ref:`Bootstrapping the pip installer ` (:pep:`453`)." msgstr "" -":mod:`ensurepip`: :ref:`初始建置 pip 安裝程式 ` (:pep:" -"`453`)。" +":mod:`ensurepip`: :ref:`初始建置 pip 安裝程式 ` " +"(:pep:`453`)。" #: ../../whatsnew/3.4.rst:104 msgid "" -":mod:`enum`: :ref:`Support for enumeration types ` (:pep:" -"`435`)." +":mod:`enum`: :ref:`Support for enumeration types ` " +"(:pep:`435`)." msgstr ":mod:`enum`: :ref:`支援列舉型別 ` (:pep:`435`)。" #: ../../whatsnew/3.4.rst:106 msgid "" -":mod:`pathlib`: :ref:`Object-oriented filesystem paths ` (:" -"pep:`428`)." +":mod:`pathlib`: :ref:`Object-oriented filesystem paths ` " +"(:pep:`428`)." msgstr "" ":mod:`pathlib`: :ref:`物件導向檔案系統路徑 ` (:pep:`428`)。" #: ../../whatsnew/3.4.rst:108 msgid "" ":mod:`selectors`: :ref:`High-level and efficient I/O multiplexing `, built upon the :mod:`select` module primitives (part of :pep:" -"`3156`)." +"selectors>`, built upon the :mod:`select` module primitives (part " +"of :pep:`3156`)." msgstr "" #: ../../whatsnew/3.4.rst:111 @@ -144,8 +144,8 @@ msgid "" ":mod:`tracemalloc`: :ref:`Trace Python memory allocations ` (:pep:`454`)." msgstr "" -":mod:`tracemalloc`: :ref:`追蹤 Python 記憶體配置 ` (:" -"pep:`454`)。" +":mod:`tracemalloc`: :ref:`追蹤 Python 記憶體配置 ` " +"(:pep:`454`)。" #: ../../whatsnew/3.4.rst:116 msgid "Significantly improved library modules:" @@ -153,8 +153,8 @@ msgstr "顯著改進的函式庫模組:" #: ../../whatsnew/3.4.rst:118 msgid "" -":ref:`Single-dispatch generic functions ` in :mod:" -"`functools` (:pep:`443`)." +":ref:`Single-dispatch generic functions ` " +"in :mod:`functools` (:pep:`443`)." msgstr "" #: ../../whatsnew/3.4.rst:120 @@ -172,10 +172,10 @@ msgstr "" #: ../../whatsnew/3.4.rst:123 msgid "" -":mod:`email` has a new submodule, :mod:`~email.contentmanager`, and a new :" -"mod:`~email.message.Message` subclass (:class:`~email.message.EmailMessage`) " -"that :ref:`simplify MIME handling ` (:issue:" -"`18891`)." +":mod:`email` has a new submodule, :mod:`~email.contentmanager`, and a " +"new :mod:`~email.message.Message` subclass " +"(:class:`~email.message.EmailMessage`) that :ref:`simplify MIME handling " +"` (:issue:`18891`)." msgstr "" #: ../../whatsnew/3.4.rst:127 @@ -195,8 +195,8 @@ msgstr "安全性改進:" #: ../../whatsnew/3.4.rst:134 msgid "" -":ref:`Secure and interchangeable hash algorithm ` (:pep:" -"`456`)." +":ref:`Secure and interchangeable hash algorithm ` " +"(:pep:`456`)." msgstr "" #: ../../whatsnew/3.4.rst:136 @@ -207,11 +207,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:138 msgid "" -"New command line option for :ref:`isolated mode `, (:" -"issue:`16499`)." +"New command line option for :ref:`isolated mode `, " +"(:issue:`16499`)." msgstr "" -"用於\\ :ref:`隔離模式 `\\ 的新命令列選項 (:issue:" -"`16499`)。" +"用於\\ :ref:`隔離模式 `\\ 的新命令列選項 " +"(:issue:`16499`)。" #: ../../whatsnew/3.4.rst:140 msgid "" @@ -259,9 +259,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:155 msgid "" "All modules in the standard library that support SSL now support server " -"certificate verification, including hostname matching (:func:`!ssl." -"match_hostname`) and CRLs (Certificate Revocation lists, see :func:`ssl." -"SSLContext.load_verify_locations`)." +"certificate verification, including hostname matching (:func:`!" +"ssl.match_hostname`) and CRLs (Certificate Revocation lists, " +"see :func:`ssl.SSLContext.load_verify_locations`)." msgstr "" #: ../../whatsnew/3.4.rst:160 @@ -391,8 +391,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:247 msgid "" "However, as this migration is currently still incomplete, the legacy " -"versions of those guides remaining available as :ref:`install-index` and :" -"ref:`setuptools-index`." +"versions of those guides remaining available as :ref:`install-index` " +"and :ref:`setuptools-index`." msgstr "" #: ../../whatsnew/3.4.rst:253 @@ -433,10 +433,8 @@ msgid ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" msgstr ":func:`os.get_handle_inheritable`、:func:`os.set_handle_inheritable`" #: ../../whatsnew/3.4.rst:274 -msgid "" -":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" -msgstr "" -":meth:`socket.socket.get_inheritable`、:meth:`socket.socket.set_inheritable`" +msgid ":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" +msgstr ":meth:`socket.socket.get_inheritable`、:meth:`socket.socket.set_inheritable`" #: ../../whatsnew/3.4.rst:278 msgid ":pep:`446` -- Make newly created file descriptors non-inheritable" @@ -461,19 +459,20 @@ msgstr "" #: ../../whatsnew/3.4.rst:294 msgid "" -"As a key step in clarifying the situation, the :meth:`codecs.encode` and :" -"meth:`codecs.decode` convenience functions are now properly documented in " -"Python 2.7, 3.3 and 3.4. These functions have existed in the :mod:`codecs` " -"module (and have been covered by the regression test suite) since Python " -"2.4, but were previously only discoverable through runtime introspection." +"As a key step in clarifying the situation, the :meth:`codecs.encode` " +"and :meth:`codecs.decode` convenience functions are now properly documented " +"in Python 2.7, 3.3 and 3.4. These functions have existed in " +"the :mod:`codecs` module (and have been covered by the regression test " +"suite) since Python 2.4, but were previously only discoverable through " +"runtime introspection." msgstr "" #: ../../whatsnew/3.4.rst:300 msgid "" -"Unlike the convenience methods on :class:`str`, :class:`bytes` and :class:" -"`bytearray`, the :mod:`codecs` convenience functions support arbitrary " -"codecs in both Python 2 and Python 3, rather than being limited to Unicode " -"text encodings (in Python 3) or ``basestring`` <-> ``basestring`` " +"Unlike the convenience methods on :class:`str`, :class:`bytes` " +"and :class:`bytearray`, the :mod:`codecs` convenience functions support " +"arbitrary codecs in both Python 2 and Python 3, rather than being limited to " +"Unicode text encodings (in Python 3) or ``basestring`` <-> ``basestring`` " "conversions (in Python 2)." msgstr "" @@ -595,11 +594,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:373 msgid "" -"(Contributed by Nick Coghlan in :issue:`7475`, :issue:`17827`, :issue:" -"`17828` and :issue:`19619`.)" +"(Contributed by Nick Coghlan " +"in :issue:`7475`, :issue:`17827`, :issue:`17828` and :issue:`19619`.)" msgstr "" -"(由 Nick Coghlan 在 :issue:`7475`、:issue:`17827`、:issue:`17828` 和 :issue:" -"`19619` 中貢獻。)" +"(由 Nick Coghlan 在 :issue:`7475`、:issue:`17827`、:issue:`17828` " +"和 :issue:`19619` 中貢獻。)" #: ../../whatsnew/3.4.rst:380 msgid "PEP 451: A ModuleSpec Type for the Import System" @@ -620,9 +619,9 @@ msgid "" "Furthermore, they should be transparent to everyone but importer authors. " "Key finder and loader methods have been deprecated, but they will continue " "working. New importers should use the new methods described in the PEP. " -"Existing importers should be updated to implement the new methods. See the :" -"ref:`deprecated-3.4` section for a list of methods that should be replaced " -"and their replacements." +"Existing importers should be updated to implement the new methods. See " +"the :ref:`deprecated-3.4` section for a list of methods that should be " +"replaced and their replacements." msgstr "" #: ../../whatsnew/3.4.rst:400 @@ -641,8 +640,8 @@ msgstr "" msgid "" ":func:`min` and :func:`max` now accept a *default* keyword-only argument " "that can be used to specify the value they return if the iterable they are " -"evaluating has no elements. (Contributed by Julian Berman in :issue:" -"`18111`.)" +"evaluating has no elements. (Contributed by Julian Berman " +"in :issue:`18111`.)" msgstr "" #: ../../whatsnew/3.4.rst:411 @@ -652,9 +651,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:413 msgid "" "Module ``__file__`` attributes (and related values) should now always " -"contain absolute paths by default, with the sole exception of ``__main__." -"__file__`` when a script has been executed directly using a relative path. " -"(Contributed by Brett Cannon in :issue:`18416`.)" +"contain absolute paths by default, with the sole exception of " +"``__main__.__file__`` when a script has been executed directly using a " +"relative path. (Contributed by Brett Cannon in :issue:`18416`.)" msgstr "" #: ../../whatsnew/3.4.rst:418 @@ -682,8 +681,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:431 msgid "" ":class:`bytes`.join() and :class:`bytearray`.join() now accept arbitrary " -"buffer objects as arguments. (Contributed by Antoine Pitrou in :issue:" -"`15958`.)" +"buffer objects as arguments. (Contributed by Antoine Pitrou " +"in :issue:`15958`.)" msgstr "" #: ../../whatsnew/3.4.rst:435 @@ -702,9 +701,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:443 msgid "" -":class:`memoryview` is now registered as a :class:`Sequence `, and supports the :func:`reversed` builtin. (Contributed by Nick " -"Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.)" +":class:`memoryview` is now registered as a :class:`Sequence " +"`, and supports the :func:`reversed` builtin. (Contributed " +"by Nick Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.)" msgstr "" #: ../../whatsnew/3.4.rst:447 @@ -717,8 +716,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:451 msgid "" ":meth:`~object.__length_hint__` is now part of the formal language " -"specification (see :pep:`424`). (Contributed by Armin Ronacher in :issue:" -"`16148`.)" +"specification (see :pep:`424`). (Contributed by Armin Ronacher " +"in :issue:`16148`.)" msgstr "" #: ../../whatsnew/3.4.rst:457 @@ -755,11 +754,11 @@ msgstr "ensurepip" #: ../../whatsnew/3.4.rst:483 msgid "" -"The new :mod:`ensurepip` module is the primary infrastructure for the :pep:" -"`453` implementation. In the normal course of events end users will not " -"need to interact with this module, but it can be used to manually bootstrap " -"``pip`` if the automated bootstrapping into an installation or virtual " -"environment was declined." +"The new :mod:`ensurepip` module is the primary infrastructure for " +"the :pep:`453` implementation. In the normal course of events end users " +"will not need to interact with this module, but it can be used to manually " +"bootstrap ``pip`` if the automated bootstrapping into an installation or " +"virtual environment was declined." msgstr "" #: ../../whatsnew/3.4.rst:489 @@ -789,10 +788,10 @@ msgstr "enum" #: ../../whatsnew/3.4.rst:509 msgid "" "The new :mod:`enum` module (defined in :pep:`435`) provides a standard " -"implementation of enumeration types, allowing other modules (such as :mod:" -"`socket`) to provide more informative error messages and better debugging " -"support by replacing opaque integer constants with backwards compatible " -"enumeration values." +"implementation of enumeration types, allowing other modules (such " +"as :mod:`socket`) to provide more informative error messages and better " +"debugging support by replacing opaque integer constants with backwards " +"compatible enumeration values." msgstr "" #: ../../whatsnew/3.4.rst:517 @@ -832,9 +831,9 @@ msgstr "selectors" #: ../../whatsnew/3.4.rst:546 msgid "" -"The new :mod:`selectors` module (created as part of implementing :pep:" -"`3156`) allows high-level and efficient I/O multiplexing, built upon the :" -"mod:`select` module primitives." +"The new :mod:`selectors` module (created as part of " +"implementing :pep:`3156`) allows high-level and efficient I/O multiplexing, " +"built upon the :mod:`select` module primitives." msgstr "" #: ../../whatsnew/3.4.rst:554 @@ -934,9 +933,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:615 ../../whatsnew/3.4.rst:1543 msgid "" -"The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept any :" -"term:`bytes-like object`. (Contributed by Serhiy Storchaka in :issue:" -"`8311`.)" +"The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept " +"any :term:`bytes-like object`. (Contributed by Serhiy Storchaka " +"in :issue:`8311`.)" msgstr "" #: ../../whatsnew/3.4.rst:621 @@ -979,21 +978,22 @@ msgstr "base64" #: ../../whatsnew/3.4.rst:646 msgid "" -"The encoding and decoding functions in :mod:`base64` now accept any :term:" -"`bytes-like object` in cases where it previously required a :class:`bytes` " -"or :class:`bytearray` instance. (Contributed by Nick Coghlan in :issue:" -"`17839`.)" +"The encoding and decoding functions in :mod:`base64` now accept " +"any :term:`bytes-like object` in cases where it previously required " +"a :class:`bytes` or :class:`bytearray` instance. (Contributed by Nick " +"Coghlan in :issue:`17839`.)" msgstr "" #: ../../whatsnew/3.4.rst:651 msgid "" -"New functions :func:`~base64.a85encode`, :func:`~base64.a85decode`, :func:" -"`~base64.b85encode`, and :func:`~base64.b85decode` provide the ability to " -"encode and decode binary data from and to ``Ascii85`` and the git/mercurial " -"``Base85`` formats, respectively. The ``a85`` functions have options that " -"can be used to make them compatible with the variants of the ``Ascii85`` " -"encoding, including the Adobe variant. (Contributed by Martin Morrison, the " -"Mercurial project, Serhiy Storchaka, and Antoine Pitrou in :issue:`17618`.)" +"New " +"functions :func:`~base64.a85encode`, :func:`~base64.a85decode`, :func:`~base64.b85encode`, " +"and :func:`~base64.b85decode` provide the ability to encode and decode " +"binary data from and to ``Ascii85`` and the git/mercurial ``Base85`` " +"formats, respectively. The ``a85`` functions have options that can be used " +"to make them compatible with the variants of the ``Ascii85`` encoding, " +"including the Adobe variant. (Contributed by Martin Morrison, the Mercurial " +"project, Serhiy Storchaka, and Antoine Pitrou in :issue:`17618`.)" msgstr "" #: ../../whatsnew/3.4.rst:661 @@ -1035,21 +1035,21 @@ msgstr "" #: ../../whatsnew/3.4.rst:686 msgid "" "The new :func:`contextlib.redirect_stdout` context manager makes it easier " -"for utility scripts to handle inflexible APIs that write their output to :" -"data:`sys.stdout` and don't provide any options to redirect it. Using the " -"context manager, the :data:`sys.stdout` output can be redirected to any " +"for utility scripts to handle inflexible APIs that write their output " +"to :data:`sys.stdout` and don't provide any options to redirect it. Using " +"the context manager, the :data:`sys.stdout` output can be redirected to any " "other stream or, in conjunction with :class:`io.StringIO`, to a string. The " "latter can be especially useful, for example, to capture output from a " "function that was written to implement a command line interface. It is " -"recommended only for utility scripts because it affects the global state of :" -"data:`sys.stdout`. (Contributed by Raymond Hettinger in :issue:`15805`.)" +"recommended only for utility scripts because it affects the global state " +"of :data:`sys.stdout`. (Contributed by Raymond Hettinger in :issue:`15805`.)" msgstr "" #: ../../whatsnew/3.4.rst:697 msgid "" -"The :mod:`contextlib` documentation has also been updated to include a :ref:" -"`discussion ` of the differences " -"between single use, reusable and reentrant context managers." +"The :mod:`contextlib` documentation has also been updated to include " +"a :ref:`discussion ` of the " +"differences between single use, reusable and reentrant context managers." msgstr "" #: ../../whatsnew/3.4.rst:703 @@ -1070,8 +1070,8 @@ msgstr "dis" #: ../../whatsnew/3.4.rst:714 msgid "" -"Functions :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, and :" -"func:`~dis.disassemble` now accept a keyword-only *file* argument that " +"Functions :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, " +"and :func:`~dis.disassemble` now accept a keyword-only *file* argument that " "controls where they write their output." msgstr "" @@ -1119,13 +1119,13 @@ msgstr "" msgid "" "In addition, a new application-friendly class :class:`~dis.Bytecode` " "provides an object-oriented API for inspecting bytecode in both in human-" -"readable form and for iterating over instructions. The :class:`~dis." -"Bytecode` constructor takes the same arguments that :func:`~dis." -"get_instructions` does (plus an optional *current_offset*), and the " -"resulting object can be iterated to produce :class:`~dis.Instruction` " -"objects. But it also has a :mod:`~dis.Bytecode.dis` method, equivalent to " -"calling :mod:`~dis.dis` on the constructor argument, but returned as a multi-" -"line string::" +"readable form and for iterating over instructions. " +"The :class:`~dis.Bytecode` constructor takes the same arguments " +"that :func:`~dis.get_instructions` does (plus an optional *current_offset*), " +"and the resulting object can be iterated to " +"produce :class:`~dis.Instruction` objects. But it also has " +"a :mod:`~dis.Bytecode.dis` method, equivalent to calling :mod:`~dis.dis` on " +"the constructor argument, but returned as a multi-line string::" msgstr "" #: ../../whatsnew/3.4.rst:748 @@ -1158,16 +1158,16 @@ msgstr "" #: ../../whatsnew/3.4.rst:761 msgid "" -":class:`~dis.Bytecode` also has a class method, :meth:`~dis.Bytecode." -"from_traceback`, that provides the ability to manipulate a traceback (that " -"is, ``print(Bytecode.from_traceback(tb).dis())`` is equivalent to " -"``distb(tb)``)." +":class:`~dis.Bytecode` also has a class " +"method, :meth:`~dis.Bytecode.from_traceback`, that provides the ability to " +"manipulate a traceback (that is, " +"``print(Bytecode.from_traceback(tb).dis())`` is equivalent to ``distb(tb)``)." msgstr "" #: ../../whatsnew/3.4.rst:766 msgid "" -"(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in :issue:" -"`11816` and Claudiu Popa in :issue:`17916`.)" +"(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver " +"in :issue:`11816` and Claudiu Popa in :issue:`17916`.)" msgstr "" "(由 Nick Coghlan、Ryan Kelly 和 Thomas Kluyver 在 :issue:`11816` 中以及 " "Claudiu Popa 在 :issue:`17916` 中貢獻。)" @@ -1196,8 +1196,8 @@ msgid "" "two new options, ``-o`` and ``-f``. ``-o`` allows :ref:`doctest options " "` to be specified on the command line, and ``-f`` is a " "shorthand for ``-o FAIL_FAST`` (to parallel the similar option supported by " -"the :mod:`unittest` CLI). (Contributed by R. David Murray in :issue:" -"`11390`.)" +"the :mod:`unittest` CLI). (Contributed by R. David Murray " +"in :issue:`11390`.)" msgstr "" #: ../../whatsnew/3.4.rst:787 @@ -1225,10 +1225,10 @@ msgid "" "New method :meth:`~email.message.Message.as_bytes` added to produce a bytes " "representation of the message in a fashion similar to how ``as_string`` " "produces a string representation. It does not accept the *maxheaderlen* " -"argument, but does accept the *unixfrom* and *policy* arguments. The :class:" -"`~email.message.Message` :meth:`~email.message.Message.__bytes__` method " -"calls it, meaning that ``bytes(mymsg)`` will now produce the intuitive " -"result: a bytes object containing the fully formatted message. " +"argument, but does accept the *unixfrom* and *policy* arguments. " +"The :class:`~email.message.Message` :meth:`~email.message.Message.__bytes__` " +"method calls it, meaning that ``bytes(mymsg)`` will now produce the " +"intuitive result: a bytes object containing the fully formatted message. " "(Contributed by R. David Murray in :issue:`18600`.)" msgstr "" @@ -1237,8 +1237,8 @@ msgid "" "The :meth:`.Message.set_param` message now accepts a *replace* keyword " "argument. When specified, the associated header will be updated without " "changing its location in the list of headers. For backward compatibility, " -"the default is ``False``. (Contributed by R. David Murray in :issue:" -"`18891`.)" +"the default is ``False``. (Contributed by R. David Murray " +"in :issue:`18891`.)" msgstr "" #: ../../whatsnew/3.4.rst:818 @@ -1250,12 +1250,13 @@ msgid "" "documentation is currently in the new module, which is being added as part " "of email's new :term:`provisional API`. These classes provide a number of " "new methods that make extracting content from and inserting content into " -"email messages much easier. For details, see the :mod:`~email." -"contentmanager` documentation and the :ref:`email-examples`. These API " -"additions complete the bulk of the work that was planned as part of the " -"email6 project. The currently provisional API is scheduled to become final " -"in Python 3.5 (possibly with a few minor additions in the area of error " -"handling). (Contributed by R. David Murray in :issue:`18891`.)" +"email messages much easier. For details, see " +"the :mod:`~email.contentmanager` documentation and the :ref:`email-" +"examples`. These API additions complete the bulk of the work that was " +"planned as part of the email6 project. The currently provisional API is " +"scheduled to become final in Python 3.5 (possibly with a few minor additions " +"in the area of error handling). (Contributed by R. David Murray " +"in :issue:`18891`.)" msgstr "" #: ../../whatsnew/3.4.rst:834 @@ -1276,8 +1277,8 @@ msgstr "" msgid "" "New module attribute :const:`~filecmp.DEFAULT_IGNORES` provides the list of " "directories that are used as the default value for the *ignore* parameter of " -"the :func:`~filecmp.dircmp` function. (Contributed by Eli Bendersky in :" -"issue:`15442`.)" +"the :func:`~filecmp.dircmp` function. (Contributed by Eli Bendersky " +"in :issue:`15442`.)" msgstr "" #: ../../whatsnew/3.4.rst:850 @@ -1314,9 +1315,9 @@ msgstr "由 Łukasz Langa 撰寫 PEP 與實作。" #: ../../whatsnew/3.4.rst:873 msgid "" -":func:`~functools.total_ordering` now supports a return value of :data:" -"`NotImplemented` from the underlying comparison function. (Contributed by " -"Katie Miller in :issue:`10042`.)" +":func:`~functools.total_ordering` now supports a return value " +"of :data:`NotImplemented` from the underlying comparison function. " +"(Contributed by Katie Miller in :issue:`10042`.)" msgstr "" #: ../../whatsnew/3.4.rst:877 @@ -1361,17 +1362,17 @@ msgid "" "(Contributed by Christian Heimes in :issue:`18582`.)" msgstr "" "新的 :func:`hashlib.pbkdf2_hmac` 函式提供了\\ `基於密碼的 PKCS#5 密鑰生成函" -"式 2 `_。(由 Christian Heimes 在 :" -"issue:`18582` 中貢獻。)" +"式 2 `_。(由 Christian Heimes " +"在 :issue:`18582` 中貢獻。)" #: ../../whatsnew/3.4.rst:907 msgid "" "The :attr:`~hashlib.hash.name` attribute of :mod:`hashlib` hash objects is " -"now a formally supported interface. It has always existed in CPython's :mod:" -"`hashlib` (although it did not return lower case names for all supported " -"hashes), but it was not a public interface and so some other Python " -"implementations have not previously supported it. (Contributed by Jason R. " -"Coombs in :issue:`18532`.)" +"now a formally supported interface. It has always existed in " +"CPython's :mod:`hashlib` (although it did not return lower case names for " +"all supported hashes), but it was not a public interface and so some other " +"Python implementations have not previously supported it. (Contributed by " +"Jason R. Coombs in :issue:`18532`.)" msgstr "" #: ../../whatsnew/3.4.rst:916 @@ -1398,10 +1399,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:930 msgid "" -"With the addition of :attr:`~hmac.HMAC.block_size` and :attr:`~hmac.HMAC." -"name` attributes (and the formal documentation of the :attr:`~hmac.HMAC." -"digest_size` attribute), the :mod:`hmac` module now conforms fully to the :" -"pep:`247` API. (Contributed by Christian Heimes in :issue:`18775`.)" +"With the addition of :attr:`~hmac.HMAC.block_size` " +"and :attr:`~hmac.HMAC.name` attributes (and the formal documentation of " +"the :attr:`~hmac.HMAC.digest_size` attribute), the :mod:`hmac` module now " +"conforms fully to the :pep:`247` API. (Contributed by Christian Heimes " +"in :issue:`18775`.)" msgstr "" #: ../../whatsnew/3.4.rst:937 @@ -1440,10 +1442,10 @@ msgid "" ":meth:`~http.server.BaseHTTPRequestHandler.send_error` now accepts an " "optional additional *explain* parameter which can be used to provide an " "extended error description, overriding the hardcoded default if there is " -"one. This extended error description will be formatted using the :attr:" -"`~http.server.BaseHTTPRequestHandler.error_message_format` attribute and " -"sent as the body of the error response. (Contributed by Karl Cow in :issue:" -"`12921`.)" +"one. This extended error description will be formatted using " +"the :attr:`~http.server.BaseHTTPRequestHandler.error_message_format` " +"attribute and sent as the body of the error response. (Contributed by Karl " +"Cow in :issue:`12921`.)" msgstr "" #: ../../whatsnew/3.4.rst:965 @@ -1460,10 +1462,10 @@ msgstr "idlelib 與 IDLE" #: ../../whatsnew/3.4.rst:973 msgid "" "Since idlelib implements the IDLE shell and editor and is not intended for " -"import by other programs, it gets improvements with every release. See :file:" -"`Lib/idlelib/NEWS.txt` for a cumulative list of changes since 3.3.0, as well " -"as changes made in future 3.4.x releases. This file is also available from " -"the IDLE :menuselection:`Help --> About IDLE` dialog." +"import by other programs, it gets improvements with every release. " +"See :file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since " +"3.3.0, as well as changes made in future 3.4.x releases. This file is also " +"available from the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" #: ../../whatsnew/3.4.rst:981 @@ -1472,11 +1474,12 @@ msgstr "importlib" #: ../../whatsnew/3.4.rst:983 msgid "" -"The :class:`~importlib.abc.InspectLoader` ABC defines a new method, :meth:" -"`~importlib.abc.InspectLoader.source_to_code` that accepts source data and a " -"path and returns a code object. The default implementation is equivalent to " -"``compile(data, path, 'exec', dont_inherit=True)``. (Contributed by Eric " -"Snow and Brett Cannon in :issue:`15627`.)" +"The :class:`~importlib.abc.InspectLoader` ABC defines a new " +"method, :meth:`~importlib.abc.InspectLoader.source_to_code` that accepts " +"source data and a path and returns a code object. The default " +"implementation is equivalent to ``compile(data, path, 'exec', " +"dont_inherit=True)``. (Contributed by Eric Snow and Brett Cannon " +"in :issue:`15627`.)" msgstr "" #: ../../whatsnew/3.4.rst:989 @@ -1489,9 +1492,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:994 msgid "" -"The :func:`~importlib.reload` function has been moved from :mod:`!imp` to :" -"mod:`importlib` as part of the :mod:`!imp` module deprecation. (Contributed " -"by Berker Peksag in :issue:`18193`.)" +"The :func:`~importlib.reload` function has been moved from :mod:`!imp` " +"to :mod:`importlib` as part of the :mod:`!imp` module deprecation. " +"(Contributed by Berker Peksag in :issue:`18193`.)" msgstr "" #: ../../whatsnew/3.4.rst:998 @@ -1504,34 +1507,35 @@ msgstr "" #: ../../whatsnew/3.4.rst:1003 msgid "" -"New :mod:`importlib.util` functions :func:`~importlib.util." -"cache_from_source` and :func:`~importlib.util.source_from_cache` replace the " -"same-named functions in the deprecated :mod:`!imp` module. (Contributed by " -"Brett Cannon in :issue:`18194`.)" +"New :mod:`importlib.util` " +"functions :func:`~importlib.util.cache_from_source` " +"and :func:`~importlib.util.source_from_cache` replace the same-named " +"functions in the deprecated :mod:`!imp` module. (Contributed by Brett " +"Cannon in :issue:`18194`.)" msgstr "" #: ../../whatsnew/3.4.rst:1008 msgid "" "The :mod:`importlib` bootstrap :class:`.NamespaceLoader` now conforms to " -"the :class:`.InspectLoader` ABC, which means that ``runpy`` and ``python -" -"m`` can now be used with namespace packages. (Contributed by Brett Cannon " +"the :class:`.InspectLoader` ABC, which means that ``runpy`` and ``python " +"-m`` can now be used with namespace packages. (Contributed by Brett Cannon " "in :issue:`18058`.)" msgstr "" #: ../../whatsnew/3.4.rst:1013 msgid "" -":mod:`importlib.util` has a new function :func:`~importlib.util." -"decode_source` that decodes source from bytes using universal newline " -"processing. This is useful for implementing :meth:`.InspectLoader." -"get_source` methods." +":mod:`importlib.util` has a new " +"function :func:`~importlib.util.decode_source` that decodes source from " +"bytes using universal newline processing. This is useful for " +"implementing :meth:`.InspectLoader.get_source` methods." msgstr "" #: ../../whatsnew/3.4.rst:1017 msgid "" -":class:`importlib.machinery.ExtensionFileLoader` now has a :meth:`~importlib." -"machinery.ExtensionFileLoader.get_filename` method. This was inadvertently " -"omitted in the original implementation. (Contributed by Eric Snow in :issue:" -"`19152`.)" +":class:`importlib.machinery.ExtensionFileLoader` now has " +"a :meth:`~importlib.machinery.ExtensionFileLoader.get_filename` method. " +"This was inadvertently omitted in the original implementation. (Contributed " +"by Eric Snow in :issue:`19152`.)" msgstr "" #: ../../whatsnew/3.4.rst:1024 @@ -1556,21 +1560,23 @@ msgstr "" #: ../../whatsnew/3.4.rst:1036 msgid "" -"As part of the implementation of the new :mod:`enum` module, the :mod:" -"`inspect` module now has substantially better support for custom ``__dir__`` " -"methods and dynamic class attributes provided through metaclasses. " -"(Contributed by Ethan Furman in :issue:`18929` and :issue:`19030`.)" +"As part of the implementation of the new :mod:`enum` module, " +"the :mod:`inspect` module now has substantially better support for custom " +"``__dir__`` methods and dynamic class attributes provided through " +"metaclasses. (Contributed by Ethan Furman in :issue:`18929` " +"and :issue:`19030`.)" msgstr "" #: ../../whatsnew/3.4.rst:1042 msgid "" -":func:`~inspect.getfullargspec` and :func:`~inspect.getargspec` now use the :" -"func:`~inspect.signature` API. This allows them to support a much broader " -"range of callables, including those with ``__signature__`` attributes, those " -"with metadata provided by argument clinic, :func:`functools.partial` objects " -"and more. Note that, unlike :func:`~inspect.signature`, these functions " -"still ignore ``__wrapped__`` attributes, and report the already bound first " -"argument for bound methods, so it is still necessary to update your code to " +":func:`~inspect.getfullargspec` and :func:`!getargspec` now use " +"the :func:`~inspect.signature` API. This allows them to support a much " +"broader range of callables, including those with ``__signature__`` " +"attributes, those with metadata provided by argument " +"clinic, :func:`functools.partial` objects and more. Note that, " +"unlike :func:`~inspect.signature`, these functions still ignore " +"``__wrapped__`` attributes, and report the already bound first argument for " +"bound methods, so it is still necessary to update your code to " "use :func:`~inspect.signature` directly if those features are desired. " "(Contributed by Yury Selivanov in :issue:`17481`.)" msgstr "" @@ -1588,17 +1594,18 @@ msgstr "ipaddress" #: ../../whatsnew/3.4.rst:1061 msgid "" -":mod:`ipaddress` was added to the standard library in Python 3.3 as a :term:" -"`provisional API`. With the release of Python 3.4, this qualification has " -"been removed: :mod:`ipaddress` is now considered a stable API, covered by " -"the normal standard library requirements to maintain backwards compatibility." +":mod:`ipaddress` was added to the standard library in Python 3.3 as " +"a :term:`provisional API`. With the release of Python 3.4, this " +"qualification has been removed: :mod:`ipaddress` is now considered a stable " +"API, covered by the normal standard library requirements to maintain " +"backwards compatibility." msgstr "" #: ../../whatsnew/3.4.rst:1067 msgid "" "A new :attr:`~ipaddress.IPv4Address.is_global` property is ``True`` if an " -"address is globally routeable. (Contributed by Peter Moody in :issue:" -"`17400`.)" +"address is globally routeable. (Contributed by Peter Moody " +"in :issue:`17400`.)" msgstr "" #: ../../whatsnew/3.4.rst:1073 @@ -1614,27 +1621,29 @@ msgstr "" #: ../../whatsnew/3.4.rst:1079 msgid "" -":class:`~logging.handlers.SocketHandler` and :class:`~logging.handlers." -"DatagramHandler` now support Unix domain sockets (by setting *port* to " -"``None``). (Contributed by Vinay Sajip in commit ce46195b56a9.)" +":class:`~logging.handlers.SocketHandler` " +"and :class:`~logging.handlers.DatagramHandler` now support Unix domain " +"sockets (by setting *port* to ``None``). (Contributed by Vinay Sajip in " +"commit ce46195b56a9.)" msgstr "" #: ../../whatsnew/3.4.rst:1084 msgid "" -":func:`~logging.config.fileConfig` now accepts a :class:`configparser." -"RawConfigParser` subclass instance for the *fname* parameter. This " -"facilitates using a configuration file when logging configuration is just a " -"part of the overall application configuration, or where the application " -"modifies the configuration before passing it to :func:`~logging.config." -"fileConfig`. (Contributed by Vinay Sajip in :issue:`16110`.)" +":func:`~logging.config.fileConfig` now accepts " +"a :class:`configparser.RawConfigParser` subclass instance for the *fname* " +"parameter. This facilitates using a configuration file when logging " +"configuration is just a part of the overall application configuration, or " +"where the application modifies the configuration before passing it " +"to :func:`~logging.config.fileConfig`. (Contributed by Vinay Sajip " +"in :issue:`16110`.)" msgstr "" #: ../../whatsnew/3.4.rst:1092 msgid "" -"Logging configuration data received from a socket via the :func:`logging." -"config.listen` function can now be validated before being processed by " -"supplying a verification function as the argument to the new *verify* " -"keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)" +"Logging configuration data received from a socket via " +"the :func:`logging.config.listen` function can now be validated before being " +"processed by supplying a verification function as the argument to the new " +"*verify* keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)" msgstr "" #: ../../whatsnew/3.4.rst:1101 @@ -1647,11 +1656,11 @@ msgid "" "implementing the new version restores the Python2 behavior of recording only " "one copy of interned strings and preserving the interning on " "deserialization, and extends this \"one copy\" ability to any object type " -"(including handling recursive references). This reduces both the size of ``." -"pyc`` files and the amount of memory a module occupies in memory when it is " -"loaded from a ``.pyc`` (or ``.pyo``) file. (Contributed by Kristján Valur " -"Jónsson in :issue:`16475`, with additional speedups by Antoine Pitrou in :" -"issue:`19219`.)" +"(including handling recursive references). This reduces both the size of " +"``.pyc`` files and the amount of memory a module occupies in memory when it " +"is loaded from a ``.pyc`` (or ``.pyo``) file. (Contributed by Kristján " +"Valur Jónsson in :issue:`16475`, with additional speedups by Antoine Pitrou " +"in :issue:`19219`.)" msgstr "" #: ../../whatsnew/3.4.rst:1114 @@ -1671,12 +1680,13 @@ msgstr "multiprocessing" #: ../../whatsnew/3.4.rst:1125 msgid "" "On Unix two new :ref:`start methods `, " -"``spawn`` and ``forkserver``, have been added for starting processes using :" -"mod:`multiprocessing`. These make the mixing of processes with threads more " -"robust, and the ``spawn`` method matches the semantics that multiprocessing " -"has always used on Windows. New function :func:`~multiprocessing." -"get_all_start_methods` reports all start methods available on the platform, :" -"func:`~multiprocessing.get_start_method` reports the current start method, " +"``spawn`` and ``forkserver``, have been added for starting processes " +"using :mod:`multiprocessing`. These make the mixing of processes with " +"threads more robust, and the ``spawn`` method matches the semantics that " +"multiprocessing has always used on Windows. New " +"function :func:`~multiprocessing.get_all_start_methods` reports all start " +"methods available on the platform, :func:`~multiprocessing.get_start_method` " +"reports the current start method, " "and :func:`~multiprocessing.set_start_method` sets the start method. " "(Contributed by Richard Oudkerk in :issue:`8713`.)" msgstr "" @@ -1684,21 +1694,22 @@ msgstr "" #: ../../whatsnew/3.4.rst:1135 msgid "" ":mod:`multiprocessing` also now has the concept of a ``context``, which " -"determines how child processes are created. New function :func:" -"`~multiprocessing.get_context` returns a context that uses a specified start " -"method. It has the same API as the :mod:`multiprocessing` module itself, so " -"you can use it to create :class:`~multiprocessing.pool.Pool`\\ s and other " -"objects that will operate within that context. This allows a framework and " -"an application or different parts of the same application to use " -"multiprocessing without interfering with each other. (Contributed by " -"Richard Oudkerk in :issue:`18999`.)" +"determines how child processes are created. New " +"function :func:`~multiprocessing.get_context` returns a context that uses a " +"specified start method. It has the same API as the :mod:`multiprocessing` " +"module itself, so you can use it to " +"create :class:`~multiprocessing.pool.Pool`\\ s and other objects that will " +"operate within that context. This allows a framework and an application or " +"different parts of the same application to use multiprocessing without " +"interfering with each other. (Contributed by Richard Oudkerk " +"in :issue:`18999`.)" msgstr "" #: ../../whatsnew/3.4.rst:1145 msgid "" "Except when using the old *fork* start method, child processes no longer " -"inherit unneeded handles/file descriptors from their parents (part of :issue:" -"`8713`)." +"inherit unneeded handles/file descriptors from their parents (part " +"of :issue:`8713`)." msgstr "" #: ../../whatsnew/3.4.rst:1149 @@ -1737,9 +1748,9 @@ msgstr "os" #: ../../whatsnew/3.4.rst:1173 msgid "" "There are new functions to get and set the :ref:`inheritable flag " -"` of a file descriptor (:func:`os.get_inheritable`, :func:" -"`os.set_inheritable`) or a Windows handle (:func:`os." -"get_handle_inheritable`, :func:`os.set_handle_inheritable`)." +"` of a file descriptor " +"(:func:`os.get_inheritable`, :func:`os.set_inheritable`) or a Windows handle " +"(:func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`)." msgstr "" #: ../../whatsnew/3.4.rst:1178 @@ -1748,14 +1759,14 @@ msgid "" "the platform on which Python is running (or ``None`` if the count can't be " "determined). The :func:`multiprocessing.cpu_count` function is now " "implemented in terms of this function). (Contributed by Trent Nelson, " -"Yogesh Chaudhari, Victor Stinner, and Charles-François Natali in :issue:" -"`17914`.)" +"Yogesh Chaudhari, Victor Stinner, and Charles-François Natali " +"in :issue:`17914`.)" msgstr "" #: ../../whatsnew/3.4.rst:1184 msgid "" -":func:`os.path.samestat` is now available on the Windows platform (and the :" -"func:`os.path.samefile` implementation is now shared between Unix and " +":func:`os.path.samestat` is now available on the Windows platform (and " +"the :func:`os.path.samefile` implementation is now shared between Unix and " "Windows). (Contributed by Brian Curtin in :issue:`11939`.)" msgstr "" @@ -1767,12 +1778,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:1191 msgid "" -":func:`os.open` supports two new flags on platforms that provide them, :" -"const:`~os.O_PATH` (un-opened file descriptor), and :const:`~os.O_TMPFILE` " -"(unnamed temporary file; as of 3.4.0 release available only on Linux systems " -"with a kernel version of 3.11 or newer that have uapi headers). " -"(Contributed by Christian Heimes in :issue:`18673` and Benjamin Peterson, " -"respectively.)" +":func:`os.open` supports two new flags on platforms that provide " +"them, :const:`~os.O_PATH` (un-opened file descriptor), " +"and :const:`~os.O_TMPFILE` (unnamed temporary file; as of 3.4.0 release " +"available only on Linux systems with a kernel version of 3.11 or newer that " +"have uapi headers). (Contributed by Christian Heimes in :issue:`18673` and " +"Benjamin Peterson, respectively.)" msgstr "" #: ../../whatsnew/3.4.rst:1199 @@ -1809,9 +1820,9 @@ msgid "" ":mod:`pickle` now supports (but does not use by default) a new pickle " "protocol, protocol 4. This new protocol addresses a number of issues that " "were present in previous protocols, such as the serialization of nested " -"classes, very large strings and containers, and classes whose :meth:`~object." -"__new__` method takes keyword-only arguments. It also provides some " -"efficiency improvements." +"classes, very large strings and containers, and classes " +"whose :meth:`~object.__new__` method takes keyword-only arguments. It also " +"provides some efficiency improvements." msgstr "" #: ../../whatsnew/3.4.rst:1230 @@ -1829,12 +1840,13 @@ msgstr "plistlib" #: ../../whatsnew/3.4.rst:1237 msgid "" ":mod:`plistlib` now has an API that is similar to the standard pattern for " -"stdlib serialization protocols, with new :func:`~plistlib.load`, :func:" -"`~plistlib.dump`, :func:`~plistlib.loads`, and :func:`~plistlib.dumps` " -"functions. (The older API is now deprecated.) In addition to the already " -"supported XML plist format (:const:`~plistlib.FMT_XML`), it also now " -"supports the binary plist format (:const:`~plistlib.FMT_BINARY`). " -"(Contributed by Ronald Oussoren and others in :issue:`14455`.)" +"stdlib serialization protocols, with " +"new :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:`~plistlib.loads`, " +"and :func:`~plistlib.dumps` functions. (The older API is now deprecated.) " +"In addition to the already supported XML plist format " +"(:const:`~plistlib.FMT_XML`), it also now supports the binary plist format " +"(:const:`~plistlib.FMT_BINARY`). (Contributed by Ronald Oussoren and others " +"in :issue:`14455`.)" msgstr "" #: ../../whatsnew/3.4.rst:1247 @@ -1844,9 +1856,9 @@ msgstr "poplib" #: ../../whatsnew/3.4.rst:1249 msgid "" "Two new methods have been added to :mod:`poplib`: :meth:`~poplib.POP3.capa`, " -"which returns the list of capabilities advertised by the POP server, and :" -"meth:`~poplib.POP3.stls`, which switches a clear-text POP3 session into an " -"encrypted POP3 session if the POP server supports it. (Contributed by " +"which returns the list of capabilities advertised by the POP server, " +"and :meth:`~poplib.POP3.stls`, which switches a clear-text POP3 session into " +"an encrypted POP3 session if the POP server supports it. (Contributed by " "Lorenzo Catucci in :issue:`4473`.)" msgstr "" @@ -1856,8 +1868,8 @@ msgstr "pprint" #: ../../whatsnew/3.4.rst:1259 msgid "" -"The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and its :" -"func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new " +"The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and " +"its :func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new " "option, *compact*, that controls how the output is formatted. Currently " "setting *compact* to ``True`` means that sequences will be printed with as " "many sequence elements as will fit within *width* on each (indented) line. " @@ -1886,27 +1898,28 @@ msgstr "pydoc" #: ../../whatsnew/3.4.rst:1280 msgid "" -"The :mod:`pydoc` module is now based directly on the :func:`inspect." -"signature` introspection API, allowing it to provide signature information " -"for a wider variety of callable objects. This change also means that " -"``__wrapped__`` attributes are now taken into account when displaying help " -"information. (Contributed by Larry Hastings in :issue:`19674`.)" +"The :mod:`pydoc` module is now based directly on " +"the :func:`inspect.signature` introspection API, allowing it to provide " +"signature information for a wider variety of callable objects. This change " +"also means that ``__wrapped__`` attributes are now taken into account when " +"displaying help information. (Contributed by Larry Hastings " +"in :issue:`19674`.)" msgstr "" #: ../../whatsnew/3.4.rst:1286 msgid "" "The :mod:`pydoc` module no longer displays the ``self`` parameter for " "already bound methods. Instead, it aims to always display the exact current " -"signature of the supplied callable. (Contributed by Larry Hastings in :" -"issue:`20710`.)" +"signature of the supplied callable. (Contributed by Larry Hastings " +"in :issue:`20710`.)" msgstr "" #: ../../whatsnew/3.4.rst:1291 msgid "" "In addition to the changes that have been made to :mod:`pydoc` directly, its " "handling of custom ``__dir__`` methods and various descriptor behaviours has " -"also been improved substantially by the underlying changes in the :mod:" -"`inspect` module." +"also been improved substantially by the underlying changes in " +"the :mod:`inspect` module." msgstr "" #: ../../whatsnew/3.4.rst:1296 @@ -1952,17 +1965,18 @@ msgstr "" #: ../../whatsnew/3.4.rst:1325 msgid "" "On Linux kernel version 2.6.36 or later, there are also some new Linux " -"specific constants: :const:`~resource.RLIMIT_MSGQUEUE`, :const:`~resource." -"RLIMIT_NICE`, :const:`~resource.RLIMIT_RTPRIO`, :const:`~resource." -"RLIMIT_RTTIME`, and :const:`~resource.RLIMIT_SIGPENDING`. (Contributed by " -"Christian Heimes in :issue:`19324`.)" +"specific " +"constants: :const:`~resource.RLIMIT_MSGQUEUE`, :const:`~resource.RLIMIT_NICE`, :const:`~resource.RLIMIT_RTPRIO`, :const:`~resource.RLIMIT_RTTIME`, " +"and :const:`~resource.RLIMIT_SIGPENDING`. (Contributed by Christian Heimes " +"in :issue:`19324`.)" msgstr "" #: ../../whatsnew/3.4.rst:1331 msgid "" -"On FreeBSD version 9 and later, there some new FreeBSD specific constants: :" -"const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, and :const:" -"`~resource.RLIMIT_NPTS`. (Contributed by Claudiu Popa in :issue:`19343`.)" +"On FreeBSD version 9 and later, there some new FreeBSD specific " +"constants: :const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, " +"and :const:`~resource.RLIMIT_NPTS`. (Contributed by Claudiu Popa " +"in :issue:`19343`.)" msgstr "" #: ../../whatsnew/3.4.rst:1338 @@ -1980,8 +1994,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:1345 msgid "" ":class:`~select.devpoll` objects now have :meth:`~select.devpoll.fileno` " -"and :meth:`~select.devpoll.close` methods, as well as a new attribute :attr:" -"`~select.devpoll.closed`. (Contributed by Victor Stinner in :issue:`18794`.)" +"and :meth:`~select.devpoll.close` methods, as well as a new " +"attribute :attr:`~select.devpoll.closed`. (Contributed by Victor Stinner " +"in :issue:`18794`.)" msgstr "" #: ../../whatsnew/3.4.rst:1352 @@ -2004,8 +2019,8 @@ msgid "" ":func:`~shutil.copyfile` now raises a specific :exc:`~shutil.Error` " "subclass, :exc:`~shutil.SameFileError`, when the source and destination are " "the same file, which allows an application to take appropriate action on " -"this specific error. (Contributed by Atsuo Ishimoto and Hynek Schlawack in :" -"issue:`1492704`.)" +"this specific error. (Contributed by Atsuo Ishimoto and Hynek Schlawack " +"in :issue:`1492704`.)" msgstr "" #: ../../whatsnew/3.4.rst:1370 @@ -2017,8 +2032,8 @@ msgid "" "The :class:`!SMTPServer` and :class:`!SMTPChannel` classes now accept a " "*map* keyword argument which, if specified, is passed in to :class:`!" "asynchat.async_chat` as its *map* argument. This allows an application to " -"avoid affecting the global socket map. (Contributed by Vinay Sajip in :" -"issue:`11959`.)" +"avoid affecting the global socket map. (Contributed by Vinay Sajip " +"in :issue:`11959`.)" msgstr "" #: ../../whatsnew/3.4.rst:1380 @@ -2046,8 +2061,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:1394 msgid "" "Socket objects have new methods to get or set their :ref:`inheritable flag " -"`, :meth:`~socket.socket.get_inheritable` and :meth:`~socket." -"socket.set_inheritable`." +"`, :meth:`~socket.socket.get_inheritable` " +"and :meth:`~socket.socket.set_inheritable`." msgstr "" #: ../../whatsnew/3.4.rst:1398 @@ -2099,37 +2114,40 @@ msgid "" "more stringent than the defaults provided by the :class:`~ssl.SSLContext` " "constructor, and may be adjusted in the future, without prior deprecation, " "if best-practice security requirements change. The new recommended best " -"practice for using stdlib libraries that support SSL is to use :func:`~ssl." -"create_default_context` to obtain an :class:`~ssl.SSLContext` object, modify " -"it if needed, and then pass it as the *context* argument of the appropriate " -"stdlib API. (Contributed by Christian Heimes in :issue:`19689`.)" +"practice for using stdlib libraries that support SSL is to " +"use :func:`~ssl.create_default_context` to obtain " +"an :class:`~ssl.SSLContext` object, modify it if needed, and then pass it as " +"the *context* argument of the appropriate stdlib API. (Contributed by " +"Christian Heimes in :issue:`19689`.)" msgstr "" #: ../../whatsnew/3.4.rst:1441 msgid "" -":class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." -"load_verify_locations` accepts a new optional argument *cadata*, which can " -"be used to provide PEM or DER encoded certificates directly via strings or " -"bytes, respectively. (Contributed by Christian Heimes in :issue:`18138`.)" +":class:`~ssl.SSLContext` " +"method :meth:`~ssl.SSLContext.load_verify_locations` accepts a new optional " +"argument *cadata*, which can be used to provide PEM or DER encoded " +"certificates directly via strings or bytes, respectively. (Contributed by " +"Christian Heimes in :issue:`18138`.)" msgstr "" #: ../../whatsnew/3.4.rst:1446 msgid "" "New function :func:`~ssl.get_default_verify_paths` returns a named tuple of " -"the paths and environment variables that the :meth:`~ssl.SSLContext." -"set_default_verify_paths` method uses to set OpenSSL's default ``cafile`` " -"and ``capath``. This can be an aid in debugging default verification " -"issues. (Contributed by Christian Heimes in :issue:`18143`.)" +"the paths and environment variables that " +"the :meth:`~ssl.SSLContext.set_default_verify_paths` method uses to set " +"OpenSSL's default ``cafile`` and ``capath``. This can be an aid in " +"debugging default verification issues. (Contributed by Christian Heimes " +"in :issue:`18143`.)" msgstr "" #: ../../whatsnew/3.4.rst:1453 msgid "" -":class:`~ssl.SSLContext` has a new method, :meth:`~ssl.SSLContext." -"cert_store_stats`, that reports the number of loaded ``X.509`` certs, " -"``X.509 CA`` certs, and certificate revocation lists (``crl``\\ s), as well " -"as a :meth:`~ssl.SSLContext.get_ca_certs` method that returns a list of the " -"loaded ``CA`` certificates. (Contributed by Christian Heimes in :issue:" -"`18147`.)" +":class:`~ssl.SSLContext` has a new " +"method, :meth:`~ssl.SSLContext.cert_store_stats`, that reports the number of " +"loaded ``X.509`` certs, ``X.509 CA`` certs, and certificate revocation lists " +"(``crl``\\ s), as well as a :meth:`~ssl.SSLContext.get_ca_certs` method that " +"returns a list of the loaded ``CA`` certificates. (Contributed by Christian " +"Heimes in :issue:`18147`.)" msgstr "" #: ../../whatsnew/3.4.rst:1460 @@ -2137,45 +2155,46 @@ msgid "" "If OpenSSL 0.9.8 or later is available, :class:`~ssl.SSLContext` has a new " "attribute :attr:`~ssl.SSLContext.verify_flags` that can be used to control " "the certificate verification process by setting it to some combination of " -"the new constants :const:`~ssl.VERIFY_DEFAULT`, :const:`~ssl." -"VERIFY_CRL_CHECK_LEAF`, :const:`~ssl.VERIFY_CRL_CHECK_CHAIN`, or :const:" -"`~ssl.VERIFY_X509_STRICT`. OpenSSL does not do any CRL verification by " -"default. (Contributed by Christien Heimes in :issue:`8813`.)" +"the new " +"constants :const:`~ssl.VERIFY_DEFAULT`, :const:`~ssl.VERIFY_CRL_CHECK_LEAF`, :const:`~ssl.VERIFY_CRL_CHECK_CHAIN`, " +"or :const:`~ssl.VERIFY_X509_STRICT`. OpenSSL does not do any CRL " +"verification by default. (Contributed by Christien Heimes in :issue:`8813`.)" msgstr "" #: ../../whatsnew/3.4.rst:1468 msgid "" -"New :class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." -"load_default_certs` loads a set of default \"certificate authority\" (CA) " -"certificates from default locations, which vary according to the platform. " -"It can be used to load both TLS web server authentication certificates " -"(``purpose=``:data:`~ssl.Purpose.SERVER_AUTH`) for a client to use to verify " -"a server, and certificates for a server to use in verifying client " -"certificates (``purpose=``:data:`~ssl.Purpose.CLIENT_AUTH`). (Contributed " -"by Christian Heimes in :issue:`19292`.)" +"New :class:`~ssl.SSLContext` " +"method :meth:`~ssl.SSLContext.load_default_certs` loads a set of default " +"\"certificate authority\" (CA) certificates from default locations, which " +"vary according to the platform. It can be used to load both TLS web server " +"authentication certificates (``purpose=``:data:`~ssl.Purpose.SERVER_AUTH`) " +"for a client to use to verify a server, and certificates for a server to use " +"in verifying client certificates " +"(``purpose=``:data:`~ssl.Purpose.CLIENT_AUTH`). (Contributed by Christian " +"Heimes in :issue:`19292`.)" msgstr "" #: ../../whatsnew/3.4.rst:1479 msgid "" -"Two new windows-only functions, :func:`~ssl.enum_certificates` and :func:" -"`~ssl.enum_crls` provide the ability to retrieve certificates, certificate " -"information, and CRLs from the Windows cert store. (Contributed by " -"Christian Heimes in :issue:`17134`.)" +"Two new windows-only functions, :func:`~ssl.enum_certificates` " +"and :func:`~ssl.enum_crls` provide the ability to retrieve certificates, " +"certificate information, and CRLs from the Windows cert store. (Contributed " +"by Christian Heimes in :issue:`17134`.)" msgstr "" #: ../../whatsnew/3.4.rst:1486 msgid "" -"Support for server-side SNI (Server Name Indication) using the new :meth:" -"`ssl.SSLContext.set_servername_callback` method. (Contributed by Daniel " -"Black in :issue:`8109`.)" +"Support for server-side SNI (Server Name Indication) using the " +"new :meth:`ssl.SSLContext.set_servername_callback` method. (Contributed by " +"Daniel Black in :issue:`8109`.)" msgstr "" #: ../../whatsnew/3.4.rst:1490 msgid "" "The dictionary returned by :meth:`.SSLSocket.getpeercert` contains " "additional ``X509v3`` extension items: ``crlDistributionPoints``, " -"``calIssuers``, and ``OCSP`` URIs. (Contributed by Christian Heimes in :" -"issue:`18379`.)" +"``calIssuers``, and ``OCSP`` URIs. (Contributed by Christian Heimes " +"in :issue:`18379`.)" msgstr "" #: ../../whatsnew/3.4.rst:1496 @@ -2191,9 +2210,10 @@ msgstr "" #: ../../whatsnew/3.4.rst:1502 msgid "" -"The module supports new :mod:`~stat.ST_MODE` flags, :mod:`~stat.S_IFDOOR`, :" -"const:`~stat.S_IFPORT`, and :const:`~stat.S_IFWHT`. (Contributed by " -"Christian Hiemes in :issue:`11016`.)" +"The module supports new :mod:`~stat.ST_MODE` " +"flags, :mod:`~stat.S_IFDOOR`, :const:`~stat.S_IFPORT`, " +"and :const:`~stat.S_IFWHT`. (Contributed by Christian Hiemes " +"in :issue:`11016`.)" msgstr "" #: ../../whatsnew/3.4.rst:1508 @@ -2202,10 +2222,10 @@ msgstr "struct" #: ../../whatsnew/3.4.rst:1510 msgid "" -"New function :mod:`~struct.iter_unpack` and a new :meth:`struct.Struct." -"iter_unpack` method on compiled formats provide streamed unpacking of a " -"buffer containing repeated instances of a given format of data. (Contributed " -"by Antoine Pitrou in :issue:`17804`.)" +"New function :mod:`~struct.iter_unpack` and a " +"new :meth:`struct.Struct.iter_unpack` method on compiled formats provide " +"streamed unpacking of a buffer containing repeated instances of a given " +"format of data. (Contributed by Antoine Pitrou in :issue:`17804`.)" msgstr "" #: ../../whatsnew/3.4.rst:1517 @@ -2259,10 +2279,10 @@ msgstr "sys" msgid "" "New function :func:`sys.getallocatedblocks` returns the current number of " "blocks allocated by the interpreter. (In CPython with the default ``--with-" -"pymalloc`` setting, this is allocations made through the :c:func:" -"`PyObject_Malloc` API.) This can be useful for tracking memory leaks, " -"especially if automated via a test suite. (Contributed by Antoine Pitrou " -"in :issue:`13390`.)" +"pymalloc`` setting, this is allocations made through " +"the :c:func:`PyObject_Malloc` API.) This can be useful for tracking memory " +"leaks, especially if automated via a test suite. (Contributed by Antoine " +"Pitrou in :issue:`13390`.)" msgstr "" #: ../../whatsnew/3.4.rst:1558 @@ -2275,10 +2295,10 @@ msgid "" "The :mod:`site` module :ref:`sets it ` to a function " "that enables tab completion and history saving (in :file:`~/.python-" "history`) if the platform supports :mod:`readline`. If you do not want this " -"(new) behavior, you can override it in :envvar:`PYTHONSTARTUP`, :mod:" -"`sitecustomize`, or :mod:`usercustomize` by deleting this attribute from :" -"mod:`sys` (or setting it to some other callable). (Contributed by Éric " -"Araujo and Antoine Pitrou in :issue:`5845`.)" +"(new) behavior, you can override it " +"in :envvar:`PYTHONSTARTUP`, :mod:`sitecustomize`, or :mod:`usercustomize` by " +"deleting this attribute from :mod:`sys` (or setting it to some other " +"callable). (Contributed by Éric Araujo and Antoine Pitrou in :issue:`5845`.)" msgstr "" #: ../../whatsnew/3.4.rst:1573 @@ -2289,8 +2309,8 @@ msgstr "tarfile" msgid "" "The :mod:`tarfile` module now supports a simple :ref:`tarfile-commandline` " "when called as a script directly or via ``-m``. This can be used to create " -"and extract tarfile archives. (Contributed by Berker Peksag in :issue:" -"`13477`.)" +"and extract tarfile archives. (Contributed by Berker Peksag " +"in :issue:`13477`.)" msgstr "" #: ../../whatsnew/3.4.rst:1581 @@ -2307,8 +2327,8 @@ msgid "" "convenience function :func:`~textwrap.shorten` collapses all of the " "whitespace in the input to single spaces and produces a single line of a " "given *width* that ends with the *placeholder* (by default, ``[...]``). " -"(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` and :" -"issue:`18725`.)" +"(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` " +"and :issue:`18725`.)" msgstr "" #: ../../whatsnew/3.4.rst:1595 @@ -2331,8 +2351,8 @@ msgstr "traceback" msgid "" "A new :func:`traceback.clear_frames` function takes a traceback object and " "clears the local variables in all of the frames it references, reducing the " -"amount of memory consumed. (Contributed by Andrew Kuchling in :issue:" -"`1565525`.)" +"amount of memory consumed. (Contributed by Andrew Kuchling " +"in :issue:`1565525`.)" msgstr "" #: ../../whatsnew/3.4.rst:1613 @@ -2355,40 +2375,41 @@ msgstr "urllib" #: ../../whatsnew/3.4.rst:1626 msgid "" -":mod:`urllib.request` now supports ``data:`` URLs via the :class:`~urllib." -"request.DataHandler` class. (Contributed by Mathias Panzenböck in :issue:" -"`16423`.)" +":mod:`urllib.request` now supports ``data:`` URLs via " +"the :class:`~urllib.request.DataHandler` class. (Contributed by Mathias " +"Panzenböck in :issue:`16423`.)" msgstr "" #: ../../whatsnew/3.4.rst:1630 msgid "" "The http method that will be used by a :class:`~urllib.request.Request` " -"class can now be specified by setting a :class:`~urllib.request.Request." -"method` class attribute on the subclass. (Contributed by Jason R Coombs in :" -"issue:`18978`.)" +"class can now be specified by setting " +"a :class:`~urllib.request.Request.method` class attribute on the subclass. " +"(Contributed by Jason R Coombs in :issue:`18978`.)" msgstr "" #: ../../whatsnew/3.4.rst:1635 msgid "" -":class:`~urllib.request.Request` objects are now reusable: if the :attr:" -"`~urllib.request.Request.full_url` or :attr:`~urllib.request.Request.data` " -"attributes are modified, all relevant internal properties are updated. This " -"means, for example, that it is now possible to use the same :class:`~urllib." -"request.Request` object in more than one :meth:`.OpenerDirector.open` call " -"with different *data* arguments, or to modify a :class:`~urllib.request." -"Request`\\ 's ``url`` rather than recomputing it from scratch. There is " -"also a new :meth:`~urllib.request.Request.remove_header` method that can be " -"used to remove headers from a :class:`~urllib.request.Request`. " -"(Contributed by Alexey Kachayev in :issue:`16464`, Daniel Wozniak in :issue:" -"`17485`, and Damien Brecht and Senthil Kumaran in :issue:`17272`.)" +":class:`~urllib.request.Request` objects are now reusable: if " +"the :attr:`~urllib.request.Request.full_url` " +"or :attr:`~urllib.request.Request.data` attributes are modified, all " +"relevant internal properties are updated. This means, for example, that it " +"is now possible to use the same :class:`~urllib.request.Request` object in " +"more than one :meth:`.OpenerDirector.open` call with different *data* " +"arguments, or to modify a :class:`~urllib.request.Request`\\ 's ``url`` " +"rather than recomputing it from scratch. There is also a " +"new :meth:`~urllib.request.Request.remove_header` method that can be used to " +"remove headers from a :class:`~urllib.request.Request`. (Contributed by " +"Alexey Kachayev in :issue:`16464`, Daniel Wozniak in :issue:`17485`, and " +"Damien Brecht and Senthil Kumaran in :issue:`17272`.)" msgstr "" #: ../../whatsnew/3.4.rst:1648 msgid "" -":class:`~urllib.error.HTTPError` objects now have a :attr:`~urllib.error." -"HTTPError.headers` attribute that provides access to the HTTP response " -"headers associated with the error. (Contributed by Berker Peksag in :issue:" -"`15701`.)" +":class:`~urllib.error.HTTPError` objects now have " +"a :attr:`~urllib.error.HTTPError.headers` attribute that provides access to " +"the HTTP response headers associated with the error. (Contributed by Berker " +"Peksag in :issue:`15701`.)" msgstr "" #: ../../whatsnew/3.4.rst:1655 @@ -2397,13 +2418,13 @@ msgstr "unittest" #: ../../whatsnew/3.4.rst:1657 msgid "" -"The :class:`~unittest.TestCase` class has a new method, :meth:`~unittest." -"TestCase.subTest`, that produces a context manager whose :keyword:`with` " -"block becomes a \"sub-test\". This context manager allows a test method to " -"dynamically generate subtests by, say, calling the ``subTest`` context " -"manager inside a loop. A single test method can thereby produce an " -"indefinite number of separately identified and separately counted tests, all " -"of which will run even if one or more of them fail. For example::" +"The :class:`~unittest.TestCase` class has a new " +"method, :meth:`~unittest.TestCase.subTest`, that produces a context manager " +"whose :keyword:`with` block becomes a \"sub-test\". This context manager " +"allows a test method to dynamically generate subtests by, say, calling the " +"``subTest`` context manager inside a loop. A single test method can thereby " +"produce an indefinite number of separately identified and separately counted " +"tests, all of which will run even if one or more of them fail. For example::" msgstr "" #: ../../whatsnew/3.4.rst:1665 @@ -2463,9 +2484,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:1696 msgid "" "A new test assertion context-manager, :meth:`~unittest.TestCase.assertLogs`, " -"will ensure that a given block of code emits a log message using the :mod:" -"`logging` module. By default the message can come from any logger and have " -"a priority of ``INFO`` or higher, but both the logger name and an " +"will ensure that a given block of code emits a log message using " +"the :mod:`logging` module. By default the message can come from any logger " +"and have a priority of ``INFO`` or higher, but both the logger name and an " "alternative minimum logging level may be specified. The object returned by " "the context manager can be queried for the :class:`~logging.LogRecord`\\ s " "and/or formatted messages that were logged. (Contributed by Antoine Pitrou " @@ -2507,8 +2528,8 @@ msgid "" ":class:`~venv.EnvBuilder` and the :func:`~venv.create` convenience function " "take a new keyword argument *with_pip*, which defaults to ``False``, that " "controls whether or not :class:`~venv.EnvBuilder` ensures that ``pip`` is " -"installed in the virtual environment. (Contributed by Nick Coghlan in :" -"issue:`19552` as part of the :pep:`453` implementation.)" +"installed in the virtual environment. (Contributed by Nick Coghlan " +"in :issue:`19552` as part of the :pep:`453` implementation.)" msgstr "" #: ../../whatsnew/3.4.rst:1731 @@ -2536,9 +2557,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:1743 msgid "" -"The :meth:`~wave.Wave_write.writeframesraw` and :meth:`~wave.Wave_write." -"writeframes` methods now accept any :term:`bytes-like object`. (Contributed " -"by Serhiy Storchaka in :issue:`8311`.)" +"The :meth:`~wave.Wave_write.writeframesraw` " +"and :meth:`~wave.Wave_write.writeframes` methods now accept any :term:`bytes-" +"like object`. (Contributed by Serhiy Storchaka in :issue:`8311`.)" msgstr "" #: ../../whatsnew/3.4.rst:1749 @@ -2573,21 +2594,21 @@ msgstr "xml.etree" #: ../../whatsnew/3.4.rst:1767 msgid "" "A new parser, :class:`~xml.etree.ElementTree.XMLPullParser`, allows a non-" -"blocking applications to parse XML documents. An example can be seen at :" -"ref:`elementtree-pull-parsing`. (Contributed by Antoine Pitrou in :issue:" -"`17741`.)" +"blocking applications to parse XML documents. An example can be seen " +"at :ref:`elementtree-pull-parsing`. (Contributed by Antoine Pitrou " +"in :issue:`17741`.)" msgstr "" #: ../../whatsnew/3.4.rst:1772 msgid "" "The :mod:`xml.etree.ElementTree` :func:`~xml.etree.ElementTree.tostring` " -"and :func:`~xml.etree.ElementTree.tostringlist` functions, and the :class:" -"`~xml.etree.ElementTree.ElementTree` :meth:`~xml.etree.ElementTree." -"ElementTree.write` method, now have a *short_empty_elements* :ref:`keyword-" -"only parameter ` providing control over whether " -"elements with no content are written in abbreviated (````) or " -"expanded (````) form. (Contributed by Ariel Poliak and Serhiy " -"Storchaka in :issue:`14377`.)" +"and :func:`~xml.etree.ElementTree.tostringlist` functions, and " +"the :class:`~xml.etree.ElementTree.ElementTree` :meth:`~xml.etree.ElementTree.ElementTree.write` " +"method, now have a *short_empty_elements* :ref:`keyword-only parameter " +"` providing control over whether elements with no " +"content are written in abbreviated (````) or expanded (````) form. (Contributed by Ariel Poliak and Serhiy Storchaka " +"in :issue:`14377`.)" msgstr "" #: ../../whatsnew/3.4.rst:1783 @@ -2596,18 +2617,18 @@ msgstr "zipfile" #: ../../whatsnew/3.4.rst:1785 msgid "" -"The :meth:`~zipfile.PyZipFile.writepy` method of the :class:`~zipfile." -"PyZipFile` class has a new *filterfunc* option that can be used to control " -"which directories and files are added to the archive. For example, this " -"could be used to exclude test files from the archive. (Contributed by " -"Christian Tismer in :issue:`19274`.)" +"The :meth:`~zipfile.PyZipFile.writepy` method of " +"the :class:`~zipfile.PyZipFile` class has a new *filterfunc* option that can " +"be used to control which directories and files are added to the archive. " +"For example, this could be used to exclude test files from the archive. " +"(Contributed by Christian Tismer in :issue:`19274`.)" msgstr "" #: ../../whatsnew/3.4.rst:1791 msgid "" -"The *allowZip64* parameter to :class:`~zipfile.ZipFile` and :class:`~zipfile." -"PyZipFile` is now ``True`` by default. (Contributed by William Mallard in :" -"issue:`17201`.)" +"The *allowZip64* parameter to :class:`~zipfile.ZipFile` " +"and :class:`~zipfile.PyZipFile` is now ``True`` by default. (Contributed by " +"William Mallard in :issue:`17201`.)" msgstr "" #: ../../whatsnew/3.4.rst:1798 @@ -2642,11 +2663,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:1825 msgid "" -"As part of this change, module globals are no longer forcibly set to :const:" -"`None` during interpreter shutdown in most cases, instead relying on the " -"normal operation of the cyclic garbage collector. This avoids a whole class " -"of interpreter-shutdown-time errors, usually involving ``__del__`` methods, " -"that have plagued Python since the cyclic GC was first introduced." +"As part of this change, module globals are no longer forcibly set " +"to :const:`None` during interpreter shutdown in most cases, instead relying " +"on the normal operation of the cyclic garbage collector. This avoids a " +"whole class of interpreter-shutdown-time errors, usually involving " +"``__del__`` methods, that have plagued Python since the cyclic GC was first " +"introduced." msgstr "" #: ../../whatsnew/3.4.rst:1834 @@ -2759,31 +2781,33 @@ msgstr "" #: ../../whatsnew/3.4.rst:1910 msgid "" -"New function :c:func:`PyStructSequence_InitType2` supplements the existing :" -"c:func:`PyStructSequence_InitType` function. The difference is that it " -"returns ``0`` on success and ``-1`` on failure." +"New function :c:func:`PyStructSequence_InitType2` supplements the " +"existing :c:func:`PyStructSequence_InitType` function. The difference is " +"that it returns ``0`` on success and ``-1`` on failure." msgstr "" #: ../../whatsnew/3.4.rst:1914 msgid "" "The CPython source can now be compiled using the address sanity checking " "features of recent versions of GCC and clang: the false alarms in the small " -"object allocator have been silenced. (Contributed by Dhiru Kholia in :issue:" -"`18596`.)" +"object allocator have been silenced. (Contributed by Dhiru Kholia " +"in :issue:`18596`.)" msgstr "" #: ../../whatsnew/3.4.rst:1919 msgid "" -"The Windows build now uses `Address Space Layout Randomization `_ and `Data Execution " -"Prevention `_. " -"(Contributed by Christian Heimes in :issue:`16632`.)" +"The Windows build now uses `Address Space Layout Randomization `_ and `Data " +"Execution Prevention `_. (Contributed by Christian Heimes " +"in :issue:`16632`.)" msgstr "" #: ../../whatsnew/3.4.rst:1924 msgid "" -"New function :c:func:`PyObject_LengthHint` is the C API equivalent of :func:" -"`operator.length_hint`. (Contributed by Armin Ronacher in :issue:`16148`.)" +"New function :c:func:`PyObject_LengthHint` is the C API equivalent " +"of :func:`operator.length_hint`. (Contributed by Armin Ronacher " +"in :issue:`16148`.)" msgstr "" #: ../../whatsnew/3.4.rst:1932 @@ -2824,8 +2848,8 @@ msgstr "" msgid "" "The CPython Windows installer now adds ``.py`` to the :envvar:`PATHEXT` " "variable when extensions are registered, allowing users to run a python " -"script at the windows command prompt by just typing its name without the ``." -"py`` extension. (Contributed by Paul Moore in :issue:`18569`.)" +"script at the windows command prompt by just typing its name without the " +"``.py`` extension. (Contributed by Paul Moore in :issue:`18569`.)" msgstr "" #: ../../whatsnew/3.4.rst:1962 @@ -2839,12 +2863,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:1968 msgid "" "The ``-R`` option to the :ref:`python regression test suite ` now " -"also checks for memory allocation leaks, using :func:`sys." -"getallocatedblocks`. (Contributed by Antoine Pitrou in :issue:`13390`.)" +"also checks for memory allocation leaks, " +"using :func:`sys.getallocatedblocks`. (Contributed by Antoine Pitrou " +"in :issue:`13390`.)" msgstr "" -":ref:`python 迴歸測試套裝 ` 的 ``-R`` 選項現在也可以透過使用 :func:" -"`sys.getallocatedblocks` 來檢查記憶體配置洩漏。(由 Antoine Pitrou 在 :issue:" -"`13390` 貢獻。)" +":ref:`python 迴歸測試套裝 ` 的 ``-R`` 選項現在也可以透過使" +"用 :func:`sys.getallocatedblocks` 來檢查記憶體配置洩漏。(由 Antoine Pitrou " +"在 :issue:`13390` 貢獻。)" #: ../../whatsnew/3.4.rst:1973 msgid "``python -m`` now works with namespace packages." @@ -2868,15 +2893,15 @@ msgstr "" msgid "" "A new opcode, :opcode:`!LOAD_CLASSDEREF`, has been added to fix a bug in the " "loading of free variables in class bodies that could be triggered by certain " -"uses of :ref:`__prepare__ `. (Contributed by Benjamin Peterson in :" -"issue:`17853`.)" +"uses of :ref:`__prepare__ `. (Contributed by Benjamin Peterson " +"in :issue:`17853`.)" msgstr "" #: ../../whatsnew/3.4.rst:1988 msgid "" "A number of MemoryError-related crashes were identified and fixed by Victor " -"Stinner using his :pep:`445`-based ``pyfailmalloc`` tool (:issue:`18408`, :" -"issue:`18520`)." +"Stinner using his :pep:`445`-based ``pyfailmalloc`` tool " +"(:issue:`18408`, :issue:`18520`)." msgstr "" #: ../../whatsnew/3.4.rst:1992 @@ -2896,10 +2921,10 @@ msgstr "" #: ../../whatsnew/3.4.rst:2001 msgid "" -"The encoding name is now optional in the value set for the :envvar:" -"`PYTHONIOENCODING` environment variable. This makes it possible to set just " -"the error handler, without changing the default encoding. (Contributed by " -"Serhiy Storchaka in :issue:`18818`.)" +"The encoding name is now optional in the value set for " +"the :envvar:`PYTHONIOENCODING` environment variable. This makes it possible " +"to set just the error handler, without changing the default encoding. " +"(Contributed by Serhiy Storchaka in :issue:`18818`.)" msgstr "" #: ../../whatsnew/3.4.rst:2006 @@ -2935,12 +2960,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:2028 msgid "" "The interpreter starts about 30% faster. A couple of measures lead to the " -"speedup. The interpreter loads fewer modules on startup, e.g. the :mod:" -"`re`, :mod:`collections` and :mod:`locale` modules and their dependencies " -"are no longer imported by default. The marshal module has been improved to " -"load compiled Python code faster. (Contributed by Antoine Pitrou, Christian " -"Heimes and Victor Stinner in :issue:`19219`, :issue:`19218`, :issue:" -"`19209`, :issue:`19205` and :issue:`9548`.)" +"speedup. The interpreter loads fewer modules on startup, e.g. " +"the :mod:`re`, :mod:`collections` and :mod:`locale` modules and their " +"dependencies are no longer imported by default. The marshal module has been " +"improved to load compiled Python code faster. (Contributed by Antoine " +"Pitrou, Christian Heimes and Victor Stinner " +"in :issue:`19219`, :issue:`19218`, :issue:`19209`, :issue:`19205` " +"and :issue:`9548`.)" msgstr "" #: ../../whatsnew/3.4.rst:2036 @@ -2973,8 +2999,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2052 msgid "" -":func:`html.escape` is now 10x faster. (Contributed by Matt Bryant in :" -"issue:`18020`.)" +":func:`html.escape` is now 10x faster. (Contributed by Matt Bryant " +"in :issue:`18020`.)" msgstr "" #: ../../whatsnew/3.4.rst:2055 @@ -2999,9 +3025,9 @@ msgstr "已棄用" msgid "" "This section covers various APIs and other features that have been " "deprecated in Python 3.4, and will be removed in Python 3.5 or later. In " -"most (but not all) cases, using the deprecated APIs will produce a :exc:" -"`DeprecationWarning` when the interpreter is run with deprecation warnings " -"enabled (for example, by using ``-Wd``)." +"most (but not all) cases, using the deprecated APIs will produce " +"a :exc:`DeprecationWarning` when the interpreter is run with deprecation " +"warnings enabled (for example, by using ``-Wd``)." msgstr "" #: ../../whatsnew/3.4.rst:2077 @@ -3012,23 +3038,25 @@ msgstr "已棄用的 Python API" msgid "" "As mentioned in :ref:`whatsnew-pep-451`, a number of :mod:`importlib` " "methods and functions are deprecated: :meth:`!importlib.find_loader` is " -"replaced by :func:`importlib.util.find_spec`; :meth:`!importlib.machinery." -"PathFinder.find_module` is replaced by :meth:`importlib.machinery.PathFinder." -"find_spec`; :meth:`!importlib.abc.MetaPathFinder.find_module` is replaced " -"by :meth:`importlib.abc.MetaPathFinder.find_spec`; :meth:`!importlib.abc." -"PathEntryFinder.find_loader` and :meth:`!find_module` are replaced by :meth:" -"`importlib.abc.PathEntryFinder.find_spec`; all of the :samp:`{xxx}Loader` " -"ABC ``load_module`` methods (:meth:`!importlib.abc.Loader.load_module`, :" -"meth:`!importlib.abc.InspectLoader.load_module`, :meth:`!importlib.abc." -"FileLoader.load_module`, :meth:`!importlib.abc.SourceLoader.load_module`) " -"should no longer be implemented, instead loaders should implement an " -"``exec_module`` method (:meth:`importlib.abc.Loader.exec_module`, :meth:" -"`importlib.abc.InspectLoader.exec_module` :meth:`importlib.abc.SourceLoader." -"exec_module`) and let the import system take care of the rest; and :meth:`!" -"importlib.abc.Loader.module_repr`, :meth:`!importlib.util." -"module_for_loader`, :meth:`!importlib.util.set_loader`, and :meth:`!" -"importlib.util.set_package` are no longer needed because their functions are " -"now handled automatically by the import system." +"replaced by :func:`importlib.util.find_spec`; :meth:`!" +"importlib.machinery.PathFinder.find_module` is replaced " +"by :meth:`importlib.machinery.PathFinder.find_spec`; :meth:`!" +"importlib.abc.MetaPathFinder.find_module` is replaced " +"by :meth:`importlib.abc.MetaPathFinder.find_spec`; :meth:`!" +"importlib.abc.PathEntryFinder.find_loader` and :meth:`!find_module` are " +"replaced by :meth:`importlib.abc.PathEntryFinder.find_spec`; all of " +"the :samp:`{xxx}Loader` ABC ``load_module`` methods (:meth:`!" +"importlib.abc.Loader.load_module`, :meth:`!" +"importlib.abc.InspectLoader.load_module`, :meth:`!" +"importlib.abc.FileLoader.load_module`, :meth:`!" +"importlib.abc.SourceLoader.load_module`) should no longer be implemented, " +"instead loaders should implement an ``exec_module`` method " +"(:meth:`importlib.abc.Loader.exec_module`, :meth:`importlib.abc.InspectLoader.exec_module` :meth:`importlib.abc.SourceLoader.exec_module`) " +"and let the import system take care of the rest; and :meth:`!" +"importlib.abc.Loader.module_repr`, :meth:`!" +"importlib.util.module_for_loader`, :meth:`!importlib.util.set_loader`, " +"and :meth:`!importlib.util.set_package` are no longer needed because their " +"functions are now handled automatically by the import system." msgstr "" #: ../../whatsnew/3.4.rst:2104 @@ -3053,8 +3081,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2114 msgid "" "The internal ``Netrc`` class in the :mod:`ftplib` module has been documented " -"as deprecated in its docstring for quite some time. It now emits a :exc:" -"`DeprecationWarning` and will be removed completely in Python 3.5." +"as deprecated in its docstring for quite some time. It now emits " +"a :exc:`DeprecationWarning` and will be removed completely in Python 3.5." msgstr "" #: ../../whatsnew/3.4.rst:2118 @@ -3073,10 +3101,10 @@ msgstr "" msgid "" "The :mod:`plistlib` :func:`!readPlist`, :func:`!writePlist`, :func:`!" "readPlistFromBytes`, and :func:`!writePlistToBytes` functions are deprecated " -"in favor of the corresponding new functions :func:`~plistlib.load`, :func:" -"`~plistlib.dump`, :func:`~plistlib.loads`, and :func:`~plistlib.dumps`. :" -"func:`!Data` is deprecated in favor of just using the :class:`bytes` " -"constructor." +"in favor of the corresponding new " +"functions :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:`~plistlib.loads`, " +"and :func:`~plistlib.dumps`. :func:`!Data` is deprecated in favor of just " +"using the :class:`bytes` constructor." msgstr "" #: ../../whatsnew/3.4.rst:2131 @@ -3096,9 +3124,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:2139 msgid "" "The *parser* argument of :func:`xml.etree.ElementTree.iterparse` has been " -"deprecated, as has the *html* argument of :func:`~xml.etree.ElementTree." -"XMLParser`. To prepare for the removal of the latter, all arguments to " -"``XMLParser`` should be passed by keyword." +"deprecated, as has the *html* argument " +"of :func:`~xml.etree.ElementTree.XMLParser`. To prepare for the removal of " +"the latter, all arguments to ``XMLParser`` should be passed by keyword." msgstr "" #: ../../whatsnew/3.4.rst:2146 @@ -3174,8 +3202,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2185 msgid "" "The ``PyThreadState.tick_counter`` field has been removed; its value has " -"been meaningless since Python 3.2, when the \"new GIL\" was introduced (:" -"issue:`19199`)." +"been meaningless since Python 3.2, when the \"new GIL\" was introduced " +"(:issue:`19199`)." msgstr "" #: ../../whatsnew/3.4.rst:2189 @@ -3186,9 +3214,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:2192 msgid "" -"The *strict* argument to :class:`~http.client.HTTPConnection` and :class:" -"`~http.client.HTTPSConnection` has been removed. HTTP 0.9-style \"Simple " -"Responses\" are no longer supported." +"The *strict* argument to :class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` has been removed. HTTP 0.9-style " +"\"Simple Responses\" are no longer supported." msgstr "" #: ../../whatsnew/3.4.rst:2196 @@ -3201,8 +3229,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2201 msgid "" -"Support for loading the deprecated ``TYPE_INT64`` has been removed from :mod:" -"`marshal`. (Contributed by Dan Riti in :issue:`15480`.)" +"Support for loading the deprecated ``TYPE_INT64`` has been removed " +"from :mod:`marshal`. (Contributed by Dan Riti in :issue:`15480`.)" msgstr "" #: ../../whatsnew/3.4.rst:2204 @@ -3219,16 +3247,16 @@ msgid "" "situation where previously working (but incorrect) code would start failing " "if an object gained a __format__ method, which means that your code may now " "raise a :exc:`TypeError` if you are using an ``'s'`` format code with " -"objects that do not have a __format__ method that handles it. See :issue:" -"`7994` for background." +"objects that do not have a __format__ method that handles it. " +"See :issue:`7994` for background." msgstr "" #: ../../whatsnew/3.4.rst:2216 msgid "" -":meth:`!difflib.SequenceMatcher.isbjunk` and :meth:`!difflib.SequenceMatcher." -"isbpopular` were deprecated in 3.2, and have now been removed: use ``x in sm." -"bjunk`` and ``x in sm.bpopular``, where *sm* is a :class:`~difflib." -"SequenceMatcher` object (:issue:`13248`)." +":meth:`!difflib.SequenceMatcher.isbjunk` and :meth:`!" +"difflib.SequenceMatcher.isbpopular` were deprecated in 3.2, and have now " +"been removed: use ``x in sm.bjunk`` and ``x in sm.bpopular``, where *sm* is " +"a :class:`~difflib.SequenceMatcher` object (:issue:`13248`)." msgstr "" #: ../../whatsnew/3.4.rst:2224 @@ -3272,12 +3300,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:2249 msgid "" "In a posix shell, setting the :envvar:`PATH` environment variable to an " -"empty value is equivalent to not setting it at all. However, setting :" -"envvar:`PYTHONPATH` to an empty value was *not* equivalent to not setting it " -"at all: setting :envvar:`PYTHONPATH` to an empty value was equivalent to " -"setting it to ``.``, which leads to confusion when reasoning by analogy to " -"how :envvar:`PATH` works. The behavior now conforms to the posix convention " -"for :envvar:`PATH`." +"empty value is equivalent to not setting it at all. However, " +"setting :envvar:`PYTHONPATH` to an empty value was *not* equivalent to not " +"setting it at all: setting :envvar:`PYTHONPATH` to an empty value was " +"equivalent to setting it to ``.``, which leads to confusion when reasoning " +"by analogy to how :envvar:`PATH` works. The behavior now conforms to the " +"posix convention for :envvar:`PATH`." msgstr "" #: ../../whatsnew/3.4.rst:2257 @@ -3301,18 +3329,20 @@ msgstr "Python API 的變更" #: ../../whatsnew/3.4.rst:2269 msgid "" "The ABCs defined in :mod:`importlib.abc` now either raise the appropriate " -"exception or return a default value instead of raising :exc:" -"`NotImplementedError` blindly. This will only affect code calling :func:" -"`super` and falling through all the way to the ABCs. For compatibility, " -"catch both :exc:`NotImplementedError` or the appropriate exception as needed." +"exception or return a default value instead of " +"raising :exc:`NotImplementedError` blindly. This will only affect code " +"calling :func:`super` and falling through all the way to the ABCs. For " +"compatibility, catch both :exc:`NotImplementedError` or the appropriate " +"exception as needed." msgstr "" #: ../../whatsnew/3.4.rst:2275 msgid "" -"The module type now initializes the :attr:`~module.__package__` and :attr:" -"`~module.__loader__` attributes to ``None`` by default. To determine if " -"these attributes were set in a backwards-compatible fashion, use e.g. " -"``getattr(module, '__loader__', None) is not None``. (:issue:`17115`.)" +"The module type now initializes the :attr:`~module.__package__` " +"and :attr:`~module.__loader__` attributes to ``None`` by default. To " +"determine if these attributes were set in a backwards-compatible fashion, " +"use e.g. ``getattr(module, '__loader__', None) is not None``. " +"(:issue:`17115`.)" msgstr "" #: ../../whatsnew/3.4.rst:2281 @@ -3347,9 +3377,9 @@ msgid "" "incorrect for frozen modules to set the attribute as they are not loaded " "from any explicit location. If you must know that a module comes from frozen " "code then you can see if the module's ``__spec__.location`` is set to " -"``'frozen'``, check if the loader is a subclass of :class:`importlib." -"machinery.FrozenImporter`, or if Python 2 compatibility is necessary you can " -"use :func:`!imp.is_frozen`." +"``'frozen'``, check if the loader is a subclass " +"of :class:`importlib.machinery.FrozenImporter`, or if Python 2 compatibility " +"is necessary you can use :func:`!imp.is_frozen`." msgstr "" #: ../../whatsnew/3.4.rst:2306 @@ -3362,14 +3392,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:2311 msgid "" -":meth:`importlib.abc.SourceLoader.get_source` no longer raises :exc:" -"`ImportError` when the source code being loaded triggers a :exc:" -"`SyntaxError` or :exc:`UnicodeDecodeError`. As :exc:`ImportError` is meant " -"to be raised only when source code cannot be found but it should, it was " -"felt to be over-reaching/overloading of that meaning when the source code is " -"found but improperly structured. If you were catching ImportError before and " -"wish to continue to ignore syntax or decoding issues, catch all three " -"exceptions now." +":meth:`importlib.abc.SourceLoader.get_source` no longer " +"raises :exc:`ImportError` when the source code being loaded triggers " +"a :exc:`SyntaxError` or :exc:`UnicodeDecodeError`. As :exc:`ImportError` is " +"meant to be raised only when source code cannot be found but it should, it " +"was felt to be over-reaching/overloading of that meaning when the source " +"code is found but improperly structured. If you were catching ImportError " +"before and wish to continue to ignore syntax or decoding issues, catch all " +"three exceptions now." msgstr "" #: ../../whatsnew/3.4.rst:2320 @@ -3386,12 +3416,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:2330 msgid "" -":func:`inspect.getfullargspec` has been reimplemented on top of :func:" -"`inspect.signature` and hence handles a much wider variety of callable " -"objects than it did in the past. It is expected that additional builtin and " -"extension module callables will gain signature metadata over the course of " -"the Python 3.4 series. Code that assumes that :func:`inspect.getfullargspec` " -"will fail on non-Python callables may need to be adjusted accordingly." +":func:`inspect.getfullargspec` has been reimplemented on top " +"of :func:`inspect.signature` and hence handles a much wider variety of " +"callable objects than it did in the past. It is expected that additional " +"builtin and extension module callables will gain signature metadata over the " +"course of the Python 3.4 series. Code that assumes " +"that :func:`inspect.getfullargspec` will fail on non-Python callables may " +"need to be adjusted accordingly." msgstr "" #: ../../whatsnew/3.4.rst:2338 @@ -3404,8 +3435,8 @@ msgid "" "working directory will also now have an absolute path, including when using " "``-m`` with the interpreter (except for ``__main__.__file__`` when a script " "has been executed directly using a relative path) (Contributed by Brett " -"Cannon in :issue:`18416`). is specified on the command-line) (:issue:" -"`18416`)." +"Cannon in :issue:`18416`). is specified on the command-line) " +"(:issue:`18416`)." msgstr "" #: ../../whatsnew/3.4.rst:2349 @@ -3422,66 +3453,69 @@ msgid "" "Strings between ``from __future__ import ...`` statements now *always* raise " "a :exc:`SyntaxError`. Previously if there was no leading docstring, an " "interstitial string would sometimes be ignored. This brings CPython into " -"compliance with the language spec; Jython and PyPy already were. (:issue:" -"`17434`)." +"compliance with the language spec; Jython and PyPy already were. " +"(:issue:`17434`)." msgstr "" #: ../../whatsnew/3.4.rst:2361 msgid "" ":meth:`ssl.SSLSocket.getpeercert` and :meth:`ssl.SSLSocket.do_handshake` now " "raise an :exc:`OSError` with ``ENOTCONN`` when the ``SSLSocket`` is not " -"connected, instead of the previous behavior of raising an :exc:" -"`AttributeError`. In addition, :meth:`~ssl.SSLSocket.getpeercert` will " -"raise a :exc:`ValueError` if the handshake has not yet been done." +"connected, instead of the previous behavior of raising " +"an :exc:`AttributeError`. In addition, :meth:`~ssl.SSLSocket.getpeercert` " +"will raise a :exc:`ValueError` if the handshake has not yet been done." msgstr "" #: ../../whatsnew/3.4.rst:2367 msgid "" ":func:`base64.b32decode` now raises a :exc:`binascii.Error` when the input " "string contains non-b32-alphabet characters, instead of a :exc:`TypeError`. " -"This particular :exc:`TypeError` was missed when the other :exc:" -"`TypeError`\\ s were converted. (Contributed by Serhiy Storchaka in :issue:" -"`18011`.) Note: this change was also inadvertently applied in Python 3.3.3." +"This particular :exc:`TypeError` was missed when the " +"other :exc:`TypeError`\\ s were converted. (Contributed by Serhiy Storchaka " +"in :issue:`18011`.) Note: this change was also inadvertently applied in " +"Python 3.3.3." msgstr "" #: ../../whatsnew/3.4.rst:2374 msgid "" -"The :attr:`!file` attribute is now automatically closed when the creating :" -"class:`!cgi.FieldStorage` instance is garbage collected. If you were pulling " -"the file object out separately from the :class:`!cgi.FieldStorage` instance " -"and not keeping the instance alive, then you should either store the entire :" -"class:`!cgi.FieldStorage` instance or read the contents of the file before " -"the :class:`!cgi.FieldStorage` instance is garbage collected." +"The :attr:`!file` attribute is now automatically closed when the " +"creating :class:`!cgi.FieldStorage` instance is garbage collected. If you " +"were pulling the file object out separately from the :class:`!" +"cgi.FieldStorage` instance and not keeping the instance alive, then you " +"should either store the entire :class:`!cgi.FieldStorage` instance or read " +"the contents of the file before the :class:`!cgi.FieldStorage` instance is " +"garbage collected." msgstr "" #: ../../whatsnew/3.4.rst:2381 msgid "" "Calling ``read`` or ``write`` on a closed SSL socket now raises an " -"informative :exc:`ValueError` rather than the previous more mysterious :exc:" -"`AttributeError` (:issue:`9177`)." +"informative :exc:`ValueError` rather than the previous more " +"mysterious :exc:`AttributeError` (:issue:`9177`)." msgstr "" #: ../../whatsnew/3.4.rst:2385 msgid "" ":meth:`slice.indices` no longer produces an :exc:`OverflowError` for huge " -"values. As a consequence of this fix, :meth:`slice.indices` now raises a :" -"exc:`ValueError` if given a negative length; previously it returned nonsense " -"values (:issue:`14794`)." +"values. As a consequence of this fix, :meth:`slice.indices` now raises " +"a :exc:`ValueError` if given a negative length; previously it returned " +"nonsense values (:issue:`14794`)." msgstr "" #: ../../whatsnew/3.4.rst:2390 msgid "" "The :class:`complex` constructor, unlike the :mod:`cmath` functions, was " "incorrectly accepting :class:`float` values if an object's ``__complex__`` " -"special method returned one. This now raises a :exc:`TypeError`. (:issue:" -"`16290`.)" +"special method returned one. This now raises a :exc:`TypeError`. " +"(:issue:`16290`.)" msgstr "" #: ../../whatsnew/3.4.rst:2395 msgid "" -"The :class:`int` constructor in 3.2 and 3.3 erroneously accepts :class:" -"`float` values for the *base* parameter. It is unlikely anyone was doing " -"this, but if so, it will now raise a :exc:`TypeError` (:issue:`16772`)." +"The :class:`int` constructor in 3.2 and 3.3 erroneously " +"accepts :class:`float` values for the *base* parameter. It is unlikely " +"anyone was doing this, but if so, it will now raise a :exc:`TypeError` " +"(:issue:`16772`)." msgstr "" #: ../../whatsnew/3.4.rst:2399 @@ -3522,8 +3556,8 @@ msgid "" "isolation that :mod:`unittest` is designed to provide. However, if the lack " "of isolation is considered acceptable, the old behavior can be restored by " "creating a :mod:`~unittest.TestSuite` subclass that defines a " -"``_removeTestAtIndex`` method that does nothing (see :meth:`.TestSuite." -"__iter__`) (:issue:`11798`)." +"``_removeTestAtIndex`` method that does nothing " +"(see :meth:`.TestSuite.__iter__`) (:issue:`11798`)." msgstr "" #: ../../whatsnew/3.4.rst:2426 @@ -3556,8 +3590,8 @@ msgid "" "The new *convert_charrefs* argument to :class:`~html.parser.HTMLParser` " "currently defaults to ``False`` for backward compatibility, but will " "eventually be changed to default to ``True``. It is recommended that you " -"add this keyword, with the appropriate value, to any :class:`~html.parser." -"HTMLParser` calls in your code (:issue:`13633`)." +"add this keyword, with the appropriate value, to " +"any :class:`~html.parser.HTMLParser` calls in your code (:issue:`13633`)." msgstr "" #: ../../whatsnew/3.4.rst:2447 @@ -3581,8 +3615,8 @@ msgid "" "is ineffective in Python3 and will eventually raise an error if used. " "Depending on the function, the equivalent of its old Python2 behavior can be " "achieved using either a *newline* argument, or if necessary by wrapping the " -"stream in :mod:`~io.TextIOWrapper` to use its *newline* argument (:issue:" -"`15204`)." +"stream in :mod:`~io.TextIOWrapper` to use its *newline* argument " +"(:issue:`15204`)." msgstr "" #: ../../whatsnew/3.4.rst:2463 @@ -3612,10 +3646,10 @@ msgstr "" msgid "" "The :mod:`collections.abc` module has been slightly refactored as part of " "the Python startup improvements. As a consequence of this, it is no longer " -"the case that importing :mod:`collections` automatically imports :mod:" -"`collections.abc`. If your program depended on the (undocumented) implicit " -"import, you will need to add an explicit ``import collections.abc`` (:issue:" -"`20784`)." +"the case that importing :mod:`collections` automatically " +"imports :mod:`collections.abc`. If your program depended on the " +"(undocumented) implicit import, you will need to add an explicit ``import " +"collections.abc`` (:issue:`20784`)." msgstr "" #: ../../whatsnew/3.4.rst:2487 @@ -3624,16 +3658,16 @@ msgstr "C API 中的改動" #: ../../whatsnew/3.4.rst:2489 msgid "" -":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, and :c:func:" -"`PyObject_Str`, along with some other internal C APIs, now include a " -"debugging assertion that ensures they are not used in situations where they " -"may silently discard a currently active exception. In cases where discarding " -"the active exception is expected and desired (for example, because it has " -"already been saved locally with :c:func:`PyErr_Fetch` or is being " -"deliberately replaced with a different exception), an explicit :c:func:" -"`PyErr_Clear` call will be needed to avoid triggering the assertion when " -"invoking these operations (directly or indirectly) and running against a " -"version of Python that is compiled with assertions enabled." +":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, " +"and :c:func:`PyObject_Str`, along with some other internal C APIs, now " +"include a debugging assertion that ensures they are not used in situations " +"where they may silently discard a currently active exception. In cases where " +"discarding the active exception is expected and desired (for example, " +"because it has already been saved locally with :c:func:`PyErr_Fetch` or is " +"being deliberately replaced with a different exception), an " +"explicit :c:func:`PyErr_Clear` call will be needed to avoid triggering the " +"assertion when invoking these operations (directly or indirectly) and " +"running against a version of Python that is compiled with assertions enabled." msgstr "" #: ../../whatsnew/3.4.rst:2501 @@ -3646,10 +3680,10 @@ msgstr "" #: ../../whatsnew/3.4.rst:2505 msgid "" "The result of the :c:data:`PyOS_ReadlineFunctionPointer` callback must now " -"be a string allocated by :c:func:`PyMem_RawMalloc` or :c:func:" -"`PyMem_RawRealloc`, or ``NULL`` if an error occurred, instead of a string " -"allocated by :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc` (:issue:" -"`16742`)" +"be a string allocated by :c:func:`PyMem_RawMalloc` " +"or :c:func:`PyMem_RawRealloc`, or ``NULL`` if an error occurred, instead of " +"a string allocated by :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc` " +"(:issue:`16742`)" msgstr "" #: ../../whatsnew/3.4.rst:2511 diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 1fcb0649025..84004b38cdb 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,9 +6,9 @@ # Noah Chen , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-10 20:44+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,7 +32,6 @@ msgid "Elvis Pranskevichus , Yury Selivanov " msgstr "Elvis Pranskevichus , Yury Selivanov " #: ../../whatsnew/3.5.rst:47 -#, fuzzy msgid "" "This article explains the new features in Python 3.5, compared to 3.4. " "Python 3.5 was released on September 13, 2015. See the `changelog , Yury Selivanov " msgstr "Elvis Pranskevichus , Yury Selivanov " #: ../../whatsnew/3.6.rst:47 -#, fuzzy msgid "" "This article explains the new features in Python 3.6, compared to 3.5. " "Python 3.6 was released on December 23, 2016. See the `changelog , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -708,7 +708,6 @@ msgid "" msgstr "" #: ../../whatsnew/3.8.rst:430 -#, fuzzy msgid "" ">>> def parse(family):\n" "... lastname, *members = family.split()\n" @@ -718,9 +717,9 @@ msgid "" "('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'maggie')" msgstr "" ">>> def parse(family):\n" -" lastname, *members = family.split()\n" -" return lastname.upper(), *members\n" -"\n" +"... lastname, *members = family.split()\n" +"... return lastname.upper(), *members\n" +"...\n" ">>> parse('simpsons homer marge bart lisa maggie')\n" "('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'maggie')" @@ -1397,7 +1396,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:848 msgid "IDLE and idlelib" -msgstr "" +msgstr "IDLE 和 idlelib" #: ../../whatsnew/3.8.rst:850 msgid "" @@ -3722,7 +3721,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:2337 msgid "Notable security feature in 3.8.14" -msgstr "" +msgstr "Python 3.8.14 中顯著的安全性功能" #: ../../whatsnew/3.8.rst:2339 msgid "" diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index 6a2f8c50e87..8ae229ee4a5 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -1,11 +1,11 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" @@ -714,7 +714,7 @@ msgstr "" #: ../../whatsnew/3.9.rst:470 msgid "IDLE and idlelib" -msgstr "" +msgstr "IDLE 和 idlelib" #: ../../whatsnew/3.9.rst:472 msgid "" @@ -2590,7 +2590,7 @@ msgstr "" #: ../../whatsnew/3.9.rst:1588 msgid "Notable security feature in 3.9.14" -msgstr "" +msgstr "Python 3.9.14 中顯著的安全性功能" #: ../../whatsnew/3.9.rst:1590 msgid "" diff --git a/whatsnew/changelog.po b/whatsnew/changelog.po index bbbdb4ce13b..bd0ca5445c3 100644 --- a/whatsnew/changelog.po +++ b/whatsnew/changelog.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # Noah Chen , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-03 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:21+0000\n" diff --git a/whatsnew/index.po b/whatsnew/index.po index 89b1ecce37a..5a68b70e925 100644 --- a/whatsnew/index.po +++ b/whatsnew/index.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ # Steven Hsu , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800\n" "PO-Revision-Date: 2022-07-07 11:37+0800\n" From 555102195176d1cdce53f00d76ab62ae44628af3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Sep 2025 20:55:45 +0800 Subject: [PATCH 04/28] build(deps): bump actions/setup-python from 5 to 6 (#1145) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e7acfe52ad..5adceaf466c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v5 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: python-version: "3.14" From 71ca89d2597589d133ba7e01c756a8a72ae4a94b Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Thu, 18 Sep 2025 17:09:46 +0800 Subject: [PATCH 05/28] Sync with CPython 3.14 (#1146) Co-authored-by: github-actions[bot] Co-authored-by: Matt.Wang --- .github/workflows/ci.yml | 2 +- c-api/hash.po | 17 +- c-api/init.po | 1337 ++++----- c-api/long.po | 461 ++- deprecations/c-api-pending-removal-in-3.18.po | 142 +- deprecations/index.po | 672 ++--- deprecations/pending-removal-in-3.14.po | 155 +- deprecations/pending-removal-in-3.17.po | 32 +- extending/extending.po | 374 ++- glossary.po | 1806 ++++++------ howto/enum.po | 245 +- howto/remote_debugging.po | 384 ++- library/argparse.po | 696 ++--- library/collections.abc.po | 299 +- library/concurrent.futures.po | 305 +- library/constants.po | 102 +- library/csv.po | 245 +- library/enum.po | 648 +++-- library/getpass.po | 23 +- library/html.po | 33 +- library/inspect.po | 844 +++--- library/locale.po | 453 +-- library/logging.po | 780 +++--- library/os.po | 1086 ++++---- library/shutil.po | 180 +- library/ssl.po | 1254 ++++----- library/stdtypes.po | 1274 ++++----- library/typing.po | 2285 +++++++-------- library/unicodedata.po | 211 +- library/unittest.mock.po | 723 +++-- library/venv.po | 150 +- library/warnings.po | 209 +- library/zipfile.po | 462 +-- reference/compound_stmts.po | 294 +- reference/datamodel.po | 1385 ++++----- reference/lexical_analysis.po | 357 +-- reference/simple_stmts.po | 117 +- tutorial/controlflow.po | 512 ++-- whatsnew/3.12.po | 1648 ++++++----- whatsnew/3.13.po | 2033 +++++++------- whatsnew/3.14.po | 2467 ++++++++--------- whatsnew/3.5.po | 981 ++++--- 42 files changed, 13958 insertions(+), 13725 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5adceaf466c..74feaecdce8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-python@v6 with: - python-version: "3.14" + python-version: "3.13" - name: Install Dependencies run: sudo apt-get install gettext diff --git a/c-api/hash.po b/c-api/hash.po index 780b001cbbe..cbd53b8163c 100644 --- a/c-api/hash.po +++ b/c-api/hash.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2024-04-30 00:20+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -62,6 +62,10 @@ msgstr "用於複數虛數部分的乘數。" msgid "Hash function definition used by :c:func:`PyHash_GetFuncDef`." msgstr ":c:func:`PyHash_GetFuncDef` 所使用的雜湊函式定義。" +#: ../../c-api/hash.rst:56 +msgid "Hash function." +msgstr "雜湊函式。" + #: ../../c-api/hash.rst:60 msgid "Hash function name (UTF-8 encoded string)." msgstr "雜湊函式名稱(UTF-8 編碼字串)。" @@ -99,16 +103,15 @@ msgstr "此函式不會失敗:它不會回傳 ``-1``。" #: ../../c-api/hash.rst:95 msgid "" "Compute and return the hash value of a buffer of *len* bytes starting at " -"address *ptr*. The hash is guaranteed to match that " -"of :class:`bytes`, :class:`memoryview`, and other built-in objects that " -"implement the :ref:`buffer protocol `." +"address *ptr*. The hash is guaranteed to match that of :class:`bytes`, :" +"class:`memoryview`, and other built-in objects that implement the :ref:" +"`buffer protocol `." msgstr "" #: ../../c-api/hash.rst:100 msgid "" -"Use this function to implement hashing for immutable objects " -"whose :c:member:`~PyTypeObject.tp_richcompare` function compares to another " -"object's buffer." +"Use this function to implement hashing for immutable objects whose :c:member:" +"`~PyTypeObject.tp_richcompare` function compares to another object's buffer." msgstr "" #: ../../c-api/hash.rst:104 diff --git a/c-api/init.po b/c-api/init.po index 771928aae59..3b5b946f410 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -205,8 +205,10 @@ msgstr ":c:func:`PyMutex_Unlock`" msgid "" "Despite their apparent similarity to some of the functions listed above, the " "following functions **should not be called** before the interpreter has been " -"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, " -"and :c:func:`Py_RunMain`." +"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:" +"`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:" +"`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:" +"`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, and :c:func:`Py_RunMain`." msgstr "" #: ../../c-api/init.rst:90 @@ -216,30 +218,30 @@ msgstr "" #: ../../c-api/init.rst:92 msgid "" "Python has variables for the global configuration to control different " -"features and options. By default, these flags are controlled " -"by :ref:`command line options `." +"features and options. By default, these flags are controlled by :ref:" +"`command line options `." msgstr "" #: ../../c-api/init.rst:96 msgid "" "When a flag is set by an option, the value of the flag is the number of " -"times that the option was set. For example, ``-b`` " -"sets :c:data:`Py_BytesWarningFlag` to 1 and ``-bb`` " -"sets :c:data:`Py_BytesWarningFlag` to 2." +"times that the option was set. For example, ``-b`` sets :c:data:" +"`Py_BytesWarningFlag` to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to " +"2." msgstr "" #: ../../c-api/init.rst:102 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.bytes_warning` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"bytes_warning` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:106 msgid "" -"Issue a warning when comparing :class:`bytes` or :class:`bytearray` " -"with :class:`str` or :class:`bytes` with :class:`int`. Issue an error if " -"greater or equal to ``2``." +"Issue a warning when comparing :class:`bytes` or :class:`bytearray` with :" +"class:`str` or :class:`bytes` with :class:`int`. Issue an error if greater " +"or equal to ``2``." msgstr "" #: ../../c-api/init.rst:110 @@ -248,9 +250,9 @@ msgstr "由 :option:`-b` 選項設定。" #: ../../c-api/init.rst:116 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.parser_debug` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"parser_debug` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:120 @@ -267,9 +269,9 @@ msgstr "由 :option:`-d` 選項與 :envvar:`PYTHONDEBUG` 環境變數設定。" #: ../../c-api/init.rst:130 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.write_bytecode` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"write_bytecode` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:134 @@ -287,15 +289,15 @@ msgstr "" #: ../../c-api/init.rst:144 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.pathconfig_warnings` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"pathconfig_warnings` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:148 msgid "" -"Suppress error messages when calculating the module search path " -"in :c:func:`Py_GetPath`." +"Suppress error messages when calculating the module search path in :c:func:" +"`Py_GetPath`." msgstr "" #: ../../c-api/init.rst:151 @@ -304,9 +306,8 @@ msgstr "" #: ../../c-api/init.rst:157 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.hash_seed` " -"and :c:member:`PyConfig.use_hash_seed` should be used instead, " +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"hash_seed` and :c:member:`PyConfig.use_hash_seed` should be used instead, " "see :ref:`Python Initialization Configuration `." msgstr "" @@ -325,15 +326,15 @@ msgstr "" #: ../../c-api/init.rst:172 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.use_environment` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"use_environment` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:176 msgid "" -"Ignore all :envvar:`!PYTHON*` environment variables, " -"e.g. :envvar:`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." +"Ignore all :envvar:`!PYTHON*` environment variables, e.g. :envvar:" +"`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." msgstr "" "忽略所有可能被設定的 :envvar:`!PYTHON*` 環境變數,例如 :envvar:`PYTHONPATH` " "與 :envvar:`PYTHONHOME`。" @@ -344,9 +345,9 @@ msgstr "由 :option:`-E` 與 :option:`-I` 選項設定。" #: ../../c-api/init.rst:185 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.inspect` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"inspect` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:189 @@ -364,9 +365,9 @@ msgstr "由 :option:`-i` 選項與 :envvar:`PYTHONINSPECT` 環境變數設定。 #: ../../c-api/init.rst:200 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.interactive` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"interactive` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:204 @@ -375,9 +376,9 @@ msgstr "由 :option:`-i` 選項設定。" #: ../../c-api/init.rst:210 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.isolated` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"isolated` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:214 @@ -392,9 +393,9 @@ msgstr "由 :option:`-i` 選項設定。" #: ../../c-api/init.rst:225 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyPreConfig.legacy_windows_fs_encoding` should be used " -"instead, see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` should be used instead, see :ref:`Python " +"Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:229 @@ -422,15 +423,15 @@ msgstr "可用性" #: ../../c-api/init.rst:244 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.legacy_windows_stdio` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"legacy_windows_stdio` should be used instead, see :ref:`Python " +"Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:248 msgid "" -"If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!" -"io._WindowsConsoleIO` for :mod:`sys` standard streams." +"If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!io." +"_WindowsConsoleIO` for :mod:`sys` standard streams." msgstr "" #: ../../c-api/init.rst:251 @@ -445,17 +446,17 @@ msgstr "更多詳情請見 :pep:`528`。" #: ../../c-api/init.rst:262 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.site_import` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"site_import` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:266 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " -"manipulations if :mod:`site` is explicitly imported later " -"(call :func:`site.main` if you want them to be triggered)." +"manipulations if :mod:`site` is explicitly imported later (call :func:`site." +"main` if you want them to be triggered)." msgstr "" #: ../../c-api/init.rst:271 @@ -464,30 +465,30 @@ msgstr "由 :option:`-S` 選項設定。" #: ../../c-api/init.rst:277 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.user_site_directory` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"user_site_directory` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:281 msgid "" -"Don't add the :data:`user site-packages directory ` " -"to :data:`sys.path`." +"Don't add the :data:`user site-packages directory ` to :data:" +"`sys.path`." msgstr "" #: ../../c-api/init.rst:284 msgid "" -"Set by the :option:`-s` and :option:`-I` options, and " -"the :envvar:`PYTHONNOUSERSITE` environment variable." +"Set by the :option:`-s` and :option:`-I` options, and the :envvar:" +"`PYTHONNOUSERSITE` environment variable." msgstr "" "由 :option:`-s` 選項、:option:`-I` 選項與 :envvar:`PYTHONNOUSERSITE` 環境變數" "設定。" #: ../../c-api/init.rst:291 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.optimization_level` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"optimization_level` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:295 @@ -498,9 +499,9 @@ msgstr "由 :option:`-O` 選項與 :envvar:`PYTHONOPTIMIZE` 環境變數設定 #: ../../c-api/init.rst:302 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.quiet` should be used instead, see :ref:`Python " -"Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"quiet` should be used instead, see :ref:`Python Initialization Configuration " +"`." msgstr "" #: ../../c-api/init.rst:306 @@ -514,9 +515,9 @@ msgstr "由 :option:`-q` 選項設定。" #: ../../c-api/init.rst:316 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.buffered_stdio` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"buffered_stdio` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:320 @@ -531,9 +532,9 @@ msgstr "由 :option:`-u` 選項與 :envvar:`PYTHONUNBUFFERED` 環境變數設定 #: ../../c-api/init.rst:329 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.verbose` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"verbose` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:333 @@ -557,9 +558,8 @@ msgstr "" #: ../../c-api/init.rst:360 msgid "" "Initialize the Python interpreter. In an application embedding Python, " -"this should be called before using any other Python/C API functions; " -"see :ref:`Before Python Initialization ` for the few " -"exceptions." +"this should be called before using any other Python/C API functions; see :" +"ref:`Before Python Initialization ` for the few exceptions." msgstr "" #: ../../c-api/init.rst:364 @@ -622,19 +622,18 @@ msgstr "" #: ../../c-api/init.rst:417 msgid "" "Undo all initializations made by :c:func:`Py_Initialize` and subsequent use " -"of Python/C API functions, and destroy all sub-interpreters " -"(see :c:func:`Py_NewInterpreter` below) that were created and not yet " -"destroyed since the last call to :c:func:`Py_Initialize`. This is a no-op " -"when called for a second time (without calling :c:func:`Py_Initialize` again " -"first)." +"of Python/C API functions, and destroy all sub-interpreters (see :c:func:" +"`Py_NewInterpreter` below) that were created and not yet destroyed since the " +"last call to :c:func:`Py_Initialize`. This is a no-op when called for a " +"second time (without calling :c:func:`Py_Initialize` again first)." msgstr "" #: ../../c-api/init.rst:423 msgid "" "Since this is the reverse of :c:func:`Py_Initialize`, it should be called in " "the same thread with the same interpreter active. That means the main " -"thread and the main interpreter. This should never be called " -"while :c:func:`Py_RunMain` is running." +"thread and the main interpreter. This should never be called while :c:func:" +"`Py_RunMain` is running." msgstr "" #: ../../c-api/init.rst:428 @@ -685,11 +684,11 @@ msgstr "" #: ../../c-api/init.rst:462 msgid "" -"Raises an :ref:`auditing event ` " -"``cpython._PySys_ClearAuditHooks`` with no arguments." +"Raises an :ref:`auditing event ` ``cpython." +"_PySys_ClearAuditHooks`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` " -"``cpython._PySys_ClearAuditHooks``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." +"_PySys_ClearAuditHooks``。" #: ../../c-api/init.rst:469 msgid "" @@ -738,9 +737,9 @@ msgstr "" #: ../../c-api/init.rst:504 msgid "" -"In terms of the CPython runtime configuration APIs documented in " -"the :ref:`runtime configuration ` section (and without " -"accounting for error handling), ``Py_Main`` is approximately equivalent to::" +"In terms of the CPython runtime configuration APIs documented in the :ref:" +"`runtime configuration ` section (and without accounting for " +"error handling), ``Py_Main`` is approximately equivalent to::" msgstr "" #: ../../c-api/init.rst:508 @@ -757,14 +756,14 @@ msgstr "" #: ../../c-api/init.rst:516 msgid "" "In normal usage, an embedding application will call this function *instead* " -"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` " -"or :c:func:`Py_InitializeFromConfig` directly, and all settings will be " -"applied as described elsewhere in this documentation. If this function is " -"instead called *after* a preceding runtime initialization API call, then " -"exactly which environmental and command line configuration settings will be " -"updated is version dependent (as it depends on which settings correctly " -"support being modified after they have already been set once when the " -"runtime was first initialized)." +"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` or :c:func:" +"`Py_InitializeFromConfig` directly, and all settings will be applied as " +"described elsewhere in this documentation. If this function is instead " +"called *after* a preceding runtime initialization API call, then exactly " +"which environmental and command line configuration settings will be updated " +"is version dependent (as it depends on which settings correctly support " +"being modified after they have already been set once when the runtime was " +"first initialized)." msgstr "" #: ../../c-api/init.rst:529 @@ -773,11 +772,11 @@ msgstr "" #: ../../c-api/init.rst:531 msgid "" -"Executes the command (:c:member:`PyConfig.run_command`), the script " -"(:c:member:`PyConfig.run_filename`) or the module " -"(:c:member:`PyConfig.run_module`) specified on the command line or in the " -"configuration. If none of these values are set, runs the interactive Python " -"prompt (REPL) using the ``__main__`` module's global namespace." +"Executes the command (:c:member:`PyConfig.run_command`), the script (:c:" +"member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig." +"run_module`) specified on the command line or in the configuration. If none " +"of these values are set, runs the interactive Python prompt (REPL) using the " +"``__main__`` module's global namespace." msgstr "" #: ../../c-api/init.rst:537 @@ -807,8 +806,8 @@ msgstr "" #: ../../c-api/init.rst:552 msgid "" "See :ref:`Python Configuration ` for an example of a " -"customized Python that always runs in isolated mode " -"using :c:func:`Py_RunMain`." +"customized Python that always runs in isolated mode using :c:func:" +"`Py_RunMain`." msgstr "" #: ../../c-api/init.rst:558 @@ -828,9 +827,9 @@ msgstr "" #: ../../c-api/init.rst:577 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.program_name` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"program_name` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:581 @@ -850,8 +849,8 @@ msgstr "" #: ../../c-api/init.rst:592 ../../c-api/init.rst:840 ../../c-api/init.rst:876 #: ../../c-api/init.rst:902 msgid "" -"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get " -"a :c:expr:`wchar_t*` string." +"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" +"`wchar_t*` string." msgstr "" #: ../../c-api/init.rst:600 @@ -875,8 +874,8 @@ msgstr "如果在 :c:func:`Py_Initialize` 之前呼叫,現在會回傳 ``NULL` #: ../../c-api/init.rst:610 ../../c-api/init.rst:705 msgid "" -"Use :c:func:`PyConfig_Get(\"executable\") ` " -"(:data:`sys.executable`) instead." +"Use :c:func:`PyConfig_Get(\"executable\") ` (:data:`sys." +"executable`) instead." msgstr "" #: ../../c-api/init.rst:617 @@ -895,10 +894,10 @@ msgstr "" #: ../../c-api/init.rst:633 msgid "" -"Use :c:func:`PyConfig_Get(\"base_prefix\") ` " -"(:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get(\"prefix\") " -"` (:data:`sys.prefix`) if :ref:`virtual environments ` need to be handled." +"Use :c:func:`PyConfig_Get(\"base_prefix\") ` (:data:`sys." +"base_prefix`) instead. Use :c:func:`PyConfig_Get(\"prefix\") ` " +"(:data:`sys.prefix`) if :ref:`virtual environments ` need to be " +"handled." msgstr "" #: ../../c-api/init.rst:642 @@ -908,11 +907,11 @@ msgid "" "with :c:member:`PyConfig.program_name` and some environment variables; for " "example, if the program name is ``'/usr/local/bin/python'``, the exec-prefix " "is ``'/usr/local'``. The returned string points into static storage; the " -"caller should not modify its value. This corresponds to " -"the :makevar:`exec_prefix` variable in the top-level :file:`Makefile` and " -"the ``--exec-prefix`` argument to the :program:`configure` script at build " -"time. The value is available to Python code as ``sys.base_exec_prefix``. " -"It is only useful on Unix." +"caller should not modify its value. This corresponds to the :makevar:" +"`exec_prefix` variable in the top-level :file:`Makefile` and the ``--exec-" +"prefix`` argument to the :program:`configure` script at build time. The " +"value is available to Python code as ``sys.base_exec_prefix``. It is only " +"useful on Unix." msgstr "" #: ../../c-api/init.rst:653 @@ -940,19 +939,18 @@ msgstr "" #: ../../c-api/init.rst:670 msgid "" -"System administrators will know how to configure the :program:`mount` " -"or :program:`automount` programs to share :file:`/usr/local` between " -"platforms while having :file:`/usr/local/plat` be a different filesystem for " -"each platform." +"System administrators will know how to configure the :program:`mount` or :" +"program:`automount` programs to share :file:`/usr/local` between platforms " +"while having :file:`/usr/local/plat` be a different filesystem for each " +"platform." msgstr "" #: ../../c-api/init.rst:681 msgid "" -"Use :c:func:`PyConfig_Get(\"base_exec_prefix\") ` " -"(:data:`sys.base_exec_prefix`) instead. " -"Use :c:func:`PyConfig_Get(\"exec_prefix\") ` " -"(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " -"be handled." +"Use :c:func:`PyConfig_Get(\"base_exec_prefix\") ` (:data:`sys." +"base_exec_prefix`) instead. Use :c:func:`PyConfig_Get(\"exec_prefix\") " +"` (:data:`sys.exec_prefix`) if :ref:`virtual environments " +"` need to be handled." msgstr "" #: ../../c-api/init.rst:693 @@ -979,8 +977,8 @@ msgstr "" #: ../../c-api/init.rst:734 msgid "" -"Use :c:func:`PyConfig_Get(\"module_search_paths\") ` " -"(:data:`sys.path`) instead." +"Use :c:func:`PyConfig_Get(\"module_search_paths\") ` (:data:" +"`sys.path`) instead." msgstr "" #: ../../c-api/init.rst:740 @@ -998,8 +996,8 @@ msgid "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " "period. The returned string points into static storage; the caller should " -"not modify its value. The value is available to Python code " -"as :data:`sys.version`." +"not modify its value. The value is available to Python code as :data:`sys." +"version`." msgstr "" #: ../../c-api/init.rst:752 @@ -1062,10 +1060,10 @@ msgstr "\"#67, Aug 1 1997, 22:34:28\"" #: ../../c-api/init.rst:815 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.argv`, :c:member:`PyConfig.parse_argv` " -"and :c:member:`PyConfig.safe_path` should be used instead, see :ref:`Python " -"Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " +"should be used instead, see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:820 @@ -1089,8 +1087,8 @@ msgstr "" #: ../../c-api/init.rst:832 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " -"path of the directory where the script is located is prepended " -"to :data:`sys.path`." +"path of the directory where the script is located is prepended to :data:`sys." +"path`." msgstr "" #: ../../c-api/init.rst:835 @@ -1116,8 +1114,8 @@ msgstr "" #: ../../c-api/init.rst:852 msgid "" "On versions before 3.1.3, you can achieve the same effect by manually " -"popping the first :data:`sys.path` element after having " -"called :c:func:`PySys_SetArgv`, for example using::" +"popping the first :data:`sys.path` element after having called :c:func:" +"`PySys_SetArgv`, for example using::" msgstr "" #: ../../c-api/init.rst:856 @@ -1126,17 +1124,16 @@ msgstr "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" #: ../../c-api/init.rst:868 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` should " -"be used instead, see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" +"`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:872 msgid "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " -"``1`` unless the :program:`python` interpreter was started with " -"the :option:`-I`." +"``1`` unless the :program:`python` interpreter was started with the :option:" +"`-I`." msgstr "" #: ../../c-api/init.rst:882 @@ -1145,9 +1142,9 @@ msgstr "" #: ../../c-api/init.rst:889 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.home` should be used instead, see :ref:`Python " -"Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"home` should be used instead, see :ref:`Python Initialization Configuration " +"`." msgstr "" #: ../../c-api/init.rst:893 @@ -1167,16 +1164,18 @@ msgstr "" #: ../../c-api/init.rst:910 msgid "" -"Return the default \"home\", that is, the value set " -"by :c:member:`PyConfig.home`, or the value of the :envvar:`PYTHONHOME` " -"environment variable if it is set." +"Return the default \"home\", that is, the value set by :c:member:`PyConfig." +"home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " +"is set." msgstr "" #: ../../c-api/init.rst:920 msgid "" -"Use :c:func:`PyConfig_Get(\"home\") ` or " -"the :envvar:`PYTHONHOME` environment variable instead." -msgstr "改為使用 :c:func:`PyConfig_Get(\"home\") ` 或 :envvar:`PYTHONHOME` 環境變數。" +"Use :c:func:`PyConfig_Get(\"home\") ` or the :envvar:" +"`PYTHONHOME` environment variable instead." +msgstr "" +"改為使用 :c:func:`PyConfig_Get(\"home\") ` 或 :envvar:" +"`PYTHONHOME` 環境變數。" #: ../../c-api/init.rst:928 msgid "Thread State and the Global Interpreter Lock" @@ -1197,22 +1196,21 @@ msgstr "" #: ../../c-api/init.rst:946 msgid "" -"Therefore, the rule exists that only the thread that has acquired " -"the :term:`GIL` may operate on Python objects or call Python/C API " -"functions. In order to emulate concurrency of execution, the interpreter " -"regularly tries to switch threads (see :func:`sys.setswitchinterval`). The " -"lock is also released around potentially blocking I/O operations like " -"reading or writing a file, so that other Python threads can run in the " -"meantime." +"Therefore, the rule exists that only the thread that has acquired the :term:" +"`GIL` may operate on Python objects or call Python/C API functions. In order " +"to emulate concurrency of execution, the interpreter regularly tries to " +"switch threads (see :func:`sys.setswitchinterval`). The lock is also " +"released around potentially blocking I/O operations like reading or writing " +"a file, so that other Python threads can run in the meantime." msgstr "" #: ../../c-api/init.rst:956 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " -"inside a data structure called :c:type:`PyThreadState`, known as " -"a :term:`thread state`. Each OS thread has a thread-local pointer to " -"a :c:type:`PyThreadState`; a thread state referenced by this pointer is " -"considered to be :term:`attached `." +"inside a data structure called :c:type:`PyThreadState`, known as a :term:" +"`thread state`. Each OS thread has a thread-local pointer to a :c:type:" +"`PyThreadState`; a thread state referenced by this pointer is considered to " +"be :term:`attached `." msgstr "" #: ../../c-api/init.rst:961 @@ -1229,10 +1227,10 @@ msgstr "" #: ../../c-api/init.rst:968 msgid "" "In general, there will always be an :term:`attached thread state` when using " -"Python's C API. Only in some specific cases (such as in " -"a :c:macro:`Py_BEGIN_ALLOW_THREADS` block) will the thread not have an " -"attached thread state. If uncertain, check " -"if :c:func:`PyThreadState_GetUnchecked` returns ``NULL``." +"Python's C API. Only in some specific cases (such as in a :c:macro:" +"`Py_BEGIN_ALLOW_THREADS` block) will the thread not have an attached thread " +"state. If uncertain, check if :c:func:`PyThreadState_GetUnchecked` returns " +"``NULL``." msgstr "" #: ../../c-api/init.rst:974 @@ -1290,16 +1288,16 @@ msgstr "" #: ../../c-api/init.rst:1011 msgid "" "The :term:`attached thread state` holds the :term:`GIL` for the entire " -"interpreter. When detaching the :term:`attached thread state`, " -"the :term:`GIL` is released, allowing other threads to attach a thread state " -"to their own thread, thus getting the :term:`GIL` and can start executing. " -"The pointer to the prior :term:`attached thread state` is stored as a local " +"interpreter. When detaching the :term:`attached thread state`, the :term:" +"`GIL` is released, allowing other threads to attach a thread state to their " +"own thread, thus getting the :term:`GIL` and can start executing. The " +"pointer to the prior :term:`attached thread state` is stored as a local " "variable. Upon reaching :c:macro:`Py_END_ALLOW_THREADS`, the thread state " -"that was previously :term:`attached ` is passed " -"to :c:func:`PyEval_RestoreThread`. This function will block until another " -"releases its :term:`thread state `, thus allowing the " -"old :term:`thread state ` to get re-attached and the " -"C API can be called again." +"that was previously :term:`attached ` is passed to :c:" +"func:`PyEval_RestoreThread`. This function will block until another releases " +"its :term:`thread state `, thus allowing the old :" +"term:`thread state ` to get re-attached and the C API " +"can be called again." msgstr "" #: ../../c-api/init.rst:1021 @@ -1307,15 +1305,15 @@ msgid "" "For :term:`free-threaded ` builds, the :term:`GIL` is " "normally out of the question, but detaching the :term:`thread state " "` is still required for blocking I/O and long " -"operations. The difference is that threads don't have to wait for " -"the :term:`GIL` to be released to attach their thread state, allowing true " -"multi-core parallelism." +"operations. The difference is that threads don't have to wait for the :term:" +"`GIL` to be released to attach their thread state, allowing true multi-core " +"parallelism." msgstr "" #: ../../c-api/init.rst:1027 msgid "" -"Calling system I/O functions is the most common use case for detaching " -"the :term:`thread state `, but it can also be useful " +"Calling system I/O functions is the most common use case for detaching the :" +"term:`thread state `, but it can also be useful " "before calling long-running computations which don't need access to Python " "objects, such as compression or cryptographic functions operating over " "memory buffers. For example, the standard :mod:`zlib` and :mod:`hashlib` " @@ -1329,22 +1327,22 @@ msgstr "" #: ../../c-api/init.rst:1040 msgid "" -"When threads are created using the dedicated Python APIs (such as " -"the :mod:`threading` module), a thread state is automatically associated to " -"them and the code showed above is therefore correct. However, when threads " -"are created from C (for example by a third-party library with its own thread " -"management), they don't hold the :term:`GIL`, because they don't have " -"an :term:`attached thread state`." +"When threads are created using the dedicated Python APIs (such as the :mod:" +"`threading` module), a thread state is automatically associated to them and " +"the code showed above is therefore correct. However, when threads are " +"created from C (for example by a third-party library with its own thread " +"management), they don't hold the :term:`GIL`, because they don't have an :" +"term:`attached thread state`." msgstr "" #: ../../c-api/init.rst:1047 msgid "" "If you need to call Python code from these threads (often this will be part " "of a callback API provided by the aforementioned third-party library), you " -"must first register these threads with the interpreter by creating " -"an :term:`attached thread state` before you can start using the Python/C " -"API. When you are done, you should detach the :term:`thread state `, and finally free it." +"must first register these threads with the interpreter by creating an :term:" +"`attached thread state` before you can start using the Python/C API. When " +"you are done, you should detach the :term:`thread state `, and finally free it." msgstr "" #: ../../c-api/init.rst:1054 @@ -1371,13 +1369,13 @@ msgstr "" msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " -"supports the creation of additional interpreters " -"(using :c:func:`Py_NewInterpreter`), but mixing multiple interpreters and " -"the ``PyGILState_*`` API is unsupported. This is " -"because :c:func:`PyGILState_Ensure` and similar functions default " -"to :term:`attaching ` a :term:`thread state` for the " -"main interpreter, meaning that the thread can't safely interact with the " -"calling subinterpreter." +"supports the creation of additional interpreters (using :c:func:" +"`Py_NewInterpreter`), but mixing multiple interpreters and the " +"``PyGILState_*`` API is unsupported. This is because :c:func:" +"`PyGILState_Ensure` and similar functions default to :term:`attaching " +"` a :term:`thread state` for the main interpreter, " +"meaning that the thread can't safely interact with the calling " +"subinterpreter." msgstr "" #: ../../c-api/init.rst:1078 @@ -1439,11 +1437,11 @@ msgid "" "of additional (non-Python) locks that need to be acquired before or reset " "after a fork. OS facilities such as :c:func:`!pthread_atfork` would need to " "be used to accomplish the same thing. Additionally, when extending or " -"embedding Python, calling :c:func:`fork` directly rather than " -"through :func:`os.fork` (and returning to or calling into Python) may result " -"in a deadlock by one of Python's internal locks being held by a thread that " -"is defunct after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the " -"necessary locks, but is not always able to." +"embedding Python, calling :c:func:`fork` directly rather than through :func:" +"`os.fork` (and returning to or calling into Python) may result in a deadlock " +"by one of Python's internal locks being held by a thread that is defunct " +"after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the necessary " +"locks, but is not always able to." msgstr "" #: ../../c-api/init.rst:1129 @@ -1466,18 +1464,18 @@ msgstr "" #: ../../c-api/init.rst:1145 msgid "" "In the late stage of :term:`interpreter shutdown`, after attempting to wait " -"for non-daemon threads to exit (though this can be interrupted " -"by :class:`KeyboardInterrupt`) and running the :mod:`atexit` functions, the " -"runtime is marked as *finalizing*: :c:func:`Py_IsFinalizing` " -"and :func:`sys.is_finalizing` return true. At this point, only the " -"*finalization thread* that initiated finalization (typically the main " -"thread) is allowed to acquire the :term:`GIL`." +"for non-daemon threads to exit (though this can be interrupted by :class:" +"`KeyboardInterrupt`) and running the :mod:`atexit` functions, the runtime is " +"marked as *finalizing*: :c:func:`Py_IsFinalizing` and :func:`sys." +"is_finalizing` return true. At this point, only the *finalization thread* " +"that initiated finalization (typically the main thread) is allowed to " +"acquire the :term:`GIL`." msgstr "" #: ../../c-api/init.rst:1153 msgid "" -"If any thread, other than the finalization thread, attempts to attach " -"a :term:`thread state` during finalization, either explicitly or implicitly, " +"If any thread, other than the finalization thread, attempts to attach a :" +"term:`thread state` during finalization, either explicitly or implicitly, " "the thread enters **a permanently blocked state** where it remains until the " "program exits. In most cases this is harmless, but this can result in " "deadlock if a later stage of finalization attempts to acquire a lock owned " @@ -1522,54 +1520,60 @@ msgid "" "which interpreter they belong." msgstr "" -#: ../../c-api/init.rst:1190 +#: ../../c-api/init.rst:1189 +msgid "" +":pep:`684` introduced the possibility of a :ref:`per-interpreter GIL `. See :c:func:`Py_NewInterpreterFromConfig`." +msgstr "" + +#: ../../c-api/init.rst:1196 msgid "" "This data structure represents the state of a single thread. The only " "public data member is:" msgstr "" -#: ../../c-api/init.rst:1195 +#: ../../c-api/init.rst:1201 msgid "This thread's interpreter state." msgstr "" -#: ../../c-api/init.rst:1206 +#: ../../c-api/init.rst:1212 msgid "Deprecated function which does nothing." msgstr "" -#: ../../c-api/init.rst:1208 +#: ../../c-api/init.rst:1214 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" -#: ../../c-api/init.rst:1210 +#: ../../c-api/init.rst:1216 msgid "The function now does nothing." msgstr "此函式現在不會做任何事情。" -#: ../../c-api/init.rst:1213 +#: ../../c-api/init.rst:1219 msgid "" "This function is now called by :c:func:`Py_Initialize()`, so you don't have " "to call it yourself anymore." msgstr "" -#: ../../c-api/init.rst:1217 +#: ../../c-api/init.rst:1223 msgid "" "This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -#: ../../c-api/init.rst:1227 +#: ../../c-api/init.rst:1233 msgid "" "Detach the :term:`attached thread state` and return it. The thread will have " "no :term:`thread state` upon returning." msgstr "" -#: ../../c-api/init.rst:1233 +#: ../../c-api/init.rst:1239 msgid "" "Set the :term:`attached thread state` to *tstate*. The passed :term:`thread " "state` **should not** be :term:`attached `, otherwise " "deadlock ensues. *tstate* will be attached upon returning." msgstr "" -#: ../../c-api/init.rst:1238 ../../c-api/init.rst:1609 +#: ../../c-api/init.rst:1244 ../../c-api/init.rst:1615 msgid "" "Calling this function from a thread when the runtime is finalizing will hang " "the thread until the program exits, even if the thread was not created by " @@ -1577,14 +1581,14 @@ msgid "" "details." msgstr "" -#: ../../c-api/init.rst:1243 ../../c-api/init.rst:1314 -#: ../../c-api/init.rst:1619 +#: ../../c-api/init.rst:1249 ../../c-api/init.rst:1320 +#: ../../c-api/init.rst:1625 msgid "" "Hangs the current thread, rather than terminating it, if called while the " "interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1249 +#: ../../c-api/init.rst:1255 msgid "" "Return the :term:`attached thread state`. If the thread has no attached " "thread state, (such as when inside of :c:macro:`Py_BEGIN_ALLOW_THREADS` " @@ -1592,78 +1596,78 @@ msgid "" "``NULL``)." msgstr "" -#: ../../c-api/init.rst:1254 +#: ../../c-api/init.rst:1260 msgid "See also :c:func:`PyThreadState_GetUnchecked`." msgstr "也請見 :c:func:`PyThreadState_GetUnchecked`。" -#: ../../c-api/init.rst:1258 +#: ../../c-api/init.rst:1264 msgid "" "Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a " "fatal error if it is NULL. The caller is responsible to check if the result " "is NULL." msgstr "" -#: ../../c-api/init.rst:1262 +#: ../../c-api/init.rst:1268 msgid "" "In Python 3.5 to 3.12, the function was private and known as " "``_PyThreadState_UncheckedGet()``." msgstr "" -#: ../../c-api/init.rst:1269 +#: ../../c-api/init.rst:1275 msgid "" -"Set the :term:`attached thread state` to *tstate*, and return " -"the :term:`thread state` that was attached prior to calling." +"Set the :term:`attached thread state` to *tstate*, and return the :term:" +"`thread state` that was attached prior to calling." msgstr "" -#: ../../c-api/init.rst:1272 +#: ../../c-api/init.rst:1278 msgid "" "This function is safe to call without an :term:`attached thread state`; it " "will simply return ``NULL`` indicating that there was no prior thread state." msgstr "" -#: ../../c-api/init.rst:1279 +#: ../../c-api/init.rst:1285 msgid "" "Similar to :c:func:`PyGILState_Ensure`, this function will hang the thread " "if the runtime is finalizing." msgstr "" -#: ../../c-api/init.rst:1283 +#: ../../c-api/init.rst:1289 msgid "" "The following functions use thread-local storage, and are not compatible " "with sub-interpreters:" msgstr "" -#: ../../c-api/init.rst:1288 +#: ../../c-api/init.rst:1294 msgid "" "Ensure that the current thread is ready to call the Python C API regardless " "of the current state of Python, or of the :term:`attached thread state`. " "This may be called as many times as desired by a thread as long as each call " "is matched with a call to :c:func:`PyGILState_Release`. In general, other " -"thread-related APIs may be used between :c:func:`PyGILState_Ensure` " -"and :c:func:`PyGILState_Release` calls as long as the thread state is " -"restored to its previous state before the Release(). For example, normal " -"usage of the :c:macro:`Py_BEGIN_ALLOW_THREADS` " -"and :c:macro:`Py_END_ALLOW_THREADS` macros is acceptable." +"thread-related APIs may be used between :c:func:`PyGILState_Ensure` and :c:" +"func:`PyGILState_Release` calls as long as the thread state is restored to " +"its previous state before the Release(). For example, normal usage of the :" +"c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS` macros " +"is acceptable." msgstr "" -#: ../../c-api/init.rst:1298 +#: ../../c-api/init.rst:1304 msgid "" "The return value is an opaque \"handle\" to the :term:`attached thread " -"state` when :c:func:`PyGILState_Ensure` was called, and must be passed " -"to :c:func:`PyGILState_Release` to ensure Python is left in the same state. " -"Even though recursive calls are allowed, these handles *cannot* be shared - " -"each unique call to :c:func:`PyGILState_Ensure` must save the handle for its " -"call to :c:func:`PyGILState_Release`." +"state` when :c:func:`PyGILState_Ensure` was called, and must be passed to :c:" +"func:`PyGILState_Release` to ensure Python is left in the same state. Even " +"though recursive calls are allowed, these handles *cannot* be shared - each " +"unique call to :c:func:`PyGILState_Ensure` must save the handle for its call " +"to :c:func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1305 +#: ../../c-api/init.rst:1311 msgid "" "When the function returns, there will be an :term:`attached thread state` " "and the thread will be able to call arbitrary Python code. Failure is a " "fatal error." msgstr "" -#: ../../c-api/init.rst:1309 +#: ../../c-api/init.rst:1315 msgid "" "Calling this function when the runtime is finalizing is unsafe. Doing so " "will either hang the thread until the program ends, or fully crash the " @@ -1671,21 +1675,21 @@ msgid "" "finalization` for more details." msgstr "" -#: ../../c-api/init.rst:1320 +#: ../../c-api/init.rst:1326 msgid "" "Release any resources previously acquired. After this call, Python's state " -"will be the same as it was prior to the " -"corresponding :c:func:`PyGILState_Ensure` call (but generally this state " -"will be unknown to the caller, hence the use of the GILState API)." +"will be the same as it was prior to the corresponding :c:func:" +"`PyGILState_Ensure` call (but generally this state will be unknown to the " +"caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:1325 +#: ../../c-api/init.rst:1331 msgid "" -"Every call to :c:func:`PyGILState_Ensure` must be matched by a call " -"to :c:func:`PyGILState_Release` on the same thread." +"Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" +"func:`PyGILState_Release` on the same thread." msgstr "" -#: ../../c-api/init.rst:1330 +#: ../../c-api/init.rst:1336 msgid "" "Get the :term:`attached thread state` for this thread. May return ``NULL`` " "if no GILState API has been used on the current thread. Note that the main " @@ -1693,279 +1697,279 @@ msgid "" "been made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1336 +#: ../../c-api/init.rst:1342 msgid "" "This function does not account for :term:`thread states ` " -"created by something other than :c:func:`PyGILState_Ensure` (such " -"as :c:func:`PyThreadState_New`). Prefer :c:func:`PyThreadState_Get` " -"or :c:func:`PyThreadState_GetUnchecked` for most cases." +"created by something other than :c:func:`PyGILState_Ensure` (such as :c:func:" +"`PyThreadState_New`). Prefer :c:func:`PyThreadState_Get` or :c:func:" +"`PyThreadState_GetUnchecked` for most cases." msgstr "" -#: ../../c-api/init.rst:1345 +#: ../../c-api/init.rst:1351 msgid "" "Return ``1`` if the current thread is holding the :term:`GIL` and ``0`` " "otherwise. This function can be called from any thread at any time. Only if " -"it has had its :term:`thread state ` initialized " -"via :c:func:`PyGILState_Ensure` will it return ``1``. This is mainly a " -"helper/diagnostic function. It can be useful for example in callback " -"contexts or memory allocation functions when knowing that the :term:`GIL` is " -"locked can allow the caller to perform sensitive actions or otherwise behave " +"it has had its :term:`thread state ` initialized via :" +"c:func:`PyGILState_Ensure` will it return ``1``. This is mainly a helper/" +"diagnostic function. It can be useful for example in callback contexts or " +"memory allocation functions when knowing that the :term:`GIL` is locked can " +"allow the caller to perform sensitive actions or otherwise behave " "differently." msgstr "" -#: ../../c-api/init.rst:1355 +#: ../../c-api/init.rst:1361 msgid "" "If the current Python process has ever created a subinterpreter, this " -"function will *always* return ``1``. " -"Prefer :c:func:`PyThreadState_GetUnchecked` for most cases." +"function will *always* return ``1``. Prefer :c:func:" +"`PyThreadState_GetUnchecked` for most cases." msgstr "" -#: ../../c-api/init.rst:1362 +#: ../../c-api/init.rst:1368 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: ../../c-api/init.rst:1368 +#: ../../c-api/init.rst:1374 msgid "" -"This macro expands to ``{ PyThreadState *_save; _save = " -"PyEval_SaveThread();``. Note that it contains an opening brace; it must be " -"matched with a following :c:macro:`Py_END_ALLOW_THREADS` macro. See above " -"for further discussion of this macro." +"This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" +"``. Note that it contains an opening brace; it must be matched with a " +"following :c:macro:`Py_END_ALLOW_THREADS` macro. See above for further " +"discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1376 +#: ../../c-api/init.rst:1382 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " -"contains a closing brace; it must be matched with an " -"earlier :c:macro:`Py_BEGIN_ALLOW_THREADS` macro. See above for further " -"discussion of this macro." +"contains a closing brace; it must be matched with an earlier :c:macro:" +"`Py_BEGIN_ALLOW_THREADS` macro. See above for further discussion of this " +"macro." msgstr "" -#: ../../c-api/init.rst:1384 +#: ../../c-api/init.rst:1390 msgid "" -"This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent " -"to :c:macro:`Py_END_ALLOW_THREADS` without the closing brace." +"This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" +"c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: ../../c-api/init.rst:1390 +#: ../../c-api/init.rst:1396 msgid "" -"This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent " -"to :c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " +"This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" +"c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: ../../c-api/init.rst:1396 +#: ../../c-api/init.rst:1402 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1398 +#: ../../c-api/init.rst:1404 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1400 +#: ../../c-api/init.rst:1406 msgid "" -":c:func:`Py_Initialize()` now initializes the :term:`GIL` and sets " -"an :term:`attached thread state`." +":c:func:`Py_Initialize()` now initializes the :term:`GIL` and sets an :term:" +"`attached thread state`." msgstr "" -#: ../../c-api/init.rst:1407 +#: ../../c-api/init.rst:1413 msgid "" "Create a new interpreter state object. An :term:`attached thread state` is " "not needed, but may optionally exist if it is necessary to serialize calls " "to this function." msgstr "" -#: ../../c-api/init.rst:1411 +#: ../../c-api/init.rst:1417 msgid "" -"Raises an :ref:`auditing event ` " -"``cpython.PyInterpreterState_New`` with no arguments." +"Raises an :ref:`auditing event ` ``cpython." +"PyInterpreterState_New`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` " -"``cpython.PyInterpreterState_New``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." +"PyInterpreterState_New``。" -#: ../../c-api/init.rst:1416 +#: ../../c-api/init.rst:1422 msgid "" -"Reset all information in an interpreter state object. There must be " -"an :term:`attached thread state` for the interpreter." +"Reset all information in an interpreter state object. There must be an :" +"term:`attached thread state` for the interpreter." msgstr "" -#: ../../c-api/init.rst:1419 +#: ../../c-api/init.rst:1425 msgid "" -"Raises an :ref:`auditing event ` " -"``cpython.PyInterpreterState_Clear`` with no arguments." +"Raises an :ref:`auditing event ` ``cpython." +"PyInterpreterState_Clear`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` " -"``cpython.PyInterpreterState_Clear``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." +"PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1424 +#: ../../c-api/init.rst:1430 msgid "" -"Destroy an interpreter state object. There **should not** be " -"an :term:`attached thread state` for the target interpreter. The interpreter " -"state must have been reset with a previous call " -"to :c:func:`PyInterpreterState_Clear`." +"Destroy an interpreter state object. There **should not** be an :term:" +"`attached thread state` for the target interpreter. The interpreter state " +"must have been reset with a previous call to :c:func:" +"`PyInterpreterState_Clear`." msgstr "" -#: ../../c-api/init.rst:1431 +#: ../../c-api/init.rst:1437 msgid "" "Create a new thread state object belonging to the given interpreter object. " "An :term:`attached thread state` is not needed." msgstr "" -#: ../../c-api/init.rst:1436 +#: ../../c-api/init.rst:1442 msgid "" -"Reset all information in a :term:`thread state` object. *tstate* must " -"be :term:`attached `" +"Reset all information in a :term:`thread state` object. *tstate* must be :" +"term:`attached `" msgstr "" -#: ../../c-api/init.rst:1439 +#: ../../c-api/init.rst:1445 msgid "" "This function now calls the :c:member:`PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1443 +#: ../../c-api/init.rst:1449 msgid "The :c:member:`PyThreadState.on_delete` callback was removed." msgstr ":c:member:`PyThreadState.on_delete` 回呼已被移除。" -#: ../../c-api/init.rst:1449 +#: ../../c-api/init.rst:1455 msgid "" -"Destroy a :term:`thread state` object. *tstate* should not " -"be :term:`attached ` to any thread. *tstate* must " -"have been reset with a previous call to :c:func:`PyThreadState_Clear`." +"Destroy a :term:`thread state` object. *tstate* should not be :term:" +"`attached ` to any thread. *tstate* must have been " +"reset with a previous call to :c:func:`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1457 +#: ../../c-api/init.rst:1463 msgid "" "Detach the :term:`attached thread state` (which must have been reset with a " "previous call to :c:func:`PyThreadState_Clear`) and then destroy it." msgstr "" -#: ../../c-api/init.rst:1460 +#: ../../c-api/init.rst:1466 msgid "" "No :term:`thread state` will be :term:`attached ` " "upon returning." msgstr "" -#: ../../c-api/init.rst:1465 +#: ../../c-api/init.rst:1471 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1467 +#: ../../c-api/init.rst:1473 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1470 +#: ../../c-api/init.rst:1476 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1472 ../../c-api/init.rst:1481 -#: ../../c-api/init.rst:1490 +#: ../../c-api/init.rst:1478 ../../c-api/init.rst:1487 +#: ../../c-api/init.rst:1496 msgid "" "*tstate* must not be ``NULL``, and must be :term:`attached `." msgstr "" -#: ../../c-api/init.rst:1479 +#: ../../c-api/init.rst:1485 msgid "" "Get the unique :term:`thread state` identifier of the Python thread state " "*tstate*." msgstr "" -#: ../../c-api/init.rst:1488 +#: ../../c-api/init.rst:1494 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1497 +#: ../../c-api/init.rst:1503 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1499 +#: ../../c-api/init.rst:1505 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1506 +#: ../../c-api/init.rst:1512 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1509 +#: ../../c-api/init.rst:1515 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1517 +#: ../../c-api/init.rst:1523 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1519 +#: ../../c-api/init.rst:1525 msgid "" "Issue a fatal error if there no :term:`attached thread state`. It cannot " "return NULL." msgstr "" -#: ../../c-api/init.rst:1527 +#: ../../c-api/init.rst:1533 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1530 ../../c-api/init.rst:2117 -#: ../../c-api/init.rst:2124 ../../c-api/init.rst:2143 -#: ../../c-api/init.rst:2150 +#: ../../c-api/init.rst:1536 ../../c-api/init.rst:2125 +#: ../../c-api/init.rst:2132 ../../c-api/init.rst:2151 +#: ../../c-api/init.rst:2158 msgid "The caller must have an :term:`attached thread state`." msgstr "呼叫者必須擁有一個 :term:`attached thread state`。" -#: ../../c-api/init.rst:1537 +#: ../../c-api/init.rst:1543 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1541 +#: ../../c-api/init.rst:1547 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1549 +#: ../../c-api/init.rst:1555 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1551 +#: ../../c-api/init.rst:1557 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1554 +#: ../../c-api/init.rst:1560 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1557 +#: ../../c-api/init.rst:1563 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1562 +#: ../../c-api/init.rst:1568 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1564 ../../c-api/init.rst:1572 +#: ../../c-api/init.rst:1570 ../../c-api/init.rst:1578 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1570 +#: ../../c-api/init.rst:1576 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1579 +#: ../../c-api/init.rst:1585 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1975,7 +1979,7 @@ msgid "" "thread state is attached." msgstr "" -#: ../../c-api/init.rst:1589 +#: ../../c-api/init.rst:1595 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1987,55 +1991,54 @@ msgid "" "is cleared. This raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1597 +#: ../../c-api/init.rst:1603 msgid "" -"The type of the *id* parameter changed from :c:expr:`long` " -"to :c:expr:`unsigned long`." +"The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" +"`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1603 +#: ../../c-api/init.rst:1609 msgid "" ":term:`Attach ` *tstate* to the current thread, which " "must not be ``NULL`` or already :term:`attached `." msgstr "" -#: ../../c-api/init.rst:1606 +#: ../../c-api/init.rst:1612 msgid "" "The calling thread must not already have an :term:`attached thread state`." msgstr "" -#: ../../c-api/init.rst:1614 +#: ../../c-api/init.rst:1620 msgid "" -"Updated to be consistent " -"with :c:func:`PyEval_RestoreThread`, :c:func:`Py_END_ALLOW_THREADS`, " -"and :c:func:`PyGILState_Ensure`, and terminate the current thread if called " -"while the interpreter is finalizing." +"Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" +"`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " +"current thread if called while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1623 +#: ../../c-api/init.rst:1629 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1629 +#: ../../c-api/init.rst:1635 msgid "" "Detach the :term:`attached thread state`. The *tstate* argument, which must " -"not be ``NULL``, is only used to check that it represents " -"the :term:`attached thread state` --- if it isn't, a fatal error is reported." +"not be ``NULL``, is only used to check that it represents the :term:" +"`attached thread state` --- if it isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1634 +#: ../../c-api/init.rst:1640 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1641 +#: ../../c-api/init.rst:1647 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1643 +#: ../../c-api/init.rst:1649 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -2043,7 +2046,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1648 +#: ../../c-api/init.rst:1654 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -2054,134 +2057,134 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1655 +#: ../../c-api/init.rst:1661 msgid "" -"You can switch between sub-interpreters using " -"the :c:func:`PyThreadState_Swap` function. You can create and destroy them " -"using the following functions:" +"You can switch between sub-interpreters using the :c:func:" +"`PyThreadState_Swap` function. You can create and destroy them using the " +"following functions:" msgstr "" -#: ../../c-api/init.rst:1661 +#: ../../c-api/init.rst:1667 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1667 +#: ../../c-api/init.rst:1673 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1671 +#: ../../c-api/init.rst:1677 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1675 +#: ../../c-api/init.rst:1681 msgid "" -"If this is ``0`` " -"then :c:member:`~PyInterpreterConfig.check_multi_interp_extensions` must be " -"``1`` (non-zero). If this is ``1`` then :c:member:`~PyInterpreterConfig.gil` " -"must not be :c:macro:`PyInterpreterConfig_OWN_GIL`." +"If this is ``0`` then :c:member:`~PyInterpreterConfig." +"check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " +"then :c:member:`~PyInterpreterConfig.gil` must not be :c:macro:" +"`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1683 +#: ../../c-api/init.rst:1689 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1687 +#: ../../c-api/init.rst:1693 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1692 +#: ../../c-api/init.rst:1698 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1697 +#: ../../c-api/init.rst:1703 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1702 +#: ../../c-api/init.rst:1708 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1708 +#: ../../c-api/init.rst:1714 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " -"create daemon threads. Otherwise daemon threads are allowed (as long " -"as :c:member:`~PyInterpreterConfig.allow_threads` is non-zero)." +"create daemon threads. Otherwise daemon threads are allowed (as long as :c:" +"member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1715 +#: ../../c-api/init.rst:1721 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " -"is currently active. Otherwise only multi-phase init extension modules " -"(see :pep:`489`) may be imported. (Also " -"see :c:macro:`Py_mod_multiple_interpreters`.)" +"is currently active. Otherwise only multi-phase init extension modules (see :" +"pep:`489`) may be imported. (Also see :c:macro:" +"`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1722 +#: ../../c-api/init.rst:1728 msgid "" -"This must be ``1`` (non-zero) " -"if :c:member:`~PyInterpreterConfig.use_main_obmalloc` is ``0``." +"This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." +"use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:1733 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1734 +#: ../../c-api/init.rst:1740 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1738 +#: ../../c-api/init.rst:1744 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1742 +#: ../../c-api/init.rst:1748 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1744 +#: ../../c-api/init.rst:1750 msgid "" -"If this is :c:macro:`PyInterpreterConfig_OWN_GIL` " -"then :c:member:`PyInterpreterConfig.use_main_obmalloc` must be ``0``." +"If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" +"`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1758 +#: ../../c-api/init.rst:1764 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " "interpreter has separate, independent versions of all imported modules, " -"including the fundamental modules :mod:`builtins`, :mod:`__main__` " -"and :mod:`sys`. The table of loaded modules (``sys.modules``) and the " -"module search path (``sys.path``) are also separate. The new environment " -"has no ``sys.argv`` variable. It has new standard I/O stream file objects " -"``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` (however these refer to the " -"same underlying file descriptors)." +"including the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:" +"`sys`. The table of loaded modules (``sys.modules``) and the module search " +"path (``sys.path``) are also separate. The new environment has no ``sys." +"argv`` variable. It has new standard I/O stream file objects ``sys.stdin``, " +"``sys.stdout`` and ``sys.stderr`` (however these refer to the same " +"underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1768 +#: ../../c-api/init.rst:1774 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1771 +#: ../../c-api/init.rst:1777 msgid "" "Upon success, *tstate_p* will be set to the first :term:`thread state` " "created in the new sub-interpreter. This thread state is :term:`attached " @@ -2192,26 +2195,26 @@ msgid "" "not exist." msgstr "" -#: ../../c-api/init.rst:1780 +#: ../../c-api/init.rst:1786 msgid "" "Like all other Python/C API functions, an :term:`attached thread state` must " "be present before calling this function, but it might be detached upon " "returning. On success, the returned thread state will be :term:`attached " -"`. If the sub-interpreter is created with its " -"own :term:`GIL` then the :term:`attached thread state` of the calling " -"interpreter will be detached. When the function returns, the new " -"interpreter's :term:`thread state` will be :term:`attached ` to the current thread and the previous interpreter's :term:`attached " -"thread state` will remain detached." +"`. If the sub-interpreter is created with its own :" +"term:`GIL` then the :term:`attached thread state` of the calling interpreter " +"will be detached. When the function returns, the new interpreter's :term:" +"`thread state` will be :term:`attached ` to the " +"current thread and the previous interpreter's :term:`attached thread state` " +"will remain detached." msgstr "" -#: ../../c-api/init.rst:1791 +#: ../../c-api/init.rst:1797 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1794 +#: ../../c-api/init.rst:1800 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2243,59 +2246,58 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init.rst:1809 +#: ../../c-api/init.rst:1815 msgid "" "Note that the config is used only briefly and does not get modified. During " -"initialization the config's values are converted into " -"various :c:type:`PyInterpreterState` values. A read-only copy of the config " -"may be stored internally on the :c:type:`PyInterpreterState`." +"initialization the config's values are converted into various :c:type:" +"`PyInterpreterState` values. A read-only copy of the config may be stored " +"internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1818 +#: ../../c-api/init.rst:1824 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1820 +#: ../../c-api/init.rst:1826 msgid "" -"For modules using multi-phase initialization, " -"e.g. :c:func:`PyModule_FromDefAndSpec`, a separate module object is created " -"and initialized for each interpreter. Only C-level static and global " -"variables are shared between these module objects." +"For modules using multi-phase initialization, e.g. :c:func:" +"`PyModule_FromDefAndSpec`, a separate module object is created and " +"initialized for each interpreter. Only C-level static and global variables " +"are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1826 +#: ../../c-api/init.rst:1832 msgid "" -"For modules using single-phase initialization, " -"e.g. :c:func:`PyModule_Create`, the first time a particular extension is " -"imported, it is initialized normally, and a (shallow) copy of its module's " -"dictionary is squirreled away. When the same extension is imported by " -"another (sub-)interpreter, a new module is initialized and filled with the " -"contents of this copy; the extension's ``init`` function is not called. " -"Objects in the module's dictionary thus end up shared across " -"(sub-)interpreters, which might cause unwanted behavior (see `Bugs and " -"caveats`_ below)." +"For modules using single-phase initialization, e.g. :c:func:" +"`PyModule_Create`, the first time a particular extension is imported, it is " +"initialized normally, and a (shallow) copy of its module's dictionary is " +"squirreled away. When the same extension is imported by another " +"(sub-)interpreter, a new module is initialized and filled with the contents " +"of this copy; the extension's ``init`` function is not called. Objects in " +"the module's dictionary thus end up shared across (sub-)interpreters, which " +"might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1837 +#: ../../c-api/init.rst:1843 msgid "" "Note that this is different from what happens when an extension is imported " -"after the interpreter has been completely re-initialized by " -"calling :c:func:`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, " -"the extension's ``initmodule`` function *is* called again. As with multi-" -"phase initialization, this means that only C-level static and global " -"variables are shared between these modules." +"after the interpreter has been completely re-initialized by calling :c:func:" +"`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, the extension's " +"``initmodule`` function *is* called again. As with multi-phase " +"initialization, this means that only C-level static and global variables are " +"shared between these modules." msgstr "" -#: ../../c-api/init.rst:1857 +#: ../../c-api/init.rst:1863 msgid "" -"Create a new sub-interpreter. This is essentially just a wrapper " -"around :c:func:`Py_NewInterpreterFromConfig` with a config that preserves " -"the existing behavior. The result is an unisolated sub-interpreter that " -"shares the main interpreter's GIL, allows fork/exec, allows daemon threads, " -"and allows single-phase init modules." +"Create a new sub-interpreter. This is essentially just a wrapper around :c:" +"func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " +"behavior. The result is an unisolated sub-interpreter that shares the main " +"interpreter's GIL, allows fork/exec, allows daemon threads, and allows " +"single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1869 +#: ../../c-api/init.rst:1875 msgid "" "Destroy the (sub-)interpreter represented by the given :term:`thread state`. " "The given thread state must be :term:`attached `. " @@ -2303,17 +2305,17 @@ msgid "" "thread states associated with this interpreter are destroyed." msgstr "" -#: ../../c-api/init.rst:1874 +#: ../../c-api/init.rst:1880 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1879 +#: ../../c-api/init.rst:1887 msgid "A Per-Interpreter GIL" msgstr "直譯器各別持有的 GIL" -#: ../../c-api/init.rst:1881 +#: ../../c-api/init.rst:1889 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2322,10 +2324,10 @@ msgid "" "interpreters or blocking any others. Thus a single Python process can truly " "take advantage of multiple CPU cores when running Python code. The " "isolation also encourages a different approach to concurrency than that of " -"just using threads. (See :pep:`554`.)" +"just using threads. (See :pep:`554` and :pep:`684`.)" msgstr "" -#: ../../c-api/init.rst:1891 +#: ../../c-api/init.rst:1899 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2339,7 +2341,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1902 +#: ../../c-api/init.rst:1910 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2347,7 +2349,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1907 +#: ../../c-api/init.rst:1915 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2357,11 +2359,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1918 +#: ../../c-api/init.rst:1926 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1920 +#: ../../c-api/init.rst:1928 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2374,7 +2376,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1930 +#: ../../c-api/init.rst:1938 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2383,37 +2385,37 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1936 +#: ../../c-api/init.rst:1944 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " "and OS-level threads, an assumption broken by the presence of sub-" "interpreters. It is highly recommended that you don't switch sub-" -"interpreters between a pair of matching :c:func:`PyGILState_Ensure` " -"and :c:func:`PyGILState_Release` calls. Furthermore, extensions (such " -"as :mod:`ctypes`) using these APIs to allow calling of Python code from non-" -"Python created threads will probably be broken when using sub-interpreters." +"interpreters between a pair of matching :c:func:`PyGILState_Ensure` and :c:" +"func:`PyGILState_Release` calls. Furthermore, extensions (such as :mod:" +"`ctypes`) using these APIs to allow calling of Python code from non-Python " +"created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1947 +#: ../../c-api/init.rst:1955 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1949 +#: ../../c-api/init.rst:1957 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1956 +#: ../../c-api/init.rst:1964 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1960 +#: ../../c-api/init.rst:1968 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2421,17 +2423,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1965 +#: ../../c-api/init.rst:1973 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1966 +#: ../../c-api/init.rst:1974 msgid "" "with the main thread holding an :term:`attached thread state` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1969 +#: ../../c-api/init.rst:1977 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2439,25 +2441,25 @@ msgid "" "if the :term:`thread state ` is detached." msgstr "" -#: ../../c-api/init.rst:1974 +#: ../../c-api/init.rst:1982 msgid "" "This function doesn't need an :term:`attached thread state`. However, to " -"call this function in a subinterpreter, the caller must have " -"an :term:`attached thread state`. Otherwise, the function *func* can be " -"scheduled to be called from the wrong interpreter." +"call this function in a subinterpreter, the caller must have an :term:" +"`attached thread state`. Otherwise, the function *func* can be scheduled to " +"be called from the wrong interpreter." msgstr "" -#: ../../c-api/init.rst:1979 +#: ../../c-api/init.rst:1987 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " "thread is busy executing a system call, *func* won't be called before the " "system call returns. This function is generally **not** suitable for " -"calling Python code from arbitrary C threads. Instead, use " -"the :ref:`PyGILState API`." +"calling Python code from arbitrary C threads. Instead, use the :ref:" +"`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1988 +#: ../../c-api/init.rst:1996 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2465,18 +2467,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1997 +#: ../../c-api/init.rst:2005 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:2002 +#: ../../c-api/init.rst:2010 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:2006 +#: ../../c-api/init.rst:2014 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2486,76 +2488,78 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:2016 +#: ../../c-api/init.rst:2024 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " "the registration function as *obj*, *frame* is the frame object to which the " -"event pertains, *what* is one of the " -"constants :c:data:`PyTrace_CALL`, :c:data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, :c:data:`PyTrace_RETURN`, :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION`, :c:data:`PyTrace_C_RETURN`, " -"or :c:data:`PyTrace_OPCODE`, and *arg* depends on the value of *what*:" +"event pertains, *what* is one of the constants :c:data:`PyTrace_CALL`, :c:" +"data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, :c:data:`PyTrace_RETURN`, :" +"c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION`, :c:data:" +"`PyTrace_C_RETURN`, or :c:data:`PyTrace_OPCODE`, and *arg* depends on the " +"value of *what*:" msgstr "" -#: ../../c-api/init.rst:2025 +#: ../../c-api/init.rst:2033 msgid "Value of *what*" msgstr "*what* 的值" -#: ../../c-api/init.rst:2025 +#: ../../c-api/init.rst:2033 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:2027 +#: ../../c-api/init.rst:2035 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:2027 ../../c-api/init.rst:2032 -#: ../../c-api/init.rst:2043 +#: ../../c-api/init.rst:2035 ../../c-api/init.rst:2040 +#: ../../c-api/init.rst:2051 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:2029 +#: ../../c-api/init.rst:2037 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:2029 +#: ../../c-api/init.rst:2037 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:2032 +#: ../../c-api/init.rst:2040 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:2034 +#: ../../c-api/init.rst:2042 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:2034 +#: ../../c-api/init.rst:2042 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:2037 +#: ../../c-api/init.rst:2045 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:2037 ../../c-api/init.rst:2039 -#: ../../c-api/init.rst:2041 +#: ../../c-api/init.rst:2045 ../../c-api/init.rst:2047 +#: ../../c-api/init.rst:2049 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:2039 +#: ../../c-api/init.rst:2047 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:2041 +#: ../../c-api/init.rst:2049 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:2043 +#: ../../c-api/init.rst:2051 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:2048 +#: ../../c-api/init.rst:2056 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2564,7 +2568,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:2057 +#: ../../c-api/init.rst:2065 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2576,129 +2580,128 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:2068 +#: ../../c-api/init.rst:2076 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " -"reported. It may be disabled for a frame by " -"setting :attr:`~frame.f_trace_lines` to *0* on that frame." +"reported. It may be disabled for a frame by setting :attr:`~frame." +"f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:2076 +#: ../../c-api/init.rst:2084 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:2082 +#: ../../c-api/init.rst:2090 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:2088 +#: ../../c-api/init.rst:2096 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:2094 +#: ../../c-api/init.rst:2102 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:2100 +#: ../../c-api/init.rst:2108 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " -"event is not emitted by default: it must be explicitly requested by " -"setting :attr:`~frame.f_trace_opcodes` to *1* on the frame." +"event is not emitted by default: it must be explicitly requested by setting :" +"attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:2108 +#: ../../c-api/init.rst:2116 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " "If the profile function needs to maintain state, using a different value for " "*obj* for each thread provides a convenient and thread-safe place to store " -"it. The profile function is called for all monitored events " -"except :c:data:`PyTrace_LINE` :c:data:`PyTrace_OPCODE` " -"and :c:data:`PyTrace_EXCEPTION`." +"it. The profile function is called for all monitored events except :c:data:" +"`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:2115 +#: ../../c-api/init.rst:2123 msgid "See also the :func:`sys.setprofile` function." msgstr "另請參閱 :func:`sys.setprofile` 函式。" -#: ../../c-api/init.rst:2121 +#: ../../c-api/init.rst:2129 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:2126 +#: ../../c-api/init.rst:2134 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:2134 +#: ../../c-api/init.rst:2142 msgid "" -"Set the tracing function to *func*. This is similar " -"to :c:func:`PyEval_SetProfile`, except the tracing function does receive " -"line-number events and per-opcode events, but does not receive any event " -"related to C function objects being called. Any trace function registered " -"using :c:func:`PyEval_SetTrace` will not " -"receive :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION` " -"or :c:data:`PyTrace_C_RETURN` as a value for the *what* parameter." +"Set the tracing function to *func*. This is similar to :c:func:" +"`PyEval_SetProfile`, except the tracing function does receive line-number " +"events and per-opcode events, but does not receive any event related to C " +"function objects being called. Any trace function registered using :c:func:" +"`PyEval_SetTrace` will not receive :c:data:`PyTrace_C_CALL`, :c:data:" +"`PyTrace_C_EXCEPTION` or :c:data:`PyTrace_C_RETURN` as a value for the " +"*what* parameter." msgstr "" -#: ../../c-api/init.rst:2141 +#: ../../c-api/init.rst:2149 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:2147 +#: ../../c-api/init.rst:2155 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:2152 +#: ../../c-api/init.rst:2160 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:2158 +#: ../../c-api/init.rst:2166 msgid "Reference tracing" msgstr "" -#: ../../c-api/init.rst:2164 +#: ../../c-api/init.rst:2172 msgid "" -"The type of the trace function registered " -"using :c:func:`PyRefTracer_SetTracer`. The first parameter is a Python " -"object that has been just created (when **event** is set " -"to :c:data:`PyRefTracer_CREATE`) or about to be destroyed (when **event** is " -"set to :c:data:`PyRefTracer_DESTROY`). The **data** argument is the opaque " -"pointer that was provided when :c:func:`PyRefTracer_SetTracer` was called." +"The type of the trace function registered using :c:func:" +"`PyRefTracer_SetTracer`. The first parameter is a Python object that has " +"been just created (when **event** is set to :c:data:`PyRefTracer_CREATE`) or " +"about to be destroyed (when **event** is set to :c:data:" +"`PyRefTracer_DESTROY`). The **data** argument is the opaque pointer that was " +"provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -#: ../../c-api/init.rst:2174 +#: ../../c-api/init.rst:2182 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" -#: ../../c-api/init.rst:2179 +#: ../../c-api/init.rst:2187 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been destroyed." msgstr "" -#: ../../c-api/init.rst:2184 +#: ../../c-api/init.rst:2192 msgid "" "Register a reference tracer function. The function will be called when a new " "Python has been created or when an object is going to be destroyed. If " @@ -2707,7 +2710,7 @@ msgid "" "return ``-1`` on error." msgstr "" -#: ../../c-api/init.rst:2190 +#: ../../c-api/init.rst:2198 msgid "" "Not that tracer functions **must not** create Python objects inside or " "otherwise the call will be re-entrant. The tracer also **must not** clear " @@ -2715,12 +2718,12 @@ msgid "" "active every time the tracer function is called." msgstr "" -#: ../../c-api/init.rst:2195 ../../c-api/init.rst:2206 +#: ../../c-api/init.rst:2203 ../../c-api/init.rst:2214 msgid "" "There must be an :term:`attached thread state` when calling this function." msgstr "" -#: ../../c-api/init.rst:2201 +#: ../../c-api/init.rst:2209 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " @@ -2728,48 +2731,48 @@ msgid "" "set the **data** pointer to NULL." msgstr "" -#: ../../c-api/init.rst:2213 +#: ../../c-api/init.rst:2221 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2218 +#: ../../c-api/init.rst:2226 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2223 +#: ../../c-api/init.rst:2231 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2228 +#: ../../c-api/init.rst:2236 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2233 +#: ../../c-api/init.rst:2241 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2239 +#: ../../c-api/init.rst:2247 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2245 +#: ../../c-api/init.rst:2253 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2252 +#: ../../c-api/init.rst:2260 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2256 +#: ../../c-api/init.rst:2264 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2779,42 +2782,42 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2263 +#: ../../c-api/init.rst:2271 msgid "" "A :term:`thread state` does *not* need to be :term:`attached ` when calling these functions; they suppl their own locking." msgstr "" -#: ../../c-api/init.rst:2266 +#: ../../c-api/init.rst:2274 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2270 +#: ../../c-api/init.rst:2278 msgid "" -"None of these API functions handle memory management on behalf of " -"the :c:expr:`void*` values. You need to allocate and deallocate them " -"yourself. If the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, " -"these functions don't do refcount operations on them either." +"None of these API functions handle memory management on behalf of the :c:" +"expr:`void*` values. You need to allocate and deallocate them yourself. If " +"the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, these functions " +"don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2278 +#: ../../c-api/init.rst:2286 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2280 +#: ../../c-api/init.rst:2288 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2286 +#: ../../c-api/init.rst:2294 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2291 +#: ../../c-api/init.rst:2299 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2822,67 +2825,66 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2296 +#: ../../c-api/init.rst:2304 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2302 +#: ../../c-api/init.rst:2310 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: ../../c-api/init.rst:2307 +#: ../../c-api/init.rst:2315 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2309 +#: ../../c-api/init.rst:2317 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2316 +#: ../../c-api/init.rst:2324 msgid "" -"Return a value which is the same state as a value initialized " -"with :c:macro:`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic " -"allocation failure." +"Return a value which is the same state as a value initialized with :c:macro:" +"`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" -#: ../../c-api/init.rst:2323 +#: ../../c-api/init.rst:2331 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2329 +#: ../../c-api/init.rst:2337 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2334 +#: ../../c-api/init.rst:2342 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2336 +#: ../../c-api/init.rst:2344 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " -"undefined if the given :c:type:`Py_tss_t` has not been initialized " -"by :c:func:`PyThread_tss_create`." +"undefined if the given :c:type:`Py_tss_t` has not been initialized by :c:" +"func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2344 +#: ../../c-api/init.rst:2352 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2350 +#: ../../c-api/init.rst:2358 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2891,40 +2893,40 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2359 +#: ../../c-api/init.rst:2367 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " -"destroyed key is able to be initialized again " -"by :c:func:`PyThread_tss_create`. This function can be called repeatedly on " -"the same key -- calling it on an already destroyed key is a no-op." +"destroyed key is able to be initialized again by :c:func:" +"`PyThread_tss_create`. This function can be called repeatedly on the same " +"key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2368 +#: ../../c-api/init.rst:2376 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2375 +#: ../../c-api/init.rst:2383 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2383 +#: ../../c-api/init.rst:2391 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2385 +#: ../../c-api/init.rst:2393 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2390 +#: ../../c-api/init.rst:2398 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2933,45 +2935,45 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2395 +#: ../../c-api/init.rst:2403 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:2406 +#: ../../c-api/init.rst:2414 msgid "Synchronization Primitives" msgstr "" -#: ../../c-api/init.rst:2408 +#: ../../c-api/init.rst:2416 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -#: ../../c-api/init.rst:2412 +#: ../../c-api/init.rst:2420 msgid "" "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " "zero to represent the unlocked state. For example::" msgstr "" -#: ../../c-api/init.rst:2415 +#: ../../c-api/init.rst:2423 msgid "PyMutex mutex = {0};" msgstr "PyMutex mutex = {0};" -#: ../../c-api/init.rst:2417 +#: ../../c-api/init.rst:2425 msgid "" "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " "contents and address of a :c:type:`!PyMutex` are meaningful, and it must " "remain at a fixed, writable location in memory." msgstr "" -#: ../../c-api/init.rst:2423 +#: ../../c-api/init.rst:2431 msgid "" "A :c:type:`!PyMutex` currently occupies one byte, but the size should be " "considered unstable. The size may change in future Python releases without " "a deprecation period." msgstr "" -#: ../../c-api/init.rst:2431 +#: ../../c-api/init.rst:2439 msgid "" "Lock mutex *m*. If another thread has already locked it, the calling thread " "will block until the mutex is unlocked. While blocked, the thread will " @@ -2979,28 +2981,28 @@ msgid "" "exists." msgstr "" -#: ../../c-api/init.rst:2439 +#: ../../c-api/init.rst:2447 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" -#: ../../c-api/init.rst:2446 +#: ../../c-api/init.rst:2454 msgid "Returns non-zero if the mutex *m* is currently locked, zero otherwise." msgstr "" -#: ../../c-api/init.rst:2450 +#: ../../c-api/init.rst:2458 msgid "" "This function is intended for use in assertions and debugging only and " "should not be used to make concurrency control decisions, as the lock state " "may change immediately after the check." msgstr "" -#: ../../c-api/init.rst:2459 +#: ../../c-api/init.rst:2467 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2461 +#: ../../c-api/init.rst:2469 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded ` CPython. They are " @@ -3008,17 +3010,16 @@ msgid "" "no-ops in versions of Python with the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:2466 +#: ../../c-api/init.rst:2474 msgid "" "Critical sections are intended to be used for custom types implemented in C-" -"API extensions. They should generally not be used with built-in types " -"like :class:`list` and :class:`dict` because their public C-APIs already use " -"critical sections internally, with the notable exception " -"of :c:func:`PyDict_Next`, which requires critical section to be acquired " -"externally." +"API extensions. They should generally not be used with built-in types like :" +"class:`list` and :class:`dict` because their public C-APIs already use " +"critical sections internally, with the notable exception of :c:func:" +"`PyDict_Next`, which requires critical section to be acquired externally." msgstr "" -#: ../../c-api/init.rst:2473 +#: ../../c-api/init.rst:2481 msgid "" "Critical sections avoid deadlocks by implicitly suspending active critical " "sections, hence, they do not provide exclusive access such as provided by " @@ -3029,7 +3030,7 @@ msgid "" "threads can acquire the per-object lock for the same object." msgstr "" -#: ../../c-api/init.rst:2481 +#: ../../c-api/init.rst:2489 msgid "" "Variants that accept :c:type:`PyMutex` pointers rather than Python objects " "are also available. Use these variants to start a critical section in a " @@ -3038,7 +3039,7 @@ msgid "" "needs to call into the C API in a manner that might lead to deadlocks." msgstr "" -#: ../../c-api/init.rst:2487 +#: ../../c-api/init.rst:2495 msgid "" "The functions and structs used by the macros are exposed for cases where C " "macros are not available. They should only be used as in the given macro " @@ -3046,20 +3047,20 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2494 +#: ../../c-api/init.rst:2502 msgid "" -"Operations that need to lock two objects at once must " -"use :c:macro:`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical " -"sections to lock more than one object at once, because the inner critical " -"section may suspend the outer critical sections. This API does not provide " -"a way to lock more than two objects at once." +"Operations that need to lock two objects at once must use :c:macro:" +"`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " +"lock more than one object at once, because the inner critical section may " +"suspend the outer critical sections. This API does not provide a way to " +"lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2500 +#: ../../c-api/init.rst:2508 msgid "Example usage::" msgstr "範例用法: ::" -#: ../../c-api/init.rst:2502 +#: ../../c-api/init.rst:2510 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -3079,29 +3080,29 @@ msgstr "" " Py_RETURN_NONE;\n" "}" -#: ../../c-api/init.rst:2511 +#: ../../c-api/init.rst:2519 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " "critical section API avoids potential deadlocks due to reentrancy and lock " "ordering by allowing the runtime to temporarily suspend the critical section " -"if the code triggered by the finalizer blocks and " -"calls :c:func:`PyEval_SaveThread`." +"if the code triggered by the finalizer blocks and calls :c:func:" +"`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2519 +#: ../../c-api/init.rst:2527 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2522 ../../c-api/init.rst:2536 -#: ../../c-api/init.rst:2553 ../../c-api/init.rst:2568 -#: ../../c-api/init.rst:2582 ../../c-api/init.rst:2599 +#: ../../c-api/init.rst:2530 ../../c-api/init.rst:2544 +#: ../../c-api/init.rst:2561 ../../c-api/init.rst:2576 +#: ../../c-api/init.rst:2590 ../../c-api/init.rst:2607 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2524 +#: ../../c-api/init.rst:2532 msgid "" "{\n" " PyCriticalSection _py_cs;\n" @@ -3111,15 +3112,15 @@ msgstr "" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" -#: ../../c-api/init.rst:2528 ../../c-api/init.rst:2574 +#: ../../c-api/init.rst:2536 ../../c-api/init.rst:2582 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2534 +#: ../../c-api/init.rst:2542 msgid "Locks the mutex *m* and begins a critical section." msgstr "" -#: ../../c-api/init.rst:2538 +#: ../../c-api/init.rst:2546 msgid "" "{\n" " PyCriticalSection _py_cs;\n" @@ -3129,21 +3130,21 @@ msgstr "" " PyCriticalSection _py_cs;\n" " PyCriticalSection_BeginMutex(&_py_cs, m)" -#: ../../c-api/init.rst:2542 +#: ../../c-api/init.rst:2550 msgid "" "Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION`, there is no cast for " "the argument of the macro - it must be a :c:type:`PyMutex` pointer." msgstr "" -#: ../../c-api/init.rst:2545 ../../c-api/init.rst:2591 +#: ../../c-api/init.rst:2553 ../../c-api/init.rst:2599 msgid "On the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2551 +#: ../../c-api/init.rst:2559 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2555 +#: ../../c-api/init.rst:2563 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" @@ -3151,18 +3152,18 @@ msgstr "" " PyCriticalSection_End(&_py_cs);\n" "}" -#: ../../c-api/init.rst:2558 ../../c-api/init.rst:2604 +#: ../../c-api/init.rst:2566 ../../c-api/init.rst:2612 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2564 +#: ../../c-api/init.rst:2572 msgid "" "Acquires the per-objects locks for the objects *a* and *b* and begins a " "critical section. The locks are acquired in a consistent order (lowest " "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2570 +#: ../../c-api/init.rst:2578 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" @@ -3172,11 +3173,11 @@ msgstr "" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" -#: ../../c-api/init.rst:2580 +#: ../../c-api/init.rst:2588 msgid "Locks the mutexes *m1* and *m2* and begins a critical section." msgstr "" -#: ../../c-api/init.rst:2584 +#: ../../c-api/init.rst:2592 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" @@ -3186,17 +3187,17 @@ msgstr "" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2)" -#: ../../c-api/init.rst:2588 +#: ../../c-api/init.rst:2596 msgid "" "Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, there is no cast for " "the arguments of the macro - they must be :c:type:`PyMutex` pointers." msgstr "" -#: ../../c-api/init.rst:2597 +#: ../../c-api/init.rst:2605 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2601 +#: ../../c-api/init.rst:2609 msgid "" " PyCriticalSection2_End(&_py_cs2);\n" "}" @@ -3216,20 +3217,20 @@ msgstr "modules(sys 模組中)" msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:712 ../../c-api/init.rst:1222 -#: ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:712 ../../c-api/init.rst:1228 +#: ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 msgid "sys" msgstr "sys" @@ -3241,7 +3242,7 @@ msgstr "search(搜尋)" msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1814 ../../c-api/init.rst:1867 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1820 ../../c-api/init.rst:1873 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" @@ -3317,43 +3318,43 @@ msgstr "PyEval_RestoreThread(C 函式)" msgid "PyEval_SaveThread (C function)" msgstr "PyEval_SaveThread(C 函式)" -#: ../../c-api/init.rst:1200 +#: ../../c-api/init.rst:1206 msgid "PyEval_AcquireThread()" msgstr "PyEval_AcquireThread()" -#: ../../c-api/init.rst:1200 +#: ../../c-api/init.rst:1206 msgid "PyEval_ReleaseThread()" msgstr "PyEval_ReleaseThread()" -#: ../../c-api/init.rst:1200 +#: ../../c-api/init.rst:1206 msgid "PyEval_SaveThread()" msgstr "PyEval_SaveThread()" -#: ../../c-api/init.rst:1200 +#: ../../c-api/init.rst:1206 msgid "PyEval_RestoreThread()" msgstr "PyEval_RestoreThread()" -#: ../../c-api/init.rst:1222 +#: ../../c-api/init.rst:1228 msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 +#: ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 +#: ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1750 ../../c-api/init.rst:1849 +#: ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1814 +#: ../../c-api/init.rst:1820 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1844 +#: ../../c-api/init.rst:1850 msgid "close (in module os)" msgstr "close(os 模組中)" diff --git a/c-api/long.po b/c-api/long.po index e428371f79b..17bf9290c6f 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,8 +46,8 @@ msgstr "" #: ../../c-api/long.rst:29 msgid "" -"Return true if its argument is a :c:type:`PyLongObject` or a subtype " -"of :c:type:`PyLongObject`. This function always succeeds." +"Return true if its argument is a :c:type:`PyLongObject` or a subtype of :c:" +"type:`PyLongObject`. This function always succeeds." msgstr "" #: ../../c-api/long.rst:35 @@ -61,63 +61,63 @@ msgid "" "Return a new :c:type:`PyLongObject` object from *v*, or ``NULL`` on failure." msgstr "" -#: ../../c-api/long.rst:43 +#: ../../c-api/long.rst:45 msgid "" -"The current implementation keeps an array of integer objects for all " -"integers between ``-5`` and ``256``. When you create an int in that range " -"you actually just get back a reference to the existing object." +"CPython keeps an array of integer objects for all integers between ``-5`` " +"and ``256``. When you create an int in that range you actually just get " +"back a reference to the existing object." msgstr "" -#: ../../c-api/long.rst:50 +#: ../../c-api/long.rst:52 msgid "" "Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long`, " "or ``NULL`` on failure." msgstr "" -#: ../../c-api/long.rst:56 +#: ../../c-api/long.rst:58 msgid "" "Return a new :c:type:`PyLongObject` object from a C :c:type:`Py_ssize_t`, or " "``NULL`` on failure." msgstr "" -#: ../../c-api/long.rst:62 +#: ../../c-api/long.rst:64 msgid "" "Return a new :c:type:`PyLongObject` object from a C :c:type:`size_t`, or " "``NULL`` on failure." msgstr "" -#: ../../c-api/long.rst:68 +#: ../../c-api/long.rst:70 msgid "" "Return a new :c:type:`PyLongObject` object from a C :c:expr:`long long`, or " "``NULL`` on failure." msgstr "" -#: ../../c-api/long.rst:75 +#: ../../c-api/long.rst:77 msgid "" "Return a new :c:type:`PyLongObject` object from a signed C :c:expr:`int32_t` " "or :c:expr:`int64_t`, or ``NULL`` with an exception set on failure." msgstr "" -#: ../../c-api/long.rst:84 +#: ../../c-api/long.rst:86 msgid "" "Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long " "long`, or ``NULL`` on failure." msgstr "" -#: ../../c-api/long.rst:91 +#: ../../c-api/long.rst:93 msgid "" -"Return a new :c:type:`PyLongObject` object from an unsigned " -"C :c:expr:`uint32_t` or :c:expr:`uint64_t`, or ``NULL`` with an exception " -"set on failure." +"Return a new :c:type:`PyLongObject` object from an unsigned C :c:expr:" +"`uint32_t` or :c:expr:`uint64_t`, or ``NULL`` with an exception set on " +"failure." msgstr "" -#: ../../c-api/long.rst:100 +#: ../../c-api/long.rst:102 msgid "" "Return a new :c:type:`PyLongObject` object from the integer part of *v*, or " "``NULL`` on failure." msgstr "" -#: ../../c-api/long.rst:106 +#: ../../c-api/long.rst:108 msgid "" "Return a new :c:type:`PyLongObject` based on the string value in *str*, " "which is interpreted according to the radix in *base*, or ``NULL`` on " @@ -132,32 +132,32 @@ msgid "" "whitespace, :exc:`ValueError` will be raised." msgstr "" -#: ../../c-api/long.rst:117 +#: ../../c-api/long.rst:119 msgid "" ":c:func:`PyLong_AsNativeBytes()` and :c:func:`PyLong_FromNativeBytes()` " "functions can be used to convert a :c:type:`PyLongObject` to/from an array " "of bytes in base ``256``." msgstr "" -#: ../../c-api/long.rst:124 +#: ../../c-api/long.rst:126 msgid "" "Convert a sequence of Unicode digits in the string *u* to a Python integer " "value." msgstr "" -#: ../../c-api/long.rst:132 +#: ../../c-api/long.rst:134 msgid "" "Create a Python integer from the pointer *p*. The pointer value can be " "retrieved from the resulting value using :c:func:`PyLong_AsVoidPtr`." msgstr "" -#: ../../c-api/long.rst:138 +#: ../../c-api/long.rst:140 msgid "" "Create a Python integer from the value contained in the first *n_bytes* of " "*buffer*, interpreted as a two's-complement signed number." msgstr "" -#: ../../c-api/long.rst:141 +#: ../../c-api/long.rst:143 msgid "" "*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " "select the native endian that CPython was compiled with and assume that the " @@ -166,295 +166,291 @@ msgid "" "calling :c:func:`PyLong_FromUnsignedNativeBytes`. Other flags are ignored." msgstr "" -#: ../../c-api/long.rst:152 +#: ../../c-api/long.rst:154 msgid "" "Create a Python integer from the value contained in the first *n_bytes* of " "*buffer*, interpreted as an unsigned number." msgstr "" -#: ../../c-api/long.rst:155 +#: ../../c-api/long.rst:157 msgid "" "*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " "select the native endian that CPython was compiled with and assume that the " "most-significant bit is not a sign bit. Flags other than endian are ignored." msgstr "" -#: ../../c-api/long.rst:168 ../../c-api/long.rst:204 +#: ../../c-api/long.rst:170 ../../c-api/long.rst:206 msgid "" "Return a C :c:expr:`long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:172 +#: ../../c-api/long.rst:174 msgid "" -"Raise :exc:`OverflowError` if the value of *obj* is out of range for " -"a :c:expr:`long`." +"Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" +"expr:`long`." msgstr "" -#: ../../c-api/long.rst:175 ../../c-api/long.rst:213 ../../c-api/long.rst:234 -#: ../../c-api/long.rst:254 ../../c-api/long.rst:277 +#: ../../c-api/long.rst:177 ../../c-api/long.rst:215 ../../c-api/long.rst:236 +#: ../../c-api/long.rst:256 ../../c-api/long.rst:279 msgid "Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:177 ../../c-api/long.rst:215 ../../c-api/long.rst:236 -#: ../../c-api/long.rst:258 ../../c-api/long.rst:342 ../../c-api/long.rst:362 +#: ../../c-api/long.rst:179 ../../c-api/long.rst:217 ../../c-api/long.rst:238 +#: ../../c-api/long.rst:260 ../../c-api/long.rst:344 ../../c-api/long.rst:364 msgid "Use :meth:`~object.__index__` if available." msgstr "" -#: ../../c-api/long.rst:180 ../../c-api/long.rst:218 ../../c-api/long.rst:239 -#: ../../c-api/long.rst:261 ../../c-api/long.rst:345 ../../c-api/long.rst:365 +#: ../../c-api/long.rst:182 ../../c-api/long.rst:220 ../../c-api/long.rst:241 +#: ../../c-api/long.rst:263 ../../c-api/long.rst:347 ../../c-api/long.rst:367 msgid "This function will no longer use :meth:`~object.__int__`." msgstr "" -#: ../../c-api/long.rst:187 +#: ../../c-api/long.rst:189 msgid "" "A :term:`soft deprecated` alias. Exactly equivalent to the preferred " "``PyLong_AsLong``. In particular, it can fail with :exc:`OverflowError` or " "another exception." msgstr "" -#: ../../c-api/long.rst:191 +#: ../../c-api/long.rst:193 msgid "The function is soft deprecated." msgstr "" -#: ../../c-api/long.rst:196 +#: ../../c-api/long.rst:198 msgid "" -"Similar to :c:func:`PyLong_AsLong`, but store the result in a " -"C :c:expr:`int` instead of a C :c:expr:`long`." +"Similar to :c:func:`PyLong_AsLong`, but store the result in a C :c:expr:" +"`int` instead of a C :c:expr:`long`." msgstr "" -#: ../../c-api/long.rst:208 +#: ../../c-api/long.rst:210 msgid "" -"If the value of *obj* is greater than :c:macro:`LONG_MAX` or less " -"than :c:macro:`LONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, " -"respectively, and return ``-1``; otherwise, set *\\*overflow* to ``0``. If " -"any other exception occurs set *\\*overflow* to ``0`` and return ``-1`` as " -"usual." +"If the value of *obj* is greater than :c:macro:`LONG_MAX` or less than :c:" +"macro:`LONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " +"return ``-1``; otherwise, set *\\*overflow* to ``0``. If any other " +"exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:227 ../../c-api/long.rst:245 +#: ../../c-api/long.rst:229 ../../c-api/long.rst:247 msgid "" "Return a C :c:expr:`long long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:231 +#: ../../c-api/long.rst:233 msgid "" -"Raise :exc:`OverflowError` if the value of *obj* is out of range for " -"a :c:expr:`long long`." +"Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" +"expr:`long long`." msgstr "" -#: ../../c-api/long.rst:249 +#: ../../c-api/long.rst:251 msgid "" -"If the value of *obj* is greater than :c:macro:`LLONG_MAX` or less " -"than :c:macro:`LLONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, " -"respectively, and return ``-1``; otherwise, set *\\*overflow* to ``0``. If " -"any other exception occurs set *\\*overflow* to ``0`` and return ``-1`` as " -"usual." +"If the value of *obj* is greater than :c:macro:`LLONG_MAX` or less than :c:" +"macro:`LLONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " +"return ``-1``; otherwise, set *\\*overflow* to ``0``. If any other " +"exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:271 +#: ../../c-api/long.rst:273 msgid "" "Return a C :c:type:`Py_ssize_t` representation of *pylong*. *pylong* must " "be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:274 +#: ../../c-api/long.rst:276 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " -"a :c:type:`Py_ssize_t`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" +"type:`Py_ssize_t`." msgstr "" -#: ../../c-api/long.rst:286 +#: ../../c-api/long.rst:288 msgid "" "Return a C :c:expr:`unsigned long` representation of *pylong*. *pylong* " "must be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:289 +#: ../../c-api/long.rst:291 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " -"a :c:expr:`unsigned long`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" +"expr:`unsigned long`." msgstr "" -#: ../../c-api/long.rst:292 +#: ../../c-api/long.rst:294 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:302 +#: ../../c-api/long.rst:304 msgid "" "Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:305 +#: ../../c-api/long.rst:307 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " -"a :c:type:`size_t`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" +"type:`size_t`." msgstr "" -#: ../../c-api/long.rst:308 +#: ../../c-api/long.rst:310 msgid "" "Returns ``(size_t)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:317 +#: ../../c-api/long.rst:319 msgid "" "Return a C :c:expr:`unsigned long long` representation of *pylong*. " "*pylong* must be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:320 +#: ../../c-api/long.rst:322 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " -"an :c:expr:`unsigned long long`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for an :" +"c:expr:`unsigned long long`." msgstr "" -#: ../../c-api/long.rst:323 +#: ../../c-api/long.rst:325 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:326 +#: ../../c-api/long.rst:328 msgid "" "A negative *pylong* now raises :exc:`OverflowError`, not :exc:`TypeError`." msgstr "" -#: ../../c-api/long.rst:332 +#: ../../c-api/long.rst:334 msgid "" "Return a C :c:expr:`unsigned long` representation of *obj*. If *obj* is not " -"an instance of :c:type:`PyLongObject`, first call " -"its :meth:`~object.__index__` method (if present) to convert it to " -"a :c:type:`PyLongObject`." +"an instance of :c:type:`PyLongObject`, first call its :meth:`~object." +"__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:336 +#: ../../c-api/long.rst:338 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long`, return " "the reduction of that value modulo ``ULONG_MAX + 1``." msgstr "" -#: ../../c-api/long.rst:339 +#: ../../c-api/long.rst:341 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:351 +#: ../../c-api/long.rst:353 msgid "" "Return a C :c:expr:`unsigned long long` representation of *obj*. If *obj* " -"is not an instance of :c:type:`PyLongObject`, first call " -"its :meth:`~object.__index__` method (if present) to convert it to " -"a :c:type:`PyLongObject`." +"is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object." +"__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:356 +#: ../../c-api/long.rst:358 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long long`, " "return the reduction of that value modulo ``ULLONG_MAX + 1``." msgstr "" -#: ../../c-api/long.rst:359 +#: ../../c-api/long.rst:361 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` " "to disambiguate." msgstr "" -#: ../../c-api/long.rst:372 +#: ../../c-api/long.rst:374 msgid "" "Set *\\*value* to a signed C :c:expr:`int32_t` or :c:expr:`int64_t` " "representation of *obj*." msgstr "" -#: ../../c-api/long.rst:375 ../../c-api/long.rst:396 +#: ../../c-api/long.rst:377 ../../c-api/long.rst:397 +msgid "" +"If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:" +"`~object.__index__` method (if present) to convert it to a :c:type:" +"`PyLongObject`." +msgstr "" + +#: ../../c-api/long.rst:381 ../../c-api/long.rst:402 msgid "If the *obj* value is out of range, raise an :exc:`OverflowError`." msgstr "" -#: ../../c-api/long.rst:377 ../../c-api/long.rst:398 +#: ../../c-api/long.rst:383 ../../c-api/long.rst:404 msgid "" "Set *\\*value* and return ``0`` on success. Set an exception and return " "``-1`` on error." msgstr "" -#: ../../c-api/long.rst:380 ../../c-api/long.rst:401 +#: ../../c-api/long.rst:386 ../../c-api/long.rst:407 msgid "*value* must not be ``NULL``." msgstr "" -#: ../../c-api/long.rst:388 +#: ../../c-api/long.rst:394 msgid "" "Set *\\*value* to an unsigned C :c:expr:`uint32_t` or :c:expr:`uint64_t` " "representation of *obj*." msgstr "" -#: ../../c-api/long.rst:391 -msgid "" -"If *obj* is not an instance of :c:type:`PyLongObject`, first call " -"its :meth:`~object.__index__` method (if present) to convert it to " -"a :c:type:`PyLongObject`." -msgstr "" - -#: ../../c-api/long.rst:395 +#: ../../c-api/long.rst:401 msgid "If *obj* is negative, raise a :exc:`ValueError`." msgstr "" -#: ../../c-api/long.rst:408 +#: ../../c-api/long.rst:414 msgid "" "Return a C :c:expr:`double` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:411 +#: ../../c-api/long.rst:417 msgid "" -"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " -"a :c:expr:`double`." +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" +"expr:`double`." msgstr "" -#: ../../c-api/long.rst:414 +#: ../../c-api/long.rst:420 msgid "" "Returns ``-1.0`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:419 +#: ../../c-api/long.rst:425 msgid "" "Convert a Python integer *pylong* to a C :c:expr:`void` pointer. If *pylong* " "cannot be converted, an :exc:`OverflowError` will be raised. This is only " -"assured to produce a usable :c:expr:`void` pointer for values created " -"with :c:func:`PyLong_FromVoidPtr`." +"assured to produce a usable :c:expr:`void` pointer for values created with :" +"c:func:`PyLong_FromVoidPtr`." msgstr "" -#: ../../c-api/long.rst:424 +#: ../../c-api/long.rst:430 msgid "" "Returns ``NULL`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:429 +#: ../../c-api/long.rst:435 msgid "" "Copy the Python integer value *pylong* to a native *buffer* of size " "*n_bytes*. The *flags* can be set to ``-1`` to behave similarly to a C cast, " "or to values documented below to control the behavior." msgstr "" -#: ../../c-api/long.rst:433 +#: ../../c-api/long.rst:439 msgid "" "Returns ``-1`` with an exception raised on error. This may happen if " "*pylong* cannot be interpreted as an integer, or if *pylong* was negative " "and the ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` flag was set." msgstr "" -#: ../../c-api/long.rst:437 +#: ../../c-api/long.rst:443 msgid "" "Otherwise, returns the number of bytes required to store the value. If this " "is equal to or less than *n_bytes*, the entire value was copied. All " "*n_bytes* of the buffer are written: large buffers are padded with zeroes." msgstr "" -#: ../../c-api/long.rst:442 +#: ../../c-api/long.rst:448 msgid "" "If the returned value is greater than *n_bytes*, the value was truncated: as " "many of the lowest bits of the value as could fit are written, and the " @@ -462,25 +458,25 @@ msgid "" "downcast." msgstr "" -#: ../../c-api/long.rst:449 +#: ../../c-api/long.rst:455 msgid "" "Overflow is not considered an error. If the returned value is larger than " "*n_bytes*, most significant bits were discarded." msgstr "" -#: ../../c-api/long.rst:452 +#: ../../c-api/long.rst:458 msgid "``0`` will never be returned." msgstr "``0`` 將永不被回傳。" -#: ../../c-api/long.rst:454 +#: ../../c-api/long.rst:460 msgid "Values are always copied as two's-complement." msgstr "" -#: ../../c-api/long.rst:456 +#: ../../c-api/long.rst:462 msgid "Usage example::" msgstr "使用範例: ::" -#: ../../c-api/long.rst:458 +#: ../../c-api/long.rst:464 msgid "" "int32_t value;\n" "Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);\n" @@ -497,26 +493,26 @@ msgid "" "}" msgstr "" -#: ../../c-api/long.rst:472 +#: ../../c-api/long.rst:478 msgid "" "Passing zero to *n_bytes* will return the size of a buffer that would be " "large enough to hold the value. This may be larger than technically " "necessary, but not unreasonably so. If *n_bytes=0*, *buffer* may be ``NULL``." msgstr "" -#: ../../c-api/long.rst:479 +#: ../../c-api/long.rst:485 msgid "" "Passing *n_bytes=0* to this function is not an accurate way to determine the " "bit length of the value." msgstr "" -#: ../../c-api/long.rst:482 +#: ../../c-api/long.rst:488 msgid "" "To get at the entire Python value of an unknown size, the function can be " "called twice: first to determine the buffer size, then to fill it::" msgstr "" -#: ../../c-api/long.rst:485 +#: ../../c-api/long.rst:491 msgid "" "// Ask how much space we need.\n" "Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);\n" @@ -547,69 +543,69 @@ msgid "" "free(bignum);" msgstr "" -#: ../../c-api/long.rst:513 +#: ../../c-api/long.rst:519 msgid "" "*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults " "that behave most like a C cast, or a combination of the other flags in the " "table below. Note that ``-1`` cannot be combined with other flags." msgstr "" -#: ../../c-api/long.rst:518 +#: ../../c-api/long.rst:524 msgid "" "Currently, ``-1`` corresponds to ``Py_ASNATIVEBYTES_NATIVE_ENDIAN | " "Py_ASNATIVEBYTES_UNSIGNED_BUFFER``." msgstr "" -#: ../../c-api/long.rst:524 +#: ../../c-api/long.rst:530 msgid "Flag" msgstr "旗標" -#: ../../c-api/long.rst:524 +#: ../../c-api/long.rst:530 msgid "Value" msgstr "數值" -#: ../../c-api/long.rst:526 +#: ../../c-api/long.rst:532 msgid "``-1``" msgstr "``-1``" -#: ../../c-api/long.rst:527 +#: ../../c-api/long.rst:533 msgid "``0``" msgstr "``0``" -#: ../../c-api/long.rst:528 +#: ../../c-api/long.rst:534 msgid "``1``" msgstr "``1``" -#: ../../c-api/long.rst:529 +#: ../../c-api/long.rst:535 msgid "``3``" msgstr "``3``" -#: ../../c-api/long.rst:530 +#: ../../c-api/long.rst:536 msgid "``4``" msgstr "``4``" -#: ../../c-api/long.rst:531 +#: ../../c-api/long.rst:537 msgid "``8``" msgstr "``8``" -#: ../../c-api/long.rst:532 +#: ../../c-api/long.rst:538 msgid "``16``" msgstr "``16``" -#: ../../c-api/long.rst:535 +#: ../../c-api/long.rst:541 msgid "" "Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian " "flags. Passing ``2`` is reserved." msgstr "" -#: ../../c-api/long.rst:538 +#: ../../c-api/long.rst:544 msgid "" "By default, sufficient buffer will be requested to include a sign bit. For " "example, when converting 128 with *n_bytes=1*, the function will return 2 " "(or more) in order to store a zero sign bit." msgstr "" -#: ../../c-api/long.rst:542 +#: ../../c-api/long.rst:548 msgid "" "If ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` is specified, a zero sign bit will " "be omitted from size calculations. This allows, for example, 128 to fit in a " @@ -619,7 +615,7 @@ msgid "" "requested." msgstr "" -#: ../../c-api/long.rst:549 +#: ../../c-api/long.rst:555 msgid "" "Specifying ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` causes an exception to be " "set if *pylong* is negative. Without this flag, negative values will be " @@ -627,17 +623,17 @@ msgid "" "of whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified." msgstr "" -#: ../../c-api/long.rst:554 +#: ../../c-api/long.rst:560 msgid "" "If ``Py_ASNATIVEBYTES_ALLOW_INDEX`` is specified and a non-integer value is " "passed, its :meth:`~object.__index__` method will be called first. This may " "result in Python code executing and other threads being allowed to run, " "which could cause changes to other objects or values in use. When *flags* is " -"``-1``, this option is not set, and non-integer values will " -"raise :exc:`TypeError`." +"``-1``, this option is not set, and non-integer values will raise :exc:" +"`TypeError`." msgstr "" -#: ../../c-api/long.rst:563 +#: ../../c-api/long.rst:569 msgid "" "With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without " "*REJECT_NEGATIVE*), multiple Python integers can map to a single value " @@ -645,166 +641,165 @@ msgid "" "buffer and set all its bits. This matches typical C cast behavior." msgstr "" -#: ../../c-api/long.rst:574 +#: ../../c-api/long.rst:580 msgid "Get the sign of the integer object *obj*." msgstr "" -#: ../../c-api/long.rst:576 +#: ../../c-api/long.rst:582 msgid "" "On success, set *\\*sign* to the integer sign (0, -1 or +1 for zero, " "negative or positive integer, respectively) and return 0." msgstr "" -#: ../../c-api/long.rst:579 +#: ../../c-api/long.rst:585 msgid "" "On failure, return -1 with an exception set. This function always succeeds " "if *obj* is a :c:type:`PyLongObject` or its subtype." msgstr "" -#: ../../c-api/long.rst:587 +#: ../../c-api/long.rst:593 msgid "Check if the integer object *obj* is positive (``obj > 0``)." msgstr "" -#: ../../c-api/long.rst:589 +#: ../../c-api/long.rst:595 msgid "" "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " "``1`` when it's positive and ``0`` otherwise. Else set an exception and " "return ``-1``." msgstr "" -#: ../../c-api/long.rst:598 +#: ../../c-api/long.rst:604 msgid "Check if the integer object *obj* is negative (``obj < 0``)." msgstr "" -#: ../../c-api/long.rst:600 +#: ../../c-api/long.rst:606 msgid "" "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " "``1`` when it's negative and ``0`` otherwise. Else set an exception and " "return ``-1``." msgstr "" -#: ../../c-api/long.rst:609 +#: ../../c-api/long.rst:615 msgid "Check if the integer object *obj* is zero." msgstr "" -#: ../../c-api/long.rst:611 +#: ../../c-api/long.rst:617 msgid "" "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " "``1`` when it's zero and ``0`` otherwise. Else set an exception and return " "``-1``." msgstr "" -#: ../../c-api/long.rst:620 +#: ../../c-api/long.rst:626 msgid "" "On success, return a read only :term:`named tuple`, that holds information " "about Python's internal representation of integers. See :data:`sys.int_info` " "for description of individual fields." msgstr "" -#: ../../c-api/long.rst:624 +#: ../../c-api/long.rst:630 msgid "On failure, return ``NULL`` with an exception set." msgstr "在失敗時,會回傳 ``NULL`` 並設定例外。" -#: ../../c-api/long.rst:631 +#: ../../c-api/long.rst:637 msgid "Return 1 if *op* is compact, 0 otherwise." msgstr "" -#: ../../c-api/long.rst:633 +#: ../../c-api/long.rst:639 msgid "" "This function makes it possible for performance-critical code to implement a " -"“fast path” for small integers. For compact values " -"use :c:func:`PyUnstable_Long_CompactValue`; for others fall back to " -"a :c:func:`PyLong_As* ` function " -"or :c:func:`PyLong_AsNativeBytes`." +"“fast path” for small integers. For compact values use :c:func:" +"`PyUnstable_Long_CompactValue`; for others fall back to a :c:func:" +"`PyLong_As* ` function or :c:func:`PyLong_AsNativeBytes`." msgstr "" -#: ../../c-api/long.rst:639 +#: ../../c-api/long.rst:645 msgid "The speedup is expected to be negligible for most users." msgstr "" -#: ../../c-api/long.rst:641 +#: ../../c-api/long.rst:647 msgid "" "Exactly what values are considered compact is an implementation detail and " "is subject to change." msgstr "" -#: ../../c-api/long.rst:649 +#: ../../c-api/long.rst:655 msgid "" "If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, " "return its value." msgstr "" -#: ../../c-api/long.rst:652 +#: ../../c-api/long.rst:658 msgid "Otherwise, the return value is undefined." msgstr "" -#: ../../c-api/long.rst:658 +#: ../../c-api/long.rst:664 msgid "Export API" msgstr "" -#: ../../c-api/long.rst:664 +#: ../../c-api/long.rst:670 msgid "" "Layout of an array of \"digits\" (\"limbs\" in the GMP terminology), used to " "represent absolute value for arbitrary precision integers." msgstr "" -#: ../../c-api/long.rst:667 +#: ../../c-api/long.rst:673 msgid "" -"Use :c:func:`PyLong_GetNativeLayout` to get the native layout of " -"Python :class:`int` objects, used internally for integers with \"big " -"enough\" absolute value." +"Use :c:func:`PyLong_GetNativeLayout` to get the native layout of Python :" +"class:`int` objects, used internally for integers with \"big enough\" " +"absolute value." msgstr "" -#: ../../c-api/long.rst:671 +#: ../../c-api/long.rst:677 msgid "" "See also :data:`sys.int_info` which exposes similar information in Python." msgstr "" -#: ../../c-api/long.rst:675 +#: ../../c-api/long.rst:681 msgid "" "Bits per digit. For example, a 15 bit digit means that bits 0-14 contain " "meaningful information." msgstr "" -#: ../../c-api/long.rst:680 +#: ../../c-api/long.rst:686 msgid "" "Digit size in bytes. For example, a 15 bit digit will require at least 2 " "bytes." msgstr "" -#: ../../c-api/long.rst:685 +#: ../../c-api/long.rst:691 msgid "Digits order:" msgstr "" -#: ../../c-api/long.rst:687 +#: ../../c-api/long.rst:693 msgid "``1`` for most significant digit first" msgstr "" -#: ../../c-api/long.rst:688 +#: ../../c-api/long.rst:694 msgid "``-1`` for least significant digit first" msgstr "" -#: ../../c-api/long.rst:692 +#: ../../c-api/long.rst:698 msgid "Digit endianness:" msgstr "" -#: ../../c-api/long.rst:694 +#: ../../c-api/long.rst:700 msgid "``1`` for most significant byte first (big endian)" msgstr "" -#: ../../c-api/long.rst:695 +#: ../../c-api/long.rst:701 msgid "``-1`` for least significant byte first (little endian)" msgstr "" -#: ../../c-api/long.rst:700 +#: ../../c-api/long.rst:706 msgid "Get the native layout of Python :class:`int` objects." msgstr "" -#: ../../c-api/long.rst:702 +#: ../../c-api/long.rst:708 msgid "See the :c:struct:`PyLongLayout` structure." msgstr "" -#: ../../c-api/long.rst:704 +#: ../../c-api/long.rst:710 msgid "" "The function must not be called before Python initialization nor after " "Python finalization. The returned layout is valid until Python is finalized. " @@ -812,175 +807,175 @@ msgid "" "it can be cached." msgstr "" -#: ../../c-api/long.rst:712 +#: ../../c-api/long.rst:718 msgid "Export of a Python :class:`int` object." msgstr "" -#: ../../c-api/long.rst:714 +#: ../../c-api/long.rst:720 msgid "There are two cases:" msgstr "" -#: ../../c-api/long.rst:716 +#: ../../c-api/long.rst:722 msgid "" "If :c:member:`digits` is ``NULL``, only use the :c:member:`value` member." msgstr "" -#: ../../c-api/long.rst:717 +#: ../../c-api/long.rst:723 msgid "" -"If :c:member:`digits` is not ``NULL``, " -"use :c:member:`negative`, :c:member:`ndigits` and :c:member:`digits` members." +"If :c:member:`digits` is not ``NULL``, use :c:member:`negative`, :c:member:" +"`ndigits` and :c:member:`digits` members." msgstr "" -#: ../../c-api/long.rst:722 +#: ../../c-api/long.rst:728 msgid "" -"The native integer value of the exported :class:`int` object. Only valid " -"if :c:member:`digits` is ``NULL``." +"The native integer value of the exported :class:`int` object. Only valid if :" +"c:member:`digits` is ``NULL``." msgstr "" -#: ../../c-api/long.rst:727 +#: ../../c-api/long.rst:733 msgid "" -"``1`` if the number is negative, ``0`` otherwise. Only valid " -"if :c:member:`digits` is not ``NULL``." +"``1`` if the number is negative, ``0`` otherwise. Only valid if :c:member:" +"`digits` is not ``NULL``." msgstr "" -#: ../../c-api/long.rst:732 +#: ../../c-api/long.rst:738 msgid "" -"Number of digits in :c:member:`digits` array. Only valid " -"if :c:member:`digits` is not ``NULL``." +"Number of digits in :c:member:`digits` array. Only valid if :c:member:" +"`digits` is not ``NULL``." msgstr "" -#: ../../c-api/long.rst:737 +#: ../../c-api/long.rst:743 msgid "Read-only array of unsigned digits. Can be ``NULL``." msgstr "" -#: ../../c-api/long.rst:742 +#: ../../c-api/long.rst:748 msgid "Export a Python :class:`int` object." msgstr "" -#: ../../c-api/long.rst:744 +#: ../../c-api/long.rst:750 msgid "" "*export_long* must point to a :c:struct:`PyLongExport` structure allocated " "by the caller. It must not be ``NULL``." msgstr "" -#: ../../c-api/long.rst:747 +#: ../../c-api/long.rst:753 msgid "" "On success, fill in *\\*export_long* and return ``0``. On error, set an " "exception and return ``-1``." msgstr "" -#: ../../c-api/long.rst:750 +#: ../../c-api/long.rst:756 msgid "" ":c:func:`PyLong_FreeExport` must be called when the export is no longer " "needed." msgstr "" -#: ../../c-api/long.rst:754 +#: ../../c-api/long.rst:760 msgid "" "This function always succeeds if *obj* is a Python :class:`int` object or a " "subclass." msgstr "" -#: ../../c-api/long.rst:760 +#: ../../c-api/long.rst:766 msgid "Release the export *export_long* created by :c:func:`PyLong_Export`." msgstr "" -#: ../../c-api/long.rst:763 +#: ../../c-api/long.rst:769 msgid "" "Calling :c:func:`PyLong_FreeExport` is optional if *export_long->digits* is " "``NULL``." msgstr "" -#: ../../c-api/long.rst:768 +#: ../../c-api/long.rst:774 msgid "PyLongWriter API" msgstr "" -#: ../../c-api/long.rst:770 +#: ../../c-api/long.rst:776 msgid "The :c:type:`PyLongWriter` API can be used to import an integer." msgstr "" -#: ../../c-api/long.rst:776 +#: ../../c-api/long.rst:782 msgid "A Python :class:`int` writer instance." msgstr "" -#: ../../c-api/long.rst:778 +#: ../../c-api/long.rst:784 msgid "" -"The instance must be destroyed by :c:func:`PyLongWriter_Finish` " -"or :c:func:`PyLongWriter_Discard`." +"The instance must be destroyed by :c:func:`PyLongWriter_Finish` or :c:func:" +"`PyLongWriter_Discard`." msgstr "" -#: ../../c-api/long.rst:784 +#: ../../c-api/long.rst:790 msgid "Create a :c:type:`PyLongWriter`." msgstr "" -#: ../../c-api/long.rst:786 +#: ../../c-api/long.rst:792 msgid "" "On success, allocate *\\*digits* and return a writer. On error, set an " "exception and return ``NULL``." msgstr "" -#: ../../c-api/long.rst:789 +#: ../../c-api/long.rst:795 msgid "*negative* is ``1`` if the number is negative, or ``0`` otherwise." msgstr "" -#: ../../c-api/long.rst:791 +#: ../../c-api/long.rst:797 msgid "" "*ndigits* is the number of digits in the *digits* array. It must be greater " "than 0." msgstr "" -#: ../../c-api/long.rst:794 +#: ../../c-api/long.rst:800 msgid "*digits* must not be NULL." msgstr "" -#: ../../c-api/long.rst:796 +#: ../../c-api/long.rst:802 msgid "" "After a successful call to this function, the caller should fill in the " "array of digits *digits* and then call :c:func:`PyLongWriter_Finish` to get " -"a Python :class:`int`. The layout of *digits* is described " -"by :c:func:`PyLong_GetNativeLayout`." +"a Python :class:`int`. The layout of *digits* is described by :c:func:" +"`PyLong_GetNativeLayout`." msgstr "" -#: ../../c-api/long.rst:801 +#: ../../c-api/long.rst:807 msgid "" "Digits must be in the range [``0``; ``(1 << bits_per_digit) - 1``] (where " "the :c:struct:`~PyLongLayout.bits_per_digit` is the number of bits per " "digit). Any unused most significant digits must be set to ``0``." msgstr "" -#: ../../c-api/long.rst:806 +#: ../../c-api/long.rst:812 msgid "" "Alternately, call :c:func:`PyLongWriter_Discard` to destroy the writer " "instance without creating an :class:`~int` object." msgstr "" -#: ../../c-api/long.rst:812 +#: ../../c-api/long.rst:818 msgid "" "Finish a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." msgstr "" -#: ../../c-api/long.rst:814 +#: ../../c-api/long.rst:820 msgid "" "On success, return a Python :class:`int` object. On error, set an exception " "and return ``NULL``." msgstr "" -#: ../../c-api/long.rst:817 +#: ../../c-api/long.rst:823 msgid "" "The function takes care of normalizing the digits and converts the object to " "a compact integer if needed." msgstr "" -#: ../../c-api/long.rst:820 ../../c-api/long.rst:829 +#: ../../c-api/long.rst:826 ../../c-api/long.rst:835 msgid "The writer instance and the *digits* array are invalid after the call." msgstr "" -#: ../../c-api/long.rst:825 +#: ../../c-api/long.rst:831 msgid "" "Discard a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." msgstr "" -#: ../../c-api/long.rst:827 +#: ../../c-api/long.rst:833 msgid "If *writer* is ``NULL``, no operation is performed." msgstr "" @@ -996,23 +991,23 @@ msgstr "long integer(長整數)" msgid "integer" msgstr "integer(整數)" -#: ../../c-api/long.rst:164 +#: ../../c-api/long.rst:166 msgid "LONG_MAX (C macro)" msgstr "LONG_MAX(C 巨集)" -#: ../../c-api/long.rst:164 ../../c-api/long.rst:224 ../../c-api/long.rst:267 -#: ../../c-api/long.rst:282 ../../c-api/long.rst:298 ../../c-api/long.rst:314 +#: ../../c-api/long.rst:166 ../../c-api/long.rst:226 ../../c-api/long.rst:269 +#: ../../c-api/long.rst:284 ../../c-api/long.rst:300 ../../c-api/long.rst:316 msgid "OverflowError (built-in exception)" msgstr "OverflowError(內建例外)" -#: ../../c-api/long.rst:267 +#: ../../c-api/long.rst:269 msgid "PY_SSIZE_T_MAX (C macro)" msgstr "PY_SSIZE_T_MAX(C 巨集)" -#: ../../c-api/long.rst:282 +#: ../../c-api/long.rst:284 msgid "ULONG_MAX (C macro)" msgstr "ULONG_MAX(C 巨集)" -#: ../../c-api/long.rst:298 +#: ../../c-api/long.rst:300 msgid "SIZE_MAX (C macro)" msgstr "SIZE_MAX(C 巨集)" diff --git a/deprecations/c-api-pending-removal-in-3.18.po b/deprecations/c-api-pending-removal-in-3.18.po index f4c5782835a..458022f9a8b 100644 --- a/deprecations/c-api-pending-removal-in-3.18.po +++ b/deprecations/c-api-pending-removal-in-3.18.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,50 +21,52 @@ msgid "Pending removal in Python 3.18" msgstr "Python 3.18 中待移除的項目" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:4 -msgid "Deprecated private functions (:gh:`128863`):" -msgstr "被棄用的私有函式 (:gh:`128863`):" +msgid "" +"The following private functions are deprecated and planned for removal in " +"Python 3.18:" +msgstr "以下私有函式已被棄用,並計劃在 Python 3.18 中移除:" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:6 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." msgstr ":c:func:`!_PyBytes_Join`:請改用 :c:func:`PyBytes_Join`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 msgid "" -":c:func:`!_PyDict_GetItemStringWithError`: " -"use :c:func:`PyDict_GetItemStringRef`." +":c:func:`!_PyDict_GetItemStringWithError`: use :c:func:" +"`PyDict_GetItemStringRef`." msgstr "" -":c:func:`!_PyDict_GetItemStringWithError`:請改" -"用 :c:func:`PyDict_GetItemStringRef`。" +":c:func:`!_PyDict_GetItemStringWithError`:請改用 :c:func:" +"`PyDict_GetItemStringRef`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 -msgid ":c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 +msgid ":c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`." msgstr ":c:func:`!_PyDict_Pop()`:請改用 :c:func:`PyDict_Pop`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." msgstr ":c:func:`!_PyLong_Sign()`:請改用 :c:func:`PyLong_GetSign`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:11 msgid "" -":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: " -"use :c:func:`PyLongWriter_Create`." +":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: use :c:func:" +"`PyLongWriter_Create`." msgstr "" -":c:func:`!_PyLong_FromDigits` 和 :c:func:`!_PyLong_New`:請改" -"用 :c:func:`PyLongWriter_Create`。" +":c:func:`!_PyLong_FromDigits` 和 :c:func:`!_PyLong_New`:請改用 :c:func:" +"`PyLongWriter_Create`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:12 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 msgid "" -":c:func:`!_PyThreadState_UncheckedGet`: " -"use :c:func:`PyThreadState_GetUnchecked`." +":c:func:`!_PyThreadState_UncheckedGet`: use :c:func:" +"`PyThreadState_GetUnchecked`." msgstr "" -":c:func:`!_PyThreadState_UncheckedGet`:請改" -"用 :c:func:`PyThreadState_GetUnchecked`。" +":c:func:`!_PyThreadState_UncheckedGet`:請改用 :c:func:" +"`PyThreadState_GetUnchecked`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." msgstr ":c:func:`!_PyUnicode_AsString`:請改用 :c:func:`PyUnicode_AsUTF8`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:15 msgid "" ":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " "with :c:func:`writer = PyUnicodeWriter_Create(0) `." @@ -72,105 +74,99 @@ msgstr "" ":c:func:`!_PyUnicodeWriter_Init`:將 ``_PyUnicodeWriter_Init(&writer)`` 替換" "為 :c:func:`writer = PyUnicodeWriter_Create(0) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:17 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:18 msgid "" ":c:func:`!_PyUnicodeWriter_Finish`: replace " -"``_PyUnicodeWriter_Finish(&writer)`` " -"with :c:func:`PyUnicodeWriter_Finish(writer) `." +"``_PyUnicodeWriter_Finish(&writer)`` with :c:func:" +"`PyUnicodeWriter_Finish(writer) `." msgstr "" ":c:func:`!_PyUnicodeWriter_Finish`:將 ``_PyUnicodeWriter_Finish(&writer)`` " "替換為 :c:func:`PyUnicodeWriter_Finish(writer) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:20 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:21 msgid "" ":c:func:`!_PyUnicodeWriter_Dealloc`: replace " -"``_PyUnicodeWriter_Dealloc(&writer)`` " -"with :c:func:`PyUnicodeWriter_Discard(writer) `." +"``_PyUnicodeWriter_Dealloc(&writer)`` with :c:func:" +"`PyUnicodeWriter_Discard(writer) `." msgstr "" ":c:func:`!_PyUnicodeWriter_Dealloc`:將 " -"``_PyUnicodeWriter_Dealloc(&writer)`` 替換" -"為 :c:func:`PyUnicodeWriter_Discard(writer) `。" +"``_PyUnicodeWriter_Dealloc(&writer)`` 替換為 :c:func:" +"`PyUnicodeWriter_Discard(writer) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:23 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:24 msgid "" ":c:func:`!_PyUnicodeWriter_WriteChar`: replace " -"``_PyUnicodeWriter_WriteChar(&writer, ch)`` " -"with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " -"`." +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` with :c:func:" +"`PyUnicodeWriter_WriteChar(writer, ch) `." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteChar`:將 " -"``_PyUnicodeWriter_WriteChar(&writer, ch)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " -"`。" +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteChar(writer, ch) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:26 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:27 msgid "" ":c:func:`!_PyUnicodeWriter_WriteStr`: replace " -"``_PyUnicodeWriter_WriteStr(&writer, str)`` " -"with :c:func:`PyUnicodeWriter_WriteStr(writer, str) " -"`." +"``_PyUnicodeWriter_WriteStr(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteStr(writer, str) `." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteStr`:將 " -"``_PyUnicodeWriter_WriteStr(&writer, str)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteStr(writer, str) " -"`。" +"``_PyUnicodeWriter_WriteStr(&writer, str)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteStr(writer, str) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:29 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:30 msgid "" ":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " -"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` " -"with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` with :c:func:" +"`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " "`." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteSubstring`:將 " -"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " "`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:32 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:33 msgid "" ":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " -"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` " -"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`." +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteASCII(writer, str) `." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteASCIIString`:將 " -"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`。" +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteASCII(writer, str) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:35 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:36 msgid "" ":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace " -"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` " -"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`." +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteUTF8(writer, str) `." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteLatin1String`:將 " -"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`。" +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteUTF8(writer, str) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:38 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." msgstr ":c:func:`!_PyUnicodeWriter_Prepare`:(無替代方案)。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." msgstr ":c:func:`!_PyUnicodeWriter_PrepareKind`:(無替代方案)。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." msgstr ":c:func:`!_Py_HashPointer`:請改用 :c:func:`Py_HashPointer`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:42 msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." msgstr ":c:func:`!_Py_fopen_obj`:請改用 :c:func:`Py_fopen`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:43 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:44 msgid "" "The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older." +">`__ can be used to get these new public functions on Python 3.13 and older. " +"(Contributed by Victor Stinner in :gh:`128863`.)" msgstr "" -"可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.13 及更早版本取得這些新的公開函式。" +"可以使用 `pythoncapi-compat project `__ 來取得這些於 Python 3.13 及更早版本的新公開函式。(由 " +"Victor Stinner 在 :gh:`128863` 貢獻)" diff --git a/deprecations/index.po b/deprecations/index.po index a8107540c4e..06b7a16536c 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,10 +31,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to " -"set :attr:`__spec__.cached ` is " -"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " -"into consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "` 的做法已被棄用。在 Python 3.15 中," @@ -42,11 +42,10 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to " -"set :attr:`__spec__.parent ` is " -"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " -"take into consideration by the import system or standard library. " -"(:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "` 的做法已被棄用。在 Python 3.15 中," @@ -102,17 +101,15 @@ msgstr ":class:`locale`:" #: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 " -"(:gh:`90817`), but has been postponed to Python 3.15. " -"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " -"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " -"in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" -"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " -"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" -"獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" @@ -120,11 +117,11 @@ msgstr ":mod:`pathlib`:" #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " -"Use :func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" -"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" @@ -179,9 +176,9 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" -"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " -"於 :gh:`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:80 #: ../../deprecations/pending-removal-in-3.17.rst:4 @@ -190,10 +187,10 @@ msgstr ":mod:`typing`:" #: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for " -"creating :class:`~typing.NamedTuple` classes (for example, ``Point = " -"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " -"3.13. Use the class-based syntax or the functional syntax instead." +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (for example, ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``) has been deprecated since Python 3.13. Use the class-based syntax " +"or the functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" @@ -228,14 +225,13 @@ msgstr ":mod:`wave`:" #: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " -"and :meth:`~wave.Wave_read.getmarkers` methods of " -"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " -"deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" -"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " -"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:107 msgid ":mod:`zipimport`:" @@ -247,9 +243,9 @@ msgid "" "3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " "by Jiahao Li in :gh:`125746`.)" msgstr "" -":meth:`~zipimport.zipimporter.load_module` 自 Python 3.10 被棄用。請改" -"用 :meth:`~zipimport.zipimporter.exec_module`。(由 Jiahao Li " -"於 :gh:`125746` 貢獻。)" +":meth:`~zipimport.zipimporter.load_module` 自 Python 3.10 被棄用。請改用 :" +"meth:`~zipimport.zipimporter.exec_module`。(由 Jiahao Li 於 :gh:`125746` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" @@ -257,10 +253,10 @@ msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to " -"set :attr:`__spec__.loader ` is " -"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " -"taken into consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "` 的做法將於 Python 3.16 被棄用。在 " @@ -291,8 +287,8 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除;請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " -"於 :gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" +"gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 msgid "" @@ -386,8 +382,8 @@ msgid "" "*function* or *sequence* as keyword arguments has been deprecated since " "Python 3.14." msgstr "" -"自 Python 3.14 起,使用 *function* 或 *sequence* 關鍵字引數呼" -"叫 :func:`functools.reduce` 的 Python 實作已被棄用。" +"自 Python 3.14 起,使用 *function* 或 *sequence* 關鍵字引數呼叫 :func:" +"`functools.reduce` 的 Python 實作已被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:64 msgid ":mod:`logging`:" @@ -408,10 +404,10 @@ msgstr ":mod:`mimetypes`:" #: ../../deprecations/pending-removal-in-3.16.rst:72 msgid "" -"Valid extensions start with a '.' or are empty " -"for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated " -"and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " -"Kemenade in :gh:`75223`.)" +"Valid extensions start with a '.' or are empty for :meth:`mimetypes." +"MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :" +"exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:" +"`75223`.)" msgstr "" "有效的副檔名以 '.' 開頭或對 :meth:`mimetypes.MimeTypes.add_type` 為空字串。未" "加點的副檔名已被棄用,並將在 Python 3.16 中引發 :exc:`ValueError`。(由 Hugo " @@ -494,18 +490,48 @@ msgstr "" "除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " "和 :func:`typing.get_args`,或者依賴私有實作細節。" +#: ../../deprecations/pending-removal-in-3.17.rst:11 +msgid "" +":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " +"removal in Python 3.17. Prefer :class:`~collections.abc.Sequence` or :class:" +"`~collections.abc.Buffer`. For use in type annotations, prefer a union, like " +"``bytes | bytearray``, or :class:`collections.abc.Buffer`. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" +"自 Python 3.9 起已被棄用的 :class:`typing.ByteString`,計劃在 Python " +"3.17 中移除。建議改用 :class:`~collections.abc.Sequence` 或 :class:`~" +"collections.abc.Buffer`。在型別註釋中建議改用聯集,例如 ``bytes | " +"bytearray`` 或 :class:`collections.abc.Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.17.rst:17 +msgid ":mod:`collections.abc`:" +msgstr ":mod:`collections.abc`:" + +#: ../../deprecations/pending-removal-in-3.17.rst:19 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. " +"Prefer :class:`~collections.abc.Sequence` or :class:`~collections.abc." +"Buffer`. For use in type annotations, prefer a union, like ``bytes | " +"bytearray``, or :class:`collections.abc.Buffer`. (Contributed by Shantanu " +"Jain in :gh:`91896`.)" +msgstr "" +":class:`collections.abc.ByteString` 計劃在 Python 3.17 中移除。建議改用 " +":class:`~collections.abc.Sequence` 或 :class:`~collections.abc.Buffer`。在" +"型別註釋中建議改用聯集,例如 ``bytes | bytearray`` 或 :class:`collections.abc." +"Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" + #: ../../deprecations/pending-removal-in-3.19.rst:2 msgid "Pending removal in Python 3.19" msgstr "Python 3.19 中待移除的項目" #: ../../deprecations/pending-removal-in-3.19.rst:6 msgid "" -"Implicitly switching to the MSVC-compatible struct layout by " -"setting :attr:`~ctypes.Structure._pack_` but " -"not :attr:`~ctypes.Structure._layout_` on non-Windows platforms." +"Implicitly switching to the MSVC-compatible struct layout by setting :attr:" +"`~ctypes.Structure._pack_` but not :attr:`~ctypes.Structure._layout_` on non-" +"Windows platforms." msgstr "" -"在非 Windows 平台上,透過設定 :attr:`~ctypes.Structure._pack_` 而沒有設" -"定 :attr:`~ctypes.Structure._layout_` 來隱式地切換到與 MSVC 相容的結構佈局。" +"在非 Windows 平台上,透過設定 :attr:`~ctypes.Structure._pack_` 而沒有設定 :" +"attr:`~ctypes.Structure._layout_` 來隱式地切換到與 MSVC 相容的結構佈局。" #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 @@ -529,11 +555,11 @@ msgstr "巢狀引數群組和巢狀互斥群組已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:11 msgid "" -"Passing the undocumented keyword argument *prefix_chars* " -"to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." +"Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse." +"ArgumentParser.add_argument_group` is now deprecated." msgstr "" -"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞" -"給 :meth:`~argparse.ArgumentParser.add_argument_group` 的做法現在已被棄用。" +"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞給 :meth:`~argparse." +"ArgumentParser.add_argument_group` 的做法現在已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:14 msgid "The :class:`argparse.FileType` type converter is deprecated." @@ -558,17 +584,17 @@ msgid "" "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of " -"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " -"and :keyword:`or`. In a future release it will be changed to a syntax " -"error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" -"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " -"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" -"法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" +"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" +"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" +"本中,它將被更改為語法錯誤。(:gh:`87999`)" #: ../../deprecations/pending-removal-in-future.rst:30 msgid "" @@ -581,18 +607,18 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:33 msgid "" -"Support for ``__float__()`` method returning a strict subclass " -"of :class:`float`: these methods will be required to return an instance " -"of :class:`float`." +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:36 msgid "" -"Support for ``__complex__()`` method returning a strict subclass " -"of :class:`complex`: these methods will be required to return an instance " -"of :class:`complex`." +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" @@ -603,10 +629,10 @@ msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" #: ../../deprecations/pending-removal-in-future.rst:40 msgid "" -"Passing a complex number as the *real* or *imag* argument in " -"the :func:`complex` constructor is now deprecated; it should only be passed " -"as a single positional argument. (Contributed by Serhiy Storchaka " -"in :gh:`109218`.)" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" @@ -614,9 +640,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:45 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` " -"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " @@ -624,8 +649,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:50 msgid "" -":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " -"(:gh:`133038`)" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:" +"`133038`)" msgstr "" ":mod:`codecs`:請改用 :func:`open` 而非 :func:`codecs.open`。(:gh:`133038`)" @@ -642,19 +667,19 @@ msgstr ":mod:`datetime`:" #: ../../deprecations/pending-removal-in-future.rst:57 msgid "" -":meth:`~datetime.datetime.utcnow`: use " -"``datetime.datetime.now(tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 " -"``datetime.datetime.now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." +"now(tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:59 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:62 msgid ":mod:`gettext`: Plural value must be an integer." @@ -685,8 +710,8 @@ msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" -"用 :meth:`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" #: ../../deprecations/pending-removal-in-future.rst:77 msgid "" @@ -743,11 +768,11 @@ msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:100 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " -"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " -"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" +"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" #: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.OP_NO_SSL*`` options" @@ -795,11 +820,11 @@ msgstr ":mod:`threading` 方法:" #: ../../deprecations/pending-removal-in-future.rst:116 msgid "" -":meth:`!threading.Condition.notifyAll`: " -"use :meth:`~threading.Condition.notify_all`." +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請" -"用 :meth:`~threading.Condition.notify_all`。" +":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." +"notify_all`。" #: ../../deprecations/pending-removal-in-future.rst:117 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." @@ -807,19 +832,19 @@ msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set` #: ../../deprecations/pending-removal-in-future.rst:118 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " -"use :attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:120 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " -"use :attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" -"用 :attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" +"attr:`threading.Thread.name` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:122 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." @@ -912,22 +937,22 @@ msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分 #: ../../deprecations/pending-removal-in-future.rst:152 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of " -"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " -"release it will always return ``True``. Prefer explicit ``len(elem)`` or " -"``elem is not None`` tests instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用" -"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" -"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." +"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " +"``len(elem)`` 或 ``elem is not None`` 測試。" #: ../../deprecations/pending-removal-in-future.rst:157 msgid "" -":func:`sys._clear_type_cache` is deprecated: " -"use :func:`sys._clear_internal_caches` instead." +":func:`sys._clear_type_cache` is deprecated: use :func:`sys." +"_clear_internal_caches` instead." msgstr "" -":func:`sys._clear_type_cache` 已被棄用:請改" -"用 :func:`sys._clear_internal_caches`。" +":func:`sys._clear_type_cache` 已被棄用:請改用 :func:`sys." +"_clear_internal_caches`。" #: ../../deprecations/index.rst:15 msgid "C API deprecations" @@ -935,31 +960,31 @@ msgstr "C API 的棄用項目" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: " -"Use :c:func:`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改" -"用 :c:func:`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" +"`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " -"Use :c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project " -"`__ can be used to " -"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project `__ can be used to get :c:func:" +"`PyWeakref_GetRef` on Python 3.12 and older." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" -"用 :c:func:`PyWeakref_GetRef`。可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.12 和更早版本取" -"得 :c:func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.12 和更早版本取得 :c:func:" +"`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " -"Use :c:type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" -"用 :c:type:`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 msgid "" @@ -974,8 +999,8 @@ msgid "" "than :class:`str`, such as :class:`bytes`." msgstr "" ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`;請注" -"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`str` 的型別,例" -"如 :class:`bytes`。" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`str` 的型別,例如 :" +"class:`bytes`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid "" @@ -990,8 +1015,8 @@ msgid "" "than :class:`bytes`, such as :class:`str`." msgstr "" ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`;請注" -"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`bytes` 的型別,例" -"如 :class:`str`。" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`bytes` 的型別,例如 :" +"class:`str`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 msgid "Python initialization functions, deprecated in Python 3.13:" @@ -1008,37 +1033,35 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:27 msgid "" ":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") " -"` (:data:`sys.base_prefix`) instead. " -"Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) " -"if :ref:`virtual environments ` need to be handled." +"` (:data:`sys.base_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) if :ref:" +"`virtual environments ` need to be handled." msgstr "" ":c:func:`Py_GetPrefix`:請改用 :c:func:`PyConfig_Get(\"base_prefix\") " "` (:data:`sys.base_prefix`)。如果需要處理\\ :ref:`虛擬環境 " -"`,請改用 :c:func:`PyConfig_Get(\"prefix\") ` " -"(:data:`sys.prefix`)。" +"`,請改用 :c:func:`PyConfig_Get(\"prefix\") ` (:data:" +"`sys.prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:32 msgid "" ":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") " -"` (:data:`sys.base_exec_prefix`) instead. " -"Use :c:func:`PyConfig_Get(\"exec_prefix\") ` " -"(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " -"be handled." +"` (:data:`sys.base_exec_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"exec_prefix\") ` (:data:`sys.exec_prefix`) if :" +"ref:`virtual environments ` need to be handled." msgstr "" -":c:func:`Py_GetExecPrefix`:請改" -"用 :c:func:`PyConfig_Get(\"base_exec_prefix\") ` " -"(:data:`sys.base_exec_prefix`)。如果需要處理\\ :ref:`虛擬環境 `,請" -"改用 :c:func:`PyConfig_Get(\"exec_prefix\") ` " -"(:data:`sys.exec_prefix`)。" +":c:func:`Py_GetExecPrefix`:請改用 :c:func:" +"`PyConfig_Get(\"base_exec_prefix\") ` (:data:`sys." +"base_exec_prefix`)。如果需要處理\\ :ref:`虛擬環境 `,請改用 :c:" +"func:`PyConfig_Get(\"exec_prefix\") ` (:data:`sys." +"exec_prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:38 msgid "" ":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." msgstr "" -":c:func:`Py_GetProgramFullPath`:請改" -"用 :c:func:`PyConfig_Get(\"executable\") ` " -"(:data:`sys.executable`)。" +":c:func:`Py_GetProgramFullPath`:請改用 :c:func:" +"`PyConfig_Get(\"executable\") ` (:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:41 msgid "" @@ -1093,13 +1116,13 @@ msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " -"和 :data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" +"data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:65 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." msgstr "" "應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API。" @@ -1109,108 +1132,108 @@ msgstr "全域配置變數:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:70 msgid "" -":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` " -"or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." +":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` or :c:func:" +"`PyConfig_Get(\"parser_debug\") ` instead." msgstr "" -":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug` " -"或 :c:func:`PyConfig_Get(\"parser_debug\") `。" +":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug` 或 :c:func:" +"`PyConfig_Get(\"parser_debug\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:73 msgid "" -":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` " -"or :c:func:`PyConfig_Get(\"verbose\") ` instead." +":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` or :c:func:" +"`PyConfig_Get(\"verbose\") ` instead." msgstr "" -":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose` " -"或 :c:func:`PyConfig_Get(\"verbose\") `。" +":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose` 或 :c:func:" +"`PyConfig_Get(\"verbose\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:76 msgid "" -":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` " -"or :c:func:`PyConfig_Get(\"quiet\") ` instead." +":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` or :c:func:" +"`PyConfig_Get(\"quiet\") ` instead." msgstr "" -":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet` " -"或 :c:func:`PyConfig_Get(\"quiet\") `。" +":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet` 或 :c:func:" +"`PyConfig_Get(\"quiet\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:79 msgid "" -":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` " -"or :c:func:`PyConfig_Get(\"interactive\") ` instead." +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` or :c:func:" +"`PyConfig_Get(\"interactive\") ` instead." msgstr "" -":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive` " -"或 :c:func:`PyConfig_Get(\"interactive\") `。" +":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive` 或 :c:" +"func:`PyConfig_Get(\"interactive\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:82 msgid "" -":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` " -"or :c:func:`PyConfig_Get(\"inspect\") ` instead." +":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` or :c:func:" +"`PyConfig_Get(\"inspect\") ` instead." msgstr "" -":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect` " -"或 :c:func:`PyConfig_Get(\"inspect\") `。" +":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect` 或 :c:func:" +"`PyConfig_Get(\"inspect\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:85 msgid "" -":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " -"or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` or :c:" +"func:`PyConfig_Get(\"optimization_level\") ` instead." msgstr "" -":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level` " -"或 :c:func:`PyConfig_Get(\"optimization_level\") `。" +":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level` 或 :" +"c:func:`PyConfig_Get(\"optimization_level\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:88 msgid "" -":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` " -"or :c:func:`PyConfig_Get(\"site_import\") ` instead." +":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` or :c:func:" +"`PyConfig_Get(\"site_import\") ` instead." msgstr "" -":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import` " -"或 :c:func:`PyConfig_Get(\"site_import\") `。" +":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import` 或 :c:func:" +"`PyConfig_Get(\"site_import\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:91 msgid "" -":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " -"or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` or :c:" +"func:`PyConfig_Get(\"bytes_warning\") ` instead." msgstr "" -":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning` " -"或 :c:func:`PyConfig_Get(\"bytes_warning\") `。" +":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning` 或 :" +"c:func:`PyConfig_Get(\"bytes_warning\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:94 msgid "" -":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " -"or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` or :c:" +"func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" -":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings` " -"或 :c:func:`PyConfig_Get(\"pathconfig_warnings\") `。" +":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings` 或 :" +"c:func:`PyConfig_Get(\"pathconfig_warnings\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:97 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "or :c:func:`PyConfig_Get(\"use_environment\") ` instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment` " -"或 :c:func:`PyConfig_Get(\"use_environment\") `。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." +"use_environment` 或 :c:func:`PyConfig_Get(\"use_environment\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:100 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改" -"用 :c:member:`PyConfig.write_bytecode` " -"或 :c:func:`PyConfig_Get(\"write_bytecode\") `。" +":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." +"write_bytecode` 或 :c:func:`PyConfig_Get(\"write_bytecode\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:103 msgid "" -":c:var:`Py_NoUserSiteDirectory`: " -"Use :c:member:`PyConfig.user_site_directory` " -"or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` or :c:func:`PyConfig_Get(\"user_site_directory\") " +"` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory` " -"或 :c:func:`PyConfig_Get(\"user_site_directory\") `。" +":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." +"user_site_directory` 或 :c:func:`PyConfig_Get(\"user_site_directory\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:106 msgid "" -":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " -"or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` or :" +"c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." msgstr "" ":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio` " "或 :c:func:`PyConfig_Get(\"buffered_stdio\") `。" @@ -1227,70 +1250,69 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:113 msgid "" -":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` " -"or :c:func:`PyConfig_Get(\"isolated\") ` instead." +":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` or :c:func:" +"`PyConfig_Get(\"isolated\") ` instead." msgstr "" -":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated` " -"或 :c:func:`PyConfig_Get(\"isolated\") `。" +":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated` 或 :c:func:" +"`PyConfig_Get(\"isolated\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:116 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` " -"or :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") ` " -"instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` or :c:func:" +"`PyConfig_Get(\"legacy_windows_fs_encoding\") ` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding` " -"或 :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") `。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` 或 :c:func:" +"`PyConfig_Get(\"legacy_windows_fs_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:119 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"Use :c:member:`PyConfig.legacy_windows_stdio` " -"or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") " +"` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio` " -"或 :c:func:`PyConfig_Get(\"legacy_windows_stdio\") `。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." +"legacy_windows_stdio` 或 :c:func:`PyConfig_Get(\"legacy_windows_stdio\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:122 msgid "" ":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" -"Py_HasFileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` " -"or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." +"Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` or :c:func:`PyConfig_Get(\"filesystem_encoding\") " +"` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`、:c:var:`!" -"Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding` " -"或 :c:func:`PyConfig_Get(\"filesystem_encoding\") `。" +"Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding` 或 :c:func:`PyConfig_Get(\"filesystem_encoding\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:125 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"Use :c:member:`PyConfig.filesystem_errors` " -"or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` or :c:func:`PyConfig_Get(\"filesystem_errors\") " +"` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors` " -"或 :c:func:`PyConfig_Get(\"filesystem_errors\") `。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." +"filesystem_errors` 或 :c:func:`PyConfig_Get(\"filesystem_errors\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:128 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` " -"or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` or :c:func:" +"`PyConfig_Get(\"utf8_mode\") ` instead. (see :c:func:" +"`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode` " -"或 :c:func:`PyConfig_Get(\"utf8_mode\") `。(請參" -"閱 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode` 或 :c:func:" +"`PyConfig_Get(\"utf8_mode\") `。(請參閱 :c:func:" +"`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:133 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can " -"be used to get these options at runtime." +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can be used to " +"get these options at runtime." msgstr "" "應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API 來設定" "這些選項。或者也可以使用 :c:func:`PyConfig_Get` 在執行時取得這些選項。" @@ -1300,50 +1322,52 @@ msgid "Pending removal in Python 3.18" msgstr "Python 3.18 中待移除的項目" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:4 -msgid "Deprecated private functions (:gh:`128863`):" -msgstr "被棄用的私有函式 (:gh:`128863`):" +msgid "" +"The following private functions are deprecated and planned for removal in " +"Python 3.18:" +msgstr "以下私有函式已被棄用,並計劃在 Python 3.18 中移除:" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:6 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." msgstr ":c:func:`!_PyBytes_Join`:請改用 :c:func:`PyBytes_Join`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 msgid "" -":c:func:`!_PyDict_GetItemStringWithError`: " -"use :c:func:`PyDict_GetItemStringRef`." +":c:func:`!_PyDict_GetItemStringWithError`: use :c:func:" +"`PyDict_GetItemStringRef`." msgstr "" -":c:func:`!_PyDict_GetItemStringWithError`:請改" -"用 :c:func:`PyDict_GetItemStringRef`。" +":c:func:`!_PyDict_GetItemStringWithError`:請改用 :c:func:" +"`PyDict_GetItemStringRef`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 -msgid ":c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 +msgid ":c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`." msgstr ":c:func:`!_PyDict_Pop()`:請改用 :c:func:`PyDict_Pop`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." msgstr ":c:func:`!_PyLong_Sign()`:請改用 :c:func:`PyLong_GetSign`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:11 msgid "" -":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: " -"use :c:func:`PyLongWriter_Create`." +":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: use :c:func:" +"`PyLongWriter_Create`." msgstr "" -":c:func:`!_PyLong_FromDigits` 和 :c:func:`!_PyLong_New`:請改" -"用 :c:func:`PyLongWriter_Create`。" +":c:func:`!_PyLong_FromDigits` 和 :c:func:`!_PyLong_New`:請改用 :c:func:" +"`PyLongWriter_Create`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:12 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 msgid "" -":c:func:`!_PyThreadState_UncheckedGet`: " -"use :c:func:`PyThreadState_GetUnchecked`." +":c:func:`!_PyThreadState_UncheckedGet`: use :c:func:" +"`PyThreadState_GetUnchecked`." msgstr "" -":c:func:`!_PyThreadState_UncheckedGet`:請改" -"用 :c:func:`PyThreadState_GetUnchecked`。" +":c:func:`!_PyThreadState_UncheckedGet`:請改用 :c:func:" +"`PyThreadState_GetUnchecked`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." msgstr ":c:func:`!_PyUnicode_AsString`:請改用 :c:func:`PyUnicode_AsUTF8`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:15 msgid "" ":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " "with :c:func:`writer = PyUnicodeWriter_Create(0) `." @@ -1351,108 +1375,102 @@ msgstr "" ":c:func:`!_PyUnicodeWriter_Init`:將 ``_PyUnicodeWriter_Init(&writer)`` 替換" "為 :c:func:`writer = PyUnicodeWriter_Create(0) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:17 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:18 msgid "" ":c:func:`!_PyUnicodeWriter_Finish`: replace " -"``_PyUnicodeWriter_Finish(&writer)`` " -"with :c:func:`PyUnicodeWriter_Finish(writer) `." +"``_PyUnicodeWriter_Finish(&writer)`` with :c:func:" +"`PyUnicodeWriter_Finish(writer) `." msgstr "" ":c:func:`!_PyUnicodeWriter_Finish`:將 ``_PyUnicodeWriter_Finish(&writer)`` " "替換為 :c:func:`PyUnicodeWriter_Finish(writer) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:20 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:21 msgid "" ":c:func:`!_PyUnicodeWriter_Dealloc`: replace " -"``_PyUnicodeWriter_Dealloc(&writer)`` " -"with :c:func:`PyUnicodeWriter_Discard(writer) `." +"``_PyUnicodeWriter_Dealloc(&writer)`` with :c:func:" +"`PyUnicodeWriter_Discard(writer) `." msgstr "" ":c:func:`!_PyUnicodeWriter_Dealloc`:將 " -"``_PyUnicodeWriter_Dealloc(&writer)`` 替換" -"為 :c:func:`PyUnicodeWriter_Discard(writer) `。" +"``_PyUnicodeWriter_Dealloc(&writer)`` 替換為 :c:func:" +"`PyUnicodeWriter_Discard(writer) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:23 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:24 msgid "" ":c:func:`!_PyUnicodeWriter_WriteChar`: replace " -"``_PyUnicodeWriter_WriteChar(&writer, ch)`` " -"with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " -"`." +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` with :c:func:" +"`PyUnicodeWriter_WriteChar(writer, ch) `." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteChar`:將 " -"``_PyUnicodeWriter_WriteChar(&writer, ch)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " -"`。" +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteChar(writer, ch) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:26 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:27 msgid "" ":c:func:`!_PyUnicodeWriter_WriteStr`: replace " -"``_PyUnicodeWriter_WriteStr(&writer, str)`` " -"with :c:func:`PyUnicodeWriter_WriteStr(writer, str) " -"`." +"``_PyUnicodeWriter_WriteStr(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteStr(writer, str) `." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteStr`:將 " -"``_PyUnicodeWriter_WriteStr(&writer, str)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteStr(writer, str) " -"`。" +"``_PyUnicodeWriter_WriteStr(&writer, str)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteStr(writer, str) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:29 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:30 msgid "" ":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " -"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` " -"with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` with :c:func:" +"`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " "`." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteSubstring`:將 " -"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " "`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:32 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:33 msgid "" ":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " -"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` " -"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`." +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteASCII(writer, str) `." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteASCIIString`:將 " -"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`。" +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteASCII(writer, str) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:35 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:36 msgid "" ":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace " -"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` " -"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`." +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteUTF8(writer, str) `." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteLatin1String`:將 " -"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`。" +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteUTF8(writer, str) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:38 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." msgstr ":c:func:`!_PyUnicodeWriter_Prepare`:(無替代方案)。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." msgstr ":c:func:`!_PyUnicodeWriter_PrepareKind`:(無替代方案)。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." msgstr ":c:func:`!_Py_HashPointer`:請改用 :c:func:`Py_HashPointer`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:42 msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." msgstr ":c:func:`!_Py_fopen_obj`:請改用 :c:func:`Py_fopen`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:43 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:44 msgid "" "The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older." +">`__ can be used to get these new public functions on Python 3.13 and older. " +"(Contributed by Victor Stinner in :gh:`128863`.)" msgstr "" "可以使用 `pythoncapi-compat project `__ 來取得這些於 Python 3.13 及更早版本的新公開函式。" +"compat/>`__ 來取得這些於 Python 3.13 及更早版本的新公開函式。(由 " +"Victor Stinner 在 :gh:`128863` 貢獻)" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -1473,8 +1491,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改" -"用 :c:func:`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改用 :c:func:" +"`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -1494,11 +1512,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " -"and :c:func:`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " -"和 :c:func:`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" +"`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" @@ -1520,8 +1538,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" -"叫 :c:func:`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" +"`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:29 msgid "Thread Local Storage (TLS) API:" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index 12e8980e524..add170a79b4 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -60,8 +60,8 @@ msgstr ":class:`!ast.Ellipsis`" #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " -"in :gh:`90953`.)" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" +"`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" @@ -72,28 +72,26 @@ msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" "The child watcher classes :class:`!asyncio.MultiLoopChildWatcher`, :class:`!" -"asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` " -"and :class:`!asyncio.SafeChildWatcher` are deprecated and will be removed in " -"Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +"asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` and :class:" +"`!asyncio.SafeChildWatcher` are deprecated and will be removed in Python " +"3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`!" -"asyncio.MultiLoopChildWatcher`、:class:`!asyncio.FastChildWatcher`、:class:`!" -"asyncio.AbstractChildWatcher` 和 :class:`!asyncio.SafeChildWatcher`。 (由 " -"Kumar Aditya 於 :gh:`94597` 貢獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`!asyncio." +"MultiLoopChildWatcher`、:class:`!asyncio.FastChildWatcher`、:class:`!asyncio." +"AbstractChildWatcher` 和 :class:`!asyncio.SafeChildWatcher`。 (由 Kumar " +"Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`!asyncio.set_child_watcher`, :func:`!" -"asyncio.get_child_watcher`, :meth:`!" -"asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`!" +":func:`!asyncio.set_child_watcher`, :func:`!asyncio.get_child_watcher`, :" +"meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`!" "asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated and will " "be removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -":func:`!asyncio.set_child_watcher`、:func:`!" -"asyncio.get_child_watcher`、:meth:`!" -"asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`!" -"asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python " -"3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`!asyncio.set_child_watcher`、:func:`!asyncio.get_child_watcher`、:" +"meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`!asyncio." +"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" +"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" @@ -108,60 +106,45 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" -":mod:`collections.abc`: Deprecated :class:`!collections.abc.ByteString`. " -"Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, " -"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -"in :gh:`91896`.)" -msgstr "" -":mod:`collections.abc`:已棄用 :class:`!collections.abc.ByteString`。請改" -"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" -"時,請改用聯集,如 ``bytes | bytearray``," -"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" -"獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:47 -msgid "" -":mod:`email`: Deprecated the *isdst* parameter " -"in :func:`email.utils.localtime`. (Contributed by Alan Williams " -"in :gh:`72346`.)" +":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:50 +#: ../../deprecations/pending-removal-in-3.14.rst:44 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:52 +#: ../../deprecations/pending-removal-in-3.14.rst:46 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:53 +#: ../../deprecations/pending-removal-in-3.14.rst:47 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:48 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:50 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:58 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:55 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:57 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -172,86 +155,94 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:69 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " "currently the default (:gh:`84559`). Adding a runtime warning about this was " "deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` " -"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " -"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." +"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." +"set_start_method` APIs to explicitly specify when your code *requires* " +"``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" "台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" -"用 :func:`~multiprocessing.get_context` " -"或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時\\ *" -"需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" +"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " +"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" +"`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:77 +#: ../../deprecations/pending-removal-in-3.14.rst:71 msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " -"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " -"deprecated." +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." +"PurePath.relative_to`: passing additional arguments is deprecated." msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " -"和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" +"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:81 +#: ../../deprecations/pending-removal-in-3.14.rst:75 msgid "" ":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`!pkgutil.find_loader` 和 :func:`!pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改" -"用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" -"獻。)" +"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." +"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:86 +#: ../../deprecations/pending-removal-in-3.14.rst:80 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:82 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:83 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:85 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:87 msgid ":data:`!version` and :data:`!version_info`." msgstr ":data:`!version` 和 :data:`!version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " -"if :ref:`named placeholders ` are used and " -"*parameters* is a sequence instead of a :class:`dict`." +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" +"ref:`named placeholders ` are used and *parameters* is " +"a sequence instead of a :class:`dict`." msgstr "" ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:99 -msgid "" -":mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9, now " -"causes a :exc:`DeprecationWarning` to be emitted when it is used." -msgstr "" -":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`!typing.ByteString` 現在在" -"使用時會發出 :exc:`DeprecationWarning`。" - -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith " -"in :gh:`88168`.)" +"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" +"`88168`.)" msgstr "" ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" "(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" + +#~ msgid "" +#~ ":mod:`collections.abc`: Deprecated :class:`!collections.abc.ByteString`. " +#~ "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " +#~ "typing, prefer a union, like ``bytes | bytearray``, or :class:" +#~ "`collections.abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" +#~ msgstr "" +#~ ":mod:`collections.abc`:已棄用 :class:`!collections.abc.ByteString`。請改" +#~ "用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使" +#~ "用時,請改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc." +#~ "Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢獻。)" + +#~ msgid "" +#~ ":mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9, " +#~ "now causes a :exc:`DeprecationWarning` to be emitted when it is used." +#~ msgstr "" +#~ ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`!typing.ByteString` 現在" +#~ "在使用時會發出 :exc:`DeprecationWarning`。" diff --git a/deprecations/pending-removal-in-3.17.po b/deprecations/pending-removal-in-3.17.po index cbf597dea40..49abbd6744e 100644 --- a/deprecations/pending-removal-in-3.17.po +++ b/deprecations/pending-removal-in-3.17.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -37,3 +37,33 @@ msgstr "" "作的。這個類別不再被需要,但為了向後相容性而保留,並計劃將在 Python 3.17 中移" "除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " "和 :func:`typing.get_args`,或者依賴私有實作細節。" + +#: ../../deprecations/pending-removal-in-3.17.rst:11 +msgid "" +":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " +"removal in Python 3.17. Prefer :class:`~collections.abc.Sequence` or :class:" +"`~collections.abc.Buffer`. For use in type annotations, prefer a union, like " +"``bytes | bytearray``, or :class:`collections.abc.Buffer`. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" +"自 Python 3.9 起已被棄用的 :class:`typing.ByteString`,計劃在 Python " +"3.17 中移除。建議改用 :class:`~collections.abc.Sequence` 或 :class:`~" +"collections.abc.Buffer`。在型別註釋中建議改用聯集,例如 ``bytes | " +"bytearray`` 或 :class:`collections.abc.Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.17.rst:17 +msgid ":mod:`collections.abc`:" +msgstr ":mod:`collections.abc`:" + +#: ../../deprecations/pending-removal-in-3.17.rst:19 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. " +"Prefer :class:`~collections.abc.Sequence` or :class:`~collections.abc." +"Buffer`. For use in type annotations, prefer a union, like ``bytes | " +"bytearray``, or :class:`collections.abc.Buffer`. (Contributed by Shantanu " +"Jain in :gh:`91896`.)" +msgstr "" +":class:`collections.abc.ByteString` 計劃在 Python 3.17 中移除。建議改用 " +":class:`~collections.abc.Sequence` 或 :class:`~collections.abc.Buffer`。在" +"型別註釋中建議改用聯集,例如 ``bytes | bytearray`` 或 :class:`collections.abc." +"Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" diff --git a/extending/extending.po b/extending/extending.po index 597ae13de89..452fcb63745 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2025-02-17 14:34+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -101,9 +101,9 @@ msgstr "" #: ../../extending/extending.rst:53 msgid "" "Begin by creating a file :file:`spammodule.c`. (Historically, if a module " -"is called ``spam``, the C file containing its implementation is " -"called :file:`spammodule.c`; if the module name is very long, like " -"``spammify``, the module name can be just :file:`spammify.c`.)" +"is called ``spam``, the C file containing its implementation is called :file:" +"`spammodule.c`; if the module name is very long, like ``spammify``, the " +"module name can be just :file:`spammify.c`.)" msgstr "" "首先建立一個檔案 :file:`spammodule.c`。(從過去歷史來看,如果一個模組叫做 " "``spam``,包含其實作的 C 檔案就會叫做 :file:`spammodule.c`;如果模組名稱很" @@ -153,11 +153,11 @@ msgstr "" msgid "" "All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` " "or ``PY``, except those defined in standard header files. For convenience, " -"and since they are used extensively by the Python interpreter, " -"``\"Python.h\"`` includes a few standard header files: ````, " -"````, ````, and ````. If the latter header " -"file does not exist on your system, it declares the " -"functions :c:func:`malloc`, :c:func:`free` and :c:func:`realloc` directly." +"and since they are used extensively by the Python interpreter, ``\"Python." +"h\"`` includes a few standard header files: ````, ````, " +"````, and ````. If the latter header file does not exist " +"on your system, it declares the functions :c:func:`malloc`, :c:func:`free` " +"and :c:func:`realloc` directly." msgstr "" #: ../../extending/extending.rst:85 @@ -166,9 +166,9 @@ msgid "" "called when the Python expression ``spam.system(string)`` is evaluated " "(we'll see shortly how it ends up being called)::" msgstr "" -"接下來我們要加入到模組檔案的是 C 函式,當 Python 運算式 " -"``spam.system(string)`` 要被求值 (evaluated) 時就會被呼叫(我們很快就會看到它" -"最後是如何被呼叫的): ::" +"接下來我們要加入到模組檔案的是 C 函式,當 Python 運算式 ``spam." +"system(string)`` 要被求值 (evaluated) 時就會被呼叫(我們很快就會看到它最後是" +"如何被呼叫的): ::" #: ../../extending/extending.rst:89 msgid "" @@ -227,9 +227,9 @@ msgid "" msgstr "" "*args* 引數會是一個指向包含引數的 Python 元組物件的指標。元組中的每一項都對應" "於呼叫的引數串列中的一個引數。引數是 Python 物件 --- 為了在我們的 C 函式中對" -"它們做任何事情,我們必須先將它們轉換成 C 值。Python API 中" -"的 :c:func:`PyArg_ParseTuple` 函式能夠檢查引數型別並將他們轉換為 C 值。它使用" -"模板字串來決定所需的引數型別以及儲存轉換值的 C 變數型別。稍後會再詳細說明。" +"它們做任何事情,我們必須先將它們轉換成 C 值。Python API 中的 :c:func:" +"`PyArg_ParseTuple` 函式能夠檢查引數型別並將他們轉換為 C 值。它使用模板字串來" +"決定所需的引數型別以及儲存轉換值的 C 變數型別。稍後會再詳細說明。" #: ../../extending/extending.rst:118 msgid "" @@ -240,10 +240,10 @@ msgid "" "the calling function can return ``NULL`` immediately (as we saw in the " "example)." msgstr "" -"如果所有的引數都有正確的型別,且其元件已儲存在傳入位址的變數中," -"則 :c:func:`PyArg_ParseTuple` 會回傳 true(非零)。如果傳入的是無效引數串列則" -"回傳 false(零)。在後者情況下,它也會產生適當的例外,因此呼叫函式可以立即回" -"傳 ``NULL``\\ (就像我們在範例中所看到的)。" +"如果所有的引數都有正確的型別,且其元件已儲存在傳入位址的變數中,則 :c:func:" +"`PyArg_ParseTuple` 會回傳 true(非零)。如果傳入的是無效引數串列則回傳 false" +"(零)。在後者情況下,它也會產生適當的例外,因此呼叫函式可以立即回傳 " +"``NULL``\\ (就像我們在範例中所看到的)。" #: ../../extending/extending.rst:128 msgid "Intermezzo: Errors and Exceptions" @@ -289,28 +289,27 @@ msgstr "" msgid "" "Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an " "exception argument and constructs the associated value by inspection of the " -"global variable :c:data:`errno`. The most general function " -"is :c:func:`PyErr_SetObject`, which takes two object arguments, the " -"exception and its associated value. You don't need to :c:func:`Py_INCREF` " -"the objects passed to any of these functions." +"global variable :c:data:`errno`. The most general function is :c:func:" +"`PyErr_SetObject`, which takes two object arguments, the exception and its " +"associated value. You don't need to :c:func:`Py_INCREF` the objects passed " +"to any of these functions." msgstr "" "另一個有用的函式是 :c:func:`PyErr_SetFromErrno`,它只接受一個例外引數,並透過" -"檢查全域變數 :c:data:`errno` 來建立關聯值。最一般的函式" -"是 :c:func:`PyErr_SetObject`,它接受兩個物件引數,即例外和它的關聯值。你不需" -"要對傳給任何這些函式的物件呼叫 :c:func:`Py_INCREF`。" +"檢查全域變數 :c:data:`errno` 來建立關聯值。最一般的函式是 :c:func:" +"`PyErr_SetObject`,它接受兩個物件引數,即例外和它的關聯值。你不需要對傳給任何" +"這些函式的物件呼叫 :c:func:`Py_INCREF`。" #: ../../extending/extending.rst:154 msgid "" -"You can test non-destructively whether an exception has been set " -"with :c:func:`PyErr_Occurred`. This returns the current exception object, " -"or ``NULL`` if no exception has occurred. You normally don't need to " -"call :c:func:`PyErr_Occurred` to see whether an error occurred in a function " -"call, since you should be able to tell from the return value." +"You can test non-destructively whether an exception has been set with :c:" +"func:`PyErr_Occurred`. This returns the current exception object, or " +"``NULL`` if no exception has occurred. You normally don't need to call :c:" +"func:`PyErr_Occurred` to see whether an error occurred in a function call, " +"since you should be able to tell from the return value." msgstr "" "你可以使用 :c:func:`PyErr_Occurred` 來不具破壞性地測試例外是否已被設定。這會" -"回傳目前的例外物件,如果沒有例外發生則回傳 ``NULL``。你通常不需要呼" -"叫 :c:func:`PyErr_Occurred` 來查看函式呼叫是否發生錯誤,因為你應可從回傳值就" -"得知。" +"回傳目前的例外物件,如果沒有例外發生則回傳 ``NULL``。你通常不需要呼叫 :c:" +"func:`PyErr_Occurred` 來查看函式呼叫是否發生錯誤,因為你應可從回傳值就得知。" #: ../../extending/extending.rst:160 msgid "" @@ -359,17 +358,16 @@ msgstr "" #: ../../extending/extending.rst:182 msgid "" "Every failing :c:func:`malloc` call must be turned into an exception --- the " -"direct caller of :c:func:`malloc` (or :c:func:`realloc`) must " -"call :c:func:`PyErr_NoMemory` and return a failure indicator itself. All " -"the object-creating functions (for example, :c:func:`PyLong_FromLong`) " -"already do this, so this note is only relevant to those who " -"call :c:func:`malloc` directly." -msgstr "" -"每個失敗的 :c:func:`malloc` 呼叫都必須被轉換成一個例外 " -"--- :c:func:`malloc`\\ (或 :c:func:`realloc`)的直接呼叫者必須呼" -"叫 :c:func:`PyErr_NoMemory` 並回傳一個失敗指示器。所有建立物件的函式(例" -"如 :c:func:`PyLong_FromLong`)都已經這麼做了,所以這個注意事項只和那些直接呼" -"叫 :c:func:`malloc` 的函式有關。" +"direct caller of :c:func:`malloc` (or :c:func:`realloc`) must call :c:func:" +"`PyErr_NoMemory` and return a failure indicator itself. All the object-" +"creating functions (for example, :c:func:`PyLong_FromLong`) already do this, " +"so this note is only relevant to those who call :c:func:`malloc` directly." +msgstr "" +"每個失敗的 :c:func:`malloc` 呼叫都必須被轉換成一個例外 --- :c:func:" +"`malloc`\\ (或 :c:func:`realloc`)的直接呼叫者必須呼叫 :c:func:" +"`PyErr_NoMemory` 並回傳一個失敗指示器。所有建立物件的函式(例如 :c:func:" +"`PyLong_FromLong`)都已經這麼做了,所以這個注意事項只和那些直接呼叫 :c:func:" +"`malloc` 的函式有關。" #: ../../extending/extending.rst:188 msgid "" @@ -384,12 +382,12 @@ msgstr "" #: ../../extending/extending.rst:192 msgid "" -"Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` " -"or :c:func:`Py_DECREF` calls for objects you have already created) when you " +"Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or :" +"c:func:`Py_DECREF` calls for objects you have already created) when you " "return an error indicator!" msgstr "" -"最後,在回傳錯誤指示器時要注意垃圾清理(透過對你已經建立的物件呼" -"叫 :c:func:`Py_XDECREF` 或 :c:func:`Py_DECREF`)!" +"最後,在回傳錯誤指示器時要注意垃圾清理(透過對你已經建立的物件呼叫 :c:func:" +"`Py_XDECREF` 或 :c:func:`Py_DECREF`)!" #: ../../extending/extending.rst:196 msgid "" @@ -397,20 +395,19 @@ msgid "" "predeclared C objects corresponding to all built-in Python exceptions, such " "as :c:data:`PyExc_ZeroDivisionError`, which you can use directly. Of course, " "you should choose exceptions wisely --- don't use :c:data:`PyExc_TypeError` " -"to mean that a file couldn't be opened (that should probably " -"be :c:data:`PyExc_OSError`). If something's wrong with the argument list, " -"the :c:func:`PyArg_ParseTuple` function usually " -"raises :c:data:`PyExc_TypeError`. If you have an argument whose value must " -"be in a particular range or must satisfy other " -"conditions, :c:data:`PyExc_ValueError` is appropriate." +"to mean that a file couldn't be opened (that should probably be :c:data:" +"`PyExc_OSError`). If something's wrong with the argument list, the :c:func:" +"`PyArg_ParseTuple` function usually raises :c:data:`PyExc_TypeError`. If " +"you have an argument whose value must be in a particular range or must " +"satisfy other conditions, :c:data:`PyExc_ValueError` is appropriate." msgstr "" "你完全可以自行選擇要產生的例外。有一些預先宣告的 C 物件會對應到所有內建的 " "Python 例外,例如 :c:data:`PyExc_ZeroDivisionError`,你可以直接使用它們。當" "然,你應該明智地選擇例外,像是不要使用 :c:data:`PyExc_TypeError` 來表示檔案無" -"法打開(應該是 :c:data:`PyExc_OSError`)。如果引數串列有問" -"題,:c:func:`PyArg_ParseTuple` 函式通常會引發 :c:data:`PyExc_TypeError`。如果" -"你有一個引數的值必須在一個特定的範圍內或必須滿足其他條件,則可以使" -"用 :c:data:`PyExc_ValueError`。" +"法打開(應該是 :c:data:`PyExc_OSError`)。如果引數串列有問題,:c:func:" +"`PyArg_ParseTuple` 函式通常會引發 :c:data:`PyExc_TypeError`。如果你有一個引數" +"的值必須在一個特定的範圍內或必須滿足其他條件,則可以使用 :c:data:" +"`PyExc_ValueError`。" #: ../../extending/extending.rst:206 msgid "" @@ -427,8 +424,8 @@ msgstr "static PyObject *SpamError = NULL;" #: ../../extending/extending.rst:212 msgid "" -"and initialize it by calling :c:func:`PyErr_NewException` in the " -"module's :c:data:`Py_mod_exec` function (:c:func:`!spam_module_exec`)::" +"and initialize it by calling :c:func:`PyErr_NewException` in the module's :c:" +"data:`Py_mod_exec` function (:c:func:`!spam_module_exec`)::" msgstr "" #: ../../extending/extending.rst:215 @@ -437,9 +434,9 @@ msgstr "" #: ../../extending/extending.rst:217 msgid "" -"Since :c:data:`!SpamError` is a global variable, it will be overwitten every " -"time the module is reinitialized, when the :c:data:`Py_mod_exec` function is " -"called." +"Since :c:data:`!SpamError` is a global variable, it will be overwritten " +"every time the module is reinitialized, when the :c:data:`Py_mod_exec` " +"function is called." msgstr "" #: ../../extending/extending.rst:220 @@ -609,8 +606,8 @@ msgid "" "The next statement is a call to the Unix function :c:func:`system`, passing " "it the string we just got from :c:func:`PyArg_ParseTuple`::" msgstr "" -"接下來的陳述式會呼叫 Unix 函式 :c:func:`system`,並將剛才" -"從 :c:func:`PyArg_ParseTuple` 得到的字串傳給它:" +"接下來的陳述式會呼叫 Unix 函式 :c:func:`system`,並將剛才從 :c:func:" +"`PyArg_ParseTuple` 得到的字串傳給它:" #: ../../extending/extending.rst:321 msgid "sts = system(command);" @@ -619,8 +616,8 @@ msgstr "sts = system(command);" #: ../../extending/extending.rst:323 msgid "" "Our :func:`!spam.system` function must return the value of :c:data:`!sts` as " -"a Python object. This is done using the " -"function :c:func:`PyLong_FromLong`. ::" +"a Python object. This is done using the function :c:func:" +"`PyLong_FromLong`. ::" msgstr "" "我們的 :func:`!spam.system` 函式必須以 Python 物件的形式來回傳 :c:data:`!" "sts` 的值。這是透過 :c:func:`PyLong_FromLong` 函式來達成。 ::" @@ -641,12 +638,12 @@ msgstr "" msgid "" "If you have a C function that returns no useful argument (a function " "returning :c:expr:`void`), the corresponding Python function must return " -"``None``. You need this idiom to do so (which is implemented by " -"the :c:macro:`Py_RETURN_NONE` macro)::" +"``None``. You need this idiom to do so (which is implemented by the :c:" +"macro:`Py_RETURN_NONE` macro)::" msgstr "" "如果你有一個不回傳任何有用引數的 C 函式(一個回傳 :c:expr:`void` 的函式),對" -"應的 Python 函式必須回傳 ``None``。你需要以下這個慣例來達成" -"(由 :c:macro:`Py_RETURN_NONE` 巨集實作): ::" +"應的 Python 函式必須回傳 ``None``。你需要以下這個慣例來達成(由 :c:macro:" +"`Py_RETURN_NONE` 巨集實作): ::" #: ../../extending/extending.rst:336 msgid "" @@ -711,9 +708,8 @@ msgstr "" #: ../../extending/extending.rst:365 msgid "" "When using only ``METH_VARARGS``, the function should expect the Python-" -"level parameters to be passed in as a tuple acceptable for parsing " -"via :c:func:`PyArg_ParseTuple`; more information on this function is " -"provided below." +"level parameters to be passed in as a tuple acceptable for parsing via :c:" +"func:`PyArg_ParseTuple`; more information on this function is provided below." msgstr "" "當只使用 ``METH_VARARGS`` 時,函式應預期 Python 層級的參數是以元組形式傳入且" "能夠接受以 :c:func:`PyArg_ParseTuple` 進行剖析;有關此函式的更多資訊將在下面" @@ -749,9 +745,9 @@ msgstr "" #: ../../extending/extending.rst:383 msgid "" "This structure, in turn, must be passed to the interpreter in the module's " -"initialization function. The initialization function must be " -"named :c:func:`!PyInit_name`, where *name* is the name of the module, and " -"should be the only non-\\ ``static`` item defined in the module file::" +"initialization function. The initialization function must be named :c:func:" +"`!PyInit_name`, where *name* is the name of the module, and should be the " +"only non-\\ ``static`` item defined in the module file::" msgstr "" "反過來說,這個結構必須在模組的初始化函式中被傳給直譯器。初始化函式必須被命名" "為 :c:func:`!PyInit_name`,其中 *name* 是模組的名稱,且應該是模組檔案中唯一定" @@ -782,24 +778,23 @@ msgstr "" #: ../../extending/extending.rst:398 msgid "" -":c:func:`!PyInit_spam` is called when each interpreter imports its " -"module :mod:`!spam` for the first time. (See below for comments about " -"embedding Python.) A pointer to the module definition must be returned " -"via :c:func:`PyModuleDef_Init`, so that the import machinery can create the " -"module and store it in ``sys.modules``." +":c:func:`!PyInit_spam` is called when each interpreter imports its module :" +"mod:`!spam` for the first time. (See below for comments about embedding " +"Python.) A pointer to the module definition must be returned via :c:func:" +"`PyModuleDef_Init`, so that the import machinery can create the module and " +"store it in ``sys.modules``." msgstr "" #: ../../extending/extending.rst:403 msgid "" "When embedding Python, the :c:func:`!PyInit_spam` function is not called " "automatically unless there's an entry in the :c:data:`!PyImport_Inittab` " -"table. To add the module to the initialization table, " -"use :c:func:`PyImport_AppendInittab`, optionally followed by an import of " -"the module::" +"table. To add the module to the initialization table, use :c:func:" +"`PyImport_AppendInittab`, optionally followed by an import of the module::" msgstr "" "嵌入 Python 時,除非在 :c:data:`!PyImport_Inittab` 表中有相關條目,否則不會自" -"動呼叫 :c:func:`!PyInit_spam` 函式。要將模組加入初始化表,請使" -"用 :c:func:`PyImport_AppendInittab` 並在隨後選擇性地將該模組引入: ::" +"動呼叫 :c:func:`!PyInit_spam` 函式。要將模組加入初始化表,請使用 :c:func:" +"`PyImport_AppendInittab` 並在隨後選擇性地將該模組引入: ::" #: ../../extending/extending.rst:408 msgid "" @@ -909,10 +904,10 @@ msgid "" "experience unintended side-effects on re-initialisation, for example when " "removing entries from ``sys.modules`` or importing compiled modules into " "multiple interpreters within a process (or following a :c:func:`fork` " -"without an intervening :c:func:`exec`). If module state is not yet " -"fully :ref:`isolated `, authors should consider " -"marking the module as having no support for subinterpreters " -"(via :c:macro:`Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED`)." +"without an intervening :c:func:`exec`). If module state is not yet fully :" +"ref:`isolated `, authors should consider marking " +"the module as having no support for subinterpreters (via :c:macro:" +"`Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED`)." msgstr "" #: ../../extending/extending.rst:467 @@ -921,8 +916,8 @@ msgid "" "distribution as :file:`Modules/xxlimited.c`. This file may be used as a " "template or simply read as an example." msgstr "" -"Python 原始碼發行版本中包含了一個更實質的範例模組 :file:`Modules/" -"xxlimited.c`。這個檔案可以當作模板使用,也可以簡單地當作範例來閱讀。" +"Python 原始碼發行版本中包含了一個更實質的範例模組 :file:`Modules/xxlimited." +"c`。這個檔案可以當作模板使用,也可以簡單地當作範例來閱讀。" #: ../../extending/extending.rst:475 msgid "Compilation and Linkage" @@ -933,10 +928,9 @@ msgid "" "There are two more things to do before you can use your new extension: " "compiling and linking it with the Python system. If you use dynamic " "loading, the details may depend on the style of dynamic loading your system " -"uses; see the chapters about building extension modules " -"(chapter :ref:`building`) and additional information that pertains only to " -"building on Windows (chapter :ref:`building-on-windows`) for more " -"information about this." +"uses; see the chapters about building extension modules (chapter :ref:" +"`building`) and additional information that pertains only to building on " +"Windows (chapter :ref:`building-on-windows`) for more information about this." msgstr "" #: ../../extending/extending.rst:484 @@ -1035,10 +1029,10 @@ msgstr "" #: ../../extending/extending.rst:558 msgid "" -"This function must be registered with the interpreter using " -"the :c:macro:`METH_VARARGS` flag; this is described in " -"section :ref:`methodtable`. The :c:func:`PyArg_ParseTuple` function and its " -"arguments are documented in section :ref:`parsetuple`." +"This function must be registered with the interpreter using the :c:macro:" +"`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The :" +"c:func:`PyArg_ParseTuple` function and its arguments are documented in " +"section :ref:`parsetuple`." msgstr "" #: ../../extending/extending.rst:563 @@ -1051,15 +1045,14 @@ msgstr "" #: ../../extending/extending.rst:570 msgid "" -"Later, when it is time to call the function, you call the C " -"function :c:func:`PyObject_CallObject`. This function has two arguments, " -"both pointers to arbitrary Python objects: the Python function, and the " -"argument list. The argument list must always be a tuple object, whose " -"length is the number of arguments. To call the Python function with no " -"arguments, pass in ``NULL``, or an empty tuple; to call it with one " -"argument, pass a singleton tuple. :c:func:`Py_BuildValue` returns a tuple " -"when its format string consists of zero or more format codes between " -"parentheses. For example::" +"Later, when it is time to call the function, you call the C function :c:func:" +"`PyObject_CallObject`. This function has two arguments, both pointers to " +"arbitrary Python objects: the Python function, and the argument list. The " +"argument list must always be a tuple object, whose length is the number of " +"arguments. To call the Python function with no arguments, pass in ``NULL``, " +"or an empty tuple; to call it with one argument, pass a singleton tuple. :c:" +"func:`Py_BuildValue` returns a tuple when its format string consists of zero " +"or more format codes between parentheses. For example::" msgstr "" #: ../../extending/extending.rst:579 @@ -1081,9 +1074,8 @@ msgid "" ":c:func:`PyObject_CallObject` returns a Python object pointer: this is the " "return value of the Python function. :c:func:`PyObject_CallObject` is " "\"reference-count-neutral\" with respect to its arguments. In the example a " -"new tuple was created to serve as the argument list, which " -"is :c:func:`Py_DECREF`\\ -ed immediately after " -"the :c:func:`PyObject_CallObject` call." +"new tuple was created to serve as the argument list, which is :c:func:" +"`Py_DECREF`\\ -ed immediately after the :c:func:`PyObject_CallObject` call." msgstr "" #: ../../extending/extending.rst:597 @@ -1149,10 +1141,9 @@ msgstr "" #: ../../extending/extending.rst:639 msgid "" -"You may also call a function with keyword arguments by " -"using :c:func:`PyObject_Call`, which supports arguments and keyword " -"arguments. As in the above example, we use :c:func:`Py_BuildValue` to " -"construct the dictionary. ::" +"You may also call a function with keyword arguments by using :c:func:" +"`PyObject_Call`, which supports arguments and keyword arguments. As in the " +"above example, we use :c:func:`Py_BuildValue` to construct the dictionary. ::" msgstr "" #: ../../extending/extending.rst:643 @@ -1305,21 +1296,21 @@ msgstr "" #: ../../extending/extending.rst:758 msgid "" -"The *arg* and *format* parameters are identical to those of " -"the :c:func:`PyArg_ParseTuple` function. The *kwdict* parameter is the " -"dictionary of keywords received as the third parameter from the Python " -"runtime. The *kwlist* parameter is a ``NULL``-terminated list of strings " -"which identify the parameters; the names are matched with the type " -"information from *format* from left to right. On " -"success, :c:func:`PyArg_ParseTupleAndKeywords` returns true, otherwise it " -"returns false and raises an appropriate exception." +"The *arg* and *format* parameters are identical to those of the :c:func:" +"`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of " +"keywords received as the third parameter from the Python runtime. The " +"*kwlist* parameter is a ``NULL``-terminated list of strings which identify " +"the parameters; the names are matched with the type information from " +"*format* from left to right. On success, :c:func:" +"`PyArg_ParseTupleAndKeywords` returns true, otherwise it returns false and " +"raises an appropriate exception." msgstr "" #: ../../extending/extending.rst:768 msgid "" "Nested tuples cannot be parsed when using keyword arguments! Keyword " -"parameters passed in which are not present in the *kwlist* will " -"cause :exc:`TypeError` to be raised." +"parameters passed in which are not present in the *kwlist* will cause :exc:" +"`TypeError` to be raised." msgstr "" #: ../../extending/extending.rst:774 @@ -1397,10 +1388,10 @@ msgstr "PyObject *Py_BuildValue(const char *format, ...);" #: ../../extending/extending.rst:835 msgid "" -"It recognizes a set of format units similar to the ones recognized " -"by :c:func:`PyArg_ParseTuple`, but the arguments (which are input to the " -"function, not output) must not be pointers, just values. It returns a new " -"Python object, suitable for returning from a C function called from Python." +"It recognizes a set of format units similar to the ones recognized by :c:" +"func:`PyArg_ParseTuple`, but the arguments (which are input to the function, " +"not output) must not be pointers, just values. It returns a new Python " +"object, suitable for returning from a C function called from Python." msgstr "" #: ../../extending/extending.rst:840 @@ -1474,16 +1465,16 @@ msgstr "" #: ../../extending/extending.rst:882 msgid "" "Every block of memory allocated with :c:func:`malloc` should eventually be " -"returned to the pool of available memory by exactly one call " -"to :c:func:`free`. It is important to call :c:func:`free` at the right " -"time. If a block's address is forgotten but :c:func:`free` is not called " -"for it, the memory it occupies cannot be reused until the program " -"terminates. This is called a :dfn:`memory leak`. On the other hand, if a " -"program calls :c:func:`free` for a block and then continues to use the " -"block, it creates a conflict with reuse of the block through " -"another :c:func:`malloc` call. This is called :dfn:`using freed memory`. It " -"has the same bad consequences as referencing uninitialized data --- core " -"dumps, wrong results, mysterious crashes." +"returned to the pool of available memory by exactly one call to :c:func:" +"`free`. It is important to call :c:func:`free` at the right time. If a " +"block's address is forgotten but :c:func:`free` is not called for it, the " +"memory it occupies cannot be reused until the program terminates. This is " +"called a :dfn:`memory leak`. On the other hand, if a program calls :c:func:" +"`free` for a block and then continues to use the block, it creates a " +"conflict with reuse of the block through another :c:func:`malloc` call. " +"This is called :dfn:`using freed memory`. It has the same bad consequences " +"as referencing uninitialized data --- core dumps, wrong results, mysterious " +"crashes." msgstr "" #: ../../extending/extending.rst:893 @@ -1547,9 +1538,9 @@ msgstr "" #: ../../extending/extending.rst:937 msgid "" "The cycle detector is able to detect garbage cycles and can reclaim them. " -"The :mod:`gc` module exposes a way to run the detector " -"(the :func:`~gc.collect` function), as well as configuration interfaces and " -"the ability to disable the detector at runtime." +"The :mod:`gc` module exposes a way to run the detector (the :func:`~gc." +"collect` function), as well as configuration interfaces and the ability to " +"disable the detector at runtime." msgstr "" #: ../../extending/extending.rst:946 @@ -1559,12 +1550,12 @@ msgstr "Python 中的參照計數" #: ../../extending/extending.rst:948 msgid "" "There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle " -"the incrementing and decrementing of the reference " -"count. :c:func:`Py_DECREF` also frees the object when the count reaches " -"zero. For flexibility, it doesn't call :c:func:`free` directly --- rather, " -"it makes a call through a function pointer in the object's :dfn:`type " -"object`. For this purpose (and others), every object also contains a " -"pointer to its type object." +"the incrementing and decrementing of the reference count. :c:func:" +"`Py_DECREF` also frees the object when the count reaches zero. For " +"flexibility, it doesn't call :c:func:`free` directly --- rather, it makes a " +"call through a function pointer in the object's :dfn:`type object`. For " +"this purpose (and others), every object also contains a pointer to its type " +"object." msgstr "" #: ../../extending/extending.rst:955 @@ -1602,11 +1593,11 @@ msgstr "" #: ../../extending/extending.rst:978 msgid "" -"A borrowed reference can be changed into an owned reference by " -"calling :c:func:`Py_INCREF`. This does not affect the status of the owner " -"from which the reference was borrowed --- it creates a new owned reference, " -"and gives full owner responsibilities (the new owner must dispose of the " -"reference properly, as well as the previous owner)." +"A borrowed reference can be changed into an owned reference by calling :c:" +"func:`Py_INCREF`. This does not affect the status of the owner from which " +"the reference was borrowed --- it creates a new owned reference, and gives " +"full owner responsibilities (the new owner must dispose of the reference " +"properly, as well as the previous owner)." msgstr "" #: ../../extending/extending.rst:988 @@ -1626,20 +1617,20 @@ msgid "" "the reference. In particular, all functions whose function it is to create " "a new object, such as :c:func:`PyLong_FromLong` and :c:func:`Py_BuildValue`, " "pass ownership to the receiver. Even if the object is not actually new, you " -"still receive ownership of a new reference to that object. For " -"instance, :c:func:`PyLong_FromLong` maintains a cache of popular values and " -"can return a reference to a cached item." +"still receive ownership of a new reference to that object. For instance, :c:" +"func:`PyLong_FromLong` maintains a cache of popular values and can return a " +"reference to a cached item." msgstr "" #: ../../extending/extending.rst:1002 msgid "" "Many functions that extract objects from other objects also transfer " -"ownership with the reference, for " -"instance :c:func:`PyObject_GetAttrString`. The picture is less clear, here, " -"however, since a few common routines are " -"exceptions: :c:func:`PyTuple_GetItem`, :c:func:`PyList_GetItem`, :c:func:`PyDict_GetItem`, " -"and :c:func:`PyDict_GetItemString` all return references that you borrow " -"from the tuple, list or dictionary." +"ownership with the reference, for instance :c:func:" +"`PyObject_GetAttrString`. The picture is less clear, here, however, since a " +"few common routines are exceptions: :c:func:`PyTuple_GetItem`, :c:func:" +"`PyList_GetItem`, :c:func:`PyDict_GetItem`, and :c:func:" +"`PyDict_GetItemString` all return references that you borrow from the tuple, " +"list or dictionary." msgstr "" #: ../../extending/extending.rst:1009 @@ -1654,11 +1645,10 @@ msgid "" "When you pass an object reference into another function, in general, the " "function borrows the reference from you --- if it needs to store it, it will " "use :c:func:`Py_INCREF` to become an independent owner. There are exactly " -"two important exceptions to this rule: :c:func:`PyTuple_SetItem` " -"and :c:func:`PyList_SetItem`. These functions take over ownership of the " -"item passed to them --- even if they fail! (Note " -"that :c:func:`PyDict_SetItem` and friends don't take over ownership --- they " -"are \"normal.\")" +"two important exceptions to this rule: :c:func:`PyTuple_SetItem` and :c:func:" +"`PyList_SetItem`. These functions take over ownership of the item passed to " +"them --- even if they fail! (Note that :c:func:`PyDict_SetItem` and friends " +"don't take over ownership --- they are \"normal.\")" msgstr "" #: ../../extending/extending.rst:1021 @@ -1732,12 +1722,12 @@ msgid "" "defined a :meth:`!__del__` method. If this class instance has a reference " "count of 1, disposing of it will call its :meth:`!__del__` method. " "Internally, :c:func:`PyList_SetItem` calls :c:func:`Py_DECREF` on the " -"replaced item, which invokes replaced item's " -"corresponding :c:member:`~PyTypeObject.tp_dealloc` function. During " -"deallocation, :c:member:`~PyTypeObject.tp_dealloc` " -"calls :c:member:`~PyTypeObject.tp_finalize`, which is mapped to the :meth:`!" -"__del__` method for class instances (see :pep:`442`). This entire sequence " -"happens synchronously within the :c:func:`PyList_SetItem` call." +"replaced item, which invokes replaced item's corresponding :c:member:" +"`~PyTypeObject.tp_dealloc` function. During deallocation, :c:member:" +"`~PyTypeObject.tp_dealloc` calls :c:member:`~PyTypeObject.tp_finalize`, " +"which is mapped to the :meth:`!__del__` method for class instances (see :pep:" +"`442`). This entire sequence happens synchronously within the :c:func:" +"`PyList_SetItem` call." msgstr "" #: ../../extending/extending.rst:1071 @@ -1794,12 +1784,11 @@ msgid "" "threads. Normally, multiple threads in the Python interpreter can't get in " "each other's way, because there is a :term:`global lock ` protecting Python's entire object space. However, it is possible to " -"temporarily release this lock using the " -"macro :c:macro:`Py_BEGIN_ALLOW_THREADS`, and to re-acquire it " -"using :c:macro:`Py_END_ALLOW_THREADS`. This is common around blocking I/O " -"calls, to let other threads use the processor while waiting for the I/O to " -"complete. Obviously, the following function has the same problem as the " -"previous one::" +"temporarily release this lock using the macro :c:macro:" +"`Py_BEGIN_ALLOW_THREADS`, and to re-acquire it using :c:macro:" +"`Py_END_ALLOW_THREADS`. This is common around blocking I/O calls, to let " +"other threads use the processor while waiting for the I/O to complete. " +"Obviously, the following function has the same problem as the previous one::" msgstr "" #: ../../extending/extending.rst:1107 @@ -1841,8 +1830,8 @@ msgstr "" #: ../../extending/extending.rst:1135 msgid "" "The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " -"``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` " -"and :c:func:`Py_XDECREF` do." +"``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and :c:" +"func:`Py_XDECREF` do." msgstr "" #: ../../extending/extending.rst:1139 @@ -2070,9 +2059,9 @@ msgstr "" #: ../../extending/extending.rst:1286 msgid "" "The ``#define`` is used to tell the header file that it is being included in " -"the exporting module, not a client module. Finally, the " -"module's :c:data:`mod_exec ` function must take care of " -"initializing the C API pointer array::" +"the exporting module, not a client module. Finally, the module's :c:data:" +"`mod_exec ` function must take care of initializing the C API " +"pointer array::" msgstr "" #: ../../extending/extending.rst:1290 @@ -2164,10 +2153,9 @@ msgstr "" #: ../../extending/extending.rst:1363 msgid "" -"All that a client module must do in order to have access to the " -"function :c:func:`!PySpam_System` is to call the function (or rather " -"macro) :c:func:`!import_spam` in its :c:data:`mod_exec ` " -"function::" +"All that a client module must do in order to have access to the function :c:" +"func:`!PySpam_System` is to call the function (or rather macro) :c:func:`!" +"import_spam` in its :c:data:`mod_exec ` function::" msgstr "" #: ../../extending/extending.rst:1367 @@ -2206,8 +2194,8 @@ msgstr "註腳" #: ../../extending/extending.rst:1390 msgid "" -"An interface for this function already exists in the standard " -"module :mod:`os` --- it was chosen as a simple and straightforward example." +"An interface for this function already exists in the standard module :mod:" +"`os` --- it was chosen as a simple and straightforward example." msgstr "" #: ../../extending/extending.rst:1393 diff --git a/glossary.po b/glossary.po index 72d8b77df6e..9bb349a099a 100644 --- a/glossary.po +++ b/glossary.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -54,56 +54,56 @@ msgstr "" "號、花括號或三引號)內部,或是在指定一個裝飾器 (decorator) 之後,要輸入程式碼" "時,:term:`互動式 ` shell 顯示的預設 Python 提示字元。" -#: ../../glossary.rst:24 -msgid "The :const:`Ellipsis` built-in constant." -msgstr "內建常數 :const:`Ellipsis`。" +#: ../../glossary.rst:26 +msgid "" +"The three dots form of the :ref:`Ellipsis ` object." +msgstr "" -#: ../../glossary.rst:25 +#: ../../glossary.rst:27 msgid "abstract base class" msgstr "abstract base class(抽象基底類別)" -#: ../../glossary.rst:27 +#: ../../glossary.rst:29 msgid "" "Abstract base classes complement :term:`duck-typing` by providing a way to " "define interfaces when other techniques like :func:`hasattr` would be clumsy " "or subtly wrong (for example with :ref:`magic methods `). " "ABCs introduce virtual subclasses, which are classes that don't inherit from " -"a class but are still recognized by :func:`isinstance` " -"and :func:`issubclass`; see the :mod:`abc` module documentation. Python " -"comes with many built-in ABCs for data structures (in " -"the :mod:`collections.abc` module), numbers (in the :mod:`numbers` module), " -"streams (in the :mod:`io` module), import finders and loaders (in " -"the :mod:`importlib.abc` module). You can create your own ABCs with " -"the :mod:`abc` module." +"a class but are still recognized by :func:`isinstance` and :func:" +"`issubclass`; see the :mod:`abc` module documentation. Python comes with " +"many built-in ABCs for data structures (in the :mod:`collections.abc` " +"module), numbers (in the :mod:`numbers` module), streams (in the :mod:`io` " +"module), import finders and loaders (in the :mod:`importlib.abc` module). " +"You can create your own ABCs with the :mod:`abc` module." msgstr "" "抽象基底類別(又稱為 ABC)提供了一種定義介面的方法,作為 :term:`duck-" "typing`\\ (鴨子型別)的補充。其他類似的技術,像是 :func:`hasattr`,則顯得笨" "拙或是帶有細微的錯誤(例如使用\\ :ref:`魔術方法 (magic method) `\\ )。ABC 採用虛擬的 subclass(子類別),它們並不繼承自另一個 class" -"(類別),但仍可被 :func:`isinstance` 及 :func:`issubclass` 辨識;請參" -"閱 :mod:`abc` 模組的說明文件。Python 有許多內建的 ABC,用於資料結構" -"(在 :mod:`collections.abc` 模組)、數字(在 :mod:`numbers` 模組)、串流" -"(在 :mod:`io` 模組)及 import 尋檢器和載入器(在 :mod:`importlib.abc` 模" -"組)。你可以使用 :mod:`abc` 模組建立自己的 ABC。" +"(類別),但仍可被 :func:`isinstance` 及 :func:`issubclass` 辨識;請參閱 :" +"mod:`abc` 模組的說明文件。Python 有許多內建的 ABC,用於資料結構(在 :mod:" +"`collections.abc` 模組)、數字(在 :mod:`numbers` 模組)、串流(在 :mod:`io` " +"模組)及 import 尋檢器和載入器(在 :mod:`importlib.abc` 模組)。你可以使用 :" +"mod:`abc` 模組建立自己的 ABC。" -#: ../../glossary.rst:38 +#: ../../glossary.rst:40 msgid "annotate function" msgstr "annotate function(註釋函式)" -#: ../../glossary.rst:40 +#: ../../glossary.rst:42 msgid "" "A function that can be called to retrieve the :term:`annotations " -"` of an object. This function is accessible as " -"the :attr:`~object.__annotate__` attribute of functions, classes, and " -"modules. Annotate functions are a subset of :term:`evaluate functions " -"`." +"` of an object. This function is accessible as the :attr:" +"`~object.__annotate__` attribute of functions, classes, and modules. " +"Annotate functions are a subset of :term:`evaluate functions `." msgstr "" -#: ../../glossary.rst:44 +#: ../../glossary.rst:46 msgid "annotation" msgstr "annotation(註釋)" -#: ../../glossary.rst:46 +#: ../../glossary.rst:48 msgid "" "A label associated with a variable, a class attribute or a function " "parameter or return value, used by convention as a :term:`type hint`." @@ -111,32 +111,31 @@ msgstr "" "一個與變數、class 屬性、函式的參數或回傳值相關聯的標籤。照慣例,它被用來作" "為 :term:`type hint`\\ (型別提示)。" -#: ../../glossary.rst:50 +#: ../../glossary.rst:52 msgid "" "Annotations of local variables cannot be accessed at runtime, but " "annotations of global variables, class attributes, and functions can be " "retrieved by calling :func:`annotationlib.get_annotations` on modules, " "classes, and functions, respectively." msgstr "" -"在 runtime 的區域變數註釋無法被存取,但全域變數、類別屬性和函式" -"的註釋,分別能夠以對模組、類別和函式呼叫 :func:`annotationlib.get_annotations` 來取得。" +"在 runtime 的區域變數註釋無法被存取,但全域變數、類別屬性和函式的註釋,分別能" +"夠以對模組、類別和函式呼叫 :func:`annotationlib.get_annotations` 來取得。" -#: ../../glossary.rst:55 +#: ../../glossary.rst:57 msgid "" -"See :term:`variable annotation`, :term:`function " -"annotation`, :pep:`484`, :pep:`526`, and :pep:`649`, which describe this " -"functionality. Also see :ref:`annotations-howto` for best practices on " -"working with annotations." +"See :term:`variable annotation`, :term:`function annotation`, :pep:`484`, :" +"pep:`526`, and :pep:`649`, which describe this functionality. Also see :ref:" +"`annotations-howto` for best practices on working with annotations." msgstr "" -"請參閱 :term:`variable annotation`、:term:`function annotation`、:pep:`484`" -"、:pep:`526` 和 :pep:`649`,這些章節皆有此功能的說明。關於註釋的最佳實踐方法也請參" -"閱 :ref:`annotations-howto`。" +"請參閱 :term:`variable annotation`、:term:`function annotation`、:pep:" +"`484`、:pep:`526` 和 :pep:`649`,這些章節皆有此功能的說明。關於註釋的最佳實踐" +"方法也請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:59 +#: ../../glossary.rst:61 msgid "argument" msgstr "argument(引數)" -#: ../../glossary.rst:61 +#: ../../glossary.rst:63 msgid "" "A value passed to a :term:`function` (or :term:`method`) when calling the " "function. There are two kinds of argument:" @@ -144,7 +143,7 @@ msgstr "" "呼叫函式時被傳遞給 :term:`function`\\ (或 :term:`method`\\ )的值。引數有兩" "種:" -#: ../../glossary.rst:64 +#: ../../glossary.rst:66 msgid "" ":dfn:`keyword argument`: an argument preceded by an identifier (e.g. " "``name=``) in a function call or passed as a value in a dictionary preceded " @@ -156,7 +155,7 @@ msgstr "" "遞的引數。例如,``3`` 和 ``5`` 都是以下 :func:`complex` 呼叫中的關鍵字引" "數: ::" -#: ../../glossary.rst:69 +#: ../../glossary.rst:71 msgid "" "complex(real=3, imag=5)\n" "complex(**{'real': 3, 'imag': 5})" @@ -164,7 +163,7 @@ msgstr "" "complex(real=3, imag=5)\n" "complex(**{'real': 3, 'imag': 5})" -#: ../../glossary.rst:72 +#: ../../glossary.rst:74 msgid "" ":dfn:`positional argument`: an argument that is not a keyword argument. " "Positional arguments can appear at the beginning of an argument list and/or " @@ -175,7 +174,7 @@ msgstr "" "引數列表的起始處出現,和(或)作為 ``*`` 之後的 :term:`iterable`\\ (可疊代物" "件)中的元素被傳遞。例如,``3`` 和 ``5`` 都是以下呼叫中的位置引數: ::" -#: ../../glossary.rst:78 +#: ../../glossary.rst:80 msgid "" "complex(3, 5)\n" "complex(*(3, 5))" @@ -183,7 +182,7 @@ msgstr "" "complex(3, 5)\n" "complex(*(3, 5))" -#: ../../glossary.rst:81 +#: ../../glossary.rst:83 msgid "" "Arguments are assigned to the named local variables in a function body. See " "the :ref:`calls` section for the rules governing this assignment. " @@ -194,7 +193,7 @@ msgstr "" "\\ :ref:`calls`\\ 章節。在語法上,任何運算式都可以被用來表示一個引數;其評估" "值會被指定給區域變數。" -#: ../../glossary.rst:86 +#: ../../glossary.rst:88 msgid "" "See also the :term:`parameter` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " @@ -203,25 +202,25 @@ msgstr "" "另請參閱術語表的 :term:`parameter`\\ (參數)條目、常見問題中的\\ :ref:`引數" "和參數之間的差異 `,以及 :pep:`362`。" -#: ../../glossary.rst:89 +#: ../../glossary.rst:91 msgid "asynchronous context manager" msgstr "asynchronous context manager(非同步情境管理器)" -#: ../../glossary.rst:91 +#: ../../glossary.rst:93 msgid "" "An object which controls the environment seen in an :keyword:`async with` " -"statement by defining :meth:`~object.__aenter__` " -"and :meth:`~object.__aexit__` methods. Introduced by :pep:`492`." +"statement by defining :meth:`~object.__aenter__` and :meth:`~object." +"__aexit__` methods. Introduced by :pep:`492`." msgstr "" -"一個可以控制 :keyword:`async with` 陳述式中所見環境的物件,而它是透過定" -"義 :meth:`~object.__aenter__` 和 :meth:`~object.__aexit__` method(方法)來控" -"制的。由 :pep:`492` 引入。" +"一個可以控制 :keyword:`async with` 陳述式中所見環境的物件,而它是透過定義 :" +"meth:`~object.__aenter__` 和 :meth:`~object.__aexit__` method(方法)來控制" +"的。由 :pep:`492` 引入。" -#: ../../glossary.rst:94 +#: ../../glossary.rst:96 msgid "asynchronous generator" msgstr "asynchronous generator(非同步產生器)" -#: ../../glossary.rst:96 +#: ../../glossary.rst:98 msgid "" "A function which returns an :term:`asynchronous generator iterator`. It " "looks like a coroutine function defined with :keyword:`async def` except " @@ -230,10 +229,10 @@ msgid "" msgstr "" "一個會回傳 :term:`asynchronous generator iterator`\\ (非同步產生器疊代器)的" "函式。它看起來像一個以 :keyword:`async def` 定義的協程函式 (coroutine " -"function),但不同的是它包含了 :keyword:`yield` 運算式,能生成一系列可用" -"於 :keyword:`async for` 迴圈的值。" +"function),但不同的是它包含了 :keyword:`yield` 運算式,能生成一系列可用於 :" +"keyword:`async for` 迴圈的值。" -#: ../../glossary.rst:101 +#: ../../glossary.rst:103 msgid "" "Usually refers to an asynchronous generator function, but may refer to an " "*asynchronous generator iterator* in some contexts. In cases where the " @@ -243,7 +242,7 @@ msgstr "" "同步產生器疊代器 (asynchronous generator iterator)*。萬一想表達的意思不夠清" "楚,那就使用完整的術語,以避免歧義。" -#: ../../glossary.rst:105 +#: ../../glossary.rst:107 msgid "" "An asynchronous generator function may contain :keyword:`await` expressions " "as well as :keyword:`async for`, and :keyword:`async with` statements." @@ -251,28 +250,28 @@ msgstr "" "一個非同步產生器函式可能包含 :keyword:`await` 運算式,以及 :keyword:`async " "for` 和 :keyword:`async with` 陳述式。" -#: ../../glossary.rst:108 +#: ../../glossary.rst:110 msgid "asynchronous generator iterator" msgstr "asynchronous generator iterator(非同步產生器疊代器)" -#: ../../glossary.rst:110 +#: ../../glossary.rst:112 msgid "An object created by an :term:`asynchronous generator` function." msgstr "" "一個由 :term:`asynchronous generator`\\ (非同步產生器)函式所建立的物件。" -#: ../../glossary.rst:112 +#: ../../glossary.rst:114 msgid "" -"This is an :term:`asynchronous iterator` which when called using " -"the :meth:`~object.__anext__` method returns an awaitable object which will " -"execute the body of the asynchronous generator function until the " -"next :keyword:`yield` expression." +"This is an :term:`asynchronous iterator` which when called using the :meth:" +"`~object.__anext__` method returns an awaitable object which will execute " +"the body of the asynchronous generator function until the next :keyword:" +"`yield` expression." msgstr "" -"這是一個 :term:`asynchronous iterator`\\ (非同步疊代器),當它" -"以 :meth:`~object.__anext__` method 被呼叫時,會回傳一個可等待物件 " -"(awaitable object),該物件將執行非同步產生器的函式主體,直到遇到下一" -"個 :keyword:`yield` 運算式。" +"這是一個 :term:`asynchronous iterator`\\ (非同步疊代器),當它以 :meth:" +"`~object.__anext__` method 被呼叫時,會回傳一個可等待物件 (awaitable " +"object),該物件將執行非同步產生器的函式主體,直到遇到下一個 :keyword:`yield` " +"運算式。" -#: ../../glossary.rst:117 +#: ../../glossary.rst:119 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "execution state (including local variables and pending try-statements). " @@ -281,58 +280,57 @@ msgid "" "off. See :pep:`492` and :pep:`525`." msgstr "" "每個 :keyword:`yield` 會暫停處理程序,並記住執行狀態(包括區域變數及擱置中的 " -"try 陳述式)。當\\ *非同步產生器疊代器*\\ 以另一個" -"被 :meth:`~object.__anext__` 回傳的可等待物件有效地回復時,它會從停止的地方繼" -"續執行。請參閱 :pep:`492` 和 :pep:`525`。" +"try 陳述式)。當\\ *非同步產生器疊代器*\\ 以另一個被 :meth:`~object." +"__anext__` 回傳的可等待物件有效地回復時,它會從停止的地方繼續執行。請參閱 :" +"pep:`492` 和 :pep:`525`。" -#: ../../glossary.rst:122 +#: ../../glossary.rst:124 msgid "asynchronous iterable" msgstr "asynchronous iterable(非同步可疊代物件)" -#: ../../glossary.rst:124 +#: ../../glossary.rst:126 msgid "" "An object, that can be used in an :keyword:`async for` statement. Must " "return an :term:`asynchronous iterator` from its :meth:`~object.__aiter__` " "method. Introduced by :pep:`492`." msgstr "" -"一個物件,它可以在 :keyword:`async for` 陳述式中被使用。必須從它" -"的 :meth:`~object.__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ " -"(非同步疊代器)。由 :pep:`492` 引入。" +"一個物件,它可以在 :keyword:`async for` 陳述式中被使用。必須從它的 :meth:" +"`~object.__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ (非同步" +"疊代器)。由 :pep:`492` 引入。" -#: ../../glossary.rst:127 +#: ../../glossary.rst:129 msgid "asynchronous iterator" msgstr "asynchronous iterator(非同步疊代器)" -#: ../../glossary.rst:129 +#: ../../glossary.rst:131 msgid "" -"An object that implements the :meth:`~object.__aiter__` " -"and :meth:`~object.__anext__` methods. :meth:`~object.__anext__` must " -"return an :term:`awaitable` object. :keyword:`async for` resolves the " -"awaitables returned by an asynchronous iterator's :meth:`~object.__anext__` " -"method until it raises a :exc:`StopAsyncIteration` exception. Introduced " -"by :pep:`492`." +"An object that implements the :meth:`~object.__aiter__` and :meth:`~object." +"__anext__` methods. :meth:`~object.__anext__` must return an :term:" +"`awaitable` object. :keyword:`async for` resolves the awaitables returned by " +"an asynchronous iterator's :meth:`~object.__anext__` method until it raises " +"a :exc:`StopAsyncIteration` exception. Introduced by :pep:`492`." msgstr "" "一個實作 :meth:`~object.__aiter__` 和 :meth:`~object.__anext__` method 的物" "件。:meth:`~object.__anext__` 必須回傳一個 :term:`awaitable`\\ (可等待物" "件)。:keyword:`async for` 會解析非同步疊代器的 :meth:`~object.__anext__` " -"method 所回傳的可等待物件,直到它引發 :exc:`StopAsyncIteration` 例外。" -"由 :pep:`492` 引入。" +"method 所回傳的可等待物件,直到它引發 :exc:`StopAsyncIteration` 例外。由 :" +"pep:`492` 引入。" -#: ../../glossary.rst:134 +#: ../../glossary.rst:136 msgid "attached thread state" msgstr "" -#: ../../glossary.rst:137 +#: ../../glossary.rst:139 msgid "A :term:`thread state` that is active for the current OS thread." msgstr "" -#: ../../glossary.rst:139 +#: ../../glossary.rst:141 msgid "" "When a :term:`thread state` is attached, the OS thread has access to the " "full Python C API and can safely invoke the bytecode interpreter." msgstr "" -#: ../../glossary.rst:143 +#: ../../glossary.rst:145 msgid "" "Unless a function explicitly notes otherwise, attempting to call the C API " "without an attached thread state will result in a fatal error or undefined " @@ -341,7 +339,7 @@ msgid "" "blocking C calls and by the bytecode interpreter in between calls." msgstr "" -#: ../../glossary.rst:150 +#: ../../glossary.rst:152 msgid "" "On most builds of Python, having an attached thread state implies that the " "caller holds the :term:`GIL` for the current interpreter, so only one OS " @@ -351,11 +349,11 @@ msgid "" "interpreter." msgstr "" -#: ../../glossary.rst:156 +#: ../../glossary.rst:158 msgid "attribute" msgstr "attribute(屬性)" -#: ../../glossary.rst:158 +#: ../../glossary.rst:160 msgid "" "A value associated with an object which is usually referenced by name using " "dotted expressions. For example, if an object *o* has an attribute *a* it " @@ -364,75 +362,75 @@ msgstr "" "一個與某物件相關聯的值,該值大多能透過使用點分隔運算式 (dotted expression) 的" "名稱被參照。例如,如果物件 *o* 有一個屬性 *a*,則該屬性能以 *o.a* 被參照。" -#: ../../glossary.rst:163 +#: ../../glossary.rst:165 msgid "" "It is possible to give an object an attribute whose name is not an " -"identifier as defined by :ref:`identifiers`, for example " -"using :func:`setattr`, if the object allows it. Such an attribute will not " -"be accessible using a dotted expression, and would instead need to be " -"retrieved with :func:`getattr`." +"identifier as defined by :ref:`identifiers`, for example using :func:" +"`setattr`, if the object allows it. Such an attribute will not be accessible " +"using a dotted expression, and would instead need to be retrieved with :func:" +"`getattr`." msgstr "" "如果一個物件允許,給予該物件一個名稱不是由\\ :ref:`identifiers`\\ 所定義之識" "別符 (identifier) 的屬性是有可能的,例如使用 :func:`setattr`。像這樣的屬性將" "無法使用點分隔運算式來存取,而是需要使用 :func:`getattr` 來取得它。" -#: ../../glossary.rst:168 +#: ../../glossary.rst:170 msgid "awaitable" msgstr "awaitable(可等待物件)" -#: ../../glossary.rst:170 +#: ../../glossary.rst:172 msgid "" -"An object that can be used in an :keyword:`await` expression. Can be " -"a :term:`coroutine` or an object with an :meth:`~object.__await__` method. " -"See also :pep:`492`." +"An object that can be used in an :keyword:`await` expression. Can be a :" +"term:`coroutine` or an object with an :meth:`~object.__await__` method. See " +"also :pep:`492`." msgstr "" -"一個可以在 :keyword:`await` 運算式中被使用的物件。它可以是一" -"個 :term:`coroutine`\\ (協程),或是一個有 :meth:`~object.__await__` method " -"的物件。另請參閱 :pep:`492`。" +"一個可以在 :keyword:`await` 運算式中被使用的物件。它可以是一個 :term:" +"`coroutine`\\ (協程),或是一個有 :meth:`~object.__await__` method 的物件。" +"另請參閱 :pep:`492`。" -#: ../../glossary.rst:173 +#: ../../glossary.rst:175 msgid "BDFL" msgstr "BDFL" -#: ../../glossary.rst:175 +#: ../../glossary.rst:177 msgid "" -"Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." +"Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." msgstr "" "Benevolent Dictator For Life(終身仁慈獨裁者),又名 `Guido van Rossum " "`_,Python 的創造者。" -#: ../../glossary.rst:177 +#: ../../glossary.rst:179 msgid "binary file" msgstr "binary file(二進位檔案)" -#: ../../glossary.rst:179 +#: ../../glossary.rst:181 msgid "" "A :term:`file object` able to read and write :term:`bytes-like objects " "`. Examples of binary files are files opened in binary " -"mode (``'rb'``, ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer " -"`, :data:`sys.stdout.buffer `, and instances " -"of :class:`io.BytesIO` and :class:`gzip.GzipFile`." +"mode (``'rb'``, ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer `, :data:`sys.stdout.buffer `, and instances of :class:`io." +"BytesIO` and :class:`gzip.GzipFile`." msgstr "" "一個能夠讀取和寫入 :term:`bytes-like objects `\\ (類位元" "組串物件)的 :term:`file object`\\ (檔案物件)。二進位檔案的例子有:以二進位" "模式(``'rb'``、``'wb'`` 或 ``'rb+'``)開啟的檔案、:data:`sys.stdin.buffer " -"`、:data:`sys.stdout.buffer `,以" -"及 :class:`io.BytesIO` 和 :class:`gzip.GzipFile` 實例。" +"`、:data:`sys.stdout.buffer `,以及 :class:`io." +"BytesIO` 和 :class:`gzip.GzipFile` 實例。" -#: ../../glossary.rst:186 +#: ../../glossary.rst:188 msgid "" -"See also :term:`text file` for a file object able to read and " -"write :class:`str` objects." +"See also :term:`text file` for a file object able to read and write :class:" +"`str` objects." msgstr "" -"另請參閱 :term:`text file`\\ (文字檔案),它是一個能夠讀取和寫" -"入 :class:`str` 物件的檔案物件。" +"另請參閱 :term:`text file`\\ (文字檔案),它是一個能夠讀取和寫入 :class:" +"`str` 物件的檔案物件。" -#: ../../glossary.rst:188 +#: ../../glossary.rst:190 msgid "borrowed reference" msgstr "borrowed reference(借用參照)" -#: ../../glossary.rst:190 +#: ../../glossary.rst:192 msgid "" "In Python's C API, a borrowed reference is a reference to an object, where " "the code using the object does not own the reference. It becomes a dangling " @@ -444,12 +442,12 @@ msgstr "" "如,一次垃圾回收 (garbage collection) 可以移除對物件的最後一個 :term:`strong " "reference`\\ (強參照),而將該物件銷毀。" -#: ../../glossary.rst:196 +#: ../../glossary.rst:198 msgid "" "Calling :c:func:`Py_INCREF` on the :term:`borrowed reference` is recommended " "to convert it to a :term:`strong reference` in-place, except when the object " -"cannot be destroyed before the last usage of the borrowed reference. " -"The :c:func:`Py_NewRef` function can be used to create a new :term:`strong " +"cannot be destroyed before the last usage of the borrowed reference. The :c:" +"func:`Py_NewRef` function can be used to create a new :term:`strong " "reference`." msgstr "" "對 :term:`borrowed reference` 呼叫 :c:func:`Py_INCREF` 以將它原地 (in-place) " @@ -457,31 +455,31 @@ msgstr "" "借用參照之前被銷毀。:c:func:`Py_NewRef` 函式可用於建立一個新的 :term:`strong " "reference`。" -#: ../../glossary.rst:201 +#: ../../glossary.rst:203 msgid "bytes-like object" msgstr "bytes-like object(類位元組串物件)" -#: ../../glossary.rst:203 +#: ../../glossary.rst:205 msgid "" -"An object that supports the :ref:`bufferobjects` and can export a " -"C-:term:`contiguous` buffer. This includes " -"all :class:`bytes`, :class:`bytearray`, and :class:`array.array` objects, as " -"well as many common :class:`memoryview` objects. Bytes-like objects can be " -"used for various operations that work with binary data; these include " -"compression, saving to a binary file, and sending over a socket." +"An object that supports the :ref:`bufferobjects` and can export a C-:term:" +"`contiguous` buffer. This includes all :class:`bytes`, :class:`bytearray`, " +"and :class:`array.array` objects, as well as many common :class:`memoryview` " +"objects. Bytes-like objects can be used for various operations that work " +"with binary data; these include compression, saving to a binary file, and " +"sending over a socket." msgstr "" "一個支援\\ :ref:`bufferobjects`\\ 且能夠匯出 C-:term:`contiguous` 緩衝區的物" "件。這包括所有的 :class:`bytes`、:class:`bytearray` 和 :class:`array.array` " "物件,以及許多常見的 :class:`memoryview` 物件。類位元組串物件可用於處理二進位" "資料的各種運算;這些運算包括壓縮、儲存至二進位檔案和透過 socket(插座)發送。" -#: ../../glossary.rst:210 +#: ../../glossary.rst:212 msgid "" "Some operations need the binary data to be mutable. The documentation often " "refers to these as \"read-write bytes-like objects\". Example mutable " -"buffer objects include :class:`bytearray` and a :class:`memoryview` of " -"a :class:`bytearray`. Other operations require the binary data to be stored " -"in immutable objects (\"read-only bytes-like objects\"); examples of these " +"buffer objects include :class:`bytearray` and a :class:`memoryview` of a :" +"class:`bytearray`. Other operations require the binary data to be stored in " +"immutable objects (\"read-only bytes-like objects\"); examples of these " "include :class:`bytes` and a :class:`memoryview` of a :class:`bytes` object." msgstr "" "有些運算需要二進位資料是可變的。說明文件通常會將這些物件稱為「可讀寫的類位元" @@ -490,11 +488,11 @@ msgstr "" "的類位元組串物件」)中;這些物件包括 :class:`bytes`,以及 :class:`bytes` 物件" "的 :class:`memoryview`。" -#: ../../glossary.rst:218 +#: ../../glossary.rst:220 msgid "bytecode" msgstr "bytecode(位元組碼)" -#: ../../glossary.rst:220 +#: ../../glossary.rst:222 msgid "" "Python source code is compiled into bytecode, the internal representation of " "a Python program in the CPython interpreter. The bytecode is also cached in " @@ -513,54 +511,54 @@ msgstr "" "上是無法在不同的 Python 虛擬機器之間運作的,也不能在不同版本的 Python 之間保" "持穩定。" -#: ../../glossary.rst:230 +#: ../../glossary.rst:232 msgid "" -"A list of bytecode instructions can be found in the documentation " -"for :ref:`the dis module `." +"A list of bytecode instructions can be found in the documentation for :ref:" +"`the dis module `." msgstr "" "位元組碼的指令列表可以在 :ref:`dis 模組 `\\ 的說明文件中找到。" -#: ../../glossary.rst:232 +#: ../../glossary.rst:234 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../glossary.rst:234 +#: ../../glossary.rst:236 msgid "" "A callable is an object that can be called, possibly with a set of arguments " "(see :term:`argument`), with the following syntax::" msgstr "" -"一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請" -"見 :term:`argument`): ::" +"一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請見 :" +"term:`argument`): ::" -#: ../../glossary.rst:237 +#: ../../glossary.rst:239 msgid "callable(argument1, argument2, argumentN)" msgstr "callable(argument1, argument2, argumentN)" -#: ../../glossary.rst:239 +#: ../../glossary.rst:241 msgid "" "A :term:`function`, and by extension a :term:`method`, is a callable. An " "instance of a class that implements the :meth:`~object.__call__` method is " "also a callable." msgstr "" -"一個 :term:`function` 與其延伸的 :term:`method` 都是 callable。一個有實" -"作 :meth:`~object.__call__` 方法的 class 之實例也是個 callable。" +"一個 :term:`function` 與其延伸的 :term:`method` 都是 callable。一個有實作 :" +"meth:`~object.__call__` 方法的 class 之實例也是個 callable。" -#: ../../glossary.rst:242 +#: ../../glossary.rst:244 msgid "callback" msgstr "callback(回呼)" -#: ../../glossary.rst:244 +#: ../../glossary.rst:246 msgid "" "A subroutine function which is passed as an argument to be executed at some " "point in the future." msgstr "" "作為引數被傳遞的一個副程式 (subroutine) 函式,會在未來的某個時間點被執行。" -#: ../../glossary.rst:246 +#: ../../glossary.rst:248 msgid "class" msgstr "class(類別)" -#: ../../glossary.rst:248 +#: ../../glossary.rst:250 msgid "" "A template for creating user-defined objects. Class definitions normally " "contain method definitions which operate on instances of the class." @@ -568,11 +566,11 @@ msgstr "" "一個用於建立使用者定義物件的模板。Class 的定義通常會包含 method 的定義,這些 " "method 可以在 class 的實例上進行操作。" -#: ../../glossary.rst:251 +#: ../../glossary.rst:253 msgid "class variable" msgstr "class variable(類別變數)" -#: ../../glossary.rst:253 +#: ../../glossary.rst:255 msgid "" "A variable defined in a class and intended to be modified only at class " "level (i.e., not in an instance of the class)." @@ -580,24 +578,24 @@ msgstr "" "一個在 class 中被定義,且應該只能在 class 層次(意即不是在 class 的實例中)被" "修改的變數。" -#: ../../glossary.rst:255 +#: ../../glossary.rst:257 msgid "closure variable" msgstr "closure variable(閉包變數)" -#: ../../glossary.rst:257 +#: ../../glossary.rst:259 msgid "" "A :term:`free variable` referenced from a :term:`nested scope` that is " "defined in an outer scope rather than being resolved at runtime from the " -"globals or builtin namespaces. May be explicitly defined with " -"the :keyword:`nonlocal` keyword to allow write access, or implicitly defined " -"if the variable is only being read." +"globals or builtin namespaces. May be explicitly defined with the :keyword:" +"`nonlocal` keyword to allow write access, or implicitly defined if the " +"variable is only being read." msgstr "" "從外部作用域中定義且從\\ :term:`巢狀作用域 `\\ 參照的\\ :term:`" "自由變數 `,不是於 runtime 從全域或內建命名空間解析。可以使" "用 :keyword:`nonlocal` 關鍵字明確定義以允許寫入存取,或者如果僅需讀取變數則隱" "式定義即可。" -#: ../../glossary.rst:262 +#: ../../glossary.rst:264 msgid "" "For example, in the ``inner`` function in the following code, both ``x`` and " "``print`` are :term:`free variables `, but only ``x`` is a " @@ -606,7 +604,7 @@ msgstr "" "例如在下面程式碼中的 ``inner`` 函式中,``x`` 和 ``print`` 都是\\ :term:`自由" "變數 `,但只有 ``x`` 是\\ *閉包變數*: ::" -#: ../../glossary.rst:265 +#: ../../glossary.rst:267 msgid "" "def outer():\n" " x = 0\n" @@ -624,7 +622,7 @@ msgstr "" " print(x)\n" " return inner" -#: ../../glossary.rst:273 +#: ../../glossary.rst:275 msgid "" "Due to the :attr:`codeobject.co_freevars` attribute (which, despite its " "name, only includes the names of closure variables rather than listing all " @@ -636,11 +634,11 @@ msgstr "" "名稱,而不是列出所有參照的自由變數),當預期含義是特指閉包變數時,有時候甚至" "也會使用更通用的\\ :term:`自由變數 `\\ 一詞。" -#: ../../glossary.rst:277 +#: ../../glossary.rst:279 msgid "complex number" msgstr "complex number(複數)" -#: ../../glossary.rst:279 +#: ../../glossary.rst:281 msgid "" "An extension of the familiar real number system in which all numbers are " "expressed as a sum of a real part and an imaginary part. Imaginary numbers " @@ -655,69 +653,68 @@ msgstr "" "一個我們熟悉的實數系統的擴充,在此所有數字都會被表示為一個實部和一個虛部之" "和。虛數就是虛數單位(``-1`` 的平方根)的實數倍,此單位通常在數學中被寫為 " "``i``,在工程學中被寫為 ``j``。Python 內建了對複數的支援,它是用後者的記法來" -"表示複數;虛部會帶著一個後綴的 ``j`` 被編寫,例如 ``3+1j``。若要" -"將 :mod:`math` 模組內的工具等效地用於複數,請使用 :mod:`cmath` 模組。複數的使" -"用是一個相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可" -"以安全地忽略它們。" +"表示複數;虛部會帶著一個後綴的 ``j`` 被編寫,例如 ``3+1j``。若要將 :mod:" +"`math` 模組內的工具等效地用於複數,請使用 :mod:`cmath` 模組。複數的使用是一個" +"相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可以安全地" +"忽略它們。" -#: ../../glossary.rst:289 +#: ../../glossary.rst:291 msgid "context" msgstr "context(情境)" -#: ../../glossary.rst:291 +#: ../../glossary.rst:293 msgid "" "This term has different meanings depending on where and how it is used. Some " "common meanings:" msgstr "" -#: ../../glossary.rst:294 +#: ../../glossary.rst:296 msgid "" "The temporary state or environment established by a :term:`context manager` " "via a :keyword:`with` statement." msgstr "" -#: ../../glossary.rst:296 +#: ../../glossary.rst:298 msgid "" -"The collection of key­value bindings associated with a " -"particular :class:`contextvars.Context` object and accessed " -"via :class:`~contextvars.ContextVar` objects. Also see :term:`context " -"variable`." +"The collection of key­value bindings associated with a particular :class:" +"`contextvars.Context` object and accessed via :class:`~contextvars." +"ContextVar` objects. Also see :term:`context variable`." msgstr "" -#: ../../glossary.rst:300 +#: ../../glossary.rst:302 msgid "" "A :class:`contextvars.Context` object. Also see :term:`current context`." msgstr "" "一個 :class:`contextvars.Context` 物件。另請參閱 :term:`current context`。" -#: ../../glossary.rst:302 +#: ../../glossary.rst:304 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../glossary.rst:304 +#: ../../glossary.rst:306 msgid "" "The :meth:`~object.__enter__` and :meth:`~object.__exit__` methods called by " "the :keyword:`with` statement. See :pep:`343`." msgstr "" -"由 :keyword:`with` 陳述式所呼叫的 :meth:`~object.__enter__` " -"和 :meth:`~object.__exit__` 方法。另請參閱 :pep:`343`。" +"由 :keyword:`with` 陳述式所呼叫的 :meth:`~object.__enter__` 和 :meth:" +"`~object.__exit__` 方法。另請參閱 :pep:`343`。" -#: ../../glossary.rst:306 +#: ../../glossary.rst:308 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../glossary.rst:308 +#: ../../glossary.rst:310 msgid "" "An object which implements the :term:`context management protocol` and " -"controls the environment seen in a :keyword:`with` statement. " -"See :pep:`343`." +"controls the environment seen in a :keyword:`with` statement. See :pep:" +"`343`." msgstr "" -#: ../../glossary.rst:311 +#: ../../glossary.rst:313 msgid "context variable" msgstr "context variable(情境變數)" -#: ../../glossary.rst:313 +#: ../../glossary.rst:315 msgid "" "A variable whose value depends on which context is the :term:`current " "context`. Values are accessed via :class:`contextvars.ContextVar` objects. " @@ -725,11 +722,11 @@ msgid "" "asynchronous tasks." msgstr "" -#: ../../glossary.rst:317 +#: ../../glossary.rst:319 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../glossary.rst:321 +#: ../../glossary.rst:323 msgid "" "A buffer is considered contiguous exactly if it is either *C-contiguous* or " "*Fortran contiguous*. Zero-dimensional buffers are C and Fortran " @@ -746,11 +743,11 @@ msgstr "" "的順序瀏覽各個項目時,最後一個索引的變化最快。然而,在 Fortran contiguous 陣" "列中,第一個索引的變化最快。" -#: ../../glossary.rst:329 +#: ../../glossary.rst:331 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../glossary.rst:331 +#: ../../glossary.rst:333 msgid "" "Coroutines are a more generalized form of subroutines. Subroutines are " "entered at one point and exited at another point. Coroutines can be " @@ -761,27 +758,26 @@ msgstr "" "在另一個時間點被退出。協程可以在許多不同的時間點被進入、退出和回復。它們能夠" "以 :keyword:`async def` 陳述式被實作。另請參閱 :pep:`492`。" -#: ../../glossary.rst:336 +#: ../../glossary.rst:338 msgid "coroutine function" msgstr "coroutine function(協程函式)" -#: ../../glossary.rst:338 +#: ../../glossary.rst:340 msgid "" "A function which returns a :term:`coroutine` object. A coroutine function " -"may be defined with the :keyword:`async def` statement, and may " -"contain :keyword:`await`, :keyword:`async for`, and :keyword:`async with` " -"keywords. These were introduced by :pep:`492`." +"may be defined with the :keyword:`async def` statement, and may contain :" +"keyword:`await`, :keyword:`async for`, and :keyword:`async with` keywords. " +"These were introduced by :pep:`492`." msgstr "" -"一個回傳 :term:`coroutine`\\ (協程)物件的函式。一個協程函式能" -"以 :keyword:`async def` 陳述式被定義,並可能會包" -"含 :keyword:`await`、:keyword:`async for` 和 :keyword:`async with` 關鍵字。這" -"些關鍵字由 :pep:`492` 引入。" +"一個回傳 :term:`coroutine`\\ (協程)物件的函式。一個協程函式能以 :keyword:" +"`async def` 陳述式被定義,並可能會包含 :keyword:`await`、:keyword:`async " +"for` 和 :keyword:`async with` 關鍵字。這些關鍵字由 :pep:`492` 引入。" -#: ../../glossary.rst:343 +#: ../../glossary.rst:345 msgid "CPython" msgstr "CPython" -#: ../../glossary.rst:345 +#: ../../glossary.rst:347 msgid "" "The canonical implementation of the Python programming language, as " "distributed on `python.org `_. The term \"CPython\" " @@ -792,25 +788,25 @@ msgstr "" "`_ 上。「CPython」這個術語在必要時被使用,以區分此實" "作與其它語言的實作,例如 Jython 或 IronPython。" -#: ../../glossary.rst:349 +#: ../../glossary.rst:351 msgid "current context" msgstr "" -#: ../../glossary.rst:351 +#: ../../glossary.rst:353 msgid "" "The :term:`context` (:class:`contextvars.Context` object) that is currently " "used by :class:`~contextvars.ContextVar` objects to access (get or set) the " "values of :term:`context variables `. Each thread has its " -"own current context. Frameworks for executing asynchronous tasks " -"(see :mod:`asyncio`) associate each task with a context which becomes the " -"current context whenever the task starts or resumes execution." +"own current context. Frameworks for executing asynchronous tasks (see :mod:" +"`asyncio`) associate each task with a context which becomes the current " +"context whenever the task starts or resumes execution." msgstr "" -#: ../../glossary.rst:357 +#: ../../glossary.rst:359 msgid "cyclic isolate" msgstr "" -#: ../../glossary.rst:359 +#: ../../glossary.rst:361 msgid "" "A subgroup of one or more objects that reference each other in a reference " "cycle, but are not referenced by objects outside the group. The goal of " @@ -819,11 +815,11 @@ msgid "" "reclaimed." msgstr "" -#: ../../glossary.rst:363 +#: ../../glossary.rst:365 msgid "decorator" msgstr "decorator(裝飾器)" -#: ../../glossary.rst:365 +#: ../../glossary.rst:367 msgid "" "A function returning another function, usually applied as a function " "transformation using the ``@wrapper`` syntax. Common examples for " @@ -833,13 +829,13 @@ msgstr "" "式的變換 (function transformation)。裝飾器的常見範例是 :func:`classmethod` " "和 :func:`staticmethod`。" -#: ../../glossary.rst:369 +#: ../../glossary.rst:371 msgid "" "The decorator syntax is merely syntactic sugar, the following two function " "definitions are semantically equivalent::" msgstr "裝飾器語法只是語法糖。以下兩個函式定義在語義上是等效的: ::" -#: ../../glossary.rst:372 +#: ../../glossary.rst:374 msgid "" "def f(arg):\n" " ...\n" @@ -857,41 +853,40 @@ msgstr "" "def f(arg):\n" " ..." -#: ../../glossary.rst:380 +#: ../../glossary.rst:382 msgid "" "The same concept exists for classes, but is less commonly used there. See " "the documentation for :ref:`function definitions ` and :ref:`class " "definitions ` for more about decorators." msgstr "" -"Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱" -"\\ :ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" +"Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱\\ :" +"ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" -#: ../../glossary.rst:383 +#: ../../glossary.rst:385 msgid "descriptor" msgstr "descriptor(描述器)" -#: ../../glossary.rst:385 -msgid "" -"Any object which defines the " -"methods :meth:`~object.__get__`, :meth:`~object.__set__`, " -"or :meth:`~object.__delete__`. When a class attribute is a descriptor, its " -"special binding behavior is triggered upon attribute lookup. Normally, " -"using *a.b* to get, set or delete an attribute looks up the object named *b* " -"in the class dictionary for *a*, but if *b* is a descriptor, the respective " -"descriptor method gets called. Understanding descriptors is a key to a deep " -"understanding of Python because they are the basis for many features " -"including functions, methods, properties, class methods, static methods, and " -"reference to super classes." -msgstr "" -"任何定義了 :meth:`~object.__get__`、:meth:`~object.__set__` " -"或 :meth:`~object.__delete__` method 的物件。當一個 class 屬性是一個描述器" -"時,它的特殊連結行為會在屬性查找時被觸發。通常,使用 *a.b* 來取得、設定或刪除" -"某個屬性時,會在 *a* 的 class 字典中查找名稱為 *b* 的物件,但如果 *b* 是一個" -"描述器,則相對應的描述器 method 會被呼叫。對描述器的理解是深入理解 Python 的" -"關鍵,因為它們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、" -"class method、靜態 method,以及對 super class(父類別)的參照。" - -#: ../../glossary.rst:396 +#: ../../glossary.rst:387 +msgid "" +"Any object which defines the methods :meth:`~object.__get__`, :meth:`~object." +"__set__`, or :meth:`~object.__delete__`. When a class attribute is a " +"descriptor, its special binding behavior is triggered upon attribute " +"lookup. Normally, using *a.b* to get, set or delete an attribute looks up " +"the object named *b* in the class dictionary for *a*, but if *b* is a " +"descriptor, the respective descriptor method gets called. Understanding " +"descriptors is a key to a deep understanding of Python because they are the " +"basis for many features including functions, methods, properties, class " +"methods, static methods, and reference to super classes." +msgstr "" +"任何定義了 :meth:`~object.__get__`、:meth:`~object.__set__` 或 :meth:" +"`~object.__delete__` method 的物件。當一個 class 屬性是一個描述器時,它的特殊" +"連結行為會在屬性查找時被觸發。通常,使用 *a.b* 來取得、設定或刪除某個屬性時," +"會在 *a* 的 class 字典中查找名稱為 *b* 的物件,但如果 *b* 是一個描述器,則相" +"對應的描述器 method 會被呼叫。對描述器的理解是深入理解 Python 的關鍵,因為它" +"們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、class method、" +"靜態 method,以及對 super class(父類別)的參照。" + +#: ../../glossary.rst:398 msgid "" "For more information about descriptors' methods, see :ref:`descriptors` or " "the :ref:`Descriptor How To Guide `." @@ -899,11 +894,11 @@ msgstr "" "關於描述器 method 的更多資訊,請參閱\\ :ref:`descriptors`\\ 或\\ :ref:`描述器" "使用指南 `。" -#: ../../glossary.rst:398 +#: ../../glossary.rst:400 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../glossary.rst:400 +#: ../../glossary.rst:402 msgid "" "An associative array, where arbitrary keys are mapped to values. The keys " "can be any object with :meth:`~object.__hash__` and :meth:`~object.__eq__` " @@ -913,11 +908,11 @@ msgstr "" "有 :meth:`~object.__hash__` 和 :meth:`~object.__eq__` method 的物件。在 Perl " "中被稱為雜湊 (hash)。" -#: ../../glossary.rst:404 +#: ../../glossary.rst:406 msgid "dictionary comprehension" msgstr "dictionary comprehension(字典綜合運算)" -#: ../../glossary.rst:406 +#: ../../glossary.rst:408 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a dictionary with the results. ``results = {n: n ** 2 for n in " @@ -928,28 +923,28 @@ msgstr "" "字典回傳。``results = {n: n ** 2 for n in range(10)}`` 會產生一個字典,它包含" "了鍵 ``n`` 對映到值 ``n ** 2``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:410 +#: ../../glossary.rst:412 msgid "dictionary view" msgstr "dictionary view(字典檢視)" -#: ../../glossary.rst:412 +#: ../../glossary.rst:414 msgid "" -"The objects returned from :meth:`dict.keys`, :meth:`dict.values`, " -"and :meth:`dict.items` are called dictionary views. They provide a dynamic " -"view on the dictionary’s entries, which means that when the dictionary " -"changes, the view reflects these changes. To force the dictionary view to " -"become a full list use ``list(dictview)``. See :ref:`dict-views`." +"The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:" +"`dict.items` are called dictionary views. They provide a dynamic view on the " +"dictionary’s entries, which means that when the dictionary changes, the view " +"reflects these changes. To force the dictionary view to become a full list " +"use ``list(dictview)``. See :ref:`dict-views`." msgstr "" "從 :meth:`dict.keys`、:meth:`dict.values` 及 :meth:`dict.items` 回傳的物件被" "稱為字典檢視。它們提供了字典中項目的動態檢視,這表示當字典有變動時,該檢視會" "反映這些變動。若要強制將字典檢視轉為完整的 list(串列),須使用 " "``list(dictview)``。請參閱\\ :ref:`dict-views`。" -#: ../../glossary.rst:418 +#: ../../glossary.rst:420 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../glossary.rst:420 +#: ../../glossary.rst:422 msgid "" "A string literal which appears as the first expression in a class, function " "or module. While ignored when the suite is executed, it is recognized by " @@ -958,25 +953,25 @@ msgid "" "introspection, it is the canonical place for documentation of the object." msgstr "" "一個在 class、函式或模組中,作為第一個運算式出現的字串文本。雖然它在套件執行" -"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組" -"的 :attr:`~definition.__doc__` 屬性中。由於說明字串可以透過內省 " -"(introspection) 來瀏覽,因此它是物件的說明文件存放的標準位置。" +"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組的 :attr:" +"`~definition.__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏" +"覽,因此它是物件的說明文件存放的標準位置。" -#: ../../glossary.rst:426 +#: ../../glossary.rst:428 msgid "duck-typing" msgstr "duck-typing(鴨子型別)" -#: ../../glossary.rst:428 +#: ../../glossary.rst:430 msgid "" "A programming style which does not look at an object's type to determine if " "it has the right interface; instead, the method or attribute is simply " "called or used (\"If it looks like a duck and quacks like a duck, it must be " "a duck.\") By emphasizing interfaces rather than specific types, well-" "designed code improves its flexibility by allowing polymorphic " -"substitution. Duck-typing avoids tests using :func:`type` " -"or :func:`isinstance`. (Note, however, that duck-typing can be complemented " -"with :term:`abstract base classes `.) Instead, it " -"typically employs :func:`hasattr` tests or :term:`EAFP` programming." +"substitution. Duck-typing avoids tests using :func:`type` or :func:" +"`isinstance`. (Note, however, that duck-typing can be complemented with :" +"term:`abstract base classes `.) Instead, it typically " +"employs :func:`hasattr` tests or :term:`EAFP` programming." msgstr "" "一種程式設計風格,它不是藉由檢查一個物件的型別來確定它是否具有正確的介面;取" "而代之的是,method 或屬性會單純地被呼叫或使用。(「如果它看起來像一隻鴨子而且" @@ -987,25 +982,25 @@ msgstr "" "來補充。)然而,它通常會採用 :func:`hasattr` 測試,或是 :term:`EAFP` 程式設計" "風格。" -#: ../../glossary.rst:437 +#: ../../glossary.rst:439 msgid "dunder" msgstr "dunder(雙底線)" -#: ../../glossary.rst:439 +#: ../../glossary.rst:441 msgid "" -"An informal short-hand for \"double underscore\", used when talking about " -"a :term:`special method`. For example, ``__init__`` is often pronounced " +"An informal short-hand for \"double underscore\", used when talking about a :" +"term:`special method`. For example, ``__init__`` is often pronounced " "\"dunder init\"." msgstr "" "一個非正式的縮寫,代表「雙底線 (double underscore)」,當談論到\\ :term:`特殊" "方法 `\\ 時使用。例如,``__init__`` 通常被叫做 \"dunder " "init\"。" -#: ../../glossary.rst:442 +#: ../../glossary.rst:444 msgid "EAFP" msgstr "EAFP" -#: ../../glossary.rst:444 +#: ../../glossary.rst:446 msgid "" "Easier to ask for forgiveness than permission. This common Python coding " "style assumes the existence of valid keys or attributes and catches " @@ -1016,26 +1011,26 @@ msgid "" msgstr "" "Easier to ask for forgiveness than permission.(請求寬恕比請求許可更容易。)" "這種常見的 Python 編碼風格會先假設有效的鍵或屬性的存在,並在該假設被推翻時再" -"捕獲例外。這種乾淨且快速的風格,其特色是存在許多的 :keyword:`try` " -"和 :keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見" -"的 :term:`LBYL` 風格形成了對比。" +"捕獲例外。這種乾淨且快速的風格,其特色是存在許多的 :keyword:`try` 和 :" +"keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見的 :term:`LBYL` 風" +"格形成了對比。" -#: ../../glossary.rst:450 +#: ../../glossary.rst:452 msgid "evaluate function" msgstr "evaluate function(求值函式)" -#: ../../glossary.rst:452 +#: ../../glossary.rst:454 msgid "" "A function that can be called to evaluate a lazily evaluated attribute of an " "object, such as the value of type aliases created with the :keyword:`type` " "statement." msgstr "" -#: ../../glossary.rst:455 +#: ../../glossary.rst:457 msgid "expression" msgstr "expression(運算式)" -#: ../../glossary.rst:457 +#: ../../glossary.rst:459 msgid "" "A piece of syntax which can be evaluated to some value. In other words, an " "expression is an accumulation of expression elements like literals, names, " @@ -1051,11 +1046,11 @@ msgstr "" "(陳述式)不能被用作運算式,例如 :keyword:`while`。賦值 (assignment) 也是陳述" "式,而不是運算式。" -#: ../../glossary.rst:464 +#: ../../glossary.rst:466 msgid "extension module" msgstr "extension module(擴充模組)" -#: ../../glossary.rst:466 +#: ../../glossary.rst:468 msgid "" "A module written in C or C++, using Python's C API to interact with the core " "and with user code." @@ -1063,28 +1058,28 @@ msgstr "" "一個以 C 或 C++ 編寫的模組,它使用 Python 的 C API 來與核心及使用者程式碼進行" "互動。" -#: ../../glossary.rst:468 +#: ../../glossary.rst:470 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../glossary.rst:469 +#: ../../glossary.rst:471 msgid "f-strings" msgstr "f-strings(f 字串)" -#: ../../glossary.rst:471 +#: ../../glossary.rst:473 msgid "" "String literals prefixed with ``f`` or ``F`` are commonly called \"f-" "strings\" which is short for :ref:`formatted string literals `. " "See also :pep:`498`." msgstr "" -"以 ``f`` 或 ``F`` 為前綴的字串文本通常被稱為「f 字串」,它是\\ :ref:`格式" -"化的字串文本 `\\ 的縮寫。另請參閱 :pep:`498`。" +"以 ``f`` 或 ``F`` 為前綴的字串文本通常被稱為「f 字串」,它是\\ :ref:`格式化的" +"字串文本 `\\ 的縮寫。另請參閱 :pep:`498`。" -#: ../../glossary.rst:474 +#: ../../glossary.rst:476 msgid "file object" msgstr "file object(檔案物件)" -#: ../../glossary.rst:476 +#: ../../glossary.rst:478 msgid "" "An object exposing a file-oriented API (with methods such as :meth:`!read` " "or :meth:`!write`) to an underlying resource. Depending on the way it was " @@ -1099,7 +1094,7 @@ msgstr "" "衝區、socket(插座)、管線 (pipe) 等)的存取。檔案物件也被稱為\\ :dfn:`類檔案" "物件 (file-like object)` 或\\ :dfn:`串流 (stream)`。" -#: ../../glossary.rst:484 +#: ../../glossary.rst:486 msgid "" "There are actually three categories of file objects: raw :term:`binary files " "`, buffered :term:`binary files ` and :term:`text " @@ -1107,24 +1102,23 @@ msgid "" "The canonical way to create a file object is by using the :func:`open` " "function." msgstr "" -"實際上,有三種檔案物件:原始的\\ :term:`二進位檔案 `、緩衝的" -"\\ :term:`二進位檔案 `\\ 和\\ :term:`文字檔案 `。它們" -"的介面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函" -"式。" +"實際上,有三種檔案物件:原始的\\ :term:`二進位檔案 `、緩衝的\\ :" +"term:`二進位檔案 `\\ 和\\ :term:`文字檔案 `。它們的介" +"面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函式。" -#: ../../glossary.rst:489 +#: ../../glossary.rst:491 msgid "file-like object" msgstr "file-like object(類檔案物件)" -#: ../../glossary.rst:491 +#: ../../glossary.rst:493 msgid "A synonym for :term:`file object`." msgstr ":term:`file object`\\ (檔案物件)的同義字。" -#: ../../glossary.rst:492 +#: ../../glossary.rst:494 msgid "filesystem encoding and error handler" msgstr "filesystem encoding and error handler(檔案系統編碼和錯誤處理函式)" -#: ../../glossary.rst:494 +#: ../../glossary.rst:496 msgid "" "Encoding and error handler used by Python to decode bytes from the operating " "system and encode Unicode to the operating system." @@ -1132,7 +1126,7 @@ msgstr "" "Python 所使用的一種編碼和錯誤處理函式,用來解碼來自作業系統的位元組,以及將 " "Unicode 編碼到作業系統。" -#: ../../glossary.rst:497 +#: ../../glossary.rst:499 msgid "" "The filesystem encoding must guarantee to successfully decode all bytes " "below 128. If the file system encoding fails to provide this guarantee, API " @@ -1141,43 +1135,43 @@ msgstr "" "檔案系統編碼必須保證能成功解碼所有小於 128 的位元組。如果檔案系統編碼無法提供" "此保證,則 API 函式會引發 :exc:`UnicodeError`。" -#: ../../glossary.rst:501 +#: ../../glossary.rst:503 msgid "" -"The :func:`sys.getfilesystemencoding` " -"and :func:`sys.getfilesystemencodeerrors` functions can be used to get the " -"filesystem encoding and error handler." +"The :func:`sys.getfilesystemencoding` and :func:`sys." +"getfilesystemencodeerrors` functions can be used to get the filesystem " +"encoding and error handler." msgstr "" ":func:`sys.getfilesystemencoding` 和 :func:`sys.getfilesystemencodeerrors` 函" "式可用於取得檔案系統編碼和錯誤處理函式。" -#: ../../glossary.rst:505 +#: ../../glossary.rst:507 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " -"startup by the :c:func:`PyConfig_Read` function: " -"see :c:member:`~PyConfig.filesystem_encoding` " -"and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." +"startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." +"filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :" +"c:type:`PyConfig`." msgstr "" ":term:`filesystem encoding and error handler`\\ (檔案系統編碼和錯誤處理函" -"式)會在 Python 啟動時由 :c:func:`PyConfig_Read` 函式來配置:請參" -"閱 :c:member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成" -"員 :c:member:`~PyConfig.filesystem_errors`。" +"式)會在 Python 啟動時由 :c:func:`PyConfig_Read` 函式來配置:請參閱 :c:" +"member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成員 :c:" +"member:`~PyConfig.filesystem_errors`。" -#: ../../glossary.rst:510 +#: ../../glossary.rst:512 msgid "See also the :term:`locale encoding`." msgstr "另請參閱 :term:`locale encoding`\\ (區域編碼)。" -#: ../../glossary.rst:511 +#: ../../glossary.rst:513 msgid "finder" msgstr "finder(尋檢器)" -#: ../../glossary.rst:513 +#: ../../glossary.rst:515 msgid "" "An object that tries to find the :term:`loader` for a module that is being " "imported." msgstr "" "一個物件,它會嘗試為正在被 import 的模組尋找 :term:`loader`\\ (載入器)。" -#: ../../glossary.rst:516 +#: ../../glossary.rst:518 msgid "" "There are two types of finder: :term:`meta path finders ` " "for use with :data:`sys.meta_path`, and :term:`path entry finders ` 會使用 :data:`sys.meta_path`,而\\ :term:`路徑項目尋檢器 (path " "entry finder) ` 會使用 :data:`sys.path_hooks`。" -#: ../../glossary.rst:520 +#: ../../glossary.rst:522 msgid "" "See :ref:`finders-and-loaders` and :mod:`importlib` for much more detail." msgstr "請參閱 :ref:`finders-and-loaders` 和 :mod:`importlib` 以了解更多細節。" -#: ../../glossary.rst:521 +#: ../../glossary.rst:523 msgid "floor division" msgstr "floor division(向下取整除法)" -#: ../../glossary.rst:523 +#: ../../glossary.rst:525 msgid "" "Mathematical division that rounds down to nearest integer. The floor " "division operator is ``//``. For example, the expression ``11 // 4`` " @@ -1209,26 +1203,26 @@ msgstr "" "``2.75`` 不同。請注意,``(-11) // 4`` 的結果是 ``-3``,因為是 ``-2.75`` 被\\ " "*向下*\\ 無條件捨去。請參閱 :pep:`238`。" -#: ../../glossary.rst:528 +#: ../../glossary.rst:530 msgid "free threading" msgstr "free threading(自由執行緒)" -#: ../../glossary.rst:530 +#: ../../glossary.rst:532 msgid "" "A threading model where multiple threads can run Python bytecode " -"simultaneously within the same interpreter. This is in contrast to " -"the :term:`global interpreter lock` which allows only one thread to execute " +"simultaneously within the same interpreter. This is in contrast to the :" +"term:`global interpreter lock` which allows only one thread to execute " "Python bytecode at a time. See :pep:`703`." msgstr "" "為一種執行緒模型,多個執行緒可以在同一直譯器中同時運行 Python 位元組碼。這與" "\\ :term:`全域直譯器鎖 `\\ 形成對比,後者一次只允許" "一個執行緒執行 Python 位元組碼。請參閱 :pep:`703`。" -#: ../../glossary.rst:534 +#: ../../glossary.rst:536 msgid "free variable" msgstr "free variable(自由變數)" -#: ../../glossary.rst:536 +#: ../../glossary.rst:538 msgid "" "Formally, as defined in the :ref:`language execution model `, a " "free variable is any variable used in a namespace which is not a local " @@ -1238,31 +1232,31 @@ msgid "" "variable`." msgstr "" -#: ../../glossary.rst:541 +#: ../../glossary.rst:543 msgid "function" msgstr "function(函式)" -#: ../../glossary.rst:543 +#: ../../glossary.rst:545 msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments ` which may be used in the " -"execution of the body. See also :term:`parameter`, :term:`method`, and " -"the :ref:`function` section." +"execution of the body. See also :term:`parameter`, :term:`method`, and the :" +"ref:`function` section." msgstr "" "一連串的陳述式,它能夠向呼叫者回傳一些值。它也可以被傳遞零個或多個\\ :term:`" -"引數 `,這些引數可被使用於函式本體的執行。另請參" -"閱 :term:`parameter`\\ (參數)、:term:`method`\\ (方法),以及" -"\\ :ref:`function`\\ 章節。" +"引數 `,這些引數可被使用於函式本體的執行。另請參閱 :term:" +"`parameter`\\ (參數)、:term:`method`\\ (方法),以及\\ :ref:`function`\\ " +"章節。" -#: ../../glossary.rst:547 +#: ../../glossary.rst:549 msgid "function annotation" msgstr "function annotation(函式註釋)" -#: ../../glossary.rst:549 +#: ../../glossary.rst:551 msgid "An :term:`annotation` of a function parameter or return value." msgstr "函式參數或回傳值的一個 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:551 +#: ../../glossary.rst:553 msgid "" "Function annotations are usually used for :term:`type hints `: " "for example, this function is expected to take two :class:`int` arguments " @@ -1271,7 +1265,7 @@ msgstr "" "函式註釋通常被使用於\\ :term:`型別提示 `:例如,這個函式預期會得到" "兩個 :class:`int` 引數,並會有一個 :class:`int` 回傳值: ::" -#: ../../glossary.rst:556 +#: ../../glossary.rst:558 msgid "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" @@ -1279,11 +1273,11 @@ msgstr "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" -#: ../../glossary.rst:559 +#: ../../glossary.rst:561 msgid "Function annotation syntax is explained in section :ref:`function`." msgstr "函式註釋的語法在\\ :ref:`function`\\ 章節有詳細解釋。" -#: ../../glossary.rst:561 +#: ../../glossary.rst:563 msgid "" "See :term:`variable annotation` and :pep:`484`, which describe this " "functionality. Also see :ref:`annotations-howto` for best practices on " @@ -1292,16 +1286,16 @@ msgstr "" "請參閱 :term:`variable annotation` 和 :pep:`484`,皆有此功能的描述。關於註釋" "的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:565 +#: ../../glossary.rst:567 msgid "__future__" msgstr "__future__" -#: ../../glossary.rst:567 +#: ../../glossary.rst:569 msgid "" "A :ref:`future statement `, ``from __future__ import ``, " "directs the compiler to compile the current module using syntax or semantics " -"that will become standard in a future release of Python. " -"The :mod:`__future__` module documents the possible values of *feature*. By " +"that will become standard in a future release of Python. The :mod:" +"`__future__` module documents the possible values of *feature*. By " "importing this module and evaluating its variables, you can see when a new " "feature was first added to the language and when it will (or did) become the " "default::" @@ -1312,7 +1306,7 @@ msgstr "" "import 此模組並對其變數求值,你可以看見一個新的功能是何時首次被新增到此語言" "中,以及它何時將會(或已經)成為預設的功能: ::" -#: ../../glossary.rst:575 +#: ../../glossary.rst:577 msgid "" ">>> import __future__\n" ">>> __future__.division\n" @@ -1322,11 +1316,11 @@ msgstr "" ">>> __future__.division\n" "_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)" -#: ../../glossary.rst:578 +#: ../../glossary.rst:580 msgid "garbage collection" msgstr "garbage collection(垃圾回收)" -#: ../../glossary.rst:580 +#: ../../glossary.rst:582 msgid "" "The process of freeing memory when it is not used anymore. Python performs " "garbage collection via reference counting and a cyclic garbage collector " @@ -1338,11 +1332,11 @@ msgstr "" "垃圾回收器 (cyclic garbage collector) 來完成。垃圾回收器可以使用 :mod:`gc` 模" "組對其進行控制。" -#: ../../glossary.rst:585 ../../glossary.rst:586 +#: ../../glossary.rst:587 ../../glossary.rst:588 msgid "generator" msgstr "generator(產生器)" -#: ../../glossary.rst:588 +#: ../../glossary.rst:590 msgid "" "A function which returns a :term:`generator iterator`. It looks like a " "normal function except that it contains :keyword:`yield` expressions for " @@ -1353,7 +1347,7 @@ msgstr "" "個正常的函式,但不同的是它包含了 :keyword:`yield` 運算式,能產生一系列的值," "這些值可用於 for 迴圈,或是以 :func:`next` 函式,每次檢索其中的一個值。" -#: ../../glossary.rst:593 +#: ../../glossary.rst:595 msgid "" "Usually refers to a generator function, but may refer to a *generator " "iterator* in some contexts. In cases where the intended meaning isn't " @@ -1362,15 +1356,15 @@ msgstr "" "這個術語通常用來表示一個產生器函式,但在某些情境中,也可能是表示\\ *產生器疊" "代器*。萬一想表達的意思不夠清楚,那就使用完整的術語,以避免歧義。" -#: ../../glossary.rst:596 +#: ../../glossary.rst:598 msgid "generator iterator" msgstr "generator iterator(產生器疊代器)" -#: ../../glossary.rst:598 +#: ../../glossary.rst:600 msgid "An object created by a :term:`generator` function." msgstr "一個由 :term:`generator`\\ (產生器)函式所建立的物件。" -#: ../../glossary.rst:600 +#: ../../glossary.rst:602 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "execution state (including local variables and pending try-statements). " @@ -1381,11 +1375,11 @@ msgstr "" "try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與那些" "每次呼叫時都要重新開始的函式有所不同)。" -#: ../../glossary.rst:606 ../../glossary.rst:607 +#: ../../glossary.rst:608 ../../glossary.rst:609 msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../glossary.rst:609 +#: ../../glossary.rst:611 msgid "" "An :term:`expression` that returns an :term:`iterator`. It looks like a " "normal expression followed by a :keyword:`!for` clause defining a loop " @@ -1397,7 +1391,7 @@ msgstr "" "變數、範圍以及一個選擇性的 :keyword:`!if` 子句。該組合運算式會為外層函式產生" "多個值: ::" -#: ../../glossary.rst:614 +#: ../../glossary.rst:616 msgid "" ">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" "285" @@ -1405,11 +1399,11 @@ msgstr "" ">>> sum(i*i for i in range(10)) # 平方之和 0, 1, 4, ... 81\n" "285" -#: ../../glossary.rst:616 +#: ../../glossary.rst:618 msgid "generic function" msgstr "generic function(泛型函式)" -#: ../../glossary.rst:618 +#: ../../glossary.rst:620 msgid "" "A function composed of multiple functions implementing the same operation " "for different types. Which implementation should be used during a call is " @@ -1418,50 +1412,49 @@ msgstr "" "一個由多個函式組成的函式,該函式會對不同的型別實作相同的運算。呼叫期間應該使" "用哪種實作,是由調度演算法 (dispatch algorithm) 來決定。" -#: ../../glossary.rst:622 +#: ../../glossary.rst:624 msgid "" -"See also the :term:`single dispatch` glossary entry, " -"the :func:`functools.singledispatch` decorator, and :pep:`443`." +"See also the :term:`single dispatch` glossary entry, the :func:`functools." +"singledispatch` decorator, and :pep:`443`." msgstr "" -"另請參閱 :term:`single dispatch`\\ (單一調度)術語表條" -"目、:func:`functools.singledispatch` 裝飾器和 :pep:`443`。" +"另請參閱 :term:`single dispatch`\\ (單一調度)術語表條目、:func:`functools." +"singledispatch` 裝飾器和 :pep:`443`。" -#: ../../glossary.rst:624 +#: ../../glossary.rst:626 msgid "generic type" msgstr "generic type(泛型型別)" -#: ../../glossary.rst:626 +#: ../../glossary.rst:628 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " -"class` such as :class:`list` or :class:`dict`. Used " -"for :term:`type hints ` and :term:`annotations `." +"class` such as :class:`list` or :class:`dict`. Used for :" +"term:`type hints ` and :term:`annotations `." msgstr "" -"一個能夠被參數化 (parameterized) 的 :term:`type`\\ (型別);通常是一" -"個 :ref:`容器型別 `,像是 :class:`list` 和 :class:`dict`。它" -"被用於\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" +"一個能夠被參數化 (parameterized) 的 :term:`type`\\ (型別);通常是一個 :ref:" +"`容器型別 `,像是 :class:`list` 和 :class:`dict`。它被用於" +"\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" -#: ../../glossary.rst:631 +#: ../../glossary.rst:633 msgid "" -"For more details, see :ref:`generic alias types`, :pep:`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` " -"module." +"For more details, see :ref:`generic alias types`, :pep:" +"`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." msgstr "" -"詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:`484`、:pep:`585` 和 :mod:`typing` 模組。" +"詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:" +"`484`、:pep:`585` 和 :mod:`typing` 模組。" -#: ../../glossary.rst:633 +#: ../../glossary.rst:635 msgid "GIL" msgstr "GIL" -#: ../../glossary.rst:635 +#: ../../glossary.rst:637 msgid "See :term:`global interpreter lock`." msgstr "請參閱 :term:`global interpreter lock`\\ (全域直譯器鎖)。" -#: ../../glossary.rst:636 +#: ../../glossary.rst:638 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../glossary.rst:638 +#: ../../glossary.rst:640 msgid "" "The mechanism used by the :term:`CPython` interpreter to assure that only " "one thread executes Python :term:`bytecode` at a time. This simplifies the " @@ -1478,7 +1471,7 @@ msgstr "" "(multi-threaded),但代價是會犧牲掉多處理器的機器能夠提供的一大部分平行性 " "(parallelism)。" -#: ../../glossary.rst:647 +#: ../../glossary.rst:649 msgid "" "However, some extension modules, either standard or third-party, are " "designed so as to release the GIL when doing computationally intensive tasks " @@ -1489,7 +1482,7 @@ msgstr "" "計算密集 (computationally intensive) 的任務時,可以解除 GIL。另外,在執行 I/" "O 時,GIL 總是會被解除。" -#: ../../glossary.rst:652 +#: ../../glossary.rst:654 msgid "" "As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil` " "build configuration. After building Python with this option, code must be " @@ -1504,18 +1497,18 @@ msgstr "" "多執行緒應用程式的效能,並使多核心 CPU 的高效使用變得更加容易。有關更多詳細資" "訊,請參閱 :pep:`703`。" -#: ../../glossary.rst:659 +#: ../../glossary.rst:661 msgid "" "In prior versions of Python's C API, a function might declare that it " -"requires the GIL to be held in order to use it. This refers to having " -"an :term:`attached thread state`." +"requires the GIL to be held in order to use it. This refers to having an :" +"term:`attached thread state`." msgstr "" -#: ../../glossary.rst:662 +#: ../../glossary.rst:664 msgid "hash-based pyc" msgstr "hash-based pyc(雜湊架構的 pyc)" -#: ../../glossary.rst:664 +#: ../../glossary.rst:666 msgid "" "A bytecode cache file that uses the hash rather than the last-modified time " "of the corresponding source file to determine its validity. See :ref:`pyc-" @@ -1524,23 +1517,23 @@ msgstr "" "一個位元組碼 (bytecode) 暫存檔,它使用雜湊值而不是對應原始檔案的最後修改時" "間,來確定其有效性。請參閱\\ :ref:`pyc-invalidation`。" -#: ../../glossary.rst:667 +#: ../../glossary.rst:669 msgid "hashable" msgstr "hashable(可雜湊的)" -#: ../../glossary.rst:669 +#: ../../glossary.rst:671 msgid "" "An object is *hashable* if it has a hash value which never changes during " "its lifetime (it needs a :meth:`~object.__hash__` method), and can be " "compared to other objects (it needs an :meth:`~object.__eq__` method). " "Hashable objects which compare equal must have the same hash value." msgstr "" -"如果一個物件有一個雜湊值,該值在其生命週期中永不改變(它需要一" -"個 :meth:`~object.__hash__` method),且可與其他物件互相比較(它需要一" -"個 :meth:`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結" -"果為相等的多個可雜湊物件,它們必須擁有相同的雜湊值。" +"如果一個物件有一個雜湊值,該值在其生命週期中永不改變(它需要一個 :meth:" +"`~object.__hash__` method),且可與其他物件互相比較(它需要一個 :meth:" +"`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結果為相等的" +"多個可雜湊物件,它們必須擁有相同的雜湊值。" -#: ../../glossary.rst:675 +#: ../../glossary.rst:677 msgid "" "Hashability makes an object usable as a dictionary key and a set member, " "because these data structures use the hash value internally." @@ -1548,7 +1541,7 @@ msgstr "" "可雜湊性 (hashability) 使一個物件可用作 dictionary(字典)的鍵和 set(集合)" "的成員,因為這些資料結構都在其內部使用了雜湊值。" -#: ../../glossary.rst:678 +#: ../../glossary.rst:680 msgid "" "Most of Python's immutable built-in objects are hashable; mutable containers " "(such as lists or dictionaries) are not; immutable containers (such as " @@ -1563,11 +1556,11 @@ msgstr "" "則這些物件會被預設為可雜湊的。它們在互相比較時都是不相等的(除非它們與自己比" "較),而它們的雜湊值則是衍生自它們的 :func:`id`。" -#: ../../glossary.rst:685 +#: ../../glossary.rst:687 msgid "IDLE" msgstr "IDLE" -#: ../../glossary.rst:687 +#: ../../glossary.rst:689 msgid "" "An Integrated Development and Learning Environment for Python. :ref:`idle` " "is a basic editor and interpreter environment which ships with the standard " @@ -1577,37 +1570,37 @@ msgstr "" "境)。:ref:`idle` 是一個基本的編輯器和直譯器環境,它和 Python 的標準發行版本" "一起被提供。" -#: ../../glossary.rst:690 +#: ../../glossary.rst:692 msgid "immortal" msgstr "immortal(不滅)" -#: ../../glossary.rst:692 +#: ../../glossary.rst:694 msgid "" -"*Immortal objects* are a CPython implementation detail introduced " -"in :pep:`683`." +"*Immortal objects* are a CPython implementation detail introduced in :pep:" +"`683`." msgstr "*不滅物件 (Immortal objects)* 是 :pep:`683` 引入的 CPython 實作細節。" -#: ../../glossary.rst:695 +#: ../../glossary.rst:697 msgid "" "If an object is immortal, its :term:`reference count` is never modified, and " "therefore it is never deallocated while the interpreter is running. For " "example, :const:`True` and :const:`None` are immortal in CPython." msgstr "" "如果一個物件是不滅的,它的\\ :term:`參照計數 `\\ 永遠不會被" -"修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` " -"和 :const:`None` 在 CPython 中是不滅的。" +"修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` 和 :const:" +"`None` 在 CPython 中是不滅的。" -#: ../../glossary.rst:699 +#: ../../glossary.rst:701 msgid "" -"Immortal objects can be identified via :func:`sys._is_immortal`, or " -"via :c:func:`PyUnstable_IsImmortal` in the C API." +"Immortal objects can be identified via :func:`sys._is_immortal`, or via :c:" +"func:`PyUnstable_IsImmortal` in the C API." msgstr "" -#: ../../glossary.rst:701 +#: ../../glossary.rst:703 msgid "immutable" msgstr "immutable(不可變物件)" -#: ../../glossary.rst:703 +#: ../../glossary.rst:705 msgid "" "An object with a fixed value. Immutable objects include numbers, strings " "and tuples. Such an object cannot be altered. A new object has to be " @@ -1619,11 +1612,11 @@ msgstr "" "能被改變的。如果一個不同的值必須被儲存,則必須建立一個新的物件。它們在需要恆" "定雜湊值的地方,扮演重要的角色,例如 dictionary(字典)中的一個鍵。" -#: ../../glossary.rst:708 +#: ../../glossary.rst:710 msgid "import path" msgstr "import path(引入路徑)" -#: ../../glossary.rst:710 +#: ../../glossary.rst:712 msgid "" "A list of locations (or :term:`path entries `) that are searched " "by the :term:`path based finder` for modules to import. During import, this " @@ -1635,11 +1628,11 @@ msgstr "" "的位置。在 import 期間,此位置列表通常是來自 :data:`sys.path`,但對於子套件 " "(subpackage) 而言,它也可能是來自父套件的 ``__path__`` 屬性。" -#: ../../glossary.rst:715 +#: ../../glossary.rst:717 msgid "importing" msgstr "importing(引入)" -#: ../../glossary.rst:717 +#: ../../glossary.rst:719 msgid "" "The process by which Python code in one module is made available to Python " "code in another module." @@ -1647,23 +1640,23 @@ msgstr "" "一個過程。一個模組中的 Python 程式碼可以透過此過程,被另一個模組中的 Python " "程式碼使用。" -#: ../../glossary.rst:719 +#: ../../glossary.rst:721 msgid "importer" msgstr "importer(引入器)" -#: ../../glossary.rst:721 +#: ../../glossary.rst:723 msgid "" -"An object that both finds and loads a module; both a :term:`finder` " -"and :term:`loader` object." +"An object that both finds and loads a module; both a :term:`finder` and :" +"term:`loader` object." msgstr "" -"一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也" -"是 :term:`loader`\\ (載入器)物件。" +"一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也是 :term:" +"`loader`\\ (載入器)物件。" -#: ../../glossary.rst:723 +#: ../../glossary.rst:725 msgid "interactive" msgstr "interactive(互動的)" -#: ../../glossary.rst:725 +#: ../../glossary.rst:727 msgid "" "Python has an interactive interpreter which means you can enter statements " "and expressions at the interpreter prompt, immediately execute them and see " @@ -1677,11 +1670,11 @@ msgstr "" "從你的電腦的主選單選擇它)。這是測試新想法或檢查模組和包的非常強大的方法(請" "記住help(x))。更多互動式模式相關資訊請見 :ref:`tut-interac`。" -#: ../../glossary.rst:732 +#: ../../glossary.rst:734 msgid "interpreted" msgstr "interpreted(直譯的)" -#: ../../glossary.rst:734 +#: ../../glossary.rst:736 msgid "" "Python is an interpreted language, as opposed to a compiled one, though the " "distinction can be blurry because of the presence of the bytecode compiler. " @@ -1695,20 +1688,20 @@ msgstr "" "一個執行檔,然後再執行它。直譯語言通常比編譯語言有更短的開發/除錯週期,不過" "它們的程式通常也運行得較慢。另請參閱 :term:`interactive`\\ (互動的)。" -#: ../../glossary.rst:741 +#: ../../glossary.rst:743 msgid "interpreter shutdown" msgstr "interpreter shutdown(直譯器關閉)" -#: ../../glossary.rst:743 +#: ../../glossary.rst:745 msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " -"critical internal structures. It also makes several calls to " -"the :term:`garbage collector `. This can trigger the " -"execution of code in user-defined destructors or weakref callbacks. Code " -"executed during the shutdown phase can encounter various exceptions as the " -"resources it relies on may not function anymore (common examples are library " -"modules or the warnings machinery)." +"critical internal structures. It also makes several calls to the :term:" +"`garbage collector `. This can trigger the execution of " +"code in user-defined destructors or weakref callbacks. Code executed during " +"the shutdown phase can encounter various exceptions as the resources it " +"relies on may not function anymore (common examples are library modules or " +"the warnings machinery)." msgstr "" "當 Python 直譯器被要求關閉時,它會進入一個特殊階段,在此它逐漸釋放所有被配置" "的資源,例如模組和各種關鍵內部結構。它也會多次呼叫\\ :term:`垃圾回收器 " @@ -1717,109 +1710,104 @@ msgstr "" "段被執行的程式碼會遇到各種例外,因為它所依賴的資源可能不再有作用了(常見的例" "子是函式庫模組或是警告機制)。" -#: ../../glossary.rst:752 +#: ../../glossary.rst:754 msgid "" "The main reason for interpreter shutdown is that the ``__main__`` module or " "the script being run has finished executing." msgstr "" "直譯器關閉的主要原因,是 ``__main__`` 模組或正被運行的腳本已經執行完成。" -#: ../../glossary.rst:754 +#: ../../glossary.rst:756 msgid "iterable" msgstr "iterable(可疊代物件)" -#: ../../glossary.rst:756 +#: ../../glossary.rst:758 msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " -"and :class:`tuple`) and some non-sequence types " -"like :class:`dict`, :term:`file objects `, and objects of any " -"classes you define with an :meth:`~object.__iter__` method or with " -"a :meth:`~object.__getitem__` method that implements :term:`sequence` " -"semantics." +"and :class:`tuple`) and some non-sequence types like :class:`dict`, :term:" +"`file objects `, and objects of any classes you define with an :" +"meth:`~object.__iter__` method or with a :meth:`~object.__getitem__` method " +"that implements :term:`sequence` semantics." msgstr "" "一種能夠一次回傳一個其中成員的物件。可疊代物件的例子包括所有的序列型別(像" -"是 :class:`list`、:class:`str` 和 :class:`tuple`\\ )和某些非序列型別,像" -"是 :class:`dict`、:term:`檔案物件 `,以及你所定義的任何 class 物" -"件,只要那些 class 有實作 :term:`sequence`\\ (序列)語意" -"的 :meth:`~object.__iter__` 或是 :meth:`~object.__getitem__` method,該物件就" -"是可疊代物件。" +"是 :class:`list`、:class:`str` 和 :class:`tuple`\\ )和某些非序列型別,像是 :" +"class:`dict`、:term:`檔案物件 `,以及你所定義的任何 class 物件," +"只要那些 class 有實作 :term:`sequence`\\ (序列)語意的 :meth:`~object." +"__iter__` 或是 :meth:`~object.__getitem__` method,該物件就是可疊代物件。" -#: ../../glossary.rst:764 +#: ../../glossary.rst:766 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " -"iterable object is passed as an argument to the built-in " -"function :func:`iter`, it returns an iterator for the object. This iterator " -"is good for one pass over the set of values. When using iterables, it is " -"usually not necessary to call :func:`iter` or deal with iterator objects " -"yourself. The :keyword:`for` statement does that automatically for you, " -"creating a temporary unnamed variable to hold the iterator for the duration " -"of the loop. See also :term:`iterator`, :term:`sequence`, " -"and :term:`generator`." -msgstr "" -"可疊代物件可用於 :keyword:`for` 迴圈和許多其他需要一個序列的地方 " -"(:func:`zip`、:func:`map`\\ ...)。當一個可疊代物件作為引數被傳遞給內建函" -"式 :func:`iter` 時,它會為該物件回傳一個疊代器。此疊代器適用於針對一組值進行" -"一遍 (one pass) 運算。使用疊代器時,通常不一定要呼叫 :func:`iter` 或自行處理" -"疊代器物件。:keyword:`for` 陳述式會自動地為你處理這些事,它會建立一個暫時性的" -"未命名變數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代" -"器)、:term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" - -#: ../../glossary.rst:774 +"iterable object is passed as an argument to the built-in function :func:" +"`iter`, it returns an iterator for the object. This iterator is good for " +"one pass over the set of values. When using iterables, it is usually not " +"necessary to call :func:`iter` or deal with iterator objects yourself. The :" +"keyword:`for` statement does that automatically for you, creating a " +"temporary unnamed variable to hold the iterator for the duration of the " +"loop. See also :term:`iterator`, :term:`sequence`, and :term:`generator`." +msgstr "" +"可疊代物件可用於 :keyword:`for` 迴圈和許多其他需要一個序列的地方 (:func:" +"`zip`、:func:`map`\\ ...)。當一個可疊代物件作為引數被傳遞給內建函式 :func:" +"`iter` 時,它會為該物件回傳一個疊代器。此疊代器適用於針對一組值進行一遍 (one " +"pass) 運算。使用疊代器時,通常不一定要呼叫 :func:`iter` 或自行處理疊代器物" +"件。:keyword:`for` 陳述式會自動地為你處理這些事,它會建立一個暫時性的未命名變" +"數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代器)、:" +"term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" + +#: ../../glossary.rst:776 msgid "iterator" msgstr "iterator(疊代器)" -#: ../../glossary.rst:776 -msgid "" -"An object representing a stream of data. Repeated calls to the " -"iterator's :meth:`~iterator.__next__` method (or passing it to the built-in " -"function :func:`next`) return successive items in the stream. When no more " -"data are available a :exc:`StopIteration` exception is raised instead. At " -"this point, the iterator object is exhausted and any further calls to " -"its :meth:`!__next__` method just raise :exc:`StopIteration` again. " -"Iterators are required to have an :meth:`~iterator.__iter__` method that " -"returns the iterator object itself so every iterator is also iterable and " -"may be used in most places where other iterables are accepted. One notable " -"exception is code which attempts multiple iteration passes. A container " -"object (such as a :class:`list`) produces a fresh new iterator each time you " -"pass it to the :func:`iter` function or use it in a :keyword:`for` loop. " -"Attempting this with an iterator will just return the same exhausted " -"iterator object used in the previous iteration pass, making it appear like " -"an empty container." +#: ../../glossary.rst:778 +msgid "" +"An object representing a stream of data. Repeated calls to the iterator's :" +"meth:`~iterator.__next__` method (or passing it to the built-in function :" +"func:`next`) return successive items in the stream. When no more data are " +"available a :exc:`StopIteration` exception is raised instead. At this " +"point, the iterator object is exhausted and any further calls to its :meth:`!" +"__next__` method just raise :exc:`StopIteration` again. Iterators are " +"required to have an :meth:`~iterator.__iter__` method that returns the " +"iterator object itself so every iterator is also iterable and may be used in " +"most places where other iterables are accepted. One notable exception is " +"code which attempts multiple iteration passes. A container object (such as " +"a :class:`list`) produces a fresh new iterator each time you pass it to the :" +"func:`iter` function or use it in a :keyword:`for` loop. Attempting this " +"with an iterator will just return the same exhausted iterator object used in " +"the previous iteration pass, making it appear like an empty container." msgstr "" "一個表示資料流的物件。重複地呼叫疊代器的 :meth:`~iterator.__next__` method" "(或是將它傳遞給內建函式 :func:`next`\\ )會依序回傳資料流中的各項目。當不再" "有資料時,則會引發 :exc:`StopIteration` 例外。此時,該疊代器物件已被用盡,而" -"任何對其 :meth:`!__next__` method 的進一步呼叫,都只會再次引" -"發 :exc:`StopIteration`。疊代器必須有一個 :meth:`~iterator.__iter__` method," -"它會回傳疊代器物件本身,所以每個疊代器也都是可疊代物件,且可以用於大多數適用" -"其他可疊代物件的場合。一個明顯的例外,是嘗試多遍疊代 (multiple iteration " -"passes) 的程式碼。一個容器物件(像是 :class:`list`)在每次你將它傳遞" -"給 :func:`iter` 函式或在 :keyword:`for` 迴圈中使用它時,都會產生一個全新的疊" -"代器。使用疊代器嘗試此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一" -"個已被用盡的疊代器物件,使其看起來就像一個空的容器。" - -#: ../../glossary.rst:791 +"任何對其 :meth:`!__next__` method 的進一步呼叫,都只會再次引發 :exc:" +"`StopIteration`。疊代器必須有一個 :meth:`~iterator.__iter__` method,它會回傳" +"疊代器物件本身,所以每個疊代器也都是可疊代物件,且可以用於大多數適用其他可疊" +"代物件的場合。一個明顯的例外,是嘗試多遍疊代 (multiple iteration passes) 的程" +"式碼。一個容器物件(像是 :class:`list`)在每次你將它傳遞給 :func:`iter` 函式" +"或在 :keyword:`for` 迴圈中使用它時,都會產生一個全新的疊代器。使用疊代器嘗試" +"此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一個已被用盡的疊代器物" +"件,使其看起來就像一個空的容器。" + +#: ../../glossary.rst:793 msgid "More information can be found in :ref:`typeiter`." msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" -#: ../../glossary.rst:795 +#: ../../glossary.rst:797 msgid "" -"CPython does not consistently apply the requirement that an iterator " -"define :meth:`~iterator.__iter__`. And also please note that the free-" -"threading CPython does not guarantee the thread-safety of iterator " -"operations." +"CPython does not consistently apply the requirement that an iterator define :" +"meth:`~iterator.__iter__`. And also please note that the free-threading " +"CPython does not guarantee the thread-safety of iterator operations." msgstr "" -"CPython 並不是始終如一地都會檢查「疊代器有定" -"義 :meth:`~iterator.__iter__`\\ 」這個規定。另請注意,free-threading(自由執" -"行緒)CPython 不保證疊代器操作的執行緒安全。" +"CPython 並不是始終如一地都會檢查「疊代器有定義 :meth:`~iterator." +"__iter__`\\ 」這個規定。另請注意,free-threading(自由執行緒)CPython 不保證" +"疊代器操作的執行緒安全。" -#: ../../glossary.rst:800 +#: ../../glossary.rst:802 msgid "key function" msgstr "key function(鍵函式)" -#: ../../glossary.rst:802 +#: ../../glossary.rst:804 msgid "" "A key function or collation function is a callable that returns a value used " "for sorting or ordering. For example, :func:`locale.strxfrm` is used to " @@ -1829,48 +1817,48 @@ msgstr "" "一個用於排序 (sorting) 或定序 (ordering) 的值。例如,:func:`locale.strxfrm` " "被用來產生一個了解區域特定排序慣例的排序鍵。" -#: ../../glossary.rst:807 +#: ../../glossary.rst:809 msgid "" "A number of tools in Python accept key functions to control how elements are " -"ordered or grouped. They " -"include :func:`min`, :func:`max`, :func:`sorted`, :meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq.nlargest`, " -"and :func:`itertools.groupby`." +"ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" +"meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq." +"nlargest`, and :func:`itertools.groupby`." msgstr "" -"Python 中的許多工具,都接受以鍵函式來控制元素被定序或分組的方式。它們包" -"括 :func:`min`、:func:`max`、:func:`sorted`、:meth:`list.sort`、:func:`heapq.merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` " -"和 :func:`itertools.groupby`。" +"Python 中的許多工具,都接受以鍵函式來控制元素被定序或分組的方式。它們包括 :" +"func:`min`、:func:`max`、:func:`sorted`、:meth:`list.sort`、:func:`heapq." +"merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` 和 :func:`itertools." +"groupby`。" -#: ../../glossary.rst:813 +#: ../../glossary.rst:815 msgid "" -"There are several ways to create a key function. For example. " -"the :meth:`str.lower` method can serve as a key function for case " -"insensitive sorts. Alternatively, a key function can be built from " -"a :keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``. " -"Also, :func:`operator.attrgetter`, :func:`operator.itemgetter`, " -"and :func:`operator.methodcaller` are three key function constructors. See " -"the :ref:`Sorting HOW TO ` for examples of how to create and " -"use key functions." +"There are several ways to create a key function. For example. the :meth:" +"`str.lower` method can serve as a key function for case insensitive sorts. " +"Alternatively, a key function can be built from a :keyword:`lambda` " +"expression such as ``lambda r: (r[0], r[2])``. Also, :func:`operator." +"attrgetter`, :func:`operator.itemgetter`, and :func:`operator.methodcaller` " +"are three key function constructors. See the :ref:`Sorting HOW TO " +"` for examples of how to create and use key functions." msgstr "" "有幾種方法可以建立一個鍵函式。例如,:meth:`str.lower` method 可以作為不分大小" "寫排序的鍵函式。或者,一個鍵函式也可以從 :keyword:`lambda` 運算式被建造,例" -"如 ``lambda r: (r[0], r[2])``。另" -"外,:func:`operator.attrgetter`、:func:`operator.itemgetter` " -"和 :func:`operator.methodcaller` 為三個鍵函式的建構函式 (constructor)。關於如" -"何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 `。" +"如 ``lambda r: (r[0], r[2])``。另外,:func:`operator.attrgetter`、:func:" +"`operator.itemgetter` 和 :func:`operator.methodcaller` 為三個鍵函式的建構函" +"式 (constructor)。關於如何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 " +"`。" -#: ../../glossary.rst:820 +#: ../../glossary.rst:822 msgid "keyword argument" msgstr "keyword argument(關鍵字引數)" -#: ../../glossary.rst:822 ../../glossary.rst:1137 +#: ../../glossary.rst:824 ../../glossary.rst:1139 msgid "See :term:`argument`." msgstr "請參閱 :term:`argument`\\ (引數)。" -#: ../../glossary.rst:823 +#: ../../glossary.rst:825 msgid "lambda" msgstr "lambda" -#: ../../glossary.rst:825 +#: ../../glossary.rst:827 msgid "" "An anonymous inline function consisting of a single :term:`expression` which " "is evaluated when the function is called. The syntax to create a lambda " @@ -1880,11 +1868,11 @@ msgstr "" "function),於該函式被呼叫時求值。建立 lambda 函式的語法是 ``lambda " "[parameters]: expression``" -#: ../../glossary.rst:828 +#: ../../glossary.rst:830 msgid "LBYL" msgstr "LBYL" -#: ../../glossary.rst:830 +#: ../../glossary.rst:832 msgid "" "Look before you leap. This coding style explicitly tests for pre-conditions " "before making calls or lookups. This style contrasts with the :term:`EAFP` " @@ -1892,10 +1880,10 @@ msgid "" "statements." msgstr "" "Look before you leap.(三思而後行。)這種編碼風格會在進行呼叫或查找之前,明確" -"地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許" -"多 :keyword:`if` 陳述式的存在。" +"地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許多 :" +"keyword:`if` 陳述式的存在。" -#: ../../glossary.rst:835 +#: ../../glossary.rst:837 msgid "" "In a multi-threaded environment, the LBYL approach can risk introducing a " "race condition between \"the looking\" and \"the leaping\". For example, " @@ -1909,19 +1897,19 @@ msgstr "" "了 *key*,則該程式碼就會失效。這個問題可以用鎖 (lock) 或使用 EAFP 編碼方式來" "解決。" -#: ../../glossary.rst:840 +#: ../../glossary.rst:842 msgid "lexical analyzer" msgstr "lexical analyzer(詞法分析器)" -#: ../../glossary.rst:843 +#: ../../glossary.rst:845 msgid "Formal name for the *tokenizer*; see :term:`token`." msgstr "tokenizer 的正式名稱;請參閱 :term:`token`。" -#: ../../glossary.rst:844 +#: ../../glossary.rst:846 msgid "list" msgstr "list(串列)" -#: ../../glossary.rst:846 +#: ../../glossary.rst:848 msgid "" "A built-in Python :term:`sequence`. Despite its name it is more akin to an " "array in other languages than to a linked list since access to elements is " @@ -1931,11 +1919,11 @@ msgstr "" "似其他語言中的一個陣列 (array) 而較不像一個鏈結串列 (linked list),因為存取元" "素的時間複雜度是 *O*\\ (1)。" -#: ../../glossary.rst:849 +#: ../../glossary.rst:851 msgid "list comprehension" msgstr "list comprehension(串列綜合運算)" -#: ../../glossary.rst:851 +#: ../../glossary.rst:853 msgid "" "A compact way to process all or part of the elements in a sequence and " "return a list with the results. ``result = ['{:#04x}'.format(x) for x in " @@ -1945,101 +1933,98 @@ msgid "" msgstr "" "一種用來處理一個序列中的全部或部分元素,並將處理結果以一個 list 回傳的簡要方" "法。``result = ['{:#04x}'.format(x) for x in range(256) if x % 2 == 0]`` 會產" -"生一個字串 list,其中包含 0 到 255 範圍內,所有偶數的十六進位數 " -"(0x..)。:keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有" -"元素都會被處理。" +"生一個字串 list,其中包含 0 到 255 範圍內,所有偶數的十六進位數 (0x..)。:" +"keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有元素都會被" +"處理。" -#: ../../glossary.rst:857 +#: ../../glossary.rst:859 msgid "loader" msgstr "loader(載入器)" -#: ../../glossary.rst:859 +#: ../../glossary.rst:861 msgid "" -"An object that loads a module. It must define the :meth:`!exec_module` " -"and :meth:`!create_module` methods to implement " -"the :class:`~importlib.abc.Loader` interface. A loader is typically returned " -"by a :term:`finder`. See also:" +"An object that loads a module. It must define the :meth:`!exec_module` and :" +"meth:`!create_module` methods to implement the :class:`~importlib.abc." +"Loader` interface. A loader is typically returned by a :term:`finder`. See " +"also:" msgstr "" "一個能夠載入模組的物件。它必須定義 :meth:`!exec_module` 和 :meth:`!" "create_module` 方法以實作 :class:`~importlib.abc.Loader` 介面。載入器通常是" "被 :term:`finder`\\ (尋檢器)回傳。更多細節請參閱:" -#: ../../glossary.rst:865 +#: ../../glossary.rst:867 msgid ":ref:`finders-and-loaders`" msgstr ":ref:`finders-and-loaders`" -#: ../../glossary.rst:866 +#: ../../glossary.rst:868 msgid ":class:`importlib.abc.Loader`" msgstr ":class:`importlib.abc.Loader`" -#: ../../glossary.rst:867 +#: ../../glossary.rst:869 msgid ":pep:`302`" msgstr ":pep:`302`" -#: ../../glossary.rst:868 +#: ../../glossary.rst:870 msgid "locale encoding" msgstr "locale encoding(區域編碼)" -#: ../../glossary.rst:870 +#: ../../glossary.rst:872 msgid "" -"On Unix, it is the encoding of the LC_CTYPE locale. It can be set " -"with :func:`locale.setlocale(locale.LC_CTYPE, new_locale) " -"`." +"On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" +"`locale.setlocale(locale.LC_CTYPE, new_locale) `." msgstr "" -"在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以" -"用 :func:`locale.setlocale(locale.LC_CTYPE, new_locale) ` " -"來設定。" +"在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以用 :func:`locale." +"setlocale(locale.LC_CTYPE, new_locale) ` 來設定。" -#: ../../glossary.rst:873 +#: ../../glossary.rst:875 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." msgstr "在 Windows 上,它是 ANSI 碼頁(code page,例如 ``\"cp1252\"``\\ )。" -#: ../../glossary.rst:875 +#: ../../glossary.rst:877 msgid "" "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "在 Android 和 VxWorks 上,Python 使用 ``\"utf-8\"`` 作為區域編碼。" -#: ../../glossary.rst:877 +#: ../../glossary.rst:879 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr ":func:`locale.getencoding` 可以用來取得區域編碼。" -#: ../../glossary.rst:879 +#: ../../glossary.rst:881 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "也請參考 :term:`filesystem encoding and error handler`。" -#: ../../glossary.rst:880 +#: ../../glossary.rst:882 msgid "magic method" msgstr "magic method(魔術方法)" -#: ../../glossary.rst:884 +#: ../../glossary.rst:886 msgid "An informal synonym for :term:`special method`." msgstr ":term:`special method`\\ (特殊方法)的一個非正式同義詞。" -#: ../../glossary.rst:885 +#: ../../glossary.rst:887 msgid "mapping" msgstr "mapping(對映)" -#: ../../glossary.rst:887 +#: ../../glossary.rst:889 msgid "" "A container object that supports arbitrary key lookups and implements the " -"methods specified in the :class:`collections.abc.Mapping` " -"or :class:`collections.abc.MutableMapping` :ref:`abstract base classes " -"`. Examples " -"include :class:`dict`, :class:`collections.defaultdict`, :class:`collections.OrderedDict` " -"and :class:`collections.Counter`." +"methods specified in the :class:`collections.abc.Mapping` or :class:" +"`collections.abc.MutableMapping` :ref:`abstract base classes `. Examples include :class:`dict`, :class:" +"`collections.defaultdict`, :class:`collections.OrderedDict` and :class:" +"`collections.Counter`." msgstr "" "一個容器物件,它支援任意鍵的查找,且能實作 :ref:`abstract base classes(抽象" -"基底類別) `\\ " -"中,:class:`collections.abc.Mapping` " -"或 :class:`collections.abc.MutableMapping` 所指定的 method。範例包" -"括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections.OrderedDict` " -"和 :class:`collections.Counter`。" +"基底類別) `\\ 中,:class:`collections." +"abc.Mapping` 或 :class:`collections.abc.MutableMapping` 所指定的 method。範例" +"包括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections." +"OrderedDict` 和 :class:`collections.Counter`。" -#: ../../glossary.rst:893 +#: ../../glossary.rst:895 msgid "meta path finder" msgstr "meta path finder(元路徑尋檢器)" -#: ../../glossary.rst:895 +#: ../../glossary.rst:897 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders ` " "相關但是不同。" -#: ../../glossary.rst:899 +#: ../../glossary.rst:901 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." msgstr "" "關於元路徑尋檢器實作的 method,請參閱 :class:`importlib.abc.MetaPathFinder`。" -#: ../../glossary.rst:901 +#: ../../glossary.rst:903 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../glossary.rst:903 +#: ../../glossary.rst:905 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -2080,31 +2065,31 @@ msgstr "" "性存取、增加執行緒安全性、追蹤物件建立、實作單例模式 (singleton),以及許多其" "他的任務。" -#: ../../glossary.rst:913 +#: ../../glossary.rst:915 msgid "More information can be found in :ref:`metaclasses`." msgstr "更多資訊可以在\\ :ref:`metaclasses`\\ 章節中找到。" -#: ../../glossary.rst:882 ../../glossary.rst:914 ../../glossary.rst:1288 +#: ../../glossary.rst:884 ../../glossary.rst:916 ../../glossary.rst:1290 msgid "method" msgstr "method(方法)" -#: ../../glossary.rst:916 +#: ../../glossary.rst:918 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " -"first :term:`argument` (which is usually called ``self``). " -"See :term:`function` and :term:`nested scope`." +"first :term:`argument` (which is usually called ``self``). See :term:" +"`function` and :term:`nested scope`." msgstr "" "一個在 class 本體內被定義的函式。如果 method 作為其 class 實例的一個屬性被呼" "叫,則它將會得到該實例物件成為它的第一個 :term:`argument`\\ (引數)(此引數" "通常被稱為 ``self``)。請參閱 :term:`function`\\ (函式)和 :term:`nested " "scope`\\ (巢狀作用域)。" -#: ../../glossary.rst:920 +#: ../../glossary.rst:922 msgid "method resolution order" msgstr "method resolution order(方法解析順序)" -#: ../../glossary.rst:922 +#: ../../glossary.rst:924 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See :ref:`python_2.3_mro` for details of the " @@ -2113,11 +2098,11 @@ msgstr "" "方法解析順序是在查找某個成員的過程中,base class(基底類別)被搜尋的順序。關" "於 Python 自 2.3 版直譯器所使用的演算法細節,請參閱 :ref:`python_2.3_mro`。" -#: ../../glossary.rst:925 +#: ../../glossary.rst:927 msgid "module" msgstr "module(模組)" -#: ../../glossary.rst:927 +#: ../../glossary.rst:929 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -2127,51 +2112,51 @@ msgstr "" "空間,它包含任意的 Python 物件。模組是藉由 :term:`importing` 的過程,被載入" "至 Python。" -#: ../../glossary.rst:931 +#: ../../glossary.rst:933 msgid "See also :term:`package`." msgstr "另請參閱 :term:`package`\\ (套件)。" -#: ../../glossary.rst:932 +#: ../../glossary.rst:934 msgid "module spec" msgstr "module spec(模組規格)" -#: ../../glossary.rst:934 +#: ../../glossary.rst:936 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." msgstr "" -"一個命名空間,它包含用於載入模組的 import 相關資訊。它" -"是 :class:`importlib.machinery.ModuleSpec` 的一個實例。" +"一個命名空間,它包含用於載入模組的 import 相關資訊。它是 :class:`importlib." +"machinery.ModuleSpec` 的一個實例。" -#: ../../glossary.rst:937 +#: ../../glossary.rst:939 msgid "See also :ref:`module-specs`." msgstr "另請參閱 :ref:`module-specs`。" -#: ../../glossary.rst:938 +#: ../../glossary.rst:940 msgid "MRO" msgstr "MRO" -#: ../../glossary.rst:940 +#: ../../glossary.rst:942 msgid "See :term:`method resolution order`." msgstr "請參閱 :term:`method resolution order`\\ (方法解析順序)。" -#: ../../glossary.rst:941 +#: ../../glossary.rst:943 msgid "mutable" msgstr "mutable(可變物件)" -#: ../../glossary.rst:943 +#: ../../glossary.rst:945 msgid "" -"Mutable objects can change their value but keep their :func:`id`. See " -"also :term:`immutable`." +"Mutable objects can change their value but keep their :func:`id`. See also :" +"term:`immutable`." msgstr "" -"可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參" -"閱 :term:`immutable`\\ (不可變物件)。" +"可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參閱 :term:" +"`immutable`\\ (不可變物件)。" -#: ../../glossary.rst:945 +#: ../../glossary.rst:947 msgid "named tuple" msgstr "named tuple(附名元組)" -#: ../../glossary.rst:947 +#: ../../glossary.rst:949 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -2181,16 +2166,16 @@ msgstr "" "索引 (indexable) 元素也可以用附名屬性來存取。這些型別或 class 也可以具有其他" "的特性。" -#: ../../glossary.rst:951 +#: ../../glossary.rst:953 msgid "" -"Several built-in types are named tuples, including the values returned " -"by :func:`time.localtime` and :func:`os.stat`. Another example " -"is :data:`sys.float_info`::" +"Several built-in types are named tuples, including the values returned by :" +"func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." +"float_info`::" msgstr "" "有些內建型別是 named tuple,包括由 :func:`time.localtime` 和 :func:`os.stat` " "回傳的值。另一個例子是 :data:`sys.float_info`: ::" -#: ../../glossary.rst:955 +#: ../../glossary.rst:957 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -2206,54 +2191,52 @@ msgstr "" ">>> isinstance(sys.float_info, tuple) # 屬於 tuple 型別\n" "True" -#: ../../glossary.rst:962 +#: ../../glossary.rst:964 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " "that inherits from :class:`tuple` and that defines named fields. Such a " -"class can be written by hand, or it can be created by " -"inheriting :class:`typing.NamedTuple`, or with the factory " -"function :func:`collections.namedtuple`. The latter techniques also add " -"some extra methods that may not be found in hand-written or built-in named " -"tuples." +"class can be written by hand, or it can be created by inheriting :class:" +"`typing.NamedTuple`, or with the factory function :func:`collections." +"namedtuple`. The latter techniques also add some extra methods that may not " +"be found in hand-written or built-in named tuples." msgstr "" "有些 named tuple 是內建型別(如上例)。或者,一個 named tuple 也可以從一個正" "規的 class 定義來建立,只要該 class 是繼承自 :class:`tuple`,且定義了附名欄" -"位 (named field) 即可。這類的 class 可以手工編寫、可以繼承" -"自 :class:`typing.NamedTuple` 來建立,也可以使用工廠函式 (factory " -"function) :func:`collections.namedtuple` 來建立。後者技術也增加了一些額外的 " -"method,這些 method 可能是在手寫或內建的 named tuple 中,無法找到的。" +"位 (named field) 即可。這類的 class 可以手工編寫、可以繼承自 :class:`typing." +"NamedTuple` 來建立,也可以使用工廠函式 (factory function) :func:`collections." +"namedtuple` 來建立。後者技術也增加了一些額外的 method,這些 method 可能是在手" +"寫或內建的 named tuple 中,無法找到的。" -#: ../../glossary.rst:970 +#: ../../glossary.rst:972 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../glossary.rst:972 +#: ../../glossary.rst:974 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " "as nested namespaces in objects (in methods). Namespaces support modularity " -"by preventing naming conflicts. For instance, the " -"functions :func:`builtins.open <.open>` and :func:`os.open` are " -"distinguished by their namespaces. Namespaces also aid readability and " -"maintainability by making it clear which module implements a function. For " -"instance, writing :func:`random.seed` or :func:`itertools.islice` makes it " -"clear that those functions are implemented by the :mod:`random` " -"and :mod:`itertools` modules, respectively." +"by preventing naming conflicts. For instance, the functions :func:`builtins." +"open <.open>` and :func:`os.open` are distinguished by their namespaces. " +"Namespaces also aid readability and maintainability by making it clear which " +"module implements a function. For instance, writing :func:`random.seed` or :" +"func:`itertools.islice` makes it clear that those functions are implemented " +"by the :mod:`random` and :mod:`itertools` modules, respectively." msgstr "" "變數被儲存的地方。命名空間是以 dictionary(字典)被實作。有區域的、全域的及內" "建的命名空間,而在物件中(在 method 中)也有巢狀的命名空間。命名空間藉由防止" -"命名衝突,來支援模組化。例如,函式 :func:`builtins.open <.open>` " -"和 :func:`os.open` 是透過它們的命名空間來區分彼此。命名空間也藉由明確地區分是" -"哪個模組在實作一個函式,來增進可讀性及可維護性。例如,寫" -"出 :func:`random.seed` 或 :func:`itertools.islice` 明確地表示,這些函式分別是" -"由 :mod:`random` 和 :mod:`itertools` 模組在實作。" +"命名衝突,來支援模組化。例如,函式 :func:`builtins.open <.open>` 和 :func:" +"`os.open` 是透過它們的命名空間來區分彼此。命名空間也藉由明確地區分是哪個模組" +"在實作一個函式,來增進可讀性及可維護性。例如,寫出 :func:`random.seed` 或 :" +"func:`itertools.islice` 明確地表示,這些函式分別是由 :mod:`random` 和 :mod:" +"`itertools` 模組在實作。" -#: ../../glossary.rst:982 +#: ../../glossary.rst:984 msgid "namespace package" msgstr "namespace package(命名空間套件)" -#: ../../glossary.rst:984 +#: ../../glossary.rst:986 msgid "" "A :term:`package` which serves only as a container for subpackages. " "Namespace packages may have no physical representation, and specifically are " @@ -2263,7 +2246,7 @@ msgstr "" "名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:`regular " "package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" -#: ../../glossary.rst:989 +#: ../../glossary.rst:991 msgid "" "Namespace packages allow several individually installable packages to have a " "common parent package. Otherwise, it is recommended to use a :term:`regular " @@ -2272,20 +2255,20 @@ msgstr "" "命名空間套件允許數個可獨立安裝的套件擁有一個共同的父套件。除此之外,建議使" "用 :term:`regular package`。" -#: ../../glossary.rst:992 +#: ../../glossary.rst:994 msgid "" "For more information, see :pep:`420` and :ref:`reference-namespace-package`." msgstr "更多資訊,請參閱 :pep:`420` 和 :ref:`reference-namespace-package`。" -#: ../../glossary.rst:994 +#: ../../glossary.rst:996 msgid "See also :term:`module`." msgstr "另請參閱 :term:`module`\\ (模組)。" -#: ../../glossary.rst:995 +#: ../../glossary.rst:997 msgid "nested scope" msgstr "nested scope(巢狀作用域)" -#: ../../glossary.rst:997 +#: ../../glossary.rst:999 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -2300,41 +2283,39 @@ msgstr "" "寫入。同樣地,全域變數是在全域命名空間中讀取及寫入。:keyword:`nonlocal` 容許" "對外層作用域進行寫入。" -#: ../../glossary.rst:1004 +#: ../../glossary.rst:1006 msgid "new-style class" msgstr "new-style class(新式類別)" -#: ../../glossary.rst:1006 +#: ../../glossary.rst:1008 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " -"versatile features like :attr:`~object.__slots__`, descriptors, " -"properties, :meth:`~object.__getattribute__`, class methods, and static " -"methods." +"versatile features like :attr:`~object.__slots__`, descriptors, properties, :" +"meth:`~object.__getattribute__`, class methods, and static methods." msgstr "" "一個舊名,它是指現在所有的 class 物件所使用的 class 風格。在早期的 Python 版" -"本中,只有新式 class 才能使用 Python 較新的、多樣的功能,像" -"是 :attr:`~object.__slots__`、描述器 (descriptor)、屬性 " -"(property)、:meth:`~object.__getattribute__`、class method(類別方法)和 " -"static method(靜態方法)。" +"本中,只有新式 class 才能使用 Python 較新的、多樣的功能,像是 :attr:`~object." +"__slots__`、描述器 (descriptor)、屬性 (property)、:meth:`~object." +"__getattribute__`、class method(類別方法)和 static method(靜態方法)。" -#: ../../glossary.rst:1011 +#: ../../glossary.rst:1013 msgid "object" msgstr "object(物件)" -#: ../../glossary.rst:1013 +#: ../../glossary.rst:1015 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." msgstr "" -"具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任" -"何 :term:`new-style class`\\ (新式類別)的最終 base class(基底類別)。" +"具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任何 :term:" +"`new-style class`\\ (新式類別)的最終 base class(基底類別)。" -#: ../../glossary.rst:1016 +#: ../../glossary.rst:1018 msgid "optimized scope" msgstr "optimized scope(最佳化作用域)" -#: ../../glossary.rst:1018 +#: ../../glossary.rst:1020 msgid "" "A scope where target local variable names are reliably known to the compiler " "when the code is compiled, allowing optimization of read and write access to " @@ -2345,11 +2326,11 @@ msgid "" "to optimized scopes." msgstr "" -#: ../../glossary.rst:1025 +#: ../../glossary.rst:1027 msgid "package" msgstr "package(套件)" -#: ../../glossary.rst:1027 +#: ../../glossary.rst:1029 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " @@ -2359,17 +2340,17 @@ msgstr "" "迴的子套件 (subpackage)。技術上而言,套件就是具有 ``__path__`` 屬性的一個 " "Python 模組。" -#: ../../glossary.rst:1031 +#: ../../glossary.rst:1033 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "" "另請參閱 :term:`regular package`\\ (正規套件)和 :term:`namespace " "package`\\ (命名空間套件)。" -#: ../../glossary.rst:1032 +#: ../../glossary.rst:1034 msgid "parameter" msgstr "parameter(參數)" -#: ../../glossary.rst:1034 +#: ../../glossary.rst:1036 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2379,7 +2360,7 @@ msgstr "" "它指明該函式能夠接受的一個 :term:`argument`\\ (引數),或在某些情況下指示多" "個引數。共有有五種不同的參數類型:" -#: ../../glossary.rst:1038 +#: ../../glossary.rst:1040 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally ` or as a :term:`keyword argument " @@ -2390,11 +2371,11 @@ msgstr "" "置 `\\ 或是作為\\ :term:`關鍵字引數 `\\ 被傳遞的引數。這" "是參數的預設類型,例如以下的 *foo* 和 *bar*: ::" -#: ../../glossary.rst:1043 +#: ../../glossary.rst:1045 msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." -#: ../../glossary.rst:1047 +#: ../../glossary.rst:1049 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2405,11 +2386,11 @@ msgstr "" "式定義的參數列表中包含一個 ``/`` 字元,就可以在該字元前面定義僅限位置參數,例" "如以下的 *posonly1* 和 *posonly2*: ::" -#: ../../glossary.rst:1052 +#: ../../glossary.rst:1054 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." -#: ../../glossary.rst:1056 +#: ../../glossary.rst:1058 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2422,11 +2403,11 @@ msgstr "" "單純的 ``*`` 字元,就可以在其後方定義僅限關鍵字參數,例如以下的 *kw_only1* " "和 *kw_only2*: ::" -#: ../../glossary.rst:1062 +#: ../../glossary.rst:1064 msgid "def func(arg, *, kw_only1, kw_only2): ..." msgstr "def func(arg, *, kw_only1, kw_only2): ..." -#: ../../glossary.rst:1064 +#: ../../glossary.rst:1066 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2438,11 +2419,11 @@ msgstr "" "數(在已被其他參數接受的任何位置引數之外)。這類參數是透過在其參數名稱字首加" "上 ``*`` 來定義的,例如以下的 *args*: ::" -#: ../../glossary.rst:1070 +#: ../../glossary.rst:1072 msgid "def func(*args, **kwargs): ..." msgstr "def func(*args, **kwargs): ..." -#: ../../glossary.rst:1072 +#: ../../glossary.rst:1074 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2453,29 +2434,29 @@ msgstr "" "已被其他參數接受的任何關鍵字引數之外)。這類參數是透過在其參數名稱字首加上 " "``**`` 來定義的,例如上面範例中的 *kwargs*。" -#: ../../glossary.rst:1078 +#: ../../glossary.rst:1080 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." msgstr "" "參數可以指明引數是選擇性的或必需的,也可以為一些選擇性的引數指定預設值。" -#: ../../glossary.rst:1081 +#: ../../glossary.rst:1083 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " -"the :class:`inspect.Parameter` class, the :ref:`function` section, " -"and :pep:`362`." +"the :class:`inspect.Parameter` class, the :ref:`function` section, and :pep:" +"`362`." msgstr "" "另請參閱術語表的 :term:`argument`\\ (引數)條目、常見問題中的\\ :ref:`引數和" "參數之間的差異 `、:class:`inspect.Parameter` " "class、:ref:`function`\\ 章節,以及 :pep:`362`。" -#: ../../glossary.rst:1085 +#: ../../glossary.rst:1087 msgid "path entry" msgstr "path entry(路徑項目)" -#: ../../glossary.rst:1087 +#: ../../glossary.rst:1089 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2483,33 +2464,33 @@ msgstr "" "在 :term:`import path`\\ (引入路徑)中的一個位置,而 :term:`path based " "finder` (基於路徑的尋檢器)會參考該位置來尋找要 import 的模組。" -#: ../../glossary.rst:1089 +#: ../../glossary.rst:1091 msgid "path entry finder" msgstr "path entry finder(路徑項目尋檢器)" -#: ../../glossary.rst:1091 +#: ../../glossary.rst:1093 msgid "" -"A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. " -"a :term:`path entry hook`) which knows how to locate modules given " -"a :term:`path entry`." +"A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" +"term:`path entry hook`) which knows how to locate modules given a :term:" +"`path entry`." msgstr "" -"被 :data:`sys.path_hooks` 中的一個可呼叫物件 (callable)(意即一" -"個 :term:`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一" -"個 :term:`path entry`\\ 定位模組。" +"被 :data:`sys.path_hooks` 中的一個可呼叫物件 (callable)(意即一個 :term:" +"`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一個 :term:" +"`path entry`\\ 定位模組。" -#: ../../glossary.rst:1095 +#: ../../glossary.rst:1097 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." msgstr "" -"關於路徑項目尋檢器實作的 method,請參" -"閱 :class:`importlib.abc.PathEntryFinder`。" +"關於路徑項目尋檢器實作的 method,請參閱 :class:`importlib.abc." +"PathEntryFinder`。" -#: ../../glossary.rst:1097 +#: ../../glossary.rst:1099 msgid "path entry hook" msgstr "path entry hook(路徑項目鉤)" -#: ../../glossary.rst:1099 +#: ../../glossary.rst:1101 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2519,11 +2500,11 @@ msgstr "" "個特定的 :term:`path entry` 中尋找模組,則會回傳一個 :term:`path entry " "finder`\\ (路徑項目尋檢器)。" -#: ../../glossary.rst:1102 +#: ../../glossary.rst:1104 msgid "path based finder" msgstr "path based finder(基於路徑的尋檢器)" -#: ../../glossary.rst:1104 +#: ../../glossary.rst:1106 msgid "" "One of the default :term:`meta path finders ` which " "searches an :term:`import path` for modules." @@ -2531,33 +2512,33 @@ msgstr "" "預設的\\ :term:`元路徑尋檢器 (meta path finder) ` 之一,它" "會在一個 :term:`import path` 中搜尋模組。" -#: ../../glossary.rst:1106 +#: ../../glossary.rst:1108 msgid "path-like object" msgstr "path-like object(類路徑物件)" -#: ../../glossary.rst:1108 +#: ../../glossary.rst:1110 msgid "" -"An object representing a file system path. A path-like object is either " -"a :class:`str` or :class:`bytes` object representing a path, or an object " -"implementing the :class:`os.PathLike` protocol. An object that supports " -"the :class:`os.PathLike` protocol can be converted to a :class:`str` " -"or :class:`bytes` file system path by calling the :func:`os.fspath` " -"function; :func:`os.fsdecode` and :func:`os.fsencode` can be used to " -"guarantee a :class:`str` or :class:`bytes` result instead, respectively. " -"Introduced by :pep:`519`." -msgstr "" -"一個表示檔案系統路徑的物件。類路徑物件可以是一個表示路徑的 :class:`str` " -"或 :class:`bytes` 物件,或是一個實作 :class:`os.PathLike` 協定的物件。透過呼" -"叫 :func:`os.fspath` 函式,一個支援 :class:`os.PathLike` 協定的物件可以被轉換" -"為 :class:`str` 或 :class:`bytes` 檔案系統路徑;而 :func:`os.fsdecode` " -"及 :func:`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結" -"果。由 :pep:`519` 引入。" - -#: ../../glossary.rst:1116 +"An object representing a file system path. A path-like object is either a :" +"class:`str` or :class:`bytes` object representing a path, or an object " +"implementing the :class:`os.PathLike` protocol. An object that supports the :" +"class:`os.PathLike` protocol can be converted to a :class:`str` or :class:" +"`bytes` file system path by calling the :func:`os.fspath` function; :func:" +"`os.fsdecode` and :func:`os.fsencode` can be used to guarantee a :class:" +"`str` or :class:`bytes` result instead, respectively. Introduced by :pep:" +"`519`." +msgstr "" +"一個表示檔案系統路徑的物件。類路徑物件可以是一個表示路徑的 :class:`str` 或 :" +"class:`bytes` 物件,或是一個實作 :class:`os.PathLike` 協定的物件。透過呼叫 :" +"func:`os.fspath` 函式,一個支援 :class:`os.PathLike` 協定的物件可以被轉換為 :" +"class:`str` 或 :class:`bytes` 檔案系統路徑;而 :func:`os.fsdecode` 及 :func:" +"`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結果。由 :" +"pep:`519` 引入。" + +#: ../../glossary.rst:1118 msgid "PEP" msgstr "PEP" -#: ../../glossary.rst:1118 +#: ../../glossary.rst:1120 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2568,7 +2549,7 @@ msgstr "" "為 Python 社群提供資訊,或是描述 Python 的一個新功能或該功能的程序和環境。" "PEP 應該要提供簡潔的技術規範以及被提案功能的運作原理。" -#: ../../glossary.rst:1124 +#: ../../glossary.rst:1126 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2580,15 +2561,15 @@ msgstr "" "已納入 Python 的設計決策的記錄,這些過程的主要機制。PEP 的作者要負責在社群內" "建立共識並記錄反對意見。" -#: ../../glossary.rst:1130 +#: ../../glossary.rst:1132 msgid "See :pep:`1`." msgstr "請參閱 :pep:`1`。" -#: ../../glossary.rst:1131 +#: ../../glossary.rst:1133 msgid "portion" msgstr "portion(部分)" -#: ../../glossary.rst:1133 +#: ../../glossary.rst:1135 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2596,15 +2577,15 @@ msgstr "" "在單一目錄中的一組檔案(也可能儲存在一個 zip 檔中),這些檔案能對一個命名空間" "套件 (namespace package) 有所貢獻,如同 :pep:`420` 中的定義。" -#: ../../glossary.rst:1135 +#: ../../glossary.rst:1137 msgid "positional argument" msgstr "positional argument(位置引數)" -#: ../../glossary.rst:1138 +#: ../../glossary.rst:1140 msgid "provisional API" msgstr "provisional API(暫行 API)" -#: ../../glossary.rst:1140 +#: ../../glossary.rst:1142 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2620,7 +2601,7 @@ msgstr "" "該介面)。這種變更並不會無端地產生——只有 API 被納入之前未察覺的嚴重基本缺陷被" "揭露時,它們才會發生。" -#: ../../glossary.rst:1149 +#: ../../glossary.rst:1151 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2629,7 +2610,7 @@ msgstr "" "即使對於暫行 API,向後不相容的變更也會被視為「最後的解決方案」——對於任何被發" "現的問題,仍然會盡可能找出一個向後相容的解決方案。" -#: ../../glossary.rst:1153 +#: ../../glossary.rst:1155 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2638,19 +2619,19 @@ msgstr "" "這個過程使得標準函式庫能隨著時間不斷進化,而避免耗費過長的時間去鎖定有問題的" "設計錯誤。請參閱 :pep:`411` 了解更多細節。" -#: ../../glossary.rst:1156 +#: ../../glossary.rst:1158 msgid "provisional package" msgstr "provisional package(暫行套件)" -#: ../../glossary.rst:1158 +#: ../../glossary.rst:1160 msgid "See :term:`provisional API`." msgstr "請參閱 :term:`provisional API`\\ (暫行 API)。" -#: ../../glossary.rst:1159 +#: ../../glossary.rst:1161 msgid "Python 3000" msgstr "Python 3000" -#: ../../glossary.rst:1161 +#: ../../glossary.rst:1163 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2659,11 +2640,11 @@ msgstr "" "Python 3.x 系列版本的暱稱(很久以前創造的,當時第 3 版的發布是在遙遠的未" "來。)也可以縮寫為「Py3k」。" -#: ../../glossary.rst:1164 +#: ../../glossary.rst:1166 msgid "Pythonic" msgstr "Pythonic(Python 風格的)" -#: ../../glossary.rst:1166 +#: ../../glossary.rst:1168 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2673,11 +2654,11 @@ msgid "" "Python sometimes use a numerical counter instead::" msgstr "" "一個想法或一段程式碼,它應用了 Python 語言最常見的慣用語,而不是使用其他語言" -"常見的概念來實作程式碼。例如,Python 中常見的一種習慣用法,是使用一" -"個 :keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並" -"沒有這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" +"常見的概念來實作程式碼。例如,Python 中常見的一種習慣用法,是使用一個 :" +"keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並沒有" +"這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" -#: ../../glossary.rst:1173 +#: ../../glossary.rst:1175 msgid "" "for i in range(len(food)):\n" " print(food[i])" @@ -2685,11 +2666,11 @@ msgstr "" "for i in range(len(food)):\n" " print(food[i])" -#: ../../glossary.rst:1176 +#: ../../glossary.rst:1178 msgid "As opposed to the cleaner, Pythonic method::" msgstr "相較之下,以下方法更簡潔、更具有 Python 風格: ::" -#: ../../glossary.rst:1178 +#: ../../glossary.rst:1180 msgid "" "for piece in food:\n" " print(piece)" @@ -2697,11 +2678,11 @@ msgstr "" "for piece in food:\n" " print(piece)" -#: ../../glossary.rst:1180 +#: ../../glossary.rst:1182 msgid "qualified name" msgstr "qualified name(限定名稱)" -#: ../../glossary.rst:1182 +#: ../../glossary.rst:1184 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2712,7 +2693,7 @@ msgstr "" "或 method 的「路徑」,如 :pep:`3155` 中的定義。對於頂層的函式和 class 而言," "限定名稱與其物件名稱相同: ::" -#: ../../glossary.rst:1187 +#: ../../glossary.rst:1189 msgid "" ">>> class C:\n" "... class D:\n" @@ -2738,16 +2719,16 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../glossary.rst:1199 +#: ../../glossary.rst:1201 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " -"dotted path to the module, including any parent packages, e.g. " -"``email.mime.text``::" +"dotted path to the module, including any parent packages, e.g. ``email.mime." +"text``::" msgstr "" "當用於引用模組時,*完全限定名稱 (fully qualified name)* 是表示該模組的完整點" "分隔路徑,包括任何的父套件,例如 ``email.mime.text``: ::" -#: ../../glossary.rst:1203 +#: ../../glossary.rst:1205 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" @@ -2757,11 +2738,11 @@ msgstr "" ">>> email.mime.text.__name__\n" "'email.mime.text'" -#: ../../glossary.rst:1206 +#: ../../glossary.rst:1208 msgid "reference count" msgstr "reference count(參照計數)" -#: ../../glossary.rst:1208 +#: ../../glossary.rst:1210 msgid "" "The number of references to an object. When the reference count of an " "object drops to zero, it is deallocated. Some objects are :term:`immortal` " @@ -2774,10 +2755,10 @@ msgstr "" "對於一個物件的參照次數。當一個物件的參照計數下降到零時,它會被解除配置 " "(deallocated)。有些物件是「\\ :term:`不滅的 ` (immortal)」並擁有不" "會被改變的參照計數,也因此永遠不會被解除配置。參照計數通常在 Python 程式碼中" -"看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼" -"叫 :func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" +"看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :" +"func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" -#: ../../glossary.rst:1217 +#: ../../glossary.rst:1219 msgid "" "In :term:`CPython`, reference counts are not considered to be stable or well-" "defined values; the number of references to an object, and how that number " @@ -2786,39 +2767,39 @@ msgstr "" "在 :term:`CPython` 中,參照計數不被視為穩定或明確定義的值;對物件的參照數量," "以及該數量如何受到 Python 程式碼的影響,在不同版本之間可能會有所不同。" -#: ../../glossary.rst:1221 +#: ../../glossary.rst:1223 msgid "regular package" msgstr "regular package(正規套件)" -#: ../../glossary.rst:1223 +#: ../../glossary.rst:1225 msgid "" -"A traditional :term:`package`, such as a directory containing an " -"``__init__.py`` file." +"A traditional :term:`package`, such as a directory containing an ``__init__." +"py`` file." msgstr "" "一個傳統的 :term:`package`\\ (套件),例如一個包含 ``__init__.py`` 檔案的目" "錄。" -#: ../../glossary.rst:1226 +#: ../../glossary.rst:1228 msgid "See also :term:`namespace package`." msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" -#: ../../glossary.rst:1227 +#: ../../glossary.rst:1229 msgid "REPL" msgstr "REPL" -#: ../../glossary.rst:1229 +#: ../../glossary.rst:1231 msgid "" -"An acronym for the \"read–eval–print loop\", another name for " -"the :term:`interactive` interpreter shell." +"An acronym for the \"read–eval–print loop\", another name for the :term:" +"`interactive` interpreter shell." msgstr "" "「read-eval-print 迴圈 (read–eval–print loop)」的縮寫,是\\ :term:`互動式 " "`\\ 直譯器 shell 的另一個名稱。" -#: ../../glossary.rst:1231 +#: ../../glossary.rst:1233 msgid "__slots__" msgstr "__slots__" -#: ../../glossary.rst:1233 +#: ../../glossary.rst:1235 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -2831,66 +2812,66 @@ msgstr "" "最好保留給那種在一個記憶體關鍵 (memory-critical) 的應用程式中存在大量實例的罕" "見情況。" -#: ../../glossary.rst:1238 +#: ../../glossary.rst:1240 msgid "sequence" msgstr "sequence(序列)" -#: ../../glossary.rst:1240 +#: ../../glossary.rst:1242 msgid "" "An :term:`iterable` which supports efficient element access using integer " -"indices via the :meth:`~object.__getitem__` special method and defines " -"a :meth:`~object.__len__` method that returns the length of the sequence. " -"Some built-in sequence types " -"are :class:`list`, :class:`str`, :class:`tuple`, and :class:`bytes`. Note " -"that :class:`dict` also supports :meth:`~object.__getitem__` and :meth:`!" -"__len__`, but is considered a mapping rather than a sequence because the " -"lookups use arbitrary :term:`hashable` keys rather than integers." +"indices via the :meth:`~object.__getitem__` special method and defines a :" +"meth:`~object.__len__` method that returns the length of the sequence. Some " +"built-in sequence types are :class:`list`, :class:`str`, :class:`tuple`, " +"and :class:`bytes`. Note that :class:`dict` also supports :meth:`~object." +"__getitem__` and :meth:`!__len__`, but is considered a mapping rather than a " +"sequence because the lookups use arbitrary :term:`hashable` keys rather than " +"integers." msgstr "" "一個 :term:`iterable`\\ (可疊代物件),它透過 :meth:`~object.__getitem__` " "special method(特殊方法),使用整數索引來支援高效率的元素存取,並定義了一" -"個 :meth:`~object.__len__` method 來回傳該序列的長度。一些內建序列型別包" -"括 :class:`list`、:class:`str`、:class:`tuple` 和 :class:`bytes`。請注意,雖" -"然 :class:`dict` 也支援 :meth:`~object.__getitem__` 和 :meth:`!__len__`,但它" -"被視為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` " -"鍵,而不是整數。" +"個 :meth:`~object.__len__` method 來回傳該序列的長度。一些內建序列型別包括 :" +"class:`list`、:class:`str`、:class:`tuple` 和 :class:`bytes`。請注意,雖然 :" +"class:`dict` 也支援 :meth:`~object.__getitem__` 和 :meth:`!__len__`,但它被視" +"為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` 鍵," +"而不是整數。" -#: ../../glossary.rst:1249 +#: ../../glossary.rst:1251 msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " -"richer interface that goes beyond just :meth:`~object.__getitem__` " -"and :meth:`~object.__len__`, " -"adding :meth:`~sequence.count`, :meth:`~sequence.index`, :meth:`~object.__contains__`, " -"and :meth:`~object.__reversed__`. Types that implement this expanded " -"interface can be registered explicitly using :func:`~abc.ABCMeta.register`. " -"For more documentation on sequence methods generally, see :ref:`Common " -"Sequence Operations `." +"richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:" +"`~object.__len__`, adding :meth:`~sequence.count`, :meth:`~sequence.index`, :" +"meth:`~object.__contains__`, and :meth:`~object.__reversed__`. Types that " +"implement this expanded interface can be registered explicitly using :func:" +"`~abc.ABCMeta.register`. For more documentation on sequence methods " +"generally, see :ref:`Common Sequence Operations `." msgstr "" "抽象基底類別 (abstract base class) :class:`collections.abc.Sequence` 定義了一" -"個更加豐富的介面,並不僅止於 :meth:`~object.__getitem__` " -"和 :meth:`~object.__len__`,還增加了 :meth:`~sequence.count`、:meth:`~sequence.index`、:meth:`~object.__contains__` 和 :meth:`~object.__reversed__`。實作此" -"擴充介面的型別,可以使用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於" -"序列方法的文件,請見\\ :ref:`常見序列操作 `。" +"個更加豐富的介面,並不僅止於 :meth:`~object.__getitem__` 和 :meth:`~object." +"__len__`,還增加了 :meth:`~sequence.count`、:meth:`~sequence.index`、:meth:" +"`~object.__contains__` 和 :meth:`~object.__reversed__`。實作此擴充介面的型" +"別,可以使用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於序列方法的文" +"件,請見\\ :ref:`常見序列操作 `。" -#: ../../glossary.rst:1259 +#: ../../glossary.rst:1261 msgid "set comprehension" msgstr "set comprehension(集合綜合運算)" -#: ../../glossary.rst:1261 +#: ../../glossary.rst:1263 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " -"not in 'abc'}`` generates the set of strings ``{'r', 'd'}``. " -"See :ref:`comprehensions`." +"not in 'abc'}`` generates the set of strings ``{'r', 'd'}``. See :ref:" +"`comprehensions`." msgstr "" "一種緊密的方法,用來處理一個可疊代物件中的全部或部分元素,並將處理結果以一個 " "set 回傳。``results = {c for c in 'abracadabra' if c not in 'abc'}`` 會產生一" "個字串 set:``{'r', 'd'}``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:1265 +#: ../../glossary.rst:1267 msgid "single dispatch" msgstr "single dispatch(單一調度)" -#: ../../glossary.rst:1267 +#: ../../glossary.rst:1269 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -2898,11 +2879,11 @@ msgstr "" ":term:`generic function`\\ (泛型函式)調度的一種形式,在此,實作的選擇是基於" "單一引數的型別。" -#: ../../glossary.rst:1269 +#: ../../glossary.rst:1271 msgid "slice" msgstr "slice(切片)" -#: ../../glossary.rst:1271 +#: ../../glossary.rst:1273 msgid "" "An object usually containing a portion of a :term:`sequence`. A slice is " "created using the subscript notation, ``[]`` with colons between numbers " @@ -2914,11 +2895,11 @@ msgstr "" "之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內部,會使" "用 :class:`slice` 物件。" -#: ../../glossary.rst:1275 +#: ../../glossary.rst:1277 msgid "soft deprecated" msgstr "soft deprecated(軟性棄用)" -#: ../../glossary.rst:1277 +#: ../../glossary.rst:1279 msgid "" "A soft deprecated API should not be used in new code, but it is safe for " "already existing code to use it. The API remains documented and tested, but " @@ -2927,13 +2908,13 @@ msgstr "" "被軟性棄用的 API 代表不應再用於新程式碼中,但在現有程式碼中繼續使用它仍會是安" "全的。API 仍會以文件記錄並會被測試,但不會被繼續改進。" -#: ../../glossary.rst:1281 +#: ../../glossary.rst:1283 msgid "" "Soft deprecation, unlike normal deprecation, does not plan on removing the " "API and will not emit warnings." msgstr "與正常棄用不同,軟性棄用沒有刪除 API 的規劃,也不會發出警告。" -#: ../../glossary.rst:1284 +#: ../../glossary.rst:1286 msgid "" "See `PEP 387: Soft Deprecation `_." @@ -2941,39 +2922,39 @@ msgstr "" "請參閱 `PEP 387:軟性棄用 `_。" -#: ../../glossary.rst:1286 +#: ../../glossary.rst:1288 msgid "special method" msgstr "special method(特殊方法)" -#: ../../glossary.rst:1290 +#: ../../glossary.rst:1292 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " -"with double underscores. Special methods are documented " -"in :ref:`specialnames`." +"with double underscores. Special methods are documented in :ref:" +"`specialnames`." msgstr "" "一種會被 Python 自動呼叫的 method,用於對某種型別執行某種運算,例如加法。這" -"種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在" -"\\ :ref:`specialnames`\\ 中有詳細說明。" +"種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在\\ :ref:" +"`specialnames`\\ 中有詳細說明。" -#: ../../glossary.rst:1294 +#: ../../glossary.rst:1296 msgid "standard library" msgstr "標準函式庫" -#: ../../glossary.rst:1296 +#: ../../glossary.rst:1298 msgid "" -"The collection of :term:`packages `, :term:`modules ` " -"and :term:`extension modules ` distributed as a part of " -"the official Python interpreter package. The exact membership of the " -"collection may vary based on platform, available system libraries, or other " -"criteria. Documentation can be found at :ref:`library-index`." +"The collection of :term:`packages `, :term:`modules ` and :" +"term:`extension modules ` distributed as a part of the " +"official Python interpreter package. The exact membership of the collection " +"may vary based on platform, available system libraries, or other criteria. " +"Documentation can be found at :ref:`library-index`." msgstr "" "包含\\ :term:`套件 `、:term:`模組 `\\ 和\\ :term:`擴充模組 " "`\\ 的集合,它們是作為官方 Python 直譯器套件的一部分來發" "行。該集合的成員可能會因平台、可用的系統函式庫或其他條件而有所不同。相關文件" "可以在 :ref:`library-index` 中找到。" -#: ../../glossary.rst:1302 +#: ../../glossary.rst:1304 msgid "" "See also :data:`sys.stdlib_module_names` for a list of all possible standard " "library module names." @@ -2981,58 +2962,58 @@ msgstr "" "請參閱 :data:`sys.stdlib_module_names` 以取得所有可能的標準函式庫模組名稱的列" "表。" -#: ../../glossary.rst:1304 +#: ../../glossary.rst:1306 msgid "statement" msgstr "statement(陳述式)" -#: ../../glossary.rst:1306 +#: ../../glossary.rst:1308 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " -"an :term:`expression` or one of several constructs with a keyword, such " -"as :keyword:`if`, :keyword:`while` or :keyword:`for`." +"an :term:`expression` or one of several constructs with a keyword, such as :" +"keyword:`if`, :keyword:`while` or :keyword:`for`." msgstr "" -"陳述式是一個套組(suite,一個程式碼「區塊」)中的一部分。陳述式可以是一" -"個 :term:`expression`\\ (運算式),或是含有關鍵字(例" -"如 :keyword:`if`、:keyword:`while` 或 :keyword:`for`\\ )的多種結構之一。" +"陳述式是一個套組(suite,一個程式碼「區塊」)中的一部分。陳述式可以是一個 :" +"term:`expression`\\ (運算式),或是含有關鍵字(例如 :keyword:`if`、:keyword:" +"`while` 或 :keyword:`for`\\ )的多種結構之一。" -#: ../../glossary.rst:1309 +#: ../../glossary.rst:1311 msgid "static type checker" msgstr "static type checker(靜態型別檢查器)" -#: ../../glossary.rst:1311 +#: ../../glossary.rst:1313 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " -"such as incorrect types. See also :term:`type hints ` and " -"the :mod:`typing` module." +"such as incorrect types. See also :term:`type hints ` and the :" +"mod:`typing` module." msgstr "" "會讀取 Python 程式碼並分析的外部工具,能夠找出錯誤,像是使用了不正確的型別。" "另請參閱\\ :term:`型別提示 (type hints) ` 以及 :mod:`typing` 模" "組。" -#: ../../glossary.rst:1314 +#: ../../glossary.rst:1316 msgid "stdlib" msgstr "stdlib(標準函式庫)" -#: ../../glossary.rst:1316 +#: ../../glossary.rst:1318 msgid "An abbreviation of :term:`standard library`." msgstr ":term:`standard library` 的縮寫。" -#: ../../glossary.rst:1317 +#: ../../glossary.rst:1319 msgid "strong reference" msgstr "strong reference(強參照)" -#: ../../glossary.rst:1319 +#: ../../glossary.rst:1321 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " -"calling :c:func:`Py_INCREF` when the reference is created and released " -"with :c:func:`Py_DECREF` when the reference is deleted." +"calling :c:func:`Py_INCREF` when the reference is created and released with :" +"c:func:`Py_DECREF` when the reference is deleted." msgstr "" "在 Python 的 C API 中,強參照是對物件的參照,該物件為持有該參照的程式碼所擁" -"有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透" -"過 :c:func:`Py_DECREF` 釋放強參照。" +"有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透過 :c:" +"func:`Py_DECREF` 釋放強參照。" -#: ../../glossary.rst:1325 +#: ../../glossary.rst:1327 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -3042,40 +3023,41 @@ msgstr "" ":c:func:`Py_NewRef` 函式可用於建立一個對物件的強參照。通常,在退出強參照的作" "用域之前,必須在該強參照上呼叫 :c:func:`Py_DECREF` 函式,以避免洩漏一個參照。" -#: ../../glossary.rst:1330 +#: ../../glossary.rst:1332 msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" -#: ../../glossary.rst:1331 +#: ../../glossary.rst:1333 msgid "t-string" msgstr "t-string(t 字串)" -#: ../../glossary.rst:1332 +#: ../../glossary.rst:1334 msgid "t-strings" msgstr "t-strings(t 字串)" -#: ../../glossary.rst:1334 +#: ../../glossary.rst:1336 msgid "" "String literals prefixed with ``t`` or ``T`` are commonly called \"t-" "strings\" which is short for :ref:`template string literals `." msgstr "" -"以 ``t`` 或 ``T`` 為前綴的字串文本通常被稱為「t 字串」,它是\\ :ref:`模板" -"化的字串文本 `\\ 的縮寫。" +"以 ``t`` 或 ``T`` 為前綴的字串文本通常被稱為「t 字串」,它是\\ :ref:`模板化的" +"字串文本 `\\ 的縮寫。" -#: ../../glossary.rst:1337 +#: ../../glossary.rst:1339 msgid "text encoding" msgstr "text encoding(文字編碼)" -#: ../../glossary.rst:1339 +#: ../../glossary.rst:1341 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " "serialized as a sequence of bytes." msgstr "" -"Python 中的字串是一個 Unicode 編碼位置 (code point) 的序列(範圍在 ``U+0000`` -- " -"``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一個位元組序列。" +"Python 中的字串是一個 Unicode 編碼位置 (code point) 的序列(範圍在 " +"``U+0000`` -- ``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一" +"個位元組序列。" -#: ../../glossary.rst:1343 +#: ../../glossary.rst:1345 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -3083,7 +3065,7 @@ msgstr "" "將一個字串序列化為位元組序列,稱為「編碼」,而從位元組序列重新建立該字串則稱" "為「解碼 (decoding)」。" -#: ../../glossary.rst:1346 +#: ../../glossary.rst:1348 msgid "" "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." @@ -3091,60 +3073,58 @@ msgstr "" "有多種不同的文字序列化編解碼器 (:ref:`codecs `),它們被統" "稱為「文字編碼」。" -#: ../../glossary.rst:1349 +#: ../../glossary.rst:1351 msgid "text file" msgstr "text file(文字檔案)" -#: ../../glossary.rst:1351 +#: ../../glossary.rst:1353 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " -"text file actually accesses a byte-oriented datastream and handles " -"the :term:`text encoding` automatically. Examples of text files are files " -"opened in text mode (``'r'`` or " -"``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and instances " -"of :class:`io.StringIO`." +"text file actually accesses a byte-oriented datastream and handles the :term:" +"`text encoding` automatically. Examples of text files are files opened in " +"text mode (``'r'`` or ``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and " +"instances of :class:`io.StringIO`." msgstr "" "一個能夠讀取和寫入 :class:`str` 物件的一個 :term:`file object`\\ (檔案物" "件)。通常,文字檔案實際上是存取位元組導向的資料流 (byte-oriented " "datastream) 並會自動處理 :term:`text encoding`\\ (文字編碼)。文字檔案的例子" -"有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔" -"案、:data:`sys.stdin`、:data:`sys.stdout` 以及 :class:`io.StringIO` 的實例。" +"有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔案、:data:`sys.stdin`、:data:" +"`sys.stdout` 以及 :class:`io.StringIO` 的實例。" -#: ../../glossary.rst:1358 +#: ../../glossary.rst:1360 msgid "" -"See also :term:`binary file` for a file object able to read and " -"write :term:`bytes-like objects `." +"See also :term:`binary file` for a file object able to read and write :term:" +"`bytes-like objects `." msgstr "" -"另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入" -"\\ :term:`類位元組串物件 (bytes-like object) ` 的檔案物" -"件。" +"另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入\\ :" +"term:`類位元組串物件 (bytes-like object) ` 的檔案物件。" -#: ../../glossary.rst:1360 +#: ../../glossary.rst:1362 msgid "thread state" msgstr "" -#: ../../glossary.rst:1363 +#: ../../glossary.rst:1365 msgid "" "The information used by the :term:`CPython` runtime to run in an OS thread. " "For example, this includes the current exception, if any, and the state of " "the bytecode interpreter." msgstr "" -#: ../../glossary.rst:1367 +#: ../../glossary.rst:1369 msgid "" "Each thread state is bound to a single OS thread, but threads may have many " "thread states available. At most, one of them may be :term:`attached " "` at once." msgstr "" -#: ../../glossary.rst:1371 +#: ../../glossary.rst:1373 msgid "" "An :term:`attached thread state` is required to call most of Python's C API, " "unless a function explicitly documents otherwise. The bytecode interpreter " "only runs under an attached thread state." msgstr "" -#: ../../glossary.rst:1375 +#: ../../glossary.rst:1377 msgid "" "Each thread state belongs to a single interpreter, but each interpreter may " "have many thread states, including multiple for the same OS thread. Thread " @@ -3153,17 +3133,17 @@ msgid "" "given moment." msgstr "" -#: ../../glossary.rst:1381 +#: ../../glossary.rst:1383 msgid "" "See :ref:`Thread State and the Global Interpreter Lock ` for more " "information." msgstr "" -#: ../../glossary.rst:1383 +#: ../../glossary.rst:1385 msgid "token" msgstr "token" -#: ../../glossary.rst:1386 +#: ../../glossary.rst:1388 msgid "" "A small unit of source code, generated by the :ref:`lexical analyzer " "` (also called the *tokenizer*). Names, numbers, strings, " @@ -3172,19 +3152,19 @@ msgstr "" "原始碼的小單位,由 :ref:`詞法分析器 ` (也稱為 *tokenizer*)產生。名" "稱、數字、字串、運算子、換行符號等都以 token 表示。" -#: ../../glossary.rst:1391 +#: ../../glossary.rst:1393 msgid "" -"The :mod:`tokenize` module exposes Python's lexical analyzer. " -"The :mod:`token` module contains information on the various types of tokens." +"The :mod:`tokenize` module exposes Python's lexical analyzer. The :mod:" +"`token` module contains information on the various types of tokens." msgstr "" ":mod:`tokenize` 模組公開了 Python 的詞法分析器。:mod:`token` 模組包含各種 " "token 類型的資訊。" -#: ../../glossary.rst:1394 +#: ../../glossary.rst:1396 msgid "triple-quoted string" msgstr "triple-quoted string(三引號內字串)" -#: ../../glossary.rst:1396 +#: ../../glossary.rst:1398 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -3199,37 +3179,36 @@ msgstr "" "中包含未跳脫 (unescaped) 的單引號和雙引號,而且它們不需使用連續字元 " "(continuation character) 就可以跨越多行,這使得它們在編寫說明字串時特別有用。" -#: ../../glossary.rst:1403 +#: ../../glossary.rst:1405 msgid "type" msgstr "type(型別)" -#: ../../glossary.rst:1405 +#: ../../glossary.rst:1407 msgid "" "The type of a Python object determines what kind of object it is; every " -"object has a type. An object's type is accessible as " -"its :attr:`~object.__class__` attribute or can be retrieved with " -"``type(obj)``." +"object has a type. An object's type is accessible as its :attr:`~object." +"__class__` attribute or can be retrieved with ``type(obj)``." msgstr "" "一個 Python 物件的型別決定了它是什麼類型的物件;每個物件都有一個型別。一個物" "件的型別可以用它的 :attr:`~object.__class__` 屬性來存取,或以 ``type(obj)`` " "來檢索。" -#: ../../glossary.rst:1409 +#: ../../glossary.rst:1411 msgid "type alias" msgstr "type alias(型別別名)" -#: ../../glossary.rst:1411 +#: ../../glossary.rst:1413 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "一個型別的同義詞,透過將型別指定給一個識別符 (identifier) 來建立。" -#: ../../glossary.rst:1413 +#: ../../glossary.rst:1415 msgid "" "Type aliases are useful for simplifying :term:`type hints `. For " "example::" msgstr "" "型別別名對於簡化\\ :term:`型別提示 (type hint) ` 很有用。例如: ::" -#: ../../glossary.rst:1416 +#: ../../glossary.rst:1418 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" @@ -3239,11 +3218,11 @@ msgstr "" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" -#: ../../glossary.rst:1420 +#: ../../glossary.rst:1422 msgid "could be made more readable like this::" msgstr "可以寫成這樣,更具有可讀性: ::" -#: ../../glossary.rst:1422 +#: ../../glossary.rst:1424 msgid "" "Color = tuple[int, int, int]\n" "\n" @@ -3255,15 +3234,15 @@ msgstr "" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" -#: ../../glossary.rst:1427 ../../glossary.rst:1441 +#: ../../glossary.rst:1429 ../../glossary.rst:1443 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "請參閱 :mod:`typing` 和 :pep:`484`,有此功能的描述。" -#: ../../glossary.rst:1428 +#: ../../glossary.rst:1430 msgid "type hint" msgstr "type hint(型別提示)" -#: ../../glossary.rst:1430 +#: ../../glossary.rst:1432 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -3271,7 +3250,7 @@ msgstr "" "一種 :term:`annotation`\\ (註釋),它指定一個變數、一個 class 屬性或一個函式" "的參數或回傳值的預期型別。" -#: ../../glossary.rst:1433 +#: ../../glossary.rst:1435 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers `. They can also aid " @@ -3281,45 +3260,45 @@ msgstr "" "(static type checkers) `\\ 很有用,並能協助 IDE 完成程式" "碼的補全 (completion) 和重構 (refactoring)。" -#: ../../glossary.rst:1437 +#: ../../glossary.rst:1439 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." msgstr "" -"全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使" -"用 :func:`typing.get_type_hints` 來存取。" +"全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使用 :func:" +"`typing.get_type_hints` 來存取。" -#: ../../glossary.rst:1442 +#: ../../glossary.rst:1444 msgid "universal newlines" msgstr "universal newlines(通用換行字元)" -#: ../../glossary.rst:1444 +#: ../../glossary.rst:1446 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " "Windows convention ``'\\r\\n'``, and the old Macintosh convention " -"``'\\r'``. See :pep:`278` and :pep:`3116`, as well " -"as :func:`bytes.splitlines` for an additional use." +"``'\\r'``. See :pep:`278` and :pep:`3116`, as well as :func:`bytes." +"splitlines` for an additional use." msgstr "" "一種解譯文字流 (text stream) 的方式,會將以下所有的情況識別為一行的結束:" "Unix 行尾慣例 ``'\\n'``、Windows 慣例 ``'\\r\\n'`` 和舊的 Macintosh 慣例 " -"``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用" -"於 :func:`bytes.splitlines` 的附加用途。" +"``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用於 :func:`bytes." +"splitlines` 的附加用途。" -#: ../../glossary.rst:1449 +#: ../../glossary.rst:1451 msgid "variable annotation" msgstr "variable annotation(變數註釋)" -#: ../../glossary.rst:1451 +#: ../../glossary.rst:1453 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "一個變數或 class 屬性的 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:1453 +#: ../../glossary.rst:1455 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "註釋變數或 class 屬性時,賦值是選擇性的: ::" -#: ../../glossary.rst:1455 +#: ../../glossary.rst:1457 msgid "" "class C:\n" " field: 'annotation'" @@ -3327,7 +3306,7 @@ msgstr "" "class C:\n" " field: 'annotation'" -#: ../../glossary.rst:1458 +#: ../../glossary.rst:1460 msgid "" "Variable annotations are usually used for :term:`type hints `: " "for example this variable is expected to take :class:`int` values::" @@ -3335,15 +3314,15 @@ msgstr "" "變數註釋通常用於\\ :term:`型別提示 (type hint) `:例如,這個變數預" "期會取得 :class:`int`\\ (整數)值: ::" -#: ../../glossary.rst:1462 +#: ../../glossary.rst:1464 msgid "count: int = 0" msgstr "count: int = 0" -#: ../../glossary.rst:1464 +#: ../../glossary.rst:1466 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "變數註釋的語法在\\ :ref:`annassign`\\ 章節有詳細的解釋。" -#: ../../glossary.rst:1466 +#: ../../glossary.rst:1468 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -3352,11 +3331,11 @@ msgstr "" "請參閱 :term:`function annotation`\\ (函式註釋)、:pep:`484` 和 :pep:`526`," "皆有此功能的描述。關於註釋的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:1470 +#: ../../glossary.rst:1472 msgid "virtual environment" msgstr "virtual environment(虛擬環境)" -#: ../../glossary.rst:1472 +#: ../../glossary.rst:1474 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -3367,38 +3346,38 @@ msgstr "" "程式得以安裝和升級 Python 發佈套件,而不會對同一個系統上運行的其他 Python 應" "用程式的行為產生干擾。" -#: ../../glossary.rst:1477 +#: ../../glossary.rst:1479 msgid "See also :mod:`venv`." msgstr "另請參閱 :mod:`venv`。" -#: ../../glossary.rst:1478 +#: ../../glossary.rst:1480 msgid "virtual machine" msgstr "virtual machine(虛擬機器)" -#: ../../glossary.rst:1480 +#: ../../glossary.rst:1482 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." msgstr "" -"一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行" -"由 :term:`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" +"一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行由 :term:" +"`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" -#: ../../glossary.rst:1482 +#: ../../glossary.rst:1484 msgid "walrus operator" msgstr "walrus operator(海象運算子)" -#: ../../glossary.rst:1484 +#: ../../glossary.rst:1486 msgid "" "A light-hearted way to refer to the :ref:`assignment expression ` operator ``:=`` because it looks a bit like a walrus if you " "turn your head." msgstr "" -#: ../../glossary.rst:1487 +#: ../../glossary.rst:1489 msgid "Zen of Python" msgstr "Zen of Python(Python 之禪)" -#: ../../glossary.rst:1489 +#: ../../glossary.rst:1491 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -3407,18 +3386,29 @@ msgstr "" "Python 設計原則與哲學的列表,其內容有助於理解和使用此語言。此列表可以透過在互" "動式提式字元後輸入「``import this``」來找到它。" -#: ../../glossary.rst:319 +#: ../../glossary.rst:24 +msgid "..." +msgstr "..." + +#: ../../glossary.rst:24 +msgid "ellipsis literal" +msgstr "刪節號字面值" + +#: ../../glossary.rst:321 msgid "C-contiguous" msgstr "C-contiguous(C 連續的)" -#: ../../glossary.rst:319 +#: ../../glossary.rst:321 msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" -#: ../../glossary.rst:882 +#: ../../glossary.rst:884 msgid "magic" msgstr "magic" -#: ../../glossary.rst:1288 +#: ../../glossary.rst:1290 msgid "special" msgstr "special" + +#~ msgid "The :const:`Ellipsis` built-in constant." +#~ msgstr "內建常數 :const:`Ellipsis`。" diff --git a/howto/enum.po b/howto/enum.po index 275ee13dff9..36d792394fa 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,6 +45,15 @@ msgid "" "... SATURDAY = 6\n" "... SUNDAY = 7" msgstr "" +">>> from enum import Enum\n" +">>> class Weekday(Enum):\n" +"... MONDAY = 1\n" +"... TUESDAY = 2\n" +"... WEDNESDAY = 3\n" +"... THURSDAY = 4\n" +"... FRIDAY = 5\n" +"... SATURDAY = 6\n" +"... SUNDAY = 7" #: ../../howto/enum.rst:28 msgid "Or perhaps the RGB primary colors::" @@ -58,6 +67,11 @@ msgid "" "... GREEN = 2\n" "... BLUE = 3" msgstr "" +">>> from enum import Enum\n" +">>> class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3" #: ../../howto/enum.rst:36 msgid "" @@ -315,15 +329,15 @@ msgstr "" #: ../../howto/enum.rst:154 msgid "" ">>> chores_for_ethan = {\n" -"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | " -"Weekday.FRIDAY,\n" +"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." +"FRIDAY,\n" "... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" msgstr "" ">>> chores_for_ethan = {\n" -"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | " -"Weekday.FRIDAY,\n" +"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." +"FRIDAY,\n" "... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" @@ -386,8 +400,8 @@ msgstr "" #: ../../howto/enum.rst:191 msgid "" -"Sometimes it's useful to access members in enumerations programmatically " -"(i.e. situations where ``Color.RED`` won't do because the exact color is not " +"Sometimes it's useful to access members in enumerations programmatically (i." +"e. situations where ``Color.RED`` won't do because the exact color is not " "known at program-writing time). ``Enum`` allows such access::" msgstr "" @@ -627,16 +641,16 @@ msgid "" ">>> list(Shape)\n" "[, , ]\n" ">>> list(Weekday)\n" -"[, , , " -", , , " -"]" +"[, , , , , , ]" msgstr "" ">>> list(Shape)\n" "[, , ]\n" ">>> list(Weekday)\n" -"[, , , " -", , , " -"]" +"[, , , , , , ]" #: ../../howto/enum.rst:319 msgid "" @@ -839,25 +853,24 @@ msgid "" "The rules for what is allowed are as follows: names that start and end with " "a single underscore are reserved by enum and cannot be used; all other " "attributes defined within an enumeration will become members of this " -"enumeration, with the exception of special methods " -"(:meth:`~object.__str__`, :meth:`~object.__add__`, etc.), descriptors " -"(methods are also descriptors), and variable names listed " -"in :attr:`~Enum._ignore_`." +"enumeration, with the exception of special methods (:meth:`~object." +"__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also " +"descriptors), and variable names listed in :attr:`~Enum._ignore_`." msgstr "" #: ../../howto/enum.rst:432 msgid "" -"Note: if your enumeration defines :meth:`~object.__new__` and/" -"or :meth:`~object.__init__`, any value(s) given to the enum member will be " -"passed into those methods. See `Planet`_ for an example." +"Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:" +"`~object.__init__`, any value(s) given to the enum member will be passed " +"into those methods. See `Planet`_ for an example." msgstr "" #: ../../howto/enum.rst:438 msgid "" "The :meth:`~object.__new__` method, if defined, is used during creation of " "the Enum members; it is then replaced by Enum's :meth:`~object.__new__` " -"which is used after class creation for lookup of existing members. " -"See :ref:`new-vs-init` for more details." +"which is used after class creation for lookup of existing members. See :ref:" +"`new-vs-init` for more details." msgstr "" #: ../../howto/enum.rst:445 @@ -939,8 +952,8 @@ msgstr "" #: ../../howto/enum.rst:486 msgid "" -"When inheriting from a :class:`~dataclasses.dataclass`, " -"the :meth:`~Enum.__repr__` omits the inherited class' name. For example::" +"When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum." +"__repr__` omits the inherited class' name. For example::" msgstr "" #: ../../howto/enum.rst:489 @@ -1041,10 +1054,9 @@ msgstr "" #: ../../howto/enum.rst:547 msgid "" -"It is possible to modify how enum members are pickled/unpickled by " -"defining :meth:`~object.__reduce_ex__` in the enumeration class. The " -"default method is by-value, but enums with complicated values may want to " -"use by-name::" +"It is possible to modify how enum members are pickled/unpickled by defining :" +"meth:`~object.__reduce_ex__` in the enumeration class. The default method " +"is by-value, but enums with complicated values may want to use by-name::" msgstr "" #: ../../howto/enum.rst:551 @@ -1153,10 +1165,10 @@ msgstr "" #: ../../howto/enum.rst:611 msgid "" -"The new pickle protocol 4 also, in some circumstances, relies " -"on :attr:`~type.__qualname__` being set to the location where pickle will be " -"able to find the class. For example, if the class was made available in " -"class SomeData in the global scope::" +"The new pickle protocol 4 also, in some circumstances, relies on :attr:" +"`~type.__qualname__` being set to the location where pickle will be able to " +"find the class. For example, if the class was made available in class " +"SomeData in the global scope::" msgstr "" #: ../../howto/enum.rst:616 @@ -1259,10 +1271,10 @@ msgstr "IntEnum" #: ../../howto/enum.rst:667 msgid "" -"The first variation of :class:`Enum` that is provided is also a subclass " -"of :class:`int`. Members of an :class:`IntEnum` can be compared to " -"integers; by extension, integer enumerations of different types can also be " -"compared to each other::" +"The first variation of :class:`Enum` that is provided is also a subclass of :" +"class:`int`. Members of an :class:`IntEnum` can be compared to integers; by " +"extension, integer enumerations of different types can also be compared to " +"each other::" msgstr "" #: ../../howto/enum.rst:672 @@ -1371,9 +1383,9 @@ msgid "" "The next variation of :class:`Enum` provided, :class:`IntFlag`, is also " "based on :class:`int`. The difference being :class:`IntFlag` members can be " "combined using the bitwise operators (&, \\|, ^, ~) and the result is still " -"an :class:`IntFlag` member, if possible. " -"Like :class:`IntEnum`, :class:`IntFlag` members are also integers and can be " -"used wherever an :class:`int` is used." +"an :class:`IntFlag` member, if possible. Like :class:`IntEnum`, :class:" +"`IntFlag` members are also integers and can be used wherever an :class:`int` " +"is used." msgstr "" #: ../../howto/enum.rst:733 @@ -1463,8 +1475,8 @@ msgstr "" #: ../../howto/enum.rst:781 msgid "" "Another important difference between :class:`IntFlag` and :class:`Enum` is " -"that if no flags are set (the value is 0), its boolean evaluation " -"is :data:`False`::" +"that if no flags are set (the value is 0), its boolean evaluation is :data:" +"`False`::" msgstr "" #: ../../howto/enum.rst:784 @@ -1532,10 +1544,10 @@ msgstr "Flag" #: ../../howto/enum.rst:817 msgid "" "The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` " -"members can be combined using the bitwise operators (&, \\|, ^, ~). " -"Unlike :class:`IntFlag`, they cannot be combined with, nor compared against, " -"any other :class:`Flag` enumeration, nor :class:`int`. While it is possible " -"to specify the values directly it is recommended to use :class:`auto` as the " +"members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :" +"class:`IntFlag`, they cannot be combined with, nor compared against, any " +"other :class:`Flag` enumeration, nor :class:`int`. While it is possible to " +"specify the values directly it is recommended to use :class:`auto` as the " "value and let :class:`Flag` select an appropriate value." msgstr "" @@ -1644,10 +1656,10 @@ msgid "" "For the majority of new code, :class:`Enum` and :class:`Flag` are strongly " "recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic " "promises of an enumeration (by being comparable to integers, and thus by " -"transitivity to other unrelated enumerations). :class:`IntEnum` " -"and :class:`IntFlag` should be used only in cases where :class:`Enum` " -"and :class:`Flag` will not do; for example, when integer constants are " -"replaced with enumerations, or for interoperability with other systems." +"transitivity to other unrelated enumerations). :class:`IntEnum` and :class:" +"`IntFlag` should be used only in cases where :class:`Enum` and :class:`Flag` " +"will not do; for example, when integer constants are replaced with " +"enumerations, or for interoperability with other systems." msgstr "" #: ../../howto/enum.rst:886 @@ -1671,8 +1683,8 @@ msgstr "" #: ../../howto/enum.rst:894 msgid "" "This demonstrates how similar derived enumerations can be defined; for " -"example a :class:`!FloatEnum` that mixes in :class:`float` instead " -"of :class:`int`." +"example a :class:`!FloatEnum` that mixes in :class:`float` instead of :class:" +"`int`." msgstr "" #: ../../howto/enum.rst:897 @@ -1681,24 +1693,24 @@ msgstr "一些規則:" #: ../../howto/enum.rst:899 msgid "" -"When subclassing :class:`Enum`, mix-in types must appear before " -"the :class:`Enum` class itself in the sequence of bases, as in " -"the :class:`IntEnum` example above." +"When subclassing :class:`Enum`, mix-in types must appear before the :class:" +"`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` " +"example above." msgstr "" #: ../../howto/enum.rst:902 msgid "" -"Mix-in types must be subclassable. For example, :class:`bool` " -"and :class:`range` are not subclassable and will throw an error during Enum " -"creation if used as the mix-in type." +"Mix-in types must be subclassable. For example, :class:`bool` and :class:" +"`range` are not subclassable and will throw an error during Enum creation if " +"used as the mix-in type." msgstr "" #: ../../howto/enum.rst:905 msgid "" "While :class:`Enum` can have members of any type, once you mix in an " -"additional type, all the members must have values of that type, " -"e.g. :class:`int` above. This restriction does not apply to mix-ins which " -"only add methods and don't specify another type." +"additional type, all the members must have values of that type, e.g. :class:" +"`int` above. This restriction does not apply to mix-ins which only add " +"methods and don't specify another type." msgstr "" #: ../../howto/enum.rst:909 @@ -1710,30 +1722,30 @@ msgstr "" #: ../../howto/enum.rst:912 msgid "" -"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or " -"a :class:`~dataclasses.dataclass`" +"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or a :class:" +"`~dataclasses.dataclass`" msgstr "" #: ../../howto/enum.rst:914 msgid "" -"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` " -"class's :meth:`~object.__str__` and :meth:`~object.__repr__` respectively; " -"other codes (such as ``%i`` or ``%h`` for IntEnum) treat the enum member as " -"its mixed-in type." +"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's :meth:" +"`~object.__str__` and :meth:`~object.__repr__` respectively; other codes " +"(such as ``%i`` or ``%h`` for IntEnum) treat the enum member as its mixed-in " +"type." msgstr "" #: ../../howto/enum.rst:917 msgid "" -":ref:`Formatted string literals `, :meth:`str.format`, " -"and :func:`format` will use the enum's :meth:`~object.__str__` method." +":ref:`Formatted string literals `, :meth:`str.format`, and :func:" +"`format` will use the enum's :meth:`~object.__str__` method." msgstr "" #: ../../howto/enum.rst:922 msgid "" "Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are " -"designed to be drop-in replacements for existing constants, " -"their :meth:`~object.__str__` method has been reset to their data " -"types' :meth:`~object.__str__` method." +"designed to be drop-in replacements for existing constants, their :meth:" +"`~object.__str__` method has been reset to their data types' :meth:`~object." +"__str__` method." msgstr "" #: ../../howto/enum.rst:930 @@ -1744,8 +1756,8 @@ msgstr "" msgid "" ":meth:`~object.__new__` must be used whenever you want to customize the " "actual value of the :class:`Enum` member. Any other modifications may go in " -"either :meth:`~object.__new__` or :meth:`~object.__init__`, " -"with :meth:`~object.__init__` being preferred." +"either :meth:`~object.__new__` or :meth:`~object.__init__`, with :meth:" +"`~object.__init__` being preferred." msgstr "" #: ../../howto/enum.rst:936 @@ -1802,9 +1814,9 @@ msgstr "" #: ../../howto/enum.rst:976 msgid "" ":meth:`~object.__new__`, if specified, must create and return the enum " -"members; it is also a very good idea to set the " -"member's :attr:`~Enum._value_` appropriately. Once all the members are " -"created it is no longer used." +"members; it is also a very good idea to set the member's :attr:`~Enum." +"_value_` appropriately. Once all the members are created it is no longer " +"used." msgstr "" #: ../../howto/enum.rst:982 @@ -1827,9 +1839,9 @@ msgstr "" #: ../../howto/enum.rst:988 msgid "" -":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or " -"a :class:`str`, that will not be transformed into members, and will be " -"removed from the final class" +":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" +"class:`str`, that will not be transformed into members, and will be removed " +"from the final class" msgstr "" #: ../../howto/enum.rst:991 @@ -1840,13 +1852,13 @@ msgstr "" #: ../../howto/enum.rst:993 msgid "" -":meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing " +":meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing " "member." msgstr "" #: ../../howto/enum.rst:995 msgid "" -":meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an " +":meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an " "existing member. See `MultiValueEnum`_ for an example." msgstr "" @@ -1973,11 +1985,11 @@ msgstr "" #: ../../howto/enum.rst:1074 msgid "" -"Enum classes that are mixed with non-:class:`Enum` types (such " -"as :class:`int`, :class:`str`, etc.) are evaluated according to the mixed-in " -"type's rules; otherwise, all members evaluate as :data:`True`. To make your " -"own enum's boolean evaluation depend on the member's value add the following " -"to your class::" +"Enum classes that are mixed with non-:class:`Enum` types (such as :class:" +"`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's " +"rules; otherwise, all members evaluate as :data:`True`. To make your own " +"enum's boolean evaluation depend on the member's value add the following to " +"your class::" msgstr "" #: ../../howto/enum.rst:1080 @@ -2230,8 +2242,8 @@ msgstr "" #: ../../howto/enum.rst:1202 msgid "" "The default for Flag is ``STRICT``, the default for ``IntFlag`` is " -"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see " -"``ssl.Options`` for an example of when ``KEEP`` is needed)." +"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl." +"Options`` for an example of when ``KEEP`` is needed)." msgstr "" #: ../../howto/enum.rst:1210 @@ -2240,8 +2252,8 @@ msgstr "Enums 和 Flags 有何不同?" #: ../../howto/enum.rst:1212 msgid "" -"Enums have a custom metaclass that affects many aspects of both " -"derived :class:`Enum` classes and their instances (members)." +"Enums have a custom metaclass that affects many aspects of both derived :" +"class:`Enum` classes and their instances (members)." msgstr "" #: ../../howto/enum.rst:1217 @@ -2250,14 +2262,14 @@ msgstr "Enum 類別" #: ../../howto/enum.rst:1219 msgid "" -"The :class:`EnumType` metaclass is responsible for providing " -"the :meth:`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " +"The :class:`EnumType` metaclass is responsible for providing the :meth:" +"`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " "and other methods that allow one to do things with an :class:`Enum` class " "that fail on a typical class, such as ``list(Color)`` or ``some_enum_var in " "Color``. :class:`EnumType` is responsible for ensuring that various other " -"methods on the final :class:`Enum` class are correct (such " -"as :meth:`~object.__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` " -"and :meth:`~object.__repr__`)." +"methods on the final :class:`Enum` class are correct (such as :meth:`~object." +"__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` and :meth:" +"`~object.__repr__`)." msgstr "" #: ../../howto/enum.rst:1228 @@ -2268,8 +2280,8 @@ msgstr "Flag 類別" msgid "" "Flags have an expanded view of aliasing: to be canonical, the value of a " "flag needs to be a power-of-two value, and not a duplicate name. So, in " -"addition to the :class:`Enum` definition of alias, a flag with no value " -"(a.k.a. ``0``) or with more than one power-of-two value (e.g. ``3``) is " +"addition to the :class:`Enum` definition of alias, a flag with no value (a.k." +"a. ``0``) or with more than one power-of-two value (e.g. ``3``) is " "considered an alias." msgstr "" @@ -2279,11 +2291,11 @@ msgstr "" #: ../../howto/enum.rst:1238 msgid "" -"The most interesting thing about enum members is that they are " -"singletons. :class:`EnumType` creates them all while it is creating the enum " -"class itself, and then puts a custom :meth:`~object.__new__` in place to " -"ensure that no new ones are ever instantiated by returning only the existing " -"member instances." +"The most interesting thing about enum members is that they are singletons. :" +"class:`EnumType` creates them all while it is creating the enum class " +"itself, and then puts a custom :meth:`~object.__new__` in place to ensure " +"that no new ones are ever instantiated by returning only the existing member " +"instances." msgstr "" #: ../../howto/enum.rst:1244 @@ -2342,11 +2354,10 @@ msgstr "" #: ../../howto/enum.rst:1273 msgid "" -"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, " -"and :class:`IntFlag` are expected to cover the majority of use-cases, they " -"cannot cover them all. Here are recipes for some different types of " -"enumerations that can be used directly, or as examples for creating one's " -"own." +"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :" +"class:`IntFlag` are expected to cover the majority of use-cases, they cannot " +"cover them all. Here are recipes for some different types of enumerations " +"that can be used directly, or as examples for creating one's own." msgstr "" #: ../../howto/enum.rst:1280 @@ -2438,8 +2449,8 @@ msgstr "" #: ../../howto/enum.rst:1323 msgid "" -"This is also a good example of why you might want to write your " -"own :meth:`~object.__repr__`::" +"This is also a good example of why you might want to write your own :meth:" +"`~object.__repr__`::" msgstr "" #: ../../howto/enum.rst:1326 @@ -2796,11 +2807,11 @@ msgid "" "... Period['day_%d' % i] = i\n" "...\n" ">>> list(Period)[:2]\n" -"[, ]\n" +"[, ]\n" ">>> list(Period)[-2:]\n" -"[, ]" +"[, ]" msgstr "" ">>> from datetime import timedelta\n" ">>> class Period(timedelta, Enum):\n" @@ -2811,11 +2822,11 @@ msgstr "" "... Period['day_%d' % i] = i\n" "...\n" ">>> list(Period)[:2]\n" -"[, ]\n" +"[, ]\n" ">>> list(Period)[-2:]\n" -"[, ]" +"[, ]" #: ../../howto/enum.rst:1558 msgid "Subclassing EnumType" diff --git a/howto/remote_debugging.po b/howto/remote_debugging.po index 2ae74b8ad27..32a5a54f6e6 100644 --- a/howto/remote_debugging.po +++ b/howto/remote_debugging.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-13 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -22,11 +22,143 @@ msgstr "" #: ../../howto/remote_debugging.rst:6 msgid "" +"This protocol enables external tools to attach to a running CPython process " +"and execute Python code remotely." +msgstr "" + +#: ../../howto/remote_debugging.rst:9 +msgid "" +"Most platforms require elevated privileges to attach to another Python " +"process." +msgstr "" + +#: ../../howto/remote_debugging.rst:14 +msgid "Permission requirements" +msgstr "" + +#: ../../howto/remote_debugging.rst:16 +msgid "" +"Attaching to a running Python process for remote debugging requires elevated " +"privileges on most platforms. The specific requirements and troubleshooting " +"steps depend on your operating system:" +msgstr "" + +#: ../../howto/remote_debugging.rst:21 +msgid "Linux" +msgstr "Linux" + +#: ../../howto/remote_debugging.rst:22 +msgid "" +"The tracer process must have the ``CAP_SYS_PTRACE`` capability or equivalent " +"privileges. You can only trace processes you own and can signal. Tracing may " +"fail if the process is already being traced, or if it is running with set-" +"user-ID or set-group-ID. Security modules like Yama may further restrict " +"tracing." +msgstr "" + +#: ../../howto/remote_debugging.rst:28 +msgid "To temporarily relax ptrace restrictions (until reboot), run:" +msgstr "" + +#: ../../howto/remote_debugging.rst:30 +msgid "``echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope``" +msgstr "" + +#: ../../howto/remote_debugging.rst:34 +msgid "" +"Disabling ``ptrace_scope`` reduces system hardening and should only be done " +"in trusted environments." +msgstr "" + +#: ../../howto/remote_debugging.rst:37 +msgid "" +"If running inside a container, use ``--cap-add=SYS_PTRACE`` or ``--" +"privileged``, and run as root if needed." +msgstr "" + +#: ../../howto/remote_debugging.rst:40 +msgid "Try re-running the command with elevated privileges:" +msgstr "" + +#: ../../howto/remote_debugging.rst:42 +msgid "``sudo -E !!``" +msgstr "``sudo -E !!``" + +#: ../../howto/remote_debugging.rst:46 +msgid "macOS" +msgstr "macOS" + +#: ../../howto/remote_debugging.rst:47 +msgid "" +"To attach to another process, you typically need to run your debugging tool " +"with elevated privileges. This can be done by using ``sudo`` or running as " +"root." +msgstr "" + +#: ../../howto/remote_debugging.rst:51 +msgid "" +"Even when attaching to processes you own, macOS may block debugging unless " +"the debugger is run with root privileges due to system security restrictions." +msgstr "" + +#: ../../howto/remote_debugging.rst:56 +msgid "Windows" +msgstr "Windows" + +#: ../../howto/remote_debugging.rst:57 +msgid "" +"To attach to another process, you usually need to run your debugging tool " +"with administrative privileges. Start the command prompt or terminal as " +"Administrator." +msgstr "" + +#: ../../howto/remote_debugging.rst:61 +msgid "" +"Some processes may still be inaccessible even with Administrator rights, " +"unless you have the ``SeDebugPrivilege`` privilege enabled." +msgstr "" + +#: ../../howto/remote_debugging.rst:64 +msgid "" +"To resolve file or folder access issues, adjust the security permissions:" +msgstr "" + +#: ../../howto/remote_debugging.rst:66 +msgid "Right-click the file or folder and select **Properties**." +msgstr "" + +#: ../../howto/remote_debugging.rst:67 +msgid "Go to the **Security** tab to view users and groups with access." +msgstr "" + +#: ../../howto/remote_debugging.rst:68 +msgid "Click **Edit** to modify permissions." +msgstr "" + +#: ../../howto/remote_debugging.rst:69 +msgid "Select your user account." +msgstr "選擇你的使用者帳戶。" + +#: ../../howto/remote_debugging.rst:70 +msgid "In **Permissions**, check **Read** or **Full control** as needed." +msgstr "" + +#: ../../howto/remote_debugging.rst:71 +msgid "Click **Apply**, then **OK** to confirm." +msgstr "點擊 **Apply**,然後點擊 **OK** 來確認。" + +#: ../../howto/remote_debugging.rst:76 +msgid "" +"Ensure you've satisfied all :ref:`permission-requirements` before proceeding." +msgstr "" + +#: ../../howto/remote_debugging.rst:78 +msgid "" "This section describes the low-level protocol that enables external tools to " "inject and execute a Python script within a running CPython process." msgstr "" -#: ../../howto/remote_debugging.rst:9 +#: ../../howto/remote_debugging.rst:81 msgid "" "This mechanism forms the basis of the :func:`sys.remote_exec` function, " "which instructs a remote Python process to execute a ``.py`` file. However, " @@ -37,14 +169,14 @@ msgid "" "of the protocol, regardless of programming language." msgstr "" -#: ../../howto/remote_debugging.rst:19 +#: ../../howto/remote_debugging.rst:91 msgid "" "The execution of the injected script depends on the interpreter reaching a " "safe evaluation point. As a result, execution may be delayed depending on " "the runtime state of the target process." msgstr "" -#: ../../howto/remote_debugging.rst:23 +#: ../../howto/remote_debugging.rst:95 msgid "" "Once injected, the script is executed by the interpreter within the target " "process the next time a safe evaluation point is reached. This approach " @@ -52,7 +184,7 @@ msgid "" "structure of the running Python application." msgstr "" -#: ../../howto/remote_debugging.rst:28 +#: ../../howto/remote_debugging.rst:100 msgid "" "Subsequent sections provide a step-by-step description of the protocol, " "including techniques for locating interpreter structures in memory, safely " @@ -61,11 +193,11 @@ msgid "" "included to clarify each operation." msgstr "" -#: ../../howto/remote_debugging.rst:35 +#: ../../howto/remote_debugging.rst:107 msgid "Locating the PyRuntime structure" msgstr "" -#: ../../howto/remote_debugging.rst:37 +#: ../../howto/remote_debugging.rst:109 msgid "" "CPython places the ``PyRuntime`` structure in a dedicated binary section to " "help external tools find it at runtime. The name and format of this section " @@ -74,14 +206,14 @@ msgid "" "structure by examining the binary on disk." msgstr "" -#: ../../howto/remote_debugging.rst:43 +#: ../../howto/remote_debugging.rst:115 msgid "" "The ``PyRuntime`` structure contains CPython’s global interpreter state and " "provides access to other internal data, including the list of interpreters, " "thread states, and debugger support fields." msgstr "" -#: ../../howto/remote_debugging.rst:47 +#: ../../howto/remote_debugging.rst:119 msgid "" "To work with a remote Python process, a debugger must first find the memory " "address of the ``PyRuntime`` structure in the target process. This address " @@ -89,66 +221,66 @@ msgid "" "where the operating system loaded the binary." msgstr "" -#: ../../howto/remote_debugging.rst:52 +#: ../../howto/remote_debugging.rst:124 msgid "" "The method for finding ``PyRuntime`` depends on the platform, but the steps " "are the same in general:" msgstr "" -#: ../../howto/remote_debugging.rst:55 +#: ../../howto/remote_debugging.rst:127 msgid "" "Find the base address where the Python binary or shared library was loaded " "in the target process." msgstr "" -#: ../../howto/remote_debugging.rst:57 +#: ../../howto/remote_debugging.rst:129 msgid "" "Use the on-disk binary to locate the offset of the ``.PyRuntime`` section." msgstr "" -#: ../../howto/remote_debugging.rst:58 +#: ../../howto/remote_debugging.rst:130 msgid "" "Add the section offset to the base address to compute the address in memory." msgstr "" -#: ../../howto/remote_debugging.rst:60 +#: ../../howto/remote_debugging.rst:132 msgid "" "The sections below explain how to do this on each supported platform and " "include example code." msgstr "" -#: ../../howto/remote_debugging.rst:64 +#: ../../howto/remote_debugging.rst:136 msgid "Linux (ELF)" -msgstr "" +msgstr "Linux (ELF)" -#: ../../howto/remote_debugging.rst:65 +#: ../../howto/remote_debugging.rst:137 msgid "To find the ``PyRuntime`` structure on Linux:" msgstr "" -#: ../../howto/remote_debugging.rst:67 +#: ../../howto/remote_debugging.rst:139 msgid "" "Read the process’s memory map (for example, ``/proc//maps``) to find " "the address where the Python executable or ``libpython`` was loaded." msgstr "" -#: ../../howto/remote_debugging.rst:69 +#: ../../howto/remote_debugging.rst:141 msgid "" -"Parse the ELF section headers in the binary to get the offset of the " -"``.PyRuntime`` section." +"Parse the ELF section headers in the binary to get the offset of the ``." +"PyRuntime`` section." msgstr "" -#: ../../howto/remote_debugging.rst:71 +#: ../../howto/remote_debugging.rst:143 msgid "" "Add that offset to the base address from step 1 to get the memory address of " "``PyRuntime``." msgstr "" -#: ../../howto/remote_debugging.rst:74 ../../howto/remote_debugging.rst:136 -#: ../../howto/remote_debugging.rst:206 ../../howto/remote_debugging.rst:475 +#: ../../howto/remote_debugging.rst:146 ../../howto/remote_debugging.rst:208 +#: ../../howto/remote_debugging.rst:278 ../../howto/remote_debugging.rst:547 msgid "The following is an example implementation::" -msgstr "" +msgstr "以下是一個範例實作: ::" -#: ../../howto/remote_debugging.rst:76 +#: ../../howto/remote_debugging.rst:148 msgid "" "def find_py_runtime_linux(pid: int) -> int:\n" " # Step 1: Try to find the Python executable in memory\n" @@ -171,7 +303,7 @@ msgid "" " return base_address + section_offset" msgstr "" -#: ../../howto/remote_debugging.rst:97 +#: ../../howto/remote_debugging.rst:169 msgid "" "On Linux systems, there are two main approaches to read memory from another " "process. The first is through the ``/proc`` filesystem, specifically by " @@ -185,7 +317,7 @@ msgid "" "multiple context switches between the tracer and tracee processes." msgstr "" -#: ../../howto/remote_debugging.rst:108 +#: ../../howto/remote_debugging.rst:180 msgid "" "For parsing ELF sections, the process involves reading and interpreting the " "ELF file format structures from the binary file on disk. The ELF header " @@ -198,34 +330,34 @@ msgid "" "memory." msgstr "" -#: ../../howto/remote_debugging.rst:117 +#: ../../howto/remote_debugging.rst:189 msgid "" "You can read more about the ELF file format in the `ELF specification " "`_." msgstr "" -#: ../../howto/remote_debugging.rst:122 +#: ../../howto/remote_debugging.rst:194 msgid "macOS (Mach-O)" -msgstr "" +msgstr "macOS (Mach-O)" -#: ../../howto/remote_debugging.rst:123 +#: ../../howto/remote_debugging.rst:195 msgid "To find the ``PyRuntime`` structure on macOS:" -msgstr "" +msgstr "在 macOS 上找 ``PyRuntime`` 結構:" -#: ../../howto/remote_debugging.rst:125 +#: ../../howto/remote_debugging.rst:197 msgid "" "Call ``task_for_pid()`` to get the ``mach_port_t`` task port for the target " "process. This handle is needed to read memory using APIs like " "``mach_vm_read_overwrite`` and ``mach_vm_region``." msgstr "" -#: ../../howto/remote_debugging.rst:128 +#: ../../howto/remote_debugging.rst:200 msgid "" "Scan the memory regions to find the one containing the Python executable or " "``libpython``." msgstr "" -#: ../../howto/remote_debugging.rst:130 +#: ../../howto/remote_debugging.rst:202 msgid "" "Load the binary file from disk and parse the Mach-O headers to find the " "section named ``PyRuntime`` in the ``__DATA`` segment. On macOS, symbol " @@ -234,7 +366,7 @@ msgid "" "is not affected." msgstr "" -#: ../../howto/remote_debugging.rst:138 +#: ../../howto/remote_debugging.rst:210 msgid "" "def find_py_runtime_macos(pid: int) -> int:\n" " # Step 1: Get access to the process's memory\n" @@ -260,7 +392,7 @@ msgid "" " return base_address + section_offset" msgstr "" -#: ../../howto/remote_debugging.rst:161 +#: ../../howto/remote_debugging.rst:233 msgid "" "On macOS, accessing another process's memory requires using Mach-O specific " "APIs and file formats. The first step is obtaining a ``task_port`` handle " @@ -269,7 +401,7 @@ msgid "" "``mach_vm_read_overwrite()``." msgstr "" -#: ../../howto/remote_debugging.rst:167 +#: ../../howto/remote_debugging.rst:239 msgid "" "The process memory can be examined using ``mach_vm_region()`` to scan " "through the virtual memory space, while ``proc_regionfilename()`` helps " @@ -278,7 +410,7 @@ msgid "" "locate the ``PyRuntime`` structure." msgstr "" -#: ../../howto/remote_debugging.rst:172 +#: ../../howto/remote_debugging.rst:244 msgid "" "The Mach-O format organizes code and data into segments and sections. The " "``PyRuntime`` structure lives in a section named ``__PyRuntime`` within the " @@ -289,22 +421,22 @@ msgid "" "section offsets from the Mach-O headers." msgstr "" -#: ../../howto/remote_debugging.rst:180 +#: ../../howto/remote_debugging.rst:252 msgid "" "Note that accessing another process's memory on macOS typically requires " "elevated privileges - either root access or special security entitlements " "granted to the debugging process." msgstr "" -#: ../../howto/remote_debugging.rst:186 +#: ../../howto/remote_debugging.rst:258 msgid "Windows (PE)" -msgstr "" +msgstr "Windows (PE)" -#: ../../howto/remote_debugging.rst:187 +#: ../../howto/remote_debugging.rst:259 msgid "To find the ``PyRuntime`` structure on Windows:" -msgstr "" +msgstr "在 Windows 上找 ``PyRuntime`` 結構:" -#: ../../howto/remote_debugging.rst:189 +#: ../../howto/remote_debugging.rst:261 msgid "" "Use the ToolHelp API to enumerate all modules loaded in the target process. " "This is done using functions such as `CreateToolhelp32Snapshot `_." msgstr "" -#: ../../howto/remote_debugging.rst:196 +#: ../../howto/remote_debugging.rst:268 msgid "" -"Identify the module corresponding to :file:`python.exe` " -"or :file:`python{XY}.dll`, where ``X`` and ``Y`` are the major and minor " -"version numbers of the Python version, and record its base address." +"Identify the module corresponding to :file:`python.exe` or :file:`python{XY}." +"dll`, where ``X`` and ``Y`` are the major and minor version numbers of the " +"Python version, and record its base address." msgstr "" -#: ../../howto/remote_debugging.rst:199 +#: ../../howto/remote_debugging.rst:271 msgid "" "Locate the ``PyRuntim`` section. Due to the PE format's 8-character limit on " "section names (defined as ``IMAGE_SIZEOF_SHORT_NAME``), the original name " @@ -330,13 +462,13 @@ msgid "" "structure." msgstr "" -#: ../../howto/remote_debugging.rst:203 +#: ../../howto/remote_debugging.rst:275 msgid "" "Retrieve the section’s relative virtual address (RVA) and add it to the base " "address of the module." msgstr "" -#: ../../howto/remote_debugging.rst:208 +#: ../../howto/remote_debugging.rst:280 msgid "" "def find_py_runtime_windows(pid: int) -> int:\n" " # Step 1: Try to find the Python executable in memory\n" @@ -360,7 +492,7 @@ msgid "" " return base_address + section_rva" msgstr "" -#: ../../howto/remote_debugging.rst:230 +#: ../../howto/remote_debugging.rst:302 msgid "" "On Windows, accessing another process's memory requires using the Windows " "API functions like ``CreateToolhelp32Snapshot()`` and ``Module32First()/" @@ -369,14 +501,14 @@ msgid "" "memory operations through ``ReadProcessMemory()``." msgstr "" -#: ../../howto/remote_debugging.rst:236 +#: ../../howto/remote_debugging.rst:308 msgid "" "The process memory can be examined by enumerating loaded modules to find the " "Python binary or DLL. When found, its PE headers need to be parsed to locate " "the ``PyRuntime`` structure." msgstr "" -#: ../../howto/remote_debugging.rst:240 +#: ../../howto/remote_debugging.rst:312 msgid "" "The PE format organizes code and data into sections. The ``PyRuntime`` " "structure lives in a section named \"PyRuntim\" (truncated from " @@ -387,25 +519,25 @@ msgid "" "address from the PE section headers." msgstr "" -#: ../../howto/remote_debugging.rst:247 +#: ../../howto/remote_debugging.rst:319 msgid "" "Note that accessing another process's memory on Windows typically requires " "appropriate privileges - either administrative access or the " "``SeDebugPrivilege`` privilege granted to the debugging process." msgstr "" -#: ../../howto/remote_debugging.rst:253 +#: ../../howto/remote_debugging.rst:325 msgid "Reading _Py_DebugOffsets" -msgstr "" +msgstr "讀取 _Py_DebugOffsets" -#: ../../howto/remote_debugging.rst:255 +#: ../../howto/remote_debugging.rst:327 msgid "" "Once the address of the ``PyRuntime`` structure has been determined, the " "next step is to read the ``_Py_DebugOffsets`` structure located at the " "beginning of the ``PyRuntime`` block." msgstr "" -#: ../../howto/remote_debugging.rst:259 +#: ../../howto/remote_debugging.rst:331 msgid "" "This structure provides version-specific field offsets that are needed to " "safely read interpreter and thread state memory. These offsets vary between " @@ -413,11 +545,11 @@ msgid "" "compatible." msgstr "" -#: ../../howto/remote_debugging.rst:263 +#: ../../howto/remote_debugging.rst:335 msgid "To read and check the debug offsets, follow these steps:" msgstr "" -#: ../../howto/remote_debugging.rst:265 +#: ../../howto/remote_debugging.rst:337 msgid "" "Read memory from the target process starting at the ``PyRuntime`` address, " "covering the same number of bytes as the ``_Py_DebugOffsets`` structure. " @@ -426,47 +558,47 @@ msgid "" "same within a given minor version, but may change in major versions." msgstr "" -#: ../../howto/remote_debugging.rst:271 +#: ../../howto/remote_debugging.rst:343 msgid "Check that the structure contains valid data:" msgstr "" -#: ../../howto/remote_debugging.rst:273 +#: ../../howto/remote_debugging.rst:345 msgid "The ``cookie`` field must match the expected debug marker." msgstr "" -#: ../../howto/remote_debugging.rst:274 +#: ../../howto/remote_debugging.rst:346 msgid "" "The ``version`` field must match the version of the Python interpreter used " "by the debugger." msgstr "" -#: ../../howto/remote_debugging.rst:276 +#: ../../howto/remote_debugging.rst:348 msgid "" "If either the debugger or the target process is using a pre-release version " "(for example, an alpha, beta, or release candidate), the versions must match " "exactly." msgstr "" -#: ../../howto/remote_debugging.rst:279 +#: ../../howto/remote_debugging.rst:351 msgid "" "The ``free_threaded`` field must have the same value in both the debugger " "and the target process." msgstr "" -#: ../../howto/remote_debugging.rst:282 +#: ../../howto/remote_debugging.rst:354 msgid "" "If the structure is valid, the offsets it contains can be used to locate " "fields in memory. If any check fails, the debugger should stop the operation " "to avoid reading memory in the wrong format." msgstr "" -#: ../../howto/remote_debugging.rst:286 +#: ../../howto/remote_debugging.rst:358 msgid "" "The following is an example implementation that reads and checks " "``_Py_DebugOffsets``::" msgstr "" -#: ../../howto/remote_debugging.rst:289 +#: ../../howto/remote_debugging.rst:361 msgid "" "def read_debug_offsets(pid: int, py_runtime_addr: int) -> DebugOffsets:\n" " # Step 1: Read memory from the target process at the PyRuntime address\n" @@ -490,11 +622,11 @@ msgid "" " return debug_offsets" msgstr "" -#: ../../howto/remote_debugging.rst:314 +#: ../../howto/remote_debugging.rst:386 msgid "**Process suspension recommended**" msgstr "" -#: ../../howto/remote_debugging.rst:316 +#: ../../howto/remote_debugging.rst:388 msgid "" "To avoid race conditions and ensure memory consistency, it is strongly " "recommended that the target process be suspended before performing any " @@ -504,14 +636,14 @@ msgid "" "memory reads or writes." msgstr "" -#: ../../howto/remote_debugging.rst:323 +#: ../../howto/remote_debugging.rst:395 msgid "" "A debugger may suspend execution by attaching to the process with ``ptrace`` " "or by sending a ``SIGSTOP`` signal. Execution should only be resumed after " "debugger-side memory operations are complete." msgstr "" -#: ../../howto/remote_debugging.rst:329 +#: ../../howto/remote_debugging.rst:401 msgid "" "Some tools, such as profilers or sampling-based debuggers, may operate on a " "running process without suspension. In such cases, tools must be explicitly " @@ -520,11 +652,11 @@ msgid "" "robust approach." msgstr "" -#: ../../howto/remote_debugging.rst:337 +#: ../../howto/remote_debugging.rst:409 msgid "Locating the interpreter and thread state" msgstr "" -#: ../../howto/remote_debugging.rst:339 +#: ../../howto/remote_debugging.rst:411 msgid "" "Before code can be injected and executed in a remote Python process, the " "debugger must choose a thread in which to schedule execution. This is " @@ -534,7 +666,7 @@ msgid "" "request execution of injected scripts." msgstr "" -#: ../../howto/remote_debugging.rst:346 +#: ../../howto/remote_debugging.rst:418 msgid "" "The ``PyThreadState`` structure represents a thread running inside a Python " "interpreter. It maintains the thread’s evaluation context and contains the " @@ -543,7 +675,7 @@ msgid "" "remotely." msgstr "" -#: ../../howto/remote_debugging.rst:351 +#: ../../howto/remote_debugging.rst:423 msgid "" "A thread is typically selected based on its role or ID. In most cases, the " "main thread is used, but some tools may target a specific thread by its " @@ -551,11 +683,11 @@ msgid "" "both the interpreter and the associated thread state structures in memory." msgstr "" -#: ../../howto/remote_debugging.rst:356 +#: ../../howto/remote_debugging.rst:428 msgid "The relevant internal structures are defined as follows:" msgstr "" -#: ../../howto/remote_debugging.rst:358 +#: ../../howto/remote_debugging.rst:430 msgid "" "``PyInterpreterState`` represents an isolated Python interpreter instance. " "Each interpreter maintains its own set of imported modules, built-in state, " @@ -563,52 +695,52 @@ msgid "" "interpreter, CPython supports multiple interpreters in the same process." msgstr "" -#: ../../howto/remote_debugging.rst:363 +#: ../../howto/remote_debugging.rst:435 msgid "" "``PyThreadState`` represents a thread running within an interpreter. It " "contains execution state and the control fields used by the debugger." msgstr "" -#: ../../howto/remote_debugging.rst:366 +#: ../../howto/remote_debugging.rst:438 msgid "To locate a thread:" msgstr "" -#: ../../howto/remote_debugging.rst:368 +#: ../../howto/remote_debugging.rst:440 msgid "" "Use the offset ``runtime_state.interpreters_head`` to obtain the address of " "the first interpreter in the ``PyRuntime`` structure. This is the entry " "point to the linked list of active interpreters." msgstr "" -#: ../../howto/remote_debugging.rst:372 +#: ../../howto/remote_debugging.rst:444 msgid "" "Use the offset ``interpreter_state.threads_main`` to access the main thread " "state associated with the selected interpreter. This is typically the most " "reliable thread to target." msgstr "" -#: ../../howto/remote_debugging.rst:376 +#: ../../howto/remote_debugging.rst:448 msgid "" -"3. Optionally, use the offset ``interpreter_state.threads_head`` to iterate " +"Optionally, use the offset ``interpreter_state.threads_head`` to iterate " "through the linked list of all thread states. Each ``PyThreadState`` " "structure contains a ``native_thread_id`` field, which may be compared to a " "target thread ID to find a specific thread." msgstr "" -#: ../../howto/remote_debugging.rst:381 +#: ../../howto/remote_debugging.rst:453 msgid "" -"1. Once a valid ``PyThreadState`` has been found, its address can be used in " +"Once a valid ``PyThreadState`` has been found, its address can be used in " "later steps of the protocol, such as writing debugger control fields and " "scheduling execution." msgstr "" -#: ../../howto/remote_debugging.rst:385 +#: ../../howto/remote_debugging.rst:457 msgid "" "The following is an example implementation that locates the main thread " "state::" msgstr "" -#: ../../howto/remote_debugging.rst:387 +#: ../../howto/remote_debugging.rst:459 msgid "" "def find_main_thread_state(\n" " pid: int, py_runtime_addr: int, debug_offsets: DebugOffsets,\n" @@ -632,13 +764,13 @@ msgid "" " return thread_state_addr" msgstr "" -#: ../../howto/remote_debugging.rst:408 +#: ../../howto/remote_debugging.rst:480 msgid "" "The following example demonstrates how to locate a thread by its native " "thread ID::" msgstr "" -#: ../../howto/remote_debugging.rst:411 +#: ../../howto/remote_debugging.rst:483 msgid "" "def find_thread_by_id(\n" " pid: int,\n" @@ -667,18 +799,18 @@ msgid "" " raise RuntimeError(\"Thread with the given ID was not found\")" msgstr "" -#: ../../howto/remote_debugging.rst:438 +#: ../../howto/remote_debugging.rst:510 msgid "" "Once a valid thread state has been located, the debugger can proceed with " "modifying its control fields and scheduling execution, as described in the " "next section." msgstr "" -#: ../../howto/remote_debugging.rst:443 +#: ../../howto/remote_debugging.rst:515 msgid "Writing control information" msgstr "" -#: ../../howto/remote_debugging.rst:445 +#: ../../howto/remote_debugging.rst:517 msgid "" "Once a valid ``PyThreadState`` structure has been identified, the debugger " "may modify control fields within it to schedule the execution of a specified " @@ -687,7 +819,7 @@ msgid "" "code at a safe point in the evaluation loop." msgstr "" -#: ../../howto/remote_debugging.rst:451 +#: ../../howto/remote_debugging.rst:523 msgid "" "Each ``PyThreadState`` contains a ``_PyRemoteDebuggerSupport`` structure " "used for communication between the debugger and the interpreter. The " @@ -695,57 +827,47 @@ msgid "" "and include the following:" msgstr "" -#: ../../howto/remote_debugging.rst:456 -msgid "" -"``debugger_script_path``: A fixed-size buffer that holds the full path to a" -msgstr "" - -#: ../../howto/remote_debugging.rst:457 +#: ../../howto/remote_debugging.rst:528 msgid "" +"``debugger_script_path``: A fixed-size buffer that holds the full path to a " "Python source file (``.py``). This file must be accessible and readable by " "the target process when execution is triggered." msgstr "" -#: ../../howto/remote_debugging.rst:460 +#: ../../howto/remote_debugging.rst:532 msgid "" -"``debugger_pending_call``: An integer flag. Setting this to ``1`` tells the" -msgstr "" - -#: ../../howto/remote_debugging.rst:461 -msgid "interpreter that a script is ready to be executed." +"``debugger_pending_call``: An integer flag. Setting this to ``1`` tells the " +"interpreter that a script is ready to be executed." msgstr "" -#: ../../howto/remote_debugging.rst:463 -msgid "``eval_breaker``: A field checked by the interpreter during execution." -msgstr "" - -#: ../../howto/remote_debugging.rst:464 +#: ../../howto/remote_debugging.rst:535 msgid "" +"``eval_breaker``: A field checked by the interpreter during execution. " "Setting bit 5 (``_PY_EVAL_PLEASE_STOP_BIT``, value ``1U << 5``) in this " "field causes the interpreter to pause and check for debugger activity." msgstr "" -#: ../../howto/remote_debugging.rst:467 +#: ../../howto/remote_debugging.rst:539 msgid "" "To complete the injection, the debugger must perform the following steps:" msgstr "" -#: ../../howto/remote_debugging.rst:469 +#: ../../howto/remote_debugging.rst:541 msgid "Write the full script path into the ``debugger_script_path`` buffer." msgstr "" -#: ../../howto/remote_debugging.rst:470 +#: ../../howto/remote_debugging.rst:542 msgid "Set ``debugger_pending_call`` to ``1``." msgstr "" -#: ../../howto/remote_debugging.rst:471 +#: ../../howto/remote_debugging.rst:543 msgid "" "Read the current value of ``eval_breaker``, set bit 5 " "(``_PY_EVAL_PLEASE_STOP_BIT``), and write the updated value back. This " "signals the interpreter to check for debugger activity." msgstr "" -#: ../../howto/remote_debugging.rst:477 +#: ../../howto/remote_debugging.rst:549 msgid "" "def inject_script(\n" " pid: int,\n" @@ -784,20 +906,20 @@ msgid "" " write_int(pid, eval_breaker_ptr, breaker)" msgstr "" -#: ../../howto/remote_debugging.rst:514 +#: ../../howto/remote_debugging.rst:586 msgid "" "Once these fields are set, the debugger may resume the process (if it was " "suspended). The interpreter will process the request at the next safe " "evaluation point, load the script from disk, and execute it." msgstr "" -#: ../../howto/remote_debugging.rst:518 +#: ../../howto/remote_debugging.rst:590 msgid "" "It is the responsibility of the debugger to ensure that the script file " "remains present and accessible to the target process during execution." msgstr "" -#: ../../howto/remote_debugging.rst:523 +#: ../../howto/remote_debugging.rst:595 msgid "" "Script execution is asynchronous. The script file cannot be deleted " "immediately after injection. The debugger should wait until the injected " @@ -808,41 +930,41 @@ msgid "" "the file is no longer needed." msgstr "" -#: ../../howto/remote_debugging.rst:532 +#: ../../howto/remote_debugging.rst:604 msgid "Summary" msgstr "" -#: ../../howto/remote_debugging.rst:534 +#: ../../howto/remote_debugging.rst:606 msgid "To inject and execute a Python script in a remote process:" msgstr "" -#: ../../howto/remote_debugging.rst:536 +#: ../../howto/remote_debugging.rst:608 msgid "Locate the ``PyRuntime`` structure in the target process’s memory." msgstr "" -#: ../../howto/remote_debugging.rst:537 +#: ../../howto/remote_debugging.rst:609 msgid "" "Read and validate the ``_Py_DebugOffsets`` structure at the beginning of " "``PyRuntime``." msgstr "" -#: ../../howto/remote_debugging.rst:539 +#: ../../howto/remote_debugging.rst:611 msgid "Use the offsets to locate a valid ``PyThreadState``." msgstr "" -#: ../../howto/remote_debugging.rst:540 +#: ../../howto/remote_debugging.rst:612 msgid "Write the path to a Python script into ``debugger_script_path``." msgstr "" -#: ../../howto/remote_debugging.rst:541 +#: ../../howto/remote_debugging.rst:613 msgid "Set the ``debugger_pending_call`` flag to ``1``." msgstr "" -#: ../../howto/remote_debugging.rst:542 +#: ../../howto/remote_debugging.rst:614 msgid "Set ``_PY_EVAL_PLEASE_STOP_BIT`` in the ``eval_breaker`` field." msgstr "" -#: ../../howto/remote_debugging.rst:543 +#: ../../howto/remote_debugging.rst:615 msgid "" "Resume the process (if suspended). The script will execute at the next safe " "evaluation point." diff --git a/library/argparse.po b/library/argparse.po index 7f010326db8..41fc0df320f 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -47,16 +47,16 @@ msgstr "教學" #: ../../library/argparse.rst:30 msgid "" "This page contains the API reference information. For a more gentle " -"introduction to Python command-line parsing, have a look at " -"the :ref:`argparse tutorial `." +"introduction to Python command-line parsing, have a look at the :ref:" +"`argparse tutorial `." msgstr "" #: ../../library/argparse.rst:34 msgid "" "The :mod:`!argparse` module makes it easy to write user-friendly command-" "line interfaces. The program defines what arguments it requires, and :mod:`!" -"argparse` will figure out how to parse those out of :data:`sys.argv`. " -"The :mod:`!argparse` module also automatically generates help and usage " +"argparse` will figure out how to parse those out of :data:`sys.argv`. The :" +"mod:`!argparse` module also automatically generates help and usage " "messages. The module will also issue errors when users give the program " "invalid arguments." msgstr "" @@ -116,8 +116,8 @@ msgstr "" #: ../../library/argparse.rst:65 msgid "" -"If you're looking for a guide about how to upgrade :mod:`optparse` code " -"to :mod:`!argparse`, see :ref:`Upgrading Optparse Code `." msgstr "" @@ -136,7 +136,8 @@ msgstr "" msgid "" "prog_ - The name of the program (default: generated from the ``__main__`` " "module attributes and ``sys.argv[0]``)" -msgstr "prog_ - 程式的名稱(預設值:從 ``__main__`` 模組屬性和 ``sys.argv[0]`` 產生)" +msgstr "" +"prog_ - 程式的名稱(預設值:從 ``__main__`` 模組屬性和 ``sys.argv[0]`` 產生)" #: ../../library/argparse.rst:86 msgid "" @@ -371,10 +372,10 @@ msgstr "" #: ../../library/argparse.rst:211 msgid "" "When a custom usage message is specified for the main parser, you may also " -"want to consider passing the ``prog`` argument " -"to :meth:`~ArgumentParser.add_subparsers` or the ``prog`` and the ``usage`` " -"arguments to :meth:`~_SubParsersAction.add_parser`, to ensure consistent " -"command prefixes and usage information across subparsers." +"want to consider passing the ``prog`` argument to :meth:`~ArgumentParser." +"add_subparsers` or the ``prog`` and the ``usage`` arguments to :meth:" +"`~_SubParsersAction.add_parser`, to ensure consistent command prefixes and " +"usage information across subparsers." msgstr "" #: ../../library/argparse.rst:221 @@ -450,11 +451,11 @@ msgstr "parents" msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " -"shared arguments and passed to ``parents=`` argument " -"to :class:`ArgumentParser` can be used. The ``parents=`` argument takes a " -"list of :class:`ArgumentParser` objects, collects all the positional and " -"optional actions from them, and adds these actions to " -"the :class:`ArgumentParser` object being constructed::" +"shared arguments and passed to ``parents=`` argument to :class:" +"`ArgumentParser` can be used. The ``parents=`` argument takes a list of :" +"class:`ArgumentParser` objects, collects all the positional and optional " +"actions from them, and adds these actions to the :class:`ArgumentParser` " +"object being constructed::" msgstr "" #: ../../library/argparse.rst:268 @@ -513,9 +514,9 @@ msgstr "" #: ../../library/argparse.rst:305 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " -"more control over how textual descriptions are displayed. By " -"default, :class:`ArgumentParser` objects line-wrap the description_ and " -"epilog_ texts in command-line help messages::" +"more control over how textual descriptions are displayed. By default, :class:" +"`ArgumentParser` objects line-wrap the description_ and epilog_ texts in " +"command-line help messages::" msgstr "" #: ../../library/argparse.rst:310 @@ -747,9 +748,9 @@ msgstr "" #: ../../library/argparse.rst:437 msgid "" -"Arguments read from a file must be one per line by default (but see " -"also :meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if " -"they were in the same place as the original file referencing argument on the " +"Arguments read from a file must be one per line by default (but see also :" +"meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " +"were in the same place as the original file referencing argument on the " "command line. So in the example above, the expression ``['-f', 'foo', " "'@args.txt']`` is considered equivalent to the expression ``['-f', 'foo', '-" "f', 'bar']``." @@ -777,10 +778,10 @@ msgstr "" #: ../../library/argparse.rst:455 msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " -"from default (e.g. :func:`locale.getpreferredencoding(False) " -"` and ``\"strict\"``) to the :term:`filesystem " -"encoding and error handler`. Arguments file should be encoded in UTF-8 " -"instead of ANSI Codepage on Windows." +"from default (e.g. :func:`locale.getpreferredencoding(False) ` and ``\"strict\"``) to the :term:`filesystem encoding " +"and error handler`. Arguments file should be encoded in UTF-8 instead of " +"ANSI Codepage on Windows." msgstr "" #: ../../library/argparse.rst:463 @@ -789,15 +790,14 @@ msgstr "argument_default" #: ../../library/argparse.rst:465 msgid "" -"Generally, argument defaults are specified either by passing a default " -"to :meth:`~ArgumentParser.add_argument` or by calling " -"the :meth:`~ArgumentParser.set_defaults` methods with a specific set of name-" -"value pairs. Sometimes however, it may be useful to specify a single parser-" -"wide default for arguments. This can be accomplished by passing the " -"``argument_default=`` keyword argument to :class:`ArgumentParser`. For " -"example, to globally suppress attribute creation " -"on :meth:`~ArgumentParser.parse_args` calls, we supply " -"``argument_default=SUPPRESS``::" +"Generally, argument defaults are specified either by passing a default to :" +"meth:`~ArgumentParser.add_argument` or by calling the :meth:`~ArgumentParser." +"set_defaults` methods with a specific set of name-value pairs. Sometimes " +"however, it may be useful to specify a single parser-wide default for " +"arguments. This can be accomplished by passing the ``argument_default=`` " +"keyword argument to :class:`ArgumentParser`. For example, to globally " +"suppress attribute creation on :meth:`~ArgumentParser.parse_args` calls, we " +"supply ``argument_default=SUPPRESS``::" msgstr "" #: ../../library/argparse.rst:474 @@ -824,9 +824,9 @@ msgstr "allow_abbrev" #: ../../library/argparse.rst:487 msgid "" -"Normally, when you pass an argument list to " -"the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " -"it :ref:`recognizes abbreviations ` of long options." +"Normally, when you pass an argument list to the :meth:`~ArgumentParser." +"parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " +"abbreviations ` of long options." msgstr "" #: ../../library/argparse.rst:491 @@ -933,8 +933,8 @@ msgstr "" #: ../../library/argparse.rst:547 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " -"This can be achieved by passing ``False`` as the ``add_help=`` argument " -"to :class:`ArgumentParser`::" +"This can be achieved by passing ``False`` as the ``add_help=`` argument to :" +"class:`ArgumentParser`::" msgstr "" #: ../../library/argparse.rst:551 @@ -985,10 +985,9 @@ msgstr "exit_on_error" #: ../../library/argparse.rst:576 msgid "" -"Normally, when you pass an invalid argument list to " -"the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " -"it will print a *message* to :data:`sys.stderr` and exit with a status code " -"of 2." +"Normally, when you pass an invalid argument list to the :meth:" +"`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " +"print a *message* to :data:`sys.stderr` and exit with a status code of 2." msgstr "" #: ../../library/argparse.rst:580 @@ -1154,8 +1153,8 @@ msgstr "" #: ../../library/argparse.rst:679 msgid "" -"dest_ - The name of the attribute to be added to the object returned " -"by :meth:`parse_args`." +"dest_ - The name of the attribute to be added to the object returned by :" +"meth:`parse_args`." msgstr "" #: ../../library/argparse.rst:682 @@ -1170,9 +1169,9 @@ msgstr "name or flags" msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " -"a list of filenames, is expected. The first arguments passed " -"to :meth:`~ArgumentParser.add_argument` must therefore be either a series of " -"flags, or a simple argument name." +"a list of filenames, is expected. The first arguments passed to :meth:" +"`~ArgumentParser.add_argument` must therefore be either a series of flags, " +"or a simple argument name." msgstr "" #: ../../library/argparse.rst:698 @@ -1322,24 +1321,24 @@ msgstr "" #: ../../library/argparse.rst:777 msgid "" -"``'append'`` - This stores a list, and appends each argument value to the " -"list. It is useful to allow an option to be specified multiple times. If the " -"default value is non-empty, the default elements will be present in the " -"parsed value for the option, with any values from the command line appended " -"after those default values. Example usage::" +"``'append'`` - This appends each argument value to a list. It is useful for " +"allowing an option to be specified multiple times. If the default value is a " +"non-empty list, the parsed value will start with the default list's elements " +"and any values from the command line will be appended after those default " +"values. Example usage::" msgstr "" #: ../../library/argparse.rst:783 msgid "" ">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument('--foo', action='append')\n" +">>> parser.add_argument('--foo', action='append', default=['0'])\n" ">>> parser.parse_args('--foo 1 --foo 2'.split())\n" -"Namespace(foo=['1', '2'])" +"Namespace(foo=['0', '1', '2'])" msgstr "" ">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument('--foo', action='append')\n" +">>> parser.add_argument('--foo', action='append', default=['0'])\n" ">>> parser.parse_args('--foo 1 --foo 2'.split())\n" -"Namespace(foo=['1', '2'])" +"Namespace(foo=['0', '1', '2'])" #: ../../library/argparse.rst:788 msgid "" @@ -1421,9 +1420,9 @@ msgstr "" #: ../../library/argparse.rst:830 msgid "" -"``'version'`` - This expects a ``version=`` keyword argument in " -"the :meth:`~ArgumentParser.add_argument` call, and prints version " -"information and exits when invoked::" +"``'version'`` - This expects a ``version=`` keyword argument in the :meth:" +"`~ArgumentParser.add_argument` call, and prints version information and " +"exits when invoked::" msgstr "" #: ../../library/argparse.rst:834 @@ -1450,10 +1449,10 @@ msgid "" "arguments (e.g. ``'store'``, ``'append'``, ``'extend'``, or custom actions " "with non-zero ``nargs``) can be used with positional arguments." msgstr "" -"你也可以傳遞一個 :class:`Action` 子類別(例" -"如 :class:`BooleanOptionalAction`)或實作相同介面的其他物件。只有會消耗命令列" -"引數的 action(例如 ``'store'``、``'append'``、``'extend'`` 或 ``nargs`` 不為" -"零的自定義 action)可以被用於位置引數。" +"你也可以傳遞一個 :class:`Action` 子類別(例如 :class:" +"`BooleanOptionalAction`)或實作相同介面的其他物件。只有會消耗命令列引數的 " +"action(例如 ``'store'``、``'append'``、``'extend'`` 或 ``nargs`` 不為零的自" +"定義 action)可以被用於位置引數。" #: ../../library/argparse.rst:846 msgid "" @@ -1666,11 +1665,10 @@ msgstr "" msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='store_const'`` or ``action='append_const'``. These actions add " -"the ``const`` value to one of the attributes of the object returned " -"by :meth:`~ArgumentParser.parse_args`. See the action_ description for " -"examples. If ``const`` is not provided " -"to :meth:`~ArgumentParser.add_argument`, it will receive a default value of " -"``None``." +"the ``const`` value to one of the attributes of the object returned by :meth:" +"`~ArgumentParser.parse_args`. See the action_ description for examples. If " +"``const`` is not provided to :meth:`~ArgumentParser.add_argument`, it will " +"receive a default value of ``None``." msgstr "" #: ../../library/argparse.rst:980 @@ -1679,8 +1677,8 @@ msgid "" "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " "argument that can be followed by zero or one command-line arguments. When " "parsing the command line, if the option string is encountered with no " -"command-line argument following it, the value of ``const`` will be assumed " -"to be ``None`` instead. See the nargs_ description for examples." +"command-line argument following it, the value from ``const`` will be used. " +"See the nargs_ description for examples." msgstr "" #: ../../library/argparse.rst:987 @@ -1696,11 +1694,11 @@ msgstr "default" #: ../../library/argparse.rst:996 msgid "" "All optional arguments and some positional arguments may be omitted at the " -"command line. The ``default`` keyword argument " -"of :meth:`~ArgumentParser.add_argument`, whose value defaults to ``None``, " -"specifies what value should be used if the command-line argument is not " -"present. For optional arguments, the ``default`` value is used when the " -"option string was not present at the command line::" +"command line. The ``default`` keyword argument of :meth:`~ArgumentParser." +"add_argument`, whose value defaults to ``None``, specifies what value should " +"be used if the command-line argument is not present. For optional arguments, " +"the ``default`` value is used when the option string was not present at the " +"command line::" msgstr "" #: ../../library/argparse.rst:1003 @@ -1741,9 +1739,8 @@ msgstr "" msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " -"conversion argument, if provided, before setting the attribute on " -"the :class:`Namespace` return value. Otherwise, the parser uses the value " -"as is::" +"conversion argument, if provided, before setting the attribute on the :class:" +"`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" #: ../../library/argparse.rst:1023 @@ -1834,9 +1831,9 @@ msgstr "" msgid "" "The argument to ``type`` can be a callable that accepts a single string or " "the name of a registered type (see :meth:`~ArgumentParser.register`) If the " -"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, " -"or :exc:`ValueError`, the exception is caught and a nicely formatted error " -"message is displayed. Other exception types are not handled." +"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" +"`ValueError`, the exception is caught and a nicely formatted error message " +"is displayed. Other exception types are not handled." msgstr "" #: ../../library/argparse.rst:1074 @@ -1905,9 +1902,9 @@ msgstr "" #: ../../library/argparse.rst:1109 msgid "" "For example, JSON or YAML conversions have complex error cases that require " -"better reporting than can be given by the ``type`` keyword. " -"A :exc:`~json.JSONDecodeError` would not be well formatted and " -"a :exc:`FileNotFoundError` exception would not be handled at all." +"better reporting than can be given by the ``type`` keyword. A :exc:`~json." +"JSONDecodeError` would not be well formatted and a :exc:`FileNotFoundError` " +"exception would not be handled at all." msgstr "" #: ../../library/argparse.rst:1114 @@ -1961,24 +1958,31 @@ msgstr "" #: ../../library/argparse.rst:1145 msgid "" -"Note that inclusion in the *choices* sequence is checked after any type_ " -"conversions have been performed, so the type of the objects in the *choices* " -"sequence should match the type_ specified." -msgstr "" - -#: ../../library/argparse.rst:1149 -msgid "" "Any sequence can be passed as the *choices* value, so :class:`list` " "objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" -#: ../../library/argparse.rst:1152 +#: ../../library/argparse.rst:1148 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: ../../library/argparse.rst:1155 +#: ../../library/argparse.rst:1151 +msgid "" +"Note that *choices* are checked after any type_ conversions have been " +"performed, so objects in *choices* should match the type_ specified. This " +"can make *choices* appear unfamiliar in usage, help, or error messages." +msgstr "" + +#: ../../library/argparse.rst:1156 +msgid "" +"To keep *choices* user-friendly, consider a custom type wrapper that " +"converts and formats values, or omit type_ and handle conversion in your " +"application code." +msgstr "" + +#: ../../library/argparse.rst:1160 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -1986,11 +1990,11 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1164 +#: ../../library/argparse.rst:1169 msgid "required" msgstr "required" -#: ../../library/argparse.rst:1166 +#: ../../library/argparse.rst:1171 msgid "" "In general, the :mod:`!argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " @@ -1998,7 +2002,7 @@ msgid "" "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1171 +#: ../../library/argparse.rst:1176 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -2016,24 +2020,24 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1179 +#: ../../library/argparse.rst:1184 msgid "" -"As the example shows, if an option is marked as " -"``required``, :meth:`~ArgumentParser.parse_args` will report an error if " -"that option is not present at the command line." +"As the example shows, if an option is marked as ``required``, :meth:" +"`~ArgumentParser.parse_args` will report an error if that option is not " +"present at the command line." msgstr "" -#: ../../library/argparse.rst:1185 +#: ../../library/argparse.rst:1190 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: ../../library/argparse.rst:1192 +#: ../../library/argparse.rst:1197 msgid "help" msgstr "help" -#: ../../library/argparse.rst:1194 +#: ../../library/argparse.rst:1199 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " @@ -2041,16 +2045,16 @@ msgid "" "each argument." msgstr "" -#: ../../library/argparse.rst:1199 +#: ../../library/argparse.rst:1204 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " "available specifiers include the program name, ``%(prog)s`` and most keyword " -"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, ``%" -"(type)s``, etc.::" +"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, " +"``%(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1204 +#: ../../library/argparse.rst:1209 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -2076,19 +2080,19 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1216 +#: ../../library/argparse.rst:1221 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: ../../library/argparse.rst:1219 +#: ../../library/argparse.rst:1224 msgid "" ":mod:`!argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1222 +#: ../../library/argparse.rst:1227 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -2106,11 +2110,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1234 +#: ../../library/argparse.rst:1239 msgid "metavar" msgstr "metavar" -#: ../../library/argparse.rst:1236 +#: ../../library/argparse.rst:1241 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, :class:`!ArgumentParser` " @@ -2122,7 +2126,7 @@ msgid "" "command-line argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1245 +#: ../../library/argparse.rst:1250 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2154,11 +2158,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1260 +#: ../../library/argparse.rst:1265 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1262 +#: ../../library/argparse.rst:1267 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2190,21 +2194,21 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1277 +#: ../../library/argparse.rst:1282 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: ../../library/argparse.rst:1281 +#: ../../library/argparse.rst:1286 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: ../../library/argparse.rst:1285 +#: ../../library/argparse.rst:1290 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2228,21 +2232,21 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1300 +#: ../../library/argparse.rst:1305 msgid "dest" msgstr "dest" -#: ../../library/argparse.rst:1302 +#: ../../library/argparse.rst:1307 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " -"attribute is determined by the ``dest`` keyword argument " -"of :meth:`~ArgumentParser.add_argument`. For positional argument actions, " -"``dest`` is normally supplied as the first argument " -"to :meth:`~ArgumentParser.add_argument`::" +"attribute is determined by the ``dest`` keyword argument of :meth:" +"`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` " +"is normally supplied as the first argument to :meth:`~ArgumentParser." +"add_argument`::" msgstr "" -#: ../../library/argparse.rst:1309 +#: ../../library/argparse.rst:1314 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2254,7 +2258,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1314 +#: ../../library/argparse.rst:1319 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2266,7 +2270,7 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1323 +#: ../../library/argparse.rst:1328 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2284,11 +2288,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1331 +#: ../../library/argparse.rst:1336 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1333 +#: ../../library/argparse.rst:1338 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2300,11 +2304,11 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1342 +#: ../../library/argparse.rst:1347 msgid "deprecated" msgstr "deprecated" -#: ../../library/argparse.rst:1344 +#: ../../library/argparse.rst:1349 msgid "" "During a project's lifetime, some arguments may need to be removed from the " "command line. Before removing them, you should inform your users that the " @@ -2315,7 +2319,7 @@ msgid "" "will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" -#: ../../library/argparse.rst:1354 +#: ../../library/argparse.rst:1359 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='snake.py')\n" @@ -2335,28 +2339,28 @@ msgstr "" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" -#: ../../library/argparse.rst:1367 +#: ../../library/argparse.rst:1372 msgid "Action classes" msgstr "Action 類別" -#: ../../library/argparse.rst:1369 +#: ../../library/argparse.rst:1374 msgid "" ":class:`!Action` classes implement the Action API, a callable which returns " "a callable which processes arguments from the command-line. Any object which " -"follows this API may be passed as the ``action`` parameter " -"to :meth:`~ArgumentParser.add_argument`." +"follows this API may be passed as the ``action`` parameter to :meth:" +"`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1378 +#: ../../library/argparse.rst:1383 msgid "" ":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " "the information needed to parse a single argument from one or more strings " "from the command line. The :class:`!Action` class must accept the two " -"positional arguments plus any keyword arguments passed " -"to :meth:`ArgumentParser.add_argument` except for the ``action`` itself." +"positional arguments plus any keyword arguments passed to :meth:" +"`ArgumentParser.add_argument` except for the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1384 +#: ../../library/argparse.rst:1389 msgid "" "Instances of :class:`!Action` (or return value of any callable to the " "``action`` parameter) should have attributes :attr:`!dest`, :attr:`!" @@ -2365,46 +2369,46 @@ msgid "" "is to call :meth:`!Action.__init__`." msgstr "" -#: ../../library/argparse.rst:1392 +#: ../../library/argparse.rst:1397 msgid "" ":class:`!Action` instances should be callable, so subclasses must override " "the :meth:`!__call__` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1395 +#: ../../library/argparse.rst:1400 msgid "" "*parser* - The :class:`ArgumentParser` object which contains this action." msgstr "" -#: ../../library/argparse.rst:1397 +#: ../../library/argparse.rst:1402 msgid "" -"*namespace* - The :class:`Namespace` object that will be returned " -"by :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to " -"this object using :func:`setattr`." +"*namespace* - The :class:`Namespace` object that will be returned by :meth:" +"`~ArgumentParser.parse_args`. Most actions add an attribute to this object " +"using :func:`setattr`." msgstr "" -#: ../../library/argparse.rst:1401 +#: ../../library/argparse.rst:1406 msgid "" "*values* - The associated command-line arguments, with any type conversions " -"applied. Type conversions are specified with the type_ keyword argument " -"to :meth:`~ArgumentParser.add_argument`." +"applied. Type conversions are specified with the type_ keyword argument to :" +"meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1405 +#: ../../library/argparse.rst:1410 msgid "" "*option_string* - The option string that was used to invoke this action. The " "``option_string`` argument is optional, and will be absent if the action is " "associated with a positional argument." msgstr "" -#: ../../library/argparse.rst:1409 +#: ../../library/argparse.rst:1414 msgid "" "The :meth:`!__call__` method may perform arbitrary actions, but will " "typically set attributes on the ``namespace`` based on ``dest`` and " "``values``." msgstr "" -#: ../../library/argparse.rst:1414 +#: ../../library/argparse.rst:1419 msgid "" ":class:`!Action` subclasses can define a :meth:`!format_usage` method that " "takes no argument and return a string which will be used when printing the " @@ -2412,7 +2416,7 @@ msgid "" "will be used." msgstr "" -#: ../../library/argparse.rst:1420 +#: ../../library/argparse.rst:1425 msgid "" "A subclass of :class:`Action` for handling boolean flags with positive and " "negative options. Adding a single argument such as ``--foo`` automatically " @@ -2420,7 +2424,7 @@ msgid "" "``False`` respectively::" msgstr "" -#: ../../library/argparse.rst:1425 +#: ../../library/argparse.rst:1430 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -2434,47 +2438,47 @@ msgstr "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" -#: ../../library/argparse.rst:1435 +#: ../../library/argparse.rst:1440 msgid "The parse_args() method" msgstr "parse_args() 方法" -#: ../../library/argparse.rst:1439 +#: ../../library/argparse.rst:1444 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1442 +#: ../../library/argparse.rst:1447 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:`!" "add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1446 +#: ../../library/argparse.rst:1451 msgid "" -"args_ - List of strings to parse. The default is taken " -"from :data:`sys.argv`." +"args_ - List of strings to parse. The default is taken from :data:`sys." +"argv`." msgstr "" -#: ../../library/argparse.rst:1449 +#: ../../library/argparse.rst:1454 msgid "" -"namespace_ - An object to take the attributes. The default is a new " -"empty :class:`Namespace` object." +"namespace_ - An object to take the attributes. The default is a new empty :" +"class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1454 +#: ../../library/argparse.rst:1459 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1456 +#: ../../library/argparse.rst:1461 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: ../../library/argparse.rst:1460 +#: ../../library/argparse.rst:1465 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2492,14 +2496,14 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1468 +#: ../../library/argparse.rst:1473 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: ../../library/argparse.rst:1472 +#: ../../library/argparse.rst:1477 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2507,13 +2511,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1475 +#: ../../library/argparse.rst:1480 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1478 +#: ../../library/argparse.rst:1483 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2521,13 +2525,13 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1481 +#: ../../library/argparse.rst:1486 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: ../../library/argparse.rst:1484 +#: ../../library/argparse.rst:1489 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='store_true')\n" @@ -2543,11 +2547,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1493 +#: ../../library/argparse.rst:1498 msgid "Invalid arguments" msgstr "無效引數" -#: ../../library/argparse.rst:1495 +#: ../../library/argparse.rst:1500 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -2555,7 +2559,7 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1500 +#: ../../library/argparse.rst:1505 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -2595,11 +2599,11 @@ msgstr "" "usage: PROG [-h] [--foo FOO] [bar]\n" "PROG: error: extra arguments found: badger" -#: ../../library/argparse.rst:1521 +#: ../../library/argparse.rst:1526 msgid "Arguments containing ``-``" msgstr "包含 ``-`` 的引數" -#: ../../library/argparse.rst:1523 +#: ../../library/argparse.rst:1528 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -2611,7 +2615,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1531 +#: ../../library/argparse.rst:1536 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2644,7 +2648,7 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -#: ../../library/argparse.rst:1561 +#: ../../library/argparse.rst:1566 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -2652,7 +2656,7 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1566 +#: ../../library/argparse.rst:1571 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -2660,24 +2664,24 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1569 +#: ../../library/argparse.rst:1574 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" -#: ../../library/argparse.rst:1575 +#: ../../library/argparse.rst:1580 msgid "Argument abbreviations (prefix matching)" msgstr "引數縮寫 (前綴匹配)" -#: ../../library/argparse.rst:1577 +#: ../../library/argparse.rst:1582 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: ../../library/argparse.rst:1581 +#: ../../library/argparse.rst:1586 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2701,17 +2705,17 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1592 +#: ../../library/argparse.rst:1597 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: ../../library/argparse.rst:1598 +#: ../../library/argparse.rst:1603 msgid "Beyond ``sys.argv``" -msgstr "" +msgstr "``sys.argv`` 之外" -#: ../../library/argparse.rst:1600 +#: ../../library/argparse.rst:1605 msgid "" "Sometimes it may be useful to have an :class:`ArgumentParser` parse " "arguments other than those of :data:`sys.argv`. This can be accomplished by " @@ -2719,7 +2723,7 @@ msgid "" "useful for testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1605 +#: ../../library/argparse.rst:1610 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -2745,24 +2749,24 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1620 +#: ../../library/argparse.rst:1625 msgid "The Namespace object" msgstr "命名空間物件" -#: ../../library/argparse.rst:1624 +#: ../../library/argparse.rst:1629 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1627 +#: ../../library/argparse.rst:1632 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: ../../library/argparse.rst:1631 +#: ../../library/argparse.rst:1636 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2776,14 +2780,14 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1637 +#: ../../library/argparse.rst:1642 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:1641 +#: ../../library/argparse.rst:1646 msgid "" ">>> class C:\n" "... pass\n" @@ -2805,93 +2809,92 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1653 +#: ../../library/argparse.rst:1658 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1656 +#: ../../library/argparse.rst:1661 msgid "Sub-commands" msgstr "子命令" -#: ../../library/argparse.rst:1663 +#: ../../library/argparse.rst:1668 msgid "" "Many programs split up their functionality into a number of subcommands, for " "example, the ``svn`` program can invoke subcommands like ``svn checkout``, " "``svn update``, and ``svn commit``. Splitting up functionality this way can " "be a particularly good idea when a program performs several different " -"functions which require different kinds of command-line " -"arguments. :class:`ArgumentParser` supports the creation of such subcommands " -"with the :meth:`!add_subparsers` method. The :meth:`!add_subparsers` method " -"is normally called with no arguments and returns a special action object. " -"This object has a single method, :meth:`~_SubParsersAction.add_parser`, " -"which takes a command name and any :class:`!ArgumentParser` constructor " -"arguments, and returns an :class:`!ArgumentParser` object that can be " -"modified as usual." +"functions which require different kinds of command-line arguments. :class:" +"`ArgumentParser` supports the creation of such subcommands with the :meth:`!" +"add_subparsers` method. The :meth:`!add_subparsers` method is normally " +"called with no arguments and returns a special action object. This object " +"has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a " +"command name and any :class:`!ArgumentParser` constructor arguments, and " +"returns an :class:`!ArgumentParser` object that can be modified as usual." msgstr "" -#: ../../library/argparse.rst:1675 +#: ../../library/argparse.rst:1680 msgid "Description of parameters:" msgstr "參數的解釋:" -#: ../../library/argparse.rst:1677 +#: ../../library/argparse.rst:1682 msgid "" "*title* - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: ../../library/argparse.rst:1681 +#: ../../library/argparse.rst:1686 msgid "" "*description* - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1684 +#: ../../library/argparse.rst:1689 msgid "" "*prog* - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1688 +#: ../../library/argparse.rst:1693 msgid "" "*parser_class* - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. :class:`ArgumentParser`)" msgstr "" -#: ../../library/argparse.rst:1691 +#: ../../library/argparse.rst:1696 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1694 +#: ../../library/argparse.rst:1699 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1697 +#: ../../library/argparse.rst:1702 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1700 +#: ../../library/argparse.rst:1705 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1702 +#: ../../library/argparse.rst:1707 msgid "" "metavar_ - string presenting available subcommands in help; by default it is " "``None`` and presents subcommands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1705 +#: ../../library/argparse.rst:1710 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1707 +#: ../../library/argparse.rst:1712 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -2914,7 +2917,7 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -#: ../../library/argparse.rst:1726 +#: ../../library/argparse.rst:1731 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -2924,7 +2927,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1733 +#: ../../library/argparse.rst:1738 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -2933,7 +2936,7 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1741 +#: ../../library/argparse.rst:1746 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -2991,14 +2994,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1769 +#: ../../library/argparse.rst:1774 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: ../../library/argparse.rst:1773 +#: ../../library/argparse.rst:1778 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -3034,7 +3037,7 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1790 +#: ../../library/argparse.rst:1795 msgid "" "Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " "*aliases* argument, which allows multiple strings to refer to the same " @@ -3042,7 +3045,7 @@ msgid "" "``checkout``::" msgstr "" -#: ../../library/argparse.rst:1795 +#: ../../library/argparse.rst:1800 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -3058,13 +3061,13 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1802 +#: ../../library/argparse.rst:1807 msgid "" ":meth:`~_SubParsersAction.add_parser` supports also an additional " "*deprecated* argument, which allows to deprecate the subparser." msgstr "" -#: ../../library/argparse.rst:1816 +#: ../../library/argparse.rst:1821 msgid "" "One particularly effective way of handling subcommands is to combine the use " "of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so " @@ -3072,7 +3075,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1821 +#: ../../library/argparse.rst:1826 msgid "" ">>> # subcommand functions\n" ">>> def foo(args):\n" @@ -3107,7 +3110,7 @@ msgid "" "((XYZYX))" msgstr "" -#: ../../library/argparse.rst:1853 +#: ../../library/argparse.rst:1858 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -3117,7 +3120,7 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1860 +#: ../../library/argparse.rst:1865 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -3137,30 +3140,30 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1869 +#: ../../library/argparse.rst:1874 msgid "New *required* keyword-only parameter." msgstr "" -#: ../../library/argparse.rst:1872 +#: ../../library/argparse.rst:1877 msgid "" "Subparser's *prog* is no longer affected by a custom usage message in the " "main parser." msgstr "" -#: ../../library/argparse.rst:1878 +#: ../../library/argparse.rst:1883 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1882 +#: ../../library/argparse.rst:1887 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " -"argument of :meth:`ArgumentParser.add_argument`. Arguments that " -"have :class:`FileType` objects as their type will open command-line " -"arguments as files with the requested modes, buffer sizes, encodings and " -"error handling (see the :func:`open` function for more details)::" +"argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" +"`FileType` objects as their type will open command-line arguments as files " +"with the requested modes, buffer sizes, encodings and error handling (see " +"the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1888 +#: ../../library/argparse.rst:1893 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -3178,14 +3181,14 @@ msgstr "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" -#: ../../library/argparse.rst:1894 +#: ../../library/argparse.rst:1899 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -#: ../../library/argparse.rst:1898 +#: ../../library/argparse.rst:1903 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -3197,7 +3200,7 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1905 +#: ../../library/argparse.rst:1910 msgid "" "If one argument uses *FileType* and then a subsequent argument fails, an " "error is reported but the file is not automatically closed. This can also " @@ -3206,15 +3209,15 @@ msgid "" "manage the files." msgstr "" -#: ../../library/argparse.rst:1911 +#: ../../library/argparse.rst:1916 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: ../../library/argparse.rst:1918 +#: ../../library/argparse.rst:1923 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1923 +#: ../../library/argparse.rst:1928 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " @@ -3223,7 +3226,7 @@ msgid "" "method::" msgstr "" -#: ../../library/argparse.rst:1929 +#: ../../library/argparse.rst:1934 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3247,18 +3250,18 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:1940 +#: ../../library/argparse.rst:1945 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " -"has an :meth:`~ArgumentParser.add_argument` method just like a " -"regular :class:`ArgumentParser`. When an argument is added to the group, " -"the parser treats it just like a normal argument, but displays the argument " -"in a separate group for help messages. The :meth:`!add_argument_group` " -"method accepts *title* and *description* arguments which can be used to " -"customize this display::" +"has an :meth:`~ArgumentParser.add_argument` method just like a regular :" +"class:`ArgumentParser`. When an argument is added to the group, the parser " +"treats it just like a normal argument, but displays the argument in a " +"separate group for help messages. The :meth:`!add_argument_group` method " +"accepts *title* and *description* arguments which can be used to customize " +"this display::" msgstr "" -#: ../../library/argparse.rst:1948 +#: ../../library/argparse.rst:1953 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3296,44 +3299,44 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1966 +#: ../../library/argparse.rst:1971 msgid "" "The optional, keyword-only parameters argument_default_ and " "conflict_handler_ allow for finer-grained control of the behavior of the " -"argument group. These parameters have the same meaning as in " -"the :class:`ArgumentParser` constructor, but apply specifically to the " -"argument group rather than the entire parser." +"argument group. These parameters have the same meaning as in the :class:" +"`ArgumentParser` constructor, but apply specifically to the argument group " +"rather than the entire parser." msgstr "" -#: ../../library/argparse.rst:1971 +#: ../../library/argparse.rst:1976 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: ../../library/argparse.rst:1974 +#: ../../library/argparse.rst:1979 msgid "" "Calling :meth:`add_argument_group` on an argument group now raises an " "exception. This nesting was never supported, often failed to work correctly, " "and was unintentionally exposed through inheritance." msgstr "" -#: ../../library/argparse.rst:1979 +#: ../../library/argparse.rst:1984 msgid "Passing prefix_chars_ to :meth:`add_argument_group` is now deprecated." msgstr "" -#: ../../library/argparse.rst:1985 +#: ../../library/argparse.rst:1990 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:1989 +#: ../../library/argparse.rst:1994 msgid "" "Create a mutually exclusive group. :mod:`!argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: ../../library/argparse.rst:1993 +#: ../../library/argparse.rst:1998 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3359,14 +3362,14 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:2005 +#: ../../library/argparse.rst:2010 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: ../../library/argparse.rst:2009 +#: ../../library/argparse.rst:2014 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3384,16 +3387,15 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:2017 +#: ../../library/argparse.rst:2022 msgid "" "Note that currently mutually exclusive argument groups do not support the " -"*title* and *description* arguments " -"of :meth:`~ArgumentParser.add_argument_group`. However, a mutually exclusive " -"group can be added to an argument group that has a title and description. " -"For example::" +"*title* and *description* arguments of :meth:`~ArgumentParser." +"add_argument_group`. However, a mutually exclusive group can be added to an " +"argument group that has a title and description. For example::" msgstr "" -#: ../../library/argparse.rst:2023 +#: ../../library/argparse.rst:2028 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3429,7 +3431,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:2040 +#: ../../library/argparse.rst:2045 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group now raises an exception. This nesting was " @@ -3437,20 +3439,20 @@ msgid "" "exposed through inheritance." msgstr "" -#: ../../library/argparse.rst:2048 +#: ../../library/argparse.rst:2053 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:2052 +#: ../../library/argparse.rst:2057 msgid "" -"Most of the time, the attributes of the object returned " -"by :meth:`parse_args` will be fully determined by inspecting the command-" -"line arguments and the argument actions. :meth:`set_defaults` allows some " +"Most of the time, the attributes of the object returned by :meth:" +"`parse_args` will be fully determined by inspecting the command-line " +"arguments and the argument actions. :meth:`set_defaults` allows some " "additional attributes that are determined without any inspection of the " "command line to be added::" msgstr "" -#: ../../library/argparse.rst:2058 +#: ../../library/argparse.rst:2063 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3464,12 +3466,12 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:2064 +#: ../../library/argparse.rst:2069 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" -#: ../../library/argparse.rst:2066 +#: ../../library/argparse.rst:2071 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3483,21 +3485,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:2072 +#: ../../library/argparse.rst:2077 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: ../../library/argparse.rst:2078 +#: ../../library/argparse.rst:2083 msgid "" -"Get the default value for a namespace attribute, as set by " -"either :meth:`~ArgumentParser.add_argument` or " -"by :meth:`~ArgumentParser.set_defaults`::" +"Get the default value for a namespace attribute, as set by either :meth:" +"`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: ../../library/argparse.rst:2082 +#: ../../library/argparse.rst:2087 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -3509,54 +3510,54 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:2089 +#: ../../library/argparse.rst:2094 msgid "Printing help" msgstr "印出幫助訊息" -#: ../../library/argparse.rst:2091 +#: ../../library/argparse.rst:2096 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: ../../library/argparse.rst:2097 +#: ../../library/argparse.rst:2102 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: ../../library/argparse.rst:2103 +#: ../../library/argparse.rst:2108 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: ../../library/argparse.rst:2107 +#: ../../library/argparse.rst:2112 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:2112 +#: ../../library/argparse.rst:2117 msgid "" -"Return a string containing a brief description of how " -"the :class:`ArgumentParser` should be invoked on the command line." +"Return a string containing a brief description of how the :class:" +"`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:2117 +#: ../../library/argparse.rst:2122 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:2122 +#: ../../library/argparse.rst:2127 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:2126 +#: ../../library/argparse.rst:2131 msgid "" "Sometimes a script only needs to handle a specific set of command-line " "arguments, leaving any unrecognized arguments for another script or program. " @@ -3564,7 +3565,7 @@ msgid "" "useful." msgstr "" -#: ../../library/argparse.rst:2131 +#: ../../library/argparse.rst:2136 msgid "" "This method works similarly to :meth:`~ArgumentParser.parse_args`, but it " "does not raise an error for extra, unrecognized arguments. Instead, it " @@ -3572,7 +3573,7 @@ msgid "" "populated namespace and the list of any unrecognized arguments." msgstr "" -#: ../../library/argparse.rst:2138 +#: ../../library/argparse.rst:2143 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -3586,19 +3587,19 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2145 +#: ../../library/argparse.rst:2150 msgid "" -":ref:`Prefix matching ` rules apply " -"to :meth:`~ArgumentParser.parse_known_args`. The parser may consume an " -"option even if it's just a prefix of one of its known options, instead of " -"leaving it in the remaining arguments list." +":ref:`Prefix matching ` rules apply to :meth:" +"`~ArgumentParser.parse_known_args`. The parser may consume an option even if " +"it's just a prefix of one of its known options, instead of leaving it in the " +"remaining arguments list." msgstr "" -#: ../../library/argparse.rst:2152 +#: ../../library/argparse.rst:2157 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2156 +#: ../../library/argparse.rst:2161 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -3606,20 +3607,20 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2161 +#: ../../library/argparse.rst:2166 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: ../../library/argparse.rst:2165 +#: ../../library/argparse.rst:2170 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: ../../library/argparse.rst:2168 +#: ../../library/argparse.rst:2173 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -3629,18 +3630,18 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2174 +#: ../../library/argparse.rst:2179 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2178 +#: ../../library/argparse.rst:2183 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* to :data:`sys.stderr` before that. The user " "can override this method to handle these steps differently::" msgstr "" -#: ../../library/argparse.rst:2182 +#: ../../library/argparse.rst:2187 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3654,17 +3655,17 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2190 +#: ../../library/argparse.rst:2195 msgid "" -"This method prints a usage message, including the *message*, " -"to :data:`sys.stderr` and terminates the program with a status code of 2." +"This method prints a usage message, including the *message*, to :data:`sys." +"stderr` and terminates the program with a status code of 2." msgstr "" -#: ../../library/argparse.rst:2195 +#: ../../library/argparse.rst:2200 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2200 +#: ../../library/argparse.rst:2205 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -3672,7 +3673,7 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2205 +#: ../../library/argparse.rst:2210 msgid "" "These parsers do not support all the :mod:`!argparse` features, and will " "raise exceptions if unsupported features are used. In particular, " @@ -3680,16 +3681,15 @@ msgid "" "positionals are not supported." msgstr "" -#: ../../library/argparse.rst:2210 +#: ../../library/argparse.rst:2215 msgid "" -"The following example shows the difference " -"between :meth:`~ArgumentParser.parse_known_args` " -"and :meth:`~ArgumentParser.parse_intermixed_args`: the former returns " -"``['2', '3']`` as unparsed arguments, while the latter collects all the " -"positionals into ``rest``. ::" +"The following example shows the difference between :meth:`~ArgumentParser." +"parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " +"former returns ``['2', '3']`` as unparsed arguments, while the latter " +"collects all the positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2216 +#: ../../library/argparse.rst:2221 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3709,7 +3709,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2225 +#: ../../library/argparse.rst:2230 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -3717,11 +3717,11 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2234 +#: ../../library/argparse.rst:2239 msgid "Registering custom types or actions" msgstr "" -#: ../../library/argparse.rst:2238 +#: ../../library/argparse.rst:2243 msgid "" "Sometimes it's desirable to use a custom string in error messages to provide " "more user-friendly output. In these cases, :meth:`!register` can be used to " @@ -3729,7 +3729,7 @@ msgid "" "the type by their registered name instead of their callable name." msgstr "" -#: ../../library/argparse.rst:2243 +#: ../../library/argparse.rst:2248 msgid "" "The :meth:`!register` method accepts three arguments - a *registry_name*, " "specifying the internal registry where the object will be stored (e.g., " @@ -3737,12 +3737,12 @@ msgid "" "be registered, and object, the callable to be registered." msgstr "" -#: ../../library/argparse.rst:2248 +#: ../../library/argparse.rst:2253 msgid "" "The following example shows how to register a custom type with a parser::" msgstr "" -#: ../../library/argparse.rst:2250 +#: ../../library/argparse.rst:2255 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -3758,26 +3758,26 @@ msgid "" "PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" msgstr "" -#: ../../library/argparse.rst:2262 +#: ../../library/argparse.rst:2267 msgid "Exceptions" msgstr "例外" -#: ../../library/argparse.rst:2266 +#: ../../library/argparse.rst:2271 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: ../../library/argparse.rst:2268 +#: ../../library/argparse.rst:2273 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: ../../library/argparse.rst:2273 +#: ../../library/argparse.rst:2278 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: ../../library/argparse.rst:2277 +#: ../../library/argparse.rst:2282 msgid "Guides and Tutorials" msgstr "" @@ -3800,11 +3800,11 @@ msgstr "+ (加號)" #~ msgid "" #~ ">>> parser = argparse.ArgumentParser()\n" -#~ ">>> parser.add_argument('infile', nargs='?', " -#~ "type=argparse.FileType('r'),\n" +#~ ">>> parser.add_argument('infile', nargs='?', type=argparse." +#~ "FileType('r'),\n" #~ "... default=sys.stdin)\n" -#~ ">>> parser.add_argument('outfile', nargs='?', " -#~ "type=argparse.FileType('w'),\n" +#~ ">>> parser.add_argument('outfile', nargs='?', type=argparse." +#~ "FileType('w'),\n" #~ "... default=sys.stdout)\n" #~ ">>> parser.parse_args(['input.txt', 'output.txt'])\n" #~ "Namespace(infile=<_io.TextIOWrapper name='input.txt' encoding='UTF-8'>,\n" @@ -3815,11 +3815,11 @@ msgstr "+ (加號)" #~ " outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" #~ msgstr "" #~ ">>> parser = argparse.ArgumentParser()\n" -#~ ">>> parser.add_argument('infile', nargs='?', " -#~ "type=argparse.FileType('r'),\n" +#~ ">>> parser.add_argument('infile', nargs='?', type=argparse." +#~ "FileType('r'),\n" #~ "... default=sys.stdin)\n" -#~ ">>> parser.add_argument('outfile', nargs='?', " -#~ "type=argparse.FileType('w'),\n" +#~ ">>> parser.add_argument('outfile', nargs='?', type=argparse." +#~ "FileType('w'),\n" #~ "... default=sys.stdout)\n" #~ ">>> parser.parse_args(['input.txt', 'output.txt'])\n" #~ "Namespace(infile=<_io.TextIOWrapper name='input.txt' encoding='UTF-8'>,\n" diff --git a/library/collections.abc.po b/library/collections.abc.po index 1999abb4ab5..9cd5830693e 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,8 +33,8 @@ msgstr "**原始碼:**\\ :source:`Lib/_collections_abc.py`" msgid "" "This module provides :term:`abstract base classes ` " "that can be used to test whether a class provides a particular interface; " -"for example, whether it is :term:`hashable` or whether it is " -"a :term:`mapping`." +"for example, whether it is :term:`hashable` or whether it is a :term:" +"`mapping`." msgstr "" #: ../../library/collections.abc.rst:27 @@ -112,9 +112,9 @@ msgstr "" msgid "" "In this example, class :class:`!D` does not need to define ``__contains__``, " "``__iter__``, and ``__reversed__`` because the :ref:`in-operator " -"`, the :term:`iteration ` logic, and " -"the :func:`reversed` function automatically fall back to using " -"``__getitem__`` and ``__len__``." +"`, the :term:`iteration ` logic, and the :func:" +"`reversed` function automatically fall back to using ``__getitem__`` and " +"``__len__``." msgstr "" #: ../../library/collections.abc.rst:82 @@ -239,7 +239,7 @@ msgstr ":class:`Generator` [1]_" msgid ":class:`Iterator`" msgstr ":class:`Iterator`" -#: ../../library/collections.abc.rst:127 ../../library/collections.abc.rst:173 +#: ../../library/collections.abc.rst:127 ../../library/collections.abc.rst:176 msgid "``send``, ``throw``" msgstr "``send``、``throw``" @@ -271,11 +271,12 @@ msgstr ":class:`Collection` [1]_" msgid ":class:`Sized`, :class:`Iterable`, :class:`Container`" msgstr ":class:`Sized`、:class:`Iterable`、:class:`Container`" -#: ../../library/collections.abc.rst:130 ../../library/collections.abc.rst:143 +#: ../../library/collections.abc.rst:130 ../../library/collections.abc.rst:146 msgid "``__contains__``, ``__iter__``, ``__len__``" msgstr "``__contains__``、``__iter__``、``__len__``" #: ../../library/collections.abc.rst:134 ../../library/collections.abc.rst:137 +#: ../../library/collections.abc.rst:143 msgid ":class:`Sequence`" msgstr ":class:`Sequence`" @@ -283,7 +284,7 @@ msgstr ":class:`Sequence`" msgid ":class:`Reversible`, :class:`Collection`" msgstr ":class:`Reversible`, :class:`Collection`" -#: ../../library/collections.abc.rst:134 +#: ../../library/collections.abc.rst:134 ../../library/collections.abc.rst:143 msgid "``__getitem__``, ``__len__``" msgstr "``__getitem__``、``__len__``" @@ -309,15 +310,23 @@ msgid "" "``extend``, ``pop``, ``remove``, and ``__iadd__``" msgstr "" -#: ../../library/collections.abc.rst:143 ../../library/collections.abc.rst:148 +#: ../../library/collections.abc.rst:143 +msgid ":class:`ByteString`" +msgstr ":class:`ByteString`" + +#: ../../library/collections.abc.rst:143 +msgid "Inherited :class:`Sequence` methods" +msgstr ":class:`Sequence` 的繼承方法" + +#: ../../library/collections.abc.rst:146 ../../library/collections.abc.rst:151 msgid ":class:`Set`" msgstr ":class:`Set`" -#: ../../library/collections.abc.rst:143 ../../library/collections.abc.rst:154 +#: ../../library/collections.abc.rst:146 ../../library/collections.abc.rst:157 msgid ":class:`Collection`" msgstr ":class:`Collection`" -#: ../../library/collections.abc.rst:143 +#: ../../library/collections.abc.rst:146 msgid "" "``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, ``__gt__``, ``__ge__``, " "``__and__``, ``__or__``, ``__sub__``, ``__rsub__``, ``__xor__``, " @@ -327,29 +336,29 @@ msgstr "" "``__and__``、``__or__``、``__sub__``、``__rsub__``、``__xor__``、" "``__rxor__`` 和 ``isdisjoint``" -#: ../../library/collections.abc.rst:148 +#: ../../library/collections.abc.rst:151 msgid ":class:`MutableSet`" msgstr ":class:`MutableSet`" -#: ../../library/collections.abc.rst:148 +#: ../../library/collections.abc.rst:151 msgid "``__contains__``, ``__iter__``, ``__len__``, ``add``, ``discard``" msgstr "``__contains__``、``__iter__``、``__len__``、``add``、``discard``" -#: ../../library/collections.abc.rst:148 +#: ../../library/collections.abc.rst:151 msgid "" "Inherited :class:`Set` methods and ``clear``, ``pop``, ``remove``, " "``__ior__``, ``__iand__``, ``__ixor__``, and ``__isub__``" msgstr "" -#: ../../library/collections.abc.rst:154 ../../library/collections.abc.rst:158 +#: ../../library/collections.abc.rst:157 ../../library/collections.abc.rst:161 msgid ":class:`Mapping`" msgstr ":class:`Mapping`" -#: ../../library/collections.abc.rst:154 +#: ../../library/collections.abc.rst:157 msgid "``__getitem__``, ``__iter__``, ``__len__``" msgstr "``__getitem__``、``__iter__``、``__len__``" -#: ../../library/collections.abc.rst:154 +#: ../../library/collections.abc.rst:157 msgid "" "``__contains__``, ``keys``, ``items``, ``values``, ``get``, ``__eq__``, and " "``__ne__``" @@ -357,128 +366,128 @@ msgstr "" "``__contains__``、``keys``、``items``、``values``、``get``、``__eq__`` 和 " "``__ne__``" -#: ../../library/collections.abc.rst:158 +#: ../../library/collections.abc.rst:161 msgid ":class:`MutableMapping`" msgstr ":class:`MutableMapping`" -#: ../../library/collections.abc.rst:158 +#: ../../library/collections.abc.rst:161 msgid "" "``__getitem__``, ``__setitem__``, ``__delitem__``, ``__iter__``, ``__len__``" msgstr "" "``__getitem__``、``__setitem__``、``__delitem__``、``__iter__``、``__len__``" -#: ../../library/collections.abc.rst:158 +#: ../../library/collections.abc.rst:161 msgid "" "Inherited :class:`Mapping` methods and ``pop``, ``popitem``, ``clear``, " "``update``, and ``setdefault``" msgstr "" -#: ../../library/collections.abc.rst:165 +#: ../../library/collections.abc.rst:168 msgid ":class:`MappingView`" msgstr ":class:`MappingView`" -#: ../../library/collections.abc.rst:165 +#: ../../library/collections.abc.rst:168 msgid ":class:`Sized`" msgstr ":class:`Sized`" -#: ../../library/collections.abc.rst:165 +#: ../../library/collections.abc.rst:168 msgid "``__init__``, ``__len__`` and ``__repr__``" msgstr "``__init__``、``__len__`` 和 ``__repr__``" -#: ../../library/collections.abc.rst:166 +#: ../../library/collections.abc.rst:169 msgid ":class:`ItemsView`" msgstr ":class:`ItemsView`" -#: ../../library/collections.abc.rst:166 ../../library/collections.abc.rst:168 +#: ../../library/collections.abc.rst:169 ../../library/collections.abc.rst:171 msgid ":class:`MappingView`, :class:`Set`" msgstr ":class:`MappingView`、:class:`Set`" -#: ../../library/collections.abc.rst:166 ../../library/collections.abc.rst:168 -#: ../../library/collections.abc.rst:170 +#: ../../library/collections.abc.rst:169 ../../library/collections.abc.rst:171 +#: ../../library/collections.abc.rst:173 msgid "``__contains__``, ``__iter__``" msgstr "``__contains__``、``__iter__``" -#: ../../library/collections.abc.rst:168 +#: ../../library/collections.abc.rst:171 msgid ":class:`KeysView`" msgstr ":class:`KeysView`" -#: ../../library/collections.abc.rst:170 +#: ../../library/collections.abc.rst:173 msgid ":class:`ValuesView`" msgstr ":class:`ValuesView`" -#: ../../library/collections.abc.rst:170 +#: ../../library/collections.abc.rst:173 msgid ":class:`MappingView`, :class:`Collection`" msgstr ":class:`MappingView`、:class:`Collection`" -#: ../../library/collections.abc.rst:172 +#: ../../library/collections.abc.rst:175 msgid ":class:`Awaitable` [1]_" msgstr ":class:`Awaitable` [1]_" -#: ../../library/collections.abc.rst:172 +#: ../../library/collections.abc.rst:175 msgid "``__await__``" msgstr "``__await__``" -#: ../../library/collections.abc.rst:173 +#: ../../library/collections.abc.rst:176 msgid ":class:`Coroutine` [1]_" msgstr ":class:`Coroutine` [1]_" -#: ../../library/collections.abc.rst:173 +#: ../../library/collections.abc.rst:176 msgid ":class:`Awaitable`" msgstr ":class:`Awaitable`" -#: ../../library/collections.abc.rst:173 +#: ../../library/collections.abc.rst:176 msgid "``close``" msgstr "``close``" -#: ../../library/collections.abc.rst:174 +#: ../../library/collections.abc.rst:177 msgid ":class:`AsyncIterable` [1]_" msgstr ":class:`AsyncIterable` [1]_" -#: ../../library/collections.abc.rst:174 ../../library/collections.abc.rst:175 +#: ../../library/collections.abc.rst:177 ../../library/collections.abc.rst:178 msgid "``__aiter__``" msgstr "``__aiter__``" -#: ../../library/collections.abc.rst:175 +#: ../../library/collections.abc.rst:178 msgid ":class:`AsyncIterator` [1]_" msgstr ":class:`AsyncIterator` [1]_" -#: ../../library/collections.abc.rst:175 +#: ../../library/collections.abc.rst:178 msgid ":class:`AsyncIterable`" msgstr ":class:`AsyncIterable`" -#: ../../library/collections.abc.rst:175 +#: ../../library/collections.abc.rst:178 msgid "``__anext__``" msgstr "``__anext__``" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:179 msgid ":class:`AsyncGenerator` [1]_" msgstr ":class:`AsyncGenerator` [1]_" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:179 msgid ":class:`AsyncIterator`" msgstr ":class:`AsyncIterator`" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:179 msgid "``asend``, ``athrow``" msgstr "``asend``、``athrow``" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:179 msgid "``aclose``, ``__aiter__``, ``__anext__``" msgstr "``aclose``、``__aiter__``、``__anext__``" -#: ../../library/collections.abc.rst:177 +#: ../../library/collections.abc.rst:180 msgid ":class:`Buffer` [1]_" msgstr ":class:`Buffer` [1]_" -#: ../../library/collections.abc.rst:177 +#: ../../library/collections.abc.rst:180 msgid "``__buffer__``" msgstr "``__buffer__``" -#: ../../library/collections.abc.rst:182 +#: ../../library/collections.abc.rst:185 msgid "Footnotes" msgstr "註腳" -#: ../../library/collections.abc.rst:183 +#: ../../library/collections.abc.rst:186 msgid "" "These ABCs override :meth:`~abc.ABCMeta.__subclasshook__` to support testing " "an interface by verifying the required methods are present and have not been " @@ -486,222 +495,227 @@ msgid "" "interfaces require registration or direct subclassing." msgstr "" -#: ../../library/collections.abc.rst:189 +#: ../../library/collections.abc.rst:192 msgid "" "Checking ``isinstance(obj, Iterable)`` detects classes that are registered " "as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " "it does not detect classes that iterate with the :meth:`~object.__getitem__` " -"method. The only reliable way to determine whether an object " -"is :term:`iterable` is to call ``iter(obj)``." +"method. The only reliable way to determine whether an object is :term:" +"`iterable` is to call ``iter(obj)``." msgstr "" -#: ../../library/collections.abc.rst:197 +#: ../../library/collections.abc.rst:200 msgid "Collections Abstract Base Classes -- Detailed Descriptions" msgstr "" -#: ../../library/collections.abc.rst:202 +#: ../../library/collections.abc.rst:205 msgid "ABC for classes that provide the :meth:`~object.__contains__` method." msgstr "" -#: ../../library/collections.abc.rst:206 +#: ../../library/collections.abc.rst:209 msgid "ABC for classes that provide the :meth:`~object.__hash__` method." msgstr "" -#: ../../library/collections.abc.rst:210 +#: ../../library/collections.abc.rst:213 msgid "ABC for classes that provide the :meth:`~object.__len__` method." msgstr "" -#: ../../library/collections.abc.rst:214 +#: ../../library/collections.abc.rst:217 msgid "ABC for classes that provide the :meth:`~object.__call__` method." msgstr "" -#: ../../library/collections.abc.rst:216 +#: ../../library/collections.abc.rst:219 msgid "" "See :ref:`annotating-callables` for details on how to use :class:`!Callable` " "in type annotations." msgstr "" -#: ../../library/collections.abc.rst:221 +#: ../../library/collections.abc.rst:224 msgid "ABC for classes that provide the :meth:`~container.__iter__` method." msgstr "" -#: ../../library/collections.abc.rst:223 +#: ../../library/collections.abc.rst:226 msgid "" "Checking ``isinstance(obj, Iterable)`` detects classes that are registered " "as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " "it does not detect classes that iterate with the :meth:`~object.__getitem__` " -"method. The only reliable way to determine whether an object " -"is :term:`iterable` is to call ``iter(obj)``." +"method. The only reliable way to determine whether an object is :term:" +"`iterable` is to call ``iter(obj)``." msgstr "" -#: ../../library/collections.abc.rst:232 +#: ../../library/collections.abc.rst:235 msgid "ABC for sized iterable container classes." msgstr "" -#: ../../library/collections.abc.rst:238 +#: ../../library/collections.abc.rst:241 msgid "" -"ABC for classes that provide the :meth:`~iterator.__iter__` " -"and :meth:`~iterator.__next__` methods. See also the definition " -"of :term:`iterator`." +"ABC for classes that provide the :meth:`~iterator.__iter__` and :meth:" +"`~iterator.__next__` methods. See also the definition of :term:`iterator`." msgstr "" -#: ../../library/collections.abc.rst:244 +#: ../../library/collections.abc.rst:247 msgid "" "ABC for iterable classes that also provide the :meth:`~object.__reversed__` " "method." msgstr "" -#: ../../library/collections.abc.rst:251 +#: ../../library/collections.abc.rst:254 msgid "" -"ABC for :term:`generator` classes that implement the protocol defined " -"in :pep:`342` that extends :term:`iterators ` with " -"the :meth:`~generator.send`, :meth:`~generator.throw` " -"and :meth:`~generator.close` methods." +"ABC for :term:`generator` classes that implement the protocol defined in :" +"pep:`342` that extends :term:`iterators ` with the :meth:" +"`~generator.send`, :meth:`~generator.throw` and :meth:`~generator.close` " +"methods." msgstr "" -#: ../../library/collections.abc.rst:256 +#: ../../library/collections.abc.rst:259 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on " -"using :class:`!Generator` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`!Generator` in type annotations." msgstr "" -#: ../../library/collections.abc.rst:264 +#: ../../library/collections.abc.rst:268 msgid "ABCs for read-only and mutable :term:`sequences `." msgstr "" -#: ../../library/collections.abc.rst:266 +#: ../../library/collections.abc.rst:270 msgid "" -"Implementation note: Some of the mixin methods, such " -"as :meth:`~container.__iter__`, :meth:`~object.__reversed__`, " -"and :meth:`~sequence.index` make repeated calls to the " -"underlying :meth:`~object.__getitem__` method. Consequently, " -"if :meth:`~object.__getitem__` is implemented with constant access speed, " -"the mixin methods will have linear performance; however, if the underlying " -"method is linear (as it would be with a linked list), the mixins will have " -"quadratic performance and will likely need to be overridden." +"Implementation note: Some of the mixin methods, such as :meth:`~container." +"__iter__`, :meth:`~object.__reversed__`, and :meth:`~sequence.index` make " +"repeated calls to the underlying :meth:`~object.__getitem__` method. " +"Consequently, if :meth:`~object.__getitem__` is implemented with constant " +"access speed, the mixin methods will have linear performance; however, if " +"the underlying method is linear (as it would be with a linked list), the " +"mixins will have quadratic performance and will likely need to be overridden." msgstr "" -#: ../../library/collections.abc.rst:278 +#: ../../library/collections.abc.rst:282 msgid "Return first index of *value*." msgstr "" -#: ../../library/collections.abc.rst:280 +#: ../../library/collections.abc.rst:284 msgid "Raises :exc:`ValueError` if the value is not present." msgstr "" -#: ../../library/collections.abc.rst:282 +#: ../../library/collections.abc.rst:286 msgid "" "Supporting the *start* and *stop* arguments is optional, but recommended." msgstr "" -#: ../../library/collections.abc.rst:284 +#: ../../library/collections.abc.rst:288 msgid "" "The :meth:`~sequence.index` method gained support for the *stop* and *start* " "arguments." msgstr "" -#: ../../library/collections.abc.rst:291 +#: ../../library/collections.abc.rst:292 +msgid "" +"The :class:`ByteString` ABC has been deprecated. For use in type " +"annotations, prefer a union, like ``bytes | bytearray``, or :class:" +"`collections.abc.Buffer`. For use as an ABC, prefer :class:`Sequence` or :" +"class:`collections.abc.Buffer`." +msgstr "" + +#: ../../library/collections.abc.rst:301 msgid "ABCs for read-only and mutable :ref:`sets `." msgstr "" -#: ../../library/collections.abc.rst:296 +#: ../../library/collections.abc.rst:306 msgid "ABCs for read-only and mutable :term:`mappings `." msgstr "" -#: ../../library/collections.abc.rst:303 +#: ../../library/collections.abc.rst:313 msgid "" "ABCs for mapping, items, keys, and values :term:`views `." msgstr "" -#: ../../library/collections.abc.rst:307 +#: ../../library/collections.abc.rst:317 msgid "" "ABC for :term:`awaitable` objects, which can be used in :keyword:`await` " -"expressions. Custom implementations must provide " -"the :meth:`~object.__await__` method." +"expressions. Custom implementations must provide the :meth:`~object." +"__await__` method." msgstr "" -#: ../../library/collections.abc.rst:311 +#: ../../library/collections.abc.rst:321 msgid "" -":term:`Coroutine ` objects and instances of " -"the :class:`~collections.abc.Coroutine` ABC are all instances of this ABC." +":term:`Coroutine ` objects and instances of the :class:" +"`~collections.abc.Coroutine` ABC are all instances of this ABC." msgstr "" -#: ../../library/collections.abc.rst:315 +#: ../../library/collections.abc.rst:325 msgid "" "In CPython, generator-based coroutines (:term:`generators ` " "decorated with :func:`@types.coroutine `) are *awaitables*, " "even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Awaitable)`` for them will return ``False``. " -"Use :func:`inspect.isawaitable` to detect them." +"``isinstance(gencoro, Awaitable)`` for them will return ``False``. Use :func:" +"`inspect.isawaitable` to detect them." msgstr "" -#: ../../library/collections.abc.rst:325 +#: ../../library/collections.abc.rst:335 msgid "" "ABC for :term:`coroutine` compatible classes. These implement the following " -"methods, defined in :ref:`coroutine-" -"objects`: :meth:`~coroutine.send`, :meth:`~coroutine.throw`, " -"and :meth:`~coroutine.close`. Custom implementations must also " -"implement :meth:`~object.__await__`. All :class:`Coroutine` instances are " -"also instances of :class:`Awaitable`." +"methods, defined in :ref:`coroutine-objects`: :meth:`~coroutine.send`, :meth:" +"`~coroutine.throw`, and :meth:`~coroutine.close`. Custom implementations " +"must also implement :meth:`~object.__await__`. All :class:`Coroutine` " +"instances are also instances of :class:`Awaitable`." msgstr "" -#: ../../library/collections.abc.rst:333 +#: ../../library/collections.abc.rst:343 msgid "" "In CPython, generator-based coroutines (:term:`generators ` " "decorated with :func:`@types.coroutine `) are *awaitables*, " "even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Coroutine)`` for them will return ``False``. " -"Use :func:`inspect.isawaitable` to detect them." +"``isinstance(gencoro, Coroutine)`` for them will return ``False``. Use :func:" +"`inspect.isawaitable` to detect them." msgstr "" -#: ../../library/collections.abc.rst:339 +#: ../../library/collections.abc.rst:349 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on " -"using :class:`!Coroutine` in type annotations. The variance and order of " -"type parameters correspond to those of :class:`Generator`." +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`!Coroutine` in type annotations. The variance and order of type parameters " +"correspond to those of :class:`Generator`." msgstr "" -#: ../../library/collections.abc.rst:348 +#: ../../library/collections.abc.rst:358 msgid "" "ABC for classes that provide an ``__aiter__`` method. See also the " "definition of :term:`asynchronous iterable`." msgstr "" -#: ../../library/collections.abc.rst:355 +#: ../../library/collections.abc.rst:365 msgid "" "ABC for classes that provide ``__aiter__`` and ``__anext__`` methods. See " "also the definition of :term:`asynchronous iterator`." msgstr "" -#: ../../library/collections.abc.rst:362 +#: ../../library/collections.abc.rst:372 msgid "" "ABC for :term:`asynchronous generator` classes that implement the protocol " "defined in :pep:`525` and :pep:`492`." msgstr "" -#: ../../library/collections.abc.rst:365 +#: ../../library/collections.abc.rst:375 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on " -"using :class:`!AsyncGenerator` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`!AsyncGenerator` in type annotations." msgstr "" -#: ../../library/collections.abc.rst:372 +#: ../../library/collections.abc.rst:382 msgid "" "ABC for classes that provide the :meth:`~object.__buffer__` method, " "implementing the :ref:`buffer protocol `. See :pep:`688`." msgstr "" -#: ../../library/collections.abc.rst:378 +#: ../../library/collections.abc.rst:388 msgid "Examples and Recipes" msgstr "" -#: ../../library/collections.abc.rst:380 +#: ../../library/collections.abc.rst:390 msgid "" "ABCs allow us to ask classes or instances if they provide particular " "functionality, for example::" msgstr "" -#: ../../library/collections.abc.rst:383 +#: ../../library/collections.abc.rst:393 msgid "" "size = None\n" "if isinstance(myvar, collections.abc.Sized):\n" @@ -711,18 +725,17 @@ msgstr "" "if isinstance(myvar, collections.abc.Sized):\n" " size = len(myvar)" -#: ../../library/collections.abc.rst:387 +#: ../../library/collections.abc.rst:397 msgid "" "Several of the ABCs are also useful as mixins that make it easier to develop " "classes supporting container APIs. For example, to write a class supporting " "the full :class:`Set` API, it is only necessary to supply the three " -"underlying abstract " -"methods: :meth:`~object.__contains__`, :meth:`~container.__iter__`, " -"and :meth:`~object.__len__`. The ABC supplies the remaining methods such " -"as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" +"underlying abstract methods: :meth:`~object.__contains__`, :meth:`~container." +"__iter__`, and :meth:`~object.__len__`. The ABC supplies the remaining " +"methods such as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" msgstr "" -#: ../../library/collections.abc.rst:394 +#: ../../library/collections.abc.rst:404 msgid "" "class ListBasedSet(collections.abc.Set):\n" " ''' Alternate set implementation favoring space over speed\n" @@ -748,31 +761,31 @@ msgid "" "automatically" msgstr "" -#: ../../library/collections.abc.rst:416 +#: ../../library/collections.abc.rst:426 msgid "Notes on using :class:`Set` and :class:`MutableSet` as a mixin:" msgstr "" -#: ../../library/collections.abc.rst:419 +#: ../../library/collections.abc.rst:429 msgid "" "Since some set operations create new sets, the default mixin methods need a " "way to create new instances from an :term:`iterable`. The class constructor " "is assumed to have a signature in the form ``ClassName(iterable)``. That " -"assumption is factored-out to an internal :class:`classmethod` " -"called :meth:`!_from_iterable` which calls ``cls(iterable)`` to produce a " -"new set. If the :class:`Set` mixin is being used in a class with a different " -"constructor signature, you will need to override :meth:`!_from_iterable` " -"with a classmethod or regular method that can construct new instances from " -"an iterable argument." +"assumption is factored-out to an internal :class:`classmethod` called :meth:" +"`!_from_iterable` which calls ``cls(iterable)`` to produce a new set. If " +"the :class:`Set` mixin is being used in a class with a different constructor " +"signature, you will need to override :meth:`!_from_iterable` with a " +"classmethod or regular method that can construct new instances from an " +"iterable argument." msgstr "" -#: ../../library/collections.abc.rst:430 +#: ../../library/collections.abc.rst:440 msgid "" "To override the comparisons (presumably for speed, as the semantics are " "fixed), redefine :meth:`~object.__le__` and :meth:`~object.__ge__`, then the " "other operations will automatically follow suit." msgstr "" -#: ../../library/collections.abc.rst:436 +#: ../../library/collections.abc.rst:446 msgid "" "The :class:`Set` mixin provides a :meth:`!_hash` method to compute a hash " "value for the set; however, :meth:`~object.__hash__` is not defined because " @@ -781,12 +794,12 @@ msgid "" "define ``__hash__ = Set._hash``." msgstr "" -#: ../../library/collections.abc.rst:444 +#: ../../library/collections.abc.rst:454 msgid "" "`OrderedSet recipe `_ for an " "example built on :class:`MutableSet`." msgstr "" -#: ../../library/collections.abc.rst:447 +#: ../../library/collections.abc.rst:457 msgid "For more about ABCs, see the :mod:`abc` module and :pep:`3119`." msgstr "關於 ABC 的更多資訊請見 :mod:`abc` module 和 :pep:`3119`。" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 447755e4423..0db2ac39ec4 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2023-01-24 03:33+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,7 +30,8 @@ msgid "" "interpreter.py`" msgstr "" "**原始碼:**\\ :source:`Lib/concurrent/futures/thread.py`、:source:`Lib/" -"concurrent/futures/process.py` 與 :source:`Lib/concurrent/futures/interpreter.py`" +"concurrent/futures/process.py` 與 :source:`Lib/concurrent/futures/" +"interpreter.py`" #: ../../library/concurrent.futures.rst:15 msgid "" @@ -42,14 +43,15 @@ msgstr "" #: ../../library/concurrent.futures.rst:18 msgid "" -"The asynchronous execution can be performed with threads, " -"using :class:`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`, or " -"separate processes, using :class:`ProcessPoolExecutor`. Each implements the " -"same interface, which is defined by the abstract :class:`Executor` class." +"The asynchronous execution can be performed with threads, using :class:" +"`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`, or separate " +"processes, using :class:`ProcessPoolExecutor`. Each implements the same " +"interface, which is defined by the abstract :class:`Executor` class." msgstr "" -"非同步執行可以透過 :class:`ThreadPoolExecutor` 或 :class:`InterpreterPoolExecutor` 來使用執行緒 (thread) 執行,或" -"透過 :class:`ProcessPoolExecutor` 來使用單獨行程 (process) 執行。兩者都實作了" -"相同的介面,該介面由抽象的 :class:`Executor` 類別定義。" +"非同步執行可以透過 :class:`ThreadPoolExecutor` 或 :class:" +"`InterpreterPoolExecutor` 來使用執行緒 (thread) 執行,或透過 :class:" +"`ProcessPoolExecutor` 來使用單獨行程 (process) 執行。兩者都實作了相同的介面," +"該介面由抽象的 :class:`Executor` 類別定義。" #: ../../includes/wasm-notavail.rst:3 msgid "Availability" @@ -114,11 +116,11 @@ msgstr "*fn* 是非同步執行的,並且對 *fn* 的多次呼叫可以並行 #: ../../library/concurrent.futures.rst:56 msgid "" -"The returned iterator raises a :exc:`TimeoutError` " -"if :meth:`~iterator.__next__` is called and the result isn't available after " -"*timeout* seconds from the original call to :meth:`Executor.map`. *timeout* " -"can be an int or a float. If *timeout* is not specified or ``None``, there " -"is no limit to the wait time." +"The returned iterator raises a :exc:`TimeoutError` if :meth:`~iterator." +"__next__` is called and the result isn't available after *timeout* seconds " +"from the original call to :meth:`Executor.map`. *timeout* can be an int or a " +"float. If *timeout* is not specified or ``None``, there is no limit to the " +"wait time." msgstr "" "如果 :meth:`~iterator.__next__` 被呼叫,且在原先呼叫 :meth:`Executor.map` 的 " "*timeout* 秒後結果仍不可用,回傳的疊代器就會引發 :exc:`TimeoutError`。" @@ -138,14 +140,14 @@ msgid "" "(approximate) size of these chunks can be specified by setting *chunksize* " "to a positive integer. For very long iterables, using a large value for " "*chunksize* can significantly improve performance compared to the default " -"size of 1. With :class:`ThreadPoolExecutor` " -"and :class:`InterpreterPoolExecutor`, *chunksize* has no effect." +"size of 1. With :class:`ThreadPoolExecutor` and :class:" +"`InterpreterPoolExecutor`, *chunksize* has no effect." msgstr "" "使用 :class:`ProcessPoolExecutor` 時,此方法將 *iterables* 分成許多分塊 " "(chunks),並將其作為獨立的任務來提交給池 (pool)。可以透過將 *chunksize* 設定" "為正整數來指定這些分塊的(約略)大小。對於非常長的可疊代物件,*chunksize* 使" -"用較大的值(與預設大小 1 相比)可以顯著提高性能。對" -"於 :class:`ThreadPoolExecutor` 和 :class:`InterpreterPoolExecutor`,*chunksize* 無效。" +"用較大的值(與預設大小 1 相比)可以顯著提高性能。對於 :class:" +"`ThreadPoolExecutor` 和 :class:`InterpreterPoolExecutor`,*chunksize* 無效。" #: ../../library/concurrent.futures.rst:74 msgid "Added the *chunksize* parameter." @@ -158,13 +160,13 @@ msgstr "新增 *buffersize* 參數。" #: ../../library/concurrent.futures.rst:82 msgid "" "Signal the executor that it should free any resources that it is using when " -"the currently pending futures are done executing. Calls " -"to :meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will " -"raise :exc:`RuntimeError`." +"the currently pending futures are done executing. Calls to :meth:`Executor." +"submit` and :meth:`Executor.map` made after shutdown will raise :exc:" +"`RuntimeError`." msgstr "" "向 executor 發出訊號 (signal),表明它應該在目前未定 (pending) 的 future 完成" -"執行時釋放它正在使用的任何資源。在關閉後呼叫 :meth:`Executor.submit` " -"和 :meth:`Executor.map` 將引發 :exc:`RuntimeError`。" +"執行時釋放它正在使用的任何資源。在關閉後呼叫 :meth:`Executor.submit` 和 :" +"meth:`Executor.map` 將引發 :exc:`RuntimeError`。" #: ../../library/concurrent.futures.rst:87 msgid "" @@ -203,14 +205,14 @@ msgstr "" #: ../../library/concurrent.futures.rst:104 msgid "" -"You can avoid having to call this method explicitly if you use " -"the :keyword:`with` statement, which will shutdown the :class:`Executor` " -"(waiting as if :meth:`Executor.shutdown` were called with *wait* set to " -"``True``)::" +"You can avoid having to call this method explicitly if you use the executor " +"as a :term:`context manager` via the :keyword:`with` statement, which will " +"shutdown the :class:`Executor` (waiting as if :meth:`Executor.shutdown` were " +"called with *wait* set to ``True``)::" msgstr "" -"如果使用 :keyword:`with` 陳述式,那你就可以不用明確地呼叫此方法,這將會自己關" -"閉 :class:`Executor`\\(如同呼叫 :meth:`Executor.shutdown` 時 *wait* 被設定" -"為 ``True`` 般等待): ::" +"如果使用 :keyword:`with` 陳述式來將 executor 用作 :term:`context manager`,那你就" +"可以不用明確地呼叫此方法,這將會自己關閉 :class:`Executor`\\(如同呼" +"叫 :meth:`Executor.shutdown` 時 *wait* 被設定為 ``True`` 般等待): ::" #: ../../library/concurrent.futures.rst:109 msgid "" @@ -343,16 +345,16 @@ msgid "" msgstr "" "*initializer* 是一個可選的可呼叫物件,在每個工作執行緒開始時呼叫; " "*initargs* 是傳遞給 initializer 的引數元組 (tuple)。如果 *initializer* 引發例" -"外,所有目前未定的作業以及任何向池中提交 (submit) 更多作業的嘗試都將引" -"發 :exc:`~concurrent.futures.thread.BrokenThreadPool`。" +"外,所有目前未定的作業以及任何向池中提交 (submit) 更多作業的嘗試都將引發 :" +"exc:`~concurrent.futures.thread.BrokenThreadPool`。" #: ../../library/concurrent.futures.rst:175 msgid "" "If *max_workers* is ``None`` or not given, it will default to the number of " -"processors on the machine, multiplied by ``5``, assuming " -"that :class:`ThreadPoolExecutor` is often used to overlap I/O instead of CPU " -"work and the number of workers should be higher than the number of workers " -"for :class:`ProcessPoolExecutor`." +"processors on the machine, multiplied by ``5``, assuming that :class:" +"`ThreadPoolExecutor` is often used to overlap I/O instead of CPU work and " +"the number of workers should be higher than the number of workers for :class:" +"`ProcessPoolExecutor`." msgstr "" "如果 *max_workers* 為 ``None`` 或未給定,它將預設為機器上的處理器數量乘以 " "``5``,這假定了 :class:`ThreadPoolExecutor` 通常用於 I/O 重疊而非 CPU 密集的" @@ -361,9 +363,9 @@ msgstr "" #: ../../library/concurrent.futures.rst:183 msgid "" -"Added the *thread_name_prefix* parameter to allow users to control " -"the :class:`threading.Thread` names for worker threads created by the pool " -"for easier debugging." +"Added the *thread_name_prefix* parameter to allow users to control the :" +"class:`threading.Thread` names for worker threads created by the pool for " +"easier debugging." msgstr "" "新增 *thread_name_prefix* 參數以允許使用者控制由池所建立的工作執行緒 (worker " "thread) 的 :class:`threading.Thread` 名稱,以便於除錯。" @@ -394,8 +396,8 @@ msgstr "" #: ../../library/concurrent.futures.rst:200 msgid "" -"Default value of *max_workers* is changed to ``min(32, " -"(os.process_cpu_count() or 1) + 4)``." +"Default value of *max_workers* is changed to ``min(32, (os." +"process_cpu_count() or 1) + 4)``." msgstr "" "*max_workers* 的預設值被改為 ``min(32, (os.process_cpu_count() or 1) + 4)``。" @@ -523,8 +525,8 @@ msgstr "" #: ../../library/concurrent.futures.rst:308 msgid "" -"The executor may replace uncaught exceptions from *initializer* " -"with :class:`~concurrent.futures.interpreter.ExecutionFailed`." +"The executor may replace uncaught exceptions from *initializer* with :class:" +"`~concurrent.futures.interpreter.ExecutionFailed`." msgstr "" #: ../../library/concurrent.futures.rst:311 @@ -543,13 +545,11 @@ msgstr "" msgid "" "When a worker's current task raises an uncaught exception, the worker always " "tries to preserve the exception as-is. If that is successful then it also " -"sets the ``__cause__`` to a " -"corresponding :class:`~concurrent.futures.interpreter.ExecutionFailed` " -"instance, which contains a summary of the original exception. In the " -"uncommon case that the worker is not able to preserve the original as-is " -"then it directly preserves the " -"corresponding :class:`~concurrent.futures.interpreter.ExecutionFailed` " -"instance instead." +"sets the ``__cause__`` to a corresponding :class:`~concurrent.futures." +"interpreter.ExecutionFailed` instance, which contains a summary of the " +"original exception. In the uncommon case that the worker is not able to " +"preserve the original as-is then it directly preserves the corresponding :" +"class:`~concurrent.futures.interpreter.ExecutionFailed` instance instead." msgstr "" #: ../../library/concurrent.futures.rst:330 @@ -559,15 +559,15 @@ msgstr "ProcessPoolExecutor" #: ../../library/concurrent.futures.rst:332 msgid "" "The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that " -"uses a pool of processes to execute calls " -"asynchronously. :class:`ProcessPoolExecutor` uses the :mod:`multiprocessing` " -"module, which allows it to side-step the :term:`Global Interpreter Lock " -"` but also means that only picklable objects can be " -"executed and returned." +"uses a pool of processes to execute calls asynchronously. :class:" +"`ProcessPoolExecutor` uses the :mod:`multiprocessing` module, which allows " +"it to side-step the :term:`Global Interpreter Lock ` but also means that only picklable objects can be executed and " +"returned." msgstr "" ":class:`ProcessPoolExecutor` 類別是一個 :class:`Executor` 的子類別,它使用行" -"程池來非同步地執行呼叫。:class:`ProcessPoolExecutor` 使用" -"了 :mod:`multiprocessing` 模組,這允許它避開\\ :term:`全域直譯器鎖 (Global " +"程池來非同步地執行呼叫。:class:`ProcessPoolExecutor` 使用了 :mod:" +"`multiprocessing` 模組,這允許它避開\\ :term:`全域直譯器鎖 (Global " "Interpreter Lock) `,但也意味著只能執行和回傳可被 " "pickle 的 (picklable) 物件。" @@ -577,9 +577,9 @@ msgid "" "means that :class:`ProcessPoolExecutor` will not work in the interactive " "interpreter." msgstr "" -"``__main__`` 模組必須可以被工作子行程 (worker subprocess) 引入。這意味" -"著 :class:`ProcessPoolExecutor` 將無法在交互式直譯器 (interactive " -"interpreter) 中工作。" +"``__main__`` 模組必須可以被工作子行程 (worker subprocess) 引入。這意味著 :" +"class:`ProcessPoolExecutor` 將無法在交互式直譯器 (interactive interpreter) 中" +"工作。" #: ../../library/concurrent.futures.rst:342 msgid "" @@ -592,10 +592,9 @@ msgstr "" #: ../../library/concurrent.futures.rst:345 msgid "" "Note that the restrictions on functions and arguments needing to picklable " -"as per :class:`multiprocessing.Process` apply when " -"using :meth:`~Executor.submit` and :meth:`~Executor.map` on " -"a :class:`ProcessPoolExecutor`. A function defined in a REPL or a lambda " -"should not be expected to work." +"as per :class:`multiprocessing.Process` apply when using :meth:`~Executor." +"submit` and :meth:`~Executor.map` on a :class:`ProcessPoolExecutor`. A " +"function defined in a REPL or a lambda should not be expected to work." msgstr "" #: ../../library/concurrent.futures.rst:352 @@ -609,18 +608,18 @@ msgid "" "the default chosen will be at most ``61``, even if more processors are " "available. *mp_context* can be a :mod:`multiprocessing` context or ``None``. " "It will be used to launch the workers. If *mp_context* is ``None`` or not " -"given, the default :mod:`multiprocessing` context is used. " -"See :ref:`multiprocessing-start-methods`." +"given, the default :mod:`multiprocessing` context is used. See :ref:" +"`multiprocessing-start-methods`." msgstr "" "一個 :class:`Executor` 子類別,它使用了最多有 *max_workers* 個行程的池來非同" -"步地執行呼叫。如果 *max_workers* 為 ``None`` 或未給定,它將被預設" -"為 :func:`os.process_cpu_count`。如果 *max_workers* 小於或等於 ``0``,則會引" -"發 :exc:`ValueError`。在 Windows 上,*max_workers* 必須小於或等於 ``61``。如" -"果不是,則會引發 :exc:`ValueError`。如果 *max_workers* 為 ``None``,則預設選" -"擇最多為 ``61``,即便有更多處理器可用。*mp_context* 可以" -"是 :mod:`multiprocessing` 情境 (context) 或 ``None``。它將用於啟動 worker。如" -"果 *mp_context* 為 ``None`` 或未給定,則使用預設的 :mod:`multiprocessing` 情" -"境。請見 :ref:`multiprocessing-start-methods`。" +"步地執行呼叫。如果 *max_workers* 為 ``None`` 或未給定,它將被預設為 :func:" +"`os.process_cpu_count`。如果 *max_workers* 小於或等於 ``0``,則會引發 :exc:" +"`ValueError`。在 Windows 上,*max_workers* 必須小於或等於 ``61``。如果不是," +"則會引發 :exc:`ValueError`。如果 *max_workers* 為 ``None``,則預設選擇最多為 " +"``61``,即便有更多處理器可用。*mp_context* 可以是 :mod:`multiprocessing` 情" +"境 (context) 或 ``None``。它將用於啟動 worker。如果 *mp_context* 為 ``None`` " +"或未給定,則使用預設的 :mod:`multiprocessing` 情境。請見 :ref:" +"`multiprocessing-start-methods`。" #: ../../library/concurrent.futures.rst:366 msgid "" @@ -632,8 +631,8 @@ msgid "" msgstr "" "*initializer* 是一個可選的可呼叫物件,在每個工作行程 (worker process) 開始時" "呼叫;*initargs* 是傳遞給 initializer 的引數元組。如果 *initializer* 引發例" -"外,所有目前未定的作業以及任何向池中提交更多作業的嘗試都將引" -"發 :exc:`~concurrent.futures.process.BrokenProcessPool`。" +"外,所有目前未定的作業以及任何向池中提交更多作業的嘗試都將引發 :exc:" +"`~concurrent.futures.process.BrokenProcessPool`。" #: ../../library/concurrent.futures.rst:372 msgid "" @@ -653,15 +652,14 @@ msgstr "" #: ../../library/concurrent.futures.rst:380 msgid "" -"When one of the worker processes terminates abruptly, " -"a :exc:`~concurrent.futures.process.BrokenProcessPool` error is now raised. " -"Previously, behaviour was undefined but operations on the executor or its " -"futures would often freeze or deadlock." +"When one of the worker processes terminates abruptly, a :exc:`~concurrent." +"futures.process.BrokenProcessPool` error is now raised. Previously, " +"behaviour was undefined but operations on the executor or its futures would " +"often freeze or deadlock." msgstr "" -"當其中一個工作行程突然終止時,現在會引" -"發 :exc:`~concurrent.futures.process.BrokenProcessPool` 錯誤。在過去,此行為" -"是未定義的 (undefined),但對 executor 或其 future 的操作經常會發生凍結或死" -"鎖。" +"當其中一個工作行程突然終止時,現在會引發 :exc:`~concurrent.futures.process." +"BrokenProcessPool` 錯誤。在過去,此行為是未定義的 (undefined),但對 executor " +"或其 future 的操作經常會發生凍結或死鎖。" #: ../../library/concurrent.futures.rst:387 msgid "" @@ -679,12 +677,11 @@ msgstr "" #: ../../library/concurrent.futures.rst:397 msgid "" -"On POSIX systems, if your application has multiple threads and " -"the :mod:`multiprocessing` context uses the ``\"fork\"`` start method: " -"The :func:`os.fork` function called internally to spawn workers may raise " -"a :exc:`DeprecationWarning`. Pass a *mp_context* configured to use a " -"different start method. See the :func:`os.fork` documentation for further " -"explanation." +"On POSIX systems, if your application has multiple threads and the :mod:" +"`multiprocessing` context uses the ``\"fork\"`` start method: The :func:`os." +"fork` function called internally to spawn workers may raise a :exc:" +"`DeprecationWarning`. Pass a *mp_context* configured to use a different " +"start method. See the :func:`os.fork` documentation for further explanation." msgstr "" "在 POSIX 系統上,如果你的應用程式有多個執行緒並且 :mod:`multiprocessing` 情境" "使用了 ``\"fork\"`` 啟動方法:內部呼叫以產生 worker 的 :func:`os.fork` 函式可" @@ -693,24 +690,24 @@ msgstr "" #: ../../library/concurrent.futures.rst:405 msgid "" -"*max_workers* uses :func:`os.process_cpu_count` by default, instead " -"of :func:`os.cpu_count`." +"*max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:" +"`os.cpu_count`." msgstr "" #: ../../library/concurrent.futures.rst:409 msgid "" "The default process start method (see :ref:`multiprocessing-start-methods`) " -"changed away from *fork*. If you require the *fork* start method " -"for :class:`ProcessPoolExecutor` you must explicitly pass " -"``mp_context=multiprocessing.get_context(\"fork\")``." +"changed away from *fork*. If you require the *fork* start method for :class:" +"`ProcessPoolExecutor` you must explicitly pass ``mp_context=multiprocessing." +"get_context(\"fork\")``." msgstr "" #: ../../library/concurrent.futures.rst:417 msgid "" -"Attempt to terminate all living worker processes immediately by " -"calling :meth:`Process.terminate ` on " -"each of them. Internally, it will also call :meth:`Executor.shutdown` to " -"ensure that all other resources associated with the executor are freed." +"Attempt to terminate all living worker processes immediately by calling :" +"meth:`Process.terminate ` on each of " +"them. Internally, it will also call :meth:`Executor.shutdown` to ensure that " +"all other resources associated with the executor are freed." msgstr "" #: ../../library/concurrent.futures.rst:422 @@ -722,10 +719,10 @@ msgstr "" #: ../../library/concurrent.futures.rst:429 msgid "" -"Attempt to kill all living worker processes immediately by " -"calling :meth:`Process.kill ` on each of them. " -"Internally, it will also call :meth:`Executor.shutdown` to ensure that all " -"other resources associated with the executor are freed." +"Attempt to kill all living worker processes immediately by calling :meth:" +"`Process.kill ` on each of them. Internally, " +"it will also call :meth:`Executor.shutdown` to ensure that all other " +"resources associated with the executor are freed." msgstr "" #: ../../library/concurrent.futures.rst:442 @@ -809,8 +806,8 @@ msgid "" "The :class:`Future` class encapsulates the asynchronous execution of a " "callable. :class:`Future` instances are created by :meth:`Executor.submit`." msgstr "" -":class:`Future` 類別封裝了可呼叫物件的非同步執行。:class:`Future` 實例" -"由 :meth:`Executor.submit` 建立。" +":class:`Future` 類別封裝了可呼叫物件的非同步執行。:class:`Future` 實例由 :" +"meth:`Executor.submit` 建立。" #: ../../library/concurrent.futures.rst:487 msgid "" @@ -915,8 +912,8 @@ msgstr "如果 future 已經完成或被取消,*fn* 將立即被呼叫。" #: ../../library/concurrent.futures.rst:555 msgid "" -"The following :class:`Future` methods are meant for use in unit tests " -"and :class:`Executor` implementations." +"The following :class:`Future` methods are meant for use in unit tests and :" +"class:`Executor` implementations." msgstr "以下 :class:`Future` 方法旨在用於單元測試和 :class:`Executor` 實作。" #: ../../library/concurrent.futures.rst:560 @@ -930,14 +927,14 @@ msgstr "" #: ../../library/concurrent.futures.rst:564 msgid "" -"If the method returns ``False`` then the :class:`Future` was cancelled, " -"i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads " +"If the method returns ``False`` then the :class:`Future` was cancelled, i." +"e. :meth:`Future.cancel` was called and returned ``True``. Any threads " "waiting on the :class:`Future` completing (i.e. through :func:`as_completed` " "or :func:`wait`) will be woken up." msgstr "" -"如果該方法回傳 ``False`` 則 :class:`Future` 已被取消," -"即 :meth:`Future.cancel` 被呼叫並回傳 ``True``。任何等待 :class:`Future` 完成" -"的執行緒(即透過 :func:`as_completed` 或 :func:`wait`)將被喚醒。" +"如果該方法回傳 ``False`` 則 :class:`Future` 已被取消,即 :meth:`Future." +"cancel` 被呼叫並回傳 ``True``。任何等待 :class:`Future` 完成的執行緒(即透" +"過 :func:`as_completed` 或 :func:`wait`)將被喚醒。" #: ../../library/concurrent.futures.rst:569 msgid "" @@ -950,12 +947,11 @@ msgstr "" #: ../../library/concurrent.futures.rst:573 msgid "" -"This method can only be called once and cannot be called " -"after :meth:`Future.set_result` or :meth:`Future.set_exception` have been " -"called." +"This method can only be called once and cannot be called after :meth:`Future." +"set_result` or :meth:`Future.set_exception` have been called." msgstr "" -"此方法只能呼叫一次,且不能在呼叫 :meth:`Future.set_result` " -"或 :meth:`Future.set_exception` 之後呼叫。" +"此方法只能呼叫一次,且不能在呼叫 :meth:`Future.set_result` 或 :meth:`Future." +"set_exception` 之後呼叫。" #: ../../library/concurrent.futures.rst:579 msgid "" @@ -972,16 +968,16 @@ msgstr "此方法只能在 :class:`Executor` 實作中和單元測試中使用 #: ../../library/concurrent.futures.rst:585 #: ../../library/concurrent.futures.rst:598 msgid "" -"This method raises :exc:`concurrent.futures.InvalidStateError` if " -"the :class:`Future` is already done." +"This method raises :exc:`concurrent.futures.InvalidStateError` if the :class:" +"`Future` is already done." msgstr "" -"如果 :class:`Future` 已經完成,此方法會引" -"發 :exc:`concurrent.futures.InvalidStateError`。" +"如果 :class:`Future` 已經完成,此方法會引發 :exc:`concurrent.futures." +"InvalidStateError`。" #: ../../library/concurrent.futures.rst:592 msgid "" -"Sets the result of the work associated with the :class:`Future` to " -"the :class:`Exception` *exception*." +"Sets the result of the work associated with the :class:`Future` to the :" +"class:`Exception` *exception*." msgstr "" "將與 :class:`Future` 關聯的工作結果設定為 :class:`Exception` *exception*。" @@ -991,13 +987,13 @@ msgstr "模組函式" #: ../../library/concurrent.futures.rst:608 msgid "" -"Wait for the :class:`Future` instances (possibly created by " -"different :class:`Executor` instances) given by *fs* to complete. Duplicate " -"futures given to *fs* are removed and will be returned only once. Returns a " -"named 2-tuple of sets. The first set, named ``done``, contains the futures " -"that completed (finished or cancelled futures) before the wait completed. " -"The second set, named ``not_done``, contains the futures that did not " -"complete (pending or running futures)." +"Wait for the :class:`Future` instances (possibly created by different :class:" +"`Executor` instances) given by *fs* to complete. Duplicate futures given to " +"*fs* are removed and will be returned only once. Returns a named 2-tuple of " +"sets. The first set, named ``done``, contains the futures that completed " +"(finished or cancelled futures) before the wait completed. The second set, " +"named ``not_done``, contains the futures that did not complete (pending or " +"running futures)." msgstr "" "等待 *fs* 給定的 :class:`Future` 實例(可能由不同的 :class:`Executor` 實例建" "立)完成。提供給 *fs* 的重複 future 將被刪除,並且只會回傳一次。回傳一個集合" @@ -1035,8 +1031,8 @@ msgstr "當任何 future 完成或被取消時,該函式就會回傳。" #: ../../library/concurrent.futures.rst:633 msgid "" "The function will return when any future finishes by raising an exception. " -"If no future raises an exception then it is equivalent " -"to :const:`ALL_COMPLETED`." +"If no future raises an exception then it is equivalent to :const:" +"`ALL_COMPLETED`." msgstr "" "該函式會在任何 future 透過引發例外而完結時回傳。如果 future 沒有引發例外,那" "麼它等同於 :const:`ALL_COMPLETED`。" @@ -1060,10 +1056,10 @@ msgstr "" "回傳由 *fs* 給定的 :class:`Future` 實例(可能由不同的 :class:`Executor` 實例" "建立)的疊代器,它在完成時產生 future(已完成或被取消的 future)。*fs* 給定的" "任何重複的 future 將只被回傳一次。呼叫 :func:`as_completed` 之前完成的任何 " -"future 將首先產生。如果 :meth:`~iterator.__next__` 被呼叫,並且在原先呼" -"叫 :func:`as_completed` 的 *timeout* 秒後結果仍不可用,則回傳的疊代器會引" -"發 :exc:`TimeoutError`。*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或" -"為 ``None``,則等待時間就沒有限制。" +"future 將首先產生。如果 :meth:`~iterator.__next__` 被呼叫,並且在原先呼叫 :" +"func:`as_completed` 的 *timeout* 秒後結果仍不可用,則回傳的疊代器會引發 :exc:" +"`TimeoutError`。*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或為 " +"``None``,則等待時間就沒有限制。" #: ../../library/concurrent.futures.rst:655 msgid ":pep:`3148` -- futures - execute computations asynchronously" @@ -1112,23 +1108,21 @@ msgstr "目前狀態下不允許的 future 操作被執行時而引發。" #: ../../library/concurrent.futures.rst:698 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class " -"is raised when one of the workers of " -"a :class:`~concurrent.futures.ThreadPoolExecutor` has failed initializing." +"is raised when one of the workers of a :class:`~concurrent.futures." +"ThreadPoolExecutor` has failed initializing." msgstr "" -"衍生自 :exc:`~concurrent.futures.BrokenExecutor`," -"當 :class:`~concurrent.futures.ThreadPoolExecutor` 的其中一個 worker 初始化失" -"敗時會引發此例外類別。" +"衍生自 :exc:`~concurrent.futures.BrokenExecutor`,當 :class:`~concurrent." +"futures.ThreadPoolExecutor` 的其中一個 worker 初始化失敗時會引發此例外類別。" #: ../../library/concurrent.futures.rst:709 msgid "" "Derived from :exc:`~concurrent.futures.thread.BrokenThreadPool`, this " -"exception class is raised when one of the workers of " -"a :class:`~concurrent.futures.InterpreterPoolExecutor` has failed " -"initializing." +"exception class is raised when one of the workers of a :class:`~concurrent." +"futures.InterpreterPoolExecutor` has failed initializing." msgstr "" -"衍生自 :exc:`~concurrent.futures.thread.BrokenThreadPool`," -"當 :class:`~concurrent.futures.InterpreterPoolExecutor` 的其中一個 worker 初始化失" -"敗時會引發此例外類別。" +"衍生自 :exc:`~concurrent.futures.thread.BrokenThreadPool`,當 :class:" +"`~concurrent.futures.InterpreterPoolExecutor` 的其中一個 worker 初始化失敗時" +"會引發此例外類別。" #: ../../library/concurrent.futures.rst:718 msgid "" @@ -1139,13 +1133,12 @@ msgstr "" #: ../../library/concurrent.futures.rst:729 msgid "" -"Derived from :exc:`~concurrent.futures.BrokenExecutor` " -"(formerly :exc:`RuntimeError`), this exception class is raised when one of " -"the workers of a :class:`~concurrent.futures.ProcessPoolExecutor` has " -"terminated in a non-clean fashion (for example, if it was killed from the " -"outside)." +"Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly :exc:" +"`RuntimeError`), this exception class is raised when one of the workers of " +"a :class:`~concurrent.futures.ProcessPoolExecutor` has terminated in a non-" +"clean fashion (for example, if it was killed from the outside)." msgstr "" -"衍生自 :exc:`~concurrent.futures.BrokenExecutor`\\(以前" -"為 :exc:`RuntimeError`)," -"當 :class:`~concurrent.futures.ProcessPoolExecutor` 的其中一個 worker 以不乾" -"淨的方式終止時將引發此例外類別(例如它是從外面被 kill 掉的)。" +"衍生自 :exc:`~concurrent.futures.BrokenExecutor`\\(以前為 :exc:" +"`RuntimeError`),當 :class:`~concurrent.futures.ProcessPoolExecutor` 的其中" +"一個 worker 以不乾淨的方式終止時將引發此例外類別(例如它是從外面被 kill 掉" +"的)。" diff --git a/library/constants.po b/library/constants.po index a22d36e5099..ec45a2b3aba 100644 --- a/library/constants.po +++ b/library/constants.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2021-11-19 23:36+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -58,22 +58,21 @@ msgstr "" #: ../../library/constants.rst:30 msgid "" -"A special value which should be returned by the binary special methods " -"(e.g. :meth:`~object.__eq__`, :meth:`~object.__lt__`, :meth:`~object.__add__`, :meth:`~object.__rsub__`, " -"etc.) to indicate that the operation is not implemented with respect to the " -"other type; may be returned by the in-place binary special methods " -"(e.g. :meth:`~object.__imul__`, :meth:`~object.__iand__`, etc.) for the same " -"purpose. It should not be evaluated in a boolean context. :data:`!" -"NotImplemented` is the sole instance of the :data:`types.NotImplementedType` " -"type." -msgstr "" -"會被二元特殊方法 (binary special methods)" -"(如::meth:`~object.__eq__`、:meth:`~object.__lt__`、:meth:`~object.__add__`、:meth:`~object.__rsub__` " -"等)所回傳的特殊值,代表著該運算沒有針對其他型別的實作。同理也可以被原地二元" -"特殊方法 (in-place binary special methods) " -"(如::meth:`~object.__imul__`、:meth:`~object.__iand__` 等)回傳。它不應該被" -"作為 boolean(布林)來解讀。:data:`!NotImplemented` 是型" -"別 :data:`types.NotImplementedType` 的唯一實例。" +"A special value which should be returned by the binary special methods (e." +"g. :meth:`~object.__eq__`, :meth:`~object.__lt__`, :meth:`~object.__add__`, :" +"meth:`~object.__rsub__`, etc.) to indicate that the operation is not " +"implemented with respect to the other type; may be returned by the in-place " +"binary special methods (e.g. :meth:`~object.__imul__`, :meth:`~object." +"__iand__`, etc.) for the same purpose. It should not be evaluated in a " +"boolean context. :data:`!NotImplemented` is the sole instance of the :data:" +"`types.NotImplementedType` type." +msgstr "" +"會被二元特殊方法 (binary special methods)(如::meth:`~object.__eq__`、:meth:" +"`~object.__lt__`、:meth:`~object.__add__`、:meth:`~object.__rsub__` 等)所回" +"傳的特殊值,代表著該運算沒有針對其他型別的實作。同理也可以被原地二元特殊方法 " +"(in-place binary special methods) (如::meth:`~object.__imul__`、:meth:" +"`~object.__iand__` 等)回傳。它不應該被作為 boolean(布林)來解讀。:data:`!" +"NotImplemented` 是型別 :data:`types.NotImplementedType` 的唯一實例。" #: ../../library/constants.rst:40 msgid "" @@ -98,60 +97,61 @@ msgstr "請參見 :ref:`implementing-the-arithmetic-operations` 以找到更多 #: ../../library/constants.rst:51 msgid "" ":data:`!NotImplemented` and :exc:`!NotImplementedError` are not " -"interchangeable. This constant should only be used as described above; " -"see :exc:`NotImplementedError` for details on correct usage of the exception." +"interchangeable. This constant should only be used as described above; see :" +"exc:`NotImplementedError` for details on correct usage of the exception." msgstr "" ":data:`!NotImplemented` 與 :exc:`!NotImplementedError` 並不一樣且不可互換。這" -"個常數只能用於上述的情況;欲知更多如何正確使用它們的細節,請參" -"見 :exc:`NotImplementedError`。" +"個常數只能用於上述的情況;欲知更多如何正確使用它們的細節,請參見 :exc:" +"`NotImplementedError`。" #: ../../library/constants.rst:56 msgid "Evaluating :data:`!NotImplemented` in a boolean context was deprecated." -msgstr "" +msgstr "在 boolean(布林)上下文中對 :data:`!NotImplemented` 求值的操作已被棄用。" #: ../../library/constants.rst:59 msgid "" -"Evaluating :data:`!NotImplemented` in a boolean context now raises " -"a :exc:`TypeError`. It previously evaluated to :const:`True` and emitted " -"a :exc:`DeprecationWarning` since Python 3.9." +"Evaluating :data:`!NotImplemented` in a boolean context now raises a :exc:" +"`TypeError`. It previously evaluated to :const:`True` and emitted a :exc:" +"`DeprecationWarning` since Python 3.9." msgstr "" -"在 boolean(布林)上下文中解讀 :data:`!NotImplemented` 現在會引發 :exc:`TypeError`。" -"過去自 Python 3.9 以來,這會被解讀成 :const:`True`,並發出 :exc:`DeprecationWarning`" +"在 boolean 上下文中解讀 :data:`!NotImplemented` 現在會引發 :exc:" +"`TypeError`。過去自 Python 3.9 以來,這會被解讀成 :const:`True`,並發出 :exc:" +"`DeprecationWarning`" #: ../../library/constants.rst:68 msgid "" -"The same as the ellipsis literal \"``...``\". Special value used mostly in " -"conjunction with extended slicing syntax for user-defined container data " -"types. ``Ellipsis`` is the sole instance of the :data:`types.EllipsisType` " -"type." +"The same as the ellipsis literal \"``...``\", an object frequently used to " +"indicate that something is omitted. Assignment to ``Ellipsis`` is possible, " +"but assignment to ``...`` raises a :exc:`SyntaxError`. ``Ellipsis`` is the " +"sole instance of the :data:`types.EllipsisType` type." msgstr "" -"與刪節號 \"``...``\" 字面相同。為一特殊值,大多用於結合使用者定義資料型別的延" -"伸切片語法 (extended slicing syntax)。``Ellipsis`` 是型" -"別 :data:`types.EllipsisType` 的唯一實例。" +"與刪節號 \"``...``\" 字面相同,是一個經常被用來表示某些東西被省略的物件。對於 " +"``Ellipsis`` 的賦值是可能的,但對於 ``...`` 的賦值會引發 :exc:`SyntaxError`。" +"``Ellipsis`` 是型別 :data:`types.EllipsisType` 的唯一實例。" -#: ../../library/constants.rst:75 +#: ../../library/constants.rst:76 msgid "" "This constant is true if Python was not started with an :option:`-O` option. " "See also the :keyword:`assert` statement." msgstr "" -"如果 Python 沒有被以 :option:`-O` 選項啟動,則此常數為 true。請參" -"見 :keyword:`assert` 陳述式。" +"如果 Python 沒有被以 :option:`-O` 選項啟動,則此常數為 true。請參見 :keyword:" +"`assert` 陳述式。" -#: ../../library/constants.rst:81 +#: ../../library/constants.rst:82 msgid "" "The names :data:`None`, :data:`False`, :data:`True` and :data:`__debug__` " -"cannot be reassigned (assignments to them, even as an attribute name, " -"raise :exc:`SyntaxError`), so they can be considered \"true\" constants." +"cannot be reassigned (assignments to them, even as an attribute name, raise :" +"exc:`SyntaxError`), so they can be considered \"true\" constants." msgstr "" ":data:`None`,:data:`False`,:data:`True`,以及 :data:`__debug__` 都是不能被" -"重新賦值的(任何對它們的賦值,即使是屬性的名稱,也會拋" -"出 :exc:`SyntaxError`)。因此,它們可以被視為”真正的”常數。" +"重新賦值的(任何對它們的賦值,即使是屬性的名稱,也會拋出 :exc:" +"`SyntaxError`)。因此,它們可以被視為”真正的”常數。" -#: ../../library/constants.rst:89 +#: ../../library/constants.rst:90 msgid "Constants added by the :mod:`site` module" msgstr "由 :mod:`site` module(模組)所添增的常數" -#: ../../library/constants.rst:91 +#: ../../library/constants.rst:92 msgid "" "The :mod:`site` module (which is imported automatically during startup, " "except if the :option:`-S` command-line option is given) adds several " @@ -162,7 +162,7 @@ msgstr "" "指令行選項)會添增一些常數到內建命名空間 (built-in namespace) 中。它們在互動" "式直譯器中是很有幫助的,但不應該在程式 (programs) 中被使用。" -#: ../../library/constants.rst:99 +#: ../../library/constants.rst:100 msgid "" "Objects that when printed, print a message like \"Use quit() or Ctrl-D (i.e. " "EOF) to exit\", and when accessed directly in the interactive interpreter or " @@ -172,24 +172,24 @@ msgstr "" "直接在互動式直譯器中存取或作為函式呼叫時,會引發 :exc:`SystemExit` 並帶有指定" "的返回碼(exit code)。" -#: ../../library/constants.rst:107 +#: ../../library/constants.rst:108 msgid "" "Object that when printed, prints the message \"Type help() for interactive " "help, or help(object) for help about object.\", and when accessed directly " -"in the interactive interpreter, invokes the built-in help system " -"(see :func:`help`)." +"in the interactive interpreter, invokes the built-in help system (see :func:" +"`help`)." msgstr "" "當印出此物件時,會印出訊息 \"Type help() for interactive help, or " "help(object) for help about object.\",並在互動式直譯器中直接存取時,會叫用內" "建的幫助系統(參見 :func:`help`)。" -#: ../../library/constants.rst:115 +#: ../../library/constants.rst:116 msgid "" "Objects that when printed or called, print the text of copyright or credits, " "respectively." msgstr "當印出或是呼叫此物件時,分別會印出版權與致謝的文字。" -#: ../../library/constants.rst:120 +#: ../../library/constants.rst:121 msgid "" "Object that when printed, prints the message \"Type license() to see the " "full license text\", and when called, displays the full license text in a " @@ -204,4 +204,4 @@ msgstr "..." #: ../../library/constants.rst:65 msgid "ellipsis literal" -msgstr "ellipsis literal(刪節號)" +msgstr "ellipsis literal(刪節號字面值)" diff --git a/library/csv.po b/library/csv.po index f4fc801561a..300da9c5905 100644 --- a/library/csv.po +++ b/library/csv.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2023-11-08 15:06+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -105,22 +105,22 @@ msgstr "" "其中每個字串都要是讀取器所定義的 csv 格式,csvfile 通常是個類檔案物件或者 " "list。如果 *csvfile* 是個檔案物件,則需開啟時使用 ``newline=''``。 [1]_ " "*dialect* 為一個可選填的參數,可以用為特定的 CSV dialect(方言) 定義一組參" -"數。它可能為 :class:`Dialect` 的一個子類別 (subclass) 的實例或是" -"由 :func:`list_dialects` 函式回傳的多個字串中的其中之一。另一個可選填的關鍵字" -"引數 *fmtparams* 可以在這個 dialect 中覆寫 (override) 個別的格式化參數 " -"(formatting parameter)。關於 dialect 及格式化參數的完整說明,請見段" -"落 :ref:`csv-fmt-params`。" +"數。它可能為 :class:`Dialect` 的一個子類別 (subclass) 的實例或是由 :func:" +"`list_dialects` 函式回傳的多個字串中的其中之一。另一個可選填的關鍵字引數 " +"*fmtparams* 可以在這個 dialect 中覆寫 (override) 個別的格式化參數 " +"(formatting parameter)。關於 dialect 及格式化參數的完整說明,請見段落 :ref:" +"`csv-fmt-params`。" #: ../../library/csv.rst:72 msgid "" "Each row read from the csv file is returned as a list of strings. No " -"automatic data type conversion is performed unless " -"the :data:`QUOTE_NONNUMERIC` format option is specified (in which case " -"unquoted fields are transformed into floats)." +"automatic data type conversion is performed unless the :data:" +"`QUOTE_NONNUMERIC` format option is specified (in which case unquoted fields " +"are transformed into floats)." msgstr "" -"從 CSV 檔案讀取的每一列會回傳為一個字串列表。除非格式選" -"項 :data:`QUOTE_NONNUMERIC` 有被指定(在這個情況之下,沒有引號的欄位都會被轉" -"換成浮點數),否則不會進行自動資料型別轉換。" +"從 CSV 檔案讀取的每一列會回傳為一個字串列表。除非格式選項 :data:" +"`QUOTE_NONNUMERIC` 有被指定(在這個情況之下,沒有引號的欄位都會被轉換成浮點" +"數),否則不會進行自動資料型別轉換。" #: ../../library/csv.rst:76 ../../library/csv.rst:106 ../../library/csv.rst:181 #: ../../library/csv.rst:219 @@ -152,12 +152,12 @@ msgid "" "object with a :meth:`~io.TextIOBase.write` method. If *csvfile* is a file " "object, it should be opened with ``newline=''`` [1]_. An optional *dialect* " "parameter can be given which is used to define a set of parameters specific " -"to a particular CSV dialect. It may be an instance of a subclass of " -"the :class:`Dialect` class or one of the strings returned by " -"the :func:`list_dialects` function. The other optional *fmtparams* keyword " -"arguments can be given to override individual formatting parameters in the " -"current dialect. For full details about dialects and formatting parameters, " -"see the :ref:`csv-fmt-params` section. To make it as easy as possible to " +"to a particular CSV dialect. It may be an instance of a subclass of the :" +"class:`Dialect` class or one of the strings returned by the :func:" +"`list_dialects` function. The other optional *fmtparams* keyword arguments " +"can be given to override individual formatting parameters in the current " +"dialect. For full details about dialects and formatting parameters, see " +"the :ref:`csv-fmt-params` section. To make it as easy as possible to " "interface with modules which implement the DB API, the value :const:`None` " "is written as the empty string. While this isn't a reversible " "transformation, it makes it easier to dump SQL NULL data values to CSV files " @@ -208,8 +208,8 @@ msgstr "" #: ../../library/csv.rst:127 msgid "" -"Delete the dialect associated with *name* from the dialect registry. " -"An :exc:`Error` is raised if *name* is not a registered dialect name." +"Delete the dialect associated with *name* from the dialect registry. An :" +"exc:`Error` is raised if *name* is not a registered dialect name." msgstr "" "從 dialect 註冊表 (registry) 中,刪除與 *name* 關聯的 dialect。若 *name* 如果" "不是註冊的 dialect 名稱,則會產生一個 :exc:`Error`。" @@ -221,8 +221,8 @@ msgid "" "immutable :class:`Dialect`." msgstr "" "回傳一個與 *name* 關聯的 dialect。若 *name* 如果不是註冊的 dialect 名稱,則會" -"產生一個 :exc:`Error`。這個函式會回傳一個 immutable (不可變物" -"件) :class:`Dialect`。" +"產生一個 :exc:`Error`。這個函式會回傳一個 immutable (不可變物件) :class:" +"`Dialect`。" #: ../../library/csv.rst:139 msgid "Return the names of all registered dialects." @@ -246,8 +246,8 @@ msgid "" "information in each row to a :class:`dict` whose keys are given by the " "optional *fieldnames* parameter." msgstr "" -"建立一個物件,其運作上就像一般的讀取器,但可以將每一列資訊 map (對映) " -"到 :class:`dict` 中,可以透過選填的參數 *fieldnames* 設定 key。" +"建立一個物件,其運作上就像一般的讀取器,但可以將每一列資訊 map (對映) 到 :" +"class:`dict` 中,可以透過選填的參數 *fieldnames* 設定 key。" #: ../../library/csv.rst:157 msgid "" @@ -277,8 +277,8 @@ msgstr "" #: ../../library/csv.rst:170 msgid "" -"All other optional or keyword arguments are passed to the " -"underlying :class:`reader` instance." +"All other optional or keyword arguments are passed to the underlying :class:" +"`reader` instance." msgstr "所有其他選填的引數或關鍵字引數皆會傳遞至下層的 :class:`reader` 實例。" #: ../../library/csv.rst:173 ../../library/csv.rst:217 @@ -332,10 +332,10 @@ msgid "" "written if the dictionary is missing a key in *fieldnames*. If the " "dictionary passed to the :meth:`~csvwriter.writerow` method contains a key " "not found in *fieldnames*, the optional *extrasaction* parameter indicates " -"what action to take. If it is set to ``'raise'``, the default value, " -"a :exc:`ValueError` is raised. If it is set to ``'ignore'``, extra values in " -"the dictionary are ignored. Any other optional or keyword arguments are " -"passed to the underlying :class:`writer` instance." +"what action to take. If it is set to ``'raise'``, the default value, a :exc:" +"`ValueError` is raised. If it is set to ``'ignore'``, extra values in the " +"dictionary are ignored. Any other optional or keyword arguments are passed " +"to the underlying :class:`writer` instance." msgstr "" "建立一個物件,其運作上就像一般的寫入器,但可以將 dictionary map 到輸出的列" "上。參數 *fieldnames* 是一個鍵值的 :mod:`sequence ` 且可以辨" @@ -384,13 +384,13 @@ msgid "" "The :class:`Dialect` class is a container class whose attributes contain " "information for how to handle doublequotes, whitespace, delimiters, etc. Due " "to the lack of a strict CSV specification, different applications produce " -"subtly different CSV data. :class:`Dialect` instances define " -"how :class:`reader` and :class:`writer` instances behave." +"subtly different CSV data. :class:`Dialect` instances define how :class:" +"`reader` and :class:`writer` instances behave." msgstr "" "類別 :class:`Dialect` 是一個容器類別,其屬性 (attribute) 包含如何處理雙引號、" "空白、分隔符號等資訊。由於缺少一個嚴謹的 CSV 技術規範,不同的應用程式會產出有" -"巧妙不同的 CSV 資料。:class:`Dialect` 實例定義了 :class:`reader` 以" -"及 :class:`writer` 的實例該如何表示。" +"巧妙不同的 CSV 資料。:class:`Dialect` 實例定義了 :class:`reader` 以及 :class:" +"`writer` 的實例該如何表示。" #: ../../library/csv.rst:241 msgid "" @@ -461,10 +461,10 @@ msgstr "" #: ../../library/csv.rst:288 msgid "" -"Analyze the sample text (presumed to be in CSV format) and " -"return :const:`True` if the first row appears to be a series of column " -"headers. Inspecting each column, one of two key criteria will be considered " -"to estimate if the sample contains a header:" +"Analyze the sample text (presumed to be in CSV format) and return :const:" +"`True` if the first row appears to be a series of column headers. Inspecting " +"each column, one of two key criteria will be considered to estimate if the " +"sample contains a header:" msgstr "" "如果第一列的文字顯示將作為一系列的欄位標題,會分析 sample 文字(假定他是 CSV " "格式)並回傳 :const:`True`。檢查每一欄時,會考慮是否滿足兩個關鍵標準其中之" @@ -486,8 +486,8 @@ msgid "" "Twenty rows after the first row are sampled; if more than half of columns + " "rows meet the criteria, :const:`True` is returned." msgstr "" -"對第一列之後的二十個列進行取樣;如果超過一半的行及列滿足條件,則返" -"回 :const:`True`。" +"對第一列之後的二十個列進行取樣;如果超過一半的行及列滿足條件,則返回 :const:" +"`True`。" #: ../../library/csv.rst:302 msgid "" @@ -538,16 +538,16 @@ msgstr "引導 :class:`writer` 物件引用所有非數字的欄位。" #: ../../library/csv.rst:334 msgid "" -"Instructs :class:`reader` objects to convert all non-quoted fields to " -"type :class:`float`." +"Instructs :class:`reader` objects to convert all non-quoted fields to type :" +"class:`float`." msgstr "引導 :class:`reader` 物件轉換所有非引用的欄位為 :class:`float`。" #: ../../library/csv.rst:337 msgid "" -"Some numeric types, such as :class:`bool`, :class:`~fractions.Fraction`, " -"or :class:`~enum.IntEnum`, have a string representation that cannot be " -"converted to :class:`float`. They cannot be read in " -"the :data:`QUOTE_NONNUMERIC` and :data:`QUOTE_STRINGS` modes." +"Some numeric types, such as :class:`bool`, :class:`~fractions.Fraction`, or :" +"class:`~enum.IntEnum`, have a string representation that cannot be converted " +"to :class:`float`. They cannot be read in the :data:`QUOTE_NONNUMERIC` and :" +"data:`QUOTE_STRINGS` modes." msgstr "" #: ../../library/csv.rst:345 @@ -593,17 +593,17 @@ msgid "" "are strings. This is similar to :data:`QUOTE_NONNUMERIC`, except that if a " "field value is ``None`` an empty (unquoted) string is written." msgstr "" -"引導 :class:`writer` 物件永遠在字串的欄位前後放置引號。這" -"與 :data:`QUOTE_NONNUMERIC` 相似,除非如果欄位值為 ``None``,該欄位則被寫成空" -"(沒有引號)字串。" +"引導 :class:`writer` 物件永遠在字串的欄位前後放置引號。這與 :data:" +"`QUOTE_NONNUMERIC` 相似,除非如果欄位值為 ``None``,該欄位則被寫成空(沒有引" +"號)字串。" #: ../../library/csv.rst:372 msgid "" "Instructs :class:`reader` objects to interpret an empty (unquoted) string as " "``None`` and to otherwise behave as :data:`QUOTE_NONNUMERIC`." msgstr "" -"引導 :class:`reader` 物件將空(沒有引號)字串直譯為 ``None``,否則會" -"和 :data:`QUOTE_ALL` 有相同的表現方式。" +"引導 :class:`reader` 物件將空(沒有引號)字串直譯為 ``None``,否則會和 :data:" +"`QUOTE_ALL` 有相同的表現方式。" #: ../../library/csv.rst:377 msgid "The :mod:`csv` module defines the following exception:" @@ -622,19 +622,19 @@ msgid "" "To make it easier to specify the format of input and output records, " "specific formatting parameters are grouped together into dialects. A " "dialect is a subclass of the :class:`Dialect` class containing various " -"attributes describing the format of the CSV file. When " -"creating :class:`reader` or :class:`writer` objects, the programmer can " -"specify a string or a subclass of the :class:`Dialect` class as the dialect " -"parameter. In addition to, or instead of, the *dialect* parameter, the " -"programmer can also specify individual formatting parameters, which have the " -"same names as the attributes defined below for the :class:`Dialect` class." +"attributes describing the format of the CSV file. When creating :class:" +"`reader` or :class:`writer` objects, the programmer can specify a string or " +"a subclass of the :class:`Dialect` class as the dialect parameter. In " +"addition to, or instead of, the *dialect* parameter, the programmer can also " +"specify individual formatting parameters, which have the same names as the " +"attributes defined below for the :class:`Dialect` class." msgstr "" "為了讓指定輸入及輸出紀錄的格式更方便,特定的格式化參數會被組成 dialect。一個 " "dialect 是 :class:`Dialect` class 的子類別,其包含多個描述 CSV 檔案格式的多個" "屬性。當建立 :class:`reader` 或 :class:`writer` 物件時,程式設計師可以指定一" "個字串或是一個 :class:`Dialect` 的子類別作為 dialect 參數。此外,或是作為替" -"代,在\\ *dialect*\\ 參數中,程式設計師可以指定個別的格式化參數,其" -"與 :class:`Dialect` 類別定義的屬性具有相同的名字。" +"代,在\\ *dialect*\\ 參數中,程式設計師可以指定個別的格式化參數,其與 :class:" +"`Dialect` 類別定義的屬性具有相同的名字。" #: ../../library/csv.rst:399 msgid "Dialects support the following attributes:" @@ -648,9 +648,9 @@ msgstr "一個單一字元 (one-character) 的字串可已用來分割欄位。 #: ../../library/csv.rst:409 msgid "" "Controls how instances of *quotechar* appearing inside a field should " -"themselves be quoted. When :const:`True`, the character is doubled. " -"When :const:`False`, the *escapechar* is used as a prefix to the " -"*quotechar*. It defaults to :const:`True`." +"themselves be quoted. When :const:`True`, the character is doubled. When :" +"const:`False`, the *escapechar* is used as a prefix to the *quotechar*. It " +"defaults to :const:`True`." msgstr "" "控制 *quotechar* 的實例何時出現在欄位之中,並讓它們自己被放在引號之內。當屬性" "為 :const:`True`,字元會是雙引號。若為 :const:`False`,在 *quotechar* 之前會" @@ -658,8 +658,8 @@ msgstr "" #: ../../library/csv.rst:414 msgid "" -"On output, if *doublequote* is :const:`False` and no *escapechar* is " -"set, :exc:`Error` is raised if a *quotechar* is found in a field." +"On output, if *doublequote* is :const:`False` and no *escapechar* is set, :" +"exc:`Error` is raised if a *quotechar* is found in a field." msgstr "" "在輸出時,若 *doublequote* 是 :const:`False` 且\\ *逸出字元*\\ 沒有被設定,當" "一個\\ *引號*\\ 在欄位中被發現時,:exc:`Error` 會被引發。" @@ -673,8 +673,8 @@ msgstr "一個單一字元的字串,會被寫入器用來逸出需要逸出的 #: ../../library/csv.rst:423 msgid "" "the *delimiter*, the *quotechar*, ``'\\r'``, ``'\\n'`` and any of the " -"characters in *lineterminator* are escaped if *quoting* is set " -"to :const:`QUOTE_NONE`;" +"characters in *lineterminator* are escaped if *quoting* is set to :const:" +"`QUOTE_NONE`;" msgstr "" #: ../../library/csv.rst:426 @@ -737,37 +737,38 @@ msgid "" "``None``, and :const:`QUOTE_NONE` otherwise." msgstr "" "控制 writer 何時產生引號,以及 reader 如何辨識引號。如 *quotechar* 不為 " -"``None``,則可以使用任何 :ref:`QUOTE_\\* 常數 `\\ 且預設" -"為 :const:`QUOTE_MINIMAL`。否則預設為 :const:`QUOTE_NONE`。" +"``None``,則可以使用任何 :ref:`QUOTE_\\* 常數 `\\ 且預設為 :" +"const:`QUOTE_MINIMAL`。否則預設為 :const:`QUOTE_NONE`。" #: ../../library/csv.rst:469 msgid "" "When :const:`True`, spaces immediately following the *delimiter* are " -"ignored. The default is :const:`False`." +"ignored. The default is :const:`False`. When combining ``delimiter=' '`` " +"with ``skipinitialspace=True``, unquoted empty fields are not allowed." msgstr "" -"若為 :const:`True`,在緊接著\\ *delimiter*\\ 後的空格會被忽略。預設" -"為 :const:`False`。" +"若為 :const:`True`,在緊接著\\ *delimiter*\\ 後的空格會被忽略。預設為 :const:" +"`False`。當結合 ``delimiter=' '`` 與 ``skipinitialspace=True`` 時,不允許沒有引號的空欄位。" -#: ../../library/csv.rst:475 +#: ../../library/csv.rst:476 msgid "" "When ``True``, raise exception :exc:`Error` on bad CSV input. The default is " "``False``." msgstr "" "若為 ``True``,若有錯誤的 CSV 輸入則會引發 :exc:`Error`。預設為 ``False``。" -#: ../../library/csv.rst:481 +#: ../../library/csv.rst:482 msgid "Reader Objects" msgstr "讀取器物件" -#: ../../library/csv.rst:483 +#: ../../library/csv.rst:484 msgid "" -"Reader objects (:class:`DictReader` instances and objects returned by " -"the :func:`reader` function) have the following public methods:" +"Reader objects (:class:`DictReader` instances and objects returned by the :" +"func:`reader` function) have the following public methods:" msgstr "" "讀取器物件(:func:`reader` 函式回傳的 :class:`DictReader` 實例與物件)有下列" "公開方法 (public method):" -#: ../../library/csv.rst:488 +#: ../../library/csv.rst:489 msgid "" "Return the next row of the reader's iterable object as a list (if the object " "was returned from :func:`reader`) or a dict (if it is a :class:`DictReader` " @@ -775,28 +776,28 @@ msgid "" "should call this as ``next(reader)``." msgstr "" "回傳一個列表為讀入器的可疊代物件的下一列內容(若該物件是由 :func:`reader` 回" -"傳)或是一個 dict(若為 :class:`DictReader` 實例),會依據目前" -"的 :class:`Dialect` 進行剖析。通常會用 ``next(reader)`` 來進行呼叫。" +"傳)或是一個 dict(若為 :class:`DictReader` 實例),會依據目前的 :class:" +"`Dialect` 進行剖析。通常會用 ``next(reader)`` 來進行呼叫。" -#: ../../library/csv.rst:494 +#: ../../library/csv.rst:495 msgid "Reader objects have the following public attributes:" msgstr "讀取器物件有下列公開屬性 (public attributes):" -#: ../../library/csv.rst:498 +#: ../../library/csv.rst:499 msgid "A read-only description of the dialect in use by the parser." msgstr "dialect 的唯讀敘述,會被剖析器使用。" -#: ../../library/csv.rst:503 +#: ../../library/csv.rst:504 msgid "" "The number of lines read from the source iterator. This is not the same as " "the number of records returned, as records can span multiple lines." msgstr "來源疊代器所讀取的行數。這與回傳的紀錄數不同,因為可以進行跨行紀錄。" -#: ../../library/csv.rst:507 +#: ../../library/csv.rst:508 msgid "DictReader objects have the following public attribute:" msgstr "DictReader 物件有下列公開屬性:" -#: ../../library/csv.rst:511 +#: ../../library/csv.rst:512 msgid "" "If not passed as a parameter when creating the object, this attribute is " "initialized upon first access or when the first record is read from the file." @@ -804,11 +805,11 @@ msgstr "" "若在建立物件時沒有作為參數傳遞,這個屬性會在第一次存取之前或是第一筆資料被讀" "取之前進行初始化 (initialize)。" -#: ../../library/csv.rst:518 +#: ../../library/csv.rst:519 msgid "Writer Objects" msgstr "寫入器物件" -#: ../../library/csv.rst:520 +#: ../../library/csv.rst:521 msgid "" ":class:`writer` objects (:class:`DictWriter` instances and objects returned " "by the :func:`writer` function) have the following public methods. A *row* " @@ -826,7 +827,7 @@ msgstr "" "遞)。請注意,在寫入複數 (complex number) 時會用小括號 (parens) 包起來。這可" "能在其他程式讀取 CSV 檔案時導致某些問題(假設他們完全支援複雜數字)。" -#: ../../library/csv.rst:531 +#: ../../library/csv.rst:532 msgid "" "Write the *row* parameter to the writer's file object, formatted according " "to the current :class:`Dialect`. Return the return value of the call to the " @@ -835,11 +836,11 @@ msgstr "" "將參數 *row* 寫入至寫入器的檔案物件中,並依照目前的 :class:`Dialect` 進行格式" "化。回傳下層檔案物件 *write* 方法的回傳值。" -#: ../../library/csv.rst:535 +#: ../../library/csv.rst:536 msgid "Added support of arbitrary iterables." msgstr "新增對任意可疊代物件 (arbitrary iterables) 的支援。" -#: ../../library/csv.rst:540 +#: ../../library/csv.rst:541 msgid "" "Write all elements in *rows* (an iterable of *row* objects as described " "above) to the writer's file object, formatted according to the current " @@ -848,19 +849,19 @@ msgstr "" "將 *rows* 中所有元素(為上述的一個可疊代的 *row* 物件)寫入至寫入器的檔案物件" "中,並依照目前的 dialect 進行格式化。" -#: ../../library/csv.rst:544 +#: ../../library/csv.rst:545 msgid "Writer objects have the following public attribute:" msgstr "寫入器物件有下列公開屬性:" -#: ../../library/csv.rst:549 +#: ../../library/csv.rst:550 msgid "A read-only description of the dialect in use by the writer." msgstr "dialect 的唯讀敘述,會被寫入器使用。" -#: ../../library/csv.rst:552 +#: ../../library/csv.rst:553 msgid "DictWriter objects have the following public method:" msgstr "DictWriter 物件有下列公開方法:" -#: ../../library/csv.rst:557 +#: ../../library/csv.rst:558 msgid "" "Write a row with the field names (as specified in the constructor) to the " "writer's file object, formatted according to the current dialect. Return the " @@ -870,23 +871,23 @@ msgstr "" "中,並依照目前的 dialect 進行格式化。回傳內部呼叫 :meth:`csvwriter.writerow` " "的回傳值。" -#: ../../library/csv.rst:562 +#: ../../library/csv.rst:563 msgid "" -":meth:`writeheader` now also returns the value returned by " -"the :meth:`csvwriter.writerow` method it uses internally." +":meth:`writeheader` now also returns the value returned by the :meth:" +"`csvwriter.writerow` method it uses internally." msgstr "" ":meth:`writeheader` 現在也會回傳內部呼叫 :meth:`csvwriter.writerow` 的回傳" "值。" -#: ../../library/csv.rst:570 +#: ../../library/csv.rst:571 msgid "Examples" msgstr "範例" -#: ../../library/csv.rst:572 +#: ../../library/csv.rst:573 msgid "The simplest example of reading a CSV file::" msgstr "最簡單的讀取 CSV 檔案範例: ::" -#: ../../library/csv.rst:574 +#: ../../library/csv.rst:575 msgid "" "import csv\n" "with open('some.csv', newline='') as f:\n" @@ -900,11 +901,11 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:580 +#: ../../library/csv.rst:581 msgid "Reading a file with an alternate format::" msgstr "讀取一個其他格式的檔案: ::" -#: ../../library/csv.rst:582 +#: ../../library/csv.rst:583 msgid "" "import csv\n" "with open('passwd', newline='') as f:\n" @@ -918,11 +919,11 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:588 +#: ../../library/csv.rst:589 msgid "The corresponding simplest possible writing example is::" msgstr "相對最簡單、可行的寫入範例為: ::" -#: ../../library/csv.rst:590 +#: ../../library/csv.rst:591 msgid "" "import csv\n" "with open('some.csv', 'w', newline='') as f:\n" @@ -930,18 +931,18 @@ msgid "" " writer.writerows(someiterable)" msgstr "" -#: ../../library/csv.rst:595 +#: ../../library/csv.rst:596 msgid "" "Since :func:`open` is used to open a CSV file for reading, the file will by " -"default be decoded into unicode using the system default encoding " -"(see :func:`locale.getencoding`). To decode a file using a different " -"encoding, use the ``encoding`` argument of open::" +"default be decoded into unicode using the system default encoding (see :func:" +"`locale.getencoding`). To decode a file using a different encoding, use the " +"``encoding`` argument of open::" msgstr "" "當 :func:`open` 被使用於開啟並讀取一個 CSV 檔案,該檔案會預設使用系統預設的編" "碼格式(請見 :func:`locale.getencoding`),並解碼為 unicode。若要使用不同編碼" "格式進行檔案解碼,請使用 open 函式的 ``encoding`` 引數: ::" -#: ../../library/csv.rst:600 +#: ../../library/csv.rst:601 msgid "" "import csv\n" "with open('some.csv', newline='', encoding='utf-8') as f:\n" @@ -955,7 +956,7 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:606 +#: ../../library/csv.rst:607 msgid "" "The same applies to writing in something other than the system default " "encoding: specify the encoding argument when opening the output file." @@ -963,11 +964,11 @@ msgstr "" "同理可以應用到使用不同編碼格式進行寫入:當開啟輸出檔案時,指定 ``encoding`` " "引數。" -#: ../../library/csv.rst:609 +#: ../../library/csv.rst:610 msgid "Registering a new dialect::" msgstr "註冊一個新的 dialect : ::" -#: ../../library/csv.rst:611 +#: ../../library/csv.rst:612 msgid "" "import csv\n" "csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)\n" @@ -979,13 +980,13 @@ msgstr "" "with open('passwd', newline='') as f:\n" " reader = csv.reader(f, 'unixpwd')" -#: ../../library/csv.rst:616 +#: ../../library/csv.rst:617 msgid "" "A slightly more advanced use of the reader --- catching and reporting " "errors::" msgstr "稍微進階的讀取器用法 -- 擷取及回報錯誤: ::" -#: ../../library/csv.rst:618 +#: ../../library/csv.rst:619 msgid "" "import csv, sys\n" "filename = 'some.csv'\n" @@ -1007,13 +1008,13 @@ msgstr "" " except csv.Error as e:\n" " sys.exit(f'file {filename}, line {reader.line_num}: {e}')" -#: ../../library/csv.rst:628 +#: ../../library/csv.rst:629 msgid "" "And while the module doesn't directly support parsing strings, it can easily " "be done::" msgstr "而當模組無法直接支援剖析字串時,仍可以輕鬆的解決: ::" -#: ../../library/csv.rst:631 +#: ../../library/csv.rst:632 msgid "" "import csv\n" "for row in csv.reader(['one,two,three']):\n" @@ -1023,20 +1024,20 @@ msgstr "" "for row in csv.reader(['one,two,three']):\n" " print(row)" -#: ../../library/csv.rst:637 +#: ../../library/csv.rst:638 msgid "Footnotes" msgstr "註解" -#: ../../library/csv.rst:638 +#: ../../library/csv.rst:639 msgid "" "If ``newline=''`` is not specified, newlines embedded inside quoted fields " -"will not be interpreted correctly, and on platforms that use ``\\r\\n`` " -"linendings on write an extra ``\\r`` will be added. It should always be " -"safe to specify ``newline=''``, since the csv module does its own " -"(:term:`universal `) newline handling." +"will not be interpreted correctly, and on platforms that use ``\\r\\n`` line " +"endings on write an extra ``\\r`` will be added. It should always be safe " +"to specify ``newline=''``, since the csv module does its own (:term:" +"`universal `) newline handling." msgstr "" "如果 ``newline=''`` 沒有被指定,則嵌入引號中的換行符號不會被正確直譯,使用 " -"``\\r\\n`` 行尾 (linending) 的平台會寫入額外的 ``\\r``。自從 csv 模組有自己 " +"``\\r\\n`` 行尾 (line ending) 的平台會寫入額外的 ``\\r``。自從 csv 模組有自己 " "(:term:`統一的 `) 換行處理方式,因此指定 ``newline=''`` " "會永遠是安全的。" diff --git a/library/enum.po b/library/enum.po index fd17ead394b..23d76be0111 100644 --- a/library/enum.po +++ b/library/enum.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2024-12-21 13:50+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -125,8 +125,8 @@ msgid "" "The enum members have *names* and *values* (the name of :attr:`!Color.RED` " "is ``RED``, the value of :attr:`!Color.BLUE` is ``3``, etc.)" msgstr "" -"列舉成員有\\ *名稱*\\ 和\\ *值*\\ (:attr:`!Color.RED` 的名稱是 " -"``RED``,:attr:`!Color.BLUE` 的值是 ``3`` 諸如此類)" +"列舉成員有\\ *名稱*\\ 和\\ *值*\\ (:attr:`!Color.RED` 的名稱是 ``RED``,:" +"attr:`!Color.BLUE` 的值是 ``3`` 諸如此類)" #: ../../library/enum.rst:65 msgid "Module Contents" @@ -154,8 +154,8 @@ msgstr ":class:`IntEnum`" #: ../../library/enum.rst:77 msgid "" -"Base class for creating enumerated constants that are also subclasses " -"of :class:`int`. (`Notes`_)" +"Base class for creating enumerated constants that are also subclasses of :" +"class:`int`. (`Notes`_)" msgstr "" "用來建立列舉常數的基礎類別,同時也是 :class:`int` 的子類別。(`備註 " "`_)" @@ -166,8 +166,8 @@ msgstr ":class:`StrEnum`" #: ../../library/enum.rst:82 msgid "" -"Base class for creating enumerated constants that are also subclasses " -"of :class:`str`. (`Notes`_)" +"Base class for creating enumerated constants that are also subclasses of :" +"class:`str`. (`Notes`_)" msgstr "" "用來建立列舉常數的基礎類別,同時也是 :class:`str` 的子類別。(`備註 " "`_)" @@ -181,8 +181,8 @@ msgid "" "Base class for creating enumerated constants that can be combined using the " "bitwise operations without losing their :class:`Flag` membership." msgstr "" -"用來建立列舉常數的基礎類別,可以使用位元操作來結合成員且其結果不失" -"去 :class:`Flag` 的成員資格。" +"用來建立列舉常數的基礎類別,可以使用位元操作來結合成員且其結果不失去 :class:" +"`Flag` 的成員資格。" #: ../../library/enum.rst:90 msgid ":class:`IntFlag`" @@ -191,13 +191,12 @@ msgstr ":class:`IntFlag`" #: ../../library/enum.rst:92 msgid "" "Base class for creating enumerated constants that can be combined using the " -"bitwise operators without losing their :class:`IntFlag` " -"membership. :class:`IntFlag` members are also subclasses of :class:`int`. " -"(`Notes`_)" +"bitwise operators without losing their :class:`IntFlag` membership. :class:" +"`IntFlag` members are also subclasses of :class:`int`. (`Notes`_)" msgstr "" -"用來建立列舉常數的基礎類別,可以使用位元操作來結合成員且其結果不失" -"去 :class:`IntFlag` 的成員資格。:class:`IntFlag` 的成員也是 :class:`int` 的子" -"類別。(`備註 `_)" +"用來建立列舉常數的基礎類別,可以使用位元操作來結合成員且其結果不失去 :class:" +"`IntFlag` 的成員資格。:class:`IntFlag` 的成員也是 :class:`int` 的子類別。(`" +"備註 `_)" #: ../../library/enum.rst:96 msgid ":class:`ReprEnum`" @@ -221,8 +220,8 @@ msgid "" "``UNIQUE``, for use with :func:`verify` to ensure various constraints are " "met by a given enumeration." msgstr "" -"一個有 ``CONTINUOUS``、``NAMED_FLAGS`` 及 ``UNIQUE`` 這些值的列舉," -"和 :func:`verify` 一起使用來確保給定的列舉符合多種限制。" +"一個有 ``CONTINUOUS``、``NAMED_FLAGS`` 及 ``UNIQUE`` 這些值的列舉,和 :func:" +"`verify` 一起使用來確保給定的列舉符合多種限制。" #: ../../library/enum.rst:107 msgid ":class:`FlagBoundary`" @@ -251,9 +250,9 @@ msgstr ":class:`auto`" #: ../../library/enum.rst:119 msgid "" -"Instances are replaced with an appropriate value for Enum " -"members. :class:`StrEnum` defaults to the lower-cased version of the member " -"name, while other Enums default to 1 and increase from there." +"Instances are replaced with an appropriate value for Enum members. :class:" +"`StrEnum` defaults to the lower-cased version of the member name, while " +"other Enums default to 1 and increase from there." msgstr "" "列舉成員的實例會被取代成合適的值。:class:`StrEnum` 預設是小寫版本的成員名稱," "其它列舉則預設是 1 且往後遞增。" @@ -358,20 +357,26 @@ msgstr "" #: ../../library/enum.rst:173 msgid "" -"``EnumType`` is responsible for setting the correct :meth:`!" -"__repr__`, :meth:`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` " -"methods on the final *enum*, as well as creating the enum members, properly " -"handling duplicates, providing iteration over the enum class, etc." +"``EnumType`` is responsible for setting the correct :meth:`!__repr__`, :meth:" +"`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the " +"final *enum*, as well as creating the enum members, properly handling " +"duplicates, providing iteration over the enum class, etc." msgstr "" -"``EnumType`` 負責在最後的\\ *列舉*\\ 上面設定正確的 :meth:`!" -"__repr__`、:meth:`!__str__`、:meth:`!__format__` 及 :meth:`!__reduce__` 方" -"法,以及建立列舉成員、正確處理重複、提供列舉類別的疊代等等。" +"``EnumType`` 負責在最後的\\ *列舉*\\ 上面設定正確的 :meth:`!__repr__`、:meth:" +"`!__str__`、:meth:`!__format__` 及 :meth:`!__reduce__` 方法,以及建立列舉成" +"員、正確處理重複、提供列舉類別的疊代等等。" #: ../../library/enum.rst:180 +msgid "" +"Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available " +"as an alias." +msgstr "在 3.11 之前,``EnumType`` 稱作 ``EnumMeta``,其目前仍可作為別名使用。" + +#: ../../library/enum.rst:184 msgid "This method is called in two different ways:" msgstr "這個方法可以用兩種不同的方式呼叫:" -#: ../../library/enum.rst:182 +#: ../../library/enum.rst:186 msgid "to look up an existing member:" msgstr "查詢已存在的成員:" @@ -379,7 +384,7 @@ msgstr "查詢已存在的成員:" msgid "cls" msgstr "cls" -#: ../../library/enum.rst:184 ../../library/enum.rst:190 +#: ../../library/enum.rst:188 ../../library/enum.rst:194 msgid "The enum class being called." msgstr "所呼叫的列舉類別。" @@ -387,17 +392,17 @@ msgstr "所呼叫的列舉類別。" msgid "value" msgstr "value" -#: ../../library/enum.rst:185 +#: ../../library/enum.rst:189 msgid "The value to lookup." msgstr "要查詢的值。" -#: ../../library/enum.rst:187 +#: ../../library/enum.rst:191 msgid "" "to use the ``cls`` enum to create a new enum (only if the existing enum does " "not have any members):" msgstr "使用 ``cls`` 列舉來建立新列舉(只有在現有列舉沒有任何成員時)" -#: ../../library/enum.rst:191 +#: ../../library/enum.rst:195 msgid "The name of the new Enum to create." msgstr "要建立的新列舉的名稱。" @@ -405,7 +410,7 @@ msgstr "要建立的新列舉的名稱。" msgid "names" msgstr "names" -#: ../../library/enum.rst:192 +#: ../../library/enum.rst:196 msgid "The names/values of the members for the new Enum." msgstr "新列舉的成員的名稱/值。" @@ -413,7 +418,7 @@ msgstr "新列舉的成員的名稱/值。" msgid "module" msgstr "module" -#: ../../library/enum.rst:193 +#: ../../library/enum.rst:197 msgid "The name of the module the new Enum is created in." msgstr "新列舉要建立在哪個模組名稱下。" @@ -421,7 +426,7 @@ msgstr "新列舉要建立在哪個模組名稱下。" msgid "qualname" msgstr "qualname" -#: ../../library/enum.rst:194 +#: ../../library/enum.rst:198 msgid "The actual location in the module where this Enum can be found." msgstr "這個列舉在模組裡實際上的位置。" @@ -429,7 +434,7 @@ msgstr "這個列舉在模組裡實際上的位置。" msgid "type" msgstr "type" -#: ../../library/enum.rst:195 +#: ../../library/enum.rst:199 msgid "A mix-in type for the new Enum." msgstr "新列舉的混合型別。" @@ -437,7 +442,7 @@ msgstr "新列舉的混合型別。" msgid "start" msgstr "start" -#: ../../library/enum.rst:196 +#: ../../library/enum.rst:200 msgid "The first integer value for the Enum (used by :class:`auto`)." msgstr "列舉的第一個整數值(由 :class:`auto` 所使用)" @@ -445,16 +450,16 @@ msgstr "列舉的第一個整數值(由 :class:`auto` 所使用)" msgid "boundary" msgstr "boundary" -#: ../../library/enum.rst:197 +#: ../../library/enum.rst:201 msgid "" "How to handle out-of-range values from bit operations (:class:`Flag` only)." msgstr "在位元操作時怎麼處理範圍外的值(只有 :class:`Flag` 會用到)" -#: ../../library/enum.rst:201 +#: ../../library/enum.rst:205 msgid "Returns ``True`` if member belongs to the ``cls``::" msgstr "如果 member 屬於 ``cls`` 則回傳 ``True``: ::" -#: ../../library/enum.rst:203 +#: ../../library/enum.rst:207 msgid "" ">>> some_var = Color.RED\n" ">>> some_var in Color\n" @@ -468,7 +473,7 @@ msgstr "" ">>> Color.RED.value in Color\n" "True" -#: ../../library/enum.rst:211 +#: ../../library/enum.rst:215 msgid "" "Before Python 3.12, a ``TypeError`` is raised if a non-Enum-member is used " "in a containment check." @@ -476,7 +481,7 @@ msgstr "" "在 Python 3.12 之前,如果用非列舉成員做屬於檢查 (containment check) 會引發 " "``TypeError``。" -#: ../../library/enum.rst:216 +#: ../../library/enum.rst:220 msgid "" "Returns ``['__class__', '__doc__', '__members__', '__module__']`` and the " "names of the members in *cls*::" @@ -484,7 +489,7 @@ msgstr "" "回傳 ``['__class__', '__doc__', '__members__', '__module__']`` 及 *cls* 的成" "員名稱: ::" -#: ../../library/enum.rst:219 +#: ../../library/enum.rst:223 msgid "" ">>> dir(Color)\n" "['BLUE', 'GREEN', 'RED', '__class__', '__contains__', '__doc__', " @@ -496,13 +501,13 @@ msgstr "" "'__getitem__', '__init_subclass__', '__iter__', '__len__', '__members__', " "'__module__', '__name__', '__qualname__']" -#: ../../library/enum.rst:224 +#: ../../library/enum.rst:228 msgid "" -"Returns the Enum member in *cls* matching *name*, or raises " -"a :exc:`KeyError`::" +"Returns the Enum member in *cls* matching *name*, or raises a :exc:" +"`KeyError`::" msgstr "回傳 *cls* 中符合 *name* 的列舉成員,或引發 :exc:`KeyError`: ::" -#: ../../library/enum.rst:226 +#: ../../library/enum.rst:230 msgid "" ">>> Color['BLUE']\n" "" @@ -510,11 +515,11 @@ msgstr "" ">>> Color['BLUE']\n" "" -#: ../../library/enum.rst:231 +#: ../../library/enum.rst:235 msgid "Returns each member in *cls* in definition order::" msgstr "以定義的順序回傳在 *cls* 中的每個成員: ::" -#: ../../library/enum.rst:233 +#: ../../library/enum.rst:237 msgid "" ">>> list(Color)\n" "[, , ]" @@ -522,11 +527,11 @@ msgstr "" ">>> list(Color)\n" "[, , ]" -#: ../../library/enum.rst:238 +#: ../../library/enum.rst:242 msgid "Returns the number of member in *cls*::" msgstr "回傳 *cls* 的成員數量: ::" -#: ../../library/enum.rst:240 +#: ../../library/enum.rst:244 msgid "" ">>> len(Color)\n" "3" @@ -534,15 +539,15 @@ msgstr "" ">>> len(Color)\n" "3" -#: ../../library/enum.rst:245 +#: ../../library/enum.rst:249 msgid "Returns a mapping of every enum name to its member, including aliases" msgstr "回傳每個列舉名稱到其成員的對映,包括別名" -#: ../../library/enum.rst:249 +#: ../../library/enum.rst:253 msgid "Returns each member in *cls* in reverse definition order::" msgstr "以跟定義相反的順序回傳 *cls* 的每個成員: ::" -#: ../../library/enum.rst:251 +#: ../../library/enum.rst:255 msgid "" ">>> list(reversed(Color))\n" "[, , ]" @@ -550,35 +555,15 @@ msgstr "" ">>> list(reversed(Color))\n" "[, , ]" -#: ../../library/enum.rst:256 -msgid "" -"Adds a new name as an alias to an existing member. Raises " -"a :exc:`NameError` if the name is already assigned to a different member." -msgstr "" -"為已存在的成員新增一個名稱作為別名。如果該名稱已經被指派給不同的成員,則會引發 :exc:`NameError`。" - #: ../../library/enum.rst:261 -msgid "" -"Adds a new value as an alias to an existing member. Raises " -"a :exc:`ValueError` if the value is already linked with a different member." -msgstr "" -"為已存在的成員新增一個值作為別名。如果該值已經被連結到不同的成員,則會引發 :exc:`ValueError`。" - -#: ../../library/enum.rst:266 -msgid "" -"Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available " -"as an alias." -msgstr "在 3.11 之前,``EnumType`` 稱作 ``EnumMeta``,其目前仍可作為別名使用。" - -#: ../../library/enum.rst:271 msgid "*Enum* is the base class for all *enum* enumerations." msgstr "*Enum* 是所有 *enum* 列舉的基礎類別。" -#: ../../library/enum.rst:275 +#: ../../library/enum.rst:265 msgid "The name used to define the ``Enum`` member::" msgstr "用來定義 ``Enum`` 成員的名稱: ::" -#: ../../library/enum.rst:277 +#: ../../library/enum.rst:267 msgid "" ">>> Color.BLUE.name\n" "'BLUE'" @@ -586,11 +571,11 @@ msgstr "" ">>> Color.BLUE.name\n" "'BLUE'" -#: ../../library/enum.rst:282 +#: ../../library/enum.rst:272 msgid "The value given to the ``Enum`` member::" msgstr "``Enum`` 成員給定的值: ::" -#: ../../library/enum.rst:284 +#: ../../library/enum.rst:274 msgid "" ">>> Color.RED.value\n" "1" @@ -598,61 +583,61 @@ msgstr "" ">>> Color.RED.value\n" "1" -#: ../../library/enum.rst:287 ../../library/enum.rst:307 +#: ../../library/enum.rst:277 ../../library/enum.rst:297 msgid "Value of the member, can be set in :meth:`~Enum.__new__`." msgstr "成員的值,可以在 :meth:`~Enum.__new__` 設定。" -#: ../../library/enum.rst:289 +#: ../../library/enum.rst:279 msgid "Enum member values" msgstr "列舉成員的值" -#: ../../library/enum.rst:291 +#: ../../library/enum.rst:281 msgid "" "Member values can be anything: :class:`int`, :class:`str`, etc. If the " "exact value is unimportant you may use :class:`auto` instances and an " "appropriate value will be chosen for you. See :class:`auto` for the details." msgstr "" "成員的值可以是任何值::class:`int`、:class:`str` 等等。如果實際使用什麼值並不" -"重要,你可以使用 :class:`auto` 實例,它會為你選擇合適的值。更多細節請參" -"考 :class:`auto`。" +"重要,你可以使用 :class:`auto` 實例,它會為你選擇合適的值。更多細節請參考 :" +"class:`auto`。" -#: ../../library/enum.rst:296 +#: ../../library/enum.rst:286 msgid "" "While mutable/unhashable values, such as :class:`dict`, :class:`list` or a " "mutable :class:`~dataclasses.dataclass`, can be used, they will have a " "quadratic performance impact during creation relative to the total number of " "mutable/unhashable values in the enum." msgstr "" -"雖然可以使用可變的 (mutable) / 不可雜湊的 (unhashable) 值,例" -"如 :class:`dict`、:class:`list` 或可變的 :class:`~dataclasses.dataclass`,它" -"們在建立期間會對效能產生相對於列舉中可變的 / 不可雜湊的值總數量的二次方影響。" +"雖然可以使用可變的 (mutable) / 不可雜湊的 (unhashable) 值,例如 :class:" +"`dict`、:class:`list` 或可變的 :class:`~dataclasses.dataclass`,它們在建立期" +"間會對效能產生相對於列舉中可變的 / 不可雜湊的值總數量的二次方影響。" -#: ../../library/enum.rst:303 +#: ../../library/enum.rst:293 msgid "Name of the member." msgstr "成員名稱。" -#: ../../library/enum.rst:311 +#: ../../library/enum.rst:301 msgid "" "No longer used, kept for backward compatibility. (class attribute, removed " "during class creation)." msgstr "已不再使用,只為了向後相容而保留(類別屬性,在類別建立時移除)" -#: ../../library/enum.rst:316 +#: ../../library/enum.rst:306 msgid "" "``_ignore_`` is only used during creation and is removed from the " "enumeration once creation is complete." msgstr "``_ignore_`` 只有在建立的時候用到,在列舉建立完成後會被移除。" -#: ../../library/enum.rst:319 +#: ../../library/enum.rst:309 msgid "" "``_ignore_`` is a list of names that will not become members, and whose " -"names will also be removed from the completed enumeration. " -"See :ref:`TimePeriod ` for an example." +"names will also be removed from the completed enumeration. See :ref:" +"`TimePeriod ` for an example." msgstr "" "``_ignore_`` 是一個不會變成成員的名稱串列,在列舉建立完成後其名稱會被移除。範" "例請參考 :ref:`TimePeriod `。" -#: ../../library/enum.rst:325 +#: ../../library/enum.rst:315 msgid "" "Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and any " "public methods defined on *self.__class__*::" @@ -660,7 +645,7 @@ msgstr "" "回傳 ``['__class__', '__doc__', '__module__', 'name', 'value']`` 及任何 " "*self.__class__* 上定義的公開方法: ::" -#: ../../library/enum.rst:328 +#: ../../library/enum.rst:318 msgid "" ">>> from datetime import date\n" ">>> class Weekday(Enum):\n" @@ -700,11 +685,11 @@ msgstr "" msgid "name" msgstr "name" -#: ../../library/enum.rst:346 +#: ../../library/enum.rst:336 msgid "The name of the member being defined (e.g. 'RED')." msgstr "定義的成員名稱(例如 'RED')。" -#: ../../library/enum.rst:347 +#: ../../library/enum.rst:337 msgid "The start value for the Enum; the default is 1." msgstr "列舉的開始值,預設為 1。" @@ -712,7 +697,7 @@ msgstr "列舉的開始值,預設為 1。" msgid "count" msgstr "count" -#: ../../library/enum.rst:348 +#: ../../library/enum.rst:338 msgid "The number of members currently defined, not including this one." msgstr "已定義的成員數量,不包含目前這一個。" @@ -720,17 +705,17 @@ msgstr "已定義的成員數量,不包含目前這一個。" msgid "last_values" msgstr "last_values" -#: ../../library/enum.rst:349 +#: ../../library/enum.rst:339 msgid "A list of the previous values." msgstr "一個之前值的串列。" -#: ../../library/enum.rst:351 +#: ../../library/enum.rst:341 msgid "" -"A *staticmethod* that is used to determine the next value returned " -"by :class:`auto`::" +"A *staticmethod* that is used to determine the next value returned by :class:" +"`auto`::" msgstr "一個 *staticmethod*,用來決定 :class:`auto` 下一個要回傳的值的: ::" -#: ../../library/enum.rst:354 +#: ../../library/enum.rst:344 msgid "" ">>> from enum import auto\n" ">>> class PowersOfThree(Enum):\n" @@ -754,7 +739,7 @@ msgstr "" ">>> PowersOfThree.SECOND.value\n" "9" -#: ../../library/enum.rst:367 +#: ../../library/enum.rst:357 msgid "" "By default, does nothing. If multiple values are given in the member " "assignment, those values become separate arguments to ``__init__``; e.g." @@ -762,19 +747,19 @@ msgstr "" "預設情況下,不執行任何操作。如果在成員賦值中給出多個值,這些值將成為與 " "``__init__`` 分別的引數;例如" -#: ../../library/enum.rst:374 +#: ../../library/enum.rst:364 msgid "" "``Weekday.__init__()`` would be called as ``Weekday.__init__(self, 1, " "'Mon')``" msgstr "``Weekday.__init__()`` 將被稱為 ``Weekday.__init__(self, 1, 'Mon')``" -#: ../../library/enum.rst:378 +#: ../../library/enum.rst:368 msgid "" "A *classmethod* that is used to further configure subsequent subclasses. By " "default, does nothing." msgstr "一個 *classmethod*,用來進一步設定後續的子類別,預設不做任何事。" -#: ../../library/enum.rst:383 +#: ../../library/enum.rst:373 msgid "" "A *classmethod* for looking up values not found in *cls*. By default it " "does nothing, but can be overridden to implement custom search behavior::" @@ -782,7 +767,7 @@ msgstr "" "一個 *classmethod*,用來查詢在 *cls* 裡找不到的值。預設不做任何事,但可以被覆" "寫以實作客製化的搜尋行為: ::" -#: ../../library/enum.rst:386 +#: ../../library/enum.rst:376 msgid "" ">>> from enum import StrEnum\n" ">>> class Build(StrEnum):\n" @@ -818,7 +803,7 @@ msgstr "" ">>> Build('deBUG')\n" "" -#: ../../library/enum.rst:405 +#: ../../library/enum.rst:395 msgid "" "By default, doesn't exist. If specified, either in the enum class " "definition or in a mixin class (such as ``int``), all values given in the " @@ -827,12 +812,12 @@ msgstr "" "預設情況下不存在。如果有指定,無論是在列舉類別定義中還是在 mixin 類別中(例" "如 ``int``\\ ),都將傳遞成員賦值中給出的所有值;例如" -#: ../../library/enum.rst:413 +#: ../../library/enum.rst:403 msgid "" "results in the call ``int('1a', 16)`` and a value of ``26`` for the member." msgstr "會產生呼叫 ``int('1a', 16)`` 而該成員的值為 ``26``。" -#: ../../library/enum.rst:417 +#: ../../library/enum.rst:407 msgid "" "When writing a custom ``__new__``, do not use ``super().__new__`` -- call " "the appropriate ``__new__`` instead." @@ -840,7 +825,7 @@ msgstr "" "當寫自訂的 ``__new__`` 時,不要使用 ``super().__new__``,而是要呼叫適當的 " "``__new__``。" -#: ../../library/enum.rst:422 +#: ../../library/enum.rst:412 msgid "" "Returns the string used for *repr()* calls. By default, returns the *Enum* " "name, member name, and value, but can be overridden::" @@ -848,7 +833,7 @@ msgstr "" "回傳呼叫 *repr()* 時使用的字串。預設回傳 *Enum* 名稱、成員名稱及值,但可以被" "覆寫: ::" -#: ../../library/enum.rst:425 +#: ../../library/enum.rst:415 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -858,8 +843,8 @@ msgid "" "... cls_name = self.__class__.__name__\n" "... return f'{cls_name}.{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " -"f\"{OtherStyle.ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." +"ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" msgstr "" ">>> class OtherStyle(Enum):\n" @@ -870,11 +855,11 @@ msgstr "" "... cls_name = self.__class__.__name__\n" "... return f'{cls_name}.{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " -"f\"{OtherStyle.ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." +"ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" -#: ../../library/enum.rst:438 +#: ../../library/enum.rst:428 msgid "" "Returns the string used for *str()* calls. By default, returns the *Enum* " "name and member name, but can be overridden::" @@ -882,7 +867,7 @@ msgstr "" "回傳呼叫 *str()* 時使用的字串。預設回傳 *Enum* 名稱及成員名稱,但可以被覆" "寫: ::" -#: ../../library/enum.rst:441 +#: ../../library/enum.rst:431 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -891,8 +876,8 @@ msgid "" "... def __str__(self):\n" "... return f'{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " -"f\"{OtherStyle.ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." +"ALTERNATE}\"\n" "(, 'ALTERNATE', 'ALTERNATE')" msgstr "" ">>> class OtherStyle(Enum):\n" @@ -902,11 +887,11 @@ msgstr "" "... def __str__(self):\n" "... return f'{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " -"f\"{OtherStyle.ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." +"ALTERNATE}\"\n" "(, 'ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:453 +#: ../../library/enum.rst:443 msgid "" "Returns the string used for *format()* and *f-string* calls. By default, " "returns :meth:`__str__` return value, but can be overridden::" @@ -914,7 +899,7 @@ msgstr "" "回傳呼叫 *format()* 及 *f-string* 時使用的字串。預設回傳 :meth:`__str__` 的回" "傳值,但可以被覆寫: ::" -#: ../../library/enum.rst:456 +#: ../../library/enum.rst:446 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -923,8 +908,8 @@ msgid "" "... def __format__(self, spec):\n" "... return f'{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " -"f\"{OtherStyle.ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." +"ALTERNATE}\"\n" "(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" msgstr "" ">>> class OtherStyle(Enum):\n" @@ -934,21 +919,61 @@ msgstr "" "... def __format__(self, spec):\n" "... return f'{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " -"f\"{OtherStyle.ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." +"ALTERNATE}\"\n" "(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:468 +#: ../../library/enum.rst:458 msgid "" "Using :class:`auto` with :class:`Enum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`Enum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:471 +#: ../../library/enum.rst:461 msgid "Added :ref:`enum-dataclass-support`" msgstr "新增 :ref:`enum-dataclass-support`" -#: ../../library/enum.rst:476 +#: ../../library/enum.rst:465 +msgid "Adds a new name as an alias to an existing member::" +msgstr "新增一個名稱作為現有成員的別名: ::" + +#: ../../library/enum.rst:467 +msgid "" +">>> Color.RED._add_alias_(\"ERROR\")\n" +">>> Color.ERROR\n" +"" +msgstr "" +">>> Color.RED._add_alias_(\"ERROR\")\n" +">>> Color.ERROR\n" +"" + +#: ../../library/enum.rst:471 +msgid "" +"Raises a :exc:`NameError` if the name is already assigned to a different " +"member." +msgstr "如果該名稱已經被指派給不同的成員,則會引發 :exc:`NameError`。" + +#: ../../library/enum.rst:477 +msgid "Adds a new value as an alias to an existing member::" +msgstr "新增一個值作為現有成員的別名: ::" + +#: ../../library/enum.rst:479 +msgid "" +">>> Color.RED._add_value_alias_(42)\n" +">>> Color(42)\n" +"" +msgstr "" +">>> Color.RED._add_value_alias_(42)\n" +">>> Color(42)\n" +"" + +#: ../../library/enum.rst:483 +msgid "" +"Raises a :exc:`ValueError` if the value is already linked with a different " +"member." +msgstr "如果該值已經被連結到不同的成員,則會引發 :exc:`ValueError`。" + +#: ../../library/enum.rst:490 msgid "" "*IntEnum* is the same as :class:`Enum`, but its members are also integers " "and can be used anywhere that an integer can be used. If any integer " @@ -958,23 +983,23 @@ msgstr "" "*IntEnum* 和 :class:`Enum` 一樣,但其成員同時也是整數而可以被用在任何使用整數" "的地方。如果 *IntEnum* 成員經過任何整數運算,結果值會失去其列舉狀態。" -#: ../../library/enum.rst:497 +#: ../../library/enum.rst:511 msgid "" "Using :class:`auto` with :class:`IntEnum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`IntEnum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:500 +#: ../../library/enum.rst:514 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` was " "already :meth:`!int.__format__` for that same reason." msgstr "" "為了更好地支援\\ *現存常數取代 (replacement of existing constants)* 的使用情" -"境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理" -"由,:meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" +"境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" +"meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:507 +#: ../../library/enum.rst:521 msgid "" "*StrEnum* is the same as :class:`Enum`, but its members are also strings and " "can be used in most of the same places that a string can be used. The result " @@ -984,7 +1009,7 @@ msgstr "" "*StrEnum* 和 :class:`Enum` 一樣,但其成員同時也是字串而可以被用在幾乎所有使用" "字串的地方。*StrEnum* 成員經過任何字串操作的結果會不再是列舉的一部份。" -#: ../../library/enum.rst:528 +#: ../../library/enum.rst:542 msgid "" "There are places in the stdlib that check for an exact :class:`str` instead " "of a :class:`str` subclass (i.e. ``type(unknown) == str`` instead of " @@ -995,23 +1020,23 @@ msgstr "" "是 ``type(unknown) == str`` 而不是 ``isinstance(unknown, str)``),在這些地方" "你需要使用 ``str(MyStrEnum.MY_MEMBER)``。" -#: ../../library/enum.rst:535 +#: ../../library/enum.rst:549 msgid "" "Using :class:`auto` with :class:`StrEnum` results in the lower-cased member " "name as the value." msgstr ":class:`StrEnum` 使用 :class:`auto` 會產生小寫的成員名稱當作值。" -#: ../../library/enum.rst:540 +#: ../../library/enum.rst:554 msgid "" ":meth:`~object.__str__` is :meth:`!str.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` is " "likewise :meth:`!str.__format__` for that same reason." msgstr "" "為了更好地支援\\ *現存常數取代 (replacement of existing constants)* 的使用情" -"境,:meth:`~object.__str__` 現在會是 :meth:`!str.__str__`。為了同樣的理" -"由,:meth:`~object.__format__` 也會是 :meth:`!str.__format__`。" +"境,:meth:`~object.__str__` 現在會是 :meth:`!str.__str__`。為了同樣的理由,:" +"meth:`~object.__format__` 也會是 :meth:`!str.__format__`。" -#: ../../library/enum.rst:548 +#: ../../library/enum.rst:562 msgid "" "``Flag`` is the same as :class:`Enum`, but its members support the bitwise " "operators ``&`` (*AND*), ``|`` (*OR*), ``^`` (*XOR*), and ``~`` (*INVERT*); " @@ -1021,11 +1046,11 @@ msgstr "" "(*OR*)、``^`` (*XOR*) 和 ``~`` (*INVERT*);這些操作的結果是列舉的成員(的別" "名)。" -#: ../../library/enum.rst:554 +#: ../../library/enum.rst:568 msgid "Returns *True* if value is in self::" msgstr "如果 value 在 self 裡則回傳 *True*: ::" -#: ../../library/enum.rst:556 +#: ../../library/enum.rst:570 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -1061,11 +1086,11 @@ msgstr "" ">>> white in purple\n" "False" -#: ../../library/enum.rst:575 +#: ../../library/enum.rst:589 msgid "Returns all contained non-alias members::" msgstr "回傳所有包含的非別名成員: ::" -#: ../../library/enum.rst:577 +#: ../../library/enum.rst:591 msgid "" ">>> list(Color.RED)\n" "[]\n" @@ -1077,11 +1102,11 @@ msgstr "" ">>> list(purple)\n" "[, ]" -#: ../../library/enum.rst:586 +#: ../../library/enum.rst:600 msgid "Returns number of members in flag::" msgstr "回傳旗標裡的成員數量: ::" -#: ../../library/enum.rst:588 +#: ../../library/enum.rst:602 msgid "" ">>> len(Color.GREEN)\n" "1\n" @@ -1093,11 +1118,11 @@ msgstr "" ">>> len(white)\n" "3" -#: ../../library/enum.rst:597 +#: ../../library/enum.rst:611 msgid "Returns *True* if any members in flag, *False* otherwise::" msgstr "如果成員在旗標裡則回傳 *True*,否則回傳 *False*: ::" -#: ../../library/enum.rst:599 +#: ../../library/enum.rst:613 msgid "" ">>> bool(Color.GREEN)\n" "True\n" @@ -1115,11 +1140,11 @@ msgstr "" ">>> bool(black)\n" "False" -#: ../../library/enum.rst:609 +#: ../../library/enum.rst:623 msgid "Returns current flag binary or'ed with other::" msgstr "回傳和 other 做 OR 過後的二進位旗標: ::" -#: ../../library/enum.rst:611 +#: ../../library/enum.rst:625 msgid "" ">>> Color.RED | Color.GREEN\n" "" @@ -1127,11 +1152,11 @@ msgstr "" ">>> Color.RED | Color.GREEN\n" "" -#: ../../library/enum.rst:616 +#: ../../library/enum.rst:630 msgid "Returns current flag binary and'ed with other::" msgstr "回傳和 other 做 AND 過後的二進位旗標: ::" -#: ../../library/enum.rst:618 +#: ../../library/enum.rst:632 msgid "" ">>> purple & white\n" "\n" @@ -1143,11 +1168,11 @@ msgstr "" ">>> purple & Color.GREEN\n" "" -#: ../../library/enum.rst:625 +#: ../../library/enum.rst:639 msgid "Returns current flag binary xor'ed with other::" msgstr "回傳和 other 做 XOR 過後的二進位旗標: ::" -#: ../../library/enum.rst:627 +#: ../../library/enum.rst:641 msgid "" ">>> purple ^ white\n" "\n" @@ -1159,11 +1184,11 @@ msgstr "" ">>> purple ^ Color.GREEN\n" "" -#: ../../library/enum.rst:634 +#: ../../library/enum.rst:648 msgid "Returns all the flags in *type(self)* that are not in *self*::" msgstr "回傳所有在 *type(self)* 但不在 *self* 裡的旗標: ::" -#: ../../library/enum.rst:636 +#: ../../library/enum.rst:650 msgid "" ">>> ~white\n" "\n" @@ -1179,7 +1204,7 @@ msgstr "" ">>> ~Color.RED\n" "" -#: ../../library/enum.rst:645 +#: ../../library/enum.rst:659 msgid "" "Function used to format any remaining unnamed numeric values. Default is " "the value's repr; common choices are :func:`hex` and :func:`oct`." @@ -1187,17 +1212,17 @@ msgstr "" "用來格式化任何剩下未命名數值的函式。預設是值的 repr,常見選擇是 :func:`hex` " "和 :func:`oct`。" -#: ../../library/enum.rst:650 +#: ../../library/enum.rst:664 msgid "" "Using :class:`auto` with :class:`Flag` results in integers that are powers " "of two, starting with ``1``." msgstr ":class:`Flag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:653 +#: ../../library/enum.rst:667 msgid "The *repr()* of zero-valued flags has changed. It is now:" msgstr "值為 0 的旗標的 *repr()* 已改變。現在是:" -#: ../../library/enum.rst:661 +#: ../../library/enum.rst:675 msgid "" "``IntFlag`` is the same as :class:`Flag`, but its members are also integers " "and can be used anywhere that an integer can be used." @@ -1205,13 +1230,13 @@ msgstr "" "``IntFlag`` 和 :class:`Flag` 一樣,但其成員同時也是整數而可以被用在任何使用整" "數的地方。" -#: ../../library/enum.rst:675 +#: ../../library/enum.rst:689 msgid "" "If any integer operation is performed with an *IntFlag* member, the result " "is not an *IntFlag*::" msgstr "如果 *IntFlag* 成員經過任何整數運算,其結果不是 *IntFlag*: ::" -#: ../../library/enum.rst:678 +#: ../../library/enum.rst:692 msgid "" ">>> Color.RED + 2\n" "3" @@ -1219,25 +1244,25 @@ msgstr "" ">>> Color.RED + 2\n" "3" -#: ../../library/enum.rst:681 +#: ../../library/enum.rst:695 msgid "If a :class:`Flag` operation is performed with an *IntFlag* member and:" msgstr "如果 *IntFlag* 成員經過 :class:`Flag` 操作且:" -#: ../../library/enum.rst:683 +#: ../../library/enum.rst:697 msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "結果是合法的 *IntFlag*:回傳 *IntFlag*" -#: ../../library/enum.rst:684 +#: ../../library/enum.rst:698 msgid "" -"the result is not a valid *IntFlag*: the result depends on " -"the :class:`FlagBoundary` setting" +"the result is not a valid *IntFlag*: the result depends on the :class:" +"`FlagBoundary` setting" msgstr "結果不是合法的 *IntFlag*:結果會根據 :class:`FlagBoundary` 的設定" -#: ../../library/enum.rst:686 +#: ../../library/enum.rst:700 msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now::" msgstr "未命名且值為 0 的旗標的 :func:`repr` 已改變。現在是: ::" -#: ../../library/enum.rst:688 +#: ../../library/enum.rst:702 msgid "" ">>> Color(0)\n" "" @@ -1245,24 +1270,24 @@ msgstr "" ">>> Color(0)\n" "" -#: ../../library/enum.rst:693 +#: ../../library/enum.rst:707 msgid "" "Using :class:`auto` with :class:`IntFlag` results in integers that are " "powers of two, starting with ``1``." msgstr "" ":class:`IntFlag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:698 +#: ../../library/enum.rst:712 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` " "was already :meth:`!int.__format__` for that same reason." msgstr "" "為了更好地支援\\ *現存常數取代 (replacement of existing constants)* 的使用情" -"境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理" -"由,:meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" +"境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" +"meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:702 +#: ../../library/enum.rst:716 msgid "" "Inversion of an :class:`!IntFlag` now returns a positive value that is the " "union of all flags not in the given flag, rather than a negative value. This " @@ -1271,7 +1296,7 @@ msgstr "" ":class:`!IntFlag` 的反轉 (inversion) 現在會回傳正值,該值是不在給定旗標的所有" "旗標聯集,而不是一個負值。這符合現有 :class:`Flag` 的行為。" -#: ../../library/enum.rst:708 +#: ../../library/enum.rst:722 msgid "" ":class:`!ReprEnum` uses the :meth:`repr() ` of :class:`Enum`, " "but the :class:`str() ` of the mixed-in data type:" @@ -1279,25 +1304,24 @@ msgstr "" ":class:`!ReprEnum` 使用 :class:`Enum` 的 :meth:`repr() `,但使" "用混合資料型別的 :class:`str() `:" -#: ../../library/enum.rst:711 +#: ../../library/enum.rst:725 msgid ":meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`" msgstr "對 :class:`IntEnum` 和 :class:`IntFlag` 是 :meth:`!int.__str__`" -#: ../../library/enum.rst:712 +#: ../../library/enum.rst:726 msgid ":meth:`!str.__str__` for :class:`StrEnum`" msgstr "對 :class:`StrEnum` 是 :meth:`!str.__str__`" -#: ../../library/enum.rst:714 +#: ../../library/enum.rst:728 msgid "" -"Inherit from :class:`!ReprEnum` to keep the :class:`str() " -"` / :func:`format` of the mixed-in data type instead of using " -"the :class:`Enum`-default :meth:`str() `." +"Inherit from :class:`!ReprEnum` to keep the :class:`str() ` / :func:" +"`format` of the mixed-in data type instead of using the :class:`Enum`-" +"default :meth:`str() `." msgstr "" -"繼承 :class:`!ReprEnum` 來保留混合資料型別的 :class:`str() " -"` / :func:`format`,而不是使用 :class:`Enum` 預設的 :meth:`str() " -"`。" +"繼承 :class:`!ReprEnum` 來保留混合資料型別的 :class:`str() ` / :func:" +"`format`,而不是使用 :class:`Enum` 預設的 :meth:`str() `。" -#: ../../library/enum.rst:723 +#: ../../library/enum.rst:737 msgid "" "*EnumCheck* contains the options used by the :func:`verify` decorator to " "ensure various constraints; failed constraints result in a :exc:`ValueError`." @@ -1305,11 +1329,11 @@ msgstr "" "*EnumCheck* 包含 :func:`verify` 裝飾器使用的選項,以確保多樣的限制,不符合限" "制會產生 :exc:`ValueError`。" -#: ../../library/enum.rst:728 +#: ../../library/enum.rst:742 msgid "Ensure that each value has only one name::" msgstr "確保每個值只有一個名稱: ::" -#: ../../library/enum.rst:730 +#: ../../library/enum.rst:744 msgid "" ">>> from enum import Enum, verify, UNIQUE\n" ">>> @verify(UNIQUE)\n" @@ -1333,13 +1357,13 @@ msgstr "" "...\n" "ValueError: aliases found in : CRIMSON -> RED" -#: ../../library/enum.rst:744 +#: ../../library/enum.rst:758 msgid "" "Ensure that there are no missing values between the lowest-valued member and " "the highest-valued member::" msgstr "確保在最小值成員跟最大值成員間沒有缺少值: ::" -#: ../../library/enum.rst:747 +#: ../../library/enum.rst:761 msgid "" ">>> from enum import Enum, verify, CONTINUOUS\n" ">>> @verify(CONTINUOUS)\n" @@ -1361,7 +1385,7 @@ msgstr "" "...\n" "ValueError: invalid enum 'Color': missing values 3, 4" -#: ../../library/enum.rst:759 +#: ../../library/enum.rst:773 msgid "" "Ensure that any flag groups/masks contain only named flags -- useful when " "values are specified instead of being generated by :func:`auto`::" @@ -1369,7 +1393,7 @@ msgstr "" "確保任何旗標群組 / 遮罩只包含命名旗標 -- 當值是用指定而不是透過 :func:`auto` " "產生時是很實用的: ::" -#: ../../library/enum.rst:762 +#: ../../library/enum.rst:776 msgid "" ">>> from enum import Flag, verify, NAMED_FLAGS\n" ">>> @verify(NAMED_FLAGS)\n" @@ -1397,24 +1421,24 @@ msgstr "" "ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing " "combined values of 0x18 [use enum.show_flag_values(value) for details]" -#: ../../library/enum.rst:776 +#: ../../library/enum.rst:790 msgid "" "CONTINUOUS and NAMED_FLAGS are designed to work with integer-valued members." msgstr "CONTINUOUS 和 NAMED_FLAGS 是設計用來運作在整數值的成員上。" -#: ../../library/enum.rst:782 +#: ../../library/enum.rst:796 msgid "" -"``FlagBoundary`` controls how out-of-range values are handled " -"in :class:`Flag` and its subclasses." +"``FlagBoundary`` controls how out-of-range values are handled in :class:" +"`Flag` and its subclasses." msgstr "``FlagBoundary`` 控制在 :class:`Flag` 及其子類別中如何處理範圍外的值。" -#: ../../library/enum.rst:787 +#: ../../library/enum.rst:801 msgid "" "Out-of-range values cause a :exc:`ValueError` to be raised. This is the " "default for :class:`Flag`::" msgstr "範圍外的值會引發 :exc:`ValueError`。這是 :class:`Flag` 的預設行為: ::" -#: ../../library/enum.rst:790 +#: ../../library/enum.rst:804 msgid "" ">>> from enum import Flag, STRICT, auto\n" ">>> class StrictFlag(Flag, boundary=STRICT):\n" @@ -1442,13 +1466,13 @@ msgstr "" " given 0b0 10100\n" " allowed 0b0 00111" -#: ../../library/enum.rst:805 +#: ../../library/enum.rst:819 msgid "" -"Out-of-range values have invalid values removed, leaving a " -"valid :class:`Flag` value::" +"Out-of-range values have invalid values removed, leaving a valid :class:" +"`Flag` value::" msgstr "會移除範圍外的值中的非法值,留下合法的 :class:`Flag` 值: ::" -#: ../../library/enum.rst:808 +#: ../../library/enum.rst:822 msgid "" ">>> from enum import Flag, CONFORM, auto\n" ">>> class ConformFlag(Flag, boundary=CONFORM):\n" @@ -1468,13 +1492,13 @@ msgstr "" ">>> ConformFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:819 +#: ../../library/enum.rst:833 msgid "" -"Out-of-range values lose their :class:`Flag` membership and revert " -"to :class:`int`." +"Out-of-range values lose their :class:`Flag` membership and revert to :class:" +"`int`." msgstr "範圍外的值會失去它們的 :class:`Flag` 成員資格且恢復成 :class:`int`。" -#: ../../library/enum.rst:832 +#: ../../library/enum.rst:846 msgid "" "Out-of-range values are kept, and the :class:`Flag` membership is kept. This " "is the default for :class:`IntFlag`::" @@ -1482,7 +1506,7 @@ msgstr "" "範圍外的值會被保留,:class:`Flag` 成員資格也會被保留。這是 :class:`IntFlag` " "的預設行為: ::" -#: ../../library/enum.rst:835 +#: ../../library/enum.rst:849 msgid "" ">>> from enum import Flag, KEEP, auto\n" ">>> class KeepFlag(Flag, boundary=KEEP):\n" @@ -1502,7 +1526,7 @@ msgstr "" ">>> KeepFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:848 +#: ../../library/enum.rst:862 msgid "" "*EnumDict* is a subclass of :class:`dict` that is used as the namespace for " "defining enum classes (see :ref:`prepare`). It is exposed to allow " @@ -1511,31 +1535,31 @@ msgid "" "created, otherwise private names and internal classes will not be handled " "correctly." msgstr "" -"*EnumDict* 是 :class:`dict` 的子類別,用來作為定義列舉類別的命名空間(參" -"見 :ref:`prepare`)。它被公開來使得 :class:`EnumType` 的子類別能具有進階行" -"為,例如讓每個成員有多個值。它應該在被呼叫時帶上正在建立的列舉類別名稱,否則" -"私有名稱和內部類別將無法被正確處理。" +"*EnumDict* 是 :class:`dict` 的子類別,用來作為定義列舉類別的命名空間(參見 :" +"ref:`prepare`)。它被公開來使得 :class:`EnumType` 的子類別能具有進階行為,例" +"如讓每個成員有多個值。它應該在被呼叫時帶上正在建立的列舉類別名稱,否則私有名" +"稱和內部類別將無法被正確處理。" -#: ../../library/enum.rst:855 +#: ../../library/enum.rst:869 msgid "" -"Note that only the :class:`~collections.abc.MutableMapping` interface " -"(:meth:`~object.__setitem__` and :meth:`~dict.update`) is overridden. It may " -"be possible to bypass the checks using other :class:`!dict` operations " -"like :meth:`|= `." +"Note that only the :class:`~collections.abc.MutableMapping` interface (:meth:" +"`~object.__setitem__` and :meth:`~dict.update`) is overridden. It may be " +"possible to bypass the checks using other :class:`!dict` operations like :" +"meth:`|= `." msgstr "" -"注意只有 :class:`~collections.abc.MutableMapping` 介面" -"(:meth:`~object.__setitem__` 和 :meth:`~dict.update`)被覆寫。可能可以使用其" -"他 :class:`!dict` 操作來繞過檢查,例如 :meth:`|= `。" +"注意只有 :class:`~collections.abc.MutableMapping` 介面(:meth:`~object." +"__setitem__` 和 :meth:`~dict.update`)被覆寫。可能可以使用其他 :class:`!" +"dict` 操作來繞過檢查,例如 :meth:`|= `。" -#: ../../library/enum.rst:862 +#: ../../library/enum.rst:876 msgid "A list of member names." msgstr "一個成員名稱的串列。" -#: ../../library/enum.rst:869 +#: ../../library/enum.rst:883 msgid "Supported ``__dunder__`` names" msgstr "支援的 ``__dunder__`` 名稱" -#: ../../library/enum.rst:871 +#: ../../library/enum.rst:885 msgid "" ":attr:`~EnumType.__members__` is a read-only ordered mapping of " "``member_name``:``member`` items. It is only available on the class." @@ -1543,7 +1567,7 @@ msgstr "" ":attr:`~EnumType.__members__` 是一個唯讀有序的\\ ``成員名稱``:``成員``\\ 項" "目的對映。只有在類別上可用。" -#: ../../library/enum.rst:874 +#: ../../library/enum.rst:888 msgid "" ":meth:`~Enum.__new__`, if specified, must create and return the enum " "members; it is also a very good idea to set the member's :attr:`!_value_` " @@ -1553,47 +1577,35 @@ msgstr "" "的 :attr:`!_value_` 也是一個很好的主意。一旦所有成員都建立之後就不會再被用" "到。" -#: ../../library/enum.rst:880 +#: ../../library/enum.rst:894 msgid "Supported ``_sunder_`` names" msgstr "支援的 ``_sunder_`` 名稱" -#: ../../library/enum.rst:882 -msgid "" -":meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing " -"member." -msgstr ":meth:`~EnumType._add_alias_` -- 新增一個名稱作為現有成員的別名。" - -#: ../../library/enum.rst:884 -msgid "" -":meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an " -"existing member." -msgstr ":meth:`~EnumType._add_value_alias_` -- 新增一個值作為現有成員的別名。" - -#: ../../library/enum.rst:886 +#: ../../library/enum.rst:896 msgid ":attr:`~Enum._name_` -- name of the member" msgstr ":attr:`~Enum._name_` -- 成員名稱" -#: ../../library/enum.rst:887 +#: ../../library/enum.rst:897 msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" msgstr ":attr:`~Enum._value_` -- 成員的值;可以在 ``__new__`` 設定" -#: ../../library/enum.rst:888 +#: ../../library/enum.rst:898 msgid "" ":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " "may be overridden" msgstr "" ":meth:`~Enum._missing_` -- 當值沒有被找到時會使用的查詢函式;可以被覆寫" -#: ../../library/enum.rst:890 +#: ../../library/enum.rst:900 msgid "" -":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or " -"a :class:`str`, that will not be transformed into members, and will be " -"removed from the final class" +":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" +"class:`str`, that will not be transformed into members, and will be removed " +"from the final class" msgstr "" -":attr:`~Enum._ignore_` -- 一個名稱的串列,可以是 :class:`list` " -"或 :class:`str`,它不會被轉換成成員,且在最後的類別上會被移除" +":attr:`~Enum._ignore_` -- 一個名稱的串列,可以是 :class:`list` 或 :class:" +"`str`,它不會被轉換成成員,且在最後的類別上會被移除" -#: ../../library/enum.rst:893 +#: ../../library/enum.rst:903 msgid "" ":attr:`~Enum._order_` -- no longer used, kept for backward compatibility " "(class attribute, removed during class creation)" @@ -1601,28 +1613,40 @@ msgstr "" ":attr:`~Enum._order_` -- 不再被使用,僅為了向後相容而保留(類別屬性,在類別建" "立時移除)" -#: ../../library/enum.rst:895 +#: ../../library/enum.rst:905 msgid "" ":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " "an enum member; may be overridden" msgstr "" ":meth:`~Enum._generate_next_value_` -- 用來為列舉成員取得合適的值;可以被覆寫" -#: ../../library/enum.rst:900 +#: ../../library/enum.rst:910 msgid "" "For standard :class:`Enum` classes the next value chosen is the highest " "value seen incremented by one." msgstr "" "對標準的 :class:`Enum` 類別來說,下一個被選擇的值是所看過的最大值加一。" -#: ../../library/enum.rst:903 +#: ../../library/enum.rst:913 msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " "power-of-two." msgstr "" "對 :class:`Flag` 類別來說,下一個被選擇的值是下一個最大的 2 的次方的數字。" -#: ../../library/enum.rst:906 +#: ../../library/enum.rst:916 +msgid "" +":meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing " +"member." +msgstr ":meth:`~Enum._add_alias_` -- 新增一個名稱作為現有成員的別名。" + +#: ../../library/enum.rst:918 +msgid "" +":meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an " +"existing member." +msgstr ":meth:`~Enum._add_value_alias_` -- 新增一個值作為現有成員的別名。" + +#: ../../library/enum.rst:921 msgid "" "While ``_sunder_`` names are generally reserved for the further development " "of the :class:`Enum` class and can not be used, some are explicitly allowed:" @@ -1630,57 +1654,55 @@ msgstr "" "雖然 ``_sunder_`` 名稱通常保留用於 :class:`Enum` 類別的進一步開發而不能被使" "用,但有些是明確允許的:" -#: ../../library/enum.rst:909 +#: ../../library/enum.rst:924 msgid "" "``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" msgstr "" "``_repr_*``\\ (例如 ``_repr_html_``),例如用於 `IPython 的豐富顯示 " "`_" -#: ../../library/enum.rst:911 +#: ../../library/enum.rst:926 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "``_missing_``、``_order_``、``_generate_next_value_``" -#: ../../library/enum.rst:912 +#: ../../library/enum.rst:927 msgid "``_ignore_``" msgstr "``_ignore_``" -#: ../../library/enum.rst:913 +#: ../../library/enum.rst:928 msgid "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" msgstr "``_add_alias_``、``_add_value_alias_``、``_repr_*``" -#: ../../library/enum.rst:919 +#: ../../library/enum.rst:934 msgid "Utilities and Decorators" msgstr "通用項目與裝飾器" -#: ../../library/enum.rst:923 +#: ../../library/enum.rst:938 msgid "" "*auto* can be used in place of a value. If used, the *Enum* machinery will " "call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an " "appropriate value. For :class:`Enum` and :class:`IntEnum` that appropriate " -"value will be the last value plus one; for :class:`Flag` " -"and :class:`IntFlag` it will be the first power-of-two greater than the " -"highest value; for :class:`StrEnum` it will be the lower-cased version of " -"the member's name. Care must be taken if mixing *auto()* with manually " -"specified values." +"value will be the last value plus one; for :class:`Flag` and :class:" +"`IntFlag` it will be the first power-of-two greater than the highest value; " +"for :class:`StrEnum` it will be the lower-cased version of the member's " +"name. Care must be taken if mixing *auto()* with manually specified values." msgstr "" -"*auto* 可以用來取代給值。如果使用的話,*Enum* 系統會呼叫 :class:`Enum` " -"的 :meth:`~Enum._generate_next_value_` 來取得合適的值。對 :class:`Enum` " -"和 :class:`IntEnum` 來說,合適的值是最後一個值加一;對 :class:`Flag` " -"和 :class:`IntFlag` 來說,是第一個比最大值還大的 2 的次方的數字;" -"對 :class:`StrEnum` 來說,是成員名稱的小寫版本。如果混用 *auto()* 和手動指定" -"值的話要特別注意。" +"*auto* 可以用來取代給值。如果使用的話,*Enum* 系統會呼叫 :class:`Enum` 的 :" +"meth:`~Enum._generate_next_value_` 來取得合適的值。對 :class:`Enum` 和 :" +"class:`IntEnum` 來說,合適的值是最後一個值加一;對 :class:`Flag` 和 :class:" +"`IntFlag` 來說,是第一個比最大值還大的 2 的次方的數字;對 :class:`StrEnum` 來" +"說,是成員名稱的小寫版本。如果混用 *auto()* 和手動指定值的話要特別注意。" -#: ../../library/enum.rst:931 +#: ../../library/enum.rst:946 msgid "" "*auto* instances are only resolved when at the top level of an assignment:" msgstr "*auto* 實例只有在最上層的賦值時才會被解析:" -#: ../../library/enum.rst:933 +#: ../../library/enum.rst:948 msgid "``FIRST = auto()`` will work (auto() is replaced with ``1``);" msgstr "``FIRST = auto()`` 可以運作(auto() 會被取代成 ``1``)" -#: ../../library/enum.rst:934 +#: ../../library/enum.rst:949 msgid "" "``SECOND = auto(), -2`` will work (auto is replaced with ``2``, so ``2, -2`` " "is used to create the ``SECOND`` enum member;" @@ -1688,7 +1710,7 @@ msgstr "" "``SECOND = auto(), -2`` 可以運作(auto 會被取代成 ``2``, 因此 ``2, -2`` 會被" "用來建立列舉成員 ``SECOND``;" -#: ../../library/enum.rst:936 +#: ../../library/enum.rst:951 msgid "" "``THREE = [auto(), -3]`` will *not* work (``, -3`` is used to " "create the ``THREE`` enum member)" @@ -1696,19 +1718,19 @@ msgstr "" "``THREE = [auto(), -3]`` *無法*\\ 運作(\\ ``, -3`` 會被用來建立列" "舉成員 ``THREE``)" -#: ../../library/enum.rst:941 +#: ../../library/enum.rst:956 msgid "" "In prior versions, ``auto()`` had to be the only thing on the assignment " "line to work properly." msgstr "在之前的版本中,``auto()`` 必須是賦值行裡的唯一內容才能運作正確。" -#: ../../library/enum.rst:944 +#: ../../library/enum.rst:959 msgid "" "``_generate_next_value_`` can be overridden to customize the values used by " "*auto*." msgstr "可以覆寫 ``_generate_next_value_`` 來客製 *auto* 使用的值。" -#: ../../library/enum.rst:947 +#: ../../library/enum.rst:962 msgid "" "in 3.13 the default ``_generate_next_value_`` will always return the highest " "member value incremented by 1, and will fail if any member is an " @@ -1717,7 +1739,7 @@ msgstr "" "在 3.13 預設 ``_generate_next_value_`` 總是回傳最大的成員值加一,如果任何成員" "是不相容的型別就會失敗。" -#: ../../library/enum.rst:953 +#: ../../library/enum.rst:968 msgid "" "A decorator similar to the built-in *property*, but specifically for " "enumerations. It allows member attributes to have the same names as members " @@ -1726,7 +1748,7 @@ msgstr "" "和內建的 *property* 相似的裝飾器,但只專門針對列舉。它允許成員屬性和成員本身" "有相同名稱。" -#: ../../library/enum.rst:957 +#: ../../library/enum.rst:972 msgid "" "the *property* and the member must be defined in separate classes; for " "example, the *value* and *name* attributes are defined in the *Enum* class, " @@ -1736,17 +1758,17 @@ msgstr "" "*屬性*\\ 和成員必須定義在分開的類別裡;例如 *value* 和 *name* 屬性定義在 " "*Enum* 類別而 *Enum* 子類別可以定義成員名稱為 ``value`` 和 ``name``。" -#: ../../library/enum.rst:966 +#: ../../library/enum.rst:981 msgid "" "A :keyword:`class` decorator specifically for enumerations. It searches an " "enumeration's :attr:`~EnumType.__members__`, gathering any aliases it finds; " "if any are found :exc:`ValueError` is raised with the details::" msgstr "" -"專門針對列舉的 :keyword:`class` 裝飾器。它搜尋列舉" -"的 :attr:`~EnumType.__members__`,蒐集任何它找到的別名;如果有找到任何別名則" -"引發 :exc:`ValueError` 並附上細節: ::" +"專門針對列舉的 :keyword:`class` 裝飾器。它搜尋列舉的 :attr:`~EnumType." +"__members__`,蒐集任何它找到的別名;如果有找到任何別名則引發 :exc:" +"`ValueError` 並附上細節: ::" -#: ../../library/enum.rst:970 +#: ../../library/enum.rst:985 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -1772,24 +1794,24 @@ msgstr "" "...\n" "ValueError: duplicate values found in : FOUR -> THREE" -#: ../../library/enum.rst:984 +#: ../../library/enum.rst:999 msgid "" -"A :keyword:`class` decorator specifically for enumerations. Members " -"from :class:`EnumCheck` are used to specify which constraints should be " -"checked on the decorated enumeration." +"A :keyword:`class` decorator specifically for enumerations. Members from :" +"class:`EnumCheck` are used to specify which constraints should be checked on " +"the decorated enumeration." msgstr "" "專門針對列舉的 :keyword:`class` 裝飾器。使用 :class:`EnumCheck` 裡的成員來指" "定在裝飾的列舉上應該檢查什麼限制。" -#: ../../library/enum.rst:992 +#: ../../library/enum.rst:1007 msgid "A decorator for use in enums: its target will become a member." msgstr "列舉所使用的裝飾器:其目標會變成成員。" -#: ../../library/enum.rst:998 +#: ../../library/enum.rst:1013 msgid "A decorator for use in enums: its target will not become a member." msgstr "列舉所使用的裝飾器:其目標不會變成成員。" -#: ../../library/enum.rst:1004 +#: ../../library/enum.rst:1019 msgid "" "A decorator to change the :class:`str() ` and :func:`repr` of an enum " "to show its members as belonging to the module instead of its class. Should " @@ -1800,19 +1822,19 @@ msgstr "" "組而不是其類別。應該只有當列舉成員被匯出到模組的全域命名空間才使用(範例請參" "考 :class:`re.RegexFlag`)。" -#: ../../library/enum.rst:1014 +#: ../../library/enum.rst:1029 msgid "Return a list of all power-of-two integers contained in a flag *value*." msgstr "回傳在旗標\\ *值*\\ 中包含的所有 2 的次方的整數串列。" -#: ../../library/enum.rst:1021 +#: ../../library/enum.rst:1036 msgid "Notes" msgstr "備註" -#: ../../library/enum.rst:1023 +#: ../../library/enum.rst:1038 msgid ":class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag`" msgstr ":class:`IntEnum`、:class:`StrEnum` 及 :class:`IntFlag`" -#: ../../library/enum.rst:1025 +#: ../../library/enum.rst:1040 msgid "" "These three enum types are designed to be drop-in replacements for existing " "integer- and string-based values; as such, they have extra limitations:" @@ -1820,17 +1842,17 @@ msgstr "" "這三種列舉型別是設計來直接取代現有以整數及字串為基底的值;因此它們有額外的限" "制:" -#: ../../library/enum.rst:1028 +#: ../../library/enum.rst:1043 msgid "``__str__`` uses the value and not the name of the enum member" msgstr "``__str__`` 使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:1030 +#: ../../library/enum.rst:1045 msgid "" "``__format__``, because it uses ``__str__``, will also use the value of the " "enum member instead of its name" msgstr "``__format__`` 因為使用 ``__str__``,也會使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:1033 +#: ../../library/enum.rst:1048 msgid "" "If you do not need/want those limitations, you can either create your own " "base class by mixing in the ``int`` or ``str`` type yourself::" @@ -1838,7 +1860,7 @@ msgstr "" "如果你不需要或不想要這些限制,你可以透過混合 ``int`` 或 ``str`` 型別來建立自" "己的基礎類別: ::" -#: ../../library/enum.rst:1036 +#: ../../library/enum.rst:1051 msgid "" ">>> from enum import Enum\n" ">>> class MyIntEnum(int, Enum):\n" @@ -1848,11 +1870,11 @@ msgstr "" ">>> class MyIntEnum(int, Enum):\n" "... pass" -#: ../../library/enum.rst:1040 +#: ../../library/enum.rst:1055 msgid "or you can reassign the appropriate :meth:`str`, etc., in your enum::" msgstr "或者你也可以在你的列舉重新給定合適的 :meth:`str`: ::" -#: ../../library/enum.rst:1042 +#: ../../library/enum.rst:1057 msgid "" ">>> from enum import Enum, IntEnum\n" ">>> class MyIntEnum(IntEnum):\n" @@ -1861,27 +1883,3 @@ msgstr "" ">>> from enum import Enum, IntEnum\n" ">>> class MyIntEnum(IntEnum):\n" "... __str__ = Enum.__str__" - -#~ msgid "Adds a new name as an alias to an existing member::" -#~ msgstr "新增一個名稱作為現有成員的別名: ::" - -#~ msgid "" -#~ ">>> Color.RED._add_alias_(\"ERROR\")\n" -#~ ">>> Color.ERROR\n" -#~ "" -#~ msgstr "" -#~ ">>> Color.RED._add_alias_(\"ERROR\")\n" -#~ ">>> Color.ERROR\n" -#~ "" - -#~ msgid "Adds a new value as an alias to an existing member::" -#~ msgstr "新增一個值作為現有成員的別名: ::" - -#~ msgid "" -#~ ">>> Color.RED._add_value_alias_(42)\n" -#~ ">>> Color(42)\n" -#~ "" -#~ msgstr "" -#~ ">>> Color.RED._add_value_alias_(42)\n" -#~ ">>> Color(42)\n" -#~ "" diff --git a/library/getpass.po b/library/getpass.po index 706e6b8c265..93118b2782b 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-10 20:44+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: 2022-02-11 12:04+0800\n" "Last-Translator: Weilin Du\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -62,16 +62,16 @@ msgstr "" msgid "" "The *echo_char* argument controls how user input is displayed while typing. " "If *echo_char* is ``None`` (default), input remains hidden. Otherwise, " -"*echo_char* must be a printable ASCII string and each typed character is " -"replaced by it. For example, ``echo_char='*'`` will display asterisks " -"instead of the actual input." +"*echo_char* must be a single printable ASCII character and each typed " +"character is replaced by it. For example, ``echo_char='*'`` will display " +"asterisks instead of the actual input." msgstr "" #: ../../library/getpass.rst:34 msgid "" "If echo free input is unavailable getpass() falls back to printing a warning " -"message to *stream* and reading from ``sys.stdin`` and issuing " -"a :exc:`GetPassWarning`." +"message to *stream* and reading from ``sys.stdin`` and issuing a :exc:" +"`GetPassWarning`." msgstr "" "如果無回音輸入 (echo-free input) 無法使用則 getpass() 將回退為印出一條警告訊" "息到 *stream*,並從 ``sys.stdin`` 讀取且同時發出 :exc:`GetPassWarning`。" @@ -107,12 +107,11 @@ msgstr "回傳使用者的\"登入名稱\"。" #: ../../library/getpass.rst:62 msgid "" -"This function checks the environment " -"variables :envvar:`LOGNAME`, :envvar:`USER`, :envvar:`!LNAME` " -"and :envvar:`USERNAME`, in order, and returns the value of the first one " -"which is set to a non-empty string. If none are set, the login name from " -"the password database is returned on systems which support the :mod:`pwd` " -"module, otherwise, an :exc:`OSError` is raised." +"This function checks the environment variables :envvar:`LOGNAME`, :envvar:" +"`USER`, :envvar:`!LNAME` and :envvar:`USERNAME`, in order, and returns the " +"value of the first one which is set to a non-empty string. If none are set, " +"the login name from the password database is returned on systems which " +"support the :mod:`pwd` module, otherwise, an :exc:`OSError` is raised." msgstr "" "此函式會按順序檢查環境變數 :envvar:`LOGNAME`、:envvar:`USER`、:envvar:`!" "LNAME` 和 :envvar:`USERNAME`,並回傳其中第一個被設定成非空字串的值。如果均未" diff --git a/library/html.po b/library/html.po index 52907a6a55b..8fae0bf234b 100644 --- a/library/html.po +++ b/library/html.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,36 +33,39 @@ msgstr "此模組定義了操作 HTML 的工具。" msgid "" "Convert the characters ``&``, ``<`` and ``>`` in string *s* to HTML-safe " "sequences. Use this if you need to display text that might contain such " -"characters in HTML. If the optional flag *quote* is true, the characters " -"(``\"``) and (``'``) are also translated; this helps for inclusion in an " -"HTML attribute value delimited by quotes, as in ````." +"characters in HTML. If the optional flag *quote* is true (the default), the " +"characters (``\"``) and (``'``) are also translated; this helps for " +"inclusion in an HTML attribute value delimited by quotes, as in ````. If *quote* is set to false, the characters (``\"``) and " +"(``'``) are not translated." msgstr "" "將字串 *s* 中的 ``&``、``<`` 和 ``>`` 字元轉換為在 HTML 中安全的序列 " "(sequence)。如果你需要在 HTML 中顯示可能包含這些字元的文字,可以使用這個函" -"式。如果選擇性的旗標 *quote* 為 true,則 (``\"``) 與 (``'``) 字元也會被轉換;" -"這樣能包含在 HTML 中,被引號分隔的屬性值,如 ```` 。" +"式。如果選擇性的旗標 *quote* 為 true(預設),則 (``\"``) 與 (``'``) 字元也會被轉換;" +"這樣能包含在 HTML 中,被引號分隔的屬性值,如 ```` 。如果 *quote* 設" +"為 false,則 (``\"``) 與 (``'``) 字元不會被轉換。" -#: ../../library/html.rst:26 +#: ../../library/html.rst:29 msgid "" -"Convert all named and numeric character references (e.g. ``>``, " -"``>``, ``>``) in the string *s* to the corresponding Unicode " -"characters. This function uses the rules defined by the HTML 5 standard for " -"both valid and invalid character references, and the :data:`list of HTML 5 " -"named character references `." +"Convert all named and numeric character references (e.g. ``>``, ``>" +"``, ``>``) in the string *s* to the corresponding Unicode characters. " +"This function uses the rules defined by the HTML 5 standard for both valid " +"and invalid character references, and the :data:`list of HTML 5 named " +"character references `." msgstr "" "將字串 *s* 中所有附名 (named) 且為數值的 (numeric) 字元參照(如: ``>``、 " "``>``、``>`` )轉換為對應的 Unicode 字元。此函式針對有效及無效的字元" "參照,皆使用 HTML 5 標準所定義的規則,以及 :data:`HTML 5 附名字元參照清單 " "` 。" -#: ../../library/html.rst:36 +#: ../../library/html.rst:39 msgid "Submodules in the ``html`` package are:" msgstr "``html`` 套件中的子模組為:" -#: ../../library/html.rst:38 +#: ../../library/html.rst:41 msgid ":mod:`html.parser` -- HTML/XHTML parser with lenient parsing mode" msgstr ":mod:`html.parser` -- 帶有寬鬆剖析模式的 HTML/XHTML 剖析器" -#: ../../library/html.rst:39 +#: ../../library/html.rst:42 msgid ":mod:`html.entities` -- HTML entity definitions" msgstr ":mod:`html.entities` -- HTML 實體的定義" diff --git a/library/inspect.po b/library/inspect.po index fa571e54255..093377a4d2b 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-10 20:44+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,10 +51,10 @@ msgstr "" msgid "" "The :func:`getmembers` function retrieves the members of an object such as a " "class or module. The functions whose names begin with \"is\" are mainly " -"provided as convenient choices for the second argument " -"to :func:`getmembers`. They also help you determine when you can expect to " -"find the following special attributes (see :ref:`import-mod-attrs` for " -"module attributes):" +"provided as convenient choices for the second argument to :func:" +"`getmembers`. They also help you determine when you can expect to find the " +"following special attributes (see :ref:`import-mod-attrs` for module " +"attributes):" msgstr "" #: ../../library/inspect.rst:46 @@ -74,19 +74,19 @@ msgid "class" msgstr "" #: ../../library/inspect.rst:48 ../../library/inspect.rst:63 -#: ../../library/inspect.rst:81 ../../library/inspect.rst:292 +#: ../../library/inspect.rst:81 ../../library/inspect.rst:295 msgid "__doc__" msgstr "__doc__" #: ../../library/inspect.rst:48 ../../library/inspect.rst:63 -#: ../../library/inspect.rst:81 ../../library/inspect.rst:292 +#: ../../library/inspect.rst:81 ../../library/inspect.rst:295 msgid "documentation string" msgstr "" #: ../../library/inspect.rst:50 ../../library/inspect.rst:65 #: ../../library/inspect.rst:83 ../../library/inspect.rst:248 -#: ../../library/inspect.rst:262 ../../library/inspect.rst:275 -#: ../../library/inspect.rst:294 +#: ../../library/inspect.rst:265 ../../library/inspect.rst:278 +#: ../../library/inspect.rst:297 msgid "__name__" msgstr "__name__" @@ -96,15 +96,15 @@ msgstr "" #: ../../library/inspect.rst:53 ../../library/inspect.rst:68 #: ../../library/inspect.rst:86 ../../library/inspect.rst:250 -#: ../../library/inspect.rst:264 ../../library/inspect.rst:277 -#: ../../library/inspect.rst:297 +#: ../../library/inspect.rst:267 ../../library/inspect.rst:280 +#: ../../library/inspect.rst:300 msgid "__qualname__" msgstr "__qualname__" #: ../../library/inspect.rst:53 ../../library/inspect.rst:68 #: ../../library/inspect.rst:86 ../../library/inspect.rst:250 -#: ../../library/inspect.rst:264 ../../library/inspect.rst:277 -#: ../../library/inspect.rst:297 +#: ../../library/inspect.rst:267 ../../library/inspect.rst:280 +#: ../../library/inspect.rst:300 msgid "qualified name" msgstr "" @@ -143,7 +143,7 @@ msgstr "__func__" msgid "function object containing implementation of method" msgstr "" -#: ../../library/inspect.rst:74 ../../library/inspect.rst:299 +#: ../../library/inspect.rst:74 ../../library/inspect.rst:302 msgid "__self__" msgstr "__self__" @@ -260,7 +260,7 @@ msgid "next inner traceback object (called by this level)" msgstr "" #: ../../library/inspect.rst:132 ../../library/inspect.rst:252 -#: ../../library/inspect.rst:269 ../../library/inspect.rst:282 +#: ../../library/inspect.rst:272 ../../library/inspect.rst:285 msgid "frame" msgstr "" @@ -355,8 +355,8 @@ msgstr "" msgid "used to clear all references to local variables" msgstr "" -#: ../../library/inspect.rst:175 ../../library/inspect.rst:256 -#: ../../library/inspect.rst:273 ../../library/inspect.rst:286 +#: ../../library/inspect.rst:175 ../../library/inspect.rst:259 +#: ../../library/inspect.rst:276 ../../library/inspect.rst:289 msgid "code" msgstr "code(程式碼)" @@ -528,8 +528,8 @@ msgstr "" msgid "generator" msgstr "" -#: ../../library/inspect.rst:248 ../../library/inspect.rst:262 -#: ../../library/inspect.rst:275 +#: ../../library/inspect.rst:248 ../../library/inspect.rst:265 +#: ../../library/inspect.rst:278 msgid "name" msgstr "" @@ -541,113 +541,121 @@ msgstr "gi_frame" msgid "gi_running" msgstr "gi_running" -#: ../../library/inspect.rst:254 ../../library/inspect.rst:271 +#: ../../library/inspect.rst:254 ../../library/inspect.rst:274 msgid "is the generator running?" msgstr "" #: ../../library/inspect.rst:256 +msgid "gi_suspended" +msgstr "" + +#: ../../library/inspect.rst:256 +msgid "is the generator suspended?" +msgstr "" + +#: ../../library/inspect.rst:259 msgid "gi_code" msgstr "gi_code" -#: ../../library/inspect.rst:258 +#: ../../library/inspect.rst:261 msgid "gi_yieldfrom" msgstr "gi_yieldfrom" -#: ../../library/inspect.rst:258 +#: ../../library/inspect.rst:261 msgid "object being iterated by ``yield from``, or ``None``" msgstr "" -#: ../../library/inspect.rst:262 +#: ../../library/inspect.rst:265 msgid "async generator" msgstr "" -#: ../../library/inspect.rst:266 +#: ../../library/inspect.rst:269 msgid "ag_await" msgstr "ag_await" -#: ../../library/inspect.rst:266 ../../library/inspect.rst:279 +#: ../../library/inspect.rst:269 ../../library/inspect.rst:282 msgid "object being awaited on, or ``None``" msgstr "" -#: ../../library/inspect.rst:269 +#: ../../library/inspect.rst:272 msgid "ag_frame" msgstr "ag_frame" -#: ../../library/inspect.rst:271 +#: ../../library/inspect.rst:274 msgid "ag_running" msgstr "ag_running" -#: ../../library/inspect.rst:273 +#: ../../library/inspect.rst:276 msgid "ag_code" msgstr "ag_code" -#: ../../library/inspect.rst:275 +#: ../../library/inspect.rst:278 msgid "coroutine" msgstr "coroutine" -#: ../../library/inspect.rst:279 +#: ../../library/inspect.rst:282 msgid "cr_await" msgstr "cr_await" -#: ../../library/inspect.rst:282 +#: ../../library/inspect.rst:285 msgid "cr_frame" msgstr "cr_frame" -#: ../../library/inspect.rst:284 +#: ../../library/inspect.rst:287 msgid "cr_running" msgstr "cr_running" -#: ../../library/inspect.rst:284 +#: ../../library/inspect.rst:287 msgid "is the coroutine running?" msgstr "" -#: ../../library/inspect.rst:286 +#: ../../library/inspect.rst:289 msgid "cr_code" msgstr "cr_code" -#: ../../library/inspect.rst:288 +#: ../../library/inspect.rst:291 msgid "cr_origin" msgstr "cr_origin" -#: ../../library/inspect.rst:288 +#: ../../library/inspect.rst:291 msgid "where coroutine was created, or ``None``. See |coroutine-origin-link|" msgstr "" -#: ../../library/inspect.rst:292 +#: ../../library/inspect.rst:295 msgid "builtin" msgstr "" -#: ../../library/inspect.rst:294 +#: ../../library/inspect.rst:297 msgid "original name of this function or method" msgstr "" -#: ../../library/inspect.rst:299 +#: ../../library/inspect.rst:302 msgid "instance to which a method is bound, or ``None``" msgstr "" -#: ../../library/inspect.rst:306 +#: ../../library/inspect.rst:309 msgid "Add ``__qualname__`` and ``gi_yieldfrom`` attributes to generators." msgstr "將 ``__qualname__`` 和 ``gi_yieldfrom`` 屬性加到產生器。" -#: ../../library/inspect.rst:308 +#: ../../library/inspect.rst:311 msgid "" "The ``__name__`` attribute of generators is now set from the function name, " "instead of the code name, and it can now be modified." msgstr "" -#: ../../library/inspect.rst:313 +#: ../../library/inspect.rst:316 msgid "Add ``cr_origin`` attribute to coroutines." msgstr "新增協程的 ``cr_origin`` 屬性。" -#: ../../library/inspect.rst:317 +#: ../../library/inspect.rst:320 msgid "Add ``__builtins__`` attribute to functions." msgstr "新增函式的 ``__builtins__`` 屬性。" -#: ../../library/inspect.rst:321 +#: ../../library/inspect.rst:324 msgid "Add ``f_generator`` attribute to frames." msgstr "新增 ``f_generator`` 屬性到 frame。" -#: ../../library/inspect.rst:325 +#: ../../library/inspect.rst:328 msgid "" "Return all the members of an object in a list of ``(name, value)`` pairs " "sorted by name. If the optional *predicate* argument—which will be called " @@ -655,14 +663,14 @@ msgid "" "the predicate returns a true value are included." msgstr "" -#: ../../library/inspect.rst:332 +#: ../../library/inspect.rst:335 msgid "" ":func:`getmembers` will only return class attributes defined in the " "metaclass when the argument is a class and those attributes have been listed " "in the metaclass' custom :meth:`~object.__dir__`." msgstr "" -#: ../../library/inspect.rst:339 +#: ../../library/inspect.rst:342 msgid "" "Return all the members of an object in a list of ``(name, value)`` pairs " "sorted by name without triggering dynamic lookup via the descriptor " @@ -670,7 +678,7 @@ msgid "" "that satisfy a given predicate." msgstr "" -#: ../../library/inspect.rst:346 +#: ../../library/inspect.rst:349 msgid "" ":func:`getmembers_static` may not be able to retrieve all members that " "getmembers can fetch (like dynamically created attributes) and may find " @@ -679,7 +687,7 @@ msgid "" "cases." msgstr "" -#: ../../library/inspect.rst:357 +#: ../../library/inspect.rst:360 msgid "" "Return the name of the module named by the file *path*, without including " "the names of enclosing packages. The file extension is checked against all " @@ -688,123 +696,123 @@ msgid "" "``None`` is returned." msgstr "" -#: ../../library/inspect.rst:363 +#: ../../library/inspect.rst:366 msgid "" "Note that this function *only* returns a meaningful name for actual Python " "modules - paths that potentially refer to Python packages will still return " "``None``." msgstr "" -#: ../../library/inspect.rst:367 +#: ../../library/inspect.rst:370 msgid "The function is based directly on :mod:`importlib`." msgstr "此函式直接基於 :mod:`importlib`。" -#: ../../library/inspect.rst:373 +#: ../../library/inspect.rst:376 msgid "Return ``True`` if the object is a module." msgstr "如果物件是模組,則回傳 ``True``。" -#: ../../library/inspect.rst:378 +#: ../../library/inspect.rst:381 msgid "" "Return ``True`` if the object is a class, whether built-in or created in " "Python code." msgstr "" -#: ../../library/inspect.rst:384 +#: ../../library/inspect.rst:387 msgid "Return ``True`` if the object is a bound method written in Python." msgstr "" -#: ../../library/inspect.rst:389 +#: ../../library/inspect.rst:392 msgid "Return ``True`` if the object is a :term:`package`." msgstr "如果物件是 :term:`package`,則回傳 ``True``。" -#: ../../library/inspect.rst:396 +#: ../../library/inspect.rst:399 msgid "" "Return ``True`` if the object is a Python function, which includes functions " "created by a :term:`lambda` expression." msgstr "" -#: ../../library/inspect.rst:402 +#: ../../library/inspect.rst:405 msgid "Return ``True`` if the object is a Python generator function." msgstr "如果物件是 Python 產生器函式,則回傳 ``True``。" -#: ../../library/inspect.rst:404 +#: ../../library/inspect.rst:407 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is a Python generator function." msgstr "" -#: ../../library/inspect.rst:408 +#: ../../library/inspect.rst:411 msgid "" "Functions wrapped in :func:`functools.partialmethod` now return ``True`` if " "the wrapped function is a Python generator function." msgstr "" -#: ../../library/inspect.rst:414 +#: ../../library/inspect.rst:417 msgid "Return ``True`` if the object is a generator." msgstr "如果物件是產生器,則回傳 ``True``。" -#: ../../library/inspect.rst:419 +#: ../../library/inspect.rst:422 msgid "" "Return ``True`` if the object is a :term:`coroutine function` (a function " "defined with an :keyword:`async def` syntax), a :func:`functools.partial` " -"wrapping a :term:`coroutine function`, or a sync function marked " -"with :func:`markcoroutinefunction`." +"wrapping a :term:`coroutine function`, or a sync function marked with :func:" +"`markcoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:426 +#: ../../library/inspect.rst:429 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is a :term:`coroutine function`." msgstr "" -#: ../../library/inspect.rst:430 +#: ../../library/inspect.rst:433 msgid "" "Sync functions marked with :func:`markcoroutinefunction` now return ``True``." msgstr "" -#: ../../library/inspect.rst:434 ../../library/inspect.rst:504 +#: ../../library/inspect.rst:437 ../../library/inspect.rst:507 msgid "" "Functions wrapped in :func:`functools.partialmethod` now return ``True`` if " "the wrapped function is a :term:`coroutine function`." msgstr "" -#: ../../library/inspect.rst:441 +#: ../../library/inspect.rst:444 msgid "" "Decorator to mark a callable as a :term:`coroutine function` if it would not " "otherwise be detected by :func:`iscoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:444 +#: ../../library/inspect.rst:447 msgid "" "This may be of use for sync functions that return a :term:`coroutine`, if " "the function is passed to an API that requires :func:`iscoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:447 +#: ../../library/inspect.rst:450 msgid "" "When possible, using an :keyword:`async def` function is preferred. Also " -"acceptable is calling the function and testing the return " -"with :func:`iscoroutine`." +"acceptable is calling the function and testing the return with :func:" +"`iscoroutine`." msgstr "" -#: ../../library/inspect.rst:456 +#: ../../library/inspect.rst:459 msgid "" -"Return ``True`` if the object is a :term:`coroutine` created by " -"an :keyword:`async def` function." +"Return ``True`` if the object is a :term:`coroutine` created by an :keyword:" +"`async def` function." msgstr "" -#: ../../library/inspect.rst:464 +#: ../../library/inspect.rst:467 msgid "" "Return ``True`` if the object can be used in :keyword:`await` expression." msgstr "" -#: ../../library/inspect.rst:466 +#: ../../library/inspect.rst:469 msgid "" "Can also be used to distinguish generator-based coroutines from regular " "generators:" msgstr "" -#: ../../library/inspect.rst:469 +#: ../../library/inspect.rst:472 msgid "" "import types\n" "\n" @@ -828,13 +836,13 @@ msgstr "" "assert not isawaitable(gen())\n" "assert isawaitable(gen_coro())" -#: ../../library/inspect.rst:487 +#: ../../library/inspect.rst:490 msgid "" "Return ``True`` if the object is an :term:`asynchronous generator` function, " "for example:" msgstr "" -#: ../../library/inspect.rst:490 +#: ../../library/inspect.rst:493 msgid "" ">>> async def agen():\n" "... yield 1\n" @@ -843,66 +851,65 @@ msgid "" "True" msgstr "" -#: ../../library/inspect.rst:500 +#: ../../library/inspect.rst:503 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is an :term:`asynchronous generator` function." msgstr "" -#: ../../library/inspect.rst:510 +#: ../../library/inspect.rst:513 msgid "" "Return ``True`` if the object is an :term:`asynchronous generator iterator` " "created by an :term:`asynchronous generator` function." msgstr "" -#: ../../library/inspect.rst:517 +#: ../../library/inspect.rst:520 msgid "Return ``True`` if the object is a traceback." msgstr "" -#: ../../library/inspect.rst:522 +#: ../../library/inspect.rst:525 msgid "Return ``True`` if the object is a frame." msgstr "" -#: ../../library/inspect.rst:527 +#: ../../library/inspect.rst:530 msgid "Return ``True`` if the object is a code." msgstr "如果物件是程式碼,則回傳 ``True``。" -#: ../../library/inspect.rst:532 +#: ../../library/inspect.rst:535 msgid "" "Return ``True`` if the object is a built-in function or a bound built-in " "method." msgstr "" -#: ../../library/inspect.rst:537 +#: ../../library/inspect.rst:540 msgid "" "Return ``True`` if the type of object is a :class:`~types.MethodWrapperType`." msgstr "" -#: ../../library/inspect.rst:539 +#: ../../library/inspect.rst:542 msgid "" -"These are instances of :class:`~types.MethodWrapperType`, such " -"as :meth:`~object.__str__`, :meth:`~object.__eq__` " -"and :meth:`~object.__repr__`." +"These are instances of :class:`~types.MethodWrapperType`, such as :meth:" +"`~object.__str__`, :meth:`~object.__eq__` and :meth:`~object.__repr__`." msgstr "" -#: ../../library/inspect.rst:547 +#: ../../library/inspect.rst:550 msgid "" "Return ``True`` if the object is a user-defined or built-in function or " "method." msgstr "如果物件是使用者定義或內建的函式或方法,則回傳 ``True``。" -#: ../../library/inspect.rst:552 +#: ../../library/inspect.rst:555 msgid "Return ``True`` if the object is an abstract base class." msgstr "如果物件是抽象基底類別,則回傳 ``True``。" -#: ../../library/inspect.rst:557 +#: ../../library/inspect.rst:560 msgid "" -"Return ``True`` if the object is a method descriptor, but not " -"if :func:`ismethod`, :func:`isclass`, :func:`isfunction` " -"or :func:`isbuiltin` are true." +"Return ``True`` if the object is a method descriptor, but not if :func:" +"`ismethod`, :func:`isclass`, :func:`isfunction` or :func:`isbuiltin` are " +"true." msgstr "" -#: ../../library/inspect.rst:561 +#: ../../library/inspect.rst:564 msgid "" "This, for example, is true of ``int.__add__``. An object passing this test " "has a :meth:`~object.__get__` method, but not a :meth:`~object.__set__` " @@ -911,79 +918,77 @@ msgid "" "sensible, and :attr:`~definition.__doc__` often is." msgstr "" -#: ../../library/inspect.rst:567 +#: ../../library/inspect.rst:570 msgid "" "Methods implemented via descriptors that also pass one of the other tests " "return ``False`` from the :func:`ismethoddescriptor` test, simply because " -"the other tests promise more -- you can, e.g., count on having " -"the :attr:`~method.__func__` attribute (etc) when an object " -"passes :func:`ismethod`." +"the other tests promise more -- you can, e.g., count on having the :attr:" +"`~method.__func__` attribute (etc) when an object passes :func:`ismethod`." msgstr "" -#: ../../library/inspect.rst:573 +#: ../../library/inspect.rst:576 msgid "" -"This function no longer incorrectly reports objects " -"with :meth:`~object.__get__` and :meth:`~object.__delete__`, but " -"not :meth:`~object.__set__`, as being method descriptors (such objects are " -"data descriptors, not method descriptors)." +"This function no longer incorrectly reports objects with :meth:`~object." +"__get__` and :meth:`~object.__delete__`, but not :meth:`~object.__set__`, as " +"being method descriptors (such objects are data descriptors, not method " +"descriptors)." msgstr "" -#: ../../library/inspect.rst:581 +#: ../../library/inspect.rst:584 msgid "Return ``True`` if the object is a data descriptor." msgstr "如果物件是資料描述器,則回傳 ``True``。" -#: ../../library/inspect.rst:583 +#: ../../library/inspect.rst:586 msgid "" -"Data descriptors have a :attr:`~object.__set__` or " -"a :attr:`~object.__delete__` method. Examples are properties (defined in " -"Python), getsets, and members. The latter two are defined in C and there " -"are more specific tests available for those types, which is robust across " -"Python implementations. Typically, data descriptors will also " -"have :attr:`~definition.__name__` and :attr:`!__doc__` attributes " -"(properties, getsets, and members have both of these attributes), but this " -"is not guaranteed." +"Data descriptors have a :attr:`~object.__set__` or a :attr:`~object." +"__delete__` method. Examples are properties (defined in Python), getsets, " +"and members. The latter two are defined in C and there are more specific " +"tests available for those types, which is robust across Python " +"implementations. Typically, data descriptors will also have :attr:" +"`~definition.__name__` and :attr:`!__doc__` attributes (properties, getsets, " +"and members have both of these attributes), but this is not guaranteed." msgstr "" -#: ../../library/inspect.rst:594 +#: ../../library/inspect.rst:597 msgid "Return ``True`` if the object is a getset descriptor." msgstr "" -#: ../../library/inspect.rst:598 +#: ../../library/inspect.rst:601 msgid "" -"getsets are attributes defined in extension modules " -"via :c:type:`PyGetSetDef` structures. For Python implementations without " -"such types, this method will always return ``False``." +"getsets are attributes defined in extension modules via :c:type:" +"`PyGetSetDef` structures. For Python implementations without such types, " +"this method will always return ``False``." msgstr "" -#: ../../library/inspect.rst:605 +#: ../../library/inspect.rst:608 msgid "Return ``True`` if the object is a member descriptor." msgstr "如果物件是成員描述器,則回傳 ``True``。" -#: ../../library/inspect.rst:609 +#: ../../library/inspect.rst:612 msgid "" -"Member descriptors are attributes defined in extension modules " -"via :c:type:`PyMemberDef` structures. For Python implementations without " -"such types, this method will always return ``False``." +"Member descriptors are attributes defined in extension modules via :c:type:" +"`PyMemberDef` structures. For Python implementations without such types, " +"this method will always return ``False``." msgstr "" -#: ../../library/inspect.rst:617 +#: ../../library/inspect.rst:620 msgid "Retrieving source code" msgstr "取得原始碼" -#: ../../library/inspect.rst:621 +#: ../../library/inspect.rst:624 msgid "" -"Get the documentation string for an object, cleaned up " -"with :func:`cleandoc`. If the documentation string for an object is not " -"provided and the object is a class, a method, a property or a descriptor, " -"retrieve the documentation string from the inheritance hierarchy. Return " -"``None`` if the documentation string is invalid or missing." +"Get the documentation string for an object, cleaned up with :func:" +"`cleandoc`. If the documentation string for an object is not provided and " +"the object is a class, a method, a property or a descriptor, retrieve the " +"documentation string from the inheritance hierarchy. Return ``None`` if the " +"documentation string is invalid or missing." msgstr "" -#: ../../library/inspect.rst:627 +#: ../../library/inspect.rst:630 msgid "Documentation strings are now inherited if not overridden." msgstr "" -#: ../../library/inspect.rst:633 +#: ../../library/inspect.rst:636 msgid "" "Return in a single string any lines of comments immediately preceding the " "object's source code (for a class, function, or method), or at the top of " @@ -992,27 +997,27 @@ msgid "" "been defined in C or the interactive shell." msgstr "" -#: ../../library/inspect.rst:642 +#: ../../library/inspect.rst:645 msgid "" "Return the name of the (text or binary) file in which an object was defined. " "This will fail with a :exc:`TypeError` if the object is a built-in module, " "class, or function." msgstr "" -#: ../../library/inspect.rst:649 +#: ../../library/inspect.rst:652 msgid "" "Try to guess which module an object was defined in. Return ``None`` if the " "module cannot be determined." msgstr "" -#: ../../library/inspect.rst:655 +#: ../../library/inspect.rst:658 msgid "" "Return the name of the Python source file in which an object was defined or " "``None`` if no way can be identified to get the source. This will fail with " "a :exc:`TypeError` if the object is a built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:663 +#: ../../library/inspect.rst:666 msgid "" "Return a list of source lines and starting line number for an object. The " "argument may be a module, class, method, function, traceback, frame, or code " @@ -1023,13 +1028,13 @@ msgid "" "built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:672 ../../library/inspect.rst:686 +#: ../../library/inspect.rst:675 ../../library/inspect.rst:689 msgid "" ":exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the " "former." msgstr "" -#: ../../library/inspect.rst:679 +#: ../../library/inspect.rst:682 msgid "" "Return the text of the source code for an object. The argument may be a " "module, class, method, function, traceback, frame, or code object. The " @@ -1038,13 +1043,13 @@ msgid "" "object is a built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:693 +#: ../../library/inspect.rst:696 msgid "" "Clean up indentation from docstrings that are indented to line up with " "blocks of code." msgstr "" -#: ../../library/inspect.rst:696 +#: ../../library/inspect.rst:699 msgid "" "All leading whitespace is removed from the first line. Any leading " "whitespace that can be uniformly removed from the second line onwards is " @@ -1052,22 +1057,22 @@ msgid "" "Also, all tabs are expanded to spaces." msgstr "" -#: ../../library/inspect.rst:705 +#: ../../library/inspect.rst:708 msgid "Introspecting callables with the Signature object" msgstr "" -#: ../../library/inspect.rst:709 +#: ../../library/inspect.rst:712 msgid "" "The :class:`Signature` object represents the call signature of a callable " "object and its return annotation. To retrieve a :class:`!Signature` object, " "use the :func:`!signature` function." msgstr "" -#: ../../library/inspect.rst:716 +#: ../../library/inspect.rst:719 msgid "Return a :class:`Signature` object for the given *callable*:" msgstr "" -#: ../../library/inspect.rst:718 +#: ../../library/inspect.rst:721 msgid "" ">>> from inspect import signature\n" ">>> def foo(a, *, b:int, **kwargs):\n" @@ -1099,68 +1104,66 @@ msgstr "" ">>> sig.parameters['b'].annotation\n" "" -#: ../../library/inspect.rst:735 +#: ../../library/inspect.rst:738 msgid "" "Accepts a wide range of Python callables, from plain functions and classes " "to :func:`functools.partial` objects." msgstr "" -#: ../../library/inspect.rst:738 +#: ../../library/inspect.rst:741 msgid "" "If some of the annotations are strings (e.g., because ``from __future__ " "import annotations`` was used), :func:`signature` will attempt to " -"automatically un-stringize the annotations " -"using :func:`annotationlib.get_annotations`. The *globals*, *locals*, and " -"*eval_str* parameters are passed into :func:`!annotationlib.get_annotations` " -"when resolving the annotations; see the documentation for :func:`!" -"annotationlib.get_annotations` for instructions on how to use these " -"parameters. A member of the :class:`annotationlib.Format` enum can be passed " -"to the *annotation_format* parameter to control the format of the returned " -"annotations. For example, use " -"``annotation_format=annotationlib.Format.STRING`` to return annotations in " -"string format." -msgstr "" - -#: ../../library/inspect.rst:752 -msgid "" -"Raises :exc:`ValueError` if no signature can be provided, " -"and :exc:`TypeError` if that type of object is not supported. Also, if the " +"automatically un-stringize the annotations using :func:`annotationlib." +"get_annotations`. The *globals*, *locals*, and *eval_str* parameters are " +"passed into :func:`!annotationlib.get_annotations` when resolving the " +"annotations; see the documentation for :func:`!annotationlib." +"get_annotations` for instructions on how to use these parameters. A member " +"of the :class:`annotationlib.Format` enum can be passed to the " +"*annotation_format* parameter to control the format of the returned " +"annotations. For example, use ``annotation_format=annotationlib.Format." +"STRING`` to return annotations in string format." +msgstr "" + +#: ../../library/inspect.rst:755 +msgid "" +"Raises :exc:`ValueError` if no signature can be provided, and :exc:" +"`TypeError` if that type of object is not supported. Also, if the " "annotations are stringized, and *eval_str* is not false, the ``eval()`` " -"call(s) to un-stringize the annotations " -"in :func:`annotationlib.get_annotations` could potentially raise any kind of " -"exception." +"call(s) to un-stringize the annotations in :func:`annotationlib." +"get_annotations` could potentially raise any kind of exception." msgstr "" -#: ../../library/inspect.rst:758 +#: ../../library/inspect.rst:761 msgid "" "A slash (/) in the signature of a function denotes that the parameters prior " "to it are positional-only. For more info, see :ref:`the FAQ entry on " "positional-only parameters `." msgstr "" -#: ../../library/inspect.rst:762 +#: ../../library/inspect.rst:765 msgid "" "The *follow_wrapped* parameter was added. Pass ``False`` to get a signature " "of *callable* specifically (``callable.__wrapped__`` will not be used to " "unwrap decorated callables.)" msgstr "" -#: ../../library/inspect.rst:768 ../../library/inspect.rst:904 +#: ../../library/inspect.rst:771 ../../library/inspect.rst:907 msgid "The *globals*, *locals*, and *eval_str* parameters were added." msgstr "" -#: ../../library/inspect.rst:771 +#: ../../library/inspect.rst:774 msgid "The *annotation_format* parameter was added." msgstr "" -#: ../../library/inspect.rst:776 +#: ../../library/inspect.rst:779 msgid "" "Some callables may not be introspectable in certain implementations of " "Python. For example, in CPython, some built-in functions defined in C " "provide no metadata about their arguments." msgstr "" -#: ../../library/inspect.rst:782 +#: ../../library/inspect.rst:785 msgid "" "If the passed object has a :attr:`!__signature__` attribute, we may use it " "to create the signature. The exact semantics are an implementation detail " @@ -1168,14 +1171,14 @@ msgid "" "semantics." msgstr "" -#: ../../library/inspect.rst:790 +#: ../../library/inspect.rst:793 msgid "" "A :class:`!Signature` object represents the call signature of a function and " "its return annotation. For each parameter accepted by the function it " "stores a :class:`Parameter` object in its :attr:`parameters` collection." msgstr "" -#: ../../library/inspect.rst:795 +#: ../../library/inspect.rst:798 msgid "" "The optional *parameters* argument is a sequence of :class:`Parameter` " "objects, which is validated to check that there are no parameters with " @@ -1184,54 +1187,54 @@ msgid "" "defaults follow parameters without defaults." msgstr "" -#: ../../library/inspect.rst:801 +#: ../../library/inspect.rst:804 msgid "" "The optional *return_annotation* argument can be an arbitrary Python object. " "It represents the \"return\" annotation of the callable." msgstr "" -#: ../../library/inspect.rst:804 +#: ../../library/inspect.rst:807 msgid "" ":class:`!Signature` objects are *immutable*. Use :meth:`Signature.replace` " "or :func:`copy.replace` to make a modified copy." msgstr "" -#: ../../library/inspect.rst:807 +#: ../../library/inspect.rst:810 msgid ":class:`!Signature` objects are now picklable and :term:`hashable`." msgstr "" -#: ../../library/inspect.rst:812 +#: ../../library/inspect.rst:815 msgid "A special class-level marker to specify absence of a return annotation." msgstr "" -#: ../../library/inspect.rst:816 +#: ../../library/inspect.rst:819 msgid "" -"An ordered mapping of parameters' names to the " -"corresponding :class:`Parameter` objects. Parameters appear in strict " -"definition order, including keyword-only parameters." +"An ordered mapping of parameters' names to the corresponding :class:" +"`Parameter` objects. Parameters appear in strict definition order, " +"including keyword-only parameters." msgstr "" -#: ../../library/inspect.rst:820 ../../library/inspect.rst:1184 +#: ../../library/inspect.rst:823 ../../library/inspect.rst:1187 msgid "" "Python only explicitly guaranteed that it preserved the declaration order of " "keyword-only parameters as of version 3.7, although in practice this order " "had always been preserved in Python 3." msgstr "" -#: ../../library/inspect.rst:827 +#: ../../library/inspect.rst:830 msgid "" "The \"return\" annotation for the callable. If the callable has no " "\"return\" annotation, this attribute is set to :attr:`Signature.empty`." msgstr "" -#: ../../library/inspect.rst:832 +#: ../../library/inspect.rst:835 msgid "" "Create a mapping from positional and keyword arguments to parameters. " "Returns :class:`BoundArguments` if ``*args`` and ``**kwargs`` match the " "signature, or raises a :exc:`TypeError`." msgstr "" -#: ../../library/inspect.rst:838 +#: ../../library/inspect.rst:841 msgid "" "Works the same way as :meth:`Signature.bind`, but allows the omission of " "some required arguments (mimics :func:`functools.partial` behavior.) " @@ -1239,16 +1242,16 @@ msgid "" "arguments do not match the signature." msgstr "" -#: ../../library/inspect.rst:845 +#: ../../library/inspect.rst:848 msgid "" -"Create a new :class:`Signature` instance based on the " -"instance :meth:`replace` was invoked on. It is possible to pass different " -"*parameters* and/or *return_annotation* to override the corresponding " -"properties of the base signature. To remove ``return_annotation`` from the " -"copied :class:`!Signature`, pass in :attr:`Signature.empty`." +"Create a new :class:`Signature` instance based on the instance :meth:" +"`replace` was invoked on. It is possible to pass different *parameters* and/" +"or *return_annotation* to override the corresponding properties of the base " +"signature. To remove ``return_annotation`` from the copied :class:`!" +"Signature`, pass in :attr:`Signature.empty`." msgstr "" -#: ../../library/inspect.rst:853 +#: ../../library/inspect.rst:856 msgid "" ">>> def test(a, b):\n" "... pass\n" @@ -1266,47 +1269,47 @@ msgstr "" ">>> str(new_sig)\n" "\"(a, b) -> 'new return anno'\"" -#: ../../library/inspect.rst:863 +#: ../../library/inspect.rst:866 msgid "" -":class:`Signature` objects are also supported by the generic " -"function :func:`copy.replace`." +":class:`Signature` objects are also supported by the generic function :func:" +"`copy.replace`." msgstr "" -#: ../../library/inspect.rst:868 +#: ../../library/inspect.rst:871 msgid "Create a string representation of the :class:`Signature` object." msgstr "" -#: ../../library/inspect.rst:870 +#: ../../library/inspect.rst:873 msgid "" "If *max_width* is passed, the method will attempt to fit the signature into " "lines of at most *max_width* characters. If the signature is longer than " "*max_width*, all parameters will be on separate lines." msgstr "" -#: ../../library/inspect.rst:875 +#: ../../library/inspect.rst:878 msgid "" "If *quote_annotation_strings* is False, :term:`annotations ` in " "the signature are displayed without opening and closing quotation marks if " -"they are strings. This is useful if the signature was created with " -"the :attr:`~annotationlib.Format.STRING` format or if ``from __future__ " -"import annotations`` was used." +"they are strings. This is useful if the signature was created with the :attr:" +"`~annotationlib.Format.STRING` format or if ``from __future__ import " +"annotations`` was used." msgstr "" -#: ../../library/inspect.rst:883 +#: ../../library/inspect.rst:886 msgid "The *unquote_annotations* parameter was added." msgstr "" -#: ../../library/inspect.rst:888 +#: ../../library/inspect.rst:891 msgid "" "Return a :class:`Signature` (or its subclass) object for a given callable " "*obj*." msgstr "" -#: ../../library/inspect.rst:891 +#: ../../library/inspect.rst:894 msgid "This method simplifies subclassing of :class:`Signature`:" msgstr "" -#: ../../library/inspect.rst:893 +#: ../../library/inspect.rst:896 msgid "" "class MySignature(Signature):\n" " pass\n" @@ -1318,130 +1321,129 @@ msgstr "" "sig = MySignature.from_callable(sum)\n" "assert isinstance(sig, MySignature)" -#: ../../library/inspect.rst:900 +#: ../../library/inspect.rst:903 msgid "Its behavior is otherwise identical to that of :func:`signature`." msgstr "" -#: ../../library/inspect.rst:910 +#: ../../library/inspect.rst:913 msgid "" ":class:`!Parameter` objects are *immutable*. Instead of modifying a :class:`!" -"Parameter` object, you can use :meth:`Parameter.replace` " -"or :func:`copy.replace` to create a modified copy." +"Parameter` object, you can use :meth:`Parameter.replace` or :func:`copy." +"replace` to create a modified copy." msgstr "" -#: ../../library/inspect.rst:914 +#: ../../library/inspect.rst:917 msgid "Parameter objects are now picklable and :term:`hashable`." msgstr "" -#: ../../library/inspect.rst:919 +#: ../../library/inspect.rst:922 msgid "" "A special class-level marker to specify absence of default values and " "annotations." msgstr "" -#: ../../library/inspect.rst:924 +#: ../../library/inspect.rst:927 msgid "" "The name of the parameter as a string. The name must be a valid Python " "identifier." msgstr "" -#: ../../library/inspect.rst:929 +#: ../../library/inspect.rst:932 msgid "" "CPython generates implicit parameter names of the form ``.0`` on the code " "objects used to implement comprehensions and generator expressions." msgstr "" -#: ../../library/inspect.rst:933 +#: ../../library/inspect.rst:936 msgid "" "These parameter names are now exposed by this module as names like " "``implicit0``." msgstr "" -#: ../../library/inspect.rst:939 +#: ../../library/inspect.rst:942 msgid "" "The default value for the parameter. If the parameter has no default value, " "this attribute is set to :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:944 +#: ../../library/inspect.rst:947 msgid "" "The annotation for the parameter. If the parameter has no annotation, this " "attribute is set to :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:949 +#: ../../library/inspect.rst:952 msgid "" "Describes how argument values are bound to the parameter. The possible " -"values are accessible via :class:`Parameter` (like " -"``Parameter.KEYWORD_ONLY``), and support comparison and ordering, in the " -"following order:" +"values are accessible via :class:`Parameter` (like ``Parameter." +"KEYWORD_ONLY``), and support comparison and ordering, in the following order:" msgstr "" -#: ../../library/inspect.rst:956 +#: ../../library/inspect.rst:959 msgid "Name" msgstr "名稱" -#: ../../library/inspect.rst:956 +#: ../../library/inspect.rst:959 msgid "Meaning" msgstr "意義" -#: ../../library/inspect.rst:958 +#: ../../library/inspect.rst:961 msgid "*POSITIONAL_ONLY*" msgstr "*POSITIONAL_ONLY*" -#: ../../library/inspect.rst:958 +#: ../../library/inspect.rst:961 msgid "" "Value must be supplied as a positional argument. Positional only parameters " "are those which appear before a ``/`` entry (if present) in a Python " "function definition." msgstr "" -#: ../../library/inspect.rst:963 +#: ../../library/inspect.rst:966 msgid "*POSITIONAL_OR_KEYWORD*" msgstr "*POSITIONAL_OR_KEYWORD*" -#: ../../library/inspect.rst:963 +#: ../../library/inspect.rst:966 msgid "" "Value may be supplied as either a keyword or positional argument (this is " "the standard binding behaviour for functions implemented in Python.)" msgstr "" -#: ../../library/inspect.rst:968 +#: ../../library/inspect.rst:971 msgid "*VAR_POSITIONAL*" msgstr "*VAR_POSITIONAL*" -#: ../../library/inspect.rst:968 +#: ../../library/inspect.rst:971 msgid "" "A tuple of positional arguments that aren't bound to any other parameter. " "This corresponds to a ``*args`` parameter in a Python function definition." msgstr "" -#: ../../library/inspect.rst:973 +#: ../../library/inspect.rst:976 msgid "*KEYWORD_ONLY*" msgstr "*KEYWORD_ONLY*" -#: ../../library/inspect.rst:973 +#: ../../library/inspect.rst:976 msgid "" "Value must be supplied as a keyword argument. Keyword only parameters are " "those which appear after a ``*`` or ``*args`` entry in a Python function " "definition." msgstr "" -#: ../../library/inspect.rst:978 +#: ../../library/inspect.rst:981 msgid "*VAR_KEYWORD*" msgstr "*VAR_KEYWORD*" -#: ../../library/inspect.rst:978 +#: ../../library/inspect.rst:981 msgid "" "A dict of keyword arguments that aren't bound to any other parameter. This " "corresponds to a ``**kwargs`` parameter in a Python function definition." msgstr "" -#: ../../library/inspect.rst:984 +#: ../../library/inspect.rst:987 msgid "Example: print all keyword-only arguments without default values:" msgstr "" -#: ../../library/inspect.rst:986 +#: ../../library/inspect.rst:989 msgid "" ">>> def foo(a, b, *, c, d=10):\n" "... pass\n" @@ -1463,15 +1465,15 @@ msgstr "" "... print('Parameter:', param)\n" "Parameter: c" -#: ../../library/inspect.rst:1000 +#: ../../library/inspect.rst:1003 msgid "Describes an enum value of :attr:`Parameter.kind`." msgstr "" -#: ../../library/inspect.rst:1004 +#: ../../library/inspect.rst:1007 msgid "Example: print all descriptions of arguments:" msgstr "範例:列印所有引數的描述:" -#: ../../library/inspect.rst:1006 +#: ../../library/inspect.rst:1009 msgid "" ">>> def foo(a, b, *, c, d=10):\n" "... pass\n" @@ -1495,7 +1497,7 @@ msgstr "" "keyword-only\n" "keyword-only" -#: ../../library/inspect.rst:1021 +#: ../../library/inspect.rst:1024 msgid "" "Create a new :class:`Parameter` instance based on the instance replaced was " "invoked on. To override a :class:`!Parameter` attribute, pass the " @@ -1503,7 +1505,7 @@ msgid "" "a :class:`!Parameter`, pass :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:1026 +#: ../../library/inspect.rst:1029 msgid "" ">>> from inspect import Parameter\n" ">>> param = Parameter('foo', Parameter.KEYWORD_ONLY, default=42)\n" @@ -1527,83 +1529,83 @@ msgstr "" ">>> str(param.replace(default=Parameter.empty, annotation='spam'))\n" "\"foo: 'spam'\"" -#: ../../library/inspect.rst:1039 +#: ../../library/inspect.rst:1042 msgid "" -":class:`Parameter` objects are also supported by the generic " -"function :func:`copy.replace`." +":class:`Parameter` objects are also supported by the generic function :func:" +"`copy.replace`." msgstr "" -#: ../../library/inspect.rst:1042 +#: ../../library/inspect.rst:1045 msgid "" "In Python 3.3 :class:`Parameter` objects were allowed to have ``name`` set " "to ``None`` if their ``kind`` was set to ``POSITIONAL_ONLY``. This is no " "longer permitted." msgstr "" -#: ../../library/inspect.rst:1049 +#: ../../library/inspect.rst:1052 msgid "" "Result of a :meth:`Signature.bind` or :meth:`Signature.bind_partial` call. " "Holds the mapping of arguments to the function's parameters." msgstr "" -#: ../../library/inspect.rst:1054 +#: ../../library/inspect.rst:1057 msgid "" "A mutable mapping of parameters' names to arguments' values. Contains only " -"explicitly bound arguments. Changes in :attr:`arguments` will reflect " -"in :attr:`args` and :attr:`kwargs`." +"explicitly bound arguments. Changes in :attr:`arguments` will reflect in :" +"attr:`args` and :attr:`kwargs`." msgstr "" -#: ../../library/inspect.rst:1058 +#: ../../library/inspect.rst:1061 msgid "" "Should be used in conjunction with :attr:`Signature.parameters` for any " "argument processing purposes." msgstr "" -#: ../../library/inspect.rst:1063 +#: ../../library/inspect.rst:1066 msgid "" "Arguments for which :meth:`Signature.bind` or :meth:`Signature.bind_partial` " -"relied on a default value are skipped. However, if needed, " -"use :meth:`BoundArguments.apply_defaults` to add them." +"relied on a default value are skipped. However, if needed, use :meth:" +"`BoundArguments.apply_defaults` to add them." msgstr "" -#: ../../library/inspect.rst:1068 +#: ../../library/inspect.rst:1071 msgid "" -":attr:`arguments` is now of type :class:`dict`. Formerly, it was of " -"type :class:`collections.OrderedDict`." +":attr:`arguments` is now of type :class:`dict`. Formerly, it was of type :" +"class:`collections.OrderedDict`." msgstr "" -#: ../../library/inspect.rst:1074 +#: ../../library/inspect.rst:1077 msgid "" -"A tuple of positional arguments values. Dynamically computed from " -"the :attr:`arguments` attribute." +"A tuple of positional arguments values. Dynamically computed from the :attr:" +"`arguments` attribute." msgstr "" -#: ../../library/inspect.rst:1079 +#: ../../library/inspect.rst:1082 msgid "" -"A dict of keyword arguments values. Dynamically computed from " -"the :attr:`arguments` attribute. Arguments that can be passed positionally " -"are included in :attr:`args` instead." +"A dict of keyword arguments values. Dynamically computed from the :attr:" +"`arguments` attribute. Arguments that can be passed positionally are " +"included in :attr:`args` instead." msgstr "" -#: ../../library/inspect.rst:1085 +#: ../../library/inspect.rst:1088 msgid "A reference to the parent :class:`Signature` object." msgstr "" -#: ../../library/inspect.rst:1089 +#: ../../library/inspect.rst:1092 msgid "Set default values for missing arguments." msgstr "為遺漏的引數設定預設值。" -#: ../../library/inspect.rst:1091 +#: ../../library/inspect.rst:1094 msgid "" "For variable-positional arguments (``*args``) the default is an empty tuple." msgstr "" -#: ../../library/inspect.rst:1094 +#: ../../library/inspect.rst:1097 msgid "" "For variable-keyword arguments (``**kwargs``) the default is an empty dict." msgstr "" -#: ../../library/inspect.rst:1097 +#: ../../library/inspect.rst:1100 msgid "" ">>> def foo(a, b='ham', *args): pass\n" ">>> ba = inspect.signature(foo).bind('spam')\n" @@ -1617,13 +1619,13 @@ msgstr "" ">>> ba.arguments\n" "{'a': 'spam', 'b': 'ham', 'args': ()}" -#: ../../library/inspect.rst:1107 +#: ../../library/inspect.rst:1110 msgid "" "The :attr:`args` and :attr:`kwargs` properties can be used to invoke " "functions:" msgstr "" -#: ../../library/inspect.rst:1110 +#: ../../library/inspect.rst:1113 msgid "" "def test(a, *, b):\n" " ...\n" @@ -1639,19 +1641,19 @@ msgstr "" "ba = sig.bind(10, b=20)\n" "test(*ba.args, **ba.kwargs)" -#: ../../library/inspect.rst:1122 +#: ../../library/inspect.rst:1125 msgid ":pep:`362` - Function Signature Object." msgstr "" -#: ../../library/inspect.rst:1123 +#: ../../library/inspect.rst:1126 msgid "The detailed specification, implementation details and examples." msgstr "" -#: ../../library/inspect.rst:1129 +#: ../../library/inspect.rst:1132 msgid "Classes and functions" msgstr "類別與函式" -#: ../../library/inspect.rst:1133 +#: ../../library/inspect.rst:1136 msgid "" "Arrange the given list of classes into a hierarchy of nested lists. Where a " "nested list appears, it contains classes derived from the class whose entry " @@ -1662,19 +1664,19 @@ msgid "" "will appear multiple times." msgstr "" -#: ../../library/inspect.rst:1144 +#: ../../library/inspect.rst:1147 msgid "" -"Get the names and default values of a Python function's parameters. " -"A :term:`named tuple` is returned:" +"Get the names and default values of a Python function's parameters. A :term:" +"`named tuple` is returned:" msgstr "" -#: ../../library/inspect.rst:1147 +#: ../../library/inspect.rst:1150 msgid "" "``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, " "annotations)``" msgstr "" -#: ../../library/inspect.rst:1150 +#: ../../library/inspect.rst:1153 msgid "" "*args* is a list of the positional parameter names. *varargs* is the name of " "the ``*`` parameter or ``None`` if arbitrary positional arguments are not " @@ -1689,7 +1691,7 @@ msgid "" "report the function return value annotation (if any)." msgstr "" -#: ../../library/inspect.rst:1165 +#: ../../library/inspect.rst:1168 msgid "" "Note that :func:`signature` and :ref:`Signature Object ` provide the recommended API for callable introspection, and support " @@ -1699,43 +1701,42 @@ msgid "" "``inspect`` module API." msgstr "" -#: ../../library/inspect.rst:1172 +#: ../../library/inspect.rst:1175 msgid "" "This function is now based on :func:`signature`, but still ignores " "``__wrapped__`` attributes and includes the already bound first parameter in " "the signature output for bound methods." msgstr "" -#: ../../library/inspect.rst:1177 +#: ../../library/inspect.rst:1180 msgid "" -"This method was previously documented as deprecated in favour " -"of :func:`signature` in Python 3.5, but that decision has been reversed in " -"order to restore a clearly supported standard interface for single-source " -"Python 2/3 code migrating away from the legacy :func:`!getargspec` API." +"This method was previously documented as deprecated in favour of :func:" +"`signature` in Python 3.5, but that decision has been reversed in order to " +"restore a clearly supported standard interface for single-source Python 2/3 " +"code migrating away from the legacy :func:`!getargspec` API." msgstr "" -#: ../../library/inspect.rst:1192 +#: ../../library/inspect.rst:1195 msgid "" -"Get information about arguments passed into a particular frame. " -"A :term:`named tuple` ``ArgInfo(args, varargs, keywords, locals)`` is " -"returned. *args* is a list of the argument names. *varargs* and *keywords* " -"are the names of the ``*`` and ``**`` arguments or ``None``. *locals* is " -"the locals dictionary of the given frame." +"Get information about arguments passed into a particular frame. A :term:" +"`named tuple` ``ArgInfo(args, varargs, keywords, locals)`` is returned. " +"*args* is a list of the argument names. *varargs* and *keywords* are the " +"names of the ``*`` and ``**`` arguments or ``None``. *locals* is the locals " +"dictionary of the given frame." msgstr "" -#: ../../library/inspect.rst:1199 ../../library/inspect.rst:1209 +#: ../../library/inspect.rst:1202 ../../library/inspect.rst:1212 msgid "This function was inadvertently marked as deprecated in Python 3.5." msgstr "" -#: ../../library/inspect.rst:1204 +#: ../../library/inspect.rst:1207 msgid "" -"Format a pretty argument spec from the four values returned " -"by :func:`getargvalues`. The format\\* arguments are the corresponding " -"optional formatting functions that are called to turn names and values into " -"strings." +"Format a pretty argument spec from the four values returned by :func:" +"`getargvalues`. The format\\* arguments are the corresponding optional " +"formatting functions that are called to turn names and values into strings." msgstr "" -#: ../../library/inspect.rst:1214 +#: ../../library/inspect.rst:1217 msgid "" "Return a tuple of class cls's base classes, including cls, in method " "resolution order. No class appears more than once in this tuple. Note that " @@ -1743,7 +1744,7 @@ msgid "" "user-defined metatype is in use, cls will be the first element of the tuple." msgstr "" -#: ../../library/inspect.rst:1222 +#: ../../library/inspect.rst:1225 msgid "" "Bind the *args* and *kwds* to the argument names of the Python function or " "method *func*, as if it was called with them. For bound methods, bind also " @@ -1756,7 +1757,7 @@ msgid "" "example:" msgstr "" -#: ../../library/inspect.rst:1231 +#: ../../library/inspect.rst:1234 msgid "" ">>> from inspect import getcallargs\n" ">>> def f(a, b=1, *pos, **named):\n" @@ -1786,11 +1787,11 @@ msgstr "" "...\n" "TypeError: f() missing 1 required positional argument: 'a'" -#: ../../library/inspect.rst:1248 +#: ../../library/inspect.rst:1251 msgid "Use :meth:`Signature.bind` and :meth:`Signature.bind_partial` instead." msgstr "請改用 :meth:`Signature.bind` 與 :meth:`Signature.bind_partial`。" -#: ../../library/inspect.rst:1254 +#: ../../library/inspect.rst:1257 msgid "" "Get the mapping of external name references in a Python function or method " "*func* to their current values. A :term:`named tuple` " @@ -1802,58 +1803,58 @@ msgid "" "builtins." msgstr "" -#: ../../library/inspect.rst:1263 +#: ../../library/inspect.rst:1266 msgid "" ":exc:`TypeError` is raised if *func* is not a Python function or method." msgstr "如果 *func* 不是 Python 函式或方法,則引發 :exc:`TypeError`。" -#: ../../library/inspect.rst:1270 +#: ../../library/inspect.rst:1273 msgid "" -"Get the object wrapped by *func*. It follows the chain " -"of :attr:`__wrapped__` attributes returning the last object in the chain." +"Get the object wrapped by *func*. It follows the chain of :attr:" +"`__wrapped__` attributes returning the last object in the chain." msgstr "" -#: ../../library/inspect.rst:1273 +#: ../../library/inspect.rst:1276 msgid "" "*stop* is an optional callback accepting an object in the wrapper chain as " "its sole argument that allows the unwrapping to be terminated early if the " "callback returns a true value. If the callback never returns a true value, " -"the last object in the chain is returned as usual. For " -"example, :func:`signature` uses this to stop unwrapping if any object in the " -"chain has a ``__signature__`` attribute defined." +"the last object in the chain is returned as usual. For example, :func:" +"`signature` uses this to stop unwrapping if any object in the chain has a " +"``__signature__`` attribute defined." msgstr "" -#: ../../library/inspect.rst:1280 +#: ../../library/inspect.rst:1283 msgid ":exc:`ValueError` is raised if a cycle is encountered." msgstr "如果遇到循環,則引發 :exc:`ValueError`。" -#: ../../library/inspect.rst:1287 +#: ../../library/inspect.rst:1290 msgid "Compute the annotations dict for an object." msgstr "" -#: ../../library/inspect.rst:1289 +#: ../../library/inspect.rst:1292 msgid "" "This is an alias for :func:`annotationlib.get_annotations`; see the " "documentation of that function for more information." msgstr "" -#: ../../library/inspect.rst:1294 +#: ../../library/inspect.rst:1297 msgid "" -"This function may execute arbitrary code contained in annotations. " -"See :ref:`annotationlib-security` for more information." +"This function may execute arbitrary code contained in annotations. See :ref:" +"`annotationlib-security` for more information." msgstr "" -#: ../../library/inspect.rst:1299 +#: ../../library/inspect.rst:1302 msgid "" "This function is now an alias for :func:`annotationlib.get_annotations`. " "Calling it as ``inspect.get_annotations`` will continue to work." msgstr "" -#: ../../library/inspect.rst:1307 +#: ../../library/inspect.rst:1310 msgid "The interpreter stack" msgstr "直譯器堆疊" -#: ../../library/inspect.rst:1309 +#: ../../library/inspect.rst:1312 msgid "" "Some of the following functions return :class:`FrameInfo` objects. For " "backwards compatibility these objects allow tuple-like operations on all " @@ -1861,95 +1862,95 @@ msgid "" "may be removed in the future." msgstr "" -#: ../../library/inspect.rst:1318 +#: ../../library/inspect.rst:1321 msgid "The :ref:`frame object ` that the record corresponds to." msgstr "" -#: ../../library/inspect.rst:1322 +#: ../../library/inspect.rst:1325 msgid "" "The file name associated with the code being executed by the frame this " "record corresponds to." msgstr "" -#: ../../library/inspect.rst:1327 +#: ../../library/inspect.rst:1330 msgid "" "The line number of the current line associated with the code being executed " "by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1332 +#: ../../library/inspect.rst:1335 msgid "" "The function name that is being executed by the frame this record " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1336 +#: ../../library/inspect.rst:1339 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1341 ../../library/inspect.rst:1380 +#: ../../library/inspect.rst:1344 ../../library/inspect.rst:1383 msgid "" "The index of the current line being executed in the :attr:`code_context` " "list." msgstr "" -#: ../../library/inspect.rst:1345 +#: ../../library/inspect.rst:1348 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1349 +#: ../../library/inspect.rst:1352 msgid "Return a :term:`named tuple` instead of a :class:`tuple`." msgstr "" -#: ../../library/inspect.rst:1352 +#: ../../library/inspect.rst:1355 msgid "" ":class:`!FrameInfo` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1361 +#: ../../library/inspect.rst:1364 msgid "" "The file name associated with the code being executed by the frame this " "traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1366 +#: ../../library/inspect.rst:1369 msgid "" "The line number of the current line associated with the code being executed " "by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1371 +#: ../../library/inspect.rst:1374 msgid "" "The function name that is being executed by the frame this traceback " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1375 +#: ../../library/inspect.rst:1378 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1384 +#: ../../library/inspect.rst:1387 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1389 +#: ../../library/inspect.rst:1392 msgid "" ":class:`!Traceback` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1396 +#: ../../library/inspect.rst:1399 msgid "" "Keeping references to frame objects, as found in the first element of the " "frame records these functions return, can cause your program to create " @@ -1961,16 +1962,15 @@ msgid "" "consumption which occurs." msgstr "" -#: ../../library/inspect.rst:1404 +#: ../../library/inspect.rst:1407 msgid "" "Though the cycle detector will catch these, destruction of the frames (and " -"local variables) can be made deterministic by removing the cycle in " -"a :keyword:`finally` clause. This is also important if the cycle detector " -"was disabled when Python was compiled or using :func:`gc.disable`. For " -"example::" +"local variables) can be made deterministic by removing the cycle in a :" +"keyword:`finally` clause. This is also important if the cycle detector was " +"disabled when Python was compiled or using :func:`gc.disable`. For example::" msgstr "" -#: ../../library/inspect.rst:1409 +#: ../../library/inspect.rst:1412 msgid "" "def handle_stackframe_without_leak():\n" " frame = inspect.currentframe()\n" @@ -1980,31 +1980,31 @@ msgid "" " del frame" msgstr "" -#: ../../library/inspect.rst:1416 +#: ../../library/inspect.rst:1419 msgid "" "If you want to keep the frame around (for example to print a traceback " "later), you can also break reference cycles by using the :meth:`frame.clear` " "method." msgstr "" -#: ../../library/inspect.rst:1420 +#: ../../library/inspect.rst:1423 msgid "" "The optional *context* argument supported by most of these functions " "specifies the number of lines of context to return, which are centered " "around the current line." msgstr "" -#: ../../library/inspect.rst:1427 +#: ../../library/inspect.rst:1430 msgid "" "Get information about a frame or traceback object. A :class:`Traceback` " "object is returned." msgstr "" -#: ../../library/inspect.rst:1430 +#: ../../library/inspect.rst:1433 msgid "A :class:`Traceback` object is returned instead of a named tuple." msgstr "" -#: ../../library/inspect.rst:1435 +#: ../../library/inspect.rst:1438 msgid "" "Get a list of :class:`FrameInfo` objects for a frame and all outer frames. " "These frames represent the calls that lead to the creation of *frame*. The " @@ -2012,19 +2012,19 @@ msgid "" "represents the outermost call on *frame*'s stack." msgstr "" -#: ../../library/inspect.rst:1440 ../../library/inspect.rst:1455 -#: ../../library/inspect.rst:1481 ../../library/inspect.rst:1496 +#: ../../library/inspect.rst:1443 ../../library/inspect.rst:1458 +#: ../../library/inspect.rst:1484 ../../library/inspect.rst:1499 msgid "" "A list of :term:`named tuples ` ``FrameInfo(frame, filename, " "lineno, function, code_context, index)`` is returned." msgstr "" -#: ../../library/inspect.rst:1445 ../../library/inspect.rst:1460 -#: ../../library/inspect.rst:1486 ../../library/inspect.rst:1501 +#: ../../library/inspect.rst:1448 ../../library/inspect.rst:1463 +#: ../../library/inspect.rst:1489 ../../library/inspect.rst:1504 msgid "A list of :class:`FrameInfo` objects is returned." msgstr "回傳一個 :class:`FrameInfo` 物件串列。" -#: ../../library/inspect.rst:1450 +#: ../../library/inspect.rst:1453 msgid "" "Get a list of :class:`FrameInfo` objects for a traceback's frame and all " "inner frames. These frames represent calls made as a consequence of " @@ -2032,11 +2032,11 @@ msgid "" "represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1465 +#: ../../library/inspect.rst:1468 msgid "Return the frame object for the caller's stack frame." msgstr "" -#: ../../library/inspect.rst:1469 +#: ../../library/inspect.rst:1472 msgid "" "This function relies on Python stack frame support in the interpreter, which " "isn't guaranteed to exist in all implementations of Python. If running in " @@ -2044,14 +2044,14 @@ msgid "" "``None``." msgstr "" -#: ../../library/inspect.rst:1477 +#: ../../library/inspect.rst:1480 msgid "" "Return a list of :class:`FrameInfo` objects for the caller's stack. The " "first entry in the returned list represents the caller; the last entry " "represents the outermost call on the stack." msgstr "" -#: ../../library/inspect.rst:1491 +#: ../../library/inspect.rst:1494 msgid "" "Return a list of :class:`FrameInfo` objects for the stack between the " "current frame and the frame in which an exception currently being handled " @@ -2059,32 +2059,32 @@ msgid "" "entry represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1505 +#: ../../library/inspect.rst:1508 msgid "Fetching attributes statically" msgstr "" -#: ../../library/inspect.rst:1507 +#: ../../library/inspect.rst:1510 msgid "" "Both :func:`getattr` and :func:`hasattr` can trigger code execution when " "fetching or checking for the existence of attributes. Descriptors, like " -"properties, will be invoked and :meth:`~object.__getattr__` " -"and :meth:`~object.__getattribute__` may be called." +"properties, will be invoked and :meth:`~object.__getattr__` and :meth:" +"`~object.__getattribute__` may be called." msgstr "" -#: ../../library/inspect.rst:1513 +#: ../../library/inspect.rst:1516 msgid "" "For cases where you want passive introspection, like documentation tools, " -"this can be inconvenient. :func:`getattr_static` has the same signature " -"as :func:`getattr` but avoids executing code when it fetches attributes." +"this can be inconvenient. :func:`getattr_static` has the same signature as :" +"func:`getattr` but avoids executing code when it fetches attributes." msgstr "" -#: ../../library/inspect.rst:1519 +#: ../../library/inspect.rst:1522 msgid "" "Retrieve attributes without triggering dynamic lookup via the descriptor " "protocol, :meth:`~object.__getattr__` or :meth:`~object.__getattribute__`." msgstr "" -#: ../../library/inspect.rst:1523 +#: ../../library/inspect.rst:1526 msgid "" "Note: this function may not be able to retrieve all attributes that getattr " "can fetch (like dynamically created attributes) and may find attributes that " @@ -2092,27 +2092,27 @@ msgid "" "return descriptors objects instead of instance members." msgstr "" -#: ../../library/inspect.rst:1529 +#: ../../library/inspect.rst:1532 msgid "" "If the instance :attr:`~object.__dict__` is shadowed by another member (for " "example a property) then this function will be unable to find instance " "members." msgstr "" -#: ../../library/inspect.rst:1535 +#: ../../library/inspect.rst:1538 msgid "" ":func:`getattr_static` does not resolve descriptors, for example slot " "descriptors or getset descriptors on objects implemented in C. The " "descriptor object is returned instead of the underlying attribute." msgstr "" -#: ../../library/inspect.rst:1539 +#: ../../library/inspect.rst:1542 msgid "" "You can handle these with code like the following. Note that for arbitrary " "getset descriptors invoking these may trigger code execution::" msgstr "" -#: ../../library/inspect.rst:1543 +#: ../../library/inspect.rst:1546 msgid "" "# example code for resolving the builtin descriptor types\n" "class _foo:\n" @@ -2135,11 +2135,11 @@ msgid "" " pass" msgstr "" -#: ../../library/inspect.rst:1565 +#: ../../library/inspect.rst:1568 msgid "Current State of Generators, Coroutines, and Asynchronous Generators" msgstr "" -#: ../../library/inspect.rst:1567 +#: ../../library/inspect.rst:1570 msgid "" "When implementing coroutine schedulers and for other advanced uses of " "generators, it is useful to determine whether a generator is currently " @@ -2148,32 +2148,32 @@ msgid "" "generator to be determined easily." msgstr "" -#: ../../library/inspect.rst:1575 +#: ../../library/inspect.rst:1578 msgid "Get current state of a generator-iterator." msgstr "" -#: ../../library/inspect.rst:1577 ../../library/inspect.rst:1593 -#: ../../library/inspect.rst:1610 +#: ../../library/inspect.rst:1580 ../../library/inspect.rst:1596 +#: ../../library/inspect.rst:1613 msgid "Possible states are:" msgstr "" -#: ../../library/inspect.rst:1579 +#: ../../library/inspect.rst:1582 msgid "GEN_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1580 +#: ../../library/inspect.rst:1583 msgid "GEN_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1581 +#: ../../library/inspect.rst:1584 msgid "GEN_SUSPENDED: Currently suspended at a yield expression." msgstr "" -#: ../../library/inspect.rst:1582 +#: ../../library/inspect.rst:1585 msgid "GEN_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1588 +#: ../../library/inspect.rst:1591 msgid "" "Get current state of a coroutine object. The function is intended to be " "used with coroutine objects created by :keyword:`async def` functions, but " @@ -2181,55 +2181,55 @@ msgid "" "``cr_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1595 +#: ../../library/inspect.rst:1598 msgid "CORO_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1596 +#: ../../library/inspect.rst:1599 msgid "CORO_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1597 +#: ../../library/inspect.rst:1600 msgid "CORO_SUSPENDED: Currently suspended at an await expression." msgstr "" -#: ../../library/inspect.rst:1598 +#: ../../library/inspect.rst:1601 msgid "CORO_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1604 +#: ../../library/inspect.rst:1607 msgid "" "Get current state of an asynchronous generator object. The function is " -"intended to be used with asynchronous iterator objects created " -"by :keyword:`async def` functions which use the :keyword:`yield` statement, " -"but will accept any asynchronous generator-like object that has " -"``ag_running`` and ``ag_frame`` attributes." +"intended to be used with asynchronous iterator objects created by :keyword:" +"`async def` functions which use the :keyword:`yield` statement, but will " +"accept any asynchronous generator-like object that has ``ag_running`` and " +"``ag_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1612 +#: ../../library/inspect.rst:1615 msgid "AGEN_CREATED: Waiting to start execution." msgstr "AGEN_CREATED: 等待開始執行。" -#: ../../library/inspect.rst:1613 +#: ../../library/inspect.rst:1616 msgid "AGEN_RUNNING: Currently being executed by the interpreter." msgstr "AGEN_RUNNING: 目前正在被直譯器執行。" -#: ../../library/inspect.rst:1614 +#: ../../library/inspect.rst:1617 msgid "AGEN_SUSPENDED: Currently suspended at a yield expression." msgstr "AGEN_SUSPENDED: 目前於 yield 運算式暫停。" -#: ../../library/inspect.rst:1615 +#: ../../library/inspect.rst:1618 msgid "AGEN_CLOSED: Execution has completed." msgstr "AGEN_CLOSED: 執行已完成。" -#: ../../library/inspect.rst:1619 +#: ../../library/inspect.rst:1622 msgid "" "The current internal state of the generator can also be queried. This is " "mostly useful for testing purposes, to ensure that internal state is being " "updated as expected:" msgstr "" -#: ../../library/inspect.rst:1625 +#: ../../library/inspect.rst:1628 msgid "" "Get the mapping of live local variables in *generator* to their current " "values. A dictionary is returned that maps from variable names to values. " @@ -2237,14 +2237,14 @@ msgid "" "generator, and all the same caveats apply." msgstr "" -#: ../../library/inspect.rst:1630 +#: ../../library/inspect.rst:1633 msgid "" "If *generator* is a :term:`generator` with no currently associated frame, " "then an empty dictionary is returned. :exc:`TypeError` is raised if " "*generator* is not a Python generator object." msgstr "" -#: ../../library/inspect.rst:1636 +#: ../../library/inspect.rst:1639 msgid "" "This function relies on the generator exposing a Python stack frame for " "introspection, which isn't guaranteed to be the case in all implementations " @@ -2252,90 +2252,90 @@ msgid "" "dictionary." msgstr "" -#: ../../library/inspect.rst:1645 +#: ../../library/inspect.rst:1648 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for coroutine objects created by :keyword:`async def` functions." msgstr "" -#: ../../library/inspect.rst:1652 +#: ../../library/inspect.rst:1655 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for asynchronous generator objects created by :keyword:`async def` functions " "which use the :keyword:`yield` statement." msgstr "" -#: ../../library/inspect.rst:1662 +#: ../../library/inspect.rst:1665 msgid "Code Objects Bit Flags" msgstr "" -#: ../../library/inspect.rst:1664 +#: ../../library/inspect.rst:1667 msgid "" "Python code objects have a :attr:`~codeobject.co_flags` attribute, which is " "a bitmap of the following flags:" msgstr "" -#: ../../library/inspect.rst:1669 +#: ../../library/inspect.rst:1672 msgid "The code object is optimized, using fast locals." msgstr "" -#: ../../library/inspect.rst:1673 +#: ../../library/inspect.rst:1676 msgid "" "If set, a new dict will be created for the frame's :attr:`~frame.f_locals` " "when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1678 +#: ../../library/inspect.rst:1681 msgid "The code object has a variable positional parameter (``*args``-like)." msgstr "" -#: ../../library/inspect.rst:1682 +#: ../../library/inspect.rst:1685 msgid "The code object has a variable keyword parameter (``**kwargs``-like)." msgstr "" -#: ../../library/inspect.rst:1686 +#: ../../library/inspect.rst:1689 msgid "The flag is set when the code object is a nested function." msgstr "" -#: ../../library/inspect.rst:1690 +#: ../../library/inspect.rst:1693 msgid "" "The flag is set when the code object is a generator function, i.e. a " "generator object is returned when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1695 +#: ../../library/inspect.rst:1698 msgid "" "The flag is set when the code object is a coroutine function. When the code " "object is executed it returns a coroutine object. See :pep:`492` for more " "details." msgstr "" -#: ../../library/inspect.rst:1703 +#: ../../library/inspect.rst:1706 msgid "" "The flag is used to transform generators into generator-based coroutines. " "Generator objects with this flag can be used in ``await`` expression, and " "can ``yield from`` coroutine objects. See :pep:`492` for more details." msgstr "" -#: ../../library/inspect.rst:1712 +#: ../../library/inspect.rst:1715 msgid "" "The flag is set when the code object is an asynchronous generator function. " "When the code object is executed it returns an asynchronous generator " "object. See :pep:`525` for more details." msgstr "" -#: ../../library/inspect.rst:1720 +#: ../../library/inspect.rst:1723 msgid "" "The flag is set when there is a docstring for the code object in the source " "code. If set, it will be the first item in :attr:`~codeobject.co_consts`." msgstr "" -#: ../../library/inspect.rst:1728 +#: ../../library/inspect.rst:1731 msgid "" "The flag is set when the code object is a function defined in class scope." msgstr "" -#: ../../library/inspect.rst:1734 +#: ../../library/inspect.rst:1737 msgid "" "The flags are specific to CPython, and may not be defined in other Python " "implementations. Furthermore, the flags are an implementation detail, and " @@ -2343,39 +2343,39 @@ msgid "" "use public APIs from the :mod:`inspect` module for any introspection needs." msgstr "" -#: ../../library/inspect.rst:1742 +#: ../../library/inspect.rst:1745 msgid "Buffer flags" msgstr "" -#: ../../library/inspect.rst:1746 +#: ../../library/inspect.rst:1749 msgid "" "This is an :class:`enum.IntFlag` that represents the flags that can be " -"passed to the :meth:`~object.__buffer__` method of objects implementing " -"the :ref:`buffer protocol `." +"passed to the :meth:`~object.__buffer__` method of objects implementing the :" +"ref:`buffer protocol `." msgstr "" -#: ../../library/inspect.rst:1750 +#: ../../library/inspect.rst:1753 msgid "The meaning of the flags is explained at :ref:`buffer-request-types`." msgstr "" -#: ../../library/inspect.rst:1777 +#: ../../library/inspect.rst:1780 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/inspect.rst:1779 +#: ../../library/inspect.rst:1782 msgid "" "The :mod:`inspect` module also provides a basic introspection capability " "from the command line." msgstr "" -#: ../../library/inspect.rst:1784 +#: ../../library/inspect.rst:1787 msgid "" "By default, accepts the name of a module and prints the source of that " "module. A class or function within the module can be printed instead by " "appended a colon and the qualified name of the target object." msgstr "" -#: ../../library/inspect.rst:1790 +#: ../../library/inspect.rst:1793 msgid "" "Print information about the specified object rather than the source code" msgstr "" diff --git a/library/locale.po b/library/locale.po index 03f8db33d22..511cf776da2 100644 --- a/library/locale.po +++ b/library/locale.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -53,27 +53,33 @@ msgstr "" msgid "" "If *locale* is given and not ``None``, :func:`setlocale` modifies the locale " "setting for the *category*. The available categories are listed in the data " -"description below. *locale* may be a string, or an iterable of two strings " -"(language code and encoding). If it's an iterable, it's converted to a " -"locale name using the locale aliasing engine. An empty string specifies the " -"user's default settings. If the modification of the locale fails, the " -"exception :exc:`Error` is raised. If successful, the new locale setting is " -"returned." +"description below. *locale* may be a :ref:`string `, or a pair, " +"language code and encoding. An empty string specifies the user's default " +"settings. If the modification of the locale fails, the exception :exc:" +"`Error` is raised. If successful, the new locale setting is returned." +msgstr "" + +#: ../../library/locale.rst:42 +msgid "" +"If *locale* is a pair, it is converted to a locale name using the locale " +"aliasing engine. The language code has the same format as a :ref:`locale " +"name `, but without encoding and ``@``-modifier. The language " +"code and encoding can be ``None``." msgstr "" -#: ../../library/locale.rst:43 +#: ../../library/locale.rst:48 msgid "" "If *locale* is omitted or ``None``, the current setting for *category* is " "returned." msgstr "" -#: ../../library/locale.rst:46 +#: ../../library/locale.rst:51 msgid "" ":func:`setlocale` is not thread-safe on most systems. Applications typically " "start with a call of ::" msgstr "" -#: ../../library/locale.rst:49 +#: ../../library/locale.rst:54 msgid "" "import locale\n" "locale.setlocale(locale.LC_ALL, '')" @@ -81,7 +87,7 @@ msgstr "" "import locale\n" "locale.setlocale(locale.LC_ALL, '')" -#: ../../library/locale.rst:52 +#: ../../library/locale.rst:57 msgid "" "This sets the locale for all categories to the user's default setting " "(typically specified in the :envvar:`LANG` environment variable). If the " @@ -89,246 +95,246 @@ msgid "" "problems." msgstr "" -#: ../../library/locale.rst:59 +#: ../../library/locale.rst:64 msgid "" "Returns the database of the local conventions as a dictionary. This " "dictionary has the following strings as keys:" msgstr "" -#: ../../library/locale.rst:65 +#: ../../library/locale.rst:70 msgid "Category" msgstr "分類" -#: ../../library/locale.rst:65 +#: ../../library/locale.rst:70 msgid "Key" msgstr "" -#: ../../library/locale.rst:65 +#: ../../library/locale.rst:70 msgid "Meaning" msgstr "含義" -#: ../../library/locale.rst:67 +#: ../../library/locale.rst:72 msgid ":const:`LC_NUMERIC`" msgstr ":const:`LC_NUMERIC`" -#: ../../library/locale.rst:67 +#: ../../library/locale.rst:72 msgid "``'decimal_point'``" msgstr "``'decimal_point'``" -#: ../../library/locale.rst:67 +#: ../../library/locale.rst:72 msgid "Decimal point character." msgstr "" -#: ../../library/locale.rst:69 +#: ../../library/locale.rst:74 msgid "``'grouping'``" msgstr "``'grouping'``" -#: ../../library/locale.rst:69 +#: ../../library/locale.rst:74 msgid "" "Sequence of numbers specifying which relative positions the " -"``'thousands_sep'`` is expected. If the sequence is terminated " -"with :const:`CHAR_MAX`, no further grouping is performed. If the sequence " -"terminates with a ``0``, the last group size is repeatedly used." +"``'thousands_sep'`` is expected. If the sequence is terminated with :const:" +"`CHAR_MAX`, no further grouping is performed. If the sequence terminates " +"with a ``0``, the last group size is repeatedly used." msgstr "" -#: ../../library/locale.rst:80 +#: ../../library/locale.rst:85 msgid "``'thousands_sep'``" msgstr "``'thousands_sep'``" -#: ../../library/locale.rst:80 +#: ../../library/locale.rst:85 msgid "Character used between groups." msgstr "" -#: ../../library/locale.rst:82 +#: ../../library/locale.rst:87 msgid ":const:`LC_MONETARY`" msgstr ":const:`LC_MONETARY`" -#: ../../library/locale.rst:82 +#: ../../library/locale.rst:87 msgid "``'int_curr_symbol'``" msgstr "``'int_curr_symbol'``" -#: ../../library/locale.rst:82 +#: ../../library/locale.rst:87 msgid "International currency symbol." msgstr "" -#: ../../library/locale.rst:84 +#: ../../library/locale.rst:89 msgid "``'currency_symbol'``" msgstr "``'currency_symbol'``" -#: ../../library/locale.rst:84 +#: ../../library/locale.rst:89 msgid "Local currency symbol." msgstr "" -#: ../../library/locale.rst:86 +#: ../../library/locale.rst:91 msgid "``'p_cs_precedes/n_cs_precedes'``" msgstr "``'p_cs_precedes/n_cs_precedes'``" -#: ../../library/locale.rst:86 +#: ../../library/locale.rst:91 msgid "" "Whether the currency symbol precedes the value (for positive resp. negative " "values)." msgstr "" -#: ../../library/locale.rst:91 +#: ../../library/locale.rst:96 msgid "``'p_sep_by_space/n_sep_by_space'``" msgstr "``'p_sep_by_space/n_sep_by_space'``" -#: ../../library/locale.rst:91 +#: ../../library/locale.rst:96 msgid "" "Whether the currency symbol is separated from the value by a space (for " "positive resp. negative values)." msgstr "" -#: ../../library/locale.rst:96 +#: ../../library/locale.rst:101 msgid "``'mon_decimal_point'``" msgstr "``'mon_decimal_point'``" -#: ../../library/locale.rst:96 +#: ../../library/locale.rst:101 msgid "Decimal point used for monetary values." msgstr "" -#: ../../library/locale.rst:99 +#: ../../library/locale.rst:104 msgid "``'frac_digits'``" msgstr "``'frac_digits'``" -#: ../../library/locale.rst:99 +#: ../../library/locale.rst:104 msgid "" "Number of fractional digits used in local formatting of monetary values." msgstr "" -#: ../../library/locale.rst:103 +#: ../../library/locale.rst:108 msgid "``'int_frac_digits'``" msgstr "``'int_frac_digits'``" -#: ../../library/locale.rst:103 +#: ../../library/locale.rst:108 msgid "" "Number of fractional digits used in international formatting of monetary " "values." msgstr "" -#: ../../library/locale.rst:107 +#: ../../library/locale.rst:112 msgid "``'mon_thousands_sep'``" msgstr "``'mon_thousands_sep'``" -#: ../../library/locale.rst:107 +#: ../../library/locale.rst:112 msgid "Group separator used for monetary values." msgstr "" -#: ../../library/locale.rst:110 +#: ../../library/locale.rst:115 msgid "``'mon_grouping'``" msgstr "``'mon_grouping'``" -#: ../../library/locale.rst:110 +#: ../../library/locale.rst:115 msgid "Equivalent to ``'grouping'``, used for monetary values." msgstr "" -#: ../../library/locale.rst:113 +#: ../../library/locale.rst:118 msgid "``'positive_sign'``" msgstr "``'positive_sign'``" -#: ../../library/locale.rst:113 +#: ../../library/locale.rst:118 msgid "Symbol used to annotate a positive monetary value." msgstr "" -#: ../../library/locale.rst:116 +#: ../../library/locale.rst:121 msgid "``'negative_sign'``" msgstr "``'negative_sign'``" -#: ../../library/locale.rst:116 +#: ../../library/locale.rst:121 msgid "Symbol used to annotate a negative monetary value." msgstr "" -#: ../../library/locale.rst:119 +#: ../../library/locale.rst:124 msgid "``'p_sign_posn/n_sign_posn'``" msgstr "``'p_sign_posn/n_sign_posn'``" -#: ../../library/locale.rst:119 +#: ../../library/locale.rst:124 msgid "" "The position of the sign (for positive resp. negative values), see below." msgstr "" -#: ../../library/locale.rst:124 +#: ../../library/locale.rst:129 msgid "" "All numeric values can be set to :const:`CHAR_MAX` to indicate that there is " "no value specified in this locale." msgstr "" -#: ../../library/locale.rst:127 +#: ../../library/locale.rst:132 msgid "" "The possible values for ``'p_sign_posn'`` and ``'n_sign_posn'`` are given " "below." msgstr "" -#: ../../library/locale.rst:130 +#: ../../library/locale.rst:135 msgid "Value" msgstr "" -#: ../../library/locale.rst:130 +#: ../../library/locale.rst:135 msgid "Explanation" msgstr "" -#: ../../library/locale.rst:132 +#: ../../library/locale.rst:137 msgid "``0``" msgstr "``0``" -#: ../../library/locale.rst:132 +#: ../../library/locale.rst:137 msgid "Currency and value are surrounded by parentheses." msgstr "" -#: ../../library/locale.rst:135 +#: ../../library/locale.rst:140 msgid "``1``" msgstr "``1``" -#: ../../library/locale.rst:135 +#: ../../library/locale.rst:140 msgid "The sign should precede the value and currency symbol." msgstr "" -#: ../../library/locale.rst:138 +#: ../../library/locale.rst:143 msgid "``2``" msgstr "``2``" -#: ../../library/locale.rst:138 +#: ../../library/locale.rst:143 msgid "The sign should follow the value and currency symbol." msgstr "" -#: ../../library/locale.rst:141 +#: ../../library/locale.rst:146 msgid "``3``" msgstr "``3``" -#: ../../library/locale.rst:141 +#: ../../library/locale.rst:146 msgid "The sign should immediately precede the value." msgstr "" -#: ../../library/locale.rst:144 +#: ../../library/locale.rst:149 msgid "``4``" msgstr "``4``" -#: ../../library/locale.rst:144 +#: ../../library/locale.rst:149 msgid "The sign should immediately follow the value." msgstr "" -#: ../../library/locale.rst:147 +#: ../../library/locale.rst:152 msgid "``CHAR_MAX``" msgstr "``CHAR_MAX``" -#: ../../library/locale.rst:147 +#: ../../library/locale.rst:152 msgid "Nothing is specified in this locale." msgstr "" -#: ../../library/locale.rst:150 +#: ../../library/locale.rst:155 msgid "" "The function temporarily sets the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` " "locale or the ``LC_MONETARY`` locale if locales are different and numeric or " "monetary strings are non-ASCII. This temporary change affects other threads." msgstr "" -#: ../../library/locale.rst:154 +#: ../../library/locale.rst:159 msgid "" "The function now temporarily sets the ``LC_CTYPE`` locale to the " "``LC_NUMERIC`` locale in some cases." msgstr "" -#: ../../library/locale.rst:161 +#: ../../library/locale.rst:166 msgid "" "Return some locale-specific information as a string. This function is not " "available on all systems, and the set of possible options might also vary " @@ -336,106 +342,106 @@ msgid "" "symbolic constants are available in the locale module." msgstr "" -#: ../../library/locale.rst:166 +#: ../../library/locale.rst:171 msgid "" "The :func:`nl_langinfo` function accepts one of the following keys. Most " "descriptions are taken from the corresponding description in the GNU C " "library." msgstr "" -#: ../../library/locale.rst:172 +#: ../../library/locale.rst:177 msgid "" "Get a string with the name of the character encoding used in the selected " "locale." msgstr "" -#: ../../library/locale.rst:177 +#: ../../library/locale.rst:182 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent date and time in a locale-specific way." msgstr "" -#: ../../library/locale.rst:182 +#: ../../library/locale.rst:187 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent a date in a locale-specific way." msgstr "" -#: ../../library/locale.rst:187 +#: ../../library/locale.rst:192 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent a time in a locale-specific way." msgstr "" -#: ../../library/locale.rst:192 +#: ../../library/locale.rst:197 msgid "" "Get a format string for :func:`time.strftime` to represent time in the am/pm " "format." msgstr "" -#: ../../library/locale.rst:203 +#: ../../library/locale.rst:208 msgid "Get the name of the n-th day of the week." msgstr "" -#: ../../library/locale.rst:207 +#: ../../library/locale.rst:212 msgid "" "This follows the US convention of :const:`DAY_1` being Sunday, not the " "international convention (ISO 8601) that Monday is the first day of the week." msgstr "" -#: ../../library/locale.rst:219 +#: ../../library/locale.rst:224 msgid "Get the abbreviated name of the n-th day of the week." msgstr "" -#: ../../library/locale.rst:234 +#: ../../library/locale.rst:239 msgid "Get the name of the n-th month." msgstr "" -#: ../../library/locale.rst:249 +#: ../../library/locale.rst:254 msgid "Get the abbreviated name of the n-th month." msgstr "" -#: ../../library/locale.rst:253 +#: ../../library/locale.rst:258 msgid "Get the radix character (decimal dot, decimal comma, etc.)." msgstr "" -#: ../../library/locale.rst:257 +#: ../../library/locale.rst:262 msgid "Get the separator character for thousands (groups of three digits)." msgstr "" -#: ../../library/locale.rst:261 +#: ../../library/locale.rst:266 msgid "" "Get a regular expression that can be used with the regex function to " "recognize a positive response to a yes/no question." msgstr "" -#: ../../library/locale.rst:266 +#: ../../library/locale.rst:271 msgid "" "Get a regular expression that can be used with the ``regex(3)`` function to " "recognize a negative response to a yes/no question." msgstr "" -#: ../../library/locale.rst:271 +#: ../../library/locale.rst:276 msgid "" "The regular expressions for :const:`YESEXPR` and :const:`NOEXPR` use syntax " "suitable for the ``regex`` function from the C library, which might differ " "from the syntax used in :mod:`re`." msgstr "" -#: ../../library/locale.rst:278 +#: ../../library/locale.rst:283 msgid "" "Get the currency symbol, preceded by \"-\" if the symbol should appear " "before the value, \"+\" if the symbol should appear after the value, or \"." "\" if the symbol should replace the radix character." msgstr "" -#: ../../library/locale.rst:284 +#: ../../library/locale.rst:289 msgid "" "Get a string which describes how years are counted and displayed for each " "era in a locale." msgstr "" -#: ../../library/locale.rst:287 +#: ../../library/locale.rst:292 msgid "" "Most locales do not define this value. An example of a locale which does " "define this value is the Japanese one. In Japan, the traditional " @@ -443,42 +449,42 @@ msgid "" "then-emperor's reign." msgstr "" -#: ../../library/locale.rst:292 +#: ../../library/locale.rst:297 msgid "" "Normally it should not be necessary to use this value directly. Specifying " "the ``E`` modifier in their format strings causes the :func:`time.strftime` " "function to use this information. The format of the returned string is " "specified in *The Open Group Base Specifications Issue 8*, paragraph " -"`7.3.5.2 LC_TIME C-Language Access `_." +"`7.3.5.2 LC_TIME C-Language Access `_." msgstr "" -#: ../../library/locale.rst:301 +#: ../../library/locale.rst:306 msgid "" "Get a format string for :func:`time.strftime` to represent date and time in " "a locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:306 +#: ../../library/locale.rst:311 msgid "" "Get a format string for :func:`time.strftime` to represent a date in a " "locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:311 +#: ../../library/locale.rst:316 msgid "" "Get a format string for :func:`time.strftime` to represent a time in a " "locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:316 +#: ../../library/locale.rst:321 msgid "" "Get a string consisting of up to 100 semicolon-separated symbols used to " "represent the values 0 to 99 in a locale-specific way. In most locales this " "is an empty string." msgstr "" -#: ../../library/locale.rst:320 +#: ../../library/locale.rst:325 msgid "" "The function temporarily sets the ``LC_CTYPE`` locale to the locale of the " "category that determines the requested value (``LC_TIME``, ``LC_NUMERIC``, " @@ -486,18 +492,18 @@ msgid "" "resulting string is non-ASCII. This temporary change affects other threads." msgstr "" -#: ../../library/locale.rst:326 +#: ../../library/locale.rst:331 msgid "" "The function now temporarily sets the ``LC_CTYPE`` locale in some cases." msgstr "" -#: ../../library/locale.rst:332 +#: ../../library/locale.rst:337 msgid "" "Tries to determine the default locale settings and returns them as a tuple " "of the form ``(language code, encoding)``." msgstr "" -#: ../../library/locale.rst:335 +#: ../../library/locale.rst:340 msgid "" "According to POSIX, a program which has not called ``setlocale(LC_ALL, '')`` " "runs using the portable ``'C'`` locale. Calling ``setlocale(LC_ALL, '')`` " @@ -506,7 +512,7 @@ msgid "" "emulate the behavior in the way described above." msgstr "" -#: ../../library/locale.rst:341 +#: ../../library/locale.rst:346 msgid "" "To maintain compatibility with other platforms, not only the :envvar:`LANG` " "variable is tested, but a list of variables given as envvars parameter. The " @@ -516,22 +522,23 @@ msgid "" "``'LC_CTYPE'``, ``'LANG'`` and ``'LANGUAGE'``, in that order." msgstr "" -#: ../../library/locale.rst:348 ../../library/locale.rst:361 +#: ../../library/locale.rst:353 ../../library/locale.rst:368 msgid "" -"Except for the code ``'C'``, the language code corresponds to :rfc:`1766`. " -"*language code* and *encoding* may be ``None`` if their values cannot be " -"determined." +"The language code has the same format as a :ref:`locale name `, " +"but without encoding and ``@``-modifier. The language code and encoding may " +"be ``None`` if their values cannot be determined. The \"C\" locale is " +"represented as ``(None, None)``." msgstr "" -#: ../../library/locale.rst:357 +#: ../../library/locale.rst:364 msgid "" -"Returns the current setting for the given locale category as sequence " -"containing *language code*, *encoding*. *category* may be one of " -"the :const:`!LC_\\*` values except :const:`LC_ALL`. It defaults " -"to :const:`LC_CTYPE`." +"Returns the current setting for the given locale category as a tuple " +"containing the language code and encoding. *category* may be one of the :" +"const:`!LC_\\*` values except :const:`LC_ALL`. It defaults to :const:" +"`LC_CTYPE`." msgstr "" -#: ../../library/locale.rst:368 +#: ../../library/locale.rst:377 msgid "" "Return the :term:`locale encoding` used for text data, according to user " "preferences. User preferences are expressed differently on different " @@ -539,72 +546,72 @@ msgid "" "this function only returns a guess." msgstr "" -#: ../../library/locale.rst:373 +#: ../../library/locale.rst:382 msgid "" "On some systems, it is necessary to invoke :func:`setlocale` to obtain the " "user preferences, so this function is not thread-safe. If invoking setlocale " "is not necessary or desired, *do_setlocale* should be set to ``False``." msgstr "" -#: ../../library/locale.rst:377 +#: ../../library/locale.rst:386 msgid "" "On Android or if the :ref:`Python UTF-8 Mode ` is enabled, always " "return ``'utf-8'``, the :term:`locale encoding` and the *do_setlocale* " "argument are ignored." msgstr "" -#: ../../library/locale.rst:381 ../../library/locale.rst:399 +#: ../../library/locale.rst:390 ../../library/locale.rst:408 msgid "" "The :ref:`Python preinitialization ` configures the LC_CTYPE " "locale. See also the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../library/locale.rst:384 +#: ../../library/locale.rst:393 msgid "" -"The function now always returns ``\"utf-8\"`` on Android or if " -"the :ref:`Python UTF-8 Mode ` is enabled." +"The function now always returns ``\"utf-8\"`` on Android or if the :ref:" +"`Python UTF-8 Mode ` is enabled." msgstr "" -#: ../../library/locale.rst:391 +#: ../../library/locale.rst:400 msgid "Get the current :term:`locale encoding`:" msgstr "" -#: ../../library/locale.rst:393 +#: ../../library/locale.rst:402 msgid "On Android and VxWorks, return ``\"utf-8\"``." msgstr "" -#: ../../library/locale.rst:394 +#: ../../library/locale.rst:403 msgid "" "On Unix, return the encoding of the current :data:`LC_CTYPE` locale. Return " "``\"utf-8\"`` if ``nl_langinfo(CODESET)`` returns an empty string: for " "example, if the current LC_CTYPE locale is not supported." msgstr "" -#: ../../library/locale.rst:397 +#: ../../library/locale.rst:406 msgid "On Windows, return the ANSI code page." msgstr "" -#: ../../library/locale.rst:402 +#: ../../library/locale.rst:411 msgid "" "This function is similar to :func:`getpreferredencoding(False) " "` except this function ignores the :ref:`Python UTF-8 " "Mode `." msgstr "" -#: ../../library/locale.rst:411 +#: ../../library/locale.rst:420 msgid "" "Returns a normalized locale code for the given locale name. The returned " "locale code is formatted for use with :func:`setlocale`. If normalization " "fails, the original name is returned unchanged." msgstr "" -#: ../../library/locale.rst:415 +#: ../../library/locale.rst:424 msgid "" "If the given encoding is not known, the function defaults to the default " "encoding for the locale code just like :func:`setlocale`." msgstr "" -#: ../../library/locale.rst:421 +#: ../../library/locale.rst:430 msgid "" "Compares two strings according to the current :const:`LC_COLLATE` setting. " "As any other compare function, returns a negative, or a positive value, or " @@ -612,7 +619,7 @@ msgid "" "is equal to it." msgstr "" -#: ../../library/locale.rst:429 +#: ../../library/locale.rst:438 msgid "" "Transforms a string to one that can be used in locale-aware comparisons. " "For example, ``strxfrm(s1) < strxfrm(s2)`` is equivalent to ``strcoll(s1, " @@ -620,7 +627,7 @@ msgid "" "repeatedly, e.g. when collating a sequence of strings." msgstr "" -#: ../../library/locale.rst:438 +#: ../../library/locale.rst:447 msgid "" "Formats a number *val* according to the current :const:`LC_NUMERIC` setting. " "The format follows the conventions of the ``%`` operator. For floating-" @@ -628,29 +635,29 @@ msgid "" "is ``True``, also takes the grouping into account." msgstr "" -#: ../../library/locale.rst:443 +#: ../../library/locale.rst:452 msgid "" "If *monetary* is true, the conversion uses monetary thousands separator and " "grouping strings." msgstr "" -#: ../../library/locale.rst:446 +#: ../../library/locale.rst:455 msgid "" "Processes formatting specifiers as in ``format % val``, but takes the " "current locale settings into account." msgstr "" -#: ../../library/locale.rst:449 +#: ../../library/locale.rst:458 msgid "The *monetary* keyword parameter was added." msgstr "" -#: ../../library/locale.rst:455 +#: ../../library/locale.rst:464 msgid "" "Formats a number *val* according to the current :const:`LC_MONETARY` " "settings." msgstr "" -#: ../../library/locale.rst:457 +#: ../../library/locale.rst:466 msgid "" "The returned string includes the currency symbol if *symbol* is true, which " "is the default. If *grouping* is ``True`` (which is not the default), " @@ -658,43 +665,43 @@ msgid "" "not the default), the international currency symbol is used." msgstr "" -#: ../../library/locale.rst:464 +#: ../../library/locale.rst:473 msgid "" "This function will not work with the 'C' locale, so you have to set a locale " "via :func:`setlocale` first." msgstr "" -#: ../../library/locale.rst:470 +#: ../../library/locale.rst:479 msgid "" "Formats a floating-point number using the same format as the built-in " "function ``str(float)``, but takes the decimal point into account." msgstr "" -#: ../../library/locale.rst:476 +#: ../../library/locale.rst:485 msgid "" -"Converts a string into a normalized number string, following " -"the :const:`LC_NUMERIC` settings." +"Converts a string into a normalized number string, following the :const:" +"`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:484 +#: ../../library/locale.rst:493 msgid "" -"Converts a normalized number string into a formatted string following " -"the :const:`LC_NUMERIC` settings." +"Converts a normalized number string into a formatted string following the :" +"const:`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:492 +#: ../../library/locale.rst:501 msgid "" "Converts a string to a number, following the :const:`LC_NUMERIC` settings, " "by calling *func* on the result of calling :func:`delocalize` on *string*." msgstr "" -#: ../../library/locale.rst:498 +#: ../../library/locale.rst:507 msgid "" "Converts a string to an integer, following the :const:`LC_NUMERIC` " "conventions." msgstr "" -#: ../../library/locale.rst:503 +#: ../../library/locale.rst:512 msgid "" "Locale category for the character type functions. Most importantly, this " "category defines the text encoding, i.e. how bytes are interpreted as " @@ -704,32 +711,32 @@ msgid "" "SSH connections." msgstr "" -#: ../../library/locale.rst:510 +#: ../../library/locale.rst:519 msgid "" "Python doesn't internally use locale-dependent character transformation " "functions from ``ctype.h``. Instead, an internal ``pyctype.h`` provides " "locale-independent equivalents like :c:macro:`!Py_TOLOWER`." msgstr "" -#: ../../library/locale.rst:517 +#: ../../library/locale.rst:526 msgid "" -"Locale category for sorting strings. The functions :func:`strcoll` " -"and :func:`strxfrm` of the :mod:`locale` module are affected." +"Locale category for sorting strings. The functions :func:`strcoll` and :" +"func:`strxfrm` of the :mod:`locale` module are affected." msgstr "" -#: ../../library/locale.rst:523 +#: ../../library/locale.rst:532 msgid "" -"Locale category for the formatting of time. The " -"function :func:`time.strftime` follows these conventions." +"Locale category for the formatting of time. The function :func:`time." +"strftime` follows these conventions." msgstr "" -#: ../../library/locale.rst:529 +#: ../../library/locale.rst:538 msgid "" "Locale category for formatting of monetary values. The available options " "are available from the :func:`localeconv` function." msgstr "" -#: ../../library/locale.rst:535 +#: ../../library/locale.rst:544 msgid "" "Locale category for message display. Python currently does not support " "application specific locale-aware messages. Messages displayed by the " @@ -737,21 +744,21 @@ msgid "" "affected by this category." msgstr "" -#: ../../library/locale.rst:540 +#: ../../library/locale.rst:549 msgid "" "This value may not be available on operating systems not conforming to the " "POSIX standard, most notably Windows." msgstr "" -#: ../../library/locale.rst:546 +#: ../../library/locale.rst:555 msgid "" -"Locale category for formatting numbers. The " -"functions :func:`format_string`, :func:`atoi`, :func:`atof` and :func:`.str` " -"of the :mod:`locale` module are affected by that category. All other " -"numeric formatting operations are not affected." +"Locale category for formatting numbers. The functions :func:" +"`format_string`, :func:`atoi`, :func:`atof` and :func:`.str` of the :mod:" +"`locale` module are affected by that category. All other numeric formatting " +"operations are not affected." msgstr "" -#: ../../library/locale.rst:554 +#: ../../library/locale.rst:563 msgid "" "Combination of all locale settings. If this flag is used when the locale is " "changed, setting the locale for all categories is attempted. If that fails " @@ -761,17 +768,17 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:563 +#: ../../library/locale.rst:572 msgid "" -"This is a symbolic constant used for different values returned " -"by :func:`localeconv`." +"This is a symbolic constant used for different values returned by :func:" +"`localeconv`." msgstr "" -#: ../../library/locale.rst:567 +#: ../../library/locale.rst:576 msgid "Example::" msgstr "範例: ::" -#: ../../library/locale.rst:569 +#: ../../library/locale.rst:578 msgid "" ">>> import locale\n" ">>> loc = locale.getlocale() # get current locale\n" @@ -784,11 +791,11 @@ msgid "" ">>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale" msgstr "" -#: ../../library/locale.rst:580 +#: ../../library/locale.rst:589 msgid "Background, details, hints, tips and caveats" msgstr "" -#: ../../library/locale.rst:582 +#: ../../library/locale.rst:591 msgid "" "The C standard defines the locale as a program-wide property that may be " "relatively expensive to change. On top of that, some implementations are " @@ -796,17 +803,17 @@ msgid "" "This makes the locale somewhat painful to use correctly." msgstr "" -#: ../../library/locale.rst:587 +#: ../../library/locale.rst:596 msgid "" "Initially, when a program is started, the locale is the ``C`` locale, no " -"matter what the user's preferred locale is. There is one exception: " -"the :data:`LC_CTYPE` category is changed at startup to set the current " -"locale encoding to the user's preferred locale encoding. The program must " +"matter what the user's preferred locale is. There is one exception: the :" +"data:`LC_CTYPE` category is changed at startup to set the current locale " +"encoding to the user's preferred locale encoding. The program must " "explicitly say that it wants the user's preferred locale settings for other " "categories by calling ``setlocale(LC_ALL, '')``." msgstr "" -#: ../../library/locale.rst:594 +#: ../../library/locale.rst:603 msgid "" "It is generally a bad idea to call :func:`setlocale` in some library " "routine, since as a side effect it affects the entire program. Saving and " @@ -814,7 +821,7 @@ msgid "" "that happen to run before the settings have been restored." msgstr "" -#: ../../library/locale.rst:599 +#: ../../library/locale.rst:608 msgid "" "If, when coding a module for general use, you need a locale independent " "version of an operation that is affected by the locale (such as certain " @@ -825,14 +832,14 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:606 +#: ../../library/locale.rst:615 msgid "" "The only way to perform numeric operations according to the locale is to use " -"the special functions defined by this " -"module: :func:`atof`, :func:`atoi`, :func:`format_string`, :func:`.str`." +"the special functions defined by this module: :func:`atof`, :func:`atoi`, :" +"func:`format_string`, :func:`.str`." msgstr "" -#: ../../library/locale.rst:610 +#: ../../library/locale.rst:619 msgid "" "There is no way to perform case conversions and character classifications " "according to the locale. For (Unicode) text strings these are done " @@ -843,11 +850,85 @@ msgid "" "whitespace." msgstr "" -#: ../../library/locale.rst:621 +#: ../../library/locale.rst:630 +msgid "Locale names" +msgstr "" + +#: ../../library/locale.rst:632 +msgid "" +"The format of the locale name is platform dependent, and the set of " +"supported locales can depend on the system configuration." +msgstr "" + +#: ../../library/locale.rst:635 +msgid "On Posix platforms, it usually has the format [1]_:" +msgstr "" + +#: ../../library/locale.rst:640 +msgid "" +"where *language* is a two- or three-letter language code from `ISO 639`_, " +"*territory* is a two-letter country or region code from `ISO 3166`_, " +"*charset* is a locale encoding, and *modifier* is a script name, a language " +"subtag, a sort order identifier, or other locale modifier (for example, " +"\"latin\", \"valencia\", \"stroke\" and \"euro\")." +msgstr "" + +#: ../../library/locale.rst:646 +msgid "" +"On Windows, several formats are supported. [2]_ [3]_ A subset of `IETF BCP " +"47`_ tags:" +msgstr "" + +#: ../../library/locale.rst:653 +msgid "" +"where *language* and *territory* have the same meaning as in Posix, *script* " +"is a four-letter script code from `ISO 15924`_, and *modifier* is a language " +"subtag, a sort order identifier or custom modifier (for example, " +"\"valencia\", \"stroke\" or \"x-python\"). Both hyphen (``'-'``) and " +"underscore (``'_'``) separators are supported. Only UTF-8 encoding is " +"allowed for BCP 47 tags." +msgstr "" + +#: ../../library/locale.rst:660 +msgid "Windows also supports locale names in the format:" +msgstr "" + +#: ../../library/locale.rst:665 +msgid "" +"where *language* and *territory* are full names, such as \"English\" and " +"\"United States\", and *charset* is either a code page number (for example, " +"\"1252\") or UTF-8. Only the underscore separator is supported in this " +"format." +msgstr "" + +#: ../../library/locale.rst:670 +msgid "The \"C\" locale is supported on all platforms." +msgstr "" + +#: ../../library/locale.rst:677 +msgid "" +"`IEEE Std 1003.1-2024; 8.2 Internationalization Variables `_" +msgstr "" + +#: ../../library/locale.rst:678 +msgid "" +"`UCRT Locale names, Languages, and Country/Region strings `_" +msgstr "" + +#: ../../library/locale.rst:679 +msgid "" +"`Locale Names `_" +msgstr "" + +#: ../../library/locale.rst:685 msgid "For extension writers and programs that embed Python" msgstr "" -#: ../../library/locale.rst:623 +#: ../../library/locale.rst:687 msgid "" "Extension modules should never call :func:`setlocale`, except to find out " "what the current locale is. But since the return value can only be used " @@ -855,32 +936,32 @@ msgid "" "whether or not the locale is ``C``)." msgstr "" -#: ../../library/locale.rst:628 +#: ../../library/locale.rst:692 msgid "" "When Python code uses the :mod:`locale` module to change the locale, this " "also affects the embedding application. If the embedding application " "doesn't want this to happen, it should remove the :mod:`!_locale` extension " -"module (which does all the work) from the table of built-in modules in " -"the :file:`config.c` file, and make sure that the :mod:`!_locale` module is " -"not accessible as a shared library." +"module (which does all the work) from the table of built-in modules in the :" +"file:`config.c` file, and make sure that the :mod:`!_locale` module is not " +"accessible as a shared library." msgstr "" -#: ../../library/locale.rst:639 +#: ../../library/locale.rst:703 msgid "Access to message catalogs" msgstr "" -#: ../../library/locale.rst:648 +#: ../../library/locale.rst:712 msgid "" "The locale module exposes the C library's gettext interface on systems that " -"provide this interface. It consists of the " -"functions :func:`gettext`, :func:`dgettext`, :func:`dcgettext`, :func:`textdomain`, :func:`bindtextdomain`, " +"provide this interface. It consists of the functions :func:`gettext`, :func:" +"`dgettext`, :func:`dcgettext`, :func:`textdomain`, :func:`bindtextdomain`, " "and :func:`bind_textdomain_codeset`. These are similar to the same " "functions in the :mod:`gettext` module, but use the C library's binary " "format for message catalogs, and the C library's search algorithms for " "locating message catalogs." msgstr "" -#: ../../library/locale.rst:655 +#: ../../library/locale.rst:719 msgid "" "Python applications should normally find no need to invoke these functions, " "and should use :mod:`gettext` instead. A known exception to this rule are " diff --git a/library/logging.po b/library/logging.po index 03043fcd0e2..93e609050e5 100644 --- a/library/logging.po +++ b/library/logging.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-17 00:13+0000\n" "PO-Revision-Date: 2024-03-28 22:40+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -206,15 +206,15 @@ msgid "" "are all descendants of ``foo``. In addition, all loggers are descendants of " "the root logger. The logger name hierarchy is analogous to the Python " "package hierarchy, and identical to it if you organise your loggers on a per-" -"module basis using the recommended construction " -"``logging.getLogger(__name__)``. That's because in a module, ``__name__`` " -"is the module's name in the Python package namespace." +"module basis using the recommended construction ``logging." +"getLogger(__name__)``. That's because in a module, ``__name__`` is the " +"module's name in the Python package namespace." msgstr "" #: ../../library/logging.rst:123 msgid "" -"This is the logger's name, and is the value that was passed " -"to :func:`getLogger` to obtain the logger." +"This is the logger's name, and is the value that was passed to :func:" +"`getLogger` to obtain the logger." msgstr "" #: ../../library/logging.rst:126 ../../library/logging.rst:186 @@ -362,29 +362,27 @@ msgstr "" #: ../../library/logging.rst:223 msgid "" "Indicates if a message of severity *level* would be processed by this " -"logger. This method checks first the module-level level set by " -"``logging.disable(level)`` and then the logger's effective level as " -"determined by :meth:`getEffectiveLevel`." +"logger. This method checks first the module-level level set by ``logging." +"disable(level)`` and then the logger's effective level as determined by :" +"meth:`getEffectiveLevel`." msgstr "" #: ../../library/logging.rst:231 msgid "" -"Indicates the effective level for this logger. If a value other " -"than :const:`NOTSET` has been set using :meth:`setLevel`, it is returned. " -"Otherwise, the hierarchy is traversed towards the root until a value other " -"than :const:`NOTSET` is found, and that value is returned. The value " -"returned is an integer, typically one " -"of :const:`logging.DEBUG`, :const:`logging.INFO` etc." +"Indicates the effective level for this logger. If a value other than :const:" +"`NOTSET` has been set using :meth:`setLevel`, it is returned. Otherwise, the " +"hierarchy is traversed towards the root until a value other than :const:" +"`NOTSET` is found, and that value is returned. The value returned is an " +"integer, typically one of :const:`logging.DEBUG`, :const:`logging.INFO` etc." msgstr "" #: ../../library/logging.rst:241 msgid "" "Returns a logger which is a descendant to this logger, as determined by the " "suffix. Thus, ``logging.getLogger('abc').getChild('def.ghi')`` would return " -"the same logger as would be returned by " -"``logging.getLogger('abc.def.ghi')``. This is a convenience method, useful " -"when the parent logger is named using e.g. ``__name__`` rather than a " -"literal string." +"the same logger as would be returned by ``logging.getLogger('abc.def." +"ghi')``. This is a convenience method, useful when the parent logger is " +"named using e.g. ``__name__`` rather than a literal string." msgstr "" #: ../../library/logging.rst:252 @@ -455,19 +453,19 @@ msgstr "" msgid "" "The third optional keyword argument is *stacklevel*, which defaults to " "``1``. If greater than 1, the corresponding number of stack frames are " -"skipped when computing the line number and function name set in " -"the :class:`LogRecord` created for the logging event. This can be used in " -"logging helpers so that the function name, filename and line number recorded " -"are not the information for the helper function/method, but rather its " -"caller. The name of this parameter mirrors the equivalent one in " -"the :mod:`warnings` module." +"skipped when computing the line number and function name set in the :class:" +"`LogRecord` created for the logging event. This can be used in logging " +"helpers so that the function name, filename and line number recorded are not " +"the information for the helper function/method, but rather its caller. The " +"name of this parameter mirrors the equivalent one in the :mod:`warnings` " +"module." msgstr "" #: ../../library/logging.rst:306 msgid "" "The fourth keyword argument is *extra* which can be used to pass a " -"dictionary which is used to populate the :attr:`~object.__dict__` of " -"the :class:`LogRecord` created for the logging event with user-defined " +"dictionary which is used to populate the :attr:`~object.__dict__` of the :" +"class:`LogRecord` created for the logging event with user-defined " "attributes. These custom attributes can then be used as you like. For " "example, they could be incorporated into logged messages. For example::" msgstr "" @@ -506,12 +504,12 @@ msgstr "" #: ../../library/logging.rst:329 msgid "" "If you choose to use these attributes in logged messages, you need to " -"exercise some care. In the above example, for instance, " -"the :class:`Formatter` has been set up with a format string which expects " -"'clientip' and 'user' in the attribute dictionary of the :class:`LogRecord`. " -"If these are missing, the message will not be logged because a string " -"formatting exception will occur. So in this case, you always need to pass " -"the *extra* dictionary with these keys." +"exercise some care. In the above example, for instance, the :class:" +"`Formatter` has been set up with a format string which expects 'clientip' " +"and 'user' in the attribute dictionary of the :class:`LogRecord`. If these " +"are missing, the message will not be logged because a string formatting " +"exception will occur. So in this case, you always need to pass the *extra* " +"dictionary with these keys." msgstr "" #: ../../library/logging.rst:336 @@ -555,8 +553,8 @@ msgid "" "Logs a message with level :const:`WARNING` on this logger. The arguments are " "interpreted as for :meth:`debug`." msgstr "" -"在此記錄器上記錄一條層級為 :const:`WARNING` 的訊息。這些引數被直譯的方式" -"與 :meth:`debug` 相同。" +"在此記錄器上記錄一條層級為 :const:`WARNING` 的訊息。這些引數被直譯的方式與 :" +"meth:`debug` 相同。" #: ../../library/logging.rst:368 msgid "" @@ -637,8 +635,8 @@ msgid "" "Handles a record by passing it to all handlers associated with this logger " "and its ancestors (until a false value of *propagate* is found). This method " "is used for unpickled records received from a socket, as well as those " -"created locally. Logger-level filtering is applied " -"using :meth:`~Logger.filter`." +"created locally. Logger-level filtering is applied using :meth:`~Logger." +"filter`." msgstr "" #: ../../library/logging.rst:450 @@ -752,17 +750,17 @@ msgstr "" #: ../../library/logging.rst:518 msgid "" -"Handlers have the following attributes and methods. Note " -"that :class:`Handler` is never instantiated directly; this class acts as a " -"base for more useful subclasses. However, the :meth:`!__init__` method in " -"subclasses needs to call :meth:`Handler.__init__`." +"Handlers have the following attributes and methods. Note that :class:" +"`Handler` is never instantiated directly; this class acts as a base for more " +"useful subclasses. However, the :meth:`!__init__` method in subclasses needs " +"to call :meth:`Handler.__init__`." msgstr "" #: ../../library/logging.rst:527 msgid "" "Initializes the :class:`Handler` instance by setting its level, setting the " -"list of filters to the empty list and creating a lock " -"(using :meth:`createLock`) for serializing access to an I/O mechanism." +"list of filters to the empty list and creating a lock (using :meth:" +"`createLock`) for serializing access to an I/O mechanism." msgstr "" #: ../../library/logging.rst:534 @@ -794,8 +792,8 @@ msgstr "" #: ../../library/logging.rst:565 msgid "" -"Sets the formatter for this handler to *fmt*. The *fmt* argument must be " -"a :class:`Formatter` instance or ``None``." +"Sets the formatter for this handler to *fmt*. The *fmt* argument must be a :" +"class:`Formatter` instance or ``None``." msgstr "" #: ../../library/logging.rst:571 @@ -844,15 +842,14 @@ msgstr "" #: ../../library/logging.rst:613 msgid "" "This method should be called from handlers when an exception is encountered " -"during an :meth:`emit` call. If the module-level " -"attribute :data:`raiseExceptions` is ``False``, exceptions get silently " -"ignored. This is what is mostly wanted for a logging system - most users " -"will not care about errors in the logging system, they are more interested " -"in application errors. You could, however, replace this with a custom " -"handler if you wish. The specified record is the one which was being " -"processed when the exception occurred. (The default value " -"of :data:`raiseExceptions` is ``True``, as that is more useful during " -"development)." +"during an :meth:`emit` call. If the module-level attribute :data:" +"`raiseExceptions` is ``False``, exceptions get silently ignored. This is " +"what is mostly wanted for a logging system - most users will not care about " +"errors in the logging system, they are more interested in application " +"errors. You could, however, replace this with a custom handler if you wish. " +"The specified record is the one which was being processed when the exception " +"occurred. (The default value of :data:`raiseExceptions` is ``True``, as that " +"is more useful during development)." msgstr "" #: ../../library/logging.rst:626 @@ -864,8 +861,8 @@ msgstr "" #: ../../library/logging.rst:632 msgid "" "Do whatever it takes to actually log the specified logging record. This " -"version is intended to be implemented by subclasses and so raises " -"a :exc:`NotImplementedError`." +"version is intended to be implemented by subclasses and so raises a :exc:" +"`NotImplementedError`." msgstr "" #: ../../library/logging.rst:636 @@ -915,66 +912,65 @@ msgstr "" #: ../../library/logging.rst:666 msgid "" "A format string in the given *style* for the logged output as a whole. The " -"possible mapping keys are drawn from the :class:`LogRecord` " -"object's :ref:`logrecord-attributes`. If not specified, ``'%(message)s'`` is " -"used, which is just the logged message." +"possible mapping keys are drawn from the :class:`LogRecord` object's :ref:" +"`logrecord-attributes`. If not specified, ``'%(message)s'`` is used, which " +"is just the logged message." msgstr "" #: ../../library/logging.rst:674 msgid "" -"A format string in the given *style* for the date/time portion of the logged " -"output. If not specified, the default described in :meth:`formatTime` is " -"used." +"A format string for the date/time portion of the logged output. If not " +"specified, the default described in :meth:`formatTime` is used." msgstr "" -#: ../../library/logging.rst:679 +#: ../../library/logging.rst:678 msgid "" "Can be one of ``'%'``, ``'{'`` or ``'$'`` and determines how the format " "string will be merged with its data: using one of :ref:`old-string-" "formatting` (``%``), :meth:`str.format` (``{``) or :class:`string.Template` " -"(``$``). This only applies to *fmt* and *datefmt* (e.g. ``'%(message)s'`` " -"versus ``'{message}'``), not to the actual log messages passed to the " -"logging methods. However, there are :ref:`other ways ` to " -"use ``{``- and ``$``-formatting for log messages." +"(``$``). This only applies to *fmt* (e.g. ``'%(message)s'`` versus " +"``'{message}'``), not to the actual log messages passed to the logging " +"methods. However, there are :ref:`other ways ` to use " +"``{``- and ``$``-formatting for log messages." msgstr "" -#: ../../library/logging.rst:689 +#: ../../library/logging.rst:688 msgid "" "If ``True`` (the default), incorrect or mismatched *fmt* and *style* will " -"raise a :exc:`ValueError`; for example, ``logging.Formatter('%(asctime)s - %" -"(message)s', style='{')``." +"raise a :exc:`ValueError`; for example, ``logging.Formatter('%(asctime)s - " +"%(message)s', style='{')``." msgstr "" -#: ../../library/logging.rst:694 +#: ../../library/logging.rst:693 msgid "" "A dictionary with default values to use in custom fields. For example, " "``logging.Formatter('%(ip)s %(message)s', defaults={\"ip\": None})``" msgstr "" -#: ../../library/logging.rst:699 +#: ../../library/logging.rst:698 msgid "Added the *style* parameter." msgstr "新增 *style* 參數。" -#: ../../library/logging.rst:702 +#: ../../library/logging.rst:701 msgid "Added the *validate* parameter." msgstr "新增 *validate* 參數。" -#: ../../library/logging.rst:705 +#: ../../library/logging.rst:704 msgid "Added the *defaults* parameter." msgstr "新增 *defaults* 參數。" -#: ../../library/logging.rst:711 +#: ../../library/logging.rst:710 msgid "" "The record's attribute dictionary is used as the operand to a string " "formatting operation. Returns the resulting string. Before formatting the " "dictionary, a couple of preparatory steps are carried out. The *message* " "attribute of the record is computed using *msg* % *args*. If the formatting " "string contains ``'(asctime)'``, :meth:`formatTime` is called to format the " -"event time. If there is exception information, it is formatted " -"using :meth:`formatException` and appended to the message. Note that the " -"formatted exception information is cached in attribute *exc_text*. This is " -"useful because the exception information can be pickled and sent across the " -"wire, but you should be careful if you have more than one :class:`Formatter` " +"event time. If there is exception information, it is formatted using :meth:" +"`formatException` and appended to the message. Note that the formatted " +"exception information is cached in attribute *exc_text*. This is useful " +"because the exception information can be pickled and sent across the wire, " +"but you should be careful if you have more than one :class:`Formatter` " "subclass which customizes the formatting of exception information. In this " "case, you will have to clear the cached value (by setting the *exc_text* " "attribute to ``None``) after a formatter has done its formatting, so that " @@ -982,26 +978,26 @@ msgid "" "recalculates it afresh." msgstr "" -#: ../../library/logging.rst:727 +#: ../../library/logging.rst:726 msgid "" "If stack information is available, it's appended after the exception " "information, using :meth:`formatStack` to transform it if necessary." msgstr "" -#: ../../library/logging.rst:733 +#: ../../library/logging.rst:732 msgid "" "This method should be called from :meth:`format` by a formatter which wants " "to make use of a formatted time. This method can be overridden in formatters " "to provide for any specific requirement, but the basic behavior is as " -"follows: if *datefmt* (a string) is specified, it is used " -"with :func:`time.strftime` to format the creation time of the record. " -"Otherwise, the format '%Y-%m-%d %H:%M:%S,uuu' is used, where the uuu part is " -"a millisecond value and the other letters are as per " -"the :func:`time.strftime` documentation. An example time in this format is " -"``2003-01-23 00:29:50,411``. The resulting string is returned." +"follows: if *datefmt* (a string) is specified, it is used with :func:`time." +"strftime` to format the creation time of the record. Otherwise, the format " +"'%Y-%m-%d %H:%M:%S,uuu' is used, where the uuu part is a millisecond value " +"and the other letters are as per the :func:`time.strftime` documentation. " +"An example time in this format is ``2003-01-23 00:29:50,411``. The " +"resulting string is returned." msgstr "" -#: ../../library/logging.rst:743 +#: ../../library/logging.rst:742 msgid "" "This function uses a user-configurable function to convert the creation time " "to a tuple. By default, :func:`time.localtime` is used; to change this for a " @@ -1011,7 +1007,7 @@ msgid "" "be shown in GMT, set the ``converter`` attribute in the ``Formatter`` class." msgstr "" -#: ../../library/logging.rst:751 +#: ../../library/logging.rst:750 msgid "" "Previously, the default format was hard-coded as in this example: " "``2010-09-06 22:38:15,292`` where the part before the comma is handled by a " @@ -1026,11 +1022,11 @@ msgid "" "the millisecond value)." msgstr "" -#: ../../library/logging.rst:764 +#: ../../library/logging.rst:763 msgid "The ``default_msec_format`` can be ``None``." msgstr "" -#: ../../library/logging.rst:769 +#: ../../library/logging.rst:768 msgid "" "Formats the specified exception information (a standard exception tuple as " "returned by :func:`sys.exc_info`) as a string. This default implementation " @@ -1038,14 +1034,14 @@ msgid "" "returned." msgstr "" -#: ../../library/logging.rst:776 +#: ../../library/logging.rst:775 msgid "" -"Formats the specified stack information (a string as returned " -"by :func:`traceback.print_stack`, but with the last newline removed) as a " -"string. This default implementation just returns the input value." +"Formats the specified stack information (a string as returned by :func:" +"`traceback.print_stack`, but with the last newline removed) as a string. " +"This default implementation just returns the input value." msgstr "" -#: ../../library/logging.rst:782 +#: ../../library/logging.rst:781 msgid "" "A base formatter class suitable for subclassing when you want to format a " "number of records. You can pass a :class:`Formatter` instance which you want " @@ -1054,7 +1050,7 @@ msgid "" "used as the line formatter." msgstr "" -#: ../../library/logging.rst:790 +#: ../../library/logging.rst:789 msgid "" "Return a header for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " @@ -1062,14 +1058,14 @@ msgid "" "separator line." msgstr "" -#: ../../library/logging.rst:797 +#: ../../library/logging.rst:796 msgid "" "Return a footer for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " "specific behaviour, e.g. to show the count of records or a separator line." msgstr "" -#: ../../library/logging.rst:804 +#: ../../library/logging.rst:803 msgid "" "Return formatted text for a list of *records*. The base implementation just " "returns the empty string if there are no records; otherwise, it returns the " @@ -1077,11 +1073,11 @@ msgid "" "and the footer." msgstr "" -#: ../../library/logging.rst:812 +#: ../../library/logging.rst:811 msgid "Filter Objects" msgstr "" -#: ../../library/logging.rst:814 +#: ../../library/logging.rst:813 msgid "" "``Filters`` can be used by ``Handlers`` and ``Loggers`` for more " "sophisticated filtering than is provided by levels. The base filter class " @@ -1091,7 +1087,7 @@ msgid "" "If initialized with the empty string, all events are passed." msgstr "" -#: ../../library/logging.rst:824 +#: ../../library/logging.rst:823 msgid "" "Returns an instance of the :class:`Filter` class. If *name* is specified, it " "names a logger which, together with its children, will have its events " @@ -1099,7 +1095,7 @@ msgid "" "event." msgstr "" -#: ../../library/logging.rst:831 +#: ../../library/logging.rst:830 msgid "" "Is the specified record to be logged? Returns false for no, true for yes. " "Filters can either modify log records in-place or return a completely " @@ -1107,7 +1103,7 @@ msgid "" "future processing of the event." msgstr "" -#: ../../library/logging.rst:836 +#: ../../library/logging.rst:835 msgid "" "Note that filters attached to handlers are consulted before an event is " "emitted by the handler, whereas filters attached to loggers are consulted " @@ -1117,24 +1113,24 @@ msgid "" "setting, unless the filter has also been applied to those descendant loggers." msgstr "" -#: ../../library/logging.rst:843 +#: ../../library/logging.rst:842 msgid "" "You don't actually need to subclass ``Filter``: you can pass any instance " "which has a ``filter`` method with the same semantics." msgstr "" -#: ../../library/logging.rst:846 +#: ../../library/logging.rst:845 msgid "" "You don't need to create specialized ``Filter`` classes, or use other " "classes with a ``filter`` method: you can use a function (or other callable) " "as a filter. The filtering logic will check to see if the filter object has " -"a ``filter`` attribute: if it does, it's assumed to be a ``Filter`` and " -"its :meth:`~Filter.filter` method is called. Otherwise, it's assumed to be a " +"a ``filter`` attribute: if it does, it's assumed to be a ``Filter`` and its :" +"meth:`~Filter.filter` method is called. Otherwise, it's assumed to be a " "callable and called with the record as the single parameter. The returned " "value should conform to that returned by :meth:`~Filter.filter`." msgstr "" -#: ../../library/logging.rst:856 +#: ../../library/logging.rst:855 msgid "" "You can now return a :class:`LogRecord` instance from filters to replace the " "log record rather than modifying it in place. This allows filters attached " @@ -1142,7 +1138,7 @@ msgid "" "having side effects on other handlers." msgstr "" -#: ../../library/logging.rst:862 +#: ../../library/logging.rst:861 msgid "" "Although filters are used primarily to filter records based on more " "sophisticated criteria than levels, they get to see every record which is " @@ -1154,29 +1150,29 @@ msgid "" "contextual information into logs (see :ref:`filters-contextual`)." msgstr "" -#: ../../library/logging.rst:875 +#: ../../library/logging.rst:874 msgid "LogRecord Objects" msgstr "LogRecord 物件" -#: ../../library/logging.rst:877 +#: ../../library/logging.rst:876 msgid "" -":class:`LogRecord` instances are created automatically by " -"the :class:`Logger` every time something is logged, and can be created " -"manually via :func:`makeLogRecord` (for example, from a pickled event " -"received over the wire)." +":class:`LogRecord` instances are created automatically by the :class:" +"`Logger` every time something is logged, and can be created manually via :" +"func:`makeLogRecord` (for example, from a pickled event received over the " +"wire)." msgstr "" -#: ../../library/logging.rst:885 +#: ../../library/logging.rst:884 msgid "Contains all the information pertinent to the event being logged." msgstr "" -#: ../../library/logging.rst:887 +#: ../../library/logging.rst:886 msgid "" "The primary information is passed in *msg* and *args*, which are combined " "using ``msg % args`` to create the :attr:`!message` attribute of the record." msgstr "" -#: ../../library/logging.rst:891 +#: ../../library/logging.rst:890 msgid "" "The name of the logger used to log the event represented by this :class:`!" "LogRecord`. Note that the logger name in the :class:`!LogRecord` will always " @@ -1184,55 +1180,54 @@ msgid "" "different (ancestor) logger." msgstr "" -#: ../../library/logging.rst:899 +#: ../../library/logging.rst:898 msgid "" "The :ref:`numeric level ` of the logging event (such as ``10`` for " "``DEBUG``, ``20`` for ``INFO``, etc). Note that this is converted to *two* " -"attributes of the LogRecord: :attr:`!levelno` for the numeric value " -"and :attr:`!levelname` for the corresponding level name." +"attributes of the LogRecord: :attr:`!levelno` for the numeric value and :" +"attr:`!levelname` for the corresponding level name." msgstr "" -#: ../../library/logging.rst:906 +#: ../../library/logging.rst:905 msgid "" "The full string path of the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:910 +#: ../../library/logging.rst:909 msgid "The line number in the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:914 +#: ../../library/logging.rst:913 msgid "" "The event description message, which can be a %-format string with " "placeholders for variable data, or an arbitrary object (see :ref:`arbitrary-" "object-messages`)." msgstr "" -#: ../../library/logging.rst:919 +#: ../../library/logging.rst:918 msgid "" "Variable data to merge into the *msg* argument to obtain the event " "description." msgstr "" -#: ../../library/logging.rst:923 +#: ../../library/logging.rst:922 msgid "" -"An exception tuple with the current exception information, as returned " -"by :func:`sys.exc_info`, or ``None`` if no exception information is " -"available." +"An exception tuple with the current exception information, as returned by :" +"func:`sys.exc_info`, or ``None`` if no exception information is available." msgstr "" -#: ../../library/logging.rst:928 +#: ../../library/logging.rst:927 msgid "" "The name of the function or method from which the logging call was invoked." msgstr "" -#: ../../library/logging.rst:932 +#: ../../library/logging.rst:931 msgid "" "A text string representing stack information from the base of the stack in " "the current thread, up to the logging call." msgstr "" -#: ../../library/logging.rst:939 +#: ../../library/logging.rst:938 msgid "" "Returns the message for this :class:`LogRecord` instance after merging any " "user-supplied arguments with the message. If the user-supplied message " @@ -1241,7 +1236,7 @@ msgid "" "whose ``__str__`` method can return the actual format string to be used." msgstr "" -#: ../../library/logging.rst:946 +#: ../../library/logging.rst:945 msgid "" "The creation of a :class:`LogRecord` has been made more configurable by " "providing a factory which is used to create the record. The factory can be " @@ -1249,13 +1244,13 @@ msgid "" "this for the factory's signature)." msgstr "" -#: ../../library/logging.rst:952 +#: ../../library/logging.rst:951 msgid "" -"This functionality can be used to inject your own values into " -"a :class:`LogRecord` at creation time. You can use the following pattern::" +"This functionality can be used to inject your own values into a :class:" +"`LogRecord` at creation time. You can use the following pattern::" msgstr "" -#: ../../library/logging.rst:955 +#: ../../library/logging.rst:954 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -1275,18 +1270,18 @@ msgstr "" "\n" "logging.setLogRecordFactory(record_factory)" -#: ../../library/logging.rst:964 +#: ../../library/logging.rst:963 msgid "" "With this pattern, multiple factories could be chained, and as long as they " "don't overwrite each other's attributes or unintentionally overwrite the " "standard attributes listed above, there should be no surprises." msgstr "" -#: ../../library/logging.rst:973 +#: ../../library/logging.rst:972 msgid "LogRecord attributes" msgstr "LogRecord 屬性" -#: ../../library/logging.rst:975 +#: ../../library/logging.rst:974 msgid "" "The LogRecord has a number of attributes, most of which are derived from the " "parameters to the constructor. (Note that the names do not always correspond " @@ -1297,15 +1292,15 @@ msgid "" "style format string." msgstr "" -#: ../../library/logging.rst:983 +#: ../../library/logging.rst:982 msgid "" "If you are using {}-formatting (:func:`str.format`), you can use ``{attrname}" -"`` as the placeholder in the format string. If you are using $-formatting " -"(:class:`string.Template`), use the form ``${attrname}``. In both cases, of " +"`` as the placeholder in the format string. If you are using $-formatting (:" +"class:`string.Template`), use the form ``${attrname}``. In both cases, of " "course, replace ``attrname`` with the actual attribute name you want to use." msgstr "" -#: ../../library/logging.rst:989 +#: ../../library/logging.rst:988 msgid "" "In the case of {}-formatting, you can specify formatting flags by placing " "them after the attribute name, separated from it with a colon. For example: " @@ -1314,319 +1309,318 @@ msgid "" "on the options available to you." msgstr "" -#: ../../library/logging.rst:996 +#: ../../library/logging.rst:995 msgid "Attribute name" msgstr "屬性名稱" -#: ../../library/logging.rst:996 ../../library/logging.rst:1366 +#: ../../library/logging.rst:995 ../../library/logging.rst:1365 msgid "Format" msgstr "格式" -#: ../../library/logging.rst:996 ../../library/logging.rst:1366 +#: ../../library/logging.rst:995 ../../library/logging.rst:1365 msgid "Description" msgstr "描述" -#: ../../library/logging.rst:0 ../../library/logging.rst:998 +#: ../../library/logging.rst:0 ../../library/logging.rst:997 msgid "args" msgstr "args" -#: ../../library/logging.rst:998 ../../library/logging.rst:1012 -#: ../../library/logging.rst:1040 ../../library/logging.rst:1058 +#: ../../library/logging.rst:997 ../../library/logging.rst:1011 +#: ../../library/logging.rst:1039 ../../library/logging.rst:1057 msgid "You shouldn't need to format this yourself." msgstr "你不應該需要自己格式化它。" -#: ../../library/logging.rst:998 +#: ../../library/logging.rst:997 msgid "" "The tuple of arguments merged into ``msg`` to produce ``message``, or a dict " "whose values are used for the merge (when there is only one argument, and it " "is a dictionary)." msgstr "" -#: ../../library/logging.rst:1003 +#: ../../library/logging.rst:1002 msgid "asctime" msgstr "asctime" -#: ../../library/logging.rst:1003 +#: ../../library/logging.rst:1002 msgid "``%(asctime)s``" msgstr "``%(asctime)s``" -#: ../../library/logging.rst:1003 +#: ../../library/logging.rst:1002 msgid "" "Human-readable time when the :class:`LogRecord` was created. By default " "this is of the form '2003-07-08 16:49:45,896' (the numbers after the comma " "are millisecond portion of the time)." msgstr "" -#: ../../library/logging.rst:1009 +#: ../../library/logging.rst:1008 msgid "created" msgstr "created" -#: ../../library/logging.rst:1009 +#: ../../library/logging.rst:1008 msgid "``%(created)f``" msgstr "``%(created)f``" -#: ../../library/logging.rst:1009 +#: ../../library/logging.rst:1008 msgid "" -"Time when the :class:`LogRecord` was created (as returned " -"by :func:`time.time_ns` / 1e9)." +"Time when the :class:`LogRecord` was created (as returned by :func:`time." +"time_ns` / 1e9)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1012 +#: ../../library/logging.rst:0 ../../library/logging.rst:1011 msgid "exc_info" msgstr "exc_info" -#: ../../library/logging.rst:1012 +#: ../../library/logging.rst:1011 msgid "" "Exception tuple (à la ``sys.exc_info``) or, if no exception has occurred, " "``None``." msgstr "" -#: ../../library/logging.rst:1015 +#: ../../library/logging.rst:1014 msgid "filename" msgstr "filename" -#: ../../library/logging.rst:1015 +#: ../../library/logging.rst:1014 msgid "``%(filename)s``" msgstr "``%(filename)s``" -#: ../../library/logging.rst:1015 +#: ../../library/logging.rst:1014 msgid "Filename portion of ``pathname``." msgstr "``pathname`` 的檔案名稱部分。" -#: ../../library/logging.rst:1017 +#: ../../library/logging.rst:1016 msgid "funcName" msgstr "funcName" -#: ../../library/logging.rst:1017 +#: ../../library/logging.rst:1016 msgid "``%(funcName)s``" msgstr "``%(funcName)s``" -#: ../../library/logging.rst:1017 +#: ../../library/logging.rst:1016 msgid "Name of function containing the logging call." msgstr "" -#: ../../library/logging.rst:1019 +#: ../../library/logging.rst:1018 msgid "levelname" msgstr "levelname" -#: ../../library/logging.rst:1019 +#: ../../library/logging.rst:1018 msgid "``%(levelname)s``" msgstr "``%(levelname)s``" -#: ../../library/logging.rst:1019 +#: ../../library/logging.rst:1018 msgid "" "Text logging level for the message (``'DEBUG'``, ``'INFO'``, ``'WARNING'``, " "``'ERROR'``, ``'CRITICAL'``)." msgstr "" -#: ../../library/logging.rst:1023 +#: ../../library/logging.rst:1022 msgid "levelno" msgstr "levelno" -#: ../../library/logging.rst:1023 +#: ../../library/logging.rst:1022 msgid "``%(levelno)s``" msgstr "``%(levelno)s``" -#: ../../library/logging.rst:1023 +#: ../../library/logging.rst:1022 msgid "" -"Numeric logging level for the message " -"(:const:`DEBUG`, :const:`INFO`, :const:`WARNING`, :const:`ERROR`, :const:`CRITICAL`)." +"Numeric logging level for the message (:const:`DEBUG`, :const:`INFO`, :const:" +"`WARNING`, :const:`ERROR`, :const:`CRITICAL`)." msgstr "" -#: ../../library/logging.rst:1028 +#: ../../library/logging.rst:1027 msgid "lineno" msgstr "lineno" -#: ../../library/logging.rst:1028 +#: ../../library/logging.rst:1027 msgid "``%(lineno)d``" msgstr "``%(lineno)d``" -#: ../../library/logging.rst:1028 +#: ../../library/logging.rst:1027 msgid "Source line number where the logging call was issued (if available)." msgstr "" -#: ../../library/logging.rst:1031 +#: ../../library/logging.rst:1030 msgid "message" msgstr "message" -#: ../../library/logging.rst:1031 +#: ../../library/logging.rst:1030 msgid "``%(message)s``" msgstr "``%(message)s``" -#: ../../library/logging.rst:1031 +#: ../../library/logging.rst:1030 msgid "" -"The logged message, computed as ``msg % args``. This is set " -"when :meth:`Formatter.format` is invoked." +"The logged message, computed as ``msg % args``. This is set when :meth:" +"`Formatter.format` is invoked." msgstr "" -#: ../../library/logging.rst:1035 +#: ../../library/logging.rst:1034 msgid "module" msgstr "模組" -#: ../../library/logging.rst:1035 +#: ../../library/logging.rst:1034 msgid "``%(module)s``" msgstr "``%(module)s``" -#: ../../library/logging.rst:1035 +#: ../../library/logging.rst:1034 msgid "Module (name portion of ``filename``)." msgstr "模組(``filename`` 的名稱部分)。" -#: ../../library/logging.rst:1037 +#: ../../library/logging.rst:1036 msgid "msecs" msgstr "msecs" -#: ../../library/logging.rst:1037 +#: ../../library/logging.rst:1036 msgid "``%(msecs)d``" msgstr "``%(msecs)d``" -#: ../../library/logging.rst:1037 +#: ../../library/logging.rst:1036 msgid "" "Millisecond portion of the time when the :class:`LogRecord` was created." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1040 +#: ../../library/logging.rst:0 ../../library/logging.rst:1039 msgid "msg" msgstr "msg" -#: ../../library/logging.rst:1040 +#: ../../library/logging.rst:1039 msgid "" "The format string passed in the original logging call. Merged with ``args`` " "to produce ``message``, or an arbitrary object (see :ref:`arbitrary-object-" "messages`)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1045 +#: ../../library/logging.rst:0 ../../library/logging.rst:1044 msgid "name" msgstr "name" -#: ../../library/logging.rst:1045 +#: ../../library/logging.rst:1044 msgid "``%(name)s``" msgstr "``%(name)s``" -#: ../../library/logging.rst:1045 +#: ../../library/logging.rst:1044 msgid "Name of the logger used to log the call." msgstr "" -#: ../../library/logging.rst:1047 +#: ../../library/logging.rst:1046 msgid "pathname" msgstr "pathname" -#: ../../library/logging.rst:1047 +#: ../../library/logging.rst:1046 msgid "``%(pathname)s``" msgstr "``%(pathname)s``" -#: ../../library/logging.rst:1047 +#: ../../library/logging.rst:1046 msgid "" "Full pathname of the source file where the logging call was issued (if " "available)." msgstr "" -#: ../../library/logging.rst:1050 +#: ../../library/logging.rst:1049 msgid "process" msgstr "process" -#: ../../library/logging.rst:1050 +#: ../../library/logging.rst:1049 msgid "``%(process)d``" msgstr "``%(process)d``" -#: ../../library/logging.rst:1050 +#: ../../library/logging.rst:1049 msgid "Process ID (if available)." msgstr "行程 ID(如果可用)。" -#: ../../library/logging.rst:1052 +#: ../../library/logging.rst:1051 msgid "processName" msgstr "processName" -#: ../../library/logging.rst:1052 +#: ../../library/logging.rst:1051 msgid "``%(processName)s``" msgstr "``%(processName)s``" -#: ../../library/logging.rst:1052 +#: ../../library/logging.rst:1051 msgid "Process name (if available)." msgstr "行程名稱(如果可用)。" -#: ../../library/logging.rst:1054 +#: ../../library/logging.rst:1053 msgid "relativeCreated" msgstr "relativeCreated" -#: ../../library/logging.rst:1054 +#: ../../library/logging.rst:1053 msgid "``%(relativeCreated)d``" msgstr "``%(relativeCreated)d``" -#: ../../library/logging.rst:1054 +#: ../../library/logging.rst:1053 msgid "" "Time in milliseconds when the LogRecord was created, relative to the time " "the logging module was loaded." msgstr "" -#: ../../library/logging.rst:1058 +#: ../../library/logging.rst:1057 msgid "stack_info" msgstr "stack_info" -#: ../../library/logging.rst:1058 +#: ../../library/logging.rst:1057 msgid "" "Stack frame information (where available) from the bottom of the stack in " "the current thread, up to and including the stack frame of the logging call " "which resulted in the creation of this record." msgstr "" -#: ../../library/logging.rst:1064 +#: ../../library/logging.rst:1063 msgid "thread" msgstr "thread" -#: ../../library/logging.rst:1064 +#: ../../library/logging.rst:1063 msgid "``%(thread)d``" msgstr "``%(thread)d``" -#: ../../library/logging.rst:1064 +#: ../../library/logging.rst:1063 msgid "Thread ID (if available)." msgstr "執行緒 ID(如果可用)。" -#: ../../library/logging.rst:1066 +#: ../../library/logging.rst:1065 msgid "threadName" msgstr "threadName" -#: ../../library/logging.rst:1066 +#: ../../library/logging.rst:1065 msgid "``%(threadName)s``" msgstr "``%(threadName)s``" -#: ../../library/logging.rst:1066 +#: ../../library/logging.rst:1065 msgid "Thread name (if available)." msgstr "" -#: ../../library/logging.rst:1068 +#: ../../library/logging.rst:1067 msgid "taskName" msgstr "taskName" -#: ../../library/logging.rst:1068 +#: ../../library/logging.rst:1067 msgid "``%(taskName)s``" msgstr "``%(taskName)s``" -#: ../../library/logging.rst:1068 +#: ../../library/logging.rst:1067 msgid ":class:`asyncio.Task` name (if available)." msgstr "" -#: ../../library/logging.rst:1071 +#: ../../library/logging.rst:1070 msgid "*processName* was added." msgstr "新增 *processName*。" -#: ../../library/logging.rst:1074 +#: ../../library/logging.rst:1073 msgid "*taskName* was added." msgstr "新增 *taskName*。" -#: ../../library/logging.rst:1080 +#: ../../library/logging.rst:1079 msgid "LoggerAdapter Objects" msgstr "LoggerAdapter 物件" -#: ../../library/logging.rst:1082 +#: ../../library/logging.rst:1081 msgid "" ":class:`LoggerAdapter` instances are used to conveniently pass contextual " -"information into logging calls. For a usage example, see the section " -"on :ref:`adding contextual information to your logging output `." +"information into logging calls. For a usage example, see the section on :ref:" +"`adding contextual information to your logging output `." msgstr "" -#: ../../library/logging.rst:1088 +#: ../../library/logging.rst:1087 msgid "" "Returns an instance of :class:`LoggerAdapter` initialized with an " "underlying :class:`Logger` instance, a dict-like object (*extra*), and a " @@ -1636,7 +1630,7 @@ msgid "" "calls and only use the one of the :class:`LoggerAdapter` instance" msgstr "" -#: ../../library/logging.rst:1097 +#: ../../library/logging.rst:1096 msgid "" "Modifies the message and/or keyword arguments passed to a logging call in " "order to insert contextual information. This implementation takes the object " @@ -1645,55 +1639,57 @@ msgid "" "(possibly modified) versions of the arguments passed in." msgstr "" -#: ../../library/logging.rst:1105 +#: ../../library/logging.rst:1104 msgid "Delegates to the underlying :attr:`!manager` on *logger*." msgstr "" -#: ../../library/logging.rst:1109 +#: ../../library/logging.rst:1108 msgid "Delegates to the underlying :meth:`!_log` method on *logger*." msgstr "" -#: ../../library/logging.rst:1111 +#: ../../library/logging.rst:1110 msgid "" "In addition to the above, :class:`LoggerAdapter` supports the following " -"methods " -"of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`, :meth:`~Logger.warning`, :meth:`~Logger.error`, :meth:`~Logger.exception`, :meth:`~Logger.critical`, :meth:`~Logger.log`, :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:`~Logger.setLevel` " -"and :meth:`~Logger.hasHandlers`. These methods have the same signatures as " -"their counterparts in :class:`Logger`, so you can use the two types of " -"instances interchangeably." +"methods of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`, :" +"meth:`~Logger.warning`, :meth:`~Logger.error`, :meth:`~Logger.exception`, :" +"meth:`~Logger.critical`, :meth:`~Logger.log`, :meth:`~Logger.isEnabledFor`, :" +"meth:`~Logger.getEffectiveLevel`, :meth:`~Logger.setLevel` and :meth:" +"`~Logger.hasHandlers`. These methods have the same signatures as their " +"counterparts in :class:`Logger`, so you can use the two types of instances " +"interchangeably." msgstr "" -#: ../../library/logging.rst:1122 +#: ../../library/logging.rst:1121 msgid "" -"The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:`~Logger.setLevel` " -"and :meth:`~Logger.hasHandlers` methods were added " -"to :class:`LoggerAdapter`. These methods delegate to the underlying logger." +"The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:" +"`~Logger.setLevel` and :meth:`~Logger.hasHandlers` methods were added to :" +"class:`LoggerAdapter`. These methods delegate to the underlying logger." msgstr "" -#: ../../library/logging.rst:1128 +#: ../../library/logging.rst:1127 msgid "" "Attribute :attr:`!manager` and method :meth:`!_log` were added, which " "delegate to the underlying logger and allow adapters to be nested." msgstr "" -#: ../../library/logging.rst:1133 +#: ../../library/logging.rst:1132 msgid "The *merge_extra* argument was added." msgstr "新增 *merge_extra* 引數。" -#: ../../library/logging.rst:1137 +#: ../../library/logging.rst:1136 msgid "Thread Safety" msgstr "執行緒安全" -#: ../../library/logging.rst:1139 +#: ../../library/logging.rst:1138 msgid "" "The logging module is intended to be thread-safe without any special work " -"needing to be done by its clients. It achieves this though using threading " +"needing to be done by its clients. It achieves this through using threading " "locks; there is one lock to serialize access to the module's shared data, " "and each handler also creates a lock to serialize access to its underlying I/" "O." msgstr "" -#: ../../library/logging.rst:1144 +#: ../../library/logging.rst:1143 msgid "" "If you are implementing asynchronous signal handlers using the :mod:`signal` " "module, you may not be able to use logging from within such handlers. This " @@ -1701,17 +1697,17 @@ msgid "" "always re-entrant, and so cannot be invoked from such signal handlers." msgstr "" -#: ../../library/logging.rst:1151 +#: ../../library/logging.rst:1150 msgid "Module-Level Functions" msgstr "模組層級函式" -#: ../../library/logging.rst:1153 +#: ../../library/logging.rst:1152 msgid "" "In addition to the classes described above, there are a number of module-" "level functions." msgstr "" -#: ../../library/logging.rst:1159 +#: ../../library/logging.rst:1158 msgid "" "Return a logger with the specified name or, if name is ``None``, return the " "root logger of the hierarchy. If specified, the name is typically a dot-" @@ -1721,14 +1717,14 @@ msgid "" "for not doing that, as mentioned in :ref:`logger`." msgstr "" -#: ../../library/logging.rst:1166 +#: ../../library/logging.rst:1165 msgid "" "All calls to this function with a given name return the same logger " "instance. This means that logger instances never need to be passed between " "different parts of an application." msgstr "" -#: ../../library/logging.rst:1173 +#: ../../library/logging.rst:1172 msgid "" "Return either the standard :class:`Logger` class, or the last class passed " "to :func:`setLoggerClass`. This function may be called from within a new " @@ -1737,7 +1733,7 @@ msgid "" "example::" msgstr "" -#: ../../library/logging.rst:1178 +#: ../../library/logging.rst:1177 msgid "" "class MyLogger(logging.getLoggerClass()):\n" " # ... override behaviour here" @@ -1745,38 +1741,37 @@ msgstr "" "class MyLogger(logging.getLoggerClass()):\n" " # ... 在這裡覆蓋其行為" -#: ../../library/logging.rst:1184 +#: ../../library/logging.rst:1183 msgid "Return a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1186 +#: ../../library/logging.rst:1185 msgid "" "This function has been provided, along with :func:`setLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1191 +#: ../../library/logging.rst:1190 msgid "" "See :func:`setLogRecordFactory` for more information about the how the " "factory is called." msgstr "" -#: ../../library/logging.rst:1196 +#: ../../library/logging.rst:1195 msgid "" "This is a convenience function that calls :meth:`Logger.debug`, on the root " "logger. The handling of the arguments is in every way identical to what is " "described in that method." msgstr "" -#: ../../library/logging.rst:1200 +#: ../../library/logging.rst:1199 msgid "" -"The only difference is that if the root logger has no handlers, " -"then :func:`basicConfig` is called, prior to calling ``debug`` on the root " -"logger." +"The only difference is that if the root logger has no handlers, then :func:" +"`basicConfig` is called, prior to calling ``debug`` on the root logger." msgstr "" -#: ../../library/logging.rst:1203 +#: ../../library/logging.rst:1202 msgid "" "For very short scripts or quick demonstrations of ``logging`` facilities, " "``debug`` and the other module-level functions may be convenient. However, " @@ -1786,38 +1781,38 @@ msgid "" "described at the beginning of this documentation." msgstr "" -#: ../../library/logging.rst:1213 +#: ../../library/logging.rst:1212 msgid "" "Logs a message with level :const:`INFO` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1219 +#: ../../library/logging.rst:1218 msgid "" "Logs a message with level :const:`WARNING` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1222 +#: ../../library/logging.rst:1221 msgid "" "There is an obsolete function ``warn`` which is functionally identical to " "``warning``. As ``warn`` is deprecated, please do not use it - use " "``warning`` instead." msgstr "" -#: ../../library/logging.rst:1229 +#: ../../library/logging.rst:1228 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1235 +#: ../../library/logging.rst:1234 msgid "" "Logs a message with level :const:`CRITICAL` on the root logger. The " "arguments and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1241 +#: ../../library/logging.rst:1240 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`. Exception info is " @@ -1825,13 +1820,13 @@ msgid "" "exception handler." msgstr "" -#: ../../library/logging.rst:1247 +#: ../../library/logging.rst:1246 msgid "" "Logs a message with level *level* on the root logger. The arguments and " "behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1252 +#: ../../library/logging.rst:1251 msgid "" "Provides an overriding level *level* for all loggers which takes precedence " "over the logger's own level. When the need arises to temporarily throttle " @@ -1839,13 +1834,13 @@ msgid "" "useful. Its effect is to disable all logging calls of severity *level* and " "below, so that if you call it with a value of INFO, then all INFO and DEBUG " "events would be discarded, whereas those of severity WARNING and above would " -"be processed according to the logger's effective level. If " -"``logging.disable(logging.NOTSET)`` is called, it effectively removes this " -"overriding level, so that logging output again depends on the effective " -"levels of individual loggers." +"be processed according to the logger's effective level. If ``logging." +"disable(logging.NOTSET)`` is called, it effectively removes this overriding " +"level, so that logging output again depends on the effective levels of " +"individual loggers." msgstr "" -#: ../../library/logging.rst:1263 +#: ../../library/logging.rst:1262 msgid "" "Note that if you have defined any custom logging level higher than " "``CRITICAL`` (this is not recommended), you won't be able to rely on the " @@ -1853,13 +1848,13 @@ msgid "" "a suitable value." msgstr "" -#: ../../library/logging.rst:1268 +#: ../../library/logging.rst:1267 msgid "" -"The *level* parameter was defaulted to level ``CRITICAL``. " -"See :issue:`28524` for more information about this change." +"The *level* parameter was defaulted to level ``CRITICAL``. See :issue:" +"`28524` for more information about this change." msgstr "" -#: ../../library/logging.rst:1274 +#: ../../library/logging.rst:1273 msgid "" "Associates level *level* with text *levelName* in an internal dictionary, " "which is used to map numeric levels to a textual representation, for example " @@ -1869,57 +1864,56 @@ msgid "" "and they should increase in increasing order of severity." msgstr "" -#: ../../library/logging.rst:1281 +#: ../../library/logging.rst:1280 msgid "" -"If you are thinking of defining your own levels, please see the section " -"on :ref:`custom-levels`." +"If you are thinking of defining your own levels, please see the section on :" +"ref:`custom-levels`." msgstr "" -#: ../../library/logging.rst:1286 +#: ../../library/logging.rst:1285 msgid "" "Returns a mapping from level names to their corresponding logging levels. " "For example, the string \"CRITICAL\" maps to :const:`CRITICAL`. The returned " "mapping is copied from an internal mapping on each call to this function." msgstr "" -#: ../../library/logging.rst:1294 +#: ../../library/logging.rst:1293 msgid "Returns the textual or numeric representation of logging level *level*." msgstr "" -#: ../../library/logging.rst:1296 +#: ../../library/logging.rst:1295 msgid "" -"If *level* is one of the predefined " -"levels :const:`CRITICAL`, :const:`ERROR`, :const:`WARNING`, :const:`INFO` " -"or :const:`DEBUG` then you get the corresponding string. If you have " -"associated levels with names using :func:`addLevelName` then the name you " -"have associated with *level* is returned. If a numeric value corresponding " -"to one of the defined levels is passed in, the corresponding string " -"representation is returned." +"If *level* is one of the predefined levels :const:`CRITICAL`, :const:" +"`ERROR`, :const:`WARNING`, :const:`INFO` or :const:`DEBUG` then you get the " +"corresponding string. If you have associated levels with names using :func:" +"`addLevelName` then the name you have associated with *level* is returned. " +"If a numeric value corresponding to one of the defined levels is passed in, " +"the corresponding string representation is returned." msgstr "" -#: ../../library/logging.rst:1303 +#: ../../library/logging.rst:1302 msgid "" "The *level* parameter also accepts a string representation of the level such " "as 'INFO'. In such cases, this functions returns the corresponding numeric " "value of the level." msgstr "" -#: ../../library/logging.rst:1307 +#: ../../library/logging.rst:1306 msgid "" "If no matching numeric or string value is passed in, the string 'Level %s' % " "level is returned." msgstr "" -#: ../../library/logging.rst:1310 +#: ../../library/logging.rst:1309 msgid "" "Levels are internally integers (as they need to be compared in the logging " "logic). This function is used to convert between an integer level and the " -"level name displayed in the formatted log output by means of the ``%" -"(levelname)s`` format specifier (see :ref:`logrecord-attributes`), and vice " -"versa." +"level name displayed in the formatted log output by means of the " +"``%(levelname)s`` format specifier (see :ref:`logrecord-attributes`), and " +"vice versa." msgstr "" -#: ../../library/logging.rst:1316 +#: ../../library/logging.rst:1315 msgid "" "In Python versions earlier than 3.4, this function could also be passed a " "text level, and would return the corresponding numeric value of the level. " @@ -1927,41 +1921,40 @@ msgid "" "Python 3.4, but reinstated in 3.4.2 due to retain backward compatibility." msgstr "" -#: ../../library/logging.rst:1324 +#: ../../library/logging.rst:1323 msgid "" "Returns a handler with the specified *name*, or ``None`` if there is no " "handler with that name." msgstr "" -#: ../../library/logging.rst:1331 +#: ../../library/logging.rst:1330 msgid "Returns an immutable set of all known handler names." msgstr "" -#: ../../library/logging.rst:1337 +#: ../../library/logging.rst:1336 msgid "" "Creates and returns a new :class:`LogRecord` instance whose attributes are " -"defined by *attrdict*. This function is useful for taking a " -"pickled :class:`LogRecord` attribute dictionary, sent over a socket, and " -"reconstituting it as a :class:`LogRecord` instance at the receiving end." +"defined by *attrdict*. This function is useful for taking a pickled :class:" +"`LogRecord` attribute dictionary, sent over a socket, and reconstituting it " +"as a :class:`LogRecord` instance at the receiving end." msgstr "" -#: ../../library/logging.rst:1345 +#: ../../library/logging.rst:1344 msgid "" -"Does basic configuration for the logging system by creating " -"a :class:`StreamHandler` with a default :class:`Formatter` and adding it to " -"the root logger. The " -"functions :func:`debug`, :func:`info`, :func:`warning`, :func:`error` " -"and :func:`critical` will call :func:`basicConfig` automatically if no " -"handlers are defined for the root logger." +"Does basic configuration for the logging system by creating a :class:" +"`StreamHandler` with a default :class:`Formatter` and adding it to the root " +"logger. The functions :func:`debug`, :func:`info`, :func:`warning`, :func:" +"`error` and :func:`critical` will call :func:`basicConfig` automatically if " +"no handlers are defined for the root logger." msgstr "" -#: ../../library/logging.rst:1351 +#: ../../library/logging.rst:1350 msgid "" "This function does nothing if the root logger already has handlers " "configured, unless the keyword argument *force* is set to ``True``." msgstr "" -#: ../../library/logging.rst:1354 +#: ../../library/logging.rst:1353 msgid "" "This function should be called from the main thread before other threads are " "started. In versions of Python prior to 2.7.1 and 3.2, if this function is " @@ -1970,54 +1963,54 @@ msgid "" "unexpected results such as messages being duplicated in the log." msgstr "" -#: ../../library/logging.rst:1361 +#: ../../library/logging.rst:1360 msgid "The following keyword arguments are supported." msgstr "支援以下的關鍵字引數。" -#: ../../library/logging.rst:1368 +#: ../../library/logging.rst:1367 msgid "*filename*" msgstr "*filename*" -#: ../../library/logging.rst:1368 +#: ../../library/logging.rst:1367 msgid "" "Specifies that a :class:`FileHandler` be created, using the specified " "filename, rather than a :class:`StreamHandler`." msgstr "" -#: ../../library/logging.rst:1372 +#: ../../library/logging.rst:1371 msgid "*filemode*" msgstr "*filemode*" -#: ../../library/logging.rst:1372 +#: ../../library/logging.rst:1371 msgid "" "If *filename* is specified, open the file in this :ref:`mode `. " "Defaults to ``'a'``." msgstr "" -#: ../../library/logging.rst:1376 +#: ../../library/logging.rst:1375 msgid "*format*" msgstr "*format*" -#: ../../library/logging.rst:1376 +#: ../../library/logging.rst:1375 msgid "" "Use the specified format string for the handler. Defaults to attributes " "``levelname``, ``name`` and ``message`` separated by colons." msgstr "" -#: ../../library/logging.rst:1381 +#: ../../library/logging.rst:1380 msgid "*datefmt*" msgstr "*datefmt*" -#: ../../library/logging.rst:1381 +#: ../../library/logging.rst:1380 msgid "" "Use the specified date/time format, as accepted by :func:`time.strftime`." msgstr "" -#: ../../library/logging.rst:1384 +#: ../../library/logging.rst:1383 msgid "*style*" msgstr "*style*" -#: ../../library/logging.rst:1384 +#: ../../library/logging.rst:1383 msgid "" "If *format* is specified, use this style for the format string. One of " "``'%'``, ``'{'`` or ``'$'`` for :ref:`printf-style `." msgstr "" -#: ../../library/logging.rst:1395 +#: ../../library/logging.rst:1394 msgid "*stream*" msgstr "*stream*" -#: ../../library/logging.rst:1395 +#: ../../library/logging.rst:1394 msgid "" "Use the specified stream to initialize the :class:`StreamHandler`. Note that " "this argument is incompatible with *filename* - if both are present, a " "``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1401 +#: ../../library/logging.rst:1400 msgid "*handlers*" msgstr "*handlers*" -#: ../../library/logging.rst:1401 +#: ../../library/logging.rst:1400 msgid "" "If specified, this should be an iterable of already created handlers to add " "to the root logger. Any handlers which don't already have a formatter set " @@ -2057,112 +2050,111 @@ msgid "" "present, a ``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1410 +#: ../../library/logging.rst:1409 msgid "*force*" msgstr "*force*" -#: ../../library/logging.rst:1410 +#: ../../library/logging.rst:1409 msgid "" "If this keyword argument is specified as true, any existing handlers " "attached to the root logger are removed and closed, before carrying out the " "configuration as specified by the other arguments." msgstr "" -#: ../../library/logging.rst:1416 +#: ../../library/logging.rst:1415 msgid "*encoding*" msgstr "*encoding*" -#: ../../library/logging.rst:1416 +#: ../../library/logging.rst:1415 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " "the output file." msgstr "" -#: ../../library/logging.rst:1421 +#: ../../library/logging.rst:1420 msgid "*errors*" msgstr "*errors*" -#: ../../library/logging.rst:1421 +#: ../../library/logging.rst:1420 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " "the output file. If not specified, the value 'backslashreplace' is used. " -"Note that if ``None`` is specified, it will be passed as such " -"to :func:`open`, which means that it will be treated the same as passing " -"'errors'." +"Note that if ``None`` is specified, it will be passed as such to :func:" +"`open`, which means that it will be treated the same as passing 'errors'." msgstr "" -#: ../../library/logging.rst:1432 +#: ../../library/logging.rst:1431 msgid "The *style* argument was added." msgstr "新增 *style* 引數。" -#: ../../library/logging.rst:1435 +#: ../../library/logging.rst:1434 msgid "" "The *handlers* argument was added. Additional checks were added to catch " "situations where incompatible arguments are specified (e.g. *handlers* " "together with *stream* or *filename*, or *stream* together with *filename*)." msgstr "" -#: ../../library/logging.rst:1441 +#: ../../library/logging.rst:1440 msgid "The *force* argument was added." msgstr "新增 *force* 引數。" -#: ../../library/logging.rst:1444 +#: ../../library/logging.rst:1443 msgid "The *encoding* and *errors* arguments were added." msgstr "新增 *encoding* 與 *errors* 引數。" -#: ../../library/logging.rst:1449 +#: ../../library/logging.rst:1448 msgid "" "Informs the logging system to perform an orderly shutdown by flushing and " "closing all handlers. This should be called at application exit and no " "further use of the logging system should be made after this call." msgstr "" -#: ../../library/logging.rst:1453 +#: ../../library/logging.rst:1452 msgid "" "When the logging module is imported, it registers this function as an exit " "handler (see :mod:`atexit`), so normally there's no need to do that manually." msgstr "" -#: ../../library/logging.rst:1460 +#: ../../library/logging.rst:1459 msgid "" "Tells the logging system to use the class *klass* when instantiating a " "logger. The class should define :meth:`!__init__` such that only a name " -"argument is required, and the :meth:`!__init__` should call :meth:`!" -"Logger.__init__`. This function is typically called before any loggers are " +"argument is required, and the :meth:`!__init__` should call :meth:`!Logger." +"__init__`. This function is typically called before any loggers are " "instantiated by applications which need to use custom logger behavior. After " "this call, as at any other time, do not instantiate loggers directly using " "the subclass: continue to use the :func:`logging.getLogger` API to get your " "loggers." msgstr "" -#: ../../library/logging.rst:1471 +#: ../../library/logging.rst:1470 msgid "Set a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1473 +#: ../../library/logging.rst:1472 msgid "The factory callable to be used to instantiate a log record." msgstr "" -#: ../../library/logging.rst:1475 +#: ../../library/logging.rst:1474 msgid "" "This function has been provided, along with :func:`getLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1480 +#: ../../library/logging.rst:1479 msgid "The factory has the following signature:" msgstr "" -#: ../../library/logging.rst:1482 +#: ../../library/logging.rst:1481 msgid "" "``factory(name, level, fn, lno, msg, args, exc_info, func=None, sinfo=None, " "**kwargs)``" msgstr "" -#: ../../library/logging.rst:1484 +#: ../../library/logging.rst:1483 msgid "The logger name." msgstr "" @@ -2170,7 +2162,7 @@ msgstr "" msgid "level" msgstr "" -#: ../../library/logging.rst:1485 +#: ../../library/logging.rst:1484 msgid "The logging level (numeric)." msgstr "" @@ -2178,7 +2170,7 @@ msgstr "" msgid "fn" msgstr "fn" -#: ../../library/logging.rst:1486 +#: ../../library/logging.rst:1485 msgid "The full pathname of the file where the logging call was made." msgstr "" @@ -2186,19 +2178,19 @@ msgstr "" msgid "lno" msgstr "lno" -#: ../../library/logging.rst:1487 +#: ../../library/logging.rst:1486 msgid "The line number in the file where the logging call was made." msgstr "" -#: ../../library/logging.rst:1488 +#: ../../library/logging.rst:1487 msgid "The logging message." msgstr "" -#: ../../library/logging.rst:1489 +#: ../../library/logging.rst:1488 msgid "The arguments for the logging message." msgstr "" -#: ../../library/logging.rst:1490 +#: ../../library/logging.rst:1489 msgid "An exception tuple, or ``None``." msgstr "" @@ -2206,7 +2198,7 @@ msgstr "" msgid "func" msgstr "func" -#: ../../library/logging.rst:1491 +#: ../../library/logging.rst:1490 msgid "The name of the function or method which invoked the logging call." msgstr "" @@ -2214,7 +2206,7 @@ msgstr "" msgid "sinfo" msgstr "sinfo" -#: ../../library/logging.rst:1493 +#: ../../library/logging.rst:1492 msgid "" "A stack traceback such as is provided by :func:`traceback.print_stack`, " "showing the call hierarchy." @@ -2224,34 +2216,34 @@ msgstr "" msgid "kwargs" msgstr "kwargs" -#: ../../library/logging.rst:1495 +#: ../../library/logging.rst:1494 msgid "Additional keyword arguments." msgstr "額外的關鍵字引數。" -#: ../../library/logging.rst:1499 +#: ../../library/logging.rst:1498 msgid "Module-Level Attributes" msgstr "模組層級屬性" -#: ../../library/logging.rst:1503 +#: ../../library/logging.rst:1502 msgid "" -"A \"handler of last resort\" is available through this attribute. This is " -"a :class:`StreamHandler` writing to ``sys.stderr`` with a level of " -"``WARNING``, and is used to handle logging events in the absence of any " -"logging configuration. The end result is to just print the message to " -"``sys.stderr``. This replaces the earlier error message saying that \"no " -"handlers could be found for logger XYZ\". If you need the earlier behaviour " -"for some reason, ``lastResort`` can be set to ``None``." +"A \"handler of last resort\" is available through this attribute. This is a :" +"class:`StreamHandler` writing to ``sys.stderr`` with a level of ``WARNING``, " +"and is used to handle logging events in the absence of any logging " +"configuration. The end result is to just print the message to ``sys." +"stderr``. This replaces the earlier error message saying that \"no handlers " +"could be found for logger XYZ\". If you need the earlier behaviour for some " +"reason, ``lastResort`` can be set to ``None``." msgstr "" -#: ../../library/logging.rst:1515 +#: ../../library/logging.rst:1514 msgid "Used to see if exceptions during handling should be propagated." msgstr "" -#: ../../library/logging.rst:1517 +#: ../../library/logging.rst:1516 msgid "Default: ``True``." msgstr "" -#: ../../library/logging.rst:1519 +#: ../../library/logging.rst:1518 msgid "" "If :data:`raiseExceptions` is ``False``, exceptions get silently ignored. " "This is what is mostly wanted for a logging system - most users will not " @@ -2259,70 +2251,70 @@ msgid "" "application errors." msgstr "" -#: ../../library/logging.rst:1526 +#: ../../library/logging.rst:1525 msgid "Integration with the warnings module" msgstr "" -#: ../../library/logging.rst:1528 +#: ../../library/logging.rst:1527 msgid "" "The :func:`captureWarnings` function can be used to integrate :mod:`logging` " "with the :mod:`warnings` module." msgstr "" -#: ../../library/logging.rst:1533 +#: ../../library/logging.rst:1532 msgid "" "This function is used to turn the capture of warnings by logging on and off." msgstr "" -#: ../../library/logging.rst:1536 +#: ../../library/logging.rst:1535 msgid "" "If *capture* is ``True``, warnings issued by the :mod:`warnings` module will " "be redirected to the logging system. Specifically, a warning will be " "formatted using :func:`warnings.formatwarning` and the resulting string " -"logged to a logger named ``'py.warnings'`` with a severity " -"of :const:`WARNING`." +"logged to a logger named ``'py.warnings'`` with a severity of :const:" +"`WARNING`." msgstr "" -#: ../../library/logging.rst:1541 +#: ../../library/logging.rst:1540 msgid "" "If *capture* is ``False``, the redirection of warnings to the logging system " -"will stop, and warnings will be redirected to their original destinations " -"(i.e. those in effect before ``captureWarnings(True)`` was called)." +"will stop, and warnings will be redirected to their original destinations (i." +"e. those in effect before ``captureWarnings(True)`` was called)." msgstr "" -#: ../../library/logging.rst:1548 +#: ../../library/logging.rst:1547 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.rst:1549 +#: ../../library/logging.rst:1548 msgid "Configuration API for the logging module." msgstr "" -#: ../../library/logging.rst:1551 +#: ../../library/logging.rst:1550 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../library/logging.rst:1552 +#: ../../library/logging.rst:1551 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../library/logging.rst:1554 +#: ../../library/logging.rst:1553 msgid ":pep:`282` - A Logging System" msgstr "" -#: ../../library/logging.rst:1555 +#: ../../library/logging.rst:1554 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "" -#: ../../library/logging.rst:1558 +#: ../../library/logging.rst:1557 msgid "" -"`Original Python logging package `_" +"`Original Python logging package `_" msgstr "" -#: ../../library/logging.rst:1559 +#: ../../library/logging.rst:1558 msgid "" "This is the original source for the :mod:`logging` package. The version of " "the package available from this site is suitable for use with Python 1.5.2, " diff --git a/library/os.po b/library/os.po index b9c13b0f20a..a882bc46b50 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2024-04-29 15:24+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,10 +31,10 @@ msgid "" "This module provides a portable way of using operating system dependent " "functionality. If you just want to read or write a file see :func:`open`, " "if you want to manipulate paths, see the :mod:`os.path` module, and if you " -"want to read all the lines in all the files on the command line see " -"the :mod:`fileinput` module. For creating temporary files and directories " -"see the :mod:`tempfile` module, and for high-level file and directory " -"handling see the :mod:`shutil` module." +"want to read all the lines in all the files on the command line see the :mod:" +"`fileinput` module. For creating temporary files and directories see the :" +"mod:`tempfile` module, and for high-level file and directory handling see " +"the :mod:`shutil` module." msgstr "" "該模組提供了一種便利的方式來操作與作業系統相關的功能。如果你想讀取或寫入檔" "案,請參閱 :func:`open` ,如果你想操作檔案路徑,請參閱 :mod:`os.path` 模組," @@ -84,11 +84,11 @@ msgstr "在 VxWorks, 不支援 os.popen、os.fork、os.execv 和 os.spawn*p*。" #: ../../library/os.rst:37 msgid "" "On WebAssembly platforms, Android and iOS, large parts of the :mod:`os` " -"module are not available or behave differently. APIs related to processes " -"(e.g. :func:`~os.fork`, :func:`~os.execve`) and resources " -"(e.g. :func:`~os.nice`) are not available. Others like :func:`~os.getuid` " -"and :func:`~os.getpid` are emulated or stubs. WebAssembly platforms also " -"lack support for signals (e.g. :func:`~os.kill`, :func:`~os.wait`)." +"module are not available or behave differently. APIs related to processes (e." +"g. :func:`~os.fork`, :func:`~os.execve`) and resources (e.g. :func:`~os." +"nice`) are not available. Others like :func:`~os.getuid` and :func:`~os." +"getpid` are emulated or stubs. WebAssembly platforms also lack support for " +"signals (e.g. :func:`~os.kill`, :func:`~os.wait`)." msgstr "" "在 WebAssembly 平台和 Android 與 iOS 上,大部分 :mod:`os` 模組無法使用或行為" "不同。與行程 (process)(例如 :func:`~os.fork`、:func:`~os.execve`\\ )與資源" @@ -143,9 +143,9 @@ msgstr "" #: ../../library/os.rst:82 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " -"startup by the :c:func:`PyConfig_Read` function: " -"see :c:member:`~PyConfig.filesystem_encoding` " -"and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." +"startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." +"filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :" +"c:type:`PyConfig`." msgstr "" #: ../../library/os.rst:87 @@ -161,8 +161,8 @@ msgstr "" msgid "" "The :term:`file system encoding ` " "must guarantee to successfully decode all bytes below 128. If the file " -"system encoding fails to provide this guarantee, API functions can " -"raise :exc:`UnicodeError`." +"system encoding fails to provide this guarantee, API functions can raise :" +"exc:`UnicodeError`." msgstr "" #: ../../library/os.rst:100 @@ -220,9 +220,9 @@ msgstr "在 Unix 中,:func:`os.device_encoding` 回傳 ``'utf-8'`` 而非裝 #: ../../library/os.rst:127 msgid "" -"Note that the standard stream settings in UTF-8 mode can be overridden " -"by :envvar:`PYTHONIOENCODING` (just as they can be in the default locale-" -"aware mode)." +"Note that the standard stream settings in UTF-8 mode can be overridden by :" +"envvar:`PYTHONIOENCODING` (just as they can be in the default locale-aware " +"mode)." msgstr "" "請注意,在 UTF-8 模式中,標準的串流設定會被 :envvar:`PYTHONIOENCODING` 覆蓋" "(如同在預設在地化覺察 模式一樣)。" @@ -282,8 +282,8 @@ msgstr "" #: ../../library/os.rst:159 msgid "" -"See also the :ref:`UTF-8 mode on Windows ` and " -"the :term:`filesystem encoding and error handler`." +"See also the :ref:`UTF-8 mode on Windows ` and the :term:" +"`filesystem encoding and error handler`." msgstr "" #: ../../library/os.rst:164 @@ -411,9 +411,9 @@ msgstr "" msgid "" "This mapping is captured the first time the :mod:`os` module is imported, " "typically during Python startup as part of processing :file:`site.py`. " -"Changes to the environment made after this time are not reflected " -"in :data:`os.environ`, except for changes made by " -"modifying :data:`os.environ` directly." +"Changes to the environment made after this time are not reflected in :data:" +"`os.environ`, except for changes made by modifying :data:`os.environ` " +"directly." msgstr "" #: ../../library/os.rst:196 @@ -442,8 +442,8 @@ msgid "" "Calling :func:`putenv` directly does not change :data:`os.environ`, so it's " "better to modify :data:`os.environ`." msgstr "" -"呼叫 :func:`putenv` 並不會改變 :data:`os.environ`,所以建議直接修" -"改 :data:`os.environ`。" +"呼叫 :func:`putenv` 並不會改變 :data:`os.environ`,所以建議直接修改 :data:" +"`os.environ`。" #: ../../library/os.rst:216 msgid "" @@ -453,10 +453,10 @@ msgstr "" #: ../../library/os.rst:220 msgid "" -"You can delete items in this mapping to unset environment " -"variables. :func:`unsetenv` will be called automatically when an item is " -"deleted from :data:`os.environ`, and when one of the :meth:`pop` " -"or :meth:`clear` methods is called." +"You can delete items in this mapping to unset environment variables. :func:" +"`unsetenv` will be called automatically when an item is deleted from :data:" +"`os.environ`, and when one of the :meth:`pop` or :meth:`clear` methods is " +"called." msgstr "" #: ../../library/os.rst:227 @@ -471,9 +471,9 @@ msgstr "" #: ../../library/os.rst:235 msgid "" "Bytes version of :data:`environ`: a :term:`mapping` object where both keys " -"and values are :class:`bytes` objects representing the process " -"environment. :data:`environ` and :data:`environb` are synchronized " -"(modifying :data:`environb` updates :data:`environ`, and vice versa)." +"and values are :class:`bytes` objects representing the process environment. :" +"data:`environ` and :data:`environb` are synchronized (modifying :data:" +"`environb` updates :data:`environ`, and vice versa)." msgstr "" #: ../../library/os.rst:240 @@ -495,9 +495,9 @@ msgstr "" #: ../../library/os.rst:259 msgid "" "This function is not thread-safe. Calling it while the environment is being " -"modified in an other thread is an undefined behavior. Reading " -"from :data:`os.environ` or :data:`os.environb`, or calling :func:`os.getenv` " -"while reloading, may return an empty result." +"modified in an other thread is an undefined behavior. Reading from :data:`os." +"environ` or :data:`os.environb`, or calling :func:`os.getenv` while " +"reloading, may return an empty result." msgstr "" #: ../../library/os.rst:272 @@ -506,9 +506,8 @@ msgstr "" #: ../../library/os.rst:277 msgid "" -"Encode :term:`path-like ` *filename* to " -"the :term:`filesystem encoding and error handler`; return :class:`bytes` " -"unchanged." +"Encode :term:`path-like ` *filename* to the :term:" +"`filesystem encoding and error handler`; return :class:`bytes` unchanged." msgstr "" #: ../../library/os.rst:281 @@ -523,9 +522,8 @@ msgstr "" #: ../../library/os.rst:292 msgid "" -"Decode the :term:`path-like ` *filename* from " -"the :term:`filesystem encoding and error handler`; return :class:`str` " -"unchanged." +"Decode the :term:`path-like ` *filename* from the :term:" +"`filesystem encoding and error handler`; return :class:`str` unchanged." msgstr "" #: ../../library/os.rst:296 @@ -563,10 +561,10 @@ msgstr "" #: ../../library/os.rst:335 msgid "" "Return the value of the environment variable *key* as a string if it exists, " -"or *default* if it doesn't. *key* is a string. Note that " -"since :func:`getenv` uses :data:`os.environ`, the mapping of :func:`getenv` " -"is similarly also captured on import, and the function may not reflect " -"future environment changes." +"or *default* if it doesn't. *key* is a string. Note that since :func:" +"`getenv` uses :data:`os.environ`, the mapping of :func:`getenv` is similarly " +"also captured on import, and the function may not reflect future environment " +"changes." msgstr "" #: ../../library/os.rst:341 @@ -579,10 +577,10 @@ msgstr "" #: ../../library/os.rst:350 msgid "" "Return the value of the environment variable *key* as bytes if it exists, or " -"*default* if it doesn't. *key* must be bytes. Note that " -"since :func:`getenvb` uses :data:`os.environb`, the mapping " -"of :func:`getenvb` is similarly also captured on import, and the function " -"may not reflect future environment changes." +"*default* if it doesn't. *key* must be bytes. Note that since :func:" +"`getenvb` uses :data:`os.environb`, the mapping of :func:`getenvb` is " +"similarly also captured on import, and the function may not reflect future " +"environment changes." msgstr "" #: ../../library/os.rst:357 @@ -645,19 +643,18 @@ msgid "" "access list for the user associated with the effective user id of the " "process; the group access list may change over the lifetime of the process, " "it is not affected by calls to :func:`setgroups`, and its length is not " -"limited to 16. The deployment target " -"value, :const:`MACOSX_DEPLOYMENT_TARGET`, can be obtained " -"with :func:`sysconfig.get_config_var`." +"limited to 16. The deployment target value, :const:" +"`MACOSX_DEPLOYMENT_TARGET`, can be obtained with :func:`sysconfig." +"get_config_var`." msgstr "" #: ../../library/os.rst:442 msgid "" "Return the name of the user logged in on the controlling terminal of the " -"process. For most purposes, it is more useful to " -"use :func:`getpass.getuser` since the latter checks the environment " -"variables :envvar:`LOGNAME` or :envvar:`USERNAME` to find out who the user " -"is, and falls back to ``pwd.getpwuid(os.getuid())[0]`` to get the login name " -"of the current real user id." +"process. For most purposes, it is more useful to use :func:`getpass." +"getuser` since the latter checks the environment variables :envvar:`LOGNAME` " +"or :envvar:`USERNAME` to find out who the user is, and falls back to ``pwd." +"getpwuid(os.getuid())[0]`` to get the login name of the current real user id." msgstr "" #: ../../library/os.rst:454 @@ -687,13 +684,13 @@ msgstr "新增對 Windows 的支援。" #: ../../library/os.rst:495 msgid "" -"Get program scheduling priority. The value *which* is one " -"of :const:`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and " -"*who* is interpreted relative to *which* (a process identifier " -"for :const:`PRIO_PROCESS`, process group identifier for :const:`PRIO_PGRP`, " -"and a user ID for :const:`PRIO_USER`). A zero value for *who* denotes " -"(respectively) the calling process, the process group of the calling " -"process, or the real user ID of the calling process." +"Get program scheduling priority. The value *which* is one of :const:" +"`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " +"interpreted relative to *which* (a process identifier for :const:" +"`PRIO_PROCESS`, process group identifier for :const:`PRIO_PGRP`, and a user " +"ID for :const:`PRIO_USER`). A zero value for *who* denotes (respectively) " +"the calling process, the process group of the calling process, or the real " +"user ID of the calling process." msgstr "" #: ../../library/os.rst:512 ../../library/os.rst:524 @@ -727,8 +724,8 @@ msgstr "" #: ../../library/os.rst:577 msgid "" "Set the environment variable named *key* to the string *value*. Such " -"changes to the environment affect subprocesses started " -"with :func:`os.system`, :func:`popen` or :func:`fork` and :func:`execv`." +"changes to the environment affect subprocesses started with :func:`os." +"system`, :func:`popen` or :func:`fork` and :func:`execv`." msgstr "" #: ../../library/os.rst:581 @@ -736,9 +733,9 @@ msgid "" "Assignments to items in :data:`os.environ` are automatically translated into " "corresponding calls to :func:`putenv`; however, calls to :func:`putenv` " "don't update :data:`os.environ`, so it is actually preferable to assign to " -"items of :data:`os.environ`. This also applies to :func:`getenv` " -"and :func:`getenvb`, which respectively use :data:`os.environ` " -"and :data:`os.environb` in their implementations." +"items of :data:`os.environ`. This also applies to :func:`getenv` and :func:" +"`getenvb`, which respectively use :data:`os.environ` and :data:`os.environb` " +"in their implementations." msgstr "" #: ../../library/os.rst:587 ../../library/os.rst:837 @@ -756,8 +753,8 @@ msgid "" "Raises an :ref:`auditing event ` ``os.putenv`` with arguments " "``key``, ``value``." msgstr "" -"引發一個附帶引數 ``key``、``value`` 的\\ :ref:`稽核事件 ` " -"``os.putenv``。" +"引發一個附帶引數 ``key``、``value`` 的\\ :ref:`稽核事件 ` ``os." +"putenv``。" #: ../../library/os.rst:596 msgid "The function is now always available." @@ -786,16 +783,15 @@ msgstr "" #: ../../library/os.rst:629 msgid "" "On macOS, the length of *groups* may not exceed the system-defined maximum " -"number of effective group ids, typically 16. See the documentation " -"for :func:`getgroups` for cases where it may not return the same group list " -"set by calling setgroups()." +"number of effective group ids, typically 16. See the documentation for :func:" +"`getgroups` for cases where it may not return the same group list set by " +"calling setgroups()." msgstr "" #: ../../library/os.rst:636 msgid "" -"Reassociate the current thread with a Linux namespace. See " -"the :manpage:`setns(2)` and :manpage:`namespaces(7)` man pages for more " -"details." +"Reassociate the current thread with a Linux namespace. See the :manpage:" +"`setns(2)` and :manpage:`namespaces(7)` man pages for more details." msgstr "" #: ../../library/os.rst:640 @@ -809,14 +805,13 @@ msgstr "" #: ../../library/os.rst:647 msgid "" -"Since Linux 5.8, *fd* may refer to a PID file descriptor obtained " -"from :func:`~os.pidfd_open`. In this case, ``setns()`` reassociates the " -"calling thread into one or more of the same namespaces as the thread " -"referred to by *fd*. This is subject to any constraints imposed by *nstype*, " -"which is a bit mask combining one or more of the :ref:`CLONE_NEW* constants " -"`, e.g. ``setns(fd, os.CLONE_NEWUTS | " -"os.CLONE_NEWPID)``. The caller's memberships in unspecified namespaces are " -"left unchanged." +"Since Linux 5.8, *fd* may refer to a PID file descriptor obtained from :func:" +"`~os.pidfd_open`. In this case, ``setns()`` reassociates the calling thread " +"into one or more of the same namespaces as the thread referred to by *fd*. " +"This is subject to any constraints imposed by *nstype*, which is a bit mask " +"combining one or more of the :ref:`CLONE_NEW* constants `, e.g. ``setns(fd, os.CLONE_NEWUTS | os.CLONE_NEWPID)``. The caller's " +"memberships in unspecified namespaces are left unchanged." msgstr "" #: ../../library/os.rst:656 @@ -861,15 +856,15 @@ msgstr "" #: ../../library/os.rst:693 msgid "" -"Set program scheduling priority. The value *which* is one " -"of :const:`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and " -"*who* is interpreted relative to *which* (a process identifier " -"for :const:`PRIO_PROCESS`, process group identifier for :const:`PRIO_PGRP`, " -"and a user ID for :const:`PRIO_USER`). A zero value for *who* denotes " -"(respectively) the calling process, the process group of the calling " -"process, or the real user ID of the calling process. *priority* is a value " -"in the range -20 to 19. The default priority is 0; lower priorities cause " -"more favorable scheduling." +"Set program scheduling priority. The value *which* is one of :const:" +"`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " +"interpreted relative to *which* (a process identifier for :const:" +"`PRIO_PROCESS`, process group identifier for :const:`PRIO_PGRP`, and a user " +"ID for :const:`PRIO_USER`). A zero value for *who* denotes (respectively) " +"the calling process, the process group of the calling process, or the real " +"user ID of the calling process. *priority* is a value in the range -20 to " +"19. The default priority is 0; lower priorities cause more favorable " +"scheduling." msgstr "" #: ../../library/os.rst:710 @@ -950,9 +945,8 @@ msgstr "" #: ../../library/os.rst:802 msgid "" "For backwards compatibility, this object is also iterable, behaving like a " -"five-tuple " -"containing :attr:`sysname`, :attr:`nodename`, :attr:`release`, :attr:`version`, " -"and :attr:`machine` in that order." +"five-tuple containing :attr:`sysname`, :attr:`nodename`, :attr:`release`, :" +"attr:`version`, and :attr:`machine` in that order." msgstr "" #: ../../library/os.rst:807 @@ -965,9 +959,9 @@ msgstr "" #: ../../library/os.rst:812 msgid "" "On macOS, iOS and Android, this returns the *kernel* name and version (i.e., " -"``'Darwin'`` on macOS and iOS; ``'Linux'`` on " -"Android). :func:`platform.uname` can be used to get the user-facing " -"operating system name and version on iOS and Android." +"``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android). :func:`platform." +"uname` can be used to get the user-facing operating system name and version " +"on iOS and Android." msgstr "" #: ../../library/os.rst:819 ../../library/os.rst:5083 @@ -979,8 +973,8 @@ msgstr "" #: ../../library/os.rst:828 msgid "" "Unset (delete) the environment variable named *key*. Such changes to the " -"environment affect subprocesses started " -"with :func:`os.system`, :func:`popen` or :func:`fork` and :func:`execv`." +"environment affect subprocesses started with :func:`os.system`, :func:" +"`popen` or :func:`fork` and :func:`execv`." msgstr "" #: ../../library/os.rst:832 @@ -1006,11 +1000,11 @@ msgstr "" msgid "" "Disassociate parts of the process execution context, and move them into a " "newly created namespace. See the :manpage:`unshare(2)` man page for more " -"details. The *flags* argument is a bit mask, combining zero or more of " -"the :ref:`CLONE_* constants `, that specifies which " -"parts of the execution context should be unshared from their existing " -"associations and moved to a new namespace. If the *flags* argument is ``0``, " -"no changes are made to the calling process's execution context." +"details. The *flags* argument is a bit mask, combining zero or more of the :" +"ref:`CLONE_* constants `, that specifies which parts " +"of the execution context should be unshared from their existing associations " +"and moved to a new namespace. If the *flags* argument is ``0``, no changes " +"are made to the calling process's execution context." msgstr "" #: ../../library/os.rst:864 @@ -1030,8 +1024,8 @@ msgstr "" #: ../../library/os.rst:893 msgid "" -"These functions create new :term:`file objects `. (See " -"also :func:`~os.open` for opening file descriptors.)" +"These functions create new :term:`file objects `. (See also :" +"func:`~os.open` for opening file descriptors.)" msgstr "" #: ../../library/os.rst:899 @@ -1077,8 +1071,8 @@ msgstr "" msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To close a " -"\"file object\" returned by the built-in function :func:`open` or " -"by :func:`popen` or :func:`fdopen`, use its :meth:`~io.IOBase.close` method." +"\"file object\" returned by the built-in function :func:`open` or by :func:" +"`popen` or :func:`fdopen`, use its :meth:`~io.IOBase.close` method." msgstr "" #: ../../library/os.rst:939 @@ -1112,8 +1106,8 @@ msgstr "" #: ../../library/os.rst:956 msgid "" "In Linux kernel older than 5.3, the files pointed to by *src* and *dst* must " -"reside in the same filesystem, otherwise an :exc:`OSError` is raised " -"with :attr:`~OSError.errno` set to :const:`errno.EXDEV`." +"reside in the same filesystem, otherwise an :exc:`OSError` is raised with :" +"attr:`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" #: ../../library/os.rst:960 @@ -1164,8 +1158,8 @@ msgstr "" #: ../../library/os.rst:999 msgid "" -"Return a duplicate of file descriptor *fd*. The new file descriptor " -"is :ref:`non-inheritable `." +"Return a duplicate of file descriptor *fd*. The new file descriptor is :ref:" +"`non-inheritable `." msgstr "" #: ../../library/os.rst:1002 @@ -1226,9 +1220,8 @@ msgstr "新增對 Windows 的支援。" #: ../../library/os.rst:1047 msgid "" "Change the owner and group id of the file given by *fd* to the numeric *uid* " -"and *gid*. To leave one of the ids unchanged, set it to -1. " -"See :func:`chown`. As of Python 3.3, this is equivalent to ``os.chown(fd, " -"uid, gid)``." +"and *gid*. To leave one of the ids unchanged, set it to -1. See :func:" +"`chown`. As of Python 3.3, this is equivalent to ``os.chown(fd, uid, gid)``." msgstr "" #: ../../library/os.rst:1052 ../../library/os.rst:2235 @@ -1265,8 +1258,8 @@ msgstr "" msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " -"included in ``pathconf_names``, an :exc:`OSError` is raised " -"with :const:`errno.EINVAL` for the error number." +"included in ``pathconf_names``, an :exc:`OSError` is raised with :const:" +"`errno.EINVAL` for the error number." msgstr "" #: ../../library/os.rst:1086 @@ -1311,8 +1304,8 @@ msgstr "" #: ../../library/os.rst:1126 msgid "" "Truncate the file corresponding to file descriptor *fd*, so that it is at " -"most *length* bytes in size. As of Python 3.3, this is equivalent to " -"``os.truncate(fd, length)``." +"most *length* bytes in size. As of Python 3.3, this is equivalent to ``os." +"truncate(fd, length)``." msgstr "" #: ../../library/os.rst:1130 @@ -1320,8 +1313,8 @@ msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``fd``, ``length``." msgstr "" -"引發一個附帶引數 ``fd``、``length`` 的\\ :ref:`稽核事件 ` " -"``os.truncate``。" +"引發一個附帶引數 ``fd``、``length`` 的\\ :ref:`稽核事件 ` ``os." +"truncate``。" #: ../../library/os.rst:1134 ../../library/os.rst:3571 msgid "Added support for Windows" @@ -1329,8 +1322,8 @@ msgstr "新增對 Windows 的支援" #: ../../library/os.rst:1140 msgid "" -"Get the blocking mode of the file descriptor: ``False`` if " -"the :data:`O_NONBLOCK` flag is set, ``True`` if the flag is cleared." +"Get the blocking mode of the file descriptor: ``False`` if the :data:" +"`O_NONBLOCK` flag is set, ``True`` if the flag is cleared." msgstr "" #: ../../library/os.rst:1143 @@ -1365,8 +1358,8 @@ msgstr "" #: ../../library/os.rst:1179 msgid "" "Apply, test or remove a POSIX lock on an open file descriptor. *fd* is an " -"open file descriptor. *cmd* specifies the command to use - one " -"of :data:`F_LOCK`, :data:`F_TLOCK`, :data:`F_ULOCK` or :data:`F_TEST`. *len* " +"open file descriptor. *cmd* specifies the command to use - one of :data:" +"`F_LOCK`, :data:`F_TLOCK`, :data:`F_ULOCK` or :data:`F_TEST`. *len* " "specifies the section of the file to lock." msgstr "" @@ -1502,8 +1495,8 @@ msgstr "" msgid "" "For a description of the flag and mode values, see the C run-time " "documentation; flag constants (like :const:`O_RDONLY` and :const:`O_WRONLY`) " -"are defined in the :mod:`os` module. In particular, on Windows " -"adding :const:`O_BINARY` is needed to open files in binary mode." +"are defined in the :mod:`os` module. In particular, on Windows adding :" +"const:`O_BINARY` is needed to open files in binary mode." msgstr "" #: ../../library/os.rst:1288 @@ -1523,9 +1516,9 @@ msgstr "" #: ../../library/os.rst:1298 msgid "" "This function is intended for low-level I/O. For normal usage, use the " -"built-in function :func:`open`, which returns a :term:`file object` " -"with :meth:`~file.read` and :meth:`~file.write` methods (and many more). To " -"wrap a file descriptor in a file object, use :func:`fdopen`." +"built-in function :func:`open`, which returns a :term:`file object` with :" +"meth:`~file.read` and :meth:`~file.write` methods (and many more). To wrap " +"a file descriptor in a file object, use :func:`fdopen`." msgstr "" #: ../../library/os.rst:1303 ../../library/os.rst:2479 @@ -1540,8 +1533,8 @@ msgstr "新增 *dir_fd* 參數。" #: ../../library/os.rst:1892 ../../library/os.rst:5179 msgid "" "If the system call is interrupted and the signal handler does not raise an " -"exception, the function now retries the system call instead of raising " -"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." +"exception, the function now retries the system call instead of raising an :" +"exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" #: ../../library/os.rst:1311 ../../library/os.rst:2102 @@ -1564,12 +1557,12 @@ msgstr "" #: ../../library/os.rst:1314 msgid "" -"The following constants are options for the *flags* parameter to " -"the :func:`~os.open` function. They can be combined using the bitwise OR " -"operator ``|``. Some of them are not available on all platforms. For " -"descriptions of their availability and use, consult the :manpage:`open(2)` " -"manual page on Unix or `the MSDN `_ on Windows." +"The following constants are options for the *flags* parameter to the :func:" +"`~os.open` function. They can be combined using the bitwise OR operator ``|" +"``. Some of them are not available on all platforms. For descriptions of " +"their availability and use, consult the :manpage:`open(2)` manual page on " +"Unix or `the MSDN `_ " +"on Windows." msgstr "" #: ../../library/os.rst:1329 @@ -1594,8 +1587,8 @@ msgstr "" #: ../../library/os.rst:1362 msgid "" -"Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK` " -"and :data:`O_NOFOLLOW_ANY` constants." +"Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK` and :data:" +"`O_NOFOLLOW_ANY` constants." msgstr "" #: ../../library/os.rst:1376 @@ -1632,9 +1625,9 @@ msgstr "" #: ../../library/os.rst:1414 msgid "" "Create a pipe with *flags* set atomically. *flags* can be constructed by " -"ORing together one or more of these " -"values: :data:`O_NONBLOCK`, :data:`O_CLOEXEC`. Return a pair of file " -"descriptors ``(r, w)`` usable for reading and writing, respectively." +"ORing together one or more of these values: :data:`O_NONBLOCK`, :data:" +"`O_CLOEXEC`. Return a pair of file descriptors ``(r, w)`` usable for reading " +"and writing, respectively." msgstr "" #: ../../library/os.rst:1427 @@ -1648,9 +1641,10 @@ msgid "" "Announces an intention to access data in a specific pattern thus allowing " "the kernel to make optimizations. The advice applies to the region of the " "file specified by *fd* starting at *offset* and continuing for *len* bytes. " -"*advice* is one " -"of :data:`POSIX_FADV_NORMAL`, :data:`POSIX_FADV_SEQUENTIAL`, :data:`POSIX_FADV_RANDOM`, :data:`POSIX_FADV_NOREUSE`, :data:`POSIX_FADV_WILLNEED` " -"or :data:`POSIX_FADV_DONTNEED`." +"*advice* is one of :data:`POSIX_FADV_NORMAL`, :data:" +"`POSIX_FADV_SEQUENTIAL`, :data:`POSIX_FADV_RANDOM`, :data:" +"`POSIX_FADV_NOREUSE`, :data:`POSIX_FADV_WILLNEED` or :data:" +"`POSIX_FADV_DONTNEED`." msgstr "" #: ../../library/os.rst:1457 @@ -1691,11 +1685,10 @@ msgstr "" #: ../../library/os.rst:1497 msgid "" -"Read from a file descriptor *fd* at a position of *offset* into " -"mutable :term:`bytes-like objects ` *buffers*, leaving " -"the file offset unchanged. Transfer data into each buffer until it is full " -"and then move on to the next buffer in the sequence to hold the rest of the " -"data." +"Read from a file descriptor *fd* at a position of *offset* into mutable :" +"term:`bytes-like objects ` *buffers*, leaving the file " +"offset unchanged. Transfer data into each buffer until it is full and then " +"move on to the next buffer in the sequence to hold the rest of the data." msgstr "" #: ../../library/os.rst:1502 ../../library/os.rst:1587 @@ -1743,8 +1736,8 @@ msgstr "" #: ../../library/os.rst:1529 msgid "" "If some data was successfully read, it will return the number of bytes read. " -"If no bytes were read, it will return ``-1`` and set errno " -"to :const:`errno.EAGAIN`." +"If no bytes were read, it will return ``-1`` and set errno to :const:`errno." +"EAGAIN`." msgstr "" #: ../../library/os.rst:1540 @@ -1786,10 +1779,10 @@ msgstr "" #: ../../library/os.rst:1581 msgid "" "Write the *buffers* contents to file descriptor *fd* at an offset *offset*, " -"leaving the file offset unchanged. *buffers* must be a sequence " -"of :term:`bytes-like objects `. Buffers are processed in " -"array order. Entire contents of the first buffer is written before " -"proceeding to the second, and so on." +"leaving the file offset unchanged. *buffers* must be a sequence of :term:" +"`bytes-like objects `. Buffers are processed in array " +"order. Entire contents of the first buffer is written before proceeding to " +"the second, and so on." msgstr "" #: ../../library/os.rst:1590 @@ -1843,8 +1836,8 @@ msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To read a \"file " "object\" returned by the built-in function :func:`open` or by :func:`popen` " -"or :func:`fdopen`, or :data:`sys.stdin`, use its :meth:`~file.read` " -"or :meth:`~file.readline` methods." +"or :func:`fdopen`, or :data:`sys.stdin`, use its :meth:`~file.read` or :meth:" +"`~file.readline` methods." msgstr "" #: ../../library/os.rst:1665 @@ -1873,10 +1866,9 @@ msgstr "" msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`os.pipe`. To read a " -"\"file object\" returned by the built-in function :func:`open`, " -"or :data:`sys.stdin`, use its member functions, for " -"example :meth:`io.BufferedIOBase.readinto`, :meth:`io.BufferedIOBase.read`, " -"or :meth:`io.TextIOBase.read`" +"\"file object\" returned by the built-in function :func:`open`, or :data:" +"`sys.stdin`, use its member functions, for example :meth:`io.BufferedIOBase." +"readinto`, :meth:`io.BufferedIOBase.read`, or :meth:`io.TextIOBase.read`" msgstr "" #: ../../library/os.rst:1693 @@ -1888,8 +1880,8 @@ msgstr "" #: ../../library/os.rst:1697 msgid "" -"The first function notation is supported by all platforms that " -"define :func:`sendfile`." +"The first function notation is supported by all platforms that define :func:" +"`sendfile`." msgstr "" #: ../../library/os.rst:1700 @@ -1926,8 +1918,8 @@ msgstr "" #: ../../library/os.rst:1720 msgid "" -"For a higher-level wrapper of :func:`sendfile`, " -"see :meth:`socket.socket.sendfile`." +"For a higher-level wrapper of :func:`sendfile`, see :meth:`socket.socket." +"sendfile`." msgstr "" #: ../../library/os.rst:1725 @@ -1949,9 +1941,8 @@ msgstr "" #: ../../library/os.rst:1752 msgid "" -"Set the blocking mode of the specified file descriptor. Set " -"the :data:`O_NONBLOCK` flag if blocking is ``False``, clear the flag " -"otherwise." +"Set the blocking mode of the specified file descriptor. Set the :data:" +"`O_NONBLOCK` flag if blocking is ``False``, clear the flag otherwise." msgstr "" #: ../../library/os.rst:1755 @@ -1997,8 +1988,8 @@ msgid "" "is ``None``, then *src* is read from the current position; respectively for " "*offset_dst*. The offset associated to the file descriptor that refers to a " "pipe must be ``None``. The files pointed to by *src* and *dst* must reside " -"in the same filesystem, otherwise an :exc:`OSError` is raised " -"with :attr:`~OSError.errno` set to :const:`errno.EXDEV`." +"in the same filesystem, otherwise an :exc:`OSError` is raised with :attr:" +"`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" #: ../../library/os.rst:1798 @@ -2068,9 +2059,9 @@ msgstr "" msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To write a " -"\"file object\" returned by the built-in function :func:`open` or " -"by :func:`popen` or :func:`fdopen`, or :data:`sys.stdout` " -"or :data:`sys.stderr`, use its :meth:`~file.write` method." +"\"file object\" returned by the built-in function :func:`open` or by :func:" +"`popen` or :func:`fdopen`, or :data:`sys.stdout` or :data:`sys.stderr`, use " +"its :meth:`~file.write` method." msgstr "" #: ../../library/os.rst:1900 @@ -2201,8 +2192,8 @@ msgstr "" msgid "" "You can check whether or not *path* can be specified as a file descriptor " "for a particular function on your platform using :data:`os.supports_fd`. If " -"this functionality is unavailable, using it will raise " -"a :exc:`NotImplementedError`." +"this functionality is unavailable, using it will raise a :exc:" +"`NotImplementedError`." msgstr "" #: ../../library/os.rst:2020 @@ -2251,10 +2242,10 @@ msgid "" "operations will use the effective uid/gid, therefore this routine can be " "used in a suid/sgid environment to test if the invoking user has the " "specified access to *path*. *mode* should be :const:`F_OK` to test the " -"existence of *path*, or it can be the inclusive OR of one or more " -"of :const:`R_OK`, :const:`W_OK`, and :const:`X_OK` to test permissions. " -"Return :const:`True` if access is allowed, :const:`False` if not. See the " -"Unix man page :manpage:`access(2)` for more information." +"existence of *path*, or it can be the inclusive OR of one or more of :const:" +"`R_OK`, :const:`W_OK`, and :const:`X_OK` to test permissions. Return :const:" +"`True` if access is allowed, :const:`False` if not. See the Unix man page :" +"manpage:`access(2)` for more information." msgstr "" #: ../../library/os.rst:2061 @@ -2345,9 +2336,8 @@ msgstr "" #: ../../library/os.rst:2125 msgid "" -"This function can raise :exc:`OSError` and subclasses such " -"as :exc:`FileNotFoundError`, :exc:`PermissionError`, " -"and :exc:`NotADirectoryError`." +"This function can raise :exc:`OSError` and subclasses such as :exc:" +"`FileNotFoundError`, :exc:`PermissionError`, and :exc:`NotADirectoryError`." msgstr "" #: ../../library/os.rst:2128 ../../library/os.rst:2266 @@ -2365,8 +2355,8 @@ msgstr "" #: ../../library/os.rst:2140 msgid "" "Set the flags of *path* to the numeric *flags*. *flags* may take a " -"combination (bitwise OR) of the following values (as defined in " -"the :mod:`stat` module):" +"combination (bitwise OR) of the following values (as defined in the :mod:" +"`stat` module):" msgstr "" #: ../../library/os.rst:2143 @@ -2427,8 +2417,8 @@ msgid "" "Raises an :ref:`auditing event ` ``os.chflags`` with arguments " "``path``, ``flags``." msgstr "" -"引發一個附帶引數 ``path``、``flags`` 的\\ :ref:`稽核事件 ` " -"``os.chflags``。" +"引發一個附帶引數 ``path``、``flags`` 的\\ :ref:`稽核事件 ` ``os." +"chflags``。" #: ../../library/os.rst:2162 msgid "Added the *follow_symlinks* parameter." @@ -2520,9 +2510,9 @@ msgstr ":const:`stat.S_IXOTH`" #: ../../library/os.rst:2195 ../../library/os.rst:2228 #: ../../library/os.rst:3620 msgid "" -"This function can support :ref:`specifying a file descriptor " -"`, :ref:`paths relative to directory descriptors ` " -"and :ref:`not following symlinks `." +"This function can support :ref:`specifying a file descriptor `, :" +"ref:`paths relative to directory descriptors ` and :ref:`not " +"following symlinks `." msgstr "" #: ../../library/os.rst:2201 @@ -2590,16 +2580,16 @@ msgstr "" #: ../../library/os.rst:2288 msgid "" "Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do " -"not follow symbolic links. As of Python 3.3, this is equivalent to " -"``os.chflags(path, flags, follow_symlinks=False)``." +"not follow symbolic links. As of Python 3.3, this is equivalent to ``os." +"chflags(path, flags, follow_symlinks=False)``." msgstr "" #: ../../library/os.rst:2302 msgid "" "Change the mode of *path* to the numeric *mode*. If path is a symlink, this " "affects the symlink rather than the target. See the docs for :func:`chmod` " -"for possible values of *mode*. As of Python 3.3, this is equivalent to " -"``os.chmod(path, mode, follow_symlinks=False)``." +"for possible values of *mode*. As of Python 3.3, this is equivalent to ``os." +"chmod(path, mode, follow_symlinks=False)``." msgstr "" #: ../../library/os.rst:2307 @@ -2622,8 +2612,8 @@ msgstr "" #: ../../library/os.rst:2338 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " -"supply :ref:`paths relative to directory descriptors `, " -"and :ref:`not following symlinks `. The default value of " +"supply :ref:`paths relative to directory descriptors `, and :ref:" +"`not following symlinks `. The default value of " "*follow_symlinks* is ``False`` on Windows." msgstr "" @@ -2725,10 +2715,10 @@ msgstr "" #: ../../library/os.rst:2418 msgid "" -"*volume* must be represented as a GUID path, like those returned " -"by :func:`os.listvolumes`. Volumes may be mounted in multiple locations or " -"not at all. In the latter case, the list will be empty. Mount points that " -"are not associated with a volume will not be returned by this function." +"*volume* must be represented as a GUID path, like those returned by :func:" +"`os.listvolumes`. Volumes may be mounted in multiple locations or not at " +"all. In the latter case, the list will be empty. Mount points that are not " +"associated with a volume will not be returned by this function." msgstr "" #: ../../library/os.rst:2424 @@ -2748,8 +2738,8 @@ msgid "" "Raises an :ref:`auditing event ` ``os.listmounts`` with argument " "``volume``." msgstr "" -"引發一個附帶引數 ``volume`` 的\\ :ref:`稽核事件 ` " -"``os.listmounts``。" +"引發一個附帶引數 ``volume`` 的\\ :ref:`稽核事件 ` ``os." +"listmounts``。" #: ../../library/os.rst:2439 msgid "Return a list containing the volumes in the system." @@ -2777,14 +2767,14 @@ msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.lis #: ../../library/os.rst:2459 msgid "" "Perform the equivalent of an :c:func:`!lstat` system call on the given path. " -"Similar to :func:`~os.stat`, but does not follow symbolic links. Return " -"a :class:`stat_result` object." +"Similar to :func:`~os.stat`, but does not follow symbolic links. Return a :" +"class:`stat_result` object." msgstr "" #: ../../library/os.rst:2463 msgid "" -"On platforms that do not support symbolic links, this is an alias " -"for :func:`~os.stat`." +"On platforms that do not support symbolic links, this is an alias for :func:" +"`~os.stat`." msgstr "" #: ../../library/os.rst:2466 @@ -2810,8 +2800,8 @@ msgstr "" msgid "" "On Windows, now opens reparse points that represent another path (name " "surrogates), including symbolic links and directory junctions. Other kinds " -"of reparse points are resolved by the operating system as " -"for :func:`~os.stat`." +"of reparse points are resolved by the operating system as for :func:`~os." +"stat`." msgstr "" #: ../../library/os.rst:2494 @@ -2896,10 +2886,10 @@ msgstr "新增 *exist_ok* 參數。" #: ../../library/os.rst:2561 msgid "" -"Before Python 3.4.1, if *exist_ok* was ``True`` and the directory " -"existed, :func:`makedirs` would still raise an error if *mode* did not match " -"the mode of the existing directory. Since this behavior was impossible to " -"implement safely, it was removed in Python 3.4.1. See :issue:`21082`." +"Before Python 3.4.1, if *exist_ok* was ``True`` and the directory existed, :" +"func:`makedirs` would still raise an error if *mode* did not match the mode " +"of the existing directory. Since this behavior was impossible to implement " +"safely, it was removed in Python 3.4.1. See :issue:`21082`." msgstr "" #: ../../library/os.rst:2569 @@ -2928,23 +2918,23 @@ msgstr "" msgid "" "Create a filesystem node (file, device special file or named pipe) named " "*path*. *mode* specifies both the permissions to use and the type of node to " -"be created, being combined (bitwise OR) with one of ``stat.S_IFREG``, " -"``stat.S_IFCHR``, ``stat.S_IFBLK``, and ``stat.S_IFIFO`` (those constants " -"are available in :mod:`stat`). For ``stat.S_IFCHR`` and ``stat.S_IFBLK``, " -"*device* defines the newly created device special file (probably " -"using :func:`os.makedev`), otherwise it is ignored." +"be created, being combined (bitwise OR) with one of ``stat.S_IFREG``, ``stat." +"S_IFCHR``, ``stat.S_IFBLK``, and ``stat.S_IFIFO`` (those constants are " +"available in :mod:`stat`). For ``stat.S_IFCHR`` and ``stat.S_IFBLK``, " +"*device* defines the newly created device special file (probably using :func:" +"`os.makedev`), otherwise it is ignored." msgstr "" #: ../../library/os.rst:2621 msgid "" -"Extract the device major number from a raw device number (usually " -"the :attr:`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." +"Extract the device major number from a raw device number (usually the :attr:" +"`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" #: ../../library/os.rst:2627 msgid "" -"Extract the device minor number from a raw device number (usually " -"the :attr:`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." +"Extract the device minor number from a raw device number (usually the :attr:" +"`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" #: ../../library/os.rst:2633 @@ -2979,23 +2969,22 @@ msgstr "" msgid "" "Return a string representing the path to which the symbolic link points. " "The result may be either an absolute or relative pathname; if it is " -"relative, it may be converted to an absolute pathname using " -"``os.path.join(os.path.dirname(path), result)``." +"relative, it may be converted to an absolute pathname using ``os.path." +"join(os.path.dirname(path), result)``." msgstr "" #: ../../library/os.rst:2676 msgid "" -"If the *path* is a string object (directly or indirectly through " -"a :class:`PathLike` interface), the result will also be a string object, and " -"the call may raise a UnicodeDecodeError. If the *path* is a bytes object " -"(direct or indirectly), the result will be a bytes object." +"If the *path* is a string object (directly or indirectly through a :class:" +"`PathLike` interface), the result will also be a string object, and the call " +"may raise a UnicodeDecodeError. If the *path* is a bytes object (direct or " +"indirectly), the result will be a bytes object." msgstr "" #: ../../library/os.rst:2684 msgid "" -"When trying to resolve a path that may contain links, " -"use :func:`~os.path.realpath` to properly handle recursion and platform " -"differences." +"When trying to resolve a path that may contain links, use :func:`~os.path." +"realpath` to properly handle recursion and platform differences." msgstr "" #: ../../library/os.rst:2696 @@ -3015,9 +3004,9 @@ msgstr "" #: ../../library/os.rst:2708 msgid "" -"Remove (delete) the file *path*. If *path* is a directory, " -"an :exc:`OSError` is raised. Use :func:`rmdir` to remove directories. If " -"the file does not exist, a :exc:`FileNotFoundError` is raised." +"Remove (delete) the file *path*. If *path* is a directory, an :exc:" +"`OSError` is raised. Use :func:`rmdir` to remove directories. If the file " +"does not exist, a :exc:`FileNotFoundError` is raised." msgstr "" #: ../../library/os.rst:2712 ../../library/os.rst:2825 @@ -3045,8 +3034,8 @@ msgid "" "Raises an :ref:`auditing event ` ``os.remove`` with arguments " "``path``, ``dir_fd``." msgstr "" -"引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` " -"``os.remove``。" +"引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." +"remove``。" #: ../../library/os.rst:2734 msgid "" @@ -3069,14 +3058,14 @@ msgstr "" #: ../../library/os.rst:2754 msgid "" "On Windows, if *dst* exists a :exc:`FileExistsError` is always raised. The " -"operation may fail if *src* and *dst* are on different filesystems. " -"Use :func:`shutil.move` to support moves to a different filesystem." +"operation may fail if *src* and *dst* are on different filesystems. Use :" +"func:`shutil.move` to support moves to a different filesystem." msgstr "" #: ../../library/os.rst:2758 msgid "" -"On Unix, if *src* is a file and *dst* is a directory or vice-versa, " -"an :exc:`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised " +"On Unix, if *src* is a file and *dst* is a directory or vice-versa, an :exc:" +"`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised " "respectively. If both are directories and *dst* is empty, *dst* will be " "silently replaced. If *dst* is a non-empty directory, an :exc:`OSError` is " "raised. If both are files, *dst* will be replaced silently if the user has " @@ -3093,8 +3082,8 @@ msgstr "" #: ../../library/os.rst:2770 msgid "" -"If you want cross-platform overwriting of the destination, " -"use :func:`replace`." +"If you want cross-platform overwriting of the destination, use :func:" +"`replace`." msgstr "" #: ../../library/os.rst:2772 ../../library/os.rst:2793 @@ -3142,8 +3131,8 @@ msgstr "" msgid "" "Remove (delete) the directory *path*. If the directory does not exist or is " "not empty, a :exc:`FileNotFoundError` or an :exc:`OSError` is raised " -"respectively. In order to remove whole directory " -"trees, :func:`shutil.rmtree` can be used." +"respectively. In order to remove whole directory trees, :func:`shutil." +"rmtree` can be used." msgstr "" #: ../../library/os.rst:2828 @@ -3151,8 +3140,8 @@ msgid "" "Raises an :ref:`auditing event ` ``os.rmdir`` with arguments " "``path``, ``dir_fd``." msgstr "" -"引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` " -"``os.rmdir``。" +"引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." +"rmdir``。" #: ../../library/os.rst:2839 msgid "" @@ -3169,12 +3158,11 @@ msgid "" "Using :func:`scandir` instead of :func:`listdir` can significantly increase " "the performance of code that also needs file type or file attribute " "information, because :class:`os.DirEntry` objects expose this information if " -"the operating system provides it when scanning a directory. " -"All :class:`os.DirEntry` methods may perform a system call, " -"but :func:`~os.DirEntry.is_dir` and :func:`~os.DirEntry.is_file` usually " -"only require a system call for symbolic links; :func:`os.DirEntry.stat` " -"always requires a system call on Unix but only requires one for symbolic " -"links on Windows." +"the operating system provides it when scanning a directory. All :class:`os." +"DirEntry` methods may perform a system call, but :func:`~os.DirEntry.is_dir` " +"and :func:`~os.DirEntry.is_file` usually only require a system call for " +"symbolic links; :func:`os.DirEntry.stat` always requires a system call on " +"Unix but only requires one for symbolic links on Windows." msgstr "" #: ../../library/os.rst:2856 @@ -3237,17 +3225,17 @@ msgid "" "pubs.opengroup.org/onlinepubs/009695399/functions/opendir.html>`_ and " "`readdir() `_ functions. On Windows, it uses the Win32 `FindFirstFileW " -"`_ and `FindNextFileW `_ functions." +"`_ and `FindNextFileW `_ functions." msgstr "" #: ../../library/os.rst:2905 msgid "" -"Added support for the :term:`context manager` protocol and " -"the :func:`~scandir.close` method. If a :func:`scandir` iterator is neither " -"exhausted nor explicitly closed a :exc:`ResourceWarning` will be emitted in " -"its destructor." +"Added support for the :term:`context manager` protocol and the :func:" +"`~scandir.close` method. If a :func:`scandir` iterator is neither exhausted " +"nor explicitly closed a :exc:`ResourceWarning` will be emitted in its " +"destructor." msgstr "" #: ../../library/os.rst:2911 @@ -3305,25 +3293,25 @@ msgstr "" #: ../../library/os.rst:2946 msgid "" "The :attr:`name` attribute will be ``bytes`` if the :func:`scandir` *path* " -"argument is of type ``bytes`` and ``str`` otherwise. " -"Use :func:`~os.fsdecode` to decode byte filenames." +"argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." +"fsdecode` to decode byte filenames." msgstr "" #: ../../library/os.rst:2952 msgid "" -"The entry's full path name: equivalent to ``os.path.join(scandir_path, " -"entry.name)`` where *scandir_path* is the :func:`scandir` *path* argument. " -"The path is only absolute if the :func:`scandir` *path* argument was " -"absolute. If the :func:`scandir` *path* argument was a :ref:`file " -"descriptor `, the :attr:`path` attribute is the same as " -"the :attr:`name` attribute." +"The entry's full path name: equivalent to ``os.path.join(scandir_path, entry." +"name)`` where *scandir_path* is the :func:`scandir` *path* argument. The " +"path is only absolute if the :func:`scandir` *path* argument was absolute. " +"If the :func:`scandir` *path* argument was a :ref:`file descriptor " +"`, the :attr:`path` attribute is the same as the :attr:`name` " +"attribute." msgstr "" #: ../../library/os.rst:2959 msgid "" "The :attr:`path` attribute will be ``bytes`` if the :func:`scandir` *path* " -"argument is of type ``bytes`` and ``str`` otherwise. " -"Use :func:`~os.fsdecode` to decode byte filenames." +"argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." +"fsdecode` to decode byte filenames." msgstr "" #: ../../library/os.rst:2965 @@ -3332,9 +3320,8 @@ msgstr "" #: ../../library/os.rst:2967 msgid "" -"The result is cached on the ``os.DirEntry`` object. Use " -"``os.stat(entry.path, follow_symlinks=False).st_ino`` to fetch up-to-date " -"information." +"The result is cached on the ``os.DirEntry`` object. Use ``os.stat(entry." +"path, follow_symlinks=False).st_ino`` to fetch up-to-date information." msgstr "" #: ../../library/os.rst:2971 @@ -3376,8 +3363,8 @@ msgstr "" #: ../../library/os.rst:2995 ../../library/os.rst:3025 msgid "" -"This method can raise :exc:`OSError`, such as :exc:`PermissionError`, " -"but :exc:`FileNotFoundError` is caught and not raised." +"This method can raise :exc:`OSError`, such as :exc:`PermissionError`, but :" +"exc:`FileNotFoundError` is caught and not raised." msgstr "" #: ../../library/os.rst:3000 @@ -3409,8 +3396,8 @@ msgstr "" #: ../../library/os.rst:3017 msgid "" -"The result is cached on the ``os.DirEntry`` object. " -"Call :func:`os.path.islink` to fetch up-to-date information." +"The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." +"islink` to fetch up-to-date information." msgstr "" #: ../../library/os.rst:3020 @@ -3430,8 +3417,8 @@ msgstr "" #: ../../library/os.rst:3034 msgid "" -"The result is cached on the ``os.DirEntry`` object. " -"Call :func:`os.path.isjunction` to fetch up-to-date information." +"The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." +"isjunction` to fetch up-to-date information." msgstr "" #: ../../library/os.rst:3041 @@ -3450,8 +3437,8 @@ msgstr "" #: ../../library/os.rst:3050 msgid "" -"On Windows, the ``st_ino``, ``st_dev`` and ``st_nlink`` attributes of " -"the :class:`stat_result` are always set to zero. Call :func:`os.stat` to get " +"On Windows, the ``st_ino``, ``st_dev`` and ``st_nlink`` attributes of the :" +"class:`stat_result` are always set to zero. Call :func:`os.stat` to get " "these attributes." msgstr "" @@ -3472,8 +3459,8 @@ msgstr "" #: ../../library/os.rst:3066 msgid "" -"Added support for the :class:`~os.PathLike` interface. Added support " -"for :class:`bytes` paths on Windows." +"Added support for the :class:`~os.PathLike` interface. Added support for :" +"class:`bytes` paths on Windows." msgstr "" #: ../../library/os.rst:3070 @@ -3486,11 +3473,11 @@ msgstr "" #: ../../library/os.rst:3079 msgid "" -"Get the status of a file or a file descriptor. Perform the equivalent of " -"a :c:func:`stat` system call on the given path. *path* may be specified as " -"either a string or bytes -- directly or indirectly through " -"the :class:`PathLike` interface -- or as an open file descriptor. Return " -"a :class:`stat_result` object." +"Get the status of a file or a file descriptor. Perform the equivalent of a :" +"c:func:`stat` system call on the given path. *path* may be specified as " +"either a string or bytes -- directly or indirectly through the :class:" +"`PathLike` interface -- or as an open file descriptor. Return a :class:" +"`stat_result` object." msgstr "" #: ../../library/os.rst:3085 @@ -3503,8 +3490,8 @@ msgstr "" #: ../../library/os.rst:4183 ../../library/os.rst:4199 #: ../../library/os.rst:4219 msgid "" -"This function can support :ref:`specifying a file descriptor ` " -"and :ref:`not following symlinks `." +"This function can support :ref:`specifying a file descriptor ` and :" +"ref:`not following symlinks `." msgstr "" #: ../../library/os.rst:3091 @@ -3515,10 +3502,10 @@ msgid "" "the operating system is unable to follow will be opened directly. When " "following a chain of multiple links, this may result in the original link " "being returned instead of the non-link that prevented full traversal. To " -"obtain stat results for the final path in this case, use " -"the :func:`os.path.realpath` function to resolve the path name as far as " -"possible and call :func:`lstat` on the result. This does not apply to " -"dangling symlinks or junction points, which will raise the usual exceptions." +"obtain stat results for the final path in this case, use the :func:`os.path." +"realpath` function to resolve the path name as far as possible and call :" +"func:`lstat` on the result. This does not apply to dangling symlinks or " +"junction points, which will raise the usual exceptions." msgstr "" #: ../../library/os.rst:3104 ../../library/os.rst:3874 @@ -3567,9 +3554,9 @@ msgstr "" #: ../../library/os.rst:3137 msgid "" -"Object whose attributes correspond roughly to the members of " -"the :c:struct:`stat` structure. It is used for the result " -"of :func:`os.stat`, :func:`os.fstat` and :func:`os.lstat`." +"Object whose attributes correspond roughly to the members of the :c:struct:" +"`stat` structure. It is used for the result of :func:`os.stat`, :func:`os." +"fstat` and :func:`os.lstat`." msgstr "" #: ../../library/os.rst:3141 @@ -3682,26 +3669,25 @@ msgstr "" #: ../../library/os.rst:3241 msgid "" -"The exact meaning and resolution of " -"the :attr:`st_atime`, :attr:`st_mtime`, :attr:`st_ctime` " -"and :attr:`st_birthtime` attributes depend on the operating system and the " -"file system. For example, on Windows systems using the FAT32 file " -"systems, :attr:`st_mtime` has 2-second resolution, and :attr:`st_atime` has " -"only 1-day resolution. See your operating system documentation for details." +"The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, :" +"attr:`st_ctime` and :attr:`st_birthtime` attributes depend on the operating " +"system and the file system. For example, on Windows systems using the FAT32 " +"file systems, :attr:`st_mtime` has 2-second resolution, and :attr:`st_atime` " +"has only 1-day resolution. See your operating system documentation for " +"details." msgstr "" #: ../../library/os.rst:3248 msgid "" -"Similarly, " -"although :attr:`st_atime_ns`, :attr:`st_mtime_ns`, :attr:`st_ctime_ns` " -"and :attr:`st_birthtime_ns` are always expressed in nanoseconds, many " -"systems do not provide nanosecond precision. On systems that do provide " -"nanosecond precision, the floating-point object used to " -"store :attr:`st_atime`, :attr:`st_mtime`, :attr:`st_ctime` " -"and :attr:`st_birthtime` cannot preserve all of it, and as such will be " -"slightly inexact. If you need the exact timestamps you should always " -"use :attr:`st_atime_ns`, :attr:`st_mtime_ns`, :attr:`st_ctime_ns` " -"and :attr:`st_birthtime_ns`." +"Similarly, although :attr:`st_atime_ns`, :attr:`st_mtime_ns`, :attr:" +"`st_ctime_ns` and :attr:`st_birthtime_ns` are always expressed in " +"nanoseconds, many systems do not provide nanosecond precision. On systems " +"that do provide nanosecond precision, the floating-point object used to " +"store :attr:`st_atime`, :attr:`st_mtime`, :attr:`st_ctime` and :attr:" +"`st_birthtime` cannot preserve all of it, and as such will be slightly " +"inexact. If you need the exact timestamps you should always use :attr:" +"`st_atime_ns`, :attr:`st_mtime_ns`, :attr:`st_ctime_ns` and :attr:" +"`st_birthtime_ns`." msgstr "" #: ../../library/os.rst:3258 @@ -3712,8 +3698,8 @@ msgstr "" #: ../../library/os.rst:3263 msgid "" -"Number of 512-byte blocks allocated for file. This may be smaller " -"than :attr:`st_size`/512 when the file has holes." +"Number of 512-byte blocks allocated for file. This may be smaller than :attr:" +"`st_size`/512 when the file has holes." msgstr "" #: ../../library/os.rst:3268 @@ -3775,16 +3761,16 @@ msgstr "" msgid "" "Windows file attributes: ``dwFileAttributes`` member of the " "``BY_HANDLE_FILE_INFORMATION`` structure returned by :c:func:`!" -"GetFileInformationByHandle`. See the :const:`!FILE_ATTRIBUTE_* " -"` constants in the :mod:`stat` module." +"GetFileInformationByHandle`. See the :const:`!FILE_ATTRIBUTE_* ` constants in the :mod:`stat` module." msgstr "" #: ../../library/os.rst:3322 msgid "" -"When :attr:`st_file_attributes` has " -"the :const:`~stat.FILE_ATTRIBUTE_REPARSE_POINT` set, this field contains the " -"tag identifying the type of reparse point. See the :const:`IO_REPARSE_TAG_* " -"` constants in the :mod:`stat` module." +"When :attr:`st_file_attributes` has the :const:`~stat." +"FILE_ATTRIBUTE_REPARSE_POINT` set, this field contains the tag identifying " +"the type of reparse point. See the :const:`IO_REPARSE_TAG_* ` constants in the :mod:`stat` module." msgstr "" #: ../../library/os.rst:3327 @@ -3798,11 +3784,12 @@ msgstr "" msgid "" "For backward compatibility, a :class:`stat_result` instance is also " "accessible as a tuple of at least 10 integers giving the most important (and " -"portable) members of the :c:struct:`stat` structure, in the " -"order :attr:`st_mode`, :attr:`st_ino`, :attr:`st_dev`, :attr:`st_nlink`, :attr:`st_uid`, :attr:`st_gid`, :attr:`st_size`, :attr:`st_atime`, :attr:`st_mtime`, :attr:`st_ctime`. " -"More items may be added at the end by some implementations. For " -"compatibility with older Python versions, accessing :class:`stat_result` as " -"a tuple always returns integers." +"portable) members of the :c:struct:`stat` structure, in the order :attr:" +"`st_mode`, :attr:`st_ino`, :attr:`st_dev`, :attr:`st_nlink`, :attr:" +"`st_uid`, :attr:`st_gid`, :attr:`st_size`, :attr:`st_atime`, :attr:" +"`st_mtime`, :attr:`st_ctime`. More items may be added at the end by some " +"implementations. For compatibility with older Python versions, accessing :" +"class:`stat_result` as a tuple always returns integers." msgstr "" #: ../../library/os.rst:3340 @@ -3819,8 +3806,8 @@ msgstr "在 Windows 上新增 :attr:`st_reparse_tag` 成員。" #: ../../library/os.rst:3350 msgid "" -"On Windows, the :attr:`st_mode` member now identifies special files " -"as :const:`S_IFCHR`, :const:`S_IFIFO` or :const:`S_IFBLK` as appropriate." +"On Windows, the :attr:`st_mode` member now identifies special files as :" +"const:`S_IFCHR`, :const:`S_IFIFO` or :const:`S_IFBLK` as appropriate." msgstr "" #: ../../library/os.rst:3355 @@ -3852,7 +3839,9 @@ msgid "" "Perform a :c:func:`!statvfs` system call on the given path. The return " "value is an object whose attributes describe the filesystem on the given " "path, and correspond to the members of the :c:struct:`statvfs` structure, " -"namely: :attr:`f_bsize`, :attr:`f_frsize`, :attr:`f_blocks`, :attr:`f_bfree`, :attr:`f_bavail`, :attr:`f_files`, :attr:`f_ffree`, :attr:`f_favail`, :attr:`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`." +"namely: :attr:`f_bsize`, :attr:`f_frsize`, :attr:`f_blocks`, :attr:" +"`f_bfree`, :attr:`f_bavail`, :attr:`f_files`, :attr:`f_ffree`, :attr:" +"`f_favail`, :attr:`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`." msgstr "" #: ../../library/os.rst:3380 @@ -3866,15 +3855,14 @@ msgstr "" #: ../../library/os.rst:3385 msgid "" "Additional module-level constants are defined for GNU/glibc based systems. " -"These are :const:`ST_NODEV` (disallow access to device special " -"files), :const:`ST_NOEXEC` (disallow program " -"execution), :const:`ST_SYNCHRONOUS` (writes are synced at " -"once), :const:`ST_MANDLOCK` (allow mandatory locks on an " -"FS), :const:`ST_WRITE` (write on file/directory/symlink), :const:`ST_APPEND` " -"(append-only file), :const:`ST_IMMUTABLE` (immutable " -"file), :const:`ST_NOATIME` (do not update access " -"times), :const:`ST_NODIRATIME` (do not update directory access " -"times), :const:`ST_RELATIME` (update atime relative to mtime/ctime)." +"These are :const:`ST_NODEV` (disallow access to device special files), :" +"const:`ST_NOEXEC` (disallow program execution), :const:`ST_SYNCHRONOUS` " +"(writes are synced at once), :const:`ST_MANDLOCK` (allow mandatory locks on " +"an FS), :const:`ST_WRITE` (write on file/directory/symlink), :const:" +"`ST_APPEND` (append-only file), :const:`ST_IMMUTABLE` (immutable file), :" +"const:`ST_NOATIME` (do not update access times), :const:`ST_NODIRATIME` (do " +"not update directory access times), :const:`ST_RELATIME` (update atime " +"relative to mtime/ctime)." msgstr "" #: ../../library/os.rst:3398 @@ -3883,8 +3871,10 @@ msgstr "新增 :const:`ST_RDONLY` 與 :const:`ST_NOSUID` 常數。" #: ../../library/os.rst:3404 msgid "" -"The :const:`ST_NODEV`, :const:`ST_NOEXEC`, :const:`ST_SYNCHRONOUS`, :const:`ST_MANDLOCK`, :const:`ST_WRITE`, :const:`ST_APPEND`, :const:`ST_IMMUTABLE`, :const:`ST_NOATIME`, :const:`ST_NODIRATIME`, " -"and :const:`ST_RELATIME` constants were added." +"The :const:`ST_NODEV`, :const:`ST_NOEXEC`, :const:`ST_SYNCHRONOUS`, :const:" +"`ST_MANDLOCK`, :const:`ST_WRITE`, :const:`ST_APPEND`, :const:" +"`ST_IMMUTABLE`, :const:`ST_NOATIME`, :const:`ST_NODIRATIME`, and :const:" +"`ST_RELATIME` constants were added." msgstr "" #: ../../library/os.rst:3413 @@ -3926,8 +3916,8 @@ msgid "" "A :class:`set` object indicating whether :func:`os.access` permits " "specifying ``True`` for its *effective_ids* parameter on the local platform. " "(Specifying ``False`` for *effective_ids* is always supported on all " -"platforms.) If the local platform supports it, the collection will " -"contain :func:`os.access`; otherwise it will be empty." +"platforms.) If the local platform supports it, the collection will contain :" +"func:`os.access`; otherwise it will be empty." msgstr "" #: ../../library/os.rst:3450 @@ -3959,8 +3949,8 @@ msgstr "" msgid "" "To determine whether a particular function permits specifying an open file " "descriptor for its *path* parameter, use the ``in`` operator on " -"``supports_fd``. As an example, this expression evaluates to ``True`` " -"if :func:`os.chdir` accepts open file descriptors for *path* on your local " +"``supports_fd``. As an example, this expression evaluates to ``True`` if :" +"func:`os.chdir` accepts open file descriptors for *path* on your local " "platform::" msgstr "" @@ -3986,8 +3976,8 @@ msgid "" "To check whether a particular function accepts ``False`` for its " "*follow_symlinks* parameter, use the ``in`` operator on " "``supports_follow_symlinks``. As an example, this expression evaluates to " -"``True`` if you may specify ``follow_symlinks=False`` when " -"calling :func:`os.stat` on the local platform::" +"``True`` if you may specify ``follow_symlinks=False`` when calling :func:`os." +"stat` on the local platform::" msgstr "" #: ../../library/os.rst:3499 @@ -4054,8 +4044,8 @@ msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``path``, ``length``." msgstr "" -"引發一個附帶引數 ``path``、``length`` 的\\ :ref:`稽核事件 ` " -"``os.truncate``。" +"引發一個附帶引數 ``path``、``length`` 的\\ :ref:`稽核事件 ` ``os." +"truncate``。" #: ../../library/os.rst:3580 msgid "" @@ -4098,12 +4088,12 @@ msgstr "" #: ../../library/os.rst:3613 msgid "" -"Note that the exact times you set here may not be returned by a " -"subsequent :func:`~os.stat` call, depending on the resolution with which " -"your operating system records access and modification times; " -"see :func:`~os.stat`. The best way to preserve exact times is to use the " -"*st_atime_ns* and *st_mtime_ns* fields from the :func:`os.stat` result " -"object with the *ns* parameter to :func:`utime`." +"Note that the exact times you set here may not be returned by a subsequent :" +"func:`~os.stat` call, depending on the resolution with which your operating " +"system records access and modification times; see :func:`~os.stat`. The best " +"way to preserve exact times is to use the *st_atime_ns* and *st_mtime_ns* " +"fields from the :func:`os.stat` result object with the *ns* parameter to :" +"func:`utime`." msgstr "" #: ../../library/os.rst:3624 @@ -4243,8 +4233,8 @@ msgid "" "Raises an :ref:`auditing event ` ``os.walk`` with arguments " "``top``, ``topdown``, ``onerror``, ``followlinks``." msgstr "" -"引發一個附帶引數 ``top``、``topdown``、``onerror``、``followlinks`` 的" -"\\ :ref:`稽核事件 ` ``os.walk``。" +"引發一個附帶引數 ``top``、``topdown``、``onerror``、``followlinks`` 的\\ :" +"ref:`稽核事件 ` ``os.walk``。" #: ../../library/os.rst:3726 msgid "" @@ -4283,9 +4273,9 @@ msgstr "" msgid "" "import os\n" "for root, dirs, files, rootfd in os.fwalk('python/Lib/xml'):\n" -" print(root, \"consumes\", end=\"\")\n" +" print(root, \"consumes\", end=\" \")\n" " print(sum([os.stat(name, dir_fd=rootfd).st_size for name in files]),\n" -" end=\"\")\n" +" end=\" \")\n" " print(\"bytes in\", len(files), \"non-directory files\")\n" " if '__pycache__' in dirs:\n" " dirs.remove('__pycache__') # don't visit __pycache__ directories" @@ -4352,10 +4342,10 @@ msgstr "``MFD_HUGE*`` 旗標僅在 Linux 4.14 以上可用。" #: ../../library/os.rst:3846 msgid "" "Create and return an event file descriptor. The file descriptors supports " -"raw :func:`read` and :func:`write` with a buffer size of " -"8, :func:`~select.select`, :func:`~select.poll` and similar. See man " -"page :manpage:`eventfd(2)` for more information. By default, the new file " -"descriptor is :ref:`non-inheritable `." +"raw :func:`read` and :func:`write` with a buffer size of 8, :func:`~select." +"select`, :func:`~select.poll` and similar. See man page :manpage:" +"`eventfd(2)` for more information. By default, the new file descriptor is :" +"ref:`non-inheritable `." msgstr "" #: ../../library/os.rst:3852 @@ -4374,8 +4364,8 @@ msgstr "" #: ../../library/os.rst:3860 msgid "" -"If :const:`EFD_SEMAPHORE` is specified and the event counter is non-" -"zero, :func:`eventfd_read` returns 1 and decrements the counter by one." +"If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero, :" +"func:`eventfd_read` returns 1 and decrements the counter by one." msgstr "" #: ../../library/os.rst:3863 @@ -4387,15 +4377,15 @@ msgstr "" #: ../../library/os.rst:3867 msgid "" -"If the event counter is zero and :const:`EFD_NONBLOCK` is not " -"specified, :func:`eventfd_read` blocks." +"If the event counter is zero and :const:`EFD_NONBLOCK` is not specified, :" +"func:`eventfd_read` blocks." msgstr "" #: ../../library/os.rst:3870 msgid "" ":func:`eventfd_write` increments the event counter. Write blocks if the " -"write operation would increment the counter to a value larger than " -"2\\ :sup:`64`\\ -\\ 2." +"write operation would increment the counter to a value larger than 2\\ :sup:" +"`64`\\ -\\ 2." msgstr "" #: ../../library/os.rst:3876 @@ -4445,7 +4435,7 @@ msgstr "" #: ../../library/os.rst:3943 msgid "Timer File Descriptors" -msgstr "" +msgstr "計時器檔案描述器" #: ../../library/os.rst:3947 msgid "" @@ -4478,8 +4468,8 @@ msgid "" "The file descriptor's :func:`read` method can be called with a buffer size " "of 8. If the timer has already expired one or more times, :func:`read` " "returns the number of expirations with the host's endianness, which may be " -"converted to an :class:`int` by ``int.from_bytes(x, " -"byteorder=sys.byteorder)``." +"converted to an :class:`int` by ``int.from_bytes(x, byteorder=sys." +"byteorder)``." msgstr "" #: ../../library/os.rst:3965 @@ -4510,8 +4500,8 @@ msgstr "" msgid "" "If *clockid* is :const:`time.CLOCK_REALTIME`, a settable system-wide real-" "time clock is used. If system clock is changed, timer setting need to be " -"updated. To cancel timer when system clock is changed, " -"see :const:`TFD_TIMER_CANCEL_ON_SET`." +"updated. To cancel timer when system clock is changed, see :const:" +"`TFD_TIMER_CANCEL_ON_SET`." msgstr "" #: ../../library/os.rst:3980 @@ -4523,9 +4513,8 @@ msgstr "" #: ../../library/os.rst:3984 msgid "" -"If *clockid* is :const:`time.CLOCK_BOOTTIME`, same " -"as :const:`time.CLOCK_MONOTONIC` except it includes any time that the system " -"is suspended." +"If *clockid* is :const:`time.CLOCK_BOOTTIME`, same as :const:`time." +"CLOCK_MONOTONIC` except it includes any time that the system is suspended." msgstr "" #: ../../library/os.rst:3987 @@ -4553,7 +4542,7 @@ msgstr "" #: ../../library/os.rst:4000 msgid ":const:`TFD_CLOEXEC` is always set by Python automatically." -msgstr "" +msgstr ":const:`TFD_CLOEXEC` 總是由 Python 自動設定。" #: ../../library/os.rst:4002 msgid "" @@ -4573,7 +4562,7 @@ msgstr "" #: ../../library/os.rst:4017 msgid "*fd* must be a valid timer file descriptor." -msgstr "" +msgstr "*fd* 必須是有效的計時器檔案描述器。" #: ../../library/os.rst:4019 msgid "" @@ -4594,8 +4583,8 @@ msgstr ":const:`TFD_TIMER_CANCEL_ON_SET`" msgid "" "The timer is disabled by setting *initial* to zero (``0``). If *initial* is " "equal to or greater than zero, the timer is enabled. If *initial* is less " -"than zero, it raises an :class:`OSError` exception with ``errno`` set " -"to :const:`errno.EINVAL`" +"than zero, it raises an :class:`OSError` exception with ``errno`` set to :" +"const:`errno.EINVAL`" msgstr "" #: ../../library/os.rst:4031 @@ -4617,17 +4606,17 @@ msgid "" "*interval* is zero, the timer only fires once, on the initial expiration. If " "*interval* is greater than zero, the timer fires every time *interval* " "seconds have elapsed since the previous expiration. If *interval* is less " -"than zero, it raises :class:`OSError` with ``errno`` set " -"to :const:`errno.EINVAL`" +"than zero, it raises :class:`OSError` with ``errno`` set to :const:`errno." +"EINVAL`" msgstr "" #: ../../library/os.rst:4045 msgid "" -"If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along " -"with :const:`TFD_TIMER_ABSTIME` and the clock for this timer " -"is :const:`time.CLOCK_REALTIME`, the timer is marked as cancelable if the " -"real-time clock is changed discontinuously. Reading the descriptor is " -"aborted with the error ECANCELED." +"If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along with :const:" +"`TFD_TIMER_ABSTIME` and the clock for this timer is :const:`time." +"CLOCK_REALTIME`, the timer is marked as cancelable if the real-time clock is " +"changed discontinuously. Reading the descriptor is aborted with the error " +"ECANCELED." msgstr "" #: ../../library/os.rst:4051 @@ -4662,8 +4651,8 @@ msgstr "" #: ../../library/os.rst:4066 msgid "" -":manpage:`timerfd_create(2)`, :manpage:`timerfd_settime(2)`, :manpage:`settimeofday(2)`, :manpage:`clock_settime(2)`, " -"and :manpage:`date(1)`." +":manpage:`timerfd_create(2)`, :manpage:`timerfd_settime(2)`, :manpage:" +"`settimeofday(2)`, :manpage:`clock_settime(2)`, and :manpage:`date(1)`." msgstr "" #: ../../library/os.rst:4077 @@ -4698,9 +4687,9 @@ msgstr "" #: ../../library/os.rst:4113 msgid "" -"A flag for the :func:`timerfd_create` function, which sets " -"the :const:`O_NONBLOCK` status flag for the new timer file descriptor. " -"If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks." +"A flag for the :func:`timerfd_create` function, which sets the :const:" +"`O_NONBLOCK` status flag for the new timer file descriptor. If :const:" +"`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks." msgstr "" #: ../../library/os.rst:4123 @@ -4735,9 +4724,9 @@ msgstr "" #: ../../library/os.rst:4162 msgid "" "Return the value of the extended filesystem attribute *attribute* for " -"*path*. *attribute* can be bytes or str (directly or indirectly through " -"the :class:`PathLike` interface). If it is str, it is encoded with the " -"filesystem encoding." +"*path*. *attribute* can be bytes or str (directly or indirectly through the :" +"class:`PathLike` interface). If it is str, it is encoded with the filesystem " +"encoding." msgstr "" #: ../../library/os.rst:4170 @@ -4771,9 +4760,9 @@ msgstr "" #: ../../library/os.rst:4194 msgid "" "Removes the extended filesystem attribute *attribute* from *path*. " -"*attribute* should be bytes or str (directly or indirectly through " -"the :class:`PathLike` interface). If it is a string, it is encoded with " -"the :term:`filesystem encoding and error handler`." +"*attribute* should be bytes or str (directly or indirectly through the :" +"class:`PathLike` interface). If it is a string, it is encoded with the :term:" +"`filesystem encoding and error handler`." msgstr "" #: ../../library/os.rst:4202 @@ -4791,9 +4780,9 @@ msgid "" "indirectly through the :class:`PathLike` interface). If it is a str, it is " "encoded with the :term:`filesystem encoding and error handler`. *flags* may " "be :data:`XATTR_REPLACE` or :data:`XATTR_CREATE`. If :data:`XATTR_REPLACE` " -"is given and the attribute does not exist, ``ENODATA`` will be raised. " -"If :data:`XATTR_CREATE` is given and the attribute already exists, the " -"attribute will not be created and ``EEXISTS`` will be raised." +"is given and the attribute does not exist, ``ENODATA`` will be raised. If :" +"data:`XATTR_CREATE` is given and the attribute already exists, the attribute " +"will not be created and ``EEXISTS`` will be raised." msgstr "" #: ../../library/os.rst:4224 @@ -4852,8 +4841,8 @@ msgid "" "Generate a :const:`SIGABRT` signal to the current process. On Unix, the " "default behavior is to produce a core dump; on Windows, the process " "immediately returns an exit code of ``3``. Be aware that calling this " -"function will not call the Python signal handler registered " -"for :const:`SIGABRT` with :func:`signal.signal`." +"function will not call the Python signal handler registered for :const:" +"`SIGABRT` with :func:`signal.signal`." msgstr "" #: ../../library/os.rst:4278 @@ -4875,9 +4864,9 @@ msgstr "" #: ../../library/os.rst:4287 msgid "" -"See the `Microsoft documentation `_ for more information about how DLLs " -"are loaded." +"See the `Microsoft documentation `_ for more information about how " +"DLLs are loaded." msgstr "" #: ../../library/os.rst:4291 @@ -4885,8 +4874,8 @@ msgid "" "Raises an :ref:`auditing event ` ``os.add_dll_directory`` with " "argument ``path``." msgstr "" -"引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` " -"``os.add_dll_directory``。" +"引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os." +"add_dll_directory``。" #: ../../library/os.rst:4295 msgid "" @@ -4915,8 +4904,8 @@ msgstr "" msgid "" "The current process is replaced immediately. Open file objects and " "descriptors are not flushed, so if there may be data buffered on these open " -"files, you should flush them using :func:`sys.stdout.flush` " -"or :func:`os.fsync` before calling an :func:`exec\\* ` function." +"files, you should flush them using :func:`sys.stdout.flush` or :func:`os." +"fsync` before calling an :func:`exec\\* ` function." msgstr "" #: ../../library/os.rst:4328 @@ -4934,17 +4923,16 @@ msgstr "" #: ../../library/os.rst:4337 msgid "" -"The variants which include a \"p\" near the end " -"(:func:`execlp`, :func:`execlpe`, :func:`execvp`, and :func:`execvpe`) will " -"use the :envvar:`PATH` environment variable to locate the program *file*. " -"When the environment is being replaced (using one of the :func:`exec\\*e " -"` variants, discussed in the next paragraph), the new environment is " -"used as the source of the :envvar:`PATH` variable. The other " -"variants, :func:`execl`, :func:`execle`, :func:`execv`, and :func:`execve`, " -"will not use the :envvar:`PATH` variable to locate the executable; *path* " -"must contain an appropriate absolute or relative path. Relative paths must " -"include at least one slash, even on Windows, as plain names will not be " -"resolved." +"The variants which include a \"p\" near the end (:func:`execlp`, :func:" +"`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the :envvar:`PATH` " +"environment variable to locate the program *file*. When the environment is " +"being replaced (using one of the :func:`exec\\*e ` variants, " +"discussed in the next paragraph), the new environment is used as the source " +"of the :envvar:`PATH` variable. The other variants, :func:`execl`, :func:" +"`execle`, :func:`execv`, and :func:`execve`, will not use the :envvar:`PATH` " +"variable to locate the executable; *path* must contain an appropriate " +"absolute or relative path. Relative paths must include at least one slash, " +"even on Windows, as plain names will not be resolved." msgstr "" #: ../../library/os.rst:4348 @@ -4952,18 +4940,18 @@ msgid "" "For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " "which is used to define the environment variables for the new process (these " -"are used instead of the current process' environment); the " -"functions :func:`execl`, :func:`execlp`, :func:`execv`, and :func:`execvp` " -"all cause the new process to inherit the environment of the current process." +"are used instead of the current process' environment); the functions :func:" +"`execl`, :func:`execlp`, :func:`execv`, and :func:`execvp` all cause the new " +"process to inherit the environment of the current process." msgstr "" #: ../../library/os.rst:4355 msgid "" "For :func:`execve` on some platforms, *path* may also be specified as an " "open file descriptor. This functionality may not be supported on your " -"platform; you can check whether or not it is available " -"using :data:`os.supports_fd`. If it is unavailable, using it will raise " -"a :exc:`NotImplementedError`." +"platform; you can check whether or not it is available using :data:`os." +"supports_fd`. If it is unavailable, using it will raise a :exc:" +"`NotImplementedError`." msgstr "" #: ../../library/os.rst:4360 @@ -4976,8 +4964,8 @@ msgstr "" #: ../../library/os.rst:4364 msgid "" -"Added support for specifying *path* as an open file descriptor " -"for :func:`execve`." +"Added support for specifying *path* as an open file descriptor for :func:" +"`execve`." msgstr "" #: ../../library/os.rst:4373 @@ -5122,14 +5110,14 @@ msgstr "" #: ../../library/os.rst:4539 msgid "" -"Calling ``fork()`` in a subinterpreter is no longer supported " -"(:exc:`RuntimeError` is raised)." +"Calling ``fork()`` in a subinterpreter is no longer supported (:exc:" +"`RuntimeError` is raised)." msgstr "" #: ../../library/os.rst:4543 msgid "" -"If Python is able to detect that your process has multiple " -"threads, :func:`os.fork` now raises a :exc:`DeprecationWarning`." +"If Python is able to detect that your process has multiple threads, :func:" +"`os.fork` now raises a :exc:`DeprecationWarning`." msgstr "" #: ../../library/os.rst:4547 @@ -5173,15 +5161,15 @@ msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.for #: ../../library/os.rst:4583 msgid "" -"Calling ``forkpty()`` in a subinterpreter is no longer supported " -"(:exc:`RuntimeError` is raised)." +"Calling ``forkpty()`` in a subinterpreter is no longer supported (:exc:" +"`RuntimeError` is raised)." msgstr "" #: ../../library/os.rst:4587 msgid "" "If Python is able to detect that your process has multiple threads, this now " -"raises a :exc:`DeprecationWarning`. See the longer explanation " -"on :func:`os.fork`." +"raises a :exc:`DeprecationWarning`. See the longer explanation on :func:`os." +"fork`." msgstr "" #: ../../library/os.rst:4601 @@ -5192,10 +5180,10 @@ msgstr "" #: ../../library/os.rst:4604 msgid "" -"Windows: The :const:`signal.CTRL_C_EVENT` " -"and :const:`signal.CTRL_BREAK_EVENT` signals are special signals which can " -"only be sent to console processes which share a common console window, e.g., " -"some subprocesses. Any other value for *sig* will cause the process to be " +"Windows: The :const:`signal.CTRL_C_EVENT` and :const:`signal." +"CTRL_BREAK_EVENT` signals are special signals which can only be sent to " +"console processes which share a common console window, e.g., some " +"subprocesses. Any other value for *sig* will cause the process to be " "unconditionally killed by the TerminateProcess API, and the exit code will " "be set to *sig*." msgstr "" @@ -5209,8 +5197,8 @@ msgid "" "Raises an :ref:`auditing event ` ``os.kill`` with arguments " "``pid``, ``sig``." msgstr "" -"引發一個附帶引數 ``pid``、``sig`` 的\\ :ref:`稽核事件 ` " -"``os.kill``。" +"引發一個附帶引數 ``pid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." +"kill``。" #: ../../library/os.rst:4627 msgid "Send the signal *sig* to the process group *pgid*." @@ -5221,8 +5209,8 @@ msgid "" "Raises an :ref:`auditing event ` ``os.killpg`` with arguments " "``pgid``, ``sig``." msgstr "" -"引發一個附帶引數 ``pgid``、``sig`` 的\\ :ref:`稽核事件 ` " -"``os.killpg``。" +"引發一個附帶引數 ``pgid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." +"killpg``。" #: ../../library/os.rst:4636 msgid "" @@ -5259,9 +5247,9 @@ msgid "" "Open a pipe to or from command *cmd*. The return value is an open file " "object connected to the pipe, which can be read or written depending on " "whether *mode* is ``'r'`` (default) or ``'w'``. The *buffering* argument " -"have the same meaning as the corresponding argument to the built-" -"in :func:`open` function. The returned file object reads or writes text " -"strings rather than bytes." +"have the same meaning as the corresponding argument to the built-in :func:" +"`open` function. The returned file object reads or writes text strings " +"rather than bytes." msgstr "" #: ../../library/os.rst:4681 @@ -5298,9 +5286,9 @@ msgstr "" #: ../../library/os.rst:4706 msgid "" -":func:`popen` is a simple wrapper around :class:`subprocess.Popen`. " -"Use :class:`subprocess.Popen` or :func:`subprocess.run` to control options " -"like encodings." +":func:`popen` is a simple wrapper around :class:`subprocess.Popen`. Use :" +"class:`subprocess.Popen` or :func:`subprocess.run` to control options like " +"encodings." msgstr "" #: ../../library/os.rst:4710 @@ -5320,9 +5308,9 @@ msgstr "" #: ../../library/os.rst:4723 msgid "" -"The positional-only arguments *path*, *args*, and *env* are similar " -"to :func:`execve`. *env* is allowed to be ``None``, in which case current " -"process' environment is used." +"The positional-only arguments *path*, *args*, and *env* are similar to :func:" +"`execve`. *env* is allowed to be ``None``, in which case current process' " +"environment is used." msgstr "" #: ../../library/os.rst:4727 @@ -5379,8 +5367,8 @@ msgid "" "posix_spawn_file_actions_addopen`, :c:func:`!" "posix_spawn_file_actions_addclose`, :c:func:`!" "posix_spawn_file_actions_adddup2`, and :c:func:`!" -"posix_spawn_file_actions_addclosefrom_np` API calls used to prepare for " -"the :c:func:`!posix_spawn` call itself." +"posix_spawn_file_actions_addclosefrom_np` API calls used to prepare for the :" +"c:func:`!posix_spawn` call itself." msgstr "" #: ../../library/os.rst:4768 @@ -5406,9 +5394,9 @@ msgstr "" #: ../../library/os.rst:4782 msgid "" "If the *setsid* argument is ``True``, it will create a new session ID for " -"``posix_spawn``. *setsid* requires :c:macro:`!POSIX_SPAWN_SETSID` " -"or :c:macro:`!POSIX_SPAWN_SETSID_NP` flag. " -"Otherwise, :exc:`NotImplementedError` is raised." +"``posix_spawn``. *setsid* requires :c:macro:`!POSIX_SPAWN_SETSID` or :c:" +"macro:`!POSIX_SPAWN_SETSID_NP` flag. Otherwise, :exc:`NotImplementedError` " +"is raised." msgstr "" #: ../../library/os.rst:4787 @@ -5468,9 +5456,9 @@ msgstr "見 :func:`posix_spawn` 文件。" #: ../../library/os.rst:4836 msgid "" -"Register callables to be executed when a new child process is forked " -"using :func:`os.fork` or similar process cloning APIs. The parameters are " -"optional and keyword-only. Each specifies a different call point." +"Register callables to be executed when a new child process is forked using :" +"func:`os.fork` or similar process cloning APIs. The parameters are optional " +"and keyword-only. Each specifies a different call point." msgstr "" #: ../../library/os.rst:4841 @@ -5504,9 +5492,8 @@ msgstr "" #: ../../library/os.rst:4855 msgid "" "Note that :c:func:`fork` calls made by third-party C code may not call those " -"functions, unless it explicitly " -"calls :c:func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` " -"and :c:func:`PyOS_AfterFork_Child`." +"functions, unless it explicitly calls :c:func:`PyOS_BeforeFork`, :c:func:" +"`PyOS_AfterFork_Parent` and :c:func:`PyOS_AfterFork_Child`." msgstr "" #: ../../library/os.rst:4859 @@ -5521,8 +5508,8 @@ msgstr "" msgid "" "(Note that the :mod:`subprocess` module provides more powerful facilities " "for spawning new processes and retrieving their results; using that module " -"is preferable to using these functions. Check especially " -"the :ref:`subprocess-replacements` section.)" +"is preferable to using these functions. Check especially the :ref:" +"`subprocess-replacements` section.)" msgstr "" #: ../../library/os.rst:4882 @@ -5554,15 +5541,15 @@ msgstr "" #: ../../library/os.rst:4900 msgid "" -"The variants which include a second \"p\" near the end " -"(:func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) " -"will use the :envvar:`PATH` environment variable to locate the program " -"*file*. When the environment is being replaced (using one of " -"the :func:`spawn\\*e ` variants, discussed in the next paragraph), " -"the new environment is used as the source of the :envvar:`PATH` variable. " -"The other variants, :func:`spawnl`, :func:`spawnle`, :func:`spawnv`, " -"and :func:`spawnve`, will not use the :envvar:`PATH` variable to locate the " -"executable; *path* must contain an appropriate absolute or relative path." +"The variants which include a second \"p\" near the end (:func:`spawnlp`, :" +"func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the :envvar:" +"`PATH` environment variable to locate the program *file*. When the " +"environment is being replaced (using one of the :func:`spawn\\*e ` " +"variants, discussed in the next paragraph), the new environment is used as " +"the source of the :envvar:`PATH` variable. The other variants, :func:" +"`spawnl`, :func:`spawnle`, :func:`spawnv`, and :func:`spawnve`, will not use " +"the :envvar:`PATH` variable to locate the executable; *path* must contain an " +"appropriate absolute or relative path." msgstr "" #: ../../library/os.rst:4910 @@ -5570,12 +5557,11 @@ msgid "" "For :func:`spawnle`, :func:`spawnlpe`, :func:`spawnve`, and :func:`spawnvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " "which is used to define the environment variables for the new process (they " -"are used instead of the current process' environment); the " -"functions :func:`spawnl`, :func:`spawnlp`, :func:`spawnv`, " -"and :func:`spawnvp` all cause the new process to inherit the environment of " -"the current process. Note that keys and values in the *env* dictionary must " -"be strings; invalid keys or values will cause the function to fail, with a " -"return value of ``127``." +"are used instead of the current process' environment); the functions :func:" +"`spawnl`, :func:`spawnlp`, :func:`spawnv`, and :func:`spawnvp` all cause the " +"new process to inherit the environment of the current process. Note that " +"keys and values in the *env* dictionary must be strings; invalid keys or " +"values will cause the function to fail, with a return value of ``127``." msgstr "" #: ../../library/os.rst:4919 @@ -5623,9 +5609,9 @@ msgstr "" #: ../../library/os.rst:4948 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " -"family of functions. If either of these values is given, " -"the :func:`spawn\\* ` functions will return as soon as the new " -"process has been created, with the process id as the return value." +"family of functions. If either of these values is given, the :func:" +"`spawn\\* ` functions will return as soon as the new process has " +"been created, with the process id as the return value." msgstr "" #: ../../library/os.rst:4958 @@ -5640,11 +5626,11 @@ msgstr "" #: ../../library/os.rst:4970 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " -"family of functions. These are less portable than those listed " -"above. :const:`P_DETACH` is similar to :const:`P_NOWAIT`, but the new " -"process is detached from the console of the calling process. " -"If :const:`P_OVERLAY` is used, the current process will be replaced; " -"the :func:`spawn\\* ` function will not return." +"family of functions. These are less portable than those listed above. :" +"const:`P_DETACH` is similar to :const:`P_NOWAIT`, but the new process is " +"detached from the console of the calling process. If :const:`P_OVERLAY` is " +"used, the current process will be replaced; the :func:`spawn\\* ` " +"function will not return." msgstr "" #: ../../library/os.rst:4981 @@ -5654,9 +5640,9 @@ msgstr "" #: ../../library/os.rst:4983 msgid "" "When *operation* is not specified, this acts like double-clicking the file " -"in Windows Explorer, or giving the file name as an argument to " -"the :program:`start` command from the interactive command shell: the file is " -"opened with whatever application (if any) its extension is associated." +"in Windows Explorer, or giving the file name as an argument to the :program:" +"`start` command from the interactive command shell: the file is opened with " +"whatever application (if any) its extension is associated." msgstr "" #: ../../library/os.rst:4988 @@ -5724,8 +5710,8 @@ msgstr "" #: ../../library/os.rst:5023 msgid "" -"Added the *arguments*, *cwd* and *show_cmd* arguments, and the " -"``os.startfile/2`` audit event." +"Added the *arguments*, *cwd* and *show_cmd* arguments, and the ``os." +"startfile/2`` audit event." msgstr "" #: ../../library/os.rst:5030 @@ -5748,10 +5734,10 @@ msgstr "" #: ../../library/os.rst:5041 msgid "" "On Windows, the return value is that returned by the system shell after " -"running *command*. The shell is given by the Windows environment " -"variable :envvar:`COMSPEC`: it is usually :program:`cmd.exe`, which returns " -"the exit status of the command run; on systems using a non-native shell, " -"consult your shell documentation." +"running *command*. The shell is given by the Windows environment variable :" +"envvar:`COMSPEC`: it is usually :program:`cmd.exe`, which returns the exit " +"status of the command run; on systems using a non-native shell, consult your " +"shell documentation." msgstr "" #: ../../library/os.rst:5047 @@ -5811,8 +5797,8 @@ msgstr "" #: ../../library/os.rst:5076 msgid "" -"See the Unix manual page :manpage:`times(2)` and `times(3) `_ manual page on Unix or `the " +"See the Unix manual page :manpage:`times(2)` and `times(3) `_ manual page on Unix or `the " "GetProcessTimes MSDN `_ on Windows. On " "Windows, only :attr:`!user` and :attr:`!system` are known; the other " @@ -5843,8 +5829,8 @@ msgstr "" #: ../../library/os.rst:5106 msgid "" "The other :func:`!wait*` functions documented below can be used to wait for " -"the completion of a specific child process and have more " -"options. :func:`waitpid` is the only one also available on Windows." +"the completion of a specific child process and have more options. :func:" +"`waitpid` is the only one also available on Windows." msgstr "" #: ../../library/os.rst:5113 @@ -5853,22 +5839,22 @@ msgstr "" #: ../../library/os.rst:5115 msgid "" -"*idtype* can be :data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or (on " -"Linux) :data:`P_PIDFD`. The interpretation of *id* depends on it; see their " +"*idtype* can be :data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or (on Linux) :" +"data:`P_PIDFD`. The interpretation of *id* depends on it; see their " "individual descriptions." msgstr "" #: ../../library/os.rst:5118 msgid "" -"*options* is an OR combination of flags. At least one " -"of :data:`WEXITED`, :data:`WSTOPPED` or :data:`WCONTINUED` is " -"required; :data:`WNOHANG` and :data:`WNOWAIT` are additional optional flags." +"*options* is an OR combination of flags. At least one of :data:`WEXITED`, :" +"data:`WSTOPPED` or :data:`WCONTINUED` is required; :data:`WNOHANG` and :data:" +"`WNOWAIT` are additional optional flags." msgstr "" #: ../../library/os.rst:5122 msgid "" -"The return value is an object representing the data contained in " -"the :c:type:`siginfo_t` structure with the following attributes:" +"The return value is an object representing the data contained in the :c:type:" +"`siginfo_t` structure with the following attributes:" msgstr "" #: ../../library/os.rst:5125 @@ -5943,9 +5929,9 @@ msgid "" "bits (shifting makes cross-platform use of the function easier). A *pid* " "less than or equal to ``0`` has no special meaning on Windows, and raises an " "exception. The value of integer *options* has no effect. *pid* can refer to " -"any process whose id is known, not necessarily a child process. " -"The :func:`spawn\\* ` functions called with :const:`P_NOWAIT` return " -"suitable process handles." +"any process whose id is known, not necessarily a child process. The :func:" +"`spawn\\* ` functions called with :const:`P_NOWAIT` return suitable " +"process handles." msgstr "" #: ../../library/os.rst:5187 @@ -6006,8 +5992,8 @@ msgstr "" #: ../../library/os.rst:5239 msgid "" -"This *options* flag for :func:`waitpid`, :func:`wait3`, :func:`wait4`, " -"and :func:`waitid` causes child processes to be reported if they have been " +"This *options* flag for :func:`waitpid`, :func:`wait3`, :func:`wait4`, and :" +"func:`waitid` causes child processes to be reported if they have been " "continued from a job control stop since they were last reported." msgstr "" @@ -6109,15 +6095,15 @@ msgstr "" #: ../../library/os.rst:5343 msgid "" -":func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`, :func:`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` " -"functions." +":func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`, :func:" +"`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` functions." msgstr "" #: ../../library/os.rst:5351 msgid "" -"The following functions take a process status code as returned " -"by :func:`system`, :func:`wait`, or :func:`waitpid` as a parameter. They " -"may be used to determine the disposition of a process." +"The following functions take a process status code as returned by :func:" +"`system`, :func:`wait`, or :func:`waitpid` as a parameter. They may be used " +"to determine the disposition of a process." msgstr "" #: ../../library/os.rst:5357 @@ -6132,9 +6118,9 @@ msgstr "" #: ../../library/os.rst:5367 msgid "" -"Return ``True`` if a stopped child has been resumed by delivery " -"of :const:`~signal.SIGCONT` (if the process has been continued from a job " -"control stop), otherwise return ``False``." +"Return ``True`` if a stopped child has been resumed by delivery of :const:" +"`~signal.SIGCONT` (if the process has been continued from a job control " +"stop), otherwise return ``False``." msgstr "" #: ../../library/os.rst:5371 @@ -6247,9 +6233,9 @@ msgstr "" #: ../../library/os.rst:5491 msgid "" -"This class represents tunable scheduling parameters used " -"in :func:`sched_setparam`, :func:`sched_setscheduler`, " -"and :func:`sched_getparam`. It is immutable." +"This class represents tunable scheduling parameters used in :func:" +"`sched_setparam`, :func:`sched_setscheduler`, and :func:`sched_getparam`. It " +"is immutable." msgstr "" #: ../../library/os.rst:5495 @@ -6355,8 +6341,8 @@ msgstr "" msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " -"included in ``confstr_names``, an :exc:`OSError` is raised " -"with :const:`errno.EINVAL` for the error number." +"included in ``confstr_names``, an :exc:`OSError` is raised with :const:" +"`errno.EINVAL` for the error number." msgstr "" #: ../../library/os.rst:5597 @@ -6394,8 +6380,8 @@ msgstr "" #: ../../library/os.rst:5630 msgid "" "Get the number of logical CPUs usable by the calling thread of the **current " -"process**. Returns ``None`` if undetermined. It can be less " -"than :func:`cpu_count` depending on the CPU affinity." +"process**. Returns ``None`` if undetermined. It can be less than :func:" +"`cpu_count` depending on the CPU affinity." msgstr "" #: ../../library/os.rst:5634 @@ -6449,24 +6435,24 @@ msgstr "" #: ../../library/os.rst:5675 msgid "" "The constant string used by the operating system to refer to the current " -"directory. This is ``'.'`` for Windows and POSIX. Also available " -"via :mod:`os.path`." +"directory. This is ``'.'`` for Windows and POSIX. Also available via :mod:" +"`os.path`." msgstr "" #: ../../library/os.rst:5683 msgid "" "The constant string used by the operating system to refer to the parent " -"directory. This is ``'..'`` for Windows and POSIX. Also available " -"via :mod:`os.path`." +"directory. This is ``'..'`` for Windows and POSIX. Also available via :mod:" +"`os.path`." msgstr "" #: ../../library/os.rst:5692 msgid "" "The character used by the operating system to separate pathname components. " "This is ``'/'`` for POSIX and ``'\\\\'`` for Windows. Note that knowing " -"this is not sufficient to be able to parse or concatenate pathnames --- " -"use :func:`os.path.split` and :func:`os.path.join` --- but it is " -"occasionally useful. Also available via :mod:`os.path`." +"this is not sufficient to be able to parse or concatenate pathnames --- use :" +"func:`os.path.split` and :func:`os.path.join` --- but it is occasionally " +"useful. Also available via :mod:`os.path`." msgstr "" #: ../../library/os.rst:5702 @@ -6492,18 +6478,18 @@ msgstr "" #: ../../library/os.rst:5726 msgid "" -"The default search path used by :func:`exec\\*p\\* ` " -"and :func:`spawn\\*p\\* ` if the environment doesn't have a " -"``'PATH'`` key. Also available via :mod:`os.path`." +"The default search path used by :func:`exec\\*p\\* ` and :func:" +"`spawn\\*p\\* ` if the environment doesn't have a ``'PATH'`` key. " +"Also available via :mod:`os.path`." msgstr "" #: ../../library/os.rst:5733 msgid "" "The string used to separate (or, rather, terminate) lines on the current " "platform. This may be a single character, such as ``'\\n'`` for POSIX, or " -"multiple characters, for example, ``'\\r\\n'`` for Windows. Do not use " -"*os.linesep* as a line terminator when writing files opened in text mode " -"(the default); use a single ``'\\n'`` instead, on all platforms." +"multiple characters, for example, ``'\\r\\n'`` for Windows. Do not use *os." +"linesep* as a line terminator when writing files opened in text mode (the " +"default); use a single ``'\\n'`` instead, on all platforms." msgstr "" #: ../../library/os.rst:5742 @@ -6514,9 +6500,9 @@ msgstr "" #: ../../library/os.rst:5753 msgid "" -"Flags for use with the :func:`~sys.setdlopenflags` " -"and :func:`~sys.getdlopenflags` functions. See the Unix manual " -"page :manpage:`dlopen(3)` for what the different flags mean." +"Flags for use with the :func:`~sys.setdlopenflags` and :func:`~sys." +"getdlopenflags` functions. See the Unix manual page :manpage:`dlopen(3)` " +"for what the different flags mean." msgstr "" #: ../../library/os.rst:5761 @@ -6546,8 +6532,8 @@ msgstr "" #: ../../library/os.rst:5777 msgid "" "The flags argument is a bit mask that can contain zero or more of the " -"following values ORed together: :py:const:`os.GRND_RANDOM` " -"and :py:data:`GRND_NONBLOCK`." +"following values ORed together: :py:const:`os.GRND_RANDOM` and :py:data:" +"`GRND_NONBLOCK`." msgstr "" #: ../../library/os.rst:5781 diff --git a/library/shutil.po b/library/shutil.po index c50c958d1c4..415d7fb6dd7 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,8 +35,8 @@ msgstr "" #: ../../library/shutil.rst:25 msgid "" -"Even the higher-level file copying functions " -"(:func:`shutil.copy`, :func:`shutil.copy2`) cannot copy all file metadata." +"Even the higher-level file copying functions (:func:`shutil.copy`, :func:" +"`shutil.copy2`) cannot copy all file metadata." msgstr "" #: ../../library/shutil.rst:28 @@ -50,7 +50,7 @@ msgstr "" #: ../../library/shutil.rst:38 msgid "Directory and files operations" -msgstr "" +msgstr "目錄和檔案操作" #: ../../library/shutil.rst:42 msgid "" @@ -69,9 +69,9 @@ msgid "" "been flushed on completion of the copy. If you want to read from the " "destination at the completion of the copy operation (for example, reading " "the contents of a temporary file that has been copied from a HTTP stream), " -"you must ensure that you have called :func:`~io.IOBase.flush` " -"or :func:`~io.IOBase.close` on the file-like object before attempting to " -"read the destination file." +"you must ensure that you have called :func:`~io.IOBase.flush` or :func:`~io." +"IOBase.close` on the file-like object before attempting to read the " +"destination file." msgstr "" #: ../../library/shutil.rst:60 @@ -109,8 +109,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.copyfile`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " -"``shutil.copyfile``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." +"copyfile``。" #: ../../library/shutil.rst:79 msgid "" @@ -152,10 +152,10 @@ msgid "" "like object>` or path names given as strings. If *follow_symlinks* is false, " "and both *src* and *dst* are symbolic links, :func:`copymode` will attempt " "to modify the mode of *dst* itself (rather than the file it points to). " -"This functionality is not available on every platform; please " -"see :func:`copystat` for more information. If :func:`copymode` cannot " -"modify symbolic links on the local platform, and it is asked to do so, it " -"will do nothing and return." +"This functionality is not available on every platform; please see :func:" +"`copystat` for more information. If :func:`copymode` cannot modify symbolic " +"links on the local platform, and it is asked to do so, it will do nothing " +"and return." msgstr "" #: ../../library/shutil.rst:120 ../../library/shutil.rst:193 @@ -163,8 +163,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.copymode`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " -"``shutil.copymode``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." +"copymode``。" #: ../../library/shutil.rst:122 msgid "Added *follow_symlinks* argument." @@ -207,9 +207,9 @@ msgstr "" #: ../../library/shutil.rst:154 msgid "" -"If ``os.chflags in os.supports_follow_symlinks`` is " -"``True``, :func:`copystat` can modify the flags of a symbolic link. " -"(``os.chflags`` is not available on all platforms.)" +"If ``os.chflags in os.supports_follow_symlinks`` is ``True``, :func:" +"`copystat` can modify the flags of a symbolic link. (``os.chflags`` is not " +"available on all platforms.)" msgstr "" #: ../../library/shutil.rst:159 @@ -228,8 +228,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.copystat`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " -"``shutil.copystat``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." +"copystat``。" #: ../../library/shutil.rst:169 msgid "" @@ -277,16 +277,15 @@ msgid "" "attempts to copy all metadata from the *src* symbolic link to the newly " "created *dst* symbolic link. However, this functionality is not available on " "all platforms. On platforms where some or all of this functionality is " -"unavailable, :func:`copy2` will preserve all the metadata it " -"can; :func:`copy2` never raises an exception because it cannot preserve file " -"metadata." +"unavailable, :func:`copy2` will preserve all the metadata it can; :func:" +"`copy2` never raises an exception because it cannot preserve file metadata." msgstr "" #: ../../library/shutil.rst:218 msgid "" -":func:`copy2` uses :func:`copystat` to copy the file metadata. Please " -"see :func:`copystat` for more information about platform support for " -"modifying symbolic link metadata." +":func:`copy2` uses :func:`copystat` to copy the file metadata. Please see :" +"func:`copystat` for more information about platform support for modifying " +"symbolic link metadata." msgstr "" #: ../../library/shutil.rst:226 @@ -298,9 +297,9 @@ msgstr "" #: ../../library/shutil.rst:238 msgid "" -"This factory function creates a function that can be used as a callable " -"for :func:`copytree`\\'s *ignore* argument, ignoring files and directories " -"that match one of the glob-style *patterns* provided. See the example below." +"This factory function creates a function that can be used as a callable for :" +"func:`copytree`\\'s *ignore* argument, ignoring files and directories that " +"match one of the glob-style *patterns* provided. See the example below." msgstr "" #: ../../library/shutil.rst:247 @@ -327,9 +326,9 @@ msgstr "" #: ../../library/shutil.rst:259 msgid "" "When *symlinks* is false, if the file pointed to by the symlink doesn't " -"exist, an exception will be added in the list of errors raised in " -"an :exc:`Error` exception at the end of the copy process. You can set the " -"optional *ignore_dangling_symlinks* flag to true if you want to silence this " +"exist, an exception will be added in the list of errors raised in an :exc:" +"`Error` exception at the end of the copy process. You can set the optional " +"*ignore_dangling_symlinks* flag to true if you want to silence this " "exception. Notice that this option has no effect on platforms that don't " "support :func:`os.symlink`." msgstr "" @@ -362,8 +361,8 @@ msgstr "" #: ../../library/shutil.rst:283 msgid "" -"If *dirs_exist_ok* is false (the default) and *dst* already exists, " -"a :exc:`FileExistsError` is raised. If *dirs_exist_ok* is true, the copying " +"If *dirs_exist_ok* is false (the default) and *dst* already exists, a :exc:" +"`FileExistsError` is raised. If *dirs_exist_ok* is true, the copying " "operation will continue if it encounters existing directories, and files " "within the *dst* tree will be overwritten by corresponding files from the " "*src* tree." @@ -374,8 +373,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.copytree`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " -"``shutil.copytree``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." +"copytree``。" #: ../../library/shutil.rst:291 msgid "" @@ -476,8 +475,8 @@ msgstr "新增 *onexc* 參數並棄用 *onerror*。" #: ../../library/shutil.rst:364 msgid "" ":func:`!rmtree` now ignores :exc:`FileNotFoundError` exceptions for all but " -"the top-level path. Exceptions other than :exc:`OSError` and subclasses " -"of :exc:`!OSError` are now always propagated to the caller." +"the top-level path. Exceptions other than :exc:`OSError` and subclasses of :" +"exc:`!OSError` are now always propagated to the caller." msgstr "" #: ../../library/shutil.rst:372 @@ -518,9 +517,9 @@ msgstr "" msgid "" "If *copy_function* is given, it must be a callable that takes two arguments, " "*src* and the destination, and will be used to copy *src* to the destination " -"if :func:`os.rename` cannot be used. If the source is a " -"directory, :func:`copytree` is called, passing it the *copy_function*. The " -"default *copy_function* is :func:`copy2`. Using :func:`~shutil.copy` as the " +"if :func:`os.rename` cannot be used. If the source is a directory, :func:" +"`copytree` is called, passing it the *copy_function*. The default " +"*copy_function* is :func:`copy2`. Using :func:`~shutil.copy` as the " "*copy_function* allows the move to succeed when it is not possible to also " "copy the metadata, at the expense of not copying any of the metadata." msgstr "" @@ -530,8 +529,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.move`` with arguments " "``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " -"``shutil.move``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." +"move``。" #: ../../library/shutil.rst:406 msgid "" @@ -610,9 +609,9 @@ msgstr "" #: ../../library/shutil.rst:470 msgid "" "*path* is a \"``PATH`` string\" specifying the directories to look in, " -"delimited by :data:`os.pathsep`. When no *path* is specified, " -"the :envvar:`PATH` environment variable is read from :data:`os.environ`, " -"falling back to :data:`os.defpath` if it is not set." +"delimited by :data:`os.pathsep`. When no *path* is specified, the :envvar:" +"`PATH` environment variable is read from :data:`os.environ`, falling back " +"to :data:`os.defpath` if it is not set." msgstr "" #: ../../library/shutil.rst:475 @@ -693,12 +692,12 @@ msgstr "" #: ../../library/shutil.rst:527 msgid "" -"Starting from Python 3.8, all functions involving a file copy " -"(:func:`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, " -"and :func:`move`) may use platform-specific \"fast-copy\" syscalls in order " -"to copy the file more efficiently (see :issue:`33671`). \"fast-copy\" means " -"that the copying operation occurs within the kernel, avoiding the use of " -"userspace buffers in Python as in \"``outfd.write(infd.read())``\"." +"Starting from Python 3.8, all functions involving a file copy (:func:" +"`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, and :func:" +"`move`) may use platform-specific \"fast-copy\" syscalls in order to copy " +"the file more efficiently (see :issue:`33671`). \"fast-copy\" means that the " +"copying operation occurs within the kernel, avoiding the use of userspace " +"buffers in Python as in \"``outfd.write(infd.read())``\"." msgstr "" #: ../../library/shutil.rst:535 @@ -707,24 +706,24 @@ msgstr "" #: ../../library/shutil.rst:537 msgid "On Linux :func:`os.copy_file_range` or :func:`os.sendfile` is used." -msgstr "" +msgstr "Linux 上會使用 :func:`os.copy_file_range` 或 :func:`os.sendfile`。" #: ../../library/shutil.rst:539 msgid "On Solaris :func:`os.sendfile` is used." -msgstr "" +msgstr "Solaris 上會使用 :func:`os.sendfile`。" #: ../../library/shutil.rst:541 msgid "" "On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " -"instead of 64 KiB) and a :func:`memoryview`-based variant " -"of :func:`shutil.copyfileobj` is used." +"instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil." +"copyfileobj` is used." msgstr "" #: ../../library/shutil.rst:545 msgid "" "If the fast-copy operation fails and no data was written in the destination " -"file then shutil will silently fallback on using less " -"efficient :func:`copyfileobj` function internally." +"file then shutil will silently fallback on using less efficient :func:" +"`copyfileobj` function internally." msgstr "" #: ../../library/shutil.rst:551 @@ -733,8 +732,8 @@ msgstr "" #: ../../library/shutil.rst:554 msgid "" -"Copy-on-write or server-side copy may be used internally " -"via :func:`os.copy_file_range` on supported Linux filesystems." +"Copy-on-write or server-side copy may be used internally via :func:`os." +"copy_file_range` on supported Linux filesystems." msgstr "" #: ../../library/shutil.rst:561 @@ -776,6 +775,14 @@ msgid "" "\n" "copytree(source, destination, ignore=_logpath)" msgstr "" +"from shutil import copytree\n" +"import logging\n" +"\n" +"def _logpath(path, names):\n" +" logging.info('Working in %s', path)\n" +" return [] # 沒有東西被忽略\n" +"\n" +"copytree(source, destination, ignore=_logpath)" #: ../../library/shutil.rst:587 msgid "rmtree example" @@ -830,9 +837,9 @@ msgstr "" msgid "" "*format* is the archive format: one of \"zip\" (if the :mod:`zlib` module is " "available), \"tar\", \"gztar\" (if the :mod:`zlib` module is available), " -"\"bztar\" (if the :mod:`bz2` module is available), \"xztar\" (if " -"the :mod:`lzma` module is available), or \"zstdtar\" (if " -"the :mod:`compression.zstd` module is available)." +"\"bztar\" (if the :mod:`bz2` module is available), \"xztar\" (if the :mod:" +"`lzma` module is available), or \"zstdtar\" (if the :mod:`compression.zstd` " +"module is available)." msgstr "" #: ../../library/shutil.rst:631 @@ -870,26 +877,26 @@ msgstr "" msgid "" "*logger* must be an object compatible with :pep:`282`, usually an instance " "of :class:`logging.Logger`." -msgstr "" +msgstr "*logger* 必須是與 :pep:`282` 相容的物件,通常是 :class:`logging.Logger` 的實例。" #: ../../library/shutil.rst:652 msgid "The *verbose* argument is unused and deprecated." -msgstr "" +msgstr "*verbose* 引數未被使用且已棄用。" #: ../../library/shutil.rst:654 msgid "" "Raises an :ref:`auditing event ` ``shutil.make_archive`` with " "arguments ``base_name``, ``format``, ``root_dir``, ``base_dir``." msgstr "" -"引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的" -"\\ :ref:`稽核事件 ` ``shutil.make_archive``。" +"引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的\\ :" +"ref:`稽核事件 ` ``shutil.make_archive``。" #: ../../library/shutil.rst:658 msgid "" -"This function is not thread-safe when custom archivers registered " -"with :func:`register_archive_format` do not support the *root_dir* " -"argument. In this case it temporarily changes the current working directory " -"of the process to *root_dir* to perform archiving." +"This function is not thread-safe when custom archivers registered with :func:" +"`register_archive_format` do not support the *root_dir* argument. In this " +"case it temporarily changes the current working directory of the process to " +"*root_dir* to perform archiving." msgstr "" #: ../../library/shutil.rst:664 @@ -912,7 +919,7 @@ msgstr "" #: ../../library/shutil.rst:677 ../../library/shutil.rst:794 msgid "By default :mod:`shutil` provides these formats:" -msgstr "" +msgstr "預設情況下 :mod:`shutil` 提供這些格式:" #: ../../library/shutil.rst:679 msgid "*zip*: ZIP file (if the :mod:`zlib` module is available)." @@ -1002,11 +1009,10 @@ msgstr "" #: ../../library/shutil.rst:729 msgid "" "*format* is the archive format: one of \"zip\", \"tar\", \"gztar\", " -"\"bztar\", \"xztar\", or \"zstdtar\". Or any other format registered " -"with :func:`register_unpack_format`. If not " -"provided, :func:`unpack_archive` will use the archive file name extension " -"and see if an unpacker was registered for that extension. In case none is " -"found, a :exc:`ValueError` is raised." +"\"bztar\", \"xztar\", or \"zstdtar\". Or any other format registered with :" +"func:`register_unpack_format`. If not provided, :func:`unpack_archive` will " +"use the archive file name extension and see if an unpacker was registered " +"for that extension. In case none is found, a :exc:`ValueError` is raised." msgstr "" #: ../../library/shutil.rst:736 @@ -1053,8 +1059,8 @@ msgstr "新增 *filter* 引數。" #: ../../library/shutil.rst:765 msgid "" "Registers an unpack format. *name* is the name of the format and " -"*extensions* is a list of extensions corresponding to the format, like " -"``.zip`` for Zip files." +"*extensions* is a list of extensions corresponding to the format, like ``." +"zip`` for Zip files." msgstr "" #: ../../library/shutil.rst:769 @@ -1074,8 +1080,8 @@ msgstr "" #: ../../library/shutil.rst:774 msgid "" -"possibly a *filter* keyword argument, if it was given " -"to :func:`unpack_archive`;" +"possibly a *filter* keyword argument, if it was given to :func:" +"`unpack_archive`;" msgstr "" #: ../../library/shutil.rst:776 @@ -1193,8 +1199,8 @@ msgstr "" #: ../../library/shutil.rst:858 msgid "" -"In the final archive, :file:`please_add.txt` should be included, " -"but :file:`do_not_add.txt` should not. Therefore we use the following::" +"In the final archive, :file:`please_add.txt` should be included, but :file:" +"`do_not_add.txt` should not. Therefore we use the following::" msgstr "" #: ../../library/shutil.rst:861 @@ -1208,7 +1214,7 @@ msgid "" "... root_dir='tmp/root',\n" "... base_dir='structure/content',\n" "... )\n" -"'/Users/tarek/my_archive.tar'" +"'/Users/tarek/myarchive.tar'" msgstr "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1219,7 +1225,7 @@ msgstr "" "... root_dir='tmp/root',\n" "... base_dir='structure/content',\n" "... )\n" -"'/Users/tarek/my_archive.tar'" +"'/Users/tarek/myarchive.tar'" #: ../../library/shutil.rst:872 msgid "Listing the files in the resulting archive gives us:" @@ -1253,8 +1259,8 @@ msgstr "" #: ../../library/shutil.rst:892 msgid "" "When ``COLUMNS`` or ``LINES`` is not defined, which is the common case, the " -"terminal connected to :data:`sys.__stdout__` is queried by " -"invoking :func:`os.get_terminal_size`." +"terminal connected to :data:`sys.__stdout__` is queried by invoking :func:" +"`os.get_terminal_size`." msgstr "" #: ../../library/shutil.rst:896 diff --git a/library/ssl.po b/library/ssl.po index ed5e9b69338..5939b968dbe 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -88,8 +88,8 @@ msgid "" "also encrypts and decrypts the data going over the socket with SSL. It " "supports additional methods such as :meth:`getpeercert`, which retrieves the " "certificate of the other side of the connection, :meth:`cipher`, which " -"retrieves the cipher being used for the secure connection " -"or :meth:`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " +"retrieves the cipher being used for the secure connection or :meth:" +"`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " "certificate chain." msgstr "" "此模組提供了一個 :class:`ssl.SSLSocket` 類別,它是從 :class:`socket.socket` " @@ -142,10 +142,9 @@ msgstr "Socket 建立" #: ../../library/ssl.rst:79 msgid "" -"Instances of :class:`SSLSocket` must be created using " -"the :meth:`SSLContext.wrap_socket` method. The helper " -"function :func:`create_default_context` returns a new context with secure " -"default settings." +"Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." +"wrap_socket` method. The helper function :func:`create_default_context` " +"returns a new context with secure default settings." msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`SSLContext.wrap_socket` 方法來建立。輔" "助函式 :func:`create_default_context` 會回傳有安全預設設定的新語境 " @@ -246,31 +245,31 @@ msgid "" "If all three are :const:`None`, this function can choose to trust the " "system's default CA certificates instead." msgstr "" -"*cafile*, *capath*, *cadata* 是用來選擇用於憑證認證的 CA 憑證,就" -"像 :meth:`SSLContext.load_verify_locations` 一樣。如果三個值都" -"是 :const:`None`,此函式會自動選擇系統預設的 CA 憑證。" +"*cafile*, *capath*, *cadata* 是用來選擇用於憑證認證的 CA 憑證,就像 :meth:" +"`SSLContext.load_verify_locations` 一樣。如果三個值都是 :const:`None`,此函式" +"會自動選擇系統預設的 CA 憑證。" # Skylull: `high encryption cipher` 可能是指 https://superuser.com/questions/1751902/how-to-check-which-ciphers-are-included-in-high-ciphers-constant # 其文中表示可能是指 128bit 以上 key length 的加密算法,需要其他來源佐證。 # 或是 https://help.fortinet.com/fweb/582/Content/FortiWeb/fortiweb-admin/supported_cipher_suites.htm#ssl_414712646_1189301 #: ../../library/ssl.rst:141 msgid "" -"The settings are: :data:`PROTOCOL_TLS_CLIENT` " -"or :data:`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` " -"with high encryption cipher suites without RC4 and without unauthenticated " -"cipher suites. Passing :const:`~Purpose.SERVER_AUTH` as *purpose* " -"sets :data:`~SSLContext.verify_mode` to :data:`CERT_REQUIRED` and either " -"loads CA certificates (when at least one of *cafile*, *capath* or *cadata* " -"is given) or uses :meth:`SSLContext.load_default_certs` to load default CA " +"The settings are: :data:`PROTOCOL_TLS_CLIENT` or :data:" +"`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` with " +"high encryption cipher suites without RC4 and without unauthenticated cipher " +"suites. Passing :const:`~Purpose.SERVER_AUTH` as *purpose* sets :data:" +"`~SSLContext.verify_mode` to :data:`CERT_REQUIRED` and either loads CA " +"certificates (when at least one of *cafile*, *capath* or *cadata* is given) " +"or uses :meth:`SSLContext.load_default_certs` to load default CA " "certificates." msgstr "" -"這些設定包含::data:`PROTOCOL_TLS_CLIENT` " -"或 :data:`PROTOCOL_TLS_SERVER`、:data:`OP_NO_SSLv2`、以" -"及 :data:`OP_NO_SSLv3`,使用高等加密套件但不包含 RC4 和未經身份驗證的加密套" -"件。如果將 *purpose* 設定為 :const:`~Purpose.SERVER_AUTH`,則會" -"把 :data:`~SSLContext.verify_mode` 設為 :data:`CERT_REQUIRED` 並使用設定的 " -"CA 憑證(當 *cafile*、*capath* 或 *cadata* 其中一個值有被設定時) 或使用預設的 " -"CA 憑證 :meth:`SSLContext.load_default_certs` 。" +"這些設定包含::data:`PROTOCOL_TLS_CLIENT` 或 :data:`PROTOCOL_TLS_SERVER`、:" +"data:`OP_NO_SSLv2`、以及 :data:`OP_NO_SSLv3`,使用高等加密套件但不包含 RC4 和" +"未經身份驗證的加密套件。如果將 *purpose* 設定為 :const:`~Purpose." +"SERVER_AUTH`,則會把 :data:`~SSLContext.verify_mode` 設為 :data:" +"`CERT_REQUIRED` 並使用設定的 CA 憑證(當 *cafile*、*capath* 或 *cadata* 其中一" +"個值有被設定時) 或使用預設的 CA 憑證 :meth:`SSLContext." +"load_default_certs` 。" #: ../../library/ssl.rst:150 msgid "" @@ -278,16 +277,16 @@ msgid "" "variable :envvar:`SSLKEYLOGFILE` is set, :func:`create_default_context` " "enables key logging." msgstr "" -"當系統有支援 :attr:`~SSLContext.keylog_filename` 並且有設定環境變" -"數 :envvar:`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記" -"錄 (logging)。" +"當系統有支援 :attr:`~SSLContext.keylog_filename` 並且有設定環境變數 :envvar:" +"`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記錄 " +"(logging)。" #: ../../library/ssl.rst:154 msgid "" -"The default settings for this context " -"include :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. " -"These make the underlying OpenSSL implementation behave more like a " -"conforming implementation of :rfc:`5280`, in exchange for a small amount of " +"The default settings for this context include :data:" +"`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. These make the " +"underlying OpenSSL implementation behave more like a conforming " +"implementation of :rfc:`5280`, in exchange for a small amount of " "incompatibility with older X.509 certificates." msgstr "" @@ -302,8 +301,8 @@ msgstr "" #: ../../library/ssl.rst:165 msgid "" -"If your application needs specific settings, you should create " -"a :class:`SSLContext` and apply the settings yourself." +"If your application needs specific settings, you should create a :class:" +"`SSLContext` and apply the settings yourself." msgstr "" "如果你的應用程式需要特殊的設定,你應該要自行建立一個 :class:`SSLContext` 並自" "行調整設定。" @@ -314,9 +313,9 @@ msgid "" "with a :class:`SSLContext` created by this function that they get an error " "stating \"Protocol or cipher suite mismatch\", it may be that they only " "support SSL3.0 which this function excludes using the :data:`OP_NO_SSLv3`. " -"SSL3.0 is widely considered to be `completely broken `_. If you still wish to continue to use this " -"function but still allow SSL 3.0 connections you can re-enable them using::" +"SSL3.0 is widely considered to be `completely broken `_. If you still wish to continue to use this function but " +"still allow SSL 3.0 connections you can re-enable them using::" msgstr "" "如果你發現某些舊的用戶端或伺服器常適用此函式建立的 :class:`SSLContext` 連線" "時,收到 \"Protocol or cipher suite mismatch\" 錯誤,這可能是因為他們的系統僅" @@ -366,17 +365,16 @@ msgstr "增加了 :envvar:`SSLKEYLOGFILE` 對密鑰日誌記錄 (logging) 的支 #: ../../library/ssl.rst:208 msgid "" -"The context now uses :data:`PROTOCOL_TLS_CLIENT` " -"or :data:`PROTOCOL_TLS_SERVER` protocol instead of " -"generic :data:`PROTOCOL_TLS`." +"The context now uses :data:`PROTOCOL_TLS_CLIENT` or :data:" +"`PROTOCOL_TLS_SERVER` protocol instead of generic :data:`PROTOCOL_TLS`." msgstr "" "目前語境使用 :data:`PROTOCOL_TLS_CLIENT` 協定或 :data:`PROTOCOL_TLS_SERVER` " "協定而非通用的 :data:`PROTOCOL_TLS`。" #: ../../library/ssl.rst:214 msgid "" -"The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` " -"and :data:`VERIFY_X509_STRICT` in its default verify flags." +"The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:" +"`VERIFY_X509_STRICT` in its default verify flags." msgstr "" #: ../../library/ssl.rst:219 @@ -393,9 +391,9 @@ msgid "" "OpenSSL library." msgstr "" "引發由底層 SSL 實作(目前由 OpenSSL 函式庫提供)所引發的錯誤訊息。這表示在覆" -"蓋底層網路連線的高階加密和身份驗證層中存在一些問題。這項錯誤" -"是 :exc:`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 " -"OpenSSL 函式庫提供。" +"蓋底層網路連線的高階加密和身份驗證層中存在一些問題。這項錯誤是 :exc:" +"`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 OpenSSL " +"函式庫提供。" #: ../../library/ssl.rst:230 msgid ":exc:`SSLError` used to be a subtype of :exc:`socket.error`." @@ -491,16 +489,16 @@ msgstr "隨機產生" #: ../../library/ssl.rst:319 msgid "" -"Return *num* cryptographically strong pseudo-random bytes. Raises " -"an :class:`SSLError` if the PRNG has not been seeded with enough data or if " -"the operation is not supported by the current RAND " -"method. :func:`RAND_status` can be used to check the status of the PRNG " -"and :func:`RAND_add` can be used to seed the PRNG." +"Return *num* cryptographically strong pseudo-random bytes. Raises an :class:" +"`SSLError` if the PRNG has not been seeded with enough data or if the " +"operation is not supported by the current RAND method. :func:`RAND_status` " +"can be used to check the status of the PRNG and :func:`RAND_add` can be used " +"to seed the PRNG." msgstr "" "回傳 *num* 個加密性強的偽隨機位元組。如果 PRNG 未使用足夠的資料做為隨機種子 " -"(seed) 或是目前的 RAND 方法不支持該操作則會導致 :class:`SSLError` 錯" -"誤。:func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可" -"以用來為 PRNG 設定隨機種子。" +"(seed) 或是目前的 RAND 方法不支持該操作則會導致 :class:`SSLError` 錯誤。:" +"func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可以用來" +"為 PRNG 設定隨機種子。" #: ../../library/ssl.rst:325 msgid "For almost all applications :func:`os.urandom` is preferable." @@ -513,21 +511,20 @@ msgid "" "Cryptographically_secure_pseudorandom_number_generator>`_, to get the " "requirements of a cryptographically strong generator." msgstr "" -"請閱讀維基百科的\\ `密碼學安全偽隨機數產生器 (CSPRNG) `_\\ 文章來了解密碼學" -"安全偽隨機數產生器的需求。" +"請閱讀維基百科的\\ `密碼學安全偽隨機數產生器 (CSPRNG) `_\\ 文章來了" +"解密碼學安全偽隨機數產生器的需求。" #: ../../library/ssl.rst:336 msgid "" "Return ``True`` if the SSL pseudo-random number generator has been seeded " -"with 'enough' randomness, and ``False`` otherwise. You can " -"use :func:`ssl.RAND_egd` and :func:`ssl.RAND_add` to increase the randomness " -"of the pseudo-random number generator." +"with 'enough' randomness, and ``False`` otherwise. You can use :func:`ssl." +"RAND_egd` and :func:`ssl.RAND_add` to increase the randomness of the pseudo-" +"random number generator." msgstr "" "如果 SSL 偽隨機數產生器已經使用「足夠的」隨機性進行隨機種子生成,則回傳 " -"``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式" -"和 :func:`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" +"``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式和 :func:" +"`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" #: ../../library/ssl.rst:343 msgid "" @@ -600,19 +597,19 @@ msgid "" "PEM-encoded string. If ``ssl_version`` is specified, uses that version of " "the SSL protocol to attempt to connect to the server. If *ca_certs* is " "specified, it should be a file containing a list of root certificates, the " -"same format as used for the *cafile* parameter " -"in :meth:`SSLContext.load_verify_locations`. The call will attempt to " -"validate the server certificate against that set of root certificates, and " -"will fail if the validation attempt fails. A timeout can be specified with " -"the ``timeout`` parameter." +"same format as used for the *cafile* parameter in :meth:`SSLContext." +"load_verify_locations`. The call will attempt to validate the server " +"certificate against that set of root certificates, and will fail if the " +"validation attempt fails. A timeout can be specified with the ``timeout`` " +"parameter." msgstr "" "輸入使用 SSL 保護的伺服器的地址 ``addr``,輸入形式為一個 pair (*hostname*, " "*port-number*),取得該伺服器的憑證,並以 PEM 編碼字串的形式回傳。如果指定了 " "``ssl_version``,則使用指定的 SSL 協定來嘗試與伺服器連線。如果指定 " -"*ca_certs*,則它應該是一個包含根憑證列表的檔案,並" -"與 :meth:`SSLContext.load_verify_locations` 中的參數 *cafile* 所使用的格式相" -"同。此呼叫將嘗試使用該組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失" -"敗。可以使用 ``timeout`` 參數指定超時時間。" +"*ca_certs*,則它應該是一個包含根憑證列表的檔案,並與 :meth:`SSLContext." +"load_verify_locations` 中的參數 *cafile* 所使用的格式相同。此呼叫將嘗試使用該" +"組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失敗。可以使用 ``timeout`` " +"參數指定超時時間。" #: ../../library/ssl.rst:399 msgid "This function is now IPv6-compatible." @@ -620,11 +617,11 @@ msgstr "此函式現在是與 IPv6 相容的。" #: ../../library/ssl.rst:402 msgid "" -"The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` " -"to :data:`PROTOCOL_TLS` for maximum compatibility with modern servers." +"The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` to :data:" +"`PROTOCOL_TLS` for maximum compatibility with modern servers." msgstr "" -"預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改" -"為 :data:`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" +"預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改為 :data:" +"`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" #: ../../library/ssl.rst:406 msgid "The *timeout* parameter was added." @@ -651,9 +648,9 @@ msgid "" "paths are the same as used by :meth:`SSLContext.set_default_verify_paths`. " "The return value is a :term:`named tuple` ``DefaultVerifyPaths``:" msgstr "" -"回傳一個具有 OpenSSL 的預設 cafile 和 capath 路徑的附名元組。這些路徑" -"與 :meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一" -"個 :term:`named tuple` ``DefaultVerifyPaths``:" +"回傳一個具有 OpenSSL 的預設 cafile 和 capath 路徑的附名元組。這些路徑與 :" +"meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一個 :term:" +"`named tuple` ``DefaultVerifyPaths``:" #: ../../library/ssl.rst:426 msgid "" @@ -699,20 +696,18 @@ msgstr "" #: ../../library/ssl.rst:441 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " -"The encoding_type specifies the encoding of cert_bytes. It is " -"either :const:`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for " -"PKCS#7 ASN.1 data. Trust specifies the purpose of the certificate as a set " -"of OIDS or exactly ``True`` if the certificate is trustworthy for all " -"purposes." +"The encoding_type specifies the encoding of cert_bytes. It is either :const:" +"`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 " +"data. Trust specifies the purpose of the certificate as a set of OIDS or " +"exactly ``True`` if the certificate is trustworthy for all purposes." msgstr "" "此函式會回傳一個元組 (cert_bytes, encoding_type, trust) 串列。encoding_type " -"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料" -"的 :const:`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" -"Trust 通過一組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 " -"``True``。" +"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" +"`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。Trust 通過一" +"組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 ``True``。" #: ../../library/ssl.rst:448 ../../library/ssl.rst:1605 -#: ../../library/ssl.rst:1904 +#: ../../library/ssl.rst:1905 msgid "Example::" msgstr "範例: ::" @@ -737,13 +732,12 @@ msgstr "" #: ../../library/ssl.rst:464 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " -"The encoding_type specifies the encoding of cert_bytes. It is " -"either :const:`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for " -"PKCS#7 ASN.1 data." +"The encoding_type specifies the encoding of cert_bytes. It is either :const:" +"`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 data." msgstr "" "此函式會回傳一個元組 (cert_bytes, encoding_type, trust) 串列。encoding_type " -"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料" -"的 :const:`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" +"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" +"`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" #: ../../library/ssl.rst:475 msgid "Constants" @@ -758,11 +752,10 @@ msgstr "" #: ../../library/ssl.rst:483 msgid "" -"Possible value for :attr:`SSLContext.verify_mode`. Except " -"for :const:`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side " -"sockets, just about any cert is accepted. Validation errors, such as " -"untrusted or expired cert, are ignored and do not abort the TLS/SSL " -"handshake." +"Possible value for :attr:`SSLContext.verify_mode`. Except for :const:" +"`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side sockets, " +"just about any cert is accepted. Validation errors, such as untrusted or " +"expired cert, are ignored and do not abort the TLS/SSL handshake." msgstr "" ":attr:`SSLContext.verify_mode` 可能的值。除了 :attr:`SSLContext.verify_mode` " "外,這是預設的模式。對於用戶端的 sockets,幾乎任何憑證都能被允許。驗證錯誤," @@ -776,20 +769,19 @@ msgstr "" "在伺服器模式下,不會從用戶端請求任何憑證,所以用戶端不用發送任何用於用戶端憑" "證身分驗證的憑證。" -#: ../../library/ssl.rst:492 ../../library/ssl.rst:2406 +#: ../../library/ssl.rst:492 ../../library/ssl.rst:2407 msgid "See the discussion of :ref:`ssl-security` below." msgstr "參閱下方 :ref:`ssl-security` 的討論。" #: ../../library/ssl.rst:496 msgid "" -"Possible value for :attr:`SSLContext.verify_mode`. In client " -"mode, :const:`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. " -"It is recommended to use :const:`CERT_REQUIRED` for client-side sockets " -"instead." +"Possible value for :attr:`SSLContext.verify_mode`. In client mode, :const:" +"`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. It is " +"recommended to use :const:`CERT_REQUIRED` for client-side sockets instead." msgstr "" -":attr:`SSLContext.verify_mode` 可能的值。在用戶端模式" -"下,:const:`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶" -"端 sockets 推薦改用 :const:`CERT_REQUIRED`。" +":attr:`SSLContext.verify_mode` 可能的值。在用戶端模式下,:const:" +"`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶端 sockets " +"推薦改用 :const:`CERT_REQUIRED`。" #: ../../library/ssl.rst:501 msgid "" @@ -805,30 +797,29 @@ msgstr "" #: ../../library/ssl.rst:507 ../../library/ssl.rst:526 msgid "" -"Use of this setting requires a valid set of CA certificates to be passed " -"to :meth:`SSLContext.load_verify_locations`." +"Use of this setting requires a valid set of CA certificates to be passed to :" +"meth:`SSLContext.load_verify_locations`." msgstr "" -"使用此設定需要將一組有效的 CA 憑證傳送" -"給 :meth:`SSLContext.load_verify_locations`。" +"使用此設定需要將一組有效的 CA 憑證傳送給 :meth:`SSLContext." +"load_verify_locations`。" #: ../../library/ssl.rst:512 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In this mode, " -"certificates are required from the other side of the socket connection; " -"an :class:`SSLError` will be raised if no certificate is provided, or if its " +"certificates are required from the other side of the socket connection; an :" +"class:`SSLError` will be raised if no certificate is provided, or if its " "validation fails. This mode is **not** sufficient to verify a certificate in " -"client mode as it does not match " -"hostnames. :attr:`~SSLContext.check_hostname` must be enabled as well to " -"verify the authenticity of a cert. :const:`PROTOCOL_TLS_CLIENT` " -"uses :const:`CERT_REQUIRED` and enables :attr:`~SSLContext.check_hostname` " -"by default." +"client mode as it does not match hostnames. :attr:`~SSLContext." +"check_hostname` must be enabled as well to verify the authenticity of a " +"cert. :const:`PROTOCOL_TLS_CLIENT` uses :const:`CERT_REQUIRED` and enables :" +"attr:`~SSLContext.check_hostname` by default." msgstr "" ":attr:`SSLContext.verify_mode` 可能的值。在這個模式下,需要從 socket 連線的另" "一端取得憑證;如果未提供憑證或是驗證失敗,則將會導致 :class:`SSLError`。此模" -"式\\ **不能**\\ 在用戶端模式下對憑證進行驗證,因為它無法去配對主機名" -"稱。:attr:`~SSLContext.check_hostname` 也必須被開起來來驗證憑證的真實" -"性。:const:`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開" -"啟 :attr:`~SSLContext.check_hostname`。" +"式\\ **不能**\\ 在用戶端模式下對憑證進行驗證,因為它無法去配對主機名稱。:" +"attr:`~SSLContext.check_hostname` 也必須被開起來來驗證憑證的真實性。:const:" +"`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開啟 :attr:" +"`~SSLContext.check_hostname`。" #: ../../library/ssl.rst:522 msgid "" @@ -857,8 +848,8 @@ msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, only the " "peer cert is checked but none of the intermediate CA certificates. The mode " "requires a valid CRL that is signed by the peer cert's issuer (its direct " -"ancestor CA). If no proper CRL has been loaded " -"with :attr:`SSLContext.load_verify_locations`, validation will fail." +"ancestor CA). If no proper CRL has been loaded with :attr:`SSLContext." +"load_verify_locations`, validation will fail." msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。在此模式下,只會檢查同等的憑證而不" "會去檢查中間的 CA 憑證。此模式需要提供由對等憑證發行者 (它的直接上級 CA) 的有" @@ -924,8 +915,8 @@ msgstr "" #: ../../library/ssl.rst:608 msgid "" "TLS clients and servers require different default settings for secure " -"communication. The generic TLS protocol constant is deprecated in favor " -"of :data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`." +"communication. The generic TLS protocol constant is deprecated in favor of :" +"data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`." msgstr "" "TLS 的用戶端及伺服器端需要不同的預設值來實現安全通訊。通用的 TLS 協定常數已被" "廢除,並改用 :data:`PROTOCOL_TLS_CLIENT` 和 :data:`PROTOCOL_TLS_SERVER`。" @@ -971,13 +962,13 @@ msgstr "第三版的 SSL 是不安全的,強烈建議不要使用。" #: ../../library/ssl.rst:649 msgid "" "OpenSSL has deprecated all version specific protocols. Use the default " -"protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` " -"with :attr:`SSLContext.minimum_version` " -"and :attr:`SSLContext.maximum_version` instead." +"protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` with :" +"attr:`SSLContext.minimum_version` and :attr:`SSLContext.maximum_version` " +"instead." msgstr "" -"OpenSSL 已經終止了所有特定版本的協定。請改用預設" -"的 :data:`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` " -"和 :attr:`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" +"OpenSSL 已經終止了所有特定版本的協定。請改用預設的 :data:" +"`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` 和 :attr:" +"`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" #: ../../library/ssl.rst:657 msgid "Selects TLS version 1.0 as the channel encryption protocol." @@ -1050,13 +1041,11 @@ msgstr "" #: ../../library/ssl.rst:725 msgid "" -"The option is deprecated since OpenSSL 1.1.0, use the " -"new :attr:`SSLContext.minimum_version` " -"and :attr:`SSLContext.maximum_version` instead." +"The option is deprecated since OpenSSL 1.1.0, use the new :attr:`SSLContext." +"minimum_version` and :attr:`SSLContext.maximum_version` instead." msgstr "" -"該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新" -"的 :attr:`SSLContext.minimum_version` 及 :attr:`SSLContext.maximum_version` " -"代替。" +"該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新的 :attr:`SSLContext." +"minimum_version` 及 :attr:`SSLContext.maximum_version` 代替。" #: ../../library/ssl.rst:732 msgid "" @@ -1206,16 +1195,16 @@ msgid "" "Whether the OpenSSL library has built-in support for the *Application-Layer " "Protocol Negotiation* TLS extension as described in :rfc:`7301`." msgstr "" -"OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述" -"在 :rfc:`7301` 中。" +"OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述在 :" +"rfc:`7301` 中。" #: ../../library/ssl.rst:864 msgid "" "Whether the OpenSSL library has built-in support not checking subject common " "name and :attr:`SSLContext.hostname_checks_common_name` is writeable." msgstr "" -"OpenSSL 函式庫是否內建支援不檢查主題通用名稱" -"及 :attr:`SSLContext.hostname_checks_common_name` 是否可寫。" +"OpenSSL 函式庫是否內建支援不檢查主題通用名稱及 :attr:`SSLContext." +"hostname_checks_common_name` 是否可寫。" #: ../../library/ssl.rst:872 msgid "" @@ -1290,8 +1279,8 @@ msgid "" "List of supported TLS channel binding types. Strings in this list can be " "used as arguments to :meth:`SSLSocket.get_channel_binding`." msgstr "" -"支援的 TLS 通道綁定類型列表。列表中的字串可以作" -"為 :meth:`SSLSocket.get_channel_binding` 的參數。" +"支援的 TLS 通道綁定類型列表。列表中的字串可以作為 :meth:`SSLSocket." +"get_channel_binding` 的參數。" #: ../../library/ssl.rst:952 msgid "The version string of the OpenSSL library loaded by the interpreter::" @@ -1342,14 +1331,14 @@ msgid "" "parameters-6>`_ contains this list and references to the RFCs where their " "meaning is defined." msgstr "" -"來自 :rfc:`5246` 和其他文件的警報描述。`IANA TLS Alert Registry `_ 包含了此列表以及其含義定義所在的 RFC 的引用。" +"來自 :rfc:`5246` 和其他文件的警報描述。`IANA TLS Alert Registry `_ 包" +"含了此列表以及其含義定義所在的 RFC 的引用。" #: ../../library/ssl.rst:988 msgid "" -"Used as the return value of the callback function " -"in :meth:`SSLContext.set_servername_callback`." +"Used as the return value of the callback function in :meth:`SSLContext." +"set_servername_callback`." msgstr "" "被用來做為 :meth:`SSLContext.set_servername_callback` 中回呼函式的回傳值。" @@ -1359,20 +1348,20 @@ msgstr ":class:`enum.IntEnum` 為 ALERT_DESCRIPTION_* 常數中的一個集合 #: ../../library/ssl.rst:1001 msgid "" -"Option for :func:`create_default_context` " -"and :meth:`SSLContext.load_default_certs`. This value indicates that the " -"context may be used to authenticate web servers (therefore, it will be used " -"to create client-side sockets)." +"Option for :func:`create_default_context` and :meth:`SSLContext." +"load_default_certs`. This value indicates that the context may be used to " +"authenticate web servers (therefore, it will be used to create client-side " +"sockets)." msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁伺服器 (因此它將用於建立用戶端 socket)。" #: ../../library/ssl.rst:1010 msgid "" -"Option for :func:`create_default_context` " -"and :meth:`SSLContext.load_default_certs`. This value indicates that the " -"context may be used to authenticate web clients (therefore, it will be used " -"to create server-side sockets)." +"Option for :func:`create_default_context` and :meth:`SSLContext." +"load_default_certs`. This value indicates that the context may be used to " +"authenticate web clients (therefore, it will be used to create server-side " +"sockets)." msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁用戶端 (因此,它將用於建立伺服器端的 " @@ -1384,13 +1373,11 @@ msgstr ":class:`enum.IntEnum` 為 SSL_ERROR_* 常數中的一個集合。" #: ../../library/ssl.rst:1025 msgid "" -":class:`enum.IntEnum` collection of SSL and TLS versions " -"for :attr:`SSLContext.maximum_version` " -"and :attr:`SSLContext.minimum_version`." +":class:`enum.IntEnum` collection of SSL and TLS versions for :attr:" +"`SSLContext.maximum_version` and :attr:`SSLContext.minimum_version`." msgstr "" -"用於 :attr:`SSLContext.maximum_version` " -"和 :attr:`SSLContext.minimum_version` 的 SSL 和 TLS 版" -"本 :class:`enum.IntEnum` 集合。" +"用於 :attr:`SSLContext.maximum_version` 和 :attr:`SSLContext." +"minimum_version` 的 SSL 和 TLS 版本 :class:`enum.IntEnum` 集合。" #: ../../library/ssl.rst:1033 msgid "" @@ -1407,11 +1394,11 @@ msgstr "SSL 3.0 到 TLS 1.3。" #: ../../library/ssl.rst:1047 msgid "" -"All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` " -"and :attr:`TLSVersion.TLSv1_3` are deprecated." +"All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` and :attr:" +"`TLSVersion.TLSv1_3` are deprecated." msgstr "" -"除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有" -"的 :class:`TLSVersion` 成員都已被棄用。" +"除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有的 :" +"class:`TLSVersion` 成員都已被棄用。" #: ../../library/ssl.rst:1052 msgid "SSL Sockets" @@ -1454,8 +1441,12 @@ msgid ":meth:`~socket.socket.getsockopt`, :meth:`~socket.socket.setsockopt`" msgstr ":meth:`~socket.socket.getsockopt`、:meth:`~socket.socket.setsockopt`" #: ../../library/ssl.rst:1066 -msgid ":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:`~socket.socket.setblocking`" -msgstr ":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:`~socket.socket.setblocking`" +msgid "" +":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:" +"`~socket.socket.setblocking`" +msgstr "" +":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:" +"`~socket.socket.setblocking`" #: ../../library/ssl.rst:1068 msgid ":meth:`~socket.socket.listen`" @@ -1506,8 +1497,8 @@ msgstr "" #: ../../library/ssl.rst:1083 msgid "" -"Instances of :class:`SSLSocket` must be created using " -"the :meth:`SSLContext.wrap_socket` method." +"Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." +"wrap_socket` method." msgstr "" ":class:`SSLSocket` 的實例必須使用 :meth:`SSLContext.wrap_socket` 方法建立。" @@ -1526,18 +1517,17 @@ msgstr "" #: ../../library/ssl.rst:1094 msgid "" -"It is deprecated to create a :class:`SSLSocket` instance directly, " -"use :meth:`SSLContext.wrap_socket` to wrap a socket." +"It is deprecated to create a :class:`SSLSocket` instance directly, use :meth:" +"`SSLContext.wrap_socket` to wrap a socket." msgstr "" -"直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使" -"用 :meth:`SSLContext.wrap_socket` 來包裝 socket。" +"直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使用 :meth:`SSLContext." +"wrap_socket` 來包裝 socket。" #: ../../library/ssl.rst:1098 msgid "" -":class:`SSLSocket` instances must to created " -"with :meth:`~SSLContext.wrap_socket`. In earlier versions, it was possible " -"to create instances directly. This was never documented or officially " -"supported." +":class:`SSLSocket` instances must to created with :meth:`~SSLContext." +"wrap_socket`. In earlier versions, it was possible to create instances " +"directly. This was never documented or officially supported." msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`~SSLContext.wrap_socket` 建立。在較早" "的版本中可以直接建立實例,但這從未被記錄或正式支援。" @@ -1566,12 +1556,11 @@ msgstr "" #: ../../library/ssl.rst:1117 msgid "" -"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket " -"is :ref:`non-blocking ` and the read would block." +"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" +"ref:`non-blocking ` and the read would block." msgstr "" -"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引" -"發 :exc:`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻" -"塞。" +"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" +"`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻塞。" #: ../../library/ssl.rst:1120 msgid "" @@ -1603,12 +1592,11 @@ msgstr "" #: ../../library/ssl.rst:1136 msgid "" -"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket " -"is :ref:`non-blocking ` and the write would block." +"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" +"ref:`non-blocking ` and the write would block." msgstr "" -"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引" -"發 :exc:`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻" -"塞。" +"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" +"`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻塞。" #: ../../library/ssl.rst:1139 msgid "" @@ -1634,8 +1622,8 @@ msgid "" "The :meth:`~SSLSocket.read` and :meth:`~SSLSocket.write` methods are the low-" "level methods that read and write unencrypted, application-level data and " "decrypt/encrypt it to encrypted, wire-level data. These methods require an " -"active SSL connection, i.e. the handshake was completed " -"and :meth:`SSLSocket.unwrap` was not called." +"active SSL connection, i.e. the handshake was completed and :meth:`SSLSocket." +"unwrap` was not called." msgstr "" ":meth:`~SSLSocket.read` 和 :meth:`~SSLSocket.write` 方法為低階層的方法,負責" "讀取和寫入未加密的應用層資料,並將其加密/解密為加密的寫入層資料。這些方法需要" @@ -1643,9 +1631,8 @@ msgstr "" #: ../../library/ssl.rst:1157 msgid "" -"Normally you should use the socket API methods " -"like :meth:`~socket.socket.recv` and :meth:`~socket.socket.send` instead of " -"these methods." +"Normally you should use the socket API methods like :meth:`~socket.socket." +"recv` and :meth:`~socket.socket.send` instead of these methods." msgstr "" "通常你應該使用像 :meth:`~socket.socket.recv` 和 :meth:`~socket.socket.send` " "這樣的 socket API 方法,而不是直接使用這些方法。" @@ -1656,13 +1643,12 @@ msgstr "執行 SSL 設定握手。" #: ../../library/ssl.rst:1165 msgid "" -"The handshake method also performs :func:`match_hostname` when " -"the :attr:`~SSLContext.check_hostname` attribute of the " -"socket's :attr:`~SSLSocket.context` is true." +"The handshake method also performs :func:`match_hostname` when the :attr:" +"`~SSLContext.check_hostname` attribute of the socket's :attr:`~SSLSocket." +"context` is true." msgstr "" -"當 socket 的 :attr:`~SSLSocket.context` " -"的 :attr:`~SSLContext.check_hostname` 屬性質為 true 時,握手方法也會執" -"行 :func:`match_hostname`。" +"當 socket 的 :attr:`~SSLSocket.context` 的 :attr:`~SSLContext." +"check_hostname` 屬性質為 true 時,握手方法也會執行 :func:`match_hostname`。" #: ../../library/ssl.rst:1170 msgid "" @@ -1674,23 +1660,23 @@ msgstr "" #: ../../library/ssl.rst:1174 msgid "" -"Hostname or IP address is matched by OpenSSL during handshake. The " -"function :func:`match_hostname` is no longer used. In case OpenSSL refuses a " -"hostname or IP address, the handshake is aborted early and a TLS alert " -"message is sent to the peer." +"Hostname or IP address is matched by OpenSSL during handshake. The function :" +"func:`match_hostname` is no longer used. In case OpenSSL refuses a hostname " +"or IP address, the handshake is aborted early and a TLS alert message is " +"sent to the peer." msgstr "" -"在握手過程中,OpenSSL 會去配對主機名稱或 IP 地址。已不再使" -"用 :func:`match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手" -"將會提前中止,並向對方發送 TLS 警報訊息。" +"在握手過程中,OpenSSL 會去配對主機名稱或 IP 地址。已不再使用 :func:" +"`match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手將會提前" +"中止,並向對方發送 TLS 警報訊息。" #: ../../library/ssl.rst:1182 msgid "" "If there is no certificate for the peer on the other end of the connection, " -"return ``None``. If the SSL handshake hasn't been done yet, " -"raise :exc:`ValueError`." +"return ``None``. If the SSL handshake hasn't been done yet, raise :exc:" +"`ValueError`." msgstr "" -"如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引" -"發 :exc:`ValueError`。" +"如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引發 :exc:" +"`ValueError`。" #: ../../library/ssl.rst:1186 msgid "" @@ -1771,8 +1757,8 @@ msgid "" "socket's role:" msgstr "" "如果 ``binary_form`` 參數設定為 :const:`True`,且對等提供了證書,則該方法會" -"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回" -"傳 :const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" +"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回傳 :" +"const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" #: ../../library/ssl.rst:1225 msgid "" @@ -1783,13 +1769,13 @@ msgstr "對於用戶端 SSL socket,伺服器將永遠提供證書,無論是 #: ../../library/ssl.rst:1228 msgid "" "for a server SSL socket, the client will only provide a certificate when " -"requested by the server; therefore :meth:`getpeercert` will " -"return :const:`None` if you used :const:`CERT_NONE` (rather " -"than :const:`CERT_OPTIONAL` or :const:`CERT_REQUIRED`)." +"requested by the server; therefore :meth:`getpeercert` will return :const:" +"`None` if you used :const:`CERT_NONE` (rather than :const:`CERT_OPTIONAL` " +"or :const:`CERT_REQUIRED`)." msgstr "" "對於伺服器 SSL socket,用戶端僅在伺服器要求時才會提供證書;因此,如果你使用的" -"是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` " -"或 :const:`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" +"是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` 或 :const:" +"`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" #: ../../library/ssl.rst:1233 msgid "See also :attr:`SSLContext.check_hostname`." @@ -1865,18 +1851,17 @@ msgstr "" msgid "" "The *cb_type* parameter allow selection of the desired channel binding type. " "Valid channel binding types are listed in the :data:`CHANNEL_BINDING_TYPES` " -"list. Currently only the 'tls-unique' channel binding, defined " -"by :rfc:`5929`, is supported. :exc:`ValueError` will be raised if an " -"unsupported channel binding type is requested." +"list. Currently only the 'tls-unique' channel binding, defined by :rfc:" +"`5929`, is supported. :exc:`ValueError` will be raised if an unsupported " +"channel binding type is requested." msgstr "" #: ../../library/ssl.rst:1305 msgid "" -"Return the protocol that was selected during the TLS handshake. " -"If :meth:`SSLContext.set_alpn_protocols` was not called, if the other party " -"does not support ALPN, if this socket does not support any of the client's " -"proposed protocols, or if the handshake has not happened yet, ``None`` is " -"returned." +"Return the protocol that was selected during the TLS handshake. If :meth:" +"`SSLContext.set_alpn_protocols` was not called, if the other party does not " +"support ALPN, if this socket does not support any of the client's proposed " +"protocols, or if the handshake has not happened yet, ``None`` is returned." msgstr "" #: ../../library/ssl.rst:1315 @@ -1904,8 +1889,8 @@ msgstr "" msgid "" "Requests post-handshake authentication (PHA) from a TLS 1.3 client. PHA can " "only be initiated for a TLS 1.3 connection from a server-side socket, after " -"the initial TLS handshake and with PHA enabled on both sides, " -"see :attr:`SSLContext.post_handshake_auth`." +"the initial TLS handshake and with PHA enabled on both sides, see :attr:" +"`SSLContext.post_handshake_auth`." msgstr "" #: ../../library/ssl.rst:1341 @@ -1917,8 +1902,8 @@ msgstr "" #: ../../library/ssl.rst:1345 msgid "" -"If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), " -"an :exc:`SSLError` is raised." +"If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), an :exc:" +"`SSLError` is raised." msgstr "" #: ../../library/ssl.rst:1349 @@ -1962,16 +1947,16 @@ msgstr "" msgid "" "The attribute is now always ASCII text. When ``server_hostname`` is an " "internationalized domain name (IDN), this attribute now stores the A-label " -"form (``\"xn--pythn-mua.org\"``), rather than the U-label form " -"(``\"pythön.org\"``)." +"form (``\"xn--pythn-mua.org\"``), rather than the U-label form (``\"pythön." +"org\"``)." msgstr "" #: ../../library/ssl.rst:1397 msgid "" "The :class:`SSLSession` for this SSL connection. The session is available " "for client and server side sockets after the TLS handshake has been " -"performed. For client sockets the session can be set " -"before :meth:`~SSLSocket.do_handshake` has been called to reuse a session." +"performed. For client sockets the session can be set before :meth:" +"`~SSLSocket.do_handshake` has been called to reuse a session." msgstr "" #: ../../library/ssl.rst:1410 @@ -2077,7 +2062,7 @@ msgstr "*TLSv1.2*" #: ../../library/ssl.rst:1446 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../library/ssl.rst:1447 msgid ":class:`SSLContext` disables SSLv2 with :data:`OP_NO_SSLv2` by default." @@ -2101,27 +2086,28 @@ msgstr "" #: ../../library/ssl.rst:1459 msgid "" -"The context is created with secure default values. The " -"options :data:`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:`OP_SINGLE_DH_USE`, :data:`OP_SINGLE_ECDH_USE`, :data:`OP_NO_SSLv2`, " -"and :data:`OP_NO_SSLv3` (except for :data:`PROTOCOL_SSLv3`) are set by " -"default. The initial cipher suite list contains only ``HIGH`` ciphers, no " -"``NULL`` ciphers and no ``MD5`` ciphers." +"The context is created with secure default values. The options :data:" +"`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:" +"`OP_SINGLE_DH_USE`, :data:`OP_SINGLE_ECDH_USE`, :data:`OP_NO_SSLv2`, and :" +"data:`OP_NO_SSLv3` (except for :data:`PROTOCOL_SSLv3`) are set by default. " +"The initial cipher suite list contains only ``HIGH`` ciphers, no ``NULL`` " +"ciphers and no ``MD5`` ciphers." msgstr "" #: ../../library/ssl.rst:1469 msgid "" ":class:`SSLContext` without protocol argument is deprecated. The context " -"class will either require :data:`PROTOCOL_TLS_CLIENT` " -"or :data:`PROTOCOL_TLS_SERVER` protocol in the future." +"class will either require :data:`PROTOCOL_TLS_CLIENT` or :data:" +"`PROTOCOL_TLS_SERVER` protocol in the future." msgstr "" #: ../../library/ssl.rst:1475 msgid "" "The default cipher suites now include only secure AES and ChaCha20 ciphers " "with forward secrecy and security level 2. RSA and DH keys with less than " -"2048 bits and ECC keys with less than 224 bits are " -"prohibited. :data:`PROTOCOL_TLS`, :data:`PROTOCOL_TLS_CLIENT`, " -"and :data:`PROTOCOL_TLS_SERVER` use TLS 1.2 as minimum TLS version." +"2048 bits and ECC keys with less than 224 bits are prohibited. :data:" +"`PROTOCOL_TLS`, :data:`PROTOCOL_TLS_CLIENT`, and :data:`PROTOCOL_TLS_SERVER` " +"use TLS 1.2 as minimum TLS version." msgstr "" #: ../../library/ssl.rst:1483 @@ -2141,7 +2127,7 @@ msgstr "" #: ../../library/ssl.rst:1495 msgid ":class:`SSLContext` objects have the following methods and attributes:" -msgstr "" +msgstr ":class:`SSLContext` 物件具有以下方法和屬性:" #: ../../library/ssl.rst:1499 msgid "" @@ -2206,9 +2192,9 @@ msgstr "新增可選引數 *password*。" msgid "" "Load a set of default \"certification authority\" (CA) certificates from " "default locations. On Windows it loads CA certs from the ``CA`` and ``ROOT`` " -"system stores. On all systems it " -"calls :meth:`SSLContext.set_default_verify_paths`. In the future the method " -"may load CA certificates from other locations, too." +"system stores. On all systems it calls :meth:`SSLContext." +"set_default_verify_paths`. In the future the method may load CA certificates " +"from other locations, too." msgstr "" #: ../../library/ssl.rst:1549 @@ -2223,9 +2209,8 @@ msgstr "" #: ../../library/ssl.rst:1559 msgid "" "Load a set of \"certification authority\" (CA) certificates used to validate " -"other peers' certificates when :data:`verify_mode` is other " -"than :data:`CERT_NONE`. At least one of *cafile* or *capath* must be " -"specified." +"other peers' certificates when :data:`verify_mode` is other than :data:" +"`CERT_NONE`. At least one of *cafile* or *capath* must be specified." msgstr "" #: ../../library/ssl.rst:1563 @@ -2279,8 +2264,8 @@ msgstr "" #: ../../library/ssl.rst:1602 msgid "" -"Get a list of enabled ciphers. The list is in order of cipher priority. " -"See :meth:`SSLContext.set_ciphers`." +"Get a list of enabled ciphers. The list is in order of cipher priority. See :" +"meth:`SSLContext.set_ciphers`." msgstr "" #: ../../library/ssl.rst:1607 @@ -2368,16 +2353,16 @@ msgstr "" #: ../../library/ssl.rst:1659 msgid "" -"TLS 1.3 cipher suites cannot be disabled " -"with :meth:`~SSLContext.set_ciphers`." +"TLS 1.3 cipher suites cannot be disabled with :meth:`~SSLContext." +"set_ciphers`." msgstr "" #: ../../library/ssl.rst:1664 msgid "" "Specify which protocols the socket should advertise during the SSL/TLS " -"handshake. It should be a list of ASCII strings, like ``['http/1.1', 'spdy/" -"2']``, ordered by preference. The selection of a protocol will happen during " -"the handshake, and will play out according to :rfc:`7301`. After a " +"handshake. It should be a list of ASCII strings, like ``['http/1.1', " +"'spdy/2']``, ordered by preference. The selection of a protocol will happen " +"during the handshake, and will play out according to :rfc:`7301`. After a " "successful handshake, the :meth:`SSLSocket.selected_alpn_protocol` method " "will return the agreed-upon protocol." msgstr "" @@ -2386,7 +2371,7 @@ msgstr "" msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_ALPN` is " "``False``." -msgstr "" +msgstr "此方法會在 :data:`HAS_ALPN` 為 ``False`` 時引發 :exc:`NotImplementedError`。" #: ../../library/ssl.rst:1678 msgid "" @@ -2395,16 +2380,16 @@ msgid "" "ordered by preference. The selection of a protocol will happen during the " "handshake, and will play out according to the `Application Layer Protocol " "Negotiation `_. After a successful handshake, " -"the :meth:`SSLSocket.selected_npn_protocol` method will return the agreed-" -"upon protocol." +"Layer_Protocol_Negotiation>`_. After a successful handshake, the :meth:" +"`SSLSocket.selected_npn_protocol` method will return the agreed-upon " +"protocol." msgstr "" #: ../../library/ssl.rst:1686 msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_NPN` is " "``False``." -msgstr "" +msgstr "此方法會在 :data:`HAS_NPN` 為 ``False`` 時引發 :exc:`NotImplementedError`。" #: ../../library/ssl.rst:1697 msgid "" @@ -2434,37 +2419,37 @@ msgstr "" #: ../../library/ssl.rst:1714 msgid "" -"A typical use of this callback is to change " -"the :class:`ssl.SSLSocket`'s :attr:`SSLSocket.context` attribute to a new " -"object of type :class:`SSLContext` representing a certificate chain that " -"matches the server name." +"A typical use of this callback is to change the :class:`ssl.SSLSocket`'s :" +"attr:`SSLSocket.context` attribute to a new object of type :class:" +"`SSLContext` representing a certificate chain that matches the server name." msgstr "" #: ../../library/ssl.rst:1719 msgid "" "Due to the early negotiation phase of the TLS connection, only limited " -"methods and attributes are usable " -"like :meth:`SSLSocket.selected_alpn_protocol` and :attr:`SSLSocket.context`. " -"The :meth:`SSLSocket.getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket.get_unverified_chain` :meth:`SSLSocket.cipher` " -"and :meth:`SSLSocket.compression` methods require that the TLS connection " -"has progressed beyond the TLS Client Hello and therefore will not return " -"meaningful values nor can they be called safely." +"methods and attributes are usable like :meth:`SSLSocket." +"selected_alpn_protocol` and :attr:`SSLSocket.context`. The :meth:`SSLSocket." +"getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket." +"get_unverified_chain` :meth:`SSLSocket.cipher` and :meth:`SSLSocket." +"compression` methods require that the TLS connection has progressed beyond " +"the TLS Client Hello and therefore will not return meaningful values nor can " +"they be called safely." msgstr "" #: ../../library/ssl.rst:1728 msgid "" "The *sni_callback* function must return ``None`` to allow the TLS " -"negotiation to continue. If a TLS failure is required, a " -"constant :const:`ALERT_DESCRIPTION_* ` can " -"be returned. Other return values will result in a TLS fatal error " -"with :const:`ALERT_DESCRIPTION_INTERNAL_ERROR`." +"negotiation to continue. If a TLS failure is required, a constant :const:" +"`ALERT_DESCRIPTION_* ` can be returned. " +"Other return values will result in a TLS fatal error with :const:" +"`ALERT_DESCRIPTION_INTERNAL_ERROR`." msgstr "" #: ../../library/ssl.rst:1734 msgid "" "If an exception is raised from the *sni_callback* function the TLS " -"connection will terminate with a fatal TLS alert " -"message :const:`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." +"connection will terminate with a fatal TLS alert message :const:" +"`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." msgstr "" #: ../../library/ssl.rst:1738 @@ -2500,8 +2485,8 @@ msgstr "" #: ../../library/ssl.rst:1765 msgid "" -"This setting doesn't apply to client sockets. You can also use " -"the :data:`OP_SINGLE_DH_USE` option to further improve security." +"This setting doesn't apply to client sockets. You can also use the :data:" +"`OP_SINGLE_DH_USE` option to further improve security." msgstr "" #: ../../library/ssl.rst:1772 @@ -2515,13 +2500,13 @@ msgstr "" #: ../../library/ssl.rst:1778 msgid "" -"This setting doesn't apply to client sockets. You can also use " -"the :data:`OP_SINGLE_ECDH_USE` option to further improve security." +"This setting doesn't apply to client sockets. You can also use the :data:" +"`OP_SINGLE_ECDH_USE` option to further improve security." msgstr "" #: ../../library/ssl.rst:1781 msgid "This method is not available if :data:`HAS_ECDH` is ``False``." -msgstr "" +msgstr "此方法在 :data:`HAS_ECDH` 為 ``False`` 時不可用。" #: ../../library/ssl.rst:1786 msgid "" @@ -2535,11 +2520,10 @@ msgstr "" #: ../../library/ssl.rst:1793 msgid "" -"Wrap an existing Python socket *sock* and return an instance " -"of :attr:`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The " -"returned SSL socket is tied to the context, its settings and certificates. " -"*sock* must be a :const:`~socket.SOCK_STREAM` socket; other socket types are " -"unsupported." +"Wrap an existing Python socket *sock* and return an instance of :attr:" +"`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The returned SSL " +"socket is tied to the context, its settings and certificates. *sock* must be " +"a :const:`~socket.SOCK_STREAM` socket; other socket types are unsupported." msgstr "" #: ../../library/ssl.rst:1799 @@ -2555,8 +2539,8 @@ msgid "" "after :meth:`connect` is called on the socket. For server-side sockets, if " "the socket has no remote peer, it is assumed to be a listening socket, and " "the server-side SSL wrapping is automatically performed on client " -"connections accepted via the :meth:`accept` method. The method may " -"raise :exc:`SSLError`." +"connections accepted via the :meth:`accept` method. The method may raise :" +"exc:`SSLError`." msgstr "" #: ../../library/ssl.rst:1810 @@ -2572,20 +2556,20 @@ msgstr "" msgid "" "The parameter ``do_handshake_on_connect`` specifies whether to do the SSL " "handshake automatically after doing a :meth:`socket.connect`, or whether the " -"application program will call it explicitly, by invoking " -"the :meth:`SSLSocket.do_handshake` method. " -"Calling :meth:`SSLSocket.do_handshake` explicitly gives the program control " -"over the blocking behavior of the socket I/O involved in the handshake." +"application program will call it explicitly, by invoking the :meth:" +"`SSLSocket.do_handshake` method. Calling :meth:`SSLSocket.do_handshake` " +"explicitly gives the program control over the blocking behavior of the " +"socket I/O involved in the handshake." msgstr "" #: ../../library/ssl.rst:1823 msgid "" -"The parameter ``suppress_ragged_eofs`` specifies how " -"the :meth:`SSLSocket.recv` method should signal unexpected EOF from the " -"other end of the connection. If specified as :const:`True` (the default), " -"it returns a normal EOF (an empty bytes object) in response to unexpected " -"EOF errors raised from the underlying socket; if :const:`False`, it will " -"raise the exceptions back to the caller." +"The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket." +"recv` method should signal unexpected EOF from the other end of the " +"connection. If specified as :const:`True` (the default), it returns a " +"normal EOF (an empty bytes object) in response to unexpected EOF errors " +"raised from the underlying socket; if :const:`False`, it will raise the " +"exceptions back to the caller." msgstr "" #: ../../library/ssl.rst:1830 @@ -2594,8 +2578,8 @@ msgstr "" #: ../../library/ssl.rst:1832 msgid "" -"To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, " -"use :meth:`SSLContext.wrap_bio`." +"To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, use :meth:" +"`SSLContext.wrap_bio`." msgstr "" #: ../../library/ssl.rst:1835 @@ -2604,7 +2588,7 @@ msgid "" "SNI." msgstr "" -#: ../../library/ssl.rst:1839 ../../library/ssl.rst:1865 +#: ../../library/ssl.rst:1839 ../../library/ssl.rst:1866 msgid "*session* argument was added." msgstr "新增 *session* 引數。" @@ -2616,39 +2600,39 @@ msgstr "" #: ../../library/ssl.rst:1848 msgid "" -"The return type of :meth:`SSLContext.wrap_socket`, defaults " -"to :class:`SSLSocket`. The attribute can be overridden on instance of class " -"in order to return a custom subclass of :class:`SSLSocket`." +"The return type of :meth:`SSLContext.wrap_socket`, defaults to :class:" +"`SSLSocket`. The attribute can be assigned to on instances of :class:" +"`SSLContext` in order to return a custom subclass of :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1857 +#: ../../library/ssl.rst:1858 msgid "" -"Wrap the BIO objects *incoming* and *outgoing* and return an instance " -"of :attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " +"Wrap the BIO objects *incoming* and *outgoing* and return an instance of :" +"attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " "routines will read input data from the incoming BIO and write data to the " "outgoing BIO." msgstr "" -#: ../../library/ssl.rst:1862 +#: ../../library/ssl.rst:1863 msgid "" "The *server_side*, *server_hostname* and *session* parameters have the same " "meaning as in :meth:`SSLContext.wrap_socket`." msgstr "" -#: ../../library/ssl.rst:1868 +#: ../../library/ssl.rst:1869 msgid "" "The method returns an instance of :attr:`SSLContext.sslobject_class` instead " "of hard-coded :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1874 +#: ../../library/ssl.rst:1875 msgid "" -"The return type of :meth:`SSLContext.wrap_bio`, defaults " -"to :class:`SSLObject`. The attribute can be overridden on instance of class " -"in order to return a custom subclass of :class:`SSLObject`." +"The return type of :meth:`SSLContext.wrap_bio`, defaults to :class:" +"`SSLObject`. The attribute can be overridden on instance of class in order " +"to return a custom subclass of :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1882 +#: ../../library/ssl.rst:1883 msgid "" "Get statistics about the SSL sessions created or managed by this context. A " "dictionary is returned which maps the names of each `piece of information " @@ -2657,7 +2641,7 @@ msgid "" "the session cache since the context was created::" msgstr "" -#: ../../library/ssl.rst:1887 +#: ../../library/ssl.rst:1888 msgid "" ">>> stats = context.session_stats()\n" ">>> stats['hits'], stats['misses']\n" @@ -2667,21 +2651,20 @@ msgstr "" ">>> stats['hits'], stats['misses']\n" "(0, 0)" -#: ../../library/ssl.rst:1893 +#: ../../library/ssl.rst:1894 msgid "" "Whether to match the peer cert's hostname in :meth:`SSLSocket.do_handshake`. " -"The context's :attr:`~SSLContext.verify_mode` must be set " -"to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, and you must pass " +"The context's :attr:`~SSLContext.verify_mode` must be set to :data:" +"`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, and you must pass " "*server_hostname* to :meth:`~SSLContext.wrap_socket` in order to match the " -"hostname. Enabling hostname checking automatically " -"sets :attr:`~SSLContext.verify_mode` from :data:`CERT_NONE` " -"to :data:`CERT_REQUIRED`. It cannot be set back to :data:`CERT_NONE` as " -"long as hostname checking is enabled. The :data:`PROTOCOL_TLS_CLIENT` " -"protocol enables hostname checking by default. With other protocols, " -"hostname checking must be enabled explicitly." +"hostname. Enabling hostname checking automatically sets :attr:`~SSLContext." +"verify_mode` from :data:`CERT_NONE` to :data:`CERT_REQUIRED`. It cannot be " +"set back to :data:`CERT_NONE` as long as hostname checking is enabled. The :" +"data:`PROTOCOL_TLS_CLIENT` protocol enables hostname checking by default. " +"With other protocols, hostname checking must be enabled explicitly." msgstr "" -#: ../../library/ssl.rst:1906 +#: ../../library/ssl.rst:1907 msgid "" "import socket, ssl\n" "\n" @@ -2705,15 +2688,15 @@ msgstr "" "ssl_sock = context.wrap_socket(s, server_hostname='www.verisign.com')\n" "ssl_sock.connect(('www.verisign.com', 443))" -#: ../../library/ssl.rst:1921 +#: ../../library/ssl.rst:1922 msgid "" -":attr:`~SSLContext.verify_mode` is now automatically changed " -"to :data:`CERT_REQUIRED` when hostname checking is enabled " -"and :attr:`~SSLContext.verify_mode` is :data:`CERT_NONE`. Previously the " -"same operation would have failed with a :exc:`ValueError`." +":attr:`~SSLContext.verify_mode` is now automatically changed to :data:" +"`CERT_REQUIRED` when hostname checking is enabled and :attr:`~SSLContext." +"verify_mode` is :data:`CERT_NONE`. Previously the same operation would have " +"failed with a :exc:`ValueError`." msgstr "" -#: ../../library/ssl.rst:1928 +#: ../../library/ssl.rst:1929 msgid "" "Write TLS keys to a keylog file, whenever key material is generated or " "received. The keylog file is designed for debugging purposes only. The file " @@ -2722,58 +2705,56 @@ msgid "" "synchronized between threads, but not between processes." msgstr "" -#: ../../library/ssl.rst:1938 +#: ../../library/ssl.rst:1939 msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " -"attribute is read-only for protocols other " -"than :const:`PROTOCOL_TLS`, :const:`PROTOCOL_TLS_CLIENT`, " -"and :const:`PROTOCOL_TLS_SERVER`." +"attribute is read-only for protocols other than :const:`PROTOCOL_TLS`, :" +"const:`PROTOCOL_TLS_CLIENT`, and :const:`PROTOCOL_TLS_SERVER`." msgstr "" -#: ../../library/ssl.rst:1943 +#: ../../library/ssl.rst:1944 msgid "" -"The " -"attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext.minimum_version` " -"and :attr:`SSLContext.options` all affect the supported SSL and TLS versions " -"of the context. The implementation does not prevent invalid combination. For " -"example a context with :attr:`OP_NO_TLSv1_2` in :attr:`~SSLContext.options` " -"and :attr:`~SSLContext.maximum_version` set to :attr:`TLSVersion.TLSv1_2` " -"will not be able to establish a TLS 1.2 connection." +"The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext." +"minimum_version` and :attr:`SSLContext.options` all affect the supported SSL " +"and TLS versions of the context. The implementation does not prevent invalid " +"combination. For example a context with :attr:`OP_NO_TLSv1_2` in :attr:" +"`~SSLContext.options` and :attr:`~SSLContext.maximum_version` set to :attr:" +"`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." msgstr "" -#: ../../library/ssl.rst:1956 +#: ../../library/ssl.rst:1957 msgid "" "Like :attr:`SSLContext.maximum_version` except it is the lowest supported " "version or :attr:`TLSVersion.MINIMUM_SUPPORTED`." msgstr "" -#: ../../library/ssl.rst:1963 +#: ../../library/ssl.rst:1964 msgid "" -"Control the number of TLS 1.3 session tickets of " -"a :const:`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 " -"to 1.2 connections." +"Control the number of TLS 1.3 session tickets of a :const:" +"`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 " +"connections." msgstr "" -#: ../../library/ssl.rst:1971 +#: ../../library/ssl.rst:1972 msgid "" "An integer representing the set of SSL options enabled on this context. The " -"default value is :data:`OP_ALL`, but you can specify other options such " -"as :data:`OP_NO_SSLv2` by ORing them together." +"default value is :data:`OP_ALL`, but you can specify other options such as :" +"data:`OP_NO_SSLv2` by ORing them together." msgstr "" -#: ../../library/ssl.rst:1975 +#: ../../library/ssl.rst:1976 msgid ":attr:`SSLContext.options` returns :class:`Options` flags:" msgstr ":attr:`SSLContext.options` 會回傳 :class:`Options` 旗標:" -#: ../../library/ssl.rst:1983 +#: ../../library/ssl.rst:1984 msgid "" "All ``OP_NO_SSL*`` and ``OP_NO_TLS*`` options have been deprecated since " -"Python 3.7. Use :attr:`SSLContext.minimum_version` " -"and :attr:`SSLContext.maximum_version` instead." +"Python 3.7. Use :attr:`SSLContext.minimum_version` and :attr:`SSLContext." +"maximum_version` instead." msgstr "" -#: ../../library/ssl.rst:1989 +#: ../../library/ssl.rst:1990 msgid "" "Enable TLS 1.3 post-handshake client authentication. Post-handshake auth is " "disabled by default and a server can only request a TLS client certificate " @@ -2781,81 +2762,80 @@ msgid "" "client certificate at any time after the handshake." msgstr "" -#: ../../library/ssl.rst:1994 +#: ../../library/ssl.rst:1995 msgid "" "When enabled on client-side sockets, the client signals the server that it " "supports post-handshake authentication." msgstr "" -#: ../../library/ssl.rst:1997 +#: ../../library/ssl.rst:1998 msgid "" "When enabled on server-side sockets, :attr:`SSLContext.verify_mode` must be " "set to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, too. The actual " -"client cert exchange is delayed " -"until :meth:`SSLSocket.verify_client_post_handshake` is called and some I/O " -"is performed." +"client cert exchange is delayed until :meth:`SSLSocket." +"verify_client_post_handshake` is called and some I/O is performed." msgstr "" -#: ../../library/ssl.rst:2007 +#: ../../library/ssl.rst:2008 msgid "" "The protocol version chosen when constructing the context. This attribute " "is read-only." msgstr "" -#: ../../library/ssl.rst:2012 +#: ../../library/ssl.rst:2013 msgid "" "Whether :attr:`~SSLContext.check_hostname` falls back to verify the cert's " "subject common name in the absence of a subject alternative name extension " "(default: true)." msgstr "" -#: ../../library/ssl.rst:2020 +#: ../../library/ssl.rst:2021 msgid "" "The flag had no effect with OpenSSL before version 1.1.1l. Python 3.8.9, " "3.9.3, and 3.10 include workarounds for previous versions." msgstr "" -#: ../../library/ssl.rst:2025 +#: ../../library/ssl.rst:2026 msgid "" "An integer representing the `security level `_ for the context. This attribute is read-" "only." msgstr "" -#: ../../library/ssl.rst:2033 +#: ../../library/ssl.rst:2034 msgid "" -"The flags for certificate verification operations. You can set flags " -"like :data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default " -"OpenSSL does neither require nor verify certificate revocation lists (CRLs)." +"The flags for certificate verification operations. You can set flags like :" +"data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default OpenSSL does " +"neither require nor verify certificate revocation lists (CRLs)." msgstr "" -#: ../../library/ssl.rst:2039 +#: ../../library/ssl.rst:2040 msgid ":attr:`SSLContext.verify_flags` returns :class:`VerifyFlags` flags:" -msgstr "" +msgstr ":attr:`SSLContext.verify_flags` 會回傳 :class:`VerifyFlags` 旗標:" -#: ../../library/ssl.rst:2047 +#: ../../library/ssl.rst:2048 msgid "" "Whether to try to verify other peers' certificates and how to behave if " -"verification fails. This attribute must be one " -"of :data:`CERT_NONE`, :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." +"verification fails. This attribute must be one of :data:`CERT_NONE`, :data:" +"`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." msgstr "" -#: ../../library/ssl.rst:2051 +#: ../../library/ssl.rst:2052 msgid ":attr:`SSLContext.verify_mode` returns :class:`VerifyMode` enum:" msgstr ":attr:`SSLContext.verify_mode` 會回傳 :class:`VerifyMode` 列舉:" -#: ../../library/ssl.rst:2059 +#: ../../library/ssl.rst:2060 msgid "" "Enables TLS-PSK (pre-shared key) authentication on a client-side connection." msgstr "" -#: ../../library/ssl.rst:2061 ../../library/ssl.rst:2110 +#: ../../library/ssl.rst:2062 ../../library/ssl.rst:2111 msgid "" "In general, certificate based authentication should be preferred over this " "method." msgstr "" -#: ../../library/ssl.rst:2063 +#: ../../library/ssl.rst:2064 msgid "" "The parameter ``callback`` is a callable object with the signature: ``def " "callback(hint: str | None) -> tuple[str | None, bytes]``. The ``hint`` " @@ -2867,27 +2847,27 @@ msgid "" "shared key. Return a zero length PSK to reject the connection." msgstr "" -#: ../../library/ssl.rst:2073 ../../library/ssl.rst:2119 +#: ../../library/ssl.rst:2074 ../../library/ssl.rst:2120 msgid "Setting ``callback`` to :const:`None` removes any existing callback." msgstr "" -#: ../../library/ssl.rst:2076 +#: ../../library/ssl.rst:2077 msgid "When using TLS 1.3:" -msgstr "" +msgstr "使用 TLS 1.3 時:" -#: ../../library/ssl.rst:2078 +#: ../../library/ssl.rst:2079 msgid "the ``hint`` parameter is always :const:`None`." -msgstr "" +msgstr "``hint`` 參數始終為 :const:`None`。" -#: ../../library/ssl.rst:2079 +#: ../../library/ssl.rst:2080 msgid "client-identity must be a non-empty string." msgstr "" -#: ../../library/ssl.rst:2081 ../../library/ssl.rst:2128 +#: ../../library/ssl.rst:2082 ../../library/ssl.rst:2129 msgid "Example usage::" msgstr "範例用法: ::" -#: ../../library/ssl.rst:2083 +#: ../../library/ssl.rst:2084 msgid "" "context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" "context.check_hostname = False\n" @@ -2908,18 +2888,18 @@ msgid "" "context.set_psk_client_callback(callback)" msgstr "" -#: ../../library/ssl.rst:2101 ../../library/ssl.rst:2146 +#: ../../library/ssl.rst:2102 ../../library/ssl.rst:2147 msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_PSK` is " "``False``." msgstr "" -#: ../../library/ssl.rst:2108 +#: ../../library/ssl.rst:2109 msgid "" "Enables TLS-PSK (pre-shared key) authentication on a server-side connection." msgstr "" -#: ../../library/ssl.rst:2112 +#: ../../library/ssl.rst:2113 msgid "" "The parameter ``callback`` is a callable object with the signature: ``def " "callback(identity: str | None) -> bytes``. The ``identity`` parameter is an " @@ -2929,19 +2909,19 @@ msgid "" "connection." msgstr "" -#: ../../library/ssl.rst:2121 +#: ../../library/ssl.rst:2122 msgid "" "The parameter ``identity_hint`` is an optional identity hint string sent to " "the client. The string must be less than or equal to ``256`` octets when " "UTF-8 encoded." msgstr "" -#: ../../library/ssl.rst:2126 +#: ../../library/ssl.rst:2127 msgid "" "When using TLS 1.3 the ``identity_hint`` parameter is not sent to the client." msgstr "" -#: ../../library/ssl.rst:2130 +#: ../../library/ssl.rst:2131 msgid "" "context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" "context.maximum_version = ssl.TLSVersion.TLSv1_2\n" @@ -2960,11 +2940,11 @@ msgid "" "context.set_psk_server_callback(callback, 'ServerId_1')" msgstr "" -#: ../../library/ssl.rst:2158 +#: ../../library/ssl.rst:2159 msgid "Certificates" msgstr "" -#: ../../library/ssl.rst:2160 +#: ../../library/ssl.rst:2161 msgid "" "Certificates in general are part of a public-key / private-key system. In " "this system, each *principal*, (which may be a machine, or a person, or an " @@ -2975,7 +2955,7 @@ msgid "" "other part, and **only** with the other part." msgstr "" -#: ../../library/ssl.rst:2168 +#: ../../library/ssl.rst:2169 msgid "" "A certificate contains information about two principals. It contains the " "name of a *subject*, and the subject's public key. It also contains a " @@ -2989,7 +2969,7 @@ msgid "" "as two fields, called \"notBefore\" and \"notAfter\"." msgstr "" -#: ../../library/ssl.rst:2178 +#: ../../library/ssl.rst:2179 msgid "" "In the Python use of certificates, a client or server can use a certificate " "to prove who they are. The other side of a network connection can also be " @@ -3002,14 +2982,14 @@ msgid "" "take place." msgstr "" -#: ../../library/ssl.rst:2188 +#: ../../library/ssl.rst:2189 msgid "" "Python uses files to contain certificates. They should be formatted as " "\"PEM\" (see :rfc:`1422`), which is a base-64 encoded form wrapped with a " "header line and a footer line::" msgstr "" -#: ../../library/ssl.rst:2192 +#: ../../library/ssl.rst:2193 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate in base64 PEM encoding) ...\n" @@ -3019,11 +2999,11 @@ msgstr "" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2197 +#: ../../library/ssl.rst:2198 msgid "Certificate chains" msgstr "" -#: ../../library/ssl.rst:2199 +#: ../../library/ssl.rst:2200 msgid "" "The Python files which contain certificates can contain a sequence of " "certificates, sometimes called a *certificate chain*. This chain should " @@ -3039,7 +3019,7 @@ msgid "" "agency which issued the certification authority's certificate::" msgstr "" -#: ../../library/ssl.rst:2212 +#: ../../library/ssl.rst:2213 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate for your server)...\n" @@ -3061,27 +3041,27 @@ msgstr "" "... (the root certificate for the CA's issuer)...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2223 +#: ../../library/ssl.rst:2224 msgid "CA certificates" msgstr "" -#: ../../library/ssl.rst:2225 +#: ../../library/ssl.rst:2226 msgid "" "If you are going to require validation of the other side of the connection's " "certificate, you need to provide a \"CA certs\" file, filled with the " "certificate chains for each issuer you are willing to trust. Again, this " "file just contains these chains concatenated together. For validation, " "Python will use the first chain it finds in the file which matches. The " -"platform's certificates file can be used by " -"calling :meth:`SSLContext.load_default_certs`, this is done automatically " -"with :func:`.create_default_context`." +"platform's certificates file can be used by calling :meth:`SSLContext." +"load_default_certs`, this is done automatically with :func:`." +"create_default_context`." msgstr "" -#: ../../library/ssl.rst:2234 +#: ../../library/ssl.rst:2235 msgid "Combined key and certificate" msgstr "" -#: ../../library/ssl.rst:2236 +#: ../../library/ssl.rst:2237 msgid "" "Often the private key is stored in the same file as the certificate; in this " "case, only the ``certfile`` parameter to :meth:`SSLContext.load_cert_chain` " @@ -3089,7 +3069,7 @@ msgid "" "should come before the first certificate in the certificate chain::" msgstr "" -#: ../../library/ssl.rst:2242 +#: ../../library/ssl.rst:2243 msgid "" "-----BEGIN RSA PRIVATE KEY-----\n" "... (private key in base64 encoding) ...\n" @@ -3105,11 +3085,11 @@ msgstr "" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2250 +#: ../../library/ssl.rst:2251 msgid "Self-signed certificates" msgstr "" -#: ../../library/ssl.rst:2252 +#: ../../library/ssl.rst:2253 msgid "" "If you are going to create a server that provides SSL-encrypted connection " "services, you will need to acquire a certificate for that service. There " @@ -3119,7 +3099,7 @@ msgid "" "package, using something like the following::" msgstr "" -#: ../../library/ssl.rst:2259 +#: ../../library/ssl.rst:2260 msgid "" "% openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem\n" "Generating a 1024 bit RSA private key\n" @@ -3145,28 +3125,28 @@ msgid "" "%" msgstr "" -#: ../../library/ssl.rst:2281 +#: ../../library/ssl.rst:2282 msgid "" "The disadvantage of a self-signed certificate is that it is its own root " "certificate, and no one else will have it in their cache of known (and " "trusted) root certificates." msgstr "" -#: ../../library/ssl.rst:2287 +#: ../../library/ssl.rst:2288 msgid "Examples" msgstr "範例" -#: ../../library/ssl.rst:2290 +#: ../../library/ssl.rst:2291 msgid "Testing for SSL support" msgstr "" -#: ../../library/ssl.rst:2292 +#: ../../library/ssl.rst:2293 msgid "" "To test for the presence of SSL support in a Python installation, user code " "should use the following idiom::" msgstr "" -#: ../../library/ssl.rst:2295 +#: ../../library/ssl.rst:2296 msgid "" "try:\n" " import ssl\n" @@ -3176,27 +3156,27 @@ msgid "" " ... # do something that requires SSL support" msgstr "" -#: ../../library/ssl.rst:2303 +#: ../../library/ssl.rst:2304 msgid "Client-side operation" msgstr "" -#: ../../library/ssl.rst:2305 +#: ../../library/ssl.rst:2306 msgid "" "This example creates a SSL context with the recommended security settings " "for client sockets, including automatic certificate verification::" msgstr "" -#: ../../library/ssl.rst:2308 +#: ../../library/ssl.rst:2309 msgid ">>> context = ssl.create_default_context()" msgstr ">>> context = ssl.create_default_context()" -#: ../../library/ssl.rst:2310 +#: ../../library/ssl.rst:2311 msgid "" "If you prefer to tune security settings yourself, you might create a context " "from scratch (but beware that you might not get the settings right)::" msgstr "" -#: ../../library/ssl.rst:2314 +#: ../../library/ssl.rst:2315 msgid "" ">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" @@ -3204,14 +3184,14 @@ msgstr "" ">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" -#: ../../library/ssl.rst:2317 +#: ../../library/ssl.rst:2318 msgid "" "(this snippet assumes your operating system places a bundle of all CA " "certificates in ``/etc/ssl/certs/ca-bundle.crt``; if not, you'll get an " "error and have to adjust the location)" msgstr "" -#: ../../library/ssl.rst:2321 +#: ../../library/ssl.rst:2322 msgid "" "The :data:`PROTOCOL_TLS_CLIENT` protocol configures the context for cert " "validation and hostname verification. :attr:`~SSLContext.verify_mode` is set " @@ -3219,16 +3199,16 @@ msgid "" "``True``. All other protocols create SSL contexts with insecure defaults." msgstr "" -#: ../../library/ssl.rst:2326 +#: ../../library/ssl.rst:2327 msgid "" -"When you use the context to connect to a server, :const:`CERT_REQUIRED` " -"and :attr:`~SSLContext.check_hostname` validate the server certificate: it " +"When you use the context to connect to a server, :const:`CERT_REQUIRED` and :" +"attr:`~SSLContext.check_hostname` validate the server certificate: it " "ensures that the server certificate was signed with one of the CA " "certificates, checks the signature for correctness, and verifies other " "properties like validity and identity of the hostname::" msgstr "" -#: ../../library/ssl.rst:2332 +#: ../../library/ssl.rst:2333 msgid "" ">>> conn = context.wrap_socket(socket.socket(socket.AF_INET),\n" "... server_hostname=\"www.python.org\")\n" @@ -3238,30 +3218,30 @@ msgstr "" "... server_hostname=\"www.python.org\")\n" ">>> conn.connect((\"www.python.org\", 443))" -#: ../../library/ssl.rst:2336 +#: ../../library/ssl.rst:2337 msgid "You may then fetch the certificate::" msgstr "" -#: ../../library/ssl.rst:2338 +#: ../../library/ssl.rst:2339 msgid ">>> cert = conn.getpeercert()" msgstr ">>> cert = conn.getpeercert()" -#: ../../library/ssl.rst:2340 +#: ../../library/ssl.rst:2341 msgid "" "Visual inspection shows that the certificate does identify the desired " "service (that is, the HTTPS host ``www.python.org``)::" msgstr "" -#: ../../library/ssl.rst:2343 +#: ../../library/ssl.rst:2344 msgid "" ">>> pprint.pprint(cert)\n" "{'OCSP': ('http://ocsp.digicert.com',),\n" " 'caIssuers': ('http://cacerts.digicert.com/" "DigiCertSHA2ExtendedValidationServerCA.crt',),\n" -" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-" -"g1.crl',\n" -" 'http://crl4.digicert.com/sha2-ev-server-" -"g1.crl'),\n" +" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1." +"crl',\n" +" 'http://crl4.digicert.com/sha2-ev-server-g1." +"crl'),\n" " 'issuer': ((('countryName', 'US'),),\n" " (('organizationName', 'DigiCert Inc'),),\n" " (('organizationalUnitName', 'www.digicert.com'),),\n" @@ -3302,10 +3282,10 @@ msgstr "" "{'OCSP': ('http://ocsp.digicert.com',),\n" " 'caIssuers': ('http://cacerts.digicert.com/" "DigiCertSHA2ExtendedValidationServerCA.crt',),\n" -" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-" -"g1.crl',\n" -" 'http://crl4.digicert.com/sha2-ev-server-" -"g1.crl'),\n" +" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1." +"crl',\n" +" 'http://crl4.digicert.com/sha2-ev-server-g1." +"crl'),\n" " 'issuer': ((('countryName', 'US'),),\n" " (('organizationName', 'DigiCert Inc'),),\n" " (('organizationalUnitName', 'www.digicert.com'),),\n" @@ -3342,13 +3322,13 @@ msgstr "" " ('DNS', 'id.python.org')),\n" " 'version': 3}" -#: ../../library/ssl.rst:2383 +#: ../../library/ssl.rst:2384 msgid "" "Now the SSL channel is established and the certificate verified, you can " "proceed to talk with the server::" msgstr "" -#: ../../library/ssl.rst:2386 +#: ../../library/ssl.rst:2387 msgid "" ">>> conn.sendall(b\"HEAD / HTTP/1.0\\r\\nHost: linuxfr.org\\r\\n\\r\\n\")\n" ">>> pprint.pprint(conn.recv(1024).split(b\"\\r\\n\"))\n" @@ -3390,11 +3370,11 @@ msgstr "" " b'',\n" " b'']" -#: ../../library/ssl.rst:2410 +#: ../../library/ssl.rst:2411 msgid "Server-side operation" -msgstr "" +msgstr "伺服器端操作" -#: ../../library/ssl.rst:2412 +#: ../../library/ssl.rst:2413 msgid "" "For server operation, typically you'll need to have a server certificate, " "and private key, each in a file. You'll first create a context holding the " @@ -3403,7 +3383,7 @@ msgid "" "start waiting for clients to connect::" msgstr "" -#: ../../library/ssl.rst:2418 +#: ../../library/ssl.rst:2419 msgid "" "import socket, ssl\n" "\n" @@ -3423,15 +3403,14 @@ msgstr "" "bindsocket.bind(('myaddr.example.com', 10023))\n" "bindsocket.listen(5)" -#: ../../library/ssl.rst:2427 +#: ../../library/ssl.rst:2428 msgid "" "When a client connects, you'll call :meth:`accept` on the socket to get the " -"new socket from the other end, and use the " -"context's :meth:`SSLContext.wrap_socket` method to create a server-side SSL " -"socket for the connection::" +"new socket from the other end, and use the context's :meth:`SSLContext." +"wrap_socket` method to create a server-side SSL socket for the connection::" msgstr "" -#: ../../library/ssl.rst:2431 +#: ../../library/ssl.rst:2432 msgid "" "while True:\n" " newsocket, fromaddr = bindsocket.accept()\n" @@ -3451,13 +3430,13 @@ msgstr "" " connstream.shutdown(socket.SHUT_RDWR)\n" " connstream.close()" -#: ../../library/ssl.rst:2440 +#: ../../library/ssl.rst:2441 msgid "" "Then you'll read data from the ``connstream`` and do something with it till " "you are finished with the client (or the client is finished with you)::" msgstr "" -#: ../../library/ssl.rst:2443 +#: ../../library/ssl.rst:2444 msgid "" "def deal_with_client(connstream):\n" " data = connstream.recv(1024)\n" @@ -3471,7 +3450,7 @@ msgid "" " # finished with client" msgstr "" -#: ../../library/ssl.rst:2454 +#: ../../library/ssl.rst:2455 msgid "" "And go back to listening for new client connections (of course, a real " "server would probably handle each client connection in a separate thread, or " @@ -3479,46 +3458,46 @@ msgid "" "event loop)." msgstr "" -#: ../../library/ssl.rst:2462 +#: ../../library/ssl.rst:2463 msgid "Notes on non-blocking sockets" msgstr "" -#: ../../library/ssl.rst:2464 +#: ../../library/ssl.rst:2465 msgid "" "SSL sockets behave slightly different than regular sockets in non-blocking " "mode. When working with non-blocking sockets, there are thus several things " "you need to be aware of:" msgstr "" -#: ../../library/ssl.rst:2468 +#: ../../library/ssl.rst:2469 msgid "" "Most :class:`SSLSocket` methods will raise either :exc:`SSLWantWriteError` " "or :exc:`SSLWantReadError` instead of :exc:`BlockingIOError` if an I/O " "operation would block. :exc:`SSLWantReadError` will be raised if a read " -"operation on the underlying socket is necessary, " -"and :exc:`SSLWantWriteError` for a write operation on the underlying socket. " -"Note that attempts to *write* to an SSL socket may require *reading* from " -"the underlying socket first, and attempts to *read* from the SSL socket may " +"operation on the underlying socket is necessary, and :exc:" +"`SSLWantWriteError` for a write operation on the underlying socket. Note " +"that attempts to *write* to an SSL socket may require *reading* from the " +"underlying socket first, and attempts to *read* from the SSL socket may " "require a prior *write* to the underlying socket." msgstr "" -#: ../../library/ssl.rst:2480 +#: ../../library/ssl.rst:2481 msgid "" "In earlier Python versions, the :meth:`!SSLSocket.send` method returned zero " "instead of raising :exc:`SSLWantWriteError` or :exc:`SSLWantReadError`." msgstr "" -#: ../../library/ssl.rst:2484 +#: ../../library/ssl.rst:2485 msgid "" "Calling :func:`~select.select` tells you that the OS-level socket can be " "read from (or written to), but it does not imply that there is sufficient " "data at the upper SSL layer. For example, only part of an SSL frame might " "have arrived. Therefore, you must be ready to handle :meth:`SSLSocket.recv` " -"and :meth:`SSLSocket.send` failures, and retry after another call " -"to :func:`~select.select`." +"and :meth:`SSLSocket.send` failures, and retry after another call to :func:" +"`~select.select`." msgstr "" -#: ../../library/ssl.rst:2491 +#: ../../library/ssl.rst:2492 msgid "" "Conversely, since the SSL layer has its own framing, a SSL socket may still " "have data available for reading without :func:`~select.select` being aware " @@ -3527,21 +3506,21 @@ msgid "" "call if still necessary." msgstr "" -#: ../../library/ssl.rst:2497 +#: ../../library/ssl.rst:2498 msgid "" -"(of course, similar provisions apply when using other primitives such " -"as :func:`~select.poll`, or those in the :mod:`selectors` module)" +"(of course, similar provisions apply when using other primitives such as :" +"func:`~select.poll`, or those in the :mod:`selectors` module)" msgstr "" -#: ../../library/ssl.rst:2500 +#: ../../library/ssl.rst:2501 msgid "" -"The SSL handshake itself will be non-blocking: " -"the :meth:`SSLSocket.do_handshake` method has to be retried until it returns " -"successfully. Here is a synopsis using :func:`~select.select` to wait for " -"the socket's readiness::" +"The SSL handshake itself will be non-blocking: the :meth:`SSLSocket." +"do_handshake` method has to be retried until it returns successfully. Here " +"is a synopsis using :func:`~select.select` to wait for the socket's " +"readiness::" msgstr "" -#: ../../library/ssl.rst:2505 +#: ../../library/ssl.rst:2506 msgid "" "while True:\n" " try:\n" @@ -3561,36 +3540,36 @@ msgstr "" " except ssl.SSLWantWriteError:\n" " select.select([], [sock], [])" -#: ../../library/ssl.rst:2516 +#: ../../library/ssl.rst:2517 msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets ` and provides a higher level :ref:`Streams API `. It polls for events using the :mod:`selectors` module and " -"handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` " -"and :exc:`BlockingIOError` exceptions. It runs the SSL handshake " -"asynchronously as well." +"handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` and :exc:" +"`BlockingIOError` exceptions. It runs the SSL handshake asynchronously as " +"well." msgstr "" -#: ../../library/ssl.rst:2525 +#: ../../library/ssl.rst:2526 msgid "Memory BIO Support" msgstr "記憶體 BIO 支援" -#: ../../library/ssl.rst:2529 +#: ../../library/ssl.rst:2530 msgid "" -"Ever since the SSL module was introduced in Python 2.6, " -"the :class:`SSLSocket` class has provided two related but distinct areas of " +"Ever since the SSL module was introduced in Python 2.6, the :class:" +"`SSLSocket` class has provided two related but distinct areas of " "functionality:" msgstr "" -#: ../../library/ssl.rst:2532 +#: ../../library/ssl.rst:2533 msgid "SSL protocol handling" msgstr "" -#: ../../library/ssl.rst:2533 +#: ../../library/ssl.rst:2534 msgid "Network IO" msgstr "" -#: ../../library/ssl.rst:2535 +#: ../../library/ssl.rst:2536 msgid "" "The network IO API is identical to that provided by :class:`socket.socket`, " "from which :class:`SSLSocket` also inherits. This allows an SSL socket to be " @@ -3598,19 +3577,19 @@ msgid "" "add SSL support to an existing application." msgstr "" -#: ../../library/ssl.rst:2540 +#: ../../library/ssl.rst:2541 msgid "" "Combining SSL protocol handling and network IO usually works well, but there " "are some cases where it doesn't. An example is async IO frameworks that want " "to use a different IO multiplexing model than the \"select/poll on a file " -"descriptor\" (readiness based) model that is assumed " -"by :class:`socket.socket` and by the internal OpenSSL socket IO routines. " -"This is mostly relevant for platforms like Windows where this model is not " -"efficient. For this purpose, a reduced scope variant of :class:`SSLSocket` " -"called :class:`SSLObject` is provided." +"descriptor\" (readiness based) model that is assumed by :class:`socket." +"socket` and by the internal OpenSSL socket IO routines. This is mostly " +"relevant for platforms like Windows where this model is not efficient. For " +"this purpose, a reduced scope variant of :class:`SSLSocket` called :class:" +"`SSLObject` is provided." msgstr "" -#: ../../library/ssl.rst:2551 +#: ../../library/ssl.rst:2552 msgid "" "A reduced-scope variant of :class:`SSLSocket` representing an SSL protocol " "instance that does not contain any network IO methods. This class is " @@ -3618,7 +3597,7 @@ msgid "" "for SSL through memory buffers." msgstr "" -#: ../../library/ssl.rst:2556 +#: ../../library/ssl.rst:2557 msgid "" "This class implements an interface on top of a low-level SSL object as " "implemented by OpenSSL. This object captures the state of an SSL connection " @@ -3626,7 +3605,7 @@ msgid "" "separate \"BIO\" objects which are OpenSSL's IO abstraction layer." msgstr "" -#: ../../library/ssl.rst:2561 +#: ../../library/ssl.rst:2562 msgid "" "This class has no public constructor. An :class:`SSLObject` instance must " "be created using the :meth:`~SSLContext.wrap_bio` method. This method will " @@ -3635,232 +3614,231 @@ msgid "" "instance, while the *outgoing* BIO is used to pass data the other way around." msgstr "" -#: ../../library/ssl.rst:2568 +#: ../../library/ssl.rst:2569 msgid "The following methods are available:" msgstr "" -#: ../../library/ssl.rst:2570 +#: ../../library/ssl.rst:2571 msgid ":attr:`~SSLSocket.context`" msgstr ":attr:`~SSLSocket.context`" -#: ../../library/ssl.rst:2571 +#: ../../library/ssl.rst:2572 msgid ":attr:`~SSLSocket.server_side`" msgstr ":attr:`~SSLSocket.server_side`" -#: ../../library/ssl.rst:2572 +#: ../../library/ssl.rst:2573 msgid ":attr:`~SSLSocket.server_hostname`" msgstr ":attr:`~SSLSocket.server_hostname`" -#: ../../library/ssl.rst:2573 +#: ../../library/ssl.rst:2574 msgid ":attr:`~SSLSocket.session`" msgstr ":attr:`~SSLSocket.session`" -#: ../../library/ssl.rst:2574 +#: ../../library/ssl.rst:2575 msgid ":attr:`~SSLSocket.session_reused`" msgstr ":attr:`~SSLSocket.session_reused`" -#: ../../library/ssl.rst:2575 +#: ../../library/ssl.rst:2576 msgid ":meth:`~SSLSocket.read`" msgstr ":meth:`~SSLSocket.read`" -#: ../../library/ssl.rst:2576 +#: ../../library/ssl.rst:2577 msgid ":meth:`~SSLSocket.write`" msgstr ":meth:`~SSLSocket.write`" -#: ../../library/ssl.rst:2577 +#: ../../library/ssl.rst:2578 msgid ":meth:`~SSLSocket.getpeercert`" msgstr ":meth:`~SSLSocket.getpeercert`" -#: ../../library/ssl.rst:2578 +#: ../../library/ssl.rst:2579 msgid ":meth:`~SSLSocket.get_verified_chain`" msgstr ":meth:`~SSLSocket.get_verified_chain`" -#: ../../library/ssl.rst:2579 +#: ../../library/ssl.rst:2580 msgid ":meth:`~SSLSocket.get_unverified_chain`" msgstr ":meth:`~SSLSocket.get_unverified_chain`" -#: ../../library/ssl.rst:2580 +#: ../../library/ssl.rst:2581 msgid ":meth:`~SSLSocket.selected_alpn_protocol`" msgstr ":meth:`~SSLSocket.selected_alpn_protocol`" -#: ../../library/ssl.rst:2581 +#: ../../library/ssl.rst:2582 msgid ":meth:`~SSLSocket.selected_npn_protocol`" msgstr ":meth:`~SSLSocket.selected_npn_protocol`" -#: ../../library/ssl.rst:2582 +#: ../../library/ssl.rst:2583 msgid ":meth:`~SSLSocket.cipher`" msgstr ":meth:`~SSLSocket.cipher`" -#: ../../library/ssl.rst:2583 +#: ../../library/ssl.rst:2584 msgid ":meth:`~SSLSocket.shared_ciphers`" msgstr ":meth:`~SSLSocket.shared_ciphers`" -#: ../../library/ssl.rst:2584 +#: ../../library/ssl.rst:2585 msgid ":meth:`~SSLSocket.compression`" msgstr ":meth:`~SSLSocket.compression`" -#: ../../library/ssl.rst:2585 +#: ../../library/ssl.rst:2586 msgid ":meth:`~SSLSocket.pending`" msgstr ":meth:`~SSLSocket.pending`" -#: ../../library/ssl.rst:2586 +#: ../../library/ssl.rst:2587 msgid ":meth:`~SSLSocket.do_handshake`" msgstr ":meth:`~SSLSocket.do_handshake`" -#: ../../library/ssl.rst:2587 +#: ../../library/ssl.rst:2588 msgid ":meth:`~SSLSocket.verify_client_post_handshake`" msgstr ":meth:`~SSLSocket.verify_client_post_handshake`" -#: ../../library/ssl.rst:2588 +#: ../../library/ssl.rst:2589 msgid ":meth:`~SSLSocket.unwrap`" msgstr ":meth:`~SSLSocket.unwrap`" -#: ../../library/ssl.rst:2589 +#: ../../library/ssl.rst:2590 msgid ":meth:`~SSLSocket.get_channel_binding`" msgstr ":meth:`~SSLSocket.get_channel_binding`" -#: ../../library/ssl.rst:2590 +#: ../../library/ssl.rst:2591 msgid ":meth:`~SSLSocket.version`" msgstr ":meth:`~SSLSocket.version`" -#: ../../library/ssl.rst:2592 +#: ../../library/ssl.rst:2593 msgid "" "When compared to :class:`SSLSocket`, this object lacks the following " "features:" msgstr "" -#: ../../library/ssl.rst:2595 +#: ../../library/ssl.rst:2596 msgid "" "Any form of network IO; ``recv()`` and ``send()`` read and write only to the " "underlying :class:`MemoryBIO` buffers." msgstr "" -#: ../../library/ssl.rst:2598 +#: ../../library/ssl.rst:2599 msgid "" "There is no *do_handshake_on_connect* machinery. You must always manually " "call :meth:`~SSLSocket.do_handshake` to start the handshake." msgstr "" -#: ../../library/ssl.rst:2601 +#: ../../library/ssl.rst:2602 msgid "" "There is no handling of *suppress_ragged_eofs*. All end-of-file conditions " -"that are in violation of the protocol are reported via " -"the :exc:`SSLEOFError` exception." +"that are in violation of the protocol are reported via the :exc:" +"`SSLEOFError` exception." msgstr "" -#: ../../library/ssl.rst:2605 +#: ../../library/ssl.rst:2606 msgid "" "The method :meth:`~SSLSocket.unwrap` call does not return anything, unlike " "for an SSL socket where it returns the underlying socket." msgstr "" -#: ../../library/ssl.rst:2608 +#: ../../library/ssl.rst:2609 msgid "" -"The *server_name_callback* callback passed " -"to :meth:`SSLContext.set_servername_callback` will get an :class:`SSLObject` " -"instance instead of a :class:`SSLSocket` instance as its first parameter." +"The *server_name_callback* callback passed to :meth:`SSLContext." +"set_servername_callback` will get an :class:`SSLObject` instance instead of " +"a :class:`SSLSocket` instance as its first parameter." msgstr "" -#: ../../library/ssl.rst:2612 +#: ../../library/ssl.rst:2613 msgid "Some notes related to the use of :class:`SSLObject`:" msgstr "" -#: ../../library/ssl.rst:2614 +#: ../../library/ssl.rst:2615 msgid "" "All IO on an :class:`SSLObject` is :ref:`non-blocking `. " -"This means that for example :meth:`~SSLSocket.read` will raise " -"an :exc:`SSLWantReadError` if it needs more data than the incoming BIO has " -"available." +"This means that for example :meth:`~SSLSocket.read` will raise an :exc:" +"`SSLWantReadError` if it needs more data than the incoming BIO has available." msgstr "" -#: ../../library/ssl.rst:2619 +#: ../../library/ssl.rst:2620 msgid "" -":class:`SSLObject` instances must be created " -"with :meth:`~SSLContext.wrap_bio`. In earlier versions, it was possible to " -"create instances directly. This was never documented or officially supported." +":class:`SSLObject` instances must be created with :meth:`~SSLContext." +"wrap_bio`. In earlier versions, it was possible to create instances " +"directly. This was never documented or officially supported." msgstr "" -#: ../../library/ssl.rst:2625 +#: ../../library/ssl.rst:2626 msgid "" "An SSLObject communicates with the outside world using memory buffers. The " "class :class:`MemoryBIO` provides a memory buffer that can be used for this " "purpose. It wraps an OpenSSL memory BIO (Basic IO) object:" msgstr "" -#: ../../library/ssl.rst:2631 +#: ../../library/ssl.rst:2632 msgid "" "A memory buffer that can be used to pass data between Python and an SSL " "protocol instance." msgstr "" -#: ../../library/ssl.rst:2636 +#: ../../library/ssl.rst:2637 msgid "Return the number of bytes currently in the memory buffer." msgstr "" -#: ../../library/ssl.rst:2640 +#: ../../library/ssl.rst:2641 msgid "" "A boolean indicating whether the memory BIO is current at the end-of-file " "position." msgstr "" -#: ../../library/ssl.rst:2645 +#: ../../library/ssl.rst:2646 msgid "" "Read up to *n* bytes from the memory buffer. If *n* is not specified or " "negative, all bytes are returned." msgstr "" -#: ../../library/ssl.rst:2650 +#: ../../library/ssl.rst:2651 msgid "" "Write the bytes from *buf* to the memory BIO. The *buf* argument must be an " "object supporting the buffer protocol." msgstr "" -#: ../../library/ssl.rst:2653 +#: ../../library/ssl.rst:2654 msgid "" "The return value is the number of bytes written, which is always equal to " "the length of *buf*." msgstr "" -#: ../../library/ssl.rst:2658 +#: ../../library/ssl.rst:2659 msgid "" "Write an EOF marker to the memory BIO. After this method has been called, it " "is illegal to call :meth:`~MemoryBIO.write`. The attribute :attr:`eof` will " "become true after all data currently in the buffer has been read." msgstr "" -#: ../../library/ssl.rst:2664 +#: ../../library/ssl.rst:2665 msgid "SSL session" msgstr "" -#: ../../library/ssl.rst:2670 +#: ../../library/ssl.rst:2671 msgid "Session object used by :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:2682 +#: ../../library/ssl.rst:2683 msgid "Security considerations" msgstr "" -#: ../../library/ssl.rst:2685 +#: ../../library/ssl.rst:2686 msgid "Best defaults" msgstr "" -#: ../../library/ssl.rst:2687 +#: ../../library/ssl.rst:2688 msgid "" "For **client use**, if you don't have any special requirements for your " -"security policy, it is highly recommended that you use " -"the :func:`create_default_context` function to create your SSL context. It " -"will load the system's trusted CA certificates, enable certificate " -"validation and hostname checking, and try to choose reasonably secure " -"protocol and cipher settings." +"security policy, it is highly recommended that you use the :func:" +"`create_default_context` function to create your SSL context. It will load " +"the system's trusted CA certificates, enable certificate validation and " +"hostname checking, and try to choose reasonably secure protocol and cipher " +"settings." msgstr "" -#: ../../library/ssl.rst:2694 +#: ../../library/ssl.rst:2695 msgid "" "For example, here is how you would use the :class:`smtplib.SMTP` class to " "create a trusted, secure connection to a SMTP server::" msgstr "" -#: ../../library/ssl.rst:2697 +#: ../../library/ssl.rst:2698 msgid "" ">>> import ssl, smtplib\n" ">>> smtp = smtplib.SMTP(\"mail.python.org\", port=587)\n" @@ -3874,50 +3852,50 @@ msgstr "" ">>> smtp.starttls(context=context)\n" "(220, b'2.0.0 Ready to start TLS')" -#: ../../library/ssl.rst:2703 +#: ../../library/ssl.rst:2704 msgid "" -"If a client certificate is needed for the connection, it can be added " -"with :meth:`SSLContext.load_cert_chain`." +"If a client certificate is needed for the connection, it can be added with :" +"meth:`SSLContext.load_cert_chain`." msgstr "" -#: ../../library/ssl.rst:2706 +#: ../../library/ssl.rst:2707 msgid "" -"By contrast, if you create the SSL context by calling " -"the :class:`SSLContext` constructor yourself, it will not have certificate " -"validation nor hostname checking enabled by default. If you do so, please " -"read the paragraphs below to achieve a good security level." +"By contrast, if you create the SSL context by calling the :class:" +"`SSLContext` constructor yourself, it will not have certificate validation " +"nor hostname checking enabled by default. If you do so, please read the " +"paragraphs below to achieve a good security level." msgstr "" -#: ../../library/ssl.rst:2712 +#: ../../library/ssl.rst:2713 msgid "Manual settings" msgstr "手動設定" -#: ../../library/ssl.rst:2715 +#: ../../library/ssl.rst:2716 msgid "Verifying certificates" msgstr "驗證憑證" -#: ../../library/ssl.rst:2717 +#: ../../library/ssl.rst:2718 msgid "" -"When calling the :class:`SSLContext` constructor " -"directly, :const:`CERT_NONE` is the default. Since it does not authenticate " -"the other peer, it can be insecure, especially in client mode where most of " -"the time you would like to ensure the authenticity of the server you're " -"talking to. Therefore, when in client mode, it is highly recommended to " -"use :const:`CERT_REQUIRED`. However, it is in itself not sufficient; you " -"also have to check that the server certificate, which can be obtained by " -"calling :meth:`SSLSocket.getpeercert`, matches the desired service. For " -"many protocols and applications, the service can be identified by the " -"hostname. This common check is automatically performed " -"when :attr:`SSLContext.check_hostname` is enabled." +"When calling the :class:`SSLContext` constructor directly, :const:" +"`CERT_NONE` is the default. Since it does not authenticate the other peer, " +"it can be insecure, especially in client mode where most of the time you " +"would like to ensure the authenticity of the server you're talking to. " +"Therefore, when in client mode, it is highly recommended to use :const:" +"`CERT_REQUIRED`. However, it is in itself not sufficient; you also have to " +"check that the server certificate, which can be obtained by calling :meth:" +"`SSLSocket.getpeercert`, matches the desired service. For many protocols " +"and applications, the service can be identified by the hostname. This common " +"check is automatically performed when :attr:`SSLContext.check_hostname` is " +"enabled." msgstr "" -#: ../../library/ssl.rst:2729 +#: ../../library/ssl.rst:2730 msgid "" -"Hostname matchings is now performed by OpenSSL. Python no longer " -"uses :func:`match_hostname`." +"Hostname matchings is now performed by OpenSSL. Python no longer uses :func:" +"`match_hostname`." msgstr "" -#: ../../library/ssl.rst:2733 +#: ../../library/ssl.rst:2734 msgid "" "In server mode, if you want to authenticate your clients using the SSL layer " "(rather than using a higher-level authentication mechanism), you'll also " @@ -3925,20 +3903,20 @@ msgid "" "certificate." msgstr "" -#: ../../library/ssl.rst:2739 +#: ../../library/ssl.rst:2740 msgid "Protocol versions" msgstr "協定版本" -#: ../../library/ssl.rst:2741 +#: ../../library/ssl.rst:2742 msgid "" "SSL versions 2 and 3 are considered insecure and are therefore dangerous to " "use. If you want maximum compatibility between clients and servers, it is " -"recommended to use :const:`PROTOCOL_TLS_CLIENT` " -"or :const:`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are " -"disabled by default." +"recommended to use :const:`PROTOCOL_TLS_CLIENT` or :const:" +"`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are disabled " +"by default." msgstr "" -#: ../../library/ssl.rst:2749 +#: ../../library/ssl.rst:2750 msgid "" ">>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3\n" @@ -3948,36 +3926,36 @@ msgstr "" ">>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3\n" ">>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3" -#: ../../library/ssl.rst:2754 +#: ../../library/ssl.rst:2755 msgid "" "The SSL context created above will only allow TLSv1.3 and later (if " -"supported by your system) connections to a " -"server. :const:`PROTOCOL_TLS_CLIENT` implies certificate validation and " -"hostname checks by default. You have to load certificates into the context." +"supported by your system) connections to a server. :const:" +"`PROTOCOL_TLS_CLIENT` implies certificate validation and hostname checks by " +"default. You have to load certificates into the context." msgstr "" -#: ../../library/ssl.rst:2761 +#: ../../library/ssl.rst:2762 msgid "Cipher selection" msgstr "" -#: ../../library/ssl.rst:2763 +#: ../../library/ssl.rst:2764 msgid "" "If you have advanced security requirements, fine-tuning of the ciphers " -"enabled when negotiating a SSL session is possible through " -"the :meth:`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the " -"ssl module disables certain weak ciphers by default, but you may want to " -"further restrict the cipher choice. Be sure to read OpenSSL's documentation " -"about the `cipher list format `_. If you want to check which ciphers are enabled by a " -"given cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl " -"ciphers`` command on your system." +"enabled when negotiating a SSL session is possible through the :meth:" +"`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the ssl module " +"disables certain weak ciphers by default, but you may want to further " +"restrict the cipher choice. Be sure to read OpenSSL's documentation about " +"the `cipher list format `_. If you want to check which ciphers are enabled by a given " +"cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl ciphers`` " +"command on your system." msgstr "" -#: ../../library/ssl.rst:2774 +#: ../../library/ssl.rst:2775 msgid "Multi-processing" msgstr "" -#: ../../library/ssl.rst:2776 +#: ../../library/ssl.rst:2777 msgid "" "If using this module as part of a multi-processed application (using, for " "example the :mod:`multiprocessing` or :mod:`concurrent.futures` modules), be " @@ -3988,32 +3966,32 @@ msgid "" "sufficient." msgstr "" -#: ../../library/ssl.rst:2788 +#: ../../library/ssl.rst:2789 msgid "TLS 1.3" msgstr "TLS 1.3" -#: ../../library/ssl.rst:2792 +#: ../../library/ssl.rst:2793 msgid "" "The TLS 1.3 protocol behaves slightly differently than previous version of " "TLS/SSL. Some new TLS 1.3 features are not yet available." msgstr "" -#: ../../library/ssl.rst:2795 +#: ../../library/ssl.rst:2796 msgid "" "TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20 " -"cipher suites are enabled by default. The " -"method :meth:`SSLContext.set_ciphers` cannot enable or disable any TLS 1.3 " -"ciphers yet, but :meth:`SSLContext.get_ciphers` returns them." +"cipher suites are enabled by default. The method :meth:`SSLContext." +"set_ciphers` cannot enable or disable any TLS 1.3 ciphers yet, but :meth:" +"`SSLContext.get_ciphers` returns them." msgstr "" -#: ../../library/ssl.rst:2799 +#: ../../library/ssl.rst:2800 msgid "" "Session tickets are no longer sent as part of the initial handshake and are " "handled differently. :attr:`SSLSocket.session` and :class:`SSLSession` are " "not compatible with TLS 1.3." msgstr "" -#: ../../library/ssl.rst:2802 +#: ../../library/ssl.rst:2803 msgid "" "Client-side certificates are also no longer verified during the initial " "handshake. A server can request a certificate at any time. Clients process " @@ -4021,21 +3999,21 @@ msgid "" "server." msgstr "" -#: ../../library/ssl.rst:2806 +#: ../../library/ssl.rst:2807 msgid "" "TLS 1.3 features like early data, deferred TLS client cert request, " "signature algorithm configuration, and rekeying are not supported yet." msgstr "" -#: ../../library/ssl.rst:2812 +#: ../../library/ssl.rst:2813 msgid "Class :class:`socket.socket`" msgstr ":class:`socket.socket` 類別" -#: ../../library/ssl.rst:2813 +#: ../../library/ssl.rst:2814 msgid "Documentation of underlying :mod:`socket` class" msgstr "底層 :mod:`socket` 類別的文件" -#: ../../library/ssl.rst:2815 +#: ../../library/ssl.rst:2816 msgid "" "`SSL/TLS Strong Encryption: An Introduction `_" @@ -4043,11 +4021,11 @@ msgstr "" "`SSL/TLS Strong Encryption: An Introduction `_" -#: ../../library/ssl.rst:2816 +#: ../../library/ssl.rst:2817 msgid "Intro from the Apache HTTP Server documentation" msgstr "Apache HTTP Server 文件的介紹" -#: ../../library/ssl.rst:2818 +#: ../../library/ssl.rst:2819 msgid "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" @@ -4055,19 +4033,19 @@ msgstr "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" -#: ../../library/ssl.rst:2819 +#: ../../library/ssl.rst:2820 msgid "Steve Kent" msgstr "Steve Kent" -#: ../../library/ssl.rst:2821 +#: ../../library/ssl.rst:2822 msgid ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" msgstr ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" -#: ../../library/ssl.rst:2822 +#: ../../library/ssl.rst:2823 msgid "Donald E., Jeffrey I. Schiller" msgstr "Donald E., Jeffrey I. Schiller" -#: ../../library/ssl.rst:2824 +#: ../../library/ssl.rst:2825 msgid "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" @@ -4075,11 +4053,11 @@ msgstr "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" -#: ../../library/ssl.rst:2825 +#: ../../library/ssl.rst:2826 msgid "D. Cooper" msgstr "D. Cooper" -#: ../../library/ssl.rst:2827 +#: ../../library/ssl.rst:2828 msgid "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" @@ -4087,19 +4065,19 @@ msgstr "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" -#: ../../library/ssl.rst:2828 +#: ../../library/ssl.rst:2829 msgid "T. Dierks et. al." msgstr "T. Dierks et. al." -#: ../../library/ssl.rst:2830 +#: ../../library/ssl.rst:2831 msgid ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" msgstr ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" -#: ../../library/ssl.rst:2831 +#: ../../library/ssl.rst:2832 msgid "D. Eastlake" msgstr "D. Eastlake" -#: ../../library/ssl.rst:2833 +#: ../../library/ssl.rst:2834 msgid "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" @@ -4107,11 +4085,11 @@ msgstr "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" -#: ../../library/ssl.rst:2834 +#: ../../library/ssl.rst:2835 msgid "IANA" msgstr "IANA" -#: ../../library/ssl.rst:2836 +#: ../../library/ssl.rst:2837 msgid "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" @@ -4119,11 +4097,11 @@ msgstr "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" -#: ../../library/ssl.rst:2837 +#: ../../library/ssl.rst:2838 msgid "IETF" msgstr "IETF" -#: ../../library/ssl.rst:2839 +#: ../../library/ssl.rst:2840 msgid "" "`Mozilla's Server Side TLS recommendations `_" @@ -4131,7 +4109,7 @@ msgstr "" "`Mozilla's Server Side TLS recommendations `_" -#: ../../library/ssl.rst:2840 +#: ../../library/ssl.rst:2841 msgid "Mozilla" msgstr "Mozilla" @@ -4159,10 +4137,10 @@ msgstr "Transport Layer Security(傳輸層安全)" msgid "Secure Sockets Layer" msgstr "Secure Sockets Layer(安全 socket 層)" -#: ../../library/ssl.rst:2151 +#: ../../library/ssl.rst:2152 msgid "certificates" msgstr "certificates(憑證)" -#: ../../library/ssl.rst:2153 +#: ../../library/ssl.rst:2154 msgid "X509 certificate" msgstr "X509 certificate(X509 憑證)" diff --git a/library/stdtypes.po b/library/stdtypes.po index 9192ab4199a..df265115a64 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-10 20:44+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -65,24 +65,22 @@ msgstr "真值檢測" #: ../../library/stdtypes.rst:41 msgid "" -"Any object can be tested for truth value, for use in an :keyword:`if` " -"or :keyword:`while` condition or as operand of the Boolean operations below." +"Any object can be tested for truth value, for use in an :keyword:`if` or :" +"keyword:`while` condition or as operand of the Boolean operations below." msgstr "" -"任何物件都可以進行檢測以判斷是否為真值,以便在 :keyword:`if` " -"或 :keyword:`while` 條件中使用,或是作為如下所述 boolean(布林)運算之運算元" -"所用。" +"任何物件都可以進行檢測以判斷是否為真值,以便在 :keyword:`if` 或 :keyword:" +"`while` 條件中使用,或是作為如下所述 boolean(布林)運算之運算元所用。" #: ../../library/stdtypes.rst:46 msgid "" -"By default, an object is considered true unless its class defines either " -"a :meth:`~object.__bool__` method that returns ``False`` or " -"a :meth:`~object.__len__` method that returns zero, when called with the " -"object. [1]_ Here are most of the built-in objects considered false:" +"By default, an object is considered true unless its class defines either a :" +"meth:`~object.__bool__` method that returns ``False`` or a :meth:`~object." +"__len__` method that returns zero, when called with the object. [1]_ Here " +"are most of the built-in objects considered false:" msgstr "" -"預設情況下,一個物件會被視為真值,除非它的 class 定義了會回傳 ``False`` " -"的 :meth:`~object.__bool__` method 或是定義了會回傳零" -"的 :meth:`~object.__len__` method。[1]_ 以下列出了大部分會被視為 false 的內建" -"物件:" +"預設情況下,一個物件會被視為真值,除非它的 class 定義了會回傳 ``False`` 的 :" +"meth:`~object.__bool__` method 或是定義了會回傳零的 :meth:`~object.__len__` " +"method。[1]_ 以下列出了大部分會被視為 false 的內建物件:" #: ../../library/stdtypes.rst:56 msgid "constants defined to be false: ``None`` and ``False``" @@ -326,24 +324,23 @@ msgid "" "Non-identical instances of a class normally compare as non-equal unless the " "class defines the :meth:`~object.__eq__` method." msgstr "" -"一個 class 的非相同實例通常會比較為不相等,除非 class 有定" -"義 :meth:`~object.__eq__` method。" +"一個 class 的非相同實例通常會比較為不相等,除非 class 有定義 :meth:`~object." +"__eq__` method。" #: ../../library/stdtypes.rst:184 msgid "" "Instances of a class cannot be ordered with respect to other instances of " "the same class, or other types of object, unless the class defines enough of " -"the " -"methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " -"and :meth:`~object.__ge__` (in general, :meth:`~object.__lt__` " -"and :meth:`~object.__eq__` are sufficient, if you want the conventional " -"meanings of the comparison operators)." +"the methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object." +"__gt__`, and :meth:`~object.__ge__` (in general, :meth:`~object.__lt__` and :" +"meth:`~object.__eq__` are sufficient, if you want the conventional meanings " +"of the comparison operators)." msgstr "" "一個 class 的實例不可以與其他相同 class 的實例或其他物件型別進行排序,除非 " -"class 定義足夠的 method ,包" -"含 :meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object.__gt__` " -"及 :meth:`~object.__ge__`\\ (一般來說,使用 :meth:`~object.__lt__` " -"及 :meth:`~object.__eq__` 就可以滿足常規意義上的比較運算子)。" +"class 定義足夠的 method ,包含 :meth:`~object.__lt__`、:meth:`~object." +"__le__`、:meth:`~object.__gt__` 及 :meth:`~object.__ge__`\\ (一般來說,使" +"用 :meth:`~object.__lt__` 及 :meth:`~object.__eq__` 就可以滿足常規意義上的比" +"較運算子)。" #: ../../library/stdtypes.rst:191 msgid "" @@ -356,8 +353,8 @@ msgstr "" #: ../../library/stdtypes.rst:199 msgid "" -"Two more operations with the same syntactic priority, :keyword:`in` " -"and :keyword:`not in`, are supported by types that are :term:`iterable` or " +"Two more operations with the same syntactic priority, :keyword:`in` and :" +"keyword:`not in`, are supported by types that are :term:`iterable` or " "implement the :meth:`~object.__contains__` method." msgstr "" "此外,擁有相同的語法優先序的 :keyword:`in` 及 :keyword:`not in` 兩種運算皆被" @@ -375,21 +372,20 @@ msgid "" "subtype of integers. Integers have unlimited precision. Floating-point " "numbers are usually implemented using :c:expr:`double` in C; information " "about the precision and internal representation of floating-point numbers " -"for the machine on which your program is running is available " -"in :data:`sys.float_info`. Complex numbers have a real and imaginary part, " -"which are each a floating-point number. To extract these parts from a " -"complex number *z*, use ``z.real`` and ``z.imag``. (The standard library " -"includes the additional numeric types :mod:`fractions.Fraction`, for " -"rationals, and :mod:`decimal.Decimal`, for floating-point numbers with user-" -"definable precision.)" +"for the machine on which your program is running is available in :data:`sys." +"float_info`. Complex numbers have a real and imaginary part, which are each " +"a floating-point number. To extract these parts from a complex number *z*, " +"use ``z.real`` and ``z.imag``. (The standard library includes the additional " +"numeric types :mod:`fractions.Fraction`, for rationals, and :mod:`decimal." +"Decimal`, for floating-point numbers with user-definable precision.)" msgstr "" "數值型別共有三種::dfn:`整數`、:dfn:`浮點數` 及 :dfn:`複數`。此外,Boolean 為" -"整數中的一個子型別。整數有無限的精度。浮點數通常使用 C 裡面" -"的 :c:expr:`double` 實作。關於在你程式所運作的機器上之浮點數的精度及內部表示" -"法可以在 :data:`sys.float_info` 進行查找。複數包含實數及虛數的部分,這兩部分" -"各自是一個浮點數。若要從一個複數 *z* 提取這兩部分,需使用 ``z.real`` 及 " -"``z.imag``。(標準函式庫包含額外的數值型別,像是 :mod:`fractions.Fraction` 表" -"示有理數,而 :mod:`decimal.Decimal` 表示可由使用者制定精度的浮點數。)" +"整數中的一個子型別。整數有無限的精度。浮點數通常使用 C 裡面的 :c:expr:" +"`double` 實作。關於在你程式所運作的機器上之浮點數的精度及內部表示法可以在 :" +"data:`sys.float_info` 進行查找。複數包含實數及虛數的部分,這兩部分各自是一個" +"浮點數。若要從一個複數 *z* 提取這兩部分,需使用 ``z.real`` 及 ``z.imag``。" +"(標準函式庫包含額外的數值型別,像是 :mod:`fractions.Fraction` 表示有理數," +"而 :mod:`decimal.Decimal` 表示可由使用者制定精度的浮點數。)" #: ../../library/stdtypes.rst:238 msgid "" @@ -445,8 +441,8 @@ msgid "" "All numeric types (except complex) support the following operations (for " "priorities of the operations, see :ref:`operator-summary`):" msgstr "" -"所有數值型別(除複數外)皆支援以下的運算(有關運算的先後順序,詳" -"見 :ref:`operator-summary`):" +"所有數值型別(除複數外)皆支援以下的運算(有關運算的先後順序,詳見 :ref:" +"`operator-summary`):" #: ../../library/stdtypes.rst:282 msgid "Full documentation" @@ -635,11 +631,11 @@ msgid "" "always rounded towards minus infinity: ``1//2`` is ``0``, ``(-1)//2`` is " "``-1``, ``1//(-2)`` is ``-1``, and ``(-1)//(-2)`` is ``0``." msgstr "" -"也被稱為整數除法。對於型別為 :class:`int` 的運算元來說,結果之型別會" -"是 :class:`int`。對於型別為 :class:`float` 的運算元來說,結果之型別會" -"是 :class:`float`。一般來說,結果會是一個整數,但其型別不一定會" -"是 :class:`int`。結果總是會往負無窮大的方向取整數值: ``1//2`` 為 ``0``、" -"``(-1)//2`` 為 ``-1``、``1//(-2)`` 為 ``-1`` 及 ``(-1)//(-2)`` 為 ``0``。" +"也被稱為整數除法。對於型別為 :class:`int` 的運算元來說,結果之型別會是 :" +"class:`int`。對於型別為 :class:`float` 的運算元來說,結果之型別會是 :class:" +"`float`。一般來說,結果會是一個整數,但其型別不一定會是 :class:`int`。結果總" +"是會往負無窮大的方向取整數值: ``1//2`` 為 ``0``、``(-1)//2`` 為 ``-1``、" +"``1//(-2)`` 為 ``-1`` 及 ``(-1)//(-2)`` 為 ``0``。" #: ../../library/stdtypes.rst:337 msgid "" @@ -653,8 +649,8 @@ msgid "" "fractional part. See functions :func:`math.floor` and :func:`math.ceil` for " "alternative conversions." msgstr "" -"從 :class:`float` 轉換為 :class:`int` 會導致截斷並排除小數部分。詳" -"見 :func:`math.floor` 及 :func:`math.ceil` 以了解更多轉換方式。" +"從 :class:`float` 轉換為 :class:`int` 會導致截斷並排除小數部分。詳見 :func:" +"`math.floor` 及 :func:`math.ceil` 以了解更多轉換方式。" #: ../../library/stdtypes.rst:353 msgid "" @@ -844,13 +840,13 @@ msgstr "向右移動 *n* 個位元等同於向下除法除以 ``pow(2, n)``。" #: ../../library/stdtypes.rst:452 msgid "" "Performing these calculations with at least one extra sign extension bit in " -"a finite two's complement representation (a working bit-width of ``1 + " -"max(x.bit_length(), y.bit_length())`` or more) is sufficient to get the same " +"a finite two's complement representation (a working bit-width of ``1 + max(x." +"bit_length(), y.bit_length())`` or more) is sufficient to get the same " "result as if there were an infinite number of sign bits." msgstr "" -"在有限的二的補數表示法中執行這些計算(一個有效位元寬度為 ``1 + " -"max(x.bit_length(), y.bit_length())`` 或以上)並至少有一個額外的符號擴展位" -"元,便足以得到與無窮多個符號位元相同的結果。" +"在有限的二的補數表示法中執行這些計算(一個有效位元寬度為 ``1 + max(x." +"bit_length(), y.bit_length())`` 或以上)並至少有一個額外的符號擴展位元,便足" +"以得到與無窮多個符號位元相同的結果。" #: ../../library/stdtypes.rst:459 msgid "Additional Methods on Integer Types" @@ -889,13 +885,13 @@ msgid "" "More precisely, if ``x`` is nonzero, then ``x.bit_length()`` is the unique " "positive integer ``k`` such that ``2**(k-1) <= abs(x) < 2**k``. " "Equivalently, when ``abs(x)`` is small enough to have a correctly rounded " -"logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then " -"``x.bit_length()`` returns ``0``." +"logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then ``x." +"bit_length()`` returns ``0``." msgstr "" "更準確來說,若 ``x`` 非為零,則 ``x.bit_length()`` 會得出滿足 ``2**(k-1) <= " "abs(x) < 2**k`` 的單一正整數 ``k``。同樣地,當 ``abs(x)`` 足夠小到能正確地取" -"得捨入的對數,則 ``k = 1 + int(log(abs(x), 2))``。若 ``x`` 為零,則 " -"``x.bit_length()`` 會回傳 ``0``。" +"得捨入的對數,則 ``k = 1 + int(log(abs(x), 2))``。若 ``x`` 為零,則 ``x." +"bit_length()`` 會回傳 ``0``。" #: ../../library/stdtypes.rst:481 ../../library/stdtypes.rst:504 #: ../../library/stdtypes.rst:549 ../../library/stdtypes.rst:593 @@ -948,9 +944,9 @@ msgstr "回傳表示一個整數的一列位元組。" #: ../../library/stdtypes.rst:525 msgid "" -"The integer is represented using *length* bytes, and defaults to 1. " -"An :exc:`OverflowError` is raised if the integer is not representable with " -"the given number of bytes." +"The integer is represented using *length* bytes, and defaults to 1. An :exc:" +"`OverflowError` is raised if the integer is not representable with the given " +"number of bytes." msgstr "" "此整數會使用 *length* 位元組表示,並且預設為 1。如果該整數無法用給定的位元組" "數來表示,則會引發 :exc:`OverflowError`。" @@ -996,8 +992,8 @@ msgid "" "However, when using the default arguments, don't try to convert a value " "greater than 255 or you'll get an :exc:`OverflowError`." msgstr "" -"然而,使用預設引數時,不要嘗試轉換大於 255 的值,否則你將會得到一" -"個 :exc:`OverflowError`。" +"然而,使用預設引數時,不要嘗試轉換大於 255 的值,否則你將會得到一個 :exc:" +"`OverflowError`。" #: ../../library/stdtypes.rst:551 msgid "" @@ -1043,8 +1039,8 @@ msgid "" "integer, and defaults to ``\"big\"``. If *byteorder* is ``\"big\"``, the " "most significant byte is at the beginning of the byte array. If *byteorder* " "is ``\"little\"``, the most significant byte is at the end of the byte " -"array. To request the native byte order of the host system, " -"use :data:`sys.byteorder` as the byte order value." +"array. To request the native byte order of the host system, use :data:`sys." +"byteorder` as the byte order value." msgstr "" "*byteorder* 引數決定了用來表示整數的位元組順序並且預設為 ``\"big\"``。如果 " "*byteorder* 是 ``\"big\"``,最重要的位元組位於位元組陣列的開頭。如果 " @@ -1102,8 +1098,8 @@ msgstr "" #: ../../library/stdtypes.rst:624 msgid "" -"Returns ``True``. Exists for duck type compatibility " -"with :meth:`float.is_integer`." +"Returns ``True``. Exists for duck type compatibility with :meth:`float." +"is_integer`." msgstr "回傳 ``True``。為了與 :meth:`float.is_integer` 的鴨子型別相容而存在。" #: ../../library/stdtypes.rst:629 @@ -1127,22 +1123,22 @@ msgstr "" msgid "" "If the argument is an integer or a floating-point number, a floating-point " "number with the same value (within Python's floating-point precision) is " -"returned. If the argument is outside the range of a Python float, " -"an :exc:`OverflowError` will be raised." +"returned. If the argument is outside the range of a Python float, an :exc:" +"`OverflowError` will be raised." msgstr "" #: ../../library/stdtypes.rst:643 msgid "" -"For a general Python object ``x``, ``float.from_number(x)`` delegates to " -"``x.__float__()``. If :meth:`~object.__float__` is not defined then it falls " +"For a general Python object ``x``, ``float.from_number(x)`` delegates to ``x." +"__float__()``. If :meth:`~object.__float__` is not defined then it falls " "back to :meth:`~object.__index__`." msgstr "" #: ../../library/stdtypes.rst:653 msgid "" "Return a pair of integers whose ratio is exactly equal to the original " -"float. The ratio is in lowest terms and has a positive denominator. " -"Raises :exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs." +"float. The ratio is in lowest terms and has a positive denominator. Raises :" +"exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs." msgstr "" "回傳一對整數,其比率完全等於原始浮點數。比率是在最低條件下並且有一個正分母。" "在無窮大時引發 :exc:`OverflowError`,在 NaN 時引發 :exc:`ValueError`。" @@ -1199,8 +1195,8 @@ msgstr "" #: ../../library/stdtypes.rst:692 msgid "" -"Note that :meth:`float.hex` is an instance method, " -"while :meth:`float.fromhex` is a class method." +"Note that :meth:`float.hex` is an instance method, while :meth:`float." +"fromhex` is a class method." msgstr "" "請注意 :meth:`float.hex` 是一個實例 method,而 :meth:`float.fromhex` 是一個 " "class method。" @@ -1229,10 +1225,10 @@ msgstr "" "其中可選的 ``sign`` 可以是 ``+`` 或 ``-``,``integer`` 和 ``fraction`` 是十六" "進位數字的字串,而 ``exponent`` 是一個十進位整數並且有一個可選的前導符號。大" "小寫不重要,並且整數或小數部分至少有一個十六進位數字。這個語法與 C99 標準的" -"第 6.4.4.2 節指定的語法相似,也與 Java 1.5 以後的語法相似。特別" -"是 :meth:`float.hex` 的輸出可用作 C 或 Java 程式碼中的十六進位浮點數文字,並" -"且 C 的 ``%a`` 格式字元或 Java 的 ``Double.toHexString`` 產生的十六進位字串可" -"被 :meth:`float.fromhex` 接受。" +"第 6.4.4.2 節指定的語法相似,也與 Java 1.5 以後的語法相似。特別是 :meth:" +"`float.hex` 的輸出可用作 C 或 Java 程式碼中的十六進位浮點數文字,並且 C 的 " +"``%a`` 格式字元或 Java 的 ``Double.toHexString`` 產生的十六進位字串可被 :" +"meth:`float.fromhex` 接受。" #: ../../library/stdtypes.rst:712 msgid "" @@ -1274,9 +1270,9 @@ msgstr "複數的附加方法" #: ../../library/stdtypes.rst:732 msgid "" -"The :class:`!complex` type implements " -"the :class:`numbers.Complex` :term:`abstract base class`. :class:`!complex` " -"also has the following additional methods." +"The :class:`!complex` type implements the :class:`numbers.Complex` :term:" +"`abstract base class`. :class:`!complex` also has the following additional " +"methods." msgstr "" ":class:`!complex` 型別實作了 :class:`numbers.Complex` :term:`抽象基底類別 " "`。:class:`!complex` 也有下列附加方法。" @@ -1300,29 +1296,27 @@ msgstr "數值型別的雜湊" #: ../../library/stdtypes.rst:753 msgid "" "For numbers ``x`` and ``y``, possibly of different types, it's a requirement " -"that ``hash(x) == hash(y)`` whenever ``x == y`` (see " -"the :meth:`~object.__hash__` method documentation for more details). For " -"ease of implementation and efficiency across a variety of numeric types " -"(including :class:`int`, :class:`float`, :class:`decimal.Decimal` " -"and :class:`fractions.Fraction`) Python's hash for numeric types is based on " -"a single mathematical function that's defined for any rational number, and " -"hence applies to all instances of :class:`int` " -"and :class:`fractions.Fraction`, and all finite instances of :class:`float` " -"and :class:`decimal.Decimal`. Essentially, this function is given by " -"reduction modulo ``P`` for a fixed prime ``P``. The value of ``P`` is made " -"available to Python as the :attr:`~sys.hash_info.modulus` attribute " -"of :data:`sys.hash_info`." +"that ``hash(x) == hash(y)`` whenever ``x == y`` (see the :meth:`~object." +"__hash__` method documentation for more details). For ease of " +"implementation and efficiency across a variety of numeric types (including :" +"class:`int`, :class:`float`, :class:`decimal.Decimal` and :class:`fractions." +"Fraction`) Python's hash for numeric types is based on a single mathematical " +"function that's defined for any rational number, and hence applies to all " +"instances of :class:`int` and :class:`fractions.Fraction`, and all finite " +"instances of :class:`float` and :class:`decimal.Decimal`. Essentially, this " +"function is given by reduction modulo ``P`` for a fixed prime ``P``. The " +"value of ``P`` is made available to Python as the :attr:`~sys.hash_info." +"modulus` attribute of :data:`sys.hash_info`." msgstr "" "對於數字 ``x`` 和 ``y``,可能是不同型別,當 ``x == y`` 時,``hash(x) == " "hash(y)`` 是一個要求( 詳見 :meth:`~object.__hash__` method 的文件以獲得更多" -"細節)。為了實作的便利性和效率跨越各種數值型別(包" -"括 :class:`int`、:class:`float`、:class:`decimal.Decimal` " -"和 :class:`fractions.Fraction`)Python 的數值型別的雜湊是基於一個數學函式,它" -"對於任何有理數都是定義的,因此適用於所有 :class:`int` " -"和 :class:`fractions.Fraction` 的實例,以及所有有限的 :class:`float` " -"和 :class:`decimal.Decimal` 的實例。基本上,這個函式是由簡化的 modulo(模" -"數) ``P`` 給出的一個固定的質數 ``P``。``P`` 的值作為 :data:`sys.hash_info` " -"的 :attr:`~sys.hash_info.modulus` 屬性提供給 Python。" +"細節)。為了實作的便利性和效率跨越各種數值型別(包括 :class:`int`、:class:" +"`float`、:class:`decimal.Decimal` 和 :class:`fractions.Fraction`)Python 的數" +"值型別的雜湊是基於一個數學函式,它對於任何有理數都是定義的,因此適用於所有 :" +"class:`int` 和 :class:`fractions.Fraction` 的實例,以及所有有限的 :class:" +"`float` 和 :class:`decimal.Decimal` 的實例。基本上,這個函式是由簡化的 modulo" +"(模數) ``P`` 給出的一個固定的質數 ``P``。``P`` 的值作為 :data:`sys." +"hash_info` 的 :attr:`~sys.hash_info.modulus` 屬性提供給 Python。" #: ../../library/stdtypes.rst:768 msgid "" @@ -1377,23 +1371,21 @@ msgstr "" #: ../../library/stdtypes.rst:790 msgid "" "For a :class:`complex` number ``z``, the hash values of the real and " -"imaginary parts are combined by computing ``hash(z.real) + " -"sys.hash_info.imag * hash(z.imag)``, reduced modulo " -"``2**sys.hash_info.width`` so that it lies in " -"``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - 1))``. " -"Again, if the result is ``-1``, it's replaced with ``-2``." +"imaginary parts are combined by computing ``hash(z.real) + sys.hash_info." +"imag * hash(z.imag)``, reduced modulo ``2**sys.hash_info.width`` so that it " +"lies in ``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - " +"1))``. Again, if the result is ``-1``, it's replaced with ``-2``." msgstr "" "對於一個 :class:`complex` 值 ``z``,實部和虛部的雜湊值藉由 ``hash(z.real) + " -"sys.hash_info.imag * hash(z.imag)`` 的計算進行組合,對 " -"``2**sys.hash_info.width`` 取模數使其介於 ``range(-2**(sys.hash_info.width - " -"1), 2**(sys.hash_info.width - 1))``。同樣地,如果結果是 ``-1``,則將其替換為 " -"``-2``。" +"sys.hash_info.imag * hash(z.imag)`` 的計算進行組合,對 ``2**sys.hash_info." +"width`` 取模數使其介於 ``range(-2**(sys.hash_info.width - 1), 2**(sys." +"hash_info.width - 1))``。同樣地,如果結果是 ``-1``,則將其替換為 ``-2``。" #: ../../library/stdtypes.rst:798 msgid "" "To clarify the above rules, here's some example Python code, equivalent to " -"the built-in hash, for computing the hash of a rational " -"number, :class:`float`, or :class:`complex`::" +"the built-in hash, for computing the hash of a rational number, :class:" +"`float`, or :class:`complex`::" msgstr "" "為了闡明上述規則,這裡有一些 Python 程式碼範例,等同於內建的雜湊,用於計算有" "理數、:class:`float` 或 :class:`complex` 的雜湊: ::" @@ -1440,8 +1432,8 @@ msgid "" "def hash_complex(z):\n" " \"\"\"Compute the hash of a complex number z.\"\"\"\n" "\n" -" hash_value = hash_float(z.real) + sys.hash_info.imag * " -"hash_float(z.imag)\n" +" hash_value = hash_float(z.real) + sys.hash_info.imag * hash_float(z." +"imag)\n" " # do a signed reduction modulo 2**sys.hash_info.width\n" " M = 2**(sys.hash_info.width - 1)\n" " hash_value = (hash_value & (M - 1)) - (hash_value & M)\n" @@ -1517,8 +1509,8 @@ msgstr "" #: ../../library/stdtypes.rst:900 msgid "" -"One method needs to be defined for container objects to " -"provide :term:`iterable` support:" +"One method needs to be defined for container objects to provide :term:" +"`iterable` support:" msgstr "" "需要為容器物件定義一個 method 來提供\\ :term:`可疊代物件 `\\ 支援:" @@ -1529,15 +1521,15 @@ msgid "" "of iteration, additional methods can be provided to specifically request " "iterators for those iteration types. (An example of an object supporting " "multiple forms of iteration would be a tree structure which supports both " -"breadth-first and depth-first traversal.) This method corresponds to " -"the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python " -"objects in the Python/C API." +"breadth-first and depth-first traversal.) This method corresponds to the :c:" +"member:`~PyTypeObject.tp_iter` slot of the type structure for Python objects " +"in the Python/C API." msgstr "" "回傳一個\\ :term:`疊代器 `\\ 物件。該物件需要支援下述的疊代器協定。" "如果一個容器支援不同型別的疊代,則可以提供額外的 methods 來專門請求這些疊代型" "別的疊代器。(支援多種形式疊代的物件的一個例子是支援廣度優先和深度優先遍歷的" -"樹結構。)此 method 對應 Python/C API 中 Python 物件的型別結構" -"的 :c:member:`~PyTypeObject.tp_iter` 插槽。" +"樹結構。)此 method 對應 Python/C API 中 Python 物件的型別結構的 :c:member:" +"`~PyTypeObject.tp_iter` 插槽。" #: ../../library/stdtypes.rst:916 msgid "" @@ -1549,10 +1541,9 @@ msgstr "" #: ../../library/stdtypes.rst:922 msgid "" "Return the :term:`iterator` object itself. This is required to allow both " -"containers and iterators to be used with the :keyword:`for` " -"and :keyword:`in` statements. This method corresponds to " -"the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python " -"objects in the Python/C API." +"containers and iterators to be used with the :keyword:`for` and :keyword:" +"`in` statements. This method corresponds to the :c:member:`~PyTypeObject." +"tp_iter` slot of the type structure for Python objects in the Python/C API." msgstr "" "回傳\\ :term:`疊代器 `\\ 物件本身。這是為了允許容器和疊代器都可以" "與 :keyword:`for` 和 :keyword:`in` 在陳述式中使用。此 method 對應於 Python/C " @@ -1565,9 +1556,9 @@ msgid "" "the :c:member:`~PyTypeObject.tp_iternext` slot of the type structure for " "Python objects in the Python/C API." msgstr "" -"從\\ :term:`疊代器 `\\ 回傳下一個項目。如果沒有更多項目,則引" -"發 :exc:`StopIteration` 例外。此 method 對應於 Python/C API 中Python 物件的型" -"別結構的 :c:member:`~PyTypeObject.tp_iternext` 插槽。" +"從\\ :term:`疊代器 `\\ 回傳下一個項目。如果沒有更多項目,則引發 :" +"exc:`StopIteration` 例外。此 method 對應於 Python/C API 中Python 物件的型別結" +"構的 :c:member:`~PyTypeObject.tp_iternext` 插槽。" #: ../../library/stdtypes.rst:936 msgid "" @@ -1581,8 +1572,8 @@ msgstr "" #: ../../library/stdtypes.rst:941 msgid "" -"Once an iterator's :meth:`~iterator.__next__` method " -"raises :exc:`StopIteration`, it must continue to do so on subsequent calls. " +"Once an iterator's :meth:`~iterator.__next__` method raises :exc:" +"`StopIteration`, it must continue to do so on subsequent calls. " "Implementations that do not obey this property are deemed broken." msgstr "" "一旦疊代器的 :meth:`~iterator.__next__` method 引發 :exc:`StopIteration`,則" @@ -1597,10 +1588,10 @@ msgid "" "Python's :term:`generator`\\s provide a convenient way to implement the " "iterator protocol. If a container object's :meth:`~object.__iter__` method " "is implemented as a generator, it will automatically return an iterator " -"object (technically, a generator object) supplying " -"the :meth:`~iterator.__iter__` and :meth:`~generator.__next__` methods. More " -"information about generators can be found in :ref:`the documentation for the " -"yield expression `." +"object (technically, a generator object) supplying the :meth:`~iterator." +"__iter__` and :meth:`~generator.__next__` methods. More information about " +"generators can be found in :ref:`the documentation for the yield expression " +"`." msgstr "" #: ../../library/stdtypes.rst:963 @@ -1756,9 +1747,9 @@ msgstr "" msgid "" "Forward and reversed iterators over mutable sequences access values using an " "index. That index will continue to march forward (or backward) even if the " -"underlying sequence is mutated. The iterator terminates only when " -"an :exc:`IndexError` or a :exc:`StopIteration` is encountered (or when the " -"index drops below zero)." +"underlying sequence is mutated. The iterator terminates only when an :exc:" +"`IndexError` or a :exc:`StopIteration` is encountered (or when the index " +"drops below zero)." msgstr "" #: ../../library/stdtypes.rst:1052 @@ -1870,17 +1861,17 @@ msgstr "" #: ../../library/stdtypes.rst:1117 msgid "" -"if concatenating :class:`str` objects, you can build a list and " -"use :meth:`str.join` at the end or else write to an :class:`io.StringIO` " -"instance and retrieve its value when complete" +"if concatenating :class:`str` objects, you can build a list and use :meth:" +"`str.join` at the end or else write to an :class:`io.StringIO` instance and " +"retrieve its value when complete" msgstr "" #: ../../library/stdtypes.rst:1121 msgid "" -"if concatenating :class:`bytes` objects, you can similarly " -"use :meth:`bytes.join` or :class:`io.BytesIO`, or you can do in-place " -"concatenation with a :class:`bytearray` object. :class:`bytearray` objects " -"are mutable and have an efficient overallocation mechanism" +"if concatenating :class:`bytes` objects, you can similarly use :meth:`bytes." +"join` or :class:`io.BytesIO`, or you can do in-place concatenation with a :" +"class:`bytearray` object. :class:`bytearray` objects are mutable and have " +"an efficient overallocation mechanism" msgstr "" #: ../../library/stdtypes.rst:1126 @@ -1942,15 +1933,15 @@ msgstr "不可變序列型別" #: ../../library/stdtypes.rst:1184 msgid "" "The only operation that immutable sequence types generally implement that is " -"not also implemented by mutable sequence types is support for " -"the :func:`hash` built-in." +"not also implemented by mutable sequence types is support for the :func:" +"`hash` built-in." msgstr "" #: ../../library/stdtypes.rst:1188 msgid "" "This support allows immutable sequences, such as :class:`tuple` instances, " -"to be used as :class:`dict` keys and stored in :class:`set` " -"and :class:`frozenset` instances." +"to be used as :class:`dict` keys and stored in :class:`set` and :class:" +"`frozenset` instances." msgstr "" #: ../../library/stdtypes.rst:1192 @@ -2054,11 +2045,10 @@ msgstr "" #: ../../library/stdtypes.rst:1260 msgid "" -"The value *n* is an integer, or an object " -"implementing :meth:`~object.__index__`. Zero and negative values of *n* " -"clear the sequence. Items in the sequence are not copied; they are " -"referenced multiple times, as explained for ``s * n`` under :ref:`typesseq-" -"common`." +"The value *n* is an integer, or an object implementing :meth:`~object." +"__index__`. Zero and negative values of *n* clear the sequence. Items in " +"the sequence are not copied; they are referenced multiple times, as " +"explained for ``s * n`` under :ref:`typesseq-common`." msgstr "" #: ../../library/stdtypes.rst:1266 @@ -2089,9 +2079,9 @@ msgstr "建立 *sequence* 的淺層複製,這和 ``sequence[:]`` 相同。" #: ../../library/stdtypes.rst:1303 msgid "" -"The :meth:`!copy` method is not part of " -"the :class:`~collections.abc.MutableSequence` :class:`~abc.ABC`, but most " -"concrete mutable sequence types provide it." +"The :meth:`!copy` method is not part of the :class:`~collections.abc." +"MutableSequence` :class:`~abc.ABC`, but most concrete mutable sequence types " +"provide it." msgstr "" #: ../../library/stdtypes.rst:1314 @@ -2189,8 +2179,8 @@ msgstr "" #: ../../library/stdtypes.rst:1404 msgid "" -":meth:`sort` accepts two arguments that can only be passed by keyword " -"(:ref:`keyword-only arguments `):" +":meth:`sort` accepts two arguments that can only be passed by keyword (:ref:" +"`keyword-only arguments `):" msgstr "" #: ../../library/stdtypes.rst:1407 @@ -2252,8 +2242,8 @@ msgid "" "Tuples are immutable sequences, typically used to store collections of " "heterogeneous data (such as the 2-tuples produced by the :func:`enumerate` " "built-in). Tuples are also used for cases where an immutable sequence of " -"homogeneous data is needed (such as allowing storage in a :class:`set` " -"or :class:`dict` instance)." +"homogeneous data is needed (such as allowing storage in a :class:`set` or :" +"class:`dict` instance)." msgstr "" #: ../../library/stdtypes.rst:1455 @@ -2321,8 +2311,8 @@ msgstr "" #: ../../library/stdtypes.rst:1498 msgid "" -"The arguments to the range constructor must be integers (either built-" -"in :class:`int` or any object that implements the :meth:`~object.__index__` " +"The arguments to the range constructor must be integers (either built-in :" +"class:`int` or any object that implements the :meth:`~object.__index__` " "special method). If the *step* argument is omitted, it defaults to ``1``. " "If the *start* argument is omitted, it defaults to ``0``. If *step* is " "zero, :exc:`ValueError` is raised." @@ -2351,8 +2341,8 @@ msgstr "" #: ../../library/stdtypes.rst:1517 msgid "" "Ranges containing absolute values larger than :data:`sys.maxsize` are " -"permitted but some features (such as :func:`len`) may " -"raise :exc:`OverflowError`." +"permitted but some features (such as :func:`len`) may raise :exc:" +"`OverflowError`." msgstr "" #: ../../library/stdtypes.rst:1521 @@ -2417,8 +2407,8 @@ msgstr "" #: ../../library/stdtypes.rst:1557 msgid "" -"The advantage of the :class:`range` type over a regular :class:`list` " -"or :class:`tuple` is that a :class:`range` object will always take the same " +"The advantage of the :class:`range` type over a regular :class:`list` or :" +"class:`tuple` is that a :class:`range` object will always take the same " "(small) amount of memory, no matter the size of the range it represents (as " "it only stores the ``start``, ``stop`` and ``step`` values, calculating " "individual items and subranges as needed)." @@ -2443,9 +2433,9 @@ msgstr "" #: ../../library/stdtypes.rst:1590 msgid "" -"Implement the Sequence ABC. Support slicing and negative indices. " -"Test :class:`int` objects for membership in constant time instead of " -"iterating through all items." +"Implement the Sequence ABC. Support slicing and negative indices. Test :" +"class:`int` objects for membership in constant time instead of iterating " +"through all items." msgstr "" #: ../../library/stdtypes.rst:1596 @@ -2851,9 +2841,9 @@ msgstr "" #: ../../library/stdtypes.rst:1714 msgid "" -"Textual data in Python is handled with :class:`str` objects, " -"or :dfn:`strings`. Strings are immutable :ref:`sequences ` of " -"Unicode code points. String literals are written in a variety of ways:" +"Textual data in Python is handled with :class:`str` objects, or :dfn:" +"`strings`. Strings are immutable :ref:`sequences ` of Unicode code " +"points. String literals are written in a variety of ways:" msgstr "" #: ../../library/stdtypes.rst:1719 @@ -2904,9 +2894,9 @@ msgstr "" #: ../../library/stdtypes.rst:1743 msgid "" -"There is also no mutable string type, but :meth:`str.join` " -"or :class:`io.StringIO` can be used to efficiently construct strings from " -"multiple fragments." +"There is also no mutable string type, but :meth:`str.join` or :class:`io." +"StringIO` can be used to efficiently construct strings from multiple " +"fragments." msgstr "" #: ../../library/stdtypes.rst:1747 @@ -2925,24 +2915,24 @@ msgstr "" #: ../../library/stdtypes.rst:1765 msgid "" -"If neither *encoding* nor *errors* is given, ``str(object)`` " -"returns :meth:`type(object).__str__(object) `, which is the " -"\"informal\" or nicely printable string representation of *object*. For " -"string objects, this is the string itself. If *object* does not have " -"a :meth:`~object.__str__` method, then :func:`str` falls back to " -"returning :func:`repr(object) `." +"If neither *encoding* nor *errors* is given, ``str(object)`` returns :meth:" +"`type(object).__str__(object) `, which is the \"informal\" " +"or nicely printable string representation of *object*. For string objects, " +"this is the string itself. If *object* does not have a :meth:`~object." +"__str__` method, then :func:`str` falls back to returning :func:" +"`repr(object) `." msgstr "" #: ../../library/stdtypes.rst:1777 msgid "" -"If at least one of *encoding* or *errors* is given, *object* should be " -"a :term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " +"If at least one of *encoding* or *errors* is given, *object* should be a :" +"term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " "this case, if *object* is a :class:`bytes` (or :class:`bytearray`) object, " -"then ``str(bytes, encoding, errors)`` is equivalent " -"to :meth:`bytes.decode(encoding, errors) `. Otherwise, the " -"bytes object underlying the buffer object is obtained before " -"calling :meth:`bytes.decode`. See :ref:`binaryseq` and :ref:`bufferobjects` " -"for information on buffer objects." +"then ``str(bytes, encoding, errors)`` is equivalent to :meth:`bytes." +"decode(encoding, errors) `. Otherwise, the bytes object " +"underlying the buffer object is obtained before calling :meth:`bytes." +"decode`. See :ref:`binaryseq` and :ref:`bufferobjects` for information on " +"buffer objects." msgstr "" #: ../../library/stdtypes.rst:1786 @@ -2963,10 +2953,10 @@ msgstr "" #: ../../library/stdtypes.rst:1794 msgid "" -"For more information on the ``str`` class and its methods, " -"see :ref:`textseq` and the :ref:`string-methods` section below. To output " -"formatted strings, see the :ref:`f-strings` and :ref:`formatstrings` " -"sections. In addition, see the :ref:`stringservices` section." +"For more information on the ``str`` class and its methods, see :ref:" +"`textseq` and the :ref:`string-methods` section below. To output formatted " +"strings, see the :ref:`f-strings` and :ref:`formatstrings` sections. In " +"addition, see the :ref:`stringservices` section." msgstr "" #: ../../library/stdtypes.rst:1806 @@ -2982,11 +2972,11 @@ msgstr "" #: ../../library/stdtypes.rst:1814 msgid "" "Strings also support two styles of string formatting, one providing a large " -"degree of flexibility and customization " -"(see :meth:`str.format`, :ref:`formatstrings` and :ref:`string-formatting`) " -"and the other based on C ``printf`` style formatting that handles a narrower " -"range of types and is slightly harder to use correctly, but is often faster " -"for the cases it can handle (:ref:`old-string-formatting`)." +"degree of flexibility and customization (see :meth:`str.format`, :ref:" +"`formatstrings` and :ref:`string-formatting`) and the other based on C " +"``printf`` style formatting that handles a narrower range of types and is " +"slightly harder to use correctly, but is often faster for the cases it can " +"handle (:ref:`old-string-formatting`)." msgstr "" #: ../../library/stdtypes.rst:1821 @@ -3020,8 +3010,8 @@ msgid "" "Casefolding is similar to lowercasing but more aggressive because it is " "intended to remove all case distinctions in a string. For example, the " "German lowercase letter ``'ß'`` is equivalent to ``\"ss\"``. Since it is " -"already lowercase, :meth:`lower` would do nothing to " -"``'ß'``; :meth:`casefold` converts it to ``\"ss\"``." +"already lowercase, :meth:`lower` would do nothing to ``'ß'``; :meth:" +"`casefold` converts it to ``\"ss\"``." msgstr "" #: ../../library/stdtypes.rst:1846 @@ -3106,15 +3096,15 @@ msgid "" "*errors* controls how encoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " "are ``'ignore'``, ``'replace'``, ``'xmlcharrefreplace'``, " -"``'backslashreplace'`` and any other name registered " -"via :func:`codecs.register_error`. See :ref:`error-handlers` for details." +"``'backslashreplace'`` and any other name registered via :func:`codecs." +"register_error`. See :ref:`error-handlers` for details." msgstr "" #: ../../library/stdtypes.rst:1901 msgid "" "For performance reasons, the value of *errors* is not checked for validity " -"unless an encoding error actually occurs, :ref:`devmode` is enabled or " -"a :ref:`debug build ` is used. For example::" +"unless an encoding error actually occurs, :ref:`devmode` is enabled or a :" +"ref:`debug build ` is used. For example::" msgstr "" #: ../../library/stdtypes.rst:1907 @@ -3137,8 +3127,8 @@ msgstr "新增關鍵字引數的支援。" #: ../../library/stdtypes.rst:1917 ../../library/stdtypes.rst:3299 msgid "" -"The value of the *errors* argument is now checked in :ref:`devmode` and " -"in :ref:`debug mode `." +"The value of the *errors* argument is now checked in :ref:`devmode` and in :" +"ref:`debug mode `." msgstr "" #: ../../library/stdtypes.rst:1924 @@ -3235,8 +3225,8 @@ msgstr "另請參閱 :meth:`rfind` 和 :meth:`index`。" #: ../../library/stdtypes.rst:1982 msgid "" "The :meth:`~str.find` method should be used only if you need to know the " -"position of *sub*. To check if *sub* is a substring or not, use " -"the :keyword:`in` operator::" +"position of *sub*. To check if *sub* is a substring or not, use the :" +"keyword:`in` operator::" msgstr "" #: ../../library/stdtypes.rst:1986 @@ -3265,14 +3255,13 @@ msgstr "" #: ../../library/stdtypes.rst:2006 msgid "" -"When formatting a number " -"(:class:`int`, :class:`float`, :class:`complex`, :class:`decimal.Decimal` " -"and subclasses) with the ``n`` type (ex: ``'{:n}'.format(1234)``), the " -"function temporarily sets the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` " -"locale to decode ``decimal_point`` and ``thousands_sep`` fields " -"of :c:func:`localeconv` if they are non-ASCII or longer than 1 byte, and the " -"``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. This " -"temporary change affects other threads." +"When formatting a number (:class:`int`, :class:`float`, :class:`complex`, :" +"class:`decimal.Decimal` and subclasses) with the ``n`` type (ex: ``'{:n}'." +"format(1234)``), the function temporarily sets the ``LC_CTYPE`` locale to " +"the ``LC_NUMERIC`` locale to decode ``decimal_point`` and ``thousands_sep`` " +"fields of :c:func:`localeconv` if they are non-ASCII or longer than 1 byte, " +"and the ``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. " +"This temporary change affects other threads." msgstr "" #: ../../library/stdtypes.rst:2015 @@ -3298,16 +3287,16 @@ msgstr "" msgid "" "Return ``True`` if all characters in the string are alphanumeric and there " "is at least one character, ``False`` otherwise. A character ``c`` is " -"alphanumeric if one of the following returns ``True``: ``c.isalpha()``, " -"``c.isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." +"alphanumeric if one of the following returns ``True``: ``c.isalpha()``, ``c." +"isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." msgstr "" #: ../../library/stdtypes.rst:2053 msgid "" "Return ``True`` if all characters in the string are alphabetic and there is " "at least one character, ``False`` otherwise. Alphabetic characters are " -"those characters defined in the Unicode character database as \"Letter\", " -"i.e., those with general category property being one of \"Lm\", \"Lt\", " +"those characters defined in the Unicode character database as \"Letter\", i." +"e., those with general category property being one of \"Lm\", \"Lt\", " "\"Lu\", \"Ll\", or \"Lo\". Note that this is different from the `Alphabetic " "property defined in the section 4.10 'Letters, Alphabetic, and Ideographic' " "of the Unicode Standard ` to access the memory of other " -"binary objects without needing to make a copy." +"The core built-in types for manipulating binary data are :class:`bytes` and :" +"class:`bytearray`. They are supported by :class:`memoryview` which uses the :" +"ref:`buffer protocol ` to access the memory of other binary " +"objects without needing to make a copy." msgstr "" #: ../../library/stdtypes.rst:2946 @@ -5124,22 +5112,22 @@ msgstr "" msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " -"are ``'ignore'``, ``'replace'``, and any other name registered " -"via :func:`codecs.register_error`. See :ref:`error-handlers` for details." +"are ``'ignore'``, ``'replace'``, and any other name registered via :func:" +"`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" #: ../../library/stdtypes.rst:3286 msgid "" "For performance reasons, the value of *errors* is not checked for validity " -"unless a decoding error actually occurs, :ref:`devmode` is enabled or " -"a :ref:`debug build ` is used." +"unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" +"`debug build ` is used." msgstr "" #: ../../library/stdtypes.rst:3292 msgid "" -"Passing the *encoding* argument to :class:`str` allows decoding " -"any :term:`bytes-like object` directly, without needing to make a " -"temporary :class:`!bytes` or :class:`!bytearray` object." +"Passing the *encoding* argument to :class:`str` allows decoding any :term:" +"`bytes-like object` directly, without needing to make a temporary :class:`!" +"bytes` or :class:`!bytearray` object." msgstr "" #: ../../library/stdtypes.rst:3307 @@ -5165,8 +5153,8 @@ msgstr "" #: ../../library/stdtypes.rst:3328 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " -"position of *sub*. To check if *sub* is a substring or not, use " -"the :keyword:`in` operator::" +"position of *sub*. To check if *sub* is a substring or not, use the :" +"keyword:`in` operator::" msgstr "" #: ../../library/stdtypes.rst:3332 @@ -5195,10 +5183,10 @@ msgstr "" #: ../../library/stdtypes.rst:3366 msgid "" -"This static method returns a translation table usable " -"for :meth:`bytes.translate` that will map each character in *from* into the " -"character at the same position in *to*; *from* and *to* must both " -"be :term:`bytes-like objects ` and have the same length." +"This static method returns a translation table usable for :meth:`bytes." +"translate` that will map each character in *from* into the character at the " +"same position in *to*; *from* and *to* must both be :term:`bytes-like " +"objects ` and have the same length." msgstr "" #: ../../library/stdtypes.rst:3377 @@ -5760,10 +5748,10 @@ msgstr "" #: ../../library/stdtypes.rst:3894 msgid "" -"Unlike :func:`str.swapcase`, it is always the case that " -"``bin.swapcase().swapcase() == bin`` for the binary versions. Case " -"conversions are symmetrical in ASCII, even though that is not generally true " -"for arbitrary Unicode code points." +"Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." +"swapcase() == bin`` for the binary versions. Case conversions are " +"symmetrical in ASCII, even though that is not generally true for arbitrary " +"Unicode code points." msgstr "" #: ../../library/stdtypes.rst:3908 @@ -5877,8 +5865,8 @@ msgid "" "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " "*interpolation* operator. Given ``format % values`` (where *format* is a " "bytes object), ``%`` conversion specifications in *format* are replaced with " -"zero or more elements of *values*. The effect is similar to using " -"the :c:func:`sprintf` in the C language." +"zero or more elements of *values*. The effect is similar to using the :c:" +"func:`sprintf` in the C language." msgstr "" #: ../../library/stdtypes.rst:4023 @@ -6138,8 +6126,8 @@ msgstr "" #: ../../library/stdtypes.rst:4299 msgid "" -"memoryview is now registered automatically " -"with :class:`collections.abc.Sequence`" +"memoryview is now registered automatically with :class:`collections.abc." +"Sequence`" msgstr "" #: ../../library/stdtypes.rst:4303 @@ -6163,9 +6151,8 @@ msgstr "" #: ../../library/stdtypes.rst:4317 msgid "" -"For the subset of :mod:`struct` format strings currently supported " -"by :meth:`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == " -"w.tolist()``::" +"For the subset of :mod:`struct` format strings currently supported by :meth:" +"`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" msgstr "" #: ../../library/stdtypes.rst:4320 @@ -6331,8 +6318,8 @@ msgstr "" #: ../../library/stdtypes.rst:4411 msgid "" -":meth:`tolist` now supports all single character native formats " -"in :mod:`struct` module syntax as well as multi-dimensional representations." +":meth:`tolist` now supports all single character native formats in :mod:" +"`struct` module syntax as well as multi-dimensional representations." msgstr "" #: ../../library/stdtypes.rst:4418 @@ -6370,8 +6357,8 @@ msgstr "" #: ../../library/stdtypes.rst:4437 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " -"objects take special actions when a view is held on them (for example, " -"a :class:`bytearray` would temporarily forbid resizing); therefore, calling " +"objects take special actions when a view is held on them (for example, a :" +"class:`bytearray` would temporarily forbid resizing); therefore, calling " "release() is handy to remove these restrictions (and free any dangling " "resources) as soon as possible." msgstr "" @@ -6436,10 +6423,10 @@ msgstr "" #: ../../library/stdtypes.rst:4477 msgid "" -"The destination format is restricted to a single element native format " -"in :mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' " -"or 'c'). The byte length of the result must be the same as the original " -"length. Note that all byte lengths may depend on the operating system." +"The destination format is restricted to a single element native format in :" +"mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " +"'c'). The byte length of the result must be the same as the original length. " +"Note that all byte lengths may depend on the operating system." msgstr "" #: ../../library/stdtypes.rst:4483 @@ -6793,8 +6780,8 @@ msgid "" "objects. Common uses include membership testing, removing duplicates from a " "sequence, and computing mathematical operations such as intersection, union, " "difference, and symmetric difference. (For other containers see the built-" -"in :class:`dict`, :class:`list`, and :class:`tuple` classes, and " -"the :mod:`collections` module.)" +"in :class:`dict`, :class:`list`, and :class:`tuple` classes, and the :mod:" +"`collections` module.)" msgstr "" #: ../../library/stdtypes.rst:4712 @@ -6807,10 +6794,10 @@ msgstr "" #: ../../library/stdtypes.rst:4717 msgid "" -"There are currently two built-in set types, :class:`set` " -"and :class:`frozenset`. The :class:`set` type is mutable --- the contents " -"can be changed using methods like :meth:`~set.add` and :meth:`~set.remove`. " -"Since it is mutable, it has no hash value and cannot be used as either a " +"There are currently two built-in set types, :class:`set` and :class:" +"`frozenset`. The :class:`set` type is mutable --- the contents can be " +"changed using methods like :meth:`~set.add` and :meth:`~set.remove`. Since " +"it is mutable, it has no hash value and cannot be used as either a " "dictionary key or as an element of another set. The :class:`frozenset` type " "is immutable and :term:`hashable` --- its contents cannot be altered after " "it is created; it can therefore be used as a dictionary key or as an element " @@ -6923,12 +6910,12 @@ msgstr "" #: ../../library/stdtypes.rst:4811 msgid "" -"Note, the non-operator versions " -"of :meth:`union`, :meth:`intersection`, :meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, " -"and :meth:`issuperset` methods will accept any iterable as an argument. In " -"contrast, their operator based counterparts require their arguments to be " -"sets. This precludes error-prone constructions like ``set('abc') & 'cbs'`` " -"in favor of the more readable ``set('abc').intersection('cbs')``." +"Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" +"meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" +"`issuperset` methods will accept any iterable as an argument. In contrast, " +"their operator based counterparts require their arguments to be sets. This " +"precludes error-prone constructions like ``set('abc') & 'cbs'`` in favor of " +"the more readable ``set('abc').intersection('cbs')``." msgstr "" #: ../../library/stdtypes.rst:4818 @@ -7022,18 +7009,17 @@ msgstr "從集合中移除所有元素。" #: ../../library/stdtypes.rst:4889 msgid "" -"Note, the non-operator versions of " -"the :meth:`update`, :meth:`intersection_update`, :meth:`difference_update`, " -"and :meth:`symmetric_difference_update` methods will accept any iterable as " -"an argument." +"Note, the non-operator versions of the :meth:`update`, :meth:" +"`intersection_update`, :meth:`difference_update`, and :meth:" +"`symmetric_difference_update` methods will accept any iterable as an " +"argument." msgstr "" #: ../../library/stdtypes.rst:4894 msgid "" -"Note, the *elem* argument to " -"the :meth:`~object.__contains__`, :meth:`remove`, and :meth:`discard` " -"methods may be a set. To support searching for an equivalent frozenset, a " -"temporary one is created from *elem*." +"Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" +"`remove`, and :meth:`discard` methods may be a set. To support searching " +"for an equivalent frozenset, a temporary one is created from *elem*." msgstr "" #: ../../library/stdtypes.rst:4903 @@ -7044,19 +7030,18 @@ msgstr "" msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " -"type, the :dfn:`dictionary`. (For other containers see the built-" -"in :class:`list`, :class:`set`, and :class:`tuple` classes, and " -"the :mod:`collections` module.)" +"type, the :dfn:`dictionary`. (For other containers see the built-in :class:" +"`list`, :class:`set`, and :class:`tuple` classes, and the :mod:`collections` " +"module.)" msgstr "" #: ../../library/stdtypes.rst:4919 msgid "" -"A dictionary's keys are *almost* arbitrary values. Values that are " -"not :term:`hashable`, that is, values containing lists, dictionaries or " -"other mutable types (that are compared by value rather than by object " -"identity) may not be used as keys. Values that compare equal (such as ``1``, " -"``1.0``, and ``True``) can be used interchangeably to index the same " -"dictionary entry." +"A dictionary's keys are *almost* arbitrary values. Values that are not :" +"term:`hashable`, that is, values containing lists, dictionaries or other " +"mutable types (that are compared by value rather than by object identity) " +"may not be used as keys. Values that compare equal (such as ``1``, ``1.0``, " +"and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" #: ../../library/stdtypes.rst:4930 @@ -7211,10 +7196,9 @@ msgid "" "is not present, the ``d[key]`` operation calls that method with the key " "*key* as argument. The ``d[key]`` operation then returns or raises whatever " "is returned or raised by the ``__missing__(key)`` call. No other operations " -"or methods invoke :meth:`~object.__missing__`. " -"If :meth:`~object.__missing__` is not defined, :exc:`KeyError` is " -"raised. :meth:`~object.__missing__` must be a method; it cannot be an " -"instance variable::" +"or methods invoke :meth:`~object.__missing__`. If :meth:`~object." +"__missing__` is not defined, :exc:`KeyError` is raised. :meth:`~object." +"__missing__` must be a method; it cannot be an instance variable::" msgstr "" #: ../../library/stdtypes.rst:5025 @@ -7243,9 +7227,9 @@ msgstr "" #: ../../library/stdtypes.rst:5036 msgid "" -"The example above shows part of the implementation " -"of :class:`collections.Counter`. A different :meth:`!__missing__` method is " -"used by :class:`collections.defaultdict`." +"The example above shows part of the implementation of :class:`collections." +"Counter`. A different :meth:`!__missing__` method is used by :class:" +"`collections.defaultdict`." msgstr "" #: ../../library/stdtypes.rst:5043 @@ -7316,8 +7300,8 @@ msgstr "" #: ../../library/stdtypes.rst:5100 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " -"*default*. If *default* is not given and *key* is not in the dictionary, " -"a :exc:`KeyError` is raised." +"*default*. If *default* is not given and *key* is not in the dictionary, a :" +"exc:`KeyError` is raised." msgstr "" #: ../../library/stdtypes.rst:5106 @@ -7329,8 +7313,8 @@ msgstr "" #: ../../library/stdtypes.rst:5109 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " -"often used in set algorithms. If the dictionary is empty, " -"calling :meth:`popitem` raises a :exc:`KeyError`." +"often used in set algorithms. If the dictionary is empty, calling :meth:" +"`popitem` raises a :exc:`KeyError`." msgstr "" #: ../../library/stdtypes.rst:5113 @@ -7435,8 +7419,8 @@ msgstr "" #: ../../library/stdtypes.rst:5189 msgid "" -":class:`types.MappingProxyType` can be used to create a read-only view of " -"a :class:`dict`." +":class:`types.MappingProxyType` can be used to create a read-only view of a :" +"class:`dict`." msgstr "" #: ../../library/stdtypes.rst:5196 @@ -7445,10 +7429,10 @@ msgstr "字典視圖物件" #: ../../library/stdtypes.rst:5198 msgid "" -"The objects returned by :meth:`dict.keys`, :meth:`dict.values` " -"and :meth:`dict.items` are *view objects*. They provide a dynamic view on " -"the dictionary's entries, which means that when the dictionary changes, the " -"view reflects these changes." +"The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" +"`dict.items` are *view objects*. They provide a dynamic view on the " +"dictionary's entries, which means that when the dictionary changes, the view " +"reflects these changes." msgstr "" #: ../../library/stdtypes.rst:5203 @@ -7470,9 +7454,9 @@ msgstr "" #: ../../library/stdtypes.rst:5215 msgid "" "Keys and values are iterated over in insertion order. This allows the " -"creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = " -"zip(d.values(), d.keys())``. Another way to create the same list is ``pairs " -"= [(v, k) for (k, v) in d.items()]``." +"creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." +"values(), d.keys())``. Another way to create the same list is ``pairs = " +"[(v, k) for (k, v) in d.items()]``." msgstr "" #: ../../library/stdtypes.rst:5220 @@ -7595,9 +7579,8 @@ msgstr "" #: ../../library/stdtypes.rst:5322 msgid "" "An example of a context manager that returns itself is a :term:`file " -"object`. File objects return themselves from __enter__() to " -"allow :func:`open` to be used as the context expression in a :keyword:`with` " -"statement." +"object`. File objects return themselves from __enter__() to allow :func:" +"`open` to be used as the context expression in a :keyword:`with` statement." msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" @@ -7624,8 +7607,8 @@ msgid "" "the exception type, value and traceback information. Otherwise, all three " "arguments are ``None``." msgstr "" -"退出 runtime 情境並回傳布林旗標以表示是否應抑制曾發生的任何例外。如果在執" -"行 :keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " +"退出 runtime 情境並回傳布林旗標以表示是否應抑制曾發生的任何例外。如果在執行 :" +"keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" #: ../../library/stdtypes.rst:5341 @@ -7638,22 +7621,22 @@ msgid "" "replace any exception that occurred in the body of the :keyword:`!with` " "statement." msgstr "" -"從此方法回傳 true 值將導致 :keyword:`with` 陳述式抑制例外並繼續執行緊接" -"著 :keyword:`!with` 陳述式之後的陳述式。否則,該例外將在該方法執行完畢後繼續" -"傳播 (propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體" -"中發生的任何例外。" +"從此方法回傳 true 值將導致 :keyword:`with` 陳述式抑制例外並繼續執行緊接著 :" +"keyword:`!with` 陳述式之後的陳述式。否則,該例外將在該方法執行完畢後繼續傳播 " +"(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" +"的任何例外。" #: ../../library/stdtypes.rst:5348 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " "successfully and does not want to suppress the raised exception. This allows " -"context management code to easily detect whether or not " -"an :meth:`~object.__exit__` method has actually failed." +"context management code to easily detect whether or not an :meth:`~object." +"__exit__` method has actually failed." msgstr "" "傳入的例外不應明確重新引發 - 取而代之的是,此方法應回傳 false 值以指示該方法" -"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢" -"測 :meth:`__exit__` 方法是否曾實際失敗過。" +"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" +"`__exit__` 方法是否曾實際失敗過。" #: ../../library/stdtypes.rst:5354 msgid "" @@ -7672,16 +7655,15 @@ msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " "generator function is decorated with the :class:`contextlib.contextmanager` " -"decorator, it will return a context manager implementing the " -"necessary :meth:`~contextmanager.__enter__` " -"and :meth:`~contextmanager.__exit__` methods, rather than the iterator " -"produced by an undecorated generator function." +"decorator, it will return a context manager implementing the necessary :meth:" +"`~contextmanager.__enter__` and :meth:`~contextmanager.__exit__` methods, " +"rather than the iterator produced by an undecorated generator function." msgstr "" "Python 的 :term:`generator` 和 :class:`contextlib.contextmanager` 裝飾器提供" -"了一種便捷的方法來實作這些協定。如果產生器函式" -"以 :class:`contextlib.contextmanager` 裝飾器裝飾,它將回傳一個有實作出需要" -"的 :meth:`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法" -"的情境管理器,而不是由未裝飾產生器函式產生的疊代器。" +"了一種便捷的方法來實作這些協定。如果產生器函式以 :class:`contextlib." +"contextmanager` 裝飾器裝飾,它將回傳一個有實作出需要的 :meth:" +"`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" +"理器,而不是由未裝飾產生器函式產生的疊代器。" #: ../../library/stdtypes.rst:5367 msgid "" @@ -7697,16 +7679,16 @@ msgstr "" #: ../../library/stdtypes.rst:5375 msgid "" -"Type Annotation Types --- :ref:`Generic Alias `, :ref:`Union `" +"Type Annotation Types --- :ref:`Generic Alias `, :ref:" +"`Union `" msgstr "" -"型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:ref:`聯合 (Union) `" +"型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" +"ref:`聯合 (Union) `" #: ../../library/stdtypes.rst:5380 msgid "" -"The core built-in types for :term:`type annotations ` " -"are :ref:`Generic Alias ` and :ref:`Union `." +"The core built-in types for :term:`type annotations ` are :ref:" +"`Generic Alias ` and :ref:`Union `." msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" @@ -7752,12 +7734,12 @@ msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " "object contains. For example, ``set[bytes]`` can be used in type annotations " -"to signify a :class:`set` in which all the elements are of " -"type :class:`bytes`." +"to signify a :class:`set` in which all the elements are of type :class:" +"`bytes`." msgstr "" "對於一個容器類別,提供給該類別的\\ :ref:`下標 `\\ 引數可以代表" -"物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一" -"個 :class:`set`,其中所有元素的型別都是 :class:`bytes`。" +"物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" +"`set`,其中所有元素的型別都是 :class:`bytes`。" #: ../../library/stdtypes.rst:5415 msgid "" @@ -7786,8 +7768,8 @@ msgstr "" #: ../../library/stdtypes.rst:5427 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " -"``y`` will also be an instance of ``re.Match``, but the return values of " -"``y.group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type " +"``y`` will also be an instance of ``re.Match``, but the return values of ``y." +"group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type " "annotations, we would represent this variety of :ref:`re.Match ` objects with ``re.Match[bytes]``." msgstr "" @@ -7798,9 +7780,9 @@ msgstr "" #: ../../library/stdtypes.rst:5433 msgid "" -"``GenericAlias`` objects are instances of the " -"class :class:`types.GenericAlias`, which can also be used to create " -"``GenericAlias`` objects directly." +"``GenericAlias`` objects are instances of the class :class:`types." +"GenericAlias`, which can also be used to create ``GenericAlias`` objects " +"directly." msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" @@ -7812,8 +7794,8 @@ msgid "" "expecting a :class:`list` containing :class:`float` elements::" msgstr "" "建立一個 ``GenericAlias`` 來表示一個型別 ``T``,其以型別 *X*、*Y* 等(取決於" -"所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素" -"的 :class:`list`: ::" +"所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" +"class:`list`: ::" #: ../../library/stdtypes.rst:5444 msgid "" @@ -7933,8 +7915,8 @@ msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" msgstr "" -"為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器" -"的 :meth:`~object.__getitem__` 方法會在這種情況下引發例外: ::" +"為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." +"__getitem__` 方法會在這種情況下引發例外: ::" #: ../../library/stdtypes.rst:5495 msgid "" @@ -7955,8 +7937,8 @@ msgid "" "items in the ``GenericAlias`` object's :attr:`~genericalias.__args__`. ::" msgstr "" "然而當使用\\ :ref:`型別變數 (type variable) ` 時,此類運算式是有效" -"的。索引的元素數量必須與 ``GenericAlias`` 物件" -"的 :attr:`~genericalias.__args__` 中的型別變數項目一樣多: ::" +"的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." +"__args__` 中的型別變數項目一樣多: ::" #: ../../library/stdtypes.rst:5504 msgid "" @@ -8105,114 +8087,118 @@ msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" #: ../../library/stdtypes.rst:5547 +msgid ":class:`collections.abc.ByteString`" +msgstr ":class:`collections.abc.ByteString`" + +#: ../../library/stdtypes.rst:5548 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5548 +#: ../../library/stdtypes.rst:5549 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5549 +#: ../../library/stdtypes.rst:5550 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5550 +#: ../../library/stdtypes.rst:5551 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5551 +#: ../../library/stdtypes.rst:5552 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5552 +#: ../../library/stdtypes.rst:5553 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5553 +#: ../../library/stdtypes.rst:5554 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5554 +#: ../../library/stdtypes.rst:5555 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5555 +#: ../../library/stdtypes.rst:5556 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5556 +#: ../../library/stdtypes.rst:5557 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5557 +#: ../../library/stdtypes.rst:5558 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5558 +#: ../../library/stdtypes.rst:5559 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5559 +#: ../../library/stdtypes.rst:5560 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5560 +#: ../../library/stdtypes.rst:5561 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5561 +#: ../../library/stdtypes.rst:5562 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5562 +#: ../../library/stdtypes.rst:5563 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5563 +#: ../../library/stdtypes.rst:5564 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5564 +#: ../../library/stdtypes.rst:5565 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5565 +#: ../../library/stdtypes.rst:5566 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5566 +#: ../../library/stdtypes.rst:5567 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5567 +#: ../../library/stdtypes.rst:5568 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5568 +#: ../../library/stdtypes.rst:5569 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5569 +#: ../../library/stdtypes.rst:5570 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5570 +#: ../../library/stdtypes.rst:5571 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5575 +#: ../../library/stdtypes.rst:5576 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5577 +#: ../../library/stdtypes.rst:5578 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5581 +#: ../../library/stdtypes.rst:5582 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5583 +#: ../../library/stdtypes.rst:5584 msgid "" ">>> list[int].__origin__\n" "" @@ -8220,16 +8206,16 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5589 +#: ../../library/stdtypes.rst:5590 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " "class::" msgstr "" -"此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型" -"別 :class:`tuple`\\ (長度可以為 1): ::" +"此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" +"class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5593 +#: ../../library/stdtypes.rst:5594 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -8237,7 +8223,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5599 +#: ../../library/stdtypes.rst:5600 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -8245,7 +8231,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5602 +#: ../../library/stdtypes.rst:5603 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -8259,90 +8245,89 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5610 +#: ../../library/stdtypes.rst:5611 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " -"have correct ``__parameters__`` after substitution " -"because :class:`typing.ParamSpec` is intended primarily for static type " -"checking." +"have correct ``__parameters__`` after substitution because :class:`typing." +"ParamSpec` is intended primarily for static type checking." msgstr "" "具有 :class:`typing.ParamSpec` 參數的一個 ``GenericAlias`` 物件在替換後可能沒" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5617 +#: ../../library/stdtypes.rst:5618 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." msgstr "" -"如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參" -"閱 :data:`~typing.TypeVarTuple`\\ )。" +"如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" +"`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5625 +#: ../../library/stdtypes.rst:5626 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5626 +#: ../../library/stdtypes.rst:5627 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5628 +#: ../../library/stdtypes.rst:5629 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5629 +#: ../../library/stdtypes.rst:5630 msgid "" "Introducing the ability to natively parameterize standard-library classes, " -"provided they implement the special class " -"method :meth:`~object.__class_getitem__`." +"provided they implement the special class method :meth:`~object." +"__class_getitem__`." msgstr "" -"引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方" -"法 :meth:`~object.__class_getitem__`。" +"引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" +"`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5633 +#: ../../library/stdtypes.rst:5634 msgid "" -":ref:`Generics`, :ref:`user-defined generics ` " -"and :class:`typing.Generic`" +":ref:`Generics`, :ref:`user-defined generics ` and :" +"class:`typing.Generic`" msgstr "" -":ref:`Generics`、:ref:`使用者定義泛型 `\\ " -"和 :class:`typing.Generic`" +":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" +"`typing.Generic`" -#: ../../library/stdtypes.rst:5634 +#: ../../library/stdtypes.rst:5635 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5643 +#: ../../library/stdtypes.rst:5644 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5649 +#: ../../library/stdtypes.rst:5650 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " "primarily for :term:`type annotations `. The union type " -"expression enables cleaner type hinting syntax compared to " -"subscripting :class:`typing.Union`." +"expression enables cleaner type hinting syntax compared to subscripting :" +"class:`typing.Union`." msgstr "" "一個聯合物件可以保存多個\\ :ref:`型別物件 (type object) `\\ 之 ``|``\\ (位元 or)運算的值。這些型別主要用於\\ :term:`型別註" "釋 (type annotation) `。與下標 :data:`typing.Union` 相比,聯合型" "別運算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5656 +#: ../../library/stdtypes.rst:5657 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " -"example, the following function expects an argument of type :class:`int` " -"or :class:`float`::" +"example, the following function expects an argument of type :class:`int` or :" +"class:`float`::" msgstr "" "定義一個包含 *X*、*Y* 等型別的聯合物件。``X | Y`` 表示 X 或 Y。它相當於 " -"``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` " -"或 :class:`float` 的引數: ::" +"``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" +"class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5661 +#: ../../library/stdtypes.rst:5662 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -8350,7 +8335,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5666 +#: ../../library/stdtypes.rst:5667 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -8363,40 +8348,40 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5674 +#: ../../library/stdtypes.rst:5675 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5676 +#: ../../library/stdtypes.rst:5677 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5678 +#: ../../library/stdtypes.rst:5679 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5680 +#: ../../library/stdtypes.rst:5681 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5682 +#: ../../library/stdtypes.rst:5683 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5684 +#: ../../library/stdtypes.rst:5685 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5686 +#: ../../library/stdtypes.rst:5687 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5688 +#: ../../library/stdtypes.rst:5689 msgid "It creates instances of :class:`typing.Union`::" msgstr "它會建立 :class:`types.UnionType` 的實例: ::" -#: ../../library/stdtypes.rst:5690 +#: ../../library/stdtypes.rst:5691 msgid "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" @@ -8404,21 +8389,21 @@ msgstr "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" -#: ../../library/stdtypes.rst:5693 +#: ../../library/stdtypes.rst:5694 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5695 +#: ../../library/stdtypes.rst:5696 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5700 +#: ../../library/stdtypes.rst:5701 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5703 +#: ../../library/stdtypes.rst:5704 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -8426,14 +8411,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5706 +#: ../../library/stdtypes.rst:5707 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5709 +#: ../../library/stdtypes.rst:5710 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -8443,15 +8428,15 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5716 +#: ../../library/stdtypes.rst:5717 msgid "" -"The user-exposed type for the union object can be accessed " -"from :class:`typing.Union` and used for :func:`isinstance` checks::" +"The user-exposed type for the union object can be accessed from :class:" +"`typing.Union` and used for :func:`isinstance` checks::" msgstr "" -"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透" -"過 :data:`types.UnionType` 存取並用於 :func:`isinstance` 檢查: ::" +"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." +"UnionType` 存取並用於 :func:`isinstance` 檢查: ::" -#: ../../library/stdtypes.rst:5719 +#: ../../library/stdtypes.rst:5720 msgid "" ">>> import typing\n" ">>> isinstance(int | str, typing.Union)\n" @@ -8469,7 +8454,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'typing.Union' instances" -#: ../../library/stdtypes.rst:5728 +#: ../../library/stdtypes.rst:5729 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -8478,7 +8463,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5732 +#: ../../library/stdtypes.rst:5733 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -8504,79 +8489,79 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5748 +#: ../../library/stdtypes.rst:5749 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5754 +#: ../../library/stdtypes.rst:5755 msgid "" "Union objects are now instances of :class:`typing.Union`. Previously, they " -"were instances of :class:`types.UnionType`, which remains an alias " -"for :class:`typing.Union`." +"were instances of :class:`types.UnionType`, which remains an alias for :" +"class:`typing.Union`." msgstr "" -#: ../../library/stdtypes.rst:5761 +#: ../../library/stdtypes.rst:5762 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:5763 +#: ../../library/stdtypes.rst:5764 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5770 +#: ../../library/stdtypes.rst:5771 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5772 +#: ../../library/stdtypes.rst:5773 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " -"table. Module attributes can be assigned to. (Note that " -"the :keyword:`import` statement is not, strictly speaking, an operation on a " -"module object; ``import foo`` does not require a module object named *foo* " -"to exist, rather it requires an (external) *definition* for a module named " +"table. Module attributes can be assigned to. (Note that the :keyword:" +"`import` statement is not, strictly speaking, an operation on a module " +"object; ``import foo`` does not require a module object named *foo* to " +"exist, rather it requires an (external) *definition* for a module named " "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5779 +#: ../../library/stdtypes.rst:5780 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " "will actually change the module's symbol table, but direct assignment to " -"the :attr:`~object.__dict__` attribute is not possible (you can write " -"``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't " -"write ``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is " -"not recommended." +"the :attr:`~object.__dict__` attribute is not possible (you can write ``m." +"__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write " +"``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is not " +"recommended." msgstr "" -#: ../../library/stdtypes.rst:5787 +#: ../../library/stdtypes.rst:5788 msgid "" -"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." +"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5795 +#: ../../library/stdtypes.rst:5796 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:5797 +#: ../../library/stdtypes.rst:5798 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:5803 +#: ../../library/stdtypes.rst:5804 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5805 +#: ../../library/stdtypes.rst:5806 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5808 +#: ../../library/stdtypes.rst:5809 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -8584,36 +8569,36 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5812 +#: ../../library/stdtypes.rst:5813 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5818 +#: ../../library/stdtypes.rst:5819 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:5822 +#: ../../library/stdtypes.rst:5823 msgid "" "Methods are functions that are called using the attribute notation. There " -"are two flavors: :ref:`built-in methods ` (such " -"as :meth:`~list.append` on lists) and :ref:`class instance method ` (such as :meth:" +"`~list.append` on lists) and :ref:`class instance method `. Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5828 +#: ../../library/stdtypes.rst:5829 msgid "" "If you access a method (a function defined in a class namespace) through an " -"instance, you get a special object: a :dfn:`bound method` (also " -"called :ref:`instance method `) object. When called, it " -"will add the ``self`` argument to the argument list. Bound methods have two " -"special read-only attributes: :attr:`m.__self__ ` is the " -"object on which the method operates, and :attr:`m.__func__ " -"` is the function implementing the method. Calling " -"``m(arg-1, arg-2, ..., arg-n)`` is completely equivalent to calling " -"``m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)``." +"instance, you get a special object: a :dfn:`bound method` (also called :ref:" +"`instance method `) object. When called, it will add the " +"``self`` argument to the argument list. Bound methods have two special read-" +"only attributes: :attr:`m.__self__ ` is the object on which " +"the method operates, and :attr:`m.__func__ ` is the " +"function implementing the method. Calling ``m(arg-1, arg-2, ..., arg-n)`` " +"is completely equivalent to calling ``m.__func__(m.__self__, arg-1, " +"arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5839 +#: ../../library/stdtypes.rst:5840 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -8624,7 +8609,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5847 +#: ../../library/stdtypes.rst:5848 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -8652,25 +8637,25 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5862 +#: ../../library/stdtypes.rst:5863 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5870 +#: ../../library/stdtypes.rst:5871 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5876 +#: ../../library/stdtypes.rst:5877 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " "objects because they don't contain a reference to their global execution " "environment. Code objects are returned by the built-in :func:`compile` " -"function and can be extracted from function objects through " -"their :attr:`~function.__code__` attribute. See also the :mod:`code` module." +"function and can be extracted from function objects through their :attr:" +"`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5883 +#: ../../library/stdtypes.rst:5884 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -8679,21 +8664,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5890 +#: ../../library/stdtypes.rst:5891 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5893 +#: ../../library/stdtypes.rst:5894 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5899 +#: ../../library/stdtypes.rst:5900 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5905 +#: ../../library/stdtypes.rst:5906 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -8701,119 +8686,167 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5910 +#: ../../library/stdtypes.rst:5911 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5916 +#: ../../library/stdtypes.rst:5917 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5918 +#: ../../library/stdtypes.rst:5919 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5922 +#: ../../library/stdtypes.rst:5923 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5929 +#: ../../library/stdtypes.rst:5930 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:5931 +#: ../../library/stdtypes.rst:5932 msgid "" -"This object is commonly used by slicing (see :ref:`slicings`). It supports " -"no special operations. There is exactly one ellipsis object, " +"This object is commonly used used to indicate that something is omitted. It " +"supports no special operations. There is exactly one ellipsis object, " "named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces " "the :const:`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5936 +#: ../../library/stdtypes.rst:5937 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" +#: ../../library/stdtypes.rst:5939 +msgid "" +"In typical use, ``...`` as the ``Ellipsis`` object appears in a few " +"different places, for instance:" +msgstr "" + #: ../../library/stdtypes.rst:5942 +msgid "" +"In type annotations, such as :ref:`callable arguments ` or :ref:`tuple elements `." +msgstr "" + +#: ../../library/stdtypes.rst:5945 +msgid "" +"As the body of a function instead of a :ref:`pass statement `." +msgstr "" + +#: ../../library/stdtypes.rst:5947 +msgid "" +"In third-party libraries, such as `Numpy's slicing and striding `_." +msgstr "" + +#: ../../library/stdtypes.rst:5950 +msgid "" +"Python also uses three dots in ways that are not ``Ellipsis`` objects, for " +"instance:" +msgstr "" + +#: ../../library/stdtypes.rst:5952 +msgid "" +"Doctest's :const:`ELLIPSIS `, as a pattern for missing " +"content." +msgstr "" + +#: ../../library/stdtypes.rst:5954 +msgid "" +"The default Python prompt of the :term:`interactive` shell when partial " +"input is incomplete." +msgstr "" + +#: ../../library/stdtypes.rst:5956 +msgid "" +"Lastly, the Python documentation often uses three dots in conventional " +"English usage to mean omitted content, even in code examples that also use " +"them as the ``Ellipsis``." +msgstr "" + +#: ../../library/stdtypes.rst:5964 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5944 +#: ../../library/stdtypes.rst:5966 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " -"more information. There is exactly one :data:`NotImplemented` " -"object. :code:`type(NotImplemented)()` produces the singleton instance." +"more information. There is exactly one :data:`NotImplemented` object. :code:" +"`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5949 +#: ../../library/stdtypes.rst:5971 msgid "It is written as :code:`NotImplemented`." msgstr "它被寫為 :code:`NotImplemented`。" -#: ../../library/stdtypes.rst:5955 +#: ../../library/stdtypes.rst:5977 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:5957 +#: ../../library/stdtypes.rst:5979 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5965 +#: ../../library/stdtypes.rst:5987 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5967 +#: ../../library/stdtypes.rst:5989 msgid "" "The implementation adds a few special read-only attributes to several object " -"types, where they are relevant. Some of these are not reported by " -"the :func:`dir` built-in function." +"types, where they are relevant. Some of these are not reported by the :func:" +"`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5974 +#: ../../library/stdtypes.rst:5996 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5980 +#: ../../library/stdtypes.rst:6002 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5988 +#: ../../library/stdtypes.rst:6010 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5993 +#: ../../library/stdtypes.rst:6015 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5998 +#: ../../library/stdtypes.rst:6020 msgid "" -"The :ref:`type parameters ` of generic classes, functions, " -"and :ref:`type aliases `. For classes and functions that are " -"not generic, this will be an empty tuple." +"The :ref:`type parameters ` of generic classes, functions, and :" +"ref:`type aliases `. For classes and functions that are not " +"generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:6008 +#: ../../library/stdtypes.rst:6030 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:6010 +#: ../../library/stdtypes.rst:6032 msgid "" -"CPython has a global limit for converting between :class:`int` " -"and :class:`str` to mitigate denial of service attacks. This limit *only* " -"applies to decimal or other non-power-of-two number bases. Hexadecimal, " -"octal, and binary conversions are unlimited. The limit can be configured." +"CPython has a global limit for converting between :class:`int` and :class:" +"`str` to mitigate denial of service attacks. This limit *only* applies to " +"decimal or other non-power-of-two number bases. Hexadecimal, octal, and " +"binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:6015 +#: ../../library/stdtypes.rst:6037 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -8823,24 +8856,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:6022 +#: ../../library/stdtypes.rst:6044 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:6024 +#: ../../library/stdtypes.rst:6046 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:6028 +#: ../../library/stdtypes.rst:6050 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:6030 +#: ../../library/stdtypes.rst:6052 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8864,19 +8897,19 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:6050 +#: ../../library/stdtypes.rst:6072 msgid "" -"The default limit is 4300 digits as provided " -"in :data:`sys.int_info.default_max_str_digits `. The lowest " -"limit that can be configured is 640 digits as provided " -"in :data:`sys.int_info.str_digits_check_threshold `." +"The default limit is 4300 digits as provided in :data:`sys.int_info." +"default_max_str_digits `. The lowest limit that can be " +"configured is 640 digits as provided in :data:`sys.int_info." +"str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:6055 +#: ../../library/stdtypes.rst:6077 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:6057 +#: ../../library/stdtypes.rst:6079 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8894,84 +8927,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:6070 +#: ../../library/stdtypes.rst:6092 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:6072 +#: ../../library/stdtypes.rst:6094 msgid "" -"The limitation only applies to potentially slow conversions " -"between :class:`int` and :class:`str` or :class:`bytes`:" +"The limitation only applies to potentially slow conversions between :class:" +"`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:6075 +#: ../../library/stdtypes.rst:6097 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:6076 +#: ../../library/stdtypes.rst:6098 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:6077 +#: ../../library/stdtypes.rst:6099 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:6078 +#: ../../library/stdtypes.rst:6100 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:6079 +#: ../../library/stdtypes.rst:6101 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:6082 +#: ../../library/stdtypes.rst:6104 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:6084 +#: ../../library/stdtypes.rst:6106 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:6085 +#: ../../library/stdtypes.rst:6107 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:6086 +#: ../../library/stdtypes.rst:6108 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:6087 +#: ../../library/stdtypes.rst:6109 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:6088 +#: ../../library/stdtypes.rst:6110 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:6089 +#: ../../library/stdtypes.rst:6111 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:6092 +#: ../../library/stdtypes.rst:6114 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:6094 +#: ../../library/stdtypes.rst:6116 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:6097 +#: ../../library/stdtypes.rst:6119 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:6100 +#: ../../library/stdtypes.rst:6122 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8979,48 +9012,47 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:6102 +#: ../../library/stdtypes.rst:6124 msgid "" -":data:`sys.flags.int_max_str_digits` contains the value " -"of :envvar:`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. " -"If both the env var and the ``-X`` option are set, the ``-X`` option takes " -"precedence. A value of *-1* indicates that both were unset, thus a value " -"of :data:`sys.int_info.default_max_str_digits` was used during " -"initialization." +":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" +"`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " +"env var and the ``-X`` option are set, the ``-X`` option takes precedence. A " +"value of *-1* indicates that both were unset, thus a value of :data:`sys." +"int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:6108 +#: ../../library/stdtypes.rst:6130 msgid "" -"From code, you can inspect the current limit and set a new one using " -"these :mod:`sys` APIs:" +"From code, you can inspect the current limit and set a new one using these :" +"mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:6111 +#: ../../library/stdtypes.rst:6133 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:6115 +#: ../../library/stdtypes.rst:6137 msgid "" -"Information about the default and minimum can be found " -"in :data:`sys.int_info`:" +"Information about the default and minimum can be found in :data:`sys." +"int_info`:" msgstr "" -#: ../../library/stdtypes.rst:6117 +#: ../../library/stdtypes.rst:6139 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:6119 +#: ../../library/stdtypes.rst:6141 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:6126 +#: ../../library/stdtypes.rst:6148 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -9032,7 +9064,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:6135 +#: ../../library/stdtypes.rst:6157 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -9040,11 +9072,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:6141 +#: ../../library/stdtypes.rst:6163 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:6143 +#: ../../library/stdtypes.rst:6165 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -9052,11 +9084,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:6148 +#: ../../library/stdtypes.rst:6170 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:6150 +#: ../../library/stdtypes.rst:6172 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -9078,38 +9110,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:6160 +#: ../../library/stdtypes.rst:6182 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:6164 +#: ../../library/stdtypes.rst:6186 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:6165 +#: ../../library/stdtypes.rst:6187 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:6168 +#: ../../library/stdtypes.rst:6190 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:6171 +#: ../../library/stdtypes.rst:6193 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:6173 +#: ../../library/stdtypes.rst:6195 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:6176 +#: ../../library/stdtypes.rst:6198 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -9123,7 +9155,7 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:399 ../../library/stdtypes.rst:992 #: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:1201 #: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4905 -#: ../../library/stdtypes.rst:5901 +#: ../../library/stdtypes.rst:5902 msgid "types" msgstr "type(型別)" @@ -9253,8 +9285,8 @@ msgstr "is not" #: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:2954 #: ../../library/stdtypes.rst:3067 ../../library/stdtypes.rst:4703 #: ../../library/stdtypes.rst:4905 ../../library/stdtypes.rst:5389 -#: ../../library/stdtypes.rst:5645 ../../library/stdtypes.rst:5820 -#: ../../library/stdtypes.rst:5865 +#: ../../library/stdtypes.rst:5646 ../../library/stdtypes.rst:5821 +#: ../../library/stdtypes.rst:5866 msgid "object" msgstr "object(物件)" @@ -9347,8 +9379,8 @@ msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:992 #: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:4905 -#: ../../library/stdtypes.rst:5872 ../../library/stdtypes.rst:5886 -#: ../../library/stdtypes.rst:5901 +#: ../../library/stdtypes.rst:5873 ../../library/stdtypes.rst:5887 +#: ../../library/stdtypes.rst:5902 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -9415,7 +9447,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:341 ../../library/stdtypes.rst:1808 -#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:5901 +#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:5902 msgid "module" msgstr "模組" @@ -9585,7 +9617,7 @@ msgid "bytearray" msgstr "bytearray(位元組陣列)" #: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4905 -#: ../../library/stdtypes.rst:5645 ../../library/stdtypes.rst:5901 +#: ../../library/stdtypes.rst:5646 ../../library/stdtypes.rst:5902 msgid "type" msgstr "type(型別)" @@ -9835,46 +9867,46 @@ msgstr "Generic(泛型)" msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5645 +#: ../../library/stdtypes.rst:5646 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5645 +#: ../../library/stdtypes.rst:5646 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5820 +#: ../../library/stdtypes.rst:5821 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5865 +#: ../../library/stdtypes.rst:5866 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5865 +#: ../../library/stdtypes.rst:5866 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5872 +#: ../../library/stdtypes.rst:5873 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5872 +#: ../../library/stdtypes.rst:5873 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5886 +#: ../../library/stdtypes.rst:5887 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5886 +#: ../../library/stdtypes.rst:5887 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5925 +#: ../../library/stdtypes.rst:5926 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5925 +#: ../../library/stdtypes.rst:5926 msgid "ellipsis literal" -msgstr "ellipsis literal(刪節號)" +msgstr "ellipsis literal(刪節號字面值)" diff --git a/library/typing.po b/library/typing.po index bd592d68321..1bd99ff57dc 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-09 05:11+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: 2024-07-11 11:12+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,8 +55,8 @@ msgstr "" msgid "" "The function ``surface_area_of_cube`` takes an argument expected to be an " "instance of :class:`float`, as indicated by the :term:`type hint` " -"``edge_length: float``. The function is expected to return an instance " -"of :class:`str`, as indicated by the ``-> str`` hint." +"``edge_length: float``. The function is expected to return an instance of :" +"class:`str`, as indicated by the ``-> str`` hint." msgstr "" "函式 ``surface_area_of_cube`` 需要一個引數且預期是一個 :class:`float` 的實" "例,如 ``edge_length: float`` 所指出的\\ :term:`型別提示 `。這個函" @@ -73,17 +73,17 @@ msgstr "" #: ../../library/typing.rst:42 msgid "" -"New features are frequently added to the ``typing`` module. " -"The :pypi:`typing_extensions` package provides backports of these new " -"features to older versions of Python." +"New features are frequently added to the ``typing`` module. The :pypi:" +"`typing_extensions` package provides backports of these new features to " +"older versions of Python." msgstr "" "新功能會頻繁的新增至 ``typing`` 模組中。:pypi:`typing_extensions` 套件為這些" "新功能提供了 backport(向後移植的)版本,提供給舊版本的 Python 使用。" #: ../../library/typing.rst:48 msgid "" -"`Typing cheat sheet `_" +"`Typing cheat sheet `_" msgstr "" "`型別小抄 (Typing cheat sheet) `_" @@ -129,8 +129,8 @@ msgstr "Python 型別系統的技術規範" #: ../../library/typing.rst:66 msgid "" "The canonical, up-to-date specification of the Python type system can be " -"found at `Specification for the Python type system `_." +"found at `Specification for the Python type system `_." msgstr "" "關於 Python 型別系統標準的 (canonical)、最新的技術規範可以在\\ `Python 型別系" "統的技術規範 `_\\ 找到。" @@ -145,9 +145,9 @@ msgid "" "an instance of :class:`TypeAliasType`. In this example, ``Vector`` and " "``list[float]`` will be treated equivalently by static type checkers::" msgstr "" -"一個型別別名被定義來使用 :keyword:`type` 陳述式,其建立" -"了 :class:`TypeAliasType` 的實例。在這個範例中,``Vector`` 及 " -"``list[float]`` 會被當作和靜態型別檢查器一樣同等對待: ::" +"一個型別別名被定義來使用 :keyword:`type` 陳述式,其建立了 :class:" +"`TypeAliasType` 的實例。在這個範例中,``Vector`` 及 ``list[float]`` 會被當作" +"和靜態型別檢查器一樣同等對待: ::" #: ../../library/typing.rst:79 msgid "" @@ -379,19 +379,18 @@ msgstr "註釋 callable 物件" #: ../../library/typing.rst:210 msgid "" -"Functions -- or other :term:`callable` objects -- can be annotated " -"using :class:`collections.abc.Callable` or " -"deprecated :data:`typing.Callable`. ``Callable[[int], str]`` signifies a " -"function that takes a single parameter of type :class:`int` and returns " -"a :class:`str`." +"Functions -- or other :term:`callable` objects -- can be annotated using :" +"class:`collections.abc.Callable` or deprecated :data:`typing.Callable`. " +"``Callable[[int], str]`` signifies a function that takes a single parameter " +"of type :class:`int` and returns a :class:`str`." msgstr "" -"函式,或者是其他 :term:`callable` 物件,可以使" -"用 :class:`collections.abc.Callable` 或以棄用的 :data:`typing.Callable` 進行" -"註釋。 ``Callable[[int], str]`` 象徵為一個函式,可以接受一個型別" -"為 :class:`int` 的引數,並回傳一個 :class:`str`。" +"函式,或者是其他 :term:`callable` 物件,可以使用 :class:`collections.abc." +"Callable` 或以棄用的 :data:`typing.Callable` 進行註釋。 ``Callable[[int], " +"str]`` 象徵為一個函式,可以接受一個型別為 :class:`int` 的引數,並回傳一個 :" +"class:`str`。" -#: ../../library/typing.rst:215 ../../library/typing.rst:3281 -#: ../../library/typing.rst:3466 +#: ../../library/typing.rst:215 ../../library/typing.rst:3288 +#: ../../library/typing.rst:3473 msgid "For example:" msgstr "舉例來說:" @@ -411,27 +410,40 @@ msgid "" "\n" "callback: Callable[[str], Awaitable[None]] = on_update" msgstr "" +"from collections.abc import Callable, Awaitable\n" +"\n" +"def feeder(get_next_item: Callable[[], str]) -> None:\n" +" ... # 主體\n" +"\n" +"def async_query(on_success: Callable[[int], None],\n" +" on_error: Callable[[int, Exception], None]) -> None:\n" +" ... # 主體\n" +"\n" +"async def on_update(value: str) -> None:\n" +" ... # 主體\n" +"\n" +"callback: Callable[[str], Awaitable[None]] = on_update" -#: ../../library/typing.rst:233 +#: ../../library/typing.rst:235 msgid "" "The subscription syntax must always be used with exactly two values: the " "argument list and the return type. The argument list must be a list of " -"types, a :class:`ParamSpec`, :data:`Concatenate`, or an ellipsis. The return " -"type must be a single type." +"types, a :class:`ParamSpec`, :data:`Concatenate`, or an ellipsis (``...``). " +"The return type must be a single type." msgstr "" "使用下標語法 (subscription syntax) 時,必須使用到兩個值,分別為引述串列以及回" "傳類別。引數串列必須為一個型別串列::class:`ParamSpec`、:data:`Concatenate` " -"或是一個刪節號 (ellipsis)。回傳類別必為一個單一類別。" +"或是一個刪節號 (ellipsis, ``...``)。回傳類別必為一個單一類別。" -#: ../../library/typing.rst:238 +#: ../../library/typing.rst:240 msgid "" "If a literal ellipsis ``...`` is given as the argument list, it indicates " "that a callable with any arbitrary parameter list would be acceptable:" msgstr "" -"若刪節號文字 ``...`` 被當作引數串列給定,其指出一個具任何、任意參數列表的 " +"若刪節號字面值 ``...`` 被當作引數串列給定,其指出一個具任何、任意參數列表的 " "callable 會被接受: ::" -#: ../../library/typing.rst:241 +#: ../../library/typing.rst:243 msgid "" "def concat(x: str, y: str) -> str:\n" " return x + y\n" @@ -447,20 +459,20 @@ msgstr "" "x = str # OK\n" "x = concat # 也 OK" -#: ../../library/typing.rst:250 +#: ../../library/typing.rst:252 msgid "" "``Callable`` cannot express complex signatures such as functions that take a " "variadic number of arguments, :ref:`overloaded functions `, or " "functions that have keyword-only parameters. However, these signatures can " -"be expressed by defining a :class:`Protocol` class with " -"a :meth:`~object.__call__` method:" +"be expressed by defining a :class:`Protocol` class with a :meth:`~object." +"__call__` method:" msgstr "" "``Callable`` 不如有可變數量引數的函式、:func:`overloaded functions " "`、或是僅限關鍵字參數的函式,可以表示複雜簽名。然而,這些簽名可以透" "過定義一個具有 :meth:`~object.__call__` 方法的 :class:`Protocol` 類別進行表" "示:" -#: ../../library/typing.rst:256 +#: ../../library/typing.rst:258 msgid "" "from collections.abc import Iterable\n" "from typing import Protocol\n" @@ -484,7 +496,7 @@ msgid "" " # different name and kind in the callback" msgstr "" -#: ../../library/typing.rst:277 +#: ../../library/typing.rst:279 msgid "" "Callables which take other callables as arguments may indicate that their " "parameter types are dependent on each other using :class:`ParamSpec`. " @@ -501,15 +513,15 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:285 ../../library/typing.rst:3975 +#: ../../library/typing.rst:287 ../../library/typing.rst:3990 msgid "" -"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. " -"See :pep:`612` for more details." +"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" +"pep:`612` for more details." msgstr "" -"``Callable`` 現已支援 :class:`ParamSpec` 以及 :data:`Concatenate`。請參" -"閱 :pep:`612` 閱讀詳細內容。" +"``Callable`` 現已支援 :class:`ParamSpec` 以及 :data:`Concatenate`。請參閱 :" +"pep:`612` 閱讀詳細內容。" -#: ../../library/typing.rst:290 +#: ../../library/typing.rst:292 msgid "" "The documentation for :class:`ParamSpec` and :class:`Concatenate` provides " "examples of usage in ``Callable``." @@ -517,11 +529,11 @@ msgstr "" ":class:`ParamSpec` 以及 :class:`Concatenate` 的文件中,提供範例如何在 " "``Callable`` 中使用。" -#: ../../library/typing.rst:296 +#: ../../library/typing.rst:298 msgid "Generics" msgstr "泛型" -#: ../../library/typing.rst:298 +#: ../../library/typing.rst:300 msgid "" "Since type information about objects kept in containers cannot be statically " "inferred in a generic way, many container classes in the standard library " @@ -531,7 +543,7 @@ msgstr "" "(statically inferred),許多標準函式庫的容器類別支援以下標來表示容器內預期的元" "素。" -#: ../../library/typing.rst:302 +#: ../../library/typing.rst:304 msgid "" "from collections.abc import Mapping, Sequence\n" "\n" @@ -545,7 +557,7 @@ msgid "" " overrides: Mapping[str, str]) -> None: ..." msgstr "" -#: ../../library/typing.rst:315 +#: ../../library/typing.rst:317 msgid "" "Generic functions and classes can be parameterized by using :ref:`type " "parameter syntax `::" @@ -553,7 +565,7 @@ msgstr "" "泛型函式及類別可以使用\\ :ref:`型別參數語法 (type parameter syntax) ` 進行參數化 (parameterize) : ::" -#: ../../library/typing.rst:318 +#: ../../library/typing.rst:320 msgid "" "from collections.abc import Sequence\n" "\n" @@ -562,11 +574,11 @@ msgid "" " return l[0]" msgstr "" -#: ../../library/typing.rst:323 +#: ../../library/typing.rst:325 msgid "Or by using the :class:`TypeVar` factory directly::" msgstr "或是直接使用 :class:`TypeVar` 工廠 (factory): ::" -#: ../../library/typing.rst:325 +#: ../../library/typing.rst:327 msgid "" "from collections.abc import Sequence\n" "from typing import TypeVar\n" @@ -578,15 +590,15 @@ msgid "" " return l[1]" msgstr "" -#: ../../library/typing.rst:333 +#: ../../library/typing.rst:335 msgid "Syntactic support for generics is new in Python 3.12." msgstr "在 Python 3.12 中,泛型的語法支援是全新功能。" -#: ../../library/typing.rst:339 +#: ../../library/typing.rst:341 msgid "Annotating tuples" msgstr "註釋元組 (tuple)" -#: ../../library/typing.rst:341 +#: ../../library/typing.rst:343 msgid "" "For most containers in Python, the typing system assumes that all elements " "in the container will be of the same type. For example::" @@ -594,7 +606,7 @@ msgstr "" "在 Python 大多數的容器當中,加註型別系統認為容器內的所有元素會是相同型別。舉" "例來說: ::" -#: ../../library/typing.rst:344 +#: ../../library/typing.rst:346 msgid "" "from collections.abc import Mapping\n" "\n" @@ -609,32 +621,31 @@ msgid "" "z: Mapping[str, str | int] = {}" msgstr "" -#: ../../library/typing.rst:356 +#: ../../library/typing.rst:358 msgid "" ":class:`list` only accepts one type argument, so a type checker would emit " -"an error on the ``y`` assignment above. " -"Similarly, :class:`~collections.abc.Mapping` only accepts two type " -"arguments: the first indicates the type of the keys, and the second " -"indicates the type of the values." +"an error on the ``y`` assignment above. Similarly, :class:`~collections.abc." +"Mapping` only accepts two type arguments: the first indicates the type of " +"the keys, and the second indicates the type of the values." msgstr "" ":class:`list` 只接受一個型別引數,所以型別檢查器可能在上述 ``y`` 賦值 " "(assignment) 觸發錯誤。類似的範例,:class:`~collections.abc.Mapping` 只接受兩" "個型別引數:第一個引數指出 keys(鍵)的型別;第二個引數指出 values(值)的型" "別。" -#: ../../library/typing.rst:362 +#: ../../library/typing.rst:364 msgid "" "Unlike most other Python containers, however, it is common in idiomatic " "Python code for tuples to have elements which are not all of the same type. " -"For this reason, tuples are special-cased in Python's typing " -"system. :class:`tuple` accepts *any number* of type arguments::" +"For this reason, tuples are special-cased in Python's typing system. :class:" +"`tuple` accepts *any number* of type arguments::" msgstr "" "然而,與其他多數的 Python 容器不同,在慣用的 (idiomatic) Python 程式碼中,元" "組可以擁有不完全相同型別的元素是相當常見的。為此,元組在 Python 的加註型別系" "統中是個特例 (special-cased)。:class:`tuple` 接受\\ *任何數量*\\ 的型別引" "數: ::" -#: ../../library/typing.rst:367 +#: ../../library/typing.rst:369 msgid "" "# OK: ``x`` is assigned to a tuple of length 1 where the sole element is an " "int\n" @@ -649,18 +660,19 @@ msgid "" "z: tuple[int] = (1, 2, 3)" msgstr "" -#: ../../library/typing.rst:378 +#: ../../library/typing.rst:382 msgid "" "To denote a tuple which could be of *any* length, and in which all elements " -"are of the same type ``T``, use ``tuple[T, ...]``. To denote an empty tuple, " -"use ``tuple[()]``. Using plain ``tuple`` as an annotation is equivalent to " -"using ``tuple[Any, ...]``::" +"are of the same type ``T``, use the literal ellipsis ``...``: " +"``tuple[T, ...]``. To denote an empty tuple, use ``tuple[()]``. Using plain " +"``tuple`` as an annotation is equivalent to using ``tuple[Any, ...]``::" msgstr "" "為了標示一個元組可以為\\ *任意*\\ 長度,且所有元素皆是相同型別 ``T``,請使用 " -"``tuple[T, ...]`` 進行標示。為了標示一個空元組,請使用 ``tuple[()]``。單純使" -"用 ``tuple`` 作為註釋,會與使用 ``tuple[Any, ...]`` 是相等的: ::" +"刪節號字面值 (literal ellipsis) ``...``:``tuple[T, ...]``。為了標示" +"一個空元組,請使用 ``tuple[()]``。單純使用 ``tuple`` 作為註釋會與使用 ``tuple[Any, ...]`` " +"相等: ::" -#: ../../library/typing.rst:383 +#: ../../library/typing.rst:388 msgid "" "x: tuple[int, ...] = (1, 2)\n" "# These reassignments are OK: ``tuple[int, ...]`` indicates x can be of any " @@ -680,35 +692,34 @@ msgid "" "z = ()" msgstr "" -#: ../../library/typing.rst:401 +#: ../../library/typing.rst:406 msgid "The type of class objects" msgstr "類別物件的型別" -#: ../../library/typing.rst:403 +#: ../../library/typing.rst:408 msgid "" "A variable annotated with ``C`` may accept a value of type ``C``. In " -"contrast, a variable annotated with ``type[C]`` (or " -"deprecated :class:`typing.Type[C] `) may accept values that are " -"classes themselves -- specifically, it will accept the *class object* of " -"``C``. For example::" +"contrast, a variable annotated with ``type[C]`` (or deprecated :class:" +"`typing.Type[C] `) may accept values that are classes themselves -- " +"specifically, it will accept the *class object* of ``C``. For example::" msgstr "" "一個變數被註釋為 ``C`` 可以接受一個型別為 ``C`` 的值。相對的,一個變數備註解" "為 ``type[C]`` \\ (或已棄用的 :class:`typing.Type[C] `)\\ 可以接受本" "身為該類別的值 -- 具體來說,他可能會接受 ``C`` 的\\ *類別物件*\\。舉例來" "說: ::" -#: ../../library/typing.rst:409 +#: ../../library/typing.rst:414 msgid "" "a = 3 # Has type ``int``\n" "b = int # Has type ``type[int]``\n" "c = type(a) # Also has type ``type[int]``" msgstr "" -#: ../../library/typing.rst:413 +#: ../../library/typing.rst:418 msgid "Note that ``type[C]`` is covariant::" msgstr "請記得 ``type[C]`` 是共變 (covariant) 的: ::" -#: ../../library/typing.rst:415 +#: ../../library/typing.rst:420 msgid "" "class User: ...\n" "class ProUser(User): ...\n" @@ -727,16 +738,15 @@ msgid "" "``type[User]``" msgstr "" -#: ../../library/typing.rst:429 +#: ../../library/typing.rst:434 msgid "" -"The only legal parameters for :class:`type` are " -"classes, :data:`Any`, :ref:`type variables `, and unions of any of " -"these types. For example::" +"The only legal parameters for :class:`type` are classes, :data:`Any`, :ref:" +"`type variables `, and unions of any of these types. For example::" msgstr "" ":class:`type` 僅有的合法參數是類別、:data:`Any`、:ref:`型別變數 " "`\\ 以及這些型別任意組合成的聯集。舉例來說: ::" -#: ../../library/typing.rst:433 +#: ../../library/typing.rst:438 msgid "" "def new_non_team_user(user_class: type[BasicUser | ProUser]): ...\n" "\n" @@ -747,26 +757,26 @@ msgid "" "new_non_team_user(User) # Also an error" msgstr "" -#: ../../library/typing.rst:441 +#: ../../library/typing.rst:446 msgid "" -"``type[Any]`` is equivalent to :class:`type`, which is the root of " -"Python's :ref:`metaclass hierarchy `." +"``type[Any]`` is equivalent to :class:`type`, which is the root of Python's :" +"ref:`metaclass hierarchy `." msgstr "" "``type[Any]`` 等價於 :class:`type` ,其為 Python :ref:`metaclass 階層結構 " "(hierachy) `。" -#: ../../library/typing.rst:448 +#: ../../library/typing.rst:453 msgid "Annotating generators and coroutines" msgstr "" -#: ../../library/typing.rst:450 +#: ../../library/typing.rst:455 msgid "" -"A generator can be annotated using the generic " -"type :class:`Generator[YieldType, SendType, ReturnType] " -"`. For example::" +"A generator can be annotated using the generic type :class:" +"`Generator[YieldType, SendType, ReturnType] `. " +"For example::" msgstr "" -#: ../../library/typing.rst:454 +#: ../../library/typing.rst:459 msgid "" "def echo_round() -> Generator[int, float, str]:\n" " sent = yield 0\n" @@ -774,32 +784,41 @@ msgid "" " sent = yield round(sent)\n" " return 'Done'" msgstr "" +"def echo_round() -> Generator[int, float, str]:\n" +" sent = yield 0\n" +" while sent >= 0:\n" +" sent = yield round(sent)\n" +" return 'Done'" -#: ../../library/typing.rst:460 +#: ../../library/typing.rst:465 msgid "" "Note that unlike many other generic classes in the standard library, the " "``SendType`` of :class:`~collections.abc.Generator` behaves contravariantly, " "not covariantly or invariantly." msgstr "" -#: ../../library/typing.rst:464 +#: ../../library/typing.rst:469 msgid "" "The ``SendType`` and ``ReturnType`` parameters default to :const:`!None`::" msgstr "" -#: ../../library/typing.rst:466 +#: ../../library/typing.rst:471 msgid "" "def infinite_stream(start: int) -> Generator[int]:\n" " while True:\n" " yield start\n" " start += 1" msgstr "" +"def infinite_stream(start: int) -> Generator[int]:\n" +" while True:\n" +" yield start\n" +" start += 1" -#: ../../library/typing.rst:471 +#: ../../library/typing.rst:476 msgid "It is also possible to set these types explicitly::" msgstr "" -#: ../../library/typing.rst:473 +#: ../../library/typing.rst:478 msgid "" "def infinite_stream(start: int) -> Generator[int, None, None]:\n" " while True:\n" @@ -811,15 +830,14 @@ msgstr "" " yield start\n" " start += 1" -#: ../../library/typing.rst:478 +#: ../../library/typing.rst:483 msgid "" "Simple generators that only ever yield values can also be annotated as " -"having a return type of either :class:`Iterable[YieldType] " -"` or :class:`Iterator[YieldType] " -"`::" +"having a return type of either :class:`Iterable[YieldType] ` or :class:`Iterator[YieldType] `::" msgstr "" -#: ../../library/typing.rst:483 +#: ../../library/typing.rst:488 msgid "" "def infinite_stream(start: int) -> Iterator[int]:\n" " while True:\n" @@ -831,15 +849,15 @@ msgstr "" " yield start\n" " start += 1" -#: ../../library/typing.rst:488 +#: ../../library/typing.rst:493 msgid "" "Async generators are handled in a similar fashion, but don't expect a " "``ReturnType`` type argument (:class:`AsyncGenerator[YieldType, SendType] " -"`). The ``SendType`` argument defaults " -"to :const:`!None`, so the following definitions are equivalent::" +"`). The ``SendType`` argument defaults to :" +"const:`!None`, so the following definitions are equivalent::" msgstr "" -#: ../../library/typing.rst:494 +#: ../../library/typing.rst:499 msgid "" "async def infinite_stream(start: int) -> AsyncGenerator[int]:\n" " while True:\n" @@ -861,14 +879,14 @@ msgstr "" " yield start\n" " start = await increment(start)" -#: ../../library/typing.rst:504 +#: ../../library/typing.rst:509 msgid "" -"As in the synchronous case, :class:`AsyncIterable[YieldType] " -"` and :class:`AsyncIterator[YieldType] " -"` are available as well::" +"As in the synchronous case, :class:`AsyncIterable[YieldType] ` and :class:`AsyncIterator[YieldType] ` are available as well::" msgstr "" -#: ../../library/typing.rst:509 +#: ../../library/typing.rst:514 msgid "" "async def infinite_stream(start: int) -> AsyncIterator[int]:\n" " while True:\n" @@ -880,14 +898,14 @@ msgstr "" " yield start\n" " start = await increment(start)" -#: ../../library/typing.rst:514 +#: ../../library/typing.rst:519 msgid "" "Coroutines can be annotated using :class:`Coroutine[YieldType, SendType, " "ReturnType] `. Generic arguments correspond to " "those of :class:`~collections.abc.Generator`, for example::" msgstr "" -#: ../../library/typing.rst:519 +#: ../../library/typing.rst:524 msgid "" "from collections.abc import Coroutine\n" "c: Coroutine[list[str], str, int] # Some coroutine defined elsewhere\n" @@ -896,15 +914,15 @@ msgid "" " y = await c # Inferred type of 'y' is int" msgstr "" -#: ../../library/typing.rst:528 +#: ../../library/typing.rst:533 msgid "User-defined generic types" msgstr "使用者定義泛型型別" -#: ../../library/typing.rst:530 +#: ../../library/typing.rst:535 msgid "A user-defined class can be defined as a generic class." msgstr "一個使用者定義的類別可以被定義成一個泛型類別。" -#: ../../library/typing.rst:534 +#: ../../library/typing.rst:539 msgid "" "from logging import Logger\n" "\n" @@ -944,7 +962,7 @@ msgstr "" " def log(self, message: str) -> None:\n" " self.logger.info('%s: %s', self.name, message)" -#: ../../library/typing.rst:553 +#: ../../library/typing.rst:558 msgid "" "This syntax indicates that the class ``LoggedVar`` is parameterised around a " "single :ref:`type variable ` ``T`` . This also makes ``T`` valid as " @@ -953,16 +971,16 @@ msgstr "" "這個語法指出類別 ``LoggedVar`` 透過一個單一的 :ref:`型別變數 ` " "``T`` 進行參數化 (parameterised)。這使得 ``T`` 在類別中有效的成為型別。" -#: ../../library/typing.rst:557 +#: ../../library/typing.rst:562 msgid "" "Generic classes implicitly inherit from :class:`Generic`. For compatibility " -"with Python 3.11 and lower, it is also possible to inherit explicitly " -"from :class:`Generic` to indicate a generic class::" +"with Python 3.11 and lower, it is also possible to inherit explicitly from :" +"class:`Generic` to indicate a generic class::" msgstr "" "泛型類別隱性繼承了 :class:`Generic`。為了相容 Python 3.11 及更早版本,也可以" "明確的繼承 :class:`Generic` 並指出是一個泛型類別: ::" -#: ../../library/typing.rst:561 +#: ../../library/typing.rst:566 msgid "" "from typing import TypeVar, Generic\n" "\n" @@ -978,7 +996,7 @@ msgstr "" "class LoggedVar(Generic[T]):\n" " ..." -#: ../../library/typing.rst:568 +#: ../../library/typing.rst:573 msgid "" "Generic classes have :meth:`~object.__class_getitem__` methods, meaning they " "can be parameterised at runtime (e.g. ``LoggedVar[int]`` below)::" @@ -986,7 +1004,7 @@ msgstr "" "泛型類別有 :meth:`~object.__class_getitem__` 方法,其意味著可以在 runtime 進" "行參數化(如下述的 ``LoggedVar[int]``): ::" -#: ../../library/typing.rst:571 +#: ../../library/typing.rst:576 msgid "" "from collections.abc import Iterable\n" "\n" @@ -1000,15 +1018,15 @@ msgstr "" " for var in vars:\n" " var.set(0)" -#: ../../library/typing.rst:577 +#: ../../library/typing.rst:582 msgid "" -"A generic type can have any number of type variables. All varieties " -"of :class:`TypeVar` are permissible as parameters for a generic type::" +"A generic type can have any number of type variables. All varieties of :" +"class:`TypeVar` are permissible as parameters for a generic type::" msgstr "" "一個泛型型別可以有任意數量的型別變數。所有種類的 :class:`TypeVar` 都可以作為" "泛型型別的參數: ::" -#: ../../library/typing.rst:580 +#: ../../library/typing.rst:585 msgid "" "from typing import TypeVar, Generic, Sequence\n" "\n" @@ -1034,13 +1052,13 @@ msgstr "" "class OldWeirdTrio(Generic[OldT, OldB, OldS]):\n" " ..." -#: ../../library/typing.rst:592 +#: ../../library/typing.rst:597 msgid "" "Each type variable argument to :class:`Generic` must be distinct. This is " "thus invalid::" msgstr ":class:`Generic` 的每個型別變數引數必不相同。因此以下是無效的: ::" -#: ../../library/typing.rst:595 +#: ../../library/typing.rst:600 msgid "" "from typing import TypeVar, Generic\n" "...\n" @@ -1064,11 +1082,11 @@ msgstr "" "class Pair(Generic[T, T]): # INVALID\n" " ..." -#: ../../library/typing.rst:606 +#: ../../library/typing.rst:611 msgid "Generic classes can also inherit from other classes::" msgstr "泛型類別亦可以繼承其他類別: ::" -#: ../../library/typing.rst:608 +#: ../../library/typing.rst:613 msgid "" "from collections.abc import Sized\n" "\n" @@ -1080,12 +1098,12 @@ msgstr "" "class LinkedList[T](Sized):\n" " ..." -#: ../../library/typing.rst:613 +#: ../../library/typing.rst:618 msgid "" "When inheriting from generic classes, some type parameters could be fixed::" msgstr "當繼承泛型類別時,部份的型別參數可固定: ::" -#: ../../library/typing.rst:615 +#: ../../library/typing.rst:620 msgid "" "from collections.abc import Mapping\n" "\n" @@ -1097,11 +1115,11 @@ msgstr "" "class MyDict[T](Mapping[str, T]):\n" " ..." -#: ../../library/typing.rst:620 +#: ../../library/typing.rst:625 msgid "In this case ``MyDict`` has a single parameter, ``T``." msgstr "在這種情況下 ``MyDict`` 有一個單一的參數 ``T``。" -#: ../../library/typing.rst:622 +#: ../../library/typing.rst:627 msgid "" "Using a generic class without specifying type parameters assumes :data:`Any` " "for each position. In the following example, ``MyIterable`` is not generic " @@ -1110,7 +1128,7 @@ msgstr "" "若使用泛型類別卻沒有特指型別參數,則會將每個位置視為 :data:`Any`。在下列的範" "例中 ``MyIterable`` 不是泛型,但隱性繼承了 ``Iterable[Any]``: ::" -#: ../../library/typing.rst:626 +#: ../../library/typing.rst:631 msgid "" "from collections.abc import Iterable\n" "\n" @@ -1118,11 +1136,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:633 +#: ../../library/typing.rst:638 msgid "User-defined generic type aliases are also supported. Examples::" msgstr "使用者定義的泛型型別別名也有支援。例如: ::" -#: ../../library/typing.rst:635 +#: ../../library/typing.rst:640 msgid "" "from collections.abc import Iterable\n" "\n" @@ -1139,13 +1157,13 @@ msgid "" " return sum(x*y for x, y in v)" msgstr "" -#: ../../library/typing.rst:648 +#: ../../library/typing.rst:653 msgid "" "For backward compatibility, generic type aliases can also be created through " "a simple assignment::" msgstr "為了向後相容性,泛型型別別名可以透過簡單的賦值來建立: ::" -#: ../../library/typing.rst:651 +#: ../../library/typing.rst:656 msgid "" "from collections.abc import Iterable\n" "from typing import TypeVar\n" @@ -1159,11 +1177,11 @@ msgstr "" "S = TypeVar(\"S\")\n" "Response = Iterable[S] | int" -#: ../../library/typing.rst:657 +#: ../../library/typing.rst:662 msgid ":class:`Generic` no longer has a custom metaclass." msgstr ":class:`Generic` 不再是一個自訂的 metaclass。" -#: ../../library/typing.rst:660 +#: ../../library/typing.rst:665 msgid "" "Syntactic support for generics and type aliases is new in version 3.12. " "Previously, generic classes had to explicitly inherit from :class:`Generic` " @@ -1172,7 +1190,7 @@ msgstr "" "在版本 3.12 新增了泛型及型別別名的語法支援。在之前的版本中,泛型類別必須顯性" "繼承 :class:`Generic` 或是包含一個型別變數在基底類別 (base) 當中。" -#: ../../library/typing.rst:665 +#: ../../library/typing.rst:670 msgid "" "User-defined generics for parameter expressions are also supported via " "parameter specification variables in the form ``[**P]``. The behavior is " @@ -1182,11 +1200,11 @@ msgid "" "substitute a :class:`ParamSpec`::" msgstr "" "使用者定義的參數運算式 (parameter expression) 泛型一樣有支援,透過 ``[**P]`` " -"格式的參數規格變數來進行表示。對於上述作為參數規格變數的型別變數,將持續" -"被 :mod:`!typing` 模組視為一個特定的型別變數。對此,其中一個例外是一個型別列" -"表可以替代 :class:`ParamSpec`: ::" +"格式的參數規格變數來進行表示。對於上述作為參數規格變數的型別變數,將持續被 :" +"mod:`!typing` 模組視為一個特定的型別變數。對此,其中一個例外是一個型別列表可" +"以替代 :class:`ParamSpec`: ::" -#: ../../library/typing.rst:671 +#: ../../library/typing.rst:676 msgid "" ">>> class Z[T, **P]: ... # T is a TypeVar; P is a ParamSpec\n" "...\n" @@ -1198,7 +1216,7 @@ msgstr "" ">>> Z[int, [dict, float]]\n" "__main__.Z[int, [dict, float]]" -#: ../../library/typing.rst:676 +#: ../../library/typing.rst:681 msgid "" "Classes generic over a :class:`ParamSpec` can also be created using explicit " "inheritance from :class:`Generic`. In this case, ``**`` is not used::" @@ -1206,7 +1224,7 @@ msgstr "" "具有 :class:`ParamSpec` 的泛型類別可以透過顯性繼承 :class:`Generic` 進行建" "立。在這種情況下,不需要使用 ``**``: ::" -#: ../../library/typing.rst:679 +#: ../../library/typing.rst:684 msgid "" "from typing import ParamSpec, Generic\n" "\n" @@ -1222,7 +1240,7 @@ msgstr "" "class Z(Generic[P]):\n" " ..." -#: ../../library/typing.rst:686 +#: ../../library/typing.rst:691 msgid "" "Another difference between :class:`TypeVar` and :class:`ParamSpec` is that a " "generic with only one parameter specification variable will accept parameter " @@ -1235,7 +1253,7 @@ msgstr "" "``X[Type1, Type2, ...]`` 的參數列表。在內部中,後者會被轉換為前者,所以在下方" "的範例中為相等的: ::" -#: ../../library/typing.rst:692 +#: ../../library/typing.rst:697 msgid "" ">>> class X[**P]: ...\n" "...\n" @@ -1251,7 +1269,7 @@ msgstr "" ">>> X[[int, str]]\n" "__main__.X[[int, str]]" -#: ../../library/typing.rst:699 +#: ../../library/typing.rst:704 msgid "" "Note that generics with :class:`ParamSpec` may not have correct " "``__parameters__`` after substitution in some cases because they are " @@ -1260,15 +1278,15 @@ msgstr "" "請記得,具有 :class:`ParamSpec` 的泛型在某些情況下替換之後可能不會有正確的 " "``__parameters__``,因為參數規格主要還是用於靜態型別檢查。" -#: ../../library/typing.rst:703 +#: ../../library/typing.rst:708 msgid "" -":class:`Generic` can now be parameterized over parameter expressions. " -"See :class:`ParamSpec` and :pep:`612` for more details." +":class:`Generic` can now be parameterized over parameter expressions. See :" +"class:`ParamSpec` and :pep:`612` for more details." msgstr "" -":class:`Generic` 現在可以透過參數運算式來進行參數化。詳細內容請" -"見 :class:`ParamSpec` 以及 :pep:`612`。" +":class:`Generic` 現在可以透過參數運算式來進行參數化。詳細內容請見 :class:" +"`ParamSpec` 以及 :pep:`612`。" -#: ../../library/typing.rst:707 +#: ../../library/typing.rst:712 msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " @@ -1279,20 +1297,20 @@ msgstr "" "突。泛型的 metaclass 則不支援。參數化泛型的輸出將被存為快取,而在 :mod:`!" "typing` 模組中多數的型別皆為 :term:`hashable` 且可以比較相等性。" -#: ../../library/typing.rst:714 +#: ../../library/typing.rst:719 msgid "The :data:`Any` type" msgstr ":data:`Any` 型別" -#: ../../library/typing.rst:716 +#: ../../library/typing.rst:721 msgid "" "A special kind of type is :data:`Any`. A static type checker will treat " "every type as being compatible with :data:`Any` and :data:`Any` as being " "compatible with every type." msgstr "" -":data:`Any` 是一種特別的型別。一個靜態型別檢查器會將每個型別視為可相容" -"於 :data:`Any` 且 :data:`Any` 也可以相容於每個型別。" +":data:`Any` 是一種特別的型別。一個靜態型別檢查器會將每個型別視為可相容於 :" +"data:`Any` 且 :data:`Any` 也可以相容於每個型別。" -#: ../../library/typing.rst:720 +#: ../../library/typing.rst:725 msgid "" "This means that it is possible to perform any operation or method call on a " "value of type :data:`Any` and assign it to any variable::" @@ -1300,7 +1318,7 @@ msgstr "" "這意味著如果在一個為 :data:`Any` 的值上執行任何操作或呼叫方法是可行的,且可以" "賦值給任意變數: ::" -#: ../../library/typing.rst:723 +#: ../../library/typing.rst:728 msgid "" "from typing import Any\n" "\n" @@ -1318,25 +1336,25 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:738 +#: ../../library/typing.rst:743 msgid "" -"Notice that no type checking is performed when assigning a value of " -"type :data:`Any` to a more precise type. For example, the static type " -"checker did not report an error when assigning ``a`` to ``s`` even though " -"``s`` was declared to be of type :class:`str` and receives an :class:`int` " -"value at runtime!" +"Notice that no type checking is performed when assigning a value of type :" +"data:`Any` to a more precise type. For example, the static type checker did " +"not report an error when assigning ``a`` to ``s`` even though ``s`` was " +"declared to be of type :class:`str` and receives an :class:`int` value at " +"runtime!" msgstr "" "請注意,當賦予型別為 :data:`Any` 的值更精確的型別時,將不會執行任何型別檢查。" "舉例來說,靜態型別檢查器不會在 runtime 中,將 ``a`` 賦值給 ``s`` 的情況下回報" "錯誤,儘管 ``s`` 是被宣告為型別 :class:`str` 卻接收到 :class:`int` 的值!" -#: ../../library/typing.rst:744 +#: ../../library/typing.rst:749 msgid "" "Furthermore, all functions without a return type or parameter types will " "implicitly default to using :data:`Any`::" msgstr "另外,所有缺少回傳型別或參數型別的函式將會隱性預設為 :data:`Any`: ::" -#: ../../library/typing.rst:747 +#: ../../library/typing.rst:752 msgid "" "def legacy_parser(text):\n" " ...\n" @@ -1349,7 +1367,7 @@ msgid "" " return data" msgstr "" -#: ../../library/typing.rst:757 +#: ../../library/typing.rst:762 msgid "" "This behavior allows :data:`Any` to be used as an *escape hatch* when you " "need to mix dynamically and statically typed code." @@ -1357,7 +1375,7 @@ msgstr "" "當你需要混和動態及靜態的型別程式碼,這個行為允許 :data:`Any` 被當作一個\\ *緊" "急出口 (escape hatch)*\\使用。" -#: ../../library/typing.rst:760 +#: ../../library/typing.rst:765 msgid "" "Contrast the behavior of :data:`Any` with the behavior of :class:`object`. " "Similar to :data:`Any`, every type is a subtype of :class:`object`. However, " @@ -1365,10 +1383,10 @@ msgid "" "subtype of every other type." msgstr "" ":data:`Any` 的行為對比 :class:`object` 的行為。與 :data:`Any` 相似,所有的型" -"別會作為 :class:`object` 的子型別。然而,不像 :data:`Any`,反之不亦" -"然::class:`object` 並\\ *不是*\\一個其他型別的子型別。" +"別會作為 :class:`object` 的子型別。然而,不像 :data:`Any`,反之不亦然::" +"class:`object` 並\\ *不是*\\一個其他型別的子型別。" -#: ../../library/typing.rst:765 +#: ../../library/typing.rst:770 msgid "" "That means when the type of a value is :class:`object`, a type checker will " "reject almost all operations on it, and assigning it to a variable (or using " @@ -1379,7 +1397,7 @@ msgstr "" "並將賦予這個值到一個特定型別變數(或是當作回傳值使用)視為一個型別錯誤。舉例" "來說: ::" -#: ../../library/typing.rst:769 +#: ../../library/typing.rst:774 msgid "" "def hash_a(item: object) -> int:\n" " # Fails type checking; an object does not have a 'magic' method.\n" @@ -1400,7 +1418,7 @@ msgid "" "hash_b(\"foo\")" msgstr "" -#: ../../library/typing.rst:787 +#: ../../library/typing.rst:792 msgid "" "Use :class:`object` to indicate that a value could be any type in a typesafe " "manner. Use :data:`Any` to indicate that a value is dynamically typed." @@ -1408,11 +1426,11 @@ msgstr "" "使用 :class:`object` ,將指出在型別安全 (typesafe) 的習慣之下一個值可以為任意" "型別。使用 :data:`Any`,將指出這個值是個動態型別。" -#: ../../library/typing.rst:792 +#: ../../library/typing.rst:797 msgid "Nominal vs structural subtyping" msgstr "標稱 (nominal) 子型別 vs 結構子型別" -#: ../../library/typing.rst:794 +#: ../../library/typing.rst:799 msgid "" "Initially :pep:`484` defined the Python static type system as using *nominal " "subtyping*. This means that a class ``A`` is allowed where a class ``B`` is " @@ -1421,20 +1439,20 @@ msgstr "" "最初 :pep:`484` 定義 Python 靜態型別系統使用\\ *標稱子型別*。這意味著只有 " "``A`` 為 ``B`` 的子類別時,``A`` 才被允許使用在預期是類別 ``B`` 出現的地方。" -#: ../../library/typing.rst:798 +#: ../../library/typing.rst:803 msgid "" -"This requirement previously also applied to abstract base classes, such " -"as :class:`~collections.abc.Iterable`. The problem with this approach is " -"that a class had to be explicitly marked to support them, which is " -"unpythonic and unlike what one would normally do in idiomatic dynamically " -"typed Python code. For example, this conforms to :pep:`484`::" +"This requirement previously also applied to abstract base classes, such as :" +"class:`~collections.abc.Iterable`. The problem with this approach is that a " +"class had to be explicitly marked to support them, which is unpythonic and " +"unlike what one would normally do in idiomatic dynamically typed Python " +"code. For example, this conforms to :pep:`484`::" msgstr "" "這個需求之前也被運用在抽象基底類別,例如 :class:`~collections.abc.Iterable`。" "這種方式的問題在於,一個類別需要顯式的標記來支援他們,這並不符合 Python 風" -"格,也不像一個常見的慣用動態型別 Python 程式碼。舉例來說,下列程式碼符" -"合 :pep:`484`: ::" +"格,也不像一個常見的慣用動態型別 Python 程式碼。舉例來說,下列程式碼符合 :" +"pep:`484`: ::" -#: ../../library/typing.rst:804 +#: ../../library/typing.rst:809 msgid "" "from collections.abc import Sized, Iterable, Iterator\n" "\n" @@ -1450,7 +1468,7 @@ msgstr "" " def __len__(self) -> int: ...\n" " def __iter__(self) -> Iterator[int]: ..." -#: ../../library/typing.rst:811 +#: ../../library/typing.rst:816 msgid "" ":pep:`544` allows to solve this problem by allowing users to write the above " "code without explicit base classes in the class definition, allowing " @@ -1463,7 +1481,7 @@ msgstr "" "``Iterable[int]`` 兩者的子型別。這就是眾所周知的\\ *結構子型別*\\ (或是靜態" "鴨子型別): ::" -#: ../../library/typing.rst:817 +#: ../../library/typing.rst:822 msgid "" "from collections.abc import Iterator, Iterable\n" "\n" @@ -1485,7 +1503,7 @@ msgstr "" "def collect(items: Iterable[int]) -> int: ...\n" "result = collect(Bucket()) # Passes type check" -#: ../../library/typing.rst:827 +#: ../../library/typing.rst:832 msgid "" "Moreover, by subclassing a special class :class:`Protocol`, a user can " "define new custom protocols to fully enjoy structural subtyping (see " @@ -1494,43 +1512,43 @@ msgstr "" "而且,基於一個特別的型別 :class:`Protocol` 建立子型別時,使用者可以定義新的" "協定並充份發揮結構子型別的優勢(請見下方範例)。" -#: ../../library/typing.rst:832 +#: ../../library/typing.rst:837 msgid "Module contents" msgstr "模組內容" -#: ../../library/typing.rst:834 +#: ../../library/typing.rst:839 msgid "" "The ``typing`` module defines the following classes, functions and " "decorators." msgstr "模組 ``typing`` 定義了下列的類別、函式以及裝飾器。" -#: ../../library/typing.rst:837 +#: ../../library/typing.rst:842 msgid "Special typing primitives" msgstr "特別型別原語 (primitive)" -#: ../../library/typing.rst:840 +#: ../../library/typing.rst:845 msgid "Special types" msgstr "特別型別" -#: ../../library/typing.rst:842 +#: ../../library/typing.rst:847 msgid "" "These can be used as types in annotations. They do not support subscription " "using ``[]``." msgstr "這些可以在註釋中做為型別。他們並不支援 ``[]`` 的下標使用。" -#: ../../library/typing.rst:847 +#: ../../library/typing.rst:852 msgid "Special type indicating an unconstrained type." msgstr "特別型別,指出一個不受約束 (unconstrained) 的型別。" -#: ../../library/typing.rst:849 +#: ../../library/typing.rst:854 msgid "Every type is compatible with :data:`Any`." msgstr "所有型別皆與 :data:`Any` 相容。" -#: ../../library/typing.rst:850 +#: ../../library/typing.rst:855 msgid ":data:`Any` is compatible with every type." msgstr ":data:`Any` 相容於所有型別。" -#: ../../library/typing.rst:852 +#: ../../library/typing.rst:857 msgid "" ":data:`Any` can now be used as a base class. This can be useful for avoiding " "type checker errors with classes that can duck type anywhere or are highly " @@ -1539,19 +1557,19 @@ msgstr "" ":data:`Any` 可以作為一個基礎類別。這對於在任何地方使用鴨子型別或是高度動態的" "型別,避免型別檢查器的錯誤是非常有用的。" -#: ../../library/typing.rst:859 +#: ../../library/typing.rst:864 msgid "A :ref:`constrained type variable `." msgstr "一個\\ :ref:`不受約束的型別變數 `。" -#: ../../library/typing.rst:861 +#: ../../library/typing.rst:866 msgid "Definition::" msgstr "定義: ::" -#: ../../library/typing.rst:863 +#: ../../library/typing.rst:868 msgid "AnyStr = TypeVar('AnyStr', str, bytes)" msgstr "AnyStr = TypeVar('AnyStr', str, bytes)" -#: ../../library/typing.rst:865 +#: ../../library/typing.rst:870 msgid "" "``AnyStr`` is meant to be used for functions that may accept :class:`str` " "or :class:`bytes` arguments but cannot allow the two to mix." @@ -1559,15 +1577,15 @@ msgstr "" "``AnyStr`` 是對於函式有用的,他可以接受 :class:`str` 或 :class:`bytes` 引數但" "不可以將此兩種混合。" -#: ../../library/typing.rst:868 ../../library/typing.rst:986 -#: ../../library/typing.rst:1043 ../../library/typing.rst:1223 -#: ../../library/typing.rst:1310 ../../library/typing.rst:1352 -#: ../../library/typing.rst:1561 ../../library/typing.rst:1622 -#: ../../library/typing.rst:3218 ../../library/typing.rst:3451 +#: ../../library/typing.rst:873 ../../library/typing.rst:991 +#: ../../library/typing.rst:1048 ../../library/typing.rst:1230 +#: ../../library/typing.rst:1317 ../../library/typing.rst:1359 +#: ../../library/typing.rst:1568 ../../library/typing.rst:1629 +#: ../../library/typing.rst:3225 ../../library/typing.rst:3458 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:870 +#: ../../library/typing.rst:875 msgid "" "def concat(a: AnyStr, b: AnyStr) -> AnyStr:\n" " return a + b\n" @@ -1577,18 +1595,17 @@ msgid "" "concat(\"foo\", b\"bar\") # Error, cannot mix str and bytes" msgstr "" -#: ../../library/typing.rst:877 +#: ../../library/typing.rst:882 msgid "" -"Note that, despite its name, ``AnyStr`` has nothing to do with " -"the :class:`Any` type, nor does it mean \"any string\". In particular, " -"``AnyStr`` and ``str | bytes`` are different from each other and have " -"different use cases::" +"Note that, despite its name, ``AnyStr`` has nothing to do with the :class:" +"`Any` type, nor does it mean \"any string\". In particular, ``AnyStr`` and " +"``str | bytes`` are different from each other and have different use cases::" msgstr "" "請注意,儘管他的名稱相近,``AnyStr`` 與 :class:`Any` 型別無關,更不代表是「任" "何字串」的意思。尤其,``AnyStr`` 與 ``str | bytes`` 兩者不同且具有不同的使用" "情境: ::" -#: ../../library/typing.rst:882 +#: ../../library/typing.rst:887 msgid "" "# Invalid use of AnyStr:\n" "# The type variable is used only once in the function signature,\n" @@ -1601,14 +1618,14 @@ msgid "" " return \"hi there!\" if cond else b\"greetings!\"" msgstr "" -#: ../../library/typing.rst:892 +#: ../../library/typing.rst:897 msgid "" "Deprecated in favor of the new :ref:`type parameter syntax `. " -"Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. " -"See :pep:`695` for more details." +"Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See :" +"pep:`695` for more details." msgstr "" -#: ../../library/typing.rst:897 +#: ../../library/typing.rst:902 msgid "" "In Python 3.16, ``AnyStr`` will be removed from ``typing.__all__``, and " "deprecation warnings will be emitted at runtime when it is accessed or " @@ -1616,11 +1633,11 @@ msgid "" "Python 3.18." msgstr "" -#: ../../library/typing.rst:904 +#: ../../library/typing.rst:909 msgid "Special type that includes only literal strings." msgstr "特別型別,只包含文本字串。" -#: ../../library/typing.rst:906 +#: ../../library/typing.rst:911 msgid "" "Any string literal is compatible with ``LiteralString``, as is another " "``LiteralString``. However, an object typed as just ``str`` is not. A string " @@ -1631,11 +1648,11 @@ msgstr "" "此。然而,若是一個型別僅為 ``str`` 的物件則不相容。一個字串若是透過組合多個 " "``LiteralString`` 型別的物件建立,則此字串也可以視為 ``LiteralString``。" -#: ../../library/typing.rst:912 ../../library/typing.rst:2243 +#: ../../library/typing.rst:917 ../../library/typing.rst:2250 msgid "Example:" msgstr "舉例來說: ::" -#: ../../library/typing.rst:914 +#: ../../library/typing.rst:919 msgid "" "def run_query(sql: LiteralString) -> None:\n" " ...\n" @@ -1650,7 +1667,7 @@ msgid "" " )" msgstr "" -#: ../../library/typing.rst:928 +#: ../../library/typing.rst:933 msgid "" "``LiteralString`` is useful for sensitive APIs where arbitrary user-" "generated strings could generate problems. For example, the two cases above " @@ -1661,25 +1678,25 @@ msgstr "" "會產生問題。舉例來說,上面兩個案例中產生的型別檢查器錯誤是脆弱的且容易受到 " "SQL 注入攻擊。" -#: ../../library/typing.rst:933 +#: ../../library/typing.rst:938 msgid "See :pep:`675` for more details." msgstr "更多細節請見 :pep:`675`。" -#: ../../library/typing.rst:940 +#: ../../library/typing.rst:945 msgid "" -":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." +":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." msgstr "" ":data:`!Never` 和 :data:`!NoReturn` 表示\\ `底部型別 (bottom type) `_,為一個沒有任何成員的型別。" -#: ../../library/typing.rst:944 +#: ../../library/typing.rst:949 msgid "" -"They can be used to indicate that a function never returns, such " -"as :func:`sys.exit`::" +"They can be used to indicate that a function never returns, such as :func:" +"`sys.exit`::" msgstr "它們可以被用來代表一個不會回傳的函式,像是 :func:`sys.exit`: ::" -#: ../../library/typing.rst:947 +#: ../../library/typing.rst:952 msgid "" "from typing import Never # or NoReturn\n" "\n" @@ -1691,15 +1708,15 @@ msgstr "" "def stop() -> Never:\n" " raise RuntimeError('no way')" -#: ../../library/typing.rst:952 +#: ../../library/typing.rst:957 msgid "" "Or to define a function that should never be called, as there are no valid " "arguments, such as :func:`assert_never`::" msgstr "" -"或被用來定義一個不應被呼叫的函式,因為不會有有效的引數,、像" -"是 :func:`assert_never`: ::" +"或被用來定義一個不應被呼叫的函式,因為不會有有效的引數,、像是 :func:" +"`assert_never`: ::" -#: ../../library/typing.rst:956 +#: ../../library/typing.rst:961 msgid "" "from typing import Never # or NoReturn\n" "\n" @@ -1717,7 +1734,7 @@ msgid "" " never_call_me(arg) # OK, arg is of type Never (or NoReturn)" msgstr "" -#: ../../library/typing.rst:971 +#: ../../library/typing.rst:976 msgid "" ":data:`!Never` and :data:`!NoReturn` have the same meaning in the type " "system and static type checkers treat both equivalently." @@ -1725,19 +1742,19 @@ msgstr "" ":data:`!Never` 以及 :data:`!NoReturn` 在型別系統中具有相同的意義且靜態型別檢" "查器會將兩者視為相等。" -#: ../../library/typing.rst:976 +#: ../../library/typing.rst:981 msgid "Added :data:`NoReturn`." msgstr "新增 :data:`NoReturn`。" -#: ../../library/typing.rst:980 +#: ../../library/typing.rst:985 msgid "Added :data:`Never`." msgstr "新增 :data:`Never`。" -#: ../../library/typing.rst:984 +#: ../../library/typing.rst:989 msgid "Special type to represent the current enclosed class." msgstr "特別型別,用來表示目前類別之內 (enclosed class)。" -#: ../../library/typing.rst:988 +#: ../../library/typing.rst:993 msgid "" "from typing import Self, reveal_type\n" "\n" @@ -1753,13 +1770,13 @@ msgid "" "\"SubclassOfFoo\"" msgstr "" -#: ../../library/typing.rst:1000 +#: ../../library/typing.rst:1005 msgid "" "This annotation is semantically equivalent to the following, albeit in a " "more succinct fashion::" msgstr "這個註釋在語意上相等於下列內容,且形式更為簡潔: ::" -#: ../../library/typing.rst:1003 +#: ../../library/typing.rst:1008 msgid "" "from typing import TypeVar\n" "\n" @@ -1779,7 +1796,7 @@ msgstr "" " ...\n" " return self" -#: ../../library/typing.rst:1012 +#: ../../library/typing.rst:1017 msgid "" "In general, if something returns ``self``, as in the above examples, you " "should use ``Self`` as the return annotation. If ``Foo.return_self`` was " @@ -1792,11 +1809,11 @@ msgstr "" "器應該推論這個從 ``SubclassOfFoo.return_self`` 回傳的物件為 ``Foo`` 型別,而" "並非回傳 ``SubclassOfFoo`` 型別。" -#: ../../library/typing.rst:1018 +#: ../../library/typing.rst:1023 msgid "Other common use cases include:" msgstr "其他常見的使用案例包含: ::" -#: ../../library/typing.rst:1020 +#: ../../library/typing.rst:1025 msgid "" ":class:`classmethod`\\s that are used as alternative constructors and return " "instances of the ``cls`` parameter." @@ -1804,11 +1821,11 @@ msgstr "" ":class:`classmethod` 被用來作為替代的建構函式 (constructor) 並回傳 ``cls`` 參" "數的實例。" -#: ../../library/typing.rst:1022 +#: ../../library/typing.rst:1027 msgid "Annotating an :meth:`~object.__enter__` method which returns self." msgstr "註釋一個回傳自己的 :meth:`~object.__enter__` 方法。" -#: ../../library/typing.rst:1024 +#: ../../library/typing.rst:1029 msgid "" "You should not use ``Self`` as the return annotation if the method is not " "guaranteed to return an instance of a subclass when the class is subclassed::" @@ -1816,7 +1833,7 @@ msgstr "" "當類別被子類別化時,若方法不保證回傳一個子類別的實例,你不應該使用 ``Self`` " "作為回傳註釋: ::" -#: ../../library/typing.rst:1028 +#: ../../library/typing.rst:1033 msgid "" "class Eggs:\n" " # Self would be an incorrect return annotation here,\n" @@ -1826,17 +1843,17 @@ msgid "" " return Eggs()" msgstr "" -#: ../../library/typing.rst:1035 +#: ../../library/typing.rst:1040 msgid "See :pep:`673` for more details." msgstr "更多細節請見 :pep:`673`。" -#: ../../library/typing.rst:1041 +#: ../../library/typing.rst:1046 msgid "" "Special annotation for explicitly declaring a :ref:`type alias `." msgstr "做為明確宣告一個\\ :ref:`型別別名 ` 的特別註釋。" -#: ../../library/typing.rst:1045 +#: ../../library/typing.rst:1050 msgid "" "from typing import TypeAlias\n" "\n" @@ -1846,7 +1863,7 @@ msgstr "" "\n" "Factors: TypeAlias = list[int]" -#: ../../library/typing.rst:1049 +#: ../../library/typing.rst:1054 msgid "" "``TypeAlias`` is particularly useful on older Python versions for annotating " "aliases that make use of forward references, as it can be hard for type " @@ -1856,7 +1873,7 @@ msgstr "" "(forward reference),因為對於型別檢查器來說,分辨這些別名與一般的變數賦值相當" "困難: ::" -#: ../../library/typing.rst:1053 +#: ../../library/typing.rst:1058 msgid "" "from typing import Generic, TypeAlias, TypeVar\n" "\n" @@ -1874,31 +1891,31 @@ msgid "" " def make_box_of_strings(cls) -> BoxOfStrings: ..." msgstr "" -#: ../../library/typing.rst:1069 +#: ../../library/typing.rst:1074 msgid "See :pep:`613` for more details." msgstr "更多細節請見 :pep:`613`。" -#: ../../library/typing.rst:1073 +#: ../../library/typing.rst:1078 msgid "" ":data:`TypeAlias` is deprecated in favor of the :keyword:`type` statement, " "which creates instances of :class:`TypeAliasType` and which natively " -"supports forward references. Note that while :data:`TypeAlias` " -"and :class:`TypeAliasType` serve similar purposes and have similar names, " -"they are distinct and the latter is not the type of the former. Removal " -"of :data:`TypeAlias` is not currently planned, but users are encouraged to " -"migrate to :keyword:`type` statements." -msgstr "" -":data:`TypeAlias` 被棄用,請改用 :keyword:`type` 陳述式來建" -"立 :class:`TypeAliasType` 的實例,其自然可以支援傳遞參照的使用。請注意,雖" -"然 :data:`TypeAlias` 以及 :class:`TypeAliasType` 提供相似的用途且具有相似的名" -"稱,他們是不同的,且後者不是前者的型別。現在還沒有移除 :data:`TypeAlias` 的計" -"畫,但鼓勵使用者們遷移 (migrate) 至 :keyword:`type` 陳述式。" - -#: ../../library/typing.rst:1084 +"supports forward references. Note that while :data:`TypeAlias` and :class:" +"`TypeAliasType` serve similar purposes and have similar names, they are " +"distinct and the latter is not the type of the former. Removal of :data:" +"`TypeAlias` is not currently planned, but users are encouraged to migrate " +"to :keyword:`type` statements." +msgstr "" +":data:`TypeAlias` 被棄用,請改用 :keyword:`type` 陳述式來建立 :class:" +"`TypeAliasType` 的實例,其自然可以支援傳遞參照的使用。請注意,雖然 :data:" +"`TypeAlias` 以及 :class:`TypeAliasType` 提供相似的用途且具有相似的名稱,他們" +"是不同的,且後者不是前者的型別。現在還沒有移除 :data:`TypeAlias` 的計畫,但鼓" +"勵使用者們遷移 (migrate) 至 :keyword:`type` 陳述式。" + +#: ../../library/typing.rst:1089 msgid "Special forms" msgstr "特別型式" -#: ../../library/typing.rst:1086 +#: ../../library/typing.rst:1091 msgid "" "These can be used as types in annotations. They all support subscription " "using ``[]``, but each has a unique syntax." @@ -1906,14 +1923,14 @@ msgstr "" "這些在註釋中可以當作型別使用。他們全都支援 ``[]`` 的下標使用,但每個都具有獨" "特的語法。" -#: ../../library/typing.rst:1091 +#: ../../library/typing.rst:1096 msgid "" "Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or " "Y." msgstr "" "聯集型別;``Union[X, Y]`` 與 ``X | Y`` 是相等的,且都意味著 X 或 Y 兩者其一。" -#: ../../library/typing.rst:1093 +#: ../../library/typing.rst:1098 msgid "" "To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | " "str``. Using that shorthand is recommended. Details:" @@ -1921,25 +1938,25 @@ msgstr "" "為了定義聯集,例如可以使用 ``Union[int, str]`` 或是使用簡寫 (shorthand) " "``int | str``。使用這種簡寫是非常推薦的。詳細請看: ::" -#: ../../library/typing.rst:1095 +#: ../../library/typing.rst:1100 msgid "The arguments must be types and there must be at least one." msgstr "引數必須為型別且必須有至少一個。" -#: ../../library/typing.rst:1097 +#: ../../library/typing.rst:1102 msgid "Unions of unions are flattened, e.g.::" msgstr "聯集中的聯集會是扁平化的 (flattened),舉例來說: ::" -#: ../../library/typing.rst:1099 +#: ../../library/typing.rst:1104 msgid "Union[Union[int, str], float] == Union[int, str, float]" msgstr "Union[Union[int, str], float] == Union[int, str, float]" -#: ../../library/typing.rst:1101 +#: ../../library/typing.rst:1106 msgid "" "However, this does not apply to unions referenced through a type alias, to " "avoid forcing evaluation of the underlying :class:`TypeAliasType`::" msgstr "" -#: ../../library/typing.rst:1104 +#: ../../library/typing.rst:1109 msgid "" "type A = Union[int, str]\n" "Union[A, float] != Union[int, str, float]" @@ -1947,50 +1964,50 @@ msgstr "" "type A = Union[int, str]\n" "Union[A, float] != Union[int, str, float]" -#: ../../library/typing.rst:1107 +#: ../../library/typing.rst:1112 msgid "Unions of a single argument vanish, e.g.::" msgstr "單一引數的聯集會消失不見,舉例來說: ::" -#: ../../library/typing.rst:1109 +#: ../../library/typing.rst:1114 msgid "Union[int] == int # The constructor actually returns int" msgstr "Union[int] == int # 實際上建構函式會回傳 int" -#: ../../library/typing.rst:1111 ../../library/typing.rst:1253 +#: ../../library/typing.rst:1116 ../../library/typing.rst:1260 msgid "Redundant arguments are skipped, e.g.::" msgstr "多餘的引數會被略過,舉例來說: ::" -#: ../../library/typing.rst:1113 +#: ../../library/typing.rst:1118 msgid "Union[int, str, int] == Union[int, str] == int | str" msgstr "Union[int, str, int] == Union[int, str] == int | str" -#: ../../library/typing.rst:1115 +#: ../../library/typing.rst:1120 msgid "When comparing unions, the argument order is ignored, e.g.::" msgstr "當比較聯集時,引數的順序會被忽略,舉例來說: ::" -#: ../../library/typing.rst:1117 +#: ../../library/typing.rst:1122 msgid "Union[int, str] == Union[str, int]" msgstr "Union[int, str] == Union[str, int]" -#: ../../library/typing.rst:1119 +#: ../../library/typing.rst:1124 msgid "You cannot subclass or instantiate a ``Union``." msgstr "你不能建立 ``Union`` 的子類別或是實例。" -#: ../../library/typing.rst:1121 +#: ../../library/typing.rst:1126 msgid "You cannot write ``Union[X][Y]``." msgstr "你不能寫成 ``Union[X][Y]``。" -#: ../../library/typing.rst:1123 +#: ../../library/typing.rst:1128 msgid "Don't remove explicit subclasses from unions at runtime." msgstr "請勿在 runtime 中將顯性子類別從聯集中移除。" -#: ../../library/typing.rst:1126 +#: ../../library/typing.rst:1131 msgid "" "Unions can now be written as ``X | Y``. See :ref:`union type " "expressions`." msgstr "" "現在可以將聯集寫成 ``X | Y``。請見\\ :ref:`聯集型別運算式 `。" -#: ../../library/typing.rst:1130 +#: ../../library/typing.rst:1135 msgid "" ":class:`types.UnionType` is now an alias for :class:`Union`, and both " "``Union[int, str]`` and ``int | str`` create instances of the same class. To " @@ -1999,11 +2016,11 @@ msgid "" "``get_origin(obj) is typing.Union or get_origin(obj) is types.UnionType``." msgstr "" -#: ../../library/typing.rst:1140 +#: ../../library/typing.rst:1145 msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)." msgstr "``Optional[X]`` 與 ``X | None`` 是相等的(或是 ``Union[X, None]``)。" -#: ../../library/typing.rst:1142 +#: ../../library/typing.rst:1147 msgid "" "Note that this is not the same concept as an optional argument, which is one " "that has a default. An optional argument with a default does not require " @@ -2014,7 +2031,7 @@ msgstr "" "有預設值的選擇性引數的型別註釋中不具有 ``Optional`` 限定符 (qualifier),單純" "的因為它就是選擇性的。舉例來說: ::" -#: ../../library/typing.rst:1147 +#: ../../library/typing.rst:1152 msgid "" "def foo(arg: int = 0) -> None:\n" " ..." @@ -2022,7 +2039,7 @@ msgstr "" "def foo(arg: int = 0) -> None:\n" " ..." -#: ../../library/typing.rst:1150 +#: ../../library/typing.rst:1155 msgid "" "On the other hand, if an explicit value of ``None`` is allowed, the use of " "``Optional`` is appropriate, whether the argument is optional or not. For " @@ -2031,7 +2048,7 @@ msgstr "" "另一方面,如果一個顯性的值 ``None`` 是被允許的,不論引數是不是選擇性的," "``Optional`` 都適用。舉例來說: ::" -#: ../../library/typing.rst:1154 +#: ../../library/typing.rst:1159 msgid "" "def foo(arg: Optional[int] = None) -> None:\n" " ..." @@ -2039,7 +2056,7 @@ msgstr "" "def foo(arg: Optional[int] = None) -> None:\n" " ..." -#: ../../library/typing.rst:1157 +#: ../../library/typing.rst:1162 msgid "" "Optional can now be written as ``X | None``. See :ref:`union type " "expressions`." @@ -2047,11 +2064,11 @@ msgstr "" "現在可以將 Optional 寫成 ``X | None``。請見\\ :ref:`聯集型別運算式 `。" -#: ../../library/typing.rst:1163 +#: ../../library/typing.rst:1168 msgid "Special form for annotating higher-order functions." msgstr "用於註釋高階函式的特別型式。" -#: ../../library/typing.rst:1165 +#: ../../library/typing.rst:1172 msgid "" "``Concatenate`` can be used in conjunction with :ref:`Callable ` and :class:`ParamSpec` to annotate a higher-order callable which " @@ -2061,23 +2078,23 @@ msgid "" "a :ref:`Callable `. The last parameter to " "``Concatenate`` must be a :class:`ParamSpec` or ellipsis (``...``)." msgstr "" -"``Concatenate`` 可以被用在\\ :ref:`可呼叫物件 `\\ " -"與 :class:`ParamSpec` 的接合 (conjunction) 並註釋一個高階的 Callable 物件可以" -"新增、移除、轉換另一個 Callable 物件的參數。使用方法是依照這個格式 " +"``Concatenate`` 可以被用在\\ :ref:`可呼叫物件 `\\ 與 :" +"class:`ParamSpec` 的接合 (conjunction) 並註釋一個高階的 Callable 物件可以新" +"增、移除、轉換另一個 Callable 物件的參數。使用方法是依照這個格式 " "``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``。``Concatenate`` " "目前只在 :ref:`Callable 物件 `\\ 中第一個引數使用時有" "效。``Concatenate`` 的最後一個參數必須為一個 :class:`ParamSpec` 或是刪節號 " "(``...``)。" -#: ../../library/typing.rst:1174 +#: ../../library/typing.rst:1181 msgid "" -"For example, to annotate a decorator ``with_lock`` which provides " -"a :class:`threading.Lock` to the decorated function, ``Concatenate`` can be " -"used to indicate that ``with_lock`` expects a callable which takes in a " -"``Lock`` as the first argument, and returns a callable with a different type " -"signature. In this case, the :class:`ParamSpec` indicates that the returned " -"callable's parameter types are dependent on the parameter types of the " -"callable being passed in::" +"For example, to annotate a decorator ``with_lock`` which provides a :class:" +"`threading.Lock` to the decorated function, ``Concatenate`` can be used to " +"indicate that ``with_lock`` expects a callable which takes in a ``Lock`` as " +"the first argument, and returns a callable with a different type signature. " +"In this case, the :class:`ParamSpec` indicates that the returned callable's " +"parameter types are dependent on the parameter types of the callable being " +"passed in::" msgstr "" "舉例來說,註釋一個為裝飾過後的函式提供 :class:`threading.Lock` 的裝飾器 " "``with_lock``,``Concatenate`` 可以用於指出 ``with_lock`` 預期一個 Callable " @@ -2085,7 +2102,7 @@ msgstr "" "Callable 物件。在這種情況下,:class:`ParamSpec` 指出回傳的 Callable 物件的參" "數型別會依賴傳遞的 Callable 物件的參數型別: ::" -#: ../../library/typing.rst:1182 +#: ../../library/typing.rst:1189 msgid "" "from collections.abc import Callable\n" "from threading import Lock\n" @@ -2113,32 +2130,32 @@ msgid "" "sum_threadsafe([1.1, 2.2, 3.3])" msgstr "" -#: ../../library/typing.rst:1210 ../../library/typing.rst:2211 +#: ../../library/typing.rst:1217 ../../library/typing.rst:2218 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)" msgstr ":pep:`612` -- 參數技術規範變數" -#: ../../library/typing.rst:1212 +#: ../../library/typing.rst:1219 msgid ":class:`ParamSpec`" msgstr ":class:`ParamSpec`" -#: ../../library/typing.rst:1213 ../../library/typing.rst:2214 +#: ../../library/typing.rst:1220 ../../library/typing.rst:2221 msgid ":ref:`annotating-callables`" msgstr ":ref:`annotating-callables`" -#: ../../library/typing.rst:1217 +#: ../../library/typing.rst:1224 msgid "Special typing form to define \"literal types\"." msgstr "特殊型別格式,用於定義「文本型別 (literal type)」。" -#: ../../library/typing.rst:1219 +#: ../../library/typing.rst:1226 msgid "" "``Literal`` can be used to indicate to type checkers that the annotated " "object has a value equivalent to one of the provided literals." msgstr "" "``Literal`` 可以用於型別檢查器並指出註釋物件具有一個與提供的文本相同的值。" -#: ../../library/typing.rst:1225 +#: ../../library/typing.rst:1232 msgid "" "def validate_simple(data: Any) -> Literal[True]: # always returns True\n" " ...\n" @@ -2151,7 +2168,7 @@ msgid "" "open_helper('/other/path', 'typo') # Error in type checker" msgstr "" -#: ../../library/typing.rst:1235 +#: ../../library/typing.rst:1242 msgid "" "``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is " "allowed as type argument to ``Literal[...]``, but type checkers may impose " @@ -2161,29 +2178,29 @@ msgstr "" "``Literal[...]`` 的型別引數,但型別檢查器可能會加強限制。更多有關文本型別的詳" "細資訊請看 :pep:`586`。" -#: ../../library/typing.rst:1239 +#: ../../library/typing.rst:1246 msgid "Additional details:" msgstr "其他細節:" -#: ../../library/typing.rst:1241 +#: ../../library/typing.rst:1248 msgid "The arguments must be literal values and there must be at least one." msgstr "引數必須為文本值且必須有至少一個。" -#: ../../library/typing.rst:1243 +#: ../../library/typing.rst:1250 msgid "Nested ``Literal`` types are flattened, e.g.::" msgstr "巢狀的 ``Literal`` 會是扁平化的 (flattened),舉例來說: ::" -#: ../../library/typing.rst:1245 +#: ../../library/typing.rst:1252 msgid "assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]" msgstr "assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]" -#: ../../library/typing.rst:1247 +#: ../../library/typing.rst:1254 msgid "" "However, this does not apply to ``Literal`` types referenced through a type " "alias, to avoid forcing evaluation of the underlying :class:`TypeAliasType`::" msgstr "" -#: ../../library/typing.rst:1250 +#: ../../library/typing.rst:1257 msgid "" "type A = Literal[1, 2]\n" "assert Literal[A, 3] != Literal[1, 2, 3]" @@ -2191,27 +2208,27 @@ msgstr "" "type A = Literal[1, 2]\n" "assert Literal[A, 3] != Literal[1, 2, 3]" -#: ../../library/typing.rst:1255 +#: ../../library/typing.rst:1262 msgid "assert Literal[1, 2, 1] == Literal[1, 2]" msgstr "assert Literal[1, 2, 1] == Literal[1, 2]" -#: ../../library/typing.rst:1257 +#: ../../library/typing.rst:1264 msgid "When comparing literals, the argument order is ignored, e.g.::" msgstr "當比較文本時,引數的順序會被忽略,舉例來說: ::" -#: ../../library/typing.rst:1259 +#: ../../library/typing.rst:1266 msgid "assert Literal[1, 2] == Literal[2, 1]" msgstr "assert Literal[1, 2] == Literal[2, 1]" -#: ../../library/typing.rst:1261 +#: ../../library/typing.rst:1268 msgid "You cannot subclass or instantiate a ``Literal``." msgstr "你不能建立 ``Literal`` 的子類別或是實例。" -#: ../../library/typing.rst:1263 +#: ../../library/typing.rst:1270 msgid "You cannot write ``Literal[X][Y]``." msgstr "你不能寫成 ``Literal[X][Y]``。" -#: ../../library/typing.rst:1267 +#: ../../library/typing.rst:1274 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " @@ -2222,11 +2239,11 @@ msgstr "" "比較不再依照相依性排序。``Literal`` 物件現在會在相等性比較期間,若任一個其中" "的參數無法 :term:`hashable` 時,則會引發一個 :exc:`TypeError` 例外。" -#: ../../library/typing.rst:1275 +#: ../../library/typing.rst:1282 msgid "Special type construct to mark class variables." msgstr "特殊型別建構,用來標記類別變數。" -#: ../../library/typing.rst:1277 +#: ../../library/typing.rst:1284 msgid "" "As introduced in :pep:`526`, a variable annotation wrapped in ClassVar " "indicates that a given attribute is intended to be used as a class variable " @@ -2236,7 +2253,7 @@ msgstr "" "定的屬性 (attribute) 意圖被當作類別變數使用,且不該被設定成該類別的實例。使用" "方法如下: ::" -#: ../../library/typing.rst:1281 +#: ../../library/typing.rst:1288 msgid "" "class Starship:\n" " stats: ClassVar[dict[str, int]] = {} # class variable\n" @@ -2246,39 +2263,38 @@ msgstr "" " stats: ClassVar[dict[str, int]] = {} # 類別變數\n" " damage: int = 10 # 實例變數" -#: ../../library/typing.rst:1285 +#: ../../library/typing.rst:1292 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr ":data:`ClassVar` 只接受型別請不得使用下標。" -#: ../../library/typing.rst:1287 +#: ../../library/typing.rst:1294 msgid "" -":data:`ClassVar` is not a class itself, and should not be used " -"with :func:`isinstance` or :func:`issubclass`. :data:`ClassVar` does not " -"change Python runtime behavior, but it can be used by third-party type " -"checkers. For example, a type checker might flag the following code as an " -"error::" +":data:`ClassVar` is not a class itself, and should not be used with :func:" +"`isinstance` or :func:`issubclass`. :data:`ClassVar` does not change Python " +"runtime behavior, but it can be used by third-party type checkers. For " +"example, a type checker might flag the following code as an error::" msgstr "" -":data:`ClassVar` 並不代表該類別本身,而且不應該和 :func:`isinstance` 或" -"是 :func:`issubclass` 一起使用。:data:`ClassVar` 不會改變 Python runtime 的行" -"為,但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方" -"的程式碼為一個錯誤: ::" +":data:`ClassVar` 並不代表該類別本身,而且不應該和 :func:`isinstance` 或是 :" +"func:`issubclass` 一起使用。:data:`ClassVar` 不會改變 Python runtime 的行為," +"但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方的程" +"式碼為一個錯誤: ::" -#: ../../library/typing.rst:1293 +#: ../../library/typing.rst:1300 msgid "" "enterprise_d = Starship(3000)\n" "enterprise_d.stats = {} # Error, setting class variable on instance\n" "Starship.stats = {} # This is OK" msgstr "" -#: ../../library/typing.rst:1301 +#: ../../library/typing.rst:1308 msgid ":data:`ClassVar` can now be nested in :data:`Final` and vice versa." msgstr "" -#: ../../library/typing.rst:1305 +#: ../../library/typing.rst:1312 msgid "Special typing construct to indicate final names to type checkers." msgstr "特殊型別建構,用來指出給型別檢查器的最終名稱。" -#: ../../library/typing.rst:1307 +#: ../../library/typing.rst:1314 msgid "" "Final names cannot be reassigned in any scope. Final names declared in class " "scopes cannot be overridden in subclasses." @@ -2286,7 +2302,7 @@ msgstr "" "最終名稱不可以在任何作用域 (scope) 中重新賦值。在類別作用域中宣告的最終名稱," "不得在子類別中進行覆寫 (override)。" -#: ../../library/typing.rst:1312 +#: ../../library/typing.rst:1319 msgid "" "MAX_SIZE: Final = 9000\n" "MAX_SIZE += 1 # Error reported by type checker\n" @@ -2298,46 +2314,46 @@ msgid "" " TIMEOUT = 1 # Error reported by type checker" msgstr "" -#: ../../library/typing.rst:1321 ../../library/typing.rst:3234 +#: ../../library/typing.rst:1328 ../../library/typing.rst:3241 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" "這些屬性 (property) 不會在 runtime 時進行檢查。更多詳細資訊請看 :pep:`591`。" -#: ../../library/typing.rst:1328 +#: ../../library/typing.rst:1335 msgid ":data:`Final` can now be nested in :data:`ClassVar` and vice versa." msgstr "" -#: ../../library/typing.rst:1332 +#: ../../library/typing.rst:1339 msgid "Special typing construct to mark a :class:`TypedDict` key as required." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是必須的。" -#: ../../library/typing.rst:1334 +#: ../../library/typing.rst:1341 msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." msgstr "" -"主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` " -"與 :pep:`655`。" +"主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` 與 :" +"pep:`655`。" -#: ../../library/typing.rst:1341 +#: ../../library/typing.rst:1348 msgid "" "Special typing construct to mark a :class:`TypedDict` key as potentially " "missing." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是可能消失的。" -#: ../../library/typing.rst:1344 +#: ../../library/typing.rst:1351 msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" -#: ../../library/typing.rst:1350 +#: ../../library/typing.rst:1357 msgid "" "A special typing construct to mark an item of a :class:`TypedDict` as read-" "only." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 的項目是唯讀的。" -#: ../../library/typing.rst:1354 +#: ../../library/typing.rst:1361 msgid "" "class Movie(TypedDict):\n" " title: ReadOnly[str]\n" @@ -2355,19 +2371,19 @@ msgstr "" " m[\"year\"] = 1999 # allowed\n" " m[\"title\"] = \"The Matrix\" # 型別檢查器錯誤" -#: ../../library/typing.rst:1362 +#: ../../library/typing.rst:1369 msgid "There is no runtime checking for this property." msgstr "這些屬性 (property) 不會在 runtime 時進行檢查。" -#: ../../library/typing.rst:1364 +#: ../../library/typing.rst:1371 msgid "See :class:`TypedDict` and :pep:`705` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`705`。" -#: ../../library/typing.rst:1370 +#: ../../library/typing.rst:1377 msgid "Special typing form to add context-specific metadata to an annotation." msgstr "" -#: ../../library/typing.rst:1372 +#: ../../library/typing.rst:1379 msgid "" "Add metadata ``x`` to a given type ``T`` by using the annotation " "``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by " @@ -2375,7 +2391,7 @@ msgid "" "a :attr:`!__metadata__` attribute." msgstr "" -#: ../../library/typing.rst:1377 +#: ../../library/typing.rst:1384 msgid "" "If a library or tool encounters an annotation ``Annotated[T, x]`` and has no " "special logic for the metadata, it should ignore the metadata and simply " @@ -2384,7 +2400,7 @@ msgid "" "system." msgstr "" -#: ../../library/typing.rst:1383 +#: ../../library/typing.rst:1390 msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " @@ -2394,7 +2410,7 @@ msgid "" "for a function or class." msgstr "" -#: ../../library/typing.rst:1390 +#: ../../library/typing.rst:1397 msgid "" "The responsibility of how to interpret the metadata lies with the tool or " "library encountering an ``Annotated`` annotation. A tool or library " @@ -2402,13 +2418,13 @@ msgid "" "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" -#: ../../library/typing.rst:1398 +#: ../../library/typing.rst:1405 msgid "" "Here is an example of how you might use ``Annotated`` to add metadata to " "type annotations if you were doing range analysis:" msgstr "" -#: ../../library/typing.rst:1401 +#: ../../library/typing.rst:1408 msgid "" "@dataclass\n" "class ValueRange:\n" @@ -2426,14 +2442,14 @@ msgstr "" "T1 = Annotated[int, ValueRange(-10, 5)]\n" "T2 = Annotated[T1, ValueRange(-20, 3)]" -#: ../../library/typing.rst:1411 +#: ../../library/typing.rst:1418 msgid "" "The first argument to ``Annotated`` must be a valid type. Multiple metadata " "elements can be supplied as ``Annotated`` supports variadic arguments. The " "order of the metadata elements is preserved and matters for equality checks::" msgstr "" -#: ../../library/typing.rst:1415 +#: ../../library/typing.rst:1422 msgid "" "@dataclass\n" "class ctype:\n" @@ -2453,20 +2469,20 @@ msgstr "" "\n" "assert a1 != a2 # 順序是有意義的" -#: ../../library/typing.rst:1424 +#: ../../library/typing.rst:1431 msgid "" "It is up to the tool consuming the annotations to decide whether the client " "is allowed to add multiple metadata elements to one annotation and how to " "merge those annotations." msgstr "" -#: ../../library/typing.rst:1428 +#: ../../library/typing.rst:1435 msgid "" "Nested ``Annotated`` types are flattened. The order of the metadata elements " "starts with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:1431 +#: ../../library/typing.rst:1438 msgid "" "assert Annotated[Annotated[int, ValueRange(3, 10)], ctype(\"char\")] == " "Annotated[\n" @@ -2478,14 +2494,14 @@ msgstr "" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" -#: ../../library/typing.rst:1435 +#: ../../library/typing.rst:1442 msgid "" "However, this does not apply to ``Annotated`` types referenced through a " -"type alias, to avoid forcing evaluation of the " -"underlying :class:`TypeAliasType`::" +"type alias, to avoid forcing evaluation of the underlying :class:" +"`TypeAliasType`::" msgstr "" -#: ../../library/typing.rst:1438 +#: ../../library/typing.rst:1445 msgid "" "type From3To10[T] = Annotated[T, ValueRange(3, 10)]\n" "assert Annotated[From3To10[int], ctype(\"char\")] != Annotated[\n" @@ -2497,11 +2513,11 @@ msgstr "" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" -#: ../../library/typing.rst:1443 +#: ../../library/typing.rst:1450 msgid "Duplicated metadata elements are not removed::" msgstr "" -#: ../../library/typing.rst:1445 +#: ../../library/typing.rst:1452 msgid "" "assert Annotated[int, ValueRange(3, 10)] != Annotated[\n" " int, ValueRange(3, 10), ValueRange(3, 10)\n" @@ -2511,11 +2527,11 @@ msgstr "" " int, ValueRange(3, 10), ValueRange(3, 10)\n" "]" -#: ../../library/typing.rst:1449 +#: ../../library/typing.rst:1456 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" -#: ../../library/typing.rst:1451 +#: ../../library/typing.rst:1458 msgid "" "@dataclass\n" "class MaxLen:\n" @@ -2529,11 +2545,11 @@ msgid "" "type V = Vec[int]" msgstr "" -#: ../../library/typing.rst:1463 +#: ../../library/typing.rst:1470 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" msgstr "" -#: ../../library/typing.rst:1465 +#: ../../library/typing.rst:1472 msgid "" "type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " "Ann1] # NOT valid" @@ -2541,19 +2557,19 @@ msgstr "" "type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " "Ann1] # 無效" -#: ../../library/typing.rst:1467 +#: ../../library/typing.rst:1474 msgid "" "where ``T1``, ``T2``, ... are :class:`TypeVars `. This is invalid " "as only one type should be passed to Annotated." msgstr "" -#: ../../library/typing.rst:1470 +#: ../../library/typing.rst:1477 msgid "" "By default, :func:`get_type_hints` strips the metadata from annotations. " "Pass ``include_extras=True`` to have the metadata preserved:" msgstr "" -#: ../../library/typing.rst:1473 +#: ../../library/typing.rst:1480 msgid "" ">>> from typing import Annotated, get_type_hints\n" ">>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n" @@ -2571,13 +2587,13 @@ msgstr "" ">>> get_type_hints(func, include_extras=True)\n" "{'x': typing.Annotated[int, 'metadata'], 'return': }" -#: ../../library/typing.rst:1483 +#: ../../library/typing.rst:1490 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: ../../library/typing.rst:1486 +#: ../../library/typing.rst:1493 msgid "" ">>> from typing import Annotated\n" ">>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n" @@ -2593,13 +2609,13 @@ msgstr "" ">>> X.__metadata__\n" "('very', 'important', 'metadata')" -#: ../../library/typing.rst:1495 +#: ../../library/typing.rst:1502 msgid "" -"If you want to retrieve the original type wrapped by ``Annotated``, use " -"the :attr:`!__origin__` attribute:" +"If you want to retrieve the original type wrapped by ``Annotated``, use the :" +"attr:`!__origin__` attribute:" msgstr "" -#: ../../library/typing.rst:1498 +#: ../../library/typing.rst:1505 msgid "" ">>> from typing import Annotated, get_origin\n" ">>> Password = Annotated[str, \"secret\"]\n" @@ -2611,11 +2627,11 @@ msgstr "" ">>> Password.__origin__\n" "" -#: ../../library/typing.rst:1505 +#: ../../library/typing.rst:1512 msgid "Note that using :func:`get_origin` will return ``Annotated`` itself:" msgstr "" -#: ../../library/typing.rst:1507 +#: ../../library/typing.rst:1514 msgid "" ">>> get_origin(Password)\n" "typing.Annotated" @@ -2623,20 +2639,20 @@ msgstr "" ">>> get_origin(Password)\n" "typing.Annotated" -#: ../../library/typing.rst:1514 +#: ../../library/typing.rst:1521 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:1515 +#: ../../library/typing.rst:1522 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1522 ../../library/typing.rst:1606 +#: ../../library/typing.rst:1529 ../../library/typing.rst:1613 msgid "" "Special typing construct for marking user-defined type predicate functions." msgstr "" -#: ../../library/typing.rst:1524 +#: ../../library/typing.rst:1531 msgid "" "``TypeIs`` can be used to annotate the return type of a user-defined type " "predicate function. ``TypeIs`` only accepts a single type argument. At " @@ -2644,7 +2660,7 @@ msgid "" "one positional argument." msgstr "" -#: ../../library/typing.rst:1529 +#: ../../library/typing.rst:1536 msgid "" "``TypeIs`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -2654,7 +2670,7 @@ msgid "" "predicate\"::" msgstr "" -#: ../../library/typing.rst:1535 +#: ../../library/typing.rst:1542 msgid "" "def is_str(val: str | float):\n" " # \"isinstance\" type predicate\n" @@ -2666,40 +2682,40 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1544 +#: ../../library/typing.rst:1551 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " -"type predicate. Such a function should use ``TypeIs[...]`` " -"or :data:`TypeGuard` as its return type to alert static type checkers to " -"this intention. ``TypeIs`` usually has more intuitive behavior than " +"type predicate. Such a function should use ``TypeIs[...]`` or :data:" +"`TypeGuard` as its return type to alert static type checkers to this " +"intention. ``TypeIs`` usually has more intuitive behavior than " "``TypeGuard``, but it cannot be used when the input and output types are " "incompatible (e.g., ``list[object]`` to ``list[int]``) or when the function " "does not return ``True`` for all instances of the narrowed type." msgstr "" -#: ../../library/typing.rst:1552 +#: ../../library/typing.rst:1559 msgid "" "Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " "given function:" msgstr "" -#: ../../library/typing.rst:1555 ../../library/typing.rst:1616 +#: ../../library/typing.rst:1562 ../../library/typing.rst:1623 msgid "The return value is a boolean." msgstr "回傳值是一個布林值。" -#: ../../library/typing.rst:1556 +#: ../../library/typing.rst:1563 msgid "" "If the return value is ``True``, the type of its argument is the " "intersection of the argument's original type and ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1558 +#: ../../library/typing.rst:1565 msgid "" "If the return value is ``False``, the type of its argument is narrowed to " "exclude ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1563 +#: ../../library/typing.rst:1570 msgid "" "from typing import assert_type, final, TypeIs\n" "\n" @@ -2723,7 +2739,7 @@ msgid "" " assert_type(arg, Unrelated)" msgstr "" -#: ../../library/typing.rst:1584 +#: ../../library/typing.rst:1591 msgid "" "The type inside ``TypeIs`` must be consistent with the type of the " "function's argument; if it is not, static type checkers will raise an " @@ -2732,27 +2748,27 @@ msgid "" "functions in a type-safe manner." msgstr "" -#: ../../library/typing.rst:1590 +#: ../../library/typing.rst:1597 msgid "" "If a ``TypeIs`` function is a class or instance method, then the type in " "``TypeIs`` maps to the type of the second parameter (after ``cls`` or " "``self``)." msgstr "" -#: ../../library/typing.rst:1594 +#: ../../library/typing.rst:1601 msgid "" "In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``, means that " "if ``foo(arg)`` returns ``True``, then ``arg`` is an instance of ``TypeB``, " "and if it returns ``False``, it is not an instance of ``TypeB``." msgstr "" -#: ../../library/typing.rst:1598 +#: ../../library/typing.rst:1605 msgid "" -"``TypeIs`` also works with type variables. For more information, " -"see :pep:`742` (Narrowing types with ``TypeIs``)." +"``TypeIs`` also works with type variables. For more information, see :pep:" +"`742` (Narrowing types with ``TypeIs``)." msgstr "" -#: ../../library/typing.rst:1608 +#: ../../library/typing.rst:1615 msgid "" "Type predicate functions are user-defined functions that return whether " "their argument is an instance of a particular type. ``TypeGuard`` works " @@ -2760,25 +2776,25 @@ msgid "" "checking behavior (see below)." msgstr "" -#: ../../library/typing.rst:1613 +#: ../../library/typing.rst:1620 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1617 +#: ../../library/typing.rst:1624 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1620 +#: ../../library/typing.rst:1627 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: ../../library/typing.rst:1624 +#: ../../library/typing.rst:1631 msgid "" "def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" " '''Determines whether all objects in the list are strings'''\n" @@ -2793,11 +2809,11 @@ msgid "" " print(\"Not a list of strings!\")" msgstr "" -#: ../../library/typing.rst:1636 +#: ../../library/typing.rst:1643 msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" msgstr "``TypeIs`` 和 ``TypeGuard`` 在以下幾個方面有所不同:" -#: ../../library/typing.rst:1638 +#: ../../library/typing.rst:1645 msgid "" "``TypeIs`` requires the narrowed type to be a subtype of the input type, " "while ``TypeGuard`` does not. The main reason is to allow for things like " @@ -2805,7 +2821,7 @@ msgid "" "subtype of the former, since ``list`` is invariant." msgstr "" -#: ../../library/typing.rst:1642 +#: ../../library/typing.rst:1649 msgid "" "When a ``TypeGuard`` function returns ``True``, type checkers narrow the " "type of the variable to exactly the ``TypeGuard`` type. When a ``TypeIs`` " @@ -2814,7 +2830,7 @@ msgid "" "type. (Technically, this is known as an intersection type.)" msgstr "" -#: ../../library/typing.rst:1646 +#: ../../library/typing.rst:1653 msgid "" "When a ``TypeGuard`` function returns ``False``, type checkers cannot narrow " "the type of the variable at all. When a ``TypeIs`` function returns " @@ -2822,18 +2838,18 @@ msgid "" "``TypeIs`` type." msgstr "" -#: ../../library/typing.rst:1655 +#: ../../library/typing.rst:1662 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1657 +#: ../../library/typing.rst:1664 msgid "" "For example, using the unpack operator ``*`` on a :ref:`type variable tuple " "` is equivalent to using ``Unpack`` to mark the type variable " "tuple as having been unpacked::" msgstr "" -#: ../../library/typing.rst:1661 +#: ../../library/typing.rst:1668 msgid "" "Ts = TypeVarTuple('Ts')\n" "tup: tuple[*Ts]\n" @@ -2841,7 +2857,7 @@ msgid "" "tup: tuple[Unpack[Ts]]" msgstr "" -#: ../../library/typing.rst:1666 +#: ../../library/typing.rst:1673 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -2849,7 +2865,7 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1672 +#: ../../library/typing.rst:1679 msgid "" "# In older versions of Python, TypeVarTuple and Unpack\n" "# are located in the `typing_extensions` backports package.\n" @@ -2860,13 +2876,13 @@ msgid "" "tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" msgstr "" -#: ../../library/typing.rst:1680 +#: ../../library/typing.rst:1687 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" -#: ../../library/typing.rst:1683 +#: ../../library/typing.rst:1690 msgid "" "from typing import TypedDict, Unpack\n" "\n" @@ -2879,23 +2895,23 @@ msgid "" "def foo(**kwargs: Unpack[Movie]): ..." msgstr "" -#: ../../library/typing.rst:1693 +#: ../../library/typing.rst:1700 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" -#: ../../library/typing.rst:1698 +#: ../../library/typing.rst:1705 msgid "Building generic types and type aliases" msgstr "" -#: ../../library/typing.rst:1700 +#: ../../library/typing.rst:1707 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types and " "type aliases." msgstr "" -#: ../../library/typing.rst:1704 +#: ../../library/typing.rst:1711 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " @@ -2903,17 +2919,17 @@ msgid "" "syntax, as documented below." msgstr "" -#: ../../library/typing.rst:1711 +#: ../../library/typing.rst:1718 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1713 +#: ../../library/typing.rst:1720 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" -#: ../../library/typing.rst:1716 +#: ../../library/typing.rst:1723 msgid "" "class Mapping[KT, VT]:\n" " def __getitem__(self, key: KT) -> VT:\n" @@ -2925,17 +2941,17 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1721 +#: ../../library/typing.rst:1728 msgid "" "Such a class implicitly inherits from ``Generic``. The runtime semantics of " "this syntax are discussed in the :ref:`Language Reference `." msgstr "" -#: ../../library/typing.rst:1725 +#: ../../library/typing.rst:1732 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1727 +#: ../../library/typing.rst:1734 msgid "" "def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" " try:\n" @@ -2949,20 +2965,20 @@ msgstr "" " except KeyError:\n" " return default" -#: ../../library/typing.rst:1733 +#: ../../library/typing.rst:1740 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -#: ../../library/typing.rst:1736 +#: ../../library/typing.rst:1743 msgid "" "For backwards compatibility, generic classes can also be declared by " "explicitly inheriting from ``Generic``. In this case, the type parameters " "must be declared separately::" msgstr "" -#: ../../library/typing.rst:1741 +#: ../../library/typing.rst:1748 msgid "" "KT = TypeVar('KT')\n" "VT = TypeVar('VT')\n" @@ -2980,18 +2996,18 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1753 +#: ../../library/typing.rst:1760 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1755 +#: ../../library/typing.rst:1762 msgid "" "The preferred way to construct a type variable is via the dedicated syntax " "for :ref:`generic functions `, :ref:`generic classes " "`, and :ref:`generic type aliases `::" msgstr "" -#: ../../library/typing.rst:1760 +#: ../../library/typing.rst:1767 msgid "" "class Sequence[T]: # T is a TypeVar\n" " ..." @@ -2999,13 +3015,13 @@ msgstr "" "class Sequence[T]: # T 是一個 TypeVar\n" " ..." -#: ../../library/typing.rst:1763 +#: ../../library/typing.rst:1770 msgid "" "This syntax can also be used to create bounded and constrained type " "variables::" msgstr "" -#: ../../library/typing.rst:1766 +#: ../../library/typing.rst:1773 msgid "" "class StrSequence[S: str]: # S is a TypeVar with a `str` upper bound;\n" " ... # we can say that S is \"bounded by `str`\"\n" @@ -3016,13 +3032,13 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1773 +#: ../../library/typing.rst:1780 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" -#: ../../library/typing.rst:1775 +#: ../../library/typing.rst:1782 msgid "" "T = TypeVar('T') # Can be anything\n" "S = TypeVar('S', bound=str) # Can be any subtype of str\n" @@ -3032,7 +3048,7 @@ msgstr "" "S = TypeVar('S', bound=str) # 可以是任何 str 的子型別\n" "A = TypeVar('A', str, bytes) # 必須是 str 或 bytes" -#: ../../library/typing.rst:1779 +#: ../../library/typing.rst:1786 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -3040,7 +3056,7 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1785 +#: ../../library/typing.rst:1792 msgid "" "def repeat[T](x: T, n: int) -> Sequence[T]:\n" " \"\"\"Return a list containing n references to x.\"\"\"\n" @@ -3058,13 +3074,13 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:1800 +#: ../../library/typing.rst:1807 msgid "" "Note that type variables can be *bounded*, *constrained*, or neither, but " "cannot be both bounded *and* constrained." msgstr "" -#: ../../library/typing.rst:1803 +#: ../../library/typing.rst:1810 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -3074,14 +3090,14 @@ msgid "" "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" -#: ../../library/typing.rst:1811 +#: ../../library/typing.rst:1818 msgid "" "Bounded type variables and constrained type variables have different " "semantics in several important ways. Using a *bounded* type variable means " "that the ``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1815 +#: ../../library/typing.rst:1822 msgid "" "x = print_capitalized('a string')\n" "reveal_type(x) # revealed type is str\n" @@ -3095,13 +3111,13 @@ msgid "" "z = print_capitalized(45) # error: int is not a subtype of str" msgstr "" -#: ../../library/typing.rst:1826 +#: ../../library/typing.rst:1833 msgid "" "The upper bound of a type variable can be a concrete type, abstract type " "(ABC or Protocol), or even a union of types::" msgstr "" -#: ../../library/typing.rst:1829 +#: ../../library/typing.rst:1836 msgid "" "# Can be anything with an __abs__ method\n" "def print_abs[T: SupportsAbs](arg: T) -> None:\n" @@ -3112,13 +3128,13 @@ msgid "" "V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" -#: ../../library/typing.rst:1838 +#: ../../library/typing.rst:1845 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" -#: ../../library/typing.rst:1841 +#: ../../library/typing.rst:1848 msgid "" "a = concatenate('one', 'two')\n" "reveal_type(a) # revealed type is str\n" @@ -3131,120 +3147,118 @@ msgid "" "or bytes in a function call, but not both" msgstr "" -#: ../../library/typing.rst:1849 +#: ../../library/typing.rst:1856 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "在 runtime ``isinstance(x, T)`` 會引發 :exc:`TypeError`。" -#: ../../library/typing.rst:1853 +#: ../../library/typing.rst:1860 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1857 +#: ../../library/typing.rst:1864 msgid "Whether the type var has been explicitly marked as covariant." msgstr "" -#: ../../library/typing.rst:1861 +#: ../../library/typing.rst:1868 msgid "Whether the type var has been explicitly marked as contravariant." msgstr "" -#: ../../library/typing.rst:1865 +#: ../../library/typing.rst:1872 msgid "" "Whether the type variable's variance should be inferred by type checkers." msgstr "" -#: ../../library/typing.rst:1871 +#: ../../library/typing.rst:1878 msgid "The upper bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1875 +#: ../../library/typing.rst:1882 msgid "" "For type variables created through :ref:`type parameter syntax `, the bound is evaluated only when the attribute is accessed, not " "when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1881 +#: ../../library/typing.rst:1888 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~TypeVar.__bound__` " -"attribute. When called directly, this method supports only " -"the :attr:`~annotationlib.Format.VALUE` format, which is equivalent to " -"accessing the :attr:`~TypeVar.__bound__` attribute directly, but the method " -"object can be passed to :func:`annotationlib.call_evaluate_function` to " -"evaluate the value in a different format." +"attribute. When called directly, this method supports only the :attr:" +"`~annotationlib.Format.VALUE` format, which is equivalent to accessing the :" +"attr:`~TypeVar.__bound__` attribute directly, but the method object can be " +"passed to :func:`annotationlib.call_evaluate_function` to evaluate the value " +"in a different format." msgstr "" -#: ../../library/typing.rst:1891 +#: ../../library/typing.rst:1898 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1895 +#: ../../library/typing.rst:1902 msgid "" "For type variables created through :ref:`type parameter syntax `, the constraints are evaluated only when the attribute is accessed, " "not when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1901 +#: ../../library/typing.rst:1908 msgid "" -"An :term:`evaluate function` corresponding to " -"the :attr:`~TypeVar.__constraints__` attribute. When called directly, this " -"method supports only the :attr:`~annotationlib.Format.VALUE` format, which " -"is equivalent to accessing the :attr:`~TypeVar.__constraints__` attribute " -"directly, but the method object can be passed " -"to :func:`annotationlib.call_evaluate_function` to evaluate the value in a " -"different format." +"An :term:`evaluate function` corresponding to the :attr:`~TypeVar." +"__constraints__` attribute. When called directly, this method supports only " +"the :attr:`~annotationlib.Format.VALUE` format, which is equivalent to " +"accessing the :attr:`~TypeVar.__constraints__` attribute directly, but the " +"method object can be passed to :func:`annotationlib.call_evaluate_function` " +"to evaluate the value in a different format." msgstr "" -#: ../../library/typing.rst:1911 +#: ../../library/typing.rst:1918 msgid "" "The default value of the type variable, or :data:`typing.NoDefault` if it " "has no default." msgstr "" -#: ../../library/typing.rst:1918 +#: ../../library/typing.rst:1925 msgid "" -"An :term:`evaluate function` corresponding to " -"the :attr:`~TypeVar.__default__` attribute. When called directly, this " -"method supports only the :attr:`~annotationlib.Format.VALUE` format, which " -"is equivalent to accessing the :attr:`~TypeVar.__default__` attribute " -"directly, but the method object can be passed " -"to :func:`annotationlib.call_evaluate_function` to evaluate the value in a " -"different format." +"An :term:`evaluate function` corresponding to the :attr:`~TypeVar." +"__default__` attribute. When called directly, this method supports only the :" +"attr:`~annotationlib.Format.VALUE` format, which is equivalent to accessing " +"the :attr:`~TypeVar.__default__` attribute directly, but the method object " +"can be passed to :func:`annotationlib.call_evaluate_function` to evaluate " +"the value in a different format." msgstr "" -#: ../../library/typing.rst:1928 +#: ../../library/typing.rst:1935 msgid "" "Return whether or not the type variable has a default value. This is " -"equivalent to checking whether :attr:`__default__` is not " -"the :data:`typing.NoDefault` singleton, except that it does not force " -"evaluation of the :ref:`lazily evaluated ` default value." +"equivalent to checking whether :attr:`__default__` is not the :data:`typing." +"NoDefault` singleton, except that it does not force evaluation of the :ref:" +"`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:1937 +#: ../../library/typing.rst:1944 msgid "" "Type variables can now be declared using the :ref:`type parameter ` syntax introduced by :pep:`695`. The ``infer_variance`` parameter " "was added." msgstr "" -#: ../../library/typing.rst:1943 ../../library/typing.rst:2092 -#: ../../library/typing.rst:2204 +#: ../../library/typing.rst:1950 ../../library/typing.rst:2099 +#: ../../library/typing.rst:2211 msgid "Support for default values was added." msgstr "新增對預設值的支援。" -#: ../../library/typing.rst:1949 +#: ../../library/typing.rst:1956 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1952 +#: ../../library/typing.rst:1959 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" -#: ../../library/typing.rst:1955 +#: ../../library/typing.rst:1962 msgid "" "def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " "T]:\n" @@ -3254,11 +3268,11 @@ msgstr "" "T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1958 +#: ../../library/typing.rst:1965 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" msgstr "" -#: ../../library/typing.rst:1960 +#: ../../library/typing.rst:1967 msgid "" "T = TypeVar(\"T\")\n" "Ts = TypeVarTuple(\"Ts\")\n" @@ -3272,7 +3286,7 @@ msgstr "" "def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1966 +#: ../../library/typing.rst:1973 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -3280,7 +3294,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1971 +#: ../../library/typing.rst:1978 msgid "" "# T is bound to int, Ts is bound to ()\n" "# Return value is (1,), which has type tuple[int]\n" @@ -3300,7 +3314,7 @@ msgid "" "move_first_element_to_last(tup=())" msgstr "" -#: ../../library/typing.rst:1988 +#: ../../library/typing.rst:1995 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -3310,13 +3324,13 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:1996 +#: ../../library/typing.rst:2003 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:1999 +#: ../../library/typing.rst:2006 msgid "" "x: Ts # Not valid\n" "x: tuple[Ts] # Not valid\n" @@ -3326,13 +3340,13 @@ msgstr "" "x: tuple[Ts] # 無效\n" "x: tuple[*Ts] # 正確的做法" -#: ../../library/typing.rst:2003 +#: ../../library/typing.rst:2010 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" -#: ../../library/typing.rst:2006 +#: ../../library/typing.rst:2013 msgid "" "class Array[*Shape]:\n" " def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" @@ -3344,12 +3358,12 @@ msgstr "" " def __abs__(self) -> \"Array[*Shape]\": ...\n" " def get_shape(self) -> tuple[*Shape]: ..." -#: ../../library/typing.rst:2011 +#: ../../library/typing.rst:2018 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:2013 +#: ../../library/typing.rst:2020 msgid "" "class Array[DType, *Shape]: # This is fine\n" " pass\n" @@ -3364,13 +3378,13 @@ msgid "" "int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" msgstr "" -#: ../../library/typing.rst:2027 +#: ../../library/typing.rst:2034 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" -#: ../../library/typing.rst:2030 +#: ../../library/typing.rst:2037 msgid "" "x: tuple[*Ts, *Ts] # Not valid\n" "class Array[*Shape, *Shape]: # Not valid\n" @@ -3380,13 +3394,13 @@ msgstr "" "class Array[*Shape, *Shape]: # 無效\n" " pass" -#: ../../library/typing.rst:2034 +#: ../../library/typing.rst:2041 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:2037 +#: ../../library/typing.rst:2044 msgid "" "def call_soon[*Ts](\n" " callback: Callable[[*Ts], None],\n" @@ -3402,7 +3416,7 @@ msgstr "" " ...\n" " callback(*args)" -#: ../../library/typing.rst:2044 +#: ../../library/typing.rst:2051 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -3411,72 +3425,71 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:2051 +#: ../../library/typing.rst:2058 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:2055 +#: ../../library/typing.rst:2062 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:2059 +#: ../../library/typing.rst:2066 msgid "" "The default value of the type variable tuple, or :data:`typing.NoDefault` if " "it has no default." msgstr "" -#: ../../library/typing.rst:2066 +#: ../../library/typing.rst:2073 msgid "" -"An :term:`evaluate function` corresponding to " -"the :attr:`~TypeVarTuple.__default__` attribute. When called directly, this " -"method supports only the :attr:`~annotationlib.Format.VALUE` format, which " -"is equivalent to accessing the :attr:`~TypeVarTuple.__default__` attribute " -"directly, but the method object can be passed " -"to :func:`annotationlib.call_evaluate_function` to evaluate the value in a " -"different format." +"An :term:`evaluate function` corresponding to the :attr:`~TypeVarTuple." +"__default__` attribute. When called directly, this method supports only the :" +"attr:`~annotationlib.Format.VALUE` format, which is equivalent to accessing " +"the :attr:`~TypeVarTuple.__default__` attribute directly, but the method " +"object can be passed to :func:`annotationlib.call_evaluate_function` to " +"evaluate the value in a different format." msgstr "" -#: ../../library/typing.rst:2076 +#: ../../library/typing.rst:2083 msgid "" "Return whether or not the type variable tuple has a default value. This is " -"equivalent to checking whether :attr:`__default__` is not " -"the :data:`typing.NoDefault` singleton, except that it does not force " -"evaluation of the :ref:`lazily evaluated ` default value." +"equivalent to checking whether :attr:`__default__` is not the :data:`typing." +"NoDefault` singleton, except that it does not force evaluation of the :ref:" +"`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2087 +#: ../../library/typing.rst:2094 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2096 +#: ../../library/typing.rst:2103 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -#: ../../library/typing.rst:2099 +#: ../../library/typing.rst:2106 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" -#: ../../library/typing.rst:2102 +#: ../../library/typing.rst:2109 msgid "type IntFunc[**P] = Callable[P, int]" msgstr "type IntFunc[**P] = Callable[P, int]" -#: ../../library/typing.rst:2104 +#: ../../library/typing.rst:2111 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" -#: ../../library/typing.rst:2107 +#: ../../library/typing.rst:2114 msgid "P = ParamSpec('P')" msgstr "P = ParamSpec('P')" -#: ../../library/typing.rst:2109 +#: ../../library/typing.rst:2116 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -3486,7 +3499,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:2116 +#: ../../library/typing.rst:2123 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -3494,7 +3507,7 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:2121 +#: ../../library/typing.rst:2128 msgid "" "from collections.abc import Callable\n" "import logging\n" @@ -3512,109 +3525,107 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:2136 +#: ../../library/typing.rst:2143 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However " "this causes two problems:" msgstr "" -#: ../../library/typing.rst:2140 +#: ../../library/typing.rst:2147 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: ../../library/typing.rst:2142 +#: ../../library/typing.rst:2149 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: ../../library/typing.rst:2149 +#: ../../library/typing.rst:2156 msgid "" -"Since ``ParamSpec`` captures both positional and keyword parameters, " -"``P.args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " +"Since ``ParamSpec`` captures both positional and keyword parameters, ``P." +"args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " "components. ``P.args`` represents the tuple of positional parameters in a " "given call and should only be used to annotate ``*args``. ``P.kwargs`` " "represents the mapping of keyword parameters to their values in a given " "call, and should be only be used to annotate ``**kwargs``. Both attributes " "require the annotated parameter to be in scope. At runtime, ``P.args`` and " -"``P.kwargs`` are instances respectively of :class:`ParamSpecArgs` " -"and :class:`ParamSpecKwargs`." +"``P.kwargs`` are instances respectively of :class:`ParamSpecArgs` and :class:" +"`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:2161 +#: ../../library/typing.rst:2168 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:2165 +#: ../../library/typing.rst:2172 msgid "" -"The default value of the parameter specification, " -"or :data:`typing.NoDefault` if it has no default." +"The default value of the parameter specification, or :data:`typing." +"NoDefault` if it has no default." msgstr "" -#: ../../library/typing.rst:2172 +#: ../../library/typing.rst:2179 msgid "" -"An :term:`evaluate function` corresponding to " -"the :attr:`~ParamSpec.__default__` attribute. When called directly, this " -"method supports only the :attr:`~annotationlib.Format.VALUE` format, which " -"is equivalent to accessing the :attr:`~ParamSpec.__default__` attribute " -"directly, but the method object can be passed " -"to :func:`annotationlib.call_evaluate_function` to evaluate the value in a " -"different format." +"An :term:`evaluate function` corresponding to the :attr:`~ParamSpec." +"__default__` attribute. When called directly, this method supports only the :" +"attr:`~annotationlib.Format.VALUE` format, which is equivalent to accessing " +"the :attr:`~ParamSpec.__default__` attribute directly, but the method object " +"can be passed to :func:`annotationlib.call_evaluate_function` to evaluate " +"the value in a different format." msgstr "" -#: ../../library/typing.rst:2182 +#: ../../library/typing.rst:2189 msgid "" "Return whether or not the parameter specification has a default value. This " -"is equivalent to checking whether :attr:`__default__` is not " -"the :data:`typing.NoDefault` singleton, except that it does not force " -"evaluation of the :ref:`lazily evaluated ` default value." +"is equivalent to checking whether :attr:`__default__` is not the :data:" +"`typing.NoDefault` singleton, except that it does not force evaluation of " +"the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2189 +#: ../../library/typing.rst:2196 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " -"generic types. The ``bound`` argument is also accepted, similar " -"to :class:`TypeVar`. However the actual semantics of these keywords are yet " -"to be decided." +"generic types. The ``bound`` argument is also accepted, similar to :class:" +"`TypeVar`. However the actual semantics of these keywords are yet to be " +"decided." msgstr "" -#: ../../library/typing.rst:2199 +#: ../../library/typing.rst:2206 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2207 +#: ../../library/typing.rst:2214 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:2213 +#: ../../library/typing.rst:2220 msgid ":data:`Concatenate`" msgstr ":data:`Concatenate`" -#: ../../library/typing.rst:2219 +#: ../../library/typing.rst:2226 msgid "" -"Arguments and keyword arguments attributes of a :class:`ParamSpec`. The " -"``P.args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, " -"and ``P.kwargs`` is an instance of ``ParamSpecKwargs``. They are intended " -"for runtime introspection and have no special meaning to static type " -"checkers." +"Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." +"args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " +"``P.kwargs`` is an instance of ``ParamSpecKwargs``. They are intended for " +"runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:2224 +#: ../../library/typing.rst:2231 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:2227 +#: ../../library/typing.rst:2234 msgid "" ">>> from typing import ParamSpec, get_origin\n" ">>> P = ParamSpec(\"P\")\n" @@ -3630,11 +3641,11 @@ msgstr "" ">>> get_origin(P.kwargs) is P\n" "True" -#: ../../library/typing.rst:2241 +#: ../../library/typing.rst:2248 msgid "The type of type aliases created through the :keyword:`type` statement." msgstr "" -#: ../../library/typing.rst:2245 +#: ../../library/typing.rst:2252 msgid "" ">>> type Alias = int\n" ">>> type(Alias)\n" @@ -3644,11 +3655,11 @@ msgstr "" ">>> type(Alias)\n" "" -#: ../../library/typing.rst:2255 +#: ../../library/typing.rst:2262 msgid "The name of the type alias:" msgstr "" -#: ../../library/typing.rst:2257 +#: ../../library/typing.rst:2264 msgid "" ">>> type Alias = int\n" ">>> Alias.__name__\n" @@ -3658,11 +3669,11 @@ msgstr "" ">>> Alias.__name__\n" "'Alias'" -#: ../../library/typing.rst:2265 +#: ../../library/typing.rst:2272 msgid "The module in which the type alias was defined::" msgstr "" -#: ../../library/typing.rst:2267 +#: ../../library/typing.rst:2274 msgid "" ">>> type Alias = int\n" ">>> Alias.__module__\n" @@ -3672,13 +3683,13 @@ msgstr "" ">>> Alias.__module__\n" "'__main__'" -#: ../../library/typing.rst:2273 +#: ../../library/typing.rst:2280 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" -#: ../../library/typing.rst:2276 +#: ../../library/typing.rst:2283 msgid "" ">>> type ListOrSet[T] = list[T] | set[T]\n" ">>> ListOrSet.__type_params__\n" @@ -3694,14 +3705,14 @@ msgstr "" ">>> NotGeneric.__type_params__\n" "()" -#: ../../library/typing.rst:2287 +#: ../../library/typing.rst:2294 msgid "" "The type alias's value. This is :ref:`lazily evaluated `, " "so names used in the definition of the alias are not resolved until the " "``__value__`` attribute is accessed:" msgstr "" -#: ../../library/typing.rst:2291 +#: ../../library/typing.rst:2298 msgid "" ">>> type Mutually = Recursive\n" ">>> type Recursive = Mutually\n" @@ -3725,17 +3736,17 @@ msgstr "" ">>> Recursive.__value__\n" "Mutually" -#: ../../library/typing.rst:2306 +#: ../../library/typing.rst:2313 msgid "" "An :term:`evaluate function` corresponding to the :attr:`__value__` " -"attribute. When called directly, this method supports only " -"the :attr:`~annotationlib.Format.VALUE` format, which is equivalent to " -"accessing the :attr:`__value__` attribute directly, but the method object " -"can be passed to :func:`annotationlib.call_evaluate_function` to evaluate " -"the value in a different format:" +"attribute. When called directly, this method supports only the :attr:" +"`~annotationlib.Format.VALUE` format, which is equivalent to accessing the :" +"attr:`__value__` attribute directly, but the method object can be passed to :" +"func:`annotationlib.call_evaluate_function` to evaluate the value in a " +"different format:" msgstr "" -#: ../../library/typing.rst:2312 +#: ../../library/typing.rst:2319 msgid "" ">>> type Alias = undefined\n" ">>> Alias.__value__\n" @@ -3751,17 +3762,17 @@ msgid "" "ForwardRef('undefined')" msgstr "" -#: ../../library/typing.rst:2330 +#: ../../library/typing.rst:2337 msgid "Unpacking" msgstr "" -#: ../../library/typing.rst:2331 +#: ../../library/typing.rst:2338 msgid "" "Type aliases support star unpacking using the ``*Alias`` syntax. This is " "equivalent to using ``Unpack[Alias]`` directly:" msgstr "" -#: ../../library/typing.rst:2334 +#: ../../library/typing.rst:2341 msgid "" ">>> type Alias = tuple[int, str]\n" ">>> type Unpacked = tuple[bool, *Alias]\n" @@ -3769,27 +3780,27 @@ msgid "" "tuple[bool, typing.Unpack[Alias]]" msgstr "" -#: ../../library/typing.rst:2345 +#: ../../library/typing.rst:2352 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:2347 +#: ../../library/typing.rst:2354 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" -#: ../../library/typing.rst:2353 +#: ../../library/typing.rst:2360 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:2355 ../../library/typing.rst:2451 -#: ../../library/typing.rst:3555 +#: ../../library/typing.rst:2362 ../../library/typing.rst:2458 +#: ../../library/typing.rst:3562 msgid "Usage::" msgstr "用法: ::" -#: ../../library/typing.rst:2357 +#: ../../library/typing.rst:2364 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3799,20 +3810,20 @@ msgstr "" " name: str\n" " id: int" -#: ../../library/typing.rst:2361 +#: ../../library/typing.rst:2368 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../library/typing.rst:2363 +#: ../../library/typing.rst:2370 msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" msgstr "Employee = collections.namedtuple('Employee', ['name', 'id'])" -#: ../../library/typing.rst:2365 +#: ../../library/typing.rst:2372 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:2367 +#: ../../library/typing.rst:2374 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3828,12 +3839,12 @@ msgstr "" "employee = Employee('Guido')\n" "assert employee.id == 3" -#: ../../library/typing.rst:2374 +#: ../../library/typing.rst:2381 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:2376 +#: ../../library/typing.rst:2383 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -3842,11 +3853,11 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:2382 +#: ../../library/typing.rst:2389 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:2384 +#: ../../library/typing.rst:2391 msgid "" "class Employee(NamedTuple):\n" " \"\"\"Represents an employee.\"\"\"\n" @@ -3857,11 +3868,11 @@ msgid "" " return f''" msgstr "" -#: ../../library/typing.rst:2392 +#: ../../library/typing.rst:2399 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:2394 +#: ../../library/typing.rst:2401 msgid "" "class Group[T](NamedTuple):\n" " key: T\n" @@ -3871,11 +3882,11 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2398 +#: ../../library/typing.rst:2405 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:2400 +#: ../../library/typing.rst:2407 msgid "" "# For creating a generic NamedTuple on Python 3.11\n" "T = TypeVar(\"T\")\n" @@ -3888,45 +3899,45 @@ msgid "" "Employee = NamedTuple('Employee', [('name', str), ('id', int)])" msgstr "" -#: ../../library/typing.rst:2410 +#: ../../library/typing.rst:2417 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:2413 +#: ../../library/typing.rst:2420 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:2416 +#: ../../library/typing.rst:2423 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:2420 +#: ../../library/typing.rst:2427 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:2424 +#: ../../library/typing.rst:2431 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:2427 +#: ../../library/typing.rst:2434 msgid "" "Using :func:`super` (and the ``__class__`` :term:`closure variable`) in " -"methods of ``NamedTuple`` subclasses is unsupported and causes " -"a :class:`TypeError`." +"methods of ``NamedTuple`` subclasses is unsupported and causes a :class:" +"`TypeError`." msgstr "" -#: ../../library/typing.rst:2431 +#: ../../library/typing.rst:2438 msgid "" "The undocumented keyword argument syntax for creating NamedTuple classes " "(``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be disallowed " "in 3.15. Use the class-based syntax or the functional syntax instead." msgstr "" -#: ../../library/typing.rst:2436 +#: ../../library/typing.rst:2443 msgid "" "When using the functional syntax to create a NamedTuple class, failing to " "pass a value to the 'fields' parameter (``NT = NamedTuple(\"NT\")``) is " @@ -3936,48 +3947,48 @@ msgid "" "NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." msgstr "" -#: ../../library/typing.rst:2446 +#: ../../library/typing.rst:2453 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:2448 +#: ../../library/typing.rst:2455 msgid "" "A ``NewType`` is considered a distinct type by a typechecker. At runtime, " "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: ../../library/typing.rst:2453 +#: ../../library/typing.rst:2460 msgid "" "UserId = NewType('UserId', int) # Declare the NewType \"UserId\"\n" "first_user = UserId(1) # \"UserId\" returns the argument unchanged at " "runtime" msgstr "" -#: ../../library/typing.rst:2458 +#: ../../library/typing.rst:2465 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:2462 +#: ../../library/typing.rst:2469 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:2466 +#: ../../library/typing.rst:2473 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:2470 +#: ../../library/typing.rst:2477 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:2475 +#: ../../library/typing.rst:2482 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:2477 +#: ../../library/typing.rst:2484 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:2479 +#: ../../library/typing.rst:2486 msgid "" "class Proto(Protocol):\n" " def meth(self) -> int:\n" @@ -3987,13 +3998,13 @@ msgstr "" " def meth(self) -> int:\n" " ..." -#: ../../library/typing.rst:2483 +#: ../../library/typing.rst:2490 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:2486 +#: ../../library/typing.rst:2493 msgid "" "class C:\n" " def meth(self) -> int:\n" @@ -4005,20 +4016,20 @@ msgid "" "func(C()) # Passes static type check" msgstr "" -#: ../../library/typing.rst:2495 +#: ../../library/typing.rst:2502 msgid "" -"See :pep:`544` for more details. Protocol classes decorated " -"with :func:`runtime_checkable` (described later) act as simple-minded " -"runtime protocols that check only the presence of given attributes, ignoring " -"their type signatures. Protocol classes without this decorator cannot be " -"used as the second argument to :func:`isinstance` or :func:`issubclass`." +"See :pep:`544` for more details. Protocol classes decorated with :func:" +"`runtime_checkable` (described later) act as simple-minded runtime protocols " +"that check only the presence of given attributes, ignoring their type " +"signatures. Protocol classes without this decorator cannot be used as the " +"second argument to :func:`isinstance` or :func:`issubclass`." msgstr "" -#: ../../library/typing.rst:2501 +#: ../../library/typing.rst:2508 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:2503 +#: ../../library/typing.rst:2510 msgid "" "class GenProto[T](Protocol):\n" " def meth(self) -> T:\n" @@ -4028,13 +4039,13 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2507 +#: ../../library/typing.rst:2514 msgid "" "In code that needs to be compatible with Python 3.11 or older, generic " "Protocols can be written as follows::" msgstr "" -#: ../../library/typing.rst:2510 +#: ../../library/typing.rst:2517 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -4048,19 +4059,19 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2520 +#: ../../library/typing.rst:2527 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:2522 +#: ../../library/typing.rst:2529 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This allows a simple-minded structural check, very similar to \"one trick " -"ponies\" in :mod:`collections.abc` such " -"as :class:`~collections.abc.Iterable`. For example::" +"ponies\" in :mod:`collections.abc` such as :class:`~collections.abc." +"Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:2526 +#: ../../library/typing.rst:2533 msgid "" "@runtime_checkable\n" "class Closable(Protocol):\n" @@ -4088,23 +4099,23 @@ msgstr "" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" -#: ../../library/typing.rst:2539 +#: ../../library/typing.rst:2546 msgid "" "This decorator raises :exc:`TypeError` when applied to a non-protocol class." msgstr "" -#: ../../library/typing.rst:2543 +#: ../../library/typing.rst:2550 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " -"methods or attributes, not their type signatures or types. For " -"example, :class:`ssl.SSLObject` is a class, therefore it passes " -"an :func:`issubclass` check against :ref:`Callable `. " -"However, the ``ssl.SSLObject.__init__`` method exists only to raise " -"a :exc:`TypeError` with a more informative message, therefore making it " -"impossible to call (instantiate) :class:`ssl.SSLObject`." +"methods or attributes, not their type signatures or types. For example, :" +"class:`ssl.SSLObject` is a class, therefore it passes an :func:`issubclass` " +"check against :ref:`Callable `. However, the ``ssl." +"SSLObject.__init__`` method exists only to raise a :exc:`TypeError` with a " +"more informative message, therefore making it impossible to call " +"(instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:2554 +#: ../../library/typing.rst:2561 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -4112,7 +4123,7 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:2562 +#: ../../library/typing.rst:2569 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -4122,23 +4133,22 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" -#: ../../library/typing.rst:2571 +#: ../../library/typing.rst:2578 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " "onto a runtime-checkable protocol will still work, but will have no impact " -"on :func:`isinstance` checks comparing objects to the protocol. " -"See :ref:`What's new in Python 3.12 ` for more " -"details." +"on :func:`isinstance` checks comparing objects to the protocol. See :ref:" +"`What's new in Python 3.12 ` for more details." msgstr "" -#: ../../library/typing.rst:2582 +#: ../../library/typing.rst:2589 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:2585 +#: ../../library/typing.rst:2592 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -4146,7 +4156,7 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:2591 +#: ../../library/typing.rst:2598 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -4159,25 +4169,25 @@ msgid "" "assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" -#: ../../library/typing.rst:2601 +#: ../../library/typing.rst:2608 msgid "" "An alternative way to create a ``TypedDict`` is by using function-call " "syntax. The second argument must be a literal :class:`dict`::" msgstr "" -#: ../../library/typing.rst:2604 +#: ../../library/typing.rst:2611 msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" msgstr "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -#: ../../library/typing.rst:2606 +#: ../../library/typing.rst:2613 msgid "" -"This functional syntax allows defining keys which are not " -"valid :ref:`identifiers `, for example because they are " -"keywords or contain hyphens, or when key names must not be :ref:`mangled " -"` like regular private names::" +"This functional syntax allows defining keys which are not valid :ref:" +"`identifiers `, for example because they are keywords or " +"contain hyphens, or when key names must not be :ref:`mangled ` like regular private names::" msgstr "" -#: ../../library/typing.rst:2611 +#: ../../library/typing.rst:2618 msgid "" "# raises SyntaxError\n" "class Point2D(TypedDict):\n" @@ -4192,13 +4202,13 @@ msgid "" "Definition = TypedDict('Definition', {'__schema': str}) # not mangled" msgstr "" -#: ../../library/typing.rst:2623 +#: ../../library/typing.rst:2630 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" -#: ../../library/typing.rst:2626 +#: ../../library/typing.rst:2633 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -4218,19 +4228,19 @@ msgstr "" "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': " "NotRequired[str]})" -#: ../../library/typing.rst:2634 +#: ../../library/typing.rst:2641 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2637 +#: ../../library/typing.rst:2644 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2640 +#: ../../library/typing.rst:2647 msgid "" "class Point2D(TypedDict, total=False):\n" " x: int\n" @@ -4246,7 +4256,7 @@ msgstr "" "# 替代語法\n" "Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" -#: ../../library/typing.rst:2647 +#: ../../library/typing.rst:2654 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -4254,13 +4264,13 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2652 +#: ../../library/typing.rst:2659 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2655 +#: ../../library/typing.rst:2662 msgid "" "class Point2D(TypedDict, total=False):\n" " x: Required[int]\n" @@ -4286,13 +4296,13 @@ msgstr "" " 'label': str\n" "}, total=False)" -#: ../../library/typing.rst:2667 +#: ../../library/typing.rst:2674 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:2671 +#: ../../library/typing.rst:2678 msgid "" "class Point3D(Point2D):\n" " z: int" @@ -4300,13 +4310,13 @@ msgstr "" "class Point3D(Point2D):\n" " z: int" -#: ../../library/typing.rst:2674 +#: ../../library/typing.rst:2681 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2677 +#: ../../library/typing.rst:2684 msgid "" "class Point3D(TypedDict):\n" " x: int\n" @@ -4318,13 +4328,13 @@ msgstr "" " y: int\n" " z: int" -#: ../../library/typing.rst:2682 +#: ../../library/typing.rst:2689 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2685 +#: ../../library/typing.rst:2692 msgid "" "class X(TypedDict):\n" " x: int\n" @@ -4350,11 +4360,11 @@ msgstr "" "\n" "class XZ(X, Z): pass # 引發 TypeError" -#: ../../library/typing.rst:2697 +#: ../../library/typing.rst:2704 msgid "A ``TypedDict`` can be generic::" msgstr "" -#: ../../library/typing.rst:2699 +#: ../../library/typing.rst:2706 msgid "" "class Group[T](TypedDict):\n" " key: T\n" @@ -4364,13 +4374,13 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2703 +#: ../../library/typing.rst:2710 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" -#: ../../library/typing.rst:2706 +#: ../../library/typing.rst:2713 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -4384,20 +4394,19 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2714 +#: ../../library/typing.rst:2721 msgid "" -"A ``TypedDict`` can be introspected via annotations dicts " -"(see :ref:`annotations-howto` for more information on annotations best " -"practices), :attr:`__total__`, :attr:`__required_keys__`, " -"and :attr:`__optional_keys__`." +"A ``TypedDict`` can be introspected via annotations dicts (see :ref:" +"`annotations-howto` for more information on annotations best practices), :" +"attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:2720 +#: ../../library/typing.rst:2727 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2723 +#: ../../library/typing.rst:2730 msgid "" ">>> from typing import TypedDict\n" ">>> class Point2D(TypedDict): pass\n" @@ -4421,7 +4430,7 @@ msgstr "" ">>> Point3D.__total__\n" "True" -#: ../../library/typing.rst:2736 +#: ../../library/typing.rst:2743 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " @@ -4432,21 +4441,21 @@ msgid "" "introspection." msgstr "" -#: ../../library/typing.rst:2749 +#: ../../library/typing.rst:2756 msgid "" -"``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` " -"return :class:`frozenset` objects containing required and non-required keys, " +"``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" +"class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2752 +#: ../../library/typing.rst:2759 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" -#: ../../library/typing.rst:2755 +#: ../../library/typing.rst:2762 msgid "" "For backwards compatibility with Python 3.10 and below, it is also possible " "to use inheritance to declare both required and non-required keys in the " @@ -4455,7 +4464,7 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2762 +#: ../../library/typing.rst:2769 msgid "" ">>> class Point2D(TypedDict, total=False):\n" "... x: int\n" @@ -4481,7 +4490,7 @@ msgstr "" ">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" "True" -#: ../../library/typing.rst:2780 +#: ../../library/typing.rst:2787 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -4490,50 +4499,50 @@ msgid "" "attributes may be incorrect." msgstr "" -#: ../../library/typing.rst:2786 +#: ../../library/typing.rst:2793 msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" msgstr "" -#: ../../library/typing.rst:2790 +#: ../../library/typing.rst:2797 msgid "" "A :class:`frozenset` containing the names of all read-only keys. Keys are " "read-only if they carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2797 +#: ../../library/typing.rst:2804 msgid "" "A :class:`frozenset` containing the names of all mutable keys. Keys are " "mutable if they do not carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2802 +#: ../../library/typing.rst:2809 msgid "" -"See the `TypedDict `_ section in the typing documentation for more " -"examples and detailed rules." +"See the `TypedDict `_ section in the typing documentation for more examples and " +"detailed rules." msgstr "" -#: ../../library/typing.rst:2806 +#: ../../library/typing.rst:2813 msgid "" -"Added support for marking individual keys as :data:`Required` " -"or :data:`NotRequired`. See :pep:`655`." +"Added support for marking individual keys as :data:`Required` or :data:" +"`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2810 +#: ../../library/typing.rst:2817 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2813 +#: ../../library/typing.rst:2820 msgid "" "Removed support for the keyword-argument method of creating ``TypedDict``\\ " "s." msgstr "" -#: ../../library/typing.rst:2816 +#: ../../library/typing.rst:2823 msgid "Support for the :data:`ReadOnly` qualifier was added." msgstr "" -#: ../../library/typing.rst:2819 +#: ../../library/typing.rst:2826 msgid "" "When using the functional syntax to create a TypedDict class, failing to " "pass a value to the 'fields' parameter (``TD = TypedDict(\"TD\")``) is " @@ -4543,53 +4552,53 @@ msgid "" "TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." msgstr "" -#: ../../library/typing.rst:2828 +#: ../../library/typing.rst:2835 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2830 +#: ../../library/typing.rst:2837 msgid "" "The following protocols are provided by the :mod:`!typing` module. All are " "decorated with :func:`@runtime_checkable `." msgstr "" -#: ../../library/typing.rst:2835 +#: ../../library/typing.rst:2842 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2840 +#: ../../library/typing.rst:2847 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2844 +#: ../../library/typing.rst:2851 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2848 +#: ../../library/typing.rst:2855 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2852 +#: ../../library/typing.rst:2859 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2858 +#: ../../library/typing.rst:2865 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2862 +#: ../../library/typing.rst:2869 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2868 +#: ../../library/typing.rst:2875 msgid "ABCs and Protocols for working with I/O" msgstr "" -#: ../../library/typing.rst:2874 +#: ../../library/typing.rst:2881 msgid "" "Generic class ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " @@ -4597,80 +4606,80 @@ msgid "" "interface is fairly broad." msgstr "" -#: ../../library/typing.rst:2880 +#: ../../library/typing.rst:2887 msgid "" "The protocols :class:`io.Reader` and :class:`io.Writer` offer a simpler " "alternative for argument types, when only the ``read()`` or ``write()`` " "methods are accessed, respectively::" msgstr "" -#: ../../library/typing.rst:2884 +#: ../../library/typing.rst:2891 msgid "" "def read_and_write(reader: Reader[str], writer: Writer[bytes]):\n" " data = reader.read()\n" " writer.write(data.encode())" msgstr "" -#: ../../library/typing.rst:2888 +#: ../../library/typing.rst:2895 msgid "" "Also consider using :class:`collections.abc.Iterable` for iterating over the " "lines of an input stream::" msgstr "" -#: ../../library/typing.rst:2891 +#: ../../library/typing.rst:2898 msgid "" "def read_config(stream: Iterable[str]):\n" " for line in stream:\n" " ..." msgstr "" -#: ../../library/typing.rst:2896 +#: ../../library/typing.rst:2903 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2900 +#: ../../library/typing.rst:2907 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2902 +#: ../../library/typing.rst:2909 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: ../../library/typing.rst:2909 +#: ../../library/typing.rst:2916 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2911 +#: ../../library/typing.rst:2918 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" -#: ../../library/typing.rst:2914 +#: ../../library/typing.rst:2921 msgid "" "When a static type checker encounters a call to ``assert_type()``, it emits " "an error if the value is not of the specified type::" msgstr "" -#: ../../library/typing.rst:2917 +#: ../../library/typing.rst:2924 msgid "" "def greet(name: str) -> None:\n" " assert_type(name, str) # OK, inferred type of `name` is `str`\n" " assert_type(name, int) # type checker error" msgstr "" -#: ../../library/typing.rst:2921 +#: ../../library/typing.rst:2928 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" -#: ../../library/typing.rst:2924 +#: ../../library/typing.rst:2931 msgid "" "def complex_function(arg: object):\n" " # Do some complex type-narrowing logic,\n" @@ -4680,16 +4689,16 @@ msgid "" " assert_type(arg, int)" msgstr "" -#: ../../library/typing.rst:2935 +#: ../../library/typing.rst:2942 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2937 +#: ../../library/typing.rst:2944 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:2939 +#: ../../library/typing.rst:2946 msgid "" "def int_or_str(arg: int | str) -> None:\n" " match arg:\n" @@ -4709,14 +4718,14 @@ msgstr "" " case _ as unreachable:\n" " assert_never(unreachable)" -#: ../../library/typing.rst:2948 +#: ../../library/typing.rst:2955 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" -#: ../../library/typing.rst:2953 +#: ../../library/typing.rst:2960 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -4726,47 +4735,47 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2961 +#: ../../library/typing.rst:2968 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2964 +#: ../../library/typing.rst:2971 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about exhaustiveness " "checking with static typing." msgstr "" -#: ../../library/typing.rst:2972 +#: ../../library/typing.rst:2979 msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -#: ../../library/typing.rst:2974 +#: ../../library/typing.rst:2981 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the inferred type of the argument. For example::" msgstr "" -#: ../../library/typing.rst:2977 +#: ../../library/typing.rst:2984 msgid "" "x: int = 1\n" "reveal_type(x) # Revealed type is \"builtins.int\"" msgstr "" -#: ../../library/typing.rst:2980 +#: ../../library/typing.rst:2987 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2983 +#: ../../library/typing.rst:2990 msgid "" -"At runtime, this function prints the runtime type of its argument " -"to :data:`sys.stderr` and returns the argument unchanged (allowing the call " -"to be used within an expression)::" +"At runtime, this function prints the runtime type of its argument to :data:" +"`sys.stderr` and returns the argument unchanged (allowing the call to be " +"used within an expression)::" msgstr "" -#: ../../library/typing.rst:2987 +#: ../../library/typing.rst:2994 msgid "" "x = reveal_type(1) # prints \"Runtime type is int\"\n" "print(x) # prints \"1\"" @@ -4774,13 +4783,13 @@ msgstr "" "x = reveal_type(1) # 印出 \"Runtime type is int\"\n" "print(x) # 印出 \"1\"" -#: ../../library/typing.rst:2990 +#: ../../library/typing.rst:2997 msgid "" "Note that the runtime type may be different from (more or less specific " "than) the type statically inferred by a type checker." msgstr "" -#: ../../library/typing.rst:2993 +#: ../../library/typing.rst:3000 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " @@ -4788,13 +4797,13 @@ msgid "" "clearly." msgstr "" -#: ../../library/typing.rst:3004 +#: ../../library/typing.rst:3011 msgid "" -"Decorator to mark an object as providing :func:`dataclass " -"`-like behavior." +"Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" -#: ../../library/typing.rst:3007 +#: ../../library/typing.rst:3014 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -4803,11 +4812,11 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:3014 +#: ../../library/typing.rst:3021 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:3016 +#: ../../library/typing.rst:3023 msgid "" "@dataclass_transform()\n" "def create_model[T](cls: type[T]) -> type[T]:\n" @@ -4829,11 +4838,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:3028 +#: ../../library/typing.rst:3035 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:3030 +#: ../../library/typing.rst:3037 msgid "" "@dataclass_transform()\n" "class ModelBase: ...\n" @@ -4849,11 +4858,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:3037 +#: ../../library/typing.rst:3044 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:3039 +#: ../../library/typing.rst:3046 msgid "" "@dataclass_transform()\n" "class ModelMeta(type): ...\n" @@ -4873,15 +4882,15 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:3048 +#: ../../library/typing.rst:3055 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " -"similarly to classes created with :func:`@dataclasses.dataclass " -"`. For example, type checkers will assume these " -"classes have ``__init__`` methods that accept ``id`` and ``name``." +"similarly to classes created with :func:`@dataclasses.dataclass `. For example, type checkers will assume these classes have " +"``__init__`` methods that accept ``id`` and ``name``." msgstr "" -#: ../../library/typing.rst:3054 +#: ../../library/typing.rst:3061 msgid "" "The decorated class, metaclass, or function may accept the following bool " "arguments which type checkers will assume have the same effect as they would " @@ -4891,7 +4900,7 @@ msgid "" "arguments (``True`` or ``False``) to be statically evaluated." msgstr "" -#: ../../library/typing.rst:3062 +#: ../../library/typing.rst:3069 msgid "" "The arguments to the ``dataclass_transform`` decorator can be used to " "customize the default behaviors of the decorated class, metaclass, or " @@ -4902,90 +4911,90 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/typing.rst:3066 +#: ../../library/typing.rst:3073 msgid "" "Indicates whether the ``eq`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``True``." msgstr "" -#: ../../library/typing.rst:3071 +#: ../../library/typing.rst:3078 msgid "" "Indicates whether the ``order`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:3076 +#: ../../library/typing.rst:3083 msgid "" "Indicates whether the ``kw_only`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:3081 +#: ../../library/typing.rst:3088 msgid "" "Indicates whether the ``frozen`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``. .. " "versionadded:: 3.12" msgstr "" -#: ../../library/typing.rst:3082 +#: ../../library/typing.rst:3089 msgid "" "Indicates whether the ``frozen`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:3088 +#: ../../library/typing.rst:3095 msgid "" "Specifies a static list of supported classes or functions that describe " "fields, similar to :func:`dataclasses.field`. Defaults to ``()``." msgstr "" -#: ../../library/typing.rst:3094 +#: ../../library/typing.rst:3101 msgid "" "Arbitrary other keyword arguments are accepted in order to allow for " "possible future extensions." msgstr "" -#: ../../library/typing.rst:3098 +#: ../../library/typing.rst:3105 msgid "" "Type checkers recognize the following optional parameters on field " "specifiers:" msgstr "" -#: ../../library/typing.rst:3101 +#: ../../library/typing.rst:3108 msgid "**Recognised parameters for field specifiers**" msgstr "" -#: ../../library/typing.rst:3105 +#: ../../library/typing.rst:3112 msgid "Parameter name" msgstr "" -#: ../../library/typing.rst:3106 +#: ../../library/typing.rst:3113 msgid "Description" msgstr "" -#: ../../library/typing.rst:3107 +#: ../../library/typing.rst:3114 msgid "``init``" msgstr "``init``" -#: ../../library/typing.rst:3108 +#: ../../library/typing.rst:3115 msgid "" "Indicates whether the field should be included in the synthesized " "``__init__`` method. If unspecified, ``init`` defaults to ``True``." msgstr "" -#: ../../library/typing.rst:3111 +#: ../../library/typing.rst:3118 msgid "``default``" msgstr "``default``" -#: ../../library/typing.rst:3112 +#: ../../library/typing.rst:3119 msgid "Provides the default value for the field." msgstr "" -#: ../../library/typing.rst:3113 +#: ../../library/typing.rst:3120 msgid "``default_factory``" msgstr "``default_factory``" -#: ../../library/typing.rst:3114 +#: ../../library/typing.rst:3121 msgid "" "Provides a runtime callback that returns the default value for the field. If " "neither ``default`` nor ``default_factory`` are specified, the field is " @@ -4993,19 +5002,19 @@ msgid "" "is instantiated." msgstr "" -#: ../../library/typing.rst:3119 +#: ../../library/typing.rst:3126 msgid "``factory``" msgstr "``factory``" -#: ../../library/typing.rst:3120 +#: ../../library/typing.rst:3127 msgid "An alias for the ``default_factory`` parameter on field specifiers." msgstr "" -#: ../../library/typing.rst:3121 +#: ../../library/typing.rst:3128 msgid "``kw_only``" msgstr "``kw_only``" -#: ../../library/typing.rst:3122 +#: ../../library/typing.rst:3129 msgid "" "Indicates whether the field should be marked as keyword-only. If ``True``, " "the field will be keyword-only. If ``False``, it will not be keyword-only. " @@ -5015,32 +5024,32 @@ msgid "" "will be used." msgstr "" -#: ../../library/typing.rst:3128 +#: ../../library/typing.rst:3135 msgid "``alias``" msgstr "``alias``" -#: ../../library/typing.rst:3129 +#: ../../library/typing.rst:3136 msgid "" "Provides an alternative name for the field. This alternative name is used in " "the synthesized ``__init__`` method." msgstr "" -#: ../../library/typing.rst:3132 +#: ../../library/typing.rst:3139 msgid "" "At runtime, this decorator records its arguments in the " "``__dataclass_transform__`` attribute on the decorated object. It has no " "other runtime effect." msgstr "" -#: ../../library/typing.rst:3136 +#: ../../library/typing.rst:3143 msgid "See :pep:`681` for more details." msgstr "更多細節請見 :pep:`681`。" -#: ../../library/typing.rst:3144 +#: ../../library/typing.rst:3151 msgid "Decorator for creating overloaded functions and methods." msgstr "" -#: ../../library/typing.rst:3146 +#: ../../library/typing.rst:3153 msgid "" "The ``@overload`` decorator allows describing functions and methods that " "support multiple different combinations of argument types. A series of " @@ -5048,23 +5057,23 @@ msgid "" "``@overload``-decorated definition (for the same function/method)." msgstr "" -#: ../../library/typing.rst:3151 +#: ../../library/typing.rst:3158 msgid "" "``@overload``-decorated definitions are for the benefit of the type checker " "only, since they will be overwritten by the non-``@overload``-decorated " "definition. The non-``@overload``-decorated definition, meanwhile, will be " "used at runtime but should be ignored by a type checker. At runtime, " -"calling an ``@overload``-decorated function directly will " -"raise :exc:`NotImplementedError`." +"calling an ``@overload``-decorated function directly will raise :exc:" +"`NotImplementedError`." msgstr "" -#: ../../library/typing.rst:3159 +#: ../../library/typing.rst:3166 msgid "" "An example of overload that gives a more precise type than can be expressed " "using a union or a type variable:" msgstr "" -#: ../../library/typing.rst:3162 +#: ../../library/typing.rst:3169 msgid "" "@overload\n" "def process(response: None) -> None:\n" @@ -5090,24 +5099,24 @@ msgstr "" "def process(response):\n" " ... # 實際的實作在這邊" -#: ../../library/typing.rst:3176 +#: ../../library/typing.rst:3183 msgid "" "See :pep:`484` for more details and comparison with other typing semantics." msgstr "" -#: ../../library/typing.rst:3178 +#: ../../library/typing.rst:3185 msgid "" -"Overloaded functions can now be introspected at runtime " -"using :func:`get_overloads`." +"Overloaded functions can now be introspected at runtime using :func:" +"`get_overloads`." msgstr "" -#: ../../library/typing.rst:3185 +#: ../../library/typing.rst:3192 msgid "" "Return a sequence of :func:`@overload `-decorated definitions for " "*func*." msgstr "" -#: ../../library/typing.rst:3188 +#: ../../library/typing.rst:3195 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -5117,32 +5126,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:3195 +#: ../../library/typing.rst:3202 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:3203 +#: ../../library/typing.rst:3210 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:3205 +#: ../../library/typing.rst:3212 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:3212 +#: ../../library/typing.rst:3219 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:3214 +#: ../../library/typing.rst:3221 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" -#: ../../library/typing.rst:3220 +#: ../../library/typing.rst:3227 msgid "" "class Base:\n" " @final\n" @@ -5172,7 +5181,7 @@ msgstr "" "class Other(Leaf): # 型別檢查器回報的錯誤\n" " ..." -#: ../../library/typing.rst:3239 +#: ../../library/typing.rst:3246 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -5182,11 +5191,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:3250 +#: ../../library/typing.rst:3257 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:3252 +#: ../../library/typing.rst:3259 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " @@ -5194,40 +5203,40 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:3258 +#: ../../library/typing.rst:3265 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:3262 +#: ../../library/typing.rst:3269 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:3264 +#: ../../library/typing.rst:3271 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:3267 +#: ../../library/typing.rst:3274 msgid "" "No type checker ever added support for ``@no_type_check_decorator``. It is " "therefore deprecated, and will be removed in Python 3.15." msgstr "" -#: ../../library/typing.rst:3273 +#: ../../library/typing.rst:3280 msgid "" "Decorator to indicate that a method in a subclass is intended to override a " "method or attribute in a superclass." msgstr "" -#: ../../library/typing.rst:3276 +#: ../../library/typing.rst:3283 msgid "" "Type checkers should emit an error if a method decorated with ``@override`` " "does not, in fact, override anything. This helps prevent bugs that may occur " "when a base class is changed without an equivalent change to a child class." msgstr "" -#: ../../library/typing.rst:3283 +#: ../../library/typing.rst:3290 msgid "" "class Base:\n" " def log_status(self) -> None:\n" @@ -5243,11 +5252,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:3298 +#: ../../library/typing.rst:3305 msgid "There is no runtime checking of this property." msgstr "" -#: ../../library/typing.rst:3300 +#: ../../library/typing.rst:3307 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -5257,22 +5266,22 @@ msgid "" "without raising an exception." msgstr "" -#: ../../library/typing.rst:3307 +#: ../../library/typing.rst:3314 msgid "See :pep:`698` for more details." msgstr "更多細節請見 :pep:`698`。" -#: ../../library/typing.rst:3314 +#: ../../library/typing.rst:3321 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:3316 +#: ../../library/typing.rst:3323 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: ../../library/typing.rst:3320 +#: ../../library/typing.rst:3327 msgid "" "@type_check_only\n" "class Response: # private or not available at runtime\n" @@ -5282,29 +5291,29 @@ msgid "" "def fetch_response() -> Response: ..." msgstr "" -#: ../../library/typing.rst:3327 +#: ../../library/typing.rst:3334 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:3331 +#: ../../library/typing.rst:3338 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:3335 +#: ../../library/typing.rst:3342 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:3338 +#: ../../library/typing.rst:3345 msgid "" "This is often the same as ``obj.__annotations__``, but this function makes " "the following changes to the annotations dictionary:" msgstr "" -#: ../../library/typing.rst:3341 +#: ../../library/typing.rst:3348 msgid "" "Forward references encoded as string literals or :class:`ForwardRef` objects " "are handled by evaluating them in *globalns*, *localns*, and (where " @@ -5313,17 +5322,17 @@ msgid "" "inferred from *obj*." msgstr "" -#: ../../library/typing.rst:3346 +#: ../../library/typing.rst:3353 msgid "``None`` is replaced with :class:`types.NoneType`." msgstr "" -#: ../../library/typing.rst:3347 +#: ../../library/typing.rst:3354 msgid "" "If :func:`@no_type_check ` has been applied to *obj*, an " "empty dictionary is returned." msgstr "" -#: ../../library/typing.rst:3349 +#: ../../library/typing.rst:3356 msgid "" "If *obj* is a class ``C``, the function returns a dictionary that merges " "annotations from ``C``'s base classes with those on ``C`` directly. This is " @@ -5333,68 +5342,68 @@ msgid "" "annotations on classes appearing later in the method resolution order." msgstr "" -#: ../../library/typing.rst:3356 +#: ../../library/typing.rst:3363 msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]`` " -"with ``T``, unless *include_extras* is set to ``True`` " -"(see :class:`Annotated` for more information)." +"with ``T``, unless *include_extras* is set to ``True`` (see :class:" +"`Annotated` for more information)." msgstr "" -#: ../../library/typing.rst:3360 +#: ../../library/typing.rst:3367 msgid "" "See also :func:`annotationlib.get_annotations`, a lower-level function that " "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:3365 ../../library/typing.rst:3516 +#: ../../library/typing.rst:3372 ../../library/typing.rst:3523 msgid "" -"This function may execute arbitrary code contained in annotations. " -"See :ref:`annotationlib-security` for more information." +"This function may execute arbitrary code contained in annotations. See :ref:" +"`annotationlib-security` for more information." msgstr "" -#: ../../library/typing.rst:3370 +#: ../../library/typing.rst:3377 msgid "" "If any forward references in the annotations of *obj* are not resolvable or " -"are not valid Python code, this function will raise an exception such " -"as :exc:`NameError`. For example, this can happen with imported :ref:`type " +"are not valid Python code, this function will raise an exception such as :" +"exc:`NameError`. For example, this can happen with imported :ref:`type " "aliases ` that include forward references, or with names " "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:3376 +#: ../../library/typing.rst:3383 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." msgstr "" -"新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請" -"見 :data:`Annotated` 的文件。" +"新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" +"`Annotated` 的文件。" -#: ../../library/typing.rst:3380 +#: ../../library/typing.rst:3387 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:3387 +#: ../../library/typing.rst:3394 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3390 +#: ../../library/typing.rst:3397 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " -"it will be normalized to the original class. If ``X`` is an instance " -"of :class:`ParamSpecArgs` or :class:`ParamSpecKwargs`, return the " -"underlying :class:`ParamSpec`. Return ``None`` for unsupported objects." +"it will be normalized to the original class. If ``X`` is an instance of :" +"class:`ParamSpecArgs` or :class:`ParamSpecKwargs`, return the underlying :" +"class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3396 ../../library/typing.rst:3420 +#: ../../library/typing.rst:3403 ../../library/typing.rst:3427 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3398 +#: ../../library/typing.rst:3405 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" @@ -5412,13 +5421,13 @@ msgstr "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3412 +#: ../../library/typing.rst:3419 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: ../../library/typing.rst:3415 +#: ../../library/typing.rst:3422 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -5426,7 +5435,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3422 +#: ../../library/typing.rst:3429 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -5436,11 +5445,11 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3432 +#: ../../library/typing.rst:3439 msgid "Return the set of members defined in a :class:`Protocol`." msgstr "" -#: ../../library/typing.rst:3434 +#: ../../library/typing.rst:3441 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -5456,15 +5465,15 @@ msgstr "" ">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" "True" -#: ../../library/typing.rst:3443 +#: ../../library/typing.rst:3450 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." msgstr "" -#: ../../library/typing.rst:3449 +#: ../../library/typing.rst:3456 msgid "Determine if a type is a :class:`Protocol`." msgstr "確定一個型別是否 :class:`Protocol`。" -#: ../../library/typing.rst:3453 +#: ../../library/typing.rst:3460 msgid "" "class P(Protocol):\n" " def a(self) -> str: ...\n" @@ -5480,11 +5489,11 @@ msgstr "" "is_protocol(P) # => True\n" "is_protocol(int) # => False" -#: ../../library/typing.rst:3464 +#: ../../library/typing.rst:3471 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3468 +#: ../../library/typing.rst:3475 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5498,57 +5507,57 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3485 +#: ../../library/typing.rst:3492 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3487 +#: ../../library/typing.rst:3494 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. :class:`!ForwardRef` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3492 +#: ../../library/typing.rst:3499 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:3498 +#: ../../library/typing.rst:3505 msgid "" "This is now an alias for :class:`annotationlib.ForwardRef`. Several " "undocumented behaviors of this class have been changed; for example, after a " "``ForwardRef`` has been evaluated, the evaluated value is no longer cached." msgstr "" -#: ../../library/typing.rst:3505 +#: ../../library/typing.rst:3512 msgid "Evaluate an :class:`annotationlib.ForwardRef` as a :term:`type hint`." msgstr "" -#: ../../library/typing.rst:3507 +#: ../../library/typing.rst:3514 msgid "" "This is similar to calling :meth:`annotationlib.ForwardRef.evaluate`, but " "unlike that method, :func:`!evaluate_forward_ref` also recursively evaluates " "forward references nested within the type hint." msgstr "" -#: ../../library/typing.rst:3511 +#: ../../library/typing.rst:3518 msgid "" "See the documentation for :meth:`annotationlib.ForwardRef.evaluate` for the " "meaning of the *owner*, *globals*, *locals*, *type_params*, and *format* " "parameters." msgstr "" -#: ../../library/typing.rst:3523 +#: ../../library/typing.rst:3530 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" -#: ../../library/typing.rst:3526 +#: ../../library/typing.rst:3533 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5564,17 +5573,17 @@ msgstr "" ">>> S.__default__ is None\n" "True" -#: ../../library/typing.rst:3538 +#: ../../library/typing.rst:3545 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3542 +#: ../../library/typing.rst:3549 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It's ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3545 +#: ../../library/typing.rst:3552 msgid "" "A module which is expensive to import, and which only contain types used for " "typing annotations, can be safely imported inside an ``if TYPE_CHECKING:`` " @@ -5586,7 +5595,7 @@ msgid "" "will be checked properly during such analysis." msgstr "" -#: ../../library/typing.rst:3557 +#: ../../library/typing.rst:3564 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -5600,20 +5609,20 @@ msgstr "" "def fun(arg: expensive_mod.SomeType) -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3563 +#: ../../library/typing.rst:3570 msgid "" "If you occasionally need to examine type annotations at runtime which may " "contain undefined symbols, use :meth:`annotationlib.get_annotations` with a " -"``format`` parameter of :attr:`annotationlib.Format.STRING` " -"or :attr:`annotationlib.Format.FORWARDREF` to safely retrieve the " -"annotations without raising :exc:`NameError`." +"``format`` parameter of :attr:`annotationlib.Format.STRING` or :attr:" +"`annotationlib.Format.FORWARDREF` to safely retrieve the annotations without " +"raising :exc:`NameError`." msgstr "" -#: ../../library/typing.rst:3576 +#: ../../library/typing.rst:3583 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3578 +#: ../../library/typing.rst:3585 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the :mod:`!typing` module " @@ -5622,7 +5631,7 @@ msgid "" "pre-existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3585 +#: ../../library/typing.rst:3592 msgid "" "The redundant types are deprecated as of Python 3.9. However, while the " "aliases may be removed at some point, removal of these aliases is not " @@ -5630,214 +5639,213 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3590 +#: ../../library/typing.rst:3597 msgid "" "If at some point it is decided to remove these deprecated aliases, a " "deprecation warning will be issued by the interpreter for at least two " -"releases prior to removal. The aliases are guaranteed to remain in " -"the :mod:`!typing` module without deprecation warnings until at least Python " -"3.14." +"releases prior to removal. The aliases are guaranteed to remain in the :mod:" +"`!typing` module without deprecation warnings until at least Python 3.14." msgstr "" -#: ../../library/typing.rst:3595 +#: ../../library/typing.rst:3602 msgid "" "Type checkers are encouraged to flag uses of the deprecated types if the " "program they are checking targets a minimum Python version of 3.9 or newer." msgstr "" -#: ../../library/typing.rst:3601 +#: ../../library/typing.rst:3608 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3605 +#: ../../library/typing.rst:3612 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3607 +#: ../../library/typing.rst:3614 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Mapping` rather than to " "use :class:`dict` or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:3611 +#: ../../library/typing.rst:3618 msgid "" -":class:`builtins.dict ` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" +"`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3617 +#: ../../library/typing.rst:3624 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3619 +#: ../../library/typing.rst:3626 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " -"collection type such as :class:`~collections.abc.Sequence` " -"or :class:`~collections.abc.Iterable` rather than to use :class:`list` " -"or :class:`!typing.List`." +"collection type such as :class:`~collections.abc.Sequence` or :class:" +"`~collections.abc.Iterable` rather than to use :class:`list` or :class:`!" +"typing.List`." msgstr "" -#: ../../library/typing.rst:3624 +#: ../../library/typing.rst:3631 msgid "" -":class:`builtins.list ` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" +"`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3630 +#: ../../library/typing.rst:3637 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3632 +#: ../../library/typing.rst:3639 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " -"collection type such as :class:`collections.abc.Set` rather than to " -"use :class:`set` or :class:`typing.Set`." +"collection type such as :class:`collections.abc.Set` rather than to use :" +"class:`set` or :class:`typing.Set`." msgstr "" -#: ../../library/typing.rst:3636 +#: ../../library/typing.rst:3643 msgid "" -":class:`builtins.set ` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" +"`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3642 +#: ../../library/typing.rst:3649 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3644 +#: ../../library/typing.rst:3651 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3651 +#: ../../library/typing.rst:3658 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3653 +#: ../../library/typing.rst:3660 msgid "" -":class:`tuple` and ``Tuple`` are special-cased in the type system; " -"see :ref:`annotating-tuples` for more details." +":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" +"`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3656 +#: ../../library/typing.rst:3663 msgid "" -":class:`builtins.tuple ` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" +"`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3662 +#: ../../library/typing.rst:3669 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3664 +#: ../../library/typing.rst:3671 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3669 +#: ../../library/typing.rst:3676 msgid "" -":class:`builtins.type ` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" +"`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3676 +#: ../../library/typing.rst:3683 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3680 +#: ../../library/typing.rst:3687 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3684 +#: ../../library/typing.rst:3691 msgid "" -":class:`collections.defaultdict` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.defaultdict` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3690 +#: ../../library/typing.rst:3697 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3694 +#: ../../library/typing.rst:3701 msgid "" -":class:`collections.OrderedDict` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3700 +#: ../../library/typing.rst:3707 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3704 +#: ../../library/typing.rst:3711 msgid "" -":class:`collections.ChainMap` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" +"`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3710 +#: ../../library/typing.rst:3717 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3714 +#: ../../library/typing.rst:3721 msgid "" -":class:`collections.Counter` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" +"`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3720 +#: ../../library/typing.rst:3727 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3724 +#: ../../library/typing.rst:3731 msgid "" -":class:`collections.deque` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.deque` now supports subscripting (``[]``). See :pep:" +"`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3731 +#: ../../library/typing.rst:3738 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3736 +#: ../../library/typing.rst:3743 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3739 +#: ../../library/typing.rst:3746 msgid "" -"These types (and the corresponding functions) are generic " -"over :data:`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " +"These types (and the corresponding functions) are generic over :data:" +"`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " "``Pattern[bytes]``; ``Match`` can be specialised as ``Match[str]`` or " "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3744 +#: ../../library/typing.rst:3751 msgid "" -"Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. " -"See :pep:`585` and :ref:`types-genericalias`." +"Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3750 +#: ../../library/typing.rst:3757 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3752 +#: ../../library/typing.rst:3759 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: ../../library/typing.rst:3756 +#: ../../library/typing.rst:3763 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:3759 +#: ../../library/typing.rst:3766 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" @@ -5845,350 +5853,359 @@ msgstr "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" -#: ../../library/typing.rst:3764 +#: ../../library/typing.rst:3771 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: ../../library/typing.rst:3774 +#: ../../library/typing.rst:3781 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3778 +#: ../../library/typing.rst:3785 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3780 +#: ../../library/typing.rst:3787 msgid "" -":class:`collections.abc.Set` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" +"`585` and :ref:`types-genericalias`." +msgstr "" + +#: ../../library/typing.rst:3793 +msgid "" +"This type represents the types :class:`bytes`, :class:`bytearray`, and :" +"class:`memoryview` of byte sequences." +msgstr "" + +#: ../../library/typing.rst:3796 +msgid "" +"Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray " +"| memoryview``." msgstr "" -#: ../../library/typing.rst:3786 +#: ../../library/typing.rst:3801 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3790 +#: ../../library/typing.rst:3805 msgid "" -":class:`collections.abc.Collection` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3796 +#: ../../library/typing.rst:3811 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3798 +#: ../../library/typing.rst:3813 msgid "" -":class:`collections.abc.Container` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Container` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3804 +#: ../../library/typing.rst:3819 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3806 +#: ../../library/typing.rst:3821 msgid "" -":class:`collections.abc.ItemsView` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3812 +#: ../../library/typing.rst:3827 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3814 +#: ../../library/typing.rst:3829 msgid "" -":class:`collections.abc.KeysView` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3820 +#: ../../library/typing.rst:3835 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3822 +#: ../../library/typing.rst:3837 msgid "" -":class:`collections.abc.Mapping` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3828 +#: ../../library/typing.rst:3843 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3830 +#: ../../library/typing.rst:3845 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3836 +#: ../../library/typing.rst:3851 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3838 +#: ../../library/typing.rst:3853 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3845 +#: ../../library/typing.rst:3860 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3847 +#: ../../library/typing.rst:3862 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3854 +#: ../../library/typing.rst:3869 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3856 +#: ../../library/typing.rst:3871 msgid "" -":class:`collections.abc.MutableSet` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3862 +#: ../../library/typing.rst:3877 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3864 +#: ../../library/typing.rst:3879 msgid "" -":class:`collections.abc.Sequence` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3870 +#: ../../library/typing.rst:3885 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3872 +#: ../../library/typing.rst:3887 msgid "" -":class:`collections.abc.ValuesView` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3879 +#: ../../library/typing.rst:3894 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中非同步 ABC 的別名" -#: ../../library/typing.rst:3883 +#: ../../library/typing.rst:3898 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3885 +#: ../../library/typing.rst:3900 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on " -"using :class:`collections.abc.Coroutine` and ``typing.Coroutine`` in type " -"annotations." +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`collections.abc.Coroutine` and ``typing.Coroutine`` in type annotations." msgstr "" -#: ../../library/typing.rst:3891 +#: ../../library/typing.rst:3906 msgid "" -":class:`collections.abc.Coroutine` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3897 +#: ../../library/typing.rst:3912 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3899 +#: ../../library/typing.rst:3914 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on " -"using :class:`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` " -"in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` in type " +"annotations." msgstr "" -#: ../../library/typing.rst:3905 +#: ../../library/typing.rst:3920 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3910 +#: ../../library/typing.rst:3925 msgid "The ``SendType`` parameter now has a default." msgstr "``SendType`` 參數現在有預設值。" -#: ../../library/typing.rst:3915 +#: ../../library/typing.rst:3930 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3919 +#: ../../library/typing.rst:3934 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3925 +#: ../../library/typing.rst:3940 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3929 +#: ../../library/typing.rst:3944 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3935 +#: ../../library/typing.rst:3950 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3939 +#: ../../library/typing.rst:3954 msgid "" -":class:`collections.abc.Awaitable` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3946 +#: ../../library/typing.rst:3961 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3950 +#: ../../library/typing.rst:3965 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3952 +#: ../../library/typing.rst:3967 msgid "" -":class:`collections.abc.Iterable` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3958 +#: ../../library/typing.rst:3973 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3960 +#: ../../library/typing.rst:3975 msgid "" -":class:`collections.abc.Iterator` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3966 +#: ../../library/typing.rst:3981 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:3968 +#: ../../library/typing.rst:3983 msgid "" -"See :ref:`annotating-callables` for details on how to " -"use :class:`collections.abc.Callable` and ``typing.Callable`` in type " -"annotations." +"See :ref:`annotating-callables` for details on how to use :class:" +"`collections.abc.Callable` and ``typing.Callable`` in type annotations." msgstr "" -#: ../../library/typing.rst:3971 +#: ../../library/typing.rst:3986 msgid "" -":class:`collections.abc.Callable` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3981 +#: ../../library/typing.rst:3996 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:3983 +#: ../../library/typing.rst:3998 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on " -"using :class:`collections.abc.Generator` and ``typing.Generator`` in type " -"annotations." +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`collections.abc.Generator` and ``typing.Generator`` in type annotations." msgstr "" -#: ../../library/typing.rst:3987 +#: ../../library/typing.rst:4002 msgid "" -":class:`collections.abc.Generator` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3991 +#: ../../library/typing.rst:4006 msgid "Default values for the send and return types were added." msgstr "" -#: ../../library/typing.rst:3996 +#: ../../library/typing.rst:4011 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:3998 +#: ../../library/typing.rst:4013 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:4003 +#: ../../library/typing.rst:4018 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:4005 +#: ../../library/typing.rst:4020 msgid "" -":class:`collections.abc.Reversible` now supports subscripting (``[]``). " -"See :pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4011 +#: ../../library/typing.rst:4026 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:4013 +#: ../../library/typing.rst:4028 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:4019 +#: ../../library/typing.rst:4034 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:4023 +#: ../../library/typing.rst:4038 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:4025 +#: ../../library/typing.rst:4040 msgid "" -"The first type parameter, ``T_co``, represents the type returned by " -"the :meth:`~object.__enter__` method. The optional second type parameter, " +"The first type parameter, ``T_co``, represents the type returned by the :" +"meth:`~object.__enter__` method. The optional second type parameter, " "``ExitT_co``, which defaults to ``bool | None``, represents the type " "returned by the :meth:`~object.__exit__` method." msgstr "" -#: ../../library/typing.rst:4032 +#: ../../library/typing.rst:4047 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4037 +#: ../../library/typing.rst:4052 msgid "Added the optional second type parameter, ``ExitT_co``." msgstr "" -#: ../../library/typing.rst:4042 +#: ../../library/typing.rst:4057 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:4044 +#: ../../library/typing.rst:4059 msgid "" -"The first type parameter, ``T_co``, represents the type returned by " -"the :meth:`~object.__aenter__` method. The optional second type parameter, " +"The first type parameter, ``T_co``, represents the type returned by the :" +"meth:`~object.__aenter__` method. The optional second type parameter, " "``AExitT_co``, which defaults to ``bool | None``, represents the type " "returned by the :meth:`~object.__aexit__` method." msgstr "" -#: ../../library/typing.rst:4051 +#: ../../library/typing.rst:4066 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4056 +#: ../../library/typing.rst:4071 msgid "Added the optional second type parameter, ``AExitT_co``." msgstr "" -#: ../../library/typing.rst:4060 +#: ../../library/typing.rst:4075 msgid "Deprecation Timeline of Major Features" msgstr "主要功能的棄用時程表" -#: ../../library/typing.rst:4062 +#: ../../library/typing.rst:4077 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -6196,112 +6213,128 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:4069 +#: ../../library/typing.rst:4084 msgid "Feature" msgstr "" -#: ../../library/typing.rst:4070 +#: ../../library/typing.rst:4085 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:4071 +#: ../../library/typing.rst:4086 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:4072 +#: ../../library/typing.rst:4087 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:4073 +#: ../../library/typing.rst:4088 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:4074 +#: ../../library/typing.rst:4089 ../../library/typing.rst:4093 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:4075 +#: ../../library/typing.rst:4090 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:4076 +#: ../../library/typing.rst:4091 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:4077 +#: ../../library/typing.rst:4092 +msgid ":class:`typing.ByteString`" +msgstr ":class:`typing.ByteString`" + +#: ../../library/typing.rst:4094 +msgid "3.17" +msgstr "" + +#: ../../library/typing.rst:4095 +msgid ":gh:`91896`" +msgstr ":gh:`91896`" + +#: ../../library/typing.rst:4096 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:4078 +#: ../../library/typing.rst:4097 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:4079 ../../library/typing.rst:4083 -#: ../../library/typing.rst:4087 +#: ../../library/typing.rst:4098 ../../library/typing.rst:4102 +#: ../../library/typing.rst:4106 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:4080 +#: ../../library/typing.rst:4099 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:4081 +#: ../../library/typing.rst:4100 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:4082 ../../library/typing.rst:4086 +#: ../../library/typing.rst:4101 ../../library/typing.rst:4105 msgid "3.12" msgstr "3.12" -#: ../../library/typing.rst:4084 +#: ../../library/typing.rst:4103 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:4085 +#: ../../library/typing.rst:4104 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:4088 +#: ../../library/typing.rst:4107 msgid ":pep:`695`" msgstr ":pep:`695`" -#: ../../library/typing.rst:4089 +#: ../../library/typing.rst:4108 msgid ":func:`@typing.no_type_check_decorator `" msgstr ":func:`@typing.no_type_check_decorator `" -#: ../../library/typing.rst:4090 ../../library/typing.rst:4094 +#: ../../library/typing.rst:4109 ../../library/typing.rst:4113 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:4091 +#: ../../library/typing.rst:4110 msgid "3.15" msgstr "3.15" -#: ../../library/typing.rst:4092 +#: ../../library/typing.rst:4111 msgid ":gh:`106309`" msgstr ":gh:`106309`" -#: ../../library/typing.rst:4093 +#: ../../library/typing.rst:4112 msgid ":data:`typing.AnyStr`" msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:4095 +#: ../../library/typing.rst:4114 msgid "3.18" msgstr "3.18" -#: ../../library/typing.rst:4096 +#: ../../library/typing.rst:4115 msgid ":gh:`105578`" msgstr ":gh:`105578`" -#~ msgid ":class:`typing.ByteString`" -#~ msgstr ":class:`typing.ByteString`" +#: ../../library/typing.rst:233 ../../library/typing.rst:380 +#: ../../library/typing.rst:1170 +msgid "..." +msgstr "" + +#: ../../library/typing.rst:233 ../../library/typing.rst:380 +#: ../../library/typing.rst:1170 +msgid "ellipsis literal" +msgstr "" #~ msgid "3.14" #~ msgstr "3.14" -#~ msgid ":gh:`91896`" -#~ msgstr ":gh:`91896`" - #~ msgid "" #~ "@dataclass\n" #~ "class ctype:\n" diff --git a/library/unicodedata.po b/library/unicodedata.po index a061cf62bfd..f4adfb8c543 100644 --- a/library/unicodedata.po +++ b/library/unicodedata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-17 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,8 +25,8 @@ msgstr ":mod:`!unicodedata` --- Unicode 資料庫" msgid "" "This module provides access to the Unicode Character Database (UCD) which " "defines character properties for all Unicode characters. The data contained " -"in this database is compiled from the `UCD version 16.0.0 `_." +"in this database is compiled from the `UCD version 16.0.0 `_." msgstr "" #: ../../library/unicodedata.rst:23 @@ -36,84 +36,197 @@ msgid "" "tr44/>`_. It defines the following functions:" msgstr "" -#: ../../library/unicodedata.rst:31 +#: ../../library/unicodedata.rst:30 +msgid "" +"The :ref:`unicode-howto` for more information about Unicode and how to use " +"this module." +msgstr "" + +#: ../../library/unicodedata.rst:36 msgid "" "Look up character by name. If a character with the given name is found, " -"return the corresponding character. If not found, :exc:`KeyError` is raised." +"return the corresponding character. If not found, :exc:`KeyError` is " +"raised. For example::" +msgstr "" + +#: ../../library/unicodedata.rst:40 +msgid "" +">>> unicodedata.lookup('LEFT CURLY BRACKET')\n" +"'{'" +msgstr "" +">>> unicodedata.lookup('LEFT CURLY BRACKET')\n" +"'{'" + +#: ../../library/unicodedata.rst:43 +msgid "" +"The characters returned by this function are the same as those produced by " +"``\\N`` escape sequence in string literals. For example::" +msgstr "" + +#: ../../library/unicodedata.rst:46 +msgid "" +">>> unicodedata.lookup('MIDDLE DOT') == '\\N{MIDDLE DOT}'\n" +"True" msgstr "" +">>> unicodedata.lookup('MIDDLE DOT') == '\\N{MIDDLE DOT}'\n" +"True" -#: ../../library/unicodedata.rst:34 +#: ../../library/unicodedata.rst:49 msgid "Support for name aliases [#]_ and named sequences [#]_ has been added." msgstr "已新增對名稱別名 [#]_ 和命名序列 [#]_ 的支援。" -#: ../../library/unicodedata.rst:40 +#: ../../library/unicodedata.rst:55 msgid "" "Returns the name assigned to the character *chr* as a string. If no name is " "defined, *default* is returned, or, if not given, :exc:`ValueError` is " -"raised." +"raised. For example::" +msgstr "" + +#: ../../library/unicodedata.rst:59 +msgid "" +">>> unicodedata.name('½')\n" +"'VULGAR FRACTION ONE HALF'\n" +">>> unicodedata.name('\\uFFFF', 'fallback')\n" +"'fallback'" msgstr "" +">>> unicodedata.name('½')\n" +"'VULGAR FRACTION ONE HALF'\n" +">>> unicodedata.name('\\uFFFF', 'fallback')\n" +"'fallback'" -#: ../../library/unicodedata.rst:47 +#: ../../library/unicodedata.rst:67 msgid "" "Returns the decimal value assigned to the character *chr* as integer. If no " -"such value is defined, *default* is returned, or, if not " -"given, :exc:`ValueError` is raised." +"such value is defined, *default* is returned, or, if not given, :exc:" +"`ValueError` is raised. For example::" +msgstr "" + +#: ../../library/unicodedata.rst:71 +msgid "" +">>> unicodedata.decimal('\\N{ARABIC-INDIC DIGIT NINE}')\n" +"9\n" +">>> unicodedata.decimal('\\N{SUPERSCRIPT NINE}', -1)\n" +"-1" msgstr "" +">>> unicodedata.decimal('\\N{ARABIC-INDIC DIGIT NINE}')\n" +"9\n" +">>> unicodedata.decimal('\\N{SUPERSCRIPT NINE}', -1)\n" +"-1" -#: ../../library/unicodedata.rst:54 +#: ../../library/unicodedata.rst:79 msgid "" "Returns the digit value assigned to the character *chr* as integer. If no " -"such value is defined, *default* is returned, or, if not " -"given, :exc:`ValueError` is raised." +"such value is defined, *default* is returned, or, if not given, :exc:" +"`ValueError` is raised::" +msgstr "" + +#: ../../library/unicodedata.rst:83 +msgid "" +">>> unicodedata.digit('\\N{SUPERSCRIPT NINE}')\n" +"9" msgstr "" +">>> unicodedata.digit('\\N{SUPERSCRIPT NINE}')\n" +"9" -#: ../../library/unicodedata.rst:61 +#: ../../library/unicodedata.rst:89 msgid "" "Returns the numeric value assigned to the character *chr* as float. If no " -"such value is defined, *default* is returned, or, if not " -"given, :exc:`ValueError` is raised." +"such value is defined, *default* is returned, or, if not given, :exc:" +"`ValueError` is raised::" msgstr "" -#: ../../library/unicodedata.rst:68 -msgid "Returns the general category assigned to the character *chr* as string." +#: ../../library/unicodedata.rst:93 +msgid "" +">>> unicodedata.numeric('½')\n" +"0.5" msgstr "" +">>> unicodedata.numeric('½')\n" +"0.5" -#: ../../library/unicodedata.rst:74 +#: ../../library/unicodedata.rst:99 +msgid "" +"Returns the general category assigned to the character *chr* as string. " +"General category names consist of two letters. See the `General Category " +"Values section of the Unicode Character Database documentation `_ for a list " +"of category codes. For example::" +msgstr "" + +#: ../../library/unicodedata.rst:105 +msgid "" +">>> unicodedata.category('A') # 'L'etter, 'u'ppercase\n" +"'Lu'" +msgstr "" + +#: ../../library/unicodedata.rst:111 msgid "" "Returns the bidirectional class assigned to the character *chr* as string. " -"If no such value is defined, an empty string is returned." +"If no such value is defined, an empty string is returned. See the " +"`Bidirectional Class Values section of the Unicode Character Database " +"`_ " +"documentation for a list of bidirectional codes. For example::" msgstr "" -#: ../../library/unicodedata.rst:80 +#: ../../library/unicodedata.rst:117 +msgid "" +">>> unicodedata.bidirectional('\\N{ARABIC-INDIC DIGIT SEVEN}') # 'A'rabic, " +"'N'umber\n" +"'AN'" +msgstr "" + +#: ../../library/unicodedata.rst:123 msgid "" "Returns the canonical combining class assigned to the character *chr* as " -"integer. Returns ``0`` if no combining class is defined." +"integer. Returns ``0`` if no combining class is defined. See the `Canonical " +"Combining Class Values section of the Unicode Character Database `_ " +"for more information." msgstr "" -#: ../../library/unicodedata.rst:86 -msgid "Returns the east asian width assigned to the character *chr* as string." +#: ../../library/unicodedata.rst:132 +msgid "" +"Returns the east asian width assigned to the character *chr* as string. For " +"a list of widths and or more information, see the `Unicode Standard Annex " +"#11 `_." msgstr "" -#: ../../library/unicodedata.rst:92 +#: ../../library/unicodedata.rst:139 msgid "" "Returns the mirrored property assigned to the character *chr* as integer. " "Returns ``1`` if the character has been identified as a \"mirrored\" " -"character in bidirectional text, ``0`` otherwise." +"character in bidirectional text, ``0`` otherwise. For example::" msgstr "" -#: ../../library/unicodedata.rst:99 +#: ../../library/unicodedata.rst:143 +msgid "" +">>> unicodedata.mirrored('>')\n" +"1" +msgstr "" +">>> unicodedata.mirrored('>')\n" +"1" + +#: ../../library/unicodedata.rst:149 msgid "" "Returns the character decomposition mapping assigned to the character *chr* " -"as string. An empty string is returned in case no such mapping is defined." +"as string. An empty string is returned in case no such mapping is defined. " +"For example::" +msgstr "" + +#: ../../library/unicodedata.rst:153 +msgid "" +">>> unicodedata.decomposition('Ã')\n" +"'0041 0303'" msgstr "" +">>> unicodedata.decomposition('Ã')\n" +"'0041 0303'" -#: ../../library/unicodedata.rst:106 +#: ../../library/unicodedata.rst:159 msgid "" "Return the normal form *form* for the Unicode string *unistr*. Valid values " "for *form* are 'NFC', 'NFKC', 'NFD', and 'NFKD'." msgstr "" -#: ../../library/unicodedata.rst:109 +#: ../../library/unicodedata.rst:162 msgid "" "The Unicode standard defines various normalization forms of a Unicode " "string, based on the definition of canonical equivalence and compatibility " @@ -123,7 +236,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../library/unicodedata.rst:115 +#: ../../library/unicodedata.rst:168 msgid "" "For each character, there are two normal forms: normal form C and normal " "form D. Normal form D (NFD) is also known as canonical decomposition, and " @@ -132,65 +245,61 @@ msgid "" "characters again." msgstr "" -#: ../../library/unicodedata.rst:120 +#: ../../library/unicodedata.rst:173 msgid "" "In addition to these two forms, there are two additional normal forms based " "on compatibility equivalence. In Unicode, certain characters are supported " "which normally would be unified with other characters. For example, U+2160 " "(ROMAN NUMERAL ONE) is really the same thing as U+0049 (LATIN CAPITAL LETTER " "I). However, it is supported in Unicode for compatibility with existing " -"character sets (e.g. gb2312)." +"character sets (for example, gb2312)." msgstr "" -#: ../../library/unicodedata.rst:127 +#: ../../library/unicodedata.rst:180 msgid "" -"The normal form KD (NFKD) will apply the compatibility decomposition, i.e. " -"replace all compatibility characters with their equivalents. The normal form " -"KC (NFKC) first applies the compatibility decomposition, followed by the " -"canonical composition." +"The normal form KD (NFKD) will apply the compatibility decomposition, that " +"is, replace all compatibility characters with their equivalents. The normal " +"form KC (NFKC) first applies the compatibility decomposition, followed by " +"the canonical composition." msgstr "" -#: ../../library/unicodedata.rst:132 +#: ../../library/unicodedata.rst:185 msgid "" "Even if two unicode strings are normalized and look the same to a human " "reader, if one has combining characters and the other doesn't, they may not " "compare equal." msgstr "" -#: ../../library/unicodedata.rst:138 +#: ../../library/unicodedata.rst:192 msgid "" "Return whether the Unicode string *unistr* is in the normal form *form*. " "Valid values for *form* are 'NFC', 'NFKC', 'NFD', and 'NFKD'." msgstr "" -#: ../../library/unicodedata.rst:144 +#: ../../library/unicodedata.rst:198 msgid "In addition, the module exposes the following constant:" msgstr "" -#: ../../library/unicodedata.rst:148 +#: ../../library/unicodedata.rst:202 msgid "The version of the Unicode database used in this module." msgstr "在此模組中使用的 Unicode 資料庫版本。" -#: ../../library/unicodedata.rst:153 +#: ../../library/unicodedata.rst:207 msgid "" "This is an object that has the same methods as the entire module, but uses " "the Unicode database version 3.2 instead, for applications that require this " "specific version of the Unicode database (such as IDNA)." msgstr "" -#: ../../library/unicodedata.rst:157 -msgid "Examples:" -msgstr "範例:" - -#: ../../library/unicodedata.rst:177 +#: ../../library/unicodedata.rst:213 msgid "Footnotes" msgstr "註腳" -#: ../../library/unicodedata.rst:178 +#: ../../library/unicodedata.rst:214 msgid "https://www.unicode.org/Public/16.0.0/ucd/NameAliases.txt" msgstr "https://www.unicode.org/Public/16.0.0/ucd/NameAliases.txt" -#: ../../library/unicodedata.rst:180 +#: ../../library/unicodedata.rst:216 msgid "https://www.unicode.org/Public/16.0.0/ucd/NamedSequences.txt" msgstr "https://www.unicode.org/Public/16.0.0/ucd/NamedSequences.txt" diff --git a/library/unittest.mock.po b/library/unittest.mock.po index e5af3c35d62..49923b419ba 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2024-02-19 21:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,15 +50,15 @@ msgstr "" #: ../../library/unittest.mock.rst:26 msgid "" "Additionally, mock provides a :func:`patch` decorator that handles patching " -"module and class level attributes within the scope of a test, along " -"with :const:`sentinel` for creating unique objects. See the `quick guide`_ " -"for some examples of how to use :class:`Mock`, :class:`MagicMock` " -"and :func:`patch`." +"module and class level attributes within the scope of a test, along with :" +"const:`sentinel` for creating unique objects. See the `quick guide`_ for " +"some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" +"`patch`." msgstr "" "此外,mock 還提供了一個 :func:`patch` 裝飾器,用於 patching 測試範圍內對 " -"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件" -"的 :const:`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` " -"和 :func:`patch` 的一些範例,請參閱\\ `快速導引 `_。" +"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件的 :const:" +"`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` 和 :func:" +"`patch` 的一些範例,請參閱\\ `快速導引 `_。" #: ../../library/unittest.mock.rst:32 msgid "" @@ -222,11 +222,11 @@ msgid "" "replacing, and any functions and methods (including constructors) have the " "same call signature as the real object." msgstr "" -"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用" -"\\ :ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch " -"的 *autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock " -"物件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函" -"式)都具有與真實物件相同的呼叫簽名(call signature)。" +"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用\\ :" +"ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch 的 " +"*autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock 物" +"件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函式)" +"都具有與真實物件相同的呼叫簽名(call signature)。" #: ../../library/unittest.mock.rst:177 msgid "" @@ -264,12 +264,12 @@ msgstr "" msgid "" ":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods " "pre-created and ready to use. There are also non-callable variants, useful " -"when you are mocking out objects that aren't " -"callable: :class:`NonCallableMock` and :class:`NonCallableMagicMock`" +"when you are mocking out objects that aren't callable: :class:" +"`NonCallableMock` and :class:`NonCallableMagicMock`" msgstr "" ":class:`MagicMock` 是 :class:`Mock` 的子類別,其中所有魔術方法均已預先建立並" -"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有" -"用::class:`NonCallableMock` 和 :class:`NonCallableMagicMock`" +"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有用::class:" +"`NonCallableMock` 和 :class:`NonCallableMagicMock`" #: ../../library/unittest.mock.rst:224 msgid "" @@ -279,8 +279,8 @@ msgid "" "class of :class:`Mock` using the *new_callable* argument to :func:`patch`." msgstr "" ":func:`patch` 裝飾器可以輕鬆地用 :class:`Mock` 物件臨時替換特定模組中的類別。" -"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使" -"用 :func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" +"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使用 :" +"func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" #: ../../library/unittest.mock.rst:232 msgid "" @@ -300,18 +300,18 @@ msgid "" msgstr "" "*spec*:這可以是字串的 list(串列),也可以是充當 mock 物件規格的現有物件(類" "別或實例)。如果傳入一個物件,則通過對該物件呼叫 dir 來形成字串的串列(不包括" -"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引" -"發 :exc:`AttributeError`。" +"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引發 :exc:" +"`AttributeError`。" #: ../../library/unittest.mock.rst:241 msgid "" -"If *spec* is an object (rather than a list of strings) " -"then :attr:`~object.__class__` returns the class of the spec object. This " -"allows mocks to pass :func:`isinstance` tests." +"If *spec* is an object (rather than a list of strings) then :attr:`~object." +"__class__` returns the class of the spec object. This allows mocks to pass :" +"func:`isinstance` tests." msgstr "" -"如果 *spec* 是一個物件(而不是一個字串的串列),那" -"麼 :attr:`~object.__class__` 會回傳 spec 物件的類別。這允許 mocks 通" -"過 :func:`isinstance` 測試。" +"如果 *spec* 是一個物件(而不是一個字串的串列),那麼 :attr:`~object." +"__class__` 會回傳 spec 物件的類別。這允許 mocks 通過 :func:`isinstance` 測" +"試。" #: ../../library/unittest.mock.rst:245 msgid "" @@ -320,13 +320,13 @@ msgid "" "will raise an :exc:`AttributeError`." msgstr "" "*spec_set*:*spec* 的一個更嚴格的變體。如果使用 *spec_set*,在 mock 上嘗試 " -"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引" -"發 :exc:`AttributeError`。" +"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引發 :exc:" +"`AttributeError`。" #: ../../library/unittest.mock.rst:249 msgid "" -"*side_effect*: A function to be called whenever the Mock is called. See " -"the :attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " +"*side_effect*: A function to be called whenever the Mock is called. See the :" +"attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " "dynamically changing return values. The function is called with the same " "arguments as the mock, and unless it returns :data:`DEFAULT`, the return " "value of this function is used as the return value." @@ -367,8 +367,8 @@ msgstr "" #: ../../library/unittest.mock.rst:267 msgid "" "*unsafe*: By default, accessing any attribute whose name starts with " -"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise " -"an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to these " +"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise an :exc:" +"`AttributeError`. Passing ``unsafe=True`` will allow access to these " "attributes." msgstr "" "*unsafe*:預設情況下,存取任何以 *assert*、*assret*、*asert*、*aseert* 或 " @@ -381,13 +381,13 @@ msgid "" "calling the Mock will pass the call through to the wrapped object (returning " "the real result). Attribute access on the mock will return a Mock object " "that wraps the corresponding attribute of the wrapped object (so attempting " -"to access an attribute that doesn't exist will raise " -"an :exc:`AttributeError`)." +"to access an attribute that doesn't exist will raise an :exc:" +"`AttributeError`)." msgstr "" "*wraps*:被 mock 物件包裝的項目。如果 *wraps* 不是 ``None``,那麼呼叫 Mock 將" "通過被包裝的物件(回傳真實結果)。存取 mock 的屬性將會回傳一個 Mock 物件,該" -"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引" -"發 :exc:`AttributeError`\\ )。" +"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引發 :exc:" +"`AttributeError`\\ )。" #: ../../library/unittest.mock.rst:281 msgid "" @@ -408,8 +408,8 @@ msgstr "" #: ../../library/unittest.mock.rst:288 msgid "" "Mocks can also be called with arbitrary keyword arguments. These will be " -"used to set attributes on the mock after it is created. See " -"the :meth:`configure_mock` method for details." +"used to set attributes on the mock after it is created. See the :meth:" +"`configure_mock` method for details." msgstr "" "Mocks 還可以使用任意的關鍵字引數進行呼叫。這些關鍵字引數將在建立 mock 之後用" "於設定 mock 的屬性。欲知更多,請參見 :meth:`configure_mock` 方法。" @@ -440,19 +440,19 @@ msgstr "斷言 mock 已經被使用指定的引數呼叫。" #: ../../library/unittest.mock.rst:351 msgid "" -"The assert passes if the mock has *ever* been called, " -"unlike :meth:`assert_called_with` and :meth:`assert_called_once_with` that " -"only pass if the call is the most recent one, and in the case " -"of :meth:`assert_called_once_with` it must also be the only call." +"The assert passes if the mock has *ever* been called, unlike :meth:" +"`assert_called_with` and :meth:`assert_called_once_with` that only pass if " +"the call is the most recent one, and in the case of :meth:" +"`assert_called_once_with` it must also be the only call." msgstr "" -"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` " -"和 :meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對" -"於 :meth:`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" +"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` 和 :" +"meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對於 :meth:" +"`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" #: ../../library/unittest.mock.rst:364 msgid "" -"assert the mock has been called with the specified calls. " -"The :attr:`mock_calls` list is checked for the calls." +"assert the mock has been called with the specified calls. The :attr:" +"`mock_calls` list is checked for the calls." msgstr "" "斷言 mock 已經使用指定的呼叫方式來呼叫。此斷言會檢查 :attr:`mock_calls` 串列" "中的呼叫。" @@ -553,9 +553,9 @@ msgstr "" #: ../../library/unittest.mock.rst:441 msgid "" -"Note that :meth:`reset_mock` *doesn't* clear " -"the :attr:`return_value`, :attr:`side_effect` or any child attributes you " -"have set using normal assignment by default." +"Note that :meth:`reset_mock` *doesn't* clear the :attr:`return_value`, :attr:" +"`side_effect` or any child attributes you have set using normal assignment " +"by default." msgstr "" #: ../../library/unittest.mock.rst:445 @@ -581,8 +581,8 @@ msgstr "如果 *spec_set* 為 true,那麼只能設定在規格中的屬性。" #: ../../library/unittest.mock.rst:461 msgid "" "Attach a mock as an attribute of this one, replacing its name and parent. " -"Calls to the attached mock will be recorded in the :attr:`method_calls` " -"and :attr:`mock_calls` attributes of this one." +"Calls to the attached mock will be recorded in the :attr:`method_calls` and :" +"attr:`mock_calls` attributes of this one." msgstr "" "將一個 mock 作為這個 Mock 的屬性附加,取代它的名稱和上代 (parent)。對附加的 " "mock 的呼叫將被記錄在這個 Mock 的 :attr:`method_calls` 和 :attr:`mock_calls` " @@ -679,17 +679,17 @@ msgid "" "returns :data:`DEFAULT` then the mock will return its normal value (from " "the :attr:`return_value`)." msgstr "" -"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回" -"傳 :data:`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何" -"值。如果函式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值" -"(從 :attr:`return_value` 得到)。" +"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回傳 :data:" +"`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何值。如果函" +"式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值(從 :attr:" +"`return_value` 得到)。" #: ../../library/unittest.mock.rst:583 msgid "" "If you pass in an iterable, it is used to retrieve an iterator which must " "yield a value on every call. This value can either be an exception instance " -"to be raised, or a value to be returned from the call to the mock " -"(:data:`DEFAULT` handling is identical to the function case)." +"to be raised, or a value to be returned from the call to the mock (:data:" +"`DEFAULT` handling is identical to the function case)." msgstr "" "如果你傳遞一個可疊代物件,它將被用於檢索一個疊代器,該疊代器必須在每次呼叫時" "產出 (yield) 一個值。這個值可以是要引發的例外實例,或者是對 mock 呼叫時要回傳" @@ -726,26 +726,25 @@ msgid "" "This is either ``None`` (if the mock hasn't been called), or the arguments " "that the mock was last called with. This will be in the form of a tuple: the " "first member, which can also be accessed through the ``args`` property, is " -"any ordered arguments the mock was called with (or an empty tuple) and the " -"second member, which can also be accessed through the ``kwargs`` property, " -"is any keyword arguments (or an empty dictionary)." +"any positional arguments the mock was called with (or an empty tuple) and " +"the second member, which can also be accessed through the ``kwargs`` " +"property, is any keyword arguments (or an empty dictionary)." msgstr "" "這會是 ``None``\\ (如果 mock 尚未被呼叫),或是 mock 上次被呼叫時使用的引" "數。這將以元組的形式呈現:第一個成員 (member),其可以通過 ``args`` 屬性存取," -"是 mock 被呼叫時傳遞的所有有序引數(或一個空元組)。第二個成員,其可以通過 " +"是 mock 被呼叫時傳遞的所有位置引數(或一個空元組)。第二個成員,其可以通過 " "``kwargs`` 屬性存取,是所有關鍵字引數(或一個空字典)。" #: ../../library/unittest.mock.rst:672 msgid "" -":attr:`call_args`, along with members of the " -"lists :attr:`call_args_list`, :attr:`method_calls` and :attr:`mock_calls` " -"are :data:`call` objects. These are tuples, so they can be unpacked to get " -"at the individual arguments and make more complex assertions. " -"See :ref:`calls as tuples `." +":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :" +"attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These " +"are tuples, so they can be unpacked to get at the individual arguments and " +"make more complex assertions. See :ref:`calls as tuples `." msgstr "" -":attr:`call_args`,以及串列 :attr:`call_args_list`、:attr:`method_calls` " -"和 :attr:`mock_calls` 的成員都是 :data:`call` 物件。這些都是元組,因此可以解" -"包以取得各個引數並進行更複雜的斷言。參見 :ref:`calls as tuples `。" #: ../../library/unittest.mock.rst:678 @@ -757,8 +756,8 @@ msgid "" "This is a list of all the calls made to the mock object in sequence (so the " "length of the list is the number of times it has been called). Before any " "calls have been made it is an empty list. The :data:`call` object can be " -"used for conveniently constructing lists of calls to compare " -"with :attr:`call_args_list`." +"used for conveniently constructing lists of calls to compare with :attr:" +"`call_args_list`." msgstr "" "這是按順序列出所有呼叫 mock 物件的串列(因此串列的長度表示它被呼叫的次數)。" "在任何呼叫發生之前,它會是一個空的串列。 :data:`call` 物件可用於方便地建構呼" @@ -829,8 +828,8 @@ msgstr "" #: ../../library/unittest.mock.rst:772 msgid "" -":attr:`!__class__` is assignable to, this allows a mock to pass " -"an :func:`isinstance` check without forcing you to use a spec:" +":attr:`!__class__` is assignable to, this allows a mock to pass an :func:" +"`isinstance` check without forcing you to use a spec:" msgstr "" ":attr:`!__class__` 可以被指定,這允許 mock 通過 :func:`isinstance` 檢查,而不" "需要強制使用 spec:" @@ -849,13 +848,13 @@ msgid "" "Mock objects that use a class or an instance as a :attr:`!spec` or :attr:`!" "spec_set` are able to pass :func:`isinstance` tests:" msgstr "" -"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通" -"過 :func:`isinstance` 測試:" +"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通過 :" +"func:`isinstance` 測試:" #: ../../library/unittest.mock.rst:796 msgid "" -"The :class:`Mock` classes have support for mocking magic methods. " -"See :ref:`magic methods ` for the full details." +"The :class:`Mock` classes have support for mocking magic methods. See :ref:" +"`magic methods ` for the full details." msgstr "" ":class:`Mock` 類別支援 mock 魔術方法。細節請參考\\ :ref:`魔術方法 `。" @@ -867,9 +866,9 @@ msgid "" "are passed to the constructor of the mock being created. The keyword " "arguments are for configuring attributes of the mock:" msgstr "" -"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對" -"於 :func:`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵" -"字引數用於配置 mock 的屬性:" +"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對於 :func:" +"`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵字引數用" +"於配置 mock 的屬性:" #: ../../library/unittest.mock.rst:810 msgid "" @@ -911,15 +910,15 @@ msgstr "" #: ../../library/unittest.mock.rst:838 msgid "" -"This applies " -"to :meth:`~Mock.assert_called_with`, :meth:`~Mock.assert_called_once_with`, :meth:`~Mock.assert_has_calls` " -"and :meth:`~Mock.assert_any_call`. When :ref:`auto-speccing`, it will also " -"apply to method calls on the mock object." +"This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock." +"assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." +"assert_any_call`. When :ref:`auto-speccing`, it will also apply to method " +"calls on the mock object." msgstr "" -"這適用" -"於 :meth:`~Mock.assert_called_with`、:meth:`~Mock.assert_called_once_with`、:meth:`~Mock.assert_has_calls` " -"和 :meth:`~Mock.assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 " -"mock 物件的方法呼叫。" +"這適用於 :meth:`~Mock.assert_called_with`、:meth:`~Mock." +"assert_called_once_with`、:meth:`~Mock.assert_has_calls` 和 :meth:`~Mock." +"assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 mock 物件的方法" +"呼叫。" #: ../../library/unittest.mock.rst:843 msgid "Added signature introspection on specced and autospecced mock objects." @@ -929,14 +928,14 @@ msgstr "" #: ../../library/unittest.mock.rst:849 msgid "" -"A mock intended to be used as a :class:`property`, or " -"other :term:`descriptor`, on a class. :class:`PropertyMock` " -"provides :meth:`~object.__get__` and :meth:`~object.__set__` methods so you " -"can specify a return value when it is fetched." +"A mock intended to be used as a :class:`property`, or other :term:" +"`descriptor`, on a class. :class:`PropertyMock` provides :meth:`~object." +"__get__` and :meth:`~object.__set__` methods so you can specify a return " +"value when it is fetched." msgstr "" -"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 " -"mock。:class:`PropertyMock` 提供了 :meth:`~object.__get__` " -"和 :meth:`~object.__set__` 方法,因此你可以在它被提取時指定回傳值。" +"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 mock。:" +"class:`PropertyMock` 提供了 :meth:`~object.__get__` 和 :meth:`~object." +"__set__` 方法,因此你可以在它被提取時指定回傳值。" #: ../../library/unittest.mock.rst:854 msgid "" @@ -986,9 +985,9 @@ msgstr "" #: ../../library/unittest.mock.rst:875 msgid "" -"Because of the way mock attributes are stored you can't directly attach " -"a :class:`PropertyMock` to a mock object. Instead you can attach it to the " -"mock type object::" +"Because of the way mock attributes are stored you can't directly attach a :" +"class:`PropertyMock` to a mock object. Instead you can attach it to the mock " +"type object::" msgstr "" "由於 mock 屬性的儲存方式,你無法直接將 :class:`PropertyMock` 附加到 mock 物" "件。但是你可以將其附加到 mock 型別的物件: ::" @@ -1091,18 +1090,18 @@ msgstr "" #: ../../library/unittest.mock.rst:940 msgid "" -"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, " -"or :class:`AsyncMock` to a class with asynchronous and synchronous functions " -"will automatically detect the synchronous functions and set them " -"as :class:`MagicMock` (if the parent mock is :class:`AsyncMock` " -"or :class:`MagicMock`) or :class:`Mock` (if the parent mock " -"is :class:`Mock`). All asynchronous functions will be :class:`AsyncMock`." +"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, or :class:" +"`AsyncMock` to a class with asynchronous and synchronous functions will " +"automatically detect the synchronous functions and set them as :class:" +"`MagicMock` (if the parent mock is :class:`AsyncMock` or :class:`MagicMock`) " +"or :class:`Mock` (if the parent mock is :class:`Mock`). All asynchronous " +"functions will be :class:`AsyncMock`." msgstr "" "將 :class:`Mock`、:class:`MagicMock` 或 :class:`AsyncMock` 的 *spec* 設定為具" -"有同步和非同步函式的類別,會自動檢測同步函式並將其設定" -"為 :class:`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` " -"或 :class:`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock " -"為 :class:`Mock`\\ )。所有非同步函式將被設定為 :class:`AsyncMock`。" +"有同步和非同步函式的類別,會自動檢測同步函式並將其設定為 :class:" +"`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` 或 :class:" +"`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock 為 :class:`Mock`\\ )。所" +"有非同步函式將被設定為 :class:`AsyncMock`。" #: ../../library/unittest.mock.rst:968 msgid "" @@ -1132,8 +1131,8 @@ msgstr "斷言 mock 曾經被使用指定的引數等待過。" #: ../../library/unittest.mock.rst:1053 msgid "" -"Assert the mock has been awaited with the specified calls. " -"The :attr:`await_args_list` list is checked for the awaits." +"Assert the mock has been awaited with the specified calls. The :attr:" +"`await_args_list` list is checked for the awaits." msgstr "" "斷言 mock 已被使用指定的呼叫進行等待。:attr:`await_args_list` 串列將被檢查以" "確認等待的內容。" @@ -1151,8 +1150,8 @@ msgid "" "If *any_order* is true then the awaits can be in any order, but they must " "all appear in :attr:`await_args_list`." msgstr "" -"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現" -"在 :attr:`await_args_list` 中。" +"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現在 :" +"attr:`await_args_list` 中。" #: ../../library/unittest.mock.rst:1080 msgid "Assert that the mock was never awaited." @@ -1160,11 +1159,11 @@ msgstr "斷言 mock 從未被等待。" #: ../../library/unittest.mock.rst:1087 msgid "" -"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to " -"0, :attr:`await_args` to None, and clears the :attr:`await_args_list`." +"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to 0, :attr:" +"`await_args` to None, and clears the :attr:`await_args_list`." msgstr "" -"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 " -"0,:attr:`await_args` 設定為 None,並清除 :attr:`await_args_list`。" +"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 0,:attr:" +"`await_args` 設定為 None,並清除 :attr:`await_args_list`。" #: ../../library/unittest.mock.rst:1092 msgid "" @@ -1174,8 +1173,8 @@ msgstr "一個整數,用來記錄 mock 物件已被等待的次數。" #: ../../library/unittest.mock.rst:1107 msgid "" "This is either ``None`` (if the mock hasn’t been awaited), or the arguments " -"that the mock was last awaited with. Functions the same " -"as :attr:`Mock.call_args`." +"that the mock was last awaited with. Functions the same as :attr:`Mock." +"call_args`." msgstr "" "這可能是 ``None``\\ (如果 mock 尚未被等待),或者是上次等待 mock 時使用的引" "數。與 :attr:`Mock.call_args` 的功能相同。" @@ -1191,9 +1190,9 @@ msgstr "" #: ../../library/unittest.mock.rst:1145 msgid "" -"A version of :class:`MagicMock` for multithreading tests. " -"The :class:`ThreadingMock` object provides extra methods to wait for a call " -"to be invoked, rather than assert on it immediately." +"A version of :class:`MagicMock` for multithreading tests. The :class:" +"`ThreadingMock` object provides extra methods to wait for a call to be " +"invoked, rather than assert on it immediately." msgstr "" #: ../../library/unittest.mock.rst:1149 @@ -1205,8 +1204,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1152 msgid "" -"You can configure the global default timeout by " -"setting :attr:`ThreadingMock.DEFAULT_TIMEOUT`." +"You can configure the global default timeout by setting :attr:`ThreadingMock." +"DEFAULT_TIMEOUT`." msgstr "" #: ../../library/unittest.mock.rst:1156 @@ -1226,14 +1225,14 @@ msgstr "等到直到 mock 被以特定引數呼叫。" #: ../../library/unittest.mock.rst:1172 msgid "" -"If a timeout was passed at the creation of the mock the function raises " -"an :exc:`AssertionError` if the call is not performed in time." +"If a timeout was passed at the creation of the mock the function raises an :" +"exc:`AssertionError` if the call is not performed in time." msgstr "" #: ../../library/unittest.mock.rst:1183 msgid "" -"Global default timeout in seconds to create instances " -"of :class:`ThreadingMock`." +"Global default timeout in seconds to create instances of :class:" +"`ThreadingMock`." msgstr "" #: ../../library/unittest.mock.rst:1189 @@ -1242,11 +1241,11 @@ msgstr "呼叫" #: ../../library/unittest.mock.rst:1191 msgid "" -"Mock objects are callable. The call will return the value set as " -"the :attr:`~Mock.return_value` attribute. The default return value is a new " -"Mock object; it is created the first time the return value is accessed " -"(either explicitly or by calling the Mock) - but it is stored and the same " -"one returned each time." +"Mock objects are callable. The call will return the value set as the :attr:" +"`~Mock.return_value` attribute. The default return value is a new Mock " +"object; it is created the first time the return value is accessed (either " +"explicitly or by calling the Mock) - but it is stored and the same one " +"returned each time." msgstr "" "Mock 物件可被呼叫。呼叫將回傳設定為 :attr:`~Mock.return_value` 屬性的值。預設" "的回傳值是一個新的 Mock 物件;它會在第一次存取回傳值時(無論是顯式存取還是透" @@ -1254,11 +1253,11 @@ msgstr "" #: ../../library/unittest.mock.rst:1197 msgid "" -"Calls made to the object will be recorded in the attributes " -"like :attr:`~Mock.call_args` and :attr:`~Mock.call_args_list`." +"Calls made to the object will be recorded in the attributes like :attr:" +"`~Mock.call_args` and :attr:`~Mock.call_args_list`." msgstr "" -"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` " -"和 :attr:`~Mock.call_args_list` 等屬性中。" +"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` 和 :attr:`~Mock." +"call_args_list` 等屬性中。" #: ../../library/unittest.mock.rst:1200 msgid "" @@ -1271,8 +1270,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1204 msgid "" -"The simplest way to make a mock raise an exception when called is to " -"make :attr:`~Mock.side_effect` an exception class or instance:" +"The simplest way to make a mock raise an exception when called is to make :" +"attr:`~Mock.side_effect` an exception class or instance:" msgstr "" "呼叫 mock 時引發例外的最簡單方式是將 :attr:`~Mock.side_effect` 設定為例外類別" "或實例:" @@ -1296,8 +1295,8 @@ msgid "" "return :data:`DEFAULT`:" msgstr "" "如果你希望 mock 仍然回傳預設的回傳值(一個新的 mock),或者是任何已設定的回傳" -"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回" -"傳 :attr:`~Mock.return_value`,或回傳 :data:`DEFAULT`:" +"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回傳 :attr:`~Mock." +"return_value`,或回傳 :data:`DEFAULT`:" #: ../../library/unittest.mock.rst:1257 msgid "" @@ -1372,8 +1371,8 @@ msgid "" "You \"block\" attributes by deleting them. Once deleted, accessing an " "attribute will raise an :exc:`AttributeError`." msgstr "" -"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引" -"發 :exc:`AttributeError`。" +"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引發 :exc:" +"`AttributeError`。" #: ../../library/unittest.mock.rst:1331 msgid "Mock names and the name attribute" @@ -1383,8 +1382,8 @@ msgstr "Mock 名稱與名稱屬性" msgid "" "Since \"name\" is an argument to the :class:`Mock` constructor, if you want " "your mock object to have a \"name\" attribute you can't just pass it in at " -"creation time. There are two alternatives. One option is to " -"use :meth:`~Mock.configure_mock`::" +"creation time. There are two alternatives. One option is to use :meth:`~Mock." +"configure_mock`::" msgstr "" "由於 \"name\" 是傳遞給 :class:`Mock` 建構函式的引數,如果你想讓你的 mock 物件" "擁有 \"name\" 屬性,你不能在建立時直接傳遞它。有兩種替代方法。其中一個選擇是" @@ -1447,8 +1446,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1381 msgid "" "Mocks created for you by :func:`patch` are automatically given names. To " -"attach mocks that have names to a parent you use " -"the :meth:`~Mock.attach_mock` method::" +"attach mocks that have names to a parent you use the :meth:`~Mock." +"attach_mock` method::" msgstr "" "由 :func:`patch` 為你建立的 mock 會自動被賦予名稱。若要將具有名稱的 mock 附加" "到上代,你可以使用 :meth:`~Mock.attach_mock` 方法: ::" @@ -1490,10 +1489,10 @@ msgid "" "a new Mock object when it expects a magic method. If you need magic method " "support see :ref:`magic methods `." msgstr "" -"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引" -"發 :exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到" -"一個魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需" -"要魔術方法的支援,請參閱\\ :ref:`魔術方法 `。" +"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引發 :" +"exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到一個" +"魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需要魔" +"術方法的支援,請參閱\\ :ref:`魔術方法 `。" #: ../../library/unittest.mock.rst:1408 msgid "The patchers" @@ -1540,11 +1539,10 @@ msgid "" "If :func:`patch` is used as a context manager the created mock is returned " "by the context manager." msgstr "" -"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換" -"為 :class:`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做" -"為裝飾器使用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函" -"式。如果 :func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回" -"傳。" +"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換為 :class:" +"`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做為裝飾器使" +"用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函式。如果 :" +"func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回傳。" #: ../../library/unittest.mock.rst:1438 msgid "" @@ -1555,14 +1553,14 @@ msgid "" "function is executed, not at decoration time." msgstr "" "*target* 應該是以 ``'package.module.ClassName'`` 形式出現的字串。*target* 會" -"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼" -"叫 :func:`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝" -"飾器作用時 (decoration time)。" +"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼叫 :func:" +"`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝飾器作用" +"時 (decoration time)。" #: ../../library/unittest.mock.rst:1444 msgid "" -"The *spec* and *spec_set* keyword arguments are passed to " -"the :class:`MagicMock` if patch is creating one for you." +"The *spec* and *spec_set* keyword arguments are passed to the :class:" +"`MagicMock` if patch is creating one for you." msgstr "" "*spec* 和 *spec_set* 關鍵字引數會傳遞給 :class:`MagicMock`,如果 patch 正在為" "你建立一個。" @@ -1578,9 +1576,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1450 msgid "" "*new_callable* allows you to specify a different class, or callable object, " -"that will be called to create the *new* object. By " -"default :class:`AsyncMock` is used for async functions " -"and :class:`MagicMock` for the rest." +"that will be called to create the *new* object. By default :class:" +"`AsyncMock` is used for async functions and :class:`MagicMock` for the rest." msgstr "" "*new_callable* 允許你指定一個不同的類別或可呼叫的物件,用於被呼叫並建立 " "*new* 物件。預設情況下,對於非同步函式使用 :class:`AsyncMock`,而對於其他情況" @@ -1594,15 +1591,15 @@ msgid "" "attribute of the object being replaced. Methods and functions being mocked " "will have their arguments checked and will raise a :exc:`TypeError` if they " "are called with the wrong signature. For mocks replacing a class, their " -"return value (the 'instance') will have the same spec as the class. See " -"the :func:`create_autospec` function and :ref:`auto-speccing`." +"return value (the 'instance') will have the same spec as the class. See the :" +"func:`create_autospec` function and :ref:`auto-speccing`." msgstr "" "*spec* 的一種更強大的形式是 *autospec*。如果你設定 ``autospec=True``,則該 " "mock 將使用被替換物件的規格來建立。該 mock 的所有屬性也將具有被替換物件的對應" "屬性的規格。被 mock 的方法和函式將檢查其引數,如果呼叫時引數與規格不符(被使" "用錯誤的簽名 (signature) 呼叫),將引發 :exc:`TypeError`。對於替換類別的 " -"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參" -"閱 :func:`create_autospec` 函式和 :ref:`auto-speccing`。" +"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參閱 :func:" +"`create_autospec` 函式和 :ref:`auto-speccing`。" #: ../../library/unittest.mock.rst:1464 msgid "" @@ -1641,10 +1638,10 @@ msgid "" "Patch can be used as a :class:`~unittest.TestCase` class decorator. It works " "by decorating each test method in the class. This reduces the boilerplate " "code when your test methods share a common patchings set. :func:`patch` " -"finds tests by looking for method names that start with " -"``patch.TEST_PREFIX``. By default this is ``'test'``, which matches the " -"way :mod:`unittest` finds tests. You can specify an alternative prefix by " -"setting ``patch.TEST_PREFIX``." +"finds tests by looking for method names that start with ``patch." +"TEST_PREFIX``. By default this is ``'test'``, which matches the way :mod:" +"`unittest` finds tests. You can specify an alternative prefix by setting " +"``patch.TEST_PREFIX``." msgstr "" "patch 可以做為 :class:`~unittest.TestCase` 類別的裝飾器使用。它透過裝飾類別中" "的每個測試方法來運作。當你的測試方法共享一組常見的 patch 時,這會減少繁冗的代" @@ -1665,9 +1662,9 @@ msgstr "" #: ../../library/unittest.mock.rst:1493 msgid "" -":func:`patch` takes arbitrary keyword arguments. These will be passed " -"to :class:`AsyncMock` if the patched object is asynchronous, " -"to :class:`MagicMock` otherwise or to *new_callable* if specified." +":func:`patch` takes arbitrary keyword arguments. These will be passed to :" +"class:`AsyncMock` if the patched object is asynchronous, to :class:" +"`MagicMock` otherwise or to *new_callable* if specified." msgstr "" ":func:`patch` 接受任意的關鍵字引數。如果被 patch 的物件是非同步的,這些將會被" "傳遞給 :class:`AsyncMock`,如果是同步的則會傳遞給 :class:`MagicMock`,或如果" @@ -1707,18 +1704,18 @@ msgstr "" #: ../../library/unittest.mock.rst:1510 msgid "" "Patching a class replaces the class with a :class:`MagicMock` *instance*. If " -"the class is instantiated in the code under test then it will be " -"the :attr:`~Mock.return_value` of the mock that will be used." +"the class is instantiated in the code under test then it will be the :attr:" +"`~Mock.return_value` of the mock that will be used." msgstr "" "Patch 一個類別會以 :class:`MagicMock`\\ *實例*\\ 取代該類別。如果該類別在被" -"測試的程式碼中實例化,那麼它將是會被使用的 mock " -"的 :attr:`~Mock.return_value`。" +"測試的程式碼中實例化,那麼它將是會被使用的 mock 的 :attr:`~Mock." +"return_value`。" #: ../../library/unittest.mock.rst:1514 msgid "" -"If the class is instantiated multiple times you could " -"use :attr:`~Mock.side_effect` to return a new mock each time. Alternatively " -"you can set the *return_value* to be anything you want." +"If the class is instantiated multiple times you could use :attr:`~Mock." +"side_effect` to return a new mock each time. Alternatively you can set the " +"*return_value* to be anything you want." msgstr "" "如果該類別被實例化多次,你可以使用 :attr:`~Mock.side_effect` 來每次回傳一個新" "的 mock。 或者你可以將 *return_value* 設定成你想要的任何值。" @@ -1728,8 +1725,8 @@ msgid "" "To configure return values on methods of *instances* on the patched class " "you must do this on the :attr:`~Mock.return_value`. For example::" msgstr "" -"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須" -"在 :attr:`~Mock.return_value` 上進行配置。例如: ::" +"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須在 :attr:`~Mock." +"return_value` 上進行配置。例如: ::" #: ../../library/unittest.mock.rst:1521 msgid "" @@ -1870,16 +1867,16 @@ msgstr "" #: ../../library/unittest.mock.rst:1580 msgid "" -"As well as attributes on the created mock attributes, like " -"the :attr:`~Mock.return_value` and :attr:`~Mock.side_effect`, of child mocks " -"can also be configured. These aren't syntactically valid to pass in directly " -"as keyword arguments, but a dictionary with these as keys can still be " -"expanded into a :func:`patch` call using ``**``::" +"As well as attributes on the created mock attributes, like the :attr:`~Mock." +"return_value` and :attr:`~Mock.side_effect`, of child mocks can also be " +"configured. These aren't syntactically valid to pass in directly as keyword " +"arguments, but a dictionary with these as keys can still be expanded into a :" +"func:`patch` call using ``**``::" msgstr "" -"除了被建立的 mock 上的屬性外,還可以配置 child mock " -"的 :attr:`~Mock.return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能" -"直接作為關鍵字引數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一" -"個 :func:`patch` 呼叫: ::" +"除了被建立的 mock 上的屬性外,還可以配置 child mock 的 :attr:`~Mock." +"return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能直接作為關鍵字引" +"數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一個 :func:`patch` 呼" +"叫: ::" #: ../../library/unittest.mock.rst:1586 msgid "" @@ -1906,8 +1903,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1596 msgid "" "By default, attempting to patch a function in a module (or a method or an " -"attribute in a class) that does not exist will fail " -"with :exc:`AttributeError`::" +"attribute in a class) that does not exist will fail with :exc:" +"`AttributeError`::" msgstr "" "預設情況下,嘗試 patch 模組中不存在的函式(或類別中的方法或屬性)將會失敗,並" "引發 :exc:`AttributeError`: ::" @@ -1979,19 +1976,19 @@ msgstr "" msgid "" ":func:`patch.object` can be used as a decorator, class decorator or a " "context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* " -"and *new_callable* have the same meaning as for :func:`patch`. " -"Like :func:`patch`, :func:`patch.object` takes arbitrary keyword arguments " -"for configuring the mock object it creates." +"and *new_callable* have the same meaning as for :func:`patch`. Like :func:" +"`patch`, :func:`patch.object` takes arbitrary keyword arguments for " +"configuring the mock object it creates." msgstr "" ":func:`patch.object` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 *new*、" -"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與" -"在 :func:`patch` 中的引數具有相同的意義。與 :func:`patch` 一" -"樣,:func:`patch.object` 接受任意關鍵字引數來配置它所建立的 mock 物件。" +"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與在 :func:" +"`patch` 中的引數具有相同的意義。與 :func:`patch` 一樣,:func:`patch.object` " +"接受任意關鍵字引數來配置它所建立的 mock 物件。" #: ../../library/unittest.mock.rst:1636 msgid "" -"When used as a class decorator :func:`patch.object` honours " -"``patch.TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.object` honours ``patch." +"TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.object` 會遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" @@ -2031,7 +2028,9 @@ msgid "" "Patch a dictionary, or dictionary like object, and restore the dictionary to " "its original state after the test, where the restored dictionary is a copy " "of the dictionary as it was before the test." -msgstr "Patch 字典或類字典的物件,並在測試後將字典回復到其原本的狀態,其中回復的字典是測試前字典的複本。" +msgstr "" +"Patch 字典或類字典的物件,並在測試後將字典回復到其原本的狀態,其中回復的字典" +"是測試前字典的複本。" #: ../../library/unittest.mock.rst:1667 msgid "" @@ -2082,9 +2081,8 @@ msgstr ":func:`patch.dict` 可以做為情境管理器、裝飾器或類別裝 #: ../../library/unittest.mock.rst:1699 msgid "" -"When used as a class decorator :func:`patch.dict` honours " -"``patch.TEST_PREFIX`` (default to ``'test'``) for choosing which methods to " -"wrap:" +"When used as a class decorator :func:`patch.dict` honours ``patch." +"TEST_PREFIX`` (default to ``'test'``) for choosing which methods to wrap:" msgstr "" "當作為類別裝飾器使用時,:func:`patch.dict` 會遵循 ``patch.TEST_PREFIX``\\ " "(預設為 ``'test'``\\ )來選擇要包裝的方法:" @@ -2119,14 +2117,15 @@ msgid "" ":func:`patch.dict` can be used with dictionary like objects that aren't " "actually dictionaries. At the very minimum they must support item getting, " "setting, deleting and either iteration or membership test. This corresponds " -"to the magic " -"methods :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__` " -"and either :meth:`~container.__iter__` or :meth:`~object.__contains__`." +"to the magic methods :meth:`~object.__getitem__`, :meth:`~object." +"__setitem__`, :meth:`~object.__delitem__` and either :meth:`~container." +"__iter__` or :meth:`~object.__contains__`." msgstr "" ":func:`patch.dict` 可以與實際上不是字典的類字典物件一起使用。最低限度它們必須" -"支援項目的取得、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中" -"的 :meth:`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object.__delitem__` " -"以及 :meth:`~container.__iter__` 或 :meth:`~object.__contains__`。" +"支援項目的取得、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中的 :meth:" +"`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object." +"__delitem__` 以及 :meth:`~container.__iter__` 或 :meth:`~object." +"__contains__`。" #: ../../library/unittest.mock.rst:1775 msgid "patch.multiple" @@ -2153,12 +2152,12 @@ msgstr "" msgid "" "Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to " "create mocks for you. In this case the created mocks are passed into a " -"decorated function by keyword, and a dictionary is returned " -"when :func:`patch.multiple` is used as a context manager." +"decorated function by keyword, and a dictionary is returned when :func:" +"`patch.multiple` is used as a context manager." msgstr "" "如果你想要 :func:`patch.multiple` 為你建立 mock,請使用 :data:`DEFAULT` 作為" -"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且" -"當 :func:`patch.multiple` 作為情境管理器時會回傳字典。" +"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且當 :" +"func:`patch.multiple` 作為情境管理器時會回傳字典。" #: ../../library/unittest.mock.rst:1791 msgid "" @@ -2168,14 +2167,14 @@ msgid "" "will be applied to *all* patches done by :func:`patch.multiple`." msgstr "" ":func:`patch.multiple` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 " -"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與" -"在 :func:`patch` 中的引數具有相同的意義。這些引數將應用於" -"由 :func:`patch.multiple` 完成的\\ *所有* patch。" +"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與在 :func:" +"`patch` 中的引數具有相同的意義。這些引數將應用於由 :func:`patch.multiple` 完" +"成的\\ *所有* patch。" #: ../../library/unittest.mock.rst:1796 msgid "" -"When used as a class decorator :func:`patch.multiple` honours " -"``patch.TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.multiple` honours ``patch." +"TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.multiple` 遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" @@ -2187,9 +2186,9 @@ msgid "" "decorator then the created mocks are passed into the decorated function by " "keyword. ::" msgstr "" -"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使" -"用 :data:`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼" -"被建立的 mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" +"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使用 :data:" +"`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼被建立的 " +"mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" #: ../../library/unittest.mock.rst:1803 msgid "" @@ -2290,9 +2289,9 @@ msgid "" "then call :meth:`!start` to put the patch in place and :meth:`!stop` to undo " "it." msgstr "" -"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` " -"或 :func:`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼" -"叫 :meth:`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" +"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` 或 :func:" +"`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼叫 :meth:" +"`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" #: ../../library/unittest.mock.rst:1849 msgid "" @@ -2372,8 +2371,8 @@ msgstr "" msgid "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " -"exception is raised in the ``setUp`` then ``tearDown`` is not " -"called. :meth:`unittest.TestCase.addCleanup` makes this easier::" +"exception is raised in the ``setUp`` then ``tearDown`` is not called. :meth:" +"`unittest.TestCase.addCleanup` makes this easier::" msgstr "" "如果你使用這個技巧,你必須確保透過呼叫 ``stop`` 來 \"取消\" patch。這可能會比" "你想像的還要複雜一點,因為如果有例外在 ``setUp`` 中被引發,則 ``tearDown`` 就" @@ -2409,8 +2408,8 @@ msgstr "作為額外的好處,你不再需要保留對 ``patcher`` 物件的 #: ../../library/unittest.mock.rst:1903 msgid "" -"It is also possible to stop all patches which have been started by " -"using :func:`patch.stopall`." +"It is also possible to stop all patches which have been started by using :" +"func:`patch.stopall`." msgstr "也可以使用 :func:`patch.stopall` 來停止所有已啟動的 patch。" #: ../../library/unittest.mock.rst:1908 @@ -2458,14 +2457,14 @@ msgid "" "the :class:`unittest.TestLoader` finds test methods by default." msgstr "" "所有 patcher 都可以作為類別裝飾器使用。以這種方式使用時,它們包裝了類別上的每" -"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這" -"與 :class:`unittest.TestLoader` 預設尋找測試方法的方式相同。" +"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這與 :class:" +"`unittest.TestLoader` 預設尋找測試方法的方式相同。" #: ../../library/unittest.mock.rst:1937 msgid "" "It is possible that you want to use a different prefix for your tests. You " -"can inform the patchers of the different prefix by setting " -"``patch.TEST_PREFIX``::" +"can inform the patchers of the different prefix by setting ``patch." +"TEST_PREFIX``::" msgstr "" "你可能會想為你的測試使用不同的前綴。你可以透過設定 ``patch.TEST_PREFIX`` 來告" "知 patcher 使用不同的前綴: ::" @@ -2580,10 +2579,10 @@ msgstr "" msgid "" "Now we want to test ``some_function`` but we want to mock out ``SomeClass`` " "using :func:`patch`. The problem is that when we import module b, which we " -"will have to do when it imports ``SomeClass`` from module a. If we " -"use :func:`patch` to mock out ``a.SomeClass`` then it will have no effect on " -"our test; module b already has a reference to the *real* ``SomeClass`` and " -"it looks like our patching had no effect." +"will have to do when it imports ``SomeClass`` from module a. If we use :func:" +"`patch` to mock out ``a.SomeClass`` then it will have no effect on our test; " +"module b already has a reference to the *real* ``SomeClass`` and it looks " +"like our patching had no effect." msgstr "" "現在我們想要測試 ``some_function``,但我們想使用 :func:`patch` mock " "``SomeClass``。問題是,當我們 import 模組 b 時(我們必須這樣做),它會從模組 " @@ -2609,10 +2608,10 @@ msgstr "@patch('b.SomeClass')" #: ../../library/unittest.mock.rst:2022 msgid "" "However, consider the alternative scenario where instead of ``from a import " -"SomeClass`` module b does ``import a`` and ``some_function`` uses " -"``a.SomeClass``. Both of these import forms are common. In this case the " -"class we want to patch is being looked up in the module and so we have to " -"patch ``a.SomeClass`` instead::" +"SomeClass`` module b does ``import a`` and ``some_function`` uses ``a." +"SomeClass``. Both of these import forms are common. In this case the class " +"we want to patch is being looked up in the module and so we have to patch " +"``a.SomeClass`` instead::" msgstr "" "然而,考慮另一種情況,其中模組 b 並不是使用 ``from a import SomeClass``,而" "是 ``import a``,然後 ``some_function`` 使用 ``a.SomeClass``。這兩種 import " @@ -2632,14 +2631,14 @@ msgid "" "Both patch_ and patch.object_ correctly patch and restore descriptors: class " "methods, static methods and properties. You should patch these on the " "*class* rather than an instance. They also work with *some* objects that " -"proxy attribute access, like the `django settings object `_." msgstr "" "patch_ 和 patch.object_ 都正確地 patch 和還原描述器:類別方法、靜態方法以及屬" "性。你應該在 *類別* 而不是實例上 patch 它們。它們還可以使用代理屬性存取的\\ *" -"一些*\\ 物件,例如 `django 設定物件 `_。" #: ../../library/unittest.mock.rst:2041 @@ -2652,9 +2651,9 @@ msgstr "Mock 魔術方法" #: ../../library/unittest.mock.rst:2048 msgid "" -":class:`Mock` supports mocking the Python protocol methods, also known " -"as :term:`\"magic methods\" `. This allows mock objects to " -"replace containers or other objects that implement Python protocols." +":class:`Mock` supports mocking the Python protocol methods, also known as :" +"term:`\"magic methods\" `. This allows mock objects to replace " +"containers or other objects that implement Python protocols." msgstr "" ":class:`Mock` 支援 mock Python 協定方法,其也被稱作 :term:`\"魔術方法\" " "`。這允許 mock 物件替換容器或實作 Python 協定的其他物件。" @@ -2681,8 +2680,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2080 msgid "" -"One use case for this is for mocking objects used as context managers in " -"a :keyword:`with` statement:" +"One use case for this is for mocking objects used as context managers in a :" +"keyword:`with` statement:" msgstr "一個用法是在 :keyword:`with` 陳述式中 mock 作為情境管理器使用的物件:" #: ../../library/unittest.mock.rst:2092 @@ -2690,14 +2689,14 @@ msgid "" "Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they " "are recorded in :attr:`~Mock.mock_calls`." msgstr "" -"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄" -"在 :attr:`~Mock.mock_calls` 內。" +"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄在 :" +"attr:`~Mock.mock_calls` 內。" #: ../../library/unittest.mock.rst:2097 msgid "" "If you use the *spec* keyword argument to create a mock then attempting to " -"set a magic method that isn't in the spec will raise " -"an :exc:`AttributeError`." +"set a magic method that isn't in the spec will raise an :exc:" +"`AttributeError`." msgstr "" "如果你使用\\ *spec*\\ 關鍵字引數來建立一個 mock,則嘗試設定規格中未包含的魔術" "方法將引發一個 :exc:`AttributeError`。" @@ -2822,11 +2821,11 @@ msgstr "Magic Mock" #: ../../library/unittest.mock.rst:2142 msgid "" -"There are two ``MagicMock`` variants: :class:`MagicMock` " -"and :class:`NonCallableMagicMock`." +"There are two ``MagicMock`` variants: :class:`MagicMock` and :class:" +"`NonCallableMagicMock`." msgstr "" -"``MagicMock`` 有兩個變體::class:`MagicMock` " -"和 :class:`NonCallableMagicMock`。" +"``MagicMock`` 有兩個變體::class:`MagicMock` 和 :class:" +"`NonCallableMagicMock`。" #: ../../library/unittest.mock.rst:2147 msgid "" @@ -2961,13 +2960,13 @@ msgstr "舉例來說:" #: ../../library/unittest.mock.rst:2213 msgid "" "The two equality methods, :meth:`!__eq__` and :meth:`!__ne__`, are special. " -"They do the default equality comparison on identity, using " -"the :attr:`~Mock.side_effect` attribute, unless you change their return " -"value to return something else::" +"They do the default equality comparison on identity, using the :attr:`~Mock." +"side_effect` attribute, unless you change their return value to return " +"something else::" msgstr "" -":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使" -"用 :attr:`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非" -"你變更它們的回傳值以回傳其他內容: ::" +":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使用 :attr:" +"`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非你變更它" +"們的回傳值以回傳其他內容: ::" #: ../../library/unittest.mock.rst:2218 msgid "" @@ -3091,8 +3090,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2285 msgid "" -"The ``sentinel`` attributes now preserve their identity when they " -"are :mod:`copied ` or :mod:`pickled `." +"The ``sentinel`` attributes now preserve their identity when they are :mod:" +"`copied ` or :mod:`pickled `." msgstr "" "``哨兵``\\ 屬性現在當被\\ :mod:`複製 `\\ 或\\ :mod:`序列化 `\\ " "時會保留其識別性。" @@ -3110,8 +3109,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2294 msgid "" -"In this example we monkey patch ``method`` to return " -"``sentinel.some_object``:" +"In this example we monkey patch ``method`` to return ``sentinel." +"some_object``:" msgstr "" "在這個例子中,我們 monkey patch ``method`` 以回傳 ``sentinel.some_object``:" @@ -3121,13 +3120,13 @@ msgstr "DEFAULT" #: ../../library/unittest.mock.rst:2311 msgid "" -"The :data:`DEFAULT` object is a pre-created sentinel (actually " -"``sentinel.DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions " -"to indicate that the normal return value should be used." +"The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel." +"DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to " +"indicate that the normal return value should be used." msgstr "" -":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 " -"``sentinel.DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示" -"正常的回傳值應該被使用。" +":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 ``sentinel." +"DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示正常的回傳值" +"應該被使用。" #: ../../library/unittest.mock.rst:2317 msgid "call" @@ -3136,13 +3135,14 @@ msgstr "call" #: ../../library/unittest.mock.rst:2321 msgid "" ":func:`call` is a helper object for making simpler assertions, for comparing " -"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock.mock_calls` " -"and :attr:`~Mock.method_calls`. :func:`call` can also be used " +"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock." +"mock_calls` and :attr:`~Mock.method_calls`. :func:`call` can also be used " "with :meth:`~Mock.assert_has_calls`." msgstr "" -"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock.mock_calls` " -"和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更簡單的斷言的" -"輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一起使用。" +"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock." +"mock_calls` 和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更" +"簡單的斷言的輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一" +"起使用。" #: ../../library/unittest.mock.rst:2334 msgid "" @@ -3174,24 +3174,22 @@ msgid "" "A ``call`` object is either a tuple of (positional args, keyword args) or " "(name, positional args, keyword args) depending on how it was constructed. " "When you construct them yourself this isn't particularly interesting, but " -"the ``call`` objects that are in " -"the :attr:`Mock.call_args`, :attr:`Mock.call_args_list` " -"and :attr:`Mock.mock_calls` attributes can be introspected to get at the " -"individual arguments they contain." +"the ``call`` objects that are in the :attr:`Mock.call_args`, :attr:`Mock." +"call_args_list` and :attr:`Mock.mock_calls` attributes can be introspected " +"to get at the individual arguments they contain." msgstr "" "取決於它的建構方式,一個 ``call`` 物件會是(位置引數, 關鍵字引數)的元組,或" "是 (名稱, 位置引數, 關鍵字引數) 的元組。當你自己建構它們時,這並不是那麼有" -"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` " -"和 :attr:`Mock.mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各" -"個引數。" +"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` 和 :attr:`Mock." +"mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各個引數。" #: ../../library/unittest.mock.rst:2367 msgid "" -"The ``call`` objects in :attr:`Mock.call_args` " -"and :attr:`Mock.call_args_list` are two-tuples of (positional args, keyword " -"args) whereas the ``call`` objects in :attr:`Mock.mock_calls`, along with " -"ones you construct yourself, are three-tuples of (name, positional args, " -"keyword args)." +"The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock." +"call_args_list` are two-tuples of (positional args, keyword args) whereas " +"the ``call`` objects in :attr:`Mock.mock_calls`, along with ones you " +"construct yourself, are three-tuples of (name, positional args, keyword " +"args)." msgstr "" ":attr:`Mock.call_args` 和 :attr:`Mock.call_args_list` 中的 ``call`` 物件是" "(位置引數, 關鍵字引數)的二元組,而 :attr:`Mock.mock_calls` 中的 ``call`` 物" @@ -3230,8 +3228,8 @@ msgid "" "If *spec_set* is ``True`` then attempting to set attributes that don't exist " "on the spec object will raise an :exc:`AttributeError`." msgstr "" -"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引" -"發 :exc:`AttributeError`。" +"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引發 :exc:" +"`AttributeError`。" #: ../../library/unittest.mock.rst:2419 msgid "" @@ -3254,8 +3252,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2427 msgid "" -"See :ref:`auto-speccing` for examples of how to use auto-speccing " -"with :func:`create_autospec` and the *autospec* argument to :func:`patch`." +"See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:" +"`create_autospec` and the *autospec* argument to :func:`patch`." msgstr "" "請參閱 :ref:`auto-speccing` 以得知如何以 :func:`create_autospec` 使用自動規格" "以及如何在 :func:`patch` 中使用 *autospec* 引數的範例。" @@ -3265,8 +3263,8 @@ msgid "" ":func:`create_autospec` now returns an :class:`AsyncMock` if the target is " "an async function." msgstr "" -"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一" -"個 :class:`AsyncMock`。" +"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一個 :class:" +"`AsyncMock`。" #: ../../library/unittest.mock.rst:2438 msgid "ANY" @@ -3285,18 +3283,17 @@ msgstr "" #: ../../library/unittest.mock.rst:2447 msgid "" "To ignore certain arguments you can pass in objects that compare equal to " -"*everything*. Calls to :meth:`~Mock.assert_called_with` " -"and :meth:`~Mock.assert_called_once_with` will then succeed no matter what " -"was passed in." +"*everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock." +"assert_called_once_with` will then succeed no matter what was passed in." msgstr "" "要忽略某些引數,你可以傳入對\\ *所有物件*\\ 來說都相等的物件。那麼無論傳入什" -"麼內容,對 :meth:`~Mock.assert_used_with` " -"和 :meth:`~Mock.assert_used_once_with` 的呼叫都會成功。" +"麼內容,對 :meth:`~Mock.assert_used_with` 和 :meth:`~Mock." +"assert_used_once_with` 的呼叫都會成功。" #: ../../library/unittest.mock.rst:2456 msgid "" -":data:`ANY` can also be used in comparisons with call lists " -"like :attr:`~Mock.mock_calls`:" +":data:`ANY` can also be used in comparisons with call lists like :attr:" +"`~Mock.mock_calls`:" msgstr "" ":data:`ANY` 也可以用來與呼叫串列進行比較,例如 :attr:`~Mock.mock_calls`:" @@ -3329,8 +3326,8 @@ msgid "" ":data:`FILTER_DIR` is a module level variable that controls the way mock " "objects respond to :func:`dir`. The default is ``True``, which uses the " "filtering described below, to only show useful members. If you dislike this " -"filtering, or need to switch it off for diagnostic purposes, then set " -"``mock.FILTER_DIR = False``." +"filtering, or need to switch it off for diagnostic purposes, then set ``mock." +"FILTER_DIR = False``." msgstr "" ":data:`FILTER_DIR` 是一個模組級別的變數,用於控制 mock 物件回應 :func:`dir` " "的方式。其預設值為 ``True``,它使用以下描述的過濾方式來只顯示有用的成員。如果" @@ -3432,8 +3429,8 @@ msgid "" "of :const:`FILTER_DIR`." msgstr "" "或者,你可以只使用 ``vars(my_mock)``\\ (實例成員)和 " -"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考" -"慮 :const:`FILTER_DIR`。" +"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考慮 :const:" +"`FILTER_DIR`。" #: ../../library/unittest.mock.rst:2541 msgid "mock_open" @@ -3458,25 +3455,23 @@ msgstr "" #: ../../library/unittest.mock.rst:2552 msgid "" -"*read_data* is a string for " -"the :meth:`~io.RawIOBase.read`, :meth:`~io.IOBase.readline`, " -"and :meth:`~io.IOBase.readlines` methods of the file handle to return. " -"Calls to those methods will take data from *read_data* until it is " -"depleted. The mock of these methods is pretty simplistic: every time the " -"*mock* is called, the *read_data* is rewound to the start. If you need more " -"control over the data that you are feeding to the tested code you will need " -"to customize this mock for yourself. When that is insufficient, one of the " -"in-memory filesystem packages on `PyPI `_ can offer a " -"realistic filesystem for testing." -msgstr "" -"*read_data* 是檔案處理方" -"法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase.readline` " -"和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 *read_data* " -"取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 *mock* 時," -"*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行更多控制," -"你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的" -"其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測試的真實檔" -"案系統。" +"*read_data* is a string for the :meth:`~io.RawIOBase.read`, :meth:`~io." +"IOBase.readline`, and :meth:`~io.IOBase.readlines` methods of the file " +"handle to return. Calls to those methods will take data from *read_data* " +"until it is depleted. The mock of these methods is pretty simplistic: every " +"time the *mock* is called, the *read_data* is rewound to the start. If you " +"need more control over the data that you are feeding to the tested code you " +"will need to customize this mock for yourself. When that is insufficient, " +"one of the in-memory filesystem packages on `PyPI `_ can " +"offer a realistic filesystem for testing." +msgstr "" +"*read_data* 是檔案處理方法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase." +"readline` 和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 " +"*read_data* 取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 " +"*mock* 時,*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行" +"更多控制,你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測" +"試的真實檔案系統。" #: ../../library/unittest.mock.rst:2562 msgid "" @@ -3484,9 +3479,9 @@ msgid "" "The mock of :meth:`~io.RawIOBase.read` changed to consume *read_data* rather " "than returning it on each call." msgstr "" -"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支" -"援。:meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼" -"叫時回傳它。" +"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支援。:" +"meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼叫時回" +"傳它。" #: ../../library/unittest.mock.rst:2567 msgid "*read_data* is now reset on each call to the *mock*." @@ -3519,8 +3514,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2580 msgid "" "The issue is that even if you mock out the call to :func:`open` it is the " -"*returned object* that is used as a context manager (and " -"has :meth:`~object.__enter__` and :meth:`~object.__exit__` called)." +"*returned object* that is used as a context manager (and has :meth:`~object." +"__enter__` and :meth:`~object.__exit__` called)." msgstr "" "問題是,即使你 mock 了對 :func:`open` 的呼叫,它也是作為情境管理器使用的\\ *" "回傳物件*\\ (且其 :meth:`~object.__enter__` 和 :meth:`~ object.__exit__` 已" @@ -3594,8 +3589,8 @@ msgid "" "limits the api of mocks to the api of an original object (the spec), but it " "is recursive (implemented lazily) so that attributes of mocks only have the " "same api as the attributes of the spec. In addition mocked functions / " -"methods have the same call signature as the original so they raise " -"a :exc:`TypeError` if they are called incorrectly." +"methods have the same call signature as the original so they raise a :exc:" +"`TypeError` if they are called incorrectly." msgstr "" "自動規格以 mock 現有的 :attr:`!spec` 功能作為基礎。它將 mock 的 api 限制為原" "始物件(規格)的 api,但它是遞迴的(惰性 (lazily) 實現),因此 mock 的屬性僅" @@ -3666,8 +3661,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2661 msgid "" -"Auto-speccing solves this problem. You can either pass ``autospec=True`` " -"to :func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " +"Auto-speccing solves this problem. You can either pass ``autospec=True`` to :" +"func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " "function to create a mock with a spec. If you use the ``autospec=True`` " "argument to :func:`patch` then the object that is being replaced will be " "used as the spec object. Because the speccing is done \"lazily\" (the spec " @@ -3675,12 +3670,12 @@ msgid "" "complex or deeply nested objects (like modules that import modules that " "import modules) without a big performance hit." msgstr "" -"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞" -"給 :func:`patch` / :func:`patch.object` 或使用 :func:`create_autospec` 函式建" -"立帶有規格的 mock。如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取" -"代的物件將作為規格物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時" -"作為屬性被建立的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引" -"用的模組)一起使用,而不會過於影響性能。" +"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞給 :func:`patch` / :" +"func:`patch.object` 或使用 :func:`create_autospec` 函式建立帶有規格的 mock。" +"如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取代的物件將作為規格" +"物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時作為屬性被建立" +"的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引用的模組)一起" +"使用,而不會過於影響性能。" #: ../../library/unittest.mock.rst:2670 msgid "Here's an example of it in use::" @@ -3706,9 +3701,9 @@ msgstr "" #: ../../library/unittest.mock.rst:2680 msgid "" -"You can see that :class:`!request.Request` has a spec. :class:`!" -"request.Request` takes two arguments in the constructor (one of which is " -"*self*). Here's what happens if we try to call it incorrectly::" +"You can see that :class:`!request.Request` has a spec. :class:`!request." +"Request` takes two arguments in the constructor (one of which is *self*). " +"Here's what happens if we try to call it incorrectly::" msgstr "" "你可以看到 :class:`!request.Request` 有一個規格。:class:`!request.Request` 在" "建構函式中接受兩個引數(其中之一是 *self*\\ )。如果我們錯誤地呼叫它,會發生" @@ -3782,11 +3777,11 @@ msgstr "" #: ../../library/unittest.mock.rst:2712 msgid "" -"As well as using *autospec* through :func:`patch` there is " -"a :func:`create_autospec` for creating autospecced mocks directly:" +"As well as using *autospec* through :func:`patch` there is a :func:" +"`create_autospec` for creating autospecced mocks directly:" msgstr "" -"除了透過 :func:`patch` 使用 *autospec* 之外,還有一" -"個 :func:`create_autospec` 用於直接建立有自動規格的 mock:" +"除了透過 :func:`patch` 使用 *autospec* 之外,還有一個 :func:" +"`create_autospec` 用於直接建立有自動規格的 mock:" #: ../../library/unittest.mock.rst:2720 msgid "" @@ -4028,11 +4023,11 @@ msgstr "*wraps*" #: ../../library/unittest.mock.rst:2858 msgid "" -"If all three are set, mock will return the value " -"from :attr:`~Mock.side_effect`, ignoring :attr:`~Mock.return_value` and the " -"wrapped object altogether. If any two are set, the one with the higher " -"precedence will return the value. Regardless of the order of which was set " -"first, the order of precedence remains unchanged." +"If all three are set, mock will return the value from :attr:`~Mock." +"side_effect`, ignoring :attr:`~Mock.return_value` and the wrapped object " +"altogether. If any two are set, the one with the higher precedence will " +"return the value. Regardless of the order of which was set first, the order " +"of precedence remains unchanged." msgstr "" "如果這三個都有設定,mock 將會回傳來自 :attr:`~Mock.side_effect` 的值,並忽" "略 :attr:`~Mock.return_value` 和被包裝物件。如果設定了任兩項,則優先順序較高" @@ -4042,8 +4037,8 @@ msgstr "" msgid "" "As ``None`` is the default value of :attr:`~Mock.side_effect`, if you " "reassign its value back to ``None``, the order of precedence will be checked " -"between :attr:`~Mock.return_value` and the wrapped object, " -"ignoring :attr:`~Mock.side_effect`." +"between :attr:`~Mock.return_value` and the wrapped object, ignoring :attr:" +"`~Mock.side_effect`." msgstr "" "由於 ``None`` 是 :attr:`~Mock.side_effect` 的預設值,如果將其值重新賦值回為 " "``None``,則會檢查 :attr:`~Mock.return_value` 和被包裝物件之間的優先順序,忽" @@ -4060,11 +4055,11 @@ msgstr "" #: ../../library/unittest.mock.rst:2894 msgid "" -"When :class:`Mock` wraps an object, the default value " -"of :attr:`~Mock.return_value` will be :data:`DEFAULT`." +"When :class:`Mock` wraps an object, the default value of :attr:`~Mock." +"return_value` will be :data:`DEFAULT`." msgstr "" -"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將" -"為 :data:`DEFAULT`。" +"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將為 :" +"data:`DEFAULT`。" #: ../../library/unittest.mock.rst:2903 msgid "" diff --git a/library/venv.po b/library/venv.po index 40603b46efd..6d31e24cc26 100644 --- a/library/venv.po +++ b/library/venv.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2025-05-23 10:20+0800\n" "Last-Translator: Dr-XYZ \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -40,12 +40,12 @@ msgid "" "environments` and :mod:`site`'s :ref:`virtual environments documentation " "` for more information." msgstr "" -":mod:`!venv` 模組支援建立輕量級的「虛擬環境」,每個虛擬環境都有獨立安裝在" -"其 :mod:`site` 目錄中的一組 Python 套件。虛擬環境是建立在既有的 Python 安裝上" -"(稱為該虛擬環境的「基底」Python)之上,預設會與基底環境中的套件隔離,使得僅" -"能存取明確安裝在虛擬環境中的套件。更多資訊請參閱 :ref:`sys-path-init-virtual-" -"environments` 以及 :mod:`site` 的\\ :ref:`虛擬環境文件 `。" +":mod:`!venv` 模組支援建立輕量級的「虛擬環境」,每個虛擬環境都有獨立安裝在其 :" +"mod:`site` 目錄中的一組 Python 套件。虛擬環境是建立在既有的 Python 安裝上(稱" +"為該虛擬環境的「基底」Python)之上,預設會與基底環境中的套件隔離,使得僅能存" +"取明確安裝在虛擬環境中的套件。更多資訊請參閱 :ref:`sys-path-init-virtual-" +"environments` 以及 :mod:`site` 的\\ :ref:`虛擬環境文件 `。" #: ../../library/venv.rst:32 msgid "" @@ -142,20 +142,20 @@ msgstr "python -m venv /path/to/new/virtual/environment" msgid "" "This creates the target directory (including parent directories as needed) " "and places a :file:`pyvenv.cfg` file in it with a ``home`` key pointing to " -"the Python installation from which the command was run. It also creates " -"a :file:`bin` (or :file:`Scripts` on Windows) subdirectory containing a copy " -"or symlink of the Python executable (as appropriate for the platform or " +"the Python installation from which the command was run. It also creates a :" +"file:`bin` (or :file:`Scripts` on Windows) subdirectory containing a copy or " +"symlink of the Python executable (as appropriate for the platform or " "arguments used at environment creation time). It also creates a :file:`lib/" -"pythonX.Y/site-packages` subdirectory (on Windows, this is :file:`Lib\\site-" -"packages`). If an existing directory is specified, it will be re-used." +"pythonX.Y/site-packages` subdirectory (on Windows, this is :file:`Lib\\" +"\\site-packages`). If an existing directory is specified, it will be re-used." msgstr "" "執行此命令會建立目標目錄(同時也會建立任何還不存在的父目錄)並在目錄中放置一" "個名為 :file:`pyvenv.cfg` 的檔案,其中包含一個指向執行該命令的 Python 安裝路" -"徑的 ``home`` 鍵。它同時會建立一個 :file:`bin` (在 Windows 上" -"為 :file:`Scripts`)子目錄,其中包含一個 Python 二進位檔案的副本/符號連結(根" -"據建立環境時使用的平台或引數而定)。此外,它還會建立一個 :file:`lib/" -"pythonX.Y/site-packages` 子目錄(在 Windows 上為 :file:`Lib\\site-" -"packages`)。如果指定的目錄已存在,則將重新使用該目錄。" +"徑的 ``home`` 鍵。它同時會建立一個 :file:`bin` (在 Windows 上為 :file:" +"`Scripts`)子目錄,其中包含一個 Python 二進位檔案的副本/符號連結(根據建立環" +"境時使用的平台或引數而定)。此外,它還會建立一個 :file:`lib/pythonX.Y/site-" +"packages` 子目錄(在 Windows 上為 :file:`Lib\\\\site-packages`)。如果指定的目" +"錄已存在,則將重新使用該目錄。" #: ../../library/venv.rst:84 msgid "" @@ -297,8 +297,8 @@ msgid "" "script by setting the execution policy for the user. You can do this by " "issuing the following PowerShell command:" msgstr "" -"在 Microsoft Windows 上,可能需要通過設置使用者的執行策略來啟用 " -"``Activate.ps1`` 腳本。你可以發出以下 PowerShell 命令來執行此操作:" +"在 Microsoft Windows 上,可能需要通過設置使用者的執行策略來啟用 ``Activate." +"ps1`` 腳本。你可以發出以下 PowerShell 命令來執行此操作:" #: ../../library/venv.rst:186 msgid "" @@ -347,18 +347,17 @@ msgstr "虛擬環境如何運作" #: ../../library/venv.rst:210 msgid "" -"When a Python interpreter is running from a virtual " -"environment, :data:`sys.prefix` and :data:`sys.exec_prefix` point to the " -"directories of the virtual environment, whereas :data:`sys.base_prefix` " -"and :data:`sys.base_exec_prefix` point to those of the base Python used to " -"create the environment. It is sufficient to check ``sys.prefix != " -"sys.base_prefix`` to determine if the current interpreter is running from a " -"virtual environment." +"When a Python interpreter is running from a virtual environment, :data:`sys." +"prefix` and :data:`sys.exec_prefix` point to the directories of the virtual " +"environment, whereas :data:`sys.base_prefix` and :data:`sys." +"base_exec_prefix` point to those of the base Python used to create the " +"environment. It is sufficient to check ``sys.prefix != sys.base_prefix`` to " +"determine if the current interpreter is running from a virtual environment." msgstr "" -"當 Python 直譯器跑在虛擬環境時,:data:`sys.prefix` " -"和 :data:`sys.exec_prefix` 會指向虛擬環境的目錄,而 :data:`sys.base_prefix` " -"和 :data:`sys.base_exec_prefix` 會指向建立虛擬環境的基礎 Python 的目錄。檢查 " -"``sys.prefix != sys.base_prefix`` 就可以確定目前的直譯器是否跑在虛擬環境中。" +"當 Python 直譯器跑在虛擬環境時,:data:`sys.prefix` 和 :data:`sys." +"exec_prefix` 會指向虛擬環境的目錄,而 :data:`sys.base_prefix` 和 :data:`sys." +"base_exec_prefix` 會指向建立虛擬環境的基礎 Python 的目錄。檢查 ``sys.prefix !" +"= sys.base_prefix`` 就可以確定目前的直譯器是否跑在虛擬環境中。" #: ../../library/venv.rst:219 msgid "" @@ -468,21 +467,20 @@ msgstr "" #: ../../library/venv.rst:257 msgid "" "In order to achieve this, scripts installed into virtual environments have a " -"\"shebang\" line which points to the environment's Python " -"interpreter, :samp:`#!/{}/bin/python`. This means that the " -"script will run with that interpreter regardless of the value " -"of :envvar:`PATH`. On Windows, \"shebang\" line processing is supported if " -"you have the :ref:`launcher` installed. Thus, double-clicking an installed " -"script in a Windows Explorer window should run it with the correct " -"interpreter without the environment needing to be activated or on " -"the :envvar:`PATH`." +"\"shebang\" line which points to the environment's Python interpreter, :samp:" +"`#!/{}/bin/python`. This means that the script will run with " +"that interpreter regardless of the value of :envvar:`PATH`. On Windows, " +"\"shebang\" line processing is supported if you have the :ref:`launcher` " +"installed. Thus, double-clicking an installed script in a Windows Explorer " +"window should run it with the correct interpreter without the environment " +"needing to be activated or on the :envvar:`PATH`." msgstr "" "為了實現這一點,安裝在虛擬環境中的腳本會有一個 \"shebang\" 列,此列指向該環境" -"的 Python 直譯器 :samp:`#!/{}/bin/python`。這代表無" -"論 :envvar:`PATH` 的值為何,該腳本都會在直譯器上運行。在 Windows 上,如果你安" -"裝了 :ref:`launcher`,則支援 \"shebang\" 列處理。因此,在 Windows 檔案總管" -"(Windows Explorer)中雙擊已安裝的腳本,應該可以在沒有啟用環境或將其加" -"入 :envvar:`PATH` 的情況下正確地運行。" +"的 Python 直譯器 :samp:`#!/{}/bin/python`。這代表無論 :envvar:" +"`PATH` 的值為何,該腳本都會在直譯器上運行。在 Windows 上,如果你安裝了 :ref:" +"`launcher`,則支援 \"shebang\" 列處理。因此,在 Windows 檔案總管(Windows " +"Explorer)中雙擊已安裝的腳本,應該可以在沒有啟用環境或將其加入 :envvar:" +"`PATH` 的情況下正確地運行。" #: ../../library/venv.rst:266 msgid "" @@ -513,12 +511,11 @@ msgid "" msgstr "" "因為安裝在環境中的腳本不應該預期該環境已經被啟動,所以它們的 shebang 列會包含" "環境直譯器的絕對路徑。因此,在一般情況下,環境本質上是不可攜帶的。你應該使用" -"一個簡單的方法來重新建立一個環境(例如:如果你有一個名為 " -"``requirements.txt`` 的需求檔案,你可以使用環境的 ``pip install -r " -"requirements.txt`` 來安裝環境所需的所有套件)。如果出於某種原因,你需要將環境" -"移至新位置,你應該在所需位置重新建立它,並刪除舊位置的環境。如果你移動環境是" -"因為移動了其父目錄,你應該在新位置重新建立環境。否則,安裝在該環境中的軟體可" -"能無法正常運作。" +"一個簡單的方法來重新建立一個環境(例如:如果你有一個名為 ``requirements." +"txt`` 的需求檔案,你可以使用環境的 ``pip install -r requirements.txt`` 來安裝" +"環境所需的所有套件)。如果出於某種原因,你需要將環境移至新位置,你應該在所需" +"位置重新建立它,並刪除舊位置的環境。如果你移動環境是因為移動了其父目錄,你應" +"該在新位置重新建立環境。否則,安裝在該環境中的軟體可能無法正常運作。" #: ../../library/venv.rst:286 msgid "" @@ -537,8 +534,8 @@ msgstr "API" msgid "" "The high-level method described above makes use of a simple API which " "provides mechanisms for third-party virtual environment creators to " -"customize environment creation according to their needs, " -"the :class:`EnvBuilder` class." +"customize environment creation according to their needs, the :class:" +"`EnvBuilder` class." msgstr "" "上述提到的高階 method(方法)透過簡單的 API 使用, 為第三方虛擬環境建立者提供" "可以依據他們需求來建立環境的客製化機制: :class:`EnvBuilder` class。" @@ -684,13 +681,12 @@ msgstr "" #: ../../library/venv.rst:377 msgid "" -"Each of the " -"methods :meth:`ensure_directories`, :meth:`create_configuration`, :meth:`setup_python`, :meth:`setup_scripts` " -"and :meth:`post_setup` can be overridden." +"Each of the methods :meth:`ensure_directories`, :meth:" +"`create_configuration`, :meth:`setup_python`, :meth:`setup_scripts` and :" +"meth:`post_setup` can be overridden." msgstr "" -"每個 " -"methods :meth:`ensure_directories`、:meth:`create_configuration`、:meth:`setup_python`、:meth:`setup_scripts` " -"及 :meth:`post_setup` 都可以被覆寫。" +"每個 methods :meth:`ensure_directories`、:meth:`create_configuration`、:meth:" +"`setup_python`、:meth:`setup_scripts` 及 :meth:`post_setup` 都可以被覆寫。" #: ../../library/venv.rst:383 msgid "" @@ -702,9 +698,9 @@ msgid "" "subdirectories will be recreated." msgstr "" "建立還不存在的環境目錄及必要的子目錄,並回傳一個情境物件(context object)。" -"這個情境物件只是一個屬性 (例如:路徑) 的所有者,可被其他 method 使用。如" -"果 :class:`EnvBuilder` 已被建立且帶有 ``clear=True`` 的引數,該環境目錄下的內" -"容將被清空,以及所有必要的子目錄將被重新建立。" +"這個情境物件只是一個屬性 (例如:路徑) 的所有者,可被其他 method 使用。如果 :" +"class:`EnvBuilder` 已被建立且帶有 ``clear=True`` 的引數,該環境目錄下的內容將" +"被清空,以及所有必要的子目錄將被重新建立。" #: ../../library/venv.rst:390 msgid "" @@ -719,16 +715,16 @@ msgid "" "``env_dir`` - The location of the virtual environment. Used for " "``__VENV_DIR__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -"``env_dir`` —— 虛擬環境的位置。用於啟用腳本中的 ``__VENV_DIR__``\\ (參" -"見 :meth:`install_scripts`)。" +"``env_dir`` —— 虛擬環境的位置。用於啟用腳本中的 ``__VENV_DIR__``\\ (參見 :" +"meth:`install_scripts`)。" #: ../../library/venv.rst:396 msgid "" "``env_name`` - The name of the virtual environment. Used for " "``__VENV_NAME__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -"``env_name`` —— 虛擬環境的名稱。用於啟用腳本中的 ``__VENV_NAME__``\\ (參" -"見 :meth:`install_scripts`)。" +"``env_name`` —— 虛擬環境的名稱。用於啟用腳本中的 ``__VENV_NAME__``\\ (參見 :" +"meth:`install_scripts`)。" #: ../../library/venv.rst:399 msgid "" @@ -771,8 +767,8 @@ msgstr "" #: ../../library/venv.rst:416 msgid "" "``env_exe`` - The name of the Python interpreter in the virtual environment. " -"Used for ``__VENV_PYTHON__`` in activation scripts " -"(see :meth:`install_scripts`)." +"Used for ``__VENV_PYTHON__`` in activation scripts (see :meth:" +"`install_scripts`)." msgstr "" "``env_exe`` —— 虛擬環境中 Python 直譯器的名稱。用於啟用腳本中的 " "``__VENV_PYTHON__``\\ (參見 :meth:`install_scripts`)。" @@ -927,9 +923,9 @@ msgid "" "instead of :meth:`setup_scripts`. This was not the case in 3.7.2. When using " "symlinks, the original executables will be linked." msgstr "" -"Windows會在 :meth:`setup_python` 中複製重新導向腳本,而非" -"在 :meth:`setup_scripts` 中進行。這在 3.7.2 中並非如此。若使用符號連結,則會" -"連結至原始的可執行檔。" +"Windows會在 :meth:`setup_python` 中複製重新導向腳本,而非在 :meth:" +"`setup_scripts` 中進行。這在 3.7.2 中並非如此。若使用符號連結,則會連結至原始" +"的可執行檔。" #: ../../library/venv.rst:514 msgid "There is also a module-level convenience function:" @@ -1035,8 +1031,8 @@ msgid "" " \"\"\"\n" " Read lines from a subprocess' output stream and either pass to a " "progress\n" -" callable (if specified) or write progress information to " -"sys.stderr.\n" +" callable (if specified) or write progress information to sys." +"stderr.\n" " \"\"\"\n" " progress = self.progress\n" " while True:\n" @@ -1097,8 +1093,8 @@ msgid "" " url = \"https://bootstrap.pypa.io/ez_setup.py\"\n" " self.install_script(context, 'setuptools', url)\n" " # clear up the setuptools archive which gets downloaded\n" -" pred = lambda o: o.startswith('setuptools-') and " -"o.endswith('.tar.gz')\n" +" pred = lambda o: o.startswith('setuptools-') and o.endswith('.tar." +"gz')\n" " files = filter(pred, os.listdir(context.bin_path))\n" " for f in files:\n" " f = os.path.join(context.bin_path, f)\n" @@ -1214,8 +1210,8 @@ msgstr "" " 'stdout' 與 'stderr' 則分別表示從子行程輸出資料串流中\n" " 讀取的輸出內容,該子行程用於安裝應用程式。\n" "\n" -" 若未指定可呼叫物件,則預設的進度資訊會輸出至 " -"sys.stderr。\n" +" 若未指定可呼叫物件,則預設的進度資訊會輸出至 sys." +"stderr。\n" " \"\"\"\n" "\n" " def __init__(self, *args, **kwargs):\n" @@ -1302,8 +1298,8 @@ msgstr "" " url = \"https://bootstrap.pypa.io/ez_setup.py\"\n" " self.install_script(context, 'setuptools', url)\n" " # 清除已下載的 setuptools 檔案\n" -" pred = lambda o: o.startswith('setuptools-') and " -"o.endswith('.tar.gz')\n" +" pred = lambda o: o.startswith('setuptools-') and o.endswith('.tar." +"gz')\n" " files = filter(pred, os.listdir(context.bin_path))\n" " for f in files:\n" " f = os.path.join(context.bin_path, f)\n" diff --git a/library/warnings.po b/library/warnings.po index ab4a15267cf..cc91874e97b 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2025-07-14 13:00+0800\n" "Last-Translator: Dr-XYZ \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,19 +42,19 @@ msgstr "" #: ../../library/warnings.rst:18 msgid "" "Python programmers issue warnings by calling the :func:`warn` function " -"defined in this module. (C programmers use :c:func:`PyErr_WarnEx`; " -"see :ref:`exceptionhandling` for details)." +"defined in this module. (C programmers use :c:func:`PyErr_WarnEx`; see :ref:" +"`exceptionhandling` for details)." msgstr "" "Python 程式設計師可以透過呼叫此模組中定義的 :func:`warn` 函式來發出警告。(C " -"語言的程式設計師則使用 :c:func:`PyErr_WarnEx`;詳情請參" -"閱 :ref:`exceptionhandling`)。" +"語言的程式設計師則使用 :c:func:`PyErr_WarnEx`;詳情請參閱 :ref:" +"`exceptionhandling`)。" #: ../../library/warnings.rst:22 msgid "" "Warning messages are normally written to :data:`sys.stderr`, but their " "disposition can be changed flexibly, from ignoring all warnings to turning " -"them into exceptions. The disposition of warnings can vary based on " -"the :ref:`warning category `, the text of the warning " +"them into exceptions. The disposition of warnings can vary based on the :" +"ref:`warning category `, the text of the warning " "message, and the source location where it is issued. Repetitions of a " "particular warning for the same source location are typically suppressed." msgstr "" @@ -75,11 +75,11 @@ msgstr "" #: ../../library/warnings.rst:33 msgid "" -"The determination whether to issue a warning message is controlled by " -"the :ref:`warning filter `, which is a sequence of matching " -"rules and actions. Rules can be added to the filter by " -"calling :func:`filterwarnings` and reset to its default state by " -"calling :func:`resetwarnings`." +"The determination whether to issue a warning message is controlled by the :" +"ref:`warning filter `, which is a sequence of matching rules " +"and actions. Rules can be added to the filter by calling :func:" +"`filterwarnings` and reset to its default state by calling :func:" +"`resetwarnings`." msgstr "" "是否要發出警告訊息是由 :ref:`警告過濾器 ` 所控制,它是一連串" "的匹配規則和動作。可以透過呼叫 :func:`filterwarnings` 來新增規則到過濾器中," @@ -364,10 +364,10 @@ msgstr "只印出第一次出現的匹配警告,不論位置" #: ../../library/warnings.rst:160 msgid "" "*message* is a string containing a regular expression that the start of the " -"warning message must match, case-insensitively. In :option:`-W` " -"and :envvar:`PYTHONWARNINGS`, *message* is a literal string that the start " -"of the warning message must contain (case-insensitively), ignoring any " -"whitespace at the start or end of *message*." +"warning message must match, case-insensitively. In :option:`-W` and :envvar:" +"`PYTHONWARNINGS`, *message* is a literal string that the start of the " +"warning message must contain (case-insensitively), ignoring any whitespace " +"at the start or end of *message*." msgstr "" "*message* 是一個包含正規表示式的字串,警告訊息的開頭必須與其匹配(不區分大小" "寫)。在 :option:`-W` 和 :envvar:`PYTHONWARNINGS` 中,*message* 是一個字面字" @@ -466,10 +466,10 @@ msgid "" "module parses these when it is first imported (invalid options are ignored, " "after printing a message to :data:`sys.stderr`)." msgstr "" -"警告過濾器由傳遞給 Python 直譯器命令列的 :option:`-W` 選項" -"和 :envvar:`PYTHONWARNINGS` 環境變數初始化。直譯器會將所有提供條目的引數未經" -"直譯地儲存在 :data:`sys.warnoptions` 中;:mod:`warnings` 模組在首次引入時會剖" -"析這些引數(無效選項會被忽略,並在向 :data:`sys.stderr` 印出一條訊息後)。" +"警告過濾器由傳遞給 Python 直譯器命令列的 :option:`-W` 選項和 :envvar:" +"`PYTHONWARNINGS` 環境變數初始化。直譯器會將所有提供條目的引數未經直譯地儲存" +"在 :data:`sys.warnoptions` 中;:mod:`warnings` 模組在首次引入時會剖析這些引數" +"(無效選項會被忽略,並在向 :data:`sys.stderr` 印出一條訊息後)。" #: ../../library/warnings.rst:210 msgid "" @@ -484,11 +484,11 @@ msgstr "action:message:category:module:line" #: ../../library/warnings.rst:215 msgid "" "The meaning of each of these fields is as described in :ref:`warning-" -"filter`. When listing multiple filters on a single line (as " -"for :envvar:`PYTHONWARNINGS`), the individual filters are separated by " -"commas and the filters listed later take precedence over those listed before " -"them (as they're applied left-to-right, and the most recently applied " -"filters take precedence over earlier ones)." +"filter`. When listing multiple filters on a single line (as for :envvar:" +"`PYTHONWARNINGS`), the individual filters are separated by commas and the " +"filters listed later take precedence over those listed before them (as " +"they're applied left-to-right, and the most recently applied filters take " +"precedence over earlier ones)." msgstr "" "這些欄位中每一個的含義都如 :ref:`warning-filter` 中所述。當在單一行中列出多個" "過濾器時(例如 :envvar:`PYTHONWARNINGS`),個別的過濾器會以逗號分隔,且後面列" @@ -566,8 +566,8 @@ msgstr "在 :ref:`偵錯建置 ` 中,預設警告過濾器串列 #: ../../library/warnings.rst:255 msgid "" -":exc:`DeprecationWarning` is now ignored by default in addition " -"to :exc:`PendingDeprecationWarning`." +":exc:`DeprecationWarning` is now ignored by default in addition to :exc:" +"`PendingDeprecationWarning`." msgstr "" "除了 :exc:`PendingDeprecationWarning` 之外,:exc:`DeprecationWarning` 現在也" "預設被忽略。" @@ -597,10 +597,10 @@ msgstr "覆寫預設過濾器" msgid "" "Developers of applications written in Python may wish to hide *all* Python " "level warnings from their users by default, and only display them when " -"running tests or otherwise working on the application. " -"The :data:`sys.warnoptions` attribute used to pass filter configurations to " -"the interpreter can be used as a marker to indicate whether or not warnings " -"should be disabled::" +"running tests or otherwise working on the application. The :data:`sys." +"warnoptions` attribute used to pass filter configurations to the interpreter " +"can be used as a marker to indicate whether or not warnings should be " +"disabled::" msgstr "" "以 Python 編寫的應用程式的開發者可能希望預設對其使用者隱藏 *所有* Python 層級" "的警告,並且只在執行測試或以其他方式處理應用程式時才顯示它們。用於將過濾器設" @@ -679,8 +679,8 @@ msgid "" "to suppress the warning using the :class:`catch_warnings` context manager::" msgstr "" "如果你正在使用的程式碼,你知道它會引發一個警告(例如一個已棄用的函式),但你" -"不想看到這個警告(即使警告已透過命令列明確設定),那麼可以使" -"用 :class:`catch_warnings` 情境管理器來抑制該警告: ::" +"不想看到這個警告(即使警告已透過命令列明確設定),那麼可以使用 :class:" +"`catch_warnings` 情境管理器來抑制該警告: ::" #: ../../library/warnings.rst:317 msgid "" @@ -854,8 +854,8 @@ msgstr "" "是 :option:`!-W default` 的簡寫)或在環境中設定 ``PYTHONWARNINGS=default`` 來" "檢查應用程式是否使用了已棄用的介面。這會為所有警告啟用預設處理,包括那些預設" "被忽略的警告。要更改對遇到的警告所採取的動作,你可以更改傳遞給 :option:`-W` " -"的引數(例如 :option:`!-W error`)。有關更多可能性的詳細資訊,請參" -"閱 :option:`-W` 旗標。" +"的引數(例如 :option:`!-W error`)。有關更多可能性的詳細資訊,請參閱 :option:" +"`-W` 旗標。" #: ../../library/warnings.rst:418 msgid "Available Functions" @@ -948,16 +948,16 @@ msgstr "" #: ../../library/warnings.rst:462 msgid "" "This makes the warning refer to both the ``example.lower.one_way()`` and " -"``package.higher.another_way()`` call sites only from calling code living " +"``example.higher.another_way()`` call sites only from calling code living " "outside of ``example`` package." msgstr "" -"這使得警告只會從存在於 ``example`` 套件之外的呼叫程式碼中,指向 " -"``example.lower.one_way()`` 和 ``package.higher.another_way()`` 的呼叫點。" +"這使得警告只會從存在於 ``example`` 套件之外的呼叫程式碼中,指向 ``example." +"lower.one_way()`` 和 ``example.higher.another_way()`` 的呼叫點。" #: ../../library/warnings.rst:466 ../../library/warnings.rst:492 msgid "" -"*source*, if supplied, is the destroyed object which emitted " -"a :exc:`ResourceWarning`." +"*source*, if supplied, is the destroyed object which emitted a :exc:" +"`ResourceWarning`." msgstr "*source*\\ (如果提供)是發出 :exc:`ResourceWarning` 的已銷毀物件。" #: ../../library/warnings.rst:469 @@ -982,8 +982,8 @@ msgstr "" "這是一個 :func:`warn` 功能的低階介面,明確傳入訊息、類別、檔名和行號,以及可" "選的模組名稱和註冊表(應為模組的 ``__warningregistry__`` 字典)。模組名稱預設" "為去掉 ``.py`` 的檔名;如果沒有傳入註冊表,警告將永遠不會被抑制。*message* 必" -"須是字串,*category* 必須是 :exc:`Warning` 的子類別,或者 *message* 可以" -"是 :exc:`Warning` 的實例,在這種情況下 *category* 將被忽略。" +"須是字串,*category* 必須是 :exc:`Warning` 的子類別,或者 *message* 可以是 :" +"exc:`Warning` 的實例,在這種情況下 *category* 將被忽略。" #: ../../library/warnings.rst:487 msgid "" @@ -1005,28 +1005,28 @@ msgid "" "Write a warning to a file. The default implementation calls " "``formatwarning(message, category, filename, lineno, line)`` and writes the " "resulting string to *file*, which defaults to :data:`sys.stderr`. You may " -"replace this function with any callable by assigning to " -"``warnings.showwarning``. *line* is a line of source code to be included in " -"the warning message; if *line* is not supplied, :func:`showwarning` will try " -"to read the line specified by *filename* and *lineno*." +"replace this function with any callable by assigning to ``warnings." +"showwarning``. *line* is a line of source code to be included in the warning " +"message; if *line* is not supplied, :func:`showwarning` will try to read the " +"line specified by *filename* and *lineno*." msgstr "" "將警告寫入一個檔案。預設實作會呼叫 ``formatwarning(message, category, " -"filename, lineno, line)`` 並將結果字串寫入 *file*,預設" -"為 :data:`sys.stderr`。你可以透過賦值給 ``warnings.showwarning`` 來用任何可呼" -"叫物件取代此函式。*line* 是要包含在警告訊息中的一行原始碼;如果未提供 " -"*line*,:func:`showwarning` 將嘗試讀取由 *filename* 和 *lineno* 指定的行。" +"filename, lineno, line)`` 並將結果字串寫入 *file*,預設為 :data:`sys." +"stderr`。你可以透過賦值給 ``warnings.showwarning`` 來用任何可呼叫物件取代此函" +"式。*line* 是要包含在警告訊息中的一行原始碼;如果未提供 *line*,:func:" +"`showwarning` 將嘗試讀取由 *filename* 和 *lineno* 指定的行。" #: ../../library/warnings.rst:512 msgid "" "Format a warning the standard way. This returns a string which may contain " "embedded newlines and ends in a newline. *line* is a line of source code to " -"be included in the warning message; if *line* is not " -"supplied, :func:`formatwarning` will try to read the line specified by " -"*filename* and *lineno*." +"be included in the warning message; if *line* is not supplied, :func:" +"`formatwarning` will try to read the line specified by *filename* and " +"*lineno*." msgstr "" "以標準方式格式化警告。這會回傳一個可能包含嵌入換行符並以換行符結尾的字串。" -"*line* 是要包含在警告訊息中的一行原始碼;如果未提供 " -"*line*,:func:`formatwarning` 將嘗試讀取由 *filename* 和 *lineno* 指定的行。" +"*line* 是要包含在警告訊息中的一行原始碼;如果未提供 *line*,:func:" +"`formatwarning` 將嘗試讀取由 *filename* 和 *lineno* 指定的行。" #: ../../library/warnings.rst:521 msgid "" @@ -1048,10 +1048,10 @@ msgstr "" #: ../../library/warnings.rst:533 msgid "" "Insert a simple entry into the list of :ref:`warnings filter specifications " -"`. The meaning of the function parameters is as " -"for :func:`filterwarnings`, but regular expressions are not needed as the " -"filter inserted always matches any message in any module as long as the " -"category and line number match." +"`. The meaning of the function parameters is as for :func:" +"`filterwarnings`, but regular expressions are not needed as the filter " +"inserted always matches any message in any module as long as the category " +"and line number match." msgstr "" "在 :ref:`警告過濾器規格 ` 串列中插入一個簡單的條目。函式參數" "的含義與 :func:`filterwarnings` 相同,但不需要正規表示式,因為只要類別和行號" @@ -1063,8 +1063,8 @@ msgid "" "to :func:`filterwarnings`, including that of the :option:`-W` command line " "options and calls to :func:`simplefilter`." msgstr "" -"重設警告過濾器。這會捨棄所有先前對 :func:`filterwarnings` 的呼叫效果,包" -"括 :option:`-W` 命令列選項和對 :func:`simplefilter` 的呼叫。" +"重設警告過濾器。這會捨棄所有先前對 :func:`filterwarnings` 的呼叫效果,包括 :" +"option:`-W` 命令列選項和對 :func:`simplefilter` 的呼叫。" #: ../../library/warnings.rst:549 msgid "Decorator to indicate that a class, function or overload is deprecated." @@ -1077,9 +1077,9 @@ msgid "" "` will also generate a diagnostic on usage of the " "deprecated object." msgstr "" -"當此裝飾器應用於一個物件時,在使用該物件時,可能會在 runtime 發出棄用警" -"告。:term:`靜態型別檢查器 ` 也會在使用已棄用物件時產生診" -"斷訊息。" +"當此裝飾器應用於一個物件時,在使用該物件時,可能會在 runtime 發出棄用警告。:" +"term:`靜態型別檢查器 ` 也會在使用已棄用物件時產生診斷訊" +"息。" #: ../../library/warnings.rst:556 msgid "Usage::" @@ -1143,9 +1143,9 @@ msgstr "" msgid "" "The deprecation message passed to the decorator is saved in the " "``__deprecated__`` attribute on the decorated object. If applied to an " -"overload, the decorator must be after the :func:`@overload " -"` decorator for the attribute to exist on the overload as " -"returned by :func:`typing.get_overloads`." +"overload, the decorator must be after the :func:`@overload ` decorator for the attribute to exist on the overload as returned " +"by :func:`typing.get_overloads`." msgstr "" "傳遞給裝飾器的棄用訊息會儲存在被裝飾物件的 ``__deprecated__`` 屬性中。如果應" "用於重載,裝飾器必須在 :func:`@overload ` 裝飾器之後,這樣屬" @@ -1162,20 +1162,19 @@ msgstr "可用的情境管理器" #: ../../library/warnings.rst:602 msgid "" "A context manager that copies and, upon exit, restores the warnings filter " -"and the :func:`showwarning` function. If the *record* argument " -"is :const:`False` (the default) the context manager returns :class:`None` on " -"entry. If *record* is :const:`True`, a list is returned that is " -"progressively populated with objects as seen by a custom :func:`showwarning` " -"function (which also suppresses output to ``sys.stdout``). Each object in " -"the list has attributes with the same names as the arguments " -"to :func:`showwarning`." +"and the :func:`showwarning` function. If the *record* argument is :const:" +"`False` (the default) the context manager returns :class:`None` on entry. If " +"*record* is :const:`True`, a list is returned that is progressively " +"populated with objects as seen by a custom :func:`showwarning` function " +"(which also suppresses output to ``sys.stdout``). Each object in the list " +"has attributes with the same names as the arguments to :func:`showwarning`." msgstr "" "一個情境管理器,它會複製並在退出時恢復警告過濾器和 :func:`showwarning` 函式。" -"如果 *record* 引數為 :const:`False`\\ (預設值),情境管理器在進入時回" -"傳 :class:`None`。如果 *record* 為 :const:`True`,則會回傳一個串列,該串列會" -"由自訂的 :func:`showwarning` 函式(該函式也會抑制對 ``sys.stdout`` 的輸出)所" -"看到的物件逐步填充。串列中的每個物件都具有與 :func:`showwarning` 的引數同名的" -"屬性。" +"如果 *record* 引數為 :const:`False`\\ (預設值),情境管理器在進入時回傳 :" +"class:`None`。如果 *record* 為 :const:`True`,則會回傳一個串列,該串列會由自" +"訂的 :func:`showwarning` 函式(該函式也會抑制對 ``sys.stdout`` 的輸出)所看到" +"的物件逐步填充。串列中的每個物件都具有與 :func:`showwarning` 的引數同名的屬" +"性。" #: ../../library/warnings.rst:611 msgid "" @@ -1211,23 +1210,23 @@ msgstr "情境管理器的並行安全性" #: ../../library/warnings.rst:640 msgid "" -"The behavior of :class:`catch_warnings` context manager depends on " -"the :data:`sys.flags.context_aware_warnings` flag. If the flag is true, the " -"context manager behaves in a concurrent-safe fashion and otherwise not. " -"Concurrent-safe means that it is both thread-safe and safe to use " -"within :ref:`asyncio coroutines ` and tasks. Being thread-safe " -"means that behavior is predictable in a multi-threaded program. The flag " -"defaults to true for free-threaded builds and false otherwise." +"The behavior of :class:`catch_warnings` context manager depends on the :data:" +"`sys.flags.context_aware_warnings` flag. If the flag is true, the context " +"manager behaves in a concurrent-safe fashion and otherwise not. Concurrent-" +"safe means that it is both thread-safe and safe to use within :ref:`asyncio " +"coroutines ` and tasks. Being thread-safe means that behavior is " +"predictable in a multi-threaded program. The flag defaults to true for free-" +"threaded builds and false otherwise." msgstr "" #: ../../library/warnings.rst:648 msgid "" -"If the :data:`~sys.flags.context_aware_warnings` flag is false, " -"then :class:`catch_warnings` will modify the global attributes of " -"the :mod:`warnings` module. This is not safe if used within a concurrent " -"program (using multiple threads or using asyncio coroutines). For example, " -"if two or more threads use the :class:`catch_warnings` class at the same " -"time, the behavior is undefined." +"If the :data:`~sys.flags.context_aware_warnings` flag is false, then :class:" +"`catch_warnings` will modify the global attributes of the :mod:`warnings` " +"module. This is not safe if used within a concurrent program (using " +"multiple threads or using asyncio coroutines). For example, if two or more " +"threads use the :class:`catch_warnings` class at the same time, the behavior " +"is undefined." msgstr "" #: ../../library/warnings.rst:655 @@ -1258,21 +1257,21 @@ msgstr "" #: ../../library/warnings.rst:671 msgid "" "The :data:`~sys.flags.context_aware_warnings` flag can be set the :option:`-" -"X context_aware_warnings<-X>` command-line option or by " -"the :envvar:`PYTHON_CONTEXT_AWARE_WARNINGS` environment variable." +"X context_aware_warnings<-X>` command-line option or by the :envvar:" +"`PYTHON_CONTEXT_AWARE_WARNINGS` environment variable." msgstr "" #: ../../library/warnings.rst:677 msgid "" "It is likely that most programs that desire thread-safe behaviour of the " -"warnings module will also want to set " -"the :data:`~sys.flags.thread_inherit_context` flag to true. That flag " -"causes threads created by :class:`threading.Thread` to start with a copy of " -"the context variables from the thread starting it. When true, the context " -"established by :class:`catch_warnings` in one thread will also apply to new " -"threads started by it. If false, new threads will start with an empty " -"warnings context variable, meaning that any filtering that was established " -"by a :class:`catch_warnings` context manager will no longer be active." +"warnings module will also want to set the :data:`~sys.flags." +"thread_inherit_context` flag to true. That flag causes threads created by :" +"class:`threading.Thread` to start with a copy of the context variables from " +"the thread starting it. When true, the context established by :class:" +"`catch_warnings` in one thread will also apply to new threads started by " +"it. If false, new threads will start with an empty warnings context " +"variable, meaning that any filtering that was established by a :class:" +"`catch_warnings` context manager will no longer be active." msgstr "" #: ../../library/warnings.rst:690 @@ -1292,9 +1291,9 @@ msgstr "warnings (警告)" #~ "filter specifications. This means the context manager is modifying " #~ "global state and therefore is not thread-safe." #~ msgstr "" -#~ ":class:`catch_warnings` 管理器的工作原理是替換然後再恢復模組" -#~ "的 :func:`showwarning` 函式和內部過濾器規格串列。這意味著情境管理器正在修" -#~ "改全域狀態,因此不是執行緒安全的。" +#~ ":class:`catch_warnings` 管理器的工作原理是替換然後再恢復模組的 :func:" +#~ "`showwarning` 函式和內部過濾器規格串列。這意味著情境管理器正在修改全域狀" +#~ "態,因此不是執行緒安全的。" #~ msgid "Base category for warnings about dubious syntactic features." #~ msgstr "關於可疑語法功能的警告的基底類別。" diff --git a/library/zipfile.po b/library/zipfile.po index e6324e74766..1e268653906 100644 --- a/library/zipfile.po +++ b/library/zipfile.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2025-06-26 20:00+0800\n" "Last-Translator: Dr-XYZ \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -79,12 +79,12 @@ msgstr "" #: ../../library/zipfile.rst:58 msgid "" -"Class that implements a subset of the interface provided " -"by :class:`pathlib.Path`, including the " -"full :class:`importlib.resources.abc.Traversable` interface." +"Class that implements a subset of the interface provided by :class:`pathlib." +"Path`, including the full :class:`importlib.resources.abc.Traversable` " +"interface." msgstr "" -"實作了 :class:`pathlib.Path` 所提供介面子集的類別,包括完整" -"的 :class:`importlib.resources.abc.Traversable` 介面。" +"實作了 :class:`pathlib.Path` 所提供介面子集的類別,包括完整的 :class:" +"`importlib.resources.abc.Traversable` 介面。" #: ../../library/zipfile.rst:68 msgid "Class for creating ZIP archives containing Python libraries." @@ -98,14 +98,14 @@ msgid "" "module will not need to create these, but only use those created by this " "module. *filename* should be the full name of the archive member, and " "*date_time* should be a tuple containing six fields which describe the time " -"of the last modification to the file; the fields are described in " -"section :ref:`zipinfo-objects`." +"of the last modification to the file; the fields are described in section :" +"ref:`zipinfo-objects`." msgstr "" -"用於表示封存檔案中成員資訊的類別。此類別的實例由 :class:`ZipFile` 物件" -"的 :meth:`.getinfo` 和 :meth:`.infolist` 方法回傳。大多數 :mod:`zipfile` 模組" -"的使用者不需要建立這些實例,而只需使用本模組所建立的。*filename* 應為封存成員" -"的完整名稱,而 *date_time* 應為一個包含六個欄位的元組,用以描述檔案的最後修改" -"時間;這些欄位在 :ref:`zipinfo-objects` 章節中有所描述。" +"用於表示封存檔案中成員資訊的類別。此類別的實例由 :class:`ZipFile` 物件的 :" +"meth:`.getinfo` 和 :meth:`.infolist` 方法回傳。大多數 :mod:`zipfile` 模組的使" +"用者不需要建立這些實例,而只需使用本模組所建立的。*filename* 應為封存成員的完" +"整名稱,而 *date_time* 應為一個包含六個欄位的元組,用以描述檔案的最後修改時" +"間;這些欄位在 :ref:`zipinfo-objects` 章節中有所描述。" #: ../../library/zipfile.rst:82 msgid "" @@ -151,29 +151,30 @@ msgstr "用於常用的 ZIP 壓縮方法的數值常數。這需要 :mod:`zlib` #: ../../library/zipfile.rst:120 msgid "" -"The numeric constant for the BZIP2 compression method. This requires " -"the :mod:`bz2` module." +"The numeric constant for the BZIP2 compression method. This requires the :" +"mod:`bz2` module." msgstr "用於 BZIP2 壓縮方法的數值常數。這需要 :mod:`bz2` 模組。" #: ../../library/zipfile.rst:127 msgid "" -"The numeric constant for the LZMA compression method. This requires " -"the :mod:`lzma` module." +"The numeric constant for the LZMA compression method. This requires the :" +"mod:`lzma` module." msgstr "用於 LZMA 壓縮方法的數值常數。這需要 :mod:`lzma` 模組。" #: ../../library/zipfile.rst:134 msgid "" -"The numeric constant for Zstandard compression. This requires " -"the :mod:`compression.zstd` module." -msgstr "用於 Zstandard 壓縮方法的數值常數。這需要 :mod:`compression.zstd` 模組。" +"The numeric constant for Zstandard compression. This requires the :mod:" +"`compression.zstd` module." +msgstr "" +"用於 Zstandard 壓縮方法的數值常數。這需要 :mod:`compression.zstd` 模組。" #: ../../library/zipfile.rst:139 msgid "" "In APPNOTE 6.3.7, the method ID ``20`` was assigned to Zstandard " "compression. This was changed in APPNOTE 6.3.8 to method ID ``93`` to avoid " -"conflicts, with method ID ``20`` being deprecated. For compatibility, " -"the :mod:`!zipfile` module reads both method IDs but will only write data " -"with method ID ``93``." +"conflicts, with method ID ``20`` being deprecated. For compatibility, the :" +"mod:`!zipfile` module reads both method IDs but will only write data with " +"method ID ``93``." msgstr "" #: ../../library/zipfile.rst:149 @@ -184,9 +185,9 @@ msgid "" "these compression methods, and may either refuse to process the ZIP file " "altogether, or fail to extract individual files." msgstr "" -"ZIP 檔案格式規範自 2001 年起已包含對 bzip2 壓縮的支援、自 2006 年起支援 " -"LZMA 壓縮、自 2020 年起支援 Zstandard 壓縮。然而某些工具(包括舊版的 Python)" -"不支援這些壓縮方法,可能會完全拒絕處理該 ZIP 檔案,或無法解壓縮個別檔案。" +"ZIP 檔案格式規範自 2001 年起已包含對 bzip2 壓縮的支援、自 2006 年起支援 LZMA " +"壓縮、自 2020 年起支援 Zstandard 壓縮。然而某些工具(包括舊版的 Python)不支" +"援這些壓縮方法,可能會完全拒絕處理該 ZIP 檔案,或無法解壓縮個別檔案。" #: ../../library/zipfile.rst:157 msgid "`PKZIP Application Note`_" @@ -236,31 +237,30 @@ msgid "" msgstr "" "*mode* 參數應為 ``'r'`` 來讀取一個現有檔案、``'w'`` 來清空並寫入一個新檔案、" "``'a'`` 來附加到一個現有檔案,或 ``'x'`` 來獨佔性地建立並寫入一個新檔案。如" -"果 *mode* 為 ``'x'`` 且 *file* 指向一個現有檔案,將會引" -"發 :exc:`FileExistsError`。如果 *mode* 為 ``'a'`` 且 *file* 指向一個現有的 " -"ZIP 檔案,則會將額外的檔案加入其中。如果 *file* 並非指向一個 ZIP 檔案,則一個" -"新的 ZIP 封存檔案會被附加到該檔案之後。這適用於將一個 ZIP 封存檔案附加到另一" -"個檔案(例如 :file:`python.exe`)。如果 *mode* 為 ``'a'`` 且檔案完全不存在," -"它會被建立。如果 *mode* 為 ``'r'`` 或 ``'a'``,該檔案應為可定位的 " -"(seekable)。" +"果 *mode* 為 ``'x'`` 且 *file* 指向一個現有檔案,將會引發 :exc:" +"`FileExistsError`。如果 *mode* 為 ``'a'`` 且 *file* 指向一個現有的 ZIP 檔案," +"則會將額外的檔案加入其中。如果 *file* 並非指向一個 ZIP 檔案,則一個新的 ZIP " +"封存檔案會被附加到該檔案之後。這適用於將一個 ZIP 封存檔案附加到另一個檔案(例" +"如 :file:`python.exe`)。如果 *mode* 為 ``'a'`` 且檔案完全不存在,它會被建" +"立。如果 *mode* 為 ``'r'`` 或 ``'a'``,該檔案應為可定位的 (seekable)。" #: ../../library/zipfile.rst:191 msgid "" "*compression* is the ZIP compression method to use when writing the archive, " -"and should " -"be :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`, :const:`ZIP_BZIP2`, :const:`ZIP_LZMA`, " -"or :const:`ZIP_ZSTANDARD`; unrecognized values will " -"cause :exc:`NotImplementedError` to be raised. " -"If :const:`ZIP_DEFLATED`, :const:`ZIP_BZIP2`, :const:`ZIP_LZMA`, " -"or :const:`ZIP_ZSTANDARD` is specified but the corresponding module " -"(:mod:`zlib`, :mod:`bz2`, :mod:`lzma`, or :mod:`compression.zstd`) is not " -"available, :exc:`RuntimeError` is raised. The default is :const:`ZIP_STORED`." -msgstr "" -"*compression* 是寫入封存檔案時要使用的 ZIP 壓縮方法,應" -"為 :const:`ZIP_STORED`、:const:`ZIP_DEFLATED`、:const:`ZIP_BZIP2`、" -":const:`ZIP_LZMA` 或 :const:`ZIP_ZSTANDARD`;無法識別的值將導致引發 :exc:`NotImplementedError`。如果" -"指定了 :const:`ZIP_DEFLATED`、:const:`ZIP_BZIP2`、:const:`ZIP_LZMA` 或 :const:`ZIP_ZSTANDARD`,但對應" -"的模組(:mod:`zlib`、:mod:`bz2`、:mod:`lzma` 或 :mod:`compression.zstd`)不可用,則會引" +"and should be :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`, :const:" +"`ZIP_BZIP2`, :const:`ZIP_LZMA`, or :const:`ZIP_ZSTANDARD`; unrecognized " +"values will cause :exc:`NotImplementedError` to be raised. If :const:" +"`ZIP_DEFLATED`, :const:`ZIP_BZIP2`, :const:`ZIP_LZMA`, or :const:" +"`ZIP_ZSTANDARD` is specified but the corresponding module (:mod:`zlib`, :mod:" +"`bz2`, :mod:`lzma`, or :mod:`compression.zstd`) is not available, :exc:" +"`RuntimeError` is raised. The default is :const:`ZIP_STORED`." +msgstr "" +"*compression* 是寫入封存檔案時要使用的 ZIP 壓縮方法,應為 :const:" +"`ZIP_STORED`、:const:`ZIP_DEFLATED`、:const:`ZIP_BZIP2`、:const:`ZIP_LZMA` " +"或 :const:`ZIP_ZSTANDARD`;無法識別的值將導致引發 :exc:" +"`NotImplementedError`。如果指定了 :const:`ZIP_DEFLATED`、:const:" +"`ZIP_BZIP2`、:const:`ZIP_LZMA` 或 :const:`ZIP_ZSTANDARD`,但對應的模組(:mod:" +"`zlib`、:mod:`bz2`、:mod:`lzma` 或 :mod:`compression.zstd`)不可用,則會引" "發 :exc:`RuntimeError`。預設為 :const:`ZIP_STORED`。" #: ../../library/zipfile.rst:200 @@ -277,25 +277,24 @@ msgstr "" #: ../../library/zipfile.rst:205 msgid "" "The *compresslevel* parameter controls the compression level to use when " -"writing files to the archive. When using :const:`ZIP_STORED` " -"or :const:`ZIP_LZMA` it has no effect. When using :const:`ZIP_DEFLATED` " -"integers ``0`` through ``9`` are accepted (see :class:`zlib " -"` for more information). When using :const:`ZIP_BZIP2` " -"integers ``1`` through ``9`` are accepted (see :class:`bz2 ` " -"for more information). When using :const:`ZIP_ZSTANDARD` integers " -"``-131072`` through ``22`` are commonly accepted " -"(see :attr:`CompressionParameter.compression_level " -"` for more on " -"retrieving valid values and their meaning)." -msgstr "" -"*compresslevel* 參數控制寫入檔案到封存時使用的壓縮層級。當使" -"用 :const:`ZIP_STORED` 或 :const:`ZIP_LZMA` 時,它沒有效果。當使" -"用 :const:`ZIP_DEFLATED` 時,接受整數 ``0`` 到 ``9``\\ (更多資訊請參" -"閱 :class:`zlib `)。當使用 :const:`ZIP_BZIP2` 時,接受整" -"數 ``1`` 到 ``9``\\ (更多資訊請參閱 :class:`bz2 `)。當" -"使用 :const:`ZIP_ZSTANDARD` 時,通常接受整數 ``-131072`` 到 ``22``\\ (" -"更多關於檢索有效值及其含義,請參閱 :attr:`CompressionParameter.compression_level " -"`)。" +"writing files to the archive. When using :const:`ZIP_STORED` or :const:" +"`ZIP_LZMA` it has no effect. When using :const:`ZIP_DEFLATED` integers ``0`` " +"through ``9`` are accepted (see :class:`zlib ` for more " +"information). When using :const:`ZIP_BZIP2` integers ``1`` through ``9`` are " +"accepted (see :class:`bz2 ` for more information). When using :" +"const:`ZIP_ZSTANDARD` integers ``-131072`` through ``22`` are commonly " +"accepted (see :attr:`CompressionParameter.compression_level ` for more on retrieving valid " +"values and their meaning)." +msgstr "" +"*compresslevel* 參數控制寫入檔案到封存時使用的壓縮層級。當使用 :const:" +"`ZIP_STORED` 或 :const:`ZIP_LZMA` 時,它沒有效果。當使用 :const:" +"`ZIP_DEFLATED` 時,接受整數 ``0`` 到 ``9``\\ (更多資訊請參閱 :class:`zlib " +"`)。當使用 :const:`ZIP_BZIP2` 時,接受整數 ``1`` 到 " +"``9``\\ (更多資訊請參閱 :class:`bz2 `)。當使用 :const:" +"`ZIP_ZSTANDARD` 時,通常接受整數 ``-131072`` 到 ``22``\\ (更多關於檢索有效值" +"及其含義,請參閱 :attr:`CompressionParameter.compression_level `)。" #: ../../library/zipfile.rst:217 ../../library/zipfile.rst:799 msgid "" @@ -319,9 +318,9 @@ msgstr "" #: ../../library/zipfile.rst:227 msgid "" -"If the file is created with mode ``'w'``, ``'x'`` or ``'a'`` and " -"then :meth:`closed ` without adding any files to the archive, the " -"appropriate ZIP structures for an empty archive will be written to the file." +"If the file is created with mode ``'w'``, ``'x'`` or ``'a'`` and then :meth:" +"`closed ` without adding any files to the archive, the appropriate " +"ZIP structures for an empty archive will be written to the file." msgstr "" "如果檔案以 ``'w'``、``'x'`` 或 ``'a'`` 模式建立,然後在沒有向封存檔案中加入任" "何檔案的情況下 :meth:`關閉 `,則適用於空封存檔案的 ZIP 結構將被寫入檔" @@ -447,18 +446,18 @@ msgid "" "Access a member of the archive as a binary file-like object. *name* can be " "either the name of a file within the archive or a :class:`ZipInfo` object. " "The *mode* parameter, if included, must be ``'r'`` (the default) or " -"``'w'``. *pwd* is the password used to decrypt encrypted ZIP files as " -"a :class:`bytes` object." +"``'w'``. *pwd* is the password used to decrypt encrypted ZIP files as a :" +"class:`bytes` object." msgstr "" "以二進位類檔案物件的形式存取封存檔案中的一個成員。*name* 可以是封存檔案內的檔" "案名稱,或是一個 :class:`ZipInfo` 物件。*mode* 參數如果包含,則必須是 " -"``'r'``\\ (預設值)或 ``'w'``。*pwd* 是用於解密加密 ZIP 檔案的密碼,為一" -"個 :class:`bytes` 物件。" +"``'r'``\\ (預設值)或 ``'w'``。*pwd* 是用於解密加密 ZIP 檔案的密碼,為一個 :" +"class:`bytes` 物件。" #: ../../library/zipfile.rst:315 msgid "" -":meth:`~ZipFile.open` is also a context manager and therefore supports " -"the :keyword:`with` statement::" +":meth:`~ZipFile.open` is also a context manager and therefore supports the :" +"keyword:`with` statement::" msgstr "" ":meth:`~ZipFile.open` 也是一個情境管理器,因此支援 :keyword:`with` 陳述" "式: ::" @@ -476,24 +475,27 @@ msgstr "" #: ../../library/zipfile.rst:322 msgid "" "With *mode* ``'r'`` the file-like object (``ZipExtFile``) is read-only and " -"provides the following " -"methods: :meth:`~io.BufferedIOBase.read`, :meth:`~io.IOBase.readline`, :meth:`~io.IOBase.readlines`, :meth:`~io.IOBase.seek`, :meth:`~io.IOBase.tell`, :meth:`~container.__iter__`, :meth:`~iterator.__next__`. " -"These objects can operate independently of the ZipFile." +"provides the following methods: :meth:`~io.BufferedIOBase.read`, :meth:`~io." +"IOBase.readline`, :meth:`~io.IOBase.readlines`, :meth:`~io.IOBase.seek`, :" +"meth:`~io.IOBase.tell`, :meth:`~container.__iter__`, :meth:`~iterator." +"__next__`. These objects can operate independently of the ZipFile." msgstr "" "在 *mode* 為 ``'r'`` 時,該類檔案物件(``ZipExtFile``)是唯讀的,並提供以下方" -"法::meth:`~io.BufferedIOBase.read`、:meth:`~io.IOBase.readline`、:meth:`~io.IOBase.readlines`、:meth:`~io.IOBase.seek`、:meth:`~io.IOBase.tell`、:meth:`~container.__iter__`、:meth:`~iterator.__next__`。" -"這些物件可以獨立於 ZipFile 運作。" +"法::meth:`~io.BufferedIOBase.read`、:meth:`~io.IOBase.readline`、:meth:`~io." +"IOBase.readlines`、:meth:`~io.IOBase.seek`、:meth:`~io.IOBase.tell`、:meth:" +"`~container.__iter__`、:meth:`~iterator.__next__`。這些物件可以獨立於 " +"ZipFile 運作。" #: ../../library/zipfile.rst:329 msgid "" -"With ``mode='w'``, a writable file handle is returned, which supports " -"the :meth:`~io.BufferedIOBase.write` method. While a writable file handle " -"is open, attempting to read or write other files in the ZIP file will raise " -"a :exc:`ValueError`." +"With ``mode='w'``, a writable file handle is returned, which supports the :" +"meth:`~io.BufferedIOBase.write` method. While a writable file handle is " +"open, attempting to read or write other files in the ZIP file will raise a :" +"exc:`ValueError`." msgstr "" -"在 ``mode='w'`` 時,會回傳一個可寫的檔案控點 (file handle),它支" -"援 :meth:`~io.BufferedIOBase.write` 方法。當一個可寫的檔案控點開啟時,嘗試讀" -"取或寫入 ZIP 檔案中的其他檔案將會引發 :exc:`ValueError`。" +"在 ``mode='w'`` 時,會回傳一個可寫的檔案控點 (file handle),它支援 :meth:" +"`~io.BufferedIOBase.write` 方法。當一個可寫的檔案控點開啟時,嘗試讀取或寫入 " +"ZIP 檔案中的其他檔案將會引發 :exc:`ValueError`。" #: ../../library/zipfile.rst:334 msgid "" @@ -524,17 +526,17 @@ msgid "" "filename or a :class:`ZipInfo` object. You will appreciate this when trying " "to read a ZIP file that contains members with duplicate names." msgstr "" -":meth:`.open`、:meth:`read` 和 :meth:`extract` 方法可以接受一個檔名或一" -"個 :class:`ZipInfo` 物件。當你嘗試讀取一個包含重複名稱成員的 ZIP 檔案時,你會" -"發現這很有用。" +":meth:`.open`、:meth:`read` 和 :meth:`extract` 方法可以接受一個檔名或一個 :" +"class:`ZipInfo` 物件。當你嘗試讀取一個包含重複名稱成員的 ZIP 檔案時,你會發現" +"這很有用。" #: ../../library/zipfile.rst:350 msgid "" "Removed support of ``mode='U'``. Use :class:`io.TextIOWrapper` for reading " "compressed text files in :term:`universal newlines` mode." msgstr "" -"移除了對 ``mode='U'`` 的支援。請使用 :class:`io.TextIOWrapper` " -"以 :term:`universal newlines` 模式讀取壓縮的文字檔。" +"移除了對 ``mode='U'`` 的支援。請使用 :class:`io.TextIOWrapper` 以 :term:" +"`universal newlines` 模式讀取壓縮的文字檔。" #: ../../library/zipfile.rst:354 msgid "" @@ -568,10 +570,10 @@ msgid "" "to extract to. *member* can be a filename or a :class:`ZipInfo` object. " "*pwd* is the password used for encrypted files as a :class:`bytes` object." msgstr "" -"從封存檔案中解壓縮一個成員到目前工作目錄;*member* 必須是其完整名稱或一" -"個 :class:`ZipInfo` 物件。其檔案資訊會被盡可能精確地解壓縮。*path* 指定一個不" -"同的目錄來解壓縮。*member* 可以是一個檔名或一個 :class:`ZipInfo` 物件。*pwd* " -"是用於加密檔案的密碼,為一個 :class:`bytes` 物件。" +"從封存檔案中解壓縮一個成員到目前工作目錄;*member* 必須是其完整名稱或一個 :" +"class:`ZipInfo` 物件。其檔案資訊會被盡可能精確地解壓縮。*path* 指定一個不同的" +"目錄來解壓縮。*member* 可以是一個檔名或一個 :class:`ZipInfo` 物件。*pwd* 是用" +"於加密檔案的密碼,為一個 :class:`bytes` 物件。" #: ../../library/zipfile.rst:377 msgid "Returns the normalized path created (a directory or new file)." @@ -629,8 +631,8 @@ msgstr "" #: ../../library/zipfile.rst:412 msgid "" -"Calling :meth:`extractall` on a closed ZipFile will raise " -"a :exc:`ValueError`. Previously, a :exc:`RuntimeError` was raised." +"Calling :meth:`extractall` on a closed ZipFile will raise a :exc:" +"`ValueError`. Previously, a :exc:`RuntimeError` was raised." msgstr "" "在一個已關閉的 ZipFile 上呼叫 :meth:`extractall` 將會引發 :exc:`ValueError`。" "先前,會引發一個 :exc:`RuntimeError`。" @@ -652,18 +654,18 @@ msgid "" "open for read or append. *pwd* is the password used for encrypted files as " "a :class:`bytes` object and, if specified, overrides the default password " "set with :meth:`setpassword`. Calling :meth:`read` on a ZipFile that uses a " -"compression method other " -"than :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`, :const:`ZIP_BZIP2`, :const:`ZIP_LZMA`, " -"or :const:`ZIP_ZSTANDARD` will raise a :exc:`NotImplementedError`. An error " -"will also be raised if the corresponding compression module is not available." -msgstr "" -"回傳封存檔案中 *name* 檔案的位元組。*name* 是封存檔案中檔案的名稱,或是一" -"個 :class:`ZipInfo` 物件。封存檔案必須以讀取或附加模式開啟。*pwd* 是用於加密" -"檔案的密碼,為一個 :class:`bytes` 物件,如果指定,將會覆寫" -"用 :meth:`setpassword` 設定的預設密碼。在一個使" -"用 :const:`ZIP_STORED`、:const:`ZIP_DEFLATED`、:const:`ZIP_BZIP2`、" -":const:`ZIP_LZMA` 或 :const:`ZIP_ZSTANDARD` 以外壓縮方法的 ZipFile 上呼叫 :meth:`read` 將會引" -"發 :exc:`NotImplementedError`。如果對應的壓縮模組不可用,也會引發一個錯誤。" +"compression method other than :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`, :" +"const:`ZIP_BZIP2`, :const:`ZIP_LZMA`, or :const:`ZIP_ZSTANDARD` will raise " +"a :exc:`NotImplementedError`. An error will also be raised if the " +"corresponding compression module is not available." +msgstr "" +"回傳封存檔案中 *name* 檔案的位元組。*name* 是封存檔案中檔案的名稱,或是一個 :" +"class:`ZipInfo` 物件。封存檔案必須以讀取或附加模式開啟。*pwd* 是用於加密檔案" +"的密碼,為一個 :class:`bytes` 物件,如果指定,將會覆寫用 :meth:`setpassword` " +"設定的預設密碼。在一個使用 :const:`ZIP_STORED`、:const:`ZIP_DEFLATED`、:" +"const:`ZIP_BZIP2`、:const:`ZIP_LZMA` 或 :const:`ZIP_ZSTANDARD` 以外壓縮方法" +"的 ZipFile 上呼叫 :meth:`read` 將會引發 :exc:`NotImplementedError`。如果對應" +"的壓縮模組不可用,也會引發一個錯誤。" #: ../../library/zipfile.rst:442 msgid "" @@ -761,12 +763,12 @@ msgid "" "name, the date and time is set to the current date and time. The archive " "must be opened with mode ``'w'``, ``'x'`` or ``'a'``." msgstr "" -"將一個檔案寫入封存檔案。內容為 *data*,它可以是一個 :class:`str` 或一" -"個 :class:`bytes` 實例;如果它是一個 :class:`str`,它會先被編碼為 UTF-8。" -"*zinfo_or_arcname* 是它在封存檔案中將被賦予的檔案名稱,或是一" -"個 :class:`ZipInfo` 實例。如果它是一個實例,則至少必須給定檔名、日期和時間。" -"如果它是一個名稱,則日期和時間被設為目前的日期和時間。封存檔案必須以 " -"``'w'``、``'x'`` 或 ``'a'`` 模式開啟。" +"將一個檔案寫入封存檔案。內容為 *data*,它可以是一個 :class:`str` 或一個 :" +"class:`bytes` 實例;如果它是一個 :class:`str`,它會先被編碼為 UTF-8。" +"*zinfo_or_arcname* 是它在封存檔案中將被賦予的檔案名稱,或是一個 :class:" +"`ZipInfo` 實例。如果它是一個實例,則至少必須給定檔名、日期和時間。如果它是一" +"個名稱,則日期和時間被設為目前的日期和時間。封存檔案必須以 ``'w'``、``'x'`` " +"或 ``'a'`` 模式開啟。" #: ../../library/zipfile.rst:509 msgid "" @@ -800,9 +802,8 @@ msgid "" "ZipFile will raise a :exc:`ValueError`. Previously, a :exc:`RuntimeError` " "was raised." msgstr "" -"在以 ``'r'`` 模式建立的 ZipFile 或一個已關閉的 ZipFile 上呼" -"叫 :meth:`writestr` 將會引發 :exc:`ValueError`。先前,會引發一" -"個 :exc:`RuntimeError`。" +"在以 ``'r'`` 模式建立的 ZipFile 或一個已關閉的 ZipFile 上呼叫 :meth:" +"`writestr` 將會引發 :exc:`ValueError`。先前,會引發一個 :exc:`RuntimeError`。" #: ../../library/zipfile.rst:531 msgid "" @@ -853,12 +854,12 @@ msgstr "Path 物件" #: ../../library/zipfile.rst:569 msgid "" -"Construct a Path object from a ``root`` zipfile (which may be " -"a :class:`ZipFile` instance or ``file`` suitable for passing to " -"the :class:`ZipFile` constructor)." +"Construct a Path object from a ``root`` zipfile (which may be a :class:" +"`ZipFile` instance or ``file`` suitable for passing to the :class:`ZipFile` " +"constructor)." msgstr "" -"從一個 ``root`` zipfile(它可以是一個 :class:`ZipFile` 實例或一個適合傳遞" -"給 :class:`ZipFile` 建構函式的 ``file``)建構一個 Path 物件。" +"從一個 ``root`` zipfile(它可以是一個 :class:`ZipFile` 實例或一個適合傳遞給 :" +"class:`ZipFile` 建構函式的 ``file``)建構一個 Path 物件。" #: ../../library/zipfile.rst:573 msgid "" @@ -881,8 +882,8 @@ msgstr "" ":class:`Path` 類別不會清理 ZIP 封存檔案內的檔名。與 :meth:`ZipFile.extract` " "和 :meth:`ZipFile.extractall` 方法不同,呼叫者有責任驗證或清理檔名,以防止路" "徑遍歷漏洞(例如,包含 \"..\" 或絕對路徑的檔名)。在處理不受信任的封存檔案" -"時,請考慮使用 :func:`os.path.abspath` 解析檔名,並使" -"用 :func:`os.path.commonpath` 與目標目錄進行核對。" +"時,請考慮使用 :func:`os.path.abspath` 解析檔名,並使用 :func:`os.path." +"commonpath` 與目標目錄進行核對。" #: ../../library/zipfile.rst:585 msgid "" @@ -901,9 +902,9 @@ msgstr "最後的路徑元件。" msgid "" "Invoke :meth:`ZipFile.open` on the current path. Allows opening for read or " "write, text or binary through supported modes: 'r', 'w', 'rb', 'wb'. " -"Positional and keyword arguments are passed through " -"to :class:`io.TextIOWrapper` when opened as text and ignored otherwise. " -"``pwd`` is the ``pwd`` parameter to :meth:`ZipFile.open`." +"Positional and keyword arguments are passed through to :class:`io." +"TextIOWrapper` when opened as text and ignored otherwise. ``pwd`` is the " +"``pwd`` parameter to :meth:`ZipFile.open`." msgstr "" "在目前路徑上呼叫 :meth:`ZipFile.open`。允許透過支援的模式 " "'r'、'w'、'rb'、'wb' 以讀取或寫入、文字或二進位模式開啟。當以文字模式開啟時," @@ -919,12 +920,12 @@ msgstr "新增了對 open 的文字和二進位模式的支援。預設模式現 msgid "" "The ``encoding`` parameter can be supplied as a positional argument without " "causing a :exc:`TypeError`. As it could in 3.9. Code needing to be " -"compatible with unpatched 3.10 and 3.11 versions must pass " -"all :class:`io.TextIOWrapper` arguments, ``encoding`` included, as keywords." +"compatible with unpatched 3.10 and 3.11 versions must pass all :class:`io." +"TextIOWrapper` arguments, ``encoding`` included, as keywords." msgstr "" "``encoding`` 參數可以作為位置引數提供,而不會導致 :exc:`TypeError`,就像在 " -"3.9 中一樣。需要與未修補的 3.10 和 3.11 版本相容的程式碼,必須將所" -"有 :class:`io.TextIOWrapper` 引數,包括 ``encoding``,作為關鍵字傳遞。" +"3.9 中一樣。需要與未修補的 3.10 和 3.11 版本相容的程式碼,必須將所有 :class:" +"`io.TextIOWrapper` 引數,包括 ``encoding``,作為關鍵字傳遞。" #: ../../library/zipfile.rst:617 msgid "Enumerate the children of the current directory." @@ -984,8 +985,8 @@ msgid "" "passed through to :class:`io.TextIOWrapper` (except ``buffer``, which is " "implied by the context)." msgstr "" -"將目前檔案讀取為 unicode 文字。位置引數和關鍵字引數會被傳遞" -"給 :class:`io.TextIOWrapper`\\ (但 ``buffer`` 會根據情境隱式處理)。" +"將目前檔案讀取為 unicode 文字。位置引數和關鍵字引數會被傳遞給 :class:`io." +"TextIOWrapper`\\ (但 ``buffer`` 會根據情境隱式處理)。" #: ../../library/zipfile.rst:678 msgid "Read the current file as bytes." @@ -1016,8 +1017,8 @@ msgstr "在 3.10 之前,``joinpath`` 沒有文件記載,且只接受一個 #: ../../library/zipfile.rst:693 msgid "" "The :pypi:`zipp` project provides backports of the latest path object " -"functionality to older Pythons. Use ``zipp.Path`` in place of " -"``zipfile.Path`` for early access to changes." +"functionality to older Pythons. Use ``zipp.Path`` in place of ``zipfile." +"Path`` for early access to changes." msgstr "" ":pypi:`zipp` 專案為舊版 Python 提供了最新的 path 物件功能的向後移植版本。使" "用 ``zipp.Path`` 來取代 ``zipfile.Path`` 以提早使用變更。" @@ -1028,8 +1029,8 @@ msgstr "PyZipFile 物件" #: ../../library/zipfile.rst:703 msgid "" -"The :class:`PyZipFile` constructor takes the same parameters as " -"the :class:`ZipFile` constructor, and one additional parameter, *optimize*." +"The :class:`PyZipFile` constructor takes the same parameters as the :class:" +"`ZipFile` constructor, and one additional parameter, *optimize*." msgstr "" ":class:`PyZipFile` 建構函式接受與 :class:`ZipFile` 建構函式相同的參數,以及一" "個額外的參數 *optimize*。" @@ -1074,17 +1075,17 @@ msgid "" "information). If *pathname* is a file that does not end with :file:`.py`, " "a :exc:`RuntimeError` will be raised. If it is a directory, and the " "directory is not a package directory, then all the files :file:`\\*.pyc` are " -"added at the top level. If the directory is a package directory, then " -"all :file:`\\*.pyc` are added under the package name as a file path, and if " -"any subdirectories are package directories, all of these are added " -"recursively in sorted order." -msgstr "" -"如果 *pathname* 是一個檔案,檔名必須以 :file:`.py` 結尾,且只有(對應" -"的 :file:`\\*.pyc`)檔案會被加到頂層(沒有路徑資訊)。如果 *pathname* 是一個" -"不以 :file:`.py` 結尾的檔案,將會引發 :exc:`RuntimeError`。如果它是一個目錄," -"且該目錄不是一個套件目錄,則所有 :file:`\\*.pyc` 檔案都會被加到頂層。如果該目" -"錄是一個套件目錄,則所有 :file:`\\*.pyc` 都會以檔案路徑的形式被加到套件名稱" -"下,且如果任何子目錄是套件目錄,所有這些都會以排序後的順序遞迴地加入。" +"added at the top level. If the directory is a package directory, then all :" +"file:`\\*.pyc` are added under the package name as a file path, and if any " +"subdirectories are package directories, all of these are added recursively " +"in sorted order." +msgstr "" +"如果 *pathname* 是一個檔案,檔名必須以 :file:`.py` 結尾,且只有(對應的 :" +"file:`\\*.pyc`)檔案會被加到頂層(沒有路徑資訊)。如果 *pathname* 是一個不" +"以 :file:`.py` 結尾的檔案,將會引發 :exc:`RuntimeError`。如果它是一個目錄,且" +"該目錄不是一個套件目錄,則所有 :file:`\\*.pyc` 檔案都會被加到頂層。如果該目錄" +"是一個套件目錄,則所有 :file:`\\*.pyc` 都會以檔案路徑的形式被加到套件名稱下," +"且如果任何子目錄是套件目錄,所有這些都會以排序後的順序遞迴地加入。" #: ../../library/zipfile.rst:739 msgid "*basename* is intended for internal use only." @@ -1162,8 +1163,8 @@ msgid "" "and :meth:`.infolist` methods of :class:`ZipFile` objects. Each object " "stores information about a single member of the ZIP archive." msgstr "" -":class:`ZipInfo` 類別的實例由 :class:`ZipFile` 物件的 :meth:`.getinfo` " -"和 :meth:`.infolist` 方法回傳。每個物件儲存關於 ZIP 封存檔案單一成員的資訊。" +":class:`ZipInfo` 類別的實例由 :class:`ZipFile` 物件的 :meth:`.getinfo` 和 :" +"meth:`.infolist` 方法回傳。每個物件儲存關於 ZIP 封存檔案單一成員的資訊。" #: ../../library/zipfile.rst:784 msgid "" @@ -1219,79 +1220,98 @@ msgstr "封存檔案中檔案的名稱。" #: ../../library/zipfile.rst:832 msgid "" "The time and date of the last modification to the archive member. This is a " -"tuple of six values:" +"tuple of six values representing the \"last [modified] file time\" and " +"\"last [modified] file date\" fields from the ZIP file's central directory." msgstr "" -"封存成員的最後修改時間和日期。這是一個包含六個值的元組:" +"封存成員的最後修改時間和日期。這是一個包含六個值的元組,代表 ZIP 檔案中" +"中央目錄的「最後 [修改] 檔案時間」和「最後 [修改] 檔案日期」欄位。" #: ../../library/zipfile.rst:836 +msgid "The tuple contains:" +msgstr "該元組包含:" + +#: ../../library/zipfile.rst:839 msgid "Index" msgstr "索引" -#: ../../library/zipfile.rst:836 +#: ../../library/zipfile.rst:839 msgid "Value" msgstr "值" -#: ../../library/zipfile.rst:838 +#: ../../library/zipfile.rst:841 msgid "``0``" msgstr "``0``" -#: ../../library/zipfile.rst:838 +#: ../../library/zipfile.rst:841 msgid "Year (>= 1980)" msgstr "年(>= 1980)" -#: ../../library/zipfile.rst:840 +#: ../../library/zipfile.rst:843 msgid "``1``" msgstr "``1``" -#: ../../library/zipfile.rst:840 +#: ../../library/zipfile.rst:843 msgid "Month (one-based)" msgstr "月(從 1 開始)" -#: ../../library/zipfile.rst:842 +#: ../../library/zipfile.rst:845 msgid "``2``" msgstr "``2``" -#: ../../library/zipfile.rst:842 +#: ../../library/zipfile.rst:845 msgid "Day of month (one-based)" msgstr "日(從 1 開始)" -#: ../../library/zipfile.rst:844 +#: ../../library/zipfile.rst:847 msgid "``3``" msgstr "``3``" -#: ../../library/zipfile.rst:844 +#: ../../library/zipfile.rst:847 msgid "Hours (zero-based)" msgstr "時(從 0 開始)" -#: ../../library/zipfile.rst:846 +#: ../../library/zipfile.rst:849 msgid "``4``" msgstr "``4``" -#: ../../library/zipfile.rst:846 +#: ../../library/zipfile.rst:849 msgid "Minutes (zero-based)" msgstr "分(從 0 開始)" -#: ../../library/zipfile.rst:848 +#: ../../library/zipfile.rst:851 msgid "``5``" msgstr "``5``" -#: ../../library/zipfile.rst:848 +#: ../../library/zipfile.rst:851 msgid "Seconds (zero-based)" msgstr "秒(從 0 開始)" -#: ../../library/zipfile.rst:853 -msgid "The ZIP file format does not support timestamps before 1980." -msgstr "ZIP 檔案格式不支援 1980 年以前的時間戳記。" +#: ../../library/zipfile.rst:856 +msgid "" +"The ZIP format supports multiple timestamp fields in different locations " +"(central directory, extra fields for NTFS/UNIX systems, etc.). This " +"attribute specifically returns the timestamp from the central directory. The " +"central directory timestamp format in ZIP files does not support timestamps " +"before 1980. While some extra field formats (such as UNIX timestamps) can " +"represent earlier dates, this attribute only returns the central directory " +"timestamp." +msgstr "" -#: ../../library/zipfile.rst:858 +#: ../../library/zipfile.rst:863 +msgid "" +"The central directory timestamp is interpreted as representing local time, " +"rather than UTC time, to match the behavior of other zip tools." +msgstr "" + +#: ../../library/zipfile.rst:869 msgid "Type of compression for the archive member." msgstr "封存成員的壓縮型別。" -#: ../../library/zipfile.rst:863 +#: ../../library/zipfile.rst:874 msgid "Comment for the individual archive member as a :class:`bytes` object." msgstr "個別封存成員的註解,為一個 :class:`bytes` 物件。" -#: ../../library/zipfile.rst:868 +#: ../../library/zipfile.rst:879 msgid "" "Expansion field data. The `PKZIP Application Note`_ contains some comments " "on the internal structure of the data contained in this :class:`bytes` " @@ -1300,146 +1320,145 @@ msgstr "" "擴充欄位資料。`PKZIP Application Note`_ 包含一些關於此 :class:`bytes` 物件中" "所含資料內部結構的註解。" -#: ../../library/zipfile.rst:875 +#: ../../library/zipfile.rst:886 msgid "System which created ZIP archive." msgstr "建立 ZIP 封存檔案的系統。" -#: ../../library/zipfile.rst:880 +#: ../../library/zipfile.rst:891 msgid "PKZIP version which created ZIP archive." msgstr "建立 ZIP 封存檔案的 PKZIP 版本。" -#: ../../library/zipfile.rst:885 +#: ../../library/zipfile.rst:896 msgid "PKZIP version needed to extract archive." msgstr "解壓縮封存檔案所需的 PKZIP 版本。" -#: ../../library/zipfile.rst:890 +#: ../../library/zipfile.rst:901 msgid "Must be zero." msgstr "必須為零。" -#: ../../library/zipfile.rst:895 +#: ../../library/zipfile.rst:906 msgid "ZIP flag bits." msgstr "ZIP 旗標位元。" -#: ../../library/zipfile.rst:900 +#: ../../library/zipfile.rst:911 msgid "Volume number of file header." msgstr "檔案標頭的磁碟空間編號。" -#: ../../library/zipfile.rst:905 +#: ../../library/zipfile.rst:916 msgid "Internal attributes." msgstr "內部屬性。" -#: ../../library/zipfile.rst:910 +#: ../../library/zipfile.rst:921 msgid "External file attributes." msgstr "外部檔案屬性。" -#: ../../library/zipfile.rst:915 +#: ../../library/zipfile.rst:926 msgid "Byte offset to the file header." msgstr "到檔案標頭的位元組偏移量。" -#: ../../library/zipfile.rst:920 +#: ../../library/zipfile.rst:931 msgid "CRC-32 of the uncompressed file." msgstr "未壓縮檔案的 CRC-32。" -#: ../../library/zipfile.rst:925 +#: ../../library/zipfile.rst:936 msgid "Size of the compressed data." msgstr "壓縮資料的大小。" -#: ../../library/zipfile.rst:930 +#: ../../library/zipfile.rst:941 msgid "Size of the uncompressed file." msgstr "未壓縮檔案的大小。" -#: ../../library/zipfile.rst:937 +#: ../../library/zipfile.rst:948 msgid "Command-Line Interface" msgstr "命令列介面" -#: ../../library/zipfile.rst:939 +#: ../../library/zipfile.rst:950 msgid "" "The :mod:`zipfile` module provides a simple command-line interface to " "interact with ZIP archives." msgstr "" ":mod:`zipfile` 模組提供了一個簡單的命令列介面,用以與 ZIP 封存檔案互動。" -#: ../../library/zipfile.rst:942 +#: ../../library/zipfile.rst:953 msgid "" -"If you want to create a new ZIP archive, specify its name after " -"the :option:`-c` option and then list the filename(s) that should be " -"included:" +"If you want to create a new ZIP archive, specify its name after the :option:" +"`-c` option and then list the filename(s) that should be included:" msgstr "" "如果你想建立一個新的 ZIP 封存檔案,請在 :option:`-c` 選項後指定其名稱,然後列" "出應包含的檔名:" -#: ../../library/zipfile.rst:945 +#: ../../library/zipfile.rst:956 msgid "$ python -m zipfile -c monty.zip spam.txt eggs.txt" msgstr "$ python -m zipfile -c monty.zip spam.txt eggs.txt" -#: ../../library/zipfile.rst:949 +#: ../../library/zipfile.rst:960 msgid "Passing a directory is also acceptable:" msgstr "傳遞一個目錄也是可以的:" -#: ../../library/zipfile.rst:951 +#: ../../library/zipfile.rst:962 msgid "$ python -m zipfile -c monty.zip life-of-brian_1979/" msgstr "$ python -m zipfile -c monty.zip life-of-brian_1979/" -#: ../../library/zipfile.rst:955 +#: ../../library/zipfile.rst:966 msgid "" -"If you want to extract a ZIP archive into the specified directory, use " -"the :option:`-e` option:" +"If you want to extract a ZIP archive into the specified directory, use the :" +"option:`-e` option:" msgstr "" "如果你想將一個 ZIP 封存檔案解壓縮到指定的目錄,請使用 :option:`-e` 選項:" -#: ../../library/zipfile.rst:958 +#: ../../library/zipfile.rst:969 msgid "$ python -m zipfile -e monty.zip target-dir/" msgstr "$ python -m zipfile -e monty.zip target-dir/" -#: ../../library/zipfile.rst:962 +#: ../../library/zipfile.rst:973 msgid "For a list of the files in a ZIP archive, use the :option:`-l` option:" msgstr "要列出 ZIP 封存檔案中的檔案,請使用 :option:`-l` 選項:" -#: ../../library/zipfile.rst:964 +#: ../../library/zipfile.rst:975 msgid "$ python -m zipfile -l monty.zip" msgstr "$ python -m zipfile -l monty.zip" -#: ../../library/zipfile.rst:970 +#: ../../library/zipfile.rst:981 msgid "Command-line options" msgstr "命令列選項" -#: ../../library/zipfile.rst:975 +#: ../../library/zipfile.rst:986 msgid "List files in a zipfile." msgstr "列出 zipfile 中的檔案。" -#: ../../library/zipfile.rst:980 +#: ../../library/zipfile.rst:991 msgid "Create zipfile from source files." msgstr "從來源檔案建立 zipfile。" -#: ../../library/zipfile.rst:985 +#: ../../library/zipfile.rst:996 msgid "Extract zipfile into target directory." msgstr "將 zipfile 解壓縮到目標目錄。" -#: ../../library/zipfile.rst:990 +#: ../../library/zipfile.rst:1001 msgid "Test whether the zipfile is valid or not." msgstr "測試 zipfile 是否有效。" -#: ../../library/zipfile.rst:994 +#: ../../library/zipfile.rst:1005 msgid "" -"Specify encoding of member names for :option:`-l`, :option:`-e` " -"and :option:`-t`." +"Specify encoding of member names for :option:`-l`, :option:`-e` and :option:" +"`-t`." msgstr "為 :option:`-l`、:option:`-e` 和 :option:`-t` 指定成員名稱的編碼。" -#: ../../library/zipfile.rst:1001 +#: ../../library/zipfile.rst:1012 msgid "Decompression pitfalls" msgstr "解壓縮的陷阱" -#: ../../library/zipfile.rst:1003 +#: ../../library/zipfile.rst:1014 msgid "" "The extraction in zipfile module might fail due to some pitfalls listed " "below." msgstr "zipfile 模組中的解壓縮可能會由於下面列出的一些陷阱而失敗。" -#: ../../library/zipfile.rst:1006 +#: ../../library/zipfile.rst:1017 msgid "From file itself" msgstr "來自檔案本身" -#: ../../library/zipfile.rst:1008 +#: ../../library/zipfile.rst:1019 msgid "" "Decompression may fail due to incorrect password / CRC checksum / ZIP format " "or unsupported compression method / decryption." @@ -1447,11 +1466,11 @@ msgstr "" "解壓縮可能由於不正確的密碼 / CRC 校驗和 / ZIP 格式或不支援的壓縮方法 / 解密而" "失敗。" -#: ../../library/zipfile.rst:1012 +#: ../../library/zipfile.rst:1023 msgid "File System limitations" msgstr "檔案系統限制" -#: ../../library/zipfile.rst:1014 +#: ../../library/zipfile.rst:1025 msgid "" "Exceeding limitations on different file systems can cause decompression " "failed. Such as allowable characters in the directory entries, length of the " @@ -1461,11 +1480,11 @@ msgstr "" "超出不同檔案系統的限制可能導致解壓縮失敗。例如目錄條目中允許的字元、檔名長" "度、路徑名長度、單一檔案的大小以及檔案數量等。" -#: ../../library/zipfile.rst:1021 +#: ../../library/zipfile.rst:1032 msgid "Resources limitations" msgstr "資源限制" -#: ../../library/zipfile.rst:1023 +#: ../../library/zipfile.rst:1034 msgid "" "The lack of memory or disk volume would lead to decompression failed. For " "example, decompression bombs (aka `ZIP bomb`_) apply to zipfile library that " @@ -1474,11 +1493,11 @@ msgstr "" "記憶體或磁碟空間不足會導致解壓縮失敗。例如,解壓縮炸彈(又稱 `ZIP bomb`_)適" "用於 zipfile 函式庫,可能導致磁碟空間耗盡。" -#: ../../library/zipfile.rst:1028 +#: ../../library/zipfile.rst:1039 msgid "Interruption" msgstr "中斷" -#: ../../library/zipfile.rst:1030 +#: ../../library/zipfile.rst:1041 msgid "" "Interruption during the decompression, such as pressing control-C or killing " "the decompression process may result in incomplete decompression of the " @@ -1487,11 +1506,11 @@ msgstr "" "在解壓縮過程中斷,例如按下 control-C 或終止解壓縮過程,可能導致封存檔案解壓縮" "不完整。" -#: ../../library/zipfile.rst:1034 +#: ../../library/zipfile.rst:1045 msgid "Default behaviors of extraction" msgstr "解壓縮的預設行為" -#: ../../library/zipfile.rst:1036 +#: ../../library/zipfile.rst:1047 msgid "" "Not knowing the default extraction behaviors can cause unexpected " "decompression results. For example, when extracting the same archive twice, " @@ -1499,3 +1518,6 @@ msgid "" msgstr "" "不了解預設的解壓縮行為可能導致非預期的解壓縮結果。例如,當兩次解壓縮同一個封" "存檔案時,它會不經詢問就覆寫檔案。" + +#~ msgid "The ZIP file format does not support timestamps before 1980." +#~ msgstr "ZIP 檔案格式不支援 1980 年以前的時間戳記。" diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 4b3a5146d24..1d7fd59b4b4 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-10 20:44+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,10 +33,10 @@ msgstr "" msgid "" "The :keyword:`if`, :keyword:`while` and :keyword:`for` statements implement " "traditional control flow constructs. :keyword:`try` specifies exception " -"handlers and/or cleanup code for a group of statements, while " -"the :keyword:`with` statement allows the execution of initialization and " -"finalization code around a block of code. Function and class definitions " -"are also syntactically compound statements." +"handlers and/or cleanup code for a group of statements, while the :keyword:" +"`with` statement allows the execution of initialization and finalization " +"code around a block of code. Function and class definitions are also " +"syntactically compound statements." msgstr "" #: ../../reference/compound_stmts.rst:26 @@ -78,8 +78,8 @@ msgid "" "Note that statements always end in a ``NEWLINE`` possibly followed by a " "``DEDENT``. Also note that optional continuation clauses always begin with " "a keyword that cannot start a statement, thus there are no ambiguities (the " -"'dangling :keyword:`else`' problem is solved in Python by requiring " -"nested :keyword:`if` statements to be indented)." +"'dangling :keyword:`else`' problem is solved in Python by requiring nested :" +"keyword:`if` statements to be indented)." msgstr "" #: ../../reference/compound_stmts.rst:75 @@ -127,9 +127,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:133 msgid "" "A :keyword:`break` statement executed in the first suite terminates the loop " -"without executing the :keyword:`!else` clause's suite. " -"A :keyword:`continue` statement executed in the first suite skips the rest " -"of the suite and goes back to testing the expression." +"without executing the :keyword:`!else` clause's suite. A :keyword:" +"`continue` statement executed in the first suite skips the rest of the suite " +"and goes back to testing the expression." msgstr "" #: ../../reference/compound_stmts.rst:142 @@ -147,20 +147,19 @@ msgid "" "The :token:`~python-grammar:starred_expression_list` expression is evaluated " "once; it should yield an :term:`iterable` object. An :term:`iterator` is " "created for that iterable. The first item provided by the iterator is then " -"assigned to the target list using the standard rules for assignments " -"(see :ref:`assignment`), and the suite is executed. This repeats for each " -"item provided by the iterator. When the iterator is exhausted, the suite in " -"the :keyword:`!else` clause, if present, is executed, and the loop " -"terminates." +"assigned to the target list using the standard rules for assignments (see :" +"ref:`assignment`), and the suite is executed. This repeats for each item " +"provided by the iterator. When the iterator is exhausted, the suite in the :" +"keyword:`!else` clause, if present, is executed, and the loop terminates." msgstr "" #: ../../reference/compound_stmts.rst:173 msgid "" "A :keyword:`break` statement executed in the first suite terminates the loop " -"without executing the :keyword:`!else` clause's suite. " -"A :keyword:`continue` statement executed in the first suite skips the rest " -"of the suite and continues with the next item, or with the :keyword:`!else` " -"clause if there is no next item." +"without executing the :keyword:`!else` clause's suite. A :keyword:" +"`continue` statement executed in the first suite skips the rest of the suite " +"and continues with the next item, or with the :keyword:`!else` clause if " +"there is no next item." msgstr "" #: ../../reference/compound_stmts.rst:179 @@ -204,9 +203,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:231 msgid "" -"Additional information on exceptions can be found in " -"section :ref:`exceptions`, and information on using the :keyword:`raise` " -"statement to generate exceptions may be found in section :ref:`raise`." +"Additional information on exceptions can be found in section :ref:" +"`exceptions`, and information on using the :keyword:`raise` statement to " +"generate exceptions may be found in section :ref:`raise`." msgstr "" #: ../../reference/compound_stmts.rst:235 @@ -260,13 +259,13 @@ msgstr "" #: ../../reference/compound_stmts.rst:270 msgid "" "When a matching :keyword:`!except` clause is found, the exception is " -"assigned to the target specified after the :keyword:`!as` keyword in " -"that :keyword:`!except` clause, if present, and the :keyword:`!except` " -"clause's suite is executed. All :keyword:`!except` clauses must have an " -"executable block. When the end of this block is reached, execution continues " -"normally after the entire :keyword:`try` statement. (This means that if two " -"nested handlers exist for the same exception, and the exception occurs in " -"the :keyword:`!try` clause of the inner handler, the outer handler will not " +"assigned to the target specified after the :keyword:`!as` keyword in that :" +"keyword:`!except` clause, if present, and the :keyword:`!except` clause's " +"suite is executed. All :keyword:`!except` clauses must have an executable " +"block. When the end of this block is reached, execution continues normally " +"after the entire :keyword:`try` statement. (This means that if two nested " +"handlers exist for the same exception, and the exception occurs in the :" +"keyword:`!try` clause of the inner handler, the outer handler will not " "handle the exception.)" msgstr "" @@ -364,15 +363,15 @@ msgstr ":keyword:`!except*` 子句" #: ../../reference/compound_stmts.rst:338 msgid "" -"The :keyword:`!except*` clause(s) are used for " -"handling :exc:`ExceptionGroup`\\s. The exception type for matching is " -"interpreted as in the case of :keyword:`except`, but in the case of " -"exception groups we can have partial matches when the type matches some of " -"the exceptions in the group. This means that multiple :keyword:`!except*` " -"clauses can execute, each handling part of the exception group. Each clause " -"executes at most once and handles an exception group of all matching " -"exceptions. Each exception in the group is handled by at most " -"one :keyword:`!except*` clause, the first that matches it. ::" +"The :keyword:`!except*` clause(s) are used for handling :exc:" +"`ExceptionGroup`\\s. The exception type for matching is interpreted as in " +"the case of :keyword:`except`, but in the case of exception groups we can " +"have partial matches when the type matches some of the exceptions in the " +"group. This means that multiple :keyword:`!except*` clauses can execute, " +"each handling part of the exception group. Each clause executes at most once " +"and handles an exception group of all matching exceptions. Each exception " +"in the group is handled by at most one :keyword:`!except*` clause, the first " +"that matches it. ::" msgstr "" #: ../../reference/compound_stmts.rst:348 @@ -436,8 +435,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:387 msgid "" "It is not possible to mix :keyword:`except` and :keyword:`!except*` in the " -"same :keyword:`try`. :keyword:`break`, :keyword:`continue` " -"and :keyword:`return` cannot appear in an :keyword:`!except*` clause." +"same :keyword:`try`. The :keyword:`break`, :keyword:`continue`, and :keyword:" +"`return` statements cannot appear in an :keyword:`!except*` clause." msgstr "" #: ../../reference/compound_stmts.rst:402 @@ -447,10 +446,10 @@ msgstr ":keyword:`!else` 子句" #: ../../reference/compound_stmts.rst:404 msgid "" "The optional :keyword:`!else` clause is executed if the control flow leaves " -"the :keyword:`try` suite, no exception was raised, and " -"no :keyword:`return`, :keyword:`continue`, or :keyword:`break` statement was " -"executed. Exceptions in the :keyword:`!else` clause are not handled by the " -"preceding :keyword:`except` clauses." +"the :keyword:`try` suite, no exception was raised, and no :keyword:" +"`return`, :keyword:`continue`, or :keyword:`break` statement was executed. " +"Exceptions in the :keyword:`!else` clause are not handled by the preceding :" +"keyword:`except` clauses." msgstr "" #: ../../reference/compound_stmts.rst:416 @@ -459,17 +458,16 @@ msgstr ":keyword:`!finally` 子句" #: ../../reference/compound_stmts.rst:418 msgid "" -"If :keyword:`!finally` is present, it specifies a 'cleanup' handler. " -"The :keyword:`try` clause is executed, including any :keyword:`except` " -"and :keyword:`else ` clauses. If an exception occurs in any of " -"the clauses and is not handled, the exception is temporarily saved. " -"The :keyword:`!finally` clause is executed. If there is a saved exception " -"it is re-raised at the end of the :keyword:`!finally` clause. If " -"the :keyword:`!finally` clause raises another exception, the saved exception " -"is set as the context of the new exception. If the :keyword:`!finally` " -"clause executes a :keyword:`return`, :keyword:`break` or :keyword:`continue` " -"statement, the saved exception is discarded. For example, this function " -"returns 42." +"If :keyword:`!finally` is present, it specifies a 'cleanup' handler. The :" +"keyword:`try` clause is executed, including any :keyword:`except` and :" +"keyword:`else ` clauses. If an exception occurs in any of the " +"clauses and is not handled, the exception is temporarily saved. The :keyword:" +"`!finally` clause is executed. If there is a saved exception it is re-" +"raised at the end of the :keyword:`!finally` clause. If the :keyword:`!" +"finally` clause raises another exception, the saved exception is set as the " +"context of the new exception. If the :keyword:`!finally` clause executes a :" +"keyword:`return`, :keyword:`break` or :keyword:`continue` statement, the " +"saved exception is discarded. For example, this function returns 42." msgstr "" #: ../../reference/compound_stmts.rst:431 @@ -525,15 +523,15 @@ msgstr "" #: ../../reference/compound_stmts.rst:464 msgid "" -"Prior to Python 3.8, a :keyword:`continue` statement was illegal in " -"the :keyword:`!finally` clause due to a problem with the implementation." +"Prior to Python 3.8, a :keyword:`continue` statement was illegal in the :" +"keyword:`!finally` clause due to a problem with the implementation." msgstr "" #: ../../reference/compound_stmts.rst:468 msgid "" -"The compiler emits a :exc:`SyntaxWarning` when " -"a :keyword:`return`, :keyword:`break` or :keyword:`continue` appears in " -"a :keyword:`!finally` block (see :pep:`765`)." +"The compiler emits a :exc:`SyntaxWarning` when a :keyword:`return`, :keyword:" +"`break` or :keyword:`continue` appears in a :keyword:`!finally` block (see :" +"pep:`765`)." msgstr "" #: ../../reference/compound_stmts.rst:478 @@ -544,8 +542,8 @@ msgstr ":keyword:`!with` 陳述式" msgid "" "The :keyword:`with` statement is used to wrap the execution of a block with " "methods defined by a context manager (see section :ref:`context-managers`). " -"This allows common :keyword:`try`...\\ :keyword:`except`..." -"\\ :keyword:`finally` usage patterns to be encapsulated for convenient reuse." +"This allows common :keyword:`try`...\\ :keyword:`except`...\\ :keyword:" +"`finally` usage patterns to be encapsulated for convenient reuse." msgstr "" #: ../../reference/compound_stmts.rst:497 @@ -556,8 +554,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:499 msgid "" -"The context expression (the expression given in the :token:`~python-" -"grammar:with_item`) is evaluated to obtain a context manager." +"The context expression (the expression given in the :token:`~python-grammar:" +"with_item`) is evaluated to obtain a context manager." msgstr "" #: ../../reference/compound_stmts.rst:502 @@ -581,11 +579,11 @@ msgstr "" #: ../../reference/compound_stmts.rst:513 msgid "" -"The :keyword:`with` statement guarantees that if " -"the :meth:`~object.__enter__` method returns without an error, " -"then :meth:`~object.__exit__` will always be called. Thus, if an error " -"occurs during the assignment to the target list, it will be treated the same " -"as an error occurring within the suite would be. See step 7 below." +"The :keyword:`with` statement guarantees that if the :meth:`~object." +"__enter__` method returns without an error, then :meth:`~object.__exit__` " +"will always be called. Thus, if an error occurs during the assignment to the " +"target list, it will be treated the same as an error occurring within the " +"suite would be. See step 7 below." msgstr "" #: ../../reference/compound_stmts.rst:519 @@ -596,16 +594,16 @@ msgstr "" msgid "" "The context manager's :meth:`~object.__exit__` method is invoked. If an " "exception caused the suite to be exited, its type, value, and traceback are " -"passed as arguments to :meth:`~object.__exit__`. Otherwise, " -"three :const:`None` arguments are supplied." +"passed as arguments to :meth:`~object.__exit__`. Otherwise, three :const:" +"`None` arguments are supplied." msgstr "" #: ../../reference/compound_stmts.rst:526 msgid "" -"If the suite was exited due to an exception, and the return value from " -"the :meth:`~object.__exit__` method was false, the exception is reraised. " -"If the return value was true, the exception is suppressed, and execution " -"continues with the statement following the :keyword:`with` statement." +"If the suite was exited due to an exception, and the return value from the :" +"meth:`~object.__exit__` method was false, the exception is reraised. If the " +"return value was true, the exception is suppressed, and execution continues " +"with the statement following the :keyword:`with` statement." msgstr "" #: ../../reference/compound_stmts.rst:531 @@ -673,8 +671,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:559 msgid "" -"With more than one item, the context managers are processed as if " -"multiple :keyword:`with` statements were nested::" +"With more than one item, the context managers are processed as if multiple :" +"keyword:`with` statements were nested::" msgstr "" #: ../../reference/compound_stmts.rst:562 @@ -1053,8 +1051,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:855 msgid "" -"The rule ``strings`` and the token ``NUMBER`` are defined in " -"the :doc:`standard Python grammar <./grammar>`. Triple-quoted strings are " +"The rule ``strings`` and the token ``NUMBER`` are defined in the :doc:" +"`standard Python grammar <./grammar>`. Triple-quoted strings are " "supported. Raw strings and byte strings are supported. :ref:`f-strings` " "and :ref:`t-strings` are not supported." msgstr "" @@ -1084,8 +1082,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:878 msgid "" "A single underscore ``_`` is not a capture pattern (this is what ``!'_'`` " -"expresses). It is instead treated as a :token:`~python-" -"grammar:wildcard_pattern`." +"expresses). It is instead treated as a :token:`~python-grammar:" +"wildcard_pattern`." msgstr "" #: ../../reference/compound_stmts.rst:882 @@ -1146,8 +1144,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:927 msgid "" -"In simple terms ``NAME1.NAME2`` will succeed only if `` == " -"NAME1.NAME2``" +"In simple terms ``NAME1.NAME2`` will succeed only if `` == NAME1." +"NAME2``" msgstr "" #: ../../reference/compound_stmts.rst:931 @@ -1407,14 +1405,14 @@ msgstr "" #: ../../reference/compound_stmts.rst:1103 msgid "" -"If ``name_or_attr`` is not an instance of the builtin :class:`type` , " -"raise :exc:`TypeError`." +"If ``name_or_attr`` is not an instance of the builtin :class:`type` , raise :" +"exc:`TypeError`." msgstr "" #: ../../reference/compound_stmts.rst:1106 msgid "" -"If the subject value is not an instance of ``name_or_attr`` (tested " -"via :func:`isinstance`), the class pattern fails." +"If the subject value is not an instance of ``name_or_attr`` (tested via :" +"func:`isinstance`), the class pattern fails." msgstr "" #: ../../reference/compound_stmts.rst:1109 @@ -1480,14 +1478,14 @@ msgstr "" #: ../../reference/compound_stmts.rst:1142 msgid "" -"If the returned value is not a tuple, the conversion fails " -"and :exc:`TypeError` is raised." +"If the returned value is not a tuple, the conversion fails and :exc:" +"`TypeError` is raised." msgstr "" #: ../../reference/compound_stmts.rst:1145 msgid "" -"If there are more positional patterns than " -"``len(cls.__match_args__)``, :exc:`TypeError` is raised." +"If there are more positional patterns than ``len(cls.__match_args__)``, :exc:" +"`TypeError` is raised." msgstr "" #: ../../reference/compound_stmts.rst:1148 @@ -1608,8 +1606,8 @@ msgstr "函式定義" #: ../../reference/compound_stmts.rst:1217 msgid "" -"A function definition defines a user-defined function object (see " -"section :ref:`types`):" +"A function definition defines a user-defined function object (see section :" +"ref:`types`):" msgstr "" #: ../../reference/compound_stmts.rst:1239 @@ -1669,9 +1667,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1269 msgid "" -"Functions may be decorated with any valid :token:`~python-" -"grammar:assignment_expression`. Previously, the grammar was much more " -"restrictive; see :pep:`614` for details." +"Functions may be decorated with any valid :token:`~python-grammar:" +"assignment_expression`. Previously, the grammar was much more restrictive; " +"see :pep:`614` for details." msgstr "" #: ../../reference/compound_stmts.rst:1274 @@ -1721,21 +1719,26 @@ msgid "" " penguin.append(\"property of the zoo\")\n" " return penguin" msgstr "" +"def whats_on_the_telly(penguin=None):\n" +" if penguin is None:\n" +" penguin = []\n" +" penguin.append(\"property of the zoo\")\n" +" return penguin" #: ../../reference/compound_stmts.rst:1318 msgid "" -"Function call semantics are described in more detail in " -"section :ref:`calls`. A function call always assigns values to all " -"parameters mentioned in the parameter list, either from positional " -"arguments, from keyword arguments, or from default values. If the form " -"\"``*identifier``\" is present, it is initialized to a tuple receiving any " -"excess positional parameters, defaulting to the empty tuple. If the form " -"\"``**identifier``\" is present, it is initialized to a new ordered mapping " -"receiving any excess keyword arguments, defaulting to a new empty mapping of " -"the same type. Parameters after \"``*``\" or \"``*identifier``\" are " -"keyword-only parameters and may only be passed by keyword arguments. " -"Parameters before \"``/``\" are positional-only parameters and may only be " -"passed by positional arguments." +"Function call semantics are described in more detail in section :ref:" +"`calls`. A function call always assigns values to all parameters mentioned " +"in the parameter list, either from positional arguments, from keyword " +"arguments, or from default values. If the form \"``*identifier``\" is " +"present, it is initialized to a tuple receiving any excess positional " +"parameters, defaulting to the empty tuple. If the form \"``**identifier``\" " +"is present, it is initialized to a new ordered mapping receiving any excess " +"keyword arguments, defaulting to a new empty mapping of the same type. " +"Parameters after \"``*``\" or \"``*identifier``\" are keyword-only " +"parameters and may only be passed by keyword arguments. Parameters before " +"\"``/``\" are positional-only parameters and may only be passed by " +"positional arguments." msgstr "" #: ../../reference/compound_stmts.rst:1330 @@ -1770,8 +1773,8 @@ msgid "" "described in section :ref:`lambda`. Note that the lambda expression is " "merely a shorthand for a simplified function definition; a function defined " "in a \":keyword:`def`\" statement can be passed around or assigned to " -"another name just like a function defined by a lambda expression. The " -"\":keyword:`!def`\" form is actually more powerful since it allows the " +"another name just like a function defined by a lambda expression. The \":" +"keyword:`!def`\" form is actually more powerful since it allows the " "execution of multiple statements and annotations." msgstr "" @@ -1869,14 +1872,14 @@ msgstr "" #: ../../reference/compound_stmts.rst:1426 msgid "" -"The class's suite is then executed in a new execution frame " -"(see :ref:`naming`), using a newly created local namespace and the original " -"global namespace. (Usually, the suite contains mostly function " -"definitions.) When the class's suite finishes execution, its execution " -"frame is discarded but its local namespace is saved. [#]_ A class object is " -"then created using the inheritance list for the base classes and the saved " -"local namespace for the attribute dictionary. The class name is bound to " -"this class object in the original local namespace." +"The class's suite is then executed in a new execution frame (see :ref:" +"`naming`), using a newly created local namespace and the original global " +"namespace. (Usually, the suite contains mostly function definitions.) When " +"the class's suite finishes execution, its execution frame is discarded but " +"its local namespace is saved. [#]_ A class object is then created using the " +"inheritance list for the base classes and the saved local namespace for the " +"attribute dictionary. The class name is bound to this class object in the " +"original local namespace." msgstr "" #: ../../reference/compound_stmts.rst:1435 @@ -1923,9 +1926,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1459 msgid "" -"Classes may be decorated with any valid :token:`~python-" -"grammar:assignment_expression`. Previously, the grammar was much more " -"restrictive; see :pep:`614` for details." +"Classes may be decorated with any valid :token:`~python-grammar:" +"assignment_expression`. Previously, the grammar was much more restrictive; " +"see :pep:`614` for details." msgstr "" #: ../../reference/compound_stmts.rst:1464 @@ -1933,8 +1936,8 @@ msgid "" "A list of :ref:`type parameters ` may be given in square " "brackets immediately after the class's name. This indicates to static type " "checkers that the class is generic. At runtime, the type parameters can be " -"retrieved from the class's :attr:`~type.__type_params__` attribute. " -"See :ref:`generic-classes` for more." +"retrieved from the class's :attr:`~type.__type_params__` attribute. See :ref:" +"`generic-classes` for more." msgstr "" #: ../../reference/compound_stmts.rst:1473 @@ -2178,9 +2181,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1648 msgid "" -":ref:`Functions ` (including :ref:`coroutines `), :ref:`classes ` and :ref:`type aliases ` may contain a " -"type parameter list::" +":ref:`Functions ` (including :ref:`coroutines `), :ref:" +"`classes ` and :ref:`type aliases ` may contain a type " +"parameter list::" msgstr "" #: ../../reference/compound_stmts.rst:1652 @@ -2237,9 +2240,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:1681 msgid "" -"Generic functions, classes, and type aliases have " -"a :attr:`~definition.__type_params__` attribute listing their type " -"parameters." +"Generic functions, classes, and type aliases have a :attr:`~definition." +"__type_params__` attribute listing their type parameters." msgstr "" #: ../../reference/compound_stmts.rst:1684 @@ -2382,8 +2384,8 @@ msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope `, which is not actually bound to any name at runtime. (One other " "liberty is taken in the translation: the syntax does not go through " -"attribute access on the :mod:`typing` module, but creates an instance " -"of :data:`typing.TypeVar` directly.)" +"attribute access on the :mod:`typing` module, but creates an instance of :" +"data:`typing.TypeVar` directly.)" msgstr "" #: ../../reference/compound_stmts.rst:1763 @@ -2411,8 +2413,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:1774 msgid "" -"Except for the :ref:`lazy evaluation ` of " -"the :class:`~typing.TypeVar` bound, this is equivalent to::" +"Except for the :ref:`lazy evaluation ` of the :class:" +"`~typing.TypeVar` bound, this is equivalent to::" msgstr "" #: ../../reference/compound_stmts.rst:1777 @@ -2475,9 +2477,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1818 msgid "" -"Here again ``annotation-def`` (not a real keyword) indicates " -"an :ref:`annotation scope `, and the name " -"``TYPE_PARAMS_OF_Bag`` is not actually bound at runtime." +"Here again ``annotation-def`` (not a real keyword) indicates an :ref:" +"`annotation scope `, and the name ``TYPE_PARAMS_OF_Bag`` " +"is not actually bound at runtime." msgstr "" #: ../../reference/compound_stmts.rst:1822 @@ -2595,8 +2597,8 @@ msgid "" "this is not enforced by the language, and in general annotations may contain " "arbitrary expressions. The presence of annotations does not change the " "runtime semantics of the code, except if some mechanism is used that " -"introspects and uses the annotations (such as :mod:`dataclasses` " -"or :func:`functools.singledispatch`)." +"introspects and uses the annotations (such as :mod:`dataclasses` or :func:" +"`functools.singledispatch`)." msgstr "" #: ../../reference/compound_stmts.rst:1890 @@ -2630,9 +2632,9 @@ msgstr "" msgid "" "This future statement will be deprecated and removed in a future version of " "Python, but not before Python 3.13 reaches its end of life (see :pep:`749`). " -"When it is used, introspection tools " -"like :func:`annotationlib.get_annotations` and :func:`typing.get_type_hints` " -"are less likely to be able to resolve annotations at runtime." +"When it is used, introspection tools like :func:`annotationlib." +"get_annotations` and :func:`typing.get_type_hints` are less likely to be " +"able to resolve annotations at runtime." msgstr "" #: ../../reference/compound_stmts.rst:1911 @@ -2641,9 +2643,9 @@ msgstr "註解" #: ../../reference/compound_stmts.rst:1912 msgid "" -"The exception is propagated to the invocation stack unless there is " -"a :keyword:`finally` clause which happens to raise another exception. That " -"new exception causes the old one to be lost." +"The exception is propagated to the invocation stack unless there is a :" +"keyword:`finally` clause which happens to raise another exception. That new " +"exception causes the old one to be lost." msgstr "" #: ../../reference/compound_stmts.rst:1916 @@ -2715,8 +2717,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:1942 msgid "" -"The standard library classes :class:`dict` " -"and :class:`types.MappingProxyType` are mappings." +"The standard library classes :class:`dict` and :class:`types." +"MappingProxyType` are mappings." msgstr "" #: ../../reference/compound_stmts.rst:1945 diff --git a/reference/datamodel.po b/reference/datamodel.po index 0097c0fda53..2d2bbd02937 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-10 20:44+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2024-09-24 19:03+0900\n" "Last-Translator: Kisaragi Hiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -66,8 +66,8 @@ msgid "" msgstr "" "一個物件的型別決定了該物件所支援的操作(例如「它有長度嗎?」),也同時定義該" "型別的物件能夠擁有的數值。:func:`type` 函式會回傳一個物件的型別(而該型別本身" -"也是一個物件)。如同它的識別性,一個物件的型別 (:dfn:`type`) 也是不可變的。" -"\\ [#]_" +"也是一個物件)。如同它的識別性,一個物件的型別 (:dfn:`type`) 也是不可變" +"的。\\ [#]_" #: ../../reference/datamodel.rst:50 msgid "" @@ -137,9 +137,9 @@ msgid "" "is garbage-collected, but since garbage collection is not guaranteed to " "happen, such objects also provide an explicit way to release the external " "resource, usually a :meth:`!close` method. Programs are strongly recommended " -"to explicitly close such objects. The :keyword:`try`..." -"\\ :keyword:`finally` statement and the :keyword:`with` statement provide " -"convenient ways to do this." +"to explicitly close such objects. The :keyword:`try`...\\ :keyword:" +"`finally` statement and the :keyword:`with` statement provide convenient " +"ways to do this." msgstr "" "某些物件包含對於「外部」資源的參照,像是開啟的檔案或是視窗。基本上這些資源會" "在物件被回收時釋放,但因為垃圾回收不保證會發生,這種物件也會提供明確釋放外部" @@ -241,10 +241,10 @@ msgid "" "will then try the reflected operation, or some other fallback, depending on " "the operator.) It should not be evaluated in a boolean context." msgstr "" -"這個型別只有一個數值。只有一個物件有這個數值。這個物件由內建名" -"稱 :data:`NotImplemented` 存取。數字方法和 rich comparison 方法應該在沒有為所" -"提供的運算元實作該操作的時候回傳這個數值。(直譯器接下來則會依運算子嘗試反轉" -"的操作或是其他的後備方案。)它不應該在預期布林值的情境中被計算。" +"這個型別只有一個數值。只有一個物件有這個數值。這個物件由內建名稱 :data:" +"`NotImplemented` 存取。數字方法和 rich comparison 方法應該在沒有為所提供的運" +"算元實作該操作的時候回傳這個數值。(直譯器接下來則會依運算子嘗試反轉的操作或" +"是其他的後備方案。)它不應該在預期布林值的情境中被計算。" #: ../../reference/datamodel.rst:172 msgid "See :ref:`implementing-the-arithmetic-operations` for more details." @@ -256,13 +256,13 @@ msgstr "" #: ../../reference/datamodel.rst:179 msgid "" -"Evaluating :data:`NotImplemented` in a boolean context now raises " -"a :exc:`TypeError`. It previously evaluated to :const:`True` and emitted " -"a :exc:`DeprecationWarning` since Python 3.9." +"Evaluating :data:`NotImplemented` in a boolean context now raises a :exc:" +"`TypeError`. It previously evaluated to :const:`True` and emitted a :exc:" +"`DeprecationWarning` since Python 3.9." msgstr "" "在預期布林值的情境中計算 :data:`NotImplemented` 現在會引發 :exc:`TypeError`。" -"它先前會計算為 :const:`True`,並自 Python 3.9 起會發" -"出 :exc:`DeprecationWarning`。" +"它先前會計算為 :const:`True`,並自 Python 3.9 起會發出 :exc:" +"`DeprecationWarning`。" #: ../../reference/datamodel.rst:186 ../../reference/datamodel.rst:187 msgid "Ellipsis" @@ -292,8 +292,8 @@ msgstr "" #: ../../reference/datamodel.rst:207 msgid "" -"The string representations of the numeric classes, computed " -"by :meth:`~object.__repr__` and :meth:`~object.__str__`, have the following " +"The string representations of the numeric classes, computed by :meth:" +"`~object.__repr__` and :meth:`~object.__str__`, have the following " "properties:" msgstr "" @@ -467,9 +467,9 @@ msgid "" "The built-in function :func:`ord` converts a code point from its string form " "to an integer in the range ``0 - 10FFFF``; :func:`chr` converts an integer " "in the range ``0 - 10FFFF`` to the corresponding length ``1`` string " -"object. :meth:`str.encode` can be used to convert a :class:`str` " -"to :class:`bytes` using the given text encoding, and :meth:`bytes.decode` " -"can be used to achieve the opposite." +"object. :meth:`str.encode` can be used to convert a :class:`str` to :class:" +"`bytes` using the given text encoding, and :meth:`bytes.decode` can be used " +"to achieve the opposite." msgstr "" #: ../../reference/datamodel.rst:367 @@ -495,8 +495,8 @@ msgid "" "A bytes object is an immutable array. The items are 8-bit bytes, " "represented by integers in the range 0 <= x < 256. Bytes literals (like " "``b'abc'``) and the built-in :func:`bytes` constructor can be used to create " -"bytes objects. Also, bytes objects can be decoded to strings via " -"the :meth:`~bytes.decode` method." +"bytes objects. Also, bytes objects can be decoded to strings via the :meth:" +"`~bytes.decode` method." msgstr "" #: ../../reference/datamodel.rst:391 @@ -506,8 +506,8 @@ msgstr "可變序列" #: ../../reference/datamodel.rst:400 msgid "" "Mutable sequences can be changed after they are created. The subscription " -"and slicing notations can be used as the target of assignment " -"and :keyword:`del` (delete) statements." +"and slicing notations can be used as the target of assignment and :keyword:" +"`del` (delete) statements." msgstr "" #: ../../reference/datamodel.rst:408 @@ -537,8 +537,8 @@ msgstr "位元組陣列" #: ../../reference/datamodel.rst:423 msgid "" -"A bytearray object is a mutable array. They are created by the built-" -"in :func:`bytearray` constructor. Aside from being mutable (and hence " +"A bytearray object is a mutable array. They are created by the built-in :" +"func:`bytearray` constructor. Aside from being mutable (and hence " "unhashable), byte arrays otherwise provide the same interface and " "functionality as immutable :class:`bytes` objects." msgstr "" @@ -576,8 +576,8 @@ msgstr "Set(集合)" #: ../../reference/datamodel.rst:454 msgid "" "These represent a mutable set. They are created by the built-in :func:`set` " -"constructor and can be modified afterwards by several methods, such " -"as :meth:`add `." +"constructor and can be modified afterwards by several methods, such as :meth:" +"`add `." msgstr "" #: ../../reference/datamodel.rst:459 @@ -586,10 +586,9 @@ msgstr "Frozen set(凍結集合)" #: ../../reference/datamodel.rst:462 msgid "" -"These represent an immutable set. They are created by the built-" -"in :func:`frozenset` constructor. As a frozenset is immutable " -"and :term:`hashable`, it can be used again as an element of another set, or " -"as a dictionary key." +"These represent an immutable set. They are created by the built-in :func:" +"`frozenset` constructor. As a frozenset is immutable and :term:`hashable`, " +"it can be used again as an element of another set, or as a dictionary key." msgstr "" #: ../../reference/datamodel.rst:469 @@ -658,8 +657,8 @@ msgstr "可呼叫型別" #: ../../reference/datamodel.rst:530 msgid "" -"These are the types to which the function call operation (see " -"section :ref:`calls`) can be applied:" +"These are the types to which the function call operation (see section :ref:" +"`calls`) can be applied:" msgstr "" #: ../../reference/datamodel.rst:537 @@ -690,9 +689,9 @@ msgstr "含義" #: ../../reference/datamodel.rst:564 msgid "" -"A reference to the :class:`dictionary ` that holds the " -"function's :ref:`global variables ` -- the global namespace of the " -"module in which the function was defined." +"A reference to the :class:`dictionary ` that holds the function's :ref:" +"`global variables ` -- the global namespace of the module in which " +"the function was defined." msgstr "" #: ../../reference/datamodel.rst:569 @@ -722,8 +721,8 @@ msgstr "函式的文件字串,若不可用則為 ``None``。" #: ../../reference/datamodel.rst:603 msgid "" -"The function's name. See also: :attr:`__name__ attributes " -"`." +"The function's name. See also: :attr:`__name__ attributes `." msgstr "" #: ../../reference/datamodel.rst:607 @@ -753,23 +752,23 @@ msgstr "代表編譯函式主體的\\ :ref:`程式碼物件 `。" #: ../../reference/datamodel.rst:626 msgid "" -"The namespace supporting arbitrary function attributes. See " -"also: :attr:`__dict__ attributes `." +"The namespace supporting arbitrary function attributes. See also: :attr:" +"`__dict__ attributes `." msgstr "" #: ../../reference/datamodel.rst:630 msgid "" "A :class:`dictionary ` containing annotations of :term:`parameters " "`. The keys of the dictionary are the parameter names, and " -"``'return'`` for the return annotation, if provided. See " -"also: :attr:`object.__annotations__`." +"``'return'`` for the return annotation, if provided. See also: :attr:`object." +"__annotations__`." msgstr "" #: ../../reference/datamodel.rst:636 ../../reference/datamodel.rst:1105 #: ../../reference/datamodel.rst:1249 msgid "" -"Annotations are now :ref:`lazily evaluated `. " -"See :pep:`649`." +"Annotations are now :ref:`lazily evaluated `. See :pep:" +"`649`." msgstr "" #: ../../reference/datamodel.rst:641 @@ -780,14 +779,14 @@ msgstr "" #: ../../reference/datamodel.rst:647 msgid "" -"A :class:`dictionary ` containing defaults for keyword-" -"only :term:`parameters `." +"A :class:`dictionary ` containing defaults for keyword-only :term:" +"`parameters `." msgstr "" #: ../../reference/datamodel.rst:651 msgid "" -"A :class:`tuple` containing the :ref:`type parameters ` of " -"a :ref:`generic function `." +"A :class:`tuple` containing the :ref:`type parameters ` of a :" +"ref:`generic function `." msgstr "" #: ../../reference/datamodel.rst:656 @@ -807,8 +806,8 @@ msgstr "" #: ../../reference/datamodel.rst:667 msgid "" "Additional information about a function's definition can be retrieved from " -"its :ref:`code object ` (accessible via " -"the :attr:`~function.__code__` attribute)." +"its :ref:`code object ` (accessible via the :attr:`~function." +"__code__` attribute)." msgstr "" #: ../../reference/datamodel.rst:675 @@ -837,15 +836,15 @@ msgstr "" #: ../../reference/datamodel.rst:704 msgid "" -"The method's documentation (same as :attr:`method.__func__.__doc__ " -"`). A :class:`string ` if the original function had a " +"The method's documentation (same as :attr:`method.__func__.__doc__ `). A :class:`string ` if the original function had a " "docstring, else ``None``." msgstr "" #: ../../reference/datamodel.rst:710 msgid "" -"The name of the method (same as :attr:`method.__func__.__name__ " -"`)" +"The name of the method (same as :attr:`method.__func__.__name__ `)" msgstr "" #: ../../reference/datamodel.rst:714 @@ -863,44 +862,43 @@ msgstr "" msgid "" "User-defined method objects may be created when getting an attribute of a " "class (perhaps via an instance of that class), if that attribute is a user-" -"defined :ref:`function object ` or " -"a :class:`classmethod` object." +"defined :ref:`function object ` or a :class:" +"`classmethod` object." msgstr "" #: ../../reference/datamodel.rst:727 msgid "" -"When an instance method object is created by retrieving a user-" -"defined :ref:`function object ` from a class via one of " -"its instances, its :attr:`~method.__self__` attribute is the instance, and " -"the method object is said to be *bound*. The new " -"method's :attr:`~method.__func__` attribute is the original function object." +"When an instance method object is created by retrieving a user-defined :ref:" +"`function object ` from a class via one of its " +"instances, its :attr:`~method.__self__` attribute is the instance, and the " +"method object is said to be *bound*. The new method's :attr:`~method." +"__func__` attribute is the original function object." msgstr "" #: ../../reference/datamodel.rst:733 msgid "" -"When an instance method object is created by retrieving " -"a :class:`classmethod` object from a class or instance, " -"its :attr:`~method.__self__` attribute is the class itself, and " -"its :attr:`~method.__func__` attribute is the function object underlying the " -"class method." +"When an instance method object is created by retrieving a :class:" +"`classmethod` object from a class or instance, its :attr:`~method.__self__` " +"attribute is the class itself, and its :attr:`~method.__func__` attribute is " +"the function object underlying the class method." msgstr "" #: ../../reference/datamodel.rst:738 msgid "" -"When an instance method object is called, the underlying function " -"(:attr:`~method.__func__`) is called, inserting the class instance " -"(:attr:`~method.__self__`) in front of the argument list. For instance, " -"when :class:`!C` is a class which contains a definition for a " -"function :meth:`!f`, and ``x`` is an instance of :class:`!C`, calling " -"``x.f(1)`` is equivalent to calling ``C.f(x, 1)``." +"When an instance method object is called, the underlying function (:attr:" +"`~method.__func__`) is called, inserting the class instance (:attr:`~method." +"__self__`) in front of the argument list. For instance, when :class:`!C` is " +"a class which contains a definition for a function :meth:`!f`, and ``x`` is " +"an instance of :class:`!C`, calling ``x.f(1)`` is equivalent to calling ``C." +"f(x, 1)``." msgstr "" #: ../../reference/datamodel.rst:745 msgid "" "When an instance method object is derived from a :class:`classmethod` " "object, the \"class instance\" stored in :attr:`~method.__self__` will " -"actually be the class itself, so that calling either ``x.f(1)`` or " -"``C.f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is the underlying " +"actually be the class itself, so that calling either ``x.f(1)`` or ``C." +"f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is the underlying " "function." msgstr "" @@ -917,15 +915,15 @@ msgstr "產生器函式" #: ../../reference/datamodel.rst:763 msgid "" -"A function or method which uses the :keyword:`yield` statement (see " -"section :ref:`yield`) is called a :dfn:`generator function`. Such a " -"function, when called, always returns an :term:`iterator` object which can " -"be used to execute the body of the function: calling the " -"iterator's :meth:`iterator.__next__` method will cause the function to " -"execute until it provides a value using the :keyword:`!yield` statement. " -"When the function executes a :keyword:`return` statement or falls off the " -"end, a :exc:`StopIteration` exception is raised and the iterator will have " -"reached the end of the set of values to be returned." +"A function or method which uses the :keyword:`yield` statement (see section :" +"ref:`yield`) is called a :dfn:`generator function`. Such a function, when " +"called, always returns an :term:`iterator` object which can be used to " +"execute the body of the function: calling the iterator's :meth:`iterator." +"__next__` method will cause the function to execute until it provides a " +"value using the :keyword:`!yield` statement. When the function executes a :" +"keyword:`return` statement or falls off the end, a :exc:`StopIteration` " +"exception is raised and the iterator will have reached the end of the set of " +"values to be returned." msgstr "" #: ../../reference/datamodel.rst:775 @@ -935,10 +933,10 @@ msgstr "Coroutine(協程)函式" #: ../../reference/datamodel.rst:780 msgid "" "A function or method which is defined using :keyword:`async def` is called " -"a :dfn:`coroutine function`. Such a function, when called, returns " -"a :term:`coroutine` object. It may contain :keyword:`await` expressions, as " -"well as :keyword:`async with` and :keyword:`async for` statements. See also " -"the :ref:`coroutine-objects` section." +"a :dfn:`coroutine function`. Such a function, when called, returns a :term:" +"`coroutine` object. It may contain :keyword:`await` expressions, as well " +"as :keyword:`async with` and :keyword:`async for` statements. See also the :" +"ref:`coroutine-objects` section." msgstr "" #: ../../reference/datamodel.rst:788 @@ -956,13 +954,13 @@ msgstr "" #: ../../reference/datamodel.rst:800 msgid "" -"Calling the asynchronous iterator's :meth:`aiterator.__anext__ " -"` method will return an :term:`awaitable` which when " -"awaited will execute until it provides a value using the :keyword:`yield` " -"expression. When the function executes an empty :keyword:`return` statement " -"or falls off the end, a :exc:`StopAsyncIteration` exception is raised and " -"the asynchronous iterator will have reached the end of the set of values to " -"be yielded." +"Calling the asynchronous iterator's :meth:`aiterator.__anext__ ` method will return an :term:`awaitable` which when awaited will " +"execute until it provides a value using the :keyword:`yield` expression. " +"When the function executes an empty :keyword:`return` statement or falls off " +"the end, a :exc:`StopAsyncIteration` exception is raised and the " +"asynchronous iterator will have reached the end of the set of values to be " +"yielded." msgstr "" #: ../../reference/datamodel.rst:813 @@ -976,17 +974,17 @@ msgid "" "standard built-in module). The number and type of the arguments are " "determined by the C function. Special read-only attributes:" msgstr "" -"一個內建函式物件是一個 C 函式的 wrapper。內建函式的範例有 :func:`len` " -"和 :func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數" -"數量與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" +"一個內建函式物件是一個 C 函式的 wrapper。內建函式的範例有 :func:`len` 和 :" +"func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數數量" +"與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" #: ../../reference/datamodel.rst:825 msgid "" ":attr:`!__doc__` is the function's documentation string, or ``None`` if " "unavailable. See :attr:`function.__doc__`." msgstr "" -":attr:`!__doc__` 是函式的文件字串,若不可用則為 ``None``。請" -"見 :attr:`function.__doc__`。" +":attr:`!__doc__` 是函式的文件字串,若不可用則為 ``None``。請見 :attr:" +"`function.__doc__`。" #: ../../reference/datamodel.rst:827 msgid "" @@ -1012,10 +1010,10 @@ msgid "" "This is really a different disguise of a built-in function, this time " "containing an object passed to the C function as an implicit extra " "argument. An example of a built-in method is ``alist.append()``, assuming " -"*alist* is a list object. In this case, the special read-only " -"attribute :attr:`!__self__` is set to the object denoted by *alist*. (The " -"attribute has the same semantics as it does with :attr:`other instance " -"methods `.)" +"*alist* is a list object. In this case, the special read-only attribute :" +"attr:`!__self__` is set to the object denoted by *alist*. (The attribute has " +"the same semantics as it does with :attr:`other instance methods `.)" msgstr "" #: ../../reference/datamodel.rst:854 @@ -1026,8 +1024,8 @@ msgstr "" msgid "" "Classes are callable. These objects normally act as factories for new " "instances of themselves, but variations are possible for class types that " -"override :meth:`~object.__new__`. The arguments of the call are passed " -"to :meth:`!__new__` and, in the typical case, to :meth:`~object.__init__` to " +"override :meth:`~object.__new__`. The arguments of the call are passed to :" +"meth:`!__new__` and, in the typical case, to :meth:`~object.__init__` to " "initialize the new instance." msgstr "" @@ -1037,8 +1035,8 @@ msgstr "類別實例" #: ../../reference/datamodel.rst:866 msgid "" -"Instances of arbitrary classes can be made callable by defining " -"a :meth:`~object.__call__` method in their class." +"Instances of arbitrary classes can be made callable by defining a :meth:" +"`~object.__call__` method in their class." msgstr "" #: ../../reference/datamodel.rst:873 @@ -1048,16 +1046,16 @@ msgstr "模組" #: ../../reference/datamodel.rst:879 msgid "" "Modules are a basic organizational unit of Python code, and are created by " -"the :ref:`import system ` as invoked either by " -"the :keyword:`import` statement, or by calling functions such " -"as :func:`importlib.import_module` and built-in :func:`__import__`. A " -"module object has a namespace implemented by a :class:`dictionary ` " -"object (this is the dictionary referenced by " -"the :attr:`~function.__globals__` attribute of functions defined in the " -"module). Attribute references are translated to lookups in this dictionary, " -"e.g., ``m.x`` is equivalent to ``m.__dict__[\"x\"]``. A module object does " -"not contain the code object used to initialize the module (since it isn't " -"needed once the initialization is done)." +"the :ref:`import system ` as invoked either by the :keyword:" +"`import` statement, or by calling functions such as :func:`importlib." +"import_module` and built-in :func:`__import__`. A module object has a " +"namespace implemented by a :class:`dictionary ` object (this is the " +"dictionary referenced by the :attr:`~function.__globals__` attribute of " +"functions defined in the module). Attribute references are translated to " +"lookups in this dictionary, e.g., ``m.x`` is equivalent to ``m." +"__dict__[\"x\"]``. A module object does not contain the code object used to " +"initialize the module (since it isn't needed once the initialization is " +"done)." msgstr "" #: ../../reference/datamodel.rst:892 @@ -1111,6 +1109,15 @@ msgid "" ">>> typing.__name__, typing.__spec__.name\n" "('keyboard_smashing', 'spelling')" msgstr "" +">>> import typing\n" +">>> typing.__name__, typing.__spec__.name\n" +"('typing', 'typing')\n" +">>> typing.__spec__.name = 'spelling'\n" +">>> typing.__name__, typing.__spec__.name\n" +"('typing', 'spelling')\n" +">>> typing.__name__ = 'keyboard_smashing'\n" +">>> typing.__name__, typing.__spec__.name\n" +"('keyboard_smashing', 'spelling')" #: ../../reference/datamodel.rst:949 msgid "" @@ -1121,8 +1128,8 @@ msgstr "" #: ../../reference/datamodel.rst:952 msgid "" "This attribute must be set to the fully qualified name of the module. It is " -"expected to match the value of :attr:`module.__spec__.name " -"`." +"expected to match the value of :attr:`module.__spec__.name `." msgstr "" #: ../../reference/datamodel.rst:958 @@ -1143,9 +1150,9 @@ msgstr "" msgid "" "If the module is top-level (that is, not a part of any specific package) " "then the attribute should be set to ``''`` (the empty string). Otherwise, it " -"should be set to the name of the module's package (which can be equal " -"to :attr:`module.__name__` if the module itself is a package). " -"See :pep:`366` for further details." +"should be set to the name of the module's package (which can be equal to :" +"attr:`module.__name__` if the module itself is a package). See :pep:`366` " +"for further details." msgstr "" #: ../../reference/datamodel.rst:975 @@ -1160,9 +1167,9 @@ msgstr "" #: ../../reference/datamodel.rst:981 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.parent " -"` instead of :attr:`!" -"module.__package__`. :attr:`__package__` is now only used as a fallback " -"if :attr:`!__spec__.parent` is not set, and this fallback path is deprecated." +"` instead of :attr:`!module." +"__package__`. :attr:`__package__` is now only used as a fallback if :attr:`!" +"__spec__.parent` is not set, and this fallback path is deprecated." msgstr "" #: ../../reference/datamodel.rst:987 ../../reference/datamodel.rst:1028 @@ -1174,18 +1181,17 @@ msgstr "" #: ../../reference/datamodel.rst:992 msgid "" -"The value of :attr:`!__package__` is expected to be the same " -"as :attr:`__spec__.parent " -"`. :attr:`__package__` is now only " -"used as a fallback during import resolution if :attr:`!__spec__.parent` is " -"not defined." +"The value of :attr:`!__package__` is expected to be the same as :attr:" +"`__spec__.parent `. :attr:" +"`__package__` is now only used as a fallback during import resolution if :" +"attr:`!__spec__.parent` is not defined." msgstr "" #: ../../reference/datamodel.rst:998 msgid "" ":exc:`ImportWarning` is raised if an import resolution falls back to :attr:`!" -"__package__` instead of :attr:`__spec__.parent " -"`." +"__package__` instead of :attr:`__spec__.parent `." msgstr "" #: ../../reference/datamodel.rst:1003 @@ -1215,16 +1221,16 @@ msgstr "" #: ../../reference/datamodel.rst:1019 msgid "" ":attr:`!__loader__` defaults to ``None`` for modules created dynamically " -"using the :class:`types.ModuleType` constructor; " -"use :func:`importlib.util.module_from_spec` instead to ensure the attribute " -"is set to a :term:`loader` object." +"using the :class:`types.ModuleType` constructor; use :func:`importlib.util." +"module_from_spec` instead to ensure the attribute is set to a :term:`loader` " +"object." msgstr "" #: ../../reference/datamodel.rst:1024 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.loader " -"` instead of :attr:`!" -"module.__loader__`." +"` instead of :attr:`!module." +"__loader__`." msgstr "" #: ../../reference/datamodel.rst:1033 @@ -1248,10 +1254,9 @@ msgstr "" #: ../../reference/datamodel.rst:1046 msgid "" -"It is **strongly** recommended that you " -"use :attr:`module.__spec__.submodule_search_locations " -"` instead " -"of :attr:`!module.__path__`." +"It is **strongly** recommended that you use :attr:`module.__spec__." +"submodule_search_locations ` instead of :attr:`!module.__path__`." msgstr "" #: ../../reference/datamodel.rst:1053 @@ -1284,18 +1289,18 @@ msgstr "" #: ../../reference/datamodel.rst:1071 msgid "" "Note that :attr:`!__cached__` may be set even if :attr:`!__file__` is not " -"set. However, that scenario is quite atypical. Ultimately, " -"the :term:`loader` is what makes use of the module spec provided by " -"the :term:`finder` (from which :attr:`!__file__` and :attr:`!__cached__` are " -"derived). So if a loader can load from a cached module but otherwise does " -"not load from a file, that atypical scenario may be appropriate." +"set. However, that scenario is quite atypical. Ultimately, the :term:" +"`loader` is what makes use of the module spec provided by the :term:`finder` " +"(from which :attr:`!__file__` and :attr:`!__cached__` are derived). So if a " +"loader can load from a cached module but otherwise does not load from a " +"file, that atypical scenario may be appropriate." msgstr "" #: ../../reference/datamodel.rst:1078 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.cached " -"` instead of :attr:`!" -"module.__cached__`." +"` instead of :attr:`!module." +"__cached__`." msgstr "" #: ../../reference/datamodel.rst:1082 @@ -1318,8 +1323,8 @@ msgstr "" #: ../../reference/datamodel.rst:1096 msgid "" -"The module's documentation string, or ``None`` if unavailable. See " -"also: :attr:`__doc__ attributes `." +"The module's documentation string, or ``None`` if unavailable. See also: :" +"attr:`__doc__ attributes `." msgstr "" "模組的文件字串,若不可用則為 ``None``。請見 :attr:`__doc__ attributes " "`。" @@ -1327,8 +1332,8 @@ msgstr "" #: ../../reference/datamodel.rst:1101 msgid "" "A dictionary containing :term:`variable annotations ` " -"collected during module body execution. For best practices on working " -"with :attr:`!__annotations__`, see :mod:`annotationlib`." +"collected during module body execution. For best practices on working with :" +"attr:`!__annotations__`, see :mod:`annotationlib`." msgstr "" #: ../../reference/datamodel.rst:1111 @@ -1366,25 +1371,25 @@ msgstr "" #: ../../reference/datamodel.rst:1141 msgid "" -"Custom class types are typically created by class definitions (see " -"section :ref:`class`). A class has a namespace implemented by a dictionary " -"object. Class attribute references are translated to lookups in this " -"dictionary, e.g., ``C.x`` is translated to ``C.__dict__[\"x\"]`` (although " -"there are a number of hooks which allow for other means of locating " -"attributes). When the attribute name is not found there, the attribute " -"search continues in the base classes. This search of the base classes uses " -"the C3 method resolution order which behaves correctly even in the presence " -"of 'diamond' inheritance structures where there are multiple inheritance " -"paths leading back to a common ancestor. Additional details on the C3 MRO " -"used by Python can be found at :ref:`python_2.3_mro`." +"Custom class types are typically created by class definitions (see section :" +"ref:`class`). A class has a namespace implemented by a dictionary object. " +"Class attribute references are translated to lookups in this dictionary, e." +"g., ``C.x`` is translated to ``C.__dict__[\"x\"]`` (although there are a " +"number of hooks which allow for other means of locating attributes). When " +"the attribute name is not found there, the attribute search continues in the " +"base classes. This search of the base classes uses the C3 method resolution " +"order which behaves correctly even in the presence of 'diamond' inheritance " +"structures where there are multiple inheritance paths leading back to a " +"common ancestor. Additional details on the C3 MRO used by Python can be " +"found at :ref:`python_2.3_mro`." msgstr "" #: ../../reference/datamodel.rst:1162 msgid "" "When a class attribute reference (for class :class:`!C`, say) would yield a " -"class method object, it is transformed into an instance method object " -"whose :attr:`~method.__self__` attribute is :class:`!C`. When it would yield " -"a :class:`staticmethod` object, it is transformed into the object wrapped by " +"class method object, it is transformed into an instance method object whose :" +"attr:`~method.__self__` attribute is :class:`!C`. When it would yield a :" +"class:`staticmethod` object, it is transformed into the object wrapped by " "the static method object. See section :ref:`descriptors` for another way in " "which attributes retrieved from a class may differ from those actually " "contained in its :attr:`~object.__dict__`." @@ -1408,8 +1413,8 @@ msgstr "特殊屬性" #: ../../reference/datamodel.rst:1202 msgid "" -"The class's name. See also: :attr:`__name__ attributes " -"`." +"The class's name. See also: :attr:`__name__ attributes `." msgstr "" #: ../../reference/datamodel.rst:1206 @@ -1425,8 +1430,8 @@ msgstr "" #: ../../reference/datamodel.rst:1213 msgid "" "A :class:`mapping proxy ` providing a read-only view " -"of the class's namespace. See also: :attr:`__dict__ attributes " -"`." +"of the class's namespace. See also: :attr:`__dict__ attributes `." msgstr "" #: ../../reference/datamodel.rst:1218 @@ -1474,14 +1479,14 @@ msgstr "" #: ../../reference/datamodel.rst:1254 msgid "" "The :term:`annotate function` for this class, or ``None`` if the class has " -"no annotations. See also: :attr:`__annotate__ attributes " -"`." +"no annotations. See also: :attr:`__annotate__ attributes `." msgstr "" #: ../../reference/datamodel.rst:1261 msgid "" -"A :class:`tuple` containing the :ref:`type parameters ` of " -"a :ref:`generic class `." +"A :class:`tuple` containing the :ref:`type parameters ` of a :" +"ref:`generic class `." msgstr "" #: ../../reference/datamodel.rst:1267 @@ -1493,8 +1498,8 @@ msgstr "" #: ../../reference/datamodel.rst:1273 msgid "" "The line number of the first line of the class definition, including " -"decorators. Setting the :attr:`~type.__module__` attribute removes " -"the :attr:`!__firstlineno__` item from the type's dictionary." +"decorators. Setting the :attr:`~type.__module__` attribute removes the :attr:" +"`!__firstlineno__` item from the type's dictionary." msgstr "" #: ../../reference/datamodel.rst:1281 @@ -1556,16 +1561,16 @@ msgid "" "\"Classes\". See section :ref:`descriptors` for another way in which " "attributes of a class retrieved via its instances may differ from the " "objects actually stored in the class's :attr:`~object.__dict__`. If no " -"class attribute is found, and the object's class has " -"a :meth:`~object.__getattr__` method, that is called to satisfy the lookup." +"class attribute is found, and the object's class has a :meth:`~object." +"__getattr__` method, that is called to satisfy the lookup." msgstr "" #: ../../reference/datamodel.rst:1335 msgid "" "Attribute assignments and deletions update the instance's dictionary, never " -"a class's dictionary. If the class has a :meth:`~object.__setattr__` " -"or :meth:`~object.__delattr__` method, this is called instead of updating " -"the instance dictionary directly." +"a class's dictionary. If the class has a :meth:`~object.__setattr__` or :" +"meth:`~object.__delattr__` method, this is called instead of updating the " +"instance dictionary directly." msgstr "" #: ../../reference/datamodel.rst:1345 @@ -1593,9 +1598,9 @@ msgstr "" msgid "" "A :term:`file object` represents an open file. Various shortcuts are " "available to create file objects: the :func:`open` built-in function, and " -"also :func:`os.popen`, :func:`os.fdopen`, and " -"the :meth:`~socket.socket.makefile` method of socket objects (and perhaps by " -"other functions or methods provided by extension modules)." +"also :func:`os.popen`, :func:`os.fdopen`, and the :meth:`~socket.socket." +"makefile` method of socket objects (and perhaps by other functions or " +"methods provided by extension modules)." msgstr "" #: ../../reference/datamodel.rst:1388 @@ -1623,15 +1628,14 @@ msgstr "程式碼物件" #: ../../reference/datamodel.rst:1414 msgid "" -"Code objects represent *byte-compiled* executable Python code, " -"or :term:`bytecode`. The difference between a code object and a function " -"object is that the function object contains an explicit reference to the " -"function's globals (the module in which it was defined), while a code object " -"contains no context; also the default argument values are stored in the " -"function object, not in the code object (because they represent values " -"calculated at run-time). Unlike function objects, code objects are " -"immutable and contain no references (directly or indirectly) to mutable " -"objects." +"Code objects represent *byte-compiled* executable Python code, or :term:" +"`bytecode`. The difference between a code object and a function object is " +"that the function object contains an explicit reference to the function's " +"globals (the module in which it was defined), while a code object contains " +"no context; also the default argument values are stored in the function " +"object, not in the code object (because they represent values calculated at " +"run-time). Unlike function objects, code objects are immutable and contain " +"no references (directly or indirectly) to mutable objects." msgstr "" #: ../../reference/datamodel.rst:1448 @@ -1744,17 +1748,17 @@ msgid "" "``0x04`` is set if the function uses the ``*arguments`` syntax to accept an " "arbitrary number of positional arguments; bit ``0x08`` is set if the " "function uses the ``**keywords`` syntax to accept arbitrary keyword " -"arguments; bit ``0x20`` is set if the function is a generator. " -"See :ref:`inspect-module-co-flags` for details on the semantics of each " -"flags that might be present." +"arguments; bit ``0x20`` is set if the function is a generator. See :ref:" +"`inspect-module-co-flags` for details on the semantics of each flags that " +"might be present." msgstr "" #: ../../reference/datamodel.rst:1530 msgid "" "Future feature declarations (for example, ``from __future__ import " "division``) also use bits in :attr:`~codeobject.co_flags` to indicate " -"whether a code object was compiled with a particular feature enabled. " -"See :attr:`~__future__._Feature.compiler_flag`." +"whether a code object was compiled with a particular feature enabled. See :" +"attr:`~__future__._Feature.compiler_flag`." msgstr "" #: ../../reference/datamodel.rst:1534 @@ -1764,10 +1768,10 @@ msgstr "" #: ../../reference/datamodel.rst:1538 msgid "" -"If a code object represents a function and has a docstring, " -"the :data:`~inspect.CO_HAS_DOCSTRING` bit is set " -"in :attr:`~codeobject.co_flags` and the first item " -"in :attr:`~codeobject.co_consts` is the docstring of the function." +"If a code object represents a function and has a docstring, the :data:" +"`~inspect.CO_HAS_DOCSTRING` bit is set in :attr:`~codeobject.co_flags` and " +"the first item in :attr:`~codeobject.co_consts` is the docstring of the " +"function." msgstr "" #: ../../reference/datamodel.rst:1544 @@ -1830,9 +1834,9 @@ msgstr "" #: ../../reference/datamodel.rst:1581 msgid "" -"Returns an iterator that yields information about successive ranges " -"of :term:`bytecode`\\s. Each item yielded is a ``(start, end, " -"lineno)`` :class:`tuple`:" +"Returns an iterator that yields information about successive ranges of :term:" +"`bytecode`\\s. Each item yielded is a ``(start, end, lineno)`` :class:" +"`tuple`:" msgstr "" #: ../../reference/datamodel.rst:1585 @@ -1849,9 +1853,9 @@ msgstr "" #: ../../reference/datamodel.rst:1589 msgid "" -"``lineno`` is an :class:`int` representing the line number of " -"the :term:`bytecode` range, or ``None`` if the bytecodes in the given range " -"have no line number" +"``lineno`` is an :class:`int` representing the line number of the :term:" +"`bytecode` range, or ``None`` if the bytecodes in the given range have no " +"line number" msgstr "" #: ../../reference/datamodel.rst:1593 @@ -1875,8 +1879,8 @@ msgstr "" #: ../../reference/datamodel.rst:1600 msgid "" -"The last :class:`tuple` yielded will have ``end`` equal to the size of " -"the :term:`bytecode`." +"The last :class:`tuple` yielded will have ``end`` equal to the size of the :" +"term:`bytecode`." msgstr "" #: ../../reference/datamodel.rst:1603 @@ -1924,8 +1928,8 @@ msgstr "" #: ../../reference/datamodel.rst:1653 msgid "" "The :ref:`code object ` being executed in this frame. " -"Accessing this attribute raises an :ref:`auditing event ` " -"``object.__getattr__`` with arguments ``obj`` and ``\"f_code\"``." +"Accessing this attribute raises an :ref:`auditing event ` ``object." +"__getattr__`` with arguments ``obj`` and ``\"f_code\"``." msgstr "" "在這個 frame 中執行的\\ :ref:`程式碼物件 (code object) `。存取" "這個屬性會引發一個附帶引數 ``obj`` 與 ``\"f_code\"`` 的\\ :ref:`稽核事件 " @@ -1955,8 +1959,8 @@ msgstr "" #: ../../reference/datamodel.rst:1675 msgid "" -"The \"precise instruction\" of the frame object (this is an index into " -"the :term:`bytecode` string of the :ref:`code object `)" +"The \"precise instruction\" of the frame object (this is an index into the :" +"term:`bytecode` string of the :ref:`code object `)" msgstr "" #: ../../reference/datamodel.rst:1680 @@ -2042,18 +2046,18 @@ msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " "inserted in front of the current traceback. When an exception handler is " -"entered, the stack trace is made available to the program. (See " -"section :ref:`try`.) It is accessible as the third item of the tuple " -"returned by :func:`sys.exc_info`, and as " -"the :attr:`~BaseException.__traceback__` attribute of the caught exception." +"entered, the stack trace is made available to the program. (See section :ref:" +"`try`.) It is accessible as the third item of the tuple returned by :func:" +"`sys.exc_info`, and as the :attr:`~BaseException.__traceback__` attribute of " +"the caught exception." msgstr "" #: ../../reference/datamodel.rst:1773 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " -"interactive, it is also made available to the user " -"as :data:`sys.last_traceback`." +"interactive, it is also made available to the user as :data:`sys." +"last_traceback`." msgstr "" #: ../../reference/datamodel.rst:1778 @@ -2070,8 +2074,8 @@ msgstr "" #: ../../reference/datamodel.rst:1796 msgid "" -"Accessing this attribute raises an :ref:`auditing event ` " -"``object.__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." +"Accessing this attribute raises an :ref:`auditing event ` ``object." +"__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." msgstr "" "存取此屬性會引發一個附帶引數 ``obj`` 與 ``\"tb_frame\"`` 的\\ :ref:`稽核事件 " "` ``object.__getattr__``。" @@ -2115,9 +2119,9 @@ msgstr "" #: ../../reference/datamodel.rst:1839 msgid "" -"Special read-only attributes: :attr:`~slice.start` is the lower " -"bound; :attr:`~slice.stop` is the upper bound; :attr:`~slice.step` is the " -"step value; each is ``None`` if omitted. These attributes can have any type." +"Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" +"`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " +"each is ``None`` if omitted. These attributes can have any type." msgstr "" #: ../../reference/datamodel.rst:1843 @@ -2159,8 +2163,8 @@ msgid "" "another object that alters the way in which that object is retrieved from " "classes and class instances. The behaviour of class method objects upon such " "retrieval is described above, under :ref:`\"instance methods\" `. Class method objects are created by the built-" -"in :func:`classmethod` constructor." +"methods>`. Class method objects are created by the built-in :func:" +"`classmethod` constructor." msgstr "" #: ../../reference/datamodel.rst:1880 @@ -2173,21 +2177,21 @@ msgid "" "(such as arithmetic operations or subscripting and slicing) by defining " "methods with special names. This is Python's approach to :dfn:`operator " "overloading`, allowing classes to define their own behavior with respect to " -"language operators. For instance, if a class defines a method " -"named :meth:`~object.__getitem__`, and ``x`` is an instance of this class, " -"then ``x[i]`` is roughly equivalent to ``type(x).__getitem__(x, i)``. " -"Except where mentioned, attempts to execute an operation raise an exception " -"when no appropriate method is defined (typically :exc:`AttributeError` " -"or :exc:`TypeError`)." +"language operators. For instance, if a class defines a method named :meth:" +"`~object.__getitem__`, and ``x`` is an instance of this class, then ``x[i]`` " +"is roughly equivalent to ``type(x).__getitem__(x, i)``. Except where " +"mentioned, attempts to execute an operation raise an exception when no " +"appropriate method is defined (typically :exc:`AttributeError` or :exc:" +"`TypeError`)." msgstr "" #: ../../reference/datamodel.rst:1897 msgid "" "Setting a special method to ``None`` indicates that the corresponding " -"operation is not available. For example, if a class " -"sets :meth:`~object.__iter__` to ``None``, the class is not iterable, so " -"calling :func:`iter` on its instances will raise a :exc:`TypeError` (without " -"falling back to :meth:`~object.__getitem__`). [#]_" +"operation is not available. For example, if a class sets :meth:`~object." +"__iter__` to ``None``, the class is not iterable, so calling :func:`iter` on " +"its instances will raise a :exc:`TypeError` (without falling back to :meth:" +"`~object.__getitem__`). [#]_" msgstr "" #: ../../reference/datamodel.rst:1903 @@ -2266,10 +2270,10 @@ msgstr "" #: ../../reference/datamodel.rst:1969 msgid "" "Called when the instance is about to be destroyed. This is also called a " -"finalizer or (improperly) a destructor. If a base class has " -"a :meth:`__del__` method, the derived class's :meth:`__del__` method, if " -"any, must explicitly call it to ensure proper deletion of the base class " -"part of the instance." +"finalizer or (improperly) a destructor. If a base class has a :meth:" +"`__del__` method, the derived class's :meth:`__del__` method, if any, must " +"explicitly call it to ensure proper deletion of the base class part of the " +"instance." msgstr "" #: ../../reference/datamodel.rst:1975 @@ -2310,7 +2314,7 @@ msgstr "" #: ../../reference/datamodel.rst:2004 msgid "Documentation for the :mod:`gc` module." -msgstr "" +msgstr ":mod:`gc` 模組的文件。" #: ../../reference/datamodel.rst:2008 msgid "" @@ -2324,8 +2328,8 @@ msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " "lock or invoke any other blocking resource, it may deadlock as the resource " -"may already be taken by the code that gets interrupted to " -"execute :meth:`__del__`." +"may already be taken by the code that gets interrupted to execute :meth:" +"`__del__`." msgstr "" #: ../../reference/datamodel.rst:2018 @@ -2346,10 +2350,9 @@ msgid "" "like a valid Python expression that could be used to recreate an object with " "the same value (given an appropriate environment). If this is not possible, " "a string of the form ``<...some useful description...>`` should be returned. " -"The return value must be a string object. If a class " -"defines :meth:`__repr__` but not :meth:`__str__`, then :meth:`__repr__` is " -"also used when an \"informal\" string representation of instances of that " -"class is required." +"The return value must be a string object. If a class defines :meth:" +"`__repr__` but not :meth:`__str__`, then :meth:`__repr__` is also used when " +"an \"informal\" string representation of instances of that class is required." msgstr "" #: ../../reference/datamodel.rst:2042 @@ -2383,8 +2386,8 @@ msgstr "" #: ../../reference/datamodel.rst:2073 msgid "" "Called by :ref:`bytes ` to compute a byte-string representation " -"of an object. This should return a :class:`bytes` object. " -"The :class:`object` class itself does not provide this method." +"of an object. This should return a :class:`bytes` object. The :class:" +"`object` class itself does not provide this method." msgstr "" #: ../../reference/datamodel.rst:2085 @@ -2429,10 +2432,10 @@ msgstr "" #: ../../reference/datamodel.rst:2122 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " -"between operator symbols and method names is as follows: ``xy`` calls " -"``x.__gt__(y)``, and ``x>=y`` calls ``x.__ge__(y)``." +"between operator symbols and method names is as follows: ``xy`` calls ``x.__gt__(y)``, and ``x>=y`` " +"calls ``x.__ge__(y)``." msgstr "" #: ../../reference/datamodel.rst:2128 @@ -2448,15 +2451,14 @@ msgstr "" #: ../../reference/datamodel.rst:2135 msgid "" -"By default, ``object`` implements :meth:`__eq__` by using ``is``, " -"returning :data:`NotImplemented` in the case of a false comparison: ``True " -"if x is y else NotImplemented``. For :meth:`__ne__`, by default it delegates " -"to :meth:`__eq__` and inverts the result unless it is :data:`!" -"NotImplemented`. There are no other implied relationships among the " -"comparison operators or default implementations; for example, the truth of " -"``(x` such as :class:`int`, :class:`bytes`, " -"and :class:`tuple`." +"` such as :class:`int`, :class:`bytes`, and :class:" +"`tuple`." msgstr "" #: ../../reference/datamodel.rst:2634 @@ -3074,8 +3075,8 @@ msgstr "" msgid "" "If a :class:`dictionary ` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " -"can be used to provide per-attribute docstrings that will be recognised " -"by :func:`inspect.getdoc` and displayed in the output of :func:`help`." +"can be used to provide per-attribute docstrings that will be recognised by :" +"func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" #: ../../reference/datamodel.rst:2641 @@ -3105,13 +3106,12 @@ msgstr "" #: ../../reference/datamodel.rst:2660 msgid "" -"Whenever a class inherits from another " -"class, :meth:`~object.__init_subclass__` is called on the parent class. This " -"way, it is possible to write classes which change the behavior of " -"subclasses. This is closely related to class decorators, but where class " -"decorators only affect the specific class they're applied to, " -"``__init_subclass__`` solely applies to future subclasses of the class " -"defining the method." +"Whenever a class inherits from another class, :meth:`~object." +"__init_subclass__` is called on the parent class. This way, it is possible " +"to write classes which change the behavior of subclasses. This is closely " +"related to class decorators, but where class decorators only affect the " +"specific class they're applied to, ``__init_subclass__`` solely applies to " +"future subclasses of the class defining the method." msgstr "" #: ../../reference/datamodel.rst:2669 @@ -3183,9 +3183,9 @@ msgstr "" #: ../../reference/datamodel.rst:2711 msgid "" -"If the class variable is assigned after the class is " -"created, :meth:`__set_name__` will not be called automatically. If " -"needed, :meth:`__set_name__` can be called directly::" +"If the class variable is assigned after the class is created, :meth:" +"`__set_name__` will not be called automatically. If needed, :meth:" +"`__set_name__` can be called directly::" msgstr "" #: ../../reference/datamodel.rst:2715 @@ -3277,14 +3277,14 @@ msgstr "" #: ../../reference/datamodel.rst:2772 msgid "" -"If a base that appears in a class definition is not an instance " -"of :class:`type`, then an :meth:`!__mro_entries__` method is searched on the " -"base. If an :meth:`!__mro_entries__` method is found, the base is " -"substituted with the result of a call to :meth:`!__mro_entries__` when " -"creating the class. The method is called with the original bases tuple " -"passed to the *bases* parameter, and must return a tuple of classes that " -"will be used instead of the base. The returned tuple may be empty: in these " -"cases, the original base is ignored." +"If a base that appears in a class definition is not an instance of :class:" +"`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " +"an :meth:`!__mro_entries__` method is found, the base is substituted with " +"the result of a call to :meth:`!__mro_entries__` when creating the class. " +"The method is called with the original bases tuple passed to the *bases* " +"parameter, and must return a tuple of classes that will be used instead of " +"the base. The returned tuple may be empty: in these cases, the original base " +"is ignored." msgstr "" #: ../../reference/datamodel.rst:2783 @@ -3301,8 +3301,8 @@ msgstr ":func:`types.get_original_bases`" #: ../../reference/datamodel.rst:2787 msgid "" -"Retrieve a class's \"original bases\" prior to modifications " -"by :meth:`~object.__mro_entries__`." +"Retrieve a class's \"original bases\" prior to modifications by :meth:" +"`~object.__mro_entries__`." msgstr "" #: ../../reference/datamodel.rst:2790 @@ -3329,8 +3329,8 @@ msgstr "" #: ../../reference/datamodel.rst:2802 msgid "" -"if an explicit metaclass is given and it is *not* an instance " -"of :func:`type`, then it is used directly as the metaclass;" +"if an explicit metaclass is given and it is *not* an instance of :func:" +"`type`, then it is used directly as the metaclass;" msgstr "" #: ../../reference/datamodel.rst:2804 @@ -3417,10 +3417,10 @@ msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " "created by the compiler if any methods in a class body refer to either " -"``__class__`` or ``super``. This allows the zero argument form " -"of :func:`super` to correctly identify the class being defined based on " -"lexical scoping, while the class or instance that was used to make the " -"current call is identified based on the first argument passed to the method." +"``__class__`` or ``super``. This allows the zero argument form of :func:" +"`super` to correctly identify the class being defined based on lexical " +"scoping, while the class or instance that was used to make the current call " +"is identified based on the first argument passed to the method." msgstr "" #: ../../reference/datamodel.rst:2883 @@ -3498,8 +3498,8 @@ msgstr "" #: ../../reference/datamodel.rst:2927 msgid "" -"The following methods are used to override the default behavior of " -"the :func:`isinstance` and :func:`issubclass` built-in functions." +"The following methods are used to override the default behavior of the :func:" +"`isinstance` and :func:`issubclass` built-in functions." msgstr "" #: ../../reference/datamodel.rst:2930 @@ -3538,11 +3538,11 @@ msgstr "" #: ../../reference/datamodel.rst:2957 msgid "" -"Includes the specification for customizing :func:`isinstance` " -"and :func:`issubclass` behavior through :meth:`~type.__instancecheck__` " -"and :meth:`~type.__subclasscheck__`, with motivation for this functionality " -"in the context of adding Abstract Base Classes (see the :mod:`abc` module) " -"to the language." +"Includes the specification for customizing :func:`isinstance` and :func:" +"`issubclass` behavior through :meth:`~type.__instancecheck__` and :meth:" +"`~type.__subclasscheck__`, with motivation for this functionality in the " +"context of adding Abstract Base Classes (see the :mod:`abc` module) to the " +"language." msgstr "" #: ../../reference/datamodel.rst:2965 @@ -3575,8 +3575,8 @@ msgstr "" #: ../../reference/datamodel.rst:2980 msgid "" -":ref:`Generics`, :ref:`user-defined generics` " -"and :class:`typing.Generic`" +":ref:`Generics`, :ref:`user-defined generics` and :" +"class:`typing.Generic`" msgstr "" #: ../../reference/datamodel.rst:2981 @@ -3600,8 +3600,8 @@ msgstr "" #: ../../reference/datamodel.rst:2992 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " -"method. As such, there is no need for it to be decorated " -"with :func:`@classmethod` when it is defined." +"method. As such, there is no need for it to be decorated with :func:" +"`@classmethod` when it is defined." msgstr "" #: ../../reference/datamodel.rst:2998 @@ -3619,10 +3619,9 @@ msgstr "" msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " -"standard library class that already " -"implements :meth:`~object.__class_getitem__`, or inherit " -"from :class:`typing.Generic`, which has its own implementation of " -"``__class_getitem__()``." +"standard library class that already implements :meth:`~object." +"__class_getitem__`, or inherit from :class:`typing.Generic`, which has its " +"own implementation of ``__class_getitem__()``." msgstr "" #: ../../reference/datamodel.rst:3010 @@ -3650,9 +3649,8 @@ msgstr "" #: ../../reference/datamodel.rst:3029 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " -"follows something like the following process to decide " -"whether :meth:`~object.__getitem__` or :meth:`~object.__class_getitem__` " -"should be called::" +"follows something like the following process to decide whether :meth:" +"`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" msgstr "" #: ../../reference/datamodel.rst:3034 @@ -3685,10 +3683,10 @@ msgstr "" msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " -"the :class:`type` class as their metaclass. :class:`type` does not " -"define :meth:`~object.__getitem__`, meaning that expressions such as " -"``list[int]``, ``dict[str, float]`` and ``tuple[str, bytes]`` all result " -"in :meth:`~object.__class_getitem__` being called::" +"the :class:`type` class as their metaclass. :class:`type` does not define :" +"meth:`~object.__getitem__`, meaning that expressions such as ``list[int]``, " +"``dict[str, float]`` and ``tuple[str, bytes]`` all result in :meth:`~object." +"__class_getitem__` being called::" msgstr "" #: ../../reference/datamodel.rst:3064 @@ -3708,10 +3706,9 @@ msgstr "" #: ../../reference/datamodel.rst:3076 msgid "" -"However, if a class has a custom metaclass that " -"defines :meth:`~object.__getitem__`, subscribing the class may result in " -"different behaviour. An example of this can be found in the :mod:`enum` " -"module::" +"However, if a class has a custom metaclass that defines :meth:`~object." +"__getitem__`, subscribing the class may result in different behaviour. An " +"example of this can be found in the :mod:`enum` module::" msgstr "" #: ../../reference/datamodel.rst:3080 @@ -3740,9 +3737,9 @@ msgstr "" #: ../../reference/datamodel.rst:3100 msgid "" -"Introducing :meth:`~object.__class_getitem__`, and outlining when " -"a :ref:`subscription` results in ``__class_getitem__()`` " -"being called instead of :meth:`~object.__getitem__`" +"Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" +"`subscription` results in ``__class_getitem__()`` being " +"called instead of :meth:`~object.__getitem__`" msgstr "" #: ../../reference/datamodel.rst:3108 @@ -3764,39 +3761,50 @@ msgstr "" msgid "" "The following methods can be defined to implement container objects. None of " "them are provided by the :class:`object` class itself. Containers usually " -"are :term:`sequences ` (such as :class:`lists ` " -"or :class:`tuples `) or :term:`mappings ` " -"(like :term:`dictionaries `), but can represent other containers " -"as well. The first set of methods is used either to emulate a sequence or " -"to emulate a mapping; the difference is that for a sequence, the allowable " -"keys should be the integers *k* for which ``0 <= k < N`` where *N* is the " -"length of the sequence, or :class:`slice` objects, which define a range of " -"items. It is also recommended that mappings provide the methods :meth:`!" -"keys`, :meth:`!values`, :meth:`!items`, :meth:`!get`, :meth:`!" -"clear`, :meth:`!setdefault`, :meth:`!pop`, :meth:`!popitem`, :meth:`!copy`, " -"and :meth:`!update` behaving similar to those for Python's " -"standard :class:`dictionary ` objects. The :mod:`collections.abc` " -"module provides a :class:`~collections.abc.MutableMapping` :term:`abstract " -"base class` to help create those methods from a base set " -"of :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, " -"and :meth:`!keys`. Mutable sequences should provide " -"methods :meth:`~sequence.append`, :meth:`~sequence.count`, :meth:`~sequence.index`, :meth:`~sequence.extend`, :meth:`~sequence.insert`, :meth:`~sequence.pop`, :meth:`~sequence.remove`, :meth:`~sequence.reverse` " -"and :meth:`!sort`, like Python standard :class:`list` objects. Finally, " -"sequence types should implement addition (meaning concatenation) and " -"multiplication (meaning repetition) by defining the " -"methods :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object.__iadd__`, :meth:`~object.__mul__`, :meth:`~object.__rmul__` " -"and :meth:`~object.__imul__` described below; they should not define other " -"numerical operators. It is recommended that both mappings and sequences " -"implement the :meth:`~object.__contains__` method to allow efficient use of " -"the ``in`` operator; for mappings, ``in`` should search the mapping's keys; " -"for sequences, it should search through the values. It is further " -"recommended that both mappings and sequences implement " -"the :meth:`~object.__iter__` method to allow efficient iteration through the " -"container; for mappings, :meth:`!__iter__` should iterate through the " -"object's keys; for sequences, it should iterate through the values." -msgstr "" - -#: ../../reference/datamodel.rst:3168 +"are :term:`sequences ` (such as :class:`lists ` or :class:" +"`tuples `) or :term:`mappings ` (like :term:`dictionaries " +"`), but can represent other containers as well. The first set " +"of methods is used either to emulate a sequence or to emulate a mapping; the " +"difference is that for a sequence, the allowable keys should be the integers " +"*k* for which ``0 <= k < N`` where *N* is the length of the sequence, or :" +"class:`slice` objects, which define a range of items. It is also " +"recommended that mappings provide the methods :meth:`!keys`, :meth:`!" +"values`, :meth:`!items`, :meth:`!get`, :meth:`!clear`, :meth:`!setdefault`, :" +"meth:`!pop`, :meth:`!popitem`, :meth:`!copy`, and :meth:`!update` behaving " +"similar to those for Python's standard :class:`dictionary ` objects. " +"The :mod:`collections.abc` module provides a :class:`~collections.abc." +"MutableMapping` :term:`abstract base class` to help create those methods " +"from a base set of :meth:`~object.__getitem__`, :meth:`~object." +"__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`." +msgstr "" + +#: ../../reference/datamodel.rst:3144 +msgid "" +"Mutable sequences should provide methods :meth:`~sequence.append`, :meth:" +"`~sequence.clear`, :meth:`~sequence.count`, :meth:`~sequence.extend`, :meth:" +"`~sequence.index`, :meth:`~sequence.insert`, :meth:`~sequence.pop`, :meth:" +"`~sequence.remove`, and :meth:`~sequence.reverse`, like Python standard :" +"class:`list` objects. Finally, sequence types should implement addition " +"(meaning concatenation) and multiplication (meaning repetition) by defining " +"the methods :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:" +"`~object.__iadd__`, :meth:`~object.__mul__`, :meth:`~object.__rmul__` and :" +"meth:`~object.__imul__` described below; they should not define other " +"numerical operators." +msgstr "" + +#: ../../reference/datamodel.rst:3156 +msgid "" +"It is recommended that both mappings and sequences implement the :meth:" +"`~object.__contains__` method to allow efficient use of the ``in`` operator; " +"for mappings, ``in`` should search the mapping's keys; for sequences, it " +"should search through the values. It is further recommended that both " +"mappings and sequences implement the :meth:`~object.__iter__` method to " +"allow efficient iteration through the container; for mappings, :meth:`!" +"__iter__` should iterate through the object's keys; for sequences, it should " +"iterate through the values." +msgstr "" + +#: ../../reference/datamodel.rst:3171 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -3804,97 +3812,96 @@ msgid "" "returns zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:3175 +#: ../../reference/datamodel.rst:3178 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " -"length is larger than :data:`!sys.maxsize` some features (such " -"as :func:`len`) may raise :exc:`OverflowError`. To prevent raising :exc:`!" -"OverflowError` by truth value testing, an object must define " -"a :meth:`~object.__bool__` method." +"length is larger than :data:`!sys.maxsize` some features (such as :func:" +"`len`) may raise :exc:`OverflowError`. To prevent raising :exc:`!" +"OverflowError` by truth value testing, an object must define a :meth:" +"`~object.__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:3184 +#: ../../reference/datamodel.rst:3187 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " -"The length must be an integer ``>=`` 0. The return value may also " -"be :data:`NotImplemented`, which is treated the same as if the " -"``__length_hint__`` method didn't exist at all. This method is purely an " -"optimization and is never required for correctness." +"The length must be an integer ``>=`` 0. The return value may also be :data:" +"`NotImplemented`, which is treated the same as if the ``__length_hint__`` " +"method didn't exist at all. This method is purely an optimization and is " +"never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:3198 +#: ../../reference/datamodel.rst:3201 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:3200 +#: ../../reference/datamodel.rst:3203 msgid "a[1:2] = b" msgstr "a[1:2] = b" -#: ../../reference/datamodel.rst:3202 +#: ../../reference/datamodel.rst:3205 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:3204 +#: ../../reference/datamodel.rst:3207 msgid "a[slice(1, 2, None)] = b" msgstr "a[slice(1, 2, None)] = b" -#: ../../reference/datamodel.rst:3206 +#: ../../reference/datamodel.rst:3209 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:3211 +#: ../../reference/datamodel.rst:3214 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " -"the accepted keys should be integers. Optionally, they may " -"support :class:`slice` objects as well. Negative index support is also " -"optional. If *key* is of an inappropriate type, :exc:`TypeError` may be " -"raised; if *key* is a value outside the set of indexes for the sequence " -"(after any special interpretation of negative values), :exc:`IndexError` " -"should be raised. For :term:`mapping` types, if *key* is missing (not in the " -"container), :exc:`KeyError` should be raised." +"the accepted keys should be integers. Optionally, they may support :class:" +"`slice` objects as well. Negative index support is also optional. If *key* " +"is of an inappropriate type, :exc:`TypeError` may be raised; if *key* is a " +"value outside the set of indexes for the sequence (after any special " +"interpretation of negative values), :exc:`IndexError` should be raised. For :" +"term:`mapping` types, if *key* is missing (not in the container), :exc:" +"`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:3223 +#: ../../reference/datamodel.rst:3226 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" -#: ../../reference/datamodel.rst:3228 +#: ../../reference/datamodel.rst:3231 msgid "" -"When :ref:`subscripting` a *class*, the special class " -"method :meth:`~object.__class_getitem__` may be called instead of " -"``__getitem__()``. See :ref:`classgetitem-versus-getitem` for more details." +"When :ref:`subscripting` a *class*, the special class method :" +"meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " +"See :ref:`classgetitem-versus-getitem` for more details." msgstr "" -#: ../../reference/datamodel.rst:3236 +#: ../../reference/datamodel.rst:3239 msgid "" -"Called to implement assignment to ``self[key]``. Same note as " -"for :meth:`__getitem__`. This should only be implemented for mappings if " -"the objects support changes to the values for keys, or if new keys can be " -"added, or for sequences if elements can be replaced. The same exceptions " -"should be raised for improper *key* values as for the :meth:`__getitem__` " -"method." +"Called to implement assignment to ``self[key]``. Same note as for :meth:" +"`__getitem__`. This should only be implemented for mappings if the objects " +"support changes to the values for keys, or if new keys can be added, or for " +"sequences if elements can be replaced. The same exceptions should be raised " +"for improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:3245 +#: ../../reference/datamodel.rst:3248 msgid "" -"Called to implement deletion of ``self[key]``. Same note as " -"for :meth:`__getitem__`. This should only be implemented for mappings if " -"the objects support removal of keys, or for sequences if elements can be " -"removed from the sequence. The same exceptions should be raised for " -"improper *key* values as for the :meth:`__getitem__` method." +"Called to implement deletion of ``self[key]``. Same note as for :meth:" +"`__getitem__`. This should only be implemented for mappings if the objects " +"support removal of keys, or for sequences if elements can be removed from " +"the sequence. The same exceptions should be raised for improper *key* " +"values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:3254 +#: ../../reference/datamodel.rst:3257 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:3260 +#: ../../reference/datamodel.rst:3263 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -3902,23 +3909,23 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:3268 +#: ../../reference/datamodel.rst:3271 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:3272 +#: ../../reference/datamodel.rst:3275 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " -"built-in will fall back to using the sequence protocol (:meth:`__len__` " -"and :meth:`__getitem__`). Objects that support the sequence protocol should " -"only provide :meth:`__reversed__` if they can provide an implementation that " -"is more efficient than the one provided by :func:`reversed`." +"built-in will fall back to using the sequence protocol (:meth:`__len__` and :" +"meth:`__getitem__`). Objects that support the sequence protocol should only " +"provide :meth:`__reversed__` if they can provide an implementation that is " +"more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:3279 +#: ../../reference/datamodel.rst:3282 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -3926,14 +3933,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:3286 +#: ../../reference/datamodel.rst:3289 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:3290 +#: ../../reference/datamodel.rst:3293 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -3941,11 +3948,11 @@ msgid "" "reference `." msgstr "" -#: ../../reference/datamodel.rst:3299 +#: ../../reference/datamodel.rst:3302 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:3301 +#: ../../reference/datamodel.rst:3304 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -3953,56 +3960,55 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:3327 +#: ../../reference/datamodel.rst:3330 msgid "" "These methods are called to implement the binary arithmetic operations " -"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, " -"``%``, :func:`divmod`, :func:`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|" -"``). For instance, to evaluate the expression ``x + y``, where *x* is an " -"instance of a class that has an :meth:`__add__` method, ``type(x).__add__(x, " -"y)`` is called. The :meth:`__divmod__` method should be the equivalent to " -"using :meth:`__floordiv__` and :meth:`__mod__`; it should not be related " -"to :meth:`__truediv__`. Note that :meth:`__pow__` should be defined to " -"accept an optional third argument if the three-argument version of the built-" -"in :func:`pow` function is to be supported." +"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" +"`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``). For instance, to " +"evaluate the expression ``x + y``, where *x* is an instance of a class that " +"has an :meth:`__add__` method, ``type(x).__add__(x, y)`` is called. The :" +"meth:`__divmod__` method should be the equivalent to using :meth:" +"`__floordiv__` and :meth:`__mod__`; it should not be related to :meth:" +"`__truediv__`. Note that :meth:`__pow__` should be defined to accept an " +"optional third argument if the three-argument version of the built-in :func:" +"`pow` function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:3338 +#: ../../reference/datamodel.rst:3341 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3361 +#: ../../reference/datamodel.rst:3364 msgid "" "These methods are called to implement the binary arithmetic operations " -"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, " -"``%``, :func:`divmod`, :func:`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|" -"``) with reflected (swapped) operands. These functions are only called if " -"the operands are of different types, when the left operand does not support " -"the corresponding operation [#]_, or the right operand's class is derived " -"from the left operand's class. [#]_ For instance, to evaluate the expression " -"``x - y``, where *y* is an instance of a class that has an :meth:`__rsub__` " -"method, ``type(y).__rsub__(y, x)`` is called if ``type(x).__sub__(x, y)`` " -"returns :data:`NotImplemented` or ``type(y)`` is a subclass of ``type(x)``. " -"[#]_" +"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" +"`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``) with reflected (swapped) " +"operands. These functions are only called if the operands are of different " +"types, when the left operand does not support the corresponding operation " +"[#]_, or the right operand's class is derived from the left operand's class. " +"[#]_ For instance, to evaluate the expression ``x - y``, where *y* is an " +"instance of a class that has an :meth:`__rsub__` method, ``type(y)." +"__rsub__(y, x)`` is called if ``type(x).__sub__(x, y)`` returns :data:" +"`NotImplemented` or ``type(y)`` is a subclass of ``type(x)``. [#]_" msgstr "" -#: ../../reference/datamodel.rst:3372 +#: ../../reference/datamodel.rst:3375 msgid "" "Note that :meth:`__rpow__` should be defined to accept an optional third " "argument if the three-argument version of the built-in :func:`pow` function " "is to be supported." msgstr "" -#: ../../reference/datamodel.rst:3378 +#: ../../reference/datamodel.rst:3381 msgid "" "Three-argument :func:`pow` now try calling :meth:`~object.__rpow__` if " "necessary. Previously it was only called in two-argument :func:`!pow` and " "the binary power operator." msgstr "" -#: ../../reference/datamodel.rst:3384 +#: ../../reference/datamodel.rst:3387 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -4011,7 +4017,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:3404 +#: ../../reference/datamodel.rst:3407 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -4020,28 +4026,28 @@ msgid "" "but does not have to be, *self*). If a specific method is not defined, or " "if that method returns :data:`NotImplemented`, the augmented assignment " "falls back to the normal methods. For instance, if *x* is an instance of a " -"class with an :meth:`__iadd__` method, ``x += y`` is equivalent to ``x = " -"x.__iadd__(y)`` . If :meth:`__iadd__` does not exist, or if " -"``x.__iadd__(y)`` returns :data:`!NotImplemented`, ``x.__add__(y)`` and " -"``y.__radd__(x)`` are considered, as with the evaluation of ``x + y``. In " -"certain situations, augmented assignment can result in unexpected errors " -"(see :ref:`faq-augmented-assignment-tuple-error`), but this behavior is in " -"fact part of the data model." +"class with an :meth:`__iadd__` method, ``x += y`` is equivalent to ``x = x." +"__iadd__(y)`` . If :meth:`__iadd__` does not exist, or if ``x.__iadd__(y)`` " +"returns :data:`!NotImplemented`, ``x.__add__(y)`` and ``y.__radd__(x)`` are " +"considered, as with the evaluation of ``x + y``. In certain situations, " +"augmented assignment can result in unexpected errors (see :ref:`faq-" +"augmented-assignment-tuple-error`), but this behavior is in fact part of the " +"data model." msgstr "" -#: ../../reference/datamodel.rst:3427 +#: ../../reference/datamodel.rst:3430 msgid "" -"Called to implement the unary arithmetic operations (``-``, " -"``+``, :func:`abs` and ``~``)." +"Called to implement the unary arithmetic operations (``-``, ``+``, :func:" +"`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:3440 +#: ../../reference/datamodel.rst:3443 msgid "" -"Called to implement the built-in functions :func:`complex`, :func:`int` " -"and :func:`float`. Should return a value of the appropriate type." +"Called to implement the built-in functions :func:`complex`, :func:`int` and :" +"func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:3447 +#: ../../reference/datamodel.rst:3450 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -4050,14 +4056,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:3453 +#: ../../reference/datamodel.rst:3456 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:3465 +#: ../../reference/datamodel.rst:3468 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -4066,16 +4072,16 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:3471 +#: ../../reference/datamodel.rst:3474 msgid "" ":func:`int` no longer delegates to the :meth:`~object.__trunc__` method." msgstr "" -#: ../../reference/datamodel.rst:3478 +#: ../../reference/datamodel.rst:3481 msgid "With Statement Context Managers" msgstr "With 陳述式的情境管理器" -#: ../../reference/datamodel.rst:3480 +#: ../../reference/datamodel.rst:3483 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -4085,34 +4091,34 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:3491 +#: ../../reference/datamodel.rst:3494 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:3494 +#: ../../reference/datamodel.rst:3497 msgid "" "For more information on context managers, see :ref:`typecontextmanager`. " "The :class:`object` class itself does not provide the context manager " "methods." msgstr "" -#: ../../reference/datamodel.rst:3500 +#: ../../reference/datamodel.rst:3503 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:3507 +#: ../../reference/datamodel.rst:3510 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:3511 +#: ../../reference/datamodel.rst:3514 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -4120,27 +4126,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:3515 +#: ../../reference/datamodel.rst:3518 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:3521 +#: ../../reference/datamodel.rst:3524 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../reference/datamodel.rst:3522 +#: ../../reference/datamodel.rst:3525 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3529 +#: ../../reference/datamodel.rst:3532 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:3531 +#: ../../reference/datamodel.rst:3534 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -4148,7 +4154,7 @@ msgid "" "pattern, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:3538 +#: ../../reference/datamodel.rst:3541 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -4157,29 +4163,29 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:3544 +#: ../../reference/datamodel.rst:3547 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " "MyClass(left=x, center=y)``. Note that the number of arguments in the " "pattern must be smaller than or equal to the number of elements in " -"*__match_args__*; if it is larger, the pattern match attempt will raise " -"a :exc:`TypeError`." +"*__match_args__*; if it is larger, the pattern match attempt will raise a :" +"exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:3554 +#: ../../reference/datamodel.rst:3557 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:3555 +#: ../../reference/datamodel.rst:3558 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:3561 +#: ../../reference/datamodel.rst:3564 msgid "Emulating buffer types" msgstr "" -#: ../../reference/datamodel.rst:3563 +#: ../../reference/datamodel.rst:3566 msgid "" "The :ref:`buffer protocol ` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " @@ -4187,61 +4193,60 @@ msgid "" "and third-party libraries may define additional buffer types." msgstr "" -#: ../../reference/datamodel.rst:3568 +#: ../../reference/datamodel.rst:3571 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" -#: ../../reference/datamodel.rst:3573 +#: ../../reference/datamodel.rst:3576 msgid "" -"Called when a buffer is requested from *self* (for example, by " -"the :class:`memoryview` constructor). The *flags* argument is an integer " -"representing the kind of buffer requested, affecting for example whether the " -"returned buffer is read-only or writable. :class:`inspect.BufferFlags` " -"provides a convenient way to interpret the flags. The method must return " -"a :class:`memoryview` object." +"Called when a buffer is requested from *self* (for example, by the :class:" +"`memoryview` constructor). The *flags* argument is an integer representing " +"the kind of buffer requested, affecting for example whether the returned " +"buffer is read-only or writable. :class:`inspect.BufferFlags` provides a " +"convenient way to interpret the flags. The method must return a :class:" +"`memoryview` object." msgstr "" -#: ../../reference/datamodel.rst:3582 +#: ../../reference/datamodel.rst:3585 msgid "" -"Called when a buffer is no longer needed. The *buffer* argument is " -"a :class:`memoryview` object that was previously returned " -"by :meth:`~object.__buffer__`. The method must release any resources " -"associated with the buffer. This method should return ``None``. Buffer " -"objects that do not need to perform any cleanup are not required to " -"implement this method." +"Called when a buffer is no longer needed. The *buffer* argument is a :class:" +"`memoryview` object that was previously returned by :meth:`~object." +"__buffer__`. The method must release any resources associated with the " +"buffer. This method should return ``None``. Buffer objects that do not need " +"to perform any cleanup are not required to implement this method." msgstr "" -#: ../../reference/datamodel.rst:3593 +#: ../../reference/datamodel.rst:3596 msgid ":pep:`688` - Making the buffer protocol accessible in Python" msgstr "" -#: ../../reference/datamodel.rst:3594 +#: ../../reference/datamodel.rst:3597 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3596 +#: ../../reference/datamodel.rst:3599 msgid ":class:`collections.abc.Buffer`" msgstr ":class:`collections.abc.Buffer`" -#: ../../reference/datamodel.rst:3597 +#: ../../reference/datamodel.rst:3600 msgid "ABC for buffer types." msgstr "" -#: ../../reference/datamodel.rst:3600 +#: ../../reference/datamodel.rst:3603 msgid "Annotations" msgstr "" -#: ../../reference/datamodel.rst:3602 +#: ../../reference/datamodel.rst:3605 msgid "" "Functions, classes, and modules may contain :term:`annotations " "`, which are a way to associate information (usually :term:`type " "hints `) with a symbol." msgstr "" -#: ../../reference/datamodel.rst:3608 +#: ../../reference/datamodel.rst:3611 msgid "" "This attribute contains the annotations for an object. It is :ref:`lazily " "evaluated `, so accessing the attribute may execute " @@ -4249,59 +4254,59 @@ msgid "" "attribute is set to a dictionary mapping from variable names to annotations." msgstr "" -#: ../../reference/datamodel.rst:3613 +#: ../../reference/datamodel.rst:3616 msgid "Annotations are now lazily evaluated." msgstr "" -#: ../../reference/datamodel.rst:3618 +#: ../../reference/datamodel.rst:3621 msgid "" "An :term:`annotate function`. Returns a new dictionary object mapping " "attribute/parameter names to their annotation values." msgstr "" -#: ../../reference/datamodel.rst:3621 +#: ../../reference/datamodel.rst:3624 msgid "" "Takes a format parameter specifying the format in which annotations values " "should be provided. It must be a member of the :class:`annotationlib.Format` " "enum, or an integer with a value corresponding to a member of the enum." msgstr "" -#: ../../reference/datamodel.rst:3625 +#: ../../reference/datamodel.rst:3628 msgid "" -"If an annotate function doesn't support the requested format, it must " -"raise :exc:`NotImplementedError`. Annotate functions must always " -"support :attr:`~annotationlib.Format.VALUE` format; they must not " -"raise :exc:`NotImplementedError()` when called with this format." +"If an annotate function doesn't support the requested format, it must raise :" +"exc:`NotImplementedError`. Annotate functions must always support :attr:" +"`~annotationlib.Format.VALUE` format; they must not raise :exc:" +"`NotImplementedError()` when called with this format." msgstr "" -#: ../../reference/datamodel.rst:3630 +#: ../../reference/datamodel.rst:3633 msgid "" "When called with :attr:`~annotationlib.Format.VALUE` format, an annotate " "function may raise :exc:`NameError`; it must not raise :exc:`!NameError` " "when called requesting any other format." msgstr "" -#: ../../reference/datamodel.rst:3633 +#: ../../reference/datamodel.rst:3636 msgid "" "If an object does not have any annotations, :attr:`~object.__annotate__` " "should preferably be set to ``None`` (it can’t be deleted), rather than set " "to a function that returns an empty dict." msgstr "" -#: ../../reference/datamodel.rst:3640 +#: ../../reference/datamodel.rst:3643 msgid ":pep:`649` --- Deferred evaluation of annotation using descriptors" msgstr "" -#: ../../reference/datamodel.rst:3641 +#: ../../reference/datamodel.rst:3644 msgid "" "Introduces lazy evaluation of annotations and the ``__annotate__`` function." msgstr "" -#: ../../reference/datamodel.rst:3647 +#: ../../reference/datamodel.rst:3650 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:3649 +#: ../../reference/datamodel.rst:3652 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -4309,7 +4314,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:3654 +#: ../../reference/datamodel.rst:3657 msgid "" ">>> class C:\n" "... pass\n" @@ -4331,7 +4336,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: object of type 'C' has no len()" -#: ../../reference/datamodel.rst:3664 +#: ../../reference/datamodel.rst:3667 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -4340,7 +4345,7 @@ msgid "" "invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:3671 +#: ../../reference/datamodel.rst:3674 msgid "" ">>> 1 .__hash__() == hash(1)\n" "True\n" @@ -4356,14 +4361,14 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: descriptor '__hash__' of 'int' object needs an argument" -#: ../../reference/datamodel.rst:3678 +#: ../../reference/datamodel.rst:3681 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:3682 +#: ../../reference/datamodel.rst:3685 msgid "" ">>> type(1).__hash__(1) == hash(1)\n" "True\n" @@ -4375,14 +4380,14 @@ msgstr "" ">>> type(int).__hash__(int) == hash(int)\n" "True" -#: ../../reference/datamodel.rst:3687 +#: ../../reference/datamodel.rst:3690 msgid "" "In addition to bypassing any instance attributes in the interest of " -"correctness, implicit special method lookup generally also bypasses " -"the :meth:`~object.__getattribute__` method even of the object's metaclass::" +"correctness, implicit special method lookup generally also bypasses the :" +"meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:3691 +#: ../../reference/datamodel.rst:3694 msgid "" ">>> class Meta(type):\n" "... def __getattribute__(*args):\n" @@ -4407,7 +4412,7 @@ msgid "" "10" msgstr "" -#: ../../reference/datamodel.rst:3713 +#: ../../reference/datamodel.rst:3716 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -4416,106 +4421,103 @@ msgid "" "consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:3724 +#: ../../reference/datamodel.rst:3727 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:3728 +#: ../../reference/datamodel.rst:3731 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:3730 +#: ../../reference/datamodel.rst:3733 msgid "" -"An :term:`awaitable` object generally implements " -"an :meth:`~object.__await__` method. :term:`Coroutine objects ` " -"returned from :keyword:`async def` functions are awaitable." +"An :term:`awaitable` object generally implements an :meth:`~object." +"__await__` method. :term:`Coroutine objects ` returned from :" +"keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:3736 +#: ../../reference/datamodel.rst:3739 msgid "" "The :term:`generator iterator` objects returned from generators decorated " -"with :func:`types.coroutine` are also awaitable, but they do not " -"implement :meth:`~object.__await__`." +"with :func:`types.coroutine` are also awaitable, but they do not implement :" +"meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:3742 +#: ../../reference/datamodel.rst:3745 msgid "" -"Must return an :term:`iterator`. Should be used to " -"implement :term:`awaitable` objects. For instance, :class:`asyncio.Future` " -"implements this method to be compatible with the :keyword:`await` " -"expression. The :class:`object` class itself is not awaitable and does not " -"provide this method." +"Must return an :term:`iterator`. Should be used to implement :term:" +"`awaitable` objects. For instance, :class:`asyncio.Future` implements this " +"method to be compatible with the :keyword:`await` expression. The :class:" +"`object` class itself is not awaitable and does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:3750 +#: ../../reference/datamodel.rst:3753 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " -"specific to the implementation of the asynchronous execution framework " -"(e.g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." +"specific to the implementation of the asynchronous execution framework (e." +"g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" -#: ../../reference/datamodel.rst:3758 +#: ../../reference/datamodel.rst:3761 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:3764 +#: ../../reference/datamodel.rst:3767 msgid "Coroutine Objects" msgstr "協程物件" -#: ../../reference/datamodel.rst:3766 +#: ../../reference/datamodel.rst:3769 msgid "" ":term:`Coroutine objects ` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " "and iterating over the result. When the coroutine has finished executing " -"and returns, the iterator raises :exc:`StopIteration`, and the " -"exception's :attr:`~StopIteration.value` attribute holds the return value. " -"If the coroutine raises an exception, it is propagated by the iterator. " -"Coroutines should not directly raise unhandled :exc:`StopIteration` " -"exceptions." +"and returns, the iterator raises :exc:`StopIteration`, and the exception's :" +"attr:`~StopIteration.value` attribute holds the return value. If the " +"coroutine raises an exception, it is propagated by the iterator. Coroutines " +"should not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" -#: ../../reference/datamodel.rst:3774 +#: ../../reference/datamodel.rst:3777 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:3778 +#: ../../reference/datamodel.rst:3781 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:3784 +#: ../../reference/datamodel.rst:3787 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " -"is equivalent to advancing the iterator returned " -"by :meth:`~object.__await__`. If *value* is not ``None``, this method " -"delegates to the :meth:`~generator.send` method of the iterator that caused " -"the coroutine to suspend. The result (return value, :exc:`StopIteration`, " -"or other exception) is the same as when iterating over the :meth:`!" -"__await__` return value, described above." +"is equivalent to advancing the iterator returned by :meth:`~object." +"__await__`. If *value* is not ``None``, this method delegates to the :meth:" +"`~generator.send` method of the iterator that caused the coroutine to " +"suspend. The result (return value, :exc:`StopIteration`, or other " +"exception) is the same as when iterating over the :meth:`!__await__` return " +"value, described above." msgstr "" -#: ../../reference/datamodel.rst:3795 +#: ../../reference/datamodel.rst:3798 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " "coroutine to suspend, if it has such a method. Otherwise, the exception is " -"raised at the suspension point. The result (return " -"value, :exc:`StopIteration`, or other exception) is the same as when " -"iterating over the :meth:`~object.__await__` return value, described above. " -"If the exception is not caught in the coroutine, it propagates back to the " -"caller." +"raised at the suspension point. The result (return value, :exc:" +"`StopIteration`, or other exception) is the same as when iterating over the :" +"meth:`~object.__await__` return value, described above. If the exception is " +"not caught in the coroutine, it propagates back to the caller." msgstr "" -#: ../../reference/datamodel.rst:3806 +#: ../../reference/datamodel.rst:3809 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: ../../reference/datamodel.rst:3811 +#: ../../reference/datamodel.rst:3814 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -4525,46 +4527,46 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:3819 +#: ../../reference/datamodel.rst:3822 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:3825 +#: ../../reference/datamodel.rst:3828 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:3827 +#: ../../reference/datamodel.rst:3830 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:3830 +#: ../../reference/datamodel.rst:3833 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:3832 ../../reference/datamodel.rst:3881 +#: ../../reference/datamodel.rst:3835 ../../reference/datamodel.rst:3884 msgid "The :class:`object` class itself does not provide these methods." msgstr "" -#: ../../reference/datamodel.rst:3837 +#: ../../reference/datamodel.rst:3840 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:3841 +#: ../../reference/datamodel.rst:3844 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:3844 +#: ../../reference/datamodel.rst:3847 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:3846 +#: ../../reference/datamodel.rst:3849 msgid "" "class Reader:\n" " async def readline(self):\n" @@ -4592,53 +4594,53 @@ msgstr "" " raise StopAsyncIteration\n" " return val" -#: ../../reference/datamodel.rst:3861 +#: ../../reference/datamodel.rst:3864 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator `." msgstr "" -#: ../../reference/datamodel.rst:3866 +#: ../../reference/datamodel.rst:3869 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " -"asynchronous iterator object. Returning anything else will result in " -"a :exc:`TypeError` error." +"asynchronous iterator object. Returning anything else will result in a :exc:" +"`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:3874 +#: ../../reference/datamodel.rst:3877 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3876 +#: ../../reference/datamodel.rst:3879 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3879 +#: ../../reference/datamodel.rst:3882 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3885 +#: ../../reference/datamodel.rst:3888 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3890 +#: ../../reference/datamodel.rst:3893 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3893 +#: ../../reference/datamodel.rst:3896 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:3895 +#: ../../reference/datamodel.rst:3898 msgid "" "class AsyncContextManager:\n" " async def __aenter__(self):\n" @@ -4654,26 +4656,27 @@ msgstr "" " async def __aexit__(self, exc_type, exc, tb):\n" " await log('exiting context')" -#: ../../reference/datamodel.rst:3906 +#: ../../reference/datamodel.rst:3909 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:3907 +#: ../../reference/datamodel.rst:3910 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:3911 +#: ../../reference/datamodel.rst:3914 msgid "" -"The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object.__reversed__`, :meth:`~object.__contains__`, :meth:`~object.__class_getitem__` " -"and :meth:`~os.PathLike.__fspath__` methods have special handling for this. " -"Others will still raise a :exc:`TypeError`, but may do so by relying on the " -"behavior that ``None`` is not callable." +"The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." +"__reversed__`, :meth:`~object.__contains__`, :meth:`~object." +"__class_getitem__` and :meth:`~os.PathLike.__fspath__` methods have special " +"handling for this. Others will still raise a :exc:`TypeError`, but may do so " +"by relying on the behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3918 +#: ../../reference/datamodel.rst:3921 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " @@ -4681,14 +4684,14 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3924 +#: ../../reference/datamodel.rst:3927 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method (such as :meth:`~object.__add__`) fails then the operation is not " "supported, which is why the reflected method is not called." msgstr "" -#: ../../reference/datamodel.rst:3928 +#: ../../reference/datamodel.rst:3931 msgid "" "If the right operand's type is a subclass of the left operand's type, the " "reflected method having precedence allows subclasses to override their " @@ -4711,7 +4714,7 @@ msgstr "" #: ../../reference/datamodel.rst:1313 ../../reference/datamodel.rst:1340 #: ../../reference/datamodel.rst:1412 ../../reference/datamodel.rst:1520 #: ../../reference/datamodel.rst:1628 ../../reference/datamodel.rst:1745 -#: ../../reference/datamodel.rst:2170 ../../reference/datamodel.rst:3194 +#: ../../reference/datamodel.rst:2170 ../../reference/datamodel.rst:3197 msgid "object" msgstr "object(物件)" @@ -4725,9 +4728,9 @@ msgstr "data(資料)" #: ../../reference/datamodel.rst:1369 ../../reference/datamodel.rst:1828 #: ../../reference/datamodel.rst:2071 ../../reference/datamodel.rst:2077 #: ../../reference/datamodel.rst:2170 ../../reference/datamodel.rst:2732 -#: ../../reference/datamodel.rst:3164 ../../reference/datamodel.rst:3322 -#: ../../reference/datamodel.rst:3357 ../../reference/datamodel.rst:3425 -#: ../../reference/datamodel.rst:3435 ../../reference/datamodel.rst:3463 +#: ../../reference/datamodel.rst:3167 ../../reference/datamodel.rst:3325 +#: ../../reference/datamodel.rst:3360 ../../reference/datamodel.rst:3428 +#: ../../reference/datamodel.rst:3438 ../../reference/datamodel.rst:3466 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -4821,7 +4824,7 @@ msgstr "..." #: ../../reference/datamodel.rst:187 msgid "ellipsis literal" -msgstr "ellipsis literal(刪節號)" +msgstr "ellipsis literal(刪節號字面值)" #: ../../reference/datamodel.rst:199 ../../reference/datamodel.rst:1340 msgid "numeric" @@ -4860,12 +4863,12 @@ msgstr "number(數字)" msgid "Java" msgstr "Java" -#: ../../reference/datamodel.rst:288 ../../reference/datamodel.rst:3435 +#: ../../reference/datamodel.rst:288 ../../reference/datamodel.rst:3438 msgid "complex" msgstr "complex(複數)" #: ../../reference/datamodel.rst:301 ../../reference/datamodel.rst:432 -#: ../../reference/datamodel.rst:471 ../../reference/datamodel.rst:3164 +#: ../../reference/datamodel.rst:471 ../../reference/datamodel.rst:3167 msgid "len" msgstr "len" @@ -4958,7 +4961,7 @@ msgstr "assignment(賦值)" #: ../../reference/datamodel.rst:393 ../../reference/datamodel.rst:875 #: ../../reference/datamodel.rst:1782 ../../reference/datamodel.rst:1964 -#: ../../reference/datamodel.rst:3487 +#: ../../reference/datamodel.rst:3490 msgid "statement" msgstr "statement(陳述式)" @@ -5130,7 +5133,7 @@ msgstr "generator(產生器)" msgid "iterator" msgstr "itorator(疊代器)" -#: ../../reference/datamodel.rst:777 ../../reference/datamodel.rst:3720 +#: ../../reference/datamodel.rst:777 ../../reference/datamodel.rst:3723 msgid "coroutine" msgstr "coroutine(協程)" @@ -5514,7 +5517,7 @@ msgstr "try" msgid "tb_next (traceback attribute)" msgstr "tb_next (traceback 屬性)" -#: ../../reference/datamodel.rst:1828 ../../reference/datamodel.rst:3194 +#: ../../reference/datamodel.rst:1828 ../../reference/datamodel.rst:3197 msgid "slice" msgstr "slice(切片)" @@ -5654,38 +5657,38 @@ msgstr "__class__ (方法 cell)" msgid "__classcell__ (class namespace entry)" msgstr "__classcell__ (類別命名空間項目)" -#: ../../reference/datamodel.rst:3164 +#: ../../reference/datamodel.rst:3167 msgid "__bool__() (object method)" msgstr "__bool__() (物件方法)" -#: ../../reference/datamodel.rst:3322 ../../reference/datamodel.rst:3357 +#: ../../reference/datamodel.rst:3325 ../../reference/datamodel.rst:3360 msgid "divmod" msgstr "divmod" -#: ../../reference/datamodel.rst:3322 ../../reference/datamodel.rst:3357 +#: ../../reference/datamodel.rst:3325 ../../reference/datamodel.rst:3360 msgid "pow" msgstr "pow" -#: ../../reference/datamodel.rst:3425 +#: ../../reference/datamodel.rst:3428 msgid "abs" msgstr "abs" -#: ../../reference/datamodel.rst:3435 +#: ../../reference/datamodel.rst:3438 msgid "int" msgstr "int" -#: ../../reference/datamodel.rst:3435 +#: ../../reference/datamodel.rst:3438 msgid "float" msgstr "float" -#: ../../reference/datamodel.rst:3463 +#: ../../reference/datamodel.rst:3466 msgid "round" msgstr "round" -#: ../../reference/datamodel.rst:3487 +#: ../../reference/datamodel.rst:3490 msgid "with" msgstr "with" -#: ../../reference/datamodel.rst:3487 +#: ../../reference/datamodel.rst:3490 msgid "context manager" msgstr "context manager(情境管理器)" diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index f2ddf07d1bb..77097686eff 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,18 +23,18 @@ msgstr "詞法分析" #: ../../reference/lexical_analysis.rst:10 msgid "" -"A Python program is read by a *parser*. Input to the parser is a stream " -"of :term:`tokens `, generated by the *lexical analyzer* (also known " -"as the *tokenizer*). This chapter describes how the lexical analyzer breaks " -"a file into tokens." +"A Python program is read by a *parser*. Input to the parser is a stream of :" +"term:`tokens `, generated by the *lexical analyzer* (also known as " +"the *tokenizer*). This chapter describes how the lexical analyzer breaks a " +"file into tokens." msgstr "" #: ../../reference/lexical_analysis.rst:15 msgid "" "Python reads program text as Unicode code points; the encoding of a source " -"file can be given by an encoding declaration and defaults to UTF-8, " -"see :pep:`3120` for details. If the source file cannot be decoded, " -"a :exc:`SyntaxError` is raised." +"file can be given by an encoding declaration and defaults to UTF-8, see :pep:" +"`3120` for details. If the source file cannot be decoded, a :exc:" +"`SyntaxError` is raised." msgstr "" #: ../../reference/lexical_analysis.rst:24 @@ -51,12 +51,12 @@ msgstr "" #: ../../reference/lexical_analysis.rst:38 msgid "" -"The end of a logical line is represented by the " -"token :data:`~token.NEWLINE`. Statements cannot cross logical line " -"boundaries except where :data:`!NEWLINE` is allowed by the syntax (e.g., " -"between statements in compound statements). A logical line is constructed " -"from one or more *physical lines* by following the :ref:`explicit ` or :ref:`implicit ` *line joining* rules." +"The end of a logical line is represented by the token :data:`~token." +"NEWLINE`. Statements cannot cross logical line boundaries except where :data:" +"`!NEWLINE` is allowed by the syntax (e.g., between statements in compound " +"statements). A logical line is constructed from one or more *physical lines* " +"by following the :ref:`explicit ` or :ref:`implicit " +"` *line joining* rules." msgstr "" #: ../../reference/lexical_analysis.rst:49 @@ -216,6 +216,10 @@ msgid "" " 'Juli', 'Augustus', 'September', # for the months\n" " 'Oktober', 'November', 'December'] # of the year" msgstr "" +"month_names = ['Januari', 'Februari', 'Maart', # 這些是\n" +" 'April', 'Mei', 'Juni', # 荷蘭文的\n" +" 'Juli', 'Augustus', 'September', # 一年之中\n" +" 'Oktober', 'November', 'December'] # 月份名稱" #: ../../reference/lexical_analysis.rst:172 msgid "" @@ -288,9 +292,8 @@ msgstr "" #: ../../reference/lexical_analysis.rst:230 msgid "" -"The indentation levels of consecutive lines are used to " -"generate :data:`~token.INDENT` and :data:`~token.DEDENT` tokens, using a " -"stack, as follows." +"The indentation levels of consecutive lines are used to generate :data:" +"`~token.INDENT` and :data:`~token.DEDENT` tokens, using a stack, as follows." msgstr "" #: ../../reference/lexical_analysis.rst:234 @@ -302,10 +305,10 @@ msgid "" "the stack. If it is equal, nothing happens. If it is larger, it is pushed on " "the stack, and one :data:`!INDENT` token is generated. If it is smaller, it " "*must* be one of the numbers occurring on the stack; all numbers on the " -"stack that are larger are popped off, and for each number popped off " -"a :data:`!DEDENT` token is generated. At the end of the file, a :data:`!" -"DEDENT` token is generated for each number remaining on the stack that is " -"larger than zero." +"stack that are larger are popped off, and for each number popped off a :data:" +"`!DEDENT` token is generated. At the end of the file, a :data:`!DEDENT` " +"token is generated for each number remaining on the stack that is larger " +"than zero." msgstr "" #: ../../reference/lexical_analysis.rst:245 @@ -372,8 +375,8 @@ msgstr "" #: ../../reference/lexical_analysis.rst:293 msgid "" -"At the end of non-interactive input, the lexical analyzer generates " -"an :data:`~token.ENDMARKER` token." +"At the end of non-interactive input, the lexical analyzer generates an :data:" +"`~token.ENDMARKER` token." msgstr "" #: ../../reference/lexical_analysis.rst:300 @@ -382,15 +385,14 @@ msgstr "" #: ../../reference/lexical_analysis.rst:302 msgid "" -"Besides :data:`~token.NEWLINE`, :data:`~token.INDENT` " -"and :data:`~token.DEDENT`, the following categories of tokens exist: " -"*identifiers* and *keywords* (:data:`~token.NAME`), *literals* (such " -"as :data:`~token.NUMBER` and :data:`~token.STRING`), and other symbols " -"(*operators* and *delimiters*, :data:`~token.OP`). Whitespace characters " -"(other than logical line terminators, discussed earlier) are not tokens, but " -"serve to delimit tokens. Where ambiguity exists, a token comprises the " -"longest possible string that forms a legal token, when read from left to " -"right." +"Besides :data:`~token.NEWLINE`, :data:`~token.INDENT` and :data:`~token." +"DEDENT`, the following categories of tokens exist: *identifiers* and " +"*keywords* (:data:`~token.NAME`), *literals* (such as :data:`~token.NUMBER` " +"and :data:`~token.STRING`), and other symbols (*operators* and " +"*delimiters*, :data:`~token.OP`). Whitespace characters (other than logical " +"line terminators, discussed earlier) are not tokens, but serve to delimit " +"tokens. Where ambiguity exists, a token comprises the longest possible " +"string that forms a legal token, when read from left to right." msgstr "" #: ../../reference/lexical_analysis.rst:316 @@ -498,8 +500,8 @@ msgstr "" #: ../../reference/lexical_analysis.rst:358 msgid "" -"```` - another explicit set of characters in " -"`PropList.txt`_ to support backwards compatibility" +"```` - another explicit set of characters in `PropList." +"txt`_ to support backwards compatibility" msgstr "" #: ../../reference/lexical_analysis.rst:361 @@ -510,8 +512,8 @@ msgstr "" #: ../../reference/lexical_analysis.rst:364 msgid "" -"These sets are based on the Unicode standard annex `UAX-31`_. See " -"also :pep:`3131` for further details." +"These sets are based on the Unicode standard annex `UAX-31`_. See also :pep:" +"`3131` for further details." msgstr "" #: ../../reference/lexical_analysis.rst:367 @@ -616,16 +618,16 @@ msgstr "``_``" #: ../../reference/lexical_analysis.rst:457 msgid "" -"In a ``case`` pattern within a :keyword:`match` statement, ``_`` is " -"a :ref:`soft keyword ` that denotes a :ref:`wildcard " -"`." +"In a ``case`` pattern within a :keyword:`match` statement, ``_`` is a :ref:" +"`soft keyword ` that denotes a :ref:`wildcard `." msgstr "" #: ../../reference/lexical_analysis.rst:461 msgid "" "Separately, the interactive interpreter makes the result of the last " -"evaluation available in the variable ``_``. (It is stored in " -"the :mod:`builtins` module, alongside built-in functions like ``print``.)" +"evaluation available in the variable ``_``. (It is stored in the :mod:" +"`builtins` module, alongside built-in functions like ``print``.)" msgstr "" #: ../../reference/lexical_analysis.rst:466 @@ -681,8 +683,8 @@ msgstr "" #: ../../reference/lexical_analysis.rst:501 msgid "" -"In terms of lexical analysis, Python has :ref:`string, bytes ` " -"and :ref:`numeric ` literals." +"In terms of lexical analysis, Python has :ref:`string, bytes ` and :" +"ref:`numeric ` literals." msgstr "" #: ../../reference/lexical_analysis.rst:504 @@ -707,6 +709,8 @@ msgid "" "\"spam\"\n" "'eggs'" msgstr "" +"\"spam\"\n" +"'eggs'" #: ../../reference/lexical_analysis.rst:525 msgid "" @@ -720,6 +724,8 @@ msgid "" "'Say \"Hello\", please.'\n" "\"Don't do that!\"" msgstr "" +"'Say \"Hello\", please.'\n" +"\"Don't do that!\"" #: ../../reference/lexical_analysis.rst:534 msgid "" @@ -729,10 +735,10 @@ msgstr "" #: ../../reference/lexical_analysis.rst:537 msgid "" -"Inside a string literal, the backslash (``\\``) character introduces " -"an :dfn:`escape sequence`, which has special meaning depending on the " -"character after the backslash. For example, ``\\\"`` denotes the double " -"quote character, and does *not* end the string:" +"Inside a string literal, the backslash (``\\``) character introduces an :dfn:" +"`escape sequence`, which has special meaning depending on the character " +"after the backslash. For example, ``\\\"`` denotes the double quote " +"character, and does *not* end the string:" msgstr "" #: ../../reference/lexical_analysis.rst:543 @@ -845,8 +851,8 @@ msgstr "" #: ../../reference/lexical_analysis.rst:610 msgid "" "Support for the unicode legacy literal (``u'value'``) was reintroduced to " -"simplify the maintenance of dual Python 2.x and 3.x codebases. " -"See :pep:`414` for more information." +"simplify the maintenance of dual Python 2.x and 3.x codebases. See :pep:" +"`414` for more information." msgstr "" #: ../../reference/lexical_analysis.rst:616 @@ -897,7 +903,7 @@ msgstr "``\\``\\ " #: ../../reference/lexical_analysis.rst:675 msgid ":ref:`string-escape-ignore`" -msgstr "" +msgstr ":ref:`string-escape-ignore`" #: ../../reference/lexical_analysis.rst:676 msgid "``\\\\``" @@ -985,7 +991,7 @@ msgstr ":samp:`\\\\\\\\{ooo}`" #: ../../reference/lexical_analysis.rst:697 msgid ":ref:`string-escape-oct`" -msgstr "" +msgstr ":ref:`string-escape-oct`" #: ../../reference/lexical_analysis.rst:698 msgid ":samp:`\\\\x{hh}`" @@ -993,7 +999,7 @@ msgstr ":samp:`\\\\x{hh}`" #: ../../reference/lexical_analysis.rst:699 msgid ":ref:`string-escape-hex`" -msgstr "" +msgstr ":ref:`string-escape-hex`" #: ../../reference/lexical_analysis.rst:700 msgid ":samp:`\\\\N\\\\{{name}\\\\}`" @@ -1001,7 +1007,7 @@ msgstr ":samp:`\\\\N\\\\{{name}\\\\}`" #: ../../reference/lexical_analysis.rst:701 msgid ":ref:`string-escape-named`" -msgstr "" +msgstr ":ref:`string-escape-named`" #: ../../reference/lexical_analysis.rst:702 msgid ":samp:`\\\\u{xxxx}`" @@ -1102,15 +1108,15 @@ msgstr "" #: ../../reference/lexical_analysis.rst:755 msgid "" -"Octal escapes with value larger than ``0o377`` (255) produce " -"a :exc:`DeprecationWarning`." +"Octal escapes with value larger than ``0o377`` (255) produce a :exc:" +"`DeprecationWarning`." msgstr "" #: ../../reference/lexical_analysis.rst:759 msgid "" -"Octal escapes with value larger than ``0o377`` (255) produce " -"a :exc:`SyntaxWarning`. In a future Python version they will raise " -"a :exc:`SyntaxError`." +"Octal escapes with value larger than ``0o377`` (255) produce a :exc:" +"`SyntaxWarning`. In a future Python version they will raise a :exc:" +"`SyntaxError`." msgstr "" #: ../../reference/lexical_analysis.rst:767 @@ -1245,8 +1251,8 @@ msgid "" ":dfn:`Bytes literals` are always prefixed with '``b``' or '``B``'; they " "produce an instance of the :class:`bytes` type instead of the :class:`str` " "type. They may only contain ASCII characters; bytes with a numeric value of " -"128 or greater must be expressed with escape sequences " -"(typically :ref:`string-escape-hex` or :ref:`string-escape-oct`):" +"128 or greater must be expressed with escape sequences (typically :ref:" +"`string-escape-hex` or :ref:`string-escape-oct`):" msgstr "" #: ../../reference/lexical_analysis.rst:861 @@ -1550,22 +1556,20 @@ msgstr "" #: ../../reference/lexical_analysis.rst:1099 msgid "" "The :func:`format` protocol is not used. Instead, the format specifier and " -"conversions (if any) are passed to a " -"new :class:`~string.templatelib.Interpolation` object that is created for " -"each evaluated expression. It is up to code that processes the " -"resulting :class:`~string.templatelib.Template` object to decide how to " -"handle format specifiers and conversions." +"conversions (if any) are passed to a new :class:`~string.templatelib." +"Interpolation` object that is created for each evaluated expression. It is " +"up to code that processes the resulting :class:`~string.templatelib." +"Template` object to decide how to handle format specifiers and conversions." msgstr "" #: ../../reference/lexical_analysis.rst:1106 msgid "" "Format specifiers containing nested replacement fields are evaluated " -"eagerly, prior to being passed to " -"the :class:`~string.templatelib.Interpolation` object. For instance, an " -"interpolation of the form ``{amount:.{precision}f}`` will evaluate the inner " -"expression ``{precision}`` to determine the value of the ``format_spec`` " -"attribute. If ``precision`` were to be ``2``, the resulting format specifier " -"would be ``'.2f'``." +"eagerly, prior to being passed to the :class:`~string.templatelib." +"Interpolation` object. For instance, an interpolation of the form ``{amount:." +"{precision}f}`` will evaluate the inner expression ``{precision}`` to " +"determine the value of the ``format_spec`` attribute. If ``precision`` were " +"to be ``2``, the resulting format specifier would be ``'.2f'``." msgstr "" #: ../../reference/lexical_analysis.rst:1114 @@ -1574,10 +1578,10 @@ msgid "" "text of the expression is appended to the literal string that precedes the " "relevant interpolation. This includes the equals sign and any surrounding " "whitespace. The :class:`!Interpolation` instance for the expression will be " -"created as normal, except " -"that :attr:`~string.templatelib.Interpolation.conversion` will be set to " -"'``r``' (:func:`repr`) by default. If an explicit conversion or format " -"specifier are provided, this will override the default behaviour." +"created as normal, except that :attr:`~string.templatelib.Interpolation." +"conversion` will be set to '``r``' (:func:`repr`) by default. If an explicit " +"conversion or format specifier are provided, this will override the default " +"behaviour." msgstr "" #: ../../reference/lexical_analysis.rst:1128 @@ -1618,6 +1622,9 @@ msgid "" "3\n" "2147483647" msgstr "" +"7\n" +"3\n" +"2147483647" #: ../../reference/lexical_analysis.rst:1169 msgid "" @@ -1627,7 +1634,7 @@ msgstr "" #: ../../reference/lexical_analysis.rst:1172 msgid "7922816251426433759354395033679228162514264337593543950336" -msgstr "" +msgstr "7922816251426433759354395033679228162514264337593543950336" #: ../../reference/lexical_analysis.rst:1174 msgid "" @@ -1642,6 +1649,9 @@ msgid "" "100000000000\n" "1_00_00_00_00_000" msgstr "" +"100_000_000_000\n" +"100000000000\n" +"1_00_00_00_00_000" #: ../../reference/lexical_analysis.rst:1182 msgid "" @@ -1666,6 +1676,12 @@ msgid "" "0xdeadbeef\n" "0xDead_Beef" msgstr "" +"0b100110111\n" +"0b_1110_0101\n" +"0o177\n" +"0o377\n" +"0xdeadbeef\n" +"0xDead_Beef" #: ../../reference/lexical_analysis.rst:1197 msgid "" @@ -1697,8 +1713,8 @@ msgstr "浮點數常數 (Floating-point literals)" #: ../../reference/lexical_analysis.rst:1236 msgid "" -"Floating-point (float) literals, such as ``3.14`` or ``1.5``, " -"denote :ref:`approximations of real numbers `." +"Floating-point (float) literals, such as ``3.14`` or ``1.5``, denote :ref:" +"`approximations of real numbers `." msgstr "" #: ../../reference/lexical_analysis.rst:1239 @@ -1712,6 +1728,8 @@ msgid "" "2.71828\n" "4.0" msgstr "" +"2.71828\n" +"4.0" #: ../../reference/lexical_analysis.rst:1245 msgid "" @@ -1730,6 +1748,8 @@ msgid "" "96_485.332_123\n" "3.14_15_93" msgstr "" +"96_485.332_123\n" +"3.14_15_93" #: ../../reference/lexical_analysis.rst:1254 msgid "Either of these parts, but not both, can be empty. For example::" @@ -1740,6 +1760,8 @@ msgid "" "10. # (equivalent to 10.0)\n" ".001 # (equivalent to 0.001)" msgstr "" +"10. # (相當於 10.0)\n" +".001 # (相當於 0.001)" #: ../../reference/lexical_analysis.rst:1259 msgid "" @@ -1767,6 +1789,8 @@ msgid "" "1e3 # (equivalent to 1.e3 and 1.0e3)\n" "0e0 # (equivalent to 0.)" msgstr "" +"1e3 # (相當於 1.e3 和 1.0e3)\n" +"0e0 # (相當於 0.)" #: ../../reference/lexical_analysis.rst:1274 msgid "" @@ -1794,7 +1818,7 @@ msgstr "" #: ../../reference/lexical_analysis.rst:1308 msgid "3+4.2j" -msgstr "" +msgstr "3+4.2j" #: ../../reference/lexical_analysis.rst:1310 msgid "" @@ -1806,7 +1830,7 @@ msgstr "" #: ../../reference/lexical_analysis.rst:1316 msgid "3 + 4.2j" -msgstr "" +msgstr "3 + 4.2j" #: ../../reference/lexical_analysis.rst:1318 msgid "" @@ -1851,6 +1875,9 @@ msgid "" "0j\n" "1000000000000000000000000j # equivalent to 1e+24j" msgstr "" +"10j\n" +"0j\n" +"1000000000000000000000000j # 相當於 1e+24j" #: ../../reference/lexical_analysis.rst:1341 msgid "" @@ -1867,88 +1894,52 @@ msgid "" "definition:" msgstr "" -#: ../../reference/lexical_analysis.rst:1357 -msgid "Operators" -msgstr "" - -#: ../../reference/lexical_analysis.rst:1361 -msgid "The following tokens are operators:" -msgstr "" - -#: ../../reference/lexical_analysis.rst:1363 -msgid "" -"+ - * ** / // % @\n" -"<< >> & | ^ ~ :=\n" -"< > <= >= == !=" -msgstr "" -"+ - * ** / // % @\n" -"<< >> & | ^ ~ :=\n" -"< > <= >= == !=" - -#: ../../reference/lexical_analysis.rst:1374 -msgid "Delimiters" -msgstr "" - -#: ../../reference/lexical_analysis.rst:1378 -msgid "The following tokens serve as delimiters in the grammar:" +#: ../../reference/lexical_analysis.rst:1359 +msgid "Operators and delimiters" msgstr "" -#: ../../reference/lexical_analysis.rst:1380 +#: ../../reference/lexical_analysis.rst:1365 msgid "" -"( ) [ ] { }\n" -", : ! . ; @ =" -msgstr "" -"( ) [ ] { }\n" -", : ! . ; @ =" - -#: ../../reference/lexical_analysis.rst:1385 -msgid "The period can also occur in floating-point and imaginary literals." +"The following grammar defines :dfn:`operator` and :dfn:`delimiter` tokens, " +"that is, the generic :data:`~token.OP` token type. A :ref:`list of these " +"tokens and their names ` is also available in " +"the :mod:`!token` module documentation." msgstr "" -#: ../../reference/lexical_analysis.rst:1389 +#: ../../reference/lexical_analysis.rst:1394 msgid "" -"A sequence of three periods has a special meaning as an :py:data:`Ellipsis` " -"literal:" +"Generally, *operators* are used to combine :ref:`expressions `, " +"while *delimiters* serve other purposes. However, there is no clear, formal " +"distinction between the two categories." msgstr "" -#: ../../reference/lexical_analysis.rst:1392 -msgid "..." -msgstr "..." - -#: ../../reference/lexical_analysis.rst:1396 +#: ../../reference/lexical_analysis.rst:1398 msgid "" -"The following *augmented assignment operators* serve lexically as " -"delimiters, but also perform an operation:" +"Some tokens can serve as either operators or delimiters, depending on usage. " +"For example, ``*`` is both the multiplication operator and a delimiter used " +"for sequence unpacking, and ``@`` is both the matrix multiplication and a " +"delimiter that introduces decorators." msgstr "" -#: ../../reference/lexical_analysis.rst:1399 +#: ../../reference/lexical_analysis.rst:1403 msgid "" -"-> += -= *= /= //= %=\n" -"@= &= |= ^= >>= <<= **=" +"For some tokens, the distinction is unclear. For example, some people " +"consider ``.``, ``(``, and ``)`` to be delimiters, while others see the :py:" +"func:`getattr` operator and the function call operator(s)." msgstr "" -"-> += -= *= /= //= %=\n" -"@= &= |= ^= >>= <<= **=" -#: ../../reference/lexical_analysis.rst:1404 +#: ../../reference/lexical_analysis.rst:1407 msgid "" -"The following printing ASCII characters have special meaning as part of " -"other tokens or are otherwise significant to the lexical analyzer:" +"Some of Python's operators, like ``and``, ``or``, and ``not in``, use :ref:" +"`keyword ` tokens rather than \"symbols\" (operator tokens)." msgstr "" -#: ../../reference/lexical_analysis.rst:1407 -msgid "' \" # \\" -msgstr "' \" # \\" - -#: ../../reference/lexical_analysis.rst:1411 +#: ../../reference/lexical_analysis.rst:1410 msgid "" -"The following printing ASCII characters are not used in Python. Their " -"occurrence outside string literals and comments is an unconditional error:" +"A sequence of three consecutive periods (``...``) has a special meaning as " +"an :py:data:`Ellipsis` literal." msgstr "" -#: ../../reference/lexical_analysis.rst:1414 -msgid "$ ? `" -msgstr "$ ? `" - #: ../../reference/lexical_analysis.rst:8 msgid "lexical analysis" msgstr "lexical analysis(詞法分析)" @@ -2357,88 +2348,10 @@ msgstr "e" msgid "j" msgstr "j" -#: ../../reference/lexical_analysis.rst:1359 +#: ../../reference/lexical_analysis.rst:1361 msgid "operators" msgstr "operators(運算子)" -#: ../../reference/lexical_analysis.rst:1376 +#: ../../reference/lexical_analysis.rst:1361 msgid "delimiters" msgstr "delimiters(分隔符號)" - -#~ msgid "*Lu* - uppercase letters" -#~ msgstr "*Lu* - 大寫字母" - -#~ msgid "*Ll* - lowercase letters" -#~ msgstr "*Ll* - 小寫字母" - -#~ msgid "*Lo* - other letters" -#~ msgstr "*Lo* - 其他字母" - -#~ msgid "*Nd* - decimal numbers" -#~ msgstr "*Nd* - 十進位數字" - -#~ msgid "Notes" -#~ msgstr "註解" - -#~ msgid "\\(1)" -#~ msgstr "\\(1)" - -#~ msgid "Single quote (``'``)" -#~ msgstr "單引號 (``'``)" - -#~ msgid "Double quote (``\"``)" -#~ msgstr "雙引號 (``\"``)" - -#~ msgid "(2,4)" -#~ msgstr "(2,4)" - -#~ msgid "(3,4)" -#~ msgstr "(3,4)" - -#~ msgid "\\(5)" -#~ msgstr "\\(5)" - -#~ msgid "\\(6)" -#~ msgstr "\\(6)" - -#~ msgid "\\(7)" -#~ msgstr "\\(7)" - -#~ msgid "Notes:" -#~ msgstr "註解:" - -#~ msgid "" -#~ "7 2147483647 0o177 0b100110111\n" -#~ "3 79228162514264337593543950336 0o377 0xdeadbeef\n" -#~ " 100_000_000_000 0b_1110_0101" -#~ msgstr "" -#~ "7 2147483647 0o177 0b100110111\n" -#~ "3 79228162514264337593543950336 0o377 0xdeadbeef\n" -#~ " 100_000_000_000 0b_1110_0101" - -#~ msgid "Some examples of floating-point literals::" -#~ msgstr "一些浮點數常數的範例: ::" - -#~ msgid "3.14 10. .001 1e100 3.14e-10 0e0 3.14_15_93" -#~ msgstr "3.14 10. .001 1e100 3.14e-10 0e0 3.14_15_93" - -#~ msgid "Footnotes" -#~ msgstr "註解" - -#~ msgid "Unicode Consortium" -#~ msgstr "Unicode Consortium" - -#~ msgid "raw string" -#~ msgstr "raw string(原始字串)" - -#~ msgid "``\\ooo``" -#~ msgstr "``\\ooo``" - -#~ msgid "``\\xhh``" -#~ msgstr "``\\xhh``" - -#~ msgid "``\\N{name}``" -#~ msgstr "``\\N{name}``" - -#~ msgid "``\\uxxxx``" -#~ msgstr "``\\uxxxx``" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index 6c659547246..c06e84e396e 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-17 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -203,9 +203,9 @@ msgid "" "must yield an integer. If it is negative, the sequence's length is added to " "it. The resulting value must be a nonnegative integer less than the " "sequence's length, and the sequence is asked to assign the assigned object " -"to its item with that index. If the index is out of " -"range, :exc:`IndexError` is raised (assignment to a subscripted sequence " -"cannot add new items to a list)." +"to its item with that index. If the index is out of range, :exc:" +"`IndexError` is raised (assignment to a subscripted sequence cannot add new " +"items to a list)." msgstr "" #: ../../reference/simple_stmts.rst:211 @@ -379,8 +379,8 @@ msgid "" "If the right hand side is present, an annotated assignment performs the " "actual assignment as if there was no annotation present. If the right hand " "side is not present for an expression target, then the interpreter evaluates " -"the target except for the last :meth:`~object.__setitem__` " -"or :meth:`~object.__setattr__` call." +"the target except for the last :meth:`~object.__setitem__` or :meth:`~object." +"__setattr__` call." msgstr "" #: ../../reference/simple_stmts.rst:359 @@ -460,11 +460,11 @@ msgid "" "refer to the built-in variables with those names. In the current " "implementation, the built-in variable ``__debug__`` is ``True`` under normal " "circumstances, ``False`` when optimization is requested (command line " -"option :option:`-O`). The current code generator emits no code for " -"an :keyword:`assert` statement when optimization is requested at compile " -"time. Note that it is unnecessary to include the source code for the " -"expression that failed in the error message; it will be displayed as part of " -"the stack trace." +"option :option:`-O`). The current code generator emits no code for an :" +"keyword:`assert` statement when optimization is requested at compile time. " +"Note that it is unnecessary to include the source code for the expression " +"that failed in the error message; it will be displayed as part of the stack " +"trace." msgstr "" #: ../../reference/simple_stmts.rst:418 @@ -511,8 +511,8 @@ msgstr "" msgid "" "Deletion of a name removes the binding of that name from the local or global " "namespace, depending on whether the name occurs in a :keyword:`global` " -"statement in the same code block. If the name is unbound, " -"a :exc:`NameError` exception will be raised." +"statement in the same code block. Trying to delete an unbound name raises " +"a :exc:`NameError` exception." msgstr "" #: ../../reference/simple_stmts.rst:473 @@ -562,17 +562,16 @@ msgstr "" msgid "" "In a generator function, the :keyword:`return` statement indicates that the " "generator is done and will cause :exc:`StopIteration` to be raised. The " -"returned value (if any) is used as an argument to " -"construct :exc:`StopIteration` and becomes the :attr:`StopIteration.value` " -"attribute." +"returned value (if any) is used as an argument to construct :exc:" +"`StopIteration` and becomes the :attr:`StopIteration.value` attribute." msgstr "" #: ../../reference/simple_stmts.rst:515 msgid "" "In an asynchronous generator function, an empty :keyword:`return` statement " -"indicates that the asynchronous generator is done and will " -"cause :exc:`StopAsyncIteration` to be raised. A non-empty :keyword:`!" -"return` statement is a syntax error in an asynchronous generator function." +"indicates that the asynchronous generator is done and will cause :exc:" +"`StopAsyncIteration` to be raised. A non-empty :keyword:`!return` statement " +"is a syntax error in an asynchronous generator function." msgstr "" #: ../../reference/simple_stmts.rst:523 @@ -609,8 +608,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:548 msgid "" -"Yield expressions and statements are only used when defining " -"a :term:`generator` function, and are only used in the body of the generator " +"Yield expressions and statements are only used when defining a :term:" +"`generator` function, and are only used in the body of the generator " "function. Using :keyword:`yield` in a function definition is sufficient to " "cause that definition to create a generator function instead of a normal " "function." @@ -618,8 +617,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:553 msgid "" -"For full details of :keyword:`yield` semantics, refer to " -"the :ref:`yieldexpr` section." +"For full details of :keyword:`yield` semantics, refer to the :ref:" +"`yieldexpr` section." msgstr "" #: ../../reference/simple_stmts.rst:559 @@ -637,15 +636,15 @@ msgstr "" #: ../../reference/simple_stmts.rst:575 msgid "" "Otherwise, :keyword:`raise` evaluates the first expression as the exception " -"object. It must be either a subclass or an instance " -"of :class:`BaseException`. If it is a class, the exception instance will be " -"obtained when needed by instantiating the class with no arguments." +"object. It must be either a subclass or an instance of :class:" +"`BaseException`. If it is a class, the exception instance will be obtained " +"when needed by instantiating the class with no arguments." msgstr "" #: ../../reference/simple_stmts.rst:580 msgid "" -"The :dfn:`type` of the exception is the exception instance's class, " -"the :dfn:`value` is the instance itself." +"The :dfn:`type` of the exception is the exception instance's class, the :dfn:" +"`value` is the instance itself." msgstr "" #: ../../reference/simple_stmts.rst:585 @@ -715,8 +714,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:626 msgid "" "A similar mechanism works implicitly if a new exception is raised when an " -"exception is already being handled. An exception may be handled when " -"an :keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " +"exception is already being handled. An exception may be handled when an :" +"keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " "statement, is used. The previous exception is then attached as the new " "exception's :attr:`~BaseException.__context__` attribute:" msgstr "" @@ -787,9 +786,9 @@ msgstr "" #: ../../reference/simple_stmts.rst:666 msgid "" -"Additional information on exceptions can be found in " -"section :ref:`exceptions`, and information about handling exceptions is in " -"section :ref:`try`." +"Additional information on exceptions can be found in section :ref:" +"`exceptions`, and information about handling exceptions is in section :ref:" +"`try`." msgstr "" #: ../../reference/simple_stmts.rst:669 @@ -816,8 +815,8 @@ msgstr ":keyword:`!break` 陳述式" #: ../../reference/simple_stmts.rst:695 msgid "" -":keyword:`break` may only occur syntactically nested in a :keyword:`for` " -"or :keyword:`while` loop, but not nested in a function or class definition " +":keyword:`break` may only occur syntactically nested in a :keyword:`for` or :" +"keyword:`while` loop, but not nested in a function or class definition " "within that loop." msgstr "" @@ -875,8 +874,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:768 msgid "" -"define a name or names in the local namespace for the scope where " -"the :keyword:`import` statement occurs." +"define a name or names in the local namespace for the scope where the :" +"keyword:`import` statement occurs." msgstr "" #: ../../reference/simple_stmts.rst:771 @@ -905,8 +904,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:789 msgid "" -"If the module name is followed by :keyword:`!as`, then the name " -"following :keyword:`!as` is bound directly to the imported module." +"If the module name is followed by :keyword:`!as`, then the name following :" +"keyword:`!as` is bound directly to the imported module." msgstr "" #: ../../reference/simple_stmts.rst:791 @@ -968,10 +967,10 @@ msgid "" "import foo # foo imported and bound locally\n" "import foo.bar.baz # foo, foo.bar, and foo.bar.baz imported, foo " "bound locally\n" -"import foo.bar.baz as fbb # foo, foo.bar, and foo.bar.baz imported, " -"foo.bar.baz bound as fbb\n" -"from foo.bar import baz # foo, foo.bar, and foo.bar.baz imported, " -"foo.bar.baz bound as baz\n" +"import foo.bar.baz as fbb # foo, foo.bar, and foo.bar.baz imported, foo.bar." +"baz bound as fbb\n" +"from foo.bar import baz # foo, foo.bar, and foo.bar.baz imported, foo.bar." +"baz bound as baz\n" "from foo import attr # foo imported and foo.attr bound as attr" msgstr "" @@ -1028,8 +1027,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:871 msgid "" "Raises an :ref:`auditing event ` ``import`` with arguments " -"``module``, ``filename``, ``sys.path``, ``sys.meta_path``, " -"``sys.path_hooks``." +"``module``, ``filename``, ``sys.path``, ``sys.meta_path``, ``sys." +"path_hooks``." msgstr "" "引發一個附帶引數 ``module``、``filename``、``sys.path``、``sys.meta_path``、" "``sys.path_hooks`` 的\\ :ref:`稽核事件 ` ``import``。" @@ -1137,11 +1136,11 @@ msgstr "" #: ../../reference/simple_stmts.rst:941 msgid "" -"Code compiled by calls to the built-in functions :func:`exec` " -"and :func:`compile` that occur in a module :mod:`!M` containing a future " -"statement will, by default, use the new syntax or semantics associated with " -"the future statement. This can be controlled by optional arguments " -"to :func:`compile` --- see the documentation of that function for details." +"Code compiled by calls to the built-in functions :func:`exec` and :func:" +"`compile` that occur in a module :mod:`!M` containing a future statement " +"will, by default, use the new syntax or semantics associated with the future " +"statement. This can be controlled by optional arguments to :func:`compile` " +"--- see the documentation of that function for details." msgstr "" #: ../../reference/simple_stmts.rst:947 @@ -1188,8 +1187,8 @@ msgid "" "string or code object supplied to the built-in :func:`exec` function does " "not affect the code block *containing* the function call, and code contained " "in such a string is unaffected by :keyword:`!global` statements in the code " -"containing the function call. The same applies to the :func:`eval` " -"and :func:`compile` functions." +"containing the function call. The same applies to the :func:`eval` and :" +"func:`compile` functions." msgstr "" #: ../../reference/simple_stmts.rst:998 @@ -1204,8 +1203,8 @@ msgid "" "identifiers to refer to names previously bound in nonlocal scopes. It allows " "encapsulated code to rebind such nonlocal identifiers. If a name is bound " "in more than one nonlocal scope, the nearest binding is used. If a name is " -"not bound in any nonlocal scope, or if there is no nonlocal scope, " -"a :exc:`SyntaxError` is raised." +"not bound in any nonlocal scope, or if there is no nonlocal scope, a :exc:" +"`SyntaxError` is raised." msgstr "" #: ../../reference/simple_stmts.rst:1015 @@ -1226,8 +1225,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:1024 msgid "" "**Programmer's note:** :keyword:`nonlocal` is a directive to the parser and " -"applies only to code parsed along with it. See the note for " -"the :keyword:`global` statement." +"applies only to code parsed along with it. See the note for the :keyword:" +"`global` statement." msgstr "" #: ../../reference/simple_stmts.rst:1032 @@ -1269,9 +1268,9 @@ msgstr "" msgid "" "The value of the type alias is evaluated in the annotation scope. It is not " "evaluated when the type alias is created, but only when the value is " -"accessed through the type alias's :attr:`!__value__` attribute " -"(see :ref:`lazy-evaluation`). This allows the type alias to refer to names " -"that are not yet defined." +"accessed through the type alias's :attr:`!__value__` attribute (see :ref:" +"`lazy-evaluation`). This allows the type alias to refer to names that are " +"not yet defined." msgstr "" #: ../../reference/simple_stmts.rst:1061 diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index 31f47ad6674..d7ece618b1f 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-10 20:44+0800\n" +"POT-Creation-Date: 2025-09-12 00:14+0000\n" "PO-Revision-Date: 2022-07-24 14:52+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -77,9 +77,9 @@ msgstr "" msgid "" "There can be zero or more :keyword:`elif` parts, and the :keyword:`else` " "part is optional. The keyword ':keyword:`!elif`' is short for 'else if', " -"and is useful to avoid excessive indentation. An :keyword:`!" -"if` ... :keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute " -"for the ``switch`` or ``case`` statements found in other languages." +"and is useful to avoid excessive indentation. An :keyword:`!if` ... :" +"keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute for the " +"``switch`` or ``case`` statements found in other languages." msgstr "" "在陳述式中,可以沒有或有許多個 :keyword:`elif` 敘述,且 :keyword:`else` 敘述" "並不是必要的。關鍵字 :keyword:`!elif` 是「else if」的縮寫,用來避免過多的縮" @@ -104,10 +104,10 @@ msgid "" "The :keyword:`for` statement in Python differs a bit from what you may be " "used to in C or Pascal. Rather than always iterating over an arithmetic " "progression of numbers (like in Pascal), or giving the user the ability to " -"define both the iteration step and halting condition (as C), " -"Python's :keyword:`!for` statement iterates over the items of any sequence " -"(a list or a string), in the order that they appear in the sequence. For " -"example (no pun intended):" +"define both the iteration step and halting condition (as C), Python's :" +"keyword:`!for` statement iterates over the items of any sequence (a list or " +"a string), in the order that they appear in the sequence. For example (no " +"pun intended):" msgstr "" "在 Python 中的 :keyword:`for` 陳述式有點不同於在 C 或 Pascal 中的慣用方式。相" "較於只能疊代 (iterate) 一個等差數列(如 Pascal),或給予使用者定義疊代步驟與" @@ -179,9 +179,8 @@ msgstr ":func:`range` 函式" #: ../../tutorial/controlflow.rst:96 msgid "" -"If you do need to iterate over a sequence of numbers, the built-in " -"function :func:`range` comes in handy. It generates arithmetic " -"progressions::" +"If you do need to iterate over a sequence of numbers, the built-in function :" +"func:`range` comes in handy. It generates arithmetic progressions::" msgstr "" "如果你需要疊代一個數列的話,使用內建 :func:`range` 函式就很方便。它可以生成一" "等差數列: ::" @@ -301,9 +300,9 @@ msgstr "" msgid "" "We say such an object is :term:`iterable`, that is, suitable as a target for " "functions and constructs that expect something from which they can obtain " -"successive items until the supply is exhausted. We have seen that " -"the :keyword:`for` statement is such a construct, while an example of a " -"function that takes an iterable is :func:`sum`::" +"successive items until the supply is exhausted. We have seen that the :" +"keyword:`for` statement is such a construct, while an example of a function " +"that takes an iterable is :func:`sum`::" msgstr "" "我們稱這樣的物件為 :term:`iterable`\\ (可疊代物件),意即能作為函式及架構中" "可以一直取得項目直到取盡的對象。我們已經了解 :keyword:`for` 陳述式就是如此的" @@ -323,8 +322,8 @@ msgid "" "arguments. In chapter :ref:`tut-structures`, we will discuss in more detail " "about :func:`list`." msgstr "" -"待會我們可以看到更多回傳 iterable 和使用 iterable 為引數的函式。在" -"\\ :ref:`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。" +"待會我們可以看到更多回傳 iterable 和使用 iterable 為引數的函式。在\\ :ref:" +"`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。" #: ../../tutorial/controlflow.rst:164 msgid ":keyword:`!break` and :keyword:`!continue` Statements" @@ -332,11 +331,11 @@ msgstr ":keyword:`!break` 和 :keyword:`!continue` 陳述式" #: ../../tutorial/controlflow.rst:166 msgid "" -"The :keyword:`break` statement breaks out of the innermost " -"enclosing :keyword:`for` or :keyword:`while` loop::" +"The :keyword:`break` statement breaks out of the innermost enclosing :" +"keyword:`for` or :keyword:`while` loop::" msgstr "" -":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` " -"或 :keyword:`while` 迴圈: ::" +":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` 或 :keyword:" +"`while` 迴圈: ::" #: ../../tutorial/controlflow.rst:169 msgid "" @@ -412,8 +411,8 @@ msgid "" "clause executes." msgstr "" "在 :keyword:`!for` 或 :keyword:`!while` 迴圈中,:keyword:`!break` 陳述句可能" -"與 :keyword:`!else` 子句配對。如果迴圈完成而沒有執行 :keyword:`!" -"break`,:keyword:`!else` 子句會被執行。" +"與 :keyword:`!else` 子句配對。如果迴圈完成而沒有執行 :keyword:`!break`,:" +"keyword:`!else` 子句會被執行。" #: ../../tutorial/controlflow.rst:208 msgid "" @@ -512,17 +511,17 @@ msgid "" "occurs. For more on the ``try`` statement and exceptions, see :ref:`tut-" "handling`." msgstr "" -"當 ``else`` 子句用於迴圈時,相較於搭配 ``if`` 陳述式使用,它的行為" -"與 :keyword:`try` 陳述式中的 ``else`` 子句更為相似:``try`` 陳述式的 " -"``else`` 子句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有" -"任何 ``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見" -"\\ :ref:`tut-handling`。" +"當 ``else`` 子句用於迴圈時,相較於搭配 ``if`` 陳述式使用,它的行為與 :" +"keyword:`try` 陳述式中的 ``else`` 子句更為相似:``try`` 陳述式的 ``else`` 子" +"句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有任何 " +"``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見\\ :ref:`tut-" +"handling`。" -#: ../../tutorial/controlflow.rst:257 +#: ../../tutorial/controlflow.rst:258 msgid ":keyword:`!pass` Statements" msgstr ":keyword:`!pass` 陳述式" -#: ../../tutorial/controlflow.rst:259 +#: ../../tutorial/controlflow.rst:260 msgid "" "The :keyword:`pass` statement does nothing. It can be used when a statement " "is required syntactically but the program requires no action. For example::" @@ -530,7 +529,7 @@ msgstr "" ":keyword:`pass` 陳述式不執行任何動作。它可用在語法上需要一個陳述式但程式不需" "要執行任何動作的時候。例如: ::" -#: ../../tutorial/controlflow.rst:262 +#: ../../tutorial/controlflow.rst:263 msgid "" ">>> while True:\n" "... pass # Busy-wait for keyboard interrupt (Ctrl+C)\n" @@ -540,11 +539,11 @@ msgstr "" "... pass # 忙碌等待鍵盤中斷 (Ctrl+C)\n" "..." -#: ../../tutorial/controlflow.rst:266 +#: ../../tutorial/controlflow.rst:267 msgid "This is commonly used for creating minimal classes::" msgstr "這經常用於建立簡單的 class(類別): ::" -#: ../../tutorial/controlflow.rst:268 +#: ../../tutorial/controlflow.rst:269 msgid "" ">>> class MyEmptyClass:\n" "... pass\n" @@ -554,7 +553,7 @@ msgstr "" "... pass\n" "..." -#: ../../tutorial/controlflow.rst:272 +#: ../../tutorial/controlflow.rst:273 msgid "" "Another place :keyword:`pass` can be used is as a place-holder for a " "function or conditional body when you are working on new code, allowing you " @@ -564,7 +563,7 @@ msgstr "" ":keyword:`pass` 亦可作為一個函式或條件判斷主體的預留位置,在你撰寫新的程式碼" "時讓你保持在更抽象的思維層次。:keyword:`!pass` 會直接被忽略: ::" -#: ../../tutorial/controlflow.rst:276 +#: ../../tutorial/controlflow.rst:277 msgid "" ">>> def initlog(*args):\n" "... pass # Remember to implement this!\n" @@ -574,11 +573,24 @@ msgstr "" "... pass # 記得要實作這個!\n" "..." -#: ../../tutorial/controlflow.rst:284 +#: ../../tutorial/controlflow.rst:281 +msgid "" +"For this last case, many people use the ellipsis literal :code:`...` instead " +"of :code:`pass`. This use has no special meaning to Python, and is not part " +"of the language definition (you could use any constant expression here), " +"but :code:`...` is used conventionally as a placeholder body as well. See :" +"ref:`bltin-ellipsis-object`." +msgstr "" +"在最後這個例子中,許多人會使用刪節號字面值 :code:`...` 來取代 :code:`pass`。" +"這種用法對 Python 並沒有特殊的意義,且並非語言定義的一部分(你也可以在這裡" +"使用任何常數運算式),但 :code:`...` 也慣例上被用作預留主體 (placeholder body)。" +"見 :ref:`bltin-ellipsis-object`。" + +#: ../../tutorial/controlflow.rst:291 msgid ":keyword:`!match` Statements" msgstr ":keyword:`!match` 陳述式" -#: ../../tutorial/controlflow.rst:286 +#: ../../tutorial/controlflow.rst:293 msgid "" "A :keyword:`match` statement takes an expression and compares its value to " "successive patterns given as one or more case blocks. This is superficially " @@ -595,14 +607,14 @@ msgstr "" "行,而它也可以將成分(序列元素或物件屬性)從值中提取到變數中。如果沒有任何的 " "case 匹配成功,則不會執行任何的分支。" -#: ../../tutorial/controlflow.rst:295 +#: ../../tutorial/controlflow.rst:302 msgid "" "The simplest form compares a subject value against one or more literals::" msgstr "" "最簡單的形式,是將一個主題值 (subject value) 與一個或多個字面值 (literal) 進" "行比較: ::" -#: ../../tutorial/controlflow.rst:297 +#: ../../tutorial/controlflow.rst:304 msgid "" "def http_error(status):\n" " match status:\n" @@ -626,7 +638,7 @@ msgstr "" " case _:\n" " return \"Something's wrong with the internet\"" -#: ../../tutorial/controlflow.rst:308 +#: ../../tutorial/controlflow.rst:315 msgid "" "Note the last block: the \"variable name\" ``_`` acts as a *wildcard* and " "never fails to match." @@ -634,12 +646,12 @@ msgstr "" "請注意最後一段:「變數名稱」\\ ``_`` 是作為\\ *通用字元 (wildcard)*\\ 的角" "色,且永遠不會匹配失敗。" -#: ../../tutorial/controlflow.rst:311 +#: ../../tutorial/controlflow.rst:318 msgid "" "You can combine several literals in a single pattern using ``|`` (\"or\")::" msgstr "你可以使用 ``|``\\ (「或」)來將多個字面值組合在單一模式中: ::" -#: ../../tutorial/controlflow.rst:313 +#: ../../tutorial/controlflow.rst:320 msgid "" "case 401 | 403 | 404:\n" " return \"Not allowed\"" @@ -647,14 +659,14 @@ msgstr "" "case 401 | 403 | 404:\n" " return \"Not allowed\"" -#: ../../tutorial/controlflow.rst:316 +#: ../../tutorial/controlflow.rst:323 msgid "" "Patterns can look like unpacking assignments, and can be used to bind " "variables::" msgstr "" "模式可以看起來像是拆解賦值 (unpacking assignment),且可以用來連結變數: ::" -#: ../../tutorial/controlflow.rst:319 +#: ../../tutorial/controlflow.rst:326 msgid "" "# point is an (x, y) tuple\n" "match point:\n" @@ -682,7 +694,7 @@ msgstr "" " case _:\n" " raise ValueError(\"Not a point\")" -#: ../../tutorial/controlflow.rst:332 +#: ../../tutorial/controlflow.rst:339 msgid "" "Study that one carefully! The first pattern has two literals, and can be " "thought of as an extension of the literal pattern shown above. But the next " @@ -696,7 +708,7 @@ msgstr "" "(bind)* 了來自主題 (``point``) 的一個值。第四個模式會擷取兩個值,這使得它在概" "念上類似於拆解賦值 ``(x, y) = point``。" -#: ../../tutorial/controlflow.rst:339 +#: ../../tutorial/controlflow.rst:346 msgid "" "If you are using classes to structure your data you can use the class name " "followed by an argument list resembling a constructor, but with the ability " @@ -705,7 +717,7 @@ msgstr "" "如果你要用 class 來結構化你的資料,你可以使用該 class 的名稱加上一個引數列" "表,類似一個建構式 (constructor),但它能夠將屬性擷取到變數中: ::" -#: ../../tutorial/controlflow.rst:343 +#: ../../tutorial/controlflow.rst:350 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -743,7 +755,7 @@ msgstr "" " case _:\n" " print(\"Not a point\")" -#: ../../tutorial/controlflow.rst:361 +#: ../../tutorial/controlflow.rst:368 msgid "" "You can use positional parameters with some builtin classes that provide an " "ordering for their attributes (e.g. dataclasses). You can also define a " @@ -757,7 +769,7 @@ msgstr "" "``__match_args__``,來定義模式中屬性們的特定位置。如果它被設定為 (\"x\", " "\"y\"),則以下的模式都是等價的(且都會將屬性 ``y`` 連結到變數 ``var``): ::" -#: ../../tutorial/controlflow.rst:367 +#: ../../tutorial/controlflow.rst:374 msgid "" "Point(1, var)\n" "Point(1, y=var)\n" @@ -769,13 +781,13 @@ msgstr "" "Point(x=1, y=var)\n" "Point(y=var, x=1)" -#: ../../tutorial/controlflow.rst:372 +#: ../../tutorial/controlflow.rst:379 msgid "" "A recommended way to read patterns is to look at them as an extended form of " "what you would put on the left of an assignment, to understand which " "variables would be set to what. Only the standalone names (like ``var`` " -"above) are assigned to by a match statement. Dotted names (like " -"``foo.bar``), attribute names (the ``x=`` and ``y=`` above) or class names " +"above) are assigned to by a match statement. Dotted names (like ``foo." +"bar``), attribute names (the ``x=`` and ``y=`` above) or class names " "(recognized by the \"(...)\" next to them like ``Point`` above) are never " "assigned to." msgstr "" @@ -785,7 +797,7 @@ msgstr "" "的 ``x=`` 及 ``y=``)或 class 名稱(由它們後面的 \"(...)\" 被辨識,如上面的 " "``Point``)則永遠無法被賦值。" -#: ../../tutorial/controlflow.rst:379 +#: ../../tutorial/controlflow.rst:386 msgid "" "Patterns can be arbitrarily nested. For example, if we have a short list of " "Points, with ``__match_args__`` added, we could match it like this::" @@ -793,7 +805,7 @@ msgstr "" "模式可以任意地被巢套 (nested)。例如,如果我們有一個由某些點所組成的簡短 " "list,我們就可以像這樣加入 ``__match_args__`` 來對它進行匹配: ::" -#: ../../tutorial/controlflow.rst:382 +#: ../../tutorial/controlflow.rst:389 msgid "" "class Point:\n" " __match_args__ = ('x', 'y')\n" @@ -831,7 +843,7 @@ msgstr "" " case _:\n" " print(\"Something else\")" -#: ../../tutorial/controlflow.rst:400 +#: ../../tutorial/controlflow.rst:407 msgid "" "We can add an ``if`` clause to a pattern, known as a \"guard\". If the " "guard is false, ``match`` goes on to try the next case block. Note that " @@ -841,7 +853,7 @@ msgstr "" "則 ``match`` 會繼續嘗試下一個 case 區塊。請注意,值的擷取會發生在防護的評估之" "前: ::" -#: ../../tutorial/controlflow.rst:404 +#: ../../tutorial/controlflow.rst:411 msgid "" "match point:\n" " case Point(x, y) if x == y:\n" @@ -855,11 +867,11 @@ msgstr "" " case Point(x, y):\n" " print(f\"Not on the diagonal\")" -#: ../../tutorial/controlflow.rst:410 +#: ../../tutorial/controlflow.rst:417 msgid "Several other key features of this statement:" msgstr "此種陳述式的其他幾個重要特色:" -#: ../../tutorial/controlflow.rst:412 +#: ../../tutorial/controlflow.rst:419 msgid "" "Like unpacking assignments, tuple and list patterns have exactly the same " "meaning and actually match arbitrary sequences. An important exception is " @@ -868,7 +880,7 @@ msgstr "" "與拆解賦值的情況類似,tuple(元組)和 list 模式具有完全相同的意義,而且實際上" "可以匹配任意的序列。一個重要的例外,是它們不能匹配疊代器 (iterator) 或字串。" -#: ../../tutorial/controlflow.rst:416 +#: ../../tutorial/controlflow.rst:423 msgid "" "Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y, " "*rest)`` work similar to unpacking assignments. The name after ``*`` may " @@ -880,7 +892,7 @@ msgstr "" "``_``,所以 ``(x, y, *_)`` 會匹配一個至少兩項的序列,且不會連結那兩項以外的其" "餘項。" -#: ../../tutorial/controlflow.rst:421 +#: ../../tutorial/controlflow.rst:428 msgid "" "Mapping patterns: ``{\"bandwidth\": b, \"latency\": l}`` captures the " "``\"bandwidth\"`` and ``\"latency\"`` values from a dictionary. Unlike " @@ -892,15 +904,15 @@ msgstr "" "式不同,額外的鍵 (key) 會被忽略。一種像是 ``**rest`` 的拆解方式,也是可被支援" "的。(但 ``**_`` 則是多餘的做法,所以它並不被允許。)" -#: ../../tutorial/controlflow.rst:426 +#: ../../tutorial/controlflow.rst:433 msgid "Subpatterns may be captured using the ``as`` keyword::" msgstr "使用關鍵字 ``as`` 可以擷取子模式 (subpattern): ::" -#: ../../tutorial/controlflow.rst:428 +#: ../../tutorial/controlflow.rst:435 msgid "case (Point(x1, y1), Point(x2, y2) as p2): ..." msgstr "case (Point(x1, y1), Point(x2, y2) as p2): ..." -#: ../../tutorial/controlflow.rst:430 +#: ../../tutorial/controlflow.rst:437 msgid "" "will capture the second element of the input as ``p2`` (as long as the input " "is a sequence of two points)" @@ -908,7 +920,7 @@ msgstr "" "將會擷取輸入的第二個元素作為 ``p2``\\ (只要該輸入是一個由兩個點所組成的序" "列)。" -#: ../../tutorial/controlflow.rst:433 +#: ../../tutorial/controlflow.rst:440 msgid "" "Most literals are compared by equality, however the singletons ``True``, " "``False`` and ``None`` are compared by identity." @@ -916,7 +928,7 @@ msgstr "" "大部分的字面值是藉由相等性 (equality) 來比較,但是單例物件 (singleton) " "``True``、``False`` 和 ``None`` 是藉由標識值 (identity) 來比較。" -#: ../../tutorial/controlflow.rst:436 +#: ../../tutorial/controlflow.rst:443 msgid "" "Patterns may use named constants. These must be dotted names to prevent " "them from being interpreted as capture variable::" @@ -924,7 +936,7 @@ msgstr "" "模式可以使用附名常數 (named constant)。這些模式必須是點分隔名稱,以免它們被解" "釋為擷取變數: ::" -#: ../../tutorial/controlflow.rst:439 +#: ../../tutorial/controlflow.rst:446 msgid "" "from enum import Enum\n" "class Color(Enum):\n" @@ -958,24 +970,24 @@ msgstr "" " case Color.BLUE:\n" " print(\"I'm feeling the blues :(\")" -#: ../../tutorial/controlflow.rst:455 +#: ../../tutorial/controlflow.rst:462 msgid "" -"For a more detailed explanation and additional examples, you can look " -"into :pep:`636` which is written in a tutorial format." +"For a more detailed explanation and additional examples, you can look into :" +"pep:`636` which is written in a tutorial format." msgstr "" "關於更詳細的解釋和其他範例,你可以閱讀 :pep:`636`,它是以教學的格式編寫而成。" -#: ../../tutorial/controlflow.rst:461 +#: ../../tutorial/controlflow.rst:468 msgid "Defining Functions" msgstr "定義函式 (function)" -#: ../../tutorial/controlflow.rst:463 +#: ../../tutorial/controlflow.rst:470 msgid "" "We can create a function that writes the Fibonacci series to an arbitrary " "boundary::" msgstr "我們可以建立一個函式來產生費式數列到任何一個上界: ::" -#: ../../tutorial/controlflow.rst:466 +#: ../../tutorial/controlflow.rst:473 msgid "" ">>> def fib(n): # write Fibonacci series less than n\n" "... \"\"\"Print a Fibonacci series less than n.\"\"\"\n" @@ -1001,7 +1013,7 @@ msgstr "" ">>> fib(2000)\n" "0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597" -#: ../../tutorial/controlflow.rst:483 +#: ../../tutorial/controlflow.rst:490 msgid "" "The keyword :keyword:`def` introduces a function *definition*. It must be " "followed by the function name and the parenthesized list of formal " @@ -1011,15 +1023,15 @@ msgstr "" "關鍵字 :keyword:`def` 介紹一個函式的\\ *定義*。它之後必須連著該函式的名稱和置" "於括號之中的一串參數。自下一行起,所有縮排的陳述式成為該函式的主體。" -#: ../../tutorial/controlflow.rst:488 +#: ../../tutorial/controlflow.rst:495 msgid "" "The first statement of the function body can optionally be a string literal; " -"this string literal is the function's documentation string, " -"or :dfn:`docstring`. (More about docstrings can be found in the " -"section :ref:`tut-docstrings`.) There are tools which use docstrings to " -"automatically produce online or printed documentation, or to let the user " -"interactively browse through code; it's good practice to include docstrings " -"in code that you write, so make a habit of it." +"this string literal is the function's documentation string, or :dfn:" +"`docstring`. (More about docstrings can be found in the section :ref:`tut-" +"docstrings`.) There are tools which use docstrings to automatically produce " +"online or printed documentation, or to let the user interactively browse " +"through code; it's good practice to include docstrings in code that you " +"write, so make a habit of it." msgstr "" "一個函式的第一個陳述式可以是一個字串文本;該字串文本被視為該函式的說明文件字" "串,即 :dfn:`docstring`。(關於 docstring 的細節請參見\\ :ref:`tut-" @@ -1027,7 +1039,7 @@ msgstr "" "件,或讓使用者能以互動的方式在原始碼中瀏覽文件。在原始碼中加入 docstring 是個" "好慣例,應該養成這樣的習慣。" -#: ../../tutorial/controlflow.rst:495 +#: ../../tutorial/controlflow.rst:502 msgid "" "The *execution* of a function introduces a new symbol table used for the " "local variables of the function. More precisely, all variable assignments " @@ -1045,10 +1057,10 @@ msgstr "" "域符號表。然而,在引用一個變數時,會先從區域符號表開始搜尋,其次為外層函式的" "區域符號表,其次為全域符號表 (global symbol table),最後為所有內建的名稱。因" "此,在函式中,全域變數及外層函式變數雖然可以被引用,但無法被直接賦值(除非全" -"域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數" -"在 :keyword:`nonlocal` 陳述式中被定義)。" +"域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:" +"`nonlocal` 陳述式中被定義)。" -#: ../../tutorial/controlflow.rst:506 +#: ../../tutorial/controlflow.rst:513 msgid "" "The actual parameters (arguments) to a function call are introduced in the " "local symbol table of the called function when it is called; thus, arguments " @@ -1062,7 +1074,7 @@ msgstr "" "永遠是一個物件的\\ *參照 (reference)*,而不是該物件的值)。 [#]_ 當一個函式呼" "叫別的函式或遞迴呼叫它自己時,在被呼叫的函式中會建立一個新的區域符號表。" -#: ../../tutorial/controlflow.rst:513 +#: ../../tutorial/controlflow.rst:520 msgid "" "A function definition associates the function name with the function object " "in the current symbol table. The interpreter recognizes the object pointed " @@ -1073,7 +1085,7 @@ msgstr "" "直譯器辨識為使用者自定函式 (user-defined function)。該值可以被指定給別的變數" "名,使該變數名也可以被當作函式使用。這是常見的重新命名方式: ::" -#: ../../tutorial/controlflow.rst:518 +#: ../../tutorial/controlflow.rst:525 msgid "" ">>> fib\n" "\n" @@ -1087,22 +1099,22 @@ msgstr "" ">>> f(100)\n" "0 1 1 2 3 5 8 13 21 34 55 89" -#: ../../tutorial/controlflow.rst:524 +#: ../../tutorial/controlflow.rst:531 msgid "" "Coming from other languages, you might object that ``fib`` is not a function " "but a procedure since it doesn't return a value. In fact, even functions " "without a :keyword:`return` statement do return a value, albeit a rather " "boring one. This value is called ``None`` (it's a built-in name). Writing " "the value ``None`` is normally suppressed by the interpreter if it would be " -"the only value written. You can see it if you really want to " -"using :func:`print`::" +"the only value written. You can see it if you really want to using :func:" +"`print`::" msgstr "" "如果你是來自別的語言,你可能不同意 ``fib`` 是個函式,而是個程序 (procedure)," "因為它並沒有回傳值。實際上,即使一個函式缺少一個 :keyword:`return` 陳述式,它" "亦有一個固定的回傳值。這個值稱為 ``None``\\ (它是一個內建名稱)。在直譯器中" "單獨使用 ``None`` 時,通常不會被顯示。你可以使用 :func:`print` 來看到它: ::" -#: ../../tutorial/controlflow.rst:531 +#: ../../tutorial/controlflow.rst:538 msgid "" ">>> fib(0)\n" ">>> print(fib(0))\n" @@ -1112,13 +1124,13 @@ msgstr "" ">>> print(fib(0))\n" "None" -#: ../../tutorial/controlflow.rst:535 +#: ../../tutorial/controlflow.rst:542 msgid "" "It is simple to write a function that returns a list of the numbers of the " "Fibonacci series, instead of printing it::" msgstr "如果要寫一個函式回傳費式數列的 list 而不是直接印出它,這也很容易: ::" -#: ../../tutorial/controlflow.rst:538 +#: ../../tutorial/controlflow.rst:545 msgid "" ">>> def fib2(n): # return Fibonacci series up to n\n" "... \"\"\"Return a list containing the Fibonacci series up to n.\"\"\"\n" @@ -1146,21 +1158,21 @@ msgstr "" ">>> f100 # 寫出結果\n" "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]" -#: ../../tutorial/controlflow.rst:551 +#: ../../tutorial/controlflow.rst:558 msgid "This example, as usual, demonstrates some new Python features:" msgstr "這個例子一樣示範了一些新的 Python 特性:" -#: ../../tutorial/controlflow.rst:553 +#: ../../tutorial/controlflow.rst:560 msgid "" -"The :keyword:`return` statement returns with a value from a " -"function. :keyword:`!return` without an expression argument returns " -"``None``. Falling off the end of a function also returns ``None``." +"The :keyword:`return` statement returns with a value from a function. :" +"keyword:`!return` without an expression argument returns ``None``. Falling " +"off the end of a function also returns ``None``." msgstr "" ":keyword:`return` 陳述式會讓一個函式回傳一個值。單獨使用 :keyword:`!return` " "不外加一個運算式作為引數時會回傳 ``None``。一個函式執行到結束也會回傳 " "``None``。" -#: ../../tutorial/controlflow.rst:557 +#: ../../tutorial/controlflow.rst:564 msgid "" "The statement ``result.append(a)`` calls a *method* of the list object " "``result``. A method is a function that 'belongs' to an object and is named " @@ -1168,10 +1180,10 @@ msgid "" "expression), and ``methodname`` is the name of a method that is defined by " "the object's type. Different types define different methods. Methods of " "different types may have the same name without causing ambiguity. (It is " -"possible to define your own object types and methods, using *classes*, " -"see :ref:`tut-classes`) The method :meth:`~list.append` shown in the example " -"is defined for list objects; it adds a new element at the end of the list. " -"In this example it is equivalent to ``result = result + [a]``, but more " +"possible to define your own object types and methods, using *classes*, see :" +"ref:`tut-classes`) The method :meth:`~list.append` shown in the example is " +"defined for list objects; it adds a new element at the end of the list. In " +"this example it is equivalent to ``result = result + [a]``, but more " "efficient." msgstr "" "``result.append(a)`` 陳述式呼叫了一個 list 物件 ``result`` 的 *method(方法)" @@ -1183,22 +1195,22 @@ msgstr "" "method 定義在 list 物件中;它會在該 list 的末端加入一個新的元素。這個例子等同" "於 ``result = result + [a]``,但更有效率。" -#: ../../tutorial/controlflow.rst:572 +#: ../../tutorial/controlflow.rst:579 msgid "More on Defining Functions" msgstr "深入了解函式定義" -#: ../../tutorial/controlflow.rst:574 +#: ../../tutorial/controlflow.rst:581 msgid "" "It is also possible to define functions with a variable number of arguments. " "There are three forms, which can be combined." msgstr "" "定義函式時使用的引數 (argument) 數量是可變的。總共有三種可以組合使用的形式。" -#: ../../tutorial/controlflow.rst:581 +#: ../../tutorial/controlflow.rst:588 msgid "Default Argument Values" msgstr "預設引數值" -#: ../../tutorial/controlflow.rst:583 +#: ../../tutorial/controlflow.rst:590 msgid "" "The most useful form is to specify a default value for one or more " "arguments. This creates a function that can be called with fewer arguments " @@ -1207,7 +1219,7 @@ msgstr "" "為一個或多個引數指定預設值是很有用的方式。函式建立後,可以用比定義時更少的引" "數呼叫該函式。例如: ::" -#: ../../tutorial/controlflow.rst:587 +#: ../../tutorial/controlflow.rst:594 msgid "" "def ask_ok(prompt, retries=4, reminder='Please try again!'):\n" " while True:\n" @@ -1233,22 +1245,22 @@ msgstr "" " raise ValueError('invalid user response')\n" " print(reminder)" -#: ../../tutorial/controlflow.rst:599 +#: ../../tutorial/controlflow.rst:606 msgid "This function can be called in several ways:" msgstr "該函式可以用以下幾種方式被呼叫:" -#: ../../tutorial/controlflow.rst:601 +#: ../../tutorial/controlflow.rst:608 msgid "" "giving only the mandatory argument: ``ask_ok('Do you really want to quit?')``" msgstr "只給必要引數:``ask_ok('Do you really want to quit?')``" -#: ../../tutorial/controlflow.rst:603 +#: ../../tutorial/controlflow.rst:610 msgid "" "giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', " "2)``" msgstr "給予一個選擇性引數:``ask_ok('OK to overwrite the file?', 2)``" -#: ../../tutorial/controlflow.rst:605 +#: ../../tutorial/controlflow.rst:612 msgid "" "or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come " "on, only yes or no!')``" @@ -1256,19 +1268,19 @@ msgstr "" "給予所有引數:``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or " "no!')``" -#: ../../tutorial/controlflow.rst:608 +#: ../../tutorial/controlflow.rst:615 msgid "" "This example also introduces the :keyword:`in` keyword. This tests whether " "or not a sequence contains a certain value." msgstr "此例也使用了關鍵字 :keyword:`in`,用於測試序列中是否包含某個特定值。" -#: ../../tutorial/controlflow.rst:611 +#: ../../tutorial/controlflow.rst:618 msgid "" "The default values are evaluated at the point of function definition in the " "*defining* scope, so that ::" msgstr "預設值是在函式定義當下,於\\ *定義時*\\ 的作用域中求值,所以: ::" -#: ../../tutorial/controlflow.rst:614 +#: ../../tutorial/controlflow.rst:621 msgid "" "i = 5\n" "\n" @@ -1286,11 +1298,11 @@ msgstr "" "i = 6\n" "f()" -#: ../../tutorial/controlflow.rst:622 +#: ../../tutorial/controlflow.rst:629 msgid "will print ``5``." msgstr "將會輸出 ``5``。" -#: ../../tutorial/controlflow.rst:624 +#: ../../tutorial/controlflow.rst:631 msgid "" "**Important warning:** The default value is evaluated only once. This makes " "a difference when the default is a mutable object such as a list, " @@ -1301,7 +1313,7 @@ msgstr "" "(字典)或許多類別實例時,會產生不同的結果。例如,以下函式於後續呼叫時會累積" "曾經傳遞的引數: ::" -#: ../../tutorial/controlflow.rst:629 +#: ../../tutorial/controlflow.rst:636 msgid "" "def f(a, L=[]):\n" " L.append(a)\n" @@ -1319,11 +1331,11 @@ msgstr "" "print(f(2))\n" "print(f(3))" -#: ../../tutorial/controlflow.rst:637 +#: ../../tutorial/controlflow.rst:644 msgid "This will print ::" msgstr "將會輸出: ::" -#: ../../tutorial/controlflow.rst:639 +#: ../../tutorial/controlflow.rst:646 msgid "" "[1]\n" "[1, 2]\n" @@ -1333,13 +1345,13 @@ msgstr "" "[1, 2]\n" "[1, 2, 3]" -#: ../../tutorial/controlflow.rst:643 +#: ../../tutorial/controlflow.rst:650 msgid "" "If you don't want the default to be shared between subsequent calls, you can " "write the function like this instead::" msgstr "如果不想在後續呼叫之間共用預設值,應以如下方式編寫函式:" -#: ../../tutorial/controlflow.rst:646 +#: ../../tutorial/controlflow.rst:653 msgid "" "def f(a, L=None):\n" " if L is None:\n" @@ -1353,11 +1365,11 @@ msgstr "" " L.append(a)\n" " return L" -#: ../../tutorial/controlflow.rst:656 +#: ../../tutorial/controlflow.rst:663 msgid "Keyword Arguments" msgstr "關鍵字引數" -#: ../../tutorial/controlflow.rst:658 +#: ../../tutorial/controlflow.rst:665 msgid "" "Functions can also be called using :term:`keyword arguments ` of the form ``kwarg=value``. For instance, the following " @@ -1366,7 +1378,7 @@ msgstr "" "函式也可以使用\\ :term:`關鍵字引數 `,以 ``kwarg=value`` 的" "形式呼叫。舉例來說,以下函式: ::" -#: ../../tutorial/controlflow.rst:661 +#: ../../tutorial/controlflow.rst:668 msgid "" "def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):\n" " print(\"-- This parrot wouldn't\", action, end=' ')\n" @@ -1380,7 +1392,7 @@ msgstr "" " print(\"-- Lovely plumage, the\", type)\n" " print(\"-- It's\", state, \"!\")" -#: ../../tutorial/controlflow.rst:667 +#: ../../tutorial/controlflow.rst:674 msgid "" "accepts one required argument (``voltage``) and three optional arguments " "(``state``, ``action``, and ``type``). This function can be called in any " @@ -1389,7 +1401,7 @@ msgstr "" "接受一個必要引數 (``voltage``) 和三個選擇性引數 (``state``,``action``,和 " "``type``)。該函式可用下列任一方式呼叫: ::" -#: ../../tutorial/controlflow.rst:671 +#: ../../tutorial/controlflow.rst:678 msgid "" "parrot(1000) # 1 positional " "argument\n" @@ -1409,11 +1421,11 @@ msgstr "" "parrot('a thousand', state='pushing up the daisies') # 1 個位置引數、1 個關" "鍵字引數\n" -#: ../../tutorial/controlflow.rst:678 +#: ../../tutorial/controlflow.rst:685 msgid "but all the following calls would be invalid::" msgstr "但以下呼叫方式都無效: ::" -#: ../../tutorial/controlflow.rst:680 +#: ../../tutorial/controlflow.rst:687 msgid "" "parrot() # required argument missing\n" "parrot(voltage=5.0, 'dead') # non-keyword argument after a keyword " @@ -1426,7 +1438,7 @@ msgstr "" "parrot(110, voltage=220) # 同一個引數有重複值\n" "parrot(actor='John Cleese') # 未知的關鍵字引數" -#: ../../tutorial/controlflow.rst:685 +#: ../../tutorial/controlflow.rst:692 msgid "" "In a function call, keyword arguments must follow positional arguments. All " "the keyword arguments passed must match one of the arguments accepted by the " @@ -1442,7 +1454,7 @@ msgstr "" "則也包括必要引數,(\\ ``parrot(voltage=1000)`` 也有效)。一個引數不可多次被" "賦值,下面就是一個因此限制而無效的例子: ::" -#: ../../tutorial/controlflow.rst:693 +#: ../../tutorial/controlflow.rst:700 msgid "" ">>> def function(a):\n" "... pass\n" @@ -1460,7 +1472,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: function() got multiple values for argument 'a'" -#: ../../tutorial/controlflow.rst:701 +#: ../../tutorial/controlflow.rst:708 msgid "" "When a final formal parameter of the form ``**name`` is present, it receives " "a dictionary (see :ref:`typesmapping`) containing all keyword arguments " @@ -1470,13 +1482,13 @@ msgid "" "positional arguments beyond the formal parameter list. (``*name`` must " "occur before ``**name``.) For example, if we define a function like this::" msgstr "" -"當最後一個參數為 ``**name`` 形式時,它接收一個 dictionary(字典,詳" -"見 :ref:`typesmapping`\\ ),該字典包含所有可對應形式參數以外的關鍵字引數。" +"當最後一個參數為 ``**name`` 形式時,它接收一個 dictionary(字典,詳見 :ref:" +"`typesmapping`\\ ),該字典包含所有可對應形式參數以外的關鍵字引數。" "``**name`` 可以與 ``*name`` 參數(下一小節介紹)組合使用,``*name`` 接收一" "個 :ref:`tuple `,該 tuple 包含一般參數以外的位置引數(\\ " "``*name`` 必須出現在 ``**name`` 前面)。例如,若我們定義這樣的函式: ::" -#: ../../tutorial/controlflow.rst:709 +#: ../../tutorial/controlflow.rst:716 msgid "" "def cheeseshop(kind, *arguments, **keywords):\n" " print(\"-- Do you have any\", kind, \"?\")\n" @@ -1496,11 +1508,11 @@ msgstr "" " for kw in keywords:\n" " print(kw, \":\", keywords[kw])" -#: ../../tutorial/controlflow.rst:718 +#: ../../tutorial/controlflow.rst:725 msgid "It could be called like this::" msgstr "它可以被如此呼叫: ::" -#: ../../tutorial/controlflow.rst:720 +#: ../../tutorial/controlflow.rst:727 msgid "" "cheeseshop(\"Limburger\", \"It's very runny, sir.\",\n" " \"It's really very, VERY runny, sir.\",\n" @@ -1514,11 +1526,11 @@ msgstr "" " client=\"John Cleese\",\n" " sketch=\"Cheese Shop Sketch\")" -#: ../../tutorial/controlflow.rst:726 +#: ../../tutorial/controlflow.rst:733 msgid "and of course it would print:" msgstr "輸出結果如下: ::" -#: ../../tutorial/controlflow.rst:728 +#: ../../tutorial/controlflow.rst:735 msgid "" "-- Do you have any Limburger ?\n" "-- I'm sorry, we're all out of Limburger\n" @@ -1538,17 +1550,17 @@ msgstr "" "client : John Cleese\n" "sketch : Cheese Shop Sketch" -#: ../../tutorial/controlflow.rst:739 +#: ../../tutorial/controlflow.rst:746 msgid "" "Note that the order in which the keyword arguments are printed is guaranteed " "to match the order in which they were provided in the function call." msgstr "注意,關鍵字引數的輸出順序與呼叫函式時被提供的順序必定一致。" -#: ../../tutorial/controlflow.rst:743 +#: ../../tutorial/controlflow.rst:750 msgid "Special parameters" msgstr "特殊參數" -#: ../../tutorial/controlflow.rst:745 +#: ../../tutorial/controlflow.rst:752 msgid "" "By default, arguments may be passed to a Python function either by position " "or explicitly by keyword. For readability and performance, it makes sense to " @@ -1560,11 +1572,11 @@ msgstr "" "及效能,限制引數的傳遞方式是合理的,如此,開發者只需查看函式定義,即可確定各" "項目是按位置,按位置或關鍵字,還是按關鍵字傳遞。" -#: ../../tutorial/controlflow.rst:751 +#: ../../tutorial/controlflow.rst:758 msgid "A function definition may look like:" msgstr "函式定義可能如以下樣式:" -#: ../../tutorial/controlflow.rst:753 +#: ../../tutorial/controlflow.rst:760 msgid "" "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):\n" " ----------- ---------- ----------\n" @@ -1580,7 +1592,7 @@ msgstr "" " | - Keyword only\n" " -- Positional only" -#: ../../tutorial/controlflow.rst:762 +#: ../../tutorial/controlflow.rst:769 msgid "" "where ``/`` and ``*`` are optional. If used, these symbols indicate the kind " "of parameter by how the arguments may be passed to the function: positional-" @@ -1591,22 +1603,22 @@ msgstr "" "類:僅限位置、位置或關鍵字、僅限關鍵字。關鍵字參數也稱為附名參數 (named " "parameters)。" -#: ../../tutorial/controlflow.rst:769 +#: ../../tutorial/controlflow.rst:776 msgid "Positional-or-Keyword Arguments" msgstr "位置或關鍵字引數 (Positional-or-Keyword Arguments)" -#: ../../tutorial/controlflow.rst:771 +#: ../../tutorial/controlflow.rst:778 msgid "" "If ``/`` and ``*`` are not present in the function definition, arguments may " "be passed to a function by position or by keyword." msgstr "" "若函式定義中未使用 ``/`` 和 ``*`` 時,引數可以按位置或關鍵字傳遞給函式。" -#: ../../tutorial/controlflow.rst:776 +#: ../../tutorial/controlflow.rst:783 msgid "Positional-Only Parameters" msgstr "僅限位置參數 (Positional-Only Parameters)" -#: ../../tutorial/controlflow.rst:778 +#: ../../tutorial/controlflow.rst:785 msgid "" "Looking at this in a bit more detail, it is possible to mark certain " "parameters as *positional-only*. If *positional-only*, the parameters' order " @@ -1621,17 +1633,17 @@ msgstr "" "``\\ (斜線)之前。``/`` 用於在邏輯上分開僅限位置參數與其餘參數。如果函式定義" "中沒有 ``/``,則表示沒有任何僅限位置參數。" -#: ../../tutorial/controlflow.rst:786 +#: ../../tutorial/controlflow.rst:793 msgid "" "Parameters following the ``/`` may be *positional-or-keyword* or *keyword-" "only*." msgstr "``/`` 後面的參數可以是\\ *位置或關鍵字*\\ 或\\ *僅限關鍵字*\\ 參數。" -#: ../../tutorial/controlflow.rst:790 +#: ../../tutorial/controlflow.rst:797 msgid "Keyword-Only Arguments" msgstr "僅限關鍵字引數 (Keyword-Only Arguments)" -#: ../../tutorial/controlflow.rst:792 +#: ../../tutorial/controlflow.rst:799 msgid "" "To mark parameters as *keyword-only*, indicating the parameters must be " "passed by keyword argument, place an ``*`` in the arguments list just before " @@ -1640,17 +1652,17 @@ msgstr "" "要把參數標記為\\ *僅限關鍵字*,表明參數必須以關鍵字引數傳遞,必須在引數列表中" "第一個\\ *僅限關鍵字*\\ 參數前放上 ``*``。" -#: ../../tutorial/controlflow.rst:798 +#: ../../tutorial/controlflow.rst:805 msgid "Function Examples" msgstr "函式範例" -#: ../../tutorial/controlflow.rst:800 +#: ../../tutorial/controlflow.rst:807 msgid "" "Consider the following example function definitions paying close attention " "to the markers ``/`` and ``*``::" msgstr "請看以下的函式定義範例,注意 ``/`` 和 ``*`` 記號: ::" -#: ../../tutorial/controlflow.rst:803 +#: ../../tutorial/controlflow.rst:810 msgid "" ">>> def standard_arg(arg):\n" "... print(arg)\n" @@ -1676,7 +1688,7 @@ msgstr "" ">>> def combined_example(pos_only, /, standard, *, kwd_only):\n" "... print(pos_only, standard, kwd_only)" -#: ../../tutorial/controlflow.rst:816 +#: ../../tutorial/controlflow.rst:823 msgid "" "The first function definition, ``standard_arg``, the most familiar form, " "places no restrictions on the calling convention and arguments may be passed " @@ -1685,7 +1697,7 @@ msgstr "" "第一個函式定義 ``standard_arg`` 是我們最熟悉的形式,對呼叫方式沒有任何限制," "可以按位置或關鍵字傳遞引數: ::" -#: ../../tutorial/controlflow.rst:820 +#: ../../tutorial/controlflow.rst:827 msgid "" ">>> standard_arg(2)\n" "2\n" @@ -1699,14 +1711,14 @@ msgstr "" ">>> standard_arg(arg=2)\n" "2" -#: ../../tutorial/controlflow.rst:826 +#: ../../tutorial/controlflow.rst:833 msgid "" "The second function ``pos_only_arg`` is restricted to only use positional " "parameters as there is a ``/`` in the function definition::" msgstr "" "第二個函式 ``pos_only_arg`` 的函式定義中有 ``/``,因此僅限使用位置參數: ::" -#: ../../tutorial/controlflow.rst:829 +#: ../../tutorial/controlflow.rst:836 msgid "" ">>> pos_only_arg(1)\n" "1\n" @@ -1726,14 +1738,14 @@ msgstr "" "TypeError: pos_only_arg() got some positional-only arguments passed as " "keyword arguments: 'arg'" -#: ../../tutorial/controlflow.rst:837 +#: ../../tutorial/controlflow.rst:844 msgid "" "The third function ``kwd_only_arg`` only allows keyword arguments as " "indicated by a ``*`` in the function definition::" msgstr "" "第三個函式 ``kwd_only_arg`` 的函式定義透過 ``*`` 表明僅限關鍵字引數: ::" -#: ../../tutorial/controlflow.rst:840 +#: ../../tutorial/controlflow.rst:847 msgid "" ">>> kwd_only_arg(3)\n" "Traceback (most recent call last):\n" @@ -1751,13 +1763,13 @@ msgstr "" ">>> kwd_only_arg(arg=3)\n" "3" -#: ../../tutorial/controlflow.rst:848 +#: ../../tutorial/controlflow.rst:855 msgid "" "And the last uses all three calling conventions in the same function " "definition::" msgstr "最後一個函式在同一個函式定義中,使用了全部三種呼叫方式: ::" -#: ../../tutorial/controlflow.rst:851 +#: ../../tutorial/controlflow.rst:858 msgid "" ">>> combined_example(1, 2, 3)\n" "Traceback (most recent call last):\n" @@ -1793,7 +1805,7 @@ msgstr "" "TypeError: combined_example() got some positional-only arguments passed as " "keyword arguments: 'pos_only'" -#: ../../tutorial/controlflow.rst:868 +#: ../../tutorial/controlflow.rst:875 msgid "" "Finally, consider this function definition which has a potential collision " "between the positional argument ``name`` and ``**kwds`` which has ``name`` " @@ -1802,7 +1814,7 @@ msgstr "" "最後,請看這個函式定義,如果 ``**kwds`` 內有 ``name`` 這個鍵,可能與位置引數 " "``name`` 產生潛在衝突: ::" -#: ../../tutorial/controlflow.rst:870 +#: ../../tutorial/controlflow.rst:877 msgid "" "def foo(name, **kwds):\n" " return 'name' in kwds" @@ -1810,7 +1822,7 @@ msgstr "" "def foo(name, **kwds):\n" " return 'name' in kwds" -#: ../../tutorial/controlflow.rst:873 +#: ../../tutorial/controlflow.rst:880 msgid "" "There is no possible call that will make it return ``True`` as the keyword " "``'name'`` will always bind to the first parameter. For example::" @@ -1818,7 +1830,7 @@ msgstr "" "呼叫該函式不可能回傳 ``True``,因為關鍵字 ``'name'`` 永遠是連結在第一個參數。" "例如: ::" -#: ../../tutorial/controlflow.rst:876 +#: ../../tutorial/controlflow.rst:883 msgid "" ">>> foo(1, **{'name': 2})\n" "Traceback (most recent call last):\n" @@ -1832,7 +1844,7 @@ msgstr "" "TypeError: foo() got multiple values for argument 'name'\n" ">>>" -#: ../../tutorial/controlflow.rst:882 +#: ../../tutorial/controlflow.rst:889 msgid "" "But using ``/`` (positional only arguments), it is possible since it allows " "``name`` as a positional argument and ``'name'`` as a key in the keyword " @@ -1841,7 +1853,7 @@ msgstr "" "使用 ``/``\\ (僅限位置引數)後,就可以了。函式定義會允許 ``name`` 當作位置引" "數,而 ``'name'`` 也可以當作關鍵字引數中的鍵: ::" -#: ../../tutorial/controlflow.rst:884 +#: ../../tutorial/controlflow.rst:891 msgid "" ">>> def foo(name, /, **kwds):\n" "... return 'name' in kwds\n" @@ -1855,31 +1867,31 @@ msgstr "" ">>> foo(1, **{'name': 2})\n" "True" -#: ../../tutorial/controlflow.rst:890 +#: ../../tutorial/controlflow.rst:897 msgid "" "In other words, the names of positional-only parameters can be used in " "``**kwds`` without ambiguity." msgstr "換句話說,僅限位置參數的名稱可以在 ``**kwds`` 中使用,而不產生歧義。" -#: ../../tutorial/controlflow.rst:895 +#: ../../tutorial/controlflow.rst:902 msgid "Recap" msgstr "回顧" -#: ../../tutorial/controlflow.rst:897 +#: ../../tutorial/controlflow.rst:904 msgid "" "The use case will determine which parameters to use in the function " "definition::" msgstr "此用例決定哪些參數可以用於函式定義: ::" -#: ../../tutorial/controlflow.rst:899 +#: ../../tutorial/controlflow.rst:906 msgid "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" msgstr "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" -#: ../../tutorial/controlflow.rst:901 +#: ../../tutorial/controlflow.rst:908 msgid "As guidance:" msgstr "說明:" -#: ../../tutorial/controlflow.rst:903 +#: ../../tutorial/controlflow.rst:910 msgid "" "Use positional-only if you want the name of the parameters to not be " "available to the user. This is useful when parameter names have no real " @@ -1891,7 +1903,7 @@ msgstr "" "想控制引數在函式呼叫的排列順序,或同時使用位置參數和任意關鍵字時,這種方式很" "有用。" -#: ../../tutorial/controlflow.rst:908 +#: ../../tutorial/controlflow.rst:915 msgid "" "Use keyword-only when names have meaning and the function definition is more " "understandable by being explicit with names or you want to prevent users " @@ -1900,7 +1912,7 @@ msgstr "" "當參數名稱有意義,且明確的名稱可讓函式定義更易理解,或是你不希望使用者依賴引" "數被傳遞時的位置時,請使用僅限關鍵字。" -#: ../../tutorial/controlflow.rst:911 +#: ../../tutorial/controlflow.rst:918 msgid "" "For an API, use positional-only to prevent breaking API changes if the " "parameter's name is modified in the future." @@ -1908,11 +1920,11 @@ msgstr "" "對於應用程式介面 (API),使用僅限位置,以防止未來參數名稱被修改時造成 API 的中" "斷性變更。" -#: ../../tutorial/controlflow.rst:917 +#: ../../tutorial/controlflow.rst:924 msgid "Arbitrary Argument Lists" msgstr "任意引數列表 (Arbitrary Argument Lists)" -#: ../../tutorial/controlflow.rst:922 +#: ../../tutorial/controlflow.rst:929 msgid "" "Finally, the least frequently used option is to specify that a function can " "be called with an arbitrary number of arguments. These arguments will be " @@ -1923,7 +1935,7 @@ msgstr "" "數會被包裝進一個 tuple 中(詳見 :ref:`tut-tuples`\\ )。在可變數量的引數之" "前,可能有零個或多個普通引數: ::" -#: ../../tutorial/controlflow.rst:927 +#: ../../tutorial/controlflow.rst:934 msgid "" "def write_multiple_items(file, separator, *args):\n" " file.write(separator.join(args))" @@ -1931,7 +1943,7 @@ msgstr "" "def write_multiple_items(file, separator, *args):\n" " file.write(separator.join(args))" -#: ../../tutorial/controlflow.rst:931 +#: ../../tutorial/controlflow.rst:938 msgid "" "Normally, these *variadic* arguments will be last in the list of formal " "parameters, because they scoop up all remaining input arguments that are " @@ -1943,7 +1955,7 @@ msgstr "" "以把所有傳遞給函式的剩餘輸入引數都撈起來。出現在 ``*args`` 參數後面的任何參數" "必須是「僅限關鍵字」引數,意即它們只能作為關鍵字引數,而不能用作位置引數。 ::" -#: ../../tutorial/controlflow.rst:937 +#: ../../tutorial/controlflow.rst:944 msgid "" ">>> def concat(*args, sep=\"/\"):\n" "... return sep.join(args)\n" @@ -1961,11 +1973,11 @@ msgstr "" ">>> concat(\"earth\", \"mars\", \"venus\", sep=\".\")\n" "'earth.mars.venus'" -#: ../../tutorial/controlflow.rst:948 +#: ../../tutorial/controlflow.rst:955 msgid "Unpacking Argument Lists" msgstr "拆解引數列表(Unpacking Argument Lists)" -#: ../../tutorial/controlflow.rst:950 +#: ../../tutorial/controlflow.rst:957 msgid "" "The reverse situation occurs when the arguments are already in a list or " "tuple but need to be unpacked for a function call requiring separate " @@ -1979,7 +1991,7 @@ msgstr "" "的 *start* 和 *stop* 引數。如果這些引數不是分開的,則要在呼叫函式時,用 " "``*`` 運算子把引數們從 list 或 tuple 中拆解出來: ::" -#: ../../tutorial/controlflow.rst:957 +#: ../../tutorial/controlflow.rst:964 msgid "" ">>> list(range(3, 6)) # normal call with separate arguments\n" "[3, 4, 5]\n" @@ -1994,13 +2006,13 @@ msgstr "" ">>> list(range(*args)) # 以從串列解包而得的引數呼叫\n" "[3, 4, 5]" -#: ../../tutorial/controlflow.rst:966 +#: ../../tutorial/controlflow.rst:973 msgid "" "In the same fashion, dictionaries can deliver keyword arguments with the " "``**``\\ -operator::" msgstr "同樣地,dictionary(字典)可以用 ``**`` 運算子傳遞關鍵字引數: ::" -#: ../../tutorial/controlflow.rst:969 +#: ../../tutorial/controlflow.rst:976 msgid "" ">>> def parrot(voltage, state='a stiff', action='voom'):\n" "... print(\"-- This parrot wouldn't\", action, end=' ')\n" @@ -2024,11 +2036,11 @@ msgstr "" "-- This parrot wouldn't VOOM if you put four million volts through it. E's " "bleedin' demised !" -#: ../../tutorial/controlflow.rst:982 +#: ../../tutorial/controlflow.rst:989 msgid "Lambda Expressions" msgstr "Lambda 運算式" -#: ../../tutorial/controlflow.rst:984 +#: ../../tutorial/controlflow.rst:991 msgid "" "Small anonymous functions can be created with the :keyword:`lambda` keyword. " "This function returns the sum of its two arguments: ``lambda a, b: a+b``. " @@ -2043,7 +2055,7 @@ msgstr "" "能是單一運算式。在語義上,它就是一個普通函式定義的語法糖 (syntactic sugar)。" "與巢狀函式定義一樣,lambda 函式可以從包含它的作用域中引用變數: ::" -#: ../../tutorial/controlflow.rst:992 +#: ../../tutorial/controlflow.rst:999 msgid "" ">>> def make_incrementor(n):\n" "... return lambda x: x + n\n" @@ -2063,18 +2075,17 @@ msgstr "" ">>> f(1)\n" "43" -#: ../../tutorial/controlflow.rst:1001 +#: ../../tutorial/controlflow.rst:1008 msgid "" "The above example uses a lambda expression to return a function. Another " -"use is to pass a small function as an argument. For " -"instance, :meth:`list.sort` takes a sorting key function *key* which can be " -"a lambda function::" +"use is to pass a small function as an argument. For instance, :meth:`list." +"sort` takes a sorting key function *key* which can be a lambda function::" msgstr "" "上面的例子用 lambda 運算式回傳了一個函式。另外的用法是傳遞一個小函式當作引" "數。舉例來說,:meth:`list.sort` 接受一個鍵排序函式 *key*,這個函式可以是 " "lambda 函式: ::" -#: ../../tutorial/controlflow.rst:1005 +#: ../../tutorial/controlflow.rst:1012 msgid "" ">>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]\n" ">>> pairs.sort(key=lambda pair: pair[1])\n" @@ -2086,17 +2097,17 @@ msgstr "" ">>> pairs\n" "[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]" -#: ../../tutorial/controlflow.rst:1014 +#: ../../tutorial/controlflow.rst:1021 msgid "Documentation Strings" msgstr "說明文件字串 (Documentation Strings)" -#: ../../tutorial/controlflow.rst:1021 +#: ../../tutorial/controlflow.rst:1028 msgid "" "Here are some conventions about the content and formatting of documentation " "strings." msgstr "以下是關於說明文件字串內容和格式的慣例。" -#: ../../tutorial/controlflow.rst:1024 +#: ../../tutorial/controlflow.rst:1031 msgid "" "The first line should always be a short, concise summary of the object's " "purpose. For brevity, it should not explicitly state the object's name or " @@ -2108,7 +2119,7 @@ msgstr "" "的名稱或型別,因為有其他方法可以達到相同目的(除非該名稱剛好是一個描述函式運" "算的動詞)。這一行應以大寫字母開頭,以句號結尾。" -#: ../../tutorial/controlflow.rst:1030 +#: ../../tutorial/controlflow.rst:1037 msgid "" "If there are more lines in the documentation string, the second line should " "be blank, visually separating the summary from the rest of the description. " @@ -2118,7 +2129,7 @@ msgstr "" "文件字串為多行時,第二行應為空白行,在視覺上將摘要與其餘描述分開。後面幾行可" "包含一或多個段落,描述此物件的呼叫慣例、副作用等。" -#: ../../tutorial/controlflow.rst:1035 +#: ../../tutorial/controlflow.rst:1042 msgid "" "The Python parser does not strip indentation from multi-line string literals " "in Python, so tools that process documentation have to strip indentation if " @@ -2140,11 +2151,11 @@ msgstr "" "出現了,這些行的全部前導空白字元都應被去除。展開 tab 鍵後(通常為八個空格)," "應測試空白字元量是否等價。" -#: ../../tutorial/controlflow.rst:1047 +#: ../../tutorial/controlflow.rst:1054 msgid "Here is an example of a multi-line docstring::" msgstr "下面是多行說明字串的一個範例: ::" -#: ../../tutorial/controlflow.rst:1049 +#: ../../tutorial/controlflow.rst:1056 msgid "" ">>> def my_function():\n" "... \"\"\"Do nothing, but document it.\n" @@ -2170,11 +2181,11 @@ msgstr "" "\n" "No, really, it doesn't do anything." -#: ../../tutorial/controlflow.rst:1065 +#: ../../tutorial/controlflow.rst:1072 msgid "Function Annotations" msgstr "函式註釋 (Function Annotations)" -#: ../../tutorial/controlflow.rst:1073 +#: ../../tutorial/controlflow.rst:1080 msgid "" ":ref:`Function annotations ` are completely optional metadata " "information about the types used by user-defined functions (see :pep:`3107` " @@ -2183,26 +2194,25 @@ msgstr "" ":ref:`函式註釋 `\\ 是選擇性的元資料(metadata)資訊,描述使用者定義" "函式所使用的型別(更多資訊詳見 :pep:`3107` 和 :pep:`484`\\ )。" -#: ../../tutorial/controlflow.rst:1077 +#: ../../tutorial/controlflow.rst:1084 msgid "" -":term:`Annotations ` are stored in " -"the :attr:`~object.__annotations__` attribute of the function as a " -"dictionary and have no effect on any other part of the function. Parameter " -"annotations are defined by a colon after the parameter name, followed by an " -"expression evaluating to the value of the annotation. Return annotations " -"are defined by a literal ``->``, followed by an expression, between the " -"parameter list and the colon denoting the end of the :keyword:`def` " -"statement. The following example has a required argument, an optional " -"argument, and the return value annotated::" +":term:`Annotations ` are stored in the :attr:`~object." +"__annotations__` attribute of the function as a dictionary and have no " +"effect on any other part of the function. Parameter annotations are defined " +"by a colon after the parameter name, followed by an expression evaluating to " +"the value of the annotation. Return annotations are defined by a literal ``-" +">``, followed by an expression, between the parameter list and the colon " +"denoting the end of the :keyword:`def` statement. The following example has " +"a required argument, an optional argument, and the return value annotated::" msgstr "" ":term:`註釋 `\\ 以 dictionary(字典)的形式存放在函式" -"的 :attr:`~object.__annotations__` 屬性中,且不會影響函式的任何其他部分。參數註釋的" -"定義方式是在參數名稱後加一個冒號,冒號後面跟著一個對註釋求值的運算式。回傳註" -"釋的定義方式是在參數列表和 :keyword:`def` 陳述式結尾的冒號中間,用一個 ``-" -">`` 文字接著一個運算式。以下範例註釋了一個必要引數、一個選擇性引數,以及回傳" -"值: ::" +"的 :attr:`~object.__annotations__` 屬性中,且不會影響函式的任何其他部分。參數" +"註釋的定義方式是在參數名稱後加一個冒號,冒號後面跟著一個對註釋求值的運算式。" +"回傳註釋的定義方式是在參數列表和 :keyword:`def` 陳述式結尾的冒號中間,用一個 " +"``->`` 文字接著一個運算式。以下範例註釋了一個必要引數、一個選擇性引數,以及回" +"傳值: ::" -#: ../../tutorial/controlflow.rst:1086 +#: ../../tutorial/controlflow.rst:1093 msgid "" ">>> def f(ham: str, eggs: str = 'eggs') -> str:\n" "... print(\"Annotations:\", f.__annotations__)\n" @@ -2226,11 +2236,11 @@ msgstr "" "Arguments: spam eggs\n" "'spam and eggs'" -#: ../../tutorial/controlflow.rst:1099 +#: ../../tutorial/controlflow.rst:1106 msgid "Intermezzo: Coding Style" msgstr "間奏曲:程式碼風格 (Coding Style)" -#: ../../tutorial/controlflow.rst:1104 +#: ../../tutorial/controlflow.rst:1111 msgid "" "Now that you are about to write longer, more complex pieces of Python, it is " "a good time to talk about *coding style*. Most languages can be written (or " @@ -2243,7 +2253,7 @@ msgstr "" "式比其他的更具可讀性。能讓其他人輕鬆閱讀你的程式碼永遠是一個好主意,而使用優" "良的編碼樣式對此有極大的幫助。" -#: ../../tutorial/controlflow.rst:1110 +#: ../../tutorial/controlflow.rst:1117 msgid "" "For Python, :pep:`8` has emerged as the style guide that most projects " "adhere to; it promotes a very readable and eye-pleasing coding style. Every " @@ -2253,11 +2263,11 @@ msgstr "" "對於 Python,大多數的專案都遵循 :pep:`8` 的樣式指南;它推行的編碼樣式相當可讀" "且賞心悅目。每個 Python 開發者都應該花點時間研讀;這裡是該指南的核心重點:" -#: ../../tutorial/controlflow.rst:1115 +#: ../../tutorial/controlflow.rst:1122 msgid "Use 4-space indentation, and no tabs." msgstr "用 4 個空格縮排,不要用 tab 鍵。" -#: ../../tutorial/controlflow.rst:1117 +#: ../../tutorial/controlflow.rst:1124 msgid "" "4 spaces are a good compromise between small indentation (allows greater " "nesting depth) and large indentation (easier to read). Tabs introduce " @@ -2266,11 +2276,11 @@ msgstr "" "4 個空格是小縮排(容許更大的巢套深度)和大縮排(較易閱讀)之間的折衷方案。" "Tab 鍵會造成混亂,最好別用。" -#: ../../tutorial/controlflow.rst:1121 +#: ../../tutorial/controlflow.rst:1128 msgid "Wrap lines so that they don't exceed 79 characters." msgstr "換行,使一行不超過 79 個字元。" -#: ../../tutorial/controlflow.rst:1123 +#: ../../tutorial/controlflow.rst:1130 msgid "" "This helps users with small displays and makes it possible to have several " "code files side-by-side on larger displays." @@ -2278,21 +2288,21 @@ msgstr "" "換行能讓使用小顯示器的使用者方便閱讀,也可以在較大顯示器上並排陳列多個程式碼" "檔案。" -#: ../../tutorial/controlflow.rst:1126 +#: ../../tutorial/controlflow.rst:1133 msgid "" "Use blank lines to separate functions and classes, and larger blocks of code " "inside functions." msgstr "用空行分隔函式和 class(類別),及函式內較大塊的程式碼。" -#: ../../tutorial/controlflow.rst:1129 +#: ../../tutorial/controlflow.rst:1136 msgid "When possible, put comments on a line of their own." msgstr "如果可以,把註解放在單獨一行。" -#: ../../tutorial/controlflow.rst:1131 +#: ../../tutorial/controlflow.rst:1138 msgid "Use docstrings." msgstr "使用說明字串。" -#: ../../tutorial/controlflow.rst:1133 +#: ../../tutorial/controlflow.rst:1140 msgid "" "Use spaces around operators and after commas, but not directly inside " "bracketing constructs: ``a = f(1, 2) + g(3, 4)``." @@ -2300,7 +2310,7 @@ msgstr "" "運算子前後、逗號後要加空格,但不要直接放在括號內側:``a = f(1, 2) + g(3, " "4)``。" -#: ../../tutorial/controlflow.rst:1136 +#: ../../tutorial/controlflow.rst:1143 msgid "" "Name your classes and functions consistently; the convention is to use " "``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for " @@ -2312,7 +2322,7 @@ msgstr "" "底線)。永遠用 ``self`` 作為 method 第一個引數的名稱(關於 class 和 method," "詳見 :ref:`tut-firstclasses`\\ )。" -#: ../../tutorial/controlflow.rst:1141 +#: ../../tutorial/controlflow.rst:1148 msgid "" "Don't use fancy encodings if your code is meant to be used in international " "environments. Python's default, UTF-8, or even plain ASCII work best in any " @@ -2321,7 +2331,7 @@ msgstr "" "若程式碼是為了用於國際環境時,不要用花俏的編碼。Python 預設的 UTF-8 或甚至普" "通的 ASCII,就可以勝任各種情況。" -#: ../../tutorial/controlflow.rst:1145 +#: ../../tutorial/controlflow.rst:1152 msgid "" "Likewise, don't use non-ASCII characters in identifiers if there is only the " "slightest chance people speaking a different language will read or maintain " @@ -2330,11 +2340,11 @@ msgstr "" "同樣地,若不同語言使用者閱讀或維護程式碼的可能性微乎其微,就不要在命名時使用" "非 ASCII 字元。" -#: ../../tutorial/controlflow.rst:1151 +#: ../../tutorial/controlflow.rst:1158 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/controlflow.rst:1152 +#: ../../tutorial/controlflow.rst:1159 msgid "" "Actually, *call by object reference* would be a better description, since if " "a mutable object is passed, the caller will see any changes the callee makes " @@ -2352,55 +2362,63 @@ msgstr "statement(陳述式)" msgid "for" msgstr "for" -#: ../../tutorial/controlflow.rst:478 ../../tutorial/controlflow.rst:1016 +#: ../../tutorial/controlflow.rst:254 +msgid "..." +msgstr "" + +#: ../../tutorial/controlflow.rst:254 +msgid "ellipsis literal" +msgstr "" + +#: ../../tutorial/controlflow.rst:485 ../../tutorial/controlflow.rst:1023 msgid "documentation strings" msgstr "ddocumentation strings(說明字串)" -#: ../../tutorial/controlflow.rst:478 ../../tutorial/controlflow.rst:1016 +#: ../../tutorial/controlflow.rst:485 ../../tutorial/controlflow.rst:1023 msgid "docstrings" msgstr "docstrings(說明字串)" -#: ../../tutorial/controlflow.rst:478 ../../tutorial/controlflow.rst:1016 +#: ../../tutorial/controlflow.rst:485 ../../tutorial/controlflow.rst:1023 msgid "strings, documentation" msgstr "strings(字串), documentation(說明文件)" -#: ../../tutorial/controlflow.rst:919 +#: ../../tutorial/controlflow.rst:926 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../tutorial/controlflow.rst:919 ../../tutorial/controlflow.rst:963 +#: ../../tutorial/controlflow.rst:926 ../../tutorial/controlflow.rst:970 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../tutorial/controlflow.rst:963 +#: ../../tutorial/controlflow.rst:970 msgid "**" msgstr "**" -#: ../../tutorial/controlflow.rst:1068 +#: ../../tutorial/controlflow.rst:1075 msgid "function" msgstr "function(函式)" -#: ../../tutorial/controlflow.rst:1068 +#: ../../tutorial/controlflow.rst:1075 msgid "annotations" msgstr "annotations(註釋)" -#: ../../tutorial/controlflow.rst:1068 +#: ../../tutorial/controlflow.rst:1075 msgid "->" msgstr "->" -#: ../../tutorial/controlflow.rst:1068 +#: ../../tutorial/controlflow.rst:1075 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../tutorial/controlflow.rst:1068 +#: ../../tutorial/controlflow.rst:1075 msgid ": (colon)" msgstr ": (冒號)" -#: ../../tutorial/controlflow.rst:1102 +#: ../../tutorial/controlflow.rst:1109 msgid "coding" msgstr "coding(程式編寫)" -#: ../../tutorial/controlflow.rst:1102 +#: ../../tutorial/controlflow.rst:1109 msgid "style" msgstr "style(風格)" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 94467dfda20..ef485f02512 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "Adam Turner" #: ../../whatsnew/3.12.rst:48 msgid "" "This article explains the new features in Python 3.12, compared to 3.11. " -"Python 3.12 was released on October 2, 2023. For full details, see " -"the :ref:`changelog `." +"Python 3.12 was released on October 2, 2023. For full details, see the :ref:" +"`changelog `." msgstr "" "本文介紹了 Python 3.12 與 3.11 相比多了哪些新功能。 Python 3.12 於 2023 年 " "10 月 2 日發布。完整詳情請見 :ref:`changelog `。" @@ -55,18 +55,18 @@ msgid "" "improvements, and several modules have better performance." msgstr "" "Python 3.12 是 Python 程式語言的穩定版本,包含了語言和標準函式庫的綜合變更。" -"標準函式庫的變更主要集中在清理棄用的 API、可用性和正確性。值得注意的" -"是,:mod:`!distutils` 套件已從標準函式庫中移除。:mod:`os` 和 :mod:`pathlib` " -"中的檔案系統支援進行了許多改進,並且有數個模組得到更好的效能。" +"標準函式庫的變更主要集中在清理棄用的 API、可用性和正確性。值得注意的是,:mod:" +"`!distutils` 套件已從標準函式庫中移除。:mod:`os` 和 :mod:`pathlib` 中的檔案系" +"統支援進行了許多改進,並且有數個模組得到更好的效能。" #: ../../whatsnew/3.12.rst:69 msgid "" "The language changes focus on usability, as :term:`f-strings ` " "have had many limitations removed and 'Did you mean ...' suggestions " "continue to improve. The new :ref:`type parameter syntax ` and :keyword:`type` statement improve ergonomics for " -"using :term:`generic types ` and :term:`type aliases ` with static type checkers." +"pep695>` and :keyword:`type` statement improve ergonomics for using :term:" +"`generic types ` and :term:`type aliases ` with " +"static type checkers." msgstr "" "語言變更主要集中在可用性,因為 :term:`f-字串 `\\ 已經移除了許多限" "制,並且持續改進 'Did you mean ...' 建議。新的\\ :ref:`型別參數語法 " @@ -95,8 +95,8 @@ msgstr "新增語法特性:" #: ../../whatsnew/3.12.rst:92 msgid "" -":ref:`PEP 695 `, type parameter syntax and " -"the :keyword:`type` statement" +":ref:`PEP 695 `, type parameter syntax and the :keyword:" +"`type` statement" msgstr "" ":ref:`PEP 695 `,型別參數語法和 :keyword:`type` 陳述式" @@ -129,8 +129,8 @@ msgstr ":ref:`PEP 669 `,低影響監控" #: ../../whatsnew/3.12.rst:103 msgid "" -"`Improved 'Did you mean ...' suggestions `_ " -"for :exc:`NameError`, :exc:`ImportError`, and :exc:`SyntaxError` exceptions" +"`Improved 'Did you mean ...' suggestions `_ for :" +"exc:`NameError`, :exc:`ImportError`, and :exc:`SyntaxError` exceptions" msgstr "" #: ../../whatsnew/3.12.rst:106 @@ -157,15 +157,15 @@ msgstr ":mod:`os` 模組在 Windows 支援上有了數項改進" #: ../../whatsnew/3.12.rst:115 msgid "" -"A :ref:`command-line interface ` has been added to " -"the :mod:`sqlite3` module" +"A :ref:`command-line interface ` has been added to the :mod:" +"`sqlite3` module" msgstr "" "一個\\ :ref:`命令列介面 `\\ 已被加入 :mod:`sqlite3` 模組中" #: ../../whatsnew/3.12.rst:117 msgid "" -":func:`isinstance` checks against :func:`runtime-checkable protocols " -"` enjoy a speed up of between two and 20 times" +":func:`isinstance` checks against :func:`runtime-checkable protocols ` enjoy a speed up of between two and 20 times" msgstr "" #: ../../whatsnew/3.12.rst:119 @@ -236,8 +236,8 @@ msgid "" ":ref:`PEP 692 `, using :class:`~typing.TypedDict` to " "annotate :term:`**kwargs `" msgstr "" -":ref:`PEP 692 `、使用 :class:`~typing.TypedDict` 來標" -"註 :term:`**kwargs `" +":ref:`PEP 692 `、使用 :class:`~typing.TypedDict` 來標註 :" +"term:`**kwargs `" #: ../../whatsnew/3.12.rst:149 msgid ":ref:`PEP 698 `, :func:`typing.override` decorator" @@ -277,9 +277,9 @@ msgid "" "removed, along with several :class:`unittest.TestCase` `method aliases " "`_." msgstr "" -":mod:`!asynchat`、:mod:`!asyncore` 和 :mod:`!imp` 模組以及幾" -"個 :class:`unittest.TestCase` 的\\ `方法別名 `_\\ 已被刪除。" +":mod:`!asynchat`、:mod:`!asyncore` 和 :mod:`!imp` 模組以及幾個 :class:" +"`unittest.TestCase` 的\\ `方法別名 `_\\ " +"已被刪除。" #: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1842 msgid "New Features" @@ -298,8 +298,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:187 msgid "" -":pep:`695` introduces a new, more compact and explicit way to " -"create :ref:`generic classes ` and :ref:`functions ` and :ref:`functions `::" msgstr "" @@ -346,9 +346,9 @@ msgstr "type Point[T] = tuple[T, T]" #: ../../whatsnew/3.12.rst:210 msgid "" -"The new syntax allows declaring :class:`~typing.TypeVarTuple` " -"and :class:`~typing.ParamSpec` parameters, as well " -"as :class:`~typing.TypeVar` parameters with bounds or constraints::" +"The new syntax allows declaring :class:`~typing.TypeVarTuple` and :class:" +"`~typing.ParamSpec` parameters, as well as :class:`~typing.TypeVar` " +"parameters with bounds or constraints::" msgstr "" #: ../../whatsnew/3.12.rst:214 @@ -400,7 +400,8 @@ msgid "" "(PEP written by Eric Traut. Implementation by Jelle Zijlstra, Eric Traut, " "and others in :gh:`103764`.)" msgstr "" -"(PEP 由 Eric Traut 撰寫。由 Jelle Zijlstra、Eric Traut 和其他人在 :gh:`103764` 中實作。)" +"(PEP 由 Eric Traut 撰寫。由 Jelle Zijlstra、Eric Traut 和其他人在 :gh:" +"`103764` 中實作。)" #: ../../whatsnew/3.12.rst:245 msgid "PEP 701: Syntactic formalization of f-strings" @@ -449,11 +450,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:290 msgid "" "Backslashes and unicode characters: before Python 3.12 f-string expressions " -"couldn't contain any ``\\`` character. This also affected " -"unicode :ref:`escape sequences ` (such as ``\\N{snowman}" -"``) as these contain the ``\\N`` part that previously could not be part of " -"expression components of f-strings. Now, you can define expressions like " -"this:" +"couldn't contain any ``\\`` character. This also affected unicode :ref:" +"`escape sequences ` (such as ``\\N{snowman}``) as these " +"contain the ``\\N`` part that previously could not be part of expression " +"components of f-strings. Now, you can define expressions like this:" msgstr "" #: ../../whatsnew/3.12.rst:303 @@ -593,17 +593,16 @@ msgstr "PEP 688:使緩衝區協定可在 Python 中存取" #: ../../whatsnew/3.12.rst:386 msgid "" ":pep:`688` introduces a way to use the :ref:`buffer protocol " -"` from Python code. Classes that implement " -"the :meth:`~object.__buffer__` method are now usable as buffer types." +"` from Python code. Classes that implement the :meth:`~object." +"__buffer__` method are now usable as buffer types." msgstr "" #: ../../whatsnew/3.12.rst:390 msgid "" "The new :class:`collections.abc.Buffer` ABC provides a standard way to " -"represent buffer objects, for example in type annotations. The " -"new :class:`inspect.BufferFlags` enum represents the flags that can be used " -"to customize buffer creation. (Contributed by Jelle Zijlstra " -"in :gh:`102500`.)" +"represent buffer objects, for example in type annotations. The new :class:" +"`inspect.BufferFlags` enum represents the flags that can be used to " +"customize buffer creation. (Contributed by Jelle Zijlstra in :gh:`102500`.)" msgstr "" #: ../../whatsnew/3.12.rst:399 @@ -682,8 +681,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:459 msgid "" "Improve the :exc:`SyntaxError` error message when the user types ``import x " -"from y`` instead of ``from y import x``. (Contributed by Pablo Galindo " -"in :gh:`98931`.)" +"from y`` instead of ``from y import x``. (Contributed by Pablo Galindo in :" +"gh:`98931`.)" msgstr "" #: ../../whatsnew/3.12.rst:469 @@ -700,8 +699,8 @@ msgstr "型別提示相關的新特性" #: ../../whatsnew/3.12.rst:482 msgid "" -"This section covers major changes affecting :pep:`type hints <484>` and " -"the :mod:`typing` module." +"This section covers major changes affecting :pep:`type hints <484>` and the :" +"mod:`typing` module." msgstr "" "本節涵蓋了影響\\ :pep:`型別提示 <484>`\\ 和 :mod:`typing` 模組的主要變更。" @@ -808,18 +807,17 @@ msgid "" "a :exc:`SyntaxWarning`, instead of :exc:`DeprecationWarning`. For example, " "``re.compile(\"\\d+\\.\\d+\")`` now emits a :exc:`SyntaxWarning` " "(``\"\\d\"`` is an invalid escape sequence, use raw strings for regular " -"expression: ``re.compile(r\"\\d+\\.\\d+\")``). In a future Python " -"version, :exc:`SyntaxError` will eventually be raised, instead " -"of :exc:`SyntaxWarning`. (Contributed by Victor Stinner in :gh:`98401`.)" +"expression: ``re.compile(r\"\\d+\\.\\d+\")``). In a future Python version, :" +"exc:`SyntaxError` will eventually be raised, instead of :exc:" +"`SyntaxWarning`. (Contributed by Victor Stinner in :gh:`98401`.)" msgstr "" #: ../../whatsnew/3.12.rst:557 msgid "" "Octal escapes with value larger than ``0o377`` (ex: ``\"\\477\"``), " -"deprecated in Python 3.11, now produce a :exc:`SyntaxWarning`, instead " -"of :exc:`DeprecationWarning`. In a future Python version they will be " -"eventually a :exc:`SyntaxError`. (Contributed by Victor Stinner " -"in :gh:`98401`.)" +"deprecated in Python 3.11, now produce a :exc:`SyntaxWarning`, instead of :" +"exc:`DeprecationWarning`. In a future Python version they will be eventually " +"a :exc:`SyntaxError`. (Contributed by Victor Stinner in :gh:`98401`.)" msgstr "" #: ../../whatsnew/3.12.rst:563 @@ -842,9 +840,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:574 msgid "" "When a ``try-except*`` construct handles the entire :exc:`ExceptionGroup` " -"and raises one other exception, that exception is no longer wrapped in " -"an :exc:`ExceptionGroup`. Also changed in version 3.11.4. (Contributed by " -"Irit Katriel in :gh:`103590`.)" +"and raises one other exception, that exception is no longer wrapped in an :" +"exc:`ExceptionGroup`. Also changed in version 3.11.4. (Contributed by Irit " +"Katriel in :gh:`103590`.)" msgstr "" #: ../../whatsnew/3.12.rst:579 @@ -853,8 +851,8 @@ msgid "" "Python bytecode evaluation loop instead of object allocations. The GC can " "also run when :c:func:`PyErr_CheckSignals` is called so C extensions that " "need to run for a long time without executing any Python code also have a " -"chance to execute the GC periodically. (Contributed by Pablo Galindo " -"in :gh:`97922`.)" +"chance to execute the GC periodically. (Contributed by Pablo Galindo in :gh:" +"`97922`.)" msgstr "" #: ../../whatsnew/3.12.rst:586 @@ -910,21 +908,19 @@ msgstr "" #: ../../whatsnew/3.12.rst:616 msgid "" "Add :ref:`support for the perf profiler ` through the new " -"environment variable :envvar:`PYTHONPERFSUPPORT` and command-line " -"option :option:`-X perf <-X>`, as well as the " -"new :func:`sys.activate_stack_trampoline`, :func:`sys.deactivate_stack_trampoline`, " -"and :func:`sys.is_stack_trampoline_active` functions. (Design by Pablo " -"Galindo. Contributed by Pablo Galindo and Christian Heimes with " -"contributions from Gregory P. Smith [Google] and Mark Shannon " -"in :gh:`96123`.)" +"environment variable :envvar:`PYTHONPERFSUPPORT` and command-line option :" +"option:`-X perf <-X>`, as well as the new :func:`sys." +"activate_stack_trampoline`, :func:`sys.deactivate_stack_trampoline`, and :" +"func:`sys.is_stack_trampoline_active` functions. (Design by Pablo Galindo. " +"Contributed by Pablo Galindo and Christian Heimes with contributions from " +"Gregory P. Smith [Google] and Mark Shannon in :gh:`96123`.)" msgstr "" "透過新的環境變數 :envvar:`PYTHONPERFSUPPORT` 和命令列選項 :option:`-X perf <-" -"X>` 以及新" -"的 :func:`sys.activate_stack_trampoline`、:func:`sys.deactivate_stack_trampoline` " -"和 :func:`sys.is_stack_trampoline_active` 函式,新增對\\ :ref:`效能分析器的支" -"援 `。(由 Pablo Galindo 設計。由 Pablo Galindo 和 Christian " -"Heimes 貢獻,Gregory P. Smith [Google] 和 Mark Shannon 在 :gh:`96123` 中也有" -"貢獻。)" +"X>` 以及新的 :func:`sys.activate_stack_trampoline`、:func:`sys." +"deactivate_stack_trampoline` 和 :func:`sys.is_stack_trampoline_active` 函式," +"新增對\\ :ref:`效能分析器的支援 `。(由 Pablo Galindo 設計。" +"由 Pablo Galindo 和 Christian Heimes 貢獻,Gregory P. Smith [Google] 和 Mark " +"Shannon 在 :gh:`96123` 中也有貢獻。)" #: ../../whatsnew/3.12.rst:628 msgid "New Modules" @@ -944,8 +940,8 @@ msgstr "array" #: ../../whatsnew/3.12.rst:639 msgid "" -"The :class:`array.array` class now supports subscripting, making it " -"a :term:`generic type`. (Contributed by Jelle Zijlstra in :gh:`98658`.)" +"The :class:`array.array` class now supports subscripting, making it a :term:" +"`generic type`. (Contributed by Jelle Zijlstra in :gh:`98658`.)" msgstr "" #: ../../whatsnew/3.12.rst:643 @@ -962,11 +958,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:650 msgid "" -"Add :func:`asyncio.eager_task_factory` " -"and :func:`asyncio.create_eager_task_factory` functions to allow opting an " -"event loop in to eager task execution, making some use-cases 2x to 5x " -"faster. (Contributed by Jacob Bower & Itamar Oren " -"in :gh:`102853`, :gh:`104140`, and :gh:`104138`)" +"Add :func:`asyncio.eager_task_factory` and :func:`asyncio." +"create_eager_task_factory` functions to allow opting an event loop in to " +"eager task execution, making some use-cases 2x to 5x faster. (Contributed by " +"Jacob Bower & Itamar Oren in :gh:`102853`, :gh:`104140`, and :gh:`104138`)" msgstr "" #: ../../whatsnew/3.12.rst:655 @@ -978,10 +973,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:660 msgid "" -"The event loop now uses the best available child watcher for each platform " -"(:class:`!asyncio.PidfdChildWatcher` if supported and :class:`!" -"asyncio.ThreadedChildWatcher` otherwise), so manually configuring a child " -"watcher is not recommended. (Contributed by Kumar Aditya in :gh:`94597`.)" +"The event loop now uses the best available child watcher for each platform (:" +"class:`!asyncio.PidfdChildWatcher` if supported and :class:`!asyncio." +"ThreadedChildWatcher` otherwise), so manually configuring a child watcher is " +"not recommended. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" #: ../../whatsnew/3.12.rst:666 @@ -998,9 +993,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:673 msgid "" -":func:`asyncio.iscoroutine` now returns ``False`` for generators " -"as :mod:`asyncio` does not support legacy generator-based coroutines. " -"(Contributed by Kumar Aditya in :gh:`102748`.)" +":func:`asyncio.iscoroutine` now returns ``False`` for generators as :mod:" +"`asyncio` does not support legacy generator-based coroutines. (Contributed " +"by Kumar Aditya in :gh:`102748`.)" msgstr "" #: ../../whatsnew/3.12.rst:677 @@ -1016,8 +1011,8 @@ msgstr "calendar" #: ../../whatsnew/3.12.rst:684 msgid "" "Add enums :data:`calendar.Month` and :data:`calendar.Day` defining months of " -"the year and days of the week. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"the year and days of the week. (Contributed by Prince Roshan in :gh:" +"`103636`.)" msgstr "" #: ../../whatsnew/3.12.rst:689 @@ -1027,8 +1022,8 @@ msgstr "csv" #: ../../whatsnew/3.12.rst:691 msgid "" "Add :const:`csv.QUOTE_NOTNULL` and :const:`csv.QUOTE_STRINGS` flags to " -"provide finer grained control of ``None`` and empty strings " -"by :class:`~csv.reader` and :class:`~csv.writer` objects." +"provide finer grained control of ``None`` and empty strings by :class:`~csv." +"reader` and :class:`~csv.writer` objects." msgstr "" #: ../../whatsnew/3.12.rst:696 @@ -1038,10 +1033,10 @@ msgstr "dis" #: ../../whatsnew/3.12.rst:698 msgid "" "Pseudo instruction opcodes (which are used by the compiler but do not appear " -"in executable bytecode) are now exposed in the :mod:`dis` " -"module. :opcode:`HAVE_ARGUMENT` is still relevant to real opcodes, but it is " -"not useful for pseudo instructions. Use the new :data:`dis.hasarg` " -"collection instead. (Contributed by Irit Katriel in :gh:`94216`.)" +"in executable bytecode) are now exposed in the :mod:`dis` module. :opcode:" +"`HAVE_ARGUMENT` is still relevant to real opcodes, but it is not useful for " +"pseudo instructions. Use the new :data:`dis.hasarg` collection instead. " +"(Contributed by Irit Katriel in :gh:`94216`.)" msgstr "" #: ../../whatsnew/3.12.rst:706 @@ -1135,8 +1130,8 @@ msgid "" "Add :func:`math.sumprod` for computing a sum of products. (Contributed by " "Raymond Hettinger in :gh:`100485`.)" msgstr "" -"新增 :func:`math.sumprod` 以計算乘積總和。(由 Raymond Hettinger " -"於 :gh:`100485` 中貢獻。)" +"新增 :func:`math.sumprod` 以計算乘積總和。(由 Raymond Hettinger 於 :gh:" +"`100485` 中貢獻。)" #: ../../whatsnew/3.12.rst:752 msgid "" @@ -1151,16 +1146,16 @@ msgstr "os" #: ../../whatsnew/3.12.rst:759 msgid "" -"Add :const:`os.PIDFD_NONBLOCK` to open a file descriptor for a process " -"with :func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar " -"Aditya in :gh:`93312`.)" +"Add :const:`os.PIDFD_NONBLOCK` to open a file descriptor for a process with :" +"func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar Aditya in :" +"gh:`93312`.)" msgstr "" #: ../../whatsnew/3.12.rst:763 msgid "" ":class:`os.DirEntry` now includes an :meth:`os.DirEntry.is_junction` method " -"to check if the entry is a junction. (Contributed by Charles Machalow " -"in :gh:`99547`.)" +"to check if the entry is a junction. (Contributed by Charles Machalow in :gh:" +"`99547`.)" msgstr "" #: ../../whatsnew/3.12.rst:767 @@ -1179,8 +1174,8 @@ msgid "" "with other platforms). ``st_dev`` may be up to 64 bits and ``st_ino`` up to " "128 bits depending on your file system, and ``st_rdev`` is always set to " "zero rather than incorrect values. Both functions may be significantly " -"faster on newer releases of Windows. (Contributed by Steve Dower " -"in :gh:`99726`.)" +"faster on newer releases of Windows. (Contributed by Steve Dower in :gh:" +"`99726`.)" msgstr "" #: ../../whatsnew/3.12.rst:782 @@ -1209,10 +1204,10 @@ msgstr "pathlib" #: ../../whatsnew/3.12.rst:793 msgid "" -"Add support for subclassing :class:`pathlib.PurePath` " -"and :class:`pathlib.Path`, plus their Posix- and Windows-specific variants. " -"Subclasses may override the :meth:`pathlib.PurePath.with_segments` method to " -"pass information between path instances." +"Add support for subclassing :class:`pathlib.PurePath` and :class:`pathlib." +"Path`, plus their Posix- and Windows-specific variants. Subclasses may " +"override the :meth:`pathlib.PurePath.with_segments` method to pass " +"information between path instances." msgstr "" #: ../../whatsnew/3.12.rst:798 @@ -1226,23 +1221,22 @@ msgstr "" msgid "" "Add *walk_up* optional parameter to :meth:`pathlib.PurePath.relative_to` to " "allow the insertion of ``..`` entries in the result; this behavior is more " -"consistent with :func:`os.path.relpath`. (Contributed by Domenico Ragusa " -"in :gh:`84538`.)" +"consistent with :func:`os.path.relpath`. (Contributed by Domenico Ragusa in :" +"gh:`84538`.)" msgstr "" #: ../../whatsnew/3.12.rst:807 msgid "" -"Add :meth:`pathlib.Path.is_junction` as a proxy " -"to :func:`os.path.isjunction`. (Contributed by Charles Machalow " -"in :gh:`99547`.)" +"Add :meth:`pathlib.Path.is_junction` as a proxy to :func:`os.path." +"isjunction`. (Contributed by Charles Machalow in :gh:`99547`.)" msgstr "" #: ../../whatsnew/3.12.rst:810 msgid "" -"Add *case_sensitive* optional parameter " -"to :meth:`pathlib.Path.glob`, :meth:`pathlib.Path.rglob` " -"and :meth:`pathlib.PurePath.match` for matching the path's case sensitivity, " -"allowing for more precise control over the matching process." +"Add *case_sensitive* optional parameter to :meth:`pathlib.Path.glob`, :meth:" +"`pathlib.Path.rglob` and :meth:`pathlib.PurePath.match` for matching the " +"path's case sensitivity, allowing for more precise control over the matching " +"process." msgstr "" #: ../../whatsnew/3.12.rst:815 @@ -1274,8 +1268,8 @@ msgstr "random" #: ../../whatsnew/3.12.rst:833 msgid "" -"Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger " -"in :gh:`81620`.)" +"Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger in :gh:" +"`81620`.)" msgstr "" "新增 :func:`random.binomialvariate`。(由 Raymond Hettinger 於 :gh:`81620` 中" "貢獻。)" @@ -1339,31 +1333,29 @@ msgid "" "Add a :ref:`command-line interface `. (Contributed by Erlend E. " "Aasland in :gh:`77617`.)" msgstr "" -"新增\\ :ref:`命令列介面 `。(由 Erlend E. Aasland " -"於 :gh:`77617` 中貢獻。)" +"新增\\ :ref:`命令列介面 `。(由 Erlend E. Aasland 於 :gh:" +"`77617` 中貢獻。)" #: ../../whatsnew/3.12.rst:874 msgid "" -"Add the :attr:`sqlite3.Connection.autocommit` attribute " -"to :class:`sqlite3.Connection` and the *autocommit* parameter " -"to :func:`sqlite3.connect` to control :pep:`249`-compliant :ref:`transaction " -"handling `. (Contributed by Erlend " -"E. Aasland in :gh:`83638`.)" +"Add the :attr:`sqlite3.Connection.autocommit` attribute to :class:`sqlite3." +"Connection` and the *autocommit* parameter to :func:`sqlite3.connect` to " +"control :pep:`249`-compliant :ref:`transaction handling `. (Contributed by Erlend E. Aasland in :gh:`83638`.)" msgstr "" #: ../../whatsnew/3.12.rst:881 msgid "" -"Add *entrypoint* keyword-only parameter " -"to :meth:`sqlite3.Connection.load_extension`, for overriding the SQLite " -"extension entry point. (Contributed by Erlend E. Aasland in :gh:`103015`.)" +"Add *entrypoint* keyword-only parameter to :meth:`sqlite3.Connection." +"load_extension`, for overriding the SQLite extension entry point. " +"(Contributed by Erlend E. Aasland in :gh:`103015`.)" msgstr "" #: ../../whatsnew/3.12.rst:886 msgid "" -"Add :meth:`sqlite3.Connection.getconfig` " -"and :meth:`sqlite3.Connection.setconfig` to :class:`sqlite3.Connection` to " -"make configuration changes to a database connection. (Contributed by Erlend " -"E. Aasland in :gh:`103489`.)" +"Add :meth:`sqlite3.Connection.getconfig` and :meth:`sqlite3.Connection." +"setconfig` to :class:`sqlite3.Connection` to make configuration changes to a " +"database connection. (Contributed by Erlend E. Aasland in :gh:`103489`.)" msgstr "" #: ../../whatsnew/3.12.rst:892 @@ -1384,28 +1376,27 @@ msgstr "sys" #: ../../whatsnew/3.12.rst:901 msgid "" "Add the :mod:`sys.monitoring` namespace to expose the new :ref:`PEP 669 " -"` monitoring API. (Contributed by Mark Shannon " -"in :gh:`103082`.)" +"` monitoring API. (Contributed by Mark Shannon in :gh:" +"`103082`.)" msgstr "" #: ../../whatsnew/3.12.rst:905 msgid "" -"Add :func:`sys.activate_stack_trampoline` " -"and :func:`sys.deactivate_stack_trampoline` for activating and deactivating " -"stack profiler trampolines, and :func:`sys.is_stack_trampoline_active` for " -"querying if stack profiler trampolines are active. (Contributed by Pablo " -"Galindo and Christian Heimes with contributions from Gregory P. Smith " -"[Google] and Mark Shannon in :gh:`96123`.)" +"Add :func:`sys.activate_stack_trampoline` and :func:`sys." +"deactivate_stack_trampoline` for activating and deactivating stack profiler " +"trampolines, and :func:`sys.is_stack_trampoline_active` for querying if " +"stack profiler trampolines are active. (Contributed by Pablo Galindo and " +"Christian Heimes with contributions from Gregory P. Smith [Google] and Mark " +"Shannon in :gh:`96123`.)" msgstr "" #: ../../whatsnew/3.12.rst:914 msgid "" "Add :data:`sys.last_exc` which holds the last unhandled exception that was " "raised (for post-mortem debugging use cases). Deprecate the three fields " -"that have the same information in its legacy " -"form: :data:`sys.last_type`, :data:`sys.last_value` " -"and :data:`sys.last_traceback`. (Contributed by Irit Katriel " -"in :gh:`102778`.)" +"that have the same information in its legacy form: :data:`sys.last_type`, :" +"data:`sys.last_value` and :data:`sys.last_traceback`. (Contributed by Irit " +"Katriel in :gh:`102778`.)" msgstr "" #: ../../whatsnew/3.12.rst:920 ../../whatsnew/3.12.rst:1741 @@ -1449,10 +1440,10 @@ msgstr "threading" #: ../../whatsnew/3.12.rst:940 msgid "" -"Add :func:`threading.settrace_all_threads` " -"and :func:`threading.setprofile_all_threads` that allow to set tracing and " -"profiling functions in all running threads in addition to the calling one. " -"(Contributed by Pablo Galindo in :gh:`93503`.)" +"Add :func:`threading.settrace_all_threads` and :func:`threading." +"setprofile_all_threads` that allow to set tracing and profiling functions in " +"all running threads in addition to the calling one. (Contributed by Pablo " +"Galindo in :gh:`93503`.)" msgstr "" #: ../../whatsnew/3.12.rst:946 @@ -1476,9 +1467,9 @@ msgstr "tokenize" #: ../../whatsnew/3.12.rst:959 msgid "" "The :mod:`tokenize` module includes the changes introduced in :pep:`701`. " -"(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) " -"See :ref:`whatsnew312-porting-to-python312` for more information on the " -"changes to the :mod:`tokenize` module." +"(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) See :" +"ref:`whatsnew312-porting-to-python312` for more information on the changes " +"to the :mod:`tokenize` module." msgstr "" #: ../../whatsnew/3.12.rst:965 @@ -1487,9 +1478,9 @@ msgstr "types" #: ../../whatsnew/3.12.rst:967 msgid "" -"Add :func:`types.get_original_bases` to allow for further introspection " -"of :ref:`user-defined-generics` when subclassed. (Contributed by James " -"Hilton-Balfe and Alex Waygood in :gh:`101827`.)" +"Add :func:`types.get_original_bases` to allow for further introspection of :" +"ref:`user-defined-generics` when subclassed. (Contributed by James Hilton-" +"Balfe and Alex Waygood in :gh:`101827`.)" msgstr "" #: ../../whatsnew/3.12.rst:974 @@ -1498,16 +1489,15 @@ msgstr "typing" #: ../../whatsnew/3.12.rst:976 msgid "" -":func:`isinstance` checks against :func:`runtime-checkable protocols " -"` now use :func:`inspect.getattr_static` rather " -"than :func:`hasattr` to lookup whether attributes exist. This means that " -"descriptors and :meth:`~object.__getattr__` methods are no longer " -"unexpectedly evaluated during ``isinstance()`` checks against runtime-" -"checkable protocols. However, it may also mean that some objects which used " -"to be considered instances of a runtime-checkable protocol may no longer be " -"considered instances of that protocol on Python 3.12+, and vice versa. Most " -"users are unlikely to be affected by this change. (Contributed by Alex " -"Waygood in :gh:`102433`.)" +":func:`isinstance` checks against :func:`runtime-checkable protocols ` now use :func:`inspect.getattr_static` rather than :func:" +"`hasattr` to lookup whether attributes exist. This means that descriptors " +"and :meth:`~object.__getattr__` methods are no longer unexpectedly evaluated " +"during ``isinstance()`` checks against runtime-checkable protocols. However, " +"it may also mean that some objects which used to be considered instances of " +"a runtime-checkable protocol may no longer be considered instances of that " +"protocol on Python 3.12+, and vice versa. Most users are unlikely to be " +"affected by this change. (Contributed by Alex Waygood in :gh:`102433`.)" msgstr "" #: ../../whatsnew/3.12.rst:987 @@ -1568,8 +1558,8 @@ msgid "" "Most ``isinstance()`` checks against protocols with only a few members " "should be at least 2x faster than in 3.11, and some may be 20x faster or " "more. However, ``isinstance()`` checks against protocols with many members " -"may be slower than in Python 3.11. (Contributed by Alex Waygood " -"in :gh:`74690` and :gh:`103193`.)" +"may be slower than in Python 3.11. (Contributed by Alex Waygood in :gh:" +"`74690` and :gh:`103193`.)" msgstr "" #: ../../whatsnew/3.12.rst:1020 @@ -1672,8 +1662,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1072 msgid "" -"Speed up the regular expression substitution (functions :func:`re.sub` " -"and :func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " +"Speed up the regular expression substitution (functions :func:`re.sub` and :" +"func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " "replacement strings containing group references by 2--3 times. (Contributed " "by Serhiy Storchaka in :gh:`91524`.)" msgstr "" @@ -1689,16 +1679,16 @@ msgstr "" #: ../../whatsnew/3.12.rst:1080 msgid "" "The :func:`tokenize.tokenize` and :func:`tokenize.generate_tokens` functions " -"are up to 64% faster as a side effect of the changes required to " -"cover :pep:`701` in the :mod:`tokenize` module. (Contributed by Marta Gómez " -"Macías and Pablo Galindo in :gh:`102856`.)" +"are up to 64% faster as a side effect of the changes required to cover :pep:" +"`701` in the :mod:`tokenize` module. (Contributed by Marta Gómez Macías and " +"Pablo Galindo in :gh:`102856`.)" msgstr "" #: ../../whatsnew/3.12.rst:1085 msgid "" -"Speed up :func:`super` method calls and attribute loads via the " -"new :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and " -"Vladimir Matveev in :gh:`103497`.)" +"Speed up :func:`super` method calls and attribute loads via the new :opcode:" +"`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and Vladimir " +"Matveev in :gh:`103497`.)" msgstr "" #: ../../whatsnew/3.12.rst:1091 @@ -1707,29 +1697,28 @@ msgstr "CPython 位元組碼變更" #: ../../whatsnew/3.12.rst:1093 msgid "" -"Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged " -"into :opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the " -"old :opcode:`!LOAD_METHOD` instruction if the low bit of its oparg is set. " -"(Contributed by Ken Jin in :gh:`93429`.)" +"Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged into :" +"opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the old :opcode:" +"`!LOAD_METHOD` instruction if the low bit of its oparg is set. (Contributed " +"by Ken Jin in :gh:`93429`.)" msgstr "" -"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併" -"至 :opcode:`LOAD_ATTR`。:opcode:`LOAD_ATTR` 現在會像舊的 :opcode:`!" -"LOAD_METHOD` 指令一樣行為,如果其 oparg 的低位元 (low bit) 有被設定。(由 " -"Ken Jin 於 :gh:`93429` 中貢獻。)" +"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併至 :opcode:`LOAD_ATTR`。:opcode:" +"`LOAD_ATTR` 現在會像舊的 :opcode:`!LOAD_METHOD` 指令一樣行為,如果其 oparg 的" +"低位元 (low bit) 有被設定。(由 Ken Jin 於 :gh:`93429` 中貢獻。)" #: ../../whatsnew/3.12.rst:1098 msgid "" "Remove the :opcode:`!JUMP_IF_FALSE_OR_POP` and :opcode:`!" -"JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel " -"in :gh:`102859`.)" +"JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel in :gh:" +"`102859`.)" msgstr "" "移除 :opcode:`!JUMP_IF_FALSE_OR_POP` 和 :opcode:`!JUMP_IF_TRUE_OR_POP` 指令。" "(由 Irit Katriel 於 :gh:`102859` 中貢獻。)" #: ../../whatsnew/3.12.rst:1101 msgid "" -"Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon " -"in :gh:`92925`.)" +"Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon in :" +"gh:`92925`.)" msgstr "" "移除 :opcode:`!PRECALL` 指令。(由 Mark Shannon 於 :gh:`92925` 中貢獻。)" @@ -1767,8 +1756,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1116 msgid "" -"Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon " -"in :gh:`103082`.)" +"Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon in :gh:" +"`103082`.)" msgstr "" "新增 :opcode:`!END_SEND` 指令。(由 Mark Shannon 於 :gh:`103082` 中貢獻。)" @@ -1790,34 +1779,32 @@ msgstr "" #: ../../whatsnew/3.12.rst:1125 msgid "" -"Add " -"the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:`LOAD_FROM_DICT_OR_GLOBALS`, " -"and :opcode:`LOAD_LOCALS` opcodes as part of the implementation " -"of :pep:`695`. Remove the :opcode:`!LOAD_CLASSDEREF` opcode, which can be " -"replaced with :opcode:`LOAD_LOCALS` plus :opcode:`LOAD_FROM_DICT_OR_DEREF`. " -"(Contributed by Jelle Zijlstra in :gh:`103764`.)" +"Add the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:" +"`LOAD_FROM_DICT_OR_GLOBALS`, and :opcode:`LOAD_LOCALS` opcodes as part of " +"the implementation of :pep:`695`. Remove the :opcode:`!LOAD_CLASSDEREF` " +"opcode, which can be replaced with :opcode:`LOAD_LOCALS` plus :opcode:" +"`LOAD_FROM_DICT_OR_DEREF`. (Contributed by Jelle Zijlstra in :gh:`103764`.)" msgstr "" "新增 :opcode:`LOAD_FROM_DICT_OR_DEREF`、:opcode:`LOAD_FROM_DICT_OR_GLOBALS` " "和 :opcode:`LOAD_LOCALS` 操作碼作為 :pep:`695` 實作的一部分。移除 :opcode:`!" -"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加" -"上 :opcode:`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra " -"於 :gh:`103764` 中貢獻。)" +"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加上 :opcode:" +"`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra 於 :gh:`103764` 中貢" +"獻。)" #: ../../whatsnew/3.12.rst:1131 msgid "" "Add the :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer " "and Vladimir Matveev in :gh:`103497`.)" msgstr "" -"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev " -"於 :gh:`103497` 中貢獻。)" +"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev 於 :" +"gh:`103497` 中貢獻。)" #: ../../whatsnew/3.12.rst:1134 msgid "" -"Add the ``RETURN_CONST`` instruction. (Contributed by Wenyang Wang " -"in :gh:`101632`.)" +"Add the ``RETURN_CONST`` instruction. (Contributed by Wenyang Wang in :gh:" +"`101632`.)" msgstr "" -"新增 ``RETURN_CONST`` 指令。(由 Wenyang Wang 於 :gh:`101632` 中貢" -"獻。)" +"新增 ``RETURN_CONST`` 指令。(由 Wenyang Wang 於 :gh:`101632` 中貢獻。)" #: ../../whatsnew/3.12.rst:1137 msgid "Demos and Tools" @@ -1891,8 +1878,8 @@ msgstr ":class:`!ast.Ellipsis`" #: ../../whatsnew/3.12.rst:1168 #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " -"in :gh:`90953`.)" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" +"`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" @@ -1906,29 +1893,27 @@ msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" "The child watcher classes :class:`!asyncio.MultiLoopChildWatcher`, :class:`!" -"asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` " -"and :class:`!asyncio.SafeChildWatcher` are deprecated and will be removed in " -"Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +"asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` and :class:" +"`!asyncio.SafeChildWatcher` are deprecated and will be removed in Python " +"3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`!" -"asyncio.MultiLoopChildWatcher`、:class:`!asyncio.FastChildWatcher`、:class:`!" -"asyncio.AbstractChildWatcher` 和 :class:`!asyncio.SafeChildWatcher`。 (由 " -"Kumar Aditya 於 :gh:`94597` 貢獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`!asyncio." +"MultiLoopChildWatcher`、:class:`!asyncio.FastChildWatcher`、:class:`!asyncio." +"AbstractChildWatcher` 和 :class:`!asyncio.SafeChildWatcher`。 (由 Kumar " +"Aditya 於 :gh:`94597` 貢獻。)" #: ../../whatsnew/3.12.rst:1179 #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`!asyncio.set_child_watcher`, :func:`!" -"asyncio.get_child_watcher`, :meth:`!" -"asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`!" +":func:`!asyncio.set_child_watcher`, :func:`!asyncio.get_child_watcher`, :" +"meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`!" "asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated and will " "be removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -":func:`!asyncio.set_child_watcher`、:func:`!" -"asyncio.get_child_watcher`、:meth:`!" -"asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`!" -"asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python " -"3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`!asyncio.set_child_watcher`、:func:`!asyncio.get_child_watcher`、:" +"meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`!asyncio." +"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" +"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../whatsnew/3.12.rst:1185 #: ../../deprecations/pending-removal-in-3.14.rst:36 @@ -1946,9 +1931,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:45 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` " -"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " @@ -1956,33 +1940,30 @@ msgstr "" #: ../../whatsnew/3.12.rst:1194 msgid "" -":mod:`collections.abc`: Deprecated :class:`!collections.abc.ByteString`. " -"Prefer :class:`Sequence` or :class:`collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, " -"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -"in :gh:`91896`.)" +":mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`. " +"Prefer :class:`Sequence` or :class:`collections.abc.Buffer`. For use in type " +"annotations, prefer a union, like ``bytes | bytearray``, or :class:" +"`collections.abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" msgstr "" -":mod:`collections.abc`:已棄用 :class:`!collections.abc.ByteString`。請改" -"用 :class:`Sequence` 或 :class:`collections.abc.Buffer`。在 typing 中使用時," -"請改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。" -"(由 Shantanu Jain 於 :gh:`91896` 貢獻。)" +":mod:`collections.abc`:已棄用 :class:`collections.abc.ByteString`。請改用 :" +"class:`Sequence` 或 :class:`collections.abc.Buffer`。在 typing 中使用時,請改" +"用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " +"Shantanu Jain 於 :gh:`91896` 貢獻。)" #: ../../whatsnew/3.12.rst:1199 msgid "" -":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime.utcnow` " -"and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and will be " -"removed in a future version. Instead, use timezone-aware objects to " -"represent datetimes in UTC: respectively, " -"call :meth:`~datetime.datetime.now` " -"and :meth:`~datetime.datetime.fromtimestamp` with the *tz* parameter set " -"to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" +":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime." +"utcnow` and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and " +"will be removed in a future version. Instead, use timezone-aware objects to " +"represent datetimes in UTC: respectively, call :meth:`~datetime.datetime." +"now` and :meth:`~datetime.datetime.fromtimestamp` with the *tz* parameter " +"set to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" msgstr "" #: ../../whatsnew/3.12.rst:1207 msgid "" -":mod:`email`: Deprecate the *isdst* parameter " -"in :func:`email.utils.localtime`. (Contributed by Alan Williams " -"in :gh:`72346`.)" +":mod:`email`: Deprecate the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" ":mod:`email`:棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 中貢獻。)" @@ -1994,37 +1975,37 @@ msgid "" msgstr ":mod:`importlib.abc`:棄用下列類別,預定於 Python 3.14 中移除:" #: ../../whatsnew/3.12.rst:1213 -#: ../../deprecations/pending-removal-in-3.14.rst:52 +#: ../../deprecations/pending-removal-in-3.14.rst:46 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" #: ../../whatsnew/3.12.rst:1214 -#: ../../deprecations/pending-removal-in-3.14.rst:53 +#: ../../deprecations/pending-removal-in-3.14.rst:47 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" #: ../../whatsnew/3.12.rst:1215 -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:48 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" #: ../../whatsnew/3.12.rst:1217 -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:50 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" #: ../../whatsnew/3.12.rst:1219 -#: ../../deprecations/pending-removal-in-3.14.rst:58 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" #: ../../whatsnew/3.12.rst:1220 -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" #: ../../whatsnew/3.12.rst:1222 -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:55 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" @@ -2033,8 +2014,8 @@ msgid "" ":mod:`itertools`: Deprecate the support for copy, deepcopy, and pickle " "operations, which is undocumented, inefficient, historically buggy, and " "inconsistent. This will be removed in 3.14 for a significant reduction in " -"code volume and maintenance burden. (Contributed by Raymond Hettinger " -"in :gh:`101588`.)" +"code volume and maintenance burden. (Contributed by Raymond Hettinger in :gh:" +"`101588`.)" msgstr "" #: ../../whatsnew/3.12.rst:1230 @@ -2043,22 +2024,20 @@ msgid "" "start method will change to a safer one on Linux, BSDs, and other non-macOS " "POSIX platforms where ``'fork'`` is currently the default (:gh:`84559`). " "Adding a runtime warning about this was deemed too disruptive as the " -"majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` " -"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " -"your code *requires* ``'fork'``. See :ref:`contexts and start methods " -"`." +"majority of code is not expected to care. Use the :func:`~multiprocessing." +"get_context` or :func:`~multiprocessing.set_start_method` APIs to explicitly " +"specify when your code *requires* ``'fork'``. See :ref:`contexts and start " +"methods `." msgstr "" #: ../../whatsnew/3.12.rst:1240 msgid "" ":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " -"are deprecated and will be removed in Python 3.14; " -"use :func:`importlib.util.find_spec` instead. (Contributed by Nikita Sobolev " -"in :gh:`97850`.)" +"are deprecated and will be removed in Python 3.14; use :func:`importlib.util." +"find_spec` instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" -":mod:`pkgutil`::func:`!pkgutil.find_loader` 和 :func:`!pkgutil.get_loader` 已" -"被棄用並將在 Python 3.14 中移除;請改用 :func:`importlib.util.find_spec`。" +":mod:`pkgutil`::func:`!pkgutil.find_loader` 和 :func:`!pkgutil.get_loader` " +"已被棄用並將在 Python 3.14 中移除;請改用 :func:`importlib.util.find_spec`。" "(由 Nikita Sobolev 於 :gh:`97850` 中貢獻。)" #: ../../whatsnew/3.12.rst:1245 @@ -2084,37 +2063,36 @@ msgstr "" #: ../../whatsnew/3.12.rst:1258 msgid "" -"On POSIX platforms, :func:`os.fork` can now raise " -"a :exc:`DeprecationWarning` when it can detect being called from a " -"multithreaded process. There has always been a fundamental incompatibility " -"with the POSIX platform when doing so. Even if such code *appeared* to work. " -"We added the warning to raise awareness as issues encountered by code doing " -"this are becoming more frequent. See the :func:`os.fork` documentation for " -"more details along with `this discussion on fork being incompatible with " -"threads `_ for *why* we're now surfacing this longstanding " +"On POSIX platforms, :func:`os.fork` can now raise a :exc:" +"`DeprecationWarning` when it can detect being called from a multithreaded " +"process. There has always been a fundamental incompatibility with the POSIX " +"platform when doing so. Even if such code *appeared* to work. We added the " +"warning to raise awareness as issues encountered by code doing this are " +"becoming more frequent. See the :func:`os.fork` documentation for more " +"details along with `this discussion on fork being incompatible with threads " +"`_ for *why* we're now surfacing this longstanding " "platform compatibility problem to developers." msgstr "" #: ../../whatsnew/3.12.rst:1268 msgid "" -"When this warning appears due to usage of :mod:`multiprocessing` " -"or :mod:`concurrent.futures` the fix is to use a " -"different :mod:`multiprocessing` start method such as ``\"spawn\"`` or " -"``\"forkserver\"``." +"When this warning appears due to usage of :mod:`multiprocessing` or :mod:" +"`concurrent.futures` the fix is to use a different :mod:`multiprocessing` " +"start method such as ``\"spawn\"`` or ``\"forkserver\"``." msgstr "" #: ../../whatsnew/3.12.rst:1272 msgid "" ":mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is " -"deprecated; use *onexc* instead. (Contributed by Irit Katriel " -"in :gh:`102828`.)" +"deprecated; use *onexc* instead. (Contributed by Irit Katriel in :gh:" +"`102828`.)" msgstr "" ":mod:`shutil`::func:`shutil.rmtree` 的 *onerror* 引數已被棄用,請改用 " "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" #: ../../whatsnew/3.12.rst:1275 -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:85 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" @@ -2137,14 +2115,13 @@ msgstr "" #: ../../whatsnew/3.12.rst:1290 msgid "" -":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` " -"and :data:`sys.last_traceback` fields are deprecated. " -"Use :data:`sys.last_exc` instead. (Contributed by Irit Katriel " -"in :gh:`102778`.)" +":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys." +"last_traceback` fields are deprecated. Use :data:`sys.last_exc` instead. " +"(Contributed by Irit Katriel in :gh:`102778`.)" msgstr "" -":mod:`sys`::data:`sys.last_type`、:data:`sys.last_value` " -"和 :data:`sys.last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。" -"(由 Irit Katriel 於 :gh:`102778` 中貢獻。)" +":mod:`sys`::data:`sys.last_type`、:data:`sys.last_value` 和 :data:`sys." +"last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。(由 Irit Katriel " +"於 :gh:`102778` 中貢獻。)" #: ../../whatsnew/3.12.rst:1294 msgid "" @@ -2161,20 +2138,19 @@ msgstr ":mod:`typing`:" #: ../../whatsnew/3.12.rst:1300 msgid "" -":class:`typing.Hashable` and :class:`typing.Sized`, aliases " -"for :class:`collections.abc.Hashable` and :class:`collections.abc.Sized` " -"respectively, are deprecated. (:gh:`94309`.)" +":class:`typing.Hashable` and :class:`typing.Sized`, aliases for :class:" +"`collections.abc.Hashable` and :class:`collections.abc.Sized` respectively, " +"are deprecated. (:gh:`94309`.)" msgstr "" #: ../../whatsnew/3.12.rst:1304 msgid "" -":class:`!typing.ByteString`, deprecated since Python 3.9, now causes " -"a :exc:`DeprecationWarning` to be emitted when it is used. (Contributed by " -"Alex Waygood in :gh:`91896`.)" +":class:`typing.ByteString`, deprecated since Python 3.9, now causes a :exc:" +"`DeprecationWarning` to be emitted when it is used. (Contributed by Alex " +"Waygood in :gh:`91896`.)" msgstr "" -"自 Python 3.9 起已被棄用的 :class:`!typing.ByteString` 現在在" -"使用時會發出 :exc:`DeprecationWarning`。(由 Alex Waygood 於 :gh:`91896` " -"中貢獻。)" +"自 Python 3.9 起已被棄用的 :class:`typing.ByteString` 現在在使用時會發出 :" +"exc:`DeprecationWarning`。(由 Alex Waygood 於 :gh:`91896` 中貢獻。)" #: ../../whatsnew/3.12.rst:1308 msgid "" @@ -2187,26 +2163,26 @@ msgstr "" #: ../../whatsnew/3.12.rst:1314 msgid "" "The 3-arg signatures (type, value, traceback) of :meth:`coroutine throw() " -"`, :meth:`generator throw() ` " -"and :meth:`async generator throw() ` are deprecated and may be " -"removed in a future version of Python. Use the single-arg versions of these " -"functions instead. (Contributed by Ofey Chan in :gh:`89874`.)" +"`, :meth:`generator throw() ` and :meth:" +"`async generator throw() ` are deprecated and may be removed in " +"a future version of Python. Use the single-arg versions of these functions " +"instead. (Contributed by Ofey Chan in :gh:`89874`.)" msgstr "" #: ../../whatsnew/3.12.rst:1320 msgid "" ":exc:`DeprecationWarning` is now raised when :attr:`~module.__package__` on " -"a module differs from :attr:`__spec__.parent " -"` (previously it " -"was :exc:`ImportWarning`). (Contributed by Brett Cannon in :gh:`65961`.)" +"a module differs from :attr:`__spec__.parent ` (previously it was :exc:`ImportWarning`). (Contributed by Brett " +"Cannon in :gh:`65961`.)" msgstr "" #: ../../whatsnew/3.12.rst:1326 msgid "" "Setting :attr:`~module.__package__` or :attr:`~module.__cached__` on a " "module is deprecated, and will cease to be set or taken into consideration " -"by the import system in Python 3.14. (Contributed by Brett Cannon " -"in :gh:`65961`.)" +"by the import system in Python 3.14. (Contributed by Brett Cannon in :gh:" +"`65961`.)" msgstr "" #: ../../whatsnew/3.12.rst:1330 @@ -2221,13 +2197,13 @@ msgstr "" #: ../../whatsnew/3.12.rst:1336 msgid "" "Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in " -"Python 3.10 via :pep:`626`, but it only got a " -"proper :exc:`DeprecationWarning` in 3.12. May be removed in 3.15. " -"(Contributed by Nikita Sobolev in :gh:`101866`.)" +"Python 3.10 via :pep:`626`, but it only got a proper :exc:" +"`DeprecationWarning` in 3.12. May be removed in 3.15. (Contributed by Nikita " +"Sobolev in :gh:`101866`.)" msgstr "" -"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已" -"在 :pep:`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。" -"可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" +"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已在 :pep:" +"`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。可能在 " +"3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.13.rst:2 msgid "Pending removal in Python 3.13" @@ -2419,32 +2395,17 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" -":mod:`collections.abc`: Deprecated :class:`!collections.abc.ByteString`. " -"Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, " -"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -"in :gh:`91896`.)" -msgstr "" -":mod:`collections.abc`:已棄用 :class:`!collections.abc.ByteString`。請改" -"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" -"時,請改用聯集,如 ``bytes | bytearray``," -"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" -"獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:47 -msgid "" -":mod:`email`: Deprecated the *isdst* parameter " -"in :func:`email.utils.localtime`. (Contributed by Alan Williams " -"in :gh:`72346`.)" +":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:50 +#: ../../deprecations/pending-removal-in-3.14.rst:44 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:57 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -2455,82 +2416,72 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:69 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " "currently the default (:gh:`84559`). Adding a runtime warning about this was " "deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` " -"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " -"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." +"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." +"set_start_method` APIs to explicitly specify when your code *requires* " +"``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" "台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" -"用 :func:`~multiprocessing.get_context` " -"或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時\\ *" -"需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" +"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " +"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" +"`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:77 +#: ../../deprecations/pending-removal-in-3.14.rst:71 msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " -"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " -"deprecated." +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." +"PurePath.relative_to`: passing additional arguments is deprecated." msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " -"和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" +"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:81 +#: ../../deprecations/pending-removal-in-3.14.rst:75 msgid "" ":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`!pkgutil.find_loader` 和 :func:`!pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改" -"用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" -"獻。)" +"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." +"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:86 +#: ../../deprecations/pending-removal-in-3.14.rst:80 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:82 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:83 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:87 msgid ":data:`!version` and :data:`!version_info`." msgstr ":data:`!version` 和 :data:`!version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " -"if :ref:`named placeholders ` are used and " -"*parameters* is a sequence instead of a :class:`dict`." +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" +"ref:`named placeholders ` are used and *parameters* is " +"a sequence instead of a :class:`dict`." msgstr "" ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:99 -msgid "" -":mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9, now " -"causes a :exc:`DeprecationWarning` to be emitted when it is used." -msgstr "" -":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`!typing.ByteString` 現在在" -"使用時會發出 :exc:`DeprecationWarning`。" - -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith " -"in :gh:`88168`.)" +"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" +"`88168`.)" msgstr "" ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" "(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" @@ -2547,10 +2498,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to " -"set :attr:`__spec__.cached ` is " -"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " -"into consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "` 的做法已被棄用。在 Python 3.15 中," @@ -2558,11 +2509,10 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to " -"set :attr:`__spec__.parent ` is " -"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " -"take into consideration by the import system or standard library. " -"(:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "` 的做法已被棄用。在 Python 3.15 中," @@ -2617,17 +2567,15 @@ msgstr ":class:`locale`:" #: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 " -"(:gh:`90817`), but has been postponed to Python 3.15. " -"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " -"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " -"in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" -"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " -"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" -"獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" @@ -2635,11 +2583,11 @@ msgstr ":mod:`pathlib`:" #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " -"Use :func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" -"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" @@ -2694,16 +2642,16 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" -"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " -"於 :gh:`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for " -"creating :class:`~typing.NamedTuple` classes (for example, ``Point = " -"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " -"3.13. Use the class-based syntax or the functional syntax instead." +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (for example, ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``) has been deprecated since Python 3.13. Use the class-based syntax " +"or the functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" @@ -2738,14 +2686,13 @@ msgstr ":mod:`wave`:" #: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " -"and :meth:`~wave.Wave_read.getmarkers` methods of " -"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " -"deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" -"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " -"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:107 msgid ":mod:`zipimport`:" @@ -2757,9 +2704,9 @@ msgid "" "3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " "by Jiahao Li in :gh:`125746`.)" msgstr "" -":meth:`~zipimport.zipimporter.load_module` 自 Python 3.10 被棄用。請改" -"用 :meth:`~zipimport.zipimporter.exec_module`。(由 Jiahao Li " -"於 :gh:`125746` 貢獻。)" +":meth:`~zipimport.zipimporter.load_module` 自 Python 3.10 被棄用。請改用 :" +"meth:`~zipimport.zipimporter.exec_module`。(由 Jiahao Li 於 :gh:`125746` 貢" +"獻。)" #: ../../deprecations/c-api-pending-removal-in-3.16.rst:2 #: ../../deprecations/pending-removal-in-3.16.rst:2 @@ -2768,10 +2715,10 @@ msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to " -"set :attr:`__spec__.loader ` is " -"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " -"taken into consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "` 的做法將於 Python 3.16 被棄用。在 " @@ -2798,8 +2745,8 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除;請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " -"於 :gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" +"gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 msgid "" @@ -2893,8 +2840,8 @@ msgid "" "*function* or *sequence* as keyword arguments has been deprecated since " "Python 3.14." msgstr "" -"自 Python 3.14 起,使用 *function* 或 *sequence* 關鍵字引數呼" -"叫 :func:`functools.reduce` 的 Python 實作已被棄用。" +"自 Python 3.14 起,使用 *function* 或 *sequence* 關鍵字引數呼叫 :func:" +"`functools.reduce` 的 Python 實作已被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:64 msgid ":mod:`logging`:" @@ -2915,10 +2862,10 @@ msgstr ":mod:`mimetypes`:" #: ../../deprecations/pending-removal-in-3.16.rst:72 msgid "" -"Valid extensions start with a '.' or are empty " -"for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated " -"and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " -"Kemenade in :gh:`75223`.)" +"Valid extensions start with a '.' or are empty for :meth:`mimetypes." +"MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :" +"exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:" +"`75223`.)" msgstr "" "有效的副檔名以 '.' 開頭或對 :meth:`mimetypes.MimeTypes.add_type` 為空字串。未" "加點的副檔名已被棄用,並將在 Python 3.16 中引發 :exc:`ValueError`。(由 Hugo " @@ -3001,6 +2948,36 @@ msgstr "" "除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " "和 :func:`typing.get_args`,或者依賴私有實作細節。" +#: ../../deprecations/pending-removal-in-3.17.rst:11 +msgid "" +":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " +"removal in Python 3.17. Prefer :class:`~collections.abc.Sequence` or :class:" +"`~collections.abc.Buffer`. For use in type annotations, prefer a union, like " +"``bytes | bytearray``, or :class:`collections.abc.Buffer`. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" +"自 Python 3.9 起已被棄用的 :class:`typing.ByteString`,計劃在 Python " +"3.17 中移除。建議改用 :class:`~collections.abc.Sequence` 或 :class:`~" +"collections.abc.Buffer`。在型別註釋中建議改用聯集,例如 ``bytes | " +"bytearray`` 或 :class:`collections.abc.Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.17.rst:17 +msgid ":mod:`collections.abc`:" +msgstr ":mod:`collections.abc`:" + +#: ../../deprecations/pending-removal-in-3.17.rst:19 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. " +"Prefer :class:`~collections.abc.Sequence` or :class:`~collections.abc." +"Buffer`. For use in type annotations, prefer a union, like ``bytes | " +"bytearray``, or :class:`collections.abc.Buffer`. (Contributed by Shantanu " +"Jain in :gh:`91896`.)" +msgstr "" +":class:`collections.abc.ByteString` 計劃在 Python 3.17 中移除。建議改用 " +":class:`~collections.abc.Sequence` 或 :class:`~collections.abc.Buffer`。在" +"型別註釋中建議改用聯集,例如 ``bytes | bytearray`` 或 :class:`collections.abc." +"Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" + #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 msgid "Pending removal in future versions" @@ -3023,11 +3000,11 @@ msgstr "巢狀引數群組和巢狀互斥群組已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:11 msgid "" -"Passing the undocumented keyword argument *prefix_chars* " -"to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." +"Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse." +"ArgumentParser.add_argument_group` is now deprecated." msgstr "" -"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞" -"給 :meth:`~argparse.ArgumentParser.add_argument_group` 的做法現在已被棄用。" +"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞給 :meth:`~argparse." +"ArgumentParser.add_argument_group` 的做法現在已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:14 msgid "The :class:`argparse.FileType` type converter is deprecated." @@ -3052,17 +3029,17 @@ msgid "" "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of " -"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " -"and :keyword:`or`. In a future release it will be changed to a syntax " -"error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" -"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " -"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" -"法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" +"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" +"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" +"本中,它將被更改為語法錯誤。(:gh:`87999`)" #: ../../deprecations/pending-removal-in-future.rst:30 msgid "" @@ -3075,18 +3052,18 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:33 msgid "" -"Support for ``__float__()`` method returning a strict subclass " -"of :class:`float`: these methods will be required to return an instance " -"of :class:`float`." +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:36 msgid "" -"Support for ``__complex__()`` method returning a strict subclass " -"of :class:`complex`: these methods will be required to return an instance " -"of :class:`complex`." +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" @@ -3097,18 +3074,18 @@ msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" #: ../../deprecations/pending-removal-in-future.rst:40 msgid "" -"Passing a complex number as the *real* or *imag* argument in " -"the :func:`complex` constructor is now deprecated; it should only be passed " -"as a single positional argument. (Contributed by Serhiy Storchaka " -"in :gh:`109218`.)" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" #: ../../deprecations/pending-removal-in-future.rst:50 msgid "" -":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " -"(:gh:`133038`)" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:" +"`133038`)" msgstr "" ":mod:`codecs`:請改用 :func:`open` 而非 :func:`codecs.open`。(:gh:`133038`)" @@ -3125,19 +3102,19 @@ msgstr ":mod:`datetime`:" #: ../../deprecations/pending-removal-in-future.rst:57 msgid "" -":meth:`~datetime.datetime.utcnow`: use " -"``datetime.datetime.now(tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 " -"``datetime.datetime.now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." +"now(tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:59 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:62 msgid ":mod:`gettext`: Plural value must be an integer." @@ -3168,8 +3145,8 @@ msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" -"用 :meth:`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" #: ../../deprecations/pending-removal-in-future.rst:77 msgid "" @@ -3226,11 +3203,11 @@ msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:100 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " -"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " -"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" +"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" #: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.OP_NO_SSL*`` options" @@ -3278,11 +3255,11 @@ msgstr ":mod:`threading` 方法:" #: ../../deprecations/pending-removal-in-future.rst:116 msgid "" -":meth:`!threading.Condition.notifyAll`: " -"use :meth:`~threading.Condition.notify_all`." +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請" -"用 :meth:`~threading.Condition.notify_all`。" +":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." +"notify_all`。" #: ../../deprecations/pending-removal-in-future.rst:117 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." @@ -3290,19 +3267,19 @@ msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set` #: ../../deprecations/pending-removal-in-future.rst:118 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " -"use :attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:120 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " -"use :attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" -"用 :attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" +"attr:`threading.Thread.name` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:122 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." @@ -3395,22 +3372,22 @@ msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分 #: ../../deprecations/pending-removal-in-future.rst:152 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of " -"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " -"release it will always return ``True``. Prefer explicit ``len(elem)`` or " -"``elem is not None`` tests instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用" -"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" -"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." +"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " +"``len(elem)`` 或 ``elem is not None`` 測試。" #: ../../deprecations/pending-removal-in-future.rst:157 msgid "" -":func:`sys._clear_type_cache` is deprecated: " -"use :func:`sys._clear_internal_caches` instead." +":func:`sys._clear_type_cache` is deprecated: use :func:`sys." +"_clear_internal_caches` instead." msgstr "" -":func:`sys._clear_type_cache` 已被棄用:請改" -"用 :func:`sys._clear_internal_caches`。" +":func:`sys._clear_type_cache` 已被棄用:請改用 :func:`sys." +"_clear_internal_caches`。" #: ../../whatsnew/3.12.rst:1357 ../../whatsnew/3.12.rst:2241 msgid "Removed" @@ -3451,16 +3428,16 @@ msgid "" ":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " "shorter :class:`~configparser.ConfigParser` name instead." msgstr "" -":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短" -"的 :class:`~configparser.ConfigParser` 名稱。" +":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短的 :class:" +"`~configparser.ConfigParser` 名稱。" #: ../../whatsnew/3.12.rst:1378 msgid "" -":class:`configparser.ConfigParser` no longer has a ``readfp`` method. " -"Use :meth:`~configparser.ConfigParser.read_file` instead." +":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" +"meth:`~configparser.ConfigParser.read_file` instead." msgstr "" -":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改" -"用 :meth:`~configparser.ConfigParser.read_file`。" +":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改用 :meth:" +"`~configparser.ConfigParser.read_file`。" #: ../../whatsnew/3.12.rst:1384 msgid "distutils" @@ -3540,8 +3517,8 @@ msgid "" "Remove the ``filename`` attribute of :mod:`gzip`'s :class:`gzip.GzipFile`, " "deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute " "instead. In write mode, the ``filename`` attribute added ``'.gz'`` file " -"extension if it was not present. (Contributed by Victor Stinner " -"in :gh:`94196`.)" +"extension if it was not present. (Contributed by Victor Stinner in :gh:" +"`94196`.)" msgstr "" #: ../../whatsnew/3.12.rst:1437 @@ -3550,11 +3527,11 @@ msgstr "hashlib" #: ../../whatsnew/3.12.rst:1439 msgid "" -"Remove the pure Python implementation " -"of :mod:`hashlib`'s :func:`hashlib.pbkdf2_hmac`, deprecated in Python 3.10. " -"Python 3.10 and newer requires OpenSSL 1.1.1 (:pep:`644`): this OpenSSL " -"version provides a C implementation of :func:`~hashlib.pbkdf2_hmac` which is " -"faster. (Contributed by Victor Stinner in :gh:`94199`.)" +"Remove the pure Python implementation of :mod:`hashlib`'s :func:`hashlib." +"pbkdf2_hmac`, deprecated in Python 3.10. Python 3.10 and newer requires " +"OpenSSL 1.1.1 (:pep:`644`): this OpenSSL version provides a C implementation " +"of :func:`~hashlib.pbkdf2_hmac` which is faster. (Contributed by Victor " +"Stinner in :gh:`94199`.)" msgstr "" #: ../../whatsnew/3.12.rst:1446 ../../whatsnew/3.12.rst:1475 @@ -3581,9 +3558,9 @@ msgid "" "``importlib.util.module_for_loader`` have all been removed. (Contributed by " "Brett Cannon and Nikita Sobolev in :gh:`65961` and :gh:`97850`.)" msgstr "" -"``importlib.util.set_package``、``importlib.util.set_loader`` 和 " -"``importlib.util.module_for_loader`` 已全部刪除。(由 Brett Cannon 和 Nikita " -"Sobolev 在 :gh:`65961` 和 :gh:`97850` 貢獻。)" +"``importlib.util.set_package``、``importlib.util.set_loader`` 和 ``importlib." +"util.module_for_loader`` 已全部刪除。(由 Brett Cannon 和 Nikita Sobolev 在 :" +"gh:`65961` 和 :gh:`97850` 貢獻。)" #: ../../whatsnew/3.12.rst:1458 msgid "" @@ -3607,8 +3584,8 @@ msgstr "imp" #: ../../whatsnew/3.12.rst:1469 msgid "" -"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw " -"in :gh:`98040`.)" +"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" +"gh:`98040`.)" msgstr ":mod:`!imp` 模組已被移除。(由 Barry Warsaw 在 :gh:`98040` 中貢獻。)" #: ../../whatsnew/3.12.rst:1472 @@ -3653,11 +3630,11 @@ msgstr "``imp.get_suffixes()``" #: ../../whatsnew/3.12.rst:1481 msgid "" -":const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery.EXTENSION_SUFFIXES`, " -"and :const:`importlib.machinery.BYTECODE_SUFFIXES`" +":const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery." +"EXTENSION_SUFFIXES`, and :const:`importlib.machinery.BYTECODE_SUFFIXES`" msgstr "" -":const:`importlib.machinery.SOURCE_SUFFIXES`、:const:`importlib.machinery.EXTENSION_SUFFIXES` " -"和 :const:`importlib.machinery.BYTECODE_SUFFIXES`" +":const:`importlib.machinery.SOURCE_SUFFIXES`、:const:`importlib.machinery." +"EXTENSION_SUFFIXES` 和 :const:`importlib.machinery.BYTECODE_SUFFIXES`" #: ../../whatsnew/3.12.rst:1482 msgid "``imp.get_tag()``" @@ -3788,10 +3765,10 @@ msgstr "io" #: ../../whatsnew/3.12.rst:1523 msgid "" "Remove :mod:`io`'s ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated " -"in Python 3.10: just use :func:`open` instead. The :func:`open` " -"(:func:`io.open`) function is a built-in function. Since Python " -"3.10, :func:`!_pyio.open` is also a static method. (Contributed by Victor " -"Stinner in :gh:`94169`.)" +"in Python 3.10: just use :func:`open` instead. The :func:`open` (:func:`io." +"open`) function is a built-in function. Since Python 3.10, :func:`!_pyio." +"open` is also a static method. (Contributed by Victor Stinner in :gh:" +"`94169`.)" msgstr "" #: ../../whatsnew/3.12.rst:1530 @@ -3811,10 +3788,10 @@ msgstr "smtpd" #: ../../whatsnew/3.12.rst:1539 msgid "" -"The ``smtpd`` module has been removed according to the schedule " -"in :pep:`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use " -"the :pypi:`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server " -"instead. (Contributed by Oleg Iarygin in :gh:`93243`.)" +"The ``smtpd`` module has been removed according to the schedule in :pep:" +"`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use the :pypi:" +"`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server instead. " +"(Contributed by Oleg Iarygin in :gh:`93243`.)" msgstr "" "根據 :pep:`594` 的時間表移除 ``smtpd`` 模組,它在 Python 3.4.7 和 3.5.4 中已" "被棄用。請改用 PyPI 上的 :pypi:`aiosmtpd` 模組或任何其他基於 :mod:`asyncio` " @@ -3844,9 +3821,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1557 msgid "" -"The ``sqlite3.OptimizedUnicode`` text factory has been an alias " -"for :class:`str` since Python 3.3. Code that previously set the text factory " -"to ``OptimizedUnicode`` can either use ``str`` explicitly, or rely on the " +"The ``sqlite3.OptimizedUnicode`` text factory has been an alias for :class:" +"`str` since Python 3.3. Code that previously set the text factory to " +"``OptimizedUnicode`` can either use ``str`` explicitly, or rely on the " "default value which is also ``str``." msgstr "" @@ -3876,12 +3853,12 @@ msgstr "" #: ../../whatsnew/3.12.rst:1577 msgid "" "Remove the :func:`!ssl.wrap_socket` function, deprecated in Python 3.7: " -"instead, create a :class:`ssl.SSLContext` object and call " -"its :class:`ssl.SSLContext.wrap_socket` method. Any package that still " -"uses :func:`!ssl.wrap_socket` is broken and insecure. The function neither " -"sends a SNI TLS extension nor validates the server hostname. Code is subject " -"to :cwe:`295` (Improper Certificate Validation). (Contributed by Victor " -"Stinner in :gh:`94199`.)" +"instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl." +"SSLContext.wrap_socket` method. Any package that still uses :func:`!ssl." +"wrap_socket` is broken and insecure. The function neither sends a SNI TLS " +"extension nor validates the server hostname. Code is subject to :cwe:`295` " +"(Improper Certificate Validation). (Contributed by Victor Stinner in :gh:" +"`94199`.)" msgstr "" #: ../../whatsnew/3.12.rst:1588 @@ -4039,9 +4016,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1620 msgid "" -"Undocumented :meth:`TestLoader.loadTestsFromModule " -"` parameter *use_load_tests* " -"(deprecated and ignored since Python 3.5)." +"Undocumented :meth:`TestLoader.loadTestsFromModule ` parameter *use_load_tests* (deprecated and ignored " +"since Python 3.5)." msgstr "" #: ../../whatsnew/3.12.rst:1624 @@ -4087,9 +4064,8 @@ msgstr "zipimport" #: ../../whatsnew/3.12.rst:1648 msgid "" "Remove :mod:`zipimport`'s ``find_loader()`` and ``find_module()`` methods, " -"deprecated in Python 3.10: use the ``find_spec()`` method instead. " -"See :pep:`451` for the rationale. (Contributed by Victor Stinner " -"in :gh:`94379`.)" +"deprecated in Python 3.10: use the ``find_spec()`` method instead. See :pep:" +"`451` for the rationale. (Contributed by Victor Stinner in :gh:`94379`.)" msgstr "" #: ../../whatsnew/3.12.rst:1654 @@ -4098,20 +4074,20 @@ msgstr "其他" #: ../../whatsnew/3.12.rst:1656 msgid "" -"Remove the ``suspicious`` rule from the documentation :file:`Makefile` " -"and :file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint `_. (Contributed by Julien Palard " -"in :gh:`98179`.)" +"Remove the ``suspicious`` rule from the documentation :file:`Makefile` and :" +"file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint `_. (Contributed by Julien Palard in :gh:" +"`98179`.)" msgstr "" #: ../../whatsnew/3.12.rst:1661 msgid "" -"Remove the *keyfile* and *certfile* parameters from " -"the :mod:`ftplib`, :mod:`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, " -"and the *key_file*, *cert_file* and *check_hostname* parameters from " -"the :mod:`http.client` module, all deprecated since Python 3.6. Use the " -"*context* parameter (*ssl_context* in :mod:`imaplib`) instead. (Contributed " -"by Victor Stinner in :gh:`94172`.)" +"Remove the *keyfile* and *certfile* parameters from the :mod:`ftplib`, :mod:" +"`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, and the *key_file*, " +"*cert_file* and *check_hostname* parameters from the :mod:`http.client` " +"module, all deprecated since Python 3.6. Use the *context* parameter " +"(*ssl_context* in :mod:`imaplib`) instead. (Contributed by Victor Stinner " +"in :gh:`94172`.)" msgstr "" #: ../../whatsnew/3.12.rst:1669 @@ -4124,8 +4100,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1672 msgid "" -"Remove ``_use_broken_old_ctypes_structure_semantics_`` flag " -"from :mod:`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" +"Remove ``_use_broken_old_ctypes_structure_semantics_`` flag from :mod:" +"`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" msgstr "" "移除 :mod:`ctypes` 模組中的 ``_use_broken_old_ctypes_structure_semantics_`` " "旗標。(由 Nikita Sobolev 於 :gh:`99285` 中貢獻。)" @@ -4161,8 +4137,8 @@ msgid "" "integer values such as ``randrange(10.5)`` or ``randrange('10')`` has been " "changed from :exc:`ValueError` to :exc:`TypeError`. This also prevents bugs " "where ``randrange(1e25)`` would silently select from a larger range than " -"``randrange(10**25)``. (Originally suggested by Serhiy " -"Storchaka :gh:`86388`.)" +"``randrange(10**25)``. (Originally suggested by Serhiy Storchaka :gh:" +"`86388`.)" msgstr "" #: ../../whatsnew/3.12.rst:1703 @@ -4178,8 +4154,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1709 msgid "" "Remove the ``asyncore``-based ``smtpd`` module deprecated in Python 3.4.7 " -"and 3.5.4. A recommended replacement is the :mod:`asyncio`-" -"based :pypi:`aiosmtpd` PyPI module." +"and 3.5.4. A recommended replacement is the :mod:`asyncio`-based :pypi:" +"`aiosmtpd` PyPI module." msgstr "" #: ../../whatsnew/3.12.rst:1713 @@ -4191,10 +4167,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:1718 msgid "" -"The :mod:`os` module no longer accepts bytes-like paths, " -"like :class:`bytearray` and :class:`memoryview` types: only the " -"exact :class:`bytes` type is accepted for bytes strings. (Contributed by " -"Victor Stinner in :gh:`98393`.)" +"The :mod:`os` module no longer accepts bytes-like paths, like :class:" +"`bytearray` and :class:`memoryview` types: only the exact :class:`bytes` " +"type is accepted for bytes strings. (Contributed by Victor Stinner in :gh:" +"`98393`.)" msgstr "" #: ../../whatsnew/3.12.rst:1723 @@ -4223,23 +4199,21 @@ msgstr "" #: ../../whatsnew/3.12.rst:1745 msgid "" -"When extracting tar files using :mod:`tarfile` " -"or :func:`shutil.unpack_archive`, pass the *filter* argument to limit " -"features that may be surprising or dangerous. See :ref:`tarfile-extraction-" -"filter` for details." +"When extracting tar files using :mod:`tarfile` or :func:`shutil." +"unpack_archive`, pass the *filter* argument to limit features that may be " +"surprising or dangerous. See :ref:`tarfile-extraction-filter` for details." msgstr "" #: ../../whatsnew/3.12.rst:1750 msgid "" -"The output of the :func:`tokenize.tokenize` " -"and :func:`tokenize.generate_tokens` functions is now changed due to the " -"changes introduced in :pep:`701`. This means that ``STRING`` tokens are not " -"emitted any more for f-strings and the tokens described in :pep:`701` are " -"now produced instead: ``FSTRING_START``, ``FSTRING_MIDDLE`` and " -"``FSTRING_END`` are now emitted for f-string \"string\" parts in addition to " -"the appropriate tokens for the tokenization in the expression components. " -"For example for the f-string ``f\"start {1+1} end\"`` the old version of the " -"tokenizer emitted::" +"The output of the :func:`tokenize.tokenize` and :func:`tokenize." +"generate_tokens` functions is now changed due to the changes introduced in :" +"pep:`701`. This means that ``STRING`` tokens are not emitted any more for f-" +"strings and the tokens described in :pep:`701` are now produced instead: " +"``FSTRING_START``, ``FSTRING_MIDDLE`` and ``FSTRING_END`` are now emitted " +"for f-string \"string\" parts in addition to the appropriate tokens for the " +"tokenization in the expression components. For example for the f-string " +"``f\"start {1+1} end\"`` the old version of the tokenizer emitted::" msgstr "" #: ../../whatsnew/3.12.rst:1759 @@ -4344,11 +4318,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:1815 msgid "" -"Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to " -"override :mod:`compileall` options (default: ``-j0``) in ``make install``. " -"Also merged the 3 ``compileall`` commands into a single command to " -"build .pyc files for all optimization levels (0, 1, 2) at once. (Contributed " -"by Victor Stinner in :gh:`99289`.)" +"Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to override :mod:" +"`compileall` options (default: ``-j0``) in ``make install``. Also merged the " +"3 ``compileall`` commands into a single command to build .pyc files for all " +"optimization levels (0, 1, 2) at once. (Contributed by Victor Stinner in :gh:" +"`99289`.)" msgstr "" #: ../../whatsnew/3.12.rst:1821 @@ -4377,9 +4351,8 @@ msgstr "``PYTHON_FOR_REGEN`` 現在需要 Python 3.10 或更新的版本。" #: ../../whatsnew/3.12.rst:1831 msgid "" -"Autoconf 2.71 and aclocal 1.16.4 is now required to " -"regenerate :file:`configure`. (Contributed by Christian Heimes " -"in :gh:`89886`.)" +"Autoconf 2.71 and aclocal 1.16.4 is now required to regenerate :file:" +"`configure`. (Contributed by Christian Heimes in :gh:`89886`.)" msgstr "" #: ../../whatsnew/3.12.rst:1835 @@ -4468,8 +4441,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1875 msgid "" ":c:macro:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData` added " -"to allow safely extending certain variable-sized types, " -"including :c:var:`PyType_Type`." +"to allow safely extending certain variable-sized types, including :c:var:" +"`PyType_Type`." msgstr "" #: ../../whatsnew/3.12.rst:1878 @@ -4484,10 +4457,10 @@ msgstr "(由 Petr Viktorin 於 :gh:`103509` 中貢獻。)" #: ../../whatsnew/3.12.rst:1883 msgid "" -"Add the new :ref:`limited C API ` " -"function :c:func:`PyType_FromMetaclass`, which generalizes the " -"existing :c:func:`PyType_FromModuleAndSpec` using an additional metaclass " -"argument. (Contributed by Wenzel Jakob in :gh:`93012`.)" +"Add the new :ref:`limited C API ` function :c:func:" +"`PyType_FromMetaclass`, which generalizes the existing :c:func:" +"`PyType_FromModuleAndSpec` using an additional metaclass argument. " +"(Contributed by Wenzel Jakob in :gh:`93012`.)" msgstr "" #: ../../whatsnew/3.12.rst:1888 @@ -4519,16 +4492,16 @@ msgid "" "makes vectorcall safe to use with mutable types (i.e. heap types without the " "immutable flag, :c:macro:`Py_TPFLAGS_IMMUTABLETYPE`). Mutable types that do " "not override :c:member:`~PyTypeObject.tp_call` now inherit the " -"``Py_TPFLAGS_HAVE_VECTORCALL`` flag. (Contributed by Petr Viktorin " -"in :gh:`93274`.)" +"``Py_TPFLAGS_HAVE_VECTORCALL`` flag. (Contributed by Petr Viktorin in :gh:" +"`93274`.)" msgstr "" #: ../../whatsnew/3.12.rst:1905 msgid "" -"The :c:macro:`Py_TPFLAGS_MANAGED_DICT` " -"and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows " -"extensions classes to support object :attr:`~object.__dict__` and weakrefs " -"with less bookkeeping, using less memory and with faster access." +"The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " +"classes to support object :attr:`~object.__dict__` and weakrefs with less " +"bookkeeping, using less memory and with faster access." msgstr "" #: ../../whatsnew/3.12.rst:1910 @@ -4558,9 +4531,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1922 msgid "" -"Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` " -"and :c:func:`PyEval_SetTraceAllThreads`, that allow to set tracing and " -"profiling functions in all running threads in addition to the calling one. " +"Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` and :c:" +"func:`PyEval_SetTraceAllThreads`, that allow to set tracing and profiling " +"functions in all running threads in addition to the calling one. " "(Contributed by Pablo Galindo in :gh:`93503`.)" msgstr "" @@ -4573,11 +4546,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:1932 msgid "" -"The C API now permits registering callbacks " -"via :c:func:`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to " -"be called whenever a dictionary is modified. This is intended for use by " -"optimizing interpreters, JIT compilers, or debuggers. (Contributed by Carl " -"Meyer in :gh:`91052`.)" +"The C API now permits registering callbacks via :c:func:" +"`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to be called " +"whenever a dictionary is modified. This is intended for use by optimizing " +"interpreters, JIT compilers, or debuggers. (Contributed by Carl Meyer in :gh:" +"`91052`.)" msgstr "" #: ../../whatsnew/3.12.rst:1938 @@ -4597,18 +4570,18 @@ msgstr "" #: ../../whatsnew/3.12.rst:1947 msgid "" "Add :c:func:`PyFrame_GetVar` and :c:func:`PyFrame_GetVarString` functions to " -"get a frame variable by its name. (Contributed by Victor Stinner " -"in :gh:`91248`.)" +"get a frame variable by its name. (Contributed by Victor Stinner in :gh:" +"`91248`.)" msgstr "" #: ../../whatsnew/3.12.rst:1951 msgid "" -"Add :c:func:`PyErr_GetRaisedException` " -"and :c:func:`PyErr_SetRaisedException` for saving and restoring the current " -"exception. These functions return and accept a single exception object, " -"rather than the triple arguments of the now-deprecated :c:func:`PyErr_Fetch` " -"and :c:func:`PyErr_Restore`. This is less error prone and a bit more " -"efficient. (Contributed by Mark Shannon in :gh:`101578`.)" +"Add :c:func:`PyErr_GetRaisedException` and :c:func:" +"`PyErr_SetRaisedException` for saving and restoring the current exception. " +"These functions return and accept a single exception object, rather than the " +"triple arguments of the now-deprecated :c:func:`PyErr_Fetch` and :c:func:" +"`PyErr_Restore`. This is less error prone and a bit more efficient. " +"(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:1959 @@ -4621,9 +4594,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1963 msgid "" "Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs` as " -"convenience functions for retrieving and modifying " -"the :attr:`~BaseException.args` passed to the exception's constructor. " -"(Contributed by Mark Shannon in :gh:`101578`.)" +"convenience functions for retrieving and modifying the :attr:`~BaseException." +"args` passed to the exception's constructor. (Contributed by Mark Shannon " +"in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:1968 @@ -4692,22 +4665,21 @@ msgstr "(由 Eddie Elizondo 於 :gh:`84436` 中貢獻。)" #: ../../whatsnew/3.12.rst:1992 msgid "" -":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function " -"and :c:type:`PyInterpreterConfig`, which may be used to create sub-" -"interpreters with their own GILs. (See :ref:`whatsnew312-pep684` for more " -"info.) (Contributed by Eric Snow in :gh:`104110`.)" +":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function and :" +"c:type:`PyInterpreterConfig`, which may be used to create sub-interpreters " +"with their own GILs. (See :ref:`whatsnew312-pep684` for more info.) " +"(Contributed by Eric Snow in :gh:`104110`.)" msgstr "" -":pep:`684`:新增新的 :c:func:`Py_NewInterpreterFromConfig` 函式" -"和 :c:type:`PyInterpreterConfig`,它們可用於建立具有自己的 GIL 的子直譯器。" -"(有關更多資訊,請參閱 :ref:`whatsnew312-pep684`。)(由 Eric Snow " -"在 :gh:`104110` 中貢獻。)" +":pep:`684`:新增新的 :c:func:`Py_NewInterpreterFromConfig` 函式和 :c:type:" +"`PyInterpreterConfig`,它們可用於建立具有自己的 GIL 的子直譯器。(有關更多資" +"訊,請參閱 :ref:`whatsnew312-pep684`。)(由 Eric Snow 在 :gh:`104110` 中貢" +"獻。)" #: ../../whatsnew/3.12.rst:1998 msgid "" -"In the limited C API version 3.12, :c:func:`Py_INCREF` " -"and :c:func:`Py_DECREF` functions are now implemented as opaque function " -"calls to hide implementation details. (Contributed by Victor Stinner " -"in :gh:`105387`.)" +"In the limited C API version 3.12, :c:func:`Py_INCREF` and :c:func:" +"`Py_DECREF` functions are now implemented as opaque function calls to hide " +"implementation details. (Contributed by Victor Stinner in :gh:`105387`.)" msgstr "" #: ../../whatsnew/3.12.rst:2006 @@ -4742,9 +4714,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:2025 msgid "" -"To get a list of subclasses, call the Python " -"method :py:meth:`~type.__subclasses__` (using :c:func:`PyObject_CallMethod`, " -"for example)." +"To get a list of subclasses, call the Python method :py:meth:`~type." +"__subclasses__` (using :c:func:`PyObject_CallMethod`, for example)." msgstr "" #: ../../whatsnew/3.12.rst:2029 @@ -4752,38 +4723,37 @@ msgid "" "Add support of more formatting options (left aligning, octals, uppercase " "hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C " "strings, variable width and precision) in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Serhiy Storchaka " -"in :gh:`98836`.)" +"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Serhiy Storchaka in :gh:" +"`98836`.)" msgstr "" #: ../../whatsnew/3.12.rst:2035 msgid "" -"An unrecognized format character in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In " -"previous versions it caused all the rest of the format string to be copied " -"as-is to the result string, and any extra arguments discarded. (Contributed " -"by Serhiy Storchaka in :gh:`95781`.)" +"An unrecognized format character in :c:func:`PyUnicode_FromFormat` and :c:" +"func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In previous " +"versions it caused all the rest of the format string to be copied as-is to " +"the result string, and any extra arguments discarded. (Contributed by Serhiy " +"Storchaka in :gh:`95781`.)" msgstr "" #: ../../whatsnew/3.12.rst:2041 msgid "" -"Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Philip Georgi " -"in :gh:`95504`.)" +"Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` and :c:func:" +"`PyUnicode_FromFormatV`. (Contributed by Philip Georgi in :gh:`95504`.)" msgstr "" #: ../../whatsnew/3.12.rst:2045 msgid "" "Extension classes wanting to add a :attr:`~object.__dict__` or weak " -"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` " -"and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " +"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " "``tp_weaklistoffset``, respectively. The use of ``tp_dictoffset`` and " "``tp_weaklistoffset`` is still supported, but does not fully support " "multiple inheritance (:gh:`95589`), and performance may be worse. Classes " "declaring :c:macro:`Py_TPFLAGS_MANAGED_DICT` must call :c:func:`!" "_PyObject_VisitManagedDict` and :c:func:`!_PyObject_ClearManagedDict` to " -"traverse and clear their instance's dictionaries. To clear weakrefs, " -"call :c:func:`PyObject_ClearWeakRefs`, as before." +"traverse and clear their instance's dictionaries. To clear weakrefs, call :c:" +"func:`PyObject_ClearWeakRefs`, as before." msgstr "" #: ../../whatsnew/3.12.rst:2057 @@ -4804,10 +4774,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:2067 msgid "" -"The interpreter's error indicator is now always normalized. This means " -"that :c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other " -"functions that set the error indicator now normalize the exception before " -"storing it. (Contributed by Mark Shannon in :gh:`101578`.)" +"The interpreter's error indicator is now always normalized. This means that :" +"c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other functions " +"that set the error indicator now normalize the exception before storing it. " +"(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:2072 @@ -4847,8 +4817,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:2089 msgid "" "Note that :c:func:`PyType_FromMetaclass` (added in Python 3.12) already " -"disallows creating classes whose metaclass overrides ``tp_new`` " -"(:meth:`~object.__new__` in Python)." +"disallows creating classes whose metaclass overrides ``tp_new`` (:meth:" +"`~object.__new__` in Python)." msgstr "" #: ../../whatsnew/3.12.rst:2093 @@ -4866,16 +4836,16 @@ msgstr "" #: ../../whatsnew/3.12.rst:2102 msgid "" -"If initialization can be skipped, it can be done " -"in :c:member:`~PyTypeObject.tp_init` instead." +"If initialization can be skipped, it can be done in :c:member:`~PyTypeObject." +"tp_init` instead." msgstr "" #: ../../whatsnew/3.12.rst:2104 msgid "" "If the metaclass doesn't need to be instantiated from Python, set its " -"``tp_new`` to ``NULL`` using " -"the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag. This makes it " -"acceptable for ``PyType_From*`` functions." +"``tp_new`` to ``NULL`` using the :c:macro:" +"`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag. This makes it acceptable for " +"``PyType_From*`` functions." msgstr "" #: ../../whatsnew/3.12.rst:2109 @@ -4911,10 +4881,10 @@ msgid "" ":c:struct:`PyLongObject` has had its internals changed for better " "performance. Although the internals of :c:struct:`PyLongObject` are private, " "they are used by some extension modules. The internal fields should no " -"longer be accessed directly, instead the API functions beginning " -"``PyLong_...`` should be used instead. Two new *unstable* API functions are " -"provided for efficient access to the value of :c:struct:`PyLongObject`\\s " -"which fit into a single machine word:" +"longer be accessed directly, instead the API functions beginning ``PyLong_..." +"`` should be used instead. Two new *unstable* API functions are provided for " +"efficient access to the value of :c:struct:`PyLongObject`\\s which fit into " +"a single machine word:" msgstr "" #: ../../whatsnew/3.12.rst:2133 @@ -4936,11 +4906,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:2146 msgid "" -"In accordance with :pep:`699`, the ``ma_version_tag`` field " -"in :c:type:`PyDictObject` is deprecated for extension modules. Accessing " -"this field will generate a compiler warning at compile time. This field will " -"be removed in Python 3.14. (Contributed by Ramvikrams and Kumar Aditya " -"in :gh:`101193`. PEP by Ken Jin.)" +"In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:" +"`PyDictObject` is deprecated for extension modules. Accessing this field " +"will generate a compiler warning at compile time. This field will be removed " +"in Python 3.14. (Contributed by Ramvikrams and Kumar Aditya in :gh:`101193`. " +"PEP by Ken Jin.)" msgstr "" #: ../../whatsnew/3.12.rst:2151 @@ -4990,8 +4960,8 @@ msgstr "" msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`" msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment`" +":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." +"use_environment`" #: ../../whatsnew/3.12.rst:2163 msgid "" @@ -5003,8 +4973,8 @@ msgstr "" msgid "" ":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`" msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory`" +":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." +"user_site_directory`" #: ../../whatsnew/3.12.rst:2165 msgid "" @@ -5026,57 +4996,56 @@ msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`" #: ../../whatsnew/3.12.rst:2169 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"use :c:member:`PyPreConfig.legacy_windows_fs_encoding`" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`" msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`" #: ../../whatsnew/3.12.rst:2170 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"use :c:member:`PyConfig.legacy_windows_stdio`" +":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." +"legacy_windows_stdio`" msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`" +":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." +"legacy_windows_stdio`" #: ../../whatsnew/3.12.rst:2171 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: " -"use :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." +"filesystem_encoding`" msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`" #: ../../whatsnew/3.12.rst:2172 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: " -"use :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." +"filesystem_encoding`" msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`" #: ../../whatsnew/3.12.rst:2173 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"use :c:member:`PyConfig.filesystem_errors`" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." +"filesystem_errors`" msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors`" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." +"filesystem_errors`" #: ../../whatsnew/3.12.rst:2174 msgid "" -":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:" +"`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參" -"見 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參見 :c:" +"func:`Py_PreInitialize`)" #: ../../whatsnew/3.12.rst:2176 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead. (Contributed by Victor Stinner " -"in :gh:`77782`.)" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.)" msgstr "" ":c:func:`Py_InitializeFromConfig` API 應改為與 :c:type:`PyConfig` 一起使用。" "(由 Victor Stinner 於 :gh:`77782` 中貢獻。)" @@ -5102,11 +5071,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:2189 msgid "" -":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` " -"and :c:func:`PyMember_SetOne`" +":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` and :c:func:" +"`PyMember_SetOne`" msgstr "" -":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` " -"和 :c:func:`PyMember_SetOne`" +":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` 和 :c:func:" +"`PyMember_SetOne`" #: ../../whatsnew/3.12.rst:2191 msgid "" @@ -5118,11 +5087,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:2193 msgid "" -"The flags :c:macro:`Py_READONLY` (previously ``READONLY``) " -"and :c:macro:`Py_AUDIT_READ` (previously all uppercase)" +"The flags :c:macro:`Py_READONLY` (previously ``READONLY``) and :c:macro:" +"`Py_AUDIT_READ` (previously all uppercase)" msgstr "" -":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)" -"和 :c:macro:`Py_AUDIT_READ`\\ (先前全大寫)旗標" +":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)和 :c:macro:" +"`Py_AUDIT_READ`\\ (先前全大寫)旗標" #: ../../whatsnew/3.12.rst:2196 msgid "Several items are not exposed from :file:`Python.h`:" @@ -5142,17 +5111,16 @@ msgstr "不做任何事的巨集 ``WRITE_RESTRICTED``。" #: ../../whatsnew/3.12.rst:2201 msgid "" -"The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents " -"of :c:macro:`Py_AUDIT_READ`." +"The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of :c:macro:" +"`Py_AUDIT_READ`." msgstr "" -"``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當" -"於 :c:macro:`Py_AUDIT_READ`。" +"``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當於 :c:macro:" +"`Py_AUDIT_READ`。" #: ../../whatsnew/3.12.rst:2203 msgid "" -"In some configurations, ```` is not included " -"from :file:`Python.h`. It should be included manually when using " -"``offsetof()``." +"In some configurations, ```` is not included from :file:`Python." +"h`. It should be included manually when using ``offsetof()``." msgstr "" #: ../../whatsnew/3.12.rst:2206 @@ -5172,10 +5140,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:2214 msgid "" -":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. " -"Use :c:func:`PyErr_GetRaisedException` " -"and :c:func:`PyErr_SetRaisedException` instead. (Contributed by Mark Shannon " -"in :gh:`101578`.)" +":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. Use :c:" +"func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` " +"instead. (Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:2219 @@ -5196,58 +5163,57 @@ msgstr "" #: ../../whatsnew/3.12.rst:2225 msgid "" -"Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` " -"or :c:func:`PyType_FromModuleAndSpec` to create a class whose metaclass " -"overrides :c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass " -"instead." +"Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` or :c:" +"func:`PyType_FromModuleAndSpec` to create a class whose metaclass overrides :" +"c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass instead." msgstr "" -"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` " -"或 :c:func:`PyType_FromModuleAndSpec` 建立一個其元類別覆" -"寫 :c:member:`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" +"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` 或 :c:" +"func:`PyType_FromModuleAndSpec` 建立一個其元類別覆寫 :c:member:" +"`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " "(:pep:`699`; :gh:`101193`)." msgstr "" -":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " -"(:pep:`699`;:gh:`101193`)。" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" +"`699`;:gh:`101193`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 msgid "" "Creating :c:data:`immutable types ` with mutable " "bases (:gh:`95388`)." msgstr "" -"使用可變基底建立\\ :c:data:`不可變型別 ` " -"(:gh:`95388`)。" +"使用可變基底建立\\ :c:data:`不可變型別 ` (:gh:" +"`95388`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: " -"Use :c:func:`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改" -"用 :c:func:`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" +"`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " -"Use :c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project " -"`__ can be used to " -"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project `__ can be used to get :c:func:" +"`PyWeakref_GetRef` on Python 3.12 and older." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" -"用 :c:func:`PyWeakref_GetRef`。可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.12 和更早版本取" -"得 :c:func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.12 和更早版本取得 :c:func:" +"`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " -"Use :c:type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" -"用 :c:type:`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 msgid "" @@ -5262,8 +5228,8 @@ msgid "" "than :class:`str`, such as :class:`bytes`." msgstr "" ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`;請注" -"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`str` 的型別,例" -"如 :class:`bytes`。" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`str` 的型別,例如 :" +"class:`bytes`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid "" @@ -5278,8 +5244,8 @@ msgid "" "than :class:`bytes`, such as :class:`str`." msgstr "" ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`;請注" -"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`bytes` 的型別,例" -"如 :class:`str`。" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`bytes` 的型別,例如 :" +"class:`str`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 msgid "Python initialization functions, deprecated in Python 3.13:" @@ -5296,37 +5262,35 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:27 msgid "" ":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") " -"` (:data:`sys.base_prefix`) instead. " -"Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) " -"if :ref:`virtual environments ` need to be handled." +"` (:data:`sys.base_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) if :ref:" +"`virtual environments ` need to be handled." msgstr "" ":c:func:`Py_GetPrefix`:請改用 :c:func:`PyConfig_Get(\"base_prefix\") " "` (:data:`sys.base_prefix`)。如果需要處理\\ :ref:`虛擬環境 " -"`,請改用 :c:func:`PyConfig_Get(\"prefix\") ` " -"(:data:`sys.prefix`)。" +"`,請改用 :c:func:`PyConfig_Get(\"prefix\") ` (:data:" +"`sys.prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:32 msgid "" ":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") " -"` (:data:`sys.base_exec_prefix`) instead. " -"Use :c:func:`PyConfig_Get(\"exec_prefix\") ` " -"(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " -"be handled." +"` (:data:`sys.base_exec_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"exec_prefix\") ` (:data:`sys.exec_prefix`) if :" +"ref:`virtual environments ` need to be handled." msgstr "" -":c:func:`Py_GetExecPrefix`:請改" -"用 :c:func:`PyConfig_Get(\"base_exec_prefix\") ` " -"(:data:`sys.base_exec_prefix`)。如果需要處理\\ :ref:`虛擬環境 `,請" -"改用 :c:func:`PyConfig_Get(\"exec_prefix\") ` " -"(:data:`sys.exec_prefix`)。" +":c:func:`Py_GetExecPrefix`:請改用 :c:func:" +"`PyConfig_Get(\"base_exec_prefix\") ` (:data:`sys." +"base_exec_prefix`)。如果需要處理\\ :ref:`虛擬環境 `,請改用 :c:" +"func:`PyConfig_Get(\"exec_prefix\") ` (:data:`sys." +"exec_prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:38 msgid "" ":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." msgstr "" -":c:func:`Py_GetProgramFullPath`:請改" -"用 :c:func:`PyConfig_Get(\"executable\") ` " -"(:data:`sys.executable`)。" +":c:func:`Py_GetProgramFullPath`:請改用 :c:func:" +"`PyConfig_Get(\"executable\") ` (:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:41 msgid "" @@ -5381,13 +5345,13 @@ msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " -"和 :data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" +"data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:65 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." msgstr "" "應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API。" @@ -5397,108 +5361,108 @@ msgstr "全域配置變數:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:70 msgid "" -":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` " -"or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." +":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` or :c:func:" +"`PyConfig_Get(\"parser_debug\") ` instead." msgstr "" -":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug` " -"或 :c:func:`PyConfig_Get(\"parser_debug\") `。" +":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug` 或 :c:func:" +"`PyConfig_Get(\"parser_debug\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:73 msgid "" -":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` " -"or :c:func:`PyConfig_Get(\"verbose\") ` instead." +":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` or :c:func:" +"`PyConfig_Get(\"verbose\") ` instead." msgstr "" -":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose` " -"或 :c:func:`PyConfig_Get(\"verbose\") `。" +":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose` 或 :c:func:" +"`PyConfig_Get(\"verbose\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:76 msgid "" -":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` " -"or :c:func:`PyConfig_Get(\"quiet\") ` instead." +":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` or :c:func:" +"`PyConfig_Get(\"quiet\") ` instead." msgstr "" -":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet` " -"或 :c:func:`PyConfig_Get(\"quiet\") `。" +":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet` 或 :c:func:" +"`PyConfig_Get(\"quiet\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:79 msgid "" -":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` " -"or :c:func:`PyConfig_Get(\"interactive\") ` instead." +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` or :c:func:" +"`PyConfig_Get(\"interactive\") ` instead." msgstr "" -":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive` " -"或 :c:func:`PyConfig_Get(\"interactive\") `。" +":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive` 或 :c:" +"func:`PyConfig_Get(\"interactive\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:82 msgid "" -":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` " -"or :c:func:`PyConfig_Get(\"inspect\") ` instead." +":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` or :c:func:" +"`PyConfig_Get(\"inspect\") ` instead." msgstr "" -":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect` " -"或 :c:func:`PyConfig_Get(\"inspect\") `。" +":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect` 或 :c:func:" +"`PyConfig_Get(\"inspect\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:85 msgid "" -":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " -"or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` or :c:" +"func:`PyConfig_Get(\"optimization_level\") ` instead." msgstr "" -":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level` " -"或 :c:func:`PyConfig_Get(\"optimization_level\") `。" +":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level` 或 :" +"c:func:`PyConfig_Get(\"optimization_level\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:88 msgid "" -":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` " -"or :c:func:`PyConfig_Get(\"site_import\") ` instead." +":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` or :c:func:" +"`PyConfig_Get(\"site_import\") ` instead." msgstr "" -":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import` " -"或 :c:func:`PyConfig_Get(\"site_import\") `。" +":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import` 或 :c:func:" +"`PyConfig_Get(\"site_import\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:91 msgid "" -":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " -"or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` or :c:" +"func:`PyConfig_Get(\"bytes_warning\") ` instead." msgstr "" -":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning` " -"或 :c:func:`PyConfig_Get(\"bytes_warning\") `。" +":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning` 或 :" +"c:func:`PyConfig_Get(\"bytes_warning\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:94 msgid "" -":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " -"or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` or :c:" +"func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" -":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings` " -"或 :c:func:`PyConfig_Get(\"pathconfig_warnings\") `。" +":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings` 或 :" +"c:func:`PyConfig_Get(\"pathconfig_warnings\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:97 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "or :c:func:`PyConfig_Get(\"use_environment\") ` instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment` " -"或 :c:func:`PyConfig_Get(\"use_environment\") `。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." +"use_environment` 或 :c:func:`PyConfig_Get(\"use_environment\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:100 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改" -"用 :c:member:`PyConfig.write_bytecode` " -"或 :c:func:`PyConfig_Get(\"write_bytecode\") `。" +":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." +"write_bytecode` 或 :c:func:`PyConfig_Get(\"write_bytecode\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:103 msgid "" -":c:var:`Py_NoUserSiteDirectory`: " -"Use :c:member:`PyConfig.user_site_directory` " -"or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` or :c:func:`PyConfig_Get(\"user_site_directory\") " +"` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory` " -"或 :c:func:`PyConfig_Get(\"user_site_directory\") `。" +":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." +"user_site_directory` 或 :c:func:`PyConfig_Get(\"user_site_directory\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:106 msgid "" -":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " -"or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` or :" +"c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." msgstr "" ":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio` " "或 :c:func:`PyConfig_Get(\"buffered_stdio\") `。" @@ -5515,70 +5479,69 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:113 msgid "" -":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` " -"or :c:func:`PyConfig_Get(\"isolated\") ` instead." +":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` or :c:func:" +"`PyConfig_Get(\"isolated\") ` instead." msgstr "" -":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated` " -"或 :c:func:`PyConfig_Get(\"isolated\") `。" +":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated` 或 :c:func:" +"`PyConfig_Get(\"isolated\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:116 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` " -"or :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") ` " -"instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` or :c:func:" +"`PyConfig_Get(\"legacy_windows_fs_encoding\") ` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding` " -"或 :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") `。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` 或 :c:func:" +"`PyConfig_Get(\"legacy_windows_fs_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:119 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"Use :c:member:`PyConfig.legacy_windows_stdio` " -"or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") " +"` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio` " -"或 :c:func:`PyConfig_Get(\"legacy_windows_stdio\") `。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." +"legacy_windows_stdio` 或 :c:func:`PyConfig_Get(\"legacy_windows_stdio\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:122 msgid "" ":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" -"Py_HasFileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` " -"or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." +"Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` or :c:func:`PyConfig_Get(\"filesystem_encoding\") " +"` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`、:c:var:`!" -"Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding` " -"或 :c:func:`PyConfig_Get(\"filesystem_encoding\") `。" +"Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding` 或 :c:func:`PyConfig_Get(\"filesystem_encoding\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:125 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"Use :c:member:`PyConfig.filesystem_errors` " -"or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` or :c:func:`PyConfig_Get(\"filesystem_errors\") " +"` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors` " -"或 :c:func:`PyConfig_Get(\"filesystem_errors\") `。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." +"filesystem_errors` 或 :c:func:`PyConfig_Get(\"filesystem_errors\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:128 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` " -"or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` or :c:func:" +"`PyConfig_Get(\"utf8_mode\") ` instead. (see :c:func:" +"`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode` " -"或 :c:func:`PyConfig_Get(\"utf8_mode\") `。(請參" -"閱 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode` 或 :c:func:" +"`PyConfig_Get(\"utf8_mode\") `。(請參閱 :c:func:" +"`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:133 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can " -"be used to get these options at runtime." +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can be used to " +"get these options at runtime." msgstr "" "應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API 來設定" "這些選項。或者也可以使用 :c:func:`PyConfig_Get` 在執行時取得這些選項。" @@ -5606,8 +5569,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改" -"用 :c:func:`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改用 :c:func:" +"`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -5627,11 +5590,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " -"and :c:func:`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " -"和 :c:func:`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" +"`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" @@ -5653,8 +5616,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" -"叫 :c:func:`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" +"`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:29 msgid "Thread Local Storage (TLS) API:" @@ -5696,9 +5659,9 @@ msgid "" "C API. The :file:`token.h` header file was only designed to be used by " "Python internals. (Contributed by Victor Stinner in :gh:`92651`.)" msgstr "" -"移除 :file:`token.h` 標頭檔案。從未有任何公開的 tokenizer C " -"API。:file:`token.h` 標頭檔案的設計是僅限用於 Python 內部。(由 Victor " -"Stinner 於 :gh:`92651` 中貢獻。)" +"移除 :file:`token.h` 標頭檔案。從未有任何公開的 tokenizer C API。:file:" +"`token.h` 標頭檔案的設計是僅限用於 Python 內部。(由 Victor Stinner 於 :gh:" +"`92651` 中貢獻。)" #: ../../whatsnew/3.12.rst:2248 msgid "Legacy Unicode APIs have been removed. See :pep:`623` for detail." @@ -5745,5 +5708,12 @@ msgid "" "Remove the ``PyUnicode_InternImmortal()`` function macro. (Contributed by " "Victor Stinner in :gh:`85858`.)" msgstr "" -"移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner " -"於 :gh:`85858` 中貢獻。)" +"移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner 於 :gh:" +"`85858` 中貢獻。)" + +#~ msgid "" +#~ ":mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9, " +#~ "now causes a :exc:`DeprecationWarning` to be emitted when it is used." +#~ msgstr "" +#~ ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`!typing.ByteString` 現在" +#~ "在使用時會發出 :exc:`DeprecationWarning`。" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index a48e3cc151e..82dd87b1984 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "Adam Turner 和 Thomas Wouters" #: ../../whatsnew/3.13.rst:48 msgid "" "This article explains the new features in Python 3.13, compared to 3.12. " -"Python 3.13 was released on October 7, 2024. For full details, see " -"the :ref:`changelog `." +"Python 3.13 was released on October 7, 2024. For full details, see the :ref:" +"`changelog `." msgstr "" "本文介紹了 Python 3.13 與 3.12 相比多了哪些新功能。Python 3.13 已於 2024 年 " "10 月 7 日發布。完整詳情請見 :ref:`changelog `。" @@ -51,9 +51,9 @@ msgid "" "with a mix of changes to the language, the implementation and the standard " "library. The biggest changes include a new `interactive interpreter " "`_, experimental support for " -"running in a `free-threaded mode `_ " -"(:pep:`703`), and a `Just-In-Time compiler `_ " -"(:pep:`744`)." +"running in a `free-threaded mode `_ (:" +"pep:`703`), and a `Just-In-Time compiler `_ (:pep:" +"`744`)." msgstr "" #: ../../whatsnew/3.13.rst:72 @@ -76,8 +76,8 @@ msgstr "" msgid "" "This article doesn't attempt to provide a complete specification of all new " "features, but instead gives a convenient overview. For full details refer to " -"the documentation, such as the :ref:`Library Reference ` " -"and :ref:`Language Reference `. To understand the complete " +"the documentation, such as the :ref:`Library Reference ` and :" +"ref:`Language Reference `. To understand the complete " "implementation and design rationale for a change, refer to the PEP for a " "particular new feature; but note that PEPs usually are not kept up-to-date " "once a feature has been fully implemented. See `Porting to Python 3.13`_ for " @@ -105,9 +105,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:108 msgid "" -":pep:`703`: CPython 3.13 has experimental support for running with " -"the :term:`global interpreter lock` disabled. See :ref:`Free-threaded " -"CPython ` for more details." +":pep:`703`: CPython 3.13 has experimental support for running with the :term:" +"`global interpreter lock` disabled. See :ref:`Free-threaded CPython " +"` for more details." msgstr "" #: ../../whatsnew/3.13.rst:111 @@ -168,8 +168,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:137 msgid "" "The :mod:`copy` module now has a :func:`copy.replace` function, with support " -"for many builtin types and any class defining " -"the :func:`~object.__replace__` method." +"for many builtin types and any class defining the :func:`~object." +"__replace__` method." msgstr "" #: ../../whatsnew/3.13.rst:140 @@ -195,9 +195,9 @@ msgstr "安全性改進:" #: ../../whatsnew/3.13.rst:147 msgid "" -":func:`ssl.create_default_context` " -"sets :data:`ssl.VERIFY_X509_PARTIAL_CHAIN` " -"and :data:`ssl.VERIFY_X509_STRICT` as default flags." +":func:`ssl.create_default_context` sets :data:`ssl." +"VERIFY_X509_PARTIAL_CHAIN` and :data:`ssl.VERIFY_X509_STRICT` as default " +"flags." msgstr "" #: ../../whatsnew/3.13.rst:150 @@ -223,8 +223,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:157 msgid "" -"There is a new :ref:`suite of functions ` for " -"generating :pep:`669` monitoring events in the C API." +"There is a new :ref:`suite of functions ` for generating :" +"pep:`669` monitoring events in the C API." msgstr "" #: ../../whatsnew/3.13.rst:160 @@ -233,9 +233,8 @@ msgstr "新增型別特性:" #: ../../whatsnew/3.13.rst:162 msgid "" -":pep:`696`: Type parameters " -"(:data:`typing.TypeVar`, :data:`typing.ParamSpec`, " -"and :data:`typing.TypeVarTuple`) now support defaults." +":pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing." +"ParamSpec`, and :data:`typing.TypeVarTuple`) now support defaults." msgstr "" #: ../../whatsnew/3.13.rst:164 @@ -246,8 +245,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:166 msgid "" -":pep:`705`: :data:`typing.ReadOnly` can be used to mark an item of " -"a :class:`typing.TypedDict` as read-only for type checkers." +":pep:`705`: :data:`typing.ReadOnly` can be used to mark an item of a :class:" +"`typing.TypedDict` as read-only for type checkers." msgstr "" #: ../../whatsnew/3.13.rst:168 @@ -287,19 +286,20 @@ msgstr "重要的移除:" #: ../../whatsnew/3.13.rst:182 msgid "" -":ref:`PEP 594 `: The remaining 19 \"dead batteries\" " -"(legacy stdlib modules) have been removed from the standard library: :mod:`!" -"aifc`, :mod:`!audioop`, :mod:`!cgi`, :mod:`!cgitb`, :mod:`!chunk`, :mod:`!" -"crypt`, :mod:`!imghdr`, :mod:`!mailcap`, :mod:`!msilib`, :mod:`!nis`, :mod:`!" -"nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!sndhdr`, :mod:`!" -"spwd`, :mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:`!xdrlib`." +":ref:`PEP 594 `: The remaining 19 \"dead " +"batteries\" (legacy stdlib modules) have been removed from the standard " +"library: :mod:`!aifc`, :mod:`!audioop`, :mod:`!cgi`, :mod:`!cgitb`, :mod:`!" +"chunk`, :mod:`!crypt`, :mod:`!imghdr`, :mod:`!mailcap`, :mod:`!msilib`, :mod:" +"`!nis`, :mod:`!nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!" +"sndhdr`, :mod:`!spwd`, :mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:" +"`!xdrlib`." msgstr "" ":ref:`PEP 594 `: 剩下的 19 個 \"dead batteries\" (遺留標" "準函式庫模組)已自標準函式庫中移除::mod:`!aifc`、:mod:`!audioop`、:mod:`!" "cgi`、:mod:`!cgitb`、:mod:`!chunk`、:mod:`!crypt`、:mod:`!imghdr`、:mod:`!" "mailcap`、:mod:`!msilib`、:mod:`!nis`、:mod:`!nntplib`、:mod:`!" -"ossaudiodev`、:mod:`!pipes`、:mod:`!sndhdr`、:mod:`!spwd`、:mod:`!" -"sunau`、:mod:`!telnetlib`、:mod:`!uu` 和 :mod:`!xdrlib`." +"ossaudiodev`、:mod:`!pipes`、:mod:`!sndhdr`、:mod:`!spwd`、:mod:`!sunau`、:" +"mod:`!telnetlib`、:mod:`!uu` 和 :mod:`!xdrlib`." #: ../../whatsnew/3.13.rst:188 msgid "" @@ -384,8 +384,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:228 msgid "" -"History browsing using :kbd:`F2` that skips output as well as " -"the :term:`>>>` and :term:`...` prompts." +"History browsing using :kbd:`F2` that skips output as well as the :term:" +"`>>>` and :term:`...` prompts." msgstr "" #: ../../whatsnew/3.13.rst:230 @@ -701,35 +701,35 @@ msgstr "" #: ../../whatsnew/3.13.rst:423 msgid "" -"Historically, the expected result of mutating the return value " -"of :func:`locals` has been left to individual Python implementations to " -"define. Starting from Python 3.13, :pep:`667` standardises the historical " -"behavior of CPython for most code execution scopes, but " -"changes :term:`optimized scopes ` (functions, generators, " -"coroutines, comprehensions, and generator expressions) to explicitly return " -"independent snapshots of the currently assigned local variables, including " -"locally referenced nonlocal variables captured in closures." +"Historically, the expected result of mutating the return value of :func:" +"`locals` has been left to individual Python implementations to define. " +"Starting from Python 3.13, :pep:`667` standardises the historical behavior " +"of CPython for most code execution scopes, but changes :term:`optimized " +"scopes ` (functions, generators, coroutines, " +"comprehensions, and generator expressions) to explicitly return independent " +"snapshots of the currently assigned local variables, including locally " +"referenced nonlocal variables captured in closures." msgstr "" #: ../../whatsnew/3.13.rst:432 msgid "" "This change to the semantics of :func:`locals` in optimized scopes also " "affects the default behavior of code execution functions that implicitly " -"target :func:`!locals` if no explicit namespace is provided (such " -"as :func:`exec` and :func:`eval`). In previous versions, whether or not " -"changes could be accessed by calling :func:`!locals` after calling the code " -"execution function was implementation-dependent. In CPython specifically, " -"such code would typically appear to work as desired, but could sometimes " -"fail in optimized scopes based on other code (including debuggers and code " -"execution tracing tools) potentially resetting the shared snapshot in that " -"scope. Now, the code will always run against an independent snapshot of the " -"local variables in optimized scopes, and hence the changes will never be " -"visible in subsequent calls to :func:`!locals`. To access the changes made " -"in these cases, an explicit namespace reference must now be passed to the " -"relevant function. Alternatively, it may make sense to update affected code " -"to use a higher level code execution API that returns the resulting code " -"execution namespace (e.g. :func:`runpy.run_path` when executing Python files " -"from disk)." +"target :func:`!locals` if no explicit namespace is provided (such as :func:" +"`exec` and :func:`eval`). In previous versions, whether or not changes could " +"be accessed by calling :func:`!locals` after calling the code execution " +"function was implementation-dependent. In CPython specifically, such code " +"would typically appear to work as desired, but could sometimes fail in " +"optimized scopes based on other code (including debuggers and code execution " +"tracing tools) potentially resetting the shared snapshot in that scope. Now, " +"the code will always run against an independent snapshot of the local " +"variables in optimized scopes, and hence the changes will never be visible " +"in subsequent calls to :func:`!locals`. To access the changes made in these " +"cases, an explicit namespace reference must now be passed to the relevant " +"function. Alternatively, it may make sense to update affected code to use a " +"higher level code execution API that returns the resulting code execution " +"namespace (e.g. :func:`runpy.run_path` when executing Python files from " +"disk)." msgstr "" #: ../../whatsnew/3.13.rst:451 @@ -745,16 +745,16 @@ msgstr "" #: ../../whatsnew/3.13.rst:457 msgid "" "See :pep:`667` for more details, including related C API changes and " -"deprecations. Porting notes are also provided below for the " -"affected :ref:`Python APIs ` and :ref:`C APIs " -"`." +"deprecations. Porting notes are also provided below for the affected :ref:" +"`Python APIs ` and :ref:`C APIs `." msgstr "" #: ../../whatsnew/3.13.rst:462 msgid "" -"(PEP and implementation contributed by Mark Shannon and Tian Gao " -"in :gh:`74929`. Documentation updates provided by Guido van Rossum and " -"Alyssa Coghlan.)" +"(PEP and implementation contributed by Mark Shannon and Tian Gao in :gh:" +"`74929`. Documentation updates provided by Guido van Rossum and Alyssa " +"Coghlan.)" msgstr "" #: ../../whatsnew/3.13.rst:470 @@ -849,8 +849,8 @@ msgstr "" msgid "" ":keyword:`global` declarations are now permitted in :keyword:`except` blocks " "when that global is used in the :keyword:`else` block. Previously this " -"raised an erroneous :exc:`SyntaxError`. (Contributed by Irit Katriel " -"in :gh:`111123`.)" +"raised an erroneous :exc:`SyntaxError`. (Contributed by Irit Katriel in :gh:" +"`111123`.)" msgstr "" #: ../../whatsnew/3.13.rst:540 @@ -866,15 +866,15 @@ msgid "" "Add :ref:`support for the perf profiler ` working without " "`frame pointers `_ through the new " "environment variable :envvar:`PYTHON_PERF_JIT_SUPPORT` and command-line " -"option :option:`-X perf_jit <-X>`. (Contributed by Pablo Galindo " -"in :gh:`118518`.)" +"option :option:`-X perf_jit <-X>`. (Contributed by Pablo Galindo in :gh:" +"`118518`.)" msgstr "" #: ../../whatsnew/3.13.rst:551 msgid "" -"The location of a :file:`.python_history` file can be changed via the " -"new :envvar:`PYTHON_HISTORY` environment variable. (Contributed by Levi " -"Sabah, Zackery Spytz and Hugo van Kemenade in :gh:`73965`.)" +"The location of a :file:`.python_history` file can be changed via the new :" +"envvar:`PYTHON_HISTORY` environment variable. (Contributed by Levi Sabah, " +"Zackery Spytz and Hugo van Kemenade in :gh:`73965`.)" msgstr "" #: ../../whatsnew/3.13.rst:556 @@ -895,15 +895,15 @@ msgstr "" #: ../../whatsnew/3.13.rst:565 msgid "" "The :func:`exec` and :func:`eval` builtins now accept the *globals* and " -"*locals* arguments as keywords. (Contributed by Raphael Gaschignard " -"in :gh:`105879`)" +"*locals* arguments as keywords. (Contributed by Raphael Gaschignard in :gh:" +"`105879`)" msgstr "" #: ../../whatsnew/3.13.rst:569 msgid "" -"The :func:`compile` builtin now accepts a new flag, " -"``ast.PyCF_OPTIMIZED_AST``, which is similar to ``ast.PyCF_ONLY_AST`` except " -"that the returned AST is optimized according to the value of the *optimize* " +"The :func:`compile` builtin now accepts a new flag, ``ast." +"PyCF_OPTIMIZED_AST``, which is similar to ``ast.PyCF_ONLY_AST`` except that " +"the returned AST is optimized according to the value of the *optimize* " "argument. (Contributed by Irit Katriel in :gh:`108113`)." msgstr "" @@ -915,10 +915,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:578 msgid "" -"Add :exc:`PythonFinalizationError`, a new exception derived " -"from :exc:`RuntimeError` and used to signal when operations are blocked " -"during :term:`finalization `. The following callables " -"now raise :exc:`!PythonFinalizationError`, instead of :exc:`RuntimeError`:" +"Add :exc:`PythonFinalizationError`, a new exception derived from :exc:" +"`RuntimeError` and used to signal when operations are blocked during :term:" +"`finalization `. The following callables now raise :" +"exc:`!PythonFinalizationError`, instead of :exc:`RuntimeError`:" msgstr "" #: ../../whatsnew/3.13.rst:584 @@ -946,8 +946,8 @@ msgid "" "Allow the *count* argument of :meth:`str.replace` to be a keyword. " "(Contributed by Hugo van Kemenade in :gh:`106487`.)" msgstr "" -"允許 :meth:`str.replace` 的 *count* 引數為關鍵字。(由 Hugo van Kemenade " -"在 :gh:`106487` 中貢獻。)" +"允許 :meth:`str.replace` 的 *count* 引數為關鍵字。(由 Hugo van Kemenade 在 :" +"gh:`106487` 中貢獻。)" #: ../../whatsnew/3.13.rst:594 msgid "" @@ -959,9 +959,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:599 msgid "" "Added :attr:`!name` and :attr:`!mode` attributes for compressed and archived " -"file-like objects in the :mod:`bz2`, :mod:`lzma`, :mod:`tarfile`, " -"and :mod:`zipfile` modules. (Contributed by Serhiy Storchaka " -"in :gh:`115961`.)" +"file-like objects in the :mod:`bz2`, :mod:`lzma`, :mod:`tarfile`, and :mod:" +"`zipfile` modules. (Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" #: ../../whatsnew/3.13.rst:606 @@ -984,10 +983,10 @@ msgstr "argparse" #: ../../whatsnew/3.13.rst:619 msgid "" -"Add the *deprecated* parameter to " -"the :meth:`~argparse.ArgumentParser.add_argument` and :meth:`!add_parser` " -"methods, to enable deprecating command-line options, positional arguments, " -"and subcommands. (Contributed by Serhiy Storchaka in :gh:`83648`.)" +"Add the *deprecated* parameter to the :meth:`~argparse.ArgumentParser." +"add_argument` and :meth:`!add_parser` methods, to enable deprecating command-" +"line options, positional arguments, and subcommands. (Contributed by Serhiy " +"Storchaka in :gh:`83648`.)" msgstr "" #: ../../whatsnew/3.13.rst:627 @@ -1041,14 +1040,14 @@ msgstr "" #: ../../whatsnew/3.13.rst:660 msgid "" "These changes do not apply to user-defined subclasses of :class:`ast.AST` " -"unless the class opts in to the new behavior by defining " -"the :attr:`.AST._field_types` mapping." +"unless the class opts in to the new behavior by defining the :attr:`.AST." +"_field_types` mapping." msgstr "" #: ../../whatsnew/3.13.rst:664 msgid "" -"(Contributed by Jelle Zijlstra in :gh:`105858`, :gh:`117486`, " -"and :gh:`118851`.)" +"(Contributed by Jelle Zijlstra in :gh:`105858`, :gh:`117486`, and :gh:" +"`118851`.)" msgstr "" #: ../../whatsnew/3.13.rst:666 @@ -1064,19 +1063,19 @@ msgstr "asyncio" #: ../../whatsnew/3.13.rst:675 msgid "" -":func:`asyncio.as_completed` now returns an object that is both " -"an :term:`asynchronous iterator` and a plain :term:`iterator` " -"of :term:`awaitables `. The awaitables yielded by asynchronous " -"iteration include original task or future objects that were passed in, " -"making it easier to associate results with the tasks being completed. " -"(Contributed by Justin Arthur in :gh:`77714`.)" +":func:`asyncio.as_completed` now returns an object that is both an :term:" +"`asynchronous iterator` and a plain :term:`iterator` of :term:`awaitables " +"`. The awaitables yielded by asynchronous iteration include " +"original task or future objects that were passed in, making it easier to " +"associate results with the tasks being completed. (Contributed by Justin " +"Arthur in :gh:`77714`.)" msgstr "" #: ../../whatsnew/3.13.rst:683 msgid "" ":meth:`asyncio.loop.create_unix_server` will now automatically remove the " -"Unix socket when the server is closed. (Contributed by Pierre Ossman " -"in :gh:`111246`.)" +"Unix socket when the server is closed. (Contributed by Pierre Ossman in :gh:" +"`111246`.)" msgstr "" #: ../../whatsnew/3.13.rst:687 @@ -1089,9 +1088,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:693 msgid "" -"Add :meth:`Queue.shutdown ` " -"and :exc:`~asyncio.QueueShutDown` to manage queue termination. (Contributed " -"by Laurie Opperman and Yves Duprat in :gh:`104228`.)" +"Add :meth:`Queue.shutdown ` and :exc:`~asyncio." +"QueueShutDown` to manage queue termination. (Contributed by Laurie Opperman " +"and Yves Duprat in :gh:`104228`.)" msgstr "" #: ../../whatsnew/3.13.rst:697 @@ -1104,8 +1103,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:701 msgid "" "Accept a tuple of separators in :meth:`.StreamReader.readuntil`, stopping " -"when any one of them is encountered. (Contributed by Bruce Merry " -"in :gh:`81322`.)" +"when any one of them is encountered. (Contributed by Bruce Merry in :gh:" +"`81322`.)" msgstr "" #: ../../whatsnew/3.13.rst:705 @@ -1120,10 +1119,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:712 msgid "" "In the case where a task group is cancelled externally and also must raise " -"an :exc:`ExceptionGroup`, it will now call the parent " -"task's :meth:`~asyncio.Task.cancel` method. This ensures that " -"a :exc:`~asyncio.CancelledError` will be raised at the " -"next :keyword:`await`, so the cancellation is not lost." +"an :exc:`ExceptionGroup`, it will now call the parent task's :meth:`~asyncio." +"Task.cancel` method. This ensures that a :exc:`~asyncio.CancelledError` will " +"be raised at the next :keyword:`await`, so the cancellation is not lost." msgstr "" #: ../../whatsnew/3.13.rst:718 @@ -1145,11 +1143,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:727 msgid "" -"When :meth:`.TaskGroup.create_task` is called on an " -"inactive :class:`~asyncio.TaskGroup`, the given coroutine will be closed " -"(which prevents a :exc:`RuntimeWarning` about the given coroutine being " -"never awaited). (Contributed by Arthur Tacca and Jason Zhang " -"in :gh:`115957`.)" +"When :meth:`.TaskGroup.create_task` is called on an inactive :class:" +"`~asyncio.TaskGroup`, the given coroutine will be closed (which prevents a :" +"exc:`RuntimeWarning` about the given coroutine being never awaited). " +"(Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)" msgstr "" #: ../../whatsnew/3.13.rst:733 @@ -1166,9 +1163,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:744 msgid "" -"This affects the following function and " -"methods: :meth:`asyncio.create_task`, :meth:`asyncio.loop.create_task`, :meth:`asyncio.TaskGroup.create_task`. " -"(Contributed by Thomas Grainger in :gh:`128307`.)" +"This affects the following function and methods: :meth:`asyncio." +"create_task`, :meth:`asyncio.loop.create_task`, :meth:`asyncio.TaskGroup." +"create_task`. (Contributed by Thomas Grainger in :gh:`128307`.)" msgstr "" #: ../../whatsnew/3.13.rst:751 @@ -1178,8 +1175,8 @@ msgstr "base64" #: ../../whatsnew/3.13.rst:753 msgid "" "Add :func:`~base64.z85encode` and :func:`~base64.z85decode` functions for " -"encoding :class:`bytes` as `Z85 data`_ and decoding Z85-encoded data " -"to :class:`!bytes`. (Contributed by Matan Perelman in :gh:`75299`.)" +"encoding :class:`bytes` as `Z85 data`_ and decoding Z85-encoded data to :" +"class:`!bytes`. (Contributed by Matan Perelman in :gh:`75299`.)" msgstr "" #: ../../whatsnew/3.13.rst:762 @@ -1189,9 +1186,9 @@ msgstr "compileall" #: ../../whatsnew/3.13.rst:764 ../../whatsnew/3.13.rst:772 #: ../../whatsnew/3.13.rst:1031 msgid "" -"The default number of worker threads and processes is now selected " -"using :func:`os.process_cpu_count` instead of :func:`os.cpu_count`. " -"(Contributed by Victor Stinner in :gh:`109649`.)" +"The default number of worker threads and processes is now selected using :" +"func:`os.process_cpu_count` instead of :func:`os.cpu_count`. (Contributed by " +"Victor Stinner in :gh:`109649`.)" msgstr "" #: ../../whatsnew/3.13.rst:770 @@ -1206,8 +1203,8 @@ msgstr "configparser" msgid "" ":class:`~configparser.ConfigParser` now has support for unnamed sections, " "which allows for top-level key-value pairs. This can be enabled with the new " -"*allow_unnamed_section* parameter. (Contributed by Pedro Sousa Lacerda " -"in :gh:`66449`.)" +"*allow_unnamed_section* parameter. (Contributed by Pedro Sousa Lacerda in :" +"gh:`66449`.)" msgstr "" #: ../../whatsnew/3.13.rst:787 @@ -1232,8 +1229,10 @@ msgid ":class:`dataclasses.dataclass`" msgstr ":class:`dataclasses.dataclass`" #: ../../whatsnew/3.13.rst:797 -msgid ":class:`datetime.datetime`, :class:`datetime.date`, :class:`datetime.time`" -msgstr ":class:`datetime.datetime`、:class:`datetime.date`、:class:`datetime.time`" +msgid "" +":class:`datetime.datetime`, :class:`datetime.date`, :class:`datetime.time`" +msgstr "" +":class:`datetime.datetime`、:class:`datetime.date`、:class:`datetime.time`" #: ../../whatsnew/3.13.rst:798 msgid ":class:`inspect.Signature`, :class:`inspect.Parameter`" @@ -1250,8 +1249,8 @@ msgstr ":ref:`程式碼物件 `" #: ../../whatsnew/3.13.rst:802 msgid "" "Any user-defined class can also support :func:`copy.replace` by defining " -"the :meth:`~object.__replace__` method. (Contributed by Serhiy Storchaka " -"in :gh:`108751`.)" +"the :meth:`~object.__replace__` method. (Contributed by Serhiy Storchaka in :" +"gh:`108751`.)" msgstr "" #: ../../whatsnew/3.13.rst:808 @@ -1286,10 +1285,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:824 msgid "" -":class:`ctypes.Structure` objects have a " -"new :attr:`~ctypes.Structure._align_` attribute which allows the alignment " -"of the structure being packed to/from memory to be specified explicitly. " -"(Contributed by Matt Sanderson in :gh:`112433`)" +":class:`ctypes.Structure` objects have a new :attr:`~ctypes.Structure." +"_align_` attribute which allows the alignment of the structure being packed " +"to/from memory to be specified explicitly. (Contributed by Matt Sanderson " +"in :gh:`112433`)" msgstr "" #: ../../whatsnew/3.13.rst:830 @@ -1305,9 +1304,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:836 msgid "" -"Allow removing all items from the database through the " -"new :meth:`.gdbm.clear` and :meth:`.ndbm.clear` methods. (Contributed by " -"Donghee Na in :gh:`107122`.)" +"Allow removing all items from the database through the new :meth:`.gdbm." +"clear` and :meth:`.ndbm.clear` methods. (Contributed by Donghee Na in :gh:" +"`107122`.)" msgstr "" #: ../../whatsnew/3.13.rst:842 @@ -1325,10 +1324,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:851 msgid "" ":meth:`~dis.get_instructions` no longer represents cache entries as separate " -"instructions. Instead, it returns them as part of " -"the :class:`~dis.Instruction`, in the new *cache_info* field. The " -"*show_caches* argument to :meth:`~dis.get_instructions` is deprecated and no " -"longer has any effect. (Contributed by Irit Katriel in :gh:`112962`.)" +"instructions. Instead, it returns them as part of the :class:`~dis." +"Instruction`, in the new *cache_info* field. The *show_caches* argument to :" +"meth:`~dis.get_instructions` is deprecated and no longer has any effect. " +"(Contributed by Irit Katriel in :gh:`112962`.)" msgstr "" #: ../../whatsnew/3.13.rst:863 @@ -1339,9 +1338,9 @@ msgstr "doctest" msgid "" ":mod:`doctest` output is now colored by default. This can be controlled via " "the new :envvar:`PYTHON_COLORS` environment variable as well as the " -"canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment variables. See " -"also :ref:`using-on-controlling-color`. (Contributed by Hugo van Kemenade " -"in :gh:`117225`.)" +"canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment variables. See also :" +"ref:`using-on-controlling-color`. (Contributed by Hugo van Kemenade in :gh:" +"`117225`.)" msgstr "" #: ../../whatsnew/3.13.rst:872 @@ -1357,13 +1356,12 @@ msgstr "email" #: ../../whatsnew/3.13.rst:880 msgid "" -"Headers with embedded newlines are now quoted on output. " -"The :mod:`~email.generator` will now refuse to serialize (write) headers " -"that are improperly folded or delimited, such that they would be parsed as " -"multiple headers or joined with adjacent data. If you need to turn this " -"safety feature off, " -"set :attr:`~email.policy.Policy.verify_generated_headers`. (Contributed by " -"Bas Bloemsaat and Petr Viktorin in :gh:`121650`.)" +"Headers with embedded newlines are now quoted on output. The :mod:`~email." +"generator` will now refuse to serialize (write) headers that are improperly " +"folded or delimited, such that they would be parsed as multiple headers or " +"joined with adjacent data. If you need to turn this safety feature off, set :" +"attr:`~email.policy.Policy.verify_generated_headers`. (Contributed by Bas " +"Bloemsaat and Petr Viktorin in :gh:`121650`.)" msgstr "" #: ../../whatsnew/3.13.rst:888 @@ -1372,10 +1370,10 @@ msgid "" "return ``('', '')`` pairs in more situations where invalid email addresses " "are encountered instead of potentially inaccurate values. The two functions " "have a new optional *strict* parameter (default ``True``). To get the old " -"behavior (accepting malformed input), use ``strict=False``. " -"``getattr(email.utils, 'supports_strict_parsing', False)`` can be used to " -"check if the *strict* parameter is available. (Contributed by Thomas Dwyer " -"and Victor Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" +"behavior (accepting malformed input), use ``strict=False``. ``getattr(email." +"utils, 'supports_strict_parsing', False)`` can be used to check if the " +"*strict* parameter is available. (Contributed by Thomas Dwyer and Victor " +"Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" msgstr "" #: ../../whatsnew/3.13.rst:900 @@ -1384,8 +1382,8 @@ msgstr "enum" #: ../../whatsnew/3.13.rst:902 msgid "" -":class:`~enum.EnumDict` has been made public to better support " -"subclassing :class:`~enum.EnumType`." +":class:`~enum.EnumDict` has been made public to better support subclassing :" +"class:`~enum.EnumType`." msgstr "" "公開 :class:`~enum.EnumDict` 以更好地支援 :class:`~enum.EnumType` 的子類別。" @@ -1397,8 +1395,8 @@ msgstr "fractions" msgid "" ":class:`~fractions.Fraction` objects now support the standard :ref:`format " "specification mini-language ` rules for fill, alignment, sign " -"handling, minimum width, and grouping. (Contributed by Mark Dickinson " -"in :gh:`111320`.)" +"handling, minimum width, and grouping. (Contributed by Mark Dickinson in :gh:" +"`111320`.)" msgstr "" #: ../../whatsnew/3.13.rst:916 @@ -1458,8 +1456,8 @@ msgstr "" msgid "" ":func:`~importlib.resources.contents` remains deprecated in favor of the " "fully-featured :class:`~importlib.resources.abc.Traversable` API. However, " -"there is now no plan to remove it. (Contributed by Petr Viktorin " -"in :gh:`116608`.)" +"there is now no plan to remove it. (Contributed by Petr Viktorin in :gh:" +"`116608`.)" msgstr "" #: ../../whatsnew/3.13.rst:948 @@ -1468,11 +1466,11 @@ msgstr "io" #: ../../whatsnew/3.13.rst:950 msgid "" -"The :class:`~io.IOBase` finalizer now logs any errors raised by " -"the :meth:`~io.IOBase.close` method with :data:`sys.unraisablehook`. " -"Previously, errors were ignored silently by default, and only logged " -"in :ref:`Python Development Mode ` or when using a :ref:`Python " -"debug build `. (Contributed by Victor Stinner in :gh:`62948`.)" +"The :class:`~io.IOBase` finalizer now logs any errors raised by the :meth:" +"`~io.IOBase.close` method with :data:`sys.unraisablehook`. Previously, " +"errors were ignored silently by default, and only logged in :ref:`Python " +"Development Mode ` or when using a :ref:`Python debug build `. (Contributed by Victor Stinner in :gh:`62948`.)" msgstr "" #: ../../whatsnew/3.13.rst:959 @@ -1487,10 +1485,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:965 msgid "" -"Fix ``is_global`` and ``is_private`` behavior " -"in :class:`~ipaddress.IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress.IPv4Network`, " -"and :class:`~ipaddress.IPv6Network`. (Contributed by Jakub Stasiak " -"in :gh:`113171`.)" +"Fix ``is_global`` and ``is_private`` behavior in :class:`~ipaddress." +"IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress." +"IPv4Network`, and :class:`~ipaddress.IPv6Network`. (Contributed by Jakub " +"Stasiak in :gh:`113171`.)" msgstr "" #: ../../whatsnew/3.13.rst:972 @@ -1499,9 +1497,9 @@ msgstr "itertools" #: ../../whatsnew/3.13.rst:974 msgid "" -":func:`~itertools.batched` has a new *strict* parameter, which raises " -"a :exc:`ValueError` if the final batch is shorter than the specified batch " -"size. (Contributed by Raymond Hettinger in :gh:`113202`.)" +":func:`~itertools.batched` has a new *strict* parameter, which raises a :exc:" +"`ValueError` if the final batch is shorter than the specified batch size. " +"(Contributed by Raymond Hettinger in :gh:`113202`.)" msgstr "" #: ../../whatsnew/3.13.rst:981 @@ -1538,8 +1536,8 @@ msgstr "mimetypes" msgid "" "Add the :func:`~mimetypes.guess_file_type` function to guess a MIME type " "from a filesystem path. Using paths with :func:`~mimetypes.guess_type` is " -"now :term:`soft deprecated`. (Contributed by Serhiy Storchaka " -"in :gh:`66543`.)" +"now :term:`soft deprecated`. (Contributed by Serhiy Storchaka in :gh:" +"`66543`.)" msgstr "" #: ../../whatsnew/3.13.rst:1011 @@ -1556,17 +1554,17 @@ msgstr "" #: ../../whatsnew/3.13.rst:1017 msgid "" ":class:`~mmap.mmap` has a new :meth:`~mmap.mmap.seekable` method that can be " -"used when a seekable file-like object is required. " -"The :meth:`~mmap.mmap.seek` method now returns the new absolute position. " -"(Contributed by Donghee Na and Sylvie Liberman in :gh:`111835`.)" +"used when a seekable file-like object is required. The :meth:`~mmap.mmap." +"seek` method now returns the new absolute position. (Contributed by Donghee " +"Na and Sylvie Liberman in :gh:`111835`.)" msgstr "" #: ../../whatsnew/3.13.rst:1022 msgid "" "The new UNIX-only *trackfd* parameter for :class:`~mmap.mmap` controls file " "descriptor duplication; if false, the file descriptor specified by *fileno* " -"will not be duplicated. (Contributed by Zackery Spytz and Petr Viktorin " -"in :gh:`78502`.)" +"will not be duplicated. (Contributed by Zackery Spytz and Petr Viktorin in :" +"gh:`78502`.)" msgstr "" #: ../../whatsnew/3.13.rst:1029 @@ -1597,8 +1595,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:1051 msgid "" "Add a :ref:`low level interface ` to Linux's :manpage:`timer " -"file descriptors ` " -"via :func:`~os.timerfd_create`, :func:`~os.timerfd_settime`, :func:`~os.timerfd_settime_ns`, :func:`~os.timerfd_gettime`, :func:`~os.timerfd_gettime_ns`, :const:`~os.TFD_NONBLOCK`, :const:`~os.TFD_CLOEXEC`, :const:`~os.TFD_TIMER_ABSTIME`, " +"file descriptors ` via :func:`~os.timerfd_create`, :func:" +"`~os.timerfd_settime`, :func:`~os.timerfd_settime_ns`, :func:`~os." +"timerfd_gettime`, :func:`~os.timerfd_gettime_ns`, :const:`~os." +"TFD_NONBLOCK`, :const:`~os.TFD_CLOEXEC`, :const:`~os.TFD_TIMER_ABSTIME`, " "and :const:`~os.TFD_TIMER_CANCEL_ON_SET` (Contributed by Masaru Tsuchiyama " "in :gh:`108277`.)" msgstr "" @@ -1614,17 +1614,17 @@ msgstr "" #: ../../whatsnew/3.13.rst:1066 msgid "" ":func:`~os.fchmod` and support for file descriptors in :func:`~os.chmod` are " -"both now available on Windows. (Contributed by Serhiy Storchaka " -"in :gh:`113191`.)" +"both now available on Windows. (Contributed by Serhiy Storchaka in :gh:" +"`113191`.)" msgstr "" #: ../../whatsnew/3.13.rst:1070 msgid "" "On Windows, :func:`~os.mkdir` and :func:`~os.makedirs` now support passing a " "*mode* value of ``0o700`` to apply access control to the new directory. This " -"implicitly affects :func:`tempfile.mkdtemp` and is a mitigation " -"for :cve:`2024-4030`. Other values for *mode* continue to be ignored. " -"(Contributed by Steve Dower in :gh:`118486`.)" +"implicitly affects :func:`tempfile.mkdtemp` and is a mitigation for :cve:" +"`2024-4030`. Other values for *mode* continue to be ignored. (Contributed by " +"Steve Dower in :gh:`118486`.)" msgstr "" #: ../../whatsnew/3.13.rst:1077 @@ -1637,9 +1637,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:1081 msgid "" ":func:`~os.posix_spawn` can now use the :const:`~os.POSIX_SPAWN_CLOSEFROM` " -"attribute in the *file_actions* parameter on platforms that " -"support :c:func:`!posix_spawn_file_actions_addclosefrom_np`. (Contributed by " -"Jakub Kulik in :gh:`113117`.)" +"attribute in the *file_actions* parameter on platforms that support :c:func:" +"`!posix_spawn_file_actions_addclosefrom_np`. (Contributed by Jakub Kulik in :" +"gh:`113117`.)" msgstr "" #: ../../whatsnew/3.13.rst:1088 @@ -1672,9 +1672,9 @@ msgstr "pathlib" #: ../../whatsnew/3.13.rst:1107 msgid "" -"Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead " -"of :exc:`NotImplementedError` when a path operation isn't supported. " -"(Contributed by Barney Gale in :gh:`89812`.)" +"Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead of :exc:" +"`NotImplementedError` when a path operation isn't supported. (Contributed by " +"Barney Gale in :gh:`89812`.)" msgstr "" #: ../../whatsnew/3.13.rst:1111 @@ -1700,8 +1700,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:1124 msgid "" -"Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` " -"and :meth:`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" +"Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` and :meth:" +"`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" msgstr "" #: ../../whatsnew/3.13.rst:1128 @@ -1714,9 +1714,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:1133 msgid "" "Add the *follow_symlinks* keyword-only argument to :meth:`Path.is_file " -"`, :meth:`Path.is_dir " -"`, :meth:`.Path.owner`, and :meth:`.Path.group`. " -"(Contributed by Barney Gale in :gh:`105793` and Kamil Turek in :gh:`107962`.)" +"`, :meth:`Path.is_dir `, :meth:`." +"Path.owner`, and :meth:`.Path.group`. (Contributed by Barney Gale in :gh:" +"`105793` and Kamil Turek in :gh:`107962`.)" msgstr "" #: ../../whatsnew/3.13.rst:1141 @@ -1749,8 +1749,8 @@ msgstr "" msgid "" "Add ability to move between chained exceptions during post-mortem debugging " "in :func:`~pdb.pm` using the new :pdbcmd:`exceptions [exc_number] " -"` command for Pdb. (Contributed by Matthias Bussonnier " -"in :gh:`106676`.)" +"` command for Pdb. (Contributed by Matthias Bussonnier in :gh:" +"`106676`.)" msgstr "" #: ../../whatsnew/3.13.rst:1161 @@ -1786,8 +1786,8 @@ msgstr "re" #: ../../whatsnew/3.13.rst:1184 msgid "" -"Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved " -"clarity. :exc:`!re.error` is kept for backward compatibility." +"Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved clarity. :" +"exc:`!re.error` is kept for backward compatibility." msgstr "" #: ../../whatsnew/3.13.rst:1189 @@ -1796,9 +1796,8 @@ msgstr "shutil" #: ../../whatsnew/3.13.rst:1191 msgid "" -"Support the *dir_fd* and *follow_symlinks* keyword arguments " -"in :func:`~shutil.chown`. (Contributed by Berker Peksag and Tahia K " -"in :gh:`62308`)" +"Support the *dir_fd* and *follow_symlinks* keyword arguments in :func:" +"`~shutil.chown`. (Contributed by Berker Peksag and Tahia K in :gh:`62308`)" msgstr "" #: ../../whatsnew/3.13.rst:1197 @@ -1807,9 +1806,9 @@ msgstr "site" #: ../../whatsnew/3.13.rst:1199 msgid "" -":file:`.pth` files are now decoded using UTF-8 first, and then with " -"the :term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada " -"Naoki in :gh:`117802`.)" +":file:`.pth` files are now decoded using UTF-8 first, and then with the :" +"term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada Naoki " +"in :gh:`117802`.)" msgstr "" #: ../../whatsnew/3.13.rst:1205 @@ -1826,8 +1825,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:1211 msgid "" "Add the *filter* keyword-only parameter to :meth:`.Connection.iterdump` for " -"filtering database objects to dump. (Contributed by Mariusz Felisiak " -"in :gh:`91602`.)" +"filtering database objects to dump. (Contributed by Mariusz Felisiak in :gh:" +"`91602`.)" msgstr "" #: ../../whatsnew/3.13.rst:1217 @@ -1836,9 +1835,9 @@ msgstr "ssl" #: ../../whatsnew/3.13.rst:1219 msgid "" -"The :func:`~ssl.create_default_context` API now " -"includes :data:`~ssl.VERIFY_X509_PARTIAL_CHAIN` " -"and :data:`~ssl.VERIFY_X509_STRICT` in its default flags." +"The :func:`~ssl.create_default_context` API now includes :data:`~ssl." +"VERIFY_X509_PARTIAL_CHAIN` and :data:`~ssl.VERIFY_X509_STRICT` in its " +"default flags." msgstr "" #: ../../whatsnew/3.13.rst:1225 @@ -1872,8 +1871,8 @@ msgstr "statistics" msgid "" "Add :func:`~statistics.kde` for kernel density estimation. This makes it " "possible to estimate a continuous probability density function from a fixed " -"number of discrete samples. (Contributed by Raymond Hettinger " -"in :gh:`115863`.)" +"number of discrete samples. (Contributed by Raymond Hettinger in :gh:" +"`115863`.)" msgstr "" #: ../../whatsnew/3.13.rst:1248 @@ -1905,11 +1904,11 @@ msgstr "" #: ../../whatsnew/3.13.rst:1268 msgid "" "A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can be set to " -"``False`` if you need to force :mod:`subprocess` to never " -"use :func:`~os.posix_spawn`. Please report your reason and platform details " -"in the :ref:`issue tracker ` if you set this so that we " -"can improve our API selection logic for everyone. (Contributed by Jakub " -"Kulik in :gh:`113117`.)" +"``False`` if you need to force :mod:`subprocess` to never use :func:`~os." +"posix_spawn`. Please report your reason and platform details in the :ref:" +"`issue tracker ` if you set this so that we can improve " +"our API selection logic for everyone. (Contributed by Jakub Kulik in :gh:" +"`113117`.)" msgstr "" #: ../../whatsnew/3.13.rst:1278 @@ -1931,8 +1930,8 @@ msgstr "tempfile" msgid "" "On Windows, the default mode ``0o700`` used by :func:`tempfile.mkdtemp` now " "limits access to the new directory due to changes to :func:`os.mkdir`. This " -"is a mitigation for :cve:`2024-4030`. (Contributed by Steve Dower " -"in :gh:`118486`.)" +"is a mitigation for :cve:`2024-4030`. (Contributed by Steve Dower in :gh:" +"`118486`.)" msgstr "" #: ../../whatsnew/3.13.rst:1295 @@ -1952,8 +1951,8 @@ msgid "" "On Windows, :func:`~time.time` now uses the " "``GetSystemTimePreciseAsFileTime()`` clock for a resolution of 1 " "microsecond, instead of the ``GetSystemTimeAsFileTime()`` clock which has a " -"resolution of 15.6 milliseconds. (Contributed by Victor Stinner " -"in :gh:`63207`.)" +"resolution of 15.6 milliseconds. (Contributed by Victor Stinner in :gh:" +"`63207`.)" msgstr "" #: ../../whatsnew/3.13.rst:1311 @@ -1973,9 +1972,8 @@ msgid "" "The :mod:`tkinter` widget method :meth:`!wm_attributes` now accepts the " "attribute name without the minus prefix to get window attributes, for " "example ``w.wm_attributes('alpha')`` and allows specifying attributes and " -"values to set as keyword arguments, for example " -"``w.wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka " -"in :gh:`43457`.)" +"values to set as keyword arguments, for example ``w." +"wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" #: ../../whatsnew/3.13.rst:1326 @@ -1995,10 +1993,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:1335 msgid "" -"Support the \"vsapi\" element type in " -"the :meth:`~tkinter.ttk.Style.element_create` method " -"of :class:`tkinter.ttk.Style`. (Contributed by Serhiy Storchaka " -"in :gh:`68166`.)" +"Support the \"vsapi\" element type in the :meth:`~tkinter.ttk.Style." +"element_create` method of :class:`tkinter.ttk.Style`. (Contributed by Serhiy " +"Storchaka in :gh:`68166`.)" msgstr "" #: ../../whatsnew/3.13.rst:1340 @@ -2036,9 +2033,9 @@ msgstr "traceback" #: ../../whatsnew/3.13.rst:1364 msgid "" -"Add the :attr:`~traceback.TracebackException.exc_type_str` attribute " -"to :class:`~traceback.TracebackException`, which holds a string display of " -"the *exc_type*. Deprecate the :attr:`~traceback.TracebackException.exc_type` " +"Add the :attr:`~traceback.TracebackException.exc_type_str` attribute to :" +"class:`~traceback.TracebackException`, which holds a string display of the " +"*exc_type*. Deprecate the :attr:`~traceback.TracebackException.exc_type` " "attribute, which holds the type object itself. Add parameter *save_exc_type* " "(default ``True``) to indicate whether ``exc_type`` should be saved. " "(Contributed by Irit Katriel in :gh:`112332`.)" @@ -2046,10 +2043,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:1373 msgid "" -"Add a new *show_group* keyword-only parameter " -"to :meth:`.TracebackException.format_exception_only` to (recursively) format " -"the nested exceptions of a :exc:`BaseExceptionGroup` instance. (Contributed " -"by Irit Katriel in :gh:`105292`.)" +"Add a new *show_group* keyword-only parameter to :meth:`.TracebackException." +"format_exception_only` to (recursively) format the nested exceptions of a :" +"exc:`BaseExceptionGroup` instance. (Contributed by Irit Katriel in :gh:" +"`105292`.)" msgstr "" #: ../../whatsnew/3.13.rst:1380 @@ -2060,8 +2057,8 @@ msgstr "types" msgid "" ":class:`~types.SimpleNamespace` can now take a single positional argument to " "initialise the namespace's arguments. This argument must either be a mapping " -"or an iterable of key-value pairs. (Contributed by Serhiy Storchaka " -"in :gh:`108191`.)" +"or an iterable of key-value pairs. (Contributed by Serhiy Storchaka in :gh:" +"`108191`.)" msgstr "" #: ../../whatsnew/3.13.rst:1389 ../../whatsnew/3.13.rst:1769 @@ -2090,14 +2087,14 @@ msgstr "" #: ../../whatsnew/3.13.rst:1401 msgid "" "Add :func:`~typing.get_protocol_members` to return the set of members " -"defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra " -"in :gh:`104873`.)" +"defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:" +"`104873`.)" msgstr "" #: ../../whatsnew/3.13.rst:1405 msgid "" -"Add :func:`~typing.is_protocol` to check whether a class is " -"a :class:`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" +"Add :func:`~typing.is_protocol` to check whether a class is a :class:" +"`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" msgstr "" #: ../../whatsnew/3.13.rst:1409 @@ -2179,9 +2176,9 @@ msgstr "(由 Sebastian Pipping 在 :gh:`115623` 中貢獻。)" #: ../../whatsnew/3.13.rst:1461 msgid "" -"Add the :meth:`!close` method for the iterator returned " -"by :func:`~xml.etree.ElementTree.iterparse` for explicit cleanup. " -"(Contributed by Serhiy Storchaka in :gh:`69893`.)" +"Add the :meth:`!close` method for the iterator returned by :func:`~xml.etree." +"ElementTree.iterparse` for explicit cleanup. (Contributed by Serhiy " +"Storchaka in :gh:`69893`.)" msgstr "" #: ../../whatsnew/3.13.rst:1467 @@ -2202,9 +2199,9 @@ msgstr "最佳化" msgid "" "Several standard library modules have had their import times significantly " "improved. For example, the import time of the :mod:`typing` module has been " -"reduced by around a third by removing dependencies on :mod:`re` " -"and :mod:`contextlib`. Other modules to enjoy import-time speedups " -"include :mod:`email.utils`, :mod:`enum`, :mod:`functools`, :mod:`importlib.metadata`, " +"reduced by around a third by removing dependencies on :mod:`re` and :mod:" +"`contextlib`. Other modules to enjoy import-time speedups include :mod:" +"`email.utils`, :mod:`enum`, :mod:`functools`, :mod:`importlib.metadata`, " "and :mod:`threading`. (Contributed by Alex Waygood, Shantanu Jain, Adam " "Turner, Daniel Hollas, and others in :gh:`109653`.)" msgstr "" @@ -2277,31 +2274,31 @@ msgstr ":mod:`!cgi` 和 :mod:`!cgitb`" #: ../../whatsnew/3.13.rst:1534 msgid "" -":class:`!cgi.FieldStorage` can typically be replaced " -"with :func:`urllib.parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and " -"the :mod:`email.message` module or the :pypi:`multipart` library for " -"``POST`` and ``PUT`` requests." +":class:`!cgi.FieldStorage` can typically be replaced with :func:`urllib." +"parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." +"message` module or the :pypi:`multipart` library for ``POST`` and ``PUT`` " +"requests." msgstr "" -":class:`!cgi.FieldStorage`,在於 ``GET`` 和 ``HEAD`` 請求中通常可以" -"被 :func:`urllib.parse.parse_qsl` 取代,而在於 ``POST`` 和 ``PUT`` 請求中可以" -"被 :mod:`email.message` 模組或 :pypi:`multipart` 函式庫取代。" +":class:`!cgi.FieldStorage`,在於 ``GET`` 和 ``HEAD`` 請求中通常可以被 :func:" +"`urllib.parse.parse_qsl` 取代,而在於 ``POST`` 和 ``PUT`` 請求中可以被 :mod:" +"`email.message` 模組或 :pypi:`multipart` 函式庫取代。" #: ../../whatsnew/3.13.rst:1539 msgid "" ":func:`!cgi.parse` can be replaced by calling :func:`urllib.parse.parse_qs` " "directly on the desired query string, unless the input is ``multipart/form-" -"data``, which should be replaced as described below for :func:`!" -"cgi.parse_multipart`." +"data``, which should be replaced as described below for :func:`!cgi." +"parse_multipart`." msgstr "" -":func:`!cgi.parse` 能夠以在所需的查詢字串上直接呼" -"叫 :func:`urllib.parse.parse_qs` 來取代,除非輸入為 ``multipart/form-data``," -"而這種情況則應該如下所述地將 :func:`!cgi.parse_multipart` 給替換掉。" +":func:`!cgi.parse` 能夠以在所需的查詢字串上直接呼叫 :func:`urllib.parse." +"parse_qs` 來取代,除非輸入為 ``multipart/form-data``,而這種情況則應該如下所" +"述地將 :func:`!cgi.parse_multipart` 給替換掉。" #: ../../whatsnew/3.13.rst:1544 msgid "" -":func:`!cgi.parse_header` can be replaced with the functionality in " -"the :mod:`email` package, which implements the same MIME RFCs. For example, " -"with :class:`email.message.EmailMessage`:" +":func:`!cgi.parse_header` can be replaced with the functionality in the :mod:" +"`email` package, which implements the same MIME RFCs. For example, with :" +"class:`email.message.EmailMessage`:" msgstr "" #: ../../whatsnew/3.13.rst:1548 @@ -2320,16 +2317,14 @@ msgstr "" #: ../../whatsnew/3.13.rst:1556 msgid "" -":func:`!cgi.parse_multipart` can be replaced with the functionality in " -"the :mod:`email` package, which implements the same MIME RFCs, or with " -"the :pypi:`multipart` library. For example, " -"the :class:`email.message.EmailMessage` and :class:`email.message.Message` " -"classes." +":func:`!cgi.parse_multipart` can be replaced with the functionality in the :" +"mod:`email` package, which implements the same MIME RFCs, or with the :pypi:" +"`multipart` library. For example, the :class:`email.message.EmailMessage` " +"and :class:`email.message.Message` classes." msgstr "" ":func:`!cgi.parse_multipart` 可以被 :mod:`email` 函式庫中實作相同 MIME RFCs " -"的功能取代,或者可以被 :pypi:`multipart` 函式庫取代,例" -"如 :class:`email.message.EmailMessage` 和 :class:`email.message.Message` 類" -"別。" +"的功能取代,或者可以被 :pypi:`multipart` 函式庫取代,例如 :class:`email." +"message.EmailMessage` 和 :class:`email.message.Message` 類別。" #: ../../whatsnew/3.13.rst:1562 msgid "" @@ -2371,11 +2366,11 @@ msgstr "" #: ../../whatsnew/3.13.rst:1579 msgid "" -":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to " -"the :manpage:`crypt_r(3)` library call and associated functionality." +":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to the :manpage:" +"`crypt_r(3)` library call and associated functionality." msgstr "" -":pypi:`crypt_r`:對 :mod:`!crypt` 模組的分支 (fork)," -"對 :manpage:`crypt_r(3)` 函式庫呼叫及相關功能的包裝。" +":pypi:`crypt_r`:對 :mod:`!crypt` 模組的分支 (fork),對 :manpage:" +"`crypt_r(3)` 函式庫呼叫及相關功能的包裝。" #: ../../whatsnew/3.13.rst:1583 msgid "" @@ -2440,8 +2435,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:1612 msgid "" -":mod:`!pipes`: Use the :mod:`subprocess` module instead. " -"Use :func:`shlex.quote` to replace the undocumented ``pipes.quote`` function." +":mod:`!pipes`: Use the :mod:`subprocess` module instead. Use :func:`shlex." +"quote` to replace the undocumented ``pipes.quote`` function." msgstr "" ":mod:`!pipes`:請改用 :mod:`subprocess` 模組。使用 :func:`shlex.quote` 來取代" "未以文件紀錄的 ``pipes.quote`` 函式。" @@ -2516,8 +2511,8 @@ msgstr ":pypi:`standard-xdrlib`:PyPI 上的 ``xdrlib`` 函式庫重新發布 #: ../../whatsnew/3.13.rst:1651 msgid "" -"(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` " -"and :gh:`104780`.)" +"(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" +"`104780`.)" msgstr "" "(由 Victor Stinner 和 Zachary Ware 在 :gh:`104773` 和 :gh:`104780` 中貢" "獻。)" @@ -2529,8 +2524,8 @@ msgstr "2to3" #: ../../whatsnew/3.13.rst:1657 msgid "" "Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " -"previously deprecated in Python 3.11. (Contributed by Victor Stinner " -"in :gh:`104780`.)" +"previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" +"`104780`.)" msgstr "" #: ../../whatsnew/3.13.rst:1663 @@ -2539,9 +2534,9 @@ msgstr "builtins" #: ../../whatsnew/3.13.rst:1665 msgid "" -"Remove support for chained :class:`classmethod` descriptors (introduced " -"in :gh:`63272`). These can no longer be used to wrap other descriptors, such " -"as :class:`property`. The core design of this feature was flawed and led to " +"Remove support for chained :class:`classmethod` descriptors (introduced in :" +"gh:`63272`). These can no longer be used to wrap other descriptors, such as :" +"class:`property`. The core design of this feature was flawed and led to " "several problems. To \"pass-through\" a :class:`classmethod`, consider using " "the :attr:`!__wrapped__` attribute that was added in Python 3.10. " "(Contributed by Raymond Hettinger in :gh:`89519`.)" @@ -2567,9 +2562,9 @@ msgstr "importlib.metadata" #: ../../whatsnew/3.13.rst:1691 msgid "" -"Remove deprecated subscript (:meth:`~object.__getitem__`) access " -"for :ref:`EntryPoint ` objects. (Contributed by Jason R. " -"Coombs in :gh:`113175`.)" +"Remove deprecated subscript (:meth:`~object.__getitem__`) access for :ref:" +"`EntryPoint ` objects. (Contributed by Jason R. Coombs in :gh:" +"`113175`.)" msgstr "" #: ../../whatsnew/3.13.rst:1697 @@ -2589,19 +2584,18 @@ msgstr "opcode" #: ../../whatsnew/3.13.rst:1707 msgid "" -"Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!" -"_opcode.ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " +"Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." +"ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " "documented, and is not intended for external use. (Contributed by Irit " "Katriel in :gh:`105481`.)" msgstr "" #: ../../whatsnew/3.13.rst:1712 msgid "" -"Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, " -"and :attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but " -"were neither documented nor exposed through :mod:`dis`, and were not " -"intended to be used externally. (Contributed by Irit Katriel " -"in :gh:`105481`.)" +"Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" +"attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " +"neither documented nor exposed through :mod:`dis`, and were not intended to " +"be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" msgstr "" #: ../../whatsnew/3.13.rst:1720 @@ -2610,12 +2604,12 @@ msgstr "optparse" #: ../../whatsnew/3.13.rst:1722 msgid "" -"This module is no longer considered :term:`soft deprecated`. " -"While :mod:`argparse` remains preferred for new projects that aren't using a " -"third party command line argument processing library, there are aspects of " -"the way ``argparse`` works that mean the lower level ``optparse`` module may " -"provide a better foundation for *writing* argument processing libraries, and " -"for implementing command line applications which adhere more strictly than " +"This module is no longer considered :term:`soft deprecated`. While :mod:" +"`argparse` remains preferred for new projects that aren't using a third " +"party command line argument processing library, there are aspects of the way " +"``argparse`` works that mean the lower level ``optparse`` module may provide " +"a better foundation for *writing* argument processing libraries, and for " +"implementing command line applications which adhere more strictly than " "``argparse`` does to various Unix command line processing conventions that " "originate in the behaviour of the C :c:func:`!getopt` function . " "(Contributed by Alyssa Coghlan and Serhiy Storchaka in :gh:`126180`.)" @@ -2661,15 +2655,15 @@ msgstr "" msgid "" "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " "since Python 3.8. The items in those namespaces can be imported directly " -"from the :mod:`typing` module. (Contributed by Sebastian Rittau " -"in :gh:`92871`.)" +"from the :mod:`typing` module. (Contributed by Sebastian Rittau in :gh:" +"`92871`.)" msgstr "" #: ../../whatsnew/3.13.rst:1777 msgid "" "Remove the keyword-argument method of creating :class:`~typing.TypedDict` " -"types, deprecated in Python 3.11. (Contributed by Tomas Roun " -"in :gh:`104786`.)" +"types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" +"`104786`.)" msgstr "" #: ../../whatsnew/3.13.rst:1783 @@ -2716,8 +2710,8 @@ msgstr "(由 Hugo van Kemenade 在 :gh:`104835` 中貢獻。)" #: ../../whatsnew/3.13.rst:1799 msgid "" "Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " -"deprecated in Python 3.11. (Contributed by Hugo van Kemenade " -"in :gh:`104992`.)" +"deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" +"`104992`.)" msgstr "" #: ../../whatsnew/3.13.rst:1805 @@ -2726,13 +2720,13 @@ msgstr "urllib" #: ../../whatsnew/3.13.rst:1807 msgid "" -"Remove the *cafile*, *capath*, and *cadefault* parameters of " -"the :func:`urllib.request.urlopen` function, deprecated in Python 3.6. Use " -"the *context* parameter instead with an :class:`~ssl.SSLContext` instance. " -"The :meth:`ssl.SSLContext.load_cert_chain` function can be used to load " -"specific certificates, or let :func:`ssl.create_default_context` select the " -"operating system's trusted certificate authority (CA) certificates. " -"(Contributed by Victor Stinner in :gh:`105382`.)" +"Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" +"`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " +"*context* parameter instead with an :class:`~ssl.SSLContext` instance. The :" +"meth:`ssl.SSLContext.load_cert_chain` function can be used to load specific " +"certificates, or let :func:`ssl.create_default_context` select the operating " +"system's trusted certificate authority (CA) certificates. (Contributed by " +"Victor Stinner in :gh:`105382`.)" msgstr "" #: ../../whatsnew/3.13.rst:1818 @@ -2748,9 +2742,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:1825 msgid "" -"Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use " -"the :attr:`MacOSXOSAScript.name ` attribute " -"instead. (Contributed by Nikita Sobolev in :gh:`105546`.)" +"Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use the :" +"attr:`MacOSXOSAScript.name ` attribute instead. " +"(Contributed by Nikita Sobolev in :gh:`105546`.)" msgstr "" #: ../../whatsnew/3.13.rst:1832 @@ -2779,8 +2773,8 @@ msgid "" "Deprecate the ``'u'`` format code (:c:type:`wchar_t`) at runtime. This " "format code has been deprecated in documentation since Python 3.3, and will " "be removed in Python 3.16. Use the ``'w'`` format code (:c:type:`Py_UCS4`) " -"for Unicode characters instead. (Contributed by Hugo van Kemenade " -"in :gh:`80480`.)" +"for Unicode characters instead. (Contributed by Hugo van Kemenade in :gh:" +"`80480`.)" msgstr "" #: ../../whatsnew/3.13.rst:1851 @@ -2818,9 +2812,8 @@ msgstr ":mod:`dis`:" #: ../../whatsnew/3.13.rst:1870 msgid "" -"Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership " -"in :data:`~dis.hasarg` instead. (Contributed by Irit Katriel " -"in :gh:`109319`.)" +"Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership in :data:" +"`~dis.hasarg` instead. (Contributed by Irit Katriel in :gh:`109319`.)" msgstr "" #: ../../whatsnew/3.13.rst:1874 @@ -2840,10 +2833,10 @@ msgstr ":mod:`glob`:" #: ../../whatsnew/3.13.rst:1883 msgid "" -"Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. " -"Use :func:`~glob.glob` and pass a :term:`path-like object` specifying the " -"root directory to the *root_dir* parameter instead. (Contributed by Barney " -"Gale in :gh:`117337`.)" +"Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. Use :" +"func:`~glob.glob` and pass a :term:`path-like object` specifying the root " +"directory to the *root_dir* parameter instead. (Contributed by Barney Gale " +"in :gh:`117337`.)" msgstr "" #: ../../whatsnew/3.13.rst:1888 @@ -2874,9 +2867,9 @@ msgstr ":mod:`mimetypes`:" #: ../../whatsnew/3.13.rst:1904 msgid "" -":term:`Soft-deprecate ` file path arguments " -"to :func:`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` " -"instead. (Contributed by Serhiy Storchaka in :gh:`66543`.)" +":term:`Soft-deprecate ` file path arguments to :func:" +"`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` instead. " +"(Contributed by Serhiy Storchaka in :gh:`66543`.)" msgstr "" #: ../../whatsnew/3.13.rst:1909 @@ -2899,9 +2892,9 @@ msgstr ":mod:`pathlib`:" #: ../../whatsnew/3.13.rst:1920 msgid "" -"Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. " -"Use :func:`os.path.isreserved` to detect reserved paths on Windows. " -"(Contributed by Barney Gale in :gh:`88569`.)" +"Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows. (Contributed " +"by Barney Gale in :gh:`88569`.)" msgstr "" #: ../../whatsnew/3.13.rst:1925 @@ -2927,34 +2920,34 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1938 -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:85 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" #: ../../whatsnew/3.13.rst:1940 msgid "" -"Deprecate passing more than one positional argument to " -"the :func:`~sqlite3.connect` function and the :class:`~sqlite3.Connection` " -"constructor. The remaining parameters will become keyword-only in Python " -"3.15. (Contributed by Erlend E. Aasland in :gh:`107948`.)" +"Deprecate passing more than one positional argument to the :func:`~sqlite3." +"connect` function and the :class:`~sqlite3.Connection` constructor. The " +"remaining parameters will become keyword-only in Python 3.15. (Contributed " +"by Erlend E. Aasland in :gh:`107948`.)" msgstr "" #: ../../whatsnew/3.13.rst:1946 msgid "" "Deprecate passing name, number of arguments, and the callable as keyword " -"arguments for :meth:`.Connection.create_function` " -"and :meth:`.Connection.create_aggregate` These parameters will become " -"positional-only in Python 3.15. (Contributed by Erlend E. Aasland " -"in :gh:`108278`.)" +"arguments for :meth:`.Connection.create_function` and :meth:`.Connection." +"create_aggregate` These parameters will become positional-only in Python " +"3.15. (Contributed by Erlend E. Aasland in :gh:`108278`.)" msgstr "" #: ../../whatsnew/3.13.rst:1952 msgid "" -"Deprecate passing the callback callable by keyword for " -"the :meth:`~sqlite3.Connection.set_authorizer`, :meth:`~sqlite3.Connection.set_progress_handler`, " -"and :meth:`~sqlite3.Connection.set_trace_callback` :class:`~sqlite3.Connection` " -"methods. The callback callables will become positional-only in Python 3.15. " -"(Contributed by Erlend E. Aasland in :gh:`108278`.)" +"Deprecate passing the callback callable by keyword for the :meth:`~sqlite3." +"Connection.set_authorizer`, :meth:`~sqlite3.Connection." +"set_progress_handler`, and :meth:`~sqlite3.Connection.set_trace_callback` :" +"class:`~sqlite3.Connection` methods. The callback callables will become " +"positional-only in Python 3.15. (Contributed by Erlend E. Aasland in :gh:" +"`108278`.)" msgstr "" #: ../../whatsnew/3.13.rst:1960 @@ -2986,9 +2979,9 @@ msgstr ":mod:`traceback`:" #: ../../whatsnew/3.13.rst:1975 msgid "" -"Deprecate the :attr:`.TracebackException.exc_type` attribute. " -"Use :attr:`.TracebackException.exc_type_str` instead. (Contributed by Irit " -"Katriel in :gh:`112332`.)" +"Deprecate the :attr:`.TracebackException.exc_type` attribute. Use :attr:`." +"TracebackException.exc_type_str` instead. (Contributed by Irit Katriel in :" +"gh:`112332`.)" msgstr "" #: ../../whatsnew/3.13.rst:1979 @@ -2999,23 +2992,22 @@ msgstr ":mod:`typing`:" #: ../../whatsnew/3.13.rst:1981 msgid "" -"Deprecate the undocumented keyword argument syntax for " -"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " -"NamedTuple(\"Point\", x=int, y=int)``), to be removed in Python 3.15. Use " -"the class-based syntax or the functional syntax instead. (Contributed by " -"Alex Waygood in :gh:`105566`.)" +"Deprecate the undocumented keyword argument syntax for creating :class:" +"`~typing.NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``), to be removed in Python 3.15. Use the class-based syntax or the " +"functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" msgstr "" #: ../../whatsnew/3.13.rst:1988 msgid "" -"Deprecate omitting the *fields* parameter when creating " -"a :class:`~typing.NamedTuple` or :class:`typing.TypedDict` class, and " -"deprecate passing ``None`` to the *fields* parameter of both types. Python " -"3.15 will require a valid sequence for the *fields* parameter. To create a " -"NamedTuple class with zero fields, use ``class NT(NamedTuple): pass`` or " -"``NT = NamedTuple(\"NT\", ())``. To create a TypedDict class with zero " -"fields, use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``. " -"(Contributed by Alex Waygood in :gh:`105566` and :gh:`105570`.)" +"Deprecate omitting the *fields* parameter when creating a :class:`~typing." +"NamedTuple` or :class:`typing.TypedDict` class, and deprecate passing " +"``None`` to the *fields* parameter of both types. Python 3.15 will require a " +"valid sequence for the *fields* parameter. To create a NamedTuple class with " +"zero fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " +"())``. To create a TypedDict class with zero fields, use ``class " +"TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``. (Contributed by " +"Alex Waygood in :gh:`105566` and :gh:`105570`.)" msgstr "" #: ../../whatsnew/3.13.rst:1998 @@ -3045,10 +3037,10 @@ msgstr ":mod:`wave`:" #: ../../whatsnew/3.13.rst:2014 msgid "" -"Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " -"and :meth:`~wave.Wave_read.getmarkers` methods of " -"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes, to be " -"removed in Python 3.15. (Contributed by Victor Stinner in :gh:`105096`.)" +"Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:" +"`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :" +"class:`~wave.Wave_write` classes, to be removed in Python 3.15. (Contributed " +"by Victor Stinner in :gh:`105096`.)" msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 @@ -3097,8 +3089,8 @@ msgstr ":class:`!ast.Ellipsis`" #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " -"in :gh:`90953`.)" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" +"`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" @@ -3110,28 +3102,26 @@ msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" "The child watcher classes :class:`!asyncio.MultiLoopChildWatcher`, :class:`!" -"asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` " -"and :class:`!asyncio.SafeChildWatcher` are deprecated and will be removed in " -"Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +"asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` and :class:" +"`!asyncio.SafeChildWatcher` are deprecated and will be removed in Python " +"3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`!" -"asyncio.MultiLoopChildWatcher`、:class:`!asyncio.FastChildWatcher`、:class:`!" -"asyncio.AbstractChildWatcher` 和 :class:`!asyncio.SafeChildWatcher`。 (由 " -"Kumar Aditya 於 :gh:`94597` 貢獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`!asyncio." +"MultiLoopChildWatcher`、:class:`!asyncio.FastChildWatcher`、:class:`!asyncio." +"AbstractChildWatcher` 和 :class:`!asyncio.SafeChildWatcher`。 (由 Kumar " +"Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`!asyncio.set_child_watcher`, :func:`!" -"asyncio.get_child_watcher`, :meth:`!" -"asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`!" +":func:`!asyncio.set_child_watcher`, :func:`!asyncio.get_child_watcher`, :" +"meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`!" "asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated and will " "be removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -":func:`!asyncio.set_child_watcher`、:func:`!" -"asyncio.get_child_watcher`、:meth:`!" -"asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`!" -"asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python " -"3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`!asyncio.set_child_watcher`、:func:`!asyncio.get_child_watcher`、:" +"meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`!asyncio." +"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" +"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" @@ -3146,60 +3136,45 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" -":mod:`collections.abc`: Deprecated :class:`!collections.abc.ByteString`. " -"Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, " -"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -"in :gh:`91896`.)" -msgstr "" -":mod:`collections.abc`:已棄用 :class:`!collections.abc.ByteString`。請改" -"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" -"時,請改用聯集,如 ``bytes | bytearray``," -"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" -"獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:47 -msgid "" -":mod:`email`: Deprecated the *isdst* parameter " -"in :func:`email.utils.localtime`. (Contributed by Alan Williams " -"in :gh:`72346`.)" +":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:50 +#: ../../deprecations/pending-removal-in-3.14.rst:44 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:52 +#: ../../deprecations/pending-removal-in-3.14.rst:46 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:53 +#: ../../deprecations/pending-removal-in-3.14.rst:47 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:48 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:50 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:58 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:55 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:57 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -3210,82 +3185,72 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:69 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " "currently the default (:gh:`84559`). Adding a runtime warning about this was " "deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` " -"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " -"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." +"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." +"set_start_method` APIs to explicitly specify when your code *requires* " +"``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" "台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" -"用 :func:`~multiprocessing.get_context` " -"或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時\\ *" -"需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" +"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " +"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" +"`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:77 +#: ../../deprecations/pending-removal-in-3.14.rst:71 msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " -"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " -"deprecated." +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." +"PurePath.relative_to`: passing additional arguments is deprecated." msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " -"和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" +"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:81 +#: ../../deprecations/pending-removal-in-3.14.rst:75 msgid "" ":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`!pkgutil.find_loader` 和 :func:`!pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改" -"用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" -"獻。)" +"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." +"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:86 +#: ../../deprecations/pending-removal-in-3.14.rst:80 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:82 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:83 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:87 msgid ":data:`!version` and :data:`!version_info`." msgstr ":data:`!version` 和 :data:`!version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " -"if :ref:`named placeholders ` are used and " -"*parameters* is a sequence instead of a :class:`dict`." +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" +"ref:`named placeholders ` are used and *parameters* is " +"a sequence instead of a :class:`dict`." msgstr "" ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:99 -msgid "" -":mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9, now " -"causes a :exc:`DeprecationWarning` to be emitted when it is used." -msgstr "" -":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`!typing.ByteString` 現在在" -"使用時會發出 :exc:`DeprecationWarning`。" - -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith " -"in :gh:`88168`.)" +"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" +"`88168`.)" msgstr "" ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" "(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" @@ -3302,10 +3267,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to " -"set :attr:`__spec__.cached ` is " -"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " -"into consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "` 的做法已被棄用。在 Python 3.15 中," @@ -3313,11 +3278,10 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to " -"set :attr:`__spec__.parent ` is " -"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " -"take into consideration by the import system or standard library. " -"(:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "` 的做法已被棄用。在 Python 3.15 中," @@ -3364,25 +3328,23 @@ msgstr ":class:`locale`:" #: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 " -"(:gh:`90817`), but has been postponed to Python 3.15. " -"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " -"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " -"in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" -"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " -"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" -"獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " -"Use :func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" -"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" @@ -3433,16 +3395,16 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" -"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " -"於 :gh:`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for " -"creating :class:`~typing.NamedTuple` classes (for example, ``Point = " -"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " -"3.13. Use the class-based syntax or the functional syntax instead." +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (for example, ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``) has been deprecated since Python 3.13. Use the class-based syntax " +"or the functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" @@ -3473,14 +3435,13 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " -"and :meth:`~wave.Wave_read.getmarkers` methods of " -"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " -"deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" -"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " -"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:107 msgid ":mod:`zipimport`:" @@ -3492,9 +3453,9 @@ msgid "" "3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " "by Jiahao Li in :gh:`125746`.)" msgstr "" -":meth:`~zipimport.zipimporter.load_module` 自 Python 3.10 被棄用。請改" -"用 :meth:`~zipimport.zipimporter.exec_module`。(由 Jiahao Li " -"於 :gh:`125746` 貢獻。)" +":meth:`~zipimport.zipimporter.load_module` 自 Python 3.10 被棄用。請改用 :" +"meth:`~zipimport.zipimporter.exec_module`。(由 Jiahao Li 於 :gh:`125746` 貢" +"獻。)" #: ../../deprecations/c-api-pending-removal-in-3.16.rst:2 #: ../../deprecations/pending-removal-in-3.16.rst:2 @@ -3503,10 +3464,10 @@ msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to " -"set :attr:`__spec__.loader ` is " -"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " -"taken into consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "` 的做法將於 Python 3.16 被棄用。在 " @@ -3529,8 +3490,8 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除;請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " -"於 :gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" +"gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 msgid "" @@ -3624,8 +3585,8 @@ msgid "" "*function* or *sequence* as keyword arguments has been deprecated since " "Python 3.14." msgstr "" -"自 Python 3.14 起,使用 *function* 或 *sequence* 關鍵字引數呼" -"叫 :func:`functools.reduce` 的 Python 實作已被棄用。" +"自 Python 3.14 起,使用 *function* 或 *sequence* 關鍵字引數呼叫 :func:" +"`functools.reduce` 的 Python 實作已被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:64 msgid ":mod:`logging`:" @@ -3642,10 +3603,10 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.16.rst:72 msgid "" -"Valid extensions start with a '.' or are empty " -"for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated " -"and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " -"Kemenade in :gh:`75223`.)" +"Valid extensions start with a '.' or are empty for :meth:`mimetypes." +"MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :" +"exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:" +"`75223`.)" msgstr "" "有效的副檔名以 '.' 開頭或對 :meth:`mimetypes.MimeTypes.add_type` 為空字串。未" "加點的副檔名已被棄用,並將在 Python 3.16 中引發 :exc:`ValueError`。(由 Hugo " @@ -3720,6 +3681,36 @@ msgstr "" "除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " "和 :func:`typing.get_args`,或者依賴私有實作細節。" +#: ../../deprecations/pending-removal-in-3.17.rst:11 +msgid "" +":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " +"removal in Python 3.17. Prefer :class:`~collections.abc.Sequence` or :class:" +"`~collections.abc.Buffer`. For use in type annotations, prefer a union, like " +"``bytes | bytearray``, or :class:`collections.abc.Buffer`. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" +"自 Python 3.9 起已被棄用的 :class:`typing.ByteString`,計劃在 Python " +"3.17 中移除。建議改用 :class:`~collections.abc.Sequence` 或 :class:`~" +"collections.abc.Buffer`。在型別註釋中建議改用聯集,例如 ``bytes | " +"bytearray`` 或 :class:`collections.abc.Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.17.rst:17 +msgid ":mod:`collections.abc`:" +msgstr ":mod:`collections.abc`:" + +#: ../../deprecations/pending-removal-in-3.17.rst:19 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. " +"Prefer :class:`~collections.abc.Sequence` or :class:`~collections.abc." +"Buffer`. For use in type annotations, prefer a union, like ``bytes | " +"bytearray``, or :class:`collections.abc.Buffer`. (Contributed by Shantanu " +"Jain in :gh:`91896`.)" +msgstr "" +":class:`collections.abc.ByteString` 計劃在 Python 3.17 中移除。建議改用 " +":class:`~collections.abc.Sequence` 或 :class:`~collections.abc.Buffer`。在" +"型別註釋中建議改用聯集,例如 ``bytes | bytearray`` 或 :class:`collections.abc." +"Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" + #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 msgid "Pending removal in future versions" @@ -3742,11 +3733,11 @@ msgstr "巢狀引數群組和巢狀互斥群組已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:11 msgid "" -"Passing the undocumented keyword argument *prefix_chars* " -"to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." +"Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse." +"ArgumentParser.add_argument_group` is now deprecated." msgstr "" -"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞" -"給 :meth:`~argparse.ArgumentParser.add_argument_group` 的做法現在已被棄用。" +"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞給 :meth:`~argparse." +"ArgumentParser.add_argument_group` 的做法現在已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:14 msgid "The :class:`argparse.FileType` type converter is deprecated." @@ -3771,17 +3762,17 @@ msgid "" "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of " -"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " -"and :keyword:`or`. In a future release it will be changed to a syntax " -"error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" -"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " -"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" -"法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" +"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" +"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" +"本中,它將被更改為語法錯誤。(:gh:`87999`)" #: ../../deprecations/pending-removal-in-future.rst:30 msgid "" @@ -3794,18 +3785,18 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:33 msgid "" -"Support for ``__float__()`` method returning a strict subclass " -"of :class:`float`: these methods will be required to return an instance " -"of :class:`float`." +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:36 msgid "" -"Support for ``__complex__()`` method returning a strict subclass " -"of :class:`complex`: these methods will be required to return an instance " -"of :class:`complex`." +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" @@ -3816,10 +3807,10 @@ msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" #: ../../deprecations/pending-removal-in-future.rst:40 msgid "" -"Passing a complex number as the *real* or *imag* argument in " -"the :func:`complex` constructor is now deprecated; it should only be passed " -"as a single positional argument. (Contributed by Serhiy Storchaka " -"in :gh:`109218`.)" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" @@ -3827,9 +3818,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:45 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` " -"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " @@ -3837,8 +3827,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:50 msgid "" -":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " -"(:gh:`133038`)" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:" +"`133038`)" msgstr "" ":mod:`codecs`:請改用 :func:`open` 而非 :func:`codecs.open`。(:gh:`133038`)" @@ -3855,19 +3845,19 @@ msgstr ":mod:`datetime`:" #: ../../deprecations/pending-removal-in-future.rst:57 msgid "" -":meth:`~datetime.datetime.utcnow`: use " -"``datetime.datetime.now(tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 " -"``datetime.datetime.now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." +"now(tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:59 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:62 msgid ":mod:`gettext`: Plural value must be an integer." @@ -3898,8 +3888,8 @@ msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" -"用 :meth:`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" #: ../../deprecations/pending-removal-in-future.rst:77 msgid "" @@ -3956,11 +3946,11 @@ msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:100 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " -"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " -"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" +"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" #: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.OP_NO_SSL*`` options" @@ -4008,11 +3998,11 @@ msgstr ":mod:`threading` 方法:" #: ../../deprecations/pending-removal-in-future.rst:116 msgid "" -":meth:`!threading.Condition.notifyAll`: " -"use :meth:`~threading.Condition.notify_all`." +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請" -"用 :meth:`~threading.Condition.notify_all`。" +":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." +"notify_all`。" #: ../../deprecations/pending-removal-in-future.rst:117 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." @@ -4020,19 +4010,19 @@ msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set` #: ../../deprecations/pending-removal-in-future.rst:118 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " -"use :attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:120 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " -"use :attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" -"用 :attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" +"attr:`threading.Thread.name` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:122 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." @@ -4125,22 +4115,22 @@ msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分 #: ../../deprecations/pending-removal-in-future.rst:152 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of " -"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " -"release it will always return ``True``. Prefer explicit ``len(elem)`` or " -"``elem is not None`` tests instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用" -"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" -"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." +"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " +"``len(elem)`` 或 ``elem is not None`` 測試。" #: ../../deprecations/pending-removal-in-future.rst:157 msgid "" -":func:`sys._clear_type_cache` is deprecated: " -"use :func:`sys._clear_internal_caches` instead." +":func:`sys._clear_type_cache` is deprecated: use :func:`sys." +"_clear_internal_caches` instead." msgstr "" -":func:`sys._clear_type_cache` 已被棄用:請改" -"用 :func:`sys._clear_internal_caches`。" +":func:`sys._clear_type_cache` 已被棄用:請改用 :func:`sys." +"_clear_internal_caches`。" #: ../../whatsnew/3.13.rst:2033 msgid "CPython Bytecode Changes" @@ -4151,8 +4141,8 @@ msgid "" "The oparg of :opcode:`YIELD_VALUE` is now ``1`` if the yield is part of a " "yield-from or await, and ``0`` otherwise. The oparg of :opcode:`RESUME` was " "changed to add a bit indicating if the except-depth is 1, which is needed to " -"optimize closing of generators. (Contributed by Irit Katriel " -"in :gh:`111354`.)" +"optimize closing of generators. (Contributed by Irit Katriel in :gh:" +"`111354`.)" msgstr "" #: ../../whatsnew/3.13.rst:2043 @@ -4161,8 +4151,8 @@ msgstr "C API 變更" #: ../../whatsnew/3.13.rst:2048 msgid "" -"Add the :ref:`PyMonitoring C API ` for " -"generating :pep:`669` monitoring events:" +"Add the :ref:`PyMonitoring C API ` for generating :pep:" +"`669` monitoring events:" msgstr "" #: ../../whatsnew/3.13.rst:2051 @@ -4248,10 +4238,9 @@ msgstr "(由 Irit Katriel 在 :gh:`111997` 中貢獻。)" #: ../../whatsnew/3.13.rst:2073 msgid "" "Add :c:type:`PyMutex`, a lightweight mutex that occupies a single byte, and " -"the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` " -"functions. :c:func:`!PyMutex_Lock` will release the :term:`GIL` (if " -"currently held) if the operation needs to block. (Contributed by Sam Gross " -"in :gh:`108724`.)" +"the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` functions. :c:" +"func:`!PyMutex_Lock` will release the :term:`GIL` (if currently held) if the " +"operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" msgstr "" #: ../../whatsnew/3.13.rst:2079 @@ -4301,10 +4290,10 @@ msgstr "(由 Victor Stinner 和 Petr Viktorin 在 :gh:`110850` 中貢獻。) #: ../../whatsnew/3.13.rst:2093 msgid "" -"Add the :c:func:`PyDict_ContainsString` function with the same behavior " -"as :c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const " -"char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`. " -"(Contributed by Victor Stinner in :gh:`108314`.)" +"Add the :c:func:`PyDict_ContainsString` function with the same behavior as :" +"c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` " +"UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`. (Contributed " +"by Victor Stinner in :gh:`108314`.)" msgstr "" #: ../../whatsnew/3.13.rst:2099 @@ -4313,16 +4302,16 @@ msgid "" "functions, which behave similarly to :c:func:`PyDict_GetItemWithError`, but " "return a :term:`strong reference` instead of a :term:`borrowed reference`. " "Moreover, these functions return ``-1`` on error, removing the need to " -"check :c:func:`!PyErr_Occurred`. (Contributed by Victor Stinner " -"in :gh:`106004`.)" +"check :c:func:`!PyErr_Occurred`. (Contributed by Victor Stinner in :gh:" +"`106004`.)" msgstr "" #: ../../whatsnew/3.13.rst:2107 msgid "" -"Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly " -"to :c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` " -"instead of a :term:`borrowed reference`. This function returns ``-1`` on " -"error, ``0`` on insertion, and ``1`` if the key was already present in the " +"Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly to :" +"c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` instead " +"of a :term:`borrowed reference`. This function returns ``-1`` on error, " +"``0`` on insertion, and ``1`` if the key was already present in the " "dictionary. (Contributed by Sam Gross in :gh:`112066`.)" msgstr "" @@ -4330,45 +4319,45 @@ msgstr "" msgid "" "Add the :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions to " "remove a key from a dictionary and optionally return the removed value. This " -"is similar to :meth:`dict.pop`, though there is no default value, " -"and :exc:`KeyError` is not raised for missing keys. (Contributed by Stefan " -"Behnel and Victor Stinner in :gh:`111262`.)" +"is similar to :meth:`dict.pop`, though there is no default value, and :exc:" +"`KeyError` is not raised for missing keys. (Contributed by Stefan Behnel and " +"Victor Stinner in :gh:`111262`.)" msgstr "" #: ../../whatsnew/3.13.rst:2122 msgid "" -"Add the :c:func:`PyMapping_GetOptionalItem` " -"and :c:func:`PyMapping_GetOptionalItemString` functions as alternatives " -"to :c:func:`PyObject_GetItem` and :c:func:`PyMapping_GetItemString` " -"respectively. The new functions do not raise :exc:`KeyError` if the " -"requested key is missing from the mapping. These variants are more " -"convenient and faster if a missing key should not be treated as a failure. " -"(Contributed by Serhiy Storchaka in :gh:`106307`.)" +"Add the :c:func:`PyMapping_GetOptionalItem` and :c:func:" +"`PyMapping_GetOptionalItemString` functions as alternatives to :c:func:" +"`PyObject_GetItem` and :c:func:`PyMapping_GetItemString` respectively. The " +"new functions do not raise :exc:`KeyError` if the requested key is missing " +"from the mapping. These variants are more convenient and faster if a missing " +"key should not be treated as a failure. (Contributed by Serhiy Storchaka in :" +"gh:`106307`.)" msgstr "" #: ../../whatsnew/3.13.rst:2132 msgid "" -"Add the :c:func:`PyObject_GetOptionalAttr` " -"and :c:func:`PyObject_GetOptionalAttrString` functions as alternatives " -"to :c:func:`PyObject_GetAttr` and :c:func:`PyObject_GetAttrString` " -"respectively. The new functions do not raise :exc:`AttributeError` if the " -"requested attribute is not found on the object. These variants are more " -"convenient and faster if the missing attribute should not be treated as a " -"failure. (Contributed by Serhiy Storchaka in :gh:`106521`.)" +"Add the :c:func:`PyObject_GetOptionalAttr` and :c:func:" +"`PyObject_GetOptionalAttrString` functions as alternatives to :c:func:" +"`PyObject_GetAttr` and :c:func:`PyObject_GetAttrString` respectively. The " +"new functions do not raise :exc:`AttributeError` if the requested attribute " +"is not found on the object. These variants are more convenient and faster if " +"the missing attribute should not be treated as a failure. (Contributed by " +"Serhiy Storchaka in :gh:`106521`.)" msgstr "" #: ../../whatsnew/3.13.rst:2142 msgid "" -"Add the :c:func:`PyErr_FormatUnraisable` function as an extension " -"to :c:func:`PyErr_WriteUnraisable` that allows customizing the warning " -"message. (Contributed by Serhiy Storchaka in :gh:`108082`.)" +"Add the :c:func:`PyErr_FormatUnraisable` function as an extension to :c:func:" +"`PyErr_WriteUnraisable` that allows customizing the warning message. " +"(Contributed by Serhiy Storchaka in :gh:`108082`.)" msgstr "" #: ../../whatsnew/3.13.rst:2147 msgid "" -"Add new functions that return a :term:`strong reference` instead of " -"a :term:`borrowed reference` for frame locals, globals, and builtins, as " -"part of :ref:`PEP 667 `:" +"Add new functions that return a :term:`strong reference` instead of a :term:" +"`borrowed reference` for frame locals, globals, and builtins, as part of :" +"ref:`PEP 667 `:" msgstr "" #: ../../whatsnew/3.13.rst:2151 @@ -4398,10 +4387,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:2164 msgid "" -"Add the :c:func:`PyImport_AddModuleRef` function as a replacement " -"for :c:func:`PyImport_AddModule` that returns a :term:`strong reference` " -"instead of a :term:`borrowed reference`. (Contributed by Victor Stinner " -"in :gh:`105922`.)" +"Add the :c:func:`PyImport_AddModuleRef` function as a replacement for :c:" +"func:`PyImport_AddModule` that returns a :term:`strong reference` instead of " +"a :term:`borrowed reference`. (Contributed by Victor Stinner in :gh:" +"`105922`.)" msgstr "" #: ../../whatsnew/3.13.rst:2169 @@ -4413,9 +4402,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2174 msgid "" -"Add the :c:func:`PyList_GetItemRef` function as a replacement " -"for :c:func:`PyList_GetItem` that returns a :term:`strong reference` instead " -"of a :term:`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" +"Add the :c:func:`PyList_GetItemRef` function as a replacement for :c:func:" +"`PyList_GetItem` that returns a :term:`strong reference` instead of a :term:" +"`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" msgstr "" #: ../../whatsnew/3.13.rst:2179 @@ -4427,10 +4416,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2183 msgid "" -"Add the :c:func:`PyLong_AsInt` function. It behaves similarly " -"to :c:func:`PyLong_AsLong`, but stores the result in a C :c:expr:`int` " -"instead of a C :c:expr:`long`. (Contributed by Victor Stinner " -"in :gh:`108014`.)" +"Add the :c:func:`PyLong_AsInt` function. It behaves similarly to :c:func:" +"`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead of a C :" +"c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)" msgstr "" #: ../../whatsnew/3.13.rst:2188 @@ -4443,17 +4431,16 @@ msgstr "" #: ../../whatsnew/3.13.rst:2194 msgid "" -"Add :c:func:`PyModule_Add` function, which is similar " -"to :c:func:`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but " -"always steals a reference to the value. (Contributed by Serhiy Storchaka " -"in :gh:`86493`.)" +"Add :c:func:`PyModule_Add` function, which is similar to :c:func:" +"`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals " +"a reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" #: ../../whatsnew/3.13.rst:2199 msgid "" "Add the :c:func:`PyObject_GenericHash` function that implements the default " -"hashing function of a Python object. (Contributed by Serhiy Storchaka " -"in :gh:`113024`.)" +"hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" +"`113024`.)" msgstr "" #: ../../whatsnew/3.13.rst:2203 @@ -4464,12 +4451,11 @@ msgstr "" #: ../../whatsnew/3.13.rst:2206 msgid "" -"Add the :c:func:`PyObject_VisitManagedDict` " -"and :c:func:`PyObject_ClearManagedDict` functions. which must be called by " -"the traverse and clear functions of a type using " -"the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag. The `pythoncapi-compat " -"project`_ can be used to use these functions with Python 3.11 and 3.12. " -"(Contributed by Victor Stinner in :gh:`107073`.)" +"Add the :c:func:`PyObject_VisitManagedDict` and :c:func:" +"`PyObject_ClearManagedDict` functions. which must be called by the traverse " +"and clear functions of a type using the :c:macro:`Py_TPFLAGS_MANAGED_DICT` " +"flag. The `pythoncapi-compat project`_ can be used to use these functions " +"with Python 3.11 and 3.12. (Contributed by Victor Stinner in :gh:`107073`.)" msgstr "" #: ../../whatsnew/3.13.rst:2214 @@ -4482,9 +4468,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2220 msgid "" -"Add the :c:func:`PySys_AuditTuple` function as an alternative " -"to :c:func:`PySys_Audit` that takes event arguments as a " -"Python :class:`tuple` object. (Contributed by Victor Stinner in :gh:`85283`.)" +"Add the :c:func:`PySys_AuditTuple` function as an alternative to :c:func:" +"`PySys_Audit` that takes event arguments as a Python :class:`tuple` object. " +"(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" #: ../../whatsnew/3.13.rst:2225 @@ -4498,10 +4484,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2231 msgid "" "Add the :c:func:`PyType_GetFullyQualifiedName` function to get the type's " -"fully qualified name. The module name is prepended " -"if :attr:`type.__module__` is a string and is not equal to either " -"``'builtins'`` or ``'__main__'``. (Contributed by Victor Stinner " -"in :gh:`111696`.)" +"fully qualified name. The module name is prepended if :attr:`type." +"__module__` is a string and is not equal to either ``'builtins'`` or " +"``'__main__'``. (Contributed by Victor Stinner in :gh:`111696`.)" msgstr "" #: ../../whatsnew/3.13.rst:2237 @@ -4513,19 +4498,19 @@ msgstr "" #: ../../whatsnew/3.13.rst:2242 msgid "" -"Add the :c:func:`PyUnicode_EqualToUTF8AndSize` " -"and :c:func:`PyUnicode_EqualToUTF8` functions to compare a Unicode object " -"with a :c:expr:`const char*` UTF-8 encoded string and ``1`` if they are " -"equal or ``0`` otherwise. These functions do not raise exceptions. " -"(Contributed by Serhiy Storchaka in :gh:`110289`.)" +"Add the :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" +"`PyUnicode_EqualToUTF8` functions to compare a Unicode object with a :c:expr:" +"`const char*` UTF-8 encoded string and ``1`` if they are equal or ``0`` " +"otherwise. These functions do not raise exceptions. (Contributed by Serhiy " +"Storchaka in :gh:`110289`.)" msgstr "" #: ../../whatsnew/3.13.rst:2249 msgid "" -"Add the :c:func:`PyWeakref_GetRef` function as an alternative " -"to :c:func:`PyWeakref_GetObject` that returns a :term:`strong reference` or " -"``NULL`` if the referent is no longer live. (Contributed by Victor Stinner " -"in :gh:`105927`.)" +"Add the :c:func:`PyWeakref_GetRef` function as an alternative to :c:func:" +"`PyWeakref_GetObject` that returns a :term:`strong reference` or ``NULL`` if " +"the referent is no longer live. (Contributed by Victor Stinner in :gh:" +"`105927`.)" msgstr "" #: ../../whatsnew/3.13.rst:2255 @@ -4539,11 +4524,11 @@ msgstr ":c:func:`PyObject_HasAttrWithError` 取代 :c:func:`PyObject_HasAttr`。 #: ../../whatsnew/3.13.rst:2258 msgid "" -":c:func:`PyObject_HasAttrStringWithError` " -"replaces :c:func:`PyObject_HasAttrString`." +":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" +"`PyObject_HasAttrString`." msgstr "" -":c:func:`PyObject_HasAttrStringWithError` 取" -"代 :c:func:`PyObject_HasAttrString`。" +":c:func:`PyObject_HasAttrStringWithError` 取代 :c:func:" +"`PyObject_HasAttrString`。" #: ../../whatsnew/3.13.rst:2260 msgid "" @@ -4552,11 +4537,11 @@ msgstr ":c:func:`PyMapping_HasKeyWithError` 取代 :c:func:`PyMapping_HasKey`。 #: ../../whatsnew/3.13.rst:2261 msgid "" -":c:func:`PyMapping_HasKeyStringWithError` " -"replaces :c:func:`PyMapping_HasKeyString`." +":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" +"`PyMapping_HasKeyString`." msgstr "" -":c:func:`PyMapping_HasKeyStringWithError` 取" -"代 :c:func:`PyMapping_HasKeyString`。" +":c:func:`PyMapping_HasKeyStringWithError` 取代 :c:func:" +"`PyMapping_HasKeyString`。" #: ../../whatsnew/3.13.rst:2264 msgid "" @@ -4574,15 +4559,15 @@ msgstr "" #: ../../whatsnew/3.13.rst:2273 msgid "" -"The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` " -"and :c:func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * " -"const *` in C and :c:expr:`const char * const *` in C++, instead " -"of :c:expr:`char **`. In C++, this makes these functions compatible with " -"arguments of type :c:expr:`const char * const *`, :c:expr:`const char **`, " -"or :c:expr:`char * const *` without an explicit type cast. In C, the " -"functions only support arguments of type :c:expr:`char * const *`. This can " -"be overridden with the :c:macro:`PY_CXX_CONST` macro. (Contributed by Serhiy " -"Storchaka in :gh:`65210`.)" +"The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" +"func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " +"in C and :c:expr:`const char * const *` in C++, instead of :c:expr:`char " +"**`. In C++, this makes these functions compatible with arguments of type :c:" +"expr:`const char * const *`, :c:expr:`const char **`, or :c:expr:`char * " +"const *` without an explicit type cast. In C, the functions only support " +"arguments of type :c:expr:`char * const *`. This can be overridden with the :" +"c:macro:`PY_CXX_CONST` macro. (Contributed by Serhiy Storchaka in :gh:" +"`65210`.)" msgstr "" #: ../../whatsnew/3.13.rst:2285 @@ -4600,18 +4585,19 @@ msgstr "" #: ../../whatsnew/3.13.rst:2293 msgid "" -"The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, " -"and :c:func:`PySys_GetObject` functions, each of which clears all errors " -"which occurred when calling them now reports these errors " -"using :func:`sys.unraisablehook`. You may replace them with other functions " -"as recommended in the documentation. (Contributed by Serhiy Storchaka " -"in :gh:`106672`.)" +"The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" +"`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" +"`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, and :c:func:" +"`PySys_GetObject` functions, each of which clears all errors which occurred " +"when calling them now reports these errors using :func:`sys.unraisablehook`. " +"You may replace them with other functions as recommended in the " +"documentation. (Contributed by Serhiy Storchaka in :gh:`106672`.)" msgstr "" #: ../../whatsnew/3.13.rst:2302 msgid "" -"Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats " -"to :c:func:`PyUnicode_FromFormat`:" +"Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" +"`PyUnicode_FromFormat`:" msgstr "" #: ../../whatsnew/3.13.rst:2305 @@ -4632,8 +4618,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:2310 msgid "" -"See :pep:`737` for more information. (Contributed by Victor Stinner " -"in :gh:`111696`.)" +"See :pep:`737` for more information. (Contributed by Victor Stinner in :gh:" +"`111696`.)" msgstr "" #: ../../whatsnew/3.13.rst:2313 @@ -4641,16 +4627,16 @@ msgid "" "You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " "including :file:`Python.h` when using ``#`` formats in :ref:`format codes " "`. APIs accepting the format codes always " -"use ``Py_ssize_t`` for ``#`` formats. (Contributed by Inada Naoki " -"in :gh:`104922`.)" +"use ``Py_ssize_t`` for ``#`` formats. (Contributed by Inada Naoki in :gh:" +"`104922`.)" msgstr "" #: ../../whatsnew/3.13.rst:2319 msgid "" "If Python is built in :ref:`debug mode ` or :option:`with " -"assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` " -"and :c:func:`PyList_SET_ITEM` now check the index argument with an " -"assertion. (Contributed by Victor Stinner in :gh:`106168`.)" +"assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" +"`PyList_SET_ITEM` now check the index argument with an assertion. " +"(Contributed by Victor Stinner in :gh:`106168`.)" msgstr "" #: ../../whatsnew/3.13.rst:2327 @@ -4691,8 +4677,8 @@ msgstr ":c:func:`PyType_GetModuleByDef`" #: ../../whatsnew/3.13.rst:2339 msgid "" -"(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, " -"and :gh:`116936`.)" +"(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, and :gh:" +"`116936`.)" msgstr "" "(由 Victor Stinner 貢獻於 :gh:`85283`、:gh:`85283` 和 :gh:`116936`。)" @@ -4719,26 +4705,26 @@ msgstr "" #: ../../whatsnew/3.13.rst:2357 msgid "" -"Remove old buffer protocols deprecated in Python 3.0. " -"Use :ref:`bufferobjects` instead." +"Remove old buffer protocols deprecated in Python 3.0. Use :ref:" +"`bufferobjects` instead." msgstr "" #: ../../whatsnew/3.13.rst:2360 msgid "" ":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " -"test whether the object supports the buffer protocol. Note " -"that :c:func:`PyObject_CheckBuffer` doesn't guarantee " -"that :c:func:`PyObject_GetBuffer` will succeed. To test if the object is " -"actually readable, see the next example of :c:func:`PyObject_GetBuffer`." +"test whether the object supports the buffer protocol. Note that :c:func:" +"`PyObject_CheckBuffer` doesn't guarantee that :c:func:`PyObject_GetBuffer` " +"will succeed. To test if the object is actually readable, see the next " +"example of :c:func:`PyObject_GetBuffer`." msgstr "" #: ../../whatsnew/3.13.rst:2368 msgid "" -":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: " -"Use :c:func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" +":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: Use :c:" +"func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" msgstr "" -":c:func:`!PyObject_AsCharBuffer`、:c:func:`!PyObject_AsReadBuffer`:請改" -"用 :c:func:`PyObject_GetBuffer` 和 :c:func:`PyBuffer_Release`。" +":c:func:`!PyObject_AsCharBuffer`、:c:func:`!PyObject_AsReadBuffer`:請改用 :" +"c:func:`PyObject_GetBuffer` 和 :c:func:`PyBuffer_Release`。" #: ../../whatsnew/3.13.rst:2371 msgid "" @@ -4753,11 +4739,11 @@ msgstr "" #: ../../whatsnew/3.13.rst:2381 msgid "" -":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` " -"and :c:func:`PyBuffer_Release` instead:" +":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" +"func:`PyBuffer_Release` instead:" msgstr "" -":c:func:`!PyObject_AsWriteBuffer`:請改用 :c:func:`PyObject_GetBuffer` " -"和 :c:func:`PyBuffer_Release`。" +":c:func:`!PyObject_AsWriteBuffer`:請改用 :c:func:`PyObject_GetBuffer` 和 :c:" +"func:`PyBuffer_Release`。" #: ../../whatsnew/3.13.rst:2384 msgid "" @@ -4779,8 +4765,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:2397 msgid "" -":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: " -"Use :c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." +":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: Use :" +"c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." msgstr "" ":c:func:`!PyEval_CallObject`、:c:func:`!PyEval_CallObjectWithKeywords`:請改" "用 :c:func:`PyObject_CallNoArgs` 或 :c:func:`PyObject_Call`。" @@ -4791,9 +4777,9 @@ msgid "" "and must not be ``NULL``, and keyword arguments must be a :class:`dict` or " "``NULL``, whereas the removed functions checked argument types and accepted " "``NULL`` positional and keyword arguments. To replace " -"``PyEval_CallObjectWithKeywords(func, NULL, kwargs)`` " -"with :c:func:`PyObject_Call`, pass an empty tuple as positional arguments " -"using :c:func:`PyTuple_New(0) `." +"``PyEval_CallObjectWithKeywords(func, NULL, kwargs)`` with :c:func:" +"`PyObject_Call`, pass an empty tuple as positional arguments using :c:func:" +"`PyTuple_New(0) `." msgstr "" #: ../../whatsnew/3.13.rst:2412 @@ -4827,8 +4813,8 @@ msgid "" ":c:func:`!PySys_AddWarnOptionUnicode`: Use :c:member:`PyConfig.warnoptions` " "instead." msgstr "" -":c:func:`!PySys_AddWarnOptionUnicode`:請改" -"用 :c:member:`PyConfig.warnoptions`。" +":c:func:`!PySys_AddWarnOptionUnicode`:請改用 :c:member:`PyConfig." +"warnoptions`。" #: ../../whatsnew/3.13.rst:2426 msgid "" @@ -4861,13 +4847,13 @@ msgstr "" #: ../../whatsnew/3.13.rst:2436 msgid "" -":c:func:`!Py_SetStandardStreamEncoding`: " -"Set :c:member:`PyConfig.stdio_encoding` instead, and set also " -"maybe :c:member:`PyConfig.legacy_windows_stdio` (on Windows)." +":c:func:`!Py_SetStandardStreamEncoding`: Set :c:member:`PyConfig." +"stdio_encoding` instead, and set also maybe :c:member:`PyConfig." +"legacy_windows_stdio` (on Windows)." msgstr "" -":c:func:`!Py_SetStandardStreamEncoding`:請改" -"用 :c:member:`PyConfig.stdio_encoding` 並設定可能" -"的 :c:member:`PyConfig.legacy_windows_stdio`\\ (在 Windows 上)。" +":c:func:`!Py_SetStandardStreamEncoding`:請改用 :c:member:`PyConfig." +"stdio_encoding` 並設定可能的 :c:member:`PyConfig.legacy_windows_stdio`\\ " +"(在 Windows 上)。" #: ../../whatsnew/3.13.rst:2439 msgid "" @@ -4883,8 +4869,8 @@ msgid "" "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "" "請改用 :ref:`Python 初始化設定 `\\ 的新 :c:type:`PyConfig` API " -"(:pep:`587`),這是在 Python 3.8 中新增的。(由 Victor Stinner " -"於 :gh:`105145` 貢獻。)" +"(:pep:`587`),這是在 Python 3.8 中新增的。(由 Victor Stinner 於 :gh:" +"`105145` 貢獻。)" #: ../../whatsnew/3.13.rst:2446 msgid "" @@ -4929,17 +4915,17 @@ msgstr "" #: ../../whatsnew/3.13.rst:2464 msgid "" -"Remove the :c:func:`!_PyInterpreterState_Get` alias " -"to :c:func:`PyInterpreterState_Get()` which was kept for backward " -"compatibility with Python 3.8. The `pythoncapi-compat project`_ can be used " -"to get :c:func:`PyInterpreterState_Get()` on Python 3.8 and older. " -"(Contributed by Victor Stinner in :gh:`106320`.)" +"Remove the :c:func:`!_PyInterpreterState_Get` alias to :c:func:" +"`PyInterpreterState_Get()` which was kept for backward compatibility with " +"Python 3.8. The `pythoncapi-compat project`_ can be used to get :c:func:" +"`PyInterpreterState_Get()` on Python 3.8 and older. (Contributed by Victor " +"Stinner in :gh:`106320`.)" msgstr "" -"移除 :c:func:`!_PyInterpreterState_Get` 這個" -"對 :c:func:`PyInterpreterState_Get()` 的別名,這個別名是為了與 Python 3.8 的" -"向後相容性而保留的。`pythoncapi-compat 專案`_\\ 可以用於在 Python 3.8 和更舊" -"的版本中取得 :c:func:`PyInterpreterState_Get()`。(由 Victor Stinner " -"於 :gh:`106320` 貢獻。)" +"移除 :c:func:`!_PyInterpreterState_Get` 這個對 :c:func:" +"`PyInterpreterState_Get()` 的別名,這個別名是為了與 Python 3.8 的向後相容性而" +"保留的。`pythoncapi-compat 專案`_\\ 可以用於在 Python 3.8 和更舊的版本中取" +"得 :c:func:`PyInterpreterState_Get()`。(由 Victor Stinner 於 :gh:`106320` 貢" +"獻。)" #: ../../whatsnew/3.13.rst:2471 msgid "" @@ -4947,17 +4933,17 @@ msgid "" "PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " "(Contributed by Victor Stinner in :gh:`106023`.)" msgstr "" -"移除私有的 :c:func:`!_PyObject_FastCall` 函式:請改用自 Python 3.8 起可用" -"的 :c:func:`!PyObject_Vectorcall` 函式(:pep:`590`)。(由 Victor Stinner " -"於 :gh:`106023` 貢獻。)" +"移除私有的 :c:func:`!_PyObject_FastCall` 函式:請改用自 Python 3.8 起可用的 :" +"c:func:`!PyObject_Vectorcall` 函式(:pep:`590`)。(由 Victor Stinner 於 :gh:" +"`106023` 貢獻。)" #: ../../whatsnew/3.13.rst:2476 msgid "" "Remove the ``cpython/pytime.h`` header file, which only contained private " "functions. (Contributed by Victor Stinner in :gh:`106316`.)" msgstr "" -"移除只包含私有函式的 ``cpython/pytime.h`` 標頭檔。(由 Victor Stinner " -"於 :gh:`106316` 貢獻。)" +"移除只包含私有函式的 ``cpython/pytime.h`` 標頭檔。(由 Victor Stinner 於 :gh:" +"`106316` 貢獻。)" #: ../../whatsnew/3.13.rst:2480 msgid "" @@ -4990,8 +4976,8 @@ msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " -"和 :data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" +"data:`!warnings.filters`。" #: ../../whatsnew/3.13.rst:2496 msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." @@ -5015,11 +5001,11 @@ msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" #: ../../whatsnew/3.13.rst:2506 msgid "" -":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or " -"the :envvar:`PYTHONHOME` environment variable instead." +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" +"`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " -"或 :envvar:`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" +"`PYTHONHOME` 環境變數。" #: ../../whatsnew/3.13.rst:2510 msgid "(Contributed by Victor Stinner in :gh:`105145`.)" @@ -5027,15 +5013,14 @@ msgstr "(由 Victor Stinner 在 :gh:`105145` 中貢獻。)" #: ../../whatsnew/3.13.rst:2512 msgid "" -":term:`Soft deprecate ` " -"the :c:func:`PyEval_GetBuiltins`, :c:func:`PyEval_GetGlobals`, " -"and :c:func:`PyEval_GetLocals` functions, which return a :term:`borrowed " -"reference`. (Soft deprecated as part of :pep:`667`.)" +":term:`Soft deprecate ` the :c:func:`PyEval_GetBuiltins`, :" +"c:func:`PyEval_GetGlobals`, and :c:func:`PyEval_GetLocals` functions, which " +"return a :term:`borrowed reference`. (Soft deprecated as part of :pep:`667`.)" msgstr "" -":term:`軟性棄用 ` :c:func:`PyEval_GetBuiltins`、:c:func:`PyEval_GetGlobals` " -"和 :c:func:`PyEval_GetLocals` 函式,這些函式會回傳一個\\ :term:`借用參照 " -"`。(作為 :pep:`667` 一部分的軟性棄用。)" +":term:`軟性棄用 ` :c:func:`PyEval_GetBuiltins`、:c:func:" +"`PyEval_GetGlobals` 和 :c:func:`PyEval_GetLocals` 函式,這些函式會回傳一個" +"\\ :term:`借用參照 `。(作為 :pep:`667` 一部分的軟性棄" +"用。)" #: ../../whatsnew/3.13.rst:2518 msgid "" @@ -5043,16 +5028,15 @@ msgid "" "an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " "by Victor Stinner in :gh:`105396`.)" msgstr "" -"棄用 :c:func:`PyImport_ImportModuleNoBlock` 函式,這只是自 Python 3.3 起" -"的 :c:func:`PyImport_ImportModule` 的別名。(由 Victor Stinner " -"在 :gh:`105396` 中貢獻。)" +"棄用 :c:func:`PyImport_ImportModuleNoBlock` 函式,這只是自 Python 3.3 起的 :" +"c:func:`PyImport_ImportModule` 的別名。(由 Victor Stinner 在 :gh:`105396` 中" +"貢獻。)" #: ../../whatsnew/3.13.rst:2522 msgid "" ":term:`Soft deprecate ` the :c:func:`PyModule_AddObject` " -"function. It should be replaced with :c:func:`PyModule_Add` " -"or :c:func:`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka " -"in :gh:`86493`.)" +"function. It should be replaced with :c:func:`PyModule_Add` or :c:func:" +"`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" ":term:`軟性棄用 ` :c:func:`PyModule_AddObject` 函式。應該改" "用 :c:func:`PyModule_Add` 或 :c:func:`PyModule_AddObjectRef`。(由 Serhiy " @@ -5060,11 +5044,11 @@ msgstr "" #: ../../whatsnew/3.13.rst:2528 msgid "" -"Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and " -"the :c:macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type " -"directly instead. Since Python 3.3, ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` " -"are just aliases to :c:type:`!wchar_t`. (Contributed by Victor Stinner " -"in :gh:`105156`.)" +"Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and the :c:" +"macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type directly " +"instead. Since Python 3.3, ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` are just " +"aliases to :c:type:`!wchar_t`. (Contributed by Victor Stinner in :gh:" +"`105156`.)" msgstr "" "棄用舊的 ``Py_UNICODE`` 和 ``PY_UNICODE_TYPE`` 型別以及 :c:macro:`!" "Py_UNICODE_WIDE` 定義。請直接使用 :c:type:`wchar_t` 型別。自 Python 3.3 起," @@ -5073,63 +5057,63 @@ msgstr "" #: ../../whatsnew/3.13.rst:2535 msgid "" -"Deprecate the :c:func:`PyWeakref_GetObject` " -"and :c:func:`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed " -"reference`. Replace them with the new :c:func:`PyWeakref_GetRef` function, " -"which returns a :term:`strong reference`. The `pythoncapi-compat project`_ " -"can be used to get :c:func:`PyWeakref_GetRef` on Python 3.12 and older. " -"(Contributed by Victor Stinner in :gh:`105927`.)" +"Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" +"`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`. " +"Replace them with the new :c:func:`PyWeakref_GetRef` function, which returns " +"a :term:`strong reference`. The `pythoncapi-compat project`_ can be used to " +"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older. (Contributed by " +"Victor Stinner in :gh:`105927`.)" msgstr "" "棄用 :c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT` 函式,這" -"些函式會回傳一個\\ :term:`借用參照 `。請改用新" -"的 :c:func:`PyWeakref_GetRef` 函式,這個函式會回傳一個\\ :term:`強參照 " -"`。`pythoncapi-compat 專案`_\\ 可以用於在 Python 3.12 和更" -"舊的版本中取得 :c:func:`PyWeakref_GetRef`。(由 Victor Stinner " -"在 :gh:`105927` 中貢獻。)" +"些函式會回傳一個\\ :term:`借用參照 `。請改用新的 :c:func:" +"`PyWeakref_GetRef` 函式,這個函式會回傳一個\\ :term:`強參照 `。`pythoncapi-compat 專案`_\\ 可以用於在 Python 3.12 和更舊的版本" +"中取得 :c:func:`PyWeakref_GetRef`。(由 Victor Stinner 在 :gh:`105927` 中貢" +"獻。)" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " "(:pep:`699`; :gh:`101193`)." msgstr "" -":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " -"(:pep:`699`;:gh:`101193`)。" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" +"`699`;:gh:`101193`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 msgid "" "Creating :c:data:`immutable types ` with mutable " "bases (:gh:`95388`)." msgstr "" -"使用可變基底建立\\ :c:data:`不可變型別 ` " -"(:gh:`95388`)。" +"使用可變基底建立\\ :c:data:`不可變型別 ` (:gh:" +"`95388`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: " -"Use :c:func:`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改" -"用 :c:func:`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" +"`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " -"Use :c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project " -"`__ can be used to " -"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project `__ can be used to get :c:func:" +"`PyWeakref_GetRef` on Python 3.12 and older." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" -"用 :c:func:`PyWeakref_GetRef`。可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.12 和更早版本取" -"得 :c:func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.12 和更早版本取得 :c:func:" +"`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " -"Use :c:type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" -"用 :c:type:`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 msgid "" @@ -5144,8 +5128,8 @@ msgid "" "than :class:`str`, such as :class:`bytes`." msgstr "" ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`;請注" -"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`str` 的型別,例" -"如 :class:`bytes`。" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`str` 的型別,例如 :" +"class:`bytes`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid "" @@ -5160,8 +5144,8 @@ msgid "" "than :class:`bytes`, such as :class:`str`." msgstr "" ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`;請注" -"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`bytes` 的型別,例" -"如 :class:`str`。" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`bytes` 的型別,例如 :" +"class:`str`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 msgid "Python initialization functions, deprecated in Python 3.13:" @@ -5178,37 +5162,35 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:27 msgid "" ":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") " -"` (:data:`sys.base_prefix`) instead. " -"Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) " -"if :ref:`virtual environments ` need to be handled." +"` (:data:`sys.base_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) if :ref:" +"`virtual environments ` need to be handled." msgstr "" ":c:func:`Py_GetPrefix`:請改用 :c:func:`PyConfig_Get(\"base_prefix\") " "` (:data:`sys.base_prefix`)。如果需要處理\\ :ref:`虛擬環境 " -"`,請改用 :c:func:`PyConfig_Get(\"prefix\") ` " -"(:data:`sys.prefix`)。" +"`,請改用 :c:func:`PyConfig_Get(\"prefix\") ` (:data:" +"`sys.prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:32 msgid "" ":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") " -"` (:data:`sys.base_exec_prefix`) instead. " -"Use :c:func:`PyConfig_Get(\"exec_prefix\") ` " -"(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " -"be handled." +"` (:data:`sys.base_exec_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"exec_prefix\") ` (:data:`sys.exec_prefix`) if :" +"ref:`virtual environments ` need to be handled." msgstr "" -":c:func:`Py_GetExecPrefix`:請改" -"用 :c:func:`PyConfig_Get(\"base_exec_prefix\") ` " -"(:data:`sys.base_exec_prefix`)。如果需要處理\\ :ref:`虛擬環境 `,請" -"改用 :c:func:`PyConfig_Get(\"exec_prefix\") ` " -"(:data:`sys.exec_prefix`)。" +":c:func:`Py_GetExecPrefix`:請改用 :c:func:" +"`PyConfig_Get(\"base_exec_prefix\") ` (:data:`sys." +"base_exec_prefix`)。如果需要處理\\ :ref:`虛擬環境 `,請改用 :c:" +"func:`PyConfig_Get(\"exec_prefix\") ` (:data:`sys." +"exec_prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:38 msgid "" ":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." msgstr "" -":c:func:`Py_GetProgramFullPath`:請改" -"用 :c:func:`PyConfig_Get(\"executable\") ` " -"(:data:`sys.executable`)。" +":c:func:`Py_GetProgramFullPath`:請改用 :c:func:" +"`PyConfig_Get(\"executable\") ` (:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:41 msgid "" @@ -5260,8 +5242,8 @@ msgstr ":c:func:`!Py_SetPythonHome()`:請改用 :c:member:`PyConfig.home`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:65 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." msgstr "" "應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API。" @@ -5271,108 +5253,108 @@ msgstr "全域配置變數:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:70 msgid "" -":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` " -"or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." +":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` or :c:func:" +"`PyConfig_Get(\"parser_debug\") ` instead." msgstr "" -":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug` " -"或 :c:func:`PyConfig_Get(\"parser_debug\") `。" +":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug` 或 :c:func:" +"`PyConfig_Get(\"parser_debug\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:73 msgid "" -":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` " -"or :c:func:`PyConfig_Get(\"verbose\") ` instead." +":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` or :c:func:" +"`PyConfig_Get(\"verbose\") ` instead." msgstr "" -":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose` " -"或 :c:func:`PyConfig_Get(\"verbose\") `。" +":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose` 或 :c:func:" +"`PyConfig_Get(\"verbose\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:76 msgid "" -":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` " -"or :c:func:`PyConfig_Get(\"quiet\") ` instead." +":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` or :c:func:" +"`PyConfig_Get(\"quiet\") ` instead." msgstr "" -":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet` " -"或 :c:func:`PyConfig_Get(\"quiet\") `。" +":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet` 或 :c:func:" +"`PyConfig_Get(\"quiet\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:79 msgid "" -":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` " -"or :c:func:`PyConfig_Get(\"interactive\") ` instead." +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` or :c:func:" +"`PyConfig_Get(\"interactive\") ` instead." msgstr "" -":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive` " -"或 :c:func:`PyConfig_Get(\"interactive\") `。" +":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive` 或 :c:" +"func:`PyConfig_Get(\"interactive\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:82 msgid "" -":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` " -"or :c:func:`PyConfig_Get(\"inspect\") ` instead." +":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` or :c:func:" +"`PyConfig_Get(\"inspect\") ` instead." msgstr "" -":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect` " -"或 :c:func:`PyConfig_Get(\"inspect\") `。" +":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect` 或 :c:func:" +"`PyConfig_Get(\"inspect\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:85 msgid "" -":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " -"or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` or :c:" +"func:`PyConfig_Get(\"optimization_level\") ` instead." msgstr "" -":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level` " -"或 :c:func:`PyConfig_Get(\"optimization_level\") `。" +":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level` 或 :" +"c:func:`PyConfig_Get(\"optimization_level\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:88 msgid "" -":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` " -"or :c:func:`PyConfig_Get(\"site_import\") ` instead." +":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` or :c:func:" +"`PyConfig_Get(\"site_import\") ` instead." msgstr "" -":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import` " -"或 :c:func:`PyConfig_Get(\"site_import\") `。" +":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import` 或 :c:func:" +"`PyConfig_Get(\"site_import\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:91 msgid "" -":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " -"or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` or :c:" +"func:`PyConfig_Get(\"bytes_warning\") ` instead." msgstr "" -":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning` " -"或 :c:func:`PyConfig_Get(\"bytes_warning\") `。" +":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning` 或 :" +"c:func:`PyConfig_Get(\"bytes_warning\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:94 msgid "" -":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " -"or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` or :c:" +"func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" -":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings` " -"或 :c:func:`PyConfig_Get(\"pathconfig_warnings\") `。" +":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings` 或 :" +"c:func:`PyConfig_Get(\"pathconfig_warnings\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:97 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "or :c:func:`PyConfig_Get(\"use_environment\") ` instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment` " -"或 :c:func:`PyConfig_Get(\"use_environment\") `。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." +"use_environment` 或 :c:func:`PyConfig_Get(\"use_environment\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:100 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改" -"用 :c:member:`PyConfig.write_bytecode` " -"或 :c:func:`PyConfig_Get(\"write_bytecode\") `。" +":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." +"write_bytecode` 或 :c:func:`PyConfig_Get(\"write_bytecode\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:103 msgid "" -":c:var:`Py_NoUserSiteDirectory`: " -"Use :c:member:`PyConfig.user_site_directory` " -"or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` or :c:func:`PyConfig_Get(\"user_site_directory\") " +"` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory` " -"或 :c:func:`PyConfig_Get(\"user_site_directory\") `。" +":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." +"user_site_directory` 或 :c:func:`PyConfig_Get(\"user_site_directory\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:106 msgid "" -":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " -"or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` or :" +"c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." msgstr "" ":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio` " "或 :c:func:`PyConfig_Get(\"buffered_stdio\") `。" @@ -5389,70 +5371,69 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:113 msgid "" -":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` " -"or :c:func:`PyConfig_Get(\"isolated\") ` instead." +":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` or :c:func:" +"`PyConfig_Get(\"isolated\") ` instead." msgstr "" -":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated` " -"或 :c:func:`PyConfig_Get(\"isolated\") `。" +":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated` 或 :c:func:" +"`PyConfig_Get(\"isolated\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:116 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` " -"or :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") ` " -"instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` or :c:func:" +"`PyConfig_Get(\"legacy_windows_fs_encoding\") ` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding` " -"或 :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") `。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` 或 :c:func:" +"`PyConfig_Get(\"legacy_windows_fs_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:119 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"Use :c:member:`PyConfig.legacy_windows_stdio` " -"or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") " +"` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio` " -"或 :c:func:`PyConfig_Get(\"legacy_windows_stdio\") `。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." +"legacy_windows_stdio` 或 :c:func:`PyConfig_Get(\"legacy_windows_stdio\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:122 msgid "" ":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" -"Py_HasFileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` " -"or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." +"Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` or :c:func:`PyConfig_Get(\"filesystem_encoding\") " +"` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`、:c:var:`!" -"Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding` " -"或 :c:func:`PyConfig_Get(\"filesystem_encoding\") `。" +"Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding` 或 :c:func:`PyConfig_Get(\"filesystem_encoding\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:125 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"Use :c:member:`PyConfig.filesystem_errors` " -"or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` or :c:func:`PyConfig_Get(\"filesystem_errors\") " +"` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors` " -"或 :c:func:`PyConfig_Get(\"filesystem_errors\") `。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." +"filesystem_errors` 或 :c:func:`PyConfig_Get(\"filesystem_errors\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:128 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` " -"or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` or :c:func:" +"`PyConfig_Get(\"utf8_mode\") ` instead. (see :c:func:" +"`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode` " -"或 :c:func:`PyConfig_Get(\"utf8_mode\") `。(請參" -"閱 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode` 或 :c:func:" +"`PyConfig_Get(\"utf8_mode\") `。(請參閱 :c:func:" +"`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:133 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can " -"be used to get these options at runtime." +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can be used to " +"get these options at runtime." msgstr "" "應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API 來設定" "這些選項。或者也可以使用 :c:func:`PyConfig_Get` 在執行時取得這些選項。" @@ -5466,50 +5447,52 @@ msgid "Pending removal in Python 3.18" msgstr "Python 3.18 中待移除的項目" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:4 -msgid "Deprecated private functions (:gh:`128863`):" -msgstr "被棄用的私有函式 (:gh:`128863`):" +msgid "" +"The following private functions are deprecated and planned for removal in " +"Python 3.18:" +msgstr "以下私有函式已被棄用,並計劃在 Python 3.18 中移除:" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:6 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." msgstr ":c:func:`!_PyBytes_Join`:請改用 :c:func:`PyBytes_Join`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 msgid "" -":c:func:`!_PyDict_GetItemStringWithError`: " -"use :c:func:`PyDict_GetItemStringRef`." +":c:func:`!_PyDict_GetItemStringWithError`: use :c:func:" +"`PyDict_GetItemStringRef`." msgstr "" -":c:func:`!_PyDict_GetItemStringWithError`:請改" -"用 :c:func:`PyDict_GetItemStringRef`。" +":c:func:`!_PyDict_GetItemStringWithError`:請改用 :c:func:" +"`PyDict_GetItemStringRef`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 -msgid ":c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 +msgid ":c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`." msgstr ":c:func:`!_PyDict_Pop()`:請改用 :c:func:`PyDict_Pop`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." msgstr ":c:func:`!_PyLong_Sign()`:請改用 :c:func:`PyLong_GetSign`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:11 msgid "" -":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: " -"use :c:func:`PyLongWriter_Create`." +":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: use :c:func:" +"`PyLongWriter_Create`." msgstr "" -":c:func:`!_PyLong_FromDigits` 和 :c:func:`!_PyLong_New`:請改" -"用 :c:func:`PyLongWriter_Create`。" +":c:func:`!_PyLong_FromDigits` 和 :c:func:`!_PyLong_New`:請改用 :c:func:" +"`PyLongWriter_Create`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:12 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 msgid "" -":c:func:`!_PyThreadState_UncheckedGet`: " -"use :c:func:`PyThreadState_GetUnchecked`." +":c:func:`!_PyThreadState_UncheckedGet`: use :c:func:" +"`PyThreadState_GetUnchecked`." msgstr "" -":c:func:`!_PyThreadState_UncheckedGet`:請改" -"用 :c:func:`PyThreadState_GetUnchecked`。" +":c:func:`!_PyThreadState_UncheckedGet`:請改用 :c:func:" +"`PyThreadState_GetUnchecked`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." msgstr ":c:func:`!_PyUnicode_AsString`:請改用 :c:func:`PyUnicode_AsUTF8`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:15 msgid "" ":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " "with :c:func:`writer = PyUnicodeWriter_Create(0) `." @@ -5517,108 +5500,102 @@ msgstr "" ":c:func:`!_PyUnicodeWriter_Init`:將 ``_PyUnicodeWriter_Init(&writer)`` 替換" "為 :c:func:`writer = PyUnicodeWriter_Create(0) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:17 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:18 msgid "" ":c:func:`!_PyUnicodeWriter_Finish`: replace " -"``_PyUnicodeWriter_Finish(&writer)`` " -"with :c:func:`PyUnicodeWriter_Finish(writer) `." +"``_PyUnicodeWriter_Finish(&writer)`` with :c:func:" +"`PyUnicodeWriter_Finish(writer) `." msgstr "" ":c:func:`!_PyUnicodeWriter_Finish`:將 ``_PyUnicodeWriter_Finish(&writer)`` " "替換為 :c:func:`PyUnicodeWriter_Finish(writer) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:20 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:21 msgid "" ":c:func:`!_PyUnicodeWriter_Dealloc`: replace " -"``_PyUnicodeWriter_Dealloc(&writer)`` " -"with :c:func:`PyUnicodeWriter_Discard(writer) `." +"``_PyUnicodeWriter_Dealloc(&writer)`` with :c:func:" +"`PyUnicodeWriter_Discard(writer) `." msgstr "" ":c:func:`!_PyUnicodeWriter_Dealloc`:將 " -"``_PyUnicodeWriter_Dealloc(&writer)`` 替換" -"為 :c:func:`PyUnicodeWriter_Discard(writer) `。" +"``_PyUnicodeWriter_Dealloc(&writer)`` 替換為 :c:func:" +"`PyUnicodeWriter_Discard(writer) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:23 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:24 msgid "" ":c:func:`!_PyUnicodeWriter_WriteChar`: replace " -"``_PyUnicodeWriter_WriteChar(&writer, ch)`` " -"with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " -"`." +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` with :c:func:" +"`PyUnicodeWriter_WriteChar(writer, ch) `." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteChar`:將 " -"``_PyUnicodeWriter_WriteChar(&writer, ch)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " -"`。" +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteChar(writer, ch) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:26 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:27 msgid "" ":c:func:`!_PyUnicodeWriter_WriteStr`: replace " -"``_PyUnicodeWriter_WriteStr(&writer, str)`` " -"with :c:func:`PyUnicodeWriter_WriteStr(writer, str) " -"`." +"``_PyUnicodeWriter_WriteStr(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteStr(writer, str) `." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteStr`:將 " -"``_PyUnicodeWriter_WriteStr(&writer, str)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteStr(writer, str) " -"`。" +"``_PyUnicodeWriter_WriteStr(&writer, str)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteStr(writer, str) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:29 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:30 msgid "" ":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " -"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` " -"with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` with :c:func:" +"`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " "`." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteSubstring`:將 " -"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " "`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:32 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:33 msgid "" ":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " -"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` " -"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`." +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteASCII(writer, str) `." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteASCIIString`:將 " -"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`。" +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteASCII(writer, str) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:35 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:36 msgid "" ":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace " -"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` " -"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`." +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteUTF8(writer, str) `." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteLatin1String`:將 " -"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`。" +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteUTF8(writer, str) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:38 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." msgstr ":c:func:`!_PyUnicodeWriter_Prepare`:(無替代方案)。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." msgstr ":c:func:`!_PyUnicodeWriter_PrepareKind`:(無替代方案)。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." msgstr ":c:func:`!_Py_HashPointer`:請改用 :c:func:`Py_HashPointer`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:42 msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." msgstr ":c:func:`!_Py_fopen_obj`:請改用 :c:func:`Py_fopen`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:43 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:44 msgid "" "The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older." +">`__ can be used to get these new public functions on Python 3.13 and older. " +"(Contributed by Victor Stinner in :gh:`128863`.)" msgstr "" "可以使用 `pythoncapi-compat project `__ 來取得這些於 Python 3.13 及更早版本的新公開函式。" +"compat/>`__ 來取得這些於 Python 3.13 及更早版本的新公開函式。(由 " +"Victor Stinner 在 :gh:`128863` 貢獻)" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -5639,8 +5616,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改" -"用 :c:func:`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改用 :c:func:" +"`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -5660,11 +5637,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " -"and :c:func:`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " -"和 :c:func:`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" +"`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" @@ -5686,8 +5663,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" -"叫 :c:func:`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" +"`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:29 msgid "Thread Local Storage (TLS) API:" @@ -5736,10 +5713,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2566 msgid "" -"``aarch64-linux-android`` and ``x86_64-linux-android`` are both " -"now :pep:`11` tier 3 platforms. (:ref:`PEP 738 ` written and implementation contributed by Malcolm Smith " -"in :gh:`116622`.)" +"``aarch64-linux-android`` and ``x86_64-linux-android`` are both now :pep:" +"`11` tier 3 platforms. (:ref:`PEP 738 ` " +"written and implementation contributed by Malcolm Smith in :gh:`116622`.)" msgstr "" #: ../../whatsnew/3.13.rst:2571 @@ -5753,8 +5729,8 @@ msgid "" "``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " "(Contributed by Brett Cannon in :gh:`115192`.)" msgstr "" -"``wasm32-emscripten`` 不再是 :pep:`11` 支援的平台。(由 Brett Cannon " -"在 :gh:`115192` 貢獻。)" +"``wasm32-emscripten`` 不再是 :pep:`11` 支援的平台。(由 Brett Cannon 在 :gh:" +"`115192` 貢獻。)" #: ../../whatsnew/3.13.rst:2577 msgid "" @@ -5764,9 +5740,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2580 msgid "" -"Autoconf 2.71 and aclocal 1.16.5 are now required to regenerate " -"the :file:`configure` script. (Contributed by Christian Heimes " -"in :gh:`89886` and by Victor Stinner in :gh:`112090`.)" +"Autoconf 2.71 and aclocal 1.16.5 are now required to regenerate the :file:" +"`configure` script. (Contributed by Christian Heimes in :gh:`89886` and by " +"Victor Stinner in :gh:`112090`.)" msgstr "" #: ../../whatsnew/3.13.rst:2584 @@ -5792,9 +5768,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:2600 msgid "" "Python built with :file:`configure` :option:`--with-trace-refs` (tracing " -"references) is now ABI compatible with the Python release build " -"and :ref:`debug build `. (Contributed by Victor Stinner " -"in :gh:`108634`.)" +"references) is now ABI compatible with the Python release build and :ref:" +"`debug build `. (Contributed by Victor Stinner in :gh:`108634`.)" msgstr "" #: ../../whatsnew/3.13.rst:2605 @@ -5807,11 +5782,11 @@ msgstr "" #: ../../whatsnew/3.13.rst:2609 msgid "" "The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " -"``termios``, ``winsound``, ``_ctypes_test``, " -"``_multiprocessing.posixshmem``, ``_scproxy``, ``_stat``, ``_statistics``, " -"``_testconsole``, ``_testimportmultiple`` and ``_uuid`` C extensions are now " -"built with the :ref:`limited C API `. (Contributed by Victor " -"Stinner in :gh:`85283`.)" +"``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." +"posixshmem``, ``_scproxy``, ``_stat``, ``_statistics``, ``_testconsole``, " +"``_testimportmultiple`` and ``_uuid`` C extensions are now built with the :" +"ref:`limited C API `. (Contributed by Victor Stinner in :gh:" +"`85283`.)" msgstr "" #: ../../whatsnew/3.13.rst:2618 @@ -5868,9 +5843,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2653 msgid "" ":class:`functools.partial` now emits a :exc:`FutureWarning` when used as a " -"method. The behavior will change in future Python versions. Wrap it " -"in :func:`staticmethod` if you want to preserve the old behavior. " -"(Contributed by Serhiy Storchaka in :gh:`121027`.)" +"method. The behavior will change in future Python versions. Wrap it in :func:" +"`staticmethod` if you want to preserve the old behavior. (Contributed by " +"Serhiy Storchaka in :gh:`121027`.)" msgstr "" #: ../../whatsnew/3.13.rst:2659 @@ -5928,8 +5903,8 @@ msgid "" "``Python.h`` no longer includes the ```` standard header. It was " "included for the :c:func:`!finite` function which is now provided by the " "```` header. It should now be included explicitly if needed. Remove " -"also the ``HAVE_IEEEFP_H`` macro. (Contributed by Victor Stinner " -"in :gh:`108765`.)" +"also the ``HAVE_IEEEFP_H`` macro. (Contributed by Victor Stinner in :gh:" +"`108765`.)" msgstr "" #: ../../whatsnew/3.13.rst:2698 @@ -5938,9 +5913,9 @@ msgid "" "```` and ````. If needed, they should now be " "included explicitly. For example, ```` provides the :c:func:`!clock` " "and :c:func:`!gmtime` functions, ```` provides the :c:func:`!" -"select` function, and ```` provides the :c:func:`!" -"futimes`, :c:func:`!gettimeofday` and :c:func:`!setitimer` functions. " -"(Contributed by Victor Stinner in :gh:`108765`.)" +"select` function, and ```` provides the :c:func:`!futimes`, :c:" +"func:`!gettimeofday` and :c:func:`!setitimer` functions. (Contributed by " +"Victor Stinner in :gh:`108765`.)" msgstr "" #: ../../whatsnew/3.13.rst:2706 @@ -6032,17 +6007,16 @@ msgstr "" #: ../../whatsnew/3.13.rst:2754 msgid "" -"The effects of mutating the dictionary returned " -"from :c:func:`PyEval_GetLocals` in an :term:`optimized scope` have changed. " -"New dict entries added this way will now *only* be visible to " -"subsequent :c:func:`PyEval_GetLocals` calls in that frame, " -"as :c:func:`PyFrame_GetLocals`, :func:`locals`, " -"and :attr:`FrameType.f_locals ` no longer access the same " -"underlying cached dictionary. Changes made to entries for actual variable " -"names and names added via the write-through proxy interfaces will be " -"overwritten on subsequent calls to :c:func:`PyEval_GetLocals` in that frame. " -"The recommended code update depends on how the function was being used, so " -"refer to the deprecation notice on the function for details." +"The effects of mutating the dictionary returned from :c:func:" +"`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " +"entries added this way will now *only* be visible to subsequent :c:func:" +"`PyEval_GetLocals` calls in that frame, as :c:func:`PyFrame_GetLocals`, :" +"func:`locals`, and :attr:`FrameType.f_locals ` no longer " +"access the same underlying cached dictionary. Changes made to entries for " +"actual variable names and names added via the write-through proxy interfaces " +"will be overwritten on subsequent calls to :c:func:`PyEval_GetLocals` in " +"that frame. The recommended code update depends on how the function was " +"being used, so refer to the deprecation notice on the function for details." msgstr "" #: ../../whatsnew/3.13.rst:2767 @@ -6050,8 +6024,8 @@ msgid "" "Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " "returns a write-through proxy rather than a snapshot that gets updated at " "ill-specified times. If a snapshot is desired, it must be created explicitly " -"(e.g. with :c:func:`PyDict_Copy`), or by calling the " -"new :c:func:`PyEval_GetFrameLocals` API." +"(e.g. with :c:func:`PyDict_Copy`), or by calling the new :c:func:" +"`PyEval_GetFrameLocals` API." msgstr "" #: ../../whatsnew/3.13.rst:2774 @@ -6089,11 +6063,11 @@ msgstr "``_PyErr_WriteUnraisableMsg()``::c:func:`PyErr_FormatUnraisable`;" #: ../../whatsnew/3.13.rst:2789 msgid "" -"``_PyEval_SetTrace()``: :c:func:`PyEval_SetTrace` " -"or :c:func:`PyEval_SetTraceAllThreads`;" +"``_PyEval_SetTrace()``: :c:func:`PyEval_SetTrace` or :c:func:" +"`PyEval_SetTraceAllThreads`;" msgstr "" -"``_PyEval_SetTrace()``::c:func:`PyEval_SetTrace` " -"或 :c:func:`PyEval_SetTraceAllThreads`;" +"``_PyEval_SetTrace()``::c:func:`PyEval_SetTrace` 或 :c:func:" +"`PyEval_SetTraceAllThreads`;" #: ../../whatsnew/3.13.rst:2790 msgid "``_PyList_Extend()``: :c:func:`PyList_Extend`;" @@ -6113,15 +6087,19 @@ msgstr "``_PyMem_Strdup()``:``strdup()``;" #: ../../whatsnew/3.13.rst:2794 msgid "``_PyObject_ClearManagedDict()``: :c:func:`PyObject_ClearManagedDict`;" -msgstr "``_PyObject_ClearManagedDict()``::c:func:`PyObject_ClearManagedDict`;" +msgstr "" +"``_PyObject_ClearManagedDict()``::c:func:`PyObject_ClearManagedDict`;" #: ../../whatsnew/3.13.rst:2795 msgid "``_PyObject_VisitManagedDict()``: :c:func:`PyObject_VisitManagedDict`;" -msgstr "``_PyObject_VisitManagedDict()``::c:func:`PyObject_VisitManagedDict`;" +msgstr "" +"``_PyObject_VisitManagedDict()``::c:func:`PyObject_VisitManagedDict`;" #: ../../whatsnew/3.13.rst:2796 -msgid "``_PyThreadState_UncheckedGet()``: :c:func:`PyThreadState_GetUnchecked()`;" -msgstr "``_PyThreadState_UncheckedGet()``::c:func:`PyThreadState_GetUnchecked()`;" +msgid "" +"``_PyThreadState_UncheckedGet()``: :c:func:`PyThreadState_GetUnchecked()`;" +msgstr "" +"``_PyThreadState_UncheckedGet()``::c:func:`PyThreadState_GetUnchecked()`;" #: ../../whatsnew/3.13.rst:2797 msgid "``_PyTime_AsSecondsDouble()``: :c:func:`PyTime_AsSecondsDouble`;" @@ -6129,27 +6107,27 @@ msgstr "``_PyTime_AsSecondsDouble()``::c:func:`PyTime_AsSecondsDouble`;" #: ../../whatsnew/3.13.rst:2798 msgid "" -"``_PyTime_GetMonotonicClock()``: :c:func:`PyTime_Monotonic` " -"or :c:func:`PyTime_MonotonicRaw`;" +"``_PyTime_GetMonotonicClock()``: :c:func:`PyTime_Monotonic` or :c:func:" +"`PyTime_MonotonicRaw`;" msgstr "" -"``_PyTime_GetMonotonicClock()``::c:func:`PyTime_Monotonic` " -"或 :c:func:`PyTime_MonotonicRaw`;" +"``_PyTime_GetMonotonicClock()``::c:func:`PyTime_Monotonic` 或 :c:func:" +"`PyTime_MonotonicRaw`;" #: ../../whatsnew/3.13.rst:2799 msgid "" -"``_PyTime_GetPerfCounter()``: :c:func:`PyTime_PerfCounter` " -"or :c:func:`PyTime_PerfCounterRaw`;" +"``_PyTime_GetPerfCounter()``: :c:func:`PyTime_PerfCounter` or :c:func:" +"`PyTime_PerfCounterRaw`;" msgstr "" -"``_PyTime_GetPerfCounter()``::c:func:`PyTime_PerfCounter` " -"或 :c:func:`PyTime_PerfCounterRaw`;" +"``_PyTime_GetPerfCounter()``::c:func:`PyTime_PerfCounter` 或 :c:func:" +"`PyTime_PerfCounterRaw`;" #: ../../whatsnew/3.13.rst:2800 msgid "" -"``_PyTime_GetSystemClock()``: :c:func:`PyTime_Time` " -"or :c:func:`PyTime_TimeRaw`;" +"``_PyTime_GetSystemClock()``: :c:func:`PyTime_Time` or :c:func:" +"`PyTime_TimeRaw`;" msgstr "" -"``_PyTime_GetSystemClock()``::c:func:`PyTime_Time` " -"或 :c:func:`PyTime_TimeRaw`;" +"``_PyTime_GetSystemClock()``::c:func:`PyTime_Time` 或 :c:func:" +"`PyTime_TimeRaw`;" #: ../../whatsnew/3.13.rst:2801 msgid "``_PyTime_MAX``: :c:var:`PyTime_MAX`;" @@ -6185,13 +6163,20 @@ msgstr "迴歸測試的變更" #: ../../whatsnew/3.13.rst:2813 msgid "" -"Python built with :file:`configure` :option:`--with-pydebug` now supports " -"a :option:`-X presite=package.module <-X>` command-line option. If used, it " +"Python built with :file:`configure` :option:`--with-pydebug` now supports a :" +"option:`-X presite=package.module <-X>` command-line option. If used, it " "specifies a module that should be imported early in the lifecycle of the " "interpreter, before ``site.py`` is executed. (Contributed by Łukasz Langa " "in :gh:`110769`.)" msgstr "" -"使用 :file:`configure` :option:`--with-pydebug` 建置的 Python 現在支" -"援 :option:`-X presite=package.module <-X>` 命令列選項。如果使用它就會指定一" -"個應該在直譯器生命週期的早期階段、在執行 ``site.py`` 之前被引入的模組。(由 " +"使用 :file:`configure` :option:`--with-pydebug` 建置的 Python 現在支援 :" +"option:`-X presite=package.module <-X>` 命令列選項。如果使用它就會指定一個應" +"該在直譯器生命週期的早期階段、在執行 ``site.py`` 之前被引入的模組。(由 " "Łukasz Langa 在 :gh:`110769` 中貢獻。)" + +#~ msgid "" +#~ ":mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9, " +#~ "now causes a :exc:`DeprecationWarning` to be emitted when it is used." +#~ msgstr "" +#~ ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`!typing.ByteString` 現在" +#~ "在使用時會發出 :exc:`DeprecationWarning`。" diff --git a/whatsnew/3.14.po b/whatsnew/3.14.po index 259c8bc51c3..147dddd4b71 100644 --- a/whatsnew/3.14.po +++ b/whatsnew/3.14.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -61,9 +61,9 @@ msgstr "" #: ../../whatsnew/3.14.rst:72 msgid "" -"The biggest changes to the implementation include template strings " -"(:pep:`750`), deferred evaluation of annotations (:pep:`649`), and a new " -"type of interpreter that uses tail calls." +"The biggest changes to the implementation include template strings (:pep:" +"`750`), deferred evaluation of annotations (:pep:`649`), and a new type of " +"interpreter that uses tail calls." msgstr "" #: ../../whatsnew/3.14.rst:76 @@ -141,8 +141,8 @@ msgstr "" msgid "" ":ref:`Syntax highlighting in PyREPL `, and " "color output in :ref:`unittest `, :ref:`argparse " -"`, :ref:`json ` " -"and :ref:`calendar ` CLIs" +"`, :ref:`json ` and :ref:" +"`calendar ` CLIs" msgstr "" #: ../../whatsnew/3.14.rst:102 @@ -158,8 +158,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:108 msgid "" "On platforms other than macOS and Windows, the default :ref:`start method " -"` for :mod:`multiprocessing` " -"and :class:`~concurrent.futures.ProcessPoolExecutor` switches from *fork* to " +"` for :mod:`multiprocessing` and :class:" +"`~concurrent.futures.ProcessPoolExecutor` switches from *fork* to " "*forkserver*." msgstr "" @@ -171,20 +171,20 @@ msgstr "" #: ../../whatsnew/3.14.rst:116 msgid "" -"If you encounter :exc:`NameError`\\s or pickling errors coming out " -"of :mod:`multiprocessing` or :mod:`concurrent.futures`, see " -"the :ref:`forkserver restrictions `." +"If you encounter :exc:`NameError`\\s or pickling errors coming out of :mod:" +"`multiprocessing` or :mod:`concurrent.futures`, see the :ref:`forkserver " +"restrictions `." msgstr "" #: ../../whatsnew/3.14.rst:120 msgid "" "The interpreter avoids some reference count modifications internally when " -"it's safe to do so. This can lead to different values returned " -"from :func:`sys.getrefcount` and :c:func:`Py_REFCNT` compared to previous " -"versions of Python. See :ref:`below ` for details." +"it's safe to do so. This can lead to different values returned from :func:" +"`sys.getrefcount` and :c:func:`Py_REFCNT` compared to previous versions of " +"Python. See :ref:`below ` for details." msgstr "" -#: ../../whatsnew/3.14.rst:126 ../../whatsnew/3.14.rst:2827 +#: ../../whatsnew/3.14.rst:126 msgid "New features" msgstr "" @@ -242,8 +242,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:164 msgid "" -"That limitation is removed in the 3.14 release, with the " -"new :mod:`concurrent.interpreters` module." +"That limitation is removed in the 3.14 release, with the new :mod:" +"`concurrent.interpreters` module." msgstr "" #: ../../whatsnew/3.14.rst:167 @@ -265,8 +265,8 @@ msgid "" "For some use cases, concurrency in software enables efficiency and can " "simplify software, at a high level. At the same time, implementing and " "maintaining all but the simplest concurrency is often a struggle for the " -"human brain. That especially applies to plain threads (for " -"example, :mod:`threading`), where all memory is shared between all threads." +"human brain. That especially applies to plain threads (for example, :mod:" +"`threading`), where all memory is shared between all threads." msgstr "" #: ../../whatsnew/3.14.rst:179 @@ -280,20 +280,20 @@ msgstr "" #: ../../whatsnew/3.14.rst:185 msgid "" "Regarding multi-core parallelism: as of the 3.12 release, interpreters are " -"now sufficiently isolated from one another to be used in parallel. " -"(See :pep:`684`.) This unlocks a variety of CPU-intensive use cases for " -"Python that were limited by the :term:`GIL`." +"now sufficiently isolated from one another to be used in parallel. (See :pep:" +"`684`.) This unlocks a variety of CPU-intensive use cases for Python that " +"were limited by the :term:`GIL`." msgstr "" #: ../../whatsnew/3.14.rst:190 msgid "" -"Using multiple interpreters is similar in many ways " -"to :mod:`multiprocessing`, in that they both provide isolated logical " -"\"processes\" that can run in parallel, with no sharing by default. However, " -"when using multiple interpreters, an application will use fewer system " -"resources and will operate more efficiently (since it stays within the same " -"process). Think of multiple interpreters as having the isolation of " -"processes with the efficiency of threads." +"Using multiple interpreters is similar in many ways to :mod:" +"`multiprocessing`, in that they both provide isolated logical \"processes\" " +"that can run in parallel, with no sharing by default. However, when using " +"multiple interpreters, an application will use fewer system resources and " +"will operate more efficiently (since it stays within the same process). " +"Think of multiple interpreters as having the isolation of processes with the " +"efficiency of threads." msgstr "" #: ../../whatsnew/3.14.rst:201 @@ -350,9 +350,9 @@ msgid "" "provide utilities that are less appropriate on PyPI. In the meantime, most " "of the limitations can also be addressed through extension modules, meaning " "PyPI packages can fill any gap for 3.14, and even back to 3.12 where " -"interpreters were finally properly isolated and stopped sharing " -"the :term:`GIL`. Likewise, we expect to slowly see libraries on PyPI for " -"high-level abstractions on top of interpreters." +"interpreters were finally properly isolated and stopped sharing the :term:" +"`GIL`. Likewise, we expect to slowly see libraries on PyPI for high-level " +"abstractions on top of interpreters." msgstr "" #: ../../whatsnew/3.14.rst:233 @@ -383,9 +383,9 @@ msgstr "" #: ../../whatsnew/3.14.rst:254 msgid "" "Template string literals (t-strings) are a generalization of f-strings, " -"using a ``t`` in place of the ``f`` prefix. Instead of evaluating " -"to :class:`str`, t-strings evaluate to a new :class:`!" -"string.templatelib.Template` type:" +"using a ``t`` in place of the ``f`` prefix. Instead of evaluating to :class:" +"`str`, t-strings evaluate to a new :class:`!string.templatelib.Template` " +"type:" msgstr "" #: ../../whatsnew/3.14.rst:258 @@ -584,15 +584,14 @@ msgstr "" #: ../../whatsnew/3.14.rst:387 msgid "" -"The new ``compression`` package contains modules :mod:`!" -"compression.lzma`, :mod:`!compression.bz2`, :mod:`!compression.gzip` " -"and :mod:`!compression.zlib` which re-export " -"the :mod:`lzma`, :mod:`bz2`, :mod:`gzip` and :mod:`zlib` modules " -"respectively. The new import names under ``compression`` are the canonical " -"names for importing these compression modules going forward. However, the " -"existing modules names have not been deprecated. Any deprecation or removal " -"of the existing compression modules will occur no sooner than five years " -"after the release of 3.14." +"The new ``compression`` package contains modules :mod:`!compression.lzma`, :" +"mod:`!compression.bz2`, :mod:`!compression.gzip` and :mod:`!compression." +"zlib` which re-export the :mod:`lzma`, :mod:`bz2`, :mod:`gzip` and :mod:" +"`zlib` modules respectively. The new import names under ``compression`` are " +"the canonical names for importing these compression modules going forward. " +"However, the existing modules names have not been deprecated. Any " +"deprecation or removal of the existing compression modules will occur no " +"sooner than five years after the release of 3.14." msgstr "" #: ../../whatsnew/3.14.rst:396 @@ -602,8 +601,8 @@ msgid "" "library `__. Zstandard is a widely " "adopted, highly efficient, and fast compression format. In addition to the " "APIs introduced in :mod:`!compression.zstd`, support for reading and writing " -"Zstandard compressed archives has been added to " -"the :mod:`tarfile`, :mod:`zipfile`, and :mod:`shutil` modules." +"Zstandard compressed archives has been added to the :mod:`tarfile`, :mod:" +"`zipfile`, and :mod:`shutil` modules." msgstr "" #: ../../whatsnew/3.14.rst:404 @@ -625,8 +624,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:418 msgid "" -"As can be seen, the API is similar to the APIs of the :mod:`!lzma` " -"and :mod:`!bz2` modules." +"As can be seen, the API is similar to the APIs of the :mod:`!lzma` and :mod:" +"`!bz2` modules." msgstr "" #: ../../whatsnew/3.14.rst:421 @@ -736,13 +735,12 @@ msgstr "" #: ../../whatsnew/3.14.rst:504 msgid "" "The new :mod:`annotationlib` module provides tools for inspecting deferred " -"annotations. Annotations may be evaluated in " -"the :attr:`~annotationlib.Format.VALUE` format (which evaluates annotations " -"to runtime values, similar to the behavior in earlier Python versions), " -"the :attr:`~annotationlib.Format.FORWARDREF` format (which replaces " -"undefined names with special markers), and " -"the :attr:`~annotationlib.Format.STRING` format (which returns annotations " -"as strings)." +"annotations. Annotations may be evaluated in the :attr:`~annotationlib." +"Format.VALUE` format (which evaluates annotations to runtime values, similar " +"to the behavior in earlier Python versions), the :attr:`~annotationlib." +"Format.FORWARDREF` format (which replaces undefined names with special " +"markers), and the :attr:`~annotationlib.Format.STRING` format (which returns " +"annotations as strings)." msgstr "" #: ../../whatsnew/3.14.rst:511 @@ -794,20 +792,18 @@ msgstr "" msgid "" "If your code reads the ``__annotations__`` attribute on objects, you may " "want to make changes in order to support code that relies on deferred " -"evaluation of annotations. For example, you may want to " -"use :func:`annotationlib.get_annotations` with " -"the :attr:`~annotationlib.Format.FORWARDREF` format, as " -"the :mod:`dataclasses` module now does." +"evaluation of annotations. For example, you may want to use :func:" +"`annotationlib.get_annotations` with the :attr:`~annotationlib.Format." +"FORWARDREF` format, as the :mod:`dataclasses` module now does." msgstr "" #: ../../whatsnew/3.14.rst:551 msgid "" "The external :pypi:`typing_extensions` package provides partial backports of " -"some of the functionality of the :mod:`annotationlib` module, such as " -"the :class:`~annotationlib.Format` enum and " -"the :func:`~annotationlib.get_annotations` function. These can be used to " -"write cross-version code that takes advantage of the new behavior in Python " -"3.14." +"some of the functionality of the :mod:`annotationlib` module, such as the :" +"class:`~annotationlib.Format` enum and the :func:`~annotationlib." +"get_annotations` function. These can be used to write cross-version code " +"that takes advantage of the new behavior in Python 3.14." msgstr "" #: ../../whatsnew/3.14.rst:557 @@ -828,9 +824,9 @@ msgstr "" #: ../../whatsnew/3.14.rst:567 msgid "" "In particular, do not read annotations directly from the namespace " -"dictionary attribute of type objects. " -"Use :func:`annotationlib.get_annotate_from_class_namespace` during class " -"construction and :func:`annotationlib.get_annotations` afterwards." +"dictionary attribute of type objects. Use :func:`annotationlib." +"get_annotate_from_class_namespace` during class construction and :func:" +"`annotationlib.get_annotations` afterwards." msgstr "" #: ../../whatsnew/3.14.rst:571 @@ -958,13 +954,13 @@ msgstr "" #: ../../whatsnew/3.14.rst:667 msgid "" -"If a statement " -"(:keyword:`pass`, :keyword:`del`, :keyword:`return`, :keyword:`yield`, :keyword:`raise`, :keyword:`break`, :keyword:`continue`, :keyword:`assert`, :keyword:`import`, :keyword:`from`) " -"is passed to the :ref:`if_expr` after :keyword:`else`, or one " -"of :keyword:`pass`, :keyword:`break`, or :keyword:`continue` is passed " -"before :keyword:`if`, then the error message highlights where " -"the :token:`~python-grammar:expression` is required. (Contributed by Sergey " -"Miryanov in :gh:`129515`.)" +"If a statement (:keyword:`pass`, :keyword:`del`, :keyword:`return`, :keyword:" +"`yield`, :keyword:`raise`, :keyword:`break`, :keyword:`continue`, :keyword:" +"`assert`, :keyword:`import`, :keyword:`from`) is passed to the :ref:" +"`if_expr` after :keyword:`else`, or one of :keyword:`pass`, :keyword:" +"`break`, or :keyword:`continue` is passed before :keyword:`if`, then the " +"error message highlights where the :token:`~python-grammar:expression` is " +"required. (Contributed by Sergey Miryanov in :gh:`129515`.)" msgstr "" #: ../../whatsnew/3.14.rst:675 @@ -1035,8 +1031,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:721 msgid "" -"(Contributed by Nikita Sobolev in :gh:`123539`, :gh:`123562`, " -"and :gh:`123440`.)" +"(Contributed by Nikita Sobolev in :gh:`123539`, :gh:`123562`, and :gh:" +"`123440`.)" msgstr "" #: ../../whatsnew/3.14.rst:724 @@ -1087,9 +1083,9 @@ msgstr "" #: ../../whatsnew/3.14.rst:764 msgid "" -"Complete the :pep:`587` :ref:`PyConfig C API ` by " -"adding :c:func:`PyInitConfig_AddModule` which can be used to add a built-in " -"extension module; a feature previously referred to as the “inittab”." +"Complete the :pep:`587` :ref:`PyConfig C API ` by adding :c:" +"func:`PyInitConfig_AddModule` which can be used to add a built-in extension " +"module; a feature previously referred to as the “inittab”." msgstr "" #: ../../whatsnew/3.14.rst:768 @@ -1116,8 +1112,8 @@ msgid "" "configuration mechanisms)." msgstr "" -#: ../../whatsnew/3.14.rst:783 ../../whatsnew/3.14.rst:2889 -#: ../../whatsnew/3.14.rst:2908 +#: ../../whatsnew/3.14.rst:783 ../../whatsnew/3.14.rst:2832 +#: ../../whatsnew/3.14.rst:2852 msgid "(Contributed by Victor Stinner in :gh:`107954`.)" msgstr "(由 Victor Stinner 於 :gh:`107954` 貢獻。)" @@ -1214,17 +1210,17 @@ msgid "" "TaskGroup.__aexit__ -> album TaskGroup._aexit -> TaskGroup.__aexit__ -> " "main Task-1 0x7fc930c18050\n" "1935500 0x7fc93173fdf0 TNDNBTG sleep -> " -"play TaskGroup._aexit -> " -"TaskGroup.__aexit__ -> album Sundowning 0x7fc930c18230\n" +"play TaskGroup._aexit -> TaskGroup." +"__aexit__ -> album Sundowning 0x7fc930c18230\n" "1935500 0x7fc930d32510 Levitate sleep -> " -"play TaskGroup._aexit -> " -"TaskGroup.__aexit__ -> album Sundowning 0x7fc930c18230\n" +"play TaskGroup._aexit -> TaskGroup." +"__aexit__ -> album Sundowning 0x7fc930c18230\n" "1935500 0x7fc930d32890 DYWTYLM sleep -> " -"play TaskGroup._aexit -> " -"TaskGroup.__aexit__ -> album TMBTE 0x7fc93173fa50\n" +"play TaskGroup._aexit -> TaskGroup." +"__aexit__ -> album TMBTE 0x7fc93173fa50\n" "1935500 0x7fc93161ec30 Aqua Regia sleep -> " -"play TaskGroup._aexit -> " -"TaskGroup.__aexit__ -> album TMBTE 0x7fc93173fa50" +"play TaskGroup._aexit -> TaskGroup." +"__aexit__ -> album TMBTE 0x7fc93173fa50" msgstr "" #: ../../whatsnew/3.14.rst:856 @@ -1241,10 +1237,10 @@ msgid "" " └── TaskGroup._aexit Lib/asyncio/taskgroups.py:121\n" " ├── (T) Sundowning\n" " │ └── album example.py:8\n" -" │ └── TaskGroup.__aexit__ Lib/asyncio/" -"taskgroups.py:72\n" -" │ └── TaskGroup._aexit Lib/asyncio/" -"taskgroups.py:121\n" +" │ └── TaskGroup.__aexit__ Lib/asyncio/taskgroups." +"py:72\n" +" │ └── TaskGroup._aexit Lib/asyncio/taskgroups." +"py:121\n" " │ ├── (T) TNDNBTG\n" " │ │ └── play example.py:4\n" " │ │ └── sleep Lib/asyncio/tasks.py:702\n" @@ -1253,10 +1249,10 @@ msgid "" " │ └── sleep Lib/asyncio/tasks.py:702\n" " └── (T) TMBTE\n" " └── album example.py:8\n" -" └── TaskGroup.__aexit__ Lib/asyncio/" -"taskgroups.py:72\n" -" └── TaskGroup._aexit Lib/asyncio/" -"taskgroups.py:121\n" +" └── TaskGroup.__aexit__ Lib/asyncio/taskgroups." +"py:72\n" +" └── TaskGroup._aexit Lib/asyncio/taskgroups." +"py:121\n" " ├── (T) DYWTYLM\n" " │ └── play example.py:4\n" " │ └── sleep Lib/asyncio/tasks.py:702\n" @@ -1407,14 +1403,13 @@ msgstr "" msgid "" "A new flag has been added, :data:`~sys.flags.thread_inherit_context`. This " "flag defaults to true for the free-threaded build and false for the GIL-" -"enabled build. If the flag is true then threads created " -"with :class:`threading.Thread` start with a copy of " -"the :class:`~contextvars.Context()` of the caller " -"of :meth:`~threading.Thread.start`. Most significantly, this makes the " -"warning filtering context established by :class:`~warnings.catch_warnings` " -"be \"inherited\" by threads (or asyncio tasks) started within that context. " -"It also affects other modules that use context variables, such as " -"the :mod:`decimal` context manager." +"enabled build. If the flag is true then threads created with :class:" +"`threading.Thread` start with a copy of the :class:`~contextvars.Context()` " +"of the caller of :meth:`~threading.Thread.start`. Most significantly, this " +"makes the warning filtering context established by :class:`~warnings." +"catch_warnings` be \"inherited\" by threads (or asyncio tasks) started " +"within that context. It also affects other modules that use context " +"variables, such as the :mod:`decimal` context manager." msgstr "" #: ../../whatsnew/3.14.rst:1002 @@ -1424,10 +1419,9 @@ msgstr "" #: ../../whatsnew/3.14.rst:1004 msgid "" "The default :term:`interactive` shell now highlights Python syntax as you " -"type. The feature is enabled by default unless " -"the :envvar:`PYTHON_BASIC_REPL` environment is set or any color-disabling " -"environment variables are used. See :ref:`using-on-controlling-color` for " -"details." +"type. The feature is enabled by default unless the :envvar:" +"`PYTHON_BASIC_REPL` environment is set or any color-disabling environment " +"variables are used. See :ref:`using-on-controlling-color` for details." msgstr "" #: ../../whatsnew/3.14.rst:1010 @@ -1451,10 +1445,10 @@ msgstr "" msgid "" "The official macOS and Windows release binaries now include an " "*experimental* just-in-time (JIT) compiler. Although it is **not** " -"recommended for production use, it can be tested by " -"setting :envvar:`PYTHON_JIT=1 ` as an environment variable. " -"Downstream source builds and redistributors can use the :option:`--enable-" -"experimental-jit=yes-off` configuration option for similar behavior." +"recommended for production use, it can be tested by setting :envvar:" +"`PYTHON_JIT=1 ` as an environment variable. Downstream source " +"builds and redistributors can use the :option:`--enable-experimental-jit=yes-" +"off` configuration option for similar behavior." msgstr "" #: ../../whatsnew/3.14.rst:1031 @@ -1464,18 +1458,18 @@ msgid "" "faster, depending on workload. To aid in testing and evaluation, a set of " "introspection functions has been provided in the :data:`sys._jit` " "namespace. :func:`sys._jit.is_available` can be used to determine if the " -"current executable supports JIT compilation, " -"while :func:`sys._jit.is_enabled` can be used to tell if JIT compilation has " -"been enabled for the current process." +"current executable supports JIT compilation, while :func:`sys._jit." +"is_enabled` can be used to tell if JIT compilation has been enabled for the " +"current process." msgstr "" #: ../../whatsnew/3.14.rst:1039 msgid "" "Currently, the most significant missing functionality is that native " "debuggers and profilers like ``gdb`` and ``perf`` are unable to unwind " -"through JIT frames (Python debuggers and profilers, like :mod:`pdb` " -"or :mod:`profile`, continue to work without modification). Free-threaded " -"builds do not support JIT compilation." +"through JIT frames (Python debuggers and profilers, like :mod:`pdb` or :mod:" +"`profile`, continue to work without modification). Free-threaded builds do " +"not support JIT compilation." msgstr "" #: ../../whatsnew/3.14.rst:1044 @@ -1494,8 +1488,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:1051 msgid "" "The :class:`warnings.catch_warnings` context manager will now optionally use " -"a context variable for warning filters. This is enabled by setting " -"the :data:`~sys.flags.context_aware_warnings` flag, either with the ``-X`` " +"a context variable for warning filters. This is enabled by setting the :" +"data:`~sys.flags.context_aware_warnings` flag, either with the ``-X`` " "command-line option or an environment variable. This gives predictable " "warnings control when using :class:`~warnings.catch_warnings` combined with " "multiple threads or asynchronous tasks. The flag defaults to true for the " @@ -1528,13 +1522,13 @@ msgstr "" msgid "The behavior of :func:`!gc.collect` changes slightly:" msgstr "" -#: ../../whatsnew/3.14.rst:1078 ../../whatsnew/3.14.rst:3183 +#: ../../whatsnew/3.14.rst:1078 ../../whatsnew/3.14.rst:3145 msgid "" "``gc.collect(1)``: Performs an increment of garbage collection, rather than " "collecting generation 1." msgstr "" -#: ../../whatsnew/3.14.rst:1080 ../../whatsnew/3.14.rst:3185 +#: ../../whatsnew/3.14.rst:1080 ../../whatsnew/3.14.rst:3147 msgid "Other calls to :func:`!gc.collect` are unchanged." msgstr "" @@ -1550,15 +1544,15 @@ msgstr "" msgid "" ":pep:`776`: Emscripten is now an officially supported platform at :pep:`tier " "3 <11#tier-3>`. As a part of this effort, more than 25 bugs in `Emscripten " -"libc`__ were fixed. Emscripten now includes support " -"for :mod:`ctypes`, :mod:`termios`, and :mod:`fcntl`, as well as experimental " -"support for :ref:`PyREPL `." +"libc`__ were fixed. Emscripten now includes support for :mod:`ctypes`, :mod:" +"`termios`, and :mod:`fcntl`, as well as experimental support for :ref:" +"`PyREPL `." msgstr "" #: ../../whatsnew/3.14.rst:1093 msgid "" -"(Contributed by R. Hood Chatham in :gh:`127146`, :gh:`127683`, " -"and :gh:`136931`.)" +"(Contributed by R. Hood Chatham in :gh:`127146`, :gh:`127683`, and :gh:" +"`136931`.)" msgstr "" #: ../../whatsnew/3.14.rst:1098 @@ -1586,8 +1580,8 @@ msgstr "" msgid "" "Incorrect usage of :keyword:`await` and asynchronous comprehensions is now " "detected even if the code is optimized away by the :option:`-O` command-line " -"option. For example, ``python -O -c 'assert await 1'`` now produces " -"a :exc:`SyntaxError`. (Contributed by Jelle Zijlstra in :gh:`121637`.)" +"option. For example, ``python -O -c 'assert await 1'`` now produces a :exc:" +"`SyntaxError`. (Contributed by Jelle Zijlstra in :gh:`121637`.)" msgstr "" #: ../../whatsnew/3.14.rst:1116 @@ -1609,8 +1603,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:1126 msgid "" "Implement mixed-mode arithmetic rules combining real and complex numbers as " -"specified by C standards since C99. (Contributed by Sergey B Kirpichev " -"in :gh:`69639`.)" +"specified by C standards since C99. (Contributed by Sergey B Kirpichev in :" +"gh:`69639`.)" msgstr "" #: ../../whatsnew/3.14.rst:1130 @@ -1627,8 +1621,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:1137 msgid "" -"The :class:`memoryview` type now supports subscription, making it " -"a :term:`generic type`. (Contributed by Brian Schubert in :gh:`126012`.)" +"The :class:`memoryview` type now supports subscription, making it a :term:" +"`generic type`. (Contributed by Brian Schubert in :gh:`126012`.)" msgstr "" #: ../../whatsnew/3.14.rst:1141 @@ -1703,24 +1697,23 @@ msgstr "" msgid "" "When subclassing from a pure C type, the C slots for the new type are no " "longer replaced with a wrapped version on class creation if they are not " -"explicitly overridden in the subclass. (Contributed by Tomasz Pytel " -"in :gh:`132329`.)" +"explicitly overridden in the subclass. (Contributed by Tomasz Pytel in :gh:" +"`132329`.)" msgstr "" #: ../../whatsnew/3.14.rst:1190 msgid "" "The command-line option :option:`-c` now automatically dedents its code " -"argument before execution. The auto-dedentation behavior " -"mirrors :func:`textwrap.dedent`. (Contributed by Jon Crall and Steven Sun " -"in :gh:`103998`.)" +"argument before execution. The auto-dedentation behavior mirrors :func:" +"`textwrap.dedent`. (Contributed by Jon Crall and Steven Sun in :gh:`103998`.)" msgstr "" #: ../../whatsnew/3.14.rst:1195 msgid "" "Improve error message when an object supporting the synchronous context " -"manager protocol is entered using :keyword:`async with` instead " -"of :keyword:`with`. And vice versa with the asynchronous context manager " -"protocol. (Contributed by Bénédikt Tran in :gh:`128398`.)" +"manager protocol is entered using :keyword:`async with` instead of :keyword:" +"`with`. And vice versa with the asynchronous context manager protocol. " +"(Contributed by Bénédikt Tran in :gh:`128398`.)" msgstr "" #: ../../whatsnew/3.14.rst:1201 @@ -1739,9 +1732,9 @@ msgstr "" #: ../../whatsnew/3.14.rst:1212 msgid "" -"Using :data:`NotImplemented` in a boolean context will now raise " -"a :exc:`TypeError`. This has raised a :exc:`DeprecationWarning` since Python " -"3.9. (Contributed by Jelle Zijlstra in :gh:`118767`.)" +"Using :data:`NotImplemented` in a boolean context will now raise a :exc:" +"`TypeError`. This has raised a :exc:`DeprecationWarning` since Python 3.9. " +"(Contributed by Jelle Zijlstra in :gh:`118767`.)" msgstr "" #: ../../whatsnew/3.14.rst:1221 @@ -1752,10 +1745,9 @@ msgstr "" #: ../../whatsnew/3.14.rst:1223 msgid "" -"The compiler emits a :exc:`SyntaxWarning` when " -"a :keyword:`return`, :keyword:`break` or :keyword:`continue` statement " -"appears where it exits a :keyword:`finally` block. This change is specified " -"in :pep:`765`." +"The compiler emits a :exc:`SyntaxWarning` when a :keyword:`return`, :keyword:" +"`break` or :keyword:`continue` statement appears where it exits a :keyword:" +"`finally` block. This change is specified in :pep:`765`." msgstr "" #: ../../whatsnew/3.14.rst:1229 @@ -1765,8 +1757,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:1231 msgid "" ":mod:`annotationlib`: For introspecting :term:`annotations `. " -"See :pep:`749` for more details. (Contributed by Jelle Zijlstra " -"in :gh:`119180`.)" +"See :pep:`749` for more details. (Contributed by Jelle Zijlstra in :gh:" +"`119180`.)" msgstr "" #: ../../whatsnew/3.14.rst:1237 @@ -1779,18 +1771,18 @@ msgstr "argparse" #: ../../whatsnew/3.14.rst:1242 msgid "" -"The default value of the :ref:`program name ` " -"for :class:`argparse.ArgumentParser` now reflects the way the Python " -"interpreter was instructed to find the ``__main__`` module code. " -"(Contributed by Serhiy Storchaka and Alyssa Coghlan in :gh:`66436`.)" +"The default value of the :ref:`program name ` for :class:`argparse." +"ArgumentParser` now reflects the way the Python interpreter was instructed " +"to find the ``__main__`` module code. (Contributed by Serhiy Storchaka and " +"Alyssa Coghlan in :gh:`66436`.)" msgstr "" #: ../../whatsnew/3.14.rst:1247 msgid "" -"Introduced the optional *suggest_on_error* parameter " -"to :class:`argparse.ArgumentParser`, enabling suggestions for argument " -"choices and subparser names if mistyped by the user. (Contributed by " -"Savannah Ostrowski in :gh:`124456`.)" +"Introduced the optional *suggest_on_error* parameter to :class:`argparse." +"ArgumentParser`, enabling suggestions for argument choices and subparser " +"names if mistyped by the user. (Contributed by Savannah Ostrowski in :gh:" +"`124456`.)" msgstr "" #: ../../whatsnew/3.14.rst:1254 @@ -1832,8 +1824,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:1276 msgid "" ":func:`ast.parse`, when called with an AST as input, now always verifies " -"that the root node type is appropriate. (Contributed by Irit Katriel " -"in :gh:`130139`.)" +"that the root node type is appropriate. (Contributed by Irit Katriel in :gh:" +"`130139`.)" msgstr "" #: ../../whatsnew/3.14.rst:1280 @@ -1850,27 +1842,26 @@ msgstr "asyncio" #: ../../whatsnew/3.14.rst:1288 msgid "" "The function and methods named :func:`!create_task` now take an arbitrary " -"list of keyword arguments. All keyword arguments are passed to " -"the :class:`~asyncio.Task` constructor or the custom task factory. " -"(See :meth:`~asyncio.loop.set_task_factory` for details.) The ``name`` and " -"``context`` keyword arguments are no longer special; the name should now be " -"set using the ``name`` keyword argument of the factory, and ``context`` may " -"be ``None``." +"list of keyword arguments. All keyword arguments are passed to the :class:" +"`~asyncio.Task` constructor or the custom task factory. (See :meth:`~asyncio." +"loop.set_task_factory` for details.) The ``name`` and ``context`` keyword " +"arguments are no longer special; the name should now be set using the " +"``name`` keyword argument of the factory, and ``context`` may be ``None``." msgstr "" #: ../../whatsnew/3.14.rst:1296 msgid "" -"This affects the following function and " -"methods: :meth:`asyncio.create_task`, :meth:`asyncio.loop.create_task`, :meth:`asyncio.TaskGroup.create_task`. " -"(Contributed by Thomas Grainger in :gh:`128307`.)" +"This affects the following function and methods: :meth:`asyncio." +"create_task`, :meth:`asyncio.loop.create_task`, :meth:`asyncio.TaskGroup." +"create_task`. (Contributed by Thomas Grainger in :gh:`128307`.)" msgstr "" #: ../../whatsnew/3.14.rst:1302 msgid "" "There are two new utility functions for introspecting and printing a " -"program's call graph: :func:`~asyncio.capture_call_graph` " -"and :func:`~asyncio.print_call_graph`. (Contributed by Yury Selivanov, Pablo " -"Galindo Salgado, and Łukasz Langa in :gh:`91048`.)" +"program's call graph: :func:`~asyncio.capture_call_graph` and :func:" +"`~asyncio.print_call_graph`. (Contributed by Yury Selivanov, Pablo Galindo " +"Salgado, and Łukasz Langa in :gh:`91048`.)" msgstr "" #: ../../whatsnew/3.14.rst:1312 @@ -1879,10 +1870,10 @@ msgstr "calendar" #: ../../whatsnew/3.14.rst:1314 msgid "" -"By default, today's date is highlighted in color " -"in :mod:`calendar`'s :ref:`command-line ` text output. This " -"can be controlled by :ref:`environment variables `. (Contributed by Hugo van Kemenade in :gh:`128317`.)" +"By default, today's date is highlighted in color in :mod:`calendar`'s :ref:" +"`command-line ` text output. This can be controlled by :ref:" +"`environment variables `. (Contributed by Hugo " +"van Kemenade in :gh:`128317`.)" msgstr "" #: ../../whatsnew/3.14.rst:1322 @@ -1909,8 +1900,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:1340 msgid "" "If the threading incompatible *fork* method is required, you must explicitly " -"request it by supplying a multiprocessing context *mp_context* " -"to :class:`~concurrent.futures.ProcessPoolExecutor`." +"request it by supplying a multiprocessing context *mp_context* to :class:" +"`~concurrent.futures.ProcessPoolExecutor`." msgstr "" #: ../../whatsnew/3.14.rst:1344 ../../whatsnew/3.14.rst:1774 @@ -1927,19 +1918,19 @@ msgstr "(由 Gregory P. Smith 於 :gh:`84559` 貢獻。)" #: ../../whatsnew/3.14.rst:1351 msgid "" -"Add :meth:`concurrent.futures.ProcessPoolExecutor.terminate_workers` " -"and :meth:`concurrent.futures.ProcessPoolExecutor.kill_workers` as ways to " +"Add :meth:`concurrent.futures.ProcessPoolExecutor.terminate_workers` and :" +"meth:`concurrent.futures.ProcessPoolExecutor.kill_workers` as ways to " "terminate or kill all living worker processes in the given pool. " "(Contributed by Charles Machalow in :gh:`130849`.)" msgstr "" #: ../../whatsnew/3.14.rst:1356 msgid "" -"Add the optional ``buffersize`` parameter " -"to :meth:`concurrent.futures.Executor.map` to limit the number of submitted " -"tasks whose results have not yet been yielded. If the buffer is full, " -"iteration over the *iterables* pauses until a result is yielded from the " -"buffer. (Contributed by Enzo Bonnal and Josh Rosenberg in :gh:`74028`.)" +"Add the optional ``buffersize`` parameter to :meth:`concurrent.futures." +"Executor.map` to limit the number of submitted tasks whose results have not " +"yet been yielded. If the buffer is full, iteration over the *iterables* " +"pauses until a result is yielded from the buffer. (Contributed by Enzo " +"Bonnal and Josh Rosenberg in :gh:`74028`.)" msgstr "" #: ../../whatsnew/3.14.rst:1364 @@ -1950,9 +1941,8 @@ msgstr "configparser" msgid "" "Security fix: will no longer write config files it cannot read. Attempting " "to :meth:`configparser.ConfigParser.write` keys containing delimiters or " -"beginning with the section header pattern will raise " -"a :class:`configparser.InvalidWriteError`. (Contributed by Jacob Lincoln " -"in :gh:`129270`.)" +"beginning with the section header pattern will raise a :class:`configparser." +"InvalidWriteError`. (Contributed by Jacob Lincoln in :gh:`129270`.)" msgstr "" #: ../../whatsnew/3.14.rst:1373 @@ -1971,10 +1961,10 @@ msgstr "ctypes" #: ../../whatsnew/3.14.rst:1382 msgid "" -"The layout of :ref:`bit fields ` " -"in :class:`~ctypes.Structure` and :class:`~ctypes.Union` now matches " -"platform defaults (GCC/Clang or MSVC) more closely. In particular, fields no " -"longer overlap. (Contributed by Matthias Görgens in :gh:`97702`.)" +"The layout of :ref:`bit fields ` in :" +"class:`~ctypes.Structure` and :class:`~ctypes.Union` now matches platform " +"defaults (GCC/Clang or MSVC) more closely. In particular, fields no longer " +"overlap. (Contributed by Matthias Görgens in :gh:`97702`.)" msgstr "" #: ../../whatsnew/3.14.rst:1388 @@ -2006,20 +1996,18 @@ msgstr "" #: ../../whatsnew/3.14.rst:1403 msgid "" ":func:`ctypes.memoryview_at` now exists to create a :class:`memoryview` " -"object that refers to the supplied pointer and length. This works " -"like :func:`ctypes.string_at` except it avoids a buffer copy, and is " -"typically useful when implementing pure Python callback functions that are " -"passed dynamically-sized buffers. (Contributed by Rian Hunter " -"in :gh:`112018`.)" +"object that refers to the supplied pointer and length. This works like :func:" +"`ctypes.string_at` except it avoids a buffer copy, and is typically useful " +"when implementing pure Python callback functions that are passed dynamically-" +"sized buffers. (Contributed by Rian Hunter in :gh:`112018`.)" msgstr "" #: ../../whatsnew/3.14.rst:1410 msgid "" -"Complex " -"types, :class:`~ctypes.c_float_complex`, :class:`~ctypes.c_double_complex` " -"and :class:`~ctypes.c_longdouble_complex`, are now available if both the " -"compiler and the ``libffi`` library support complex C types. (Contributed by " -"Sergey B Kirpichev in :gh:`61103`.)" +"Complex types, :class:`~ctypes.c_float_complex`, :class:`~ctypes." +"c_double_complex` and :class:`~ctypes.c_longdouble_complex`, are now " +"available if both the compiler and the ``libffi`` library support complex C " +"types. (Contributed by Sergey B Kirpichev in :gh:`61103`.)" msgstr "" #: ../../whatsnew/3.14.rst:1416 @@ -2039,8 +2027,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:1426 msgid "" -"The :class:`ctypes.py_object` type now supports subscription, making it " -"a :term:`generic type`. (Contributed by Brian Schubert in :gh:`132168`.)" +"The :class:`ctypes.py_object` type now supports subscription, making it a :" +"term:`generic type`. (Contributed by Brian Schubert in :gh:`132168`.)" msgstr "" #: ../../whatsnew/3.14.rst:1430 @@ -2055,9 +2043,9 @@ msgstr "curses" #: ../../whatsnew/3.14.rst:1436 msgid "" -"Add the :func:`~curses.assume_default_colors` function, a refinement of " -"the :func:`~curses.use_default_colors` function which allows to change the " -"color pair ``0``. (Contributed by Serhiy Storchaka in :gh:`133139`.)" +"Add the :func:`~curses.assume_default_colors` function, a refinement of the :" +"func:`~curses.use_default_colors` function which allows to change the color " +"pair ``0``. (Contributed by Serhiy Storchaka in :gh:`133139`.)" msgstr "" #: ../../whatsnew/3.14.rst:1442 @@ -2076,9 +2064,9 @@ msgstr "decimal" #: ../../whatsnew/3.14.rst:1450 msgid "" -"Add alternative :class:`~decimal.Decimal` " -"constructor :meth:`Decimal.from_number() `. " -"(Contributed by Serhiy Storchaka in :gh:`121798`.)" +"Add alternative :class:`~decimal.Decimal` constructor :meth:`Decimal." +"from_number() `. (Contributed by Serhiy " +"Storchaka in :gh:`121798`.)" msgstr "" #: ../../whatsnew/3.14.rst:1454 @@ -2094,9 +2082,9 @@ msgstr "difflib" #: ../../whatsnew/3.14.rst:1461 msgid "" -"Comparison pages with highlighted changes generated by " -"the :class:`difflib.HtmlDiff` class now support dark mode. (Contributed by " -"Jiahao Li in :gh:`129939`.)" +"Comparison pages with highlighted changes generated by the :class:`difflib." +"HtmlDiff` class now support dark mode. (Contributed by Jiahao Li in :gh:" +"`129939`.)" msgstr "" #: ../../whatsnew/3.14.rst:1466 @@ -2105,10 +2093,10 @@ msgstr "dis" #: ../../whatsnew/3.14.rst:1468 msgid "" -"Add support for rendering full source location information " -"of :class:`instructions `, rather than only the line " -"number. This feature is added to the following interfaces via the " -"*show_positions* keyword argument:" +"Add support for rendering full source location information of :class:" +"`instructions `, rather than only the line number. This " +"feature is added to the following interfaces via the *show_positions* " +"keyword argument:" msgstr "" #: ../../whatsnew/3.14.rst:1473 @@ -2145,8 +2133,8 @@ msgstr "errno" #: ../../whatsnew/3.14.rst:1489 msgid "" -"Add :data:`errno.EHWPOISON` error code. (Contributed by James Roy " -"in :gh:`126585`.)" +"Add :data:`errno.EHWPOISON` error code. (Contributed by James Roy in :gh:" +"`126585`.)" msgstr "" #: ../../whatsnew/3.14.rst:1494 @@ -2184,9 +2172,9 @@ msgstr "" #: ../../whatsnew/3.14.rst:1516 msgid "" -"Add alternative :class:`~fractions.Fraction` " -"constructor :meth:`Fraction.from_number() `. " -"(Contributed by Serhiy Storchaka in :gh:`121797`.)" +"Add alternative :class:`~fractions.Fraction` constructor :meth:`Fraction." +"from_number() `. (Contributed by Serhiy " +"Storchaka in :gh:`121797`.)" msgstr "" #: ../../whatsnew/3.14.rst:1522 @@ -2241,8 +2229,8 @@ msgstr "graphlib" #: ../../whatsnew/3.14.rst:1556 msgid "" "Allow :meth:`graphlib.TopologicalSorter.prepare` to be called more than once " -"as long as sorting has not started. (Contributed by Daniel Pope " -"in :gh:`130914`.)" +"as long as sorting has not started. (Contributed by Daniel Pope in :gh:" +"`130914`.)" msgstr "" #: ../../whatsnew/3.14.rst:1562 @@ -2297,9 +2285,9 @@ msgstr "" #: ../../whatsnew/3.14.rst:1588 msgid "" -"The :mod:`http.server` module now supports serving over HTTPS using " -"the :class:`http.server.HTTPSServer` class. This functionality is exposed by " -"the command-line interface (``python -m http.server``) through the following " +"The :mod:`http.server` module now supports serving over HTTPS using the :" +"class:`http.server.HTTPSServer` class. This functionality is exposed by the " +"command-line interface (``python -m http.server``) through the following " "options:" msgstr "" @@ -2328,8 +2316,8 @@ msgstr "imaplib" #: ../../whatsnew/3.14.rst:1603 msgid "" "Add :meth:`IMAP4.idle() `, implementing the IMAP4 " -"``IDLE`` command as defined in :rfc:`2177`. (Contributed by Forest " -"in :gh:`55454`.)" +"``IDLE`` command as defined in :rfc:`2177`. (Contributed by Forest in :gh:" +"`55454`.)" msgstr "" #: ../../whatsnew/3.14.rst:1609 @@ -2352,8 +2340,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:1619 msgid "" -"Add function :func:`inspect.ispackage` to determine whether an object is " -"a :term:`package` or not. (Contributed by Zhikang Yan in :gh:`125634`.)" +"Add function :func:`inspect.ispackage` to determine whether an object is a :" +"term:`package` or not. (Contributed by Zhikang Yan in :gh:`125634`.)" msgstr "" #: ../../whatsnew/3.14.rst:1625 ../../whatsnew/3.14.rst:2336 @@ -2362,18 +2350,17 @@ msgstr "io" #: ../../whatsnew/3.14.rst:1627 msgid "" -"Reading text from a non-blocking stream with ``read`` may now raise " -"a :exc:`BlockingIOError` if the operation cannot immediately return bytes. " +"Reading text from a non-blocking stream with ``read`` may now raise a :exc:" +"`BlockingIOError` if the operation cannot immediately return bytes. " "(Contributed by Giovanni Siragusa in :gh:`109523`.)" msgstr "" #: ../../whatsnew/3.14.rst:1631 msgid "" "Add protocols :class:`io.Reader` and :class:`io.Writer` as simpler " -"alternatives to the pseudo-" -"protocols :class:`typing.IO`, :class:`typing.TextIO`, " -"and :class:`typing.BinaryIO`. (Contributed by Sebastian Rittau " -"in :gh:`127648`.)" +"alternatives to the pseudo-protocols :class:`typing.IO`, :class:`typing." +"TextIO`, and :class:`typing.BinaryIO`. (Contributed by Sebastian Rittau in :" +"gh:`127648`.)" msgstr "" #: ../../whatsnew/3.14.rst:1638 @@ -2390,16 +2377,16 @@ msgstr "" msgid "" "Enable the :mod:`json` module to work as a script using the :option:`-m` " "switch: :program:`python -m json`. See the :ref:`JSON command-line interface " -"` documentation. (Contributed by Trey Hunner " -"in :gh:`122873`.)" +"` documentation. (Contributed by Trey Hunner in :gh:" +"`122873`.)" msgstr "" #: ../../whatsnew/3.14.rst:1651 msgid "" "By default, the output of the :ref:`JSON command-line interface ` is highlighted in color. This can be controlled " -"by :ref:`environment variables `. (Contributed " -"by Tomas Roun in :gh:`131952`.)" +"commandline>` is highlighted in color. This can be controlled by :ref:" +"`environment variables `. (Contributed by Tomas " +"Roun in :gh:`131952`.)" msgstr "" #: ../../whatsnew/3.14.rst:1658 @@ -2517,8 +2504,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:1716 msgid "" -":rfc:`3745`: JPEG 2000 (``.jp2``), extension (``.jpx``) and compound " -"(``.jpm``)" +":rfc:`3745`: JPEG 2000 (``.jp2``), extension (``.jpx``) and compound (``." +"jpm``)" msgstr "" #: ../../whatsnew/3.14.rst:1717 @@ -2661,8 +2648,8 @@ msgstr "" msgid "" "If the threading incompatible *fork* method is required, you must explicitly " "request it via a context from :func:`multiprocessing.get_context` " -"(preferred) or change the default " -"via :func:`multiprocessing.set_start_method`." +"(preferred) or change the default via :func:`multiprocessing." +"set_start_method`." msgstr "" #: ../../whatsnew/3.14.rst:1781 @@ -2696,17 +2683,17 @@ msgstr "(由 Roy Hyunjin Han 於 :gh:`103134` 貢獻。)" #: ../../whatsnew/3.14.rst:1796 msgid "" "Add support for shared :class:`set` objects via :meth:`SyncManager.set() " -"`. The :func:`set` " -"in :func:`multiprocessing.Manager` method is now available. (Contributed by " -"Mingyu Park in :gh:`129949`.)" +"`. The :func:`set` in :func:" +"`multiprocessing.Manager` method is now available. (Contributed by Mingyu " +"Park in :gh:`129949`.)" msgstr "" #: ../../whatsnew/3.14.rst:1801 msgid "" "Add :func:`multiprocessing.Process.interrupt` which terminates the child " -"process by sending :py:const:`~signal.SIGINT`. This " -"enables :keyword:`finally` clauses to print a stack trace for the terminated " -"process. (Contributed by Artem Pulkin in :gh:`131913`.)" +"process by sending :py:const:`~signal.SIGINT`. This enables :keyword:" +"`finally` clauses to print a stack trace for the terminated process. " +"(Contributed by Artem Pulkin in :gh:`131913`.)" msgstr "" #: ../../whatsnew/3.14.rst:1807 @@ -2727,10 +2714,10 @@ msgstr "os" #: ../../whatsnew/3.14.rst:1819 msgid "" -"Add the :func:`os.reload_environ` function to update :data:`os.environ` " -"and :data:`os.environb` with changes to the environment made " -"by :func:`os.putenv`, by :func:`os.unsetenv`, or made outside Python in the " -"same process. (Contributed by Victor Stinner in :gh:`120057`.)" +"Add the :func:`os.reload_environ` function to update :data:`os.environ` and :" +"data:`os.environb` with changes to the environment made by :func:`os." +"putenv`, by :func:`os.unsetenv`, or made outside Python in the same process. " +"(Contributed by Victor Stinner in :gh:`120057`.)" msgstr "" #: ../../whatsnew/3.14.rst:1825 @@ -2742,8 +2729,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:1829 msgid "" "Add the :func:`os.readinto` function to read into a :ref:`buffer object " -"` from a file descriptor. (Contributed by Cody Maloney " -"in :gh:`129205`.)" +"` from a file descriptor. (Contributed by Cody Maloney in :gh:" +"`129205`.)" msgstr "" #: ../../whatsnew/3.14.rst:1835 @@ -2752,15 +2739,15 @@ msgstr "os.path" #: ../../whatsnew/3.14.rst:1837 msgid "" -"The *strict* parameter to :func:`os.path.realpath` accepts a new " -"value, :data:`os.path.ALLOW_MISSING`. If used, errors other " -"than :exc:`FileNotFoundError` will be re-raised; the resulting path can be " -"missing but it will be free of symlinks. (Contributed by Petr Viktorin " -"for :cve:`2025-4517`.)" +"The *strict* parameter to :func:`os.path.realpath` accepts a new value, :" +"data:`os.path.ALLOW_MISSING`. If used, errors other than :exc:" +"`FileNotFoundError` will be re-raised; the resulting path can be missing but " +"it will be free of symlinks. (Contributed by Petr Viktorin for :cve:" +"`2025-4517`.)" msgstr "" #: ../../whatsnew/3.14.rst:1845 ../../whatsnew/3.14.rst:2345 -#: ../../whatsnew/3.14.rst:2605 +#: ../../whatsnew/3.14.rst:2596 msgid "pathlib" msgstr "pathlib" @@ -2809,18 +2796,18 @@ msgstr "pdb" #: ../../whatsnew/3.14.rst:1869 msgid "" "Hardcoded breakpoints (:func:`breakpoint` and :func:`pdb.set_trace`) now " -"reuse the most recent :class:`~pdb.Pdb` instance that " -"calls :meth:`~pdb.Pdb.set_trace`, instead of creating a new one each time. " -"As a result, all the instance specific data like :pdbcmd:`display` " -"and :pdbcmd:`commands` are preserved across hardcoded breakpoints. " -"(Contributed by Tian Gao in :gh:`121450`.)" +"reuse the most recent :class:`~pdb.Pdb` instance that calls :meth:`~pdb.Pdb." +"set_trace`, instead of creating a new one each time. As a result, all the " +"instance specific data like :pdbcmd:`display` and :pdbcmd:`commands` are " +"preserved across hardcoded breakpoints. (Contributed by Tian Gao in :gh:" +"`121450`.)" msgstr "" #: ../../whatsnew/3.14.rst:1876 msgid "" "Add a new argument *mode* to :class:`pdb.Pdb`. Disable the ``restart`` " -"command when :mod:`pdb` is in ``inline`` mode. (Contributed by Tian Gao " -"in :gh:`123757`.)" +"command when :mod:`pdb` is in ``inline`` mode. (Contributed by Tian Gao in :" +"gh:`123757`.)" msgstr "" #: ../../whatsnew/3.14.rst:1880 @@ -2938,9 +2925,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:1950 msgid "" -"Add support for *cid* and *bdaddr_type* in the address " -"for :const:`~socket.BTPROTO_L2CAP` on FreeBSD. (Contributed by Serhiy " -"Storchaka in :gh:`132429`.)" +"Add support for *cid* and *bdaddr_type* in the address for :const:`~socket." +"BTPROTO_L2CAP` on FreeBSD. (Contributed by Serhiy Storchaka in :gh:`132429`.)" msgstr "" #: ../../whatsnew/3.14.rst:1953 @@ -2957,9 +2943,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:1959 msgid "" -"Return *cid* in :meth:`~socket.socket.getsockname` " -"for :const:`~socket.BTPROTO_L2CAP`. (Contributed by Serhiy Storchaka " -"in :gh:`132429`.)" +"Return *cid* in :meth:`~socket.socket.getsockname` for :const:`~socket." +"BTPROTO_L2CAP`. (Contributed by Serhiy Storchaka in :gh:`132429`.)" msgstr "" #: ../../whatsnew/3.14.rst:1962 @@ -3026,8 +3011,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:2001 msgid "" -"Add :func:`sys._is_immortal` for determining if an object " -"is :term:`immortal`. (Contributed by Peter Bierma in :gh:`128509`.)" +"Add :func:`sys._is_immortal` for determining if an object is :term:" +"`immortal`. (Contributed by Peter Bierma in :gh:`128509`.)" msgstr "" #: ../../whatsnew/3.14.rst:2004 @@ -3069,8 +3054,8 @@ msgstr "tarfile" #: ../../whatsnew/3.14.rst:2028 msgid "" ":func:`~tarfile.data_filter` now normalizes symbolic link targets in order " -"to avoid path traversal attacks. (Contributed by Petr Viktorin " -"in :gh:`127987` and :cve:`2025-4138`.)" +"to avoid path traversal attacks. (Contributed by Petr Viktorin in :gh:" +"`127987` and :cve:`2025-4138`.)" msgstr "" #: ../../whatsnew/3.14.rst:2031 @@ -3085,17 +3070,17 @@ msgid "" ":func:`~tarfile.TarFile.extract` and :func:`~tarfile.TarFile.extractall` now " "(re-)apply the extraction filter when substituting a link (hard or symbolic) " "with a copy of another archive member, and when fixing up directory " -"attributes. The former raises a new " -"exception, :exc:`~tarfile.LinkFallbackError`. (Contributed by Petr Viktorin " -"for :cve:`2025-4330` and :cve:`2024-12718`.)" +"attributes. The former raises a new exception, :exc:`~tarfile." +"LinkFallbackError`. (Contributed by Petr Viktorin for :cve:`2025-4330` and :" +"cve:`2024-12718`.)" msgstr "" #: ../../whatsnew/3.14.rst:2040 msgid "" ":func:`~tarfile.TarFile.extract` and :func:`~tarfile.TarFile.extractall` no " "longer extract rejected members when :func:`~tarfile.TarFile.errorlevel` is " -"zero. (Contributed by Matt Prodani and Petr Viktorin in :gh:`112887` " -"and :cve:`2025-4435`.)" +"zero. (Contributed by Matt Prodani and Petr Viktorin in :gh:`112887` and :" +"cve:`2025-4435`.)" msgstr "" #: ../../whatsnew/3.14.rst:2048 @@ -3104,9 +3089,8 @@ msgstr "threading" #: ../../whatsnew/3.14.rst:2050 msgid "" -":meth:`threading.Thread.start` now sets the operating system thread name " -"to :attr:`threading.Thread.name`. (Contributed by Victor Stinner " -"in :gh:`59705`.)" +":meth:`threading.Thread.start` now sets the operating system thread name to :" +"attr:`threading.Thread.name`. (Contributed by Victor Stinner in :gh:`59705`.)" msgstr "" #: ../../whatsnew/3.14.rst:2056 @@ -3116,8 +3100,8 @@ msgstr "tkinter" #: ../../whatsnew/3.14.rst:2058 msgid "" "Make :mod:`tkinter` widget methods :meth:`!after` and :meth:`!after_idle` " -"accept arguments passed by keyword. (Contributed by Zhikang Yan " -"in :gh:`126899`.)" +"accept arguments passed by keyword. (Contributed by Zhikang Yan in :gh:" +"`126899`.)" msgstr "" #: ../../whatsnew/3.14.rst:2062 @@ -3132,9 +3116,9 @@ msgstr "turtle" #: ../../whatsnew/3.14.rst:2069 msgid "" -"Add context managers for :func:`turtle.fill`, :func:`turtle.poly` " -"and :func:`turtle.no_animation`. (Contributed by Marie Roald and Yngve " -"Mardal Moe in :gh:`126350`.)" +"Add context managers for :func:`turtle.fill`, :func:`turtle.poly` and :func:" +"`turtle.no_animation`. (Contributed by Marie Roald and Yngve Mardal Moe in :" +"gh:`126350`.)" msgstr "" #: ../../whatsnew/3.14.rst:2075 @@ -3143,12 +3127,12 @@ msgstr "types" #: ../../whatsnew/3.14.rst:2077 msgid "" -":class:`types.UnionType` is now an alias for :class:`typing.Union`. " -"See :ref:`below ` for more details. (Contributed " -"by Jelle Zijlstra in :gh:`105499`.)" +":class:`types.UnionType` is now an alias for :class:`typing.Union`. See :ref:" +"`below ` for more details. (Contributed by Jelle " +"Zijlstra in :gh:`105499`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2083 ../../whatsnew/3.14.rst:2651 +#: ../../whatsnew/3.14.rst:2083 msgid "typing" msgstr "typing" @@ -3179,11 +3163,11 @@ msgid "" "change could increase memory usage for some programs that use a large number " "of unions created by subscripting ``typing.Union``. However, several factors " "offset this cost: unions used in annotations are no longer evaluated by " -"default in Python 3.14 because of :pep:`649`; an instance " -"of :class:`types.UnionType` is itself much smaller than the object returned " -"by ``Union[]`` was on prior Python versions; and removing the cache also " -"saves some space. It is therefore unlikely that this change will cause a " -"significant increase in memory usage for most users." +"default in Python 3.14 because of :pep:`649`; an instance of :class:`types." +"UnionType` is itself much smaller than the object returned by ``Union[]`` " +"was on prior Python versions; and removing the cache also saves some space. " +"It is therefore unlikely that this change will cause a significant increase " +"in memory usage for most users." msgstr "" #: ../../whatsnew/3.14.rst:2109 @@ -3238,16 +3222,16 @@ msgstr "unittest" #: ../../whatsnew/3.14.rst:2138 msgid "" -":mod:`unittest` output is now colored by default. This can be controlled " -"by :ref:`environment variables `. (Contributed " -"by Hugo van Kemenade in :gh:`127221`.)" +":mod:`unittest` output is now colored by default. This can be controlled by :" +"ref:`environment variables `. (Contributed by " +"Hugo van Kemenade in :gh:`127221`.)" msgstr "" #: ../../whatsnew/3.14.rst:2143 msgid "" "unittest discovery supports :term:`namespace package` as start directory " -"again. It was removed in Python 3.11. (Contributed by Jacob Walls " -"in :gh:`80958`.)" +"again. It was removed in Python 3.11. (Contributed by Jacob Walls in :gh:" +"`80958`.)" msgstr "" #: ../../whatsnew/3.14.rst:2147 @@ -3258,30 +3242,30 @@ msgstr "" #: ../../whatsnew/3.14.rst:2150 msgid "" -":meth:`~unittest.TestCase.assertHasAttr` " -"and :meth:`~unittest.TestCase.assertNotHasAttr` check whether the object has " -"a particular attribute." +":meth:`~unittest.TestCase.assertHasAttr` and :meth:`~unittest.TestCase." +"assertNotHasAttr` check whether the object has a particular attribute." msgstr "" #: ../../whatsnew/3.14.rst:2153 msgid "" -":meth:`~unittest.TestCase.assertIsSubclass` " -"and :meth:`~unittest.TestCase.assertNotIsSubclass` check whether the object " -"is a subclass of a particular class, or of one of a tuple of classes." +":meth:`~unittest.TestCase.assertIsSubclass` and :meth:`~unittest.TestCase." +"assertNotIsSubclass` check whether the object is a subclass of a particular " +"class, or of one of a tuple of classes." msgstr "" #: ../../whatsnew/3.14.rst:2156 msgid "" -":meth:`~unittest.TestCase.assertStartsWith`, :meth:`~unittest.TestCase.assertNotStartsWith`, :meth:`~unittest.TestCase.assertEndsWith` " -"and :meth:`~unittest.TestCase.assertNotEndsWith` check whether the Unicode " -"or byte string starts or ends with particular strings." +":meth:`~unittest.TestCase.assertStartsWith`, :meth:`~unittest.TestCase." +"assertNotStartsWith`, :meth:`~unittest.TestCase.assertEndsWith` and :meth:" +"`~unittest.TestCase.assertNotEndsWith` check whether the Unicode or byte " +"string starts or ends with particular strings." msgstr "" #: ../../whatsnew/3.14.rst:2162 msgid "(Contributed by Serhiy Storchaka in :gh:`71339`.)" msgstr "(由 Serhiy Storchaka 於 :gh:`71339` 貢獻。)" -#: ../../whatsnew/3.14.rst:2166 ../../whatsnew/3.14.rst:2658 +#: ../../whatsnew/3.14.rst:2166 ../../whatsnew/3.14.rst:2642 msgid "urllib" msgstr "urllib" @@ -3294,8 +3278,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:2172 msgid "" -"Improve ergonomics and standards compliance when parsing and emitting " -"``file:`` URLs." +"Improve ergonomics and standards compliance when parsing and emitting ``file:" +"`` URLs." msgstr "" #: ../../whatsnew/3.14.rst:2175 @@ -3359,10 +3343,9 @@ msgstr "uuid" #: ../../whatsnew/3.14.rst:2202 msgid "" -"Add support for UUID versions 6, 7, and 8 " -"via :func:`uuid.uuid6`, :func:`uuid.uuid7`, and :func:`uuid.uuid8` " -"respectively, as specified in :rfc:`9562`. (Contributed by Bénédikt Tran " -"in :gh:`89083`.)" +"Add support for UUID versions 6, 7, and 8 via :func:`uuid.uuid6`, :func:" +"`uuid.uuid7`, and :func:`uuid.uuid8` respectively, as specified in :rfc:" +"`9562`. (Contributed by Bénédikt Tran in :gh:`89083`.)" msgstr "" #: ../../whatsnew/3.14.rst:2207 @@ -3402,9 +3385,9 @@ msgstr "zipfile" #: ../../whatsnew/3.14.rst:2229 msgid "" "Added :func:`ZipInfo._for_archive ` to resolve " -"suitable defaults for a :class:`~zipfile.ZipInfo` object as used " -"by :func:`ZipFile.writestr `. (Contributed by " -"Bénédikt Tran in :gh:`123424`.)" +"suitable defaults for a :class:`~zipfile.ZipInfo` object as used by :func:" +"`ZipFile.writestr `. (Contributed by Bénédikt Tran " +"in :gh:`123424`.)" msgstr "" #: ../../whatsnew/3.14.rst:2234 @@ -3421,8 +3404,12 @@ msgstr "最佳化" #: ../../whatsnew/3.14.rst:2246 msgid "" "The import time for several standard library modules has been improved, " -"including :mod:`annotationlib`, :mod:`ast`, :mod:`asyncio`, :mod:`base64`, :mod:`cmd`, :mod:`csv`, :mod:`gettext`, :mod:`importlib.util`, :mod:`locale`, :mod:`mimetypes`, :mod:`optparse`, :mod:`pickle`, :mod:`pprint`, :mod:`pstats`, :mod:`shlex`, :mod:`socket`, :mod:`string`, :mod:`subprocess`, :mod:`threading`, :mod:`tomllib`, :mod:`types`, " -"and :mod:`zipfile`." +"including :mod:`annotationlib`, :mod:`ast`, :mod:`asyncio`, :mod:`base64`, :" +"mod:`cmd`, :mod:`csv`, :mod:`gettext`, :mod:`importlib.util`, :mod:" +"`locale`, :mod:`mimetypes`, :mod:`optparse`, :mod:`pickle`, :mod:`pprint`, :" +"mod:`pstats`, :mod:`shlex`, :mod:`socket`, :mod:`string`, :mod:" +"`subprocess`, :mod:`threading`, :mod:`tomllib`, :mod:`types`, and :mod:" +"`zipfile`." msgstr "" #: ../../whatsnew/3.14.rst:2253 @@ -3489,9 +3476,9 @@ msgstr "" #: ../../whatsnew/3.14.rst:2307 msgid "" -"Because of this optimization, the meaning of the results " -"of :meth:`~gc.get_threshold` and :meth:`~gc.set_threshold` have changed, " -"along with :meth:`~gc.get_count` and :meth:`~gc.get_stats`." +"Because of this optimization, the meaning of the results of :meth:`~gc." +"get_threshold` and :meth:`~gc.set_threshold` have changed, along with :meth:" +"`~gc.get_count` and :meth:`~gc.get_stats`." msgstr "" #: ../../whatsnew/3.14.rst:2311 @@ -3540,11 +3527,11 @@ msgstr "" #: ../../whatsnew/3.14.rst:2355 msgid "" ":mod:`pdb` now supports two backends, based on either :func:`sys.settrace` " -"or :mod:`sys.monitoring`. Using the :ref:`pdb CLI ` " -"or :func:`breakpoint` will always use the :mod:`sys.monitoring` backend. " -"Explicitly instantiating :class:`pdb.Pdb` and its derived classes will use " -"the :func:`sys.settrace` backend by default, which is configurable. " -"(Contributed by Tian Gao in :gh:`124533`.)" +"or :mod:`sys.monitoring`. Using the :ref:`pdb CLI ` or :func:" +"`breakpoint` will always use the :mod:`sys.monitoring` backend. Explicitly " +"instantiating :class:`pdb.Pdb` and its derived classes will use the :func:" +"`sys.settrace` backend by default, which is configurable. (Contributed by " +"Tian Gao in :gh:`124533`.)" msgstr "" #: ../../whatsnew/3.14.rst:2367 @@ -3556,8 +3543,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:2372 msgid "" -":func:`~uuid.uuid4` is now c. 30% faster. (Contributed by Bénédikt Tran " -"in :gh:`128150`.)" +":func:`~uuid.uuid4` is now c. 30% faster. (Contributed by Bénédikt Tran in :" +"gh:`128150`.)" msgstr "" #: ../../whatsnew/3.14.rst:2377 @@ -3584,7 +3571,7 @@ msgstr "" msgid "(Contributed by Steve Dower in :gh:`91349`.)" msgstr "(由 Steve Dower 於 :gh:`91349` 貢獻。)" -#: ../../whatsnew/3.14.rst:2394 ../../whatsnew/3.14.rst:3079 +#: ../../whatsnew/3.14.rst:2394 msgid "Removed" msgstr "已移除" @@ -3598,21 +3585,20 @@ msgstr "" #: ../../whatsnew/3.14.rst:2404 msgid "" "Calling :meth:`~argparse.ArgumentParser.add_argument_group` on an argument " -"group now raises a :exc:`ValueError`. " -"Similarly, :meth:`~argparse.ArgumentParser.add_argument_group` " -"or :meth:`~argparse.ArgumentParser.add_mutually_exclusive_group` on a " -"mutually exclusive group now both raise :exc:`ValueError`\\ s. This " -"'nesting' was never supported, often failed to work correctly, and was " -"unintentionally exposed through inheritance. This functionality has been " -"deprecated since Python 3.11. (Contributed by Savannah Ostrowski " -"in :gh:`127186`.)" +"group now raises a :exc:`ValueError`. Similarly, :meth:`~argparse." +"ArgumentParser.add_argument_group` or :meth:`~argparse.ArgumentParser." +"add_mutually_exclusive_group` on a mutually exclusive group now both raise :" +"exc:`ValueError`\\ s. This 'nesting' was never supported, often failed to " +"work correctly, and was unintentionally exposed through inheritance. This " +"functionality has been deprecated since Python 3.11. (Contributed by " +"Savannah Ostrowski in :gh:`127186`.)" msgstr "" #: ../../whatsnew/3.14.rst:2418 msgid "" -"Remove the following classes, which have been deprecated aliases " -"of :class:`~ast.Constant` since Python 3.8 and have emitted deprecation " -"warnings since Python 3.12:" +"Remove the following classes, which have been deprecated aliases of :class:" +"`~ast.Constant` since Python 3.8 and have emitted deprecation warnings since " +"Python 3.12:" msgstr "" #: ../../whatsnew/3.14.rst:2422 @@ -3664,8 +3650,8 @@ msgstr "" #: ../../whatsnew/3.14.rst:2442 msgid "" -"Use :attr:`!Constant.value` instead. (Contributed by Alex Waygood " -"in :gh:`119562`.)" +"Use :attr:`!Constant.value` instead. (Contributed by Alex Waygood in :gh:" +"`119562`.)" msgstr "" #: ../../whatsnew/3.14.rst:2449 @@ -3831,178 +3817,164 @@ msgid "" " runner.run(operation_two())" msgstr "" -#: ../../whatsnew/3.14.rst:2565 -msgid "collections.abc" -msgstr "collections.abc" - -#: ../../whatsnew/3.14.rst:2567 ../../whatsnew/3.14.rst:2653 -msgid "" -"Remove :class:`!ByteString`, which has been deprecated since Python 3.12. " -"(Contributed by Nikita Sobolev in :gh:`118803`.)" -msgstr "" - -#: ../../whatsnew/3.14.rst:2573 +#: ../../whatsnew/3.14.rst:2564 msgid "email" msgstr "email" -#: ../../whatsnew/3.14.rst:2575 +#: ../../whatsnew/3.14.rst:2566 msgid "" "Remove :func:`email.utils.localtime`'s *isdst* parameter, which was " "deprecated in and has been ignored since Python 3.12. (Contributed by Hugo " "van Kemenade in :gh:`118798`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2581 +#: ../../whatsnew/3.14.rst:2572 msgid "importlib.abc" msgstr "" -#: ../../whatsnew/3.14.rst:2583 +#: ../../whatsnew/3.14.rst:2574 msgid "Remove deprecated :mod:`importlib.abc` classes:" msgstr "" -#: ../../whatsnew/3.14.rst:2585 +#: ../../whatsnew/3.14.rst:2576 msgid "" -":class:`!ResourceReader` " -"(use :class:`~importlib.resources.abc.TraversableResources`)" +":class:`!ResourceReader` (use :class:`~importlib.resources.abc." +"TraversableResources`)" msgstr "" -#: ../../whatsnew/3.14.rst:2587 +#: ../../whatsnew/3.14.rst:2578 msgid "" ":class:`!Traversable` (use :class:`~importlib.resources.abc.Traversable`)" msgstr "" -#: ../../whatsnew/3.14.rst:2589 +#: ../../whatsnew/3.14.rst:2580 msgid "" -":class:`!TraversableResources` " -"(use :class:`~importlib.resources.abc.TraversableResources`)" +":class:`!TraversableResources` (use :class:`~importlib.resources.abc." +"TraversableResources`)" msgstr "" -#: ../../whatsnew/3.14.rst:2592 +#: ../../whatsnew/3.14.rst:2583 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../whatsnew/3.14.rst:2596 +#: ../../whatsnew/3.14.rst:2587 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.14.rst:2598 +#: ../../whatsnew/3.14.rst:2589 msgid "" -"Remove support for copy, deepcopy, and pickle operations " -"from :mod:`itertools` iterators. These have emitted " -"a :exc:`DeprecationWarning` since Python 3.12. (Contributed by Raymond " -"Hettinger in :gh:`101588`.)" +"Remove support for copy, deepcopy, and pickle operations from :mod:" +"`itertools` iterators. These have emitted a :exc:`DeprecationWarning` since " +"Python 3.12. (Contributed by Raymond Hettinger in :gh:`101588`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2607 +#: ../../whatsnew/3.14.rst:2598 msgid "" -"Remove support for passing additional keyword arguments " -"to :class:`~pathlib.Path`. In previous versions, any such arguments are " -"ignored. (Contributed by Barney Gale in :gh:`74033`.)" +"Remove support for passing additional keyword arguments to :class:`~pathlib." +"Path`. In previous versions, any such arguments are ignored. (Contributed by " +"Barney Gale in :gh:`74033`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2612 +#: ../../whatsnew/3.14.rst:2603 msgid "" -"Remove support for passing additional positional arguments " -"to :meth:`.PurePath.relative_to` " -"and :meth:`~pathlib.PurePath.is_relative_to`. In previous versions, any such " -"arguments are joined onto *other*. (Contributed by Barney Gale " -"in :gh:`78707`.)" +"Remove support for passing additional positional arguments to :meth:`." +"PurePath.relative_to` and :meth:`~pathlib.PurePath.is_relative_to`. In " +"previous versions, any such arguments are joined onto *other*. (Contributed " +"by Barney Gale in :gh:`78707`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2619 +#: ../../whatsnew/3.14.rst:2610 msgid "pkgutil" msgstr "" -#: ../../whatsnew/3.14.rst:2621 +#: ../../whatsnew/3.14.rst:2612 msgid "" "Remove the :func:`!get_loader` and :func:`!find_loader` functions, which " -"have been deprecated since Python 3.12. (Contributed by Bénédikt Tran " -"in :gh:`97850`.)" +"have been deprecated since Python 3.12. (Contributed by Bénédikt Tran in :gh:" +"`97850`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2627 +#: ../../whatsnew/3.14.rst:2618 msgid "pty" msgstr "" -#: ../../whatsnew/3.14.rst:2629 +#: ../../whatsnew/3.14.rst:2620 msgid "" "Remove the :func:`!master_open` and :func:`!slave_open` functions, which " "have been deprecated since Python 3.12. Use :func:`pty.openpty` instead. " "(Contributed by Nikita Sobolev in :gh:`118824`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2636 +#: ../../whatsnew/3.14.rst:2627 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.14.rst:2638 +#: ../../whatsnew/3.14.rst:2629 msgid "" "Remove :data:`!version` and :data:`!version_info` from the :mod:`sqlite3` " -"module; use :data:`~sqlite3.sqlite_version` " -"and :data:`~sqlite3.sqlite_version_info` for the actual version number of " -"the runtime SQLite library. (Contributed by Hugo van Kemenade " -"in :gh:`118924`.)" +"module; use :data:`~sqlite3.sqlite_version` and :data:`~sqlite3." +"sqlite_version_info` for the actual version number of the runtime SQLite " +"library. (Contributed by Hugo van Kemenade in :gh:`118924`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2644 +#: ../../whatsnew/3.14.rst:2635 msgid "" -"Using a sequence of parameters with named placeholders now raises " -"a :exc:`~sqlite3.ProgrammingError`, having been deprecated since Python " -"3.12. (Contributed by Erlend E. Aasland in :gh:`118928` and :gh:`101693`.)" +"Using a sequence of parameters with named placeholders now raises a :exc:" +"`~sqlite3.ProgrammingError`, having been deprecated since Python 3.12. " +"(Contributed by Erlend E. Aasland in :gh:`118928` and :gh:`101693`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2660 +#: ../../whatsnew/3.14.rst:2644 msgid "" "Remove the :class:`!Quoter` class from :mod:`urllib.parse`, which has been " -"deprecated since Python 3.11. (Contributed by Nikita Sobolev " -"in :gh:`118827`.)" +"deprecated since Python 3.11. (Contributed by Nikita Sobolev in :gh:" +"`118827`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2664 +#: ../../whatsnew/3.14.rst:2648 msgid "" -"Remove the :class:`!URLopener` and :class:`!FancyURLopener` classes " -"from :mod:`urllib.request`, which have been deprecated since Python 3.3." +"Remove the :class:`!URLopener` and :class:`!FancyURLopener` classes from :" +"mod:`urllib.request`, which have been deprecated since Python 3.3." msgstr "" -#: ../../whatsnew/3.14.rst:2668 +#: ../../whatsnew/3.14.rst:2652 msgid "" "``myopener.open()`` can be replaced with :func:`~urllib.request.urlopen`. " -"``myopener.retrieve()`` can be replaced " -"with :func:`~urllib.request.urlretrieve`. Customisations to the opener " -"classes can be replaced by passing customized handlers " -"to :func:`~urllib.request.build_opener`. (Contributed by Barney Gale " -"in :gh:`84850`.)" +"``myopener.retrieve()`` can be replaced with :func:`~urllib.request." +"urlretrieve`. Customisations to the opener classes can be replaced by " +"passing customized handlers to :func:`~urllib.request.build_opener`. " +"(Contributed by Barney Gale in :gh:`84850`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2677 ../../whatsnew/3.14.rst:2996 +#: ../../whatsnew/3.14.rst:2661 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.14.rst:2679 +#: ../../whatsnew/3.14.rst:2663 #: ../../deprecations/pending-removal-in-future.rst:7 msgid ":mod:`argparse`:" msgstr ":mod:`argparse`:" -#: ../../whatsnew/3.14.rst:2681 +#: ../../whatsnew/3.14.rst:2665 msgid "" -"Passing the undocumented keyword argument *prefix_chars* " -"to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated. " -"(Contributed by Savannah Ostrowski in :gh:`125563`.)" +"Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse." +"ArgumentParser.add_argument_group` is now deprecated. (Contributed by " +"Savannah Ostrowski in :gh:`125563`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2685 +#: ../../whatsnew/3.14.rst:2669 msgid "" "Deprecated the :class:`argparse.FileType` type converter. Anything with " "resource management should be done downstream after the arguments are " "parsed. (Contributed by Serhiy Storchaka in :gh:`58032`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2690 +#: ../../whatsnew/3.14.rst:2674 #: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../whatsnew/3.14.rst:2692 +#: ../../whatsnew/3.14.rst:2676 #: ../../deprecations/pending-removal-in-3.16.rst:21 msgid "" ":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " @@ -4010,10 +3982,10 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除;請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " -"於 :gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" +"gh:`122875` 貢獻。)" -#: ../../whatsnew/3.14.rst:2697 +#: ../../whatsnew/3.14.rst:2681 #: ../../deprecations/pending-removal-in-3.16.rst:26 msgid "" ":mod:`asyncio` policy system is deprecated and will be removed in Python " @@ -4022,37 +3994,37 @@ msgstr "" ":mod:`asyncio` 策略系統已被棄用並將在 Python 3.16 中移除。特別是以下類別和函" "式已被棄用:" -#: ../../whatsnew/3.14.rst:2700 +#: ../../whatsnew/3.14.rst:2684 #: ../../deprecations/pending-removal-in-3.16.rst:29 msgid ":class:`asyncio.AbstractEventLoopPolicy`" msgstr ":class:`asyncio.AbstractEventLoopPolicy`" -#: ../../whatsnew/3.14.rst:2701 +#: ../../whatsnew/3.14.rst:2685 #: ../../deprecations/pending-removal-in-3.16.rst:30 msgid ":class:`asyncio.DefaultEventLoopPolicy`" msgstr ":class:`asyncio.DefaultEventLoopPolicy`" -#: ../../whatsnew/3.14.rst:2702 +#: ../../whatsnew/3.14.rst:2686 #: ../../deprecations/pending-removal-in-3.16.rst:31 msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" msgstr ":class:`asyncio.WindowsSelectorEventLoopPolicy`" -#: ../../whatsnew/3.14.rst:2703 +#: ../../whatsnew/3.14.rst:2687 #: ../../deprecations/pending-removal-in-3.16.rst:32 msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" msgstr ":class:`asyncio.WindowsProactorEventLoopPolicy`" -#: ../../whatsnew/3.14.rst:2704 +#: ../../whatsnew/3.14.rst:2688 #: ../../deprecations/pending-removal-in-3.16.rst:33 msgid ":func:`asyncio.get_event_loop_policy`" msgstr ":func:`asyncio.get_event_loop_policy`" -#: ../../whatsnew/3.14.rst:2705 +#: ../../whatsnew/3.14.rst:2689 #: ../../deprecations/pending-removal-in-3.16.rst:34 msgid ":func:`asyncio.set_event_loop_policy`" msgstr ":func:`asyncio.set_event_loop_policy`" -#: ../../whatsnew/3.14.rst:2707 +#: ../../whatsnew/3.14.rst:2691 #: ../../deprecations/pending-removal-in-3.16.rst:36 msgid "" "Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " @@ -4061,12 +4033,12 @@ msgstr "" "使用者應該使用 :func:`asyncio.run` 或 :class:`asyncio.Runner` 搭配 " "*loop_factory* 來使用所需的事件迴圈實作。" -#: ../../whatsnew/3.14.rst:2710 +#: ../../whatsnew/3.14.rst:2694 #: ../../deprecations/pending-removal-in-3.16.rst:39 msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" msgstr "例如在 Windows 上使用 :class:`asyncio.SelectorEventLoop`: ::" -#: ../../whatsnew/3.14.rst:2712 +#: ../../whatsnew/3.14.rst:2696 #: ../../deprecations/pending-removal-in-3.16.rst:41 msgid "" "import asyncio\n" @@ -4083,96 +4055,94 @@ msgstr "" "\n" "asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" -#: ../../whatsnew/3.14.rst:2719 +#: ../../whatsnew/3.14.rst:2703 #: ../../deprecations/pending-removal-in-3.16.rst:48 msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" msgstr "(由 Kumar Aditya 於 :gh:`127949` 貢獻。)" -#: ../../whatsnew/3.14.rst:2721 +#: ../../whatsnew/3.14.rst:2705 msgid "" ":mod:`builtins`: Passing a complex number as the *real* or *imag* argument " "in the :func:`complex` constructor is now deprecated; it should only be " -"passed as a single positional argument. (Contributed by Serhiy Storchaka " -"in :gh:`109218`.)" +"passed as a single positional argument. (Contributed by Serhiy Storchaka in :" +"gh:`109218`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2727 +#: ../../whatsnew/3.14.rst:2711 msgid "" ":mod:`codecs`: :func:`codecs.open` is now deprecated. Use :func:`open` " "instead. (Contributed by Inada Naoki in :gh:`133036`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2731 +#: ../../whatsnew/3.14.rst:2715 #: ../../deprecations/pending-removal-in-3.15.rst:16 #: ../../deprecations/pending-removal-in-3.19.rst:4 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" -#: ../../whatsnew/3.14.rst:2733 +#: ../../whatsnew/3.14.rst:2717 msgid "" "On non-Windows platforms, setting :attr:`.Structure._pack_` to use a MSVC-" -"compatible default memory layout is deprecated in favor of " -"setting :attr:`.Structure._layout_` to ``'ms'``. (Contributed by Petr " -"Viktorin in :gh:`131747`.)" +"compatible default memory layout is deprecated in favor of setting :attr:`." +"Structure._layout_` to ``'ms'``. (Contributed by Petr Viktorin in :gh:" +"`131747`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2738 +#: ../../whatsnew/3.14.rst:2722 msgid "" "Calling :func:`ctypes.POINTER` on a string is deprecated. Use :ref:`ctypes-" "incomplete-types` for self-referential structures. Also, the internal " "``ctypes._pointer_type_cache`` is deprecated. See :func:`ctypes.POINTER` for " -"updated implementation details. (Contributed by Sergey Myrianov " -"in :gh:`100926`.)" +"updated implementation details. (Contributed by Sergey Myrianov in :gh:" +"`100926`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2744 +#: ../../whatsnew/3.14.rst:2728 msgid "" -":mod:`functools`: Calling the Python implementation " -"of :func:`functools.reduce` with *function* or *sequence* as keyword " -"arguments is now deprecated. (Contributed by Kirill Podoprigora " -"in :gh:`121676`.)" +":mod:`functools`: Calling the Python implementation of :func:`functools." +"reduce` with *function* or *sequence* as keyword arguments is now " +"deprecated. (Contributed by Kirill Podoprigora in :gh:`121676`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2749 +#: ../../whatsnew/3.14.rst:2733 msgid "" ":mod:`logging`: Support for custom logging handlers with the *strm* argument " "is deprecated and scheduled for removal in Python 3.16. Define handlers with " -"the *stream* argument instead. (Contributed by Mariusz Felisiak " -"in :gh:`115032`.)" +"the *stream* argument instead. (Contributed by Mariusz Felisiak in :gh:" +"`115032`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2754 +#: ../../whatsnew/3.14.rst:2738 msgid "" -":mod:`mimetypes`: Valid extensions start with a '.' or are empty " -"for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated " -"and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " -"Kemenade in :gh:`75223`.)" +":mod:`mimetypes`: Valid extensions start with a '.' or are empty for :meth:" +"`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated and will " +"raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade " +"in :gh:`75223`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2761 +#: ../../whatsnew/3.14.rst:2745 msgid "" -":mod:`!nturl2path`: This module is now deprecated. " -"Call :func:`urllib.request.url2pathname` " -"and :func:`~urllib.request.pathname2url` instead. (Contributed by Barney " -"Gale in :gh:`125866`.)" +":mod:`!nturl2path`: This module is now deprecated. Call :func:`urllib." +"request.url2pathname` and :func:`~urllib.request.pathname2url` instead. " +"(Contributed by Barney Gale in :gh:`125866`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2766 +#: ../../whatsnew/3.14.rst:2750 msgid "" -":mod:`os`: :term:`Soft deprecate ` :func:`os.popen` " -"and :func:`os.spawn* ` functions. They should no longer be used " -"to write new code. The :mod:`subprocess` module is recommended instead. " +":mod:`os`: :term:`Soft deprecate ` :func:`os.popen` and :" +"func:`os.spawn* ` functions. They should no longer be used to " +"write new code. The :mod:`subprocess` module is recommended instead. " "(Contributed by Victor Stinner in :gh:`120743`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2772 +#: ../../whatsnew/3.14.rst:2756 msgid "" ":mod:`pathlib`: :meth:`!pathlib.PurePath.as_uri` is deprecated and will be " "removed in Python 3.19. Use :meth:`pathlib.Path.as_uri` instead. " "(Contributed by Barney Gale in :gh:`123599`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2777 +#: ../../whatsnew/3.14.rst:2761 msgid "" ":mod:`pdb`: The undocumented ``pdb.Pdb.curframe_locals`` attribute is now a " "deprecated read-only property. The low overhead dynamic frame locals access " @@ -4182,13 +4152,13 @@ msgid "" "later versions. (Contributed by Tian Gao in :gh:`124369` and :gh:`125951`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2785 +#: ../../whatsnew/3.14.rst:2769 msgid "" ":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " "lack of interest. (Contributed by Bénédikt Tran in :gh:`119698`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2789 +#: ../../whatsnew/3.14.rst:2773 msgid "" ":mod:`tkinter`: The :class:`!tkinter.Variable` methods :meth:`!" "trace_variable`, :meth:`!trace_vdelete` and :meth:`!trace_vinfo` are now " @@ -4196,13 +4166,13 @@ msgid "" "trace_info` instead. (Contributed by Serhiy Storchaka in :gh:`120220`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2796 +#: ../../whatsnew/3.14.rst:2780 msgid "" ":mod:`urllib.parse`: Accepting objects with false values (like ``0`` and " -"``[]``) except empty strings, byte-like objects and ``None`` " -"in :mod:`urllib.parse` functions :func:`~urllib.parse.parse_qsl` " -"and :func:`~urllib.parse.parse_qs` is now deprecated. (Contributed by Serhiy " -"Storchaka in :gh:`116897`.)" +"``[]``) except empty strings, byte-like objects and ``None`` in :mod:`urllib." +"parse` functions :func:`~urllib.parse.parse_qsl` and :func:`~urllib.parse." +"parse_qs` is now deprecated. (Contributed by Serhiy Storchaka in :gh:" +"`116897`.)" msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:2 @@ -4217,10 +4187,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to " -"set :attr:`__spec__.cached ` is " -"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " -"into consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "` 的做法已被棄用。在 Python 3.15 中," @@ -4228,11 +4198,10 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to " -"set :attr:`__spec__.parent ` is " -"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " -"take into consideration by the import system or standard library. " -"(:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "` 的做法已被棄用。在 Python 3.15 中," @@ -4283,17 +4252,15 @@ msgstr ":class:`locale`:" #: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 " -"(:gh:`90817`), but has been postponed to Python 3.15. " -"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " -"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " -"in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" -"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " -"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" -"獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" @@ -4301,11 +4268,11 @@ msgstr ":mod:`pathlib`:" #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " -"Use :func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" -"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" @@ -4360,9 +4327,9 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" -"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " -"於 :gh:`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:80 #: ../../deprecations/pending-removal-in-3.17.rst:4 @@ -4371,10 +4338,10 @@ msgstr ":mod:`typing`:" #: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for " -"creating :class:`~typing.NamedTuple` classes (for example, ``Point = " -"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " -"3.13. Use the class-based syntax or the functional syntax instead." +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (for example, ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``) has been deprecated since Python 3.13. Use the class-based syntax " +"or the functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" @@ -4409,14 +4376,13 @@ msgstr ":mod:`wave`:" #: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " -"and :meth:`~wave.Wave_read.getmarkers` methods of " -"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " -"deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" -"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " -"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:107 msgid ":mod:`zipimport`:" @@ -4428,9 +4394,9 @@ msgid "" "3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " "by Jiahao Li in :gh:`125746`.)" msgstr "" -":meth:`~zipimport.zipimporter.load_module` 自 Python 3.10 被棄用。請改" -"用 :meth:`~zipimport.zipimporter.exec_module`。(由 Jiahao Li " -"於 :gh:`125746` 貢獻。)" +":meth:`~zipimport.zipimporter.load_module` 自 Python 3.10 被棄用。請改用 :" +"meth:`~zipimport.zipimporter.exec_module`。(由 Jiahao Li 於 :gh:`125746` 貢" +"獻。)" #: ../../deprecations/c-api-pending-removal-in-3.16.rst:2 #: ../../deprecations/pending-removal-in-3.16.rst:2 @@ -4439,10 +4405,10 @@ msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to " -"set :attr:`__spec__.loader ` is " -"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " -"taken into consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "` 的做法將於 Python 3.16 被棄用。在 " @@ -4490,8 +4456,8 @@ msgid "" "*function* or *sequence* as keyword arguments has been deprecated since " "Python 3.14." msgstr "" -"自 Python 3.14 起,使用 *function* 或 *sequence* 關鍵字引數呼" -"叫 :func:`functools.reduce` 的 Python 實作已被棄用。" +"自 Python 3.14 起,使用 *function* 或 *sequence* 關鍵字引數呼叫 :func:" +"`functools.reduce` 的 Python 實作已被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:64 msgid ":mod:`logging`:" @@ -4512,10 +4478,10 @@ msgstr ":mod:`mimetypes`:" #: ../../deprecations/pending-removal-in-3.16.rst:72 msgid "" -"Valid extensions start with a '.' or are empty " -"for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated " -"and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " -"Kemenade in :gh:`75223`.)" +"Valid extensions start with a '.' or are empty for :meth:`mimetypes." +"MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :" +"exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:" +"`75223`.)" msgstr "" "有效的副檔名以 '.' 開頭或對 :meth:`mimetypes.MimeTypes.add_type` 為空字串。未" "加點的副檔名已被棄用,並將在 Python 3.16 中引發 :exc:`ValueError`。(由 Hugo " @@ -4598,18 +4564,48 @@ msgstr "" "除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " "和 :func:`typing.get_args`,或者依賴私有實作細節。" +#: ../../deprecations/pending-removal-in-3.17.rst:11 +msgid "" +":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " +"removal in Python 3.17. Prefer :class:`~collections.abc.Sequence` or :class:" +"`~collections.abc.Buffer`. For use in type annotations, prefer a union, like " +"``bytes | bytearray``, or :class:`collections.abc.Buffer`. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" +"自 Python 3.9 起已被棄用的 :class:`typing.ByteString`,計劃在 Python " +"3.17 中移除。建議改用 :class:`~collections.abc.Sequence` 或 :class:`~" +"collections.abc.Buffer`。在型別註釋中建議改用聯集,例如 ``bytes | " +"bytearray`` 或 :class:`collections.abc.Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.17.rst:17 +msgid ":mod:`collections.abc`:" +msgstr ":mod:`collections.abc`:" + +#: ../../deprecations/pending-removal-in-3.17.rst:19 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. " +"Prefer :class:`~collections.abc.Sequence` or :class:`~collections.abc." +"Buffer`. For use in type annotations, prefer a union, like ``bytes | " +"bytearray``, or :class:`collections.abc.Buffer`. (Contributed by Shantanu " +"Jain in :gh:`91896`.)" +msgstr "" +":class:`collections.abc.ByteString` 計劃在 Python 3.17 中移除。建議改用 " +":class:`~collections.abc.Sequence` 或 :class:`~collections.abc.Buffer`。在" +"型別註釋中建議改用聯集,例如 ``bytes | bytearray`` 或 :class:`collections.abc." +"Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" + #: ../../deprecations/pending-removal-in-3.19.rst:2 msgid "Pending removal in Python 3.19" msgstr "Python 3.19 中待移除的項目" #: ../../deprecations/pending-removal-in-3.19.rst:6 msgid "" -"Implicitly switching to the MSVC-compatible struct layout by " -"setting :attr:`~ctypes.Structure._pack_` but " -"not :attr:`~ctypes.Structure._layout_` on non-Windows platforms." +"Implicitly switching to the MSVC-compatible struct layout by setting :attr:" +"`~ctypes.Structure._pack_` but not :attr:`~ctypes.Structure._layout_` on non-" +"Windows platforms." msgstr "" -"在非 Windows 平台上,透過設定 :attr:`~ctypes.Structure._pack_` 而沒有設" -"定 :attr:`~ctypes.Structure._layout_` 來隱式地切換到與 MSVC 相容的結構佈局。" +"在非 Windows 平台上,透過設定 :attr:`~ctypes.Structure._pack_` 而沒有設定 :" +"attr:`~ctypes.Structure._layout_` 來隱式地切換到與 MSVC 相容的結構佈局。" #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 @@ -4629,11 +4625,11 @@ msgstr "巢狀引數群組和巢狀互斥群組已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:11 msgid "" -"Passing the undocumented keyword argument *prefix_chars* " -"to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." +"Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse." +"ArgumentParser.add_argument_group` is now deprecated." msgstr "" -"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞" -"給 :meth:`~argparse.ArgumentParser.add_argument_group` 的做法現在已被棄用。" +"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞給 :meth:`~argparse." +"ArgumentParser.add_argument_group` 的做法現在已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:14 msgid "The :class:`argparse.FileType` type converter is deprecated." @@ -4658,17 +4654,17 @@ msgid "" "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of " -"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " -"and :keyword:`or`. In a future release it will be changed to a syntax " -"error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" -"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " -"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" -"法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" +"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" +"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" +"本中,它將被更改為語法錯誤。(:gh:`87999`)" #: ../../deprecations/pending-removal-in-future.rst:30 msgid "" @@ -4681,18 +4677,18 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:33 msgid "" -"Support for ``__float__()`` method returning a strict subclass " -"of :class:`float`: these methods will be required to return an instance " -"of :class:`float`." +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:36 msgid "" -"Support for ``__complex__()`` method returning a strict subclass " -"of :class:`complex`: these methods will be required to return an instance " -"of :class:`complex`." +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" @@ -4703,10 +4699,10 @@ msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" #: ../../deprecations/pending-removal-in-future.rst:40 msgid "" -"Passing a complex number as the *real* or *imag* argument in " -"the :func:`complex` constructor is now deprecated; it should only be passed " -"as a single positional argument. (Contributed by Serhiy Storchaka " -"in :gh:`109218`.)" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" @@ -4714,9 +4710,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:45 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` " -"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " @@ -4724,8 +4719,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:50 msgid "" -":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " -"(:gh:`133038`)" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:" +"`133038`)" msgstr "" ":mod:`codecs`:請改用 :func:`open` 而非 :func:`codecs.open`。(:gh:`133038`)" @@ -4742,19 +4737,19 @@ msgstr ":mod:`datetime`:" #: ../../deprecations/pending-removal-in-future.rst:57 msgid "" -":meth:`~datetime.datetime.utcnow`: use " -"``datetime.datetime.now(tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 " -"``datetime.datetime.now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." +"now(tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:59 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:62 msgid ":mod:`gettext`: Plural value must be an integer." @@ -4785,8 +4780,8 @@ msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" -"用 :meth:`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" #: ../../deprecations/pending-removal-in-future.rst:77 msgid "" @@ -4843,11 +4838,11 @@ msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:100 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " -"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " -"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" +"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" #: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.OP_NO_SSL*`` options" @@ -4895,11 +4890,11 @@ msgstr ":mod:`threading` 方法:" #: ../../deprecations/pending-removal-in-future.rst:116 msgid "" -":meth:`!threading.Condition.notifyAll`: " -"use :meth:`~threading.Condition.notify_all`." +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請" -"用 :meth:`~threading.Condition.notify_all`。" +":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." +"notify_all`。" #: ../../deprecations/pending-removal-in-future.rst:117 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." @@ -4907,19 +4902,19 @@ msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set` #: ../../deprecations/pending-removal-in-future.rst:118 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " -"use :attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:120 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " -"use :attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" -"用 :attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" +"attr:`threading.Thread.name` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:122 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." @@ -5012,629 +5007,519 @@ msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分 #: ../../deprecations/pending-removal-in-future.rst:152 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of " -"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " -"release it will always return ``True``. Prefer explicit ``len(elem)`` or " -"``elem is not None`` tests instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用" -"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" -"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." +"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " +"``len(elem)`` 或 ``elem is not None`` 測試。" #: ../../deprecations/pending-removal-in-future.rst:157 msgid "" -":func:`sys._clear_type_cache` is deprecated: " -"use :func:`sys._clear_internal_caches` instead." +":func:`sys._clear_type_cache` is deprecated: use :func:`sys." +"_clear_internal_caches` instead." msgstr "" -":func:`sys._clear_type_cache` 已被棄用:請改" -"用 :func:`sys._clear_internal_caches`。" +":func:`sys._clear_type_cache` 已被棄用:請改用 :func:`sys." +"_clear_internal_caches`。" -#: ../../whatsnew/3.14.rst:2817 +#: ../../whatsnew/3.14.rst:2801 msgid "CPython bytecode changes" msgstr "CPython 位元組碼變更" -#: ../../whatsnew/3.14.rst:2819 +#: ../../whatsnew/3.14.rst:2803 msgid "" "Replaced the opcode ``BINARY_SUBSCR`` by :opcode:`BINARY_OP` with oparg " "``NB_SUBSCR``. (Contributed by Irit Katriel in :gh:`100239`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2824 +#: ../../whatsnew/3.14.rst:2808 msgid "C API changes" msgstr "C API 變更" -#: ../../whatsnew/3.14.rst:2829 +#: ../../whatsnew/3.14.rst:2811 +msgid "New features in the C API" +msgstr "C API 中的新功能" + +#: ../../whatsnew/3.14.rst:2813 msgid "" -"Add :c:func:`PyLong_GetSign` function to get the sign of :class:`int` " -"objects. (Contributed by Sergey B Kirpichev in :gh:`116560`.)" +"Add :c:func:`Py_PACK_VERSION` and :c:func:`Py_PACK_FULL_VERSION`, two new " +"macros for bit-packing Python version numbers. This is useful for " +"comparisons with :c:var:`Py_Version` or :c:macro:`PY_VERSION_HEX`. " +"(Contributed by Petr Viktorin in :gh:`128629`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2832 +#: ../../whatsnew/3.14.rst:2819 msgid "" -"Add a new :c:type:`PyUnicodeWriter` API to create a Python :class:`str` " -"object:" +"Add :c:func:`PyBytes_Join(sep, iterable) ` function, similar " +"to ``sep.join(iterable)`` in Python. (Contributed by Victor Stinner in :gh:" +"`121645`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2835 -msgid ":c:func:`PyUnicodeWriter_Create`" -msgstr ":c:func:`PyUnicodeWriter_Create`" +#: ../../whatsnew/3.14.rst:2823 +msgid "" +"Add functions to manipulate the configuration of the current runtime Python " +"interpreter (:ref:`PEP 741: Python configuration C API `):" +msgstr "" -#: ../../whatsnew/3.14.rst:2836 -msgid ":c:func:`PyUnicodeWriter_DecodeUTF8Stateful`" -msgstr ":c:func:`PyUnicodeWriter_DecodeUTF8Stateful`" +#: ../../whatsnew/3.14.rst:2827 +msgid ":c:func:`PyConfig_Get`" +msgstr ":c:func:`PyConfig_Get`" + +#: ../../whatsnew/3.14.rst:2828 +msgid ":c:func:`PyConfig_GetInt`" +msgstr ":c:func:`PyConfig_GetInt`" + +#: ../../whatsnew/3.14.rst:2829 +msgid ":c:func:`PyConfig_Set`" +msgstr ":c:func:`PyConfig_Set`" + +#: ../../whatsnew/3.14.rst:2830 +msgid ":c:func:`PyConfig_Names`" +msgstr ":c:func:`PyConfig_Names`" + +#: ../../whatsnew/3.14.rst:2834 +msgid "" +"Add functions to configure Python initialization (:ref:`PEP 741: Python " +"configuration C API `):" +msgstr "" +"新增用於配置 Python 初始化的函式(:ref:`PEP 741:Python 配置 C API `):" #: ../../whatsnew/3.14.rst:2837 -msgid ":c:func:`PyUnicodeWriter_Discard`" -msgstr ":c:func:`PyUnicodeWriter_Discard`" +msgid ":c:func:`Py_InitializeFromInitConfig`" +msgstr ":c:func:`Py_InitializeFromInitConfig`" #: ../../whatsnew/3.14.rst:2838 -msgid ":c:func:`PyUnicodeWriter_Finish`" -msgstr ":c:func:`PyUnicodeWriter_Finish`" +msgid ":c:func:`PyInitConfig_AddModule`" +msgstr ":c:func:`PyInitConfig_AddModule`" #: ../../whatsnew/3.14.rst:2839 -msgid ":c:func:`PyUnicodeWriter_Format`" -msgstr ":c:func:`PyUnicodeWriter_Format`" +msgid ":c:func:`PyInitConfig_Create`" +msgstr ":c:func:`PyInitConfig_Create`" #: ../../whatsnew/3.14.rst:2840 -msgid ":c:func:`PyUnicodeWriter_WriteASCII`" -msgstr ":c:func:`PyUnicodeWriter_WriteASCII`" +msgid ":c:func:`PyInitConfig_Free`" +msgstr ":c:func:`PyInitConfig_Free`" #: ../../whatsnew/3.14.rst:2841 -msgid ":c:func:`PyUnicodeWriter_WriteChar`" -msgstr ":c:func:`PyUnicodeWriter_WriteChar`" +msgid ":c:func:`PyInitConfig_FreeStrList`" +msgstr ":c:func:`PyInitConfig_FreeStrList`" #: ../../whatsnew/3.14.rst:2842 -msgid ":c:func:`PyUnicodeWriter_WriteRepr`" -msgstr ":c:func:`PyUnicodeWriter_WriteRepr`" +msgid ":c:func:`PyInitConfig_GetError`" +msgstr ":c:func:`PyInitConfig_GetError`" #: ../../whatsnew/3.14.rst:2843 -msgid ":c:func:`PyUnicodeWriter_WriteStr`" -msgstr ":c:func:`PyUnicodeWriter_WriteStr`" +msgid ":c:func:`PyInitConfig_GetExitCode`" +msgstr ":c:func:`PyInitConfig_GetExitCode`" #: ../../whatsnew/3.14.rst:2844 -msgid ":c:func:`PyUnicodeWriter_WriteSubstring`" -msgstr ":c:func:`PyUnicodeWriter_WriteSubstring`" +msgid ":c:func:`PyInitConfig_GetInt`" +msgstr ":c:func:`PyInitConfig_GetInt`" #: ../../whatsnew/3.14.rst:2845 -msgid ":c:func:`PyUnicodeWriter_WriteUCS4`" -msgstr ":c:func:`PyUnicodeWriter_WriteUCS4`" +msgid ":c:func:`PyInitConfig_GetStr`" +msgstr ":c:func:`PyInitConfig_GetStr`" #: ../../whatsnew/3.14.rst:2846 -msgid ":c:func:`PyUnicodeWriter_WriteUTF8`" -msgstr ":c:func:`PyUnicodeWriter_WriteUTF8`" +msgid ":c:func:`PyInitConfig_GetStrList`" +msgstr ":c:func:`PyInitConfig_GetStrList`" #: ../../whatsnew/3.14.rst:2847 -msgid ":c:func:`PyUnicodeWriter_WriteWideChar`" -msgstr ":c:func:`PyUnicodeWriter_WriteWideChar`" +msgid ":c:func:`PyInitConfig_HasOption`" +msgstr ":c:func:`PyInitConfig_HasOption`" + +#: ../../whatsnew/3.14.rst:2848 +msgid ":c:func:`PyInitConfig_SetInt`" +msgstr ":c:func:`PyInitConfig_SetInt`" #: ../../whatsnew/3.14.rst:2849 -msgid "(Contributed by Victor Stinner in :gh:`119182`.)" -msgstr "(由 Victor Stinner 於 :gh:`119182` 貢獻。)" +msgid ":c:func:`PyInitConfig_SetStr`" +msgstr ":c:func:`PyInitConfig_SetStr`" -#: ../../whatsnew/3.14.rst:2851 +#: ../../whatsnew/3.14.rst:2850 +msgid ":c:func:`PyInitConfig_SetStrList`" +msgstr ":c:func:`PyInitConfig_SetStrList`" + +#: ../../whatsnew/3.14.rst:2854 +msgid "" +"Add :c:func:`Py_fopen` function to open a file. This works similarly to the " +"standard C :c:func:`!fopen` function, instead accepting a Python object for " +"the *path* parameter and setting an exception on error. The corresponding " +"new :c:func:`Py_fclose` function should be used to close a file. " +"(Contributed by Victor Stinner in :gh:`127350`.)" +msgstr "" + +#: ../../whatsnew/3.14.rst:2862 +msgid "" +"Add :c:func:`Py_HashBuffer` to compute and return the hash value of a " +"buffer. (Contributed by Antoine Pitrou and Victor Stinner in :gh:`122854`.)" +msgstr "" + +#: ../../whatsnew/3.14.rst:2865 +msgid "" +"Add :c:func:`PyImport_ImportModuleAttr` and :c:func:" +"`PyImport_ImportModuleAttrString` helper functions to import a module and " +"get an attribute of the module. (Contributed by Victor Stinner in :gh:" +"`128911`.)" +msgstr "" + +#: ../../whatsnew/3.14.rst:2870 msgid "" "Add :c:func:`PyIter_NextItem` to replace :c:func:`PyIter_Next`, which has an " -"ambiguous return value. (Contributed by Irit Katriel and Erlend Aasland " -"in :gh:`105201`.)" +"ambiguous return value. (Contributed by Irit Katriel and Erlend Aasland in :" +"gh:`105201`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2855 +#: ../../whatsnew/3.14.rst:2874 +msgid "" +"Add :c:func:`PyLong_GetSign` function to get the sign of :class:`int` " +"objects. (Contributed by Sergey B Kirpichev in :gh:`116560`.)" +msgstr "" + +#: ../../whatsnew/3.14.rst:2877 msgid "" -"Add :c:func:`PyLong_IsPositive`, :c:func:`PyLong_IsNegative` " -"and :c:func:`PyLong_IsZero` for checking if :c:type:`PyLongObject` is " -"positive, negative, or zero, respectively. (Contributed by James Roy and " -"Sergey B Kirpichev in :gh:`126061`.)" +"Add :c:func:`PyLong_IsPositive`, :c:func:`PyLong_IsNegative` and :c:func:" +"`PyLong_IsZero` for checking if :c:type:`PyLongObject` is positive, " +"negative, or zero, respectively. (Contributed by James Roy and Sergey B " +"Kirpichev in :gh:`126061`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2860 +#: ../../whatsnew/3.14.rst:2882 msgid "" -"Add new functions to convert C ```` numbers from/to " -"Python :class:`int`:" +"Add new functions to convert C ```` numbers to/from Python :class:" +"`int` objects:" msgstr "" -#: ../../whatsnew/3.14.rst:2863 +#: ../../whatsnew/3.14.rst:2885 msgid ":c:func:`PyLong_AsInt32`" msgstr ":c:func:`PyLong_AsInt32`" -#: ../../whatsnew/3.14.rst:2864 +#: ../../whatsnew/3.14.rst:2886 msgid ":c:func:`PyLong_AsInt64`" msgstr ":c:func:`PyLong_AsInt64`" -#: ../../whatsnew/3.14.rst:2865 +#: ../../whatsnew/3.14.rst:2887 msgid ":c:func:`PyLong_AsUInt32`" msgstr ":c:func:`PyLong_AsUInt32`" -#: ../../whatsnew/3.14.rst:2866 +#: ../../whatsnew/3.14.rst:2888 msgid ":c:func:`PyLong_AsUInt64`" msgstr ":c:func:`PyLong_AsUInt64`" -#: ../../whatsnew/3.14.rst:2867 +#: ../../whatsnew/3.14.rst:2889 msgid ":c:func:`PyLong_FromInt32`" msgstr ":c:func:`PyLong_FromInt32`" -#: ../../whatsnew/3.14.rst:2868 +#: ../../whatsnew/3.14.rst:2890 msgid ":c:func:`PyLong_FromInt64`" msgstr ":c:func:`PyLong_FromInt64`" -#: ../../whatsnew/3.14.rst:2869 +#: ../../whatsnew/3.14.rst:2891 msgid ":c:func:`PyLong_FromUInt32`" msgstr ":c:func:`PyLong_FromUInt32`" -#: ../../whatsnew/3.14.rst:2870 +#: ../../whatsnew/3.14.rst:2892 msgid ":c:func:`PyLong_FromUInt64`" msgstr ":c:func:`PyLong_FromUInt64`" -#: ../../whatsnew/3.14.rst:2872 +#: ../../whatsnew/3.14.rst:2894 msgid "(Contributed by Victor Stinner in :gh:`120389`.)" msgstr "(由 Victor Stinner 於 :gh:`120389` 貢獻。)" -#: ../../whatsnew/3.14.rst:2874 -msgid "" -"Add :c:func:`PyBytes_Join(sep, iterable) ` function, similar " -"to ``sep.join(iterable)`` in Python. (Contributed by Victor Stinner " -"in :gh:`121645`.)" -msgstr "" - -#: ../../whatsnew/3.14.rst:2878 -msgid "" -"Add :c:func:`Py_HashBuffer` to compute and return the hash value of a " -"buffer. (Contributed by Antoine Pitrou and Victor Stinner in :gh:`122854`.)" -msgstr "" - -#: ../../whatsnew/3.14.rst:2881 -msgid "" -"Add functions to get and set the current runtime Python configuration " -"(:pep:`741`):" -msgstr "" - -#: ../../whatsnew/3.14.rst:2884 -msgid ":c:func:`PyConfig_Get`" -msgstr ":c:func:`PyConfig_Get`" - -#: ../../whatsnew/3.14.rst:2885 -msgid ":c:func:`PyConfig_GetInt`" -msgstr ":c:func:`PyConfig_GetInt`" - -#: ../../whatsnew/3.14.rst:2886 -msgid ":c:func:`PyConfig_Set`" -msgstr ":c:func:`PyConfig_Set`" - -#: ../../whatsnew/3.14.rst:2887 -msgid ":c:func:`PyConfig_Names`" -msgstr ":c:func:`PyConfig_Names`" - -#: ../../whatsnew/3.14.rst:2891 -msgid "Add functions to configure the Python initialization (:pep:`741`):" -msgstr "" - -#: ../../whatsnew/3.14.rst:2893 -msgid ":c:func:`Py_InitializeFromInitConfig`" -msgstr ":c:func:`Py_InitializeFromInitConfig`" - -#: ../../whatsnew/3.14.rst:2894 -msgid ":c:func:`PyInitConfig_AddModule`" -msgstr ":c:func:`PyInitConfig_AddModule`" - -#: ../../whatsnew/3.14.rst:2895 -msgid ":c:func:`PyInitConfig_Create`" -msgstr ":c:func:`PyInitConfig_Create`" - #: ../../whatsnew/3.14.rst:2896 -msgid ":c:func:`PyInitConfig_Free`" -msgstr ":c:func:`PyInitConfig_Free`" - -#: ../../whatsnew/3.14.rst:2897 -msgid ":c:func:`PyInitConfig_FreeStrList`" -msgstr ":c:func:`PyInitConfig_FreeStrList`" - -#: ../../whatsnew/3.14.rst:2898 -msgid ":c:func:`PyInitConfig_GetError`" -msgstr ":c:func:`PyInitConfig_GetError`" - -#: ../../whatsnew/3.14.rst:2899 -msgid ":c:func:`PyInitConfig_GetExitCode`" -msgstr ":c:func:`PyInitConfig_GetExitCode`" - -#: ../../whatsnew/3.14.rst:2900 -msgid ":c:func:`PyInitConfig_GetInt`" -msgstr ":c:func:`PyInitConfig_GetInt`" - -#: ../../whatsnew/3.14.rst:2901 -msgid ":c:func:`PyInitConfig_GetStr`" -msgstr ":c:func:`PyInitConfig_GetStr`" - -#: ../../whatsnew/3.14.rst:2902 -msgid ":c:func:`PyInitConfig_GetStrList`" -msgstr ":c:func:`PyInitConfig_GetStrList`" - -#: ../../whatsnew/3.14.rst:2903 -msgid ":c:func:`PyInitConfig_HasOption`" -msgstr ":c:func:`PyInitConfig_HasOption`" - -#: ../../whatsnew/3.14.rst:2904 -msgid ":c:func:`PyInitConfig_SetInt`" -msgstr ":c:func:`PyInitConfig_SetInt`" - -#: ../../whatsnew/3.14.rst:2905 -msgid ":c:func:`PyInitConfig_SetStr`" -msgstr ":c:func:`PyInitConfig_SetStr`" - -#: ../../whatsnew/3.14.rst:2906 -msgid ":c:func:`PyInitConfig_SetStrList`" -msgstr ":c:func:`PyInitConfig_SetStrList`" - -#: ../../whatsnew/3.14.rst:2910 msgid "" "Add a new import and export API for Python :class:`int` objects (:pep:`757`):" msgstr "" -#: ../../whatsnew/3.14.rst:2912 +#: ../../whatsnew/3.14.rst:2899 msgid ":c:func:`PyLong_GetNativeLayout`" msgstr ":c:func:`PyLong_GetNativeLayout`" -#: ../../whatsnew/3.14.rst:2913 +#: ../../whatsnew/3.14.rst:2900 msgid ":c:func:`PyLong_Export`" msgstr ":c:func:`PyLong_Export`" -#: ../../whatsnew/3.14.rst:2914 +#: ../../whatsnew/3.14.rst:2901 msgid ":c:func:`PyLong_FreeExport`" msgstr ":c:func:`PyLong_FreeExport`" -#: ../../whatsnew/3.14.rst:2915 +#: ../../whatsnew/3.14.rst:2902 msgid ":c:func:`PyLongWriter_Create`" msgstr ":c:func:`PyLongWriter_Create`" -#: ../../whatsnew/3.14.rst:2916 +#: ../../whatsnew/3.14.rst:2903 msgid ":c:func:`PyLongWriter_Finish`" msgstr ":c:func:`PyLongWriter_Finish`" -#: ../../whatsnew/3.14.rst:2917 +#: ../../whatsnew/3.14.rst:2904 msgid ":c:func:`PyLongWriter_Discard`" msgstr ":c:func:`PyLongWriter_Discard`" -#: ../../whatsnew/3.14.rst:2919 +#: ../../whatsnew/3.14.rst:2906 msgid "(Contributed by Sergey B Kirpichev and Victor Stinner in :gh:`102471`.)" msgstr "(由 Sergey B Kirpichev 和 Victor Stinner 於 :gh:`102471` 貢獻。)" -#: ../../whatsnew/3.14.rst:2921 -msgid "" -"Add :c:func:`PyType_GetBaseByToken` and :c:data:`Py_tp_token` slot for " -"easier superclass identification, which attempts to resolve the `type " -"checking issue `__ " -"mentioned in :pep:`630`. (Contributed in :gh:`124153`.)" -msgstr "" - -#: ../../whatsnew/3.14.rst:2926 +#: ../../whatsnew/3.14.rst:2908 msgid "" -"Add :c:func:`PyUnicode_Equal` function to the limited C API: test if two " -"strings are equal. (Contributed by Victor Stinner in :gh:`124502`.)" +"Add :c:func:`PyMonitoring_FireBranchLeftEvent` and :c:func:" +"`PyMonitoring_FireBranchRightEvent` for generating :monitoring-event:" +"`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT` events, respectively. " +"(Contributed by Mark Shannon in :gh:`122548`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2930 +#: ../../whatsnew/3.14.rst:2914 msgid "" "Add :c:func:`PyType_Freeze` function to make a type immutable. (Contributed " "by Victor Stinner in :gh:`121654`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2933 +#: ../../whatsnew/3.14.rst:2917 msgid "" -"Add :c:func:`PyUnstable_Object_EnableDeferredRefcount` for enabling deferred " -"reference counting, as outlined in :pep:`703`." +"Add :c:func:`PyType_GetBaseByToken` and :c:data:`Py_tp_token` slot for " +"easier superclass identification, which attempts to resolve the type " +"checking issue mentioned in :pep:`PEP 630 <630#type-checking>`. (Contributed " +"in :gh:`124153`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2936 +#: ../../whatsnew/3.14.rst:2922 msgid "" -"Add :c:func:`PyMonitoring_FireBranchLeftEvent` " -"and :c:func:`PyMonitoring_FireBranchRightEvent` for generating :monitoring-" -"event:`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT` events, " -"respectively." +"Add a new :c:func:`PyUnicode_Equal` function to test if two strings are " +"equal. The function is also added to the Limited C API. (Contributed by " +"Victor Stinner in :gh:`124502`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2941 +#: ../../whatsnew/3.14.rst:2927 msgid "" -"Add :c:func:`Py_fopen` function to open a file. Similar to the :c:func:`!" -"fopen` function, but the *path* parameter is a Python object and an " -"exception is set on error. Add also :c:func:`Py_fclose` function to close a " -"file. (Contributed by Victor Stinner in :gh:`127350`.)" +"Add a new :c:type:`PyUnicodeWriter` API to create a Python :class:`str` " +"object, with the following functions:" msgstr "" -#: ../../whatsnew/3.14.rst:2947 -msgid "" -"The ``k`` and ``K`` formats in :c:func:`PyArg_ParseTuple` and similar " -"functions now use :meth:`~object.__index__` if available, like all other " -"integer formats. (Contributed by Serhiy Storchaka in :gh:`112068`.)" -msgstr "" +#: ../../whatsnew/3.14.rst:2930 +msgid ":c:func:`PyUnicodeWriter_Create`" +msgstr ":c:func:`PyUnicodeWriter_Create`" -#: ../../whatsnew/3.14.rst:2952 -msgid "" -"Add macros :c:func:`Py_PACK_VERSION` and :c:func:`Py_PACK_FULL_VERSION` for " -"bit-packing Python version numbers. (Contributed by Petr Viktorin " -"in :gh:`128629`.)" -msgstr "" +#: ../../whatsnew/3.14.rst:2931 +msgid ":c:func:`PyUnicodeWriter_DecodeUTF8Stateful`" +msgstr ":c:func:`PyUnicodeWriter_DecodeUTF8Stateful`" -#: ../../whatsnew/3.14.rst:2956 -msgid "" -"Add :c:func:`PyUnstable_IsImmortal` for determining whether an object " -"is :term:`immortal`, for debugging purposes." -msgstr "" +#: ../../whatsnew/3.14.rst:2932 +msgid ":c:func:`PyUnicodeWriter_Discard`" +msgstr ":c:func:`PyUnicodeWriter_Discard`" -#: ../../whatsnew/3.14.rst:2959 -msgid "" -"Add :c:func:`PyImport_ImportModuleAttr` " -"and :c:func:`PyImport_ImportModuleAttrString` helper functions to import a " -"module and get an attribute of the module. (Contributed by Victor Stinner " -"in :gh:`128911`.)" -msgstr "" +#: ../../whatsnew/3.14.rst:2933 +msgid ":c:func:`PyUnicodeWriter_Finish`" +msgstr ":c:func:`PyUnicodeWriter_Finish`" -#: ../../whatsnew/3.14.rst:2964 -msgid "" -"Add support for a new ``p`` format unit in :c:func:`Py_BuildValue` that " -"allows taking a C integer and produces a Python :class:`bool` object. " -"(Contributed by Pablo Galindo in :issue:`45325`.)" -msgstr "" +#: ../../whatsnew/3.14.rst:2934 +msgid ":c:func:`PyUnicodeWriter_Format`" +msgstr ":c:func:`PyUnicodeWriter_Format`" -#: ../../whatsnew/3.14.rst:2968 -msgid "" -"Add :c:func:`PyUnstable_Object_IsUniqueReferencedTemporary` to determine if " -"an object is a unique temporary object on the interpreter's operand stack. " -"This can be used in some cases as a replacement for checking " -"if :c:func:`Py_REFCNT` is ``1`` for Python objects passed as arguments to C " -"API functions." -msgstr "" +#: ../../whatsnew/3.14.rst:2935 +msgid ":c:func:`PyUnicodeWriter_WriteASCII`" +msgstr ":c:func:`PyUnicodeWriter_WriteASCII`" -#: ../../whatsnew/3.14.rst:2973 -msgid "" -"Add :c:func:`PyUnstable_Object_IsUniquelyReferenced` as a replacement for " -"``Py_REFCNT(op) == 1`` on :term:`free threaded ` builds. " -"(Contributed by Peter Bierma in :gh:`133140`.)" -msgstr "" +#: ../../whatsnew/3.14.rst:2936 +msgid ":c:func:`PyUnicodeWriter_WriteChar`" +msgstr ":c:func:`PyUnicodeWriter_WriteChar`" -#: ../../whatsnew/3.14.rst:2979 -msgid "Limited C API changes" -msgstr "" +#: ../../whatsnew/3.14.rst:2937 +msgid ":c:func:`PyUnicodeWriter_WriteRepr`" +msgstr ":c:func:`PyUnicodeWriter_WriteRepr`" -#: ../../whatsnew/3.14.rst:2981 -msgid "" -"In the limited C API 3.14 and newer, :c:func:`Py_TYPE` " -"and :c:func:`Py_REFCNT` are now implemented as an opaque function call to " -"hide implementation details. (Contributed by Victor Stinner in :gh:`120600` " -"and :gh:`124127`.)" -msgstr "" +#: ../../whatsnew/3.14.rst:2938 +msgid ":c:func:`PyUnicodeWriter_WriteStr`" +msgstr ":c:func:`PyUnicodeWriter_WriteStr`" -#: ../../whatsnew/3.14.rst:2986 -msgid "" -"Remove " -"the :c:macro:`PySequence_Fast_GET_SIZE`, :c:macro:`PySequence_Fast_GET_ITEM` " -"and :c:macro:`PySequence_Fast_ITEMS` macros from the limited C API, since " -"these macros never worked in the limited C API. " -"Keep :c:func:`PySequence_Fast` in the limited C API. (Contributed by Victor " -"Stinner in :gh:`91417`.)" -msgstr "" +#: ../../whatsnew/3.14.rst:2939 +msgid ":c:func:`PyUnicodeWriter_WriteSubstring`" +msgstr ":c:func:`PyUnicodeWriter_WriteSubstring`" -#: ../../whatsnew/3.14.rst:2998 -msgid "" -"The :c:macro:`!Py_HUGE_VAL` macro is :term:`soft deprecated`, use :c:macro:`!" -"Py_INFINITY` instead. (Contributed by Sergey B Kirpichev in :gh:`120026`.)" -msgstr "" +#: ../../whatsnew/3.14.rst:2940 +msgid ":c:func:`PyUnicodeWriter_WriteUCS4`" +msgstr ":c:func:`PyUnicodeWriter_WriteUCS4`" -#: ../../whatsnew/3.14.rst:3002 +#: ../../whatsnew/3.14.rst:2941 +msgid ":c:func:`PyUnicodeWriter_WriteUTF8`" +msgstr ":c:func:`PyUnicodeWriter_WriteUTF8`" + +#: ../../whatsnew/3.14.rst:2942 +msgid ":c:func:`PyUnicodeWriter_WriteWideChar`" +msgstr ":c:func:`PyUnicodeWriter_WriteWideChar`" + +#: ../../whatsnew/3.14.rst:2944 +msgid "(Contributed by Victor Stinner in :gh:`119182`.)" +msgstr "(由 Victor Stinner 於 :gh:`119182` 貢獻。)" + +#: ../../whatsnew/3.14.rst:2946 msgid "" -"Macros :c:macro:`!Py_IS_NAN`, :c:macro:`!Py_IS_INFINITY` and :c:macro:`!" -"Py_IS_FINITE` are :term:`soft deprecated`, use instead :c:macro:`!" -"isnan`, :c:macro:`!isinf` and :c:macro:`!isfinite` available " -"from :file:`math.h` since C99. (Contributed by Sergey B Kirpichev " -"in :gh:`119613`.)" +"The ``k`` and ``K`` formats in :c:func:`PyArg_ParseTuple` and similar " +"functions now use :meth:`~object.__index__` if available, like all other " +"integer formats. (Contributed by Serhiy Storchaka in :gh:`112068`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3008 +#: ../../whatsnew/3.14.rst:2951 msgid "" -"Non-tuple sequences are deprecated as argument for the ``(items)`` format " -"unit in :c:func:`PyArg_ParseTuple` and other :ref:`argument parsing ` functions if *items* contains format units which store " -"a :ref:`borrowed buffer ` or a :term:`borrowed " -"reference`. (Contributed by Serhiy Storchaka in :gh:`50333`.)" +"Add support for a new ``p`` format unit in :c:func:`Py_BuildValue` that " +"produces a Python :class:`bool` object from a C integer. (Contributed by " +"Pablo Galindo in :issue:`45325`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3015 +#: ../../whatsnew/3.14.rst:2955 msgid "" -"The previously undocumented function :c:func:`PySequence_In` is :term:`soft " -"deprecated`. Use :c:func:`PySequence_Contains` instead. (Contributed by Yuki " -"Kobayashi in :gh:`127896`.)" +"Add :c:func:`PyUnstable_IsImmortal` for determining if an object is :term:" +"`immortal`, for debugging purposes. (Contributed by Peter Bierma in :gh:" +"`128509`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3021 +#: ../../whatsnew/3.14.rst:2959 msgid "" -"The ``PyMonitoring_FireBranchEvent`` function is deprecated and should be " -"replaced with calls to :c:func:`PyMonitoring_FireBranchLeftEvent` " -"and :c:func:`PyMonitoring_FireBranchRightEvent`." +"Add :c:func:`PyUnstable_Object_EnableDeferredRefcount` for enabling deferred " +"reference counting, as outlined in :pep:`703`." msgstr "" -#: ../../whatsnew/3.14.rst:3025 +#: ../../whatsnew/3.14.rst:2962 msgid "" -"The following private functions are deprecated and planned for removal in " -"Python 3.18:" +"Add :c:func:`PyUnstable_Object_IsUniquelyReferenced` as a replacement for " +"``Py_REFCNT(op) == 1`` on :term:`free threaded ` builds. " +"(Contributed by Peter Bierma in :gh:`133140`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3028 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:6 -msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." -msgstr ":c:func:`!_PyBytes_Join`:請改用 :c:func:`PyBytes_Join`。" - -#: ../../whatsnew/3.14.rst:3029 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 +#: ../../whatsnew/3.14.rst:2967 msgid "" -":c:func:`!_PyDict_GetItemStringWithError`: " -"use :c:func:`PyDict_GetItemStringRef`." +"Add :c:func:`PyUnstable_Object_IsUniqueReferencedTemporary` to determine if " +"an object is a unique temporary object on the interpreter's operand stack. " +"This can be used in some cases as a replacement for checking if :c:func:" +"`Py_REFCNT` is ``1`` for Python objects passed as arguments to C API " +"functions. (Contributed by Sam Gross in :gh:`133164`.)" msgstr "" -":c:func:`!_PyDict_GetItemStringWithError`:請改" -"用 :c:func:`PyDict_GetItemStringRef`。" -#: ../../whatsnew/3.14.rst:3030 -msgid ":c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`." +#: ../../whatsnew/3.14.rst:2977 +msgid "Limited C API changes" msgstr "" -#: ../../whatsnew/3.14.rst:3031 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 -msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." -msgstr ":c:func:`!_PyLong_Sign()`:請改用 :c:func:`PyLong_GetSign`。" - -#: ../../whatsnew/3.14.rst:3032 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 +#: ../../whatsnew/3.14.rst:2979 msgid "" -":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: " -"use :c:func:`PyLongWriter_Create`." +"In the limited C API version 3.14 and newer, :c:func:`Py_TYPE` and :c:func:" +"`Py_REFCNT` are now implemented as an opaque function call to hide " +"implementation details. (Contributed by Victor Stinner in :gh:`120600` and :" +"gh:`124127`.)" msgstr "" -":c:func:`!_PyLong_FromDigits` 和 :c:func:`!_PyLong_New`:請改" -"用 :c:func:`PyLongWriter_Create`。" -#: ../../whatsnew/3.14.rst:3034 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:12 +#: ../../whatsnew/3.14.rst:2984 msgid "" -":c:func:`!_PyThreadState_UncheckedGet`: " -"use :c:func:`PyThreadState_GetUnchecked`." +"Remove the :c:macro:`PySequence_Fast_GET_SIZE`, :c:macro:" +"`PySequence_Fast_GET_ITEM`, and :c:macro:`PySequence_Fast_ITEMS` macros from " +"the limited C API, since they have always been broken in the limited C API. " +"(Contributed by Victor Stinner in :gh:`91417`.)" msgstr "" -":c:func:`!_PyThreadState_UncheckedGet`:請改" -"用 :c:func:`PyThreadState_GetUnchecked`。" -#: ../../whatsnew/3.14.rst:3035 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 -msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." -msgstr ":c:func:`!_PyUnicode_AsString`:請改用 :c:func:`PyUnicode_AsUTF8`。" +#: ../../whatsnew/3.14.rst:2995 +msgid "Removed C APIs" +msgstr "被移除的 C API" -#: ../../whatsnew/3.14.rst:3036 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 +#: ../../whatsnew/3.14.rst:2997 msgid "" -":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " -"with :c:func:`writer = PyUnicodeWriter_Create(0) `." +"Creating :c:data:`immutable types ` with mutable " +"bases was deprecated in Python 3.12, and now raises a :exc:`TypeError`. " +"(Contributed by Nikita Sobolev in :gh:`119775`.)" msgstr "" -":c:func:`!_PyUnicodeWriter_Init`:將 ``_PyUnicodeWriter_Init(&writer)`` 替換" -"為 :c:func:`writer = PyUnicodeWriter_Create(0) `。" -#: ../../whatsnew/3.14.rst:3039 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:17 +#: ../../whatsnew/3.14.rst:3002 msgid "" -":c:func:`!_PyUnicodeWriter_Finish`: replace " -"``_PyUnicodeWriter_Finish(&writer)`` " -"with :c:func:`PyUnicodeWriter_Finish(writer) `." +"Remove ``PyDictObject.ma_version_tag`` member, which was deprecated in " +"Python 3.12. Use the :c:func:`PyDict_AddWatcher` API instead. (Contributed " +"by Sam Gross in :gh:`124296`.)" msgstr "" -":c:func:`!_PyUnicodeWriter_Finish`:將 ``_PyUnicodeWriter_Finish(&writer)`` " -"替換為 :c:func:`PyUnicodeWriter_Finish(writer) `。" -#: ../../whatsnew/3.14.rst:3042 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:20 +#: ../../whatsnew/3.14.rst:3007 msgid "" -":c:func:`!_PyUnicodeWriter_Dealloc`: replace " -"``_PyUnicodeWriter_Dealloc(&writer)`` " -"with :c:func:`PyUnicodeWriter_Discard(writer) `." +"Remove the private ``_Py_InitializeMain()`` function. It was a :term:" +"`provisional API` added to Python 3.8 by :pep:`587`. (Contributed by Victor " +"Stinner in :gh:`129033`.)" msgstr "" -":c:func:`!_PyUnicodeWriter_Dealloc`:將 " -"``_PyUnicodeWriter_Dealloc(&writer)`` 替換" -"為 :c:func:`PyUnicodeWriter_Discard(writer) `。" -#: ../../whatsnew/3.14.rst:3045 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:23 +#: ../../whatsnew/3.14.rst:3011 msgid "" -":c:func:`!_PyUnicodeWriter_WriteChar`: replace " -"``_PyUnicodeWriter_WriteChar(&writer, ch)`` " -"with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " -"`." +"Remove the undocumented APIs :c:macro:`!Py_C_RECURSION_LIMIT` and :c:member:" +"`!PyThreadState.c_recursion_remaining`. These were added in 3.13 and have " +"been removed without deprecation. Use :c:func:`Py_EnterRecursiveCall` to " +"guard against runaway recursion in C code. (Removed by Petr Viktorin in :gh:" +"`133079`, see also :gh:`130396`.)" msgstr "" -":c:func:`!_PyUnicodeWriter_WriteChar`:將 " -"``_PyUnicodeWriter_WriteChar(&writer, ch)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " -"`。" -#: ../../whatsnew/3.14.rst:3048 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:26 +#: ../../whatsnew/3.14.rst:3022 +msgid "Deprecated C APIs" +msgstr "已棄用的 C API" + +#: ../../whatsnew/3.14.rst:3024 msgid "" -":c:func:`!_PyUnicodeWriter_WriteStr`: replace " -"``_PyUnicodeWriter_WriteStr(&writer, str)`` " -"with :c:func:`PyUnicodeWriter_WriteStr(writer, str) " -"`." +"The :c:macro:`!Py_HUGE_VAL` macro is now :term:`soft deprecated`. Use :c:" +"macro:`!Py_INFINITY` instead. (Contributed by Sergey B Kirpichev in :gh:" +"`120026`.)" msgstr "" -":c:func:`!_PyUnicodeWriter_WriteStr`:將 " -"``_PyUnicodeWriter_WriteStr(&writer, str)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteStr(writer, str) " -"`。" -#: ../../whatsnew/3.14.rst:3051 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:29 +#: ../../whatsnew/3.14.rst:3028 msgid "" -":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " -"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` " -"with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " -"`." +"The :c:macro:`!Py_IS_NAN`, :c:macro:`!Py_IS_INFINITY`, and :c:macro:`!" +"Py_IS_FINITE` macros are now :term:`soft deprecated`. Use :c:macro:`!" +"isnan`, :c:macro:`!isinf` and :c:macro:`!isfinite` instead, available from :" +"file:`math.h` since C99. (Contributed by Sergey B Kirpichev in :gh:`119613`.)" msgstr "" -":c:func:`!_PyUnicodeWriter_WriteSubstring`:將 " -"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " -"`。" -#: ../../whatsnew/3.14.rst:3054 +#: ../../whatsnew/3.14.rst:3034 msgid "" -":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " -"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` " -"with :c:func:`PyUnicodeWriter_WriteASCII(writer, str) " -"`." +"Non-tuple sequences are now deprecated as argument for the ``(items)`` " +"format unit in :c:func:`PyArg_ParseTuple` and other :ref:`argument parsing " +"` functions if *items* contains format units which store a :ref:" +"`borrowed buffer ` or a :term:`borrowed reference`. " +"(Contributed by Serhiy Storchaka in :gh:`50333`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3057 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:35 +#: ../../whatsnew/3.14.rst:3041 msgid "" -":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace " -"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` " -"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`." +"The ``_PyMonitoring_FireBranchEvent`` function is now deprecated and should " +"be replaced with calls to :c:func:`PyMonitoring_FireBranchLeftEvent` and :c:" +"func:`PyMonitoring_FireBranchRightEvent`." msgstr "" -":c:func:`!_PyUnicodeWriter_WriteLatin1String`:將 " -"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`。" -#: ../../whatsnew/3.14.rst:3060 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 -msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." -msgstr ":c:func:`!_Py_HashPointer`:請改用 :c:func:`Py_HashPointer`。" - -#: ../../whatsnew/3.14.rst:3061 -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 -msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." -msgstr ":c:func:`!_Py_fopen_obj`:請改用 :c:func:`Py_fopen`。" - -#: ../../whatsnew/3.14.rst:3063 +#: ../../whatsnew/3.14.rst:3046 msgid "" -"The `pythoncapi-compat project`_ can be used to get these new public " -"functions on Python 3.13 and older. (Contributed by Victor Stinner " -"in :gh:`128863`.)" +"The previously undocumented function :c:func:`PySequence_In` is now :term:" +"`soft deprecated`. Use :c:func:`PySequence_Contains` instead. (Contributed " +"by Yuki Kobayashi in :gh:`127896`.)" msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: " -"Use :c:func:`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改" -"用 :c:func:`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" +"`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " -"Use :c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project " -"`__ can be used to " -"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project `__ can be used to get :c:func:" +"`PyWeakref_GetRef` on Python 3.12 and older." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" -"用 :c:func:`PyWeakref_GetRef`。可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.12 和更早版本取" -"得 :c:func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。可以使用 `pythoncapi-compat 專案 `__\\ 來為 Python 3.12 和更早版本取得 :c:func:" +"`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " -"Use :c:type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" -"用 :c:type:`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 msgid "" @@ -5649,8 +5534,8 @@ msgid "" "than :class:`str`, such as :class:`bytes`." msgstr "" ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`;請注" -"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`str` 的型別,例" -"如 :class:`bytes`。" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`str` 的型別,例如 :" +"class:`bytes`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid "" @@ -5665,8 +5550,8 @@ msgid "" "than :class:`bytes`, such as :class:`str`." msgstr "" ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`;請注" -"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`bytes` 的型別,例" -"如 :class:`str`。" +"意某些編解碼器(例如 \"base64\")可能會回傳非 :class:`bytes` 的型別,例如 :" +"class:`str`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 msgid "Python initialization functions, deprecated in Python 3.13:" @@ -5683,37 +5568,35 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:27 msgid "" ":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") " -"` (:data:`sys.base_prefix`) instead. " -"Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) " -"if :ref:`virtual environments ` need to be handled." +"` (:data:`sys.base_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) if :ref:" +"`virtual environments ` need to be handled." msgstr "" ":c:func:`Py_GetPrefix`:請改用 :c:func:`PyConfig_Get(\"base_prefix\") " "` (:data:`sys.base_prefix`)。如果需要處理\\ :ref:`虛擬環境 " -"`,請改用 :c:func:`PyConfig_Get(\"prefix\") ` " -"(:data:`sys.prefix`)。" +"`,請改用 :c:func:`PyConfig_Get(\"prefix\") ` (:data:" +"`sys.prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:32 msgid "" ":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") " -"` (:data:`sys.base_exec_prefix`) instead. " -"Use :c:func:`PyConfig_Get(\"exec_prefix\") ` " -"(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " -"be handled." +"` (:data:`sys.base_exec_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"exec_prefix\") ` (:data:`sys.exec_prefix`) if :" +"ref:`virtual environments ` need to be handled." msgstr "" -":c:func:`Py_GetExecPrefix`:請改" -"用 :c:func:`PyConfig_Get(\"base_exec_prefix\") ` " -"(:data:`sys.base_exec_prefix`)。如果需要處理\\ :ref:`虛擬環境 `,請" -"改用 :c:func:`PyConfig_Get(\"exec_prefix\") ` " -"(:data:`sys.exec_prefix`)。" +":c:func:`Py_GetExecPrefix`:請改用 :c:func:" +"`PyConfig_Get(\"base_exec_prefix\") ` (:data:`sys." +"base_exec_prefix`)。如果需要處理\\ :ref:`虛擬環境 `,請改用 :c:" +"func:`PyConfig_Get(\"exec_prefix\") ` (:data:`sys." +"exec_prefix`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:38 msgid "" ":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " "` (:data:`sys.executable`) instead." msgstr "" -":c:func:`Py_GetProgramFullPath`:請改" -"用 :c:func:`PyConfig_Get(\"executable\") ` " -"(:data:`sys.executable`)。" +":c:func:`Py_GetProgramFullPath`:請改用 :c:func:" +"`PyConfig_Get(\"executable\") ` (:data:`sys.executable`)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:41 msgid "" @@ -5768,13 +5651,13 @@ msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " -"和 :data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" +"data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:65 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." msgstr "" "應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API。" @@ -5784,108 +5667,108 @@ msgstr "全域配置變數:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:70 msgid "" -":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` " -"or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." +":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` or :c:func:" +"`PyConfig_Get(\"parser_debug\") ` instead." msgstr "" -":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug` " -"或 :c:func:`PyConfig_Get(\"parser_debug\") `。" +":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug` 或 :c:func:" +"`PyConfig_Get(\"parser_debug\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:73 msgid "" -":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` " -"or :c:func:`PyConfig_Get(\"verbose\") ` instead." +":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` or :c:func:" +"`PyConfig_Get(\"verbose\") ` instead." msgstr "" -":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose` " -"或 :c:func:`PyConfig_Get(\"verbose\") `。" +":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose` 或 :c:func:" +"`PyConfig_Get(\"verbose\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:76 msgid "" -":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` " -"or :c:func:`PyConfig_Get(\"quiet\") ` instead." +":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` or :c:func:" +"`PyConfig_Get(\"quiet\") ` instead." msgstr "" -":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet` " -"或 :c:func:`PyConfig_Get(\"quiet\") `。" +":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet` 或 :c:func:" +"`PyConfig_Get(\"quiet\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:79 msgid "" -":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` " -"or :c:func:`PyConfig_Get(\"interactive\") ` instead." +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` or :c:func:" +"`PyConfig_Get(\"interactive\") ` instead." msgstr "" -":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive` " -"或 :c:func:`PyConfig_Get(\"interactive\") `。" +":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive` 或 :c:" +"func:`PyConfig_Get(\"interactive\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:82 msgid "" -":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` " -"or :c:func:`PyConfig_Get(\"inspect\") ` instead." +":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` or :c:func:" +"`PyConfig_Get(\"inspect\") ` instead." msgstr "" -":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect` " -"或 :c:func:`PyConfig_Get(\"inspect\") `。" +":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect` 或 :c:func:" +"`PyConfig_Get(\"inspect\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:85 msgid "" -":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " -"or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` or :c:" +"func:`PyConfig_Get(\"optimization_level\") ` instead." msgstr "" -":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level` " -"或 :c:func:`PyConfig_Get(\"optimization_level\") `。" +":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level` 或 :" +"c:func:`PyConfig_Get(\"optimization_level\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:88 msgid "" -":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` " -"or :c:func:`PyConfig_Get(\"site_import\") ` instead." +":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` or :c:func:" +"`PyConfig_Get(\"site_import\") ` instead." msgstr "" -":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import` " -"或 :c:func:`PyConfig_Get(\"site_import\") `。" +":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import` 或 :c:func:" +"`PyConfig_Get(\"site_import\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:91 msgid "" -":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " -"or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` or :c:" +"func:`PyConfig_Get(\"bytes_warning\") ` instead." msgstr "" -":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning` " -"或 :c:func:`PyConfig_Get(\"bytes_warning\") `。" +":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning` 或 :" +"c:func:`PyConfig_Get(\"bytes_warning\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:94 msgid "" -":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " -"or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` or :c:" +"func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" -":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings` " -"或 :c:func:`PyConfig_Get(\"pathconfig_warnings\") `。" +":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings` 或 :" +"c:func:`PyConfig_Get(\"pathconfig_warnings\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:97 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "or :c:func:`PyConfig_Get(\"use_environment\") ` instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment` " -"或 :c:func:`PyConfig_Get(\"use_environment\") `。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." +"use_environment` 或 :c:func:`PyConfig_Get(\"use_environment\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:100 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改" -"用 :c:member:`PyConfig.write_bytecode` " -"或 :c:func:`PyConfig_Get(\"write_bytecode\") `。" +":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." +"write_bytecode` 或 :c:func:`PyConfig_Get(\"write_bytecode\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:103 msgid "" -":c:var:`Py_NoUserSiteDirectory`: " -"Use :c:member:`PyConfig.user_site_directory` " -"or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` or :c:func:`PyConfig_Get(\"user_site_directory\") " +"` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory` " -"或 :c:func:`PyConfig_Get(\"user_site_directory\") `。" +":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." +"user_site_directory` 或 :c:func:`PyConfig_Get(\"user_site_directory\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:106 msgid "" -":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " -"or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` or :" +"c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." msgstr "" ":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio` " "或 :c:func:`PyConfig_Get(\"buffered_stdio\") `。" @@ -5902,70 +5785,69 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:113 msgid "" -":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` " -"or :c:func:`PyConfig_Get(\"isolated\") ` instead." +":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` or :c:func:" +"`PyConfig_Get(\"isolated\") ` instead." msgstr "" -":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated` " -"或 :c:func:`PyConfig_Get(\"isolated\") `。" +":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated` 或 :c:func:" +"`PyConfig_Get(\"isolated\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:116 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` " -"or :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") ` " -"instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` or :c:func:" +"`PyConfig_Get(\"legacy_windows_fs_encoding\") ` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding` " -"或 :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") `。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` 或 :c:func:" +"`PyConfig_Get(\"legacy_windows_fs_encoding\") `。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:119 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"Use :c:member:`PyConfig.legacy_windows_stdio` " -"or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") " +"` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio` " -"或 :c:func:`PyConfig_Get(\"legacy_windows_stdio\") `。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." +"legacy_windows_stdio` 或 :c:func:`PyConfig_Get(\"legacy_windows_stdio\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:122 msgid "" ":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" -"Py_HasFileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` " -"or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." +"Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` or :c:func:`PyConfig_Get(\"filesystem_encoding\") " +"` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`、:c:var:`!" -"Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding` " -"或 :c:func:`PyConfig_Get(\"filesystem_encoding\") `。" +"Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding` 或 :c:func:`PyConfig_Get(\"filesystem_encoding\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:125 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"Use :c:member:`PyConfig.filesystem_errors` " -"or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` or :c:func:`PyConfig_Get(\"filesystem_errors\") " +"` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors` " -"或 :c:func:`PyConfig_Get(\"filesystem_errors\") `。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." +"filesystem_errors` 或 :c:func:`PyConfig_Get(\"filesystem_errors\") " +"`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:128 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` " -"or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` or :c:func:" +"`PyConfig_Get(\"utf8_mode\") ` instead. (see :c:func:" +"`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode` " -"或 :c:func:`PyConfig_Get(\"utf8_mode\") `。(請參" -"閱 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode` 或 :c:func:" +"`PyConfig_Get(\"utf8_mode\") `。(請參閱 :c:func:" +"`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:133 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can " -"be used to get these options at runtime." +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can be used to " +"get these options at runtime." msgstr "" "應改用帶有 :c:type:`PyConfig` 的 :c:func:`Py_InitializeFromConfig` API 來設定" "這些選項。或者也可以使用 :c:func:`PyConfig_Get` 在執行時取得這些選項。" @@ -5979,40 +5861,155 @@ msgid "Pending removal in Python 3.18" msgstr "Python 3.18 中待移除的項目" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:4 -msgid "Deprecated private functions (:gh:`128863`):" -msgstr "被棄用的私有函式 (:gh:`128863`):" +msgid "" +"The following private functions are deprecated and planned for removal in " +"Python 3.18:" +msgstr "以下私有函式已被棄用,並計劃在 Python 3.18 中移除:" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 +msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." +msgstr ":c:func:`!_PyBytes_Join`:請改用 :c:func:`PyBytes_Join`。" #: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 -msgid ":c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`." +msgid "" +":c:func:`!_PyDict_GetItemStringWithError`: use :c:func:" +"`PyDict_GetItemStringRef`." +msgstr "" +":c:func:`!_PyDict_GetItemStringWithError`:請改用 :c:func:" +"`PyDict_GetItemStringRef`。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 +msgid ":c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`." msgstr ":c:func:`!_PyDict_Pop()`:請改用 :c:func:`PyDict_Pop`。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:32 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 +msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." +msgstr ":c:func:`!_PyLong_Sign()`:請改用 :c:func:`PyLong_GetSign`。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:11 +msgid "" +":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: use :c:func:" +"`PyLongWriter_Create`." +msgstr "" +":c:func:`!_PyLong_FromDigits` 和 :c:func:`!_PyLong_New`:請改用 :c:func:" +"`PyLongWriter_Create`。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 +msgid "" +":c:func:`!_PyThreadState_UncheckedGet`: use :c:func:" +"`PyThreadState_GetUnchecked`." +msgstr "" +":c:func:`!_PyThreadState_UncheckedGet`:請改用 :c:func:" +"`PyThreadState_GetUnchecked`。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 +msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." +msgstr ":c:func:`!_PyUnicode_AsString`:請改用 :c:func:`PyUnicode_AsUTF8`。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:15 +msgid "" +":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " +"with :c:func:`writer = PyUnicodeWriter_Create(0) `." +msgstr "" +":c:func:`!_PyUnicodeWriter_Init`:將 ``_PyUnicodeWriter_Init(&writer)`` 替換" +"為 :c:func:`writer = PyUnicodeWriter_Create(0) `。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:18 +msgid "" +":c:func:`!_PyUnicodeWriter_Finish`: replace " +"``_PyUnicodeWriter_Finish(&writer)`` with :c:func:" +"`PyUnicodeWriter_Finish(writer) `." +msgstr "" +":c:func:`!_PyUnicodeWriter_Finish`:將 ``_PyUnicodeWriter_Finish(&writer)`` " +"替換為 :c:func:`PyUnicodeWriter_Finish(writer) `。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:21 +msgid "" +":c:func:`!_PyUnicodeWriter_Dealloc`: replace " +"``_PyUnicodeWriter_Dealloc(&writer)`` with :c:func:" +"`PyUnicodeWriter_Discard(writer) `." +msgstr "" +":c:func:`!_PyUnicodeWriter_Dealloc`:將 " +"``_PyUnicodeWriter_Dealloc(&writer)`` 替換為 :c:func:" +"`PyUnicodeWriter_Discard(writer) `。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:24 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteChar`: replace " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` with :c:func:" +"`PyUnicodeWriter_WriteChar(writer, ch) `." +msgstr "" +":c:func:`!_PyUnicodeWriter_WriteChar`:將 " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteChar(writer, ch) `。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:27 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteStr`: replace " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteStr(writer, str) `." +msgstr "" +":c:func:`!_PyUnicodeWriter_WriteStr`:將 " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteStr(writer, str) `。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:30 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` with :c:func:" +"`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`." +msgstr "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`:將 " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:33 msgid "" ":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " -"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` " -"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`." +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteASCII(writer, str) `." msgstr "" ":c:func:`!_PyUnicodeWriter_WriteASCIIString`:將 " -"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` 替換" -"為 :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " -"`。" +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteASCII(writer, str) `。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:36 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteUTF8(writer, str) `." +msgstr "" +":c:func:`!_PyUnicodeWriter_WriteLatin1String`:將 " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` 替換為 :c:func:" +"`PyUnicodeWriter_WriteUTF8(writer, str) `。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:38 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." msgstr ":c:func:`!_PyUnicodeWriter_Prepare`:(無替代方案)。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." msgstr ":c:func:`!_PyUnicodeWriter_PrepareKind`:(無替代方案)。" -#: ../../deprecations/c-api-pending-removal-in-3.18.rst:43 +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 +msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." +msgstr ":c:func:`!_Py_HashPointer`:請改用 :c:func:`Py_HashPointer`。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:42 +msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." +msgstr ":c:func:`!_Py_fopen_obj`:請改用 :c:func:`Py_fopen`。" + +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:44 msgid "" "The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older." +">`__ can be used to get these new public functions on Python 3.13 and older. " +"(Contributed by Victor Stinner in :gh:`128863`.)" msgstr "" "可以使用 `pythoncapi-compat project `__ 來取得這些於 Python 3.13 及更早版本的新公開函式。" +"compat/>`__ 來取得這些於 Python 3.13 及更早版本的新公開函式。(由 " +"Victor Stinner 在 :gh:`128863` 貢獻)" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -6033,8 +6030,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改" -"用 :c:func:`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改用 :c:func:" +"`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -6054,11 +6051,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " -"and :c:func:`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " -"和 :c:func:`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" +"`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" @@ -6080,8 +6077,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" -"叫 :c:func:`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" +"`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:29 msgid "Thread Local Storage (TLS) API:" @@ -6117,60 +6114,31 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.14.rst:3081 -msgid "" -"Creating :c:data:`immutable types ` with mutable " -"bases was deprecated since 3.12 and now raises a :exc:`TypeError`." -msgstr "" - -#: ../../whatsnew/3.14.rst:3084 -msgid "" -"Remove ``PyDictObject.ma_version_tag`` member which was deprecated since " -"Python 3.12. Use the :c:func:`PyDict_AddWatcher` API instead. (Contributed " -"by Sam Gross in :gh:`124296`.)" -msgstr "" - -#: ../../whatsnew/3.14.rst:3088 -msgid "" -"Remove the private ``_Py_InitializeMain()`` function. It was " -"a :term:`provisional API` added to Python 3.8 by :pep:`587`. (Contributed by " -"Victor Stinner in :gh:`129033`.)" -msgstr "" - -#: ../../whatsnew/3.14.rst:3092 -msgid "" -"The undocumented APIs :c:macro:`!Py_C_RECURSION_LIMIT` and :c:member:`!" -"PyThreadState.c_recursion_remaining`, added in 3.13, are removed without a " -"deprecation period. Please use :c:func:`Py_EnterRecursiveCall` to guard " -"against runaway recursion in C code. (Removed in :gh:`133079`, see " -"also :gh:`130396`.)" -msgstr "" - -#: ../../whatsnew/3.14.rst:3101 +#: ../../whatsnew/3.14.rst:3063 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.14.rst:3103 +#: ../../whatsnew/3.14.rst:3065 msgid "" "GNU Autoconf 2.72 is now required to generate :file:`configure`. " "(Contributed by Erlend Aasland in :gh:`115765`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3106 +#: ../../whatsnew/3.14.rst:3068 msgid "" "``wasm32-unknown-emscripten`` is now a :pep:`11` tier 3 platform. " -"(Contributed by R. Hood Chatham in :gh:`127146`, :gh:`127683`, " -"and :gh:`136931`.)" +"(Contributed by R. Hood Chatham in :gh:`127146`, :gh:`127683`, and :gh:" +"`136931`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3109 +#: ../../whatsnew/3.14.rst:3071 msgid "" "``#pragma``-based linking with ``python3*.lib`` can now be switched off " "with :c:expr:`Py_NO_LINK_LIB`. (Contributed by Jean-Christophe Fillion-Robin " "in :gh:`82909`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3113 +#: ../../whatsnew/3.14.rst:3075 msgid "" "CPython now enables a set of recommended compiler options by default for " "improved security. Use the :option:`--disable-safety` :file:`configure` " @@ -6178,31 +6146,31 @@ msgid "" "larger set of compiler options, albeit with a performance cost." msgstr "" -#: ../../whatsnew/3.14.rst:3119 +#: ../../whatsnew/3.14.rst:3081 msgid "" "The ``WITH_FREELISTS`` macro and ``--without-freelists`` :file:`configure` " "option have been removed." msgstr "" -#: ../../whatsnew/3.14.rst:3122 +#: ../../whatsnew/3.14.rst:3084 msgid "" "The new :file:`configure` option :option:`--with-tail-call-interp` may be " "used to enable the experimental tail call interpreter. See :ref:`whatsnew314-" "tail-call` for further details." msgstr "" -#: ../../whatsnew/3.14.rst:3126 +#: ../../whatsnew/3.14.rst:3088 msgid "" "To disable the new remote debugging support, use the :option:`--without-" "remote-debug` :file:`configure` option. This may be useful for security " "reasons." msgstr "" -#: ../../whatsnew/3.14.rst:3133 +#: ../../whatsnew/3.14.rst:3095 msgid ":file:`build-details.json`" msgstr "" -#: ../../whatsnew/3.14.rst:3135 +#: ../../whatsnew/3.14.rst:3097 msgid "" "Installations of Python now contain a new file, :file:`build-details.json`. " "This is a static JSON document containing build details for CPython, to " @@ -6210,7 +6178,7 @@ msgid "" "cases such as Python launchers, cross-compilation, and so on." msgstr "" -#: ../../whatsnew/3.14.rst:3141 +#: ../../whatsnew/3.14.rst:3103 msgid "" ":file:`build-details.json` must be installed in the platform-independent " "standard library directory. This corresponds to the :ref:`'stdlib' " @@ -6218,17 +6186,17 @@ msgid "" "by running ``sysconfig.get_path('stdlib')``." msgstr "" -#: ../../whatsnew/3.14.rst:3147 +#: ../../whatsnew/3.14.rst:3109 msgid "" ":pep:`739` -- ``build-details.json`` 1.0 -- a static description file for " "Python build details" msgstr "" -#: ../../whatsnew/3.14.rst:3153 +#: ../../whatsnew/3.14.rst:3115 msgid "Discontinuation of PGP signatures" msgstr "" -#: ../../whatsnew/3.14.rst:3155 +#: ../../whatsnew/3.14.rst:3117 msgid "" "PGP (Pretty Good Privacy) signatures will not be provided for releases of " "Python 3.14 or future versions. To verify CPython artifacts, users must use " @@ -6236,178 +6204,191 @@ msgid "" "sigstore/>`__. Releases have been signed using Sigstore_ since Python 3.11." msgstr "" -#: ../../whatsnew/3.14.rst:3161 +#: ../../whatsnew/3.14.rst:3123 msgid "This change in release process was specified in :pep:`761`." msgstr "" -#: ../../whatsnew/3.14.rst:3167 +#: ../../whatsnew/3.14.rst:3129 msgid "Porting to Python 3.14" msgstr "移植至 Python 3.14" -#: ../../whatsnew/3.14.rst:3169 +#: ../../whatsnew/3.14.rst:3131 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "本節列出了前面描述的更改以及可能需要更改程式碼的其他錯誤修復。" -#: ../../whatsnew/3.14.rst:3174 +#: ../../whatsnew/3.14.rst:3136 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.14.rst:3176 +#: ../../whatsnew/3.14.rst:3138 msgid "" -":class:`functools.partial` is now a method descriptor. Wrap it " -"in :func:`staticmethod` if you want to preserve the old behavior. " -"(Contributed by Serhiy Storchaka and Dominykas Grigonis in :gh:`121027`.)" +":class:`functools.partial` is now a method descriptor. Wrap it in :func:" +"`staticmethod` if you want to preserve the old behavior. (Contributed by " +"Serhiy Storchaka and Dominykas Grigonis in :gh:`121027`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3180 +#: ../../whatsnew/3.14.rst:3142 msgid "" "The :ref:`garbage collector is now incremental `, which means that the behavior of :func:`gc.collect` changes slightly:" msgstr "" -#: ../../whatsnew/3.14.rst:3187 +#: ../../whatsnew/3.14.rst:3149 msgid "" "The :func:`locale.nl_langinfo` function now temporarily sets the " "``LC_CTYPE`` locale in some cases. This temporary change affects other " "threads. (Contributed by Serhiy Storchaka in :gh:`69998`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3192 +#: ../../whatsnew/3.14.rst:3154 msgid "" ":class:`types.UnionType` is now an alias for :class:`typing.Union`, causing " "changes in some behaviors. See :ref:`above ` for " "more details. (Contributed by Jelle Zijlstra in :gh:`105499`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3197 +#: ../../whatsnew/3.14.rst:3159 msgid "" -"The runtime behavior of annotations has changed in various ways; " -"see :ref:`above ` for details. While most code that " -"interacts with annotations should continue to work, some undocumented " -"details may behave differently." +"The runtime behavior of annotations has changed in various ways; see :ref:" +"`above ` for details. While most code that interacts " +"with annotations should continue to work, some undocumented details may " +"behave differently." msgstr "" -#: ../../whatsnew/3.14.rst:3204 +#: ../../whatsnew/3.14.rst:3166 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.14.rst:3206 +#: ../../whatsnew/3.14.rst:3168 msgid "" ":c:func:`Py_Finalize` now deletes all interned strings. This is backwards " "incompatible to any C extension that holds onto an interned string after a " -"call to :c:func:`Py_Finalize` and is then reused after a call " -"to :c:func:`Py_Initialize`. Any issues arising from this behavior will " -"normally result in crashes during the execution of the subsequent call " -"to :c:func:`Py_Initialize` from accessing uninitialized memory. To fix, use " -"an address sanitizer to identify any use-after-free coming from an interned " -"string and deallocate it during module shutdown. (Contributed by Eddie " -"Elizondo in :gh:`113601`.)" +"call to :c:func:`Py_Finalize` and is then reused after a call to :c:func:" +"`Py_Initialize`. Any issues arising from this behavior will normally result " +"in crashes during the execution of the subsequent call to :c:func:" +"`Py_Initialize` from accessing uninitialized memory. To fix, use an address " +"sanitizer to identify any use-after-free coming from an interned string and " +"deallocate it during module shutdown. (Contributed by Eddie Elizondo in :gh:" +"`113601`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3216 +#: ../../whatsnew/3.14.rst:3178 msgid "" -"The :ref:`Unicode Exception Objects ` C API now raises " -"a :exc:`TypeError` if its exception argument is not a :exc:`UnicodeError` " +"The :ref:`Unicode Exception Objects ` C API now raises a :" +"exc:`TypeError` if its exception argument is not a :exc:`UnicodeError` " "object. (Contributed by Bénédikt Tran in :gh:`127691`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3223 +#: ../../whatsnew/3.14.rst:3185 msgid "" "The interpreter internally avoids some reference count modifications when " "loading objects onto the operands stack by :term:`borrowing ` references when possible. This can lead to smaller reference " "count values compared to previous Python versions. C API extensions that " "checked :c:func:`Py_REFCNT` of ``1`` to determine if an function argument is " -"not referenced by any other code should instead " -"use :c:func:`PyUnstable_Object_IsUniqueReferencedTemporary` as a safer " -"replacement." +"not referenced by any other code should instead use :c:func:" +"`PyUnstable_Object_IsUniqueReferencedTemporary` as a safer replacement." msgstr "" -#: ../../whatsnew/3.14.rst:3232 +#: ../../whatsnew/3.14.rst:3194 msgid "Private functions promoted to public C APIs:" msgstr "" -#: ../../whatsnew/3.14.rst:3234 +#: ../../whatsnew/3.14.rst:3196 msgid "``_PyBytes_Join()``: :c:func:`PyBytes_Join`" msgstr "" -#: ../../whatsnew/3.14.rst:3235 +#: ../../whatsnew/3.14.rst:3197 msgid "``_PyLong_IsNegative()``: :c:func:`PyLong_IsNegative`" msgstr "" -#: ../../whatsnew/3.14.rst:3236 +#: ../../whatsnew/3.14.rst:3198 msgid "``_PyLong_IsPositive()``: :c:func:`PyLong_IsPositive`" msgstr "" -#: ../../whatsnew/3.14.rst:3237 +#: ../../whatsnew/3.14.rst:3199 msgid "``_PyLong_IsZero()``: :c:func:`PyLong_IsZero`" msgstr "" -#: ../../whatsnew/3.14.rst:3238 +#: ../../whatsnew/3.14.rst:3200 msgid "``_PyLong_Sign()``: :c:func:`PyLong_GetSign`" msgstr "" -#: ../../whatsnew/3.14.rst:3239 +#: ../../whatsnew/3.14.rst:3201 msgid "``_PyUnicodeWriter_Dealloc()``: :c:func:`PyUnicodeWriter_Discard`" msgstr "" -#: ../../whatsnew/3.14.rst:3240 +#: ../../whatsnew/3.14.rst:3202 msgid "``_PyUnicodeWriter_Finish()``: :c:func:`PyUnicodeWriter_Finish`" msgstr "" -#: ../../whatsnew/3.14.rst:3241 +#: ../../whatsnew/3.14.rst:3203 msgid "``_PyUnicodeWriter_Init()``: use :c:func:`PyUnicodeWriter_Create`" msgstr "" -#: ../../whatsnew/3.14.rst:3242 +#: ../../whatsnew/3.14.rst:3204 msgid "``_PyUnicodeWriter_Prepare()``: (no replacement)" msgstr "" -#: ../../whatsnew/3.14.rst:3243 +#: ../../whatsnew/3.14.rst:3205 msgid "``_PyUnicodeWriter_PrepareKind()``: (no replacement)" msgstr "" -#: ../../whatsnew/3.14.rst:3244 +#: ../../whatsnew/3.14.rst:3206 msgid "``_PyUnicodeWriter_WriteChar()``: :c:func:`PyUnicodeWriter_WriteChar`" msgstr "" -#: ../../whatsnew/3.14.rst:3245 +#: ../../whatsnew/3.14.rst:3207 msgid "``_PyUnicodeWriter_WriteStr()``: :c:func:`PyUnicodeWriter_WriteStr`" msgstr "" -#: ../../whatsnew/3.14.rst:3246 -msgid "``_PyUnicodeWriter_WriteSubstring()``: :c:func:`PyUnicodeWriter_WriteSubstring`" +#: ../../whatsnew/3.14.rst:3208 +msgid "" +"``_PyUnicodeWriter_WriteSubstring()``: :c:func:" +"`PyUnicodeWriter_WriteSubstring`" msgstr "" -#: ../../whatsnew/3.14.rst:3247 +#: ../../whatsnew/3.14.rst:3209 msgid "``_PyUnicode_EQ()``: :c:func:`PyUnicode_Equal`" msgstr "" -#: ../../whatsnew/3.14.rst:3248 +#: ../../whatsnew/3.14.rst:3210 msgid "``_PyUnicode_Equal()``: :c:func:`PyUnicode_Equal`" msgstr "" -#: ../../whatsnew/3.14.rst:3249 +#: ../../whatsnew/3.14.rst:3211 msgid "" "``_Py_GetConfig()``: :c:func:`PyConfig_Get` and :c:func:`PyConfig_GetInt`" msgstr "" -#: ../../whatsnew/3.14.rst:3250 +#: ../../whatsnew/3.14.rst:3212 msgid "``_Py_HashBytes()``: :c:func:`Py_HashBuffer`" msgstr "" -#: ../../whatsnew/3.14.rst:3251 +#: ../../whatsnew/3.14.rst:3213 msgid "``_Py_fopen_obj()``: :c:func:`Py_fopen`" msgstr "" -#: ../../whatsnew/3.14.rst:3252 +#: ../../whatsnew/3.14.rst:3214 msgid "``PyMutex_IsLocked()`` : :c:func:`PyMutex_IsLocked`" msgstr "" -#: ../../whatsnew/3.14.rst:3254 +#: ../../whatsnew/3.14.rst:3216 msgid "" "The `pythoncapi-compat project`_ can be used to get most of these new " "functions on Python 3.13 and older." msgstr "" + +#~ msgid ":c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`." +#~ msgstr ":c:func:`!_PyDict_Pop()`:請改用 :c:func:`PyDict_Pop`。" + +#~ msgid "" +#~ ":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " +#~ "``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with :c:func:" +#~ "`PyUnicodeWriter_WriteUTF8(writer, str) `." +#~ msgstr "" +#~ ":c:func:`!_PyUnicodeWriter_WriteASCIIString`:將 " +#~ "``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` 替換為 :c:func:" +#~ "`PyUnicodeWriter_WriteUTF8(writer, str) `。" diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 84004b38cdb..684096e6896 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-10 20:44+0800\n" +"POT-Creation-Date: 2025-09-18 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -126,10 +126,10 @@ msgstr "CPython 實作改進:" #: ../../whatsnew/3.5.rst:96 msgid "" -"When the ``LC_TYPE`` locale is the POSIX locale (``C`` " -"locale), :py:data:`sys.stdin` and :py:data:`sys.stdout` now use the " -"``surrogateescape`` error handler, instead of the ``strict`` error handler. " -"(Contributed by Victor Stinner in :issue:`19977`.)" +"When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), :py:data:" +"`sys.stdin` and :py:data:`sys.stdout` now use the ``surrogateescape`` error " +"handler, instead of the ``strict`` error handler. (Contributed by Victor " +"Stinner in :issue:`19977`.)" msgstr "" #: ../../whatsnew/3.5.rst:101 @@ -193,9 +193,8 @@ msgstr "安全性改進:" #: ../../whatsnew/3.5.rst:138 msgid "" "SSLv3 is now disabled throughout the standard library. It can still be " -"enabled by instantiating a :class:`ssl.SSLContext` manually. " -"(See :issue:`22638` for more details; this change was backported to CPython " -"3.4 and 2.7.)" +"enabled by instantiating a :class:`ssl.SSLContext` manually. (See :issue:" +"`22638` for more details; this change was backported to CPython 3.4 and 2.7.)" msgstr "" #: ../../whatsnew/3.5.rst:143 @@ -400,10 +399,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:253 msgid "" -"Starting with CPython 3.5.2, ``__aiter__`` can directly " -"return :term:`asynchronous iterators `. Returning " -"an :term:`awaitable` object will result in " -"a :exc:`PendingDeprecationWarning`." +"Starting with CPython 3.5.2, ``__aiter__`` can directly return :term:" +"`asynchronous iterators `. Returning an :term:" +"`awaitable` object will result in a :exc:`PendingDeprecationWarning`." msgstr "" #: ../../whatsnew/3.5.rst:259 @@ -426,11 +424,10 @@ msgstr "" msgid "" ":pep:`465` adds the ``@`` infix operator for matrix multiplication. " "Currently, no builtin Python types implement the new operator, however, it " -"can be implemented by " -"defining :meth:`~object.__matmul__`, :meth:`~object.__rmatmul__`, " -"and :meth:`~object.__imatmul__` for regular, reflected, and in-place matrix " -"multiplication. The semantics of these methods is similar to that of methods " -"defining other infix arithmetic operators." +"can be implemented by defining :meth:`~object.__matmul__`, :meth:`~object." +"__rmatmul__`, and :meth:`~object.__imatmul__` for regular, reflected, and in-" +"place matrix multiplication. The semantics of these methods is similar to " +"that of methods defining other infix arithmetic operators." msgstr "" #: ../../whatsnew/3.5.rst:282 @@ -661,8 +658,8 @@ msgstr "PEP 484 - 型別提示" #: ../../whatsnew/3.5.rst:408 msgid "" -"Function annotation syntax has been a Python feature since version 3.0 " -"(:pep:`3107`), however the semantics of annotations has been left undefined." +"Function annotation syntax has been a Python feature since version 3.0 (:pep:" +"`3107`), however the semantics of annotations has been left undefined." msgstr "" #: ../../whatsnew/3.5.rst:411 @@ -696,18 +693,18 @@ msgstr "" #: ../../whatsnew/3.5.rst:426 msgid "" -"While these annotations are available at runtime through the " -"usual :attr:`~object.__annotations__` attribute, *no automatic type checking " -"happens at runtime*. Instead, it is assumed that a separate off-line type " -"checker (e.g. `mypy `_) will be used for on-demand " -"source code analysis." +"While these annotations are available at runtime through the usual :attr:" +"`~object.__annotations__` attribute, *no automatic type checking happens at " +"runtime*. Instead, it is assumed that a separate off-line type checker (e." +"g. `mypy `_) will be used for on-demand source code " +"analysis." msgstr "" #: ../../whatsnew/3.5.rst:432 msgid "" -"The type system supports unions, generic types, and a special type " -"named :class:`~typing.Any` which is consistent with (i.e. assignable to and " -"from) all types." +"The type system supports unions, generic types, and a special type named :" +"class:`~typing.Any` which is consistent with (i.e. assignable to and from) " +"all types." msgstr "" #: ../../whatsnew/3.5.rst:438 @@ -860,32 +857,37 @@ msgstr ":mod:`faulthandler` 模組的函式;" #: ../../whatsnew/3.5.rst:520 msgid "" -":mod:`os` " -"functions: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:`~os.fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os.fstatvfs`, :func:`~os.fsync`, :func:`~os.ftruncate`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os.open`, :func:`~os.posix_fadvise`, :func:`~os.posix_fallocate`, :func:`~os.pread`, :func:`~os.pwrite`, :func:`~os.read`, :func:`~os.readv`, :func:`~os.sendfile`, :func:`~os.wait3`, :func:`~os.wait4`, :func:`~os.wait`, :func:`~os.waitid`, :func:`~os.waitpid`, :func:`~os.write`, :func:`~os.writev`;" +":mod:`os` functions: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:`~os." +"fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os.fstatvfs`, :" +"func:`~os.fsync`, :func:`~os.ftruncate`, :func:`~os.mkfifo`, :func:`~os." +"mknod`, :func:`~os.open`, :func:`~os.posix_fadvise`, :func:`~os." +"posix_fallocate`, :func:`~os.pread`, :func:`~os.pwrite`, :func:`~os.read`, :" +"func:`~os.readv`, :func:`~os.sendfile`, :func:`~os.wait3`, :func:`~os." +"wait4`, :func:`~os.wait`, :func:`~os.waitid`, :func:`~os.waitpid`, :func:" +"`~os.write`, :func:`~os.writev`;" msgstr "" #: ../../whatsnew/3.5.rst:530 msgid "" -"special cases: :func:`os.close` and :func:`os.dup2` now " -"ignore :py:const:`~errno.EINTR` errors; the syscall is not retried (see the " -"PEP for the rationale);" +"special cases: :func:`os.close` and :func:`os.dup2` now ignore :py:const:" +"`~errno.EINTR` errors; the syscall is not retried (see the PEP for the " +"rationale);" msgstr "" #: ../../whatsnew/3.5.rst:534 msgid "" -":mod:`select` functions: :func:`devpoll.poll() " -"`, :func:`epoll.poll() " -"`, :func:`kqueue.control() " -"`, :func:`poll.poll() " -"`, :func:`~select.select`;" +":mod:`select` functions: :func:`devpoll.poll() `, :func:" +"`epoll.poll() `, :func:`kqueue.control() `, :func:`poll.poll() `, :func:`~select.select`;" msgstr "" #: ../../whatsnew/3.5.rst:539 msgid "" -"methods of the :class:`~socket.socket` " -"class: :meth:`~socket.socket.accept`, :meth:`~socket.socket.connect` (except " -"for non-blocking " -"sockets), :meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`, :meth:`~socket.socket.recvmsg`, :meth:`~socket.socket.send`, :meth:`~socket.socket.sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;" +"methods of the :class:`~socket.socket` class: :meth:`~socket.socket." +"accept`, :meth:`~socket.socket.connect` (except for non-blocking sockets), :" +"meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`, :meth:`~socket." +"socket.recvmsg`, :meth:`~socket.socket.send`, :meth:`~socket.socket." +"sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;" msgstr "" #: ../../whatsnew/3.5.rst:546 @@ -922,18 +924,18 @@ msgstr "" #: ../../whatsnew/3.5.rst:568 msgid "" ":pep:`479` changes the behavior of generators: when a ``StopIteration`` " -"exception is raised inside a generator, it is replaced with " -"a :exc:`RuntimeError` before it exits the generator frame. The main goal of " -"this change is to ease debugging in the situation where an " -"unguarded :func:`next` call raises ``StopIteration`` and causes the " -"iteration controlled by the generator to terminate silently. This is " -"particularly pernicious in combination with the ``yield from`` construct." +"exception is raised inside a generator, it is replaced with a :exc:" +"`RuntimeError` before it exits the generator frame. The main goal of this " +"change is to ease debugging in the situation where an unguarded :func:`next` " +"call raises ``StopIteration`` and causes the iteration controlled by the " +"generator to terminate silently. This is particularly pernicious in " +"combination with the ``yield from`` construct." msgstr "" #: ../../whatsnew/3.5.rst:576 msgid "" -"This is a backwards incompatible change, so to enable the new behavior, " -"a :term:`__future__` import is necessary::" +"This is a backwards incompatible change, so to enable the new behavior, a :" +"term:`__future__` import is necessary::" msgstr "" #: ../../whatsnew/3.5.rst:579 @@ -1080,15 +1082,15 @@ msgstr "" #: ../../whatsnew/3.5.rst:665 msgid "" -":pep:`488` does away with the concept of ``.pyo`` files. This means that " -"``.pyc`` files represent both unoptimized and optimized bytecode. To prevent " +":pep:`488` does away with the concept of ``.pyo`` files. This means that ``." +"pyc`` files represent both unoptimized and optimized bytecode. To prevent " "the need to constantly regenerate bytecode files, ``.pyc`` files now have an " "optional ``opt-`` tag in their name when the bytecode is optimized. This has " "the side-effect of no more bytecode file name clashes when running under " "either :option:`-O` or :option:`-OO`. Consequently, bytecode files generated " -"from :option:`-O`, and :option:`-OO` may now exist " -"simultaneously. :func:`importlib.util.cache_from_source` has an updated API " -"to help with this change." +"from :option:`-O`, and :option:`-OO` may now exist simultaneously. :func:" +"`importlib.util.cache_from_source` has an updated API to help with this " +"change." msgstr "" #: ../../whatsnew/3.5.rst:677 @@ -1144,22 +1146,22 @@ msgstr "" #: ../../whatsnew/3.5.rst:710 msgid "" -"The :option:`-b` option now affects comparisons of :class:`bytes` " -"with :class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`.)" +"The :option:`-b` option now affects comparisons of :class:`bytes` with :" +"class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`.)" msgstr "" #: ../../whatsnew/3.5.rst:713 msgid "" "New Kazakh ``kz1048`` and Tajik ``koi8_t`` :ref:`codecs `. (Contributed by Serhiy Storchaka in :issue:`22682` " -"and :issue:`22681`.)" +"encodings>`. (Contributed by Serhiy Storchaka in :issue:`22682` and :issue:" +"`22681`.)" msgstr "" #: ../../whatsnew/3.5.rst:716 msgid "" -"Property docstrings are now writable. This is especially useful " -"for :func:`collections.namedtuple` docstrings. (Contributed by Berker Peksag " -"in :issue:`24064`.)" +"Property docstrings are now writable. This is especially useful for :func:" +"`collections.namedtuple` docstrings. (Contributed by Berker Peksag in :issue:" +"`24064`.)" msgstr "" #: ../../whatsnew/3.5.rst:720 @@ -1212,8 +1214,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:753 msgid "" -"The module implementation has been contributed by Paul Moore " -"in :issue:`23491`." +"The module implementation has been contributed by Paul Moore in :issue:" +"`23491`." msgstr "模組實作由 Paul Moore 在 :issue:`23491` 貢獻。" #: ../../whatsnew/3.5.rst:758 @@ -1230,10 +1232,10 @@ msgstr "argparse" #: ../../whatsnew/3.5.rst:767 msgid "" -"The :class:`~argparse.ArgumentParser` class now allows " -"disabling :ref:`abbreviated usage ` of long options by " -"setting :ref:`allow_abbrev` to ``False``. (Contributed by Jonathan Paugh, " -"Steven Bethard, paul j3 and Daniel Eriksson in :issue:`14910`.)" +"The :class:`~argparse.ArgumentParser` class now allows disabling :ref:" +"`abbreviated usage ` of long options by setting :ref:" +"`allow_abbrev` to ``False``. (Contributed by Jonathan Paugh, Steven " +"Bethard, paul j3 and Daniel Eriksson in :issue:`14910`.)" msgstr "" #: ../../whatsnew/3.5.rst:774 @@ -1243,8 +1245,8 @@ msgstr "asyncio" #: ../../whatsnew/3.5.rst:776 msgid "" "Since the :mod:`asyncio` module is :term:`provisional `, " -"all changes introduced in Python 3.5 have also been backported to Python " -"3.4.x." +"all changes introduced in Python 3.5 have also been backported to Python 3.4." +"x." msgstr "" #: ../../whatsnew/3.5.rst:779 @@ -1253,9 +1255,9 @@ msgstr "Python 3.4.0 以來 :mod:`asyncio` 模組的顯著變更:" #: ../../whatsnew/3.5.rst:781 msgid "" -"New debugging APIs: :meth:`loop.set_debug() ` " -"and :meth:`loop.get_debug() ` methods. (Contributed " -"by Victor Stinner.)" +"New debugging APIs: :meth:`loop.set_debug() ` and :" +"meth:`loop.get_debug() ` methods. (Contributed by " +"Victor Stinner.)" msgstr "" #: ../../whatsnew/3.5.rst:785 @@ -1281,24 +1283,23 @@ msgstr "" #: ../../whatsnew/3.5.rst:799 msgid "" -"A new :meth:`transport.get_write_buffer_limits() " -"` method to inquire for " -"*high-* and *low-* water limits of the flow control. (Contributed by Victor " -"Stinner.)" +"A new :meth:`transport.get_write_buffer_limits() ` method to inquire for *high-* and *low-* water " +"limits of the flow control. (Contributed by Victor Stinner.)" msgstr "" #: ../../whatsnew/3.5.rst:804 msgid "" -"The :func:`!async` function is deprecated in favor " -"of :func:`~asyncio.ensure_future`. (Contributed by Yury Selivanov.)" +"The :func:`!async` function is deprecated in favor of :func:`~asyncio." +"ensure_future`. (Contributed by Yury Selivanov.)" msgstr "" #: ../../whatsnew/3.5.rst:808 msgid "" -"New :meth:`loop.set_task_factory() ` " -"and :meth:`loop.get_task_factory() ` methods " -"to customize the task factory that :meth:`loop.create_task() " -"` method uses. (Contributed by Yury Selivanov.)" +"New :meth:`loop.set_task_factory() ` and :" +"meth:`loop.get_task_factory() ` methods to " +"customize the task factory that :meth:`loop.create_task() ` method uses. (Contributed by Yury Selivanov.)" msgstr "" #: ../../whatsnew/3.5.rst:815 @@ -1309,8 +1310,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:819 msgid "" -"The ``JoinableQueue`` class was removed, in favor of " -"the :class:`asyncio.Queue` class. (Contributed by Victor Stinner.)" +"The ``JoinableQueue`` class was removed, in favor of the :class:`asyncio." +"Queue` class. (Contributed by Victor Stinner.)" msgstr "" #: ../../whatsnew/3.5.rst:823 @@ -1359,9 +1360,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:851 msgid "" -"New :meth:`loop.get_exception_handler() " -"` method to get the current exception " -"handler. (Contributed by Yury Selivanov.)" +"New :meth:`loop.get_exception_handler() ` method to get the current exception handler. " +"(Contributed by Yury Selivanov.)" msgstr "" #: ../../whatsnew/3.5.rst:855 @@ -1373,8 +1374,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:860 msgid "" -"The :meth:`loop.create_connection() ` " -"and :meth:`loop.create_server() ` methods are " +"The :meth:`loop.create_connection() ` and :" +"meth:`loop.create_server() ` methods are " "optimized to avoid calling the system ``getaddrinfo`` function if the " "address is already resolved. (Contributed by A. Jesse Jiryu Davis.)" msgstr "" @@ -1423,10 +1424,10 @@ msgstr "code" #: ../../whatsnew/3.5.rst:896 msgid "" -"The :func:`InteractiveInterpreter.showtraceback() " -"` method now prints the full " -"chained traceback, just like the interactive interpreter. (Contributed by " -"Claudiu Popa in :issue:`17442`.)" +"The :func:`InteractiveInterpreter.showtraceback() ` method now prints the full chained " +"traceback, just like the interactive interpreter. (Contributed by Claudiu " +"Popa in :issue:`17442`.)" msgstr "" #: ../../whatsnew/3.5.rst:902 @@ -1436,8 +1437,8 @@ msgstr "collections" #: ../../whatsnew/3.5.rst:906 msgid "" "The :class:`~collections.OrderedDict` class is now implemented in C, which " -"makes it 4 to 100 times faster. (Contributed by Eric Snow " -"in :issue:`16991`.)" +"makes it 4 to 100 times faster. (Contributed by Eric Snow in :issue:" +"`16991`.)" msgstr "" #: ../../whatsnew/3.5.rst:909 @@ -1449,13 +1450,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:913 msgid "" -"The :class:`~collections.deque` class now " -"defines :meth:`~collections.deque.index`, :meth:`~collections.deque.insert`, " -"and :meth:`~collections.deque.copy`, and supports the ``+`` and ``*`` " -"operators. This allows deques to be recognized as " -"a :class:`~collections.abc.MutableSequence` and improves their " -"substitutability for lists. (Contributed by Raymond Hettinger " -"in :issue:`23704`.)" +"The :class:`~collections.deque` class now defines :meth:`~collections.deque." +"index`, :meth:`~collections.deque.insert`, and :meth:`~collections.deque." +"copy`, and supports the ``+`` and ``*`` operators. This allows deques to be " +"recognized as a :class:`~collections.abc.MutableSequence` and improves their " +"substitutability for lists. (Contributed by Raymond Hettinger in :issue:" +"`23704`.)" msgstr "" #: ../../whatsnew/3.5.rst:920 @@ -1481,10 +1481,11 @@ msgstr "(由 Berker Peksag 在 :issue:`24064` 中貢獻。)" #: ../../whatsnew/3.5.rst:929 msgid "" -"The :class:`~collections.UserString` class now implements " -"the :meth:`~object.__getnewargs__`, :meth:`~object.__rmod__`, :meth:`~str.casefold`, :meth:`~str.format_map`, :meth:`~str.isprintable`, " -"and :meth:`~str.maketrans` methods to match the corresponding methods " -"of :class:`str`. (Contributed by Joe Jevnik in :issue:`22189`.)" +"The :class:`~collections.UserString` class now implements the :meth:`~object." +"__getnewargs__`, :meth:`~object.__rmod__`, :meth:`~str.casefold`, :meth:" +"`~str.format_map`, :meth:`~str.isprintable`, and :meth:`~str.maketrans` " +"methods to match the corresponding methods of :class:`str`. (Contributed by " +"Joe Jevnik in :issue:`22189`.)" msgstr "" #: ../../whatsnew/3.5.rst:937 @@ -1493,10 +1494,9 @@ msgstr "collections.abc" #: ../../whatsnew/3.5.rst:939 msgid "" -"The :meth:`Sequence.index() ` method " -"now accepts *start* and *stop* arguments to match the corresponding methods " -"of :class:`tuple`, :class:`list`, etc. (Contributed by Devin Jeanpierre " -"in :issue:`23086`.)" +"The :meth:`!Sequence.index` method now accepts *start* and *stop* arguments " +"to match the corresponding methods of :class:`tuple`, :class:`list`, etc. " +"(Contributed by Devin Jeanpierre in :issue:`23086`.)" msgstr "" #: ../../whatsnew/3.5.rst:944 @@ -1507,9 +1507,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:947 msgid "" -"New :class:`~collections.abc.Awaitable`, :class:`~collections.abc.Coroutine`, :class:`~collections.abc.AsyncIterator`, " -"and :class:`~collections.abc.AsyncIterable` abstract base classes. " -"(Contributed by Yury Selivanov in :issue:`24184`.)" +"New :class:`~collections.abc.Awaitable`, :class:`~collections.abc." +"Coroutine`, :class:`~collections.abc.AsyncIterator`, and :class:" +"`~collections.abc.AsyncIterable` abstract base classes. (Contributed by Yury " +"Selivanov in :issue:`24184`.)" msgstr "" #: ../../whatsnew/3.5.rst:952 @@ -1525,8 +1526,8 @@ msgstr "compileall" #: ../../whatsnew/3.5.rst:959 msgid "" "A new :mod:`compileall` option, :samp:`-j {N}`, allows running *N* workers " -"simultaneously to perform parallel bytecode compilation. " -"The :func:`~compileall.compile_dir` function has a corresponding ``workers`` " +"simultaneously to perform parallel bytecode compilation. The :func:" +"`~compileall.compile_dir` function has a corresponding ``workers`` " "parameter. (Contributed by Claudiu Popa in :issue:`16104`.)" msgstr "" @@ -1540,11 +1541,10 @@ msgstr "" msgid "" "The ``-q`` command line option can now be specified more than once, in which " "case all output, including errors, will be suppressed. The corresponding " -"``quiet`` parameter " -"in :func:`~compileall.compile_dir`, :func:`~compileall.compile_file`, " -"and :func:`~compileall.compile_path` can now accept an integer value " -"indicating the level of output suppression. (Contributed by Thomas Kluyver " -"in :issue:`21338`.)" +"``quiet`` parameter in :func:`~compileall.compile_dir`, :func:`~compileall." +"compile_file`, and :func:`~compileall.compile_path` can now accept an " +"integer value indicating the level of output suppression. (Contributed by " +"Thomas Kluyver in :issue:`21338`.)" msgstr "" #: ../../whatsnew/3.5.rst:976 @@ -1573,10 +1573,10 @@ msgstr "configparser" #: ../../whatsnew/3.5.rst:991 msgid "" ":mod:`configparser` now provides a way to customize the conversion of values " -"by specifying a dictionary of converters in " -"the :class:`~configparser.ConfigParser` constructor, or by defining them as " -"methods in ``ConfigParser`` subclasses. Converters defined in a parser " -"instance are inherited by its section proxies." +"by specifying a dictionary of converters in the :class:`~configparser." +"ConfigParser` constructor, or by defining them as methods in " +"``ConfigParser`` subclasses. Converters defined in a parser instance are " +"inherited by its section proxies." msgstr "" #: ../../whatsnew/3.5.rst:997 @@ -1673,10 +1673,10 @@ msgstr "curses" #: ../../whatsnew/3.5.rst:1047 msgid "" -"The new :func:`~curses.update_lines_cols` function updates " -"the :data:`~curses.LINES` and :data:`~curses.COLS` module variables. This " -"is useful for detecting manual screen resizing. (Contributed by Arnon Yaari " -"in :issue:`4254`.)" +"The new :func:`~curses.update_lines_cols` function updates the :data:" +"`~curses.LINES` and :data:`~curses.COLS` module variables. This is useful " +"for detecting manual screen resizing. (Contributed by Arnon Yaari in :issue:" +"`4254`.)" msgstr "" #: ../../whatsnew/3.5.rst:1053 @@ -1686,8 +1686,8 @@ msgstr "dbm" #: ../../whatsnew/3.5.rst:1055 msgid "" ":func:`dumb.open ` always creates a new database when the " -"flag has the value ``\"n\"``. (Contributed by Claudiu Popa " -"in :issue:`18039`.)" +"flag has the value ``\"n\"``. (Contributed by Claudiu Popa in :issue:" +"`18039`.)" msgstr "" #: ../../whatsnew/3.5.rst:1060 @@ -1699,8 +1699,8 @@ msgid "" "The charset of HTML documents generated by :meth:`HtmlDiff.make_file() " "` can now be customized by using a new *charset* " "keyword-only argument. The default charset of HTML document changed from " -"``\"ISO-8859-1\"`` to ``\"utf-8\"``. (Contributed by Berker Peksag " -"in :issue:`2052`.)" +"``\"ISO-8859-1\"`` to ``\"utf-8\"``. (Contributed by Berker Peksag in :issue:" +"`2052`.)" msgstr "" #: ../../whatsnew/3.5.rst:1069 @@ -1734,10 +1734,9 @@ msgstr "doctest" #: ../../whatsnew/3.5.rst:1089 msgid "" -"The :func:`~doctest.DocTestSuite` function returns an " -"empty :class:`unittest.TestSuite` if *module* contains no docstrings, " -"instead of raising :exc:`ValueError`. (Contributed by Glenn Jones " -"in :issue:`15916`.)" +"The :func:`~doctest.DocTestSuite` function returns an empty :class:`unittest." +"TestSuite` if *module* contains no docstrings, instead of raising :exc:" +"`ValueError`. (Contributed by Glenn Jones in :issue:`15916`.)" msgstr "" #: ../../whatsnew/3.5.rst:1095 @@ -1746,20 +1745,19 @@ msgstr "email" #: ../../whatsnew/3.5.rst:1097 msgid "" -"A new policy option :attr:`Policy.mangle_from_ " -"` controls whether or not lines that start " -"with ``\"From \"`` in email bodies are prefixed with a ``\">\"`` character " -"by generators. The default is ``True`` for :attr:`~email.policy.compat32` " -"and ``False`` for all other policies. (Contributed by Milan Oberkirch " -"in :issue:`20098`.)" +"A new policy option :attr:`Policy.mangle_from_ ` controls whether or not lines that start with ``\"From \"`` " +"in email bodies are prefixed with a ``\">\"`` character by generators. The " +"default is ``True`` for :attr:`~email.policy.compat32` and ``False`` for all " +"other policies. (Contributed by Milan Oberkirch in :issue:`20098`.)" msgstr "" #: ../../whatsnew/3.5.rst:1103 msgid "" -"A new :meth:`Message.get_content_disposition() " -"` method provides easy access " -"to a canonical value for the :mailheader:`Content-Disposition` header. " -"(Contributed by Abhilash Raj in :issue:`21083`.)" +"A new :meth:`Message.get_content_disposition() ` method provides easy access to a canonical value " +"for the :mailheader:`Content-Disposition` header. (Contributed by Abhilash " +"Raj in :issue:`21083`.)" msgstr "" #: ../../whatsnew/3.5.rst:1109 @@ -1767,9 +1765,9 @@ msgid "" "A new policy option :attr:`EmailPolicy.utf8 ` " "can be set to ``True`` to encode email headers using the UTF-8 charset " "instead of using encoded words. This allows ``Messages`` to be formatted " -"according to :rfc:`6532` and used with an SMTP server that supports " -"the :rfc:`6531` ``SMTPUTF8`` extension. (Contributed by R. David Murray " -"in :issue:`24211`.)" +"according to :rfc:`6532` and used with an SMTP server that supports the :rfc:" +"`6531` ``SMTPUTF8`` extension. (Contributed by R. David Murray in :issue:" +"`24211`.)" msgstr "" #: ../../whatsnew/3.5.rst:1116 @@ -1813,10 +1811,10 @@ msgstr "faulthandler" #: ../../whatsnew/3.5.rst:1139 msgid "" -"The :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:`~faulthandler.dump_traceback` " -"and :func:`~faulthandler.dump_traceback_later` functions now accept file " -"descriptors in addition to file-like objects. (Contributed by Wei Wu " -"in :issue:`23566`.)" +"The :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:" +"`~faulthandler.dump_traceback` and :func:`~faulthandler." +"dump_traceback_later` functions now accept file descriptors in addition to " +"file-like objects. (Contributed by Wei Wu in :issue:`23566`.)" msgstr "" #: ../../whatsnew/3.5.rst:1147 @@ -1848,8 +1846,8 @@ msgstr "gzip" #: ../../whatsnew/3.5.rst:1167 msgid "" "The *mode* argument of the :class:`~gzip.GzipFile` constructor now accepts " -"``\"x\"`` to request exclusive creation. (Contributed by Tim Heaney " -"in :issue:`19222`.)" +"``\"x\"`` to request exclusive creation. (Contributed by Tim Heaney in :" +"issue:`19222`.)" msgstr "" #: ../../whatsnew/3.5.rst:1173 @@ -1903,11 +1901,10 @@ msgstr "http.client" #: ../../whatsnew/3.5.rst:1202 msgid "" -":meth:`HTTPConnection.getresponse() " -"` now raises " -"a :exc:`~http.client.RemoteDisconnected` exception when a remote server " -"connection is closed unexpectedly. Additionally, if " -"a :exc:`ConnectionError` (of which ``RemoteDisconnected`` is a subclass) is " +":meth:`HTTPConnection.getresponse() ` now raises a :exc:`~http.client.RemoteDisconnected` exception " +"when a remote server connection is closed unexpectedly. Additionally, if a :" +"exc:`ConnectionError` (of which ``RemoteDisconnected`` is a subclass) is " "raised, the client socket is now closed automatically, and will reconnect on " "the next request::" msgstr "" @@ -1943,10 +1940,10 @@ msgstr "idlelib 與 IDLE" #: ../../whatsnew/3.5.rst:1224 msgid "" "Since idlelib implements the IDLE shell and editor and is not intended for " -"import by other programs, it gets improvements with every release. " -"See :file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since " -"3.4.0, as well as changes made in future 3.5.x releases. This file is also " -"available from the IDLE :menuselection:`Help --> About IDLE` dialog." +"import by other programs, it gets improvements with every release. See :" +"file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since 3.4.0, as " +"well as changes made in future 3.5.x releases. This file is also available " +"from the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" #: ../../whatsnew/3.5.rst:1232 @@ -1963,12 +1960,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:1239 msgid "" -"The :mod:`imaplib` module now supports :rfc:`5161` (ENABLE Extension) " -"and :rfc:`6855` (UTF-8 Support) via the :meth:`IMAP4.enable() " -"` method. A new :attr:`IMAP4.utf8_enabled " -"` attribute tracks whether or not :rfc:`6855` " -"support is enabled. (Contributed by Milan Oberkirch, R. David Murray, and " -"Maciej Szulik in :issue:`21800`.)" +"The :mod:`imaplib` module now supports :rfc:`5161` (ENABLE Extension) and :" +"rfc:`6855` (UTF-8 Support) via the :meth:`IMAP4.enable() ` method. A new :attr:`IMAP4.utf8_enabled ` attribute tracks whether or not :rfc:`6855` support is " +"enabled. (Contributed by Milan Oberkirch, R. David Murray, and Maciej Szulik " +"in :issue:`21800`.)" msgstr "" #: ../../whatsnew/3.5.rst:1246 @@ -1984,10 +1981,10 @@ msgstr "imghdr" #: ../../whatsnew/3.5.rst:1254 msgid "" -"The :func:`!what` function now recognizes the `OpenEXR `_ format (contributed by Martin Vignali and Claudiu Popa " -"in :issue:`20295`), and the `WebP `_ " -"format (contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" +"The :func:`!what` function now recognizes the `OpenEXR `_ format (contributed by Martin Vignali and Claudiu Popa in :issue:" +"`20295`), and the `WebP `_ format " +"(contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" msgstr "" #: ../../whatsnew/3.5.rst:1262 @@ -2003,11 +2000,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:1268 msgid "" -"The :func:`abc.InspectLoader.source_to_code() " -"` method is now a static " -"method. This makes it easier to initialize a module object with code " -"compiled from a string by running ``exec(code, module.__dict__)``. " -"(Contributed by Brett Cannon in :issue:`21156`.)" +"The :func:`abc.InspectLoader.source_to_code() ` method is now a static method. This makes it easier to " +"initialize a module object with code compiled from a string by running " +"``exec(code, module.__dict__)``. (Contributed by Brett Cannon in :issue:" +"`21156`.)" msgstr "" #: ../../whatsnew/3.5.rst:1274 @@ -2026,15 +2023,15 @@ msgstr "inspect" #: ../../whatsnew/3.5.rst:1284 msgid "" "Both the :class:`~inspect.Signature` and :class:`~inspect.Parameter` classes " -"are now picklable and hashable. (Contributed by Yury Selivanov " -"in :issue:`20726` and :issue:`20334`.)" +"are now picklable and hashable. (Contributed by Yury Selivanov in :issue:" +"`20726` and :issue:`20334`.)" msgstr "" #: ../../whatsnew/3.5.rst:1288 msgid "" -"A new :meth:`BoundArguments.apply_defaults() " -"` method provides a way to set " -"default values for missing arguments::" +"A new :meth:`BoundArguments.apply_defaults() ` method provides a way to set default values for missing " +"arguments::" msgstr "" #: ../../whatsnew/3.5.rst:1292 @@ -2057,34 +2054,34 @@ msgstr "(由 Yury Selivanov 在 :issue:`24190` 中貢獻。)" #: ../../whatsnew/3.5.rst:1300 msgid "" -"A new class method :meth:`Signature.from_callable() " -"` makes subclassing " -"of :class:`~inspect.Signature` easier. (Contributed by Yury Selivanov and " -"Eric Snow in :issue:`17373`.)" +"A new class method :meth:`Signature.from_callable() ` makes subclassing of :class:`~inspect.Signature` easier. " +"(Contributed by Yury Selivanov and Eric Snow in :issue:`17373`.)" msgstr "" #: ../../whatsnew/3.5.rst:1305 msgid "" "The :func:`~inspect.signature` function now accepts a *follow_wrapped* " "optional keyword argument, which, when set to ``False``, disables automatic " -"following of ``__wrapped__`` links. (Contributed by Yury Selivanov " -"in :issue:`20691`.)" +"following of ``__wrapped__`` links. (Contributed by Yury Selivanov in :issue:" +"`20691`.)" msgstr "" #: ../../whatsnew/3.5.rst:1310 msgid "" "A set of new functions to inspect :term:`coroutine functions ` and :term:`coroutine objects ` has been " -"added: :func:`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, :func:`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`, " -"and :func:`~inspect.getcoroutinestate`. (Contributed by Yury Selivanov " -"in :issue:`24017` and :issue:`24400`.)" +"function>` and :term:`coroutine objects ` has been added: :func:" +"`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, :func:" +"`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`, and :func:" +"`~inspect.getcoroutinestate`. (Contributed by Yury Selivanov in :issue:" +"`24017` and :issue:`24400`.)" msgstr "" #: ../../whatsnew/3.5.rst:1318 msgid "" -"The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect.getouterframes`, " -"and :func:`~inspect.getinnerframes` functions now return a list of named " -"tuples. (Contributed by Daniel Shahaf in :issue:`16808`.)" +"The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect." +"getouterframes`, and :func:`~inspect.getinnerframes` functions now return a " +"list of named tuples. (Contributed by Daniel Shahaf in :issue:`16808`.)" msgstr "" #: ../../whatsnew/3.5.rst:1325 @@ -2094,10 +2091,10 @@ msgstr "io" #: ../../whatsnew/3.5.rst:1327 msgid "" "A new :meth:`BufferedIOBase.readinto1() ` " -"method, that uses at most one call to the underlying raw " -"stream's :meth:`RawIOBase.read() ` " -"or :meth:`RawIOBase.readinto() ` methods. " -"(Contributed by Nikolaus Rath in :issue:`20578`.)" +"method, that uses at most one call to the underlying raw stream's :meth:" +"`RawIOBase.read() ` or :meth:`RawIOBase.readinto() ` methods. (Contributed by Nikolaus Rath in :issue:" +"`20578`.)" msgstr "" #: ../../whatsnew/3.5.rst:1335 @@ -2131,9 +2128,9 @@ msgstr "(由 Peter Moody 和 Antoine Pitrou 在 :issue:`16531` 中貢獻。) #: ../../whatsnew/3.5.rst:1349 msgid "" -"A new :attr:`~ipaddress.IPv4Address.reverse_pointer` attribute for " -"the :class:`~ipaddress.IPv4Address` and :class:`~ipaddress.IPv6Address` " -"classes returns the name of the reverse DNS PTR record::" +"A new :attr:`~ipaddress.IPv4Address.reverse_pointer` attribute for the :" +"class:`~ipaddress.IPv4Address` and :class:`~ipaddress.IPv6Address` classes " +"returns the name of the reverse DNS PTR record::" msgstr "" #: ../../whatsnew/3.5.rst:1353 @@ -2166,14 +2163,14 @@ msgstr "json" msgid "" "The :mod:`json.tool` command line interface now preserves the order of keys " "in JSON objects passed in input. The new ``--sort-keys`` option can be used " -"to sort the keys alphabetically. (Contributed by Berker Peksag " -"in :issue:`21650`.)" +"to sort the keys alphabetically. (Contributed by Berker Peksag in :issue:" +"`21650`.)" msgstr "" #: ../../whatsnew/3.5.rst:1372 msgid "" -"JSON decoder now raises :exc:`~json.JSONDecodeError` instead " -"of :exc:`ValueError` to provide better context information about the error. " +"JSON decoder now raises :exc:`~json.JSONDecodeError` instead of :exc:" +"`ValueError` to provide better context information about the error. " "(Contributed by Serhiy Storchaka in :issue:`19361`.)" msgstr "" @@ -2233,10 +2230,10 @@ msgstr "logging" #: ../../whatsnew/3.5.rst:1409 msgid "" -"All logging methods " -"(:class:`~logging.Logger` :meth:`~logging.Logger.log`, :meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:`~logging.Logger.debug`, " -"etc.), now accept exception instances as an *exc_info* argument, in addition " -"to boolean values and exception tuples::" +"All logging methods (:class:`~logging.Logger` :meth:`~logging.Logger.log`, :" +"meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:" +"`~logging.Logger.debug`, etc.), now accept exception instances as an " +"*exc_info* argument, in addition to boolean values and exception tuples::" msgstr "" #: ../../whatsnew/3.5.rst:1415 @@ -2263,8 +2260,8 @@ msgstr "(由 Yury Selivanov 在 :issue:`20537` 中貢獻。)" msgid "" "The :class:`handlers.HTTPHandler ` class now " "accepts an optional :class:`ssl.SSLContext` instance to configure SSL " -"settings used in an HTTP connection. (Contributed by Alex Gaynor " -"in :issue:`22788`.)" +"settings used in an HTTP connection. (Contributed by Alex Gaynor in :issue:" +"`22788`.)" msgstr "" #: ../../whatsnew/3.5.rst:1429 @@ -2292,9 +2289,9 @@ msgstr "math" #: ../../whatsnew/3.5.rst:1447 msgid "" -"Two new constants have been added to the :mod:`math` " -"module: :data:`~math.inf` and :data:`~math.nan`. (Contributed by Mark " -"Dickinson in :issue:`23185`.)" +"Two new constants have been added to the :mod:`math` module: :data:`~math." +"inf` and :data:`~math.nan`. (Contributed by Mark Dickinson in :issue:" +"`23185`.)" msgstr "" #: ../../whatsnew/3.5.rst:1450 @@ -2318,10 +2315,9 @@ msgstr "multiprocessing" #: ../../whatsnew/3.5.rst:1461 msgid "" -":func:`sharedctypes.synchronized() " -"` objects now support " -"the :term:`context manager` protocol. (Contributed by Charles-François " -"Natali in :issue:`21565`.)" +":func:`sharedctypes.synchronized() ` objects now support the :term:`context manager` protocol. " +"(Contributed by Charles-François Natali in :issue:`21565`.)" msgstr "" #: ../../whatsnew/3.5.rst:1467 @@ -2330,16 +2326,16 @@ msgstr "operator" #: ../../whatsnew/3.5.rst:1469 msgid "" -":func:`~operator.attrgetter`, :func:`~operator.itemgetter`, " -"and :func:`~operator.methodcaller` objects now support pickling. " -"(Contributed by Josh Rosenberg and Serhiy Storchaka in :issue:`22955`.)" +":func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and :func:" +"`~operator.methodcaller` objects now support pickling. (Contributed by Josh " +"Rosenberg and Serhiy Storchaka in :issue:`22955`.)" msgstr "" #: ../../whatsnew/3.5.rst:1473 msgid "" "New :func:`~operator.matmul` and :func:`~operator.imatmul` functions to " -"perform matrix multiplication. (Contributed by Benjamin Peterson " -"in :issue:`21176`.)" +"perform matrix multiplication. (Contributed by Benjamin Peterson in :issue:" +"`21176`.)" msgstr "" #: ../../whatsnew/3.5.rst:1479 @@ -2348,22 +2344,21 @@ msgstr "os" #: ../../whatsnew/3.5.rst:1481 msgid "" -"The new :func:`~os.scandir` function returning an iterator " -"of :class:`~os.DirEntry` objects has been added. If " -"possible, :func:`~os.scandir` extracts file attributes while scanning a " -"directory, removing the need to perform subsequent system calls to determine " -"file type or attributes, which may significantly improve performance. " -"(Contributed by Ben Hoyt with the help of Victor Stinner in :issue:`22524`.)" +"The new :func:`~os.scandir` function returning an iterator of :class:`~os." +"DirEntry` objects has been added. If possible, :func:`~os.scandir` extracts " +"file attributes while scanning a directory, removing the need to perform " +"subsequent system calls to determine file type or attributes, which may " +"significantly improve performance. (Contributed by Ben Hoyt with the help " +"of Victor Stinner in :issue:`22524`.)" msgstr "" #: ../../whatsnew/3.5.rst:1488 msgid "" -"On Windows, a new :attr:`stat_result.st_file_attributes " -"` attribute is now available. It " -"corresponds to the ``dwFileAttributes`` member of the " -"``BY_HANDLE_FILE_INFORMATION`` structure returned by " -"``GetFileInformationByHandle()``. (Contributed by Ben Hoyt " -"in :issue:`21719`.)" +"On Windows, a new :attr:`stat_result.st_file_attributes ` attribute is now available. It corresponds to the " +"``dwFileAttributes`` member of the ``BY_HANDLE_FILE_INFORMATION`` structure " +"returned by ``GetFileInformationByHandle()``. (Contributed by Ben Hoyt in :" +"issue:`21719`.)" msgstr "" #: ../../whatsnew/3.5.rst:1494 @@ -2377,8 +2372,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:1499 msgid "" "New :func:`~os.get_blocking` and :func:`~os.set_blocking` functions allow " -"getting and setting a file descriptor's blocking mode " -"(:const:`~os.O_NONBLOCK`.) (Contributed by Victor Stinner in :issue:`22054`.)" +"getting and setting a file descriptor's blocking mode (:const:`~os." +"O_NONBLOCK`.) (Contributed by Victor Stinner in :issue:`22054`.)" msgstr "" #: ../../whatsnew/3.5.rst:1503 @@ -2392,8 +2387,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:1506 msgid "" "There is a new :func:`os.path.commonpath` function returning the longest " -"common sub-path of each passed pathname. Unlike " -"the :func:`os.path.commonprefix` function, it always returns a valid path::" +"common sub-path of each passed pathname. Unlike the :func:`os.path." +"commonprefix` function, it always returns a valid path::" msgstr "" #: ../../whatsnew/3.5.rst:1511 @@ -2461,18 +2456,16 @@ msgstr "" msgid "" "A new :meth:`Path.home() ` class method can be used to " "get a :class:`~pathlib.Path` instance representing the user’s home " -"directory. (Contributed by Victor Salgado and Mayank Tripathi " -"in :issue:`19777`.)" +"directory. (Contributed by Victor Salgado and Mayank Tripathi in :issue:" +"`19777`.)" msgstr "" #: ../../whatsnew/3.5.rst:1548 msgid "" -"New :meth:`Path.write_text() " -"`, :meth:`Path.read_text() " -"`, :meth:`Path.write_bytes() " -"`, :meth:`Path.read_bytes() " -"` methods to simplify read/write operations on " -"files." +"New :meth:`Path.write_text() `, :meth:`Path." +"read_text() `, :meth:`Path.write_bytes() `, :meth:`Path.read_bytes() ` " +"methods to simplify read/write operations on files." msgstr "" #: ../../whatsnew/3.5.rst:1554 @@ -2565,10 +2558,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:1604 msgid "" -"The :class:`re.error ` exceptions have new " -"attributes, :attr:`~re.PatternError.msg`, :attr:`~re.PatternError.pattern`, :attr:`~re.PatternError.pos`, :attr:`~re.PatternError.lineno`, " -"and :attr:`~re.PatternError.colno`, that provide better context information " -"about the error::" +"The :class:`re.error ` exceptions have new attributes, :" +"attr:`~re.PatternError.msg`, :attr:`~re.PatternError.pattern`, :attr:`~re." +"PatternError.pos`, :attr:`~re.PatternError.lineno`, and :attr:`~re." +"PatternError.colno`, that provide better context information about the " +"error::" msgstr "" #: ../../whatsnew/3.5.rst:1610 @@ -2670,9 +2664,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:1676 msgid "" -"The :class:`!SMTPServer` class now advertises the ``8BITMIME`` extension " -"(:rfc:`6152`) if *decode_data* has been set ``True``. If the client " -"specifies ``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to :meth:`!" +"The :class:`!SMTPServer` class now advertises the ``8BITMIME`` extension (:" +"rfc:`6152`) if *decode_data* has been set ``True``. If the client specifies " +"``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to :meth:`!" "SMTPServer.process_message` via the *mail_options* keyword. (Contributed by " "Milan Oberkirch and R. David Murray in :issue:`21795`.)" msgstr "" @@ -2709,16 +2703,16 @@ msgstr "" msgid "" "The :meth:`SMTP.set_debuglevel() ` method now " "accepts an additional debuglevel (2), which enables timestamps in debug " -"messages. (Contributed by Gavin Chappell and Maciej Szulik " -"in :issue:`16914`.)" +"messages. (Contributed by Gavin Chappell and Maciej Szulik in :issue:" +"`16914`.)" msgstr "" #: ../../whatsnew/3.5.rst:1707 msgid "" -"Both the :meth:`SMTP.sendmail() ` " -"and :meth:`SMTP.send_message() ` methods now " -"support :rfc:`6531` (SMTPUTF8). (Contributed by Milan Oberkirch and R. David " -"Murray in :issue:`22027`.)" +"Both the :meth:`SMTP.sendmail() ` and :meth:`SMTP." +"send_message() ` methods now support :rfc:`6531` " +"(SMTPUTF8). (Contributed by Milan Oberkirch and R. David Murray in :issue:" +"`22027`.)" msgstr "" #: ../../whatsnew/3.5.rst:1714 @@ -2727,9 +2721,8 @@ msgstr "sndhdr" #: ../../whatsnew/3.5.rst:1716 msgid "" -"The :func:`!what` and :func:`!whathdr` functions now return " -"a :func:`~collections.namedtuple`. (Contributed by Claudiu Popa " -"in :issue:`18615`.)" +"The :func:`!what` and :func:`!whathdr` functions now return a :func:" +"`~collections.namedtuple`. (Contributed by Claudiu Popa in :issue:`18615`.)" msgstr "" #: ../../whatsnew/3.5.rst:1722 @@ -2745,10 +2738,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1727 msgid "" "A new :meth:`socket.sendfile() ` method allows " -"sending a file over a socket by using the high-" -"performance :func:`os.sendfile` function on UNIX, resulting in uploads being " -"from 2 to 3 times faster than when using plain :meth:`socket.send() " -"`. (Contributed by Giampaolo Rodola' in :issue:`17552`.)" +"sending a file over a socket by using the high-performance :func:`os." +"sendfile` function on UNIX, resulting in uploads being from 2 to 3 times " +"faster than when using plain :meth:`socket.send() `. " +"(Contributed by Giampaolo Rodola' in :issue:`17552`.)" msgstr "" #: ../../whatsnew/3.5.rst:1733 @@ -2762,9 +2755,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:1738 msgid "" "The *backlog* argument of the :meth:`socket.listen() ` " -"method is now optional. By default it is set to :data:`SOMAXCONN " -"` or to ``128``, whichever is less. (Contributed by " -"Charles-François Natali in :issue:`21455`.)" +"method is now optional. By default it is set to :data:`SOMAXCONN ` or to ``128``, whichever is less. (Contributed by Charles-" +"François Natali in :issue:`21455`.)" msgstr "" #: ../../whatsnew/3.5.rst:1745 @@ -2782,12 +2775,11 @@ msgstr "(由 Geert Jansen 在 :issue:`21965` 中貢獻。)" #: ../../whatsnew/3.5.rst:1754 msgid "" "The new :class:`~ssl.SSLObject` class has been added to provide SSL protocol " -"support for cases when the network I/O capabilities " -"of :class:`~ssl.SSLSocket` are not necessary or are suboptimal. " -"``SSLObject`` represents an SSL protocol instance, but does not implement " -"any network I/O methods, and instead provides a memory buffer interface. " -"The new :class:`~ssl.MemoryBIO` class can be used to pass data between " -"Python and an SSL protocol instance." +"support for cases when the network I/O capabilities of :class:`~ssl." +"SSLSocket` are not necessary or are suboptimal. ``SSLObject`` represents an " +"SSL protocol instance, but does not implement any network I/O methods, and " +"instead provides a memory buffer interface. The new :class:`~ssl.MemoryBIO` " +"class can be used to pass data between Python and an SSL protocol instance." msgstr "" #: ../../whatsnew/3.5.rst:1761 @@ -2814,23 +2806,23 @@ msgstr "(由 Benjamin Peterson 在 :issue:`20188` 中貢獻。)" #: ../../whatsnew/3.5.rst:1774 msgid "" "Where OpenSSL support is present, the :mod:`ssl` module now implements the " -"*Application-Layer Protocol Negotiation* TLS extension as described " -"in :rfc:`7301`." +"*Application-Layer Protocol Negotiation* TLS extension as described in :rfc:" +"`7301`." msgstr "" #: ../../whatsnew/3.5.rst:1778 msgid "" -"The new :meth:`SSLContext.set_alpn_protocols() " -"` can be used to specify which protocols " -"a socket should advertise during the TLS handshake." +"The new :meth:`SSLContext.set_alpn_protocols() ` can be used to specify which protocols a socket should " +"advertise during the TLS handshake." msgstr "" #: ../../whatsnew/3.5.rst:1782 msgid "" -"The new :meth:`SSLSocket.selected_alpn_protocol() " -"` returns the protocol that was " -"selected during the TLS handshake. The :const:`~ssl.HAS_ALPN` flag indicates " -"whether ALPN support is present." +"The new :meth:`SSLSocket.selected_alpn_protocol() ` returns the protocol that was selected during the " +"TLS handshake. The :const:`~ssl.HAS_ALPN` flag indicates whether ALPN " +"support is present." msgstr "" #: ../../whatsnew/3.5.rst:1789 @@ -2840,23 +2832,22 @@ msgstr "其他變更" #: ../../whatsnew/3.5.rst:1791 msgid "" "There is a new :meth:`SSLSocket.version() ` method to " -"query the actual protocol version in use. (Contributed by Antoine Pitrou " -"in :issue:`20421`.)" +"query the actual protocol version in use. (Contributed by Antoine Pitrou in :" +"issue:`20421`.)" msgstr "" #: ../../whatsnew/3.5.rst:1795 msgid "" -"The :class:`~ssl.SSLSocket` class now implements a :meth:`!" -"SSLSocket.sendfile` method. (Contributed by Giampaolo Rodola' " -"in :issue:`17552`.)" +"The :class:`~ssl.SSLSocket` class now implements a :meth:`!SSLSocket." +"sendfile` method. (Contributed by Giampaolo Rodola' in :issue:`17552`.)" msgstr "" #: ../../whatsnew/3.5.rst:1799 msgid "" -"The :meth:`!SSLSocket.send` method now raises either " -"the :exc:`ssl.SSLWantReadError` or :exc:`ssl.SSLWantWriteError` exception on " -"a non-blocking socket if the operation would block. Previously, it would " -"return ``0``. (Contributed by Nikolaus Rath in :issue:`20951`.)" +"The :meth:`!SSLSocket.send` method now raises either the :exc:`ssl." +"SSLWantReadError` or :exc:`ssl.SSLWantWriteError` exception on a non-" +"blocking socket if the operation would block. Previously, it would return " +"``0``. (Contributed by Nikolaus Rath in :issue:`20951`.)" msgstr "" #: ../../whatsnew/3.5.rst:1804 @@ -2870,19 +2861,18 @@ msgstr "" msgid "" "New :meth:`!SSLObject.shared_ciphers` and :meth:`SSLSocket.shared_ciphers() " "` methods return the list of ciphers sent by " -"the client during the handshake. (Contributed by Benjamin Peterson " -"in :issue:`23186`.)" +"the client during the handshake. (Contributed by Benjamin Peterson in :issue:" +"`23186`.)" msgstr "" #: ../../whatsnew/3.5.rst:1813 msgid "" -"The :meth:`SSLSocket.do_handshake() " -"`, :meth:`SSLSocket.read() " -"`, :meth:`!SSLSocket.shutdown`, " -"and :meth:`SSLSocket.write() ` methods of " -"the :class:`~ssl.SSLSocket` class no longer reset the socket timeout every " -"time bytes are received or sent. The socket timeout is now the maximum total " -"duration of the method. (Contributed by Victor Stinner in :issue:`23853`.)" +"The :meth:`SSLSocket.do_handshake() `, :meth:" +"`SSLSocket.read() `, :meth:`!SSLSocket.shutdown`, and :" +"meth:`SSLSocket.write() ` methods of the :class:`~ssl." +"SSLSocket` class no longer reset the socket timeout every time bytes are " +"received or sent. The socket timeout is now the maximum total duration of " +"the method. (Contributed by Victor Stinner in :issue:`23853`.)" msgstr "" #: ../../whatsnew/3.5.rst:1821 @@ -2890,8 +2880,8 @@ msgid "" "The :func:`!match_hostname` function now supports matching of IP addresses. " "(Contributed by Antoine Pitrou in :issue:`23239`.)" msgstr "" -":func:`!match_hostname` 函式現在支援 IP 位址的比對。(由 Antoine Pitrou " -"在 :issue:`23239` 中貢獻。)" +":func:`!match_hostname` 函式現在支援 IP 位址的比對。(由 Antoine Pitrou 在 :" +"issue:`23239` 中貢獻。)" #: ../../whatsnew/3.5.rst:1826 msgid "sqlite3" @@ -2918,11 +2908,10 @@ msgid "" "does not need to maintain compatibility with earlier Python versions. " "(Contributed by Thomas Kluyver in :issue:`23342`.)" msgstr "" -"新增 :func:`~subprocess.run` 函式。它運行指定的命令並回傳一" -"個 :class:`~subprocess.CompletedProcess` 物件,該物件描述了一個已完成的行程。" -"新的 API 更加一致,並且是以較為推薦方法來叫用子行程,適用於不需要與早期 " -"Python 版本保持相容性的 Python 程式碼。(由 Thomas Kluyver 在 :issue:`23342` " -"中貢獻。)" +"新增 :func:`~subprocess.run` 函式。它運行指定的命令並回傳一個 :class:" +"`~subprocess.CompletedProcess` 物件,該物件描述了一個已完成的行程。新的 API " +"更加一致,並且是以較為推薦方法來叫用子行程,適用於不需要與早期 Python 版本保" +"持相容性的 Python 程式碼。(由 Thomas Kluyver 在 :issue:`23342` 中貢獻。)" #: ../../whatsnew/3.5.rst:1849 msgid "" @@ -2980,8 +2969,8 @@ msgstr "sysconfig" #: ../../whatsnew/3.5.rst:1881 msgid "" "The name of the user scripts directory on Windows now includes the first two " -"components of the Python version. (Contributed by Paul Moore " -"in :issue:`23437`.)" +"components of the Python version. (Contributed by Paul Moore in :issue:" +"`23437`.)" msgstr "" #: ../../whatsnew/3.5.rst:1887 @@ -2991,16 +2980,16 @@ msgstr "tarfile" #: ../../whatsnew/3.5.rst:1889 msgid "" "The *mode* argument of the :func:`~tarfile.open` function now accepts " -"``\"x\"`` to request exclusive creation. (Contributed by Berker Peksag " -"in :issue:`21717`.)" +"``\"x\"`` to request exclusive creation. (Contributed by Berker Peksag in :" +"issue:`21717`.)" msgstr "" #: ../../whatsnew/3.5.rst:1892 msgid "" -"The :meth:`TarFile.extractall() ` " -"and :meth:`TarFile.extract() ` methods now take a " -"keyword argument *numeric_owner*. If set to ``True``, the extracted files " -"and directories will be owned by the numeric ``uid`` and ``gid`` from the " +"The :meth:`TarFile.extractall() ` and :meth:" +"`TarFile.extract() ` methods now take a keyword " +"argument *numeric_owner*. If set to ``True``, the extracted files and " +"directories will be owned by the numeric ``uid`` and ``gid`` from the " "tarfile. If set to ``False`` (the default, and the behavior in versions " "prior to 3.5), they will be owned by the named user and group in the " "tarfile. (Contributed by Michael Vogt and Eric Smith in :issue:`23193`.)" @@ -3020,10 +3009,9 @@ msgstr "threading" #: ../../whatsnew/3.5.rst:1909 msgid "" -"Both the :meth:`Lock.acquire() ` " -"and :meth:`RLock.acquire() ` methods now use a " -"monotonic clock for timeout management. (Contributed by Victor Stinner " -"in :issue:`22043`.)" +"Both the :meth:`Lock.acquire() ` and :meth:`RLock." +"acquire() ` methods now use a monotonic clock for " +"timeout management. (Contributed by Victor Stinner in :issue:`22043`.)" msgstr "" #: ../../whatsnew/3.5.rst:1916 @@ -3035,8 +3023,8 @@ msgid "" "The :func:`~time.monotonic` function is now always available. (Contributed " "by Victor Stinner in :issue:`22043`.)" msgstr "" -":func:`~time.monotonic` 函式現在總是可用的。(由 Victor Stinner " -"在 :issue:`22043` 中貢獻。)" +":func:`~time.monotonic` 函式現在總是可用的。(由 Victor Stinner 在 :issue:" +"`22043` 中貢獻。)" #: ../../whatsnew/3.5.rst:1923 msgid "timeit" @@ -3081,10 +3069,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:1953 msgid "" -"New lightweight " -"classes: :class:`~traceback.TracebackException`, :class:`~traceback.StackSummary`, " -"and :class:`~traceback.FrameSummary`. (Contributed by Robert Collins " -"in :issue:`17911`.)" +"New lightweight classes: :class:`~traceback.TracebackException`, :class:" +"`~traceback.StackSummary`, and :class:`~traceback.FrameSummary`. " +"(Contributed by Robert Collins in :issue:`17911`.)" msgstr "" #: ../../whatsnew/3.5.rst:1957 @@ -3101,16 +3088,16 @@ msgstr "types" #: ../../whatsnew/3.5.rst:1965 msgid "" "A new :func:`~types.coroutine` function to transform :term:`generator " -"` and :class:`generator-like " -"` objects into :term:`awaitables `. " -"(Contributed by Yury Selivanov in :issue:`24017`.)" +"` and :class:`generator-like ` objects into :term:`awaitables `. (Contributed by " +"Yury Selivanov in :issue:`24017`.)" msgstr "" #: ../../whatsnew/3.5.rst:1971 msgid "" -"A new type called :class:`~types.CoroutineType`, which is used " -"for :term:`coroutine` objects created by :keyword:`async def` functions. " -"(Contributed by Yury Selivanov in :issue:`24400`.)" +"A new type called :class:`~types.CoroutineType`, which is used for :term:" +"`coroutine` objects created by :keyword:`async def` functions. (Contributed " +"by Yury Selivanov in :issue:`24400`.)" msgstr "" #: ../../whatsnew/3.5.rst:1977 @@ -3131,13 +3118,13 @@ msgstr "unittest" #: ../../whatsnew/3.5.rst:1986 msgid "" -"The :meth:`TestLoader.loadTestsFromModule() " -"` method now accepts a keyword-only " -"argument *pattern* which is passed to ``load_tests`` as the third argument. " -"Found packages are now checked for ``load_tests`` regardless of whether " -"their path matches *pattern*, because it is impossible for a package name to " -"match the default pattern. (Contributed by Robert Collins and Barry A. " -"Warsaw in :issue:`16662`.)" +"The :meth:`TestLoader.loadTestsFromModule() ` method now accepts a keyword-only argument *pattern* " +"which is passed to ``load_tests`` as the third argument. Found packages are " +"now checked for ``load_tests`` regardless of whether their path matches " +"*pattern*, because it is impossible for a package name to match the default " +"pattern. (Contributed by Robert Collins and Barry A. Warsaw in :issue:" +"`16662`.)" msgstr "" #: ../../whatsnew/3.5.rst:1993 @@ -3170,24 +3157,24 @@ msgstr "" #: ../../whatsnew/3.5.rst:2012 msgid "" -"A new :meth:`Mock.assert_not_called() " -"` method to check if the mock object " -"was called. (Contributed by Kushal Das in :issue:`21262`.)" +"A new :meth:`Mock.assert_not_called() ` method to check if the mock object was called. " +"(Contributed by Kushal Das in :issue:`21262`.)" msgstr "" #: ../../whatsnew/3.5.rst:2016 msgid "" -"The :class:`~unittest.mock.MagicMock` class now " -"supports :meth:`~object.__truediv__`, :meth:`~object.__divmod__` " -"and :meth:`~object.__matmul__` operators. (Contributed by Johannes Baiter " -"in :issue:`20968`, and Håkan Lövdahl in :issue:`23581` and :issue:`23568`.)" +"The :class:`~unittest.mock.MagicMock` class now supports :meth:`~object." +"__truediv__`, :meth:`~object.__divmod__` and :meth:`~object.__matmul__` " +"operators. (Contributed by Johannes Baiter in :issue:`20968`, and Håkan " +"Lövdahl in :issue:`23581` and :issue:`23568`.)" msgstr "" #: ../../whatsnew/3.5.rst:2022 msgid "" -"It is no longer necessary to explicitly pass ``create=True`` to " -"the :func:`~unittest.mock.patch` function when patching builtin names. " -"(Contributed by Kushal Das in :issue:`17660`.)" +"It is no longer necessary to explicitly pass ``create=True`` to the :func:" +"`~unittest.mock.patch` function when patching builtin names. (Contributed by " +"Kushal Das in :issue:`17660`.)" msgstr "" #: ../../whatsnew/3.5.rst:2028 @@ -3196,38 +3183,35 @@ msgstr "urllib" #: ../../whatsnew/3.5.rst:2030 msgid "" -"A new :class:`request.HTTPPasswordMgrWithPriorAuth " -"` class allows HTTP Basic " -"Authentication credentials to be managed so as to eliminate unnecessary " -"``401`` response handling, or to unconditionally send credentials on the " -"first request in order to communicate with servers that return a ``404`` " -"response instead of a ``401`` if the ``Authorization`` header is not sent. " -"(Contributed by Matej Cepl in :issue:`19494` and Akshit Khurana " -"in :issue:`7159`.)" +"A new :class:`request.HTTPPasswordMgrWithPriorAuth ` class allows HTTP Basic Authentication " +"credentials to be managed so as to eliminate unnecessary ``401`` response " +"handling, or to unconditionally send credentials on the first request in " +"order to communicate with servers that return a ``404`` response instead of " +"a ``401`` if the ``Authorization`` header is not sent. (Contributed by Matej " +"Cepl in :issue:`19494` and Akshit Khurana in :issue:`7159`.)" msgstr "" #: ../../whatsnew/3.5.rst:2039 msgid "" -"A new *quote_via* argument for the :func:`parse.urlencode() " -"` function provides a way to control the encoding of " -"query parts if needed. (Contributed by Samwyse and Arnon Yaari " -"in :issue:`13866`.)" +"A new *quote_via* argument for the :func:`parse.urlencode() ` function provides a way to control the encoding of query parts " +"if needed. (Contributed by Samwyse and Arnon Yaari in :issue:`13866`.)" msgstr "" #: ../../whatsnew/3.5.rst:2044 msgid "" -"The :func:`request.urlopen() ` function accepts " -"an :class:`ssl.SSLContext` object as a *context* argument, which will be " -"used for the HTTPS connection. (Contributed by Alex Gaynor " -"in :issue:`22366`.)" +"The :func:`request.urlopen() ` function accepts an :" +"class:`ssl.SSLContext` object as a *context* argument, which will be used " +"for the HTTPS connection. (Contributed by Alex Gaynor in :issue:`22366`.)" msgstr "" #: ../../whatsnew/3.5.rst:2048 msgid "" -"The :func:`parse.urljoin() ` was updated to use " -"the :rfc:`3986` semantics for the resolution of relative URLs, rather " -"than :rfc:`1808` and :rfc:`2396`. (Contributed by Demian Brecht and Senthil " -"Kumaran in :issue:`22118`.)" +"The :func:`parse.urljoin() ` was updated to use the :" +"rfc:`3986` semantics for the resolution of relative URLs, rather than :rfc:" +"`1808` and :rfc:`2396`. (Contributed by Demian Brecht and Senthil Kumaran " +"in :issue:`22118`.)" msgstr "" #: ../../whatsnew/3.5.rst:2055 @@ -3236,9 +3220,9 @@ msgstr "wsgiref" #: ../../whatsnew/3.5.rst:2057 msgid "" -"The *headers* argument of the :class:`headers.Headers " -"` class constructor is now optional. (Contributed " -"by Pablo Torres Navarrete and SilentGhost in :issue:`5800`.)" +"The *headers* argument of the :class:`headers.Headers ` class constructor is now optional. (Contributed by Pablo Torres " +"Navarrete and SilentGhost in :issue:`5800`.)" msgstr "" #: ../../whatsnew/3.5.rst:2063 @@ -3265,9 +3249,9 @@ msgstr "xml.sax" #: ../../whatsnew/3.5.rst:2077 msgid "" -"SAX parsers now support a character stream of " -"the :class:`xmlreader.InputSource ` object. " -"(Contributed by Serhiy Storchaka in :issue:`2175`.)" +"SAX parsers now support a character stream of the :class:`xmlreader." +"InputSource ` object. (Contributed by Serhiy " +"Storchaka in :issue:`2175`.)" msgstr "" #: ../../whatsnew/3.5.rst:2081 @@ -3301,10 +3285,10 @@ msgstr "其他模組層級的變更" #: ../../whatsnew/3.5.rst:2099 msgid "" -"Many functions in the :mod:`mmap`, :mod:`!" -"ossaudiodev`, :mod:`socket`, :mod:`ssl`, and :mod:`codecs` modules now " -"accept writable :term:`bytes-like objects `. (Contributed " -"by Serhiy Storchaka in :issue:`23001`.)" +"Many functions in the :mod:`mmap`, :mod:`!ossaudiodev`, :mod:`socket`, :mod:" +"`ssl`, and :mod:`codecs` modules now accept writable :term:`bytes-like " +"objects `. (Contributed by Serhiy Storchaka in :issue:" +"`23001`.)" msgstr "" #: ../../whatsnew/3.5.rst:2106 @@ -3314,9 +3298,9 @@ msgstr "最佳化" #: ../../whatsnew/3.5.rst:2108 msgid "" "The :func:`os.walk` function has been sped up by 3 to 5 times on POSIX " -"systems, and by 7 to 20 times on Windows. This was done using the " -"new :func:`os.scandir` function, which exposes file information from the " -"underlying ``readdir`` or ``FindFirstFile``/``FindNextFile`` system calls. " +"systems, and by 7 to 20 times on Windows. This was done using the new :func:" +"`os.scandir` function, which exposes file information from the underlying " +"``readdir`` or ``FindFirstFile``/``FindNextFile`` system calls. " "(Contributed by Ben Hoyt with help from Victor Stinner in :issue:`23605`.)" msgstr "" @@ -3324,18 +3308,19 @@ msgstr "" msgid "" "Construction of ``bytes(int)`` (filled by zero bytes) is faster and uses " "less memory for large objects. ``calloc()`` is used instead of ``malloc()`` " -"to allocate memory for these objects. (Contributed by Victor Stinner " -"in :issue:`21233`.)" +"to allocate memory for these objects. (Contributed by Victor Stinner in :" +"issue:`21233`.)" msgstr "" #: ../../whatsnew/3.5.rst:2119 msgid "" -"Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` " -"and :class:`~ipaddress.IPv6Network` have been massively sped up, such " -"as :meth:`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, :func:`~ipaddress.summarize_address_range`, :func:`~ipaddress.collapse_addresses`. " -"The speed up can range from 3 to 15 times. (Contributed by Antoine Pitrou, " -"Michel Albert, and Markus " -"in :issue:`21486`, :issue:`21487`, :issue:`20826`, :issue:`23266`.)" +"Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` and :" +"class:`~ipaddress.IPv6Network` have been massively sped up, such as :meth:" +"`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, :" +"func:`~ipaddress.summarize_address_range`, :func:`~ipaddress." +"collapse_addresses`. The speed up can range from 3 to 15 times. (Contributed " +"by Antoine Pitrou, Michel Albert, and Markus in :issue:`21486`, :issue:" +"`21487`, :issue:`20826`, :issue:`23266`.)" msgstr "" #: ../../whatsnew/3.5.rst:2127 @@ -3347,16 +3332,16 @@ msgstr "" #: ../../whatsnew/3.5.rst:2130 msgid "" "Many operations on :class:`io.BytesIO` are now 50% to 100% faster. " -"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson " -"in :issue:`22003`.)" +"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson in :" +"issue:`22003`.)" msgstr "" #: ../../whatsnew/3.5.rst:2134 msgid "" "The :func:`marshal.dumps` function is now faster: 65--85% with versions 3 " "and 4, 20--25% with versions 0 to 2 on typical data, and up to 5 times in " -"best cases. (Contributed by Serhiy Storchaka in :issue:`20416` " -"and :issue:`23344`.)" +"best cases. (Contributed by Serhiy Storchaka in :issue:`20416` and :issue:" +"`23344`.)" msgstr "" #: ../../whatsnew/3.5.rst:2139 @@ -3381,16 +3366,16 @@ msgstr "" #: ../../whatsnew/3.5.rst:2149 msgid "" "The :c:func:`PyObject_IsInstance` and :c:func:`PyObject_IsSubclass` " -"functions have been sped up in the common case that the second argument " -"has :class:`type` as its metaclass. (Contributed Georg Brandl by " -"in :issue:`22540`.)" +"functions have been sped up in the common case that the second argument has :" +"class:`type` as its metaclass. (Contributed Georg Brandl by in :issue:" +"`22540`.)" msgstr "" #: ../../whatsnew/3.5.rst:2154 msgid "" "Method caching was slightly improved, yielding up to 5% performance " -"improvement in some benchmarks. (Contributed by Antoine Pitrou " -"in :issue:`22847`.)" +"improvement in some benchmarks. (Contributed by Antoine Pitrou in :issue:" +"`22847`.)" msgstr "" #: ../../whatsnew/3.5.rst:2158 @@ -3410,16 +3395,15 @@ msgid "" "Instantiation of :class:`fractions.Fraction` is now up to 30% faster. " "(Contributed by Stefan Behnel in :issue:`22464`.)" msgstr "" -":class:`fractions.Fraction` 的實例化現在快了 30%。(由 Stefan Behnel " -"在 :issue:`22464` 中貢獻。)" +":class:`fractions.Fraction` 的實例化現在快了 30%。(由 Stefan Behnel 在 :" +"issue:`22464` 中貢獻。)" #: ../../whatsnew/3.5.rst:2167 msgid "" -"String " -"methods :meth:`~str.find`, :meth:`~str.rfind`, :meth:`~str.split`, :meth:`~str.partition` " -"and the :keyword:`in` string operator are now significantly faster for " -"searching 1-character substrings. (Contributed by Serhiy Storchaka " -"in :issue:`23573`.)" +"String methods :meth:`~str.find`, :meth:`~str.rfind`, :meth:`~str.split`, :" +"meth:`~str.partition` and the :keyword:`in` string operator are now " +"significantly faster for searching 1-character substrings. (Contributed by " +"Serhiy Storchaka in :issue:`23573`.)" msgstr "" #: ../../whatsnew/3.5.rst:2174 @@ -3465,15 +3449,15 @@ msgstr "(由 Victor Stinner 在 :issue:`18395` 中貢獻。)" #: ../../whatsnew/3.5.rst:2191 msgid "" "A new :c:func:`PyCodec_NameReplaceErrors` function to replace the unicode " -"encode error with ``\\N{...}`` escapes. (Contributed by Serhiy Storchaka " -"in :issue:`19676`.)" +"encode error with ``\\N{...}`` escapes. (Contributed by Serhiy Storchaka in :" +"issue:`19676`.)" msgstr "" #: ../../whatsnew/3.5.rst:2195 msgid "" "A new :c:func:`PyErr_FormatV` function similar to :c:func:`PyErr_Format`, " -"but accepts a :c:type:`va_list` argument. (Contributed by Antoine Pitrou " -"in :issue:`18711`.)" +"but accepts a :c:type:`va_list` argument. (Contributed by Antoine Pitrou in :" +"issue:`18711`.)" msgstr "" #: ../../whatsnew/3.5.rst:2199 @@ -3481,23 +3465,23 @@ msgid "" "A new :c:data:`PyExc_RecursionError` exception. (Contributed by Georg Brandl " "in :issue:`19235`.)" msgstr "" -"新增 :c:data:`PyExc_RecursionError` 例外。(由 Georg Brandl " -"在 :issue:`19235` 中貢獻。)" +"新增 :c:data:`PyExc_RecursionError` 例外。(由 Georg Brandl 在 :issue:" +"`19235` 中貢獻。)" #: ../../whatsnew/3.5.rst:2202 msgid "" "New :c:func:`PyModule_FromDefAndSpec`, :c:func:`PyModule_FromDefAndSpec2`, " "and :c:func:`PyModule_ExecDef` functions introduced by :pep:`489` -- multi-" -"phase extension module initialization. (Contributed by Petr Viktorin " -"in :issue:`24268`.)" +"phase extension module initialization. (Contributed by Petr Viktorin in :" +"issue:`24268`.)" msgstr "" #: ../../whatsnew/3.5.rst:2207 msgid "" -"New :c:func:`PyNumber_MatrixMultiply` " -"and :c:func:`PyNumber_InPlaceMatrixMultiply` functions to perform matrix " -"multiplication. (Contributed by Benjamin Peterson in :issue:`21176`. See " -"also :pep:`465` for details.)" +"New :c:func:`PyNumber_MatrixMultiply` and :c:func:" +"`PyNumber_InPlaceMatrixMultiply` functions to perform matrix multiplication. " +"(Contributed by Benjamin Peterson in :issue:`21176`. See also :pep:`465` " +"for details.)" msgstr "" #: ../../whatsnew/3.5.rst:2213 @@ -3605,8 +3589,8 @@ msgstr "已棄用的 Python 行為" msgid "" "Raising the :exc:`StopIteration` exception inside a generator will now " "generate a silent :exc:`PendingDeprecationWarning`, which will become a non-" -"silent deprecation warning in Python 3.6 and will trigger " -"a :exc:`RuntimeError` in Python 3.7. See :ref:`PEP 479: Change StopIteration " +"silent deprecation warning in Python 3.6 and will trigger a :exc:" +"`RuntimeError` in Python 3.7. See :ref:`PEP 479: Change StopIteration " "handling inside generators ` for details." msgstr "" @@ -3632,8 +3616,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:2296 msgid "" -"The :func:`!asyncio.async` function is deprecated in favor " -"of :func:`~asyncio.ensure_future`." +"The :func:`!asyncio.async` function is deprecated in favor of :func:" +"`~asyncio.ensure_future`." msgstr "" #: ../../whatsnew/3.5.rst:2299 @@ -3647,20 +3631,19 @@ msgstr "" #: ../../whatsnew/3.5.rst:2305 msgid "" -"Directly assigning values to " -"the :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel.value` " -"and :attr:`~http.cookies.Morsel.coded_value` of :class:`http.cookies.Morsel` " -"objects is deprecated. Use the :meth:`~http.cookies.Morsel.set` method " -"instead. In addition, the undocumented *LegalChars* parameter " -"of :meth:`~http.cookies.Morsel.set` is deprecated, and is now ignored." +"Directly assigning values to the :attr:`~http.cookies.Morsel.key`, :attr:" +"`~http.cookies.Morsel.value` and :attr:`~http.cookies.Morsel.coded_value` " +"of :class:`http.cookies.Morsel` objects is deprecated. Use the :meth:`~http." +"cookies.Morsel.set` method instead. In addition, the undocumented " +"*LegalChars* parameter of :meth:`~http.cookies.Morsel.set` is deprecated, " +"and is now ignored." msgstr "" #: ../../whatsnew/3.5.rst:2312 msgid "" -"Passing a format string as keyword argument *format_string* to " -"the :meth:`~string.Formatter.format` method of the :class:`string.Formatter` " -"class has been deprecated. (Contributed by Serhiy Storchaka " -"in :issue:`23671`.)" +"Passing a format string as keyword argument *format_string* to the :meth:" +"`~string.Formatter.format` method of the :class:`string.Formatter` class has " +"been deprecated. (Contributed by Serhiy Storchaka in :issue:`23671`.)" msgstr "" #: ../../whatsnew/3.5.rst:2317 @@ -3674,9 +3657,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:2322 msgid "" "The previously undocumented ``from_function`` and ``from_builtin`` methods " -"of :class:`inspect.Signature` are deprecated. Use the " -"new :meth:`Signature.from_callable() ` " -"method instead. (Contributed by Yury Selivanov in :issue:`24248`.)" +"of :class:`inspect.Signature` are deprecated. Use the new :meth:`Signature." +"from_callable() ` method instead. " +"(Contributed by Yury Selivanov in :issue:`24248`.)" msgstr "" #: ../../whatsnew/3.5.rst:2327 @@ -3687,10 +3670,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:2330 msgid "" -"The :mod:`inspect` :func:`~inspect.getfullargspec`, :func:`~inspect.getcallargs`, " -"and :func:`!formatargspec` functions are deprecated in favor of " -"the :func:`inspect.signature` API. (Contributed by Yury Selivanov " -"in :issue:`20438`.)" +"The :mod:`inspect` :func:`~inspect.getfullargspec`, :func:`~inspect." +"getcallargs`, and :func:`!formatargspec` functions are deprecated in favor " +"of the :func:`inspect.signature` API. (Contributed by Yury Selivanov in :" +"issue:`20438`.)" msgstr "" #: ../../whatsnew/3.5.rst:2335 @@ -3715,10 +3698,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:2346 msgid "" -"The undocumented and unofficial *use_load_tests* default argument of " -"the :meth:`unittest.TestLoader.loadTestsFromModule` method now is deprecated " -"and ignored. (Contributed by Robert Collins and Barry A. Warsaw " -"in :issue:`16662`.)" +"The undocumented and unofficial *use_load_tests* default argument of the :" +"meth:`unittest.TestLoader.loadTestsFromModule` method now is deprecated and " +"ignored. (Contributed by Robert Collins and Barry A. Warsaw in :issue:" +"`16662`.)" msgstr "" #: ../../whatsnew/3.5.rst:2353 @@ -3808,16 +3791,16 @@ msgstr "" msgid "" "Before Python 3.5, a :class:`datetime.time` object was considered to be " "false if it represented midnight in UTC. This behavior was considered " -"obscure and error-prone and has been removed in Python 3.5. " -"See :issue:`13936` for full details." +"obscure and error-prone and has been removed in Python 3.5. See :issue:" +"`13936` for full details." msgstr "" #: ../../whatsnew/3.5.rst:2408 msgid "" -"The :meth:`!ssl.SSLSocket.send` method now raises " -"either :exc:`ssl.SSLWantReadError` or :exc:`ssl.SSLWantWriteError` on a non-" -"blocking socket if the operation would block. Previously, it would return " -"``0``. (Contributed by Nikolaus Rath in :issue:`20951`.)" +"The :meth:`!ssl.SSLSocket.send` method now raises either :exc:`ssl." +"SSLWantReadError` or :exc:`ssl.SSLWantWriteError` on a non-blocking socket " +"if the operation would block. Previously, it would return ``0``. " +"(Contributed by Nikolaus Rath in :issue:`20951`.)" msgstr "" #: ../../whatsnew/3.5.rst:2413 @@ -3831,12 +3814,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:2420 msgid "" -"The deprecated \"strict\" mode and argument " -"of :class:`~html.parser.HTMLParser`, :meth:`!HTMLParser.error`, and " -"the :exc:`!HTMLParserError` exception have been removed. (Contributed by " -"Ezio Melotti in :issue:`15114`.) The *convert_charrefs* argument " -"of :class:`~html.parser.HTMLParser` is now ``True`` by default. " -"(Contributed by Berker Peksag in :issue:`21047`.)" +"The deprecated \"strict\" mode and argument of :class:`~html.parser." +"HTMLParser`, :meth:`!HTMLParser.error`, and the :exc:`!HTMLParserError` " +"exception have been removed. (Contributed by Ezio Melotti in :issue:" +"`15114`.) The *convert_charrefs* argument of :class:`~html.parser." +"HTMLParser` is now ``True`` by default. (Contributed by Berker Peksag in :" +"issue:`21047`.)" msgstr "" #: ../../whatsnew/3.5.rst:2426 @@ -3850,11 +3833,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:2432 msgid "" -"If the current directory is set to a directory that no longer exists " -"then :exc:`FileNotFoundError` will no longer be raised and " -"instead :meth:`~importlib.machinery.FileFinder.find_spec` will return " -"``None`` **without** caching ``None`` in :data:`sys.path_importer_cache`, " -"which is different than the typical case (:issue:`22834`)." +"If the current directory is set to a directory that no longer exists then :" +"exc:`FileNotFoundError` will no longer be raised and instead :meth:" +"`~importlib.machinery.FileFinder.find_spec` will return ``None`` **without** " +"caching ``None`` in :data:`sys.path_importer_cache`, which is different than " +"the typical case (:issue:`22834`)." msgstr "" #: ../../whatsnew/3.5.rst:2438 @@ -3889,29 +3872,28 @@ msgstr "" #: ../../whatsnew/3.5.rst:2459 msgid "" "The :class:`http.cookies.Morsel` dict-like interface has been made self " -"consistent: morsel comparison now takes " -"the :attr:`~http.cookies.Morsel.key` and :attr:`~http.cookies.Morsel.value` " -"into account, :meth:`~http.cookies.Morsel.copy` now results in " -"a :class:`~http.cookies.Morsel` instance rather than a :class:`dict`, " -"and :meth:`~http.cookies.Morsel.update` will now raise an exception if any " -"of the keys in the update dictionary are invalid. In addition, the " -"undocumented *LegalChars* parameter of :func:`~http.cookies.Morsel.set` is " -"deprecated and is now ignored. (Contributed by Demian Brecht " -"in :issue:`2211`.)" +"consistent: morsel comparison now takes the :attr:`~http.cookies.Morsel." +"key` and :attr:`~http.cookies.Morsel.value` into account, :meth:`~http." +"cookies.Morsel.copy` now results in a :class:`~http.cookies.Morsel` instance " +"rather than a :class:`dict`, and :meth:`~http.cookies.Morsel.update` will " +"now raise an exception if any of the keys in the update dictionary are " +"invalid. In addition, the undocumented *LegalChars* parameter of :func:" +"`~http.cookies.Morsel.set` is deprecated and is now ignored. (Contributed " +"by Demian Brecht in :issue:`2211`.)" msgstr "" #: ../../whatsnew/3.5.rst:2469 msgid "" ":pep:`488` has removed ``.pyo`` files from Python and introduced the " -"optional ``opt-`` tag in ``.pyc`` file names. " -"The :func:`importlib.util.cache_from_source` has gained an *optimization* " -"parameter to help control the ``opt-`` tag. Because of this, the " -"*debug_override* parameter of the function is now deprecated. ``.pyo`` files " -"are also no longer supported as a file argument to the Python interpreter " -"and thus serve no purpose when distributed on their own (i.e. sourceless " -"code distribution). Due to the fact that the magic number for bytecode has " -"changed in Python 3.5, all old ``.pyo`` files from previous versions of " -"Python are invalid regardless of this PEP." +"optional ``opt-`` tag in ``.pyc`` file names. The :func:`importlib.util." +"cache_from_source` has gained an *optimization* parameter to help control " +"the ``opt-`` tag. Because of this, the *debug_override* parameter of the " +"function is now deprecated. ``.pyo`` files are also no longer supported as a " +"file argument to the Python interpreter and thus serve no purpose when " +"distributed on their own (i.e. sourceless code distribution). Due to the " +"fact that the magic number for bytecode has changed in Python 3.5, all old " +"``.pyo`` files from previous versions of Python are invalid regardless of " +"this PEP." msgstr "" #: ../../whatsnew/3.5.rst:2480 @@ -3955,17 +3937,16 @@ msgid "" "duplicated if the inherited documentation is appropriate. To suppress an " "inherited string, an empty string must be specified (or the documentation " "may be filled in). This change affects the output of the :mod:`pydoc` " -"module and the :func:`help` function. (Contributed by Serhiy Storchaka " -"in :issue:`15582`.)" +"module and the :func:`help` function. (Contributed by Serhiy Storchaka in :" +"issue:`15582`.)" msgstr "" #: ../../whatsnew/3.5.rst:2507 msgid "" "Nested :func:`functools.partial` calls are now flattened. If you were " -"relying on the previous behavior, you can now either add an attribute to " -"a :func:`functools.partial` object or you can create a subclass " -"of :func:`functools.partial`. (Contributed by Alexander Belopolsky " -"in :issue:`7830`.)" +"relying on the previous behavior, you can now either add an attribute to a :" +"func:`functools.partial` object or you can create a subclass of :func:" +"`functools.partial`. (Contributed by Alexander Belopolsky in :issue:`7830`.)" msgstr "" #: ../../whatsnew/3.5.rst:2514 @@ -3981,8 +3962,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:2521 msgid "" -"The :c:type:`!PyMemAllocator` structure was renamed " -"to :c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added." +"The :c:type:`!PyMemAllocator` structure was renamed to :c:type:" +"`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "" #: ../../whatsnew/3.5.rst:2524 @@ -3997,17 +3978,17 @@ msgstr "" msgid "" "Because the lack of the :attr:`~type.__module__` attribute breaks pickling " "and introspection, a deprecation warning is now raised for builtin types " -"without the :attr:`~type.__module__` attribute. This will be " -"an :exc:`AttributeError` in the future. (Contributed by Serhiy Storchaka " -"in :issue:`20204`.)" +"without the :attr:`~type.__module__` attribute. This will be an :exc:" +"`AttributeError` in the future. (Contributed by Serhiy Storchaka in :issue:" +"`20204`.)" msgstr "" #: ../../whatsnew/3.5.rst:2535 msgid "" -"As part of the :pep:`492` implementation, the ``tp_reserved`` slot " -"of :c:type:`PyTypeObject` was replaced with " -"a :c:member:`~PyTypeObject.tp_as_async` slot. Refer to :ref:`coro-objects` " -"for new types, structures and functions." +"As part of the :pep:`492` implementation, the ``tp_reserved`` slot of :c:" +"type:`PyTypeObject` was replaced with a :c:member:`~PyTypeObject." +"tp_as_async` slot. Refer to :ref:`coro-objects` for new types, structures " +"and functions." msgstr "" #: ../../whatsnew/3.5.rst:2542 @@ -4035,8 +4016,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:2556 msgid "" -"More selective regeneration targets are also defined - " -"see :source:`Makefile.pre.in` for details." +"More selective regeneration targets are also defined - see :source:`Makefile." +"pre.in` for details." msgstr "" #: ../../whatsnew/3.5.rst:2559 ../../whatsnew/3.5.rst:2572 From c6d74e2fc18c9f032e2aa02ab38c260aaf3d993f Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Thu, 9 Oct 2025 15:08:51 +0800 Subject: [PATCH 06/28] Translate `c-api/slice.po` (#1149) Co-authored-by: W. H. Wang --- c-api/slice.po | 57 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/c-api/slice.po b/c-api/slice.po index 57288261d15..7cbae1a4eef 100644 --- a/c-api/slice.po +++ b/c-api/slice.po @@ -3,13 +3,14 @@ # # Translators: # Leon H., 2017 +# Weilin Du, 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-18 00:13+0000\n" -"PO-Revision-Date: 2018-05-23 14:07+0000\n" -"Last-Translator: Adrian Liaw \n" +"PO-Revision-Date: 2025-10-08 21:36+0800\n" +"Last-Translator: Weilin Du <1372449351@qq.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -17,6 +18,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.6\n" #: ../../c-api/slice.rst:6 msgid "Slice Objects" @@ -26,13 +28,14 @@ msgstr "切片物件" msgid "" "The type object for slice objects. This is the same as :class:`slice` in " "the Python layer." -msgstr "" +msgstr "slice 物件的型別物件。這與 Python 層中的 :class:`slice` 相同。" #: ../../c-api/slice.rst:17 msgid "" "Return true if *ob* is a slice object; *ob* must not be ``NULL``. This " "function always succeeds." msgstr "" +"如果 *ob* 是 slice 物件,則回傳 true;*ob* 不能是 ``NULL`` 。此函式永遠成功。" #: ../../c-api/slice.rst:23 msgid "" @@ -41,12 +44,15 @@ msgid "" "the same names. Any of the values may be ``NULL``, in which case the " "``None`` will be used for the corresponding attribute." msgstr "" +"以指定的值回傳一個新的切片物件。*start*、*stop* 及 *step* 參數會被用為同名的 " +"slice 物件屬性值。任何值都可能是 ``NULL``,在這種情況下,``None`` 將用於相對" +"應的屬性。" #: ../../c-api/slice.rst:28 msgid "" "Return ``NULL`` with an exception set if the new object could not be " "allocated." -msgstr "" +msgstr "如果無法分配新物件,則回傳 ``NULL`` 並設定例外。" #: ../../c-api/slice.rst:34 msgid "" @@ -54,6 +60,8 @@ msgid "" "assuming a sequence of length *length*. Treats indices greater than *length* " "as errors." msgstr "" +"從 slice 物件 *slice* 讀取開始、停止和步進索引,假設序列長度為 *length*。將大" +"於 *length* 的索引視為錯誤。" #: ../../c-api/slice.rst:38 msgid "" @@ -61,15 +69,17 @@ msgid "" "one of the indices was not ``None`` and failed to be converted to an " "integer, in which case ``-1`` is returned with an exception set)." msgstr "" +"成功時回傳 ``0``,錯誤時回傳 ``-1``,並無例外設定(除非其中一個索引不是 " +"``None`` 並且未能轉換成整數,在這種情況下會回傳 ``-1`` ,並有設定例外)。" #: ../../c-api/slice.rst:42 msgid "You probably do not want to use this function." -msgstr "" +msgstr "你可能不想使用此功能。" #: ../../c-api/slice.rst:44 ../../c-api/slice.rst:75 msgid "" "The parameter type for the *slice* parameter was ``PySliceObject*`` before." -msgstr "" +msgstr "之前 *slice* 的參數型別是 ``PySliceObject*`` 。" #: ../../c-api/slice.rst:51 msgid "" @@ -79,6 +89,9 @@ msgid "" "bounds indices are clipped in a manner consistent with the handling of " "normal slices." msgstr "" +"可用來取代 :c:func:`PySlice_GetIndices`。從假設序列長度為 *length* 的 slice " +"物件 *slice* 擷取開始、停止和步長索引,並將 slice 的長度存入 *slicelength*。" +"超出範圍的索引會被剪切,剪切方式與一般切片的處理方式一致。" #: ../../c-api/slice.rst:57 msgid "Return ``0`` on success and ``-1`` on error with an exception set." @@ -90,6 +103,9 @@ msgid "" "should be replaced by a combination of :c:func:`PySlice_Unpack` " "and :c:func:`PySlice_AdjustIndices` where ::" msgstr "" +"這個函式對於可調整大小的序列並不安全。它的呼叫應該" +"被 :c:func:`PySlice_Unpack` 和 :c:func:`PySlice_AdjustIndices` 的組合取代,其" +"中: ::" #: ../../c-api/slice.rst:64 msgid "" @@ -98,10 +114,14 @@ msgid "" " // return error\n" "}" msgstr "" +"if (PySlice_GetIndicesEx(slice, length, &start, &stop, &step, &slicelength) " +"< 0) {\n" +" // return error\n" +"}" #: ../../c-api/slice.rst:68 msgid "is replaced by ::" -msgstr "" +msgstr "被更換為: ::" #: ../../c-api/slice.rst:70 msgid "" @@ -110,6 +130,10 @@ msgid "" "}\n" "slicelength = PySlice_AdjustIndices(length, &start, &stop, step);" msgstr "" +"if (PySlice_Unpack(slice, &start, &stop, &step) < 0) {\n" +" // return error\n" +"}\n" +"slicelength = PySlice_AdjustIndices(length, &start, &stop, step);" #: ../../c-api/slice.rst:79 msgid "" @@ -119,6 +143,10 @@ msgid "" "PySlice_Unpack` and :c:func:`!PySlice_AdjustIndices`. Arguments *start*, " "*stop* and *step* are evaluated more than once." msgstr "" +"如果 ``Py_LIMITED_API`` 沒有設定或設定為 ``0x03050400`` 和 ``0x03060000`` (不" +"包括) 或 ``0x03060100`` 或更高的值 :c:func:`!PySlice_GetIndicesEx` 是使" +"用 :c:func:`!PySlice_Unpack` 和 :c:func:`!PySlice_AdjustIndices` 來實作一個巨集" +"。引數 *start*、*stop* 和 *step* 會被計算多次。" #: ../../c-api/slice.rst:86 msgid "" @@ -126,6 +154,9 @@ msgid "" "between ``0x03060000`` and ``0x03060100`` (not including) :c:func:`!" "PySlice_GetIndicesEx` is a deprecated function." msgstr "" +"如果 ``Py_LIMITED_API`` 設定為小於 ``0x03050400`` 或介於 ``0x03060000`` 和 " +"``0x03060100`` 之間 (不包括邊界值) :c:func:`!PySlice_GetIndicesEx` 是一個" +"已廢棄的函式。" #: ../../c-api/slice.rst:94 msgid "" @@ -135,6 +166,10 @@ msgid "" "``PY_SSIZE_T_MIN`` to ``PY_SSIZE_T_MIN``, and silently boost the step values " "less than ``-PY_SSIZE_T_MAX`` to ``-PY_SSIZE_T_MAX``." msgstr "" +"以 C 整數的形式從 slice 物件中抽取 start、stop 及 step 資料成員。將大於 " +"``PY_SSIZE_T_MAX`` 的值靜默減少為 ``PY_SSIZE_T_MAX``,將小於 ``PY_SSIZE_T_MIN`` " +"的 start 和 stop 值靜默提升為 ``PY_SSIZE_T_MIN``,將小於 ``-PY_SSIZE_T_MAX`` " +"的 step 值靜默提升為 ``-PY_SSIZE_T_MAX``。" #: ../../c-api/slice.rst:100 msgid "Return ``-1`` with an exception set on error, ``0`` on success." @@ -146,12 +181,14 @@ msgid "" "Out of bounds indices are clipped in a manner consistent with the handling " "of normal slices." msgstr "" +"假設序列長度為指定長度,調整開始/結束切片索引。超出範圍的索引會以與處理正常切" +"片一致的方式切除。" #: ../../c-api/slice.rst:111 msgid "" "Return the length of the slice. Always successful. Doesn't call Python " "code." -msgstr "" +msgstr "回傳切片的長度。永遠成功。不呼叫 Python 程式碼。" #: ../../c-api/slice.rst:118 msgid "Ellipsis Object" @@ -162,12 +199,16 @@ msgid "" "The type of Python :const:`Ellipsis` object. Same " "as :class:`types.EllipsisType` in the Python layer." msgstr "" +"Python :const:`Ellipsis` 物件的型別。與 Python 層中" +"的 :class:`types.EllipsisType` 相同。" #: ../../c-api/slice.rst:129 msgid "" "The Python ``Ellipsis`` object. This object has no methods. " "Like :c:data:`Py_None`, it is an :term:`immortal` singleton object." msgstr "" +"Python ``Ellipsis`` 物件。這個物件沒有方法。就像 :c:data:`Py_None` 一樣,它是" +"一個 :term:`immortal` 單一物件。" #: ../../c-api/slice.rst:132 msgid ":c:data:`Py_Ellipsis` is immortal." From 6a2f51a6db93206309d3596819814e11bff1328b Mon Sep 17 00:00:00 2001 From: Yorkxe <150600457+Yorkxe@users.noreply.github.com> Date: Thu, 23 Oct 2025 01:17:35 +0800 Subject: [PATCH 07/28] Working on c-api/datetime.po (#1152) * Working on c-api/datetime.po * Fix the translate --- c-api/datetime.po | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/c-api/datetime.po b/c-api/datetime.po index 2689e72e405..9927a5172e1 100644 --- a/c-api/datetime.po +++ b/c-api/datetime.po @@ -5,13 +5,14 @@ # Ching-Lung Chuang, 2015 # Liang-Bo Wang , 2015 # Matt Wang , 2023 +# Yorkxe , 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-08-22 00:03+0000\n" -"PO-Revision-Date: 2023-07-01 04:14+0800\n" -"Last-Translator: Matt Wang \n" +"PO-Revision-Date: 2025-10-14 20:39+0800\n" +"Last-Translator: Yorkxe \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -43,39 +44,45 @@ msgstr "" #: ../../c-api/datetime.rst:18 msgid "This subtype of :c:type:`PyObject` represents a Python date object." -msgstr "" +msgstr "此 :c:type:`PyObject` 子型別代表 Python date 物件" #: ../../c-api/datetime.rst:22 msgid "This subtype of :c:type:`PyObject` represents a Python datetime object." -msgstr "" +msgstr "此 :c:type:`PyObject` 子型別代表 Python datetime 物件" #: ../../c-api/datetime.rst:26 msgid "This subtype of :c:type:`PyObject` represents a Python time object." -msgstr "" +msgstr "此 :c:type:`PyObject` 子型別代表 Python time 物件" #: ../../c-api/datetime.rst:30 msgid "" "This subtype of :c:type:`PyObject` represents the difference between two " "datetime values." -msgstr "" +msgstr "此 :c:type:`PyObject` 子型別代表兩個 datetime 物件的差值" #: ../../c-api/datetime.rst:34 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python date type; it " "is the same object as :class:`datetime.date` in the Python layer." msgstr "" +"此 :c:type:`PyTypeObject` 實例代表 Python date 型別,與 Python layer 中的 :" +"class:`datetime.date` 是同一物件" #: ../../c-api/datetime.rst:39 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python datetime type; " "it is the same object as :class:`datetime.datetime` in the Python layer." msgstr "" +"此 :c:type:`PyTypeObject` 實例代表 Python datetime 型別,與 Python layer 中" +"的 :class:`datetime.datetime` 是同一物件" #: ../../c-api/datetime.rst:44 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python time type; it " "is the same object as :class:`datetime.time` in the Python layer." msgstr "" +"此 :c:type:`PyTypeObject` 實例代表 Python time 型別,與 Python layer 中的 :" +"class:`datetime.datetime.time` 是同一物件" #: ../../c-api/datetime.rst:49 msgid "" @@ -83,12 +90,16 @@ msgid "" "difference between two datetime values; it is the same object as :class:" "`datetime.timedelta` in the Python layer." msgstr "" +"此 :c:type:`PyTypeObject` 實例代表 Python 兩個 datetime 物件的型別,與 " +"Python layer 中的 :class:`datetime.timedelta` 是同一物件" #: ../../c-api/datetime.rst:55 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python time zone info " "type; it is the same object as :class:`datetime.tzinfo` in the Python layer." msgstr "" +"此 :c:type:`PyTypeObject` 實例代表 Python 時區資訊型別,與 Python layer 中" +"的 :class:`datetime.tzinfo` 是同一物件" #: ../../c-api/datetime.rst:59 msgid "Macro for access to the UTC singleton:" From 10ce74ef7c5a1d06d431899f3aa6d33b399d8b82 Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 06:17:33 +0800 Subject: [PATCH 08/28] Sync with CPython 3.14 (#1148) Co-authored-by: github-actions[bot] Co-authored-by: Matt.Wang --- bugs.po | 91 +- c-api/arg.po | 157 +- c-api/buffer.po | 2 +- c-api/gcsupport.po | 16 +- c-api/init.po | 545 +-- c-api/init_config.po | 4 +- c-api/memory.po | 6 +- c-api/module.po | 362 +- c-api/object.po | 196 +- c-api/type.po | 2 +- c-api/typeobj.po | 986 +++-- c-api/unicode.po | 212 +- c-api/veryhigh.po | 67 +- deprecations/index.po | 216 +- deprecations/pending-removal-in-3.17.po | 80 +- deprecations/pending-removal-in-future.po | 257 +- extending/extending.po | 517 +-- extending/newtypes_tutorial.po | 4 + faq/general.po | 86 +- faq/programming.po | 6 +- howto/a-conceptual-overview-of-asyncio.po | 252 +- howto/enum.po | 68 + howto/functional.po | 9 + howto/isolating-extensions.po | 6 +- howto/logging-cookbook.po | 54 + howto/sorting.po | 17 + howto/unicode.po | 6 + library/annotationlib.po | 433 +- library/argparse.po | 69 + library/ast.po | 1055 +++-- library/asyncio-queue.po | 110 +- library/asyncio-stream.po | 104 +- library/bisect.po | 29 + library/cmath.po | 48 +- library/codecs.po | 1074 ++--- library/collections.abc.po | 129 +- library/collections.po | 7 + library/compression.po | 27 +- library/crypt.po | 10 +- library/csv.po | 211 +- library/ctypes.po | 1365 ++++--- library/curses.po | 171 +- library/dataclasses.po | 420 +- library/datetime.po | 36 + library/dbm.po | 351 +- library/decimal.po | 18 +- library/dialog.po | 2 +- library/difflib.po | 6 +- library/dis.po | 770 ++-- library/doctest.po | 8 + library/email.compat32-message.po | 2 +- library/email.message.po | 2 +- library/enum.po | 288 +- library/exceptions.po | 2 +- library/fractions.po | 131 +- library/functions.po | 749 ++-- library/functools.po | 277 +- library/gc.po | 99 +- library/glob.po | 109 +- library/hashlib.po | 145 +- library/html.parser.po | 9 + library/http.po | 110 +- library/idle.po | 4 +- library/imaplib.po | 6 + library/importlib.po | 385 +- library/importlib.resources.po | 159 +- library/inspect.po | 11 +- library/ipaddress.po | 4 +- library/json.po | 8 +- library/logging.config.po | 4 +- library/mailbox.po | 82 +- library/mimetypes.po | 4 +- library/mmap.po | 72 +- library/multiprocessing.po | 2 +- library/numbers.po | 140 +- library/optparse.po | 14 +- library/os.po | 19 +- library/pathlib.po | 11 + library/pickle.po | 2 +- library/platform.po | 211 +- library/plistlib.po | 6 +- library/pprint.po | 94 +- library/queue.po | 170 +- library/re.po | 4 +- library/resource.po | 247 +- library/select.po | 8 +- library/selectors.po | 10 +- library/shutil.po | 6 + library/signal.po | 525 +-- library/smtplib.po | 264 +- library/sqlite3.po | 783 ++-- library/ssl.po | 1075 ++--- library/statistics.po | 2 + library/stdtypes.po | 1911 ++++----- library/string.po | 6 + library/string.templatelib.po | 84 +- library/subprocess.po | 337 +- library/sys.monitoring.po | 4 +- library/sysconfig.po | 141 +- library/textwrap.po | 6 + library/time.po | 16 +- library/tkinter.po | 192 +- library/tokenize.po | 2 +- library/traceback.po | 8 + library/turtle.po | 1118 +++--- library/typing.po | 475 ++- library/unicodedata.po | 10 +- library/urllib.parse.po | 4 +- library/urllib.request.po | 15 + library/warnings.po | 114 +- library/weakref.po | 22 + library/xml.po | 12 +- library/xmlrpc.client.po | 4 +- library/zlib.po | 412 +- library/zoneinfo.po | 19 +- reference/compound_stmts.po | 1015 ++--- reference/datamodel.po | 1249 +++--- reference/executionmodel.po | 357 +- reference/expressions.po | 623 +-- reference/import.po | 2 +- reference/lexical_analysis.po | 1006 +++-- reference/simple_stmts.po | 75 +- sphinx.po | 140 +- tutorial/controlflow.po | 2 +- tutorial/datastructures.po | 226 +- tutorial/introduction.po | 2 +- using/android.po | 40 +- using/cmdline.po | 353 +- using/configure.po | 1048 ++--- using/ios.po | 412 +- using/windows.po | 1015 +++-- whatsnew/2.0.po | 6 + whatsnew/2.1.po | 13 +- whatsnew/2.2.po | 30 + whatsnew/2.3.po | 150 +- whatsnew/2.4.po | 19 +- whatsnew/2.5.po | 9 +- whatsnew/2.6.po | 2033 +++++----- whatsnew/2.7.po | 70 +- whatsnew/3.10.po | 1465 ++++--- whatsnew/3.12.po | 960 ++--- whatsnew/3.13.po | 954 ++--- whatsnew/3.14.po | 4439 +++++++++++---------- whatsnew/3.2.po | 15 +- whatsnew/3.3.po | 11 + whatsnew/3.4.po | 31 + whatsnew/3.5.po | 2 +- whatsnew/3.6.po | 8 + whatsnew/3.7.po | 15 +- whatsnew/3.8.po | 16 + whatsnew/3.9.po | 17 + 151 files changed, 21008 insertions(+), 18664 deletions(-) diff --git a/bugs.po b/bugs.po index 615b5d684a4..4bd3a6eb498 100644 --- a/bugs.po +++ b/bugs.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-20 00:15+0000\n" "PO-Revision-Date: 2022-08-31 12:34+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -40,8 +40,8 @@ msgstr "" #: ../../bugs.rst:11 msgid "" "It can be sometimes faster to fix bugs yourself and contribute patches to " -"Python as it streamlines the process and involves less people. Learn how " -"to :ref:`contribute `." +"Python as it streamlines the process and involves less people. Learn how to :" +"ref:`contribute `." msgstr "" "有時候自己直接修復錯誤並且送出一個修正給 Python 會比較快,因為這樣會加速流程" "而且不會困擾到太多人。學習如何\\ :ref:`貢獻給 Python `. If you have a suggestion on how to fix it, include that as " "well." msgstr "" -"如果你在這份說明文件中發現了錯誤並想要提出改進方案,請將錯誤報告提交到" -"\\ :ref:`錯誤追蹤系統 (issue tracker) `。如果你有相應的修正建議,請" -"一併提交。(譯者註:如果是繁體中文說明文件翻譯相關的錯誤,請提交到 https://" -"github.com/python/python-docs-zh-tw/issues。)" +"如果你在這份說明文件中發現了錯誤並想要提出改進方案,請將錯誤報告提交到\\ :" +"ref:`錯誤追蹤系統 (issue tracker) `。如果你有相應的修正建" +"議,請一併提交。(譯者註:如果是繁體中文說明文件翻譯相關的錯誤,請提交到 " +"https://github.com/python/python-docs-zh-tw/issues。)" -#: ../../bugs.rst:22 +#: ../../bugs.rst:24 +msgid "" +"If the bug or suggested improvement concerns the translation of this " +"documentation, submit the report to the `translation’s repository " +"`_ instead." +msgstr "" +"如果錯誤或建議的改進涉及此文件的翻譯,請將報告提交到\\ `翻譯存儲庫 " +"`_。" + +#: ../../bugs.rst:28 msgid "" "You can also open a discussion item on our `Documentation Discourse forum " "`_." @@ -71,33 +80,36 @@ msgstr "" "你也可以在我們的\\ `說明文件 Discourse 討論區 `_\\ 中新增一個討論事項。" -#: ../../bugs.rst:25 +#: ../../bugs.rst:31 msgid "" "If you find a bug in the theme (HTML / CSS / JavaScript) of the " "documentation, please submit a bug report on the `python-doc-theme issue " "tracker `_." msgstr "" +"如果你發現文件主題 (HTML / CSS / JavaScript) 中存在錯誤,請在 `python-doc-" +"theme 問題追蹤系統 `_\\ 上提交錯誤報" +"告。" -#: ../../bugs.rst:31 +#: ../../bugs.rst:37 msgid "`Documentation bugs`_" msgstr "`說明文件錯誤`_" -#: ../../bugs.rst:32 +#: ../../bugs.rst:38 msgid "" "A list of documentation bugs that have been submitted to the Python issue " "tracker." msgstr "一系列已被提交至 Python 問題追蹤系統的有關說明文件的錯誤。" -#: ../../bugs.rst:34 +#: ../../bugs.rst:40 msgid "`Issue Tracking `_" msgstr "`問題追蹤系統 `_" -#: ../../bugs.rst:35 +#: ../../bugs.rst:41 msgid "" "Overview of the process involved in reporting an improvement on the tracker." msgstr "在追蹤系統上回報改進建議的過程簡介。" -#: ../../bugs.rst:37 +#: ../../bugs.rst:43 msgid "" "`Helping with Documentation `_" @@ -105,20 +117,20 @@ msgstr "" "`貢獻說明文件 `_" -#: ../../bugs.rst:38 +#: ../../bugs.rst:44 msgid "" "Comprehensive guide for individuals that are interested in contributing to " "Python documentation." msgstr "給有意成為 Python 說明文件貢獻者的綜合指南。" -#: ../../bugs.rst:40 +#: ../../bugs.rst:46 msgid "" "`Documentation Translations `_" msgstr "" "`說明文件翻譯 `_" -#: ../../bugs.rst:41 +#: ../../bugs.rst:47 msgid "" "A list of GitHub pages for documentation translation and their primary " "contacts." @@ -126,11 +138,11 @@ msgstr "" "一份 GitHub 網頁的清單,裡面有各個說明文件翻譯團隊的連結,以及他們的主要聯絡" "人。" -#: ../../bugs.rst:47 +#: ../../bugs.rst:53 msgid "Using the Python issue tracker" msgstr "使用 Python 問題追蹤系統" -#: ../../bugs.rst:49 +#: ../../bugs.rst:55 msgid "" "Issue reports for Python itself should be submitted via the GitHub issues " "tracker (https://github.com/python/cpython/issues). The GitHub issues " @@ -141,7 +153,7 @@ msgstr "" "python/cpython/issues) 提交。這個 GitHub 問題追蹤系統提供了一個網頁表單,可以" "輸入並提交相關資訊給開發者。" -#: ../../bugs.rst:54 +#: ../../bugs.rst:60 msgid "" "The first step in filing a report is to determine whether the problem has " "already been reported. The advantage in doing so, aside from saving the " @@ -156,7 +168,7 @@ msgstr "" "本中修正了這個問題,也有可能需要更詳細的資訊(在這種情況下,如果可以,非常歡" "迎你提供資訊!)。要確認是否重複回報,請使用頁面頂端的搜尋框來搜尋追蹤系統。" -#: ../../bugs.rst:61 +#: ../../bugs.rst:67 msgid "" "If the problem you're reporting is not already in the list, log in to " "GitHub. If you don't already have a GitHub account, create a new account " @@ -166,7 +178,7 @@ msgstr "" "如果你想回報的問題還沒有在問題列表出現過,請登入 GitHub。如果你還沒有 GitHub " "帳戶,請點選「Sign up」連結來建立一個新的帳戶。你無法以匿名方式提交錯誤報告。" -#: ../../bugs.rst:66 +#: ../../bugs.rst:72 msgid "" "Being now logged in, you can submit an issue. Click on the \"New issue\" " "button in the top bar to report a new issue." @@ -174,18 +186,18 @@ msgstr "" "如果已經登入,那你就可以提交問題了。請點選列表頂端區域的「New issue」按鈕,來" "回報一個新的問題。" -#: ../../bugs.rst:69 +#: ../../bugs.rst:75 msgid "The submission form has two fields, \"Title\" and \"Comment\"." msgstr "提交的表單中有兩個欄位,「Title」及「Comment」。" -#: ../../bugs.rst:71 +#: ../../bugs.rst:77 msgid "" "For the \"Title\" field, enter a *very* short description of the problem; " "fewer than ten words is good." msgstr "" "在「Title」欄位,輸入對該問題\\ *非常*\\ 簡短的描述;最好少於十個單字。" -#: ../../bugs.rst:74 +#: ../../bugs.rst:80 msgid "" "In the \"Comment\" field, describe the problem in detail, including what you " "expected to happen and what did happen. Be sure to include whether any " @@ -196,7 +208,7 @@ msgstr "" "確定說明中包含了涉及到的任何擴充模組,以及你當時所使用的硬體和軟體平台(視情" "況而定,可以附上版本資訊)。" -#: ../../bugs.rst:79 +#: ../../bugs.rst:85 msgid "" "Each issue report will be reviewed by a developer who will determine what " "needs to be done to correct the problem. You will receive an update each " @@ -205,15 +217,15 @@ msgstr "" "每一份問題報告都會被一位開發人員查核,並由他決定要做出什麼變更來修正這個問" "題。每當該問題有修正動作時,你會收到更新回報。" -#: ../../bugs.rst:86 +#: ../../bugs.rst:92 msgid "" "`How to Report Bugs Effectively `_" msgstr "" -"`如何有效地回報錯誤 `_" +"`如何有效地回報錯誤 `_" -#: ../../bugs.rst:87 +#: ../../bugs.rst:93 msgid "" "Article which goes into some detail about how to create a useful bug report. " "This describes what kind of information is useful and why it is useful." @@ -221,14 +233,14 @@ msgstr "" "這篇文章詳細說明如何建立一份有用的錯誤報告。它描述了什麼樣的資訊是有用的,以" "及這些資訊為什麼有用。" -#: ../../bugs.rst:90 +#: ../../bugs.rst:96 msgid "" "`Bug Writing Guidelines `_" msgstr "" "`錯誤撰寫指南 `_" -#: ../../bugs.rst:91 +#: ../../bugs.rst:97 msgid "" "Information about writing a good bug report. Some of this is specific to " "the Mozilla project, but describes general good practices." @@ -236,11 +248,11 @@ msgstr "" "撰寫一份優良錯誤報告的相關資訊。部分的文章內容是針對 Mozilla 專案,但它也描述" "了通用的好習慣。" -#: ../../bugs.rst:97 +#: ../../bugs.rst:103 msgid "Getting started contributing to Python yourself" msgstr "開始讓自己貢獻 Python" -#: ../../bugs.rst:99 +#: ../../bugs.rst:105 msgid "" "Beyond just reporting bugs that you find, you are also welcome to submit " "patches to fix them. You can find more information on how to get started " @@ -252,14 +264,3 @@ msgstr "" "你可以在 `Python 開發者指南`_\\ 中找到如何開始修補 Python 的更多資訊。如果你" "有任何問題,`核心導師郵寄清單`_\\ 是一個友善的地方,你可以在那裡得到,關於 " "Python 修正錯誤的過程中,所有問題的答案。" - -#~ msgid "" -#~ "If you're short on time, you can also email documentation bug reports to " -#~ "docs@python.org (behavioral bugs can be sent to python-list@python.org). " -#~ "'docs@' is a mailing list run by volunteers; your request will be " -#~ "noticed, though it may take a while to be processed." -#~ msgstr "" -#~ "如果你的時間有限,也可以將說明文件的錯誤報告以電子郵件寄到 " -#~ "docs@python.org\\ (程式碼執行的錯誤可以寄到 python-list@python.org)。" -#~ "「docs@」是一個由志工們所運行的郵寄清單;你的請求會被注意到,但可能需要一" -#~ "些時間才會被處理。" diff --git a/c-api/arg.po b/c-api/arg.po index 61c618181fc..faecd8282de 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-25 00:15+0000\n" "PO-Revision-Date: 2022-10-16 03:21+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,17 +25,17 @@ msgstr "剖析引數與建置數值" #: ../../c-api/arg.rst:8 msgid "" "These functions are useful when creating your own extension functions and " -"methods. Additional information and examples are available " -"in :ref:`extending-index`." +"methods. Additional information and examples are available in :ref:" +"`extending-index`." msgstr "" #: ../../c-api/arg.rst:12 msgid "" -"The first three of these functions " -"described, :c:func:`PyArg_ParseTuple`, :c:func:`PyArg_ParseTupleAndKeywords`, " -"and :c:func:`PyArg_Parse`, all use *format strings* which are used to tell " -"the function about the expected arguments. The format strings use the same " -"syntax for each of these functions." +"The first three of these functions described, :c:func:`PyArg_ParseTuple`, :c:" +"func:`PyArg_ParseTupleAndKeywords`, and :c:func:`PyArg_Parse`, all use " +"*format strings* which are used to tell the function about the expected " +"arguments. The format strings use the same syntax for each of these " +"functions." msgstr "" #: ../../c-api/arg.rst:19 @@ -56,7 +56,7 @@ msgstr "" #: ../../c-api/arg.rst:33 msgid "Strings and buffers" -msgstr "" +msgstr "字串與緩衝區" #: ../../c-api/arg.rst:37 msgid "" @@ -108,10 +108,10 @@ msgstr "" #: ../../c-api/arg.rst:70 msgid "" -"To ensure that the underlying buffer may be safely borrowed, the " -"object's :c:member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. " -"This disallows common mutable objects such as :class:`bytearray`, but also " -"some read-only objects such as :class:`memoryview` of :class:`bytes`." +"To ensure that the underlying buffer may be safely borrowed, the object's :c:" +"member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. This " +"disallows common mutable objects such as :class:`bytearray`, but also some " +"read-only objects such as :class:`memoryview` of :class:`bytes`." msgstr "" #: ../../c-api/arg.rst:76 @@ -139,8 +139,8 @@ msgstr "" msgid "" "This format does not accept :term:`bytes-like objects `. " "If you want to accept filesystem paths and convert them to C character " -"strings, it is preferable to use the ``O&`` format " -"with :c:func:`PyUnicode_FSConverter` as *converter*." +"strings, it is preferable to use the ``O&`` format with :c:func:" +"`PyUnicode_FSConverter` as *converter*." msgstr "" #: ../../c-api/arg.rst:96 @@ -163,11 +163,11 @@ msgstr "" #: ../../c-api/arg.rst:106 msgid "" -"``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char " -"\\*, :c:type:`Py_ssize_t`]" +"``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char \\*, :" +"c:type:`Py_ssize_t`]" msgstr "" -"``s#`` (:class:`str`、唯讀的 :term:`bytes-like object`) [const char " -"\\*, :c:type:`Py_ssize_t`]" +"``s#`` (:class:`str`、唯讀的 :term:`bytes-like object`) [const char \\*, :c:" +"type:`Py_ssize_t`]" #: ../../c-api/arg.rst:107 msgid "" @@ -244,11 +244,11 @@ msgstr "" #: ../../c-api/arg.rst:141 msgid "" -"``y#`` (read-only :term:`bytes-like object`) [const char " -"\\*, :c:type:`Py_ssize_t`]" +"``y#`` (read-only :term:`bytes-like object`) [const char \\*, :c:type:" +"`Py_ssize_t`]" msgstr "" -"``y#`` (唯讀的 :term:`bytes-like object`) [const char " -"\\*, :c:type:`Py_ssize_t`]" +"``y#`` (唯讀的 :term:`bytes-like object`) [const char \\*, :c:type:" +"`Py_ssize_t`]" #: ../../c-api/arg.rst:142 msgid "" @@ -274,9 +274,9 @@ msgstr "``Y`` (:class:`bytearray`) [PyByteArrayObject \\*]" #: ../../c-api/arg.rst:151 msgid "" "Requires that the Python object is a :class:`bytearray` object, without " -"attempting any conversion. Raises :exc:`TypeError` if the object is not " -"a :class:`bytearray` object. The C variable may also be declared " -"as :c:expr:`PyObject*`." +"attempting any conversion. Raises :exc:`TypeError` if the object is not a :" +"class:`bytearray` object. The C variable may also be declared as :c:expr:" +"`PyObject*`." msgstr "" #: ../../c-api/arg.rst:155 @@ -298,8 +298,8 @@ msgstr "``w*`` (可讀寫 :term:`bytes-like object`) [Py_buffer]" msgid "" "This format accepts any object which implements the read-write buffer " "interface. It fills a :c:type:`Py_buffer` structure provided by the caller. " -"The buffer may contain embedded null bytes. The caller have to " -"call :c:func:`PyBuffer_Release` when it is done with the buffer." +"The buffer may contain embedded null bytes. The caller has to call :c:func:" +"`PyBuffer_Release` when it is done with the buffer." msgstr "" #: ../../c-api/arg.rst:166 @@ -327,8 +327,8 @@ msgstr "" msgid "" ":c:func:`PyArg_ParseTuple` will allocate a buffer of the needed size, copy " "the encoded data into this buffer and adjust *\\*buffer* to reference the " -"newly allocated storage. The caller is responsible for " -"calling :c:func:`PyMem_Free` to free the allocated buffer after use." +"newly allocated storage. The caller is responsible for calling :c:func:" +"`PyMem_Free` to free the allocated buffer after use." msgstr "" #: ../../c-api/arg.rst:183 @@ -348,11 +348,11 @@ msgstr "" #: ../../c-api/arg.rst:188 msgid "" -"``es#`` (:class:`str`) [const char \\*encoding, char " -"\\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" +"``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" +"`Py_ssize_t` \\*buffer_length]" msgstr "" -"``es#`` (:class:`str`) [const char \\*encoding, char " -"\\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" +"``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" +"`Py_ssize_t` \\*buffer_length]" #: ../../c-api/arg.rst:189 msgid "" @@ -428,11 +428,10 @@ msgstr "數字" #: ../../c-api/arg.rst:232 msgid "" "These formats allow representing Python numbers or single characters as C " -"numbers. Formats that require :class:`int`, :class:`float` " -"or :class:`complex` can also use the corresponding special " -"methods :meth:`~object.__index__`, :meth:`~object.__float__` " -"or :meth:`~object.__complex__` to convert the Python object to the required " -"type." +"numbers. Formats that require :class:`int`, :class:`float` or :class:" +"`complex` can also use the corresponding special methods :meth:`~object." +"__index__`, :meth:`~object.__float__` or :meth:`~object.__complex__` to " +"convert the Python object to the required type." msgstr "" #: ../../c-api/arg.rst:238 @@ -452,8 +451,8 @@ msgid "" "Convert a nonnegative Python integer to an unsigned tiny integer, stored in " "a C :c:expr:`unsigned char`." msgstr "" -"將一個 Python 非負整數轉換成無符號 tiny integer(小整數),儲存在 C " -"的 :c:expr:`unsigned`" +"將一個 Python 非負整數轉換成無符號 tiny integer(小整數),儲存在 C 的 :c:" +"expr:`unsigned`" #: ../../c-api/arg.rst:248 ../../c-api/arg.rst:648 msgid "``B`` (:class:`int`) [unsigned char]" @@ -464,8 +463,8 @@ msgid "" "Convert a Python integer to a tiny integer without overflow checking, stored " "in a C :c:expr:`unsigned char`." msgstr "" -"將一個 Python 整數轉換成 tiny integer,轉換過程無溢位檢查,儲存在 C " -"的 :c:expr:`unsigned char`。" +"將一個 Python 整數轉換成 tiny integer,轉換過程無溢位檢查,儲存在 C 的 :c:" +"expr:`unsigned char`。" #: ../../c-api/arg.rst:252 ../../c-api/arg.rst:642 msgid "``h`` (:class:`int`) [short int]" @@ -527,7 +526,7 @@ msgstr "" #: ../../c-api/arg.rst:273 ../../c-api/arg.rst:283 msgid "Use :meth:`~object.__index__` if available." -msgstr "" +msgstr "如有提供則使用 :meth:`~object.__index__`。" #: ../../c-api/arg.rst:276 ../../c-api/arg.rst:660 msgid "``L`` (:class:`int`) [long long]" @@ -616,9 +615,9 @@ msgstr "``O`` (object) [PyObject \\*]" #: ../../c-api/arg.rst:313 msgid "" "Store a Python object (without any conversion) in a C object pointer. The C " -"program thus receives the actual object that was passed. A " -"new :term:`strong reference` to the object is not created (i.e. its " -"reference count is not increased). The pointer stored is not ``NULL``." +"program thus receives the actual object that was passed. A new :term:" +"`strong reference` to the object is not created (i.e. its reference count is " +"not increased). The pointer stored is not ``NULL``." msgstr "" #: ../../c-api/arg.rst:319 @@ -652,12 +651,12 @@ msgstr "status = converter(object, address);" #: ../../c-api/arg.rst:336 msgid "" -"where *object* is the Python object to be converted and *address* is " -"the :c:expr:`void*` argument that was passed to the ``PyArg_Parse*`` " -"function. The returned *status* should be ``1`` for a successful conversion " -"and ``0`` if the conversion has failed. When the conversion fails, the " -"*converter* function should raise an exception and leave the content of " -"*address* unmodified." +"where *object* is the Python object to be converted and *address* is the :c:" +"expr:`void*` argument that was passed to the ``PyArg_Parse*`` function. The " +"returned *status* should be ``1`` for a successful conversion and ``0`` if " +"the conversion has failed. When the conversion fails, the *converter* " +"function should raise an exception and leave the content of *address* " +"unmodified." msgstr "" #: ../../c-api/arg.rst:345 @@ -671,8 +670,8 @@ msgstr "" #: ../../c-api/arg.rst:351 msgid "" -"Examples of converters: :c:func:`PyUnicode_FSConverter` " -"and :c:func:`PyUnicode_FSDecoder`." +"Examples of converters: :c:func:`PyUnicode_FSConverter` and :c:func:" +"`PyUnicode_FSDecoder`." msgstr "" #: ../../c-api/arg.rst:354 @@ -707,8 +706,8 @@ msgstr "" #: ../../c-api/arg.rst:372 msgid "" "If *items* contains format units which store a :ref:`borrowed buffer ` (``s``, ``s#``, ``z``, ``z#``, ``y``, or ``y#``) or " -"a :term:`borrowed reference` (``S``, ``Y``, ``U``, ``O``, or ``O!``), the " +"borrowed-buffer>` (``s``, ``s#``, ``z``, ``z#``, ``y``, or ``y#``) or a :" +"term:`borrowed reference` (``S``, ``Y``, ``U``, ``O``, or ``O!``), the " "object must be a Python tuple. The *converter* for the ``O&`` format unit in " "*items* must not store a borrowed buffer or a borrowed reference." msgstr "" @@ -773,8 +772,8 @@ msgstr "``;``" #: ../../c-api/arg.rst:411 msgid "" "The list of format units ends here; the string after the semicolon is used " -"as the error message *instead* of the default error message. ``:`` and " -"``;`` mutually exclude each other." +"as the error message *instead* of the default error message. ``:`` and ``;" +"`` mutually exclude each other." msgstr "" #: ../../c-api/arg.rst:415 @@ -833,9 +832,9 @@ msgstr "" #: ../../c-api/arg.rst:462 msgid "" -"The *keywords* parameter declaration is :c:expr:`char * const *` in C " -"and :c:expr:`const char * const *` in C++. This can be overridden with " -"the :c:macro:`PY_CXX_CONST` macro." +"The *keywords* parameter declaration is :c:expr:`char * const *` in C and :c:" +"expr:`const char * const *` in C++. This can be overridden with the :c:macro:" +"`PY_CXX_CONST` macro." msgstr "" #: ../../c-api/arg.rst:466 @@ -846,9 +845,9 @@ msgstr "新增對\\ :ref:`僅限位置參數 `\\ 的 #: ../../c-api/arg.rst:470 msgid "" -"The *keywords* parameter has now type :c:expr:`char * const *` in C " -"and :c:expr:`const char * const *` in C++, instead of :c:expr:`char **`. " -"Added support for non-ASCII keyword parameter names." +"The *keywords* parameter has now type :c:expr:`char * const *` in C and :c:" +"expr:`const char * const *` in C++, instead of :c:expr:`char **`. Added " +"support for non-ASCII keyword parameter names." msgstr "" #: ../../c-api/arg.rst:479 @@ -986,10 +985,10 @@ msgid "" "When memory buffers are passed as parameters to supply data to build " "objects, as for the ``s`` and ``s#`` formats, the required data is copied. " "Buffers provided by the caller are never referenced by the objects created " -"by :c:func:`Py_BuildValue`. In other words, if your code " -"invokes :c:func:`malloc` and passes the allocated memory " -"to :c:func:`Py_BuildValue`, your code is responsible for " -"calling :c:func:`free` for that memory once :c:func:`Py_BuildValue` returns." +"by :c:func:`Py_BuildValue`. In other words, if your code invokes :c:func:" +"`malloc` and passes the allocated memory to :c:func:`Py_BuildValue`, your " +"code is responsible for calling :c:func:`free` for that memory once :c:func:" +"`Py_BuildValue` returns." msgstr "" #: ../../c-api/arg.rst:589 @@ -1165,16 +1164,16 @@ msgid "" "Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` " "object of length 1." msgstr "" -"將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一" -"的 :class:`bytes`。" +"將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" +"`bytes`。" #: ../../c-api/arg.rst:687 msgid "" "Convert a C :c:expr:`int` representing a character to Python :class:`str` " "object of length 1." msgstr "" -"將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一" -"的 :class:`str`。" +"將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" +"`str`。" #: ../../c-api/arg.rst:691 msgid "Convert a C :c:expr:`double` to a Python floating-point number." @@ -1197,9 +1196,9 @@ msgid "" "Pass a Python object untouched but create a new :term:`strong reference` to " "it (i.e. its reference count is incremented by one). If the object passed in " "is a ``NULL`` pointer, it is assumed that this was caused because the call " -"producing the argument found an error and set an exception. " -"Therefore, :c:func:`Py_BuildValue` will return ``NULL`` but won't raise an " -"exception. If no exception has been raised yet, :exc:`SystemError` is set." +"producing the argument found an error and set an exception. Therefore, :c:" +"func:`Py_BuildValue` will return ``NULL`` but won't raise an exception. If " +"no exception has been raised yet, :exc:`SystemError` is set." msgstr "" #: ../../c-api/arg.rst:709 @@ -1228,9 +1227,9 @@ msgstr "``O&`` (object) [*converter*, *anything*]" #: ../../c-api/arg.rst:718 msgid "" "Convert *anything* to a Python object through a *converter* function. The " -"function is called with *anything* (which should be compatible " -"with :c:expr:`void*`) as its argument and should return a \"new\" Python " -"object, or ``NULL`` if an error occurred." +"function is called with *anything* (which should be compatible with :c:expr:" +"`void*`) as its argument and should return a \"new\" Python object, or " +"``NULL`` if an error occurred." msgstr "" #: ../../c-api/arg.rst:723 diff --git a/c-api/buffer.po b/c-api/buffer.po index a83b0f40b05..2307ed3d901 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -732,7 +732,7 @@ msgstr "" #: ../../c-api/buffer.rst:525 msgid "``0`` is returned on success, ``-1`` on error." -msgstr "" +msgstr "成功時回傳 ``0``,錯誤時回傳 ``-1``。" #: ../../c-api/buffer.rst:529 msgid "" diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index f11d4492235..1489b716d56 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -129,20 +129,20 @@ msgstr "" #: ../../c-api/gcsupport.rst:73 ../../c-api/gcsupport.rst:97 msgid ":c:func:`PyObject_GC_Del`" -msgstr "" +msgstr ":c:func:`PyObject_GC_Del`" #: ../../c-api/gcsupport.rst:74 msgid ":c:macro:`PyObject_New`" -msgstr "" +msgstr ":c:macro:`PyObject_New`" #: ../../c-api/gcsupport.rst:75 ../../c-api/gcsupport.rst:99 #: ../../c-api/gcsupport.rst:193 msgid ":c:func:`PyType_GenericAlloc`" -msgstr "" +msgstr ":c:func:`PyType_GenericAlloc`" #: ../../c-api/gcsupport.rst:76 ../../c-api/gcsupport.rst:100 msgid ":c:member:`~PyTypeObject.tp_alloc`" -msgstr "" +msgstr ":c:member:`~PyTypeObject.tp_alloc`" #: ../../c-api/gcsupport.rst:81 msgid "" @@ -152,7 +152,7 @@ msgstr "" #: ../../c-api/gcsupport.rst:98 msgid ":c:macro:`PyObject_NewVar`" -msgstr "" +msgstr ":c:macro:`PyObject_NewVar`" #: ../../c-api/gcsupport.rst:105 msgid "" @@ -262,15 +262,15 @@ msgstr "" #: ../../c-api/gcsupport.rst:191 msgid ":c:macro:`PyObject_GC_New`" -msgstr "" +msgstr ":c:macro:`PyObject_GC_New`" #: ../../c-api/gcsupport.rst:192 msgid ":c:macro:`PyObject_GC_NewVar`" -msgstr "" +msgstr ":c:macro:`PyObject_GC_NewVar`" #: ../../c-api/gcsupport.rst:194 msgid ":c:member:`~PyTypeObject.tp_free`" -msgstr "" +msgstr ":c:member:`~PyTypeObject.tp_free`" #: ../../c-api/gcsupport.rst:199 msgid "" diff --git a/c-api/init.po b/c-api/init.po index 3b5b946f410..3de24c2095f 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-10-10 00:15+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1573,7 +1573,7 @@ msgid "" "deadlock ensues. *tstate* will be attached upon returning." msgstr "" -#: ../../c-api/init.rst:1244 ../../c-api/init.rst:1615 +#: ../../c-api/init.rst:1244 ../../c-api/init.rst:1631 msgid "" "Calling this function from a thread when the runtime is finalizing will hang " "the thread until the program exits, even if the thread was not created by " @@ -1581,8 +1581,8 @@ msgid "" "details." msgstr "" -#: ../../c-api/init.rst:1249 ../../c-api/init.rst:1320 -#: ../../c-api/init.rst:1625 +#: ../../c-api/init.rst:1249 ../../c-api/init.rst:1333 +#: ../../c-api/init.rst:1641 msgid "" "Hangs the current thread, rather than terminating it, if called while the " "interpreter is finalizing." @@ -1625,6 +1625,11 @@ msgid "" "will simply return ``NULL`` indicating that there was no prior thread state." msgstr "" +#: ../../c-api/init.rst:1282 +#, fuzzy +msgid ":c:func:`PyEval_ReleaseThread`" +msgstr "PyEval_ReleaseThread()" + #: ../../c-api/init.rst:1285 msgid "" "Similar to :c:func:`PyGILState_Ensure`, this function will hang the thread " @@ -1639,6 +1644,20 @@ msgstr "" #: ../../c-api/init.rst:1294 msgid "" +"The type of the value returned by :c:func:`PyGILState_Ensure` and passed to :" +"c:func:`PyGILState_Release`." +msgstr "" + +#: ../../c-api/init.rst:1299 +msgid "The GIL was already held when :c:func:`PyGILState_Ensure` was called." +msgstr "" + +#: ../../c-api/init.rst:1303 +msgid "The GIL was not held when :c:func:`PyGILState_Ensure` was called." +msgstr "" + +#: ../../c-api/init.rst:1307 +msgid "" "Ensure that the current thread is ready to call the Python C API regardless " "of the current state of Python, or of the :term:`attached thread state`. " "This may be called as many times as desired by a thread as long as each call " @@ -1650,7 +1669,7 @@ msgid "" "is acceptable." msgstr "" -#: ../../c-api/init.rst:1304 +#: ../../c-api/init.rst:1317 msgid "" "The return value is an opaque \"handle\" to the :term:`attached thread " "state` when :c:func:`PyGILState_Ensure` was called, and must be passed to :c:" @@ -1660,14 +1679,14 @@ msgid "" "to :c:func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1311 +#: ../../c-api/init.rst:1324 msgid "" "When the function returns, there will be an :term:`attached thread state` " "and the thread will be able to call arbitrary Python code. Failure is a " "fatal error." msgstr "" -#: ../../c-api/init.rst:1315 +#: ../../c-api/init.rst:1328 msgid "" "Calling this function when the runtime is finalizing is unsafe. Doing so " "will either hang the thread until the program ends, or fully crash the " @@ -1675,7 +1694,7 @@ msgid "" "finalization` for more details." msgstr "" -#: ../../c-api/init.rst:1326 +#: ../../c-api/init.rst:1339 msgid "" "Release any resources previously acquired. After this call, Python's state " "will be the same as it was prior to the corresponding :c:func:" @@ -1683,13 +1702,13 @@ msgid "" "caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:1331 +#: ../../c-api/init.rst:1344 msgid "" "Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" "func:`PyGILState_Release` on the same thread." msgstr "" -#: ../../c-api/init.rst:1336 +#: ../../c-api/init.rst:1349 msgid "" "Get the :term:`attached thread state` for this thread. May return ``NULL`` " "if no GILState API has been used on the current thread. Note that the main " @@ -1697,15 +1716,19 @@ msgid "" "been made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1342 +#: ../../c-api/init.rst:1355 msgid "" -"This function does not account for :term:`thread states ` " -"created by something other than :c:func:`PyGILState_Ensure` (such as :c:func:" -"`PyThreadState_New`). Prefer :c:func:`PyThreadState_Get` or :c:func:" +"This function may return non-``NULL`` even when the :term:`thread state` is " +"detached. Prefer :c:func:`PyThreadState_Get` or :c:func:" "`PyThreadState_GetUnchecked` for most cases." msgstr "" -#: ../../c-api/init.rst:1351 +#: ../../c-api/init.rst:1360 +#, fuzzy +msgid ":c:func:`PyThreadState_Get`" +msgstr "也請見 :c:func:`PyThreadState_GetUnchecked`。" + +#: ../../c-api/init.rst:1364 msgid "" "Return ``1`` if the current thread is holding the :term:`GIL` and ``0`` " "otherwise. This function can be called from any thread at any time. Only if " @@ -1717,20 +1740,20 @@ msgid "" "differently." msgstr "" -#: ../../c-api/init.rst:1361 +#: ../../c-api/init.rst:1374 msgid "" "If the current Python process has ever created a subinterpreter, this " "function will *always* return ``1``. Prefer :c:func:" "`PyThreadState_GetUnchecked` for most cases." msgstr "" -#: ../../c-api/init.rst:1368 +#: ../../c-api/init.rst:1381 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: ../../c-api/init.rst:1374 +#: ../../c-api/init.rst:1387 msgid "" "This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" "``. Note that it contains an opening brace; it must be matched with a " @@ -1738,7 +1761,7 @@ msgid "" "discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1382 +#: ../../c-api/init.rst:1395 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " "contains a closing brace; it must be matched with an earlier :c:macro:" @@ -1746,42 +1769,42 @@ msgid "" "macro." msgstr "" -#: ../../c-api/init.rst:1390 +#: ../../c-api/init.rst:1403 msgid "" "This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" "c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: ../../c-api/init.rst:1396 +#: ../../c-api/init.rst:1409 msgid "" "This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" "c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: ../../c-api/init.rst:1402 +#: ../../c-api/init.rst:1415 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1404 +#: ../../c-api/init.rst:1417 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1406 +#: ../../c-api/init.rst:1419 msgid "" ":c:func:`Py_Initialize()` now initializes the :term:`GIL` and sets an :term:" "`attached thread state`." msgstr "" -#: ../../c-api/init.rst:1413 +#: ../../c-api/init.rst:1426 msgid "" "Create a new interpreter state object. An :term:`attached thread state` is " "not needed, but may optionally exist if it is necessary to serialize calls " "to this function." msgstr "" -#: ../../c-api/init.rst:1417 +#: ../../c-api/init.rst:1430 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_New`` with no arguments." @@ -1789,13 +1812,13 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_New``。" -#: ../../c-api/init.rst:1422 +#: ../../c-api/init.rst:1435 msgid "" "Reset all information in an interpreter state object. There must be an :" "term:`attached thread state` for the interpreter." msgstr "" -#: ../../c-api/init.rst:1425 +#: ../../c-api/init.rst:1438 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_Clear`` with no arguments." @@ -1803,7 +1826,7 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1430 +#: ../../c-api/init.rst:1443 msgid "" "Destroy an interpreter state object. There **should not** be an :term:" "`attached thread state` for the target interpreter. The interpreter state " @@ -1811,165 +1834,172 @@ msgid "" "`PyInterpreterState_Clear`." msgstr "" -#: ../../c-api/init.rst:1437 +#: ../../c-api/init.rst:1450 msgid "" "Create a new thread state object belonging to the given interpreter object. " "An :term:`attached thread state` is not needed." msgstr "" -#: ../../c-api/init.rst:1442 +#: ../../c-api/init.rst:1455 msgid "" "Reset all information in a :term:`thread state` object. *tstate* must be :" "term:`attached `" msgstr "" -#: ../../c-api/init.rst:1445 +#: ../../c-api/init.rst:1458 msgid "" -"This function now calls the :c:member:`PyThreadState.on_delete` callback. " +"This function now calls the :c:member:`!PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1449 -msgid "The :c:member:`PyThreadState.on_delete` callback was removed." +#: ../../c-api/init.rst:1462 +#, fuzzy +msgid "The :c:member:`!PyThreadState.on_delete` callback was removed." msgstr ":c:member:`PyThreadState.on_delete` 回呼已被移除。" -#: ../../c-api/init.rst:1455 +#: ../../c-api/init.rst:1468 msgid "" "Destroy a :term:`thread state` object. *tstate* should not be :term:" "`attached ` to any thread. *tstate* must have been " "reset with a previous call to :c:func:`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1463 +#: ../../c-api/init.rst:1476 msgid "" "Detach the :term:`attached thread state` (which must have been reset with a " "previous call to :c:func:`PyThreadState_Clear`) and then destroy it." msgstr "" -#: ../../c-api/init.rst:1466 +#: ../../c-api/init.rst:1479 msgid "" "No :term:`thread state` will be :term:`attached ` " "upon returning." msgstr "" -#: ../../c-api/init.rst:1471 +#: ../../c-api/init.rst:1484 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1473 +#: ../../c-api/init.rst:1486 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1476 +#: ../../c-api/init.rst:1489 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1478 ../../c-api/init.rst:1487 -#: ../../c-api/init.rst:1496 +#: ../../c-api/init.rst:1491 ../../c-api/init.rst:1500 +#: ../../c-api/init.rst:1509 msgid "" "*tstate* must not be ``NULL``, and must be :term:`attached `." msgstr "" -#: ../../c-api/init.rst:1485 +#: ../../c-api/init.rst:1498 msgid "" "Get the unique :term:`thread state` identifier of the Python thread state " "*tstate*." msgstr "" -#: ../../c-api/init.rst:1494 +#: ../../c-api/init.rst:1507 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1503 +#: ../../c-api/init.rst:1516 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1505 +#: ../../c-api/init.rst:1518 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1512 +#: ../../c-api/init.rst:1525 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1515 +#: ../../c-api/init.rst:1528 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1523 +#: ../../c-api/init.rst:1536 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1525 +#: ../../c-api/init.rst:1538 msgid "" "Issue a fatal error if there no :term:`attached thread state`. It cannot " "return NULL." msgstr "" -#: ../../c-api/init.rst:1533 +#: ../../c-api/init.rst:1546 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1536 ../../c-api/init.rst:2125 -#: ../../c-api/init.rst:2132 ../../c-api/init.rst:2151 -#: ../../c-api/init.rst:2158 +#: ../../c-api/init.rst:1549 ../../c-api/init.rst:2145 +#: ../../c-api/init.rst:2152 ../../c-api/init.rst:2171 +#: ../../c-api/init.rst:2178 msgid "The caller must have an :term:`attached thread state`." msgstr "呼叫者必須擁有一個 :term:`attached thread state`。" -#: ../../c-api/init.rst:1543 +#: ../../c-api/init.rst:1556 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1547 +#: ../../c-api/init.rst:1560 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1555 +#: ../../c-api/init.rst:1563 +msgid "" +"The returned dictionary is borrowed from the interpreter and is valid until " +"interpreter shutdown." +msgstr "" + +#: ../../c-api/init.rst:1571 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1557 +#: ../../c-api/init.rst:1573 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1560 +#: ../../c-api/init.rst:1576 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1563 +#: ../../c-api/init.rst:1579 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1568 +#: ../../c-api/init.rst:1584 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1570 ../../c-api/init.rst:1578 +#: ../../c-api/init.rst:1586 ../../c-api/init.rst:1594 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1576 +#: ../../c-api/init.rst:1592 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1585 +#: ../../c-api/init.rst:1601 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1979,7 +2009,7 @@ msgid "" "thread state is attached." msgstr "" -#: ../../c-api/init.rst:1595 +#: ../../c-api/init.rst:1611 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1991,54 +2021,54 @@ msgid "" "is cleared. This raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1603 +#: ../../c-api/init.rst:1619 msgid "" "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" "`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1609 +#: ../../c-api/init.rst:1625 msgid "" ":term:`Attach ` *tstate* to the current thread, which " "must not be ``NULL`` or already :term:`attached `." msgstr "" -#: ../../c-api/init.rst:1612 +#: ../../c-api/init.rst:1628 msgid "" "The calling thread must not already have an :term:`attached thread state`." msgstr "" -#: ../../c-api/init.rst:1620 +#: ../../c-api/init.rst:1636 msgid "" "Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" "`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " "current thread if called while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1629 +#: ../../c-api/init.rst:1645 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1635 +#: ../../c-api/init.rst:1651 msgid "" "Detach the :term:`attached thread state`. The *tstate* argument, which must " "not be ``NULL``, is only used to check that it represents the :term:" "`attached thread state` --- if it isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1640 +#: ../../c-api/init.rst:1656 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1647 +#: ../../c-api/init.rst:1663 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1649 +#: ../../c-api/init.rst:1665 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -2046,7 +2076,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1654 +#: ../../c-api/init.rst:1670 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -2057,31 +2087,31 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1661 +#: ../../c-api/init.rst:1677 msgid "" "You can switch between sub-interpreters using the :c:func:" "`PyThreadState_Swap` function. You can create and destroy them using the " "following functions:" msgstr "" -#: ../../c-api/init.rst:1667 +#: ../../c-api/init.rst:1683 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1673 +#: ../../c-api/init.rst:1689 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1677 +#: ../../c-api/init.rst:1693 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1681 +#: ../../c-api/init.rst:1697 msgid "" "If this is ``0`` then :c:member:`~PyInterpreterConfig." "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " @@ -2089,44 +2119,44 @@ msgid "" "`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:1705 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1693 +#: ../../c-api/init.rst:1709 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1698 +#: ../../c-api/init.rst:1714 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1703 +#: ../../c-api/init.rst:1719 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1708 +#: ../../c-api/init.rst:1724 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1714 +#: ../../c-api/init.rst:1730 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create daemon threads. Otherwise daemon threads are allowed (as long as :c:" "member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1721 +#: ../../c-api/init.rst:1737 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " @@ -2135,37 +2165,37 @@ msgid "" "`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1728 +#: ../../c-api/init.rst:1744 msgid "" "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." "use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1733 +#: ../../c-api/init.rst:1749 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1740 +#: ../../c-api/init.rst:1756 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1744 +#: ../../c-api/init.rst:1760 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1748 +#: ../../c-api/init.rst:1764 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1750 +#: ../../c-api/init.rst:1766 msgid "" "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" "`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1764 +#: ../../c-api/init.rst:1780 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " @@ -2178,13 +2208,13 @@ msgid "" "underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1774 +#: ../../c-api/init.rst:1790 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1777 +#: ../../c-api/init.rst:1793 msgid "" "Upon success, *tstate_p* will be set to the first :term:`thread state` " "created in the new sub-interpreter. This thread state is :term:`attached " @@ -2195,7 +2225,7 @@ msgid "" "not exist." msgstr "" -#: ../../c-api/init.rst:1786 +#: ../../c-api/init.rst:1802 msgid "" "Like all other Python/C API functions, an :term:`attached thread state` must " "be present before calling this function, but it might be detached upon " @@ -2208,13 +2238,13 @@ msgid "" "will remain detached." msgstr "" -#: ../../c-api/init.rst:1797 +#: ../../c-api/init.rst:1813 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1800 +#: ../../c-api/init.rst:1816 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2246,7 +2276,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init.rst:1815 +#: ../../c-api/init.rst:1831 msgid "" "Note that the config is used only briefly and does not get modified. During " "initialization the config's values are converted into various :c:type:" @@ -2254,11 +2284,11 @@ msgid "" "internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1824 +#: ../../c-api/init.rst:1840 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1826 +#: ../../c-api/init.rst:1842 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " @@ -2266,7 +2296,7 @@ msgid "" "are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1832 +#: ../../c-api/init.rst:1848 msgid "" "For modules using single-phase initialization, e.g. :c:func:" "`PyModule_Create`, the first time a particular extension is imported, it is " @@ -2278,7 +2308,7 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1843 +#: ../../c-api/init.rst:1859 msgid "" "Note that this is different from what happens when an extension is imported " "after the interpreter has been completely re-initialized by calling :c:func:" @@ -2288,7 +2318,7 @@ msgid "" "shared between these modules." msgstr "" -#: ../../c-api/init.rst:1863 +#: ../../c-api/init.rst:1879 msgid "" "Create a new sub-interpreter. This is essentially just a wrapper around :c:" "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " @@ -2297,7 +2327,7 @@ msgid "" "single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1875 +#: ../../c-api/init.rst:1891 msgid "" "Destroy the (sub-)interpreter represented by the given :term:`thread state`. " "The given thread state must be :term:`attached `. " @@ -2305,17 +2335,17 @@ msgid "" "thread states associated with this interpreter are destroyed." msgstr "" -#: ../../c-api/init.rst:1880 +#: ../../c-api/init.rst:1896 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1887 +#: ../../c-api/init.rst:1903 msgid "A Per-Interpreter GIL" msgstr "直譯器各別持有的 GIL" -#: ../../c-api/init.rst:1889 +#: ../../c-api/init.rst:1905 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2327,7 +2357,7 @@ msgid "" "just using threads. (See :pep:`554` and :pep:`684`.)" msgstr "" -#: ../../c-api/init.rst:1899 +#: ../../c-api/init.rst:1915 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2341,7 +2371,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1910 +#: ../../c-api/init.rst:1926 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2349,7 +2379,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1915 +#: ../../c-api/init.rst:1931 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2359,11 +2389,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1926 +#: ../../c-api/init.rst:1942 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1944 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2376,7 +2406,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1938 +#: ../../c-api/init.rst:1954 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2385,7 +2415,7 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1944 +#: ../../c-api/init.rst:1960 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " @@ -2397,25 +2427,25 @@ msgid "" "created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1955 +#: ../../c-api/init.rst:1971 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1957 +#: ../../c-api/init.rst:1973 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1964 +#: ../../c-api/init.rst:1980 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1968 +#: ../../c-api/init.rst:1984 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2423,17 +2453,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1973 +#: ../../c-api/init.rst:1989 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1974 +#: ../../c-api/init.rst:1990 msgid "" "with the main thread holding an :term:`attached thread state` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1977 +#: ../../c-api/init.rst:1993 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2441,7 +2471,7 @@ msgid "" "if the :term:`thread state ` is detached." msgstr "" -#: ../../c-api/init.rst:1982 +#: ../../c-api/init.rst:1998 msgid "" "This function doesn't need an :term:`attached thread state`. However, to " "call this function in a subinterpreter, the caller must have an :term:" @@ -2449,7 +2479,7 @@ msgid "" "be called from the wrong interpreter." msgstr "" -#: ../../c-api/init.rst:1987 +#: ../../c-api/init.rst:2003 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " @@ -2459,7 +2489,7 @@ msgid "" "`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1996 +#: ../../c-api/init.rst:2012 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2467,18 +2497,23 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:2005 +#: ../../c-api/init.rst:2018 +msgid "" +"This function now always schedules *func* to be run in the main interpreter." +msgstr "" + +#: ../../c-api/init.rst:2025 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:2010 +#: ../../c-api/init.rst:2030 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:2014 +#: ../../c-api/init.rst:2034 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2488,7 +2523,7 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:2024 +#: ../../c-api/init.rst:2044 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " @@ -2500,66 +2535,66 @@ msgid "" "value of *what*:" msgstr "" -#: ../../c-api/init.rst:2033 +#: ../../c-api/init.rst:2053 msgid "Value of *what*" msgstr "*what* 的值" -#: ../../c-api/init.rst:2033 +#: ../../c-api/init.rst:2053 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:2035 +#: ../../c-api/init.rst:2055 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:2035 ../../c-api/init.rst:2040 -#: ../../c-api/init.rst:2051 +#: ../../c-api/init.rst:2055 ../../c-api/init.rst:2060 +#: ../../c-api/init.rst:2071 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:2037 +#: ../../c-api/init.rst:2057 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:2037 +#: ../../c-api/init.rst:2057 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:2040 +#: ../../c-api/init.rst:2060 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:2042 +#: ../../c-api/init.rst:2062 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:2042 +#: ../../c-api/init.rst:2062 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:2045 +#: ../../c-api/init.rst:2065 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:2045 ../../c-api/init.rst:2047 -#: ../../c-api/init.rst:2049 +#: ../../c-api/init.rst:2065 ../../c-api/init.rst:2067 +#: ../../c-api/init.rst:2069 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:2047 +#: ../../c-api/init.rst:2067 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:2049 +#: ../../c-api/init.rst:2069 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:2051 +#: ../../c-api/init.rst:2071 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:2056 +#: ../../c-api/init.rst:2076 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2568,7 +2603,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:2065 +#: ../../c-api/init.rst:2085 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2580,7 +2615,7 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:2076 +#: ../../c-api/init.rst:2096 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " @@ -2588,31 +2623,31 @@ msgid "" "f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:2084 +#: ../../c-api/init.rst:2104 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:2090 +#: ../../c-api/init.rst:2110 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:2096 +#: ../../c-api/init.rst:2116 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:2102 +#: ../../c-api/init.rst:2122 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:2108 +#: ../../c-api/init.rst:2128 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " @@ -2620,7 +2655,7 @@ msgid "" "attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:2116 +#: ../../c-api/init.rst:2136 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " @@ -2630,24 +2665,24 @@ msgid "" "`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:2123 +#: ../../c-api/init.rst:2143 msgid "See also the :func:`sys.setprofile` function." msgstr "另請參閱 :func:`sys.setprofile` 函式。" -#: ../../c-api/init.rst:2129 +#: ../../c-api/init.rst:2149 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:2134 +#: ../../c-api/init.rst:2154 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:2142 +#: ../../c-api/init.rst:2162 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -2658,28 +2693,28 @@ msgid "" "*what* parameter." msgstr "" -#: ../../c-api/init.rst:2149 +#: ../../c-api/init.rst:2169 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:2155 +#: ../../c-api/init.rst:2175 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:2160 +#: ../../c-api/init.rst:2180 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:2166 +#: ../../c-api/init.rst:2186 msgid "Reference tracing" msgstr "" -#: ../../c-api/init.rst:2172 +#: ../../c-api/init.rst:2192 msgid "" "The type of the trace function registered using :c:func:" "`PyRefTracer_SetTracer`. The first parameter is a Python object that has " @@ -2689,19 +2724,19 @@ msgid "" "provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -#: ../../c-api/init.rst:2182 +#: ../../c-api/init.rst:2202 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" -#: ../../c-api/init.rst:2187 +#: ../../c-api/init.rst:2207 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been destroyed." msgstr "" -#: ../../c-api/init.rst:2192 +#: ../../c-api/init.rst:2212 msgid "" "Register a reference tracer function. The function will be called when a new " "Python has been created or when an object is going to be destroyed. If " @@ -2710,7 +2745,7 @@ msgid "" "return ``-1`` on error." msgstr "" -#: ../../c-api/init.rst:2198 +#: ../../c-api/init.rst:2218 msgid "" "Not that tracer functions **must not** create Python objects inside or " "otherwise the call will be re-entrant. The tracer also **must not** clear " @@ -2718,12 +2753,12 @@ msgid "" "active every time the tracer function is called." msgstr "" -#: ../../c-api/init.rst:2203 ../../c-api/init.rst:2214 +#: ../../c-api/init.rst:2223 ../../c-api/init.rst:2234 msgid "" "There must be an :term:`attached thread state` when calling this function." msgstr "" -#: ../../c-api/init.rst:2209 +#: ../../c-api/init.rst:2229 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " @@ -2731,48 +2766,48 @@ msgid "" "set the **data** pointer to NULL." msgstr "" -#: ../../c-api/init.rst:2221 +#: ../../c-api/init.rst:2241 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2226 +#: ../../c-api/init.rst:2246 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2231 +#: ../../c-api/init.rst:2251 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2236 +#: ../../c-api/init.rst:2256 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2241 +#: ../../c-api/init.rst:2261 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2247 +#: ../../c-api/init.rst:2267 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2253 +#: ../../c-api/init.rst:2273 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2260 +#: ../../c-api/init.rst:2280 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2264 +#: ../../c-api/init.rst:2284 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2782,19 +2817,19 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2271 +#: ../../c-api/init.rst:2291 msgid "" "A :term:`thread state` does *not* need to be :term:`attached ` when calling these functions; they suppl their own locking." msgstr "" -#: ../../c-api/init.rst:2274 +#: ../../c-api/init.rst:2294 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2278 +#: ../../c-api/init.rst:2298 msgid "" "None of these API functions handle memory management on behalf of the :c:" "expr:`void*` values. You need to allocate and deallocate them yourself. If " @@ -2802,22 +2837,22 @@ msgid "" "don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2286 +#: ../../c-api/init.rst:2306 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2288 +#: ../../c-api/init.rst:2308 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2294 +#: ../../c-api/init.rst:2314 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2299 +#: ../../c-api/init.rst:2319 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2825,52 +2860,52 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2304 +#: ../../c-api/init.rst:2324 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2310 +#: ../../c-api/init.rst:2330 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: ../../c-api/init.rst:2315 +#: ../../c-api/init.rst:2335 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2317 +#: ../../c-api/init.rst:2337 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2324 +#: ../../c-api/init.rst:2344 msgid "" "Return a value which is the same state as a value initialized with :c:macro:" "`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" -#: ../../c-api/init.rst:2331 +#: ../../c-api/init.rst:2351 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2337 +#: ../../c-api/init.rst:2357 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2342 +#: ../../c-api/init.rst:2362 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2344 +#: ../../c-api/init.rst:2364 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " @@ -2878,13 +2913,13 @@ msgid "" "func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2352 +#: ../../c-api/init.rst:2372 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2358 +#: ../../c-api/init.rst:2378 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2893,7 +2928,7 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2367 +#: ../../c-api/init.rst:2387 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " @@ -2902,31 +2937,31 @@ msgid "" "key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2376 +#: ../../c-api/init.rst:2396 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2383 +#: ../../c-api/init.rst:2403 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2391 +#: ../../c-api/init.rst:2411 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2393 +#: ../../c-api/init.rst:2413 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2398 +#: ../../c-api/init.rst:2418 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2935,45 +2970,45 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2403 +#: ../../c-api/init.rst:2423 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:2414 +#: ../../c-api/init.rst:2434 msgid "Synchronization Primitives" msgstr "" -#: ../../c-api/init.rst:2416 +#: ../../c-api/init.rst:2436 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -#: ../../c-api/init.rst:2420 +#: ../../c-api/init.rst:2440 msgid "" "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " "zero to represent the unlocked state. For example::" msgstr "" -#: ../../c-api/init.rst:2423 +#: ../../c-api/init.rst:2443 msgid "PyMutex mutex = {0};" msgstr "PyMutex mutex = {0};" -#: ../../c-api/init.rst:2425 +#: ../../c-api/init.rst:2445 msgid "" "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " "contents and address of a :c:type:`!PyMutex` are meaningful, and it must " "remain at a fixed, writable location in memory." msgstr "" -#: ../../c-api/init.rst:2431 +#: ../../c-api/init.rst:2451 msgid "" "A :c:type:`!PyMutex` currently occupies one byte, but the size should be " "considered unstable. The size may change in future Python releases without " "a deprecation period." msgstr "" -#: ../../c-api/init.rst:2439 +#: ../../c-api/init.rst:2459 msgid "" "Lock mutex *m*. If another thread has already locked it, the calling thread " "will block until the mutex is unlocked. While blocked, the thread will " @@ -2981,28 +3016,28 @@ msgid "" "exists." msgstr "" -#: ../../c-api/init.rst:2447 +#: ../../c-api/init.rst:2467 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" -#: ../../c-api/init.rst:2454 +#: ../../c-api/init.rst:2474 msgid "Returns non-zero if the mutex *m* is currently locked, zero otherwise." msgstr "" -#: ../../c-api/init.rst:2458 +#: ../../c-api/init.rst:2478 msgid "" "This function is intended for use in assertions and debugging only and " "should not be used to make concurrency control decisions, as the lock state " "may change immediately after the check." msgstr "" -#: ../../c-api/init.rst:2467 +#: ../../c-api/init.rst:2487 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2469 +#: ../../c-api/init.rst:2489 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded ` CPython. They are " @@ -3010,7 +3045,7 @@ msgid "" "no-ops in versions of Python with the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:2474 +#: ../../c-api/init.rst:2494 msgid "" "Critical sections are intended to be used for custom types implemented in C-" "API extensions. They should generally not be used with built-in types like :" @@ -3019,7 +3054,7 @@ msgid "" "`PyDict_Next`, which requires critical section to be acquired externally." msgstr "" -#: ../../c-api/init.rst:2481 +#: ../../c-api/init.rst:2501 msgid "" "Critical sections avoid deadlocks by implicitly suspending active critical " "sections, hence, they do not provide exclusive access such as provided by " @@ -3030,7 +3065,7 @@ msgid "" "threads can acquire the per-object lock for the same object." msgstr "" -#: ../../c-api/init.rst:2489 +#: ../../c-api/init.rst:2509 msgid "" "Variants that accept :c:type:`PyMutex` pointers rather than Python objects " "are also available. Use these variants to start a critical section in a " @@ -3039,7 +3074,7 @@ msgid "" "needs to call into the C API in a manner that might lead to deadlocks." msgstr "" -#: ../../c-api/init.rst:2495 +#: ../../c-api/init.rst:2515 msgid "" "The functions and structs used by the macros are exposed for cases where C " "macros are not available. They should only be used as in the given macro " @@ -3047,7 +3082,7 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2502 +#: ../../c-api/init.rst:2522 msgid "" "Operations that need to lock two objects at once must use :c:macro:" "`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " @@ -3056,11 +3091,11 @@ msgid "" "lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2508 +#: ../../c-api/init.rst:2528 msgid "Example usage::" msgstr "範例用法: ::" -#: ../../c-api/init.rst:2510 +#: ../../c-api/init.rst:2530 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -3080,7 +3115,7 @@ msgstr "" " Py_RETURN_NONE;\n" "}" -#: ../../c-api/init.rst:2519 +#: ../../c-api/init.rst:2539 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " @@ -3090,19 +3125,19 @@ msgid "" "`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2527 +#: ../../c-api/init.rst:2547 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2530 ../../c-api/init.rst:2544 -#: ../../c-api/init.rst:2561 ../../c-api/init.rst:2576 -#: ../../c-api/init.rst:2590 ../../c-api/init.rst:2607 +#: ../../c-api/init.rst:2550 ../../c-api/init.rst:2564 +#: ../../c-api/init.rst:2581 ../../c-api/init.rst:2596 +#: ../../c-api/init.rst:2610 ../../c-api/init.rst:2627 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2532 +#: ../../c-api/init.rst:2552 msgid "" "{\n" " PyCriticalSection _py_cs;\n" @@ -3112,15 +3147,15 @@ msgstr "" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" -#: ../../c-api/init.rst:2536 ../../c-api/init.rst:2582 +#: ../../c-api/init.rst:2556 ../../c-api/init.rst:2602 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2542 +#: ../../c-api/init.rst:2562 msgid "Locks the mutex *m* and begins a critical section." msgstr "" -#: ../../c-api/init.rst:2546 +#: ../../c-api/init.rst:2566 msgid "" "{\n" " PyCriticalSection _py_cs;\n" @@ -3130,21 +3165,21 @@ msgstr "" " PyCriticalSection _py_cs;\n" " PyCriticalSection_BeginMutex(&_py_cs, m)" -#: ../../c-api/init.rst:2550 +#: ../../c-api/init.rst:2570 msgid "" "Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION`, there is no cast for " "the argument of the macro - it must be a :c:type:`PyMutex` pointer." msgstr "" -#: ../../c-api/init.rst:2553 ../../c-api/init.rst:2599 +#: ../../c-api/init.rst:2573 ../../c-api/init.rst:2619 msgid "On the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2559 +#: ../../c-api/init.rst:2579 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2563 +#: ../../c-api/init.rst:2583 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" @@ -3152,18 +3187,18 @@ msgstr "" " PyCriticalSection_End(&_py_cs);\n" "}" -#: ../../c-api/init.rst:2566 ../../c-api/init.rst:2612 +#: ../../c-api/init.rst:2586 ../../c-api/init.rst:2632 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2572 +#: ../../c-api/init.rst:2592 msgid "" "Acquires the per-objects locks for the objects *a* and *b* and begins a " "critical section. The locks are acquired in a consistent order (lowest " "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2578 +#: ../../c-api/init.rst:2598 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" @@ -3173,11 +3208,11 @@ msgstr "" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" -#: ../../c-api/init.rst:2588 +#: ../../c-api/init.rst:2608 msgid "Locks the mutexes *m1* and *m2* and begins a critical section." msgstr "" -#: ../../c-api/init.rst:2592 +#: ../../c-api/init.rst:2612 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" @@ -3187,17 +3222,17 @@ msgstr "" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2)" -#: ../../c-api/init.rst:2596 +#: ../../c-api/init.rst:2616 msgid "" "Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, there is no cast for " "the arguments of the macro - they must be :c:type:`PyMutex` pointers." msgstr "" -#: ../../c-api/init.rst:2605 +#: ../../c-api/init.rst:2625 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2609 +#: ../../c-api/init.rst:2629 msgid "" " PyCriticalSection2_End(&_py_cs2);\n" "}" @@ -3218,19 +3253,19 @@ msgid "path (in module sys)" msgstr "path(sys 模組中)" #: ../../c-api/init.rst:350 ../../c-api/init.rst:712 ../../c-api/init.rst:1228 -#: ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "sys" msgstr "sys" @@ -3242,7 +3277,7 @@ msgstr "search(搜尋)" msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1820 ../../c-api/init.rst:1873 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1836 ../../c-api/init.rst:1889 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" @@ -3338,23 +3373,23 @@ msgstr "PyEval_RestoreThread()" msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1756 ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:1772 ../../c-api/init.rst:1871 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1820 +#: ../../c-api/init.rst:1836 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1850 +#: ../../c-api/init.rst:1866 msgid "close (in module os)" msgstr "close(os 模組中)" diff --git a/c-api/init_config.po b/c-api/init_config.po index bef46bbdf1b..b45fcc2319c 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -3171,7 +3171,7 @@ msgstr "" #: ../../c-api/init_config.rst:2183 msgid "Python Path Configuration" -msgstr "" +msgstr "Python 路徑配置" #: ../../c-api/init_config.rst:2185 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" @@ -3290,7 +3290,7 @@ msgstr "" #: ../../c-api/init_config.rst:2233 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" -msgstr "" +msgstr ":c:func:`Py_RunMain` 和 :c:func:`Py_Main` 會修改 :data:`sys.path`:" #: ../../c-api/init_config.rst:2235 msgid "" diff --git a/c-api/memory.po b/c-api/memory.po index 3074068991f..d19ecbf292a 100644 --- a/c-api/memory.po +++ b/c-api/memory.po @@ -1022,15 +1022,15 @@ msgstr "" #: ../../c-api/memory.rst:667 msgid ":c:func:`!VirtualAlloc` and :c:func:`!VirtualFree` on Windows," -msgstr "" +msgstr "Windows 上的 :c:func:`!VirtualAlloc` 和 :c:func:`!VirtualFree`," #: ../../c-api/memory.rst:668 msgid ":c:func:`!mmap` and :c:func:`!munmap` if available," -msgstr "" +msgstr "如果可用,則使用 :c:func:`!mmap` 和 :c:func:`!munmap`," #: ../../c-api/memory.rst:669 msgid ":c:func:`malloc` and :c:func:`free` otherwise." -msgstr "" +msgstr "否則使用 :c:func:`malloc` 和 :c:func:`free`。" #: ../../c-api/memory.rst:671 msgid "" diff --git a/c-api/module.po b/c-api/module.po index 02c45934aac..f00c8f3e2d7 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-25 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,22 +36,21 @@ msgstr "" #: ../../c-api/module.rst:27 msgid "" -"Return true if *p* is a module object, but not a subtype " -"of :c:data:`PyModule_Type`. This function always succeeds." +"Return true if *p* is a module object, but not a subtype of :c:data:" +"`PyModule_Type`. This function always succeeds." msgstr "" #: ../../c-api/module.rst:40 msgid "" "Return a new module object with :attr:`module.__name__` set to *name*. The " -"module's :attr:`!" -"__name__`, :attr:`~module.__doc__`, :attr:`~module.__package__` " -"and :attr:`~module.__loader__` attributes are filled in (all but :attr:`!" -"__name__` are set to ``None``). The caller is responsible for setting " -"a :attr:`~module.__file__` attribute." +"module's :attr:`!__name__`, :attr:`~module.__doc__`, :attr:`~module." +"__package__` and :attr:`~module.__loader__` attributes are filled in (all " +"but :attr:`!__name__` are set to ``None``). The caller is responsible for " +"setting a :attr:`~module.__file__` attribute." msgstr "" -#: ../../c-api/module.rst:46 ../../c-api/module.rst:416 -#: ../../c-api/module.rst:443 +#: ../../c-api/module.rst:46 ../../c-api/module.rst:420 +#: ../../c-api/module.rst:447 msgid "Return ``NULL`` with an exception set on error." msgstr "在失敗時回傳 ``NULL`` 並設定例外。" @@ -68,6 +67,7 @@ msgid "" "Similar to :c:func:`PyModule_NewObject`, but the name is a UTF-8 encoded " "string instead of a Unicode object." msgstr "" +"類似於 :c:func:`PyModule_NewObject`,但名稱是以 UTF-8 編碼的字串,而非 Unicode 物件。" #: ../../c-api/module.rst:65 msgid "" @@ -80,8 +80,8 @@ msgstr "" #: ../../c-api/module.rst:70 msgid "" "It is recommended extensions use other ``PyModule_*`` and ``PyObject_*`` " -"functions rather than directly manipulate a " -"module's :attr:`~object.__dict__`." +"functions rather than directly manipulate a module's :attr:`~object." +"__dict__`." msgstr "" #: ../../c-api/module.rst:81 @@ -96,12 +96,13 @@ msgid "" "Similar to :c:func:`PyModule_GetNameObject` but return the name encoded to " "``'utf-8'``." msgstr "" +"類似於 :c:func:`PyModule_GetNameObject`,但回傳以 ``'utf-8'`` 編碼的名稱。" #: ../../c-api/module.rst:95 msgid "" "Return the \"state\" of the module, that is, a pointer to the block of " -"memory allocated at module creation time, or ``NULL``. " -"See :c:member:`PyModuleDef.m_size`." +"memory allocated at module creation time, or ``NULL``. See :c:member:" +"`PyModuleDef.m_size`." msgstr "" #: ../../c-api/module.rst:102 @@ -110,51 +111,59 @@ msgid "" "was created, or ``NULL`` if the module wasn't created from a definition." msgstr "" -#: ../../c-api/module.rst:112 +#: ../../c-api/module.rst:105 msgid "" -"Return the name of the file from which *module* was loaded using " -"*module*'s :attr:`~module.__file__` attribute. If this is not defined, or " -"if it is not a string, raise :exc:`SystemError` and return ``NULL``; " -"otherwise return a reference to a Unicode object." +"On error, return ``NULL`` with an exception set. Use :c:func:" +"`PyErr_Occurred` to tell this case apart from a mising :c:type:`!" +"PyModuleDef`." msgstr "" -#: ../../c-api/module.rst:122 +#: ../../c-api/module.rst:116 +msgid "" +"Return the name of the file from which *module* was loaded using *module*'s :" +"attr:`~module.__file__` attribute. If this is not defined, or if it is not " +"a string, raise :exc:`SystemError` and return ``NULL``; otherwise return a " +"reference to a Unicode object." +msgstr "" + +#: ../../c-api/module.rst:126 msgid "" "Similar to :c:func:`PyModule_GetFilenameObject` but return the filename " "encoded to 'utf-8'." msgstr "" +"類似於 :c:func:`PyModule_GetFilenameObject`,但回傳以 'utf-8' 編碼的檔案名稱。" -#: ../../c-api/module.rst:125 +#: ../../c-api/module.rst:129 msgid "" ":c:func:`PyModule_GetFilename` raises :exc:`UnicodeEncodeError` on " "unencodable filenames, use :c:func:`PyModule_GetFilenameObject` instead." msgstr "" -#: ../../c-api/module.rst:133 +#: ../../c-api/module.rst:137 msgid "Module definitions" msgstr "模組定義" -#: ../../c-api/module.rst:135 +#: ../../c-api/module.rst:139 msgid "" "The functions in the previous section work on any module object, including " "modules imported from Python code." msgstr "" -#: ../../c-api/module.rst:138 +#: ../../c-api/module.rst:142 msgid "" -"Modules defined using the C API typically use a *module " -"definition*, :c:type:`PyModuleDef` -- a statically allocated, constant " -"“description\" of how a module should be created." +"Modules defined using the C API typically use a *module definition*, :c:type:" +"`PyModuleDef` -- a statically allocated, constant “description\" of how a " +"module should be created." msgstr "" -#: ../../c-api/module.rst:142 +#: ../../c-api/module.rst:146 msgid "" "The definition is usually used to define an extension's “main” module object " "(see :ref:`extension-modules` for details). It is also used to :ref:`create " "extension modules dynamically `." msgstr "" -#: ../../c-api/module.rst:147 +#: ../../c-api/module.rst:151 msgid "" "Unlike :c:func:`PyModule_New`, the definition allows management of *module " "state* -- a piece of memory that is allocated and cleared together with the " @@ -162,7 +171,7 @@ msgid "" "replace or delete data stored in module state." msgstr "" -#: ../../c-api/module.rst:155 +#: ../../c-api/module.rst:159 msgid "" "The module definition struct, which holds all information needed to create a " "module object. This structure must be statically allocated (or be otherwise " @@ -170,42 +179,42 @@ msgid "" "there is only one variable of this type for each extension module." msgstr "" -#: ../../c-api/module.rst:163 +#: ../../c-api/module.rst:167 msgid "Always initialize this member to :c:macro:`PyModuleDef_HEAD_INIT`." msgstr "" -#: ../../c-api/module.rst:167 +#: ../../c-api/module.rst:171 msgid "Name for the new module." msgstr "" -#: ../../c-api/module.rst:171 +#: ../../c-api/module.rst:175 msgid "" -"Docstring for the module; usually a docstring variable created " -"with :c:macro:`PyDoc_STRVAR` is used." +"Docstring for the module; usually a docstring variable created with :c:macro:" +"`PyDoc_STRVAR` is used." msgstr "" -#: ../../c-api/module.rst:176 +#: ../../c-api/module.rst:180 msgid "" "Module state may be kept in a per-module memory area that can be retrieved " "with :c:func:`PyModule_GetState`, rather than in static globals. This makes " "modules safe for use in multiple sub-interpreters." msgstr "" -#: ../../c-api/module.rst:180 +#: ../../c-api/module.rst:184 msgid "" "This memory area is allocated based on *m_size* on module creation, and " -"freed when the module object is deallocated, after " -"the :c:member:`~PyModuleDef.m_free` function has been called, if present." +"freed when the module object is deallocated, after the :c:member:" +"`~PyModuleDef.m_free` function has been called, if present." msgstr "" -#: ../../c-api/module.rst:184 +#: ../../c-api/module.rst:188 msgid "" "Setting it to a non-negative value means that the module can be re-" "initialized and specifies the additional amount of memory it requires for " "its state." msgstr "" -#: ../../c-api/module.rst:188 +#: ../../c-api/module.rst:192 msgid "" "Setting ``m_size`` to ``-1`` means that the module does not support sub-" "interpreters, because it has global state. Negative ``m_size`` is only " @@ -214,59 +223,59 @@ msgid "" "dynamic>`." msgstr "" -#: ../../c-api/module.rst:194 +#: ../../c-api/module.rst:198 msgid "See :PEP:`3121` for more details." msgstr "更多詳情請見 :pep:`3121`。" -#: ../../c-api/module.rst:198 +#: ../../c-api/module.rst:202 msgid "" -"A pointer to a table of module-level functions, described " -"by :c:type:`PyMethodDef` values. Can be ``NULL`` if no functions are " -"present." +"A pointer to a table of module-level functions, described by :c:type:" +"`PyMethodDef` values. Can be ``NULL`` if no functions are present." msgstr "" -#: ../../c-api/module.rst:203 +#: ../../c-api/module.rst:207 msgid "" "An array of slot definitions for multi-phase initialization, terminated by a " "``{0, NULL}`` entry. When using legacy single-phase initialization, " "*m_slots* must be ``NULL``." msgstr "" -#: ../../c-api/module.rst:209 +#: ../../c-api/module.rst:213 msgid "" "Prior to version 3.5, this member was always set to ``NULL``, and was " "defined as:" msgstr "" +"在 3.5 版本之前,這個成員總是被設為 ``NULL``,並被定義為:" -#: ../../c-api/module.rst:216 +#: ../../c-api/module.rst:220 msgid "" "A traversal function to call during GC traversal of the module object, or " "``NULL`` if not needed." msgstr "" -#: ../../c-api/module.rst:219 ../../c-api/module.rst:234 -#: ../../c-api/module.rst:255 +#: ../../c-api/module.rst:223 ../../c-api/module.rst:238 +#: ../../c-api/module.rst:259 msgid "" "This function is not called if the module state was requested but is not " "allocated yet. This is the case immediately after the module is created and " "before the module is executed (:c:data:`Py_mod_exec` function). More " "precisely, this function is not called if :c:member:`~PyModuleDef.m_size` is " -"greater than 0 and the module state (as returned " -"by :c:func:`PyModule_GetState`) is ``NULL``." +"greater than 0 and the module state (as returned by :c:func:" +"`PyModule_GetState`) is ``NULL``." msgstr "" -#: ../../c-api/module.rst:226 ../../c-api/module.rst:247 -#: ../../c-api/module.rst:262 +#: ../../c-api/module.rst:230 ../../c-api/module.rst:251 +#: ../../c-api/module.rst:266 msgid "No longer called before the module state is allocated." msgstr "" -#: ../../c-api/module.rst:231 +#: ../../c-api/module.rst:235 msgid "" "A clear function to call during GC clearing of the module object, or " "``NULL`` if not needed." msgstr "" -#: ../../c-api/module.rst:241 +#: ../../c-api/module.rst:245 msgid "" "Like :c:member:`PyTypeObject.tp_clear`, this function is not *always* called " "before a module is deallocated. For example, when reference counting is " @@ -275,55 +284,55 @@ msgid "" "directly." msgstr "" -#: ../../c-api/module.rst:252 +#: ../../c-api/module.rst:256 msgid "" "A function to call during deallocation of the module object, or ``NULL`` if " "not needed." msgstr "" -#: ../../c-api/module.rst:267 +#: ../../c-api/module.rst:271 msgid "Module slots" msgstr "模組槽 (Module slots)" -#: ../../c-api/module.rst:273 +#: ../../c-api/module.rst:277 msgid "A slot ID, chosen from the available values explained below." msgstr "" -#: ../../c-api/module.rst:277 +#: ../../c-api/module.rst:281 msgid "Value of the slot, whose meaning depends on the slot ID." msgstr "" -#: ../../c-api/module.rst:281 +#: ../../c-api/module.rst:285 msgid "The available slot types are:" msgstr "" -#: ../../c-api/module.rst:285 +#: ../../c-api/module.rst:289 msgid "" "Specifies a function that is called to create the module object itself. The " "*value* pointer of this slot must point to a function of the signature:" msgstr "" -#: ../../c-api/module.rst:292 +#: ../../c-api/module.rst:296 msgid "" "The function receives a :py:class:`~importlib.machinery.ModuleSpec` " "instance, as defined in :PEP:`451`, and the module definition. It should " "return a new module object, or set an error and return ``NULL``." msgstr "" -#: ../../c-api/module.rst:297 +#: ../../c-api/module.rst:301 msgid "" "This function should be kept minimal. In particular, it should not call " "arbitrary Python code, as trying to import the same module again may result " "in an infinite loop." msgstr "" -#: ../../c-api/module.rst:301 +#: ../../c-api/module.rst:305 msgid "" "Multiple ``Py_mod_create`` slots may not be specified in one module " "definition." msgstr "" -#: ../../c-api/module.rst:304 +#: ../../c-api/module.rst:308 msgid "" "If ``Py_mod_create`` is not specified, the import machinery will create a " "normal module object using :c:func:`PyModule_New`. The name is taken from " @@ -332,17 +341,17 @@ msgid "" "through symlinks, all while sharing a single module definition." msgstr "" -#: ../../c-api/module.rst:310 +#: ../../c-api/module.rst:314 msgid "" -"There is no requirement for the returned object to be an instance " -"of :c:type:`PyModule_Type`. Any type can be used, as long as it supports " -"setting and getting import-related attributes. However, only " -"``PyModule_Type`` instances may be returned if the ``PyModuleDef`` has non-" -"``NULL`` ``m_traverse``, ``m_clear``, ``m_free``; non-zero ``m_size``; or " -"slots other than ``Py_mod_create``." +"There is no requirement for the returned object to be an instance of :c:type:" +"`PyModule_Type`. Any type can be used, as long as it supports setting and " +"getting import-related attributes. However, only ``PyModule_Type`` instances " +"may be returned if the ``PyModuleDef`` has non-``NULL`` ``m_traverse``, " +"``m_clear``, ``m_free``; non-zero ``m_size``; or slots other than " +"``Py_mod_create``." msgstr "" -#: ../../c-api/module.rst:319 +#: ../../c-api/module.rst:323 msgid "" "Specifies a function that is called to *execute* the module. This is " "equivalent to executing the code of a Python module: typically, this " @@ -350,61 +359,61 @@ msgid "" "function is:" msgstr "" -#: ../../c-api/module.rst:328 +#: ../../c-api/module.rst:332 msgid "" "If multiple ``Py_mod_exec`` slots are specified, they are processed in the " "order they appear in the *m_slots* array." msgstr "" -#: ../../c-api/module.rst:333 ../../c-api/module.rst:366 +#: ../../c-api/module.rst:337 ../../c-api/module.rst:370 msgid "Specifies one of the following values:" msgstr "" -#: ../../c-api/module.rst:339 +#: ../../c-api/module.rst:343 msgid "The module does not support being imported in subinterpreters." msgstr "" -#: ../../c-api/module.rst:343 +#: ../../c-api/module.rst:347 msgid "" "The module supports being imported in subinterpreters, but only when they " "share the main interpreter's GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: ../../c-api/module.rst:349 +#: ../../c-api/module.rst:353 msgid "" "The module supports being imported in subinterpreters, even when they have " "their own GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: ../../c-api/module.rst:353 +#: ../../c-api/module.rst:357 msgid "" "This slot determines whether or not importing this module in a " "subinterpreter will fail." msgstr "" -#: ../../c-api/module.rst:356 +#: ../../c-api/module.rst:360 msgid "" "Multiple ``Py_mod_multiple_interpreters`` slots may not be specified in one " "module definition." msgstr "" -#: ../../c-api/module.rst:359 +#: ../../c-api/module.rst:363 msgid "" "If ``Py_mod_multiple_interpreters`` is not specified, the import machinery " "defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``." msgstr "" -#: ../../c-api/module.rst:372 +#: ../../c-api/module.rst:376 msgid "" "The module depends on the presence of the global interpreter lock (GIL), and " "may access global state without synchronization." msgstr "" -#: ../../c-api/module.rst:377 +#: ../../c-api/module.rst:381 msgid "The module is safe to run without an active GIL." msgstr "" -#: ../../c-api/module.rst:379 +#: ../../c-api/module.rst:383 msgid "" "This slot is ignored by Python builds not configured with :option:`--disable-" "gil`. Otherwise, it determines whether or not importing this module will " @@ -412,22 +421,22 @@ msgid "" "threaded-cpython` for more detail." msgstr "" -#: ../../c-api/module.rst:384 +#: ../../c-api/module.rst:388 msgid "" "Multiple ``Py_mod_gil`` slots may not be specified in one module definition." msgstr "" -#: ../../c-api/module.rst:386 +#: ../../c-api/module.rst:390 msgid "" "If ``Py_mod_gil`` is not specified, the import machinery defaults to " "``Py_MOD_GIL_USED``." msgstr "" -#: ../../c-api/module.rst:395 +#: ../../c-api/module.rst:399 msgid "Creating extension modules dynamically" msgstr "" -#: ../../c-api/module.rst:397 +#: ../../c-api/module.rst:401 msgid "" "The following functions may be used to create a module outside of an " "extension's :ref:`initialization function `. They are " @@ -435,42 +444,41 @@ msgid "" "initialization>`." msgstr "" -#: ../../c-api/module.rst:404 +#: ../../c-api/module.rst:408 msgid "" "Create a new module object, given the definition in *def*. This is a macro " -"that calls :c:func:`PyModule_Create2` with *module_api_version* set " -"to :c:macro:`PYTHON_API_VERSION`, or to :c:macro:`PYTHON_ABI_VERSION` if " -"using the :ref:`limited API `." +"that calls :c:func:`PyModule_Create2` with *module_api_version* set to :c:" +"macro:`PYTHON_API_VERSION`, or to :c:macro:`PYTHON_ABI_VERSION` if using " +"the :ref:`limited API `." msgstr "" -#: ../../c-api/module.rst:412 +#: ../../c-api/module.rst:416 msgid "" "Create a new module object, given the definition in *def*, assuming the API " "version *module_api_version*. If that version does not match the version of " "the running interpreter, a :exc:`RuntimeWarning` is emitted." msgstr "" -#: ../../c-api/module.rst:418 +#: ../../c-api/module.rst:422 msgid "" "This function does not support slots. The :c:member:`~PyModuleDef.m_slots` " "member of *def* must be ``NULL``." msgstr "" -#: ../../c-api/module.rst:424 +#: ../../c-api/module.rst:428 msgid "" "Most uses of this function should be using :c:func:`PyModule_Create` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:429 +#: ../../c-api/module.rst:433 msgid "" "This macro calls :c:func:`PyModule_FromDefAndSpec2` with " -"*module_api_version* set to :c:macro:`PYTHON_API_VERSION`, or " -"to :c:macro:`PYTHON_ABI_VERSION` if using the :ref:`limited API `." +"*module_api_version* set to :c:macro:`PYTHON_API_VERSION`, or to :c:macro:" +"`PYTHON_ABI_VERSION` if using the :ref:`limited API `." msgstr "" -#: ../../c-api/module.rst:438 +#: ../../c-api/module.rst:442 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*, assuming the API version *module_api_version*. If that version does " @@ -478,42 +486,42 @@ msgid "" "emitted." msgstr "" -#: ../../c-api/module.rst:445 +#: ../../c-api/module.rst:449 msgid "" "Note that this does not process execution slots (:c:data:`Py_mod_exec`). " "Both ``PyModule_FromDefAndSpec`` and ``PyModule_ExecDef`` must be called to " "fully initialize a module." msgstr "" -#: ../../c-api/module.rst:451 +#: ../../c-api/module.rst:455 msgid "" "Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:458 +#: ../../c-api/module.rst:462 msgid "Process any execution slots (:c:data:`Py_mod_exec`) given in *def*." msgstr "" -#: ../../c-api/module.rst:464 +#: ../../c-api/module.rst:468 msgid "The C API version. Defined for backwards compatibility." msgstr "" -#: ../../c-api/module.rst:466 ../../c-api/module.rst:473 +#: ../../c-api/module.rst:470 ../../c-api/module.rst:477 msgid "" "Currently, this constant is not updated in new Python versions, and is not " "useful for versioning. This may change in the future." msgstr "" -#: ../../c-api/module.rst:471 +#: ../../c-api/module.rst:475 msgid "Defined as ``3`` for backwards compatibility." msgstr "" -#: ../../c-api/module.rst:478 +#: ../../c-api/module.rst:482 msgid "Support functions" msgstr "支援的函式" -#: ../../c-api/module.rst:480 +#: ../../c-api/module.rst:484 msgid "" "The following functions are provided to help initialize a module state. They " "are intended for a module's execution slots (:c:data:`Py_mod_exec`), the " @@ -521,23 +529,23 @@ msgid "" "phase-initialization>`, or code that creates modules dynamically." msgstr "" -#: ../../c-api/module.rst:488 +#: ../../c-api/module.rst:492 msgid "" "Add an object to *module* as *name*. This is a convenience function which " "can be used from the module's initialization function." msgstr "" -#: ../../c-api/module.rst:491 +#: ../../c-api/module.rst:495 msgid "" "On success, return ``0``. On error, raise an exception and return ``-1``." msgstr "" -#: ../../c-api/module.rst:493 ../../c-api/module.rst:544 -#: ../../c-api/module.rst:571 +#: ../../c-api/module.rst:497 ../../c-api/module.rst:548 +#: ../../c-api/module.rst:575 msgid "Example usage::" msgstr "用法範例: ::" -#: ../../c-api/module.rst:495 +#: ../../c-api/module.rst:499 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -563,20 +571,20 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:507 +#: ../../c-api/module.rst:511 msgid "" "To be convenient, the function accepts ``NULL`` *value* with an exception " "set. In this case, return ``-1`` and just leave the raised exception " "unchanged." msgstr "" -#: ../../c-api/module.rst:511 +#: ../../c-api/module.rst:515 msgid "" "The example can also be written without checking explicitly if *obj* is " "``NULL``::" msgstr "" -#: ../../c-api/module.rst:514 +#: ../../c-api/module.rst:518 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -596,23 +604,23 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:523 +#: ../../c-api/module.rst:527 msgid "" "Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this " "case, since *obj* can be ``NULL``." msgstr "" -#: ../../c-api/module.rst:526 +#: ../../c-api/module.rst:530 msgid "" "The number of different *name* strings passed to this function should be " "kept small, usually by only using statically allocated strings as *name*. " -"For names that aren't known at compile time, prefer " -"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` " -"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " -"may be used internally to create a key object." +"For names that aren't known at compile time, prefer calling :c:func:" +"`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For more " +"details, see :c:func:`PyUnicode_InternFromString`, which may be used " +"internally to create a key object." msgstr "" -#: ../../c-api/module.rst:539 +#: ../../c-api/module.rst:543 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but \"steals\" a reference to " "*value*. It can be called with a result of function that returns a new " @@ -620,39 +628,43 @@ msgid "" "variable." msgstr "" -#: ../../c-api/module.rst:546 +#: ../../c-api/module.rst:550 msgid "" "if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" " goto error;\n" "}" msgstr "" +"if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" +" goto error;\n" +"}" -#: ../../c-api/module.rst:555 +#: ../../c-api/module.rst:559 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to " "*value* on success (if it returns ``0``)." msgstr "" +"類似於 :c:func:`PyModule_AddObjectRef`,但在成功時(如果回傳 ``0``)會偷走對 *value* 的參照。" -#: ../../c-api/module.rst:558 +#: ../../c-api/module.rst:562 msgid "" "The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions " "are recommended, since it is easy to introduce reference leaks by misusing " "the :c:func:`PyModule_AddObject` function." msgstr "" -#: ../../c-api/module.rst:565 +#: ../../c-api/module.rst:569 msgid "" "Unlike other functions that steal references, ``PyModule_AddObject()`` only " "releases the reference to *value* **on success**." msgstr "" -#: ../../c-api/module.rst:568 +#: ../../c-api/module.rst:572 msgid "" -"This means that its return value must be checked, and calling code " -"must :c:func:`Py_XDECREF` *value* manually on error." +"This means that its return value must be checked, and calling code must :c:" +"func:`Py_XDECREF` *value* manually on error." msgstr "" -#: ../../c-api/module.rst:573 +#: ../../c-api/module.rst:577 msgid "" "PyObject *obj = PyBytes_FromString(value);\n" "if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" @@ -666,24 +678,24 @@ msgid "" "// Py_XDECREF(obj) is not needed here." msgstr "" -#: ../../c-api/module.rst:586 +#: ../../c-api/module.rst:590 msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." -msgstr "" +msgstr ":c:func:`PyModule_AddObject` 已被\\ :term:`軟性棄用 `。" -#: ../../c-api/module.rst:591 +#: ../../c-api/module.rst:595 msgid "" "Add an integer constant to *module* as *name*. This convenience function " "can be used from the module's initialization function. Return ``-1`` with an " "exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:595 +#: ../../c-api/module.rst:599 msgid "" -"This is a convenience function that calls :c:func:`PyLong_FromLong` " -"and :c:func:`PyModule_AddObjectRef`; see their documentation for details." +"This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:" +"func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" -#: ../../c-api/module.rst:601 +#: ../../c-api/module.rst:605 msgid "" "Add a string constant to *module* as *name*. This convenience function can " "be used from the module's initialization function. The string *value* must " @@ -691,14 +703,14 @@ msgid "" "on success." msgstr "" -#: ../../c-api/module.rst:606 +#: ../../c-api/module.rst:610 msgid "" -"This is a convenience function that " -"calls :c:func:`PyUnicode_InternFromString` " -"and :c:func:`PyModule_AddObjectRef`; see their documentation for details." +"This is a convenience function that calls :c:func:" +"`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their " +"documentation for details." msgstr "" -#: ../../c-api/module.rst:613 +#: ../../c-api/module.rst:617 msgid "" "Add an int constant to *module*. The name and the value are taken from " "*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int " @@ -706,11 +718,11 @@ msgid "" "with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:621 +#: ../../c-api/module.rst:625 msgid "Add a string constant to *module*." msgstr "將字串常數加入到 *module* 中。" -#: ../../c-api/module.rst:625 +#: ../../c-api/module.rst:629 msgid "" "Add a type object to *module*. The type object is finalized by calling " "internally :c:func:`PyType_Ready`. The name of the type object is taken from " @@ -718,7 +730,7 @@ msgid "" "``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:635 +#: ../../c-api/module.rst:639 msgid "" "Add the functions from the ``NULL`` terminated *functions* array to " "*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " @@ -727,7 +739,7 @@ msgid "" "first parameter, making them similar to instance methods on Python classes)." msgstr "" -#: ../../c-api/module.rst:641 +#: ../../c-api/module.rst:645 msgid "" "This function is called automatically when creating a module from " "``PyModuleDef`` (such as when using :ref:`multi-phase-initialization`, " @@ -736,7 +748,7 @@ msgid "" "that case they should call this function directly." msgstr "" -#: ../../c-api/module.rst:652 +#: ../../c-api/module.rst:656 msgid "" "Set the docstring for *module* to *docstring*. This function is called " "automatically when creating a module from ``PyModuleDef`` (such as when " @@ -744,23 +756,23 @@ msgid "" "``PyModule_FromDefAndSpec``)." msgstr "" -#: ../../c-api/module.rst:661 +#: ../../c-api/module.rst:665 msgid "" "Indicate that *module* does or does not support running without the global " "interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. " -"It must be called during *module*'s initialization function when " -"using :ref:`single-phase-initialization`. If this function is not called " -"during module initialization, the import machinery assumes the module does " -"not support running without the GIL. This function is only available in " -"Python builds configured with :option:`--disable-gil`. Return ``-1`` with an " -"exception set on error, ``0`` on success." +"It must be called during *module*'s initialization function when using :ref:" +"`single-phase-initialization`. If this function is not called during module " +"initialization, the import machinery assumes the module does not support " +"running without the GIL. This function is only available in Python builds " +"configured with :option:`--disable-gil`. Return ``-1`` with an exception set " +"on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:675 +#: ../../c-api/module.rst:679 msgid "Module lookup (single-phase initialization)" msgstr "" -#: ../../c-api/module.rst:677 +#: ../../c-api/module.rst:681 msgid "" "The legacy :ref:`single-phase initialization ` " "initialization scheme creates singleton modules that can be looked up in the " @@ -768,14 +780,14 @@ msgid "" "retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:682 +#: ../../c-api/module.rst:686 msgid "" "These functions will not work on modules created using multi-phase " "initialization, since multiple such modules can be created from a single " "definition." msgstr "" -#: ../../c-api/module.rst:687 +#: ../../c-api/module.rst:691 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -784,18 +796,18 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:694 +#: ../../c-api/module.rst:698 msgid "" "Attaches the module object passed to the function to the interpreter state. " -"This allows the module object to be accessible " -"via :c:func:`PyState_FindModule`." +"This allows the module object to be accessible via :c:func:" +"`PyState_FindModule`." msgstr "" -#: ../../c-api/module.rst:697 +#: ../../c-api/module.rst:701 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:699 +#: ../../c-api/module.rst:703 msgid "" "Python calls ``PyState_AddModule`` automatically after importing a module " "that uses :ref:`single-phase initialization `, " @@ -807,21 +819,21 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:708 +#: ../../c-api/module.rst:712 msgid "" "If a module was attached previously using the same *def*, it is replaced by " "the new *module*." msgstr "" -#: ../../c-api/module.rst:711 ../../c-api/module.rst:722 +#: ../../c-api/module.rst:715 ../../c-api/module.rst:726 msgid "The caller must have an :term:`attached thread state`." msgstr "" -#: ../../c-api/module.rst:713 +#: ../../c-api/module.rst:717 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:719 +#: ../../c-api/module.rst:723 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." @@ -847,7 +859,7 @@ msgstr "__name__(模組屬性)" msgid "__doc__ (module attribute)" msgstr "__doc__(模組屬性)" -#: ../../c-api/module.rst:33 ../../c-api/module.rst:108 +#: ../../c-api/module.rst:33 ../../c-api/module.rst:112 msgid "__file__ (module attribute)" msgstr "__file__(模組屬性)" @@ -863,12 +875,6 @@ msgstr "__loader__(模組屬性)" msgid "__dict__ (module attribute)" msgstr "__dict__(模組屬性)" -#: ../../c-api/module.rst:77 ../../c-api/module.rst:108 +#: ../../c-api/module.rst:77 ../../c-api/module.rst:112 msgid "SystemError (built-in exception)" msgstr "SystemError(內建例外)" - -#~ msgid "Initializing C modules" -#~ msgstr "初始化 C 模組" - -#~ msgid "See :PEP:`489` for more details on multi-phase initialization." -#~ msgstr "更多關於多階段初始化的詳細資訊,請參閱 :pep:`489`。" diff --git a/c-api/object.po b/c-api/object.po index 29f4268ec26..2c7d919add0 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-14 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -134,8 +134,8 @@ msgstr "" #: ../../c-api/object.rst:50 msgid "" -"This function is primarily intended for backwards compatibility: " -"using :c:func:`Py_GetConstant` is recommended for new code." +"This function is primarily intended for backwards compatibility: using :c:" +"func:`Py_GetConstant` is recommended for new code." msgstr "" #: ../../c-api/object.rst:53 @@ -153,16 +153,15 @@ msgstr "" #: ../../c-api/object.rst:67 msgid "" "Properly handle returning :c:data:`Py_NotImplemented` from within a C " -"function (that is, create a new :term:`strong reference` " -"to :const:`NotImplemented` and return it)." +"function (that is, create a new :term:`strong reference` to :const:" +"`NotImplemented` and return it)." msgstr "" #: ../../c-api/object.rst:74 msgid "" -"Flag to be used with multiple functions that print the object " -"(like :c:func:`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, " -"these function would use the :func:`str` of the object instead of " -"the :func:`repr`." +"Flag to be used with multiple functions that print the object (like :c:func:" +"`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, these " +"function would use the :func:`str` of the object instead of the :func:`repr`." msgstr "" #: ../../c-api/object.rst:82 @@ -195,27 +194,26 @@ msgstr "" #: ../../c-api/object.rst:113 msgid "" -"Exceptions that occur when this calls :meth:`~object.__getattr__` " -"and :meth:`~object.__getattribute__` methods aren't propagated, but instead " -"given to :func:`sys.unraisablehook`. For proper error handling, " -"use :c:func:`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` " -"or :c:func:`PyObject_GetAttr` instead." +"Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" +"`~object.__getattribute__` methods aren't propagated, but instead given to :" +"func:`sys.unraisablehook`. For proper error handling, use :c:func:" +"`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` or :c:func:" +"`PyObject_GetAttr` instead." msgstr "" #: ../../c-api/object.rst:122 msgid "" "This is the same as :c:func:`PyObject_HasAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " -"a :c:expr:`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" +"`PyObject*`." msgstr "" #: ../../c-api/object.rst:128 msgid "" -"Exceptions that occur when this calls :meth:`~object.__getattr__` " -"and :meth:`~object.__getattribute__` methods or while creating the " -"temporary :class:`str` object are silently ignored. For proper error " -"handling, " -"use :c:func:`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " +"Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" +"`~object.__getattribute__` methods or while creating the temporary :class:" +"`str` object are silently ignored. For proper error handling, use :c:func:" +"`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " "or :c:func:`PyObject_GetAttrString` instead." msgstr "" @@ -228,37 +226,36 @@ msgstr "" #: ../../c-api/object.rst:142 msgid "" -"If the missing attribute should not be treated as a failure, you can " -"use :c:func:`PyObject_GetOptionalAttr` instead." +"If the missing attribute should not be treated as a failure, you can use :c:" +"func:`PyObject_GetOptionalAttr` instead." msgstr "" #: ../../c-api/object.rst:148 msgid "" "This is the same as :c:func:`PyObject_GetAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " -"a :c:expr:`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" +"`PyObject*`." msgstr "" #: ../../c-api/object.rst:152 msgid "" -"If the missing attribute should not be treated as a failure, you can " -"use :c:func:`PyObject_GetOptionalAttrString` instead." +"If the missing attribute should not be treated as a failure, you can use :c:" +"func:`PyObject_GetOptionalAttrString` instead." msgstr "" #: ../../c-api/object.rst:158 msgid "" -"Variant of :c:func:`PyObject_GetAttr` which doesn't " -"raise :exc:`AttributeError` if the attribute is not found." +"Variant of :c:func:`PyObject_GetAttr` which doesn't raise :exc:" +"`AttributeError` if the attribute is not found." msgstr "" #: ../../c-api/object.rst:161 msgid "" -"If the attribute is found, return ``1`` and set *\\*result* to a " -"new :term:`strong reference` to the attribute. If the attribute is not " -"found, return ``0`` and set *\\*result* to ``NULL``; " -"the :exc:`AttributeError` is silenced. If an error other " -"than :exc:`AttributeError` is raised, return ``-1`` and set *\\*result* to " -"``NULL``." +"If the attribute is found, return ``1`` and set *\\*result* to a new :term:" +"`strong reference` to the attribute. If the attribute is not found, return " +"``0`` and set *\\*result* to ``NULL``; the :exc:`AttributeError` is " +"silenced. If an error other than :exc:`AttributeError` is raised, return " +"``-1`` and set *\\*result* to ``NULL``." msgstr "" #: ../../c-api/object.rst:173 @@ -272,11 +269,10 @@ msgstr "" msgid "" "Generic attribute getter function that is meant to be put into a type " "object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary " -"of classes in the object's MRO as well as an attribute in the " -"object's :attr:`~object.__dict__` (if present). As outlined " -"in :ref:`descriptors`, data descriptors take preference over instance " -"attributes, while non-data descriptors don't. Otherwise, " -"an :exc:`AttributeError` is raised." +"of classes in the object's MRO as well as an attribute in the object's :attr:" +"`~object.__dict__` (if present). As outlined in :ref:`descriptors`, data " +"descriptors take preference over instance attributes, while non-data " +"descriptors don't. Otherwise, an :exc:`AttributeError` is raised." msgstr "" #: ../../c-api/object.rst:191 @@ -296,8 +292,8 @@ msgstr "" #: ../../c-api/object.rst:203 msgid "" "This is the same as :c:func:`PyObject_SetAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " -"a :c:expr:`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" +"`PyObject*`." msgstr "" #: ../../c-api/object.rst:207 @@ -310,10 +306,10 @@ msgstr "" msgid "" "The number of different attribute names passed to this function should be " "kept small, usually by using a statically allocated string as *attr_name*. " -"For attribute names that aren't known at compile time, prefer " -"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` " -"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " -"may be used internally to create a key object." +"For attribute names that aren't known at compile time, prefer calling :c:" +"func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For " +"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " +"internally to create a key object." msgstr "" #: ../../c-api/object.rst:220 @@ -337,18 +333,18 @@ msgstr "" #: ../../c-api/object.rst:238 msgid "" "This is the same as :c:func:`PyObject_DelAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " -"a :c:expr:`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" +"`PyObject*`." msgstr "" #: ../../c-api/object.rst:242 msgid "" "The number of different attribute names passed to this function should be " "kept small, usually by using a statically allocated string as *attr_name*. " -"For attribute names that aren't known at compile time, prefer " -"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` " -"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " -"may be used internally to create a key object for lookup." +"For attribute names that aren't known at compile time, prefer calling :c:" +"func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` directly. For " +"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " +"internally to create a key object for lookup." msgstr "" #: ../../c-api/object.rst:253 @@ -392,12 +388,12 @@ msgstr "" #: ../../c-api/object.rst:287 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " -"which must be one " -"of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_GT`, " -"or :c:macro:`Py_GE`, corresponding to ``<``, ``<=``, ``==``, ``!=``, ``>``, " -"or ``>=`` respectively. This is the equivalent of the Python expression ``o1 " -"op o2``, where ``op`` is the operator corresponding to *opid*. Returns the " -"value of the comparison on success, or ``NULL`` on failure." +"which must be one of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :" +"c:macro:`Py_NE`, :c:macro:`Py_GT`, or :c:macro:`Py_GE`, corresponding to " +"``<``, ``<=``, ``==``, ``!=``, ``>``, or ``>=`` respectively. This is the " +"equivalent of the Python expression ``o1 op o2``, where ``op`` is the " +"operator corresponding to *opid*. Returns the value of the comparison on " +"success, or ``NULL`` on failure." msgstr "" #: ../../c-api/object.rst:297 @@ -443,10 +439,10 @@ msgstr "" #: ../../c-api/object.rst:330 msgid "" "As :c:func:`PyObject_Repr`, compute a string representation of object *o*, " -"but escape the non-ASCII characters in the string returned " -"by :c:func:`PyObject_Repr` with ``\\x``, ``\\u`` or ``\\U`` escapes. This " -"generates a string similar to that returned by :c:func:`PyObject_Repr` in " -"Python 2. Called by the :func:`ascii` built-in function." +"but escape the non-ASCII characters in the string returned by :c:func:" +"`PyObject_Repr` with ``\\x``, ``\\u`` or ``\\U`` escapes. This generates a " +"string similar to that returned by :c:func:`PyObject_Repr` in Python 2. " +"Called by the :func:`ascii` built-in function." msgstr "" #: ../../c-api/object.rst:341 @@ -483,8 +479,8 @@ msgstr "" msgid "" "If *cls* has a :meth:`~type.__subclasscheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " -"*derived* is a subclass of *cls* if it is a direct or indirect subclass, " -"i.e. contained in :attr:`cls.__mro__ `." +"*derived* is a subclass of *cls* if it is a direct or indirect subclass, i." +"e. contained in :attr:`cls.__mro__ `." msgstr "" #: ../../c-api/object.rst:376 @@ -509,8 +505,8 @@ msgstr "" #: ../../c-api/object.rst:394 msgid "" -"An instance *inst* can override what is considered its class by having " -"a :attr:`~object.__class__` attribute." +"An instance *inst* can override what is considered its class by having a :" +"attr:`~object.__class__` attribute." msgstr "" #: ../../c-api/object.rst:397 @@ -609,9 +605,9 @@ msgstr "" #: ../../c-api/object.rst:498 msgid "" -"This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as " -"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " -"a :c:expr:`PyObject*`." +"This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as a :" +"c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" +"`PyObject*`." msgstr "" #: ../../c-api/object.rst:505 @@ -620,8 +616,8 @@ msgid "" "(possibly empty) list of strings appropriate for the object argument, or " "``NULL`` if there was an error. If the argument is ``NULL``, this is like " "the Python ``dir()``, returning the names of the current locals; in this " -"case, if no execution frame is active then ``NULL`` is returned " -"but :c:func:`PyErr_Occurred` will return false." +"case, if no execution frame is active then ``NULL`` is returned but :c:func:" +"`PyErr_Occurred` will return false." msgstr "" #: ../../c-api/object.rst:514 @@ -635,17 +631,17 @@ msgstr "" #: ../../c-api/object.rst:522 msgid "" "This is equivalent to the Python ``__iter__(self): return self`` method. It " -"is intended for :term:`iterator` types, to be used in " -"the :c:member:`PyTypeObject.tp_iter` slot." +"is intended for :term:`iterator` types, to be used in the :c:member:" +"`PyTypeObject.tp_iter` slot." msgstr "" #: ../../c-api/object.rst:528 msgid "" -"This is the equivalent to the Python expression ``aiter(o)``. Takes " -"an :class:`AsyncIterable` object and returns an :class:`AsyncIterator` for " -"it. This is typically a new iterator but if the argument is " -"an :class:`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and " -"returns ``NULL`` if the object cannot be iterated." +"This is the equivalent to the Python expression ``aiter(o)``. Takes an :" +"class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " +"This is typically a new iterator but if the argument is an :class:" +"`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and returns " +"``NULL`` if the object cannot be iterated." msgstr "" #: ../../c-api/object.rst:538 @@ -672,14 +668,14 @@ msgstr "" #: ../../c-api/object.rst:553 msgid "" "This may be larger than requested using :c:member:`-PyType_Spec.basicsize " -"`; it is safe to use this larger size (e.g. " -"with :c:func:`!memset`)." +"`; it is safe to use this larger size (e.g. with :c:" +"func:`!memset`)." msgstr "" #: ../../c-api/object.rst:556 msgid "" -"The type *cls* **must** have been created using " -"negative :c:member:`PyType_Spec.basicsize`. Python does not check this." +"The type *cls* **must** have been created using negative :c:member:" +"`PyType_Spec.basicsize`. Python does not check this." msgstr "" #: ../../c-api/object.rst:560 @@ -688,8 +684,8 @@ msgstr "錯誤時設定一個例外並回傳一個負值。" #: ../../c-api/object.rst:566 msgid "" -"Get a pointer to per-item data for a class " -"with :c:macro:`Py_TPFLAGS_ITEMS_AT_END`." +"Get a pointer to per-item data for a class with :c:macro:" +"`Py_TPFLAGS_ITEMS_AT_END`." msgstr "" #: ../../c-api/object.rst:569 @@ -697,14 +693,14 @@ msgid "" "On error, set an exception and return ``NULL``. :py:exc:`TypeError` is " "raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." msgstr "" -"錯誤時設定一個例外並回傳 ``NULL``。如果 *o* 沒有設" -"定 :c:macro:`Py_TPFLAGS_ITEMS_AT_END`,則會引發 :py:exc:`TypeError`。" +"錯誤時設定一個例外並回傳 ``NULL``。如果 *o* 沒有設定 :c:macro:" +"`Py_TPFLAGS_ITEMS_AT_END`,則會引發 :py:exc:`TypeError`。" #: ../../c-api/object.rst:577 msgid "Visit the managed dictionary of *obj*." msgstr "" -#: ../../c-api/object.rst:579 ../../c-api/object.rst:588 +#: ../../c-api/object.rst:579 msgid "" "This function must only be called in a traverse function of the type which " "has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." @@ -714,6 +710,12 @@ msgstr "" msgid "Clear the managed dictionary of *obj*." msgstr "" +#: ../../c-api/object.rst:588 +msgid "" +"This function must only be called in a clear function of the type which has " +"the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." +msgstr "" + #: ../../c-api/object.rst:595 msgid "" "Enable `deferred reference counting ` references when possible, which " -"means that a reference count of ``1`` by itself does not guarantee that a " -"function argument uniquely referenced." +"modifications when loading objects onto the operands stack by :term:" +"`borrowing ` references when possible, which means that " +"a reference count of ``1`` by itself does not guarantee that a function " +"argument uniquely referenced." msgstr "" #: ../../c-api/object.rst:635 @@ -920,10 +922,10 @@ msgstr "" #: ../../c-api/object.rst:750 msgid "" -"On a :term:`free threaded ` build, this checks if " -"*op*'s :term:`reference count` is equal to one and additionally checks if " -"*op* is only used by this thread. :c:expr:`Py_REFCNT(op) == 1` is **not** " -"thread-safe on free threaded builds; prefer this function." +"On a :term:`free threaded ` build, this checks if *op*'s :" +"term:`reference count` is equal to one and additionally checks if *op* is " +"only used by this thread. :c:expr:`Py_REFCNT(op) == 1` is **not** thread-" +"safe on free threaded builds; prefer this function." msgstr "" #: ../../c-api/object.rst:755 diff --git a/c-api/type.po b/c-api/type.po index a3c70ae54df..d83b5ad7cfc 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -642,7 +642,7 @@ msgstr "" #: ../../c-api/type.rst:549 msgid ":c:data:`Py_tp_token`" -msgstr "" +msgstr ":c:data:`Py_tp_token`" #: ../../c-api/type.rst:551 msgid "" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index a77ed49a211..c1c5a71066a 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-14 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,8 +45,8 @@ msgstr "" #: ../../c-api/typeobj.rst:23 msgid "" "In addition to the following quick reference, the :ref:`typedef-examples` " -"section provides at-a-glance insight into the meaning and use " -"of :c:type:`PyTypeObject`." +"section provides at-a-glance insight into the meaning and use of :c:type:" +"`PyTypeObject`." msgstr "" #: ../../c-api/typeobj.rst:29 @@ -63,7 +63,7 @@ msgstr "" #: ../../c-api/typeobj.rst:40 ../../c-api/typeobj.rst:201 msgid ":ref:`Type `" -msgstr "" +msgstr ":ref:`Type `" #: ../../c-api/typeobj.rst:40 msgid "special methods/attrs" @@ -1180,9 +1180,9 @@ msgstr "" #: ../../c-api/typeobj.rst:476 msgid "" -"The structure definition for :c:type:`PyTypeObject` can be found " -"in :file:`Include/cpython/object.h`. For convenience of reference, this " -"repeats the definition found there:" +"The structure definition for :c:type:`PyTypeObject` can be found in :file:" +"`Include/cpython/object.h`. For convenience of reference, this repeats the " +"definition found there:" msgstr "" #: ../../c-api/typeobj.rst:482 @@ -1290,12 +1290,11 @@ msgstr "" #: ../../c-api/typeobj.rst:488 msgid "" -"The type object structure extends the :c:type:`PyVarObject` structure. " -"The :c:member:`~PyVarObject.ob_size` field is used for dynamic types " -"(created by :c:func:`!type_new`, usually called from a class statement). " -"Note that :c:data:`PyType_Type` (the metatype) " -"initializes :c:member:`~PyTypeObject.tp_itemsize`, which means that its " -"instances (i.e. type objects) *must* have " +"The type object structure extends the :c:type:`PyVarObject` structure. The :" +"c:member:`~PyVarObject.ob_size` field is used for dynamic types (created by :" +"c:func:`!type_new`, usually called from a class statement). Note that :c:" +"data:`PyType_Type` (the metatype) initializes :c:member:`~PyTypeObject." +"tp_itemsize`, which means that its instances (i.e. type objects) *must* have " "the :c:member:`~PyVarObject.ob_size` field." msgstr "" @@ -1307,10 +1306,10 @@ msgstr ":c:member:`PyObject.ob_refcnt`" msgid "" "The type object's reference count is initialized to ``1`` by the " "``PyObject_HEAD_INIT`` macro. Note that for :ref:`statically allocated type " -"objects `, the type's instances (objects " -"whose :c:member:`~PyObject.ob_type` points back to the type) do *not* count " -"as references. But for :ref:`dynamically allocated type objects `, the instances *do* count as references." +"objects `, the type's instances (objects whose :c:member:" +"`~PyObject.ob_type` points back to the type) do *not* count as references. " +"But for :ref:`dynamically allocated type objects `, the " +"instances *do* count as references." msgstr "" #: ../../c-api/typeobj.rst:504 ../../c-api/typeobj.rst:527 @@ -1375,11 +1374,10 @@ msgstr "Foo_Type.ob_type = &PyType_Type;" #: ../../c-api/typeobj.rst:522 msgid "" -"This should be done before any instances of the type are " -"created. :c:func:`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is " -"``NULL``, and if so, initializes it to the :c:member:`~PyObject.ob_type` " -"field of the base class. :c:func:`PyType_Ready` will not change this field " -"if it is non-zero." +"This should be done before any instances of the type are created. :c:func:" +"`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is ``NULL``, and if " +"so, initializes it to the :c:member:`~PyObject.ob_type` field of the base " +"class. :c:func:`PyType_Ready` will not change this field if it is non-zero." msgstr "" #: ../../c-api/typeobj.rst:529 ../../c-api/typeobj.rst:809 @@ -1418,9 +1416,8 @@ msgstr "" msgid "" "Each slot has a section describing inheritance. If :c:func:`PyType_Ready` " "may set a value when the field is set to ``NULL`` then there will also be a " -"\"Default\" section. (Note that many fields set " -"on :c:data:`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as " -"defaults.)" +"\"Default\" section. (Note that many fields set on :c:data:" +"`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as defaults.)" msgstr "" #: ../../c-api/typeobj.rst:558 @@ -1430,9 +1427,9 @@ msgid "" "module name, followed by a dot, followed by the type name; for built-in " "types, it should be just the type name. If the module is a submodule of a " "package, the full package name is part of the full module name. For " -"example, a type named :class:`!T` defined in module :mod:`!M` in " -"subpackage :mod:`!Q` in package :mod:`!P` should have " -"the :c:member:`~PyTypeObject.tp_name` initializer ``\"P.Q.M.T\"``." +"example, a type named :class:`!T` defined in module :mod:`!M` in subpackage :" +"mod:`!Q` in package :mod:`!P` should have the :c:member:`~PyTypeObject." +"tp_name` initializer ``\"P.Q.M.T\"``." msgstr "" #: ../../c-api/typeobj.rst:566 @@ -1453,18 +1450,18 @@ msgstr "" #: ../../c-api/typeobj.rst:577 msgid "" "If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is " -"made accessible as the :attr:`~type.__name__` attribute, and " -"the :attr:`~type.__module__` attribute is undefined (unless explicitly set " -"in the dictionary, as explained above). This means your type will be " -"impossible to pickle. Additionally, it will not be listed in module " -"documentations created with pydoc." +"made accessible as the :attr:`~type.__name__` attribute, and the :attr:" +"`~type.__module__` attribute is undefined (unless explicitly set in the " +"dictionary, as explained above). This means your type will be impossible to " +"pickle. Additionally, it will not be listed in module documentations " +"created with pydoc." msgstr "" #: ../../c-api/typeobj.rst:583 msgid "" -"This field must not be ``NULL``. It is the only required field " -"in :c:func:`PyTypeObject` (other than " -"potentially :c:member:`~PyTypeObject.tp_itemsize`)." +"This field must not be ``NULL``. It is the only required field in :c:func:" +"`PyTypeObject` (other than potentially :c:member:`~PyTypeObject." +"tp_itemsize`)." msgstr "" #: ../../c-api/typeobj.rst:595 @@ -1474,20 +1471,20 @@ msgstr "" #: ../../c-api/typeobj.rst:597 msgid "" -"There are two kinds of types: types with fixed-length instances have a " -"zero :c:member:`!tp_itemsize` field, types with variable-length instances " -"have a non-zero :c:member:`!tp_itemsize` field. For a type with fixed-" -"length instances, all instances have the same size, given in :c:member:`!" -"tp_basicsize`. (Exceptions to this rule can be made " -"using :c:func:`PyUnstable_Object_GC_NewWithExtraData`.)" +"There are two kinds of types: types with fixed-length instances have a zero :" +"c:member:`!tp_itemsize` field, types with variable-length instances have a " +"non-zero :c:member:`!tp_itemsize` field. For a type with fixed-length " +"instances, all instances have the same size, given in :c:member:`!" +"tp_basicsize`. (Exceptions to this rule can be made using :c:func:" +"`PyUnstable_Object_GC_NewWithExtraData`.)" msgstr "" #: ../../c-api/typeobj.rst:604 msgid "" -"For a type with variable-length instances, the instances must have " -"an :c:member:`~PyVarObject.ob_size` field, and the instance size " -"is :c:member:`!tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N " -"is the \"length\" of the object." +"For a type with variable-length instances, the instances must have an :c:" +"member:`~PyVarObject.ob_size` field, and the instance size is :c:member:`!" +"tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N is the " +"\"length\" of the object." msgstr "" #: ../../c-api/typeobj.rst:609 @@ -1497,14 +1494,14 @@ msgid "" "field. Note that the :c:member:`~PyVarObject.ob_size` field may later be " "used for other purposes. For example, :py:type:`int` instances use the bits " "of :c:member:`~PyVarObject.ob_size` in an implementation-defined way; the " -"underlying storage and its size should be accessed " -"using :c:func:`PyLong_Export`." +"underlying storage and its size should be accessed using :c:func:" +"`PyLong_Export`." msgstr "" #: ../../c-api/typeobj.rst:619 msgid "" -"The :c:member:`~PyVarObject.ob_size` field should be accessed using " -"the :c:func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." +"The :c:member:`~PyVarObject.ob_size` field should be accessed using the :c:" +"func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." msgstr "" #: ../../c-api/typeobj.rst:622 @@ -1512,34 +1509,33 @@ msgid "" "Also, the presence of an :c:member:`~PyVarObject.ob_size` field in the " "instance layout doesn't mean that the instance structure is variable-length. " "For example, the :py:type:`list` type has fixed-length instances, yet those " -"instances have a :c:member:`~PyVarObject.ob_size` field. (As " -"with :py:type:`int`, avoid reading lists' :c:member:`!ob_size` directly. " -"Call :c:func:`PyList_Size` instead.)" +"instances have a :c:member:`~PyVarObject.ob_size` field. (As with :py:type:" +"`int`, avoid reading lists' :c:member:`!ob_size` directly. Call :c:func:" +"`PyList_Size` instead.)" msgstr "" #: ../../c-api/typeobj.rst:629 msgid "" -"The :c:member:`!tp_basicsize` includes size needed for data of the " -"type's :c:member:`~PyTypeObject.tp_base`, plus any extra data needed by each " -"instance." +"The :c:member:`!tp_basicsize` includes size needed for data of the type's :c:" +"member:`~PyTypeObject.tp_base`, plus any extra data needed by each instance." msgstr "" #: ../../c-api/typeobj.rst:633 msgid "" "The correct way to set :c:member:`!tp_basicsize` is to use the ``sizeof`` " "operator on the struct used to declare the instance layout. This struct must " -"include the struct used to declare the base type. In other " -"words, :c:member:`!tp_basicsize` must be greater than or equal to the " -"base's :c:member:`!tp_basicsize`." +"include the struct used to declare the base type. In other words, :c:member:" +"`!tp_basicsize` must be greater than or equal to the base's :c:member:`!" +"tp_basicsize`." msgstr "" #: ../../c-api/typeobj.rst:639 msgid "" "Since every type is a subtype of :py:type:`object`, this struct must " -"include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on " -"whether :c:member:`~PyVarObject.ob_size` should be included). These are " -"usually defined by the macro :c:macro:`PyObject_HEAD` " -"or :c:macro:`PyObject_VAR_HEAD`, respectively." +"include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on whether :c:" +"member:`~PyVarObject.ob_size` should be included). These are usually defined " +"by the macro :c:macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD`, " +"respectively." msgstr "" #: ../../c-api/typeobj.rst:645 @@ -1550,8 +1546,8 @@ msgstr "" #: ../../c-api/typeobj.rst:648 msgid "" -"For cases where struct used to declare the base type is unknown, " -"see :c:member:`PyType_Spec.basicsize` and :c:func:`PyType_FromMetaclass`." +"For cases where struct used to declare the base type is unknown, see :c:" +"member:`PyType_Spec.basicsize` and :c:func:`PyType_FromMetaclass`." msgstr "" #: ../../c-api/typeobj.rst:651 @@ -1609,11 +1605,10 @@ msgstr "" #: ../../c-api/typeobj.rst:688 msgid "" -"If you may call functions that may set the error indicator, you must " -"use :c:func:`PyErr_GetRaisedException` " -"and :c:func:`PyErr_SetRaisedException` to ensure you don't clobber a " -"preexisting error indicator (the deallocation could have occurred while " -"processing a different error):" +"If you may call functions that may set the error indicator, you must use :c:" +"func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` to " +"ensure you don't clobber a preexisting error indicator (the deallocation " +"could have occurred while processing a different error):" msgstr "" #: ../../c-api/typeobj.rst:693 @@ -1642,15 +1637,15 @@ msgstr "" #: ../../c-api/typeobj.rst:710 msgid "" "Python will destroy an object immediately or some time after the final " -"reference to the object is deleted, unless its finalizer " -"(:c:member:`~PyTypeObject.tp_finalize`) subsequently resurrects the object." +"reference to the object is deleted, unless its finalizer (:c:member:" +"`~PyTypeObject.tp_finalize`) subsequently resurrects the object." msgstr "" #: ../../c-api/typeobj.rst:714 msgid "" -"An object will not be destroyed while it is being automatically finalized " -"(:c:member:`~PyTypeObject.tp_finalize`) or automatically cleared " -"(:c:member:`~PyTypeObject.tp_clear`)." +"An object will not be destroyed while it is being automatically finalized (:" +"c:member:`~PyTypeObject.tp_finalize`) or automatically cleared (:c:member:" +"`~PyTypeObject.tp_clear`)." msgstr "" #: ../../c-api/typeobj.rst:718 @@ -1676,18 +1671,18 @@ msgstr "" #: ../../c-api/typeobj.rst:730 msgid "" -"It is permissible to call :c:member:`~PyTypeObject.tp_clear` " -"from :c:member:`!tp_dealloc` to reduce code duplication and to guarantee " -"that the object is always cleared before destruction. Beware " -"that :c:member:`!tp_clear` might have already been called." +"It is permissible to call :c:member:`~PyTypeObject.tp_clear` from :c:member:" +"`!tp_dealloc` to reduce code duplication and to guarantee that the object is " +"always cleared before destruction. Beware that :c:member:`!tp_clear` might " +"have already been called." msgstr "" #: ../../c-api/typeobj.rst:735 msgid "" "If the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " -"deallocator should release the owned reference to its type object " -"(via :c:func:`Py_DECREF`) after calling the type deallocator. See the " -"example code below.::" +"deallocator should release the owned reference to its type object (via :c:" +"func:`Py_DECREF`) after calling the type deallocator. See the example code " +"below.::" msgstr "" #: ../../c-api/typeobj.rst:740 @@ -1806,10 +1801,10 @@ msgstr "" #: ../../c-api/typeobj.rst:831 msgid "" -"Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also " -"set :c:member:`~PyTypeObject.tp_call` and make sure its behaviour is " -"consistent with the *vectorcallfunc* function. This can be done by setting " -"*tp_call* to :c:func:`PyVectorcall_Call`." +"Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also set :c:member:" +"`~PyTypeObject.tp_call` and make sure its behaviour is consistent with the " +"*vectorcallfunc* function. This can be done by setting *tp_call* to :c:func:" +"`PyVectorcall_Call`." msgstr "" #: ../../c-api/typeobj.rst:838 @@ -1821,19 +1816,19 @@ msgstr "" #: ../../c-api/typeobj.rst:844 msgid "" "Before version 3.12, it was not recommended for :ref:`mutable heap types " -"` to implement the vectorcall protocol. When a user " -"sets :attr:`~object.__call__` in Python code, only *tp_call* is updated, " -"likely making it inconsistent with the vectorcall function. Since 3.12, " -"setting ``__call__`` will disable vectorcall optimization by clearing " -"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag." +"` to implement the vectorcall protocol. When a user sets :attr:" +"`~object.__call__` in Python code, only *tp_call* is updated, likely making " +"it inconsistent with the vectorcall function. Since 3.12, setting " +"``__call__`` will disable vectorcall optimization by clearing the :c:macro:" +"`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" #: ../../c-api/typeobj.rst:854 msgid "" -"This field is always inherited. However, " -"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If " -"it's not set, then the subclass won't use :ref:`vectorcall `, " -"except when :c:func:`PyVectorcall_Call` is explicitly called." +"This field is always inherited. However, the :c:macro:" +"`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, " +"then the subclass won't use :ref:`vectorcall `, except when :c:" +"func:`PyVectorcall_Call` is explicitly called." msgstr "" #: ../../c-api/typeobj.rst:863 @@ -1847,21 +1842,24 @@ msgid "" "but taking a C string instead of a Python string object to give the " "attribute name." msgstr "" +"此欄位已被棄用。當它被定義時,它應該指向一個與 :c:member:`~PyTypeObject.tp_getattro` " +"行為相同但使用 C 字串而非 Python 字串物件來提供屬性名稱的函式。" #: ../../c-api/typeobj.rst:871 ../../c-api/typeobj.rst:1067 -msgid "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject.tp_getattro`" +msgid "" +"Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject." +"tp_getattro`" msgstr "" -"群" -"組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject.tp_getattro`" +"群組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject." +"tp_getattro`" #: ../../c-api/typeobj.rst:873 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_getattro`: a subtype inherits " -"both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` " -"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." +"tp_getattro` are both ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:880 ../../c-api/typeobj.rst:1080 @@ -1876,21 +1874,24 @@ msgid "" "but taking a C string instead of a Python string object to give the " "attribute name." msgstr "" +"此欄位已被棄用。當它被定義時,它應該指向一個與 :c:member:`~PyTypeObject.tp_setattro` " +"行為相同但使用 C 字串而非 Python 字串物件來提供屬性名稱的函式。" #: ../../c-api/typeobj.rst:888 ../../c-api/typeobj.rst:1093 -msgid "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject.tp_setattro`" +msgid "" +"Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject." +"tp_setattro`" msgstr "" -"群" -"組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject.tp_setattro`" +"群組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject." +"tp_setattro`" #: ../../c-api/typeobj.rst:890 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_setattro`: a subtype inherits " -"both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` " -"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." +"tp_setattro` are both ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:897 @@ -1902,7 +1903,7 @@ msgstr "" #: ../../c-api/typeobj.rst:901 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." -msgstr "" +msgstr "以前稱為 ``tp_compare`` 和 ``tp_reserved``。" #: ../../c-api/typeobj.rst:906 msgid "" @@ -1912,13 +1913,13 @@ msgstr "" #: ../../c-api/typeobj.rst:914 msgid "" -"An optional pointer to a function that implements the built-in " -"function :func:`repr`." +"An optional pointer to a function that implements the built-in function :" +"func:`repr`." msgstr "" #: ../../c-api/typeobj.rst:917 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" -msgstr "" +msgstr "函式簽名與 :c:func:`PyObject_Repr` 相同: ::" #: ../../c-api/typeobj.rst:919 msgid "PyObject *tp_repr(PyObject *self);" @@ -1992,13 +1993,13 @@ msgstr "" #: ../../c-api/typeobj.rst:979 msgid "" -"An optional pointer to a function that implements the built-in " -"function :func:`hash`." +"An optional pointer to a function that implements the built-in function :" +"func:`hash`." msgstr "" #: ../../c-api/typeobj.rst:982 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" -msgstr "" +msgstr "函式簽名與 :c:func:`PyObject_Hash` 相同: ::" #: ../../c-api/typeobj.rst:984 msgid "Py_hash_t tp_hash(PyObject *);" @@ -2014,9 +2015,9 @@ msgstr "" #: ../../c-api/typeobj.rst:990 msgid "" "When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` " -"is not set), an attempt to take the hash of the object " -"raises :exc:`TypeError`. This is the same as setting it " -"to :c:func:`PyObject_HashNotImplemented`." +"is not set), an attempt to take the hash of the object raises :exc:" +"`TypeError`. This is the same as setting it to :c:func:" +"`PyObject_HashNotImplemented`." msgstr "" #: ../../c-api/typeobj.rst:994 @@ -2026,29 +2027,30 @@ msgid "" "as the equivalent of ``__hash__ = None`` at the Python level, causing " "``isinstance(o, collections.Hashable)`` to correctly return ``False``. Note " "that the converse is also true - setting ``__hash__ = None`` on a class at " -"the Python level will result in the ``tp_hash`` slot being set " -"to :c:func:`PyObject_HashNotImplemented`." +"the Python level will result in the ``tp_hash`` slot being set to :c:func:" +"`PyObject_HashNotImplemented`." msgstr "" #: ../../c-api/typeobj.rst:1004 ../../c-api/typeobj.rst:1769 -msgid "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject.tp_richcompare`" +msgid "" +"Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." +"tp_richcompare`" msgstr "" -"群" -"組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject.tp_richcompare`" +"群組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject." +"tp_richcompare`" #: ../../c-api/typeobj.rst:1006 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_richcompare`: a subtype inherits both " -"of :c:member:`~PyTypeObject.tp_richcompare` " -"and :c:member:`~PyTypeObject.tp_hash`, when the " -"subtype's :c:member:`~PyTypeObject.tp_richcompare` " -"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." +"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash`, when the subtype's :c:" +"member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` " +"are both ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:1013 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." -msgstr "" +msgstr ":c:data:`PyBaseObject_Type` 會使用 :c:func:`PyObject_GenericHash`。" #: ../../c-api/typeobj.rst:1018 msgid "" @@ -2063,16 +2065,16 @@ msgstr "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" #: ../../c-api/typeobj.rst:1031 msgid "" -"An optional pointer to a function that implements the built-in " -"operation :func:`str`. (Note that :class:`str` is a type now, " -"and :func:`str` calls the constructor for that type. This constructor " -"calls :c:func:`PyObject_Str` to do the actual work, " -"and :c:func:`PyObject_Str` will call this handler.)" +"An optional pointer to a function that implements the built-in operation :" +"func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls " +"the constructor for that type. This constructor calls :c:func:" +"`PyObject_Str` to do the actual work, and :c:func:`PyObject_Str` will call " +"this handler.)" msgstr "" #: ../../c-api/typeobj.rst:1036 msgid "The signature is the same as for :c:func:`PyObject_Str`::" -msgstr "" +msgstr "函式簽名與 :c:func:`PyObject_Str` 相同: ::" #: ../../c-api/typeobj.rst:1038 msgid "PyObject *tp_str(PyObject *self);" @@ -2098,7 +2100,7 @@ msgstr "" #: ../../c-api/typeobj.rst:1058 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" -msgstr "" +msgstr "函式簽名與 :c:func:`PyObject_GetAttr` 相同: ::" #: ../../c-api/typeobj.rst:1060 msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" @@ -2106,28 +2108,27 @@ msgstr "PyObject *tp_getattro(PyObject *self, PyObject *attr);" #: ../../c-api/typeobj.rst:1062 msgid "" -"It is usually convenient to set this field " -"to :c:func:`PyObject_GenericGetAttr`, which implements the normal way of " -"looking for object attributes." +"It is usually convenient to set this field to :c:func:" +"`PyObject_GenericGetAttr`, which implements the normal way of looking for " +"object attributes." msgstr "" #: ../../c-api/typeobj.rst:1069 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_getattr`: a subtype inherits " -"both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` " -"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." +"tp_getattro` are both ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:1075 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." -msgstr "" +msgstr ":c:data:`PyBaseObject_Type` 會使用 :c:func:`PyObject_GenericGetAttr`。" #: ../../c-api/typeobj.rst:1082 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" -msgstr "" +msgstr "函式簽名與 :c:func:`PyObject_SetAttr` 相同: ::" #: ../../c-api/typeobj.rst:1084 msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" @@ -2136,19 +2137,18 @@ msgstr "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" #: ../../c-api/typeobj.rst:1086 msgid "" "In addition, setting *value* to ``NULL`` to delete an attribute must be " -"supported. It is usually convenient to set this field " -"to :c:func:`PyObject_GenericSetAttr`, which implements the normal way of " -"setting object attributes." +"supported. It is usually convenient to set this field to :c:func:" +"`PyObject_GenericSetAttr`, which implements the normal way of setting object " +"attributes." msgstr "" #: ../../c-api/typeobj.rst:1095 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_setattr`: a subtype inherits " -"both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` " -"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." +"tp_setattro` are both ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:1101 @@ -2172,12 +2172,12 @@ msgstr "" msgid "" "This field is a bit mask of various flags. Some flags indicate variant " "semantics for certain situations; others are used to indicate that certain " -"fields in the type object (or in the extension structures referenced " -"via :c:member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject.tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, " -"and :c:member:`~PyTypeObject.tp_as_buffer`) that were historically not " -"always present are valid; if such a flag bit is clear, the type fields it " -"guards must not be accessed and must be considered to have a zero or " -"``NULL`` value instead." +"fields in the type object (or in the extension structures referenced via :c:" +"member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject." +"tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, and :c:member:" +"`~PyTypeObject.tp_as_buffer`) that were historically not always present are " +"valid; if such a flag bit is clear, the type fields it guards must not be " +"accessed and must be considered to have a zero or ``NULL`` value instead." msgstr "" #: ../../c-api/typeobj.rst:1128 @@ -2189,11 +2189,10 @@ msgid "" "type's value of the flag bit is copied into the subtype together with a " "pointer to the extension structure. The :c:macro:`Py_TPFLAGS_HAVE_GC` flag " "bit is inherited together with the :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " -"the :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " -"``NULL`` values." +"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and the :c:member:" +"`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields in " +"the subtype exist and have ``NULL`` values." msgstr "" #: ../../c-api/typeobj.rst:1143 @@ -2211,10 +2210,10 @@ msgstr "" #: ../../c-api/typeobj.rst:1150 msgid "" "The following bit masks are currently defined; these can be ORed together " -"using the ``|`` operator to form the value of " -"the :c:member:`~PyTypeObject.tp_flags` field. The " -"macro :c:func:`PyType_HasFeature` takes a type and a flags value, *tp* and " -"*f*, and checks whether ``tp->tp_flags & f`` is non-zero." +"using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." +"tp_flags` field. The macro :c:func:`PyType_HasFeature` takes a type and a " +"flags value, *tp* and *f*, and checks whether ``tp->tp_flags & f`` is non-" +"zero." msgstr "" #: ../../c-api/typeobj.rst:1157 @@ -2225,9 +2224,9 @@ msgid "" "a reference to the type, and the type object is INCREF'ed when a new " "instance is created, and DECREF'ed when an instance is destroyed (this does " "not apply to instances of subtypes; only the type referenced by the " -"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should " -"also :ref:`support garbage collection ` as they " -"can form a reference cycle with their own module object." +"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should also :ref:" +"`support garbage collection ` as they can form a " +"reference cycle with their own module object." msgstr "" #: ../../c-api/typeobj.rst:1168 ../../c-api/typeobj.rst:1179 @@ -2245,8 +2244,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1184 msgid "" -"This bit is set when the type object has been fully initialized " -"by :c:func:`PyType_Ready`." +"This bit is set when the type object has been fully initialized by :c:func:" +"`PyType_Ready`." msgstr "" #: ../../c-api/typeobj.rst:1194 @@ -2259,26 +2258,27 @@ msgstr "" msgid "" "This bit is set when the object supports garbage collection. If this bit is " "set, memory for new instances (see :c:member:`~PyTypeObject.tp_alloc`) must " -"be allocated using :c:macro:`PyObject_GC_New` " -"or :c:func:`PyType_GenericAlloc` and deallocated " -"(see :c:member:`~PyTypeObject.tp_free`) using :c:func:`PyObject_GC_Del`. " -"More information in section :ref:`supporting-cycle-detection`." +"be allocated using :c:macro:`PyObject_GC_New` or :c:func:" +"`PyType_GenericAlloc` and deallocated (see :c:member:`~PyTypeObject." +"tp_free`) using :c:func:`PyObject_GC_Del`. More information in section :ref:" +"`supporting-cycle-detection`." msgstr "" #: ../../c-api/typeobj.rst:1213 ../../c-api/typeobj.rst:1560 #: ../../c-api/typeobj.rst:1704 -msgid "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject.tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" +msgid "" +"Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." +"tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" #: ../../c-api/typeobj.rst:1215 msgid "" -"The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with " -"the :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " -"the :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " -"``NULL`` values." +"The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:" +"member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` " +"fields, i.e. if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the " +"subtype and the :c:member:`~PyTypeObject.tp_traverse` and :c:member:" +"`~PyTypeObject.tp_clear` fields in the subtype exist and have ``NULL`` " +"values." msgstr "" #: ../../c-api/typeobj.rst:1225 @@ -2294,44 +2294,47 @@ msgstr "" #: ../../c-api/typeobj.rst:1238 msgid "If this flag is set for ``type(meth)``, then:" -msgstr "" +msgstr "如果此旗標為 ``type(meth)`` 所設定,則:" #: ../../c-api/typeobj.rst:1240 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" +"``meth.__get__(obj, cls)(*args, **kwds)``\\(其中 ``obj`` 並非 None)必須等價於 " +"``meth(obj, *args, **kwds)``。" #: ../../c-api/typeobj.rst:1243 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" +"``meth.__get__(None, cls)(*args, **kwds)`` 必須等價於 ``meth(*args, **kwds)``。" #: ../../c-api/typeobj.rst:1246 msgid "" -"This flag enables an optimization for typical method calls like " -"``obj.meth()``: it avoids creating a temporary \"bound method\" object for " -"``obj.meth``." +"This flag enables an optimization for typical method calls like ``obj." +"meth()``: it avoids creating a temporary \"bound method\" object for ``obj." +"meth``." msgstr "" #: ../../c-api/typeobj.rst:1254 msgid "" -"This flag is never inherited by types without " -"the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it " -"is inherited whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." +"This flag is never inherited by types without the :c:macro:" +"`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited " +"whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" #: ../../c-api/typeobj.rst:1260 msgid "" -"This bit indicates that instances of the class have " -"a :attr:`~object.__dict__` attribute, and that the space for the dictionary " -"is managed by the VM." +"This bit indicates that instances of the class have a :attr:`~object." +"__dict__` attribute, and that the space for the dictionary is managed by the " +"VM." msgstr "" #: ../../c-api/typeobj.rst:1263 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." -msgstr "" +msgstr "如果有設定此旗標,則也應該設定 :c:macro:`Py_TPFLAGS_HAVE_GC`。" #: ../../c-api/typeobj.rst:1265 msgid "" @@ -2353,14 +2356,14 @@ msgstr "" #: ../../c-api/typeobj.rst:1285 msgid "" -"This flag is inherited unless " -"the :c:member:`~PyTypeObject.tp_weaklistoffset` field is set in a superclass." +"This flag is inherited unless the :c:member:`~PyTypeObject." +"tp_weaklistoffset` field is set in a superclass." msgstr "" #: ../../c-api/typeobj.rst:1291 msgid "" -"Only usable with variable-size types, i.e. ones with non-" -"zero :c:member:`~PyTypeObject.tp_itemsize`." +"Only usable with variable-size types, i.e. ones with non-zero :c:member:" +"`~PyTypeObject.tp_itemsize`." msgstr "" #: ../../c-api/typeobj.rst:1294 @@ -2385,10 +2388,9 @@ msgid "" "These flags are used by functions such as :c:func:`PyLong_Check` to quickly " "determine if a type is a subclass of a built-in type; such specific checks " "are faster than a generic check, like :c:func:`PyObject_IsInstance`. Custom " -"types that inherit from built-ins should have " -"their :c:member:`~PyTypeObject.tp_flags` set appropriately, or the code that " -"interacts with such types will behave differently depending on what kind of " -"check is used." +"types that inherit from built-ins should have their :c:member:`~PyTypeObject." +"tp_flags` set appropriately, or the code that interacts with such types will " +"behave differently depending on what kind of check is used." msgstr "" #: ../../c-api/typeobj.rst:1332 @@ -2399,9 +2401,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1337 msgid "" -"This flag isn't necessary anymore, as the interpreter assumes " -"the :c:member:`~PyTypeObject.tp_finalize` slot is always present in the type " -"structure." +"This flag isn't necessary anymore, as the interpreter assumes the :c:member:" +"`~PyTypeObject.tp_finalize` slot is always present in the type structure." msgstr "" #: ../../c-api/typeobj.rst:1345 @@ -2418,8 +2419,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1358 msgid "" -"This flag is now removed from a class when the " -"class's :py:meth:`~object.__call__` method is reassigned." +"This flag is now removed from a class when the class's :py:meth:`~object." +"__call__` method is reassigned." msgstr "" #: ../../c-api/typeobj.rst:1361 @@ -2444,9 +2445,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1378 msgid "" -"Disallow creating instances of the type: " -"set :c:member:`~PyTypeObject.tp_new` to NULL and don't create the " -"``__new__`` key in the type dictionary." +"Disallow creating instances of the type: set :c:member:`~PyTypeObject." +"tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." msgstr "" #: ../../c-api/typeobj.rst:1382 @@ -2457,9 +2457,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1385 msgid "" -"The flag is set automatically on :ref:`static types ` " -"if :c:member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` " -"and :c:member:`~PyTypeObject.tp_new` is NULL." +"The flag is set automatically on :ref:`static types ` if :c:" +"member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:" +"member:`~PyTypeObject.tp_new` is NULL." msgstr "" #: ../../c-api/typeobj.rst:1391 @@ -2492,8 +2492,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1421 msgid "" -"This flag is inherited by types that do not already " -"set :c:macro:`Py_TPFLAGS_SEQUENCE`." +"This flag is inherited by types that do not already set :c:macro:" +"`Py_TPFLAGS_SEQUENCE`." msgstr "" #: ../../c-api/typeobj.rst:1424 ../../c-api/typeobj.rst:1446 @@ -2510,8 +2510,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1443 msgid "" -"This flag is inherited by types that do not already " -"set :c:macro:`Py_TPFLAGS_MAPPING`." +"This flag is inherited by types that do not already set :c:macro:" +"`Py_TPFLAGS_MAPPING`." msgstr "" #: ../../c-api/typeobj.rst:1453 @@ -2535,7 +2535,7 @@ msgstr "" #: ../../c-api/typeobj.rst:1469 msgid "This field is *not* inherited by subtypes." -msgstr "" +msgstr "此欄位不會被子型別繼承。" #: ../../c-api/typeobj.rst:1474 msgid "" @@ -2557,11 +2557,11 @@ msgstr "" #: ../../c-api/typeobj.rst:1482 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " -"collector to detect reference cycles. A typical implementation of " -"a :c:member:`~PyTypeObject.tp_traverse` function simply " -"calls :c:func:`Py_VISIT` on each of the instance's members that are Python " -"objects that the instance owns. For example, this is function :c:func:`!" -"local_traverse` from the :mod:`!_thread` extension module::" +"collector to detect reference cycles. A typical implementation of a :c:" +"member:`~PyTypeObject.tp_traverse` function simply calls :c:func:`Py_VISIT` " +"on each of the instance's members that are Python objects that the instance " +"owns. For example, this is function :c:func:`!local_traverse` from the :mod:" +"`!_thread` extension module::" msgstr "" #: ../../c-api/typeobj.rst:1488 @@ -2628,9 +2628,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1517 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " -"the :c:member:`~PyTypeObject.tp_flags` field, the traverse function must " -"call :c:func:`PyObject_VisitManagedDict` like this::" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" +"`PyObject_VisitManagedDict` like this::" msgstr "" #: ../../c-api/typeobj.rst:1521 @@ -2652,19 +2652,18 @@ msgstr "" #: ../../c-api/typeobj.rst:1535 msgid "" -"Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters " -"to :c:func:`!local_traverse` to have these specific names; don't name them " -"just anything." +"Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to :c:" +"func:`!local_traverse` to have these specific names; don't name them just " +"anything." msgstr "" #: ../../c-api/typeobj.rst:1539 msgid "" "Instances of :ref:`heap-allocated types ` hold a reference to " -"their type. Their traversal function must therefore either " -"visit :c:func:`Py_TYPE(self) `, or delegate this responsibility by " -"calling ``tp_traverse`` of another heap-allocated type (such as a heap-" -"allocated superclass). If they do not, the type object may not be garbage-" -"collected." +"their type. Their traversal function must therefore either visit :c:func:" +"`Py_TYPE(self) `, or delegate this responsibility by calling " +"``tp_traverse`` of another heap-allocated type (such as a heap-allocated " +"superclass). If they do not, the type object may not be garbage-collected." msgstr "" #: ../../c-api/typeobj.rst:1548 @@ -2682,12 +2681,10 @@ msgstr "" #: ../../c-api/typeobj.rst:1562 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_clear` and " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag " -"bit, :c:member:`~PyTypeObject.tp_traverse`, " -"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " -"if they are all zero in the subtype." +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" +"member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " +"are all inherited from the base type if they are all zero in the subtype." msgstr "" #: ../../c-api/typeobj.rst:1570 @@ -2711,16 +2708,16 @@ msgid "" ":c:member:`!tp_clear` does not need to delete references to objects that " "can't participate in reference cycles, such as Python strings or Python " "integers. However, it may be convenient to clear all references, and write " -"the type's :c:member:`~PyTypeObject.tp_dealloc` function to " -"invoke :c:member:`!tp_clear` to avoid code duplication. (Beware " -"that :c:member:`!tp_clear` might have already been called. Prefer calling " -"idempotent functions like :c:func:`Py_CLEAR`.)" +"the type's :c:member:`~PyTypeObject.tp_dealloc` function to invoke :c:member:" +"`!tp_clear` to avoid code duplication. (Beware that :c:member:`!tp_clear` " +"might have already been called. Prefer calling idempotent functions like :c:" +"func:`Py_CLEAR`.)" msgstr "" #: ../../c-api/typeobj.rst:1587 msgid "" -"Any non-trivial cleanup should be performed " -"in :c:member:`~PyTypeObject.tp_finalize` instead of :c:member:`!tp_clear`." +"Any non-trivial cleanup should be performed in :c:member:`~PyTypeObject." +"tp_finalize` instead of :c:member:`!tp_clear`." msgstr "" #: ../../c-api/typeobj.rst:1592 @@ -2750,8 +2747,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1611 msgid "" -"This function differs from the destructor " -"(:c:member:`~PyTypeObject.tp_dealloc`) in the following ways:" +"This function differs from the destructor (:c:member:`~PyTypeObject." +"tp_dealloc`) in the following ways:" msgstr "" #: ../../c-api/typeobj.rst:1614 @@ -2760,18 +2757,18 @@ msgid "" "that might participate in a reference cycle. The purpose of the destructor, " "on the other hand, is a superset: it must release *all* resources it owns, " "including references to objects that cannot participate in a reference cycle " -"(e.g., integers) as well as the object's own memory (by " -"calling :c:member:`~PyTypeObject.tp_free`)." +"(e.g., integers) as well as the object's own memory (by calling :c:member:" +"`~PyTypeObject.tp_free`)." msgstr "" #: ../../c-api/typeobj.rst:1620 msgid "" "When :c:member:`!tp_clear` is called, other objects might still hold " "references to the object being cleared. Because of this, :c:member:`!" -"tp_clear` must not deallocate the object's own memory " -"(:c:member:`~PyTypeObject.tp_free`). The destructor, on the other hand, is " -"only called when no (strong) references exist, and as such, must safely " -"destroy the object itself by deallocating it." +"tp_clear` must not deallocate the object's own memory (:c:member:" +"`~PyTypeObject.tp_free`). The destructor, on the other hand, is only called " +"when no (strong) references exist, and as such, must safely destroy the " +"object itself by deallocating it." msgstr "" #: ../../c-api/typeobj.rst:1626 @@ -2812,10 +2809,10 @@ msgstr "" #: ../../c-api/typeobj.rst:1644 msgid "" -"Python will not destroy an object until after any automatic calls to " -"its :c:member:`!tp_clear` function have returned. This ensures that the act " -"of breaking a reference cycle does not invalidate the ``self`` pointer " -"while :c:member:`!tp_clear` is still executing." +"Python will not destroy an object until after any automatic calls to its :c:" +"member:`!tp_clear` function have returned. This ensures that the act of " +"breaking a reference cycle does not invalidate the ``self`` pointer while :c:" +"member:`!tp_clear` is still executing." msgstr "" #: ../../c-api/typeobj.rst:1648 @@ -2836,13 +2833,12 @@ msgid "" "Taken together, all :c:member:`~PyTypeObject.tp_clear` functions in the " "system must combine to break all reference cycles. This is subtle, and if " "in any doubt supply a :c:member:`~PyTypeObject.tp_clear` function. For " -"example, the tuple type does not implement " -"a :c:member:`~PyTypeObject.tp_clear` function, because it's possible to " -"prove that no reference cycle can be composed entirely of tuples. Therefore " -"the :c:member:`~PyTypeObject.tp_clear` functions of other types are " -"responsible for breaking any cycle containing a tuple. This isn't " -"immediately obvious, and there's rarely a good reason to avoid " -"implementing :c:member:`~PyTypeObject.tp_clear`." +"example, the tuple type does not implement a :c:member:`~PyTypeObject." +"tp_clear` function, because it's possible to prove that no reference cycle " +"can be composed entirely of tuples. Therefore the :c:member:`~PyTypeObject." +"tp_clear` functions of other types are responsible for breaking any cycle " +"containing a tuple. This isn't immediately obvious, and there's rarely a " +"good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" #: ../../c-api/typeobj.rst:1666 @@ -2880,9 +2876,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1681 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " -"delicate: the reference to the contained object must not be released " -"(via :c:func:`Py_DECREF`) until after the pointer to the contained object is " -"set to ``NULL``. This is because releasing the reference may cause the " +"delicate: the reference to the contained object must not be released (via :" +"c:func:`Py_DECREF`) until after the pointer to the contained object is set " +"to ``NULL``. This is because releasing the reference may cause the " "contained object to become trash, triggering a chain of reclamation activity " "that may include invoking arbitrary Python code (due to finalizers, or " "weakref callbacks, associated with the contained object). If it's possible " @@ -2894,9 +2890,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1693 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " -"the :c:member:`~PyTypeObject.tp_flags` field, the traverse function must " -"call :c:func:`PyObject_ClearManagedDict` like this::" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, the clear function must call :c:func:" +"`PyObject_ClearManagedDict` like this::" msgstr "" #: ../../c-api/typeobj.rst:1697 @@ -2905,12 +2901,10 @@ msgstr "PyObject_ClearManagedDict((PyObject*)self);" #: ../../c-api/typeobj.rst:1706 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_traverse` and " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag " -"bit, :c:member:`~PyTypeObject.tp_traverse`, " -"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " -"if they are all zero in the subtype." +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" +"c:member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " +"are all inherited from the base type if they are all zero in the subtype." msgstr "" #: ../../c-api/typeobj.rst:1718 @@ -2938,9 +2932,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1730 msgid "" -"The following constants are defined to be used as the third argument " -"for :c:member:`~PyTypeObject.tp_richcompare` and " -"for :c:func:`PyObject_RichCompare`:" +"The following constants are defined to be used as the third argument for :c:" +"member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" msgstr "" #: ../../c-api/typeobj.rst:1736 @@ -2998,21 +2991,19 @@ msgstr "" #: ../../c-api/typeobj.rst:1771 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_hash`: a subtype " -"inherits :c:member:`~PyTypeObject.tp_richcompare` " -"and :c:member:`~PyTypeObject.tp_hash` when the " -"subtype's :c:member:`~PyTypeObject.tp_richcompare` " -"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" +"member:`~PyTypeObject.tp_hash` when the subtype's :c:member:`~PyTypeObject." +"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:1778 msgid "" -":c:data:`PyBaseObject_Type` provides " -"a :c:member:`~PyTypeObject.tp_richcompare` implementation, which may be " -"inherited. However, if only :c:member:`~PyTypeObject.tp_hash` is defined, " -"not even the inherited function is used and instances of the type will not " -"be able to participate in any comparisons." +":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." +"tp_richcompare` implementation, which may be inherited. However, if only :c:" +"member:`~PyTypeObject.tp_hash` is defined, not even the inherited function " +"is used and instances of the type will not be able to participate in any " +"comparisons." msgstr "" #: ../../c-api/typeobj.rst:1787 @@ -3027,8 +3018,8 @@ msgid "" "greater than zero and contains the offset in the instance structure of the " "weak reference list head (ignoring the GC header, if present); this offset " "is used by :c:func:`PyObject_ClearWeakRefs` and the ``PyWeakref_*`` " -"functions. The instance structure needs to include a field of " -"type :c:expr:`PyObject*` which is initialized to ``NULL``." +"functions. The instance structure needs to include a field of type :c:expr:" +"`PyObject*` which is initialized to ``NULL``." msgstr "" #: ../../c-api/typeobj.rst:1797 @@ -3054,18 +3045,17 @@ msgstr "" #: ../../c-api/typeobj.rst:1812 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in " -"the :c:member:`~PyTypeObject.tp_flags` field, " -"then :c:member:`~PyTypeObject.tp_weaklistoffset` will be set to a negative " -"value, to indicate that it is unsafe to use this field." +"If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." +"tp_weaklistoffset` will be set to a negative value, to indicate that it is " +"unsafe to use this field." msgstr "" #: ../../c-api/typeobj.rst:1820 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " -"object. Its presence normally signals that the instances of this type " -"are :term:`iterable` (although sequences may be iterable without this " -"function)." +"object. Its presence normally signals that the instances of this type are :" +"term:`iterable` (although sequences may be iterable without this function)." msgstr "" #: ../../c-api/typeobj.rst:1824 @@ -3078,8 +3068,8 @@ msgstr "PyObject *tp_iter(PyObject *self);" #: ../../c-api/typeobj.rst:1835 msgid "" -"An optional pointer to a function that returns the next item in " -"an :term:`iterator`. The signature is::" +"An optional pointer to a function that returns the next item in an :term:" +"`iterator`. The signature is::" msgstr "" #: ../../c-api/typeobj.rst:1838 @@ -3088,10 +3078,10 @@ msgstr "PyObject *tp_iternext(PyObject *self);" #: ../../c-api/typeobj.rst:1840 msgid "" -"When the iterator is exhausted, it must return ``NULL``; " -"a :exc:`StopIteration` exception may or may not be set. When another error " -"occurs, it must return ``NULL`` too. Its presence signals that the " -"instances of this type are iterators." +"When the iterator is exhausted, it must return ``NULL``; a :exc:" +"`StopIteration` exception may or may not be set. When another error occurs, " +"it must return ``NULL`` too. Its presence signals that the instances of " +"this type are iterators." msgstr "" #: ../../c-api/typeobj.rst:1845 @@ -3107,8 +3097,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1858 msgid "" -"An optional pointer to a static ``NULL``-terminated array " -"of :c:type:`PyMethodDef` structures, declaring regular methods of this type." +"An optional pointer to a static ``NULL``-terminated array of :c:type:" +"`PyMethodDef` structures, declaring regular methods of this type." msgstr "" #: ../../c-api/typeobj.rst:1861 @@ -3125,9 +3115,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1872 msgid "" -"An optional pointer to a static ``NULL``-terminated array " -"of :c:type:`PyMemberDef` structures, declaring regular data members (fields " -"or slots) of instances of this type." +"An optional pointer to a static ``NULL``-terminated array of :c:type:" +"`PyMemberDef` structures, declaring regular data members (fields or slots) " +"of instances of this type." msgstr "" #: ../../c-api/typeobj.rst:1876 @@ -3144,9 +3134,9 @@ msgstr "" #: ../../c-api/typeobj.rst:1887 msgid "" -"An optional pointer to a static ``NULL``-terminated array " -"of :c:type:`PyGetSetDef` structures, declaring computed attributes of " -"instances of this type." +"An optional pointer to a static ``NULL``-terminated array of :c:type:" +"`PyGetSetDef` structures, declaring computed attributes of instances of this " +"type." msgstr "" #: ../../c-api/typeobj.rst:1890 @@ -3179,10 +3169,10 @@ msgstr "" #: ../../c-api/typeobj.rst:1914 msgid "" -"However, the unary '&' operator applied to a non-static variable " -"like :c:data:`PyBaseObject_Type` is not required to produce an address " -"constant. Compilers may support this (gcc does), MSVC does not. Both " -"compilers are strictly standard conforming in this particular behavior." +"However, the unary '&' operator applied to a non-static variable like :c:" +"data:`PyBaseObject_Type` is not required to produce an address constant. " +"Compilers may support this (gcc does), MSVC does not. Both compilers are " +"strictly standard conforming in this particular behavior." msgstr "" #: ../../c-api/typeobj.rst:1920 @@ -3211,23 +3201,22 @@ msgid "" "called; it may also be initialized to a dictionary containing initial " "attributes for the type. Once :c:func:`PyType_Ready` has initialized the " "type, extra attributes for the type may be added to this dictionary only if " -"they don't correspond to overloaded operations " -"(like :meth:`~object.__add__`). Once initialization for the type has " -"finished, this field should be treated as read-only." +"they don't correspond to overloaded operations (like :meth:`~object." +"__add__`). Once initialization for the type has finished, this field should " +"be treated as read-only." msgstr "" #: ../../c-api/typeobj.rst:1945 msgid "" -"Some types may not store their dictionary in this slot. " -"Use :c:func:`PyType_GetDict` to retrieve the dictionary for an arbitrary " -"type." +"Some types may not store their dictionary in this slot. Use :c:func:" +"`PyType_GetDict` to retrieve the dictionary for an arbitrary type." msgstr "" #: ../../c-api/typeobj.rst:1951 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " -"Instead, the dict for such types is stored on ``PyInterpreterState``. " -"Use :c:func:`PyType_GetDict` to get the dict for an arbitrary type." +"Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" +"func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" #: ../../c-api/typeobj.rst:1957 @@ -3244,8 +3233,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1967 msgid "" -"It is not safe to use :c:func:`PyDict_SetItem` on or otherwise " -"modify :c:member:`~PyTypeObject.tp_dict` with the dictionary C-API." +"It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" +"member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" #: ../../c-api/typeobj.rst:1973 @@ -3287,8 +3276,8 @@ msgstr "" msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " -"of the type of the instance variable dictionary; this offset is used " -"by :c:func:`PyObject_GenericGetAttr`." +"of the type of the instance variable dictionary; this offset is used by :c:" +"func:`PyObject_GenericGetAttr`." msgstr "" #: ../../c-api/typeobj.rst:2014 @@ -3306,25 +3295,24 @@ msgstr "" #: ../../c-api/typeobj.rst:2019 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" -"only. To get the pointer to the dictionary " -"call :c:func:`PyObject_GenericGetDict`. " -"Calling :c:func:`PyObject_GenericGetDict` may need to allocate memory for " -"the dictionary, so it is may be more efficient to " -"call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." +"only. To get the pointer to the dictionary call :c:func:" +"`PyObject_GenericGetDict`. Calling :c:func:`PyObject_GenericGetDict` may " +"need to allocate memory for the dictionary, so it is may be more efficient " +"to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" #: ../../c-api/typeobj.rst:2025 msgid "" -"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit " -"and :c:member:`~PyTypeObject.tp_dictoffset`." +"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit and :c:" +"member:`~PyTypeObject.tp_dictoffset`." msgstr "" #: ../../c-api/typeobj.rst:2030 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " -"at the previous offset. To properly support inheritance, " -"use :c:macro:`Py_TPFLAGS_MANAGED_DICT`." +"at the previous offset. To properly support inheritance, use :c:macro:" +"`Py_TPFLAGS_MANAGED_DICT`." msgstr "" #: ../../c-api/typeobj.rst:2037 @@ -3336,10 +3324,9 @@ msgstr "" #: ../../c-api/typeobj.rst:2040 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " -"the :c:member:`~PyTypeObject.tp_flags` field, " -"then :c:member:`~PyTypeObject.tp_dictoffset` will be set to ``-1``, to " -"indicate that it is unsafe to use this field." +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " +"will be set to ``-1``, to indicate that it is unsafe to use this field." msgstr "" #: ../../c-api/typeobj.rst:2048 @@ -3361,20 +3348,20 @@ msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" #: ../../c-api/typeobj.rst:2059 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " -"arguments represent positional and keyword arguments of the call " -"to :meth:`~object.__init__`." +"arguments represent positional and keyword arguments of the call to :meth:" +"`~object.__init__`." msgstr "" #: ../../c-api/typeobj.rst:2063 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " -"when an instance is created normally by calling its type, after the " -"type's :c:member:`~PyTypeObject.tp_new` function has returned an instance of " -"the type. If the :c:member:`~PyTypeObject.tp_new` function returns an " -"instance of some other type that is not a subtype of the original type, " -"no :c:member:`~PyTypeObject.tp_init` function is called; " -"if :c:member:`~PyTypeObject.tp_new` returns an instance of a subtype of the " -"original type, the subtype's :c:member:`~PyTypeObject.tp_init` is called." +"when an instance is created normally by calling its type, after the type's :" +"c:member:`~PyTypeObject.tp_new` function has returned an instance of the " +"type. If the :c:member:`~PyTypeObject.tp_new` function returns an instance " +"of some other type that is not a subtype of the original type, no :c:member:" +"`~PyTypeObject.tp_init` function is called; if :c:member:`~PyTypeObject." +"tp_new` returns an instance of a subtype of the original type, the " +"subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" #: ../../c-api/typeobj.rst:2070 @@ -3396,8 +3383,8 @@ msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" #: ../../c-api/typeobj.rst:2091 msgid "" -"Static subtypes inherit this slot, which will " -"be :c:func:`PyType_GenericAlloc` if inherited from :class:`object`." +"Static subtypes inherit this slot, which will be :c:func:" +"`PyType_GenericAlloc` if inherited from :class:`object`." msgstr "" #: ../../c-api/typeobj.rst:2094 ../../c-api/typeobj.rst:2161 @@ -3427,9 +3414,9 @@ msgstr "" msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " -"to the type. Note that *subtype* doesn't have to equal the type " -"whose :c:member:`~PyTypeObject.tp_new` function is called; it may be a " -"subtype of that type (but not an unrelated type)." +"to the type. Note that *subtype* doesn't have to equal the type whose :c:" +"member:`~PyTypeObject.tp_new` function is called; it may be a subtype of " +"that type (but not an unrelated type)." msgstr "" #: ../../c-api/typeobj.rst:2118 @@ -3439,9 +3426,9 @@ msgid "" "only as much further initialization as is absolutely necessary. " "Initialization that can safely be ignored or repeated should be placed in " "the :c:member:`~PyTypeObject.tp_init` handler. A good rule of thumb is that " -"for immutable types, all initialization should take place " -"in :c:member:`~PyTypeObject.tp_new`, while for mutable types, most " -"initialization should be deferred to :c:member:`~PyTypeObject.tp_init`." +"for immutable types, all initialization should take place in :c:member:" +"`~PyTypeObject.tp_new`, while for mutable types, most initialization should " +"be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" #: ../../c-api/typeobj.rst:2126 @@ -3452,10 +3439,9 @@ msgstr "" #: ../../c-api/typeobj.rst:2131 msgid "" -"This field is inherited by subtypes, except it is not inherited " -"by :ref:`static types ` " -"whose :c:member:`~PyTypeObject.tp_base` is ``NULL`` or " -"``&PyBaseObject_Type``." +"This field is inherited by subtypes, except it is not inherited by :ref:" +"`static types ` whose :c:member:`~PyTypeObject.tp_base` is " +"``NULL`` or ``&PyBaseObject_Type``." msgstr "" #: ../../c-api/typeobj.rst:2137 @@ -3477,25 +3463,24 @@ msgstr "void tp_free(void *self);" #: ../../c-api/typeobj.rst:2149 msgid "" -"This function must free the memory allocated " -"by :c:member:`~PyTypeObject.tp_alloc`." +"This function must free the memory allocated by :c:member:`~PyTypeObject." +"tp_alloc`." msgstr "" #: ../../c-api/typeobj.rst:2154 msgid "" "Static subtypes inherit this slot, which will be :c:func:`PyObject_Free` if " "inherited from :class:`object`. Exception: If the type supports garbage " -"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set " -"in :c:member:`~PyTypeObject.tp_flags`) and it would " -"inherit :c:func:`PyObject_Free`, then this slot is not inherited but instead " -"defaults to :c:func:`PyObject_GC_Del`." +"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:" +"`~PyTypeObject.tp_flags`) and it would inherit :c:func:`PyObject_Free`, then " +"this slot is not inherited but instead defaults to :c:func:`PyObject_GC_Del`." msgstr "" #: ../../c-api/typeobj.rst:2165 msgid "" "For :ref:`heap subtypes `, this slot defaults to a deallocator " -"suitable to match :c:func:`PyType_GenericAlloc` and the value of " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." +"suitable to match :c:func:`PyType_GenericAlloc` and the value of the :c:" +"macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" #: ../../c-api/typeobj.rst:2174 @@ -3506,12 +3491,12 @@ msgstr "" msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " -"type's :c:member:`~PyTypeObject.tp_flags` field, and check " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture " -"of statically and dynamically allocated instances, and the statically " -"allocated instances are not collectible. Such types should define this " -"function; it should return ``1`` for a collectible instance, and ``0`` for a " -"non-collectible instance. The signature is::" +"type's :c:member:`~PyTypeObject.tp_flags` field, and check the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture of statically " +"and dynamically allocated instances, and the statically allocated instances " +"are not collectible. Such types should define this function; it should " +"return ``1`` for a collectible instance, and ``0`` for a non-collectible " +"instance. The signature is::" msgstr "" #: ../../c-api/typeobj.rst:2184 @@ -3520,15 +3505,15 @@ msgstr "int tp_is_gc(PyObject *self);" #: ../../c-api/typeobj.rst:2186 msgid "" -"(The only example of this are types themselves. The " -"metatype, :c:data:`PyType_Type`, defines this function to distinguish " -"between statically and :ref:`dynamically allocated types `.)" +"(The only example of this are types themselves. The metatype, :c:data:" +"`PyType_Type`, defines this function to distinguish between statically and :" +"ref:`dynamically allocated types `.)" msgstr "" #: ../../c-api/typeobj.rst:2196 msgid "" -"This slot has no default. If this field is " -"``NULL``, :c:macro:`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." +"This slot has no default. If this field is ``NULL``, :c:macro:" +"`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" #: ../../c-api/typeobj.rst:2202 @@ -3544,8 +3529,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2207 msgid "" "For dynamically created classes, the ``Py_tp_bases`` :c:type:`slot " -"` can be used instead of the *bases* argument " -"of :c:func:`PyType_FromSpecWithBases`. The argument form is preferred." +"` can be used instead of the *bases* argument of :c:func:" +"`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" #: ../../c-api/typeobj.rst:2214 @@ -3569,8 +3554,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2233 msgid "" -"This field is not inherited; it is calculated fresh " -"by :c:func:`PyType_Ready`." +"This field is not inherited; it is calculated fresh by :c:func:" +"`PyType_Ready`." msgstr "" #: ../../c-api/typeobj.rst:2239 @@ -3584,8 +3569,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2250 msgid "" -"To get a list of subclasses, call the Python " -"method :py:meth:`~type.__subclasses__`." +"To get a list of subclasses, call the Python method :py:meth:`~type." +"__subclasses__`." msgstr "" #: ../../c-api/typeobj.rst:2255 @@ -3611,7 +3596,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2282 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." -msgstr "" +msgstr "此欄位已被棄用。請改用 :c:member:`~PyTypeObject.tp_finalize`。" #: ../../c-api/typeobj.rst:2287 msgid "Used to index into the method cache. Internal use only." @@ -3640,8 +3625,8 @@ msgstr "" msgid "" "Before Python automatically finalizes an object, some of the object's direct " "or indirect referents might have themselves been automatically finalized. " -"However, none of the referents will have been automatically cleared " -"(:c:member:`~PyTypeObject.tp_clear`) yet." +"However, none of the referents will have been automatically cleared (:c:" +"member:`~PyTypeObject.tp_clear`) yet." msgstr "" #: ../../c-api/typeobj.rst:2313 @@ -3678,8 +3663,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2340 msgid "" "The :c:member:`!tp_finalize` function can be called during shutdown, after " -"some global variables have been deleted. See the documentation of " -"the :meth:`~object.__del__` method for details." +"some global variables have been deleted. See the documentation of the :meth:" +"`~object.__del__` method for details." msgstr "" #: ../../c-api/typeobj.rst:2344 @@ -3690,10 +3675,9 @@ msgstr "" #: ../../c-api/typeobj.rst:2346 msgid "" "Python might mark the object as *finalized*. Currently, Python always marks " -"objects whose type supports garbage collection (i.e., " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set " -"in :c:member:`~PyTypeObject.tp_flags`) and never marks other types of " -"objects; this might change in a future version." +"objects whose type supports garbage collection (i.e., the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:`~PyTypeObject.tp_flags`) and " +"never marks other types of objects; this might change in a future version." msgstr "" #: ../../c-api/typeobj.rst:2351 @@ -3723,9 +3707,9 @@ msgstr "" #: ../../c-api/typeobj.rst:2366 msgid "" "*Automatic finalization* refers to any finalization performed by Python " -"except via calls to :c:func:`PyObject_CallFinalizer` " -"or :c:func:`PyObject_CallFinalizerFromDealloc`. No guarantees are made " -"about when, if, or how often an object is automatically finalized, except:" +"except via calls to :c:func:`PyObject_CallFinalizer` or :c:func:" +"`PyObject_CallFinalizerFromDealloc`. No guarantees are made about when, if, " +"or how often an object is automatically finalized, except:" msgstr "" #: ../../c-api/typeobj.rst:2371 @@ -3739,10 +3723,10 @@ msgstr "" msgid "" "Python will not automatically finalize an object if finalizing it would not " "mark the object as *finalized*. Currently, this applies to objects whose " -"type does not support garbage collection, i.e., " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is not set. Such objects can still " -"be manually finalized by calling :c:func:`PyObject_CallFinalizer` " -"or :c:func:`PyObject_CallFinalizerFromDealloc`." +"type does not support garbage collection, i.e., the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag is not set. Such objects can still be manually " +"finalized by calling :c:func:`PyObject_CallFinalizer` or :c:func:" +"`PyObject_CallFinalizerFromDealloc`." msgstr "" #: ../../c-api/typeobj.rst:2380 @@ -3760,8 +3744,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2384 msgid "" "If an object is a member of a :term:`cyclic isolate`, Python will not " -"automatically finalize it after automatically clearing " -"(see :c:member:`~PyTypeObject.tp_clear`) any other member." +"automatically finalize it after automatically clearing (see :c:member:" +"`~PyTypeObject.tp_clear`) any other member." msgstr "" #: ../../c-api/typeobj.rst:2387 @@ -3773,35 +3757,33 @@ msgstr "" #: ../../c-api/typeobj.rst:2390 msgid "" -"If Python is going to automatically clear an object " -"(:c:member:`~PyTypeObject.tp_clear`), it will automatically finalize the " -"object first." +"If Python is going to automatically clear an object (:c:member:" +"`~PyTypeObject.tp_clear`), it will automatically finalize the object first." msgstr "" #: ../../c-api/typeobj.rst:2394 msgid "" -"Python currently only automatically finalizes objects that are members of " -"a :term:`cyclic isolate`, but future versions might finalize objects " -"regularly before their destruction." +"Python currently only automatically finalizes objects that are members of a :" +"term:`cyclic isolate`, but future versions might finalize objects regularly " +"before their destruction." msgstr "" #: ../../c-api/typeobj.rst:2398 msgid "" -"To manually finalize an object, do not call this function directly; " -"call :c:func:`PyObject_CallFinalizer` " -"or :c:func:`PyObject_CallFinalizerFromDealloc` instead." +"To manually finalize an object, do not call this function directly; call :c:" +"func:`PyObject_CallFinalizer` or :c:func:`PyObject_CallFinalizerFromDealloc` " +"instead." msgstr "" #: ../../c-api/typeobj.rst:2402 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should leave the current exception " "status unchanged. The recommended way to write a non-trivial finalizer is " -"to back up the exception at the beginning by " -"calling :c:func:`PyErr_GetRaisedException` and restore the exception at the " -"end by calling :c:func:`PyErr_SetRaisedException`. If an exception is " -"encountered in the middle of the finalizer, log and clear it " -"with :c:func:`PyErr_WriteUnraisable` or :c:func:`PyErr_FormatUnraisable`. " -"For example::" +"to back up the exception at the beginning by calling :c:func:" +"`PyErr_GetRaisedException` and restore the exception at the end by calling :" +"c:func:`PyErr_SetRaisedException`. If an exception is encountered in the " +"middle of the finalizer, log and clear it with :c:func:" +"`PyErr_WriteUnraisable` or :c:func:`PyErr_FormatUnraisable`. For example::" msgstr "" #: ../../c-api/typeobj.rst:2411 @@ -3829,9 +3811,9 @@ msgstr "" #: ../../c-api/typeobj.rst:2439 msgid "" -"Before version 3.8 it was necessary to set " -"the :c:macro:`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to " -"be used. This is no longer required." +"Before version 3.8 it was necessary to set the :c:macro:" +"`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " +"This is no longer required." msgstr "" #: ../../c-api/typeobj.rst:2445 @@ -3876,7 +3858,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2473 msgid "calls ``type->tp_new``," -msgstr "" +msgstr "呼叫 ``type->tp_new``," #: ../../c-api/typeobj.rst:2475 msgid "" @@ -3886,15 +3868,15 @@ msgstr "" #: ../../c-api/typeobj.rst:2478 msgid "returns the result of ``tp_new``." -msgstr "" +msgstr "回傳 ``tp_new`` 的結果。" #: ../../c-api/typeobj.rst:2480 msgid "" "Typically, ``tp_vectorcall`` is overridden to optimize this process for " -"specific :c:member:`~PyTypeObject.tp_new` " -"and :c:member:`~PyTypeObject.tp_init`. When doing this for user-subclassable " -"types, note that both can be overridden (using :py:func:`~object.__new__` " -"and :py:func:`~object.__init__`, respectively)." +"specific :c:member:`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject." +"tp_init`. When doing this for user-subclassable types, note that both can be " +"overridden (using :py:func:`~object.__new__` and :py:func:`~object." +"__init__`, respectively)." msgstr "" #: ../../c-api/typeobj.rst:2491 @@ -3911,13 +3893,13 @@ msgstr "" #: ../../c-api/typeobj.rst:2506 msgid "Static Types" -msgstr "" +msgstr "靜態型別" #: ../../c-api/typeobj.rst:2508 msgid "" -"Traditionally, types defined in C code are *static*, that is, a " -"static :c:type:`PyTypeObject` structure is defined directly in code and " -"initialized using :c:func:`PyType_Ready`." +"Traditionally, types defined in C code are *static*, that is, a static :c:" +"type:`PyTypeObject` structure is defined directly in code and initialized " +"using :c:func:`PyType_Ready`." msgstr "" #: ../../c-api/typeobj.rst:2512 @@ -3953,21 +3935,21 @@ msgstr "" #: ../../c-api/typeobj.rst:2530 msgid "Heap Types" -msgstr "" +msgstr "堆積型別" #: ../../c-api/typeobj.rst:2532 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " -"created by Python's ``class`` statement. Heap types have " -"the :c:macro:`Py_TPFLAGS_HEAPTYPE` flag set." +"created by Python's ``class`` statement. Heap types have the :c:macro:" +"`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" #: ../../c-api/typeobj.rst:2537 msgid "" -"This is done by filling a :c:type:`PyType_Spec` structure and " -"calling :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:`PyType_FromModuleAndSpec`, " -"or :c:func:`PyType_FromMetaclass`." +"This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" +"func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" +"`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." msgstr "" #: ../../c-api/typeobj.rst:2545 @@ -4092,7 +4074,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2659 msgid "Mapping Object Structures" -msgstr "" +msgstr "對映物件結構" #: ../../c-api/typeobj.rst:2666 msgid "" @@ -4102,25 +4084,24 @@ msgstr "" #: ../../c-api/typeobj.rst:2671 msgid "" -"This function is used by :c:func:`PyMapping_Size` " -"and :c:func:`PyObject_Size`, and has the same signature. This slot may be " -"set to ``NULL`` if the object has no defined length." +"This function is used by :c:func:`PyMapping_Size` and :c:func:" +"`PyObject_Size`, and has the same signature. This slot may be set to " +"``NULL`` if the object has no defined length." msgstr "" #: ../../c-api/typeobj.rst:2677 msgid "" -"This function is used by :c:func:`PyObject_GetItem` " -"and :c:func:`PySequence_GetSlice`, and has the same signature as :c:func:`!" -"PyObject_GetItem`. This slot must be filled for " -"the :c:func:`PyMapping_Check` function to return ``1``, it can be ``NULL`` " -"otherwise." +"This function is used by :c:func:`PyObject_GetItem` and :c:func:" +"`PySequence_GetSlice`, and has the same signature as :c:func:`!" +"PyObject_GetItem`. This slot must be filled for the :c:func:" +"`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." msgstr "" #: ../../c-api/typeobj.rst:2685 msgid "" -"This function is used " -"by :c:func:`PyObject_SetItem`, :c:func:`PyObject_DelItem`, :c:func:`PySequence_SetSlice` " -"and :c:func:`PySequence_DelSlice`. It has the same signature as :c:func:`!" +"This function is used by :c:func:`PyObject_SetItem`, :c:func:" +"`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" +"`PySequence_DelSlice`. It has the same signature as :c:func:`!" "PyObject_SetItem`, but *v* can also be set to ``NULL`` to delete an item. " "If this slot is ``NULL``, the object does not support item assignment and " "deletion." @@ -4128,7 +4109,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2696 msgid "Sequence Object Structures" -msgstr "" +msgstr "序列物件結構" #: ../../c-api/typeobj.rst:2703 msgid "" @@ -4138,10 +4119,10 @@ msgstr "" #: ../../c-api/typeobj.rst:2708 msgid "" -"This function is used by :c:func:`PySequence_Size` " -"and :c:func:`PyObject_Size`, and has the same signature. It is also used " -"for handling negative indices via the :c:member:`~PySequenceMethods.sq_item` " -"and the :c:member:`~PySequenceMethods.sq_ass_item` slots." +"This function is used by :c:func:`PySequence_Size` and :c:func:" +"`PyObject_Size`, and has the same signature. It is also used for handling " +"negative indices via the :c:member:`~PySequenceMethods.sq_item` and the :c:" +"member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" #: ../../c-api/typeobj.rst:2715 @@ -4169,21 +4150,20 @@ msgstr "" #: ../../c-api/typeobj.rst:2733 msgid "" -"Negative indexes are handled as follows: if " -"the :c:member:`~PySequenceMethods.sq_length` slot is filled, it is called " -"and the sequence length is used to compute a positive index which is passed " -"to :c:member:`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is " -"``NULL``, the index is passed as is to the function." +"Negative indexes are handled as follows: if the :c:member:" +"`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " +"length is used to compute a positive index which is passed to :c:member:" +"`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is ``NULL``, the " +"index is passed as is to the function." msgstr "" #: ../../c-api/typeobj.rst:2740 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " -"signature. It is also used by :c:func:`PyObject_SetItem` " -"and :c:func:`PyObject_DelItem`, after trying the item assignment and " -"deletion via the :c:member:`~PyMappingMethods.mp_ass_subscript` slot. This " -"slot may be left to ``NULL`` if the object does not support item assignment " -"and deletion." +"signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" +"`PyObject_DelItem`, after trying the item assignment and deletion via the :c:" +"member:`~PyMappingMethods.mp_ass_subscript` slot. This slot may be left to " +"``NULL`` if the object does not support item assignment and deletion." msgstr "" #: ../../c-api/typeobj.rst:2749 @@ -4199,8 +4179,8 @@ msgid "" "signature. It should modify its first operand, and return it. This slot " "may be left to ``NULL``, in this case :c:func:`!PySequence_InPlaceConcat` " "will fall back to :c:func:`PySequence_Concat`. It is also used by the " -"augmented assignment ``+=``, after trying numeric in-place addition via " -"the :c:member:`~PyNumberMethods.nb_inplace_add` slot." +"augmented assignment ``+=``, after trying numeric in-place addition via the :" +"c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" #: ../../c-api/typeobj.rst:2765 @@ -4215,7 +4195,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2776 msgid "Buffer Object Structures" -msgstr "" +msgstr "緩衝區物件結構" #: ../../c-api/typeobj.rst:2784 msgid "" @@ -4228,7 +4208,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2893 ../../c-api/typeobj.rst:2904 #: ../../c-api/typeobj.rst:2916 ../../c-api/typeobj.rst:2926 msgid "The signature of this function is::" -msgstr "" +msgstr "函式的簽名為: ::" #: ../../c-api/typeobj.rst:2792 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" @@ -4243,8 +4223,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2798 msgid "" -"Check if the request can be met. If not, raise :exc:`BufferError`, " -"set :c:expr:`view->obj` to ``NULL`` and return ``-1``." +"Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" +"expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" #: ../../c-api/typeobj.rst:2801 @@ -4272,8 +4252,8 @@ msgstr "" #: ../../c-api/typeobj.rst:2812 msgid "" -"Re-export: Each member of the tree acts as the exporting object and " -"sets :c:expr:`view->obj` to a new reference to itself." +"Re-export: Each member of the tree acts as the exporting object and sets :c:" +"expr:`view->obj` to a new reference to itself." msgstr "" #: ../../c-api/typeobj.rst:2815 @@ -4293,9 +4273,10 @@ msgstr "" #: ../../c-api/typeobj.rst:2824 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " -"exporter and must remain valid until there are no consumers " -"left. :c:member:`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides`, :c:member:`~Py_buffer.suboffsets` " -"and :c:member:`~Py_buffer.internal` are read-only for the consumer." +"exporter and must remain valid until there are no consumers left. :c:member:" +"`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer." +"strides`, :c:member:`~Py_buffer.suboffsets` and :c:member:`~Py_buffer." +"internal` are read-only for the consumer." msgstr "" #: ../../c-api/typeobj.rst:2831 @@ -4353,12 +4334,12 @@ msgstr "" #: ../../c-api/typeobj.rst:2871 msgid "Async Object Structures" -msgstr "" +msgstr "非同步物件結構" #: ../../c-api/typeobj.rst:2879 msgid "" -"This structure holds pointers to the functions required to " -"implement :term:`awaitable` and :term:`asynchronous iterator` objects." +"This structure holds pointers to the functions required to implement :term:" +"`awaitable` and :term:`asynchronous iterator` objects." msgstr "" #: ../../c-api/typeobj.rst:2884 @@ -4398,8 +4379,8 @@ msgstr "PyObject *am_aiter(PyObject *self);" #: ../../c-api/typeobj.rst:2908 msgid "" -"Must return an :term:`asynchronous iterator` object. " -"See :meth:`~object.__anext__` for details." +"Must return an :term:`asynchronous iterator` object. See :meth:`~object." +"__anext__` for details." msgstr "" #: ../../c-api/typeobj.rst:2911 @@ -4437,21 +4418,20 @@ msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " "length for the instance, suitably aligned, and initialized to zeros, but " -"with :c:member:`~PyObject.ob_refcnt` set to ``1`` " -"and :c:member:`~PyObject.ob_type` set to the type argument. If the " -"type's :c:member:`~PyTypeObject.tp_itemsize` is non-zero, the " -"object's :c:member:`~PyVarObject.ob_size` field should be initialized to " -"*nitems* and the length of the allocated memory block should be " -"``tp_basicsize + nitems*tp_itemsize``, rounded up to a multiple of " -"``sizeof(void*)``; otherwise, *nitems* is not used and the length of the " -"block should be :c:member:`~PyTypeObject.tp_basicsize`." +"with :c:member:`~PyObject.ob_refcnt` set to ``1`` and :c:member:`~PyObject." +"ob_type` set to the type argument. If the type's :c:member:`~PyTypeObject." +"tp_itemsize` is non-zero, the object's :c:member:`~PyVarObject.ob_size` " +"field should be initialized to *nitems* and the length of the allocated " +"memory block should be ``tp_basicsize + nitems*tp_itemsize``, rounded up to " +"a multiple of ``sizeof(void*)``; otherwise, *nitems* is not used and the " +"length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" #: ../../c-api/typeobj.rst:2953 msgid "" "This function should not do any other instance initialization, not even to " -"allocate additional memory; that should be done " -"by :c:member:`~PyTypeObject.tp_new`." +"allocate additional memory; that should be done by :c:member:`~PyTypeObject." +"tp_new`." msgstr "" #: ../../c-api/typeobj.rst:2960 @@ -4687,8 +4667,8 @@ msgstr "" #: ../../c-api/typeobj.rst:3141 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " -"instances (e.g. uses a separate factory func) " -"using :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" +"instances (e.g. uses a separate factory func) using :c:macro:" +"`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" #: ../../c-api/typeobj.rst:3145 diff --git a/c-api/unicode.po b/c-api/unicode.po index 6a742dde0bd..031c9279e74 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -114,8 +114,8 @@ msgstr "" msgid "" "Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 " "integer types for direct character access. No checks are performed if the " -"canonical representation has the correct character size; " -"use :c:func:`PyUnicode_KIND` to select the right function." +"canonical representation has the correct character size; use :c:func:" +"`PyUnicode_KIND` to select the right function." msgstr "" #: ../../c-api/unicode.rst:107 @@ -162,15 +162,15 @@ msgstr "" #: ../../c-api/unicode.rst:152 msgid "" -"Read a code point from a canonical representation *data* (as obtained " -"with :c:func:`PyUnicode_DATA`). No checks or ready calls are performed." +"Read a code point from a canonical representation *data* (as obtained with :" +"c:func:`PyUnicode_DATA`). No checks or ready calls are performed." msgstr "" #: ../../c-api/unicode.rst:160 msgid "" "Read a character from a Unicode object *unicode*, which must be in the " -"\"canonical\" representation. This is less efficient " -"than :c:func:`PyUnicode_READ` if you do multiple consecutive reads." +"\"canonical\" representation. This is less efficient than :c:func:" +"`PyUnicode_READ` if you do multiple consecutive reads." msgstr "" #: ../../c-api/unicode.rst:169 @@ -194,8 +194,8 @@ msgstr "" #: ../../c-api/unicode.rst:188 msgid "" -"Return true if the string only contains ASCII characters. Equivalent " -"to :py:meth:`str.isascii`." +"Return true if the string only contains ASCII characters. Equivalent to :py:" +"meth:`str.isascii`." msgstr "" #: ../../c-api/unicode.rst:195 @@ -353,11 +353,11 @@ msgstr "" #: ../../c-api/unicode.rst:330 msgid "" -"After creation, the string can be filled " -"by :c:func:`PyUnicode_WriteChar`, :c:func:`PyUnicode_CopyCharacters`, :c:func:`PyUnicode_Fill`, :c:func:`PyUnicode_WRITE` " -"or similar. Since strings are supposed to be immutable, take care to not " -"“use” the result while it is being modified. In particular, before it's " -"filled with its final contents, a string:" +"After creation, the string can be filled by :c:func:`PyUnicode_WriteChar`, :" +"c:func:`PyUnicode_CopyCharacters`, :c:func:`PyUnicode_Fill`, :c:func:" +"`PyUnicode_WRITE` or similar. Since strings are supposed to be immutable, " +"take care to not “use” the result while it is being modified. In particular, " +"before it's filled with its final contents, a string:" msgstr "" #: ../../c-api/unicode.rst:337 @@ -393,19 +393,18 @@ msgstr "" #: ../../c-api/unicode.rst:357 msgid "" -"Create a new Unicode object with the given *kind* (possible values " -"are :c:macro:`PyUnicode_1BYTE_KIND` etc., as returned " -"by :c:func:`PyUnicode_KIND`). The *buffer* must point to an array of *size* " -"units of 1, 2 or 4 bytes per character, as given by the kind." +"Create a new Unicode object with the given *kind* (possible values are :c:" +"macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" +"`PyUnicode_KIND`). The *buffer* must point to an array of *size* units of " +"1, 2 or 4 bytes per character, as given by the kind." msgstr "" #: ../../c-api/unicode.rst:362 msgid "" "If necessary, the input *buffer* is copied and transformed into the " -"canonical representation. For example, if the *buffer* is a UCS4 string " -"(:c:macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the " -"UCS1 range, it will be transformed into UCS1 " -"(:c:macro:`PyUnicode_1BYTE_KIND`)." +"canonical representation. For example, if the *buffer* is a UCS4 string (:c:" +"macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the UCS1 " +"range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" #: ../../c-api/unicode.rst:373 @@ -466,9 +465,9 @@ msgstr "" #: ../../c-api/unicode.rst:410 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " -"actual width is given in the next argument, which must be of " -"type :c:expr:`int`, and the object to convert comes after the minimum field " -"width and optional precision." +"actual width is given in the next argument, which must be of type :c:expr:" +"`int`, and the object to convert comes after the minimum field width and " +"optional precision." msgstr "" #: ../../c-api/unicode.rst:415 @@ -750,8 +749,8 @@ msgstr "``T``" #: ../../c-api/unicode.rst:533 msgid "" -"Get the fully qualified name of an object type; " -"call :c:func:`PyType_GetFullyQualifiedName`." +"Get the fully qualified name of an object type; call :c:func:" +"`PyType_GetFullyQualifiedName`." msgstr "" #: ../../c-api/unicode.rst:536 @@ -774,8 +773,8 @@ msgstr ":c:expr:`PyTypeObject*`" #: ../../c-api/unicode.rst:543 msgid "" -"Get the fully qualified name of a type; " -"call :c:func:`PyType_GetFullyQualifiedName`." +"Get the fully qualified name of a type; call :c:func:" +"`PyType_GetFullyQualifiedName`." msgstr "" #: ../../c-api/unicode.rst:546 @@ -895,8 +894,8 @@ msgstr "" #: ../../c-api/unicode.rst:633 msgid "" -"Append the string *right* to the end of *p_left*. *p_left* must point to " -"a :term:`strong reference` to a Unicode object; :c:func:`!PyUnicode_Append` " +"Append the string *right* to the end of *p_left*. *p_left* must point to a :" +"term:`strong reference` to a Unicode object; :c:func:`!PyUnicode_Append` " "releases (\"steals\") this reference." msgstr "" @@ -925,8 +924,8 @@ msgstr "" #: ../../c-api/unicode.rst:661 msgid "" -"Return the name of the default string encoding, ``\"utf-8\"``. " -"See :func:`sys.getdefaultencoding`." +"Return the name of the default string encoding, ``\"utf-8\"``. See :func:" +"`sys.getdefaultencoding`." msgstr "" #: ../../c-api/unicode.rst:664 @@ -984,8 +983,8 @@ msgstr "" #: ../../c-api/unicode.rst:712 msgid "" -"Fill a string with a character: write *fill_char* into " -"``unicode[start:start+length]``." +"Fill a string with a character: write *fill_char* into ``unicode[start:" +"start+length]``." msgstr "" #: ../../c-api/unicode.rst:715 @@ -1009,16 +1008,16 @@ msgstr "" #: ../../c-api/unicode.rst:733 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " -"not out of bounds, and that the object's reference count is one). " -"See :c:func:`PyUnicode_WRITE` for a version that skips these checks, making " -"them your responsibility." +"not out of bounds, and that the object's reference count is one. See :c:func:" +"`PyUnicode_WRITE` for a version that skips these checks, making them your " +"responsibility." msgstr "" #: ../../c-api/unicode.rst:746 msgid "" "Read a character from a string. This function checks that *unicode* is a " -"Unicode object and the index is not out of bounds, in contrast " -"to :c:func:`PyUnicode_READ_CHAR`, which performs no error checking." +"Unicode object and the index is not out of bounds, in contrast to :c:func:" +"`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" #: ../../c-api/unicode.rst:750 @@ -1042,10 +1041,10 @@ msgstr "" #: ../../c-api/unicode.rst:778 msgid "" -"Copy the string *unicode* into a new UCS4 buffer that is allocated " -"using :c:func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with " -"a :exc:`MemoryError` set. The returned buffer always has an extra null code " -"point appended." +"Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" +"func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" +"`MemoryError` set. The returned buffer always has an extra null code point " +"appended." msgstr "" #: ../../c-api/unicode.rst:787 @@ -1069,8 +1068,8 @@ msgstr "" #: ../../c-api/unicode.rst:803 msgid "" -"Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from " -"the :term:`filesystem encoding and error handler`." +"Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" +"term:`filesystem encoding and error handler`." msgstr "" #: ../../c-api/unicode.rst:806 ../../c-api/unicode.rst:841 @@ -1084,9 +1083,9 @@ msgstr ":c:func:`Py_DecodeLocale` 函式。" #: ../../c-api/unicode.rst:814 msgid "" "The function now also uses the current locale encoding for the " -"``surrogateescape`` error handler, except on Android. " -"Previously, :c:func:`Py_DecodeLocale` was used for the ``surrogateescape``, " -"and the current locale encoding was used for ``strict``." +"``surrogateescape`` error handler, except on Android. Previously, :c:func:" +"`Py_DecodeLocale` was used for the ``surrogateescape``, and the current " +"locale encoding was used for ``strict``." msgstr "" #: ../../c-api/unicode.rst:823 @@ -1102,14 +1101,14 @@ msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " "``\"strict\"`` and ``\"surrogateescape\"`` (:pep:`383`). The encoder uses " -"``\"strict\"`` error handler if *errors* is ``NULL``. Return " -"a :class:`bytes` object. *unicode* cannot contain embedded null characters." +"``\"strict\"`` error handler if *errors* is ``NULL``. Return a :class:" +"`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" #: ../../c-api/unicode.rst:838 msgid "" -"Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to " -"the :term:`filesystem encoding and error handler`." +"Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" +"`filesystem encoding and error handler`." msgstr "" #: ../../c-api/unicode.rst:845 ../../c-api/unicode.rst:957 @@ -1119,9 +1118,9 @@ msgstr ":c:func:`Py_EncodeLocale` 函式。" #: ../../c-api/unicode.rst:849 msgid "" "The function now also uses the current locale encoding for the " -"``surrogateescape`` error handler, except on Android. " -"Previously, :c:func:`Py_EncodeLocale` was used for the ``surrogateescape``, " -"and the current locale encoding was used for ``strict``." +"``surrogateescape`` error handler, except on Android. Previously, :c:func:" +"`Py_EncodeLocale` was used for the ``surrogateescape``, and the current " +"locale encoding was used for ``strict``." msgstr "" #: ../../c-api/unicode.rst:858 @@ -1144,8 +1143,8 @@ msgstr "" #: ../../c-api/unicode.rst:869 msgid "" ":ref:`PyArg_Parse\\* converter `: encode :class:`str` objects " -"-- obtained directly or through the :class:`os.PathLike` interface -- " -"to :class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " +"-- obtained directly or through the :class:`os.PathLike` interface -- to :" +"class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " "objects are output as-is. *result* must be an address of a C variable of " "type :c:expr:`PyObject*` (or :c:expr:`PyBytesObject*`). On success, set the " "variable to a new :term:`strong reference` to a :ref:`bytes object " @@ -1175,15 +1174,14 @@ msgstr "" msgid "" ":ref:`PyArg_Parse\\* converter `: decode :class:`bytes` objects " "-- obtained either directly or indirectly through the :class:`os.PathLike` " -"interface -- to :class:`str` " -"using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are " -"output as-is. *result* must be an address of a C variable of " -"type :c:expr:`PyObject*` (or :c:expr:`PyUnicodeObject*`). On success, set " -"the variable to a new :term:`strong reference` to a :ref:`Unicode object " -"` which must be released when it is no longer used and " -"return a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null " -"characters are not allowed in the result. On failure, return ``0`` with an " -"exception set." +"interface -- to :class:`str` using :c:func:" +"`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are output as-is. " +"*result* must be an address of a C variable of type :c:expr:`PyObject*` (or :" +"c:expr:`PyUnicodeObject*`). On success, set the variable to a new :term:" +"`strong reference` to a :ref:`Unicode object ` which must be " +"released when it is no longer used and return a non-zero value (:c:macro:" +"`Py_CLEANUP_SUPPORTED`). Embedded null characters are not allowed in the " +"result. On failure, return ``0`` with an exception set." msgstr "" #: ../../c-api/unicode.rst:908 @@ -1198,8 +1196,8 @@ msgstr "" #: ../../c-api/unicode.rst:921 msgid "" -"If you need to decode a string from the current locale encoding, " -"use :c:func:`PyUnicode_DecodeLocaleAndSize`." +"If you need to decode a string from the current locale encoding, use :c:func:" +"`PyUnicode_DecodeLocaleAndSize`." msgstr "" #: ../../c-api/unicode.rst:928 ../../c-api/unicode.rst:941 @@ -1217,8 +1215,8 @@ msgstr "" #: ../../c-api/unicode.rst:938 msgid "" -"If the string length is known, " -"use :c:func:`PyUnicode_DecodeFSDefaultAndSize`." +"If the string length is known, use :c:func:" +"`PyUnicode_DecodeFSDefaultAndSize`." msgstr "如果字串長度已知,請使用 :c:func:`PyUnicode_DecodeFSDefaultAndSize`。" #: ../../c-api/unicode.rst:948 @@ -1230,8 +1228,8 @@ msgstr "" #: ../../c-api/unicode.rst:952 msgid "" -"If you need to encode a string to the current locale encoding, " -"use :c:func:`PyUnicode_EncodeLocale`." +"If you need to encode a string to the current locale encoding, use :c:func:" +"`PyUnicode_EncodeLocale`." msgstr "" #: ../../c-api/unicode.rst:966 @@ -1254,8 +1252,8 @@ msgstr "" msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " -"trailing null termination character). Return the number " -"of :c:type:`wchar_t` characters copied or ``-1`` in case of an error." +"trailing null termination character). Return the number of :c:type:" +"`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" #: ../../c-api/unicode.rst:985 @@ -1267,9 +1265,9 @@ msgstr "" #: ../../c-api/unicode.rst:988 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" -"terminated. It is the responsibility of the caller to make sure that " -"the :c:expr:`wchar_t*` string is null-terminated in case this is required by " -"the application. Also, note that the :c:expr:`wchar_t*` string might contain " +"terminated. It is the responsibility of the caller to make sure that the :c:" +"expr:`wchar_t*` string is null-terminated in case this is required by the " +"application. Also, note that the :c:expr:`wchar_t*` string might contain " "null characters, which would cause the string to be truncated when used with " "most C functions." msgstr "" @@ -1281,9 +1279,8 @@ msgid "" "number of wide characters (excluding the trailing null termination " "character) into *\\*size*. Note that the resulting :c:type:`wchar_t` string " "might contain null characters, which would cause the string to be truncated " -"when used with most C functions. If *size* is ``NULL`` and " -"the :c:expr:`wchar_t*` string contains null characters a :exc:`ValueError` " -"is raised." +"when used with most C functions. If *size* is ``NULL`` and the :c:expr:" +"`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" #: ../../c-api/unicode.rst:1006 @@ -1456,8 +1453,8 @@ msgid "" "`_ embedded within *unicode*. " "As a result, strings containing null characters will remain in the returned " "string, which some C functions might interpret as the end of the string, " -"leading to truncation. If truncation is an issue, it is recommended to " -"use :c:func:`PyUnicode_AsUTF8AndSize` instead." +"leading to truncation. If truncation is an issue, it is recommended to use :" +"c:func:`PyUnicode_AsUTF8AndSize` instead." msgstr "" #: ../../c-api/unicode.rst:1159 @@ -1807,8 +1804,8 @@ msgstr "" #: ../../c-api/unicode.rst:1457 msgid "" "Encode the Unicode object using the specified code page and return a Python " -"bytes object. Return ``NULL`` if an exception was raised by the codec. " -"Use :c:macro:`!CP_ACP` code page to get the MBCS encoder." +"bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" +"c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" #: ../../c-api/unicode.rst:1467 @@ -1950,8 +1947,8 @@ msgstr "" #: ../../c-api/unicode.rst:1596 msgid "" -"This function returns ``-1`` upon failure, so one should " -"call :c:func:`PyErr_Occurred` to check for errors." +"This function returns ``-1`` upon failure, so one should call :c:func:" +"`PyErr_Occurred` to check for errors." msgstr "" #: ../../c-api/unicode.rst:1601 @@ -1972,8 +1969,8 @@ msgstr "如果 *a* 不等於 *b*,則回傳 ``0``。" #: ../../c-api/unicode.rst:1610 msgid "" -"Set a :exc:`TypeError` exception and return ``-1`` if *a* or *b* is not " -"a :class:`str` object." +"Set a :exc:`TypeError` exception and return ``-1`` if *a* or *b* is not a :" +"class:`str` object." msgstr "" #: ../../c-api/unicode.rst:1613 @@ -2036,9 +2033,8 @@ msgstr "" #: ../../c-api/unicode.rst:1666 msgid "" -"Possible values for *op* " -"are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, " -"and :c:macro:`Py_LE`." +"Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" +"`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." msgstr "" #: ../../c-api/unicode.rst:1672 @@ -2063,11 +2059,11 @@ msgstr "" msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " -"If there is an existing interned string that is the same " -"as :c:expr:`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the " -"reference to the old string object and creating a new :term:`strong " -"reference` to the interned string object), otherwise it " -"leaves :c:expr:`*p_unicode` alone and interns it." +"If there is an existing interned string that is the same as :c:expr:" +"`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the reference to " +"the old string object and creating a new :term:`strong reference` to the " +"interned string object), otherwise it leaves :c:expr:`*p_unicode` alone and " +"interns it." msgstr "" #: ../../c-api/unicode.rst:1694 @@ -2086,9 +2082,9 @@ msgstr "" #: ../../c-api/unicode.rst:1702 msgid "" -"Instances of subclasses of :py:class:`str` may not be interned, that " -"is, :c:expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, " -"then -- as with any other error -- the argument is left unchanged." +"Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" +"expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " +"as with any other error -- the argument is left unchanged." msgstr "" #: ../../c-api/unicode.rst:1706 @@ -2099,9 +2095,8 @@ msgstr "" #: ../../c-api/unicode.rst:1712 msgid "" -"A combination of :c:func:`PyUnicode_FromString` " -"and :c:func:`PyUnicode_InternInPlace`, meant for statically allocated " -"strings." +"A combination of :c:func:`PyUnicode_FromString` and :c:func:" +"`PyUnicode_InternInPlace`, meant for statically allocated strings." msgstr "" #: ../../c-api/unicode.rst:1715 @@ -2116,8 +2111,8 @@ msgid "" "Python may keep a reference to the result, or make it :term:`immortal`, " "preventing it from being garbage-collected promptly. For interning an " "unbounded number of different strings, such as ones coming from user input, " -"prefer calling :c:func:`PyUnicode_FromString` " -"and :c:func:`PyUnicode_InternInPlace` directly." +"prefer calling :c:func:`PyUnicode_FromString` and :c:func:" +"`PyUnicode_InternInPlace` directly." msgstr "" #: ../../c-api/unicode.rst:1728 @@ -2141,8 +2136,8 @@ msgstr "PyUnicodeWriter" #: ../../c-api/unicode.rst:1743 msgid "" -"The :c:type:`PyUnicodeWriter` API can be used to create a " -"Python :class:`str` object." +"The :c:type:`PyUnicodeWriter` API can be used to create a Python :class:" +"`str` object." msgstr "" #: ../../c-api/unicode.rst:1750 @@ -2274,8 +2269,7 @@ msgstr "" msgid "" "Similar to :c:func:`PyUnicode_FromFormat`, but write the output directly " "into *writer*." -msgstr "" -"類似於 :c:func:`PyUnicode_FromFormat`,但是直接將輸出寫入 *writer*。" +msgstr "類似於 :c:func:`PyUnicode_FromFormat`,但是直接將輸出寫入 *writer*。" #: ../../c-api/unicode.rst:1869 msgid "" diff --git a/c-api/veryhigh.po b/c-api/veryhigh.po index 2deb1dabda2..3149d8034ca 100644 --- a/c-api/veryhigh.po +++ b/c-api/veryhigh.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-03 00:19+0000\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -216,34 +216,35 @@ msgid "" "objects *globals* and *locals* with the compiler flags specified by " "*flags*. *globals* must be a dictionary; *locals* can be any object that " "implements the mapping protocol. The parameter *start* specifies the start " -"token that should be used to parse the source code." +"symbol and must one of the following: :c:data:`Py_eval_input`, :c:data:" +"`Py_file_input`, or :c:data:`Py_single_input`." msgstr "" -#: ../../c-api/veryhigh.rst:188 +#: ../../c-api/veryhigh.rst:189 msgid "" "Returns the result of executing the code as a Python object, or ``NULL`` if " "an exception was raised." msgstr "" -#: ../../c-api/veryhigh.rst:194 +#: ../../c-api/veryhigh.rst:195 msgid "" "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " "*closeit* set to ``0`` and *flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:200 +#: ../../c-api/veryhigh.rst:201 msgid "" "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " "*flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:206 +#: ../../c-api/veryhigh.rst:207 msgid "" "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " "*closeit* set to ``0``." msgstr "" -#: ../../c-api/veryhigh.rst:212 +#: ../../c-api/veryhigh.rst:213 msgid "" "Similar to :c:func:`PyRun_StringFlags`, but the Python source code is read " "from *fp* instead of an in-memory string. *filename* should be the name of " @@ -252,22 +253,22 @@ msgid "" "`PyRun_FileExFlags` returns." msgstr "" -#: ../../c-api/veryhigh.rst:221 +#: ../../c-api/veryhigh.rst:222 msgid "" "This is a simplified interface to :c:func:`Py_CompileStringFlags` below, " "leaving *flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:227 +#: ../../c-api/veryhigh.rst:228 msgid "" "This is a simplified interface to :c:func:`Py_CompileStringExFlags` below, " "with *optimize* set to ``-1``." msgstr "" -#: ../../c-api/veryhigh.rst:233 +#: ../../c-api/veryhigh.rst:234 msgid "" "Parse and compile the Python source code in *str*, returning the resulting " -"code object. The start token is given by *start*; this can be used to " +"code object. The start symbol is given by *start*; this can be used to " "constrain the code which can be compiled and should be :c:data:" "`Py_eval_input`, :c:data:`Py_file_input`, or :c:data:`Py_single_input`. The " "filename specified by *filename* is used to construct the code object and " @@ -275,7 +276,7 @@ msgid "" "returns ``NULL`` if the code cannot be parsed or compiled." msgstr "" -#: ../../c-api/veryhigh.rst:241 +#: ../../c-api/veryhigh.rst:242 msgid "" "The integer *optimize* specifies the optimization level of the compiler; a " "value of ``-1`` selects the optimization level of the interpreter as given " @@ -284,20 +285,20 @@ msgid "" "or ``2`` (docstrings are removed too)." msgstr "" -#: ../../c-api/veryhigh.rst:252 +#: ../../c-api/veryhigh.rst:253 msgid "" "Like :c:func:`Py_CompileStringObject`, but *filename* is a byte string " "decoded from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/veryhigh.rst:259 +#: ../../c-api/veryhigh.rst:260 msgid "" "This is a simplified interface to :c:func:`PyEval_EvalCodeEx`, with just the " "code object, and global and local variables. The other arguments are set to " "``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:266 +#: ../../c-api/veryhigh.rst:267 msgid "" "Evaluate a precompiled code object, given a particular environment for its " "evaluation. This environment consists of a dictionary of global variables, " @@ -306,13 +307,13 @@ msgid "" "only_parameter>` arguments and a closure tuple of cells." msgstr "" -#: ../../c-api/veryhigh.rst:275 +#: ../../c-api/veryhigh.rst:276 msgid "" "Evaluate an execution frame. This is a simplified interface to :c:func:" "`PyEval_EvalFrameEx`, for backward compatibility." msgstr "" -#: ../../c-api/veryhigh.rst:281 +#: ../../c-api/veryhigh.rst:282 msgid "" "This is the main, unvarnished function of Python interpretation. The code " "object associated with the execution frame *f* is executed, interpreting " @@ -322,39 +323,39 @@ msgid "" "of generator objects." msgstr "" -#: ../../c-api/veryhigh.rst:288 +#: ../../c-api/veryhigh.rst:289 msgid "" "This function now includes a debug assertion to help ensure that it does not " "silently discard an active exception." msgstr "" -#: ../../c-api/veryhigh.rst:295 +#: ../../c-api/veryhigh.rst:296 msgid "" "This function changes the flags of the current evaluation frame, and returns " "true on success, false on failure." msgstr "" -#: ../../c-api/veryhigh.rst:303 +#: ../../c-api/veryhigh.rst:304 msgid "" "The start symbol from the Python grammar for isolated expressions; for use " "with :c:func:`Py_CompileString`." msgstr "" -#: ../../c-api/veryhigh.rst:311 +#: ../../c-api/veryhigh.rst:312 msgid "" "The start symbol from the Python grammar for sequences of statements as read " "from a file or other source; for use with :c:func:`Py_CompileString`. This " "is the symbol to use when compiling arbitrarily long Python source code." msgstr "" -#: ../../c-api/veryhigh.rst:320 +#: ../../c-api/veryhigh.rst:321 msgid "" "The start symbol from the Python grammar for a single statement; for use " "with :c:func:`Py_CompileString`. This is the symbol used for the interactive " "interpreter loop." msgstr "" -#: ../../c-api/veryhigh.rst:327 +#: ../../c-api/veryhigh.rst:328 msgid "" "This is the structure used to hold compiler flags. In cases where code is " "only being compiled, it is passed as ``int flags``, and in cases where code " @@ -362,44 +363,44 @@ msgid "" "case, ``from __future__ import`` can modify *flags*." msgstr "" -#: ../../c-api/veryhigh.rst:332 +#: ../../c-api/veryhigh.rst:333 msgid "" "Whenever ``PyCompilerFlags *flags`` is ``NULL``, :c:member:`~PyCompilerFlags." "cf_flags` is treated as equal to ``0``, and any modification due to ``from " "__future__ import`` is discarded." msgstr "" -#: ../../c-api/veryhigh.rst:338 +#: ../../c-api/veryhigh.rst:339 msgid "Compiler flags." msgstr "" -#: ../../c-api/veryhigh.rst:342 +#: ../../c-api/veryhigh.rst:343 msgid "" "*cf_feature_version* is the minor Python version. It should be initialized " "to ``PY_MINOR_VERSION``." msgstr "" -#: ../../c-api/veryhigh.rst:345 +#: ../../c-api/veryhigh.rst:346 msgid "" "The field is ignored by default, it is used if and only if ``PyCF_ONLY_AST`` " "flag is set in :c:member:`~PyCompilerFlags.cf_flags`." msgstr "" -#: ../../c-api/veryhigh.rst:348 +#: ../../c-api/veryhigh.rst:349 msgid "Added *cf_feature_version* field." msgstr "新增 *cf_feature_version* 欄位。" -#: ../../c-api/veryhigh.rst:351 +#: ../../c-api/veryhigh.rst:352 msgid "The available compiler flags are accessible as macros:" msgstr "" -#: ../../c-api/veryhigh.rst:360 +#: ../../c-api/veryhigh.rst:361 msgid "" "See :ref:`compiler flags ` in documentation of the :py:" "mod:`!ast` Python module, which exports these constants under the same names." msgstr "" -#: ../../c-api/veryhigh.rst:364 +#: ../../c-api/veryhigh.rst:365 msgid "" "The \"``PyCF``\" flags above can be combined with \"``CO_FUTURE``\" flags " "such as :c:macro:`CO_FUTURE_ANNOTATIONS` to enable features normally " @@ -407,7 +408,7 @@ msgid "" "`c_codeobject_flags` for a complete list." msgstr "" -#: ../../c-api/veryhigh.rst:301 ../../c-api/veryhigh.rst:309 -#: ../../c-api/veryhigh.rst:318 +#: ../../c-api/veryhigh.rst:302 ../../c-api/veryhigh.rst:310 +#: ../../c-api/veryhigh.rst:319 msgid "Py_CompileString (C function)" msgstr "Py_CompileString(C 函式)" diff --git a/deprecations/index.po b/deprecations/index.po index 06b7a16536c..f670deffdeb 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-18 00:15+0000\n" +"POT-Creation-Date: 2025-10-06 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -86,7 +86,7 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid ":mod:`importlib`:" msgstr ":mod:`importlib`:" @@ -181,7 +181,7 @@ msgstr "" "`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:80 -#: ../../deprecations/pending-removal-in-3.17.rst:4 +#: ../../deprecations/pending-removal-in-3.17.rst:26 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" @@ -476,8 +476,55 @@ msgstr "" msgid "Pending removal in Python 3.17" msgstr "Python 3.17 中待移除的項目" +#: ../../deprecations/pending-removal-in-3.17.rst:4 +msgid ":mod:`collections.abc`:" +msgstr ":mod:`collections.abc`:" + #: ../../deprecations/pending-removal-in-3.17.rst:6 msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17." +msgstr ":class:`collections.abc.ByteString` 預計在 Python 3.17 中移除。" + +#: ../../deprecations/pending-removal-in-3.17.rst:8 +#: ../../deprecations/pending-removal-in-3.17.rst:36 +msgid "" +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." +msgstr "" +"使用 ``isinstance(obj, collections.abc.Buffer)`` 來測試 ``obj`` 是否在 runtime " +"實作了\\ :ref:`緩衝區協定 `。在型別註解的使用中,請用 :class:`~" +"collections.abc.Buffer` 或明確指定你的程式碼所支援型別的聯集(例如 " +"``bytes | bytearray | memoryview``)。" + +#: ../../deprecations/pending-removal-in-3.17.rst:14 +#: ../../deprecations/pending-removal-in-3.17.rst:42 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." +msgstr "" +":class:`!ByteString` 最初被設計為一個抽象類別,以作為 :class:`bytes` 和 :class:`bytearray` " +"的超型別 (supertype)。然而由於 ABC 從未擁有任何方法,知道一個物件是 :class:`!ByteString` 的" +"實例從未真正告訴你任何關於該物件的有用資訊。其他常見的緩衝區型別如 :class:`memoryview` " +"也從未被理解為 :class:`!ByteString` 的子型別(無論是在 runtime 還是由靜態型別檢查器)。" + +#: ../../deprecations/pending-removal-in-3.17.rst:22 +#: ../../deprecations/pending-removal-in-3.17.rst:50 +msgid "" +"See :pep:`PEP 688 <688#current-options>` for more details. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" +"更多細節請見 :pep:`PEP 688 <688#current-options>`。(由 Shantanu Jain 於 :gh:`91896` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.17.rst:28 +msgid "" "Before Python 3.14, old-style unions were implemented using the private " "class ``typing._UnionGenericAlias``. This class is no longer needed for the " "implementation, but it has been retained for backward compatibility, with " @@ -490,35 +537,12 @@ msgstr "" "除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " "和 :func:`typing.get_args`,或者依賴私有實作細節。" -#: ../../deprecations/pending-removal-in-3.17.rst:11 +#: ../../deprecations/pending-removal-in-3.17.rst:33 msgid "" ":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " -"removal in Python 3.17. Prefer :class:`~collections.abc.Sequence` or :class:" -"`~collections.abc.Buffer`. For use in type annotations, prefer a union, like " -"``bytes | bytearray``, or :class:`collections.abc.Buffer`. (Contributed by " -"Shantanu Jain in :gh:`91896`.)" -msgstr "" -"自 Python 3.9 起已被棄用的 :class:`typing.ByteString`,計劃在 Python " -"3.17 中移除。建議改用 :class:`~collections.abc.Sequence` 或 :class:`~" -"collections.abc.Buffer`。在型別註釋中建議改用聯集,例如 ``bytes | " -"bytearray`` 或 :class:`collections.abc.Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.17.rst:17 -msgid ":mod:`collections.abc`:" -msgstr ":mod:`collections.abc`:" - -#: ../../deprecations/pending-removal-in-3.17.rst:19 -msgid "" -":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. " -"Prefer :class:`~collections.abc.Sequence` or :class:`~collections.abc." -"Buffer`. For use in type annotations, prefer a union, like ``bytes | " -"bytearray``, or :class:`collections.abc.Buffer`. (Contributed by Shantanu " -"Jain in :gh:`91896`.)" +"removal in Python 3.17." msgstr "" -":class:`collections.abc.ByteString` 計劃在 Python 3.17 中移除。建議改用 " -":class:`~collections.abc.Sequence` 或 :class:`~collections.abc.Buffer`。在" -"型別註釋中建議改用聯集,例如 ``bytes | bytearray`` 或 :class:`collections.abc." -"Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" +":class:`typing.ByteString` 自 Python 3.9 起已被棄用,預計在 Python 3.17 中移除。" #: ../../deprecations/pending-removal-in-3.19.rst:2 msgid "Pending removal in Python 3.19" @@ -566,10 +590,6 @@ msgid "The :class:`argparse.FileType` type converter is deprecated." msgstr ":class:`argparse.FileType` 型別轉換器已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:18 -msgid "``bool(NotImplemented)``." -msgstr "``bool(NotImplemented)``。" - -#: ../../deprecations/pending-removal-in-future.rst:19 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -578,7 +598,7 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:22 +#: ../../deprecations/pending-removal-in-future.rst:21 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " @@ -590,13 +610,13 @@ msgid "" "syntax error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " -"1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " +"1else 2``。它讓運算式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " "``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" "keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" "`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" "本中,它將被更改為語法錯誤。(:gh:`87999`)" -#: ../../deprecations/pending-removal-in-future.rst:30 +#: ../../deprecations/pending-removal-in-future.rst:29 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -605,7 +625,7 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:33 +#: ../../deprecations/pending-removal-in-future.rst:32 msgid "" "Support for ``__float__()`` method returning a strict subclass of :class:" "`float`: these methods will be required to return an instance of :class:" @@ -614,7 +634,7 @@ msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:36 +#: ../../deprecations/pending-removal-in-future.rst:35 msgid "" "Support for ``__complex__()`` method returning a strict subclass of :class:" "`complex`: these methods will be required to return an instance of :class:" @@ -623,11 +643,11 @@ msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:39 +#: ../../deprecations/pending-removal-in-future.rst:38 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:40 +#: ../../deprecations/pending-removal-in-future.rst:39 msgid "" "Passing a complex number as the *real* or *imag* argument in the :func:" "`complex` constructor is now deprecated; it should only be passed as a " @@ -637,7 +657,7 @@ msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:45 +#: ../../deprecations/pending-removal-in-future.rst:44 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " "are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." @@ -647,25 +667,25 @@ msgstr "" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:50 +#: ../../deprecations/pending-removal-in-future.rst:49 msgid "" ":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:" "`133038`)" msgstr "" ":mod:`codecs`:請改用 :func:`open` 而非 :func:`codecs.open`。(:gh:`133038`)" -#: ../../deprecations/pending-removal-in-future.rst:52 +#: ../../deprecations/pending-removal-in-future.rst:51 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:55 +#: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:57 +#: ../../deprecations/pending-removal-in-future.rst:56 msgid "" ":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." "UTC)``." @@ -673,7 +693,7 @@ msgstr "" ":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." "now(tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:59 +#: ../../deprecations/pending-removal-in-future.rst:58 msgid "" ":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``." @@ -681,11 +701,11 @@ msgstr "" ":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:62 +#: ../../deprecations/pending-removal-in-future.rst:61 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:65 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -693,19 +713,19 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:68 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:71 +#: ../../deprecations/pending-removal-in-future.rst:70 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:71 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:74 +#: ../../deprecations/pending-removal-in-future.rst:73 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." @@ -713,19 +733,19 @@ msgstr "" ":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" "`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:76 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:79 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:82 +#: ../../deprecations/pending-removal-in-future.rst:81 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -733,7 +753,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:85 +#: ../../deprecations/pending-removal-in-future.rst:84 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -745,12 +765,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:93 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -758,15 +778,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:97 +#: ../../deprecations/pending-removal-in-future.rst:96 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -774,51 +794,51 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:108 +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:110 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:111 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:111 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:113 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -826,11 +846,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:117 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -838,7 +858,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -846,20 +866,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:122 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:127 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "" "The internal class ``typing._UnionGenericAlias`` is no longer used to " "implement :class:`typing.Union`. To preserve compatibility with users using " @@ -870,7 +890,7 @@ msgstr "" "了保持與此私有類別使用者的相容性,直到至少 Python 3.17 都將提供一個相容性 " "shim。(由 Jelle Zijlstra 於 :gh:`105499` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -878,64 +898,64 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:141 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:141 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:143 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:144 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:145 +#: ../../deprecations/pending-removal-in-future.rst:144 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:145 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:147 +#: ../../deprecations/pending-removal-in-future.rst:146 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:148 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:152 +#: ../../deprecations/pending-removal-in-future.rst:151 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." "etree.ElementTree.Element` is deprecated. In a future release it will always " @@ -946,7 +966,7 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:157 +#: ../../deprecations/pending-removal-in-future.rst:156 msgid "" ":func:`sys._clear_type_cache` is deprecated: use :func:`sys." "_clear_internal_caches` instead." @@ -1469,8 +1489,8 @@ msgid "" "(Contributed by Victor Stinner in :gh:`128863`.)" msgstr "" "可以使用 `pythoncapi-compat project `__ 來取得這些於 Python 3.13 及更早版本的新公開函式。(由 " -"Victor Stinner 在 :gh:`128863` 貢獻)" +"compat/>`__ 來取得這些於 Python 3.13 及更早版本的新公開函式。(由 Victor " +"Stinner 在 :gh:`128863` 貢獻)" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" diff --git a/deprecations/pending-removal-in-3.17.po b/deprecations/pending-removal-in-3.17.po index 49abbd6744e..3357e9e6ed7 100644 --- a/deprecations/pending-removal-in-3.17.po +++ b/deprecations/pending-removal-in-3.17.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-18 00:15+0000\n" +"POT-Creation-Date: 2025-09-19 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,10 +21,57 @@ msgid "Pending removal in Python 3.17" msgstr "Python 3.17 中待移除的項目" #: ../../deprecations/pending-removal-in-3.17.rst:4 +msgid ":mod:`collections.abc`:" +msgstr ":mod:`collections.abc`:" + +#: ../../deprecations/pending-removal-in-3.17.rst:6 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17." +msgstr ":class:`collections.abc.ByteString` 預計在 Python 3.17 中移除。" + +#: ../../deprecations/pending-removal-in-3.17.rst:8 +#: ../../deprecations/pending-removal-in-3.17.rst:36 +msgid "" +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." +msgstr "" +"使用 ``isinstance(obj, collections.abc.Buffer)`` 來測試 ``obj`` 是否在 runtime " +"實作了\\ :ref:`緩衝區協定 `。在型別註解的使用中,請用 :class:`~" +"collections.abc.Buffer` 或明確指定你的程式碼所支援型別的聯集(例如 " +"``bytes | bytearray | memoryview``)。" + +#: ../../deprecations/pending-removal-in-3.17.rst:14 +#: ../../deprecations/pending-removal-in-3.17.rst:42 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." +msgstr "" +":class:`!ByteString` 最初被設計為一個抽象類別,以作為 :class:`bytes` 和 :class:`bytearray` " +"的超型別 (supertype)。然而由於 ABC 從未擁有任何方法,知道一個物件是 :class:`!ByteString` 的" +"實例從未真正告訴你任何關於該物件的有用資訊。其他常見的緩衝區型別如 :class:`memoryview` " +"也從未被理解為 :class:`!ByteString` 的子型別(無論是在 runtime 還是由靜態型別檢查器)。" + +#: ../../deprecations/pending-removal-in-3.17.rst:22 +#: ../../deprecations/pending-removal-in-3.17.rst:50 +msgid "" +"See :pep:`PEP 688 <688#current-options>` for more details. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" +"更多細節請見 :pep:`PEP 688 <688#current-options>`。(由 Shantanu Jain 於 :gh:`91896` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.17.rst:26 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.17.rst:6 +#: ../../deprecations/pending-removal-in-3.17.rst:28 msgid "" "Before Python 3.14, old-style unions were implemented using the private " "class ``typing._UnionGenericAlias``. This class is no longer needed for the " @@ -38,32 +85,9 @@ msgstr "" "除。使用者應該改用文件中記錄的內省輔助函式,例如 :func:`typing.get_origin` " "和 :func:`typing.get_args`,或者依賴私有實作細節。" -#: ../../deprecations/pending-removal-in-3.17.rst:11 +#: ../../deprecations/pending-removal-in-3.17.rst:33 msgid "" ":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " -"removal in Python 3.17. Prefer :class:`~collections.abc.Sequence` or :class:" -"`~collections.abc.Buffer`. For use in type annotations, prefer a union, like " -"``bytes | bytearray``, or :class:`collections.abc.Buffer`. (Contributed by " -"Shantanu Jain in :gh:`91896`.)" -msgstr "" -"自 Python 3.9 起已被棄用的 :class:`typing.ByteString`,計劃在 Python " -"3.17 中移除。建議改用 :class:`~collections.abc.Sequence` 或 :class:`~" -"collections.abc.Buffer`。在型別註釋中建議改用聯集,例如 ``bytes | " -"bytearray`` 或 :class:`collections.abc.Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.17.rst:17 -msgid ":mod:`collections.abc`:" -msgstr ":mod:`collections.abc`:" - -#: ../../deprecations/pending-removal-in-3.17.rst:19 -msgid "" -":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. " -"Prefer :class:`~collections.abc.Sequence` or :class:`~collections.abc." -"Buffer`. For use in type annotations, prefer a union, like ``bytes | " -"bytearray``, or :class:`collections.abc.Buffer`. (Contributed by Shantanu " -"Jain in :gh:`91896`.)" +"removal in Python 3.17." msgstr "" -":class:`collections.abc.ByteString` 計劃在 Python 3.17 中移除。建議改用 " -":class:`~collections.abc.Sequence` 或 :class:`~collections.abc.Buffer`。在" -"型別註釋中建議改用聯集,例如 ``bytes | bytearray`` 或 :class:`collections.abc." -"Buffer`。(Shantanu Jain 於 :gh:`91896` 貢獻。)" +":class:`typing.ByteString` 自 Python 3.9 起已被棄用,預計在 Python 3.17 中移除。" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po index 60bdaf627e0..6b666a7e95f 100644 --- a/deprecations/pending-removal-in-future.po +++ b/deprecations/pending-removal-in-future.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-06 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,11 +37,11 @@ msgstr "巢狀引數群組和巢狀互斥群組已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:11 msgid "" -"Passing the undocumented keyword argument *prefix_chars* " -"to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." +"Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse." +"ArgumentParser.add_argument_group` is now deprecated." msgstr "" -"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞" -"給 :meth:`~argparse.ArgumentParser.add_argument_group` 的做法現在已被棄用。" +"將未以文件記錄的關鍵字引數 *prefix_chars* 傳遞給 :meth:`~argparse." +"ArgumentParser.add_argument_group` 的做法現在已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:14 msgid "The :class:`argparse.FileType` type converter is deprecated." @@ -52,10 +52,6 @@ msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" #: ../../deprecations/pending-removal-in-future.rst:18 -msgid "``bool(NotImplemented)``." -msgstr "``bool(NotImplemented)``。" - -#: ../../deprecations/pending-removal-in-future.rst:19 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -64,25 +60,25 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:22 +#: ../../deprecations/pending-removal-in-future.rst:21 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of " -"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " -"and :keyword:`or`. In a future release it will be changed to a syntax " -"error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " -"1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" -"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " -"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" -"法錯誤。(:gh:`87999`)" +"1else 2``。它讓運算式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" +"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" +"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" +"本中,它將被更改為語法錯誤。(:gh:`87999`)" -#: ../../deprecations/pending-removal-in-future.rst:30 +#: ../../deprecations/pending-removal-in-future.rst:29 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -91,92 +87,91 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:33 +#: ../../deprecations/pending-removal-in-future.rst:32 msgid "" -"Support for ``__float__()`` method returning a strict subclass " -"of :class:`float`: these methods will be required to return an instance " -"of :class:`float`." +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:36 +#: ../../deprecations/pending-removal-in-future.rst:35 msgid "" -"Support for ``__complex__()`` method returning a strict subclass " -"of :class:`complex`: these methods will be required to return an instance " -"of :class:`complex`." +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:39 +#: ../../deprecations/pending-removal-in-future.rst:38 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:40 +#: ../../deprecations/pending-removal-in-future.rst:39 msgid "" -"Passing a complex number as the *real* or *imag* argument in " -"the :func:`complex` constructor is now deprecated; it should only be passed " -"as a single positional argument. (Contributed by Serhiy Storchaka " -"in :gh:`109218`.)" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:45 +#: ../../deprecations/pending-removal-in-future.rst:44 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` " -"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:50 +#: ../../deprecations/pending-removal-in-future.rst:49 msgid "" -":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " -"(:gh:`133038`)" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:" +"`133038`)" msgstr "" ":mod:`codecs`:請改用 :func:`open` 而非 :func:`codecs.open`。(:gh:`133038`)" -#: ../../deprecations/pending-removal-in-future.rst:52 +#: ../../deprecations/pending-removal-in-future.rst:51 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:55 +#: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:57 +#: ../../deprecations/pending-removal-in-future.rst:56 msgid "" -":meth:`~datetime.datetime.utcnow`: use " -"``datetime.datetime.now(tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 " -"``datetime.datetime.now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." +"now(tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:59 +#: ../../deprecations/pending-removal-in-future.rst:58 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:62 +#: ../../deprecations/pending-removal-in-future.rst:61 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid ":mod:`importlib`:" msgstr ":mod:`importlib`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:65 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -184,39 +179,39 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:68 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:71 +#: ../../deprecations/pending-removal-in-future.rst:70 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:71 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:74 +#: ../../deprecations/pending-removal-in-future.rst:73 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" -"用 :meth:`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:76 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:79 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:82 +#: ../../deprecations/pending-removal-in-future.rst:81 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -224,7 +219,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:85 +#: ../../deprecations/pending-removal-in-future.rst:84 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -236,12 +231,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:93 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -249,108 +244,108 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:97 +#: ../../deprecations/pending-removal-in-future.rst:96 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " -"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " -"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" +"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:108 +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:110 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:111 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:111 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:113 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid "" -":meth:`!threading.Condition.notifyAll`: " -"use :meth:`~threading.Condition.notify_all`." +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請" -"用 :meth:`~threading.Condition.notify_all`。" +":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." +"notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:117 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " -"use :attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " -"use :attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" -"用 :attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" +"attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:122 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:127 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "" "The internal class ``typing._UnionGenericAlias`` is no longer used to " "implement :class:`typing.Union`. To preserve compatibility with users using " @@ -361,7 +356,7 @@ msgstr "" "了保持與此私有類別使用者的相容性,直到至少 Python 3.17 都將提供一個相容性 " "shim。(由 Jelle Zijlstra 於 :gh:`105499` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -369,78 +364,78 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:141 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:141 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:143 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:144 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:145 +#: ../../deprecations/pending-removal-in-future.rst:144 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:145 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:147 +#: ../../deprecations/pending-removal-in-future.rst:146 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:148 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:152 +#: ../../deprecations/pending-removal-in-future.rst:151 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of " -"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " -"release it will always return ``True``. Prefer explicit ``len(elem)`` or " -"``elem is not None`` tests instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用" -"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" -"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." +"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " +"``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:157 +#: ../../deprecations/pending-removal-in-future.rst:156 msgid "" -":func:`sys._clear_type_cache` is deprecated: " -"use :func:`sys._clear_internal_caches` instead." +":func:`sys._clear_type_cache` is deprecated: use :func:`sys." +"_clear_internal_caches` instead." msgstr "" -":func:`sys._clear_type_cache` 已被棄用:請改" -"用 :func:`sys._clear_internal_caches`。" +":func:`sys._clear_type_cache` 已被棄用:請改用 :func:`sys." +"_clear_internal_caches`。" diff --git a/extending/extending.po b/extending/extending.po index 452fcb63745..ec9327dda4f 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2025-02-17 14:34+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -113,7 +113,7 @@ msgstr "" msgid "The first two lines of our file can be::" msgstr "我們檔案的前兩列可以為: ::" -#: ../../extending/extending.rst:60 ../../extending/extending.rst:681 +#: ../../extending/extending.rst:60 ../../extending/extending.rst:706 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include " @@ -152,15 +152,86 @@ msgstr "" #: ../../extending/extending.rst:77 msgid "" "All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` " -"or ``PY``, except those defined in standard header files. For convenience, " -"and since they are used extensively by the Python interpreter, ``\"Python." -"h\"`` includes a few standard header files: ````, ````, " -"````, and ````. If the latter header file does not exist " -"on your system, it declares the functions :c:func:`malloc`, :c:func:`free` " -"and :c:func:`realloc` directly." +"or ``PY``, except those defined in standard header files." msgstr "" -#: ../../extending/extending.rst:85 +#: ../../extending/extending.rst:82 +msgid "" +"For backward compatibility, :file:`Python.h` includes several standard " +"header files. C extensions should include the standard headers that they " +"use, and should not rely on these implicit includes. If using the limited C " +"API version 3.13 or newer, the implicit includes are:" +msgstr "" + +#: ../../extending/extending.rst:87 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:88 +msgid "```` (on Windows)" +msgstr "````\\ (在 Windows 上)" + +#: ../../extending/extending.rst:89 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:90 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:91 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:92 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:93 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:94 +msgid "```` (if present)" +msgstr "````\\ (如果存在)" + +#: ../../extending/extending.rst:96 +msgid "" +"If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.12 or " +"older, the headers below are also included:" +msgstr "" + +#: ../../extending/extending.rst:99 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:100 +msgid "```` (on POSIX)" +msgstr "````\\ (在 POSIX 上)" + +#: ../../extending/extending.rst:102 +msgid "" +"If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.10 or " +"older, the headers below are also included:" +msgstr "" + +#: ../../extending/extending.rst:105 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:106 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:107 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:108 +msgid "````" +msgstr "````" + +#: ../../extending/extending.rst:110 msgid "" "The next thing we add to our module file is the C function that will be " "called when the Python expression ``spam.system(string)`` is evaluated " @@ -170,7 +241,7 @@ msgstr "" "system(string)`` 要被求值 (evaluated) 時就會被呼叫(我們很快就會看到它最後是" "如何被呼叫的): ::" -#: ../../extending/extending.rst:89 +#: ../../extending/extending.rst:114 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -196,7 +267,7 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:101 +#: ../../extending/extending.rst:126 msgid "" "There is a straightforward translation from the argument list in Python (for " "example, the single expression ``\"ls -l\"``) to the arguments passed to the " @@ -206,7 +277,7 @@ msgstr "" "可以很直觀地從 Python 的引數串列(例如單一的運算式 ``\"ls -l\"``)直接轉換成" "傳給 C 函式的引數。C 函式總是有兩個引數,習慣上會命名為 *self* 和 *args*。" -#: ../../extending/extending.rst:106 +#: ../../extending/extending.rst:131 msgid "" "The *self* argument points to the module object for module-level functions; " "for a method it would point to the object instance." @@ -214,7 +285,7 @@ msgstr "" "對於模組層級的函式,*self* 引數會指向模組物件;而對於方法來說則是指向物件的實" "例。" -#: ../../extending/extending.rst:109 +#: ../../extending/extending.rst:134 msgid "" "The *args* argument will be a pointer to a Python tuple object containing " "the arguments. Each item of the tuple corresponds to an argument in the " @@ -231,7 +302,7 @@ msgstr "" "`PyArg_ParseTuple` 函式能夠檢查引數型別並將他們轉換為 C 值。它使用模板字串來" "決定所需的引數型別以及儲存轉換值的 C 變數型別。稍後會再詳細說明。" -#: ../../extending/extending.rst:118 +#: ../../extending/extending.rst:143 msgid "" ":c:func:`PyArg_ParseTuple` returns true (nonzero) if all arguments have the " "right type and its components have been stored in the variables whose " @@ -245,11 +316,11 @@ msgstr "" "(零)。在後者情況下,它也會產生適當的例外,因此呼叫函式可以立即回傳 " "``NULL``\\ (就像我們在範例中所看到的)。" -#: ../../extending/extending.rst:128 +#: ../../extending/extending.rst:153 msgid "Intermezzo: Errors and Exceptions" msgstr "插曲:錯誤與例外" -#: ../../extending/extending.rst:130 +#: ../../extending/extending.rst:155 msgid "" "An important convention throughout the Python interpreter is the following: " "when a function fails, it should set an exception condition and return an " @@ -266,13 +337,13 @@ msgstr "" "們是由 :meth:`sys.exc_info` 所回傳的 Python 元組中的 C 等效元組。它們是例外型" "別、例外實例和回溯物件。了解它們對於理解錯誤是如何傳遞是很重要的。" -#: ../../extending/extending.rst:139 +#: ../../extending/extending.rst:164 msgid "" "The Python API defines a number of functions to set various types of " "exceptions." msgstr "Python API 定義了許多能夠設定各種類型例外的函式。" -#: ../../extending/extending.rst:141 +#: ../../extending/extending.rst:166 msgid "" "The most common one is :c:func:`PyErr_SetString`. Its arguments are an " "exception object and a C string. The exception object is usually a " @@ -285,7 +356,7 @@ msgstr "" "指出錯誤的原因,並被轉換為 Python 字串物件且被儲存為例外的「關聯值 " "(associated value)」。" -#: ../../extending/extending.rst:147 +#: ../../extending/extending.rst:172 msgid "" "Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an " "exception argument and constructs the associated value by inspection of the " @@ -299,7 +370,7 @@ msgstr "" "`PyErr_SetObject`,它接受兩個物件引數,即例外和它的關聯值。你不需要對傳給任何" "這些函式的物件呼叫 :c:func:`Py_INCREF`。" -#: ../../extending/extending.rst:154 +#: ../../extending/extending.rst:179 msgid "" "You can test non-destructively whether an exception has been set with :c:" "func:`PyErr_Occurred`. This returns the current exception object, or " @@ -311,7 +382,7 @@ msgstr "" "回傳目前的例外物件,如果沒有例外發生則回傳 ``NULL``。你通常不需要呼叫 :c:" "func:`PyErr_Occurred` 來查看函式呼叫是否發生錯誤,因為你應可從回傳值就得知。" -#: ../../extending/extending.rst:160 +#: ../../extending/extending.rst:185 msgid "" "When a function *f* that calls another function *g* detects that the latter " "fails, *f* should itself return an error value (usually ``NULL`` or " @@ -330,7 +401,7 @@ msgstr "" "首先檢測到它的函式回報了。一旦錯誤到達 Python 直譯器的主要迴圈,這會中止目前" "執行的 Python 程式碼,並嘗試尋找 Python 程式設計者指定的例外處理程式。" -#: ../../extending/extending.rst:170 +#: ../../extending/extending.rst:195 msgid "" "(There are situations where a module can actually give a more detailed error " "message by calling another ``PyErr_*`` function, and in such cases it is " @@ -342,7 +413,7 @@ msgstr "" "息,在這種情況下這樣做是沒問題的。然而這一般來說並非必要,而且可能會導致錯誤" "原因資訊的遺失:大多數的操作都可能因為各種原因而失敗。)" -#: ../../extending/extending.rst:176 +#: ../../extending/extending.rst:201 msgid "" "To ignore an exception set by a function call that failed, the exception " "condition must be cleared explicitly by calling :c:func:`PyErr_Clear`. The " @@ -355,7 +426,7 @@ msgstr "" "給直譯器而想要完全是自己來處理它時(可能是要再嘗試其他東西,或者假裝什麼都沒" "出錯)。" -#: ../../extending/extending.rst:182 +#: ../../extending/extending.rst:207 msgid "" "Every failing :c:func:`malloc` call must be turned into an exception --- the " "direct caller of :c:func:`malloc` (or :c:func:`realloc`) must call :c:func:" @@ -369,7 +440,7 @@ msgstr "" "`PyLong_FromLong`)都已經這麼做了,所以這個注意事項只和那些直接呼叫 :c:func:" "`malloc` 的函式有關。" -#: ../../extending/extending.rst:188 +#: ../../extending/extending.rst:213 msgid "" "Also note that, with the important exception of :c:func:`PyArg_ParseTuple` " "and friends, functions that return an integer status usually return a " @@ -380,7 +451,7 @@ msgstr "" "整數狀態的函式通常會回傳一個正值或 0 表示成功、回傳 ``-1`` 表示失敗,就像 " "Unix 系統呼叫一樣。" -#: ../../extending/extending.rst:192 +#: ../../extending/extending.rst:217 msgid "" "Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or :" "c:func:`Py_DECREF` calls for objects you have already created) when you " @@ -389,7 +460,7 @@ msgstr "" "最後,在回傳錯誤指示器時要注意垃圾清理(透過對你已經建立的物件呼叫 :c:func:" "`Py_XDECREF` 或 :c:func:`Py_DECREF`)!" -#: ../../extending/extending.rst:196 +#: ../../extending/extending.rst:221 msgid "" "The choice of which exception to raise is entirely yours. There are " "predeclared C objects corresponding to all built-in Python exceptions, such " @@ -409,7 +480,7 @@ msgstr "" "的值必須在一個特定的範圍內或必須滿足其他條件,則可以使用 :c:data:" "`PyExc_ValueError`。" -#: ../../extending/extending.rst:206 +#: ../../extending/extending.rst:231 msgid "" "You can also define a new exception that is unique to your module. The " "simplest way to do this is to declare a static global object variable at the " @@ -418,34 +489,34 @@ msgstr "" "你也可以定義一個你的模組特有的新例外。最簡單的方式是在檔案的開頭宣告一個靜態" "全域物件變數: ::" -#: ../../extending/extending.rst:210 +#: ../../extending/extending.rst:235 msgid "static PyObject *SpamError = NULL;" msgstr "static PyObject *SpamError = NULL;" -#: ../../extending/extending.rst:212 +#: ../../extending/extending.rst:237 msgid "" "and initialize it by calling :c:func:`PyErr_NewException` in the module's :c:" "data:`Py_mod_exec` function (:c:func:`!spam_module_exec`)::" msgstr "" -#: ../../extending/extending.rst:215 +#: ../../extending/extending.rst:240 msgid "SpamError = PyErr_NewException(\"spam.error\", NULL, NULL);" msgstr "" -#: ../../extending/extending.rst:217 +#: ../../extending/extending.rst:242 msgid "" "Since :c:data:`!SpamError` is a global variable, it will be overwritten " "every time the module is reinitialized, when the :c:data:`Py_mod_exec` " "function is called." msgstr "" -#: ../../extending/extending.rst:220 +#: ../../extending/extending.rst:245 msgid "" "For now, let's avoid the issue: we will block repeated initialization by " "raising an :py:exc:`ImportError`::" msgstr "" -#: ../../extending/extending.rst:223 +#: ../../extending/extending.rst:248 msgid "" "static PyObject *SpamError = NULL;\n" "\n" @@ -484,7 +555,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:259 +#: ../../extending/extending.rst:284 msgid "" "Note that the Python name for the exception object is :exc:`!spam.error`. " "The :c:func:`PyErr_NewException` function may create a class with the base " @@ -495,7 +566,7 @@ msgstr "" "exceptions`\\ 所述,:c:func:`PyErr_NewException` 函式可能會建立一個基底類別" "為 :exc:`Exception` 的類別(除非傳入另一個類別來代替 ``NULL``)。" -#: ../../extending/extending.rst:264 +#: ../../extending/extending.rst:289 msgid "" "Note also that the :c:data:`!SpamError` variable retains a reference to the " "newly created exception class; this is intentional! Since the exception " @@ -511,7 +582,7 @@ msgstr "" "如果它變成迷途指標,那產生例外的 C 程式碼可能會導致核心轉儲 (core dump) 或其" "他不預期的 side effect。" -#: ../../extending/extending.rst:271 +#: ../../extending/extending.rst:296 msgid "" "For now, the :c:func:`Py_DECREF` call to remove this reference is missing. " "Even when the Python interpreter shuts down, the global :c:data:`!SpamError` " @@ -519,13 +590,13 @@ msgid "" "ensure that this will happen at most once per process." msgstr "" -#: ../../extending/extending.rst:276 +#: ../../extending/extending.rst:301 msgid "" "We discuss the use of :c:macro:`PyMODINIT_FUNC` as a function return type " "later in this sample." msgstr "我們稍後會討論 :c:macro:`PyMODINIT_FUNC` 作為函式回傳型別的用法。" -#: ../../extending/extending.rst:279 +#: ../../extending/extending.rst:304 msgid "" "The :exc:`!spam.error` exception can be raised in your extension module " "using a call to :c:func:`PyErr_SetString` as shown below::" @@ -533,7 +604,7 @@ msgstr "" "可以在你的擴充模組中呼叫 :c:func:`PyErr_SetString` 來引發 :exc:`!spam.error` " "例外,如下所示: ::" -#: ../../extending/extending.rst:282 +#: ../../extending/extending.rst:307 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -567,17 +638,17 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:302 +#: ../../extending/extending.rst:327 msgid "Back to the Example" msgstr "回到範例" -#: ../../extending/extending.rst:304 +#: ../../extending/extending.rst:329 msgid "" "Going back to our example function, you should now be able to understand " "this statement::" msgstr "回到我們的範例函式,現在你應該可以理解這個陳述式了: ::" -#: ../../extending/extending.rst:307 +#: ../../extending/extending.rst:332 msgid "" "if (!PyArg_ParseTuple(args, \"s\", &command))\n" " return NULL;" @@ -585,7 +656,7 @@ msgstr "" "if (!PyArg_ParseTuple(args, \"s\", &command))\n" " return NULL;" -#: ../../extending/extending.rst:310 +#: ../../extending/extending.rst:335 msgid "" "It returns ``NULL`` (the error indicator for functions returning object " "pointers) if an error is detected in the argument list, relying on the " @@ -601,7 +672,7 @@ msgstr "" "的字串(所以在標準 C 中,:c:data:`!command` 變數應該正確地被宣告為 ``const " "char *command``)。" -#: ../../extending/extending.rst:318 +#: ../../extending/extending.rst:343 msgid "" "The next statement is a call to the Unix function :c:func:`system`, passing " "it the string we just got from :c:func:`PyArg_ParseTuple`::" @@ -609,11 +680,11 @@ msgstr "" "接下來的陳述式會呼叫 Unix 函式 :c:func:`system`,並將剛才從 :c:func:" "`PyArg_ParseTuple` 得到的字串傳給它:" -#: ../../extending/extending.rst:321 +#: ../../extending/extending.rst:346 msgid "sts = system(command);" msgstr "sts = system(command);" -#: ../../extending/extending.rst:323 +#: ../../extending/extending.rst:348 msgid "" "Our :func:`!spam.system` function must return the value of :c:data:`!sts` as " "a Python object. This is done using the function :c:func:" @@ -622,11 +693,11 @@ msgstr "" "我們的 :func:`!spam.system` 函式必須以 Python 物件的形式來回傳 :c:data:`!" "sts` 的值。這是透過 :c:func:`PyLong_FromLong` 函式來達成。 ::" -#: ../../extending/extending.rst:326 +#: ../../extending/extending.rst:351 msgid "return PyLong_FromLong(sts);" msgstr "return PyLong_FromLong(sts);" -#: ../../extending/extending.rst:328 +#: ../../extending/extending.rst:353 msgid "" "In this case, it will return an integer object. (Yes, even integers are " "objects on the heap in Python!)" @@ -634,7 +705,7 @@ msgstr "" "在這種情況下它會回傳一個整數物件。(是的,在 Python 中連整數也是堆積 (heap) 上" "的物件!)" -#: ../../extending/extending.rst:331 +#: ../../extending/extending.rst:356 msgid "" "If you have a C function that returns no useful argument (a function " "returning :c:expr:`void`), the corresponding Python function must return " @@ -645,7 +716,7 @@ msgstr "" "應的 Python 函式必須回傳 ``None``。你需要以下這個慣例來達成(由 :c:macro:" "`Py_RETURN_NONE` 巨集實作): ::" -#: ../../extending/extending.rst:336 +#: ../../extending/extending.rst:361 msgid "" "Py_INCREF(Py_None);\n" "return Py_None;" @@ -653,7 +724,7 @@ msgstr "" "Py_INCREF(Py_None);\n" "return Py_None;" -#: ../../extending/extending.rst:339 +#: ../../extending/extending.rst:364 msgid "" ":c:data:`Py_None` is the C name for the special Python object ``None``. It " "is a genuine Python object rather than a ``NULL`` pointer, which means " @@ -663,11 +734,11 @@ msgstr "" "Python 物件而不是一個 ``NULL`` 指標,在大多數的情況下它的意思是「錯誤」,如我" "們所見過的那樣。" -#: ../../extending/extending.rst:347 +#: ../../extending/extending.rst:372 msgid "The Module's Method Table and Initialization Function" msgstr "模組的方法表和初始化函式" -#: ../../extending/extending.rst:349 +#: ../../extending/extending.rst:374 msgid "" "I promised to show how :c:func:`!spam_system` is called from Python " "programs. First, we need to list its name and address in a \"method table\"::" @@ -675,7 +746,7 @@ msgstr "" "我承諾過要展示 :c:func:`!spam_system` 是如何從 Python 程式中呼叫的。首先,我" "們需要在「方法表」中列出它的名稱和位址: ::" -#: ../../extending/extending.rst:352 +#: ../../extending/extending.rst:377 msgid "" "static PyMethodDef spam_methods[] = {\n" " ...\n" @@ -693,7 +764,7 @@ msgstr "" " {NULL, NULL, 0, NULL} /* Sentinel */\n" "};" -#: ../../extending/extending.rst:360 +#: ../../extending/extending.rst:385 msgid "" "Note the third entry (``METH_VARARGS``). This is a flag telling the " "interpreter the calling convention to be used for the C function. It should " @@ -705,7 +776,7 @@ msgstr "" "標。通常應該是 ``METH_VARARGS`` 或 ``METH_VARARGS | METH_KEYWORDS``;``0`` 表" "示是使用 :c:func:`PyArg_ParseTuple` 的一個過時變體。" -#: ../../extending/extending.rst:365 +#: ../../extending/extending.rst:390 msgid "" "When using only ``METH_VARARGS``, the function should expect the Python-" "level parameters to be passed in as a tuple acceptable for parsing via :c:" @@ -715,7 +786,7 @@ msgstr "" "能夠接受以 :c:func:`PyArg_ParseTuple` 進行剖析;有關此函式的更多資訊將在下面" "提供。" -#: ../../extending/extending.rst:369 +#: ../../extending/extending.rst:394 msgid "" "The :c:macro:`METH_KEYWORDS` bit may be set in the third field if keyword " "arguments should be passed to the function. In this case, the C function " @@ -728,12 +799,12 @@ msgstr "" "是關鍵字的字典。可使用 :c:func:`PyArg_ParseTupleAndKeywords` 來剖析這種函式的" "引數。" -#: ../../extending/extending.rst:375 +#: ../../extending/extending.rst:400 msgid "" "The method table must be referenced in the module definition structure::" msgstr "方法表必須在模組定義結構中被參照: ::" -#: ../../extending/extending.rst:377 +#: ../../extending/extending.rst:402 msgid "" "static struct PyModuleDef spam_module = {\n" " ...\n" @@ -742,7 +813,7 @@ msgid "" "};" msgstr "" -#: ../../extending/extending.rst:383 +#: ../../extending/extending.rst:408 msgid "" "This structure, in turn, must be passed to the interpreter in the module's " "initialization function. The initialization function must be named :c:func:" @@ -753,7 +824,7 @@ msgstr "" "為 :c:func:`!PyInit_name`,其中 *name* 是模組的名稱,且應該是模組檔案中唯一定" "義的非「靜態 (``static``)」項目: ::" -#: ../../extending/extending.rst:388 +#: ../../extending/extending.rst:413 msgid "" "PyMODINIT_FUNC\n" "PyInit_spam(void)\n" @@ -767,7 +838,7 @@ msgstr "" " return PyModuleDef_Init(&spam_module);\n" "}" -#: ../../extending/extending.rst:394 +#: ../../extending/extending.rst:419 msgid "" "Note that :c:macro:`PyMODINIT_FUNC` declares the function as ``PyObject *`` " "return type, declares any special linkage declarations required by the " @@ -776,7 +847,7 @@ msgstr "" "請注意,:c:macro:`PyMODINIT_FUNC` 宣告函式的回傳型別為 ``PyObject *``、宣告平" "台所需的任何特殊連結宣告、並針對 C++ 宣告函式為 ``extern \"C\"``。" -#: ../../extending/extending.rst:398 +#: ../../extending/extending.rst:423 msgid "" ":c:func:`!PyInit_spam` is called when each interpreter imports its module :" "mod:`!spam` for the first time. (See below for comments about embedding " @@ -785,7 +856,7 @@ msgid "" "store it in ``sys.modules``." msgstr "" -#: ../../extending/extending.rst:403 +#: ../../extending/extending.rst:428 msgid "" "When embedding Python, the :c:func:`!PyInit_spam` function is not called " "automatically unless there's an entry in the :c:data:`!PyImport_Inittab` " @@ -796,7 +867,7 @@ msgstr "" "動呼叫 :c:func:`!PyInit_spam` 函式。要將模組加入初始化表,請使用 :c:func:" "`PyImport_AppendInittab` 並在隨後選擇性地將該模組引入: ::" -#: ../../extending/extending.rst:408 +#: ../../extending/extending.rst:433 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -898,7 +969,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../extending/extending.rst:458 +#: ../../extending/extending.rst:483 msgid "" "If you declare a global variable or a local static one, the module may " "experience unintended side-effects on re-initialisation, for example when " @@ -910,7 +981,7 @@ msgid "" "`Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED`)." msgstr "" -#: ../../extending/extending.rst:467 +#: ../../extending/extending.rst:492 msgid "" "A more substantial example module is included in the Python source " "distribution as :file:`Modules/xxlimited.c`. This file may be used as a " @@ -919,11 +990,11 @@ msgstr "" "Python 原始碼發行版本中包含了一個更實質的範例模組 :file:`Modules/xxlimited." "c`。這個檔案可以當作模板使用,也可以簡單地當作範例來閱讀。" -#: ../../extending/extending.rst:475 +#: ../../extending/extending.rst:500 msgid "Compilation and Linkage" msgstr "" -#: ../../extending/extending.rst:477 +#: ../../extending/extending.rst:502 msgid "" "There are two more things to do before you can use your new extension: " "compiling and linking it with the Python system. If you use dynamic " @@ -933,7 +1004,7 @@ msgid "" "Windows (chapter :ref:`building-on-windows`) for more information about this." msgstr "" -#: ../../extending/extending.rst:484 +#: ../../extending/extending.rst:509 msgid "" "If you can't use dynamic loading, or if you want to make your module a " "permanent part of the Python interpreter, you will have to change the " @@ -943,11 +1014,11 @@ msgid "" "line to the file :file:`Modules/Setup.local` describing your file:" msgstr "" -#: ../../extending/extending.rst:491 +#: ../../extending/extending.rst:516 msgid "spam spammodule.o" msgstr "spam spammodule.o" -#: ../../extending/extending.rst:495 +#: ../../extending/extending.rst:520 msgid "" "and rebuild the interpreter by running :program:`make` in the toplevel " "directory. You can also run :program:`make` in the :file:`Modules/` " @@ -956,21 +1027,21 @@ msgid "" "the :file:`Setup` file.)" msgstr "" -#: ../../extending/extending.rst:501 +#: ../../extending/extending.rst:526 msgid "" "If your module requires additional libraries to link with, these can be " "listed on the line in the configuration file as well, for instance:" msgstr "" -#: ../../extending/extending.rst:504 +#: ../../extending/extending.rst:529 msgid "spam spammodule.o -lX11" msgstr "spam spammodule.o -lX11" -#: ../../extending/extending.rst:512 +#: ../../extending/extending.rst:537 msgid "Calling Python Functions from C" msgstr "" -#: ../../extending/extending.rst:514 +#: ../../extending/extending.rst:539 msgid "" "So far we have concentrated on making C functions callable from Python. The " "reverse is also useful: calling Python functions from C. This is especially " @@ -981,7 +1052,7 @@ msgid "" "uses are also imaginable." msgstr "" -#: ../../extending/extending.rst:522 +#: ../../extending/extending.rst:547 msgid "" "Fortunately, the Python interpreter is easily called recursively, and there " "is a standard interface to call a Python function. (I won't dwell on how to " @@ -990,7 +1061,7 @@ msgid "" "line option in :file:`Modules/main.c` from the Python source code.)" msgstr "" -#: ../../extending/extending.rst:528 +#: ../../extending/extending.rst:553 msgid "" "Calling a Python function is easy. First, the Python program must somehow " "pass you the Python function object. You should provide a function (or some " @@ -1000,7 +1071,7 @@ msgid "" "function might be part of a module definition::" msgstr "" -#: ../../extending/extending.rst:535 +#: ../../extending/extending.rst:560 msgid "" "static PyObject *my_callback = NULL;\n" "\n" @@ -1027,7 +1098,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:558 +#: ../../extending/extending.rst:583 msgid "" "This function must be registered with the interpreter using the :c:macro:" "`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The :" @@ -1035,7 +1106,7 @@ msgid "" "section :ref:`parsetuple`." msgstr "" -#: ../../extending/extending.rst:563 +#: ../../extending/extending.rst:588 msgid "" "The macros :c:func:`Py_XINCREF` and :c:func:`Py_XDECREF` increment/decrement " "the reference count of an object and are safe in the presence of ``NULL`` " @@ -1043,7 +1114,7 @@ msgid "" "info on them in section :ref:`refcounts`." msgstr "" -#: ../../extending/extending.rst:570 +#: ../../extending/extending.rst:595 msgid "" "Later, when it is time to call the function, you call the C function :c:func:" "`PyObject_CallObject`. This function has two arguments, both pointers to " @@ -1055,7 +1126,7 @@ msgid "" "or more format codes between parentheses. For example::" msgstr "" -#: ../../extending/extending.rst:579 +#: ../../extending/extending.rst:604 msgid "" "int arg;\n" "PyObject *arglist;\n" @@ -1069,7 +1140,7 @@ msgid "" "Py_DECREF(arglist);" msgstr "" -#: ../../extending/extending.rst:590 +#: ../../extending/extending.rst:615 msgid "" ":c:func:`PyObject_CallObject` returns a Python object pointer: this is the " "return value of the Python function. :c:func:`PyObject_CallObject` is " @@ -1078,7 +1149,7 @@ msgid "" "`Py_DECREF`\\ -ed immediately after the :c:func:`PyObject_CallObject` call." msgstr "" -#: ../../extending/extending.rst:597 +#: ../../extending/extending.rst:622 msgid "" "The return value of :c:func:`PyObject_CallObject` is \"new\": either it is a " "brand new object, or it is an existing object whose reference count has been " @@ -1087,7 +1158,7 @@ msgid "" "not interested in its value." msgstr "" -#: ../../extending/extending.rst:603 +#: ../../extending/extending.rst:628 msgid "" "Before you do this, however, it is important to check that the return value " "isn't ``NULL``. If it is, the Python function terminated by raising an " @@ -1098,7 +1169,7 @@ msgid "" "should be cleared by calling :c:func:`PyErr_Clear`. For example::" msgstr "" -#: ../../extending/extending.rst:611 +#: ../../extending/extending.rst:636 msgid "" "if (result == NULL)\n" " return NULL; /* Pass error back */\n" @@ -1106,7 +1177,7 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:616 +#: ../../extending/extending.rst:641 msgid "" "Depending on the desired interface to the Python callback function, you may " "also have to provide an argument list to :c:func:`PyObject_CallObject`. In " @@ -1118,7 +1189,7 @@ msgid "" "you want to pass an integral event code, you might use the following code::" msgstr "" -#: ../../extending/extending.rst:625 +#: ../../extending/extending.rst:650 msgid "" "PyObject *arglist;\n" "...\n" @@ -1131,7 +1202,7 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:635 +#: ../../extending/extending.rst:660 msgid "" "Note the placement of ``Py_DECREF(arglist)`` immediately after the call, " "before the error check! Also note that strictly speaking this code is not " @@ -1139,14 +1210,14 @@ msgid "" "checked." msgstr "" -#: ../../extending/extending.rst:639 +#: ../../extending/extending.rst:664 msgid "" "You may also call a function with keyword arguments by using :c:func:" "`PyObject_Call`, which supports arguments and keyword arguments. As in the " "above example, we use :c:func:`Py_BuildValue` to construct the dictionary. ::" msgstr "" -#: ../../extending/extending.rst:643 +#: ../../extending/extending.rst:668 msgid "" "PyObject *dict;\n" "...\n" @@ -1159,19 +1230,19 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:657 +#: ../../extending/extending.rst:682 msgid "Extracting Parameters in Extension Functions" msgstr "" -#: ../../extending/extending.rst:661 +#: ../../extending/extending.rst:686 msgid "The :c:func:`PyArg_ParseTuple` function is declared as follows::" msgstr "" -#: ../../extending/extending.rst:663 +#: ../../extending/extending.rst:688 msgid "int PyArg_ParseTuple(PyObject *arg, const char *format, ...);" msgstr "" -#: ../../extending/extending.rst:665 +#: ../../extending/extending.rst:690 msgid "" "The *arg* argument must be a tuple object containing an argument list passed " "from Python to a C function. The *format* argument must be a format string, " @@ -1180,7 +1251,7 @@ msgid "" "whose type is determined by the format string." msgstr "" -#: ../../extending/extending.rst:671 +#: ../../extending/extending.rst:696 msgid "" "Note that while :c:func:`PyArg_ParseTuple` checks that the Python arguments " "have the required types, it cannot check the validity of the addresses of C " @@ -1188,17 +1259,17 @@ msgid "" "probably crash or at least overwrite random bits in memory. So be careful!" msgstr "" -#: ../../extending/extending.rst:676 +#: ../../extending/extending.rst:701 msgid "" "Note that any Python object references which are provided to the caller are " "*borrowed* references; do not decrement their reference count!" msgstr "" -#: ../../extending/extending.rst:679 +#: ../../extending/extending.rst:704 msgid "Some example calls::" msgstr "一些呼叫範例: ::" -#: ../../extending/extending.rst:686 +#: ../../extending/extending.rst:711 msgid "" "int ok;\n" "int i, j;\n" @@ -1218,27 +1289,27 @@ msgstr "" "ok = PyArg_ParseTuple(args, \"\"); /* 沒有引數 */\n" " /* Python 呼叫:f() */" -#: ../../extending/extending.rst:697 +#: ../../extending/extending.rst:722 msgid "" "ok = PyArg_ParseTuple(args, \"s\", &s); /* A string */\n" " /* Possible Python call: f('whoops!') */" msgstr "" -#: ../../extending/extending.rst:702 +#: ../../extending/extending.rst:727 msgid "" "ok = PyArg_ParseTuple(args, \"lls\", &k, &l, &s); /* Two longs and a string " "*/\n" " /* Possible Python call: f(1, 2, 'three') */" msgstr "" -#: ../../extending/extending.rst:707 +#: ../../extending/extending.rst:732 msgid "" "ok = PyArg_ParseTuple(args, \"(ii)s#\", &i, &j, &s, &size);\n" " /* A pair of ints and a string, whose size is also returned */\n" " /* Possible Python call: f((1, 2), 'three') */" msgstr "" -#: ../../extending/extending.rst:713 +#: ../../extending/extending.rst:738 msgid "" "{\n" " const char *file;\n" @@ -1253,7 +1324,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:727 +#: ../../extending/extending.rst:752 msgid "" "{\n" " int left, top, right, bottom, h, v;\n" @@ -1265,7 +1336,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:738 +#: ../../extending/extending.rst:763 msgid "" "{\n" " Py_complex c;\n" @@ -1275,16 +1346,16 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:749 +#: ../../extending/extending.rst:774 msgid "Keyword Parameters for Extension Functions" msgstr "" -#: ../../extending/extending.rst:753 +#: ../../extending/extending.rst:778 msgid "" "The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::" msgstr "" -#: ../../extending/extending.rst:755 +#: ../../extending/extending.rst:780 msgid "" "int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" " const char *format, char * const " @@ -1294,7 +1365,7 @@ msgstr "" " const char *format, char * const " "*kwlist, ...);" -#: ../../extending/extending.rst:758 +#: ../../extending/extending.rst:783 msgid "" "The *arg* and *format* parameters are identical to those of the :c:func:" "`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of " @@ -1306,20 +1377,20 @@ msgid "" "raises an appropriate exception." msgstr "" -#: ../../extending/extending.rst:768 +#: ../../extending/extending.rst:793 msgid "" "Nested tuples cannot be parsed when using keyword arguments! Keyword " "parameters passed in which are not present in the *kwlist* will cause :exc:" "`TypeError` to be raised." msgstr "" -#: ../../extending/extending.rst:774 +#: ../../extending/extending.rst:799 msgid "" "Here is an example module which uses keywords, based on an example by Geoff " "Philbrick (philbrick@hks.com)::" msgstr "" -#: ../../extending/extending.rst:777 +#: ../../extending/extending.rst:802 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -1372,21 +1443,21 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:828 +#: ../../extending/extending.rst:853 msgid "Building Arbitrary Values" msgstr "" -#: ../../extending/extending.rst:830 +#: ../../extending/extending.rst:855 msgid "" "This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is " "declared as follows::" msgstr "" -#: ../../extending/extending.rst:833 +#: ../../extending/extending.rst:858 msgid "PyObject *Py_BuildValue(const char *format, ...);" msgstr "PyObject *Py_BuildValue(const char *format, ...);" -#: ../../extending/extending.rst:835 +#: ../../extending/extending.rst:860 msgid "" "It recognizes a set of format units similar to the ones recognized by :c:" "func:`PyArg_ParseTuple`, but the arguments (which are input to the function, " @@ -1394,7 +1465,7 @@ msgid "" "object, suitable for returning from a C function called from Python." msgstr "" -#: ../../extending/extending.rst:840 +#: ../../extending/extending.rst:865 msgid "" "One difference with :c:func:`PyArg_ParseTuple`: while the latter requires " "its first argument to be a tuple (since Python argument lists are always " @@ -1406,12 +1477,12 @@ msgid "" "parenthesize the format string." msgstr "" -#: ../../extending/extending.rst:848 +#: ../../extending/extending.rst:873 msgid "" "Examples (to the left the call, to the right the resulting Python value):" msgstr "" -#: ../../extending/extending.rst:850 +#: ../../extending/extending.rst:875 msgid "" "Py_BuildValue(\"\") None\n" "Py_BuildValue(\"i\", 123) 123\n" @@ -1449,11 +1520,11 @@ msgstr "" "Py_BuildValue(\"((ii)(ii)) (ii)\",\n" " 1, 2, 3, 4, 5, 6) (((1, 2), (3, 4)), (5, 6))" -#: ../../extending/extending.rst:874 +#: ../../extending/extending.rst:899 msgid "Reference Counts" msgstr "參照計數" -#: ../../extending/extending.rst:876 +#: ../../extending/extending.rst:901 msgid "" "In languages like C or C++, the programmer is responsible for dynamic " "allocation and deallocation of memory on the heap. In C, this is done using " @@ -1462,7 +1533,7 @@ msgid "" "restrict the following discussion to the C case." msgstr "" -#: ../../extending/extending.rst:882 +#: ../../extending/extending.rst:907 msgid "" "Every block of memory allocated with :c:func:`malloc` should eventually be " "returned to the pool of available memory by exactly one call to :c:func:" @@ -1477,7 +1548,7 @@ msgid "" "crashes." msgstr "" -#: ../../extending/extending.rst:893 +#: ../../extending/extending.rst:918 msgid "" "Common causes of memory leaks are unusual paths through the code. For " "instance, a function may allocate a block of memory, do some calculation, " @@ -1494,7 +1565,7 @@ msgid "" "of errors." msgstr "" -#: ../../extending/extending.rst:906 +#: ../../extending/extending.rst:931 msgid "" "Since Python makes heavy use of :c:func:`malloc` and :c:func:`free`, it " "needs a strategy to avoid memory leaks as well as the use of freed memory. " @@ -1505,7 +1576,7 @@ msgid "" "reference to the object has been deleted and the object is freed." msgstr "" -#: ../../extending/extending.rst:914 +#: ../../extending/extending.rst:939 msgid "" "An alternative strategy is called :dfn:`automatic garbage collection`. " "(Sometimes, reference counting is also referred to as a garbage collection " @@ -1521,7 +1592,7 @@ msgid "" "with reference counts." msgstr "" -#: ../../extending/extending.rst:926 +#: ../../extending/extending.rst:951 msgid "" "While Python uses the traditional reference counting implementation, it also " "offers a cycle detector that works to detect reference cycles. This allows " @@ -1535,7 +1606,7 @@ msgid "" "though there are no further references to the cycle itself." msgstr "" -#: ../../extending/extending.rst:937 +#: ../../extending/extending.rst:962 msgid "" "The cycle detector is able to detect garbage cycles and can reclaim them. " "The :mod:`gc` module exposes a way to run the detector (the :func:`~gc." @@ -1543,11 +1614,11 @@ msgid "" "disable the detector at runtime." msgstr "" -#: ../../extending/extending.rst:946 +#: ../../extending/extending.rst:971 msgid "Reference Counting in Python" msgstr "Python 中的參照計數" -#: ../../extending/extending.rst:948 +#: ../../extending/extending.rst:973 msgid "" "There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle " "the incrementing and decrementing of the reference count. :c:func:" @@ -1558,7 +1629,7 @@ msgid "" "object." msgstr "" -#: ../../extending/extending.rst:955 +#: ../../extending/extending.rst:980 msgid "" "The big question now remains: when to use ``Py_INCREF(x)`` and " "``Py_DECREF(x)``? Let's first introduce some terms. Nobody \"owns\" an " @@ -1571,7 +1642,7 @@ msgid "" "reference creates a memory leak." msgstr "" -#: ../../extending/extending.rst:964 +#: ../../extending/extending.rst:989 msgid "" "It is also possible to :dfn:`borrow` [#]_ a reference to an object. The " "borrower of a reference should not call :c:func:`Py_DECREF`. The borrower " @@ -1580,7 +1651,7 @@ msgid "" "risks using freed memory and should be avoided completely [#]_." msgstr "" -#: ../../extending/extending.rst:970 +#: ../../extending/extending.rst:995 msgid "" "The advantage of borrowing over owning a reference is that you don't need to " "take care of disposing of the reference on all possible paths through the " @@ -1591,7 +1662,7 @@ msgid "" "borrowed has in fact disposed of it." msgstr "" -#: ../../extending/extending.rst:978 +#: ../../extending/extending.rst:1003 msgid "" "A borrowed reference can be changed into an owned reference by calling :c:" "func:`Py_INCREF`. This does not affect the status of the owner from which " @@ -1600,18 +1671,18 @@ msgid "" "properly, as well as the previous owner)." msgstr "" -#: ../../extending/extending.rst:988 +#: ../../extending/extending.rst:1013 msgid "Ownership Rules" msgstr "" -#: ../../extending/extending.rst:990 +#: ../../extending/extending.rst:1015 msgid "" "Whenever an object reference is passed into or out of a function, it is part " "of the function's interface specification whether ownership is transferred " "with the reference or not." msgstr "" -#: ../../extending/extending.rst:994 +#: ../../extending/extending.rst:1019 msgid "" "Most functions that return a reference to an object pass on ownership with " "the reference. In particular, all functions whose function it is to create " @@ -1622,7 +1693,7 @@ msgid "" "reference to a cached item." msgstr "" -#: ../../extending/extending.rst:1002 +#: ../../extending/extending.rst:1027 msgid "" "Many functions that extract objects from other objects also transfer " "ownership with the reference, for instance :c:func:" @@ -1633,14 +1704,14 @@ msgid "" "list or dictionary." msgstr "" -#: ../../extending/extending.rst:1009 +#: ../../extending/extending.rst:1034 msgid "" "The function :c:func:`PyImport_AddModule` also returns a borrowed reference, " "even though it may actually create the object it returns: this is possible " "because an owned reference to the object is stored in ``sys.modules``." msgstr "" -#: ../../extending/extending.rst:1013 +#: ../../extending/extending.rst:1038 msgid "" "When you pass an object reference into another function, in general, the " "function borrows the reference from you --- if it needs to store it, it will " @@ -1651,7 +1722,7 @@ msgid "" "don't take over ownership --- they are \"normal.\")" msgstr "" -#: ../../extending/extending.rst:1021 +#: ../../extending/extending.rst:1046 msgid "" "When a C function is called from Python, it borrows references to its " "arguments from the caller. The caller owns a reference to the object, so " @@ -1660,18 +1731,18 @@ msgid "" "turned into an owned reference by calling :c:func:`Py_INCREF`." msgstr "" -#: ../../extending/extending.rst:1027 +#: ../../extending/extending.rst:1052 msgid "" "The object reference returned from a C function that is called from Python " "must be an owned reference --- ownership is transferred from the function to " "its caller." msgstr "" -#: ../../extending/extending.rst:1035 +#: ../../extending/extending.rst:1060 msgid "Thin Ice" msgstr "" -#: ../../extending/extending.rst:1037 +#: ../../extending/extending.rst:1062 msgid "" "There are a few situations where seemingly harmless use of a borrowed " "reference can lead to problems. These all have to do with implicit " @@ -1679,14 +1750,14 @@ msgid "" "dispose of it." msgstr "" -#: ../../extending/extending.rst:1041 +#: ../../extending/extending.rst:1066 msgid "" "The first and most important case to know about is using :c:func:`Py_DECREF` " "on an unrelated object while borrowing a reference to a list item. For " "instance::" msgstr "" -#: ../../extending/extending.rst:1044 +#: ../../extending/extending.rst:1069 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1706,14 +1777,14 @@ msgstr "" " PyObject_Print(item, stdout, 0); /* BUG! */\n" "}" -#: ../../extending/extending.rst:1053 +#: ../../extending/extending.rst:1078 msgid "" "This function first borrows a reference to ``list[0]``, then replaces " "``list[1]`` with the value ``0``, and finally prints the borrowed reference. " "Looks harmless, right? But it's not!" msgstr "" -#: ../../extending/extending.rst:1057 +#: ../../extending/extending.rst:1082 msgid "" "Let's follow the control flow into :c:func:`PyList_SetItem`. The list owns " "references to all its items, so when item 1 is replaced, it has to dispose " @@ -1730,7 +1801,7 @@ msgid "" "`PyList_SetItem` call." msgstr "" -#: ../../extending/extending.rst:1071 +#: ../../extending/extending.rst:1096 msgid "" "Since it is written in Python, the :meth:`!__del__` method can execute " "arbitrary Python code. Could it perhaps do something to invalidate the " @@ -1741,13 +1812,13 @@ msgid "" "associated with it, thereby invalidating ``item``." msgstr "" -#: ../../extending/extending.rst:1079 +#: ../../extending/extending.rst:1104 msgid "" "The solution, once you know the source of the problem, is easy: temporarily " "increment the reference count. The correct version of the function reads::" msgstr "" -#: ../../extending/extending.rst:1082 +#: ../../extending/extending.rst:1107 msgid "" "void\n" "no_bug(PyObject *list)\n" @@ -1771,14 +1842,14 @@ msgstr "" " Py_DECREF(item);\n" "}" -#: ../../extending/extending.rst:1093 +#: ../../extending/extending.rst:1118 msgid "" "This is a true story. An older version of Python contained variants of this " "bug and someone spent a considerable amount of time in a C debugger to " "figure out why his :meth:`!__del__` methods would fail..." msgstr "" -#: ../../extending/extending.rst:1097 +#: ../../extending/extending.rst:1122 msgid "" "The second case of problems with a borrowed reference is a variant involving " "threads. Normally, multiple threads in the Python interpreter can't get in " @@ -1791,7 +1862,7 @@ msgid "" "Obviously, the following function has the same problem as the previous one::" msgstr "" -#: ../../extending/extending.rst:1107 +#: ../../extending/extending.rst:1132 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1804,11 +1875,11 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1121 +#: ../../extending/extending.rst:1146 msgid "NULL Pointers" msgstr "NULL 指標" -#: ../../extending/extending.rst:1123 +#: ../../extending/extending.rst:1148 msgid "" "In general, functions that take object references as arguments do not expect " "you to pass them ``NULL`` pointers, and will dump core (or cause later core " @@ -1820,21 +1891,21 @@ msgid "" "more slowly." msgstr "" -#: ../../extending/extending.rst:1131 +#: ../../extending/extending.rst:1156 msgid "" "It is better to test for ``NULL`` only at the \"source:\" when a pointer " "that may be ``NULL`` is received, for example, from :c:func:`malloc` or from " "a function that may raise an exception." msgstr "" -#: ../../extending/extending.rst:1135 +#: ../../extending/extending.rst:1160 msgid "" "The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " "``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and :c:" "func:`Py_XDECREF` do." msgstr "" -#: ../../extending/extending.rst:1139 +#: ../../extending/extending.rst:1164 msgid "" "The macros for checking for a particular object type (``Pytype_Check()``) " "don't check for ``NULL`` pointers --- again, there is much code that calls " @@ -1843,24 +1914,24 @@ msgid "" "variants with ``NULL`` checking." msgstr "" -#: ../../extending/extending.rst:1145 +#: ../../extending/extending.rst:1170 msgid "" "The C function calling mechanism guarantees that the argument list passed to " "C functions (``args`` in the examples) is never ``NULL`` --- in fact it " "guarantees that it is always a tuple [#]_." msgstr "" -#: ../../extending/extending.rst:1149 +#: ../../extending/extending.rst:1174 msgid "" "It is a severe error to ever let a ``NULL`` pointer \"escape\" to the Python " "user." msgstr "" -#: ../../extending/extending.rst:1160 +#: ../../extending/extending.rst:1185 msgid "Writing Extensions in C++" msgstr "" -#: ../../extending/extending.rst:1162 +#: ../../extending/extending.rst:1187 msgid "" "It is possible to write extension modules in C++. Some restrictions apply. " "If the main program (the Python interpreter) is compiled and linked by the C " @@ -1873,11 +1944,11 @@ msgid "" "(all recent C++ compilers define this symbol)." msgstr "" -#: ../../extending/extending.rst:1176 +#: ../../extending/extending.rst:1201 msgid "Providing a C API for an Extension Module" msgstr "" -#: ../../extending/extending.rst:1181 +#: ../../extending/extending.rst:1206 msgid "" "Many extension modules just provide new functions and types to be used from " "Python, but sometimes the code in an extension module can be useful for " @@ -1888,7 +1959,7 @@ msgid "" "functions for direct manipulation from other extension modules." msgstr "" -#: ../../extending/extending.rst:1189 +#: ../../extending/extending.rst:1214 msgid "" "At first sight this seems easy: just write the functions (without declaring " "them ``static``, of course), provide an appropriate header file, and " @@ -1904,7 +1975,7 @@ msgid "" "call might not have been loaded yet!" msgstr "" -#: ../../extending/extending.rst:1201 +#: ../../extending/extending.rst:1226 msgid "" "Portability therefore requires not to make any assumptions about symbol " "visibility. This means that all symbols in extension modules should be " @@ -1914,7 +1985,7 @@ msgid "" "accessible from other extension modules must be exported in a different way." msgstr "" -#: ../../extending/extending.rst:1208 +#: ../../extending/extending.rst:1233 msgid "" "Python provides a special mechanism to pass C-level information (pointers) " "from one extension module to another one: Capsules. A Capsule is a Python " @@ -1926,7 +1997,7 @@ msgid "" "the Capsule." msgstr "" -#: ../../extending/extending.rst:1216 +#: ../../extending/extending.rst:1241 msgid "" "There are many ways in which Capsules can be used to export the C API of an " "extension module. Each function could get its own Capsule, or all C API " @@ -1936,7 +2007,7 @@ msgid "" "client modules." msgstr "" -#: ../../extending/extending.rst:1222 +#: ../../extending/extending.rst:1247 msgid "" "Whichever method you choose, it's important to name your Capsules properly. " "The function :c:func:`PyCapsule_New` takes a name parameter (:c:expr:`const " @@ -1946,17 +2017,17 @@ msgid "" "from another." msgstr "" -#: ../../extending/extending.rst:1229 +#: ../../extending/extending.rst:1254 msgid "" "In particular, Capsules used to expose C APIs should be given a name " "following this convention::" msgstr "" -#: ../../extending/extending.rst:1232 +#: ../../extending/extending.rst:1257 msgid "modulename.attributename" msgstr "modulename.attributename" -#: ../../extending/extending.rst:1234 +#: ../../extending/extending.rst:1259 msgid "" "The convenience function :c:func:`PyCapsule_Import` makes it easy to load a " "C API provided via a Capsule, but only if the Capsule's name matches this " @@ -1964,7 +2035,7 @@ msgid "" "the Capsule they load contains the correct C API." msgstr "" -#: ../../extending/extending.rst:1239 +#: ../../extending/extending.rst:1264 msgid "" "The following example demonstrates an approach that puts most of the burden " "on the writer of the exporting module, which is appropriate for commonly " @@ -1975,7 +2046,7 @@ msgid "" "modules only have to call this macro before accessing the C API." msgstr "" -#: ../../extending/extending.rst:1247 +#: ../../extending/extending.rst:1272 msgid "" "The exporting module is a modification of the :mod:`!spam` module from " "section :ref:`extending-simpleexample`. The function :func:`!spam.system` " @@ -1986,13 +2057,13 @@ msgid "" "modules." msgstr "" -#: ../../extending/extending.rst:1254 +#: ../../extending/extending.rst:1279 msgid "" "The function :c:func:`!PySpam_System` is a plain C function, declared " "``static`` like everything else::" msgstr "" -#: ../../extending/extending.rst:1257 +#: ../../extending/extending.rst:1282 msgid "" "static int\n" "PySpam_System(const char *command)\n" @@ -2006,11 +2077,11 @@ msgstr "" " return system(command);\n" "}" -#: ../../extending/extending.rst:1263 +#: ../../extending/extending.rst:1288 msgid "The function :c:func:`!spam_system` is modified in a trivial way::" msgstr "" -#: ../../extending/extending.rst:1265 +#: ../../extending/extending.rst:1290 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -2036,19 +2107,19 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:1277 +#: ../../extending/extending.rst:1302 msgid "In the beginning of the module, right after the line ::" msgstr "" -#: ../../extending/extending.rst:1279 +#: ../../extending/extending.rst:1304 msgid "#include " msgstr "#include " -#: ../../extending/extending.rst:1281 +#: ../../extending/extending.rst:1306 msgid "two more lines must be added::" msgstr "" -#: ../../extending/extending.rst:1283 +#: ../../extending/extending.rst:1308 msgid "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" @@ -2056,7 +2127,7 @@ msgstr "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" -#: ../../extending/extending.rst:1286 +#: ../../extending/extending.rst:1311 msgid "" "The ``#define`` is used to tell the header file that it is being included in " "the exporting module, not a client module. Finally, the module's :c:data:" @@ -2064,7 +2135,7 @@ msgid "" "pointer array::" msgstr "" -#: ../../extending/extending.rst:1290 +#: ../../extending/extending.rst:1315 msgid "" "static int\n" "spam_module_exec(PyObject *m)\n" @@ -2087,19 +2158,19 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1309 +#: ../../extending/extending.rst:1334 msgid "" "Note that ``PySpam_API`` is declared ``static``; otherwise the pointer array " "would disappear when :c:func:`!PyInit_spam` terminates!" msgstr "" -#: ../../extending/extending.rst:1312 +#: ../../extending/extending.rst:1337 msgid "" "The bulk of the work is in the header file :file:`spammodule.h`, which looks " "like this::" msgstr "" -#: ../../extending/extending.rst:1315 +#: ../../extending/extending.rst:1340 msgid "" "#ifndef Py_SPAMMODULE_H\n" "#define Py_SPAMMODULE_H\n" @@ -2151,14 +2222,14 @@ msgid "" "#endif /* !defined(Py_SPAMMODULE_H) */" msgstr "" -#: ../../extending/extending.rst:1363 +#: ../../extending/extending.rst:1388 msgid "" "All that a client module must do in order to have access to the function :c:" "func:`!PySpam_System` is to call the function (or rather macro) :c:func:`!" "import_spam` in its :c:data:`mod_exec ` function::" msgstr "" -#: ../../extending/extending.rst:1367 +#: ../../extending/extending.rst:1392 msgid "" "static int\n" "client_module_exec(PyObject *m)\n" @@ -2171,14 +2242,14 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1377 +#: ../../extending/extending.rst:1402 msgid "" "The main disadvantage of this approach is that the file :file:`spammodule.h` " "is rather complicated. However, the basic structure is the same for each " "function that is exported, so it has to be learned only once." msgstr "" -#: ../../extending/extending.rst:1381 +#: ../../extending/extending.rst:1406 msgid "" "Finally it should be mentioned that Capsules offer additional functionality, " "which is especially useful for memory allocation and deallocation of the " @@ -2188,89 +2259,47 @@ msgid "" "in the Python source code distribution)." msgstr "" -#: ../../extending/extending.rst:1389 +#: ../../extending/extending.rst:1414 msgid "Footnotes" msgstr "註腳" -#: ../../extending/extending.rst:1390 +#: ../../extending/extending.rst:1415 msgid "" "An interface for this function already exists in the standard module :mod:" "`os` --- it was chosen as a simple and straightforward example." msgstr "" -#: ../../extending/extending.rst:1393 +#: ../../extending/extending.rst:1418 msgid "" "The metaphor of \"borrowing\" a reference is not completely correct: the " "owner still has a copy of the reference." msgstr "" -#: ../../extending/extending.rst:1396 +#: ../../extending/extending.rst:1421 msgid "" "Checking that the reference count is at least 1 **does not work** --- the " "reference count itself could be in freed memory and may thus be reused for " "another object!" msgstr "" -#: ../../extending/extending.rst:1400 +#: ../../extending/extending.rst:1425 msgid "" "These guarantees don't hold when you use the \"old\" style calling " "convention --- this is still found in much existing code." msgstr "" -#: ../../extending/extending.rst:568 +#: ../../extending/extending.rst:593 msgid "PyObject_CallObject (C function)" msgstr "PyObject_CallObject(C 函式)" -#: ../../extending/extending.rst:659 +#: ../../extending/extending.rst:684 msgid "PyArg_ParseTuple (C function)" msgstr "PyArg_ParseTuple(C 函式)" -#: ../../extending/extending.rst:751 +#: ../../extending/extending.rst:776 msgid "PyArg_ParseTupleAndKeywords (C function)" msgstr "PyArg_ParseTupleAndKeywords(C 函式)" -#: ../../extending/extending.rst:772 +#: ../../extending/extending.rst:797 msgid "Philbrick, Geoff" msgstr "Philbrick, Geoff" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "```` (on Windows)" -#~ msgstr "````\\ (在 Windows 上)" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "```` (if present)" -#~ msgstr "````\\ (如果存在)" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "```` (on POSIX)" -#~ msgstr "````\\ (在 POSIX 上)" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" - -#~ msgid "````" -#~ msgstr "````" diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index 73dfa0052db..f9af9cb62f0 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -271,6 +271,10 @@ msgid "" " File \"\", line 1, in \n" "TypeError: can only concatenate str (not \"custom.Custom\") to str" msgstr "" +">>> \"\" + custom.Custom()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: can only concatenate str (not \"custom.Custom\") to str" #: ../../extending/newtypes_tutorial.rst:131 msgid "" diff --git a/faq/general.po b/faq/general.po index 16c2897ed61..b5ec25461db 100644 --- a/faq/general.po +++ b/faq/general.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-22 00:14+0000\n" "PO-Revision-Date: 2023-06-23 16:56+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -83,14 +83,14 @@ msgid "" msgstr "" "Python 軟體基金會 (Python Software Foundation) 是一個獨立的非營利性組織,它擁" "有 Python 2.1 版與之後各版本的版權。PSF 的使命在於推展 Python 程式設計語言相" -"關的開放原始碼技術,以及宣傳 Python 的使用。PSF 首頁的網址是 https://" -"www.python.org/psf/。" +"關的開放原始碼技術,以及宣傳 Python 的使用。PSF 首頁的網址是 https://www." +"python.org/psf/。" #: ../../faq/general.rst:42 msgid "" "Donations to the PSF are tax-exempt in the US. If you use Python and find " -"it helpful, please contribute via `the PSF donation page `_." +"it helpful, please contribute via `the PSF donation page `_." msgstr "" "在美國捐款給 PSF 是免稅的。如果你使用了 Python 且發現它很有用,請至 `PSF 捐款" "頁面 `_\\ 為它做出貢獻。" @@ -334,9 +334,8 @@ msgid "" msgstr "" "請參閱\\ `開發人員指南 `__\\ 以獲得更多關於開發週期的資訊,並參閱 :pep:`387` 以瞭" -"解更多關於 Python 的向後相容性政策。另外,也請查" -"看 :data:`sys.version`、:data:`sys.hexversion` 和 :data:`sys.version_info` 的" -"說明文件。" +"解更多關於 Python 的向後相容性政策。另外,也請查看 :data:`sys.version`、:" +"data:`sys.hexversion` 和 :data:`sys.version_info` 的說明文件。" #: ../../faq/general.rst:169 msgid "How do I obtain a copy of the Python source?" @@ -348,9 +347,9 @@ msgid "" "at https://www.python.org/downloads/. The latest development sources can be " "obtained at https://github.com/python/cpython/." msgstr "" -"最新的 Python 原始碼發行版永遠可以從 python.org 取得,在 https://" -"www.python.org/downloads/。最新的開發中原始碼可以在 https://github.com/" -"python/cpython/ 取得。" +"最新的 Python 原始碼發行版永遠可以從 python.org 取得,在 https://www.python." +"org/downloads/。最新的開發中原始碼可以在 https://github.com/python/cpython/ " +"取得。" #: ../../faq/general.rst:175 msgid "" @@ -379,10 +378,10 @@ msgstr "我要如何取得 Python 的說明文件?" #: ../../faq/general.rst:188 msgid "" "The standard documentation for the current stable version of Python is " -"available at https://docs.python.org/3/. PDF, plain text, and downloadable " +"available at https://docs.python.org/3/. EPUB, plain text, and downloadable " "HTML versions are also available at https://docs.python.org/3/download.html." msgstr "" -"Python 目前穩定版本的標準說明文件可在 https://docs.python.org/3/ 找到。PDF、" +"Python 目前穩定版本的標準說明文件可在 https://docs.python.org/3/ 找到。EPUB、" "純文字和可下載的 HTML 版本也可在 https://docs.python.org/3/download.html 找" "到。" @@ -425,10 +424,9 @@ msgid "" "There is a newsgroup, :newsgroup:`comp.lang.python`, and a mailing list, " "`python-list `_. The " "newsgroup and mailing list are gatewayed into each other -- if you can read " -"news it's unnecessary to subscribe to the mailing " -"list. :newsgroup:`comp.lang.python` is high-traffic, receiving hundreds of " -"postings every day, and Usenet readers are often more able to cope with this " -"volume." +"news it's unnecessary to subscribe to the mailing list. :newsgroup:`comp." +"lang.python` is high-traffic, receiving hundreds of postings every day, and " +"Usenet readers are often more able to cope with this volume." msgstr "" "有一個新聞群組 (newsgroup),:newsgroup:`comp.lang.python`,也有一個郵件討論" "群 (mailing list),`python-list `_." msgstr "" "新的軟體發布版本及事件的通知,可以在 comp.lang.python.announce 中找到,這是一" @@ -463,9 +461,9 @@ msgstr "如何取得 Python 的 beta 測試版本?" #: ../../faq/general.rst:229 msgid "" "Alpha and beta releases are available from https://www.python.org/" -"downloads/. All releases are announced on the comp.lang.python and " -"comp.lang.python.announce newsgroups and on the Python home page at https://" -"www.python.org/; an RSS feed of news is available." +"downloads/. All releases are announced on the comp.lang.python and comp." +"lang.python.announce newsgroups and on the Python home page at https://www." +"python.org/; an RSS feed of news is available." msgstr "" "Alpha 和 beta 發布版本可以從 https://www.python.org/downloads/ 取得。所有的發" "布版本都會在 comp.lang.python 和 comp.lang.python.announce 新聞群組上宣布,也" @@ -485,8 +483,8 @@ msgstr "如何提交 Python 的錯誤報告和修補程式?" #: ../../faq/general.rst:241 msgid "" -"To report a bug or submit a patch, use the issue tracker at https://" -"github.com/python/cpython/issues." +"To report a bug or submit a patch, use the issue tracker at https://github." +"com/python/cpython/issues." msgstr "" "要回報一個錯誤 (bug) 或提交一個修補程式 (patch),請使用於 https://github.com/" "python/cpython/issues 的問題追蹤系統。" @@ -552,8 +550,8 @@ msgstr "www.python.org 的真實位置在哪裡?" #: ../../faq/general.rst:274 msgid "" "The Python project's infrastructure is located all over the world and is " -"managed by the Python Infrastructure Team. Details `here `__." +"managed by the Python Infrastructure Team. Details `here `__." msgstr "" "Python 專案的基礎建設遍佈世界各地,由 Python 基礎建設團隊管理。詳細資訊\\ `在" "此 `__。" @@ -565,8 +563,8 @@ msgstr "為什麼要取名為 Python?" #: ../../faq/general.rst:281 msgid "" "When he began implementing Python, Guido van Rossum was also reading the " -"published scripts from `\"Monty Python's Flying Circus\" `__, a BBC comedy series from the 1970s. " +"published scripts from `\"Monty Python's Flying Circus\" `__, a BBC comedy series from the 1970s. " "Van Rossum thought he needed a name that was short, unique, and slightly " "mysterious, so he decided to call the language Python." msgstr "" @@ -660,8 +658,8 @@ msgstr "有沒有任何重要的專案使用 Python 完成開發?" #: ../../faq/general.rst:333 msgid "" "See https://www.python.org/about/success for a list of projects that use " -"Python. Consulting the proceedings for `past Python conferences `_ will reveal contributions from many " +"Python. Consulting the proceedings for `past Python conferences `_ will reveal contributions from many " "different companies and organizations." msgstr "" "要查看使用 Python 的專案清單,請參閱 https://www.python.org/about/success。藉" @@ -671,17 +669,17 @@ msgstr "" #: ../../faq/general.rst:338 msgid "" "High-profile Python projects include `the Mailman mailing list manager " -"`_ and `the Zope application server `_. Several Linux distributions, most notably `Red Hat " -"`_, have written part or all of their installer and " -"system administration software in Python. Companies that use Python " -"internally include Google, Yahoo, and Lucasfilm Ltd." -msgstr "" -"備受矚目的 Python 專案包括 `Mailman 郵件討論群管理員 `_\\ 和 `Zope 應用程式伺服器 `_。有一些 " -"Linux 發行版,最著名的是 `Red Hat `_,已經用 Python " -"編寫了部分或全部的安裝程式及系統管理軟體。內部使用 Python 的公司包括 Google、" -"Yahoo 和 Lucasfilm Ltd。" +"`_ and `the Zope application server `_. Several Linux distributions, most notably `Red Hat `_, have written part or all of their installer and system " +"administration software in Python. Companies that use Python internally " +"include Google, Yahoo, and Lucasfilm Ltd." +msgstr "" +"備受矚目的 Python 專案包括 `Mailman 郵件討論群管理員 `_\\ 和 `Zope 應用程式伺服器 `_。有一些 Linux 發行" +"版,最著名的是 `Red Hat `_,已經用 Python 編寫了部分" +"或全部的安裝程式及系統管理軟體。內部使用 Python 的公司包括 Google、Yahoo 和 " +"Lucasfilm Ltd。" #: ../../faq/general.rst:347 msgid "What new developments are expected for Python in the future?" @@ -702,8 +700,8 @@ msgstr "" #: ../../faq/general.rst:355 msgid "" -"New development is discussed on `the python-dev mailing list `_." +"New development is discussed on `the python-dev mailing list `_." msgstr "" "新的開發會在 `python-dev 郵件討論群 `_\\ 中討論。" diff --git a/faq/programming.po b/faq/programming.po index 3eb7dcd192a..22e2872cb9e 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -2796,7 +2796,6 @@ msgid "" msgstr "產生錯誤的是操作的賦值部分,因為元組是不可變的。" #: ../../faq/programming.rst:1382 -#, fuzzy msgid "When you write something like::" msgstr "當你寫這樣的東西時: ::" @@ -2808,6 +2807,11 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> a_tuple = (['foo'], 'bar')\n" +">>> a_tuple[0] += ['item']\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" #: ../../faq/programming.rst:1390 #, fuzzy diff --git a/howto/a-conceptual-overview-of-asyncio.po b/howto/a-conceptual-overview-of-asyncio.po index d816f8941e8..9fdca88cc00 100644 --- a/howto/a-conceptual-overview-of-asyncio.po +++ b/howto/a-conceptual-overview-of-asyncio.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-10 00:19+0000\n" +"POT-Creation-Date: 2025-10-15 00:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -29,63 +29,63 @@ msgstr "" #: ../../howto/a-conceptual-overview-of-asyncio.rst:11 msgid "" -"You might be curious about some key :mod:`!asyncio` concepts. You'll be " -"comfortably able to answer these questions by the end of this article:" +"You might be curious about some key :mod:`!asyncio` concepts. By the end of " +"this article, you'll be able to comfortably answer these questions:" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:15 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:14 msgid "What's happening behind the scenes when an object is awaited?" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:16 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:15 msgid "" -"How does :mod:`!asyncio` differentiate between a task which doesn't need CPU-" +"How does :mod:`!asyncio` differentiate between a task which doesn't need CPU " "time (such as a network request or file read) as opposed to a task that does " "(such as computing n-factorial)?" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:19 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:18 msgid "" "How to write an asynchronous variant of an operation, such as an async sleep " "or database request." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:24 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:23 msgid "" "The `guide `_ that inspired this HOWTO article, by Alexander Nordin." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:26 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:25 msgid "" "This in-depth `YouTube tutorial series `_ on ``asyncio`` " "created by Python core team member, Łukasz Langa." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:29 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:28 msgid "" "`500 Lines or Less: A Web Crawler With asyncio Coroutines `_ by A. Jesse Jiryu " "Davis and Guido van Rossum." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:35 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:34 msgid "A conceptual overview part 1: the high-level" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:37 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:36 msgid "" "In part 1, we'll cover the main, high-level building blocks of :mod:`!" -"asyncio`: the event loop, coroutine functions, coroutine objects, tasks and " +"asyncio`: the event loop, coroutine functions, coroutine objects, tasks, and " "``await``." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:42 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:41 msgid "Event Loop" msgstr "事件迴圈" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:44 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:43 msgid "" "Everything in :mod:`!asyncio` happens relative to the event loop. It's the " "star of the show. It's like an orchestra conductor. It's behind the scenes " @@ -94,7 +94,7 @@ msgid "" "worker bees." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:51 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:50 msgid "" "In more technical terms, the event loop contains a collection of jobs to be " "run. Some jobs are added directly by you, and some indirectly by :mod:`!" @@ -104,20 +104,20 @@ msgid "" "event loop will then select another job from its pool and invoke it. You can " "*roughly* think of the collection of jobs as a queue: jobs are added and " "then processed one at a time, generally (but not always) in order. This " -"process repeats indefinitely with the event loop cycling endlessly onwards. " +"process repeats indefinitely, with the event loop cycling endlessly onwards. " "If there are no more jobs pending execution, the event loop is smart enough " "to rest and avoid needlessly wasting CPU cycles, and will come back when " "there's more work to be done." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:65 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:64 msgid "" "Effective execution relies on jobs sharing well and cooperating; a greedy " "job could hog control and leave the other jobs to starve, rendering the " "overall event loop approach rather useless." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:71 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:70 msgid "" "import asyncio\n" "\n" @@ -127,15 +127,15 @@ msgid "" "event_loop.run_forever()" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:80 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:79 msgid "Asynchronous functions and coroutines" msgstr "非同步函式與協程" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:82 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:81 msgid "This is a basic, boring Python function::" msgstr "這是一個基本的、無聊的 Python 函式:" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:84 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:83 msgid "" "def hello_printer():\n" " print(\n" @@ -151,11 +151,11 @@ msgstr "" " \"partner in crime.\"\n" " )" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:91 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:90 msgid "Calling a regular function invokes its logic or body::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:93 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:92 msgid "" ">>> hello_printer()\n" "Hi, I am a lowly, simple printer, though I have all I need in life --\n" @@ -165,14 +165,14 @@ msgstr "" "Hi, I am a lowly, simple printer, though I have all I need in life --\n" "fresh paper and my dearly beloved octopus partner in crime." -#: ../../howto/a-conceptual-overview-of-asyncio.rst:97 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:96 msgid "" "The :ref:`async def `, as opposed to just a plain ``def``, makes " "this an asynchronous function (or \"coroutine function\"). Calling it " "creates and returns a :ref:`coroutine ` object." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:103 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:102 msgid "" "async def loudmouth_penguin(magic_number: int):\n" " print(\n" @@ -188,13 +188,13 @@ msgstr "" " f\"By the way, my lucky number is: {magic_number}.\"\n" " )" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:109 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:108 msgid "" "Calling the async function, ``loudmouth_penguin``, does not execute the " "print statement; instead, it creates a coroutine object::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:112 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:111 msgid "" ">>> loudmouth_penguin(magic_number=3)\n" "" @@ -202,7 +202,7 @@ msgstr "" ">>> loudmouth_penguin(magic_number=3)\n" "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:115 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:114 msgid "" "The terms \"coroutine function\" and \"coroutine object\" are often " "conflated as coroutine. That can be confusing! In this article, coroutine " @@ -212,7 +212,7 @@ msgid "" "distinction that matters for type checking." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:124 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:123 msgid "" "A coroutine represents the function's body or logic. A coroutine has to be " "explicitly started; again, merely creating the coroutine does not start it. " @@ -221,7 +221,7 @@ msgid "" "asynchronous behavior!" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:131 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:130 msgid "" "Coroutines and coroutine functions were built by leveraging the " "functionality of :term:`generators ` and :term:" @@ -229,7 +229,7 @@ msgid "" "function that :keyword:`yield`\\s, like this one::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:137 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:136 msgid "" "def get_random_number():\n" " # This would be a bad random number generator!\n" @@ -251,13 +251,13 @@ msgstr "" " yield 4\n" " ..." -#: ../../howto/a-conceptual-overview-of-asyncio.rst:147 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:146 msgid "" "Similar to a coroutine function, calling a generator function does not run " "it. Instead, it creates a generator object::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:150 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:149 msgid "" ">>> get_random_number()\n" "" @@ -265,14 +265,14 @@ msgstr "" ">>> get_random_number()\n" "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:153 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:152 msgid "" "You can proceed to the next ``yield`` of a generator by using the built-in " "function :func:`next`. In other words, the generator runs, then pauses. For " "example::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:158 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:157 msgid "" ">>> generator = get_random_number()\n" ">>> next(generator)\n" @@ -290,11 +290,11 @@ msgstr "" "Hello\n" "7" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:168 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:167 msgid "Tasks" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:170 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:169 msgid "" "Roughly speaking, :ref:`tasks ` are coroutines (not " "coroutine functions) tied to an event loop. A task also maintains a list of " @@ -303,21 +303,21 @@ msgid "" "`asyncio.create_task`." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:176 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:175 msgid "" "Creating a task automatically schedules it for execution (by adding a " "callback to run it in the event loop's to-do list, that is, collection of " "jobs)." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:179 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:178 msgid "" "Since there's only one event loop (in each thread), :mod:`!asyncio` takes " "care of associating the task with the event loop for you. As such, there's " "no need to specify the event loop." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:185 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:184 msgid "" "coroutine = loudmouth_penguin(magic_number=5)\n" "# This creates a Task object and schedules its execution via the event " @@ -325,7 +325,7 @@ msgid "" "task = asyncio.create_task(coroutine)" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:189 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:188 msgid "" "Earlier, we manually created the event loop and set it to run forever. In " "practice, it's recommended to use (and common to see) :func:`asyncio.run`, " @@ -334,7 +334,7 @@ msgid "" "this setup::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:195 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:194 msgid "" "import asyncio\n" "\n" @@ -349,7 +349,7 @@ msgid "" " print(\"coroutine main() is done!\")" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:207 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:206 msgid "" "It's important to be aware that the task itself is not added to the event " "loop, only a callback to the task is. This matters if the task object you " @@ -357,7 +357,7 @@ msgid "" "example, consider this program:" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:213 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:212 msgid "" "async def hello():\n" " print(\"hello!\")\n" @@ -371,7 +371,7 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:227 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:226 msgid "" "Because there's no reference to the task object created on line 5, it " "*might* be garbage collected before the event loop invokes it. Later " @@ -385,17 +385,17 @@ msgid "" "doesn't happen. But that's no reason to be reckless!" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:243 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:242 msgid "await" msgstr "await" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:245 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:244 msgid "" ":keyword:`await` is a Python keyword that's commonly used in one of two " "different ways::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:248 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:247 msgid "" "await task\n" "await coroutine" @@ -403,20 +403,20 @@ msgstr "" "await task\n" "await coroutine" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:251 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:250 msgid "" "In a crucial way, the behavior of ``await`` depends on the type of object " "being awaited." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:254 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:253 msgid "" "Awaiting a task will cede control from the current task or coroutine to the " "event loop. In the process of relinquishing control, a few important things " "happen. We'll use the following code example to illustrate::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:259 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:258 msgid "" "async def plant_a_tree():\n" " dig_the_hole_task = asyncio.create_task(dig_the_hole())\n" @@ -426,7 +426,7 @@ msgid "" " ..." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:266 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:265 msgid "" "In this example, imagine the event loop has passed control to the start of " "the coroutine ``plant_a_tree()``. As seen above, the coroutine creates a " @@ -439,21 +439,21 @@ msgid "" "this case, a call to resume ``plant_a_tree()``." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:277 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:276 msgid "" "Generally speaking, when the awaited task finishes (``dig_the_hole_task``), " "the original task or coroutine (``plant_a_tree()``) is added back to the " -"event loops to-do list to be resumed." +"event loop's to-do list to be resumed." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:281 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:280 msgid "" "This is a basic, yet reliable mental model. In practice, the control " "handoffs are slightly more complex, but not by much. In part 2, we'll walk " "through the details that make this possible." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:285 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:284 msgid "" "**Unlike tasks, awaiting a coroutine does not hand control back to the event " "loop!** Wrapping a coroutine in a task first, then awaiting that would cede " @@ -461,7 +461,7 @@ msgid "" "invoking a regular, synchronous Python function. Consider this program::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:293 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:292 msgid "" "import asyncio\n" "\n" @@ -497,16 +497,16 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:310 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:309 msgid "" "The first statement in the coroutine ``main()`` creates ``task_b`` and " "schedules it for execution via the event loop. Then, ``coro_a()`` is " -"repeatedly awaited. Control never cedes to the event loop which is why we " +"repeatedly awaited. Control never cedes to the event loop, which is why we " "see the output of all three ``coro_a()`` invocations before ``coro_b()``'s " "output:" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:316 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:315 msgid "" "I am coro_a(). Hi!\n" "I am coro_a(). Hi!\n" @@ -518,7 +518,7 @@ msgstr "" "I am coro_a(). Hi!\n" "I am coro_b(). I sure hope no one hogs the event loop..." -#: ../../howto/a-conceptual-overview-of-asyncio.rst:323 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:322 msgid "" "If we change ``await coro_a()`` to ``await asyncio.create_task(coro_a())``, " "the behavior changes. The coroutine ``main()`` cedes control to the event " @@ -527,7 +527,7 @@ msgid "" "before resuming the coroutine ``main()``." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:330 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:329 msgid "" "I am coro_b(). I sure hope no one hogs the event loop...\n" "I am coro_a(). Hi!\n" @@ -539,31 +539,31 @@ msgstr "" "I am coro_a(). Hi!\n" "I am coro_a(). Hi!" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:337 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:336 msgid "" "This behavior of ``await coroutine`` can trip a lot of people up! That " "example highlights how using only ``await coroutine`` could unintentionally " "hog control from other tasks and effectively stall the event loop. :func:" -"`asyncio.run` can help you detect such occurences via the ``debug=True`` " -"flag which accordingly enables :ref:`debug mode `. Among " -"other things, it will log any coroutines that monopolize execution for 100ms " -"or longer." +"`asyncio.run` can help you detect such occurrences via the ``debug=True`` " +"flag, which enables :ref:`debug mode `. Among other " +"things, it will log any coroutines that monopolize execution for 100ms or " +"longer." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:347 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:346 msgid "" "The design intentionally trades off some conceptual clarity around usage of " "``await`` for improved performance. Each time a task is awaited, control " "needs to be passed all the way up the call stack to the event loop. That " -"might sound minor, but in a large program with many ``await``'s and a deep " -"callstack that overhead can add up to a meaningful performance drag." +"might sound minor, but in a large program with many ``await`` statements and " +"a deep call stack, that overhead can add up to a meaningful performance drag." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:356 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:355 msgid "A conceptual overview part 2: the nuts and bolts" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:358 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:357 msgid "" "Part 2 goes into detail on the mechanisms :mod:`!asyncio` uses to manage " "control flow. This is where the magic happens. You'll come away from this " @@ -571,24 +571,24 @@ msgid "" "own asynchronous operators." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:366 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:365 msgid "The inner workings of coroutines" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:368 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:367 msgid ":mod:`!asyncio` leverages four components to pass around control." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:370 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:369 msgid "" ":meth:`coroutine.send(arg) ` is the method used to start or " "resume a coroutine. If the coroutine was paused and is now being resumed, " "the argument ``arg`` will be sent in as the return value of the ``yield`` " "statement which originally paused it. If the coroutine is being used for the " -"first time (as opposed to being resumed) ``arg`` must be ``None``." +"first time (as opposed to being resumed), ``arg`` must be ``None``." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:378 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:377 msgid "" "class Rock:\n" " def __await__(self):\n" @@ -642,18 +642,18 @@ msgstr "" " returned_value = e.value\n" "print(f\"Coroutine main() finished and provided value: {returned_value}.\")" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:406 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:405 msgid "" -":ref:`yield `, like usual, pauses execution and returns control " -"to the caller. In the example above, the ``yield``, on line 3, is called by " +":ref:`yield `, as usual, pauses execution and returns control to " +"the caller. In the example above, the ``yield``, on line 3, is called by " "``... = await rock`` on line 11. More broadly speaking, ``await`` calls the :" "meth:`~object.__await__` method of the given object. ``await`` also does one " "more very special thing: it propagates (or \"passes along\") any ``yield``\\ " -"s it receives up the call-chain. In this case, that's back to ``... = " +"s it receives up the call chain. In this case, that's back to ``... = " "coroutine.send(None)`` on line 16." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:416 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:415 msgid "" "The coroutine is resumed via the ``coroutine.send(42)`` call on line 21. The " "coroutine picks back up from where it ``yield``\\ ed (or paused) on line 3 " @@ -662,11 +662,11 @@ msgid "" "attached in the :attr:`~StopIteration.value` attribute." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:422 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:421 msgid "That snippet produces this output:" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:424 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:423 msgid "" "Beginning coroutine main().\n" "Awaiting rock...\n" @@ -684,28 +684,28 @@ msgstr "" "Coroutine received value: 42 from rock.\n" "Coroutine main() finished and provided value: 23." -#: ../../howto/a-conceptual-overview-of-asyncio.rst:434 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:433 msgid "" "It's worth pausing for a moment here and making sure you followed the " "various ways that control flow and values were passed. A lot of important " "ideas were covered and it's worth ensuring your understanding is firm." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:438 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:437 msgid "" "The only way to yield (or effectively cede control) from a coroutine is to " "``await`` an object that ``yield``\\ s in its ``__await__`` method. That " "might sound odd to you. You might be thinking:" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:442 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:441 msgid "" "1. What about a ``yield`` directly within the coroutine function? The " "coroutine function becomes an :ref:`async generator function `, a different beast entirely." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:447 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:446 msgid "" "2. What about a :ref:`yield from ` within the coroutine function " "to a (plain) generator? That causes the error: ``SyntaxError: yield from not " @@ -716,11 +716,11 @@ msgid "" "same thing." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:458 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:457 msgid "Futures" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:460 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:459 msgid "" "A :ref:`future ` is an object meant to represent a " "computation's status and result. The term is a nod to the idea of something " @@ -728,17 +728,17 @@ msgid "" "that something." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:465 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:464 msgid "" -"A future has a few important attributes. One is its state which can be " -"either \"pending\", \"cancelled\" or \"done\". Another is its result, which " +"A future has a few important attributes. One is its state, which can be " +"either \"pending\", \"cancelled\", or \"done\". Another is its result, which " "is set when the state transitions to done. Unlike a coroutine, a future does " "not represent the actual computation to be done; instead, it represents the " "status and result of that computation, kind of like a status light (red, " -"yellow or green) or indicator." +"yellow, or green) or indicator." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:472 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:471 msgid "" ":class:`asyncio.Task` subclasses :class:`asyncio.Future` in order to gain " "these various capabilities. The prior section said tasks store a list of " @@ -746,7 +746,7 @@ msgid "" "class that implements this logic, which ``Task`` inherits." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:479 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:478 msgid "" "Futures may also be used directly (not via tasks). Tasks mark themselves as " "done when their coroutine is complete. Futures are much more versatile and " @@ -754,26 +754,26 @@ msgid "" "interface for you to make your own conditions for waiting and resuming." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:487 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:486 msgid "A homemade asyncio.sleep" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:489 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:488 msgid "" "We'll go through an example of how you could leverage a future to create " "your own variant of asynchronous sleep (``async_sleep``) which mimics :func:" "`asyncio.sleep`." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:493 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:492 msgid "" -"This snippet registers a few tasks with the event loop and then awaits a " -"coroutine wrapped in a task: ``async_sleep(3)``. We want that task to finish " -"only after three seconds have elapsed, but without preventing other tasks " -"from running." +"This snippet registers a few tasks with the event loop and then awaits the " +"task created by ``asyncio.create_task``, which wraps the ``async_sleep(3)`` " +"coroutine. We want that task to finish only after three seconds have " +"elapsed, but without preventing other tasks from running." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:500 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:499 msgid "" "async def other_work():\n" " print(\"I like work. Work work.\")\n" @@ -799,7 +799,7 @@ msgid "" " await asyncio.gather(*work_tasks)" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:524 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:523 msgid "" "Below, we use a future to enable custom control over when that task will be " "marked as done. If :meth:`future.set_result() ` " @@ -809,7 +809,7 @@ msgid "" "elapsed and, accordingly, call ``future.set_result()``." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:535 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:534 msgid "" "async def async_sleep(seconds: float):\n" " future = asyncio.Future()\n" @@ -821,31 +821,31 @@ msgid "" " await future" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:543 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:542 msgid "" -"Below, we'll use a rather bare object, ``YieldToEventLoop()``, to ``yield`` " -"from ``__await__`` in order to cede control to the event loop. This is " +"Below, we use a rather bare ``YieldToEventLoop()`` object to ``yield`` from " +"its ``__await__`` method, ceding control to the event loop. This is " "effectively the same as calling ``asyncio.sleep(0)``, but this approach " "offers more clarity, not to mention it's somewhat cheating to use ``asyncio." "sleep`` when showcasing how to implement it!" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:549 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:548 msgid "" "As usual, the event loop cycles through its tasks, giving them control and " "receiving control back when they pause or finish. The ``watcher_task``, " "which runs the coroutine ``_sleep_watcher(...)``, will be invoked once per " "full cycle of the event loop. On each resumption, it'll check the time and " "if not enough has elapsed, then it'll pause once again and hand control back " -"to the event loop. Eventually, enough time will have elapsed, and " -"``_sleep_watcher(...)`` will mark the future as done, and then itself finish " -"too by breaking out of the infinite ``while`` loop. Given this helper task " -"is only invoked once per cycle of the event loop, you'd be correct to note " -"that this asynchronous sleep will sleep *at least* three seconds, rather " -"than exactly three seconds. Note this is also of true of ``asyncio.sleep``." +"to the event loop. Once enough time has elapsed, ``_sleep_watcher(...)`` " +"marks the future as done and completes by exiting its infinite ``while`` " +"loop. Given this helper task is only invoked once per cycle of the event " +"loop, you'd be correct to note that this asynchronous sleep will sleep *at " +"least* three seconds, rather than exactly three seconds. Note this is also " +"true of ``asyncio.sleep``." msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:565 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:564 msgid "" "class YieldToEventLoop:\n" " def __await__(self):\n" @@ -861,11 +861,11 @@ msgid "" " await YieldToEventLoop()" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:578 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:577 msgid "Here is the full program's output:" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:580 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:579 msgid "" "$ python custom-async-sleep.py\n" "Beginning asynchronous sleep at time: 14:52:22.\n" @@ -881,7 +881,7 @@ msgstr "" "I like work. Work work.\n" "Done asynchronous sleep at time: 14:52:25." -#: ../../howto/a-conceptual-overview-of-asyncio.rst:589 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:588 msgid "" "You might feel this implementation of asynchronous sleep was unnecessarily " "convoluted. And, well, it was. The example was meant to showcase the " @@ -890,7 +890,7 @@ msgid "" "so::" msgstr "" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:596 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:595 msgid "" "async def simpler_async_sleep(seconds):\n" " time_to_wake = time.time() + seconds\n" @@ -908,9 +908,9 @@ msgstr "" " else:\n" " await YieldToEventLoop()" -#: ../../howto/a-conceptual-overview-of-asyncio.rst:604 +#: ../../howto/a-conceptual-overview-of-asyncio.rst:603 msgid "" -"But, that's all for now. Hopefully you're ready to more confidently dive " -"into some async programming or check out advanced topics in the :mod:`rest " -"of the documentation `." +"But that's all for now. Hopefully you're ready to more confidently dive into " +"some async programming or check out advanced topics in the :mod:`rest of the " +"documentation `." msgstr "" diff --git a/howto/enum.po b/howto/enum.po index 36d792394fa..cbddd1538c2 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -1018,6 +1018,15 @@ msgid "" ">>> Color.RED == Color.BLUE # problem is here: they should not be equal\n" "True" msgstr "" +">>> @dataclass # 不要這樣做,這並不合理\n" +"... class Color(Enum):\n" +"... RED = 1\n" +"... BLUE = 2\n" +"...\n" +">>> Color.RED is Color.BLUE\n" +"False\n" +">>> Color.RED == Color.BLUE # 問題在此:它們不應該相等\n" +"True" #: ../../howto/enum.rst:529 msgid "Pickling" @@ -2146,6 +2155,16 @@ msgid "" ">>> (Perm.R & Perm.W).name is None # effectively Perm(0)\n" "True" msgstr "" +">>> (Color.RED | Color.GREEN).name\n" +"'RED|GREEN'\n" +"\n" +">>> class Perm(IntFlag):\n" +"... R = 4\n" +"... W = 2\n" +"... X = 1\n" +"...\n" +">>> (Perm.R & Perm.W).name is None # 效果為 Perm(0)\n" +"True" #: ../../howto/enum.rst:1164 msgid "multi-bit flags, aka aliases, can be returned from operations::" @@ -2557,6 +2576,13 @@ msgid "" "... return obj\n" "..." msgstr "" +">>> class AutoNumber(Enum):\n" +"... def __new__(cls, *args): # 這是和上面相比唯一的變更\n" +"... value = len(cls.__members__) + 1\n" +"... obj = object.__new__(cls)\n" +"... obj._value_ = value\n" +"... return obj\n" +"..." #: ../../howto/enum.rst:1382 msgid "" @@ -2700,6 +2726,26 @@ msgid "" " ...\n" "ValueError: aliases not allowed in DuplicateFreeEnum: 'GRENE' --> 'GREEN'" msgstr "" +">>> class DuplicateFreeEnum(Enum):\n" +"... def __init__(self, *args):\n" +"... cls = self.__class__\n" +"... if any(self.value == e.value for e in cls):\n" +"... a = self.name\n" +"... e = cls(self.value).name\n" +"... raise ValueError(\n" +"... \"aliases not allowed in DuplicateFreeEnum: %r --> " +"%r\"\n" +"... % (a, e))\n" +"...\n" +">>> class Color(DuplicateFreeEnum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3\n" +"... GRENE = 2\n" +"...\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: aliases not allowed in DuplicateFreeEnum: 'GRENE' --> 'GREEN'" #: ../../howto/enum.rst:1477 msgid "" @@ -2787,6 +2833,28 @@ msgid "" ">>> Planet.EARTH.surface_gravity\n" "9.802652743337129" msgstr "" +">>> class Planet(Enum):\n" +"... MERCURY = (3.303e+23, 2.4397e6)\n" +"... VENUS = (4.869e+24, 6.0518e6)\n" +"... EARTH = (5.976e+24, 6.37814e6)\n" +"... MARS = (6.421e+23, 3.3972e6)\n" +"... JUPITER = (1.9e+27, 7.1492e7)\n" +"... SATURN = (5.688e+26, 6.0268e7)\n" +"... URANUS = (8.686e+25, 2.5559e7)\n" +"... NEPTUNE = (1.024e+26, 2.4746e7)\n" +"... def __init__(self, mass, radius):\n" +"... self.mass = mass # 以公斤表示\n" +"... self.radius = radius # 以公尺表示\n" +"... @property\n" +"... def surface_gravity(self):\n" +"... # 萬有引力常數 (m3 kg-1 s-2)\n" +"... G = 6.67300E-11\n" +"... return G * self.mass / (self.radius * self.radius)\n" +"...\n" +">>> Planet.EARTH.value\n" +"(5.976e+24, 6378140.0)\n" +">>> Planet.EARTH.surface_gravity\n" +"9.802652743337129" #: ../../howto/enum.rst:1537 msgid "TimePeriod" diff --git a/howto/functional.po b/howto/functional.po index 1be2a0486f5..85b44dc8cb5 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -1018,6 +1018,15 @@ msgid "" ">>> sorted(rand_list, reverse=True)\n" "[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]" msgstr "" +">>> import random\n" +">>> # 產生 8 個範圍在 [0, 10000) 的隨機數字\n" +">>> rand_list = random.sample(range(10000), 8)\n" +">>> rand_list\n" +"[769, 7953, 9828, 6431, 8442, 9878, 6213, 2207]\n" +">>> sorted(rand_list)\n" +"[769, 2207, 6213, 6431, 7953, 8442, 9828, 9878]\n" +">>> sorted(rand_list, reverse=True)\n" +"[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]" #: ../../howto/functional.rst:698 msgid "" diff --git a/howto/isolating-extensions.po b/howto/isolating-extensions.po index 9464ff1c9d7..468e64d8410 100644 --- a/howto/isolating-extensions.po +++ b/howto/isolating-extensions.po @@ -631,7 +631,7 @@ msgstr "" #: ../../howto/isolating-extensions.rst:418 msgid "Defining ``tp_dealloc``" -msgstr "" +msgstr "定義 ``tp_dealloc``" #: ../../howto/isolating-extensions.rst:420 msgid "" @@ -692,7 +692,7 @@ msgstr "" #: ../../howto/isolating-extensions.rst:452 msgid "Avoiding ``PyObject_New``" -msgstr "" +msgstr "避免使用 ``PyObject_New``" #: ../../howto/isolating-extensions.rst:454 msgid "GC-tracked objects need to be allocated using GC-aware functions." @@ -843,7 +843,7 @@ msgstr "" #: ../../howto/isolating-extensions.rst:538 msgid "For example::" -msgstr "" +msgstr "舉例來說: ::" #: ../../howto/isolating-extensions.rst:540 msgid "" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index 9d926063b6a..15d2b2fcd6a 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -2167,6 +2167,27 @@ msgid "" "2010-10-28 15:13:11,494 foo.bar CRITICAL This is a CRITICAL message\n" ">>>" msgstr "" +">>> import logging\n" +">>> root = logging.getLogger()\n" +">>> root.setLevel(logging.DEBUG)\n" +">>> handler = logging.StreamHandler()\n" +">>> bf = logging.Formatter('{asctime} {name} {levelname:8s} {message}',\n" +"... style='{')\n" +">>> handler.setFormatter(bf)\n" +">>> root.addHandler(handler)\n" +">>> logger = logging.getLogger('foo.bar')\n" +">>> logger.debug('This is a DEBUG message')\n" +"2010-10-28 15:11:55,341 foo.bar DEBUG This is a DEBUG message\n" +">>> logger.critical('This is a CRITICAL message')\n" +"2010-10-28 15:12:11,526 foo.bar CRITICAL This is a CRITICAL message\n" +">>> df = logging.Formatter('$asctime $name ${levelname} $message',\n" +"... style='$')\n" +">>> handler.setFormatter(df)\n" +">>> logger.debug('This is a DEBUG message')\n" +"2010-10-28 15:13:06,924 foo.bar DEBUG This is a DEBUG message\n" +">>> logger.critical('This is a CRITICAL message')\n" +"2010-10-28 15:13:11,494 foo.bar CRITICAL This is a CRITICAL message\n" +">>>" #: ../../howto/logging-cookbook.rst:1669 msgid "" @@ -2181,6 +2202,9 @@ msgid "" "2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n" ">>>" msgstr "" +">>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message')\n" +"2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n" +">>>" #: ../../howto/logging-cookbook.rst:1677 msgid "" @@ -2281,6 +2305,21 @@ msgid "" "Message with 2 placeholders\n" ">>>" msgstr "" +">>> from wherever import BraceMessage as __\n" +">>> print(__('Message with {0} {name}', 2, name='placeholders'))\n" +"Message with 2 placeholders\n" +">>> class Point: pass\n" +"...\n" +">>> p = Point()\n" +">>> p.x = 0.5\n" +">>> p.y = 0.5\n" +">>> print(__('Message with coordinates: ({point.x:.2f}, {point.y:.2f})',\n" +"... point=p))\n" +"Message with coordinates: (0.50, 0.50)\n" +">>> from wherever import DollarMessage as __\n" +">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" +"Message with 2 placeholders\n" +">>>" #: ../../howto/logging-cookbook.rst:1744 msgid "" @@ -3679,6 +3718,17 @@ msgid "" "point=p))\n" "Message with coordinates: (0.50, 0.50)" msgstr "" +">>> __ = BraceMessage\n" +">>> print(__('Message with {0} {1}', 2, 'placeholders'))\n" +"Message with 2 placeholders\n" +">>> class Point: pass\n" +"...\n" +">>> p = Point()\n" +">>> p.x = 0.5\n" +">>> p.y = 0.5\n" +">>> print(__('Message with coordinates: ({point.x:.2f}, {point.y:.2f})', " +"point=p))\n" +"Message with coordinates: (0.50, 0.50)" #: ../../howto/logging-cookbook.rst:2824 msgid "Secondly, formatting with :class:`string.Template`::" @@ -3691,6 +3741,10 @@ msgid "" "Message with 2 placeholders\n" ">>>" msgstr "" +">>> __ = DollarMessage\n" +">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" +"Message with 2 placeholders\n" +">>>" #: ../../howto/logging-cookbook.rst:2831 msgid "" diff --git a/howto/sorting.po b/howto/sorting.po index 40f6d215fc8..7455a8b96f6 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -594,6 +594,9 @@ msgid "" ">>> sorted(map(str, data))\n" "['10', '11', 'twelve']" msgstr "" +">>> data = ['twelve', '11', 10]\n" +">>> sorted(map(str, data))\n" +"['10', '11', 'twelve']" #: ../../howto/sorting.rst:292 msgid "" @@ -612,6 +615,11 @@ msgid "" ">>> sorted(filterfalse(isnan, data))\n" "[1.1, 2.2, 3.3]" msgstr "" +">>> from math import isnan\n" +">>> from itertools import filterfalse\n" +">>> data = [3.3, float('nan'), 1.1, 2.2]\n" +">>> sorted(filterfalse(isnan, data))\n" +"[1.1, 2.2, 3.3]" #: ../../howto/sorting.rst:305 msgid "" @@ -630,6 +638,9 @@ msgid "" ">>> sorted(x for x in data if x is not None)\n" "[1.1, 2.2, 3.3]" msgstr "" +">>> data = [3.3, None, 1.1, 2.2]\n" +">>> sorted(x for x in data if x is not None)\n" +"[1.1, 2.2, 3.3]" #: ../../howto/sorting.rst:317 msgid "This is needed because ``None`` is not comparable to other types." @@ -645,6 +656,9 @@ msgid "" ">>> sorted(data, key=lambda d: sorted(d.items()))\n" "[{'a': 1}, {'b': 2}]" msgstr "" +">>> data = [{'a': 1}, {'b': 2}]\n" +">>> sorted(data, key=lambda d: sorted(d.items()))\n" +"[{'a': 1}, {'b': 2}]" #: ../../howto/sorting.rst:327 msgid "" @@ -661,6 +675,9 @@ msgid "" ">>> sorted(map(sorted, data))\n" "[['a', 'b', 'c'], ['b', 'c', 'd']]" msgstr "" +">>> data = [{'a', 'b', 'c'}, {'b', 'c', 'd'}]\n" +">>> sorted(map(sorted, data))\n" +"[['a', 'b', 'c'], ['b', 'c', 'd']]" #: ../../howto/sorting.rst:338 msgid "" diff --git a/howto/unicode.po b/howto/unicode.po index 7d33256d991..ebe70ac6140 100644 --- a/howto/unicode.po +++ b/howto/unicode.po @@ -556,6 +556,12 @@ msgid "" ">>> [ord(c) for c in s]\n" "[97, 172, 4660, 8364, 32768]" msgstr "" +">>> s = \"a\\xac\\u1234\\u20ac\\U00008000\"\n" +"... # ^^^^ two-digit hex escape\n" +"... # ^^^^^^ four-digit Unicode escape\n" +"... # ^^^^^^^^^^ eight-digit Unicode escape\n" +">>> [ord(c) for c in s]\n" +"[97, 172, 4660, 8364, 32768]" #: ../../howto/unicode.rst:324 msgid "" diff --git a/library/annotationlib.po b/library/annotationlib.po index 6725f78e2f2..93d55b02d9c 100644 --- a/library/annotationlib.po +++ b/library/annotationlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-09 05:11+0800\n" +"POT-Creation-Date: 2025-10-22 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,17 +18,16 @@ msgstr "" #: ../../library/annotationlib.rst:2 msgid ":mod:`!annotationlib` --- Functionality for introspecting annotations" -msgstr "" +msgstr ":mod:`!annotationlib` --- 用於自我檢查註釋的功能" #: ../../library/annotationlib.rst:9 msgid "**Source code:** :source:`Lib/annotationlib.py`" -msgstr "" +msgstr "**原始碼:** :source:`Lib/annotationlib.py`" #: ../../library/annotationlib.rst:18 msgid "" -"The :mod:`!annotationlib` module provides tools for " -"introspecting :term:`annotations ` on modules, classes, and " -"functions." +"The :mod:`!annotationlib` module provides tools for introspecting :term:" +"`annotations ` on modules, classes, and functions." msgstr "" #: ../../library/annotationlib.rst:21 @@ -42,8 +41,8 @@ msgstr "" #: ../../library/annotationlib.rst:26 msgid "" -"This module supports retrieving annotations in three main formats " -"(see :class:`Format`), each of which works best for different use cases:" +"This module supports retrieving annotations in three main formats (see :" +"class:`Format`), each of which works best for different use cases:" msgstr "" #: ../../library/annotationlib.rst:29 @@ -74,10 +73,9 @@ msgid "" "annotations. Given a function, class, or module, it returns an annotations " "dictionary in the requested format. This module also provides functionality " "for working directly with the :term:`annotate function` that is used to " -"evaluate annotations, such as :func:`get_annotate_from_class_namespace` " -"and :func:`call_annotate_function`, as well as " -"the :func:`call_evaluate_function` function for working with :term:`evaluate " -"functions `." +"evaluate annotations, such as :func:`get_annotate_from_class_namespace` and :" +"func:`call_annotate_function`, as well as the :func:`call_evaluate_function` " +"function for working with :term:`evaluate functions `." msgstr "" #: ../../library/annotationlib.rst:51 @@ -93,8 +91,8 @@ msgstr "" #: ../../library/annotationlib.rst:58 msgid "" -":pep:`749` expanded on various aspects of :pep:`649` and introduced " -"the :mod:`!annotationlib` module." +":pep:`749` expanded on various aspects of :pep:`649` and introduced the :mod:" +"`!annotationlib` module." msgstr "" #: ../../library/annotationlib.rst:61 @@ -122,9 +120,9 @@ msgstr "" #: ../../library/annotationlib.rst:74 msgid "" -"*Stock semantics* (default in Python 3.0 through 3.13; see :pep:`3107` " -"and :pep:`526`): Annotations are evaluated eagerly, as they are encountered " -"in the source code." +"*Stock semantics* (default in Python 3.0 through 3.13; see :pep:`3107` and :" +"pep:`526`): Annotations are evaluated eagerly, as they are encountered in " +"the source code." msgstr "" #: ../../library/annotationlib.rst:77 @@ -136,9 +134,8 @@ msgstr "" #: ../../library/annotationlib.rst:80 msgid "" -"*Deferred evaluation* (default in Python 3.14 and newer; see :pep:`649` " -"and :pep:`749`): Annotations are evaluated lazily, only when they are " -"accessed." +"*Deferred evaluation* (default in Python 3.14 and newer; see :pep:`649` and :" +"pep:`749`): Annotations are evaluated lazily, only when they are accessed." msgstr "" #: ../../library/annotationlib.rst:83 @@ -161,9 +158,9 @@ msgstr "" #: ../../library/annotationlib.rst:94 msgid "" -"Under stock semantics (Python 3.13 and earlier), it will throw " -"a :exc:`NameError` at the line where ``func`` is defined, because ``Cls`` is " -"an undefined name at that point." +"Under stock semantics (Python 3.13 and earlier), it will throw a :exc:" +"`NameError` at the line where ``func`` is defined, because ``Cls`` is an " +"undefined name at that point." msgstr "" #: ../../library/annotationlib.rst:97 @@ -219,11 +216,10 @@ msgstr "" msgid "" "Special value used to signal that an annotate function is being evaluated in " "a special environment with fake globals. When passed this value, annotate " -"functions should either return the same value as for " -"the :attr:`Format.VALUE` format, or raise :exc:`NotImplementedError` to " -"signal that they do not support execution in this environment. This format " -"is only used internally and should not be passed to the functions in this " -"module." +"functions should either return the same value as for the :attr:`Format." +"VALUE` format, or raise :exc:`NotImplementedError` to signal that they do " +"not support execution in this environment. This format is only used " +"internally and should not be passed to the functions in this module." msgstr "" #: ../../library/annotationlib.rst:149 @@ -259,9 +255,9 @@ msgstr "" #: ../../library/annotationlib.rst:176 msgid "" -"A string containing the code that was evaluated to produce " -"the :class:`~ForwardRef`. The string may not be exactly equivalent to the " -"original source." +"A string containing the code that was evaluated to produce the :class:" +"`~ForwardRef`. The string may not be exactly equivalent to the original " +"source." msgstr "" #: ../../library/annotationlib.rst:182 @@ -279,9 +275,8 @@ msgid "" "example, if the forward reference object contains the code " "``list[undefined]``, where ``undefined`` is a name that is not defined, " "evaluating it with the :attr:`~Format.FORWARDREF` format will return " -"``list[ForwardRef('undefined')]``. If the *format* argument " -"is :attr:`~Format.STRING`, the method will " -"return :attr:`~ForwardRef.__forward_arg__`." +"``list[ForwardRef('undefined')]``. If the *format* argument is :attr:" +"`~Format.STRING`, the method will return :attr:`~ForwardRef.__forward_arg__`." msgstr "" #: ../../library/annotationlib.rst:196 @@ -295,15 +290,15 @@ msgstr "" #: ../../library/annotationlib.rst:201 msgid "" "The *globals*, *locals*, and *type_params* parameters provide a more precise " -"mechanism for influencing the names that are available when " -"the :class:`~ForwardRef` is evaluated. *globals* and *locals* are passed " -"to :func:`eval`, representing the global and local namespaces in which the " -"name is evaluated. The *type_params* parameter is relevant for objects " -"created using the native syntax for :ref:`generic classes ` " -"and :ref:`functions `. It is a tuple of :ref:`type " -"parameters ` that are in scope while the forward reference is " -"being evaluated. For example, if evaluating a :class:`~ForwardRef` retrieved " -"from an annotation found in the class namespace of a generic class ``C``, " +"mechanism for influencing the names that are available when the :class:" +"`~ForwardRef` is evaluated. *globals* and *locals* are passed to :func:" +"`eval`, representing the global and local namespaces in which the name is " +"evaluated. The *type_params* parameter is relevant for objects created using " +"the native syntax for :ref:`generic classes ` and :ref:" +"`functions `. It is a tuple of :ref:`type parameters " +"` that are in scope while the forward reference is being " +"evaluated. For example, if evaluating a :class:`~ForwardRef` retrieved from " +"an annotation found in the class namespace of a generic class ``C``, " "*type_params* should be set to ``C.__type_params__``." msgstr "" @@ -319,9 +314,9 @@ msgstr "" #: ../../library/annotationlib.rst:219 msgid "" -"If no *owner*, *globals*, *locals*, or *type_params* are provided and " -"the :class:`~ForwardRef` does not contain information about its origin, " -"empty globals and locals dictionaries are used." +"If no *owner*, *globals*, *locals*, or *type_params* are provided and the :" +"class:`~ForwardRef` does not contain information about its origin, empty " +"globals and locals dictionaries are used." msgstr "" #: ../../library/annotationlib.rst:227 @@ -339,8 +334,8 @@ msgstr "" #: ../../library/annotationlib.rst:238 msgid "" -"For example, this is used to implement the :attr:`~Format.STRING` " -"for :class:`typing.TypedDict` classes created through the functional syntax:" +"For example, this is used to implement the :attr:`~Format.STRING` for :class:" +"`typing.TypedDict` classes created through the functional syntax:" msgstr "" #: ../../library/annotationlib.rst:241 @@ -350,6 +345,10 @@ msgid "" ">>> get_annotations(Movie, format=Format.STRING)\n" "{'name': 'str', 'year': 'int'}" msgstr "" +">>> from typing import TypedDict\n" +">>> Movie = TypedDict(\"movie\", {\"name\": str, \"year\": int})\n" +">>> get_annotations(Movie, format=Format.STRING)\n" +"{'name': 'str', 'year': 'int'}" #: ../../library/annotationlib.rst:252 msgid "" @@ -361,12 +360,12 @@ msgstr "" #: ../../library/annotationlib.rst:256 msgid "" "This helper function is required because annotate functions generated by the " -"compiler for functions, classes, and modules only support " -"the :attr:`~Format.VALUE` format when called directly. To support other " -"formats, this function calls the annotate function in a special environment " -"that allows it to produce annotations in the other formats. This is a useful " -"building block when implementing functionality that needs to partially " -"evaluate annotations while a class is being constructed." +"compiler for functions, classes, and modules only support the :attr:`~Format." +"VALUE` format when called directly. To support other formats, this function " +"calls the annotate function in a special environment that allows it to " +"produce annotations in the other formats. This is a useful building block " +"when implementing functionality that needs to partially evaluate annotations " +"while a class is being constructed." msgstr "" #: ../../library/annotationlib.rst:265 @@ -469,9 +468,9 @@ msgstr "" #: ../../library/annotationlib.rst:333 msgid "" -"*obj* may be a callable, class, module, or other object " -"with :attr:`~object.__annotate__` or :attr:`~object.__annotations__` " -"attributes. Passing any other object raises :exc:`TypeError`." +"*obj* may be a callable, class, module, or other object with :attr:`~object." +"__annotate__` or :attr:`~object.__annotations__` attributes. Passing any " +"other object raises :exc:`TypeError`." msgstr "" #: ../../library/annotationlib.rst:337 @@ -487,34 +486,54 @@ msgid "" "exist, the :attr:`!object.__annotate__` function is called if it exists." msgstr "" -#: ../../library/annotationlib.rst:343 +#: ../../library/annotationlib.rst:344 msgid "" "FORWARDREF: If :attr:`!object.__annotations__` exists and can be evaluated " "successfully, it is used; otherwise, the :attr:`!object.__annotate__` " -"function is called. If it does not exist either, :attr:`!" -"object.__annotations__` is tried again and any error from accessing it is re-" -"raised." +"function is called. If it does not exist either, :attr:`!object." +"__annotations__` is tried again and any error from accessing it is re-raised." +msgstr "" + +#: ../../library/annotationlib.rst:349 +msgid "" +"When calling :attr:`!object.__annotate__` it is first called with :attr:" +"`~Format.FORWARDREF`. If this is not implemented, it will then check if :" +"attr:`~Format.VALUE_WITH_FAKE_GLOBALS` is supported and use that in the fake " +"globals environment. If neither of these formats are supported, it will fall " +"back to using :attr:`~Format.VALUE`. If :attr:`~Format.VALUE` fails, the " +"error from this call will be raised." msgstr "" -#: ../../library/annotationlib.rst:347 +#: ../../library/annotationlib.rst:355 msgid "" "STRING: If :attr:`!object.__annotate__` exists, it is called first; " -"otherwise, :attr:`!object.__annotations__` is used and stringified " -"using :func:`annotations_to_string`." +"otherwise, :attr:`!object.__annotations__` is used and stringified using :" +"func:`annotations_to_string`." +msgstr "" + +#: ../../library/annotationlib.rst:359 +msgid "" +"When calling :attr:`!object.__annotate__` it is first called with :attr:" +"`~Format.STRING`. If this is not implemented, it will then check if :attr:" +"`~Format.VALUE_WITH_FAKE_GLOBALS` is supported and use that in the fake " +"globals environment. If neither of these formats are supported, it will fall " +"back to using :attr:`~Format.VALUE` with the result converted using :func:" +"`annotations_to_string`. If :attr:`~Format.VALUE` fails, the error from this " +"call will be raised." msgstr "" -#: ../../library/annotationlib.rst:351 +#: ../../library/annotationlib.rst:366 msgid "" "Returns a dict. :func:`!get_annotations` returns a new dict every time it's " "called; calling it twice on the same object will return two different but " "equivalent dicts." msgstr "" -#: ../../library/annotationlib.rst:355 +#: ../../library/annotationlib.rst:370 msgid "This function handles several details for you:" msgstr "" -#: ../../library/annotationlib.rst:357 +#: ../../library/annotationlib.rst:372 msgid "" "If *eval_str* is true, values of type :class:`!str` will be un-stringized " "using :func:`eval`. This is intended for use with stringized annotations " @@ -522,47 +541,47 @@ msgid "" "to true with formats other than :attr:`Format.VALUE`." msgstr "" -#: ../../library/annotationlib.rst:362 +#: ../../library/annotationlib.rst:377 msgid "" "If *obj* doesn't have an annotations dict, returns an empty dict. (Functions " "and methods always have an annotations dict; classes, modules, and other " "types of callables may not.)" msgstr "" -#: ../../library/annotationlib.rst:366 +#: ../../library/annotationlib.rst:381 msgid "" "Ignores inherited annotations on classes, as well as annotations on " "metaclasses. If a class doesn't have its own annotations dict, returns an " "empty dict." msgstr "" -#: ../../library/annotationlib.rst:369 +#: ../../library/annotationlib.rst:384 msgid "" "All accesses to object members and dict values are done using ``getattr()`` " "and ``dict.get()`` for safety." msgstr "" -#: ../../library/annotationlib.rst:372 +#: ../../library/annotationlib.rst:387 msgid "" "*eval_str* controls whether or not values of type :class:`!str` are replaced " "with the result of calling :func:`eval` on those values:" msgstr "" -#: ../../library/annotationlib.rst:375 +#: ../../library/annotationlib.rst:390 msgid "" "If eval_str is true, :func:`eval` is called on values of type :class:`!str`. " -"(Note that :func:`!get_annotations` doesn't catch exceptions; " -"if :func:`eval` raises an exception, it will unwind the stack past " -"the :func:`!get_annotations` call.)" +"(Note that :func:`!get_annotations` doesn't catch exceptions; if :func:" +"`eval` raises an exception, it will unwind the stack past the :func:`!" +"get_annotations` call.)" msgstr "" -#: ../../library/annotationlib.rst:379 +#: ../../library/annotationlib.rst:394 msgid "" "If *eval_str* is false (the default), values of type :class:`!str` are " "unchanged." msgstr "" -#: ../../library/annotationlib.rst:382 +#: ../../library/annotationlib.rst:397 msgid "" "*globals* and *locals* are passed in to :func:`eval`; see the documentation " "for :func:`eval` for more information. If *globals* or *locals* is :const:`!" @@ -570,48 +589,51 @@ msgid "" "contingent on ``type(obj)``:" msgstr "" -#: ../../library/annotationlib.rst:387 +#: ../../library/annotationlib.rst:402 msgid "If *obj* is a module, *globals* defaults to ``obj.__dict__``." -msgstr "" +msgstr "如果 *obj* 是模組,則 *globals* 預設為 ``obj.__dict__``。" -#: ../../library/annotationlib.rst:388 +#: ../../library/annotationlib.rst:403 msgid "" -"If *obj* is a class, *globals* defaults to " -"``sys.modules[obj.__module__].__dict__`` and *locals* defaults to the *obj* " -"class namespace." +"If *obj* is a class, *globals* defaults to ``sys.modules[obj.__module__]." +"__dict__`` and *locals* defaults to the *obj* class namespace." msgstr "" -#: ../../library/annotationlib.rst:391 +#: ../../library/annotationlib.rst:406 msgid "" "If *obj* is a callable, *globals* defaults to :attr:`obj.__globals__ " -"`, although if *obj* is a wrapped function " -"(using :func:`functools.update_wrapper`) or a :class:`functools.partial` " -"object, it is unwrapped until a non-wrapped function is found." +"`, although if *obj* is a wrapped function (using :" +"func:`functools.update_wrapper`) or a :class:`functools.partial` object, it " +"is unwrapped until a non-wrapped function is found." msgstr "" -#: ../../library/annotationlib.rst:397 +#: ../../library/annotationlib.rst:412 msgid "" "Calling :func:`!get_annotations` is best practice for accessing the " "annotations dict of any object. See :ref:`annotations-howto` for more " "information on annotations best practices." msgstr "" -#: ../../library/annotationlib.rst:401 +#: ../../library/annotationlib.rst:416 msgid "" ">>> def f(a: int, b: str) -> float:\n" "... pass\n" ">>> get_annotations(f)\n" "{'a': , 'b': , 'return': }" msgstr "" +">>> def f(a: int, b: str) -> float:\n" +"... pass\n" +">>> get_annotations(f)\n" +"{'a': , 'b': , 'return': }" -#: ../../library/annotationlib.rst:412 +#: ../../library/annotationlib.rst:427 msgid "" -"Convert an arbitrary Python value to a format suitable for use by " -"the :attr:`~Format.STRING` format. This calls :func:`repr` for most objects, " -"but has special handling for some objects, such as type objects." +"Convert an arbitrary Python value to a format suitable for use by the :attr:" +"`~Format.STRING` format. This calls :func:`repr` for most objects, but has " +"special handling for some objects, such as type objects." msgstr "" -#: ../../library/annotationlib.rst:416 +#: ../../library/annotationlib.rst:431 msgid "" "This is meant as a helper for user-provided annotate functions that support " "the :attr:`~Format.STRING` format but do not have access to the code " @@ -620,15 +642,15 @@ msgid "" "commonly encountered in annotations." msgstr "" -#: ../../library/annotationlib.rst:426 +#: ../../library/annotationlib.rst:441 msgid "Recipes" msgstr "" -#: ../../library/annotationlib.rst:431 +#: ../../library/annotationlib.rst:446 msgid "Using annotations in a metaclass" msgstr "" -#: ../../library/annotationlib.rst:433 +#: ../../library/annotationlib.rst:448 msgid "" "A :ref:`metaclass ` may want to inspect or even modify the " "annotations in a class body during class creation. Doing so requires " @@ -642,21 +664,20 @@ msgid "" "names that cannot yet be resolved when the class is created." msgstr "" -#: ../../library/annotationlib.rst:444 +#: ../../library/annotationlib.rst:459 msgid "" "To modify the annotations, it is best to create a wrapper annotate function " "that calls the original annotate function, makes any necessary adjustments, " "and returns the result." msgstr "" -#: ../../library/annotationlib.rst:448 +#: ../../library/annotationlib.rst:463 msgid "" -"Below is an example of a metaclass that filters out " -"all :class:`typing.ClassVar` annotations from the class and puts them in a " -"separate attribute:" +"Below is an example of a metaclass that filters out all :class:`typing." +"ClassVar` annotations from the class and puts them in a separate attribute:" msgstr "" -#: ../../library/annotationlib.rst:451 +#: ../../library/annotationlib.rst:466 msgid "" "import annotationlib\n" "import typing\n" @@ -707,25 +728,25 @@ msgid "" " return typ" msgstr "" -#: ../../library/annotationlib.rst:499 +#: ../../library/annotationlib.rst:514 msgid "Limitations of the ``STRING`` format" -msgstr "" +msgstr "``STRING`` 格式的限制" -#: ../../library/annotationlib.rst:501 +#: ../../library/annotationlib.rst:516 msgid "" "The :attr:`~Format.STRING` format is meant to approximate the source code of " "the annotation, but the implementation strategy used means that it is not " "always possible to recover the exact source code." msgstr "" -#: ../../library/annotationlib.rst:505 +#: ../../library/annotationlib.rst:520 msgid "" "First, the stringifier of course cannot recover any information that is not " "present in the compiled code, including comments, whitespace, " "parenthesization, and operations that get simplified by the compiler." msgstr "" -#: ../../library/annotationlib.rst:509 +#: ../../library/annotationlib.rst:524 msgid "" "Second, the stringifier can intercept almost all operations that involve " "names looked up in some scope, but it cannot intercept operations that " @@ -735,23 +756,29 @@ msgid "" "access to any globals or builtins. For example:" msgstr "" -#: ../../library/annotationlib.rst:515 +#: ../../library/annotationlib.rst:530 msgid "" -">>> def f(x: (1).__class__.__base__.__subclasses__()" -"[-1].__init__.__builtins__[\"print\"](\"Hello world\")): pass\n" +">>> def f(x: (1).__class__.__base__.__subclasses__()[-1].__init__." +"__builtins__[\"print\"](\"Hello world\")): pass\n" "...\n" ">>> annotationlib.get_annotations(f, format=annotationlib.Format.STRING)\n" "Hello world\n" "{'x': 'None'}" msgstr "" +">>> def f(x: (1).__class__.__base__.__subclasses__()[-1].__init__." +"__builtins__[\"print\"](\"Hello world\")): pass\n" +"...\n" +">>> annotationlib.get_annotations(f, format=annotationlib.Format.STRING)\n" +"Hello world\n" +"{'x': 'None'}" -#: ../../library/annotationlib.rst:524 +#: ../../library/annotationlib.rst:539 msgid "" "This particular example works as of the time of writing, but it relies on " "implementation details and is not guaranteed to work in the future." msgstr "" -#: ../../library/annotationlib.rst:527 +#: ../../library/annotationlib.rst:542 msgid "" "Among the different kinds of expressions that exist in Python, as " "represented by the :mod:`ast` module, some expressions are supported, " @@ -760,183 +787,184 @@ msgid "" "output or an error." msgstr "" -#: ../../library/annotationlib.rst:532 +#: ../../library/annotationlib.rst:547 msgid "The following are supported (sometimes with caveats):" msgstr "" -#: ../../library/annotationlib.rst:534 +#: ../../library/annotationlib.rst:549 msgid ":class:`ast.BinOp`" -msgstr "" +msgstr ":class:`ast.BinOp`" -#: ../../library/annotationlib.rst:535 +#: ../../library/annotationlib.rst:550 msgid ":class:`ast.UnaryOp`" -msgstr "" +msgstr ":class:`ast.UnaryOp`" -#: ../../library/annotationlib.rst:537 +#: ../../library/annotationlib.rst:552 msgid "" -":class:`ast.Invert` (``~``), :class:`ast.UAdd` (``+``), " -"and :class:`ast.USub` (``-``) are supported" +":class:`ast.Invert` (``~``), :class:`ast.UAdd` (``+``), and :class:`ast." +"USub` (``-``) are supported" msgstr "" +":class:`ast.Invert` (``~``)、:class:`ast.UAdd` (``+``) 和 :class:`ast.USub` (``-``) 有被支援" -#: ../../library/annotationlib.rst:538 +#: ../../library/annotationlib.rst:553 msgid ":class:`ast.Not` (``not``) is not supported" -msgstr "" +msgstr ":class:`ast.Not` (``not``) 並不被支援" -#: ../../library/annotationlib.rst:540 +#: ../../library/annotationlib.rst:555 msgid ":class:`ast.Dict` (except when using ``**`` unpacking)" -msgstr "" +msgstr ":class:`ast.Dict`\\ (除了使用 ``**`` 解包的情況)" -#: ../../library/annotationlib.rst:541 +#: ../../library/annotationlib.rst:556 msgid ":class:`ast.Set`" -msgstr "" +msgstr ":class:`ast.Set`" -#: ../../library/annotationlib.rst:542 +#: ../../library/annotationlib.rst:557 msgid ":class:`ast.Compare`" -msgstr "" +msgstr ":class:`ast.Compare`" -#: ../../library/annotationlib.rst:544 +#: ../../library/annotationlib.rst:559 msgid ":class:`ast.Eq` and :class:`ast.NotEq` are supported" -msgstr "" +msgstr ":class:`ast.Eq` 和 :class:`ast.NotEq` 有被支援" -#: ../../library/annotationlib.rst:545 +#: ../../library/annotationlib.rst:560 msgid "" ":class:`ast.Lt`, :class:`ast.LtE`, :class:`ast.Gt`, and :class:`ast.GtE` are " "supported, but the operand may be flipped" msgstr "" -#: ../../library/annotationlib.rst:546 +#: ../../library/annotationlib.rst:561 msgid "" ":class:`ast.Is`, :class:`ast.IsNot`, :class:`ast.In`, and :class:`ast.NotIn` " "are not supported" msgstr "" -#: ../../library/annotationlib.rst:548 +#: ../../library/annotationlib.rst:563 msgid ":class:`ast.Call` (except when using ``**`` unpacking)" msgstr "" -#: ../../library/annotationlib.rst:549 +#: ../../library/annotationlib.rst:564 msgid "" ":class:`ast.Constant` (though not the exact representation of the constant; " "for example, escape sequences in strings are lost; hexadecimal numbers are " "converted to decimal)" msgstr "" -#: ../../library/annotationlib.rst:551 +#: ../../library/annotationlib.rst:566 msgid ":class:`ast.Attribute` (assuming the value is not a constant)" msgstr "" -#: ../../library/annotationlib.rst:552 +#: ../../library/annotationlib.rst:567 msgid ":class:`ast.Subscript` (assuming the value is not a constant)" msgstr "" -#: ../../library/annotationlib.rst:553 +#: ../../library/annotationlib.rst:568 msgid ":class:`ast.Starred` (``*`` unpacking)" msgstr "" -#: ../../library/annotationlib.rst:554 +#: ../../library/annotationlib.rst:569 msgid ":class:`ast.Name`" -msgstr "" +msgstr ":class:`ast.Name`" -#: ../../library/annotationlib.rst:555 +#: ../../library/annotationlib.rst:570 msgid ":class:`ast.List`" -msgstr "" +msgstr ":class:`ast.List`" -#: ../../library/annotationlib.rst:556 +#: ../../library/annotationlib.rst:571 msgid ":class:`ast.Tuple`" -msgstr "" +msgstr ":class:`ast.Tuple`" -#: ../../library/annotationlib.rst:557 +#: ../../library/annotationlib.rst:572 msgid ":class:`ast.Slice`" -msgstr "" +msgstr ":class:`ast.Slice`" -#: ../../library/annotationlib.rst:559 +#: ../../library/annotationlib.rst:574 msgid "" "The following are unsupported, but throw an informative error when " "encountered by the stringifier:" msgstr "" -#: ../../library/annotationlib.rst:562 +#: ../../library/annotationlib.rst:577 msgid "" ":class:`ast.FormattedValue` (f-strings; error is not detected if conversion " "specifiers like ``!r`` are used)" msgstr "" -#: ../../library/annotationlib.rst:564 +#: ../../library/annotationlib.rst:579 msgid ":class:`ast.JoinedStr` (f-strings)" -msgstr "" +msgstr ":class:`ast.JoinedStr`\\ (f 字串)" -#: ../../library/annotationlib.rst:566 +#: ../../library/annotationlib.rst:581 msgid "The following are unsupported and result in incorrect output:" -msgstr "" +msgstr "以下是不支援的,並且會導致不正確的輸出:" -#: ../../library/annotationlib.rst:568 +#: ../../library/annotationlib.rst:583 msgid ":class:`ast.BoolOp` (``and`` and ``or``)" -msgstr "" +msgstr ":class:`ast.BoolOp`\\ (``and`` 和 ``or``)" -#: ../../library/annotationlib.rst:569 +#: ../../library/annotationlib.rst:584 msgid ":class:`ast.IfExp`" -msgstr "" +msgstr ":class:`ast.IfExp`" -#: ../../library/annotationlib.rst:570 +#: ../../library/annotationlib.rst:585 msgid ":class:`ast.Lambda`" -msgstr "" +msgstr ":class:`ast.Lambda`" -#: ../../library/annotationlib.rst:571 +#: ../../library/annotationlib.rst:586 msgid ":class:`ast.ListComp`" -msgstr "" +msgstr ":class:`ast.ListComp`" -#: ../../library/annotationlib.rst:572 +#: ../../library/annotationlib.rst:587 msgid ":class:`ast.SetComp`" -msgstr "" +msgstr ":class:`ast.SetComp`" -#: ../../library/annotationlib.rst:573 +#: ../../library/annotationlib.rst:588 msgid ":class:`ast.DictComp`" -msgstr "" +msgstr ":class:`ast.DictComp`" -#: ../../library/annotationlib.rst:574 +#: ../../library/annotationlib.rst:589 msgid ":class:`ast.GeneratorExp`" -msgstr "" +msgstr ":class:`ast.GeneratorExp`" -#: ../../library/annotationlib.rst:576 +#: ../../library/annotationlib.rst:591 msgid "" "The following are disallowed in annotation scopes and therefore not relevant:" msgstr "" -#: ../../library/annotationlib.rst:578 +#: ../../library/annotationlib.rst:593 msgid ":class:`ast.NamedExpr` (``:=``)" -msgstr "" +msgstr ":class:`ast.NamedExpr` (``:=``)" -#: ../../library/annotationlib.rst:579 +#: ../../library/annotationlib.rst:594 msgid ":class:`ast.Await`" -msgstr "" +msgstr ":class:`ast.Await`" -#: ../../library/annotationlib.rst:580 +#: ../../library/annotationlib.rst:595 msgid ":class:`ast.Yield`" -msgstr "" +msgstr ":class:`ast.Yield`" -#: ../../library/annotationlib.rst:581 +#: ../../library/annotationlib.rst:596 msgid ":class:`ast.YieldFrom`" -msgstr "" +msgstr ":class:`ast.YieldFrom`" -#: ../../library/annotationlib.rst:585 +#: ../../library/annotationlib.rst:600 msgid "Limitations of the ``FORWARDREF`` format" -msgstr "" +msgstr "``FORWARDREF`` 格式的限制" -#: ../../library/annotationlib.rst:587 +#: ../../library/annotationlib.rst:602 msgid "" "The :attr:`~Format.FORWARDREF` format aims to produce real values as much as " -"possible, with anything that cannot be resolved replaced " -"with :class:`ForwardRef` objects. It is affected by broadly the same " -"Limitations as the :attr:`~Format.STRING` format: annotations that perform " -"operations on literals or that use unsupported expression types may raise " -"exceptions when evaluated using the :attr:`~Format.FORWARDREF` format." +"possible, with anything that cannot be resolved replaced with :class:" +"`ForwardRef` objects. It is affected by broadly the same Limitations as the :" +"attr:`~Format.STRING` format: annotations that perform operations on " +"literals or that use unsupported expression types may raise exceptions when " +"evaluated using the :attr:`~Format.FORWARDREF` format." msgstr "" -#: ../../library/annotationlib.rst:594 +#: ../../library/annotationlib.rst:609 msgid "Below are a few examples of the behavior with unsupported expressions:" msgstr "" -#: ../../library/annotationlib.rst:596 +#: ../../library/annotationlib.rst:611 msgid "" ">>> from annotationlib import get_annotations, Format\n" ">>> def zerodiv(x: 1 / 0): ...\n" @@ -952,25 +980,38 @@ msgid "" ">>> get_annotations(ifexp, format=Format.STRING)\n" "{'x': '1'}" msgstr "" +">>> from annotationlib import get_annotations, Format\n" +">>> def zerodiv(x: 1 / 0): ...\n" +">>> get_annotations(zerodiv, format=Format.STRING)\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero\n" +">>> get_annotations(zerodiv, format=Format.FORWARDREF)\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero\n" +">>> def ifexp(x: 1 if y else 0): ...\n" +">>> get_annotations(ifexp, format=Format.STRING)\n" +"{'x': '1'}" -#: ../../library/annotationlib.rst:615 +#: ../../library/annotationlib.rst:630 msgid "Security implications of introspecting annotations" msgstr "" -#: ../../library/annotationlib.rst:617 +#: ../../library/annotationlib.rst:632 msgid "" "Much of the functionality in this module involves executing code related to " -"annotations, which can then do arbitrary things. For " -"example, :func:`get_annotations` may call an arbitrary :term:`annotate " -"function`, and :meth:`ForwardRef.evaluate` may call :func:`eval` on an " -"arbitrary string. Code contained in an annotation might make arbitrary " -"system calls, enter an infinite loop, or perform any other operation. This " -"is also true for any access of the :attr:`~object.__annotations__` " -"attribute, and for various functions in the :mod:`typing` module that work " -"with annotations, such as :func:`typing.get_type_hints`." +"annotations, which can then do arbitrary things. For example, :func:" +"`get_annotations` may call an arbitrary :term:`annotate function`, and :meth:" +"`ForwardRef.evaluate` may call :func:`eval` on an arbitrary string. Code " +"contained in an annotation might make arbitrary system calls, enter an " +"infinite loop, or perform any other operation. This is also true for any " +"access of the :attr:`~object.__annotations__` attribute, and for various " +"functions in the :mod:`typing` module that work with annotations, such as :" +"func:`typing.get_type_hints`." msgstr "" -#: ../../library/annotationlib.rst:626 +#: ../../library/annotationlib.rst:641 msgid "" "Any security issue arising from this also applies immediately after " "importing code that may contain untrusted annotations: importing code can " diff --git a/library/argparse.po b/library/argparse.po index 41fc0df320f..075bef69513 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -542,6 +542,26 @@ msgid "" "words\n" "will be wrapped across a couple lines" msgstr "" +">>> parser = argparse.ArgumentParser(\n" +"... prog='PROG',\n" +"... description='''this description\n" +"... was indented weird\n" +"... but that is okay''',\n" +"... epilog='''\n" +"... likewise for this epilog whose whitespace will\n" +"... be cleaned up and whose words will be wrapped\n" +"... across a couple lines''')\n" +">>> parser.print_help()\n" +"usage: PROG [-h]\n" +"\n" +"this description was indented weird but that is okay\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"\n" +"likewise for this epilog whose whitespace will be cleaned up and whose " +"words\n" +"will be wrapped across a couple lines" #: ../../library/argparse.rst:330 msgid "" @@ -1053,6 +1073,14 @@ msgid "" "tester.py: error: argument --action: invalid choice: 'sumn', maybe you meant " "'sum'? (choose from 'sum', 'max')" msgstr "" +">>> parser = argparse.ArgumentParser(description='Process some integers.',\n" +" suggest_on_error=True)\n" +">>> parser.add_argument('--action', choices=['sum', 'max'])\n" +">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" +"... help='an integer for the accumulator')\n" +">>> parser.parse_args(['--action', 'sumn', 1, 2, 3])\n" +"tester.py: error: argument --action: invalid choice: 'sumn', maybe you meant " +"'sum'? (choose from 'sum', 'max')" #: ../../library/argparse.rst:615 msgid "" @@ -1067,6 +1095,8 @@ msgid "" ">>> parser = argparse.ArgumentParser(description='Process some integers.')\n" ">>> parser.suggest_on_error = True" msgstr "" +">>> parser = argparse.ArgumentParser(description='Process some integers.')\n" +">>> parser.suggest_on_error = True" #: ../../library/argparse.rst:627 msgid "color" @@ -1090,6 +1120,12 @@ msgid "" "... help='an integer for the accumulator')\n" ">>> parser.parse_args(['--help'])" msgstr "" +">>> parser = argparse.ArgumentParser(description='Process some integers.',\n" +"... color=False)\n" +">>> parser.add_argument('--action', choices=['sum', 'max'])\n" +">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" +"... help='an integer for the accumulator')\n" +">>> parser.parse_args(['--help'])" #: ../../library/argparse.rst:646 msgid "The add_argument() method" @@ -1405,6 +1441,10 @@ msgid "" ">>> parser.parse_args(['-vvv'])\n" "Namespace(verbose=3)" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--verbose', '-v', action='count', default=0)\n" +">>> parser.parse_args(['-vvv'])\n" +"Namespace(verbose=3)" #: ../../library/argparse.rst:823 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." @@ -1487,6 +1527,23 @@ msgid "" ">>> args\n" "Namespace(bar='1', foo='2')" msgstr "" +">>> class FooAction(argparse.Action):\n" +"... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" +"... if nargs is not None:\n" +"... raise ValueError(\"nargs not allowed\")\n" +"... super().__init__(option_strings, dest, **kwargs)\n" +"... def __call__(self, parser, namespace, values, option_string=None):\n" +"... print('%r %r %r' % (namespace, values, option_string))\n" +"... setattr(namespace, self.dest, values)\n" +"...\n" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', action=FooAction)\n" +">>> parser.add_argument('bar', action=FooAction)\n" +">>> args = parser.parse_args('1 --foo 2'.split())\n" +"Namespace(bar=None, foo=None) '1' None\n" +"Namespace(bar='1', foo=None) '2' '--foo'\n" +">>> args\n" +"Namespace(bar='1', foo='2')" #: ../../library/argparse.rst:871 msgid "For more details, see :class:`Action`." @@ -3757,6 +3814,18 @@ msgid "" "usage: PROG [-h] [--foo FOO]\n" "PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" msgstr "" +">>> import argparse\n" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.register('type', 'hexadecimal integer', lambda s: int(s, 16))\n" +">>> parser.add_argument('--foo', type='hexadecimal integer')\n" +"_StoreAction(option_strings=['--foo'], dest='foo', nargs=None, const=None, " +"default=None, type='hexadecimal integer', choices=None, required=False, " +"help=None, metavar=None, deprecated=False)\n" +">>> parser.parse_args(['--foo', '0xFA'])\n" +"Namespace(foo=250)\n" +">>> parser.parse_args(['--foo', '1.2'])\n" +"usage: PROG [-h] [--foo FOO]\n" +"PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" #: ../../library/argparse.rst:2267 msgid "Exceptions" diff --git a/library/ast.po b/library/ast.po index 7c52be3473c..013311dd141 100644 --- a/library/ast.po +++ b/library/ast.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-24 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,12 +38,12 @@ msgstr "" #: ../../library/ast.rst:23 msgid "" -"An abstract syntax tree can be generated by " -"passing :data:`ast.PyCF_ONLY_AST` as a flag to the :func:`compile` built-in " -"function, or using the :func:`parse` helper provided in this module. The " -"result will be a tree of objects whose classes all inherit " -"from :class:`ast.AST`. An abstract syntax tree can be compiled into a " -"Python code object using the built-in :func:`compile` function." +"An abstract syntax tree can be generated by passing :data:`ast." +"PyCF_ONLY_AST` as a flag to the :func:`compile` built-in function, or using " +"the :func:`parse` helper provided in this module. The result will be a tree " +"of objects whose classes all inherit from :class:`ast.AST`. An abstract " +"syntax tree can be compiled into a Python code object using the built-in :" +"func:`compile` function." msgstr "" "要生成抽象語法樹,可以透過將 :data:`ast.PyCF_ONLY_AST` 作為旗標傳遞給內建函" "式 :func:`compile` 或使用此模組所提供的 :func:`parse` 輔助函式。結果將會是一" @@ -242,13 +242,13 @@ msgstr "節點 (Node) 類別" #: ../../library/ast.rst:46 msgid "" "This is the base of all AST node classes. The actual node classes are " -"derived from the :file:`Parser/Python.asdl` file, which is " -"reproduced :ref:`above `. They are defined in the :mod:`!" -"_ast` C module and re-exported in :mod:`ast`." +"derived from the :file:`Parser/Python.asdl` file, which is reproduced :ref:" +"`above `. They are defined in the :mod:`!_ast` C module " +"and re-exported in :mod:`ast`." msgstr "" -"這是所有 AST 節點類別的基礎。實際的節點類別是衍生自 :file:`Parser/" -"Python.asdl` 檔案,該檔案在\\ :ref:`上方 ` 重現。它們被定義" -"於 :mod:`!_ast` 的 C 模組中,並於 :mod:`ast` 中重新匯出。" +"這是所有 AST 節點類別的基礎。實際的節點類別是衍生自 :file:`Parser/Python." +"asdl` 檔案,該檔案在\\ :ref:`上方 ` 重現。它們被定義於 :" +"mod:`!_ast` 的 C 模組中,並於 :mod:`ast` 中重新匯出。" #: ../../library/ast.rst:51 msgid "" @@ -260,11 +260,11 @@ msgid "" "rules with alternatives (aka \"sums\"), the left-hand side class is " "abstract: only instances of specific constructor nodes are ever created." msgstr "" -"抽象文法中為每個左側符號定義了一個類別(例如 :class:`ast.stmt` " -"或 :class:`ast.expr`)。此外,也為每個右側的建構函式 (constructor) 定義了" -"一個類別;這些類別繼承自左側樹的類別。例如,:class:`ast.BinOp` 繼承" -"自 :class:`ast.expr`。對於具有替代方案(即為「和 (sums)」)的生產規則,左側類" -"別是抽象的:僅有特定建構函式節點的實例會被建立。" +"抽象文法中為每個左側符號定義了一個類別(例如 :class:`ast.stmt` 或 :class:" +"`ast.expr`)。此外,也為每個右側的建構函式 (constructor) 定義了一個類別;這些" +"類別繼承自左側樹的類別。例如,:class:`ast.BinOp` 繼承自 :class:`ast.expr`。對" +"於具有替代方案(即為「和 (sums)」)的生產規則,左側類別是抽象的:僅有特定建構" +"函式節點的實例會被建立。" #: ../../library/ast.rst:64 msgid "" @@ -278,8 +278,8 @@ msgid "" "the type as defined in the grammar. For example, :class:`ast.BinOp` " "instances have an attribute :attr:`left` of type :class:`ast.expr`." msgstr "" -"具體類別的每個實例對於每個子節點都有一個屬性,其型別如文法中所定義。例" -"如,:class:`ast.BinOp` 實例具有型別為 :class:`ast.expr` 的屬性 :attr:`left`。" +"具體類別的每個實例對於每個子節點都有一個屬性,其型別如文法中所定義。例如,:" +"class:`ast.BinOp` 實例具有型別為 :class:`ast.expr` 的屬性 :attr:`left`。" #: ../../library/ast.rst:71 msgid "" @@ -290,16 +290,16 @@ msgid "" "compiling an AST with :func:`compile`." msgstr "" "如果這些屬性在文法中被標記為可選(使用問號),則該值可能為 ``None``。如果屬性" -"可以有零個或多個值(用星號標記),則這些值將表示為 Python 串列。使" -"用 :func:`compile` 編譯 AST 時,所有可能的屬性都必須存在並且具有有效值。" +"可以有零個或多個值(用星號標記),則這些值將表示為 Python 串列。使用 :func:" +"`compile` 編譯 AST 時,所有可能的屬性都必須存在並且具有有效值。" #: ../../library/ast.rst:79 msgid "" "The :attr:`!_field_types` attribute on each concrete class is a dictionary " "mapping field names (as also listed in :attr:`_fields`) to their types." msgstr "" -"每個具體類別上的 :attr:`!_field_types` 屬性是將欄位名稱(也" -"在 :attr:`_fields` 中列出)對映到其型別的字典。" +"每個具體類別上的 :attr:`!_field_types` 屬性是將欄位名稱(也在 :attr:" +"`_fields` 中列出)對映到其型別的字典。" #: ../../library/ast.rst:82 msgid "" @@ -313,22 +313,21 @@ msgstr "" #: ../../library/ast.rst:94 msgid "" -"Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses " -"have :attr:`lineno`, :attr:`col_offset`, :attr:`end_lineno`, " -"and :attr:`end_col_offset` attributes. The :attr:`lineno` " -"and :attr:`end_lineno` are the first and last line numbers of source text " -"span (1-indexed so the first line is line 1) and the :attr:`col_offset` " -"and :attr:`end_col_offset` are the corresponding UTF-8 byte offsets of the " -"first and last tokens that generated the node. The UTF-8 offset is recorded " -"because the parser uses UTF-8 internally." -msgstr "" -":class:`ast.expr` 和 :class:`ast.stmt` 子類別的實例具" -"有 :attr:`lineno`、:attr:`col_offset`、:attr:`end_lineno` " -"和 :attr:`end_col_offset` 屬性。:attr:`lineno` 和 :attr:`end_lineno` 是原始文" -"本跨度 (source text span) 的第一個和最後一個列號(1-indexed,因此第一列號是 " -"1)以及 :attr:`col_offset` 和 :attr:`end_col_offset` 是生成節點的第一個和最後" -"一個標記對應的 UTF-8 位元組偏移量。會記錄 UTF-8 偏移量是因為剖析器 (parser) " -"內部使用 UTF-8。" +"Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have :attr:" +"`lineno`, :attr:`col_offset`, :attr:`end_lineno`, and :attr:`end_col_offset` " +"attributes. The :attr:`lineno` and :attr:`end_lineno` are the first and " +"last line numbers of source text span (1-indexed so the first line is line " +"1) and the :attr:`col_offset` and :attr:`end_col_offset` are the " +"corresponding UTF-8 byte offsets of the first and last tokens that generated " +"the node. The UTF-8 offset is recorded because the parser uses UTF-8 " +"internally." +msgstr "" +":class:`ast.expr` 和 :class:`ast.stmt` 子類別的實例具有 :attr:`lineno`、:" +"attr:`col_offset`、:attr:`end_lineno` 和 :attr:`end_col_offset` 屬性。:attr:" +"`lineno` 和 :attr:`end_lineno` 是原始文本跨度 (source text span) 的第一個和最" +"後一個列號(1-indexed,因此第一列號是 1)以及 :attr:`col_offset` 和 :attr:" +"`end_col_offset` 是生成節點的第一個和最後一個標記對應的 UTF-8 位元組偏移量。" +"會記錄 UTF-8 偏移量是因為剖析器 (parser) 內部使用 UTF-8。" #: ../../library/ast.rst:103 msgid "" @@ -380,15 +379,15 @@ msgid "" "If a field that is optional in the grammar is omitted from the constructor, " "it defaults to ``None``. If a list field is omitted, it defaults to the " "empty list. If a field of type :class:`!ast.expr_context` is omitted, it " -"defaults to :class:`Load() `. If any other field is omitted, " -"a :exc:`DeprecationWarning` is raised and the AST node will not have this " +"defaults to :class:`Load() `. If any other field is omitted, a :" +"exc:`DeprecationWarning` is raised and the AST node will not have this " "field. In Python 3.15, this condition will raise an error." msgstr "" "如果建構函式中省略了文法中可選的欄位,則它預設為 ``None``。如果省略串列欄位," -"則預設為空串列。如果省略 :class:`!ast.expr_context` 型別的欄位,則預設" -"為 :class:`Load() `。如果省略任何其他欄位,則會引" -"發 :exc:`DeprecationWarning`,且 AST 節點將沒有此欄位。在 Python 3.15 中,這" -"種情況會引發錯誤。" +"則預設為空串列。如果省略 :class:`!ast.expr_context` 型別的欄位,則預設為 :" +"class:`Load() `。如果省略任何其他欄位,則會引發 :exc:" +"`DeprecationWarning`,且 AST 節點將沒有此欄位。在 Python 3.15 中,這種情況會" +"引發錯誤。" #: ../../library/ast.rst:130 msgid "Class :class:`ast.Constant` is now used for all constants." @@ -408,10 +407,10 @@ msgstr "" #: ../../library/ast.rst:144 msgid "" -"Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!" -"ast.Bytes`, :class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still " -"available, but they will be removed in future Python releases. In the " -"meantime, instantiating them will return an instance of a different class." +"Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`, :" +"class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still available, " +"but they will be removed in future Python releases. In the meantime, " +"instantiating them will return an instance of a different class." msgstr "" "舊的類別 :class:`!ast.Num`、:class:`!ast.Str`、:class:`!ast.Bytes`、:class:`!" "ast.NameConstant` 和 :class:`!ast.Ellipsis` 仍然可用,但它們將在未來的 " @@ -441,9 +440,8 @@ msgstr "" #: ../../library/ast.rst:165 msgid "" "The descriptions of the specific node classes displayed here were initially " -"adapted from the fantastic `Green Tree Snakes `__ project and all its " -"contributors." +"adapted from the fantastic `Green Tree Snakes `__ project and all its contributors." msgstr "" "這裡顯示的特定節點類別的描述最初是從出色的 `Green Tree Snakes `__ 專案和所有貢獻者那裡改編而來" @@ -458,8 +456,8 @@ msgid "" "A Python module, as with :ref:`file input `. Node type generated " "by :func:`ast.parse` in the default ``\"exec\"`` *mode*." msgstr "" -"一個 Python 模組,與\\ :ref:`檔案輸入 ` 一樣。" -"由 :func:`ast.parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" +"一個 Python 模組,與\\ :ref:`檔案輸入 ` 一樣。由 :func:`ast." +"parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" #: ../../library/ast.rst:181 msgid "``body`` is a :class:`list` of the module's :ref:`ast-statements`." @@ -527,8 +525,8 @@ msgstr "" #: ../../library/ast.rst:217 msgid "``body`` is a :class:`list` of :ref:`statement nodes `." msgstr "" -"``body`` 是\\ :ref:`陳述式節點 (statement nodes) ` " -"的 :class:`list`。" +"``body`` 是\\ :ref:`陳述式節點 (statement nodes) ` 的 :class:" +"`list`。" #: ../../library/ast.rst:219 msgid "" @@ -621,14 +619,14 @@ msgstr "文本 (Literals)" msgid "" "A constant value. The ``value`` attribute of the ``Constant`` literal " "contains the Python object it represents. The values represented can be " -"instances " -"of :class:`str`, :class:`bytes`, :class:`int`, :class:`float`, :class:`complex`, " -"and :class:`bool`, and the constants :data:`None` and :data:`Ellipsis`." +"instances of :class:`str`, :class:`bytes`, :class:`int`, :class:`float`, :" +"class:`complex`, and :class:`bool`, and the constants :data:`None` and :data:" +"`Ellipsis`." msgstr "" "一個常數值。``Constant`` 文本的 ``value`` 屬性包含它所代表的 Python 物件。表" -"示的值可以" -"是 :class:`str`、:class:`bytes`、:class:`int`、:class:`float`、:class:`complex` " -"和 :class:`bool` 的實例,以及常數 :data:`None` 和 :data:`Ellipsis`。" +"示的值可以是 :class:`str`、:class:`bytes`、:class:`int`、:class:`float`、:" +"class:`complex` 和 :class:`bool` 的實例,以及常數 :data:`None` 和 :data:" +"`Ellipsis`。" #: ../../library/ast.rst:284 msgid "" @@ -646,7 +644,7 @@ msgid "" "function call)." msgstr "``value`` 為任何運算式節點(例如文字、變數或函式呼叫)。" -#: ../../library/ast.rst:290 ../../library/ast.rst:367 +#: ../../library/ast.rst:290 ../../library/ast.rst:372 msgid "``conversion`` is an integer:" msgstr "``conversion`` 是一個整數:" @@ -677,8 +675,8 @@ msgstr "" #: ../../library/ast.rst:304 msgid "" -"An f-string, comprising a series of :class:`FormattedValue` " -"and :class:`Constant` nodes." +"An f-string, comprising a series of :class:`FormattedValue` and :class:" +"`Constant` nodes." msgstr "" "一個 f 字串,包含一系列 :class:`FormattedValue` 和 :class:`Constant` 節點。" @@ -726,9 +724,9 @@ msgstr "" #: ../../library/ast.rst:333 msgid "" -"Node representing a template string literal, comprising a series " -"of :class:`Interpolation` and :class:`Constant` nodes. These nodes may be " -"any order, and do not need to be interleaved." +"Node representing a template string literal, comprising a series of :class:" +"`Interpolation` and :class:`Constant` nodes. These nodes may be any order, " +"and do not need to be interleaved." msgstr "" #: ../../library/ast.rst:337 @@ -778,34 +776,43 @@ msgstr "" msgid "" "``value`` is any expression node (such as a literal, a variable, or a " "function call). This has the same meaning as ``FormattedValue.value``." -msgstr "``value`` 為任何運算式節點(例如文字、變數或函式呼叫)。這和 ``FormattedValue.value`` 的意思相同。" +msgstr "" +"``value`` 為任何運算式節點(例如文字、變數或函式呼叫)。這和 " +"``FormattedValue.value`` 的意思相同。" #: ../../library/ast.rst:366 msgid "" "``str`` is a constant containing the text of the interpolation expression." msgstr "" -#: ../../library/ast.rst:369 +#: ../../library/ast.rst:368 +msgid "" +"If ``str`` is set to ``None``, then ``value`` is used to generate code when " +"calling :func:`ast.unparse`. This no longer guarantees that the generated " +"code is identical to the original and is intended for code generation." +msgstr "" + +#: ../../library/ast.rst:374 msgid "-1: no conversion" msgstr "-1:無規範" -#: ../../library/ast.rst:370 +#: ../../library/ast.rst:375 msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` conversion" msgstr "97 (``ord('a')``):``!a`` :func:`ASCII ` 轉換" -#: ../../library/ast.rst:371 +#: ../../library/ast.rst:376 msgid "114 (``ord('r')``): ``!r`` :func:`repr` conversion" msgstr "114 (``ord('r')``):``!r`` :func:`repr` 轉換" -#: ../../library/ast.rst:372 +#: ../../library/ast.rst:377 msgid "115 (``ord('s')``): ``!s`` :func:`string ` conversion" msgstr "115 (``ord('s')``):``!s`` :func:`string ` 轉換" -#: ../../library/ast.rst:374 +#: ../../library/ast.rst:379 msgid "This has the same meaning as ``FormattedValue.conversion``." msgstr "這與 ``FormattedValue.conversion`` 的意思相同。" -#: ../../library/ast.rst:375 +#: ../../library/ast.rst:380 msgid "" "``format_spec`` is a :class:`JoinedStr` node representing the formatting of " "the value, or ``None`` if no format was specified. Both ``conversion`` and " @@ -816,16 +823,16 @@ msgstr "" "為 ``None``。``conversion`` 和 ``format_spec`` 可以同時設定。這與 " "``FormattedValue.format_spec`` 的意思相同。" -#: ../../library/ast.rst:384 +#: ../../library/ast.rst:389 msgid "" "A list or tuple. ``elts`` holds a list of nodes representing the elements. " "``ctx`` is :class:`Store` if the container is an assignment target (i.e. " "``(x,y)=something``), and :class:`Load` otherwise." msgstr "" -"串列或元組。``elts`` 保存表示元素的節點串列。如果容器是賦值目標(即 " -"``(x,y)=something`` ),則 ``ctx`` 是 :class:`Store`,否則是 :class:`Load`。" +"串列或元組。``elts`` 保存表示元素的節點串列。如果容器是賦值目標(即 ``(x," +"y)=something`` ),則 ``ctx`` 是 :class:`Store`,否則是 :class:`Load`。" -#: ../../library/ast.rst:388 +#: ../../library/ast.rst:393 msgid "" ">>> print(ast.dump(ast.parse('[1, 2, 3]', mode='eval'), indent=4))\n" "Expression(\n" @@ -861,11 +868,11 @@ msgstr "" " Constant(value=3)],\n" " ctx=Load()))" -#: ../../library/ast.rst:410 +#: ../../library/ast.rst:415 msgid "A set. ``elts`` holds a list of nodes representing the set's elements." msgstr "一個集合。``elts`` 保存表示集合之元素的節點串列。" -#: ../../library/ast.rst:412 +#: ../../library/ast.rst:417 msgid "" ">>> print(ast.dump(ast.parse('{1, 2, 3}', mode='eval'), indent=4))\n" "Expression(\n" @@ -883,7 +890,7 @@ msgstr "" " Constant(value=2),\n" " Constant(value=3)]))" -#: ../../library/ast.rst:425 +#: ../../library/ast.rst:430 msgid "" "A dictionary. ``keys`` and ``values`` hold lists of nodes representing the " "keys and the values respectively, in matching order (what would be returned " @@ -893,7 +900,7 @@ msgstr "" "節點串列(為呼叫 :code:`dictionary.keys()` 和 :code:`dictionary.values()` 時" "將回傳的內容)。" -#: ../../library/ast.rst:429 +#: ../../library/ast.rst:434 msgid "" "When doing dictionary unpacking using dictionary literals the expression to " "be expanded goes in the ``values`` list, with a ``None`` at the " @@ -902,7 +909,7 @@ msgstr "" "當使用字典文本進行字典解包 (unpack) 時,要擴充的運算式位於 ``values`` 串列" "中,在 ``keys`` 中的相應位置有一個 ``None``。" -#: ../../library/ast.rst:433 +#: ../../library/ast.rst:438 msgid "" ">>> print(ast.dump(ast.parse('{\"a\":1, **d}', mode='eval'), indent=4))\n" "Expression(\n" @@ -924,17 +931,17 @@ msgstr "" " Constant(value=1),\n" " Name(id='d', ctx=Load())]))" -#: ../../library/ast.rst:447 +#: ../../library/ast.rst:452 msgid "Variables" msgstr "變數" -#: ../../library/ast.rst:451 +#: ../../library/ast.rst:456 msgid "" "A variable name. ``id`` holds the name as a string, and ``ctx`` is one of " "the following types." msgstr "一個變數名稱。``id`` 將名稱以字串形式保存,且 ``ctx`` 是以下型別之一。" -#: ../../library/ast.rst:459 +#: ../../library/ast.rst:464 msgid "" "Variable references can be used to load the value of a variable, to assign a " "new value to it, or to delete it. Variable references are given a context to " @@ -943,7 +950,7 @@ msgstr "" "變數參照可用於載入變數的值、為其分配新值或刪除它。變數參照被賦予情境 " "(context) 來區分這些情況。" -#: ../../library/ast.rst:463 +#: ../../library/ast.rst:468 msgid "" ">>> print(ast.dump(ast.parse('a'), indent=4))\n" "Module(\n" @@ -987,16 +994,16 @@ msgstr "" " targets=[\n" " Name(id='a', ctx=Del())])])" -#: ../../library/ast.rst:489 +#: ../../library/ast.rst:494 msgid "" -"A ``*var`` variable reference. ``value`` holds the variable, typically " -"a :class:`Name` node. This type must be used when building a :class:`Call` " -"node with ``*args``." +"A ``*var`` variable reference. ``value`` holds the variable, typically a :" +"class:`Name` node. This type must be used when building a :class:`Call` node " +"with ``*args``." msgstr "" "一個 ``*var`` 變數參照。``value`` 保存變數,通常是一個 :class:`Name` 節點。在" "使用 ``*args`` 建置 :class:`Call` 節點時必須使用此型別。" -#: ../../library/ast.rst:493 +#: ../../library/ast.rst:498 msgid "" ">>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\n" "Module(\n" @@ -1026,24 +1033,24 @@ msgstr "" " ctx=Store())],\n" " value=Name(id='it', ctx=Load()))])" -#: ../../library/ast.rst:513 +#: ../../library/ast.rst:518 msgid "Expressions" msgstr "運算式" -#: ../../library/ast.rst:517 +#: ../../library/ast.rst:522 msgid "" "When an expression, such as a function call, appears as a statement by " "itself with its return value not used or stored, it is wrapped in this " -"container. ``value`` holds one of the other nodes in this section, " -"a :class:`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` " -"or :class:`YieldFrom` node." +"container. ``value`` holds one of the other nodes in this section, a :class:" +"`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` or :class:" +"`YieldFrom` node." msgstr "" "當運算式(例如函式呼叫)本身作為陳述式出現且未使用或儲存其回傳值時,它將被包" -"裝在此容器中。``value`` 保存此區段 (section) 中的一個其他節" -"點::class:`Constant`、:class:`Name`、:class:`Lambda`、:class:`Yield` " -"或 :class:`YieldFrom`" +"裝在此容器中。``value`` 保存此區段 (section) 中的一個其他節點::class:" +"`Constant`、:class:`Name`、:class:`Lambda`、:class:`Yield` 或 :class:" +"`YieldFrom`" -#: ../../library/ast.rst:522 +#: ../../library/ast.rst:527 msgid "" ">>> print(ast.dump(ast.parse('-a'), indent=4))\n" "Module(\n" @@ -1061,14 +1068,14 @@ msgstr "" " op=USub(),\n" " operand=Name(id='a', ctx=Load())))])" -#: ../../library/ast.rst:535 +#: ../../library/ast.rst:540 msgid "" "A unary operation. ``op`` is the operator, and ``operand`` any expression " "node." msgstr "" "一元運算 (unary operation)。``op`` 是運算子,``operand`` 是任何運算式節點。" -#: ../../library/ast.rst:544 +#: ../../library/ast.rst:549 msgid "" "Unary operator tokens. :class:`Not` is the ``not`` keyword, :class:`Invert` " "is the ``~`` operator." @@ -1076,7 +1083,7 @@ msgstr "" "一元運算子標記。 :class:`Not` 是 ``not`` 關鍵字、:class:`Invert` 是 ``~`` 運" "算子。" -#: ../../library/ast.rst:547 +#: ../../library/ast.rst:552 msgid "" ">>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4))\n" "Expression(\n" @@ -1090,7 +1097,7 @@ msgstr "" " op=Not(),\n" " operand=Name(id='x', ctx=Load())))" -#: ../../library/ast.rst:558 +#: ../../library/ast.rst:563 msgid "" "A binary operation (like addition or division). ``op`` is the operator, and " "``left`` and ``right`` are any expression nodes." @@ -1098,7 +1105,7 @@ msgstr "" "二元運算 (binary operation)(如加法或除法)。 ``op`` 是運算子、``left`` 和 " "``right`` 是任意運算式節點。" -#: ../../library/ast.rst:561 +#: ../../library/ast.rst:566 msgid "" ">>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4))\n" "Expression(\n" @@ -1114,11 +1121,11 @@ msgstr "" " op=Add(),\n" " right=Name(id='y', ctx=Load())))" -#: ../../library/ast.rst:585 +#: ../../library/ast.rst:590 msgid "Binary operator tokens." msgstr "二元運算子 token。" -#: ../../library/ast.rst:590 +#: ../../library/ast.rst:595 msgid "" "A boolean operation, 'or' or 'and'. ``op`` is :class:`Or` or :class:`And`. " "``values`` are the values involved. Consecutive operations with the same " @@ -1126,14 +1133,14 @@ msgid "" "values." msgstr "" "布林運算 'or' 或 'and'。``op`` 是 :class:`Or` 或 :class:`And`。``values`` 是" -"有所涉及的值。使用同一運算子的連續操作(例如 ``a or b or c``)會被折疊為具" -"有多個值的一個節點。" +"有所涉及的值。使用同一運算子的連續操作(例如 ``a or b or c``)會被折疊為具有" +"多個值的一個節點。" -#: ../../library/ast.rst:595 +#: ../../library/ast.rst:600 msgid "This doesn't include ``not``, which is a :class:`UnaryOp`." msgstr "這不包括 ``not``,它是一個 :class:`UnaryOp`。" -#: ../../library/ast.rst:597 +#: ../../library/ast.rst:602 msgid "" ">>> print(ast.dump(ast.parse('x or y', mode='eval'), indent=4))\n" "Expression(\n" @@ -1151,11 +1158,11 @@ msgstr "" " Name(id='x', ctx=Load()),\n" " Name(id='y', ctx=Load())]))" -#: ../../library/ast.rst:611 +#: ../../library/ast.rst:616 msgid "Boolean operator tokens." msgstr "布林運算子 token。" -#: ../../library/ast.rst:616 +#: ../../library/ast.rst:621 msgid "" "A comparison of two or more values. ``left`` is the first value in the " "comparison, ``ops`` the list of operators, and ``comparators`` the list of " @@ -1164,7 +1171,7 @@ msgstr "" "兩個或多個值的比較。``left`` 是比較中的第一個值、``ops`` 是運算子串列、" "``comparators`` 是要比較的第一個元素之後值的串列。" -#: ../../library/ast.rst:620 +#: ../../library/ast.rst:625 msgid "" ">>> print(ast.dump(ast.parse('1 <= a < 10', mode='eval'), indent=4))\n" "Expression(\n" @@ -1188,36 +1195,36 @@ msgstr "" " Name(id='a', ctx=Load()),\n" " Constant(value=10)]))" -#: ../../library/ast.rst:645 +#: ../../library/ast.rst:650 msgid "Comparison operator tokens." msgstr "比較運算子 token。" -#: ../../library/ast.rst:650 +#: ../../library/ast.rst:655 msgid "" -"A function call. ``func`` is the function, which will often be " -"a :class:`Name` or :class:`Attribute` object. Of the arguments:" +"A function call. ``func`` is the function, which will often be a :class:" +"`Name` or :class:`Attribute` object. Of the arguments:" msgstr "" -"一個函式呼叫。``func`` 是該函式,通常是一個 :class:`Name` " -"或 :class:`Attribute` 物件。而在引數中:" +"一個函式呼叫。``func`` 是該函式,通常是一個 :class:`Name` 或 :class:" +"`Attribute` 物件。而在引數中:" -#: ../../library/ast.rst:653 +#: ../../library/ast.rst:658 msgid "``args`` holds a list of the arguments passed by position." msgstr "``args`` 保存按位置傳遞的引數串列。" -#: ../../library/ast.rst:654 +#: ../../library/ast.rst:659 msgid "" "``keywords`` holds a list of :class:`.keyword` objects representing " "arguments passed by keyword." msgstr "" "``keywords`` 保存一個 :class:`.keyword` 物件串列,表示透過關鍵字傳遞的引數。" -#: ../../library/ast.rst:657 +#: ../../library/ast.rst:662 msgid "" "The ``args`` and ``keywords`` arguments are optional and default to empty " "lists." msgstr "``args`` 和 ``keywords`` 引數是可選的,預設為空串列。" -#: ../../library/ast.rst:659 +#: ../../library/ast.rst:664 msgid "" ">>> print(ast.dump(ast.parse('func(a, b=c, *d, **e)', mode='eval'), " "indent=4))\n" @@ -1253,7 +1260,7 @@ msgstr "" " keyword(\n" " value=Name(id='e', ctx=Load()))]))" -#: ../../library/ast.rst:680 +#: ../../library/ast.rst:685 msgid "" "A keyword argument to a function call or class definition. ``arg`` is a raw " "string of the parameter name, ``value`` is a node to pass in." @@ -1261,7 +1268,7 @@ msgstr "" "函式呼叫或類別定義的關鍵字引數。``arg`` 是參數名稱的原始字串,``value`` 是要" "傳入的節點。" -#: ../../library/ast.rst:686 +#: ../../library/ast.rst:691 msgid "" "An expression such as ``a if b else c``. Each field holds a single node, so " "in the following example, all three are :class:`Name` nodes." @@ -1269,7 +1276,7 @@ msgstr "" "像是 ``a if b else c`` 之類的運算式。每個欄位都保存一個節點,因此在以下範例" "中,所有三個都是 :class:`Name` 節點。" -#: ../../library/ast.rst:689 +#: ../../library/ast.rst:694 msgid "" ">>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4))\n" "Expression(\n" @@ -1285,18 +1292,18 @@ msgstr "" " body=Name(id='a', ctx=Load()),\n" " orelse=Name(id='c', ctx=Load())))" -#: ../../library/ast.rst:701 +#: ../../library/ast.rst:706 msgid "" -"Attribute access, e.g. ``d.keys``. ``value`` is a node, typically " -"a :class:`Name`. ``attr`` is a bare string giving the name of the attribute, " -"and ``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to " -"how the attribute is acted on." +"Attribute access, e.g. ``d.keys``. ``value`` is a node, typically a :class:" +"`Name`. ``attr`` is a bare string giving the name of the attribute, and " +"``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to how " +"the attribute is acted on." msgstr "" "屬性的存取,例如 ``d.keys``。``value`` 是一個節點,通常是一個 :class:`Name`。" -"``attr`` 是一個屬性名稱的字串,``ctx`` 根據屬性的作用方式可能" -"是 :class:`Load`、:class:`Store` 或 :class:`Del`。" +"``attr`` 是一個屬性名稱的字串,``ctx`` 根據屬性的作用方式可能是 :class:" +"`Load`、:class:`Store` 或 :class:`Del`。" -#: ../../library/ast.rst:706 +#: ../../library/ast.rst:711 msgid "" ">>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4))\n" "Expression(\n" @@ -1312,18 +1319,18 @@ msgstr "" " attr='colour',\n" " ctx=Load()))" -#: ../../library/ast.rst:718 +#: ../../library/ast.rst:723 msgid "" "A named expression. This AST node is produced by the assignment expressions " -"operator (also known as the walrus operator). As opposed to " -"the :class:`Assign` node in which the first argument can be multiple nodes, " -"in this case both ``target`` and ``value`` must be single nodes." +"operator (also known as the walrus operator). As opposed to the :class:" +"`Assign` node in which the first argument can be multiple nodes, in this " +"case both ``target`` and ``value`` must be single nodes." msgstr "" "一個附名運算式 (named expression)。該 AST 節點由賦值運算式運算子(也稱為海象" "運算子)產生。相對於 :class:`Assign` 節點之第一個引數可為多個節點,在這種情況" "下 ``target`` 和 ``value`` 都必須是單個節點。" -#: ../../library/ast.rst:723 +#: ../../library/ast.rst:728 msgid "" ">>> print(ast.dump(ast.parse('(x := 4)', mode='eval'), indent=4))\n" "Expression(\n" @@ -1337,24 +1344,23 @@ msgstr "" " target=Name(id='x', ctx=Store()),\n" " value=Constant(value=4)))" -#: ../../library/ast.rst:734 +#: ../../library/ast.rst:739 msgid "Subscripting" msgstr "下標 (Subscripting)" -#: ../../library/ast.rst:738 +#: ../../library/ast.rst:743 msgid "" "A subscript, such as ``l[1]``. ``value`` is the subscripted object (usually " -"sequence or mapping). ``slice`` is an index, slice or key. It can be " -"a :class:`Tuple` and contain a :class:`Slice`. ``ctx`` " -"is :class:`Load`, :class:`Store` or :class:`Del` according to the action " -"performed with the subscript." +"sequence or mapping). ``slice`` is an index, slice or key. It can be a :" +"class:`Tuple` and contain a :class:`Slice`. ``ctx`` is :class:`Load`, :class:" +"`Store` or :class:`Del` according to the action performed with the subscript." msgstr "" "一個下標,例如 ``l[1]``。``value`` 是下標物件(通常是序列或對映)。``slice`` " "是索引、切片或鍵。它可以是一個 :class:`Tuple` 並包含一個 :class:`Slice`。根據" -"下標執行的操作不同,``ctx`` 可以是 :class:`Load`、:class:`Store` " -"或 :class:`Del`。" +"下標執行的操作不同,``ctx`` 可以是 :class:`Load`、:class:`Store` 或 :class:" +"`Del`。" -#: ../../library/ast.rst:744 +#: ../../library/ast.rst:749 msgid "" ">>> print(ast.dump(ast.parse('l[1:2, 3]', mode='eval'), indent=4))\n" "Expression(\n" @@ -1382,16 +1388,16 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))" -#: ../../library/ast.rst:762 +#: ../../library/ast.rst:767 msgid "" "Regular slicing (on the form ``lower:upper`` or ``lower:upper:step``). Can " "occur only inside the *slice* field of :class:`Subscript`, either directly " "or as an element of :class:`Tuple`." msgstr "" -"常規切片(形式為 ``lower:upper`` 或 ``lower:upper:step``)。只能直接或者或" -"者作為 :class:`Tuple` 的元素出現在 :class:`Subscript` 的 *slice* 欄位內。" +"常規切片(形式為 ``lower:upper`` 或 ``lower:upper:step``)。只能直接或者或者" +"作為 :class:`Tuple` 的元素出現在 :class:`Subscript` 的 *slice* 欄位內。" -#: ../../library/ast.rst:766 +#: ../../library/ast.rst:771 msgid "" ">>> print(ast.dump(ast.parse('l[1:2]', mode='eval'), indent=4))\n" "Expression(\n" @@ -1411,11 +1417,11 @@ msgstr "" " upper=Constant(value=2)),\n" " ctx=Load()))" -#: ../../library/ast.rst:779 +#: ../../library/ast.rst:784 msgid "Comprehensions" msgstr "綜合運算式 (comprehensions)" -#: ../../library/ast.rst:786 +#: ../../library/ast.rst:791 msgid "" "List and set comprehensions, generator expressions, and dictionary " "comprehensions. ``elt`` (or ``key`` and ``value``) is a single node " @@ -1424,11 +1430,11 @@ msgstr "" "串列和集合綜合運算、生成器運算式和字典綜合運算。``elt``\\ (或 ``key`` 和 " "``value``)是單個節點,表示各個項目會被求值 (evaluate) 的部分。" -#: ../../library/ast.rst:790 +#: ../../library/ast.rst:795 msgid "``generators`` is a list of :class:`comprehension` nodes." msgstr "``generators`` 是一個 :class:`comprehension` 節點的串列。" -#: ../../library/ast.rst:792 +#: ../../library/ast.rst:797 msgid "" ">>> print(ast.dump(\n" "... ast.parse('[x for x in numbers]', mode='eval'),\n" @@ -1512,18 +1518,18 @@ msgstr "" " iter=Name(id='numbers', ctx=Load()),\n" " is_async=0)]))" -#: ../../library/ast.rst:838 +#: ../../library/ast.rst:843 msgid "" "One ``for`` clause in a comprehension. ``target`` is the reference to use " "for each element - typically a :class:`Name` or :class:`Tuple` node. " "``iter`` is the object to iterate over. ``ifs`` is a list of test " "expressions: each ``for`` clause can have multiple ``ifs``." msgstr "" -"綜合運算中的一個 ``for`` 子句。``target`` 是用於每個元素的參照 - 通常" -"是 :class:`Name` 或 :class:`Tuple` 節點。``iter`` 是要疊代的物件。``ifs`` 是" -"測試運算式的串列:每個 ``for`` 子句可以有多個 ``ifs``。" +"綜合運算中的一個 ``for`` 子句。``target`` 是用於每個元素的參照 - 通常是 :" +"class:`Name` 或 :class:`Tuple` 節點。``iter`` 是要疊代的物件。``ifs`` 是測試" +"運算式的串列:每個 ``for`` 子句可以有多個 ``ifs``。" -#: ../../library/ast.rst:843 +#: ../../library/ast.rst:848 msgid "" "``is_async`` indicates a comprehension is asynchronous (using an ``async " "for`` instead of ``for``). The value is an integer (0 or 1)." @@ -1531,7 +1537,7 @@ msgstr "" "``is_async`` 表示綜合運算式是非同步的(使用 ``async for`` 而不是 ``for`` )。" "該值為整數(0 或 1)。" -#: ../../library/ast.rst:846 +#: ../../library/ast.rst:851 msgid "" ">>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', " "mode='eval'),\n" @@ -1649,17 +1655,17 @@ msgstr "" " iter=Name(id='soc', ctx=Load()),\n" " is_async=1)]))" -#: ../../library/ast.rst:908 +#: ../../library/ast.rst:913 msgid "Statements" msgstr "陳述式" -#: ../../library/ast.rst:912 +#: ../../library/ast.rst:917 msgid "" "An assignment. ``targets`` is a list of nodes, and ``value`` is a single " "node." msgstr "一個賦值。``targets`` 是節點串列,``value`` 是單個節點。" -#: ../../library/ast.rst:914 +#: ../../library/ast.rst:919 msgid "" "Multiple nodes in ``targets`` represents assigning the same value to each. " "Unpacking is represented by putting a :class:`Tuple` or :class:`List` within " @@ -1668,13 +1674,13 @@ msgstr "" "``targets`` 中的多個節點表示為每個節點分配相同的值。解包是透過在 ``targets`` " "中放置一個 :class:`Tuple` 或 :class:`List` 來表示的。" -#: ../../library/ast.rst:920 ../../library/ast.rst:1215 -#: ../../library/ast.rst:1409 ../../library/ast.rst:1975 +#: ../../library/ast.rst:925 ../../library/ast.rst:1220 +#: ../../library/ast.rst:1414 ../../library/ast.rst:1980 msgid "" "``type_comment`` is an optional string with the type annotation as a comment." msgstr "``type_comment`` 是一個可選字串,其中的註解為型別註釋。" -#: ../../library/ast.rst:922 +#: ../../library/ast.rst:927 msgid "" ">>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment\n" "Module(\n" @@ -1718,32 +1724,31 @@ msgstr "" " ctx=Store())],\n" " value=Name(id='c', ctx=Load()))])" -#: ../../library/ast.rst:948 +#: ../../library/ast.rst:953 msgid "" "An assignment with a type annotation. ``target`` is a single node and can be " "a :class:`Name`, an :class:`Attribute` or a :class:`Subscript`. " -"``annotation`` is the annotation, such as a :class:`Constant` " -"or :class:`Name` node. ``value`` is a single optional node." +"``annotation`` is the annotation, such as a :class:`Constant` or :class:" +"`Name` node. ``value`` is a single optional node." msgstr "" -"帶有型別註釋的賦值。``target`` 是單個節點,可以" -"是 :class:`Name`、:class:`Attribute` 或 :class:`Subscript`。``annotation`` 是" -"註釋,例如 :class:`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節" -"點。" +"帶有型別註釋的賦值。``target`` 是單個節點,可以是 :class:`Name`、:class:" +"`Attribute` 或 :class:`Subscript`。``annotation`` 是註釋,例如 :class:" +"`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節點。" -#: ../../library/ast.rst:953 +#: ../../library/ast.rst:958 msgid "" "``simple`` is always either 0 (indicating a \"complex\" target) or 1 " -"(indicating a \"simple\" target). A \"simple\" target consists solely of " -"a :class:`Name` node that does not appear between parentheses; all other " -"targets are considered complex. Only simple targets appear in " -"the :attr:`~object.__annotations__` dictionary of modules and classes." +"(indicating a \"simple\" target). A \"simple\" target consists solely of a :" +"class:`Name` node that does not appear between parentheses; all other " +"targets are considered complex. Only simple targets appear in the :attr:" +"`~object.__annotations__` dictionary of modules and classes." msgstr "" "``simple`` 總會是 0(表示一個「複雜」目標)或 1(表示一個「簡單」目標)。一個" "「簡單」目標僅包含一個 :class:`Name` 節點,且不出現在括號之間;所有其他目標都" -"被視為是複雜的。只有簡單目標會出現在模組和類別" -"的 :attr:`~object.__annotations__` 字典中。" +"被視為是複雜的。只有簡單目標會出現在模組和類別的 :attr:`~object." +"__annotations__` 字典中。" -#: ../../library/ast.rst:959 +#: ../../library/ast.rst:964 msgid "" ">>> print(ast.dump(ast.parse('c: int'), indent=4))\n" "Module(\n" @@ -1827,7 +1832,7 @@ msgstr "" " annotation=Name(id='int', ctx=Load()),\n" " simple=0)])" -#: ../../library/ast.rst:1003 +#: ../../library/ast.rst:1008 msgid "" "Augmented assignment, such as ``a += 1``. In the following example, " "``target`` is a :class:`Name` node for ``x`` (with the :class:`Store` " @@ -1835,18 +1840,18 @@ msgid "" "value for 1." msgstr "" "增加賦值 (augmented assignment),例如 ``a += 1``。在下面的範例中,``target`` " -"是 ``x`` 的 :class:`Name` 節點(帶有 :class:`Store` 情境),``op`` " -"是 :class:`Add`,``value`` 是一個值為 1 的 :class:`Constant`。" +"是 ``x`` 的 :class:`Name` 節點(帶有 :class:`Store` 情境),``op`` 是 :class:" +"`Add`,``value`` 是一個值為 1 的 :class:`Constant`。" -#: ../../library/ast.rst:1008 +#: ../../library/ast.rst:1013 msgid "" "The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, " "unlike the targets of :class:`Assign`." msgstr "" -"與 :class:`Assign` 的目標不同,``target`` 屬性不能屬於 :class:`Tuple` " -"或 :class:`List` 類別。" +"與 :class:`Assign` 的目標不同,``target`` 屬性不能屬於 :class:`Tuple` 或 :" +"class:`List` 類別。" -#: ../../library/ast.rst:1011 +#: ../../library/ast.rst:1016 msgid "" ">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" "Module(\n" @@ -1864,17 +1869,17 @@ msgstr "" " op=Add(),\n" " value=Constant(value=2))])" -#: ../../library/ast.rst:1024 +#: ../../library/ast.rst:1029 msgid "" "A ``raise`` statement. ``exc`` is the exception object to be raised, " "normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone " "``raise``. ``cause`` is the optional part for ``y`` in ``raise x from y``." msgstr "" -"一個 ``raise`` 陳述式。``exc`` 是要引發的例外物件,通常是 :class:`Call` " -"或 :class:`Name`,若是獨立的 ``raise`` 則為 ``None``。``cause`` 是 ``raise x " +"一個 ``raise`` 陳述式。``exc`` 是要引發的例外物件,通常是 :class:`Call` 或 :" +"class:`Name`,若是獨立的 ``raise`` 則為 ``None``。``cause`` 是 ``raise x " "from y`` 中的可選部分 ``y``。" -#: ../../library/ast.rst:1028 +#: ../../library/ast.rst:1033 msgid "" ">>> print(ast.dump(ast.parse('raise x from y'), indent=4))\n" "Module(\n" @@ -1890,7 +1895,7 @@ msgstr "" " exc=Name(id='x', ctx=Load()),\n" " cause=Name(id='y', ctx=Load()))])" -#: ../../library/ast.rst:1040 +#: ../../library/ast.rst:1045 msgid "" "An assertion. ``test`` holds the condition, such as a :class:`Compare` node. " "``msg`` holds the failure message." @@ -1898,7 +1903,7 @@ msgstr "" "一個斷言 (assertion)。``test`` 保存條件,例如 :class:`Compare` 節點。``msg`` " "保存失敗訊息。" -#: ../../library/ast.rst:1043 +#: ../../library/ast.rst:1048 msgid "" ">>> print(ast.dump(ast.parse('assert x,y'), indent=4))\n" "Module(\n" @@ -1914,15 +1919,15 @@ msgstr "" " test=Name(id='x', ctx=Load()),\n" " msg=Name(id='y', ctx=Load()))])" -#: ../../library/ast.rst:1055 +#: ../../library/ast.rst:1060 msgid "" -"Represents a ``del`` statement. ``targets`` is a list of nodes, such " -"as :class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." +"Represents a ``del`` statement. ``targets`` is a list of nodes, such as :" +"class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." msgstr "" -"代表一個 ``del`` 陳述式。``targets`` 是節點串列,例" -"如 :class:`Name`、:class:`Attribute` 或 :class:`Subscript` 節點。" +"代表一個 ``del`` 陳述式。``targets`` 是節點串列,例如 :class:`Name`、:class:" +"`Attribute` 或 :class:`Subscript` 節點。" -#: ../../library/ast.rst:1058 +#: ../../library/ast.rst:1063 msgid "" ">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" "Module(\n" @@ -1942,11 +1947,11 @@ msgstr "" " Name(id='y', ctx=Del()),\n" " Name(id='z', ctx=Del())])])" -#: ../../library/ast.rst:1072 +#: ../../library/ast.rst:1077 msgid "A ``pass`` statement." msgstr "一個 ``pass`` 陳述式。" -#: ../../library/ast.rst:1074 +#: ../../library/ast.rst:1079 msgid "" ">>> print(ast.dump(ast.parse('pass'), indent=4))\n" "Module(\n" @@ -1958,18 +1963,18 @@ msgstr "" " body=[\n" " Pass()])" -#: ../../library/ast.rst:1084 +#: ../../library/ast.rst:1089 msgid "" "A :ref:`type alias ` created through the :keyword:`type` " -"statement. ``name`` is the name of the alias, ``type_params`` is a list " -"of :ref:`type parameters `, and ``value`` is the value of " -"the type alias." +"statement. ``name`` is the name of the alias, ``type_params`` is a list of :" +"ref:`type parameters `, and ``value`` is the value of the " +"type alias." msgstr "" "透過 :keyword:`type` 陳述式建立的\\ :ref:`型別別名 (type alias) `。``name`` 是別名的名稱、``type_params`` 是\\ :ref:`型別參數 (type " "parameter) ` 的串列、``value`` 是型別別名的值。" -#: ../../library/ast.rst:1089 +#: ../../library/ast.rst:1094 msgid "" ">>> print(ast.dump(ast.parse('type Alias = int'), indent=4))\n" "Module(\n" @@ -1985,21 +1990,21 @@ msgstr "" " name=Name(id='Alias', ctx=Store()),\n" " value=Name(id='int', ctx=Load()))])" -#: ../../library/ast.rst:1100 +#: ../../library/ast.rst:1105 msgid "" "Other statements which are only applicable inside functions or loops are " "described in other sections." msgstr "其他僅適用於函式或迴圈內部的陳述式將在其他部分中描述。" -#: ../../library/ast.rst:1104 +#: ../../library/ast.rst:1109 msgid "Imports" msgstr "引入 (imports)" -#: ../../library/ast.rst:1108 +#: ../../library/ast.rst:1113 msgid "An import statement. ``names`` is a list of :class:`alias` nodes." msgstr "一個 import 陳述式。``names`` 是 :class:`alias` 節點的串列。" -#: ../../library/ast.rst:1110 +#: ../../library/ast.rst:1115 msgid "" ">>> print(ast.dump(ast.parse('import x,y,z'), indent=4))\n" "Module(\n" @@ -2019,7 +2024,7 @@ msgstr "" " alias(name='y'),\n" " alias(name='z')])])" -#: ../../library/ast.rst:1124 +#: ../../library/ast.rst:1129 msgid "" "Represents ``from x import y``. ``module`` is a raw string of the 'from' " "name, without any leading dots, or ``None`` for statements such as ``from . " @@ -2030,7 +2035,7 @@ msgstr "" "點 (dot),或者對於諸如 ``from . import foo`` 之類的陳述式則為 ``None``。" "``level`` 是一個整數,保存相對引入的級別(0 表示絕對引入)。" -#: ../../library/ast.rst:1129 +#: ../../library/ast.rst:1134 msgid "" ">>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))\n" "Module(\n" @@ -2054,7 +2059,7 @@ msgstr "" " alias(name='z')],\n" " level=0)])" -#: ../../library/ast.rst:1145 +#: ../../library/ast.rst:1150 msgid "" "Both parameters are raw strings of the names. ``asname`` can be ``None`` if " "the regular name is to be used." @@ -2062,7 +2067,7 @@ msgstr "" "這兩個參數都是名稱的原始字串。如果要使用常規名稱,``asname`` 可以為 " "``None``。" -#: ../../library/ast.rst:1148 +#: ../../library/ast.rst:1153 msgid "" ">>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))\n" "Module(\n" @@ -2084,25 +2089,25 @@ msgstr "" " alias(name='c')],\n" " level=2)])" -#: ../../library/ast.rst:1161 +#: ../../library/ast.rst:1166 msgid "Control flow" msgstr "流程控制" -#: ../../library/ast.rst:1164 +#: ../../library/ast.rst:1169 msgid "" "Optional clauses such as ``else`` are stored as an empty list if they're not " "present." msgstr "諸如 ``else`` 之類的可選子句如果不存在,則將被儲存為空串列。" -#: ../../library/ast.rst:1169 +#: ../../library/ast.rst:1174 msgid "" -"An ``if`` statement. ``test`` holds a single node, such as " -"a :class:`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." +"An ``if`` statement. ``test`` holds a single node, such as a :class:" +"`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." msgstr "" "一個 ``if`` 陳述式。``test`` 保存單個節點,例如 :class:`Compare` 節點。" "``body`` 和 ``orelse`` 各自保存一個節點串列。" -#: ../../library/ast.rst:1172 +#: ../../library/ast.rst:1177 msgid "" "``elif`` clauses don't have a special representation in the AST, but rather " "appear as extra :class:`If` nodes within the ``orelse`` section of the " @@ -2111,7 +2116,7 @@ msgstr "" "``elif`` 子句在 AST 中沒有特殊表示,而是在前一個子句的 ``orelse`` 部分中作為" "額外的 :class:`If` 節點出現。" -#: ../../library/ast.rst:1176 +#: ../../library/ast.rst:1181 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... if x:\n" @@ -2163,22 +2168,22 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1206 +#: ../../library/ast.rst:1211 msgid "" "A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a " -"single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` " -"or :class:`Subscript` node. ``iter`` holds the item to be looped over, again " -"as a single node. ``body`` and ``orelse`` contain lists of nodes to execute. " +"single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` or :" +"class:`Subscript` node. ``iter`` holds the item to be looped over, again as " +"a single node. ``body`` and ``orelse`` contain lists of nodes to execute. " "Those in ``orelse`` are executed if the loop finishes normally, rather than " "via a ``break`` statement." msgstr "" -"一個 ``for`` 迴圈。 ``target`` 保存迴圈賦予的變數,為單" -"個 :class:`Name`、:class:`Tuple`、:class:`List`、:class:`Attribute` " -"或 :class:`Subscript` 節點。``iter`` 保存要迴圈跑過的項目,也為單個節點。" -"``body`` 和 ``orelse`` 包含要執行的節點串列。如果迴圈正常完成,則執行 " -"``orelse`` 中的內容,而不是透過 ``break`` 陳述式執行。" +"一個 ``for`` 迴圈。 ``target`` 保存迴圈賦予的變數,為單個 :class:`Name`、:" +"class:`Tuple`、:class:`List`、:class:`Attribute` 或 :class:`Subscript` 節點。" +"``iter`` 保存要迴圈跑過的項目,也為單個節點。``body`` 和 ``orelse`` 包含要執" +"行的節點串列。如果迴圈正常完成,則執行 ``orelse`` 中的內容,而不是透過 " +"``break`` 陳述式執行。" -#: ../../library/ast.rst:1217 +#: ../../library/ast.rst:1222 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... for x in y:\n" @@ -2216,13 +2221,13 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])" -#: ../../library/ast.rst:1240 +#: ../../library/ast.rst:1245 msgid "" "A ``while`` loop. ``test`` holds the condition, such as a :class:`Compare` " "node." msgstr "一個 ``while`` 迴圈。``test`` 保存條件,例如 :class:`Compare` 節點。" -#: ../../library/ast.rst:1243 +#: ../../library/ast.rst:1248 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" @@ -2258,11 +2263,11 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])" -#: ../../library/ast.rst:1266 +#: ../../library/ast.rst:1271 msgid "The ``break`` and ``continue`` statements." msgstr "``break`` 和 ``continue`` 陳述式。" -#: ../../library/ast.rst:1268 +#: ../../library/ast.rst:1273 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... for a in b:\n" @@ -2316,7 +2321,7 @@ msgstr "" " orelse=[\n" " Continue()])])])" -#: ../../library/ast.rst:1299 +#: ../../library/ast.rst:1304 msgid "" "``try`` blocks. All attributes are list of nodes to execute, except for " "``handlers``, which is a list of :class:`ExceptHandler` nodes." @@ -2324,7 +2329,7 @@ msgstr "" "``try`` 區塊。除 ``handlers`` 是 :class:`ExceptHandler` 節點的串列外,其他所" "有屬性都是要執行之節點的串列。" -#: ../../library/ast.rst:1302 +#: ../../library/ast.rst:1307 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2400,7 +2405,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])" -#: ../../library/ast.rst:1344 +#: ../../library/ast.rst:1349 msgid "" "``try`` blocks which are followed by ``except*`` clauses. The attributes are " "the same as for :class:`Try` but the :class:`ExceptHandler` nodes in " @@ -2410,7 +2415,7 @@ msgstr "" "``handlers`` 中的 :class:`ExceptHandler` 節點被直譯 (interpret) 為 " "``except*`` 區塊而不是 ``except``。" -#: ../../library/ast.rst:1348 +#: ../../library/ast.rst:1353 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2450,19 +2455,19 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1373 +#: ../../library/ast.rst:1378 msgid "" "A single ``except`` clause. ``type`` is the exception type it will match, " "typically a :class:`Name` node (or ``None`` for a catch-all ``except:`` " "clause). ``name`` is a raw string for the name to hold the exception, or " "``None`` if the clause doesn't have ``as foo``. ``body`` is a list of nodes." msgstr "" -"單個 ``except`` 子句。``type`` 是會被匹配的例外型別,通常是一" -"個 :class:`Name` 節點(或者 ``None`` 表示會捕捉到所有例外的 ``except:`` 子" -"句)。``name`` 是用於保存例外的名稱之原始字串,如果子句沒有 ``as foo`` ,則" -"為 ``None``。``body`` 是節點串列。" +"單個 ``except`` 子句。``type`` 是會被匹配的例外型別,通常是一個 :class:" +"`Name` 節點(或者 ``None`` 表示會捕捉到所有例外的 ``except:`` 子句)。" +"``name`` 是用於保存例外的名稱之原始字串,如果子句沒有 ``as foo`` ,則為 " +"``None``。``body`` 是節點串列。" -#: ../../library/ast.rst:1378 +#: ../../library/ast.rst:1383 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... try:\n" @@ -2506,7 +2511,7 @@ msgstr "" " body=[\n" " Pass()])])])" -#: ../../library/ast.rst:1404 +#: ../../library/ast.rst:1409 msgid "" "A ``with`` block. ``items`` is a list of :class:`withitem` nodes " "representing the context managers, and ``body`` is the indented block inside " @@ -2515,19 +2520,18 @@ msgstr "" "一個 ``with`` 區塊。``items`` 是表示情境管理器的 :class:`withitem` 節點串列," "``body`` 是情境內的縮進區塊。" -#: ../../library/ast.rst:1414 +#: ../../library/ast.rst:1419 msgid "" "A single context manager in a ``with`` block. ``context_expr`` is the " -"context manager, often a :class:`Call` node. ``optional_vars`` is " -"a :class:`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or " -"``None`` if that isn't used." +"context manager, often a :class:`Call` node. ``optional_vars`` is a :class:" +"`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or ``None`` " +"if that isn't used." msgstr "" -"``with`` 區塊中的單個情境管理器。``context_expr`` 是情境管理器,通常是一" -"個 :class:`Call` 節點。``Optional_vars`` 是 ``as foo`` 部分" -"的 :class:`Name`、:class:`Tuple` 或 :class:`List`,或者如果不使用則為 " -"``None`` 。" +"``with`` 區塊中的單個情境管理器。``context_expr`` 是情境管理器,通常是一個 :" +"class:`Call` 節點。``Optional_vars`` 是 ``as foo`` 部分的 :class:`Name`、:" +"class:`Tuple` 或 :class:`List`,或者如果不使用則為 ``None`` 。" -#: ../../library/ast.rst:1419 +#: ../../library/ast.rst:1424 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... with a as b, c as d:\n" @@ -2573,11 +2577,11 @@ msgstr "" " Name(id='b', ctx=Load()),\n" " Name(id='d', ctx=Load())]))])])" -#: ../../library/ast.rst:1445 +#: ../../library/ast.rst:1450 msgid "Pattern matching" msgstr "模式匹配 (pattern matching)" -#: ../../library/ast.rst:1450 +#: ../../library/ast.rst:1455 msgid "" "A ``match`` statement. ``subject`` holds the subject of the match (the " "object that is being matched against the cases) and ``cases`` contains an " @@ -2586,24 +2590,24 @@ msgstr "" "一個 ``match`` 陳述式。``subject`` 保存匹配的主題(與案例匹配的物件)," "``cases`` 包含具有不同案例的 :class:`match_case` 節點的可疊代物件。" -#: ../../library/ast.rst:1458 +#: ../../library/ast.rst:1463 msgid "" "A single case pattern in a ``match`` statement. ``pattern`` contains the " -"match pattern that the subject will be matched against. Note that " -"the :class:`AST` nodes produced for patterns differ from those produced for " +"match pattern that the subject will be matched against. Note that the :class:" +"`AST` nodes produced for patterns differ from those produced for " "expressions, even when they share the same syntax." msgstr "" "``match`` 陳述式中的單個案例模式。``pattern`` 包含主題將與之匹配的匹配模式。" "請注意,為模式生成的 :class:`AST` 節點與為運算式生成的節點不同,即使它們共享" "相同的語法。" -#: ../../library/ast.rst:1463 +#: ../../library/ast.rst:1468 msgid "" "The ``guard`` attribute contains an expression that will be evaluated if the " "pattern matches the subject." msgstr "``guard`` 屬性包含一個運算式,如果模式與主題匹配,則將對該運算式求值。" -#: ../../library/ast.rst:1466 +#: ../../library/ast.rst:1471 msgid "" "``body`` contains a list of nodes to execute if the pattern matches and the " "result of evaluating the guard expression is true." @@ -2611,7 +2615,7 @@ msgstr "" "``body`` 包含一個節點串列,如果模式匹配並且為防護運算式 (guard expression) 的" "求值 (evaluate) 結果為真,則會執行該節點串列。" -#: ../../library/ast.rst:1469 +#: ../../library/ast.rst:1474 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2677,7 +2681,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1507 +#: ../../library/ast.rst:1512 msgid "" "A match literal or value pattern that compares by equality. ``value`` is an " "expression node. Permitted value nodes are restricted as described in the " @@ -2687,7 +2691,7 @@ msgstr "" "以相等性進行比較的匹配文本或值的模式。``value`` 是一個運算式節點。允許值節點" "受到匹配陳述式文件中所述的限制。如果匹配主題等於求出值,則此模式成功。" -#: ../../library/ast.rst:1512 +#: ../../library/ast.rst:1517 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2723,7 +2727,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1535 +#: ../../library/ast.rst:1540 msgid "" "A match literal pattern that compares by identity. ``value`` is the " "singleton to be compared against: ``None``, ``True``, or ``False``. This " @@ -2733,7 +2737,7 @@ msgstr "" "``True`` 或 ``False`` 進行比較的單例 (singleton)。如果匹配主題是給定的常數," "則此模式成功。" -#: ../../library/ast.rst:1539 +#: ../../library/ast.rst:1544 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2767,7 +2771,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1561 +#: ../../library/ast.rst:1566 msgid "" "A match sequence pattern. ``patterns`` contains the patterns to be matched " "against the subject elements if the subject is a sequence. Matches a " @@ -2777,7 +2781,7 @@ msgstr "" "匹配序列模式。如果主題是一個序列,``patterns`` 包含與主題元素匹配的模式。如果" "子模式之一是 ``MatchStar`` 節點,則匹配可變長度序列,否則匹配固定長度序列。" -#: ../../library/ast.rst:1566 +#: ../../library/ast.rst:1571 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2821,7 +2825,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1593 +#: ../../library/ast.rst:1598 msgid "" "Matches the rest of the sequence in a variable length match sequence " "pattern. If ``name`` is not ``None``, a list containing the remaining " @@ -2831,7 +2835,7 @@ msgstr "" "以可變長度匹配序列模式匹配序列的其餘部分。如果 ``name`` 不是 ``None``,則如果" "整體序列模式成功,則包含其餘序列元素的串列將綁定到該名稱。" -#: ../../library/ast.rst:1597 +#: ../../library/ast.rst:1602 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2895,7 +2899,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1634 +#: ../../library/ast.rst:1639 msgid "" "A match mapping pattern. ``keys`` is a sequence of expression nodes. " "``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an " @@ -2907,7 +2911,7 @@ msgstr "" "列。``rest`` 是一個可選名稱,可以指定它來捕獲剩餘的對映元素。允許的鍵運算式受" "到匹配陳述式文件中所述的限制。" -#: ../../library/ast.rst:1640 +#: ../../library/ast.rst:1645 msgid "" "This pattern succeeds if the subject is a mapping, all evaluated key " "expressions are present in the mapping, and the value corresponding to each " @@ -2919,7 +2923,7 @@ msgstr "" "應的子模式匹配,則此模式成功。如果 ``rest`` 不是 ``None``,則如果整體對映模式" "成功,則包含其餘對映元素的字典將綁定到該名稱。" -#: ../../library/ast.rst:1646 +#: ../../library/ast.rst:1651 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2979,7 +2983,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1681 +#: ../../library/ast.rst:1686 msgid "" "A match class pattern. ``cls`` is an expression giving the nominal class to " "be matched. ``patterns`` is a sequence of pattern nodes to be matched " @@ -2994,7 +2998,7 @@ msgstr "" "``kwd_attrs`` 是要匹配的附加屬性序列(在類別模式中指定為關鍵字引數)," "``kwd_patterns`` 是相應的模式(在類別模式中指定為關鍵字的值)。" -#: ../../library/ast.rst:1688 +#: ../../library/ast.rst:1693 msgid "" "This pattern succeeds if the subject is an instance of the nominated class, " "all positional patterns match the corresponding class-defined attributes, " @@ -3003,7 +3007,7 @@ msgstr "" "如果主題是指定類別的實例,所有位置模式都與相應的類別定義屬性匹配,並且任何指" "定的關鍵字屬性與其相應模式匹配,則此模式成功。" -#: ../../library/ast.rst:1692 +#: ../../library/ast.rst:1697 msgid "" "Note: classes may define a property that returns self in order to match a " "pattern node against the instance being matched. Several builtin types are " @@ -3012,7 +3016,7 @@ msgstr "" "注意:類別可以定義一個回傳 self 的特性 (property),以便將模式節點與正在匹配的" "實例進行匹配。一些內建型別也以這種方式匹配,如同匹配陳述式文件中所述。" -#: ../../library/ast.rst:1696 +#: ../../library/ast.rst:1701 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3096,7 +3100,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1743 +#: ../../library/ast.rst:1748 msgid "" "A match \"as-pattern\", capture pattern or wildcard pattern. ``pattern`` " "contains the match pattern that the subject will be matched against. If the " @@ -3107,7 +3111,7 @@ msgstr "" "(wildcard pattern)。``pattern`` 包含主題將與之匹配的匹配模式。如果模式為 " "``None``,則該節點代表捕獲模式(即裸名 (bare name))並且始終會成功。" -#: ../../library/ast.rst:1748 +#: ../../library/ast.rst:1753 msgid "" "The ``name`` attribute contains the name that will be bound if the pattern " "is successful. If ``name`` is ``None``, ``pattern`` must also be ``None`` " @@ -3116,7 +3120,7 @@ msgstr "" "``name`` 屬性包含模式成功時將綁定的名稱。如果 ``name`` 為 ``None``,則 " "``pattern`` 也必須為 ``None``,並且節點代表通配模式。" -#: ../../library/ast.rst:1752 +#: ../../library/ast.rst:1757 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3172,7 +3176,7 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1785 +#: ../../library/ast.rst:1790 msgid "" "A match \"or-pattern\". An or-pattern matches each of its subpatterns in " "turn to the subject, until one succeeds. The or-pattern is then deemed to " @@ -3184,7 +3188,7 @@ msgstr "" "到成功為止,然後 or 模式就會被認為是成功的。如果沒有一個子模式成功,則 or 模" "式將失敗。 ``patterns`` 屬性包含將與主題進行匹配的匹配模式節點串列。" -#: ../../library/ast.rst:1791 +#: ../../library/ast.rst:1796 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3228,17 +3232,17 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1818 +#: ../../library/ast.rst:1823 msgid "Type annotations" msgstr "" -#: ../../library/ast.rst:1822 +#: ../../library/ast.rst:1827 msgid "" "A ``# type: ignore`` comment located at *lineno*. *tag* is the optional tag " "specified by the form ``# type: ignore ``." msgstr "" -#: ../../library/ast.rst:1825 +#: ../../library/ast.rst:1830 msgid "" ">>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), " "indent=4))\n" @@ -3284,37 +3288,37 @@ msgstr "" " type_ignores=[\n" " TypeIgnore(lineno=1, tag='[assignment]')])" -#: ../../library/ast.rst:1848 +#: ../../library/ast.rst:1853 msgid "" ":class:`!TypeIgnore` nodes are not generated when the *type_comments* " "parameter is set to ``False`` (default). See :func:`ast.parse` for more " "details." msgstr "" -#: ../../library/ast.rst:1856 +#: ../../library/ast.rst:1861 msgid "Type parameters" msgstr "型別參數 (type parameters)" -#: ../../library/ast.rst:1858 +#: ../../library/ast.rst:1863 msgid "" ":ref:`Type parameters ` can exist on classes, functions, and " "type aliases." msgstr ":ref:`型別參數 `\\ 可以存在於類別、函式和型別別名上。" -#: ../../library/ast.rst:1863 +#: ../../library/ast.rst:1868 msgid "" "A :class:`typing.TypeVar`. ``name`` is the name of the type variable. " -"``bound`` is the bound or constraints, if any. If ``bound`` is " -"a :class:`Tuple`, it represents constraints; otherwise it represents the " -"bound. ``default_value`` is the default value; if the :class:`!TypeVar` has " -"no default, this attribute will be set to ``None``." +"``bound`` is the bound or constraints, if any. If ``bound`` is a :class:" +"`Tuple`, it represents constraints; otherwise it represents the bound. " +"``default_value`` is the default value; if the :class:`!TypeVar` has no " +"default, this attribute will be set to ``None``." msgstr "" "一個 :class:`typing.TypeVar`。``name`` 是型別變數的名稱。``bound`` 是(如果有" -"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一" -"個 :class:`Tuple`,它代表約束;否則它代表界限。``default_value`` 為預設值;如" -"果 :class:`!TypeVar` 沒有預設值,那此屬性會被設為 ``None``。" +"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一個 :class:" +"`Tuple`,它代表約束;否則它代表界限。``default_value`` 為預設值;如果 :class:" +"`!TypeVar` 沒有預設值,那此屬性會被設為 ``None``。" -#: ../../library/ast.rst:1869 +#: ../../library/ast.rst:1874 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), " "indent=4))\n" @@ -3348,12 +3352,12 @@ msgstr "" " slice=Name(id='T', ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1888 ../../library/ast.rst:1923 -#: ../../library/ast.rst:1955 +#: ../../library/ast.rst:1893 ../../library/ast.rst:1928 +#: ../../library/ast.rst:1960 msgid "Added the *default_value* parameter." msgstr "新增 *default_value* 參數。" -#: ../../library/ast.rst:1893 +#: ../../library/ast.rst:1898 msgid "" "A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " "specification. ``default_value`` is the default value; if the :class:`!" @@ -3362,7 +3366,7 @@ msgstr "" "一個 :class:`typing.ParamSpec`。``name`` 是參數規範的名稱。``default_value`` " "是預設值;如果 :class:`!ParamSpec` 沒有預設值,則該屬性將設定為 ``None``。" -#: ../../library/ast.rst:1897 +#: ../../library/ast.rst:1902 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, " "int]\"), indent=4))\n" @@ -3410,7 +3414,7 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1928 +#: ../../library/ast.rst:1933 msgid "" "A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " "tuple. ``default_value`` is the default value; if the :class:`!TypeVarTuple` " @@ -3420,7 +3424,7 @@ msgstr "" "``default_value`` 為預設值;如果 :class:`!TypeVarTuple` 沒有預設值,那此屬性" "會被設為 ``None``。" -#: ../../library/ast.rst:1932 +#: ../../library/ast.rst:1937 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), " "indent=4))\n" @@ -3462,27 +3466,27 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1959 +#: ../../library/ast.rst:1964 msgid "Function and class definitions" msgstr "函式和類別定義" -#: ../../library/ast.rst:1963 +#: ../../library/ast.rst:1968 msgid "A function definition." msgstr "一個函式定義。" -#: ../../library/ast.rst:1965 +#: ../../library/ast.rst:1970 msgid "``name`` is a raw string of the function name." msgstr "``name`` 是函式名稱的原始字串。" -#: ../../library/ast.rst:1966 +#: ../../library/ast.rst:1971 msgid "``args`` is an :class:`arguments` node." msgstr "``args`` 是一個 :class:`arguments` 節點。" -#: ../../library/ast.rst:1967 +#: ../../library/ast.rst:1972 msgid "``body`` is the list of nodes inside the function." msgstr "``body`` 是函式內節點的串列。" -#: ../../library/ast.rst:1968 +#: ../../library/ast.rst:1973 msgid "" "``decorator_list`` is the list of decorators to be applied, stored outermost " "first (i.e. the first in the list will be applied last)." @@ -3490,20 +3494,20 @@ msgstr "" "``decorator_list`` 是要應用的裝飾器串列,在最外層者會被儲存在首位(即串列中首" "位將會是最後一個被應用的那個)。" -#: ../../library/ast.rst:1970 +#: ../../library/ast.rst:1975 msgid "``returns`` is the return annotation." msgstr "``returns`` 是回傳註釋。" -#: ../../library/ast.rst:1971 ../../library/ast.rst:2134 +#: ../../library/ast.rst:1976 ../../library/ast.rst:2139 msgid "``type_params`` is a list of :ref:`type parameters `." msgstr "``type_params`` 是\\ :ref:`型別參數 `\\ 的串列。" -#: ../../library/ast.rst:1977 ../../library/ast.rst:2161 -#: ../../library/ast.rst:2172 +#: ../../library/ast.rst:1982 ../../library/ast.rst:2166 +#: ../../library/ast.rst:2177 msgid "Added ``type_params``." msgstr "新增了 ``type_params``。" -#: ../../library/ast.rst:1983 +#: ../../library/ast.rst:1988 msgid "" "``lambda`` is a minimal function definition that can be used inside an " "expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." @@ -3511,7 +3515,7 @@ msgstr "" "``lambda`` 是可以在運算式內使用的最小函式定義。與 :class:`FunctionDef` 不同," "``body`` 保存單個節點。" -#: ../../library/ast.rst:1986 +#: ../../library/ast.rst:1991 msgid "" ">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" "Module(\n" @@ -3535,17 +3539,17 @@ msgstr "" " arg(arg='y')]),\n" " body=Constant(value=Ellipsis)))])" -#: ../../library/ast.rst:2002 +#: ../../library/ast.rst:2007 msgid "The arguments for a function." msgstr "函式的引數。" -#: ../../library/ast.rst:2004 +#: ../../library/ast.rst:2009 msgid "" "``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." msgstr "" "``posonlyargs``、``args`` 和 ``kwonlyargs`` 是 :class:`arg` 節點的串列。" -#: ../../library/ast.rst:2005 +#: ../../library/ast.rst:2010 msgid "" "``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the " "``*args, **kwargs`` parameters." @@ -3553,7 +3557,7 @@ msgstr "" "``vararg`` 和 ``kwarg`` 是單個 :class:`arg` 節點,指的是 ``*args, **kwargs`` " "參數。" -#: ../../library/ast.rst:2007 +#: ../../library/ast.rst:2012 msgid "" "``kw_defaults`` is a list of default values for keyword-only arguments. If " "one is ``None``, the corresponding argument is required." @@ -3561,7 +3565,7 @@ msgstr "" "``kw_defaults`` 是僅限關鍵字引數的預設值串列。如果其中某個為 ``None``,則相應" "參數就會是必要的。" -#: ../../library/ast.rst:2009 +#: ../../library/ast.rst:2014 msgid "" "``defaults`` is a list of default values for arguments that can be passed " "positionally. If there are fewer defaults, they correspond to the last n " @@ -3570,7 +3574,7 @@ msgstr "" "``defaults`` 是可以按位置傳遞的引數的預設值串列。如果預設值較少,則它們對應於" "最後 n 個引數。" -#: ../../library/ast.rst:2016 +#: ../../library/ast.rst:2021 msgid "" "A single argument in a list. ``arg`` is a raw string of the argument name; " "``annotation`` is its annotation, such as a :class:`Name` node." @@ -3578,12 +3582,12 @@ msgstr "" "串列中的單個引數。``arg`` 是引數名稱的原始字串,``annotation`` 是它的註釋,例" "如 :class:`Name` 節點。" -#: ../../library/ast.rst:2021 +#: ../../library/ast.rst:2026 msgid "" "``type_comment`` is an optional string with the type annotation as a comment" msgstr "``type_comment`` 是一個可選字串,其註解為型別註釋" -#: ../../library/ast.rst:2023 +#: ../../library/ast.rst:2028 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3657,11 +3661,11 @@ msgstr "" " Name(id='decorator2', ctx=Load())],\n" " returns=Constant(value='return annotation'))])" -#: ../../library/ast.rst:2063 +#: ../../library/ast.rst:2068 msgid "A ``return`` statement." msgstr "一個 ``return`` 陳述式。" -#: ../../library/ast.rst:2065 +#: ../../library/ast.rst:2070 msgid "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" @@ -3675,7 +3679,7 @@ msgstr "" " Return(\n" " value=Constant(value=4))])" -#: ../../library/ast.rst:2077 +#: ../../library/ast.rst:2082 msgid "" "A ``yield`` or ``yield from`` expression. Because these are expressions, " "they must be wrapped in an :class:`Expr` node if the value sent back is not " @@ -3684,7 +3688,7 @@ msgstr "" "一個 ``yield`` 或 ``yield from`` 運算式。因為這些是運算式,所以如果不使用發送" "回來的值,則必須將它們包裝在 :class:`Expr` 節點中。" -#: ../../library/ast.rst:2080 +#: ../../library/ast.rst:2085 msgid "" ">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" "Module(\n" @@ -3714,12 +3718,12 @@ msgstr "" " value=YieldFrom(\n" " value=Name(id='x', ctx=Load())))])" -#: ../../library/ast.rst:2100 +#: ../../library/ast.rst:2105 msgid "" "``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." msgstr "``global`` 和 ``nonlocal`` 陳述式。``names`` 是原始字串的串列。" -#: ../../library/ast.rst:2102 +#: ../../library/ast.rst:2107 msgid "" ">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" "Module(\n" @@ -3757,38 +3761,38 @@ msgstr "" " 'y',\n" " 'z'])])" -#: ../../library/ast.rst:2125 +#: ../../library/ast.rst:2130 msgid "A class definition." msgstr "一個類別定義。" -#: ../../library/ast.rst:2127 +#: ../../library/ast.rst:2132 msgid "``name`` is a raw string for the class name" msgstr "``name`` 是類別名稱的原始字串" -#: ../../library/ast.rst:2128 +#: ../../library/ast.rst:2133 msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "``bases`` 是被顯式指定的基底類別節點串列。" -#: ../../library/ast.rst:2129 +#: ../../library/ast.rst:2134 msgid "" "``keywords`` is a list of :class:`.keyword` nodes, principally for " -"'metaclass'. Other keywords will be passed to the metaclass, as " -"per :pep:`3115`." +"'metaclass'. Other keywords will be passed to the metaclass, as per :pep:" +"`3115`." msgstr "" "``keywords`` 是一個 :class:`.keyword` 節點的串列,主要用於 'metaclass'(元類" "別)。如 :pep:`3115` 所述,其他關鍵字將被傳遞到 metaclass。" -#: ../../library/ast.rst:2131 +#: ../../library/ast.rst:2136 msgid "" "``body`` is a list of nodes representing the code within the class " "definition." msgstr "``body`` 是表示類別定義中程式碼的節點串列。" -#: ../../library/ast.rst:2133 +#: ../../library/ast.rst:2138 msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "``decorator_list`` 是一個節點串列,如 :class:`FunctionDef` 中所示。" -#: ../../library/ast.rst:2136 +#: ../../library/ast.rst:2141 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3836,25 +3840,25 @@ msgstr "" " Name(id='decorator1', ctx=Load()),\n" " Name(id='decorator2', ctx=Load())])])" -#: ../../library/ast.rst:2165 +#: ../../library/ast.rst:2170 msgid "Async and await" msgstr "async 和 await" -#: ../../library/ast.rst:2169 +#: ../../library/ast.rst:2174 msgid "" -"An ``async def`` function definition. Has the same fields " -"as :class:`FunctionDef`." +"An ``async def`` function definition. Has the same fields as :class:" +"`FunctionDef`." msgstr "一個 ``async def`` 函式定義。與 :class:`FunctionDef` 具有相同的欄位。" -#: ../../library/ast.rst:2178 +#: ../../library/ast.rst:2183 msgid "" "An ``await`` expression. ``value`` is what it waits for. Only valid in the " "body of an :class:`AsyncFunctionDef`." msgstr "" -"一個 ``await`` 運算式。``value`` 是它等待的東西。僅" -"在 :class:`AsyncFunctionDef` 主體 (body) 中有效。" +"一個 ``await`` 運算式。``value`` 是它等待的東西。僅在 :class:" +"`AsyncFunctionDef` 主體 (body) 中有效。" -#: ../../library/ast.rst:2181 +#: ../../library/ast.rst:2186 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -3886,7 +3890,7 @@ msgstr "" " value=Call(\n" " func=Name(id='other_func', ctx=Load()))))])])" -#: ../../library/ast.rst:2202 +#: ../../library/ast.rst:2207 msgid "" "``async for`` loops and ``async with`` context managers. They have the same " "fields as :class:`For` and :class:`With`, respectively. Only valid in the " @@ -3895,24 +3899,24 @@ msgstr "" "``async for`` 迴圈和 ``async with`` 情境管理器。它們分別具有與 :class:`For` " "和 :class:`With` 相同的欄位。僅在 :class:`AsyncFunctionDef` 主體中有效。" -#: ../../library/ast.rst:2207 +#: ../../library/ast.rst:2212 msgid "" -"When a string is parsed by :func:`ast.parse`, operator nodes (subclasses " -"of :class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast.boolop` " -"and :class:`ast.expr_context`) on the returned tree will be singletons. " -"Changes to one will be reflected in all other occurrences of the same value " -"(for example, :class:`ast.Add`)." +"When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :" +"class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast." +"boolop` and :class:`ast.expr_context`) on the returned tree will be " +"singletons. Changes to one will be reflected in all other occurrences of the " +"same value (for example, :class:`ast.Add`)." msgstr "" -"當字串被 :func:`ast.parse` 剖析時,回傳樹的運算子節點" -"(:class:`ast.operator`、:class:`ast.unaryop`、:class:`ast.cmpop`、:class:`ast.boolop` " -"和 :class:`ast.expr_context` 的子類別)將是單例。對其中之一的更改將反映在所有其他出" -"現的相同值中(例如 :class:`ast.Add`)。" +"當字串被 :func:`ast.parse` 剖析時,回傳樹的運算子節點(:class:`ast." +"operator`、:class:`ast.unaryop`、:class:`ast.cmpop`、:class:`ast.boolop` 和 :" +"class:`ast.expr_context` 的子類別)將是單例。對其中之一的更改將反映在所有其他" +"出現的相同值中(例如 :class:`ast.Add`)。" -#: ../../library/ast.rst:2215 +#: ../../library/ast.rst:2220 msgid ":mod:`ast` helpers" msgstr ":mod:`ast` 輔助程式" -#: ../../library/ast.rst:2217 +#: ../../library/ast.rst:2222 msgid "" "Apart from the node classes, the :mod:`ast` module defines these utility " "functions and classes for traversing abstract syntax trees:" @@ -3920,37 +3924,37 @@ msgstr "" "除了節點類別之外,:mod:`ast` 模組還定義了這些用於遍歷 (traverse) 抽象語法樹的" "實用函式和類別:" -#: ../../library/ast.rst:2222 +#: ../../library/ast.rst:2227 msgid "" "Parse the source into an AST node. Equivalent to ``compile(source, " "filename, mode, flags=FLAGS_VALUE, optimize=optimize)``, where " -"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and " -"``ast.PyCF_OPTIMIZED_AST`` otherwise." +"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and ``ast." +"PyCF_OPTIMIZED_AST`` otherwise." msgstr "" "將原始碼剖析為 AST 節點,相當於 ``compile(source, filename, mode, " "flags=FLAGS_VALUE, optimize=optimize)``,其中 ``FLAGS_VALUE`` 在 ``optimize " "<= 0`` 時為 ``ast.PyCF_ONLY_AST``,否則為 ``ast.PyCF_OPTIMIZED_AST``。" -#: ../../library/ast.rst:2227 +#: ../../library/ast.rst:2232 msgid "" "If ``type_comments=True`` is given, the parser is modified to check and " "return type comments as specified by :pep:`484` and :pep:`526`. This is " -"equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed " -"to :func:`compile`. This will report syntax errors for misplaced type " +"equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed to :" +"func:`compile`. This will report syntax errors for misplaced type " "comments. Without this flag, type comments will be ignored, and the " "``type_comment`` field on selected AST nodes will always be ``None``. In " "addition, the locations of ``# type: ignore`` comments will be returned as " "the ``type_ignores`` attribute of :class:`Module` (otherwise it is always an " "empty list)." msgstr "" -"如果給定 ``type_comments=True``,剖析器將被修改為檢查並回傳 :pep:`484` " -"和 :pep:`526` 指定的型別註釋。這相當於將 :data:`ast.PyCF_TYPE_COMMENTS` 新增" -"到傳遞給 :func:`compile` 的旗標中。這將報告錯誤型別註釋的語法錯誤。如果沒有此" -"旗標,型別註釋將被忽略,並且所選 AST 節點上的 ``type_comment`` 欄位將始終為 " +"如果給定 ``type_comments=True``,剖析器將被修改為檢查並回傳 :pep:`484` 和 :" +"pep:`526` 指定的型別註釋。這相當於將 :data:`ast.PyCF_TYPE_COMMENTS` 新增到傳" +"遞給 :func:`compile` 的旗標中。這將報告錯誤型別註釋的語法錯誤。如果沒有此旗" +"標,型別註釋將被忽略,並且所選 AST 節點上的 ``type_comment`` 欄位將始終為 " "``None``。此外,``# type: ignore`` 註釋的位置將作為 :class:`Module` 的 " "``type_ignores`` 屬性回傳(否則它始終是一個空串列)。" -#: ../../library/ast.rst:2237 +#: ../../library/ast.rst:2242 msgid "" "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to " "correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> " @@ -3960,7 +3964,7 @@ msgstr "" "名型別註解 (signature type comments)」而被修改,例如 ``(str, int) -> " "List[str]``。" -#: ../../library/ast.rst:2241 +#: ../../library/ast.rst:2246 msgid "" "Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a " "\"best-effort\" attempt to parse using that Python version's grammar. For " @@ -3980,12 +3984,12 @@ msgstr "" "能保證剖析(或剖析的成功)與在與 ``feature_version`` 對應的 Python 版本上運行" "時相同。" -#: ../../library/ast.rst:2251 +#: ../../library/ast.rst:2256 msgid "" "If source contains a null character (``\\0``), :exc:`ValueError` is raised." msgstr "如果來源包含 null 字元 (``\\0``),則會引發 :exc:`ValueError`。" -#: ../../library/ast.rst:2254 +#: ../../library/ast.rst:2259 msgid "" "Note that successfully parsing source code into an AST object doesn't " "guarantee that the source code provided is valid Python code that can be " @@ -3999,14 +4003,14 @@ msgstr "" "原始的 ``return 42`` 為 return 陳述式生成一個有效的 AST 節點,但它不能單獨編" "譯(它需要位於函式節點內)。" -#: ../../library/ast.rst:2261 +#: ../../library/ast.rst:2266 msgid "" "In particular, :func:`ast.parse` won't do any scoping checks, which the " "compilation step does." msgstr "" "特別是 :func:`ast.parse` 不會執行任何範圍檢查,而編譯步驟才會執行此操作。" -#: ../../library/ast.rst:2265 +#: ../../library/ast.rst:2270 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string due to stack depth limitations in Python's AST compiler." @@ -4014,11 +4018,11 @@ msgstr "" "由於 Python AST 編譯器中的堆疊 (stack) 深度限制,太大或太複雜的字串可能會導" "致 Python 直譯器崩潰。" -#: ../../library/ast.rst:2269 +#: ../../library/ast.rst:2274 msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "新增 ``type_comments``、``mode='func_type'`` 與 ``feature_version``。" -#: ../../library/ast.rst:2272 +#: ../../library/ast.rst:2277 msgid "" "The minimum supported version for ``feature_version`` is now ``(3, 7)``. The " "``optimize`` argument was added." @@ -4026,16 +4030,16 @@ msgstr "" "``feature_version`` 的最低支援版本現在是 ``(3, 7)``。新增了 ``optimize`` 引" "數。" -#: ../../library/ast.rst:2279 +#: ../../library/ast.rst:2284 msgid "" "Unparse an :class:`ast.AST` object and generate a string with code that " -"would produce an equivalent :class:`ast.AST` object if parsed back " -"with :func:`ast.parse`." +"would produce an equivalent :class:`ast.AST` object if parsed back with :" +"func:`ast.parse`." msgstr "" -"反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使" -"用 :func:`ast.parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" +"反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使用 :func:`ast." +"parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" -#: ../../library/ast.rst:2284 +#: ../../library/ast.rst:2289 msgid "" "The produced code string will not necessarily be equal to the original code " "that generated the :class:`ast.AST` object (without any compiler " @@ -4044,13 +4048,13 @@ msgstr "" "生成的程式碼字串不一定等於生成 :class:`ast.AST` 物件的原始程式碼(沒有任何編" "譯器最佳化,例如常數元組/凍結集合)。" -#: ../../library/ast.rst:2289 +#: ../../library/ast.rst:2294 msgid "" -"Trying to unparse a highly complex expression would result " -"with :exc:`RecursionError`." +"Trying to unparse a highly complex expression would result with :exc:" +"`RecursionError`." msgstr "嘗試剖析高度複雜的運算式會導致 :exc:`RecursionError`。" -#: ../../library/ast.rst:2297 +#: ../../library/ast.rst:2302 msgid "" "Evaluate an expression node or a string containing only a Python literal or " "container display. The string or node provided may only consist of the " @@ -4061,7 +4065,7 @@ msgstr "" "能包含以下 Python 文本結構:字串、位元組、數字、元組、串列、字典、集合、布林" "值、``None`` 和 ``Ellipsis``。" -#: ../../library/ast.rst:2302 +#: ../../library/ast.rst:2307 msgid "" "This can be used for evaluating strings containing Python values without the " "need to parse the values oneself. It is not capable of evaluating " @@ -4070,7 +4074,7 @@ msgstr "" "這可用於為包含 Python 值的字串求值,而無需自己剖析這些值。它無法計算任意複雜" "的運算式,例如涉及運算子或索引。" -#: ../../library/ast.rst:2307 +#: ../../library/ast.rst:2312 msgid "" "This function had been documented as \"safe\" in the past without defining " "what that meant. That was misleading. This is specifically designed not to " @@ -4087,62 +4091,60 @@ msgstr "" "盡或 C 堆疊耗盡,從而導致行程崩潰。某些輸入也可能會出現 CPU 消耗過多而導致拒" "絕服務的情況。因此不建議在不受信任的資料上呼叫它。" -#: ../../library/ast.rst:2317 +#: ../../library/ast.rst:2322 msgid "" "It is possible to crash the Python interpreter due to stack depth " "limitations in Python's AST compiler." msgstr "由於 Python AST 編譯器的堆疊深度限制,Python 直譯器可能會崩潰。" -#: ../../library/ast.rst:2320 +#: ../../library/ast.rst:2325 msgid "" -"It can " -"raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:`MemoryError` " -"and :exc:`RecursionError` depending on the malformed input." +"It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:" +"`MemoryError` and :exc:`RecursionError` depending on the malformed input." msgstr "" -"它可能會引" -"發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:`MemoryError` " -"和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" +"它可能會引發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:" +"`MemoryError` 和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" -#: ../../library/ast.rst:2324 +#: ../../library/ast.rst:2329 msgid "Now allows bytes and set literals." msgstr "現在允許位元組和集合文本 (set literal)。" -#: ../../library/ast.rst:2327 +#: ../../library/ast.rst:2332 msgid "Now supports creating empty sets with ``'set()'``." msgstr "現在支援使用 ``'set()'`` 建立空集合。" -#: ../../library/ast.rst:2330 +#: ../../library/ast.rst:2335 msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "對於字串輸入,前導空格和定位字元 (tab) 現在已被去除。" -#: ../../library/ast.rst:2336 +#: ../../library/ast.rst:2341 msgid "" -"Return the docstring of the given *node* (which must be " -"a :class:`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, " -"or :class:`Module` node), or ``None`` if it has no docstring. If *clean* is " -"true, clean up the docstring's indentation with :func:`inspect.cleandoc`." +"Return the docstring of the given *node* (which must be a :class:" +"`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:" +"`Module` node), or ``None`` if it has no docstring. If *clean* is true, " +"clean up the docstring's indentation with :func:`inspect.cleandoc`." msgstr "" -"回傳給定 *node* 的文件字串 (docstring)(必須" -"是 :class:`FunctionDef`、:class:`AsyncFunctionDef`、:class:`ClassDef` " -"或 :class:`Module` 節點)或如果它沒有文件字串則為 ``None``。如果 *clean* 為 " -"true,則使用 :func:`inspect.cleandoc` 清理文件字串的縮排。" +"回傳給定 *node* 的文件字串 (docstring)(必須是 :class:`FunctionDef`、:class:" +"`AsyncFunctionDef`、:class:`ClassDef` 或 :class:`Module` 節點)或如果它沒有文" +"件字串則為 ``None``。如果 *clean* 為 true,則使用 :func:`inspect.cleandoc` 清" +"理文件字串的縮排。" -#: ../../library/ast.rst:2342 +#: ../../library/ast.rst:2347 msgid ":class:`AsyncFunctionDef` is now supported." msgstr "目前已支援 :class:`AsyncFunctionDef`。" -#: ../../library/ast.rst:2348 +#: ../../library/ast.rst:2353 msgid "" "Get source code segment of the *source* that generated *node*. If some " -"location information " -"(:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :attr:`~ast.AST.col_offset`, " -"or :attr:`~ast.AST.end_col_offset`) is missing, return ``None``." +"location information (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :" +"attr:`~ast.AST.col_offset`, or :attr:`~ast.AST.end_col_offset`) is missing, " +"return ``None``." msgstr "" -"取得生成 *node* 的 *source* 的原始碼片段。如果某些位置資訊" -"(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` " -"或 :attr:`~ast.AST.end_col_offset`)遺漏,則回傳 ``None``。" +"取得生成 *node* 的 *source* 的原始碼片段。如果某些位置資訊(:attr:`~ast.AST." +"lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` 或 :attr:" +"`~ast.AST.end_col_offset`)遺漏,則回傳 ``None``。" -#: ../../library/ast.rst:2352 +#: ../../library/ast.rst:2357 msgid "" "If *padded* is ``True``, the first line of a multi-line statement will be " "padded with spaces to match its original position." @@ -4150,22 +4152,21 @@ msgstr "" "如果 *padded* 為 ``True``,則多列陳述式的第一列將用空格填充 (padded) 以匹配其" "原始位置。" -#: ../../library/ast.rst:2360 +#: ../../library/ast.rst:2365 msgid "" -"When you compile a node tree with :func:`compile`, the compiler " -"expects :attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes " -"for every node that supports them. This is rather tedious to fill in for " -"generated nodes, so this helper adds these attributes recursively where not " -"already set, by setting them to the values of the parent node. It works " -"recursively starting at *node*." +"When you compile a node tree with :func:`compile`, the compiler expects :" +"attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes for every " +"node that supports them. This is rather tedious to fill in for generated " +"nodes, so this helper adds these attributes recursively where not already " +"set, by setting them to the values of the parent node. It works recursively " +"starting at *node*." msgstr "" -"當你使用 :func:`compile` 編譯節點樹時,對於每個有支" -"援 :attr:`~ast.AST.lineno` 和 :attr:`~ast.AST.col_offset` 屬性之節點,編譯器" -"預期他們的這些屬性都要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些" -"屬性設定為父節點的值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞" -"迴地作用。" +"當你使用 :func:`compile` 編譯節點樹時,對於每個有支援 :attr:`~ast.AST." +"lineno` 和 :attr:`~ast.AST.col_offset` 屬性之節點,編譯器預期他們的這些屬性都" +"要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些屬性設定為父節點的" +"值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞迴地作用。" -#: ../../library/ast.rst:2369 +#: ../../library/ast.rst:2374 msgid "" "Increment the line number and end line number of each node in the tree " "starting at *node* by *n*. This is useful to \"move code\" to a different " @@ -4174,19 +4175,17 @@ msgstr "" "將樹中從 *node* 開始的每個節點的列號和結束列號增加 *n*。這對於「移動程式碼」" "到檔案中的不同位置很有用。" -#: ../../library/ast.rst:2376 +#: ../../library/ast.rst:2381 msgid "" -"Copy source location " -"(:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :attr:`~ast.AST.end_lineno`, " -"and :attr:`~ast.AST.end_col_offset`) from *old_node* to *new_node* if " -"possible, and return *new_node*." +"Copy source location (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :" +"attr:`~ast.AST.end_lineno`, and :attr:`~ast.AST.end_col_offset`) from " +"*old_node* to *new_node* if possible, and return *new_node*." msgstr "" -"如果可行,將原始位置" -"(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.col_offset`、:attr:`~ast.AST.end_lineno` " -"和 :attr:`~ast.AST.end_col_offset` )從 *old_node* 複製到 *new_node*,並回傳 " -"*new_node* 。" +"如果可行,將原始位置(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.col_offset`、:" +"attr:`~ast.AST.end_lineno` 和 :attr:`~ast.AST.end_col_offset` )從 " +"*old_node* 複製到 *new_node*,並回傳 *new_node* 。" -#: ../../library/ast.rst:2383 +#: ../../library/ast.rst:2388 msgid "" "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` " "that is present on *node*." @@ -4194,7 +4193,7 @@ msgstr "" "為 *node* 上存在的 ``node._fields`` 中的每個欄位生成一個 ``(fieldname, " "value)`` 元組。" -#: ../../library/ast.rst:2389 +#: ../../library/ast.rst:2394 msgid "" "Yield all direct child nodes of *node*, that is, all fields that are nodes " "and all items of fields that are lists of nodes." @@ -4202,7 +4201,7 @@ msgstr "" "生成 *node* 的所有直接子節點,即作為節點的所有欄位以及作為節點串列欄位的所有" "項目。" -#: ../../library/ast.rst:2395 +#: ../../library/ast.rst:2400 msgid "" "Recursively yield all descendant nodes in the tree starting at *node* " "(including *node* itself), in no specified order. This is useful if you " @@ -4211,7 +4210,7 @@ msgstr "" "遞迴地生成樹中從 *node* 開始的所有後代節點(包括 *node* 本身),不按指定順" "序。如果你只想就地修改節點而不關心情境,這非常有用。" -#: ../../library/ast.rst:2402 +#: ../../library/ast.rst:2407 msgid "" "A node visitor base class that walks the abstract syntax tree and calls a " "visitor function for every node found. This function may return a value " @@ -4220,27 +4219,27 @@ msgstr "" "節點瀏覽者基底類別,它遍歷抽象語法樹並為找到的每個節點呼叫瀏覽者函式。該函式" "可能會回傳一個由 :meth:`visit` 方法轉發的值。" -#: ../../library/ast.rst:2406 +#: ../../library/ast.rst:2411 msgid "" "This class is meant to be subclassed, with the subclass adding visitor " "methods." msgstr "這個類別應該被子類別化,子類別新增瀏覽者方法。" -#: ../../library/ast.rst:2411 +#: ../../library/ast.rst:2416 msgid "" -"Visit a node. The default implementation calls the method " -"called :samp:`self.visit_{classname}` where *classname* is the name of the " -"node class, or :meth:`generic_visit` if that method doesn't exist." +"Visit a node. The default implementation calls the method called :samp:" +"`self.visit_{classname}` where *classname* is the name of the node class, " +"or :meth:`generic_visit` if that method doesn't exist." msgstr "" "瀏覽一個節點。預設實作呼叫名為 :samp:`self.visit_{classname}` 的方法,其中 " -"*classname* 是節點類別的名稱,或者在該方法不存在時呼" -"叫 :meth:`generic_visit`。" +"*classname* 是節點類別的名稱,或者在該方法不存在時呼叫 :meth:" +"`generic_visit`。" -#: ../../library/ast.rst:2417 +#: ../../library/ast.rst:2422 msgid "This visitor calls :meth:`visit` on all children of the node." msgstr "該瀏覽者對該節點的所有子節點呼叫 :meth:`visit`。" -#: ../../library/ast.rst:2419 +#: ../../library/ast.rst:2424 msgid "" "Note that child nodes of nodes that have a custom visitor method won't be " "visited unless the visitor calls :meth:`generic_visit` or visits them itself." @@ -4248,38 +4247,38 @@ msgstr "" "請注意,除非瀏覽者呼叫 :meth:`generic_visit` 或瀏覽它們本身,否則不會瀏覽具有" "自定義瀏覽者方法的節點之子節點。" -#: ../../library/ast.rst:2425 +#: ../../library/ast.rst:2430 msgid "Handles all constant nodes." msgstr "處理所有常數節點。" -#: ../../library/ast.rst:2427 +#: ../../library/ast.rst:2432 msgid "" "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " -"during traversal. For this a special visitor exists " -"(:class:`NodeTransformer`) that allows modifications." +"during traversal. For this a special visitor exists (:class:" +"`NodeTransformer`) that allows modifications." msgstr "" -"如果你想在遍歷期間將變更應用 (apply) 於節點,請不要使" -"用 :class:`NodeVisitor`。為此,有個允許修改的特殊遍歷瀏覽者工" -"具 :class:`NodeTransformer`。" +"如果你想在遍歷期間將變更應用 (apply) 於節點,請不要使用 :class:" +"`NodeVisitor`。為此,有個允許修改的特殊遍歷瀏覽者工具 :class:" +"`NodeTransformer`。" -#: ../../library/ast.rst:2433 +#: ../../library/ast.rst:2438 msgid "" -"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!" -"visit_Bytes`, :meth:`!visit_NameConstant` and :meth:`!visit_Ellipsis` are " -"deprecated now and will not be called in future Python versions. Add " -"the :meth:`visit_Constant` method to handle all constant nodes." +"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`, :meth:" +"`!visit_NameConstant` and :meth:`!visit_Ellipsis` are deprecated now and " +"will not be called in future Python versions. Add the :meth:" +"`visit_Constant` method to handle all constant nodes." msgstr "" ":meth:`!visit_Num`、:meth:`!visit_Str`、:meth:`!visit_Bytes`、:meth:`!" "visit_NameConstant` 和 :meth:`!visit_Ellipsis` 方法現已棄用,並且不會在未來的" "Python 版本中被呼叫。新增 :meth:`visit_Constant` 方法來處理所有常數節點。" -#: ../../library/ast.rst:2441 +#: ../../library/ast.rst:2446 msgid "" "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and " "allows modification of nodes." msgstr "一個 :class:`NodeVisitor` 子類別,它會遍歷抽象語法樹並允許修改節點。" -#: ../../library/ast.rst:2444 +#: ../../library/ast.rst:2449 msgid "" "The :class:`NodeTransformer` will walk the AST and use the return value of " "the visitor methods to replace or remove the old node. If the return value " @@ -4291,7 +4290,7 @@ msgstr "" "點。如果瀏覽者方法的回傳值為 ``None``,則該節點將從其位置中刪除,否則將被替換" "為回傳值。回傳值可能是原始節點,在這種情況下不會發生替換。" -#: ../../library/ast.rst:2450 +#: ../../library/ast.rst:2455 msgid "" "Here is an example transformer that rewrites all occurrences of name lookups " "(``foo``) to ``data['foo']``::" @@ -4299,7 +4298,7 @@ msgstr "" "下面是一個示範用的 transformer,它將查找所有出現名稱 (``foo``) 並改寫為 " "``data['foo']``: ::" -#: ../../library/ast.rst:2453 +#: ../../library/ast.rst:2458 msgid "" "class RewriteName(NodeTransformer):\n" "\n" @@ -4319,16 +4318,16 @@ msgstr "" " ctx=node.ctx\n" " )" -#: ../../library/ast.rst:2462 +#: ../../library/ast.rst:2467 msgid "" "Keep in mind that if the node you're operating on has child nodes you must " -"either transform the child nodes yourself or call " -"the :meth:`~ast.NodeVisitor.generic_visit` method for the node first." +"either transform the child nodes yourself or call the :meth:`~ast." +"NodeVisitor.generic_visit` method for the node first." msgstr "" -"請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點" -"的 :meth:`~ast.NodeVisitor.generic_visit` 方法。" +"請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點的 :" +"meth:`~ast.NodeVisitor.generic_visit` 方法。" -#: ../../library/ast.rst:2466 +#: ../../library/ast.rst:2471 msgid "" "For nodes that were part of a collection of statements (that applies to all " "statement nodes), the visitor may also return a list of nodes rather than " @@ -4337,18 +4336,18 @@ msgstr "" "對於屬於陳述式總集 (collection) 一部分的節點(適用於所有陳述式節點),瀏覽者" "還可以回傳節點串列,而不僅僅是單個節點。" -#: ../../library/ast.rst:2470 +#: ../../library/ast.rst:2475 msgid "" "If :class:`NodeTransformer` introduces new nodes (that weren't part of " -"original tree) without giving them location information (such " -"as :attr:`~ast.AST.lineno`), :func:`fix_missing_locations` should be called " -"with the new sub-tree to recalculate the location information::" +"original tree) without giving them location information (such as :attr:`~ast." +"AST.lineno`), :func:`fix_missing_locations` should be called with the new " +"sub-tree to recalculate the location information::" msgstr "" "如果 :class:`NodeTransformer` 引進了新節點(不屬於原始樹的一部分),但沒有給" -"它們提供位置資訊(例如 :attr:`~ast.AST.lineno`),則應使用新的子樹呼" -"叫 :func:`fix_missing_locations` 以重新計算位置資訊: ::" +"它們提供位置資訊(例如 :attr:`~ast.AST.lineno`),則應使用新的子樹呼叫 :func:" +"`fix_missing_locations` 以重新計算位置資訊: ::" -#: ../../library/ast.rst:2475 +#: ../../library/ast.rst:2480 msgid "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" @@ -4356,15 +4355,15 @@ msgstr "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" -#: ../../library/ast.rst:2478 +#: ../../library/ast.rst:2483 msgid "Usually you use the transformer like this::" msgstr "你通常會像這樣使用 transformer: ::" -#: ../../library/ast.rst:2480 +#: ../../library/ast.rst:2485 msgid "node = YourTransformer().visit(node)" msgstr "node = YourTransformer().visit(node)" -#: ../../library/ast.rst:2485 +#: ../../library/ast.rst:2490 msgid "" "Return a formatted dump of the tree in *node*. This is mainly useful for " "debugging purposes. If *annotate_fields* is true (by default), the returned " @@ -4380,7 +4379,7 @@ msgstr "" "潔。預設情況下,不會傾印列號和行偏移量等屬性。如果需要,可以設定 " "*include_attributes* 為 true。" -#: ../../library/ast.rst:2493 +#: ../../library/ast.rst:2498 msgid "" "If *indent* is a non-negative integer or string, then the tree will be " "pretty-printed with that indent level. An indent level of 0, negative, or " @@ -4394,7 +4393,7 @@ msgstr "" "(預設值)代表選擇單列表示。使用正整數縮排可以在每個級別縮排相同數量的空格。" "如果 *indent* 是一個字串(例如 ``\"\\t\"``),則該字串用於縮排每個級別。" -#: ../../library/ast.rst:2500 +#: ../../library/ast.rst:2505 msgid "" "If *show_empty* is false (the default), optional empty lists will be omitted " "from the output. Optional ``None`` values are always omitted." @@ -4402,15 +4401,15 @@ msgstr "" "如果 *show_empty* 為 false(預設值),則輸出中將省略可選的空串列。可選的 " "``None`` 值總是會被省略。" -#: ../../library/ast.rst:2504 +#: ../../library/ast.rst:2509 msgid "Added the *indent* option." msgstr "新增 *indent* 選項。" -#: ../../library/ast.rst:2507 +#: ../../library/ast.rst:2512 msgid "Added the *show_empty* option." msgstr "新增 *show_empty* 選項。" -#: ../../library/ast.rst:2510 +#: ../../library/ast.rst:2515 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -4462,17 +4461,17 @@ msgstr "" " type_params=[])],\n" " type_ignores=[])" -#: ../../library/ast.rst:2541 +#: ../../library/ast.rst:2546 msgid "Compiler flags" msgstr "編譯器旗標" -#: ../../library/ast.rst:2543 +#: ../../library/ast.rst:2548 msgid "" "The following flags may be passed to :func:`compile` in order to change " "effects on the compilation of a program:" msgstr "可以將以下旗標傳遞給 :func:`compile` 以變更對程式的編譯效果:" -#: ../../library/ast.rst:2548 +#: ../../library/ast.rst:2553 msgid "" "Enables support for top-level ``await``, ``async for``, ``async with`` and " "async comprehensions." @@ -4480,21 +4479,21 @@ msgstr "" "啟用對最高階 ``await``、``async for``、``async with`` 和非同步綜合運算的支" "援。" -#: ../../library/ast.rst:2555 +#: ../../library/ast.rst:2560 msgid "" "Generates and returns an abstract syntax tree instead of returning a " "compiled code object." msgstr "生成並回傳抽象語法樹,而不是回傳已編譯的程式碼物件。" -#: ../../library/ast.rst:2560 +#: ../../library/ast.rst:2565 msgid "" -"The returned AST is optimized according to the *optimize* argument " -"in :func:`compile` or :func:`ast.parse`." +"The returned AST is optimized according to the *optimize* argument in :func:" +"`compile` or :func:`ast.parse`." msgstr "" "回傳的 AST 會根據 :func:`compile` 或 :func:`ast.parse` 中的 *optimize* 引數進" "行最佳化。" -#: ../../library/ast.rst:2567 +#: ../../library/ast.rst:2572 msgid "" "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: " "``, ``# type: ignore ``)." @@ -4502,11 +4501,11 @@ msgstr "" "啟用對 :pep:`484` 和 :pep:`526` 樣式型別註釋的支援 (``# type: ``, ``# " "type: ignore ``)。" -#: ../../library/ast.rst:2575 +#: ../../library/ast.rst:2580 msgid "Recursively compares two ASTs." msgstr "" -#: ../../library/ast.rst:2577 +#: ../../library/ast.rst:2582 msgid "" "*compare_attributes* affects whether AST attributes are considered in the " "comparison. If *compare_attributes* is ``False`` (default), then attributes " @@ -4515,63 +4514,63 @@ msgid "" "similar details. Attributes include line numbers and column offsets." msgstr "" -#: ../../library/ast.rst:2590 +#: ../../library/ast.rst:2595 msgid "Command-line usage" msgstr "命令列用法" -#: ../../library/ast.rst:2594 +#: ../../library/ast.rst:2599 msgid "" "The :mod:`ast` module can be executed as a script from the command line. It " "is as simple as:" msgstr ":mod:`ast` 模組可以作為腳本從命令列執行,可以像這樣簡單地做到:" -#: ../../library/ast.rst:2597 +#: ../../library/ast.rst:2602 msgid "python -m ast [-m ] [-a] [infile]" msgstr "python -m ast [-m ] [-a] [infile]" -#: ../../library/ast.rst:2601 +#: ../../library/ast.rst:2606 msgid "The following options are accepted:" msgstr "以下選項可被接受:" -#: ../../library/ast.rst:2607 +#: ../../library/ast.rst:2612 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/ast.rst:2612 +#: ../../library/ast.rst:2617 msgid "" -"Specify what kind of code must be compiled, like the *mode* argument " -"in :func:`parse`." +"Specify what kind of code must be compiled, like the *mode* argument in :" +"func:`parse`." msgstr "指定必須編譯哪種類型的程式碼,像是 :func:`parse` 中的 *mode* 引數。" -#: ../../library/ast.rst:2617 +#: ../../library/ast.rst:2622 msgid "Don't parse type comments." msgstr "不要剖析型別註解。" -#: ../../library/ast.rst:2621 +#: ../../library/ast.rst:2626 msgid "Include attributes such as line numbers and column offsets." msgstr "包括列號和行偏移量等屬性。" -#: ../../library/ast.rst:2626 +#: ../../library/ast.rst:2631 msgid "Indentation of nodes in AST (number of spaces)." msgstr "AST 中節點的縮進(空格數)。" -#: ../../library/ast.rst:2630 +#: ../../library/ast.rst:2635 msgid "" "Python version in the format 3.x (for example, 3.10). Defaults to the " "current version of the interpreter." msgstr "" -#: ../../library/ast.rst:2638 +#: ../../library/ast.rst:2643 msgid "Optimization level for parser. Defaults to no optimization." msgstr "" -#: ../../library/ast.rst:2644 +#: ../../library/ast.rst:2649 msgid "" "Show empty lists and fields that are ``None``. Defaults to not showing empty " "objects." msgstr "" -#: ../../library/ast.rst:2650 +#: ../../library/ast.rst:2655 msgid "" "If :file:`infile` is specified its contents are parsed to AST and dumped to " "stdout. Otherwise, the content is read from stdin." @@ -4579,7 +4578,7 @@ msgstr "" "如果指定了 :file:`infile`,則其內容將被剖析為 AST 並傾印 (dump) 到 stdout。否" "則會從 stdin 讀取內容。" -#: ../../library/ast.rst:2656 +#: ../../library/ast.rst:2661 msgid "" "`Green Tree Snakes `_, an external " "documentation resource, has good details on working with Python ASTs." @@ -4587,7 +4586,7 @@ msgstr "" "`Green Tree Snakes `_ 是一個外部文件" "資源,提供了有關使用 Python AST 的詳細資訊。" -#: ../../library/ast.rst:2659 +#: ../../library/ast.rst:2664 msgid "" "`ASTTokens `_ " "annotates Python ASTs with the positions of tokens and text in the source " @@ -4598,7 +4597,7 @@ msgstr "" "用生成它們的原始碼中的標記和文本的位置來註釋 Python AST。這對於進行原始碼轉換" "的工具很有幫助。" -#: ../../library/ast.rst:2664 +#: ../../library/ast.rst:2669 msgid "" "`leoAst.py `_ unifies the token-based and parse-tree-based views of python programs " @@ -4608,7 +4607,7 @@ msgstr "" "py>`_ 透過在 token 和 ast 節點之間插入雙向鏈結,統一了 python 程式的基於 " "token 和基於剖析樹的視圖。" -#: ../../library/ast.rst:2669 +#: ../../library/ast.rst:2674 msgid "" "`LibCST `_ parses code as a Concrete Syntax " "Tree that looks like an ast tree and keeps all formatting details. It's " @@ -4618,7 +4617,7 @@ msgstr "" "(Concrete Syntax Tree),看起來像 ast 樹並保留所有格式詳細資訊。它對於建置自動" "重構 (codemod) 應用程式和 linter 非常有用。" -#: ../../library/ast.rst:2674 +#: ../../library/ast.rst:2679 msgid "" "`Parso `_ is a Python parser that supports " "error recovery and round-trip parsing for different Python versions (in " diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index 29ef9ec4533..7f18a47ce54 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2022-02-20 18:34+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -39,8 +39,8 @@ msgstr "" #: ../../library/asyncio-queue.rst:17 msgid "" -"Note that methods of asyncio queues don't have a *timeout* parameter; " -"use :func:`asyncio.wait_for` function to do queue operations with a timeout." +"Note that methods of asyncio queues don't have a *timeout* parameter; use :" +"func:`asyncio.wait_for` function to do queue operations with a timeout." msgstr "" "注意 asyncio 的佇列沒有 *timeout* 參數;請使用 :func:`asyncio.wait_for` 函式" "來為佇列新增具有超時 (timeout) 設定的操作。" @@ -64,8 +64,8 @@ msgid "" "queue reaches *maxsize* until an item is removed by :meth:`get`." msgstr "" "如果 *maxsize* 小於或等於零,則佇列大小是無限制的。如果是大於 ``0`` 的整數," -"則當佇列達到 *maxsize* 時,``await put()`` 將會阻塞 (block),直到某個元素" -"被 :meth:`get` 取出。" +"則當佇列達到 *maxsize* 時,``await put()`` 將會阻塞 (block),直到某個元素被 :" +"meth:`get` 取出。" #: ../../library/asyncio-queue.rst:35 msgid "" @@ -97,8 +97,8 @@ msgstr "如果有 :attr:`maxsize` 個條目在佇列中,則回傳 ``True``。" #: ../../library/asyncio-queue.rst:57 msgid "" -"If the queue was initialized with ``maxsize=0`` (the default), " -"then :meth:`full` never returns ``True``." +"If the queue was initialized with ``maxsize=0`` (the default), then :meth:" +"`full` never returns ``True``." msgstr "" "如果佇列用 ``maxsize=0`` (預設)初始化,則 :meth:`full` 永遠不會回傳 " "``True``。" @@ -127,10 +127,10 @@ msgstr "持續阻塞直到佇列中所有的元素都被接收和處理完畢。 #: ../../library/asyncio-queue.rst:79 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " -"queue. The count goes down whenever a consumer coroutine " -"calls :meth:`task_done` to indicate that the item was retrieved and all work " -"on it is complete. When the count of unfinished tasks drops to " -"zero, :meth:`join` unblocks." +"queue. The count goes down whenever a consumer coroutine calls :meth:" +"`task_done` to indicate that the item was retrieved and all work on it is " +"complete. When the count of unfinished tasks drops to zero, :meth:`join` " +"unblocks." msgstr "" "當條目新增到佇列的時候,未完成任務的計數就會增加。每當一個消耗者 (consumer) " "協程呼叫 :meth:`task_done`,表示這個條目已經被取回且被它包含的所有工作都已完" @@ -162,40 +162,64 @@ msgid "Return the number of items in the queue." msgstr "回傳佇列中的元素數量。" #: ../../library/asyncio-queue.rst:105 -msgid "" -"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` " -"raise :exc:`QueueShutDown`." +msgid "Put a :class:`Queue` instance into a shutdown mode." msgstr "" -#: ../../library/asyncio-queue.rst:108 +#: ../../library/asyncio-queue.rst:107 msgid "" -"By default, :meth:`~Queue.get` on a shut down queue will only raise once the " -"queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise " -"immediately instead." +"The queue can no longer grow. Future calls to :meth:`~Queue.put` raise :exc:" +"`QueueShutDown`. Currently blocked callers of :meth:`~Queue.put` will be " +"unblocked and will raise :exc:`QueueShutDown` in the formerly blocked thread." msgstr "" #: ../../library/asyncio-queue.rst:112 msgid "" -"All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " -"unblocked. If *immediate* is true, a task will be marked as done for each " -"remaining item in the queue, which may unblock callers " -"of :meth:`~Queue.join`." +"If *immediate* is false (the default), the queue can be wound down normally " +"with :meth:`~Queue.get` calls to extract tasks that have already been loaded." +msgstr "" + +#: ../../library/asyncio-queue.rst:116 +msgid "" +"And if :meth:`~Queue.task_done` is called for each remaining task, a " +"pending :meth:`~Queue.join` will be unblocked normally." msgstr "" -#: ../../library/asyncio-queue.rst:121 +#: ../../library/asyncio-queue.rst:119 +msgid "" +"Once the queue is empty, future calls to :meth:`~Queue.get` will raise :exc:" +"`QueueShutDown`." +msgstr "" + +#: ../../library/asyncio-queue.rst:122 +msgid "" +"If *immediate* is true, the queue is terminated immediately. The queue is " +"drained to be completely empty. All callers of :meth:`~Queue.join` are " +"unblocked regardless of the number of unfinished tasks. Blocked callers of :" +"meth:`~Queue.get` are unblocked and will raise :exc:`QueueShutDown` because " +"the queue is empty." +msgstr "" + +#: ../../library/asyncio-queue.rst:129 +msgid "" +"Use caution when using :meth:`~Queue.join` with *immediate* set to true. " +"This unblocks the join even when no work has been done on the tasks, " +"violating the usual invariant for joining a queue." +msgstr "" + +#: ../../library/asyncio-queue.rst:137 msgid "Indicate that a formerly enqueued work item is complete." msgstr "表示前面一個排隊的工作項目已經完成。" -#: ../../library/asyncio-queue.rst:123 +#: ../../library/asyncio-queue.rst:139 msgid "" "Used by queue consumers. For each :meth:`~Queue.get` used to fetch a work " "item, a subsequent call to :meth:`task_done` tells the queue that the " "processing on the work item is complete." msgstr "" -"由佇列消耗者使用。對於每個用於取得一個工作項目的 :meth:`~Queue.get`,接續" -"的 :meth:`task_done` 呼叫會告訴佇列這個工作項目的處理已經完成。" +"由佇列消耗者使用。對於每個用於取得一個工作項目的 :meth:`~Queue.get`,接續的 :" +"meth:`task_done` 呼叫會告訴佇列這個工作項目的處理已經完成。" -#: ../../library/asyncio-queue.rst:127 +#: ../../library/asyncio-queue.rst:143 msgid "" "If a :meth:`join` is currently blocking, it will resume when all items have " "been processed (meaning that a :meth:`task_done` call was received for every " @@ -204,53 +228,47 @@ msgstr "" "如果 :meth:`join` 目前正在阻塞,在所有項目都被處理後會解除阻塞(意味著每個" "以 :meth:`~Queue.put` 放進佇列的條目都會收到一個 :meth:`task_done`)。" -#: ../../library/asyncio-queue.rst:132 -msgid "" -"``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining item " -"in the queue." -msgstr "" - -#: ../../library/asyncio-queue.rst:135 +#: ../../library/asyncio-queue.rst:148 msgid "" "Raises :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "如果被呼叫的次數多於放入佇列中的項目數量,將引發 :exc:`ValueError`。" -#: ../../library/asyncio-queue.rst:140 +#: ../../library/asyncio-queue.rst:153 msgid "Priority Queue" msgstr "Priority Queue(優先佇列)" -#: ../../library/asyncio-queue.rst:144 +#: ../../library/asyncio-queue.rst:157 msgid "" "A variant of :class:`Queue`; retrieves entries in priority order (lowest " "first)." msgstr ":class:`Queue` 的變形;按優先順序取出條目 (最小的先取出)。" -#: ../../library/asyncio-queue.rst:147 +#: ../../library/asyncio-queue.rst:160 msgid "Entries are typically tuples of the form ``(priority_number, data)``." msgstr "條目通常是 ``(priority_number, data)`` 形式的 tuple(元組)。" -#: ../../library/asyncio-queue.rst:152 +#: ../../library/asyncio-queue.rst:165 msgid "LIFO Queue" msgstr "LIFO Queue" -#: ../../library/asyncio-queue.rst:156 +#: ../../library/asyncio-queue.rst:169 msgid "" "A variant of :class:`Queue` that retrieves most recently added entries first " "(last in, first out)." msgstr ":class:`Queue` 的變形,先取出最近新增的條目(後進先出)。" -#: ../../library/asyncio-queue.rst:161 +#: ../../library/asyncio-queue.rst:174 msgid "Exceptions" msgstr "例外" -#: ../../library/asyncio-queue.rst:165 +#: ../../library/asyncio-queue.rst:178 msgid "" "This exception is raised when the :meth:`~Queue.get_nowait` method is called " "on an empty queue." msgstr "當佇列為空的時候,呼叫 :meth:`~Queue.get_nowait` 方法會引發這個例外。" -#: ../../library/asyncio-queue.rst:171 +#: ../../library/asyncio-queue.rst:184 msgid "" "Exception raised when the :meth:`~Queue.put_nowait` method is called on a " "queue that has reached its *maxsize*." @@ -258,22 +276,22 @@ msgstr "" "當佇列中條目數量已經達到它的 *maxsize* 時,呼叫 :meth:`~Queue.put_nowait` 方" "法會引發這個例外。" -#: ../../library/asyncio-queue.rst:177 +#: ../../library/asyncio-queue.rst:190 msgid "" "Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " "a queue which has been shut down." msgstr "" -#: ../../library/asyncio-queue.rst:184 +#: ../../library/asyncio-queue.rst:197 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-queue.rst:188 +#: ../../library/asyncio-queue.rst:201 msgid "" "Queues can be used to distribute workload between several concurrent tasks::" msgstr "佇列能被用於多個並行任務的工作分配:" -#: ../../library/asyncio-queue.rst:191 +#: ../../library/asyncio-queue.rst:204 msgid "" "import asyncio\n" "import random\n" diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index 0ed40b78cb9..064b1899443 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-19 00:16+0000\n" +"POT-Creation-Date: 2025-10-05 00:16+0000\n" "PO-Revision-Date: 2022-10-31 16:28+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,7 +42,7 @@ msgstr "" msgid "Here is an example of a TCP echo client written using asyncio streams::" msgstr "這是一個使用 asyncio 串流編寫的 TCP echo 用戶端範例: ::" -#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:440 +#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:441 msgid "" "import asyncio\n" "\n" @@ -146,7 +146,7 @@ msgstr "移除 *loop* 參數。" #: ../../library/asyncio-stream.rst:87 ../../library/asyncio-stream.rst:131 #: ../../library/asyncio-stream.rst:167 ../../library/asyncio-stream.rst:202 -#: ../../library/asyncio-stream.rst:407 +#: ../../library/asyncio-stream.rst:408 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "新增 *ssl_shutdown_timeout* 參數。" @@ -409,11 +409,17 @@ msgstr "" "此方法會嘗試立即將 *data* 寫入到底層的 socket。如果失敗,資料會被放到內部寫入" "緩衝中排隊等待 (queue),直到它可被發送。" -#: ../../library/asyncio-stream.rst:319 ../../library/asyncio-stream.rst:334 +#: ../../library/asyncio-stream.rst:319 +msgid "" +"The *data* buffer should be a bytes, bytearray, or C-contiguous one-" +"dimensional memoryview object." +msgstr "" + +#: ../../library/asyncio-stream.rst:322 ../../library/asyncio-stream.rst:335 msgid "The method should be used along with the ``drain()`` method::" msgstr "此方法應當與 ``drain()`` 方法一起使用: ::" -#: ../../library/asyncio-stream.rst:321 +#: ../../library/asyncio-stream.rst:324 msgid "" "stream.write(data)\n" "await stream.drain()" @@ -421,13 +427,7 @@ msgstr "" "stream.write(data)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:325 -msgid "" -"The *data* buffer should be a C contiguous one-dimensional :term:`bytes-like " -"object `." -msgstr "" - -#: ../../library/asyncio-stream.rst:329 +#: ../../library/asyncio-stream.rst:330 msgid "" "The method writes a list (or any iterable) of bytes to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " @@ -436,7 +436,7 @@ msgstr "" "此方法會立即嘗試將一個位元組 list(或任何可疊代物件 (iterable))寫入到底層的 " "socket。如果失敗,資料會被放到內部寫入緩衝中排隊等待,直到它可被發送。" -#: ../../library/asyncio-stream.rst:336 +#: ../../library/asyncio-stream.rst:337 msgid "" "stream.writelines(lines)\n" "await stream.drain()" @@ -444,17 +444,17 @@ msgstr "" "stream.writelines(lines)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:341 +#: ../../library/asyncio-stream.rst:342 msgid "The method closes the stream and the underlying socket." msgstr "此方法會關閉串流以及底層的 socket。" -#: ../../library/asyncio-stream.rst:343 +#: ../../library/asyncio-stream.rst:344 msgid "" "The method should be used, though not mandatory, along with the " "``wait_closed()`` method::" msgstr "此方法應與 ``wait_closed()`` 方法一起使用,但並非強制: ::" -#: ../../library/asyncio-stream.rst:346 +#: ../../library/asyncio-stream.rst:347 msgid "" "stream.close()\n" "await stream.wait_closed()" @@ -462,7 +462,7 @@ msgstr "" "stream.close()\n" "await stream.wait_closed()" -#: ../../library/asyncio-stream.rst:351 +#: ../../library/asyncio-stream.rst:352 msgid "" "Return ``True`` if the underlying transport supports the :meth:`write_eof` " "method, ``False`` otherwise." @@ -470,26 +470,26 @@ msgstr "" "如果底層的傳輸支援 :meth:`write_eof` 方法就回傳 ``True``,否則回傳 " "``False``。" -#: ../../library/asyncio-stream.rst:356 +#: ../../library/asyncio-stream.rst:357 msgid "" "Close the write end of the stream after the buffered write data is flushed." msgstr "在已緩衝的寫入資料被清理 (flush) 後關閉串流的寫入端。" -#: ../../library/asyncio-stream.rst:361 +#: ../../library/asyncio-stream.rst:362 msgid "Return the underlying asyncio transport." msgstr "回傳底層的 asyncio 傳輸。" -#: ../../library/asyncio-stream.rst:365 +#: ../../library/asyncio-stream.rst:366 msgid "" "Access optional transport information; see :meth:`BaseTransport." "get_extra_info` for details." msgstr "存取可選的傳輸資訊;詳情請見 :meth:`BaseTransport.get_extra_info`。" -#: ../../library/asyncio-stream.rst:371 +#: ../../library/asyncio-stream.rst:372 msgid "Wait until it is appropriate to resume writing to the stream. Example::" msgstr "等待直到可以繼續寫入到串流。範例: ::" -#: ../../library/asyncio-stream.rst:374 +#: ../../library/asyncio-stream.rst:375 msgid "" "writer.write(data)\n" "await writer.drain()" @@ -497,7 +497,7 @@ msgstr "" "writer.write(data)\n" "await writer.drain()" -#: ../../library/asyncio-stream.rst:377 +#: ../../library/asyncio-stream.rst:378 msgid "" "This is a flow control method that interacts with the underlying IO write " "buffer. When the size of the buffer reaches the high watermark, *drain()* " @@ -509,48 +509,48 @@ msgstr "" "(high watermark) 時,*drain()* 會阻塞直到緩衝區大小減少至最低標記位 (low " "watermark) 以便繼續寫入。當沒有要等待的資料時,:meth:`drain` 會立即回傳。" -#: ../../library/asyncio-stream.rst:388 +#: ../../library/asyncio-stream.rst:389 msgid "Upgrade an existing stream-based connection to TLS." msgstr "將現有的基於串流的連線升級到 TLS。" -#: ../../library/asyncio-stream.rst:390 +#: ../../library/asyncio-stream.rst:391 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-stream.rst:392 +#: ../../library/asyncio-stream.rst:393 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:一個 :class:`~ssl.SSLContext` 的已配置實例。" -#: ../../library/asyncio-stream.rst:394 +#: ../../library/asyncio-stream.rst:395 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "*server_hostname*:設定或覆寫將會被目標伺服器憑證比對的主機名稱。" -#: ../../library/asyncio-stream.rst:397 +#: ../../library/asyncio-stream.rst:398 msgid "" "*ssl_handshake_timeout* is the time in seconds to wait for the TLS handshake " "to complete before aborting the connection. ``60.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:401 +#: ../../library/asyncio-stream.rst:402 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:413 +#: ../../library/asyncio-stream.rst:414 msgid "" "Return ``True`` if the stream is closed or in the process of being closed." msgstr "如果串流已被關閉或正在被關閉則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:421 +#: ../../library/asyncio-stream.rst:422 msgid "Wait until the stream is closed." msgstr "等待直到串流被關閉。" -#: ../../library/asyncio-stream.rst:423 +#: ../../library/asyncio-stream.rst:424 msgid "" "Should be called after :meth:`close` to wait until the underlying connection " "is closed, ensuring that all data has been flushed before e.g. exiting the " @@ -559,19 +559,19 @@ msgstr "" "應當在 :meth:`close` 之後才被呼叫,這會持續等待直到底層的連線被關閉,以確保在" "這之前(例如在程式退出前)所有資料都已經被清空" -#: ../../library/asyncio-stream.rst:431 +#: ../../library/asyncio-stream.rst:432 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-stream.rst:436 +#: ../../library/asyncio-stream.rst:437 msgid "TCP echo client using streams" msgstr "使用串流的 TCP echo 用戶端" -#: ../../library/asyncio-stream.rst:438 +#: ../../library/asyncio-stream.rst:439 msgid "TCP echo client using the :func:`asyncio.open_connection` function::" msgstr "使用 :func:`asyncio.open_connection` 函式的 TCP echo 用戶端: ::" -#: ../../library/asyncio-stream.rst:462 +#: ../../library/asyncio-stream.rst:463 msgid "" "The :ref:`TCP echo client protocol " "` example uses the low-level :meth:" @@ -580,15 +580,15 @@ msgstr "" "使用低階 :meth:`loop.create_connection` 方法的 :ref:`TCP echo 用戶端協定 " "`\\ 範例。" -#: ../../library/asyncio-stream.rst:469 +#: ../../library/asyncio-stream.rst:470 msgid "TCP echo server using streams" msgstr "使用串流的 TCP echo 伺服器" -#: ../../library/asyncio-stream.rst:471 +#: ../../library/asyncio-stream.rst:472 msgid "TCP echo server using the :func:`asyncio.start_server` function::" msgstr "TCP echo 伺服器使用 :func:`asyncio.start_server` 函式: ::" -#: ../../library/asyncio-stream.rst:473 +#: ../../library/asyncio-stream.rst:474 msgid "" "import asyncio\n" "\n" @@ -648,7 +648,7 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../library/asyncio-stream.rst:505 +#: ../../library/asyncio-stream.rst:506 msgid "" "The :ref:`TCP echo server protocol " "` example uses the :meth:`loop." @@ -657,16 +657,16 @@ msgstr "" "使用 :meth:`loop.create_server` 方法的 :ref:`TCP echo 伺服器協定 " "` 範例。" -#: ../../library/asyncio-stream.rst:510 +#: ../../library/asyncio-stream.rst:511 msgid "Get HTTP headers" msgstr "取得 HTTP 標頭" -#: ../../library/asyncio-stream.rst:512 +#: ../../library/asyncio-stream.rst:513 msgid "" "Simple example querying HTTP headers of the URL passed on the command line::" msgstr "查詢自命令列傳入之 URL 所帶有 HTTP 標頭的簡單範例: ::" -#: ../../library/asyncio-stream.rst:514 +#: ../../library/asyncio-stream.rst:515 msgid "" "import asyncio\n" "import urllib.parse\n" @@ -705,34 +705,34 @@ msgid "" "asyncio.run(print_http_headers(url))" msgstr "" -#: ../../library/asyncio-stream.rst:551 +#: ../../library/asyncio-stream.rst:552 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-stream.rst:553 +#: ../../library/asyncio-stream.rst:554 msgid "python example.py http://example.com/path/page.html" msgstr "python example.py http://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:555 +#: ../../library/asyncio-stream.rst:556 msgid "or with HTTPS::" msgstr "或使用 HTTPS: ::" -#: ../../library/asyncio-stream.rst:557 +#: ../../library/asyncio-stream.rst:558 msgid "python example.py https://example.com/path/page.html" msgstr "python example.py https://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:563 +#: ../../library/asyncio-stream.rst:564 msgid "Register an open socket to wait for data using streams" msgstr "註冊一個使用串流來等待資料的開放 socket" -#: ../../library/asyncio-stream.rst:565 +#: ../../library/asyncio-stream.rst:566 msgid "" "Coroutine waiting until a socket receives data using the :func:" "`open_connection` function::" msgstr "" "等待直到 socket 透過使用 :func:`open_connection` 函式接收到資料的協程: ::" -#: ../../library/asyncio-stream.rst:568 +#: ../../library/asyncio-stream.rst:569 msgid "" "import asyncio\n" "import socket\n" @@ -765,7 +765,7 @@ msgid "" "asyncio.run(wait_for_data())" msgstr "" -#: ../../library/asyncio-stream.rst:600 +#: ../../library/asyncio-stream.rst:601 msgid "" "The :ref:`register an open socket to wait for data using a protocol " "` example uses a low-level protocol and " @@ -775,7 +775,7 @@ msgstr "" "`\\ 範例中,有使用了低階協定以及 :meth:" "`loop.create_connection` 方法。" -#: ../../library/asyncio-stream.rst:604 +#: ../../library/asyncio-stream.rst:605 msgid "" "The :ref:`watch a file descriptor for read events " "` example uses the low-level :meth:`loop." diff --git a/library/bisect.po b/library/bisect.po index 5d583395d6b..e18d196ae0a 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -370,6 +370,35 @@ msgid "" " Movie(name='Aliens', released=1986, director='Cameron'),\n" " Movie(name='Titanic', released=1997, director='Cameron')]" msgstr "" +">>> from collections import namedtuple\n" +">>> from operator import attrgetter\n" +">>> from bisect import bisect, insort\n" +">>> from pprint import pprint\n" +"\n" +">>> Movie = namedtuple('Movie', ('name', 'released', 'director'))\n" +"\n" +">>> movies = [\n" +"... Movie('Jaws', 1975, 'Spielberg'),\n" +"... Movie('Titanic', 1997, 'Cameron'),\n" +"... Movie('The Birds', 1963, 'Hitchcock'),\n" +"... Movie('Aliens', 1986, 'Cameron')\n" +"... ]\n" +"\n" +">>> # 找到 1960 年後上映的第一部電影\n" +">>> by_year = attrgetter('released')\n" +">>> movies.sort(key=by_year)\n" +">>> movies[bisect(movies, 1960, key=by_year)]\n" +"Movie(name='The Birds', released=1963, director='Hitchcock')\n" +"\n" +">>> # 插入一部電影並保持排序\n" +">>> romance = Movie('Love Story', 1970, 'Hiller')\n" +">>> insort(movies, romance, key=by_year)\n" +">>> pprint(movies)\n" +"[Movie(name='The Birds', released=1963, director='Hitchcock'),\n" +" Movie(name='Love Story', released=1970, director='Hiller'),\n" +" Movie(name='Jaws', released=1975, director='Spielberg'),\n" +" Movie(name='Aliens', released=1986, director='Cameron'),\n" +" Movie(name='Titanic', released=1997, director='Cameron')]" #: ../../library/bisect.rst:247 msgid "" diff --git a/library/cmath.po b/library/cmath.po index cf69d27a6e8..1106996067f 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-15 00:16+0000\n" "PO-Revision-Date: 2024-03-14 09:26+0800\n" "Last-Translator: Enkai Huang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,9 +33,9 @@ msgid "" "result of the conversion." msgstr "" "本模組提供一些適用於複數的數學函式。本模組中的函式接受整數、浮點數或複數作為" -"引數。它們也接受任何具有 :meth:`~object.__complex__` " -"或 :meth:`~object.__float__` 方法的 Python 物件:這些方法分別用於將物件轉換為" -"複數或浮點數,然後再將函式應用於轉換後的結果。" +"引數。它們也接受任何具有 :meth:`~object.__complex__` 或 :meth:`~object." +"__float__` 方法的 Python 物件:這些方法分別用於將物件轉換為複數或浮點數,然後" +"再將函式應用於轉換後的結果。" #: ../../library/cmath.rst:18 msgid "" @@ -60,9 +60,8 @@ msgid "" "*below* the branch cut, and so gives a result on the negative imaginary " "axis::" msgstr "" -"例如 :func:`cmath.sqrt` 函式具有一條沿負實軸的分枝切割。 引數 " -"``-2-0j`` 被視為位於分枝切割 *下方* 處理,因此給出的結果在負虛" -"軸上: ::" +"例如 :func:`cmath.sqrt` 函式具有一條沿負實軸的分枝切割。 引數 ``-2-0j`` 被視" +"為位於分枝切割 *下方* 處理,因此給出的結果在負虛軸上: ::" #: ../../library/cmath.rst:31 msgid "" @@ -357,8 +356,8 @@ msgstr "轉換到極座標和從極座標做轉換" #: ../../library/cmath.rst:95 msgid "" "A Python complex number ``z`` is stored internally using *rectangular* or " -"*Cartesian* coordinates. It is completely determined by its *real part* " -"``z.real`` and its *imaginary part* ``z.imag``." +"*Cartesian* coordinates. It is completely determined by its *real part* ``z." +"real`` and its *imaginary part* ``z.imag``." msgstr "" "Python 複數 ``z`` 是用 *直角坐標* 或 *笛卡爾坐標* 儲存在內部的。它完全是由其 " "*實部* ``z.real`` 和 *虛部* ``z.imag`` 所決定。" @@ -392,8 +391,8 @@ msgid "" msgstr "" "以浮點數的形式回傳 *z* 的相位角(也稱為 *z* 的 *引數* )。``phase(z)`` 等價" "於 ``math.atan2(z.imag, z.real)``。結果將位於 [-\\ *π*, *π*] 的範圍內,且此操" -"作的分枝切割將位於負實軸上。結果的符號會與 ``z.imag`` 的符號相同,即使 " -"``z.imag`` 為零: ::" +"作的分枝切割將位於負實軸上。結果的符號會與 ``z.imag`` 的符號相同,即使 ``z." +"imag`` 為零: ::" #: ../../library/cmath.rst:117 msgid "" @@ -413,8 +412,8 @@ msgid "" "the built-in :func:`abs` function. There is no separate :mod:`cmath` module " "function for this operation." msgstr "" -"複數 *z* 的絕對值可以使用內建的 :func:`abs` 函式計算。沒有單獨" -"的 :mod:`cmath` 模組函式適用於此操作。" +"複數 *z* 的絕對值可以使用內建的 :func:`abs` 函式計算。沒有單獨的 :mod:" +"`cmath` 模組函式適用於此操作。" #: ../../library/cmath.rst:132 msgid "" @@ -454,8 +453,8 @@ msgstr "" #: ../../library/cmath.rst:162 msgid "" -"Return the base-10 logarithm of *z*. This has the same branch cut " -"as :func:`log`." +"Return the base-10 logarithm of *z*. This has the same branch cut as :func:" +"`log`." msgstr "回傳 *z* 以 10 為底的對數。它與 :func:`log` 具有相同的分枝切割。" #: ../../library/cmath.rst:168 @@ -647,8 +646,8 @@ msgstr "實部為零和虛部為正無窮的複數。相當於 ``complex(0.0, fl #: ../../library/cmath.rst:340 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to " -"``float('nan')``." -msgstr "浮點「非數字」 (NaN) 值。相當於 ``float('nan')``。" +"``float('nan')``. See also :data:`math.nan`." +msgstr "浮點「非數字」 (NaN) 值。相當於 ``float('nan')``。另請參閱 :data:`math.nan`。" #: ../../library/cmath.rst:348 msgid "" @@ -662,16 +661,15 @@ msgid "" "in module :mod:`math`. The reason for having two modules is that some users " "aren't interested in complex numbers, and perhaps don't even know what they " "are. They would rather have ``math.sqrt(-1)`` raise an exception than " -"return a complex number. Also note that the functions defined " -"in :mod:`cmath` always return a complex number, even if the answer can be " -"expressed as a real number (in which case the complex number has an " -"imaginary part of zero)." +"return a complex number. Also note that the functions defined in :mod:" +"`cmath` always return a complex number, even if the answer can be expressed " +"as a real number (in which case the complex number has an imaginary part of " +"zero)." msgstr "" "請注意,函式的選擇與模組 :mod:`math` 的類似,但並不完全相同。擁有兩個模組的原" -"因是有些用戶對複數不感興趣,甚至根本就不知道它們是什麼。他們寧願讓 " -"``math.sqrt(-1)`` 引發異常,也不願它回傳複數。另請注意, :mod:`cmath` 中所定" -"義的函式始終都會回傳複數,即使答案可以表示為實數(在這種情況下,複數的虛部為" -"零)。" +"因是有些用戶對複數不感興趣,甚至根本就不知道它們是什麼。他們寧願讓 ``math." +"sqrt(-1)`` 引發異常,也不願它回傳複數。另請注意, :mod:`cmath` 中所定義的函式" +"始終都會回傳複數,即使答案可以表示為實數(在這種情況下,複數的虛部為零)。" #: ../../library/cmath.rst:364 msgid "" diff --git a/library/codecs.po b/library/codecs.po index e9bfa3e9fe1..7acae8c1c11 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-19 00:16+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,9 +51,9 @@ msgstr "" #: ../../library/codecs.rst:40 msgid "" "*Errors* may be given to set the desired error handling scheme. The default " -"error handler is ``'strict'`` meaning that encoding errors " -"raise :exc:`ValueError` (or a more codec specific subclass, such " -"as :exc:`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more " +"error handler is ``'strict'`` meaning that encoding errors raise :exc:" +"`ValueError` (or a more codec specific subclass, such as :exc:" +"`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more " "information on codec error handling." msgstr "" @@ -64,9 +64,9 @@ msgstr "" #: ../../library/codecs.rst:50 msgid "" "*Errors* may be given to set the desired error handling scheme. The default " -"error handler is ``'strict'`` meaning that decoding errors " -"raise :exc:`ValueError` (or a more codec specific subclass, such " -"as :exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more " +"error handler is ``'strict'`` meaning that decoding errors raise :exc:" +"`ValueError` (or a more codec specific subclass, such as :exc:" +"`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more " "information on codec error handling." msgstr "" @@ -85,17 +85,16 @@ msgstr "" #: ../../library/codecs.rst:68 msgid "" -"Looks up the codec info in the Python codec registry and returns " -"a :class:`CodecInfo` object as defined below." +"Looks up the codec info in the Python codec registry and returns a :class:" +"`CodecInfo` object as defined below." msgstr "" #: ../../library/codecs.rst:71 msgid "" "Encodings are first looked up in the registry's cache. If not found, the " "list of registered search functions is scanned. If no :class:`CodecInfo` " -"object is found, a :exc:`LookupError` is raised. Otherwise, " -"the :class:`CodecInfo` object is stored in the cache and returned to the " -"caller." +"object is found, a :exc:`LookupError` is raised. Otherwise, the :class:" +"`CodecInfo` object is stored in the cache and returned to the caller." msgstr "" #: ../../library/codecs.rst:78 @@ -111,25 +110,25 @@ msgstr "編碼的名稱。" #: ../../library/codecs.rst:90 msgid "" "The stateless encoding and decoding functions. These must be functions or " -"methods which have the same interface as the :meth:`~Codec.encode` " -"and :meth:`~Codec.decode` methods of Codec instances (see :ref:`Codec " -"Interface `). The functions or methods are expected to work " -"in a stateless mode." +"methods which have the same interface as the :meth:`~Codec.encode` and :meth:" +"`~Codec.decode` methods of Codec instances (see :ref:`Codec Interface `). The functions or methods are expected to work in a stateless " +"mode." msgstr "" #: ../../library/codecs.rst:100 msgid "" "Incremental encoder and decoder classes or factory functions. These have to " -"provide the interface defined by the base " -"classes :class:`IncrementalEncoder` and :class:`IncrementalDecoder`, " -"respectively. Incremental codecs can maintain state." +"provide the interface defined by the base classes :class:" +"`IncrementalEncoder` and :class:`IncrementalDecoder`, respectively. " +"Incremental codecs can maintain state." msgstr "" #: ../../library/codecs.rst:109 msgid "" "Stream writer and reader classes or factory functions. These have to provide " -"the interface defined by the base classes :class:`StreamWriter` " -"and :class:`StreamReader`, respectively. Stream codecs can maintain state." +"the interface defined by the base classes :class:`StreamWriter` and :class:" +"`StreamReader`, respectively. Stream codecs can maintain state." msgstr "" #: ../../library/codecs.rst:114 @@ -179,14 +178,14 @@ msgstr "" #: ../../library/codecs.rst:151 msgid "" -"Look up the codec for the given encoding and return " -"its :class:`StreamReader` class or factory function." +"Look up the codec for the given encoding and return its :class:" +"`StreamReader` class or factory function." msgstr "" #: ../../library/codecs.rst:159 msgid "" -"Look up the codec for the given encoding and return " -"its :class:`StreamWriter` class or factory function." +"Look up the codec for the given encoding and return its :class:" +"`StreamWriter` class or factory function." msgstr "" #: ../../library/codecs.rst:164 @@ -224,9 +223,9 @@ msgstr "" #: ../../library/codecs.rst:194 msgid "" -"Open an encoded file using the given *mode* and return an instance " -"of :class:`StreamReaderWriter`, providing transparent encoding/decoding. The " -"default file mode is ``'r'``, meaning to open the file in read mode." +"Open an encoded file using the given *mode* and return an instance of :class:" +"`StreamReaderWriter`, providing transparent encoding/decoding. The default " +"file mode is ``'r'``, meaning to open the file in read mode." msgstr "" #: ../../library/codecs.rst:200 @@ -294,8 +293,8 @@ msgstr "" #: ../../library/codecs.rst:245 msgid "" "Uses an incremental encoder to iteratively encode the input provided by " -"*iterator*. *iterator* must yield :class:`str` objects. This function is " -"a :term:`generator`. The *errors* argument (as well as any other keyword " +"*iterator*. *iterator* must yield :class:`str` objects. This function is a :" +"term:`generator`. The *errors* argument (as well as any other keyword " "argument) is passed through to the incremental encoder." msgstr "" @@ -318,8 +317,8 @@ msgstr "" msgid "" "This function requires that the codec accept :class:`bytes` objects to " "decode. Therefore it does not support text-to-text encoders such as " -"``rot_13``, although ``rot_13`` may be used equivalently " -"with :func:`iterencode`." +"``rot_13``, although ``rot_13`` may be used equivalently with :func:" +"`iterencode`." msgstr "" #: ../../library/codecs.rst:270 @@ -352,11 +351,11 @@ msgid "" "These constants define various byte sequences, being Unicode byte order " "marks (BOMs) for several encodings. They are used in UTF-16 and UTF-32 data " "streams to indicate the byte order used, and in UTF-8 as a Unicode " -"signature. :const:`BOM_UTF16` is either :const:`BOM_UTF16_BE` " -"or :const:`BOM_UTF16_LE` depending on the platform's native byte " -"order, :const:`BOM` is an alias for :const:`BOM_UTF16`, :const:`BOM_LE` " -"for :const:`BOM_UTF16_LE` and :const:`BOM_BE` for :const:`BOM_UTF16_BE`. The " -"others represent the BOM in UTF-8 and UTF-32 encodings." +"signature. :const:`BOM_UTF16` is either :const:`BOM_UTF16_BE` or :const:" +"`BOM_UTF16_LE` depending on the platform's native byte order, :const:`BOM` " +"is an alias for :const:`BOM_UTF16`, :const:`BOM_LE` for :const:" +"`BOM_UTF16_LE` and :const:`BOM_BE` for :const:`BOM_UTF16_BE`. The others " +"represent the BOM in UTF-8 and UTF-32 encodings." msgstr "" #: ../../library/codecs.rst:311 @@ -401,8 +400,8 @@ msgid "Value" msgstr "" #: ../../library/codecs.rst:356 ../../library/codecs.rst:399 -#: ../../library/codecs.rst:419 ../../library/codecs.rst:1371 -#: ../../library/codecs.rst:1443 ../../library/codecs.rst:1498 +#: ../../library/codecs.rst:419 ../../library/codecs.rst:1376 +#: ../../library/codecs.rst:1448 ../../library/codecs.rst:1533 msgid "Meaning" msgstr "含義" @@ -444,10 +443,9 @@ msgstr "``'backslashreplace'``" #: ../../library/codecs.rst:372 msgid "" "Replace with backslashed escape sequences. On encoding, use hexadecimal form " -"of Unicode code point with formats :samp:`\\\\x{hh}` :samp:`\\\\u{xxxx}" -"` :samp:`\\\\U{xxxxxxxx}`. On decoding, use hexadecimal form of byte value " -"with format :samp:`\\\\x{hh}`. Implemented " -"in :func:`backslashreplace_errors`." +"of Unicode code point with formats :samp:`\\\\x{hh}` :samp:`\\\\u{xxxx}` :" +"samp:`\\\\U{xxxxxxxx}`. On decoding, use hexadecimal form of byte value with " +"format :samp:`\\\\x{hh}`. Implemented in :func:`backslashreplace_errors`." msgstr "" #: ../../library/codecs.rst:381 @@ -464,8 +462,8 @@ msgstr "" #: ../../library/codecs.rst:395 msgid "" -"The following error handlers are only applicable to encoding " -"(within :term:`text encodings `):" +"The following error handlers are only applicable to encoding (within :term:" +"`text encodings `):" msgstr "" #: ../../library/codecs.rst:401 @@ -475,8 +473,8 @@ msgstr "``'xmlcharrefreplace'``" #: ../../library/codecs.rst:401 msgid "" "Replace with XML/HTML numeric character reference, which is a decimal form " -"of Unicode code point with format :samp:`&#{num};`. Implemented " -"in :func:`xmlcharrefreplace_errors`." +"of Unicode code point with format :samp:`&#{num};`. Implemented in :func:" +"`xmlcharrefreplace_errors`." msgstr "" #: ../../library/codecs.rst:407 @@ -486,8 +484,8 @@ msgstr "``'namereplace'``" #: ../../library/codecs.rst:407 msgid "" "Replace with ``\\N{...}`` escape sequences, what appears in the braces is " -"the Name property from Unicode Character Database. Implemented " -"in :func:`namereplace_errors`." +"the Name property from Unicode Character Database. Implemented in :func:" +"`namereplace_errors`." msgstr "" #: ../../library/codecs.rst:416 @@ -549,18 +547,17 @@ msgstr "" #: ../../library/codecs.rst:451 msgid "" -"For encoding, *error_handler* will be called with " -"a :exc:`UnicodeEncodeError` instance, which contains information about the " -"location of the error. The error handler must either raise this or a " -"different exception, or return a tuple with a replacement for the " -"unencodable part of the input and a position where encoding should continue. " -"The replacement may be either :class:`str` or :class:`bytes`. If the " -"replacement is bytes, the encoder will simply copy them into the output " -"buffer. If the replacement is a string, the encoder will encode the " -"replacement. Encoding continues on original input at the specified position. " -"Negative position values will be treated as being relative to the end of the " -"input string. If the resulting position is out of bound an :exc:`IndexError` " -"will be raised." +"For encoding, *error_handler* will be called with a :exc:" +"`UnicodeEncodeError` instance, which contains information about the location " +"of the error. The error handler must either raise this or a different " +"exception, or return a tuple with a replacement for the unencodable part of " +"the input and a position where encoding should continue. The replacement may " +"be either :class:`str` or :class:`bytes`. If the replacement is bytes, the " +"encoder will simply copy them into the output buffer. If the replacement is " +"a string, the encoder will encode the replacement. Encoding continues on " +"original input at the specified position. Negative position values will be " +"treated as being relative to the end of the input string. If the resulting " +"position is out of bound an :exc:`IndexError` will be raised." msgstr "" #: ../../library/codecs.rst:463 @@ -636,8 +633,8 @@ msgstr "" #: ../../library/codecs.rst:519 msgid "" -"Implements the ``'xmlcharrefreplace'`` error handling (for encoding " -"within :term:`text encoding` only)." +"Implements the ``'xmlcharrefreplace'`` error handling (for encoding within :" +"term:`text encoding` only)." msgstr "" #: ../../library/codecs.rst:522 @@ -649,8 +646,8 @@ msgstr "" #: ../../library/codecs.rst:529 msgid "" -"Implements the ``'namereplace'`` error handling (for encoding " -"within :term:`text encoding` only)." +"Implements the ``'namereplace'`` error handling (for encoding within :term:" +"`text encoding` only)." msgstr "" #: ../../library/codecs.rst:532 @@ -687,9 +684,9 @@ msgstr "" #: ../../library/codecs.rst:561 msgid "" -"The method may not store state in the :class:`Codec` instance. " -"Use :class:`StreamWriter` for codecs which have to keep state in order to " -"make encoding efficient." +"The method may not store state in the :class:`Codec` instance. Use :class:" +"`StreamWriter` for codecs which have to keep state in order to make encoding " +"efficient." msgstr "" #: ../../library/codecs.rst:565 @@ -715,9 +712,9 @@ msgstr "" #: ../../library/codecs.rst:583 msgid "" -"The method may not store state in the :class:`Codec` instance. " -"Use :class:`StreamReader` for codecs which have to keep state in order to " -"make decoding efficient." +"The method may not store state in the :class:`Codec` instance. Use :class:" +"`StreamReader` for codecs which have to keep state in order to make decoding " +"efficient." msgstr "" #: ../../library/codecs.rst:587 @@ -735,18 +732,18 @@ msgid "" "The :class:`IncrementalEncoder` and :class:`IncrementalDecoder` classes " "provide the basic interface for incremental encoding and decoding. Encoding/" "decoding the input isn't done with one call to the stateless encoder/decoder " -"function, but with multiple calls to " -"the :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` " -"method of the incremental encoder/decoder. The incremental encoder/decoder " -"keeps track of the encoding/decoding process during method calls." +"function, but with multiple calls to the :meth:`~IncrementalEncoder.encode`/:" +"meth:`~IncrementalDecoder.decode` method of the incremental encoder/decoder. " +"The incremental encoder/decoder keeps track of the encoding/decoding process " +"during method calls." msgstr "" #: ../../library/codecs.rst:602 msgid "" -"The joined output of calls to " -"the :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` " -"method is the same as if all the single inputs were joined into one, and " -"this input was encoded/decoded with the stateless encoder/decoder." +"The joined output of calls to the :meth:`~IncrementalEncoder.encode`/:meth:" +"`~IncrementalDecoder.decode` method is the same as if all the single inputs " +"were joined into one, and this input was encoded/decoded with the stateless " +"encoder/decoder." msgstr "" #: ../../library/codecs.rst:611 @@ -782,21 +779,21 @@ msgstr "" msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " -"error handling strategies during the lifetime of " -"the :class:`IncrementalEncoder` object." +"error handling strategies during the lifetime of the :class:" +"`IncrementalEncoder` object." msgstr "" #: ../../library/codecs.rst:638 msgid "" "Encodes *object* (taking the current state of the encoder into account) and " -"returns the resulting encoded object. If this is the last call " -"to :meth:`encode` *final* must be true (the default is false)." +"returns the resulting encoded object. If this is the last call to :meth:" +"`encode` *final* must be true (the default is false)." msgstr "" #: ../../library/codecs.rst:645 msgid "" -"Reset the encoder to the initial state. The output is discarded: call " -"``.encode(object, final=True)``, passing an empty byte or text string if " +"Reset the encoder to the initial state. The output is discarded: call ``." +"encode(object, final=True)``, passing an empty byte or text string if " "necessary, to reset the encoder and to get the output." msgstr "" @@ -848,19 +845,19 @@ msgstr "" msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " -"error handling strategies during the lifetime of " -"the :class:`IncrementalDecoder` object." +"error handling strategies during the lifetime of the :class:" +"`IncrementalDecoder` object." msgstr "" #: ../../library/codecs.rst:695 msgid "" "Decodes *object* (taking the current state of the decoder into account) and " -"returns the resulting decoded object. If this is the last call " -"to :meth:`decode` *final* must be true (the default is false). If *final* is " -"true the decoder must decode the input completely and must flush all " -"buffers. If this isn't possible (e.g. because of incomplete byte sequences " -"at the end of the input) it must initiate error handling just like in the " -"stateless case (which might raise an exception)." +"returns the resulting decoded object. If this is the last call to :meth:" +"`decode` *final* must be true (the default is false). If *final* is true the " +"decoder must decode the input completely and must flush all buffers. If this " +"isn't possible (e.g. because of incomplete byte sequences at the end of the " +"input) it must initiate error handling just like in the stateless case " +"(which might raise an exception)." msgstr "" #: ../../library/codecs.rst:706 @@ -1015,8 +1012,8 @@ msgstr "" #: ../../library/codecs.rst:823 msgid "" -"The set of allowed values for the *errors* argument can be extended " -"with :func:`register_error`." +"The set of allowed values for the *errors* argument can be extended with :" +"func:`register_error`." msgstr "" #: ../../library/codecs.rst:829 @@ -1082,8 +1079,8 @@ msgstr "" #: ../../library/codecs.rst:872 msgid "" -"*sizehint*, if given, is passed as the *size* argument to the " -"stream's :meth:`read` method." +"*sizehint*, if given, is passed as the *size* argument to the stream's :meth:" +"`read` method." msgstr "" #: ../../library/codecs.rst:880 @@ -1110,8 +1107,8 @@ msgstr "" #: ../../library/codecs.rst:895 ../../library/codecs.rst:919 msgid "" -"The design is such that one can use the factory functions returned by " -"the :func:`lookup` function to construct the instance." +"The design is such that one can use the factory functions returned by the :" +"func:`lookup` function to construct the instance." msgstr "" #: ../../library/codecs.rst:901 @@ -1125,8 +1122,8 @@ msgstr "" #: ../../library/codecs.rst:906 msgid "" -":class:`StreamReaderWriter` instances define the combined interfaces " -"of :class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " +":class:`StreamReaderWriter` instances define the combined interfaces of :" +"class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " "other methods and attributes from the underlying stream." msgstr "" @@ -1174,9 +1171,9 @@ msgstr "" #: ../../library/codecs.rst:945 msgid "" -":class:`StreamRecoder` instances define the combined interfaces " -"of :class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " -"other methods and attributes from the underlying stream." +":class:`StreamRecoder` instances define the combined interfaces of :class:" +"`StreamReader` and :class:`StreamWriter` classes. They inherit all other " +"methods and attributes from the underlying stream." msgstr "" #: ../../library/codecs.rst:953 @@ -1223,30 +1220,38 @@ msgid "" "Unicode code point, is to store each code point as four consecutive bytes. " "There are two possibilities: store the bytes in big endian or in little " "endian order. These two encodings are called ``UTF-32-BE`` and ``UTF-32-LE`` " -"respectively. Their disadvantage is that if e.g. you use ``UTF-32-BE`` on a " -"little endian machine you will always have to swap bytes on encoding and " -"decoding. ``UTF-32`` avoids this problem: bytes will always be in natural " -"endianness. When these bytes are read by a CPU with a different endianness, " -"then bytes have to be swapped though. To be able to detect the endianness of " -"a ``UTF-16`` or ``UTF-32`` byte sequence, there's the so called BOM (\"Byte " -"Order Mark\"). This is the Unicode character ``U+FEFF``. This character can " -"be prepended to every ``UTF-16`` or ``UTF-32`` byte sequence. The byte " -"swapped version of this character (``0xFFFE``) is an illegal character that " -"may not appear in a Unicode text. So when the first character in a " -"``UTF-16`` or ``UTF-32`` byte sequence appears to be a ``U+FFFE`` the bytes " -"have to be swapped on decoding. Unfortunately the character ``U+FEFF`` had a " -"second purpose as a ``ZERO WIDTH NO-BREAK SPACE``: a character that has no " -"width and doesn't allow a word to be split. It can e.g. be used to give " -"hints to a ligature algorithm. With Unicode 4.0 using ``U+FEFF`` as a ``ZERO " -"WIDTH NO-BREAK SPACE`` has been deprecated (with ``U+2060`` (``WORD " -"JOINER``) assuming this role). Nevertheless Unicode software still must be " -"able to handle ``U+FEFF`` in both roles: as a BOM it's a device to determine " -"the storage layout of the encoded bytes, and vanishes once the byte sequence " -"has been decoded into a string; as a ``ZERO WIDTH NO-BREAK SPACE`` it's a " -"normal character that will be decoded like any other." -msgstr "" - -#: ../../library/codecs.rst:1006 +"respectively. Their disadvantage is that if, for example, you use ``UTF-32-" +"BE`` on a little endian machine you will always have to swap bytes on " +"encoding and decoding. Python's ``UTF-16`` and ``UTF-32`` codecs avoid this " +"problem by using the platform's native byte order when no BOM is present. " +"Python follows prevailing platform practice, so native-endian data round-" +"trips without redundant byte swapping, even though the Unicode Standard " +"defaults to big-endian when the byte order is unspecified. When these bytes " +"are read by a CPU with a different endianness, the bytes have to be swapped. " +"To be able to detect the endianness of a ``UTF-16`` or ``UTF-32`` byte " +"sequence, a BOM (\"Byte Order Mark\") is used. This is the Unicode character " +"``U+FEFF``. This character can be prepended to every ``UTF-16`` or " +"``UTF-32`` byte sequence. The byte swapped version of this character " +"(``0xFFFE``) is an illegal character that may not appear in a Unicode text. " +"When the first character of a ``UTF-16`` or ``UTF-32`` byte sequence is " +"``U+FFFE``, the bytes have to be swapped on decoding." +msgstr "" + +#: ../../library/codecs.rst:1001 +msgid "" +"Unfortunately the character ``U+FEFF`` had a second purpose as a ``ZERO " +"WIDTH NO-BREAK SPACE``: a character that has no width and doesn't allow a " +"word to be split. It can e.g. be used to give hints to a ligature algorithm. " +"With Unicode 4.0 using ``U+FEFF`` as a ``ZERO WIDTH NO-BREAK SPACE`` has " +"been deprecated (with ``U+2060`` (``WORD JOINER``) assuming this role). " +"Nevertheless Unicode software still must be able to handle ``U+FEFF`` in " +"both roles: as a BOM it's a device to determine the storage layout of the " +"encoded bytes, and vanishes once the byte sequence has been decoded into a " +"string; as a ``ZERO WIDTH NO-BREAK SPACE`` it's a normal character that will " +"be decoded like any other." +msgstr "" + +#: ../../library/codecs.rst:1011 msgid "" "There's another encoding that is able to encode the full range of Unicode " "characters: UTF-8. UTF-8 is an 8-bit encoding, which means there are no " @@ -1257,59 +1262,59 @@ msgid "" "which when concatenated give the Unicode character):" msgstr "" -#: ../../library/codecs.rst:1015 +#: ../../library/codecs.rst:1020 msgid "Range" msgstr "" -#: ../../library/codecs.rst:1015 +#: ../../library/codecs.rst:1020 msgid "Encoding" msgstr "" -#: ../../library/codecs.rst:1017 +#: ../../library/codecs.rst:1022 msgid "``U-00000000`` ... ``U-0000007F``" msgstr "``U-00000000`` ... ``U-0000007F``" -#: ../../library/codecs.rst:1017 +#: ../../library/codecs.rst:1022 msgid "0xxxxxxx" msgstr "0xxxxxxx" -#: ../../library/codecs.rst:1019 +#: ../../library/codecs.rst:1024 msgid "``U-00000080`` ... ``U-000007FF``" msgstr "``U-00000080`` ... ``U-000007FF``" -#: ../../library/codecs.rst:1019 +#: ../../library/codecs.rst:1024 msgid "110xxxxx 10xxxxxx" msgstr "110xxxxx 10xxxxxx" -#: ../../library/codecs.rst:1021 +#: ../../library/codecs.rst:1026 msgid "``U-00000800`` ... ``U-0000FFFF``" msgstr "``U-00000800`` ... ``U-0000FFFF``" -#: ../../library/codecs.rst:1021 +#: ../../library/codecs.rst:1026 msgid "1110xxxx 10xxxxxx 10xxxxxx" msgstr "1110xxxx 10xxxxxx 10xxxxxx" -#: ../../library/codecs.rst:1023 +#: ../../library/codecs.rst:1028 msgid "``U-00010000`` ... ``U-0010FFFF``" msgstr "``U-00010000`` ... ``U-0010FFFF``" -#: ../../library/codecs.rst:1023 +#: ../../library/codecs.rst:1028 msgid "11110xxx 10xxxxxx 10xxxxxx 10xxxxxx" msgstr "11110xxx 10xxxxxx 10xxxxxx 10xxxxxx" -#: ../../library/codecs.rst:1026 +#: ../../library/codecs.rst:1031 msgid "" "The least significant bit of the Unicode character is the rightmost x bit." msgstr "" -#: ../../library/codecs.rst:1028 +#: ../../library/codecs.rst:1033 msgid "" "As UTF-8 is an 8-bit encoding no BOM is required and any ``U+FEFF`` " "character in the decoded string (even if it's the first character) is " "treated as a ``ZERO WIDTH NO-BREAK SPACE``." msgstr "" -#: ../../library/codecs.rst:1032 +#: ../../library/codecs.rst:1037 msgid "" "Without external information it's impossible to reliably determine which " "encoding was used for encoding a string. Each charmap encoding can decode " @@ -1335,7 +1340,7 @@ msgstr "" msgid "INVERTED QUESTION MARK" msgstr "" -#: ../../library/codecs.rst:1048 +#: ../../library/codecs.rst:1053 msgid "" "in iso-8859-1), this increases the probability that a ``utf-8-sig`` encoding " "can be correctly guessed from the byte sequence. So here the BOM is not used " @@ -1347,11 +1352,11 @@ msgid "" "the use of the BOM is discouraged and should generally be avoided." msgstr "" -#: ../../library/codecs.rst:1061 +#: ../../library/codecs.rst:1066 msgid "Standard Encodings" msgstr "標準編碼" -#: ../../library/codecs.rst:1063 +#: ../../library/codecs.rst:1068 msgid "" "Python comes with a number of codecs built-in, either implemented as C " "functions or with dictionaries as mapping tables. The following table lists " @@ -1364,20 +1369,20 @@ msgid "" "``'utf-8'`` is a valid alias for the ``'utf_8'`` codec." msgstr "" -#: ../../library/codecs.rst:1075 +#: ../../library/codecs.rst:1080 msgid "" "The below table lists the most common aliases, for a complete list refer to " "the source :source:`aliases.py ` file." msgstr "" -#: ../../library/codecs.rst:1078 +#: ../../library/codecs.rst:1083 msgid "" "On Windows, ``cpXXX`` codecs are available for all code pages. But only " "codecs listed in the following table are guarantead to exist on other " "platforms." msgstr "" -#: ../../library/codecs.rst:1084 +#: ../../library/codecs.rst:1089 msgid "" "Some common encodings can bypass the codecs lookup machinery to improve " "performance. These optimization opportunities are only recognized by CPython " @@ -1387,11 +1392,11 @@ msgid "" "Using alternative aliases for these encodings may result in slower execution." msgstr "" -#: ../../library/codecs.rst:1092 +#: ../../library/codecs.rst:1097 msgid "Optimization opportunity recognized for us-ascii." msgstr "" -#: ../../library/codecs.rst:1095 +#: ../../library/codecs.rst:1100 msgid "" "Many of the character sets support the same languages. They vary in " "individual characters (e.g. whether the EURO SIGN is supported or not), and " @@ -1399,504 +1404,504 @@ msgid "" "languages in particular, the following variants typically exist:" msgstr "" -#: ../../library/codecs.rst:1100 +#: ../../library/codecs.rst:1105 msgid "an ISO 8859 codeset" msgstr "" -#: ../../library/codecs.rst:1102 +#: ../../library/codecs.rst:1107 msgid "" "a Microsoft Windows code page, which is typically derived from an 8859 " "codeset, but replaces control characters with additional graphic characters" msgstr "" -#: ../../library/codecs.rst:1105 +#: ../../library/codecs.rst:1110 msgid "an IBM EBCDIC code page" msgstr "" -#: ../../library/codecs.rst:1107 +#: ../../library/codecs.rst:1112 msgid "an IBM PC code page, which is ASCII compatible" msgstr "" -#: ../../library/codecs.rst:1112 ../../library/codecs.rst:1371 -#: ../../library/codecs.rst:1443 ../../library/codecs.rst:1498 +#: ../../library/codecs.rst:1117 ../../library/codecs.rst:1376 +#: ../../library/codecs.rst:1448 ../../library/codecs.rst:1533 msgid "Codec" msgstr "" -#: ../../library/codecs.rst:1112 ../../library/codecs.rst:1371 -#: ../../library/codecs.rst:1443 ../../library/codecs.rst:1498 +#: ../../library/codecs.rst:1117 ../../library/codecs.rst:1376 +#: ../../library/codecs.rst:1448 ../../library/codecs.rst:1533 msgid "Aliases" msgstr "" -#: ../../library/codecs.rst:1112 +#: ../../library/codecs.rst:1117 msgid "Languages" msgstr "語言" -#: ../../library/codecs.rst:1114 +#: ../../library/codecs.rst:1119 msgid "ascii" msgstr "ascii" -#: ../../library/codecs.rst:1114 +#: ../../library/codecs.rst:1119 msgid "646, us-ascii" msgstr "646, us-ascii" -#: ../../library/codecs.rst:1114 ../../library/codecs.rst:1120 -#: ../../library/codecs.rst:1128 +#: ../../library/codecs.rst:1119 ../../library/codecs.rst:1125 +#: ../../library/codecs.rst:1133 msgid "English" msgstr "英文" -#: ../../library/codecs.rst:1116 +#: ../../library/codecs.rst:1121 msgid "big5" msgstr "big5" -#: ../../library/codecs.rst:1116 +#: ../../library/codecs.rst:1121 msgid "big5-tw, csbig5" msgstr "big5-tw, csbig5" -#: ../../library/codecs.rst:1116 ../../library/codecs.rst:1118 -#: ../../library/codecs.rst:1177 +#: ../../library/codecs.rst:1121 ../../library/codecs.rst:1123 +#: ../../library/codecs.rst:1182 msgid "Traditional Chinese" msgstr "繁體中文" -#: ../../library/codecs.rst:1118 +#: ../../library/codecs.rst:1123 msgid "big5hkscs" msgstr "big5hkscs" -#: ../../library/codecs.rst:1118 +#: ../../library/codecs.rst:1123 msgid "big5-hkscs, hkscs" msgstr "big5-hkscs, hkscs" -#: ../../library/codecs.rst:1120 +#: ../../library/codecs.rst:1125 msgid "cp037" msgstr "cp037" -#: ../../library/codecs.rst:1120 +#: ../../library/codecs.rst:1125 msgid "IBM037, IBM039" msgstr "IBM037, IBM039" -#: ../../library/codecs.rst:1122 +#: ../../library/codecs.rst:1127 msgid "cp273" msgstr "cp273" -#: ../../library/codecs.rst:1122 +#: ../../library/codecs.rst:1127 msgid "273, IBM273, csIBM273" msgstr "273, IBM273, csIBM273" -#: ../../library/codecs.rst:1122 +#: ../../library/codecs.rst:1127 msgid "German" msgstr "德文" -#: ../../library/codecs.rst:1126 +#: ../../library/codecs.rst:1131 msgid "cp424" msgstr "cp424" -#: ../../library/codecs.rst:1126 +#: ../../library/codecs.rst:1131 msgid "EBCDIC-CP-HE, IBM424" msgstr "EBCDIC-CP-HE, IBM424" -#: ../../library/codecs.rst:1126 ../../library/codecs.rst:1146 -#: ../../library/codecs.rst:1156 ../../library/codecs.rst:1200 -#: ../../library/codecs.rst:1263 +#: ../../library/codecs.rst:1131 ../../library/codecs.rst:1151 +#: ../../library/codecs.rst:1161 ../../library/codecs.rst:1205 +#: ../../library/codecs.rst:1268 msgid "Hebrew" msgstr "希伯來文" -#: ../../library/codecs.rst:1128 +#: ../../library/codecs.rst:1133 msgid "cp437" msgstr "cp437" -#: ../../library/codecs.rst:1128 +#: ../../library/codecs.rst:1133 msgid "437, IBM437" msgstr "437, IBM437" -#: ../../library/codecs.rst:1130 +#: ../../library/codecs.rst:1135 msgid "cp500" msgstr "cp500" -#: ../../library/codecs.rst:1130 +#: ../../library/codecs.rst:1135 msgid "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" msgstr "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" -#: ../../library/codecs.rst:1130 ../../library/codecs.rst:1139 -#: ../../library/codecs.rst:1150 ../../library/codecs.rst:1187 -#: ../../library/codecs.rst:1194 ../../library/codecs.rst:1247 -#: ../../library/codecs.rst:1275 ../../library/codecs.rst:1303 +#: ../../library/codecs.rst:1135 ../../library/codecs.rst:1144 +#: ../../library/codecs.rst:1155 ../../library/codecs.rst:1192 +#: ../../library/codecs.rst:1199 ../../library/codecs.rst:1252 +#: ../../library/codecs.rst:1280 ../../library/codecs.rst:1308 msgid "Western Europe" msgstr "" -#: ../../library/codecs.rst:1133 +#: ../../library/codecs.rst:1138 msgid "cp720" msgstr "cp720" -#: ../../library/codecs.rst:1133 ../../library/codecs.rst:1160 -#: ../../library/codecs.rst:1202 ../../library/codecs.rst:1259 +#: ../../library/codecs.rst:1138 ../../library/codecs.rst:1165 +#: ../../library/codecs.rst:1207 ../../library/codecs.rst:1264 msgid "Arabic" msgstr "阿拉伯文" -#: ../../library/codecs.rst:1135 +#: ../../library/codecs.rst:1140 msgid "cp737" msgstr "cp737" -#: ../../library/codecs.rst:1135 ../../library/codecs.rst:1166 -#: ../../library/codecs.rst:1170 ../../library/codecs.rst:1196 -#: ../../library/codecs.rst:1261 ../../library/codecs.rst:1296 +#: ../../library/codecs.rst:1140 ../../library/codecs.rst:1171 +#: ../../library/codecs.rst:1175 ../../library/codecs.rst:1201 +#: ../../library/codecs.rst:1266 ../../library/codecs.rst:1301 msgid "Greek" msgstr "希臘文" -#: ../../library/codecs.rst:1137 +#: ../../library/codecs.rst:1142 msgid "cp775" msgstr "cp775" -#: ../../library/codecs.rst:1137 +#: ../../library/codecs.rst:1142 msgid "IBM775" msgstr "IBM775" -#: ../../library/codecs.rst:1137 ../../library/codecs.rst:1204 -#: ../../library/codecs.rst:1254 ../../library/codecs.rst:1271 +#: ../../library/codecs.rst:1142 ../../library/codecs.rst:1209 +#: ../../library/codecs.rst:1276 msgid "Baltic languages" msgstr "" -#: ../../library/codecs.rst:1139 +#: ../../library/codecs.rst:1144 msgid "cp850" msgstr "cp850" -#: ../../library/codecs.rst:1139 +#: ../../library/codecs.rst:1144 msgid "850, IBM850" msgstr "850, IBM850" -#: ../../library/codecs.rst:1141 +#: ../../library/codecs.rst:1146 msgid "cp852" msgstr "cp852" -#: ../../library/codecs.rst:1141 +#: ../../library/codecs.rst:1146 msgid "852, IBM852" msgstr "852, IBM852" -#: ../../library/codecs.rst:1141 ../../library/codecs.rst:1189 -#: ../../library/codecs.rst:1250 ../../library/codecs.rst:1300 +#: ../../library/codecs.rst:1146 ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1255 ../../library/codecs.rst:1305 msgid "Central and Eastern Europe" msgstr "" -#: ../../library/codecs.rst:1143 +#: ../../library/codecs.rst:1148 msgid "cp855" msgstr "cp855" -#: ../../library/codecs.rst:1143 +#: ../../library/codecs.rst:1148 msgid "855, IBM855" msgstr "855, IBM855" -#: ../../library/codecs.rst:1143 ../../library/codecs.rst:1191 -#: ../../library/codecs.rst:1256 ../../library/codecs.rst:1293 +#: ../../library/codecs.rst:1148 ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1261 ../../library/codecs.rst:1298 msgid "Belarusian, Bulgarian, Macedonian, Russian, Serbian" msgstr "" -#: ../../library/codecs.rst:1146 +#: ../../library/codecs.rst:1151 msgid "cp856" msgstr "cp856" -#: ../../library/codecs.rst:1148 +#: ../../library/codecs.rst:1153 msgid "cp857" msgstr "cp857" -#: ../../library/codecs.rst:1148 +#: ../../library/codecs.rst:1153 msgid "857, IBM857" msgstr "857, IBM857" -#: ../../library/codecs.rst:1148 ../../library/codecs.rst:1181 -#: ../../library/codecs.rst:1198 ../../library/codecs.rst:1265 -#: ../../library/codecs.rst:1305 +#: ../../library/codecs.rst:1153 ../../library/codecs.rst:1186 +#: ../../library/codecs.rst:1203 ../../library/codecs.rst:1270 +#: ../../library/codecs.rst:1310 msgid "Turkish" msgstr "土耳其文" -#: ../../library/codecs.rst:1150 +#: ../../library/codecs.rst:1155 msgid "cp858" msgstr "cp858" -#: ../../library/codecs.rst:1150 +#: ../../library/codecs.rst:1155 msgid "858, IBM858" msgstr "858, IBM858" -#: ../../library/codecs.rst:1152 +#: ../../library/codecs.rst:1157 msgid "cp860" msgstr "cp860" -#: ../../library/codecs.rst:1152 +#: ../../library/codecs.rst:1157 msgid "860, IBM860" msgstr "860, IBM860" -#: ../../library/codecs.rst:1152 +#: ../../library/codecs.rst:1157 msgid "Portuguese" msgstr "" -#: ../../library/codecs.rst:1154 +#: ../../library/codecs.rst:1159 msgid "cp861" msgstr "cp861" -#: ../../library/codecs.rst:1154 +#: ../../library/codecs.rst:1159 msgid "861, CP-IS, IBM861" msgstr "861, CP-IS, IBM861" -#: ../../library/codecs.rst:1154 ../../library/codecs.rst:1298 +#: ../../library/codecs.rst:1159 ../../library/codecs.rst:1303 msgid "Icelandic" msgstr "" -#: ../../library/codecs.rst:1156 +#: ../../library/codecs.rst:1161 msgid "cp862" msgstr "cp862" -#: ../../library/codecs.rst:1156 +#: ../../library/codecs.rst:1161 msgid "862, IBM862" msgstr "862, IBM862" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1163 msgid "cp863" msgstr "cp863" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1163 msgid "863, IBM863" msgstr "863, IBM863" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1163 msgid "Canadian" msgstr "" -#: ../../library/codecs.rst:1160 +#: ../../library/codecs.rst:1165 msgid "cp864" msgstr "cp864" -#: ../../library/codecs.rst:1160 +#: ../../library/codecs.rst:1165 msgid "IBM864" msgstr "IBM864" -#: ../../library/codecs.rst:1162 +#: ../../library/codecs.rst:1167 msgid "cp865" msgstr "cp865" -#: ../../library/codecs.rst:1162 +#: ../../library/codecs.rst:1167 msgid "865, IBM865" msgstr "865, IBM865" -#: ../../library/codecs.rst:1162 +#: ../../library/codecs.rst:1167 msgid "Danish, Norwegian" msgstr "" -#: ../../library/codecs.rst:1164 +#: ../../library/codecs.rst:1169 msgid "cp866" msgstr "cp866" -#: ../../library/codecs.rst:1164 +#: ../../library/codecs.rst:1169 msgid "866, IBM866" msgstr "866, IBM866" -#: ../../library/codecs.rst:1164 ../../library/codecs.rst:1281 +#: ../../library/codecs.rst:1169 ../../library/codecs.rst:1286 msgid "Russian" msgstr "俄羅斯文" -#: ../../library/codecs.rst:1166 +#: ../../library/codecs.rst:1171 msgid "cp869" msgstr "cp869" -#: ../../library/codecs.rst:1166 +#: ../../library/codecs.rst:1171 msgid "869, CP-GR, IBM869" msgstr "869, CP-GR, IBM869" -#: ../../library/codecs.rst:1168 +#: ../../library/codecs.rst:1173 msgid "cp874" msgstr "cp874" -#: ../../library/codecs.rst:1168 +#: ../../library/codecs.rst:1173 msgid "Thai" msgstr "泰文" -#: ../../library/codecs.rst:1170 +#: ../../library/codecs.rst:1175 msgid "cp875" msgstr "cp875" -#: ../../library/codecs.rst:1172 +#: ../../library/codecs.rst:1177 msgid "cp932" msgstr "cp932" -#: ../../library/codecs.rst:1172 +#: ../../library/codecs.rst:1177 msgid "932, ms932, mskanji, ms-kanji, windows-31j" msgstr "932, ms932, mskanji, ms-kanji, windows-31j" -#: ../../library/codecs.rst:1172 ../../library/codecs.rst:1208 -#: ../../library/codecs.rst:1210 ../../library/codecs.rst:1212 -#: ../../library/codecs.rst:1229 ../../library/codecs.rst:1232 -#: ../../library/codecs.rst:1237 ../../library/codecs.rst:1240 -#: ../../library/codecs.rst:1242 ../../library/codecs.rst:1310 -#: ../../library/codecs.rst:1313 ../../library/codecs.rst:1316 +#: ../../library/codecs.rst:1177 ../../library/codecs.rst:1213 +#: ../../library/codecs.rst:1215 ../../library/codecs.rst:1217 +#: ../../library/codecs.rst:1234 ../../library/codecs.rst:1237 +#: ../../library/codecs.rst:1242 ../../library/codecs.rst:1245 +#: ../../library/codecs.rst:1247 ../../library/codecs.rst:1315 +#: ../../library/codecs.rst:1318 ../../library/codecs.rst:1321 msgid "Japanese" msgstr "日文" -#: ../../library/codecs.rst:1175 +#: ../../library/codecs.rst:1180 msgid "cp949" msgstr "cp949" -#: ../../library/codecs.rst:1175 +#: ../../library/codecs.rst:1180 msgid "949, ms949, uhc" msgstr "949, ms949, uhc" -#: ../../library/codecs.rst:1175 ../../library/codecs.rst:1214 -#: ../../library/codecs.rst:1244 ../../library/codecs.rst:1279 +#: ../../library/codecs.rst:1180 ../../library/codecs.rst:1219 +#: ../../library/codecs.rst:1249 ../../library/codecs.rst:1284 msgid "Korean" msgstr "韓文" -#: ../../library/codecs.rst:1177 +#: ../../library/codecs.rst:1182 msgid "cp950" msgstr "cp950" -#: ../../library/codecs.rst:1177 +#: ../../library/codecs.rst:1182 msgid "950, ms950" msgstr "950, ms950" -#: ../../library/codecs.rst:1179 +#: ../../library/codecs.rst:1184 msgid "cp1006" msgstr "cp1006" -#: ../../library/codecs.rst:1179 +#: ../../library/codecs.rst:1184 msgid "Urdu" msgstr "" -#: ../../library/codecs.rst:1181 +#: ../../library/codecs.rst:1186 msgid "cp1026" msgstr "cp1026" -#: ../../library/codecs.rst:1181 +#: ../../library/codecs.rst:1186 msgid "ibm1026" msgstr "ibm1026" -#: ../../library/codecs.rst:1183 +#: ../../library/codecs.rst:1188 msgid "cp1125" msgstr "cp1125" -#: ../../library/codecs.rst:1183 +#: ../../library/codecs.rst:1188 msgid "1125, ibm1125, cp866u, ruscii" msgstr "1125, ibm1125, cp866u, ruscii" -#: ../../library/codecs.rst:1183 ../../library/codecs.rst:1287 +#: ../../library/codecs.rst:1188 ../../library/codecs.rst:1292 msgid "Ukrainian" msgstr "烏克蘭文" -#: ../../library/codecs.rst:1187 +#: ../../library/codecs.rst:1192 msgid "cp1140" msgstr "cp1140" -#: ../../library/codecs.rst:1187 +#: ../../library/codecs.rst:1192 msgid "ibm1140" msgstr "ibm1140" -#: ../../library/codecs.rst:1189 +#: ../../library/codecs.rst:1194 msgid "cp1250" msgstr "cp1250" -#: ../../library/codecs.rst:1189 +#: ../../library/codecs.rst:1194 msgid "windows-1250" msgstr "windows-1250" -#: ../../library/codecs.rst:1191 +#: ../../library/codecs.rst:1196 msgid "cp1251" msgstr "cp1251" -#: ../../library/codecs.rst:1191 +#: ../../library/codecs.rst:1196 msgid "windows-1251" msgstr "windows-1251" -#: ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1199 msgid "cp1252" msgstr "cp1252" -#: ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1199 msgid "windows-1252" msgstr "windows-1252" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1201 msgid "cp1253" msgstr "cp1253" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1201 msgid "windows-1253" msgstr "windows-1253" -#: ../../library/codecs.rst:1198 +#: ../../library/codecs.rst:1203 msgid "cp1254" msgstr "cp1254" -#: ../../library/codecs.rst:1198 +#: ../../library/codecs.rst:1203 msgid "windows-1254" msgstr "windows-1254" -#: ../../library/codecs.rst:1200 +#: ../../library/codecs.rst:1205 msgid "cp1255" msgstr "cp1255" -#: ../../library/codecs.rst:1200 +#: ../../library/codecs.rst:1205 msgid "windows-1255" msgstr "windows-1255" -#: ../../library/codecs.rst:1202 +#: ../../library/codecs.rst:1207 msgid "cp1256" msgstr "cp1256" -#: ../../library/codecs.rst:1202 +#: ../../library/codecs.rst:1207 msgid "windows-1256" msgstr "windows-1256" -#: ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1209 msgid "cp1257" msgstr "cp1257" -#: ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1209 msgid "windows-1257" msgstr "windows-1257" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1211 msgid "cp1258" msgstr "cp1258" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1211 msgid "windows-1258" msgstr "windows-1258" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1211 msgid "Vietnamese" msgstr "越南文" -#: ../../library/codecs.rst:1208 +#: ../../library/codecs.rst:1213 msgid "euc_jp" msgstr "euc_jp" -#: ../../library/codecs.rst:1208 +#: ../../library/codecs.rst:1213 msgid "eucjp, ujis, u-jis" msgstr "eucjp, ujis, u-jis" -#: ../../library/codecs.rst:1210 +#: ../../library/codecs.rst:1215 msgid "euc_jis_2004" msgstr "euc_jis_2004" -#: ../../library/codecs.rst:1210 +#: ../../library/codecs.rst:1215 msgid "jisx0213, eucjis2004" msgstr "jisx0213, eucjis2004" -#: ../../library/codecs.rst:1212 +#: ../../library/codecs.rst:1217 msgid "euc_jisx0213" msgstr "euc_jisx0213" -#: ../../library/codecs.rst:1212 +#: ../../library/codecs.rst:1217 msgid "eucjisx0213" msgstr "eucjisx0213" -#: ../../library/codecs.rst:1214 +#: ../../library/codecs.rst:1219 msgid "euc_kr" msgstr "euc_kr" -#: ../../library/codecs.rst:1214 +#: ../../library/codecs.rst:1219 msgid "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" msgstr "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" -#: ../../library/codecs.rst:1218 +#: ../../library/codecs.rst:1223 msgid "gb2312" msgstr "gb2312" -#: ../../library/codecs.rst:1218 +#: ../../library/codecs.rst:1223 msgid "" "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " "gb2312-80, iso-ir-58" @@ -1904,450 +1909,454 @@ msgstr "" "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " "gb2312-80, iso-ir-58" -#: ../../library/codecs.rst:1218 ../../library/codecs.rst:1227 +#: ../../library/codecs.rst:1223 ../../library/codecs.rst:1232 msgid "Simplified Chinese" msgstr "簡體中文" -#: ../../library/codecs.rst:1223 +#: ../../library/codecs.rst:1228 msgid "gbk" msgstr "gbk" -#: ../../library/codecs.rst:1223 +#: ../../library/codecs.rst:1228 msgid "936, cp936, ms936" msgstr "936, cp936, ms936" -#: ../../library/codecs.rst:1223 ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1228 ../../library/codecs.rst:1230 msgid "Unified Chinese" msgstr "" -#: ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1230 msgid "gb18030" msgstr "gb18030" -#: ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1230 msgid "gb18030-2000" msgstr "gb18030-2000" -#: ../../library/codecs.rst:1227 +#: ../../library/codecs.rst:1232 msgid "hz" msgstr "hz" -#: ../../library/codecs.rst:1227 +#: ../../library/codecs.rst:1232 msgid "hzgb, hz-gb, hz-gb-2312" msgstr "hzgb, hz-gb, hz-gb-2312" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1234 msgid "iso2022_jp" msgstr "iso2022_jp" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1234 msgid "csiso2022jp, iso2022jp, iso-2022-jp" msgstr "csiso2022jp, iso2022jp, iso-2022-jp" -#: ../../library/codecs.rst:1232 +#: ../../library/codecs.rst:1237 msgid "iso2022_jp_1" msgstr "iso2022_jp_1" -#: ../../library/codecs.rst:1232 +#: ../../library/codecs.rst:1237 msgid "iso2022jp-1, iso-2022-jp-1" msgstr "iso2022jp-1, iso-2022-jp-1" -#: ../../library/codecs.rst:1234 +#: ../../library/codecs.rst:1239 msgid "iso2022_jp_2" msgstr "iso2022_jp_2" -#: ../../library/codecs.rst:1234 +#: ../../library/codecs.rst:1239 msgid "iso2022jp-2, iso-2022-jp-2" msgstr "iso2022jp-2, iso-2022-jp-2" -#: ../../library/codecs.rst:1234 +#: ../../library/codecs.rst:1239 msgid "Japanese, Korean, Simplified Chinese, Western Europe, Greek" msgstr "" -#: ../../library/codecs.rst:1237 +#: ../../library/codecs.rst:1242 msgid "iso2022_jp_2004" msgstr "iso2022_jp_2004" -#: ../../library/codecs.rst:1237 +#: ../../library/codecs.rst:1242 msgid "iso2022jp-2004, iso-2022-jp-2004" msgstr "iso2022jp-2004, iso-2022-jp-2004" -#: ../../library/codecs.rst:1240 +#: ../../library/codecs.rst:1245 msgid "iso2022_jp_3" msgstr "iso2022_jp_3" -#: ../../library/codecs.rst:1240 +#: ../../library/codecs.rst:1245 msgid "iso2022jp-3, iso-2022-jp-3" msgstr "iso2022jp-3, iso-2022-jp-3" -#: ../../library/codecs.rst:1242 +#: ../../library/codecs.rst:1247 msgid "iso2022_jp_ext" msgstr "iso2022_jp_ext" -#: ../../library/codecs.rst:1242 +#: ../../library/codecs.rst:1247 msgid "iso2022jp-ext, iso-2022-jp-ext" msgstr "iso2022jp-ext, iso-2022-jp-ext" -#: ../../library/codecs.rst:1244 +#: ../../library/codecs.rst:1249 msgid "iso2022_kr" msgstr "iso2022_kr" -#: ../../library/codecs.rst:1244 +#: ../../library/codecs.rst:1249 msgid "csiso2022kr, iso2022kr, iso-2022-kr" msgstr "csiso2022kr, iso2022kr, iso-2022-kr" -#: ../../library/codecs.rst:1247 +#: ../../library/codecs.rst:1252 msgid "latin_1" msgstr "latin_1" -#: ../../library/codecs.rst:1247 +#: ../../library/codecs.rst:1252 msgid "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" msgstr "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" -#: ../../library/codecs.rst:1250 +#: ../../library/codecs.rst:1255 msgid "iso8859_2" msgstr "iso8859_2" -#: ../../library/codecs.rst:1250 +#: ../../library/codecs.rst:1255 msgid "iso-8859-2, latin2, L2" msgstr "iso-8859-2, latin2, L2" -#: ../../library/codecs.rst:1252 +#: ../../library/codecs.rst:1257 msgid "iso8859_3" msgstr "iso8859_3" -#: ../../library/codecs.rst:1252 +#: ../../library/codecs.rst:1257 msgid "iso-8859-3, latin3, L3" msgstr "iso-8859-3, latin3, L3" -#: ../../library/codecs.rst:1252 +#: ../../library/codecs.rst:1257 msgid "Esperanto, Maltese" msgstr "" -#: ../../library/codecs.rst:1254 +#: ../../library/codecs.rst:1259 msgid "iso8859_4" msgstr "iso8859_4" -#: ../../library/codecs.rst:1254 +#: ../../library/codecs.rst:1259 msgid "iso-8859-4, latin4, L4" msgstr "iso-8859-4, latin4, L4" -#: ../../library/codecs.rst:1256 +#: ../../library/codecs.rst:1259 +msgid "Northern Europe" +msgstr "" + +#: ../../library/codecs.rst:1261 msgid "iso8859_5" msgstr "iso8859_5" -#: ../../library/codecs.rst:1256 +#: ../../library/codecs.rst:1261 msgid "iso-8859-5, cyrillic" msgstr "iso-8859-5, cyrillic" -#: ../../library/codecs.rst:1259 +#: ../../library/codecs.rst:1264 msgid "iso8859_6" msgstr "iso8859_6" -#: ../../library/codecs.rst:1259 +#: ../../library/codecs.rst:1264 msgid "iso-8859-6, arabic" msgstr "iso-8859-6, arabic" -#: ../../library/codecs.rst:1261 +#: ../../library/codecs.rst:1266 msgid "iso8859_7" msgstr "iso8859_7" -#: ../../library/codecs.rst:1261 +#: ../../library/codecs.rst:1266 msgid "iso-8859-7, greek, greek8" msgstr "iso-8859-7, greek, greek8" -#: ../../library/codecs.rst:1263 +#: ../../library/codecs.rst:1268 msgid "iso8859_8" msgstr "iso8859_8" -#: ../../library/codecs.rst:1263 +#: ../../library/codecs.rst:1268 msgid "iso-8859-8, hebrew" msgstr "iso-8859-8, hebrew" -#: ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1270 msgid "iso8859_9" msgstr "iso8859_9" -#: ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1270 msgid "iso-8859-9, latin5, L5" msgstr "iso-8859-9, latin5, L5" -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1272 msgid "iso8859_10" msgstr "iso8859_10" -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1272 msgid "iso-8859-10, latin6, L6" msgstr "iso-8859-10, latin6, L6" -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1272 msgid "Nordic languages" msgstr "" -#: ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1274 msgid "iso8859_11" msgstr "iso8859_11" -#: ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1274 msgid "iso-8859-11, thai" msgstr "iso-8859-11, thai" -#: ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1274 msgid "Thai languages" msgstr "泰語" -#: ../../library/codecs.rst:1271 +#: ../../library/codecs.rst:1276 msgid "iso8859_13" msgstr "iso8859_13" -#: ../../library/codecs.rst:1271 +#: ../../library/codecs.rst:1276 msgid "iso-8859-13, latin7, L7" msgstr "iso-8859-13, latin7, L7" -#: ../../library/codecs.rst:1273 +#: ../../library/codecs.rst:1278 msgid "iso8859_14" msgstr "iso8859_14" -#: ../../library/codecs.rst:1273 +#: ../../library/codecs.rst:1278 msgid "iso-8859-14, latin8, L8" msgstr "iso-8859-14, latin8, L8" -#: ../../library/codecs.rst:1273 +#: ../../library/codecs.rst:1278 msgid "Celtic languages" msgstr "" -#: ../../library/codecs.rst:1275 +#: ../../library/codecs.rst:1280 msgid "iso8859_15" msgstr "iso8859_15" -#: ../../library/codecs.rst:1275 +#: ../../library/codecs.rst:1280 msgid "iso-8859-15, latin9, L9" msgstr "iso-8859-15, latin9, L9" -#: ../../library/codecs.rst:1277 +#: ../../library/codecs.rst:1282 msgid "iso8859_16" msgstr "iso8859_16" -#: ../../library/codecs.rst:1277 +#: ../../library/codecs.rst:1282 msgid "iso-8859-16, latin10, L10" msgstr "iso-8859-16, latin10, L10" -#: ../../library/codecs.rst:1277 +#: ../../library/codecs.rst:1282 msgid "South-Eastern Europe" msgstr "" -#: ../../library/codecs.rst:1279 +#: ../../library/codecs.rst:1284 msgid "johab" msgstr "" -#: ../../library/codecs.rst:1279 +#: ../../library/codecs.rst:1284 msgid "cp1361, ms1361" msgstr "cp1361, ms1361" -#: ../../library/codecs.rst:1281 +#: ../../library/codecs.rst:1286 msgid "koi8_r" msgstr "koi8_r" -#: ../../library/codecs.rst:1283 +#: ../../library/codecs.rst:1288 msgid "koi8_t" msgstr "koi8_t" -#: ../../library/codecs.rst:1283 +#: ../../library/codecs.rst:1288 msgid "Tajik" msgstr "" -#: ../../library/codecs.rst:1287 +#: ../../library/codecs.rst:1292 msgid "koi8_u" msgstr "koi8_u" -#: ../../library/codecs.rst:1289 +#: ../../library/codecs.rst:1294 msgid "kz1048" msgstr "kz1048" -#: ../../library/codecs.rst:1289 +#: ../../library/codecs.rst:1294 msgid "kz_1048, strk1048_2002, rk1048" msgstr "kz_1048, strk1048_2002, rk1048" -#: ../../library/codecs.rst:1289 ../../library/codecs.rst:1307 +#: ../../library/codecs.rst:1294 ../../library/codecs.rst:1312 msgid "Kazakh" msgstr "" -#: ../../library/codecs.rst:1293 +#: ../../library/codecs.rst:1298 msgid "mac_cyrillic" msgstr "mac_cyrillic" -#: ../../library/codecs.rst:1293 +#: ../../library/codecs.rst:1298 msgid "maccyrillic" msgstr "" -#: ../../library/codecs.rst:1296 +#: ../../library/codecs.rst:1301 msgid "mac_greek" msgstr "mac_greek" -#: ../../library/codecs.rst:1296 +#: ../../library/codecs.rst:1301 msgid "macgreek" msgstr "" -#: ../../library/codecs.rst:1298 +#: ../../library/codecs.rst:1303 msgid "mac_iceland" msgstr "mac_iceland" -#: ../../library/codecs.rst:1298 +#: ../../library/codecs.rst:1303 msgid "maciceland" msgstr "" -#: ../../library/codecs.rst:1300 +#: ../../library/codecs.rst:1305 msgid "mac_latin2" msgstr "mac_latin2" -#: ../../library/codecs.rst:1300 +#: ../../library/codecs.rst:1305 msgid "maclatin2, maccentraleurope, mac_centeuro" msgstr "maclatin2, maccentraleurope, mac_centeuro" -#: ../../library/codecs.rst:1303 +#: ../../library/codecs.rst:1308 msgid "mac_roman" msgstr "mac_roman" -#: ../../library/codecs.rst:1303 +#: ../../library/codecs.rst:1308 msgid "macroman, macintosh" msgstr "macroman, macintosh" -#: ../../library/codecs.rst:1305 +#: ../../library/codecs.rst:1310 msgid "mac_turkish" msgstr "mac_turkish" -#: ../../library/codecs.rst:1305 +#: ../../library/codecs.rst:1310 msgid "macturkish" msgstr "" -#: ../../library/codecs.rst:1307 +#: ../../library/codecs.rst:1312 msgid "ptcp154" msgstr "ptcp154" -#: ../../library/codecs.rst:1307 +#: ../../library/codecs.rst:1312 msgid "csptcp154, pt154, cp154, cyrillic-asian" msgstr "csptcp154, pt154, cp154, cyrillic-asian" -#: ../../library/codecs.rst:1310 +#: ../../library/codecs.rst:1315 msgid "shift_jis" msgstr "shift_jis" -#: ../../library/codecs.rst:1310 +#: ../../library/codecs.rst:1315 msgid "csshiftjis, shiftjis, sjis, s_jis" msgstr "csshiftjis, shiftjis, sjis, s_jis" -#: ../../library/codecs.rst:1313 +#: ../../library/codecs.rst:1318 msgid "shift_jis_2004" msgstr "shift_jis_2004" -#: ../../library/codecs.rst:1313 +#: ../../library/codecs.rst:1318 msgid "shiftjis2004, sjis_2004, sjis2004" msgstr "shiftjis2004, sjis_2004, sjis2004" -#: ../../library/codecs.rst:1316 +#: ../../library/codecs.rst:1321 msgid "shift_jisx0213" msgstr "shift_jisx0213" -#: ../../library/codecs.rst:1316 +#: ../../library/codecs.rst:1321 msgid "shiftjisx0213, sjisx0213, s_jisx0213" msgstr "shiftjisx0213, sjisx0213, s_jisx0213" -#: ../../library/codecs.rst:1319 +#: ../../library/codecs.rst:1324 msgid "utf_32" msgstr "utf_32" -#: ../../library/codecs.rst:1319 +#: ../../library/codecs.rst:1324 msgid "U32, utf32" msgstr "U32, utf32" -#: ../../library/codecs.rst:1319 ../../library/codecs.rst:1321 -#: ../../library/codecs.rst:1323 ../../library/codecs.rst:1325 -#: ../../library/codecs.rst:1327 ../../library/codecs.rst:1329 -#: ../../library/codecs.rst:1331 ../../library/codecs.rst:1333 -#: ../../library/codecs.rst:1335 +#: ../../library/codecs.rst:1324 ../../library/codecs.rst:1326 +#: ../../library/codecs.rst:1328 ../../library/codecs.rst:1330 +#: ../../library/codecs.rst:1332 ../../library/codecs.rst:1334 +#: ../../library/codecs.rst:1336 ../../library/codecs.rst:1338 +#: ../../library/codecs.rst:1340 msgid "all languages" msgstr "" -#: ../../library/codecs.rst:1321 +#: ../../library/codecs.rst:1326 msgid "utf_32_be" msgstr "utf_32_be" -#: ../../library/codecs.rst:1321 +#: ../../library/codecs.rst:1326 msgid "UTF-32BE" msgstr "UTF-32BE" -#: ../../library/codecs.rst:1323 +#: ../../library/codecs.rst:1328 msgid "utf_32_le" msgstr "utf_32_le" -#: ../../library/codecs.rst:1323 +#: ../../library/codecs.rst:1328 msgid "UTF-32LE" msgstr "UTF-32LE" -#: ../../library/codecs.rst:1325 +#: ../../library/codecs.rst:1330 msgid "utf_16" msgstr "utf_16" -#: ../../library/codecs.rst:1325 +#: ../../library/codecs.rst:1330 msgid "U16, utf16" msgstr "U16, utf16" -#: ../../library/codecs.rst:1327 +#: ../../library/codecs.rst:1332 msgid "utf_16_be" msgstr "utf_16_be" -#: ../../library/codecs.rst:1327 +#: ../../library/codecs.rst:1332 msgid "UTF-16BE" msgstr "UTF-16BE" -#: ../../library/codecs.rst:1329 +#: ../../library/codecs.rst:1334 msgid "utf_16_le" msgstr "utf_16_le" -#: ../../library/codecs.rst:1329 +#: ../../library/codecs.rst:1334 msgid "UTF-16LE" msgstr "UTF-16LE" -#: ../../library/codecs.rst:1331 +#: ../../library/codecs.rst:1336 msgid "utf_7" msgstr "utf_7" -#: ../../library/codecs.rst:1331 +#: ../../library/codecs.rst:1336 msgid "U7, unicode-1-1-utf-7" msgstr "U7, unicode-1-1-utf-7" -#: ../../library/codecs.rst:1333 +#: ../../library/codecs.rst:1338 msgid "utf_8" msgstr "utf_8" -#: ../../library/codecs.rst:1333 +#: ../../library/codecs.rst:1338 msgid "U8, UTF, utf8, cp65001" msgstr "U8, UTF, utf8, cp65001" -#: ../../library/codecs.rst:1335 +#: ../../library/codecs.rst:1340 msgid "utf_8_sig" msgstr "utf_8_sig" -#: ../../library/codecs.rst:1338 +#: ../../library/codecs.rst:1343 msgid "" "The utf-16\\* and utf-32\\* encoders no longer allow surrogate code points " "(``U+D800``--``U+DFFF``) to be encoded. The utf-32\\* decoders no longer " "decode byte sequences that correspond to surrogate code points." msgstr "" -#: ../../library/codecs.rst:1344 +#: ../../library/codecs.rst:1349 msgid "``cp65001`` is now an alias to ``utf_8``." msgstr "``cp65001`` 現在是 ``utf_8`` 的別名。" -#: ../../library/codecs.rst:1347 +#: ../../library/codecs.rst:1352 msgid "On Windows, ``cpXXX`` codecs are now available for all code pages." msgstr "" -#: ../../library/codecs.rst:1352 +#: ../../library/codecs.rst:1357 msgid "Python Specific Encodings" msgstr "" -#: ../../library/codecs.rst:1354 +#: ../../library/codecs.rst:1359 msgid "" "A number of predefined codecs are specific to Python, so their codec names " "have no meaning outside Python. These are listed in the tables below based " @@ -2357,279 +2366,316 @@ msgid "" "asymmetric codecs, the stated meaning describes the encoding direction." msgstr "" -#: ../../library/codecs.rst:1362 +#: ../../library/codecs.rst:1367 msgid "Text Encodings" msgstr "" -#: ../../library/codecs.rst:1364 +#: ../../library/codecs.rst:1369 msgid "" -"The following codecs provide :class:`str` to :class:`bytes` encoding " -"and :term:`bytes-like object` to :class:`str` decoding, similar to the " -"Unicode text encodings." +"The following codecs provide :class:`str` to :class:`bytes` encoding and :" +"term:`bytes-like object` to :class:`str` decoding, similar to the Unicode " +"text encodings." msgstr "" -#: ../../library/codecs.rst:1373 +#: ../../library/codecs.rst:1378 msgid "idna" msgstr "idna" -#: ../../library/codecs.rst:1373 +#: ../../library/codecs.rst:1378 msgid "" "Implement :rfc:`3490`, see also :mod:`encodings.idna`. Only " "``errors='strict'`` is supported." msgstr "" -#: ../../library/codecs.rst:1379 +#: ../../library/codecs.rst:1384 msgid "mbcs" msgstr "mbcs" -#: ../../library/codecs.rst:1379 +#: ../../library/codecs.rst:1384 msgid "ansi, dbcs" msgstr "ansi, dbcs" -#: ../../library/codecs.rst:1379 +#: ../../library/codecs.rst:1384 msgid "" "Windows only: Encode the operand according to the ANSI codepage (CP_ACP)." msgstr "" -#: ../../library/codecs.rst:1383 +#: ../../library/codecs.rst:1388 msgid "oem" msgstr "oem" -#: ../../library/codecs.rst:1383 +#: ../../library/codecs.rst:1388 msgid "" "Windows only: Encode the operand according to the OEM codepage (CP_OEMCP)." msgstr "" -#: ../../library/codecs.rst:1389 +#: ../../library/codecs.rst:1394 msgid "palmos" msgstr "" -#: ../../library/codecs.rst:1389 +#: ../../library/codecs.rst:1394 msgid "Encoding of PalmOS 3.5." msgstr "" -#: ../../library/codecs.rst:1391 +#: ../../library/codecs.rst:1396 msgid "punycode" msgstr "" -#: ../../library/codecs.rst:1391 +#: ../../library/codecs.rst:1396 msgid "Implement :rfc:`3492`. Stateful codecs are not supported." msgstr "" -#: ../../library/codecs.rst:1395 +#: ../../library/codecs.rst:1400 msgid "raw_unicode_escape" msgstr "raw_unicode_escape" -#: ../../library/codecs.rst:1395 +#: ../../library/codecs.rst:1400 msgid "" "Latin-1 encoding with :samp:`\\\\u{XXXX}` and :samp:`\\\\U{XXXXXXXX}` for " "other code points. Existing backslashes are not escaped in any way. It is " "used in the Python pickle protocol." msgstr "" -#: ../../library/codecs.rst:1405 +#: ../../library/codecs.rst:1410 msgid "undefined" msgstr "" -#: ../../library/codecs.rst:1405 +#: ../../library/codecs.rst:1410 msgid "This Codec should only be used for testing purposes." msgstr "" -#: ../../library/codecs.rst:1409 +#: ../../library/codecs.rst:1414 msgid "" "Raise an exception for all conversions, even empty strings. The error " "handler is ignored." msgstr "" -#: ../../library/codecs.rst:1414 +#: ../../library/codecs.rst:1419 msgid "unicode_escape" msgstr "unicode_escape" -#: ../../library/codecs.rst:1414 +#: ../../library/codecs.rst:1419 msgid "" "Encoding suitable as the contents of a Unicode literal in ASCII-encoded " "Python source code, except that quotes are not escaped. Decode from Latin-1 " "source code. Beware that Python source code actually uses UTF-8 by default." msgstr "" -#: ../../library/codecs.rst:1426 +#: ../../library/codecs.rst:1431 msgid "\"unicode_internal\" codec is removed." msgstr "" -#: ../../library/codecs.rst:1433 +#: ../../library/codecs.rst:1438 msgid "Binary Transforms" msgstr "" -#: ../../library/codecs.rst:1435 +#: ../../library/codecs.rst:1440 msgid "" "The following codecs provide binary transforms: :term:`bytes-like object` " "to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode` " "(which only produces :class:`str` output)." msgstr "" -#: ../../library/codecs.rst:1443 +#: ../../library/codecs.rst:1448 msgid "Encoder / decoder" msgstr "" -#: ../../library/codecs.rst:1445 +#: ../../library/codecs.rst:1450 msgid "base64_codec [#b64]_" msgstr "base64_codec [#b64]_" -#: ../../library/codecs.rst:1445 +#: ../../library/codecs.rst:1450 msgid "base64, base_64" msgstr "base64, base_64" -#: ../../library/codecs.rst:1445 +#: ../../library/codecs.rst:1450 msgid "" "Convert the operand to multiline MIME base64 (the result always includes a " "trailing ``'\\n'``)." msgstr "" -#: ../../library/codecs.rst:1450 +#: ../../library/codecs.rst:1455 msgid "" "accepts any :term:`bytes-like object` as input for encoding and decoding" msgstr "" -#: ../../library/codecs.rst:1445 +#: ../../library/codecs.rst:1450 msgid ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" msgstr ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" -#: ../../library/codecs.rst:1456 +#: ../../library/codecs.rst:1461 msgid "bz2_codec" msgstr "bz2_codec" -#: ../../library/codecs.rst:1456 +#: ../../library/codecs.rst:1461 msgid "bz2" msgstr "bz2" -#: ../../library/codecs.rst:1456 +#: ../../library/codecs.rst:1461 msgid "Compress the operand using bz2." msgstr "" -#: ../../library/codecs.rst:1456 +#: ../../library/codecs.rst:1461 msgid ":meth:`bz2.compress` / :meth:`bz2.decompress`" msgstr ":meth:`bz2.compress` / :meth:`bz2.decompress`" -#: ../../library/codecs.rst:1459 +#: ../../library/codecs.rst:1464 msgid "hex_codec" msgstr "hex_codec" -#: ../../library/codecs.rst:1459 +#: ../../library/codecs.rst:1464 msgid "hex" msgstr "hex" -#: ../../library/codecs.rst:1459 +#: ../../library/codecs.rst:1464 msgid "" "Convert the operand to hexadecimal representation, with two digits per byte." msgstr "" -#: ../../library/codecs.rst:1459 +#: ../../library/codecs.rst:1464 msgid ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" msgstr ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" -#: ../../library/codecs.rst:1464 +#: ../../library/codecs.rst:1469 msgid "quopri_codec" msgstr "quopri_codec" -#: ../../library/codecs.rst:1464 +#: ../../library/codecs.rst:1469 msgid "quopri, quotedprintable, quoted_printable" msgstr "quopri, quotedprintable, quoted_printable" -#: ../../library/codecs.rst:1464 +#: ../../library/codecs.rst:1469 msgid "Convert the operand to MIME quoted printable." msgstr "" -#: ../../library/codecs.rst:1464 +#: ../../library/codecs.rst:1469 msgid ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" msgstr ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" -#: ../../library/codecs.rst:1468 +#: ../../library/codecs.rst:1473 msgid "uu_codec" msgstr "uu_codec" -#: ../../library/codecs.rst:1468 +#: ../../library/codecs.rst:1473 msgid "uu" msgstr "uu" -#: ../../library/codecs.rst:1468 +#: ../../library/codecs.rst:1473 msgid "Convert the operand using uuencode." msgstr "" -#: ../../library/codecs.rst:1471 +#: ../../library/codecs.rst:1476 msgid "zlib_codec" msgstr "zlib_codec" -#: ../../library/codecs.rst:1471 +#: ../../library/codecs.rst:1476 msgid "zip, zlib" msgstr "zip, zlib" -#: ../../library/codecs.rst:1471 +#: ../../library/codecs.rst:1476 msgid "Compress the operand using gzip." msgstr "" -#: ../../library/codecs.rst:1471 +#: ../../library/codecs.rst:1476 msgid ":meth:`zlib.compress` / :meth:`zlib.decompress`" msgstr ":meth:`zlib.compress` / :meth:`zlib.decompress`" -#: ../../library/codecs.rst:1475 +#: ../../library/codecs.rst:1480 msgid "" "In addition to :term:`bytes-like objects `, " "``'base64_codec'`` also accepts ASCII-only instances of :class:`str` for " "decoding" msgstr "" -#: ../../library/codecs.rst:1479 +#: ../../library/codecs.rst:1484 msgid "Restoration of the binary transforms." msgstr "" -#: ../../library/codecs.rst:1482 +#: ../../library/codecs.rst:1487 msgid "Restoration of the aliases for the binary transforms." msgstr "" -#: ../../library/codecs.rst:1489 +#: ../../library/codecs.rst:1494 +msgid "Standalone Codec Functions" +msgstr "" + +#: ../../library/codecs.rst:1496 +msgid "" +"The following functions provide encoding and decoding functionality similar " +"to codecs, but are not available as named codecs through :func:`codecs." +"encode` or :func:`codecs.decode`. They are used internally (for example, by :" +"mod:`pickle`) and behave similarly to the ``string_escape`` codec that was " +"removed in Python 3." +msgstr "" + +#: ../../library/codecs.rst:1503 +msgid "" +"Encode *input* using escape sequences. Similar to how :func:`repr` on bytes " +"produces escaped byte values." +msgstr "" + +#: ../../library/codecs.rst:1506 +msgid "*input* must be a :class:`bytes` object." +msgstr "" + +#: ../../library/codecs.rst:1508 ../../library/codecs.rst:1517 +msgid "" +"Returns a tuple ``(output, length)`` where *output* is a :class:`bytes` " +"object and *length* is the number of bytes consumed." +msgstr "" + +#: ../../library/codecs.rst:1513 +msgid "Decode *input* from escape sequences back to the original bytes." +msgstr "" + +#: ../../library/codecs.rst:1515 +msgid "*input* must be a :term:`bytes-like object`." +msgstr "*input* 必須是個 :term:`bytes-like object`。" + +#: ../../library/codecs.rst:1524 msgid "Text Transforms" msgstr "" -#: ../../library/codecs.rst:1491 +#: ../../library/codecs.rst:1526 msgid "" -"The following codec provides a text transform: a :class:`str` " -"to :class:`str` mapping. It is not supported by :meth:`str.encode` (which " -"only produces :class:`bytes` output)." +"The following codec provides a text transform: a :class:`str` to :class:" +"`str` mapping. It is not supported by :meth:`str.encode` (which only " +"produces :class:`bytes` output)." msgstr "" -#: ../../library/codecs.rst:1500 +#: ../../library/codecs.rst:1535 msgid "rot_13" msgstr "rot_13" -#: ../../library/codecs.rst:1500 +#: ../../library/codecs.rst:1535 msgid "rot13" msgstr "" -#: ../../library/codecs.rst:1500 +#: ../../library/codecs.rst:1535 msgid "Return the Caesar-cypher encryption of the operand." msgstr "" -#: ../../library/codecs.rst:1505 +#: ../../library/codecs.rst:1540 msgid "Restoration of the ``rot_13`` text transform." msgstr "" -#: ../../library/codecs.rst:1508 +#: ../../library/codecs.rst:1543 msgid "Restoration of the ``rot13`` alias." msgstr "" -#: ../../library/codecs.rst:1513 +#: ../../library/codecs.rst:1548 msgid ":mod:`encodings` --- Encodings package" msgstr "" -#: ../../library/codecs.rst:1518 +#: ../../library/codecs.rst:1553 msgid "This module implements the following functions:" msgstr "" -#: ../../library/codecs.rst:1522 +#: ../../library/codecs.rst:1557 msgid "Normalize encoding name *encoding*." msgstr "" -#: ../../library/codecs.rst:1524 +#: ../../library/codecs.rst:1559 msgid "" "Normalization works as follows: all non-alphanumeric characters except the " "dot used for Python package names are collapsed and replaced with a single " @@ -2637,67 +2683,67 @@ msgid "" "-;#'`` becomes ``'_'``." msgstr "" -#: ../../library/codecs.rst:1529 +#: ../../library/codecs.rst:1564 msgid "Note that *encoding* should be ASCII only." msgstr "" -#: ../../library/codecs.rst:1533 +#: ../../library/codecs.rst:1568 msgid "" "The following functions should not be used directly, except for testing " "purposes; :func:`codecs.lookup` should be used instead." msgstr "" -#: ../../library/codecs.rst:1539 +#: ../../library/codecs.rst:1574 msgid "" "Search for the codec module corresponding to the given encoding name " "*encoding*." msgstr "" -#: ../../library/codecs.rst:1542 +#: ../../library/codecs.rst:1577 msgid "" -"This function first normalizes the *encoding* " -"using :func:`normalize_encoding`, then looks for a corresponding alias. It " -"attempts to import a codec module from the encodings package using either " -"the alias or the normalized name. If the module is found and defines a valid " +"This function first normalizes the *encoding* using :func:" +"`normalize_encoding`, then looks for a corresponding alias. It attempts to " +"import a codec module from the encodings package using either the alias or " +"the normalized name. If the module is found and defines a valid " "``getregentry()`` function that returns a :class:`codecs.CodecInfo` object, " "the codec is cached and returned." msgstr "" -#: ../../library/codecs.rst:1549 +#: ../../library/codecs.rst:1584 msgid "" "If the codec module defines a ``getaliases()`` function any returned aliases " "are registered for future use." msgstr "" -#: ../../library/codecs.rst:1555 +#: ../../library/codecs.rst:1590 msgid "" "Search for a Windows code page encoding *encoding* of the form ``cpXXXX``." msgstr "" -#: ../../library/codecs.rst:1557 +#: ../../library/codecs.rst:1592 msgid "" "If the code page is valid and supported, return a :class:`codecs.CodecInfo` " "object for it." msgstr "" -#: ../../library/codecs.rst:1560 ../../library/codecs.rst:1646 +#: ../../library/codecs.rst:1595 ../../library/codecs.rst:1681 msgid "Availability" msgstr "可用性" -#: ../../library/codecs.rst:1565 +#: ../../library/codecs.rst:1600 msgid "This module implements the following exception:" msgstr "" -#: ../../library/codecs.rst:1569 +#: ../../library/codecs.rst:1604 msgid "Raised when a codec is invalid or incompatible." msgstr "" -#: ../../library/codecs.rst:1573 +#: ../../library/codecs.rst:1608 msgid "" ":mod:`encodings.idna` --- Internationalized Domain Names in Applications" msgstr "" -#: ../../library/codecs.rst:1579 +#: ../../library/codecs.rst:1614 msgid "" "This module implements :rfc:`3490` (Internationalized Domain Names in " "Applications) and :rfc:`3492` (Nameprep: A Stringprep Profile for " @@ -2705,27 +2751,27 @@ msgid "" "encoding and :mod:`stringprep`." msgstr "" -#: ../../library/codecs.rst:1584 +#: ../../library/codecs.rst:1619 msgid "" "If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the " "third-party :pypi:`idna` module." msgstr "" -#: ../../library/codecs.rst:1587 +#: ../../library/codecs.rst:1622 msgid "" "These RFCs together define a protocol to support non-ASCII characters in " -"domain names. A domain name containing non-ASCII characters (such as " -"``www.Alliancefrançaise.nu``) is converted into an ASCII-compatible encoding " -"(ACE, such as ``www.xn--alliancefranaise-npb.nu``). The ACE form of the " -"domain name is then used in all places where arbitrary characters are not " -"allowed by the protocol, such as DNS queries, HTTP :mailheader:`Host` " -"fields, and so on. This conversion is carried out in the application; if " -"possible invisible to the user: The application should transparently convert " -"Unicode domain labels to IDNA on the wire, and convert back ACE labels to " -"Unicode before presenting them to the user." +"domain names. A domain name containing non-ASCII characters (such as ``www." +"Alliancefrançaise.nu``) is converted into an ASCII-compatible encoding (ACE, " +"such as ``www.xn--alliancefranaise-npb.nu``). The ACE form of the domain " +"name is then used in all places where arbitrary characters are not allowed " +"by the protocol, such as DNS queries, HTTP :mailheader:`Host` fields, and so " +"on. This conversion is carried out in the application; if possible invisible " +"to the user: The application should transparently convert Unicode domain " +"labels to IDNA on the wire, and convert back ACE labels to Unicode before " +"presenting them to the user." msgstr "" -#: ../../library/codecs.rst:1598 +#: ../../library/codecs.rst:1633 msgid "" "Python supports this conversion in several ways: the ``idna`` codec " "performs conversion between Unicode and ACE, separating an input string into " @@ -2736,20 +2782,20 @@ msgid "" "the :mod:`socket` module transparently converts Unicode host names to ACE, " "so that applications need not be concerned about converting host names " "themselves when they pass them to the socket module. On top of that, modules " -"that have host names as function parameters, such as :mod:`http.client` " -"and :mod:`ftplib`, accept Unicode host names (:mod:`http.client` then also " +"that have host names as function parameters, such as :mod:`http.client` and :" +"mod:`ftplib`, accept Unicode host names (:mod:`http.client` then also " "transparently sends an IDNA hostname in the :mailheader:`Host` field if it " "sends that field at all)." msgstr "" -#: ../../library/codecs.rst:1611 +#: ../../library/codecs.rst:1646 msgid "" "When receiving host names from the wire (such as in reverse name lookup), no " "automatic conversion to Unicode is performed: applications wishing to " "present such host names to the user should decode them to Unicode." msgstr "" -#: ../../library/codecs.rst:1615 +#: ../../library/codecs.rst:1650 msgid "" "The module :mod:`encodings.idna` also implements the nameprep procedure, " "which performs certain normalizations on host names, to achieve case-" @@ -2757,45 +2803,45 @@ msgid "" "characters. The nameprep functions can be used directly if desired." msgstr "" -#: ../../library/codecs.rst:1623 +#: ../../library/codecs.rst:1658 msgid "" "Return the nameprepped version of *label*. The implementation currently " "assumes query strings, so ``AllowUnassigned`` is true." msgstr "" -#: ../../library/codecs.rst:1629 +#: ../../library/codecs.rst:1664 msgid "" "Convert a label to ASCII, as specified in :rfc:`3490`. ``UseSTD3ASCIIRules`` " "is assumed to be false." msgstr "" -#: ../../library/codecs.rst:1635 +#: ../../library/codecs.rst:1670 msgid "Convert a label to Unicode, as specified in :rfc:`3490`." msgstr "" -#: ../../library/codecs.rst:1639 +#: ../../library/codecs.rst:1674 msgid ":mod:`encodings.mbcs` --- Windows ANSI codepage" msgstr ":mod:`encodings.mbcs` --- Windows ANSI 碼頁" -#: ../../library/codecs.rst:1644 +#: ../../library/codecs.rst:1679 msgid "This module implements the ANSI codepage (CP_ACP)." msgstr "這個模組實作了 ANSI 碼頁 (CP_ACP)。" -#: ../../library/codecs.rst:1648 +#: ../../library/codecs.rst:1683 msgid "" "Before 3.2, the *errors* argument was ignored; ``'replace'`` was always used " "to encode, and ``'ignore'`` to decode." msgstr "" -#: ../../library/codecs.rst:1652 +#: ../../library/codecs.rst:1687 msgid "Support any error handler." msgstr "" -#: ../../library/codecs.rst:1657 +#: ../../library/codecs.rst:1692 msgid ":mod:`encodings.utf_8_sig` --- UTF-8 codec with BOM signature" msgstr "" -#: ../../library/codecs.rst:1663 +#: ../../library/codecs.rst:1698 msgid "" "This module implements a variant of the UTF-8 codec. On encoding, a UTF-8 " "encoded BOM will be prepended to the UTF-8 encoded bytes. For the stateful " diff --git a/library/collections.abc.po b/library/collections.abc.po index 9cd5830693e..b999edb5cc5 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-18 00:15+0000\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,7 +23,7 @@ msgstr ":mod:`!collections.abc` --- 容器的抽象基底類別" #: ../../library/collections.abc.rst:10 msgid "Formerly, this module was part of the :mod:`collections` module." -msgstr "" +msgstr "過去此模組是 :mod:`collections` 模組的一部分。" #: ../../library/collections.abc.rst:13 msgid "**Source code:** :source:`Lib/_collections_abc.py`" @@ -309,6 +309,8 @@ msgid "" "Inherited :class:`Sequence` methods and ``append``, ``clear``, ``reverse``, " "``extend``, ``pop``, ``remove``, and ``__iadd__``" msgstr "" +"繼承 :class:`Sequence` 方法和 ``append``、``clear``、``reverse``、``extend``、" +"``pop``、``remove`` 和 ``__iadd__``" #: ../../library/collections.abc.rst:143 msgid ":class:`ByteString`" @@ -506,23 +508,23 @@ msgstr "" #: ../../library/collections.abc.rst:200 msgid "Collections Abstract Base Classes -- Detailed Descriptions" -msgstr "" +msgstr "集合抽象基底類別的詳細描述" #: ../../library/collections.abc.rst:205 msgid "ABC for classes that provide the :meth:`~object.__contains__` method." -msgstr "" +msgstr "有提供 :meth:`~object.__contains__` 方法之類別的 ABC。" #: ../../library/collections.abc.rst:209 msgid "ABC for classes that provide the :meth:`~object.__hash__` method." -msgstr "" +msgstr "有提供 :meth:`~object.__hash__` 方法之類別的 ABC。" #: ../../library/collections.abc.rst:213 msgid "ABC for classes that provide the :meth:`~object.__len__` method." -msgstr "" +msgstr "有提供 :meth:`~object.__len__` 方法之類別的 ABC。" #: ../../library/collections.abc.rst:217 msgid "ABC for classes that provide the :meth:`~object.__call__` method." -msgstr "" +msgstr "有提供 :meth:`~object.__call__` 方法之類別的 ABC。" #: ../../library/collections.abc.rst:219 msgid "" @@ -532,7 +534,7 @@ msgstr "" #: ../../library/collections.abc.rst:224 msgid "ABC for classes that provide the :meth:`~container.__iter__` method." -msgstr "" +msgstr "有提供 :meth:`~container.__iter__` 方法之類別的 ABC。" #: ../../library/collections.abc.rst:226 msgid "" @@ -552,12 +554,15 @@ msgid "" "ABC for classes that provide the :meth:`~iterator.__iter__` and :meth:" "`~iterator.__next__` methods. See also the definition of :term:`iterator`." msgstr "" +"有提供 :meth:`~iterator.__iter__` 和 :meth:`~iterator.__next__` 方法之類別的 ABC。" +"另請參閱 :term:`iterator` 的定義。" #: ../../library/collections.abc.rst:247 msgid "" "ABC for iterable classes that also provide the :meth:`~object.__reversed__` " "method." msgstr "" +"亦有提供 :meth:`~object.__reversed__` 方法之可疊代類別的 ABC。" #: ../../library/collections.abc.rst:254 msgid "" @@ -575,7 +580,7 @@ msgstr "" #: ../../library/collections.abc.rst:268 msgid "ABCs for read-only and mutable :term:`sequences `." -msgstr "" +msgstr "唯讀且可變\\ :term:`序列 `\\ 的 ABC。" #: ../../library/collections.abc.rst:270 msgid "" @@ -590,16 +595,16 @@ msgstr "" #: ../../library/collections.abc.rst:282 msgid "Return first index of *value*." -msgstr "" +msgstr "回傳 *value* 的第一個索引。" #: ../../library/collections.abc.rst:284 msgid "Raises :exc:`ValueError` if the value is not present." -msgstr "" +msgstr "如果找不到該值,則引發 :exc:`ValueError`。" #: ../../library/collections.abc.rst:286 msgid "" "Supporting the *start* and *stop* arguments is optional, but recommended." -msgstr "" +msgstr "建議要支援 *start* 和 *stop* 引數,但並非必要。" #: ../../library/collections.abc.rst:288 msgid "" @@ -608,49 +613,73 @@ msgid "" msgstr "" #: ../../library/collections.abc.rst:292 +msgid "The :class:`ByteString` ABC has been deprecated." +msgstr ":class:`ByteString` ABC 已被棄用。" + +#: ../../library/collections.abc.rst:295 msgid "" -"The :class:`ByteString` ABC has been deprecated. For use in type " -"annotations, prefer a union, like ``bytes | bytearray``, or :class:" -"`collections.abc.Buffer`. For use as an ABC, prefer :class:`Sequence` or :" -"class:`collections.abc.Buffer`." +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`Buffer` or a union that explicitly " +"specifies the types your code supports (e.g., ``bytes | bytearray | " +"memoryview``)." msgstr "" #: ../../library/collections.abc.rst:301 -msgid "ABCs for read-only and mutable :ref:`sets `." +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." msgstr "" +":class:`!ByteString` 最初被設計為一個抽象類別,以作為 :class:`bytes` 和 :class:`bytearray` " +"的超型別 (supertype)。然而由於 ABC 從未擁有任何方法,知道一個物件是 :class:`!ByteString` 的" +"實例從未真正告訴你任何關於該物件的有用資訊。其他常見的緩衝區型別如 :class:`memoryview` " +"也從未被理解為 :class:`!ByteString` 的子型別(無論是在 runtime 還是由靜態型別檢查器)。" + +#: ../../library/collections.abc.rst:309 +msgid "See :pep:`PEP 688 <688#current-options>` for more details." +msgstr "更多詳細資訊請參閱 :pep:`PEP 688 <688#current-options>`。" -#: ../../library/collections.abc.rst:306 +#: ../../library/collections.abc.rst:314 +msgid "ABCs for read-only and mutable :ref:`sets `." +msgstr "唯讀且可變\\ :ref:`集合 `\\ 的 ABC。" + +#: ../../library/collections.abc.rst:319 msgid "ABCs for read-only and mutable :term:`mappings `." -msgstr "" +msgstr "唯讀且可變\\ :term:`對映 `\\ 的 ABC。" -#: ../../library/collections.abc.rst:313 +#: ../../library/collections.abc.rst:326 msgid "" "ABCs for mapping, items, keys, and values :term:`views `." msgstr "" -#: ../../library/collections.abc.rst:317 +#: ../../library/collections.abc.rst:330 msgid "" "ABC for :term:`awaitable` objects, which can be used in :keyword:`await` " "expressions. Custom implementations must provide the :meth:`~object." "__await__` method." msgstr "" -#: ../../library/collections.abc.rst:321 +#: ../../library/collections.abc.rst:334 msgid "" ":term:`Coroutine ` objects and instances of the :class:" "`~collections.abc.Coroutine` ABC are all instances of this ABC." msgstr "" -#: ../../library/collections.abc.rst:325 +#: ../../library/collections.abc.rst:338 msgid "" "In CPython, generator-based coroutines (:term:`generators ` " -"decorated with :func:`@types.coroutine `) are *awaitables*, " -"even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Awaitable)`` for them will return ``False``. Use :func:" -"`inspect.isawaitable` to detect them." +"decorated with :deco:`types.coroutine`) are *awaitables*, even though they " +"do not have an :meth:`~object.__await__` method. Using ``isinstance(gencoro, " +"Awaitable)`` for them will return ``False``. Use :func:`inspect.isawaitable` " +"to detect them." msgstr "" -#: ../../library/collections.abc.rst:335 +#: ../../library/collections.abc.rst:348 msgid "" "ABC for :term:`coroutine` compatible classes. These implement the following " "methods, defined in :ref:`coroutine-objects`: :meth:`~coroutine.send`, :meth:" @@ -659,63 +688,63 @@ msgid "" "instances are also instances of :class:`Awaitable`." msgstr "" -#: ../../library/collections.abc.rst:343 +#: ../../library/collections.abc.rst:356 msgid "" "In CPython, generator-based coroutines (:term:`generators ` " -"decorated with :func:`@types.coroutine `) are *awaitables*, " -"even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Coroutine)`` for them will return ``False``. Use :func:" -"`inspect.isawaitable` to detect them." +"decorated with :deco:`types.coroutine`) are *awaitables*, even though they " +"do not have an :meth:`~object.__await__` method. Using ``isinstance(gencoro, " +"Coroutine)`` for them will return ``False``. Use :func:`inspect.isawaitable` " +"to detect them." msgstr "" -#: ../../library/collections.abc.rst:349 +#: ../../library/collections.abc.rst:362 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`!Coroutine` in type annotations. The variance and order of type parameters " "correspond to those of :class:`Generator`." msgstr "" -#: ../../library/collections.abc.rst:358 +#: ../../library/collections.abc.rst:371 msgid "" "ABC for classes that provide an ``__aiter__`` method. See also the " "definition of :term:`asynchronous iterable`." msgstr "" -#: ../../library/collections.abc.rst:365 +#: ../../library/collections.abc.rst:378 msgid "" "ABC for classes that provide ``__aiter__`` and ``__anext__`` methods. See " "also the definition of :term:`asynchronous iterator`." msgstr "" -#: ../../library/collections.abc.rst:372 +#: ../../library/collections.abc.rst:385 msgid "" "ABC for :term:`asynchronous generator` classes that implement the protocol " "defined in :pep:`525` and :pep:`492`." msgstr "" -#: ../../library/collections.abc.rst:375 +#: ../../library/collections.abc.rst:388 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`!AsyncGenerator` in type annotations." msgstr "" -#: ../../library/collections.abc.rst:382 +#: ../../library/collections.abc.rst:395 msgid "" "ABC for classes that provide the :meth:`~object.__buffer__` method, " "implementing the :ref:`buffer protocol `. See :pep:`688`." msgstr "" -#: ../../library/collections.abc.rst:388 +#: ../../library/collections.abc.rst:401 msgid "Examples and Recipes" msgstr "" -#: ../../library/collections.abc.rst:390 +#: ../../library/collections.abc.rst:403 msgid "" "ABCs allow us to ask classes or instances if they provide particular " "functionality, for example::" msgstr "" -#: ../../library/collections.abc.rst:393 +#: ../../library/collections.abc.rst:406 msgid "" "size = None\n" "if isinstance(myvar, collections.abc.Sized):\n" @@ -725,7 +754,7 @@ msgstr "" "if isinstance(myvar, collections.abc.Sized):\n" " size = len(myvar)" -#: ../../library/collections.abc.rst:397 +#: ../../library/collections.abc.rst:410 msgid "" "Several of the ABCs are also useful as mixins that make it easier to develop " "classes supporting container APIs. For example, to write a class supporting " @@ -735,7 +764,7 @@ msgid "" "methods such as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" msgstr "" -#: ../../library/collections.abc.rst:404 +#: ../../library/collections.abc.rst:417 msgid "" "class ListBasedSet(collections.abc.Set):\n" " ''' Alternate set implementation favoring space over speed\n" @@ -761,11 +790,11 @@ msgid "" "automatically" msgstr "" -#: ../../library/collections.abc.rst:426 +#: ../../library/collections.abc.rst:439 msgid "Notes on using :class:`Set` and :class:`MutableSet` as a mixin:" msgstr "" -#: ../../library/collections.abc.rst:429 +#: ../../library/collections.abc.rst:442 msgid "" "Since some set operations create new sets, the default mixin methods need a " "way to create new instances from an :term:`iterable`. The class constructor " @@ -778,14 +807,14 @@ msgid "" "iterable argument." msgstr "" -#: ../../library/collections.abc.rst:440 +#: ../../library/collections.abc.rst:453 msgid "" "To override the comparisons (presumably for speed, as the semantics are " "fixed), redefine :meth:`~object.__le__` and :meth:`~object.__ge__`, then the " "other operations will automatically follow suit." msgstr "" -#: ../../library/collections.abc.rst:446 +#: ../../library/collections.abc.rst:459 msgid "" "The :class:`Set` mixin provides a :meth:`!_hash` method to compute a hash " "value for the set; however, :meth:`~object.__hash__` is not defined because " @@ -794,12 +823,12 @@ msgid "" "define ``__hash__ = Set._hash``." msgstr "" -#: ../../library/collections.abc.rst:454 +#: ../../library/collections.abc.rst:467 msgid "" "`OrderedSet recipe `_ for an " "example built on :class:`MutableSet`." msgstr "" -#: ../../library/collections.abc.rst:457 +#: ../../library/collections.abc.rst:470 msgid "For more about ABCs, see the :mod:`abc` module and :pep:`3119`." msgstr "關於 ABC 的更多資訊請見 :mod:`abc` module 和 :pep:`3119`。" diff --git a/library/collections.po b/library/collections.po index 637cf57e017..786f7b046db 100644 --- a/library/collections.po +++ b/library/collections.po @@ -1574,6 +1574,13 @@ msgid "" ">>> Pixel(11, 22, 128, 255, 0)\n" "Pixel(x=11, y=22, red=128, green=255, blue=0)" msgstr "" +">>> p._fields # 查看欄位名稱\n" +"('x', 'y')\n" +"\n" +">>> Color = namedtuple('Color', 'red green blue')\n" +">>> Pixel = namedtuple('Pixel', Point._fields + Color._fields)\n" +">>> Pixel(11, 22, 128, 255, 0)\n" +"Pixel(x=11, y=22, red=128, green=255, blue=0)" #: ../../library/collections.rst:1006 msgid "Dictionary mapping field names to default values." diff --git a/library/compression.po b/library/compression.po index 8bedbc98d67..db9321737a5 100644 --- a/library/compression.po +++ b/library/compression.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-05 00:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,7 +20,7 @@ msgstr "" msgid "The :mod:`!compression` package" msgstr ":mod:`!compression` 套件" -#: ../../library/compression.rst:6 +#: ../../library/compression.rst:8 msgid "" "The :mod:`!compression` package contains the canonical compression modules " "containing interfaces to several different compression algorithms. Some of " @@ -29,24 +29,27 @@ msgid "" "reasons, and will not be removed without a deprecation cycle. The use of " "modules in :mod:`!compression` is encouraged where practical." msgstr "" +":mod:`!compression` 套件包含了有多種不同壓縮演算法介面的標準壓縮模組。其中一些模組過去" +"是以獨立模組的形式提供;為了相容性考量,這些模組將繼續以其原始名稱提供,並且不會在沒有經過" +"棄用週期的情況下被移除。建議在可行的情況下盡量先使用 :mod:`!compression` 中的模組。" -#: ../../library/compression.rst:13 +#: ../../library/compression.rst:15 msgid ":mod:`!compression.bz2` -- Re-exports :mod:`bz2`" -msgstr "" +msgstr ":mod:`!compression.bz2` -- 重新匯出 :mod:`bz2`" -#: ../../library/compression.rst:14 +#: ../../library/compression.rst:16 msgid ":mod:`!compression.gzip` -- Re-exports :mod:`gzip`" -msgstr "" +msgstr ":mod:`!compression.gzip` -- 重新匯出 :mod:`gzip`" -#: ../../library/compression.rst:15 +#: ../../library/compression.rst:17 msgid ":mod:`!compression.lzma` -- Re-exports :mod:`lzma`" -msgstr "" +msgstr ":mod:`!compression.lzma` -- 重新匯出 :mod:`lzma`" -#: ../../library/compression.rst:16 +#: ../../library/compression.rst:18 msgid ":mod:`!compression.zlib` -- Re-exports :mod:`zlib`" -msgstr "" +msgstr ":mod:`!compression.zlib` -- 重新匯出 :mod:`zlib`" -#: ../../library/compression.rst:17 +#: ../../library/compression.rst:19 msgid "" ":mod:`compression.zstd` -- Wrapper for the Zstandard compression library" -msgstr "" +msgstr ":mod:`compression.zstd` -- Zstandard 壓縮函式庫的包裝器" diff --git a/library/crypt.po b/library/crypt.po index b8cf2e9438a..07db5a7c63d 100644 --- a/library/crypt.po +++ b/library/crypt.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"POT-Creation-Date: 2025-10-10 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,12 +34,12 @@ msgstr "" msgid "" "Applications can use the :mod:`hashlib` module from the standard library. " "Other possible replacements are third-party libraries from PyPI: :pypi:" -"`legacycrypt`, :pypi:`bcrypt`, :pypi:`argon2-cffi`, or :pypi:`passlib`. " -"These are not supported or maintained by the Python core team." +"`legacycrypt`, :pypi:`bcrypt`, or :pypi:`argon2-cffi`. These are not " +"supported or maintained by the Python core team." msgstr "" "應用程式可以改用標準函式庫中的 :mod:`hashlib` 模組。其他可能的替代方案是 " -"PyPI 上的第三方庫::pypi:`legacycrypt`、:pypi:`bcrypt`、:pypi:`argon2-cffi` " -"或 :pypi:`passlib`。這些函式庫並不受 Python 核心團隊支援或維護。" +"PyPI 上的第三方庫::pypi:`legacycrypt`、:pypi:`bcrypt` 或 :pypi:`argon2-cffi`" +"。這些函式庫並不受 Python 核心團隊支援或維護。" #: ../../library/crypt.rst:19 msgid "" diff --git a/library/csv.po b/library/csv.po index 300da9c5905..377a9de593b 100644 --- a/library/csv.po +++ b/library/csv.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-10-09 00:15+0000\n" "PO-Revision-Date: 2023-11-08 15:06+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -122,8 +122,8 @@ msgstr "" "`QUOTE_NONNUMERIC` 有被指定(在這個情況之下,沒有引號的欄位都會被轉換成浮點" "數),否則不會進行自動資料型別轉換。" -#: ../../library/csv.rst:76 ../../library/csv.rst:106 ../../library/csv.rst:181 -#: ../../library/csv.rst:219 +#: ../../library/csv.rst:76 ../../library/csv.rst:106 ../../library/csv.rst:182 +#: ../../library/csv.rst:220 msgid "A short usage example::" msgstr "一個簡短的用法範例: ::" @@ -228,7 +228,7 @@ msgstr "" msgid "Return the names of all registered dialects." msgstr "回傳所有已註冊的 dialect 名稱。" -#: ../../library/csv.rst:144 +#: ../../library/csv.rst:145 msgid "" "Returns the current maximum field size allowed by the parser. If *new_limit* " "is given, this becomes the new limit." @@ -236,11 +236,11 @@ msgstr "" "回傳目前的剖析器 (parser) 允許的最大字串大小。如果 *new_limit* 被給定,則會變" "成新的最大字串大小。" -#: ../../library/csv.rst:148 +#: ../../library/csv.rst:149 msgid "The :mod:`csv` module defines the following classes:" msgstr ":mod:`csv` 模組定義了下列的類別:" -#: ../../library/csv.rst:153 +#: ../../library/csv.rst:154 msgid "" "Create an object that operates like a regular reader but maps the " "information in each row to a :class:`dict` whose keys are given by the " @@ -249,7 +249,7 @@ msgstr "" "建立一個物件,其運作上就像一般的讀取器,但可以將每一列資訊 map (對映) 到 :" "class:`dict` 中,可以透過選填的參數 *fieldnames* 設定 key。" -#: ../../library/csv.rst:157 +#: ../../library/csv.rst:158 msgid "" "The *fieldnames* parameter is a :term:`sequence`. If *fieldnames* is " "omitted, the values in the first row of file *f* will be used as the " @@ -263,7 +263,7 @@ msgstr "" "供,它們就會被使用,且第一列會被包含在結果中。不管欄位標題是如何決定的," "dictionary 都會保留原始的排序。" -#: ../../library/csv.rst:164 +#: ../../library/csv.rst:165 msgid "" "If a row has more fields than fieldnames, the remaining data is put in a " "list and stored with the fieldname specified by *restkey* (which defaults to " @@ -275,28 +275,28 @@ msgstr "" "``None``)特指的欄位標題會放入列表當中並儲存。如果一個非空的 (non-blank) 列中" "的欄位比欄位標題還少,缺少的值則會填入 *restval* (預設為 ``None``)的值。" -#: ../../library/csv.rst:170 +#: ../../library/csv.rst:171 msgid "" "All other optional or keyword arguments are passed to the underlying :class:" "`reader` instance." msgstr "所有其他選填的引數或關鍵字引數皆會傳遞至下層的 :class:`reader` 實例。" -#: ../../library/csv.rst:173 ../../library/csv.rst:217 +#: ../../library/csv.rst:174 ../../library/csv.rst:218 msgid "" "If the argument passed to *fieldnames* is an iterator, it will be coerced to " "a :class:`list`." msgstr "" "如果傳遞至 *fieldnames* 的引數是個疊代器,則會被迫成為一個 :class:`list`。" -#: ../../library/csv.rst:175 +#: ../../library/csv.rst:176 msgid "Returned rows are now of type :class:`OrderedDict`." msgstr "回傳的列已成為型別 :class:`OrderedDict`。" -#: ../../library/csv.rst:178 +#: ../../library/csv.rst:179 msgid "Returned rows are now of type :class:`dict`." msgstr "回傳的列已成為型別 :class:`dict`。" -#: ../../library/csv.rst:183 +#: ../../library/csv.rst:184 msgid "" ">>> import csv\n" ">>> with open('names.csv', newline='') as csvfile:\n" @@ -322,7 +322,7 @@ msgstr "" ">>> print(row)\n" "{'first_name': 'John', 'last_name': 'Cleese'}" -#: ../../library/csv.rst:199 +#: ../../library/csv.rst:200 msgid "" "Create an object which operates like a regular writer but maps dictionaries " "onto output rows. The *fieldnames* parameter is a :mod:`sequence " @@ -347,7 +347,7 @@ msgstr "" "被設定為 ``'ignore'``,dictionary 中額外的值會被忽略。其他選填的引數或關鍵字" "引數皆會傳遞至下層的 :class:`writer` 實例。" -#: ../../library/csv.rst:214 +#: ../../library/csv.rst:215 msgid "" "Note that unlike the :class:`DictReader` class, the *fieldnames* parameter " "of the :class:`DictWriter` class is not optional." @@ -355,7 +355,7 @@ msgstr "" "請記得這不像類別 :class:`DictReader`,在類別 :class:`DictWriter` 中,參數 " "*fieldnames* 並不是選填的。" -#: ../../library/csv.rst:221 +#: ../../library/csv.rst:222 msgid "" "import csv\n" "\n" @@ -379,7 +379,7 @@ msgstr "" " writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})\n" " writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})" -#: ../../library/csv.rst:235 +#: ../../library/csv.rst:236 msgid "" "The :class:`Dialect` class is a container class whose attributes contain " "information for how to handle doublequotes, whitespace, delimiters, etc. Due " @@ -392,7 +392,7 @@ msgstr "" "巧妙不同的 CSV 資料。:class:`Dialect` 實例定義了 :class:`reader` 以及 :class:" "`writer` 的實例該如何表示。" -#: ../../library/csv.rst:241 +#: ../../library/csv.rst:242 msgid "" "All available :class:`Dialect` names are returned by :func:`list_dialects`, " "and they can be registered with specific :class:`reader` and :class:`writer` " @@ -402,7 +402,7 @@ msgstr "" "透過特定 :class:`reader` 及 :class:`writer` 類別的初始器 (initializer, " "``__init__``) 函式進行註冊,就像這樣: ::" -#: ../../library/csv.rst:245 +#: ../../library/csv.rst:246 msgid "" "import csv\n" "\n" @@ -414,7 +414,7 @@ msgstr "" "with open('students.csv', 'w', newline='') as csvfile:\n" " writer = csv.writer(csvfile, dialect='unix')" -#: ../../library/csv.rst:253 +#: ../../library/csv.rst:254 msgid "" "The :class:`excel` class defines the usual properties of an Excel-generated " "CSV file. It is registered with the dialect name ``'excel'``." @@ -422,7 +422,7 @@ msgstr "" "類別 :class:`excel` 定義了透過 Excel 產生的 CSV 檔案的慣用屬性。它被註冊的 " "dialect 名稱為 ``'excel'``。" -#: ../../library/csv.rst:259 +#: ../../library/csv.rst:260 msgid "" "The :class:`excel_tab` class defines the usual properties of an Excel-" "generated TAB-delimited file. It is registered with the dialect name " @@ -431,7 +431,7 @@ msgstr "" "類別 :class:`excel_tab` 定義了透過 Excel 產生並以 Tab 作為分隔的 CSV 檔案的慣" "用屬性。它被註冊的 dialect 名稱為 ``'excel-tab'``。" -#: ../../library/csv.rst:265 +#: ../../library/csv.rst:266 msgid "" "The :class:`unix_dialect` class defines the usual properties of a CSV file " "generated on UNIX systems, i.e. using ``'\\n'`` as line terminator and " @@ -441,15 +441,15 @@ msgstr "" "句話說,使用 ``'\\n'`` 作為換行符號且所有欄位都被引號包覆起來。它被註冊的 " "dialect 名稱為 ``'unix'``。" -#: ../../library/csv.rst:274 +#: ../../library/csv.rst:275 msgid "The :class:`Sniffer` class is used to deduce the format of a CSV file." msgstr "類別 :class:`Sniffer` 被用來推斷 CSV 檔案的格式。" -#: ../../library/csv.rst:276 +#: ../../library/csv.rst:277 msgid "The :class:`Sniffer` class provides two methods:" msgstr "類別 :class:`Sniffer` 提供了兩個 method:" -#: ../../library/csv.rst:280 +#: ../../library/csv.rst:281 msgid "" "Analyze the given *sample* and return a :class:`Dialect` subclass reflecting " "the parameters found. If the optional *delimiters* parameter is given, it " @@ -459,7 +459,7 @@ msgstr "" "數。如果給定選填的參數 *delimiters*,它會被解釋為一個字串且含有可能、有效的分" "隔字元。" -#: ../../library/csv.rst:288 +#: ../../library/csv.rst:289 msgid "" "Analyze the sample text (presumed to be in CSV format) and return :const:" "`True` if the first row appears to be a series of column headers. Inspecting " @@ -470,18 +470,18 @@ msgstr "" "格式)並回傳 :const:`True`。檢查每一欄時,會考慮是否滿足兩個關鍵標準其中之" "一,判斷 sample 是否包含標題:" -#: ../../library/csv.rst:293 +#: ../../library/csv.rst:294 msgid "the second through n-th rows contain numeric values" msgstr "第二列至第 n 列包含數字" -#: ../../library/csv.rst:294 +#: ../../library/csv.rst:295 msgid "" "the second through n-th rows contain strings where at least one value's " "length differs from that of the putative header of that column." msgstr "" "第二列到第 n 列包含的字串中至少有一個值的長度與該行的假定標題的長度不同。" -#: ../../library/csv.rst:297 +#: ../../library/csv.rst:298 msgid "" "Twenty rows after the first row are sampled; if more than half of columns + " "rows meet the criteria, :const:`True` is returned." @@ -489,7 +489,7 @@ msgstr "" "對第一列之後的二十個列進行取樣;如果超過一半的行及列滿足條件,則返回 :const:" "`True`。" -#: ../../library/csv.rst:302 +#: ../../library/csv.rst:303 msgid "" "This method is a rough heuristic and may produce both false positives and " "negatives." @@ -497,11 +497,11 @@ msgstr "" "此方法是一個粗略的啟發,可能會產生偽陽性及偽陰性 (false positives and " "negatives)。" -#: ../../library/csv.rst:305 +#: ../../library/csv.rst:306 msgid "An example for :class:`Sniffer` use::" msgstr "一個 :class:`Sniffer` 的使用範例: ::" -#: ../../library/csv.rst:307 +#: ../../library/csv.rst:308 msgid "" "with open('example.csv', newline='') as csvfile:\n" " dialect = csv.Sniffer().sniff(csvfile.read(1024))\n" @@ -515,15 +515,15 @@ msgstr "" " reader = csv.reader(csvfile, dialect)\n" " # ... 在這邊處理 CSV 檔案 ..." -#: ../../library/csv.rst:316 +#: ../../library/csv.rst:317 msgid "The :mod:`csv` module defines the following constants:" msgstr ":mod:`csv` 模組定義了以下常數:" -#: ../../library/csv.rst:320 +#: ../../library/csv.rst:321 msgid "Instructs :class:`writer` objects to quote all fields." msgstr "引導 :class:`writer` 物件引用所有欄位。" -#: ../../library/csv.rst:325 +#: ../../library/csv.rst:326 msgid "" "Instructs :class:`writer` objects to only quote those fields which contain " "special characters such as *delimiter*, *quotechar*, ``'\\r'``, ``'\\n'`` or " @@ -532,17 +532,17 @@ msgstr "" "引導 :class:`writer` 物件只引用包含特殊字元的欄位,例如:*delimiter*、" "*quotechar*、``'\\r'``、``'\\n'`` 或是 *lineterminator* 的其他字元。" -#: ../../library/csv.rst:332 +#: ../../library/csv.rst:333 msgid "Instructs :class:`writer` objects to quote all non-numeric fields." msgstr "引導 :class:`writer` 物件引用所有非數字的欄位。" -#: ../../library/csv.rst:334 +#: ../../library/csv.rst:335 msgid "" "Instructs :class:`reader` objects to convert all non-quoted fields to type :" "class:`float`." msgstr "引導 :class:`reader` 物件轉換所有非引用的欄位為 :class:`float`。" -#: ../../library/csv.rst:337 +#: ../../library/csv.rst:338 msgid "" "Some numeric types, such as :class:`bool`, :class:`~fractions.Fraction`, or :" "class:`~enum.IntEnum`, have a string representation that cannot be converted " @@ -550,7 +550,7 @@ msgid "" "data:`QUOTE_STRINGS` modes." msgstr "" -#: ../../library/csv.rst:345 +#: ../../library/csv.rst:346 msgid "" "Instructs :class:`writer` objects to never quote fields. When the current " "*delimiter*, *quotechar*, *escapechar*, ``'\\r'``, ``'\\n'`` or any of the " @@ -564,13 +564,13 @@ msgstr "" "前的字元是目前的 *escapechar*。如果沒有設定 *escapechar*,若遇到任何字元需要" "逸出,寫入器則會引發 :exc:`Error`。設定 *quotechar* 為 ``None`` 以防止逸出。" -#: ../../library/csv.rst:353 +#: ../../library/csv.rst:354 msgid "" "Instructs :class:`reader` objects to perform no special processing of quote " "characters." msgstr "引導 :class:`reader` 物件不對引號進行特別處理。" -#: ../../library/csv.rst:357 +#: ../../library/csv.rst:358 msgid "" "Instructs :class:`writer` objects to quote all fields which are not " "``None``. This is similar to :data:`QUOTE_ALL`, except that if a field " @@ -579,7 +579,7 @@ msgstr "" "引導 :class:`writer` 物件引用所有非 ``None`` 的欄位。這與 :data:`QUOTE_ALL` " "相似,除非如果欄位值為 ``None``,該欄位則被寫成空(沒有引號)字串。" -#: ../../library/csv.rst:361 +#: ../../library/csv.rst:362 msgid "" "Instructs :class:`reader` objects to interpret an empty (unquoted) field as " "``None`` and to otherwise behave as :data:`QUOTE_ALL`." @@ -587,7 +587,7 @@ msgstr "" "引導 :class:`reader` 物件將空(沒有引號)欄位直譯 (interpret) 為 ``None``,否" "則會和 :data:`QUOTE_ALL` 有相同的表現方式。" -#: ../../library/csv.rst:368 +#: ../../library/csv.rst:369 msgid "" "Instructs :class:`writer` objects to always place quotes around fields which " "are strings. This is similar to :data:`QUOTE_NONNUMERIC`, except that if a " @@ -597,7 +597,7 @@ msgstr "" "`QUOTE_NONNUMERIC` 相似,除非如果欄位值為 ``None``,該欄位則被寫成空(沒有引" "號)字串。" -#: ../../library/csv.rst:372 +#: ../../library/csv.rst:373 msgid "" "Instructs :class:`reader` objects to interpret an empty (unquoted) string as " "``None`` and to otherwise behave as :data:`QUOTE_NONNUMERIC`." @@ -605,19 +605,19 @@ msgstr "" "引導 :class:`reader` 物件將空(沒有引號)字串直譯為 ``None``,否則會和 :data:" "`QUOTE_ALL` 有相同的表現方式。" -#: ../../library/csv.rst:377 +#: ../../library/csv.rst:378 msgid "The :mod:`csv` module defines the following exception:" msgstr ":mod:`csv` 模組定義下列例外:" -#: ../../library/csv.rst:382 +#: ../../library/csv.rst:383 msgid "Raised by any of the functions when an error is detected." msgstr "當偵測到錯誤時,任何函式都可以引發。" -#: ../../library/csv.rst:387 +#: ../../library/csv.rst:388 msgid "Dialects and Formatting Parameters" msgstr "Dialect 與格式參數" -#: ../../library/csv.rst:389 +#: ../../library/csv.rst:390 msgid "" "To make it easier to specify the format of input and output records, " "specific formatting parameters are grouped together into dialects. A " @@ -636,16 +636,16 @@ msgstr "" "代,在\\ *dialect*\\ 參數中,程式設計師可以指定個別的格式化參數,其與 :class:" "`Dialect` 類別定義的屬性具有相同的名字。" -#: ../../library/csv.rst:399 +#: ../../library/csv.rst:400 msgid "Dialects support the following attributes:" msgstr "Dialect 支援下列屬性:" -#: ../../library/csv.rst:404 +#: ../../library/csv.rst:405 msgid "" "A one-character string used to separate fields. It defaults to ``','``." msgstr "一個單一字元 (one-character) 的字串可已用來分割欄位。預設為 ``','``。" -#: ../../library/csv.rst:409 +#: ../../library/csv.rst:410 msgid "" "Controls how instances of *quotechar* appearing inside a field should " "themselves be quoted. When :const:`True`, the character is doubled. When :" @@ -656,7 +656,7 @@ msgstr "" "為 :const:`True`,字元會是雙引號。若為 :const:`False`,在 *quotechar* 之前會" "先使用 *escapechar* 作為前綴字。預設為 :const:`True`。" -#: ../../library/csv.rst:414 +#: ../../library/csv.rst:415 msgid "" "On output, if *doublequote* is :const:`False` and no *escapechar* is set, :" "exc:`Error` is raised if a *quotechar* is found in a field." @@ -664,28 +664,28 @@ msgstr "" "在輸出時,若 *doublequote* 是 :const:`False` 且\\ *逸出字元*\\ 沒有被設定,當" "一個\\ *引號*\\ 在欄位中被發現時,:exc:`Error` 會被引發。" -#: ../../library/csv.rst:420 +#: ../../library/csv.rst:421 msgid "" "A one-character string used by the writer to escape characters that require " "escaping:" msgstr "一個單一字元的字串,會被寫入器用來逸出需要逸出的字元:" -#: ../../library/csv.rst:423 +#: ../../library/csv.rst:424 msgid "" "the *delimiter*, the *quotechar*, ``'\\r'``, ``'\\n'`` and any of the " "characters in *lineterminator* are escaped if *quoting* is set to :const:" "`QUOTE_NONE`;" msgstr "" -#: ../../library/csv.rst:426 +#: ../../library/csv.rst:427 msgid "the *quotechar* is escaped if *doublequote* is :const:`False`;" msgstr "" -#: ../../library/csv.rst:427 +#: ../../library/csv.rst:428 msgid "the *escapechar* itself." msgstr "*escapechar* 本身。" -#: ../../library/csv.rst:429 +#: ../../library/csv.rst:430 msgid "" "On reading, the *escapechar* removes any special meaning from the following " "character. It defaults to :const:`None`, which disables escaping." @@ -693,17 +693,17 @@ msgstr "" "在讀取時,*escapechar* 會移除後面字元的任何特殊意義。預設為 :const:`None`,表" "示禁止逸出。" -#: ../../library/csv.rst:432 +#: ../../library/csv.rst:433 msgid "An empty *escapechar* is not allowed." msgstr "*escapechar* 為空是不被接受的。" -#: ../../library/csv.rst:437 +#: ../../library/csv.rst:438 msgid "" "The string used to terminate lines produced by the :class:`writer`. It " "defaults to ``'\\r\\n'``." msgstr "由 :class:`writer` 產生被用來分行的字串。預設為 ``'\\r\\n'``。" -#: ../../library/csv.rst:442 +#: ../../library/csv.rst:443 msgid "" "The :class:`reader` is hard-coded to recognise either ``'\\r'`` or ``'\\n'`` " "as end-of-line, and ignores *lineterminator*. This behavior may change in " @@ -712,7 +712,7 @@ msgstr "" ":class:`reader` 是 hard-coded 辨別 ``'\\r'`` or ``'\\n'`` 作為行尾 (end-of-" "line),並忽略\\ *lineterminator*。未來可能會改變這個行為。" -#: ../../library/csv.rst:449 +#: ../../library/csv.rst:450 msgid "" "A one-character string used to quote fields containing special characters, " "such as the *delimiter* or the *quotechar*, or which contain new-line " @@ -725,11 +725,11 @@ msgstr "" "元)。預設為 ``'\"'``。如果 *quoting* 設定為 :const:`QUOTE_NONE`,可以設定為 " "``None`` 以防止逸出 ``'\"'``。" -#: ../../library/csv.rst:456 +#: ../../library/csv.rst:457 msgid "An empty *quotechar* is not allowed." msgstr "*quotechar* 為空是不被允許的。" -#: ../../library/csv.rst:461 +#: ../../library/csv.rst:462 msgid "" "Controls when quotes should be generated by the writer and recognised by the " "reader. It can take on any of the :ref:`QUOTE_\\* constants `\\ 且預設為 :" "const:`QUOTE_MINIMAL`。否則預設為 :const:`QUOTE_NONE`。" -#: ../../library/csv.rst:469 +#: ../../library/csv.rst:470 msgid "" "When :const:`True`, spaces immediately following the *delimiter* are " "ignored. The default is :const:`False`. When combining ``delimiter=' '`` " "with ``skipinitialspace=True``, unquoted empty fields are not allowed." msgstr "" "若為 :const:`True`,在緊接著\\ *delimiter*\\ 後的空格會被忽略。預設為 :const:" -"`False`。當結合 ``delimiter=' '`` 與 ``skipinitialspace=True`` 時,不允許沒有引號的空欄位。" +"`False`。當結合 ``delimiter=' '`` 與 ``skipinitialspace=True`` 時,不允許沒有" +"引號的空欄位。" -#: ../../library/csv.rst:476 +#: ../../library/csv.rst:477 msgid "" "When ``True``, raise exception :exc:`Error` on bad CSV input. The default is " "``False``." msgstr "" "若為 ``True``,若有錯誤的 CSV 輸入則會引發 :exc:`Error`。預設為 ``False``。" -#: ../../library/csv.rst:482 +#: ../../library/csv.rst:483 msgid "Reader Objects" msgstr "讀取器物件" -#: ../../library/csv.rst:484 +#: ../../library/csv.rst:485 msgid "" "Reader objects (:class:`DictReader` instances and objects returned by the :" "func:`reader` function) have the following public methods:" @@ -768,7 +769,7 @@ msgstr "" "讀取器物件(:func:`reader` 函式回傳的 :class:`DictReader` 實例與物件)有下列" "公開方法 (public method):" -#: ../../library/csv.rst:489 +#: ../../library/csv.rst:490 msgid "" "Return the next row of the reader's iterable object as a list (if the object " "was returned from :func:`reader`) or a dict (if it is a :class:`DictReader` " @@ -779,25 +780,25 @@ msgstr "" "傳)或是一個 dict(若為 :class:`DictReader` 實例),會依據目前的 :class:" "`Dialect` 進行剖析。通常會用 ``next(reader)`` 來進行呼叫。" -#: ../../library/csv.rst:495 +#: ../../library/csv.rst:496 msgid "Reader objects have the following public attributes:" msgstr "讀取器物件有下列公開屬性 (public attributes):" -#: ../../library/csv.rst:499 +#: ../../library/csv.rst:500 msgid "A read-only description of the dialect in use by the parser." msgstr "dialect 的唯讀敘述,會被剖析器使用。" -#: ../../library/csv.rst:504 +#: ../../library/csv.rst:505 msgid "" "The number of lines read from the source iterator. This is not the same as " "the number of records returned, as records can span multiple lines." msgstr "來源疊代器所讀取的行數。這與回傳的紀錄數不同,因為可以進行跨行紀錄。" -#: ../../library/csv.rst:508 +#: ../../library/csv.rst:509 msgid "DictReader objects have the following public attribute:" msgstr "DictReader 物件有下列公開屬性:" -#: ../../library/csv.rst:512 +#: ../../library/csv.rst:513 msgid "" "If not passed as a parameter when creating the object, this attribute is " "initialized upon first access or when the first record is read from the file." @@ -805,11 +806,11 @@ msgstr "" "若在建立物件時沒有作為參數傳遞,這個屬性會在第一次存取之前或是第一筆資料被讀" "取之前進行初始化 (initialize)。" -#: ../../library/csv.rst:519 +#: ../../library/csv.rst:520 msgid "Writer Objects" msgstr "寫入器物件" -#: ../../library/csv.rst:521 +#: ../../library/csv.rst:522 msgid "" ":class:`writer` objects (:class:`DictWriter` instances and objects returned " "by the :func:`writer` function) have the following public methods. A *row* " @@ -827,7 +828,7 @@ msgstr "" "遞)。請注意,在寫入複數 (complex number) 時會用小括號 (parens) 包起來。這可" "能在其他程式讀取 CSV 檔案時導致某些問題(假設他們完全支援複雜數字)。" -#: ../../library/csv.rst:532 +#: ../../library/csv.rst:533 msgid "" "Write the *row* parameter to the writer's file object, formatted according " "to the current :class:`Dialect`. Return the return value of the call to the " @@ -836,11 +837,11 @@ msgstr "" "將參數 *row* 寫入至寫入器的檔案物件中,並依照目前的 :class:`Dialect` 進行格式" "化。回傳下層檔案物件 *write* 方法的回傳值。" -#: ../../library/csv.rst:536 +#: ../../library/csv.rst:537 msgid "Added support of arbitrary iterables." msgstr "新增對任意可疊代物件 (arbitrary iterables) 的支援。" -#: ../../library/csv.rst:541 +#: ../../library/csv.rst:542 msgid "" "Write all elements in *rows* (an iterable of *row* objects as described " "above) to the writer's file object, formatted according to the current " @@ -849,19 +850,19 @@ msgstr "" "將 *rows* 中所有元素(為上述的一個可疊代的 *row* 物件)寫入至寫入器的檔案物件" "中,並依照目前的 dialect 進行格式化。" -#: ../../library/csv.rst:545 +#: ../../library/csv.rst:546 msgid "Writer objects have the following public attribute:" msgstr "寫入器物件有下列公開屬性:" -#: ../../library/csv.rst:550 +#: ../../library/csv.rst:551 msgid "A read-only description of the dialect in use by the writer." msgstr "dialect 的唯讀敘述,會被寫入器使用。" -#: ../../library/csv.rst:553 +#: ../../library/csv.rst:554 msgid "DictWriter objects have the following public method:" msgstr "DictWriter 物件有下列公開方法:" -#: ../../library/csv.rst:558 +#: ../../library/csv.rst:559 msgid "" "Write a row with the field names (as specified in the constructor) to the " "writer's file object, formatted according to the current dialect. Return the " @@ -871,7 +872,7 @@ msgstr "" "中,並依照目前的 dialect 進行格式化。回傳內部呼叫 :meth:`csvwriter.writerow` " "的回傳值。" -#: ../../library/csv.rst:563 +#: ../../library/csv.rst:564 msgid "" ":meth:`writeheader` now also returns the value returned by the :meth:" "`csvwriter.writerow` method it uses internally." @@ -879,15 +880,15 @@ msgstr "" ":meth:`writeheader` 現在也會回傳內部呼叫 :meth:`csvwriter.writerow` 的回傳" "值。" -#: ../../library/csv.rst:571 +#: ../../library/csv.rst:572 msgid "Examples" msgstr "範例" -#: ../../library/csv.rst:573 +#: ../../library/csv.rst:574 msgid "The simplest example of reading a CSV file::" msgstr "最簡單的讀取 CSV 檔案範例: ::" -#: ../../library/csv.rst:575 +#: ../../library/csv.rst:576 msgid "" "import csv\n" "with open('some.csv', newline='') as f:\n" @@ -901,11 +902,11 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:581 +#: ../../library/csv.rst:582 msgid "Reading a file with an alternate format::" msgstr "讀取一個其他格式的檔案: ::" -#: ../../library/csv.rst:583 +#: ../../library/csv.rst:584 msgid "" "import csv\n" "with open('passwd', newline='') as f:\n" @@ -919,11 +920,11 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:589 +#: ../../library/csv.rst:590 msgid "The corresponding simplest possible writing example is::" msgstr "相對最簡單、可行的寫入範例為: ::" -#: ../../library/csv.rst:591 +#: ../../library/csv.rst:592 msgid "" "import csv\n" "with open('some.csv', 'w', newline='') as f:\n" @@ -931,7 +932,7 @@ msgid "" " writer.writerows(someiterable)" msgstr "" -#: ../../library/csv.rst:596 +#: ../../library/csv.rst:597 msgid "" "Since :func:`open` is used to open a CSV file for reading, the file will by " "default be decoded into unicode using the system default encoding (see :func:" @@ -942,7 +943,7 @@ msgstr "" "碼格式(請見 :func:`locale.getencoding`),並解碼為 unicode。若要使用不同編碼" "格式進行檔案解碼,請使用 open 函式的 ``encoding`` 引數: ::" -#: ../../library/csv.rst:601 +#: ../../library/csv.rst:602 msgid "" "import csv\n" "with open('some.csv', newline='', encoding='utf-8') as f:\n" @@ -956,7 +957,7 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:607 +#: ../../library/csv.rst:608 msgid "" "The same applies to writing in something other than the system default " "encoding: specify the encoding argument when opening the output file." @@ -964,11 +965,11 @@ msgstr "" "同理可以應用到使用不同編碼格式進行寫入:當開啟輸出檔案時,指定 ``encoding`` " "引數。" -#: ../../library/csv.rst:610 +#: ../../library/csv.rst:611 msgid "Registering a new dialect::" msgstr "註冊一個新的 dialect : ::" -#: ../../library/csv.rst:612 +#: ../../library/csv.rst:613 msgid "" "import csv\n" "csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)\n" @@ -980,13 +981,13 @@ msgstr "" "with open('passwd', newline='') as f:\n" " reader = csv.reader(f, 'unixpwd')" -#: ../../library/csv.rst:617 +#: ../../library/csv.rst:618 msgid "" "A slightly more advanced use of the reader --- catching and reporting " "errors::" msgstr "稍微進階的讀取器用法 -- 擷取及回報錯誤: ::" -#: ../../library/csv.rst:619 +#: ../../library/csv.rst:620 msgid "" "import csv, sys\n" "filename = 'some.csv'\n" @@ -1008,13 +1009,13 @@ msgstr "" " except csv.Error as e:\n" " sys.exit(f'file {filename}, line {reader.line_num}: {e}')" -#: ../../library/csv.rst:629 +#: ../../library/csv.rst:630 msgid "" "And while the module doesn't directly support parsing strings, it can easily " "be done::" msgstr "而當模組無法直接支援剖析字串時,仍可以輕鬆的解決: ::" -#: ../../library/csv.rst:632 +#: ../../library/csv.rst:633 msgid "" "import csv\n" "for row in csv.reader(['one,two,three']):\n" @@ -1024,11 +1025,11 @@ msgstr "" "for row in csv.reader(['one,two,three']):\n" " print(row)" -#: ../../library/csv.rst:638 +#: ../../library/csv.rst:639 msgid "Footnotes" msgstr "註解" -#: ../../library/csv.rst:639 +#: ../../library/csv.rst:640 msgid "" "If ``newline=''`` is not specified, newlines embedded inside quoted fields " "will not be interpreted correctly, and on platforms that use ``\\r\\n`` line " @@ -1037,9 +1038,9 @@ msgid "" "`universal `) newline handling." msgstr "" "如果 ``newline=''`` 沒有被指定,則嵌入引號中的換行符號不會被正確直譯,使用 " -"``\\r\\n`` 行尾 (line ending) 的平台會寫入額外的 ``\\r``。自從 csv 模組有自己 " -"(:term:`統一的 `) 換行處理方式,因此指定 ``newline=''`` " -"會永遠是安全的。" +"``\\r\\n`` 行尾 (line ending) 的平台會寫入額外的 ``\\r``。自從 csv 模組有自" +"己 (:term:`統一的 `) 換行處理方式,因此指定 " +"``newline=''`` 會永遠是安全的。" #: ../../library/csv.rst:11 msgid "csv" diff --git a/library/ctypes.po b/library/ctypes.po index e930f5d30e1..6098fb15ff9 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -47,10 +47,9 @@ msgstr "" #: ../../library/ctypes.rst:27 msgid "" "Note: Some code samples reference the ctypes :class:`c_int` type. On " -"platforms where ``sizeof(long) == sizeof(int)`` it is an alias " -"to :class:`c_long`. So, you should not be confused if :class:`c_long` is " -"printed if you would expect :class:`c_int` --- they are actually the same " -"type." +"platforms where ``sizeof(long) == sizeof(int)`` it is an alias to :class:" +"`c_long`. So, you should not be confused if :class:`c_long` is printed if " +"you would expect :class:`c_int` --- they are actually the same type." msgstr "" #: ../../library/ctypes.rst:35 @@ -76,8 +75,8 @@ msgstr "" #: ../../library/ctypes.rst:48 msgid "" -"Windows errors used to raise :exc:`WindowsError`, which is now an alias " -"of :exc:`OSError`." +"Windows errors used to raise :exc:`WindowsError`, which is now an alias of :" +"exc:`OSError`." msgstr "" #: ../../library/ctypes.rst:53 @@ -209,8 +208,8 @@ msgstr "" #: ../../library/ctypes.rst:125 msgid "" "Sometimes, dlls export functions with names which aren't valid Python " -"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to " -"use :func:`getattr` to retrieve the function::" +"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to use :func:" +"`getattr` to retrieve the function::" msgstr "" #: ../../library/ctypes.rst:129 @@ -364,10 +363,10 @@ msgid "" "``None``, integers, bytes objects and (unicode) strings are the only native " "Python objects that can directly be used as parameters in these function " "calls. ``None`` is passed as a C ``NULL`` pointer, bytes objects and strings " -"are passed as pointer to the memory block that contains their data " -"(:c:expr:`char *` or :c:expr:`wchar_t *`). Python integers are passed as " -"the platform's default C :c:expr:`int` type, their value is masked to fit " -"into the C type." +"are passed as pointer to the memory block that contains their data (:c:expr:" +"`char *` or :c:expr:`wchar_t *`). Python integers are passed as the " +"platform's default C :c:expr:`int` type, their value is masked to fit into " +"the C type." msgstr "" #: ../../library/ctypes.rst:205 @@ -376,7 +375,7 @@ msgid "" "learn more about :mod:`ctypes` data types." msgstr "" -#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2430 +#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2426 msgid "Fundamental data types" msgstr "" @@ -768,10 +767,10 @@ msgstr "" #: ../../library/ctypes.rst:322 msgid "" -"Assigning a new value to instances of the pointer " -"types :class:`c_char_p`, :class:`c_wchar_p`, and :class:`c_void_p` changes " -"the *memory location* they point to, *not the contents* of the memory block " -"(of course not, because Python string objects are immutable)::" +"Assigning a new value to instances of the pointer types :class:`c_char_p`, :" +"class:`c_wchar_p`, and :class:`c_void_p` changes the *memory location* they " +"point to, *not the contents* of the memory block (of course not, because " +"Python string objects are immutable)::" msgstr "" #: ../../library/ctypes.rst:327 @@ -809,11 +808,11 @@ msgstr "" #: ../../library/ctypes.rst:342 msgid "" "You should be careful, however, not to pass them to functions expecting " -"pointers to mutable memory. If you need mutable memory blocks, ctypes has " -"a :func:`create_string_buffer` function which creates these in various " -"ways. The current memory block contents can be accessed (or changed) with " -"the ``raw`` property; if you want to access it as NUL terminated string, use " -"the ``value`` property::" +"pointers to mutable memory. If you need mutable memory blocks, ctypes has a :" +"func:`create_string_buffer` function which creates these in various ways. " +"The current memory block contents can be accessed (or changed) with the " +"``raw`` property; if you want to access it as NUL terminated string, use the " +"``value`` property::" msgstr "" #: ../../library/ctypes.rst:349 @@ -852,9 +851,9 @@ msgstr "" #: ../../library/ctypes.rst:377 msgid "" -"Note that printf prints to the real standard output channel, *not* " -"to :data:`sys.stdout`, so these examples will only work at the console " -"prompt, not from within *IDLE* or *PythonWin*::" +"Note that printf prints to the real standard output channel, *not* to :data:" +"`sys.stdout`, so these examples will only work at the console prompt, not " +"from within *IDLE* or *PythonWin*::" msgstr "" #: ../../library/ctypes.rst:381 @@ -1049,13 +1048,13 @@ msgstr "" msgid "" "If you have defined your own classes which you pass to function calls, you " "have to implement a :meth:`~_CData.from_param` class method for them to be " -"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. " -"The :meth:`~_CData.from_param` class method receives the Python object " -"passed to the function call, it should do a typecheck or whatever is needed " -"to make sure this object is acceptable, and then return the object itself, " -"its :attr:`!_as_parameter_` attribute, or whatever you want to pass as the C " -"function argument in this case. Again, the result should be an integer, " -"string, bytes, a :mod:`ctypes` instance, or an object with an :attr:`!" +"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. The :meth:" +"`~_CData.from_param` class method receives the Python object passed to the " +"function call, it should do a typecheck or whatever is needed to make sure " +"this object is acceptable, and then return the object itself, its :attr:`!" +"_as_parameter_` attribute, or whatever you want to pass as the C function " +"argument in this case. Again, the result should be an integer, string, " +"bytes, a :mod:`ctypes` instance, or an object with an :attr:`!" "_as_parameter_` attribute." msgstr "" @@ -1072,10 +1071,9 @@ msgstr "" #: ../../library/ctypes.rst:512 msgid "" -"The C prototype of :c:func:`time` is ``time_t time(time_t *)``. " -"Because :c:type:`time_t` might be of a different type than the default " -"return type :c:expr:`int`, you should specify the :attr:`!restype` " -"attribute::" +"The C prototype of :c:func:`time` is ``time_t time(time_t *)``. Because :c:" +"type:`time_t` might be of a different type than the default return type :c:" +"expr:`int`, you should specify the :attr:`!restype` attribute::" msgstr "" #: ../../library/ctypes.rst:516 @@ -1245,10 +1243,10 @@ msgstr "" #: ../../library/ctypes.rst:601 msgid "" ":mod:`ctypes` exports the :func:`byref` function which is used to pass " -"parameters by reference. The same effect can be achieved with " -"the :func:`pointer` function, although :func:`pointer` does a lot more work " -"since it constructs a real pointer object, so it is faster to " -"use :func:`byref` if you don't need the pointer object in Python itself::" +"parameters by reference. The same effect can be achieved with the :func:" +"`pointer` function, although :func:`pointer` does a lot more work since it " +"constructs a real pointer object, so it is faster to use :func:`byref` if " +"you don't need the pointer object in Python itself::" msgstr "" #: ../../library/ctypes.rst:607 @@ -1283,11 +1281,11 @@ msgstr "" #: ../../library/ctypes.rst:625 msgid "" -"Structures and unions must derive from the :class:`Structure` " -"and :class:`Union` base classes which are defined in the :mod:`ctypes` " -"module. Each subclass must define a :attr:`~Structure._fields_` " -"attribute. :attr:`!_fields_` must be a list of *2-tuples*, containing a " -"*field name* and a *field type*." +"Structures and unions must derive from the :class:`Structure` and :class:" +"`Union` base classes which are defined in the :mod:`ctypes` module. Each " +"subclass must define a :attr:`~Structure._fields_` attribute. :attr:`!" +"_fields_` must be a list of *2-tuples*, containing a *field name* and a " +"*field type*." msgstr "" #: ../../library/ctypes.rst:630 @@ -1392,8 +1390,8 @@ msgstr "" #: ../../library/ctypes.rst:675 msgid "" "Field :term:`descriptor`\\s can be retrieved from the *class*, they are " -"useful for debugging because they can provide useful information. " -"See :class:`CField`::" +"useful for debugging because they can provide useful information. See :class:" +"`CField`::" msgstr "" #: ../../library/ctypes.rst:679 @@ -1432,40 +1430,33 @@ msgstr "" #: ../../library/ctypes.rst:703 msgid "" -"It is possible to specify the maximum alignment for the fields by setting " -"the :attr:`~Structure._pack_` class attribute to a positive integer. This " -"matches what ``#pragma pack(n)`` does in MSVC." +"It is possible to specify the maximum alignment for the fields and/or for " +"the structure itself by setting the class attributes :attr:`~Structure." +"_pack_` and/or :attr:`~Structure._align_`, respectively. See the attribute " +"documentation for details." msgstr "" -#: ../../library/ctypes.rst:707 -msgid "" -"It is also possible to set a minimum alignment for how the subclass itself " -"is packed in the same way ``#pragma align(n)`` works in MSVC. This can be " -"achieved by specifying a :attr:`~Structure._align_` class attribute in the " -"subclass definition." -msgstr "" - -#: ../../library/ctypes.rst:712 +#: ../../library/ctypes.rst:708 msgid "" ":mod:`ctypes` uses the native byte order for Structures and Unions. To " -"build structures with non-native byte order, you can use one of " -"the :class:`BigEndianStructure`, :class:`LittleEndianStructure`, :class:`BigEndianUnion`, " -"and :class:`LittleEndianUnion` base classes. These classes cannot contain " -"pointer fields." +"build structures with non-native byte order, you can use one of the :class:" +"`BigEndianStructure`, :class:`LittleEndianStructure`, :class:" +"`BigEndianUnion`, and :class:`LittleEndianUnion` base classes. These " +"classes cannot contain pointer fields." msgstr "" -#: ../../library/ctypes.rst:722 +#: ../../library/ctypes.rst:718 msgid "Bit fields in structures and unions" msgstr "" -#: ../../library/ctypes.rst:724 +#: ../../library/ctypes.rst:720 msgid "" "It is possible to create structures and unions containing bit fields. Bit " "fields are only possible for integer fields, the bit width is specified as " "the third item in the :attr:`~Structure._fields_` tuples::" msgstr "" -#: ../../library/ctypes.rst:728 +#: ../../library/ctypes.rst:724 msgid "" ">>> class Int(Structure):\n" "... _fields_ = [(\"first_16\", c_int, 16),\n" @@ -1485,7 +1476,7 @@ msgstr "" ">>> print(Int.second_16)\n" "" -#: ../../library/ctypes.rst:737 +#: ../../library/ctypes.rst:733 msgid "" "It is important to note that bit field allocation and layout in memory are " "not defined as a C standard; their implementation is compiler-specific. By " @@ -1494,33 +1485,33 @@ msgid "" "details on the default behavior and how to change it." msgstr "" -#: ../../library/ctypes.rst:748 +#: ../../library/ctypes.rst:744 msgid "Arrays" msgstr "" -#: ../../library/ctypes.rst:750 +#: ../../library/ctypes.rst:746 msgid "" "Arrays are sequences, containing a fixed number of instances of the same " "type." msgstr "" -#: ../../library/ctypes.rst:752 +#: ../../library/ctypes.rst:748 msgid "" "The recommended way to create array types is by multiplying a data type with " "a positive integer::" msgstr "" -#: ../../library/ctypes.rst:755 +#: ../../library/ctypes.rst:751 msgid "TenPointsArrayType = POINT * 10" msgstr "" -#: ../../library/ctypes.rst:757 +#: ../../library/ctypes.rst:753 msgid "" "Here is an example of a somewhat artificial data type, a structure " "containing 4 POINTs among other stuff::" msgstr "" -#: ../../library/ctypes.rst:760 +#: ../../library/ctypes.rst:756 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -1548,11 +1539,11 @@ msgstr "" "4\n" ">>>" -#: ../../library/ctypes.rst:773 +#: ../../library/ctypes.rst:769 msgid "Instances are created in the usual way, by calling the class::" msgstr "" -#: ../../library/ctypes.rst:775 +#: ../../library/ctypes.rst:771 msgid "" "arr = TenPointsArrayType()\n" "for pt in arr:\n" @@ -1562,17 +1553,17 @@ msgstr "" "for pt in arr:\n" " print(pt.x, pt.y)" -#: ../../library/ctypes.rst:779 +#: ../../library/ctypes.rst:775 msgid "" "The above code print a series of ``0 0`` lines, because the array contents " "is initialized to zeros." msgstr "" -#: ../../library/ctypes.rst:782 +#: ../../library/ctypes.rst:778 msgid "Initializers of the correct type can also be specified::" msgstr "" -#: ../../library/ctypes.rst:784 +#: ../../library/ctypes.rst:780 msgid "" ">>> from ctypes import *\n" ">>> TenIntegers = c_int * 10\n" @@ -1594,17 +1585,17 @@ msgstr "" "1 2 3 4 5 6 7 8 9 10\n" ">>>" -#: ../../library/ctypes.rst:798 +#: ../../library/ctypes.rst:794 msgid "Pointers" msgstr "指標" -#: ../../library/ctypes.rst:800 +#: ../../library/ctypes.rst:796 msgid "" -"Pointer instances are created by calling the :func:`pointer` function on " -"a :mod:`ctypes` type::" +"Pointer instances are created by calling the :func:`pointer` function on a :" +"mod:`ctypes` type::" msgstr "" -#: ../../library/ctypes.rst:803 +#: ../../library/ctypes.rst:799 msgid "" ">>> from ctypes import *\n" ">>> i = c_int(42)\n" @@ -1616,13 +1607,13 @@ msgstr "" ">>> pi = pointer(i)\n" ">>>" -#: ../../library/ctypes.rst:808 +#: ../../library/ctypes.rst:804 msgid "" "Pointer instances have a :attr:`~_Pointer.contents` attribute which returns " "the object to which the pointer points, the ``i`` object above::" msgstr "" -#: ../../library/ctypes.rst:811 +#: ../../library/ctypes.rst:807 msgid "" ">>> pi.contents\n" "c_long(42)\n" @@ -1632,13 +1623,13 @@ msgstr "" "c_long(42)\n" ">>>" -#: ../../library/ctypes.rst:815 +#: ../../library/ctypes.rst:811 msgid "" "Note that :mod:`ctypes` does not have OOR (original object return), it " "constructs a new, equivalent object each time you retrieve an attribute::" msgstr "" -#: ../../library/ctypes.rst:818 +#: ../../library/ctypes.rst:814 msgid "" ">>> pi.contents is i\n" "False\n" @@ -1652,14 +1643,14 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:824 +#: ../../library/ctypes.rst:820 msgid "" "Assigning another :class:`c_int` instance to the pointer's contents " "attribute would cause the pointer to point to the memory location where this " "is stored::" msgstr "" -#: ../../library/ctypes.rst:827 +#: ../../library/ctypes.rst:823 msgid "" ">>> i = c_int(99)\n" ">>> pi.contents = i\n" @@ -1673,11 +1664,11 @@ msgstr "" "c_long(99)\n" ">>>" -#: ../../library/ctypes.rst:836 +#: ../../library/ctypes.rst:832 msgid "Pointer instances can also be indexed with integers::" msgstr "" -#: ../../library/ctypes.rst:838 +#: ../../library/ctypes.rst:834 msgid "" ">>> pi[0]\n" "99\n" @@ -1687,11 +1678,11 @@ msgstr "" "99\n" ">>>" -#: ../../library/ctypes.rst:842 +#: ../../library/ctypes.rst:838 msgid "Assigning to an integer index changes the pointed to value::" msgstr "" -#: ../../library/ctypes.rst:844 +#: ../../library/ctypes.rst:840 msgid "" ">>> print(i)\n" "c_long(99)\n" @@ -1707,7 +1698,7 @@ msgstr "" "c_long(22)\n" ">>>" -#: ../../library/ctypes.rst:851 +#: ../../library/ctypes.rst:847 msgid "" "It is also possible to use indexes different from 0, but you must know what " "you're doing, just as in C: You can access or change arbitrary memory " @@ -1716,7 +1707,7 @@ msgid "" "instead of a single item." msgstr "" -#: ../../library/ctypes.rst:857 +#: ../../library/ctypes.rst:853 msgid "" "Behind the scenes, the :func:`pointer` function does more than simply create " "pointer instances, it has to create pointer *types* first. This is done with " @@ -1724,7 +1715,7 @@ msgid "" "returns a new type::" msgstr "" -#: ../../library/ctypes.rst:862 +#: ../../library/ctypes.rst:858 msgid "" ">>> PI = POINTER(c_int)\n" ">>> PI\n" @@ -1748,13 +1739,13 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:873 +#: ../../library/ctypes.rst:869 msgid "" "Calling the pointer type without an argument creates a ``NULL`` pointer. " "``NULL`` pointers have a ``False`` boolean value::" msgstr "" -#: ../../library/ctypes.rst:876 +#: ../../library/ctypes.rst:872 msgid "" ">>> null_ptr = POINTER(c_int)()\n" ">>> print(bool(null_ptr))\n" @@ -1766,13 +1757,13 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:881 +#: ../../library/ctypes.rst:877 msgid "" ":mod:`ctypes` checks for ``NULL`` when dereferencing pointers (but " "dereferencing invalid non-\\ ``NULL`` pointers would crash Python)::" msgstr "" -#: ../../library/ctypes.rst:884 +#: ../../library/ctypes.rst:880 msgid "" ">>> null_ptr[0]\n" "Traceback (most recent call last):\n" @@ -1798,34 +1789,37 @@ msgstr "" "ValueError: NULL pointer access\n" ">>>" -#: ../../library/ctypes.rst:899 +#: ../../library/ctypes.rst:895 msgid "Thread safety without the GIL" msgstr "" -#: ../../library/ctypes.rst:901 +#: ../../library/ctypes.rst:897 msgid "" "From Python 3.13 onward, the :term:`GIL` can be disabled on :term:`free " "threaded ` builds. In ctypes, reads and writes to a single " "object concurrently is safe, but not across multiple objects:" msgstr "" -#: ../../library/ctypes.rst:904 +#: ../../library/ctypes.rst:900 msgid "" ">>> number = c_int(42)\n" ">>> pointer_a = pointer(number)\n" ">>> pointer_b = pointer(number)" msgstr "" +">>> number = c_int(42)\n" +">>> pointer_a = pointer(number)\n" +">>> pointer_b = pointer(number)" -#: ../../library/ctypes.rst:910 +#: ../../library/ctypes.rst:906 msgid "" "In the above, it's only safe for one object to read and write to the address " "at once if the GIL is disabled. So, ``pointer_a`` can be shared and written " "to across multiple threads, but only if ``pointer_b`` is not also attempting " -"to do the same. If this is an issue, consider using " -"a :class:`threading.Lock` to synchronize access to memory:" +"to do the same. If this is an issue, consider using a :class:`threading." +"Lock` to synchronize access to memory:" msgstr "" -#: ../../library/ctypes.rst:915 +#: ../../library/ctypes.rst:911 msgid "" ">>> import threading\n" ">>> lock = threading.Lock()\n" @@ -1836,12 +1830,20 @@ msgid "" ">>> with lock:\n" "... pointer_b.contents = 42" msgstr "" +">>> import threading\n" +">>> lock = threading.Lock()\n" +">>> # 執行緒 1\n" +">>> with lock:\n" +"... pointer_a.contents = 24\n" +">>> # 執行緒 2\n" +">>> with lock:\n" +"... pointer_b.contents = 42" -#: ../../library/ctypes.rst:930 +#: ../../library/ctypes.rst:926 msgid "Type conversions" msgstr "" -#: ../../library/ctypes.rst:932 +#: ../../library/ctypes.rst:928 msgid "" "Usually, ctypes does strict type checking. This means, if you have " "``POINTER(c_int)`` in the :attr:`~_CFuncPtr.argtypes` list of a function or " @@ -1852,7 +1854,7 @@ msgid "" "ctypes accepts an array of c_int::" msgstr "" -#: ../../library/ctypes.rst:939 +#: ../../library/ctypes.rst:935 msgid "" ">>> class Bar(Structure):\n" "... _fields_ = [(\"count\", c_int), (\"values\", POINTER(c_int))]\n" @@ -1882,7 +1884,7 @@ msgstr "" "3\n" ">>>" -#: ../../library/ctypes.rst:953 +#: ../../library/ctypes.rst:949 msgid "" "In addition, if a function argument is explicitly declared to be a pointer " "type (such as ``POINTER(c_int)``) in :attr:`~_CFuncPtr.argtypes`, an object " @@ -1891,11 +1893,11 @@ msgid "" "automatically." msgstr "" -#: ../../library/ctypes.rst:958 +#: ../../library/ctypes.rst:954 msgid "To set a POINTER type field to ``NULL``, you can assign ``None``::" msgstr "" -#: ../../library/ctypes.rst:960 +#: ../../library/ctypes.rst:956 msgid "" ">>> bar.values = None\n" ">>>" @@ -1903,7 +1905,7 @@ msgstr "" ">>> bar.values = None\n" ">>>" -#: ../../library/ctypes.rst:965 +#: ../../library/ctypes.rst:961 msgid "" "Sometimes you have instances of incompatible types. In C, you can cast one " "type into another type. :mod:`ctypes` provides a :func:`cast` function " @@ -1912,7 +1914,7 @@ msgid "" "``values`` field, but not instances of other types::" msgstr "" -#: ../../library/ctypes.rst:971 +#: ../../library/ctypes.rst:967 msgid "" ">>> bar.values = (c_byte * 4)()\n" "Traceback (most recent call last):\n" @@ -1928,11 +1930,11 @@ msgstr "" "instance\n" ">>>" -#: ../../library/ctypes.rst:977 +#: ../../library/ctypes.rst:973 msgid "For these cases, the :func:`cast` function is handy." msgstr "" -#: ../../library/ctypes.rst:979 +#: ../../library/ctypes.rst:975 msgid "" "The :func:`cast` function can be used to cast a ctypes instance into a " "pointer to a different ctypes data type. :func:`cast` takes two parameters, " @@ -1941,7 +1943,7 @@ msgid "" "references the same memory block as the first argument::" msgstr "" -#: ../../library/ctypes.rst:985 +#: ../../library/ctypes.rst:981 msgid "" ">>> a = (c_byte * 4)()\n" ">>> cast(a, POINTER(c_int))\n" @@ -1953,13 +1955,13 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:990 +#: ../../library/ctypes.rst:986 msgid "" "So, :func:`cast` can be used to assign to the ``values`` field of ``Bar`` " "the structure::" msgstr "" -#: ../../library/ctypes.rst:993 +#: ../../library/ctypes.rst:989 msgid "" ">>> bar = Bar()\n" ">>> bar.values = cast((c_byte * 4)(), POINTER(c_int))\n" @@ -1973,18 +1975,18 @@ msgstr "" "0\n" ">>>" -#: ../../library/ctypes.rst:1003 +#: ../../library/ctypes.rst:999 msgid "Incomplete Types" msgstr "" -#: ../../library/ctypes.rst:1005 +#: ../../library/ctypes.rst:1001 msgid "" "*Incomplete Types* are structures, unions or arrays whose members are not " "yet specified. In C, they are specified by forward declarations, which are " "defined later::" msgstr "" -#: ../../library/ctypes.rst:1009 +#: ../../library/ctypes.rst:1005 msgid "" "struct cell; /* forward declaration */\n" "\n" @@ -1994,13 +1996,13 @@ msgid "" "};" msgstr "" -#: ../../library/ctypes.rst:1016 +#: ../../library/ctypes.rst:1012 msgid "" "The straightforward translation into ctypes code would be this, but it does " "not work::" msgstr "" -#: ../../library/ctypes.rst:1019 +#: ../../library/ctypes.rst:1015 msgid "" ">>> class cell(Structure):\n" "... _fields_ = [(\"name\", c_char_p),\n" @@ -2022,14 +2024,14 @@ msgstr "" "NameError: name 'cell' is not defined\n" ">>>" -#: ../../library/ctypes.rst:1029 +#: ../../library/ctypes.rst:1025 msgid "" "because the new ``class cell`` is not available in the class statement " -"itself. In :mod:`ctypes`, we can define the ``cell`` class and set " -"the :attr:`~Structure._fields_` attribute later, after the class statement::" +"itself. In :mod:`ctypes`, we can define the ``cell`` class and set the :attr:" +"`~Structure._fields_` attribute later, after the class statement::" msgstr "" -#: ../../library/ctypes.rst:1033 +#: ../../library/ctypes.rst:1029 msgid "" ">>> from ctypes import *\n" ">>> class cell(Structure):\n" @@ -2047,13 +2049,13 @@ msgstr "" "... (\"next\", POINTER(cell))]\n" ">>>" -#: ../../library/ctypes.rst:1041 +#: ../../library/ctypes.rst:1037 msgid "" "Let's try it. We create two instances of ``cell``, and let them point to " "each other, and finally follow the pointer chain a few times::" msgstr "" -#: ../../library/ctypes.rst:1044 +#: ../../library/ctypes.rst:1040 msgid "" ">>> c1 = cell()\n" ">>> c1.name = b\"foo\"\n" @@ -2083,24 +2085,24 @@ msgstr "" "foo bar foo bar foo bar foo bar\n" ">>>" -#: ../../library/ctypes.rst:1062 +#: ../../library/ctypes.rst:1058 msgid "Callback functions" msgstr "回呼函式" -#: ../../library/ctypes.rst:1064 +#: ../../library/ctypes.rst:1060 msgid "" ":mod:`ctypes` allows creating C callable function pointers from Python " "callables. These are sometimes called *callback functions*." msgstr "" -#: ../../library/ctypes.rst:1067 +#: ../../library/ctypes.rst:1063 msgid "" "First, you must create a class for the callback function. The class knows " "the calling convention, the return type, and the number and types of " "arguments this function will receive." msgstr "" -#: ../../library/ctypes.rst:1071 +#: ../../library/ctypes.rst:1067 msgid "" "The :func:`CFUNCTYPE` factory function creates types for callback functions " "using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE` " @@ -2108,21 +2110,21 @@ msgid "" "calling convention." msgstr "" -#: ../../library/ctypes.rst:1076 +#: ../../library/ctypes.rst:1072 msgid "" "Both of these factory functions are called with the result type as first " "argument, and the callback functions expected argument types as the " "remaining arguments." msgstr "" -#: ../../library/ctypes.rst:1080 +#: ../../library/ctypes.rst:1076 msgid "" "I will present an example here which uses the standard C library's :c:func:`!" "qsort` function, that is used to sort items with the help of a callback " "function. :c:func:`!qsort` will be used to sort an array of integers::" msgstr "" -#: ../../library/ctypes.rst:1084 +#: ../../library/ctypes.rst:1080 msgid "" ">>> IntArray5 = c_int * 5\n" ">>> ia = IntArray5(5, 1, 7, 33, 99)\n" @@ -2136,7 +2138,7 @@ msgstr "" ">>> qsort.restype = None\n" ">>>" -#: ../../library/ctypes.rst:1090 +#: ../../library/ctypes.rst:1086 msgid "" ":func:`!qsort` must be called with a pointer to the data to sort, the number " "of items in the data array, the size of one item, and a pointer to the " @@ -2146,13 +2148,13 @@ msgid "" "otherwise." msgstr "" -#: ../../library/ctypes.rst:1096 +#: ../../library/ctypes.rst:1092 msgid "" "So our callback function receives pointers to integers, and must return an " "integer. First we create the ``type`` for the callback function::" msgstr "" -#: ../../library/ctypes.rst:1099 +#: ../../library/ctypes.rst:1095 msgid "" ">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" ">>>" @@ -2160,13 +2162,13 @@ msgstr "" ">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" ">>>" -#: ../../library/ctypes.rst:1102 +#: ../../library/ctypes.rst:1098 msgid "" "To get started, here is a simple callback that shows the values it gets " "passed::" msgstr "" -#: ../../library/ctypes.rst:1105 +#: ../../library/ctypes.rst:1101 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -2182,11 +2184,11 @@ msgstr "" ">>> cmp_func = CMPFUNC(py_cmp_func)\n" ">>>" -#: ../../library/ctypes.rst:1112 +#: ../../library/ctypes.rst:1108 msgid "The result::" msgstr "結果為: ::" -#: ../../library/ctypes.rst:1114 +#: ../../library/ctypes.rst:1110 msgid "" ">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n" "py_cmp_func 5 1\n" @@ -2204,11 +2206,11 @@ msgstr "" "py_cmp_func 1 7\n" ">>>" -#: ../../library/ctypes.rst:1122 +#: ../../library/ctypes.rst:1118 msgid "Now we can actually compare the two items and return a useful result::" msgstr "" -#: ../../library/ctypes.rst:1124 +#: ../../library/ctypes.rst:1120 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -2236,11 +2238,11 @@ msgstr "" "py_cmp_func 5 7\n" ">>>" -#: ../../library/ctypes.rst:1137 +#: ../../library/ctypes.rst:1133 msgid "As we can easily check, our array is sorted now::" msgstr "" -#: ../../library/ctypes.rst:1139 +#: ../../library/ctypes.rst:1135 msgid "" ">>> for i in ia: print(i, end=\" \")\n" "...\n" @@ -2252,13 +2254,13 @@ msgstr "" "1 5 7 33 99\n" ">>>" -#: ../../library/ctypes.rst:1144 +#: ../../library/ctypes.rst:1140 msgid "" "The function factories can be used as decorator factories, so we may as well " "write::" msgstr "" -#: ../../library/ctypes.rst:1147 +#: ../../library/ctypes.rst:1143 msgid "" ">>> @CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" "... def py_cmp_func(a, b):\n" @@ -2286,14 +2288,14 @@ msgstr "" "py_cmp_func 5 7\n" ">>>" -#: ../../library/ctypes.rst:1162 +#: ../../library/ctypes.rst:1158 msgid "" "Make sure you keep references to :func:`CFUNCTYPE` objects as long as they " "are used from C code. :mod:`ctypes` doesn't, and if you don't, they may be " "garbage collected, crashing your program when a callback is made." msgstr "" -#: ../../library/ctypes.rst:1166 +#: ../../library/ctypes.rst:1162 msgid "" "Also, note that if the callback function is called in a thread created " "outside of Python's control (e.g. by the foreign code that calls the " @@ -2303,25 +2305,25 @@ msgid "" "even when those calls are made from the same C thread." msgstr "" -#: ../../library/ctypes.rst:1176 +#: ../../library/ctypes.rst:1172 msgid "Accessing values exported from dlls" msgstr "" -#: ../../library/ctypes.rst:1178 +#: ../../library/ctypes.rst:1174 msgid "" "Some shared libraries not only export functions, they also export variables. " "An example in the Python library itself is the :c:data:`Py_Version`, Python " "runtime version number encoded in a single constant integer." msgstr "" -#: ../../library/ctypes.rst:1182 +#: ../../library/ctypes.rst:1178 msgid "" ":mod:`ctypes` can access values like this with the :meth:`~_CData.in_dll` " "class methods of the type. *pythonapi* is a predefined symbol giving access " "to the Python C api::" msgstr "" -#: ../../library/ctypes.rst:1186 +#: ../../library/ctypes.rst:1182 msgid "" ">>> version = ctypes.c_int.in_dll(ctypes.pythonapi, \"Py_Version\")\n" ">>> print(hex(version.value))\n" @@ -2331,17 +2333,17 @@ msgstr "" ">>> print(hex(version.value))\n" "0x30c00a0" -#: ../../library/ctypes.rst:1190 +#: ../../library/ctypes.rst:1186 msgid "" "An extended example which also demonstrates the use of pointers accesses " "the :c:data:`PyImport_FrozenModules` pointer exported by Python." msgstr "" -#: ../../library/ctypes.rst:1193 +#: ../../library/ctypes.rst:1189 msgid "Quoting the docs for that value:" msgstr "" -#: ../../library/ctypes.rst:1195 +#: ../../library/ctypes.rst:1191 msgid "" "This pointer is initialized to point to an array of :c:struct:`_frozen` " "records, terminated by one whose members are all ``NULL`` or zero. When a " @@ -2350,13 +2352,13 @@ msgid "" "frozen modules." msgstr "" -#: ../../library/ctypes.rst:1200 +#: ../../library/ctypes.rst:1196 msgid "" "So manipulating this pointer could even prove useful. To restrict the " "example size, we show only how this table can be read with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1203 +#: ../../library/ctypes.rst:1199 msgid "" ">>> from ctypes import *\n" ">>>\n" @@ -2380,13 +2382,13 @@ msgstr "" "...\n" ">>>" -#: ../../library/ctypes.rst:1214 +#: ../../library/ctypes.rst:1210 msgid "" "We have defined the :c:struct:`_frozen` data type, so we can get the pointer " "to the table::" msgstr "" -#: ../../library/ctypes.rst:1217 +#: ../../library/ctypes.rst:1213 msgid "" ">>> FrozenTable = POINTER(struct_frozen)\n" ">>> table = FrozenTable.in_dll(pythonapi, \"_PyImport_FrozenBootstrap\")\n" @@ -2396,7 +2398,7 @@ msgstr "" ">>> table = FrozenTable.in_dll(pythonapi, \"_PyImport_FrozenBootstrap\")\n" ">>>" -#: ../../library/ctypes.rst:1221 +#: ../../library/ctypes.rst:1217 msgid "" "Since ``table`` is a ``pointer`` to the array of ``struct_frozen`` records, " "we can iterate over it, but we just have to make sure that our loop " @@ -2405,7 +2407,7 @@ msgid "" "the loop when we hit the ``NULL`` entry::" msgstr "" -#: ../../library/ctypes.rst:1227 +#: ../../library/ctypes.rst:1223 msgid "" ">>> for item in table:\n" "... if item.name is None:\n" @@ -2427,28 +2429,28 @@ msgstr "" "zipimport 12345\n" ">>>" -#: ../../library/ctypes.rst:1237 +#: ../../library/ctypes.rst:1233 msgid "" "The fact that standard Python has a frozen module and a frozen package " "(indicated by the negative ``size`` member) is not well known, it is only " "used for testing. Try it out with ``import __hello__`` for example." msgstr "" -#: ../../library/ctypes.rst:1245 +#: ../../library/ctypes.rst:1241 msgid "Surprises" msgstr "" -#: ../../library/ctypes.rst:1247 +#: ../../library/ctypes.rst:1243 msgid "" "There are some edges in :mod:`ctypes` where you might expect something other " "than what actually happens." msgstr "" -#: ../../library/ctypes.rst:1250 +#: ../../library/ctypes.rst:1246 msgid "Consider the following example::" msgstr "" -#: ../../library/ctypes.rst:1252 +#: ../../library/ctypes.rst:1248 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -2486,13 +2488,13 @@ msgstr "" "3 4 3 4\n" ">>>" -#: ../../library/ctypes.rst:1270 +#: ../../library/ctypes.rst:1266 msgid "" "Hm. We certainly expected the last statement to print ``3 4 1 2``. What " "happened? Here are the steps of the ``rc.a, rc.b = rc.b, rc.a`` line above::" msgstr "" -#: ../../library/ctypes.rst:1273 +#: ../../library/ctypes.rst:1269 msgid "" ">>> temp0, temp1 = rc.b, rc.a\n" ">>> rc.a = temp0\n" @@ -2504,7 +2506,7 @@ msgstr "" ">>> rc.b = temp1\n" ">>>" -#: ../../library/ctypes.rst:1278 +#: ../../library/ctypes.rst:1274 msgid "" "Note that ``temp0`` and ``temp1`` are objects still using the internal " "buffer of the ``rc`` object above. So executing ``rc.a = temp0`` copies the " @@ -2513,20 +2515,20 @@ msgid "" "have the expected effect." msgstr "" -#: ../../library/ctypes.rst:1284 +#: ../../library/ctypes.rst:1280 msgid "" "Keep in mind that retrieving sub-objects from Structure, Unions, and Arrays " "doesn't *copy* the sub-object, instead it retrieves a wrapper object " "accessing the root-object's underlying buffer." msgstr "" -#: ../../library/ctypes.rst:1288 +#: ../../library/ctypes.rst:1284 msgid "" "Another example that may behave differently from what one would expect is " "this::" msgstr "" -#: ../../library/ctypes.rst:1290 +#: ../../library/ctypes.rst:1286 msgid "" ">>> s = c_char_p()\n" ">>> s.value = b\"abc def ghi\"\n" @@ -2544,13 +2546,13 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:1300 +#: ../../library/ctypes.rst:1296 msgid "" "Objects instantiated from :class:`c_char_p` can only have their value set to " "bytes or integers." msgstr "" -#: ../../library/ctypes.rst:1303 +#: ../../library/ctypes.rst:1299 msgid "" "Why is it printing ``False``? ctypes instances are objects containing a " "memory block plus some :term:`descriptor`\\s accessing the contents of the " @@ -2559,16 +2561,16 @@ msgid "" "the contents again constructs a new Python object each time!" msgstr "" -#: ../../library/ctypes.rst:1313 +#: ../../library/ctypes.rst:1309 msgid "Variable-sized data types" msgstr "" -#: ../../library/ctypes.rst:1315 +#: ../../library/ctypes.rst:1311 msgid "" ":mod:`ctypes` provides some support for variable-sized arrays and structures." msgstr "" -#: ../../library/ctypes.rst:1317 +#: ../../library/ctypes.rst:1313 msgid "" "The :func:`resize` function can be used to resize the memory buffer of an " "existing ctypes object. The function takes the object as first argument, " @@ -2577,7 +2579,7 @@ msgid "" "objects type, a :exc:`ValueError` is raised if this is tried::" msgstr "" -#: ../../library/ctypes.rst:1323 +#: ../../library/ctypes.rst:1319 msgid "" ">>> short_array = (c_short * 4)()\n" ">>> print(sizeof(short_array))\n" @@ -2607,14 +2609,14 @@ msgstr "" "8\n" ">>>" -#: ../../library/ctypes.rst:1337 +#: ../../library/ctypes.rst:1333 msgid "" "This is nice and fine, but how would one access the additional elements " "contained in this array? Since the type still only knows about 4 elements, " "we get errors accessing other elements::" msgstr "" -#: ../../library/ctypes.rst:1341 +#: ../../library/ctypes.rst:1337 msgid "" ">>> short_array[:]\n" "[0, 0, 0, 0]\n" @@ -2632,28 +2634,28 @@ msgstr "" "IndexError: invalid index\n" ">>>" -#: ../../library/ctypes.rst:1349 +#: ../../library/ctypes.rst:1345 msgid "" "Another way to use variable-sized data types with :mod:`ctypes` is to use " "the dynamic nature of Python, and (re-)define the data type after the " "required size is already known, on a case by case basis." msgstr "" -#: ../../library/ctypes.rst:1357 +#: ../../library/ctypes.rst:1353 msgid "ctypes reference" msgstr "" -#: ../../library/ctypes.rst:1363 +#: ../../library/ctypes.rst:1359 msgid "Finding shared libraries" msgstr "" -#: ../../library/ctypes.rst:1365 +#: ../../library/ctypes.rst:1361 msgid "" "When programming in a compiled language, shared libraries are accessed when " "compiling/linking a program, and when the program is run." msgstr "" -#: ../../library/ctypes.rst:1368 +#: ../../library/ctypes.rst:1364 msgid "" "The purpose of the :func:`~ctypes.util.find_library` function is to locate a " "library in a way similar to what the compiler or runtime loader does (on " @@ -2662,13 +2664,13 @@ msgid "" "and call the runtime loader directly." msgstr "" -#: ../../library/ctypes.rst:1374 +#: ../../library/ctypes.rst:1370 msgid "" "The :mod:`!ctypes.util` module provides a function which can help to " "determine the library to load." msgstr "" -#: ../../library/ctypes.rst:1382 +#: ../../library/ctypes.rst:1378 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like *lib*, suffix like ``.so``, ``.dylib`` or version " @@ -2676,29 +2678,29 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1387 ../../library/ctypes.rst:2135 +#: ../../library/ctypes.rst:1383 ../../library/ctypes.rst:2131 msgid "The exact functionality is system dependent." msgstr "" -#: ../../library/ctypes.rst:1389 +#: ../../library/ctypes.rst:1385 msgid "" "On Linux, :func:`~ctypes.util.find_library` tries to run external programs " "(``/sbin/ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the library " "file. It returns the filename of the library file." msgstr "" -#: ../../library/ctypes.rst:1393 +#: ../../library/ctypes.rst:1389 msgid "" "On Linux, the value of the environment variable ``LD_LIBRARY_PATH`` is used " "when searching for libraries, if a library cannot be found by any other " "means." msgstr "" -#: ../../library/ctypes.rst:1397 +#: ../../library/ctypes.rst:1393 msgid "Here are some examples::" msgstr "以下是一些範例: ::" -#: ../../library/ctypes.rst:1399 +#: ../../library/ctypes.rst:1395 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"m\")\n" @@ -2718,14 +2720,14 @@ msgstr "" "'libbz2.so.1.0'\n" ">>>" -#: ../../library/ctypes.rst:1408 +#: ../../library/ctypes.rst:1404 msgid "" "On macOS and Android, :func:`~ctypes.util.find_library` uses the system's " "standard naming schemes and paths to locate the library, and returns a full " "pathname if successful::" msgstr "" -#: ../../library/ctypes.rst:1412 +#: ../../library/ctypes.rst:1408 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"c\")\n" @@ -2749,7 +2751,7 @@ msgstr "" "'/System/Library/Frameworks/AGL.framework/AGL'\n" ">>>" -#: ../../library/ctypes.rst:1423 +#: ../../library/ctypes.rst:1419 msgid "" "On Windows, :func:`~ctypes.util.find_library` searches along the system " "search path, and returns the full pathname, but since there is no predefined " @@ -2757,7 +2759,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ctypes.rst:1427 +#: ../../library/ctypes.rst:1423 msgid "" "If wrapping a shared library with :mod:`ctypes`, it *may* be better to " "determine the shared library name at development time, and hardcode that " @@ -2765,18 +2767,18 @@ msgid "" "to locate the library at runtime." msgstr "" -#: ../../library/ctypes.rst:1435 +#: ../../library/ctypes.rst:1431 msgid "Listing loaded shared libraries" msgstr "" -#: ../../library/ctypes.rst:1437 +#: ../../library/ctypes.rst:1433 msgid "" "When writing code that relies on code loaded from shared libraries, it can " "be useful to know which shared libraries have already been loaded into the " "current process." msgstr "" -#: ../../library/ctypes.rst:1441 +#: ../../library/ctypes.rst:1437 msgid "" "The :mod:`!ctypes.util` module provides the :func:`~ctypes.util.dllist` " "function, which calls the different APIs provided by the various platforms " @@ -2784,7 +2786,7 @@ msgid "" "current process." msgstr "" -#: ../../library/ctypes.rst:1445 +#: ../../library/ctypes.rst:1441 msgid "" "The exact output of this function will be system dependent. On most " "platforms, the first entry of this list represents the current process " @@ -2792,56 +2794,59 @@ msgid "" "return may look like::" msgstr "" -#: ../../library/ctypes.rst:1450 +#: ../../library/ctypes.rst:1446 msgid "" ">>> from ctypes.util import dllist\n" ">>> dllist()\n" "['', 'linux-vdso.so.1', '/lib/x86_64-linux-gnu/libm.so.6', '/lib/x86_64-" "linux-gnu/libc.so.6', ... ]" msgstr "" +">>> from ctypes.util import dllist\n" +">>> dllist()\n" +"['', 'linux-vdso.so.1', '/lib/x86_64-linux-gnu/libm.so.6', '/lib/x86_64-" +"linux-gnu/libc.so.6', ... ]" -#: ../../library/ctypes.rst:1457 +#: ../../library/ctypes.rst:1453 msgid "Loading shared libraries" msgstr "" -#: ../../library/ctypes.rst:1459 +#: ../../library/ctypes.rst:1455 msgid "" "There are several ways to load shared libraries into the Python process. " "One way is to instantiate one of the following classes:" msgstr "" -#: ../../library/ctypes.rst:1465 +#: ../../library/ctypes.rst:1461 msgid "" "Instances of this class represent loaded shared libraries. Functions in " "these libraries use the standard C calling convention, and are assumed to " "return :c:expr:`int`." msgstr "" -#: ../../library/ctypes.rst:1469 +#: ../../library/ctypes.rst:1465 msgid "" "On Windows creating a :class:`CDLL` instance may fail even if the DLL name " -"exists. When a dependent DLL of the loaded DLL is not found, " -"a :exc:`OSError` error is raised with the message *\"[WinError 126] The " -"specified module could not be found\".* This error message does not contain " -"the name of the missing DLL because the Windows API does not return this " -"information making this error hard to diagnose. To resolve this error and " -"determine which DLL is not found, you need to find the list of dependent " -"DLLs and determine which one is not found using Windows debugging and " -"tracing tools." -msgstr "" - -#: ../../library/ctypes.rst:1481 ../../library/ctypes.rst:1506 -#: ../../library/ctypes.rst:1519 ../../library/ctypes.rst:1537 +"exists. When a dependent DLL of the loaded DLL is not found, a :exc:" +"`OSError` error is raised with the message *\"[WinError 126] The specified " +"module could not be found\".* This error message does not contain the name " +"of the missing DLL because the Windows API does not return this information " +"making this error hard to diagnose. To resolve this error and determine " +"which DLL is not found, you need to find the list of dependent DLLs and " +"determine which one is not found using Windows debugging and tracing tools." +msgstr "" + +#: ../../library/ctypes.rst:1477 ../../library/ctypes.rst:1502 +#: ../../library/ctypes.rst:1515 ../../library/ctypes.rst:1533 msgid "The *name* parameter can now be a :term:`path-like object`." msgstr "" -#: ../../library/ctypes.rst:1485 +#: ../../library/ctypes.rst:1481 msgid "" "`Microsoft DUMPBIN tool `_ -- A tool to find DLL dependents." msgstr "" -#: ../../library/ctypes.rst:1491 +#: ../../library/ctypes.rst:1487 msgid "" "Instances of this class represent loaded shared libraries, functions in " "these libraries use the ``stdcall`` calling convention, and are assumed to " @@ -2851,38 +2856,38 @@ msgid "" "a failure, an :class:`OSError` is automatically raised." msgstr "" -#: ../../library/ctypes.rst:1498 ../../library/ctypes.rst:1515 -#: ../../library/ctypes.rst:1659 ../../library/ctypes.rst:1667 -#: ../../library/ctypes.rst:1839 ../../library/ctypes.rst:1891 -#: ../../library/ctypes.rst:2043 ../../library/ctypes.rst:2115 -#: ../../library/ctypes.rst:2124 ../../library/ctypes.rst:2149 -#: ../../library/ctypes.rst:2163 ../../library/ctypes.rst:2172 -#: ../../library/ctypes.rst:2181 ../../library/ctypes.rst:2196 -#: ../../library/ctypes.rst:2263 ../../library/ctypes.rst:2290 -#: ../../library/ctypes.rst:2690 ../../library/ctypes.rst:3088 +#: ../../library/ctypes.rst:1494 ../../library/ctypes.rst:1511 +#: ../../library/ctypes.rst:1655 ../../library/ctypes.rst:1663 +#: ../../library/ctypes.rst:1835 ../../library/ctypes.rst:1887 +#: ../../library/ctypes.rst:2039 ../../library/ctypes.rst:2111 +#: ../../library/ctypes.rst:2120 ../../library/ctypes.rst:2145 +#: ../../library/ctypes.rst:2159 ../../library/ctypes.rst:2168 +#: ../../library/ctypes.rst:2177 ../../library/ctypes.rst:2192 +#: ../../library/ctypes.rst:2259 ../../library/ctypes.rst:2286 +#: ../../library/ctypes.rst:2686 ../../library/ctypes.rst:3104 msgid "Availability" msgstr "可用性" -#: ../../library/ctypes.rst:1500 +#: ../../library/ctypes.rst:1496 msgid "" -":exc:`WindowsError` used to be raised, which is now an alias " -"of :exc:`OSError`." +":exc:`WindowsError` used to be raised, which is now an alias of :exc:" +"`OSError`." msgstr "" -#: ../../library/ctypes.rst:1511 +#: ../../library/ctypes.rst:1507 msgid "" "Instances of this class represent loaded shared libraries, functions in " "these libraries use the ``stdcall`` calling convention, and are assumed to " "return :c:expr:`int` by default." msgstr "" -#: ../../library/ctypes.rst:1522 +#: ../../library/ctypes.rst:1518 msgid "" "The Python :term:`global interpreter lock` is released before calling any " "function exported by these libraries, and reacquired afterwards." msgstr "" -#: ../../library/ctypes.rst:1528 +#: ../../library/ctypes.rst:1524 msgid "" "Instances of this class behave like :class:`CDLL` instances, except that the " "Python GIL is *not* released during the function call, and after the " @@ -2890,11 +2895,11 @@ msgid "" "set, a Python exception is raised." msgstr "" -#: ../../library/ctypes.rst:1533 +#: ../../library/ctypes.rst:1529 msgid "Thus, this is only useful to call Python C api functions directly." msgstr "" -#: ../../library/ctypes.rst:1539 +#: ../../library/ctypes.rst:1535 msgid "" "All these classes can be instantiated by calling them with at least one " "argument, the pathname of the shared library. If you have an existing " @@ -2904,7 +2909,7 @@ msgid "" "the process, and to get a handle to it." msgstr "" -#: ../../library/ctypes.rst:1546 +#: ../../library/ctypes.rst:1542 msgid "" "The *mode* parameter can be used to specify how the library is loaded. For " "details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is " @@ -2912,35 +2917,33 @@ msgid "" "configurable." msgstr "" -#: ../../library/ctypes.rst:1551 +#: ../../library/ctypes.rst:1547 msgid "" "The *use_errno* parameter, when set to true, enables a ctypes mechanism that " -"allows accessing the system :data:`errno` error number in a safe " -"way. :mod:`ctypes` maintains a thread-local copy of the " -"system's :data:`errno` variable; if you call foreign functions created with " -"``use_errno=True`` then the :data:`errno` value before the function call is " -"swapped with the ctypes private copy, the same happens immediately after the " -"function call." +"allows accessing the system :data:`errno` error number in a safe way. :mod:" +"`ctypes` maintains a thread-local copy of the system's :data:`errno` " +"variable; if you call foreign functions created with ``use_errno=True`` then " +"the :data:`errno` value before the function call is swapped with the ctypes " +"private copy, the same happens immediately after the function call." msgstr "" -#: ../../library/ctypes.rst:1558 +#: ../../library/ctypes.rst:1554 msgid "" "The function :func:`ctypes.get_errno` returns the value of the ctypes " "private copy, and the function :func:`ctypes.set_errno` changes the ctypes " "private copy to a new value and returns the former value." msgstr "" -#: ../../library/ctypes.rst:1562 +#: ../../library/ctypes.rst:1558 msgid "" "The *use_last_error* parameter, when set to true, enables the same mechanism " -"for the Windows error code which is managed by the :func:`GetLastError` " -"and :func:`!SetLastError` Windows API " -"functions; :func:`ctypes.get_last_error` and :func:`ctypes.set_last_error` " -"are used to request and change the ctypes private copy of the windows error " -"code." +"for the Windows error code which is managed by the :func:`GetLastError` and :" +"func:`!SetLastError` Windows API functions; :func:`ctypes.get_last_error` " +"and :func:`ctypes.set_last_error` are used to request and change the ctypes " +"private copy of the windows error code." msgstr "" -#: ../../library/ctypes.rst:1568 +#: ../../library/ctypes.rst:1564 msgid "" "The *winmode* parameter is used on Windows to specify how the library is " "loaded (since *mode* is ignored). It takes any value that is valid for the " @@ -2950,29 +2953,29 @@ msgid "" "ensure the correct library and dependencies are loaded." msgstr "" -#: ../../library/ctypes.rst:1575 +#: ../../library/ctypes.rst:1571 msgid "Added *winmode* parameter." msgstr "新增 *winmode* 參數。" -#: ../../library/ctypes.rst:1582 +#: ../../library/ctypes.rst:1578 msgid "" "Flag to use as *mode* parameter. On platforms where this flag is not " "available, it is defined as the integer zero." msgstr "" -#: ../../library/ctypes.rst:1589 +#: ../../library/ctypes.rst:1585 msgid "" "Flag to use as *mode* parameter. On platforms where this is not available, " "it is the same as *RTLD_GLOBAL*." msgstr "" -#: ../../library/ctypes.rst:1596 +#: ../../library/ctypes.rst:1592 msgid "" "The default mode which is used to load shared libraries. On OSX 10.3, this " "is *RTLD_GLOBAL*, otherwise it is the same as *RTLD_LOCAL*." msgstr "" -#: ../../library/ctypes.rst:1599 +#: ../../library/ctypes.rst:1595 msgid "" "Instances of these classes have no public methods. Functions exported by " "the shared library can be accessed as attributes or by index. Please note " @@ -2981,7 +2984,7 @@ msgid "" "other hand, accessing it through an index returns a new object each time::" msgstr "" -#: ../../library/ctypes.rst:1605 +#: ../../library/ctypes.rst:1601 msgid "" ">>> from ctypes import CDLL\n" ">>> libc = CDLL(\"libc.so.6\") # On Linux\n" @@ -2997,21 +3000,21 @@ msgstr "" ">>> libc['time'] == libc['time']\n" "False" -#: ../../library/ctypes.rst:1612 +#: ../../library/ctypes.rst:1608 msgid "" "The following public attributes are available, their name starts with an " "underscore to not clash with exported function names:" msgstr "" -#: ../../library/ctypes.rst:1618 +#: ../../library/ctypes.rst:1614 msgid "The system handle used to access the library." msgstr "" -#: ../../library/ctypes.rst:1623 +#: ../../library/ctypes.rst:1619 msgid "The name of the library passed in the constructor." msgstr "" -#: ../../library/ctypes.rst:1625 +#: ../../library/ctypes.rst:1621 msgid "" "Shared libraries can also be loaded by using one of the prefabricated " "objects, which are instances of the :class:`LibraryLoader` class, either by " @@ -3019,13 +3022,13 @@ msgid "" "library as attribute of the loader instance." msgstr "" -#: ../../library/ctypes.rst:1633 +#: ../../library/ctypes.rst:1629 msgid "" -"Class which loads shared libraries. *dlltype* should be one of " -"the :class:`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." +"Class which loads shared libraries. *dlltype* should be one of the :class:" +"`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." msgstr "" -#: ../../library/ctypes.rst:1636 +#: ../../library/ctypes.rst:1632 msgid "" ":meth:`!__getattr__` has special behavior: It allows loading a shared " "library by accessing it as attribute of a library loader instance. The " @@ -3033,72 +3036,72 @@ msgid "" "each time." msgstr "" -#: ../../library/ctypes.rst:1642 +#: ../../library/ctypes.rst:1638 msgid "" "Load a shared library into the process and return it. This method always " "returns a new instance of the library." msgstr "" -#: ../../library/ctypes.rst:1646 +#: ../../library/ctypes.rst:1642 msgid "These prefabricated library loaders are available:" msgstr "" -#: ../../library/ctypes.rst:1651 +#: ../../library/ctypes.rst:1647 msgid "Creates :class:`CDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1657 +#: ../../library/ctypes.rst:1653 msgid "Creates :class:`WinDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1665 +#: ../../library/ctypes.rst:1661 msgid "Creates :class:`OleDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1673 +#: ../../library/ctypes.rst:1669 msgid "Creates :class:`PyDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1676 +#: ../../library/ctypes.rst:1672 msgid "" "For accessing the C Python api directly, a ready-to-use Python shared " "library object is available:" msgstr "" -#: ../../library/ctypes.rst:1682 +#: ../../library/ctypes.rst:1678 msgid "" "An instance of :class:`PyDLL` that exposes Python C API functions as " -"attributes. Note that all these functions are assumed to return " -"C :c:expr:`int`, which is of course not always the truth, so you have to " -"assign the correct :attr:`!restype` attribute to use these functions." +"attributes. Note that all these functions are assumed to return C :c:expr:" +"`int`, which is of course not always the truth, so you have to assign the " +"correct :attr:`!restype` attribute to use these functions." msgstr "" -#: ../../library/ctypes.rst:1687 ../../library/ctypes.rst:1689 +#: ../../library/ctypes.rst:1683 ../../library/ctypes.rst:1685 msgid "" "Loading a library through any of these objects raises an :ref:`auditing " "event ` ``ctypes.dlopen`` with string argument ``name``, the name " "used to load the library." msgstr "" -#: ../../library/ctypes.rst:1693 ../../library/ctypes.rst:1695 +#: ../../library/ctypes.rst:1689 ../../library/ctypes.rst:1691 msgid "" -"Accessing a function on a loaded library raises an auditing event " -"``ctypes.dlsym`` with arguments ``library`` (the library object) and " -"``name`` (the symbol's name as a string or integer)." +"Accessing a function on a loaded library raises an auditing event ``ctypes." +"dlsym`` with arguments ``library`` (the library object) and ``name`` (the " +"symbol's name as a string or integer)." msgstr "" -#: ../../library/ctypes.rst:1699 ../../library/ctypes.rst:1701 +#: ../../library/ctypes.rst:1695 ../../library/ctypes.rst:1697 msgid "" "In cases when only the library handle is available rather than the object, " "accessing a function raises an auditing event ``ctypes.dlsym/handle`` with " "arguments ``handle`` (the raw library handle) and ``name``." msgstr "" -#: ../../library/ctypes.rst:1708 +#: ../../library/ctypes.rst:1704 msgid "Foreign functions" msgstr "" -#: ../../library/ctypes.rst:1710 +#: ../../library/ctypes.rst:1706 msgid "" "As explained in the previous section, foreign functions can be accessed as " "attributes of loaded shared libraries. The function objects created in this " @@ -3107,13 +3110,13 @@ msgid "" "library loader." msgstr "" -#: ../../library/ctypes.rst:1715 +#: ../../library/ctypes.rst:1711 msgid "" "They are instances of a private local class :class:`!_FuncPtr` (not exposed " "in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class:" msgstr "" -#: ../../library/ctypes.rst:1718 +#: ../../library/ctypes.rst:1714 msgid "" ">>> import ctypes\n" ">>> lib = ctypes.CDLL(None)\n" @@ -3122,30 +3125,36 @@ msgid "" ">>> lib._FuncPtr is ctypes._CFuncPtr\n" "False" msgstr "" +">>> import ctypes\n" +">>> lib = ctypes.CDLL(None)\n" +">>> issubclass(lib._FuncPtr, ctypes._CFuncPtr)\n" +"True\n" +">>> lib._FuncPtr is ctypes._CFuncPtr\n" +"False" -#: ../../library/ctypes.rst:1729 +#: ../../library/ctypes.rst:1725 msgid "Base class for C callable foreign functions." msgstr "" -#: ../../library/ctypes.rst:1731 +#: ../../library/ctypes.rst:1727 msgid "" "Instances of foreign functions are also C compatible data types; they " "represent C function pointers." msgstr "" -#: ../../library/ctypes.rst:1734 +#: ../../library/ctypes.rst:1730 msgid "" "This behavior can be customized by assigning to special attributes of the " "foreign function object." msgstr "" -#: ../../library/ctypes.rst:1739 +#: ../../library/ctypes.rst:1735 msgid "" "Assign a ctypes type to specify the result type of the foreign function. Use " "``None`` for :c:expr:`void`, a function not returning anything." msgstr "" -#: ../../library/ctypes.rst:1742 +#: ../../library/ctypes.rst:1738 msgid "" "It is possible to assign a callable Python object that is not a ctypes type, " "in this case the function is assumed to return a C :c:expr:`int`, and the " @@ -3155,7 +3164,7 @@ msgid "" "callable to the :attr:`errcheck` attribute." msgstr "" -#: ../../library/ctypes.rst:1751 +#: ../../library/ctypes.rst:1747 msgid "" "Assign a tuple of ctypes types to specify the argument types that the " "function accepts. Functions using the ``stdcall`` calling convention can " @@ -3164,17 +3173,17 @@ msgid "" "unspecified arguments as well." msgstr "" -#: ../../library/ctypes.rst:1757 +#: ../../library/ctypes.rst:1753 msgid "" -"When a foreign function is called, each actual argument is passed to " -"the :meth:`~_CData.from_param` class method of the items in " -"the :attr:`argtypes` tuple, this method allows adapting the actual argument " -"to an object that the foreign function accepts. For example, " -"a :class:`c_char_p` item in the :attr:`argtypes` tuple will convert a string " -"passed as argument into a bytes object using ctypes conversion rules." +"When a foreign function is called, each actual argument is passed to the :" +"meth:`~_CData.from_param` class method of the items in the :attr:`argtypes` " +"tuple, this method allows adapting the actual argument to an object that the " +"foreign function accepts. For example, a :class:`c_char_p` item in the :" +"attr:`argtypes` tuple will convert a string passed as argument into a bytes " +"object using ctypes conversion rules." msgstr "" -#: ../../library/ctypes.rst:1764 +#: ../../library/ctypes.rst:1760 msgid "" "New: It is now possible to put items in argtypes which are not ctypes types, " "but each item must have a :meth:`~_CData.from_param` method which returns a " @@ -3182,58 +3191,58 @@ msgid "" "defining adapters that can adapt custom objects as function parameters." msgstr "" -#: ../../library/ctypes.rst:1771 +#: ../../library/ctypes.rst:1767 msgid "" "Assign a Python function or another callable to this attribute. The callable " "will be called with three or more arguments:" msgstr "" -#: ../../library/ctypes.rst:1778 +#: ../../library/ctypes.rst:1774 msgid "" "*result* is what the foreign function returns, as specified by the :attr:`!" "restype` attribute." msgstr "" -#: ../../library/ctypes.rst:1781 +#: ../../library/ctypes.rst:1777 msgid "" "*func* is the foreign function object itself, this allows reusing the same " "callable object to check or post process the results of several functions." msgstr "" -#: ../../library/ctypes.rst:1785 +#: ../../library/ctypes.rst:1781 msgid "" "*arguments* is a tuple containing the parameters originally passed to the " "function call, this allows specializing the behavior on the arguments used." msgstr "" -#: ../../library/ctypes.rst:1789 +#: ../../library/ctypes.rst:1785 msgid "" "The object that this function returns will be returned from the foreign " "function call, but it can also check the result value and raise an exception " "if the foreign function call failed." msgstr "" -#: ../../library/ctypes.rst:1794 ../../library/ctypes.rst:1796 +#: ../../library/ctypes.rst:1790 ../../library/ctypes.rst:1792 msgid "" "On Windows, when a foreign function call raises a system exception (for " "example, due to an access violation), it will be captured and replaced with " -"a suitable Python exception. Further, an auditing event " -"``ctypes.set_exception`` with argument ``code`` will be raised, allowing an " -"audit hook to replace the exception with its own." +"a suitable Python exception. Further, an auditing event ``ctypes." +"set_exception`` with argument ``code`` will be raised, allowing an audit " +"hook to replace the exception with its own." msgstr "" -#: ../../library/ctypes.rst:1802 ../../library/ctypes.rst:1804 +#: ../../library/ctypes.rst:1798 ../../library/ctypes.rst:1800 msgid "" "Some ways to invoke foreign function calls as well as some of the functions " "in this module may raise an auditing event ``ctypes.call_function`` with " "arguments ``function pointer`` and ``arguments``." msgstr "" -#: ../../library/ctypes.rst:1811 +#: ../../library/ctypes.rst:1807 msgid "Function prototypes" msgstr "" -#: ../../library/ctypes.rst:1813 +#: ../../library/ctypes.rst:1809 msgid "" "Foreign functions can also be created by instantiating function prototypes. " "Function prototypes are similar to function prototypes in C; they describe a " @@ -3244,47 +3253,46 @@ msgid "" "``@wrapper`` syntax. See :ref:`ctypes-callback-functions` for examples." msgstr "" -#: ../../library/ctypes.rst:1824 +#: ../../library/ctypes.rst:1820 msgid "" "The returned function prototype creates functions that use the standard C " "calling convention. The function will release the GIL during the call. If " -"*use_errno* is set to true, the ctypes private copy of the " -"system :data:`errno` variable is exchanged with the real :data:`errno` value " -"before and after the call; *use_last_error* does the same for the Windows " -"error code." +"*use_errno* is set to true, the ctypes private copy of the system :data:" +"`errno` variable is exchanged with the real :data:`errno` value before and " +"after the call; *use_last_error* does the same for the Windows error code." msgstr "" -#: ../../library/ctypes.rst:1834 +#: ../../library/ctypes.rst:1830 msgid "" "The returned function prototype creates functions that use the ``stdcall`` " "calling convention. The function will release the GIL during the call. " "*use_errno* and *use_last_error* have the same meaning as above." msgstr "" -#: ../../library/ctypes.rst:1844 +#: ../../library/ctypes.rst:1840 msgid "" "The returned function prototype creates functions that use the Python " "calling convention. The function will *not* release the GIL during the call." msgstr "" -#: ../../library/ctypes.rst:1847 +#: ../../library/ctypes.rst:1843 msgid "" "Function prototypes created by these factory functions can be instantiated " "in different ways, depending on the type and number of the parameters in the " "call:" msgstr "" -#: ../../library/ctypes.rst:1854 +#: ../../library/ctypes.rst:1850 msgid "" "Returns a foreign function at the specified address which must be an integer." msgstr "" -#: ../../library/ctypes.rst:1861 +#: ../../library/ctypes.rst:1857 msgid "" "Create a C callable function (a callback function) from a Python *callable*." msgstr "" -#: ../../library/ctypes.rst:1868 +#: ../../library/ctypes.rst:1864 msgid "" "Returns a foreign function exported by a shared library. *func_spec* must be " "a 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the " @@ -3292,7 +3300,7 @@ msgid "" "small integer. The second item is the shared library instance." msgstr "" -#: ../../library/ctypes.rst:1878 +#: ../../library/ctypes.rst:1874 msgid "" "Returns a foreign function that will call a COM method. *vtbl_index* is the " "index into the virtual function table, a small non-negative integer. *name* " @@ -3300,86 +3308,86 @@ msgid "" "identifier which is used in extended error reporting." msgstr "" -#: ../../library/ctypes.rst:1883 +#: ../../library/ctypes.rst:1879 msgid "" "If *iid* is not specified, an :exc:`OSError` is raised if the COM method " "call fails. If *iid* is specified, a :exc:`~ctypes.COMError` is raised " "instead." msgstr "" -#: ../../library/ctypes.rst:1887 +#: ../../library/ctypes.rst:1883 msgid "" "COM methods use a special calling convention: They require a pointer to the " "COM interface as first argument, in addition to those parameters that are " "specified in the :attr:`!argtypes` tuple." msgstr "" -#: ../../library/ctypes.rst:1894 +#: ../../library/ctypes.rst:1890 msgid "" "The optional *paramflags* parameter creates foreign function wrappers with " "much more functionality than the features described above." msgstr "" -#: ../../library/ctypes.rst:1897 +#: ../../library/ctypes.rst:1893 msgid "" -"*paramflags* must be a tuple of the same length " -"as :attr:`~_CFuncPtr.argtypes`." +"*paramflags* must be a tuple of the same length as :attr:`~_CFuncPtr." +"argtypes`." msgstr "" -#: ../../library/ctypes.rst:1899 +#: ../../library/ctypes.rst:1895 msgid "" "Each item in this tuple contains further information about a parameter, it " "must be a tuple containing one, two, or three items." msgstr "" -#: ../../library/ctypes.rst:1902 +#: ../../library/ctypes.rst:1898 msgid "" "The first item is an integer containing a combination of direction flags for " "the parameter:" msgstr "" -#: ../../library/ctypes.rst:1905 +#: ../../library/ctypes.rst:1901 msgid "1" msgstr "1" -#: ../../library/ctypes.rst:1906 +#: ../../library/ctypes.rst:1902 msgid "Specifies an input parameter to the function." msgstr "" -#: ../../library/ctypes.rst:1908 +#: ../../library/ctypes.rst:1904 msgid "2" msgstr "2" -#: ../../library/ctypes.rst:1909 +#: ../../library/ctypes.rst:1905 msgid "Output parameter. The foreign function fills in a value." msgstr "" -#: ../../library/ctypes.rst:1911 +#: ../../library/ctypes.rst:1907 msgid "4" msgstr "4" -#: ../../library/ctypes.rst:1912 +#: ../../library/ctypes.rst:1908 msgid "Input parameter which defaults to the integer zero." msgstr "" -#: ../../library/ctypes.rst:1914 +#: ../../library/ctypes.rst:1910 msgid "" "The optional second item is the parameter name as string. If this is " "specified, the foreign function can be called with named parameters." msgstr "" -#: ../../library/ctypes.rst:1917 +#: ../../library/ctypes.rst:1913 msgid "The optional third item is the default value for this parameter." msgstr "" -#: ../../library/ctypes.rst:1920 +#: ../../library/ctypes.rst:1916 msgid "" "The following example demonstrates how to wrap the Windows ``MessageBoxW`` " "function so that it supports default parameters and named arguments. The C " "declaration from the windows header file is this::" msgstr "" -#: ../../library/ctypes.rst:1924 +#: ../../library/ctypes.rst:1920 msgid "" "WINUSERAPI int WINAPI\n" "MessageBoxW(\n" @@ -3395,11 +3403,11 @@ msgstr "" " LPCWSTR lpCaption,\n" " UINT uType);" -#: ../../library/ctypes.rst:1931 ../../library/ctypes.rst:1954 +#: ../../library/ctypes.rst:1927 ../../library/ctypes.rst:1950 msgid "Here is the wrapping with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1933 +#: ../../library/ctypes.rst:1929 msgid "" ">>> from ctypes import c_int, WINFUNCTYPE, windll\n" ">>> from ctypes.wintypes import HWND, LPCWSTR, UINT\n" @@ -3415,11 +3423,11 @@ msgstr "" "\"Hello from ctypes\"), (1, \"flags\", 0)\n" ">>> MessageBox = prototype((\"MessageBoxW\", windll.user32), paramflags)" -#: ../../library/ctypes.rst:1939 +#: ../../library/ctypes.rst:1935 msgid "The ``MessageBox`` foreign function can now be called in these ways::" msgstr "" -#: ../../library/ctypes.rst:1941 +#: ../../library/ctypes.rst:1937 msgid "" ">>> MessageBox()\n" ">>> MessageBox(text=\"Spam, spam, spam\")\n" @@ -3429,7 +3437,7 @@ msgstr "" ">>> MessageBox(text=\"Spam, spam, spam\")\n" ">>> MessageBox(flags=2, text=\"foo bar\")" -#: ../../library/ctypes.rst:1945 +#: ../../library/ctypes.rst:1941 msgid "" "A second example demonstrates output parameters. The win32 " "``GetWindowRect`` function retrieves the dimensions of a specified window by " @@ -3437,7 +3445,7 @@ msgid "" "the C declaration::" msgstr "" -#: ../../library/ctypes.rst:1949 +#: ../../library/ctypes.rst:1945 msgid "" "WINUSERAPI BOOL WINAPI\n" "GetWindowRect(\n" @@ -3449,7 +3457,7 @@ msgstr "" " HWND hWnd,\n" " LPRECT lpRect);" -#: ../../library/ctypes.rst:1956 +#: ../../library/ctypes.rst:1952 msgid "" ">>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError\n" ">>> from ctypes.wintypes import BOOL, HWND, RECT\n" @@ -3467,7 +3475,7 @@ msgstr "" "paramflags)\n" ">>>" -#: ../../library/ctypes.rst:1963 +#: ../../library/ctypes.rst:1959 msgid "" "Functions with output parameters will automatically return the output " "parameter value if there is a single one, or a tuple containing the output " @@ -3475,7 +3483,7 @@ msgid "" "now returns a RECT instance, when called." msgstr "" -#: ../../library/ctypes.rst:1968 +#: ../../library/ctypes.rst:1964 msgid "" "Output parameters can be combined with the :attr:`~_CFuncPtr.errcheck` " "protocol to do further output processing and error checking. The win32 " @@ -3484,7 +3492,7 @@ msgid "" "exception when the api call failed::" msgstr "" -#: ../../library/ctypes.rst:1973 +#: ../../library/ctypes.rst:1969 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3502,7 +3510,7 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1981 +#: ../../library/ctypes.rst:1977 msgid "" "If the :attr:`~_CFuncPtr.errcheck` function returns the argument tuple it " "receives unchanged, :mod:`ctypes` continues the normal processing it does on " @@ -3511,7 +3519,7 @@ msgid "" "and return them instead, the normal processing will no longer take place::" msgstr "" -#: ../../library/ctypes.rst:1987 +#: ../../library/ctypes.rst:1983 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3531,64 +3539,64 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:2000 +#: ../../library/ctypes.rst:1996 msgid "Utility functions" msgstr "" -#: ../../library/ctypes.rst:2004 +#: ../../library/ctypes.rst:2000 msgid "" "Returns the address of the memory buffer as integer. *obj* must be an " "instance of a ctypes type." msgstr "" -#: ../../library/ctypes.rst:2007 +#: ../../library/ctypes.rst:2003 msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." msgstr "" -"引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` " -"``ctypes.addressof``。" +"引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` ``ctypes." +"addressof``。" -#: ../../library/ctypes.rst:2012 +#: ../../library/ctypes.rst:2008 msgid "" "Returns the alignment requirements of a ctypes type. *obj_or_type* must be a " "ctypes type or instance." msgstr "" -#: ../../library/ctypes.rst:2018 +#: ../../library/ctypes.rst:2014 msgid "" "Returns a light-weight pointer to *obj*, which must be an instance of a " "ctypes type. *offset* defaults to zero, and must be an integer that will be " "added to the internal pointer value." msgstr "" -#: ../../library/ctypes.rst:2022 +#: ../../library/ctypes.rst:2018 msgid "``byref(obj, offset)`` corresponds to this C code::" msgstr "" -#: ../../library/ctypes.rst:2024 +#: ../../library/ctypes.rst:2020 msgid "(((char *)&obj) + offset)" msgstr "(((char *)&obj) + offset)" -#: ../../library/ctypes.rst:2026 +#: ../../library/ctypes.rst:2022 msgid "" "The returned object can only be used as a foreign function call parameter. " "It behaves similar to ``pointer(obj)``, but the construction is a lot faster." msgstr "" -#: ../../library/ctypes.rst:2032 +#: ../../library/ctypes.rst:2028 msgid "" -"Copies a COM pointer from *src* to *dst* and returns the Windows " -"specific :c:type:`!HRESULT` value." +"Copies a COM pointer from *src* to *dst* and returns the Windows specific :c:" +"type:`!HRESULT` value." msgstr "" -#: ../../library/ctypes.rst:2035 +#: ../../library/ctypes.rst:2031 msgid "" "If *src* is not ``NULL``, its ``AddRef`` method is called, incrementing the " "reference count." msgstr "" -#: ../../library/ctypes.rst:2038 +#: ../../library/ctypes.rst:2034 msgid "" "In contrast, the reference count of *dst* will not be decremented before " "assigning the new value. Unless *dst* is ``NULL``, the caller is responsible " @@ -3596,7 +3604,7 @@ msgid "" "necessary." msgstr "" -#: ../../library/ctypes.rst:2050 +#: ../../library/ctypes.rst:2046 msgid "" "This function is similar to the cast operator in C. It returns a new " "instance of *type* which points to the same memory block as *obj*. *type* " @@ -3604,47 +3612,47 @@ msgid "" "as a pointer." msgstr "" -#: ../../library/ctypes.rst:2059 +#: ../../library/ctypes.rst:2055 msgid "" "This function creates a mutable character buffer. The returned object is a " "ctypes array of :class:`c_char`." msgstr "" -#: ../../library/ctypes.rst:2062 +#: ../../library/ctypes.rst:2058 msgid "" "If *size* is given (and not ``None``), it must be an :class:`int`. It " "specifies the size of the returned array." msgstr "" -#: ../../library/ctypes.rst:2065 +#: ../../library/ctypes.rst:2061 msgid "" "If the *init* argument is given, it must be :class:`bytes`. It is used to " "initialize the array items. Bytes not initialized this way are set to zero " "(NUL)." msgstr "" -#: ../../library/ctypes.rst:2069 +#: ../../library/ctypes.rst:2065 msgid "" "If *size* is not given (or if it is ``None``), the buffer is made one " "element larger than *init*, effectively adding a NUL terminator." msgstr "" -#: ../../library/ctypes.rst:2072 +#: ../../library/ctypes.rst:2068 msgid "" "If both arguments are given, *size* must not be less than ``len(init)``." -msgstr "" +msgstr "如果兩個引數皆有提供,*size* 不得小於 ``len(init)``。" -#: ../../library/ctypes.rst:2076 +#: ../../library/ctypes.rst:2072 msgid "" "If *size* is equal to ``len(init)``, a NUL terminator is not added. Do not " "treat such a buffer as a C string." msgstr "" -#: ../../library/ctypes.rst:2079 +#: ../../library/ctypes.rst:2075 msgid "For example::" -msgstr "" +msgstr "舉例來說: ::" -#: ../../library/ctypes.rst:2081 +#: ../../library/ctypes.rst:2077 msgid "" ">>> bytes(create_string_buffer(2))\n" "b'\\x00\\x00'\n" @@ -3659,8 +3667,20 @@ msgid "" " ...\n" "ValueError: byte string too long" msgstr "" +">>> bytes(create_string_buffer(2))\n" +"b'\\x00\\x00'\n" +">>> bytes(create_string_buffer(b'ab'))\n" +"b'ab\\x00'\n" +">>> bytes(create_string_buffer(b'ab', 2))\n" +"b'ab'\n" +">>> bytes(create_string_buffer(b'ab', 4))\n" +"b'ab\\x00\\x00'\n" +">>> bytes(create_string_buffer(b'abcdef', 2))\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: byte string too long" -#: ../../library/ctypes.rst:2094 +#: ../../library/ctypes.rst:2090 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` " "with arguments ``init``, ``size``." @@ -3668,19 +3688,19 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_string_buffer``。" -#: ../../library/ctypes.rst:2100 +#: ../../library/ctypes.rst:2096 msgid "" "This function creates a mutable unicode character buffer. The returned " "object is a ctypes array of :class:`c_wchar`." msgstr "" -#: ../../library/ctypes.rst:2103 +#: ../../library/ctypes.rst:2099 msgid "" "The function takes the same arguments as :func:`~create_string_buffer` " "except *init* must be a string and *size* counts :class:`c_wchar`." msgstr "" -#: ../../library/ctypes.rst:2106 +#: ../../library/ctypes.rst:2102 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` " "with arguments ``init``, ``size``." @@ -3688,21 +3708,21 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_unicode_buffer``。" -#: ../../library/ctypes.rst:2111 +#: ../../library/ctypes.rst:2107 msgid "" "This function is a hook which allows implementing in-process COM servers " "with ctypes. It is called from the DllCanUnloadNow function that the " "_ctypes extension dll exports." msgstr "" -#: ../../library/ctypes.rst:2120 +#: ../../library/ctypes.rst:2116 msgid "" "This function is a hook which allows implementing in-process COM servers " "with ctypes. It is called from the DllGetClassObject function that the " "``_ctypes`` extension dll exports." msgstr "" -#: ../../library/ctypes.rst:2130 +#: ../../library/ctypes.rst:2126 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version " @@ -3710,21 +3730,21 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:2141 +#: ../../library/ctypes.rst:2137 msgid "" "Returns the filename of the VC runtime library used by Python, and by the " "extension modules. If the name of the library cannot be determined, " "``None`` is returned." msgstr "" -#: ../../library/ctypes.rst:2145 +#: ../../library/ctypes.rst:2141 msgid "" "If you need to free memory, for example, allocated by an extension module " "with a call to the ``free(void *)``, it is important that you use the " "function in the same library that allocated the memory." msgstr "" -#: ../../library/ctypes.rst:2155 +#: ../../library/ctypes.rst:2151 msgid "" "Try to provide a list of paths of the shared libraries loaded into the " "current process. These paths are not normalized or processed in any way. " @@ -3732,74 +3752,74 @@ msgid "" "The exact functionality is system dependent." msgstr "" -#: ../../library/ctypes.rst:2160 +#: ../../library/ctypes.rst:2156 msgid "" "On most platforms, the first element of the list represents the current " "executable file. It may be an empty string." msgstr "" -#: ../../library/ctypes.rst:2168 +#: ../../library/ctypes.rst:2164 msgid "" "Returns a textual description of the error code *code*. If no error code is " -"specified, the last error code is used by calling the Windows API " -"function :func:`GetLastError`." +"specified, the last error code is used by calling the Windows API function :" +"func:`GetLastError`." msgstr "" -#: ../../library/ctypes.rst:2177 +#: ../../library/ctypes.rst:2173 msgid "" "Returns the last error code set by Windows in the calling thread. This " "function calls the Windows ``GetLastError()`` function directly, it does not " "return the ctypes-private copy of the error code." msgstr "" -#: ../../library/ctypes.rst:2186 +#: ../../library/ctypes.rst:2182 msgid "" -"Returns the current value of the ctypes-private copy of the " -"system :data:`errno` variable in the calling thread." +"Returns the current value of the ctypes-private copy of the system :data:" +"`errno` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2189 +#: ../../library/ctypes.rst:2185 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_errno``。" -#: ../../library/ctypes.rst:2193 +#: ../../library/ctypes.rst:2189 msgid "" "Returns the current value of the ctypes-private copy of the system :data:`!" "LastError` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2198 +#: ../../library/ctypes.rst:2194 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_last_error``。" -#: ../../library/ctypes.rst:2203 +#: ../../library/ctypes.rst:2199 msgid "" "Same as the standard C memmove library function: copies *count* bytes from " "*src* to *dst*. *dst* and *src* must be integers or ctypes instances that " "can be converted to pointers." msgstr "" -#: ../../library/ctypes.rst:2210 +#: ../../library/ctypes.rst:2206 msgid "" "Same as the standard C memset library function: fills the memory block at " "address *dst* with *count* bytes of value *c*. *dst* must be an integer " "specifying an address, or a ctypes instance." msgstr "" -#: ../../library/ctypes.rst:2217 +#: ../../library/ctypes.rst:2213 msgid "" "Create or return a ctypes pointer type. Pointer types are cached and reused " "internally, so calling this function repeatedly is cheap. *type* must be a " "ctypes type." msgstr "" -#: ../../library/ctypes.rst:2223 +#: ../../library/ctypes.rst:2219 msgid "" "The resulting pointer type is cached in the ``__pointer_type__`` attribute " "of *type*. It is possible to set this attribute before the first call to " @@ -3808,19 +3828,19 @@ msgid "" "relying on implementation details that may change in future Python versions." msgstr "" -#: ../../library/ctypes.rst:2234 +#: ../../library/ctypes.rst:2230 msgid "" "Create a new pointer instance, pointing to *obj*. The returned object is of " "the type ``POINTER(type(obj))``." msgstr "" -#: ../../library/ctypes.rst:2237 +#: ../../library/ctypes.rst:2233 msgid "" "Note: If you just want to pass a pointer to an object to a foreign function " "call, you should use ``byref(obj)`` which is much faster." msgstr "" -#: ../../library/ctypes.rst:2243 +#: ../../library/ctypes.rst:2239 msgid "" "This function resizes the internal memory buffer of *obj*, which must be an " "instance of a ctypes type. It is not possible to make the buffer smaller " @@ -3828,145 +3848,145 @@ msgid "" "but it is possible to enlarge the buffer." msgstr "" -#: ../../library/ctypes.rst:2251 +#: ../../library/ctypes.rst:2247 msgid "" "Set the current value of the ctypes-private copy of the system :data:`errno` " "variable in the calling thread to *value* and return the previous value." msgstr "" -#: ../../library/ctypes.rst:2254 +#: ../../library/ctypes.rst:2250 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." msgstr "" -"引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` " -"``ctypes.set_errno``。" +"引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` ``ctypes." +"set_errno``。" -#: ../../library/ctypes.rst:2259 +#: ../../library/ctypes.rst:2255 msgid "" "Sets the current value of the ctypes-private copy of the system :data:`!" "LastError` variable in the calling thread to *value* and return the previous " "value." msgstr "" -#: ../../library/ctypes.rst:2265 +#: ../../library/ctypes.rst:2261 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." msgstr "" -"引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` " -"``ctypes.set_last_error``。" +"引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` ``ctypes." +"set_last_error``。" -#: ../../library/ctypes.rst:2270 +#: ../../library/ctypes.rst:2266 msgid "" "Returns the size in bytes of a ctypes type or instance memory buffer. Does " "the same as the C ``sizeof`` operator." msgstr "" -#: ../../library/ctypes.rst:2276 +#: ../../library/ctypes.rst:2272 msgid "" "Return the byte string at *void \\*ptr*. If *size* is specified, it is used " "as size, otherwise the string is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2280 +#: ../../library/ctypes.rst:2276 msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " "arguments ``ptr``, ``size``." msgstr "" -"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` " -"``ctypes.string_at``。" +"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." +"string_at``。" -#: ../../library/ctypes.rst:2285 +#: ../../library/ctypes.rst:2281 msgid "" -"Creates an instance of :exc:`OSError`. If *code* is not " -"specified, :func:`GetLastError` is called to determine the error code. If " -"*descr* is not specified, :func:`FormatError` is called to get a textual " -"description of the error." +"Creates an instance of :exc:`OSError`. If *code* is not specified, :func:" +"`GetLastError` is called to determine the error code. If *descr* is not " +"specified, :func:`FormatError` is called to get a textual description of the " +"error." msgstr "" -#: ../../library/ctypes.rst:2292 +#: ../../library/ctypes.rst:2288 msgid "" "An instance of :exc:`WindowsError` used to be created, which is now an alias " "of :exc:`OSError`." msgstr "" -#: ../../library/ctypes.rst:2299 +#: ../../library/ctypes.rst:2295 msgid "" "Return the wide-character string at *void \\*ptr*. If *size* is specified, " "it is used as the number of characters of the string, otherwise the string " "is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2304 +#: ../../library/ctypes.rst:2300 msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " "arguments ``ptr``, ``size``." msgstr "" -"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` " -"``ctypes.wstring_at``。" +"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." +"wstring_at``。" -#: ../../library/ctypes.rst:2309 +#: ../../library/ctypes.rst:2305 msgid "" "Return a :class:`memoryview` object of length *size* that references memory " "starting at *void \\*ptr*." msgstr "" -#: ../../library/ctypes.rst:2312 +#: ../../library/ctypes.rst:2308 msgid "" "If *readonly* is true, the returned :class:`!memoryview` object can not be " "used to modify the underlying memory. (Changes made by other means will " "still be reflected in the returned object.)" msgstr "" -#: ../../library/ctypes.rst:2317 +#: ../../library/ctypes.rst:2313 msgid "" "This function is similar to :func:`string_at` with the key difference of not " "making a copy of the specified memory. It is a semantically equivalent (but " -"more efficient) alternative to ``memoryview((c_byte * " -"size).from_address(ptr))``. (While :meth:`~_CData.from_address` only takes " -"integers, *ptr* can also be given as a :class:`ctypes.POINTER` or " -"a :func:`~ctypes.byref` object.)" +"more efficient) alternative to ``memoryview((c_byte * size)." +"from_address(ptr))``. (While :meth:`~_CData.from_address` only takes " +"integers, *ptr* can also be given as a :class:`ctypes.POINTER` or a :func:" +"`~ctypes.byref` object.)" msgstr "" -#: ../../library/ctypes.rst:2324 +#: ../../library/ctypes.rst:2320 msgid "" "Raises an :ref:`auditing event ` ``ctypes.memoryview_at`` with " "arguments ``address``, ``size``, ``readonly``." msgstr "" -"引發一個附帶引數 ``address``、``size`` 與 ``readonly`` 的\\ :ref:`稽核事件 ` " -"``ctypes.memoryview_at``。" +"引發一個附帶引數 ``address``、``size`` 與 ``readonly`` 的\\ :ref:`稽核事件 " +"` ``ctypes.memoryview_at``。" -#: ../../library/ctypes.rst:2332 +#: ../../library/ctypes.rst:2328 msgid "Data types" msgstr "" -#: ../../library/ctypes.rst:2337 +#: ../../library/ctypes.rst:2333 msgid "" "This non-public class is the common base class of all ctypes data types. " "Among other things, all ctypes type instances contain a memory block that " -"hold C compatible data; the address of the memory block is returned by " -"the :func:`addressof` helper function. Another instance variable is exposed " -"as :attr:`_objects`; this contains other Python objects that need to be kept " +"hold C compatible data; the address of the memory block is returned by the :" +"func:`addressof` helper function. Another instance variable is exposed as :" +"attr:`_objects`; this contains other Python objects that need to be kept " "alive in case the memory block contains pointers." msgstr "" -#: ../../library/ctypes.rst:2344 +#: ../../library/ctypes.rst:2340 msgid "" "Common methods of ctypes data types, these are all class methods (to be " "exact, they are methods of the :term:`metaclass`):" msgstr "" -#: ../../library/ctypes.rst:2349 +#: ../../library/ctypes.rst:2345 msgid "" "This method returns a ctypes instance that shares the buffer of the *source* " "object. The *source* object must support the writeable buffer interface. " "The optional *offset* parameter specifies an offset into the source buffer " -"in bytes; the default is zero. If the source buffer is not large enough " -"a :exc:`ValueError` is raised." +"in bytes; the default is zero. If the source buffer is not large enough a :" +"exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2355 ../../library/ctypes.rst:2365 +#: ../../library/ctypes.rst:2351 ../../library/ctypes.rst:2361 msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with " "arguments ``pointer``, ``size``, ``offset``." @@ -3974,7 +3994,7 @@ msgstr "" "引發一個附帶引數 ``pointer``、``size``、``offset`` 的\\ :ref:`稽核事件 " "` ``ctypes.cdata/buffer``。" -#: ../../library/ctypes.rst:2359 +#: ../../library/ctypes.rst:2355 msgid "" "This method creates a ctypes instance, copying the buffer from the *source* " "object buffer which must be readable. The optional *offset* parameter " @@ -3982,20 +4002,19 @@ msgid "" "If the source buffer is not large enough a :exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2369 +#: ../../library/ctypes.rst:2365 msgid "" "This method returns a ctypes type instance using the memory specified by " "*address* which must be an integer." msgstr "" -#: ../../library/ctypes.rst:2372 ../../library/ctypes.rst:2374 +#: ../../library/ctypes.rst:2368 ../../library/ctypes.rst:2370 msgid "" -"This method, and others that indirectly call this method, raises " -"an :ref:`auditing event ` ``ctypes.cdata`` with argument " -"``address``." +"This method, and others that indirectly call this method, raises an :ref:" +"`auditing event ` ``ctypes.cdata`` with argument ``address``." msgstr "" -#: ../../library/ctypes.rst:2380 +#: ../../library/ctypes.rst:2376 msgid "" "This method adapts *obj* to a ctypes type. It is called with the actual " "object used in a foreign function call when the type is present in the " @@ -4003,50 +4022,50 @@ msgid "" "object that can be used as a function call parameter." msgstr "" -#: ../../library/ctypes.rst:2385 +#: ../../library/ctypes.rst:2381 msgid "" "All ctypes data types have a default implementation of this classmethod that " "normally returns *obj* if that is an instance of the type. Some types " "accept other objects as well." msgstr "" -#: ../../library/ctypes.rst:2391 +#: ../../library/ctypes.rst:2387 msgid "" "This method returns a ctypes type instance exported by a shared library. " "*name* is the name of the symbol that exports the data, *library* is the " "loaded shared library." msgstr "" -#: ../../library/ctypes.rst:2395 +#: ../../library/ctypes.rst:2391 msgid "Common class variables of ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2399 +#: ../../library/ctypes.rst:2395 msgid "" "The pointer type that was created by calling :func:`POINTER` for " "corresponding ctypes data type. If a pointer type was not yet created, the " "attribute is missing." msgstr "" -#: ../../library/ctypes.rst:2405 +#: ../../library/ctypes.rst:2401 msgid "Common instance variables of ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2409 +#: ../../library/ctypes.rst:2405 msgid "" "Sometimes ctypes data instances do not own the memory block they contain, " -"instead they share part of the memory block of a base object. " -"The :attr:`_b_base_` read-only member is the root ctypes object that owns " -"the memory block." +"instead they share part of the memory block of a base object. The :attr:" +"`_b_base_` read-only member is the root ctypes object that owns the memory " +"block." msgstr "" -#: ../../library/ctypes.rst:2416 +#: ../../library/ctypes.rst:2412 msgid "" "This read-only variable is true when the ctypes data instance has allocated " "the memory block itself, false otherwise." msgstr "" -#: ../../library/ctypes.rst:2421 +#: ../../library/ctypes.rst:2417 msgid "" "This member is either ``None`` or a dictionary containing Python objects " "that need to be kept alive so that the memory block contents is kept valid. " @@ -4054,20 +4073,20 @@ msgid "" "dictionary." msgstr "" -#: ../../library/ctypes.rst:2434 +#: ../../library/ctypes.rst:2430 msgid "" "This non-public class is the base class of all fundamental ctypes data " "types. It is mentioned here because it contains the common attributes of the " -"fundamental ctypes data types. :class:`_SimpleCData` is a subclass " -"of :class:`_CData`, so it inherits their methods and attributes. ctypes data " +"fundamental ctypes data types. :class:`_SimpleCData` is a subclass of :" +"class:`_CData`, so it inherits their methods and attributes. ctypes data " "types that are not and do not contain pointers can now be pickled." msgstr "" -#: ../../library/ctypes.rst:2440 +#: ../../library/ctypes.rst:2436 msgid "Instances have a single attribute:" msgstr "" -#: ../../library/ctypes.rst:2444 +#: ../../library/ctypes.rst:2440 msgid "" "This attribute contains the actual value of the instance. For integer and " "pointer types, it is an integer, for character types, it is a single " @@ -4075,7 +4094,7 @@ msgid "" "bytes object or string." msgstr "" -#: ../../library/ctypes.rst:2449 +#: ../../library/ctypes.rst:2445 msgid "" "When the ``value`` attribute is retrieved from a ctypes instance, usually a " "new object is returned each time. :mod:`ctypes` does *not* implement " @@ -4083,7 +4102,7 @@ msgid "" "true for all other ctypes object instances." msgstr "" -#: ../../library/ctypes.rst:2455 +#: ../../library/ctypes.rst:2451 msgid "" "Fundamental data types, when returned as foreign function call results, or, " "for example, by retrieving structure field members or array items, are " @@ -4093,7 +4112,7 @@ msgid "" "instance." msgstr "" -#: ../../library/ctypes.rst:2463 +#: ../../library/ctypes.rst:2459 msgid "" "Subclasses of fundamental data types do *not* inherit this behavior. So, if " "a foreign functions :attr:`!restype` is a subclass of :class:`c_void_p`, you " @@ -4101,25 +4120,25 @@ msgid "" "you can get the value of the pointer by accessing the ``value`` attribute." msgstr "" -#: ../../library/ctypes.rst:2468 +#: ../../library/ctypes.rst:2464 msgid "These are the fundamental ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2472 +#: ../../library/ctypes.rst:2468 msgid "" "Represents the C :c:expr:`signed char` datatype, and interprets the value as " "small integer. The constructor accepts an optional integer initializer; no " "overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2479 +#: ../../library/ctypes.rst:2475 msgid "" "Represents the C :c:expr:`char` datatype, and interprets the value as a " "single character. The constructor accepts an optional string initializer, " "the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2486 +#: ../../library/ctypes.rst:2482 msgid "" "Represents the C :c:expr:`char *` datatype when it points to a zero-" "terminated string. For a general character pointer that may also point to " @@ -4127,287 +4146,287 @@ msgid "" "integer address, or a bytes object." msgstr "" -#: ../../library/ctypes.rst:2494 +#: ../../library/ctypes.rst:2490 msgid "" "Represents the C :c:expr:`double` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2500 +#: ../../library/ctypes.rst:2496 msgid "" "Represents the C :c:expr:`long double` datatype. The constructor accepts an " "optional float initializer. On platforms where ``sizeof(long double) == " "sizeof(double)`` it is an alias to :class:`c_double`." msgstr "" -#: ../../library/ctypes.rst:2506 +#: ../../library/ctypes.rst:2502 msgid "" "Represents the C :c:expr:`float` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2512 +#: ../../library/ctypes.rst:2508 msgid "" "Represents the C :c:expr:`double complex` datatype, if available. The " "constructor accepts an optional :class:`complex` initializer." msgstr "" -#: ../../library/ctypes.rst:2520 +#: ../../library/ctypes.rst:2516 msgid "" "Represents the C :c:expr:`float complex` datatype, if available. The " "constructor accepts an optional :class:`complex` initializer." msgstr "" -#: ../../library/ctypes.rst:2528 +#: ../../library/ctypes.rst:2524 msgid "" "Represents the C :c:expr:`long double complex` datatype, if available. The " "constructor accepts an optional :class:`complex` initializer." msgstr "" -#: ../../library/ctypes.rst:2536 +#: ../../library/ctypes.rst:2532 msgid "" "Represents the C :c:expr:`signed int` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`." msgstr "" -#: ../../library/ctypes.rst:2543 +#: ../../library/ctypes.rst:2539 msgid "" -"Represents the C 8-bit :c:expr:`signed int` datatype. It is an alias " -"for :class:`c_byte`." +"Represents the C 8-bit :c:expr:`signed int` datatype. It is an alias for :" +"class:`c_byte`." msgstr "" -#: ../../library/ctypes.rst:2549 +#: ../../library/ctypes.rst:2545 msgid "" "Represents the C 16-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_short`." msgstr "" -#: ../../library/ctypes.rst:2555 +#: ../../library/ctypes.rst:2551 msgid "" "Represents the C 32-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_int`." msgstr "" -#: ../../library/ctypes.rst:2561 +#: ../../library/ctypes.rst:2557 msgid "" "Represents the C 64-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_longlong`." msgstr "" -#: ../../library/ctypes.rst:2567 +#: ../../library/ctypes.rst:2563 msgid "" "Represents the C :c:expr:`signed long` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2573 +#: ../../library/ctypes.rst:2569 msgid "" "Represents the C :c:expr:`signed long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2579 +#: ../../library/ctypes.rst:2575 msgid "" "Represents the C :c:expr:`signed short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2585 +#: ../../library/ctypes.rst:2581 msgid "Represents the C :c:type:`size_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2590 +#: ../../library/ctypes.rst:2586 msgid "Represents the C :c:type:`ssize_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2597 +#: ../../library/ctypes.rst:2593 msgid "Represents the C :c:type:`time_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2604 +#: ../../library/ctypes.rst:2600 msgid "" "Represents the C :c:expr:`unsigned char` datatype, it interprets the value " "as small integer. The constructor accepts an optional integer initializer; " "no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2611 +#: ../../library/ctypes.rst:2607 msgid "" "Represents the C :c:expr:`unsigned int` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`." msgstr "" -#: ../../library/ctypes.rst:2618 +#: ../../library/ctypes.rst:2614 msgid "" -"Represents the C 8-bit :c:expr:`unsigned int` datatype. It is an alias " -"for :class:`c_ubyte`." +"Represents the C 8-bit :c:expr:`unsigned int` datatype. It is an alias for :" +"class:`c_ubyte`." msgstr "" -#: ../../library/ctypes.rst:2624 +#: ../../library/ctypes.rst:2620 msgid "" "Represents the C 16-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ushort`." msgstr "" -#: ../../library/ctypes.rst:2630 +#: ../../library/ctypes.rst:2626 msgid "" "Represents the C 32-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_uint`." msgstr "" -#: ../../library/ctypes.rst:2636 +#: ../../library/ctypes.rst:2632 msgid "" "Represents the C 64-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ulonglong`." msgstr "" -#: ../../library/ctypes.rst:2642 +#: ../../library/ctypes.rst:2638 msgid "" "Represents the C :c:expr:`unsigned long` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2648 +#: ../../library/ctypes.rst:2644 msgid "" "Represents the C :c:expr:`unsigned long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2654 +#: ../../library/ctypes.rst:2650 msgid "" "Represents the C :c:expr:`unsigned short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2660 +#: ../../library/ctypes.rst:2656 msgid "" "Represents the C :c:expr:`void *` type. The value is represented as " "integer. The constructor accepts an optional integer initializer." msgstr "" -#: ../../library/ctypes.rst:2666 +#: ../../library/ctypes.rst:2662 msgid "" "Represents the C :c:type:`wchar_t` datatype, and interprets the value as a " "single character unicode string. The constructor accepts an optional string " "initializer, the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2673 +#: ../../library/ctypes.rst:2669 msgid "" "Represents the C :c:expr:`wchar_t *` datatype, which must be a pointer to a " "zero-terminated wide character string. The constructor accepts an integer " "address, or a string." msgstr "" -#: ../../library/ctypes.rst:2680 +#: ../../library/ctypes.rst:2676 msgid "" "Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` " "from C99). Its value can be ``True`` or ``False``, and the constructor " "accepts any object that has a truth value." msgstr "" -#: ../../library/ctypes.rst:2687 +#: ../../library/ctypes.rst:2683 msgid "" "Represents a :c:type:`!HRESULT` value, which contains success or error " "information for a function or method call." msgstr "" -#: ../../library/ctypes.rst:2695 +#: ../../library/ctypes.rst:2691 msgid "" "Represents the C :c:expr:`PyObject *` datatype. Calling this without an " "argument creates a ``NULL`` :c:expr:`PyObject *` pointer." msgstr "" -#: ../../library/ctypes.rst:2698 +#: ../../library/ctypes.rst:2694 msgid ":class:`!py_object` is now a :term:`generic type`." msgstr "" -#: ../../library/ctypes.rst:2701 +#: ../../library/ctypes.rst:2697 msgid "" "The :mod:`!ctypes.wintypes` module provides quite some other Windows " -"specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, " -"or :c:type:`!DWORD`. Some useful structures like :c:type:`!MSG` or :c:type:`!" -"RECT` are also defined." +"specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:" +"type:`!DWORD`. Some useful structures like :c:type:`!MSG` or :c:type:`!RECT` " +"are also defined." msgstr "" -#: ../../library/ctypes.rst:2709 +#: ../../library/ctypes.rst:2705 msgid "Structured data types" msgstr "" -#: ../../library/ctypes.rst:2714 +#: ../../library/ctypes.rst:2710 msgid "Abstract base class for unions in native byte order." msgstr "" -#: ../../library/ctypes.rst:2716 +#: ../../library/ctypes.rst:2712 msgid "" -"Unions share common attributes and behavior with structures; " -"see :class:`Structure` documentation for details." +"Unions share common attributes and behavior with structures; see :class:" +"`Structure` documentation for details." msgstr "" -#: ../../library/ctypes.rst:2721 +#: ../../library/ctypes.rst:2717 msgid "Abstract base class for unions in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2727 +#: ../../library/ctypes.rst:2723 msgid "Abstract base class for unions in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2733 +#: ../../library/ctypes.rst:2729 msgid "Abstract base class for structures in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2738 +#: ../../library/ctypes.rst:2734 msgid "Abstract base class for structures in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2740 +#: ../../library/ctypes.rst:2736 msgid "" "Structures and unions with non-native byte order cannot contain pointer type " "fields, or any other data types containing pointer type fields." msgstr "" -#: ../../library/ctypes.rst:2746 +#: ../../library/ctypes.rst:2742 msgid "Abstract base class for structures in *native* byte order." msgstr "" -#: ../../library/ctypes.rst:2748 +#: ../../library/ctypes.rst:2744 msgid "" "Concrete structure and union types must be created by subclassing one of " -"these types, and at least define a :attr:`_fields_` class " -"variable. :mod:`ctypes` will create :term:`descriptor`\\s which allow " -"reading and writing the fields by direct attribute accesses. These are the" +"these types, and at least define a :attr:`_fields_` class variable. :mod:" +"`ctypes` will create :term:`descriptor`\\s which allow reading and writing " +"the fields by direct attribute accesses. These are the" msgstr "" -#: ../../library/ctypes.rst:2756 +#: ../../library/ctypes.rst:2752 msgid "" "A sequence defining the structure fields. The items must be 2-tuples or 3-" "tuples. The first item is the name of the field, the second item specifies " "the type of the field; it can be any ctypes data type." msgstr "" -#: ../../library/ctypes.rst:2760 +#: ../../library/ctypes.rst:2756 msgid "" "For integer type fields like :class:`c_int`, a third optional item can be " "given. It must be a small positive integer defining the bit width of the " "field." msgstr "" -#: ../../library/ctypes.rst:2764 +#: ../../library/ctypes.rst:2760 msgid "" "Field names must be unique within one structure or union. This is not " "checked, only one field can be accessed when names are repeated." msgstr "" -#: ../../library/ctypes.rst:2767 +#: ../../library/ctypes.rst:2763 msgid "" "It is possible to define the :attr:`_fields_` class variable *after* the " "class statement that defines the Structure subclass, this allows creating " "data types that directly or indirectly reference themselves::" msgstr "" -#: ../../library/ctypes.rst:2771 +#: ../../library/ctypes.rst:2767 msgid "" "class List(Structure):\n" " pass\n" @@ -4421,41 +4440,55 @@ msgstr "" " ...\n" " ]" -#: ../../library/ctypes.rst:2777 +#: ../../library/ctypes.rst:2773 msgid "" "The :attr:`!_fields_` class variable can only be set once. Later assignments " "will raise an :exc:`AttributeError`." msgstr "" -#: ../../library/ctypes.rst:2780 +#: ../../library/ctypes.rst:2776 msgid "" "Additionally, the :attr:`!_fields_` class variable must be defined before " "the structure or union type is first used: an instance or subclass is " -"created, :func:`sizeof` is called on it, and so on. Later assignments " -"to :attr:`!_fields_` will raise an :exc:`AttributeError`. If :attr:`!" -"_fields_` has not been set before such use, the structure or union will have " -"no own fields, as if :attr:`!_fields_` was empty." +"created, :func:`sizeof` is called on it, and so on. Later assignments to :" +"attr:`!_fields_` will raise an :exc:`AttributeError`. If :attr:`!_fields_` " +"has not been set before such use, the structure or union will have no own " +"fields, as if :attr:`!_fields_` was empty." msgstr "" -#: ../../library/ctypes.rst:2788 +#: ../../library/ctypes.rst:2784 msgid "" "Sub-subclasses of structure types inherit the fields of the base class plus " "the :attr:`_fields_` defined in the sub-subclass, if any." msgstr "" -#: ../../library/ctypes.rst:2794 +#: ../../library/ctypes.rst:2790 msgid "" "An optional small integer that allows overriding the alignment of structure " -"fields in the instance. :attr:`_pack_` must already be defined " -"when :attr:`_fields_` is assigned, otherwise it will have no effect. Setting " -"this attribute to 0 is the same as not setting it at all." +"fields in the instance." msgstr "" -#: ../../library/ctypes.rst:2799 -msgid "This is only implemented for the MSVC-compatible memory layout." +#: ../../library/ctypes.rst:2793 +msgid "" +"This is only implemented for the MSVC-compatible memory layout (see :attr:" +"`_layout_`)." msgstr "" -#: ../../library/ctypes.rst:2803 +#: ../../library/ctypes.rst:2796 +msgid "" +"Setting :attr:`!_pack_` to 0 is the same as not setting it at all. " +"Otherwise, the value must be a positive power of two. The effect is " +"equivalent to ``#pragma pack(N)`` in C, except :mod:`ctypes` may allow " +"larger *n* than what the compiler accepts." +msgstr "" + +#: ../../library/ctypes.rst:2801 +msgid "" +":attr:`!_pack_` must already be defined when :attr:`_fields_` is assigned, " +"otherwise it will have no effect." +msgstr "" + +#: ../../library/ctypes.rst:2806 msgid "" "For historical reasons, if :attr:`!_pack_` is non-zero, the MSVC-compatible " "layout will be used by default. On non-Windows platforms, this default is " @@ -4463,33 +4496,57 @@ msgid "" "intended, set :attr:`~Structure._layout_` to ``'ms'`` explicitly." msgstr "" -#: ../../library/ctypes.rst:2812 +#: ../../library/ctypes.rst:2815 msgid "" -"An optional small integer that allows overriding the alignment of the " -"structure when being packed or unpacked to/from memory. Setting this " -"attribute to 0 is the same as not setting it at all." +"An optional small integer that allows increasing the alignment of the " +"structure when being packed or unpacked to/from memory." msgstr "" -#: ../../library/ctypes.rst:2820 +#: ../../library/ctypes.rst:2818 +msgid "" +"The value must not be negative. The effect is equivalent to " +"``__attribute__((aligned(N)))`` on GCC or ``#pragma align(N)`` on MSVC, " +"except :mod:`ctypes` may allow values that the compiler would reject." +msgstr "" + +#: ../../library/ctypes.rst:2823 +msgid "" +":attr:`!_align_` can only *increase* a structure's alignment requirements. " +"Setting it to 0 or 1 has no effect." +msgstr "" + +#: ../../library/ctypes.rst:2826 +msgid "" +"Using values that are not powers of two is discouraged and may lead to " +"surprising behavior." +msgstr "" + +#: ../../library/ctypes.rst:2829 +msgid "" +":attr:`!_align_` must already be defined when :attr:`_fields_` is assigned, " +"otherwise it will have no effect." +msgstr "" + +#: ../../library/ctypes.rst:2836 msgid "" "An optional string naming the struct/union layout. It can currently be set " "to:" msgstr "" -#: ../../library/ctypes.rst:2823 +#: ../../library/ctypes.rst:2839 msgid "" "``\"ms\"``: the layout used by the Microsoft compiler (MSVC). On GCC and " "Clang, this layout can be selected with ``__attribute__((ms_struct))``." msgstr "" -#: ../../library/ctypes.rst:2826 +#: ../../library/ctypes.rst:2842 msgid "" "``\"gcc-sysv\"``: the layout used by GCC with the System V or “SysV-like” " -"data model, as used on Linux and macOS. With this " -"layout, :attr:`~Structure._pack_` must be unset or zero." +"data model, as used on Linux and macOS. With this layout, :attr:`~Structure." +"_pack_` must be unset or zero." msgstr "" -#: ../../library/ctypes.rst:2830 +#: ../../library/ctypes.rst:2846 msgid "" "If not set explicitly, ``ctypes`` will use a default that matches the " "platform conventions. This default may change in future Python releases (for " @@ -4497,46 +4554,46 @@ msgid "" "between similar platforms is found). Currently the default will be:" msgstr "" -#: ../../library/ctypes.rst:2836 +#: ../../library/ctypes.rst:2852 msgid "On Windows: ``\"ms\"``" msgstr "" -#: ../../library/ctypes.rst:2837 +#: ../../library/ctypes.rst:2853 msgid "" "When :attr:`~Structure._pack_` is specified: ``\"ms\"``. (This is " "deprecated; see :attr:`~Structure._pack_` documentation.)" msgstr "" -#: ../../library/ctypes.rst:2839 +#: ../../library/ctypes.rst:2855 msgid "Otherwise: ``\"gcc-sysv\"``" msgstr "" -#: ../../library/ctypes.rst:2841 +#: ../../library/ctypes.rst:2857 msgid "" ":attr:`!_layout_` must already be defined when :attr:`~Structure._fields_` " "is assigned, otherwise it will have no effect." msgstr "" -#: ../../library/ctypes.rst:2848 +#: ../../library/ctypes.rst:2864 msgid "" -"An optional sequence that lists the names of unnamed (anonymous) " -"fields. :attr:`_anonymous_` must be already defined when :attr:`_fields_` is " +"An optional sequence that lists the names of unnamed (anonymous) fields. :" +"attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" -#: ../../library/ctypes.rst:2852 +#: ../../library/ctypes.rst:2868 msgid "" -"The fields listed in this variable must be structure or union type " -"fields. :mod:`ctypes` will create descriptors in the structure type that " -"allows accessing the nested fields directly, without the need to create the " +"The fields listed in this variable must be structure or union type fields. :" +"mod:`ctypes` will create descriptors in the structure type that allows " +"accessing the nested fields directly, without the need to create the " "structure or union field." msgstr "" -#: ../../library/ctypes.rst:2857 +#: ../../library/ctypes.rst:2873 msgid "Here is an example type (Windows)::" msgstr "" -#: ../../library/ctypes.rst:2859 +#: ../../library/ctypes.rst:2875 msgid "" "class _U(Union):\n" " _fields_ = [(\"lptdesc\", POINTER(TYPEDESC)),\n" @@ -4558,7 +4615,7 @@ msgstr "" " _fields_ = [(\"u\", _U),\n" " (\"vt\", VARTYPE)]" -#: ../../library/ctypes.rst:2870 +#: ../../library/ctypes.rst:2886 msgid "" "The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field " "specifies which one of the union fields is valid. Since the ``u`` field is " @@ -4568,7 +4625,7 @@ msgid "" "temporary union instance::" msgstr "" -#: ../../library/ctypes.rst:2877 +#: ../../library/ctypes.rst:2893 msgid "" "td = TYPEDESC()\n" "td.vt = VT_PTR\n" @@ -4580,15 +4637,15 @@ msgstr "" "td.lptdesc = POINTER(some_type)\n" "td.u.lptdesc = POINTER(some_type)" -#: ../../library/ctypes.rst:2882 +#: ../../library/ctypes.rst:2898 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " -"fields of the base class. If the subclass definition has a " -"separate :attr:`_fields_` variable, the fields specified in this are " -"appended to the fields of the base class." +"fields of the base class. If the subclass definition has a separate :attr:" +"`_fields_` variable, the fields specified in this are appended to the fields " +"of the base class." msgstr "" -#: ../../library/ctypes.rst:2887 +#: ../../library/ctypes.rst:2903 msgid "" "Structure and union constructors accept both positional and keyword " "arguments. Positional arguments are used to initialize member fields in the " @@ -4598,13 +4655,13 @@ msgid "" "names not present in :attr:`_fields_`." msgstr "" -#: ../../library/ctypes.rst:2897 +#: ../../library/ctypes.rst:2913 msgid "" "Descriptor for fields of a :class:`Structure` and :class:`Union`. For " "example::" msgstr "" -#: ../../library/ctypes.rst:2900 +#: ../../library/ctypes.rst:2916 msgid "" ">>> class Color(Structure):\n" "... _fields_ = (\n" @@ -4626,196 +4683,214 @@ msgid "" ">>> Color.blinking.bit_offset\n" "1" msgstr "" +">>> class Color(Structure):\n" +"... _fields_ = (\n" +"... ('red', c_uint8),\n" +"... ('green', c_uint8),\n" +"... ('blue', c_uint8),\n" +"... ('intense', c_bool, 1),\n" +"... ('blinking', c_bool, 1),\n" +"... )\n" +"...\n" +">>> Color.red\n" +"\n" +">>> Color.green.type\n" +"\n" +">>> Color.blue.byte_offset\n" +"2\n" +">>> Color.intense\n" +"\n" +">>> Color.blinking.bit_offset\n" +"1" -#: ../../library/ctypes.rst:2920 +#: ../../library/ctypes.rst:2936 msgid "All attributes are read-only." msgstr "" -#: ../../library/ctypes.rst:2922 +#: ../../library/ctypes.rst:2938 msgid "" ":class:`!CField` objects are created via :attr:`~Structure._fields_`; do not " "instantiate the class directly." msgstr "" -#: ../../library/ctypes.rst:2927 +#: ../../library/ctypes.rst:2943 msgid "" "Previously, descriptors only had ``offset`` and ``size`` attributes and a " "readable string representation; the :class:`!CField` class was not available " "directly." msgstr "" -#: ../../library/ctypes.rst:2933 +#: ../../library/ctypes.rst:2949 msgid "Name of the field, as a string." msgstr "" -#: ../../library/ctypes.rst:2937 +#: ../../library/ctypes.rst:2953 msgid "Type of the field, as a :ref:`ctypes class `." msgstr "" -#: ../../library/ctypes.rst:2942 +#: ../../library/ctypes.rst:2958 msgid "Offset of the field, in bytes." msgstr "" -#: ../../library/ctypes.rst:2944 +#: ../../library/ctypes.rst:2960 msgid "" "For bitfields, this is the offset of the underlying byte-aligned *storage " "unit*; see :attr:`~CField.bit_offset`." msgstr "" -#: ../../library/ctypes.rst:2949 +#: ../../library/ctypes.rst:2965 msgid "Size of the field, in bytes." msgstr "" -#: ../../library/ctypes.rst:2951 +#: ../../library/ctypes.rst:2967 msgid "" "For bitfields, this is the size of the underlying *storage unit*. Typically, " "it has the same size as the bitfield's type." msgstr "" -#: ../../library/ctypes.rst:2956 +#: ../../library/ctypes.rst:2972 msgid "For non-bitfields, equivalent to :attr:`~CField.byte_size`." msgstr "" -#: ../../library/ctypes.rst:2958 +#: ../../library/ctypes.rst:2974 msgid "" "For bitfields, this contains a backwards-compatible bit-packed value that " "combines :attr:`~CField.bit_size` and :attr:`~CField.bit_offset`. Prefer " "using the explicit attributes instead." msgstr "" -#: ../../library/ctypes.rst:2965 +#: ../../library/ctypes.rst:2981 msgid "True if this is a bitfield." msgstr "" -#: ../../library/ctypes.rst:2970 +#: ../../library/ctypes.rst:2986 msgid "" -"The location of a bitfield within its *storage unit*, that is, " -"within :attr:`~CField.byte_size` bytes of memory starting " -"at :attr:`~CField.byte_offset`." +"The location of a bitfield within its *storage unit*, that is, within :attr:" +"`~CField.byte_size` bytes of memory starting at :attr:`~CField.byte_offset`." msgstr "" -#: ../../library/ctypes.rst:2974 +#: ../../library/ctypes.rst:2990 msgid "" "To get the field's value, read the storage unit as an integer, :ref:`shift " "left ` by :attr:`!bit_offset` and take the :attr:`!bit_size` least " "significant bits." msgstr "" -#: ../../library/ctypes.rst:2978 +#: ../../library/ctypes.rst:2994 msgid "" "For non-bitfields, :attr:`!bit_offset` is zero and :attr:`!bit_size` is " "equal to ``byte_size * 8``." msgstr "" -#: ../../library/ctypes.rst:2983 +#: ../../library/ctypes.rst:2999 msgid "" "True if this field is anonymous, that is, it contains nested sub-fields that " "should be merged into a containing structure or union." msgstr "" -#: ../../library/ctypes.rst:2990 +#: ../../library/ctypes.rst:3006 msgid "Arrays and pointers" msgstr "" -#: ../../library/ctypes.rst:2994 +#: ../../library/ctypes.rst:3010 msgid "Abstract base class for arrays." msgstr "" -#: ../../library/ctypes.rst:2996 +#: ../../library/ctypes.rst:3012 msgid "" -"The recommended way to create concrete array types is by multiplying " -"any :mod:`ctypes` data type with a non-negative integer. Alternatively, you " -"can subclass this type and define :attr:`_length_` and :attr:`_type_` class " +"The recommended way to create concrete array types is by multiplying any :" +"mod:`ctypes` data type with a non-negative integer. Alternatively, you can " +"subclass this type and define :attr:`_length_` and :attr:`_type_` class " "variables. Array elements can be read and written using standard subscript " "and slice accesses; for slice reads, the resulting object is *not* itself " "an :class:`Array`." msgstr "" -#: ../../library/ctypes.rst:3006 +#: ../../library/ctypes.rst:3022 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" -"range subscripts result in an :exc:`IndexError`. Will be returned " -"by :func:`len`." +"range subscripts result in an :exc:`IndexError`. Will be returned by :func:" +"`len`." msgstr "" -#: ../../library/ctypes.rst:3013 +#: ../../library/ctypes.rst:3029 msgid "Specifies the type of each element in the array." msgstr "" -#: ../../library/ctypes.rst:3016 +#: ../../library/ctypes.rst:3032 msgid "" "Array subclass constructors accept positional arguments, used to initialize " "the elements in order." msgstr "" -#: ../../library/ctypes.rst:3021 +#: ../../library/ctypes.rst:3037 msgid "" -"Create an array. Equivalent to ``type * length``, where *type* is " -"a :mod:`ctypes` data type and *length* an integer." +"Create an array. Equivalent to ``type * length``, where *type* is a :mod:" +"`ctypes` data type and *length* an integer." msgstr "" -#: ../../library/ctypes.rst:3025 +#: ../../library/ctypes.rst:3041 msgid "" "This function is :term:`soft deprecated` in favor of multiplication. There " "are no plans to remove it." msgstr "" -#: ../../library/ctypes.rst:3031 +#: ../../library/ctypes.rst:3047 msgid "Private, abstract base class for pointers." msgstr "" -#: ../../library/ctypes.rst:3033 +#: ../../library/ctypes.rst:3049 msgid "" "Concrete pointer types are created by calling :func:`POINTER` with the type " "that will be pointed to; this is done automatically by :func:`pointer`." msgstr "" -#: ../../library/ctypes.rst:3037 +#: ../../library/ctypes.rst:3053 msgid "" "If a pointer points to an array, its elements can be read and written using " -"standard subscript and slice accesses. Pointer objects have no size, " -"so :func:`len` will raise :exc:`TypeError`. Negative subscripts will read " -"from the memory *before* the pointer (as in C), and out-of-range subscripts " -"will probably crash with an access violation (if you're lucky)." +"standard subscript and slice accesses. Pointer objects have no size, so :" +"func:`len` will raise :exc:`TypeError`. Negative subscripts will read from " +"the memory *before* the pointer (as in C), and out-of-range subscripts will " +"probably crash with an access violation (if you're lucky)." msgstr "" -#: ../../library/ctypes.rst:3047 +#: ../../library/ctypes.rst:3063 msgid "Specifies the type pointed to." msgstr "" -#: ../../library/ctypes.rst:3051 +#: ../../library/ctypes.rst:3067 msgid "" "Returns the object to which to pointer points. Assigning to this attribute " "changes the pointer to point to the assigned object." msgstr "" -#: ../../library/ctypes.rst:3058 +#: ../../library/ctypes.rst:3074 msgid "Exceptions" msgstr "" -#: ../../library/ctypes.rst:3062 +#: ../../library/ctypes.rst:3078 msgid "" "This exception is raised when a foreign function call cannot convert one of " "the passed arguments." msgstr "" -#: ../../library/ctypes.rst:3068 +#: ../../library/ctypes.rst:3084 msgid "This exception is raised when a COM method call failed." msgstr "" -#: ../../library/ctypes.rst:3072 +#: ../../library/ctypes.rst:3088 msgid "The integer value representing the error code." msgstr "" -#: ../../library/ctypes.rst:3076 +#: ../../library/ctypes.rst:3092 msgid "The error message." msgstr "" -#: ../../library/ctypes.rst:3080 +#: ../../library/ctypes.rst:3096 msgid "The 5-tuple ``(descr, source, helpfile, helpcontext, progid)``." msgstr "" -#: ../../library/ctypes.rst:3082 +#: ../../library/ctypes.rst:3098 msgid "" "*descr* is the textual description. *source* is the language-dependent " "``ProgID`` for the class or application that raised the error. *helpfile* " diff --git a/library/curses.po b/library/curses.po index 10b29c30bb4..119b139e4d4 100644 --- a/library/curses.po +++ b/library/curses.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -183,9 +183,9 @@ msgstr "" msgid "" "Return the attribute value for displaying text in the specified color pair. " "Only the first 256 color pairs are supported. This attribute value can be " -"combined with :const:`A_STANDOUT`, :const:`A_REVERSE`, and the " -"other :const:`!A_\\*` attributes. :func:`pair_number` is the counterpart to " -"this function." +"combined with :const:`A_STANDOUT`, :const:`A_REVERSE`, and the other :const:" +"`!A_\\*` attributes. :func:`pair_number` is the counterpart to this " +"function." msgstr "" #: ../../library/curses.rst:133 @@ -201,16 +201,16 @@ msgstr "" msgid "" "Save the current terminal mode as the \"program\" mode, the mode when the " "running program is using curses. (Its counterpart is the \"shell\" mode, " -"for when the program is not in curses.) Subsequent calls " -"to :func:`reset_prog_mode` will restore this mode." +"for when the program is not in curses.) Subsequent calls to :func:" +"`reset_prog_mode` will restore this mode." msgstr "" #: ../../library/curses.rst:150 msgid "" "Save the current terminal mode as the \"shell\" mode, the mode when the " "running program is not using curses. (Its counterpart is the \"program\" " -"mode, when the program is using curses capabilities.) Subsequent calls " -"to :func:`reset_shell_mode` will restore this mode." +"mode, when the program is using curses capabilities.) Subsequent calls to :" +"func:`reset_shell_mode` will restore this mode." msgstr "" #: ../../library/curses.rst:158 @@ -232,8 +232,8 @@ msgid "" "a window. The normal :meth:`~window.refresh` call is simply :meth:`!" "noutrefresh` followed by :func:`!doupdate`; if you have to update multiple " "windows, you can speed performance and perhaps reduce screen flicker by " -"issuing :meth:`!noutrefresh` calls on all windows, followed by a " -"single :func:`!doupdate`." +"issuing :meth:`!noutrefresh` calls on all windows, followed by a single :" +"func:`!doupdate`." msgstr "" #: ../../library/curses.rst:178 @@ -286,8 +286,10 @@ msgid "" "coordinates. (*z* is currently unused.) *bstate* is an integer value whose " "bits will be set to indicate the type of event, and will be the bitwise OR " "of one or more of the following constants, where *n* is the button number " -"from 1 to " -"5: :const:`BUTTONn_PRESSED`, :const:`BUTTONn_RELEASED`, :const:`BUTTONn_CLICKED`, :const:`BUTTONn_DOUBLE_CLICKED`, :const:`BUTTONn_TRIPLE_CLICKED`, :const:`BUTTON_SHIFT`, :const:`BUTTON_CTRL`, :const:`BUTTON_ALT`." +"from 1 to 5: :const:`BUTTONn_PRESSED`, :const:`BUTTONn_RELEASED`, :const:" +"`BUTTONn_CLICKED`, :const:`BUTTONn_DOUBLE_CLICKED`, :const:" +"`BUTTONn_TRIPLE_CLICKED`, :const:`BUTTON_SHIFT`, :const:`BUTTON_CTRL`, :" +"const:`BUTTON_ALT`." msgstr "" #: ../../library/curses.rst:230 ../../library/curses.rst:1799 @@ -305,9 +307,9 @@ msgstr "" #: ../../library/curses.rst:243 msgid "" -"Read window related data stored in the file by an " -"earlier :func:`window.putwin` call. The routine then creates and initializes " -"a new window using that data, returning the new window object." +"Read window related data stored in the file by an earlier :func:`window." +"putwin` call. The routine then creates and initializes a new window using " +"that data, returning the new window object." msgstr "" #: ../../library/curses.rst:250 @@ -374,10 +376,10 @@ msgid "" "Change the definition of a color-pair. It takes three arguments: the number " "of the color-pair to be changed, the foreground color number, and the " "background color number. The value of *pair_number* must be between ``1`` " -"and ``COLOR_PAIRS - 1`` (the ``0`` color pair can only be changed " -"by :func:`use_default_colors` and :func:`assume_default_colors`). The value " -"of *fg* and *bg* arguments must be between ``0`` and ``COLORS - 1``, or, " -"after calling :func:`!use_default_colors` or :func:`!assume_default_colors`, " +"and ``COLOR_PAIRS - 1`` (the ``0`` color pair can only be changed by :func:" +"`use_default_colors` and :func:`assume_default_colors`). The value of *fg* " +"and *bg* arguments must be between ``0`` and ``COLORS - 1``, or, after " +"calling :func:`!use_default_colors` or :func:`!assume_default_colors`, " "``-1``. If the color-pair was previously initialized, the screen is " "refreshed and all occurrences of that color-pair are changed to the new " "definition." @@ -471,14 +473,14 @@ msgid "" "and is not necessarily associated with a particular part of the screen. " "Pads can be used when a large window is needed, and only a part of the " "window will be on the screen at one time. Automatic refreshes of pads (such " -"as from scrolling or echoing of input) do not occur. " -"The :meth:`~window.refresh` and :meth:`~window.noutrefresh` methods of a pad " -"require 6 arguments to specify the part of the pad to be displayed and the " -"location on the screen to be used for the display. The arguments are " -"*pminrow*, *pmincol*, *sminrow*, *smincol*, *smaxrow*, *smaxcol*; the *p* " -"arguments refer to the upper left corner of the pad region to be displayed " -"and the *s* arguments define a clipping box on the screen within which the " -"pad region is to be displayed." +"as from scrolling or echoing of input) do not occur. The :meth:`~window." +"refresh` and :meth:`~window.noutrefresh` methods of a pad require 6 " +"arguments to specify the part of the pad to be displayed and the location on " +"the screen to be used for the display. The arguments are *pminrow*, " +"*pmincol*, *sminrow*, *smincol*, *smaxrow*, *smaxcol*; the *p* arguments " +"refer to the upper left corner of the pad region to be displayed and the *s* " +"arguments define a clipping box on the screen within which the pad region is " +"to be displayed." msgstr "" #: ../../library/curses.rst:413 @@ -541,15 +543,15 @@ msgstr "" #: ../../library/curses.rst:468 msgid "" -"Return the number of the color-pair set by the attribute value " -"*attr*. :func:`color_pair` is the counterpart to this function." +"Return the number of the color-pair set by the attribute value *attr*. :func:" +"`color_pair` is the counterpart to this function." msgstr "" #: ../../library/curses.rst:474 msgid "" "Equivalent to ``tputs(str, 1, putchar)``; emit the value of a specified " -"terminfo capability for the current terminal. Note that the output " -"of :func:`putp` always goes to standard output." +"terminfo capability for the current terminal. Note that the output of :func:" +"`putp` always goes to standard output." msgstr "" #: ../../library/curses.rst:481 @@ -568,20 +570,20 @@ msgstr "" #: ../../library/curses.rst:495 msgid "" -"Restore the terminal to \"program\" mode, as previously saved " -"by :func:`def_prog_mode`." +"Restore the terminal to \"program\" mode, as previously saved by :func:" +"`def_prog_mode`." msgstr "" #: ../../library/curses.rst:501 msgid "" -"Restore the terminal to \"shell\" mode, as previously saved " -"by :func:`def_shell_mode`." +"Restore the terminal to \"shell\" mode, as previously saved by :func:" +"`def_shell_mode`." msgstr "" #: ../../library/curses.rst:507 msgid "" -"Restore the state of the terminal modes to what it was at the last call " -"to :func:`savetty`." +"Restore the state of the terminal modes to what it was at the last call to :" +"func:`savetty`." msgstr "" #: ../../library/curses.rst:513 @@ -603,8 +605,8 @@ msgstr "" #: ../../library/curses.rst:530 msgid "" -"Save the current state of the terminal modes in a buffer, usable " -"by :func:`resetty`." +"Save the current state of the terminal modes in a buffer, usable by :func:" +"`resetty`." msgstr "" #: ../../library/curses.rst:535 @@ -653,11 +655,11 @@ msgstr "" #: ../../library/curses.rst:581 msgid "" ":func:`start_color` initializes eight basic colors (black, red, green, " -"yellow, blue, magenta, cyan, and white), and two global variables in " -"the :mod:`curses` module, :const:`COLORS` and :const:`COLOR_PAIRS`, " -"containing the maximum number of colors and color-pairs the terminal can " -"support. It also restores the colors on the terminal to the values they had " -"when the terminal was just turned on." +"yellow, blue, magenta, cyan, and white), and two global variables in the :" +"mod:`curses` module, :const:`COLORS` and :const:`COLOR_PAIRS`, containing " +"the maximum number of colors and color-pairs the terminal can support. It " +"also restores the colors on the terminal to the values they had when the " +"terminal was just turned on." msgstr "" #: ../../library/curses.rst:590 @@ -846,8 +848,8 @@ msgstr "" #: ../../library/curses.rst:775 msgid "" -"Add attribute *attr* from the \"background\" set applied to all writes to " -"the current window." +"Add attribute *attr* to the \"background\" set applied to all writes to the " +"current window." msgstr "" #: ../../library/curses.rst:781 @@ -1065,8 +1067,8 @@ msgstr "" #: ../../library/curses.rst:910 msgid "" -"Add character *ch* with attribute *attr*, and immediately " -"call :meth:`refresh` on the window." +"Add character *ch* with attribute *attr*, and immediately call :meth:" +"`refresh` on the window." msgstr "" #: ../../library/curses.rst:916 @@ -1236,15 +1238,15 @@ msgstr "" #: ../../library/curses.rst:1096 msgid "" -"Return ``True`` if the specified line was modified since the last call " -"to :meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` " +"Return ``True`` if the specified line was modified since the last call to :" +"meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` " "exception if *line* is not valid for the given window." msgstr "" #: ../../library/curses.rst:1103 msgid "" -"Return ``True`` if the specified window was modified since the last call " -"to :meth:`refresh`; otherwise return ``False``." +"Return ``True`` if the specified window was modified since the last call to :" +"meth:`refresh`; otherwise return ``False``." msgstr "" #: ../../library/curses.rst:1109 @@ -1313,8 +1315,8 @@ msgstr "" #: ../../library/curses.rst:1167 msgid "" -"To get fine-grained control over the copied region, the second form " -"of :meth:`overlay` can be used. *sminrow* and *smincol* are the upper-left " +"To get fine-grained control over the copied region, the second form of :meth:" +"`overlay` can be used. *sminrow* and *smincol* are the upper-left " "coordinates of the source window, and the other variables mark a rectangle " "in the destination window." msgstr "" @@ -1329,8 +1331,8 @@ msgstr "" #: ../../library/curses.rst:1180 msgid "" -"To get fine-grained control over the copied region, the second form " -"of :meth:`overwrite` can be used. *sminrow* and *smincol* are the upper-left " +"To get fine-grained control over the copied region, the second form of :meth:" +"`overwrite` can be used. *sminrow* and *smincol* are the upper-left " "coordinates of the source window, the other variables mark a rectangle in " "the destination window." msgstr "" @@ -1349,8 +1351,8 @@ msgstr "" #: ../../library/curses.rst:1200 msgid "" -"Touch the entire window, causing it to be completely redrawn on the " -"next :meth:`refresh` call." +"Touch the entire window, causing it to be completely redrawn on the next :" +"meth:`refresh` call." msgstr "" #: ../../library/curses.rst:1206 @@ -1448,9 +1450,9 @@ msgid "" "Set blocking or non-blocking read behavior for the window. If *delay* is " "negative, blocking read is used (which will wait indefinitely for input). " "If *delay* is zero, then non-blocking read is used, and :meth:`getch` will " -"return ``-1`` if no input is waiting. If *delay* is positive, " -"then :meth:`getch` will block for *delay* milliseconds, and return ``-1`` if " -"there is still no input at the end of that time." +"return ``-1`` if no input is waiting. If *delay* is positive, then :meth:" +"`getch` will block for *delay* milliseconds, and return ``-1`` if there is " +"still no input at the end of that time." msgstr "" #: ../../library/curses.rst:1309 @@ -1469,8 +1471,8 @@ msgstr "" #: ../../library/curses.rst:1322 msgid "" -"Mark all lines in the window as unchanged since the last call " -"to :meth:`refresh`." +"Mark all lines in the window as unchanged since the last call to :meth:" +"`refresh`." msgstr "" #: ../../library/curses.rst:1329 @@ -1489,8 +1491,8 @@ msgstr ":mod:`curses` 模組定義了以下資料成員:" #: ../../library/curses.rst:1341 msgid "" -"Some curses routines that return an integer, such " -"as :meth:`~window.getch`, return :const:`ERR` upon failure." +"Some curses routines that return an integer, such as :meth:`~window." +"getch`, return :const:`ERR` upon failure." msgstr "" #: ../../library/curses.rst:1347 @@ -1530,15 +1532,15 @@ msgstr "" #: ../../library/curses.rst:1380 msgid "" "The width of the screen, i.e., the number of columns. It is defined only " -"after the call to :func:`initscr`. Updated " -"by :func:`update_lines_cols`, :func:`resizeterm` and :func:`resize_term`." +"after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" +"func:`resizeterm` and :func:`resize_term`." msgstr "" #: ../../library/curses.rst:1387 msgid "" "The height of the screen, i.e., the number of lines. It is defined only " -"after the call to :func:`initscr`. Updated " -"by :func:`update_lines_cols`, :func:`resizeterm` and :func:`resize_term`." +"after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" +"func:`resizeterm` and :func:`resize_term`." msgstr "" #: ../../library/curses.rst:1393 @@ -1626,7 +1628,7 @@ msgstr "" #: ../../library/curses.rst:1435 msgid "``A_ITALIC`` was added." -msgstr "" +msgstr "新增 ``A_ITALIC``。" #: ../../library/curses.rst:1438 msgid "" @@ -2043,14 +2045,13 @@ msgstr "" #: ../../library/curses.rst:1652 msgid "" "On VT100s and their software emulations, such as X terminal emulators, there " -"are normally at least four function keys (:const:`KEY_F1 " -"`, :const:`KEY_F2 `, :const:`KEY_F3 " -"`, :const:`KEY_F4 `) available, and the arrow keys mapped " -"to :const:`KEY_UP`, :const:`KEY_DOWN`, :const:`KEY_LEFT` " -"and :const:`KEY_RIGHT` in the obvious way. If your machine has a PC " -"keyboard, it is safe to expect arrow keys and twelve function keys (older PC " -"keyboards may have only ten function keys); also, the following keypad " -"mappings are standard:" +"are normally at least four function keys (:const:`KEY_F1 `, :const:" +"`KEY_F2 `, :const:`KEY_F3 `, :const:`KEY_F4 `) " +"available, and the arrow keys mapped to :const:`KEY_UP`, :const:`KEY_DOWN`, :" +"const:`KEY_LEFT` and :const:`KEY_RIGHT` in the obvious way. If your machine " +"has a PC keyboard, it is safe to expect arrow keys and twelve function keys " +"(older PC keyboards may have only ten function keys); also, the following " +"keypad mappings are standard:" msgstr "" #: ../../library/curses.rst:1661 @@ -2415,11 +2416,11 @@ msgstr "" #: ../../library/curses.rst:1866 msgid "" -"Return a textbox widget object. The *win* argument should be a " -"curses :ref:`window ` object in which the textbox is " -"to be contained. The edit cursor of the textbox is initially located at the " -"upper left hand corner of the containing window, with coordinates ``(0, " -"0)``. The instance's :attr:`stripspaces` flag is initially on." +"Return a textbox widget object. The *win* argument should be a curses :ref:" +"`window ` object in which the textbox is to be " +"contained. The edit cursor of the textbox is initially located at the upper " +"left hand corner of the containing window, with coordinates ``(0, 0)``. The " +"instance's :attr:`stripspaces` flag is initially on." msgstr "" #: ../../library/curses.rst:1872 @@ -2433,8 +2434,8 @@ msgid "" "*validator* is supplied, it must be a function. It will be called for each " "keystroke entered with the keystroke as a parameter; command dispatch is " "done on the result. This method returns the window contents as a string; " -"whether blanks in the window are included is affected by " -"the :attr:`stripspaces` attribute." +"whether blanks in the window are included is affected by the :attr:" +"`stripspaces` attribute." msgstr "" #: ../../library/curses.rst:1888 diff --git a/library/dataclasses.po b/library/dataclasses.po index 9eeb64a3812..af92b953018 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-10 20:44+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2023-02-11 15:02+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,9 +27,9 @@ msgstr "**原始碼:**\\ :source:`Lib/dataclasses.py`" #, fuzzy msgid "" "This module provides a decorator and functions for automatically adding " -"generated :term:`special methods ` such " -"as :meth:`~object.__init__` and :meth:`~object.__repr__` to user-defined " -"classes. It was originally described in :pep:`557`." +"generated :term:`special methods ` such as :meth:`~object." +"__init__` and :meth:`~object.__repr__` to user-defined classes. It was " +"originally described in :pep:`557`." msgstr "" "該模組提供了一個裝飾器和函式,用於自動新增生成的\\ :term:`特殊方法 `,例如 :meth:`~object.__init__` 和 :meth:`~object.__repr__` 到使用者" @@ -38,8 +38,8 @@ msgstr "" #: ../../library/dataclasses.rst:19 #, fuzzy msgid "" -"The member variables to use in these generated methods are defined " -"using :pep:`526` type annotations. For example, this code::" +"The member variables to use in these generated methods are defined using :" +"pep:`526` type annotations. For example, this code::" msgstr "" "在這些生成的方法中使用的成員變數是使用 :pep:`526` 型別註釋定義的。例如,這段" "程式碼: ::" @@ -94,9 +94,8 @@ msgstr "模組內容" #: ../../library/dataclasses.rst:51 #, fuzzy msgid "" -"This function is a :term:`decorator` that is used to add " -"generated :term:`special methods ` to classes, as described " -"below." +"This function is a :term:`decorator` that is used to add generated :term:" +"`special methods ` to classes, as described below." msgstr "" "此函式是一個 :term:`decorator`,用於將生成的\\ :term:`特殊方法 `\\新增到類別中,如下所述。" @@ -109,9 +108,9 @@ msgid "" "`. With two exceptions described below, nothing in " "``@dataclass`` examines the type specified in the variable annotation." msgstr "" -"``@dataclass`` 裝飾器檢查類別以找到 ``field``\\s。 ``field`` 被定義為具" -"有 :term:`type annotation ` 的類別變數。除了下面描述的兩" -"個例外,``@dataclass`` 中沒有任何內容檢查變數註釋中指定的型別。" +"``@dataclass`` 裝飾器檢查類別以找到 ``field``\\s。 ``field`` 被定義為具有 :" +"term:`type annotation ` 的類別變數。除了下面描述的兩個例" +"外,``@dataclass`` 中沒有任何內容檢查變數註釋中指定的型別。" #: ../../library/dataclasses.rst:60 #, fuzzy @@ -226,35 +225,32 @@ msgstr "如果該類別已經定義了 :meth:`!__eq__`,則此參數會被忽 #: ../../library/dataclasses.rst:113 #, fuzzy msgid "" -"*order*: If true (the default is " -"``False``), :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " -"and :meth:`~object.__ge__` methods will be generated. These compare the " -"class as if it were a tuple of its fields, in order. Both instances in the " -"comparison must be of the identical type. If *order* is true and *eq* is " -"false, a :exc:`ValueError` is raised." +"*order*: If true (the default is ``False``), :meth:`~object.__lt__`, :meth:" +"`~object.__le__`, :meth:`~object.__gt__`, and :meth:`~object.__ge__` methods " +"will be generated. These compare the class as if it were a tuple of its " +"fields, in order. Both instances in the comparison must be of the identical " +"type. If *order* is true and *eq* is false, a :exc:`ValueError` is raised." msgstr "" -"*order*:如果為真(預設為 " -"``False``),:meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object.__gt__` " -"和 :meth:`~object.__ge__` 方法將是產生。它們按順序比較類別,就好像它是其欄位" -"的元組一樣。比較中的兩個實例必須屬於同一型別。如果 *order* 為真且 *eq* 為假," -"則會引發 :exc:`ValueError`。" +"*order*:如果為真(預設為 ``False``),:meth:`~object.__lt__`、:meth:" +"`~object.__le__`、:meth:`~object.__gt__` 和 :meth:`~object.__ge__` 方法將是產" +"生。它們按順序比較類別,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於" +"同一型別。如果 *order* 為真且 *eq* 為假,則會引發 :exc:`ValueError`。" #: ../../library/dataclasses.rst:120 msgid "" -"If the class already defines any of :meth:`!__lt__`, :meth:`!" -"__le__`, :meth:`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is " -"raised." +"If the class already defines any of :meth:`!__lt__`, :meth:`!__le__`, :meth:" +"`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is raised." msgstr "" -"如果該類別已經定義了 :meth:`!__lt__`、:meth:`!__le__`、:meth:`!__gt__` " -"或 :meth:`!__ge__` 中的任何一個,則引發 :exc:`TypeError`。" +"如果該類別已經定義了 :meth:`!__lt__`、:meth:`!__le__`、:meth:`!__gt__` 或 :" +"meth:`!__ge__` 中的任何一個,則引發 :exc:`TypeError`。" #: ../../library/dataclasses.rst:124 #, fuzzy msgid "" -"*unsafe_hash*: If true, force ``dataclasses`` to create " -"a :meth:`~object.__hash__` method, even though it may not be safe to do so. " -"Otherwise, generate a :meth:`~object.__hash__` method according to how *eq* " -"and *frozen* are set. The default value is ``False``." +"*unsafe_hash*: If true, force ``dataclasses`` to create a :meth:`~object." +"__hash__` method, even though it may not be safe to do so. Otherwise, " +"generate a :meth:`~object.__hash__` method according to how *eq* and " +"*frozen* are set. The default value is ``False``." msgstr "" "*unsafe_hash*:如果 ``False``(預設值),將根據 *eq* 和 *frozen* 的設定生成一" "個 :meth:`~object.__hash__` 方法。" @@ -277,11 +273,11 @@ msgstr "" #: ../../library/dataclasses.rst:137 #, fuzzy msgid "" -"By default, ``@dataclass`` will not implicitly add " -"a :meth:`~object.__hash__` method unless it is safe to do so. Neither will " -"it add or change an existing explicitly defined :meth:`!__hash__` method. " -"Setting the class attribute ``__hash__ = None`` has a specific meaning to " -"Python, as described in the :meth:`!__hash__` documentation." +"By default, ``@dataclass`` will not implicitly add a :meth:`~object." +"__hash__` method unless it is safe to do so. Neither will it add or change " +"an existing explicitly defined :meth:`!__hash__` method. Setting the class " +"attribute ``__hash__ = None`` has a specific meaning to Python, as described " +"in the :meth:`!__hash__` documentation." msgstr "" "預設情況下,``@dataclass`` 不會隱式新增 :meth:`~object.__hash__` 方法,除非這" "樣做是安全的。它也不會新增或更改現有的明確定義的 :meth:`!__hash__` 方法。設定" @@ -309,35 +305,35 @@ msgstr "" msgid "" "Here are the rules governing implicit creation of a :meth:`!__hash__` " "method. Note that you cannot both have an explicit :meth:`!__hash__` method " -"in your dataclass and set ``unsafe_hash=True``; this will result in " -"a :exc:`TypeError`." +"in your dataclass and set ``unsafe_hash=True``; this will result in a :exc:" +"`TypeError`." msgstr "" "以下是管理隱式建立 :meth:`!__hash__` 方法的規則。請注意,你不能在資料類別中既" -"有顯式的 :meth:`!__hash__` 方法又設定 ``unsafe_hash=True``;這將導" -"致 :exc:`TypeError`。" +"有顯式的 :meth:`!__hash__` 方法又設定 ``unsafe_hash=True``;這將導致 :exc:" +"`TypeError`。" #: ../../library/dataclasses.rst:155 msgid "" "If *eq* and *frozen* are both true, by default ``@dataclass`` will generate " -"a :meth:`!__hash__` method for you. If *eq* is true and *frozen* is " -"false, :meth:`!__hash__` will be set to ``None``, marking it unhashable " -"(which it is, since it is mutable). If *eq* is false, :meth:`!__hash__` " -"will be left untouched meaning the :meth:`!__hash__` method of the " -"superclass will be used (if the superclass is :class:`object`, this means it " -"will fall back to id-based hashing)." -msgstr "" -"如果 *eq* 和 *frozen* 都為真,預設情況下 ``@dataclass`` 會為你生成一" -"個 :meth:`!__hash__` 方法。如果 *eq* 為真且 *frozen* 為假,:meth:`!__hash__` " -"將被設定為 ``None``,並將其標記為不可雜湊(因為它是可變的)。如果 *eq* 為" -"假,:meth:`!__hash__` 將保持不變,這意味著將使用超類別的 :meth:`!__hash__` 方" -"法(如果超類別是 :class:`object`,這意味著它將回退到基於 id 的雜湊)。" +"a :meth:`!__hash__` method for you. If *eq* is true and *frozen* is false, :" +"meth:`!__hash__` will be set to ``None``, marking it unhashable (which it " +"is, since it is mutable). If *eq* is false, :meth:`!__hash__` will be left " +"untouched meaning the :meth:`!__hash__` method of the superclass will be " +"used (if the superclass is :class:`object`, this means it will fall back to " +"id-based hashing)." +msgstr "" +"如果 *eq* 和 *frozen* 都為真,預設情況下 ``@dataclass`` 會為你生成一個 :meth:" +"`!__hash__` 方法。如果 *eq* 為真且 *frozen* 為假,:meth:`!__hash__` 將被設定" +"為 ``None``,並將其標記為不可雜湊(因為它是可變的)。如果 *eq* 為假,:meth:`!" +"__hash__` 將保持不變,這意味著將使用超類別的 :meth:`!__hash__` 方法(如果超類" +"別是 :class:`object`,這意味著它將回退到基於 id 的雜湊)。" #: ../../library/dataclasses.rst:163 #, fuzzy msgid "" "*frozen*: If true (the default is ``False``), assigning to fields will " -"generate an exception. This emulates read-only frozen instances. See " -"the :ref:`discussion ` below." +"generate an exception. This emulates read-only frozen instances. See the :" +"ref:`discussion ` below." msgstr "" "*frozen*:如果為真(預設為 ``False``),分配給欄位將產生例外。這模擬了只讀的" "凍結實例。如果 :meth:`~object.__setattr__` 或 :meth:`~object.__delattr__` 在" @@ -354,11 +350,11 @@ msgstr "" #: ../../library/dataclasses.rst:170 #, fuzzy msgid "" -"*match_args*: If true (the default is ``True``), " -"the :attr:`~object.__match_args__` tuple will be created from the list of " -"non keyword-only parameters to the generated :meth:`~object.__init__` method " -"(even if :meth:`!__init__` is not generated, see above). If false, or " -"if :attr:`!__match_args__` is already defined in the class, then :attr:`!" +"*match_args*: If true (the default is ``True``), the :attr:`~object." +"__match_args__` tuple will be created from the list of non keyword-only " +"parameters to the generated :meth:`~object.__init__` method (even if :meth:`!" +"__init__` is not generated, see above). If false, or if :attr:`!" +"__match_args__` is already defined in the class, then :attr:`!" "__match_args__` will not be generated." msgstr "" "*match_args*:如果為真(預設為 ``True``),``__match_args__`` 元組將從參數列" @@ -377,10 +373,10 @@ msgid "" "the :const:`KW_ONLY` section." msgstr "" "``kw_only``:如果為 true(預設值為 ``False``),則所有欄位將被標記為僅限關鍵" -"字。如果一個欄位被標記為僅限關鍵字,那麼唯一的影響是從僅限關鍵字欄位生成" -"的 :meth:`~object.__init__` 參數必須在呼叫 :meth:`!__init__` 時指定關鍵字。對" -"資料類別的任何其他方面都沒有影響。有關詳細資訊,請參閱 :term:`parameter` 詞彙" -"表條目。另請參閱 :const:`KW_ONLY` 部分。" +"字。如果一個欄位被標記為僅限關鍵字,那麼唯一的影響是從僅限關鍵字欄位生成的 :" +"meth:`~object.__init__` 參數必須在呼叫 :meth:`!__init__` 時指定關鍵字。對資料" +"類別的任何其他方面都沒有影響。有關詳細資訊,請參閱 :term:`parameter` 詞彙表條" +"目。另請參閱 :const:`KW_ONLY` 部分。" #: ../../library/dataclasses.rst:187 msgid "Keyword-only fields are not included in :attr:`!__match_args__`." @@ -391,8 +387,8 @@ msgstr "" msgid "" "*slots*: If true (the default is ``False``), :attr:`~object.__slots__` " "attribute will be generated and new class will be returned instead of the " -"original one. If :attr:`!__slots__` is already defined in the class, " -"then :exc:`TypeError` is raised." +"original one. If :attr:`!__slots__` is already defined in the class, then :" +"exc:`TypeError` is raised." msgstr "" "``slots``:如果為 true(預設為 ``False``),將生成 :attr:`~object.__slots__` " "屬性並回傳新類別而不是原始類別。如果 :attr:`!__slots__` 已經在類別中定義," @@ -412,9 +408,9 @@ msgid "" "If a field name is already included in the :attr:`!__slots__` of a base " "class, it will not be included in the generated :attr:`!__slots__` to " "prevent :ref:`overriding them `. Therefore, do not " -"use :attr:`!__slots__` to retrieve the field names of a dataclass. " -"Use :func:`fields` instead. To be able to determine inherited slots, base " -"class :attr:`!__slots__` may be any iterable, but *not* an iterator." +"use :attr:`!__slots__` to retrieve the field names of a dataclass. Use :func:" +"`fields` instead. To be able to determine inherited slots, base class :attr:" +"`!__slots__` may be any iterable, but *not* an iterator." msgstr "" "如果欄位名稱已經包含在基底類別的 :attr:`!__slots__` 中,它將不會包含在生成" "的 :attr:`!__slots__` 中以防止 :ref:`覆蓋它們 `。因此," @@ -455,8 +451,8 @@ msgid "" "In this example, both :attr:`!a` and :attr:`!b` will be included in the " "added :meth:`~object.__init__` method, which will be defined as::" msgstr "" -"在此示例中,:attr:`!a` 和 :attr:`!b` 都將包含在新增" -"的 :meth:`~object.__init__` 方法中,該方法將定義為: ::" +"在此示例中,:attr:`!a` 和 :attr:`!b` 都將包含在新增的 :meth:`~object." +"__init__` 方法中,該方法將定義為: ::" #: ../../library/dataclasses.rst:234 msgid "def __init__(self, a: int, b: int = 0):" @@ -568,10 +564,10 @@ msgid "" "comparisons. Setting this value to anything other than ``None`` is " "discouraged." msgstr "" -"*hash*:這可以是 bool 或 ``None``。如果為真,則此欄位包含在生成" -"的 :meth:`__hash__` 方法中。如果 ``None``\\ (預設值),則使用\\ *比較*\\ 的" -"值:這通常是預期的行為。如果一個欄位用於比較,則應在雜湊中考慮該欄位。不鼓勵" -"將此值設定為 ``None`` 以外的任何值。" +"*hash*:這可以是 bool 或 ``None``。如果為真,則此欄位包含在生成的 :meth:" +"`__hash__` 方法中。如果 ``None``\\ (預設值),則使用\\ *比較*\\ 的值:這通常" +"是預期的行為。如果一個欄位用於比較,則應在雜湊中考慮該欄位。不鼓勵將此值設定" +"為 ``None`` 以外的任何值。" #: ../../library/dataclasses.rst:286 #, fuzzy @@ -590,11 +586,11 @@ msgstr "" #, fuzzy msgid "" "*compare*: If true (the default), this field is included in the generated " -"equality and comparison methods " -"(:meth:`~object.__eq__`, :meth:`~object.__gt__`, et al.)." +"equality and comparison methods (:meth:`~object.__eq__`, :meth:`~object." +"__gt__`, et al.)." msgstr "" -"*compare*:如果為真(預設值),則此欄位包含在生成的相等和比較方法中" -"(:meth:`~object.__eq__`、:meth:`~object.__gt__` 等)。" +"*compare*:如果為真(預設值),則此欄位包含在生成的相等和比較方法中(:meth:" +"`~object.__eq__`、:meth:`~object.__gt__` 等)。" #: ../../library/dataclasses.rst:296 #, fuzzy @@ -606,10 +602,10 @@ msgid "" "mechanism. Multiple third-parties can each have their own key, to use as a " "namespace in the metadata." msgstr "" -"*metadata*:這可以是對映或無。 None 被視為空字典。此值包含" -"在 :func:`~types.MappingProxyType` 中以使其成為只讀的,並暴露" -"在 :class:`Field` 對像上。它根本不被資料類別使用,而是作為第三方擴充機制提供" -"的。多個第三方可以各自擁有自己的密鑰,用作元資料中的命名空間。" +"*metadata*:這可以是對映或無。 None 被視為空字典。此值包含在 :func:`~types." +"MappingProxyType` 中以使其成為只讀的,並暴露在 :class:`Field` 對像上。它根本" +"不被資料類別使用,而是作為第三方擴充機制提供的。多個第三方可以各自擁有自己的" +"密鑰,用作元資料中的命名空間。" #: ../../library/dataclasses.rst:304 #, fuzzy @@ -617,8 +613,8 @@ msgid "" "*kw_only*: If true, this field will be marked as keyword-only. This is used " "when the generated :meth:`~object.__init__` method's parameters are computed." msgstr "" -"*kw_only*:如果為真,該欄位將被標記為僅限關鍵字。這在計算生成" -"的 :meth:`~object.__init__` 方法的參數時使用。" +"*kw_only*:如果為真,該欄位將被標記為僅限關鍵字。這在計算生成的 :meth:" +"`~object.__init__` 方法的參數時使用。" #: ../../library/dataclasses.rst:308 msgid "Keyword-only fields are also not included in :attr:`!__match_args__`." @@ -634,10 +630,10 @@ msgid "" "If the default value of a field is specified by a call to :func:`!field`, " "then the class attribute for this field will be replaced by the specified " "*default* value. If *default* is not provided, then the class attribute " -"will be deleted. The intent is that after the :func:`@dataclass " -"` decorator runs, the class attributes will all contain the " -"default values for the fields, just as if the default value itself were " -"specified. For example, after::" +"will be deleted. The intent is that after the :deco:`dataclass` decorator " +"runs, the class attributes will all contain the default values for the " +"fields, just as if the default value itself were specified. For example, " +"after::" msgstr "" "如果欄位的預設值是通過呼叫 :func:`!field` 指定的,那麼該欄位的類別屬性將被指" "定的 *default* 值替換。如果沒有提供 *default*,那麼類別屬性將被刪除。目的是" @@ -678,9 +674,9 @@ msgid "" "method (see below). Users should never instantiate a :class:`!Field` object " "directly. Its documented attributes are:" msgstr "" -":class:`!Field` 物件描述每個定義的欄位。這些對像在內部建立,並" -"由 :func:`fields` 模組級方法回傳(見下文)。使用者不應該直接實例化 :class:`!" -"Field` 物件。它記錄的屬性是:" +":class:`!Field` 物件描述每個定義的欄位。這些對像在內部建立,並由 :func:" +"`fields` 模組級方法回傳(見下文)。使用者不應該直接實例化 :class:`!Field` 物" +"件。它記錄的屬性是:" #: ../../library/dataclasses.rst:343 msgid ":attr:`!name`: The name of the field." @@ -693,14 +689,13 @@ msgstr ":attr:`!type`:欄位的型別。" #: ../../library/dataclasses.rst:345 #, fuzzy msgid "" -":attr:`!default`, :attr:`!default_factory`, :attr:`!init`, :attr:`!" -"repr`, :attr:`!hash`, :attr:`!compare`, :attr:`!metadata`, and :attr:`!" -"kw_only` have the identical meaning and values as they do in " -"the :func:`field` function." +":attr:`!default`, :attr:`!default_factory`, :attr:`!init`, :attr:`!repr`, :" +"attr:`!hash`, :attr:`!compare`, :attr:`!metadata`, and :attr:`!kw_only` have " +"the identical meaning and values as they do in the :func:`field` function." msgstr "" -":attr:`!default`、:attr:`!default_factory`、:attr:`!init`、:attr:`!" -"repr`、:attr:`!hash`、:attr:`!compare`, :attr:`!metadata` 和 :attr:`!" -"kw_only` 有與它們在 :func:`field` 函式中的含義和值相同。" +":attr:`!default`、:attr:`!default_factory`、:attr:`!init`、:attr:`!repr`、:" +"attr:`!hash`、:attr:`!compare`, :attr:`!metadata` 和 :attr:`!kw_only` 有與它" +"們在 :func:`field` 函式中的含義和值相同。" #: ../../library/dataclasses.rst:349 #, fuzzy @@ -713,9 +708,9 @@ msgstr "可能存在其他屬性,但它們是私有的,不得檢查或依賴 msgid "" "``InitVar[T]`` type annotations describe variables that are :ref:`init-only " "`. Fields annotated with :class:`!InitVar` " -"are considered pseudo-fields, and thus are neither returned by " -"the :func:`fields` function nor used in any way except adding them as " -"parameters to :meth:`~object.__init__` and an optional :meth:`__post_init__`." +"are considered pseudo-fields, and thus are neither returned by the :func:" +"`fields` function nor used in any way except adding them as parameters to :" +"meth:`~object.__init__` and an optional :meth:`__post_init__`." msgstr "" #: ../../library/dataclasses.rst:363 @@ -803,8 +798,8 @@ msgid "" "objects are copied with :func:`copy.deepcopy`." msgstr "" "將資料類別 *obj* 轉換為元組(通過使用工廠函式 *tuple_factory*)。每個資料類別" -"都被轉換為其欄位值的元組。資料類別、字典、列表和元組被遞迴到。其他物件使" -"用 :func:`copy.deepcopy` 複製。" +"都被轉換為其欄位值的元組。資料類別、字典、列表和元組被遞迴到。其他物件使用 :" +"func:`copy.deepcopy` 複製。" #: ../../library/dataclasses.rst:408 msgid "Continuing from the previous example::" @@ -839,8 +834,8 @@ msgid "" "``name``, ``(name, type)``, or ``(name, type, Field)``. If just ``name`` is " "supplied, :data:`typing.Any` is used for ``type``. The values of *init*, " "*repr*, *eq*, *order*, *unsafe_hash*, *frozen*, *match_args*, *kw_only*, " -"*slots*, and *weakref_slot* have the same meaning as they do " -"in :func:`@dataclass `." +"*slots*, and *weakref_slot* have the same meaning as they do in :deco:" +"`dataclass`." msgstr "" "建立一個名為 *cls_name* 的新資料類別,欄位在 *fields* 中定義,基底類別在 " "*bases* 中給出,並使用 *namespace* 中給出的命名空間進行初始化。 ``fields`` 是" @@ -860,8 +855,8 @@ msgstr "" msgid "" "The *decorator* parameter is a callable that will be used to create the " "dataclass. It should take the class object as a first argument and the same " -"keyword arguments as :func:`@dataclass `. By default, " -"the :func:`@dataclass ` function is used." +"keyword arguments as :deco:`dataclass`. By default, the :deco:`dataclass` " +"function is used." msgstr "" #: ../../library/dataclasses.rst:441 @@ -869,12 +864,12 @@ msgstr "" msgid "" "This function is not strictly required, because any Python mechanism for " "creating a new class with :attr:`~object.__annotations__` can then apply " -"the :func:`@dataclass ` function to convert that class to a " -"dataclass. This function is provided as a convenience. For example::" +"the :deco:`dataclass` function to convert that class to a dataclass. This " +"function is provided as a convenience. For example::" msgstr "" -"這個函式不是嚴格要求的,因為任何使用 :attr:`~object.__annotations__` 建立新類別的 Python " -"機制都可以應用 :func:`dataclass` 函式將該類別轉換為資料類別。提供此功能是為了" -"方便。例如: ::" +"這個函式不是嚴格要求的,因為任何使用 :attr:`~object.__annotations__` 建立新類" +"別的 Python 機制都可以應用 :func:`dataclass` 函式將該類別轉換為資料類別。提供" +"此功能是為了方便。例如: ::" #: ../../library/dataclasses.rst:447 msgid "" @@ -915,8 +910,8 @@ msgstr "" msgid "" "Creates a new object of the same type as *obj*, replacing fields with values " "from *changes*. If *obj* is not a Data Class, raises :exc:`TypeError`. If " -"keys in *changes* are not field names of the given dataclass, " -"raises :exc:`TypeError`." +"keys in *changes* are not field names of the given dataclass, raises :exc:" +"`TypeError`." msgstr "" "建立一個與 ``obj`` 型別相同的新物件,用 ``changes`` 中的值替換欄位。如果 " "``obj`` 不是資料類別,則引發 :exc:`TypeError`。如果 ``changes`` 中的值未指定" @@ -970,17 +965,16 @@ msgstr "" #: ../../library/dataclasses.rst:495 msgid "" -"Dataclass instances are also supported by generic " -"function :func:`copy.replace`." +"Dataclass instances are also supported by generic function :func:`copy." +"replace`." msgstr "" #: ../../library/dataclasses.rst:499 -#, fuzzy msgid "" "Return ``True`` if its parameter is a dataclass (including subclasses of a " "dataclass) or an instance of one, otherwise return ``False``." msgstr "" -"如果它的參數是一個資料類別或一個實例,則回傳 ``True``,否則回傳 ``False``。" +"如果它的參數是一個資料類別(包含一個資料類別的子類別)或一個實例則回傳 ``True``,否則回傳 ``False``。" #: ../../library/dataclasses.rst:502 #, fuzzy @@ -1010,9 +1004,9 @@ msgid "" "with the type of :const:`!KW_ONLY` are marked as keyword-only fields. Note " "that a pseudo-field of type :const:`!KW_ONLY` is otherwise completely " "ignored. This includes the name of such a field. By convention, a name of " -"``_`` is used for a :const:`!KW_ONLY` field. Keyword-only fields " -"signify :meth:`~object.__init__` parameters that must be specified as " -"keywords when the class is instantiated." +"``_`` is used for a :const:`!KW_ONLY` field. Keyword-only fields signify :" +"meth:`~object.__init__` parameters that must be specified as keywords when " +"the class is instantiated." msgstr "" "用作型別註釋的標記值。型別為 :const:`!KW_ONLY` 的偽欄位之後的任何欄位都被標記" "為僅關鍵字欄位。請注意,:const:`!KW_ONLY` 型別的偽欄位將被完全忽略。這包括此" @@ -1056,33 +1050,33 @@ msgstr "在單個資料類別中,指定多個型別為 :const:`!KW_ONLY` 的 #: ../../library/dataclasses.rst:542 #, fuzzy msgid "" -"Raised when an implicitly defined :meth:`~object.__setattr__` " -"or :meth:`~object.__delattr__` is called on a dataclass which was defined " -"with ``frozen=True``. It is a subclass of :exc:`AttributeError`." +"Raised when an implicitly defined :meth:`~object.__setattr__` or :meth:" +"`~object.__delattr__` is called on a dataclass which was defined with " +"``frozen=True``. It is a subclass of :exc:`AttributeError`." msgstr "" -"當在使用 frozen=True 定義的資料類別上呼叫隱式定義的 :meth:`__setattr__` " -"或 :meth:`__delattr__` 時引發。它是 :exc:`AttributeError` 的子類別。" +"當在使用 frozen=True 定義的資料類別上呼叫隱式定義的 :meth:`__setattr__` 或 :" +"meth:`__delattr__` 時引發。它是 :exc:`AttributeError` 的子類別。" #: ../../library/dataclasses.rst:549 #, fuzzy msgid "Post-init processing" -msgstr "初始化後處理" +msgstr "後初始化處理" #: ../../library/dataclasses.rst:553 #, fuzzy msgid "" -"When defined on the class, it will be called by the " -"generated :meth:`~object.__init__`, normally as :meth:`!self.__post_init__`. " -"However, if any ``InitVar`` fields are defined, they will also be passed " -"to :meth:`!__post_init__` in the order they were defined in the class. If " -"no :meth:`!__init__` method is generated, then :meth:`!__post_init__` will " -"not automatically be called." +"When defined on the class, it will be called by the generated :meth:`~object." +"__init__`, normally as :meth:`!self.__post_init__`. However, if any " +"``InitVar`` fields are defined, they will also be passed to :meth:`!" +"__post_init__` in the order they were defined in the class. If no :meth:`!" +"__init__` method is generated, then :meth:`!__post_init__` will not " +"automatically be called." msgstr "" -"生成的 :meth:`~object.__init__` 程式碼將呼叫一個名為 :meth:`!" -"self.__post_init__` 的方法,如果 :meth:`!__post_init__` 是在類別上定義的。它" -"通常被稱為 ``self.!__post_init__()``。但是,如果定義了任何 ``InitVar`` 欄位," -"它們也將按照它們在類別中定義的順序傳遞給 :meth:`!__post_init__` 。如果沒有生" -"成 :meth:`!__init__` 方法,那麼 :meth:`!__post_init__` 將不會被自動呼叫。" +"生成的 :meth:`~object.__init__` 程式碼將呼叫一個名為 :meth:`!self." +"__post_init__` 的方法,如果 :meth:`!__post_init__` 是在類別上定義的。它通常被" +"稱為 ``self.!__post_init__()``。但是,如果定義了任何 ``InitVar`` 欄位,它們也" +"將按照它們在類別中定義的順序傳遞給 :meth:`!__post_init__` 。如果沒有生成 :" +"meth:`!__init__` 方法,那麼 :meth:`!__post_init__` 將不會被自動呼叫。" #: ../../library/dataclasses.rst:560 #, fuzzy @@ -1114,10 +1108,10 @@ msgstr "" #: ../../library/dataclasses.rst:572 #, fuzzy msgid "" -"The :meth:`~object.__init__` method generated by :func:`@dataclass " -"` does not call base class :meth:`!__init__` methods. If the base " -"class has an :meth:`!__init__` method that has to be called, it is common to " -"call this method in a :meth:`__post_init__` method::" +"The :meth:`~object.__init__` method generated by :deco:`dataclass` does not " +"call base class :meth:`!__init__` methods. If the base class has an :meth:`!" +"__init__` method that has to be called, it is common to call this method in " +"a :meth:`__post_init__` method::" msgstr "" ":func:`@dataclass ` 生成的 :meth:`~object.__init__` 方法不呼叫基底" "類別 :meth:`!__init__` 方法。如果基底類別有一個必須呼叫的 :meth:`!__init__` " @@ -1162,8 +1156,8 @@ msgstr "" #: ../../library/dataclasses.rst:593 #, fuzzy msgid "" -"See the section below on init-only variables for ways to pass parameters " -"to :meth:`!__post_init__`. Also see the warning about how :func:`replace` " +"See the section below on init-only variables for ways to pass parameters to :" +"meth:`!__post_init__`. Also see the warning about how :func:`replace` " "handles ``init=False`` fields." msgstr "" "請參閱下面有關僅初始化變數的部分,了解將參數傳遞給 :meth:`!__post_init__` 的" @@ -1176,19 +1170,18 @@ msgstr "類別變數" #: ../../library/dataclasses.rst:602 #, fuzzy msgid "" -"One of the few places where :func:`@dataclass ` actually inspects " -"the type of a field is to determine if a field is a class variable as " -"defined in :pep:`526`. It does this by checking if the type of the field " -"is :data:`typing.ClassVar`. If a field is a ``ClassVar``, it is excluded " -"from consideration as a field and is ignored by the dataclass mechanisms. " -"Such ``ClassVar`` pseudo-fields are not returned by the module-" -"level :func:`fields` function." +"One of the few places where :deco:`dataclass` actually inspects the type of " +"a field is to determine if a field is a class variable as defined in :pep:" +"`526`. It does this by checking if the type of the field is :data:`typing." +"ClassVar`. If a field is a ``ClassVar``, it is excluded from consideration " +"as a field and is ignored by the dataclass mechanisms. Such ``ClassVar`` " +"pseudo-fields are not returned by the module-level :func:`fields` function." msgstr "" ":func:`@dataclass ` 實際檢查欄位型別的少數地方之一是確定欄位是否" -"是 :pep:`526` 中定義的類別變數。它通過檢查欄位的型別是否" -"為 :data:`typing.ClassVar` 來做到這一點。如果一個欄位是一個 ``ClassVar``,它" -"就被排除在考慮之外,並被資料類別機制忽略。模組級 :func:`fields` 函式不會回傳" -"此類別 ``ClassVar`` 偽欄位。" +"是 :pep:`526` 中定義的類別變數。它通過檢查欄位的型別是否為 :data:`typing." +"ClassVar` 來做到這一點。如果一個欄位是一個 ``ClassVar``,它就被排除在考慮之" +"外,並被資料類別機制忽略。模組級 :func:`fields` 函式不會回傳此類別 " +"``ClassVar`` 偽欄位。" #: ../../library/dataclasses.rst:613 #, fuzzy @@ -1198,15 +1191,14 @@ msgstr "僅初始化變數" #: ../../library/dataclasses.rst:615 #, fuzzy msgid "" -"Another place where :func:`@dataclass ` inspects a type " -"annotation is to determine if a field is an init-only variable. It does " -"this by seeing if the type of a field is of type :class:`InitVar`. If a " -"field is an :class:`InitVar`, it is considered a pseudo-field called an init-" -"only field. As it is not a true field, it is not returned by the module-" -"level :func:`fields` function. Init-only fields are added as parameters to " -"the generated :meth:`~object.__init__` method, and are passed to the " -"optional :meth:`__post_init__` method. They are not otherwise used by " -"dataclasses." +"Another place where :deco:`dataclass` inspects a type annotation is to " +"determine if a field is an init-only variable. It does this by seeing if " +"the type of a field is of type :class:`InitVar`. If a field is an :class:" +"`InitVar`, it is considered a pseudo-field called an init-only field. As it " +"is not a true field, it is not returned by the module-level :func:`fields` " +"function. Init-only fields are added as parameters to the generated :meth:" +"`~object.__init__` method, and are passed to the optional :meth:" +"`__post_init__` method. They are not otherwise used by dataclasses." msgstr "" ":func:`dataclass` 檢查型別註解的另一個地方是確定欄位是否是僅初始化變數。它通" "過查看欄位的型別是否為 ``dataclasses.InitVar`` 型別來執行此操作。如果一個欄位" @@ -1254,8 +1246,8 @@ msgid "" "In this case, :func:`fields` will return :class:`Field` objects for :attr:`!" "i` and :attr:`!j`, but not for :attr:`!database`." msgstr "" -"在這種情況下,:func:`fields` 將為 :attr:`!i` 和 :attr:`!j` 回" -"傳 :class:`Field` 物件,但不會為 :attr:`!database` 回傳。" +"在這種情況下,:func:`fields` 將為 :attr:`!i` 和 :attr:`!j` 回傳 :class:" +"`Field` 物件,但不會為 :attr:`!database` 回傳。" #: ../../library/dataclasses.rst:646 msgid "Frozen instances" @@ -1265,24 +1257,22 @@ msgstr "凍結實例" #, fuzzy msgid "" "It is not possible to create truly immutable Python objects. However, by " -"passing ``frozen=True`` to the :func:`@dataclass ` decorator you " -"can emulate immutability. In that case, dataclasses will " -"add :meth:`~object.__setattr__` and :meth:`~object.__delattr__` methods to " -"the class. These methods will raise a :exc:`FrozenInstanceError` when " -"invoked." -msgstr "" -"不可能建立真正不可變的 Python 物件。但是,通過將 ``frozen=True`` 傳遞" -"給 :func:`@dataclass ` 裝飾器,你可以模擬不變性。在這種情況下,資" -"料類別將向類別新增 :meth:`~object.__setattr__` " -"和 :meth:`~object.__delattr__` 方法。這些方法在叫用時會引" -"發 :exc:`FrozenInstanceError`。" +"passing ``frozen=True`` to the :deco:`dataclass` decorator you can emulate " +"immutability. In that case, dataclasses will add :meth:`~object." +"__setattr__` and :meth:`~object.__delattr__` methods to the class. These " +"methods will raise a :exc:`FrozenInstanceError` when invoked." +msgstr "" +"不可能建立真正不可變的 Python 物件。但是,通過將 ``frozen=True`` 傳遞給 :" +"func:`@dataclass ` 裝飾器,你可以模擬不變性。在這種情況下,資料類" +"別將向類別新增 :meth:`~object.__setattr__` 和 :meth:`~object.__delattr__` 方" +"法。這些方法在叫用時會引發 :exc:`FrozenInstanceError`。" #: ../../library/dataclasses.rst:654 #, fuzzy msgid "" -"There is a tiny performance penalty when using " -"``frozen=True``: :meth:`~object.__init__` cannot use simple assignment to " -"initialize fields, and must use :meth:`!object.__setattr__`." +"There is a tiny performance penalty when using ``frozen=True``: :meth:" +"`~object.__init__` cannot use simple assignment to initialize fields, and " +"must use :meth:`!object.__setattr__`." msgstr "" "使用 ``frozen=True`` 時有一個微小的性能損失::meth:`~object.__init__` 不能使" "用簡單賦值來初始化欄位,必須使用 :meth:`!object.__setattr__`。" @@ -1294,14 +1284,14 @@ msgstr "繼承" #: ../../library/dataclasses.rst:665 #, fuzzy msgid "" -"When the dataclass is being created by the :func:`@dataclass ` " -"decorator, it looks through all of the class's base classes in reverse MRO " -"(that is, starting at :class:`object`) and, for each dataclass that it " -"finds, adds the fields from that base class to an ordered mapping of fields. " -"After all of the base class fields are added, it adds its own fields to the " -"ordered mapping. All of the generated methods will use this combined, " -"calculated ordered mapping of fields. Because the fields are in insertion " -"order, derived classes override base classes. An example::" +"When the dataclass is being created by the :deco:`dataclass` decorator, it " +"looks through all of the class's base classes in reverse MRO (that is, " +"starting at :class:`object`) and, for each dataclass that it finds, adds the " +"fields from that base class to an ordered mapping of fields. After all of " +"the base class fields are added, it adds its own fields to the ordered " +"mapping. All of the generated methods will use this combined, calculated " +"ordered mapping of fields. Because the fields are in insertion order, " +"derived classes override base classes. An example::" msgstr "" "當 :func:`@dataclass ` 裝飾器建立資料類別時,它會以反向 MRO(即" "從 :class:`object` 開始)查看該類別的所有基底類別,並且對於它找到的每個資料類" @@ -1463,9 +1453,8 @@ msgid "" "initial value." msgstr "" "如果一個欄位從 :meth:`~object.__init__` 中排除(使用 ``init=False``)並且該欄" -"位還指定了 ``default_factory``,那麼預設工廠函式將始終從生成" -"的 :meth:`__init__ 中呼叫`功能。發生這種情況是因為沒有其他方法可以為該欄位賦" -"予初始值。" +"位還指定了 ``default_factory``,那麼預設工廠函式將始終從生成的 :meth:" +"`__init__ 中呼叫`功能。發生這種情況是因為沒有其他方法可以為該欄位賦予初始值。" #: ../../library/dataclasses.rst:744 msgid "Mutable default values" @@ -1517,7 +1506,7 @@ msgstr "" #: ../../library/dataclasses.rst:764 #, fuzzy msgid "Using dataclasses, *if* this code was valid::" -msgstr "使用資料類別,*如果*此程式碼有效: ::" +msgstr "使用資料類別,*如果*\\ 此程式碼有效: ::" #: ../../library/dataclasses.rst:766 msgid "" @@ -1561,14 +1550,14 @@ msgstr "" #, fuzzy msgid "" "This has the same issue as the original example using class :class:`!C`. " -"That is, two instances of class :class:`!D` that do not specify a value " -"for :attr:`!x` when creating a class instance will share the same copy " -"of :attr:`!x`. Because dataclasses just use normal Python class creation " -"they also share this behavior. There is no general way for Data Classes to " -"detect this condition. Instead, the :func:`@dataclass ` " -"decorator will raise a :exc:`ValueError` if it detects an unhashable default " -"parameter. The assumption is that if a value is unhashable, it is mutable. " -"This is a partial solution, but it does protect against many common errors." +"That is, two instances of class :class:`!D` that do not specify a value for :" +"attr:`!x` when creating a class instance will share the same copy of :attr:`!" +"x`. Because dataclasses just use normal Python class creation they also " +"share this behavior. There is no general way for Data Classes to detect " +"this condition. Instead, the :deco:`dataclass` decorator will raise a :exc:" +"`ValueError` if it detects an unhashable default parameter. The assumption " +"is that if a value is unhashable, it is mutable. This is a partial " +"solution, but it does protect against many common errors." msgstr "" "這與使用類別 :class:`!C` 的原始示例存在相同的問題。也就是說,類別 :class:`!" "D` 的兩個實例在建立類別實例時沒有為 :attr:`!x` 指定值,它們將共享 :attr:`!x` " @@ -1601,10 +1590,9 @@ msgstr "" #: ../../library/dataclasses.rst:803 #, fuzzy msgid "" -"Instead of looking for and disallowing objects of " -"type :class:`list`, :class:`dict`, or :class:`set`, unhashable objects are " -"now not allowed as default values. Unhashability is used to approximate " -"mutability." +"Instead of looking for and disallowing objects of type :class:`list`, :class:" +"`dict`, or :class:`set`, unhashable objects are now not allowed as default " +"values. Unhashability is used to approximate mutability." msgstr "" "不再查找和禁止型別為 :class:`list`、:class:`dict` 或 :class:`set` 的物件,現" "在不允許使用不可散列的對像作為預設值。不可散列性用於近似可變性。" @@ -1629,15 +1617,15 @@ msgid "" "method is passed to the descriptor's :meth:`~object.__set__` method rather " "than overwriting the descriptor object." msgstr "" -"傳遞給資料類別的 :meth:`~object.__init__` 方法的欄位值被傳遞給描述器" -"的 :meth:`~object.__set__` 方法,而不是覆蓋描述器物件。" +"傳遞給資料類別的 :meth:`~object.__init__` 方法的欄位值被傳遞給描述器的 :meth:" +"`~object.__set__` 方法,而不是覆蓋描述器物件。" #: ../../library/dataclasses.rst:819 #, fuzzy msgid "" -"Similarly, when getting or setting the field, the " -"descriptor's :meth:`~object.__get__` or :meth:`!__set__` method is called " -"rather than returning or overwriting the descriptor object." +"Similarly, when getting or setting the field, the descriptor's :meth:" +"`~object.__get__` or :meth:`!__set__` method is called rather than returning " +"or overwriting the descriptor object." msgstr "" "同樣,在取得或設定欄位時,將呼叫描述器的 :meth:`~object.__get__` 或 :meth:`!" "__set__` 方法,而不是回傳或覆蓋描述器物件。" @@ -1645,12 +1633,12 @@ msgstr "" #: ../../library/dataclasses.rst:823 #, fuzzy msgid "" -"To determine whether a field contains a default value, :func:`@dataclass " -"` will call the descriptor's :meth:`!__get__` method using its " -"class access form: ``descriptor.__get__(obj=None, type=cls)``. If the " -"descriptor returns a value in this case, it will be used as the field's " -"default. On the other hand, if the descriptor raises :exc:`AttributeError` " -"in this situation, no default value will be provided for the field." +"To determine whether a field contains a default value, :deco:`dataclass` " +"will call the descriptor's :meth:`!__get__` method using its class access " +"form: ``descriptor.__get__(obj=None, type=cls)``. If the descriptor returns " +"a value in this case, it will be used as the field's default. On the other " +"hand, if the descriptor raises :exc:`AttributeError` in this situation, no " +"default value will be provided for the field." msgstr "" "為了確定一個欄位是否包含預設值,:func:`@dataclass ` 將使用其類別存" "取形式呼叫描述器的 :meth:`!__get__` 方法(即 ``descriptor.__get__(obj=None, " diff --git a/library/datetime.po b/library/datetime.po index 1185a7c7125..b564fbec70a 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -443,6 +443,16 @@ msgid "" ">>> pretty_timedelta(d)\n" "'-(1:00:00)'" msgstr "" +">>> def pretty_timedelta(td):\n" +"... if td.days >= 0:\n" +"... return str(td)\n" +"... return f'-({-td!s})'\n" +"...\n" +">>> d = timedelta(hours=-1)\n" +">>> str(d) # not human-friendly\n" +"'-1 day, 23:00:00'\n" +">>> pretty_timedelta(d)\n" +"'-(1:00:00)'" #: ../../library/datetime.rst:281 ../../library/datetime.rst:615 #: ../../library/datetime.rst:1175 ../../library/datetime.rst:1813 @@ -995,6 +1005,12 @@ msgid "" ">>> when.strftime(\"%B %d\")\n" "'February 29'" msgstr "" +">>> from datetime import date\n" +">>> date_string = \"02/29\"\n" +">>> when = date.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # 避免" +"閏年錯誤。\n" +">>> when.strftime(\"%B %d\")\n" +"'February 29'" #: ../../library/datetime.rst:619 msgid "The earliest representable date, ``date(MINYEAR, 1, 1)``." @@ -1809,6 +1825,12 @@ msgid "" ">>> when.strftime(\"%B %d\")\n" "'February 29'" msgstr "" +">>> from datetime import datetime\n" +">>> date_string = \"02/29\"\n" +">>> when = datetime.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # " +"避免閏年錯誤。\n" +">>> when.strftime(\"%B %d\")\n" +"'February 29'" #: ../../library/datetime.rst:1179 msgid "" @@ -2324,6 +2346,16 @@ msgid "" ">>> datetime(2009, 11, 27, microsecond=100, tzinfo=TZ()).isoformat()\n" "'2009-11-27T00:00:00.000100-06:39'" msgstr "" +">>> from datetime import tzinfo, timedelta, datetime\n" +">>> class TZ(tzinfo):\n" +"... \"\"\"A time zone with an arbitrary, constant -06:39 offset.\"\"\"\n" +"... def utcoffset(self, dt):\n" +"... return timedelta(hours=-6, minutes=-39)\n" +"...\n" +">>> datetime(2002, 12, 25, tzinfo=TZ()).isoformat(' ')\n" +"'2002-12-25 00:00:00-06:39'\n" +">>> datetime(2009, 11, 27, microsecond=100, tzinfo=TZ()).isoformat()\n" +"'2009-11-27T00:00:00.000100-06:39'" #: ../../library/datetime.rst:1591 ../../library/datetime.rst:1982 msgid "" @@ -4368,6 +4400,10 @@ msgid "" "bug.\n" "datetime.datetime(1984, 2, 29, 0, 0)" msgstr "" +">>> month_day = \"02/29\"\n" +">>> datetime.strptime(f\"{month_day};1984\", \"%m/%d;%Y\") # 沒有閏年" +"問題。\n" +"datetime.datetime(1984, 2, 29, 0, 0)" #: ../../library/datetime.rst:2778 msgid "" diff --git a/library/dbm.po b/library/dbm.po index 7dfd3dbb89d..c7d077cc8fe 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -59,8 +59,8 @@ msgstr "" #: ../../library/dbm.rst:31 msgid "" "This function attempts to guess which of the several simple database modules " -"available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`, " -"or :mod:`dbm.dumb` --- should be used to open a given file." +"available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`, or :mod:" +"`dbm.dumb` --- should be used to open a given file." msgstr "" #: ../../library/dbm.rst:35 @@ -82,7 +82,7 @@ msgid "" "``'dbm.gnu'``" msgstr "" -#: ../../library/dbm.rst:41 ../../library/dbm.rst:250 ../../library/dbm.rst:448 +#: ../../library/dbm.rst:41 ../../library/dbm.rst:270 ../../library/dbm.rst:471 msgid "*filename* accepts a :term:`path-like object`." msgstr "" @@ -96,13 +96,13 @@ msgstr "參數" #: ../../library/dbm.rst:67 msgid "" -"The database file to open. If the database file already exists, " -"the :func:`whichdb` function is used to determine its type and the " -"appropriate module is used; if it does not exist, the first submodule listed " -"above that can be imported is used." +"The database file to open. If the database file already exists, the :func:" +"`whichdb` function is used to determine its type and the appropriate module " +"is used; if it does not exist, the first submodule listed above that can be " +"imported is used." msgstr "" -#: ../../library/dbm.rst:68 ../../library/dbm.rst:222 +#: ../../library/dbm.rst:68 ../../library/dbm.rst:242 msgid "The database file to open." msgstr "要打開的資料庫檔案" @@ -113,7 +113,7 @@ msgid "" "the first submodule listed above that can be imported is used." msgstr "" -#: ../../library/dbm.rst:75 ../../library/dbm.rst:178 ../../library/dbm.rst:353 +#: ../../library/dbm.rst:75 ../../library/dbm.rst:182 ../../library/dbm.rst:374 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" @@ -121,28 +121,28 @@ msgstr "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" -#: ../../library/dbm.rst:76 ../../library/dbm.rst:180 ../../library/dbm.rst:227 -#: ../../library/dbm.rst:354 +#: ../../library/dbm.rst:76 ../../library/dbm.rst:184 ../../library/dbm.rst:247 +#: ../../library/dbm.rst:375 msgid "``'r'`` (default): |flag_r|" msgstr "``'r'`` (default): |flag_r|" -#: ../../library/dbm.rst:77 ../../library/dbm.rst:181 ../../library/dbm.rst:228 -#: ../../library/dbm.rst:355 ../../library/dbm.rst:429 +#: ../../library/dbm.rst:77 ../../library/dbm.rst:185 ../../library/dbm.rst:248 +#: ../../library/dbm.rst:376 ../../library/dbm.rst:452 msgid "``'w'``: |flag_w|" msgstr "``'w'``: |flag_w|" -#: ../../library/dbm.rst:78 ../../library/dbm.rst:182 ../../library/dbm.rst:229 -#: ../../library/dbm.rst:356 +#: ../../library/dbm.rst:78 ../../library/dbm.rst:186 ../../library/dbm.rst:249 +#: ../../library/dbm.rst:377 msgid "``'c'``: |flag_c|" msgstr "``'c'``: |flag_c|" -#: ../../library/dbm.rst:79 ../../library/dbm.rst:183 ../../library/dbm.rst:230 -#: ../../library/dbm.rst:357 ../../library/dbm.rst:431 +#: ../../library/dbm.rst:79 ../../library/dbm.rst:187 ../../library/dbm.rst:250 +#: ../../library/dbm.rst:378 ../../library/dbm.rst:454 msgid "``'n'``: |flag_n|" msgstr "``'n'``: |flag_n|" -#: ../../library/dbm.rst:81 ../../library/dbm.rst:244 ../../library/dbm.rst:359 -#: ../../library/dbm.rst:433 +#: ../../library/dbm.rst:81 ../../library/dbm.rst:264 ../../library/dbm.rst:380 +#: ../../library/dbm.rst:456 msgid "|mode_param_doc|" msgstr "|mode_param_doc|" @@ -152,51 +152,56 @@ msgstr "*file* 接受一個\\ :term:`類路徑物件 `。" #: ../../library/dbm.rst:87 msgid "" -"The object returned by :func:`~dbm.open` supports the same basic " -"functionality as a :class:`dict`; keys and their corresponding values can be " -"stored, retrieved, and deleted, and the :keyword:`in` operator and " -"the :meth:`!keys` method are available, as well as :meth:`!get` and :meth:`!" -"setdefault` methods." +"The object returned by :func:`~dbm.open` supports the basic functionality of " +"mutable :term:`mappings `; keys and their corresponding values can " +"be stored, retrieved, and deleted, and iteration, the :keyword:`in` operator " +"and methods :meth:`!keys`, :meth:`!get`, :meth:`!setdefault` and :meth:`!" +"clear` are available. The :meth:`!keys` method returns a list instead of a " +"view object. The :meth:`!setdefault` method requires two arguments." msgstr "" -#: ../../library/dbm.rst:92 +#: ../../library/dbm.rst:95 msgid "" "Key and values are always stored as :class:`bytes`. This means that when " "strings are used they are implicitly converted to the default encoding " "before being stored." msgstr "" -#: ../../library/dbm.rst:96 +#: ../../library/dbm.rst:99 msgid "" "These objects also support being used in a :keyword:`with` statement, which " "will automatically close them when done." msgstr "" -#: ../../library/dbm.rst:99 +#: ../../library/dbm.rst:102 msgid "" -":meth:`!get` and :meth:`!setdefault` methods are now available for " -"all :mod:`dbm` backends." +":meth:`!get` and :meth:`!setdefault` methods are now available for all :mod:" +"`dbm` backends." msgstr "" -#: ../../library/dbm.rst:103 +#: ../../library/dbm.rst:106 msgid "" "Added native support for the context management protocol to the objects " "returned by :func:`~dbm.open`." msgstr "" -#: ../../library/dbm.rst:107 +#: ../../library/dbm.rst:110 msgid "" "Deleting a key from a read-only database raises a database module specific " "exception instead of :exc:`KeyError`." msgstr "" -#: ../../library/dbm.rst:111 +#: ../../library/dbm.rst:114 +msgid ":meth:`!clear` methods are now available for all :mod:`dbm` backends." +msgstr ":meth:`!clear` 方法現在可用於所有 :mod:`dbm` 後端。" + +#: ../../library/dbm.rst:118 msgid "" "The following example records some hostnames and a corresponding title, and " "then prints out the contents of the database::" msgstr "" -#: ../../library/dbm.rst:114 +#: ../../library/dbm.rst:121 msgid "" "import dbm\n" "\n" @@ -223,32 +228,32 @@ msgid "" "# db is automatically closed when leaving the with statement." msgstr "" -#: ../../library/dbm.rst:141 +#: ../../library/dbm.rst:148 msgid "Module :mod:`shelve`" msgstr ":mod:`shelve` 模組" -#: ../../library/dbm.rst:142 +#: ../../library/dbm.rst:149 msgid "Persistence module which stores non-string data." msgstr "" -#: ../../library/dbm.rst:145 +#: ../../library/dbm.rst:152 msgid "The individual submodules are described in the following sections." msgstr "" -#: ../../library/dbm.rst:148 +#: ../../library/dbm.rst:155 msgid ":mod:`dbm.sqlite3` --- SQLite backend for dbm" msgstr ":mod:`dbm.sqlite3` --- dbm 的 SQLite 後端" -#: ../../library/dbm.rst:156 +#: ../../library/dbm.rst:163 msgid "**Source code:** :source:`Lib/dbm/sqlite3.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/sqlite3.py`" -#: ../../library/dbm.rst:160 +#: ../../library/dbm.rst:167 msgid "" "This module uses the standard library :mod:`sqlite3` module to provide an " -"SQLite backend for the :mod:`dbm` module. The files created " -"by :mod:`dbm.sqlite3` can thus be opened by :mod:`sqlite3`, or any other " -"SQLite browser, including the SQLite CLI." +"SQLite backend for the :mod:`dbm` module. The files created by :mod:`dbm." +"sqlite3` can thus be opened by :mod:`sqlite3`, or any other SQLite browser, " +"including the SQLite CLI." msgstr "" #: ../../includes/wasm-mobile-notavail.rst:3 ../../includes/wasm-notavail.rst:3 @@ -263,39 +268,52 @@ msgstr "" "此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" "availability`。" -#: ../../library/dbm.rst:169 -msgid "" -"Open an SQLite database. The returned object behaves like a :term:`mapping`, " -"implements a :meth:`!close` method, and supports a \"closing\" context " -"manager via the :keyword:`with` keyword." -msgstr "" +#: ../../library/dbm.rst:176 +msgid "Open an SQLite database." +msgstr "打開一個 SQLite 資料庫。" -#: ../../library/dbm.rst:174 +#: ../../library/dbm.rst:178 msgid "The path to the database to be opened." msgstr "要打開的資料庫路徑" -#: ../../library/dbm.rst:185 +#: ../../library/dbm.rst:189 msgid "" "The Unix file access mode of the file (default: octal ``0o666``), used only " "when the database has to be created." msgstr "" -#: ../../library/dbm.rst:191 +#: ../../library/dbm.rst:193 +msgid "" +"The returned database object behaves similar to a mutable :term:`mapping`, " +"but the :meth:`!keys` method returns a list, and the :meth:`!setdefault` " +"method requires two arguments. It also supports a \"closing\" context " +"manager via the :keyword:`with` keyword." +msgstr "" + +#: ../../library/dbm.rst:198 ../../library/dbm.rst:399 +msgid "The following method is also provided:" +msgstr "也提供了以下方法:" + +#: ../../library/dbm.rst:202 +msgid "Close the SQLite database." +msgstr "關閉 SQLite 資料庫。" + +#: ../../library/dbm.rst:206 msgid ":mod:`dbm.gnu` --- GNU database manager" msgstr ":mod:`dbm.gnu` --- GNU 資料庫管理器" -#: ../../library/dbm.rst:197 +#: ../../library/dbm.rst:212 msgid "**Source code:** :source:`Lib/dbm/gnu.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/gnu.py`" -#: ../../library/dbm.rst:201 +#: ../../library/dbm.rst:216 msgid "" "The :mod:`dbm.gnu` module provides an interface to the :abbr:`GDBM (GNU " "dbm)` library, similar to the :mod:`dbm.ndbm` module, but with additional " "functionality like crash tolerance." msgstr "" -#: ../../library/dbm.rst:207 ../../library/dbm.rst:321 +#: ../../library/dbm.rst:222 ../../library/dbm.rst:342 msgid "" "The file formats created by :mod:`dbm.gnu` and :mod:`dbm.ndbm` are " "incompatible and can not be used interchangeably." @@ -309,18 +327,24 @@ msgstr "" "此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" "台 `\\ 上不支援。" -#: ../../library/dbm.rst:214 +#: ../../library/dbm.rst:229 +msgid "" +"Raised on :mod:`dbm.gnu`-specific errors, such as I/O errors. :exc:" +"`KeyError` is raised for general mapping errors like specifying an incorrect " +"key." +msgstr "" + +#: ../../library/dbm.rst:235 msgid "" -"Raised on :mod:`dbm.gnu`-specific errors, such as I/O " -"errors. :exc:`KeyError` is raised for general mapping errors like specifying " -"an incorrect key." +"A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` " +"supports." msgstr "" -#: ../../library/dbm.rst:220 +#: ../../library/dbm.rst:240 msgid "Open a GDBM database and return a :class:`!gdbm` object." msgstr "打開一個 GDBM 資料庫,並回傳一個 :class:`!gdbm` 物件。" -#: ../../library/dbm.rst:226 +#: ../../library/dbm.rst:246 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n| The following additional characters may be appended to " @@ -332,29 +356,29 @@ msgid "" "flag characters." msgstr "" -#: ../../library/dbm.rst:232 +#: ../../library/dbm.rst:252 msgid "" "The following additional characters may be appended to control how the " "database is opened:" msgstr "" -#: ../../library/dbm.rst:235 +#: ../../library/dbm.rst:255 msgid "" "``'f'``: Open the database in fast mode. Writes to the database will not be " "synchronized." msgstr "" -#: ../../library/dbm.rst:237 +#: ../../library/dbm.rst:257 msgid "" "``'s'``: Synchronized mode. Changes to the database will be written " "immediately to the file." msgstr "" -#: ../../library/dbm.rst:239 +#: ../../library/dbm.rst:259 msgid "``'u'``: Do not lock database." msgstr "``'u'``: 不要鎖住資料庫。" -#: ../../library/dbm.rst:241 +#: ../../library/dbm.rst:261 msgid "" "Not all flags are valid for all versions of GDBM. See the :data:`open_flags` " "member for a list of supported flag characters." @@ -364,24 +388,36 @@ msgstr "" msgid "Raises" msgstr "引發" -#: ../../library/dbm.rst:247 +#: ../../library/dbm.rst:267 msgid "If an invalid *flag* argument is passed." msgstr "如果一個無效的 *flag* 引數被傳入。" -#: ../../library/dbm.rst:255 +#: ../../library/dbm.rst:273 msgid "" -"A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` " -"supports." +":class:`!gdbm` objects behave similar to mutable :term:`mappings `, " +"but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`, " +"and :meth:`!update` are not supported, the :meth:`!keys` method returns a " +"list, and the :meth:`!setdefault` method requires two arguments. It also " +"supports a \"closing\" context manager via the :keyword:`with` keyword." msgstr "" -#: ../../library/dbm.rst:257 -msgid "" -":class:`!gdbm` objects behave similar to :term:`mappings `, " -"but :meth:`!items` and :meth:`!values` methods are not supported. The " -"following methods are also provided:" -msgstr "" +#: ../../library/dbm.rst:280 ../../library/dbm.rst:393 +msgid "Added the :meth:`!get` and :meth:`!setdefault` methods." +msgstr "新增了 :meth:`!get` 和 :meth:`!setdefault` 方法。" + +#: ../../library/dbm.rst:283 ../../library/dbm.rst:396 +msgid "Added the :meth:`!clear` method." +msgstr "新增了 :meth:`!clear` 方法。" + +#: ../../library/dbm.rst:286 ../../library/dbm.rst:479 +msgid "The following methods are also provided:" +msgstr "也提供了以下方法:" + +#: ../../library/dbm.rst:290 +msgid "Close the GDBM database." +msgstr "關閉 GDBM 資料庫。" -#: ../../library/dbm.rst:263 +#: ../../library/dbm.rst:294 msgid "" "It's possible to loop over every key in the database using this method and " "the :meth:`nextkey` method. The traversal is ordered by GDBM's internal " @@ -389,14 +425,14 @@ msgid "" "starting key." msgstr "" -#: ../../library/dbm.rst:270 +#: ../../library/dbm.rst:301 msgid "" "Returns the key that follows *key* in the traversal. The following code " "prints every key in the database ``db``, without having to create a list in " "memory that contains them all::" msgstr "" -#: ../../library/dbm.rst:274 +#: ../../library/dbm.rst:305 msgid "" "k = db.firstkey()\n" "while k is not None:\n" @@ -408,45 +444,37 @@ msgstr "" " print(k)\n" " k = db.nextkey(k)" -#: ../../library/dbm.rst:281 +#: ../../library/dbm.rst:312 msgid "" "If you have carried out a lot of deletions and would like to shrink the " -"space used by the GDBM file, this routine will reorganize the " -"database. :class:`!gdbm` objects will not shorten the length of a database " -"file except by using this reorganization; otherwise, deleted file space will " -"be kept and reused as new (key, value) pairs are added." +"space used by the GDBM file, this routine will reorganize the database. :" +"class:`!gdbm` objects will not shorten the length of a database file except " +"by using this reorganization; otherwise, deleted file space will be kept and " +"reused as new (key, value) pairs are added." msgstr "" -#: ../../library/dbm.rst:289 +#: ../../library/dbm.rst:320 msgid "" "When the database has been opened in fast mode, this method forces any " "unwritten data to be written to the disk." msgstr "" -#: ../../library/dbm.rst:294 -msgid "Close the GDBM database." -msgstr "關閉 GDBM 資料庫。" - -#: ../../library/dbm.rst:298 -msgid "Remove all items from the GDBM database." -msgstr "移除 GDBM 資料庫的所有項目。" - -#: ../../library/dbm.rst:304 +#: ../../library/dbm.rst:325 msgid ":mod:`dbm.ndbm` --- New Database Manager" msgstr ":mod:`dbm.ndbm` --- 新資料庫管理器" -#: ../../library/dbm.rst:310 +#: ../../library/dbm.rst:331 msgid "**Source code:** :source:`Lib/dbm/ndbm.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/ndbm.py`" -#: ../../library/dbm.rst:314 +#: ../../library/dbm.rst:335 msgid "" "The :mod:`dbm.ndbm` module provides an interface to the :abbr:`NDBM (New " "Database Manager)` library. This module can be used with the \"classic\" " "NDBM interface or the :abbr:`GDBM (GNU dbm)` compatibility interface." msgstr "" -#: ../../library/dbm.rst:326 +#: ../../library/dbm.rst:347 msgid "" "The NDBM library shipped as part of macOS has an undocumented limitation on " "the size of values, which can result in corrupted database files when " @@ -454,109 +482,104 @@ msgid "" "result in a hard crash (segmentation fault)." msgstr "" -#: ../../library/dbm.rst:335 +#: ../../library/dbm.rst:356 msgid "" -"Raised on :mod:`dbm.ndbm`-specific errors, such as I/O " -"errors. :exc:`KeyError` is raised for general mapping errors like specifying " -"an incorrect key." +"Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:" +"`KeyError` is raised for general mapping errors like specifying an incorrect " +"key." msgstr "" -#: ../../library/dbm.rst:341 +#: ../../library/dbm.rst:362 msgid "Name of the NDBM implementation library used." msgstr "" -#: ../../library/dbm.rst:346 +#: ../../library/dbm.rst:367 msgid "Open an NDBM database and return an :class:`!ndbm` object." msgstr "" -#: ../../library/dbm.rst:348 +#: ../../library/dbm.rst:369 msgid "" "The basename of the database file (without the :file:`.dir` or :file:`.pag` " "extensions)." msgstr "" -#: ../../library/dbm.rst:362 -msgid "" -":class:`!ndbm` objects behave similar to :term:`mappings `, " -"but :meth:`!items` and :meth:`!values` methods are not supported. The " -"following methods are also provided:" +#: ../../library/dbm.rst:383 +msgid "Accepts :term:`path-like object` for filename." msgstr "" -#: ../../library/dbm.rst:366 -msgid "Accepts :term:`path-like object` for filename." +#: ../../library/dbm.rst:386 +msgid "" +":class:`!ndbm` objects behave similar to mutable :term:`mappings `, " +"but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`, " +"and :meth:`!update` are not supported, the :meth:`!keys` method returns a " +"list, and the :meth:`!setdefault` method requires two arguments. It also " +"supports a \"closing\" context manager via the :keyword:`with` keyword." msgstr "" -#: ../../library/dbm.rst:371 +#: ../../library/dbm.rst:403 msgid "Close the NDBM database." msgstr "關閉 NDBM 資料庫。" -#: ../../library/dbm.rst:375 -msgid "Remove all items from the NDBM database." -msgstr "移除 NDBM 資料庫的所有項目。" - -#: ../../library/dbm.rst:381 +#: ../../library/dbm.rst:407 msgid ":mod:`dbm.dumb` --- Portable DBM implementation" msgstr ":mod:`dbm.dumb` --- 可攜式 DBM 實作" -#: ../../library/dbm.rst:386 +#: ../../library/dbm.rst:412 msgid "**Source code:** :source:`Lib/dbm/dumb.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/dumb.py`" -#: ../../library/dbm.rst:392 +#: ../../library/dbm.rst:418 msgid "" -"The :mod:`dbm.dumb` module is intended as a last resort fallback for " -"the :mod:`dbm` module when a more robust module is not available. " -"The :mod:`dbm.dumb` module is not written for speed and is not nearly as " -"heavily used as the other database modules." +"The :mod:`dbm.dumb` module is intended as a last resort fallback for the :" +"mod:`dbm` module when a more robust module is not available. The :mod:`dbm." +"dumb` module is not written for speed and is not nearly as heavily used as " +"the other database modules." msgstr "" -#: ../../library/dbm.rst:399 +#: ../../library/dbm.rst:425 msgid "" "The :mod:`dbm.dumb` module provides a persistent :class:`dict`-like " "interface which is written entirely in Python. Unlike other :mod:`dbm` " "backends, such as :mod:`dbm.gnu`, no external library is required." msgstr "" -#: ../../library/dbm.rst:404 +#: ../../library/dbm.rst:430 msgid "The :mod:`!dbm.dumb` module defines the following:" msgstr ":mod:`!dbm.dumb` 模組定義了以下項目:" -#: ../../library/dbm.rst:408 +#: ../../library/dbm.rst:434 msgid "" -"Raised on :mod:`dbm.dumb`-specific errors, such as I/O " -"errors. :exc:`KeyError` is raised for general mapping errors like " -"specifying an incorrect key." +"Raised on :mod:`dbm.dumb`-specific errors, such as I/O errors. :exc:" +"`KeyError` is raised for general mapping errors like specifying an incorrect " +"key." msgstr "" -#: ../../library/dbm.rst:414 -msgid "" -"Open a :mod:`!dbm.dumb` database. The returned database object behaves " -"similar to a :term:`mapping`, in addition to providing :meth:`~dumbdbm.sync` " -"and :meth:`~dumbdbm.close` methods." -msgstr "" +#: ../../library/dbm.rst:440 +msgid "Open a :mod:`!dbm.dumb` database." +msgstr "開啟一個 :mod:`!dbm.dumb` 資料庫。" -#: ../../library/dbm.rst:419 +#: ../../library/dbm.rst:442 msgid "" "The basename of the database file (without extensions). A new database " -"creates the following files: - :file:`{filename}.dat` " -"- :file:`{filename}.dir`" +"creates the following files: - :file:`{filename}.dat` - :file:`{filename}." +"dir`" msgstr "" -#: ../../library/dbm.rst:420 +#: ../../library/dbm.rst:443 msgid "" "The basename of the database file (without extensions). A new database " "creates the following files:" msgstr "" -#: ../../library/dbm.rst:423 +#: ../../library/dbm.rst:446 msgid ":file:`{filename}.dat`" msgstr ":file:`{filename}.dat`" -#: ../../library/dbm.rst:424 +#: ../../library/dbm.rst:447 msgid ":file:`{filename}.dir`" msgstr ":file:`{filename}.dir`" -#: ../../library/dbm.rst:427 +#: ../../library/dbm.rst:450 msgid "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" @@ -564,62 +587,50 @@ msgstr "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" -#: ../../library/dbm.rst:428 +#: ../../library/dbm.rst:451 msgid "``'r'``: |flag_r|" msgstr "``'r'``: |flag_r|" -#: ../../library/dbm.rst:430 +#: ../../library/dbm.rst:453 msgid "``'c'`` (default): |flag_c|" msgstr "``'c'`` (default): |flag_c|" -#: ../../library/dbm.rst:437 +#: ../../library/dbm.rst:460 msgid "" "It is possible to crash the Python interpreter when loading a database with " "a sufficiently large/complex entry due to stack depth limitations in " "Python's AST compiler." msgstr "" -#: ../../library/dbm.rst:441 +#: ../../library/dbm.rst:464 msgid "" ":func:`~dbm.dumb.open` always creates a new database when *flag* is ``'n'``." msgstr "" -#: ../../library/dbm.rst:444 +#: ../../library/dbm.rst:467 msgid "" "A database opened read-only if *flag* is ``'r'``. A database is not created " "if it does not exist if *flag* is ``'r'`` or ``'w'``." msgstr "" -#: ../../library/dbm.rst:451 +#: ../../library/dbm.rst:474 msgid "" -"In addition to the methods provided by " -"the :class:`collections.abc.MutableMapping` class, the following methods are " -"provided:" +"The returned database object behaves similar to a mutable :term:`mapping`, " +"but the :meth:`!keys` and :meth:`!items` methods return lists, and the :meth:" +"`!setdefault` method requires two arguments. It also supports a \"closing\" " +"context manager via the :keyword:`with` keyword." msgstr "" -#: ../../library/dbm.rst:457 +#: ../../library/dbm.rst:483 +msgid "Close the database." +msgstr "關閉資料庫。" + +#: ../../library/dbm.rst:487 msgid "" "Synchronize the on-disk directory and data files. This method is called by " "the :meth:`shelve.Shelf.sync` method." msgstr "" -#: ../../library/dbm.rst:462 -msgid "Close the database." -msgstr "關閉資料庫。" - -#: ../../library/dbm.rst:388 +#: ../../library/dbm.rst:414 msgid "databases" msgstr "databases(資料庫)" - -#~ msgid "" -#~ ":meth:`!clear` methods are now available for all :mod:`dbm` backends." -#~ msgstr ":meth:`!clear` 方法現在可用於所有 :mod:`dbm` 後端。" - -#~ msgid "Open an SQLite database." -#~ msgstr "打開一個 SQLite 資料庫。" - -#~ msgid "The following method is also provided:" -#~ msgstr "也提供了以下方法:" - -#~ msgid "Close the SQLite database." -#~ msgstr "關閉 SQLite 資料庫。" diff --git a/library/decimal.po b/library/decimal.po index 83b16cccf96..73debdf317e 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -1294,7 +1294,7 @@ msgstr "" #: ../../library/decimal.rst:946 msgid "For example::" -msgstr "" +msgstr "舉例來說: ::" #: ../../library/decimal.rst:948 msgid "" @@ -2008,11 +2008,11 @@ msgstr "``-1999999999999999997``" #: ../../library/decimal.rst:1586 msgid "``256``" -msgstr "" +msgstr "``256``" #: ../../library/decimal.rst:1586 msgid "``512``" -msgstr "" +msgstr "``512``" #: ../../library/decimal.rst:1591 msgid "" @@ -2322,6 +2322,18 @@ msgid "" ">>> u * (v+w)\n" "Decimal('0.0060000')" msgstr "" +">>> getcontext().prec = 20\n" +">>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n" +">>> (u + v) + w\n" +"Decimal('9.51111111')\n" +">>> u + (v + w)\n" +"Decimal('9.51111111')\n" +">>>\n" +">>> u, v, w = Decimal(20000), Decimal(-6), Decimal('6.0000003')\n" +">>> (u*v) + (u*w)\n" +"Decimal('0.0060000')\n" +">>> u * (v+w)\n" +"Decimal('0.0060000')" #: ../../library/decimal.rst:1839 msgid "Special values" diff --git a/library/dialog.po b/library/dialog.po index 9e4abefdb9b..cdacc53c2af 100644 --- a/library/dialog.po +++ b/library/dialog.po @@ -59,7 +59,7 @@ msgstr "" #: ../../library/dialog.rst:43 msgid ":mod:`tkinter.filedialog` --- File selection dialogs" -msgstr "" +msgstr ":mod:`tkinter.filedialog` --- 檔案選擇對話框" #: ../../library/dialog.rst:49 msgid "**Source code:** :source:`Lib/tkinter/filedialog.py`" diff --git a/library/difflib.po b/library/difflib.po index 3296ad6fc80..8db7c3d59af 100644 --- a/library/difflib.po +++ b/library/difflib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-08 00:17+0000\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2016-11-19 00:29+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -89,7 +89,7 @@ msgstr "" #: ../../library/difflib.rst:69 msgid "Code" -msgstr "" +msgstr "程式碼" #: ../../library/difflib.rst:69 ../../library/difflib.rst:496 msgid "Meaning" @@ -310,7 +310,7 @@ msgid "" "*linejunk*: A function that accepts a single string argument, and returns " "true if the string is junk, or false if not. The default is ``None``. There " "is also a module-level function :func:`IS_LINE_JUNK`, which filters out " -"lines without visible characters, except for at most one pound character " +"lines without visible characters, except for at most one hash character " "(``'#'``) -- however the underlying :class:`SequenceMatcher` class does a " "dynamic analysis of which lines are so frequent as to constitute noise, and " "this usually works better than using this function." diff --git a/library/dis.po b/library/dis.po index a786deae559..0f0a0863664 100644 --- a/library/dis.po +++ b/library/dis.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-10 20:44+0800\n" +"POT-Creation-Date: 2025-09-30 00:13+0000\n" "PO-Revision-Date: 2018-07-27 16:55+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -61,17 +61,17 @@ msgstr "" msgid "" "Some instructions are accompanied by one or more inline cache entries, which " "take the form of :opcode:`CACHE` instructions. These instructions are hidden " -"by default, but can be shown by passing ``show_caches=True`` to " -"any :mod:`dis` utility. Furthermore, the interpreter now adapts the bytecode " -"to specialize it for different runtime conditions. The adaptive bytecode can " -"be shown by passing ``adaptive=True``." +"by default, but can be shown by passing ``show_caches=True`` to any :mod:" +"`dis` utility. Furthermore, the interpreter now adapts the bytecode to " +"specialize it for different runtime conditions. The adaptive bytecode can be " +"shown by passing ``adaptive=True``." msgstr "" #: ../../library/dis.rst:45 msgid "" "The argument of a jump is the offset of the target instruction relative to " -"the instruction that appears immediately after the jump " -"instruction's :opcode:`CACHE` entries." +"the instruction that appears immediately after the jump instruction's :" +"opcode:`CACHE` entries." msgstr "" #: ../../library/dis.rst:50 @@ -187,9 +187,9 @@ msgstr "" #: ../../library/dis.rst:136 msgid "" -"The bytecode analysis API allows pieces of Python code to be wrapped in " -"a :class:`Bytecode` object that provides easy access to details of the " -"compiled code." +"The bytecode analysis API allows pieces of Python code to be wrapped in a :" +"class:`Bytecode` object that provides easy access to details of the compiled " +"code." msgstr "" #: ../../library/dis.rst:144 @@ -261,8 +261,8 @@ msgstr "" #: ../../library/dis.rst:188 msgid "" -"Return a formatted view of the bytecode operations (the same as printed " -"by :func:`dis.dis`, but returned as a multi-line string)." +"Return a formatted view of the bytecode operations (the same as printed by :" +"func:`dis.dis`, but returned as a multi-line string)." msgstr "" #: ../../library/dis.rst:193 @@ -487,10 +487,10 @@ msgstr "" #: ../../library/dis.rst:393 msgid "" -"This generator function uses the :meth:`~codeobject.co_lines` method of " -"the :ref:`code object ` *code* to find the offsets which are " -"starts of lines in the source code. They are generated as ``(offset, " -"lineno)`` pairs." +"This generator function uses the :meth:`~codeobject.co_lines` method of the :" +"ref:`code object ` *code* to find the offsets which are starts " +"of lines in the source code. They are generated as ``(offset, lineno)`` " +"pairs." msgstr "" #: ../../library/dis.rst:398 @@ -499,8 +499,8 @@ msgstr "" #: ../../library/dis.rst:401 msgid "" -"The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of " -"the :attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " +"The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of the :" +"attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " "attributes of the :ref:`code object `." msgstr "" @@ -687,30 +687,41 @@ msgid "" msgstr "" #: ../../library/dis.rst:590 +msgid "" +"Do nothing code. Used by the interpreter to record :monitoring-event:" +"`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT` events for :mod:`sys." +"monitoring`." +msgstr "" + +#: ../../library/dis.rst:599 +msgid "Removes the iterator from the top of the stack." +msgstr "" + +#: ../../library/dis.rst:606 msgid "Removes the top-of-stack item::" msgstr "" -#: ../../library/dis.rst:592 +#: ../../library/dis.rst:608 msgid "STACK.pop()" msgstr "STACK.pop()" -#: ../../library/dis.rst:597 +#: ../../library/dis.rst:613 msgid "" "Removes the top-of-stack item. Equivalent to ``POP_TOP``. Used to clean up " "at the end of loops, hence the name." msgstr "" -#: ../../library/dis.rst:606 +#: ../../library/dis.rst:622 msgid "Implements ``del STACK[-2]``. Used to clean up when a generator exits." msgstr "" -#: ../../library/dis.rst:614 +#: ../../library/dis.rst:630 msgid "" "Push the i-th item to the top of the stack without removing it from its " "original location::" msgstr "" -#: ../../library/dis.rst:617 +#: ../../library/dis.rst:633 msgid "" "assert i > 0\n" "STACK.append(STACK[-i])" @@ -718,15 +729,15 @@ msgstr "" "assert i > 0\n" "STACK.append(STACK[-i])" -#: ../../library/dis.rst:625 +#: ../../library/dis.rst:641 msgid "Swap the top of the stack with the i-th element::" msgstr "" -#: ../../library/dis.rst:627 +#: ../../library/dis.rst:643 msgid "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" msgstr "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" -#: ../../library/dis.rst:634 +#: ../../library/dis.rst:650 msgid "" "Rather than being an actual instruction, this opcode is used to mark extra " "space for the interpreter to cache useful data directly in the bytecode " @@ -734,86 +745,86 @@ msgid "" "viewed with ``show_caches=True``." msgstr "" -#: ../../library/dis.rst:639 +#: ../../library/dis.rst:655 msgid "" "Logically, this space is part of the preceding instruction. Many opcodes " "expect to be followed by an exact number of caches, and will instruct the " "interpreter to skip over them at runtime." msgstr "" -#: ../../library/dis.rst:643 +#: ../../library/dis.rst:659 msgid "" "Populated caches can look like arbitrary instructions, so great care should " "be taken when reading or modifying raw, adaptive bytecode containing " "quickened data." msgstr "" -#: ../../library/dis.rst:650 +#: ../../library/dis.rst:666 msgid "**Unary operations**" msgstr "" -#: ../../library/dis.rst:652 +#: ../../library/dis.rst:668 msgid "" "Unary operations take the top of the stack, apply the operation, and push " "the result back on the stack." msgstr "" -#: ../../library/dis.rst:658 +#: ../../library/dis.rst:674 msgid "Implements ``STACK[-1] = -STACK[-1]``." msgstr "實作 ``STACK[-1] = -STACK[-1]``。" -#: ../../library/dis.rst:663 +#: ../../library/dis.rst:679 msgid "Implements ``STACK[-1] = not STACK[-1]``." msgstr "實作 ``STACK[-1] = not STACK[-1]``。" -#: ../../library/dis.rst:665 ../../library/dis.rst:1372 -#: ../../library/dis.rst:1388 +#: ../../library/dis.rst:681 ../../library/dis.rst:1383 +#: ../../library/dis.rst:1399 msgid "This instruction now requires an exact :class:`bool` operand." msgstr "" -#: ../../library/dis.rst:671 +#: ../../library/dis.rst:687 msgid "Implements ``STACK[-1] = ~STACK[-1]``." msgstr "實作 ``STACK[-1] = ~STACK[-1]``。" -#: ../../library/dis.rst:676 +#: ../../library/dis.rst:692 msgid "Implements ``STACK[-1] = iter(STACK[-1])``." msgstr "實作 ``STACK[-1] = iter(STACK[-1])``。" -#: ../../library/dis.rst:681 +#: ../../library/dis.rst:697 msgid "" "If ``STACK[-1]`` is a :term:`generator iterator` or :term:`coroutine` object " "it is left as is. Otherwise, implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:689 +#: ../../library/dis.rst:705 msgid "Implements ``STACK[-1] = bool(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:694 +#: ../../library/dis.rst:710 msgid "**Binary and in-place operations**" msgstr "" -#: ../../library/dis.rst:696 +#: ../../library/dis.rst:712 msgid "" "Binary operations remove the top two items from the stack (``STACK[-1]`` and " "``STACK[-2]``). They perform the operation, then put the result back on the " "stack." msgstr "" -#: ../../library/dis.rst:699 +#: ../../library/dis.rst:715 msgid "" "In-place operations are like binary operations, but the operation is done in-" "place when ``STACK[-2]`` supports it, and the resulting ``STACK[-1]`` may be " "(but does not have to be) the original ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:706 +#: ../../library/dis.rst:722 msgid "" "Implements the binary and in-place operators (depending on the value of " "*op*)::" msgstr "" -#: ../../library/dis.rst:709 +#: ../../library/dis.rst:725 msgid "" "rhs = STACK.pop()\n" "lhs = STACK.pop()\n" @@ -823,22 +834,22 @@ msgstr "" "lhs = STACK.pop()\n" "STACK.append(lhs op rhs)" -#: ../../library/dis.rst:714 +#: ../../library/dis.rst:730 msgid "" "With oparg :``NB_SUBSCR``, implements binary subscript (replaces opcode " "``BINARY_SUBSCR``)" msgstr "" -#: ../../library/dis.rst:720 ../../library/dis.rst:730 -#: ../../library/dis.rst:738 ../../library/dis.rst:750 -#: ../../library/dis.rst:828 ../../library/dis.rst:838 -#: ../../library/dis.rst:848 ../../library/dis.rst:1054 -#: ../../library/dis.rst:1065 ../../library/dis.rst:1215 -#: ../../library/dis.rst:1227 ../../library/dis.rst:1239 +#: ../../library/dis.rst:736 ../../library/dis.rst:746 +#: ../../library/dis.rst:754 ../../library/dis.rst:766 +#: ../../library/dis.rst:844 ../../library/dis.rst:854 +#: ../../library/dis.rst:864 ../../library/dis.rst:1070 +#: ../../library/dis.rst:1081 ../../library/dis.rst:1226 +#: ../../library/dis.rst:1238 ../../library/dis.rst:1250 msgid "Implements::" msgstr "實作了: ::" -#: ../../library/dis.rst:722 +#: ../../library/dis.rst:738 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -850,7 +861,7 @@ msgstr "" "value = STACK.pop()\n" "container[key] = value" -#: ../../library/dis.rst:732 +#: ../../library/dis.rst:748 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -860,7 +871,7 @@ msgstr "" "container = STACK.pop()\n" "del container[key]" -#: ../../library/dis.rst:740 +#: ../../library/dis.rst:756 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -872,7 +883,7 @@ msgstr "" "container = STACK.pop()\n" "STACK.append(container[start:end])" -#: ../../library/dis.rst:752 +#: ../../library/dis.rst:768 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -886,11 +897,11 @@ msgstr "" "values = STACK.pop()\n" "container[start:end] = value" -#: ../../library/dis.rst:761 +#: ../../library/dis.rst:777 msgid "**Coroutine opcodes**" msgstr "" -#: ../../library/dis.rst:765 +#: ../../library/dis.rst:781 msgid "" "Implements ``STACK[-1] = get_awaitable(STACK[-1])``, where " "``get_awaitable(o)`` returns ``o`` if ``o`` is a coroutine object or a " @@ -898,39 +909,39 @@ msgid "" "resolves ``o.__await__``." msgstr "" -#: ../../library/dis.rst:770 +#: ../../library/dis.rst:786 msgid "" "If the ``where`` operand is nonzero, it indicates where the instruction " "occurs:" msgstr "" -#: ../../library/dis.rst:773 +#: ../../library/dis.rst:789 msgid "``1``: After a call to ``__aenter__``" msgstr "" -#: ../../library/dis.rst:774 +#: ../../library/dis.rst:790 msgid "``2``: After a call to ``__aexit__``" msgstr "" -#: ../../library/dis.rst:778 +#: ../../library/dis.rst:794 msgid "Previously, this instruction did not have an oparg." msgstr "" -#: ../../library/dis.rst:784 +#: ../../library/dis.rst:800 msgid "Implements ``STACK[-1] = STACK[-1].__aiter__()``." msgstr "" -#: ../../library/dis.rst:787 +#: ../../library/dis.rst:803 msgid "Returning awaitable objects from ``__aiter__`` is no longer supported." msgstr "" -#: ../../library/dis.rst:794 +#: ../../library/dis.rst:810 msgid "" "Implement ``STACK.append(get_awaitable(STACK[-1].__anext__()))`` to the " "stack. See ``GET_AWAITABLE`` for details about ``get_awaitable``." msgstr "" -#: ../../library/dis.rst:802 +#: ../../library/dis.rst:818 msgid "" "Terminates an :keyword:`async for` loop. Handles an exception raised when " "awaiting a next item. The stack contains the async iterable in ``STACK[-2]`` " @@ -938,25 +949,25 @@ msgid "" "is not :exc:`StopAsyncIteration`, it is re-raised." msgstr "" -#: ../../library/dis.rst:809 ../../library/dis.rst:900 -#: ../../library/dis.rst:911 +#: ../../library/dis.rst:825 ../../library/dis.rst:916 +#: ../../library/dis.rst:927 msgid "" "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:815 +#: ../../library/dis.rst:831 msgid "" -"Handles an exception raised during a :meth:`~generator.throw` " -"or :meth:`~generator.close` call through the current frame. If " -"``STACK[-1]`` is an instance of :exc:`StopIteration`, pop three values from " -"the stack and push its ``value`` member. Otherwise, re-raise ``STACK[-1]``." +"Handles an exception raised during a :meth:`~generator.throw` or :meth:" +"`~generator.close` call through the current frame. If ``STACK[-1]`` is an " +"instance of :exc:`StopIteration`, pop three values from the stack and push " +"its ``value`` member. Otherwise, re-raise ``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:824 +#: ../../library/dis.rst:840 msgid "**Miscellaneous opcodes**" msgstr "" -#: ../../library/dis.rst:830 +#: ../../library/dis.rst:846 msgid "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" @@ -964,11 +975,11 @@ msgstr "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" -#: ../../library/dis.rst:833 +#: ../../library/dis.rst:849 msgid "Used to implement set comprehensions." msgstr "" -#: ../../library/dis.rst:840 +#: ../../library/dis.rst:856 msgid "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" @@ -976,11 +987,11 @@ msgstr "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" -#: ../../library/dis.rst:843 +#: ../../library/dis.rst:859 msgid "Used to implement list comprehensions." msgstr "" -#: ../../library/dis.rst:850 +#: ../../library/dis.rst:866 msgid "" "value = STACK.pop()\n" "key = STACK.pop()\n" @@ -990,49 +1001,49 @@ msgstr "" "key = STACK.pop()\n" "dict.__setitem__(STACK[-i], key, value)" -#: ../../library/dis.rst:854 +#: ../../library/dis.rst:870 msgid "Used to implement dict comprehensions." msgstr "" -#: ../../library/dis.rst:857 +#: ../../library/dis.rst:873 msgid "" "Map value is ``STACK[-1]`` and map key is ``STACK[-2]``. Before, those were " "reversed." msgstr "" -#: ../../library/dis.rst:861 +#: ../../library/dis.rst:877 msgid "" -"For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` " -"and :opcode:`MAP_ADD` instructions, while the added value or key/value pair " -"is popped off, the container object remains on the stack so that it is " -"available for further iterations of the loop." +"For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` and :opcode:" +"`MAP_ADD` instructions, while the added value or key/value pair is popped " +"off, the container object remains on the stack so that it is available for " +"further iterations of the loop." msgstr "" -#: ../../library/dis.rst:869 +#: ../../library/dis.rst:885 msgid "Returns with ``STACK[-1]`` to the caller of the function." msgstr "" -#: ../../library/dis.rst:874 +#: ../../library/dis.rst:890 msgid "Yields ``STACK.pop()`` from a :term:`generator`." msgstr "" -#: ../../library/dis.rst:876 +#: ../../library/dis.rst:892 msgid "oparg set to be the stack depth." msgstr "" -#: ../../library/dis.rst:879 +#: ../../library/dis.rst:895 msgid "" "oparg set to be the exception block depth, for efficient closing of " "generators." msgstr "" -#: ../../library/dis.rst:882 +#: ../../library/dis.rst:898 msgid "" "oparg is ``1`` if this instruction is part of a yield-from or await, and " "``0`` otherwise." msgstr "" -#: ../../library/dis.rst:888 +#: ../../library/dis.rst:904 msgid "" "Checks whether ``__annotations__`` is defined in ``locals()``, if not it is " "set up to an empty ``dict``. This opcode is only emitted if a class or " @@ -1040,39 +1051,39 @@ msgid "" "statically." msgstr "" -#: ../../library/dis.rst:898 +#: ../../library/dis.rst:914 msgid "" "Pops a value from the stack, which is used to restore the exception state." msgstr "" -#: ../../library/dis.rst:905 +#: ../../library/dis.rst:921 msgid "" "Re-raises the exception currently on top of the stack. If oparg is non-zero, " -"pops an additional value from the stack which is used to " -"set :attr:`~frame.f_lasti` of the current frame." +"pops an additional value from the stack which is used to set :attr:`~frame." +"f_lasti` of the current frame." msgstr "" -#: ../../library/dis.rst:916 +#: ../../library/dis.rst:932 msgid "" "Pops a value from the stack. Pushes the current exception to the top of the " "stack. Pushes the value originally popped back to the stack. Used in " "exception handlers." msgstr "" -#: ../../library/dis.rst:924 +#: ../../library/dis.rst:940 msgid "" "Performs exception matching for ``except``. Tests whether the ``STACK[-2]`` " "is an exception matching ``STACK[-1]``. Pops ``STACK[-1]`` and pushes the " "boolean result of the test." msgstr "" -#: ../../library/dis.rst:932 +#: ../../library/dis.rst:948 msgid "" "Performs exception matching for ``except*``. Applies ``split(STACK[-1])`` on " "the exception group representing ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:935 +#: ../../library/dis.rst:951 msgid "" "In case of a match, pops two items from the stack and pushes the non-" "matching subgroup (``None`` in case of full match) followed by the matching " @@ -1080,7 +1091,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/dis.rst:944 +#: ../../library/dis.rst:960 msgid "" "Calls the function in position 4 on the stack with arguments (type, val, tb) " "representing the exception at the top of the stack. Used to implement the " @@ -1088,32 +1099,32 @@ msgid "" "occurred in a :keyword:`with` statement." msgstr "" -#: ../../library/dis.rst:951 +#: ../../library/dis.rst:967 msgid "" "The ``__exit__`` function is in position 4 of the stack rather than 7. " "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:958 +#: ../../library/dis.rst:974 msgid "" "Pushes a common constant onto the stack. The interpreter contains a " -"hardcoded list of constants supported by this instruction. Used by " -"the :keyword:`assert` statement to load :exc:`AssertionError`." +"hardcoded list of constants supported by this instruction. Used by the :" +"keyword:`assert` statement to load :exc:`AssertionError`." msgstr "" -#: ../../library/dis.rst:967 +#: ../../library/dis.rst:983 msgid "" "Pushes :func:`!builtins.__build_class__` onto the stack. It is later called " "to construct a class." msgstr "" -#: ../../library/dis.rst:972 +#: ../../library/dis.rst:988 msgid "" "Perform ``STACK.append(len(STACK[-1]))``. Used in :keyword:`match` " "statements where comparison with structure of pattern is needed." msgstr "" -#: ../../library/dis.rst:980 +#: ../../library/dis.rst:996 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Mapping` (or, " "more technically: if it has the :c:macro:`Py_TPFLAGS_MAPPING` flag set in " @@ -1121,7 +1132,7 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:990 +#: ../../library/dis.rst:1006 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Sequence` and is " "*not* an instance of :class:`str`/:class:`bytes`/:class:`bytearray` (or, " @@ -1130,42 +1141,40 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:1000 +#: ../../library/dis.rst:1016 msgid "" "``STACK[-1]`` is a tuple of mapping keys, and ``STACK[-2]`` is the match " -"subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push " -"a :class:`tuple` containing the corresponding values. Otherwise, push " -"``None``." +"subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push a :" +"class:`tuple` containing the corresponding values. Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:1006 ../../library/dis.rst:1753 +#: ../../library/dis.rst:1022 ../../library/dis.rst:1764 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." msgstr "" -#: ../../library/dis.rst:1013 +#: ../../library/dis.rst:1029 msgid "" "Implements ``name = STACK.pop()``. *namei* is the index of *name* in the " "attribute :attr:`~codeobject.co_names` of the :ref:`code object `. The compiler tries to use :opcode:`STORE_FAST` " -"or :opcode:`STORE_GLOBAL` if possible." +"objects>`. The compiler tries to use :opcode:`STORE_FAST` or :opcode:" +"`STORE_GLOBAL` if possible." msgstr "" -#: ../../library/dis.rst:1020 +#: ../../library/dis.rst:1036 msgid "" -"Implements ``del name``, where *namei* is the index " -"into :attr:`~codeobject.co_names` attribute of the :ref:`code object `." +"Implements ``del name``, where *namei* is the index into :attr:`~codeobject." +"co_names` attribute of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:1026 +#: ../../library/dis.rst:1042 msgid "" "Unpacks ``STACK[-1]`` into *count* individual values, which are put onto the " "stack right-to-left. Require there to be exactly *count* values.::" msgstr "" -#: ../../library/dis.rst:1029 +#: ../../library/dis.rst:1045 msgid "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" @@ -1173,7 +1182,7 @@ msgstr "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" -#: ../../library/dis.rst:1035 +#: ../../library/dis.rst:1051 msgid "" "Implements assignment with a starred target: Unpacks an iterable in " "``STACK[-1]`` into individual values, where the total number of values can " @@ -1181,11 +1190,11 @@ msgid "" "will be a list of all leftover items." msgstr "" -#: ../../library/dis.rst:1040 +#: ../../library/dis.rst:1056 msgid "The number of values before and after the list value is limited to 255." msgstr "" -#: ../../library/dis.rst:1042 +#: ../../library/dis.rst:1058 msgid "" "The number of values before the list value is encoded in the argument of the " "opcode. The number of values after the list if any is encoded using an " @@ -1194,13 +1203,13 @@ msgid "" "list value, the high byte of *counts* the number of values after it." msgstr "" -#: ../../library/dis.rst:1048 +#: ../../library/dis.rst:1064 msgid "" "The extracted values are put onto the stack right-to-left, i.e. ``a, *b, c = " "d`` will be stored after execution as ``STACK.extend((a, b, c))``." msgstr "" -#: ../../library/dis.rst:1056 +#: ../../library/dis.rst:1072 msgid "" "obj = STACK.pop()\n" "value = STACK.pop()\n" @@ -1210,13 +1219,13 @@ msgstr "" "value = STACK.pop()\n" "obj.name = value" -#: ../../library/dis.rst:1060 +#: ../../library/dis.rst:1076 msgid "" -"where *namei* is the index of name in :attr:`~codeobject.co_names` of " -"the :ref:`code object `." +"where *namei* is the index of name in :attr:`~codeobject.co_names` of the :" +"ref:`code object `." msgstr "" -#: ../../library/dis.rst:1067 +#: ../../library/dis.rst:1083 msgid "" "obj = STACK.pop()\n" "del obj.name" @@ -1224,48 +1233,43 @@ msgstr "" "obj = STACK.pop()\n" "del obj.name" -#: ../../library/dis.rst:1070 +#: ../../library/dis.rst:1086 msgid "" -"where *namei* is the index of name into :attr:`~codeobject.co_names` of " -"the :ref:`code object `." +"where *namei* is the index of name into :attr:`~codeobject.co_names` of the :" +"ref:`code object `." msgstr "" -#: ../../library/dis.rst:1076 +#: ../../library/dis.rst:1092 msgid "Works as :opcode:`STORE_NAME`, but stores the name as a global." msgstr "" -#: ../../library/dis.rst:1081 +#: ../../library/dis.rst:1097 msgid "Works as :opcode:`DELETE_NAME`, but deletes a global name." msgstr "" -#: ../../library/dis.rst:1086 +#: ../../library/dis.rst:1102 msgid "Pushes ``co_consts[consti]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1091 -msgid "" -"Works as :opcode:`LOAD_CONST`, but is more efficient for immortal objects." -msgstr "" - -#: ../../library/dis.rst:1096 +#: ../../library/dis.rst:1107 msgid "" "Pushes the integer ``i`` onto the stack. ``i`` must be in ``range(256)``" msgstr "" -#: ../../library/dis.rst:1104 +#: ../../library/dis.rst:1115 msgid "" "Pushes the value associated with ``co_names[namei]`` onto the stack. The " "name is looked up within the locals, then the globals, then the builtins." msgstr "" -#: ../../library/dis.rst:1110 +#: ../../library/dis.rst:1121 msgid "" "Pushes a reference to the locals dictionary onto the stack. This is used to " -"prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` " -"and :opcode:`LOAD_FROM_DICT_OR_GLOBALS`." +"prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` and :" +"opcode:`LOAD_FROM_DICT_OR_GLOBALS`." msgstr "" -#: ../../library/dis.rst:1119 +#: ../../library/dis.rst:1130 msgid "" "Pops a mapping off the stack and looks up the value for ``co_names[namei]``. " "If the name is not found there, looks it up in the globals and then the " @@ -1274,14 +1278,14 @@ msgid "" "bodies." msgstr "" -#: ../../library/dis.rst:1130 +#: ../../library/dis.rst:1141 msgid "" "Constructs a new :class:`~string.templatelib.Template` instance from a tuple " "of strings and a tuple of interpolations and pushes the resulting object " "onto the stack::" msgstr "" -#: ../../library/dis.rst:1134 +#: ../../library/dis.rst:1145 msgid "" "interpolations = STACK.pop()\n" "strings = STACK.pop()\n" @@ -1291,33 +1295,33 @@ msgstr "" "strings = STACK.pop()\n" "STACK.append(_build_template(strings, interpolations))" -#: ../../library/dis.rst:1143 +#: ../../library/dis.rst:1154 msgid "" "Constructs a new :class:`~string.templatelib.Interpolation` instance from a " "value and its source expression and pushes the resulting object onto the " "stack." msgstr "" -#: ../../library/dis.rst:1147 +#: ../../library/dis.rst:1158 msgid "" "If no conversion or format specification is present, ``format`` is set to " "``2``." msgstr "" -#: ../../library/dis.rst:1150 +#: ../../library/dis.rst:1161 msgid "" "If the low bit of ``format`` is set, it indicates that the interpolation " "contains a format specification." msgstr "" -#: ../../library/dis.rst:1153 +#: ../../library/dis.rst:1164 msgid "" "If ``format >> 2`` is non-zero, it indicates that the interpolation contains " "a conversion. The value of ``format >> 2`` is the conversion type (``0`` for " "no conversion, ``1`` for ``!s``, ``2`` for ``!r``, and ``3`` for ``!a``)::" msgstr "" -#: ../../library/dis.rst:1158 +#: ../../library/dis.rst:1169 msgid "" "conversion = format >> 2\n" "if format & 1:\n" @@ -1339,13 +1343,13 @@ msgstr "" "STACK.append(_build_interpolation(value, expression, conversion, " "format_spec))" -#: ../../library/dis.rst:1172 +#: ../../library/dis.rst:1183 msgid "" "Creates a tuple consuming *count* items from the stack, and pushes the " "resulting tuple onto the stack::" msgstr "" -#: ../../library/dis.rst:1175 +#: ../../library/dis.rst:1186 msgid "" "if count == 0:\n" " value = ()\n" @@ -1363,34 +1367,34 @@ msgstr "" "\n" "STACK.append(value)" -#: ../../library/dis.rst:1186 +#: ../../library/dis.rst:1197 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." msgstr "" -#: ../../library/dis.rst:1191 +#: ../../library/dis.rst:1202 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a set." msgstr "" -#: ../../library/dis.rst:1196 +#: ../../library/dis.rst:1207 msgid "" "Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so " "that the dictionary holds *count* entries: ``{..., STACK[-4]: STACK[-3], " "STACK[-2]: STACK[-1]}``." msgstr "" -#: ../../library/dis.rst:1200 +#: ../../library/dis.rst:1211 msgid "" "The dictionary is created from stack items instead of creating an empty " "dictionary pre-sized to hold *count* items." msgstr "" -#: ../../library/dis.rst:1207 +#: ../../library/dis.rst:1218 msgid "" "Concatenates *count* strings from the stack and pushes the resulting string " "onto the stack." msgstr "" -#: ../../library/dis.rst:1217 +#: ../../library/dis.rst:1228 msgid "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" @@ -1398,11 +1402,11 @@ msgstr "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" -#: ../../library/dis.rst:1220 +#: ../../library/dis.rst:1231 msgid "Used to build lists." msgstr "" -#: ../../library/dis.rst:1229 +#: ../../library/dis.rst:1240 msgid "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" @@ -1410,11 +1414,11 @@ msgstr "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" -#: ../../library/dis.rst:1232 +#: ../../library/dis.rst:1243 msgid "Used to build sets." msgstr "" -#: ../../library/dis.rst:1241 +#: ../../library/dis.rst:1252 msgid "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" @@ -1422,21 +1426,21 @@ msgstr "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" -#: ../../library/dis.rst:1244 +#: ../../library/dis.rst:1255 msgid "Used to build dicts." msgstr "" -#: ../../library/dis.rst:1251 +#: ../../library/dis.rst:1262 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." msgstr "" -#: ../../library/dis.rst:1258 +#: ../../library/dis.rst:1269 msgid "" "If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with " "``getattr(STACK[-1], co_names[namei>>1])``." msgstr "" -#: ../../library/dis.rst:1261 +#: ../../library/dis.rst:1272 msgid "" "If the low bit of ``namei`` is set, this will attempt to load a method named " "``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is " @@ -1448,140 +1452,140 @@ msgid "" "pushed." msgstr "" -#: ../../library/dis.rst:1270 +#: ../../library/dis.rst:1281 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is pushed to " "the stack before the attribute or unbound method respectively." msgstr "" -#: ../../library/dis.rst:1277 +#: ../../library/dis.rst:1288 msgid "" "This opcode implements :func:`super`, both in its zero-argument and two-" "argument forms (e.g. ``super().method()``, ``super().attr`` and ``super(cls, " "self).method()``, ``super(cls, self).attr``)." msgstr "" -#: ../../library/dis.rst:1281 +#: ../../library/dis.rst:1292 msgid "It pops three values from the stack (from top of stack down):" msgstr "" -#: ../../library/dis.rst:1283 +#: ../../library/dis.rst:1294 msgid "``self``: the first argument to the current method" msgstr "" -#: ../../library/dis.rst:1284 +#: ../../library/dis.rst:1295 msgid "``cls``: the class within which the current method was defined" msgstr "" -#: ../../library/dis.rst:1285 +#: ../../library/dis.rst:1296 msgid "the global ``super``" msgstr "" -#: ../../library/dis.rst:1287 +#: ../../library/dis.rst:1298 msgid "" "With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`, " "except that ``namei`` is shifted left by 2 bits instead of 1." msgstr "" -#: ../../library/dis.rst:1290 +#: ../../library/dis.rst:1301 msgid "" -"The low bit of ``namei`` signals to attempt a method load, as " -"with :opcode:`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded " -"method. When it is unset a single value is pushed to the stack." +"The low bit of ``namei`` signals to attempt a method load, as with :opcode:" +"`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded method. When " +"it is unset a single value is pushed to the stack." msgstr "" -#: ../../library/dis.rst:1294 +#: ../../library/dis.rst:1305 msgid "" "The second-low bit of ``namei``, if set, means that this was a two-argument " "call to :func:`super` (unset means zero-argument)." msgstr "" -#: ../../library/dis.rst:1302 +#: ../../library/dis.rst:1313 msgid "" "Performs a Boolean operation. The operation name can be found in " "``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set " "(``opname & 16``), the result should be coerced to ``bool``." msgstr "" -#: ../../library/dis.rst:1306 +#: ../../library/dis.rst:1317 msgid "" -"The fifth-lowest bit of the oparg now indicates a forced conversion " -"to :class:`bool`." +"The fifth-lowest bit of the oparg now indicates a forced conversion to :" +"class:`bool`." msgstr "" -#: ../../library/dis.rst:1313 +#: ../../library/dis.rst:1324 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1320 +#: ../../library/dis.rst:1331 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1327 +#: ../../library/dis.rst:1338 msgid "" "Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are " -"popped and provide the *fromlist* and *level* arguments " -"of :func:`__import__`. The module object is pushed onto the stack. The " -"current namespace is not affected: for a proper import statement, a " -"subsequent :opcode:`STORE_FAST` instruction modifies the namespace." +"popped and provide the *fromlist* and *level* arguments of :func:" +"`__import__`. The module object is pushed onto the stack. The current " +"namespace is not affected: for a proper import statement, a subsequent :" +"opcode:`STORE_FAST` instruction modifies the namespace." msgstr "" -#: ../../library/dis.rst:1335 +#: ../../library/dis.rst:1346 msgid "" "Loads the attribute ``co_names[namei]`` from the module found in " "``STACK[-1]``. The resulting object is pushed onto the stack, to be " "subsequently stored by a :opcode:`STORE_FAST` instruction." msgstr "" -#: ../../library/dis.rst:1342 +#: ../../library/dis.rst:1353 msgid "Increments bytecode counter by *delta*." msgstr "" -#: ../../library/dis.rst:1347 +#: ../../library/dis.rst:1358 msgid "Decrements bytecode counter by *delta*. Checks for interrupts." msgstr "" -#: ../../library/dis.rst:1354 +#: ../../library/dis.rst:1365 msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" -#: ../../library/dis.rst:1361 +#: ../../library/dis.rst:1372 msgid "" "If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1364 ../../library/dis.rst:1380 +#: ../../library/dis.rst:1375 ../../library/dis.rst:1391 msgid "" "The oparg is now a relative delta rather than an absolute target. This " "opcode is a pseudo-instruction, replaced in final bytecode by the directed " "versions (forward/backward)." msgstr "" -#: ../../library/dis.rst:1369 ../../library/dis.rst:1385 -#: ../../library/dis.rst:1398 ../../library/dis.rst:1409 +#: ../../library/dis.rst:1380 ../../library/dis.rst:1396 +#: ../../library/dis.rst:1409 ../../library/dis.rst:1420 msgid "This is no longer a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1377 +#: ../../library/dis.rst:1388 msgid "" "If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1393 +#: ../../library/dis.rst:1404 msgid "" "If ``STACK[-1]`` is not ``None``, increments the bytecode counter by " "*delta*. ``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1404 +#: ../../library/dis.rst:1415 msgid "" "If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1414 +#: ../../library/dis.rst:1425 msgid "" "``STACK[-1]`` is an :term:`iterator`. Call its :meth:`~iterator.__next__` " "method. If this yields a new value, push it on the stack (leaving the " @@ -1589,219 +1593,219 @@ msgid "" "code counter is incremented by *delta*." msgstr "" -#: ../../library/dis.rst:1419 +#: ../../library/dis.rst:1430 msgid "Up until 3.11 the iterator was popped when it was exhausted." msgstr "" -#: ../../library/dis.rst:1424 +#: ../../library/dis.rst:1435 msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1426 +#: ../../library/dis.rst:1437 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` is pushed to the stack " "before the global variable." msgstr "" -#: ../../library/dis.rst:1432 +#: ../../library/dis.rst:1443 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1434 +#: ../../library/dis.rst:1445 msgid "" "This opcode is now only used in situations where the local variable is " "guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`." msgstr "" -#: ../../library/dis.rst:1440 +#: ../../library/dis.rst:1451 msgid "" "Pushes a borrowed reference to the local ``co_varnames[var_num]`` onto the " "stack." msgstr "" -#: ../../library/dis.rst:1447 +#: ../../library/dis.rst:1458 msgid "" "Pushes references to ``co_varnames[var_nums >> 4]`` and " "``co_varnames[var_nums & 15]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1455 +#: ../../library/dis.rst:1466 msgid "" "Pushes borrowed references to ``co_varnames[var_nums >> 4]`` and " "``co_varnames[var_nums & 15]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1462 +#: ../../library/dis.rst:1473 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " "raising an :exc:`UnboundLocalError` if the local variable has not been " "initialized." msgstr "" -#: ../../library/dis.rst:1470 +#: ../../library/dis.rst:1481 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " "pushes ``NULL`` onto the stack if the local variable has not been " "initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" -#: ../../library/dis.rst:1478 +#: ../../library/dis.rst:1489 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1482 +#: ../../library/dis.rst:1493 msgid "" "Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]`` and ``STACK[-2]`` " "into ``co_varnames[var_nums & 15]``." msgstr "" -#: ../../library/dis.rst:1489 +#: ../../library/dis.rst:1500 msgid "" "Stores ``STACK.pop()`` into the local ``co_varnames[var_nums >> 4]`` and " "pushes a reference to the local ``co_varnames[var_nums & 15]`` onto the " "stack." msgstr "" -#: ../../library/dis.rst:1497 +#: ../../library/dis.rst:1508 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1502 +#: ../../library/dis.rst:1513 msgid "" "Creates a new cell in slot ``i``. If that slot is nonempty then that value " "is stored into the new cell." msgstr "" -#: ../../library/dis.rst:1510 +#: ../../library/dis.rst:1521 msgid "" "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" -#: ../../library/dis.rst:1513 ../../library/dis.rst:1535 -#: ../../library/dis.rst:1546 +#: ../../library/dis.rst:1524 ../../library/dis.rst:1546 +#: ../../library/dis.rst:1557 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -#: ../../library/dis.rst:1519 +#: ../../library/dis.rst:1530 msgid "" "Pops a mapping off the stack and looks up the name associated with slot " "``i`` of the \"fast locals\" storage in this mapping. If the name is not " -"found there, loads it from the cell contained in slot ``i``, similar " -"to :opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables " +"found there, loads it from the cell contained in slot ``i``, similar to :" +"opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables " "` in class bodies (which previously used :opcode:`!" "LOAD_CLASSDEREF`) and in :ref:`annotation scopes ` within " "class bodies." msgstr "" -#: ../../library/dis.rst:1532 +#: ../../library/dis.rst:1543 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1541 +#: ../../library/dis.rst:1552 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" -#: ../../library/dis.rst:1552 +#: ../../library/dis.rst:1563 msgid "" "Copies the ``n`` :term:`free (closure) variables ` from " "the closure into the frame. Removes the need for special code on the " "caller's side when calling closures." msgstr "" -#: ../../library/dis.rst:1561 +#: ../../library/dis.rst:1572 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: ../../library/dis.rst:1564 +#: ../../library/dis.rst:1575 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: ../../library/dis.rst:1565 +#: ../../library/dis.rst:1576 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1566 +#: ../../library/dis.rst:1577 msgid "" "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " "``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1572 +#: ../../library/dis.rst:1583 msgid "" "Calls a callable object with the number of arguments specified by ``argc``. " "On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1575 ../../library/dis.rst:1599 +#: ../../library/dis.rst:1586 ../../library/dis.rst:1610 msgid "The callable" msgstr "" -#: ../../library/dis.rst:1576 ../../library/dis.rst:1600 +#: ../../library/dis.rst:1587 ../../library/dis.rst:1611 msgid "``self`` or ``NULL``" msgstr "``self`` 或 ``NULL``" -#: ../../library/dis.rst:1577 ../../library/dis.rst:1601 +#: ../../library/dis.rst:1588 ../../library/dis.rst:1612 msgid "The remaining positional arguments" msgstr "剩餘的位置引數" -#: ../../library/dis.rst:1579 +#: ../../library/dis.rst:1590 msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -#: ../../library/dis.rst:1581 +#: ../../library/dis.rst:1592 msgid "" "``CALL`` pops all arguments and the callable object off the stack, calls the " "callable object with those arguments, and pushes the return value returned " "by the callable object." msgstr "" -#: ../../library/dis.rst:1587 +#: ../../library/dis.rst:1598 msgid "The callable now always appears at the same position on the stack." msgstr "" -#: ../../library/dis.rst:1590 +#: ../../library/dis.rst:1601 msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -#: ../../library/dis.rst:1596 +#: ../../library/dis.rst:1607 msgid "" "Calls a callable object with the number of arguments specified by ``argc``, " "including one or more named arguments. On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1602 +#: ../../library/dis.rst:1613 msgid "The named arguments" msgstr "" -#: ../../library/dis.rst:1603 +#: ../../library/dis.rst:1614 msgid "A :class:`tuple` of keyword argument names" msgstr "" -#: ../../library/dis.rst:1605 +#: ../../library/dis.rst:1616 msgid "" "``argc`` is the total of the positional and named arguments, excluding " "``self``. The length of the tuple of keyword argument names is the number of " "named arguments." msgstr "" -#: ../../library/dis.rst:1608 +#: ../../library/dis.rst:1619 msgid "" "``CALL_KW`` pops all arguments, the keyword names, and the callable object " "off the stack, calls the callable object with those arguments, and pushes " "the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1617 +#: ../../library/dis.rst:1628 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1813,33 +1817,33 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1632 +#: ../../library/dis.rst:1643 msgid "" "Pushes a ``NULL`` to the stack. Used in the call sequence to match the " -"``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." +"``NULL`` pushed by :opcode:`!LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1641 +#: ../../library/dis.rst:1652 msgid "" "Pushes a new function object on the stack built from the code object at " "``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:1643 +#: ../../library/dis.rst:1654 msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: ../../library/dis.rst:1646 +#: ../../library/dis.rst:1657 msgid "Qualified name at ``STACK[-1]`` was removed." msgstr "" -#: ../../library/dis.rst:1649 +#: ../../library/dis.rst:1660 msgid "" "Extra function attributes on the stack, signaled by oparg flags, were " "removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" -#: ../../library/dis.rst:1656 +#: ../../library/dis.rst:1667 msgid "" "Sets an attribute on a function object. Expects the function at " "``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " @@ -1847,42 +1851,42 @@ msgid "" "attribute to set:" msgstr "" -#: ../../library/dis.rst:1660 +#: ../../library/dis.rst:1671 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: ../../library/dis.rst:1662 +#: ../../library/dis.rst:1673 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: ../../library/dis.rst:1663 +#: ../../library/dis.rst:1674 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1664 +#: ../../library/dis.rst:1675 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: ../../library/dis.rst:1673 +#: ../../library/dis.rst:1684 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" -#: ../../library/dis.rst:1675 +#: ../../library/dis.rst:1686 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" -#: ../../library/dis.rst:1679 +#: ../../library/dis.rst:1690 msgid "if it is 3, implements::" msgstr "" -#: ../../library/dis.rst:1681 +#: ../../library/dis.rst:1692 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" @@ -1894,11 +1898,11 @@ msgstr "" "start = STACK.pop()\n" "STACK.append(slice(start, end, step))" -#: ../../library/dis.rst:1686 +#: ../../library/dis.rst:1697 msgid "See the :func:`slice` built-in function for more information." msgstr "" -#: ../../library/dis.rst:1691 +#: ../../library/dis.rst:1702 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " @@ -1906,11 +1910,11 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: ../../library/dis.rst:1699 +#: ../../library/dis.rst:1710 msgid "Convert value to a string, depending on ``oparg``::" msgstr "" -#: ../../library/dis.rst:1701 +#: ../../library/dis.rst:1712 msgid "" "value = STACK.pop()\n" "result = func(value)\n" @@ -1920,28 +1924,28 @@ msgstr "" "result = func(value)\n" "STACK.append(result)" -#: ../../library/dis.rst:1705 +#: ../../library/dis.rst:1716 msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" -#: ../../library/dis.rst:1706 +#: ../../library/dis.rst:1717 msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" -#: ../../library/dis.rst:1707 +#: ../../library/dis.rst:1718 msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" -#: ../../library/dis.rst:1709 ../../library/dis.rst:1722 -#: ../../library/dis.rst:1735 +#: ../../library/dis.rst:1720 ../../library/dis.rst:1733 +#: ../../library/dis.rst:1746 msgid "Used for implementing formatted string literals (f-strings)." msgstr "" -#: ../../library/dis.rst:1716 +#: ../../library/dis.rst:1727 msgid "Formats the value on top of stack::" msgstr "" -#: ../../library/dis.rst:1718 +#: ../../library/dis.rst:1729 msgid "" "value = STACK.pop()\n" "result = value.__format__(\"\")\n" @@ -1951,11 +1955,11 @@ msgstr "" "result = value.__format__(\"\")\n" "STACK.append(result)" -#: ../../library/dis.rst:1728 +#: ../../library/dis.rst:1739 msgid "Formats the given value with the given format spec::" msgstr "" -#: ../../library/dis.rst:1730 +#: ../../library/dis.rst:1741 msgid "" "spec = STACK.pop()\n" "value = STACK.pop()\n" @@ -1967,14 +1971,14 @@ msgstr "" "result = value.__format__(spec)\n" "STACK.append(result)" -#: ../../library/dis.rst:1742 +#: ../../library/dis.rst:1753 msgid "" "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " "class being matched against, and ``STACK[-3]`` is the match subject. " "*count* is the number of positional sub-patterns." msgstr "" -#: ../../library/dis.rst:1746 +#: ../../library/dis.rst:1757 msgid "" "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " "instance of ``STACK[-2]`` and has the positional and keyword attributes " @@ -1982,219 +1986,219 @@ msgid "" "Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:1760 +#: ../../library/dis.rst:1771 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -#: ../../library/dis.rst:1762 +#: ../../library/dis.rst:1773 msgid "" "The ``context`` operand consists of two parts. The lowest two bits indicate " "where the ``RESUME`` occurs:" msgstr "" -#: ../../library/dis.rst:1765 +#: ../../library/dis.rst:1776 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" -#: ../../library/dis.rst:1767 +#: ../../library/dis.rst:1778 msgid "``1`` After a ``yield`` expression" msgstr "" -#: ../../library/dis.rst:1768 +#: ../../library/dis.rst:1779 msgid "``2`` After a ``yield from`` expression" msgstr "" -#: ../../library/dis.rst:1769 +#: ../../library/dis.rst:1780 msgid "``3`` After an ``await`` expression" msgstr "" -#: ../../library/dis.rst:1771 +#: ../../library/dis.rst:1782 msgid "" "The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " "otherwise." msgstr "" -#: ../../library/dis.rst:1776 +#: ../../library/dis.rst:1787 msgid "The oparg value changed to include information about except-depth" msgstr "" -#: ../../library/dis.rst:1782 +#: ../../library/dis.rst:1793 msgid "" "Create a generator, coroutine, or async generator from the current frame. " "Used as first opcode of in code object for the above mentioned callables. " "Clear the current frame and return the newly created generator." msgstr "" -#: ../../library/dis.rst:1791 +#: ../../library/dis.rst:1802 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" -#: ../../library/dis.rst:1794 +#: ../../library/dis.rst:1805 msgid "" "If the call raises :exc:`StopIteration`, pop the top value from the stack, " "push the exception's ``value`` attribute, and increment the bytecode counter " "by *delta*." msgstr "" -#: ../../library/dis.rst:1803 +#: ../../library/dis.rst:1814 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes in the range [0,255] which don't use their argument and those that " "do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -#: ../../library/dis.rst:1807 +#: ../../library/dis.rst:1818 msgid "" "If your application uses pseudo instructions or specialized instructions, " "use the :data:`hasarg` collection instead." msgstr "" -#: ../../library/dis.rst:1810 +#: ../../library/dis.rst:1821 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -#: ../../library/dis.rst:1814 +#: ../../library/dis.rst:1825 msgid "" "Pseudo instructions were added to the :mod:`dis` module, and for them it is " "not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use " "their arg." msgstr "" -#: ../../library/dis.rst:1819 +#: ../../library/dis.rst:1830 msgid "Use :data:`hasarg` instead." msgstr "" -#: ../../library/dis.rst:1824 +#: ../../library/dis.rst:1835 msgid "" "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " "argument and sets ``STACK[-1]`` to the result. Used to implement " "functionality that is not performance critical." msgstr "" -#: ../../library/dis.rst:1828 ../../library/dis.rst:1882 +#: ../../library/dis.rst:1839 ../../library/dis.rst:1893 msgid "The operand determines which intrinsic function is called:" msgstr "" -#: ../../library/dis.rst:1831 ../../library/dis.rst:1885 +#: ../../library/dis.rst:1842 ../../library/dis.rst:1896 msgid "Operand" msgstr "運算元" -#: ../../library/dis.rst:1831 ../../library/dis.rst:1885 +#: ../../library/dis.rst:1842 ../../library/dis.rst:1896 msgid "Description" msgstr "描述" -#: ../../library/dis.rst:1833 +#: ../../library/dis.rst:1844 msgid "``INTRINSIC_1_INVALID``" msgstr "``INTRINSIC_1_INVALID``" -#: ../../library/dis.rst:1833 ../../library/dis.rst:1887 +#: ../../library/dis.rst:1844 ../../library/dis.rst:1898 msgid "Not valid" msgstr "" -#: ../../library/dis.rst:1835 +#: ../../library/dis.rst:1846 msgid "``INTRINSIC_PRINT``" msgstr "``INTRINSIC_PRINT``" -#: ../../library/dis.rst:1835 +#: ../../library/dis.rst:1846 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" -#: ../../library/dis.rst:1838 +#: ../../library/dis.rst:1849 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "``INTRINSIC_IMPORT_STAR``" -#: ../../library/dis.rst:1838 +#: ../../library/dis.rst:1849 msgid "Performs ``import *`` for the named module." msgstr "" -#: ../../library/dis.rst:1841 +#: ../../library/dis.rst:1852 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "``INTRINSIC_STOPITERATION_ERROR``" -#: ../../library/dis.rst:1841 +#: ../../library/dis.rst:1852 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: ../../library/dis.rst:1844 +#: ../../library/dis.rst:1855 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "``INTRINSIC_ASYNC_GEN_WRAP``" -#: ../../library/dis.rst:1844 +#: ../../library/dis.rst:1855 msgid "Wraps an async generator value" msgstr "" -#: ../../library/dis.rst:1846 +#: ../../library/dis.rst:1857 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "``INTRINSIC_UNARY_POSITIVE``" -#: ../../library/dis.rst:1846 +#: ../../library/dis.rst:1857 msgid "Performs the unary ``+`` operation" msgstr "" -#: ../../library/dis.rst:1849 +#: ../../library/dis.rst:1860 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "``INTRINSIC_LIST_TO_TUPLE``" -#: ../../library/dis.rst:1849 +#: ../../library/dis.rst:1860 msgid "Converts a list to a tuple" msgstr "" -#: ../../library/dis.rst:1851 +#: ../../library/dis.rst:1862 msgid "``INTRINSIC_TYPEVAR``" msgstr "``INTRINSIC_TYPEVAR``" -#: ../../library/dis.rst:1851 +#: ../../library/dis.rst:1862 msgid "Creates a :class:`typing.TypeVar`" msgstr "" -#: ../../library/dis.rst:1853 +#: ../../library/dis.rst:1864 msgid "``INTRINSIC_PARAMSPEC``" msgstr "``INTRINSIC_PARAMSPEC``" -#: ../../library/dis.rst:1853 +#: ../../library/dis.rst:1864 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" -#: ../../library/dis.rst:1856 +#: ../../library/dis.rst:1867 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "``INTRINSIC_TYPEVARTUPLE``" -#: ../../library/dis.rst:1856 +#: ../../library/dis.rst:1867 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" -#: ../../library/dis.rst:1859 +#: ../../library/dis.rst:1870 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "``INTRINSIC_SUBSCRIPT_GENERIC``" -#: ../../library/dis.rst:1859 +#: ../../library/dis.rst:1870 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" -#: ../../library/dis.rst:1862 +#: ../../library/dis.rst:1873 msgid "``INTRINSIC_TYPEALIAS``" msgstr "``INTRINSIC_TYPEALIAS``" -#: ../../library/dis.rst:1862 +#: ../../library/dis.rst:1873 msgid "" "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " "statement. The argument is a tuple of the type alias's name, type " "parameters, and value." msgstr "" -#: ../../library/dis.rst:1874 +#: ../../library/dis.rst:1885 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" -#: ../../library/dis.rst:1877 +#: ../../library/dis.rst:1888 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" @@ -2206,69 +2210,69 @@ msgstr "" "result = intrinsic2(arg1, arg2)\n" "STACK.append(result)" -#: ../../library/dis.rst:1887 +#: ../../library/dis.rst:1898 msgid "``INTRINSIC_2_INVALID``" msgstr "``INTRINSIC_2_INVALID``" -#: ../../library/dis.rst:1889 +#: ../../library/dis.rst:1900 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "``INTRINSIC_PREP_RERAISE_STAR``" -#: ../../library/dis.rst:1889 +#: ../../library/dis.rst:1900 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" -#: ../../library/dis.rst:1893 +#: ../../library/dis.rst:1904 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "``INTRINSIC_TYPEVAR_WITH_BOUND``" -#: ../../library/dis.rst:1893 +#: ../../library/dis.rst:1904 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" -#: ../../library/dis.rst:1896 +#: ../../library/dis.rst:1907 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -#: ../../library/dis.rst:1896 +#: ../../library/dis.rst:1907 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" -#: ../../library/dis.rst:1900 +#: ../../library/dis.rst:1911 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -#: ../../library/dis.rst:1900 +#: ../../library/dis.rst:1911 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -#: ../../library/dis.rst:1909 +#: ../../library/dis.rst:1920 msgid "" -"Performs special method lookup on ``STACK[-1]``. If " -"``type(STACK[-1]).__xxx__`` is a method, leave ``type(STACK[-1]).__xxx__; " -"STACK[-1]`` on the stack. If ``type(STACK[-1]).__xxx__`` is not a method, " -"leave ``STACK[-1].__xxx__; NULL`` on the stack." +"Performs special method lookup on ``STACK[-1]``. If ``type(STACK[-1])." +"__xxx__`` is a method, leave ``type(STACK[-1]).__xxx__; STACK[-1]`` on the " +"stack. If ``type(STACK[-1]).__xxx__`` is not a method, leave ``STACK[-1]." +"__xxx__; NULL`` on the stack." msgstr "" -#: ../../library/dis.rst:1918 +#: ../../library/dis.rst:1929 msgid "**Pseudo-instructions**" msgstr "" -#: ../../library/dis.rst:1920 +#: ../../library/dis.rst:1931 msgid "" "These opcodes do not appear in Python bytecode. They are used by the " "compiler but are replaced by real opcodes or removed before bytecode is " "generated." msgstr "" -#: ../../library/dis.rst:1925 +#: ../../library/dis.rst:1936 msgid "" "Set up an exception handler for the following code block. If an exception " "occurs, the value stack level is restored to its current state and control " "is transferred to the exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1932 +#: ../../library/dis.rst:1943 msgid "" "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " "instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " @@ -2277,98 +2281,96 @@ msgid "" "exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1941 +#: ../../library/dis.rst:1952 msgid "" "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " "from the stack before control is transferred to the exception handler at " "``target``." msgstr "" -#: ../../library/dis.rst:1945 +#: ../../library/dis.rst:1956 msgid "" "This variant is used in :keyword:`with` and :keyword:`async with` " -"constructs, which push the return value of the context " -"manager's :meth:`~object.__enter__` or :meth:`~object.__aenter__` to the " -"stack." +"constructs, which push the return value of the context manager's :meth:" +"`~object.__enter__` or :meth:`~object.__aenter__` to the stack." msgstr "" -#: ../../library/dis.rst:1952 +#: ../../library/dis.rst:1963 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -#: ../../library/dis.rst:1958 +#: ../../library/dis.rst:1969 +msgid "" +"Works as :opcode:`LOAD_CONST`, but is more efficient for immortal objects." +msgstr "" + +#: ../../library/dis.rst:1975 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" -#: ../../library/dis.rst:1964 +#: ../../library/dis.rst:1981 msgid "" "Conditional jumps which do not impact the stack. Replaced by the sequence " "``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``." msgstr "" -#: ../../library/dis.rst:1969 +#: ../../library/dis.rst:1986 msgid "" "Pushes a reference to the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1972 +#: ../../library/dis.rst:1989 msgid "" "Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." msgstr "" -#: ../../library/dis.rst:1974 +#: ../../library/dis.rst:1991 msgid "This opcode is now a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1980 -msgid "" -"Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode with a " -"flag set in the arg." -msgstr "" - -#: ../../library/dis.rst:1987 +#: ../../library/dis.rst:1998 msgid "Opcode collections" msgstr "" -#: ../../library/dis.rst:1989 +#: ../../library/dis.rst:2000 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: ../../library/dis.rst:1992 +#: ../../library/dis.rst:2003 msgid "" "The collections now contain pseudo instructions and instrumented " "instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " "and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" -#: ../../library/dis.rst:1999 +#: ../../library/dis.rst:2010 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: ../../library/dis.rst:2004 +#: ../../library/dis.rst:2015 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: ../../library/dis.rst:2009 +#: ../../library/dis.rst:2020 msgid "Sequence of all compare operation names." msgstr "" -#: ../../library/dis.rst:2014 +#: ../../library/dis.rst:2025 msgid "Sequence of bytecodes that use their argument." msgstr "" -#: ../../library/dis.rst:2021 +#: ../../library/dis.rst:2032 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: ../../library/dis.rst:2026 +#: ../../library/dis.rst:2037 msgid "" "Sequence of bytecodes that access a :term:`free (closure) variable `. 'free' in this context refers to names in the current scope that " @@ -2377,58 +2379,46 @@ msgid "" "scopes." msgstr "" -#: ../../library/dis.rst:2034 +#: ../../library/dis.rst:2045 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: ../../library/dis.rst:2039 +#: ../../library/dis.rst:2050 msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" -#: ../../library/dis.rst:2046 +#: ../../library/dis.rst:2057 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: ../../library/dis.rst:2051 +#: ../../library/dis.rst:2062 msgid "Sequence of bytecodes of Boolean operations." msgstr "" -#: ../../library/dis.rst:2055 +#: ../../library/dis.rst:2066 msgid "Sequence of bytecodes that set an exception handler." msgstr "" -#: ../../library/dis.rst:2062 +#: ../../library/dis.rst:2073 msgid "Sequence of bytecodes that have a relative jump target." msgstr "" -#: ../../library/dis.rst:2064 +#: ../../library/dis.rst:2075 msgid "All jumps are now relative. Use :data:`hasjump`." msgstr "" -#: ../../library/dis.rst:2070 +#: ../../library/dis.rst:2081 msgid "Sequence of bytecodes that have an absolute jump target." msgstr "" -#: ../../library/dis.rst:2072 +#: ../../library/dis.rst:2083 msgid "All jumps are now relative. This list is empty." msgstr "" -#: ../../library/dis.rst:1671 +#: ../../library/dis.rst:1682 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/dis.rst:1671 +#: ../../library/dis.rst:1682 msgid "slice" msgstr "slice(切片)" - -#~ msgid "" -#~ "key = STACK.pop()\n" -#~ "container = STACK.pop()\n" -#~ "STACK.append(container[key])" -#~ msgstr "" -#~ "key = STACK.pop()\n" -#~ "container = STACK.pop()\n" -#~ "STACK.append(container[key])" - -#~ msgid "STACK.extend((__aexit__, __aenter__())" -#~ msgstr "STACK.extend((__aexit__, __aenter__())" diff --git a/library/doctest.po b/library/doctest.po index 11f8553e6db..4b4508a442e 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -1315,6 +1315,12 @@ msgid "" ">>> print(f'{1000**0.1:.4f}') # much safer\n" "1.9953" msgstr "" +">>> 1000**0.1 # 有風險\n" +"1.9952623149688797\n" +">>> round(1000**0.1, 9) # 更安全\n" +"1.995262315\n" +">>> print(f'{1000**0.1:.4f}') # 更加安全\n" +"1.9953" #: ../../library/doctest.rst:887 msgid "" @@ -1327,6 +1333,8 @@ msgid "" ">>> 3./4 # utterly safe\n" "0.75" msgstr "" +">>> 3./4 # utterly safe\n" +"0.75" #: ../../library/doctest.rst:893 msgid "" diff --git a/library/email.compat32-message.po b/library/email.compat32-message.po index f7a5f594604..98b599220d2 100644 --- a/library/email.compat32-message.po +++ b/library/email.compat32-message.po @@ -704,7 +704,7 @@ msgstr "" #: ../../library/email.compat32-message.rst:554 msgid "``replace`` keyword was added." -msgstr "" +msgstr "新增 ``replace`` 關鍵字。" #: ../../library/email.compat32-message.rst:559 msgid "" diff --git a/library/email.message.po b/library/email.message.po index 3c38c5cd97a..776855ae1d7 100644 --- a/library/email.message.po +++ b/library/email.message.po @@ -483,7 +483,7 @@ msgstr "" #: ../../library/email.message.rst:384 msgid "``replace`` keyword was added." -msgstr "" +msgstr "新增 ``replace`` 關鍵字。" #: ../../library/email.message.rst:389 msgid "" diff --git a/library/enum.po b/library/enum.po index 23d76be0111..5262e18ad2a 100644 --- a/library/enum.po +++ b/library/enum.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-10-03 00:13+0000\n" "PO-Revision-Date: 2024-12-21 13:50+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -647,6 +647,7 @@ msgstr "" #: ../../library/enum.rst:318 msgid "" +">>> from enum import Enum\n" ">>> from datetime import date\n" ">>> class Weekday(Enum):\n" "... MONDAY = 1\n" @@ -664,6 +665,7 @@ msgid "" "['__class__', '__doc__', '__eq__', '__hash__', '__module__', 'name', " "'today', 'value']" msgstr "" +">>> from enum import Enum\n" ">>> from datetime import date\n" ">>> class Weekday(Enum):\n" "... MONDAY = 1\n" @@ -685,11 +687,11 @@ msgstr "" msgid "name" msgstr "name" -#: ../../library/enum.rst:336 +#: ../../library/enum.rst:337 msgid "The name of the member being defined (e.g. 'RED')." msgstr "定義的成員名稱(例如 'RED')。" -#: ../../library/enum.rst:337 +#: ../../library/enum.rst:338 msgid "The start value for the Enum; the default is 1." msgstr "列舉的開始值,預設為 1。" @@ -697,7 +699,7 @@ msgstr "列舉的開始值,預設為 1。" msgid "count" msgstr "count" -#: ../../library/enum.rst:338 +#: ../../library/enum.rst:339 msgid "The number of members currently defined, not including this one." msgstr "已定義的成員數量,不包含目前這一個。" @@ -705,19 +707,19 @@ msgstr "已定義的成員數量,不包含目前這一個。" msgid "last_values" msgstr "last_values" -#: ../../library/enum.rst:339 +#: ../../library/enum.rst:340 msgid "A list of the previous values." msgstr "一個之前值的串列。" -#: ../../library/enum.rst:341 +#: ../../library/enum.rst:342 msgid "" "A *staticmethod* that is used to determine the next value returned by :class:" "`auto`::" msgstr "一個 *staticmethod*,用來決定 :class:`auto` 下一個要回傳的值的: ::" -#: ../../library/enum.rst:344 +#: ../../library/enum.rst:345 msgid "" -">>> from enum import auto\n" +">>> from enum import auto, Enum\n" ">>> class PowersOfThree(Enum):\n" "... @staticmethod\n" "... def _generate_next_value_(name, start, count, last_values):\n" @@ -728,7 +730,7 @@ msgid "" ">>> PowersOfThree.SECOND.value\n" "9" msgstr "" -">>> from enum import auto\n" +">>> from enum import auto, Enum\n" ">>> class PowersOfThree(Enum):\n" "... @staticmethod\n" "... def _generate_next_value_(name, start, count, last_values):\n" @@ -739,7 +741,7 @@ msgstr "" ">>> PowersOfThree.SECOND.value\n" "9" -#: ../../library/enum.rst:357 +#: ../../library/enum.rst:358 msgid "" "By default, does nothing. If multiple values are given in the member " "assignment, those values become separate arguments to ``__init__``; e.g." @@ -747,19 +749,19 @@ msgstr "" "預設情況下,不執行任何操作。如果在成員賦值中給出多個值,這些值將成為與 " "``__init__`` 分別的引數;例如" -#: ../../library/enum.rst:364 +#: ../../library/enum.rst:365 msgid "" "``Weekday.__init__()`` would be called as ``Weekday.__init__(self, 1, " "'Mon')``" msgstr "``Weekday.__init__()`` 將被稱為 ``Weekday.__init__(self, 1, 'Mon')``" -#: ../../library/enum.rst:368 +#: ../../library/enum.rst:369 msgid "" "A *classmethod* that is used to further configure subsequent subclasses. By " "default, does nothing." msgstr "一個 *classmethod*,用來進一步設定後續的子類別,預設不做任何事。" -#: ../../library/enum.rst:373 +#: ../../library/enum.rst:374 msgid "" "A *classmethod* for looking up values not found in *cls*. By default it " "does nothing, but can be overridden to implement custom search behavior::" @@ -767,9 +769,9 @@ msgstr "" "一個 *classmethod*,用來查詢在 *cls* 裡找不到的值。預設不做任何事,但可以被覆" "寫以實作客製化的搜尋行為: ::" -#: ../../library/enum.rst:376 +#: ../../library/enum.rst:377 msgid "" -">>> from enum import StrEnum\n" +">>> from enum import auto, StrEnum\n" ">>> class Build(StrEnum):\n" "... DEBUG = auto()\n" "... OPTIMIZED = auto()\n" @@ -786,7 +788,7 @@ msgid "" ">>> Build('deBUG')\n" "" msgstr "" -">>> from enum import StrEnum\n" +">>> from enum import auto, StrEnum\n" ">>> class Build(StrEnum):\n" "... DEBUG = auto()\n" "... OPTIMIZED = auto()\n" @@ -803,7 +805,7 @@ msgstr "" ">>> Build('deBUG')\n" "" -#: ../../library/enum.rst:395 +#: ../../library/enum.rst:396 msgid "" "By default, doesn't exist. If specified, either in the enum class " "definition or in a mixin class (such as ``int``), all values given in the " @@ -812,12 +814,12 @@ msgstr "" "預設情況下不存在。如果有指定,無論是在列舉類別定義中還是在 mixin 類別中(例" "如 ``int``\\ ),都將傳遞成員賦值中給出的所有值;例如" -#: ../../library/enum.rst:403 +#: ../../library/enum.rst:404 msgid "" "results in the call ``int('1a', 16)`` and a value of ``26`` for the member." msgstr "會產生呼叫 ``int('1a', 16)`` 而該成員的值為 ``26``。" -#: ../../library/enum.rst:407 +#: ../../library/enum.rst:408 msgid "" "When writing a custom ``__new__``, do not use ``super().__new__`` -- call " "the appropriate ``__new__`` instead." @@ -825,7 +827,7 @@ msgstr "" "當寫自訂的 ``__new__`` 時,不要使用 ``super().__new__``,而是要呼叫適當的 " "``__new__``。" -#: ../../library/enum.rst:412 +#: ../../library/enum.rst:413 msgid "" "Returns the string used for *repr()* calls. By default, returns the *Enum* " "name, member name, and value, but can be overridden::" @@ -833,8 +835,9 @@ msgstr "" "回傳呼叫 *repr()* 時使用的字串。預設回傳 *Enum* 名稱、成員名稱及值,但可以被" "覆寫: ::" -#: ../../library/enum.rst:415 +#: ../../library/enum.rst:416 msgid "" +">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" "... OTHER = auto()\n" @@ -847,6 +850,7 @@ msgid "" "ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" msgstr "" +">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" "... OTHER = auto()\n" @@ -859,7 +863,7 @@ msgstr "" "ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" -#: ../../library/enum.rst:428 +#: ../../library/enum.rst:430 msgid "" "Returns the string used for *str()* calls. By default, returns the *Enum* " "name and member name, but can be overridden::" @@ -867,8 +871,9 @@ msgstr "" "回傳呼叫 *str()* 時使用的字串。預設回傳 *Enum* 名稱及成員名稱,但可以被覆" "寫: ::" -#: ../../library/enum.rst:431 +#: ../../library/enum.rst:433 msgid "" +">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" "... OTHER = auto()\n" @@ -880,6 +885,7 @@ msgid "" "ALTERNATE}\"\n" "(, 'ALTERNATE', 'ALTERNATE')" msgstr "" +">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" "... OTHER = auto()\n" @@ -891,7 +897,7 @@ msgstr "" "ALTERNATE}\"\n" "(, 'ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:443 +#: ../../library/enum.rst:446 msgid "" "Returns the string used for *format()* and *f-string* calls. By default, " "returns :meth:`__str__` return value, but can be overridden::" @@ -899,8 +905,9 @@ msgstr "" "回傳呼叫 *format()* 及 *f-string* 時使用的字串。預設回傳 :meth:`__str__` 的回" "傳值,但可以被覆寫: ::" -#: ../../library/enum.rst:446 +#: ../../library/enum.rst:449 msgid "" +">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" "... OTHER = auto()\n" @@ -912,6 +919,7 @@ msgid "" "ALTERNATE}\"\n" "(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" msgstr "" +">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" "... OTHER = auto()\n" @@ -923,21 +931,21 @@ msgstr "" "ALTERNATE}\"\n" "(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:458 +#: ../../library/enum.rst:462 msgid "" "Using :class:`auto` with :class:`Enum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`Enum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:461 +#: ../../library/enum.rst:465 msgid "Added :ref:`enum-dataclass-support`" msgstr "新增 :ref:`enum-dataclass-support`" -#: ../../library/enum.rst:465 +#: ../../library/enum.rst:469 msgid "Adds a new name as an alias to an existing member::" msgstr "新增一個名稱作為現有成員的別名: ::" -#: ../../library/enum.rst:467 +#: ../../library/enum.rst:471 msgid "" ">>> Color.RED._add_alias_(\"ERROR\")\n" ">>> Color.ERROR\n" @@ -947,17 +955,17 @@ msgstr "" ">>> Color.ERROR\n" "" -#: ../../library/enum.rst:471 +#: ../../library/enum.rst:475 msgid "" "Raises a :exc:`NameError` if the name is already assigned to a different " "member." msgstr "如果該名稱已經被指派給不同的成員,則會引發 :exc:`NameError`。" -#: ../../library/enum.rst:477 +#: ../../library/enum.rst:481 msgid "Adds a new value as an alias to an existing member::" msgstr "新增一個值作為現有成員的別名: ::" -#: ../../library/enum.rst:479 +#: ../../library/enum.rst:483 msgid "" ">>> Color.RED._add_value_alias_(42)\n" ">>> Color(42)\n" @@ -967,13 +975,13 @@ msgstr "" ">>> Color(42)\n" "" -#: ../../library/enum.rst:483 +#: ../../library/enum.rst:487 msgid "" "Raises a :exc:`ValueError` if the value is already linked with a different " "member." msgstr "如果該值已經被連結到不同的成員,則會引發 :exc:`ValueError`。" -#: ../../library/enum.rst:490 +#: ../../library/enum.rst:494 msgid "" "*IntEnum* is the same as :class:`Enum`, but its members are also integers " "and can be used anywhere that an integer can be used. If any integer " @@ -983,13 +991,13 @@ msgstr "" "*IntEnum* 和 :class:`Enum` 一樣,但其成員同時也是整數而可以被用在任何使用整數" "的地方。如果 *IntEnum* 成員經過任何整數運算,結果值會失去其列舉狀態。" -#: ../../library/enum.rst:511 +#: ../../library/enum.rst:515 msgid "" "Using :class:`auto` with :class:`IntEnum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`IntEnum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:514 +#: ../../library/enum.rst:518 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` was " @@ -999,7 +1007,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:521 +#: ../../library/enum.rst:525 msgid "" "*StrEnum* is the same as :class:`Enum`, but its members are also strings and " "can be used in most of the same places that a string can be used. The result " @@ -1009,7 +1017,7 @@ msgstr "" "*StrEnum* 和 :class:`Enum` 一樣,但其成員同時也是字串而可以被用在幾乎所有使用" "字串的地方。*StrEnum* 成員經過任何字串操作的結果會不再是列舉的一部份。" -#: ../../library/enum.rst:542 +#: ../../library/enum.rst:546 msgid "" "There are places in the stdlib that check for an exact :class:`str` instead " "of a :class:`str` subclass (i.e. ``type(unknown) == str`` instead of " @@ -1020,13 +1028,13 @@ msgstr "" "是 ``type(unknown) == str`` 而不是 ``isinstance(unknown, str)``),在這些地方" "你需要使用 ``str(MyStrEnum.MY_MEMBER)``。" -#: ../../library/enum.rst:549 +#: ../../library/enum.rst:553 msgid "" "Using :class:`auto` with :class:`StrEnum` results in the lower-cased member " "name as the value." msgstr ":class:`StrEnum` 使用 :class:`auto` 會產生小寫的成員名稱當作值。" -#: ../../library/enum.rst:554 +#: ../../library/enum.rst:558 msgid "" ":meth:`~object.__str__` is :meth:`!str.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` is " @@ -1036,7 +1044,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!str.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 也會是 :meth:`!str.__format__`。" -#: ../../library/enum.rst:562 +#: ../../library/enum.rst:566 msgid "" "``Flag`` is the same as :class:`Enum`, but its members support the bitwise " "operators ``&`` (*AND*), ``|`` (*OR*), ``^`` (*XOR*), and ``~`` (*INVERT*); " @@ -1046,11 +1054,11 @@ msgstr "" "(*OR*)、``^`` (*XOR*) 和 ``~`` (*INVERT*);這些操作的結果是列舉的成員(的別" "名)。" -#: ../../library/enum.rst:568 +#: ../../library/enum.rst:572 msgid "Returns *True* if value is in self::" msgstr "如果 value 在 self 裡則回傳 *True*: ::" -#: ../../library/enum.rst:570 +#: ../../library/enum.rst:574 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -1086,11 +1094,11 @@ msgstr "" ">>> white in purple\n" "False" -#: ../../library/enum.rst:589 +#: ../../library/enum.rst:593 msgid "Returns all contained non-alias members::" msgstr "回傳所有包含的非別名成員: ::" -#: ../../library/enum.rst:591 +#: ../../library/enum.rst:595 msgid "" ">>> list(Color.RED)\n" "[]\n" @@ -1102,11 +1110,11 @@ msgstr "" ">>> list(purple)\n" "[, ]" -#: ../../library/enum.rst:600 +#: ../../library/enum.rst:604 msgid "Returns number of members in flag::" msgstr "回傳旗標裡的成員數量: ::" -#: ../../library/enum.rst:602 +#: ../../library/enum.rst:606 msgid "" ">>> len(Color.GREEN)\n" "1\n" @@ -1118,11 +1126,11 @@ msgstr "" ">>> len(white)\n" "3" -#: ../../library/enum.rst:611 +#: ../../library/enum.rst:615 msgid "Returns *True* if any members in flag, *False* otherwise::" msgstr "如果成員在旗標裡則回傳 *True*,否則回傳 *False*: ::" -#: ../../library/enum.rst:613 +#: ../../library/enum.rst:617 msgid "" ">>> bool(Color.GREEN)\n" "True\n" @@ -1140,11 +1148,11 @@ msgstr "" ">>> bool(black)\n" "False" -#: ../../library/enum.rst:623 +#: ../../library/enum.rst:627 msgid "Returns current flag binary or'ed with other::" msgstr "回傳和 other 做 OR 過後的二進位旗標: ::" -#: ../../library/enum.rst:625 +#: ../../library/enum.rst:629 msgid "" ">>> Color.RED | Color.GREEN\n" "" @@ -1152,11 +1160,11 @@ msgstr "" ">>> Color.RED | Color.GREEN\n" "" -#: ../../library/enum.rst:630 +#: ../../library/enum.rst:634 msgid "Returns current flag binary and'ed with other::" msgstr "回傳和 other 做 AND 過後的二進位旗標: ::" -#: ../../library/enum.rst:632 +#: ../../library/enum.rst:636 msgid "" ">>> purple & white\n" "\n" @@ -1168,11 +1176,11 @@ msgstr "" ">>> purple & Color.GREEN\n" "" -#: ../../library/enum.rst:639 +#: ../../library/enum.rst:643 msgid "Returns current flag binary xor'ed with other::" msgstr "回傳和 other 做 XOR 過後的二進位旗標: ::" -#: ../../library/enum.rst:641 +#: ../../library/enum.rst:645 msgid "" ">>> purple ^ white\n" "\n" @@ -1184,11 +1192,11 @@ msgstr "" ">>> purple ^ Color.GREEN\n" "" -#: ../../library/enum.rst:648 +#: ../../library/enum.rst:652 msgid "Returns all the flags in *type(self)* that are not in *self*::" msgstr "回傳所有在 *type(self)* 但不在 *self* 裡的旗標: ::" -#: ../../library/enum.rst:650 +#: ../../library/enum.rst:654 msgid "" ">>> ~white\n" "\n" @@ -1204,7 +1212,7 @@ msgstr "" ">>> ~Color.RED\n" "" -#: ../../library/enum.rst:659 +#: ../../library/enum.rst:663 msgid "" "Function used to format any remaining unnamed numeric values. Default is " "the value's repr; common choices are :func:`hex` and :func:`oct`." @@ -1212,17 +1220,17 @@ msgstr "" "用來格式化任何剩下未命名數值的函式。預設是值的 repr,常見選擇是 :func:`hex` " "和 :func:`oct`。" -#: ../../library/enum.rst:664 +#: ../../library/enum.rst:668 msgid "" "Using :class:`auto` with :class:`Flag` results in integers that are powers " "of two, starting with ``1``." msgstr ":class:`Flag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:667 +#: ../../library/enum.rst:671 msgid "The *repr()* of zero-valued flags has changed. It is now:" msgstr "值為 0 的旗標的 *repr()* 已改變。現在是:" -#: ../../library/enum.rst:675 +#: ../../library/enum.rst:679 msgid "" "``IntFlag`` is the same as :class:`Flag`, but its members are also integers " "and can be used anywhere that an integer can be used." @@ -1230,13 +1238,13 @@ msgstr "" "``IntFlag`` 和 :class:`Flag` 一樣,但其成員同時也是整數而可以被用在任何使用整" "數的地方。" -#: ../../library/enum.rst:689 +#: ../../library/enum.rst:693 msgid "" "If any integer operation is performed with an *IntFlag* member, the result " "is not an *IntFlag*::" msgstr "如果 *IntFlag* 成員經過任何整數運算,其結果不是 *IntFlag*: ::" -#: ../../library/enum.rst:692 +#: ../../library/enum.rst:696 msgid "" ">>> Color.RED + 2\n" "3" @@ -1244,25 +1252,25 @@ msgstr "" ">>> Color.RED + 2\n" "3" -#: ../../library/enum.rst:695 +#: ../../library/enum.rst:699 msgid "If a :class:`Flag` operation is performed with an *IntFlag* member and:" msgstr "如果 *IntFlag* 成員經過 :class:`Flag` 操作且:" -#: ../../library/enum.rst:697 +#: ../../library/enum.rst:701 msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "結果是合法的 *IntFlag*:回傳 *IntFlag*" -#: ../../library/enum.rst:698 +#: ../../library/enum.rst:702 msgid "" "the result is not a valid *IntFlag*: the result depends on the :class:" "`FlagBoundary` setting" msgstr "結果不是合法的 *IntFlag*:結果會根據 :class:`FlagBoundary` 的設定" -#: ../../library/enum.rst:700 +#: ../../library/enum.rst:704 msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now::" msgstr "未命名且值為 0 的旗標的 :func:`repr` 已改變。現在是: ::" -#: ../../library/enum.rst:702 +#: ../../library/enum.rst:706 msgid "" ">>> Color(0)\n" "" @@ -1270,14 +1278,14 @@ msgstr "" ">>> Color(0)\n" "" -#: ../../library/enum.rst:707 +#: ../../library/enum.rst:711 msgid "" "Using :class:`auto` with :class:`IntFlag` results in integers that are " "powers of two, starting with ``1``." msgstr "" ":class:`IntFlag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:712 +#: ../../library/enum.rst:716 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` " @@ -1287,7 +1295,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:716 +#: ../../library/enum.rst:720 msgid "" "Inversion of an :class:`!IntFlag` now returns a positive value that is the " "union of all flags not in the given flag, rather than a negative value. This " @@ -1296,7 +1304,7 @@ msgstr "" ":class:`!IntFlag` 的反轉 (inversion) 現在會回傳正值,該值是不在給定旗標的所有" "旗標聯集,而不是一個負值。這符合現有 :class:`Flag` 的行為。" -#: ../../library/enum.rst:722 +#: ../../library/enum.rst:726 msgid "" ":class:`!ReprEnum` uses the :meth:`repr() ` of :class:`Enum`, " "but the :class:`str() ` of the mixed-in data type:" @@ -1304,15 +1312,15 @@ msgstr "" ":class:`!ReprEnum` 使用 :class:`Enum` 的 :meth:`repr() `,但使" "用混合資料型別的 :class:`str() `:" -#: ../../library/enum.rst:725 +#: ../../library/enum.rst:729 msgid ":meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`" msgstr "對 :class:`IntEnum` 和 :class:`IntFlag` 是 :meth:`!int.__str__`" -#: ../../library/enum.rst:726 +#: ../../library/enum.rst:730 msgid ":meth:`!str.__str__` for :class:`StrEnum`" msgstr "對 :class:`StrEnum` 是 :meth:`!str.__str__`" -#: ../../library/enum.rst:728 +#: ../../library/enum.rst:732 msgid "" "Inherit from :class:`!ReprEnum` to keep the :class:`str() ` / :func:" "`format` of the mixed-in data type instead of using the :class:`Enum`-" @@ -1321,7 +1329,7 @@ msgstr "" "繼承 :class:`!ReprEnum` 來保留混合資料型別的 :class:`str() ` / :func:" "`format`,而不是使用 :class:`Enum` 預設的 :meth:`str() `。" -#: ../../library/enum.rst:737 +#: ../../library/enum.rst:741 msgid "" "*EnumCheck* contains the options used by the :func:`verify` decorator to " "ensure various constraints; failed constraints result in a :exc:`ValueError`." @@ -1329,11 +1337,11 @@ msgstr "" "*EnumCheck* 包含 :func:`verify` 裝飾器使用的選項,以確保多樣的限制,不符合限" "制會產生 :exc:`ValueError`。" -#: ../../library/enum.rst:742 +#: ../../library/enum.rst:746 msgid "Ensure that each value has only one name::" msgstr "確保每個值只有一個名稱: ::" -#: ../../library/enum.rst:744 +#: ../../library/enum.rst:748 msgid "" ">>> from enum import Enum, verify, UNIQUE\n" ">>> @verify(UNIQUE)\n" @@ -1357,13 +1365,13 @@ msgstr "" "...\n" "ValueError: aliases found in : CRIMSON -> RED" -#: ../../library/enum.rst:758 +#: ../../library/enum.rst:762 msgid "" "Ensure that there are no missing values between the lowest-valued member and " "the highest-valued member::" msgstr "確保在最小值成員跟最大值成員間沒有缺少值: ::" -#: ../../library/enum.rst:761 +#: ../../library/enum.rst:765 msgid "" ">>> from enum import Enum, verify, CONTINUOUS\n" ">>> @verify(CONTINUOUS)\n" @@ -1385,7 +1393,7 @@ msgstr "" "...\n" "ValueError: invalid enum 'Color': missing values 3, 4" -#: ../../library/enum.rst:773 +#: ../../library/enum.rst:777 msgid "" "Ensure that any flag groups/masks contain only named flags -- useful when " "values are specified instead of being generated by :func:`auto`::" @@ -1393,7 +1401,7 @@ msgstr "" "確保任何旗標群組 / 遮罩只包含命名旗標 -- 當值是用指定而不是透過 :func:`auto` " "產生時是很實用的: ::" -#: ../../library/enum.rst:776 +#: ../../library/enum.rst:780 msgid "" ">>> from enum import Flag, verify, NAMED_FLAGS\n" ">>> @verify(NAMED_FLAGS)\n" @@ -1421,24 +1429,24 @@ msgstr "" "ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing " "combined values of 0x18 [use enum.show_flag_values(value) for details]" -#: ../../library/enum.rst:790 +#: ../../library/enum.rst:794 msgid "" "CONTINUOUS and NAMED_FLAGS are designed to work with integer-valued members." msgstr "CONTINUOUS 和 NAMED_FLAGS 是設計用來運作在整數值的成員上。" -#: ../../library/enum.rst:796 +#: ../../library/enum.rst:800 msgid "" "``FlagBoundary`` controls how out-of-range values are handled in :class:" "`Flag` and its subclasses." msgstr "``FlagBoundary`` 控制在 :class:`Flag` 及其子類別中如何處理範圍外的值。" -#: ../../library/enum.rst:801 +#: ../../library/enum.rst:805 msgid "" "Out-of-range values cause a :exc:`ValueError` to be raised. This is the " "default for :class:`Flag`::" msgstr "範圍外的值會引發 :exc:`ValueError`。這是 :class:`Flag` 的預設行為: ::" -#: ../../library/enum.rst:804 +#: ../../library/enum.rst:808 msgid "" ">>> from enum import Flag, STRICT, auto\n" ">>> class StrictFlag(Flag, boundary=STRICT):\n" @@ -1466,13 +1474,13 @@ msgstr "" " given 0b0 10100\n" " allowed 0b0 00111" -#: ../../library/enum.rst:819 +#: ../../library/enum.rst:823 msgid "" "Out-of-range values have invalid values removed, leaving a valid :class:" "`Flag` value::" msgstr "會移除範圍外的值中的非法值,留下合法的 :class:`Flag` 值: ::" -#: ../../library/enum.rst:822 +#: ../../library/enum.rst:826 msgid "" ">>> from enum import Flag, CONFORM, auto\n" ">>> class ConformFlag(Flag, boundary=CONFORM):\n" @@ -1492,13 +1500,13 @@ msgstr "" ">>> ConformFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:833 +#: ../../library/enum.rst:837 msgid "" "Out-of-range values lose their :class:`Flag` membership and revert to :class:" "`int`." msgstr "範圍外的值會失去它們的 :class:`Flag` 成員資格且恢復成 :class:`int`。" -#: ../../library/enum.rst:846 +#: ../../library/enum.rst:850 msgid "" "Out-of-range values are kept, and the :class:`Flag` membership is kept. This " "is the default for :class:`IntFlag`::" @@ -1506,7 +1514,7 @@ msgstr "" "範圍外的值會被保留,:class:`Flag` 成員資格也會被保留。這是 :class:`IntFlag` " "的預設行為: ::" -#: ../../library/enum.rst:849 +#: ../../library/enum.rst:853 msgid "" ">>> from enum import Flag, KEEP, auto\n" ">>> class KeepFlag(Flag, boundary=KEEP):\n" @@ -1526,7 +1534,7 @@ msgstr "" ">>> KeepFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:862 +#: ../../library/enum.rst:866 msgid "" "*EnumDict* is a subclass of :class:`dict` that is used as the namespace for " "defining enum classes (see :ref:`prepare`). It is exposed to allow " @@ -1540,7 +1548,7 @@ msgstr "" "如讓每個成員有多個值。它應該在被呼叫時帶上正在建立的列舉類別名稱,否則私有名" "稱和內部類別將無法被正確處理。" -#: ../../library/enum.rst:869 +#: ../../library/enum.rst:873 msgid "" "Note that only the :class:`~collections.abc.MutableMapping` interface (:meth:" "`~object.__setitem__` and :meth:`~dict.update`) is overridden. It may be " @@ -1551,15 +1559,15 @@ msgstr "" "__setitem__` 和 :meth:`~dict.update`)被覆寫。可能可以使用其他 :class:`!" "dict` 操作來繞過檢查,例如 :meth:`|= `。" -#: ../../library/enum.rst:876 +#: ../../library/enum.rst:880 msgid "A list of member names." msgstr "一個成員名稱的串列。" -#: ../../library/enum.rst:883 +#: ../../library/enum.rst:887 msgid "Supported ``__dunder__`` names" msgstr "支援的 ``__dunder__`` 名稱" -#: ../../library/enum.rst:885 +#: ../../library/enum.rst:889 msgid "" ":attr:`~EnumType.__members__` is a read-only ordered mapping of " "``member_name``:``member`` items. It is only available on the class." @@ -1567,7 +1575,7 @@ msgstr "" ":attr:`~EnumType.__members__` 是一個唯讀有序的\\ ``成員名稱``:``成員``\\ 項" "目的對映。只有在類別上可用。" -#: ../../library/enum.rst:888 +#: ../../library/enum.rst:892 msgid "" ":meth:`~Enum.__new__`, if specified, must create and return the enum " "members; it is also a very good idea to set the member's :attr:`!_value_` " @@ -1577,26 +1585,26 @@ msgstr "" "的 :attr:`!_value_` 也是一個很好的主意。一旦所有成員都建立之後就不會再被用" "到。" -#: ../../library/enum.rst:894 +#: ../../library/enum.rst:898 msgid "Supported ``_sunder_`` names" msgstr "支援的 ``_sunder_`` 名稱" -#: ../../library/enum.rst:896 +#: ../../library/enum.rst:900 msgid ":attr:`~Enum._name_` -- name of the member" msgstr ":attr:`~Enum._name_` -- 成員名稱" -#: ../../library/enum.rst:897 +#: ../../library/enum.rst:901 msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" msgstr ":attr:`~Enum._value_` -- 成員的值;可以在 ``__new__`` 設定" -#: ../../library/enum.rst:898 +#: ../../library/enum.rst:902 msgid "" ":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " "may be overridden" msgstr "" ":meth:`~Enum._missing_` -- 當值沒有被找到時會使用的查詢函式;可以被覆寫" -#: ../../library/enum.rst:900 +#: ../../library/enum.rst:904 msgid "" ":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" "class:`str`, that will not be transformed into members, and will be removed " @@ -1605,7 +1613,7 @@ msgstr "" ":attr:`~Enum._ignore_` -- 一個名稱的串列,可以是 :class:`list` 或 :class:" "`str`,它不會被轉換成成員,且在最後的類別上會被移除" -#: ../../library/enum.rst:903 +#: ../../library/enum.rst:907 msgid "" ":attr:`~Enum._order_` -- no longer used, kept for backward compatibility " "(class attribute, removed during class creation)" @@ -1613,40 +1621,40 @@ msgstr "" ":attr:`~Enum._order_` -- 不再被使用,僅為了向後相容而保留(類別屬性,在類別建" "立時移除)" -#: ../../library/enum.rst:905 +#: ../../library/enum.rst:909 msgid "" ":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " "an enum member; may be overridden" msgstr "" ":meth:`~Enum._generate_next_value_` -- 用來為列舉成員取得合適的值;可以被覆寫" -#: ../../library/enum.rst:910 +#: ../../library/enum.rst:914 msgid "" "For standard :class:`Enum` classes the next value chosen is the highest " "value seen incremented by one." msgstr "" "對標準的 :class:`Enum` 類別來說,下一個被選擇的值是所看過的最大值加一。" -#: ../../library/enum.rst:913 +#: ../../library/enum.rst:917 msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " "power-of-two." msgstr "" "對 :class:`Flag` 類別來說,下一個被選擇的值是下一個最大的 2 的次方的數字。" -#: ../../library/enum.rst:916 +#: ../../library/enum.rst:920 msgid "" ":meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing " "member." msgstr ":meth:`~Enum._add_alias_` -- 新增一個名稱作為現有成員的別名。" -#: ../../library/enum.rst:918 +#: ../../library/enum.rst:922 msgid "" ":meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an " "existing member." msgstr ":meth:`~Enum._add_value_alias_` -- 新增一個值作為現有成員的別名。" -#: ../../library/enum.rst:921 +#: ../../library/enum.rst:925 msgid "" "While ``_sunder_`` names are generally reserved for the further development " "of the :class:`Enum` class and can not be used, some are explicitly allowed:" @@ -1654,30 +1662,30 @@ msgstr "" "雖然 ``_sunder_`` 名稱通常保留用於 :class:`Enum` 類別的進一步開發而不能被使" "用,但有些是明確允許的:" -#: ../../library/enum.rst:924 +#: ../../library/enum.rst:928 msgid "" "``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" msgstr "" "``_repr_*``\\ (例如 ``_repr_html_``),例如用於 `IPython 的豐富顯示 " "`_" -#: ../../library/enum.rst:926 +#: ../../library/enum.rst:930 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "``_missing_``、``_order_``、``_generate_next_value_``" -#: ../../library/enum.rst:927 +#: ../../library/enum.rst:931 msgid "``_ignore_``" msgstr "``_ignore_``" -#: ../../library/enum.rst:928 +#: ../../library/enum.rst:932 msgid "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" msgstr "``_add_alias_``、``_add_value_alias_``、``_repr_*``" -#: ../../library/enum.rst:934 +#: ../../library/enum.rst:938 msgid "Utilities and Decorators" msgstr "通用項目與裝飾器" -#: ../../library/enum.rst:938 +#: ../../library/enum.rst:942 msgid "" "*auto* can be used in place of a value. If used, the *Enum* machinery will " "call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an " @@ -1693,16 +1701,16 @@ msgstr "" "`IntFlag` 來說,是第一個比最大值還大的 2 的次方的數字;對 :class:`StrEnum` 來" "說,是成員名稱的小寫版本。如果混用 *auto()* 和手動指定值的話要特別注意。" -#: ../../library/enum.rst:946 +#: ../../library/enum.rst:950 msgid "" "*auto* instances are only resolved when at the top level of an assignment:" msgstr "*auto* 實例只有在最上層的賦值時才會被解析:" -#: ../../library/enum.rst:948 +#: ../../library/enum.rst:952 msgid "``FIRST = auto()`` will work (auto() is replaced with ``1``);" msgstr "``FIRST = auto()`` 可以運作(auto() 會被取代成 ``1``)" -#: ../../library/enum.rst:949 +#: ../../library/enum.rst:953 msgid "" "``SECOND = auto(), -2`` will work (auto is replaced with ``2``, so ``2, -2`` " "is used to create the ``SECOND`` enum member;" @@ -1710,7 +1718,7 @@ msgstr "" "``SECOND = auto(), -2`` 可以運作(auto 會被取代成 ``2``, 因此 ``2, -2`` 會被" "用來建立列舉成員 ``SECOND``;" -#: ../../library/enum.rst:951 +#: ../../library/enum.rst:955 msgid "" "``THREE = [auto(), -3]`` will *not* work (``, -3`` is used to " "create the ``THREE`` enum member)" @@ -1718,19 +1726,19 @@ msgstr "" "``THREE = [auto(), -3]`` *無法*\\ 運作(\\ ``, -3`` 會被用來建立列" "舉成員 ``THREE``)" -#: ../../library/enum.rst:956 +#: ../../library/enum.rst:960 msgid "" "In prior versions, ``auto()`` had to be the only thing on the assignment " "line to work properly." msgstr "在之前的版本中,``auto()`` 必須是賦值行裡的唯一內容才能運作正確。" -#: ../../library/enum.rst:959 +#: ../../library/enum.rst:963 msgid "" "``_generate_next_value_`` can be overridden to customize the values used by " "*auto*." msgstr "可以覆寫 ``_generate_next_value_`` 來客製 *auto* 使用的值。" -#: ../../library/enum.rst:962 +#: ../../library/enum.rst:966 msgid "" "in 3.13 the default ``_generate_next_value_`` will always return the highest " "member value incremented by 1, and will fail if any member is an " @@ -1739,7 +1747,7 @@ msgstr "" "在 3.13 預設 ``_generate_next_value_`` 總是回傳最大的成員值加一,如果任何成員" "是不相容的型別就會失敗。" -#: ../../library/enum.rst:968 +#: ../../library/enum.rst:972 msgid "" "A decorator similar to the built-in *property*, but specifically for " "enumerations. It allows member attributes to have the same names as members " @@ -1748,7 +1756,7 @@ msgstr "" "和內建的 *property* 相似的裝飾器,但只專門針對列舉。它允許成員屬性和成員本身" "有相同名稱。" -#: ../../library/enum.rst:972 +#: ../../library/enum.rst:976 msgid "" "the *property* and the member must be defined in separate classes; for " "example, the *value* and *name* attributes are defined in the *Enum* class, " @@ -1758,7 +1766,7 @@ msgstr "" "*屬性*\\ 和成員必須定義在分開的類別裡;例如 *value* 和 *name* 屬性定義在 " "*Enum* 類別而 *Enum* 子類別可以定義成員名稱為 ``value`` 和 ``name``。" -#: ../../library/enum.rst:981 +#: ../../library/enum.rst:985 msgid "" "A :keyword:`class` decorator specifically for enumerations. It searches an " "enumeration's :attr:`~EnumType.__members__`, gathering any aliases it finds; " @@ -1768,7 +1776,7 @@ msgstr "" "__members__`,蒐集任何它找到的別名;如果有找到任何別名則引發 :exc:" "`ValueError` 並附上細節: ::" -#: ../../library/enum.rst:985 +#: ../../library/enum.rst:989 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -1794,7 +1802,7 @@ msgstr "" "...\n" "ValueError: duplicate values found in : FOUR -> THREE" -#: ../../library/enum.rst:999 +#: ../../library/enum.rst:1003 msgid "" "A :keyword:`class` decorator specifically for enumerations. Members from :" "class:`EnumCheck` are used to specify which constraints should be checked on " @@ -1803,15 +1811,15 @@ msgstr "" "專門針對列舉的 :keyword:`class` 裝飾器。使用 :class:`EnumCheck` 裡的成員來指" "定在裝飾的列舉上應該檢查什麼限制。" -#: ../../library/enum.rst:1007 +#: ../../library/enum.rst:1011 msgid "A decorator for use in enums: its target will become a member." msgstr "列舉所使用的裝飾器:其目標會變成成員。" -#: ../../library/enum.rst:1013 +#: ../../library/enum.rst:1017 msgid "A decorator for use in enums: its target will not become a member." msgstr "列舉所使用的裝飾器:其目標不會變成成員。" -#: ../../library/enum.rst:1019 +#: ../../library/enum.rst:1023 msgid "" "A decorator to change the :class:`str() ` and :func:`repr` of an enum " "to show its members as belonging to the module instead of its class. Should " @@ -1822,19 +1830,19 @@ msgstr "" "組而不是其類別。應該只有當列舉成員被匯出到模組的全域命名空間才使用(範例請參" "考 :class:`re.RegexFlag`)。" -#: ../../library/enum.rst:1029 +#: ../../library/enum.rst:1033 msgid "Return a list of all power-of-two integers contained in a flag *value*." msgstr "回傳在旗標\\ *值*\\ 中包含的所有 2 的次方的整數串列。" -#: ../../library/enum.rst:1036 +#: ../../library/enum.rst:1040 msgid "Notes" msgstr "備註" -#: ../../library/enum.rst:1038 +#: ../../library/enum.rst:1042 msgid ":class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag`" msgstr ":class:`IntEnum`、:class:`StrEnum` 及 :class:`IntFlag`" -#: ../../library/enum.rst:1040 +#: ../../library/enum.rst:1044 msgid "" "These three enum types are designed to be drop-in replacements for existing " "integer- and string-based values; as such, they have extra limitations:" @@ -1842,17 +1850,17 @@ msgstr "" "這三種列舉型別是設計來直接取代現有以整數及字串為基底的值;因此它們有額外的限" "制:" -#: ../../library/enum.rst:1043 +#: ../../library/enum.rst:1047 msgid "``__str__`` uses the value and not the name of the enum member" msgstr "``__str__`` 使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:1045 +#: ../../library/enum.rst:1049 msgid "" "``__format__``, because it uses ``__str__``, will also use the value of the " "enum member instead of its name" msgstr "``__format__`` 因為使用 ``__str__``,也會使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:1048 +#: ../../library/enum.rst:1052 msgid "" "If you do not need/want those limitations, you can either create your own " "base class by mixing in the ``int`` or ``str`` type yourself::" @@ -1860,7 +1868,7 @@ msgstr "" "如果你不需要或不想要這些限制,你可以透過混合 ``int`` 或 ``str`` 型別來建立自" "己的基礎類別: ::" -#: ../../library/enum.rst:1051 +#: ../../library/enum.rst:1055 msgid "" ">>> from enum import Enum\n" ">>> class MyIntEnum(int, Enum):\n" @@ -1870,11 +1878,11 @@ msgstr "" ">>> class MyIntEnum(int, Enum):\n" "... pass" -#: ../../library/enum.rst:1055 +#: ../../library/enum.rst:1059 msgid "or you can reassign the appropriate :meth:`str`, etc., in your enum::" msgstr "或者你也可以在你的列舉重新給定合適的 :meth:`str`: ::" -#: ../../library/enum.rst:1057 +#: ../../library/enum.rst:1061 msgid "" ">>> from enum import Enum, IntEnum\n" ">>> class MyIntEnum(IntEnum):\n" diff --git a/library/exceptions.po b/library/exceptions.po index a928b9ed964..304ba827ae9 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -839,7 +839,7 @@ msgid "" "attribute: ('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))." msgstr "" "對於發生在 f-string 欄位的錯誤,訊息會以 \"f-string: \" 為前綴,而偏移量 " -"(offset) 是從替代表達式建構的文字的偏移量。例如編譯 f'Bad {a b} field' 會得到" +"(offset) 是從替代運算式建構的文字的偏移量。例如編譯 f'Bad {a b} field' 會得到" "這個 args 屬性:('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))。" #: ../../library/exceptions.rst:560 diff --git a/library/fractions.po b/library/fractions.po index 722ae18f1a3..03799a18f94 100644 --- a/library/fractions.po +++ b/library/fractions.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2016-01-31 07:18+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,30 +32,30 @@ msgstr "" #: ../../library/fractions.rst:17 msgid "" -"A Fraction instance can be constructed from a pair of integers, from another " -"rational number, or from a string." +"A Fraction instance can be constructed from a pair of rational numbers, from " +"a single number, or from a string." msgstr "" #: ../../library/fractions.rst:26 msgid "" "The first version requires that *numerator* and *denominator* are instances " "of :class:`numbers.Rational` and returns a new :class:`Fraction` instance " -"with value ``numerator/denominator``. If *denominator* is ``0``, it raises " -"a :exc:`ZeroDivisionError`." +"with a value equal to ``numerator/denominator``. If *denominator* is zero, " +"it raises a :exc:`ZeroDivisionError`." msgstr "" #: ../../library/fractions.rst:31 msgid "" -"The second version requires that *number* is an instance " -"of :class:`numbers.Rational` or has the :meth:`!as_integer_ratio` method " -"(this includes :class:`float` and :class:`decimal.Decimal`). It returns " -"a :class:`Fraction` instance with exactly the same value. Assumed, that " -"the :meth:`!as_integer_ratio` method returns a pair of coprime integers and " -"last one is positive. Note that due to the usual issues with binary point " -"(see :ref:`tut-fp-issues`), the argument to ``Fraction(1.1)`` is not exactly " -"equal to 11/10, and so ``Fraction(1.1)`` does *not* return ``Fraction(11, " -"10)`` as one might expect. (But see the documentation for " -"the :meth:`limit_denominator` method below.)" +"The second version requires that *number* is an instance of :class:`numbers." +"Rational` or has the :meth:`!as_integer_ratio` method (this includes :class:" +"`float` and :class:`decimal.Decimal`). It returns a :class:`Fraction` " +"instance with exactly the same value. Assumed, that the :meth:`!" +"as_integer_ratio` method returns a pair of coprime integers and last one is " +"positive. Note that due to the usual issues with binary point (see :ref:`tut-" +"fp-issues`), the argument to ``Fraction(1.1)`` is not exactly equal to " +"11/10, and so ``Fraction(1.1)`` does *not* return ``Fraction(11, 10)`` as " +"one might expect. (But see the documentation for the :meth:" +"`limit_denominator` method below.)" msgstr "" #: ../../library/fractions.rst:43 @@ -73,10 +73,10 @@ msgid "" "where the optional ``sign`` may be either '+' or '-' and ``numerator`` and " "``denominator`` (if present) are strings of decimal digits (underscores may " "be used to delimit digits as with integral literals in code). In addition, " -"any string that represents a finite value and is accepted by " -"the :class:`float` constructor is also accepted by the :class:`Fraction` " -"constructor. In either form the input string may also have leading and/or " -"trailing whitespace. Here are some examples::" +"any string that represents a finite value and is accepted by the :class:" +"`float` constructor is also accepted by the :class:`Fraction` constructor. " +"In either form the input string may also have leading and/or trailing " +"whitespace. Here are some examples::" msgstr "" #: ../../library/fractions.rst:57 @@ -133,20 +133,20 @@ msgstr "" #: ../../library/fractions.rst:83 msgid "" -"The :class:`Fraction` class inherits from the abstract base " -"class :class:`numbers.Rational`, and implements all of the methods and " -"operations from that class. :class:`Fraction` instances " -"are :term:`hashable`, and should be treated as immutable. In " -"addition, :class:`Fraction` has the following properties and methods:" +"The :class:`Fraction` class inherits from the abstract base class :class:" +"`numbers.Rational`, and implements all of the methods and operations from " +"that class. :class:`Fraction` instances are :term:`hashable`, and should be " +"treated as immutable. In addition, :class:`Fraction` has the following " +"properties and methods:" msgstr "" #: ../../library/fractions.rst:89 msgid "" -"The :class:`Fraction` constructor now accepts :class:`float` " -"and :class:`decimal.Decimal` instances." +"The :class:`Fraction` constructor now accepts :class:`float` and :class:" +"`decimal.Decimal` instances." msgstr "" -":class:`Fraction` 建構函式現在可接受 :class:`float` " -"和 :class:`decimal.Decimal` 實例。" +":class:`Fraction` 建構函式現在可接受 :class:`float` 和 :class:`decimal." +"Decimal` 實例。" #: ../../library/fractions.rst:93 msgid "" @@ -163,8 +163,8 @@ msgstr "" #: ../../library/fractions.rst:102 msgid "" -":class:`Fraction` implements ``__int__`` now to satisfy " -"``typing.SupportsInt`` instance checks." +":class:`Fraction` implements ``__int__`` now to satisfy ``typing." +"SupportsInt`` instance checks." msgstr "" #: ../../library/fractions.rst:106 @@ -190,99 +190,100 @@ msgid "" "The :class:`Fraction` constructor now accepts any objects with the :meth:`!" "as_integer_ratio` method." msgstr "" -":class:`Fraction` 建構函式現在可接受任何具有 :meth:`!as_integer_ratio` 方法的物件。" +":class:`Fraction` 建構函式現在可接受任何具有 :meth:`!as_integer_ratio` 方法的" +"物件。" #: ../../library/fractions.rst:124 msgid "Numerator of the Fraction in lowest term." msgstr "" #: ../../library/fractions.rst:128 -msgid "Denominator of the Fraction in lowest term." +msgid "Denominator of the Fraction in lowest terms. Guaranteed to be positive." msgstr "" -#: ../../library/fractions.rst:133 +#: ../../library/fractions.rst:134 msgid "" "Return a tuple of two integers, whose ratio is equal to the original " "Fraction. The ratio is in lowest terms and has a positive denominator." msgstr "" -#: ../../library/fractions.rst:141 +#: ../../library/fractions.rst:142 msgid "Return ``True`` if the Fraction is an integer." msgstr "" -#: ../../library/fractions.rst:147 +#: ../../library/fractions.rst:148 msgid "" -"Alternative constructor which only accepts instances of :class:`float` " -"or :class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is " -"not the same value as ``Fraction(3, 10)``." +"Alternative constructor which only accepts instances of :class:`float` or :" +"class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is not " +"the same value as ``Fraction(3, 10)``." msgstr "" -#: ../../library/fractions.rst:153 +#: ../../library/fractions.rst:154 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`float`." msgstr "" -#: ../../library/fractions.rst:159 +#: ../../library/fractions.rst:160 msgid "" -"Alternative constructor which only accepts instances " -"of :class:`decimal.Decimal` or :class:`numbers.Integral`." +"Alternative constructor which only accepts instances of :class:`decimal." +"Decimal` or :class:`numbers.Integral`." msgstr "" -#: ../../library/fractions.rst:164 +#: ../../library/fractions.rst:165 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`decimal.Decimal` instance." msgstr "" -#: ../../library/fractions.rst:171 +#: ../../library/fractions.rst:172 msgid "" -"Alternative constructor which only accepts instances " -"of :class:`numbers.Integral`, :class:`numbers.Rational`, :class:`float` " -"or :class:`decimal.Decimal`, and objects with the :meth:`!as_integer_ratio` " -"method, but not strings." +"Alternative constructor which only accepts instances of :class:`numbers." +"Integral`, :class:`numbers.Rational`, :class:`float` or :class:`decimal." +"Decimal`, and objects with the :meth:`!as_integer_ratio` method, but not " +"strings." msgstr "" -#: ../../library/fractions.rst:181 +#: ../../library/fractions.rst:182 msgid "" "Finds and returns the closest :class:`Fraction` to ``self`` that has " "denominator at most max_denominator. This method is useful for finding " "rational approximations to a given floating-point number:" msgstr "" -#: ../../library/fractions.rst:189 +#: ../../library/fractions.rst:190 msgid "or for recovering a rational number that's represented as a float:" msgstr "" -#: ../../library/fractions.rst:202 +#: ../../library/fractions.rst:203 msgid "" "Returns the greatest :class:`int` ``<= self``. This method can also be " "accessed through the :func:`math.floor` function:" msgstr "" -#: ../../library/fractions.rst:212 +#: ../../library/fractions.rst:213 msgid "" "Returns the least :class:`int` ``>= self``. This method can also be " "accessed through the :func:`math.ceil` function." msgstr "" -#: ../../library/fractions.rst:219 +#: ../../library/fractions.rst:220 msgid "" "The first version returns the nearest :class:`int` to ``self``, rounding " "half to even. The second version rounds ``self`` to the nearest multiple of " "``Fraction(1, 10**ndigits)`` (logically, if ``ndigits`` is negative), again " -"rounding half toward even. This method can also be accessed through " -"the :func:`round` function." +"rounding half toward even. This method can also be accessed through the :" +"func:`round` function." msgstr "" -#: ../../library/fractions.rst:227 +#: ../../library/fractions.rst:228 msgid "" -"Provides support for formatting of :class:`Fraction` instances via " -"the :meth:`str.format` method, the :func:`format` built-in function, " -"or :ref:`Formatted string literals `." +"Provides support for formatting of :class:`Fraction` instances via the :meth:" +"`str.format` method, the :func:`format` built-in function, or :ref:" +"`Formatted string literals `." msgstr "" -#: ../../library/fractions.rst:231 +#: ../../library/fractions.rst:232 msgid "" "If the ``format_spec`` format specification string does not end with one of " "the presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` " @@ -294,7 +295,7 @@ msgid "" "exact integer. The zero-fill flag ``'0'`` is not supported." msgstr "" -#: ../../library/fractions.rst:241 +#: ../../library/fractions.rst:242 msgid "" "If the ``format_spec`` format specification string ends with one of the " "presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` or " @@ -302,11 +303,11 @@ msgid "" "type in the :ref:`formatspec` section." msgstr "" -#: ../../library/fractions.rst:246 +#: ../../library/fractions.rst:247 msgid "Here are some examples::" msgstr "" -#: ../../library/fractions.rst:248 +#: ../../library/fractions.rst:249 msgid "" ">>> from fractions import Fraction\n" ">>> format(Fraction(103993, 33102), '_')\n" @@ -346,11 +347,11 @@ msgstr "" ">>> \"{:.2%} price increase\".format(Fraction(new_price, old_price) - 1)\n" "'34.67% price increase'" -#: ../../library/fractions.rst:270 +#: ../../library/fractions.rst:271 msgid "Module :mod:`numbers`" msgstr ":mod:`numbers` 模組" -#: ../../library/fractions.rst:271 +#: ../../library/fractions.rst:272 msgid "The abstract base classes making up the numeric tower." msgstr "" diff --git a/library/functions.po b/library/functions.po index 9b4e6313e8a..b7d0254a17b 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-09 05:11+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -460,9 +460,9 @@ msgid "" "iterator. If *default* is given, it is returned if the iterator is " "exhausted, otherwise :exc:`StopAsyncIteration` is raised." msgstr "" -"呼叫 *async_iterator* 的 :meth:`~object.__anext__` 方法,回" -"傳 :term:`awaitable`。等待返回疊代器的下一個值。如果指定 *default*,當疊代器" -"結束時會返回該值,否則會引發 :exc:`StopAsyncIteration` 。" +"呼叫 *async_iterator* 的 :meth:`~object.__anext__` 方法,回傳 :term:" +"`awaitable`。等待返回疊代器的下一個值。如果指定 *default*,當疊代器結束時會返" +"回該值,否則會引發 :exc:`StopAsyncIteration` 。" #: ../../library/functions.rst:104 msgid "" @@ -489,9 +489,9 @@ msgstr "" #: ../../library/functions.rst:116 msgid "" "As :func:`repr`, return a string containing a printable representation of an " -"object, but escape the non-ASCII characters in the string returned " -"by :func:`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates " -"a string similar to that returned by :func:`repr` in Python 2." +"object, but escape the non-ASCII characters in the string returned by :func:" +"`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates a string " +"similar to that returned by :func:`repr` in Python 2." msgstr "" "就像函式 :func:`repr`,回傳一個表示物件的字串,但是 :func:`repr` 回傳的字串中" "非 ASCII 編碼的字元會被跳脫 (escape),像是 ``\\x``、``\\u`` 和 ``\\U``。這個" @@ -500,13 +500,13 @@ msgstr "" #: ../../library/functions.rst:124 msgid "" "Convert an integer number to a binary string prefixed with \"0b\". The " -"result is a valid Python expression. If *integer* is not a " -"Python :class:`int` object, it has to define an :meth:`~object.__index__` " -"method that returns an integer. Some examples:" +"result is a valid Python expression. If *integer* is not a Python :class:" +"`int` object, it has to define an :meth:`~object.__index__` method that " +"returns an integer. Some examples:" msgstr "" "將一個整數轉變為一個前綴為 \"0b\" 的二進位制字串。結果是一個有效的 Python 運" -"算式。如果 *integer* 不是 Python 的 :class:`int` 物件,那它需要定" -"義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" +"算式。如果 *integer* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" +"`~object.__index__` method 回傳一個整數。舉例來說:" #: ../../library/functions.rst:134 msgid "" @@ -524,9 +524,9 @@ msgid "" "Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is " "converted using the standard :ref:`truth testing procedure `. If the " "argument is false or omitted, this returns ``False``; otherwise, it returns " -"``True``. The :class:`bool` class is a subclass of :class:`int` " -"(see :ref:`typesnumeric`). It cannot be subclassed further. Its only " -"instances are ``False`` and ``True`` (see :ref:`typebool`)." +"``True``. The :class:`bool` class is a subclass of :class:`int` (see :ref:" +"`typesnumeric`). It cannot be subclassed further. Its only instances are " +"``False`` and ``True`` (see :ref:`typebool`)." msgstr "" "回傳一個布林值,即 ``True`` 或者 ``False``。引數會使用標準的\\ :ref:`真值測試" "程序 `\\ 來轉換。如果引數為假或者被省略,則回傳 ``False``;其他情況回" @@ -551,18 +551,18 @@ msgid "" "not accessible, this function will raise :exc:`RuntimeError`." msgstr "" "這個函式將呼叫 :func:`sys.breakpointhook` 函式,並將 ``args`` 和 ``kws`` 傳遞" -"給它。這將有效地讓你在特定的呼叫點進入除錯器。預設情況下," -"``sys.breakpointhook()`` 呼叫 :func:`pdb.set_trace` 不須帶任何引數。這樣的設" -"計是為了方便使用者,讓他們不需要額外地導入 :mod:`pdb` 模組或輸入太多程式就可" -"以進入除錯器。然而,可以將 :func:`sys.breakpointhook` 設置為其他函式,並" -"且 :func:`breakpoint` 將自動呼叫該函式,讓你進入所選擇的除錯器。如果無法存" -"取 :func:`sys.breakpointhook` 這個函式,則此函式將引發 :exc:`RuntimeError`。" +"給它。這將有效地讓你在特定的呼叫點進入除錯器。預設情況下,``sys." +"breakpointhook()`` 呼叫 :func:`pdb.set_trace` 不須帶任何引數。這樣的設計是為" +"了方便使用者,讓他們不需要額外地導入 :mod:`pdb` 模組或輸入太多程式就可以進入" +"除錯器。然而,可以將 :func:`sys.breakpointhook` 設置為其他函式,並且 :func:" +"`breakpoint` 將自動呼叫該函式,讓你進入所選擇的除錯器。如果無法存取 :func:" +"`sys.breakpointhook` 這個函式,則此函式將引發 :exc:`RuntimeError`。" #: ../../library/functions.rst:173 msgid "" -"By default, the behavior of :func:`breakpoint` can be changed with " -"the :envvar:`PYTHONBREAKPOINT` environment variable. " -"See :func:`sys.breakpointhook` for usage details." +"By default, the behavior of :func:`breakpoint` can be changed with the :" +"envvar:`PYTHONBREAKPOINT` environment variable. See :func:`sys." +"breakpointhook` for usage details." msgstr "" "預設情況下,:func:`breakpoint` 的行為可以透過 :envvar:`PYTHONBREAKPOINT` 環境" "變數來更改。有關使用詳情,請參考 :func:`sys.breakpointhook`。" @@ -589,9 +589,9 @@ msgid "" "as most methods that the :class:`bytes` type has, see :ref:`bytes-methods`." msgstr "" "回傳一個新的 bytes 陣列。:class:`bytearray` class 是一個可變的整數序列,包含" -"範圍為 0 <= x < 256 的整數。它有可變序列大部分常見的 method(如" -"在 :ref:`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 " -"method,參見 :ref:`bytes-methods`。" +"範圍為 0 <= x < 256 的整數。它有可變序列大部分常見的 method(如在 :ref:" +"`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 method,參" +"見 :ref:`bytes-methods`。" #: ../../library/functions.rst:194 msgid "" @@ -644,8 +644,8 @@ msgstr "可參考 :ref:`binaryseq` 和 :ref:`typebytearray`。" #: ../../library/functions.rst:220 msgid "" "Return a new \"bytes\" object which is an immutable sequence of integers in " -"the range ``0 <= x < 256``. :class:`bytes` is an immutable version " -"of :class:`bytearray` -- it has the same non-mutating methods and the same " +"the range ``0 <= x < 256``. :class:`bytes` is an immutable version of :" +"class:`bytearray` -- it has the same non-mutating methods and the same " "indexing and slicing behavior." msgstr "" "回傳一個新的 \"bytes\" 物件,會是一個元素是範圍為 ``0 <= x < 256`` 整數的不可" @@ -667,12 +667,11 @@ msgstr "可參考 :ref:`binaryseq`、:ref:`typebytes` 和 :ref:`bytes-methods` #: ../../library/functions.rst:234 msgid "" -"Return :const:`True` if the *object* argument appears " -"callable, :const:`False` if not. If this returns ``True``, it is still " -"possible that a call fails, but if it is ``False``, calling *object* will " -"never succeed. Note that classes are callable (calling a class returns a new " -"instance); instances are callable if their class has " -"a :meth:`~object.__call__` method." +"Return :const:`True` if the *object* argument appears callable, :const:" +"`False` if not. If this returns ``True``, it is still possible that a call " +"fails, but if it is ``False``, calling *object* will never succeed. Note " +"that classes are callable (calling a class returns a new instance); " +"instances are callable if their class has a :meth:`~object.__call__` method." msgstr "" "如果引數 *object* 是可呼叫的,回傳 :const:`True`,否則回傳 :const:`False`。如" "果回傳 ``True``,呼叫仍可能會失敗;但如果回傳 ``False``,則呼叫 *object* 肯定" @@ -727,8 +726,8 @@ msgstr "" #: ../../library/functions.rst:267 msgid "" -"The ``@classmethod`` form is a function :term:`decorator` -- " -"see :ref:`function` for details." +"The ``@classmethod`` form is a function :term:`decorator` -- see :ref:" +"`function` for details." msgstr "" "``@classmethod`` 語法是一個函式 :term:`decorator` — 參見 :ref:`function` 中關" "於函式定義的詳細介紹。" @@ -756,30 +755,31 @@ msgstr "" #: ../../library/functions.rst:279 msgid "" -"Class methods can now wrap other :term:`descriptors ` such " -"as :func:`property`." +"Class methods can now wrap other :term:`descriptors ` such as :" +"func:`property`." msgstr "" -"Class methods 現在可以包裝其他\\ :term:`描述器 `,例" -"如 :func:`property`" +"Class methods 現在可以包裝其他\\ :term:`描述器 `,例如 :func:" +"`property`" #: ../../library/functions.rst:283 msgid "" -"Class methods now inherit the method attributes " -"(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " -"and :attr:`~function.__annotations__`) and have a new ``__wrapped__`` " -"attribute." +"Class methods now inherit the method attributes (:attr:`~function." +"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" +"attr:`~function.__doc__` and :attr:`~function.__annotations__`) and have a " +"new ``__wrapped__`` attribute." msgstr "" -"Class method 現在繼承了 method 屬性" -"(:attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__doc__` " -"和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性。" +"Class method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" +"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." +"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " +"``__wrapped__`` 屬性。" #: ../../library/functions.rst:290 msgid "" "Class methods can no longer wrap other :term:`descriptors ` such " "as :func:`property`." msgstr "" -"Class methods 不能再包裝其他的\\ :term:`描述器 `,例" -"如 :func:`property`。" +"Class methods 不能再包裝其他的\\ :term:`描述器 `,例如 :func:" +"`property`。" #: ../../library/functions.rst:297 msgid "" @@ -788,9 +788,9 @@ msgid "" "string, a byte string, or an AST object. Refer to the :mod:`ast` module " "documentation for information on how to work with AST objects." msgstr "" -"將 *source* 編譯成程式碼或 AST 物件。程式碼物件可以被 :func:`exec` " -"或 :func:`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。" -"參見 :mod:`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" +"將 *source* 編譯成程式碼或 AST 物件。程式碼物件可以被 :func:`exec` 或 :func:" +"`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。參見 :mod:" +"`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" #: ../../library/functions.rst:302 msgid "" @@ -816,16 +816,16 @@ msgstr "" #: ../../library/functions.rst:312 msgid "" -"The optional arguments *flags* and *dont_inherit* control " -"which :ref:`compiler options ` should be activated and " -"which :ref:`future features ` should be allowed. If neither is " -"present (or both are zero) the code is compiled with the same flags that " -"affect the code that is calling :func:`compile`. If the *flags* argument is " -"given and *dont_inherit* is not (or is zero) then the compiler options and " -"the future statements specified by the *flags* argument are used in addition " -"to those that would be used anyway. If *dont_inherit* is a non-zero integer " -"then the *flags* argument is it -- the flags (future features and compiler " -"options) in the surrounding code are ignored." +"The optional arguments *flags* and *dont_inherit* control which :ref:" +"`compiler options ` should be activated and which :ref:" +"`future features ` should be allowed. If neither is present (or both " +"are zero) the code is compiled with the same flags that affect the code that " +"is calling :func:`compile`. If the *flags* argument is given and " +"*dont_inherit* is not (or is zero) then the compiler options and the future " +"statements specified by the *flags* argument are used in addition to those " +"that would be used anyway. If *dont_inherit* is a non-zero integer then the " +"*flags* argument is it -- the flags (future features and compiler options) " +"in the surrounding code are ignored." msgstr "" "可選引數 *flags* 和 *dont_inherit* 控制啟用哪個\\ :ref:`編譯器選項 `\\ 以及允許哪個\\ :ref:`未來功能 `。如果兩者都不存在" @@ -838,18 +838,16 @@ msgstr "" msgid "" "Compiler options and future statements are specified by bits which can be " "bitwise ORed together to specify multiple options. The bitfield required to " -"specify a given future feature can be found as " -"the :attr:`~__future__._Feature.compiler_flag` attribute on " -"the :class:`~__future__._Feature` instance in the :mod:`__future__` " -"module. :ref:`Compiler flags ` can be found " -"in :mod:`ast` module, with ``PyCF_`` prefix." +"specify a given future feature can be found as the :attr:`~__future__." +"_Feature.compiler_flag` attribute on the :class:`~__future__._Feature` " +"instance in the :mod:`__future__` module. :ref:`Compiler flags ` can be found in :mod:`ast` module, with ``PyCF_`` prefix." msgstr "" "編譯器選項和 future 陳述式使用 bits 來表示,可以一起被位元操作 OR 來表示複數" -"個選項。需要被具體定義特徵的位元域可以透過 :mod:`__future__` module " -"中 :class:`~__future__._Feature` 實例中" -"的 :attr:`~__future__._Feature.compiler_flag` 屬性來獲得。:ref:`編譯器旗標 " -"`\\ 可以在 :mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名" -"稱。" +"個選項。需要被具體定義特徵的位元域可以透過 :mod:`__future__` module 中 :" +"class:`~__future__._Feature` 實例中的 :attr:`~__future__._Feature." +"compiler_flag` 屬性來獲得。:ref:`編譯器旗標 `\\ 可以在 :" +"mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名稱。" #: ../../library/functions.rst:331 msgid "" @@ -859,8 +857,8 @@ msgid "" "optimization; ``__debug__`` is true), ``1`` (asserts are removed, " "``__debug__`` is false) or ``2`` (docstrings are removed too)." msgstr "" -"引數 *optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器" -"的 :option:`-O` 選項相同的最佳化級別。其他級別為 ``0``\\ (沒有最佳化;\\ " +"引數 *optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器的 :" +"option:`-O` 選項相同的最佳化級別。其他級別為 ``0``\\ (沒有最佳化;\\ " "``__debug__`` 為真值)、``1``\\ (assert 被刪除,``__debug__`` 為假值)或 " "``2``\\ (說明字串 (docstring) 也被刪除)。" @@ -874,8 +872,8 @@ msgstr "" #: ../../library/functions.rst:340 msgid "" -"If you want to parse Python code into its AST representation, " -"see :func:`ast.parse`." +"If you want to parse Python code into its AST representation, see :func:`ast." +"parse`." msgstr "如果你想解析 Python 程式碼為 AST 運算式,請參閱 :func:`ast.parse`。" #: ../../library/functions.rst:343 ../../library/functions.rst:345 @@ -891,8 +889,8 @@ msgstr "" msgid "" "When compiling a string with multi-line code in ``'single'`` or ``'eval'`` " "mode, input must be terminated by at least one newline character. This is " -"to facilitate detection of incomplete and complete statements in " -"the :mod:`code` module." +"to facilitate detection of incomplete and complete statements in the :mod:" +"`code` module." msgstr "" "在 ``'single'`` 或 ``'eval'`` 模式編譯多行程式碼時,輸入必須以至少一個換行符" "結尾。這使 :mod:`code` module 更容易檢測陳述式的完整性。" @@ -985,23 +983,23 @@ msgid "" "and ``')'``, which are ignored. The string must not contain whitespace " "between ``'+'``, ``'-'``, the ``'j'`` or ``'J'`` suffix, and the decimal " "number. For example, ``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` " -"raises :exc:`ValueError`. More precisely, the input must conform to " -"the :token:`~float:complexvalue` production rule in the following grammar, " -"after parentheses and leading and trailing whitespace characters are removed:" +"raises :exc:`ValueError`. More precisely, the input must conform to the :" +"token:`~float:complexvalue` production rule in the following grammar, after " +"parentheses and leading and trailing whitespace characters are removed:" msgstr "" #: ../../library/functions.rst:422 msgid "" "If the argument is a number, the constructor serves as a numeric conversion " "like :class:`int` and :class:`float`. For a general Python object ``x``, " -"``complex(x)`` delegates to ``x.__complex__()``. " -"If :meth:`~object.__complex__` is not defined then it falls back " -"to :meth:`~object.__float__`. If :meth:`!__float__` is not defined then it " -"falls back to :meth:`~object.__index__`." +"``complex(x)`` delegates to ``x.__complex__()``. If :meth:`~object." +"__complex__` is not defined then it falls back to :meth:`~object.__float__`. " +"If :meth:`!__float__` is not defined then it falls back to :meth:`~object." +"__index__`." msgstr "" "如果引數是一個數字,則建構函式會像 :class:`int` 和 :class:`float` 一樣進行數" -"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 " -"``x.__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " +"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 ``x." +"__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " "back) 到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未定義,則會再回" "退到 :meth:`~object.__index__`。" @@ -1037,8 +1035,8 @@ msgstr "可以使用底線將程式碼文字中的數字進行分組。" #: ../../library/functions.rst:450 msgid "" -"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` " -"and :meth:`~object.__float__` are not defined." +"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :" +"meth:`~object.__float__` are not defined." msgstr "" "如果 :meth:`~object.__complex__` 和 :meth:`~object.__float__` 未定義,則會回" "退到 :meth:`~object.__index__`。" @@ -1072,8 +1070,8 @@ msgstr "" #: ../../library/functions.rst:477 msgid "" -"For other containers see the built-in :class:`list`, :class:`set`, " -"and :class:`tuple` classes, as well as the :mod:`collections` module." +"For other containers see the built-in :class:`list`, :class:`set`, and :" +"class:`tuple` classes, as well as the :mod:`collections` module." msgstr "" "其他容器型別,請參見內建的 :class:`list`、:class:`set` 和 :class:`tuple` " "class,以及 :mod:`collections` module。" @@ -1091,9 +1089,9 @@ msgstr "" msgid "" "If the object has a method named :meth:`~object.__dir__`, this method will " "be called and must return the list of attributes. This allows objects that " -"implement a custom :func:`~object.__getattr__` " -"or :func:`~object.__getattribute__` function to customize the " -"way :func:`dir` reports their attributes." +"implement a custom :func:`~object.__getattr__` or :func:`~object." +"__getattribute__` function to customize the way :func:`dir` reports their " +"attributes." msgstr "" "如果物件有一個名為 :meth:`~object.__dir__` 的 method,那麼該 method 將被呼" "叫,並且必須回傳一個屬性列表。這允許實現自定義 :func:`~object.__getattr__` " @@ -1105,12 +1103,12 @@ msgid "" "If the object does not provide :meth:`~object.__dir__`, the function tries " "its best to gather information from the object's :attr:`~object.__dict__` " "attribute, if defined, and from its type object. The resulting list is not " -"necessarily complete and may be inaccurate when the object has a " -"custom :func:`~object.__getattr__`." +"necessarily complete and may be inaccurate when the object has a custom :" +"func:`~object.__getattr__`." msgstr "" -"如果物件不提供 :meth:`~object.__dir__`,這個函式會嘗試從物件已定義" -"的 :attr:`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的," -"如果物件有自定義 :func:`~object.__getattr__`,那結果可能不準確。" +"如果物件不提供 :meth:`~object.__dir__`,這個函式會嘗試從物件已定義的 :attr:" +"`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的,如果物件有" +"自定義 :func:`~object.__getattr__`,那結果可能不準確。" #: ../../library/functions.rst:500 msgid "" @@ -1167,30 +1165,30 @@ msgid "" "consisting of their quotient and remainder when using integer division. " "With mixed operand types, the rules for binary arithmetic operators apply. " "For integers, the result is the same as ``(a // b, a % b)``. For floating-" -"point numbers the result is ``(q, a % b)``, where *q* is usually " -"``math.floor(a / b)`` but may be 1 less than that. In any case ``q * b + a " -"% b`` is very close to *a*, if ``a % b`` is non-zero it has the same sign as " -"*b*, and ``0 <= abs(a % b) < abs(b)``." +"point numbers the result is ``(q, a % b)``, where *q* is usually ``math." +"floor(a / b)`` but may be 1 less than that. In any case ``q * b + a % b`` " +"is very close to *a*, if ``a % b`` is non-zero it has the same sign as *b*, " +"and ``0 <= abs(a % b) < abs(b)``." msgstr "" "它將兩個(非複數)數字作為引數,並在執行整數除法時回傳一對商和餘數。對於混合" "運算元型別,適用二進位算術運算子的規則。對於整數,運算結果和 ``(a // b, a % " -"b)`` 一致。對於浮點數,運算結果是 ``(q, a % b)``,*q* 通常是 " -"``math.floor(a / b)`` 但可能會比 1 小。在任何情況下,``q * b + a % b`` 和 " -"*a* 基本相等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % " -"b) < abs(b)``。" +"b)`` 一致。對於浮點數,運算結果是 ``(q, a % b)``,*q* 通常是 ``math." +"floor(a / b)`` 但可能會比 1 小。在任何情況下,``q * b + a % b`` 和 *a* 基本相" +"等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % b) < " +"abs(b)``。" #: ../../library/functions.rst:556 msgid "" -"Return an enumerate object. *iterable* must be a sequence, " -"an :term:`iterator`, or some other object which supports iteration. " -"The :meth:`~iterator.__next__` method of the iterator returned " -"by :func:`enumerate` returns a tuple containing a count (from *start* which " -"defaults to 0) and the values obtained from iterating over *iterable*." +"Return an enumerate object. *iterable* must be a sequence, an :term:" +"`iterator`, or some other object which supports iteration. The :meth:" +"`~iterator.__next__` method of the iterator returned by :func:`enumerate` " +"returns a tuple containing a count (from *start* which defaults to 0) and " +"the values obtained from iterating over *iterable*." msgstr "" "回傳一個列舉 (enumerate) 物件。*iterable* 必須是一個序列、:term:`iterator` 或" -"其他支援疊代的物件。:func:`enumerate` 回傳之 iterator " -"的 :meth:`~iterator.__next__` method 回傳一個 tuple(元組),裡面包含一個計數" -"值(從 *start* 開始,預設為 0)和透過疊代 *iterable* 獲得的值。" +"其他支援疊代的物件。:func:`enumerate` 回傳之 iterator 的 :meth:`~iterator." +"__next__` method 回傳一個 tuple(元組),裡面包含一個計數值(從 *start* 開" +"始,預設為 0)和透過疊代 *iterable* 獲得的值。" #: ../../library/functions.rst:568 msgid "Equivalent to::" @@ -1257,14 +1255,14 @@ msgid "" "reference to the dictionary of the built-in module :mod:`builtins` is " "inserted under that key before *expression* is parsed. That way you can " "control what builtins are available to the executed code by inserting your " -"own ``__builtins__`` dictionary into *globals* before passing it " -"to :func:`eval`. If the *locals* mapping is omitted it defaults to the " -"*globals* dictionary. If both mappings are omitted, the expression is " -"executed with the *globals* and *locals* in the environment " -"where :func:`eval` is called. Note, *eval()* will only have access to " -"the :term:`nested scopes ` (non-locals) in the enclosing " -"environment if they are already referenced in the scope that is " -"calling :func:`eval` (e.g. via a :keyword:`nonlocal` statement)." +"own ``__builtins__`` dictionary into *globals* before passing it to :func:" +"`eval`. If the *locals* mapping is omitted it defaults to the *globals* " +"dictionary. If both mappings are omitted, the expression is executed with " +"the *globals* and *locals* in the environment where :func:`eval` is called. " +"Note, *eval()* will only have access to the :term:`nested scopes ` (non-locals) in the enclosing environment if they are already " +"referenced in the scope that is calling :func:`eval` (e.g. via a :keyword:" +"`nonlocal` statement)." msgstr "" "*expression* 引數會被視為一條 Python 運算式(技術上而言,是條件列表)來剖析及" "求值,而 *globals* 和 *locals* 對映分別用作全域和區域命名空間。如果 " @@ -1272,11 +1270,11 @@ msgstr "" "析之前,將為該鍵插入對內建 :mod:`builtins` module dictionary 的引用。這麼一" "來,在將 ``__builtins__`` dictionary 傳入 :func:`eval` 之前,你可以透過將它插" "入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 對映被省略," -"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以" -"在 :func:`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意," -"*eval()* 在封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透" -"過 :keyword:`nonlocal` 陳述式)。" +"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以在 :func:" +"`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意,*eval()* 在" +"封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-" +"locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透過 :keyword:" +"`nonlocal` 陳述式)。" #: ../../library/functions.rst:616 msgid "Example:" @@ -1301,8 +1299,8 @@ msgid "" "pass around for use by :func:`eval` or :func:`exec`." msgstr "" "提示::func:`exec` 函式支援動態執行陳述式。:func:`globals` 和 :func:`locals` " -"函式分別回傳目前的全域性和局部性 dictionary,它們對於將引數傳遞" -"給 :func:`eval` 或 :func:`exec` 可能會方便許多。" +"函式分別回傳目前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" +"`eval` 或 :func:`exec` 可能會方便許多。" #: ../../library/functions.rst:632 msgid "" @@ -1344,18 +1342,18 @@ msgid "" "as a suite of Python statements which is then executed (unless a syntax " "error occurs). [#]_ If it is a code object, it is simply executed. In all " "cases, the code that's executed is expected to be valid as file input (see " -"the section :ref:`file-input` in the Reference Manual). Be aware that " -"the :keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements " -"may not be used outside of function definitions even within the context of " -"code passed to the :func:`exec` function. The return value is ``None``." +"the section :ref:`file-input` in the Reference Manual). Be aware that the :" +"keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements may " +"not be used outside of function definitions even within the context of code " +"passed to the :func:`exec` function. The return value is ``None``." msgstr "" "這個函式支援動態執行 Python 程式碼。*source* 必須是字串或者程式碼物件。如果是" "字串,那麼該字串將被剖析為一系列 Python 陳述式並執行(除非發生語法錯誤)。" "[#]_ 如果是程式碼物件,它將被直接執行。無論哪種情況,被執行的程式碼都需要和檔" "案輸入一樣是有效的(可參閱語言參考手冊中關於\\ :ref:`file-input`\\ 的章節)。" -"請注意,即使在傳遞給 :func:`exec` 函式的程式碼的上下文" -"中,:keyword:`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在" -"函式之外使用。該函式回傳值是 ``None``。" +"請注意,即使在傳遞給 :func:`exec` 函式的程式碼的上下文中,:keyword:" +"`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使" +"用。該函式回傳值是 ``None``。" #: ../../library/functions.rst:672 msgid "" @@ -1385,9 +1383,9 @@ msgstr "" #: ../../library/functions.rst:688 msgid "" "If the *globals* dictionary does not contain a value for the key " -"``__builtins__``, a reference to the dictionary of the built-in " -"module :mod:`builtins` is inserted under that key. That way you can control " -"what builtins are available to the executed code by inserting your own " +"``__builtins__``, a reference to the dictionary of the built-in module :mod:" +"`builtins` is inserted under that key. That way you can control what " +"builtins are available to the executed code by inserting your own " "``__builtins__`` dictionary into *globals* before passing it to :func:`exec`." msgstr "" "如果 *globals* dictionary 不包含 ``__builtins__`` 鍵值,則將為該鍵插入對內" @@ -1422,9 +1420,9 @@ msgid "" "Pass an explicit *locals* dictionary if you need to see effects of the code " "on *locals* after function :func:`exec` returns." msgstr "" -"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想" -"在 :func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 " -"*locals* dictionary 。" +"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想在 :" +"func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 *locals* " +"dictionary 。" #: ../../library/functions.rst:717 msgid "Added the *closure* parameter." @@ -1524,9 +1522,9 @@ msgstr "" #: ../../library/functions.rst:800 msgid "" -"For a general Python object ``x``, ``float(x)`` delegates to " -"``x.__float__()``. If :meth:`~object.__float__` is not defined then it " -"falls back to :meth:`~object.__index__`." +"For a general Python object ``x``, ``float(x)`` delegates to ``x." +"__float__()``. If :meth:`~object.__float__` is not defined then it falls " +"back to :meth:`~object.__index__`." msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" "定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" @@ -1559,8 +1557,8 @@ msgid "" "is used by most built-in types: :ref:`formatspec`." msgstr "" "將 *value* 轉換為 *format_spec* 控制的 \"格式化\" 表示。*format_spec* 的解釋" -"取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語" -"法::ref:`formatspec`。" +"取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" +"`formatspec`。" #: ../../library/functions.rst:831 msgid "" @@ -1572,12 +1570,12 @@ msgstr "" #: ../../library/functions.rst:834 msgid "" -"A call to ``format(value, format_spec)`` is translated to " -"``type(value).__format__(value, format_spec)`` which bypasses the instance " -"dictionary when searching for the value's :meth:`~object.__format__` method. " -"A :exc:`TypeError` exception is raised if the method search " -"reaches :mod:`object` and the *format_spec* is non-empty, or if either the " -"*format_spec* or the return value are not strings." +"A call to ``format(value, format_spec)`` is translated to ``type(value)." +"__format__(value, format_spec)`` which bypasses the instance dictionary when " +"searching for the value's :meth:`~object.__format__` method. A :exc:" +"`TypeError` exception is raised if the method search reaches :mod:`object` " +"and the *format_spec* is non-empty, or if either the *format_spec* or the " +"return value are not strings." msgstr "" "呼叫 ``format(value, format_spec)`` 會轉換成 ``type(value).__format__(value, " "format_spec)``,當搜尋 value 的 :meth:`~object.__format__` method 時,會忽略" @@ -1589,24 +1587,23 @@ msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." msgstr "" -"當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引" -"發 :exc:`TypeError`。" +"當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" +"exc:`TypeError`。" #: ../../library/functions.rst:850 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " -"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` " -"and :ref:`types-set` for documentation about this class." +"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" +"ref:`types-set` for documentation about this class." msgstr "" "回傳一個新的 :class:`frozenset` 物件,它包含選擇性引數 *iterable* 中的元素。" -"``frozenset`` 是一個內建的 class。有關此 class 的文件,請參" -"閱 :class:`frozenset` 和 :ref:`types-set`。" +"``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" +"`frozenset` 和 :ref:`types-set`。" #: ../../library/functions.rst:854 msgid "" -"For other containers see the built-" -"in :class:`set`, :class:`list`, :class:`tuple`, and :class:`dict` classes, " -"as well as the :mod:`collections` module." +"For other containers see the built-in :class:`set`, :class:`list`, :class:" +"`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" @@ -1622,16 +1619,16 @@ msgid "" msgstr "" "回傳 *object* 之具名屬性的值。*name* 必須是字串。如果該字串是物件屬性之一的名" "稱,則回傳該屬性的值。例如,``getattr(x, 'foobar')`` 等同於 ``x.foobar``。如" -"果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則引" -"發 :exc:`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請" -"見 :func:`setattr`)。" +"果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則引發 :exc:" +"`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" +"`setattr`)。" #: ../../library/functions.rst:871 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " -"with two leading underscores) name in order to retrieve it " -"with :func:`getattr`." +"with two leading underscores) name in order to retrieve it with :func:" +"`getattr`." msgstr "" "由於\\ :ref:`私有名稱改編 (private name mangling) ` 是" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" @@ -1670,9 +1667,8 @@ msgstr "" #: ../../library/functions.rst:901 msgid "" -"For objects with custom :meth:`~object.__hash__` methods, note " -"that :func:`hash` truncates the return value based on the bit width of the " -"host machine." +"For objects with custom :meth:`~object.__hash__` methods, note that :func:" +"`hash` truncates the return value based on the bit width of the host machine." msgstr "" "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" "運行機器的位元長度來截斷回傳值。" @@ -1742,8 +1738,8 @@ msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基 #: ../../library/functions.rst:955 msgid "" -"To obtain a hexadecimal string representation for a float, use " -"the :meth:`float.hex` method." +"To obtain a hexadecimal string representation for a float, use the :meth:" +"`float.hex` method." msgstr "" "如果要取得浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" @@ -1851,14 +1847,13 @@ msgstr "" #: ../../library/functions.rst:1021 msgid "" -"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns " -"``x.__int__()``. If the argument defines :meth:`~object.__index__`, it " -"returns ``x.__index__()``. For floating-point numbers, this truncates " -"towards zero." +"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." +"__int__()``. If the argument defines :meth:`~object.__index__`, it returns " +"``x.__index__()``. For floating-point numbers, this truncates towards zero." msgstr "" -"如果引數定義了 :meth:`~object.__int__`,則 ``int(x)`` 會回傳 ``x.__int__()``。" -"如果引數定義了 :meth:`~object.__index__` 則回傳 ``x.__index__()``。對於浮點" -"數,則會向零的方向無條件捨去。" +"如果引數定義了 :meth:`~object.__int__`,則 ``int(x)`` 會回傳 ``x." +"__int__()``。如果引數定義了 :meth:`~object.__index__` 則回傳 ``x." +"__index__()``。對於浮點數,則會向零的方向無條件捨去。" #: ../../library/functions.rst:1026 msgid "" @@ -1868,10 +1863,10 @@ msgid "" "``-`` (with no space in between), have leading zeros, be surrounded by " "whitespace, and have single underscores interspersed between digits." msgstr "" -"如果引數不是數字或如果有給定 *base*,則它必須是個字串、:class:`bytes` " -"或 :class:`bytearray` 實例,表示基數 (radix) *base* 中的整數。可選地,字串之" -"前可以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、" -"或在數字間有單一底線。" +"如果引數不是數字或如果有給定 *base*,則它必須是個字串、:class:`bytes` 或 :" +"class:`bytearray` 實例,表示基數 (radix) *base* 中的整數。可選地,字串之前可" +"以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在" +"數字間有單一底線。" #: ../../library/functions.rst:1032 msgid "" @@ -1901,15 +1896,15 @@ msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" #: ../../library/functions.rst:1045 msgid "" -"If *base* is not an instance of :class:`int` and the *base* object has " -"a :meth:`base.__index__ ` method, that method is called to " +"If *base* is not an instance of :class:`int` and the *base* object has a :" +"meth:`base.__index__ ` method, that method is called to " "obtain an integer for the base. Previous versions used :meth:`base.__int__ " "` instead of :meth:`base.__index__ `." msgstr "" "如果 *base* 不是 :class:`int` 的實例,但 *base* 物件有 :meth:`base.__index__ " "` method,則會呼叫該 method 來取得此進位制所需的整數。以前" -"的版本使用 :meth:`base.__int__ ` 而不" -"是 :meth:`base.__index__ `。" +"的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." +"__index__ `。" #: ../../library/functions.rst:1055 msgid "The first parameter is now positional-only." @@ -1927,14 +1922,14 @@ msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " "limit is exceeded while converting a string to an :class:`int` or when " -"converting an :class:`int` into a string would exceed the limit. See " -"the :ref:`integer string conversion length limitation ` " +"converting an :class:`int` into a string would exceed the limit. See the :" +"ref:`integer string conversion length limitation ` " "documentation." msgstr "" ":class:`int` 的字串輸入和字串表示法可以被限制,以避免阻斷服務攻擊 (denial of " -"service attack)。在字串 *x* 轉換為 :class:`int` 時已超出限制,或是" -"在 :class:`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱" -"\\ :ref:`整數字串轉換的長度限制 `\\ 說明文件。" +"service attack)。在字串 *x* 轉換為 :class:`int` 時已超出限制,或是在 :class:" +"`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" +"數字串轉換的長度限制 `\\ 說明文件。" #: ../../library/functions.rst:1069 msgid "" @@ -1949,18 +1944,18 @@ msgid "" "the function always returns ``False``. If *classinfo* is a tuple of type " "objects (or recursively, other such tuples) or a :ref:`types-union` of " "multiple types, return ``True`` if *object* is an instance of any of the " -"types. If *classinfo* is not a type or tuple of types and such tuples, " -"a :exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised " -"for an invalid type if an earlier check succeeds." -msgstr "" -"如果 *object* 引數是 *classinfo* 引數的實例,或者是(直接、間接" -"或 :term:`virtual `)subclass 的實例,則回傳 ``True``。" -"如果 *object* 不是給定型別的物件,函式始終回傳 ``False``。如果 *classinfo* 是" -"包含物件型別的 tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-" -"union`,若 *object* 是其中的任何一個物件的實例則回傳 ``True``。如果 " -"*classinfo* 既不是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會引" -"發 :exc:`TypeError` 異常。若是先前檢查已經成功,:exc:`TypeError` 可能不會再因" -"為不合格的型別而被引發。" +"types. If *classinfo* is not a type or tuple of types and such tuples, a :" +"exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised for " +"an invalid type if an earlier check succeeds." +msgstr "" +"如果 *object* 引數是 *classinfo* 引數的實例,或者是(直接、間接或 :term:" +"`virtual `)subclass 的實例,則回傳 ``True``。如果 " +"*object* 不是給定型別的物件,函式始終回傳 ``False``。如果 *classinfo* 是包含" +"物件型別的 tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-union`," +"若 *object* 是其中的任何一個物件的實例則回傳 ``True``。如果 *classinfo* 既不" +"是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會引發 :exc:`TypeError` 異" +"常。若是先前檢查已經成功,:exc:`TypeError` 可能不會再因為不合格的型別而被引" +"發。" #: ../../library/functions.rst:1085 ../../library/functions.rst:1099 msgid "*classinfo* can be a :ref:`types-union`." @@ -1968,18 +1963,18 @@ msgstr "*classinfo* 可以是一個 :ref:`types-union`。" #: ../../library/functions.rst:1091 msgid "" -"Return ``True`` if *class* is a subclass (direct, indirect, " -"or :term:`virtual `) of *classinfo*. A class is " -"considered a subclass of itself. *classinfo* may be a tuple of class objects " -"(or recursively, other such tuples) or a :ref:`types-union`, in which case " +"Return ``True`` if *class* is a subclass (direct, indirect, or :term:" +"`virtual `) of *classinfo*. A class is considered a " +"subclass of itself. *classinfo* may be a tuple of class objects (or " +"recursively, other such tuples) or a :ref:`types-union`, in which case " "return ``True`` if *class* is a subclass of any entry in *classinfo*. In " "any other case, a :exc:`TypeError` exception is raised." msgstr "" "如果 *class* 是 *classinfo* 的 subclass(直接、間接或 :term:`virtual " "`),則回傳 ``True``。*classinfo* 可以是 class 物件的 " "tuple(或遞迴地其他類似 tuple)或是一個 :ref:`types-union`,此時若 *class* " -"是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引" -"發 :exc:`TypeError`。" +"是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" +"exc:`TypeError`。" #: ../../library/functions.rst:1106 msgid "" @@ -1987,24 +1982,23 @@ msgid "" "differently depending on the presence of the second argument. Without a " "second argument, the single argument must be a collection object which " "supports the :term:`iterable` protocol (the :meth:`~object.__iter__` " -"method), or it must support the sequence protocol " -"(the :meth:`~object.__getitem__` method with integer arguments starting at " -"``0``). If it does not support either of those protocols, :exc:`TypeError` " -"is raised. If the second argument, *sentinel*, is given, then the first " -"argument must be a callable object. The iterator created in this case will " -"call *callable* with no arguments for each call to " -"its :meth:`~iterator.__next__` method; if the value returned is equal to " -"*sentinel*, :exc:`StopIteration` will be raised, otherwise the value will be " -"returned." +"method), or it must support the sequence protocol (the :meth:`~object." +"__getitem__` method with integer arguments starting at ``0``). If it does " +"not support either of those protocols, :exc:`TypeError` is raised. If the " +"second argument, *sentinel*, is given, then the first argument must be a " +"callable object. The iterator created in this case will call *callable* " +"with no arguments for each call to its :meth:`~iterator.__next__` method; if " +"the value returned is equal to *sentinel*, :exc:`StopIteration` will be " +"raised, otherwise the value will be returned." msgstr "" "回傳一個 :term:`iterator` 物件。根據是否存在第二個引數,第一個引數的意義是非" "常不同的。如果沒有第二個引數,該單一引數必須是支援 :term:`iterable` 協定" -"(有 :meth:`~object.__iter__` method)的集合物件,或必須支援序列協定" -"(有 :meth:`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支" -"援這些協定,會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼第一引" -"數必須是可呼叫的物件,這種情況下生成的 iterator,每次疊代呼" -"叫 :meth:`~iterator.__next__` 時會不帶引數地呼叫 *callable*;如果回傳的結果" -"是 *sentinel* 則引發 :exc:`StopIteration`,否則回傳呼叫結果。" +"(有 :meth:`~object.__iter__` method)的集合物件,或必須支援序列協定(有 :" +"meth:`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支援這些" +"協定,會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼第一引數必須" +"是可呼叫的物件,這種情況下生成的 iterator,每次疊代呼叫 :meth:`~iterator." +"__next__` 時會不帶引數地呼叫 *callable*;如果回傳的結果是 *sentinel* 則引發 :" +"exc:`StopIteration`,否則回傳呼叫結果。" #: ../../library/functions.rst:1120 msgid "See also :ref:`typeiter`." @@ -2042,8 +2036,8 @@ msgstr "" #: ../../library/functions.rst:1140 msgid "" -"``len`` raises :exc:`OverflowError` on lengths larger " -"than :data:`sys.maxsize`, such as :class:`range(2 ** 100) `." +"``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." +"maxsize`, such as :class:`range(2 ** 100) `." msgstr "" "如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," "則 ``len`` 會引發 :exc:`OverflowError`。" @@ -2066,8 +2060,8 @@ msgstr "" #: ../../library/functions.rst:1158 msgid "" "At module scope, as well as when using :func:`exec` or :func:`eval` with a " -"single namespace, this function returns the same namespace " -"as :func:`globals`." +"single namespace, this function returns the same namespace as :func:" +"`globals`." msgstr "" #: ../../library/functions.rst:1162 @@ -2128,10 +2122,10 @@ msgstr "" #: ../../library/functions.rst:1197 msgid "" "As part of :pep:`667`, the semantics of mutating the mapping objects " -"returned from this function are now defined. The behavior " -"in :term:`optimized scopes ` is now as described above. " -"Aside from being defined, the behaviour in other scopes remains unchanged " -"from previous versions." +"returned from this function are now defined. The behavior in :term:" +"`optimized scopes ` is now as described above. Aside from " +"being defined, the behaviour in other scopes remains unchanged from previous " +"versions." msgstr "" #: ../../library/functions.rst:1207 @@ -2145,12 +2139,12 @@ msgid "" "cases where the function inputs are already arranged into argument tuples, " "see :func:`itertools.starmap`." msgstr "" -"產生一個將 *function* 應用於 *iterable* 中所有項目並 yield 回傳結果的" -"疊代器。如果傳遞了額外的 *iterables* 引數,則 *function* 必須接受相同個數的" -"引數,且 *function* 會平行地被應用於所有可疊代物件的項目。當有多個可疊代物件時,項目最少的" -"可疊代物件耗盡時疊代器也會結束。如果 *strict* 為 ``True`` 且其中一個" -"可疊代物件在其他可疊代物件之前耗盡,則會拋出 :exc:`ValueError`。如果函式的輸入已經被編排為引數的元組," -"請參閱 :func:`itertools.starmap`。" +"產生一個將 *function* 應用於 *iterable* 中所有項目並 yield 回傳結果的疊代器。" +"如果傳遞了額外的 *iterables* 引數,則 *function* 必須接受相同個數的引數,且 " +"*function* 會平行地被應用於所有可疊代物件的項目。當有多個可疊代物件時,項目最" +"少的可疊代物件耗盡時疊代器也會結束。如果 *strict* 為 ``True`` 且其中一個可疊" +"代物件在其他可疊代物件之前耗盡,則會拋出 :exc:`ValueError`。如果函式的輸入已" +"經被編排為引數的元組,請參閱 :func:`itertools.starmap`。" #: ../../library/functions.rst:1216 msgid "Added the *strict* parameter." @@ -2176,20 +2170,20 @@ msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " "*default* argument specifies an object to return if the provided iterable is " -"empty. If the iterable is empty and *default* is not provided, " -"a :exc:`ValueError` is raised." +"empty. If the iterable is empty and *default* is not provided, a :exc:" +"`ValueError` is raised." msgstr "" "這個函式有兩個選擇性的僅限關鍵字引數。*key* 引數能指定單一引數所使用的排序函" "式,如同 :meth:`list.sort` 的使用方式。*default* 引數是當 iterable 為空時回傳" -"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引" -"發 :exc:`ValueError`。" +"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" +"`ValueError`。" #: ../../library/functions.rst:1238 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " -"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and " -"``heapq.nlargest(1, iterable, key=keyfunc)``." +"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and ``heapq." +"nlargest(1, iterable, key=keyfunc)``." msgstr "" "如果有多個最大元素,則此函式將回傳第一個找到的。這和其他穩定排序工具如 " "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " @@ -2205,8 +2199,8 @@ msgstr "*key* 可以為 ``None``。" #: ../../library/functions.rst:1254 msgid "" -"Return a \"memory view\" object created from the given argument. " -"See :ref:`typememoryview` for more information." +"Return a \"memory view\" object created from the given argument. See :ref:" +"`typememoryview` for more information." msgstr "" "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" "閱\\ :ref:`typememoryview`。" @@ -2239,14 +2233,13 @@ msgstr "" #: ../../library/functions.rst:1291 msgid "" -"Retrieve the next item from the :term:`iterator` by calling " -"its :meth:`~iterator.__next__` method. If *default* is given, it is " -"returned if the iterator is exhausted, otherwise :exc:`StopIteration` is " -"raised." +"Retrieve the next item from the :term:`iterator` by calling its :meth:" +"`~iterator.__next__` method. If *default* is given, it is returned if the " +"iterator is exhausted, otherwise :exc:`StopIteration` is raised." msgstr "" "透過呼叫 :term:`iterator` 的 :meth:`~iterator.__next__` method 取得下一個元" -"素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引" -"發 :exc:`StopIteration`。" +"素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" +"exc:`StopIteration`。" #: ../../library/functions.rst:1298 msgid "" @@ -2270,9 +2263,9 @@ msgstr "" #: ../../library/functions.rst:1312 msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " -"result is a valid Python expression. If *integer* is not a " -"Python :class:`int` object, it has to define an :meth:`~object.__index__` " -"method that returns an integer. For example:" +"result is a valid Python expression. If *integer* is not a Python :class:" +"`int` object, it has to define an :meth:`~object.__index__` method that " +"returns an integer. For example:" msgstr "" "將一個整數轉變為一個前綴為 \"0o\" 的八進位制字串。回傳結果是一個有效的 " "Python 運算式。如果 *integer* 不是 Python 的 :class:`int` 物件,那它需要定" @@ -2317,18 +2310,18 @@ msgid "" "already exists), ``'x'`` for exclusive creation, and ``'a'`` for appending " "(which on *some* Unix systems, means that *all* writes append to the end of " "the file regardless of the current seek position). In text mode, if " -"*encoding* is not specified the encoding used is platform-" -"dependent: :func:`locale.getencoding` is called to get the current locale " -"encoding. (For reading and writing raw bytes use binary mode and leave " -"*encoding* unspecified.) The available modes are:" +"*encoding* is not specified the encoding used is platform-dependent: :func:" +"`locale.getencoding` is called to get the current locale encoding. (For " +"reading and writing raw bytes use binary mode and leave *encoding* " +"unspecified.) The available modes are:" msgstr "" "*mode* 是一個選擇性字串,用於指定開啟檔案的模式。預設值是 ``'r'``,這意味著它" "以文字模式開啟並讀取。其他常見模式有:寫入 ``'w'``\\ (會捨去已經存在的檔" "案)、唯一性建立 ``'x'``、追加寫入 ``'a'``\\ (在\\ *一些* Unix 系統上,無論" "目前的檔案指標在什麼位置,*所有* 寫入都會追加到檔案末尾)。在文字模式,如果沒" -"有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼" -"叫 :func:`locale.getencoding` 來取得目前的本地編碼。(要讀取和寫入原始 " -"bytes,請使用二進位制模式且不要指定 *encoding*。)可用的模式有:" +"有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼叫 :func:`locale." +"getencoding` 來取得目前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" +"式且不要指定 *encoding*。)可用的模式有:" #: ../../library/functions.rst:1366 msgid "Character" @@ -2457,9 +2450,9 @@ msgid "" "size is available. On most systems, the buffer will typically be 128 " "kilobytes long." msgstr "" -"二進位檔案會以固定大小的區塊進行緩衝;緩衝區的大小為 " -"``max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)``,當裝置區塊大小可用時。" -"在大多數系統上,緩衝區的長度通常為 128 KB。" +"二進位檔案會以固定大小的區塊進行緩衝;緩衝區的大小為 ``max(min(blocksize, 8 " +"MiB), DEFAULT_BUFFER_SIZE)``,當裝置區塊大小可用時。在大多數系統上,緩衝區的" +"長度通常為 128 KB。" #: ../../library/functions.rst:1410 msgid "" @@ -2488,9 +2481,8 @@ msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " "standard error handlers are available (listed under :ref:`error-handlers`), " -"though any error handling name that has been registered " -"with :func:`codecs.register_error` is also valid. The standard names " -"include:" +"though any error handling name that has been registered with :func:`codecs." +"register_error` is also valid. The standard names include:" msgstr "" "*errors* 是一個選擇性的字串,用於指定要如何處理編碼和解碼的錯誤——它不能在二進" "制模式下使用。有許多不同的標準錯誤處理程式(error handler,在\\ :ref:`error-" @@ -2584,10 +2576,10 @@ msgstr "" #: ../../library/functions.rst:1472 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " -"characters written are translated to the system default line " -"separator, :data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no " -"translation takes place. If *newline* is any of the other legal values, any " -"``'\\n'`` characters written are translated to the given string." +"characters written are translated to the system default line separator, :" +"data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no translation " +"takes place. If *newline* is any of the other legal values, any ``'\\n'`` " +"characters written are translated to the given string." msgstr "" "將輸出寫入資料串流時,如果 *newline* 是 ``None``,則被寫入的任何 ``'\\n'`` 字" "元都會轉換為系統預設的行分隔符號 :data:`os.linesep`。如果 *newline* 是 " @@ -2624,8 +2616,8 @@ msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" #: ../../library/functions.rst:1491 msgid "" -"The following example uses the :ref:`dir_fd ` parameter of " -"the :func:`os.open` function to open a file relative to a given directory::" +"The following example uses the :ref:`dir_fd ` parameter of the :func:" +"`os.open` function to open a file relative to a given directory::" msgstr "" "下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" @@ -2642,40 +2634,49 @@ msgid "" "...\n" ">>> os.close(dir_fd) # don't leak a file descriptor" msgstr "" +">>> import os\n" +">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" +">>> def opener(path, flags):\n" +"... return os.open(path, flags, dir_fd=dir_fd)\n" +"...\n" +">>> with open('spamspam.txt', 'w', opener=opener) as f:\n" +"... print('This will be written to somedir/spamspam.txt', file=f)\n" +"...\n" +">>> os.close(dir_fd) # don't leak a file descriptor" #: ../../library/functions.rst:1504 msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " -"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass " -"of :class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When " -"used to open a file in a binary mode with buffering, the returned class is a " +"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass of :" +"class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When used " +"to open a file in a binary mode with buffering, the returned class is a " "subclass of :class:`io.BufferedIOBase`. The exact class varies: in read " "binary mode, it returns an :class:`io.BufferedReader`; in write binary and " "append binary modes, it returns an :class:`io.BufferedWriter`, and in read/" "write mode, it returns an :class:`io.BufferedRandom`. When buffering is " -"disabled, the raw stream, a subclass " -"of :class:`io.RawIOBase`, :class:`io.FileIO`, is returned." +"disabled, the raw stream, a subclass of :class:`io.RawIOBase`, :class:`io." +"FileIO`, is returned." msgstr "" ":func:`open` 函式回傳的 :term:`file object` 型別取決於模式。當 :func:`open` " "是在文字模式中開啟檔案時(``'w'``、``'r'``、``'wt'``、``'rt'`` 等),它會回" -"傳 :class:`io.TextIOBase` 的一個 subclass(具體來說,就" -"是 :class:`io.TextIOWrapper`)。使用有緩衝的二進制模式開啟檔案時,回傳的 " -"class 則會是 :class:`io.BufferedIOBase` 的 subclass。確切的 class 各不相同:" -"在讀取的二進制模式,它會回傳 :class:`io.BufferedReader`;在寫入和附加的二進制" -"模式,它會回傳 :class:`io.BufferedWriter`,而在讀/寫模式,它會回" -"傳 :class:`io.BufferedRandom`。當緩衝被停用時,會回傳原始資料串" -"流 :class:`io.FileIO`,它是 :class:`io.RawIOBase` 的一個 subclass。" +"傳 :class:`io.TextIOBase` 的一個 subclass(具體來說,就是 :class:`io." +"TextIOWrapper`)。使用有緩衝的二進制模式開啟檔案時,回傳的 class 則會是 :" +"class:`io.BufferedIOBase` 的 subclass。確切的 class 各不相同:在讀取的二進制" +"模式,它會回傳 :class:`io.BufferedReader`;在寫入和附加的二進制模式,它會回" +"傳 :class:`io.BufferedWriter`,而在讀/寫模式,它會回傳 :class:`io." +"BufferedRandom`。當緩衝被停用時,會回傳原始資料串流 :class:`io.FileIO`,它" +"是 :class:`io.RawIOBase` 的一個 subclass。" #: ../../library/functions.rst:1525 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " -"(where :func:`open` is " -"declared), :mod:`os`, :mod:`os.path`, :mod:`tempfile`, and :mod:`shutil`." +"(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" +"`tempfile`, and :mod:`shutil`." msgstr "" -"另請參閱檔案操作模組,例如 :mod:`fileinput`、:mod:`io`\\ (定義" -"了 :func:`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以" -"及 :mod:`shutil`。" +"另請參閱檔案操作模組,例如 :mod:`fileinput`、:mod:`io`\\ (定義了 :func:" +"`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" +"`shutil`。" #: ../../library/functions.rst:1529 msgid "" @@ -2708,8 +2709,8 @@ msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." msgstr "" -"如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引" -"發 :exc:`FileExistsError`。" +"如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" +"`FileExistsError`。" #: ../../library/functions.rst:1544 msgid "The file is now non-inheritable." @@ -2718,8 +2719,8 @@ msgstr "檔案在此版本開始是不可繼承的。" #: ../../library/functions.rst:1548 msgid "" "If the system call is interrupted and the signal handler does not raise an " -"exception, the function now retries the system call instead of raising " -"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." +"exception, the function now retries the system call instead of raising an :" +"exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" "如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" "不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" @@ -2734,8 +2735,8 @@ msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" #: ../../library/functions.rst:1556 msgid "" -"On Windows, opening a console buffer may return a subclass " -"of :class:`io.RawIOBase` other than :class:`io.FileIO`." +"On Windows, opening a console buffer may return a subclass of :class:`io." +"RawIOBase` other than :class:`io.FileIO`." msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" @@ -2752,8 +2753,8 @@ msgstr "" msgid "" "If the argument is a one-character string, return the Unicode code point of " "that character. For example, ``ord('a')`` returns the integer ``97`` and " -"``ord('€')`` (Euro sign) returns ``8364``. This is the inverse " -"of :func:`chr`." +"``ord('€')`` (Euro sign) returns ``8364``. This is the inverse of :func:" +"`chr`." msgstr "" "如果引數是單字元字串,則回傳該字元的 Unicode 編碼位置。例如 ``ord('a')`` 回傳" "整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這是 :func:`chr` 的逆" @@ -2779,7 +2780,7 @@ msgstr "" #: ../../library/functions.rst:1583 msgid "" -"The arguments must have numeric types. With mixed operand types, the " +"When arguments are builtin numeric types with mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " "operands, the result has the same type as the operands (after coercion) " "unless the second argument is negative; in that case, all arguments are " @@ -2787,19 +2788,19 @@ msgid "" "2)`` returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative " "base of type :class:`int` or :class:`float` and a non-integral exponent, a " "complex result is delivered. For example, ``pow(-9, 0.5)`` returns a value " -"close to ``3j``. Whereas, for a negative base of type :class:`int` " -"or :class:`float` with an integral exponent, a float result is delivered. " -"For example, ``pow(-9, 2.0)`` returns ``81.0``." +"close to ``3j``. Whereas, for a negative base of type :class:`int` or :class:" +"`float` with an integral exponent, a float result is delivered. For example, " +"``pow(-9, 2.0)`` returns ``81.0``." msgstr "" -"引數必須為數值型別。當運算元型別為混合型別時,會套用二元算術運算子的強制轉型 " +"當引數為內建數值型別且運算元型別為混合型別時,會套用二元算術運算子的強制轉型 " "(coercion) 規則。對於 :class:`int` 運算元,運算結果會(在強制轉型後)與運算元" "的型別相同,除非第二個引數是負數;在這種情況下,所有的引數都會被轉換為浮點數" "並得到浮點數的結果。例如,``pow(10, 2)`` 會回傳 ``100``,但 ``pow(10, -2)`` " "會回傳 ``0.01``。如果底數 (base) 是型別為 :class:`int` 或 :class:`float` 的負" -"數且指數 (exponent) 為非整數,則會傳回複數結果。例如 ``pow(-9, 0.5)`` " -"會回傳一個接近 ``3j`` 的值。然而,如果底數 (base) 是型別為 :class:`int` " -"或 :class:`float` 的負數且指數為整數,則會傳回浮點數結果。例如 " -"``pow(-9, 2.0)`` 會回傳 ``81.0``。" +"數且指數 (exponent) 為非整數,則會傳回複數結果。例如 ``pow(-9, 0.5)`` 會回傳" +"一個接近 ``3j`` 的值。然而,如果底數 (base) 是型別為 :class:`int` 或 :class:" +"`float` 的負數且指數為整數,則會傳回浮點數結果。例如 ``pow(-9, 2.0)`` 會回傳 " +"``81.0``。" #: ../../library/functions.rst:1595 msgid "" @@ -2950,12 +2951,12 @@ msgstr "" msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " -"possible to create read-only properties easily using :func:`property` as " -"a :term:`decorator`::" +"possible to create read-only properties easily using :func:`property` as a :" +"term:`decorator`::" msgstr "" "如果有給定 *doc*,它將會是 property 屬性的說明字串。否則,property 會複製 " -"*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使" -"用 :func:`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" +"*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" +"`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" #: ../../library/functions.rst:1675 msgid "" @@ -3112,8 +3113,8 @@ msgstr "" #: ../../library/functions.rst:1790 msgid "" -"For a general Python object ``number``, ``round`` delegates to " -"``number.__round__``." +"For a general Python object ``number``, ``round`` delegates to ``number." +"__round__``." msgstr "" #: ../../library/functions.rst:1795 @@ -3134,9 +3135,9 @@ msgstr "" #: ../../library/functions.rst:1810 msgid "" -"For other containers see the built-" -"in :class:`frozenset`, :class:`list`, :class:`tuple`, and :class:`dict` " -"classes, as well as the :mod:`collections` module." +"For other containers see the built-in :class:`frozenset`, :class:`list`, :" +"class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " +"module." msgstr "" #: ../../library/functions.rst:1817 @@ -3151,10 +3152,10 @@ msgstr "" #: ../../library/functions.rst:1823 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " -"unless the object chooses to enforce that, for example in a " -"custom :meth:`~object.__getattribute__` or via :attr:`~object.__slots__`. An " -"attribute whose name is not an identifier will not be accessible using the " -"dot notation, but is accessible through :func:`getattr` etc.." +"unless the object chooses to enforce that, for example in a custom :meth:" +"`~object.__getattribute__` or via :attr:`~object.__slots__`. An attribute " +"whose name is not an identifier will not be accessible using the dot " +"notation, but is accessible through :func:`getattr` etc.." msgstr "" #: ../../library/functions.rst:1831 @@ -3182,16 +3183,14 @@ msgstr "" #: ../../library/functions.rst:1853 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " -"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. " -"See :func:`itertools.islice` for an alternate version that returns " -"an :term:`iterator`." +"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" +"`itertools.islice` for an alternate version that returns an :term:`iterator`." msgstr "" #: ../../library/functions.rst:1858 msgid "" -"Slice objects are now :term:`hashable` " -"(provided :attr:`~slice.start`, :attr:`~slice.stop`, and :attr:`~slice.step` " -"are hashable)." +"Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" +"`~slice.stop`, and :attr:`~slice.step` are hashable)." msgstr "" #: ../../library/functions.rst:1864 @@ -3206,9 +3205,8 @@ msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" #: ../../library/functions.rst:1868 msgid "" "*key* specifies a function of one argument that is used to extract a " -"comparison key from each element in *iterable* (for example, " -"``key=str.lower``). The default value is ``None`` (compare the elements " -"directly)." +"comparison key from each element in *iterable* (for example, ``key=str." +"lower``). The default value is ``None`` (compare the elements directly)." msgstr "" #: ../../library/functions.rst:1872 @@ -3270,8 +3268,8 @@ msgstr "" #: ../../library/functions.rst:1905 msgid "" -"The ``@staticmethod`` form is a function :term:`decorator` -- " -"see :ref:`function` for details." +"The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" +"`function` for details." msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" @@ -3279,9 +3277,9 @@ msgstr "" #: ../../library/functions.rst:1908 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " -"an instance (such as ``C().f()``). Moreover, the static " -"method :term:`descriptor` is also callable, so it can be used in the class " -"definition (such as ``f()``)." +"an instance (such as ``C().f()``). Moreover, the static method :term:" +"`descriptor` is also callable, so it can be used in the class definition " +"(such as ``f()``)." msgstr "" #: ../../library/functions.rst:1913 @@ -3320,15 +3318,15 @@ msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" #: ../../library/functions.rst:1931 msgid "" -"Static methods now inherit the method attributes " -"(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " -"and :attr:`~function.__annotations__`), have a new ``__wrapped__`` " -"attribute, and are now callable as regular functions." +"Static methods now inherit the method attributes (:attr:`~function." +"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" +"attr:`~function.__doc__` and :attr:`~function.__annotations__`), have a new " +"``__wrapped__`` attribute, and are now callable as regular functions." msgstr "" -"Static method 現在繼承了 method 屬性" -"(:attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__doc__` " -"和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性," -"且為如一般函式的可呼叫物件。" +"Static method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" +"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." +"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " +"``__wrapped__`` 屬性,且為如一般函式的可呼叫物件。" #: ../../library/functions.rst:1949 msgid "" @@ -3351,10 +3349,10 @@ msgstr "" #: ../../library/functions.rst:1961 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " -"preferred, fast way to concatenate a sequence of strings is by calling " -"``''.join(sequence)``. To add floating-point values with extended " -"precision, see :func:`math.fsum`\\. To concatenate a series of iterables, " -"consider using :func:`itertools.chain`." +"preferred, fast way to concatenate a sequence of strings is by calling ``''." +"join(sequence)``. To add floating-point values with extended precision, " +"see :func:`math.fsum`\\. To concatenate a series of iterables, consider " +"using :func:`itertools.chain`." msgstr "" #: ../../library/functions.rst:1967 @@ -3388,17 +3386,17 @@ msgstr "" #: ../../library/functions.rst:1989 msgid "" -"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C " -"-> A -> object`` and the value of *type* is ``B``, then :func:`super` " +"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" +"> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" #: ../../library/functions.rst:1993 msgid "" "The :attr:`~type.__mro__` attribute of the class corresponding to " -"*object_or_type* lists the method resolution search order used by " -"both :func:`getattr` and :func:`super`. The attribute is dynamic and can " -"change whenever the inheritance hierarchy is updated." +"*object_or_type* lists the method resolution search order used by both :func:" +"`getattr` and :func:`super`. The attribute is dynamic and can change " +"whenever the inheritance hierarchy is updated." msgstr "" #: ../../library/functions.rst:1998 @@ -3481,15 +3479,15 @@ msgstr "" #: ../../library/functions.rst:2051 msgid "" -"For practical suggestions on how to design cooperative classes " -"using :func:`super`, see `guide to using super() `_." +"For practical suggestions on how to design cooperative classes using :func:" +"`super`, see `guide to using super() `_." msgstr "" #: ../../library/functions.rst:2055 msgid "" -":class:`super` objects are now :mod:`pickleable ` " -"and :mod:`copyable `." +":class:`super` objects are now :mod:`pickleable ` and :mod:" +"`copyable `." msgstr "" #: ../../library/functions.rst:2064 @@ -3501,8 +3499,8 @@ msgstr "" #: ../../library/functions.rst:2073 msgid "" "With one argument, return the type of an *object*. The return value is a " -"type object and generally the same object as returned " -"by :attr:`object.__class__`." +"type object and generally the same object as returned by :attr:`object." +"__class__`." msgstr "" #: ../../library/functions.rst:2077 @@ -3519,9 +3517,9 @@ msgid "" "tuple contains the base classes and becomes the :attr:`~type.__bases__` " "attribute; if empty, :class:`object`, the ultimate base of all classes, is " "added. The *dict* dictionary contains attribute and method definitions for " -"the class body; it may be copied or wrapped before becoming " -"the :attr:`~type.__dict__` attribute. The following two statements create " -"identical :class:`!type` objects:" +"the class body; it may be copied or wrapped before becoming the :attr:`~type." +"__dict__` attribute. The following two statements create identical :class:`!" +"type` objects:" msgstr "" #: ../../library/functions.rst:2095 @@ -3564,11 +3562,10 @@ msgstr "" #: ../../library/functions.rst:2117 msgid "" -"Objects such as modules and instances have an " -"updateable :attr:`~object.__dict__` attribute; however, other objects may " -"have write restrictions on their :attr:`!__dict__` attributes (for example, " -"classes use a :class:`types.MappingProxyType` to prevent direct dictionary " -"updates)." +"Objects such as modules and instances have an updateable :attr:`~object." +"__dict__` attribute; however, other objects may have write restrictions on " +"their :attr:`!__dict__` attributes (for example, classes use a :class:`types." +"MappingProxyType` to prevent direct dictionary updates)." msgstr "" #: ../../library/functions.rst:2122 @@ -3623,15 +3620,15 @@ msgstr "" #: ../../library/functions.rst:2151 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " -"columns into rows. This is similar to `transposing a matrix `_." +"columns into rows. This is similar to `transposing a matrix `_." msgstr "" #: ../../library/functions.rst:2155 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " -"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in " -"a :class:`list`." +"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" +"`list`." msgstr "" #: ../../library/functions.rst:2159 @@ -3688,8 +3685,8 @@ msgstr "" #: ../../library/functions.rst:2200 msgid "" "Shorter iterables can be padded with a constant value to make all the " -"iterables have the same length. This is done " -"by :func:`itertools.zip_longest`." +"iterables have the same length. This is done by :func:`itertools." +"zip_longest`." msgstr "" #: ../../library/functions.rst:2204 diff --git a/library/functools.po b/library/functools.po index b803598b208..35b6b07dfe5 100644 --- a/library/functools.po +++ b/library/functools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2024-05-11 16:02+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -147,9 +147,9 @@ msgstr "" #: ../../library/functools.rst:81 msgid "" -"The mechanics of :func:`cached_property` are somewhat different " -"from :func:`property`. A regular property blocks attribute writes unless a " -"setter is defined. In contrast, a *cached_property* allows writes." +"The mechanics of :func:`cached_property` are somewhat different from :func:" +"`property`. A regular property blocks attribute writes unless a setter is " +"defined. In contrast, a *cached_property* allows writes." msgstr "" ":func:`cached_property` 的機制與 :func:`property` 有所不同。除非定義了 " "setter,否則常規屬性會阻止屬性的寫入。相反地,*cached_property* 則允許寫入。" @@ -218,8 +218,8 @@ msgid "" "If a mutable mapping is not available or if space-efficient key sharing is " "desired, an effect similar to :func:`cached_property` can also be achieved " "by stacking :func:`property` on top of :func:`lru_cache`. See :ref:`faq-" -"cache-method-calls` for more details on how this differs " -"from :func:`cached_property`." +"cache-method-calls` for more details on how this differs from :func:" +"`cached_property`." msgstr "" "如果可變對映不可用或需要金鑰共享以節省空間,則也可以透過在 :func:`lru_cache` " "之上堆疊 :func:`property` 來實作類似於 :func:`cached_property` 的效果。請參閱" @@ -242,15 +242,16 @@ msgstr "" #: ../../library/functools.rst:130 msgid "" "Transform an old-style comparison function to a :term:`key function`. Used " -"with tools that accept key functions (such " -"as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). " -"This function is primarily used as a transition tool for programs being " -"converted from Python 2 which supported the use of comparison functions." +"with tools that accept key functions (such as :func:`sorted`, :func:`min`, :" +"func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:" +"`itertools.groupby`). This function is primarily used as a transition tool " +"for programs being converted from Python 2 which supported the use of " +"comparison functions." msgstr "" "將舊式比較函式轉換為\\ :term:`鍵函式 `,能與接受鍵函式的工具一" -"起使用(例" -"如 :func:`sorted`、:func:`min`、:func:`max`、:func:`heapq.nlargest`、:func:`heapq.nsmallest`、:func:`itertools.groupby`)。" -"此函式主要作為轉換工具,用於從有支援使用比較函式的 Python 2 轉換成的程式。" +"起使用(例如 :func:`sorted`、:func:`min`、:func:`max`、:func:`heapq." +"nlargest`、:func:`heapq.nsmallest`、:func:`itertools.groupby`)。此函式主要作" +"為轉換工具,用於從有支援使用比較函式的 Python 2 轉換成的程式。" #: ../../library/functools.rst:137 msgid "" @@ -380,9 +381,9 @@ msgstr "裝飾器還提供了一個 :func:`!cache_clear` 函式來清除或使 #: ../../library/functools.rst:216 msgid "" -"The original underlying function is accessible through " -"the :attr:`__wrapped__` attribute. This is useful for introspection, for " -"bypassing the cache, or for rewrapping the function with a different cache." +"The original underlying function is accessible through the :attr:" +"`__wrapped__` attribute. This is useful for introspection, for bypassing " +"the cache, or for rewrapping the function with a different cache." msgstr "" "原本的底層函式可以透過 :attr:`__wrapped__` 屬性存取。這對於要自我檢查 " "(introspection)、繞過快取或使用不同的快取重新包裝函式時非常有用。" @@ -412,11 +413,10 @@ msgid "" "long-running processes such as web servers." msgstr "" "當最近的呼叫是即將發生之呼叫的最佳預測因子時(例如新聞伺服器上最受歡迎的文章" -"往往每天都會發生變化),`LRU (least recently used) 快取 `_\\ 能發揮最好的效果。" -"快取的大小限制可確保快取不會在長時間運行的行程(例如 Web 伺服器)上無限制地成" -"長。" +"往往每天都會發生變化),`LRU (least recently used) 快取 `_\\ " +"能發揮最好的效果。快取的大小限制可確保快取不會在長時間運行的行程(例如 Web 伺" +"服器)上無限制地成長。" #: ../../library/functools.rst:233 msgid "" @@ -472,10 +472,9 @@ msgstr "" #: ../../library/functools.rst:258 msgid "" -"Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a " -"`dynamic programming `_ " -"technique::" +"Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a `dynamic " +"programming `_ technique::" msgstr "" "使用快取來實作\\ `動態規劃 (dynamic programming) `_ 技法以有效率地計算\\ `費波那契數 (Fibonacci " @@ -530,15 +529,13 @@ msgstr "" #: ../../library/functools.rst:293 msgid "" -"The class must define one " -"of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " -"or :meth:`~object.__ge__`. In addition, the class should supply " -"an :meth:`~object.__eq__` method." +"The class must define one of :meth:`~object.__lt__`, :meth:`~object." +"__le__`, :meth:`~object.__gt__`, or :meth:`~object.__ge__`. In addition, the " +"class should supply an :meth:`~object.__eq__` method." msgstr "" -"類別必須定" -"義 :meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object.__gt__` " -"或 :meth:`~object.__ge__` 其中之一。此外,該類別應該提" -"供 :meth:`~object.__eq__` 方法。" +"類別必須定義 :meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object." +"__gt__` 或 :meth:`~object.__ge__` 其中之一。此外,該類別應該提供 :meth:" +"`~object.__eq__` 方法。" #: ../../library/functools.rst:299 msgid "" @@ -660,6 +657,10 @@ msgid "" ">>> basetwo('10010')\n" "18" msgstr "" +">>> basetwo = partial(int, base=2)\n" +">>> basetwo.__doc__ = 'Convert base 2 string to an int.'\n" +">>> basetwo('10010')\n" +"18" #: ../../library/functools.rst:375 msgid "" @@ -682,6 +683,9 @@ msgid "" ">>> say_to_world('Hello', 'dear')\n" "Hello dear world!" msgstr "" +">>> say_to_world = partial(print, Placeholder, Placeholder, \"world!\")\n" +">>> say_to_world('Hello', 'dear')\n" +"Hello dear world!" #: ../../library/functools.rst:388 msgid "" @@ -692,11 +696,10 @@ msgstr "" #: ../../library/functools.rst:392 msgid "" -"If :func:`!partial` is applied to an existing :func:`!partial` " -"object, :data:`!Placeholder` sentinels of the input object are filled in " -"with new positional arguments. A placeholder can be retained by inserting a " -"new :data:`!Placeholder` sentinel to the place held by a previous :data:`!" -"Placeholder`:" +"If :func:`!partial` is applied to an existing :func:`!partial` object, :data:" +"`!Placeholder` sentinels of the input object are filled in with new " +"positional arguments. A placeholder can be retained by inserting a new :data:" +"`!Placeholder` sentinel to the place held by a previous :data:`!Placeholder`:" msgstr "" #: ../../library/functools.rst:398 @@ -713,6 +716,17 @@ msgid "" ">>> remove_first_dear(message)\n" "'Hello, dear world!'" msgstr "" +">>> from functools import partial, Placeholder as _\n" +">>> remove = partial(str.replace, _, _, '')\n" +">>> message = 'Hello, dear dear world!'\n" +">>> remove(message, ' dear')\n" +"'Hello, world!'\n" +">>> remove_dear = partial(remove, _, ' dear')\n" +">>> remove_dear(message)\n" +"'Hello, world!'\n" +">>> remove_first_dear = partial(remove_dear, _, 1)\n" +">>> remove_first_dear(message)\n" +"'Hello, dear world!'" #: ../../library/functools.rst:412 msgid "" @@ -726,12 +740,12 @@ msgstr "" #: ../../library/functools.rst:419 msgid "" -"Return a new :class:`partialmethod` descriptor which behaves " -"like :class:`partial` except that it is designed to be used as a method " -"definition rather than being directly callable." +"Return a new :class:`partialmethod` descriptor which behaves like :class:" +"`partial` except that it is designed to be used as a method definition " +"rather than being directly callable." msgstr "" -"回傳一個新的 :class:`partialmethod` 描述器 (descriptor),其行為類似" -"於 :class:`partial`,只不過它被設計為用於方法定義而不能直接呼叫。" +"回傳一個新的 :class:`partialmethod` 描述器 (descriptor),其行為類似於 :class:" +"`partial`,只不過它被設計為用於方法定義而不能直接呼叫。" #: ../../library/functools.rst:423 msgid "" @@ -743,25 +757,24 @@ msgstr "" #: ../../library/functools.rst:426 msgid "" -"When *func* is a descriptor (such as a normal Python " -"function, :func:`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` " -"or another instance of :class:`partialmethod`), calls to ``__get__`` are " -"delegated to the underlying descriptor, and an appropriate :ref:`partial " -"object` returned as the result." +"When *func* is a descriptor (such as a normal Python function, :func:" +"`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` or another " +"instance of :class:`partialmethod`), calls to ``__get__`` are delegated to " +"the underlying descriptor, and an appropriate :ref:`partial object` returned as the result." msgstr "" -"當 *func* 是描述器時(例如普通的 Python 函" -"式、:func:`classmethod`、:func:`staticmethod`、:func:`~abc.abstractmethod` " -"或 :class:`partialmethod` 的另一個實例),對 ``__get__`` 的呼叫將被委託 " -"(delegated) 給底層描述器,且一個適當的 :ref:`partial 物件 `\\ 會被作為結果回傳。" +"當 *func* 是描述器時(例如普通的 Python 函式、:func:`classmethod`、:func:" +"`staticmethod`、:func:`~abc.abstractmethod` 或 :class:`partialmethod` 的另一" +"個實例),對 ``__get__`` 的呼叫將被委託 (delegated) 給底層描述器,且一個適當" +"的 :ref:`partial 物件 `\\ 會被作為結果回傳。" #: ../../library/functools.rst:432 msgid "" "When *func* is a non-descriptor callable, an appropriate bound method is " "created dynamically. This behaves like a normal Python function when used as " "a method: the *self* argument will be inserted as the first positional " -"argument, even before the *args* and *keywords* supplied to " -"the :class:`partialmethod` constructor." +"argument, even before the *args* and *keywords* supplied to the :class:" +"`partialmethod` constructor." msgstr "" "當 *func* 是非描述器可呼叫物件 (non-descriptor callable) 時,會動態建立適當的" "繫結方法 (bound method)。當被作為方法使用時,其行為類似於普通的 Python 函式:" @@ -869,8 +882,8 @@ msgstr "" #: ../../library/functools.rst:494 msgid "" -"Transform a function into a :term:`single-dispatch ` :term:`generic function`." +"Transform a function into a :term:`single-dispatch ` :term:" +"`generic function`." msgstr "" "將函式轉換為\\ :term:`單一調度 `\\ :term:`泛型函式 `。" @@ -1036,8 +1049,8 @@ msgid "" "the :func:`~singledispatch.register` attribute can also be used in a " "functional form::" msgstr "" -"若要啟用註冊 :term:`lambdas` 和預先存在的函" -"式,:func:`~singledispatch.register` 屬性也能以函式形式使用: ::" +"若要啟用註冊 :term:`lambdas` 和預先存在的函式,:func:" +"`~singledispatch.register` 屬性也能以函式形式使用: ::" #: ../../library/functools.rst:579 msgid "" @@ -1129,13 +1142,13 @@ msgstr "" msgid "" "Where there is no registered implementation for a specific type, its method " "resolution order is used to find a more generic implementation. The original " -"function decorated with ``@singledispatch`` is registered for the " -"base :class:`object` type, which means it is used if no better " -"implementation is found." +"function decorated with ``@singledispatch`` is registered for the base :" +"class:`object` type, which means it is used if no better implementation is " +"found." msgstr "" "如果沒有為特定型別註冊實作,則使用其方法解析順序 (method resolution order) 來" -"尋找更通用的實作。用 ``@singledispatch`` 裝飾的原始函式是為基" -"底 :class:`object` 型別註冊的,這意味著如果沒有找到更好的實作就會使用它。" +"尋找更通用的實作。用 ``@singledispatch`` 裝飾的原始函式是為基底 :class:" +"`object` 型別註冊的,這意味著如果沒有找到更好的實作就會使用它。" #: ../../library/functools.rst:624 msgid "" @@ -1219,14 +1232,16 @@ msgstr ":func:`~singledispatch.register` 屬性現在支援使用型別註釋。 #: ../../library/functools.rst:664 msgid "" -"The :func:`~singledispatch.register` attribute now " -"supports :class:`typing.Union` as a type annotation." -msgstr ":func:`~singledispatch.register` 屬性現在支援使用 :class:`typing.Union` 型別註釋。" +"The :func:`~singledispatch.register` attribute now supports :class:`typing." +"Union` as a type annotation." +msgstr "" +":func:`~singledispatch.register` 屬性現在支援使用 :class:`typing.Union` 型別" +"註釋。" #: ../../library/functools.rst:671 msgid "" -"Transform a method into a :term:`single-dispatch ` :term:`generic function`." +"Transform a method into a :term:`single-dispatch ` :term:" +"`generic function`." msgstr "" "將方法轉換為\\ :term:`單一調度 `\\ :term:`泛型函式 `。" @@ -1272,15 +1287,15 @@ msgstr "" #: ../../library/functools.rst:692 msgid "" -"``@singledispatchmethod`` supports nesting with other decorators such " -"as :func:`@classmethod`. Note that to allow for " -"``dispatcher.register``, ``singledispatchmethod`` must be the *outer most* " -"decorator. Here is the ``Negator`` class with the ``neg`` methods bound to " -"the class, rather than an instance of the class::" +"``@singledispatchmethod`` supports nesting with other decorators such as :" +"deco:`classmethod`. Note that to allow for ``dispatcher.register``, " +"``singledispatchmethod`` must be the *outer most* decorator. Here is the " +"``Negator`` class with the ``neg`` methods bound to the class, rather than " +"an instance of the class::" msgstr "" -"``@singledispatchmethod`` 支援與其他裝飾器巢狀使用 (nesting),例" -"如 :func:`@classmethod`。請注意,為了使 ``dispatcher.register`` " -"可用,``singledispatchmethod`` 必須是\\ *最外面的*\\ 裝飾器。以下範例是 " +"``@singledispatchmethod`` 支援與其他裝飾器巢狀使用 (nesting),例如 :" +"deco:`classmethod`。請注意,為了使 ``dispatcher.register`` 可用," +"``singledispatchmethod`` 必須是\\ *最外面的*\\ 裝飾器。以下範例是 " "``Negator`` 類別,其 ``neg`` 方法繫結到該類別,而不是該類別的實例: ::" #: ../../library/functools.rst:698 @@ -1319,15 +1334,12 @@ msgstr "" #: ../../library/functools.rst:714 msgid "" -"The same pattern can be used for other similar " -"decorators: :func:`@staticmethod`, :func:`@abstractmethod`, " -"and others." +"The same pattern can be used for other similar decorators: :deco:" +"`staticmethod`, :deco:`~abc.abstractmethod`, and others." msgstr "" -"相同的模式可用於其他類似的裝飾" -"器::func:`@staticmethod`、:func:`@abstractmethod` " -"等。" +"相同的模式可用於其他類似的裝飾器::deco:`staticmethod`、:deco:`~abc.abstractmethod` 等。" -#: ../../library/functools.rst:723 +#: ../../library/functools.rst:722 msgid "" "Update a *wrapper* function to look like the *wrapped* function. The " "optional arguments are tuples to specify which attributes of the original " @@ -1335,21 +1347,23 @@ msgid "" "function and which attributes of the wrapper function are updated with the " "corresponding attributes from the original function. The default values for " "these arguments are the module level constants ``WRAPPER_ASSIGNMENTS`` " -"(which assigns to the wrapper " -"function's :attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__annotations__`, :attr:`~function.__type_params__`, " -"and :attr:`~function.__doc__`, the documentation string) and " -"``WRAPPER_UPDATES`` (which updates the wrapper " -"function's :attr:`~function.__dict__`, i.e. the instance dictionary)." +"(which assigns to the wrapper function's :attr:`~function.__module__`, :attr:" +"`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function." +"__annotations__`, :attr:`~function.__type_params__`, and :attr:`~function." +"__doc__`, the documentation string) and ``WRAPPER_UPDATES`` (which updates " +"the wrapper function's :attr:`~function.__dict__`, i.e. the instance " +"dictionary)." msgstr "" "更新 *wrapper* 函式,使其看起來像 *wrapped* 函式。可選引數是元組,用於指定原" "始函式的哪些屬性直接賦值給包裝函式上的匹配屬性,以及包裝函式的哪些屬性使用原" "始函式中的對應屬性進行更新。這些引數的預設值是模組層級的常數 " -"``WRAPPER_ASSIGNMENTS``\\ (它賦值給包裝函式" -"的 :attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__annotations__`、:attr:`~function.__type_params__` " -"和 :attr:`~function.__doc__` 文件字串 (docstring))和 ``WRAPPER_UPDATES``\\ " -"(更新包裝器函式的 :attr:`~function.__dict__`,即實例字典)。" +"``WRAPPER_ASSIGNMENTS``\\ (它賦值給包裝函式的 :attr:`~function." +"__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:" +"attr:`~function.__annotations__`、:attr:`~function.__type_params__` 和 :attr:" +"`~function.__doc__` 文件字串 (docstring))和 ``WRAPPER_UPDATES``\\ (更新包" +"裝器函式的 :attr:`~function.__dict__`,即實例字典)。" -#: ../../library/functools.rst:735 +#: ../../library/functools.rst:734 msgid "" "To allow access to the original function for introspection and other " "purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), " @@ -1360,7 +1374,7 @@ msgstr "" "飾器,如 :func:`lru_cache`),此函式會自動向包裝器新增 ``__wrapped__`` 屬性," "該包裝器參照被包裝的函式。" -#: ../../library/functools.rst:740 +#: ../../library/functools.rst:739 msgid "" "The main intended use for this function is in :term:`decorator` functions " "which wrap the decorated function and return the wrapper. If the wrapper " @@ -1372,7 +1386,7 @@ msgstr "" "裝器函式未更新,則回傳函式的元資料 (metadata) 將反映包裝器定義而非原始函式定" "義,這通常不太會有幫助。" -#: ../../library/functools.rst:746 +#: ../../library/functools.rst:745 msgid "" ":func:`update_wrapper` may be used with callables other than functions. Any " "attributes named in *assigned* or *updated* that are missing from the object " @@ -1385,31 +1399,30 @@ msgstr "" "器函式上設定它們)。如果包裝函式本身缺少 *updated* 中指定的任何屬性,仍然會引" "發 :exc:`AttributeError`。" -#: ../../library/functools.rst:752 +#: ../../library/functools.rst:751 msgid "" -"The ``__wrapped__`` attribute is now automatically added. " -"The :attr:`~function.__annotations__` attribute is now copied by default. " -"Missing attributes no longer trigger an :exc:`AttributeError`." +"The ``__wrapped__`` attribute is now automatically added. The :attr:" +"`~function.__annotations__` attribute is now copied by default. Missing " +"attributes no longer trigger an :exc:`AttributeError`." msgstr "" -"現在會自動新增 ``__wrapped__`` 屬性。現在預設會複" -"製 :attr:`~function.__annotations__` 屬性。缺少的屬性不再觸" -"發 :exc:`AttributeError`。" +"現在會自動新增 ``__wrapped__`` 屬性。現在預設會複製 :attr:`~function." +"__annotations__` 屬性。缺少的屬性不再觸發 :exc:`AttributeError`。" -#: ../../library/functools.rst:757 +#: ../../library/functools.rst:756 msgid "" "The ``__wrapped__`` attribute now always refers to the wrapped function, " -"even if that function defined a ``__wrapped__`` attribute. " -"(see :issue:`17482`)" +"even if that function defined a ``__wrapped__`` attribute. (see :issue:" +"`17482`)" msgstr "" "``__wrapped__`` 屬性現在都會參照包裝函式,即便函式有定義 ``__wrapped__`` 屬" "性。(參見 :issue:`17482`)" -#: ../../library/functools.rst:762 +#: ../../library/functools.rst:761 msgid "" "The :attr:`~function.__type_params__` attribute is now copied by default." msgstr "現在預設會複製 :attr:`~function.__type_params__` 屬性。" -#: ../../library/functools.rst:768 +#: ../../library/functools.rst:767 msgid "" "This is a convenience function for invoking :func:`update_wrapper` as a " "function decorator when defining a wrapper function. It is equivalent to " @@ -1420,7 +1433,7 @@ msgstr "" "式裝飾器。它相當於 ``partial(update_wrapper, wrapped=wrapped, " "assigned=assigned, updated=updated)``。例如: ::" -#: ../../library/functools.rst:773 +#: ../../library/functools.rst:772 msgid "" ">>> from functools import wraps\n" ">>> def my_decorator(f):\n" @@ -1443,8 +1456,28 @@ msgid "" ">>> example.__doc__\n" "'Docstring'" msgstr "" +">>> from functools import wraps\n" +">>> def my_decorator(f):\n" +"... @wraps(f)\n" +"... def wrapper(*args, **kwds):\n" +"... print('Calling decorated function')\n" +"... return f(*args, **kwds)\n" +"... return wrapper\n" +"...\n" +">>> @my_decorator\n" +"... def example():\n" +"... \"\"\"Docstring\"\"\"\n" +"... print('Called example function')\n" +"...\n" +">>> example()\n" +"Calling decorated function\n" +"Called example function\n" +">>> example.__name__\n" +"'example'\n" +">>> example.__doc__\n" +"'Docstring'" -#: ../../library/functools.rst:794 +#: ../../library/functools.rst:793 msgid "" "Without the use of this decorator factory, the name of the example function " "would have been ``'wrapper'``, and the docstring of the original :func:`!" @@ -1453,11 +1486,11 @@ msgstr "" "如果不使用這個裝飾器工廠 (decorator factory),範例函式的名稱將會是 " "``'wrapper'``,並且原始 :func:`!example` 的文件字串將會遺失。" -#: ../../library/functools.rst:802 +#: ../../library/functools.rst:801 msgid ":class:`partial` Objects" msgstr ":class:`partial` 物件" -#: ../../library/functools.rst:804 +#: ../../library/functools.rst:803 msgid "" ":class:`partial` objects are callable objects created by :func:`partial`. " "They have three read-only attributes:" @@ -1465,7 +1498,7 @@ msgstr "" ":class:`partial` 物件是由 :func:`partial` 所建立的可呼叫物件。它們有三個唯讀" "屬性:" -#: ../../library/functools.rst:810 +#: ../../library/functools.rst:809 msgid "" "A callable object or function. Calls to the :class:`partial` object will be " "forwarded to :attr:`func` with new arguments and keywords." @@ -1473,7 +1506,7 @@ msgstr "" "一個可呼叫的物件或函式。對 :class:`partial` 物件的呼叫將被轉送到帶有新引數和" "關鍵字的 :attr:`func`。" -#: ../../library/functools.rst:816 +#: ../../library/functools.rst:815 msgid "" "The leftmost positional arguments that will be prepended to the positional " "arguments provided to a :class:`partial` object call." @@ -1481,21 +1514,21 @@ msgstr "" "最左邊的位置引數將會被加入到提供給 :class:`partial` 物件呼叫的位置引數的前" "面。" -#: ../../library/functools.rst:822 +#: ../../library/functools.rst:821 msgid "" "The keyword arguments that will be supplied when the :class:`partial` object " "is called." msgstr "呼叫 :class:`partial` 物件時將提供的關鍵字引數。" -#: ../../library/functools.rst:825 +#: ../../library/functools.rst:824 msgid "" ":class:`partial` objects are like :ref:`function objects ` in that they are callable, weak referenceable, and can have " -"attributes. There are some important differences. For instance, " -"the :attr:`~definition.__name__` and :attr:`~definition.__doc__` attributes " -"are not created automatically." +"attributes. There are some important differences. For instance, the :attr:" +"`~definition.__name__` and :attr:`~definition.__doc__` attributes are not " +"created automatically." msgstr "" ":class:`partial` 物件與\\ :ref:`函式物件 `\\ 類似,因為它" -"們是可呼叫的、可弱參照的 (weak referencable) 且可以具有屬性的。但有一些重要的區" -"別,例如,:attr:`~definition.__name__` 和 :attr:`~definition.__doc__` 屬性不會自動" -"建立。" +"們是可呼叫的、可弱參照的 (weak referencable) 且可以具有屬性的。但有一些重要的" +"區別,例如,:attr:`~definition.__name__` 和 :attr:`~definition.__doc__` 屬性" +"不會自動建立。" diff --git a/library/gc.po b/library/gc.po index 9d53e9812a8..abcbc0941b3 100644 --- a/library/gc.po +++ b/library/gc.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-09-29 00:15+0000\n" "PO-Revision-Date: 2023-04-24 21:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -69,26 +69,26 @@ msgid "" "is raised if the generation number is invalid. The sum of collected objects " "and uncollectable objects is returned." msgstr "" -"啟動垃圾回收。可選的引數 *generation* 可以是一個指" -"明需要回收哪一代垃圾的整數(從 0 到 2)。當 generation 數值無效時,會引" -"發 :exc:`ValueError` 例外。可回收物件與不可回收物件的總和會被回傳。" +"啟動垃圾回收。可選的引數 *generation* 可以是一個指明需要回收哪一代垃圾的整數" +"(從 0 到 2)。當 generation 數值無效時,會引發 :exc:`ValueError` 例外。可回" +"收物件與不可回收物件的總和會被回傳。" #: ../../library/gc.rst:48 msgid "" "Calling ``gc.collect(0)`` will perform a GC collection on the young " "generation." -msgstr "" +msgstr "呼叫 ``gc.collect(0)`` 將對年輕代執行 GC 回收。" #: ../../library/gc.rst:50 msgid "" "Calling ``gc.collect(1)`` will perform a GC collection on the young " "generation and an increment of the old generation." -msgstr "" +msgstr "呼叫 ``gc.collect(1)`` 將對年輕代執行 GC 回收並對年老代執行增量回收。" #: ../../library/gc.rst:53 msgid "" "Calling ``gc.collect(2)`` or ``gc.collect()`` performs a full collection" -msgstr "" +msgstr "呼叫 ``gc.collect(2)`` 或 ``gc.collect()`` 執行完整回收" #: ../../library/gc.rst:55 msgid "" @@ -109,7 +109,7 @@ msgstr "當直譯器已經執行收集時呼叫 ``gc.collect()`` 的效果是未 #: ../../library/gc.rst:63 msgid "``generation=1`` performs an increment of collection." -msgstr "" +msgstr "``generation=1`` 會執行增量收集。" #: ../../library/gc.rst:69 msgid "" @@ -139,7 +139,7 @@ msgstr "0: 年輕代中的所有物件。" #: ../../library/gc.rst:86 msgid "1: No objects, as there is no generation 1 (as of Python 3.14)" -msgstr "1: 沒有物件,因為不存在第 1 代(截至 Python 3.14)" +msgstr "1: 沒有物件,因為不存在第一代(截至 Python 3.14)" #: ../../library/gc.rst:87 msgid "2: All objects in the old generation" @@ -151,7 +151,7 @@ msgstr "新增 *generation* 參數。" #: ../../library/gc.rst:92 msgid "Generation 1 is removed" -msgstr "" +msgstr "第一代已被刪除" #: ../../library/gc.rst:95 msgid "" @@ -187,8 +187,8 @@ msgid "" "uncollectable (and were therefore moved to the :data:`garbage` list) inside " "this generation." msgstr "" -"``uncollectable`` 是在這一代中被發現無法回收的物件總數(因此被移" -"到 :data:`garbage` list 中)。" +"``uncollectable`` 是在這一代中被發現無法回收的物件總數(因此被移到 :data:" +"`garbage` list 中)。" #: ../../library/gc.rst:118 msgid "" @@ -202,6 +202,8 @@ msgid "" "have survived a collection. New objects are placed in the young generation. " "If an object survives a collection it is moved into the old generation." msgstr "" +"GC 根據物件是否在回收中倖存下來而將其分為兩代。新的物件會被放置在年輕代中。如果一" +"個物件在回收中倖存下來,它將被移動到年老代中。" #: ../../library/gc.rst:125 msgid "" @@ -211,6 +213,9 @@ msgid "" "*threshold0*, collection starts. For each collection, all the objects in the " "young generation and some fraction of the old generation is collected." msgstr "" +"為了決定何時運行,回收器會追蹤自上次回收以來物件分配和釋放的數量。當分配數" +"量減去釋放數量超過 *threshold0* 時,回收就會開始。每次回收都會去回收年輕代中的所有物件" +"和年老代的部分物件。" #: ../../library/gc.rst:131 msgid "" @@ -219,6 +224,9 @@ msgid "" "by 10% since the last collection and the net number of object allocations " "has not exceeded 40 times *threshold0*, the collection is not run." msgstr "" +"在自由執行緒建置 (free-threaded build) 中,在運行回收器之前還會檢查行程記憶體使用量的" +"增加。如果自上次回收以來記憶體使用量未增加 10%,且物件分配的淨數量未超過 *threshold0* " +"的 40 倍,則不會運行回收。" #: ../../library/gc.rst:136 msgid "" @@ -227,20 +235,24 @@ msgid "" "in the old generation are collected. For the default value of 10, 1% of the " "old generation is scanned during each collection." msgstr "" +"年老代中被回收的物件比例與 *threshold1* 成\\ **反比**。*threshold1* 越大,年老代中" +"物件的回收就越慢。以預設值 10 來說,每次回收時會掃描年老代中的 1%。" #: ../../library/gc.rst:141 msgid "*threshold2* is ignored." -msgstr "" +msgstr "*threshold2* 會被忽略。" #: ../../library/gc.rst:143 msgid "" -"See `Garbage collector design `_ for more information." +"See `Garbage collector design `_ for more information." msgstr "" +"有關更多資訊,請參閱\\ `垃圾回收器設計 `_。" #: ../../library/gc.rst:145 msgid "*threshold2* is ignored" -msgstr "" +msgstr "*threshold2* 會被忽略" #: ../../library/gc.rst:151 msgid "" @@ -292,35 +304,34 @@ msgid "" "Raises an :ref:`auditing event ` ``gc.get_referrers`` with " "argument ``objs``." msgstr "" -"引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` " -"``gc.get_referrers``。" +"引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." +"get_referrers``。" #: ../../library/gc.rst:184 msgid "" "Return a list of objects directly referred to by any of the arguments. The " -"referents returned are those objects visited by the arguments' C-" -"level :c:member:`~PyTypeObject.tp_traverse` methods (if any), and may not be " -"all objects actually directly " -"reachable. :c:member:`~PyTypeObject.tp_traverse` methods are supported only " -"by objects that support garbage collection, and are only required to visit " -"objects that may be involved in a cycle. So, for example, if an integer is " -"directly reachable from an argument, that integer object may or may not " -"appear in the result list." +"referents returned are those objects visited by the arguments' C-level :c:" +"member:`~PyTypeObject.tp_traverse` methods (if any), and may not be all " +"objects actually directly reachable. :c:member:`~PyTypeObject.tp_traverse` " +"methods are supported only by objects that support garbage collection, and " +"are only required to visit objects that may be involved in a cycle. So, for " +"example, if an integer is directly reachable from an argument, that integer " +"object may or may not appear in the result list." msgstr "" "回傳包含被任意一個引數直接參照之物件的 list。回傳的被參照物件是有被引數的 C " "語言級別 :c:member:`~PyTypeObject.tp_traverse` 方法(若存在)瀏覽到的物件,可" -"能不是所有的實際直接可達物件。只有支援垃圾回收的物件支" -"援 :c:member:`~PyTypeObject.tp_traverse` 方法,並且此方法只會瀏覽涉及參照迴圈" -"的物件。因此,可以有以下例子:一個整數對於一個引數是直接可達的,這個整數物件" -"有可能出現或不出現在結果的 list 當中。" +"能不是所有的實際直接可達物件。只有支援垃圾回收的物件支援 :c:member:" +"`~PyTypeObject.tp_traverse` 方法,並且此方法只會瀏覽涉及參照迴圈的物件。因" +"此,可以有以下例子:一個整數對於一個引數是直接可達的,這個整數物件有可能出現" +"或不出現在結果的 list 當中。" #: ../../library/gc.rst:192 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referents`` with " "argument ``objs``." msgstr "" -"引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` " -"``gc.get_referents``。" +"引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." +"get_referents``。" #: ../../library/gc.rst:196 msgid "" @@ -417,9 +428,9 @@ msgstr "" "如果一個行程將在沒有 ``exec()`` 的情況下進行 ``fork()``,避免子行程中不必要的" "寫入時複製將最大化記憶體共享並減少整體記憶體使用。這需要避免在父行程的記憶體" "頁面中建立已釋放的「漏洞」,並確保子行程中的 GC 收集不會觸及源自父行程的長壽" -"命物件的 ``gc_refs`` 計數器。要實現這兩個目標,請在父行程的早期呼叫 " -"``gc.disable()``,在 ``fork()`` 之前呼叫 ``gc.freeze()``,並儘早在子行程中呼" -"叫 ``gc.enable()``。" +"命物件的 ``gc_refs`` 計數器。要實現這兩個目標,請在父行程的早期呼叫 ``gc." +"disable()``,在 ``fork()`` 之前呼叫 ``gc.freeze()``,並儘早在子行程中呼叫 " +"``gc.enable()``。" #: ../../library/gc.rst:257 msgid "" @@ -458,22 +469,22 @@ msgstr "" #: ../../library/gc.rst:283 msgid "" -"If this list is non-empty at :term:`interpreter shutdown`, " -"a :exc:`ResourceWarning` is emitted, which is silent by default. " -"If :const:`DEBUG_UNCOLLECTABLE` is set, in addition all uncollectable " -"objects are printed." +"If this list is non-empty at :term:`interpreter shutdown`, a :exc:" +"`ResourceWarning` is emitted, which is silent by default. If :const:" +"`DEBUG_UNCOLLECTABLE` is set, in addition all uncollectable objects are " +"printed." msgstr "" -"當 :term:`interpreter shutdown` 即直譯器關閉時,若此 list 非空,會產" -"生 :exc:`ResourceWarning`,在預設情況下此警告不會被提醒。如果設定" -"了 :const:`DEBUG_UNCOLLECTABLE`,所有無法被回收的物件會被印出。" +"當 :term:`interpreter shutdown` 即直譯器關閉時,若此 list 非空,會產生 :exc:" +"`ResourceWarning`,在預設情況下此警告不會被提醒。如果設定了 :const:" +"`DEBUG_UNCOLLECTABLE`,所有無法被回收的物件會被印出。" #: ../../library/gc.rst:289 msgid "" "Following :pep:`442`, objects with a :meth:`~object.__del__` method don't " "end up in :data:`gc.garbage` anymore." msgstr "" -"根據 :pep:`442`,帶有 :meth:`~object.__del__` method 的物件最終不會" -"在 :data:`gc.garbage` 內。" +"根據 :pep:`442`,帶有 :meth:`~object.__del__` method 的物件最終不會在 :data:" +"`gc.garbage` 內。" #: ../../library/gc.rst:295 msgid "" diff --git a/library/glob.po b/library/glob.po index 6eba211699a..b2f5820851f 100644 --- a/library/glob.po +++ b/library/glob.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-10-21 00:14+0000\n" "PO-Revision-Date: 2023-01-24 01:21+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,30 +29,35 @@ msgstr "**原始碼:**\\ :source:`Lib/glob.py`" #: ../../library/glob.rst:21 msgid "" -"The :mod:`glob` module finds all the pathnames matching a specified pattern " -"according to the rules used by the Unix shell, although results are returned " -"in arbitrary order. No tilde expansion is done, but ``*``, ``?``, and " +"The :mod:`!glob` module finds pathnames using pattern matching rules similar " +"to the Unix shell. No tilde expansion is done, but ``*``, ``?``, and " "character ranges expressed with ``[]`` will be correctly matched. This is " "done by using the :func:`os.scandir` and :func:`fnmatch.fnmatch` functions " "in concert, and not by actually invoking a subshell." msgstr "" -":mod:`glob` 模組根據 Unix shell 使用的規則查找與指定模式匹配的所有路徑名稱," -"結果以任意順序回傳。沒有波浪號 (tilde) 擴展,但是 ``*``、``?`` 和用 ``[]`` 表" -"示的字元範圍將被正確匹配。這是透過同時使用 :func:`os.scandir` 和 :func:" -"`fnmatch.fnmatch` 函式來完成的,而沒有實際呼叫 subshell。" +":mod:`!glob` 模組使用類似於 Unix shell 的模式匹配規則來尋找路徑名稱。不會進" +"行波浪號擴展 (tilde expansion) ,但 ``*``、``?`` 和使用 ``[]`` 表達的字元範圍將會被正確匹配。這" +"是透過結合使用 :func:`os.scandir` 和 :func:`fnmatch.fnmatch` 函式來完成的,而沒有實際呼叫 subshell。" -#: ../../library/glob.rst:28 +#: ../../library/glob.rst:29 msgid "" -"Note that files beginning with a dot (``.``) can only be matched by patterns " -"that also start with a dot, unlike :func:`fnmatch.fnmatch` or :func:`pathlib." -"Path.glob`. (For tilde and shell variable expansion, use :func:`os.path." -"expanduser` and :func:`os.path.expandvars`.)" +"The pathnames are returned in no particular order. If you need a specific " +"order, sort the results." msgstr "" -"請注意,以點 (``.``) 開頭的檔案只能與同樣以點開頭的模式匹配,這與 :func:" -"`fnmatch.fnmatch` 或 :func:`pathlib.Path.glob` 不同。(對於波浪號和 shell 變" -"數擴展,請使用 :func:`os.path.expanduser` 和 :func:`os.path.expandvars`。)" +"路徑名稱不會以特定順序回傳。如果你需要特定的順序,請對結果進行排序。" -#: ../../library/glob.rst:34 +#: ../../library/glob.rst:32 +msgid "" +"Files beginning with a dot (``.``) can only be matched by patterns that also " +"start with a dot, unlike :func:`fnmatch.fnmatch` or :func:`pathlib.Path." +"glob`. For tilde and shell variable expansion, use :func:`os.path." +"expanduser` and :func:`os.path.expandvars`." +msgstr "" +"以點 (``.``) 開頭的檔案只能與同樣以點開頭的模式匹配,這與 :func:" +"`fnmatch.fnmatch` 或 :func:`pathlib.Path.glob` 不同。對於波浪號和 shell 變" +"數擴展,請使用 :func:`os.path.expanduser` 和 :func:`os.path.expandvars`。" + +#: ../../library/glob.rst:38 msgid "" "For a literal match, wrap the meta-characters in brackets. For example, " "``'[?]'`` matches the character ``'?'``." @@ -60,11 +65,11 @@ msgstr "" "對於文本 (literal) 匹配,將元字元 (meta-character) 括在方括號中。例如," "``'[?]'`` 會匹配 ``'?'`` 字元。" -#: ../../library/glob.rst:37 -msgid "The :mod:`glob` module defines the following functions:" -msgstr ":mod:`glob` 模組定義了以下函式:" +#: ../../library/glob.rst:41 +msgid "The :mod:`!glob` module defines the following functions:" +msgstr ":mod:`!glob` 模組定義了以下函式:" -#: ../../library/glob.rst:43 +#: ../../library/glob.rst:47 msgid "" "Return a possibly empty list of path names that match *pathname*, which must " "be a string containing a path specification. *pathname* can be either " @@ -82,25 +87,25 @@ msgstr "" "取決於檔案系統 (file system)。如果在呼叫此函式期間刪除或新增滿足條件的檔案," "則結果不一定會包含該檔案的路徑名稱。" -#: ../../library/glob.rst:52 +#: ../../library/glob.rst:56 msgid "" "If *root_dir* is not ``None``, it should be a :term:`path-like object` " "specifying the root directory for searching. It has the same effect on :" -"func:`glob` as changing the current directory before calling it. If " +"func:`!glob` as changing the current directory before calling it. If " "*pathname* is relative, the result will contain paths relative to *root_dir*." msgstr "" "如果 *root_dir* 不是 ``None``,它應該是一個指定搜尋根目錄的 :term:`path-like " -"object`。它在呼叫它之前更改目前目錄的影響與 :func:`glob` 相同。如果 " +"object`。它在呼叫它之前更改目前目錄的影響與 :func:`!glob` 相同。如果 " "*pathname* 是相對的,結果將包含相對於 *root_dir* 的路徑。" -#: ../../library/glob.rst:58 +#: ../../library/glob.rst:62 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" "此函式可以支援以 *dir_fd* 參數使用\\ :ref:`相對目錄描述器的路徑 `。" -#: ../../library/glob.rst:64 +#: ../../library/glob.rst:68 msgid "" "If *recursive* is true, the pattern \"``**``\" will match any files and zero " "or more directories, subdirectories and symbolic links to directories. If " @@ -111,13 +116,13 @@ msgstr "" "和目錄的符號連結。如果模式後面有 :data:`os.sep` 或 :data:`os.altsep` 那麼檔案" "將不會被匹配。" -#: ../../library/glob.rst:69 +#: ../../library/glob.rst:73 msgid "" "If *include_hidden* is true, \"``**``\" pattern will match hidden " "directories." msgstr "如果 *include_hidden* 為真,\"``**``\" 模式將匹配被隱藏的目錄。" -#: ../../library/glob.rst:71 ../../library/glob.rst:98 +#: ../../library/glob.rst:75 ../../library/glob.rst:102 msgid "" "Raises an :ref:`auditing event ` ``glob.glob`` with arguments " "``pathname``, ``recursive``." @@ -125,7 +130,7 @@ msgstr "" "引發一個附帶引數 ``pathname``、``recursive`` 的\\ :ref:`稽核事件 ` " "``glob.glob``。" -#: ../../library/glob.rst:72 ../../library/glob.rst:99 +#: ../../library/glob.rst:76 ../../library/glob.rst:103 msgid "" "Raises an :ref:`auditing event ` ``glob.glob/2`` with arguments " "``pathname``, ``recursive``, ``root_dir``, ``dir_fd``." @@ -133,31 +138,31 @@ msgstr "" "引發一個附帶引數 ``pathname``、``recursive``、``root_dir``、``dir_fd`` 的\\ :" "ref:`稽核事件 ` ``glob.glob/2``。" -#: ../../library/glob.rst:75 +#: ../../library/glob.rst:79 msgid "" "Using the \"``**``\" pattern in large directory trees may consume an " "inordinate amount of time." msgstr "在大型目錄樹中使用 \"``**``\" 模式可能會消耗過多的時間。" -#: ../../library/glob.rst:79 ../../library/glob.rst:102 +#: ../../library/glob.rst:83 ../../library/glob.rst:106 msgid "" "This function may return duplicate path names if *pathname* contains " "multiple \"``**``\" patterns and *recursive* is true." msgstr "" -#: ../../library/glob.rst:82 ../../library/glob.rst:105 +#: ../../library/glob.rst:86 ../../library/glob.rst:109 msgid "Support for recursive globs using \"``**``\"." msgstr "支援以 \"``**``\" 使用遞迴 glob。" -#: ../../library/glob.rst:85 ../../library/glob.rst:108 +#: ../../library/glob.rst:89 ../../library/glob.rst:112 msgid "Added the *root_dir* and *dir_fd* parameters." msgstr "新增 *root_dir* 與 *dir_fd* 參數。" -#: ../../library/glob.rst:88 ../../library/glob.rst:111 +#: ../../library/glob.rst:92 ../../library/glob.rst:115 msgid "Added the *include_hidden* parameter." msgstr "新增 *include_hidden* 參數。" -#: ../../library/glob.rst:95 +#: ../../library/glob.rst:99 msgid "" "Return an :term:`iterator` which yields the same values as :func:`glob` " "without actually storing them all simultaneously." @@ -165,7 +170,7 @@ msgstr "" "回傳一個會產生與 :func:`glob` 相同的值的 :term:`iterator` ,而不是同時儲存全" "部的值。" -#: ../../library/glob.rst:117 +#: ../../library/glob.rst:121 msgid "" "Escape all special characters (``'?'``, ``'*'`` and ``'['``). This is useful " "if you want to match an arbitrary literal string that may have special " @@ -178,52 +183,52 @@ msgstr "" "(sharepoints) 中的特殊字元不會被跳脫,例如在 Windows 上,``escape('//?/c:/" "Quo vadis?.txt')`` 會回傳 ``'//?/c:/Quo vadis[?].txt'``。" -#: ../../library/glob.rst:128 +#: ../../library/glob.rst:132 msgid "" "Convert the given path specification to a regular expression for use with :" "func:`re.match`. The path specification can contain shell-style wildcards." msgstr "" -#: ../../library/glob.rst:131 +#: ../../library/glob.rst:135 msgid "For example:" msgstr "舉例來說:" -#: ../../library/glob.rst:142 +#: ../../library/glob.rst:146 msgid "" "Path separators and segments are meaningful to this function, unlike :func:" "`fnmatch.translate`. By default wildcards do not match path separators, and " "``*`` pattern segments match precisely one path segment." msgstr "" -#: ../../library/glob.rst:146 +#: ../../library/glob.rst:150 msgid "" "If *recursive* is true, the pattern segment \"``**``\" will match any number " "of path segments." msgstr "" -#: ../../library/glob.rst:149 +#: ../../library/glob.rst:153 msgid "" "If *include_hidden* is true, wildcards can match path segments that start " "with a dot (``.``)." msgstr "" -#: ../../library/glob.rst:152 +#: ../../library/glob.rst:156 msgid "" "A sequence of path separators may be supplied to the *seps* argument. If not " "given, :data:`os.sep` and :data:`~os.altsep` (if available) are used." msgstr "" -#: ../../library/glob.rst:157 +#: ../../library/glob.rst:161 msgid "" ":meth:`pathlib.PurePath.full_match` and :meth:`pathlib.Path.glob` methods, " "which call this function to implement pattern matching and globbing." msgstr "" -#: ../../library/glob.rst:165 +#: ../../library/glob.rst:169 msgid "Examples" msgstr "範例" -#: ../../library/glob.rst:167 +#: ../../library/glob.rst:171 msgid "" "Consider a directory containing the following files: :file:`1.gif`, :file:`2." "txt`, :file:`card.gif` and a subdirectory :file:`sub` which contains only " @@ -234,7 +239,7 @@ msgstr "" "gif`,和一個僅包含 :file:`3.txt` 檔案的子目錄 :file:`sub`,:func:`glob` 將產" "生以下結果。請注意路徑的任何前導部分是如何保留的。 ::" -#: ../../library/glob.rst:173 +#: ../../library/glob.rst:177 msgid "" ">>> import glob\n" ">>> glob.glob('./[0-9].*')\n" @@ -260,7 +265,7 @@ msgstr "" ">>> glob.glob('./**/', recursive=True)\n" "['./', './sub/']" -#: ../../library/glob.rst:185 +#: ../../library/glob.rst:189 msgid "" "If the directory contains files starting with ``.`` they won't be matched by " "default. For example, consider a directory containing :file:`card.gif` and :" @@ -269,7 +274,7 @@ msgstr "" "如果目錄包含以 ``.`` 開頭的檔案,則預設情況下不會去匹配到它們。例如,一個包" "含 :file:`card.gif` 和 :file:`.card.gif` 的目錄: ::" -#: ../../library/glob.rst:189 +#: ../../library/glob.rst:193 msgid "" ">>> import glob\n" ">>> glob.glob('*.gif')\n" @@ -283,12 +288,12 @@ msgstr "" ">>> glob.glob('.c*')\n" "['.card.gif']" -#: ../../library/glob.rst:196 +#: ../../library/glob.rst:200 msgid "" "The :mod:`fnmatch` module offers shell-style filename (not path) expansion." msgstr ":mod:`fnmatch` 模組提供了 shell 風格檔案名(不是路徑)的擴展" -#: ../../library/glob.rst:199 +#: ../../library/glob.rst:203 msgid "The :mod:`pathlib` module offers high-level path objects." msgstr ":mod:`pathlib` 模組提供高階路徑物件。" @@ -304,7 +309,7 @@ msgstr "pathname expansion(路徑名稱展開)" msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/glob.rst:13 ../../library/glob.rst:61 +#: ../../library/glob.rst:13 ../../library/glob.rst:65 msgid "in glob-style wildcards" msgstr "於 glob 風格的萬用字元中" @@ -328,6 +333,6 @@ msgstr "- (減號)" msgid ". (dot)" msgstr ". (點)" -#: ../../library/glob.rst:61 +#: ../../library/glob.rst:65 msgid "**" msgstr "**" diff --git a/library/hashlib.po b/library/hashlib.po index 9c32394b8f0..91b8e4ca77a 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-24 05:58+0000\n" +"POT-Creation-Date: 2025-10-03 00:13+0000\n" "PO-Revision-Date: 2024-05-11 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,8 +43,8 @@ msgstr "" #: ../../library/hashlib.rst:31 msgid "" -"If you want the adler32 or crc32 hash functions, they are available in " -"the :mod:`zlib` module." +"If you want the adler32 or crc32 hash functions, they are available in the :" +"mod:`zlib` module." msgstr "" "如果你需要 adler32 或 crc32 雜湊函式,可以在 :mod:`zlib` 模組中找到它們。" @@ -55,13 +55,13 @@ msgstr "雜湊演算法" #: ../../library/hashlib.rst:40 msgid "" "There is one constructor method named for each type of :dfn:`hash`. All " -"return a hash object with the same simple interface. For example: " -"use :func:`sha256` to create a SHA-256 hash object. You can now feed this " -"object with :term:`bytes-like objects ` " -"(normally :class:`bytes`) using the :meth:`update` method. At " -"any point you can ask it for the :dfn:`digest` of the concatenation of the " -"data fed to it so far using the :meth:`digest()` " -"or :meth:`hexdigest()` methods." +"return a hash object with the same simple interface. For example: use :func:" +"`sha256` to create a SHA-256 hash object. You can now feed this object with :" +"term:`bytes-like objects ` (normally :class:`bytes`) " +"using the :meth:`update` method. At any point you can ask it " +"for the :dfn:`digest` of the concatenation of the data fed to it so far " +"using the :meth:`digest()` or :meth:`hexdigest()` methods." msgstr "" "每種種類的 :dfn:`hash` 都有一個以其命名的建構函式方法。全部都會回傳具有相同簡" "單介面的雜湊物件。例如:可使用 :func:`sha256` 來建立 SHA-256 雜湊物件。現在你" @@ -74,8 +74,8 @@ msgstr "" #: ../../library/hashlib.rst:48 msgid "" "To allow multithreading, the Python :term:`GIL` is released while computing " -"a hash supplied more than 2047 bytes of data at once in its constructor " -"or :meth:`.update` method." +"a hash supplied more than 2047 bytes of data at once in its constructor or :" +"meth:`.update` method." msgstr "" "為了允許多執行緒 (multithreading),Python :term:`GIL` 被釋放,同時在其建構函" "式或 :meth:`.update` 方法中計算一次提供超過 2047 位元組資料的雜" @@ -83,25 +83,27 @@ msgstr "" #: ../../library/hashlib.rst:55 msgid "" -"Constructors for hash algorithms that are always present in this module " -"are :func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, :func:`sha512`, :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256`, :func:`blake2b`, " -"and :func:`blake2s`. :func:`md5` is normally available as well, though it " -"may be missing or blocked if you are using a rare \"FIPS compliant\" build " -"of Python. These correspond to :data:`algorithms_guaranteed`." -msgstr "" -"此模組中始終存在的雜湊演算法之建構函式" -"有 :func:`sha1`、:func:`sha224`、:func:`sha256`、:func:`sha384`、:func:`sha512`、:func:`sha3_224`、:func:`sha3_256`、:func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:`shake_256`、:func:`blake2b` " -"和 :func:`blake2s`。:func:`md5` 通常也可用,但如果你使用罕見的「符合 FIPS " -"(FIPS compliant)」的 Python 建置版本,它可能不存在或者不被允許使用。以上會對" -"應到 :data:`algorithms_guaranteed`。" +"Constructors for hash algorithms that are always present in this module are :" +"func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, :func:" +"`sha512`, :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:" +"`sha3_512`, :func:`shake_128`, :func:`shake_256`, :func:`blake2b`, and :func:" +"`blake2s`. :func:`md5` is normally available as well, though it may be " +"missing or blocked if you are using a rare \"FIPS compliant\" build of " +"Python. These correspond to :data:`algorithms_guaranteed`." +msgstr "" +"此模組中始終存在的雜湊演算法之建構函式有 :func:`sha1`、:func:`sha224`、:func:" +"`sha256`、:func:`sha384`、:func:`sha512`、:func:`sha3_224`、:func:" +"`sha3_256`、:func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:" +"`shake_256`、:func:`blake2b` 和 :func:`blake2s`。:func:`md5` 通常也可用,但如" +"果你使用罕見的「符合 FIPS (FIPS compliant)」的 Python 建置版本,它可能不存在" +"或者不被允許使用。以上會對應到 :data:`algorithms_guaranteed`。" #: ../../library/hashlib.rst:63 msgid "" -"Additional algorithms may also be available if your Python " -"distribution's :mod:`hashlib` was linked against a build of OpenSSL that " -"provides others. Others *are not guaranteed available* on all installations " -"and will only be accessible by name via :func:`new`. " -"See :data:`algorithms_available`." +"Additional algorithms may also be available if your Python distribution's :" +"mod:`hashlib` was linked against a build of OpenSSL that provides others. " +"Others *are not guaranteed available* on all installations and will only be " +"accessible by name via :func:`new`. See :data:`algorithms_available`." msgstr "" "如果你的 Python 發行版的 :mod:`hashlib` 與提供其他演算法的 OpenSSL 版本鏈結," "也可能有其他演算法可用。其他則\\ *不保證可用*\\ 於在所有安裝上,並且只能以名" @@ -119,13 +121,13 @@ msgstr "" #: ../../library/hashlib.rst:74 msgid "" -"SHA3 (Keccak) and SHAKE " -"constructors :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256` " -"were added. :func:`blake2b` and :func:`blake2s` were added." +"SHA3 (Keccak) and SHAKE constructors :func:`sha3_224`, :func:`sha3_256`, :" +"func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256` were " +"added. :func:`blake2b` and :func:`blake2s` were added." msgstr "" -"新增了 SHA3 (Keccak) 和 SHAKE 建構函" -"式 :func:`sha3_224`、:func:`sha3_256`、:func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:`shake_256`。" -"也新增了 :func:`blake2b` 和 :func:`blake2s`。" +"新增了 SHA3 (Keccak) 和 SHAKE 建構函式 :func:`sha3_224`、:func:`sha3_256`、:" +"func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:`shake_256`。也新" +"增了 :func:`blake2b` 和 :func:`blake2s`。" #: ../../library/hashlib.rst:82 msgid "" @@ -172,7 +174,8 @@ msgid "" ">>> m.update(b\" the spammish repetition\")\n" ">>> m.digest()\n" "b'\\x03\\x1e\\xdd}Ae\\x15\\x93\\xc5\\xfe\\\\" -"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" +"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:" +"\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" ">>> m.hexdigest()\n" "'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'" msgstr "" @@ -182,7 +185,8 @@ msgstr "" ">>> m.update(b\" the spammish repetition\")\n" ">>> m.digest()\n" "b'\\x03\\x1e\\xdd}Ae\\x15\\x93\\xc5\\xfe\\\\" -"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" +"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:" +"\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" ">>> m.hexdigest()\n" "'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'" @@ -236,14 +240,14 @@ msgstr "" #: ../../library/hashlib.rst:165 msgid "" "A set containing the names of the hash algorithms that are available in the " -"running Python interpreter. These names will be recognized when passed " -"to :func:`new`. :attr:`algorithms_guaranteed` will always be a subset. The " +"running Python interpreter. These names will be recognized when passed to :" +"func:`new`. :attr:`algorithms_guaranteed` will always be a subset. The " "same algorithm may appear multiple times in this set under different names " "(thanks to OpenSSL)." msgstr "" -"包含正在運行的 Python 直譯器中可用的雜湊演算法名稱的集合。這些名稱在傳遞" -"給 :func:`new` 時將被識別。:attr:`algorithms_guaranteed` 都會是它的一個子集。" -"相同的演算法可能會以不同的名稱多次出現在該集合中(多虧了 OpenSSL)。" +"包含正在運行的 Python 直譯器中可用的雜湊演算法名稱的集合。這些名稱在傳遞給 :" +"func:`new` 時將被識別。:attr:`algorithms_guaranteed` 都會是它的一個子集。相同" +"的演算法可能會以不同的名稱多次出現在該集合中(多虧了 OpenSSL)。" #: ../../library/hashlib.rst:174 msgid "Hash Objects" @@ -295,8 +299,8 @@ msgid "" "``m.update(a); m.update(b)`` is equivalent to ``m.update(a+b)``." msgstr "" "使用\\ :term:`類位元組物件 `\\ 來更新雜湊物件。重複呼叫相" -"當於連接所有引數的單一呼叫:``m.update(a); m.update(b)`` 等價於 " -"``m.update(a+b)``。" +"當於連接所有引數的單一呼叫:``m.update(a); m.update(b)`` 等價於 ``m." +"update(a+b)``。" #: ../../library/hashlib.rst:212 msgid "" @@ -304,9 +308,8 @@ msgid "" "This is a bytes object of size :attr:`digest_size` which may contain bytes " "in the whole range from 0 to 255." msgstr "" -"回傳目前有傳遞給 :meth:`update` 方法的資料之摘要。這是一個大小" -"為 :attr:`digest_size` 的位元組物件,它可能包含從 0 到 255 的整個範圍內的位元" -"組。" +"回傳目前有傳遞給 :meth:`update` 方法的資料之摘要。這是一個大小為 :attr:" +"`digest_size` 的位元組物件,它可能包含從 0 到 255 的整個範圍內的位元組。" #: ../../library/hashlib.rst:219 msgid "" @@ -384,20 +387,20 @@ msgid "" "*fileobj* must be a file-like object opened for reading in binary mode. It " "accepts file objects from builtin :func:`open`, :class:`~io.BytesIO` " "instances, SocketIO objects from :meth:`socket.socket.makefile`, and " -"similar. *fileobj* must be opened in blocking mode, otherwise " -"a :exc:`BlockingIOError` may be raised." +"similar. *fileobj* must be opened in blocking mode, otherwise a :exc:" +"`BlockingIOError` may be raised." msgstr "" "*fileobj* 必須是以二進位模式讀取的類檔案物件。它接受來自內建 :func:`open` 的" "檔案物件、:class:`~io.BytesIO` 實例、來自 :meth:`socket.socket.makefile` 的 " -"SocketIO 物件等。*fileobj* 必須以阻塞模式開啟,否則可能會引" -"發 :exc:`BlockingIOError`。" +"SocketIO 物件等。*fileobj* 必須以阻塞模式開啟,否則可能會引發 :exc:" +"`BlockingIOError`。" #: ../../library/hashlib.rst:276 msgid "" -"The function may bypass Python's I/O and use the file descriptor " -"from :meth:`~io.IOBase.fileno` directly. *fileobj* must be assumed to be in " -"an unknown state after this function returns or raises. It is up to the " -"caller to close *fileobj*." +"The function may bypass Python's I/O and use the file descriptor from :meth:" +"`~io.IOBase.fileno` directly. *fileobj* must be assumed to be in an unknown " +"state after this function returns or raises. It is up to the caller to close " +"*fileobj*." msgstr "" "該函式可以繞過 Python 的 I/O 並直接使用 :meth:`~io.IOBase.fileno` 中的檔案描" "述器 (file descriptor)。在此函式回傳或引發後,必須假定 *fileobj* 處於未知狀" @@ -417,8 +420,8 @@ msgstr "範例:" #: ../../library/hashlib.rst:305 msgid "" -"Now raises a :exc:`BlockingIOError` if the file is opened in blocking mode. " -"Previously, spurious null bytes were added to the digest." +"Now raises a :exc:`BlockingIOError` if the file is opened in non-blocking " +"mode. Previously, spurious null bytes were added to the digest." msgstr "" #: ../../library/hashlib.rst:311 @@ -456,8 +459,8 @@ msgid "" msgstr "" "字串 *hash_name* 是 HMAC 的雜湊摘要演算法所需的名稱,例如 ``sha1`` 或 " "``sha256``。*password* 和 *salt* 被直譯為位元組緩衝區。應用程式和函式庫應為 " -"*password* 設下合理的長度限制(例如 1024)。*salt* 應該是來自適當來源(例" -"如 :func:`os.urandom`)且大約 16 或更多位元組。" +"*password* 設下合理的長度限制(例如 1024)。*salt* 應該是來自適當來源(例如 :" +"func:`os.urandom`)且大約 16 或更多位元組。" #: ../../library/hashlib.rst:330 msgid "" @@ -555,8 +558,8 @@ msgstr "" #: ../../library/hashlib.rst:392 msgid "" -"Hash objects from this module follow the API of standard " -"library's :mod:`hashlib` objects." +"Hash objects from this module follow the API of standard library's :mod:" +"`hashlib` objects." msgstr "該模組中的雜湊物件遵循標準函式庫的 :mod:`hashlib` 物件 API。" #: ../../library/hashlib.rst:397 @@ -770,17 +773,15 @@ msgstr "簡單雜湊" #: ../../library/hashlib.rst:513 msgid "" "To calculate hash of some data, you should first construct a hash object by " -"calling the appropriate constructor function (:func:`blake2b` " -"or :func:`blake2s`), then update it with the data by " -"calling :meth:`~hash.update` on the object, and, finally, get the digest out " -"of the object by calling :meth:`~hash.digest` (or :meth:`~hash.hexdigest` " -"for hex-encoded string)." +"calling the appropriate constructor function (:func:`blake2b` or :func:" +"`blake2s`), then update it with the data by calling :meth:`~hash.update` on " +"the object, and, finally, get the digest out of the object by calling :meth:" +"`~hash.digest` (or :meth:`~hash.hexdigest` for hex-encoded string)." msgstr "" "要計算某些資料的雜湊值,你應該首先透過呼叫適當的建構函式(:func:`blake2b` " -"或 :func:`blake2s`)以建構一個雜湊物件,然後透過於物件呼" -"叫 :meth:`~hash.update` 來以資料對它更新,最後透過呼" -"叫 :meth:`~hash.digest`\\ (或對於十六進位編碼字串則" -"為 :meth:`~hash.hexdigest`)從物件中獲得摘要。" +"或 :func:`blake2s`)以建構一個雜湊物件,然後透過於物件呼叫 :meth:`~hash." +"update` 來以資料對它更新,最後透過呼叫 :meth:`~hash.digest`\\ (或對於十六進" +"位編碼字串則為 :meth:`~hash.hexdigest`)從物件中獲得摘要。" #: ../../library/hashlib.rst:526 msgid "" @@ -826,9 +827,9 @@ msgstr "密鑰雜湊 (Keyed hashing)" #: ../../library/hashlib.rst:581 msgid "" "Keyed hashing can be used for authentication as a faster and simpler " -"replacement for `Hash-based message authentication code `_ (HMAC). BLAKE2 can be securely used in prefix-" -"MAC mode thanks to the indifferentiability property inherited from BLAKE." +"replacement for `Hash-based message authentication code `_ (HMAC). BLAKE2 can be securely used in prefix-MAC " +"mode thanks to the indifferentiability property inherited from BLAKE." msgstr "" "密鑰雜湊可用於身份驗證,作為\\ `基於雜湊的訊息驗證碼 (Hash-based message " "authentication code) `_ (HMAC) 的更快、" diff --git a/library/html.parser.po b/library/html.parser.po index a054929fb1a..999f46dd863 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -572,6 +572,15 @@ msgid "" "Num ent : >\n" "Num ent : >" msgstr "" +">>> parser = MyHTMLParser()\n" +">>> parser.feed('>>>')\n" +"Data : >>>\n" +"\n" +">>> parser = MyHTMLParser(convert_charrefs=False)\n" +">>> parser.feed('>>>')\n" +"Named ent: >\n" +"Num ent : >\n" +"Num ent : >" #: ../../library/html.parser.rst:337 msgid "" diff --git a/library/http.po b/library/http.po index e2e24bae355..644e1e5a660 100644 --- a/library/http.po +++ b/library/http.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-10-15 00:16+0000\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -40,13 +40,13 @@ msgid "" ":mod:`http.client` is a low-level HTTP protocol client; for high-level URL " "opening use :mod:`urllib.request`" msgstr "" -":mod:`http.client` 是一個低階的 HTTP 協定用戶端;對於高階的 URL 存取請使" -"用 :mod:`urllib.request`" +":mod:`http.client` 是一個低階的 HTTP 協定用戶端;對於高階的 URL 存取請使用 :" +"mod:`urllib.request`" #: ../../library/http.rst:20 msgid "" -":mod:`http.server` contains basic HTTP server classes based " -"on :mod:`socketserver`" +":mod:`http.server` contains basic HTTP server classes based on :mod:" +"`socketserver`" msgstr ":mod:`http.server` 包含基於 :mod:`socketserver` 的基本 HTTP 伺服器類別" #: ../../library/http.rst:21 @@ -74,8 +74,8 @@ msgstr "" ":class:`enum.IntEnum` 的子類別,它定義了一組 HTTP 狀態碼、原理短語 (reason " "phrase) 以及英文長描述。" -#: ../../library/http.rst:34 ../../library/http.rst:161 -#: ../../library/http.rst:175 +#: ../../library/http.rst:34 ../../library/http.rst:162 +#: ../../library/http.rst:176 msgid "Usage::" msgstr "用法: ::" @@ -116,8 +116,8 @@ msgstr "HTTP 狀態碼" #: ../../library/http.rst:55 msgid "" "Supported, `IANA-registered status codes `_ available " -"in :class:`http.HTTPStatus` are:" +"http-status-codes/http-status-codes.xhtml>`_ available in :class:`http." +"HTTPStatus` are:" msgstr "" ":class:`http.HTTPStatus` 當中,已支援並且有於 `IANA 註冊的狀態碼 `_\\ 有:" @@ -126,12 +126,12 @@ msgstr "" msgid "Code" msgstr "狀態碼" -#: ../../library/http.rst:60 ../../library/http.rst:208 +#: ../../library/http.rst:60 ../../library/http.rst:209 msgid "Enum Name" msgstr "列舉名稱" -#: ../../library/http.rst:60 ../../library/http.rst:152 -#: ../../library/http.rst:208 +#: ../../library/http.rst:60 ../../library/http.rst:153 +#: ../../library/http.rst:209 msgid "Details" msgstr "詳情" @@ -904,73 +904,75 @@ msgstr "" #: ../../library/http.rst:140 msgid "" "Implemented RFC9110 naming for status constants. Old constant names are " -"preserved for backwards compatibility." +"preserved for backwards compatibility: ``413 REQUEST_ENTITY_TOO_LARGE``, " +"``414 REQUEST_URI_TOO_LONG``, ``416 REQUESTED_RANGE_NOT_SATISFIABLE`` and " +"``422 UNPROCESSABLE_ENTITY``." msgstr "" -#: ../../library/http.rst:145 +#: ../../library/http.rst:146 msgid "HTTP status category" msgstr "HTTP 狀態分類" -#: ../../library/http.rst:149 +#: ../../library/http.rst:150 msgid "" "The enum values have several properties to indicate the HTTP status category:" msgstr "" -#: ../../library/http.rst:152 +#: ../../library/http.rst:153 msgid "Property" msgstr "" -#: ../../library/http.rst:152 +#: ../../library/http.rst:153 msgid "Indicates that" msgstr "" -#: ../../library/http.rst:154 +#: ../../library/http.rst:155 msgid "``is_informational``" msgstr "``is_informational``" -#: ../../library/http.rst:154 +#: ../../library/http.rst:155 msgid "``100 <= status <= 199``" msgstr "``100 <= status <= 199``" -#: ../../library/http.rst:154 ../../library/http.rst:155 -#: ../../library/http.rst:156 ../../library/http.rst:157 -#: ../../library/http.rst:158 +#: ../../library/http.rst:155 ../../library/http.rst:156 +#: ../../library/http.rst:157 ../../library/http.rst:158 +#: ../../library/http.rst:159 msgid "HTTP Semantics :rfc:`9110`, Section 15" msgstr "HTTP Semantics :rfc:`9110`, Section 15" -#: ../../library/http.rst:155 +#: ../../library/http.rst:156 msgid "``is_success``" msgstr "``is_success``" -#: ../../library/http.rst:155 +#: ../../library/http.rst:156 msgid "``200 <= status <= 299``" msgstr "``200 <= status <= 299``" -#: ../../library/http.rst:156 +#: ../../library/http.rst:157 msgid "``is_redirection``" msgstr "``is_redirection``" -#: ../../library/http.rst:156 +#: ../../library/http.rst:157 msgid "``300 <= status <= 399``" msgstr "``300 <= status <= 399``" -#: ../../library/http.rst:157 +#: ../../library/http.rst:158 msgid "``is_client_error``" msgstr "``is_client_error``" -#: ../../library/http.rst:157 +#: ../../library/http.rst:158 msgid "``400 <= status <= 499``" msgstr "``400 <= status <= 499``" -#: ../../library/http.rst:158 +#: ../../library/http.rst:159 msgid "``is_server_error``" msgstr "``is_server_error``" -#: ../../library/http.rst:158 +#: ../../library/http.rst:159 msgid "``500 <= status <= 599``" msgstr "``500 <= status <= 599``" -#: ../../library/http.rst:163 +#: ../../library/http.rst:164 msgid "" ">>> from http import HTTPStatus\n" ">>> HTTPStatus.OK.is_success\n" @@ -984,13 +986,13 @@ msgstr "" ">>> HTTPStatus.OK.is_client_error\n" "False" -#: ../../library/http.rst:173 +#: ../../library/http.rst:174 msgid "" "A subclass of :class:`enum.StrEnum` that defines a set of HTTP methods and " "descriptions written in English." msgstr ":class:`enum.StrEnum` 的子類別,它定義了一組 HTTP 方法以及英文描述。" -#: ../../library/http.rst:177 +#: ../../library/http.rst:178 msgid "" ">>> from http import HTTPMethod\n" ">>>\n" @@ -1034,11 +1036,11 @@ msgstr "" " ,\n" " ]" -#: ../../library/http.rst:201 +#: ../../library/http.rst:202 msgid "HTTP methods" msgstr "HTTP 方法" -#: ../../library/http.rst:203 +#: ../../library/http.rst:204 msgid "" "Supported, `IANA-registered methods `_ available in :class:`http.HTTPMethod` are:" @@ -1046,79 +1048,79 @@ msgstr "" ":class:`http.HTTPStatus` 當中,已支援並且有於 `IANA 註冊的狀態碼 `_\\ 有:" -#: ../../library/http.rst:208 +#: ../../library/http.rst:209 msgid "Method" msgstr "方法" -#: ../../library/http.rst:210 +#: ../../library/http.rst:211 msgid "``GET``" msgstr "``GET``" -#: ../../library/http.rst:210 +#: ../../library/http.rst:211 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.1" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.1" -#: ../../library/http.rst:211 +#: ../../library/http.rst:212 msgid "``HEAD``" msgstr "``HEAD``" -#: ../../library/http.rst:211 +#: ../../library/http.rst:212 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.2" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.2" -#: ../../library/http.rst:212 +#: ../../library/http.rst:213 msgid "``POST``" msgstr "``POST``" -#: ../../library/http.rst:212 +#: ../../library/http.rst:213 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.3" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.3" -#: ../../library/http.rst:213 +#: ../../library/http.rst:214 msgid "``PUT``" msgstr "``PUT``" -#: ../../library/http.rst:213 +#: ../../library/http.rst:214 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.4" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.4" -#: ../../library/http.rst:214 +#: ../../library/http.rst:215 msgid "``DELETE``" msgstr "``DELETE``" -#: ../../library/http.rst:214 +#: ../../library/http.rst:215 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.5" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.5" -#: ../../library/http.rst:215 +#: ../../library/http.rst:216 msgid "``CONNECT``" msgstr "``CONNECT``" -#: ../../library/http.rst:215 +#: ../../library/http.rst:216 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.6" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.6" -#: ../../library/http.rst:216 +#: ../../library/http.rst:217 msgid "``OPTIONS``" msgstr "``OPTIONS``" -#: ../../library/http.rst:216 +#: ../../library/http.rst:217 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.7" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.7" -#: ../../library/http.rst:217 +#: ../../library/http.rst:218 msgid "``TRACE``" msgstr "``TRACE``" -#: ../../library/http.rst:217 +#: ../../library/http.rst:218 msgid "HTTP Semantics :rfc:`9110`, Section 9.3.8" msgstr "HTTP Semantics :rfc:`9110`, Section 9.3.8" -#: ../../library/http.rst:218 +#: ../../library/http.rst:219 msgid "``PATCH``" msgstr "``PATCH``" -#: ../../library/http.rst:218 +#: ../../library/http.rst:219 msgid "HTTP/1.1 :rfc:`5789`" msgstr "HTTP/1.1 :rfc:`5789`" diff --git a/library/idle.po b/library/idle.po index 3aaf2acd70e..9bba58a62b1 100644 --- a/library/idle.po +++ b/library/idle.po @@ -698,7 +698,7 @@ msgstr "" #: ../../library/idle.rst:345 msgid "Python Docs" -msgstr "" +msgstr "Python 文件" #: ../../library/idle.rst:346 msgid "" @@ -1177,7 +1177,7 @@ msgstr "" #: ../../library/idle.rst:667 msgid "python -m idlelib [options] [file ...]" -msgstr "" +msgstr "python -m idlelib [options] [file ...]" #: ../../library/idle.rst:671 msgid "The following options are available:" diff --git a/library/imaplib.po b/library/imaplib.po index fb45e859d2c..48f89ff6533 100644 --- a/library/imaplib.po +++ b/library/imaplib.po @@ -423,6 +423,12 @@ msgid "" "EXISTS [b'1']\n" "RECENT [b'1']" msgstr "" +">>> with M.idle(duration=29 * 60) as idler:\n" +"... for typ, data in idler:\n" +"... print(typ, data)\n" +"...\n" +"EXISTS [b'1']\n" +"RECENT [b'1']" #: ../../library/imaplib.rst:349 msgid "" diff --git a/library/importlib.po b/library/importlib.po index 03ed501d9f6..6e27335e784 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-17 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,9 +42,9 @@ msgid "" "to comprehend than one implemented in a programming language other than " "Python." msgstr "" -"第一是提供 Python 原始碼中 :keyword:`import` 陳述式的實作(因此,也延伸" -"到 :func:`__import__` 函式)。這讓 :keyword:`!import` 實作可以移植到任何 " -"Python 直譯器。同時,這也提供了一個比用其他程式語言實作更容易理解的版本。" +"第一是提供 Python 原始碼中 :keyword:`import` 陳述式的實作(因此,也延伸到 :" +"func:`__import__` 函式)。這讓 :keyword:`!import` 實作可以移植到任何 Python " +"直譯器。同時,這也提供了一個比用其他程式語言實作更容易理解的版本。" #: ../../library/importlib.rst:29 msgid "" @@ -88,8 +88,8 @@ msgstr "" #: ../../library/importlib.rst:47 msgid "" "Original specification of packages. Some semantics have changed since the " -"writing of this document (e.g. redirecting based on ``None`` " -"in :data:`sys.modules`)." +"writing of this document (e.g. redirecting based on ``None`` in :data:`sys." +"modules`)." msgstr "" #: ../../library/importlib.rst:51 @@ -230,11 +230,11 @@ msgstr "" #: ../../library/importlib.rst:115 msgid "" -"The :func:`import_module` function acts as a simplifying wrapper " -"around :func:`importlib.__import__`. This means all semantics of the " -"function are derived from :func:`importlib.__import__`. The most important " -"difference between these two functions is that :func:`import_module` returns " -"the specified package or module (e.g. ``pkg.mod``), while :func:`__import__` " +"The :func:`import_module` function acts as a simplifying wrapper around :" +"func:`importlib.__import__`. This means all semantics of the function are " +"derived from :func:`importlib.__import__`. The most important difference " +"between these two functions is that :func:`import_module` returns the " +"specified package or module (e.g. ``pkg.mod``), while :func:`__import__` " "returns the top-level package or module (e.g. ``pkg``)." msgstr "" @@ -346,11 +346,11 @@ msgstr "" #: ../../library/importlib.rst:193 msgid "" -"If a module imports objects from another module " -"using :keyword:`from` ... :keyword:`import` ..., calling :func:`reload` for " -"the other module does not redefine the objects imported from it --- one way " -"around this is to re-execute the :keyword:`!from` statement, another is to " -"use :keyword:`!import` and qualified names (*module.name*) instead." +"If a module imports objects from another module using :keyword:`from` ... :" +"keyword:`import` ..., calling :func:`reload` for the other module does not " +"redefine the objects imported from it --- one way around this is to re-" +"execute the :keyword:`!from` statement, another is to use :keyword:`!import` " +"and qualified names (*module.name*) instead." msgstr "" #: ../../library/importlib.rst:199 @@ -363,16 +363,15 @@ msgstr "" #: ../../library/importlib.rst:205 msgid "" -":exc:`ModuleNotFoundError` is raised when the module being reloaded lacks " -"a :class:`~importlib.machinery.ModuleSpec`." +":exc:`ModuleNotFoundError` is raised when the module being reloaded lacks a :" +"class:`~importlib.machinery.ModuleSpec`." msgstr "" #: ../../library/importlib.rst:210 msgid "" "This function is not thread-safe. Calling it from multiple threads can " -"result in unexpected behavior. It's recommended to use " -"the :class:`threading.Lock` or other synchronization primitives for thread-" -"safe module reloading." +"result in unexpected behavior. It's recommended to use the :class:`threading." +"Lock` or other synchronization primitives for thread-safe module reloading." msgstr "" #: ../../library/importlib.rst:215 @@ -451,27 +450,26 @@ msgstr "" msgid "" "An abstract base class representing a :term:`path entry finder`. Though it " "bears some similarities to :class:`MetaPathFinder`, ``PathEntryFinder`` is " -"meant for use only within the path-based import subsystem provided " -"by :class:`importlib.machinery.PathFinder`." +"meant for use only within the path-based import subsystem provided by :class:" +"`importlib.machinery.PathFinder`." msgstr "" #: ../../library/importlib.rst:289 msgid "" "An abstract method for finding a :term:`spec ` for the " -"specified module. The finder will search for the module only within " -"the :term:`path entry` to which it is assigned. If a spec cannot be found, " +"specified module. The finder will search for the module only within the :" +"term:`path entry` to which it is assigned. If a spec cannot be found, " "``None`` is returned. When passed in, ``target`` is a module object that " -"the finder may use to make a more educated guess about what spec to " -"return. :func:`importlib.util.spec_from_loader` may be useful for " -"implementing concrete ``PathEntryFinders``." +"the finder may use to make a more educated guess about what spec to return. :" +"func:`importlib.util.spec_from_loader` may be useful for implementing " +"concrete ``PathEntryFinders``." msgstr "" #: ../../library/importlib.rst:301 msgid "" "An optional method which, when called, should invalidate any internal cache " -"used by the finder. Used " -"by :meth:`importlib.machinery.PathFinder.invalidate_caches` when " -"invalidating the caches of all cached finders." +"used by the finder. Used by :meth:`importlib.machinery.PathFinder." +"invalidate_caches` when invalidating the caches of all cached finders." msgstr "" #: ../../library/importlib.rst:309 @@ -482,9 +480,9 @@ msgstr "" #: ../../library/importlib.rst:312 msgid "" -"Loaders that wish to support resource reading should implement " -"a :meth:`get_resource_reader` method as specified " -"by :class:`importlib.resources.abc.ResourceReader`." +"Loaders that wish to support resource reading should implement a :meth:" +"`get_resource_reader` method as specified by :class:`importlib.resources.abc." +"ResourceReader`." msgstr "" #: ../../library/importlib.rst:316 @@ -506,8 +504,8 @@ msgstr "" msgid "" "An abstract method that executes the module in its own namespace when a " "module is imported or reloaded. The module should already be initialized " -"when :meth:`exec_module` is called. When this method " -"exists, :meth:`create_module` must be defined." +"when :meth:`exec_module` is called. When this method exists, :meth:" +"`create_module` must be defined." msgstr "" #: ../../library/importlib.rst:340 @@ -516,9 +514,8 @@ msgstr ":meth:`create_module` 也必須被定義。" #: ../../library/importlib.rst:345 msgid "" -"A legacy method for loading a module. If the module cannot be " -"loaded, :exc:`ImportError` is raised, otherwise the loaded module is " -"returned." +"A legacy method for loading a module. If the module cannot be loaded, :exc:" +"`ImportError` is raised, otherwise the loaded module is returned." msgstr "" #: ../../library/importlib.rst:349 @@ -576,9 +573,9 @@ msgstr "" #: ../../library/importlib.rst:377 msgid "" -"The recommended API for loading a module is :meth:`exec_module` " -"(and :meth:`create_module`). Loaders should implement it instead " -"of :meth:`load_module`. The import machinery takes care of all the other " +"The recommended API for loading a module is :meth:`exec_module` (and :meth:" +"`create_module`). Loaders should implement it instead of :meth:" +"`load_module`. The import machinery takes care of all the other " "responsibilities of :meth:`load_module` when :meth:`exec_module` is " "implemented." msgstr "" @@ -589,16 +586,15 @@ msgstr "" #: ../../library/importlib.rst:389 msgid "" -"An abstract base class for a :term:`loader` which implements the " -"optional :pep:`302` protocol for loading arbitrary resources from the " -"storage back-end." +"An abstract base class for a :term:`loader` which implements the optional :" +"pep:`302` protocol for loading arbitrary resources from the storage back-end." msgstr "" #: ../../library/importlib.rst:393 msgid "" -"This ABC is deprecated in favour of supporting resource loading " -"through :class:`importlib.resources.abc.TraversableResources`. This class " -"exists for backwards compatibility only with other ABCs in this module." +"This ABC is deprecated in favour of supporting resource loading through :" +"class:`importlib.resources.abc.TraversableResources`. This class exists for " +"backwards compatibility only with other ABCs in this module." msgstr "" #: ../../library/importlib.rst:402 @@ -607,9 +603,8 @@ msgid "" "Loaders that have a file-like storage back-end that allows storing arbitrary " "data can implement this abstract method to give direct access to the data " "stored. :exc:`OSError` is to be raised if the *path* cannot be found. The " -"*path* is expected to be constructed using a " -"module's :attr:`~module.__file__` attribute or an item from a " -"package's :attr:`~module.__path__`." +"*path* is expected to be constructed using a module's :attr:`~module." +"__file__` attribute or an item from a package's :attr:`~module.__path__`." msgstr "" #: ../../library/importlib.rst:411 @@ -618,8 +613,8 @@ msgstr "" #: ../../library/importlib.rst:417 msgid "" -"An abstract base class for a :term:`loader` which implements the " -"optional :pep:`302` protocol for loaders that inspect modules." +"An abstract base class for a :term:`loader` which implements the optional :" +"pep:`302` protocol for loaders that inspect modules." msgstr "" #: ../../library/importlib.rst:422 @@ -666,10 +661,10 @@ msgstr "" #: ../../library/importlib.rst:462 msgid "" -"The *data* argument can be whatever the :func:`compile` function supports " -"(i.e. string or bytes). The *path* argument should be the \"path\" to where " -"the source code originated from, which can be an abstract concept (e.g. " -"location in a zip file)." +"The *data* argument can be whatever the :func:`compile` function supports (i." +"e. string or bytes). The *path* argument should be the \"path\" to where the " +"source code originated from, which can be an abstract concept (e.g. location " +"in a zip file)." msgstr "" #: ../../library/importlib.rst:467 @@ -716,9 +711,9 @@ msgstr "" #: ../../library/importlib.rst:512 msgid "" -"An abstract base class which inherits from :class:`ResourceLoader` " -"and :class:`ExecutionLoader`, providing concrete implementations " -"of :meth:`ResourceLoader.get_data` and :meth:`ExecutionLoader.get_filename`." +"An abstract base class which inherits from :class:`ResourceLoader` and :" +"class:`ExecutionLoader`, providing concrete implementations of :meth:" +"`ResourceLoader.get_data` and :meth:`ExecutionLoader.get_filename`." msgstr "" #: ../../library/importlib.rst:516 @@ -754,8 +749,8 @@ msgstr "" #: ../../library/importlib.rst:549 msgid "" "An abstract base class for implementing source (and optionally bytecode) " -"file loading. The class inherits from both :class:`ResourceLoader` " -"and :class:`ExecutionLoader`, requiring the implementation of:" +"file loading. The class inherits from both :class:`ResourceLoader` and :" +"class:`ExecutionLoader`, requiring the implementation of:" msgstr "" #: ../../library/importlib.rst:553 @@ -775,9 +770,9 @@ msgstr "" #: ../../library/importlib.rst:558 msgid "" "The abstract methods defined by this class are to add optional bytecode file " -"support. Not implementing these optional methods (or causing them to " -"raise :exc:`NotImplementedError`) causes the loader to only work with source " -"code. Implementing the methods allows the loader to work with source *and* " +"support. Not implementing these optional methods (or causing them to raise :" +"exc:`NotImplementedError`) causes the loader to only work with source code. " +"Implementing the methods allows the loader to work with source *and* " "bytecode files; it does not allow for *sourceless* loading where only " "bytecode is provided. Bytecode files are an optimization to speed up " "loading by removing the parsing step of Python's compiler, and so no " @@ -832,9 +827,8 @@ msgstr "" #: ../../library/importlib.rst:603 msgid "" -"When writing to the path fails because the path is read-only " -"(:const:`errno.EACCES`/:exc:`PermissionError`), do not propagate the " -"exception." +"When writing to the path fails because the path is read-only (:const:`errno." +"EACCES`/:exc:`PermissionError`), do not propagate the exception." msgstr "" #: ../../library/importlib.rst:607 @@ -864,9 +858,9 @@ msgstr "" #: ../../library/importlib.rst:633 msgid "" "Concrete implementation of :meth:`InspectLoader.is_package`. A module is " -"determined to be a package if its file path (as provided " -"by :meth:`ExecutionLoader.get_filename`) is a file named ``__init__`` when " -"the file extension is removed **and** the module name itself does not end in " +"determined to be a package if its file path (as provided by :meth:" +"`ExecutionLoader.get_filename`) is a file named ``__init__`` when the file " +"extension is removed **and** the module name itself does not end in " "``__init__``." msgstr "" @@ -887,9 +881,9 @@ msgstr "" #: ../../library/importlib.rst:655 msgid "" -"For any of methods of this class, a *resource* argument is expected to be " -"a :term:`path-like object` which represents conceptually just a file name. " -"This means that no subdirectory paths should be included in the *resource* " +"For any of methods of this class, a *resource* argument is expected to be a :" +"term:`path-like object` which represents conceptually just a file name. This " +"means that no subdirectory paths should be included in the *resource* " "argument. This is because the location of the package the reader is for, " "acts as the \"directory\". Hence the metaphor for directories and file names " "is packages and resources, respectively. This is also why instances of this " @@ -926,22 +920,22 @@ msgstr "" #: ../../library/importlib.rst:692 msgid "" -"If the resource does not concretely exist on the file system, " -"raise :exc:`FileNotFoundError`." +"If the resource does not concretely exist on the file system, raise :exc:" +"`FileNotFoundError`." msgstr "" #: ../../library/importlib.rst:698 msgid "" -"Returns ``True`` if the named *name* is considered a " -"resource. :exc:`FileNotFoundError` is raised if *name* does not exist." +"Returns ``True`` if the named *name* is considered a resource. :exc:" +"`FileNotFoundError` is raised if *name* does not exist." msgstr "" #: ../../library/importlib.rst:704 msgid "" "Returns an :term:`iterable` of strings over the contents of the package. Do " "note that it is not required that all names returned by the iterator be " -"actual resources, e.g. it is acceptable to return names for " -"which :meth:`is_resource` would be false." +"actual resources, e.g. it is acceptable to return names for which :meth:" +"`is_resource` would be false." msgstr "" #: ../../library/importlib.rst:710 @@ -965,8 +959,8 @@ msgstr "" #: ../../library/importlib.rst:726 msgid "" -"For a representation of the object on the file-system, " -"use :meth:`importlib.resources.as_file`." +"For a representation of the object on the file-system, use :meth:`importlib." +"resources.as_file`." msgstr "" #: ../../library/importlib.rst:731 @@ -1005,8 +999,8 @@ msgstr "" #: ../../library/importlib.rst:769 msgid "" -"When opening as text, accepts encoding parameters such as those accepted " -"by :class:`io.TextIOWrapper`." +"When opening as text, accepts encoding parameters such as those accepted by :" +"class:`io.TextIOWrapper`." msgstr "" #: ../../library/importlib.rst:774 @@ -1019,11 +1013,10 @@ msgstr "" #: ../../library/importlib.rst:783 msgid "" -"An abstract base class for resource readers capable of serving " -"the :meth:`importlib.resources.files` interface. " -"Subclasses :class:`importlib.resources.abc.ResourceReader` and provides " -"concrete implementations of " -"the :class:`importlib.resources.abc.ResourceReader`'s abstract methods. " +"An abstract base class for resource readers capable of serving the :meth:" +"`importlib.resources.files` interface. Subclasses :class:`importlib." +"resources.abc.ResourceReader` and provides concrete implementations of the :" +"class:`importlib.resources.abc.ResourceReader`'s abstract methods. " "Therefore, any loader supplying :class:`importlib.abc.TraversableResources` " "also supplies ResourceReader." msgstr "" @@ -1097,16 +1090,15 @@ msgid "" "Returns a combined list of strings representing all file suffixes for " "modules recognized by the standard import machinery. This is a helper for " "code which simply needs to know if a filesystem path potentially refers to a " -"module without needing any details on the kind of module (for " -"example, :func:`inspect.getmodulename`)." +"module without needing any details on the kind of module (for example, :func:" +"`inspect.getmodulename`)." msgstr "" #: ../../library/importlib.rst:876 msgid "" "An :term:`importer` for built-in modules. All known built-in modules are " -"listed in :data:`sys.builtin_module_names`. This class implements " -"the :class:`importlib.abc.MetaPathFinder` " -"and :class:`importlib.abc.InspectLoader` ABCs." +"listed in :data:`sys.builtin_module_names`. This class implements the :class:" +"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" #: ../../library/importlib.rst:881 ../../library/importlib.rst:895 @@ -1118,15 +1110,14 @@ msgstr "" #: ../../library/importlib.rst:884 msgid "" -"As part of :pep:`489`, the builtin importer now " -"implements :meth:`Loader.create_module` and :meth:`Loader.exec_module`" +"As part of :pep:`489`, the builtin importer now implements :meth:`Loader." +"create_module` and :meth:`Loader.exec_module`" msgstr "" #: ../../library/importlib.rst:891 msgid "" -"An :term:`importer` for frozen modules. This class implements " -"the :class:`importlib.abc.MetaPathFinder` " -"and :class:`importlib.abc.InspectLoader` ABCs." +"An :term:`importer` for frozen modules. This class implements the :class:" +"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" #: ../../library/importlib.rst:898 @@ -1157,22 +1148,21 @@ msgstr "" msgid "" "Class method that attempts to find a :term:`spec ` for the " "module specified by *fullname* on :data:`sys.path` or, if defined, on " -"*path*. For each path entry that is " -"searched, :data:`sys.path_importer_cache` is checked. If a non-false object " -"is found then it is used as the :term:`path entry finder` to look for the " -"module being searched for. If no entry is found " -"in :data:`sys.path_importer_cache`, then :data:`sys.path_hooks` is searched " -"for a finder for the path entry and, if found, is stored " -"in :data:`sys.path_importer_cache` along with being queried about the " -"module. If no finder is ever found then ``None`` is both stored in the cache " -"and returned." +"*path*. For each path entry that is searched, :data:`sys." +"path_importer_cache` is checked. If a non-false object is found then it is " +"used as the :term:`path entry finder` to look for the module being searched " +"for. If no entry is found in :data:`sys.path_importer_cache`, then :data:" +"`sys.path_hooks` is searched for a finder for the path entry and, if found, " +"is stored in :data:`sys.path_importer_cache` along with being queried about " +"the module. If no finder is ever found then ``None`` is both stored in the " +"cache and returned." msgstr "" #: ../../library/importlib.rst:942 msgid "" "If the current working directory -- represented by an empty string -- is no " -"longer valid then ``None`` is returned but no value is cached " -"in :data:`sys.path_importer_cache`." +"longer valid then ``None`` is returned but no value is cached in :data:`sys." +"path_importer_cache`." msgstr "" #: ../../library/importlib.rst:949 @@ -1246,8 +1236,8 @@ msgstr "" #: ../../library/importlib.rst:1008 msgid "" -"If the argument to the closure is not an existing " -"directory, :exc:`ImportError` is raised." +"If the argument to the closure is not an existing directory, :exc:" +"`ImportError` is raised." msgstr "" #: ../../library/importlib.rst:1014 @@ -1355,8 +1345,8 @@ msgstr "" #: ../../library/importlib.rst:1120 msgid "" -"Creates the module object from the given specification in accordance " -"with :pep:`489`." +"Creates the module object from the given specification in accordance with :" +"pep:`489`." msgstr "" #: ../../library/importlib.rst:1127 @@ -1411,14 +1401,14 @@ msgid "" "the *values* are usually equivalent, they can differ since there is no " "synchronization between the two objects. For example, it is possible to " "update the module's :attr:`~module.__file__` at runtime and this will not be " -"automatically reflected in the module's :attr:`__spec__.origin " -"`, and vice versa." +"automatically reflected in the module's :attr:`__spec__.origin `, and vice versa." msgstr "" #: ../../library/importlib.rst:1185 msgid "" -"The module's fully qualified name (see :attr:`module.__name__`). " -"The :term:`finder` should always set this attribute to a non-empty string." +"The module's fully qualified name (see :attr:`module.__name__`). The :term:" +"`finder` should always set this attribute to a non-empty string." msgstr "" #: ../../library/importlib.rst:1190 @@ -1429,12 +1419,11 @@ msgstr "" #: ../../library/importlib.rst:1195 msgid "" -"The location the :term:`loader` should use to load the module " -"(see :attr:`module.__file__`). For example, for modules loaded from a " -"``.py`` file this is the filename. The :term:`finder` should always set this " -"attribute to a meaningful value for the :term:`loader` to use. In the " -"uncommon case that there is not one (like for namespace packages), it should " -"be set to ``None``." +"The location the :term:`loader` should use to load the module (see :attr:" +"`module.__file__`). For example, for modules loaded from a ``.py`` file this " +"is the filename. The :term:`finder` should always set this attribute to a " +"meaningful value for the :term:`loader` to use. In the uncommon case that " +"there is not one (like for namespace packages), it should be set to ``None``." msgstr "" #: ../../library/importlib.rst:1204 @@ -1461,10 +1450,9 @@ msgstr "" #: ../../library/importlib.rst:1223 msgid "" -"The filename of a compiled version of the module's code " -"(see :attr:`module.__cached__`). The :term:`finder` should always set this " -"attribute but it may be ``None`` for modules that do not need compiled code " -"stored." +"The filename of a compiled version of the module's code (see :attr:`module." +"__cached__`). The :term:`finder` should always set this attribute but it may " +"be ``None`` for modules that do not need compiled code stored." msgstr "" #: ../../library/importlib.rst:1230 @@ -1501,29 +1489,29 @@ msgid "" "To accommodate this requirement, when running on iOS, extension module " "binaries are *not* packaged as ``.so`` files on ``sys.path``, but as " "individual standalone frameworks. To discover those frameworks, this loader " -"is be registered against the ``.fwork`` file extension, with a ``.fwork`` " -"file acting as a placeholder in the original location of the binary on " -"``sys.path``. The ``.fwork`` file contains the path of the actual binary in " -"the ``Frameworks`` folder, relative to the app bundle. To allow for " -"resolving a framework-packaged binary back to the original location, the " -"framework is expected to contain a ``.origin`` file that contains the " -"location of the ``.fwork`` file, relative to the app bundle." +"is registered against the ``.fwork`` file extension, with a ``.fwork`` file " +"acting as a placeholder in the original location of the binary on ``sys." +"path``. The ``.fwork`` file contains the path of the actual binary in the " +"``Frameworks`` folder, relative to the app bundle. To allow for resolving a " +"framework-packaged binary back to the original location, the framework is " +"expected to contain a ``.origin`` file that contains the location of the ``." +"fwork`` file, relative to the app bundle." msgstr "" #: ../../library/importlib.rst:1264 msgid "" "For example, consider the case of an import ``from foo.bar import _whiz``, " "where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" -"_whiz.abi3.so``, with ``sources`` being the location registered on " -"``sys.path``, relative to the application bundle. This module *must* be " +"_whiz.abi3.so``, with ``sources`` being the location registered on ``sys." +"path``, relative to the application bundle. This module *must* be " "distributed as ``Frameworks/foo.bar._whiz.framework/foo.bar._whiz`` " "(creating the framework name from the full import path of the module), with " "an ``Info.plist`` file in the ``.framework`` directory identifying the " "binary as a framework. The ``foo.bar._whiz`` module would be represented in " "the original location with a ``sources/foo/bar/_whiz.abi3.fwork`` marker " "file, containing the path ``Frameworks/foo.bar._whiz/foo.bar._whiz``. The " -"framework would also contain ``Frameworks/foo.bar._whiz.framework/" -"foo.bar._whiz.origin``, containing the path to the ``.fwork`` file." +"framework would also contain ``Frameworks/foo.bar._whiz.framework/foo.bar." +"_whiz.origin``, containing the path to the ``.fwork`` file." msgstr "" #: ../../library/importlib.rst:1278 @@ -1579,9 +1567,9 @@ msgid "" "Return the :pep:`3147`/:pep:`488` path to the byte-compiled file associated " "with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the " "return value would be ``/foo/bar/__pycache__/baz.cpython-32.pyc`` for Python " -"3.2. The ``cpython-32`` string comes from the current magic tag " -"(see :func:`get_tag`; if :attr:`sys.implementation.cache_tag` is not defined " -"then :exc:`NotImplementedError` will be raised)." +"3.2. The ``cpython-32`` string comes from the current magic tag (see :func:" +"`get_tag`; if :attr:`sys.implementation.cache_tag` is not defined then :exc:" +"`NotImplementedError` will be raised)." msgstr "" #: ../../library/importlib.rst:1335 @@ -1592,9 +1580,9 @@ msgid "" "``/foo/bar/__pycache__/baz.cpython-32.pyc``. ``None`` causes the " "interpreter's optimization level to be used. Any other value's string " "representation is used, so ``/foo/bar/baz.py`` with an *optimization* of " -"``2`` will lead to the bytecode path of ``/foo/bar/__pycache__/" -"baz.cpython-32.opt-2.pyc``. The string representation of *optimization* can " -"only be alphanumeric, else :exc:`ValueError` is raised." +"``2`` will lead to the bytecode path of ``/foo/bar/__pycache__/baz." +"cpython-32.opt-2.pyc``. The string representation of *optimization* can only " +"be alphanumeric, else :exc:`ValueError` is raised." msgstr "" #: ../../library/importlib.rst:1345 @@ -1615,24 +1603,23 @@ msgstr "" #: ../../library/importlib.rst:1357 ../../library/importlib.rst:1373 #: ../../library/importlib.rst:1462 msgid "Accepts a :term:`path-like object`." -msgstr "" +msgstr "接受一個 :term:`path-like object`。" #: ../../library/importlib.rst:1363 msgid "" "Given the *path* to a :pep:`3147` file name, return the associated source " -"code file path. For example, if *path* is ``/foo/bar/__pycache__/" -"baz.cpython-32.pyc`` the returned path would be ``/foo/bar/baz.py``. *path* " +"code file path. For example, if *path* is ``/foo/bar/__pycache__/baz." +"cpython-32.pyc`` the returned path would be ``/foo/bar/baz.py``. *path* " "need not exist, however if it does not conform to :pep:`3147` or :pep:`488` " -"format, a :exc:`ValueError` is raised. " -"If :attr:`sys.implementation.cache_tag` is not " -"defined, :exc:`NotImplementedError` is raised." +"format, a :exc:`ValueError` is raised. If :attr:`sys.implementation." +"cache_tag` is not defined, :exc:`NotImplementedError` is raised." msgstr "" #: ../../library/importlib.rst:1378 msgid "" "Decode the given bytes representing source code and return it as a string " -"with universal newlines (as required " -"by :meth:`importlib.abc.InspectLoader.get_source`)." +"with universal newlines (as required by :meth:`importlib.abc.InspectLoader." +"get_source`)." msgstr "" #: ../../library/importlib.rst:1386 @@ -1642,18 +1629,16 @@ msgstr "" #: ../../library/importlib.rst:1388 msgid "" "If **name** has no leading dots, then **name** is simply returned. This " -"allows for usage such as ``importlib.util.resolve_name('sys', " -"__spec__.parent)`` without doing a check to see if the **package** argument " -"is needed." +"allows for usage such as ``importlib.util.resolve_name('sys', __spec__." +"parent)`` without doing a check to see if the **package** argument is needed." msgstr "" #: ../../library/importlib.rst:1393 msgid "" ":exc:`ImportError` is raised if **name** is a relative module name but " -"**package** is a false value (e.g. ``None`` or the empty " -"string). :exc:`ImportError` is also raised if a relative name would escape " -"its containing package (e.g. requesting ``..bacon`` from within the ``spam`` " -"package)." +"**package** is a false value (e.g. ``None`` or the empty string). :exc:" +"`ImportError` is also raised if a relative name would escape its containing " +"package (e.g. requesting ``..bacon`` from within the ``spam`` package)." msgstr "" #: ../../library/importlib.rst:1401 @@ -1714,9 +1699,9 @@ msgstr "" msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on a loader. The parameters have the same meaning as they do " -"for ModuleSpec. The function uses available :term:`loader` APIs, such " -"as :meth:`InspectLoader.is_package`, to fill in any missing information on " -"the spec." +"for ModuleSpec. The function uses available :term:`loader` APIs, such as :" +"meth:`InspectLoader.is_package`, to fill in any missing information on the " +"spec." msgstr "" #: ../../library/importlib.rst:1455 @@ -1773,16 +1758,15 @@ msgstr "" #: ../../library/importlib.rst:1502 msgid "" -"This class **only** works with loaders that " -"define :meth:`~importlib.abc.Loader.exec_module` as control over what module " -"type is used for the module is required. For those same reasons, the " -"loader's :meth:`~importlib.abc.Loader.create_module` method must return " -"``None`` or a type for which its ``__class__`` attribute can be mutated " -"along with not using :term:`slots <__slots__>`. Finally, modules which " -"substitute the object placed into :data:`sys.modules` will not work as there " -"is no way to properly replace the module references throughout the " -"interpreter safely; :exc:`ValueError` is raised if such a substitution is " -"detected." +"This class **only** works with loaders that define :meth:`~importlib.abc." +"Loader.exec_module` as control over what module type is used for the module " +"is required. For those same reasons, the loader's :meth:`~importlib.abc." +"Loader.create_module` method must return ``None`` or a type for which its " +"``__class__`` attribute can be mutated along with not using :term:`slots " +"<__slots__>`. Finally, modules which substitute the object placed into :data:" +"`sys.modules` will not work as there is no way to properly replace the " +"module references throughout the interpreter safely; :exc:`ValueError` is " +"raised if such a substitution is detected." msgstr "" #: ../../library/importlib.rst:1513 @@ -1797,8 +1781,8 @@ msgstr "" #: ../../library/importlib.rst:1521 msgid "" "Began calling :meth:`~importlib.abc.Loader.create_module`, removing the " -"compatibility warning for :class:`importlib.machinery.BuiltinImporter` " -"and :class:`importlib.machinery.ExtensionFileLoader`." +"compatibility warning for :class:`importlib.machinery.BuiltinImporter` and :" +"class:`importlib.machinery.ExtensionFileLoader`." msgstr "" #: ../../library/importlib.rst:1528 @@ -1855,8 +1839,8 @@ msgstr "" #: ../../library/importlib.rst:1560 msgid "" -"Note that if ``name`` is a submodule (contains a " -"dot), :func:`importlib.util.find_spec` will import the parent module. ::" +"Note that if ``name`` is a submodule (contains a dot), :func:`importlib.util." +"find_spec` will import the parent module. ::" msgstr "" #: ../../library/importlib.rst:1564 @@ -1886,11 +1870,11 @@ msgstr "" #: ../../library/importlib.rst:1585 msgid "" "This recipe should be used with caution: it is an approximation of an import " -"statement where the file path is specified directly, rather " -"than :data:`sys.path` being searched. Alternatives should first be " -"considered first, such as modifying :data:`sys.path` when a proper module is " -"required, or using :func:`runpy.run_path` when the global namespace " -"resulting from running a Python file is appropriate." +"statement where the file path is specified directly, rather than :data:`sys." +"path` being searched. Alternatives should first be considered first, such as " +"modifying :data:`sys.path` when a proper module is required, or using :func:" +"`runpy.run_path` when the global namespace resulting from running a Python " +"file is appropriate." msgstr "" #: ../../library/importlib.rst:1592 @@ -1949,6 +1933,22 @@ msgid "" ">>> lazy_typing.TYPE_CHECKING\n" "False" msgstr "" +">>> import importlib.util\n" +">>> import sys\n" +">>> def lazy_import(name):\n" +"... spec = importlib.util.find_spec(name)\n" +"... loader = importlib.util.LazyLoader(spec.loader)\n" +"... spec.loader = loader\n" +"... module = importlib.util.module_from_spec(spec)\n" +"... sys.modules[name] = module\n" +"... loader.exec_module(module)\n" +"... return module\n" +"...\n" +">>> lazy_typing = lazy_import(\"typing\")\n" +">>> # lazy_typing 是一個真實的模組物件,\n" +">>> # 但它尚未載入到記憶體中。\n" +">>> lazy_typing.TYPE_CHECKING\n" +"False" #: ../../library/importlib.rst:1639 msgid "Setting up an importer" @@ -1956,17 +1956,16 @@ msgstr "" #: ../../library/importlib.rst:1641 msgid "" -"For deep customizations of import, you typically want to implement " -"an :term:`importer`. This means managing both the :term:`finder` " -"and :term:`loader` side of things. For finders there are two flavours to " -"choose from depending on your needs: a :term:`meta path finder` or " -"a :term:`path entry finder`. The former is what you would put " -"on :data:`sys.meta_path` while the latter is what you create using " -"a :term:`path entry hook` on :data:`sys.path_hooks` which works " -"with :data:`sys.path` entries to potentially create a finder. This example " -"will show you how to register your own importers so that import will use " -"them (for creating an importer for yourself, read the documentation for the " -"appropriate classes defined within this package)::" +"For deep customizations of import, you typically want to implement an :term:" +"`importer`. This means managing both the :term:`finder` and :term:`loader` " +"side of things. For finders there are two flavours to choose from depending " +"on your needs: a :term:`meta path finder` or a :term:`path entry finder`. " +"The former is what you would put on :data:`sys.meta_path` while the latter " +"is what you create using a :term:`path entry hook` on :data:`sys.path_hooks` " +"which works with :data:`sys.path` entries to potentially create a finder. " +"This example will show you how to register your own importers so that import " +"will use them (for creating an importer for yourself, read the documentation " +"for the appropriate classes defined within this package)::" msgstr "" #: ../../library/importlib.rst:1652 diff --git a/library/importlib.resources.po b/library/importlib.resources.po index dd268a9bdb3..40d502c68fc 100644 --- a/library/importlib.resources.po +++ b/library/importlib.resources.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,18 +37,19 @@ msgid "" "\"Resources\" are file-like resources associated with a module or package in " "Python. The resources may be contained directly in a package, within a " "subdirectory contained in that package, or adjacent to modules outside a " -"package. Resources may be text or binary. As a result, Python module sources " -"(.py) of a package and compilation artifacts (pycache) are technically de-" -"facto resources of that package. In practice, however, resources are " -"primarily those non-Python artifacts exposed specifically by the package " -"author." +"package. Resources may be text or binary. As a result, a package's Python " +"module sources (.py), compilation artifacts (pycache), and installation " +"artifacts (like :func:`reserved filenames ` in " +"directories) are technically de-facto resources of that package. In " +"practice, however, resources are primarily those non-Python artifacts " +"exposed specifically by the package author." msgstr "" -#: ../../library/importlib.resources.rst:25 +#: ../../library/importlib.resources.rst:26 msgid "Resources can be opened or read in either binary or text mode." msgstr "" -#: ../../library/importlib.resources.rst:27 +#: ../../library/importlib.resources.rst:28 msgid "" "Resources are roughly akin to files inside directories, though it's " "important to keep in mind that this is just a metaphor. Resources and " @@ -57,7 +58,7 @@ msgid "" "zip file using :py:mod:`zipimport`." msgstr "" -#: ../../library/importlib.resources.rst:35 +#: ../../library/importlib.resources.rst:36 msgid "" "This module provides functionality similar to `pkg_resources `_ `Basic Resource " @@ -67,7 +68,7 @@ msgid "" "consistent semantics." msgstr "" -#: ../../library/importlib.resources.rst:43 +#: ../../library/importlib.resources.rst:44 msgid "" "The standalone backport of this module provides more information on `using " "importlib.resources `_." msgstr "" -#: ../../library/importlib.resources.rst:49 +#: ../../library/importlib.resources.rst:50 msgid "" ":class:`Loaders ` that wish to support resource " "reading should implement a ``get_resource_reader(fullname)`` method as " "specified by :class:`importlib.resources.abc.ResourceReader`." msgstr "" -#: ../../library/importlib.resources.rst:55 +#: ../../library/importlib.resources.rst:56 msgid "" -"Represents an anchor for resources, either a :class:`module object " -"` or a module name as a string. Defined as ``Union[str, " +"Represents an anchor for resources, either a :class:`module object ` or a module name as a string. Defined as ``Union[str, " "ModuleType]``." msgstr "" -#: ../../library/importlib.resources.rst:61 +#: ../../library/importlib.resources.rst:62 msgid "" "Returns a :class:`~importlib.resources.abc.Traversable` object representing " "the resource container (think directory) and its resources (think files). A " "Traversable may contain other containers (think subdirectories)." msgstr "" -#: ../../library/importlib.resources.rst:66 +#: ../../library/importlib.resources.rst:67 msgid "" "*anchor* is an optional :class:`Anchor`. If the anchor is a package, " "resources are resolved from that package. If a module, resources are " @@ -104,17 +105,16 @@ msgid "" "If the anchor is omitted, the caller's module is used." msgstr "" -#: ../../library/importlib.resources.rst:74 +#: ../../library/importlib.resources.rst:75 msgid "" "*package* parameter was renamed to *anchor*. *anchor* can now be a non-" "package module and if omitted will default to the caller's module. *package* " -"is still accepted for compatibility but will raise " -"a :exc:`DeprecationWarning`. Consider passing the anchor positionally or " -"using ``importlib_resources >= 5.10`` for a compatible interface on older " -"Pythons." +"is still accepted for compatibility but will raise a :exc:" +"`DeprecationWarning`. Consider passing the anchor positionally or using " +"``importlib_resources >= 5.10`` for a compatible interface on older Pythons." msgstr "" -#: ../../library/importlib.resources.rst:84 +#: ../../library/importlib.resources.rst:85 msgid "" "Given a :class:`~importlib.resources.abc.Traversable` object representing a " "file or directory, typically from :func:`importlib.resources.files`, return " @@ -122,61 +122,60 @@ msgid "" "manager provides a :class:`pathlib.Path` object." msgstr "" -#: ../../library/importlib.resources.rst:89 +#: ../../library/importlib.resources.rst:90 msgid "" "Exiting the context manager cleans up any temporary file or directory " "created when the resource was extracted from e.g. a zip file." msgstr "" -#: ../../library/importlib.resources.rst:92 +#: ../../library/importlib.resources.rst:93 msgid "" "Use ``as_file`` when the Traversable methods (``read_text``, etc) are " "insufficient and an actual file or directory on the file system is required." msgstr "" -#: ../../library/importlib.resources.rst:98 +#: ../../library/importlib.resources.rst:99 msgid "Added support for *traversable* representing a directory." msgstr "" -#: ../../library/importlib.resources.rst:105 +#: ../../library/importlib.resources.rst:106 msgid "Functional API" msgstr "" -#: ../../library/importlib.resources.rst:107 +#: ../../library/importlib.resources.rst:108 msgid "" "A set of simplified, backwards-compatible helpers is available. These allow " "common operations in a single function call." msgstr "" -#: ../../library/importlib.resources.rst:110 +#: ../../library/importlib.resources.rst:111 msgid "For all the following functions:" msgstr "" -#: ../../library/importlib.resources.rst:112 +#: ../../library/importlib.resources.rst:113 msgid "" -"*anchor* is an :class:`~importlib.resources.Anchor`, as " -"in :func:`~importlib.resources.files`. Unlike in ``files``, it may not be " -"omitted." +"*anchor* is an :class:`~importlib.resources.Anchor`, as in :func:`~importlib." +"resources.files`. Unlike in ``files``, it may not be omitted." msgstr "" -#: ../../library/importlib.resources.rst:116 +#: ../../library/importlib.resources.rst:117 msgid "" "*path_names* are components of a resource's path name, relative to the " "anchor. For example, to get the text of resource named ``info.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:120 +#: ../../library/importlib.resources.rst:121 msgid "importlib.resources.read_text(my_module, \"info.txt\")" msgstr "importlib.resources.read_text(my_module, \"info.txt\")" -#: ../../library/importlib.resources.rst:122 +#: ../../library/importlib.resources.rst:123 msgid "" "Like :meth:`Traversable.joinpath `, The " "individual components should use forward slashes (``/``) as path separators. " "For example, the following are equivalent::" msgstr "" -#: ../../library/importlib.resources.rst:127 +#: ../../library/importlib.resources.rst:128 msgid "" "importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" "importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" @@ -184,14 +183,14 @@ msgstr "" "importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" "importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" -#: ../../library/importlib.resources.rst:130 +#: ../../library/importlib.resources.rst:131 msgid "" "For backward compatibility reasons, functions that read text require an " "explicit *encoding* argument if multiple *path_names* are given. For " "example, to get the text of ``info/chapter1.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:134 +#: ../../library/importlib.resources.rst:135 msgid "" "importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" " encoding='utf-8')" @@ -199,124 +198,124 @@ msgstr "" "importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" " encoding='utf-8')" -#: ../../library/importlib.resources.rst:139 +#: ../../library/importlib.resources.rst:140 msgid "Open the named resource for binary reading." msgstr "" -#: ../../library/importlib.resources.rst:141 -#: ../../library/importlib.resources.rst:184 -#: ../../library/importlib.resources.rst:232 -#: ../../library/importlib.resources.rst:249 -#: ../../library/importlib.resources.rst:267 +#: ../../library/importlib.resources.rst:142 +#: ../../library/importlib.resources.rst:185 +#: ../../library/importlib.resources.rst:233 +#: ../../library/importlib.resources.rst:250 +#: ../../library/importlib.resources.rst:268 msgid "" "See :ref:`the introduction ` for details on " "*anchor* and *path_names*." msgstr "" -#: ../../library/importlib.resources.rst:144 +#: ../../library/importlib.resources.rst:145 msgid "" "This function returns a :class:`~typing.BinaryIO` object, that is, a binary " "stream open for reading." msgstr "" -#: ../../library/importlib.resources.rst:147 -#: ../../library/importlib.resources.rst:171 -#: ../../library/importlib.resources.rst:187 -#: ../../library/importlib.resources.rst:208 -#: ../../library/importlib.resources.rst:235 -#: ../../library/importlib.resources.rst:252 -#: ../../library/importlib.resources.rst:270 +#: ../../library/importlib.resources.rst:148 +#: ../../library/importlib.resources.rst:172 +#: ../../library/importlib.resources.rst:188 +#: ../../library/importlib.resources.rst:209 +#: ../../library/importlib.resources.rst:236 +#: ../../library/importlib.resources.rst:253 +#: ../../library/importlib.resources.rst:271 msgid "This function is roughly equivalent to::" msgstr "這個函式大致等同於: ::" -#: ../../library/importlib.resources.rst:149 +#: ../../library/importlib.resources.rst:150 msgid "files(anchor).joinpath(*path_names).open('rb')" msgstr "files(anchor).joinpath(*path_names).open('rb')" -#: ../../library/importlib.resources.rst:151 -#: ../../library/importlib.resources.rst:191 -#: ../../library/importlib.resources.rst:256 +#: ../../library/importlib.resources.rst:152 +#: ../../library/importlib.resources.rst:192 +#: ../../library/importlib.resources.rst:257 msgid "Multiple *path_names* are accepted." msgstr "多個 *path_names* 是被接受的。" -#: ../../library/importlib.resources.rst:157 +#: ../../library/importlib.resources.rst:158 msgid "" "Open the named resource for text reading. By default, the contents are read " "as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:160 -#: ../../library/importlib.resources.rst:200 +#: ../../library/importlib.resources.rst:161 +#: ../../library/importlib.resources.rst:201 msgid "" "See :ref:`the introduction ` for details on " "*anchor* and *path_names*. *encoding* and *errors* have the same meaning as " "in built-in :func:`open`." msgstr "" -#: ../../library/importlib.resources.rst:164 -#: ../../library/importlib.resources.rst:204 +#: ../../library/importlib.resources.rst:165 +#: ../../library/importlib.resources.rst:205 msgid "" "For backward compatibility reasons, the *encoding* argument must be given " "explicitly if there are multiple *path_names*. This limitation is scheduled " "to be removed in Python 3.15." msgstr "" -#: ../../library/importlib.resources.rst:168 +#: ../../library/importlib.resources.rst:169 msgid "" "This function returns a :class:`~typing.TextIO` object, that is, a text " "stream open for reading." msgstr "" -#: ../../library/importlib.resources.rst:173 +#: ../../library/importlib.resources.rst:174 msgid "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" msgstr "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" -#: ../../library/importlib.resources.rst:175 -#: ../../library/importlib.resources.rst:212 -#: ../../library/importlib.resources.rst:239 +#: ../../library/importlib.resources.rst:176 +#: ../../library/importlib.resources.rst:213 +#: ../../library/importlib.resources.rst:240 msgid "" "Multiple *path_names* are accepted. *encoding* and *errors* must be given as " "keyword arguments." msgstr "" -#: ../../library/importlib.resources.rst:182 +#: ../../library/importlib.resources.rst:183 msgid "Read and return the contents of the named resource as :class:`bytes`." msgstr "以 :class:`bytes` 形式讀取並回傳指定資源的內容。" -#: ../../library/importlib.resources.rst:189 +#: ../../library/importlib.resources.rst:190 msgid "files(anchor).joinpath(*path_names).read_bytes()" msgstr "files(anchor).joinpath(*path_names).read_bytes()" -#: ../../library/importlib.resources.rst:197 +#: ../../library/importlib.resources.rst:198 msgid "" "Read and return the contents of the named resource as :class:`str`. By " "default, the contents are read as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:210 +#: ../../library/importlib.resources.rst:211 msgid "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" msgstr "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" -#: ../../library/importlib.resources.rst:219 +#: ../../library/importlib.resources.rst:220 msgid "" "Provides the path to the *resource* as an actual file system path. This " "function returns a context manager for use in a :keyword:`with` statement. " "The context manager provides a :class:`pathlib.Path` object." msgstr "" -#: ../../library/importlib.resources.rst:223 +#: ../../library/importlib.resources.rst:224 msgid "" "Exiting the context manager cleans up any temporary files created, e.g. when " "the resource needs to be extracted from a zip file." msgstr "" -#: ../../library/importlib.resources.rst:226 +#: ../../library/importlib.resources.rst:227 msgid "" "For example, the :meth:`~pathlib.Path.stat` method requires an actual file " "system path; it can be used like this::" msgstr "" -#: ../../library/importlib.resources.rst:229 +#: ../../library/importlib.resources.rst:230 msgid "" "with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" " result = fspath.stat()" @@ -324,21 +323,21 @@ msgstr "" "with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" " result = fspath.stat()" -#: ../../library/importlib.resources.rst:237 +#: ../../library/importlib.resources.rst:238 msgid "as_file(files(anchor).joinpath(*path_names))" msgstr "as_file(files(anchor).joinpath(*path_names))" -#: ../../library/importlib.resources.rst:246 +#: ../../library/importlib.resources.rst:247 msgid "" "Return ``True`` if the named resource exists, otherwise ``False``. This " "function does not consider directories to be resources." msgstr "" -#: ../../library/importlib.resources.rst:254 +#: ../../library/importlib.resources.rst:255 msgid "files(anchor).joinpath(*path_names).is_file()" msgstr "files(anchor).joinpath(*path_names).is_file()" -#: ../../library/importlib.resources.rst:262 +#: ../../library/importlib.resources.rst:263 msgid "" "Return an iterable over the named items within the package or path. The " "iterable returns names of resources (e.g. files) and non-resources (e.g. " @@ -346,7 +345,7 @@ msgid "" "subdirectories." msgstr "" -#: ../../library/importlib.resources.rst:272 +#: ../../library/importlib.resources.rst:273 msgid "" "for resource in files(anchor).joinpath(*path_names).iterdir():\n" " yield resource.name" @@ -354,7 +353,7 @@ msgstr "" "for resource in files(anchor).joinpath(*path_names).iterdir():\n" " yield resource.name" -#: ../../library/importlib.resources.rst:275 +#: ../../library/importlib.resources.rst:276 msgid "" "Prefer ``iterdir()`` as above, which offers more control over the results " "and richer functionality." diff --git a/library/inspect.po b/library/inspect.po index 093377a4d2b..4d6134d298a 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -850,6 +850,11 @@ msgid "" ">>> inspect.isasyncgenfunction(agen)\n" "True" msgstr "" +">>> async def agen():\n" +"... yield 1\n" +"...\n" +">>> inspect.isasyncgenfunction(agen)\n" +"True" #: ../../library/inspect.rst:503 msgid "" @@ -1643,11 +1648,11 @@ msgstr "" #: ../../library/inspect.rst:1125 msgid ":pep:`362` - Function Signature Object." -msgstr "" +msgstr ":pep:`362` - 函式簽名物件。" #: ../../library/inspect.rst:1126 msgid "The detailed specification, implementation details and examples." -msgstr "" +msgstr "詳細的規格、實作細節和範例。" #: ../../library/inspect.rst:1132 msgid "Classes and functions" @@ -1675,6 +1680,8 @@ msgid "" "``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, " "annotations)``" msgstr "" +"``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, " +"annotations)``" #: ../../library/inspect.rst:1153 msgid "" diff --git a/library/ipaddress.po b/library/ipaddress.po index 26ac4a22525..055f7119c00 100644 --- a/library/ipaddress.po +++ b/library/ipaddress.po @@ -264,11 +264,11 @@ msgstr "" #: ../../library/ipaddress.rst:209 msgid "``64:ff9b:1::/48`` is considered private." -msgstr "" +msgstr "``64:ff9b:1::/48`` 被視為私有。" #: ../../library/ipaddress.rst:210 msgid "``2002::/16`` is considered private." -msgstr "" +msgstr "``2002::/16`` 被視為私有。" #: ../../library/ipaddress.rst:211 msgid "" diff --git a/library/json.po b/library/json.po index 98996caed79..76ddc68384d 100644 --- a/library/json.po +++ b/library/json.po @@ -118,6 +118,9 @@ msgid "" ">>> json.dumps([1, 2, 3, {'4': 5, '6': 7}], separators=(',', ':'))\n" "'[1,2,3,{\"4\":5,\"6\":7}]'" msgstr "" +">>> import json\n" +">>> json.dumps([1, 2, 3, {'4': 5, '6': 7}], separators=(',', ':'))\n" +"'[1,2,3,{\"4\":5,\"6\":7}]'" #: ../../library/json.rst:59 msgid "Pretty printing::" @@ -1161,10 +1164,13 @@ msgid "" ">>> json.loads(weird_json)\n" "{'x': 3}" msgstr "" +">>> weird_json = '{\"x\": 1, \"x\": 2, \"x\": 3}'\n" +">>> json.loads(weird_json)\n" +"{'x': 3}" #: ../../library/json.rst:694 msgid "The *object_pairs_hook* parameter can be used to alter this behavior." -msgstr "*object_parts_hook* 參數可以改變這個行為。" +msgstr "*object_pairs_hook* 參數可以改變這個行為。" #: ../../library/json.rst:698 msgid "Top-level Non-Object, Non-Array Values" diff --git a/library/logging.config.po b/library/logging.config.po index 29d54ac575b..06dbdf1241e 100644 --- a/library/logging.config.po +++ b/library/logging.config.po @@ -373,11 +373,11 @@ msgstr "``style``" #: ../../library/logging.config.rst:263 msgid "``validate`` (since version >=3.8)" -msgstr "" +msgstr "``validate`` (自 3.8 版起)" #: ../../library/logging.config.rst:264 msgid "``defaults`` (since version >=3.12)" -msgstr "" +msgstr "``defaults`` (自 3.12 版起)" #: ../../library/logging.config.rst:266 msgid "" diff --git a/library/mailbox.po b/library/mailbox.po index 2a44b786f77..44305a8f187 100644 --- a/library/mailbox.po +++ b/library/mailbox.po @@ -1081,7 +1081,7 @@ msgstr "" #: ../../library/mailbox.rst:964 ../../library/mailbox.rst:1131 #: ../../library/mailbox.rst:1502 msgid "Flag" -msgstr "" +msgstr "旗標" #: ../../library/mailbox.rst:964 ../../library/mailbox.rst:1131 #: ../../library/mailbox.rst:1502 @@ -1092,7 +1092,7 @@ msgstr "含義" #: ../../library/mailbox.rst:1282 ../../library/mailbox.rst:1369 #: ../../library/mailbox.rst:1502 msgid "Explanation" -msgstr "" +msgstr "解釋" #: ../../library/mailbox.rst:966 ../../library/mailbox.rst:1137 #: ../../library/mailbox.rst:1508 @@ -1101,11 +1101,11 @@ msgstr "D" #: ../../library/mailbox.rst:966 msgid "Draft" -msgstr "" +msgstr "草稿" #: ../../library/mailbox.rst:966 msgid "Under composition" -msgstr "" +msgstr "編輯中" #: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 #: ../../library/mailbox.rst:1510 @@ -1115,12 +1115,12 @@ msgstr "F" #: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 #: ../../library/mailbox.rst:1510 msgid "Flagged" -msgstr "" +msgstr "已標記" #: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 #: ../../library/mailbox.rst:1288 ../../library/mailbox.rst:1510 msgid "Marked as important" -msgstr "" +msgstr "標記為重要" #: ../../library/mailbox.rst:970 msgid "P" @@ -1141,7 +1141,7 @@ msgstr "R" #: ../../library/mailbox.rst:972 msgid "Replied" -msgstr "" +msgstr "已回覆" #: ../../library/mailbox.rst:972 ../../library/mailbox.rst:1141 #: ../../library/mailbox.rst:1286 ../../library/mailbox.rst:1377 @@ -1155,7 +1155,7 @@ msgstr "S" #: ../../library/mailbox.rst:974 msgid "Seen" -msgstr "" +msgstr "已查看" #: ../../library/mailbox.rst:974 ../../library/mailbox.rst:1133 #: ../../library/mailbox.rst:1504 @@ -1177,7 +1177,7 @@ msgstr "" #: ../../library/mailbox.rst:979 msgid ":class:`!MaildirMessage` instances offer the following methods:" -msgstr "" +msgstr ":class:`!MaildirMessage` 實例提供以下方法:" #: ../../library/mailbox.rst:984 msgid "" @@ -1274,13 +1274,13 @@ msgstr "" #: ../../library/mailbox.rst:1062 ../../library/mailbox.rst:1332 #: ../../library/mailbox.rst:1460 msgid ":class:`mboxMessage` or :class:`MMDFMessage` state" -msgstr "" +msgstr ":class:`mboxMessage` 或 :class:`MMDFMessage` 狀態" #: ../../library/mailbox.rst:1065 ../../library/mailbox.rst:1082 #: ../../library/mailbox.rst:1097 ../../library/mailbox.rst:1206 #: ../../library/mailbox.rst:1578 msgid "\"cur\" subdirectory" -msgstr "" +msgstr "\"cur\" 子目錄" #: ../../library/mailbox.rst:1065 ../../library/mailbox.rst:1206 #: ../../library/mailbox.rst:1223 ../../library/mailbox.rst:1238 @@ -1288,7 +1288,7 @@ msgstr "" #: ../../library/mailbox.rst:1595 ../../library/mailbox.rst:1610 #: ../../library/mailbox.rst:1626 msgid "O flag" -msgstr "" +msgstr "O 旗標" #: ../../library/mailbox.rst:1067 ../../library/mailbox.rst:1086 #: ../../library/mailbox.rst:1210 ../../library/mailbox.rst:1225 @@ -1296,7 +1296,7 @@ msgstr "" #: ../../library/mailbox.rst:1339 ../../library/mailbox.rst:1582 #: ../../library/mailbox.rst:1597 ../../library/mailbox.rst:1630 msgid "F flag" -msgstr "" +msgstr "F 旗標" #: ../../library/mailbox.rst:1069 ../../library/mailbox.rst:1071 #: ../../library/mailbox.rst:1088 ../../library/mailbox.rst:1103 @@ -1305,7 +1305,7 @@ msgstr "" #: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1576 #: ../../library/mailbox.rst:1584 ../../library/mailbox.rst:1624 msgid "R flag" -msgstr "" +msgstr "R 旗標" #: ../../library/mailbox.rst:1069 ../../library/mailbox.rst:1212 #: ../../library/mailbox.rst:1227 ../../library/mailbox.rst:1242 @@ -1314,25 +1314,25 @@ msgstr "" #: ../../library/mailbox.rst:1599 ../../library/mailbox.rst:1614 #: ../../library/mailbox.rst:1632 msgid "A flag" -msgstr "" +msgstr "A 旗標" #: ../../library/mailbox.rst:1071 ../../library/mailbox.rst:1204 #: ../../library/mailbox.rst:1576 msgid "S flag" -msgstr "" +msgstr "S 旗標" #: ../../library/mailbox.rst:1073 ../../library/mailbox.rst:1105 #: ../../library/mailbox.rst:1208 ../../library/mailbox.rst:1447 #: ../../library/mailbox.rst:1580 msgid "T flag" -msgstr "" +msgstr "T 旗標" #: ../../library/mailbox.rst:1073 ../../library/mailbox.rst:1208 #: ../../library/mailbox.rst:1240 ../../library/mailbox.rst:1256 #: ../../library/mailbox.rst:1465 ../../library/mailbox.rst:1580 #: ../../library/mailbox.rst:1612 ../../library/mailbox.rst:1628 msgid "D flag" -msgstr "" +msgstr "D 旗標" #: ../../library/mailbox.rst:1076 msgid "" @@ -1343,36 +1343,36 @@ msgstr "" #: ../../library/mailbox.rst:1080 ../../library/mailbox.rst:1219 #: ../../library/mailbox.rst:1474 ../../library/mailbox.rst:1591 msgid ":class:`MHMessage` state" -msgstr "" +msgstr ":class:`MHMessage` 狀態" #: ../../library/mailbox.rst:1082 ../../library/mailbox.rst:1223 #: ../../library/mailbox.rst:1319 ../../library/mailbox.rst:1335 #: ../../library/mailbox.rst:1348 ../../library/mailbox.rst:1476 #: ../../library/mailbox.rst:1595 msgid "\"unseen\" sequence" -msgstr "" +msgstr "\"unseen\" 序列" #: ../../library/mailbox.rst:1084 ../../library/mailbox.rst:1099 msgid "\"cur\" subdirectory and S flag" -msgstr "" +msgstr "\"cur\" 子目錄和 S 旗標" #: ../../library/mailbox.rst:1084 ../../library/mailbox.rst:1221 #: ../../library/mailbox.rst:1593 msgid "no \"unseen\" sequence" -msgstr "" +msgstr "沒有 \"unseen\" 序列" #: ../../library/mailbox.rst:1086 ../../library/mailbox.rst:1225 #: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1339 #: ../../library/mailbox.rst:1597 msgid "\"flagged\" sequence" -msgstr "" +msgstr "\"flagged\" 序列" #: ../../library/mailbox.rst:1088 ../../library/mailbox.rst:1227 #: ../../library/mailbox.rst:1321 ../../library/mailbox.rst:1337 #: ../../library/mailbox.rst:1350 ../../library/mailbox.rst:1478 #: ../../library/mailbox.rst:1599 msgid "\"replied\" sequence" -msgstr "" +msgstr "\"replied\" 序列" #: ../../library/mailbox.rst:1091 msgid "" @@ -1383,40 +1383,40 @@ msgstr "" #: ../../library/mailbox.rst:1095 ../../library/mailbox.rst:1234 #: ../../library/mailbox.rst:1346 ../../library/mailbox.rst:1606 msgid ":class:`BabylMessage` state" -msgstr "" +msgstr ":class:`BabylMessage` 狀態" #: ../../library/mailbox.rst:1097 ../../library/mailbox.rst:1238 #: ../../library/mailbox.rst:1348 ../../library/mailbox.rst:1445 #: ../../library/mailbox.rst:1463 ../../library/mailbox.rst:1476 #: ../../library/mailbox.rst:1610 msgid "\"unseen\" label" -msgstr "" +msgstr "\"unseen\" 標籤" #: ../../library/mailbox.rst:1099 ../../library/mailbox.rst:1236 #: ../../library/mailbox.rst:1608 msgid "no \"unseen\" label" -msgstr "" +msgstr "沒有 \"unseen\" 標籤" #: ../../library/mailbox.rst:1101 ../../library/mailbox.rst:1451 msgid "P flag" -msgstr "" +msgstr "P 旗標" #: ../../library/mailbox.rst:1101 msgid "\"forwarded\" or \"resent\" label" -msgstr "" +msgstr "\"forwarded\" 或 \"resent\" 標籤" #: ../../library/mailbox.rst:1103 ../../library/mailbox.rst:1242 #: ../../library/mailbox.rst:1350 ../../library/mailbox.rst:1449 #: ../../library/mailbox.rst:1467 ../../library/mailbox.rst:1478 #: ../../library/mailbox.rst:1614 msgid "\"answered\" label" -msgstr "" +msgstr "\"answered\" 標籤" #: ../../library/mailbox.rst:1105 ../../library/mailbox.rst:1240 #: ../../library/mailbox.rst:1447 ../../library/mailbox.rst:1465 #: ../../library/mailbox.rst:1612 msgid "\"deleted\" label" -msgstr "" +msgstr "\"deleted\" 標籤" #: ../../library/mailbox.rst:1112 msgid ":class:`!mboxMessage` objects" @@ -1476,7 +1476,7 @@ msgstr "" #: ../../library/mailbox.rst:1148 msgid ":class:`!mboxMessage` instances offer the following methods:" -msgstr "" +msgstr ":class:`!mboxMessage` 實例提供以下方法:" #: ../../library/mailbox.rst:1153 ../../library/mailbox.rst:1525 msgid "" @@ -1535,7 +1535,7 @@ msgstr "" #: ../../library/mailbox.rst:1202 ../../library/mailbox.rst:1317 #: ../../library/mailbox.rst:1443 ../../library/mailbox.rst:1574 msgid ":class:`MaildirMessage` state" -msgstr "" +msgstr ":class:`MaildirMessage` 狀態" #: ../../library/mailbox.rst:1215 msgid "" @@ -1546,7 +1546,7 @@ msgstr "" #: ../../library/mailbox.rst:1221 ../../library/mailbox.rst:1236 #: ../../library/mailbox.rst:1593 ../../library/mailbox.rst:1608 msgid "R flag and O flag" -msgstr "" +msgstr "R 旗標和 O 旗標" #: ../../library/mailbox.rst:1230 msgid "" @@ -1563,7 +1563,7 @@ msgstr "" #: ../../library/mailbox.rst:1250 msgid ":class:`MMDFMessage` state" -msgstr "" +msgstr ":class:`MMDFMessage` 狀態" #: ../../library/mailbox.rst:1267 msgid ":class:`!MHMessage` objects" @@ -1606,7 +1606,7 @@ msgstr "" #: ../../library/mailbox.rst:1291 msgid ":class:`!MHMessage` instances offer the following methods:" -msgstr "" +msgstr ":class:`!MHMessage` 實例提供以下方法:" #: ../../library/mailbox.rst:1296 msgid "Return a list of the names of sequences that include this message." @@ -1632,7 +1632,7 @@ msgstr "" #: ../../library/mailbox.rst:1319 ../../library/mailbox.rst:1445 msgid "no S flag" -msgstr "" +msgstr "無 S 旗標" #: ../../library/mailbox.rst:1326 msgid "" @@ -1644,7 +1644,7 @@ msgstr "" #: ../../library/mailbox.rst:1335 ../../library/mailbox.rst:1463 msgid "no R flag" -msgstr "" +msgstr "無 R 旗標" #: ../../library/mailbox.rst:1342 msgid "" @@ -1721,7 +1721,7 @@ msgstr "" #: ../../library/mailbox.rst:1390 msgid ":class:`!BabylMessage` instances offer the following methods:" -msgstr "" +msgstr ":class:`!BabylMessage` 實例提供以下方法:" #: ../../library/mailbox.rst:1395 msgid "Return a list of labels on the message." @@ -1774,7 +1774,7 @@ msgstr "" #: ../../library/mailbox.rst:1451 msgid "\"forwarded\" label" -msgstr "" +msgstr "\"forwarded\" 標籤" #: ../../library/mailbox.rst:1454 msgid "" @@ -1849,7 +1849,7 @@ msgstr "" #: ../../library/mailbox.rst:1622 msgid ":class:`mboxMessage` state" -msgstr "" +msgstr ":class:`mboxMessage` 狀態" #: ../../library/mailbox.rst:1637 msgid "Exceptions" diff --git a/library/mimetypes.po b/library/mimetypes.po index 7a4af89faa2..ca02fe441f4 100644 --- a/library/mimetypes.po +++ b/library/mimetypes.po @@ -376,7 +376,7 @@ msgstr "" #: ../../library/mimetypes.rst:320 msgid "Command-line usage" -msgstr "" +msgstr "命令列用法" #: ../../library/mimetypes.rst:322 msgid "" @@ -386,7 +386,7 @@ msgstr "" #: ../../library/mimetypes.rst:324 msgid "python -m mimetypes [-h] [-e] [-l] type [type ...]" -msgstr "" +msgstr "python -m mimetypes [-h] [-e] [-l] type [type ...]" #: ../../library/mimetypes.rst:328 msgid "The following options are accepted:" diff --git a/library/mmap.po b/library/mmap.po index be083b8ab9f..63491910875 100644 --- a/library/mmap.po +++ b/library/mmap.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-27 07:36+0000\n" +"POT-Creation-Date: 2025-09-22 00:18+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -289,7 +289,7 @@ msgstr "" #: ../../library/mmap.rst:187 msgid "``True`` if the file is closed." -msgstr "" +msgstr "若檔案已關閉則回傳 ``True``。" #: ../../library/mmap.rst:194 msgid "" @@ -299,12 +299,12 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/mmap.rst:199 ../../library/mmap.rst:291 -#: ../../library/mmap.rst:331 +#: ../../library/mmap.rst:199 ../../library/mmap.rst:292 +#: ../../library/mmap.rst:332 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" -#: ../../library/mmap.rst:205 +#: ../../library/mmap.rst:206 msgid "" "Flushes changes made to the in-memory copy of a file back to disk. Without " "use of this call there is no guarantee that changes are written back before " @@ -314,20 +314,20 @@ msgid "" "`PAGESIZE` or :const:`ALLOCATIONGRANULARITY`." msgstr "" -#: ../../library/mmap.rst:212 +#: ../../library/mmap.rst:213 msgid "" "``None`` is returned to indicate success. An exception is raised when the " "call failed." msgstr "" -#: ../../library/mmap.rst:215 +#: ../../library/mmap.rst:216 msgid "" "Previously, a nonzero value was returned on success; zero was returned on " "error under Windows. A zero value was returned on success; an exception was " "raised on error under Unix." msgstr "" -#: ../../library/mmap.rst:223 +#: ../../library/mmap.rst:224 msgid "" "Send advice *option* to the kernel about the memory region beginning at " "*start* and extending *length* bytes. *option* must be one of the :ref:" @@ -336,18 +336,18 @@ msgid "" "(including Linux), *start* must be a multiple of the :const:`PAGESIZE`." msgstr "" -#: ../../library/mmap.rst:230 +#: ../../library/mmap.rst:231 msgid "Availability: Systems with the ``madvise()`` system call." msgstr "" -#: ../../library/mmap.rst:237 +#: ../../library/mmap.rst:238 msgid "" "Copy the *count* bytes starting at offset *src* to the destination index " "*dest*. If the mmap was created with :const:`ACCESS_READ`, then calls to " "move will raise a :exc:`TypeError` exception." msgstr "" -#: ../../library/mmap.rst:244 +#: ../../library/mmap.rst:245 msgid "" "Return a :class:`bytes` containing up to *n* bytes starting from the current " "file position. If the argument is omitted, ``None`` or negative, return all " @@ -355,28 +355,28 @@ msgid "" "position is updated to point after the bytes that were returned." msgstr "" -#: ../../library/mmap.rst:250 +#: ../../library/mmap.rst:251 msgid "Argument can be omitted or ``None``." msgstr "" -#: ../../library/mmap.rst:255 +#: ../../library/mmap.rst:256 msgid "" "Returns a byte at the current file position as an integer, and advances the " "file position by 1." msgstr "" -#: ../../library/mmap.rst:261 +#: ../../library/mmap.rst:262 msgid "" "Returns a single line, starting at the current file position and up to the " "next newline. The file position is updated to point after the bytes that " "were returned." msgstr "" -#: ../../library/mmap.rst:268 +#: ../../library/mmap.rst:269 msgid "Resizes the map and the underlying file, if any." msgstr "" -#: ../../library/mmap.rst:270 +#: ../../library/mmap.rst:271 msgid "" "Resizing a map created with *access* of :const:`ACCESS_READ` or :const:" "`ACCESS_COPY`, will raise a :exc:`TypeError` exception. Resizing a map " @@ -384,7 +384,7 @@ msgid "" "exception." msgstr "" -#: ../../library/mmap.rst:275 +#: ../../library/mmap.rst:276 msgid "" "**On Windows**: Resizing the map will raise an :exc:`OSError` if there are " "other maps against the same named file. Resizing an anonymous map (ie " @@ -392,13 +392,13 @@ msgid "" "copied over up to the length of the new size." msgstr "" -#: ../../library/mmap.rst:280 +#: ../../library/mmap.rst:281 msgid "" "Correctly fails if attempting to resize when another map is held Allows " "resize against an anonymous map on Windows" msgstr "" -#: ../../library/mmap.rst:286 +#: ../../library/mmap.rst:287 msgid "" "Returns the highest index in the object where the subsequence *sub* is " "found, such that *sub* is contained in the range [*start*, *end*]. Optional " @@ -406,7 +406,7 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/mmap.rst:297 +#: ../../library/mmap.rst:298 msgid "" "Set the file's current position. *whence* argument is optional and defaults " "to ``os.SEEK_SET`` or ``0`` (absolute file positioning); other values are " @@ -414,27 +414,27 @@ msgid "" "SEEK_END`` or ``2`` (seek relative to the file's end)." msgstr "" -#: ../../library/mmap.rst:302 +#: ../../library/mmap.rst:303 msgid "Return the new absolute position instead of ``None``." msgstr "" -#: ../../library/mmap.rst:307 +#: ../../library/mmap.rst:308 msgid "" "Return whether the file supports seeking, and the return value is always " "``True``." msgstr "" -#: ../../library/mmap.rst:313 +#: ../../library/mmap.rst:314 msgid "" "Return the length of the file, which can be larger than the size of the " "memory-mapped area." msgstr "" -#: ../../library/mmap.rst:319 +#: ../../library/mmap.rst:320 msgid "Returns the current position of the file pointer." msgstr "" -#: ../../library/mmap.rst:324 +#: ../../library/mmap.rst:325 msgid "" "Write the bytes in *bytes* into memory at the current position of the file " "pointer and return the number of bytes written (never less than " @@ -444,11 +444,11 @@ msgid "" "it will raise a :exc:`TypeError` exception." msgstr "" -#: ../../library/mmap.rst:334 +#: ../../library/mmap.rst:335 msgid "The number of bytes written is now returned." msgstr "" -#: ../../library/mmap.rst:340 +#: ../../library/mmap.rst:341 msgid "" "Write the integer *byte* into memory at the current position of the file " "pointer; the file position is advanced by ``1``. If the mmap was created " @@ -456,25 +456,25 @@ msgid "" "exception." msgstr "" -#: ../../library/mmap.rst:348 +#: ../../library/mmap.rst:349 msgid "MADV_* Constants" msgstr "MADV_* 常數" -#: ../../library/mmap.rst:375 +#: ../../library/mmap.rst:376 msgid "" "These options can be passed to :meth:`mmap.madvise`. Not every option will " "be present on every system." msgstr "" -#: ../../library/mmap.rst:378 +#: ../../library/mmap.rst:379 msgid "Availability: Systems with the madvise() system call." msgstr "" -#: ../../library/mmap.rst:385 +#: ../../library/mmap.rst:386 msgid "MAP_* Constants" msgstr "MAP_* 常數" -#: ../../library/mmap.rst:409 +#: ../../library/mmap.rst:410 msgid "" "These are the various flags that can be passed to :meth:`mmap.mmap`. :data:" "`MAP_ALIGNED_SUPER` is only available at FreeBSD and :data:`MAP_CONCEAL` is " @@ -482,19 +482,19 @@ msgid "" "some systems." msgstr "" -#: ../../library/mmap.rst:413 +#: ../../library/mmap.rst:414 msgid "Added :data:`MAP_POPULATE` constant." msgstr "新增 :data:`MAP_POPULATE` 常數。" -#: ../../library/mmap.rst:416 +#: ../../library/mmap.rst:417 msgid "Added :data:`MAP_STACK` constant." msgstr "新增 :data:`MAP_STACK` 常數。" -#: ../../library/mmap.rst:419 +#: ../../library/mmap.rst:420 msgid "Added :data:`MAP_ALIGNED_SUPER` and :data:`MAP_CONCEAL` constants." msgstr "新增 :data:`MAP_ALIGNED_SUPER` 和 :data:`MAP_CONCEAL` 常數。" -#: ../../library/mmap.rst:422 +#: ../../library/mmap.rst:423 msgid "" "Added :data:`MAP_32BIT`, :data:`MAP_HASSEMAPHORE`, :data:`MAP_JIT`, :data:" "`MAP_NOCACHE`, :data:`MAP_NOEXTEND`, :data:`MAP_NORESERVE`, :data:" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index 15f6ddc7039..b5178aa2ade 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -2982,7 +2982,7 @@ msgstr "" #: ../../library/multiprocessing.rst:2036 msgid ":class:`set` support was added." -msgstr "" +msgstr "已新增對 :class:`set` 的支援。" #: ../../library/multiprocessing.rst:2039 msgid "" diff --git a/library/numbers.po b/library/numbers.po index 9715ceb1a09..42965452060 100644 --- a/library/numbers.po +++ b/library/numbers.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2022-11-16 04:57+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,10 +30,10 @@ msgstr "**原始碼:**\\ :source:`Lib/numbers.py`" #: ../../library/numbers.rst:11 msgid "" -"The :mod:`!numbers` module (:pep:`3141`) defines a hierarchy of " -"numeric :term:`abstract base classes ` which " -"progressively define more operations. None of the types defined in this " -"module are intended to be instantiated." +"The :mod:`!numbers` module (:pep:`3141`) defines a hierarchy of numeric :" +"term:`abstract base classes ` which progressively " +"define more operations. None of the types defined in this module are " +"intended to be instantiated." msgstr "" ":mod:`!numbers` 模組 (:pep:`3141`) 定義了數值\\ :term:`抽象基底類別 " "` 的階層結構,其中逐一定義了更多操作。此模組中定義的型別" @@ -54,16 +54,15 @@ msgstr "數值的階層" #: ../../library/numbers.rst:27 msgid "" "Subclasses of this type describe complex numbers and include the operations " -"that work on the built-in :class:`complex` type. These are: conversions " -"to :class:`complex` and :class:`bool`, :attr:`.real`, :attr:`.imag`, ``+``, " -"``-``, ``*``, ``/``, ``**``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!" +"that work on the built-in :class:`complex` type. These are: conversions to :" +"class:`complex` and :class:`bool`, :attr:`.real`, :attr:`.imag`, ``+``, ``-" +"``, ``*``, ``/``, ``**``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!" "=``. All except ``-`` and ``!=`` are abstract." msgstr "" "這個型別的子類別描述了複數並包含適用於內建 :class:`complex` 型別的操作。這些" -"操作有::class:`complex` 和 :class:`bool` 的轉" -"換、:attr:`.real`、:attr:`.imag`、``+``、``-``、``*``、``/``、" -"``**``、:func:`abs`、:meth:`conjugate`、``==`` 以及 ``!=``。除 ``-`` 和 ``!" -"=`` 之外所有操作都是抽象的。" +"操作有::class:`complex` 和 :class:`bool` 的轉換、:attr:`.real`、:attr:`." +"imag`、``+``、``-``、``*``、``/``、``**``、:func:`abs`、:meth:`conjugate`、" +"``==`` 以及 ``!=``。除 ``-`` 和 ``!=`` 之外所有操作都是抽象的。" #: ../../library/numbers.rst:35 msgid "Abstract. Retrieves the real component of this number." @@ -87,59 +86,59 @@ msgstr "相對於 :class:`Complex`,:class:`!Real` 加入了只有實數才能 #: ../../library/numbers.rst:52 msgid "" -"In short, those are: a conversion " -"to :class:`float`, :func:`math.trunc`, :func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, " -"``//``, ``%``, ``<``, ``<=``, ``>``, and ``>=``." +"In short, those are: a conversion to :class:`float`, :func:`math.trunc`, :" +"func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, ``//``, " +"``%``, ``<``, ``<=``, ``>``, and ``>=``." msgstr "" -"簡單的說,有 :class:`float` 的轉" -"換、:func:`math.trunc`、:func:`round`、:func:`math.floor`、:func:`math.ceil`、:func:`divmod`、" -"``//``、``%``、 ``<``、``<=``、``>``、和 ``>=``。" +"簡單的說,有 :class:`float` 的轉換、:func:`math.trunc`、:func:`round`、:func:" +"`math.floor`、:func:`math.ceil`、:func:`divmod`、``//``、``%``、 ``<``、" +"``<=``、``>``、和 ``>=``。" #: ../../library/numbers.rst:56 msgid "" -"Real also provides defaults " -"for :func:`complex`, :attr:`~Complex.real`, :attr:`~Complex.imag`, " -"and :meth:`~Complex.conjugate`." +"Real also provides defaults for :func:`complex`, :attr:`~Complex.real`, :" +"attr:`~Complex.imag`, and :meth:`~Complex.conjugate`." msgstr "" "實數同樣提供 :func:`complex`、:attr:`~Complex.real`、:attr:`~Complex.imag` " "和 :meth:`~Complex.conjugate` 的預設值。" #: ../../library/numbers.rst:62 msgid "" -"Subtypes :class:`Real` and adds :attr:`~Rational.numerator` " -"and :attr:`~Rational.denominator` properties. It also provides a default " -"for :func:`float`." +"Subtypes :class:`Real` and adds :attr:`~Rational.numerator` and :attr:" +"`~Rational.denominator` properties. It also provides a default for :func:" +"`float`." msgstr "" -":class:`Real` 的子型別,並增加了 :attr:`~Rational.numerator` " -"和 :attr:`~Rational.denominator` 這兩種特性。它也會提供 :func:`float` 的預設" -"值。" +":class:`Real` 的子型別,並增加了 :attr:`~Rational.numerator` 和 :attr:" +"`~Rational.denominator` 這兩種特性。它也會提供 :func:`float` 的預設值。" #: ../../library/numbers.rst:66 msgid "" "The :attr:`~Rational.numerator` and :attr:`~Rational.denominator` values " -"should be instances of :class:`Integral` and should be in lowest terms " -"with :attr:`~Rational.denominator` positive." +"should be instances of :class:`Integral` and should be in lowest terms with :" +"attr:`~Rational.denominator` positive." msgstr "" -":attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 的值必須" -"是 :class:`Integral` 的實例且 :attr:`~Rational.denominator` 要是正數。" +":attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 的值必須是 :" +"class:`Integral` 的實例且 :attr:`~Rational.denominator` 要是正數。" -#: ../../library/numbers.rst:72 ../../library/numbers.rst:76 -msgid "Abstract." -msgstr "為抽象的。" +#: ../../library/numbers.rst:72 +msgid "Abstract. The numerator of this rational number." +msgstr "為抽象的。該有理數的分子。" + +#: ../../library/numbers.rst:76 +msgid "Abstract. The denominator of this rational number." +msgstr "為抽象的。該有理數的分母。" #: ../../library/numbers.rst:81 msgid "" "Subtypes :class:`Rational` and adds a conversion to :class:`int`. Provides " -"defaults for :func:`float`, :attr:`~Rational.numerator`, " -"and :attr:`~Rational.denominator`. Adds abstract methods for :func:`pow` " -"with modulus and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, " -"``~``." +"defaults for :func:`float`, :attr:`~Rational.numerator`, and :attr:" +"`~Rational.denominator`. Adds abstract methods for :func:`pow` with modulus " +"and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~``." msgstr "" -":class:`Rational` 的子型別,並增加了 :class:`int` 的轉換操作。" -"為 :func:`float`、:attr:`~Rational.numerator` " -"和 :attr:`~Rational.denominator` 提供了預設值。為 :func:`pow` 方法增加了求餘 " -"(modulus) 和位元字串運算 (bit-string operations) 的抽象方法:``<<``、``>>``、" -"``&``、``^``、``|``、``~``。" +":class:`Rational` 的子型別,並增加了 :class:`int` 的轉換操作。為 :func:" +"`float`、:attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 提供了" +"預設值。為 :func:`pow` 方法增加了求餘 (modulus) 和位元字串運算 (bit-string " +"operations) 的抽象方法:``<<``、``>>``、``&``、``^``、``|``、``~``。" #: ../../library/numbers.rst:89 msgid "Notes for type implementers" @@ -149,12 +148,12 @@ msgstr "給型別實作者的註記" msgid "" "Implementers should be careful to make equal numbers equal and hash them to " "the same values. This may be subtle if there are two different extensions of " -"the real numbers. For example, :class:`fractions.Fraction` " -"implements :func:`hash` as follows::" +"the real numbers. For example, :class:`fractions.Fraction` implements :func:" +"`hash` as follows::" msgstr "" "實作者需注意,相等的數值除了大小相等外,還必須擁有同樣的雜湊值。當使用兩個不" -"同的實數擴充時,這可能是很微妙的。例如,:class:`fractions.Fraction` 底下" -"的 :func:`hash` 實作如下: ::" +"同的實數擴充時,這可能是很微妙的。例如,:class:`fractions.Fraction` 底下的 :" +"func:`hash` 實作如下: ::" #: ../../library/numbers.rst:96 msgid "" @@ -191,8 +190,8 @@ msgid "" "poor hierarchy if it precluded the possibility of adding those. You can add " "``MyFoo`` between :class:`Complex` and :class:`Real` with::" msgstr "" -"當然,還有更多用於數值的 ABC,如果不加入它們就不會有健全的階層。你可以" -"在 :class:`Complex` 和 :class:`Real` 中加入 ``MyFoo``,像是: ::" +"當然,還有更多用於數值的 ABC,如果不加入它們就不會有健全的階層。你可以在 :" +"class:`Complex` 和 :class:`Real` 中加入 ``MyFoo``,像是: ::" #: ../../library/numbers.rst:117 msgid "" @@ -211,9 +210,8 @@ msgid "" "We want to implement the arithmetic operations so that mixed-mode operations " "either call an implementation whose author knew about the types of both " "arguments, or convert both to the nearest built in type and do the operation " -"there. For subtypes of :class:`Integral`, this means " -"that :meth:`~object.__add__` and :meth:`~object.__radd__` should be defined " -"as::" +"there. For subtypes of :class:`Integral`, this means that :meth:`~object." +"__add__` and :meth:`~object.__radd__` should be defined as::" msgstr "" "我們想要實作算術操作,來使得混合模式操作要麼呼叫一個作者知道兩個引數之型別的" "實作,要麼將其轉換成最接近的內建型別並執行這個操作。對於 :class:`Integral` 的" @@ -272,10 +270,10 @@ msgstr "" #: ../../library/numbers.rst:158 msgid "" -"There are 5 different cases for a mixed-type operation on subclasses " -"of :class:`Complex`. I'll refer to all of the above code that doesn't refer " -"to ``MyIntegral`` and ``OtherTypeIKnowAbout`` as \"boilerplate\". ``a`` will " -"be an instance of ``A``, which is a subtype of :class:`Complex` (``a : A <: " +"There are 5 different cases for a mixed-type operation on subclasses of :" +"class:`Complex`. I'll refer to all of the above code that doesn't refer to " +"``MyIntegral`` and ``OtherTypeIKnowAbout`` as \"boilerplate\". ``a`` will be " +"an instance of ``A``, which is a subtype of :class:`Complex` (``a : A <: " "Complex``), and ``b : B <: Complex``. I'll consider ``a + b``:" msgstr "" ":class:`Complex` 的子類別有 5 種不同的混合型別操作。我將上面提到所有不涉及 " @@ -293,9 +291,9 @@ msgstr "" msgid "" "If ``A`` falls back to the boilerplate code, and it were to return a value " "from :meth:`~object.__add__`, we'd miss the possibility that ``B`` defines a " -"more intelligent :meth:`~object.__radd__`, so the boilerplate should " -"return :data:`NotImplemented` from :meth:`!__add__`. (Or ``A`` may not " -"implement :meth:`!__add__` at all.)" +"more intelligent :meth:`~object.__radd__`, so the boilerplate should return :" +"data:`NotImplemented` from :meth:`!__add__`. (Or ``A`` may not implement :" +"meth:`!__add__` at all.)" msgstr "" "如果 ``A`` 回退成模板程式碼,它將回傳一個來自 :meth:`~object.__add__` 的值," "並喪失讓 ``B`` 定義一個更完善的 :meth:`~object.__radd__` 的機會,因此模板需要" @@ -330,24 +328,24 @@ msgstr "" #: ../../library/numbers.rst:183 msgid "" "If ``A <: Complex`` and ``B <: Real`` without sharing any other knowledge, " -"then the appropriate shared operation is the one involving the built " -"in :class:`complex`, and both :meth:`~object.__radd__` s land there, so " -"``a+b == b+a``." +"then the appropriate shared operation is the one involving the built in :" +"class:`complex`, and both :meth:`~object.__radd__` s land there, so ``a+b == " +"b+a``." msgstr "" "如果 ``A <: Complex`` 和 ``B <: Real`` 且沒有共享任何其他型別上的理解,那麼適" -"當的共享操作會涉及內建的 :class:`complex`,並且分別用" -"到 :meth:`~object.__radd__`,因此 ``a+b == b+a``。" +"當的共享操作會涉及內建的 :class:`complex`,並且分別用到 :meth:`~object." +"__radd__`,因此 ``a+b == b+a``。" #: ../../library/numbers.rst:188 msgid "" "Because most of the operations on any given type will be very similar, it " "can be useful to define a helper function which generates the forward and " -"reverse instances of any given operator. For " -"example, :class:`fractions.Fraction` uses::" +"reverse instances of any given operator. For example, :class:`fractions." +"Fraction` uses::" msgstr "" "由於大部分對任意給定類型的操作都十分相似的,定義一個為任意給定運算子生成向前 " -"(forward) 與向後 (reverse) 實例的輔助函式可能會非常有用。例" -"如,:class:`fractions.Fraction` 使用了: ::" +"(forward) 與向後 (reverse) 實例的輔助函式可能會非常有用。例如,:class:" +"`fractions.Fraction` 使用了: ::" #: ../../library/numbers.rst:193 msgid "" @@ -426,9 +424,3 @@ msgstr "" "__add__, __radd__ = _operator_fallbacks(_add, operator.add)\n" "\n" "# ..." - -#~ msgid "Abstract. The numerator of this rational number." -#~ msgstr "為抽象的。該有理數的分子。" - -#~ msgid "Abstract. The denominator of this rational number." -#~ msgstr "為抽象的。該有理數的分母。" diff --git a/library/optparse.po b/library/optparse.po index 42e4ab6d592..220f9352262 100644 --- a/library/optparse.po +++ b/library/optparse.po @@ -1581,7 +1581,7 @@ msgstr "" #: ../../library/optparse.rst:912 msgid "Creating the parser" -msgstr "" +msgstr "建立剖析器" #: ../../library/optparse.rst:914 msgid "" @@ -1624,11 +1624,11 @@ msgstr "" #: ../../library/optparse.rst:936 msgid "``option_class`` (default: optparse.Option)" -msgstr "" +msgstr "``option_class``\\ (預設值:optparse.Option)" #: ../../library/optparse.rst:937 msgid "Class to use when adding options to the parser in :meth:`add_option`." -msgstr "" +msgstr "在 :meth:`add_option` 中新增選項時要使用的類別。" #: ../../library/optparse.rst:939 msgid "``version`` (default: ``None``)" @@ -2049,7 +2049,7 @@ msgstr "" #: ../../library/optparse.rst:1206 msgid "Standard option actions" -msgstr "" +msgstr "標準選項動作" #: ../../library/optparse.rst:1208 msgid "" @@ -2083,7 +2083,7 @@ msgstr "" #: ../../library/optparse.rst:1226 msgid "If :attr:`~Option.type` is not supplied, it defaults to ``\"string\"``." -msgstr "" +msgstr "如果沒有提供 :attr:`~Option.type`,它的預設值是 ``\"string\"``。" #: ../../library/optparse.rst:1228 msgid "" @@ -2117,7 +2117,7 @@ msgstr "-f foo.txt -p 1 -3.5 4 -fbar.txt" #: ../../library/optparse.rst:1242 msgid ":mod:`optparse` will set ::" -msgstr "" +msgstr ":mod:`optparse` 將會設定: ::" #: ../../library/optparse.rst:1244 msgid "" @@ -2668,7 +2668,7 @@ msgstr "" #: ../../library/optparse.rst:1569 msgid "``\"error\"`` (default)" -msgstr "" +msgstr "``\"error\"`` (預設值)" #: ../../library/optparse.rst:1570 msgid "" diff --git a/library/os.po b/library/os.po index a882bc46b50..4b37ac7df91 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-09-22 00:18+0000\n" "PO-Revision-Date: 2024-04-29 15:24+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -512,7 +512,7 @@ msgstr "" #: ../../library/os.rst:281 msgid ":func:`fsdecode` is the reverse function." -msgstr "" +msgstr ":func:`fsdecode` 是反函式。" #: ../../library/os.rst:285 ../../library/os.rst:300 msgid "" @@ -528,7 +528,7 @@ msgstr "" #: ../../library/os.rst:296 msgid ":func:`fsencode` is the reverse function." -msgstr "" +msgstr ":func:`fsencode` 是反函式。" #: ../../library/os.rst:307 msgid "Return the file system representation of the path." @@ -2183,9 +2183,8 @@ msgid "" "functions in the :mod:`os` module must be a string specifying a file path. " "However, some functions now alternatively accept an open file descriptor for " "their *path* argument. The function will then operate on the file referred " -"to by the descriptor. (For POSIX systems, Python will call the variant of " -"the function prefixed with ``f`` (e.g. call ``fchdir`` instead of " -"``chdir``).)" +"to by the descriptor. For POSIX systems, Python will call the variant of the " +"function prefixed with ``f`` (e.g. call ``fchdir`` instead of ``chdir``)." msgstr "" #: ../../library/os.rst:2015 @@ -2207,7 +2206,7 @@ msgid "" "**paths relative to directory descriptors:** If *dir_fd* is not ``None``, it " "should be a file descriptor referring to a directory, and the path to " "operate on should be relative; path will then be relative to that " -"directory. If the path is absolute, *dir_fd* is ignored. (For POSIX " +"directory. If the path is absolute, *dir_fd* is ignored. For POSIX " "systems, Python will call the variant of the function with an ``at`` suffix " "and possibly prefixed with ``f`` (e.g. call ``faccessat`` instead of " "``access``)." @@ -2225,8 +2224,8 @@ msgid "" "**not following symlinks:** If *follow_symlinks* is ``False``, and the last " "element of the path to operate on is a symbolic link, the function will " "operate on the symbolic link itself rather than the file pointed to by the " -"link. (For POSIX systems, Python will call the ``l...`` variant of the " -"function.)" +"link. For POSIX systems, Python will call the ``l...`` variant of the " +"function." msgstr "" #: ../../library/os.rst:2044 @@ -3659,7 +3658,7 @@ msgstr "" #: ../../library/os.rst:3228 msgid "``st_birthtime`` is now available on Windows." -msgstr "" +msgstr "``st_birthtime`` 現在在 Windows 上可用。" #: ../../library/os.rst:3233 msgid "" diff --git a/library/pathlib.po b/library/pathlib.po index 293165e97a3..63bea451b4a 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -2081,6 +2081,17 @@ msgid "" "...\n" "directory" msgstr "" +">>> p = Path('src')\n" +">>> if p.info.is_symlink():\n" +"... print('symlink')\n" +"... elif p.info.is_dir():\n" +"... print('directory')\n" +"... elif p.info.exists():\n" +"... print('something else')\n" +"... else:\n" +"... print('not found')\n" +"...\n" +"directory" #: ../../library/pathlib.rst:1207 msgid "" diff --git a/library/pickle.po b/library/pickle.po index e13aa653175..fbabbf46b3c 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -2437,7 +2437,7 @@ msgstr "" #: ../../library/pickle.rst:1224 msgid "python -m pickle pickle_file [pickle_file ...]" -msgstr "" +msgstr "python -m pickle pickle_file [pickle_file ...]" #: ../../library/pickle.rst:1228 msgid "The following option is accepted:" diff --git a/library/platform.po b/library/platform.po index 7e2ed8e70b6..24e80e0681e 100644 --- a/library/platform.po +++ b/library/platform.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-09 05:11+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2022-06-11 14:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -88,8 +88,8 @@ msgid "" "To get at the \"64-bitness\" of the current interpreter, it is more reliable " "to query the :data:`sys.maxsize` attribute::" msgstr "" -"要取得目前直譯器的 \"64 位元性 (64-bitness)\",更可靠的做法是查" -"詢 :data:`sys.maxsize` 屬性: ::" +"要取得目前直譯器的 \"64 位元性 (64-bitness)\",更可靠的做法是查詢 :data:`sys." +"maxsize` 屬性: ::" #: ../../library/platform.rst:51 msgid "is_64bits = sys.maxsize > 2**32" @@ -101,7 +101,13 @@ msgid "" "the value cannot be determined." msgstr "回傳機器種類,例如 ``'AMD64'``。如果該值無法確定則會回傳一個空字串。" -#: ../../library/platform.rst:62 +#: ../../library/platform.rst:59 +msgid "" +"The output is platform-dependent and may differ in casing and naming " +"conventions." +msgstr "" + +#: ../../library/platform.rst:64 msgid "" "Returns the computer's network name (may not be fully qualified!). An empty " "string is returned if the value cannot be determined." @@ -109,13 +115,13 @@ msgstr "" "回傳電腦的網路名稱(可能不是完整名稱!)。如果該值無法確定則會回傳一個空字" "串。" -#: ../../library/platform.rst:68 +#: ../../library/platform.rst:70 msgid "" "Returns a single string identifying the underlying platform with as much " "useful information as possible." msgstr "會儘可能附帶有用資訊地回傳一個標識底層平臺的字串。" -#: ../../library/platform.rst:71 +#: ../../library/platform.rst:73 msgid "" "The output is intended to be *human readable* rather than machine parseable. " "It may look different on different platforms and this is intended." @@ -123,7 +129,7 @@ msgstr "" "輸出應為\\ *人類易讀的 (human readable)*,而非機器易剖析的 (machine " "parseable)。它在不同平臺上看起來可能不一致,這是有意為之的。" -#: ../../library/platform.rst:74 +#: ../../library/platform.rst:76 msgid "" "If *aliased* is true, the function will use aliases for various platforms " "that report system names which differ from their common names, for example " @@ -134,13 +140,13 @@ msgstr "" "稱,例如 SunOS 將被回報為 Solaris。:func:`system_alias` 函式被用於實作此功" "能。" -#: ../../library/platform.rst:79 +#: ../../library/platform.rst:81 msgid "" "Setting *terse* to true causes the function to return only the absolute " "minimum information needed to identify the platform." msgstr "將 *terse* 設為真值將導致此函式只回傳標識平臺所需的最小量資訊。" -#: ../../library/platform.rst:82 +#: ../../library/platform.rst:84 msgid "" "On macOS, the function now uses :func:`mac_ver`, if it returns a non-empty " "release string, to get the macOS version rather than the darwin version." @@ -148,11 +154,11 @@ msgstr "" "在 macOS 上,如果 :func:`mac_ver` 回傳的釋出版字串非空字串,此函式現在會使用" "它以取得 macOS 版本而非 darwin 版本。" -#: ../../library/platform.rst:90 +#: ../../library/platform.rst:92 msgid "Returns the (real) processor name, e.g. ``'amdk6'``." msgstr "回傳(真實的)處理器名稱,例如 ``'amdk6'``。" -#: ../../library/platform.rst:92 +#: ../../library/platform.rst:94 msgid "" "An empty string is returned if the value cannot be determined. Note that " "many platforms do not provide this information or simply return the same " @@ -161,7 +167,7 @@ msgstr "" "如果該值無法確定則將回傳空字串。請注意,許多平臺都不提供此資訊或是簡單地回傳" "與 :func:`machine` 相同的值。NetBSD 則會提供此資訊。" -#: ../../library/platform.rst:99 +#: ../../library/platform.rst:101 msgid "" "Returns a tuple ``(buildno, builddate)`` stating the Python build number and " "date as strings." @@ -169,15 +175,15 @@ msgstr "" "回傳一個 tuple ``(buildno, builddate)``,表示字串形式的 Python 建置編號和日" "期。" -#: ../../library/platform.rst:105 +#: ../../library/platform.rst:107 msgid "Returns a string identifying the compiler used for compiling Python." msgstr "回傳一個標識用於編譯 Python 的編譯器的字串。" -#: ../../library/platform.rst:110 +#: ../../library/platform.rst:112 msgid "Returns a string identifying the Python implementation SCM branch." msgstr "回傳一個標識 Python 實作 SCM 分支的字串。" -#: ../../library/platform.rst:115 +#: ../../library/platform.rst:117 msgid "" "Returns a string identifying the Python implementation. Possible return " "values are: 'CPython', 'IronPython', 'Jython', 'PyPy'." @@ -185,15 +191,15 @@ msgstr "" "回傳一個標識 Python 實作的字串。可能的回傳值" "有:'CPython'、'IronPython'、'Jython'、'PyPy'。" -#: ../../library/platform.rst:121 +#: ../../library/platform.rst:123 msgid "Returns a string identifying the Python implementation SCM revision." msgstr "回傳一個標識 Python 實作 SCM 修訂版的字串。" -#: ../../library/platform.rst:126 +#: ../../library/platform.rst:128 msgid "Returns the Python version as string ``'major.minor.patchlevel'``." msgstr "將 Python 版本以字串 ``'major.minor.patchlevel'`` 形式回傳。" -#: ../../library/platform.rst:128 +#: ../../library/platform.rst:130 msgid "" "Note that unlike the Python ``sys.version``, the returned value will always " "include the patchlevel (it defaults to 0)." @@ -201,13 +207,13 @@ msgstr "" "請注意此回傳值不同於 Python ``sys.version``,它總是會包括 patchlevel(預設為 " "``'0'``\\ )。" -#: ../../library/platform.rst:134 +#: ../../library/platform.rst:136 msgid "" "Returns the Python version as tuple ``(major, minor, patchlevel)`` of " "strings." msgstr "將 Python 版本以字串 tuple ``(major, minor, patchlevel)`` 形式回傳。" -#: ../../library/platform.rst:136 +#: ../../library/platform.rst:138 msgid "" "Note that unlike the Python ``sys.version``, the returned value will always " "include the patchlevel (it defaults to ``'0'``)." @@ -215,7 +221,7 @@ msgstr "" "請注意此回傳值不同於 Python ``sys.version``,它總是會包括 patchlevel(預設為 " "``'0'``\\ )。" -#: ../../library/platform.rst:142 +#: ../../library/platform.rst:144 msgid "" "Returns the system's release, e.g. ``'2.2.0'`` or ``'NT'``. An empty string " "is returned if the value cannot be determined." @@ -223,7 +229,7 @@ msgstr "" "回傳系統的釋出版本,例如 ``'2.2.0'`` 或 ``'NT'``,如果該值無法確定則將回傳一" "個空字串。" -#: ../../library/platform.rst:148 +#: ../../library/platform.rst:150 msgid "" "Returns the system/OS name, such as ``'Linux'``, ``'Darwin'``, ``'Java'``, " "``'Windows'``. An empty string is returned if the value cannot be determined." @@ -231,14 +237,14 @@ msgstr "" "回傳系統/OS 的名稱,例如 ``'Linux'``、``'Darwin'``、``'Java'``、" "``'Windows'``。如果該值無法確定則回傳一個空字串。" -#: ../../library/platform.rst:151 +#: ../../library/platform.rst:153 msgid "" "On iOS and Android, this returns the user-facing OS name (i.e, ``'iOS``, " "``'iPadOS'`` or ``'Android'``). To obtain the kernel name (``'Darwin'`` or " "``'Linux'``), use :func:`os.uname`." msgstr "" -#: ../../library/platform.rst:157 +#: ../../library/platform.rst:159 msgid "" "Returns ``(system, release, version)`` aliased to common marketing names " "used for some systems. It also does some reordering of the information in " @@ -247,7 +253,7 @@ msgstr "" "回傳做為某些系統所使用的常見行銷名稱之別名的 ``(system, release, version)``。" "它還會在可能導致混淆的情況下對資訊進行一些重新排序。" -#: ../../library/platform.rst:164 +#: ../../library/platform.rst:166 msgid "" "Returns the system's release version, e.g. ``'#3 on degas'``. An empty " "string is returned if the value cannot be determined." @@ -255,64 +261,62 @@ msgstr "" "回傳系統的釋出版本資訊,例如 ``'#3 on degas'``。如果該值無法確定則將回傳一個" "空字串。" -#: ../../library/platform.rst:167 +#: ../../library/platform.rst:169 msgid "" "On iOS and Android, this is the user-facing OS version. To obtain the Darwin " "or Linux kernel version, use :func:`os.uname`." msgstr "" -#: ../../library/platform.rst:172 +#: ../../library/platform.rst:174 msgid "" "Fairly portable uname interface. Returns a :func:`~collections.namedtuple` " -"containing six " -"attributes: :attr:`system`, :attr:`node`, :attr:`release`, :attr:`version`, :attr:`machine`, " -"and :attr:`processor`." +"containing six attributes: :attr:`system`, :attr:`node`, :attr:`release`, :" +"attr:`version`, :attr:`machine`, and :attr:`processor`." msgstr "" -"具有高可攜性 (portable) 的 uname 介面。回傳包含六個屬性" -"的 :func:`~collections.namedtuple`::attr:`system`、:attr:`node`、:attr:`release`、:attr:`version`、:attr:`machine` " -"和 :attr:`processor`。" +"具有高可攜性 (portable) 的 uname 介面。回傳包含六個屬性的 :func:" +"`~collections.namedtuple`::attr:`system`、:attr:`node`、:attr:`release`、:" +"attr:`version`、:attr:`machine` 和 :attr:`processor`。" -#: ../../library/platform.rst:176 +#: ../../library/platform.rst:178 msgid ":attr:`processor` is resolved late, on demand." msgstr ":attr:`processor` 會延遲解析,有需求時才會解析" -#: ../../library/platform.rst:178 +#: ../../library/platform.rst:180 msgid "" -"Note: the first two attribute names differ from the names presented " -"by :func:`os.uname`, where they are named :attr:`!sysname` and :attr:`!" -"nodename`." +"Note: the first two attribute names differ from the names presented by :func:" +"`os.uname`, where they are named :attr:`!sysname` and :attr:`!nodename`." msgstr "" -"注意:前兩個屬性名稱與 :func:`os.uname` 提供的名稱不同,它們分別命名" -"為 :attr:`!sysname` 和 :attr:`!nodename`。" +"注意:前兩個屬性名稱與 :func:`os.uname` 提供的名稱不同,它們分別命名為 :attr:" +"`!sysname` 和 :attr:`!nodename`。" -#: ../../library/platform.rst:182 +#: ../../library/platform.rst:184 msgid "Entries which cannot be determined are set to ``''``." msgstr "無法確定的條目會被設為 ``''``。" -#: ../../library/platform.rst:184 +#: ../../library/platform.rst:186 msgid "Result changed from a tuple to a :func:`~collections.namedtuple`." msgstr "將結果從 tuple 改為 :func:`~collections.namedtuple`。" -#: ../../library/platform.rst:187 +#: ../../library/platform.rst:189 msgid ":attr:`processor` is resolved late instead of immediately." msgstr ":attr:`processor` 會延遲解析,並非立即解析。" -#: ../../library/platform.rst:192 +#: ../../library/platform.rst:194 msgid "" "Clear out the internal cache of information, such as the :func:`uname`. This " "is typically useful when the platform's :func:`node` is changed by an " "external process and one needs to retrieve the updated value." msgstr "" -#: ../../library/platform.rst:200 +#: ../../library/platform.rst:202 msgid "Java platform" msgstr "Java 平台" -#: ../../library/platform.rst:205 +#: ../../library/platform.rst:207 msgid "Version interface for Jython." msgstr "Jython 的版本介面。" -#: ../../library/platform.rst:207 +#: ../../library/platform.rst:209 msgid "" "Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a " "tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple " @@ -324,17 +328,17 @@ msgstr "" "os_version, os_arch)``。無法確定的值將被設為由參數所給定的預設值(預設均為 " "``''``\\ )。" -#: ../../library/platform.rst:212 +#: ../../library/platform.rst:214 msgid "" "It was largely untested, had a confusing API, and was only useful for Jython " "support." msgstr "" -#: ../../library/platform.rst:218 +#: ../../library/platform.rst:220 msgid "Windows platform" msgstr "Windows 平台" -#: ../../library/platform.rst:223 +#: ../../library/platform.rst:225 msgid "" "Get additional version information from the Windows Registry and return a " "tuple ``(release, version, csd, ptype)`` referring to OS release, version " @@ -346,20 +350,20 @@ msgstr "" "``(release, version, csd, ptype)``,它代表 OS 發行版、版本號、CSD 級別 " "(service pack) 和 OS 類型(多個/單個處理器)。" -#: ../../library/platform.rst:229 +#: ../../library/platform.rst:231 msgid "" "As a hint: *ptype* is ``'Uniprocessor Free'`` on single processor NT " "machines and ``'Multiprocessor Free'`` on multi processor machines. The " "``'Free'`` refers to the OS version being free of debugging code. It could " -"also state ``'Checked'`` which means the OS version uses debugging code, " -"i.e. code that checks arguments, ranges, etc." +"also state ``'Checked'`` which means the OS version uses debugging code, i." +"e. code that checks arguments, ranges, etc." msgstr "" "一點提示:*ptype* 在單個處理器的 NT 機器上為 ``'Uniprocessor Free'``,而在多" "個處理器的機器上為 ``'Multiprocessor Free'``。``'Free'`` 是指該 OS 版本沒有除" "錯程式。它也可能以 ``'Checked'`` 表示,代表該 OS 版本使用了除錯程式,即檢查引" "數、範圍等的程式。" -#: ../../library/platform.rst:237 +#: ../../library/platform.rst:239 msgid "" "Returns a string representing the current Windows edition, or ``None`` if " "the value cannot be determined. Possible values include but are not limited " @@ -369,7 +373,7 @@ msgstr "" "回傳一個代表目前 Windows 版本的字串。可能的值包括但不限於 ``'Enterprise'``、" "``'IoTUAP'``、``'ServerStandard'`` 和 ``'nanoserver'``。" -#: ../../library/platform.rst:245 +#: ../../library/platform.rst:247 msgid "" "Return ``True`` if the Windows edition returned by :func:`win32_edition` is " "recognized as an IoT edition." @@ -377,11 +381,11 @@ msgstr "" "如果 :func:`win32_edition` 回傳的 Windows 版本被識別為 IoT 版則回傳 " "``True``。" -#: ../../library/platform.rst:252 +#: ../../library/platform.rst:254 msgid "macOS platform" msgstr "macOS 平台" -#: ../../library/platform.rst:256 +#: ../../library/platform.rst:258 msgid "" "Get macOS version information and return it as tuple ``(release, " "versioninfo, machine)`` with *versioninfo* being a tuple ``(version, " @@ -391,53 +395,53 @@ msgstr "" "其中 *versioninfo* 是一個 tuple ``(version, dev_stage, " "non_release_version)``。" -#: ../../library/platform.rst:260 +#: ../../library/platform.rst:262 msgid "" "Entries which cannot be determined are set to ``''``. All tuple entries are " "strings." msgstr "無法確定的條目會被設為 ``''``。所有 tuple 條目均為字串。" -#: ../../library/platform.rst:264 +#: ../../library/platform.rst:266 msgid "iOS platform" msgstr "iOS 平台" -#: ../../library/platform.rst:268 +#: ../../library/platform.rst:270 msgid "" -"Get iOS version information and return it as " -"a :func:`~collections.namedtuple` with the following attributes:" +"Get iOS version information and return it as a :func:`~collections." +"namedtuple` with the following attributes:" msgstr "" -#: ../../library/platform.rst:271 +#: ../../library/platform.rst:273 msgid "``system`` is the OS name; either ``'iOS'`` or ``'iPadOS'``." msgstr "``system`` 是 OS 名稱;可能是 ``'iOS'`` 或 ``'iPadOS'``。" -#: ../../library/platform.rst:272 +#: ../../library/platform.rst:274 msgid "``release`` is the iOS version number as a string (e.g., ``'17.2'``)." msgstr "" -#: ../../library/platform.rst:273 +#: ../../library/platform.rst:275 msgid "" "``model`` is the device model identifier; this will be a string like " "``'iPhone13,2'`` for a physical device, or ``'iPhone'`` on a simulator." msgstr "" -#: ../../library/platform.rst:275 +#: ../../library/platform.rst:277 msgid "" "``is_simulator`` is a boolean describing if the app is running on a " "simulator or a physical device." msgstr "" -#: ../../library/platform.rst:278 +#: ../../library/platform.rst:280 msgid "" "Entries which cannot be determined are set to the defaults given as " "parameters." msgstr "無法確定的條目會被設定為以參數給定的預設值。" -#: ../../library/platform.rst:283 +#: ../../library/platform.rst:285 msgid "Unix platforms" msgstr "Unix 平台" -#: ../../library/platform.rst:287 +#: ../../library/platform.rst:289 msgid "" "Tries to determine the libc version against which the file executable " "(defaults to the Python interpreter) is linked. Returns a tuple of strings " @@ -447,7 +451,7 @@ msgstr "" "嘗試確認可執行檔案(預設為 Python 直譯器)所連結到的 libc 版本。回傳一個字串 " "tuple ``(lib, version)``,當查詢失敗時其預設值將被設為給定的參數值。" -#: ../../library/platform.rst:291 +#: ../../library/platform.rst:293 msgid "" "Note that this function has intimate knowledge of how different libc " "versions add symbols to the executable is probably only usable for " @@ -456,15 +460,15 @@ msgstr "" "請注意,此函式對於不同 libc 版本如何為可執行檔案新增符號的方式有深層的關聯," "可能僅適用於以 :program:`gcc` 編譯出來的可執行檔案。" -#: ../../library/platform.rst:295 +#: ../../library/platform.rst:297 msgid "The file is read and scanned in chunks of *chunksize* bytes." msgstr "檔案會以 *chunksize* 位元組大小的分塊 (chunk) 來讀取和掃描。" -#: ../../library/platform.rst:299 +#: ../../library/platform.rst:301 msgid "Linux platforms" msgstr "Linux 平台" -#: ../../library/platform.rst:303 +#: ../../library/platform.rst:305 msgid "" "Get operating system identification from ``os-release`` file and return it " "as a dict. The ``os-release`` file is a `freedesktop.org standard `_、並在大多數 Linux 發行版上可用。一個重要的例外" "是 Android 和基於 Android 的發行版。" -#: ../../library/platform.rst:309 +#: ../../library/platform.rst:311 msgid "" "Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor ``/" "usr/lib/os-release`` can be read." msgstr "" -"當 ``/etc/os-release`` 與 ``/usr/lib/os-release`` 均無法被讀取時將引" -"發 :exc:`OSError` 或其子類別。" +"當 ``/etc/os-release`` 與 ``/usr/lib/os-release`` 均無法被讀取時將引發 :exc:" +"`OSError` 或其子類別。" -#: ../../library/platform.rst:312 +#: ../../library/platform.rst:314 msgid "" "On success, the function returns a dictionary where keys and values are " "strings. Values have their special characters like ``\"`` and ``$`` " @@ -498,7 +502,7 @@ msgstr "" "``PRETTY_NAME`` 總會按照標準來定義。所有其他欄位都是可選的。根據不同廠商可能" "會包括額外的欄位。" -#: ../../library/platform.rst:318 +#: ../../library/platform.rst:320 msgid "" "Note that fields like ``NAME``, ``VERSION``, and ``VARIANT`` are strings " "suitable for presentation to users. Programs should use fields like ``ID``, " @@ -509,11 +513,11 @@ msgstr "" "串。程式應當使用 ``ID``、``ID_LIKE``、``VERSION_ID`` 或 ``VARIANT_ID`` 等欄位" "來標識 Linux 發行版。" -#: ../../library/platform.rst:323 +#: ../../library/platform.rst:325 msgid "Example::" msgstr "範例: ::" -#: ../../library/platform.rst:325 +#: ../../library/platform.rst:327 msgid "" "def get_like_distro():\n" " info = platform.freedesktop_os_release()\n" @@ -524,95 +528,92 @@ msgid "" " return ids" msgstr "" -#: ../../library/platform.rst:337 +#: ../../library/platform.rst:339 msgid "Android platform" msgstr "Android 平台" -#: ../../library/platform.rst:342 +#: ../../library/platform.rst:344 msgid "" "Get Android device information. Returns a :func:`~collections.namedtuple` " "with the following attributes. Values which cannot be determined are set to " "the defaults given as parameters." msgstr "" -#: ../../library/platform.rst:346 +#: ../../library/platform.rst:348 msgid "``release`` - Android version, as a string (e.g. ``\"14\"``)." msgstr "" -#: ../../library/platform.rst:348 +#: ../../library/platform.rst:350 msgid "" "``api_level`` - API level of the running device, as an integer (e.g. ``34`` " -"for Android 14). To get the API level which Python was built against, " -"see :func:`sys.getandroidapilevel`." +"for Android 14). To get the API level which Python was built against, see :" +"func:`sys.getandroidapilevel`." msgstr "" -#: ../../library/platform.rst:352 +#: ../../library/platform.rst:354 msgid "" "``manufacturer`` - `Manufacturer name `__." msgstr "" -#: ../../library/platform.rst:355 +#: ../../library/platform.rst:357 msgid "" "``model`` - `Model name `__ – typically the marketing name or model number." msgstr "" -#: ../../library/platform.rst:359 +#: ../../library/platform.rst:361 msgid "" "``device`` - `Device name `__ – typically the model number or a codename." msgstr "" -#: ../../library/platform.rst:363 +#: ../../library/platform.rst:365 msgid "" "``is_emulator`` - ``True`` if the device is an emulator; ``False`` if it's a " "physical device." msgstr "" -#: ../../library/platform.rst:366 +#: ../../library/platform.rst:368 msgid "" -"Google maintains a `list of known model and device names `__." +"Google maintains a `list of known model and device names `__." msgstr "" -#: ../../library/platform.rst:374 +#: ../../library/platform.rst:376 msgid "Command-line usage" msgstr "命令列用法" -#: ../../library/platform.rst:376 +#: ../../library/platform.rst:378 msgid "" ":mod:`platform` can also be invoked directly using the :option:`-m` switch " "of the interpreter::" msgstr "" -#: ../../library/platform.rst:379 +#: ../../library/platform.rst:381 msgid "python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]" msgstr "python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]" -#: ../../library/platform.rst:381 +#: ../../library/platform.rst:383 msgid "The following options are accepted:" msgstr "可接受以下選項:" -#: ../../library/platform.rst:387 +#: ../../library/platform.rst:389 msgid "" -"Print terse information about the platform. This is equivalent to " -"calling :func:`platform.platform` with the *terse* argument set to ``True``." +"Print terse information about the platform. This is equivalent to calling :" +"func:`platform.platform` with the *terse* argument set to ``True``." msgstr "" -#: ../../library/platform.rst:392 +#: ../../library/platform.rst:394 msgid "" "Print platform information without system/OS name aliasing. This is " "equivalent to calling :func:`platform.platform` with the *aliased* argument " "set to ``True``." msgstr "" -#: ../../library/platform.rst:396 +#: ../../library/platform.rst:398 msgid "" "You can also pass one or more positional arguments (``terse``, " "``nonaliased``) to explicitly control the output format. These behave " "similarly to their corresponding options." msgstr "" - -#~ msgid "Miscellaneous" -#~ msgstr "雜項" diff --git a/library/plistlib.po b/library/plistlib.po index 7525bc142c7..025b7f64919 100644 --- a/library/plistlib.po +++ b/library/plistlib.po @@ -98,15 +98,15 @@ msgstr "" #: ../../library/plistlib.rst:63 msgid ":data:`None`: Autodetect the file format" -msgstr "" +msgstr ":data:`None`:自動偵測檔案格式" #: ../../library/plistlib.rst:65 msgid ":data:`FMT_XML`: XML file format" -msgstr "" +msgstr ":data:`FMT_XML`:XML 檔案格式" #: ../../library/plistlib.rst:67 msgid ":data:`FMT_BINARY`: Binary plist format" -msgstr "" +msgstr ":data:`FMT_BINARY`:二進位 plist 格式" #: ../../library/plistlib.rst:69 msgid "" diff --git a/library/pprint.po b/library/pprint.po index 7a0e5fc47a3..324d72d73af 100644 --- a/library/pprint.po +++ b/library/pprint.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-15 00:14+0000\n" +"POT-Creation-Date: 2025-10-13 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,22 +43,18 @@ msgid "" msgstr "" #: ../../library/pprint.rst:25 -msgid "Dictionaries are sorted by key before the display is computed." -msgstr "" - -#: ../../library/pprint.rst:27 msgid "Added support for pretty-printing :class:`types.SimpleNamespace`." msgstr "" -#: ../../library/pprint.rst:30 +#: ../../library/pprint.rst:28 msgid "Added support for pretty-printing :class:`dataclasses.dataclass`." msgstr "" -#: ../../library/pprint.rst:36 +#: ../../library/pprint.rst:34 msgid "Functions" msgstr "函式" -#: ../../library/pprint.rst:41 +#: ../../library/pprint.rst:39 msgid "" "Prints the formatted representation of *object*, followed by a newline. This " "function may be used in the interactive interpreter instead of the :func:" @@ -70,28 +66,28 @@ msgstr "" msgid "Parameters" msgstr "參數" -#: ../../library/pprint.rst:46 +#: ../../library/pprint.rst:44 msgid "The object to be printed." msgstr "將被印出的物件。" -#: ../../library/pprint.rst:49 +#: ../../library/pprint.rst:47 msgid "" "A file-like object to which the output will be written by calling its :meth:" "`!write` method. If ``None`` (the default), :data:`sys.stdout` is used." msgstr "" -#: ../../library/pprint.rst:55 +#: ../../library/pprint.rst:53 msgid "The amount of indentation added for each nesting level." msgstr "" -#: ../../library/pprint.rst:58 +#: ../../library/pprint.rst:56 msgid "" "The desired maximum number of characters per line in the output. If a " "structure cannot be formatted within the width constraint, a best effort " "will be made." msgstr "" -#: ../../library/pprint.rst:63 +#: ../../library/pprint.rst:61 msgid "" "The number of nesting levels which may be printed. If the data structure " "being printed is too deep, the next contained level is replaced by ``...``. " @@ -99,7 +95,7 @@ msgid "" "objects being formatted." msgstr "" -#: ../../library/pprint.rst:71 +#: ../../library/pprint.rst:69 msgid "" "Control the way long :term:`sequences ` are formatted. If " "``False`` (the default), each item of a sequence will be formatted on a " @@ -107,26 +103,26 @@ msgid "" "be formatted on each output line." msgstr "" -#: ../../library/pprint.rst:78 +#: ../../library/pprint.rst:76 msgid "" "If ``True``, dictionaries will be formatted with their keys sorted, " "otherwise they will be displayed in insertion order (the default)." msgstr "" -#: ../../library/pprint.rst:83 +#: ../../library/pprint.rst:81 msgid "" "If ``True``, integers will be formatted with the ``_`` character for a " "thousands separator, otherwise underscores are not displayed (the default)." msgstr "" -#: ../../library/pprint.rst:105 +#: ../../library/pprint.rst:103 msgid "" "Alias for :func:`~pprint.pp` with *sort_dicts* set to ``True`` by default, " "which would automatically sort the dictionaries' keys, you might want to " "use :func:`~pprint.pp` instead where it is ``False`` by default." msgstr "" -#: ../../library/pprint.rst:113 +#: ../../library/pprint.rst:111 msgid "" "Return the formatted representation of *object* as a string. *indent*, " "*width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* are " @@ -134,21 +130,21 @@ msgid "" "and their meanings are as described in the documentation above." msgstr "" -#: ../../library/pprint.rst:123 +#: ../../library/pprint.rst:121 msgid "" "Determine if the formatted representation of *object* is \"readable\", or " "can be used to reconstruct the value using :func:`eval`. This always " "returns ``False`` for recursive objects." msgstr "" -#: ../../library/pprint.rst:133 +#: ../../library/pprint.rst:131 msgid "" "Determine if *object* requires a recursive representation. This function is " "subject to the same limitations as noted in :func:`saferepr` below and may " "raise an :exc:`RecursionError` if it fails to detect a recursive object." msgstr "" -#: ../../library/pprint.rst:140 +#: ../../library/pprint.rst:138 msgid "" "Return a string representation of *object*, protected against recursion in " "some common data structures, namely instances of :class:`dict`, :class:" @@ -158,53 +154,53 @@ msgid "" "id=number>``. The representation is not otherwise formatted." msgstr "" -#: ../../library/pprint.rst:153 +#: ../../library/pprint.rst:151 msgid "PrettyPrinter Objects" msgstr "PrettyPrinter 物件" -#: ../../library/pprint.rst:160 +#: ../../library/pprint.rst:158 msgid "Construct a :class:`PrettyPrinter` instance." msgstr "建立一個 :class:`PrettyPrinter` 實例。" -#: ../../library/pprint.rst:162 +#: ../../library/pprint.rst:160 msgid "" "Arguments have the same meaning as for :func:`~pprint.pp`. Note that they " "are in a different order, and that *sort_dicts* defaults to ``True``." msgstr "" -#: ../../library/pprint.rst:189 +#: ../../library/pprint.rst:187 msgid "Added the *compact* parameter." msgstr "新增 *compact* 參數。" -#: ../../library/pprint.rst:192 +#: ../../library/pprint.rst:190 msgid "Added the *sort_dicts* parameter." msgstr "新增 *sort_dicts* 參數。" -#: ../../library/pprint.rst:195 +#: ../../library/pprint.rst:193 msgid "Added the *underscore_numbers* parameter." msgstr "新增 *underscore_numbers* 參數。" -#: ../../library/pprint.rst:198 +#: ../../library/pprint.rst:196 msgid "No longer attempts to write to :data:`!sys.stdout` if it is ``None``." msgstr "" -#: ../../library/pprint.rst:202 +#: ../../library/pprint.rst:200 msgid ":class:`PrettyPrinter` instances have the following methods:" msgstr ":class:`PrettyPrinter` 實例有以下方法:" -#: ../../library/pprint.rst:207 +#: ../../library/pprint.rst:205 msgid "" "Return the formatted representation of *object*. This takes into account " "the options passed to the :class:`PrettyPrinter` constructor." msgstr "" -#: ../../library/pprint.rst:213 +#: ../../library/pprint.rst:211 msgid "" "Print the formatted representation of *object* on the configured stream, " "followed by a newline." msgstr "" -#: ../../library/pprint.rst:216 +#: ../../library/pprint.rst:214 msgid "" "The following methods provide the implementations for the corresponding " "functions of the same names. Using these methods on an instance is slightly " @@ -212,7 +208,7 @@ msgid "" "created." msgstr "" -#: ../../library/pprint.rst:226 +#: ../../library/pprint.rst:224 msgid "" "Determine if the formatted representation of the object is \"readable,\" or " "can be used to reconstruct the value using :func:`eval`. Note that this " @@ -221,18 +217,18 @@ msgid "" "returns ``False``." msgstr "" -#: ../../library/pprint.rst:235 +#: ../../library/pprint.rst:233 msgid "Determine if the object requires a recursive representation." msgstr "" -#: ../../library/pprint.rst:237 +#: ../../library/pprint.rst:235 msgid "" "This method is provided as a hook to allow subclasses to modify the way " "objects are converted to strings. The default implementation uses the " "internals of the :func:`saferepr` implementation." msgstr "" -#: ../../library/pprint.rst:244 +#: ../../library/pprint.rst:242 msgid "" "Returns three values: the formatted version of *object* as a string, a flag " "indicating whether the result is readable, and a flag indicating whether " @@ -250,18 +246,18 @@ msgid "" "of the current call." msgstr "" -#: ../../library/pprint.rst:262 +#: ../../library/pprint.rst:260 msgid "Example" msgstr "範例" -#: ../../library/pprint.rst:264 +#: ../../library/pprint.rst:262 msgid "" "To demonstrate several uses of the :func:`~pprint.pp` function and its " "parameters, let's fetch information about a project from `PyPI `_::" msgstr "" -#: ../../library/pprint.rst:267 +#: ../../library/pprint.rst:265 msgid "" ">>> import json\n" ">>> import pprint\n" @@ -275,11 +271,11 @@ msgstr "" ">>> with urlopen('https://pypi.org/pypi/sampleproject/1.2.0/json') as resp:\n" "... project_info = json.load(resp)['info']" -#: ../../library/pprint.rst:273 +#: ../../library/pprint.rst:271 msgid "In its basic form, :func:`~pprint.pp` shows the whole object::" msgstr "" -#: ../../library/pprint.rst:275 +#: ../../library/pprint.rst:273 msgid "" ">>> pprint.pp(project_info)\n" "{'author': 'The Python Packaging Authority',\n" @@ -395,13 +391,13 @@ msgstr "" " 'summary': 'A sample Python project',\n" " 'version': '1.2.0'}" -#: ../../library/pprint.rst:329 +#: ../../library/pprint.rst:327 msgid "" "The result can be limited to a certain *depth* (ellipsis is used for deeper " "contents)::" msgstr "" -#: ../../library/pprint.rst:332 +#: ../../library/pprint.rst:330 msgid "" ">>> pprint.pp(project_info, depth=1)\n" "{'author': 'The Python Packaging Authority',\n" @@ -495,13 +491,13 @@ msgstr "" " 'summary': 'A sample Python project',\n" " 'version': '1.2.0'}" -#: ../../library/pprint.rst:375 +#: ../../library/pprint.rst:373 msgid "" "Additionally, maximum character *width* can be suggested. If a long object " "cannot be split, the specified width will be exceeded::" msgstr "" -#: ../../library/pprint.rst:378 +#: ../../library/pprint.rst:376 msgid "" ">>> pprint.pp(project_info, depth=1, width=60)\n" "{'author': 'The Python Packaging Authority',\n" @@ -595,18 +591,18 @@ msgstr "" " 'summary': 'A sample Python project',\n" " 'version': '1.2.0'}" -#: ../../library/pprint.rst:121 ../../library/pprint.rst:224 +#: ../../library/pprint.rst:119 ../../library/pprint.rst:222 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/pprint.rst:121 ../../library/pprint.rst:224 +#: ../../library/pprint.rst:119 ../../library/pprint.rst:222 msgid "eval" msgstr "eval" -#: ../../library/pprint.rst:155 +#: ../../library/pprint.rst:153 msgid "..." msgstr "..." -#: ../../library/pprint.rst:155 +#: ../../library/pprint.rst:153 msgid "placeholder" msgstr "placeholder(佔位符號)" diff --git a/library/queue.po b/library/queue.po index 37d2064deae..434dd0f2021 100644 --- a/library/queue.po +++ b/library/queue.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2022-09-27 00:12+0800\n" "Last-Translator: Allen Wu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,11 +50,11 @@ msgid "" "kept sorted (using the :mod:`heapq` module) and the lowest valued entry is " "retrieved first." msgstr "" -"此 module 實作三種型別的佇列,它們僅在取出條目的順序上有所不同。" -"在 :abbr:`FIFO (first-in, first-out)` 佇列中,先加入的任務是第一個被取出的。" -"在 :abbr:`LIFO (last-in, first-out)` 佇列中,最近被加入的條目是第一個被取出的" -"(像堆疊 (stack) 一樣操作)。使用優先佇列 (priority queue) 時,條目將保持排序" -"狀態(使用 :mod:`heapq` module),並先取出最低值條目。" +"此 module 實作三種型別的佇列,它們僅在取出條目的順序上有所不同。在 :abbr:" +"`FIFO (first-in, first-out)` 佇列中,先加入的任務是第一個被取出的。在 :abbr:" +"`LIFO (last-in, first-out)` 佇列中,最近被加入的條目是第一個被取出的(像堆疊 " +"(stack) 一樣操作)。使用優先佇列 (priority queue) 時,條目將保持排序狀態(使" +"用 :mod:`heapq` module),並先取出最低值條目。" #: ../../library/queue.rst:24 msgid "" @@ -159,30 +159,27 @@ msgstr "" #: ../../library/queue.rst:84 msgid "" -"Exception raised when non-blocking :meth:`~Queue.get` " -"(or :meth:`~Queue.get_nowait`) is called on a :class:`Queue` object which is " -"empty." +"Exception raised when non-blocking :meth:`~Queue.get` (or :meth:`~Queue." +"get_nowait`) is called on a :class:`Queue` object which is empty." msgstr "" -"當對一個空的 :class:`Queue` 物件呼叫非阻塞的 (non-" -"blocking) :meth:`~Queue.get`\\ (或 :meth:`~Queue.get_nowait`\\ )將引發此例" -"外。" +"當對一個空的 :class:`Queue` 物件呼叫非阻塞的 (non-blocking) :meth:`~Queue." +"get`\\ (或 :meth:`~Queue.get_nowait`\\ )將引發此例外。" #: ../../library/queue.rst:91 msgid "" -"Exception raised when non-blocking :meth:`~Queue.put` " -"(or :meth:`~Queue.put_nowait`) is called on a :class:`Queue` object which is " -"full." +"Exception raised when non-blocking :meth:`~Queue.put` (or :meth:`~Queue." +"put_nowait`) is called on a :class:`Queue` object which is full." msgstr "" -"當對一個已滿的 :class:`Queue` 物件呼叫非阻塞的 :meth:`~Queue.put`\\ " -"(或 :meth:`~Queue.put_nowait`\\ )將引發此例外。" +"當對一個已滿的 :class:`Queue` 物件呼叫非阻塞的 :meth:`~Queue.put`\\ (或 :" +"meth:`~Queue.put_nowait`\\ )將引發此例外。" #: ../../library/queue.rst:98 msgid "" "Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " "a :class:`Queue` object which has been shut down." msgstr "" -"當對一個已關閉的 :class:`Queue` 物件呼叫 :meth:`~Queue.put` " -"或 :meth:`~Queue.get` 時將引發此例外。" +"當對一個已關閉的 :class:`Queue` 物件呼叫 :meth:`~Queue.put` 或 :meth:`~Queue." +"get` 時將引發此例外。" #: ../../library/queue.rst:107 msgid "Queue Objects" @@ -190,8 +187,8 @@ msgstr "佇列物件" #: ../../library/queue.rst:109 msgid "" -"Queue objects (:class:`Queue`, :class:`LifoQueue`, " -"or :class:`PriorityQueue`) provide the public methods described below." +"Queue objects (:class:`Queue`, :class:`LifoQueue`, or :class:" +"`PriorityQueue`) provide the public methods described below." msgstr "" "佇列物件(:class:`Queue`、:class:`LifoQueue`、:class:`PriorityQueue`)提供下" "面描述的公用 method。" @@ -251,7 +248,7 @@ msgstr "如果佇列已被關閉,則引發 :exc:`ShutDown`。" msgid "Equivalent to ``put(item, block=False)``." msgstr "等效於 ``put(item, block=False)``。" -#: ../../library/queue.rst:156 ../../library/queue.rst:297 +#: ../../library/queue.rst:156 ../../library/queue.rst:313 msgid "" "Remove and return an item from the queue. If optional args *block* is true " "and *timeout* is ``None`` (the default), block if necessary until an item is " @@ -263,17 +260,17 @@ msgid "" msgstr "" "從佇列中移除並回傳一個項目。如果可選的 args *block* 為 true,且 *timeout* 為 " "``None``\\ (預設值),則在必要時阻塞,直到有可用的項目。如果 *timeout* 是正" -"數,則最多會阻塞 *timeout* 秒,如果該時間內沒有可用的項目,則會引" -"發 :exc:`Empty` 例外。否則(*block* 為 false),如果立即可用,則回傳一個項" -"目,否則引發 :exc:`Empty` 例外(在這種情況下,*timeout* 將被忽略)。" +"數,則最多會阻塞 *timeout* 秒,如果該時間內沒有可用的項目,則會引發 :exc:" +"`Empty` 例外。否則(*block* 為 false),如果立即可用,則回傳一個項目,否則引" +"發 :exc:`Empty` 例外(在這種情況下,*timeout* 將被忽略)。" #: ../../library/queue.rst:163 msgid "" "Prior to 3.0 on POSIX systems, and for all versions on Windows, if *block* " "is true and *timeout* is ``None``, this operation goes into an " "uninterruptible wait on an underlying lock. This means that no exceptions " -"can occur, and in particular a SIGINT will not trigger " -"a :exc:`KeyboardInterrupt`." +"can occur, and in particular a SIGINT will not trigger a :exc:" +"`KeyboardInterrupt`." msgstr "" "在 POSIX 系統的 3.0 版之前,以及 Windows 的所有版本,如果 *block* 為 true 且 " "*timeout* 為 ``None``,則此操作將在底層鎖上進入不間斷等待。這意味著不會發生例" @@ -285,7 +282,7 @@ msgid "" "the queue has been shut down immediately." msgstr "如果佇列已被關閉且為空,或佇列已立即關閉,則引發 :exc:`ShutDown`。" -#: ../../library/queue.rst:174 ../../library/queue.rst:307 +#: ../../library/queue.rst:174 ../../library/queue.rst:323 msgid "Equivalent to ``get(False)``." msgstr "等效於 ``get(False)``。" @@ -300,9 +297,8 @@ msgstr "" #: ../../library/queue.rst:182 msgid "" "Indicate that a formerly enqueued task is complete. Used by queue consumer " -"threads. For each :meth:`get` used to fetch a task, a subsequent call " -"to :meth:`task_done` tells the queue that the processing on the task is " -"complete." +"threads. For each :meth:`get` used to fetch a task, a subsequent call to :" +"meth:`task_done` tells the queue that the processing on the task is complete." msgstr "" "表示先前放入佇列的任務已完成。由佇列消費者執行緒使用。對於用來提取任務的每" "個 :meth:`get`,隨後呼叫 :meth:`task_done` 告訴佇列任務的處理已完成。" @@ -313,36 +309,34 @@ msgid "" "been processed (meaning that a :meth:`task_done` call was received for every " "item that had been :meth:`put` into the queue)." msgstr "" -"如果目前 :meth:`join` 阻塞,它將會在所有項目都已處理完畢後恢復(代表對於" -"以 :meth:`put` 放進佇列的每個項目,都要收到 :meth:`task_done` 的呼叫)。" +"如果目前 :meth:`join` 阻塞,它將會在所有項目都已處理完畢後恢復(代表對於以 :" +"meth:`put` 放進佇列的每個項目,都要收到 :meth:`task_done` 的呼叫)。" #: ../../library/queue.rst:190 msgid "" -"``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining item " -"in the queue." -msgstr "" - -#: ../../library/queue.rst:193 -msgid "" "Raises a :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "如果呼叫次數超過佇列中放置的項目數量,則引發 :exc:`ValueError`。" -#: ../../library/queue.rst:199 +#: ../../library/queue.rst:196 msgid "Blocks until all items in the queue have been gotten and processed." msgstr "持續阻塞直到佇列中的所有項目都已被取得並處理完畢。" -#: ../../library/queue.rst:201 +#: ../../library/queue.rst:198 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " -"queue. The count goes down whenever a consumer thread " -"calls :meth:`task_done` to indicate that the item was retrieved and all work " -"on it is complete. When the count of unfinished tasks drops to " -"zero, :meth:`join` unblocks." +"queue. The count goes down whenever a consumer thread calls :meth:" +"`task_done` to indicate that the item was retrieved and all work on it is " +"complete. When the count of unfinished tasks drops to zero, :meth:`join` " +"unblocks." +msgstr "" +"每當項目被加到佇列中時,未完成任務的計數都會增加。每當消費者執行緒呼叫 :meth:" +"`task_done` 以指示該項目已被取出並且對其的所有工作都已完成時,計數就會下降。" +"當未完成任務的計數降至零時,:meth:`join` 將停止阻塞。" + +#: ../../library/queue.rst:205 +msgid "Waiting for task completion" msgstr "" -"每當項目被加到佇列中時,未完成任務的計數都會增加。每當消費者執行緒呼" -"叫 :meth:`task_done` 以指示該項目已被取出並且對其的所有工作都已完成時,計數就" -"會下降。當未完成任務的計數降至零時,:meth:`join` 將停止阻塞。" #: ../../library/queue.rst:207 msgid "Example of how to wait for enqueued tasks to be completed::" @@ -380,48 +374,72 @@ msgstr "" #: ../../library/queue.rst:236 msgid "" -":class:`Queue` objects can be made to prevent further interaction by " -"shutting them down." +"When no longer needed, :class:`Queue` objects can be wound down until empty " +"or terminated immediately with a hard shutdown." msgstr "" #: ../../library/queue.rst:241 -msgid "" -"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` " -"raise :exc:`ShutDown`." +msgid "Put a :class:`Queue` instance into a shutdown mode." msgstr "" -#: ../../library/queue.rst:244 +#: ../../library/queue.rst:243 msgid "" -"By default, :meth:`~Queue.get` on a shut down queue will only raise once the " -"queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise " -"immediately instead." +"The queue can no longer grow. Future calls to :meth:`~Queue.put` raise :exc:" +"`ShutDown`. Currently blocked callers of :meth:`~Queue.put` will be " +"unblocked and will raise :exc:`ShutDown` in the formerly blocked thread." msgstr "" #: ../../library/queue.rst:248 msgid "" -"All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " -"unblocked. If *immediate* is true, a task will be marked as done for each " -"remaining item in the queue, which may unblock callers " -"of :meth:`~Queue.join`." +"If *immediate* is false (the default), the queue can be wound down normally " +"with :meth:`~Queue.get` calls to extract tasks that have already been loaded." +msgstr "" + +#: ../../library/queue.rst:252 +msgid "" +"And if :meth:`~Queue.task_done` is called for each remaining task, a " +"pending :meth:`~Queue.join` will be unblocked normally." +msgstr "" + +#: ../../library/queue.rst:255 +msgid "" +"Once the queue is empty, future calls to :meth:`~Queue.get` will raise :exc:" +"`ShutDown`." +msgstr "" + +#: ../../library/queue.rst:258 +msgid "" +"If *immediate* is true, the queue is terminated immediately. The queue is " +"drained to be completely empty. All callers of :meth:`~Queue.join` are " +"unblocked regardless of the number of unfinished tasks. Blocked callers of :" +"meth:`~Queue.get` are unblocked and will raise :exc:`ShutDown` because the " +"queue is empty." +msgstr "" + +#: ../../library/queue.rst:265 +msgid "" +"Use caution when using :meth:`~Queue.join` with *immediate* set to true. " +"This unblocks the join even when no work has been done on the tasks, " +"violating the usual invariant for joining a queue." msgstr "" -#: ../../library/queue.rst:257 +#: ../../library/queue.rst:273 msgid "SimpleQueue Objects" msgstr "SimpleQueue 物件" -#: ../../library/queue.rst:259 +#: ../../library/queue.rst:275 msgid "" ":class:`SimpleQueue` objects provide the public methods described below." msgstr ":class:`SimpleQueue` 物件提供下面描述的公用 method。" -#: ../../library/queue.rst:263 +#: ../../library/queue.rst:279 msgid "" "Return the approximate size of the queue. Note, qsize() > 0 doesn't " "guarantee that a subsequent get() will not block." msgstr "" "傳回佇列的近似大小。注意,qsize() > 0 並不能保證後續的 get() 不會阻塞。" -#: ../../library/queue.rst:269 +#: ../../library/queue.rst:285 msgid "" "Return ``True`` if the queue is empty, ``False`` otherwise. If empty() " "returns ``False`` it doesn't guarantee that a subsequent call to get() will " @@ -430,7 +448,7 @@ msgstr "" "如果佇列為空,則回傳 ``True``,否則回傳 ``False``。如果 empty() 回傳 " "``False``,則不保證後續呼叫 get() 不會阻塞。" -#: ../../library/queue.rst:276 +#: ../../library/queue.rst:292 msgid "" "Put *item* into the queue. The method never blocks and always succeeds " "(except for potential low-level errors such as failure to allocate memory). " @@ -441,7 +459,7 @@ msgstr "" "像是分配記憶體失敗)。可選的 args *block* 和 *timeout* 會被忽略,它們僅是為了" "與 :meth:`Queue.put` 相容才存在。" -#: ../../library/queue.rst:282 +#: ../../library/queue.rst:298 msgid "" "This method has a C implementation which is reentrant. That is, a ``put()`` " "or ``get()`` call can be interrupted by another ``put()`` call in the same " @@ -454,18 +472,18 @@ msgstr "" "鎖 (deadlock) 或損壞佇列中的內部狀態。這使得它適合在解構子 (destructor) 中使" "用,像是 ``__del__`` method 或 :mod:`weakref` 回呼函式 (callback)。" -#: ../../library/queue.rst:291 +#: ../../library/queue.rst:307 msgid "" -"Equivalent to ``put(item, block=False)``, provided for compatibility " -"with :meth:`Queue.put_nowait`." +"Equivalent to ``put(item, block=False)``, provided for compatibility with :" +"meth:`Queue.put_nowait`." msgstr "" "等效於 ``put(item, block=False)``,用於與 :meth:`Queue.put_nowait` 相容。" -#: ../../library/queue.rst:312 +#: ../../library/queue.rst:328 msgid "Class :class:`multiprocessing.Queue`" msgstr "Class :class:`multiprocessing.Queue`" -#: ../../library/queue.rst:313 +#: ../../library/queue.rst:329 msgid "" "A queue class for use in a multi-processing (rather than multi-threading) " "context." @@ -473,12 +491,12 @@ msgstr "" "用於多行程處理 (multi-processing)(而非多執行緒)情境 (context) 的佇列 " "class。" -#: ../../library/queue.rst:316 +#: ../../library/queue.rst:332 msgid "" ":class:`collections.deque` is an alternative implementation of unbounded " -"queues with fast atomic :meth:`~collections.deque.append` " -"and :meth:`~collections.deque.popleft` operations that do not require " -"locking and also support indexing." +"queues with fast atomic :meth:`~collections.deque.append` and :meth:" +"`~collections.deque.popleft` operations that do not require locking and also " +"support indexing." msgstr "" ":class:`collections.deque` 是無界佇列的替代實作,有快速且具原子性 (atomic) " "的 :meth:`~collections.deque.append` 和 :meth:`~collections.deque.popleft` 操" diff --git a/library/re.po b/library/re.po index 3144c750c06..60b0905870a 100644 --- a/library/re.po +++ b/library/re.po @@ -963,7 +963,7 @@ msgstr "" #: ../../library/re.rst:667 msgid "``\\z``" -msgstr "" +msgstr "``\\z``" #: ../../library/re.rst:668 msgid "Matches only at the end of the string." @@ -2994,7 +2994,7 @@ msgstr "\\W" #: ../../library/re.rst:664 msgid "\\z" -msgstr "" +msgstr "\\z" #: ../../library/re.rst:664 msgid "\\Z" diff --git a/library/resource.po b/library/resource.po index 5dc559f7885..251df93e972 100644 --- a/library/resource.po +++ b/library/resource.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-10-21 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,11 +28,11 @@ msgid "" msgstr "" #: ../../library/resource.rst:16 ../../library/resource.rst:104 -#: ../../library/resource.rst:180 ../../library/resource.rst:192 -#: ../../library/resource.rst:201 ../../library/resource.rst:210 -#: ../../library/resource.rst:220 ../../library/resource.rst:229 -#: ../../library/resource.rst:239 ../../library/resource.rst:252 -#: ../../library/resource.rst:260 ../../library/resource.rst:268 +#: ../../library/resource.rst:181 ../../library/resource.rst:193 +#: ../../library/resource.rst:202 ../../library/resource.rst:211 +#: ../../library/resource.rst:221 ../../library/resource.rst:230 +#: ../../library/resource.rst:241 ../../library/resource.rst:255 +#: ../../library/resource.rst:264 ../../library/resource.rst:273 msgid "Availability" msgstr "可用性" @@ -93,7 +93,7 @@ msgstr "" msgid "" "Sets new limits of consumption of *resource*. The *limits* argument must be " "a tuple ``(soft, hard)`` of two integers describing the new limits. A value " -"of :data:`~resource.RLIM_INFINITY` can be used to request a limit that is " +"of :const:`~resource.RLIM_INFINITY` can be used to request a limit that is " "unlimited." msgstr "" @@ -101,7 +101,7 @@ msgstr "" msgid "" "Raises :exc:`ValueError` if an invalid resource is specified, if the new " "soft limit exceeds the hard limit, or if a process tries to raise its hard " -"limit. Specifying a limit of :data:`~resource.RLIM_INFINITY` when the hard " +"limit. Specifying a limit of :const:`~resource.RLIM_INFINITY` when the hard " "or system limit for that resource is not unlimited will result in a :exc:" "`ValueError`. A process with the effective UID of super-user can request " "any valid limit value, including unlimited, but :exc:`ValueError` will still " @@ -115,7 +115,7 @@ msgid "" msgstr "" #: ../../library/resource.rst:81 -msgid "VxWorks only supports setting :data:`RLIMIT_NOFILE`." +msgid "VxWorks only supports setting :const:`RLIMIT_NOFILE`." msgstr "" #: ../../library/resource.rst:83 @@ -183,9 +183,10 @@ msgstr "" #: ../../library/resource.rst:129 msgid "" "The maximum amount of processor time (in seconds) that a process can use. If " -"this limit is exceeded, a :const:`SIGXCPU` signal is sent to the process. " -"(See the :mod:`signal` module documentation for information about how to " -"catch this signal and do something useful, e.g. flush open files to disk.)" +"this limit is exceeded, a :const:`~signal.SIGXCPU` signal is sent to the " +"process. (See the :mod:`signal` module documentation for information about " +"how to catch this signal and do something useful, e.g. flush open files to " +"disk.)" msgstr "" #: ../../library/resource.rst:137 @@ -224,45 +225,47 @@ msgid "The maximum address space which may be locked in memory." msgstr "" #: ../../library/resource.rst:178 -msgid "The largest area of mapped memory which the process may occupy." +msgid "" +"The largest area of mapped memory which the process may occupy. Usually an " +"alias of :const:`RLIMIT_AS`." msgstr "" -#: ../../library/resource.rst:185 +#: ../../library/resource.rst:186 msgid "" "The maximum area (in bytes) of address space which may be taken by the " "process." msgstr "" -#: ../../library/resource.rst:190 +#: ../../library/resource.rst:191 msgid "The number of bytes that can be allocated for POSIX message queues." msgstr "" -#: ../../library/resource.rst:199 +#: ../../library/resource.rst:200 msgid "The ceiling for the process's nice level (calculated as 20 - rlim_cur)." msgstr "" -#: ../../library/resource.rst:208 +#: ../../library/resource.rst:209 msgid "The ceiling of the real-time priority." msgstr "" -#: ../../library/resource.rst:217 +#: ../../library/resource.rst:218 msgid "" "The time limit (in microseconds) on CPU time that a process can spend under " "real-time scheduling without making a blocking syscall." msgstr "" -#: ../../library/resource.rst:227 +#: ../../library/resource.rst:228 msgid "The number of signals which the process may queue." msgstr "" -#: ../../library/resource.rst:235 +#: ../../library/resource.rst:237 msgid "" "The maximum size (in bytes) of socket buffer usage for this user. This " "limits the amount of network memory, and hence the amount of mbufs, that " "this user may hold at any time." msgstr "" -#: ../../library/resource.rst:245 +#: ../../library/resource.rst:248 msgid "" "The maximum size (in bytes) of the swap space that may be reserved or used " "by all of this user id's processes. This limit is enforced only if bit 1 of " @@ -271,23 +274,23 @@ msgid "" "this sysctl." msgstr "" -#: ../../library/resource.rst:258 +#: ../../library/resource.rst:262 msgid "The maximum number of pseudo-terminals created by this user id." msgstr "" -#: ../../library/resource.rst:266 +#: ../../library/resource.rst:271 msgid "The maximum number of kqueues this user id is allowed to create." msgstr "" -#: ../../library/resource.rst:273 +#: ../../library/resource.rst:279 msgid "Resource Usage" msgstr "" -#: ../../library/resource.rst:275 +#: ../../library/resource.rst:281 msgid "These functions are used to retrieve resource usage information:" msgstr "" -#: ../../library/resource.rst:280 +#: ../../library/resource.rst:286 msgid "" "This function returns an object that describes the resources consumed by " "either the current process or its children, as specified by the *who* " @@ -295,11 +298,11 @@ msgid "" "`!RUSAGE_\\*` constants described below." msgstr "" -#: ../../library/resource.rst:285 +#: ../../library/resource.rst:291 msgid "A simple example::" msgstr "一個簡單範例: ::" -#: ../../library/resource.rst:287 +#: ../../library/resource.rst:293 msgid "" "from resource import *\n" "import time\n" @@ -314,7 +317,7 @@ msgid "" "print(getrusage(RUSAGE_SELF))" msgstr "" -#: ../../library/resource.rst:299 +#: ../../library/resource.rst:305 msgid "" "The fields of the return value each describe how a particular system " "resource has been used, e.g. amount of time spent running is user mode or " @@ -323,15 +326,15 @@ msgid "" "is using." msgstr "" -#: ../../library/resource.rst:304 +#: ../../library/resource.rst:310 msgid "" "For backward compatibility, the return value is also accessible as a tuple " "of 16 elements." msgstr "" -#: ../../library/resource.rst:307 +#: ../../library/resource.rst:313 msgid "" -"The fields :attr:`ru_utime` and :attr:`ru_stime` of the return value are " +"The fields :attr:`!ru_utime` and :attr:`!ru_stime` of the return value are " "floating-point values representing the amount of time spent executing in " "user mode and the amount of time spent executing in system mode, " "respectively. The remaining values are integers. Consult the :manpage:" @@ -339,249 +342,249 @@ msgid "" "summary is presented here:" msgstr "" -#: ../../library/resource.rst:314 +#: ../../library/resource.rst:320 msgid "Index" msgstr "" -#: ../../library/resource.rst:314 +#: ../../library/resource.rst:320 msgid "Field" msgstr "" -#: ../../library/resource.rst:314 +#: ../../library/resource.rst:320 msgid "Resource" msgstr "" -#: ../../library/resource.rst:316 +#: ../../library/resource.rst:322 msgid "``0``" msgstr "``0``" -#: ../../library/resource.rst:316 -msgid ":attr:`ru_utime`" -msgstr ":attr:`ru_utime`" +#: ../../library/resource.rst:322 +msgid ":attr:`!ru_utime`" +msgstr ":attr:`!ru_utime`" -#: ../../library/resource.rst:316 +#: ../../library/resource.rst:322 msgid "time in user mode (float seconds)" msgstr "" -#: ../../library/resource.rst:318 +#: ../../library/resource.rst:324 msgid "``1``" msgstr "``1``" -#: ../../library/resource.rst:318 -msgid ":attr:`ru_stime`" -msgstr ":attr:`ru_stime`" +#: ../../library/resource.rst:324 +msgid ":attr:`!ru_stime`" +msgstr ":attr:`!ru_stime`" -#: ../../library/resource.rst:318 +#: ../../library/resource.rst:324 msgid "time in system mode (float seconds)" msgstr "" -#: ../../library/resource.rst:320 +#: ../../library/resource.rst:326 msgid "``2``" msgstr "``2``" -#: ../../library/resource.rst:320 -msgid ":attr:`ru_maxrss`" -msgstr ":attr:`ru_maxrss`" +#: ../../library/resource.rst:326 +msgid ":attr:`!ru_maxrss`" +msgstr ":attr:`!ru_maxrss`" -#: ../../library/resource.rst:320 +#: ../../library/resource.rst:326 msgid "maximum resident set size" msgstr "" -#: ../../library/resource.rst:322 +#: ../../library/resource.rst:328 msgid "``3``" msgstr "``3``" -#: ../../library/resource.rst:322 -msgid ":attr:`ru_ixrss`" -msgstr ":attr:`ru_ixrss`" +#: ../../library/resource.rst:328 +msgid ":attr:`!ru_ixrss`" +msgstr ":attr:`!ru_ixrss`" -#: ../../library/resource.rst:322 +#: ../../library/resource.rst:328 msgid "shared memory size" msgstr "" -#: ../../library/resource.rst:324 +#: ../../library/resource.rst:330 msgid "``4``" msgstr "``4``" -#: ../../library/resource.rst:324 -msgid ":attr:`ru_idrss`" -msgstr ":attr:`ru_idrss`" +#: ../../library/resource.rst:330 +msgid ":attr:`!ru_idrss`" +msgstr ":attr:`!ru_idrss`" -#: ../../library/resource.rst:324 +#: ../../library/resource.rst:330 msgid "unshared memory size" msgstr "" -#: ../../library/resource.rst:326 +#: ../../library/resource.rst:332 msgid "``5``" msgstr "``5``" -#: ../../library/resource.rst:326 -msgid ":attr:`ru_isrss`" -msgstr ":attr:`ru_isrss`" +#: ../../library/resource.rst:332 +msgid ":attr:`!ru_isrss`" +msgstr ":attr:`!ru_isrss`" -#: ../../library/resource.rst:326 +#: ../../library/resource.rst:332 msgid "unshared stack size" msgstr "" -#: ../../library/resource.rst:328 +#: ../../library/resource.rst:334 msgid "``6``" msgstr "``6``" -#: ../../library/resource.rst:328 -msgid ":attr:`ru_minflt`" -msgstr ":attr:`ru_minflt`" +#: ../../library/resource.rst:334 +msgid ":attr:`!ru_minflt`" +msgstr ":attr:`!ru_minflt`" -#: ../../library/resource.rst:328 +#: ../../library/resource.rst:334 msgid "page faults not requiring I/O" msgstr "" -#: ../../library/resource.rst:330 +#: ../../library/resource.rst:336 msgid "``7``" msgstr "``7``" -#: ../../library/resource.rst:330 -msgid ":attr:`ru_majflt`" -msgstr ":attr:`ru_majflt`" +#: ../../library/resource.rst:336 +msgid ":attr:`!ru_majflt`" +msgstr ":attr:`!ru_majflt`" -#: ../../library/resource.rst:330 +#: ../../library/resource.rst:336 msgid "page faults requiring I/O" msgstr "" -#: ../../library/resource.rst:332 +#: ../../library/resource.rst:338 msgid "``8``" msgstr "``8``" -#: ../../library/resource.rst:332 -msgid ":attr:`ru_nswap`" -msgstr ":attr:`ru_nswap`" +#: ../../library/resource.rst:338 +msgid ":attr:`!ru_nswap`" +msgstr ":attr:`!ru_nswap`" -#: ../../library/resource.rst:332 +#: ../../library/resource.rst:338 msgid "number of swap outs" msgstr "" -#: ../../library/resource.rst:334 +#: ../../library/resource.rst:340 msgid "``9``" msgstr "``9``" -#: ../../library/resource.rst:334 -msgid ":attr:`ru_inblock`" -msgstr ":attr:`ru_inblock`" +#: ../../library/resource.rst:340 +msgid ":attr:`!ru_inblock`" +msgstr ":attr:`!ru_inblock`" -#: ../../library/resource.rst:334 +#: ../../library/resource.rst:340 msgid "block input operations" msgstr "" -#: ../../library/resource.rst:336 +#: ../../library/resource.rst:342 msgid "``10``" msgstr "``10``" -#: ../../library/resource.rst:336 -msgid ":attr:`ru_oublock`" -msgstr ":attr:`ru_oublock`" +#: ../../library/resource.rst:342 +msgid ":attr:`!ru_oublock`" +msgstr ":attr:`!ru_oublock`" -#: ../../library/resource.rst:336 +#: ../../library/resource.rst:342 msgid "block output operations" msgstr "" -#: ../../library/resource.rst:338 +#: ../../library/resource.rst:344 msgid "``11``" msgstr "``11``" -#: ../../library/resource.rst:338 -msgid ":attr:`ru_msgsnd`" -msgstr ":attr:`ru_msgsnd`" +#: ../../library/resource.rst:344 +msgid ":attr:`!ru_msgsnd`" +msgstr ":attr:`!ru_msgsnd`" -#: ../../library/resource.rst:338 +#: ../../library/resource.rst:344 msgid "messages sent" msgstr "" -#: ../../library/resource.rst:340 +#: ../../library/resource.rst:346 msgid "``12``" msgstr "``12``" -#: ../../library/resource.rst:340 -msgid ":attr:`ru_msgrcv`" -msgstr ":attr:`ru_msgrcv`" +#: ../../library/resource.rst:346 +msgid ":attr:`!ru_msgrcv`" +msgstr ":attr:`!ru_msgrcv`" -#: ../../library/resource.rst:340 +#: ../../library/resource.rst:346 msgid "messages received" msgstr "" -#: ../../library/resource.rst:342 +#: ../../library/resource.rst:348 msgid "``13``" msgstr "``13``" -#: ../../library/resource.rst:342 -msgid ":attr:`ru_nsignals`" -msgstr ":attr:`ru_nsignals`" +#: ../../library/resource.rst:348 +msgid ":attr:`!ru_nsignals`" +msgstr ":attr:`!ru_nsignals`" -#: ../../library/resource.rst:342 +#: ../../library/resource.rst:348 msgid "signals received" msgstr "" -#: ../../library/resource.rst:344 +#: ../../library/resource.rst:350 msgid "``14``" msgstr "``14``" -#: ../../library/resource.rst:344 -msgid ":attr:`ru_nvcsw`" -msgstr ":attr:`ru_nvcsw`" +#: ../../library/resource.rst:350 +msgid ":attr:`!ru_nvcsw`" +msgstr ":attr:`!ru_nvcsw`" -#: ../../library/resource.rst:344 +#: ../../library/resource.rst:350 msgid "voluntary context switches" msgstr "" -#: ../../library/resource.rst:346 +#: ../../library/resource.rst:352 msgid "``15``" msgstr "``15``" -#: ../../library/resource.rst:346 -msgid ":attr:`ru_nivcsw`" -msgstr ":attr:`ru_nivcsw`" +#: ../../library/resource.rst:352 +msgid ":attr:`!ru_nivcsw`" +msgstr ":attr:`!ru_nivcsw`" -#: ../../library/resource.rst:346 +#: ../../library/resource.rst:352 msgid "involuntary context switches" msgstr "" -#: ../../library/resource.rst:349 +#: ../../library/resource.rst:355 msgid "" "This function will raise a :exc:`ValueError` if an invalid *who* parameter " "is specified. It may also raise :exc:`error` exception in unusual " "circumstances." msgstr "" -#: ../../library/resource.rst:355 +#: ../../library/resource.rst:361 msgid "" "Returns the number of bytes in a system page. (This need not be the same as " "the hardware page size.)" msgstr "" -#: ../../library/resource.rst:358 +#: ../../library/resource.rst:364 msgid "" "The following :const:`!RUSAGE_\\*` symbols are passed to the :func:" "`getrusage` function to specify which processes information should be " "provided for." msgstr "" -#: ../../library/resource.rst:364 +#: ../../library/resource.rst:370 msgid "" "Pass to :func:`getrusage` to request resources consumed by the calling " "process, which is the sum of resources used by all threads in the process." msgstr "" -#: ../../library/resource.rst:370 +#: ../../library/resource.rst:376 msgid "" "Pass to :func:`getrusage` to request resources consumed by child processes " "of the calling process which have been terminated and waited for." msgstr "" -#: ../../library/resource.rst:376 +#: ../../library/resource.rst:382 msgid "" "Pass to :func:`getrusage` to request resources consumed by both the current " "process and child processes. May not be available on all systems." msgstr "" -#: ../../library/resource.rst:382 +#: ../../library/resource.rst:388 msgid "" "Pass to :func:`getrusage` to request resources consumed by the current " "thread. May not be available on all systems." diff --git a/library/select.po b/library/select.po index 9c6bd9622f0..b2d6032182a 100644 --- a/library/select.po +++ b/library/select.po @@ -848,7 +848,7 @@ msgstr "" #: ../../library/select.rst:585 msgid ":const:`KQ_FILTER_READ` and :const:`KQ_FILTER_WRITE` filter flags:" -msgstr "" +msgstr ":const:`KQ_FILTER_READ` 和 :const:`KQ_FILTER_WRITE` 篩選旗標:" #: ../../library/select.rst:590 msgid ":const:`KQ_NOTE_LOWAT`" @@ -860,7 +860,7 @@ msgstr "" #: ../../library/select.rst:593 msgid ":const:`KQ_FILTER_VNODE` filter flags:" -msgstr "" +msgstr ":const:`KQ_FILTER_VNODE` 篩選旗標:" #: ../../library/select.rst:598 msgid ":const:`KQ_NOTE_DELETE`" @@ -920,7 +920,7 @@ msgstr "" #: ../../library/select.rst:613 msgid ":const:`KQ_FILTER_PROC` filter flags:" -msgstr "" +msgstr ":const:`KQ_FILTER_PROC` 篩選旗標:" #: ../../library/select.rst:618 msgid ":const:`KQ_NOTE_EXIT`" @@ -984,7 +984,7 @@ msgstr "" #: ../../library/select.rst:636 msgid ":const:`KQ_FILTER_NETDEV` filter flags (not available on macOS):" -msgstr "" +msgstr ":const:`KQ_FILTER_NETDEV` 篩選旗標(macOS 上不可用):" #: ../../library/select.rst:641 msgid ":const:`KQ_NOTE_LINKUP`" diff --git a/library/selectors.po b/library/selectors.po index f2ff1211e86..485a946309a 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -299,15 +299,15 @@ msgstr "" #: ../../library/selectors.rst:208 msgid ":func:`select.select`-based selector." -msgstr "" +msgstr "基於 :func:`select.select` 的選擇器。" #: ../../library/selectors.rst:213 msgid ":func:`select.poll`-based selector." -msgstr "" +msgstr "基於 :func:`select.poll` 的選擇器。" #: ../../library/selectors.rst:218 msgid ":func:`select.epoll`-based selector." -msgstr "" +msgstr "基於 :func:`select.epoll` 的選擇器。" #: ../../library/selectors.rst:222 msgid "" @@ -317,7 +317,7 @@ msgstr "" #: ../../library/selectors.rst:227 msgid ":func:`select.devpoll`-based selector." -msgstr "" +msgstr "基於 :func:`select.devpoll` 的選擇器。" #: ../../library/selectors.rst:231 msgid "" @@ -327,7 +327,7 @@ msgstr "" #: ../../library/selectors.rst:238 msgid ":func:`select.kqueue`-based selector." -msgstr "" +msgstr "基於 :func:`select.kqueue` 的選擇器。" #: ../../library/selectors.rst:242 msgid "" diff --git a/library/shutil.po b/library/shutil.po index 415d7fb6dd7..98dbfece643 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -1141,6 +1141,12 @@ msgid "" ">>> make_archive(archive_name, 'gztar', root_dir)\n" "'/Users/tarek/myarchive.tar.gz'" msgstr "" +">>> from shutil import make_archive\n" +">>> import os\n" +">>> archive_name = os.path.expanduser(os.path.join('~', 'myarchive'))\n" +">>> root_dir = os.path.expanduser(os.path.join('~', '.ssh'))\n" +">>> make_archive(archive_name, 'gztar', root_dir)\n" +"'/Users/tarek/myarchive.tar.gz'" #: ../../library/shutil.rst:824 msgid "The resulting archive contains:" diff --git a/library/signal.po b/library/signal.po index 1d05f6b606a..3e5ac2df356 100644 --- a/library/signal.po +++ b/library/signal.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-15 00:15+0000\n" +"POT-Creation-Date: 2025-10-21 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,8 +51,8 @@ msgstr "" msgid "" "A handler for a particular signal, once set, remains installed until it is " "explicitly reset (Python emulates the BSD style interface regardless of the " -"underlying implementation), with the exception of the handler " -"for :const:`SIGCHLD`, which follows the underlying implementation." +"underlying implementation), with the exception of the handler for :const:" +"`SIGCHLD`, which follows the underlying implementation." msgstr "" "特定訊號的處理程式一旦被設定,就會一直被安裝,直到被明確地重設為止 (不管底層" "的實作為何,Python 皆模擬出 BSD 風格的介面),但 :const:`SIGCHLD` 的處理程式除" @@ -86,12 +86,12 @@ msgstr "" #: ../../library/signal.rst:42 msgid "" -"It makes little sense to catch synchronous errors like :const:`SIGFPE` " -"or :const:`SIGSEGV` that are caused by an invalid operation in C code. " -"Python will return from the signal handler to the C code, which is likely to " -"raise the same signal again, causing Python to apparently hang. From Python " -"3.3 onwards, you can use the :mod:`faulthandler` module to report on " -"synchronous errors." +"It makes little sense to catch synchronous errors like :const:`SIGFPE` or :" +"const:`SIGSEGV` that are caused by an invalid operation in C code. Python " +"will return from the signal handler to the C code, which is likely to raise " +"the same signal again, causing Python to apparently hang. From Python 3.3 " +"onwards, you can use the :mod:`faulthandler` module to report on synchronous " +"errors." msgstr "" "捕捉像 :const:`SIGFPE` 或 :const:`SIGSEGV` 這類由 C 程式碼中無效操作所引起的" "同步錯誤是沒有意義的。Python 將從訊號處理程式中回傳到 C 程式碼,而 C 程式碼很" @@ -131,8 +131,8 @@ msgid "" "instead." msgstr "" "Python 訊號處理程式總是在主直譯器的主 Python 執行緒中執行,即使訊號是在另一個" -"執行緒中接收到的。這意味著訊號不能用來做為執行緒間通訊的方式。你可以使" -"用 :mod:`threading` 模組的同步原語 (synchronization primitive) 來代替。" +"執行緒中接收到的。這意味著訊號不能用來做為執行緒間通訊的方式。你可以使用 :" +"mod:`threading` 模組的同步原語 (synchronization primitive) 來代替。" #: ../../library/signal.rst:69 msgid "" @@ -146,22 +146,20 @@ msgstr "模組內容" #: ../../library/signal.rst:75 msgid "" -"signal (SIG*), handler (:const:`SIG_DFL`, :const:`SIG_IGN`) and sigmask " -"(:const:`SIG_BLOCK`, :const:`SIG_UNBLOCK`, :const:`SIG_SETMASK`) related " -"constants listed below were turned into :class:`enums ` " -"(:class:`Signals`, :class:`Handlers` and :class:`Sigmasks` " -"respectively). :func:`getsignal`, :func:`pthread_sigmask`, :func:`sigpending` " -"and :func:`sigwait` functions return human-readable :class:`enums " -"` as :class:`Signals` objects." +"signal (SIG*), handler (:const:`SIG_DFL`, :const:`SIG_IGN`) and sigmask (:" +"const:`SIG_BLOCK`, :const:`SIG_UNBLOCK`, :const:`SIG_SETMASK`) related " +"constants listed below were turned into :class:`enums ` (:" +"class:`Signals`, :class:`Handlers` and :class:`Sigmasks` respectively). :" +"func:`getsignal`, :func:`pthread_sigmask`, :func:`sigpending` and :func:" +"`sigwait` functions return human-readable :class:`enums ` as :" +"class:`Signals` objects." msgstr "" "下面列出的訊號 (SIG*)、處理器(:const:`SIG_DFL`、:const:`SIG_IGN`)和訊號遮" -"罩 (sigmask)" -"(:const:`SIG_BLOCK`、:const:`SIG_UNBLOCK`、:const:`SIG_SETMASK`)的相關常數" -"被轉換成 :class:`enums `\\ " -"(:class:`Signals`、:class:`Handlers` " -"和 :class:`Sigmasks`)。:func:`getsignal`、:func:`pthread_sigmask`、:func:`sigpending` " -"和 :func:`sigwait` 函式會回傳可被人類閱讀的\\ :class:`枚舉 `\\ " -"作為 :class:`Signals` 物件。" +"罩 (sigmask)(:const:`SIG_BLOCK`、:const:`SIG_UNBLOCK`、:const:" +"`SIG_SETMASK`)的相關常數被轉換成 :class:`enums `\\ (:class:" +"`Signals`、:class:`Handlers` 和 :class:`Sigmasks`)。:func:`getsignal`、:" +"func:`pthread_sigmask`、:func:`sigpending` 和 :func:`sigwait` 函式會回傳可被" +"人類閱讀的\\ :class:`枚舉 `\\ 作為 :class:`Signals` 物件。" #: ../../library/signal.rst:85 msgid "The signal module defines three enums:" @@ -174,37 +172,39 @@ msgstr "SIG* 常數和 CTRL_* 常數的 :class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:95 msgid "" -":class:`enum.IntEnum` collection the constants :const:`SIG_DFL` " -"and :const:`SIG_IGN`." +":class:`enum.IntEnum` collection the constants :const:`SIG_DFL` and :const:" +"`SIG_IGN`." msgstr "" ":const:`SIG_DFL` 和 :const:`SIG_IGN` 常數的 :class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:101 msgid "" -":class:`enum.IntEnum` collection the " -"constants :const:`SIG_BLOCK`, :const:`SIG_UNBLOCK` and :const:`SIG_SETMASK`." +":class:`enum.IntEnum` collection the constants :const:`SIG_BLOCK`, :const:" +"`SIG_UNBLOCK` and :const:`SIG_SETMASK`." msgstr "" -":const:`SIG_BLOCK`、:const:`SIG_UNBLOCK` 和 :const:`SIG_SETMASK` 常數" -"的 :class:`enum.IntEnum` 集合。" +":const:`SIG_BLOCK`、:const:`SIG_UNBLOCK` 和 :const:`SIG_SETMASK` 常數的 :" +"class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:103 ../../library/signal.rst:136 #: ../../library/signal.rst:142 ../../library/signal.rst:148 #: ../../library/signal.rst:154 ../../library/signal.rst:160 #: ../../library/signal.rst:166 ../../library/signal.rst:180 #: ../../library/signal.rst:198 ../../library/signal.rst:206 -#: ../../library/signal.rst:217 ../../library/signal.rst:232 -#: ../../library/signal.rst:238 ../../library/signal.rst:244 -#: ../../library/signal.rst:262 ../../library/signal.rst:272 -#: ../../library/signal.rst:351 ../../library/signal.rst:390 -#: ../../library/signal.rst:414 ../../library/signal.rst:437 -#: ../../library/signal.rst:471 ../../library/signal.rst:501 -#: ../../library/signal.rst:508 ../../library/signal.rst:563 -#: ../../library/signal.rst:605 ../../library/signal.rst:620 -#: ../../library/signal.rst:646 ../../library/signal.rst:666 +#: ../../library/signal.rst:212 ../../library/signal.rst:218 +#: ../../library/signal.rst:233 ../../library/signal.rst:248 +#: ../../library/signal.rst:254 ../../library/signal.rst:260 +#: ../../library/signal.rst:266 ../../library/signal.rst:272 +#: ../../library/signal.rst:290 ../../library/signal.rst:300 +#: ../../library/signal.rst:379 ../../library/signal.rst:418 +#: ../../library/signal.rst:442 ../../library/signal.rst:465 +#: ../../library/signal.rst:499 ../../library/signal.rst:529 +#: ../../library/signal.rst:536 ../../library/signal.rst:591 +#: ../../library/signal.rst:633 ../../library/signal.rst:648 +#: ../../library/signal.rst:673 ../../library/signal.rst:693 msgid "Availability" msgstr "可用性" -#: ../../library/signal.rst:105 ../../library/signal.rst:473 +#: ../../library/signal.rst:105 ../../library/signal.rst:501 msgid "" "See the man page :manpage:`sigprocmask(2)` and :manpage:`pthread_sigmask(3)` " "for further information." @@ -224,8 +224,8 @@ msgid "" "default action for :const:`SIGCHLD` is to simply ignore it." msgstr "" "這是兩種標準訊號處理選項之一;它會簡單地執行訊號的預設功能。例如,在大多數系" -"統上,:const:`SIGQUIT` 的預設動作是轉儲 (dump) 核心並退出," -"而 :const:`SIGCHLD` 的預設動作是直接忽略。" +"統上,:const:`SIGQUIT` 的預設動作是轉儲 (dump) 核心並退出,而 :const:" +"`SIGCHLD` 的預設動作是直接忽略。" #: ../../library/signal.rst:124 msgid "" @@ -307,10 +307,22 @@ msgid "Default action is to ignore the signal." msgstr "預設動作是忽略訊號。" #: ../../library/signal.rst:210 +msgid "Profiling timer expired." +msgstr "" + +#: ../../library/signal.rst:216 +msgid "Terminal quit signal." +msgstr "" + +#: ../../library/signal.rst:222 msgid "Segmentation fault: invalid memory reference." msgstr "記憶體區段錯誤 (segmentation fault):無效記憶體參照。" -#: ../../library/signal.rst:214 +#: ../../library/signal.rst:226 +msgid "Stop executing (cannot be caught or ignored)." +msgstr "停止執行(無法被捕捉或忽略)。" + +#: ../../library/signal.rst:230 msgid "" "Stack fault on coprocessor. The Linux kernel does not raise this signal: it " "can only be raised in user space." @@ -318,56 +330,62 @@ msgstr "" "輔助處理器 (coprocessor) 上的堆疊錯誤 (stack fault)。Linux 核心不會引發此訊" "號:它只能在使用者空間 (user space) 中引發。" -#: ../../library/signal.rst:219 +#: ../../library/signal.rst:235 msgid "" -"On architectures where the signal is available. See the man " -"page :manpage:`signal(7)` for further information." +"On architectures where the signal is available. See the man page :manpage:" +"`signal(7)` for further information." msgstr "" "在訊號可用的架構上。請參閱 :manpage:`signal(7)` 線上手冊以取得更多資訊。" -#: ../../library/signal.rst:226 +#: ../../library/signal.rst:242 msgid "Termination signal." msgstr "終止訊號。" -#: ../../library/signal.rst:230 +#: ../../library/signal.rst:246 msgid "User-defined signal 1." msgstr "使用者定義訊號 1。" -#: ../../library/signal.rst:236 +#: ../../library/signal.rst:252 msgid "User-defined signal 2." msgstr "使用者定義訊號 2。" -#: ../../library/signal.rst:242 +#: ../../library/signal.rst:258 +msgid "Virtual timer expired." +msgstr "" + +#: ../../library/signal.rst:264 msgid "Window resize signal." msgstr "視窗調整大小訊號。" -#: ../../library/signal.rst:248 +#: ../../library/signal.rst:270 +msgid "CPU time limit exceeded." +msgstr "" + +#: ../../library/signal.rst:276 msgid "" "All the signal numbers are defined symbolically. For example, the hangup " "signal is defined as :const:`signal.SIGHUP`; the variable names are " "identical to the names used in C programs, as found in ````. The " -"Unix man page for ':c:func:`signal`' lists the existing signals (on some " -"systems this is :manpage:`signal(2)`, on others the list is " -"in :manpage:`signal(7)`). Note that not all systems define the same set of " -"signal names; only those names defined by the system are defined by this " -"module." +"Unix man page for '``signal``' lists the existing signals (on some systems " +"this is :manpage:`signal(2)`, on others the list is in :manpage:" +"`signal(7)`). Note that not all systems define the same set of signal names; " +"only those names defined by the system are defined by this module." msgstr "" -"所有的訊號編號都是以符號定義的。例如,掛斷訊號被定義" -"為 :const:`signal.SIGHUP`;變數名稱與 C 程式中使用的名稱相同,可在 " -"```` 中找到。Unix 線上手冊 ':c:func:`signal`' 列出了現有的訊號(在" -"某些系統上是 :manpage:`signal(2)`,在其他系統上是在 :manpage:`signal(7)` " -"中)。請注意,並非所有系統都會定義同一套訊號名稱;只有那些由系統所定義的名稱" -"才會由這個模組定義。" +"所有的訊號編號都是以符號定義的。例如,掛斷訊號被定義為 :const:`signal." +"SIGHUP`;變數名稱與 C 程式中使用的名稱相同,可在 ```` 中找到。Unix " +"線上手冊 '``signal``' 列出了現有的訊號(在某些系統上是 :manpage:" +"`signal(2)`,在其他系統上是在 :manpage:`signal(7)` 中)。請注意,並非所有系統" +"都會定義同一套訊號名稱;只有那些由系統所定義的名稱才會由這個模組定義。" -#: ../../library/signal.rst:259 +#: ../../library/signal.rst:287 msgid "" "The signal corresponding to the :kbd:`Ctrl+C` keystroke event. This signal " "can only be used with :func:`os.kill`." msgstr "" -"與 :kbd:`Ctrl+C` 擊鍵 (keystroke) 事件相對應的訊號。此訊號只能" -"與 :func:`os.kill` 搭配使用。" +"與 :kbd:`Ctrl+C` 擊鍵 (keystroke) 事件相對應的訊號。此訊號只能與 :func:`os." +"kill` 搭配使用。" -#: ../../library/signal.rst:269 +#: ../../library/signal.rst:297 msgid "" "The signal corresponding to the :kbd:`Ctrl+Break` keystroke event. This " "signal can only be used with :func:`os.kill`." @@ -375,26 +393,26 @@ msgstr "" "與 :kbd:`Ctrl+Break` 擊鍵事件相對應的訊號。此訊號只能與 :func:`os.kill` 搭配" "使用。" -#: ../../library/signal.rst:279 +#: ../../library/signal.rst:307 msgid "" -"One more than the number of the highest signal number. " -"Use :func:`valid_signals` to get valid signal numbers." +"One more than the number of the highest signal number. Use :func:" +"`valid_signals` to get valid signal numbers." msgstr "" "比最高編號訊號的編號多一。使用 :func:`valid_signals` 來取得有效的訊號編號。" -#: ../../library/signal.rst:285 +#: ../../library/signal.rst:313 msgid "" "Decrements interval timer in real time, and delivers :const:`SIGALRM` upon " "expiration." msgstr "即時減少間隔計時器 (interval timer),並在到期時送出 :const:`SIGALRM`。" -#: ../../library/signal.rst:291 +#: ../../library/signal.rst:319 msgid "" "Decrements interval timer only when the process is executing, and delivers " "SIGVTALRM upon expiration." msgstr "僅在執行行程時遞減間隔計時器,並在到期時傳送 SIGVTALRM。" -#: ../../library/signal.rst:297 +#: ../../library/signal.rst:325 msgid "" "Decrements interval timer both when the process executes and when the system " "is executing on behalf of the process. Coupled with ITIMER_VIRTUAL, this " @@ -405,19 +423,19 @@ msgstr "" "這個計時器通常用來分析 (profile) 應用程式在使用者空間與核心空間 (kernel " "space) 所花費的時間。SIGPROF 會在到期時傳送。" -#: ../../library/signal.rst:305 +#: ../../library/signal.rst:333 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that signals are to be blocked." msgstr ":func:`pthread_sigmask` 的 *how* 參數的可能值,表示訊號將被阻檔。" -#: ../../library/signal.rst:312 +#: ../../library/signal.rst:340 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that signals are to be unblocked." msgstr ":func:`pthread_sigmask` 的 *how* 參數的可能值,表示訊號將被解除阻檔。" -#: ../../library/signal.rst:319 +#: ../../library/signal.rst:347 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that the signal mask is to be replaced." @@ -425,32 +443,32 @@ msgstr "" ":func:`pthread_sigmask` 的 *how* 參數的可能值,表示訊號遮罩 (signal mask) 要" "被取代。" -#: ../../library/signal.rst:325 +#: ../../library/signal.rst:353 msgid "The :mod:`signal` module defines one exception:" msgstr ":mod:`signal` 模組定義了一個例外:" -#: ../../library/signal.rst:329 +#: ../../library/signal.rst:357 msgid "" -"Raised to signal an error from the underlying :func:`setitimer` " -"or :func:`getitimer` implementation. Expect this error if an invalid " -"interval timer or a negative time is passed to :func:`setitimer`. This error " -"is a subtype of :exc:`OSError`." +"Raised to signal an error from the underlying :func:`setitimer` or :func:" +"`getitimer` implementation. Expect this error if an invalid interval timer " +"or a negative time is passed to :func:`setitimer`. This error is a subtype " +"of :exc:`OSError`." msgstr "" "當 :func:`setitimer` 或 :func:`getitimer` 底層實作發生錯誤時引發訊號。如果傳" "給 :func:`setitimer` 的是無效的間隔計時器或負數時間,則預期會發生此錯誤。這個" "錯誤是 :exc:`OSError` 的子型別。" -#: ../../library/signal.rst:334 +#: ../../library/signal.rst:362 msgid "" -"This error used to be a subtype of :exc:`IOError`, which is now an alias " -"of :exc:`OSError`." +"This error used to be a subtype of :exc:`IOError`, which is now an alias of :" +"exc:`OSError`." msgstr "此錯誤過去是 :exc:`IOError` 的子型別,現在是 :exc:`OSError` 的別名。" -#: ../../library/signal.rst:339 +#: ../../library/signal.rst:367 msgid "The :mod:`signal` module defines the following functions:" msgstr ":mod:`signal` 模組定義了下列函式:" -#: ../../library/signal.rst:344 +#: ../../library/signal.rst:372 msgid "" "If *time* is non-zero, this function requests that a :const:`SIGALRM` signal " "be sent to the process in *time* seconds. Any previously scheduled alarm is " @@ -466,37 +484,37 @@ msgstr "" "則不會去排程任何警報,且已排程的警報會被取消。如果回傳值為零,則代表目前未排" "程任何警報。" -#: ../../library/signal.rst:353 +#: ../../library/signal.rst:381 msgid "See the man page :manpage:`alarm(2)` for further information." msgstr "更多資訊請見 :manpage:`alarm(2)` 線上手冊。" -#: ../../library/signal.rst:358 +#: ../../library/signal.rst:386 msgid "" "Return the current signal handler for the signal *signalnum*. The returned " -"value may be a callable Python object, or one of the special " -"values :const:`signal.SIG_IGN`, :const:`signal.SIG_DFL` or :const:`None`. " -"Here, :const:`signal.SIG_IGN` means that the signal was previously " -"ignored, :const:`signal.SIG_DFL` means that the default way of handling the " -"signal was previously in use, and ``None`` means that the previous signal " -"handler was not installed from Python." +"value may be a callable Python object, or one of the special values :const:" +"`signal.SIG_IGN`, :const:`signal.SIG_DFL` or :const:`None`. Here, :const:" +"`signal.SIG_IGN` means that the signal was previously ignored, :const:" +"`signal.SIG_DFL` means that the default way of handling the signal was " +"previously in use, and ``None`` means that the previous signal handler was " +"not installed from Python." msgstr "" "回傳訊號 *signalnum* 的目前訊號處理程式。回傳值可以是一個可呼叫的 Python 物" -"件,或是特殊值 :const:`signal.SIG_IGN`、:const:`signal.SIG_DFL` " -"或 :const:`None` 之一。這裡的 :const:`signal.SIG_IGN` 表示訊號先前被忽" -"略,:const:`signal.SIG_DFL` 表示訊號先前使用預設的處理方式,而 ``None`` 表示" -"先前的訊號處理程式並未從 Python 安裝。" +"件,或是特殊值 :const:`signal.SIG_IGN`、:const:`signal.SIG_DFL` 或 :const:" +"`None` 之一。這裡的 :const:`signal.SIG_IGN` 表示訊號先前被忽略,:const:" +"`signal.SIG_DFL` 表示訊號先前使用預設的處理方式,而 ``None`` 表示先前的訊號處" +"理程式並未從 Python 安裝。" -#: ../../library/signal.rst:369 +#: ../../library/signal.rst:397 msgid "" -"Returns the description of signal *signalnum*, such as \"Interrupt\" " -"for :const:`SIGINT`. Returns :const:`None` if *signalnum* has no " -"description. Raises :exc:`ValueError` if *signalnum* is invalid." +"Returns the description of signal *signalnum*, such as \"Interrupt\" for :" +"const:`SIGINT`. Returns :const:`None` if *signalnum* has no description. " +"Raises :exc:`ValueError` if *signalnum* is invalid." msgstr "" "回傳訊號 *signalnum* 的描述,例如 :const:`SIGINT` 的 \"Interrupt\"。如果 " -"*signalnum* 沒有描述,則回傳 :const:`None`。如果 *signalnum* 無效則會引" -"發 :exc:`ValueError`。" +"*signalnum* 沒有描述,則回傳 :const:`None`。如果 *signalnum* 無效則會引發 :" +"exc:`ValueError`。" -#: ../../library/signal.rst:378 +#: ../../library/signal.rst:406 msgid "" "Return the set of valid signal numbers on this platform. This can be less " "than ``range(1, NSIG)`` if some signals are reserved by the system for " @@ -505,29 +523,29 @@ msgstr "" "回傳此平台上的有效訊號編號集合。如果某些訊號被系統保留作為內部使用,則此值可" "能小於 ``range(1, NSIG)``。" -#: ../../library/signal.rst:387 +#: ../../library/signal.rst:415 msgid "" "Cause the process to sleep until a signal is received; the appropriate " "handler will then be called. Returns nothing." msgstr "使行程休眠,直到接收到訊號;然後呼叫適當的處理程式。不會回傳任何東西。" -#: ../../library/signal.rst:392 +#: ../../library/signal.rst:420 msgid "See the man page :manpage:`signal(2)` for further information." msgstr "更多資訊請見 :manpage:`signal(2)` 線上手冊。" -#: ../../library/signal.rst:394 +#: ../../library/signal.rst:422 msgid "" -"See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` " -"and :func:`sigpending`." +"See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` and :" +"func:`sigpending`." msgstr "" -"也請見 :func:`sigwait`、:func:`sigwaitinfo`、:func:`sigtimedwait` " -"和 :func:`sigpending`。" +"也請見 :func:`sigwait`、:func:`sigwaitinfo`、:func:`sigtimedwait` 和 :func:" +"`sigpending`。" -#: ../../library/signal.rst:400 +#: ../../library/signal.rst:428 msgid "Sends a signal to the calling process. Returns nothing." msgstr "傳送訊號至呼叫的行程。不會回傳任何東西。" -#: ../../library/signal.rst:407 +#: ../../library/signal.rst:435 msgid "" "Send signal *sig* to the process referred to by file descriptor *pidfd*. " "Python does not currently support the *siginfo* parameter; it must be " @@ -537,11 +555,11 @@ msgstr "" "傳送訊號 *sig* 到檔案描述器 *pidfd* 所指的行程。Python 目前不支援 *siginfo* " "參數;它必須是 ``None``。*flags* 引數是提供給未來的擴充;目前沒有定義旗標值。" -#: ../../library/signal.rst:412 +#: ../../library/signal.rst:440 msgid "See the :manpage:`pidfd_send_signal(2)` man page for more information." msgstr "更多資訊請見 :manpage:`pidfd_send_signal(2)` 線上手冊。" -#: ../../library/signal.rst:420 +#: ../../library/signal.rst:448 msgid "" "Send the signal *signalnum* to the thread *thread_id*, another thread in the " "same process as the caller. The target thread can be executing any code " @@ -557,16 +575,16 @@ msgstr "" "`。因此,向特定 Python 執行緒發送訊號的唯一意義是強制執" "行中的系統呼叫以 :exc:`InterruptedError` 方式失敗。" -#: ../../library/signal.rst:428 +#: ../../library/signal.rst:456 msgid "" "Use :func:`threading.get_ident` or the :attr:`~threading.Thread.ident` " "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" -"使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件" -"的 :attr:`~threading.Thread.ident` 屬性來取得 *thread_id* 的適當值。" +"使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件的 :attr:" +"`~threading.Thread.ident` 屬性來取得 *thread_id* 的適當值。" -#: ../../library/signal.rst:432 +#: ../../library/signal.rst:460 msgid "" "If *signalnum* is 0, then no signal is sent, but error checking is still " "performed; this can be used to check if the target thread is still running." @@ -574,7 +592,7 @@ msgstr "" "如果 *signalnum* 為 0,則不會傳送訊號,但仍會執行錯誤檢查;這可用來檢查目標執" "行緒是否仍在執行。" -#: ../../library/signal.rst:435 +#: ../../library/signal.rst:463 msgid "" "Raises an :ref:`auditing event ` ``signal.pthread_kill`` with " "arguments ``thread_id``, ``signalnum``." @@ -582,15 +600,15 @@ msgstr "" "引發一個附帶引數 ``thread_id``、``signalnum`` 的\\ :ref:`稽核事件 " "` ``signal.pthread_kill``。" -#: ../../library/signal.rst:439 +#: ../../library/signal.rst:467 msgid "See the man page :manpage:`pthread_kill(3)` for further information." msgstr "更多資訊請見 :manpage:`pthread_kill(3)` 線上手冊。" -#: ../../library/signal.rst:441 +#: ../../library/signal.rst:469 msgid "See also :func:`os.kill`." msgstr "另請參閱 :func:`os.kill`。" -#: ../../library/signal.rst:448 +#: ../../library/signal.rst:476 msgid "" "Fetch and/or change the signal mask of the calling thread. The signal mask " "is the set of signals whose delivery is currently blocked for the caller. " @@ -599,19 +617,19 @@ msgstr "" "擷取和/或變更呼叫執行緒的訊號遮罩。訊號遮罩是目前阻擋呼叫者傳送的訊號集合。將" "舊的訊號遮罩作為一組訊號集合回傳。" -#: ../../library/signal.rst:452 +#: ../../library/signal.rst:480 msgid "" "The behavior of the call is dependent on the value of *how*, as follows." msgstr "呼叫的行為取決於 *how* 的值,如下所示。" -#: ../../library/signal.rst:454 +#: ../../library/signal.rst:482 msgid "" ":data:`SIG_BLOCK`: The set of blocked signals is the union of the current " "set and the *mask* argument." msgstr "" ":data:`SIG_BLOCK`:被阻檔的訊號集合是目前訊號集合與 *mask* 引數的聯集。" -#: ../../library/signal.rst:456 +#: ../../library/signal.rst:484 msgid "" ":data:`SIG_UNBLOCK`: The signals in *mask* are removed from the current set " "of blocked signals. It is permissible to attempt to unblock a signal which " @@ -620,23 +638,23 @@ msgstr "" ":data:`SIG_UNBLOCK`:將 *mask* 中的訊號從目前阻檔的訊號集合中移除。嘗試為未被" "阻檔的訊號解除阻檔是允許的。" -#: ../../library/signal.rst:459 +#: ../../library/signal.rst:487 msgid "" ":data:`SIG_SETMASK`: The set of blocked signals is set to the *mask* " "argument." msgstr ":data:`SIG_SETMASK`:將被阻檔的訊號集合設定為 *mask* 引數。" -#: ../../library/signal.rst:462 +#: ../../library/signal.rst:490 msgid "" -"*mask* is a set of signal numbers (e.g. " -"{:const:`signal.SIGINT`, :const:`signal.SIGTERM`}). " -"Use :func:`~signal.valid_signals` for a full mask including all signals." +"*mask* is a set of signal numbers (e.g. {:const:`signal.SIGINT`, :const:" +"`signal.SIGTERM`}). Use :func:`~signal.valid_signals` for a full mask " +"including all signals." msgstr "" -"*mask* 是一組訊號編號(例如 " -"{:const:`signal.SIGINT`, :const:`signal.SIGTERM`})的集合。使" -"用 :func:`~signal.valid_signals` 來取得包含所有訊號的完整遮罩。" +"*mask* 是一組訊號編號(例如 {:const:`signal.SIGINT`, :const:`signal." +"SIGTERM`})的集合。使用 :func:`~signal.valid_signals` 來取得包含所有訊號的完" +"整遮罩。" -#: ../../library/signal.rst:466 +#: ../../library/signal.rst:494 msgid "" "For example, ``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` reads the " "signal mask of the calling thread." @@ -644,59 +662,56 @@ msgstr "" "例如,``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` 會讀取呼叫執行緒的訊號" "遮罩。" -#: ../../library/signal.rst:469 +#: ../../library/signal.rst:497 msgid ":data:`SIGKILL` and :data:`SIGSTOP` cannot be blocked." msgstr ":data:`SIGKILL` 和 :data:`SIGSTOP` 不能被阻檔。" -#: ../../library/signal.rst:476 +#: ../../library/signal.rst:504 msgid "See also :func:`pause`, :func:`sigpending` and :func:`sigwait`." msgstr "另請參閱 :func:`pause`、:func:`sigpending` 與 :func:`sigwait`。" -#: ../../library/signal.rst:483 +#: ../../library/signal.rst:511 msgid "" -"Sets given interval timer (one " -"of :const:`signal.ITIMER_REAL`, :const:`signal.ITIMER_VIRTUAL` " -"or :const:`signal.ITIMER_PROF`) specified by *which* to fire after *seconds* " -"(float is accepted, different from :func:`alarm`) and after that every " -"*interval* seconds (if *interval* is non-zero). The interval timer specified " -"by *which* can be cleared by setting *seconds* to zero." +"Sets given interval timer (one of :const:`signal.ITIMER_REAL`, :const:" +"`signal.ITIMER_VIRTUAL` or :const:`signal.ITIMER_PROF`) specified by *which* " +"to fire after *seconds* (float is accepted, different from :func:`alarm`) " +"and after that every *interval* seconds (if *interval* is non-zero). The " +"interval timer specified by *which* can be cleared by setting *seconds* to " +"zero." msgstr "" -"設定由 *which* 指定的間隔計時器" -"(:const:`signal.ITIMER_REAL`、:const:`signal.ITIMER_VIRTUAL` " -"或 :const:`signal.ITIMER_PROF` 之一)並在*seconds*\\ (接受浮點數," -"與 :func:`alarm` 不同)之後啟動,在之後的每 *interval* 秒啟動一次(如果 " -"*interval* 非零)。*which* 指定的間隔計時器可透過將 *seconds* 設定為零來清除" -"它。" +"設定由 *which* 指定的間隔計時器(:const:`signal.ITIMER_REAL`、:const:`signal." +"ITIMER_VIRTUAL` 或 :const:`signal.ITIMER_PROF` 之一)並在*seconds*\\ (接受浮" +"點數,與 :func:`alarm` 不同)之後啟動,在之後的每 *interval* 秒啟動一次(如" +"果 *interval* 非零)。*which* 指定的間隔計時器可透過將 *seconds* 設定為零來清" +"除它。" -#: ../../library/signal.rst:490 +#: ../../library/signal.rst:518 msgid "" "When an interval timer fires, a signal is sent to the process. The signal " "sent is dependent on the timer being used; :const:`signal.ITIMER_REAL` will " -"deliver :const:`SIGALRM`, :const:`signal.ITIMER_VIRTUAL` " -"sends :const:`SIGVTALRM`, and :const:`signal.ITIMER_PROF` will " -"deliver :const:`SIGPROF`." +"deliver :const:`SIGALRM`, :const:`signal.ITIMER_VIRTUAL` sends :const:" +"`SIGVTALRM`, and :const:`signal.ITIMER_PROF` will deliver :const:`SIGPROF`." msgstr "" -"當間隔計時器啟動時,一個訊號會被傳送給行程。傳送的訊號取決於使用的計時" -"器;:const:`signal.ITIMER_REAL` 會傳" -"送 :const:`SIGALRM`,:const:`signal.ITIMER_VIRTUAL` 會傳" -"送 :const:`SIGVTALRM`,而 :const:`signal.ITIMER_PROF` 會傳" -"送 :const:`SIGPROF`。" +"當間隔計時器啟動時,一個訊號會被傳送給行程。傳送的訊號取決於使用的計時器;:" +"const:`signal.ITIMER_REAL` 會傳送 :const:`SIGALRM`,:const:`signal." +"ITIMER_VIRTUAL` 會傳送 :const:`SIGVTALRM`,而 :const:`signal.ITIMER_PROF` 會" +"傳送 :const:`SIGPROF`。" -#: ../../library/signal.rst:496 +#: ../../library/signal.rst:524 msgid "The old values are returned as a tuple: (delay, interval)." msgstr "舊值會以一個元組回傳:(delay, interval)。" -#: ../../library/signal.rst:498 +#: ../../library/signal.rst:526 msgid "" -"Attempting to pass an invalid interval timer will cause " -"an :exc:`ItimerError`." +"Attempting to pass an invalid interval timer will cause an :exc:" +"`ItimerError`." msgstr "嘗試傳入無效的間隔計時器會導致 :exc:`ItimerError`。" -#: ../../library/signal.rst:506 +#: ../../library/signal.rst:534 msgid "Returns current value of a given interval timer specified by *which*." msgstr "回傳由 *which* 指定之間隔計時器的目前值。" -#: ../../library/signal.rst:513 +#: ../../library/signal.rst:541 msgid "" "Set the wakeup file descriptor to *fd*. When a signal your program has " "registered a signal handler for is received, the signal number is written as " @@ -710,7 +725,7 @@ msgstr "" "fd。這可被函式庫用來喚醒輪詢 (wakeup a poll) 或 select 呼叫,讓訊號得以完全處" "理。" -#: ../../library/signal.rst:520 +#: ../../library/signal.rst:548 msgid "" "The old wakeup fd is returned (or -1 if file descriptor wakeup was not " "enabled). If *fd* is -1, file descriptor wakeup is disabled. If not -1, " @@ -721,7 +736,7 @@ msgstr "" "停用檔案描述器喚醒。如果不是 -1,*fd* 必須是非阻塞的。在再次呼叫輪詢或 " "select 之前,由函式庫來決定是否移除 *fd* 中的任何位元組。" -#: ../../library/signal.rst:525 ../../library/signal.rst:580 +#: ../../library/signal.rst:553 ../../library/signal.rst:608 msgid "" "When threads are enabled, this function can only be called from :ref:`the " "main thread of the main interpreter `; attempting to " @@ -731,7 +746,7 @@ msgstr "" "當啟用執行緒時,這個函式只能從\\ :ref:`主直譯器 `\\ 的主" "執行緒來呼叫;嘗試從其他執行緒呼叫它將會引發 :exc:`ValueError` 例外。" -#: ../../library/signal.rst:530 +#: ../../library/signal.rst:558 msgid "" "There are two common ways to use this function. In both approaches, you use " "the fd to wake up when a signal arrives, but then they differ in how they " @@ -740,7 +755,7 @@ msgstr "" "使用這個函式有兩種常見的方式。在這兩種方法中,當訊號抵達時,你都要使用 fd 來" "喚醒,但它們的不同之處在於如何判斷\\ *哪個或哪些*\\ 訊號有抵達。" -#: ../../library/signal.rst:535 +#: ../../library/signal.rst:563 msgid "" "In the first approach, we read the data out of the fd's buffer, and the byte " "values give you the signal numbers. This is simple, but in rare cases it can " @@ -756,7 +771,7 @@ msgstr "" "法,那麼你應該設定 ``warn_on_full_buffer=True``,這至少會在訊號丟失時將警告印" "出到 stderr。" -#: ../../library/signal.rst:544 +#: ../../library/signal.rst:572 msgid "" "In the second approach, we use the wakeup fd *only* for wakeups, and ignore " "the actual byte values. In this case, all we care about is whether the fd's " @@ -770,15 +785,15 @@ msgstr "" "如果你使用這種方法,那麼你應該設定 ``warn_on_full_buffer=False``,這樣你的使" "用者就不會被虛假的警告訊息所混淆。" -#: ../../library/signal.rst:551 +#: ../../library/signal.rst:579 msgid "On Windows, the function now also supports socket handles." msgstr "在 Windows 上,此功能現在也支援 socket 處理程式。" -#: ../../library/signal.rst:554 +#: ../../library/signal.rst:582 msgid "Added ``warn_on_full_buffer`` parameter." msgstr "新增 ``warn_on_full_buffer`` 參數。" -#: ../../library/signal.rst:559 +#: ../../library/signal.rst:587 msgid "" "Change system call restart behaviour: if *flag* is :const:`False`, system " "calls will be restarted when interrupted by signal *signalnum*, otherwise " @@ -787,11 +802,11 @@ msgstr "" "改變系統呼叫重新啟動的行為:如果 *flag* 是 :const:`False`,系統呼叫會在被訊" "號 *signalnum* 中斷時重新啟動,否則系統呼叫會被中斷。不會回傳任何東西。" -#: ../../library/signal.rst:565 +#: ../../library/signal.rst:593 msgid "See the man page :manpage:`siginterrupt(3)` for further information." msgstr "更多資訊請見 :manpage:`siginterrupt(3)` 線上手冊。" -#: ../../library/signal.rst:567 +#: ../../library/signal.rst:595 msgid "" "Note that installing a signal handler with :func:`signal` will reset the " "restart behaviour to interruptible by implicitly calling :c:func:`!" @@ -800,22 +815,21 @@ msgstr "" "請注意,使用 :func:`signal` 安裝訊號處理程式,會透過隱式呼叫 :c:func:`!" "siginterrupt` 來將重新啟動的行為重設為可中斷,且指定訊號的 *flag* 值為 true。" -#: ../../library/signal.rst:574 +#: ../../library/signal.rst:602 msgid "" "Set the handler for signal *signalnum* to the function *handler*. *handler* " "can be a callable Python object taking two arguments (see below), or one of " "the special values :const:`signal.SIG_IGN` or :const:`signal.SIG_DFL`. The " -"previous signal handler will be returned (see the description " -"of :func:`getsignal` above). (See the Unix man page :manpage:`signal(2)` " -"for further information.)" +"previous signal handler will be returned (see the description of :func:" +"`getsignal` above). (See the Unix man page :manpage:`signal(2)` for further " +"information.)" msgstr "" "將訊號 *signalnum* 的處理程式設定為函式 *handler*。*handler* 可以是帶兩個引數" -"的可呼叫 Python 物件(見下面),或是特殊值 :const:`signal.SIG_IGN` " -"或 :const:`signal.SIG_DFL` 之一。先前的訊號處理程式將會被回傳(請參閱上" -"面 :func:`getsignal` 的說明)。(更多資訊請參閱 Unix 線上手" -"冊 :manpage:`signal(2)`)。" +"的可呼叫 Python 物件(見下面),或是特殊值 :const:`signal.SIG_IGN` 或 :const:" +"`signal.SIG_DFL` 之一。先前的訊號處理程式將會被回傳(請參閱上面 :func:" +"`getsignal` 的說明)。(更多資訊請參閱 Unix 線上手冊 :manpage:`signal(2)`)。" -#: ../../library/signal.rst:585 +#: ../../library/signal.rst:613 msgid "" "The *handler* is called with two arguments: the signal number and the " "current stack frame (``None`` or a frame object; for a description of frame " @@ -826,22 +840,22 @@ msgstr "" "frame 物件;關於 frame 物件的描述,請參閱\\ :ref:`型別階層中的描述 `\\ 或 :mod:`inspect` 模組中的屬性描述)。" -#: ../../library/signal.rst:590 +#: ../../library/signal.rst:618 msgid "" -"On Windows, :func:`signal` can only be called " -"with :const:`SIGABRT`, :const:`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:`SIGTERM`, " -"or :const:`SIGBREAK`. A :exc:`ValueError` will be raised in any other case. " -"Note that not all systems define the same set of signal names; " +"On Windows, :func:`signal` can only be called with :const:`SIGABRT`, :const:" +"`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:" +"`SIGTERM`, or :const:`SIGBREAK`. A :exc:`ValueError` will be raised in any " +"other case. Note that not all systems define the same set of signal names; " "an :exc:`AttributeError` will be raised if a signal name is not defined as " "``SIG*`` module level constant." msgstr "" -"在 Windows 上,:func:`signal` 只能在使" -"用 :const:`SIGABRT`、:const:`SIGFPE`、:const:`SIGILL`、:const:`SIGINT`、:const:`SIGSEGV`、:const:`SIGTERM` " -"或 :const:`SIGBREAK` 時呼叫。在其他情況下會引發 :exc:`ValueError`。請注意,並" -"非所有系統都定義相同的訊號名稱;如果訊號名稱沒有被定義為 ``SIG*`` 模組層級常" -"數,則會引發 :exc:`AttributeError` 錯誤。" +"在 Windows 上,:func:`signal` 只能在使用 :const:`SIGABRT`、:const:`SIGFPE`、:" +"const:`SIGILL`、:const:`SIGINT`、:const:`SIGSEGV`、:const:`SIGTERM` 或 :" +"const:`SIGBREAK` 時呼叫。在其他情況下會引發 :exc:`ValueError`。請注意,並非所" +"有系統都定義相同的訊號名稱;如果訊號名稱沒有被定義為 ``SIG*`` 模組層級常數," +"則會引發 :exc:`AttributeError` 錯誤。" -#: ../../library/signal.rst:601 +#: ../../library/signal.rst:629 msgid "" "Examine the set of signals that are pending for delivery to the calling " "thread (i.e., the signals which have been raised while blocked). Return the " @@ -850,15 +864,15 @@ msgstr "" "檢查待傳送至呼叫執行緒的訊號集合(即阻檔時已被提出的訊號)。回傳待定訊號的集" "合。" -#: ../../library/signal.rst:607 +#: ../../library/signal.rst:635 msgid "See the man page :manpage:`sigpending(2)` for further information." msgstr "更多資訊請見 :manpage:`sigpending(2)` 線上手冊。" -#: ../../library/signal.rst:609 +#: ../../library/signal.rst:637 msgid "See also :func:`pause`, :func:`pthread_sigmask` and :func:`sigwait`." msgstr "另請參閱 :func:`pause`、:func:`pthread_sigmask` 與 :func:`sigwait`。" -#: ../../library/signal.rst:616 +#: ../../library/signal.rst:644 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " @@ -868,55 +882,52 @@ msgstr "" "暫停呼叫執行緒的執行,直到送出訊號集合 *sigset* 中指定的一個訊號。函式接受訊" "號(將其從待定訊號清單中移除),並回傳訊號編號。" -#: ../../library/signal.rst:622 +#: ../../library/signal.rst:650 msgid "See the man page :manpage:`sigwait(3)` for further information." msgstr "更多資訊請見 :manpage:`sigwait(3)` 線上手冊。" -#: ../../library/signal.rst:624 +#: ../../library/signal.rst:652 msgid "" -"See " -"also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:`sigwaitinfo` " -"and :func:`sigtimedwait`." +"See also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:" +"`sigwaitinfo` and :func:`sigtimedwait`." msgstr "" -"另也請" -"見 :func:`pause`、:func:`pthread_sigmask`、:func:`sigpending`、:func:`sigwaitinfo` " -"和 :func:`sigtimedwait`。" +"另也請見 :func:`pause`、:func:`pthread_sigmask`、:func:`sigpending`、:func:" +"`sigwaitinfo` 和 :func:`sigtimedwait`。" -#: ../../library/signal.rst:632 +#: ../../library/signal.rst:660 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " "signal and removes it from the pending list of signals. If one of the " "signals in *sigset* is already pending for the calling thread, the function " "will return immediately with information about that signal. The signal " -"handler is not called for the delivered signal. The function raises " -"an :exc:`InterruptedError` if it is interrupted by a signal that is not in " -"*sigset*." +"handler is not called for the delivered signal. The function raises an :exc:" +"`InterruptedError` if it is interrupted by a signal that is not in *sigset*." msgstr "" "暫停呼叫執行緒的執行,直到送出訊號集合 *sigset* 中指定的一個訊號。該函式接受" "訊號,並將其從待定訊號清單中移除。如果 *sigset* 中的一個訊號已經是呼叫執行緒" "的待定訊號,函式會立即回傳該訊號的相關資訊。對於已傳送的訊號,訊號處理程式不" -"會被呼叫。如果被不在 *sigset* 中的訊號中斷,函式會引" -"發 :exc:`InterruptedError`。" +"會被呼叫。如果被不在 *sigset* 中的訊號中斷,函式會引發 :exc:" +"`InterruptedError`。" -#: ../../library/signal.rst:641 +#: ../../library/signal.rst:669 msgid "" -"The return value is an object representing the data contained in " -"the :c:type:`siginfo_t` structure, " -"namely: :attr:`si_signo`, :attr:`si_code`, :attr:`si_errno`, :attr:`si_pid`, :attr:`si_uid`, :attr:`si_status`, :attr:`si_band`." +"The return value is an object representing the data contained in the " +"``siginfo_t`` structure, namely: ``si_signo``, ``si_code``, ``si_errno``, " +"``si_pid``, ``si_uid``, ``si_status``, ``si_band``." msgstr "" -"回傳值是一個物件,代表 :c:type:`siginfo_t` 結構所包含的資料," -"即 :attr:`si_signo`、:attr:`si_code`、:attr:`si_errno`、:attr:`si_pid`、:attr:`si_uid`、:attr:`si_status`、:attr:`si_band`。" +"回傳值是一個物件,代表 ``siginfo_t`` 結構所包含的資料,即 ``si_signo``、``si_code``、``si_errno``、" +"``si_pid``、``si_uid``、``si_status``、``si_band``。" -#: ../../library/signal.rst:648 +#: ../../library/signal.rst:675 msgid "See the man page :manpage:`sigwaitinfo(2)` for further information." msgstr "更多資訊請見 :manpage:`sigwaitinfo(2)` 線上手冊。" -#: ../../library/signal.rst:650 +#: ../../library/signal.rst:677 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigtimedwait`." msgstr "另請參閱 :func:`pause`、:func:`sigwait` 與 :func:`sigtimedwait`。" -#: ../../library/signal.rst:654 +#: ../../library/signal.rst:681 msgid "" "The function is now retried if interrupted by a signal not in *sigset* and " "the signal handler does not raise an exception (see :pep:`475` for the " @@ -925,7 +936,7 @@ msgstr "" "現在如果被不在 *sigset* 中的訊號中斷,且訊號處理程式沒有引發例外,則會重試函" "式(理由請參閱 :pep:`475`)。" -#: ../../library/signal.rst:662 +#: ../../library/signal.rst:689 msgid "" "Like :func:`sigwaitinfo`, but takes an additional *timeout* argument " "specifying a timeout. If *timeout* is specified as ``0``, a poll is " @@ -934,15 +945,15 @@ msgstr "" "類似 :func:`sigwaitinfo`,但需要額外的 *timeout* 引數指定逾時時間。如果 " "*timeout* 指定為 ``0``,會執行輪詢。如果發生逾時則會回傳 :const:`None`。" -#: ../../library/signal.rst:668 +#: ../../library/signal.rst:695 msgid "See the man page :manpage:`sigtimedwait(2)` for further information." msgstr "更多資訊請見 :manpage:`sigtimedwait(2)` 線上手冊。" -#: ../../library/signal.rst:670 +#: ../../library/signal.rst:697 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigwaitinfo`." msgstr "另請參閱 :func:`pause`、:func:`sigwait` 與 :func:`sigwaitinfo`。" -#: ../../library/signal.rst:674 +#: ../../library/signal.rst:701 msgid "" "The function is now retried with the recomputed *timeout* if interrupted by " "a signal not in *sigset* and the signal handler does not raise an exception " @@ -951,11 +962,11 @@ msgstr "" "現在如果被不在 *sigset* 中的訊號中斷,且訊號處理程式沒有引發例外,則會使用重" "新計算的 *timeout* 重試函式(理由請參閱 :pep:`475`)。" -#: ../../library/signal.rst:683 +#: ../../library/signal.rst:710 msgid "Examples" msgstr "範例" -#: ../../library/signal.rst:685 +#: ../../library/signal.rst:712 msgid "" "Here is a minimal example program. It uses the :func:`alarm` function to " "limit the time spent waiting to open a file; this is useful if the file is " @@ -969,7 +980,7 @@ msgstr "" "無限期地被擱置。解決方法是在開啟檔案前設定一個 5 秒的警報;如果操作時間過長," "警報訊號就會被送出,而處理程式會產生例外。 ::" -#: ../../library/signal.rst:692 +#: ../../library/signal.rst:719 msgid "" "import signal, os\n" "\n" @@ -1003,24 +1014,24 @@ msgstr "" "\n" "signal.alarm(0) # 停用警報" -#: ../../library/signal.rst:709 +#: ../../library/signal.rst:736 msgid "Note on SIGPIPE" msgstr "關於 SIGPIPE 的說明" -#: ../../library/signal.rst:711 +#: ../../library/signal.rst:738 msgid "" -"Piping output of your program to tools like :manpage:`head(1)` will cause " -"a :const:`SIGPIPE` signal to be sent to your process when the receiver of " -"its standard output closes early. This results in an exception " -"like :code:`BrokenPipeError: [Errno 32] Broken pipe`. To handle this case, " -"wrap your entry point to catch this exception as follows::" +"Piping output of your program to tools like :manpage:`head(1)` will cause a :" +"const:`SIGPIPE` signal to be sent to your process when the receiver of its " +"standard output closes early. This results in an exception like :code:" +"`BrokenPipeError: [Errno 32] Broken pipe`. To handle this case, wrap your " +"entry point to catch this exception as follows::" msgstr "" "將程式的輸出管道化到 :manpage:`head(1)` 之類的工具,會在你的行程的標準輸出接" -"收器提早關閉時,導致 :const:`SIGPIPE` 訊號傳送給你的行程。這會導致類" -"似 :code:`BrokenPipeError: [Errno 32] Broken pipe` 的例外。要處理這種情況,請" -"將你的進入點包裝成如下的樣子來捕捉這個例外: ::" +"收器提早關閉時,導致 :const:`SIGPIPE` 訊號傳送給你的行程。這會導致類似 :code:" +"`BrokenPipeError: [Errno 32] Broken pipe` 的例外。要處理這種情況,請將你的進" +"入點包裝成如下的樣子來捕捉這個例外: ::" -#: ../../library/signal.rst:717 +#: ../../library/signal.rst:744 msgid "" "import os\n" "import sys\n" @@ -1065,7 +1076,7 @@ msgstr "" "if __name__ == '__main__':\n" " main()" -#: ../../library/signal.rst:738 +#: ../../library/signal.rst:765 msgid "" "Do not set :const:`SIGPIPE`'s disposition to :const:`SIG_DFL` in order to " "avoid :exc:`BrokenPipeError`. Doing that would cause your program to exit " @@ -1076,11 +1087,11 @@ msgstr "" "(disposition) 設定為 :const:`SIG_DFL`。這樣做會導致你的程式在寫入任何 socket " "連線時被中斷而意外退出。" -#: ../../library/signal.rst:747 +#: ../../library/signal.rst:774 msgid "Note on Signal Handlers and Exceptions" msgstr "訊號處理程式與例外的說明" -#: ../../library/signal.rst:749 +#: ../../library/signal.rst:776 msgid "" "If a signal handler raises an exception, the exception will be propagated to " "the main thread and may be raised after any :term:`bytecode` instruction. " @@ -1092,15 +1103,15 @@ msgid "" msgstr "" "如果訊號處理程式產生例外,例外會傳送到主執行緒並可能在任何 :term:`bytecode` " "指令之後發生。最值得注意的是,:exc:`KeyboardInterrupt` 可能在執行過程中的任何" -"時候出現。大多數 Python 程式碼,包括標準函式庫,都無法避免這種情況,因" -"此 :exc:`KeyboardInterrupt`\\ (或任何其他由訊號處理程式產生的例外)可能會在" -"罕見的情況下使程式處於預期之外的狀態。" +"時候出現。大多數 Python 程式碼,包括標準函式庫,都無法避免這種情況,因此 :" +"exc:`KeyboardInterrupt`\\ (或任何其他由訊號處理程式產生的例外)可能會在罕見" +"的情況下使程式處於預期之外的狀態。" -#: ../../library/signal.rst:756 +#: ../../library/signal.rst:783 msgid "To illustrate this issue, consider the following code::" msgstr "為了說明這個問題,請參考以下程式碼: ::" -#: ../../library/signal.rst:758 +#: ../../library/signal.rst:785 msgid "" "class SpamContext:\n" " def __init__(self):\n" @@ -1132,11 +1143,11 @@ msgstr "" " ...\n" " self.lock.release()" -#: ../../library/signal.rst:773 +#: ../../library/signal.rst:800 msgid "" -"For many programs, especially those that merely want to exit " -"on :exc:`KeyboardInterrupt`, this is not a problem, but applications that " -"are complex or require high reliability should avoid raising exceptions from " +"For many programs, especially those that merely want to exit on :exc:" +"`KeyboardInterrupt`, this is not a problem, but applications that are " +"complex or require high reliability should avoid raising exceptions from " "signal handlers. They should also avoid catching :exc:`KeyboardInterrupt` as " "a means of gracefully shutting down. Instead, they should install their " "own :const:`SIGINT` handler. Below is an example of an HTTP server that " @@ -1145,11 +1156,11 @@ msgstr "" "對許多程式來說,尤其是那些只想在 :exc:`KeyboardInterrupt` 時退出的程式,這並" "不是問題,但是對於複雜或需要高可靠性的應用程式來說,應該避免從訊號處理程式產" "生例外。它們也應該避免將捕獲 :exc:`KeyboardInterrupt` 作為一種優雅關閉 " -"(gracefully shutting down) 的方式。相反地,它們應該安裝自己" -"的 :const:`SIGINT` 處理程式。以下是 HTTP 伺服器避免 :exc:`KeyboardInterrupt` " -"的範例: ::" +"(gracefully shutting down) 的方式。相反地,它們應該安裝自己的 :const:" +"`SIGINT` 處理程式。以下是 HTTP 伺服器避免 :exc:`KeyboardInterrupt` 的範" +"例: ::" -#: ../../library/signal.rst:781 +#: ../../library/signal.rst:808 msgid "" "import signal\n" "import socket\n" diff --git a/library/smtplib.po b/library/smtplib.po index e16d62ed9d3..71c0f0c5d6b 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-12 00:13+0000\n" +"POT-Creation-Date: 2025-10-15 00:16+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -125,17 +125,17 @@ msgstr "" msgid "" "An :class:`SMTP_SSL` instance behaves exactly the same as instances of :" "class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL is " -"required from the beginning of the connection and using :meth:`starttls` is " -"not appropriate. If *host* is not specified, the local host is used. If " -"*port* is zero, the standard SMTP-over-SSL port (465) is used. The optional " -"arguments *local_hostname*, *timeout* and *source_address* have the same " -"meaning as they do in the :class:`SMTP` class. *context*, also optional, " -"can contain a :class:`~ssl.SSLContext` and allows configuring various " -"aspects of the secure connection. Please read :ref:`ssl-security` for best " -"practices." +"required from the beginning of the connection and using :meth:`~SMTP." +"starttls` is not appropriate. If *host* is not specified, the local host is " +"used. If *port* is zero, the standard SMTP-over-SSL port (465) is used. The " +"optional arguments *local_hostname*, *timeout* and *source_address* have the " +"same meaning as they do in the :class:`SMTP` class. *context*, also " +"optional, can contain a :class:`~ssl.SSLContext` and allows configuring " +"various aspects of the secure connection. Please read :ref:`ssl-security` " +"for best practices." msgstr "" -#: ../../library/smtplib.rst:92 ../../library/smtplib.rst:415 +#: ../../library/smtplib.rst:92 ../../library/smtplib.rst:424 msgid "*context* was added." msgstr "新增 *context*。" @@ -155,7 +155,7 @@ msgid "" "`ValueError` to prevent the creation of a non-blocking socket" msgstr "" -#: ../../library/smtplib.rst:107 ../../library/smtplib.rst:403 +#: ../../library/smtplib.rst:107 ../../library/smtplib.rst:412 msgid "The deprecated *keyfile* and *certfile* parameters have been removed." msgstr "" @@ -163,10 +163,10 @@ msgstr "" msgid "" "The LMTP protocol, which is very similar to ESMTP, is heavily based on the " "standard SMTP client. It's common to use Unix sockets for LMTP, so our :meth:" -"`connect` method must support that as well as a regular host:port server. " -"The optional arguments *local_hostname* and *source_address* have the same " -"meaning as they do in the :class:`SMTP` class. To specify a Unix socket, you " -"must use an absolute path for *host*, starting with a '/'." +"`~SMTP.connect` method must support that as well as a regular host:port " +"server. The optional arguments *local_hostname* and *source_address* have " +"the same meaning as they do in the :class:`SMTP` class. To specify a Unix " +"socket, you must use an absolute path for *host*, starting with a '/'." msgstr "" #: ../../library/smtplib.rst:120 @@ -205,76 +205,86 @@ msgstr "" msgid "" "Base class for all exceptions that include an SMTP error code. These " "exceptions are generated in some instances when the SMTP server returns an " -"error code. The error code is stored in the :attr:`smtp_code` attribute of " -"the error, and the :attr:`smtp_error` attribute is set to the error message." +"error code." msgstr "" -#: ../../library/smtplib.rst:157 +#: ../../library/smtplib.rst:154 +msgid "The error code." +msgstr "" + +#: ../../library/smtplib.rst:158 +msgid "The error message." +msgstr "" + +#: ../../library/smtplib.rst:163 msgid "" "Sender address refused. In addition to the attributes set by on all :exc:" "`SMTPResponseException` exceptions, this sets 'sender' to the string that " "the SMTP server refused." msgstr "" -#: ../../library/smtplib.rst:164 +#: ../../library/smtplib.rst:170 +msgid "All recipient addresses refused." +msgstr "" + +#: ../../library/smtplib.rst:174 msgid "" -"All recipient addresses refused. The errors for each recipient are " -"accessible through the attribute :attr:`recipients`, which is a dictionary " -"of exactly the same sort as :meth:`SMTP.sendmail` returns." +"A dictionary of exactly the same sort as returned by :meth:`SMTP.sendmail` " +"containing the errors for each recipient." msgstr "" -#: ../../library/smtplib.rst:171 +#: ../../library/smtplib.rst:181 msgid "The SMTP server refused to accept the message data." msgstr "" -#: ../../library/smtplib.rst:176 +#: ../../library/smtplib.rst:186 msgid "Error occurred during establishment of a connection with the server." msgstr "" -#: ../../library/smtplib.rst:181 +#: ../../library/smtplib.rst:191 msgid "The server refused our ``HELO`` message." msgstr "" -#: ../../library/smtplib.rst:186 +#: ../../library/smtplib.rst:196 msgid "The command or option attempted is not supported by the server." msgstr "" -#: ../../library/smtplib.rst:193 +#: ../../library/smtplib.rst:203 msgid "" "SMTP authentication went wrong. Most probably the server didn't accept the " "username/password combination provided." msgstr "" -#: ../../library/smtplib.rst:199 +#: ../../library/smtplib.rst:209 msgid ":rfc:`821` - Simple Mail Transfer Protocol" -msgstr "" +msgstr ":rfc:`821` - 簡易郵件傳輸協定" -#: ../../library/smtplib.rst:200 +#: ../../library/smtplib.rst:210 msgid "" "Protocol definition for SMTP. This document covers the model, operating " "procedure, and protocol details for SMTP." msgstr "" -#: ../../library/smtplib.rst:203 +#: ../../library/smtplib.rst:213 msgid ":rfc:`1869` - SMTP Service Extensions" msgstr "" -#: ../../library/smtplib.rst:204 +#: ../../library/smtplib.rst:214 msgid "" "Definition of the ESMTP extensions for SMTP. This describes a framework for " "extending SMTP with new commands, supporting dynamic discovery of the " "commands provided by the server, and defines a few additional commands." msgstr "" -#: ../../library/smtplib.rst:212 +#: ../../library/smtplib.rst:222 msgid "SMTP Objects" msgstr "SMTP 物件" -#: ../../library/smtplib.rst:214 +#: ../../library/smtplib.rst:224 msgid "An :class:`SMTP` instance has the following methods:" msgstr ":class:`SMTP` 實例擁有以下方法:" -#: ../../library/smtplib.rst:219 +#: ../../library/smtplib.rst:228 msgid "" "Set the debug output level. A value of 1 or ``True`` for *level* results in " "debug messages for connection and for all messages sent to and received from " @@ -282,36 +292,36 @@ msgid "" "timestamped." msgstr "" -#: ../../library/smtplib.rst:224 +#: ../../library/smtplib.rst:233 msgid "Added debuglevel 2." msgstr "" -#: ../../library/smtplib.rst:229 +#: ../../library/smtplib.rst:238 msgid "" "Send a command *cmd* to the server. The optional argument *args* is simply " "concatenated to the command, separated by a space." msgstr "" -#: ../../library/smtplib.rst:232 +#: ../../library/smtplib.rst:241 msgid "" "This returns a 2-tuple composed of a numeric response code and the actual " "response line (multiline responses are joined into one long line.)" msgstr "" -#: ../../library/smtplib.rst:235 +#: ../../library/smtplib.rst:244 msgid "" "In normal operation it should not be necessary to call this method " "explicitly. It is used to implement other methods and may be useful for " "testing private extensions." msgstr "" -#: ../../library/smtplib.rst:239 +#: ../../library/smtplib.rst:248 msgid "" "If the connection to the server is lost while waiting for the reply, :exc:" "`SMTPServerDisconnected` will be raised." msgstr "" -#: ../../library/smtplib.rst:245 +#: ../../library/smtplib.rst:254 msgid "" "Connect to a host on a given port. The defaults are to connect to the local " "host at the standard SMTP port (25). If the hostname ends with a colon " @@ -322,7 +332,7 @@ msgid "" "connection response." msgstr "" -#: ../../library/smtplib.rst:253 +#: ../../library/smtplib.rst:262 msgid "" "Raises an :ref:`auditing event ` ``smtplib.connect`` with " "arguments ``self``, ``host``, ``port``." @@ -330,7 +340,7 @@ msgstr "" "引發一個附帶引數 ``self``、``host``、``port`` 的\\ :ref:`稽核事件 " "` ``smtplib.connect``。" -#: ../../library/smtplib.rst:258 +#: ../../library/smtplib.rst:267 msgid "" "Identify yourself to the SMTP server using ``HELO``. The hostname argument " "defaults to the fully qualified domain name of the local host. The message " @@ -338,14 +348,14 @@ msgid "" "object." msgstr "" -#: ../../library/smtplib.rst:263 +#: ../../library/smtplib.rst:272 msgid "" "In normal operation it should not be necessary to call this method " "explicitly. It will be implicitly called by the :meth:`sendmail` when " "necessary." msgstr "" -#: ../../library/smtplib.rst:269 +#: ../../library/smtplib.rst:278 msgid "" "Identify yourself to an ESMTP server using ``EHLO``. The hostname argument " "defaults to the fully qualified domain name of the local host. Examine the " @@ -357,37 +367,37 @@ msgid "" "service extensions this server supports, and their parameters (if any)." msgstr "" -#: ../../library/smtplib.rst:279 +#: ../../library/smtplib.rst:288 msgid "" "Unless you wish to use :meth:`has_extn` before sending mail, it should not " "be necessary to call this method explicitly. It will be implicitly called " "by :meth:`sendmail` when necessary." msgstr "" -#: ../../library/smtplib.rst:285 +#: ../../library/smtplib.rst:294 msgid "" "This method calls :meth:`ehlo` and/or :meth:`helo` if there has been no " "previous ``EHLO`` or ``HELO`` command this session. It tries ESMTP ``EHLO`` " "first." msgstr "" -#: ../../library/smtplib.rst:289 ../../library/smtplib.rst:318 -#: ../../library/smtplib.rst:406 ../../library/smtplib.rst:475 +#: ../../library/smtplib.rst:298 ../../library/smtplib.rst:327 +#: ../../library/smtplib.rst:415 ../../library/smtplib.rst:481 msgid ":exc:`SMTPHeloError`" msgstr ":exc:`SMTPHeloError`" -#: ../../library/smtplib.rst:290 ../../library/smtplib.rst:319 -#: ../../library/smtplib.rst:407 ../../library/smtplib.rst:476 +#: ../../library/smtplib.rst:299 ../../library/smtplib.rst:328 +#: ../../library/smtplib.rst:416 ../../library/smtplib.rst:482 msgid "The server didn't reply properly to the ``HELO`` greeting." msgstr "" -#: ../../library/smtplib.rst:294 +#: ../../library/smtplib.rst:303 msgid "" "Return :const:`True` if *name* is in the set of SMTP service extensions " "returned by the server, :const:`False` otherwise. Case is ignored." msgstr "" -#: ../../library/smtplib.rst:300 +#: ../../library/smtplib.rst:309 msgid "" "Check the validity of an address on this server using SMTP ``VRFY``. Returns " "a tuple consisting of code 250 and a full :rfc:`822` address (including " @@ -395,11 +405,11 @@ msgid "" "code of 400 or greater and an error string." msgstr "" -#: ../../library/smtplib.rst:307 +#: ../../library/smtplib.rst:316 msgid "Many sites disable SMTP ``VRFY`` in order to foil spammers." msgstr "" -#: ../../library/smtplib.rst:312 +#: ../../library/smtplib.rst:321 msgid "" "Log in on an SMTP server that requires authentication. The arguments are the " "username and the password to authenticate with. If there has been no " @@ -408,32 +418,32 @@ msgid "" "successful, or may raise the following exceptions:" msgstr "" -#: ../../library/smtplib.rst:321 +#: ../../library/smtplib.rst:330 msgid ":exc:`SMTPAuthenticationError`" msgstr ":exc:`SMTPAuthenticationError`" -#: ../../library/smtplib.rst:322 +#: ../../library/smtplib.rst:331 msgid "The server didn't accept the username/password combination." msgstr "" -#: ../../library/smtplib.rst:324 ../../library/smtplib.rst:409 -#: ../../library/smtplib.rst:485 +#: ../../library/smtplib.rst:333 ../../library/smtplib.rst:418 +#: ../../library/smtplib.rst:491 msgid ":exc:`SMTPNotSupportedError`" msgstr ":exc:`SMTPNotSupportedError`" -#: ../../library/smtplib.rst:325 +#: ../../library/smtplib.rst:334 msgid "The ``AUTH`` command is not supported by the server." msgstr "" -#: ../../library/smtplib.rst:327 +#: ../../library/smtplib.rst:336 msgid ":exc:`SMTPException`" msgstr ":exc:`SMTPException`" -#: ../../library/smtplib.rst:328 +#: ../../library/smtplib.rst:337 msgid "No suitable authentication method was found." msgstr "" -#: ../../library/smtplib.rst:330 +#: ../../library/smtplib.rst:339 msgid "" "Each of the authentication methods supported by :mod:`smtplib` are tried in " "turn if they are advertised as supported by the server. See :meth:`auth` " @@ -441,7 +451,7 @@ msgid "" "passed through to :meth:`auth`." msgstr "" -#: ../../library/smtplib.rst:335 +#: ../../library/smtplib.rst:344 msgid "" "Optional keyword argument *initial_response_ok* specifies whether, for " "authentication methods that support it, an \"initial response\" as specified " @@ -449,35 +459,35 @@ msgid "" "requiring a challenge/response." msgstr "" -#: ../../library/smtplib.rst:340 +#: ../../library/smtplib.rst:349 msgid "" ":exc:`SMTPNotSupportedError` may be raised, and the *initial_response_ok* " "parameter was added." msgstr "" -#: ../../library/smtplib.rst:347 +#: ../../library/smtplib.rst:356 msgid "" "Issue an ``SMTP`` ``AUTH`` command for the specified authentication " "*mechanism*, and handle the challenge response via *authobject*." msgstr "" -#: ../../library/smtplib.rst:350 +#: ../../library/smtplib.rst:359 msgid "" "*mechanism* specifies which authentication mechanism is to be used as " "argument to the ``AUTH`` command; the valid values are those listed in the " "``auth`` element of :attr:`esmtp_features`." msgstr "" -#: ../../library/smtplib.rst:354 +#: ../../library/smtplib.rst:363 msgid "" "*authobject* must be a callable object taking an optional single argument::" msgstr "" -#: ../../library/smtplib.rst:356 +#: ../../library/smtplib.rst:365 msgid "data = authobject(challenge=None)" msgstr "data = authobject(challenge=None)" -#: ../../library/smtplib.rst:358 +#: ../../library/smtplib.rst:367 msgid "" "If optional keyword argument *initial_response_ok* is true, ``authobject()`` " "will be called first with no argument. It can return the :rfc:`4954` " @@ -488,7 +498,7 @@ msgid "" "false, then ``authobject()`` will not be called first with ``None``." msgstr "" -#: ../../library/smtplib.rst:366 +#: ../../library/smtplib.rst:375 msgid "" "If the initial response check returns ``None``, or if *initial_response_ok* " "is false, ``authobject()`` will be called to process the server's challenge " @@ -497,7 +507,7 @@ msgid "" "the server." msgstr "" -#: ../../library/smtplib.rst:372 +#: ../../library/smtplib.rst:381 msgid "" "The ``SMTP`` class provides ``authobjects`` for the ``CRAM-MD5``, ``PLAIN``, " "and ``LOGIN`` mechanisms; they are named ``SMTP.auth_cram_md5``, ``SMTP." @@ -506,7 +516,7 @@ msgid "" "appropriate values." msgstr "" -#: ../../library/smtplib.rst:378 +#: ../../library/smtplib.rst:387 msgid "" "User code does not normally need to call ``auth`` directly, but can instead " "call the :meth:`login` method, which will try each of the above mechanisms " @@ -515,57 +525,57 @@ msgid "" "by :mod:`smtplib`." msgstr "" -#: ../../library/smtplib.rst:389 +#: ../../library/smtplib.rst:398 msgid "" "Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP " "commands that follow will be encrypted. You should then call :meth:`ehlo` " "again." msgstr "" -#: ../../library/smtplib.rst:393 +#: ../../library/smtplib.rst:402 msgid "" "If *keyfile* and *certfile* are provided, they are used to create an :class:" "`ssl.SSLContext`." msgstr "" -#: ../../library/smtplib.rst:396 +#: ../../library/smtplib.rst:405 msgid "" "Optional *context* parameter is an :class:`ssl.SSLContext` object; This is " "an alternative to using a keyfile and a certfile and if specified both " "*keyfile* and *certfile* should be ``None``." msgstr "" -#: ../../library/smtplib.rst:400 +#: ../../library/smtplib.rst:409 msgid "" "If there has been no previous ``EHLO`` or ``HELO`` command this session, " "this method tries ESMTP ``EHLO`` first." msgstr "" -#: ../../library/smtplib.rst:410 +#: ../../library/smtplib.rst:419 msgid "The server does not support the STARTTLS extension." msgstr "" -#: ../../library/smtplib.rst:412 +#: ../../library/smtplib.rst:421 msgid ":exc:`RuntimeError`" msgstr ":exc:`RuntimeError`" -#: ../../library/smtplib.rst:413 +#: ../../library/smtplib.rst:422 msgid "SSL/TLS support is not available to your Python interpreter." msgstr "" -#: ../../library/smtplib.rst:418 +#: ../../library/smtplib.rst:427 msgid "" -"The method now supports hostname check with :attr:`SSLContext." +"The method now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indicator* (see :const:`~ssl.HAS_SNI`)." msgstr "" -#: ../../library/smtplib.rst:423 +#: ../../library/smtplib.rst:432 msgid "" "The error raised for lack of STARTTLS support is now the :exc:" "`SMTPNotSupportedError` subclass instead of the base :exc:`SMTPException`." msgstr "" -#: ../../library/smtplib.rst:431 +#: ../../library/smtplib.rst:440 msgid "" "Send mail. The required arguments are an :rfc:`822` from-address string, a " "list of :rfc:`822` to-address strings (a bare string will be treated as a " @@ -574,18 +584,18 @@ msgid "" "*mail_options*. ESMTP options (such as ``DSN`` commands) that should be used " "with all ``RCPT`` commands can be passed as *rcpt_options*. (If you need to " "use different ESMTP options to different recipients you have to use the low-" -"level methods such as :meth:`mail`, :meth:`rcpt` and :meth:`data` to send " +"level methods such as :meth:`!mail`, :meth:`!rcpt` and :meth:`!data` to send " "the message.)" msgstr "" -#: ../../library/smtplib.rst:442 +#: ../../library/smtplib.rst:451 msgid "" "The *from_addr* and *to_addrs* parameters are used to construct the message " "envelope used by the transport agents. ``sendmail`` does not modify the " "message headers in any way." msgstr "" -#: ../../library/smtplib.rst:446 +#: ../../library/smtplib.rst:455 msgid "" "*msg* may be a string containing characters in the ASCII range, or a byte " "string. A string is encoded to bytes using the ascii codec, and lone " @@ -593,7 +603,7 @@ msgid "" "byte string is not modified." msgstr "" -#: ../../library/smtplib.rst:451 +#: ../../library/smtplib.rst:460 msgid "" "If there has been no previous ``EHLO`` or ``HELO`` command this session, " "this method tries ESMTP ``EHLO`` first. If the server does ESMTP, message " @@ -602,7 +612,7 @@ msgid "" "will be tried and ESMTP options suppressed." msgstr "" -#: ../../library/smtplib.rst:457 +#: ../../library/smtplib.rst:466 msgid "" "This method will return normally if the mail is accepted for at least one " "recipient. Otherwise it will raise an exception. That is, if this method " @@ -612,69 +622,65 @@ msgid "" "SMTP error code and the accompanying error message sent by the server." msgstr "" -#: ../../library/smtplib.rst:464 +#: ../../library/smtplib.rst:473 msgid "" "If ``SMTPUTF8`` is included in *mail_options*, and the server supports it, " "*from_addr* and *to_addrs* may contain non-ASCII characters." msgstr "" -#: ../../library/smtplib.rst:467 +#: ../../library/smtplib.rst:476 msgid "This method may raise the following exceptions:" msgstr "" -#: ../../library/smtplib.rst:469 +#: ../../library/smtplib.rst:478 msgid ":exc:`SMTPRecipientsRefused`" msgstr ":exc:`SMTPRecipientsRefused`" -#: ../../library/smtplib.rst:470 -msgid "" -"All recipients were refused. Nobody got the mail. The :attr:`recipients` " -"attribute of the exception object is a dictionary with information about the " -"refused recipients (like the one returned when at least one recipient was " -"accepted)." +#: ../../library/smtplib.rst:479 +msgid "All recipients were refused. Nobody got the mail." msgstr "" -#: ../../library/smtplib.rst:478 +#: ../../library/smtplib.rst:484 msgid ":exc:`SMTPSenderRefused`" msgstr ":exc:`SMTPSenderRefused`" -#: ../../library/smtplib.rst:479 +#: ../../library/smtplib.rst:485 msgid "The server didn't accept the *from_addr*." msgstr "" -#: ../../library/smtplib.rst:481 +#: ../../library/smtplib.rst:487 msgid ":exc:`SMTPDataError`" msgstr ":exc:`SMTPDataError`" -#: ../../library/smtplib.rst:482 +#: ../../library/smtplib.rst:488 msgid "" "The server replied with an unexpected error code (other than a refusal of a " "recipient)." msgstr "" -#: ../../library/smtplib.rst:486 +#: ../../library/smtplib.rst:492 msgid "" "``SMTPUTF8`` was given in the *mail_options* but is not supported by the " "server." msgstr "" -#: ../../library/smtplib.rst:489 +#: ../../library/smtplib.rst:495 msgid "" "Unless otherwise noted, the connection will be open even after an exception " "is raised." msgstr "" -#: ../../library/smtplib.rst:492 +#: ../../library/smtplib.rst:498 msgid "*msg* may be a byte string." msgstr "" -#: ../../library/smtplib.rst:495 +#: ../../library/smtplib.rst:501 msgid "" "``SMTPUTF8`` support added, and :exc:`SMTPNotSupportedError` may be raised " "if ``SMTPUTF8`` is specified but the server does not support it." msgstr "" -#: ../../library/smtplib.rst:503 +#: ../../library/smtplib.rst:509 msgid "" "This is a convenience method for calling :meth:`sendmail` with the message " "represented by an :class:`email.message.Message` object. The arguments have " @@ -682,7 +688,7 @@ msgid "" "object." msgstr "" -#: ../../library/smtplib.rst:508 +#: ../../library/smtplib.rst:514 msgid "" "If *from_addr* is ``None`` or *to_addrs* is ``None``, ``send_message`` fills " "those arguments with addresses extracted from the headers of *msg* as " @@ -697,7 +703,7 @@ msgid "" "most recent set of :mailheader:`Resent-` headers." msgstr "" -#: ../../library/smtplib.rst:520 +#: ../../library/smtplib.rst:526 msgid "" "``send_message`` serializes *msg* using :class:`~email.generator." "BytesGenerator` with ``\\r\\n`` as the *linesep*, and calls :meth:`sendmail` " @@ -712,17 +718,17 @@ msgid "" "``BODY=8BITMIME`` are added to *mail_options*." msgstr "" -#: ../../library/smtplib.rst:534 +#: ../../library/smtplib.rst:540 msgid "Support for internationalized addresses (``SMTPUTF8``)." msgstr "" -#: ../../library/smtplib.rst:540 +#: ../../library/smtplib.rst:546 msgid "" "Terminate the SMTP session and close the connection. Return the result of " "the SMTP ``QUIT`` command." msgstr "" -#: ../../library/smtplib.rst:544 +#: ../../library/smtplib.rst:550 msgid "" "Low-level methods corresponding to the standard SMTP/ESMTP commands " "``HELP``, ``RSET``, ``NOOP``, ``MAIL``, ``RCPT``, and ``DATA`` are also " @@ -730,11 +736,35 @@ msgid "" "documented here. For details, consult the module code." msgstr "" -#: ../../library/smtplib.rst:553 +#: ../../library/smtplib.rst:555 +msgid "Additionally, an SMTP instance has the following attributes:" +msgstr "此外,SMTP 實例擁有以下屬性:" + +#: ../../library/smtplib.rst:560 +msgid "The response to the ``HELO`` command, see :meth:`helo`." +msgstr "" + +#: ../../library/smtplib.rst:565 +msgid "The response to the ``EHLO`` command, see :meth:`ehlo`." +msgstr "" + +#: ../../library/smtplib.rst:570 +msgid "" +"A boolean value indicating whether the server supports ESMTP, see :meth:" +"`ehlo`." +msgstr "" + +#: ../../library/smtplib.rst:576 +msgid "" +"A dictionary of the names of SMTP service extensions supported by the " +"server, see :meth:`ehlo`." +msgstr "" + +#: ../../library/smtplib.rst:583 msgid "SMTP Example" msgstr "SMTP 範例" -#: ../../library/smtplib.rst:555 +#: ../../library/smtplib.rst:585 msgid "" "This example prompts the user for addresses needed in the message envelope " "('To' and 'From' addresses), and the message to be delivered. Note that the " @@ -744,7 +774,7 @@ msgid "" "headers explicitly::" msgstr "" -#: ../../library/smtplib.rst:561 +#: ../../library/smtplib.rst:591 msgid "" "import smtplib\n" "\n" @@ -774,7 +804,7 @@ msgid "" "server.quit()" msgstr "" -#: ../../library/smtplib.rst:590 +#: ../../library/smtplib.rst:620 msgid "" "In general, you will want to use the :mod:`email` package's features to " "construct an email message, which you can then send via :meth:`~smtplib.SMTP." @@ -791,4 +821,4 @@ msgstr "protocol(協定)" #: ../../library/smtplib.rst:11 msgid "Simple Mail Transfer Protocol" -msgstr "Simple Mail Transfer Protocol(簡單郵件傳輸協定)" +msgstr "Simple Mail Transfer Protocol(簡易郵件傳輸協定)" diff --git a/library/sqlite3.po b/library/sqlite3.po index 027f5d04322..644dd1f93b2 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-08 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,8 +38,8 @@ msgstr "" #: ../../library/sqlite3.rst:32 msgid "" "The :mod:`!sqlite3` module was written by Gerhard Häring. It provides an " -"SQL interface compliant with the DB-API 2.0 specification described " -"by :pep:`249`, and requires SQLite 3.15.2 or newer." +"SQL interface compliant with the DB-API 2.0 specification described by :pep:" +"`249`, and requires SQLite 3.15.2 or newer." msgstr "" #: ../../library/sqlite3.rst:36 @@ -128,8 +128,8 @@ msgstr "" #: ../../library/sqlite3.rst:89 msgid "" "In order to execute SQL statements and fetch results from SQL queries, we " -"will need to use a database cursor. Call :meth:`con.cursor() " -"` to create the :class:`Cursor`:" +"will need to use a database cursor. Call :meth:`con.cursor() ` to create the :class:`Cursor`:" msgstr "" #: ../../library/sqlite3.rst:93 @@ -142,8 +142,8 @@ msgid "" "database table ``movie`` with columns for title, release year, and review " "score. For simplicity, we can just use column names in the table declaration " "-- thanks to the `flexible typing`_ feature of SQLite, specifying the data " -"types is optional. Execute the ``CREATE TABLE`` statement by " -"calling :meth:`cur.execute(...) `:" +"types is optional. Execute the ``CREATE TABLE`` statement by calling :meth:" +"`cur.execute(...) `:" msgstr "" #: ../../library/sqlite3.rst:106 @@ -155,9 +155,9 @@ msgid "" "We can verify that the new table has been created by querying the " "``sqlite_master`` table built-in to SQLite, which should now contain an " "entry for the ``movie`` table definition (see `The Schema Table`_ for " -"details). Execute that query by calling :meth:`cur.execute(...) " -"`, assign the result to ``res``, and " -"call :meth:`res.fetchone() ` to fetch the resulting row:" +"details). Execute that query by calling :meth:`cur.execute(...) `, assign the result to ``res``, and call :meth:`res.fetchone() " +"` to fetch the resulting row:" msgstr "" #: ../../library/sqlite3.rst:121 @@ -172,10 +172,9 @@ msgstr "" #: ../../library/sqlite3.rst:127 msgid "" -"We can see that the table has been created, as the query returns " -"a :class:`tuple` containing the table's name. If we query ``sqlite_master`` " -"for a non-existent table ``spam``, :meth:`!res.fetchone` will return " -"``None``:" +"We can see that the table has been created, as the query returns a :class:" +"`tuple` containing the table's name. If we query ``sqlite_master`` for a non-" +"existent table ``spam``, :meth:`!res.fetchone` will return ``None``:" msgstr "" #: ../../library/sqlite3.rst:132 @@ -191,8 +190,8 @@ msgstr "" #: ../../library/sqlite3.rst:138 msgid "" "Now, add two rows of data supplied as SQL literals by executing an " -"``INSERT`` statement, once again by calling :meth:`cur.execute(...) " -"`:" +"``INSERT`` statement, once again by calling :meth:`cur.execute(...) `:" msgstr "" #: ../../library/sqlite3.rst:142 @@ -213,8 +212,8 @@ msgstr "" msgid "" "The ``INSERT`` statement implicitly opens a transaction, which needs to be " "committed before changes are saved in the database (see :ref:`sqlite3-" -"controlling-transactions` for details). Call :meth:`con.commit() " -"` on the connection object to commit the transaction:" +"controlling-transactions` for details). Call :meth:`con.commit() ` on the connection object to commit the transaction:" msgstr "" #: ../../library/sqlite3.rst:156 @@ -225,8 +224,8 @@ msgstr "con.commit()" msgid "" "We can verify that the data was inserted correctly by executing a ``SELECT`` " "query. Use the now-familiar :meth:`cur.execute(...) ` to " -"assign the result to ``res``, and call :meth:`res.fetchall() " -"` to return all resulting rows:" +"assign the result to ``res``, and call :meth:`res.fetchall() ` to return all resulting rows:" msgstr "" #: ../../library/sqlite3.rst:166 @@ -247,8 +246,8 @@ msgstr "" #: ../../library/sqlite3.rst:175 msgid "" -"Now, insert three more rows by calling :meth:`cur.executemany(...) " -"`:" +"Now, insert three more rows by calling :meth:`cur.executemany(...) `:" msgstr "" #: ../../library/sqlite3.rst:178 @@ -304,10 +303,9 @@ msgstr "" #: ../../library/sqlite3.rst:211 msgid "" -"Finally, verify that the database has been written to disk by " -"calling :meth:`con.close() ` to close the existing " -"connection, opening a new one, creating a new cursor, then querying the " -"database:" +"Finally, verify that the database has been written to disk by calling :meth:" +"`con.close() ` to close the existing connection, opening a " +"new one, creating a new cursor, then querying the database:" msgstr "" #: ../../library/sqlite3.rst:216 @@ -396,9 +394,9 @@ msgstr "" #: ../../library/sqlite3.rst:277 msgid "" -"How many seconds the connection should wait before raising " -"an :exc:`OperationalError` when a table is locked. If another connection " -"opens a transaction to modify a table, that table will be locked until the " +"How many seconds the connection should wait before raising an :exc:" +"`OperationalError` when a table is locked. If another connection opens a " +"transaction to modify a table, that table will be locked until the " "transaction is committed. Default five seconds." msgstr "" @@ -407,20 +405,19 @@ msgid "" "Control whether and how data types not :ref:`natively supported by SQLite " "` are looked up to be converted to Python types, using the " "converters registered with :func:`register_converter`. Set it to any " -"combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` " -"and :const:`PARSE_COLNAMES` to enable this. Column names takes precedence " -"over declared types if both flags are set. By default (``0``), type " -"detection is disabled." +"combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` and :const:" +"`PARSE_COLNAMES` to enable this. Column names takes precedence over declared " +"types if both flags are set. By default (``0``), type detection is disabled." msgstr "" #: ../../library/sqlite3.rst:295 msgid "" -"Control legacy transaction handling behaviour. " -"See :attr:`Connection.isolation_level` and :ref:`sqlite3-transaction-control-" -"isolation-level` for more information. Can be ``\"DEFERRED\"`` (default), " -"``\"EXCLUSIVE\"`` or ``\"IMMEDIATE\"``; or ``None`` to disable opening " -"transactions implicitly. Has no effect unless :attr:`Connection.autocommit` " -"is set to :const:`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." +"Control legacy transaction handling behaviour. See :attr:`Connection." +"isolation_level` and :ref:`sqlite3-transaction-control-isolation-level` for " +"more information. Can be ``\"DEFERRED\"`` (default), ``\"EXCLUSIVE\"`` or " +"``\"IMMEDIATE\"``; or ``None`` to disable opening transactions implicitly. " +"Has no effect unless :attr:`Connection.autocommit` is set to :const:" +"`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." msgstr "" #: ../../library/sqlite3.rst:305 @@ -455,11 +452,11 @@ msgstr "" #: ../../library/sqlite3.rst:332 msgid "" -"Control :pep:`249` transaction handling behaviour. " -"See :attr:`Connection.autocommit` and :ref:`sqlite3-transaction-control-" -"autocommit` for more information. *autocommit* currently defaults " -"to :const:`~sqlite3.LEGACY_TRANSACTION_CONTROL`. The default will change to " -"``False`` in a future Python release." +"Control :pep:`249` transaction handling behaviour. See :attr:`Connection." +"autocommit` and :ref:`sqlite3-transaction-control-autocommit` for more " +"information. *autocommit* currently defaults to :const:`~sqlite3." +"LEGACY_TRANSACTION_CONTROL`. The default will change to ``False`` in a " +"future Python release." msgstr "" #: ../../library/sqlite3.rst:0 @@ -471,8 +468,8 @@ msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect`` with argument " "``database``." msgstr "" -"引發一個附帶引數 ``database`` 的\\ :ref:`稽核事件 ` " -"``sqlite3.connect``。" +"引發一個附帶引數 ``database`` 的\\ :ref:`稽核事件 ` ``sqlite3." +"connect``。" #: ../../library/sqlite3.rst:344 msgid "" @@ -620,8 +617,8 @@ msgstr "" #: ../../library/sqlite3.rst:459 msgid "" -"Generated fields (for example ``MAX(p)``) are returned as :class:`str`. " -"Use :const:`!PARSE_COLNAMES` to enforce types for such queries." +"Generated fields (for example ``MAX(p)``) are returned as :class:`str`. Use :" +"const:`!PARSE_COLNAMES` to enforce types for such queries." msgstr "" #: ../../library/sqlite3.rst:464 @@ -688,8 +685,8 @@ msgstr "" #: ../../library/sqlite3.rst:510 msgid "" -"Version number of the runtime SQLite library as a :class:`tuple` " -"of :class:`integers `." +"Version number of the runtime SQLite library as a :class:`tuple` of :class:" +"`integers `." msgstr "" #: ../../library/sqlite3.rst:515 @@ -787,8 +784,8 @@ msgstr "" #: ../../library/sqlite3.rst:569 msgid "" -"These constants are used for the :meth:`Connection.setconfig` " -"and :meth:`~Connection.getconfig` methods." +"These constants are used for the :meth:`Connection.setconfig` and :meth:" +"`~Connection.getconfig` methods." msgstr "" #: ../../library/sqlite3.rst:572 @@ -816,9 +813,8 @@ msgstr "Connection 物件" #: ../../library/sqlite3.rst:592 msgid "" "Each open SQLite database is represented by a ``Connection`` object, which " -"is created using :func:`sqlite3.connect`. Their main purpose is " -"creating :class:`Cursor` objects, and :ref:`sqlite3-controlling-" -"transactions`." +"is created using :func:`sqlite3.connect`. Their main purpose is creating :" +"class:`Cursor` objects, and :ref:`sqlite3-controlling-transactions`." msgstr "" #: ../../library/sqlite3.rst:599 @@ -827,8 +823,8 @@ msgstr ":ref:`sqlite3-connection-shortcuts`" #: ../../library/sqlite3.rst:605 msgid "" -"A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before " -"a :class:`!Connection` object is deleted." +"A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before a :" +"class:`!Connection` object is deleted." msgstr "" #: ../../library/sqlite3.rst:608 @@ -838,9 +834,8 @@ msgstr "一個 SQLite 資料庫連線具有以下屬性和方法:" #: ../../library/sqlite3.rst:612 msgid "" "Create and return a :class:`Cursor` object. The cursor method accepts a " -"single optional parameter *factory*. If supplied, this must be " -"a :term:`callable` returning an instance of :class:`Cursor` or its " -"subclasses." +"single optional parameter *factory*. If supplied, this must be a :term:" +"`callable` returning an instance of :class:`Cursor` or its subclasses." msgstr "" #: ../../library/sqlite3.rst:619 @@ -858,7 +853,7 @@ msgid "The name of the column where the blob is located." msgstr "" #: ../../library/sqlite3.rst:628 -msgid "The name of the row where the blob is located." +msgid "The row id where the blob is located." msgstr "" #: ../../library/sqlite3.rst:631 @@ -889,17 +884,17 @@ msgstr "" #: ../../library/sqlite3.rst:654 msgid "" "Commit any pending transaction to the database. If :attr:`autocommit` is " -"``True``, or there is no open transaction, this method does nothing. " -"If :attr:`!autocommit` is ``False``, a new transaction is implicitly opened " -"if a pending transaction was committed by this method." +"``True``, or there is no open transaction, this method does nothing. If :" +"attr:`!autocommit` is ``False``, a new transaction is implicitly opened if a " +"pending transaction was committed by this method." msgstr "" #: ../../library/sqlite3.rst:662 msgid "" "Roll back to the start of any pending transaction. If :attr:`autocommit` is " -"``True``, or there is no open transaction, this method does nothing. " -"If :attr:`!autocommit` is ``False``, a new transaction is implicitly opened " -"if a pending transaction was rolled back by this method." +"``True``, or there is no open transaction, this method does nothing. If :" +"attr:`!autocommit` is ``False``, a new transaction is implicitly opened if a " +"pending transaction was rolled back by this method." msgstr "" #: ../../library/sqlite3.rst:670 @@ -1270,17 +1265,17 @@ msgstr "" #: ../../library/sqlite3.rst:935 msgid "" "Call this method from a different thread to abort any queries that might be " -"executing on the connection. Aborted queries will raise " -"an :exc:`OperationalError`." +"executing on the connection. Aborted queries will raise an :exc:" +"`OperationalError`." msgstr "" #: ../../library/sqlite3.rst:942 msgid "" "Register :term:`callable` *authorizer_callback* to be invoked for each " "attempt to access a column of a table in the database. The callback should " -"return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, " -"or :const:`SQLITE_IGNORE` to signal how access to the column should be " -"handled by the underlying SQLite library." +"return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, or :const:" +"`SQLITE_IGNORE` to signal how access to the column should be handled by the " +"underlying SQLite library." msgstr "" #: ../../library/sqlite3.rst:949 @@ -1352,11 +1347,10 @@ msgstr "" msgid "" "The only argument passed to the callback is the statement (as :class:`str`) " "that is being executed. The return value of the callback is ignored. Note " -"that the backend does not only run statements passed to " -"the :meth:`Cursor.execute` methods. Other sources include " -"the :ref:`transaction management ` of " -"the :mod:`!sqlite3` module and the execution of triggers defined in the " -"current database." +"that the backend does not only run statements passed to the :meth:`Cursor." +"execute` methods. Other sources include the :ref:`transaction management " +"` of the :mod:`!sqlite3` module and the " +"execution of triggers defined in the current database." msgstr "" #: ../../library/sqlite3.rst:1002 @@ -1390,8 +1384,8 @@ msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " "are compiled without this feature. To get loadable extension support, you " -"must pass the :option:`--enable-loadable-sqlite-extensions` option " -"to :program:`configure`." +"must pass the :option:`--enable-loadable-sqlite-extensions` option to :" +"program:`configure`." msgstr "" #: ../../library/sqlite3.rst:1035 @@ -1472,8 +1466,8 @@ msgstr "新增 *entrypoint* 參數。" #: ../../library/sqlite3.rst:1102 msgid "" "Return an :term:`iterator` to dump the database as SQL source code. Useful " -"when saving an in-memory database for later restoration. Similar to the " -"``.dump`` command in the :program:`sqlite3` shell." +"when saving an in-memory database for later restoration. Similar to the ``." +"dump`` command in the :program:`sqlite3` shell." msgstr "" #: ../../library/sqlite3.rst:1106 @@ -1600,8 +1594,8 @@ msgstr "" #: ../../library/sqlite3.rst:1214 msgid "" -"Example, query the maximum length of an SQL statement " -"for :class:`Connection` ``con`` (the default is 1000000000):" +"Example, query the maximum length of an SQL statement for :class:" +"`Connection` ``con`` (the default is 1000000000):" msgstr "" #: ../../library/sqlite3.rst:1224 @@ -1686,10 +1680,10 @@ msgstr "" #: ../../library/sqlite3.rst:1318 msgid "" -"Deserialize a :meth:`serialized ` database into " -"a :class:`Connection`. This method causes the database connection to " -"disconnect from database *name*, and reopen *name* as an in-memory database " -"based on the serialization contained in *data*." +"Deserialize a :meth:`serialized ` database into a :class:" +"`Connection`. This method causes the database connection to disconnect from " +"database *name*, and reopen *name* as an in-memory database based on the " +"serialization contained in *data*." msgstr "" #: ../../library/sqlite3.rst:1324 @@ -1728,9 +1722,9 @@ msgstr "" #: ../../library/sqlite3.rst:1353 msgid "" -"``False``: Select :pep:`249`-compliant transaction behaviour, implying " -"that :mod:`!sqlite3` ensures a transaction is always open. " -"Use :meth:`commit` and :meth:`rollback` to close transactions." +"``False``: Select :pep:`249`-compliant transaction behaviour, implying that :" +"mod:`!sqlite3` ensures a transaction is always open. Use :meth:`commit` and :" +"meth:`rollback` to close transactions." msgstr "" #: ../../library/sqlite3.rst:1357 @@ -1739,8 +1733,8 @@ msgstr "" #: ../../library/sqlite3.rst:1359 msgid "" -"``True``: Use SQLite's `autocommit mode`_. :meth:`commit` " -"and :meth:`rollback` have no effect in this mode." +"``True``: Use SQLite's `autocommit mode`_. :meth:`commit` and :meth:" +"`rollback` have no effect in this mode." msgstr "" #: ../../library/sqlite3.rst:1362 @@ -1765,8 +1759,8 @@ msgstr "更多詳情請見 :ref:`sqlite3-transaction-control-autocommit`。" #: ../../library/sqlite3.rst:1375 msgid "" -"The :attr:`isolation_level` attribute has no effect " -"unless :attr:`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." +"The :attr:`isolation_level` attribute has no effect unless :attr:" +"`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." msgstr "" #: ../../library/sqlite3.rst:1382 @@ -1808,14 +1802,14 @@ msgstr "" #: ../../library/sqlite3.rst:1412 msgid "" "The initial :attr:`~Cursor.row_factory` for :class:`Cursor` objects created " -"from this connection. Assigning to this attribute does not affect " -"the :attr:`!row_factory` of existing cursors belonging to this connection, " -"only new ones. Is ``None`` by default, meaning each row is returned as " -"a :class:`tuple`." +"from this connection. Assigning to this attribute does not affect the :attr:" +"`!row_factory` of existing cursors belonging to this connection, only new " +"ones. Is ``None`` by default, meaning each row is returned as a :class:" +"`tuple`." msgstr "" -#: ../../library/sqlite3.rst:1419 ../../library/sqlite3.rst:1705 -#: ../../library/sqlite3.rst:1728 +#: ../../library/sqlite3.rst:1419 ../../library/sqlite3.rst:1711 +#: ../../library/sqlite3.rst:1734 msgid "See :ref:`sqlite3-howto-row-factory` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-row-factory`。" @@ -1844,15 +1838,15 @@ msgstr "Cursor 物件" msgid "" "A ``Cursor`` object represents a `database cursor`_ which is used to execute " "SQL statements, and manage the context of a fetch operation. Cursors are " -"created using :meth:`Connection.cursor`, or by using any of " -"the :ref:`connection shortcut methods `." +"created using :meth:`Connection.cursor`, or by using any of the :ref:" +"`connection shortcut methods `." msgstr "" #: ../../library/sqlite3.rst:1448 msgid "" -"Cursor objects are :term:`iterators `, meaning that if " -"you :meth:`~Cursor.execute` a ``SELECT`` query, you can simply iterate over " -"the cursor to fetch the resulting rows:" +"Cursor objects are :term:`iterators `, meaning that if you :meth:" +"`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " +"to fetch the resulting rows:" msgstr "" #: ../../library/sqlite3.rst:1459 @@ -1869,8 +1863,8 @@ msgstr ":class:`Cursor` 實例具有以下屬性和方法。" #: ../../library/sqlite3.rst:1480 msgid "" -"Execute a single SQL statement, optionally binding Python values " -"using :ref:`placeholders `." +"Execute a single SQL statement, optionally binding Python values using :ref:" +"`placeholders `." msgstr "" #: ../../library/sqlite3.rst:1484 @@ -1893,18 +1887,17 @@ msgstr "" #: ../../library/sqlite3.rst:1499 msgid "" -"If :attr:`~Connection.autocommit` " -"is :data:`LEGACY_TRANSACTION_CONTROL`, :attr:`~Connection.isolation_level` " -"is not ``None``, *sql* is an ``INSERT``, ``UPDATE``, ``DELETE``, or " -"``REPLACE`` statement, and there is no open transaction, a transaction is " -"implicitly opened before executing *sql*." +"If :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`, :" +"attr:`~Connection.isolation_level` is not ``None``, *sql* is an ``INSERT``, " +"``UPDATE``, ``DELETE``, or ``REPLACE`` statement, and there is no open " +"transaction, a transaction is implicitly opened before executing *sql*." msgstr "" #: ../../library/sqlite3.rst:1508 msgid "" ":exc:`ProgrammingError` is emitted if :ref:`named placeholders ` are used and *parameters* is a sequence instead of " -"a :class:`dict`." +"placeholders>` are used and *parameters* is a sequence instead of a :class:" +"`dict`." msgstr "" #: ../../library/sqlite3.rst:1512 @@ -1970,11 +1963,11 @@ msgstr "" #: ../../library/sqlite3.rst:1568 msgid "" -"Execute the SQL statements in *sql_script*. If " -"the :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and " -"there is a pending transaction, an implicit ``COMMIT`` statement is executed " -"first. No other implicit transaction control is performed; any transaction " -"control must be added to *sql_script*." +"Execute the SQL statements in *sql_script*. If the :attr:`~Connection." +"autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and there is a pending " +"transaction, an implicit ``COMMIT`` statement is executed first. No other " +"implicit transaction control is performed; any transaction control must be " +"added to *sql_script*." msgstr "" #: ../../library/sqlite3.rst:1576 @@ -2030,44 +2023,52 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:1617 +#: ../../library/sqlite3.rst:1615 +msgid "Negative *size* values are rejected by raising :exc:`ValueError`." +msgstr "" + +#: ../../library/sqlite3.rst:1620 msgid "" "Return all (remaining) rows of a query result as a :class:`list`. Return an " "empty list if no rows are available. Note that the :attr:`arraysize` " "attribute can affect the performance of this operation." msgstr "" -#: ../../library/sqlite3.rst:1624 +#: ../../library/sqlite3.rst:1627 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:1626 +#: ../../library/sqlite3.rst:1629 msgid "" -"The cursor will be unusable from this point forward; " -"a :exc:`ProgrammingError` exception will be raised if any operation is " -"attempted with the cursor." +"The cursor will be unusable from this point forward; a :exc:" +"`ProgrammingError` exception will be raised if any operation is attempted " +"with the cursor." msgstr "" -#: ../../library/sqlite3.rst:1631 ../../library/sqlite3.rst:1635 +#: ../../library/sqlite3.rst:1634 ../../library/sqlite3.rst:1638 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:1639 +#: ../../library/sqlite3.rst:1642 msgid "" -"Read/write attribute that controls the number of rows returned " -"by :meth:`fetchmany`. The default value is 1 which means a single row would " -"be fetched per call." +"Read/write attribute that controls the number of rows returned by :meth:" +"`fetchmany`. The default value is 1 which means a single row would be " +"fetched per call." msgstr "" -#: ../../library/sqlite3.rst:1644 +#: ../../library/sqlite3.rst:1645 +msgid "Negative values are rejected by raising :exc:`ValueError`." +msgstr "" + +#: ../../library/sqlite3.rst:1650 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " -"belonging to the cursor. A :class:`Cursor` object created by " -"calling :meth:`con.cursor() ` will have " -"a :attr:`connection` attribute that refers to *con*:" +"belonging to the cursor. A :class:`Cursor` object created by calling :meth:" +"`con.cursor() ` will have a :attr:`connection` attribute " +"that refers to *con*:" msgstr "" -#: ../../library/sqlite3.rst:1649 +#: ../../library/sqlite3.rst:1655 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> cur = con.cursor()\n" @@ -2081,18 +2082,18 @@ msgstr "" "True\n" ">>> con.close()" -#: ../../library/sqlite3.rst:1659 +#: ../../library/sqlite3.rst:1665 msgid "" "Read-only attribute that provides the column names of the last query. To " "remain compatible with the Python DB API, it returns a 7-tuple for each " "column where the last six items of each tuple are ``None``." msgstr "" -#: ../../library/sqlite3.rst:1663 +#: ../../library/sqlite3.rst:1669 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:1667 +#: ../../library/sqlite3.rst:1673 msgid "" "Read-only attribute that provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " @@ -2102,15 +2103,15 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:1675 +#: ../../library/sqlite3.rst:1681 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:1677 +#: ../../library/sqlite3.rst:1683 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:1682 +#: ../../library/sqlite3.rst:1688 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -2120,7 +2121,7 @@ msgid "" "resulting rows must be fetched in order for :attr:`!rowcount` to be updated." msgstr "" -#: ../../library/sqlite3.rst:1693 +#: ../../library/sqlite3.rst:1699 msgid "" "Control how a row fetched from this :class:`!Cursor` is represented. If " "``None``, a row is represented as a :class:`tuple`. Can be set to the " @@ -2129,61 +2130,61 @@ msgid "" "and returns a custom object representing an SQLite row." msgstr "" -#: ../../library/sqlite3.rst:1700 +#: ../../library/sqlite3.rst:1706 msgid "" "Defaults to what :attr:`Connection.row_factory` was set to when the :class:`!" -"Cursor` was created. Assigning to this attribute does not " -"affect :attr:`Connection.row_factory` of the parent connection." +"Cursor` was created. Assigning to this attribute does not affect :attr:" +"`Connection.row_factory` of the parent connection." msgstr "" -#: ../../library/sqlite3.rst:1716 +#: ../../library/sqlite3.rst:1722 msgid "Row objects" msgstr "Row 物件" -#: ../../library/sqlite3.rst:1720 +#: ../../library/sqlite3.rst:1726 msgid "" -"A :class:`!Row` instance serves as a highly " -"optimized :attr:`~Connection.row_factory` for :class:`Connection` objects. " -"It supports iteration, equality testing, :func:`len`, and :term:`mapping` " -"access by column name and index." +"A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." +"row_factory` for :class:`Connection` objects. It supports iteration, " +"equality testing, :func:`len`, and :term:`mapping` access by column name and " +"index." msgstr "" -#: ../../library/sqlite3.rst:1725 +#: ../../library/sqlite3.rst:1731 msgid "" "Two :class:`!Row` objects compare equal if they have identical column names " "and values." msgstr "" -#: ../../library/sqlite3.rst:1732 +#: ../../library/sqlite3.rst:1738 msgid "" "Return a :class:`list` of column names as :class:`strings `. " -"Immediately after a query, it is the first member of each tuple " -"in :attr:`Cursor.description`." +"Immediately after a query, it is the first member of each tuple in :attr:" +"`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:1736 +#: ../../library/sqlite3.rst:1742 msgid "Added support of slicing." msgstr "新增對切片的支援。" -#: ../../library/sqlite3.rst:1743 +#: ../../library/sqlite3.rst:1749 msgid "Blob objects" msgstr "Blob 物件" -#: ../../library/sqlite3.rst:1749 +#: ../../library/sqlite3.rst:1755 msgid "" "A :class:`Blob` instance is a :term:`file-like object` that can read and " -"write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. " -"Call :func:`len(blob) ` to get the size (number of bytes) of the blob. " -"Use indices and :term:`slices ` for direct access to the blob data." +"write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. Call :func:" +"`len(blob) ` to get the size (number of bytes) of the blob. Use indices " +"and :term:`slices ` for direct access to the blob data." msgstr "" -#: ../../library/sqlite3.rst:1754 +#: ../../library/sqlite3.rst:1760 msgid "" "Use the :class:`Blob` as a :term:`context manager` to ensure that the blob " "handle is closed after use." msgstr "" -#: ../../library/sqlite3.rst:1757 +#: ../../library/sqlite3.rst:1763 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE test(blob_col blob)\")\n" @@ -2205,37 +2206,37 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1785 +#: ../../library/sqlite3.rst:1791 msgid "Close the blob." msgstr "" -#: ../../library/sqlite3.rst:1787 +#: ../../library/sqlite3.rst:1793 msgid "" -"The blob will be unusable from this point onward. " -"An :class:`~sqlite3.Error` (or subclass) exception will be raised if any " -"further operation is attempted with the blob." +"The blob will be unusable from this point onward. An :class:`~sqlite3." +"Error` (or subclass) exception will be raised if any further operation is " +"attempted with the blob." msgstr "" -#: ../../library/sqlite3.rst:1793 +#: ../../library/sqlite3.rst:1799 msgid "" "Read *length* bytes of data from the blob at the current offset position. If " "the end of the blob is reached, the data up to :abbr:`EOF (End of File)` " -"will be returned. When *length* is not specified, or is " -"negative, :meth:`~Blob.read` will read until the end of the blob." +"will be returned. When *length* is not specified, or is negative, :meth:" +"`~Blob.read` will read until the end of the blob." msgstr "" -#: ../../library/sqlite3.rst:1801 +#: ../../library/sqlite3.rst:1807 msgid "" "Write *data* to the blob at the current offset. This function cannot change " -"the blob length. Writing beyond the end of the blob will " -"raise :exc:`ValueError`." +"the blob length. Writing beyond the end of the blob will raise :exc:" +"`ValueError`." msgstr "" -#: ../../library/sqlite3.rst:1807 +#: ../../library/sqlite3.rst:1813 msgid "Return the current access position of the blob." msgstr "" -#: ../../library/sqlite3.rst:1811 +#: ../../library/sqlite3.rst:1817 msgid "" "Set the current access position of the blob to *offset*. The *origin* " "argument defaults to :const:`os.SEEK_SET` (absolute blob positioning). Other " @@ -2243,26 +2244,26 @@ msgid "" "position) and :const:`os.SEEK_END` (seek relative to the blob’s end)." msgstr "" -#: ../../library/sqlite3.rst:1819 +#: ../../library/sqlite3.rst:1825 msgid "PrepareProtocol objects" msgstr "PrepareProtocol 物件" -#: ../../library/sqlite3.rst:1823 +#: ../../library/sqlite3.rst:1829 msgid "" "The PrepareProtocol type's single purpose is to act as a :pep:`246` style " "adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." msgstr "" -#: ../../library/sqlite3.rst:1831 +#: ../../library/sqlite3.rst:1837 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:1833 +#: ../../library/sqlite3.rst:1839 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:1837 +#: ../../library/sqlite3.rst:1843 msgid "" "This exception is not currently raised by the :mod:`!sqlite3` module, but " "may be raised by applications using :mod:`!sqlite3`, for example if a user-" @@ -2270,39 +2271,39 @@ msgid "" "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1844 +#: ../../library/sqlite3.rst:1850 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1848 +#: ../../library/sqlite3.rst:1854 msgid "" "If the exception originated from within the SQLite library, the following " "two attributes are added to the exception:" msgstr "" -#: ../../library/sqlite3.rst:1853 +#: ../../library/sqlite3.rst:1859 msgid "" -"The numeric error code from the `SQLite API `_" +"The numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1860 +#: ../../library/sqlite3.rst:1866 msgid "" "The symbolic name of the numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1867 +#: ../../library/sqlite3.rst:1873 msgid "" "Exception raised for misuse of the low-level SQLite C API. In other words, " "if this exception is raised, it probably indicates a bug in the :mod:`!" "sqlite3` module. ``InterfaceError`` is a subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1874 +#: ../../library/sqlite3.rst:1880 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -2310,14 +2311,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1881 +#: ../../library/sqlite3.rst:1887 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1887 +#: ../../library/sqlite3.rst:1893 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -2325,28 +2326,28 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1895 +#: ../../library/sqlite3.rst:1901 msgid "" "Exception raised when the relational integrity of the database is affected, " "e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1900 +#: ../../library/sqlite3.rst:1906 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1907 +#: ../../library/sqlite3.rst:1913 msgid "" "Exception raised for :mod:`!sqlite3` API programming errors, for example " "supplying the wrong number of bindings to a query, or trying to operate on a " -"closed :class:`Connection`. ``ProgrammingError`` is a subclass " -"of :exc:`DatabaseError`." +"closed :class:`Connection`. ``ProgrammingError`` is a subclass of :exc:" +"`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1914 +#: ../../library/sqlite3.rst:1920 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -2355,78 +2356,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1924 +#: ../../library/sqlite3.rst:1930 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1926 +#: ../../library/sqlite3.rst:1932 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1929 +#: ../../library/sqlite3.rst:1935 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1932 ../../library/sqlite3.rst:1949 +#: ../../library/sqlite3.rst:1938 ../../library/sqlite3.rst:1955 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1932 ../../library/sqlite3.rst:1949 +#: ../../library/sqlite3.rst:1938 ../../library/sqlite3.rst:1955 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1934 ../../library/sqlite3.rst:1951 +#: ../../library/sqlite3.rst:1940 ../../library/sqlite3.rst:1957 msgid "``None``" msgstr "``None``" -#: ../../library/sqlite3.rst:1934 ../../library/sqlite3.rst:1951 +#: ../../library/sqlite3.rst:1940 ../../library/sqlite3.rst:1957 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1936 ../../library/sqlite3.rst:1953 +#: ../../library/sqlite3.rst:1942 ../../library/sqlite3.rst:1959 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1936 ../../library/sqlite3.rst:1953 +#: ../../library/sqlite3.rst:1942 ../../library/sqlite3.rst:1959 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1938 ../../library/sqlite3.rst:1955 +#: ../../library/sqlite3.rst:1944 ../../library/sqlite3.rst:1961 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1938 ../../library/sqlite3.rst:1955 +#: ../../library/sqlite3.rst:1944 ../../library/sqlite3.rst:1961 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1940 +#: ../../library/sqlite3.rst:1946 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1940 ../../library/sqlite3.rst:1957 +#: ../../library/sqlite3.rst:1946 ../../library/sqlite3.rst:1963 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1942 ../../library/sqlite3.rst:1960 +#: ../../library/sqlite3.rst:1948 ../../library/sqlite3.rst:1966 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1942 ../../library/sqlite3.rst:1960 +#: ../../library/sqlite3.rst:1948 ../../library/sqlite3.rst:1966 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1946 +#: ../../library/sqlite3.rst:1952 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1957 +#: ../../library/sqlite3.rst:1963 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1963 +#: ../../library/sqlite3.rst:1969 msgid "" "The type system of the :mod:`!sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via :ref:`object " @@ -2435,47 +2436,47 @@ msgid "" "converters>`." msgstr "" -#: ../../library/sqlite3.rst:1973 +#: ../../library/sqlite3.rst:1979 msgid "Default adapters and converters (deprecated)" msgstr "" -#: ../../library/sqlite3.rst:1977 +#: ../../library/sqlite3.rst:1983 msgid "" "The default adapters and converters are deprecated as of Python 3.12. " "Instead, use the :ref:`sqlite3-adapter-converter-recipes` and tailor them to " "your needs." msgstr "" -#: ../../library/sqlite3.rst:1981 +#: ../../library/sqlite3.rst:1987 msgid "The deprecated default adapters and converters consist of:" msgstr "" -#: ../../library/sqlite3.rst:1983 +#: ../../library/sqlite3.rst:1989 msgid "" "An adapter for :class:`datetime.date` objects to :class:`strings ` in " "`ISO 8601`_ format." msgstr "" -#: ../../library/sqlite3.rst:1985 +#: ../../library/sqlite3.rst:1991 msgid "" "An adapter for :class:`datetime.datetime` objects to strings in ISO 8601 " "format." msgstr "" -#: ../../library/sqlite3.rst:1987 +#: ../../library/sqlite3.rst:1993 msgid "" -"A converter for :ref:`declared ` \"date\" types " -"to :class:`datetime.date` objects." +"A converter for :ref:`declared ` \"date\" types to :" +"class:`datetime.date` objects." msgstr "" -#: ../../library/sqlite3.rst:1989 +#: ../../library/sqlite3.rst:1995 msgid "" "A converter for declared \"timestamp\" types to :class:`datetime.datetime` " "objects. Fractional parts will be truncated to 6 digits (microsecond " "precision)." msgstr "" -#: ../../library/sqlite3.rst:1995 +#: ../../library/sqlite3.rst:2001 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -2483,42 +2484,42 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:2008 +#: ../../library/sqlite3.rst:2014 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/sqlite3.rst:2010 +#: ../../library/sqlite3.rst:2016 msgid "" "The :mod:`!sqlite3` module can be invoked as a script, using the " "interpreter's :option:`-m` switch, in order to provide a simple SQLite " "shell. The argument signature is as follows::" msgstr "" -#: ../../library/sqlite3.rst:2015 +#: ../../library/sqlite3.rst:2021 msgid "python -m sqlite3 [-h] [-v] [filename] [sql]" msgstr "python -m sqlite3 [-h] [-v] [filename] [sql]" -#: ../../library/sqlite3.rst:2017 +#: ../../library/sqlite3.rst:2023 msgid "Type ``.quit`` or CTRL-D to exit the shell." msgstr "" -#: ../../library/sqlite3.rst:2023 +#: ../../library/sqlite3.rst:2029 msgid "Print CLI help." msgstr "" -#: ../../library/sqlite3.rst:2027 +#: ../../library/sqlite3.rst:2033 msgid "Print underlying SQLite library version." msgstr "" -#: ../../library/sqlite3.rst:2035 +#: ../../library/sqlite3.rst:2041 msgid "How-to guides" msgstr "" -#: ../../library/sqlite3.rst:2040 +#: ../../library/sqlite3.rst:2046 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: ../../library/sqlite3.rst:2042 +#: ../../library/sqlite3.rst:2048 msgid "" "SQL operations usually need to use values from Python variables. However, " "beware of using Python's string operations to assemble queries, as they are " @@ -2526,7 +2527,7 @@ msgid "" "close the single quote and inject ``OR TRUE`` to select all rows::" msgstr "" -#: ../../library/sqlite3.rst:2047 +#: ../../library/sqlite3.rst:2053 msgid "" ">>> # Never do this -- insecure!\n" ">>> symbol = input()\n" @@ -2536,8 +2537,15 @@ msgid "" "SELECT * FROM stocks WHERE symbol = '' OR TRUE; --'\n" ">>> cur.execute(sql)" msgstr "" +">>> # 千萬不要這樣做,這不安全!\n" +">>> symbol = input()\n" +"' OR TRUE; --\n" +">>> sql = \"SELECT * FROM stocks WHERE symbol = '%s'\" % symbol\n" +">>> print(sql)\n" +"SELECT * FROM stocks WHERE symbol = '' OR TRUE; --'\n" +">>> cur.execute(sql)" -#: ../../library/sqlite3.rst:2055 +#: ../../library/sqlite3.rst:2061 msgid "" "Instead, use the DB-API's parameter substitution. To insert a variable into " "a query string, use a placeholder in the string, and substitute the actual " @@ -2545,7 +2553,7 @@ msgid "" "second argument of the cursor's :meth:`~Cursor.execute` method." msgstr "" -#: ../../library/sqlite3.rst:2060 +#: ../../library/sqlite3.rst:2066 msgid "" "An SQL statement may use one of two kinds of placeholders: question marks " "(qmark style) or named placeholders (named style). For the qmark style, " @@ -2556,7 +2564,7 @@ msgid "" "ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:2071 +#: ../../library/sqlite3.rst:2077 msgid "" "con = sqlite3.connect(\":memory:\")\n" "cur = con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" @@ -2577,24 +2585,24 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2098 +#: ../../library/sqlite3.rst:2104 msgid "" ":pep:`249` numeric placeholders are *not* supported. If used, they will be " "interpreted as named placeholders." msgstr "" -#: ../../library/sqlite3.rst:2105 +#: ../../library/sqlite3.rst:2111 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: ../../library/sqlite3.rst:2107 +#: ../../library/sqlite3.rst:2113 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands `." msgstr "" -#: ../../library/sqlite3.rst:2111 +#: ../../library/sqlite3.rst:2117 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -2604,11 +2612,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:2123 +#: ../../library/sqlite3.rst:2129 msgid "How to write adaptable objects" msgstr "" -#: ../../library/sqlite3.rst:2125 +#: ../../library/sqlite3.rst:2131 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -2618,7 +2626,7 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:2133 +#: ../../library/sqlite3.rst:2139 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2650,18 +2658,18 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2157 +#: ../../library/sqlite3.rst:2163 msgid "How to register adapter callables" msgstr "" -#: ../../library/sqlite3.rst:2159 +#: ../../library/sqlite3.rst:2165 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:2163 +#: ../../library/sqlite3.rst:2169 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2695,36 +2703,36 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2190 +#: ../../library/sqlite3.rst:2196 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:2192 +#: ../../library/sqlite3.rst:2198 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: ../../library/sqlite3.rst:2197 +#: ../../library/sqlite3.rst:2203 msgid "" "Let's go back to the :class:`!Point` class. We stored the x and y " "coordinates separated via semicolons as strings in SQLite." msgstr "" -#: ../../library/sqlite3.rst:2200 +#: ../../library/sqlite3.rst:2206 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`!Point` object from it." msgstr "" -#: ../../library/sqlite3.rst:2205 +#: ../../library/sqlite3.rst:2211 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:2208 +#: ../../library/sqlite3.rst:2214 msgid "" "def convert_point(s):\n" " x, y = map(float, s.split(b\";\"))\n" @@ -2734,32 +2742,32 @@ msgstr "" " x, y = map(float, s.split(b\";\"))\n" " return Point(x, y)" -#: ../../library/sqlite3.rst:2214 +#: ../../library/sqlite3.rst:2220 msgid "" "We now need to tell :mod:`!sqlite3` when it should convert a given SQLite " "value. This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: ../../library/sqlite3.rst:2218 +#: ../../library/sqlite3.rst:2224 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:2219 +#: ../../library/sqlite3.rst:2225 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:2220 +#: ../../library/sqlite3.rst:2226 msgid "" -"Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | " -"sqlite3.PARSE_COLNAMES``. Column names take precedence over declared types." +"Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." +"PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:2224 +#: ../../library/sqlite3.rst:2230 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:2226 +#: ../../library/sqlite3.rst:2232 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2801,15 +2809,15 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2277 +#: ../../library/sqlite3.rst:2283 msgid "Adapter and converter recipes" msgstr "" -#: ../../library/sqlite3.rst:2279 +#: ../../library/sqlite3.rst:2285 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:2281 +#: ../../library/sqlite3.rst:2287 msgid "" "import datetime\n" "import sqlite3\n" @@ -2847,23 +2855,23 @@ msgid "" "sqlite3.register_converter(\"timestamp\", convert_timestamp)" msgstr "" -#: ../../library/sqlite3.rst:2341 +#: ../../library/sqlite3.rst:2347 msgid "How to use connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:2343 +#: ../../library/sqlite3.rst:2349 msgid "" -"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, " -"and :meth:`~Connection.executescript` methods of the :class:`Connection` " -"class, your code can be written more concisely because you don't have to " -"create the (often superfluous) :class:`Cursor` objects explicitly. Instead, " -"the :class:`Cursor` objects are created implicitly and these shortcut " -"methods return the cursor objects. This way, you can execute a ``SELECT`` " -"statement and iterate over it directly using only a single call on " -"the :class:`Connection` object." +"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" +"meth:`~Connection.executescript` methods of the :class:`Connection` class, " +"your code can be written more concisely because you don't have to create the " +"(often superfluous) :class:`Cursor` objects explicitly. Instead, the :class:" +"`Cursor` objects are created implicitly and these shortcut methods return " +"the cursor objects. This way, you can execute a ``SELECT`` statement and " +"iterate over it directly using only a single call on the :class:`Connection` " +"object." msgstr "" -#: ../../library/sqlite3.rst:2352 +#: ../../library/sqlite3.rst:2358 msgid "" "# Create and fill the table.\n" "con = sqlite3.connect(\":memory:\")\n" @@ -2887,11 +2895,11 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2384 +#: ../../library/sqlite3.rst:2390 msgid "How to use the connection context manager" msgstr "" -#: ../../library/sqlite3.rst:2386 +#: ../../library/sqlite3.rst:2392 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -2903,25 +2911,25 @@ msgid "" "rolling back." msgstr "" -#: ../../library/sqlite3.rst:2397 +#: ../../library/sqlite3.rst:2403 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, or if :attr:`~Connection.autocommit` is ``True``, the context " "manager does nothing." msgstr "" -#: ../../library/sqlite3.rst:2402 +#: ../../library/sqlite3.rst:2408 msgid "" "The context manager neither implicitly opens a new transaction nor closes " -"the connection. If you need a closing context manager, consider " -"using :meth:`contextlib.closing`." +"the connection. If you need a closing context manager, consider using :meth:" +"`contextlib.closing`." msgstr "" -#: ../../library/sqlite3.rst:2406 +#: ../../library/sqlite3.rst:2412 msgid "" "con = sqlite3.connect(\":memory:\")\n" -"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR UNIQUE)" -"\")\n" +"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR " +"UNIQUE)\")\n" "\n" "# Successful, con.commit() is called automatically afterwards\n" "with con:\n" @@ -2941,19 +2949,19 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2436 +#: ../../library/sqlite3.rst:2442 msgid "How to work with SQLite URIs" msgstr "" -#: ../../library/sqlite3.rst:2438 +#: ../../library/sqlite3.rst:2444 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:2440 +#: ../../library/sqlite3.rst:2446 msgid "Open a database in read-only mode:" msgstr "以唯讀模式開啟資料庫:" -#: ../../library/sqlite3.rst:2442 +#: ../../library/sqlite3.rst:2448 msgid "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" @@ -2967,13 +2975,13 @@ msgstr "" "OperationalError: attempt to write a readonly database\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2450 +#: ../../library/sqlite3.rst:2456 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: ../../library/sqlite3.rst:2453 +#: ../../library/sqlite3.rst:2459 msgid "" ">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" "Traceback (most recent call last):\n" @@ -2983,11 +2991,11 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: unable to open database file" -#: ../../library/sqlite3.rst:2460 +#: ../../library/sqlite3.rst:2466 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:2462 +#: ../../library/sqlite3.rst:2468 msgid "" "db = \"file:mem1?mode=memory&cache=shared\"\n" "con1 = sqlite3.connect(db, uri=True)\n" @@ -3013,32 +3021,32 @@ msgstr "" "con1.close()\n" "con2.close()" -#: ../../library/sqlite3.rst:2476 +#: ../../library/sqlite3.rst:2482 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:2485 +#: ../../library/sqlite3.rst:2491 msgid "How to create and use row factories" msgstr "" -#: ../../library/sqlite3.rst:2487 +#: ../../library/sqlite3.rst:2493 msgid "" -"By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If " -"a :class:`!tuple` does not suit your needs, you can use " -"the :class:`sqlite3.Row` class or a custom :attr:`~Cursor.row_factory`." +"By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :" +"class:`!tuple` does not suit your needs, you can use the :class:`sqlite3." +"Row` class or a custom :attr:`~Cursor.row_factory`." msgstr "" -#: ../../library/sqlite3.rst:2492 +#: ../../library/sqlite3.rst:2498 msgid "" -"While :attr:`!row_factory` exists as an attribute both on " -"the :class:`Cursor` and the :class:`Connection`, it is recommended to " -"set :class:`Connection.row_factory`, so all cursors created from the " -"connection will use the same row factory." +"While :attr:`!row_factory` exists as an attribute both on the :class:" +"`Cursor` and the :class:`Connection`, it is recommended to set :class:" +"`Connection.row_factory`, so all cursors created from the connection will " +"use the same row factory." msgstr "" -#: ../../library/sqlite3.rst:2497 +#: ../../library/sqlite3.rst:2503 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -3046,7 +3054,7 @@ msgid "" "attribute:" msgstr "" -#: ../../library/sqlite3.rst:2502 +#: ../../library/sqlite3.rst:2508 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" @@ -3054,11 +3062,11 @@ msgstr "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" -#: ../../library/sqlite3.rst:2507 +#: ../../library/sqlite3.rst:2513 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: ../../library/sqlite3.rst:2509 +#: ../../library/sqlite3.rst:2515 msgid "" ">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" ">>> row = res.fetchone()\n" @@ -3073,7 +3081,7 @@ msgid "" ">>> con.close()" msgstr "" -#: ../../library/sqlite3.rst:2525 +#: ../../library/sqlite3.rst:2531 msgid "" "The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the " "above example. In such cases, SQLite returns a single row with columns " @@ -3081,13 +3089,13 @@ msgid "" "alias``." msgstr "" -#: ../../library/sqlite3.rst:2530 +#: ../../library/sqlite3.rst:2536 msgid "" "You can create a custom :attr:`~Cursor.row_factory` that returns each row as " "a :class:`dict`, with column names mapped to values:" msgstr "" -#: ../../library/sqlite3.rst:2533 +#: ../../library/sqlite3.rst:2539 msgid "" "def dict_factory(cursor, row):\n" " fields = [column[0] for column in cursor.description]\n" @@ -3097,12 +3105,12 @@ msgstr "" " fields = [column[0] for column in cursor.description]\n" " return {key: value for key, value in zip(fields, row)}" -#: ../../library/sqlite3.rst:2539 +#: ../../library/sqlite3.rst:2545 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2541 +#: ../../library/sqlite3.rst:2547 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = dict_factory\n" @@ -3118,11 +3126,11 @@ msgstr "" "{'a': 1, 'b': 2}\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2550 +#: ../../library/sqlite3.rst:2556 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2552 +#: ../../library/sqlite3.rst:2558 msgid "" "from collections import namedtuple\n" "\n" @@ -3138,11 +3146,11 @@ msgstr "" " cls = namedtuple(\"Row\", fields)\n" " return cls._make(row)" -#: ../../library/sqlite3.rst:2561 +#: ../../library/sqlite3.rst:2567 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: ../../library/sqlite3.rst:2563 +#: ../../library/sqlite3.rst:2569 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = namedtuple_factory\n" @@ -3168,69 +3176,69 @@ msgstr "" "2\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2577 +#: ../../library/sqlite3.rst:2583 msgid "" -"With some adjustments, the above recipe can be adapted to use " -"a :class:`~dataclasses.dataclass`, or any other custom class, instead of " -"a :class:`~collections.namedtuple`." +"With some adjustments, the above recipe can be adapted to use a :class:" +"`~dataclasses.dataclass`, or any other custom class, instead of a :class:" +"`~collections.namedtuple`." msgstr "" -#: ../../library/sqlite3.rst:2585 +#: ../../library/sqlite3.rst:2591 msgid "How to handle non-UTF-8 text encodings" msgstr "如何處理非 UTF-8 的文字編碼" -#: ../../library/sqlite3.rst:2587 +#: ../../library/sqlite3.rst:2593 msgid "" "By default, :mod:`!sqlite3` uses :class:`str` to adapt SQLite values with " "the ``TEXT`` data type. This works well for UTF-8 encoded text, but it might " -"fail for other encodings and invalid UTF-8. You can use a " -"custom :attr:`~Connection.text_factory` to handle such cases." +"fail for other encodings and invalid UTF-8. You can use a custom :attr:" +"`~Connection.text_factory` to handle such cases." msgstr "" -#: ../../library/sqlite3.rst:2593 +#: ../../library/sqlite3.rst:2599 msgid "" "Because of SQLite's `flexible typing`_, it is not uncommon to encounter " "table columns with the ``TEXT`` data type containing non-UTF-8 encodings, or " "even arbitrary data. To demonstrate, let's assume we have a database with " "ISO-8859-2 (Latin-2) encoded text, for example a table of Czech-English " -"dictionary entries. Assuming we now have a :class:`Connection` " -"instance :py:data:`!con` connected to this database, we can decode the " -"Latin-2 encoded text using this :attr:`~Connection.text_factory`:" +"dictionary entries. Assuming we now have a :class:`Connection` instance :py:" +"data:`!con` connected to this database, we can decode the Latin-2 encoded " +"text using this :attr:`~Connection.text_factory`:" msgstr "" -#: ../../library/sqlite3.rst:2602 +#: ../../library/sqlite3.rst:2608 msgid "con.text_factory = lambda data: str(data, encoding=\"latin2\")" msgstr "con.text_factory = lambda data: str(data, encoding=\"latin2\")" -#: ../../library/sqlite3.rst:2606 +#: ../../library/sqlite3.rst:2612 msgid "" "For invalid UTF-8 or arbitrary data in stored in ``TEXT`` table columns, you " "can use the following technique, borrowed from the :ref:`unicode-howto`:" msgstr "" -#: ../../library/sqlite3.rst:2609 +#: ../../library/sqlite3.rst:2615 msgid "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" msgstr "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" -#: ../../library/sqlite3.rst:2615 +#: ../../library/sqlite3.rst:2621 msgid "" "The :mod:`!sqlite3` module API does not support strings containing " "surrogates." msgstr "" -#: ../../library/sqlite3.rst:2620 +#: ../../library/sqlite3.rst:2626 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../library/sqlite3.rst:2626 +#: ../../library/sqlite3.rst:2632 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:2632 +#: ../../library/sqlite3.rst:2638 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:2634 +#: ../../library/sqlite3.rst:2640 msgid "" ":mod:`!sqlite3` offers multiple methods of controlling whether, when and how " "database transactions are opened and closed. :ref:`sqlite3-transaction-" @@ -3238,123 +3246,122 @@ msgid "" "isolation-level` retains the pre-Python 3.12 behaviour." msgstr "" -#: ../../library/sqlite3.rst:2643 +#: ../../library/sqlite3.rst:2649 msgid "Transaction control via the ``autocommit`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2645 +#: ../../library/sqlite3.rst:2651 msgid "" -"The recommended way of controlling transaction behaviour is through " -"the :attr:`Connection.autocommit` attribute, which should preferably be set " -"using the *autocommit* parameter of :func:`connect`." +"The recommended way of controlling transaction behaviour is through the :" +"attr:`Connection.autocommit` attribute, which should preferably be set using " +"the *autocommit* parameter of :func:`connect`." msgstr "" -#: ../../library/sqlite3.rst:2650 +#: ../../library/sqlite3.rst:2656 msgid "" "It is suggested to set *autocommit* to ``False``, which implies :pep:`249`-" "compliant transaction control. This means:" msgstr "" -#: ../../library/sqlite3.rst:2654 +#: ../../library/sqlite3.rst:2660 msgid "" -":mod:`!sqlite3` ensures that a transaction is always open, " -"so :func:`connect`, :meth:`Connection.commit`, " -"and :meth:`Connection.rollback` will implicitly open a new transaction " -"(immediately after closing the pending one, for the latter two). :mod:`!" -"sqlite3` uses ``BEGIN DEFERRED`` statements when opening transactions." +":mod:`!sqlite3` ensures that a transaction is always open, so :func:" +"`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback` will " +"implicitly open a new transaction (immediately after closing the pending " +"one, for the latter two). :mod:`!sqlite3` uses ``BEGIN DEFERRED`` statements " +"when opening transactions." msgstr "" -#: ../../library/sqlite3.rst:2659 +#: ../../library/sqlite3.rst:2665 msgid "Transactions should be committed explicitly using :meth:`!commit`." msgstr "" -#: ../../library/sqlite3.rst:2660 +#: ../../library/sqlite3.rst:2666 msgid "Transactions should be rolled back explicitly using :meth:`!rollback`." msgstr "" -#: ../../library/sqlite3.rst:2661 +#: ../../library/sqlite3.rst:2667 msgid "" -"An implicit rollback is performed if the database " -"is :meth:`~Connection.close`-ed with pending changes." +"An implicit rollback is performed if the database is :meth:`~Connection." +"close`-ed with pending changes." msgstr "" -#: ../../library/sqlite3.rst:2664 +#: ../../library/sqlite3.rst:2670 msgid "" "Set *autocommit* to ``True`` to enable SQLite's `autocommit mode`_. In this " "mode, :meth:`Connection.commit` and :meth:`Connection.rollback` have no " "effect. Note that SQLite's autocommit mode is distinct from the :pep:`249`-" -"compliant :attr:`Connection.autocommit` attribute; " -"use :attr:`Connection.in_transaction` to query the low-level SQLite " -"autocommit mode." +"compliant :attr:`Connection.autocommit` attribute; use :attr:`Connection." +"in_transaction` to query the low-level SQLite autocommit mode." msgstr "" -#: ../../library/sqlite3.rst:2672 +#: ../../library/sqlite3.rst:2678 msgid "" "Set *autocommit* to :data:`LEGACY_TRANSACTION_CONTROL` to leave transaction " -"control behaviour to the :attr:`Connection.isolation_level` attribute. " -"See :ref:`sqlite3-transaction-control-isolation-level` for more information." +"control behaviour to the :attr:`Connection.isolation_level` attribute. See :" +"ref:`sqlite3-transaction-control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:2681 +#: ../../library/sqlite3.rst:2687 msgid "Transaction control via the ``isolation_level`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2685 +#: ../../library/sqlite3.rst:2691 msgid "" -"The recommended way of controlling transactions is via " -"the :attr:`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-" -"control-autocommit`." +"The recommended way of controlling transactions is via the :attr:" +"`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-control-" +"autocommit`." msgstr "" -#: ../../library/sqlite3.rst:2689 +#: ../../library/sqlite3.rst:2695 msgid "" -"If :attr:`Connection.autocommit` is set " -"to :data:`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour " -"is controlled using the :attr:`Connection.isolation_level` attribute. " +"If :attr:`Connection.autocommit` is set to :data:" +"`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour is " +"controlled using the :attr:`Connection.isolation_level` attribute. " "Otherwise, :attr:`!isolation_level` has no effect." msgstr "" -#: ../../library/sqlite3.rst:2695 +#: ../../library/sqlite3.rst:2701 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " -"``None``, new transactions are implicitly opened " -"before :meth:`~Cursor.execute` and :meth:`~Cursor.executemany` executes " -"``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statements; for other " -"statements, no implicit transaction handling is performed. Use " -"the :meth:`~Connection.commit` and :meth:`~Connection.rollback` methods to " -"respectively commit and roll back pending transactions. You can choose the " -"underlying `SQLite transaction behaviour`_ — that is, whether and what type " -"of ``BEGIN`` statements :mod:`!sqlite3` implicitly executes – via " -"the :attr:`~Connection.isolation_level` attribute." +"``None``, new transactions are implicitly opened before :meth:`~Cursor." +"execute` and :meth:`~Cursor.executemany` executes ``INSERT``, ``UPDATE``, " +"``DELETE``, or ``REPLACE`` statements; for other statements, no implicit " +"transaction handling is performed. Use the :meth:`~Connection.commit` and :" +"meth:`~Connection.rollback` methods to respectively commit and roll back " +"pending transactions. You can choose the underlying `SQLite transaction " +"behaviour`_ — that is, whether and what type of ``BEGIN`` statements :mod:`!" +"sqlite3` implicitly executes – via the :attr:`~Connection.isolation_level` " +"attribute." msgstr "" -#: ../../library/sqlite3.rst:2708 +#: ../../library/sqlite3.rst:2714 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " "`autocommit mode`_, but also allows the user to perform their own " "transaction handling using explicit SQL statements. The underlying SQLite " -"library autocommit mode can be queried using " -"the :attr:`~Connection.in_transaction` attribute." +"library autocommit mode can be queried using the :attr:`~Connection." +"in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:2716 +#: ../../library/sqlite3.rst:2722 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:2720 +#: ../../library/sqlite3.rst:2726 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:2724 +#: ../../library/sqlite3.rst:2730 msgid "" -"The recommended way of controlling transactions is now via " -"the :attr:`~Connection.autocommit` attribute." +"The recommended way of controlling transactions is now via the :attr:" +"`~Connection.autocommit` attribute." msgstr "" #: ../../library/sqlite3.rst:1475 diff --git a/library/ssl.po b/library/ssl.po index 5939b968dbe..adc4b3823df 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-09-28 00:15+0000\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -59,7 +59,7 @@ msgstr "" "在使用此模組之前,請閱讀 :ref:`ssl-security`。如果不這樣做,可能會產生錯誤的" "安全性認知,因為 ssl 模組的預設設定未必適合你的應用程式。" -#: ../../library/ssl.rst:454 ../../library/ssl.rst:469 +#: ../../library/ssl.rst:455 ../../library/ssl.rst:470 #: ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "可用性" @@ -228,7 +228,7 @@ msgid "" "purposes." msgstr "一個可以幫忙建立出 :class:`SSLContext` 物件以用於一般目的的方便函式。" -#: ../../library/ssl.rst:130 +#: ../../library/ssl.rst:131 msgid "" "Return a new :class:`SSLContext` object with default settings for the given " "*purpose*. The settings are chosen by the :mod:`ssl` module, and usually " @@ -238,7 +238,7 @@ msgstr "" "回傳一個新的 :class:`SSLContext` 物件,使用給定 *purpose* 的預設值。這些設定" "是由 :mod:`ssl` 選擇,通常比直接呼叫 :class:`SSLContext` 有更高的安全性。" -#: ../../library/ssl.rst:135 +#: ../../library/ssl.rst:136 msgid "" "*cafile*, *capath*, *cadata* represent optional CA certificates to trust for " "certificate verification, as in :meth:`SSLContext.load_verify_locations`. " @@ -252,7 +252,7 @@ msgstr "" # Skylull: `high encryption cipher` 可能是指 https://superuser.com/questions/1751902/how-to-check-which-ciphers-are-included-in-high-ciphers-constant # 其文中表示可能是指 128bit 以上 key length 的加密算法,需要其他來源佐證。 # 或是 https://help.fortinet.com/fweb/582/Content/FortiWeb/fortiweb-admin/supported_cipher_suites.htm#ssl_414712646_1189301 -#: ../../library/ssl.rst:141 +#: ../../library/ssl.rst:142 msgid "" "The settings are: :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` with " @@ -271,7 +271,7 @@ msgstr "" "個值有被設定時) 或使用預設的 CA 憑證 :meth:`SSLContext." "load_default_certs` 。" -#: ../../library/ssl.rst:150 +#: ../../library/ssl.rst:151 msgid "" "When :attr:`~SSLContext.keylog_filename` is supported and the environment " "variable :envvar:`SSLKEYLOGFILE` is set, :func:`create_default_context` " @@ -281,7 +281,7 @@ msgstr "" "`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記錄 " "(logging)。" -#: ../../library/ssl.rst:154 +#: ../../library/ssl.rst:155 msgid "" "The default settings for this context include :data:" "`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. These make the " @@ -290,7 +290,7 @@ msgid "" "incompatibility with older X.509 certificates." msgstr "" -#: ../../library/ssl.rst:161 +#: ../../library/ssl.rst:162 msgid "" "The protocol, options, cipher and other settings may change to more " "restrictive values anytime without prior deprecation. The values represent " @@ -299,7 +299,7 @@ msgstr "" "協定、選項、加密方式和其它設定可以在不捨棄舊值的情況下直接更改成新的值,這些" "值代表了在相容性和安全性之間取得的合理平衡。" -#: ../../library/ssl.rst:165 +#: ../../library/ssl.rst:166 msgid "" "If your application needs specific settings, you should create a :class:" "`SSLContext` and apply the settings yourself." @@ -307,7 +307,7 @@ msgstr "" "如果你的應用程式需要特殊的設定,你應該要自行建立一個 :class:`SSLContext` 並自" "行調整設定。" -#: ../../library/ssl.rst:169 +#: ../../library/ssl.rst:170 msgid "" "If you find that when certain older clients or servers attempt to connect " "with a :class:`SSLContext` created by this function that they get an error " @@ -323,7 +323,7 @@ msgstr "" "SSL3.0 已經\\ `被完全破解 `_。如果你仍" "然希望在允許 SSL3.0 連線的情況下使用此函式,可以使用下面的方法: ::" -#: ../../library/ssl.rst:178 +#: ../../library/ssl.rst:179 msgid "" "ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" "ctx.options &= ~ssl.OP_NO_SSLv3" @@ -331,7 +331,7 @@ msgstr "" "ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" "ctx.options &= ~ssl.OP_NO_SSLv3" -#: ../../library/ssl.rst:182 +#: ../../library/ssl.rst:183 msgid "" "This context enables :data:`VERIFY_X509_STRICT` by default, which may reject " "pre-:rfc:`5280` or malformed certificates that the underlying OpenSSL " @@ -339,7 +339,7 @@ msgid "" "recommended, you can do so using::" msgstr "" -#: ../../library/ssl.rst:187 +#: ../../library/ssl.rst:188 msgid "" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" @@ -347,23 +347,23 @@ msgstr "" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" -#: ../../library/ssl.rst:194 +#: ../../library/ssl.rst:195 msgid "RC4 was dropped from the default cipher string." msgstr "把 RC4 從預設加密方法字串中捨棄。" -#: ../../library/ssl.rst:198 +#: ../../library/ssl.rst:199 msgid "ChaCha20/Poly1305 was added to the default cipher string." msgstr "把 ChaCha20/Poly1305 加入預設加密方法字串。" -#: ../../library/ssl.rst:200 +#: ../../library/ssl.rst:201 msgid "3DES was dropped from the default cipher string." msgstr "把 3DES 從預設加密方法字串中捨棄。" -#: ../../library/ssl.rst:204 +#: ../../library/ssl.rst:205 msgid "Support for key logging to :envvar:`SSLKEYLOGFILE` was added." msgstr "增加了 :envvar:`SSLKEYLOGFILE` 對密鑰日誌記錄 (logging) 的支援。" -#: ../../library/ssl.rst:208 +#: ../../library/ssl.rst:209 msgid "" "The context now uses :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol instead of generic :data:`PROTOCOL_TLS`." @@ -371,17 +371,17 @@ msgstr "" "目前語境使用 :data:`PROTOCOL_TLS_CLIENT` 協定或 :data:`PROTOCOL_TLS_SERVER` " "協定而非通用的 :data:`PROTOCOL_TLS`。" -#: ../../library/ssl.rst:214 +#: ../../library/ssl.rst:215 msgid "" "The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:" "`VERIFY_X509_STRICT` in its default verify flags." msgstr "" -#: ../../library/ssl.rst:219 +#: ../../library/ssl.rst:220 msgid "Exceptions" msgstr "例外" -#: ../../library/ssl.rst:223 +#: ../../library/ssl.rst:224 msgid "" "Raised to signal an error from the underlying SSL implementation (currently " "provided by the OpenSSL library). This signifies some problem in the higher-" @@ -395,11 +395,11 @@ msgstr "" "`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 OpenSSL " "函式庫提供。" -#: ../../library/ssl.rst:230 +#: ../../library/ssl.rst:231 msgid ":exc:`SSLError` used to be a subtype of :exc:`socket.error`." msgstr ":exc:`SSLError` 曾經是 :exc:`socket.error` 的一個子型別。" -#: ../../library/ssl.rst:235 +#: ../../library/ssl.rst:236 msgid "" "A string mnemonic designating the OpenSSL submodule in which the error " "occurred, such as ``SSL``, ``PEM`` or ``X509``. The range of possible " @@ -408,7 +408,7 @@ msgstr "" "一個字串符號 (string mnemonic),用來指定發生錯誤的 OpenSSL 子模組,如:" "``SSL``、``PEM`` 或 ``X509``。可能值的範圍取決於 OpenSSL 的版本。" -#: ../../library/ssl.rst:243 +#: ../../library/ssl.rst:244 msgid "" "A string mnemonic designating the reason this error occurred, for example " "``CERTIFICATE_VERIFY_FAILED``. The range of possible values depends on the " @@ -417,7 +417,7 @@ msgstr "" "一個字串符號,用來指定發生錯誤的原因,如:``CERTIFICATE_VERIFY_FAILED``。可能" "值的範圍取決於 OpenSSL 的版本。" -#: ../../library/ssl.rst:251 +#: ../../library/ssl.rst:252 msgid "" "A subclass of :exc:`SSLError` raised when trying to read or write and the " "SSL connection has been closed cleanly. Note that this doesn't mean that " @@ -426,7 +426,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去讀寫已經被完全關閉的 SSL 連線時會被引" "發。請注意,這並不表示底層傳輸(例如 TCP)已經被關閉。" -#: ../../library/ssl.rst:259 +#: ../../library/ssl.rst:260 msgid "" "A subclass of :exc:`SSLError` raised by a :ref:`non-blocking SSL socket ` when trying to read or write data, but more data needs to be " @@ -435,7 +435,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去讀寫資料前,底層 TCP 傳輸需要先接收更" "多資料時會由\\ :ref:`非阻塞的 SSL socket ` 引發該錯誤。" -#: ../../library/ssl.rst:268 +#: ../../library/ssl.rst:269 msgid "" "A subclass of :exc:`SSLError` raised by a :ref:`non-blocking SSL socket ` when trying to read or write data, but more data needs to be " @@ -444,7 +444,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去讀寫資料前,底層 TCP 傳輸需要先發送更" "多資料時會由\\ :ref:`非阻塞的 SSL socket ` 引發該錯誤。" -#: ../../library/ssl.rst:277 +#: ../../library/ssl.rst:278 msgid "" "A subclass of :exc:`SSLError` raised when a system error was encountered " "while trying to fulfill an operation on a SSL socket. Unfortunately, there " @@ -453,7 +453,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去操作 SSL socket 時有系統錯誤產生會引發" "此錯誤。不幸的是,目前沒有任何簡單的方法可以去檢查原本的的 errno 編號。" -#: ../../library/ssl.rst:285 +#: ../../library/ssl.rst:286 msgid "" "A subclass of :exc:`SSLError` raised when the SSL connection has been " "terminated abruptly. Generally, you shouldn't try to reuse the underlying " @@ -462,32 +462,32 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當 SSL 連線被突然終止時會引發此錯誤。通常,當" "此錯誤發生時,你不該再去重新使用底層傳輸。" -#: ../../library/ssl.rst:293 +#: ../../library/ssl.rst:294 msgid "" "A subclass of :exc:`SSLError` raised when certificate validation has failed." msgstr "當憑證驗證失敗時會引發的一個 :exc:`SSLError` 子類別。" -#: ../../library/ssl.rst:300 +#: ../../library/ssl.rst:301 msgid "A numeric error number that denotes the verification error." msgstr "一個表示驗證錯誤的錯誤數值編號。" -#: ../../library/ssl.rst:304 +#: ../../library/ssl.rst:305 msgid "A human readable string of the verification error." msgstr "一個人類可讀的驗證錯誤字串。" -#: ../../library/ssl.rst:308 +#: ../../library/ssl.rst:309 msgid "An alias for :exc:`SSLCertVerificationError`." msgstr ":exc:`SSLCertVerificationError` 的別名。" -#: ../../library/ssl.rst:310 +#: ../../library/ssl.rst:311 msgid "The exception is now an alias for :exc:`SSLCertVerificationError`." msgstr "此例外現在是 :exc:`SSLCertVerificationError` 的別名。" -#: ../../library/ssl.rst:315 +#: ../../library/ssl.rst:316 msgid "Random generation" msgstr "隨機產生" -#: ../../library/ssl.rst:319 +#: ../../library/ssl.rst:320 msgid "" "Return *num* cryptographically strong pseudo-random bytes. Raises an :class:" "`SSLError` if the PRNG has not been seeded with enough data or if the " @@ -500,11 +500,11 @@ msgstr "" "func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可以用來" "為 PRNG 設定隨機種子。" -#: ../../library/ssl.rst:325 +#: ../../library/ssl.rst:326 msgid "For almost all applications :func:`os.urandom` is preferable." msgstr "在幾乎所有的應用程式中,:func:`os.urandom` 會是較好的選擇。" -#: ../../library/ssl.rst:327 +#: ../../library/ssl.rst:328 msgid "" "Read the Wikipedia article, `Cryptographically secure pseudorandom number " "generator (CSPRNG) `_\\ 文章來了" "解密碼學安全偽隨機數產生器的需求。" -#: ../../library/ssl.rst:336 +#: ../../library/ssl.rst:337 msgid "" "Return ``True`` if the SSL pseudo-random number generator has been seeded " "with 'enough' randomness, and ``False`` otherwise. You can use :func:`ssl." @@ -526,7 +526,7 @@ msgstr "" "``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式和 :func:" "`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" -#: ../../library/ssl.rst:343 +#: ../../library/ssl.rst:344 msgid "" "Mix the given *bytes* into the SSL pseudo-random number generator. The " "parameter *entropy* (a float) is a lower bound on the entropy contained in " @@ -537,15 +537,15 @@ msgstr "" "指字串中包含熵值的下限(因此你可以將其設為 ``0.0``\\ )。請參閱 :rfc:`1750` " "了解有關熵源的更多資訊。" -#: ../../library/ssl.rst:348 +#: ../../library/ssl.rst:349 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "可寫入的\\ :term:`類位元組物件 `\\ 現在可被接受。" -#: ../../library/ssl.rst:352 +#: ../../library/ssl.rst:353 msgid "Certificate handling" msgstr "認證處理" -#: ../../library/ssl.rst:360 +#: ../../library/ssl.rst:361 msgid "" "Return the time in seconds since the Epoch, given the ``cert_time`` string " "representing the \"notBefore\" or \"notAfter\" date from a certificate in " @@ -555,11 +555,11 @@ msgstr "" "\"notAfter\" 日期,字串採用 ``\"%b %d %H:%M:%S %Y %Z\"`` 格式(C 語言區域設" "定)。" -#: ../../library/ssl.rst:365 +#: ../../library/ssl.rst:366 msgid "Here's an example:" msgstr "以下是一個範例:" -#: ../../library/ssl.rst:367 +#: ../../library/ssl.rst:368 msgid "" ">>> import ssl\n" ">>> timestamp = ssl.cert_time_to_seconds(\"Jan 5 09:34:43 2018 GMT\")\n" @@ -577,11 +577,11 @@ msgstr "" ">>> print(datetime.utcfromtimestamp(timestamp))\n" "2018-01-05 09:34:43" -#: ../../library/ssl.rst:377 +#: ../../library/ssl.rst:378 msgid "\"notBefore\" or \"notAfter\" dates must use GMT (:rfc:`5280`)." msgstr "\"notBefore\" 或 \"notAfter\" 日期必須使用 GMT (:rfc:`5280`)。" -#: ../../library/ssl.rst:379 +#: ../../library/ssl.rst:380 msgid "" "Interpret the input time as a time in UTC as specified by 'GMT' timezone in " "the input string. Local timezone was used previously. Return an integer (no " @@ -590,7 +590,7 @@ msgstr "" "將輸入的時間直譯為 UTC 時間,如輸入字串中指定的 'GMT' 時區。在之前是使用本地" "的時區。回傳一個整數(在輸入格式中不包括秒的小數部分)。" -#: ../../library/ssl.rst:388 +#: ../../library/ssl.rst:389 msgid "" "Given the address ``addr`` of an SSL-protected server, as a (*hostname*, " "*port-number*) pair, fetches the server's certificate, and returns it as a " @@ -611,11 +611,11 @@ msgstr "" "組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失敗。可以使用 ``timeout`` " "參數指定超時時間。" -#: ../../library/ssl.rst:399 +#: ../../library/ssl.rst:400 msgid "This function is now IPv6-compatible." msgstr "此函式現在是與 IPv6 相容的。" -#: ../../library/ssl.rst:402 +#: ../../library/ssl.rst:403 msgid "" "The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` to :data:" "`PROTOCOL_TLS` for maximum compatibility with modern servers." @@ -623,11 +623,11 @@ msgstr "" "預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改為 :data:" "`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" -#: ../../library/ssl.rst:406 +#: ../../library/ssl.rst:407 msgid "The *timeout* parameter was added." msgstr "新增 *timeout* 參數。" -#: ../../library/ssl.rst:411 +#: ../../library/ssl.rst:412 msgid "" "Given a certificate as a DER-encoded blob of bytes, returns a PEM-encoded " "string version of the same certificate." @@ -635,14 +635,14 @@ msgstr "" "給定一個以 DER 編碼的位元組 blob 作為憑證,回傳以 PEM 編碼字串版本的相同憑" "證。" -#: ../../library/ssl.rst:416 +#: ../../library/ssl.rst:417 msgid "" "Given a certificate as an ASCII PEM string, returns a DER-encoded sequence " "of bytes for that same certificate." msgstr "" "給定一個以 ASCII PEM 的字串作為憑證,回傳以 DER 編碼的位元組序列的相同憑證。" -#: ../../library/ssl.rst:421 +#: ../../library/ssl.rst:422 msgid "" "Returns a named tuple with paths to OpenSSL's default cafile and capath. The " "paths are the same as used by :meth:`SSLContext.set_default_verify_paths`. " @@ -652,39 +652,39 @@ msgstr "" "meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一個 :term:" "`named tuple` ``DefaultVerifyPaths``:" -#: ../../library/ssl.rst:426 +#: ../../library/ssl.rst:427 msgid "" ":attr:`cafile` - resolved path to cafile or ``None`` if the file doesn't " "exist," msgstr ":attr:`cafile` - 解析後的 cafile 路徑,如果檔案不存在則為 ``None``," -#: ../../library/ssl.rst:427 +#: ../../library/ssl.rst:428 msgid "" ":attr:`capath` - resolved path to capath or ``None`` if the directory " "doesn't exist," msgstr ":attr:`capath` - 解析後的 capath 路徑,如果目錄不存在則為 ``None``," -#: ../../library/ssl.rst:428 +#: ../../library/ssl.rst:429 msgid "" ":attr:`openssl_cafile_env` - OpenSSL's environment key that points to a " "cafile," msgstr ":attr:`openssl_cafile_env` - 指向 cafile 的 OpenSSL 環境密鑰," -#: ../../library/ssl.rst:429 +#: ../../library/ssl.rst:430 msgid ":attr:`openssl_cafile` - hard coded path to a cafile," msgstr ":attr:`openssl_cafile` - hard coded 的 cafile 路徑," -#: ../../library/ssl.rst:430 +#: ../../library/ssl.rst:431 msgid "" ":attr:`openssl_capath_env` - OpenSSL's environment key that points to a " "capath," msgstr ":attr:`openssl_capath_env` - 指向 capath 的 OpenSSL 環境密鑰," -#: ../../library/ssl.rst:431 +#: ../../library/ssl.rst:432 msgid ":attr:`openssl_capath` - hard coded path to a capath directory" msgstr ":attr:`openssl_capath` - hard coded 的 capath 目錄路徑" -#: ../../library/ssl.rst:437 +#: ../../library/ssl.rst:438 msgid "" "Retrieve certificates from Windows' system cert store. *store_name* may be " "one of ``CA``, ``ROOT`` or ``MY``. Windows may provide additional cert " @@ -693,7 +693,7 @@ msgstr "" "從 Windows 的系統憑證儲存庫中搜尋憑證。*store_name* 可以是 ``CA``、``ROOT`` " "或 ``MY`` 的其中一個。Windows 也可能會提供額外的憑證儲存庫。" -#: ../../library/ssl.rst:441 +#: ../../library/ssl.rst:442 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " "The encoding_type specifies the encoding of cert_bytes. It is either :const:" @@ -706,12 +706,12 @@ msgstr "" "`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。Trust 通過一" "組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 ``True``。" -#: ../../library/ssl.rst:448 ../../library/ssl.rst:1605 -#: ../../library/ssl.rst:1905 +#: ../../library/ssl.rst:449 ../../library/ssl.rst:1609 +#: ../../library/ssl.rst:1909 msgid "Example::" msgstr "範例: ::" -#: ../../library/ssl.rst:450 +#: ../../library/ssl.rst:451 msgid "" ">>> ssl.enum_certificates(\"CA\")\n" "[(b'data...', 'x509_asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),\n" @@ -721,7 +721,7 @@ msgstr "" "[(b'data...', 'x509_asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),\n" " (b'data...', 'x509_asn', True)]" -#: ../../library/ssl.rst:460 +#: ../../library/ssl.rst:461 msgid "" "Retrieve CRLs from Windows' system cert store. *store_name* may be one of " "``CA``, ``ROOT`` or ``MY``. Windows may provide additional cert stores, too." @@ -729,7 +729,7 @@ msgstr "" "從 Windows 的系統憑證儲存庫中搜尋 CRLs。*store_name* 可以是 ``CA``、``ROOT`` " "或 ``MY`` 的其中一個。Windows 也可能會提供額外的憑證儲存庫。" -#: ../../library/ssl.rst:464 +#: ../../library/ssl.rst:465 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " "The encoding_type specifies the encoding of cert_bytes. It is either :const:" @@ -739,18 +739,18 @@ msgstr "" "指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" "`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" -#: ../../library/ssl.rst:475 +#: ../../library/ssl.rst:476 msgid "Constants" msgstr "常數" -#: ../../library/ssl.rst:477 +#: ../../library/ssl.rst:478 msgid "" "All constants are now :class:`enum.IntEnum` or :class:`enum.IntFlag` " "collections." msgstr "" "所有的常數現在都是 :class:`enum.IntEnum` 或 :class:`enum.IntFlag` 的集合。" -#: ../../library/ssl.rst:483 +#: ../../library/ssl.rst:484 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. Except for :const:" "`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side sockets, " @@ -761,7 +761,7 @@ msgstr "" "外,這是預設的模式。對於用戶端的 sockets,幾乎任何憑證都能被允許。驗證錯誤," "像是不被信任或是過期的憑證,會被忽略並不會中止 TLS/SSL 握手。" -#: ../../library/ssl.rst:489 +#: ../../library/ssl.rst:490 msgid "" "In server mode, no certificate is requested from the client, so the client " "does not send any for client cert authentication." @@ -769,11 +769,11 @@ msgstr "" "在伺服器模式下,不會從用戶端請求任何憑證,所以用戶端不用發送任何用於用戶端憑" "證身分驗證的憑證。" -#: ../../library/ssl.rst:492 ../../library/ssl.rst:2407 +#: ../../library/ssl.rst:493 ../../library/ssl.rst:2411 msgid "See the discussion of :ref:`ssl-security` below." msgstr "參閱下方 :ref:`ssl-security` 的討論。" -#: ../../library/ssl.rst:496 +#: ../../library/ssl.rst:497 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In client mode, :const:" "`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. It is " @@ -783,7 +783,7 @@ msgstr "" "`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶端 sockets " "推薦改用 :const:`CERT_REQUIRED`。" -#: ../../library/ssl.rst:501 +#: ../../library/ssl.rst:502 msgid "" "In server mode, a client certificate request is sent to the client. The " "client may either ignore the request or send a certificate in order perform " @@ -795,7 +795,7 @@ msgstr "" "發送憑證來執行 TLS 用戶端憑證身分驗證。如果用戶端選擇發送憑證,則會對其進行驗" "證。任何驗證錯誤都會立刻終止 TLS 握手。" -#: ../../library/ssl.rst:507 ../../library/ssl.rst:526 +#: ../../library/ssl.rst:508 ../../library/ssl.rst:527 msgid "" "Use of this setting requires a valid set of CA certificates to be passed to :" "meth:`SSLContext.load_verify_locations`." @@ -803,7 +803,7 @@ msgstr "" "使用此設定需要將一組有效的 CA 憑證傳送給 :meth:`SSLContext." "load_verify_locations`。" -#: ../../library/ssl.rst:512 +#: ../../library/ssl.rst:513 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In this mode, " "certificates are required from the other side of the socket connection; an :" @@ -821,7 +821,7 @@ msgstr "" "`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開啟 :attr:" "`~SSLContext.check_hostname`。" -#: ../../library/ssl.rst:522 +#: ../../library/ssl.rst:523 msgid "" "With server socket, this mode provides mandatory TLS client cert " "authentication. A client certificate request is sent to the client and the " @@ -830,11 +830,11 @@ msgstr "" "對於 socket 伺服器,此模式會提供強制的 TLS 用戶端憑證驗證。用戶端憑證請求會被" "發送給用戶端並且用戶端必須提供有效且被信任的憑證。" -#: ../../library/ssl.rst:531 +#: ../../library/ssl.rst:532 msgid ":class:`enum.IntEnum` collection of CERT_* constants." msgstr ":class:`enum.IntEnum` 為 CERT_* 常數的一個集合。" -#: ../../library/ssl.rst:537 +#: ../../library/ssl.rst:538 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, " "certificate revocation lists (CRLs) are not checked. By default OpenSSL does " @@ -843,7 +843,7 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。在此模式下,不會檢查憑證吊銷列表 " "(CRLs)。預設的 OpenSSL 並不會請求及驗證 CRLs。" -#: ../../library/ssl.rst:545 +#: ../../library/ssl.rst:546 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, only the " "peer cert is checked but none of the intermediate CA certificates. The mode " @@ -856,7 +856,7 @@ msgstr "" "效的 CRL 簽名。如果沒有用 :attr:`SSLContext.load_verify_locations` 載入適當" "的 CRL,則會驗證失敗。" -#: ../../library/ssl.rst:555 +#: ../../library/ssl.rst:556 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, CRLs of " "all certificates in the peer cert chain are checked." @@ -864,7 +864,7 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。在此模式下,會檢查對等憑證鍊中所有" "憑證的 CRLs。" -#: ../../library/ssl.rst:562 +#: ../../library/ssl.rst:563 msgid "" "Possible value for :attr:`SSLContext.verify_flags` to disable workarounds " "for broken X.509 certificates." @@ -872,13 +872,13 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值,用來禁用已損壞的 X.509 憑證的解決方" "法。" -#: ../../library/ssl.rst:569 +#: ../../library/ssl.rst:570 msgid "" "Possible value for :attr:`SSLContext.verify_flags` to enables proxy " "certificate verification." msgstr ":attr:`SSLContext.verify_flags` 可能的值,用來啟用憑證代理驗證。" -#: ../../library/ssl.rst:576 +#: ../../library/ssl.rst:577 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to " "prefer trusted certificates when building the trust chain to validate a " @@ -887,7 +887,7 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。它指示 OpenSSL 在構建信任鍊來驗證憑" "證時會優先使用被信任的憑證。此旗標預設開啟。" -#: ../../library/ssl.rst:584 +#: ../../library/ssl.rst:585 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to " "accept intermediate CAs in the trust store to be treated as trust-anchors, " @@ -899,11 +899,11 @@ msgstr "" "間 CAs 作為信任錨,就像自簽名的根 CA 憑證。這樣就能去信任中間 CA 所頒發的憑" "證,而不一定非要去信任其祖先的根 CA。" -#: ../../library/ssl.rst:595 +#: ../../library/ssl.rst:596 msgid ":class:`enum.IntFlag` collection of VERIFY_* constants." msgstr ":class:`enum.IntFlag` 為 VERIFY_* 常數的其中一個集合。" -#: ../../library/ssl.rst:601 +#: ../../library/ssl.rst:602 msgid "" "Selects the highest protocol version that both the client and server " "support. Despite the name, this option can select both \"SSL\" and \"TLS\" " @@ -912,7 +912,7 @@ msgstr "" "選擇用戶端及伺服器均可以支援最高協定版本。儘管名稱只有 「TLS」,但實際上" "「SSL」和「TLS」均可以選擇。" -#: ../../library/ssl.rst:608 +#: ../../library/ssl.rst:609 msgid "" "TLS clients and servers require different default settings for secure " "communication. The generic TLS protocol constant is deprecated in favor of :" @@ -921,7 +921,7 @@ msgstr "" "TLS 的用戶端及伺服器端需要不同的預設值來實現安全通訊。通用的 TLS 協定常數已被" "廢除,並改用 :data:`PROTOCOL_TLS_CLIENT` 和 :data:`PROTOCOL_TLS_SERVER`。" -#: ../../library/ssl.rst:614 +#: ../../library/ssl.rst:615 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context client-side connections. The protocol " @@ -931,35 +931,35 @@ msgstr "" "自動協商用戶端和伺服器服務器都支援的最高協定版本,並配置用戶端語境連線。該協" "定預設啟用 :data:`CERT_REQUIRED` 和 :attr:`~SSLContext.check_hostname`。" -#: ../../library/ssl.rst:623 +#: ../../library/ssl.rst:624 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context server-side connections." msgstr "自動協商用戶端和伺服器都支援的最高協定版本,並配置用戶端語境連線。" -#: ../../library/ssl.rst:630 +#: ../../library/ssl.rst:631 msgid "Alias for :data:`PROTOCOL_TLS`." msgstr ":data:`PROTOCOL_TLS` 的別名。" -#: ../../library/ssl.rst:634 +#: ../../library/ssl.rst:635 msgid "Use :data:`PROTOCOL_TLS` instead." msgstr "請改用 :data:`PROTOCOL_TLS`。" -#: ../../library/ssl.rst:638 +#: ../../library/ssl.rst:639 msgid "Selects SSL version 3 as the channel encryption protocol." msgstr "選擇第三版的 SSL 做為通道加密協定。" -#: ../../library/ssl.rst:640 +#: ../../library/ssl.rst:641 msgid "" "This protocol is not available if OpenSSL is compiled with the ``no-ssl3`` " "option." msgstr "如果 OpenSSL 是用 ``no-ssl3`` 編譯的,則此項協定無法使用。" -#: ../../library/ssl.rst:645 +#: ../../library/ssl.rst:646 msgid "SSL version 3 is insecure. Its use is highly discouraged." msgstr "第三版的 SSL 是不安全的,強烈建議不要使用。" -#: ../../library/ssl.rst:649 +#: ../../library/ssl.rst:650 msgid "" "OpenSSL has deprecated all version specific protocols. Use the default " "protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` with :" @@ -970,16 +970,16 @@ msgstr "" "`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` 和 :attr:" "`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" -#: ../../library/ssl.rst:657 +#: ../../library/ssl.rst:658 msgid "Selects TLS version 1.0 as the channel encryption protocol." msgstr "選擇 1.0 版的 TLS 做為通道加密協定。" -#: ../../library/ssl.rst:661 ../../library/ssl.rst:672 -#: ../../library/ssl.rst:683 +#: ../../library/ssl.rst:662 ../../library/ssl.rst:673 +#: ../../library/ssl.rst:684 msgid "OpenSSL has deprecated all version specific protocols." msgstr "OpenSSL 已經將所有版本特定的協定棄用。" -#: ../../library/ssl.rst:665 +#: ../../library/ssl.rst:666 msgid "" "Selects TLS version 1.1 as the channel encryption protocol. Available only " "with openssl version 1.0.1+." @@ -987,7 +987,7 @@ msgstr "" "選擇 1.1 版的 TLS 做為通道加密協定。只有在 1.0.1 版本以上的 OpenSSL 才可以選" "用。" -#: ../../library/ssl.rst:676 +#: ../../library/ssl.rst:677 msgid "" "Selects TLS version 1.2 as the channel encryption protocol. Available only " "with openssl version 1.0.1+." @@ -995,7 +995,7 @@ msgstr "" "選擇 1.2 版的 TLS 做為通道加密協定。只有在 1.0.1 版本以上的 OpenSSL 才可以選" "用。" -#: ../../library/ssl.rst:687 +#: ../../library/ssl.rst:688 msgid "" "Enables workarounds for various bugs present in other SSL implementations. " "This option is set by default. It does not necessarily set the same flags " @@ -1004,7 +1004,7 @@ msgstr "" "啟用對 SSL 實作時所產生的各種錯誤的緩解措施。此選項預設被設定。它不一定設定" "與 OpenSSL 的 ``SSL_OP_ALL`` 常數相同的旗標。" -#: ../../library/ssl.rst:695 +#: ../../library/ssl.rst:696 msgid "" "Prevents an SSLv2 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing SSLv2 as " @@ -1013,11 +1013,11 @@ msgstr "" "防止 SSLv2 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同級 " "(peer)選用 SSLv2 做為協定版本。" -#: ../../library/ssl.rst:703 +#: ../../library/ssl.rst:704 msgid "SSLv2 is deprecated" msgstr "SSLv2 已被棄用" -#: ../../library/ssl.rst:707 +#: ../../library/ssl.rst:708 msgid "" "Prevents an SSLv3 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing SSLv3 as " @@ -1026,11 +1026,11 @@ msgstr "" "防止 SSLv3 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同級" "選用 SSLv3 做為協定版本。" -#: ../../library/ssl.rst:715 +#: ../../library/ssl.rst:716 msgid "SSLv3 is deprecated" msgstr "SSLv3 已被棄用" -#: ../../library/ssl.rst:719 +#: ../../library/ssl.rst:720 msgid "" "Prevents a TLSv1 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1 as " @@ -1039,7 +1039,7 @@ msgstr "" "防止 TLSv1 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同級" "選用 TLSv1 做為協定版本。" -#: ../../library/ssl.rst:725 +#: ../../library/ssl.rst:726 msgid "" "The option is deprecated since OpenSSL 1.1.0, use the new :attr:`SSLContext." "minimum_version` and :attr:`SSLContext.maximum_version` instead." @@ -1047,7 +1047,7 @@ msgstr "" "該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新的 :attr:`SSLContext." "minimum_version` 及 :attr:`SSLContext.maximum_version` 代替。" -#: ../../library/ssl.rst:732 +#: ../../library/ssl.rst:733 msgid "" "Prevents a TLSv1.1 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.1 as " @@ -1056,11 +1056,11 @@ msgstr "" "防止 TLSv1.1 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同" "級選用 TLSv1.1 做為協定版本。只有 1.0.1 版後的 OpenSSL 版本才能使用。" -#: ../../library/ssl.rst:738 ../../library/ssl.rst:749 +#: ../../library/ssl.rst:739 ../../library/ssl.rst:750 msgid "The option is deprecated since OpenSSL 1.1.0." msgstr "此選項自 OpenSSL 1.1.0 版已被棄用。" -#: ../../library/ssl.rst:743 +#: ../../library/ssl.rst:744 msgid "" "Prevents a TLSv1.2 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.2 as " @@ -1069,7 +1069,7 @@ msgstr "" "防止 TLSv1.2 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同" "級選用 TLSv1.2 做為協定版本。只有 1.0.1 版後的 OpenSSL 版本才能使用。" -#: ../../library/ssl.rst:754 +#: ../../library/ssl.rst:755 msgid "" "Prevents a TLSv1.3 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.3 as " @@ -1081,7 +1081,7 @@ msgstr "" "級選用 TLSv1.3 做為協定版本。TSL1.3 只適用於 1.1.1 版以後的 OpenSSL。當使用 " "Python 編譯舊版的 OpenSSL 時,該標志預設為 *0*。" -#: ../../library/ssl.rst:762 +#: ../../library/ssl.rst:763 msgid "" "The option is deprecated since OpenSSL 1.1.0. It was added to 2.7.15 and " "3.6.3 for backwards compatibility with OpenSSL 1.0.2." @@ -1089,7 +1089,7 @@ msgstr "" "此選項自 OpenSSL 1.1.0 以後已被棄用。它被添加到 2.7.15 和 3.6.3 中,以向後相" "容 OpenSSL 1.0.2。" -#: ../../library/ssl.rst:768 +#: ../../library/ssl.rst:769 msgid "" "Disable all renegotiation in TLSv1.2 and earlier. Do not send HelloRequest " "messages, and ignore renegotiation requests via ClientHello." @@ -1097,11 +1097,11 @@ msgstr "" "停用所有在 TLSv1.2 及更早版本的重協商 (renegotiation)。不發送 HelloRequest 訊" "息,並忽略通過 ClientHello 的重協商請求。" -#: ../../library/ssl.rst:771 +#: ../../library/ssl.rst:772 msgid "This option is only available with OpenSSL 1.1.0h and later." msgstr "此選項僅適用於 OpenSSL 1.1.0h 及更新版本。" -#: ../../library/ssl.rst:777 +#: ../../library/ssl.rst:778 msgid "" "Use the server's cipher ordering preference, rather than the client's. This " "option has no effect on client sockets and SSLv2 server sockets." @@ -1109,7 +1109,7 @@ msgstr "" "使用伺服器的加密方法名稱字串排序優先順序,而不是用戶端的。此選項並不會影響到" "用戶端及 SSLv2 伺服器的 sockets。" -#: ../../library/ssl.rst:784 +#: ../../library/ssl.rst:785 msgid "" "Prevents reuse of the same DH key for distinct SSL sessions. This improves " "forward secrecy but requires more computational resources. This option only " @@ -1118,7 +1118,7 @@ msgstr "" "防止對不同的 SSL 會談重複使用相同的 DH 密鑰。這會加強向前保密但需要更多的運算" "資源。此選項只適用於伺服器 sockets。" -#: ../../library/ssl.rst:792 +#: ../../library/ssl.rst:793 msgid "" "Prevents reuse of the same ECDH key for distinct SSL sessions. This " "improves forward secrecy but requires more computational resources. This " @@ -1127,7 +1127,7 @@ msgstr "" "防止對不同的 SSL 會談重複使用相同的 ECDH 密鑰。這會加強向前保密但需要更多的運" "算資源。此選項只適用於伺服器 sockets。" -#: ../../library/ssl.rst:800 +#: ../../library/ssl.rst:801 msgid "" "Send dummy Change Cipher Spec (CCS) messages in TLS 1.3 handshake to make a " "TLS 1.3 connection look more like a TLS 1.2 connection." @@ -1135,34 +1135,34 @@ msgstr "" "在 TLS 1.3 握手中發送虛擬的變更加密方法規範 (CCS) 消息,以使 TLS 1.3 連接看起" "來更像 TLS 1.2 連線。" -#: ../../library/ssl.rst:803 +#: ../../library/ssl.rst:804 msgid "This option is only available with OpenSSL 1.1.1 and later." msgstr "此選項僅適用於 OpenSSL 1.1.1 及更新版本。" -#: ../../library/ssl.rst:809 +#: ../../library/ssl.rst:810 msgid "" "Disable compression on the SSL channel. This is useful if the application " "protocol supports its own compression scheme." msgstr "" "在 SSL 通道上禁用壓縮。如果應用程序協定支援自己的壓縮方案,這會很有用。" -#: ../../library/ssl.rst:816 +#: ../../library/ssl.rst:817 msgid ":class:`enum.IntFlag` collection of OP_* constants." msgstr ":class:`enum.IntFlag` 為 OP_* 常數中的一個集合。" -#: ../../library/ssl.rst:820 +#: ../../library/ssl.rst:821 msgid "Prevent client side from requesting a session ticket." msgstr "防止用戶端請求會談票據。" -#: ../../library/ssl.rst:826 +#: ../../library/ssl.rst:827 msgid "Ignore unexpected shutdown of TLS connections." msgstr "忽略意外關閉的 TLS 連線。" -#: ../../library/ssl.rst:828 ../../library/ssl.rst:844 +#: ../../library/ssl.rst:829 ../../library/ssl.rst:845 msgid "This option is only available with OpenSSL 3.0.0 and later." msgstr "此選項僅適用於 OpenSSL 3.0.0 及更新版本。" -#: ../../library/ssl.rst:834 +#: ../../library/ssl.rst:835 msgid "" "Enable the use of the kernel TLS. To benefit from the feature, OpenSSL must " "have been compiled with support for it, and the negotiated cipher suites and " @@ -1173,7 +1173,7 @@ msgstr "" "的加密套件及擴充套件也必須被該功能支援 (該功能所支援的列表可能會因平台及核心" "而有所差異)。" -#: ../../library/ssl.rst:839 +#: ../../library/ssl.rst:840 msgid "" "Note that with enabled kernel TLS some cryptographic operations are " "performed by the kernel directly and not via any available OpenSSL " @@ -1184,13 +1184,13 @@ msgstr "" "的 OpenSSL 所提供的程序,而這可能並非你所想使用的,例如:當應用程式要求所有的" "加密操作由 FIPS 提供執行。" -#: ../../library/ssl.rst:850 +#: ../../library/ssl.rst:851 msgid "" "Allow legacy insecure renegotiation between OpenSSL and unpatched servers " "only." msgstr "只允許 OpenSSL 與未修補的伺服器進行遺留 (legacy) 不安全重協商。" -#: ../../library/ssl.rst:857 +#: ../../library/ssl.rst:858 msgid "" "Whether the OpenSSL library has built-in support for the *Application-Layer " "Protocol Negotiation* TLS extension as described in :rfc:`7301`." @@ -1198,7 +1198,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述在 :" "rfc:`7301` 中。" -#: ../../library/ssl.rst:864 +#: ../../library/ssl.rst:865 msgid "" "Whether the OpenSSL library has built-in support not checking subject common " "name and :attr:`SSLContext.hostname_checks_common_name` is writeable." @@ -1206,7 +1206,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援不檢查主題通用名稱及 :attr:`SSLContext." "hostname_checks_common_name` 是否可寫。" -#: ../../library/ssl.rst:872 +#: ../../library/ssl.rst:873 msgid "" "Whether the OpenSSL library has built-in support for the Elliptic Curve-" "based Diffie-Hellman key exchange. This should be true unless the feature " @@ -1215,7 +1215,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援基於橢圓曲線的 (Elliptic Curve-based) Diffie-" "Hellman 金鑰交換。此回傳值應該要為 true 除非發布者明確禁用此功能。" -#: ../../library/ssl.rst:880 +#: ../../library/ssl.rst:881 msgid "" "Whether the OpenSSL library has built-in support for the *Server Name " "Indication* extension (as defined in :rfc:`6066`)." @@ -1223,7 +1223,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援 *伺服器名稱提示* 擴充套件 (在 :rfc:`6066` 中定" "義)。" -#: ../../library/ssl.rst:887 +#: ../../library/ssl.rst:888 msgid "" "Whether the OpenSSL library has built-in support for the *Next Protocol " "Negotiation* as described in the `Application Layer Protocol Negotiation " @@ -1236,45 +1236,45 @@ msgstr "" "描述。當此值為 true 時,你可以使用 :meth:`SSLContext.set_npn_protocols` 方法" "來公告你想支援的協定。" -#: ../../library/ssl.rst:897 +#: ../../library/ssl.rst:898 msgid "" "Whether the OpenSSL library has built-in support for the SSL 2.0 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 SSL 2.0 協定。" -#: ../../library/ssl.rst:903 +#: ../../library/ssl.rst:904 msgid "" "Whether the OpenSSL library has built-in support for the SSL 3.0 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 SSL 3.0 協定。" -#: ../../library/ssl.rst:909 +#: ../../library/ssl.rst:910 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.0 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.0 協定。" -#: ../../library/ssl.rst:915 +#: ../../library/ssl.rst:916 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.1 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.1 協定。" -#: ../../library/ssl.rst:921 +#: ../../library/ssl.rst:922 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.2 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.2 協定。" -#: ../../library/ssl.rst:927 +#: ../../library/ssl.rst:928 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.3 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.3 協定。" -#: ../../library/ssl.rst:933 +#: ../../library/ssl.rst:934 msgid "Whether the OpenSSL library has built-in support for TLS-PSK." msgstr "此 OpenSSL 函式庫是否內建支援 TLS-PSK。" -#: ../../library/ssl.rst:939 +#: ../../library/ssl.rst:940 msgid "Whether the OpenSSL library has built-in support for TLS-PHA." msgstr "此 OpenSSL 函式庫是否內建支援 TLS-PHA。" -#: ../../library/ssl.rst:945 +#: ../../library/ssl.rst:946 msgid "" "List of supported TLS channel binding types. Strings in this list can be " "used as arguments to :meth:`SSLSocket.get_channel_binding`." @@ -1282,11 +1282,11 @@ msgstr "" "支援的 TLS 通道綁定類型列表。列表中的字串可以作為 :meth:`SSLSocket." "get_channel_binding` 的參數。" -#: ../../library/ssl.rst:952 +#: ../../library/ssl.rst:953 msgid "The version string of the OpenSSL library loaded by the interpreter::" msgstr "直譯器所加載的 OpenSSL 函式庫的版本字串::" -#: ../../library/ssl.rst:954 +#: ../../library/ssl.rst:955 msgid "" ">>> ssl.OPENSSL_VERSION\n" "'OpenSSL 1.0.2k 26 Jan 2017'" @@ -1294,13 +1294,13 @@ msgstr "" ">>> ssl.OPENSSL_VERSION\n" "'OpenSSL 1.0.2k 26 Jan 2017'" -#: ../../library/ssl.rst:961 +#: ../../library/ssl.rst:962 msgid "" "A tuple of five integers representing version information about the OpenSSL " "library::" msgstr "代表 OpenSSL 函式庫版本資訊的五個整數的元組: ::" -#: ../../library/ssl.rst:964 +#: ../../library/ssl.rst:965 msgid "" ">>> ssl.OPENSSL_VERSION_INFO\n" "(1, 0, 2, 11, 15)" @@ -1308,11 +1308,11 @@ msgstr "" ">>> ssl.OPENSSL_VERSION_INFO\n" "(1, 0, 2, 11, 15)" -#: ../../library/ssl.rst:971 +#: ../../library/ssl.rst:972 msgid "The raw version number of the OpenSSL library, as a single integer::" msgstr "OpenSSL 函式庫的初始版本,以單一整數表示::" -#: ../../library/ssl.rst:973 +#: ../../library/ssl.rst:974 msgid "" ">>> ssl.OPENSSL_VERSION_NUMBER\n" "268443839\n" @@ -1324,7 +1324,7 @@ msgstr "" ">>> hex(ssl.OPENSSL_VERSION_NUMBER)\n" "'0x100020bf'" -#: ../../library/ssl.rst:984 +#: ../../library/ssl.rst:985 msgid "" "Alert Descriptions from :rfc:`5246` and others. The `IANA TLS Alert Registry " "`_ 包" "含了此列表以及其含義定義所在的 RFC 的引用。" -#: ../../library/ssl.rst:988 +#: ../../library/ssl.rst:989 msgid "" "Used as the return value of the callback function in :meth:`SSLContext." "set_servername_callback`." msgstr "" "被用來做為 :meth:`SSLContext.set_servername_callback` 中回呼函式的回傳值。" -#: ../../library/ssl.rst:995 +#: ../../library/ssl.rst:996 msgid ":class:`enum.IntEnum` collection of ALERT_DESCRIPTION_* constants." msgstr ":class:`enum.IntEnum` 為 ALERT_DESCRIPTION_* 常數中的一個集合。" -#: ../../library/ssl.rst:1001 +#: ../../library/ssl.rst:1002 msgid "" "Option for :func:`create_default_context` and :meth:`SSLContext." "load_default_certs`. This value indicates that the context may be used to " @@ -1356,7 +1356,7 @@ msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁伺服器 (因此它將用於建立用戶端 socket)。" -#: ../../library/ssl.rst:1010 +#: ../../library/ssl.rst:1011 msgid "" "Option for :func:`create_default_context` and :meth:`SSLContext." "load_default_certs`. This value indicates that the context may be used to " @@ -1367,11 +1367,11 @@ msgstr "" "項。此值表示該語境可能會用於驗證網頁用戶端 (因此,它將用於建立伺服器端的 " "socket)。" -#: ../../library/ssl.rst:1019 +#: ../../library/ssl.rst:1020 msgid ":class:`enum.IntEnum` collection of SSL_ERROR_* constants." msgstr ":class:`enum.IntEnum` 為 SSL_ERROR_* 常數中的一個集合。" -#: ../../library/ssl.rst:1025 +#: ../../library/ssl.rst:1026 msgid "" ":class:`enum.IntEnum` collection of SSL and TLS versions for :attr:" "`SSLContext.maximum_version` and :attr:`SSLContext.minimum_version`." @@ -1379,7 +1379,7 @@ msgstr "" "用於 :attr:`SSLContext.maximum_version` 和 :attr:`SSLContext." "minimum_version` 的 SSL 和 TLS 版本 :class:`enum.IntEnum` 集合。" -#: ../../library/ssl.rst:1033 +#: ../../library/ssl.rst:1034 msgid "" "The minimum or maximum supported SSL or TLS version. These are magic " "constants. Their values don't reflect the lowest and highest available TLS/" @@ -1388,11 +1388,11 @@ msgstr "" "最低或最高支援的 SSL 或 TLS 版本。這些是特殊常數。它們的值並不反映可用的最低" "和最高 TLS/SSL 版本。" -#: ../../library/ssl.rst:1043 +#: ../../library/ssl.rst:1044 msgid "SSL 3.0 to TLS 1.3." msgstr "SSL 3.0 到 TLS 1.3。" -#: ../../library/ssl.rst:1047 +#: ../../library/ssl.rst:1048 msgid "" "All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` and :attr:" "`TLSVersion.TLSv1_3` are deprecated." @@ -1400,47 +1400,47 @@ msgstr "" "除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有的 :" "class:`TLSVersion` 成員都已被棄用。" -#: ../../library/ssl.rst:1052 +#: ../../library/ssl.rst:1053 msgid "SSL Sockets" msgstr "SSL Sockets" -#: ../../library/ssl.rst:1056 +#: ../../library/ssl.rst:1057 msgid "SSL sockets provide the following methods of :ref:`socket-objects`:" msgstr "SSL sockets 提供以下 :ref:`socket-objects` 方法:" -#: ../../library/ssl.rst:1058 +#: ../../library/ssl.rst:1059 msgid ":meth:`~socket.socket.accept`" msgstr ":meth:`~socket.socket.accept`" -#: ../../library/ssl.rst:1059 +#: ../../library/ssl.rst:1060 msgid ":meth:`~socket.socket.bind`" msgstr ":meth:`~socket.socket.bind`" -#: ../../library/ssl.rst:1060 +#: ../../library/ssl.rst:1061 msgid ":meth:`~socket.socket.close`" msgstr ":meth:`~socket.socket.close`" -#: ../../library/ssl.rst:1061 +#: ../../library/ssl.rst:1062 msgid ":meth:`~socket.socket.connect`" msgstr ":meth:`~socket.socket.connect`" -#: ../../library/ssl.rst:1062 +#: ../../library/ssl.rst:1063 msgid ":meth:`~socket.socket.detach`" msgstr ":meth:`~socket.socket.detach`" -#: ../../library/ssl.rst:1063 +#: ../../library/ssl.rst:1064 msgid ":meth:`~socket.socket.fileno`" msgstr ":meth:`~socket.socket.fileno`" -#: ../../library/ssl.rst:1064 +#: ../../library/ssl.rst:1065 msgid ":meth:`~socket.socket.getpeername`, :meth:`~socket.socket.getsockname`" msgstr ":meth:`~socket.socket.getpeername`、:meth:`~socket.socket.getsockname`" -#: ../../library/ssl.rst:1065 +#: ../../library/ssl.rst:1066 msgid ":meth:`~socket.socket.getsockopt`, :meth:`~socket.socket.setsockopt`" msgstr ":meth:`~socket.socket.getsockopt`、:meth:`~socket.socket.setsockopt`" -#: ../../library/ssl.rst:1066 +#: ../../library/ssl.rst:1067 msgid "" ":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:" "`~socket.socket.setblocking`" @@ -1448,15 +1448,15 @@ msgstr "" ":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:" "`~socket.socket.setblocking`" -#: ../../library/ssl.rst:1068 +#: ../../library/ssl.rst:1069 msgid ":meth:`~socket.socket.listen`" msgstr ":meth:`~socket.socket.listen`" -#: ../../library/ssl.rst:1069 +#: ../../library/ssl.rst:1070 msgid ":meth:`~socket.socket.makefile`" msgstr ":meth:`~socket.socket.makefile`" -#: ../../library/ssl.rst:1070 +#: ../../library/ssl.rst:1071 msgid "" ":meth:`~socket.socket.recv`, :meth:`~socket.socket.recv_into` (but passing a " "non-zero ``flags`` argument is not allowed)" @@ -1464,7 +1464,7 @@ msgstr "" ":meth:`~socket.socket.recv`、:meth:`~socket.socket.recv_into` (但不允許傳遞" "非零的 ``flags`` 引數)" -#: ../../library/ssl.rst:1072 +#: ../../library/ssl.rst:1073 msgid "" ":meth:`~socket.socket.send`, :meth:`~socket.socket.sendall` (with the same " "limitation)" @@ -1472,7 +1472,7 @@ msgstr "" ":meth:`~socket.socket.send`、:meth:`~socket.socket.sendall` (同樣不允許傳遞" "非零的 ``flags`` 引數)" -#: ../../library/ssl.rst:1074 +#: ../../library/ssl.rst:1075 msgid "" ":meth:`~socket.socket.sendfile` (but :mod:`os.sendfile` will be used for " "plain-text sockets only, else :meth:`~socket.socket.send` will be used)" @@ -1480,11 +1480,11 @@ msgstr "" ":meth:`~socket.socket.sendfile` (但 :mod:`os.sendfile` 只能用於純文本 " "sockets,其餘則會使用 :meth:`~socket.socket.send`)" -#: ../../library/ssl.rst:1076 +#: ../../library/ssl.rst:1077 msgid ":meth:`~socket.socket.shutdown`" msgstr ":meth:`~socket.socket.shutdown`" -#: ../../library/ssl.rst:1078 +#: ../../library/ssl.rst:1079 msgid "" "However, since the SSL (and TLS) protocol has its own framing atop of TCP, " "the SSL sockets abstraction can, in certain respects, diverge from the " @@ -1495,18 +1495,18 @@ msgstr "" "sockets 的抽象可能會與普通作業系統級別的 sockets 規範有所不同。特別是請參閱" "\\ :ref:`關於 non-blocking sockets 的說明 `。" -#: ../../library/ssl.rst:1083 +#: ../../library/ssl.rst:1084 msgid "" "Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." "wrap_socket` method." msgstr "" ":class:`SSLSocket` 的實例必須使用 :meth:`SSLContext.wrap_socket` 方法建立。" -#: ../../library/ssl.rst:1086 +#: ../../library/ssl.rst:1087 msgid "The :meth:`sendfile` method was added." msgstr "新增 :meth:`sendfile` 方法。" -#: ../../library/ssl.rst:1089 +#: ../../library/ssl.rst:1090 msgid "" "The :meth:`shutdown` does not reset the socket timeout each time bytes are " "received or sent. The socket timeout is now the maximum total duration of " @@ -1515,7 +1515,7 @@ msgstr "" ":meth:`shutdown` 不會在每次接收或發送位元組時重置 socket 超時時間。現在," "socket 超時時間是關閉操作的最大總持續時間。" -#: ../../library/ssl.rst:1094 +#: ../../library/ssl.rst:1095 msgid "" "It is deprecated to create a :class:`SSLSocket` instance directly, use :meth:" "`SSLContext.wrap_socket` to wrap a socket." @@ -1523,7 +1523,7 @@ msgstr "" "直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使用 :meth:`SSLContext." "wrap_socket` 來包裝 socket。" -#: ../../library/ssl.rst:1098 +#: ../../library/ssl.rst:1099 msgid "" ":class:`SSLSocket` instances must to created with :meth:`~SSLContext." "wrap_socket`. In earlier versions, it was possible to create instances " @@ -1532,7 +1532,7 @@ msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`~SSLContext.wrap_socket` 建立。在較早" "的版本中可以直接建立實例,但這從未被記錄或正式支援。" -#: ../../library/ssl.rst:1104 +#: ../../library/ssl.rst:1105 msgid "" "Python now uses ``SSL_read_ex`` and ``SSL_write_ex`` internally. The " "functions support reading and writing of data larger than 2 GB. Writing zero-" @@ -1541,11 +1541,11 @@ msgstr "" "Python 現在內部使用了 ``SSL_read_ex`` 和 ``SSL_write_ex`` 函式。這些函式支援" "讀取和寫入大於 2 GB 的資料。寫入零長度的資料不再會導致協定違規錯誤。" -#: ../../library/ssl.rst:1109 +#: ../../library/ssl.rst:1110 msgid "SSL sockets also have the following additional methods and attributes:" msgstr "SSL sockets 還具有以下附加方法和屬性:" -#: ../../library/ssl.rst:1113 +#: ../../library/ssl.rst:1114 msgid "" "Read up to *len* bytes of data from the SSL socket and return the result as " "a ``bytes`` instance. If *buffer* is specified, then read into the buffer " @@ -1554,7 +1554,7 @@ msgstr "" "從 SSL socket 讀取 *len* 位元組的資料,並將結果以 ``bytes`` 實例的形式回傳。" "如果指定了 *buffer*,則將資料讀入緩衝區,並回傳讀取的位元組。" -#: ../../library/ssl.rst:1117 +#: ../../library/ssl.rst:1118 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the read would block." @@ -1562,14 +1562,14 @@ msgstr "" "如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" "`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻塞。" -#: ../../library/ssl.rst:1120 +#: ../../library/ssl.rst:1121 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`read` can also " "cause write operations." msgstr "" "由於在任何時刻都可能發生重新協商,呼叫 :meth:`read` 也可能觸發寫入操作。" -#: ../../library/ssl.rst:1123 +#: ../../library/ssl.rst:1124 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration to read up to *len* " @@ -1578,19 +1578,19 @@ msgstr "" "當接收或發送位元組時,socket 的超時時間將不再重置。現在,socket 超時時間是讀" "取最多 *len* 位元組的總最大持續時間。" -#: ../../library/ssl.rst:1128 +#: ../../library/ssl.rst:1129 msgid "Use :meth:`~SSLSocket.recv` instead of :meth:`~SSLSocket.read`." msgstr "請改用 :meth:`~SSLSocket.recv` 來替換掉 :meth:`~SSLSocket.read`。" -#: ../../library/ssl.rst:1133 +#: ../../library/ssl.rst:1134 msgid "" -"Write *buf* to the SSL socket and return the number of bytes written. The " -"*buf* argument must be an object supporting the buffer interface." +"Write *data* to the SSL socket and return the number of bytes written. The " +"*data* argument must be an object supporting the buffer interface." msgstr "" -"將 *buf* 寫入 SSL socket 並回傳寫入的位元組數量。*buf* 引數必須是支援緩衝區介" +"將 *data* 寫入 SSL socket 並回傳寫入的位元組數量。*data* 引數必須是支援緩衝區介" "面的物件。" -#: ../../library/ssl.rst:1136 +#: ../../library/ssl.rst:1137 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the write would block." @@ -1598,26 +1598,26 @@ msgstr "" "如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" "`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻塞。" -#: ../../library/ssl.rst:1139 +#: ../../library/ssl.rst:1140 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`write` can " "also cause read operations." msgstr "" "由於在任何時刻都可能發生重新協商,呼叫 :meth:`write` 也可能觸發讀取操作。" -#: ../../library/ssl.rst:1142 +#: ../../library/ssl.rst:1143 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " -"The socket timeout is now the maximum total duration to write *buf*." +"The socket timeout is now the maximum total duration to write *data*." msgstr "" "當接收或發送位元組時,socket 的超時時間將不再重置。現在,socket 超時時間是寫" -"入 *buf* 的總最大持續時間。" +"入 *data* 的總最大持續時間。" -#: ../../library/ssl.rst:1146 +#: ../../library/ssl.rst:1147 msgid "Use :meth:`~SSLSocket.send` instead of :meth:`~SSLSocket.write`." msgstr "請改用 :meth:`~SSLSocket.send` 來替換掉 :meth:`~SSLSocket.write`。" -#: ../../library/ssl.rst:1151 +#: ../../library/ssl.rst:1152 msgid "" "The :meth:`~SSLSocket.read` and :meth:`~SSLSocket.write` methods are the low-" "level methods that read and write unencrypted, application-level data and " @@ -1629,7 +1629,7 @@ msgstr "" "讀取和寫入未加密的應用層資料,並將其加密/解密為加密的寫入層資料。這些方法需要" "一個已建立的 SSL 連接,即握手已完成,且未呼叫 :meth:`SSLSocket.unwrap`。" -#: ../../library/ssl.rst:1157 +#: ../../library/ssl.rst:1158 msgid "" "Normally you should use the socket API methods like :meth:`~socket.socket." "recv` and :meth:`~socket.socket.send` instead of these methods." @@ -1637,20 +1637,27 @@ msgstr "" "通常你應該使用像 :meth:`~socket.socket.recv` 和 :meth:`~socket.socket.send` " "這樣的 socket API 方法,而不是直接使用這些方法。" -#: ../../library/ssl.rst:1163 +#: ../../library/ssl.rst:1164 msgid "Perform the SSL setup handshake." msgstr "執行 SSL 設定握手。" -#: ../../library/ssl.rst:1165 +#: ../../library/ssl.rst:1166 +msgid "" +"If *block* is true and the timeout obtained by :meth:`~socket.socket." +"gettimeout` is zero, the socket is set in blocking mode until the handshake " +"is performed." +msgstr "" + +#: ../../library/ssl.rst:1169 msgid "" -"The handshake method also performs :func:`match_hostname` when the :attr:" +"The handshake method also performs :func:`!match_hostname` when the :attr:" "`~SSLContext.check_hostname` attribute of the socket's :attr:`~SSLSocket." "context` is true." msgstr "" "當 socket 的 :attr:`~SSLSocket.context` 的 :attr:`~SSLContext." -"check_hostname` 屬性質為 true 時,握手方法也會執行 :func:`match_hostname`。" +"check_hostname` 屬性質為 true 時,握手方法也會執行 :func:`!match_hostname`。" -#: ../../library/ssl.rst:1170 +#: ../../library/ssl.rst:1174 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration of the handshake." @@ -1658,18 +1665,18 @@ msgstr "" "Socket 超時時間已經不會在每次接收或傳送位元組時重置。現在,超時時間是握手過程" "的最大總持續時間。" -#: ../../library/ssl.rst:1174 +#: ../../library/ssl.rst:1178 msgid "" "Hostname or IP address is matched by OpenSSL during handshake. The function :" -"func:`match_hostname` is no longer used. In case OpenSSL refuses a hostname " +"func:`!match_hostname` is no longer used. In case OpenSSL refuses a hostname " "or IP address, the handshake is aborted early and a TLS alert message is " "sent to the peer." msgstr "" "在握手過程中,OpenSSL 會去配對主機名稱或 IP 地址。已不再使用 :func:" -"`match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手將會提前" +"`!match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手將會提前" "中止,並向對方發送 TLS 警報訊息。" -#: ../../library/ssl.rst:1182 +#: ../../library/ssl.rst:1186 msgid "" "If there is no certificate for the peer on the other end of the connection, " "return ``None``. If the SSL handshake hasn't been done yet, raise :exc:" @@ -1678,7 +1685,7 @@ msgstr "" "如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引發 :exc:" "`ValueError`。" -#: ../../library/ssl.rst:1186 +#: ../../library/ssl.rst:1190 msgid "" "If the ``binary_form`` parameter is :const:`False`, and a certificate was " "received from the peer, this method returns a :class:`dict` instance. If " @@ -1695,7 +1702,7 @@ msgstr "" "``issuer`` (簽發證書的主體)。如果證書中包含 *Subject Alternative Name* 擴充 " "(參考\\ :rfc:`3280`\\ ),字典中還會有一個 ``subjectAltName`` 鍵。" -#: ../../library/ssl.rst:1195 +#: ../../library/ssl.rst:1199 msgid "" "The ``subject`` and ``issuer`` fields are tuples containing the sequence of " "relative distinguished names (RDNs) given in the certificate's data " @@ -1706,7 +1713,7 @@ msgstr "" "names, RDNs) 序列的元組,這些 RDN 來自證書資料結構中的相應欄位。每個 RDN 都是" "一組名稱與值的對。以下是現實中的範例: ::" -#: ../../library/ssl.rst:1200 +#: ../../library/ssl.rst:1204 msgid "" "{'issuer': ((('countryName', 'IL'),),\n" " (('organizationName', 'StartCom Ltd.'),),\n" @@ -1748,7 +1755,7 @@ msgstr "" " 'subjectAltName': (('DNS', '*.eff.org'), ('DNS', 'eff.org')),\n" " 'version': 3}" -#: ../../library/ssl.rst:1219 +#: ../../library/ssl.rst:1223 msgid "" "If the ``binary_form`` parameter is :const:`True`, and a certificate was " "provided, this method returns the DER-encoded form of the entire certificate " @@ -1760,13 +1767,13 @@ msgstr "" "以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回傳 :" "const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" -#: ../../library/ssl.rst:1225 +#: ../../library/ssl.rst:1229 msgid "" "for a client SSL socket, the server will always provide a certificate, " "regardless of whether validation was required;" msgstr "對於用戶端 SSL socket,伺服器將永遠提供證書,無論是否需要進行驗證;" -#: ../../library/ssl.rst:1228 +#: ../../library/ssl.rst:1232 msgid "" "for a server SSL socket, the client will only provide a certificate when " "requested by the server; therefore :meth:`getpeercert` will return :const:" @@ -1777,41 +1784,41 @@ msgstr "" "是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` 或 :const:" "`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" -#: ../../library/ssl.rst:1233 +#: ../../library/ssl.rst:1237 msgid "See also :attr:`SSLContext.check_hostname`." msgstr "請見 :attr:`SSLContext.check_hostname`。" -#: ../../library/ssl.rst:1235 +#: ../../library/ssl.rst:1239 msgid "" "The returned dictionary includes additional items such as ``issuer`` and " "``notBefore``." msgstr "" -#: ../../library/ssl.rst:1239 +#: ../../library/ssl.rst:1243 msgid "" ":exc:`ValueError` is raised when the handshake isn't done. The returned " "dictionary includes additional X509v3 extension items such as " "``crlDistributionPoints``, ``caIssuers`` and ``OCSP`` URIs." msgstr "" -#: ../../library/ssl.rst:1244 +#: ../../library/ssl.rst:1248 msgid "IPv6 address strings no longer have a trailing new line." msgstr "" -#: ../../library/ssl.rst:1249 +#: ../../library/ssl.rst:1253 msgid "" "Returns verified certificate chain provided by the other end of the SSL " "channel as a list of DER-encoded bytes. If certificate verification was " "disabled method acts the same as :meth:`~SSLSocket.get_unverified_chain`." msgstr "" -#: ../../library/ssl.rst:1258 +#: ../../library/ssl.rst:1262 msgid "" "Returns raw certificate chain provided by the other end of the SSL channel " "as a list of DER-encoded bytes." msgstr "" -#: ../../library/ssl.rst:1265 +#: ../../library/ssl.rst:1269 msgid "" "Returns a three-value tuple containing the name of the cipher being used, " "the version of the SSL protocol that defines its use, and the number of " @@ -1819,7 +1826,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ssl.rst:1271 +#: ../../library/ssl.rst:1275 msgid "" "Return the list of ciphers available in both the client and server. Each " "entry of the returned list is a three-value tuple containing the name of the " @@ -1829,25 +1836,25 @@ msgid "" "socket." msgstr "" -#: ../../library/ssl.rst:1282 +#: ../../library/ssl.rst:1286 msgid "" "Return the compression algorithm being used as a string, or ``None`` if the " "connection isn't compressed." msgstr "" -#: ../../library/ssl.rst:1285 +#: ../../library/ssl.rst:1289 msgid "" "If the higher-level protocol supports its own compression mechanism, you can " "use :data:`OP_NO_COMPRESSION` to disable SSL-level compression." msgstr "" -#: ../../library/ssl.rst:1292 +#: ../../library/ssl.rst:1296 msgid "" "Get channel binding data for current connection, as a bytes object. Returns " "``None`` if not connected or the handshake has not been completed." msgstr "" -#: ../../library/ssl.rst:1295 +#: ../../library/ssl.rst:1299 msgid "" "The *cb_type* parameter allow selection of the desired channel binding type. " "Valid channel binding types are listed in the :data:`CHANNEL_BINDING_TYPES` " @@ -1856,7 +1863,7 @@ msgid "" "channel binding type is requested." msgstr "" -#: ../../library/ssl.rst:1305 +#: ../../library/ssl.rst:1309 msgid "" "Return the protocol that was selected during the TLS handshake. If :meth:" "`SSLContext.set_alpn_protocols` was not called, if the other party does not " @@ -1864,7 +1871,7 @@ msgid "" "protocols, or if the handshake has not happened yet, ``None`` is returned." msgstr "" -#: ../../library/ssl.rst:1315 +#: ../../library/ssl.rst:1319 msgid "" "Return the higher-level protocol that was selected during the TLS/SSL " "handshake. If :meth:`SSLContext.set_npn_protocols` was not called, or if the " @@ -1872,11 +1879,11 @@ msgid "" "this will return ``None``." msgstr "" -#: ../../library/ssl.rst:1324 ../../library/ssl.rst:1693 +#: ../../library/ssl.rst:1328 ../../library/ssl.rst:1697 msgid "NPN has been superseded by ALPN" msgstr "" -#: ../../library/ssl.rst:1328 +#: ../../library/ssl.rst:1332 msgid "" "Performs the SSL shutdown handshake, which removes the TLS layer from the " "underlying socket, and returns the underlying socket object. This can be " @@ -1885,7 +1892,7 @@ msgid "" "other side of the connection, rather than the original socket." msgstr "" -#: ../../library/ssl.rst:1336 +#: ../../library/ssl.rst:1340 msgid "" "Requests post-handshake authentication (PHA) from a TLS 1.3 client. PHA can " "only be initiated for a TLS 1.3 connection from a server-side socket, after " @@ -1893,26 +1900,26 @@ msgid "" "`SSLContext.post_handshake_auth`." msgstr "" -#: ../../library/ssl.rst:1341 +#: ../../library/ssl.rst:1345 msgid "" "The method does not perform a cert exchange immediately. The server-side " "sends a CertificateRequest during the next write event and expects the " "client to respond with a certificate on the next read event." msgstr "" -#: ../../library/ssl.rst:1345 +#: ../../library/ssl.rst:1349 msgid "" "If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), an :exc:" "`SSLError` is raised." msgstr "" -#: ../../library/ssl.rst:1349 +#: ../../library/ssl.rst:1353 msgid "" "Only available with OpenSSL 1.1.1 and TLS 1.3 enabled. Without TLS 1.3 " "support, the method raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/ssl.rst:1356 +#: ../../library/ssl.rst:1360 msgid "" "Return the actual SSL protocol version negotiated by the connection as a " "string, or ``None`` if no secure connection is established. As of this " @@ -1921,29 +1928,29 @@ msgid "" "may define more return values." msgstr "" -#: ../../library/ssl.rst:1366 +#: ../../library/ssl.rst:1370 msgid "" "Returns the number of already decrypted bytes available for read, pending on " "the connection." msgstr "" -#: ../../library/ssl.rst:1371 +#: ../../library/ssl.rst:1375 msgid "The :class:`SSLContext` object this SSL socket is tied to." msgstr "" -#: ../../library/ssl.rst:1377 +#: ../../library/ssl.rst:1381 msgid "" "A boolean which is ``True`` for server-side sockets and ``False`` for client-" "side sockets." msgstr "" -#: ../../library/ssl.rst:1384 +#: ../../library/ssl.rst:1388 msgid "" "Hostname of the server: :class:`str` type, or ``None`` for server-side " "socket or if the hostname was not specified in the constructor." msgstr "" -#: ../../library/ssl.rst:1389 +#: ../../library/ssl.rst:1393 msgid "" "The attribute is now always ASCII text. When ``server_hostname`` is an " "internationalized domain name (IDN), this attribute now stores the A-label " @@ -1951,7 +1958,7 @@ msgid "" "org\"``)." msgstr "" -#: ../../library/ssl.rst:1397 +#: ../../library/ssl.rst:1401 msgid "" "The :class:`SSLSession` for this SSL connection. The session is available " "for client and server side sockets after the TLS handshake has been " @@ -1959,11 +1966,11 @@ msgid "" "`~SSLSocket.do_handshake` has been called to reuse a session." msgstr "" -#: ../../library/ssl.rst:1410 +#: ../../library/ssl.rst:1414 msgid "SSL Contexts" msgstr "" -#: ../../library/ssl.rst:1414 +#: ../../library/ssl.rst:1418 msgid "" "An SSL context holds various data longer-lived than single SSL connections, " "such as SSL configuration options, certificate(s) and private key(s). It " @@ -1971,7 +1978,7 @@ msgid "" "speed up repeated connections from the same clients." msgstr "" -#: ../../library/ssl.rst:1421 +#: ../../library/ssl.rst:1425 msgid "" "Create a new SSL context. You may pass *protocol* which must be one of the " "``PROTOCOL_*`` constants defined in this module. The parameter specifies " @@ -1982,109 +1989,109 @@ msgid "" "provides the most compatibility with other versions." msgstr "" -#: ../../library/ssl.rst:1430 +#: ../../library/ssl.rst:1434 msgid "" "Here's a table showing which versions in a client (down the side) can " "connect to which versions in a server (along the top):" msgstr "" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "*client* / **server**" msgstr "*client* / **server**" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "**SSLv2**" msgstr "**SSLv2**" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "**SSLv3**" msgstr "**SSLv3**" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "**TLS** [3]_" msgstr "**TLS** [3]_" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "**TLSv1**" msgstr "**TLSv1**" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "**TLSv1.1**" msgstr "**TLSv1.1**" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1440 msgid "**TLSv1.2**" msgstr "**TLSv1.2**" -#: ../../library/ssl.rst:1438 +#: ../../library/ssl.rst:1442 msgid "*SSLv2*" msgstr "*SSLv2*" -#: ../../library/ssl.rst:1438 ../../library/ssl.rst:1439 -#: ../../library/ssl.rst:1440 ../../library/ssl.rst:1441 #: ../../library/ssl.rst:1442 ../../library/ssl.rst:1443 +#: ../../library/ssl.rst:1444 ../../library/ssl.rst:1445 +#: ../../library/ssl.rst:1446 ../../library/ssl.rst:1447 msgid "yes" msgstr "" -#: ../../library/ssl.rst:1438 ../../library/ssl.rst:1439 -#: ../../library/ssl.rst:1441 ../../library/ssl.rst:1442 -#: ../../library/ssl.rst:1443 +#: ../../library/ssl.rst:1442 ../../library/ssl.rst:1443 +#: ../../library/ssl.rst:1445 ../../library/ssl.rst:1446 +#: ../../library/ssl.rst:1447 msgid "no" msgstr "" -#: ../../library/ssl.rst:1438 ../../library/ssl.rst:1440 +#: ../../library/ssl.rst:1442 ../../library/ssl.rst:1444 msgid "no [1]_" msgstr "" -#: ../../library/ssl.rst:1439 +#: ../../library/ssl.rst:1443 msgid "*SSLv3*" msgstr "*SSLv3*" -#: ../../library/ssl.rst:1439 ../../library/ssl.rst:1440 +#: ../../library/ssl.rst:1443 ../../library/ssl.rst:1444 msgid "no [2]_" msgstr "" -#: ../../library/ssl.rst:1440 +#: ../../library/ssl.rst:1444 msgid "*TLS* (*SSLv23*) [3]_" msgstr "*TLS* (*SSLv23*) [3]_" -#: ../../library/ssl.rst:1441 +#: ../../library/ssl.rst:1445 msgid "*TLSv1*" msgstr "*TLSv1*" -#: ../../library/ssl.rst:1442 +#: ../../library/ssl.rst:1446 msgid "*TLSv1.1*" msgstr "*TLSv1.1*" -#: ../../library/ssl.rst:1443 +#: ../../library/ssl.rst:1447 msgid "*TLSv1.2*" msgstr "*TLSv1.2*" -#: ../../library/ssl.rst:1446 +#: ../../library/ssl.rst:1450 msgid "Footnotes" msgstr "註腳" -#: ../../library/ssl.rst:1447 +#: ../../library/ssl.rst:1451 msgid ":class:`SSLContext` disables SSLv2 with :data:`OP_NO_SSLv2` by default." msgstr ":class:`SSLContext` 預設會關閉 SSLv2 的 :data:`OP_NO_SSLv2`。" -#: ../../library/ssl.rst:1448 +#: ../../library/ssl.rst:1452 msgid ":class:`SSLContext` disables SSLv3 with :data:`OP_NO_SSLv3` by default." msgstr ":class:`SSLContext` 預設會關閉 SSLv3 的 :data:`OP_NO_SSLv3`。" -#: ../../library/ssl.rst:1449 +#: ../../library/ssl.rst:1453 msgid "" "TLS 1.3 protocol will be available with :data:`PROTOCOL_TLS` in OpenSSL >= " "1.1.1. There is no dedicated PROTOCOL constant for just TLS 1.3." msgstr "" -#: ../../library/ssl.rst:1454 +#: ../../library/ssl.rst:1458 msgid "" ":func:`create_default_context` lets the :mod:`ssl` module choose security " "settings for a given purpose." msgstr "" -#: ../../library/ssl.rst:1459 +#: ../../library/ssl.rst:1463 msgid "" "The context is created with secure default values. The options :data:" "`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:" @@ -2094,14 +2101,14 @@ msgid "" "ciphers and no ``MD5`` ciphers." msgstr "" -#: ../../library/ssl.rst:1469 +#: ../../library/ssl.rst:1473 msgid "" ":class:`SSLContext` without protocol argument is deprecated. The context " "class will either require :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol in the future." msgstr "" -#: ../../library/ssl.rst:1475 +#: ../../library/ssl.rst:1479 msgid "" "The default cipher suites now include only secure AES and ChaCha20 ciphers " "with forward secrecy and security level 2. RSA and DH keys with less than " @@ -2110,7 +2117,7 @@ msgid "" "use TLS 1.2 as minimum TLS version." msgstr "" -#: ../../library/ssl.rst:1483 +#: ../../library/ssl.rst:1487 msgid "" ":class:`SSLContext` only supports limited mutation once it has been used by " "a connection. Adding new certificates to the internal trust store is " @@ -2118,29 +2125,29 @@ msgid "" "may result in surprising behavior." msgstr "" -#: ../../library/ssl.rst:1490 +#: ../../library/ssl.rst:1494 msgid "" ":class:`SSLContext` is designed to be shared and used by multiple " "connections. Thus, it is thread-safe as long as it is not reconfigured after " "being used by a connection." msgstr "" -#: ../../library/ssl.rst:1495 +#: ../../library/ssl.rst:1499 msgid ":class:`SSLContext` objects have the following methods and attributes:" msgstr ":class:`SSLContext` 物件具有以下方法和屬性:" -#: ../../library/ssl.rst:1499 +#: ../../library/ssl.rst:1503 msgid "" "Get statistics about quantities of loaded X.509 certificates, count of X.509 " "certificates flagged as CA certificates and certificate revocation lists as " "dictionary." msgstr "" -#: ../../library/ssl.rst:1503 +#: ../../library/ssl.rst:1507 msgid "Example for a context with one CA cert and one other cert::" msgstr "" -#: ../../library/ssl.rst:1505 +#: ../../library/ssl.rst:1509 msgid "" ">>> context.cert_store_stats()\n" "{'crl': 0, 'x509_ca': 1, 'x509': 2}" @@ -2148,7 +2155,7 @@ msgstr "" ">>> context.cert_store_stats()\n" "{'crl': 0, 'x509_ca': 1, 'x509': 2}" -#: ../../library/ssl.rst:1513 +#: ../../library/ssl.rst:1517 msgid "" "Load a private key and the corresponding certificate. The *certfile* string " "must be the path to a single file in PEM format containing the certificate " @@ -2159,7 +2166,7 @@ msgid "" "more information on how the certificate is stored in the *certfile*." msgstr "" -#: ../../library/ssl.rst:1522 +#: ../../library/ssl.rst:1526 msgid "" "The *password* argument may be a function to call to get the password for " "decrypting the private key. It will only be called if the private key is " @@ -2171,24 +2178,24 @@ msgid "" "encrypted and no password is needed." msgstr "" -#: ../../library/ssl.rst:1531 +#: ../../library/ssl.rst:1535 msgid "" "If the *password* argument is not specified and a password is required, " "OpenSSL's built-in password prompting mechanism will be used to " "interactively prompt the user for a password." msgstr "" -#: ../../library/ssl.rst:1535 +#: ../../library/ssl.rst:1539 msgid "" "An :class:`SSLError` is raised if the private key doesn't match with the " "certificate." msgstr "" -#: ../../library/ssl.rst:1538 +#: ../../library/ssl.rst:1542 msgid "New optional argument *password*." msgstr "新增可選引數 *password*。" -#: ../../library/ssl.rst:1543 +#: ../../library/ssl.rst:1547 msgid "" "Load a set of default \"certification authority\" (CA) certificates from " "default locations. On Windows it loads CA certs from the ``CA`` and ``ROOT`` " @@ -2197,7 +2204,7 @@ msgid "" "from other locations, too." msgstr "" -#: ../../library/ssl.rst:1549 +#: ../../library/ssl.rst:1553 msgid "" "The *purpose* flag specifies what kind of CA certificates are loaded. The " "default settings :const:`Purpose.SERVER_AUTH` loads certificates, that are " @@ -2206,35 +2213,35 @@ msgid "" "certificate verification on the server side." msgstr "" -#: ../../library/ssl.rst:1559 +#: ../../library/ssl.rst:1563 msgid "" "Load a set of \"certification authority\" (CA) certificates used to validate " "other peers' certificates when :data:`verify_mode` is other than :data:" "`CERT_NONE`. At least one of *cafile* or *capath* must be specified." msgstr "" -#: ../../library/ssl.rst:1563 +#: ../../library/ssl.rst:1567 msgid "" "This method can also load certification revocation lists (CRLs) in PEM or " "DER format. In order to make use of CRLs, :attr:`SSLContext.verify_flags` " "must be configured properly." msgstr "" -#: ../../library/ssl.rst:1567 +#: ../../library/ssl.rst:1571 msgid "" "The *cafile* string, if present, is the path to a file of concatenated CA " "certificates in PEM format. See the discussion of :ref:`ssl-certificates` " "for more information about how to arrange the certificates in this file." msgstr "" -#: ../../library/ssl.rst:1572 +#: ../../library/ssl.rst:1576 msgid "" "The *capath* string, if present, is the path to a directory containing " "several CA certificates in PEM format, following an `OpenSSL specific layout " "`_." msgstr "" -#: ../../library/ssl.rst:1577 +#: ../../library/ssl.rst:1581 msgid "" "The *cadata* object, if present, is either an ASCII string of one or more " "PEM-encoded certificates or a :term:`bytes-like object` of DER-encoded " @@ -2242,11 +2249,11 @@ msgid "" "are ignored but at least one certificate must be present." msgstr "" -#: ../../library/ssl.rst:1582 +#: ../../library/ssl.rst:1586 msgid "New optional argument *cadata*" msgstr "新增可選引數 *cadata*" -#: ../../library/ssl.rst:1587 +#: ../../library/ssl.rst:1591 msgid "" "Get a list of loaded \"certification authority\" (CA) certificates. If the " "``binary_form`` parameter is :const:`False` each list entry is a dict like " @@ -2256,19 +2263,19 @@ msgid "" "a SSL connection." msgstr "" -#: ../../library/ssl.rst:1595 +#: ../../library/ssl.rst:1599 msgid "" "Certificates in a capath directory aren't loaded unless they have been used " "at least once." msgstr "" -#: ../../library/ssl.rst:1602 +#: ../../library/ssl.rst:1606 msgid "" "Get a list of enabled ciphers. The list is in order of cipher priority. See :" "meth:`SSLContext.set_ciphers`." msgstr "" -#: ../../library/ssl.rst:1607 +#: ../../library/ssl.rst:1611 msgid "" ">>> ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)\n" ">>> ctx.set_ciphers('ECDHE+AESGCM:!ECDSA')\n" @@ -2326,7 +2333,7 @@ msgstr "" " 'strength_bits': 128,\n" " 'symmetric': 'aes-128-gcm'}]" -#: ../../library/ssl.rst:1639 +#: ../../library/ssl.rst:1643 msgid "" "Load a set of default \"certification authority\" (CA) certificates from a " "filesystem path defined when building the OpenSSL library. Unfortunately, " @@ -2336,7 +2343,7 @@ msgid "" "configured properly." msgstr "" -#: ../../library/ssl.rst:1648 +#: ../../library/ssl.rst:1652 msgid "" "Set the available ciphers for sockets created with this context. It should " "be a string in the `OpenSSL cipher list format `_" msgstr "" -#: ../../library/ssl.rst:1787 +#: ../../library/ssl.rst:1791 msgid "Vincent Bernat." msgstr "" -#: ../../library/ssl.rst:1793 +#: ../../library/ssl.rst:1797 msgid "" "Wrap an existing Python socket *sock* and return an instance of :attr:" "`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The returned SSL " @@ -2526,13 +2535,13 @@ msgid "" "a :const:`~socket.SOCK_STREAM` socket; other socket types are unsupported." msgstr "" -#: ../../library/ssl.rst:1799 +#: ../../library/ssl.rst:1803 msgid "" "The parameter ``server_side`` is a boolean which identifies whether server-" "side or client-side behavior is desired from this socket." msgstr "" -#: ../../library/ssl.rst:1802 +#: ../../library/ssl.rst:1806 msgid "" "For client-side sockets, the context construction is lazy; if the underlying " "socket isn't connected yet, the context construction will be performed " @@ -2543,7 +2552,7 @@ msgid "" "exc:`SSLError`." msgstr "" -#: ../../library/ssl.rst:1810 +#: ../../library/ssl.rst:1814 msgid "" "On client connections, the optional parameter *server_hostname* specifies " "the hostname of the service which we are connecting to. This allows a " @@ -2552,7 +2561,7 @@ msgid "" "*server_hostname* will raise a :exc:`ValueError` if *server_side* is true." msgstr "" -#: ../../library/ssl.rst:1816 +#: ../../library/ssl.rst:1820 msgid "" "The parameter ``do_handshake_on_connect`` specifies whether to do the SSL " "handshake automatically after doing a :meth:`socket.connect`, or whether the " @@ -2562,7 +2571,7 @@ msgid "" "socket I/O involved in the handshake." msgstr "" -#: ../../library/ssl.rst:1823 +#: ../../library/ssl.rst:1827 msgid "" "The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket." "recv` method should signal unexpected EOF from the other end of the " @@ -2572,40 +2581,40 @@ msgid "" "exceptions back to the caller." msgstr "" -#: ../../library/ssl.rst:1830 +#: ../../library/ssl.rst:1834 msgid "*session*, see :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:1832 +#: ../../library/ssl.rst:1836 msgid "" "To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, use :meth:" "`SSLContext.wrap_bio`." msgstr "" -#: ../../library/ssl.rst:1835 +#: ../../library/ssl.rst:1839 msgid "" "Always allow a server_hostname to be passed, even if OpenSSL does not have " "SNI." msgstr "" -#: ../../library/ssl.rst:1839 ../../library/ssl.rst:1866 +#: ../../library/ssl.rst:1843 ../../library/ssl.rst:1870 msgid "*session* argument was added." msgstr "新增 *session* 引數。" -#: ../../library/ssl.rst:1842 +#: ../../library/ssl.rst:1846 msgid "" "The method returns an instance of :attr:`SSLContext.sslsocket_class` instead " "of hard-coded :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1848 +#: ../../library/ssl.rst:1852 msgid "" "The return type of :meth:`SSLContext.wrap_socket`, defaults to :class:" "`SSLSocket`. The attribute can be assigned to on instances of :class:" "`SSLContext` in order to return a custom subclass of :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1858 +#: ../../library/ssl.rst:1862 msgid "" "Wrap the BIO objects *incoming* and *outgoing* and return an instance of :" "attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " @@ -2613,26 +2622,26 @@ msgid "" "outgoing BIO." msgstr "" -#: ../../library/ssl.rst:1863 +#: ../../library/ssl.rst:1867 msgid "" "The *server_side*, *server_hostname* and *session* parameters have the same " "meaning as in :meth:`SSLContext.wrap_socket`." msgstr "" -#: ../../library/ssl.rst:1869 +#: ../../library/ssl.rst:1873 msgid "" "The method returns an instance of :attr:`SSLContext.sslobject_class` instead " "of hard-coded :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1875 +#: ../../library/ssl.rst:1879 msgid "" "The return type of :meth:`SSLContext.wrap_bio`, defaults to :class:" "`SSLObject`. The attribute can be overridden on instance of class in order " "to return a custom subclass of :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1883 +#: ../../library/ssl.rst:1887 msgid "" "Get statistics about the SSL sessions created or managed by this context. A " "dictionary is returned which maps the names of each `piece of information " @@ -2641,7 +2650,7 @@ msgid "" "the session cache since the context was created::" msgstr "" -#: ../../library/ssl.rst:1888 +#: ../../library/ssl.rst:1892 msgid "" ">>> stats = context.session_stats()\n" ">>> stats['hits'], stats['misses']\n" @@ -2651,7 +2660,7 @@ msgstr "" ">>> stats['hits'], stats['misses']\n" "(0, 0)" -#: ../../library/ssl.rst:1894 +#: ../../library/ssl.rst:1898 msgid "" "Whether to match the peer cert's hostname in :meth:`SSLSocket.do_handshake`. " "The context's :attr:`~SSLContext.verify_mode` must be set to :data:" @@ -2664,7 +2673,7 @@ msgid "" "With other protocols, hostname checking must be enabled explicitly." msgstr "" -#: ../../library/ssl.rst:1907 +#: ../../library/ssl.rst:1911 msgid "" "import socket, ssl\n" "\n" @@ -2688,7 +2697,7 @@ msgstr "" "ssl_sock = context.wrap_socket(s, server_hostname='www.verisign.com')\n" "ssl_sock.connect(('www.verisign.com', 443))" -#: ../../library/ssl.rst:1922 +#: ../../library/ssl.rst:1926 msgid "" ":attr:`~SSLContext.verify_mode` is now automatically changed to :data:" "`CERT_REQUIRED` when hostname checking is enabled and :attr:`~SSLContext." @@ -2696,7 +2705,7 @@ msgid "" "failed with a :exc:`ValueError`." msgstr "" -#: ../../library/ssl.rst:1929 +#: ../../library/ssl.rst:1933 msgid "" "Write TLS keys to a keylog file, whenever key material is generated or " "received. The keylog file is designed for debugging purposes only. The file " @@ -2705,7 +2714,7 @@ msgid "" "synchronized between threads, but not between processes." msgstr "" -#: ../../library/ssl.rst:1939 +#: ../../library/ssl.rst:1943 msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " @@ -2713,7 +2722,7 @@ msgid "" "const:`PROTOCOL_TLS_CLIENT`, and :const:`PROTOCOL_TLS_SERVER`." msgstr "" -#: ../../library/ssl.rst:1944 +#: ../../library/ssl.rst:1948 msgid "" "The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext." "minimum_version` and :attr:`SSLContext.options` all affect the supported SSL " @@ -2723,38 +2732,38 @@ msgid "" "`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." msgstr "" -#: ../../library/ssl.rst:1957 +#: ../../library/ssl.rst:1961 msgid "" "Like :attr:`SSLContext.maximum_version` except it is the lowest supported " "version or :attr:`TLSVersion.MINIMUM_SUPPORTED`." msgstr "" -#: ../../library/ssl.rst:1964 +#: ../../library/ssl.rst:1968 msgid "" "Control the number of TLS 1.3 session tickets of a :const:" "`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 " "connections." msgstr "" -#: ../../library/ssl.rst:1972 +#: ../../library/ssl.rst:1976 msgid "" "An integer representing the set of SSL options enabled on this context. The " "default value is :data:`OP_ALL`, but you can specify other options such as :" "data:`OP_NO_SSLv2` by ORing them together." msgstr "" -#: ../../library/ssl.rst:1976 +#: ../../library/ssl.rst:1980 msgid ":attr:`SSLContext.options` returns :class:`Options` flags:" msgstr ":attr:`SSLContext.options` 會回傳 :class:`Options` 旗標:" -#: ../../library/ssl.rst:1984 +#: ../../library/ssl.rst:1988 msgid "" "All ``OP_NO_SSL*`` and ``OP_NO_TLS*`` options have been deprecated since " "Python 3.7. Use :attr:`SSLContext.minimum_version` and :attr:`SSLContext." "maximum_version` instead." msgstr "" -#: ../../library/ssl.rst:1990 +#: ../../library/ssl.rst:1994 msgid "" "Enable TLS 1.3 post-handshake client authentication. Post-handshake auth is " "disabled by default and a server can only request a TLS client certificate " @@ -2762,13 +2771,13 @@ msgid "" "client certificate at any time after the handshake." msgstr "" -#: ../../library/ssl.rst:1995 +#: ../../library/ssl.rst:1999 msgid "" "When enabled on client-side sockets, the client signals the server that it " "supports post-handshake authentication." msgstr "" -#: ../../library/ssl.rst:1998 +#: ../../library/ssl.rst:2002 msgid "" "When enabled on server-side sockets, :attr:`SSLContext.verify_mode` must be " "set to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, too. The actual " @@ -2776,66 +2785,66 @@ msgid "" "verify_client_post_handshake` is called and some I/O is performed." msgstr "" -#: ../../library/ssl.rst:2008 +#: ../../library/ssl.rst:2012 msgid "" "The protocol version chosen when constructing the context. This attribute " "is read-only." msgstr "" -#: ../../library/ssl.rst:2013 +#: ../../library/ssl.rst:2017 msgid "" "Whether :attr:`~SSLContext.check_hostname` falls back to verify the cert's " "subject common name in the absence of a subject alternative name extension " "(default: true)." msgstr "" -#: ../../library/ssl.rst:2021 +#: ../../library/ssl.rst:2025 msgid "" "The flag had no effect with OpenSSL before version 1.1.1l. Python 3.8.9, " "3.9.3, and 3.10 include workarounds for previous versions." msgstr "" -#: ../../library/ssl.rst:2026 +#: ../../library/ssl.rst:2030 msgid "" "An integer representing the `security level `_ for the context. This attribute is read-" "only." msgstr "" -#: ../../library/ssl.rst:2034 +#: ../../library/ssl.rst:2038 msgid "" "The flags for certificate verification operations. You can set flags like :" "data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default OpenSSL does " "neither require nor verify certificate revocation lists (CRLs)." msgstr "" -#: ../../library/ssl.rst:2040 +#: ../../library/ssl.rst:2044 msgid ":attr:`SSLContext.verify_flags` returns :class:`VerifyFlags` flags:" msgstr ":attr:`SSLContext.verify_flags` 會回傳 :class:`VerifyFlags` 旗標:" -#: ../../library/ssl.rst:2048 +#: ../../library/ssl.rst:2052 msgid "" "Whether to try to verify other peers' certificates and how to behave if " "verification fails. This attribute must be one of :data:`CERT_NONE`, :data:" "`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." msgstr "" -#: ../../library/ssl.rst:2052 +#: ../../library/ssl.rst:2056 msgid ":attr:`SSLContext.verify_mode` returns :class:`VerifyMode` enum:" msgstr ":attr:`SSLContext.verify_mode` 會回傳 :class:`VerifyMode` 列舉:" -#: ../../library/ssl.rst:2060 +#: ../../library/ssl.rst:2064 msgid "" "Enables TLS-PSK (pre-shared key) authentication on a client-side connection." msgstr "" -#: ../../library/ssl.rst:2062 ../../library/ssl.rst:2111 +#: ../../library/ssl.rst:2066 ../../library/ssl.rst:2115 msgid "" "In general, certificate based authentication should be preferred over this " "method." msgstr "" -#: ../../library/ssl.rst:2064 +#: ../../library/ssl.rst:2068 msgid "" "The parameter ``callback`` is a callable object with the signature: ``def " "callback(hint: str | None) -> tuple[str | None, bytes]``. The ``hint`` " @@ -2847,27 +2856,27 @@ msgid "" "shared key. Return a zero length PSK to reject the connection." msgstr "" -#: ../../library/ssl.rst:2074 ../../library/ssl.rst:2120 +#: ../../library/ssl.rst:2078 ../../library/ssl.rst:2124 msgid "Setting ``callback`` to :const:`None` removes any existing callback." msgstr "" -#: ../../library/ssl.rst:2077 +#: ../../library/ssl.rst:2081 msgid "When using TLS 1.3:" msgstr "使用 TLS 1.3 時:" -#: ../../library/ssl.rst:2079 +#: ../../library/ssl.rst:2083 msgid "the ``hint`` parameter is always :const:`None`." msgstr "``hint`` 參數始終為 :const:`None`。" -#: ../../library/ssl.rst:2080 +#: ../../library/ssl.rst:2084 msgid "client-identity must be a non-empty string." msgstr "" -#: ../../library/ssl.rst:2082 ../../library/ssl.rst:2129 +#: ../../library/ssl.rst:2086 ../../library/ssl.rst:2133 msgid "Example usage::" msgstr "範例用法: ::" -#: ../../library/ssl.rst:2084 +#: ../../library/ssl.rst:2088 msgid "" "context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" "context.check_hostname = False\n" @@ -2888,18 +2897,18 @@ msgid "" "context.set_psk_client_callback(callback)" msgstr "" -#: ../../library/ssl.rst:2102 ../../library/ssl.rst:2147 +#: ../../library/ssl.rst:2106 ../../library/ssl.rst:2151 msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_PSK` is " "``False``." msgstr "" -#: ../../library/ssl.rst:2109 +#: ../../library/ssl.rst:2113 msgid "" "Enables TLS-PSK (pre-shared key) authentication on a server-side connection." msgstr "" -#: ../../library/ssl.rst:2113 +#: ../../library/ssl.rst:2117 msgid "" "The parameter ``callback`` is a callable object with the signature: ``def " "callback(identity: str | None) -> bytes``. The ``identity`` parameter is an " @@ -2909,19 +2918,19 @@ msgid "" "connection." msgstr "" -#: ../../library/ssl.rst:2122 +#: ../../library/ssl.rst:2126 msgid "" "The parameter ``identity_hint`` is an optional identity hint string sent to " "the client. The string must be less than or equal to ``256`` octets when " "UTF-8 encoded." msgstr "" -#: ../../library/ssl.rst:2127 +#: ../../library/ssl.rst:2131 msgid "" "When using TLS 1.3 the ``identity_hint`` parameter is not sent to the client." msgstr "" -#: ../../library/ssl.rst:2131 +#: ../../library/ssl.rst:2135 msgid "" "context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" "context.maximum_version = ssl.TLSVersion.TLSv1_2\n" @@ -2940,11 +2949,11 @@ msgid "" "context.set_psk_server_callback(callback, 'ServerId_1')" msgstr "" -#: ../../library/ssl.rst:2159 +#: ../../library/ssl.rst:2163 msgid "Certificates" msgstr "" -#: ../../library/ssl.rst:2161 +#: ../../library/ssl.rst:2165 msgid "" "Certificates in general are part of a public-key / private-key system. In " "this system, each *principal*, (which may be a machine, or a person, or an " @@ -2955,7 +2964,7 @@ msgid "" "other part, and **only** with the other part." msgstr "" -#: ../../library/ssl.rst:2169 +#: ../../library/ssl.rst:2173 msgid "" "A certificate contains information about two principals. It contains the " "name of a *subject*, and the subject's public key. It also contains a " @@ -2969,7 +2978,7 @@ msgid "" "as two fields, called \"notBefore\" and \"notAfter\"." msgstr "" -#: ../../library/ssl.rst:2179 +#: ../../library/ssl.rst:2183 msgid "" "In the Python use of certificates, a client or server can use a certificate " "to prove who they are. The other side of a network connection can also be " @@ -2982,14 +2991,14 @@ msgid "" "take place." msgstr "" -#: ../../library/ssl.rst:2189 +#: ../../library/ssl.rst:2193 msgid "" "Python uses files to contain certificates. They should be formatted as " "\"PEM\" (see :rfc:`1422`), which is a base-64 encoded form wrapped with a " "header line and a footer line::" msgstr "" -#: ../../library/ssl.rst:2193 +#: ../../library/ssl.rst:2197 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate in base64 PEM encoding) ...\n" @@ -2999,11 +3008,11 @@ msgstr "" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2198 +#: ../../library/ssl.rst:2202 msgid "Certificate chains" msgstr "" -#: ../../library/ssl.rst:2200 +#: ../../library/ssl.rst:2204 msgid "" "The Python files which contain certificates can contain a sequence of " "certificates, sometimes called a *certificate chain*. This chain should " @@ -3019,7 +3028,7 @@ msgid "" "agency which issued the certification authority's certificate::" msgstr "" -#: ../../library/ssl.rst:2213 +#: ../../library/ssl.rst:2217 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate for your server)...\n" @@ -3041,11 +3050,11 @@ msgstr "" "... (the root certificate for the CA's issuer)...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2224 +#: ../../library/ssl.rst:2228 msgid "CA certificates" msgstr "" -#: ../../library/ssl.rst:2226 +#: ../../library/ssl.rst:2230 msgid "" "If you are going to require validation of the other side of the connection's " "certificate, you need to provide a \"CA certs\" file, filled with the " @@ -3057,11 +3066,11 @@ msgid "" "create_default_context`." msgstr "" -#: ../../library/ssl.rst:2235 +#: ../../library/ssl.rst:2239 msgid "Combined key and certificate" msgstr "" -#: ../../library/ssl.rst:2237 +#: ../../library/ssl.rst:2241 msgid "" "Often the private key is stored in the same file as the certificate; in this " "case, only the ``certfile`` parameter to :meth:`SSLContext.load_cert_chain` " @@ -3069,7 +3078,7 @@ msgid "" "should come before the first certificate in the certificate chain::" msgstr "" -#: ../../library/ssl.rst:2243 +#: ../../library/ssl.rst:2247 msgid "" "-----BEGIN RSA PRIVATE KEY-----\n" "... (private key in base64 encoding) ...\n" @@ -3085,11 +3094,11 @@ msgstr "" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2251 +#: ../../library/ssl.rst:2255 msgid "Self-signed certificates" msgstr "" -#: ../../library/ssl.rst:2253 +#: ../../library/ssl.rst:2257 msgid "" "If you are going to create a server that provides SSL-encrypted connection " "services, you will need to acquire a certificate for that service. There " @@ -3099,7 +3108,7 @@ msgid "" "package, using something like the following::" msgstr "" -#: ../../library/ssl.rst:2260 +#: ../../library/ssl.rst:2264 msgid "" "% openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem\n" "Generating a 1024 bit RSA private key\n" @@ -3125,28 +3134,28 @@ msgid "" "%" msgstr "" -#: ../../library/ssl.rst:2282 +#: ../../library/ssl.rst:2286 msgid "" "The disadvantage of a self-signed certificate is that it is its own root " "certificate, and no one else will have it in their cache of known (and " "trusted) root certificates." msgstr "" -#: ../../library/ssl.rst:2288 +#: ../../library/ssl.rst:2292 msgid "Examples" msgstr "範例" -#: ../../library/ssl.rst:2291 +#: ../../library/ssl.rst:2295 msgid "Testing for SSL support" msgstr "" -#: ../../library/ssl.rst:2293 +#: ../../library/ssl.rst:2297 msgid "" "To test for the presence of SSL support in a Python installation, user code " "should use the following idiom::" msgstr "" -#: ../../library/ssl.rst:2296 +#: ../../library/ssl.rst:2300 msgid "" "try:\n" " import ssl\n" @@ -3156,27 +3165,27 @@ msgid "" " ... # do something that requires SSL support" msgstr "" -#: ../../library/ssl.rst:2304 +#: ../../library/ssl.rst:2308 msgid "Client-side operation" msgstr "" -#: ../../library/ssl.rst:2306 +#: ../../library/ssl.rst:2310 msgid "" "This example creates a SSL context with the recommended security settings " "for client sockets, including automatic certificate verification::" msgstr "" -#: ../../library/ssl.rst:2309 +#: ../../library/ssl.rst:2313 msgid ">>> context = ssl.create_default_context()" msgstr ">>> context = ssl.create_default_context()" -#: ../../library/ssl.rst:2311 +#: ../../library/ssl.rst:2315 msgid "" "If you prefer to tune security settings yourself, you might create a context " "from scratch (but beware that you might not get the settings right)::" msgstr "" -#: ../../library/ssl.rst:2315 +#: ../../library/ssl.rst:2319 msgid "" ">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" @@ -3184,14 +3193,14 @@ msgstr "" ">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" -#: ../../library/ssl.rst:2318 +#: ../../library/ssl.rst:2322 msgid "" "(this snippet assumes your operating system places a bundle of all CA " "certificates in ``/etc/ssl/certs/ca-bundle.crt``; if not, you'll get an " "error and have to adjust the location)" msgstr "" -#: ../../library/ssl.rst:2322 +#: ../../library/ssl.rst:2326 msgid "" "The :data:`PROTOCOL_TLS_CLIENT` protocol configures the context for cert " "validation and hostname verification. :attr:`~SSLContext.verify_mode` is set " @@ -3199,7 +3208,7 @@ msgid "" "``True``. All other protocols create SSL contexts with insecure defaults." msgstr "" -#: ../../library/ssl.rst:2327 +#: ../../library/ssl.rst:2331 msgid "" "When you use the context to connect to a server, :const:`CERT_REQUIRED` and :" "attr:`~SSLContext.check_hostname` validate the server certificate: it " @@ -3208,7 +3217,7 @@ msgid "" "properties like validity and identity of the hostname::" msgstr "" -#: ../../library/ssl.rst:2333 +#: ../../library/ssl.rst:2337 msgid "" ">>> conn = context.wrap_socket(socket.socket(socket.AF_INET),\n" "... server_hostname=\"www.python.org\")\n" @@ -3218,21 +3227,21 @@ msgstr "" "... server_hostname=\"www.python.org\")\n" ">>> conn.connect((\"www.python.org\", 443))" -#: ../../library/ssl.rst:2337 +#: ../../library/ssl.rst:2341 msgid "You may then fetch the certificate::" msgstr "" -#: ../../library/ssl.rst:2339 +#: ../../library/ssl.rst:2343 msgid ">>> cert = conn.getpeercert()" msgstr ">>> cert = conn.getpeercert()" -#: ../../library/ssl.rst:2341 +#: ../../library/ssl.rst:2345 msgid "" "Visual inspection shows that the certificate does identify the desired " "service (that is, the HTTPS host ``www.python.org``)::" msgstr "" -#: ../../library/ssl.rst:2344 +#: ../../library/ssl.rst:2348 msgid "" ">>> pprint.pprint(cert)\n" "{'OCSP': ('http://ocsp.digicert.com',),\n" @@ -3322,13 +3331,13 @@ msgstr "" " ('DNS', 'id.python.org')),\n" " 'version': 3}" -#: ../../library/ssl.rst:2384 +#: ../../library/ssl.rst:2388 msgid "" "Now the SSL channel is established and the certificate verified, you can " "proceed to talk with the server::" msgstr "" -#: ../../library/ssl.rst:2387 +#: ../../library/ssl.rst:2391 msgid "" ">>> conn.sendall(b\"HEAD / HTTP/1.0\\r\\nHost: linuxfr.org\\r\\n\\r\\n\")\n" ">>> pprint.pprint(conn.recv(1024).split(b\"\\r\\n\"))\n" @@ -3370,11 +3379,11 @@ msgstr "" " b'',\n" " b'']" -#: ../../library/ssl.rst:2411 +#: ../../library/ssl.rst:2415 msgid "Server-side operation" msgstr "伺服器端操作" -#: ../../library/ssl.rst:2413 +#: ../../library/ssl.rst:2417 msgid "" "For server operation, typically you'll need to have a server certificate, " "and private key, each in a file. You'll first create a context holding the " @@ -3383,7 +3392,7 @@ msgid "" "start waiting for clients to connect::" msgstr "" -#: ../../library/ssl.rst:2419 +#: ../../library/ssl.rst:2423 msgid "" "import socket, ssl\n" "\n" @@ -3403,14 +3412,14 @@ msgstr "" "bindsocket.bind(('myaddr.example.com', 10023))\n" "bindsocket.listen(5)" -#: ../../library/ssl.rst:2428 +#: ../../library/ssl.rst:2432 msgid "" "When a client connects, you'll call :meth:`accept` on the socket to get the " "new socket from the other end, and use the context's :meth:`SSLContext." "wrap_socket` method to create a server-side SSL socket for the connection::" msgstr "" -#: ../../library/ssl.rst:2432 +#: ../../library/ssl.rst:2436 msgid "" "while True:\n" " newsocket, fromaddr = bindsocket.accept()\n" @@ -3430,13 +3439,13 @@ msgstr "" " connstream.shutdown(socket.SHUT_RDWR)\n" " connstream.close()" -#: ../../library/ssl.rst:2441 +#: ../../library/ssl.rst:2445 msgid "" "Then you'll read data from the ``connstream`` and do something with it till " "you are finished with the client (or the client is finished with you)::" msgstr "" -#: ../../library/ssl.rst:2444 +#: ../../library/ssl.rst:2448 msgid "" "def deal_with_client(connstream):\n" " data = connstream.recv(1024)\n" @@ -3450,7 +3459,7 @@ msgid "" " # finished with client" msgstr "" -#: ../../library/ssl.rst:2455 +#: ../../library/ssl.rst:2459 msgid "" "And go back to listening for new client connections (of course, a real " "server would probably handle each client connection in a separate thread, or " @@ -3458,18 +3467,18 @@ msgid "" "event loop)." msgstr "" -#: ../../library/ssl.rst:2463 +#: ../../library/ssl.rst:2467 msgid "Notes on non-blocking sockets" msgstr "" -#: ../../library/ssl.rst:2465 +#: ../../library/ssl.rst:2469 msgid "" "SSL sockets behave slightly different than regular sockets in non-blocking " "mode. When working with non-blocking sockets, there are thus several things " "you need to be aware of:" msgstr "" -#: ../../library/ssl.rst:2469 +#: ../../library/ssl.rst:2473 msgid "" "Most :class:`SSLSocket` methods will raise either :exc:`SSLWantWriteError` " "or :exc:`SSLWantReadError` instead of :exc:`BlockingIOError` if an I/O " @@ -3481,13 +3490,13 @@ msgid "" "require a prior *write* to the underlying socket." msgstr "" -#: ../../library/ssl.rst:2481 +#: ../../library/ssl.rst:2485 msgid "" "In earlier Python versions, the :meth:`!SSLSocket.send` method returned zero " "instead of raising :exc:`SSLWantWriteError` or :exc:`SSLWantReadError`." msgstr "" -#: ../../library/ssl.rst:2485 +#: ../../library/ssl.rst:2489 msgid "" "Calling :func:`~select.select` tells you that the OS-level socket can be " "read from (or written to), but it does not imply that there is sufficient " @@ -3497,7 +3506,7 @@ msgid "" "`~select.select`." msgstr "" -#: ../../library/ssl.rst:2492 +#: ../../library/ssl.rst:2496 msgid "" "Conversely, since the SSL layer has its own framing, a SSL socket may still " "have data available for reading without :func:`~select.select` being aware " @@ -3506,13 +3515,13 @@ msgid "" "call if still necessary." msgstr "" -#: ../../library/ssl.rst:2498 +#: ../../library/ssl.rst:2502 msgid "" "(of course, similar provisions apply when using other primitives such as :" "func:`~select.poll`, or those in the :mod:`selectors` module)" msgstr "" -#: ../../library/ssl.rst:2501 +#: ../../library/ssl.rst:2505 msgid "" "The SSL handshake itself will be non-blocking: the :meth:`SSLSocket." "do_handshake` method has to be retried until it returns successfully. Here " @@ -3520,7 +3529,7 @@ msgid "" "readiness::" msgstr "" -#: ../../library/ssl.rst:2506 +#: ../../library/ssl.rst:2510 msgid "" "while True:\n" " try:\n" @@ -3540,7 +3549,7 @@ msgstr "" " except ssl.SSLWantWriteError:\n" " select.select([], [sock], [])" -#: ../../library/ssl.rst:2517 +#: ../../library/ssl.rst:2521 msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets ` and provides a higher level :ref:`Streams API `. " "This means that for example :meth:`~SSLSocket.read` will raise an :exc:" "`SSLWantReadError` if it needs more data than the incoming BIO has available." msgstr "" -#: ../../library/ssl.rst:2620 +#: ../../library/ssl.rst:2624 msgid "" ":class:`SSLObject` instances must be created with :meth:`~SSLContext." "wrap_bio`. In earlier versions, it was possible to create instances " "directly. This was never documented or officially supported." msgstr "" -#: ../../library/ssl.rst:2626 +#: ../../library/ssl.rst:2630 msgid "" "An SSLObject communicates with the outside world using memory buffers. The " "class :class:`MemoryBIO` provides a memory buffer that can be used for this " "purpose. It wraps an OpenSSL memory BIO (Basic IO) object:" msgstr "" -#: ../../library/ssl.rst:2632 +#: ../../library/ssl.rst:2636 msgid "" "A memory buffer that can be used to pass data between Python and an SSL " "protocol instance." msgstr "" -#: ../../library/ssl.rst:2637 +#: ../../library/ssl.rst:2641 msgid "Return the number of bytes currently in the memory buffer." msgstr "" -#: ../../library/ssl.rst:2641 +#: ../../library/ssl.rst:2645 msgid "" "A boolean indicating whether the memory BIO is current at the end-of-file " "position." msgstr "" -#: ../../library/ssl.rst:2646 +#: ../../library/ssl.rst:2650 msgid "" "Read up to *n* bytes from the memory buffer. If *n* is not specified or " "negative, all bytes are returned." msgstr "" -#: ../../library/ssl.rst:2651 +#: ../../library/ssl.rst:2655 msgid "" "Write the bytes from *buf* to the memory BIO. The *buf* argument must be an " "object supporting the buffer protocol." msgstr "" -#: ../../library/ssl.rst:2654 +#: ../../library/ssl.rst:2658 msgid "" "The return value is the number of bytes written, which is always equal to " "the length of *buf*." msgstr "" -#: ../../library/ssl.rst:2659 +#: ../../library/ssl.rst:2663 msgid "" "Write an EOF marker to the memory BIO. After this method has been called, it " "is illegal to call :meth:`~MemoryBIO.write`. The attribute :attr:`eof` will " "become true after all data currently in the buffer has been read." msgstr "" -#: ../../library/ssl.rst:2665 +#: ../../library/ssl.rst:2669 msgid "SSL session" msgstr "" -#: ../../library/ssl.rst:2671 +#: ../../library/ssl.rst:2675 msgid "Session object used by :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:2683 +#: ../../library/ssl.rst:2687 msgid "Security considerations" msgstr "" -#: ../../library/ssl.rst:2686 +#: ../../library/ssl.rst:2690 msgid "Best defaults" msgstr "" -#: ../../library/ssl.rst:2688 +#: ../../library/ssl.rst:2692 msgid "" "For **client use**, if you don't have any special requirements for your " "security policy, it is highly recommended that you use the :func:" @@ -3832,13 +3841,13 @@ msgid "" "settings." msgstr "" -#: ../../library/ssl.rst:2695 +#: ../../library/ssl.rst:2699 msgid "" "For example, here is how you would use the :class:`smtplib.SMTP` class to " "create a trusted, secure connection to a SMTP server::" msgstr "" -#: ../../library/ssl.rst:2698 +#: ../../library/ssl.rst:2702 msgid "" ">>> import ssl, smtplib\n" ">>> smtp = smtplib.SMTP(\"mail.python.org\", port=587)\n" @@ -3852,13 +3861,13 @@ msgstr "" ">>> smtp.starttls(context=context)\n" "(220, b'2.0.0 Ready to start TLS')" -#: ../../library/ssl.rst:2704 +#: ../../library/ssl.rst:2708 msgid "" "If a client certificate is needed for the connection, it can be added with :" "meth:`SSLContext.load_cert_chain`." msgstr "" -#: ../../library/ssl.rst:2707 +#: ../../library/ssl.rst:2711 msgid "" "By contrast, if you create the SSL context by calling the :class:" "`SSLContext` constructor yourself, it will not have certificate validation " @@ -3866,15 +3875,15 @@ msgid "" "paragraphs below to achieve a good security level." msgstr "" -#: ../../library/ssl.rst:2713 +#: ../../library/ssl.rst:2717 msgid "Manual settings" msgstr "手動設定" -#: ../../library/ssl.rst:2716 +#: ../../library/ssl.rst:2720 msgid "Verifying certificates" msgstr "驗證憑證" -#: ../../library/ssl.rst:2718 +#: ../../library/ssl.rst:2722 msgid "" "When calling the :class:`SSLContext` constructor directly, :const:" "`CERT_NONE` is the default. Since it does not authenticate the other peer, " @@ -3889,13 +3898,13 @@ msgid "" "enabled." msgstr "" -#: ../../library/ssl.rst:2730 +#: ../../library/ssl.rst:2734 msgid "" "Hostname matchings is now performed by OpenSSL. Python no longer uses :func:" -"`match_hostname`." +"`!match_hostname`." msgstr "" -#: ../../library/ssl.rst:2734 +#: ../../library/ssl.rst:2738 msgid "" "In server mode, if you want to authenticate your clients using the SSL layer " "(rather than using a higher-level authentication mechanism), you'll also " @@ -3903,11 +3912,11 @@ msgid "" "certificate." msgstr "" -#: ../../library/ssl.rst:2740 +#: ../../library/ssl.rst:2744 msgid "Protocol versions" msgstr "協定版本" -#: ../../library/ssl.rst:2742 +#: ../../library/ssl.rst:2746 msgid "" "SSL versions 2 and 3 are considered insecure and are therefore dangerous to " "use. If you want maximum compatibility between clients and servers, it is " @@ -3916,7 +3925,7 @@ msgid "" "by default." msgstr "" -#: ../../library/ssl.rst:2750 +#: ../../library/ssl.rst:2754 msgid "" ">>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3\n" @@ -3926,7 +3935,7 @@ msgstr "" ">>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3\n" ">>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3" -#: ../../library/ssl.rst:2755 +#: ../../library/ssl.rst:2759 msgid "" "The SSL context created above will only allow TLSv1.3 and later (if " "supported by your system) connections to a server. :const:" @@ -3934,11 +3943,11 @@ msgid "" "default. You have to load certificates into the context." msgstr "" -#: ../../library/ssl.rst:2762 +#: ../../library/ssl.rst:2766 msgid "Cipher selection" msgstr "" -#: ../../library/ssl.rst:2764 +#: ../../library/ssl.rst:2768 msgid "" "If you have advanced security requirements, fine-tuning of the ciphers " "enabled when negotiating a SSL session is possible through the :meth:" @@ -3951,11 +3960,11 @@ msgid "" "command on your system." msgstr "" -#: ../../library/ssl.rst:2775 +#: ../../library/ssl.rst:2779 msgid "Multi-processing" msgstr "" -#: ../../library/ssl.rst:2777 +#: ../../library/ssl.rst:2781 msgid "" "If using this module as part of a multi-processed application (using, for " "example the :mod:`multiprocessing` or :mod:`concurrent.futures` modules), be " @@ -3966,17 +3975,17 @@ msgid "" "sufficient." msgstr "" -#: ../../library/ssl.rst:2789 +#: ../../library/ssl.rst:2793 msgid "TLS 1.3" msgstr "TLS 1.3" -#: ../../library/ssl.rst:2793 +#: ../../library/ssl.rst:2797 msgid "" "The TLS 1.3 protocol behaves slightly differently than previous version of " "TLS/SSL. Some new TLS 1.3 features are not yet available." msgstr "" -#: ../../library/ssl.rst:2796 +#: ../../library/ssl.rst:2800 msgid "" "TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20 " "cipher suites are enabled by default. The method :meth:`SSLContext." @@ -3984,14 +3993,14 @@ msgid "" "`SSLContext.get_ciphers` returns them." msgstr "" -#: ../../library/ssl.rst:2800 +#: ../../library/ssl.rst:2804 msgid "" "Session tickets are no longer sent as part of the initial handshake and are " "handled differently. :attr:`SSLSocket.session` and :class:`SSLSession` are " "not compatible with TLS 1.3." msgstr "" -#: ../../library/ssl.rst:2803 +#: ../../library/ssl.rst:2807 msgid "" "Client-side certificates are also no longer verified during the initial " "handshake. A server can request a certificate at any time. Clients process " @@ -3999,21 +4008,21 @@ msgid "" "server." msgstr "" -#: ../../library/ssl.rst:2807 +#: ../../library/ssl.rst:2811 msgid "" "TLS 1.3 features like early data, deferred TLS client cert request, " "signature algorithm configuration, and rekeying are not supported yet." msgstr "" -#: ../../library/ssl.rst:2813 +#: ../../library/ssl.rst:2817 msgid "Class :class:`socket.socket`" msgstr ":class:`socket.socket` 類別" -#: ../../library/ssl.rst:2814 +#: ../../library/ssl.rst:2818 msgid "Documentation of underlying :mod:`socket` class" msgstr "底層 :mod:`socket` 類別的文件" -#: ../../library/ssl.rst:2816 +#: ../../library/ssl.rst:2820 msgid "" "`SSL/TLS Strong Encryption: An Introduction `_" @@ -4021,11 +4030,11 @@ msgstr "" "`SSL/TLS Strong Encryption: An Introduction `_" -#: ../../library/ssl.rst:2817 +#: ../../library/ssl.rst:2821 msgid "Intro from the Apache HTTP Server documentation" msgstr "Apache HTTP Server 文件的介紹" -#: ../../library/ssl.rst:2819 +#: ../../library/ssl.rst:2823 msgid "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" @@ -4033,19 +4042,19 @@ msgstr "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" -#: ../../library/ssl.rst:2820 +#: ../../library/ssl.rst:2824 msgid "Steve Kent" msgstr "Steve Kent" -#: ../../library/ssl.rst:2822 +#: ../../library/ssl.rst:2826 msgid ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" msgstr ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" -#: ../../library/ssl.rst:2823 +#: ../../library/ssl.rst:2827 msgid "Donald E., Jeffrey I. Schiller" msgstr "Donald E., Jeffrey I. Schiller" -#: ../../library/ssl.rst:2825 +#: ../../library/ssl.rst:2829 msgid "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" @@ -4053,11 +4062,11 @@ msgstr "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" -#: ../../library/ssl.rst:2826 +#: ../../library/ssl.rst:2830 msgid "D. Cooper" msgstr "D. Cooper" -#: ../../library/ssl.rst:2828 +#: ../../library/ssl.rst:2832 msgid "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" @@ -4065,19 +4074,19 @@ msgstr "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" -#: ../../library/ssl.rst:2829 +#: ../../library/ssl.rst:2833 msgid "T. Dierks et. al." msgstr "T. Dierks et. al." -#: ../../library/ssl.rst:2831 +#: ../../library/ssl.rst:2835 msgid ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" msgstr ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" -#: ../../library/ssl.rst:2832 +#: ../../library/ssl.rst:2836 msgid "D. Eastlake" msgstr "D. Eastlake" -#: ../../library/ssl.rst:2834 +#: ../../library/ssl.rst:2838 msgid "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" @@ -4085,11 +4094,11 @@ msgstr "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" -#: ../../library/ssl.rst:2835 +#: ../../library/ssl.rst:2839 msgid "IANA" msgstr "IANA" -#: ../../library/ssl.rst:2837 +#: ../../library/ssl.rst:2841 msgid "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" @@ -4097,11 +4106,11 @@ msgstr "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" -#: ../../library/ssl.rst:2838 +#: ../../library/ssl.rst:2842 msgid "IETF" msgstr "IETF" -#: ../../library/ssl.rst:2840 +#: ../../library/ssl.rst:2844 msgid "" "`Mozilla's Server Side TLS recommendations `_" @@ -4109,7 +4118,7 @@ msgstr "" "`Mozilla's Server Side TLS recommendations `_" -#: ../../library/ssl.rst:2841 +#: ../../library/ssl.rst:2845 msgid "Mozilla" msgstr "Mozilla" @@ -4137,10 +4146,10 @@ msgstr "Transport Layer Security(傳輸層安全)" msgid "Secure Sockets Layer" msgstr "Secure Sockets Layer(安全 socket 層)" -#: ../../library/ssl.rst:2152 +#: ../../library/ssl.rst:2156 msgid "certificates" msgstr "certificates(憑證)" -#: ../../library/ssl.rst:2154 +#: ../../library/ssl.rst:2158 msgid "X509 certificate" msgstr "X509 certificate(X509 憑證)" diff --git a/library/statistics.po b/library/statistics.po index c957d1b2f2a..73131e7afdd 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -469,6 +469,8 @@ msgid "" ">>> round(geometric_mean([54, 24, 36]), 1)\n" "36.0" msgstr "" +">>> round(geometric_mean([54, 24, 36]), 1)\n" +"36.0" #: ../../library/statistics.rst:222 msgid "" diff --git a/library/stdtypes.po b/library/stdtypes.po index df265115a64..d46b56f45d5 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-18 00:15+0000\n" +"POT-Creation-Date: 2025-10-17 00:14+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -135,8 +135,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:282 #: ../../library/stdtypes.rst:422 ../../library/stdtypes.rst:1005 -#: ../../library/stdtypes.rst:1224 ../../library/stdtypes.rst:2841 -#: ../../library/stdtypes.rst:4101 +#: ../../library/stdtypes.rst:1224 ../../library/stdtypes.rst:2856 +#: ../../library/stdtypes.rst:4116 msgid "Notes" msgstr "註解" @@ -150,7 +150,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:1007 #: ../../library/stdtypes.rst:1010 ../../library/stdtypes.rst:1239 -#: ../../library/stdtypes.rst:2847 ../../library/stdtypes.rst:4107 +#: ../../library/stdtypes.rst:2862 ../../library/stdtypes.rst:4122 msgid "\\(1)" msgstr "\\(1)" @@ -164,8 +164,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:295 #: ../../library/stdtypes.rst:315 ../../library/stdtypes.rst:1250 -#: ../../library/stdtypes.rst:2851 ../../library/stdtypes.rst:2853 -#: ../../library/stdtypes.rst:4111 ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:2866 ../../library/stdtypes.rst:2868 +#: ../../library/stdtypes.rst:4126 ../../library/stdtypes.rst:4128 msgid "\\(2)" msgstr "\\(2)" @@ -177,18 +177,18 @@ msgstr "``not x``" msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" -#: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:2855 -#: ../../library/stdtypes.rst:2857 ../../library/stdtypes.rst:2859 -#: ../../library/stdtypes.rst:2861 ../../library/stdtypes.rst:4115 -#: ../../library/stdtypes.rst:4117 ../../library/stdtypes.rst:4119 -#: ../../library/stdtypes.rst:4121 +#: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:2870 +#: ../../library/stdtypes.rst:2872 ../../library/stdtypes.rst:2874 +#: ../../library/stdtypes.rst:2876 ../../library/stdtypes.rst:4130 +#: ../../library/stdtypes.rst:4132 ../../library/stdtypes.rst:4134 +#: ../../library/stdtypes.rst:4136 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:326 #: ../../library/stdtypes.rst:440 ../../library/stdtypes.rst:1049 -#: ../../library/stdtypes.rst:1254 ../../library/stdtypes.rst:2887 -#: ../../library/stdtypes.rst:4151 +#: ../../library/stdtypes.rst:1254 ../../library/stdtypes.rst:2902 +#: ../../library/stdtypes.rst:4166 msgid "Notes:" msgstr "註解:" @@ -235,9 +235,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2672 -#: ../../library/stdtypes.rst:2818 ../../library/stdtypes.rst:2841 -#: ../../library/stdtypes.rst:4078 ../../library/stdtypes.rst:4101 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2687 +#: ../../library/stdtypes.rst:2833 ../../library/stdtypes.rst:2856 +#: ../../library/stdtypes.rst:4093 ../../library/stdtypes.rst:4116 msgid "Meaning" msgstr "含義" @@ -570,8 +570,8 @@ msgid "" "zero." msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" -#: ../../library/stdtypes.rst:308 ../../library/stdtypes.rst:2849 -#: ../../library/stdtypes.rst:4138 +#: ../../library/stdtypes.rst:308 ../../library/stdtypes.rst:2864 +#: ../../library/stdtypes.rst:4153 msgid "\\(6)" msgstr "\\(6)" @@ -608,9 +608,9 @@ msgid "*x* to the power *y*" msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:317 ../../library/stdtypes.rst:319 -#: ../../library/stdtypes.rst:2874 ../../library/stdtypes.rst:2877 -#: ../../library/stdtypes.rst:2880 ../../library/stdtypes.rst:4134 -#: ../../library/stdtypes.rst:4141 +#: ../../library/stdtypes.rst:2889 ../../library/stdtypes.rst:2892 +#: ../../library/stdtypes.rst:2895 ../../library/stdtypes.rst:4149 +#: ../../library/stdtypes.rst:4156 msgid "\\(5)" msgstr "\\(5)" @@ -768,9 +768,9 @@ msgid "bitwise :dfn:`or` of *x* and *y*" msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:427 -#: ../../library/stdtypes.rst:430 ../../library/stdtypes.rst:2863 -#: ../../library/stdtypes.rst:2867 ../../library/stdtypes.rst:4123 -#: ../../library/stdtypes.rst:4127 +#: ../../library/stdtypes.rst:430 ../../library/stdtypes.rst:2878 +#: ../../library/stdtypes.rst:2882 ../../library/stdtypes.rst:4138 +#: ../../library/stdtypes.rst:4142 msgid "\\(4)" msgstr "\\(4)" @@ -3085,7 +3085,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1891 ../../library/stdtypes.rst:3277 +#: ../../library/stdtypes.rst:1891 ../../library/stdtypes.rst:3292 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -3121,11 +3121,11 @@ msgstr "" ">>> encoded_str_to_bytes\n" "b'Python'" -#: ../../library/stdtypes.rst:1914 ../../library/stdtypes.rst:3296 +#: ../../library/stdtypes.rst:1914 ../../library/stdtypes.rst:3311 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1917 ../../library/stdtypes.rst:3299 +#: ../../library/stdtypes.rst:1917 ../../library/stdtypes.rst:3314 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." @@ -3421,13 +3421,37 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:2163 +#: ../../library/stdtypes.rst:2160 ../../library/stdtypes.rst:2694 +msgid "For example:" +msgstr "舉例來說:" + +#: ../../library/stdtypes.rst:2162 +msgid "" +">>> 'Spam, Spam, Spam'.istitle()\n" +"True\n" +">>> 'spam, spam, spam'.istitle()\n" +"False\n" +">>> 'SPAM, SPAM, SPAM'.istitle()\n" +"False" +msgstr "" +">>> 'Spam, Spam, Spam'.istitle()\n" +"True\n" +">>> 'spam, spam, spam'.istitle()\n" +"False\n" +">>> 'SPAM, SPAM, SPAM'.istitle()\n" +"False" + +#: ../../library/stdtypes.rst:2171 +msgid "See also :meth:`title`." +msgstr "另請參閱 :meth:`title`。" + +#: ../../library/stdtypes.rst:2176 msgid "" "Return ``True`` if all cased characters [4]_ in the string are uppercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:2181 +#: ../../library/stdtypes.rst:2194 msgid "" "Return a string which is the concatenation of the strings in *iterable*. A :" "exc:`TypeError` will be raised if there are any non-string values in " @@ -3435,27 +3459,27 @@ msgid "" "elements is the string providing this method." msgstr "" -#: ../../library/stdtypes.rst:2189 +#: ../../library/stdtypes.rst:2202 msgid "" "Return the string left justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2196 +#: ../../library/stdtypes.rst:2209 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "lowercase." msgstr "" -#: ../../library/stdtypes.rst:2199 +#: ../../library/stdtypes.rst:2212 msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2206 +#: ../../library/stdtypes.rst:2219 msgid "" "Return a copy of the string with leading characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3464,7 +3488,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2211 +#: ../../library/stdtypes.rst:2224 msgid "" ">>> ' spacious '.lstrip()\n" "'spacious '\n" @@ -3476,13 +3500,13 @@ msgstr "" ">>> 'www.example.com'.lstrip('cmowz.')\n" "'example.com'" -#: ../../library/stdtypes.rst:2216 +#: ../../library/stdtypes.rst:2229 msgid "" "See :meth:`str.removeprefix` for a method that will remove a single prefix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2219 +#: ../../library/stdtypes.rst:2232 msgid "" ">>> 'Arthur: three!'.lstrip('Arthur: ')\n" "'ee!'\n" @@ -3494,13 +3518,13 @@ msgstr "" ">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" "'three!'" -#: ../../library/stdtypes.rst:2228 +#: ../../library/stdtypes.rst:2241 msgid "" "This static method returns a translation table usable for :meth:`str." "translate`." msgstr "" -#: ../../library/stdtypes.rst:2230 +#: ../../library/stdtypes.rst:2243 msgid "" "If there is only one argument, it must be a dictionary mapping Unicode " "ordinals (integers) or characters (strings of length 1) to Unicode ordinals, " @@ -3508,7 +3532,7 @@ msgid "" "converted to ordinals." msgstr "" -#: ../../library/stdtypes.rst:2235 +#: ../../library/stdtypes.rst:2248 msgid "" "If there are two arguments, they must be strings of equal length, and in the " "resulting dictionary, each character in *from* will be mapped to the " @@ -3516,7 +3540,7 @@ msgid "" "must be a string, whose characters will be mapped to ``None`` in the result." msgstr "" -#: ../../library/stdtypes.rst:2243 +#: ../../library/stdtypes.rst:2256 msgid "" "Split the string at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3524,13 +3548,13 @@ msgid "" "containing the string itself, followed by two empty strings." msgstr "" -#: ../../library/stdtypes.rst:2251 +#: ../../library/stdtypes.rst:2264 msgid "" "If the string starts with the *prefix* string, return " "``string[len(prefix):]``. Otherwise, return a copy of the original string::" msgstr "" -#: ../../library/stdtypes.rst:2255 +#: ../../library/stdtypes.rst:2268 msgid "" ">>> 'TestHook'.removeprefix('Test')\n" "'Hook'\n" @@ -3542,14 +3566,14 @@ msgstr "" ">>> 'BaseTestCase'.removeprefix('Test')\n" "'BaseTestCase'" -#: ../../library/stdtypes.rst:2265 +#: ../../library/stdtypes.rst:2278 msgid "" "If the string ends with the *suffix* string and that *suffix* is not empty, " "return ``string[:-len(suffix)]``. Otherwise, return a copy of the original " "string::" msgstr "" -#: ../../library/stdtypes.rst:2269 +#: ../../library/stdtypes.rst:2282 msgid "" ">>> 'MiscTests'.removesuffix('Tests')\n" "'Misc'\n" @@ -3561,7 +3585,7 @@ msgstr "" ">>> 'TmpDirMixin'.removesuffix('Tests')\n" "'TmpDirMixin'" -#: ../../library/stdtypes.rst:2279 +#: ../../library/stdtypes.rst:2292 msgid "" "Return a copy of the string with all occurrences of substring *old* replaced " "by *new*. If *count* is given, only the first *count* occurrences are " @@ -3569,31 +3593,31 @@ msgid "" "replaced." msgstr "" -#: ../../library/stdtypes.rst:2283 +#: ../../library/stdtypes.rst:2296 msgid "*count* is now supported as a keyword argument." msgstr "*count* 現在作為關鍵字引數被支援。" -#: ../../library/stdtypes.rst:2289 +#: ../../library/stdtypes.rst:2302 msgid "" "Return the highest index in the string where substring *sub* is found, such " "that *sub* is contained within ``s[start:end]``. Optional arguments *start* " "and *end* are interpreted as in slice notation. Return ``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2296 +#: ../../library/stdtypes.rst:2309 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found." msgstr "" -#: ../../library/stdtypes.rst:2302 +#: ../../library/stdtypes.rst:2315 msgid "" "Return the string right justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2309 +#: ../../library/stdtypes.rst:2322 msgid "" "Split the string at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3601,7 +3625,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2317 +#: ../../library/stdtypes.rst:2330 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done, the " @@ -3610,7 +3634,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2326 +#: ../../library/stdtypes.rst:2339 msgid "" "Return a copy of the string with trailing characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3619,7 +3643,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2331 +#: ../../library/stdtypes.rst:2344 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -3631,13 +3655,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2336 +#: ../../library/stdtypes.rst:2349 msgid "" "See :meth:`str.removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2339 +#: ../../library/stdtypes.rst:2352 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -3649,7 +3673,7 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2346 +#: ../../library/stdtypes.rst:2359 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -3658,7 +3682,7 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2352 +#: ../../library/stdtypes.rst:2365 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " @@ -3668,20 +3692,20 @@ msgid "" "``['']``." msgstr "" -#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:2377 -#: ../../library/stdtypes.rst:2389 ../../library/stdtypes.rst:2441 -#: ../../library/stdtypes.rst:2509 ../../library/stdtypes.rst:2577 -#: ../../library/stdtypes.rst:3612 ../../library/stdtypes.rst:3630 -#: ../../library/stdtypes.rst:3720 ../../library/stdtypes.rst:3736 -#: ../../library/stdtypes.rst:3761 ../../library/stdtypes.rst:3775 -#: ../../library/stdtypes.rst:3803 ../../library/stdtypes.rst:3817 -#: ../../library/stdtypes.rst:3835 ../../library/stdtypes.rst:3862 -#: ../../library/stdtypes.rst:3885 ../../library/stdtypes.rst:3912 -#: ../../library/stdtypes.rst:3954 ../../library/stdtypes.rst:3978 +#: ../../library/stdtypes.rst:2372 ../../library/stdtypes.rst:2390 +#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:2454 +#: ../../library/stdtypes.rst:2522 ../../library/stdtypes.rst:2592 +#: ../../library/stdtypes.rst:3627 ../../library/stdtypes.rst:3645 +#: ../../library/stdtypes.rst:3735 ../../library/stdtypes.rst:3751 +#: ../../library/stdtypes.rst:3776 ../../library/stdtypes.rst:3790 +#: ../../library/stdtypes.rst:3818 ../../library/stdtypes.rst:3832 +#: ../../library/stdtypes.rst:3850 ../../library/stdtypes.rst:3877 +#: ../../library/stdtypes.rst:3900 ../../library/stdtypes.rst:3927 +#: ../../library/stdtypes.rst:3969 ../../library/stdtypes.rst:3993 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2361 +#: ../../library/stdtypes.rst:2374 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -3701,7 +3725,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2370 +#: ../../library/stdtypes.rst:2383 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive whitespace are regarded as a single separator, " @@ -3711,7 +3735,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2379 +#: ../../library/stdtypes.rst:2392 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -3727,13 +3751,13 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2386 +#: ../../library/stdtypes.rst:2399 msgid "" "If *sep* is not specified or is ``None`` and *maxsplit* is ``0``, only " "leading runs of consecutive whitespace are considered." msgstr "" -#: ../../library/stdtypes.rst:2391 +#: ../../library/stdtypes.rst:2404 msgid "" ">>> \"\".split(None, 0)\n" "[]\n" @@ -3749,120 +3773,120 @@ msgstr "" ">>> \" foo \".split(maxsplit=0)\n" "['foo ']" -#: ../../library/stdtypes.rst:2404 +#: ../../library/stdtypes.rst:2417 msgid "" "Return a list of the lines in the string, breaking at line boundaries. Line " "breaks are not included in the resulting list unless *keepends* is given and " "true." msgstr "" -#: ../../library/stdtypes.rst:2408 +#: ../../library/stdtypes.rst:2421 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2412 +#: ../../library/stdtypes.rst:2425 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2412 +#: ../../library/stdtypes.rst:2425 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2414 +#: ../../library/stdtypes.rst:2427 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2414 +#: ../../library/stdtypes.rst:2427 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2416 +#: ../../library/stdtypes.rst:2429 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2416 +#: ../../library/stdtypes.rst:2429 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2418 +#: ../../library/stdtypes.rst:2431 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2418 +#: ../../library/stdtypes.rst:2431 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2420 +#: ../../library/stdtypes.rst:2433 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2420 +#: ../../library/stdtypes.rst:2433 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2422 +#: ../../library/stdtypes.rst:2435 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2422 +#: ../../library/stdtypes.rst:2435 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2424 +#: ../../library/stdtypes.rst:2437 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2424 +#: ../../library/stdtypes.rst:2437 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2426 +#: ../../library/stdtypes.rst:2439 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2426 +#: ../../library/stdtypes.rst:2439 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2428 +#: ../../library/stdtypes.rst:2441 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2428 +#: ../../library/stdtypes.rst:2441 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2430 +#: ../../library/stdtypes.rst:2443 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2430 +#: ../../library/stdtypes.rst:2443 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2432 +#: ../../library/stdtypes.rst:2445 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2432 +#: ../../library/stdtypes.rst:2445 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2434 +#: ../../library/stdtypes.rst:2447 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2434 +#: ../../library/stdtypes.rst:2447 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2439 +#: ../../library/stdtypes.rst:2452 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2443 +#: ../../library/stdtypes.rst:2456 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -3874,14 +3898,14 @@ msgstr "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" -#: ../../library/stdtypes.rst:2448 +#: ../../library/stdtypes.rst:2461 msgid "" "Unlike :meth:`~str.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:2452 +#: ../../library/stdtypes.rst:2465 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -3893,11 +3917,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2457 +#: ../../library/stdtypes.rst:2470 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2459 +#: ../../library/stdtypes.rst:2472 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -3909,7 +3933,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2467 +#: ../../library/stdtypes.rst:2480 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -3917,7 +3941,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2475 +#: ../../library/stdtypes.rst:2488 msgid "" "Return a copy of the string with the leading and trailing characters " "removed. The *chars* argument is a string specifying the set of characters " @@ -3926,7 +3950,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2481 +#: ../../library/stdtypes.rst:2494 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -3938,7 +3962,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2486 +#: ../../library/stdtypes.rst:2499 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -3946,7 +3970,7 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2492 +#: ../../library/stdtypes.rst:2505 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -3956,20 +3980,20 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2499 +#: ../../library/stdtypes.rst:2512 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " "and vice versa. Note that it is not necessarily true that ``s.swapcase()." "swapcase() == s``." msgstr "" -#: ../../library/stdtypes.rst:2506 +#: ../../library/stdtypes.rst:2519 msgid "" "Return a titlecased version of the string where words start with an " "uppercase character and the remaining characters are lowercase." msgstr "" -#: ../../library/stdtypes.rst:2511 +#: ../../library/stdtypes.rst:2524 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -3977,7 +4001,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2514 ../../library/stdtypes.rst:3922 +#: ../../library/stdtypes.rst:2527 ../../library/stdtypes.rst:3937 msgid "" "The algorithm uses a simple language-independent definition of a word as " "groups of consecutive letters. The definition works in many contexts but it " @@ -3985,7 +4009,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2519 +#: ../../library/stdtypes.rst:2532 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -3993,19 +4017,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2522 +#: ../../library/stdtypes.rst:2535 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2525 +#: ../../library/stdtypes.rst:2538 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2528 +#: ../../library/stdtypes.rst:2541 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -4025,7 +4049,11 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2540 +#: ../../library/stdtypes.rst:2550 +msgid "See also :meth:`istitle`." +msgstr "另請參閱 :meth:`istitle`。" + +#: ../../library/stdtypes.rst:2555 msgid "" "Return a copy of the string in which each character has been mapped through " "the given translation table. The table must be an object that implements " @@ -4037,19 +4065,19 @@ msgid "" "exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2549 +#: ../../library/stdtypes.rst:2564 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2552 +#: ../../library/stdtypes.rst:2567 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2558 +#: ../../library/stdtypes.rst:2573 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s`` " @@ -4058,14 +4086,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2564 +#: ../../library/stdtypes.rst:2579 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2571 +#: ../../library/stdtypes.rst:2586 msgid "" "Return a copy of the string left filled with ASCII ``'0'`` digits to make a " "string of length *width*. A leading sign prefix (``'+'``/``'-'``) is handled " @@ -4073,7 +4101,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2579 +#: ../../library/stdtypes.rst:2594 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -4085,27 +4113,27 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2600 +#: ../../library/stdtypes.rst:2615 msgid "Formatted String Literals (f-strings)" msgstr "" -#: ../../library/stdtypes.rst:2603 +#: ../../library/stdtypes.rst:2618 msgid "" "The :keyword:`await` and :keyword:`async for` can be used in expressions " "within f-strings." msgstr "" -#: ../../library/stdtypes.rst:2606 +#: ../../library/stdtypes.rst:2621 msgid "Added the debugging operator (``=``)" msgstr "" -#: ../../library/stdtypes.rst:2608 +#: ../../library/stdtypes.rst:2623 msgid "" "Many restrictions on expressions within f-strings have been removed. " "Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../library/stdtypes.rst:2612 +#: ../../library/stdtypes.rst:2627 msgid "" "An :dfn:`f-string` (formally a :dfn:`formatted string literal`) is a string " "literal that is prefixed with ``f`` or ``F``. This type of string literal " @@ -4115,7 +4143,7 @@ msgid "" "into regular :class:`str` objects. For example:" msgstr "" -#: ../../library/stdtypes.rst:2620 +#: ../../library/stdtypes.rst:2635 msgid "" ">>> who = 'nobody'\n" ">>> nationality = 'Spanish'\n" @@ -4127,11 +4155,11 @@ msgstr "" ">>> f'{who.title()} expects the {nationality} Inquisition!'\n" "'Nobody expects the Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2627 +#: ../../library/stdtypes.rst:2642 msgid "It is also possible to use a multi line f-string:" msgstr "" -#: ../../library/stdtypes.rst:2629 +#: ../../library/stdtypes.rst:2644 msgid "" ">>> f'''This is a string\n" "... on two lines'''\n" @@ -4141,13 +4169,13 @@ msgstr "" "... on two lines'''\n" "'This is a string\\non two lines'" -#: ../../library/stdtypes.rst:2635 +#: ../../library/stdtypes.rst:2650 msgid "" "A single opening curly bracket, ``'{'``, marks a *replacement field* that " "can contain any Python expression:" msgstr "" -#: ../../library/stdtypes.rst:2638 +#: ../../library/stdtypes.rst:2653 msgid "" ">>> nationality = 'Spanish'\n" ">>> f'The {nationality} Inquisition!'\n" @@ -4157,11 +4185,11 @@ msgstr "" ">>> f'The {nationality} Inquisition!'\n" "'The Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2644 +#: ../../library/stdtypes.rst:2659 msgid "To include a literal ``{`` or ``}``, use a double bracket:" msgstr "" -#: ../../library/stdtypes.rst:2646 +#: ../../library/stdtypes.rst:2661 msgid "" ">>> x = 42\n" ">>> f'{{x}} is {x}'\n" @@ -4171,12 +4199,12 @@ msgstr "" ">>> f'{{x}} is {x}'\n" "'{x} is 42'" -#: ../../library/stdtypes.rst:2652 +#: ../../library/stdtypes.rst:2667 msgid "" "Functions can also be used, and :ref:`format specifiers `:" msgstr "" -#: ../../library/stdtypes.rst:2654 +#: ../../library/stdtypes.rst:2669 msgid "" ">>> from math import sqrt\n" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" @@ -4186,11 +4214,11 @@ msgstr "" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" "'√2 ≈ 1.41421'" -#: ../../library/stdtypes.rst:2660 +#: ../../library/stdtypes.rst:2675 msgid "Any non-string expression is converted using :func:`str`, by default:" msgstr "" -#: ../../library/stdtypes.rst:2662 +#: ../../library/stdtypes.rst:2677 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)}'\n" @@ -4200,46 +4228,42 @@ msgstr "" ">>> f'{Fraction(1, 3)}'\n" "'1/3'" -#: ../../library/stdtypes.rst:2668 +#: ../../library/stdtypes.rst:2683 msgid "" "To use an explicit conversion, use the ``!`` (exclamation mark) operator, " "followed by any of the valid formats, which are:" msgstr "" -#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:2841 -#: ../../library/stdtypes.rst:4101 +#: ../../library/stdtypes.rst:2687 ../../library/stdtypes.rst:2856 +#: ../../library/stdtypes.rst:4116 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:2674 +#: ../../library/stdtypes.rst:2689 msgid "``!a``" msgstr "``!a``" -#: ../../library/stdtypes.rst:2674 +#: ../../library/stdtypes.rst:2689 msgid ":func:`ascii`" msgstr ":func:`ascii`" -#: ../../library/stdtypes.rst:2675 +#: ../../library/stdtypes.rst:2690 msgid "``!r``" msgstr "``!r``" -#: ../../library/stdtypes.rst:2675 +#: ../../library/stdtypes.rst:2690 msgid ":func:`repr`" msgstr ":func:`repr`" -#: ../../library/stdtypes.rst:2676 +#: ../../library/stdtypes.rst:2691 msgid "``!s``" msgstr "``!s``" -#: ../../library/stdtypes.rst:2676 +#: ../../library/stdtypes.rst:2691 msgid ":func:`str`" msgstr ":func:`str`" -#: ../../library/stdtypes.rst:2679 -msgid "For example:" -msgstr "舉例來說:" - -#: ../../library/stdtypes.rst:2681 +#: ../../library/stdtypes.rst:2696 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)!s}'\n" @@ -4259,7 +4283,7 @@ msgstr "" ">>> print(f'{question!a}')\n" "'\\xbfD\\xf3nde est\\xe1 el Presidente?'" -#: ../../library/stdtypes.rst:2692 +#: ../../library/stdtypes.rst:2707 msgid "" "While debugging it may be helpful to see both the expression and its value, " "by using the equals sign (``=``) after the expression. This preserves spaces " @@ -4267,7 +4291,7 @@ msgid "" "debugging operator uses the :func:`repr` (``!r``) conversion. For example:" msgstr "" -#: ../../library/stdtypes.rst:2698 +#: ../../library/stdtypes.rst:2713 msgid "" ">>> from fractions import Fraction\n" ">>> calculation = Fraction(1, 3)\n" @@ -4287,7 +4311,7 @@ msgstr "" ">>> f'{calculation = !s}'\n" "'calculation = 1/3'" -#: ../../library/stdtypes.rst:2709 +#: ../../library/stdtypes.rst:2724 msgid "" "Once the output has been evaluated, it can be formatted using a :ref:`format " "specifier ` following a colon (``':'``). After the expression " @@ -4297,7 +4321,7 @@ msgid "" "used as the final value for the replacement field. For example:" msgstr "" -#: ../../library/stdtypes.rst:2717 +#: ../../library/stdtypes.rst:2732 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 7):.6f}'\n" @@ -4305,19 +4329,24 @@ msgid "" ">>> f'{Fraction(1, 7):_^+10}'\n" "'___+1/7___'" msgstr "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 7):.6f}'\n" +"'0.142857'\n" +">>> f'{Fraction(1, 7):_^+10}'\n" +"'___+1/7___'" -#: ../../library/stdtypes.rst:2729 +#: ../../library/stdtypes.rst:2744 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2742 +#: ../../library/stdtypes.rst:2757 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " "dictionaries correctly)." msgstr "" -#: ../../library/stdtypes.rst:2746 +#: ../../library/stdtypes.rst:2761 msgid "" "Using :ref:`formatted string literals `, the :meth:`str.format` " "interface, or :class:`string.Template` may help avoid these errors. Each of " @@ -4325,7 +4354,7 @@ msgid "" "flexibility, and/or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2751 +#: ../../library/stdtypes.rst:2766 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -4335,13 +4364,15 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:2758 +#: ../../library/stdtypes.rst:2773 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." msgstr "" +">>> print('%s has %d quote types.' % ('Python', 2))\n" +"Python has 2 quote types." -#: ../../library/stdtypes.rst:2763 +#: ../../library/stdtypes.rst:2778 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -4349,36 +4380,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2773 ../../library/stdtypes.rst:4033 +#: ../../library/stdtypes.rst:2788 ../../library/stdtypes.rst:4048 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2776 ../../library/stdtypes.rst:4036 +#: ../../library/stdtypes.rst:2791 ../../library/stdtypes.rst:4051 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2778 ../../library/stdtypes.rst:4038 +#: ../../library/stdtypes.rst:2793 ../../library/stdtypes.rst:4053 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2781 ../../library/stdtypes.rst:4041 +#: ../../library/stdtypes.rst:2796 ../../library/stdtypes.rst:4056 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2784 ../../library/stdtypes.rst:4044 +#: ../../library/stdtypes.rst:2799 ../../library/stdtypes.rst:4059 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is read from the next element of the tuple in *values*, and the " "object to convert comes after the minimum field width and optional precision." msgstr "" -#: ../../library/stdtypes.rst:2788 ../../library/stdtypes.rst:4048 +#: ../../library/stdtypes.rst:2803 ../../library/stdtypes.rst:4063 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -4386,15 +4417,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2793 ../../library/stdtypes.rst:4053 +#: ../../library/stdtypes.rst:2808 ../../library/stdtypes.rst:4068 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2795 ../../library/stdtypes.rst:4055 +#: ../../library/stdtypes.rst:2810 ../../library/stdtypes.rst:4070 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2797 +#: ../../library/stdtypes.rst:2812 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the string *must* include a parenthesised mapping key into that " @@ -4402,275 +4433,275 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2806 ../../library/stdtypes.rst:4066 +#: ../../library/stdtypes.rst:2821 ../../library/stdtypes.rst:4081 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2809 ../../library/stdtypes.rst:4069 +#: ../../library/stdtypes.rst:2824 ../../library/stdtypes.rst:4084 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2818 ../../library/stdtypes.rst:4078 +#: ../../library/stdtypes.rst:2833 ../../library/stdtypes.rst:4093 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2820 ../../library/stdtypes.rst:4080 +#: ../../library/stdtypes.rst:2835 ../../library/stdtypes.rst:4095 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2820 ../../library/stdtypes.rst:4080 +#: ../../library/stdtypes.rst:2835 ../../library/stdtypes.rst:4095 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2823 ../../library/stdtypes.rst:4083 +#: ../../library/stdtypes.rst:2838 ../../library/stdtypes.rst:4098 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2823 ../../library/stdtypes.rst:4083 +#: ../../library/stdtypes.rst:2838 ../../library/stdtypes.rst:4098 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2825 ../../library/stdtypes.rst:4085 +#: ../../library/stdtypes.rst:2840 ../../library/stdtypes.rst:4100 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2825 ../../library/stdtypes.rst:4085 +#: ../../library/stdtypes.rst:2840 ../../library/stdtypes.rst:4100 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2828 ../../library/stdtypes.rst:4088 +#: ../../library/stdtypes.rst:2843 ../../library/stdtypes.rst:4103 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2828 ../../library/stdtypes.rst:4088 +#: ../../library/stdtypes.rst:2843 ../../library/stdtypes.rst:4103 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2831 ../../library/stdtypes.rst:4091 +#: ../../library/stdtypes.rst:2846 ../../library/stdtypes.rst:4106 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2831 ../../library/stdtypes.rst:4091 +#: ../../library/stdtypes.rst:2846 ../../library/stdtypes.rst:4106 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2835 ../../library/stdtypes.rst:4095 +#: ../../library/stdtypes.rst:2850 ../../library/stdtypes.rst:4110 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" -#: ../../library/stdtypes.rst:2838 ../../library/stdtypes.rst:4098 +#: ../../library/stdtypes.rst:2853 ../../library/stdtypes.rst:4113 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2843 ../../library/stdtypes.rst:4103 +#: ../../library/stdtypes.rst:2858 ../../library/stdtypes.rst:4118 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2843 ../../library/stdtypes.rst:2845 -#: ../../library/stdtypes.rst:4103 ../../library/stdtypes.rst:4105 +#: ../../library/stdtypes.rst:2858 ../../library/stdtypes.rst:2860 +#: ../../library/stdtypes.rst:4118 ../../library/stdtypes.rst:4120 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2845 ../../library/stdtypes.rst:4105 +#: ../../library/stdtypes.rst:2860 ../../library/stdtypes.rst:4120 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2847 ../../library/stdtypes.rst:4107 +#: ../../library/stdtypes.rst:2862 ../../library/stdtypes.rst:4122 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2847 ../../library/stdtypes.rst:4107 +#: ../../library/stdtypes.rst:2862 ../../library/stdtypes.rst:4122 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2849 ../../library/stdtypes.rst:4109 +#: ../../library/stdtypes.rst:2864 ../../library/stdtypes.rst:4124 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2849 ../../library/stdtypes.rst:4109 +#: ../../library/stdtypes.rst:2864 ../../library/stdtypes.rst:4124 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2851 ../../library/stdtypes.rst:4111 +#: ../../library/stdtypes.rst:2866 ../../library/stdtypes.rst:4126 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2851 ../../library/stdtypes.rst:4111 +#: ../../library/stdtypes.rst:2866 ../../library/stdtypes.rst:4126 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2853 ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:2868 ../../library/stdtypes.rst:4128 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2853 ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:2868 ../../library/stdtypes.rst:4128 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2855 ../../library/stdtypes.rst:4115 +#: ../../library/stdtypes.rst:2870 ../../library/stdtypes.rst:4130 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2855 ../../library/stdtypes.rst:4115 +#: ../../library/stdtypes.rst:2870 ../../library/stdtypes.rst:4130 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2857 ../../library/stdtypes.rst:4117 +#: ../../library/stdtypes.rst:2872 ../../library/stdtypes.rst:4132 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2857 ../../library/stdtypes.rst:4117 +#: ../../library/stdtypes.rst:2872 ../../library/stdtypes.rst:4132 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2859 ../../library/stdtypes.rst:4119 +#: ../../library/stdtypes.rst:2874 ../../library/stdtypes.rst:4134 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2859 ../../library/stdtypes.rst:2861 -#: ../../library/stdtypes.rst:4119 ../../library/stdtypes.rst:4121 +#: ../../library/stdtypes.rst:2874 ../../library/stdtypes.rst:2876 +#: ../../library/stdtypes.rst:4134 ../../library/stdtypes.rst:4136 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2861 ../../library/stdtypes.rst:4121 +#: ../../library/stdtypes.rst:2876 ../../library/stdtypes.rst:4136 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2863 ../../library/stdtypes.rst:4123 +#: ../../library/stdtypes.rst:2878 ../../library/stdtypes.rst:4138 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2863 ../../library/stdtypes.rst:4123 +#: ../../library/stdtypes.rst:2878 ../../library/stdtypes.rst:4138 msgid "" "Floating-point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2867 ../../library/stdtypes.rst:4127 +#: ../../library/stdtypes.rst:2882 ../../library/stdtypes.rst:4142 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2867 ../../library/stdtypes.rst:4127 +#: ../../library/stdtypes.rst:2882 ../../library/stdtypes.rst:4142 msgid "" "Floating-point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2871 ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:2886 ../../library/stdtypes.rst:4146 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2871 +#: ../../library/stdtypes.rst:2886 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2874 ../../library/stdtypes.rst:4144 +#: ../../library/stdtypes.rst:2889 ../../library/stdtypes.rst:4159 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2874 +#: ../../library/stdtypes.rst:2889 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2877 ../../library/stdtypes.rst:4138 +#: ../../library/stdtypes.rst:2892 ../../library/stdtypes.rst:4153 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2877 +#: ../../library/stdtypes.rst:2892 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2880 ../../library/stdtypes.rst:4141 +#: ../../library/stdtypes.rst:2895 ../../library/stdtypes.rst:4156 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2880 +#: ../../library/stdtypes.rst:2895 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2883 ../../library/stdtypes.rst:4147 +#: ../../library/stdtypes.rst:2898 ../../library/stdtypes.rst:4162 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2883 ../../library/stdtypes.rst:4147 +#: ../../library/stdtypes.rst:2898 ../../library/stdtypes.rst:4162 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2890 ../../library/stdtypes.rst:4154 +#: ../../library/stdtypes.rst:2905 ../../library/stdtypes.rst:4169 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2894 ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:2909 ../../library/stdtypes.rst:4173 msgid "" "The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on " "whether the ``'x'`` or ``'X'`` format was used) to be inserted before the " "first digit." msgstr "" -#: ../../library/stdtypes.rst:2898 ../../library/stdtypes.rst:4162 +#: ../../library/stdtypes.rst:2913 ../../library/stdtypes.rst:4177 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2901 ../../library/stdtypes.rst:4165 +#: ../../library/stdtypes.rst:2916 ../../library/stdtypes.rst:4180 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2905 ../../library/stdtypes.rst:4169 +#: ../../library/stdtypes.rst:2920 ../../library/stdtypes.rst:4184 msgid "" "The alternate form causes the result to always contain a decimal point, and " "trailing zeroes are not removed as they would otherwise be." msgstr "" -#: ../../library/stdtypes.rst:2908 ../../library/stdtypes.rst:4172 +#: ../../library/stdtypes.rst:2923 ../../library/stdtypes.rst:4187 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2912 ../../library/stdtypes.rst:4176 +#: ../../library/stdtypes.rst:2927 ../../library/stdtypes.rst:4191 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2915 ../../library/stdtypes.rst:4185 +#: ../../library/stdtypes.rst:2930 ../../library/stdtypes.rst:4200 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2917 +#: ../../library/stdtypes.rst:2932 msgid "" "Since Python strings have an explicit length, ``%s`` conversions do not " "assume that ``'\\0'`` is the end of the string." msgstr "" -#: ../../library/stdtypes.rst:2922 +#: ../../library/stdtypes.rst:2937 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2933 +#: ../../library/stdtypes.rst:2948 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2941 +#: ../../library/stdtypes.rst:2956 msgid "" "The core built-in types for manipulating binary data are :class:`bytes` and :" "class:`bytearray`. They are supported by :class:`memoryview` which uses the :" @@ -4678,17 +4709,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2946 +#: ../../library/stdtypes.rst:2961 msgid "" "The :mod:`array` module supports efficient storage of basic data types like " "32-bit integers and IEEE754 double-precision floating values." msgstr "" -#: ../../library/stdtypes.rst:2952 +#: ../../library/stdtypes.rst:2967 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2956 +#: ../../library/stdtypes.rst:2971 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -4696,40 +4727,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2964 +#: ../../library/stdtypes.rst:2979 msgid "" "Firstly, the syntax for bytes literals is largely the same as that for " "string literals, except that a ``b`` prefix is added:" msgstr "" -#: ../../library/stdtypes.rst:2967 +#: ../../library/stdtypes.rst:2982 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2968 +#: ../../library/stdtypes.rst:2983 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2969 +#: ../../library/stdtypes.rst:2984 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2971 +#: ../../library/stdtypes.rst:2986 msgid "" "Only ASCII characters are permitted in bytes literals (regardless of the " "declared source code encoding). Any binary values over 127 must be entered " "into bytes literals using the appropriate escape sequence." msgstr "" -#: ../../library/stdtypes.rst:2975 +#: ../../library/stdtypes.rst:2990 msgid "" "As with string literals, bytes literals may also use a ``r`` prefix to " "disable processing of escape sequences. See :ref:`strings` for more about " "the various forms of bytes literal, including supported escape sequences." msgstr "" -#: ../../library/stdtypes.rst:2979 +#: ../../library/stdtypes.rst:2994 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -4742,29 +4773,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2989 +#: ../../library/stdtypes.rst:3004 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2992 +#: ../../library/stdtypes.rst:3007 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2993 +#: ../../library/stdtypes.rst:3008 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2994 +#: ../../library/stdtypes.rst:3009 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2996 +#: ../../library/stdtypes.rst:3011 msgid "Also see the :ref:`bytes ` built-in." msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:2998 +#: ../../library/stdtypes.rst:3013 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4772,38 +4803,38 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:3004 +#: ../../library/stdtypes.rst:3019 msgid "" "This :class:`bytes` class method returns a bytes object, decoding the given " "string object. The string must contain two hexadecimal digits per byte, " "with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:3011 +#: ../../library/stdtypes.rst:3026 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:3015 +#: ../../library/stdtypes.rst:3030 msgid "" ":meth:`bytes.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-like " "objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3019 +#: ../../library/stdtypes.rst:3034 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3025 ../../library/stdtypes.rst:3116 +#: ../../library/stdtypes.rst:3040 ../../library/stdtypes.rst:3131 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:3031 +#: ../../library/stdtypes.rst:3046 msgid "" "If you want to make the hex string easier to read, you can specify a single " "character separator *sep* parameter to include in the output. By default, " @@ -4812,13 +4843,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:3048 +#: ../../library/stdtypes.rst:3063 msgid "" ":meth:`bytes.hex` now supports optional *sep* and *bytes_per_sep* parameters " "to insert separators between bytes in the hex output." msgstr "" -#: ../../library/stdtypes.rst:3052 +#: ../../library/stdtypes.rst:3067 msgid "" "Since bytes objects are sequences of integers (akin to a tuple), for a bytes " "object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes " @@ -4826,58 +4857,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3057 +#: ../../library/stdtypes.rst:3072 msgid "" "The representation of bytes objects uses the literal format (``b'...'``) " "since it is often more useful than e.g. ``bytes([46, 46, 46])``. You can " "always convert a bytes object into a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:3065 +#: ../../library/stdtypes.rst:3080 msgid "Bytearray Objects" msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:3069 +#: ../../library/stdtypes.rst:3084 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:3075 +#: ../../library/stdtypes.rst:3090 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:3078 +#: ../../library/stdtypes.rst:3093 msgid "Creating an empty instance: ``bytearray()``" msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:3079 +#: ../../library/stdtypes.rst:3094 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:3080 +#: ../../library/stdtypes.rst:3095 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:3081 +#: ../../library/stdtypes.rst:3096 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:3083 +#: ../../library/stdtypes.rst:3098 msgid "" "As bytearray objects are mutable, they support the :ref:`mutable ` sequence operations in addition to the common bytes and bytearray " "operations described in :ref:`bytes-methods`." msgstr "" -#: ../../library/stdtypes.rst:3087 +#: ../../library/stdtypes.rst:3102 msgid "Also see the :ref:`bytearray ` built-in." msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:3089 +#: ../../library/stdtypes.rst:3104 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4885,64 +4916,64 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:3095 +#: ../../library/stdtypes.rst:3110 msgid "" "This :class:`bytearray` class method returns bytearray object, decoding the " "given string object. The string must contain two hexadecimal digits per " "byte, with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:3102 +#: ../../library/stdtypes.rst:3117 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:3106 +#: ../../library/stdtypes.rst:3121 msgid "" ":meth:`bytearray.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-" "like objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3110 +#: ../../library/stdtypes.rst:3125 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3124 +#: ../../library/stdtypes.rst:3139 msgid "" "Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:3131 +#: ../../library/stdtypes.rst:3146 msgid "" "Resize the :class:`bytearray` to contain *size* bytes. *size* must be " "greater than or equal to 0." msgstr "" -#: ../../library/stdtypes.rst:3134 +#: ../../library/stdtypes.rst:3149 msgid "" "If the :class:`bytearray` needs to shrink, bytes beyond *size* are truncated." msgstr "" -#: ../../library/stdtypes.rst:3136 +#: ../../library/stdtypes.rst:3151 msgid "" "If the :class:`bytearray` needs to grow, all new bytes, those beyond *size*, " "will be set to null bytes." msgstr "" -#: ../../library/stdtypes.rst:3140 +#: ../../library/stdtypes.rst:3155 msgid "This is equivalent to:" msgstr "等同於:" -#: ../../library/stdtypes.rst:3148 +#: ../../library/stdtypes.rst:3163 msgid "Examples:" msgstr "範例:" -#: ../../library/stdtypes.rst:3161 +#: ../../library/stdtypes.rst:3176 msgid "" "Since bytearray objects are sequences of integers (akin to a list), for a " "bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be " @@ -4950,7 +4981,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3166 +#: ../../library/stdtypes.rst:3181 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -4958,11 +4989,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:3175 +#: ../../library/stdtypes.rst:3190 msgid "Bytes and Bytearray Operations" msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:3180 +#: ../../library/stdtypes.rst:3195 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -4971,14 +5002,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:3188 +#: ../../library/stdtypes.rst:3203 msgid "" "The methods on bytes and bytearray objects don't accept strings as their " "arguments, just as the methods on strings don't accept bytes as their " "arguments. For example, you have to write::" msgstr "" -#: ../../library/stdtypes.rst:3192 +#: ../../library/stdtypes.rst:3207 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -4986,11 +5017,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:3195 +#: ../../library/stdtypes.rst:3210 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:3197 +#: ../../library/stdtypes.rst:3212 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -4998,60 +5029,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:3200 +#: ../../library/stdtypes.rst:3215 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" -#: ../../library/stdtypes.rst:3205 +#: ../../library/stdtypes.rst:3220 msgid "" "Using these ASCII based operations to manipulate binary data that is not " "stored in an ASCII based format may lead to data corruption." msgstr "" -#: ../../library/stdtypes.rst:3208 +#: ../../library/stdtypes.rst:3223 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:3214 +#: ../../library/stdtypes.rst:3229 msgid "" "Return the number of non-overlapping occurrences of subsequence *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:3218 ../../library/stdtypes.rst:3323 -#: ../../library/stdtypes.rst:3345 ../../library/stdtypes.rst:3411 -#: ../../library/stdtypes.rst:3424 +#: ../../library/stdtypes.rst:3233 ../../library/stdtypes.rst:3338 +#: ../../library/stdtypes.rst:3360 ../../library/stdtypes.rst:3426 +#: ../../library/stdtypes.rst:3439 msgid "" "The subsequence to search for may be any :term:`bytes-like object` or an " "integer in the range 0 to 255." msgstr "" -#: ../../library/stdtypes.rst:3221 +#: ../../library/stdtypes.rst:3236 msgid "" "If *sub* is empty, returns the number of empty slices between characters " "which is the length of the bytes object plus one." msgstr "" -#: ../../library/stdtypes.rst:3224 ../../library/stdtypes.rst:3335 -#: ../../library/stdtypes.rst:3348 ../../library/stdtypes.rst:3414 -#: ../../library/stdtypes.rst:3427 +#: ../../library/stdtypes.rst:3239 ../../library/stdtypes.rst:3350 +#: ../../library/stdtypes.rst:3363 ../../library/stdtypes.rst:3429 +#: ../../library/stdtypes.rst:3442 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:3231 +#: ../../library/stdtypes.rst:3246 msgid "" "If the binary data starts with the *prefix* string, return " "``bytes[len(prefix):]``. Otherwise, return a copy of the original binary " "data::" msgstr "" -#: ../../library/stdtypes.rst:3235 +#: ../../library/stdtypes.rst:3250 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -5063,32 +5094,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:3240 +#: ../../library/stdtypes.rst:3255 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" -#: ../../library/stdtypes.rst:3244 ../../library/stdtypes.rst:3266 -#: ../../library/stdtypes.rst:3399 ../../library/stdtypes.rst:3492 -#: ../../library/stdtypes.rst:3506 ../../library/stdtypes.rst:3536 -#: ../../library/stdtypes.rst:3550 ../../library/stdtypes.rst:3591 -#: ../../library/stdtypes.rst:3661 ../../library/stdtypes.rst:3679 -#: ../../library/stdtypes.rst:3707 ../../library/stdtypes.rst:3846 -#: ../../library/stdtypes.rst:3901 ../../library/stdtypes.rst:3944 -#: ../../library/stdtypes.rst:3965 ../../library/stdtypes.rst:3987 -#: ../../library/stdtypes.rst:4189 +#: ../../library/stdtypes.rst:3259 ../../library/stdtypes.rst:3281 +#: ../../library/stdtypes.rst:3414 ../../library/stdtypes.rst:3507 +#: ../../library/stdtypes.rst:3521 ../../library/stdtypes.rst:3551 +#: ../../library/stdtypes.rst:3565 ../../library/stdtypes.rst:3606 +#: ../../library/stdtypes.rst:3676 ../../library/stdtypes.rst:3694 +#: ../../library/stdtypes.rst:3722 ../../library/stdtypes.rst:3861 +#: ../../library/stdtypes.rst:3916 ../../library/stdtypes.rst:3959 +#: ../../library/stdtypes.rst:3980 ../../library/stdtypes.rst:4002 +#: ../../library/stdtypes.rst:4204 msgid "" "The bytearray version of this method does *not* operate in place - it always " "produces a new object, even if no changes were made." msgstr "" -#: ../../library/stdtypes.rst:3253 +#: ../../library/stdtypes.rst:3268 msgid "" "If the binary data ends with the *suffix* string and that *suffix* is not " "empty, return ``bytes[:-len(suffix)]``. Otherwise, return a copy of the " "original binary data::" msgstr "" -#: ../../library/stdtypes.rst:3257 +#: ../../library/stdtypes.rst:3272 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -5100,15 +5131,15 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:3262 +#: ../../library/stdtypes.rst:3277 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3275 +#: ../../library/stdtypes.rst:3290 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:3280 +#: ../../library/stdtypes.rst:3295 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -5116,21 +5147,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:3286 +#: ../../library/stdtypes.rst:3301 msgid "" "For performance reasons, the value of *errors* is not checked for validity " "unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" "`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:3292 +#: ../../library/stdtypes.rst:3307 msgid "" "Passing the *encoding* argument to :class:`str` allows decoding any :term:" "`bytes-like object` directly, without needing to make a temporary :class:`!" "bytes` or :class:`!bytearray` object." msgstr "" -#: ../../library/stdtypes.rst:3307 +#: ../../library/stdtypes.rst:3322 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -5138,11 +5169,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3312 +#: ../../library/stdtypes.rst:3327 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3318 +#: ../../library/stdtypes.rst:3333 msgid "" "Return the lowest index in the data where the subsequence *sub* is found, " "such that *sub* is contained in the slice ``s[start:end]``. Optional " @@ -5150,14 +5181,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3328 +#: ../../library/stdtypes.rst:3343 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:3332 +#: ../../library/stdtypes.rst:3347 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -5165,13 +5196,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:3342 +#: ../../library/stdtypes.rst:3357 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:3355 +#: ../../library/stdtypes.rst:3370 msgid "" "Return a bytes or bytearray object which is the concatenation of the binary " "data sequences in *iterable*. A :exc:`TypeError` will be raised if there " @@ -5181,7 +5212,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:3366 +#: ../../library/stdtypes.rst:3381 msgid "" "This static method returns a translation table usable for :meth:`bytes." "translate` that will map each character in *from* into the character at the " @@ -5189,7 +5220,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:3377 +#: ../../library/stdtypes.rst:3392 msgid "" "Split the sequence at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -5198,24 +5229,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:3384 ../../library/stdtypes.rst:3441 +#: ../../library/stdtypes.rst:3399 ../../library/stdtypes.rst:3456 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3390 +#: ../../library/stdtypes.rst:3405 msgid "" "Return a copy of the sequence with all occurrences of subsequence *old* " "replaced by *new*. If the optional argument *count* is given, only the " "first *count* occurrences are replaced." msgstr "" -#: ../../library/stdtypes.rst:3394 +#: ../../library/stdtypes.rst:3409 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3406 +#: ../../library/stdtypes.rst:3421 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -5223,13 +5254,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:3421 +#: ../../library/stdtypes.rst:3436 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3434 +#: ../../library/stdtypes.rst:3449 msgid "" "Split the sequence at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -5238,7 +5269,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:3447 +#: ../../library/stdtypes.rst:3462 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -5246,11 +5277,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3452 +#: ../../library/stdtypes.rst:3467 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3458 +#: ../../library/stdtypes.rst:3473 msgid "" "Return a copy of the bytes or bytearray object where all bytes occurring in " "the optional argument *delete* are removed, and the remaining bytes have " @@ -5258,18 +5289,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3463 +#: ../../library/stdtypes.rst:3478 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3466 +#: ../../library/stdtypes.rst:3481 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3469 +#: ../../library/stdtypes.rst:3484 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -5277,11 +5308,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3472 +#: ../../library/stdtypes.rst:3487 msgid "*delete* is now supported as a keyword argument." msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3476 +#: ../../library/stdtypes.rst:3491 msgid "" "The following methods on bytes and bytearray objects have default behaviours " "that assume the use of ASCII compatible binary formats, but can still be " @@ -5290,7 +5321,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3485 +#: ../../library/stdtypes.rst:3500 msgid "" "Return a copy of the object centered in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -5298,7 +5329,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3499 +#: ../../library/stdtypes.rst:3514 msgid "" "Return a copy of the object left justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -5306,7 +5337,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3513 +#: ../../library/stdtypes.rst:3528 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -5315,7 +5346,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3519 +#: ../../library/stdtypes.rst:3534 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -5327,14 +5358,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3524 +#: ../../library/stdtypes.rst:3539 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removeprefix` for a method that will remove a " "single prefix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3529 +#: ../../library/stdtypes.rst:3544 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -5346,7 +5377,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3543 +#: ../../library/stdtypes.rst:3558 msgid "" "Return a copy of the object right justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -5354,7 +5385,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3557 +#: ../../library/stdtypes.rst:3572 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are " @@ -5364,7 +5395,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3568 +#: ../../library/stdtypes.rst:3583 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -5373,7 +5404,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3574 +#: ../../library/stdtypes.rst:3589 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -5385,14 +5416,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3579 +#: ../../library/stdtypes.rst:3594 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removesuffix` for a method that will remove a " "single suffix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3584 +#: ../../library/stdtypes.rst:3599 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -5404,7 +5435,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3598 +#: ../../library/stdtypes.rst:3613 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given and non-negative, at most " @@ -5413,7 +5444,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3604 +#: ../../library/stdtypes.rst:3619 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " @@ -5424,7 +5455,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3614 +#: ../../library/stdtypes.rst:3629 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -5444,7 +5475,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3623 +#: ../../library/stdtypes.rst:3638 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive ASCII whitespace are regarded as a single " @@ -5454,7 +5485,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3633 +#: ../../library/stdtypes.rst:3648 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -5470,7 +5501,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3644 +#: ../../library/stdtypes.rst:3659 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *bytes* argument is a binary sequence specifying the set of " @@ -5479,7 +5510,7 @@ msgid "" "or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3651 +#: ../../library/stdtypes.rst:3666 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -5491,13 +5522,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3656 +#: ../../library/stdtypes.rst:3671 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3665 +#: ../../library/stdtypes.rst:3680 msgid "" "The following methods on bytes and bytearray objects assume the use of ASCII " "compatible binary formats and should not be applied to arbitrary binary " @@ -5505,14 +5536,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3673 +#: ../../library/stdtypes.rst:3688 msgid "" "Return a copy of the sequence with each byte interpreted as an ASCII " "character, and the first byte capitalized and the rest lowercased. Non-ASCII " "byte values are passed through unchanged." msgstr "" -#: ../../library/stdtypes.rst:3686 +#: ../../library/stdtypes.rst:3701 msgid "" "Return a copy of the sequence where all ASCII tab characters are replaced by " "one or more ASCII spaces, depending on the current column and the given tab " @@ -5528,7 +5559,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3700 +#: ../../library/stdtypes.rst:3715 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -5540,7 +5571,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3714 +#: ../../library/stdtypes.rst:3729 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -5549,7 +5580,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3722 +#: ../../library/stdtypes.rst:3737 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -5561,7 +5592,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3731 +#: ../../library/stdtypes.rst:3746 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -5569,7 +5600,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3738 +#: ../../library/stdtypes.rst:3753 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -5581,20 +5612,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3747 +#: ../../library/stdtypes.rst:3762 msgid "" "Return ``True`` if the sequence is empty or all bytes in the sequence are " "ASCII, ``False`` otherwise. ASCII bytes are in the range 0-0x7F." msgstr "" -#: ../../library/stdtypes.rst:3757 +#: ../../library/stdtypes.rst:3772 msgid "" "Return ``True`` if all bytes in the sequence are ASCII decimal digits and " "the sequence is not empty, ``False`` otherwise. ASCII decimal digits are " "those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3763 +#: ../../library/stdtypes.rst:3778 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -5606,13 +5637,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3772 +#: ../../library/stdtypes.rst:3787 msgid "" "Return ``True`` if there is at least one lowercase ASCII character in the " "sequence and no uppercase ASCII characters, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:3777 +#: ../../library/stdtypes.rst:3792 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -5624,16 +5655,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3782 ../../library/stdtypes.rst:3824 -#: ../../library/stdtypes.rst:3840 ../../library/stdtypes.rst:3890 -#: ../../library/stdtypes.rst:3959 +#: ../../library/stdtypes.rst:3797 ../../library/stdtypes.rst:3839 +#: ../../library/stdtypes.rst:3855 ../../library/stdtypes.rst:3905 +#: ../../library/stdtypes.rst:3974 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3790 +#: ../../library/stdtypes.rst:3805 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -5641,14 +5672,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3799 +#: ../../library/stdtypes.rst:3814 msgid "" "Return ``True`` if the sequence is ASCII titlecase and the sequence is not " "empty, ``False`` otherwise. See :meth:`bytes.title` for more details on the " "definition of \"titlecase\"." msgstr "" -#: ../../library/stdtypes.rst:3805 +#: ../../library/stdtypes.rst:3820 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -5660,14 +5691,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3814 +#: ../../library/stdtypes.rst:3829 msgid "" "Return ``True`` if there is at least one uppercase alphabetic ASCII " "character in the sequence and no lowercase ASCII characters, ``False`` " "otherwise." msgstr "" -#: ../../library/stdtypes.rst:3819 +#: ../../library/stdtypes.rst:3834 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -5679,13 +5710,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3832 +#: ../../library/stdtypes.rst:3847 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:3852 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -5693,7 +5724,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3857 +#: ../../library/stdtypes.rst:3872 msgid "" "Return a list of the lines in the binary sequence, breaking at ASCII line " "boundaries. This method uses the :term:`universal newlines` approach to " @@ -5701,7 +5732,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3864 +#: ../../library/stdtypes.rst:3879 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -5713,14 +5744,14 @@ msgstr "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: ../../library/stdtypes.rst:3869 +#: ../../library/stdtypes.rst:3884 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:3873 +#: ../../library/stdtypes.rst:3888 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -5732,13 +5763,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3882 +#: ../../library/stdtypes.rst:3897 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" -#: ../../library/stdtypes.rst:3887 +#: ../../library/stdtypes.rst:3902 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -5746,7 +5777,7 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3894 +#: ../../library/stdtypes.rst:3909 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -5754,14 +5785,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3908 +#: ../../library/stdtypes.rst:3923 msgid "" "Return a titlecased version of the binary sequence where words start with an " "uppercase ASCII character and the remaining characters are lowercase. " "Uncased byte values are left unmodified." msgstr "" -#: ../../library/stdtypes.rst:3914 +#: ../../library/stdtypes.rst:3929 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -5769,7 +5800,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3917 +#: ../../library/stdtypes.rst:3932 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -5777,7 +5808,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3927 +#: ../../library/stdtypes.rst:3942 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -5785,12 +5816,12 @@ msgstr "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:3930 +#: ../../library/stdtypes.rst:3945 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3932 +#: ../../library/stdtypes.rst:3947 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -5812,13 +5843,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:3951 +#: ../../library/stdtypes.rst:3966 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3956 +#: ../../library/stdtypes.rst:3971 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -5826,7 +5857,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:3972 +#: ../../library/stdtypes.rst:3987 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -5835,7 +5866,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3980 +#: ../../library/stdtypes.rst:3995 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5847,11 +5878,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:3994 +#: ../../library/stdtypes.rst:4009 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:4011 +#: ../../library/stdtypes.rst:4026 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -5859,7 +5890,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:4016 +#: ../../library/stdtypes.rst:4031 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -5869,7 +5900,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:4023 +#: ../../library/stdtypes.rst:4038 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -5877,7 +5908,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:4057 +#: ../../library/stdtypes.rst:4072 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the bytes object *must* include a parenthesised mapping key into " @@ -5885,77 +5916,77 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:4109 +#: ../../library/stdtypes.rst:4124 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:4146 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:4134 +#: ../../library/stdtypes.rst:4149 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:4134 +#: ../../library/stdtypes.rst:4149 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:4138 +#: ../../library/stdtypes.rst:4153 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4141 +#: ../../library/stdtypes.rst:4156 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:4144 +#: ../../library/stdtypes.rst:4159 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4144 +#: ../../library/stdtypes.rst:4159 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:4179 +#: ../../library/stdtypes.rst:4194 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4182 +#: ../../library/stdtypes.rst:4197 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4194 +#: ../../library/stdtypes.rst:4209 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:4201 +#: ../../library/stdtypes.rst:4216 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:4203 +#: ../../library/stdtypes.rst:4218 msgid "" ":class:`memoryview` objects allow Python code to access the internal data of " "an object that supports the :ref:`buffer protocol ` without " "copying." msgstr "" -#: ../../library/stdtypes.rst:4209 +#: ../../library/stdtypes.rst:4224 msgid "" "Create a :class:`memoryview` that references *object*. *object* must " "support the buffer protocol. Built-in objects that support the buffer " "protocol include :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/stdtypes.rst:4213 +#: ../../library/stdtypes.rst:4228 msgid "" "A :class:`memoryview` has the notion of an *element*, which is the atomic " "memory unit handled by the originating *object*. For many simple types such " @@ -5963,32 +5994,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:4218 +#: ../../library/stdtypes.rst:4233 msgid "" "``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which " "is the nested list representation of the view. If ``view.ndim = 1``, this is " "equal to the number of elements in the view." msgstr "" -#: ../../library/stdtypes.rst:4222 +#: ../../library/stdtypes.rst:4237 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:4225 +#: ../../library/stdtypes.rst:4240 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:4228 +#: ../../library/stdtypes.rst:4243 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:4231 +#: ../../library/stdtypes.rst:4246 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -6010,7 +6041,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:4241 +#: ../../library/stdtypes.rst:4256 msgid "" "If :class:`~memoryview.format` is one of the native format specifiers from " "the :mod:`struct` module, indexing with an integer or a tuple of integers is " @@ -6021,11 +6052,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:4250 +#: ../../library/stdtypes.rst:4265 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:4252 +#: ../../library/stdtypes.rst:4267 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -6047,13 +6078,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:4262 +#: ../../library/stdtypes.rst:4277 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:4265 +#: ../../library/stdtypes.rst:4280 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -6093,14 +6124,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:4283 +#: ../../library/stdtypes.rst:4298 msgid "" "One-dimensional memoryviews of :term:`hashable` (read-only) types with " "formats 'B', 'b' or 'c' are also hashable. The hash is defined as ``hash(m) " "== hash(m.tobytes())``::" msgstr "" -#: ../../library/stdtypes.rst:4287 +#: ../../library/stdtypes.rst:4302 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -6118,44 +6149,44 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:4295 +#: ../../library/stdtypes.rst:4310 msgid "" "One-dimensional memoryviews can now be sliced. One-dimensional memoryviews " "with formats 'B', 'b' or 'c' are now :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4299 +#: ../../library/stdtypes.rst:4314 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:4303 +#: ../../library/stdtypes.rst:4318 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:4306 +#: ../../library/stdtypes.rst:4321 msgid "memoryview is now a :term:`generic type`." msgstr "" -#: ../../library/stdtypes.rst:4309 +#: ../../library/stdtypes.rst:4324 msgid ":class:`memoryview` has several methods:" msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:4313 +#: ../../library/stdtypes.rst:4328 msgid "" "A memoryview and a :pep:`3118` exporter are equal if their shapes are " "equivalent and if all corresponding values are equal when the operands' " "respective format codes are interpreted using :mod:`struct` syntax." msgstr "" -#: ../../library/stdtypes.rst:4317 +#: ../../library/stdtypes.rst:4332 msgid "" "For the subset of :mod:`struct` format strings currently supported by :meth:" "`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" msgstr "" -#: ../../library/stdtypes.rst:4320 +#: ../../library/stdtypes.rst:4335 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -6189,14 +6220,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:4336 +#: ../../library/stdtypes.rst:4351 msgid "" "If either format string is not supported by the :mod:`struct` module, then " "the objects will always compare as unequal (even if the format strings and " "buffer contents are identical)::" msgstr "" -#: ../../library/stdtypes.rst:4340 +#: ../../library/stdtypes.rst:4355 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -6222,25 +6253,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:4352 +#: ../../library/stdtypes.rst:4367 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:4355 +#: ../../library/stdtypes.rst:4370 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:4361 +#: ../../library/stdtypes.rst:4376 msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" -#: ../../library/stdtypes.rst:4364 +#: ../../library/stdtypes.rst:4379 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -6254,7 +6285,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:4370 +#: ../../library/stdtypes.rst:4385 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -6262,7 +6293,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:4375 +#: ../../library/stdtypes.rst:4390 msgid "" "*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the " "original array is converted to C or Fortran order. For contiguous views, 'A' " @@ -6271,13 +6302,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:4385 +#: ../../library/stdtypes.rst:4400 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:4388 +#: ../../library/stdtypes.rst:4403 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -6287,18 +6318,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:4394 +#: ../../library/stdtypes.rst:4409 msgid "" "Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:4401 +#: ../../library/stdtypes.rst:4416 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:4403 +#: ../../library/stdtypes.rst:4418 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -6316,19 +6347,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:4411 +#: ../../library/stdtypes.rst:4426 msgid "" ":meth:`tolist` now supports all single character native formats in :mod:" "`struct` module syntax as well as multi-dimensional representations." msgstr "" -#: ../../library/stdtypes.rst:4418 +#: ../../library/stdtypes.rst:4433 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:4436 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -6354,7 +6385,7 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:4437 +#: ../../library/stdtypes.rst:4452 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " "objects take special actions when a view is held on them (for example, a :" @@ -6363,14 +6394,14 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:4443 +#: ../../library/stdtypes.rst:4458 msgid "" "After this method has been called, any further operation on the view raises " "a :class:`ValueError` (except :meth:`release` itself which can be called " "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:4447 +#: ../../library/stdtypes.rst:4462 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -6386,13 +6417,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4454 +#: ../../library/stdtypes.rst:4469 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4457 +#: ../../library/stdtypes.rst:4472 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -6412,7 +6443,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4471 +#: ../../library/stdtypes.rst:4486 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -6421,7 +6452,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4477 +#: ../../library/stdtypes.rst:4492 msgid "" "The destination format is restricted to a single element native format in :" "mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " @@ -6429,11 +6460,11 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4483 +#: ../../library/stdtypes.rst:4498 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4485 +#: ../../library/stdtypes.rst:4500 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -6477,11 +6508,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4506 +#: ../../library/stdtypes.rst:4521 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4508 +#: ../../library/stdtypes.rst:4523 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -6505,11 +6536,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4519 +#: ../../library/stdtypes.rst:4534 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4521 +#: ../../library/stdtypes.rst:4536 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -6559,11 +6590,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4545 +#: ../../library/stdtypes.rst:4560 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4547 +#: ../../library/stdtypes.rst:4562 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -6585,33 +6616,33 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4559 +#: ../../library/stdtypes.rst:4574 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4564 +#: ../../library/stdtypes.rst:4579 msgid "Count the number of occurrences of *value*." msgstr "計算 *value* 的出現次數" -#: ../../library/stdtypes.rst:4570 +#: ../../library/stdtypes.rst:4585 msgid "" "Return the index of the first occurrence of *value* (at or after index " "*start* and before index *stop*)." msgstr "" -#: ../../library/stdtypes.rst:4573 +#: ../../library/stdtypes.rst:4588 msgid "Raises a :exc:`ValueError` if *value* cannot be found." msgstr "在找不到 *value* 時引發 :exc:`ValueError`。" -#: ../../library/stdtypes.rst:4577 +#: ../../library/stdtypes.rst:4592 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:4596 msgid "The underlying object of the memoryview::" msgstr "memoryview 的底層物件: ::" -#: ../../library/stdtypes.rst:4583 +#: ../../library/stdtypes.rst:4598 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -6623,14 +6654,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4592 +#: ../../library/stdtypes.rst:4607 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" -#: ../../library/stdtypes.rst:4596 +#: ../../library/stdtypes.rst:4611 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -6662,11 +6693,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4611 +#: ../../library/stdtypes.rst:4626 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4613 +#: ../../library/stdtypes.rst:4628 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -6690,11 +6721,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4628 +#: ../../library/stdtypes.rst:4643 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4632 +#: ../../library/stdtypes.rst:4647 msgid "" "A string containing the format (in :mod:`struct` module style) for each " "element in the view. A memoryview can be created from exporters with " @@ -6702,17 +6733,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4637 +#: ../../library/stdtypes.rst:4652 msgid "" "format ``'B'`` is now handled according to the struct module syntax. This " "means that ``memoryview(b'abc')[0] == b'abc'[0] == 97``." msgstr "" -#: ../../library/stdtypes.rst:4643 +#: ../../library/stdtypes.rst:4658 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4645 +#: ../../library/stdtypes.rst:4660 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -6732,49 +6763,49 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4656 +#: ../../library/stdtypes.rst:4671 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4661 +#: ../../library/stdtypes.rst:4676 msgid "" "A tuple of integers the length of :attr:`ndim` giving the shape of the " "memory as an N-dimensional array." msgstr "" -#: ../../library/stdtypes.rst:4664 ../../library/stdtypes.rst:4672 +#: ../../library/stdtypes.rst:4679 ../../library/stdtypes.rst:4687 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4669 +#: ../../library/stdtypes.rst:4684 msgid "" "A tuple of integers the length of :attr:`ndim` giving the size in bytes to " "access each element for each dimension of the array." msgstr "" -#: ../../library/stdtypes.rst:4677 +#: ../../library/stdtypes.rst:4692 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4681 +#: ../../library/stdtypes.rst:4696 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4687 +#: ../../library/stdtypes.rst:4702 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4693 +#: ../../library/stdtypes.rst:4708 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4701 +#: ../../library/stdtypes.rst:4716 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4705 +#: ../../library/stdtypes.rst:4720 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -6784,7 +6815,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4712 +#: ../../library/stdtypes.rst:4727 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " @@ -6792,7 +6823,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4717 +#: ../../library/stdtypes.rst:4732 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -6804,18 +6835,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:4725 +#: ../../library/stdtypes.rst:4740 msgid "" "Non-empty sets (not frozensets) can be created by placing a comma-separated " "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" -#: ../../library/stdtypes.rst:4729 +#: ../../library/stdtypes.rst:4744 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4734 +#: ../../library/stdtypes.rst:4749 msgid "" "Return a new set or frozenset object whose elements are taken from " "*iterable*. The elements of a set must be :term:`hashable`. To represent " @@ -6823,92 +6854,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4740 +#: ../../library/stdtypes.rst:4755 msgid "Sets can be created by several means:" msgstr "集合可以以多種方式建立:" -#: ../../library/stdtypes.rst:4742 +#: ../../library/stdtypes.rst:4757 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4743 +#: ../../library/stdtypes.rst:4758 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4744 +#: ../../library/stdtypes.rst:4759 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4746 +#: ../../library/stdtypes.rst:4761 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4751 +#: ../../library/stdtypes.rst:4766 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4755 +#: ../../library/stdtypes.rst:4770 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4759 +#: ../../library/stdtypes.rst:4774 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4763 +#: ../../library/stdtypes.rst:4778 msgid "" "Return ``True`` if the set has no elements in common with *other*. Sets are " "disjoint if and only if their intersection is the empty set." msgstr "" -#: ../../library/stdtypes.rst:4769 +#: ../../library/stdtypes.rst:4784 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4773 +#: ../../library/stdtypes.rst:4788 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4779 +#: ../../library/stdtypes.rst:4794 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4783 +#: ../../library/stdtypes.rst:4798 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4789 +#: ../../library/stdtypes.rst:4804 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4794 +#: ../../library/stdtypes.rst:4809 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4799 +#: ../../library/stdtypes.rst:4814 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4804 +#: ../../library/stdtypes.rst:4819 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4808 +#: ../../library/stdtypes.rst:4823 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4811 +#: ../../library/stdtypes.rst:4826 msgid "" "Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" "meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" @@ -6918,7 +6949,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4818 +#: ../../library/stdtypes.rst:4833 msgid "" "Both :class:`set` and :class:`frozenset` support set to set comparisons. Two " "sets are equal if and only if every element of each set is contained in the " @@ -6928,14 +6959,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4825 +#: ../../library/stdtypes.rst:4840 msgid "" "Instances of :class:`set` are compared to instances of :class:`frozenset` " "based on their members. For example, ``set('abc') == frozenset('abc')`` " "returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``." msgstr "" -#: ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:4844 msgid "" "The subset and equality comparisons do not generalize to a total ordering " "function. For example, any two nonempty disjoint sets are not equal and are " @@ -6943,71 +6974,71 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4834 +#: ../../library/stdtypes.rst:4849 msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" -#: ../../library/stdtypes.rst:4837 +#: ../../library/stdtypes.rst:4852 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4839 +#: ../../library/stdtypes.rst:4854 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" -#: ../../library/stdtypes.rst:4843 +#: ../../library/stdtypes.rst:4858 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4849 +#: ../../library/stdtypes.rst:4864 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4854 +#: ../../library/stdtypes.rst:4869 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4859 +#: ../../library/stdtypes.rst:4874 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4864 +#: ../../library/stdtypes.rst:4879 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4868 +#: ../../library/stdtypes.rst:4883 msgid "Add element *elem* to the set." msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:4872 +#: ../../library/stdtypes.rst:4887 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4877 +#: ../../library/stdtypes.rst:4892 msgid "Remove element *elem* from the set if it is present." msgstr "如果 *elem* 存在於集合中則將其移除。" -#: ../../library/stdtypes.rst:4881 +#: ../../library/stdtypes.rst:4896 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4886 +#: ../../library/stdtypes.rst:4901 msgid "Remove all elements from the set." msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:4889 +#: ../../library/stdtypes.rst:4904 msgid "" "Note, the non-operator versions of the :meth:`update`, :meth:" "`intersection_update`, :meth:`difference_update`, and :meth:" @@ -7015,18 +7046,18 @@ msgid "" "argument." msgstr "" -#: ../../library/stdtypes.rst:4894 +#: ../../library/stdtypes.rst:4909 msgid "" "Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" "`remove`, and :meth:`discard` methods may be a set. To support searching " "for an equivalent frozenset, a temporary one is created from *elem*." msgstr "" -#: ../../library/stdtypes.rst:4903 +#: ../../library/stdtypes.rst:4918 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4913 +#: ../../library/stdtypes.rst:4928 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -7035,7 +7066,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:4919 +#: ../../library/stdtypes.rst:4934 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -7044,33 +7075,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4930 +#: ../../library/stdtypes.rst:4945 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4933 +#: ../../library/stdtypes.rst:4948 msgid "Dictionaries can be created by several means:" msgstr "字典可以用數種方式建立:" -#: ../../library/stdtypes.rst:4935 +#: ../../library/stdtypes.rst:4950 msgid "" "Use a comma-separated list of ``key: value`` pairs within braces: ``{'jack': " "4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4937 +#: ../../library/stdtypes.rst:4952 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4938 +#: ../../library/stdtypes.rst:4953 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4941 +#: ../../library/stdtypes.rst:4956 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it defines a ``keys()`` method, a " @@ -7083,7 +7114,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4951 +#: ../../library/stdtypes.rst:4966 msgid "" "If keyword arguments are given, the keyword arguments and their values are " "added to the dictionary created from the positional argument. If a key " @@ -7091,13 +7122,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4956 ../../library/stdtypes.rst:4974 +#: ../../library/stdtypes.rst:4971 ../../library/stdtypes.rst:4989 msgid "" "Providing keyword arguments as in the first example only works for keys that " "are valid Python identifiers. Otherwise, any valid keys can be used." msgstr "" -#: ../../library/stdtypes.rst:4959 +#: ../../library/stdtypes.rst:4974 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " @@ -7106,7 +7137,7 @@ msgid "" "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4965 +#: ../../library/stdtypes.rst:4980 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -7126,13 +7157,13 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:4977 +#: ../../library/stdtypes.rst:4992 msgid "" "Dictionaries preserve insertion order. Note that updating a key does not " "affect the order. Keys added after deletion are inserted at the end. ::" msgstr "" -#: ../../library/stdtypes.rst:4980 +#: ../../library/stdtypes.rst:4995 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7164,33 +7195,33 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:4995 +#: ../../library/stdtypes.rst:5010 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4999 +#: ../../library/stdtypes.rst:5014 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:5004 +#: ../../library/stdtypes.rst:5019 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5008 +#: ../../library/stdtypes.rst:5023 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5012 +#: ../../library/stdtypes.rst:5027 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:5017 +#: ../../library/stdtypes.rst:5032 msgid "" "If a subclass of dict defines a method :meth:`~object.__missing__` and *key* " "is not present, the ``d[key]`` operation calls that method with the key " @@ -7201,7 +7232,7 @@ msgid "" "__missing__` must be a method; it cannot be an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:5025 +#: ../../library/stdtypes.rst:5040 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -7225,51 +7256,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:5036 +#: ../../library/stdtypes.rst:5051 msgid "" "The example above shows part of the implementation of :class:`collections." "Counter`. A different :meth:`!__missing__` method is used by :class:" "`collections.defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:5058 msgid "Set ``d[key]`` to *value*." msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:5047 +#: ../../library/stdtypes.rst:5062 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "從 *d* 中移除 ``d[key]``。若 *key* 不在對映中則引發 :exc:`KeyError`。" -#: ../../library/stdtypes.rst:5052 +#: ../../library/stdtypes.rst:5067 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5071 msgid "Equivalent to ``not key in d``." msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5075 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5080 msgid "Remove all items from the dictionary." msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:5069 +#: ../../library/stdtypes.rst:5084 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5088 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:5075 +#: ../../library/stdtypes.rst:5090 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -7278,70 +7309,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:5083 +#: ../../library/stdtypes.rst:5098 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:5089 +#: ../../library/stdtypes.rst:5104 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5094 +#: ../../library/stdtypes.rst:5109 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:5100 +#: ../../library/stdtypes.rst:5115 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " "*default*. If *default* is not given and *key* is not in the dictionary, a :" "exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:5106 +#: ../../library/stdtypes.rst:5121 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -#: ../../library/stdtypes.rst:5109 +#: ../../library/stdtypes.rst:5124 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " "often used in set algorithms. If the dictionary is empty, calling :meth:" "`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:5113 +#: ../../library/stdtypes.rst:5128 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:5119 +#: ../../library/stdtypes.rst:5134 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5126 +#: ../../library/stdtypes.rst:5141 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" -#: ../../library/stdtypes.rst:5134 +#: ../../library/stdtypes.rst:5149 msgid "" "Update the dictionary with the key/value pairs from *mapping* or *iterable* " "and *kwargs*, overwriting existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:5137 +#: ../../library/stdtypes.rst:5152 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -7350,20 +7381,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:5145 +#: ../../library/stdtypes.rst:5160 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5148 +#: ../../library/stdtypes.rst:5163 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:5152 +#: ../../library/stdtypes.rst:5167 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -7373,25 +7404,25 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:5158 +#: ../../library/stdtypes.rst:5173 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:5166 +#: ../../library/stdtypes.rst:5181 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:5172 +#: ../../library/stdtypes.rst:5187 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:5174 +#: ../../library/stdtypes.rst:5189 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7413,21 +7444,21 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:5184 +#: ../../library/stdtypes.rst:5199 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5189 +#: ../../library/stdtypes.rst:5204 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:5196 +#: ../../library/stdtypes.rst:5211 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:5198 +#: ../../library/stdtypes.rst:5213 msgid "" "The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" "`dict.items` are *view objects*. They provide a dynamic view on the " @@ -7435,23 +7466,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:5203 +#: ../../library/stdtypes.rst:5218 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5223 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5212 +#: ../../library/stdtypes.rst:5227 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5215 +#: ../../library/stdtypes.rst:5230 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -7459,39 +7490,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:5220 +#: ../../library/stdtypes.rst:5235 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:5223 +#: ../../library/stdtypes.rst:5238 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:5228 +#: ../../library/stdtypes.rst:5243 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:5233 +#: ../../library/stdtypes.rst:5248 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:5236 +#: ../../library/stdtypes.rst:5251 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5241 +#: ../../library/stdtypes.rst:5256 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:5246 +#: ../../library/stdtypes.rst:5261 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -7505,11 +7536,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:5258 +#: ../../library/stdtypes.rst:5273 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:5260 +#: ../../library/stdtypes.rst:5275 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -7550,11 +7581,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:5302 +#: ../../library/stdtypes.rst:5317 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:5309 +#: ../../library/stdtypes.rst:5324 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -7565,7 +7596,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:5317 +#: ../../library/stdtypes.rst:5332 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -7576,7 +7607,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:5322 +#: ../../library/stdtypes.rst:5337 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -7585,7 +7616,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:5326 +#: ../../library/stdtypes.rst:5341 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -7599,7 +7630,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:5336 +#: ../../library/stdtypes.rst:5351 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -7611,7 +7642,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:5341 +#: ../../library/stdtypes.rst:5356 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -7626,7 +7657,7 @@ msgstr "" "(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" "的任何例外。" -#: ../../library/stdtypes.rst:5348 +#: ../../library/stdtypes.rst:5363 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -7638,7 +7669,7 @@ msgstr "" "已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" "`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:5354 +#: ../../library/stdtypes.rst:5369 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -7650,7 +7681,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:5360 +#: ../../library/stdtypes.rst:5375 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -7665,7 +7696,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:5367 +#: ../../library/stdtypes.rst:5382 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -7677,7 +7708,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:5375 +#: ../../library/stdtypes.rst:5390 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -7685,7 +7716,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:5380 +#: ../../library/stdtypes.rst:5395 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -7693,11 +7724,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:5387 +#: ../../library/stdtypes.rst:5402 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:5393 +#: ../../library/stdtypes.rst:5408 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -7713,7 +7744,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:5403 +#: ../../library/stdtypes.rst:5418 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -7721,7 +7752,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:5406 +#: ../../library/stdtypes.rst:5421 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -7729,7 +7760,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:5424 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " @@ -7741,7 +7772,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:5415 +#: ../../library/stdtypes.rst:5430 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -7753,7 +7784,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:5421 +#: ../../library/stdtypes.rst:5436 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -7765,7 +7796,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:5427 +#: ../../library/stdtypes.rst:5442 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " "``y`` will also be an instance of ``re.Match``, but the return values of ``y." @@ -7778,7 +7809,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:5433 +#: ../../library/stdtypes.rst:5448 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -7787,7 +7818,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:5439 +#: ../../library/stdtypes.rst:5454 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -7797,7 +7828,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:5444 +#: ../../library/stdtypes.rst:5459 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -7805,7 +7836,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:5447 +#: ../../library/stdtypes.rst:5462 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -7816,7 +7847,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:5452 +#: ../../library/stdtypes.rst:5467 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -7824,7 +7855,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:5455 +#: ../../library/stdtypes.rst:5470 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -7832,7 +7863,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:5458 +#: ../../library/stdtypes.rst:5473 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -7844,7 +7875,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5463 +#: ../../library/stdtypes.rst:5478 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7856,7 +7887,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:5469 +#: ../../library/stdtypes.rst:5484 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7866,13 +7897,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:5473 +#: ../../library/stdtypes.rst:5488 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5476 +#: ../../library/stdtypes.rst:5491 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7890,13 +7921,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5484 +#: ../../library/stdtypes.rst:5499 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5486 +#: ../../library/stdtypes.rst:5501 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7910,7 +7941,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5492 +#: ../../library/stdtypes.rst:5507 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -7918,7 +7949,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5495 +#: ../../library/stdtypes.rst:5510 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7930,7 +7961,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5500 +#: ../../library/stdtypes.rst:5515 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -7940,7 +7971,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5504 +#: ../../library/stdtypes.rst:5519 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7952,253 +7983,253 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5511 +#: ../../library/stdtypes.rst:5526 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5513 +#: ../../library/stdtypes.rst:5528 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5516 +#: ../../library/stdtypes.rst:5531 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5517 +#: ../../library/stdtypes.rst:5532 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5518 +#: ../../library/stdtypes.rst:5533 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5519 +#: ../../library/stdtypes.rst:5534 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5520 +#: ../../library/stdtypes.rst:5535 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5521 +#: ../../library/stdtypes.rst:5536 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5522 +#: ../../library/stdtypes.rst:5537 msgid ":class:`asyncio.Future`" msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5523 +#: ../../library/stdtypes.rst:5538 msgid ":class:`asyncio.Task`" msgstr ":class:`asyncio.Task`" -#: ../../library/stdtypes.rst:5524 +#: ../../library/stdtypes.rst:5539 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5525 +#: ../../library/stdtypes.rst:5540 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5526 +#: ../../library/stdtypes.rst:5541 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5527 +#: ../../library/stdtypes.rst:5542 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5528 +#: ../../library/stdtypes.rst:5543 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5529 +#: ../../library/stdtypes.rst:5544 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5530 +#: ../../library/stdtypes.rst:5545 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5531 +#: ../../library/stdtypes.rst:5546 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5532 +#: ../../library/stdtypes.rst:5547 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5533 +#: ../../library/stdtypes.rst:5548 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5534 +#: ../../library/stdtypes.rst:5549 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5535 +#: ../../library/stdtypes.rst:5550 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5536 +#: ../../library/stdtypes.rst:5551 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5537 +#: ../../library/stdtypes.rst:5552 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5538 +#: ../../library/stdtypes.rst:5553 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5539 +#: ../../library/stdtypes.rst:5554 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5540 +#: ../../library/stdtypes.rst:5555 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5541 +#: ../../library/stdtypes.rst:5556 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5542 +#: ../../library/stdtypes.rst:5557 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5543 +#: ../../library/stdtypes.rst:5558 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5544 +#: ../../library/stdtypes.rst:5559 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5545 +#: ../../library/stdtypes.rst:5560 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5546 +#: ../../library/stdtypes.rst:5561 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5547 +#: ../../library/stdtypes.rst:5562 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5548 +#: ../../library/stdtypes.rst:5563 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5549 +#: ../../library/stdtypes.rst:5564 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5550 +#: ../../library/stdtypes.rst:5565 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5551 +#: ../../library/stdtypes.rst:5566 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5552 +#: ../../library/stdtypes.rst:5567 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5553 +#: ../../library/stdtypes.rst:5568 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5554 +#: ../../library/stdtypes.rst:5569 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5555 +#: ../../library/stdtypes.rst:5570 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5556 +#: ../../library/stdtypes.rst:5571 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5557 +#: ../../library/stdtypes.rst:5572 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5558 +#: ../../library/stdtypes.rst:5573 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5559 +#: ../../library/stdtypes.rst:5574 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5560 +#: ../../library/stdtypes.rst:5575 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5561 +#: ../../library/stdtypes.rst:5576 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5562 +#: ../../library/stdtypes.rst:5577 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5563 +#: ../../library/stdtypes.rst:5578 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5564 +#: ../../library/stdtypes.rst:5579 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5565 +#: ../../library/stdtypes.rst:5580 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5566 +#: ../../library/stdtypes.rst:5581 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5567 +#: ../../library/stdtypes.rst:5582 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5568 +#: ../../library/stdtypes.rst:5583 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5569 +#: ../../library/stdtypes.rst:5584 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5570 +#: ../../library/stdtypes.rst:5585 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5571 +#: ../../library/stdtypes.rst:5586 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5576 +#: ../../library/stdtypes.rst:5591 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5578 +#: ../../library/stdtypes.rst:5593 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5582 +#: ../../library/stdtypes.rst:5597 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5584 +#: ../../library/stdtypes.rst:5599 msgid "" ">>> list[int].__origin__\n" "" @@ -8206,7 +8237,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5590 +#: ../../library/stdtypes.rst:5605 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " @@ -8215,7 +8246,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5594 +#: ../../library/stdtypes.rst:5609 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -8223,7 +8254,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5600 +#: ../../library/stdtypes.rst:5615 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -8231,7 +8262,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5603 +#: ../../library/stdtypes.rst:5618 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -8245,7 +8276,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5611 +#: ../../library/stdtypes.rst:5626 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -8255,7 +8286,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5618 +#: ../../library/stdtypes.rst:5633 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -8263,19 +8294,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5626 +#: ../../library/stdtypes.rst:5641 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5627 +#: ../../library/stdtypes.rst:5642 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5629 +#: ../../library/stdtypes.rst:5644 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5630 +#: ../../library/stdtypes.rst:5645 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -8284,7 +8315,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5634 +#: ../../library/stdtypes.rst:5649 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -8292,18 +8323,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:5635 +#: ../../library/stdtypes.rst:5650 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5644 +#: ../../library/stdtypes.rst:5659 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5650 +#: ../../library/stdtypes.rst:5665 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -8316,7 +8347,7 @@ msgstr "" "釋 (type annotation) `。與下標 :data:`typing.Union` 相比,聯合型" "別運算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5657 +#: ../../library/stdtypes.rst:5672 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " @@ -8327,7 +8358,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5662 +#: ../../library/stdtypes.rst:5677 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -8335,7 +8366,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5667 +#: ../../library/stdtypes.rst:5682 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -8348,40 +8379,40 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5675 +#: ../../library/stdtypes.rst:5690 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5677 +#: ../../library/stdtypes.rst:5692 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5679 +#: ../../library/stdtypes.rst:5694 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5681 +#: ../../library/stdtypes.rst:5696 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5683 +#: ../../library/stdtypes.rst:5698 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5685 +#: ../../library/stdtypes.rst:5700 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5687 +#: ../../library/stdtypes.rst:5702 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5689 +#: ../../library/stdtypes.rst:5704 msgid "It creates instances of :class:`typing.Union`::" msgstr "它會建立 :class:`types.UnionType` 的實例: ::" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5706 msgid "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" @@ -8389,21 +8420,21 @@ msgstr "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" -#: ../../library/stdtypes.rst:5694 +#: ../../library/stdtypes.rst:5709 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5696 +#: ../../library/stdtypes.rst:5711 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5701 +#: ../../library/stdtypes.rst:5716 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5704 +#: ../../library/stdtypes.rst:5719 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -8411,14 +8442,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5707 +#: ../../library/stdtypes.rst:5722 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5710 +#: ../../library/stdtypes.rst:5725 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -8428,7 +8459,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5717 +#: ../../library/stdtypes.rst:5732 msgid "" "The user-exposed type for the union object can be accessed from :class:" "`typing.Union` and used for :func:`isinstance` checks::" @@ -8436,7 +8467,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." "UnionType` 存取並用於 :func:`isinstance` 檢查: ::" -#: ../../library/stdtypes.rst:5720 +#: ../../library/stdtypes.rst:5735 msgid "" ">>> import typing\n" ">>> isinstance(int | str, typing.Union)\n" @@ -8454,7 +8485,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'typing.Union' instances" -#: ../../library/stdtypes.rst:5729 +#: ../../library/stdtypes.rst:5744 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -8463,7 +8494,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5733 +#: ../../library/stdtypes.rst:5748 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -8489,32 +8520,32 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5749 +#: ../../library/stdtypes.rst:5764 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5755 +#: ../../library/stdtypes.rst:5770 msgid "" "Union objects are now instances of :class:`typing.Union`. Previously, they " "were instances of :class:`types.UnionType`, which remains an alias for :" "class:`typing.Union`." msgstr "" -#: ../../library/stdtypes.rst:5762 +#: ../../library/stdtypes.rst:5777 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:5764 +#: ../../library/stdtypes.rst:5779 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5771 +#: ../../library/stdtypes.rst:5786 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5773 +#: ../../library/stdtypes.rst:5788 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " @@ -8525,7 +8556,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5780 +#: ../../library/stdtypes.rst:5795 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -8536,32 +8567,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5788 +#: ../../library/stdtypes.rst:5803 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5796 +#: ../../library/stdtypes.rst:5811 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:5798 +#: ../../library/stdtypes.rst:5813 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:5804 +#: ../../library/stdtypes.rst:5819 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5806 +#: ../../library/stdtypes.rst:5821 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5809 +#: ../../library/stdtypes.rst:5824 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -8569,15 +8600,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5813 +#: ../../library/stdtypes.rst:5828 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5819 +#: ../../library/stdtypes.rst:5834 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:5823 +#: ../../library/stdtypes.rst:5838 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -8585,7 +8616,7 @@ msgid "" "methods>`. Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5829 +#: ../../library/stdtypes.rst:5844 msgid "" "If you access a method (a function defined in a class namespace) through an " "instance, you get a special object: a :dfn:`bound method` (also called :ref:" @@ -8598,7 +8629,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5840 +#: ../../library/stdtypes.rst:5855 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -8609,7 +8640,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5848 +#: ../../library/stdtypes.rst:5863 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -8637,15 +8668,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5863 +#: ../../library/stdtypes.rst:5878 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5871 +#: ../../library/stdtypes.rst:5886 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5877 +#: ../../library/stdtypes.rst:5892 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -8655,7 +8686,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5884 +#: ../../library/stdtypes.rst:5899 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -8664,21 +8695,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5891 +#: ../../library/stdtypes.rst:5906 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5894 +#: ../../library/stdtypes.rst:5909 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5900 +#: ../../library/stdtypes.rst:5915 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5906 +#: ../../library/stdtypes.rst:5921 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -8686,94 +8717,94 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5911 +#: ../../library/stdtypes.rst:5926 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5917 +#: ../../library/stdtypes.rst:5932 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5919 +#: ../../library/stdtypes.rst:5934 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5923 +#: ../../library/stdtypes.rst:5938 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5930 +#: ../../library/stdtypes.rst:5945 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:5932 +#: ../../library/stdtypes.rst:5947 msgid "" -"This object is commonly used used to indicate that something is omitted. It " +"This object is commonly used to indicate that something is omitted. It " "supports no special operations. There is exactly one ellipsis object, " "named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces " "the :const:`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5937 +#: ../../library/stdtypes.rst:5952 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5939 +#: ../../library/stdtypes.rst:5954 msgid "" "In typical use, ``...`` as the ``Ellipsis`` object appears in a few " "different places, for instance:" msgstr "" -#: ../../library/stdtypes.rst:5942 +#: ../../library/stdtypes.rst:5957 msgid "" "In type annotations, such as :ref:`callable arguments ` or :ref:`tuple elements `." msgstr "" -#: ../../library/stdtypes.rst:5945 +#: ../../library/stdtypes.rst:5960 msgid "" "As the body of a function instead of a :ref:`pass statement `." msgstr "" -#: ../../library/stdtypes.rst:5947 +#: ../../library/stdtypes.rst:5962 msgid "" "In third-party libraries, such as `Numpy's slicing and striding `_." msgstr "" -#: ../../library/stdtypes.rst:5950 +#: ../../library/stdtypes.rst:5965 msgid "" "Python also uses three dots in ways that are not ``Ellipsis`` objects, for " "instance:" msgstr "" -#: ../../library/stdtypes.rst:5952 +#: ../../library/stdtypes.rst:5967 msgid "" "Doctest's :const:`ELLIPSIS `, as a pattern for missing " "content." msgstr "" -#: ../../library/stdtypes.rst:5954 +#: ../../library/stdtypes.rst:5969 msgid "" "The default Python prompt of the :term:`interactive` shell when partial " "input is incomplete." msgstr "" -#: ../../library/stdtypes.rst:5956 +#: ../../library/stdtypes.rst:5971 msgid "" "Lastly, the Python documentation often uses three dots in conventional " "English usage to mean omitted content, even in code examples that also use " "them as the ``Ellipsis``." msgstr "" -#: ../../library/stdtypes.rst:5964 +#: ../../library/stdtypes.rst:5979 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5966 +#: ../../library/stdtypes.rst:5981 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " @@ -8781,64 +8812,64 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5971 +#: ../../library/stdtypes.rst:5986 msgid "It is written as :code:`NotImplemented`." msgstr "它被寫為 :code:`NotImplemented`。" -#: ../../library/stdtypes.rst:5977 +#: ../../library/stdtypes.rst:5992 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:5979 +#: ../../library/stdtypes.rst:5994 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5987 +#: ../../library/stdtypes.rst:6002 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5989 +#: ../../library/stdtypes.rst:6004 msgid "" "The implementation adds a few special read-only attributes to several object " "types, where they are relevant. Some of these are not reported by the :func:" "`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5996 +#: ../../library/stdtypes.rst:6011 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:6002 +#: ../../library/stdtypes.rst:6017 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:6010 +#: ../../library/stdtypes.rst:6025 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:6015 +#: ../../library/stdtypes.rst:6030 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:6020 +#: ../../library/stdtypes.rst:6035 msgid "" "The :ref:`type parameters ` of generic classes, functions, and :" "ref:`type aliases `. For classes and functions that are not " "generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:6030 +#: ../../library/stdtypes.rst:6045 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:6032 +#: ../../library/stdtypes.rst:6047 msgid "" "CPython has a global limit for converting between :class:`int` and :class:" "`str` to mitigate denial of service attacks. This limit *only* applies to " @@ -8846,7 +8877,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:6037 +#: ../../library/stdtypes.rst:6052 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -8856,24 +8887,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:6044 +#: ../../library/stdtypes.rst:6059 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:6046 +#: ../../library/stdtypes.rst:6061 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:6050 +#: ../../library/stdtypes.rst:6065 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:6052 +#: ../../library/stdtypes.rst:6067 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8897,7 +8928,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:6072 +#: ../../library/stdtypes.rst:6087 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -8905,11 +8936,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:6077 +#: ../../library/stdtypes.rst:6092 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:6079 +#: ../../library/stdtypes.rst:6094 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8927,84 +8958,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:6092 +#: ../../library/stdtypes.rst:6107 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:6094 +#: ../../library/stdtypes.rst:6109 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:6097 +#: ../../library/stdtypes.rst:6112 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:6098 +#: ../../library/stdtypes.rst:6113 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:6099 +#: ../../library/stdtypes.rst:6114 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:6100 +#: ../../library/stdtypes.rst:6115 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:6101 +#: ../../library/stdtypes.rst:6116 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:6104 +#: ../../library/stdtypes.rst:6119 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:6106 +#: ../../library/stdtypes.rst:6121 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:6107 +#: ../../library/stdtypes.rst:6122 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:6108 +#: ../../library/stdtypes.rst:6123 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:6109 +#: ../../library/stdtypes.rst:6124 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:6110 +#: ../../library/stdtypes.rst:6125 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:6111 +#: ../../library/stdtypes.rst:6126 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:6114 +#: ../../library/stdtypes.rst:6129 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:6116 +#: ../../library/stdtypes.rst:6131 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:6119 +#: ../../library/stdtypes.rst:6134 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:6122 +#: ../../library/stdtypes.rst:6137 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -9012,7 +9043,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:6124 +#: ../../library/stdtypes.rst:6139 msgid "" ":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" "`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " @@ -9021,38 +9052,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:6130 +#: ../../library/stdtypes.rst:6145 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:6133 +#: ../../library/stdtypes.rst:6148 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:6137 +#: ../../library/stdtypes.rst:6152 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:6139 +#: ../../library/stdtypes.rst:6154 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:6141 +#: ../../library/stdtypes.rst:6156 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:6148 +#: ../../library/stdtypes.rst:6163 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -9064,7 +9095,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:6157 +#: ../../library/stdtypes.rst:6172 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -9072,11 +9103,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:6163 +#: ../../library/stdtypes.rst:6178 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:6165 +#: ../../library/stdtypes.rst:6180 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -9084,11 +9115,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:6170 +#: ../../library/stdtypes.rst:6185 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:6172 +#: ../../library/stdtypes.rst:6187 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -9110,38 +9141,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:6182 +#: ../../library/stdtypes.rst:6197 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:6186 +#: ../../library/stdtypes.rst:6201 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:6187 +#: ../../library/stdtypes.rst:6202 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:6190 +#: ../../library/stdtypes.rst:6205 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:6193 +#: ../../library/stdtypes.rst:6208 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:6195 +#: ../../library/stdtypes.rst:6210 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:6198 +#: ../../library/stdtypes.rst:6213 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -9154,13 +9185,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:322 #: ../../library/stdtypes.rst:399 ../../library/stdtypes.rst:992 #: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:1201 -#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4905 -#: ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4920 +#: ../../library/stdtypes.rst:5917 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:4920 msgid "statement" msgstr "statement(陳述式)" @@ -9282,11 +9313,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:1366 #: ../../library/stdtypes.rst:1445 ../../library/stdtypes.rst:1489 #: ../../library/stdtypes.rst:1610 ../../library/stdtypes.rst:1740 -#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:2954 -#: ../../library/stdtypes.rst:3067 ../../library/stdtypes.rst:4703 -#: ../../library/stdtypes.rst:4905 ../../library/stdtypes.rst:5389 -#: ../../library/stdtypes.rst:5646 ../../library/stdtypes.rst:5821 -#: ../../library/stdtypes.rst:5866 +#: ../../library/stdtypes.rst:2950 ../../library/stdtypes.rst:2969 +#: ../../library/stdtypes.rst:3082 ../../library/stdtypes.rst:4718 +#: ../../library/stdtypes.rst:4920 ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:5661 ../../library/stdtypes.rst:5836 +#: ../../library/stdtypes.rst:5881 msgid "object" msgstr "object(物件)" @@ -9378,9 +9409,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:992 -#: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:4905 -#: ../../library/stdtypes.rst:5873 ../../library/stdtypes.rst:5887 -#: ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:4920 +#: ../../library/stdtypes.rst:5888 ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:5917 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -9396,8 +9427,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2811 -#: ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2826 +#: ../../library/stdtypes.rst:4086 msgid "+ (plus)" msgstr "+ (加號)" @@ -9409,13 +9440,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2811 -#: ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2826 +#: ../../library/stdtypes.rst:4086 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2768 -#: ../../library/stdtypes.rst:4028 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2783 +#: ../../library/stdtypes.rst:4043 msgid "* (asterisk)" msgstr "* (星號)" @@ -9427,8 +9458,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2731 -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2746 +#: ../../library/stdtypes.rst:4011 msgid "% (percent)" msgstr "% (百分號)" @@ -9438,7 +9469,7 @@ msgstr "**" #: ../../library/stdtypes.rst:322 ../../library/stdtypes.rst:399 #: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:4920 msgid "operations on" msgstr "operations on(操作於)" @@ -9447,7 +9478,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:341 ../../library/stdtypes.rst:1808 -#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:2950 ../../library/stdtypes.rst:5917 msgid "module" msgstr "模組" @@ -9515,7 +9546,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:889 ../../library/stdtypes.rst:5304 +#: ../../library/stdtypes.rst:889 ../../library/stdtypes.rst:5319 msgid "protocol" msgstr "protocol(協定)" @@ -9541,7 +9572,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:4920 msgid "len" msgstr "len" @@ -9610,14 +9641,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:2935 -#: ../../library/stdtypes.rst:3067 ../../library/stdtypes.rst:3177 -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:2950 +#: ../../library/stdtypes.rst:3082 ../../library/stdtypes.rst:3192 +#: ../../library/stdtypes.rst:4011 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4905 -#: ../../library/stdtypes.rst:5646 ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4920 +#: ../../library/stdtypes.rst:5661 ../../library/stdtypes.rst:5917 msgid "type" msgstr "type(型別)" @@ -9625,7 +9656,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4920 msgid "del" msgstr "del" @@ -9634,8 +9665,8 @@ msgid "range" msgstr "range" #: ../../library/stdtypes.rst:1610 ../../library/stdtypes.rst:1753 -#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:2585 -#: ../../library/stdtypes.rst:2731 +#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:2600 +#: ../../library/stdtypes.rst:2746 msgid "string" msgstr "string(字串)" @@ -9656,17 +9687,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2927 +#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2942 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2935 -#: ../../library/stdtypes.rst:2954 ../../library/stdtypes.rst:3177 -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2950 +#: ../../library/stdtypes.rst:2969 ../../library/stdtypes.rst:3192 +#: ../../library/stdtypes.rst:4011 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:3177 +#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:3192 msgid "methods" msgstr "methods(方法)" @@ -9674,239 +9705,239 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2399 ../../library/stdtypes.rst:3850 +#: ../../library/stdtypes.rst:2412 ../../library/stdtypes.rst:3865 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2399 +#: ../../library/stdtypes.rst:2412 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "! formatted string literal" msgstr "! formatted string literals(! 格式化字串常數)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "formatted string literals" msgstr "formatted string literals(格式化字串常數)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "! f-string" msgstr "! f-string(! f 字串)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "! (exclamation mark)" msgstr "! (驚嘆號)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "= (equals)" msgstr "= (等號)" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2600 msgid "for help in debugging using string literals" msgstr "" -#: ../../library/stdtypes.rst:2731 +#: ../../library/stdtypes.rst:2746 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2731 +#: ../../library/stdtypes.rst:2746 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2731 +#: ../../library/stdtypes.rst:2746 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2731 +#: ../../library/stdtypes.rst:2746 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2731 ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:2746 ../../library/stdtypes.rst:4011 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2731 ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:2746 ../../library/stdtypes.rst:4011 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2768 ../../library/stdtypes.rst:4028 +#: ../../library/stdtypes.rst:2783 ../../library/stdtypes.rst:4043 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2768 ../../library/stdtypes.rst:2811 -#: ../../library/stdtypes.rst:4028 ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:2783 ../../library/stdtypes.rst:2826 +#: ../../library/stdtypes.rst:4043 ../../library/stdtypes.rst:4086 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2768 ../../library/stdtypes.rst:4028 +#: ../../library/stdtypes.rst:2783 ../../library/stdtypes.rst:4043 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2811 ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:2826 ../../library/stdtypes.rst:4086 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2811 ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:2826 ../../library/stdtypes.rst:4086 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2927 +#: ../../library/stdtypes.rst:2942 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2935 +#: ../../library/stdtypes.rst:2950 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2935 +#: ../../library/stdtypes.rst:2950 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3850 +#: ../../library/stdtypes.rst:3865 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3850 +#: ../../library/stdtypes.rst:3865 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:4011 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:4011 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:4011 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:3996 +#: ../../library/stdtypes.rst:4011 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4703 +#: ../../library/stdtypes.rst:4718 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:4920 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:4920 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:5015 +#: ../../library/stdtypes.rst:5030 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:5304 +#: ../../library/stdtypes.rst:5319 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:5304 +#: ../../library/stdtypes.rst:5319 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:5304 +#: ../../library/stdtypes.rst:5319 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:5377 +#: ../../library/stdtypes.rst:5392 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:5377 +#: ../../library/stdtypes.rst:5392 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:5389 +#: ../../library/stdtypes.rst:5404 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:5389 +#: ../../library/stdtypes.rst:5404 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:5389 +#: ../../library/stdtypes.rst:5404 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5646 +#: ../../library/stdtypes.rst:5661 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5646 +#: ../../library/stdtypes.rst:5661 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5821 +#: ../../library/stdtypes.rst:5836 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5866 +#: ../../library/stdtypes.rst:5881 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5866 +#: ../../library/stdtypes.rst:5881 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5873 +#: ../../library/stdtypes.rst:5888 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5873 +#: ../../library/stdtypes.rst:5888 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5887 +#: ../../library/stdtypes.rst:5902 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5887 +#: ../../library/stdtypes.rst:5902 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5926 +#: ../../library/stdtypes.rst:5941 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5926 +#: ../../library/stdtypes.rst:5941 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號字面值)" diff --git a/library/string.po b/library/string.po index b4e0ea7563d..22619bfacd9 100644 --- a/library/string.po +++ b/library/string.po @@ -1032,6 +1032,12 @@ msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(**coord)\n" "'Coordinates: 37.24N, -115.81W'" msgstr "" +">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " +"longitude='-115.81W')\n" +"'Coordinates: 37.24N, -115.81W'\n" +">>> coord = {'latitude': '37.24N', 'longitude': '-115.81W'}\n" +">>> 'Coordinates: {latitude}, {longitude}'.format(**coord)\n" +"'Coordinates: 37.24N, -115.81W'" #: ../../library/string.rst:678 msgid "Accessing arguments' attributes::" diff --git a/library/string.templatelib.po b/library/string.templatelib.po index 6986f76fb45..372d2f85784 100644 --- a/library/string.templatelib.po +++ b/library/string.templatelib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-06 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -26,7 +26,7 @@ msgstr "**原始碼:**\\ :source:`Lib/string/templatelib.py`" #: ../../library/string.templatelib.rst:13 msgid ":ref:`Format strings `" -msgstr "" +msgstr ":ref:`格式字串 `" #: ../../library/string.templatelib.rst:14 msgid ":ref:`Template string literal (t-string) syntax `" @@ -43,9 +43,9 @@ msgstr "模板字串" #: ../../library/string.templatelib.rst:24 msgid "" "Template strings are a mechanism for custom string processing. They have the " -"full flexibility of Python's :ref:`f-strings`, but return " -"a :class:`Template` instance that gives access to the static and " -"interpolated (in curly braces) parts of a string *before* they are combined." +"full flexibility of Python's :ref:`f-strings`, but return a :class:" +"`Template` instance that gives access to the static and interpolated (in " +"curly brackets) parts of a string *before* they are combined." msgstr "" #: ../../library/string.templatelib.rst:30 @@ -81,10 +81,10 @@ msgstr "" #: ../../library/string.templatelib.rst:49 msgid "" -"The most common way to create a :class:`!Template` instance is to use " -"the :ref:`template string literal syntax `. This syntax is " -"identical to that of :ref:`f-strings `, except that it uses a " -"``t`` prefix in place of an ``f``:" +"The most common way to create a :class:`!Template` instance is to use the :" +"ref:`template string literal syntax `. This syntax is identical " +"to that of :ref:`f-strings `, except that it uses a ``t`` prefix " +"in place of an ``f``:" msgstr "" #: ../../library/string.templatelib.rst:59 @@ -145,12 +145,12 @@ msgstr "" #: ../../library/string.templatelib.rst:139 msgid "" "The ``values`` tuple always has the same length as the ``interpolations`` " -"tuple. It is always equivalent to ``tuple(i.value for i in " -"template.interpolations)``." +"tuple. It is always equivalent to ``tuple(i.value for i in template." +"interpolations)``." msgstr "" #: ../../library/string.templatelib.rst:144 -#: ../../library/string.templatelib.rst:314 +#: ../../library/string.templatelib.rst:317 msgid "Methods" msgstr "方法" @@ -177,8 +177,8 @@ msgstr "" #: ../../library/string.templatelib.rst:182 msgid "" -"Iterate over the template, yielding each non-empty string " -"and :class:`Interpolation` in the correct order:" +"Iterate over the template, yielding each non-empty string and :class:" +"`Interpolation` in the correct order:" msgstr "" #: ../../library/string.templatelib.rst:191 @@ -219,28 +219,32 @@ msgid "The evaluated value of the interpolation." msgstr "" #: ../../library/string.templatelib.rst:261 -#: ../../library/string.templatelib.rst:323 -msgid "The text of a valid Python expression, or an empty string." +msgid "" +"For interpolations created by t-string literals, :attr:`!expression` is the " +"expression text found inside the curly brackets (``{`` & ``}``), including " +"any whitespace, excluding the curly brackets themselves, and ending before " +"the first ``!``, ``:``, or ``=`` if any is present. For manually created " +"interpolations, :attr:`!expression` is the arbitrary string provided when " +"constructing the interpolation instance." msgstr "" -#: ../../library/string.templatelib.rst:263 +#: ../../library/string.templatelib.rst:268 msgid "" -"The :attr:`.expression` is the original text of the interpolation's Python " -"expression, if the interpolation was created from a t-string literal. " -"Developers creating interpolations manually should either set this to an " -"empty string or choose a suitable valid Python expression." +"We recommend using valid Python expressions or the empty string for the " +"``expression`` field of manually created :class:`!Interpolation` instances, " +"although this is not enforced at runtime." msgstr "" -#: ../../library/string.templatelib.rst:275 +#: ../../library/string.templatelib.rst:278 msgid "The conversion to apply to the value, or ``None``." msgstr "" -#: ../../library/string.templatelib.rst:277 +#: ../../library/string.templatelib.rst:280 msgid "" "The :attr:`!conversion` is the optional conversion to apply to the value:" msgstr "" -#: ../../library/string.templatelib.rst:285 +#: ../../library/string.templatelib.rst:288 msgid "" "Unlike f-strings, where conversions are applied automatically, the expected " "behavior with t-strings is that code that *processes* the :class:`!Template` " @@ -249,17 +253,17 @@ msgid "" "conversion semantics." msgstr "" -#: ../../library/string.templatelib.rst:295 +#: ../../library/string.templatelib.rst:298 msgid "The format specification to apply to the value." msgstr "" -#: ../../library/string.templatelib.rst:297 +#: ../../library/string.templatelib.rst:300 msgid "" "The :attr:`!format_spec` is an optional, arbitrary string used as the format " "specification to present the value:" msgstr "" -#: ../../library/string.templatelib.rst:305 +#: ../../library/string.templatelib.rst:308 msgid "" "Unlike f-strings, where format specifications are applied automatically via " "the :func:`format` protocol, the expected behavior with t-strings is that " @@ -269,7 +273,7 @@ msgid "" "not conform to the :func:`format` protocol." msgstr "" -#: ../../library/string.templatelib.rst:320 +#: ../../library/string.templatelib.rst:323 msgid "Create a new :class:`!Interpolation` object from component parts." msgstr "" @@ -277,49 +281,53 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/string.templatelib.rst:322 +#: ../../library/string.templatelib.rst:325 msgid "The evaluated, in-scope result of the interpolation." msgstr "" -#: ../../library/string.templatelib.rst:325 +#: ../../library/string.templatelib.rst:326 +msgid "The text of a valid Python expression, or an empty string." +msgstr "" + +#: ../../library/string.templatelib.rst:328 msgid "" "The :ref:`conversion ` to be used, one of ``None``, ``'a'``, " "``'r'``, or ``'s'``." msgstr "" -#: ../../library/string.templatelib.rst:327 +#: ../../library/string.templatelib.rst:330 msgid "" "An optional, arbitrary string used as the :ref:`format specification " "` to present the value." msgstr "" -#: ../../library/string.templatelib.rst:332 +#: ../../library/string.templatelib.rst:335 msgid "Helper functions" msgstr "" -#: ../../library/string.templatelib.rst:336 +#: ../../library/string.templatelib.rst:339 msgid "" "Applies formatted string literal :ref:`conversion ` semantics to the given object *obj*. This is frequently useful " "for custom template string processing logic." msgstr "" -#: ../../library/string.templatelib.rst:340 +#: ../../library/string.templatelib.rst:343 msgid "Three conversion flags are currently supported:" msgstr "" -#: ../../library/string.templatelib.rst:342 +#: ../../library/string.templatelib.rst:345 msgid "``'s'`` which calls :func:`str` on the value (like ``!s``)," msgstr "" -#: ../../library/string.templatelib.rst:343 +#: ../../library/string.templatelib.rst:346 msgid "``'r'`` which calls :func:`repr` (like ``!r``), and" msgstr "" -#: ../../library/string.templatelib.rst:344 +#: ../../library/string.templatelib.rst:347 msgid "``'a'`` which calls :func:`ascii` (like ``!a``)." msgstr "" -#: ../../library/string.templatelib.rst:346 +#: ../../library/string.templatelib.rst:349 msgid "If the conversion flag is ``None``, *obj* is returned unchanged." msgstr "" diff --git a/library/subprocess.po b/library/subprocess.po index 31035462266..68ed5a8c6d9 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-09 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -99,20 +99,19 @@ msgid "" "the internal :class:`Popen` object is automatically created with *stdout* " "and *stderr* both set to :data:`~subprocess.PIPE`. The *stdout* and *stderr* " "arguments may not be supplied at the same time as *capture_output*. If you " -"wish to capture and combine both streams into one, set *stdout* " -"to :data:`~subprocess.PIPE` and *stderr* to :data:`~subprocess.STDOUT`, " -"instead of using *capture_output*." +"wish to capture and combine both streams into one, set *stdout* to :data:" +"`~subprocess.PIPE` and *stderr* to :data:`~subprocess.STDOUT`, instead of " +"using *capture_output*." msgstr "" #: ../../library/subprocess.rst:62 msgid "" -"A *timeout* may be specified in seconds, it is internally passed on " -"to :meth:`Popen.communicate`. If the timeout expires, the child process will " -"be killed and waited for. The :exc:`TimeoutExpired` exception will be re-" -"raised after the child process has terminated. The initial process creation " -"itself cannot be interrupted on many platform APIs so you are not guaranteed " -"to see a timeout exception until at least after however long process " -"creation takes." +"A *timeout* may be specified in seconds, it is internally passed on to :meth:" +"`Popen.communicate`. If the timeout expires, the child process will be " +"killed and waited for. The :exc:`TimeoutExpired` exception will be re-raised " +"after the child process has terminated. The initial process creation itself " +"cannot be interrupted on many platform APIs so you are not guaranteed to see " +"a timeout exception until at least after however long process creation takes." msgstr "" #: ../../library/subprocess.rst:70 @@ -120,17 +119,16 @@ msgid "" "The *input* argument is passed to :meth:`Popen.communicate` and thus to the " "subprocess's stdin. If used it must be a byte sequence, or a string if " "*encoding* or *errors* is specified or *text* is true. When used, the " -"internal :class:`Popen` object is automatically created with *stdin* set " -"to :data:`~subprocess.PIPE`, and the *stdin* argument may not be used as " -"well." +"internal :class:`Popen` object is automatically created with *stdin* set to :" +"data:`~subprocess.PIPE`, and the *stdin* argument may not be used as well." msgstr "" #: ../../library/subprocess.rst:77 msgid "" -"If *check* is true, and the process exits with a non-zero exit code, " -"a :exc:`CalledProcessError` exception will be raised. Attributes of that " -"exception hold the arguments, the exit code, and stdout and stderr if they " -"were captured." +"If *check* is true, and the process exits with a non-zero exit code, a :exc:" +"`CalledProcessError` exception will be raised. Attributes of that exception " +"hold the arguments, the exit code, and stdout and stderr if they were " +"captured." msgstr "" #: ../../library/subprocess.rst:82 @@ -148,8 +146,8 @@ msgid "" "variables for the new process; these are used instead of the default " "behavior of inheriting the current process' environment. It is passed " "directly to :class:`Popen`. This mapping can be str to str on any platform " -"or bytes to bytes on POSIX platforms much like :data:`os.environ` " -"or :data:`os.environb`." +"or bytes to bytes on POSIX platforms much like :data:`os.environ` or :data:" +"`os.environb`." msgstr "" #: ../../library/subprocess.rst:95 @@ -200,8 +198,8 @@ msgstr "" msgid "" "Changed Windows shell search order for ``shell=True``. The current directory " "and ``%PATH%`` are replaced with ``%COMSPEC%`` and ``%SystemRoot%" -"\\System32\\cmd.exe``. As a result, dropping a malicious program named " -"``cmd.exe`` into a current directory no longer works." +"\\System32\\cmd.exe``. As a result, dropping a malicious program named ``cmd." +"exe`` into a current directory no longer works." msgstr "" #: ../../library/subprocess.rst:130 @@ -228,9 +226,9 @@ msgstr "" #: ../../library/subprocess.rst:146 msgid "" -"Captured stdout from the child process. A bytes sequence, or a string " -"if :func:`run` was called with an encoding, errors, or text=True. ``None`` " -"if stdout was not captured." +"Captured stdout from the child process. A bytes sequence, or a string if :" +"func:`run` was called with an encoding, errors, or text=True. ``None`` if " +"stdout was not captured." msgstr "" #: ../../library/subprocess.rst:150 @@ -241,9 +239,9 @@ msgstr "" #: ../../library/subprocess.rst:156 msgid "" -"Captured stderr from the child process. A bytes sequence, or a string " -"if :func:`run` was called with an encoding, errors, or text=True. ``None`` " -"if stderr was not captured." +"Captured stderr from the child process. A bytes sequence, or a string if :" +"func:`run` was called with an encoding, errors, or text=True. ``None`` if " +"stderr was not captured." msgstr "" #: ../../library/subprocess.rst:162 @@ -291,11 +289,10 @@ msgstr "" #: ../../library/subprocess.rst:211 msgid "" -"Output of the child process if it was captured by :func:`run` " -"or :func:`check_output`. Otherwise, ``None``. This is " -"always :class:`bytes` when any output was captured regardless of the " -"``text=True`` setting. It may remain ``None`` instead of ``b''`` when no " -"output was observed." +"Output of the child process if it was captured by :func:`run` or :func:" +"`check_output`. Otherwise, ``None``. This is always :class:`bytes` when " +"any output was captured regardless of the ``text=True`` setting. It may " +"remain ``None`` instead of ``b''`` when no output was observed." msgstr "" #: ../../library/subprocess.rst:219 ../../library/subprocess.rst:256 @@ -316,9 +313,9 @@ msgstr "" #: ../../library/subprocess.rst:235 msgid "" -"Subclass of :exc:`SubprocessError`, raised when a process run " -"by :func:`check_call`, :func:`check_output`, or :func:`run` (with " -"``check=True``) returns a non-zero exit status." +"Subclass of :exc:`SubprocessError`, raised when a process run by :func:" +"`check_call`, :func:`check_output`, or :func:`run` (with ``check=True``) " +"returns a non-zero exit status." msgstr "" #: ../../library/subprocess.rst:242 @@ -329,8 +326,8 @@ msgstr "" #: ../../library/subprocess.rst:251 msgid "" -"Output of the child process if it was captured by :func:`run` " -"or :func:`check_output`. Otherwise, ``None``." +"Output of the child process if it was captured by :func:`run` or :func:" +"`check_output`. Otherwise, ``None``." msgstr "" #: ../../library/subprocess.rst:260 @@ -369,10 +366,10 @@ msgid "" "descriptor (a positive integer), and an existing :term:`file object` with a " "valid file descriptor. With the default settings of ``None``, no " "redirection will occur. :data:`PIPE` indicates that a new pipe to the child " -"should be created. :data:`DEVNULL` indicates that the special " -"file :data:`os.devnull` will be used. Additionally, *stderr* can " -"be :data:`STDOUT`, which indicates that the stderr data from the child " -"process should be captured into the same file handle as for *stdout*." +"should be created. :data:`DEVNULL` indicates that the special file :data:" +"`os.devnull` will be used. Additionally, *stderr* can be :data:`STDOUT`, " +"which indicates that the stderr data from the child process should be " +"captured into the same file handle as for *stdout*." msgstr "" #: ../../library/subprocess.rst:299 @@ -409,9 +406,9 @@ msgstr "" #: ../../library/subprocess.rst:322 msgid "" -"The newlines attribute of the file " -"objects :attr:`Popen.stdin`, :attr:`Popen.stdout` and :attr:`Popen.stderr` " -"are not updated by the :meth:`Popen.communicate` method." +"The newlines attribute of the file objects :attr:`Popen.stdin`, :attr:`Popen." +"stdout` and :attr:`Popen.stderr` are not updated by the :meth:`Popen." +"communicate` method." msgstr "" #: ../../library/subprocess.rst:326 @@ -422,18 +419,17 @@ msgid "" "convenient access to other shell features such as shell pipes, filename " "wildcards, environment variable expansion, and expansion of ``~`` to a " "user's home directory. However, note that Python itself offers " -"implementations of many shell-like features (in " -"particular, :mod:`glob`, :mod:`fnmatch`, :func:`os.walk`, :func:`os.path.expandvars`, :func:`os.path.expanduser`, " -"and :mod:`shutil`)." +"implementations of many shell-like features (in particular, :mod:`glob`, :" +"mod:`fnmatch`, :func:`os.walk`, :func:`os.path.expandvars`, :func:`os.path." +"expanduser`, and :mod:`shutil`)." msgstr "" #: ../../library/subprocess.rst:336 msgid "" -"When *universal_newlines* is ``True``, the class uses the " -"encoding :func:`locale.getpreferredencoding(False) " -"` instead of " -"``locale.getpreferredencoding()``. See the :class:`io.TextIOWrapper` class " -"for more information on this change." +"When *universal_newlines* is ``True``, the class uses the encoding :func:" +"`locale.getpreferredencoding(False) ` instead " +"of ``locale.getpreferredencoding()``. See the :class:`io.TextIOWrapper` " +"class for more information on this change." msgstr "" #: ../../library/subprocess.rst:344 ../../library/subprocess.rst:465 @@ -461,16 +457,16 @@ msgstr "" #: ../../library/subprocess.rst:368 msgid "" -"Execute a child program in a new process. On POSIX, the class " -"uses :meth:`os.execvpe`-like behavior to execute the child program. On " -"Windows, the class uses the Windows ``CreateProcess()`` function. The " -"arguments to :class:`Popen` are as follows." +"Execute a child program in a new process. On POSIX, the class uses :meth:" +"`os.execvpe`-like behavior to execute the child program. On Windows, the " +"class uses the Windows ``CreateProcess()`` function. The arguments to :" +"class:`Popen` are as follows." msgstr "" #: ../../library/subprocess.rst:373 msgid "" -"*args* should be a sequence of program arguments or else a single string " -"or :term:`path-like object`. By default, the program to execute is the first " +"*args* should be a sequence of program arguments or else a single string or :" +"term:`path-like object`. By default, the program to execute is the first " "item in *args* if *args* is a sequence. If *args* is a string, the " "interpretation is platform-dependent and described below. See the *shell* " "and *executable* arguments for additional differences from the default " @@ -590,8 +586,8 @@ msgid "" "when typed at the shell prompt. This includes, for example, quoting or " "backslash escaping filenames with spaces in them. If *args* is a sequence, " "the first item specifies the command string, and any additional items will " -"be treated as additional arguments to the shell itself. That is to " -"say, :class:`Popen` does the equivalent of::" +"be treated as additional arguments to the shell itself. That is to say, :" +"class:`Popen` does the equivalent of::" msgstr "" #: ../../library/subprocess.rst:455 @@ -631,8 +627,8 @@ msgstr "" #: ../../library/subprocess.rst:477 msgid "" -"negative bufsize (the default) means the system default of " -"io.DEFAULT_BUFFER_SIZE will be used." +"negative bufsize (the default) means the system default of io." +"DEFAULT_BUFFER_SIZE will be used." msgstr "" #: ../../library/subprocess.rst:480 @@ -675,10 +671,10 @@ msgid "" "descriptor (a positive integer), and an existing :term:`file object` with a " "valid file descriptor. With the default settings of ``None``, no " "redirection will occur. :data:`PIPE` indicates that a new pipe to the child " -"should be created. :data:`DEVNULL` indicates that the special " -"file :data:`os.devnull` will be used. Additionally, *stderr* can " -"be :data:`STDOUT`, which indicates that the stderr data from the " -"applications should be captured into the same file handle as for *stdout*." +"should be created. :data:`DEVNULL` indicates that the special file :data:" +"`os.devnull` will be used. Additionally, *stderr* can be :data:`STDOUT`, " +"which indicates that the stderr data from the applications should be " +"captured into the same file handle as for *stdout*." msgstr "" #: ../../library/subprocess.rst:523 @@ -720,8 +716,8 @@ msgstr "" #: ../../library/subprocess.rst:552 msgid "" "On Windows, if *close_fds* is true then no handles will be inherited by the " -"child process unless explicitly passed in the ``handle_list`` element " -"of :attr:`STARTUPINFO.lpAttributeList`, or by standard handle redirection." +"child process unless explicitly passed in the ``handle_list`` element of :" +"attr:`STARTUPINFO.lpAttributeList`, or by standard handle redirection." msgstr "" #: ../../library/subprocess.rst:556 @@ -732,16 +728,16 @@ msgstr "" #: ../../library/subprocess.rst:560 msgid "" -"On Windows the default for *close_fds* was changed from :const:`False` " -"to :const:`True` when redirecting the standard handles. It's now possible to " -"set *close_fds* to :const:`True` when redirecting the standard handles." +"On Windows the default for *close_fds* was changed from :const:`False` to :" +"const:`True` when redirecting the standard handles. It's now possible to set " +"*close_fds* to :const:`True` when redirecting the standard handles." msgstr "" #: ../../library/subprocess.rst:565 msgid "" "*pass_fds* is an optional sequence of file descriptors to keep open between " -"the parent and child. Providing any *pass_fds* forces *close_fds* to " -"be :const:`True`. (POSIX only)" +"the parent and child. Providing any *pass_fds* forces *close_fds* to be :" +"const:`True`. (POSIX only)" msgstr "" #: ../../library/subprocess.rst:569 @@ -751,10 +747,10 @@ msgstr "新增 *pass_fds* 參數。" #: ../../library/subprocess.rst:572 msgid "" "If *cwd* is not ``None``, the function changes the working directory to " -"*cwd* before executing the child. *cwd* can be a string, bytes " -"or :term:`path-like ` object. On POSIX, the function " -"looks for *executable* (or for the first item in *args*) relative to *cwd* " -"if the executable path is a relative path." +"*cwd* before executing the child. *cwd* can be a string, bytes or :term:" +"`path-like ` object. On POSIX, the function looks for " +"*executable* (or for the first item in *args*) relative to *cwd* if the " +"executable path is a relative path." msgstr "" #: ../../library/subprocess.rst:578 @@ -839,15 +835,15 @@ msgid "" "If *env* is not ``None``, it must be a mapping that defines the environment " "variables for the new process; these are used instead of the default " "behavior of inheriting the current process' environment. This mapping can be " -"str to str on any platform or bytes to bytes on POSIX platforms much " -"like :data:`os.environ` or :data:`os.environb`." +"str to str on any platform or bytes to bytes on POSIX platforms much like :" +"data:`os.environ` or :data:`os.environb`." msgstr "" #: ../../library/subprocess.rst:650 msgid "" "If specified, *env* must provide any variables required for the program to " "execute. On Windows, in order to run a `side-by-side assembly`_ the " -"specified *env* **must** include a valid :envvar:`SystemRoot`." +"specified *env* **must** include a valid ``%SystemRoot%``." msgstr "" #: ../../library/subprocess.rst:656 @@ -955,8 +951,8 @@ msgstr "" #: ../../library/subprocess.rst:701 ../../library/subprocess.rst:703 msgid "" -"Popen and the other functions in this module that use it raise " -"an :ref:`auditing event ` ``subprocess.Popen`` with arguments " +"Popen and the other functions in this module that use it raise an :ref:" +"`auditing event ` ``subprocess.Popen`` with arguments " "``executable``, ``args``, ``cwd``, and ``env``. The value for ``args`` may " "be a single string or a list of strings, depending on platform." msgstr "" @@ -976,8 +972,8 @@ msgid "" "Popen can use :func:`os.posix_spawn` in some cases for better performance. " "On Windows Subsystem for Linux and QEMU User Emulation, Popen constructor " "using :func:`os.posix_spawn` no longer raise an exception on errors like " -"missing program, but the child process fails with a non-" -"zero :attr:`~Popen.returncode`." +"missing program, but the child process fails with a non-zero :attr:`~Popen." +"returncode`." msgstr "" #: ../../library/subprocess.rst:724 @@ -994,11 +990,11 @@ msgstr "" msgid "" "The most common exception raised is :exc:`OSError`. This occurs, for " "example, when trying to execute a non-existent file. Applications should " -"prepare for :exc:`OSError` exceptions. Note that, when " -"``shell=True``, :exc:`OSError` will be raised by the child only if the " -"selected shell itself was not found. To determine if the shell failed to " -"find the requested application, it is necessary to check the return code or " -"output from the subprocess." +"prepare for :exc:`OSError` exceptions. Note that, when ``shell=True``, :exc:" +"`OSError` will be raised by the child only if the selected shell itself was " +"not found. To determine if the shell failed to find the requested " +"application, it is necessary to check the return code or output from the " +"subprocess." msgstr "" #: ../../library/subprocess.rst:736 @@ -1009,16 +1005,15 @@ msgstr "" #: ../../library/subprocess.rst:739 msgid "" -":func:`check_call` and :func:`check_output` will " -"raise :exc:`CalledProcessError` if the called process returns a non-zero " -"return code." +":func:`check_call` and :func:`check_output` will raise :exc:" +"`CalledProcessError` if the called process returns a non-zero return code." msgstr "" #: ../../library/subprocess.rst:743 msgid "" -"All of the functions and methods that accept a *timeout* parameter, such " -"as :func:`run` and :meth:`Popen.communicate` will " -"raise :exc:`TimeoutExpired` if the timeout expires before the process exits." +"All of the functions and methods that accept a *timeout* parameter, such as :" +"func:`run` and :meth:`Popen.communicate` will raise :exc:`TimeoutExpired` if " +"the timeout expires before the process exits." msgstr "" #: ../../library/subprocess.rst:747 @@ -1054,8 +1049,8 @@ msgid "" "this library. This could result in arguments being parsed according to shell " "rules, but without any escaping added by Python. If you are intentionally " "launching a batch file with arguments from untrusted sources, consider " -"passing ``shell=True`` to allow Python to escape special characters. " -"See :gh:`114539` for additional discussion." +"passing ``shell=True`` to allow Python to escape special characters. See :gh:" +"`114539` for additional discussion." msgstr "" #: ../../library/subprocess.rst:777 @@ -1068,21 +1063,21 @@ msgstr "" #: ../../library/subprocess.rst:784 msgid "" -"Check if child process has terminated. Set and " -"return :attr:`~Popen.returncode` attribute. Otherwise, returns ``None``." +"Check if child process has terminated. Set and return :attr:`~Popen." +"returncode` attribute. Otherwise, returns ``None``." msgstr "" #: ../../library/subprocess.rst:790 msgid "" -"Wait for child process to terminate. Set and " -"return :attr:`~Popen.returncode` attribute." +"Wait for child process to terminate. Set and return :attr:`~Popen." +"returncode` attribute." msgstr "" #: ../../library/subprocess.rst:793 msgid "" -"If the process does not terminate after *timeout* seconds, raise " -"a :exc:`TimeoutExpired` exception. It is safe to catch this exception and " -"retry the wait." +"If the process does not terminate after *timeout* seconds, raise a :exc:" +"`TimeoutExpired` exception. It is safe to catch this exception and retry " +"the wait." msgstr "" #: ../../library/subprocess.rst:799 @@ -1097,8 +1092,8 @@ msgstr "" msgid "" "When the ``timeout`` parameter is not ``None``, then (on POSIX) the function " "is implemented using a busy loop (non-blocking call and short sleeps). Use " -"the :mod:`asyncio` module for an asynchronous wait: " -"see :class:`asyncio.create_subprocess_exec`." +"the :mod:`asyncio` module for an asynchronous wait: see :class:`asyncio." +"create_subprocess_exec`." msgstr "" #: ../../library/subprocess.rst:811 ../../library/subprocess.rst:852 @@ -1133,9 +1128,9 @@ msgstr "" #: ../../library/subprocess.rst:832 msgid "" -"If the process does not terminate after *timeout* seconds, " -"a :exc:`TimeoutExpired` exception will be raised. Catching this exception " -"and retrying communication will not lose any output." +"If the process does not terminate after *timeout* seconds, a :exc:" +"`TimeoutExpired` exception will be raised. Catching this exception and " +"retrying communication will not lose any output." msgstr "" #: ../../library/subprocess.rst:836 @@ -1238,10 +1233,10 @@ msgstr "" #: ../../library/subprocess.rst:922 msgid "" -"Use :meth:`~Popen.communicate` rather than :attr:`.stdin.write " -"`, :attr:`.stdout.read ` or :attr:`.stderr.read " -"` to avoid deadlocks due to any of the other OS pipe buffers " -"filling up and blocking the child process." +"Use :meth:`~Popen.communicate` rather than :attr:`.stdin.write `, :attr:`.stdout.read ` or :attr:`.stderr.read ` to avoid deadlocks due to any of the other OS pipe buffers filling " +"up and blocking the child process." msgstr "" #: ../../library/subprocess.rst:930 @@ -1298,12 +1293,12 @@ msgstr "" #: ../../library/subprocess.rst:971 msgid "" "si = subprocess.STARTUPINFO()\n" -"si.dwFlags = subprocess.STARTF_USESTDHANDLES | " -"subprocess.STARTF_USESHOWWINDOW" +"si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess." +"STARTF_USESHOWWINDOW" msgstr "" "si = subprocess.STARTUPINFO()\n" -"si.dwFlags = subprocess.STARTF_USESTDHANDLES | " -"subprocess.STARTF_USESHOWWINDOW" +"si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess." +"STARTF_USESHOWWINDOW" #: ../../library/subprocess.rst:976 msgid "" @@ -1337,15 +1332,15 @@ msgstr "" #: ../../library/subprocess.rst:1003 msgid "" -":data:`SW_HIDE` is provided for this attribute. It is used " -"when :class:`Popen` is called with ``shell=True``." +":data:`SW_HIDE` is provided for this attribute. It is used when :class:" +"`Popen` is called with ``shell=True``." msgstr "" #: ../../library/subprocess.rst:1008 msgid "" "A dictionary of additional attributes for process creation as given in " -"``STARTUPINFOEX``, see `UpdateProcThreadAttribute `__." +"``STARTUPINFOEX``, see `UpdateProcThreadAttribute `__." msgstr "" #: ../../library/subprocess.rst:1012 @@ -1364,9 +1359,9 @@ msgstr "" #: ../../library/subprocess.rst:1018 msgid "" -"The handles must be temporarily made inheritable " -"by :func:`os.set_handle_inheritable` when passed to the :class:`Popen` " -"constructor, else :class:`OSError` will be raised with Windows error " +"The handles must be temporarily made inheritable by :func:`os." +"set_handle_inheritable` when passed to the :class:`Popen` constructor, else :" +"class:`OSError` will be raised with Windows error " "``ERROR_INVALID_PARAMETER`` (87)." msgstr "" @@ -1374,9 +1369,9 @@ msgstr "" msgid "" "In a multithreaded process, use caution to avoid leaking handles that are " "marked inheritable when combining this feature with concurrent calls to " -"other process creation functions that inherit all handles such " -"as :func:`os.system`. This also applies to standard handle redirection, " -"which temporarily creates inheritable handles." +"other process creation functions that inherit all handles such as :func:`os." +"system`. This also applies to standard handle redirection, which " +"temporarily creates inheritable handles." msgstr "" #: ../../library/subprocess.rst:1035 @@ -1411,9 +1406,9 @@ msgstr "" #: ../../library/subprocess.rst:1060 msgid "" -"Specifies that " -"the :attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO.hStdOutput`, " -"and :attr:`STARTUPINFO.hStdError` attributes contain additional information." +"Specifies that the :attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO." +"hStdOutput`, and :attr:`STARTUPINFO.hStdError` attributes contain additional " +"information." msgstr "" #: ../../library/subprocess.rst:1066 @@ -1567,11 +1562,10 @@ msgstr "" #: ../../library/subprocess.rst:1224 msgid "" "Run command with arguments. Wait for command to complete. If the return " -"code was zero then return, otherwise raise :exc:`CalledProcessError`. " -"The :exc:`CalledProcessError` object will have the return code in " -"the :attr:`~CalledProcessError.returncode` attribute. If :func:`check_call` " -"was unable to start the process it will propagate the exception that was " -"raised." +"code was zero then return, otherwise raise :exc:`CalledProcessError`. The :" +"exc:`CalledProcessError` object will have the return code in the :attr:" +"`~CalledProcessError.returncode` attribute. If :func:`check_call` was unable " +"to start the process it will propagate the exception that was raised." msgstr "" #: ../../library/subprocess.rst:1233 @@ -1584,10 +1578,10 @@ msgstr "" #: ../../library/subprocess.rst:1268 msgid "" -"If the return code was non-zero it raises a :exc:`CalledProcessError`. " -"The :exc:`CalledProcessError` object will have the return code in " -"the :attr:`~CalledProcessError.returncode` attribute and any output in " -"the :attr:`~CalledProcessError.output` attribute." +"If the return code was non-zero it raises a :exc:`CalledProcessError`. The :" +"exc:`CalledProcessError` object will have the return code in the :attr:" +"`~CalledProcessError.returncode` attribute and any output in the :attr:" +"`~CalledProcessError.output` attribute." msgstr "" #: ../../library/subprocess.rst:1273 @@ -1602,10 +1596,10 @@ msgstr "run(..., check=True, stdout=PIPE).stdout" msgid "" "The arguments shown above are merely some common ones. The full function " "signature is largely the same as that of :func:`run` - most arguments are " -"passed directly through to that interface. One API deviation " -"from :func:`run` behavior exists: passing ``input=None`` will behave the " -"same as ``input=b''`` (or ``input=''``, depending on other arguments) rather " -"than using the parent's standard input file handle." +"passed directly through to that interface. One API deviation from :func:" +"`run` behavior exists: passing ``input=None`` will behave the same as " +"``input=b''`` (or ``input=''``, depending on other arguments) rather than " +"using the parent's standard input file handle." msgstr "" #: ../../library/subprocess.rst:1284 @@ -1624,8 +1618,8 @@ msgstr "" #: ../../library/subprocess.rst:1292 msgid "" -"To also capture standard error in the result, use " -"``stderr=subprocess.STDOUT``::" +"To also capture standard error in the result, use ``stderr=subprocess." +"STDOUT``::" msgstr "" #: ../../library/subprocess.rst:1295 @@ -1663,16 +1657,16 @@ msgstr "" #: ../../library/subprocess.rst:1333 msgid "" "All \"a\" functions in this section fail (more or less) silently if the " -"executed program cannot be found; the \"b\" replacements " -"raise :exc:`OSError` instead." +"executed program cannot be found; the \"b\" replacements raise :exc:" +"`OSError` instead." msgstr "" #: ../../library/subprocess.rst:1337 msgid "" -"In addition, the replacements using :func:`check_output` will fail with " -"a :exc:`CalledProcessError` if the requested operation produces a non-zero " -"return code. The output is still available as " -"the :attr:`~CalledProcessError.output` attribute of the raised exception." +"In addition, the replacements using :func:`check_output` will fail with a :" +"exc:`CalledProcessError` if the requested operation produces a non-zero " +"return code. The output is still available as the :attr:`~CalledProcessError." +"output` attribute of the raised exception." msgstr "" #: ../../library/subprocess.rst:1342 @@ -1754,15 +1748,15 @@ msgstr "" #: ../../library/subprocess.rst:1398 msgid "" -"The :func:`call` return value is encoded differently to that " -"of :func:`os.system`." +"The :func:`call` return value is encoded differently to that of :func:`os." +"system`." msgstr "" #: ../../library/subprocess.rst:1401 msgid "" "The :func:`os.system` function ignores SIGINT and SIGQUIT signals while the " -"command is running, but the caller must do this separately when using " -"the :mod:`subprocess` module." +"command is running, but the caller must do this separately when using the :" +"mod:`subprocess` module." msgstr "" #: ../../library/subprocess.rst:1405 @@ -1774,8 +1768,8 @@ msgid "" "try:\n" " retcode = call(\"mycmd\" + \" myarg\", shell=True)\n" " if retcode < 0:\n" -" print(\"Child was terminated by signal\", -retcode, " -"file=sys.stderr)\n" +" print(\"Child was terminated by signal\", -retcode, file=sys." +"stderr)\n" " else:\n" " print(\"Child returned\", retcode, file=sys.stderr)\n" "except OSError as e:\n" @@ -1784,8 +1778,8 @@ msgstr "" "try:\n" " retcode = call(\"mycmd\" + \" myarg\", shell=True)\n" " if retcode < 0:\n" -" print(\"Child was terminated by signal\", -retcode, " -"file=sys.stderr)\n" +" print(\"Child was terminated by signal\", -retcode, file=sys." +"stderr)\n" " else:\n" " print(\"Child returned\", retcode, file=sys.stderr)\n" "except OSError as e:\n" @@ -1903,10 +1897,9 @@ msgstr "" #: ../../library/subprocess.rst:1476 msgid "" -"Execute the string *cmd* in a shell with :meth:`Popen.check_output` and " -"return a 2-tuple ``(exitcode, output)``. *encoding* and *errors* are used to " -"decode output; see the notes on :ref:`frequently-used-arguments` for more " -"details." +"Execute the string *cmd* in a shell with :func:`check_output` and return a 2-" +"tuple ``(exitcode, output)``. *encoding* and *errors* are used to decode " +"output; see the notes on :ref:`frequently-used-arguments` for more details." msgstr "" #: ../../library/subprocess.rst:1481 @@ -1942,8 +1935,8 @@ msgstr "新增對 Windows 的支援。" #: ../../library/subprocess.rst:1499 msgid "" "The function now returns (exitcode, output) instead of (status, output) as " -"it did in Python 3.3.3 and earlier. exitcode has the same value " -"as :attr:`~Popen.returncode`." +"it did in Python 3.3.3 and earlier. exitcode has the same value as :attr:" +"`~Popen.returncode`." msgstr "" #: ../../library/subprocess.rst:1508 @@ -1978,9 +1971,9 @@ msgstr "" #: ../../library/subprocess.rst:1533 msgid "" -"When using the ``timeout`` parameter in functions " -"like :func:`run`, :meth:`Popen.wait`, or :meth:`Popen.communicate`, users " -"should be aware of the following behaviors:" +"When using the ``timeout`` parameter in functions like :func:`run`, :meth:" +"`Popen.wait`, or :meth:`Popen.communicate`, users should be aware of the " +"following behaviors:" msgstr "" #: ../../library/subprocess.rst:1537 @@ -2074,9 +2067,9 @@ msgid "" "attribute is available to read. Despite the name, a true value does not " "indicate the corresponding function will be used, only that it may be." msgstr "" -"在任何 Python 版本上將這個設定為 false 都是安全的。當不受支援時,它對舊版本或沒有支援的新版本" -"沒有影響。不要假設屬性可供讀取。儘管它的名稱是這樣,真實值並不表示將使用相應的" -"函式,而只是表示可能會使用。" +"在任何 Python 版本上將這個設定為 false 都是安全的。當不受支援時,它對舊版本或" +"沒有支援的新版本沒有影響。不要假設屬性可供讀取。儘管它的名稱是這樣,真實值並" +"不表示將使用相應的函式,而只是表示可能會使用。" #: ../../library/subprocess.rst:1600 msgid "" diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index 922eacc4382..10c1cdc5250 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -342,11 +342,11 @@ msgstr ":monitoring-event:`STOP_ITERATION`" #: ../../library/sys.monitoring.rst:199 msgid "Deprecated event" -msgstr "" +msgstr "已棄用的事件" #: ../../library/sys.monitoring.rst:201 msgid "``BRANCH``" -msgstr "" +msgstr "``BRANCH``" #: ../../library/sys.monitoring.rst:203 msgid "" diff --git a/library/sysconfig.po b/library/sysconfig.po index e529b88de4c..01b34730e91 100644 --- a/library/sysconfig.po +++ b/library/sysconfig.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-29 00:15+0000\n" +"POT-Creation-Date: 2025-10-05 00:16+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -109,10 +109,10 @@ msgstr "" #: ../../library/sysconfig.rst:70 msgid "" "Python uses an installation scheme that differs depending on the platform " -"and on the installation options. These schemes are stored " -"in :mod:`sysconfig` under unique identifiers based on the value returned " -"by :const:`os.name`. The schemes are used by package installers to determine " -"where to copy files to." +"and on the installation options. These schemes are stored in :mod:" +"`sysconfig` under unique identifiers based on the value returned by :const:" +"`os.name`. The schemes are used by package installers to determine where to " +"copy files to." msgstr "" #: ../../library/sysconfig.rst:75 @@ -134,8 +134,8 @@ msgstr "" #: ../../library/sysconfig.rst:81 msgid "" "*posix_user*: scheme for POSIX platforms, when the *user* option is used. " -"This scheme defines paths located under the user's home directory " -"(:const:`site.USER_BASE`)." +"This scheme defines paths located under the user's home directory (:const:" +"`site.USER_BASE`)." msgstr "" #: ../../library/sysconfig.rst:84 @@ -233,8 +233,8 @@ msgstr "" msgid "" "Files will be installed into subdirectories of :const:`site.USER_BASE` " "(written as :file:`{userbase}` hereafter). This scheme installs pure Python " -"modules and extension modules in the same location (also known " -"as :const:`site.USER_SITE`)." +"modules and extension modules in the same location (also known as :const:" +"`site.USER_SITE`)." msgstr "" #: ../../library/sysconfig.rst:126 @@ -357,8 +357,8 @@ msgid "" "The idea behind the \"home scheme\" is that you build and maintain a " "personal stash of Python modules. This scheme's name is derived from the " "idea of a \"home\" directory on Unix, since it's not unusual for a Unix user " -"to make their home directory have a layout similar to :file:`/usr/` " -"or :file:`/usr/local/`. This scheme can be used by anyone, regardless of the " +"to make their home directory have a layout similar to :file:`/usr/` or :file:" +"`/usr/local/`. This scheme can be used by anyone, regardless of the " "operating system they are installing for." msgstr "" @@ -479,8 +479,8 @@ msgstr "" #: ../../library/sysconfig.rst:265 msgid "" -"Return a tuple containing all schemes currently supported " -"in :mod:`sysconfig`." +"Return a tuple containing all schemes currently supported in :mod:" +"`sysconfig`." msgstr "" #: ../../library/sysconfig.rst:271 @@ -532,14 +532,14 @@ msgstr "" #: ../../library/sysconfig.rst:307 msgid "" -"End users should not use this function, but :func:`get_default_scheme` " -"and :func:`get_preferred_scheme` instead." +"End users should not use this function, but :func:`get_default_scheme` and :" +"func:`get_preferred_scheme` instead." msgstr "" #: ../../library/sysconfig.rst:315 msgid "" -"Return a tuple containing all path names currently supported " -"in :mod:`sysconfig`." +"Return a tuple containing all path names currently supported in :mod:" +"`sysconfig`." msgstr "" #: ../../library/sysconfig.rst:321 @@ -569,9 +569,9 @@ msgstr "" #: ../../library/sysconfig.rst:334 msgid "" -"If *scheme* is provided, it must be a value from the list returned " -"by :func:`get_scheme_names`. Otherwise, the default scheme for the current " -"platform is used." +"If *scheme* is provided, it must be a value from the list returned by :func:" +"`get_scheme_names`. Otherwise, the default scheme for the current platform " +"is used." msgstr "" #: ../../library/sysconfig.rst:338 @@ -614,8 +614,8 @@ msgstr "" #: ../../library/sysconfig.rst:360 msgid "" -"If *scheme* is not an existing scheme, :func:`get_paths` will raise " -"a :exc:`KeyError`." +"If *scheme* is not an existing scheme, :func:`get_paths` will raise a :exc:" +"`KeyError`." msgstr "" #: ../../library/sysconfig.rst:365 @@ -627,8 +627,8 @@ msgid "" "Return the ``MAJOR.MINOR`` Python version number as a string. Similar to " "``'%d.%d' % sys.version_info[:2]``." msgstr "" -"回傳 ``MAJOR.MINOR`` Python 版本號碼字串。類似於 ``'%d.%d' % " -"sys.version_info[:2]``。" +"回傳 ``MAJOR.MINOR`` Python 版本號碼字串。類似於 ``'%d.%d' % sys." +"version_info[:2]``。" #: ../../library/sysconfig.rst:375 msgid "Return a string that identifies the current platform." @@ -647,99 +647,87 @@ msgstr "" msgid "Examples of returned values:" msgstr "" -#: ../../library/sysconfig.rst:385 -msgid "linux-i586" -msgstr "linux-i586" - #: ../../library/sysconfig.rst:386 -msgid "linux-alpha (?)" -msgstr "linux-alpha (?)" +msgid "Windows:" +msgstr "Windows:" -#: ../../library/sysconfig.rst:387 -msgid "solaris-2.6-sun4u" -msgstr "solaris-2.6-sun4u" +#: ../../library/sysconfig.rst:388 +msgid "win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)" +msgstr "" #: ../../library/sysconfig.rst:389 -msgid "Windows will return one of:" +msgid "win-arm64 (64-bit Windows on ARM64, aka AArch64)" msgstr "" -#: ../../library/sysconfig.rst:391 -msgid "win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)" +#: ../../library/sysconfig.rst:390 +msgid "win32 (all others - specifically, sys.platform is returned)" msgstr "" #: ../../library/sysconfig.rst:392 -msgid "win-arm64 (64-bit Windows on ARM64, aka AArch64)" +msgid "POSIX based OS:" msgstr "" -#: ../../library/sysconfig.rst:393 -msgid "win32 (all others - specifically, sys.platform is returned)" -msgstr "" +#: ../../library/sysconfig.rst:394 +msgid "linux-x86_64" +msgstr "linux-x86_64" #: ../../library/sysconfig.rst:395 -msgid "macOS can return:" +msgid "macosx-15.5-arm64" +msgstr "macosx-15.5-arm64" + +#: ../../library/sysconfig.rst:396 +msgid "macosx-26.0-universal2 (macOS on Apple Silicon or Intel)" msgstr "" #: ../../library/sysconfig.rst:397 -msgid "macosx-10.6-ppc" -msgstr "macosx-10.6-ppc" - -#: ../../library/sysconfig.rst:398 -msgid "macosx-10.4-ppc64" -msgstr "macosx-10.4-ppc64" +msgid "android-24-arm64_v8a" +msgstr "android-24-arm64_v8a" #: ../../library/sysconfig.rst:399 -msgid "macosx-10.3-i386" -msgstr "macosx-10.3-i386" - -#: ../../library/sysconfig.rst:400 -msgid "macosx-10.4-fat" -msgstr "macosx-10.4-fat" - -#: ../../library/sysconfig.rst:402 msgid "" "For other non-POSIX platforms, currently just returns :data:`sys.platform`." msgstr "" -#: ../../library/sysconfig.rst:407 +#: ../../library/sysconfig.rst:404 msgid "" "Return ``True`` if the running Python interpreter was built from source and " "is being run from its built location, and not from a location resulting from " "e.g. running ``make install`` or installing via a binary installer." msgstr "" -#: ../../library/sysconfig.rst:414 +#: ../../library/sysconfig.rst:411 msgid "Parse a :file:`config.h`\\-style file." -msgstr "" +msgstr "剖析一個 :file:`config.h` 風格的檔案。" -#: ../../library/sysconfig.rst:416 +#: ../../library/sysconfig.rst:413 msgid "" "*fp* is a file-like object pointing to the :file:`config.h`\\-like file." msgstr "" -#: ../../library/sysconfig.rst:418 +#: ../../library/sysconfig.rst:415 msgid "" "A dictionary containing name/value pairs is returned. If an optional " "dictionary is passed in as the second argument, it is used instead of a new " "dictionary, and updated with the values read in the file." msgstr "" -#: ../../library/sysconfig.rst:425 +#: ../../library/sysconfig.rst:422 msgid "Return the path of :file:`pyconfig.h`." msgstr "回傳 :file:`pyconfig.h` 的路徑。" -#: ../../library/sysconfig.rst:429 +#: ../../library/sysconfig.rst:426 msgid "Return the path of :file:`Makefile`." msgstr "回傳 :file:`Makefile` 的路徑。" -#: ../../library/sysconfig.rst:435 +#: ../../library/sysconfig.rst:432 msgid "Command-line usage" msgstr "命令列用法" -#: ../../library/sysconfig.rst:437 +#: ../../library/sysconfig.rst:434 msgid "You can use :mod:`sysconfig` as a script with Python's *-m* option:" msgstr "" -#: ../../library/sysconfig.rst:439 +#: ../../library/sysconfig.rst:436 msgid "" "$ python -m sysconfig\n" "Platform: \"macosx-10.4-i386\"\n" @@ -785,16 +773,31 @@ msgstr "" " ARFLAGS = \"rc\"\n" " ..." -#: ../../library/sysconfig.rst:463 +#: ../../library/sysconfig.rst:460 msgid "" -"This call will print in the standard output the information returned " -"by :func:`get_platform`, :func:`get_python_version`, :func:`get_path` " -"and :func:`get_config_vars`." +"This call will print in the standard output the information returned by :" +"func:`get_platform`, :func:`get_python_version`, :func:`get_path` and :func:" +"`get_config_vars`." msgstr "" #: ../../library/sysconfig.rst:14 msgid "configuration information" msgstr "configuration information(設定資訊)" +#~ msgid "linux-alpha (?)" +#~ msgstr "linux-alpha (?)" + +#~ msgid "solaris-2.6-sun4u" +#~ msgstr "solaris-2.6-sun4u" + +#~ msgid "macosx-10.6-ppc" +#~ msgstr "macosx-10.6-ppc" + +#~ msgid "macosx-10.3-i386" +#~ msgstr "macosx-10.3-i386" + +#~ msgid "macosx-10.4-fat" +#~ msgstr "macosx-10.4-fat" + #~ msgid "Using :mod:`sysconfig` as a script" #~ msgstr "將 :mod:`sysconfig` 作為腳本使用" diff --git a/library/textwrap.po b/library/textwrap.po index 7d04efaac39..a6055637cb2 100644 --- a/library/textwrap.po +++ b/library/textwrap.po @@ -90,6 +90,12 @@ msgid "" ">>> textwrap.shorten(\"Hello world\", width=10, placeholder=\"...\")\n" "'Hello...'" msgstr "" +">>> textwrap.shorten(\"Hello world!\", width=12)\n" +"'Hello world!'\n" +">>> textwrap.shorten(\"Hello world!\", width=11)\n" +"'Hello [...]'\n" +">>> textwrap.shorten(\"Hello world\", width=10, placeholder=\"...\")\n" +"'Hello...'" #: ../../library/textwrap.rst:72 msgid "" diff --git a/library/time.po b/library/time.po index ae1603fb315..8c011ec6a9a 100644 --- a/library/time.po +++ b/library/time.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-10 00:19+0000\n" +"POT-Creation-Date: 2025-10-15 00:16+0000\n" "PO-Revision-Date: 2024-11-20 15:25+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -384,11 +384,11 @@ msgstr "其結果具有以下屬性:" #: ../../library/time.rst:241 msgid "" -"*adjustable*: ``True`` if the clock can be changed automatically (e.g. by a " -"NTP daemon) or manually by the system administrator, ``False`` otherwise" +"*adjustable*: ``True`` if the clock can be set to jump forward or backward " +"in time, ``False`` otherwise. Does not refer to gradual NTP rate adjustments." msgstr "" -"*adjustable*: 如果時鐘可以自動(例如,透過 NTP 常駐程式)或由系統管理員手動更" -"改,則為 ``True``,否則為 ``False``" +"*adjustable*: 如果時鐘可以設定為向前或向後跳轉時間則為 ``True``,否則為 ``False``。" +"不指漸進式的 NTP 速率調整。" #: ../../library/time.rst:243 msgid "" @@ -647,7 +647,7 @@ msgstr "或使用 ``select()``\\ (解析度:1 微秒)。" #: ../../library/time.rst:412 msgid "" "To emulate a \"no-op\", use :keyword:`pass` instead of ``time.sleep(0)``." -msgstr "" +msgstr "要模擬「無動作 (no-op)」,請使用 :keyword:`pass` 而不是 ``time.sleep(0)``。" #: ../../library/time.rst:414 msgid "" @@ -1601,8 +1601,8 @@ msgid "" "`International Atomic Time `_" msgstr "" -"`國際原子時間 `_" +"`國際原子時間 `_" #: ../../library/time.rst:940 msgid "" diff --git a/library/tkinter.po b/library/tkinter.po index 70c31480caf..974a2ab0e1d 100644 --- a/library/tkinter.po +++ b/library/tkinter.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-10-20 00:15+0000\n" "PO-Revision-Date: 2025-07-13 20:00+0800\n" "Last-Translator: Dr-XYZ \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -218,7 +218,7 @@ msgstr "" "繞著協同多工(cooperative multitasking)設計的,而 Tkinter 則彌合了這種差異" "(詳情請參閱 `Threading model`_)。" -#: ../../library/tkinter.rst:92 ../../library/tkinter.rst:907 +#: ../../library/tkinter.rst:92 ../../library/tkinter.rst:906 msgid "Tk" msgstr "Tk" @@ -844,8 +844,8 @@ msgid "" "Widgets are referred to by a *pathname* in Tcl (like ``.frm.btn``), whereas " "Tkinter doesn't use names but object references." msgstr "" -"在 Tcl 中,元件是透過\\ *路徑名稱*\\ (如 ``.frm.btn``)來參照,而 Tkinter 不使" -"用名稱,而是使用物件參照。" +"在 Tcl 中,元件是透過\\ *路徑名稱*\\ (如 ``.frm.btn``)來參照,而 Tkinter 不" +"使用名稱,而是使用物件參照。" #: ../../library/tkinter.rst:386 msgid "" @@ -863,8 +863,8 @@ msgid "" "Operations which are implemented as separate *commands* in Tcl (like " "``grid`` or ``destroy``) are represented as *methods* on Tkinter widget " "objects. As you'll see shortly, at other times Tcl uses what appear to be " -"method calls on widget objects, which more closely mirror what would is used " -"in Tkinter." +"method calls on widget objects, which more closely mirror what is used in " +"Tkinter." msgstr "" "在 Tcl 中實作為獨立\\ *指令*\\ 的操作(如 ``grid`` 或 ``destroy``),在 " "Tkinter 中則表示為元件物件上的\\ *方法*。正如你稍後會看到的,在其他時候,Tcl " @@ -1530,7 +1530,7 @@ msgstr "" "叫 :meth:`get` 方法,要更改其值,則呼叫 :meth:`!set` 方法。如果你遵循此協定," "元件將始終追蹤變數的值,無需你進一步干預。" -#: ../../library/tkinter.rst:714 ../../library/tkinter.rst:894 +#: ../../library/tkinter.rst:714 ../../library/tkinter.rst:893 msgid "For example::" msgstr "舉例來說: ::" @@ -1809,16 +1809,16 @@ msgstr "justify" #: ../../library/tkinter.rst:842 msgid "" -"Legal values are the strings: ``\"left\"``, ``\"center\"``, ``\"right\"``, " -"and ``\"fill\"``." +"Legal values are the strings: ``\"left\"``, ``\"center\"``, and " +"``\"right\"``." msgstr "" -"合法值為字串:``\"left\"``、``\"center\"``、``\"right\"`` 和 ``\"fill\"``。" +"合法值為字串:``\"left\"``、``\"center\"`` 和 ``\"right\"``。" -#: ../../library/tkinter.rst:845 +#: ../../library/tkinter.rst:844 msgid "region" msgstr "region" -#: ../../library/tkinter.rst:846 +#: ../../library/tkinter.rst:845 msgid "" "This is a string with four space-delimited elements, each of which is a " "legal distance (see above). For example: ``\"2 3 4 5\"`` and ``\"3i 2i 4.5i " @@ -1828,11 +1828,11 @@ msgstr "" "文)。例如:``\"2 3 4 5\"``、``\"3i 2i 4.5i 2i\"`` 和 ``\"3c 2c 4c " "10.43c\"`` 都是合法的區域。" -#: ../../library/tkinter.rst:850 +#: ../../library/tkinter.rst:849 msgid "relief" msgstr "relief" -#: ../../library/tkinter.rst:851 +#: ../../library/tkinter.rst:850 msgid "" "Determines what the border style of a widget will be. Legal values are: " "``\"raised\"``, ``\"sunken\"``, ``\"flat\"``, ``\"groove\"``, and " @@ -1841,11 +1841,11 @@ msgstr "" "決定元件的邊框樣式。合法值為:``\"raised\"``、``\"sunken\"``、``\"flat\"``、" "``\"groove\"`` 和 ``\"ridge\"``。" -#: ../../library/tkinter.rst:854 +#: ../../library/tkinter.rst:853 msgid "scrollcommand" msgstr "scrollcommand" -#: ../../library/tkinter.rst:855 +#: ../../library/tkinter.rst:854 msgid "" "This is almost always the :meth:`!set` method of some scrollbar widget, but " "can be any widget method that takes a single argument." @@ -1853,19 +1853,19 @@ msgstr "" "這幾乎總是某個捲軸元件的 :meth:`!set` 方法,但也可以是任何接受單一引數的元件" "方法。" -#: ../../library/tkinter.rst:858 +#: ../../library/tkinter.rst:857 msgid "wrap" msgstr "wrap" -#: ../../library/tkinter.rst:859 +#: ../../library/tkinter.rst:858 msgid "Must be one of: ``\"none\"``, ``\"char\"``, or ``\"word\"``." msgstr "必須是以下之一:``\"none\"``、``\"char\"`` 或 ``\"word\"``。" -#: ../../library/tkinter.rst:864 +#: ../../library/tkinter.rst:863 msgid "Bindings and Events" msgstr "繫結與事件" -#: ../../library/tkinter.rst:870 +#: ../../library/tkinter.rst:869 msgid "" "The bind method from the widget command allows you to watch for certain " "events and to have a callback function trigger when that event type occurs. " @@ -1874,19 +1874,19 @@ msgstr "" "來自元件指令的 bind 方法允許你監視某些事件,並在該事件類型發生時觸發一個回呼" "函式。bind 方法的形式是: ::" -#: ../../library/tkinter.rst:874 +#: ../../library/tkinter.rst:873 msgid "def bind(self, sequence, func, add=''):" msgstr "def bind(self, sequence, func, add=''):" -#: ../../library/tkinter.rst:876 +#: ../../library/tkinter.rst:875 msgid "where:" msgstr "其中:" -#: ../../library/tkinter.rst:878 +#: ../../library/tkinter.rst:877 msgid "sequence" msgstr "sequence" -#: ../../library/tkinter.rst:879 +#: ../../library/tkinter.rst:878 msgid "" "is a string that denotes the target kind of event. (See the :manpage:" "`bind(3tk)` man page, and page 201 of John Ousterhout's book, :title-" @@ -1896,11 +1896,11 @@ msgstr "" "及 John Ousterhout 的書 :title-reference:`Tcl and the Tk Toolkit (2nd " "edition)` 的第 201 頁)。" -#: ../../library/tkinter.rst:883 +#: ../../library/tkinter.rst:882 msgid "func" msgstr "func" -#: ../../library/tkinter.rst:884 +#: ../../library/tkinter.rst:883 msgid "" "is a Python function, taking one argument, to be invoked when the event " "occurs. An Event instance will be passed as the argument. (Functions " @@ -1909,11 +1909,11 @@ msgstr "" "是一個 Python 函式,接受一個引數,在事件發生時被呼叫。一個 Event 實例將作為引" "數傳遞。(以這種方式部署的函式通常稱為\\ *回呼*。)" -#: ../../library/tkinter.rst:888 +#: ../../library/tkinter.rst:887 msgid "add" msgstr "add" -#: ../../library/tkinter.rst:889 +#: ../../library/tkinter.rst:888 msgid "" "is optional, either ``''`` or ``'+'``. Passing an empty string denotes that " "this binding is to replace any other bindings that this event is associated " @@ -1924,7 +1924,7 @@ msgstr "" "聯的任何其他繫結。傳遞一個 ``'+'`` 意味著此函式將被新增到繫結到此事件類型的函" "式串列中。" -#: ../../library/tkinter.rst:896 +#: ../../library/tkinter.rst:895 msgid "" "def turn_red(self, event):\n" " event.widget[\"activeforeground\"] = \"red\"\n" @@ -1936,7 +1936,7 @@ msgstr "" "\n" "self.button.bind(\"\", self.turn_red)" -#: ../../library/tkinter.rst:901 +#: ../../library/tkinter.rst:900 msgid "" "Notice how the widget field of the event is being accessed in the " "``turn_red()`` callback. This field contains the widget that caught the X " @@ -1948,143 +1948,143 @@ msgstr "" "件的元件。下表列出了你可以存取的其他事件欄位,以及它們在 Tk 中的表示方式,這" "在參閱 Tk man pages 時可能很有用。" -#: ../../library/tkinter.rst:907 +#: ../../library/tkinter.rst:906 msgid "Tkinter Event Field" msgstr "Tkinter 事件欄位" -#: ../../library/tkinter.rst:909 +#: ../../library/tkinter.rst:908 msgid "%f" msgstr "%f" -#: ../../library/tkinter.rst:909 +#: ../../library/tkinter.rst:908 msgid "focus" msgstr "focus" -#: ../../library/tkinter.rst:909 +#: ../../library/tkinter.rst:908 msgid "%A" msgstr "%A" -#: ../../library/tkinter.rst:909 +#: ../../library/tkinter.rst:908 msgid "char" msgstr "char" -#: ../../library/tkinter.rst:911 +#: ../../library/tkinter.rst:910 msgid "%h" msgstr "%h" -#: ../../library/tkinter.rst:911 +#: ../../library/tkinter.rst:910 msgid "height" msgstr "height" -#: ../../library/tkinter.rst:911 +#: ../../library/tkinter.rst:910 msgid "%E" msgstr "%E" -#: ../../library/tkinter.rst:911 +#: ../../library/tkinter.rst:910 msgid "send_event" msgstr "send_event" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:912 msgid "%k" msgstr "%k" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:912 msgid "keycode" msgstr "keycode" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:912 msgid "%K" msgstr "%K" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:912 msgid "keysym" msgstr "keysym" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:914 msgid "%s" msgstr "%s" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:914 msgid "state" msgstr "state" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:914 msgid "%N" msgstr "%N" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:914 msgid "keysym_num" msgstr "keysym_num" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:916 msgid "%t" msgstr "%t" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:916 msgid "time" msgstr "time" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:916 msgid "%T" msgstr "%T" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:916 msgid "type" msgstr "type" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:918 msgid "%w" msgstr "%w" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:918 msgid "width" msgstr "width" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:918 msgid "%W" msgstr "%W" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:918 msgid "widget" msgstr "widget" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:920 msgid "%x" msgstr "%x" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:920 msgid "x" msgstr "x" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:920 msgid "%X" msgstr "%X" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:920 msgid "x_root" msgstr "x_root" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:922 msgid "%y" msgstr "%y" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:922 msgid "y" msgstr "y" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:922 msgid "%Y" msgstr "%Y" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:922 msgid "y_root" msgstr "y_root" -#: ../../library/tkinter.rst:928 +#: ../../library/tkinter.rst:927 msgid "The index Parameter" msgstr "index 參數" -#: ../../library/tkinter.rst:930 +#: ../../library/tkinter.rst:929 msgid "" "A number of widgets require \"index\" parameters to be passed. These are " "used to point at a specific place in a Text widget, or to particular " @@ -2093,11 +2093,11 @@ msgstr "" "許多元件需要傳遞 \"index\" 參數。這些參數用於指向 Text 元件中的特定位置、" "Entry 元件中的特定字元,或 Menu 元件中的特定選單項目。" -#: ../../library/tkinter.rst:934 +#: ../../library/tkinter.rst:933 msgid "Entry widget indexes (index, view index, etc.)" msgstr "Entry 元件索引(index、view index 等)" -#: ../../library/tkinter.rst:935 +#: ../../library/tkinter.rst:934 msgid "" "Entry widgets have options that refer to character positions in the text " "being displayed. You can use these :mod:`tkinter` functions to access these " @@ -2106,21 +2106,21 @@ msgstr "" "Entry 元件具有參照所顯示文字中字元位置的選項。你可以使用這些 :mod:`tkinter` " "函式來存取文字元件中的這些特殊點:" -#: ../../library/tkinter.rst:939 +#: ../../library/tkinter.rst:938 msgid "Text widget indexes" msgstr "Text 元件索引" -#: ../../library/tkinter.rst:940 +#: ../../library/tkinter.rst:939 msgid "" "The index notation for Text widgets is very rich and is best described in " "the Tk man pages." msgstr "Text 元件的索引表示法非常豐富,在 Tk man pages 中有最好的描述。" -#: ../../library/tkinter.rst:943 +#: ../../library/tkinter.rst:942 msgid "Menu indexes (menu.invoke(), menu.entryconfig(), etc.)" msgstr "選單索引(menu.invoke()、menu.entryconfig() 等)" -#: ../../library/tkinter.rst:944 +#: ../../library/tkinter.rst:943 msgid "" "Some options and methods for menus manipulate specific menu entries. Anytime " "a menu index is needed for an option or a parameter, you may pass in:" @@ -2128,23 +2128,23 @@ msgstr "" "選單的某些選項和方法會操作特定的選單項目。每當選項或參數需要選單索引時,你可" "以傳入:" -#: ../../library/tkinter.rst:947 +#: ../../library/tkinter.rst:946 msgid "" "an integer which refers to the numeric position of the entry in the widget, " "counted from the top, starting with 0;" msgstr "一個整數,它參照元件中項目的數字位置,從頂部開始計數,從 0 開始;" -#: ../../library/tkinter.rst:950 +#: ../../library/tkinter.rst:949 msgid "" "the string ``\"active\"``, which refers to the menu position that is " "currently under the cursor;" msgstr "字串 ``\"active\"``,它參照目前在游標下的選單位置;" -#: ../../library/tkinter.rst:953 +#: ../../library/tkinter.rst:952 msgid "the string ``\"last\"`` which refers to the last menu item;" msgstr "字串 ``\"last\"``,它參照最後一個選單項目;" -#: ../../library/tkinter.rst:955 +#: ../../library/tkinter.rst:954 msgid "" "An integer preceded by ``@``, as in ``@6``, where the integer is interpreted " "as a y pixel coordinate in the menu's coordinate system;" @@ -2152,7 +2152,7 @@ msgstr "" "一個以 ``@`` 為前綴的整數,如 ``@6``,其中該整數被解釋為選單座標系統中的 y 像" "素座標;" -#: ../../library/tkinter.rst:958 +#: ../../library/tkinter.rst:957 msgid "" "the string ``\"none\"``, which indicates no menu entry at all, most often " "used with menu.activate() to deactivate all entries, and finally," @@ -2160,7 +2160,7 @@ msgstr "" "字串 ``\"none\"``,表示完全沒有選單項目,最常用於 menu.activate() 以停用所有" "項目,最後," -#: ../../library/tkinter.rst:961 +#: ../../library/tkinter.rst:960 msgid "" "a text string that is pattern matched against the label of the menu entry, " "as scanned from the top of the menu to the bottom. Note that this index " @@ -2172,21 +2172,21 @@ msgstr "" "此索引類型在所有其他類型之後考慮,這意味著標籤為 ``last``、``active`` 或 " "``none`` 的選單項目的匹配可能會被解釋為上述的字面值。" -#: ../../library/tkinter.rst:969 +#: ../../library/tkinter.rst:968 msgid "Images" msgstr "圖片" -#: ../../library/tkinter.rst:971 +#: ../../library/tkinter.rst:970 msgid "" "Images of different formats can be created through the corresponding " "subclass of :class:`tkinter.Image`:" msgstr "可以透過 :class:`tkinter.Image` 的相應子類別來建立不同格式的圖片:" -#: ../../library/tkinter.rst:974 +#: ../../library/tkinter.rst:973 msgid ":class:`BitmapImage` for images in XBM format." msgstr ":class:`BitmapImage` 用於 XBM 格式的圖片。" -#: ../../library/tkinter.rst:976 +#: ../../library/tkinter.rst:975 msgid "" ":class:`PhotoImage` for images in PGM, PPM, GIF and PNG formats. The latter " "is supported starting with Tk 8.6." @@ -2194,14 +2194,14 @@ msgstr "" ":class:`PhotoImage` 用於 PGM、PPM、GIF 和 PNG 格式的圖片。後者從 Tk 8.6 開始" "支援。" -#: ../../library/tkinter.rst:979 +#: ../../library/tkinter.rst:978 msgid "" "Either type of image is created through either the ``file`` or the ``data`` " "option (other options are available as well)." msgstr "" "任一類型的圖片都是透過 ``file`` 或 ``data`` 選項建立的(也有其他選項可用)。" -#: ../../library/tkinter.rst:982 +#: ../../library/tkinter.rst:981 msgid "" "Added the :class:`!PhotoImage` method :meth:`!copy_replace` to copy a region " "from one image to other image, possibly with pixel zooming and/or " @@ -2215,7 +2215,7 @@ msgstr "" "subsample`。將 *zoom* 和 *subsample* 參數新增到 :class:`!PhotoImage` 方法 :" "meth:`!copy`。" -#: ../../library/tkinter.rst:991 +#: ../../library/tkinter.rst:990 msgid "" "The image object can then be used wherever an ``image`` option is supported " "by some widget (e.g. labels, buttons, menus). In these cases, Tk will not " @@ -2227,7 +2227,7 @@ msgstr "" "用。在這些情況下,Tk 將不會保留對圖片的參照。當對圖片物件的最後一個 Python 參" "照被刪除時,圖片資料也會被刪除,Tk 將在使用該圖片的任何地方顯示一個空框。" -#: ../../library/tkinter.rst:999 +#: ../../library/tkinter.rst:998 msgid "" "The `Pillow `_ package adds support for formats " "such as BMP, JPEG, TIFF, and WebP, among others." @@ -2235,11 +2235,11 @@ msgstr "" "`Pillow `_ 套件新增了對 BMP、JPEG、TIFF 和 WebP " "等格式的支援。" -#: ../../library/tkinter.rst:1005 +#: ../../library/tkinter.rst:1004 msgid "File Handlers" msgstr "檔案處理常式" -#: ../../library/tkinter.rst:1007 +#: ../../library/tkinter.rst:1006 msgid "" "Tk allows you to register and unregister a callback function which will be " "called from the Tk mainloop when I/O is possible on a file descriptor. Only " @@ -2248,7 +2248,7 @@ msgstr "" "Tk 允許你註冊和取消註冊一個回呼函式,當檔案描述器上可以進行 I/O 時,該函式將" "從 Tk 主迴圈中被呼叫。每個檔案描述器只能註冊一個處理常式。範例程式碼: ::" -#: ../../library/tkinter.rst:1011 +#: ../../library/tkinter.rst:1010 msgid "" "import tkinter\n" "widget = tkinter.Tk()\n" @@ -2264,11 +2264,11 @@ msgstr "" "...\n" "widget.tk.deletefilehandler(file)" -#: ../../library/tkinter.rst:1018 +#: ../../library/tkinter.rst:1017 msgid "This feature is not available on Windows." msgstr "此功能在 Windows 上不可用。" -#: ../../library/tkinter.rst:1020 +#: ../../library/tkinter.rst:1019 msgid "" "Since you don't know how many bytes are available for reading, you may not " "want to use the :class:`~io.BufferedIOBase` or :class:`~io.TextIOBase` :meth:" @@ -2285,7 +2285,7 @@ msgstr "" "法可以正常運作;對於其他檔案,請使用原始讀取或 ``os.read(file.fileno(), " "maxbytecount)``。" -#: ../../library/tkinter.rst:1031 +#: ../../library/tkinter.rst:1030 msgid "" "Registers the file handler callback function *func*. The *file* argument may " "either be an object with a :meth:`~io.IOBase.fileno` method (such as a file " @@ -2298,15 +2298,15 @@ msgstr "" "器。*mask* 引數是下面三個常數中任意一個的 OR 組合。回呼函式被呼叫的方式如" "下: ::" -#: ../../library/tkinter.rst:1037 +#: ../../library/tkinter.rst:1036 msgid "callback(file, mask)" msgstr "callback(file, mask)" -#: ../../library/tkinter.rst:1042 +#: ../../library/tkinter.rst:1041 msgid "Unregisters a file handler." msgstr "取消註冊檔案處理常式。" -#: ../../library/tkinter.rst:1049 +#: ../../library/tkinter.rst:1048 msgid "Constants used in the *mask* arguments." msgstr "用於 *mask* 引數的常數。" @@ -2318,11 +2318,11 @@ msgstr "packing(元件)" msgid "window manager (widgets)" msgstr "視窗管理器(元件)" -#: ../../library/tkinter.rst:866 +#: ../../library/tkinter.rst:865 msgid "bind (widgets)" msgstr "bind(元件)" -#: ../../library/tkinter.rst:866 +#: ../../library/tkinter.rst:865 msgid "events (widgets)" msgstr "事件(元件)" diff --git a/library/tokenize.po b/library/tokenize.po index 90da94efa3f..19da1be9e4e 100644 --- a/library/tokenize.po +++ b/library/tokenize.po @@ -227,7 +227,7 @@ msgstr "" #: ../../library/tokenize.rst:153 msgid "Command-Line Usage" -msgstr "" +msgstr "命令列用法" #: ../../library/tokenize.rst:157 msgid "" diff --git a/library/traceback.po b/library/traceback.po index f8ae57c03bf..82709ec956d 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -835,6 +835,14 @@ msgid "" ">>> traceback.format_exception_only(an_error)\n" "['IndexError: tuple index out of range\\n']" msgstr "" +">>> import traceback\n" +">>> traceback.format_list([('spam.py', 3, '', 'spam.eggs()'),\n" +"... ('eggs.py', 42, 'eggs', 'return \"bacon\"')])\n" +"[' File \"spam.py\", line 3, in \\n spam.eggs()\\n',\n" +" ' File \"eggs.py\", line 42, in eggs\\n return \"bacon\"\\n']\n" +">>> an_error = IndexError('tuple index out of range')\n" +">>> traceback.format_exception_only(an_error)\n" +"['IndexError: tuple index out of range\\n']" #: ../../library/traceback.rst:718 msgid "Examples of Using :class:`TracebackException`" diff --git a/library/turtle.po b/library/turtle.po index b134109998e..167466940b4 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-10-14 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,8 +37,8 @@ msgid "" "developed by Wally Feurzeig, Seymour Papert and Cynthia Solomon in 1967." msgstr "" "龜圖學是由 Wally Feurzeig,Seymour Papert 與 Cynthia Solomon 於 1967 年開發" -"的,一個 `以 Logo 程式語言撰寫的廣受歡迎的幾何繪圖工具 `_。" +"的,一個 `以 Logo 程式語言撰寫的廣受歡迎的幾何繪圖工具 `_。" #: ../../library/turtle.rst:34 msgid "Get started" @@ -157,7 +157,7 @@ msgid "" msgstr "" #: ../../library/turtle.rst:110 ../../library/turtle.rst:364 -#: ../../library/turtle.rst:1058 +#: ../../library/turtle.rst:1062 msgid "Pen control" msgstr "" @@ -322,8 +322,8 @@ msgstr "" #: ../../library/turtle.rst:200 msgid "" "The turtle module makes this possible by exposing all its basic " -"functionality as functions, available with ``from turtle import *``. " -"The :ref:`turtle graphics tutorial ` covers this approach." +"functionality as functions, available with ``from turtle import *``. The :" +"ref:`turtle graphics tutorial ` covers this approach." msgstr "" #: ../../library/turtle.rst:204 @@ -579,7 +579,7 @@ msgstr ":func:`setheading` | :func:`seth`" msgid ":func:`home`" msgstr ":func:`home`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2832 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2862 msgid ":func:`circle`" msgstr ":func:`circle`" @@ -587,7 +587,7 @@ msgstr ":func:`circle`" msgid ":func:`dot`" msgstr ":func:`dot`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2810 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2840 msgid ":func:`stamp`" msgstr ":func:`stamp`" @@ -607,7 +607,7 @@ msgstr ":func:`undo`" msgid ":func:`speed`" msgstr ":func:`speed`" -#: ../../library/turtle.rst:352 ../../library/turtle.rst:907 +#: ../../library/turtle.rst:352 ../../library/turtle.rst:911 msgid "Tell Turtle's state" msgstr "" @@ -647,7 +647,7 @@ msgstr ":func:`degrees`" msgid ":func:`radians`" msgstr ":func:`radians`" -#: ../../library/turtle.rst:365 ../../library/turtle.rst:1061 +#: ../../library/turtle.rst:365 ../../library/turtle.rst:1065 msgid "Drawing state" msgstr "" @@ -671,7 +671,7 @@ msgstr ":func:`pen`" msgid ":func:`isdown`" msgstr ":func:`isdown`" -#: ../../library/turtle.rst:372 ../../library/turtle.rst:1153 +#: ../../library/turtle.rst:372 ../../library/turtle.rst:1157 msgid "Color control" msgstr "" @@ -687,7 +687,7 @@ msgstr ":func:`pencolor`" msgid ":func:`fillcolor`" msgstr ":func:`fillcolor`" -#: ../../library/turtle.rst:377 ../../library/turtle.rst:1285 +#: ../../library/turtle.rst:377 ../../library/turtle.rst:1296 msgid "Filling" msgstr "" @@ -707,7 +707,7 @@ msgstr ":func:`begin_fill`" msgid ":func:`end_fill`" msgstr ":func:`end_fill`" -#: ../../library/turtle.rst:383 ../../library/turtle.rst:1355 +#: ../../library/turtle.rst:383 ../../library/turtle.rst:1366 msgid "More drawing control" msgstr "" @@ -723,11 +723,11 @@ msgstr ":func:`clear`" msgid ":func:`write`" msgstr ":func:`write`" -#: ../../library/turtle.rst:388 ../../library/turtle.rst:1401 +#: ../../library/turtle.rst:388 ../../library/turtle.rst:1412 msgid "Turtle state" msgstr "" -#: ../../library/turtle.rst:389 ../../library/turtle.rst:1404 +#: ../../library/turtle.rst:389 ../../library/turtle.rst:1415 msgid "Visibility" msgstr "" @@ -743,7 +743,7 @@ msgstr ":func:`hideturtle` | :func:`ht`" msgid ":func:`isvisible`" msgstr ":func:`isvisible`" -#: ../../library/turtle.rst:394 ../../library/turtle.rst:1443 +#: ../../library/turtle.rst:394 ../../library/turtle.rst:1454 msgid "Appearance" msgstr "" @@ -779,11 +779,11 @@ msgstr ":func:`shapetransform`" msgid ":func:`get_shapepoly`" msgstr ":func:`get_shapepoly`" -#: ../../library/turtle.rst:404 ../../library/turtle.rst:1626 +#: ../../library/turtle.rst:404 ../../library/turtle.rst:1637 msgid "Using events" msgstr "" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2804 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2834 msgid ":func:`onclick`" msgstr ":func:`onclick`" @@ -791,11 +791,11 @@ msgstr ":func:`onclick`" msgid ":func:`onrelease`" msgstr ":func:`onrelease`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2787 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2817 msgid ":func:`ondrag`" msgstr ":func:`ondrag`" -#: ../../library/turtle.rst:409 ../../library/turtle.rst:1700 +#: ../../library/turtle.rst:409 ../../library/turtle.rst:1711 msgid "Special Turtle methods" msgstr "" @@ -815,7 +815,7 @@ msgstr ":func:`end_poly`" msgid ":func:`get_poly`" msgstr ":func:`get_poly`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2826 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2856 msgid ":func:`clone`" msgstr ":func:`clone`" @@ -839,7 +839,7 @@ msgstr ":func:`undobufferentries`" msgid "Methods of TurtleScreen/Screen" msgstr "" -#: ../../library/turtle.rst:424 ../../library/turtle.rst:1871 +#: ../../library/turtle.rst:424 ../../library/turtle.rst:1882 msgid "Window control" msgstr "" @@ -867,7 +867,7 @@ msgstr ":func:`screensize`" msgid ":func:`setworldcoordinates`" msgstr ":func:`setworldcoordinates`" -#: ../../library/turtle.rst:432 ../../library/turtle.rst:1995 +#: ../../library/turtle.rst:432 ../../library/turtle.rst:2025 msgid "Animation control" msgstr "" @@ -887,7 +887,7 @@ msgstr ":func:`tracer`" msgid ":func:`update`" msgstr ":func:`update`" -#: ../../library/turtle.rst:438 ../../library/turtle.rst:2065 +#: ../../library/turtle.rst:438 ../../library/turtle.rst:2095 msgid "Using screen events" msgstr "" @@ -915,7 +915,7 @@ msgstr ":func:`ontimer`" msgid ":func:`mainloop` | :func:`done`" msgstr ":func:`mainloop` | :func:`done`" -#: ../../library/turtle.rst:446 ../../library/turtle.rst:2210 +#: ../../library/turtle.rst:446 ../../library/turtle.rst:2240 msgid "Settings and special methods" msgstr "" @@ -951,7 +951,7 @@ msgstr ":func:`window_height`" msgid ":func:`window_width`" msgstr ":func:`window_width`" -#: ../../library/turtle.rst:456 ../../library/turtle.rst:2174 +#: ../../library/turtle.rst:456 ../../library/turtle.rst:2204 msgid "Input methods" msgstr "" @@ -1034,7 +1034,7 @@ msgstr "" "(-50.00,0.00)" #: ../../library/turtle.rst:502 ../../library/turtle.rst:744 -#: ../../library/turtle.rst:1011 ../../library/turtle.rst:1542 +#: ../../library/turtle.rst:1015 ../../library/turtle.rst:1553 msgid "a number" msgstr "" @@ -1111,8 +1111,8 @@ msgstr "" #: ../../library/turtle.rst:579 msgid "" -"If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` " -"(e.g. as returned by :func:`pos`)." +"If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` (e." +"g. as returned by :func:`pos`)." msgstr "" #: ../../library/turtle.rst:582 @@ -1317,7 +1317,7 @@ msgstr "" msgid "a number (or ``None``)" msgstr "" -#: ../../library/turtle.rst:746 ../../library/turtle.rst:839 +#: ../../library/turtle.rst:746 ../../library/turtle.rst:843 msgid "an integer (or ``None``)" msgstr "" @@ -1358,21 +1358,21 @@ msgid "" "180.0" msgstr "" -#: ../../library/turtle.rst:782 +#: ../../library/turtle.rst:786 msgid "an integer >= 1 (if given)" msgstr "" -#: ../../library/turtle.rst:783 +#: ../../library/turtle.rst:787 msgid "a colorstring or a numeric color tuple" msgstr "" -#: ../../library/turtle.rst:785 +#: ../../library/turtle.rst:789 msgid "" "Draw a circular dot with diameter *size*, using *color*. If *size* is not " -"given, the maximum of pensize+4 and 2*pensize is used." +"given, the maximum of ``pensize+4`` and ``2*pensize`` is used." msgstr "" -#: ../../library/turtle.rst:789 +#: ../../library/turtle.rst:793 msgid "" ">>> turtle.home()\n" ">>> turtle.dot()\n" @@ -1390,14 +1390,14 @@ msgstr "" ">>> turtle.heading()\n" "0.0" -#: ../../library/turtle.rst:803 +#: ../../library/turtle.rst:807 msgid "" "Stamp a copy of the turtle shape onto the canvas at the current turtle " "position. Return a stamp_id for that stamp, which can be used to delete it " "by calling ``clearstamp(stamp_id)``." msgstr "" -#: ../../library/turtle.rst:807 +#: ../../library/turtle.rst:811 msgid "" ">>> turtle.color(\"blue\")\n" ">>> stamp_id = turtle.stamp()\n" @@ -1407,15 +1407,15 @@ msgstr "" ">>> stamp_id = turtle.stamp()\n" ">>> turtle.fd(50)" -#: ../../library/turtle.rst:817 +#: ../../library/turtle.rst:821 msgid "an integer, must be return value of previous :func:`stamp` call" msgstr "" -#: ../../library/turtle.rst:820 +#: ../../library/turtle.rst:824 msgid "Delete stamp with given *stampid*." msgstr "" -#: ../../library/turtle.rst:822 +#: ../../library/turtle.rst:826 msgid "" ">>> turtle.position()\n" "(150.00,-0.00)\n" @@ -1439,14 +1439,14 @@ msgstr "" ">>> turtle.position()\n" "(200.00,-0.00)" -#: ../../library/turtle.rst:841 +#: ../../library/turtle.rst:845 msgid "" "Delete all or first/last *n* of turtle's stamps. If *n* is ``None``, delete " "all stamps, if *n* > 0 delete first *n* stamps, else if *n* < 0 delete last " "*n* stamps." msgstr "" -#: ../../library/turtle.rst:845 +#: ../../library/turtle.rst:849 msgid "" ">>> for i in range(8):\n" "... unused_stamp_id = turtle.stamp()\n" @@ -1462,13 +1462,13 @@ msgstr "" ">>> turtle.clearstamps(-2)\n" ">>> turtle.clearstamps()" -#: ../../library/turtle.rst:857 +#: ../../library/turtle.rst:861 msgid "" "Undo (repeatedly) the last turtle action(s). Number of available undo " "actions is determined by the size of the undobuffer." msgstr "" -#: ../../library/turtle.rst:860 +#: ../../library/turtle.rst:864 msgid "" ">>> for i in range(4):\n" "... turtle.fd(50); turtle.lt(80)\n" @@ -1482,55 +1482,55 @@ msgstr "" ">>> for i in range(8):\n" "... turtle.undo()" -#: ../../library/turtle.rst:872 +#: ../../library/turtle.rst:876 msgid "an integer in the range 0..10 or a speedstring (see below)" msgstr "" -#: ../../library/turtle.rst:874 +#: ../../library/turtle.rst:878 msgid "" "Set the turtle's speed to an integer value in the range 0..10. If no " "argument is given, return current speed." msgstr "" -#: ../../library/turtle.rst:877 +#: ../../library/turtle.rst:881 msgid "" "If input is a number greater than 10 or smaller than 0.5, speed is set to " "0. Speedstrings are mapped to speedvalues as follows:" msgstr "" -#: ../../library/turtle.rst:880 +#: ../../library/turtle.rst:884 msgid "\"fastest\": 0" msgstr "" -#: ../../library/turtle.rst:881 +#: ../../library/turtle.rst:885 msgid "\"fast\": 10" msgstr "" -#: ../../library/turtle.rst:882 +#: ../../library/turtle.rst:886 msgid "\"normal\": 6" msgstr "" -#: ../../library/turtle.rst:883 +#: ../../library/turtle.rst:887 msgid "\"slow\": 3" msgstr "" -#: ../../library/turtle.rst:884 +#: ../../library/turtle.rst:888 msgid "\"slowest\": 1" msgstr "" -#: ../../library/turtle.rst:886 +#: ../../library/turtle.rst:890 msgid "" "Speeds from 1 to 10 enforce increasingly faster animation of line drawing " "and turtle turning." msgstr "" -#: ../../library/turtle.rst:889 +#: ../../library/turtle.rst:893 msgid "" "Attention: *speed* = 0 means that *no* animation takes place. forward/back " "makes turtle jump and likewise left/right make the turtle turn instantly." msgstr "" -#: ../../library/turtle.rst:893 +#: ../../library/turtle.rst:897 msgid "" ">>> turtle.speed()\n" "3\n" @@ -1550,12 +1550,12 @@ msgstr "" ">>> turtle.speed()\n" "9" -#: ../../library/turtle.rst:912 +#: ../../library/turtle.rst:916 msgid "" "Return the turtle's current location (x,y) (as a :class:`Vec2D` vector)." msgstr "" -#: ../../library/turtle.rst:914 +#: ../../library/turtle.rst:918 msgid "" ">>> turtle.pos()\n" "(440.00,-0.00)" @@ -1563,15 +1563,15 @@ msgstr "" ">>> turtle.pos()\n" "(440.00,-0.00)" -#: ../../library/turtle.rst:923 ../../library/turtle.rst:986 +#: ../../library/turtle.rst:927 ../../library/turtle.rst:990 msgid "a number or a pair/vector of numbers or a turtle instance" msgstr "" -#: ../../library/turtle.rst:924 ../../library/turtle.rst:987 +#: ../../library/turtle.rst:928 ../../library/turtle.rst:991 msgid "a number if *x* is a number, else ``None``" msgstr "" -#: ../../library/turtle.rst:926 +#: ../../library/turtle.rst:930 msgid "" "Return the angle between the line from turtle position to position specified " "by (x,y), the vector or the other turtle. This depends on the turtle's " @@ -1579,7 +1579,7 @@ msgid "" "\"logo\"." msgstr "" -#: ../../library/turtle.rst:930 +#: ../../library/turtle.rst:934 msgid "" ">>> turtle.goto(10, 10)\n" ">>> turtle.towards(0,0)\n" @@ -1589,11 +1589,11 @@ msgstr "" ">>> turtle.towards(0,0)\n" "225.0" -#: ../../library/turtle.rst:940 +#: ../../library/turtle.rst:944 msgid "Return the turtle's x coordinate." msgstr "" -#: ../../library/turtle.rst:942 +#: ../../library/turtle.rst:946 msgid "" ">>> turtle.home()\n" ">>> turtle.left(50)\n" @@ -1611,11 +1611,11 @@ msgstr "" ">>> print(round(turtle.xcor(), 5))\n" "64.27876" -#: ../../library/turtle.rst:956 +#: ../../library/turtle.rst:960 msgid "Return the turtle's y coordinate." msgstr "" -#: ../../library/turtle.rst:958 +#: ../../library/turtle.rst:962 msgid "" ">>> turtle.home()\n" ">>> turtle.left(60)\n" @@ -1633,13 +1633,13 @@ msgstr "" ">>> print(round(turtle.ycor(), 5))\n" "86.60254" -#: ../../library/turtle.rst:972 +#: ../../library/turtle.rst:976 msgid "" -"Return the turtle's current heading (value depends on the turtle mode, " -"see :func:`mode`)." +"Return the turtle's current heading (value depends on the turtle mode, see :" +"func:`mode`)." msgstr "" -#: ../../library/turtle.rst:975 +#: ../../library/turtle.rst:979 msgid "" ">>> turtle.home()\n" ">>> turtle.left(67)\n" @@ -1651,13 +1651,13 @@ msgstr "" ">>> turtle.heading()\n" "67.0" -#: ../../library/turtle.rst:989 +#: ../../library/turtle.rst:993 msgid "" "Return the distance from the turtle to (x,y), the given vector, or the given " "other turtle, in turtle step units." msgstr "" -#: ../../library/turtle.rst:992 +#: ../../library/turtle.rst:996 msgid "" ">>> turtle.home()\n" ">>> turtle.distance(30,40)\n" @@ -1679,17 +1679,17 @@ msgstr "" ">>> turtle.distance(joe)\n" "77.0" -#: ../../library/turtle.rst:1007 +#: ../../library/turtle.rst:1011 msgid "Settings for measurement" msgstr "" -#: ../../library/turtle.rst:1013 +#: ../../library/turtle.rst:1017 msgid "" "Set angle measurement units, i.e. set number of \"degrees\" for a full " "circle. Default value is 360 degrees." msgstr "" -#: ../../library/turtle.rst:1016 +#: ../../library/turtle.rst:1020 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1706,13 +1706,13 @@ msgid "" "90.0" msgstr "" -#: ../../library/turtle.rst:1036 +#: ../../library/turtle.rst:1040 msgid "" -"Set the angle measurement units to radians. Equivalent to " -"``degrees(2*math.pi)``." +"Set the angle measurement units to radians. Equivalent to ``degrees(2*math." +"pi)``." msgstr "" -#: ../../library/turtle.rst:1039 +#: ../../library/turtle.rst:1043 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1730,87 +1730,87 @@ msgstr "" ">>> turtle.heading()\n" "1.5707963267948966" -#: ../../library/turtle.rst:1067 +#: ../../library/turtle.rst:1071 msgid "Pull the pen down -- drawing when moving." msgstr "" -#: ../../library/turtle.rst:1074 +#: ../../library/turtle.rst:1078 msgid "Pull the pen up -- no drawing when moving." msgstr "" -#: ../../library/turtle.rst:1080 +#: ../../library/turtle.rst:1084 msgid "a positive number" msgstr "" -#: ../../library/turtle.rst:1082 +#: ../../library/turtle.rst:1086 msgid "" "Set the line thickness to *width* or return it. If resizemode is set to " "\"auto\" and turtleshape is a polygon, that polygon is drawn with the same " "line thickness. If no argument is given, the current pensize is returned." msgstr "" -#: ../../library/turtle.rst:1086 +#: ../../library/turtle.rst:1090 msgid "" ">>> turtle.pensize()\n" "1\n" ">>> turtle.pensize(10) # from here on lines of width 10 are drawn" msgstr "" -#: ../../library/turtle.rst:1096 +#: ../../library/turtle.rst:1100 msgid "a dictionary with some or all of the below listed keys" msgstr "" -#: ../../library/turtle.rst:1097 +#: ../../library/turtle.rst:1101 msgid "one or more keyword-arguments with the below listed keys as keywords" msgstr "" -#: ../../library/turtle.rst:1099 +#: ../../library/turtle.rst:1103 msgid "" "Return or set the pen's attributes in a \"pen-dictionary\" with the " "following key/value pairs:" msgstr "" -#: ../../library/turtle.rst:1102 +#: ../../library/turtle.rst:1106 msgid "\"shown\": True/False" msgstr "" -#: ../../library/turtle.rst:1103 +#: ../../library/turtle.rst:1107 msgid "\"pendown\": True/False" msgstr "" -#: ../../library/turtle.rst:1104 +#: ../../library/turtle.rst:1108 msgid "\"pencolor\": color-string or color-tuple" msgstr "" -#: ../../library/turtle.rst:1105 +#: ../../library/turtle.rst:1109 msgid "\"fillcolor\": color-string or color-tuple" msgstr "" -#: ../../library/turtle.rst:1106 +#: ../../library/turtle.rst:1110 msgid "\"pensize\": positive number" msgstr "" -#: ../../library/turtle.rst:1107 +#: ../../library/turtle.rst:1111 msgid "\"speed\": number in range 0..10" msgstr "" -#: ../../library/turtle.rst:1108 +#: ../../library/turtle.rst:1112 msgid "\"resizemode\": \"auto\" or \"user\" or \"noresize\"" msgstr "" -#: ../../library/turtle.rst:1109 +#: ../../library/turtle.rst:1113 msgid "\"stretchfactor\": (positive number, positive number)" msgstr "" -#: ../../library/turtle.rst:1110 +#: ../../library/turtle.rst:1114 msgid "\"outline\": positive number" msgstr "" -#: ../../library/turtle.rst:1111 +#: ../../library/turtle.rst:1115 msgid "\"tilt\": number" msgstr "" -#: ../../library/turtle.rst:1113 +#: ../../library/turtle.rst:1117 msgid "" "This dictionary can be used as argument for a subsequent call to :func:`pen` " "to restore the former pen-state. Moreover one or more of these attributes " @@ -1818,7 +1818,7 @@ msgid "" "attributes in one statement." msgstr "" -#: ../../library/turtle.rst:1118 +#: ../../library/turtle.rst:1122 msgid "" ">>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n" ">>> sorted(turtle.pen().items())\n" @@ -1850,11 +1850,11 @@ msgstr "" ">>> sorted(turtle.pen().items())[:3]\n" "[('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red')]" -#: ../../library/turtle.rst:1139 +#: ../../library/turtle.rst:1143 msgid "Return ``True`` if pen is down, ``False`` if it's up." msgstr "" -#: ../../library/turtle.rst:1141 +#: ../../library/turtle.rst:1145 msgid "" ">>> turtle.penup()\n" ">>> turtle.isdown()\n" @@ -1870,62 +1870,64 @@ msgstr "" ">>> turtle.isdown()\n" "True" -#: ../../library/turtle.rst:1157 +#: ../../library/turtle.rst:1163 msgid "Return or set the pencolor." msgstr "" -#: ../../library/turtle.rst:1159 ../../library/turtle.rst:1208 +#: ../../library/turtle.rst:1165 ../../library/turtle.rst:1216 +#: ../../library/turtle.rst:1890 msgid "Four input formats are allowed:" msgstr "" -#: ../../library/turtle.rst:1161 +#: ../../library/turtle.rst:1167 msgid "``pencolor()``" msgstr "``pencolor()``" -#: ../../library/turtle.rst:1162 +#: ../../library/turtle.rst:1168 msgid "" "Return the current pencolor as color specification string or as a tuple (see " -"example). May be used as input to another color/pencolor/fillcolor call." +"example). May be used as input to another color/pencolor/fillcolor/bgcolor " +"call." msgstr "" -#: ../../library/turtle.rst:1166 +#: ../../library/turtle.rst:1172 msgid "``pencolor(colorstring)``" msgstr "``pencolor(colorstring)``" -#: ../../library/turtle.rst:1167 +#: ../../library/turtle.rst:1173 msgid "" "Set pencolor to *colorstring*, which is a Tk color specification string, " "such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: ../../library/turtle.rst:1170 +#: ../../library/turtle.rst:1176 msgid "``pencolor((r, g, b))``" msgstr "``pencolor((r, g, b))``" -#: ../../library/turtle.rst:1171 +#: ../../library/turtle.rst:1177 msgid "" "Set pencolor to the RGB color represented by the tuple of *r*, *g*, and " "*b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where " "colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: ../../library/turtle.rst:1175 +#: ../../library/turtle.rst:1181 msgid "``pencolor(r, g, b)``" msgstr "``pencolor(r, g, b)``" -#: ../../library/turtle.rst:1176 +#: ../../library/turtle.rst:1182 msgid "" "Set pencolor to the RGB color represented by *r*, *g*, and *b*. Each of " "*r*, *g*, and *b* must be in the range 0..colormode." msgstr "" -#: ../../library/turtle.rst:1179 +#: ../../library/turtle.rst:1185 msgid "" "If turtleshape is a polygon, the outline of that polygon is drawn with the " "newly set pencolor." msgstr "" -#: ../../library/turtle.rst:1182 +#: ../../library/turtle.rst:1188 msgid "" ">>> colormode()\n" "1.0\n" @@ -1963,59 +1965,59 @@ msgstr "" ">>> turtle.pencolor()\n" "(50.0, 193.0, 143.0)" -#: ../../library/turtle.rst:1206 +#: ../../library/turtle.rst:1214 msgid "Return or set the fillcolor." msgstr "" -#: ../../library/turtle.rst:1210 +#: ../../library/turtle.rst:1218 msgid "``fillcolor()``" msgstr "``fillcolor()``" -#: ../../library/turtle.rst:1211 +#: ../../library/turtle.rst:1219 msgid "" "Return the current fillcolor as color specification string, possibly in " "tuple format (see example). May be used as input to another color/pencolor/" -"fillcolor call." +"fillcolor/bgcolor call." msgstr "" -#: ../../library/turtle.rst:1215 +#: ../../library/turtle.rst:1223 msgid "``fillcolor(colorstring)``" msgstr "``fillcolor(colorstring)``" -#: ../../library/turtle.rst:1216 +#: ../../library/turtle.rst:1224 msgid "" "Set fillcolor to *colorstring*, which is a Tk color specification string, " "such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: ../../library/turtle.rst:1219 +#: ../../library/turtle.rst:1227 msgid "``fillcolor((r, g, b))``" msgstr "``fillcolor((r, g, b))``" -#: ../../library/turtle.rst:1220 +#: ../../library/turtle.rst:1228 msgid "" "Set fillcolor to the RGB color represented by the tuple of *r*, *g*, and " "*b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where " "colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: ../../library/turtle.rst:1224 +#: ../../library/turtle.rst:1232 msgid "``fillcolor(r, g, b)``" msgstr "``fillcolor(r, g, b)``" -#: ../../library/turtle.rst:1225 +#: ../../library/turtle.rst:1233 msgid "" "Set fillcolor to the RGB color represented by *r*, *g*, and *b*. Each of " "*r*, *g*, and *b* must be in the range 0..colormode." msgstr "" -#: ../../library/turtle.rst:1228 +#: ../../library/turtle.rst:1236 msgid "" "If turtleshape is a polygon, the interior of that polygon is drawn with the " "newly set fillcolor." msgstr "" -#: ../../library/turtle.rst:1231 +#: ../../library/turtle.rst:1239 msgid "" ">>> turtle.fillcolor(\"violet\")\n" ">>> turtle.fillcolor()\n" @@ -2041,55 +2043,55 @@ msgstr "" ">>> turtle.fillcolor()\n" "(255.0, 255.0, 255.0)" -#: ../../library/turtle.rst:1249 +#: ../../library/turtle.rst:1260 msgid "Return or set pencolor and fillcolor." msgstr "" -#: ../../library/turtle.rst:1251 +#: ../../library/turtle.rst:1262 msgid "" "Several input formats are allowed. They use 0 to 3 arguments as follows:" msgstr "" -#: ../../library/turtle.rst:1254 +#: ../../library/turtle.rst:1265 msgid "``color()``" msgstr "``color()``" -#: ../../library/turtle.rst:1255 +#: ../../library/turtle.rst:1266 msgid "" "Return the current pencolor and the current fillcolor as a pair of color " -"specification strings or tuples as returned by :func:`pencolor` " -"and :func:`fillcolor`." +"specification strings or tuples as returned by :func:`pencolor` and :func:" +"`fillcolor`." msgstr "" -#: ../../library/turtle.rst:1259 +#: ../../library/turtle.rst:1270 msgid "``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)``" msgstr "``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)``" -#: ../../library/turtle.rst:1260 +#: ../../library/turtle.rst:1271 msgid "" "Inputs as in :func:`pencolor`, set both, fillcolor and pencolor, to the " "given value." msgstr "" -#: ../../library/turtle.rst:1263 +#: ../../library/turtle.rst:1274 msgid "" "``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))``" msgstr "" "``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))``" -#: ../../library/turtle.rst:1264 +#: ../../library/turtle.rst:1275 msgid "" "Equivalent to ``pencolor(colorstring1)`` and ``fillcolor(colorstring2)`` and " "analogously if the other input format is used." msgstr "" -#: ../../library/turtle.rst:1267 +#: ../../library/turtle.rst:1278 msgid "" "If turtleshape is a polygon, outline and interior of that polygon is drawn " "with the newly set colors." msgstr "" -#: ../../library/turtle.rst:1270 +#: ../../library/turtle.rst:1281 msgid "" ">>> turtle.color(\"red\", \"green\")\n" ">>> turtle.color()\n" @@ -2105,15 +2107,15 @@ msgstr "" ">>> color()\n" "((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))" -#: ../../library/turtle.rst:1281 +#: ../../library/turtle.rst:1292 msgid "See also: Screen method :func:`colormode`." msgstr "" -#: ../../library/turtle.rst:1295 +#: ../../library/turtle.rst:1306 msgid "Return fillstate (``True`` if filling, ``False`` else)." msgstr "" -#: ../../library/turtle.rst:1297 +#: ../../library/turtle.rst:1308 msgid "" ">>> turtle.begin_fill()\n" ">>> if turtle.filling():\n" @@ -2127,11 +2129,11 @@ msgstr "" "... else:\n" "... turtle.pensize(3)" -#: ../../library/turtle.rst:1308 +#: ../../library/turtle.rst:1319 msgid "Fill the shape drawn in the ``with turtle.fill():`` block." msgstr "" -#: ../../library/turtle.rst:1310 +#: ../../library/turtle.rst:1321 msgid "" ">>> turtle.color(\"black\", \"red\")\n" ">>> with turtle.fill():\n" @@ -2141,13 +2143,13 @@ msgstr "" ">>> with turtle.fill():\n" "... turtle.circle(80)" -#: ../../library/turtle.rst:1317 +#: ../../library/turtle.rst:1328 msgid "" "Using :func:`!fill` is equivalent to adding the :func:`begin_fill` before " "the fill-block and :func:`end_fill` after the fill-block:" msgstr "" -#: ../../library/turtle.rst:1320 ../../library/turtle.rst:1345 +#: ../../library/turtle.rst:1331 ../../library/turtle.rst:1356 msgid "" ">>> turtle.color(\"black\", \"red\")\n" ">>> turtle.begin_fill()\n" @@ -2159,15 +2161,15 @@ msgstr "" ">>> turtle.circle(80)\n" ">>> turtle.end_fill()" -#: ../../library/turtle.rst:1333 +#: ../../library/turtle.rst:1344 msgid "To be called just before drawing a shape to be filled." msgstr "" -#: ../../library/turtle.rst:1338 +#: ../../library/turtle.rst:1349 msgid "Fill the shape drawn after the last call to :func:`begin_fill`." msgstr "" -#: ../../library/turtle.rst:1340 +#: ../../library/turtle.rst:1351 msgid "" "Whether or not overlap regions for self-intersecting polygons or multiple " "shapes are filled depends on the operating system graphics, type of overlap, " @@ -2175,13 +2177,13 @@ msgid "" "all yellow or have some white regions." msgstr "" -#: ../../library/turtle.rst:1359 +#: ../../library/turtle.rst:1370 msgid "" "Delete the turtle's drawings from the screen, re-center the turtle and set " "variables to the default values." msgstr "" -#: ../../library/turtle.rst:1362 +#: ../../library/turtle.rst:1373 msgid "" ">>> turtle.goto(0,-22)\n" ">>> turtle.left(100)\n" @@ -2207,30 +2209,30 @@ msgstr "" ">>> turtle.heading()\n" "0.0" -#: ../../library/turtle.rst:1380 +#: ../../library/turtle.rst:1391 msgid "" "Delete the turtle's drawings from the screen. Do not move turtle. State " "and position of the turtle as well as drawings of other turtles are not " "affected." msgstr "" -#: ../../library/turtle.rst:1386 +#: ../../library/turtle.rst:1397 msgid "object to be written to the TurtleScreen" msgstr "" -#: ../../library/turtle.rst:1387 +#: ../../library/turtle.rst:1398 msgid "True/False" msgstr "True/False" -#: ../../library/turtle.rst:1388 +#: ../../library/turtle.rst:1399 msgid "one of the strings \"left\", \"center\" or right\"" msgstr "" -#: ../../library/turtle.rst:1389 +#: ../../library/turtle.rst:1400 msgid "a triple (fontname, fontsize, fonttype)" msgstr "" -#: ../../library/turtle.rst:1391 +#: ../../library/turtle.rst:1402 msgid "" "Write text - the string representation of *arg* - at the current turtle " "position according to *align* (\"left\", \"center\" or \"right\") and with " @@ -2238,44 +2240,44 @@ msgid "" "corner of the text. By default, *move* is ``False``." msgstr "" -#: ../../library/turtle.rst:1409 +#: ../../library/turtle.rst:1420 msgid "" "Make the turtle invisible. It's a good idea to do this while you're in the " "middle of doing some complex drawing, because hiding the turtle speeds up " "the drawing observably." msgstr "" -#: ../../library/turtle.rst:1413 +#: ../../library/turtle.rst:1424 msgid ">>> turtle.hideturtle()" msgstr ">>> turtle.hideturtle()" -#: ../../library/turtle.rst:1422 +#: ../../library/turtle.rst:1433 msgid "Make the turtle visible." msgstr "" -#: ../../library/turtle.rst:1424 +#: ../../library/turtle.rst:1435 msgid ">>> turtle.showturtle()" msgstr ">>> turtle.showturtle()" -#: ../../library/turtle.rst:1432 +#: ../../library/turtle.rst:1443 msgid "Return ``True`` if the Turtle is shown, ``False`` if it's hidden." msgstr "" -#: ../../library/turtle.rst:1447 +#: ../../library/turtle.rst:1458 msgid "a string which is a valid shapename" msgstr "" -#: ../../library/turtle.rst:1449 +#: ../../library/turtle.rst:1460 msgid "" "Set turtle shape to shape with given *name* or, if name is not given, return " "name of current shape. Shape with *name* must exist in the TurtleScreen's " "shape dictionary. Initially there are the following polygon shapes: " "\"arrow\", \"turtle\", \"circle\", \"square\", \"triangle\", \"classic\". " -"To learn about how to deal with shapes see Screen " -"method :func:`register_shape`." +"To learn about how to deal with shapes see Screen method :func:" +"`register_shape`." msgstr "" -#: ../../library/turtle.rst:1455 +#: ../../library/turtle.rst:1466 msgid "" ">>> turtle.shape()\n" "'classic'\n" @@ -2289,40 +2291,40 @@ msgstr "" ">>> turtle.shape()\n" "'turtle'" -#: ../../library/turtle.rst:1467 +#: ../../library/turtle.rst:1478 msgid "one of the strings \"auto\", \"user\", \"noresize\"" msgstr "" -#: ../../library/turtle.rst:1469 +#: ../../library/turtle.rst:1480 msgid "" "Set resizemode to one of the values: \"auto\", \"user\", \"noresize\". If " "*rmode* is not given, return current resizemode. Different resizemodes have " "the following effects:" msgstr "" -#: ../../library/turtle.rst:1473 +#: ../../library/turtle.rst:1484 msgid "" "\"auto\": adapts the appearance of the turtle corresponding to the value of " "pensize." msgstr "" -#: ../../library/turtle.rst:1474 +#: ../../library/turtle.rst:1485 msgid "" "\"user\": adapts the appearance of the turtle according to the values of " "stretchfactor and outlinewidth (outline), which are set by :func:`shapesize`." msgstr "" -#: ../../library/turtle.rst:1477 +#: ../../library/turtle.rst:1488 msgid "\"noresize\": no adaption of the turtle's appearance takes place." msgstr "" -#: ../../library/turtle.rst:1479 +#: ../../library/turtle.rst:1490 msgid "" "``resizemode(\"user\")`` is called by :func:`shapesize` when used with " "arguments." msgstr "" -#: ../../library/turtle.rst:1481 +#: ../../library/turtle.rst:1492 msgid "" ">>> turtle.resizemode()\n" "'noresize'\n" @@ -2336,12 +2338,12 @@ msgstr "" ">>> turtle.resizemode()\n" "'auto'" -#: ../../library/turtle.rst:1494 ../../library/turtle.rst:1495 -#: ../../library/turtle.rst:1496 +#: ../../library/turtle.rst:1505 ../../library/turtle.rst:1506 +#: ../../library/turtle.rst:1507 msgid "positive number" msgstr "" -#: ../../library/turtle.rst:1498 +#: ../../library/turtle.rst:1509 msgid "" "Return or set the pen's attributes x/y-stretchfactors and/or outline. Set " "resizemode to \"user\". If and only if resizemode is set to \"user\", the " @@ -2351,7 +2353,7 @@ msgid "" "determines the width of the shape's outline." msgstr "" -#: ../../library/turtle.rst:1505 +#: ../../library/turtle.rst:1516 msgid "" ">>> turtle.shapesize()\n" "(1.0, 1.0, 1)\n" @@ -2373,12 +2375,12 @@ msgstr "" ">>> turtle.shapesize()\n" "(5, 5, 8)" -#: ../../library/turtle.rst:1521 ../../library/turtle.rst:2193 -#: ../../library/turtle.rst:2194 ../../library/turtle.rst:2195 +#: ../../library/turtle.rst:1532 ../../library/turtle.rst:2223 +#: ../../library/turtle.rst:2224 ../../library/turtle.rst:2225 msgid "number (optional)" msgstr "" -#: ../../library/turtle.rst:1523 +#: ../../library/turtle.rst:1534 msgid "" "Set or return the current shearfactor. Shear the turtleshape according to " "the given shearfactor shear, which is the tangent of the shear angle. Do " @@ -2387,7 +2389,7 @@ msgid "" "by which lines parallel to the heading of the turtle are sheared." msgstr "" -#: ../../library/turtle.rst:1530 +#: ../../library/turtle.rst:1541 msgid "" ">>> turtle.shape(\"circle\")\n" ">>> turtle.shapesize(5,2)\n" @@ -2401,13 +2403,13 @@ msgstr "" ">>> turtle.shearfactor()\n" "0.5" -#: ../../library/turtle.rst:1544 +#: ../../library/turtle.rst:1555 msgid "" "Rotate the turtleshape by *angle* from its current tilt-angle, but do *not* " "change the turtle's heading (direction of movement)." msgstr "" -#: ../../library/turtle.rst:1547 +#: ../../library/turtle.rst:1558 msgid "" ">>> turtle.reset()\n" ">>> turtle.shape(\"circle\")\n" @@ -2425,13 +2427,13 @@ msgstr "" ">>> turtle.tilt(30)\n" ">>> turtle.fd(50)" -#: ../../library/turtle.rst:1561 ../../library/turtle.rst:1584 -#: ../../library/turtle.rst:1585 ../../library/turtle.rst:1586 -#: ../../library/turtle.rst:1587 +#: ../../library/turtle.rst:1572 ../../library/turtle.rst:1595 +#: ../../library/turtle.rst:1596 ../../library/turtle.rst:1597 +#: ../../library/turtle.rst:1598 msgid "a number (optional)" msgstr "" -#: ../../library/turtle.rst:1563 +#: ../../library/turtle.rst:1574 msgid "" "Set or return the current tilt-angle. If angle is given, rotate the " "turtleshape to point in the direction specified by angle, regardless of its " @@ -2441,7 +2443,7 @@ msgid "" "turtle (its direction of movement)." msgstr "" -#: ../../library/turtle.rst:1571 +#: ../../library/turtle.rst:1582 msgid "" ">>> turtle.reset()\n" ">>> turtle.shape(\"circle\")\n" @@ -2457,11 +2459,11 @@ msgstr "" ">>> turtle.tiltangle()\n" "45.0" -#: ../../library/turtle.rst:1589 +#: ../../library/turtle.rst:1600 msgid "Set or return the current transformation matrix of the turtle shape." msgstr "" -#: ../../library/turtle.rst:1591 +#: ../../library/turtle.rst:1602 msgid "" "If none of the matrix elements are given, return the transformation matrix " "as a tuple of 4 elements. Otherwise set the given elements and transform the " @@ -2471,7 +2473,7 @@ msgid "" "tiltangle according to the given matrix." msgstr "" -#: ../../library/turtle.rst:1600 +#: ../../library/turtle.rst:1611 msgid "" ">>> turtle = Turtle()\n" ">>> turtle.shape(\"square\")\n" @@ -2487,13 +2489,13 @@ msgstr "" ">>> turtle.shapetransform()\n" "(4.0, -1.0, -0.0, 2.0)" -#: ../../library/turtle.rst:1613 +#: ../../library/turtle.rst:1624 msgid "" "Return the current shape polygon as tuple of coordinate pairs. This can be " "used to define a new shape or components of a compound shape." msgstr "" -#: ../../library/turtle.rst:1616 +#: ../../library/turtle.rst:1627 msgid "" ">>> turtle.shape(\"square\")\n" ">>> turtle.shapetransform(4, -1, 0, 2)\n" @@ -2505,33 +2507,33 @@ msgstr "" ">>> turtle.get_shapepoly()\n" "((50, -20), (30, 20), (-50, 20), (-30, -20))" -#: ../../library/turtle.rst:1631 ../../library/turtle.rst:1653 -#: ../../library/turtle.rst:1678 ../../library/turtle.rst:2117 +#: ../../library/turtle.rst:1642 ../../library/turtle.rst:1664 +#: ../../library/turtle.rst:1689 ../../library/turtle.rst:2147 msgid "" "a function with two arguments which will be called with the coordinates of " "the clicked point on the canvas" msgstr "" -#: ../../library/turtle.rst:1633 ../../library/turtle.rst:1655 -#: ../../library/turtle.rst:1680 ../../library/turtle.rst:2119 +#: ../../library/turtle.rst:1644 ../../library/turtle.rst:1666 +#: ../../library/turtle.rst:1691 ../../library/turtle.rst:2149 msgid "number of the mouse-button, defaults to 1 (left mouse button)" msgstr "" -#: ../../library/turtle.rst:1634 ../../library/turtle.rst:1656 -#: ../../library/turtle.rst:1681 ../../library/turtle.rst:2120 +#: ../../library/turtle.rst:1645 ../../library/turtle.rst:1667 +#: ../../library/turtle.rst:1692 ../../library/turtle.rst:2150 msgid "" "``True`` or ``False`` -- if ``True``, a new binding will be added, otherwise " "it will replace a former binding" msgstr "" -#: ../../library/turtle.rst:1637 +#: ../../library/turtle.rst:1648 msgid "" "Bind *fun* to mouse-click events on this turtle. If *fun* is ``None``, " "existing bindings are removed. Example for the anonymous turtle, i.e. the " "procedural way:" msgstr "" -#: ../../library/turtle.rst:1641 +#: ../../library/turtle.rst:1652 msgid "" ">>> def turn(x, y):\n" "... left(180)\n" @@ -2540,13 +2542,13 @@ msgid "" ">>> onclick(None) # event-binding will be removed" msgstr "" -#: ../../library/turtle.rst:1659 +#: ../../library/turtle.rst:1670 msgid "" "Bind *fun* to mouse-button-release events on this turtle. If *fun* is " "``None``, existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:1662 +#: ../../library/turtle.rst:1673 msgid "" ">>> class MyTurtle(Turtle):\n" "... def glow(self,x,y):\n" @@ -2560,35 +2562,35 @@ msgid "" ">>> turtle.onrelease(turtle.unglow) # releasing turns it to transparent." msgstr "" -#: ../../library/turtle.rst:1684 +#: ../../library/turtle.rst:1695 msgid "" "Bind *fun* to mouse-move events on this turtle. If *fun* is ``None``, " "existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:1687 +#: ../../library/turtle.rst:1698 msgid "" "Remark: Every sequence of mouse-move-events on a turtle is preceded by a " "mouse-click event on that turtle." msgstr "" -#: ../../library/turtle.rst:1690 +#: ../../library/turtle.rst:1701 msgid ">>> turtle.ondrag(turtle.goto)" msgstr ">>> turtle.ondrag(turtle.goto)" -#: ../../library/turtle.rst:1695 +#: ../../library/turtle.rst:1706 msgid "" "Subsequently, clicking and dragging the Turtle will move it across the " "screen thereby producing handdrawings (if pen is down)." msgstr "" -#: ../../library/turtle.rst:1705 +#: ../../library/turtle.rst:1716 msgid "" "Record the vertices of a polygon drawn in the ``with turtle.poly():`` block. " "The first and last vertices will be connected." msgstr "" -#: ../../library/turtle.rst:1708 +#: ../../library/turtle.rst:1719 msgid "" ">>> with turtle.poly():\n" "... turtle.forward(100)\n" @@ -2600,23 +2602,23 @@ msgstr "" "... turtle.right(60)\n" "... turtle.forward(100)" -#: ../../library/turtle.rst:1721 +#: ../../library/turtle.rst:1732 msgid "" "Start recording the vertices of a polygon. Current turtle position is first " "vertex of polygon." msgstr "" -#: ../../library/turtle.rst:1727 +#: ../../library/turtle.rst:1738 msgid "" "Stop recording the vertices of a polygon. Current turtle position is last " "vertex of polygon. This will be connected with the first vertex." msgstr "" -#: ../../library/turtle.rst:1733 +#: ../../library/turtle.rst:1744 msgid "Return the last recorded polygon." msgstr "" -#: ../../library/turtle.rst:1735 +#: ../../library/turtle.rst:1746 msgid "" ">>> turtle.home()\n" ">>> turtle.begin_poly()\n" @@ -2640,13 +2642,13 @@ msgstr "" ">>> p = turtle.get_poly()\n" ">>> register_shape(\"myFavouriteShape\", p)" -#: ../../library/turtle.rst:1752 +#: ../../library/turtle.rst:1763 msgid "" "Create and return a clone of the turtle with same position, heading and " "turtle properties." msgstr "" -#: ../../library/turtle.rst:1755 +#: ../../library/turtle.rst:1766 msgid "" ">>> mick = Turtle()\n" ">>> joe = mick.clone()" @@ -2654,13 +2656,13 @@ msgstr "" ">>> mick = Turtle()\n" ">>> joe = mick.clone()" -#: ../../library/turtle.rst:1765 +#: ../../library/turtle.rst:1776 msgid "" "Return the Turtle object itself. Only reasonable use: as a function to " "return the \"anonymous turtle\":" msgstr "" -#: ../../library/turtle.rst:1768 +#: ../../library/turtle.rst:1779 msgid "" ">>> pet = getturtle()\n" ">>> pet.fd(50)\n" @@ -2672,13 +2674,13 @@ msgstr "" ">>> pet\n" "" -#: ../../library/turtle.rst:1779 +#: ../../library/turtle.rst:1790 msgid "" "Return the :class:`TurtleScreen` object the turtle is drawing on. " "TurtleScreen methods can then be called for that object." msgstr "" -#: ../../library/turtle.rst:1782 +#: ../../library/turtle.rst:1793 msgid "" ">>> ts = turtle.getscreen()\n" ">>> ts\n" @@ -2690,11 +2692,11 @@ msgstr "" "\n" ">>> ts.bgcolor(\"pink\")" -#: ../../library/turtle.rst:1793 +#: ../../library/turtle.rst:1804 msgid "an integer or ``None``" msgstr "一個整數或 ``None``" -#: ../../library/turtle.rst:1795 +#: ../../library/turtle.rst:1806 msgid "" "Set or disable undobuffer. If *size* is an integer, an empty undobuffer of " "given size is installed. *size* gives the maximum number of turtle actions " @@ -2702,15 +2704,15 @@ msgid "" "``None``, the undobuffer is disabled." msgstr "" -#: ../../library/turtle.rst:1800 +#: ../../library/turtle.rst:1811 msgid ">>> turtle.setundobuffer(42)" msgstr ">>> turtle.setundobuffer(42)" -#: ../../library/turtle.rst:1808 +#: ../../library/turtle.rst:1819 msgid "Return number of entries in the undobuffer." msgstr "" -#: ../../library/turtle.rst:1810 +#: ../../library/turtle.rst:1821 msgid "" ">>> while undobufferentries():\n" "... undo()" @@ -2718,32 +2720,32 @@ msgstr "" ">>> while undobufferentries():\n" "... undo()" -#: ../../library/turtle.rst:1821 +#: ../../library/turtle.rst:1832 msgid "Compound shapes" msgstr "" -#: ../../library/turtle.rst:1823 +#: ../../library/turtle.rst:1834 msgid "" "To use compound turtle shapes, which consist of several polygons of " "different color, you must use the helper class :class:`Shape` explicitly as " "described below:" msgstr "" -#: ../../library/turtle.rst:1827 +#: ../../library/turtle.rst:1838 msgid "Create an empty Shape object of type \"compound\"." msgstr "" -#: ../../library/turtle.rst:1828 +#: ../../library/turtle.rst:1839 msgid "" -"Add as many components to this object as desired, using " -"the :meth:`~Shape.addcomponent` method." +"Add as many components to this object as desired, using the :meth:`~Shape." +"addcomponent` method." msgstr "" -#: ../../library/turtle.rst:1831 +#: ../../library/turtle.rst:1842 msgid "For example:" msgstr "舉例來說:" -#: ../../library/turtle.rst:1833 +#: ../../library/turtle.rst:1844 msgid "" ">>> s = Shape(\"compound\")\n" ">>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5))\n" @@ -2757,11 +2759,11 @@ msgstr "" ">>> poly2 = ((0,0),(10,-5),(-10,-5))\n" ">>> s.addcomponent(poly2, \"blue\", \"red\")" -#: ../../library/turtle.rst:1842 +#: ../../library/turtle.rst:1853 msgid "Now add the Shape to the Screen's shapelist and use it:" msgstr "" -#: ../../library/turtle.rst:1844 +#: ../../library/turtle.rst:1855 msgid "" ">>> register_shape(\"myshape\", s)\n" ">>> shape(\"myshape\")" @@ -2769,34 +2771,70 @@ msgstr "" ">>> register_shape(\"myshape\", s)\n" ">>> shape(\"myshape\")" -#: ../../library/turtle.rst:1853 +#: ../../library/turtle.rst:1864 msgid "" "The :class:`Shape` class is used internally by the :func:`register_shape` " "method in different ways. The application programmer has to deal with the " "Shape class *only* when using compound shapes like shown above!" msgstr "" -#: ../../library/turtle.rst:1859 +#: ../../library/turtle.rst:1870 msgid "Methods of TurtleScreen/Screen and corresponding functions" msgstr "" -#: ../../library/turtle.rst:1861 +#: ../../library/turtle.rst:1872 msgid "" "Most of the examples in this section refer to a TurtleScreen instance called " "``screen``." msgstr "" -#: ../../library/turtle.rst:1875 +#: ../../library/turtle.rst:1888 +msgid "Return or set the background color of the TurtleScreen." +msgstr "" + +#: ../../library/turtle.rst:1892 +msgid "``bgcolor()``" +msgstr "``bgcolor()``" + +#: ../../library/turtle.rst:1893 +msgid "" +"Return the current background color as color specification string or as a " +"tuple (see example). May be used as input to another color/pencolor/" +"fillcolor/bgcolor call." +msgstr "" + +#: ../../library/turtle.rst:1897 +msgid "``bgcolor(colorstring)``" +msgstr "``bgcolor(colorstring)``" + +#: ../../library/turtle.rst:1898 msgid "" -"a color string or three numbers in the range 0..colormode or a 3-tuple of " -"such numbers" +"Set the background color to *colorstring*, which is a Tk color specification " +"string, such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: ../../library/turtle.rst:1879 -msgid "Set or return background color of the TurtleScreen." +#: ../../library/turtle.rst:1901 +msgid "``bgcolor((r, g, b))``" +msgstr "``bgcolor((r, g, b))``" + +#: ../../library/turtle.rst:1902 +msgid "" +"Set the background color to the RGB color represented by the tuple of *r*, " +"*g*, and *b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, " +"where colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: ../../library/turtle.rst:1881 +#: ../../library/turtle.rst:1907 +msgid "``bgcolor(r, g, b)``" +msgstr "``bgcolor(r, g, b)``" + +#: ../../library/turtle.rst:1908 +msgid "" +"Set the background color to the RGB color represented by *r*, *g*, and *b*. " +"Each of *r*, *g*, and *b* must be in the range 0..colormode." +msgstr "" + +#: ../../library/turtle.rst:1911 msgid "" ">>> screen.bgcolor(\"orange\")\n" ">>> screen.bgcolor()\n" @@ -2812,13 +2850,13 @@ msgstr "" ">>> screen.bgcolor()\n" "(128.0, 0.0, 128.0)" -#: ../../library/turtle.rst:1894 +#: ../../library/turtle.rst:1924 msgid "" "a string, name of an image file (PNG, GIF, PGM, and PPM) or ``\"nopic\"``, " "or ``None``" msgstr "" -#: ../../library/turtle.rst:1897 +#: ../../library/turtle.rst:1927 msgid "" "Set background image or return name of current backgroundimage. If " "*picname* is a filename, set the corresponding image as background. If " @@ -2826,7 +2864,7 @@ msgid "" "*picname* is ``None``, return the filename of the current backgroundimage. ::" msgstr "" -#: ../../library/turtle.rst:1902 +#: ../../library/turtle.rst:1932 msgid "" ">>> screen.bgpic()\n" "'nopic'\n" @@ -2840,44 +2878,44 @@ msgstr "" ">>> screen.bgpic()\n" "\"landscape.gif\"" -#: ../../library/turtle.rst:1913 +#: ../../library/turtle.rst:1943 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``clearscreen``. The global function ``clear`` is a different one " "derived from the Turtle method ``clear``." msgstr "" -#: ../../library/turtle.rst:1920 +#: ../../library/turtle.rst:1950 msgid "" "Delete all drawings and all turtles from the TurtleScreen. Reset the now " "empty TurtleScreen to its initial state: white background, no background " "image, no event bindings and tracing on." msgstr "" -#: ../../library/turtle.rst:1929 +#: ../../library/turtle.rst:1959 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``resetscreen``. The global function ``reset`` is another one derived " "from the Turtle method ``reset``." msgstr "" -#: ../../library/turtle.rst:1936 +#: ../../library/turtle.rst:1966 msgid "Reset all Turtles on the Screen to their initial state." msgstr "" -#: ../../library/turtle.rst:1941 +#: ../../library/turtle.rst:1971 msgid "positive integer, new width of canvas in pixels" msgstr "" -#: ../../library/turtle.rst:1942 +#: ../../library/turtle.rst:1972 msgid "positive integer, new height of canvas in pixels" msgstr "" -#: ../../library/turtle.rst:1943 +#: ../../library/turtle.rst:1973 msgid "colorstring or color-tuple, new background color" msgstr "" -#: ../../library/turtle.rst:1945 +#: ../../library/turtle.rst:1975 msgid "" "If no arguments are given, return current (canvaswidth, canvasheight). Else " "resize the canvas the turtles are drawing on. Do not alter the drawing " @@ -2886,40 +2924,40 @@ msgid "" "outside the canvas before." msgstr "" -#: ../../library/turtle.rst:1957 +#: ../../library/turtle.rst:1987 msgid "e.g. to search for an erroneously escaped turtle ;-)" msgstr "" -#: ../../library/turtle.rst:1962 +#: ../../library/turtle.rst:1992 msgid "a number, x-coordinate of lower left corner of canvas" msgstr "" -#: ../../library/turtle.rst:1963 +#: ../../library/turtle.rst:1993 msgid "a number, y-coordinate of lower left corner of canvas" msgstr "" -#: ../../library/turtle.rst:1964 +#: ../../library/turtle.rst:1994 msgid "a number, x-coordinate of upper right corner of canvas" msgstr "" -#: ../../library/turtle.rst:1965 +#: ../../library/turtle.rst:1995 msgid "a number, y-coordinate of upper right corner of canvas" msgstr "" -#: ../../library/turtle.rst:1967 +#: ../../library/turtle.rst:1997 msgid "" "Set up user-defined coordinate system and switch to mode \"world\" if " "necessary. This performs a ``screen.reset()``. If mode \"world\" is " "already active, all drawings are redrawn according to the new coordinates." msgstr "" -#: ../../library/turtle.rst:1971 +#: ../../library/turtle.rst:2001 msgid "" "**ATTENTION**: in user-defined coordinate systems angles may appear " "distorted." msgstr "" -#: ../../library/turtle.rst:1974 +#: ../../library/turtle.rst:2004 msgid "" ">>> screen.reset()\n" ">>> screen.setworldcoordinates(-50,-7.5,50,7.5)\n" @@ -2929,15 +2967,22 @@ msgid "" ">>> for _ in range(8):\n" "... left(45); fd(2) # a regular octagon" msgstr "" +">>> screen.reset()\n" +">>> screen.setworldcoordinates(-50,-7.5,50,7.5)\n" +">>> for _ in range(72):\n" +"... left(10)\n" +"...\n" +">>> for _ in range(8):\n" +"... left(45); fd(2) # 一個一般的八邊形" -#: ../../library/turtle.rst:1999 +#: ../../library/turtle.rst:2029 msgid "" "Temporarily disable turtle animation. The code written inside the " "``no_animation`` block will not be animated; once the code block is exited, " "the drawing will appear." msgstr "" -#: ../../library/turtle.rst:2003 +#: ../../library/turtle.rst:2033 msgid "" ">>> with screen.no_animation():\n" "... for dist in range(2, 400, 2):\n" @@ -2949,22 +2994,22 @@ msgstr "" "... fd(dist)\n" "... rt(90)" -#: ../../library/turtle.rst:2016 +#: ../../library/turtle.rst:2046 msgid "positive integer" -msgstr "" +msgstr "正整數" -#: ../../library/turtle.rst:2018 +#: ../../library/turtle.rst:2048 msgid "" "Set or return the drawing *delay* in milliseconds. (This is approximately " "the time interval between two consecutive canvas updates.) The longer the " "drawing delay, the slower the animation." msgstr "" -#: ../../library/turtle.rst:2022 +#: ../../library/turtle.rst:2052 msgid "Optional argument:" -msgstr "" +msgstr "可選引數: ::" -#: ../../library/turtle.rst:2024 +#: ../../library/turtle.rst:2054 msgid "" ">>> screen.delay()\n" "10\n" @@ -2978,11 +3023,11 @@ msgstr "" ">>> screen.delay()\n" "5" -#: ../../library/turtle.rst:2036 ../../library/turtle.rst:2037 +#: ../../library/turtle.rst:2066 ../../library/turtle.rst:2067 msgid "nonnegative integer" -msgstr "" +msgstr "非負整數" -#: ../../library/turtle.rst:2039 +#: ../../library/turtle.rst:2069 msgid "" "Turn turtle animation on/off and set delay for update drawings. If *n* is " "given, only each n-th regular screen update is really performed. (Can be " @@ -2991,7 +3036,7 @@ msgid "" "delay value (see :func:`delay`)." msgstr "" -#: ../../library/turtle.rst:2046 +#: ../../library/turtle.rst:2076 msgid "" ">>> screen.tracer(8, 25)\n" ">>> dist = 2\n" @@ -3007,37 +3052,37 @@ msgstr "" "... rt(90)\n" "... dist += 2" -#: ../../library/turtle.rst:2059 +#: ../../library/turtle.rst:2089 msgid "Perform a TurtleScreen update. To be used when tracer is turned off." msgstr "" -#: ../../library/turtle.rst:2061 +#: ../../library/turtle.rst:2091 msgid "See also the RawTurtle/Turtle method :func:`speed`." msgstr "另請參閱 RawTurtle/Turtle 的 :func:`speed` 方法。" -#: ../../library/turtle.rst:2069 +#: ../../library/turtle.rst:2099 msgid "" "Set focus on TurtleScreen (in order to collect key-events). Dummy arguments " "are provided in order to be able to pass :func:`listen` to the onclick " "method." msgstr "" -#: ../../library/turtle.rst:2076 ../../library/turtle.rst:2096 +#: ../../library/turtle.rst:2106 ../../library/turtle.rst:2126 msgid "a function with no arguments or ``None``" msgstr "" -#: ../../library/turtle.rst:2077 ../../library/turtle.rst:2097 +#: ../../library/turtle.rst:2107 ../../library/turtle.rst:2127 msgid "a string: key (e.g. \"a\") or key-symbol (e.g. \"space\")" msgstr "" -#: ../../library/turtle.rst:2079 +#: ../../library/turtle.rst:2109 msgid "" "Bind *fun* to key-release event of key. If *fun* is ``None``, event " "bindings are removed. Remark: in order to be able to register key-events, " "TurtleScreen must have the focus. (See method :func:`listen`.)" msgstr "" -#: ../../library/turtle.rst:2083 +#: ../../library/turtle.rst:2113 msgid "" ">>> def f():\n" "... fd(50)\n" @@ -3053,14 +3098,14 @@ msgstr "" ">>> screen.onkey(f, \"Up\")\n" ">>> screen.listen()" -#: ../../library/turtle.rst:2099 +#: ../../library/turtle.rst:2129 msgid "" "Bind *fun* to key-press event of key if key is given, or to any key-press-" "event if no key is given. Remark: in order to be able to register key-" "events, TurtleScreen must have focus. (See method :func:`listen`.)" msgstr "" -#: ../../library/turtle.rst:2104 +#: ../../library/turtle.rst:2134 msgid "" ">>> def f():\n" "... fd(50)\n" @@ -3074,19 +3119,19 @@ msgstr "" ">>> screen.onkey(f, \"Up\")\n" ">>> screen.listen()" -#: ../../library/turtle.rst:2123 +#: ../../library/turtle.rst:2153 msgid "" "Bind *fun* to mouse-click events on this screen. If *fun* is ``None``, " "existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:2126 +#: ../../library/turtle.rst:2156 msgid "" "Example for a TurtleScreen instance named ``screen`` and a Turtle instance " "named ``turtle``:" msgstr "" -#: ../../library/turtle.rst:2129 +#: ../../library/turtle.rst:2159 msgid "" ">>> screen.onclick(turtle.goto) # Subsequently clicking into the " "TurtleScreen will\n" @@ -3095,26 +3140,26 @@ msgid "" ">>> screen.onclick(None) # remove event binding again" msgstr "" -#: ../../library/turtle.rst:2137 +#: ../../library/turtle.rst:2167 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``onscreenclick``. The global function ``onclick`` is another one " "derived from the Turtle method ``onclick``." msgstr "" -#: ../../library/turtle.rst:2144 +#: ../../library/turtle.rst:2174 msgid "a function with no arguments" msgstr "" -#: ../../library/turtle.rst:2145 +#: ../../library/turtle.rst:2175 msgid "a number >= 0" msgstr "" -#: ../../library/turtle.rst:2147 +#: ../../library/turtle.rst:2177 msgid "Install a timer that calls *fun* after *t* milliseconds." msgstr "" -#: ../../library/turtle.rst:2149 +#: ../../library/turtle.rst:2179 msgid "" ">>> running = True\n" ">>> def f():\n" @@ -3126,7 +3171,7 @@ msgid "" ">>> running = False" msgstr "" -#: ../../library/turtle.rst:2165 +#: ../../library/turtle.rst:2195 msgid "" "Starts event loop - calling Tkinter's mainloop function. Must be the last " "statement in a turtle graphics program. Must *not* be used if a script is " @@ -3134,16 +3179,16 @@ msgid "" "turtle graphics. ::" msgstr "" -#: ../../library/turtle.rst:2170 +#: ../../library/turtle.rst:2200 msgid ">>> screen.mainloop()" msgstr ">>> screen.mainloop()" -#: ../../library/turtle.rst:2178 ../../library/turtle.rst:2179 -#: ../../library/turtle.rst:2191 ../../library/turtle.rst:2192 +#: ../../library/turtle.rst:2208 ../../library/turtle.rst:2209 +#: ../../library/turtle.rst:2221 ../../library/turtle.rst:2222 msgid "string" msgstr "string(字串)" -#: ../../library/turtle.rst:2181 +#: ../../library/turtle.rst:2211 msgid "" "Pop up a dialog window for input of a string. Parameter title is the title " "of the dialog window, prompt is a text mostly describing what information to " @@ -3151,11 +3196,11 @@ msgid "" "``None``. ::" msgstr "" -#: ../../library/turtle.rst:2186 +#: ../../library/turtle.rst:2216 msgid ">>> screen.textinput(\"NIM\", \"Name of first player:\")" msgstr ">>> screen.textinput(\"NIM\", \"Name of first player:\")" -#: ../../library/turtle.rst:2197 +#: ../../library/turtle.rst:2227 msgid "" "Pop up a dialog window for input of a number. title is the title of the " "dialog window, prompt is a text mostly describing what numerical information " @@ -3166,7 +3211,7 @@ msgid "" "return ``None``. ::" msgstr "" -#: ../../library/turtle.rst:2206 +#: ../../library/turtle.rst:2236 msgid "" ">>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, " "maxval=10000)" @@ -3174,17 +3219,17 @@ msgstr "" ">>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, " "maxval=10000)" -#: ../../library/turtle.rst:2214 +#: ../../library/turtle.rst:2244 msgid "one of the strings \"standard\", \"logo\" or \"world\"" msgstr "" -#: ../../library/turtle.rst:2216 +#: ../../library/turtle.rst:2246 msgid "" "Set turtle mode (\"standard\", \"logo\" or \"world\") and perform reset. If " "mode is not given, current mode is returned." msgstr "" -#: ../../library/turtle.rst:2219 +#: ../../library/turtle.rst:2249 msgid "" "Mode \"standard\" is compatible with old :mod:`turtle`. Mode \"logo\" is " "compatible with most Logo turtle graphics. Mode \"world\" uses user-defined " @@ -3192,60 +3237,60 @@ msgid "" "if ``x/y`` unit-ratio doesn't equal 1." msgstr "" -#: ../../library/turtle.rst:2225 +#: ../../library/turtle.rst:2255 msgid "Mode" msgstr "" -#: ../../library/turtle.rst:2225 +#: ../../library/turtle.rst:2255 msgid "Initial turtle heading" msgstr "" -#: ../../library/turtle.rst:2225 +#: ../../library/turtle.rst:2255 msgid "positive angles" msgstr "" -#: ../../library/turtle.rst:2227 +#: ../../library/turtle.rst:2257 msgid "\"standard\"" msgstr "" -#: ../../library/turtle.rst:2227 +#: ../../library/turtle.rst:2257 msgid "to the right (east)" msgstr "" -#: ../../library/turtle.rst:2227 +#: ../../library/turtle.rst:2257 msgid "counterclockwise" msgstr "" -#: ../../library/turtle.rst:2228 +#: ../../library/turtle.rst:2258 msgid "\"logo\"" msgstr "" -#: ../../library/turtle.rst:2228 +#: ../../library/turtle.rst:2258 msgid "upward (north)" msgstr "" -#: ../../library/turtle.rst:2228 +#: ../../library/turtle.rst:2258 msgid "clockwise" msgstr "" -#: ../../library/turtle.rst:2231 +#: ../../library/turtle.rst:2261 msgid "" ">>> mode(\"logo\") # resets turtle heading to north\n" ">>> mode()\n" "'logo'" msgstr "" -#: ../../library/turtle.rst:2241 +#: ../../library/turtle.rst:2271 msgid "one of the values 1.0 or 255" msgstr "" -#: ../../library/turtle.rst:2243 +#: ../../library/turtle.rst:2273 msgid "" "Return the colormode or set it to 1.0 or 255. Subsequently *r*, *g*, *b* " "values of color triples have to be in the range 0..*cmode*." msgstr "" -#: ../../library/turtle.rst:2246 +#: ../../library/turtle.rst:2276 msgid "" ">>> screen.colormode(1)\n" ">>> turtle.pencolor(240, 160, 80)\n" @@ -3271,13 +3316,13 @@ msgstr "" "255\n" ">>> turtle.pencolor(240,160,80)" -#: ../../library/turtle.rst:2264 +#: ../../library/turtle.rst:2294 msgid "" "Return the Canvas of this TurtleScreen. Useful for insiders who know what " "to do with a Tkinter Canvas." msgstr "" -#: ../../library/turtle.rst:2267 +#: ../../library/turtle.rst:2297 msgid "" ">>> cv = screen.getcanvas()\n" ">>> cv\n" @@ -3287,11 +3332,11 @@ msgstr "" ">>> cv\n" "" -#: ../../library/turtle.rst:2277 +#: ../../library/turtle.rst:2307 msgid "Return a list of names of all currently available turtle shapes." msgstr "" -#: ../../library/turtle.rst:2279 +#: ../../library/turtle.rst:2309 msgid "" ">>> screen.getshapes()\n" "['arrow', 'blank', 'circle', ..., 'turtle']" @@ -3299,69 +3344,69 @@ msgstr "" ">>> screen.getshapes()\n" "['arrow', 'blank', 'circle', ..., 'turtle']" -#: ../../library/turtle.rst:2289 +#: ../../library/turtle.rst:2319 msgid "There are four different ways to call this function:" msgstr "" -#: ../../library/turtle.rst:2291 +#: ../../library/turtle.rst:2321 msgid "" "*name* is the name of an image file (PNG, GIF, PGM, and PPM) and *shape* is " "``None``: Install the corresponding image shape. ::" msgstr "" -#: ../../library/turtle.rst:2294 +#: ../../library/turtle.rst:2324 msgid ">>> screen.register_shape(\"turtle.gif\")" msgstr ">>> screen.register_shape(\"turtle.gif\")" -#: ../../library/turtle.rst:2297 ../../library/turtle.rst:2306 +#: ../../library/turtle.rst:2327 ../../library/turtle.rst:2336 msgid "" "Image shapes *do not* rotate when turning the turtle, so they do not display " "the heading of the turtle!" msgstr "" -#: ../../library/turtle.rst:2300 +#: ../../library/turtle.rst:2330 msgid "" "*name* is an arbitrary string and *shape* is the name of an image file (PNG, " "GIF, PGM, and PPM): Install the corresponding image shape. ::" msgstr "" -#: ../../library/turtle.rst:2303 +#: ../../library/turtle.rst:2333 msgid ">>> screen.register_shape(\"turtle\", \"turtle.gif\")" msgstr ">>> screen.register_shape(\"turtle\", \"turtle.gif\")" -#: ../../library/turtle.rst:2309 +#: ../../library/turtle.rst:2339 msgid "" "*name* is an arbitrary string and *shape* is a tuple of pairs of " "coordinates: Install the corresponding polygon shape." msgstr "" -#: ../../library/turtle.rst:2312 +#: ../../library/turtle.rst:2342 msgid ">>> screen.register_shape(\"triangle\", ((5,-3), (0,5), (-5,-3)))" msgstr ">>> screen.register_shape(\"triangle\", ((5,-3), (0,5), (-5,-3)))" -#: ../../library/turtle.rst:2317 +#: ../../library/turtle.rst:2347 msgid "" "*name* is an arbitrary string and *shape* is a (compound) :class:`Shape` " "object: Install the corresponding compound shape." msgstr "" -#: ../../library/turtle.rst:2320 +#: ../../library/turtle.rst:2350 msgid "" "Add a turtle shape to TurtleScreen's shapelist. Only thusly registered " "shapes can be used by issuing the command ``shape(shapename)``." msgstr "" -#: ../../library/turtle.rst:2323 +#: ../../library/turtle.rst:2353 msgid "" "Added support for PNG, PGM, and PPM image formats. Both a shape name and an " "image file name can be specified." msgstr "" -#: ../../library/turtle.rst:2330 +#: ../../library/turtle.rst:2360 msgid "Return the list of turtles on the screen." msgstr "" -#: ../../library/turtle.rst:2332 +#: ../../library/turtle.rst:2362 msgid "" ">>> for turtle in screen.turtles():\n" "... turtle.color(\"red\")" @@ -3369,11 +3414,11 @@ msgstr "" ">>> for turtle in screen.turtles():\n" "... turtle.color(\"red\")" -#: ../../library/turtle.rst:2341 +#: ../../library/turtle.rst:2371 msgid "Return the height of the turtle window. ::" msgstr "" -#: ../../library/turtle.rst:2343 +#: ../../library/turtle.rst:2373 msgid "" ">>> screen.window_height()\n" "480" @@ -3381,11 +3426,11 @@ msgstr "" ">>> screen.window_height()\n" "480" -#: ../../library/turtle.rst:2349 +#: ../../library/turtle.rst:2379 msgid "Return the width of the turtle window. ::" msgstr "" -#: ../../library/turtle.rst:2351 +#: ../../library/turtle.rst:2381 msgid "" ">>> screen.window_width()\n" "640" @@ -3393,43 +3438,43 @@ msgstr "" ">>> screen.window_width()\n" "640" -#: ../../library/turtle.rst:2358 +#: ../../library/turtle.rst:2388 msgid "Methods specific to Screen, not inherited from TurtleScreen" msgstr "" -#: ../../library/turtle.rst:2362 +#: ../../library/turtle.rst:2392 msgid "Shut the turtlegraphics window." msgstr "" -#: ../../library/turtle.rst:2367 +#: ../../library/turtle.rst:2397 msgid "Bind ``bye()`` method to mouse clicks on the Screen." msgstr "" -#: ../../library/turtle.rst:2370 +#: ../../library/turtle.rst:2400 msgid "" "If the value \"using_IDLE\" in the configuration dictionary is ``False`` " "(default value), also enter mainloop. Remark: If IDLE with the ``-n`` " -"switch (no subprocess) is used, this value should be set to ``True`` " -"in :file:`turtle.cfg`. In this case IDLE's own mainloop is active also for " -"the client script." +"switch (no subprocess) is used, this value should be set to ``True`` in :" +"file:`turtle.cfg`. In this case IDLE's own mainloop is active also for the " +"client script." msgstr "" -#: ../../library/turtle.rst:2379 +#: ../../library/turtle.rst:2409 msgid "Save the current turtle drawing (and turtles) as a PostScript file." msgstr "" -#: ../../library/turtle.rst:2381 +#: ../../library/turtle.rst:2411 msgid "the path of the saved PostScript file" msgstr "" -#: ../../library/turtle.rst:2382 +#: ../../library/turtle.rst:2412 msgid "" "if ``False`` and there already exists a file with the given filename, then " "the function will raise a ``FileExistsError``. If it is ``True``, the file " "will be overwritten." msgstr "" -#: ../../library/turtle.rst:2387 +#: ../../library/turtle.rst:2417 msgid "" ">>> screen.save(\"my_drawing.ps\")\n" ">>> screen.save(\"my_drawing.ps\", overwrite=True)" @@ -3437,38 +3482,38 @@ msgstr "" ">>> screen.save(\"my_drawing.ps\")\n" ">>> screen.save(\"my_drawing.ps\", overwrite=True)" -#: ../../library/turtle.rst:2397 +#: ../../library/turtle.rst:2427 msgid "" "Set the size and position of the main window. Default values of arguments " -"are stored in the configuration dictionary and can be changed via " -"a :file:`turtle.cfg` file." +"are stored in the configuration dictionary and can be changed via a :file:" +"`turtle.cfg` file." msgstr "" -#: ../../library/turtle.rst:2401 +#: ../../library/turtle.rst:2431 msgid "" "if an integer, a size in pixels, if a float, a fraction of the screen; " "default is 50% of screen" msgstr "" -#: ../../library/turtle.rst:2403 +#: ../../library/turtle.rst:2433 msgid "" "if an integer, the height in pixels, if a float, a fraction of the screen; " "default is 75% of screen" msgstr "" -#: ../../library/turtle.rst:2405 +#: ../../library/turtle.rst:2435 msgid "" "if positive, starting position in pixels from the left edge of the screen, " "if negative from the right edge, if ``None``, center window horizontally" msgstr "" -#: ../../library/turtle.rst:2408 +#: ../../library/turtle.rst:2438 msgid "" "if positive, starting position in pixels from the top edge of the screen, if " "negative from the bottom edge, if ``None``, center window vertically" msgstr "" -#: ../../library/turtle.rst:2412 +#: ../../library/turtle.rst:2442 msgid "" ">>> screen.setup (width=200, height=200, startx=0, starty=0)\n" ">>> # sets window to 200x200 pixels, in upper left of screen\n" @@ -3476,129 +3521,128 @@ msgid "" ">>> # sets window to 75% of screen by 50% of screen and centers" msgstr "" -#: ../../library/turtle.rst:2423 +#: ../../library/turtle.rst:2453 msgid "a string that is shown in the titlebar of the turtle graphics window" msgstr "" -#: ../../library/turtle.rst:2426 +#: ../../library/turtle.rst:2456 msgid "Set title of turtle window to *titlestring*." msgstr "" -#: ../../library/turtle.rst:2428 +#: ../../library/turtle.rst:2458 msgid ">>> screen.title(\"Welcome to the turtle zoo!\")" msgstr ">>> screen.title(\"Welcome to the turtle zoo!\")" -#: ../../library/turtle.rst:2435 +#: ../../library/turtle.rst:2465 msgid "Public classes" msgstr "" -#: ../../library/turtle.rst:2441 +#: ../../library/turtle.rst:2471 msgid "" -"a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or " -"a :class:`TurtleScreen`" +"a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or a :class:" +"`TurtleScreen`" msgstr "" -#: ../../library/turtle.rst:2444 +#: ../../library/turtle.rst:2474 msgid "" "Create a turtle. The turtle has all methods described above as \"methods of " "Turtle/RawTurtle\"." msgstr "" -#: ../../library/turtle.rst:2450 +#: ../../library/turtle.rst:2480 msgid "" -"Subclass of RawTurtle, has the same interface but draws on a " -"default :class:`Screen` object created automatically when needed for the " -"first time." +"Subclass of RawTurtle, has the same interface but draws on a default :class:" +"`Screen` object created automatically when needed for the first time." msgstr "" -#: ../../library/turtle.rst:2456 +#: ../../library/turtle.rst:2486 msgid "a :class:`!tkinter.Canvas`" msgstr "一個 :class:`!tkinter.Canvas`" -#: ../../library/turtle.rst:2458 +#: ../../library/turtle.rst:2488 msgid "" "Provides screen oriented methods like :func:`bgcolor` etc. that are " "described above." msgstr "" -#: ../../library/turtle.rst:2463 +#: ../../library/turtle.rst:2493 msgid "" "Subclass of TurtleScreen, with :ref:`four methods added `." msgstr "" -#: ../../library/turtle.rst:2468 +#: ../../library/turtle.rst:2498 msgid "" "some Tkinter widget to contain the ScrolledCanvas, i.e. a Tkinter-canvas " "with scrollbars added" msgstr "" -#: ../../library/turtle.rst:2471 +#: ../../library/turtle.rst:2501 msgid "" "Used by class Screen, which thus automatically provides a ScrolledCanvas as " "playground for the turtles." msgstr "" -#: ../../library/turtle.rst:2476 +#: ../../library/turtle.rst:2506 msgid "one of the strings \"polygon\", \"image\", \"compound\"" msgstr "" -#: ../../library/turtle.rst:2478 +#: ../../library/turtle.rst:2508 msgid "" "Data structure modeling shapes. The pair ``(type_, data)`` must follow this " "specification:" msgstr "" -#: ../../library/turtle.rst:2483 +#: ../../library/turtle.rst:2513 msgid "*type_*" msgstr "*type_*" -#: ../../library/turtle.rst:2483 +#: ../../library/turtle.rst:2513 msgid "*data*" msgstr "*data*" -#: ../../library/turtle.rst:2485 +#: ../../library/turtle.rst:2515 msgid "\"polygon\"" msgstr "\"polygon\"" -#: ../../library/turtle.rst:2485 +#: ../../library/turtle.rst:2515 msgid "a polygon-tuple, i.e. a tuple of pairs of coordinates" msgstr "" -#: ../../library/turtle.rst:2486 +#: ../../library/turtle.rst:2516 msgid "\"image\"" msgstr "\"image\"" -#: ../../library/turtle.rst:2486 +#: ../../library/turtle.rst:2516 msgid "an image (in this form only used internally!)" msgstr "" -#: ../../library/turtle.rst:2487 +#: ../../library/turtle.rst:2517 msgid "\"compound\"" msgstr "\"compound\"" -#: ../../library/turtle.rst:2487 +#: ../../library/turtle.rst:2517 msgid "" -"``None`` (a compound shape has to be constructed using " -"the :meth:`addcomponent` method)" +"``None`` (a compound shape has to be constructed using the :meth:" +"`addcomponent` method)" msgstr "" -#: ../../library/turtle.rst:2493 +#: ../../library/turtle.rst:2523 msgid "a polygon, i.e. a tuple of pairs of numbers" msgstr "" -#: ../../library/turtle.rst:2494 +#: ../../library/turtle.rst:2524 msgid "a color the *poly* will be filled with" msgstr "" -#: ../../library/turtle.rst:2495 +#: ../../library/turtle.rst:2525 msgid "a color for the poly's outline (if given)" msgstr "" -#: ../../library/turtle.rst:2497 +#: ../../library/turtle.rst:2527 msgid "Example:" msgstr "例如:" -#: ../../library/turtle.rst:2499 +#: ../../library/turtle.rst:2529 msgid "" ">>> poly = ((0,0),(10,-5),(0,10),(-10,-5))\n" ">>> s = Shape(\"compound\")\n" @@ -3606,81 +3650,80 @@ msgid "" ">>> # ... add more components and then use register_shape()" msgstr "" -#: ../../library/turtle.rst:2507 +#: ../../library/turtle.rst:2537 msgid "See :ref:`compoundshapes`." msgstr "請見\\ :ref:`compoundshapes`。" -#: ../../library/turtle.rst:2512 +#: ../../library/turtle.rst:2542 msgid "" "A two-dimensional vector class, used as a helper class for implementing " "turtle graphics. May be useful for turtle graphics programs too. Derived " "from tuple, so a vector is a tuple!" msgstr "" -#: ../../library/turtle.rst:2516 +#: ../../library/turtle.rst:2546 msgid "Provides (for *a*, *b* vectors, *k* number):" msgstr "" -#: ../../library/turtle.rst:2518 +#: ../../library/turtle.rst:2548 msgid "``a + b`` vector addition" msgstr "``a + b`` 向量加法" -#: ../../library/turtle.rst:2519 +#: ../../library/turtle.rst:2549 msgid "``a - b`` vector subtraction" msgstr "``a - b`` 向量減法" -#: ../../library/turtle.rst:2520 +#: ../../library/turtle.rst:2550 msgid "``a * b`` inner product" msgstr "``a * b`` 內積" -#: ../../library/turtle.rst:2521 +#: ../../library/turtle.rst:2551 msgid "``k * a`` and ``a * k`` multiplication with scalar" msgstr "" -#: ../../library/turtle.rst:2522 +#: ../../library/turtle.rst:2552 msgid "``abs(a)`` absolute value of a" msgstr "``abs(a)`` a 的絕對值" -#: ../../library/turtle.rst:2523 +#: ../../library/turtle.rst:2553 msgid "``a.rotate(angle)`` rotation" msgstr "``a.rotate(angle)`` 旋轉" -#: ../../library/turtle.rst:2529 +#: ../../library/turtle.rst:2559 msgid "Explanation" msgstr "解釋" -#: ../../library/turtle.rst:2531 +#: ../../library/turtle.rst:2561 msgid "" "A turtle object draws on a screen object, and there a number of key classes " "in the turtle object-oriented interface that can be used to create them and " "relate them to each other." msgstr "" -#: ../../library/turtle.rst:2535 +#: ../../library/turtle.rst:2565 msgid "" "A :class:`Turtle` instance will automatically create a :class:`Screen` " "instance if one is not already present." msgstr "" -#: ../../library/turtle.rst:2538 +#: ../../library/turtle.rst:2568 msgid "" "``Turtle`` is a subclass of :class:`RawTurtle`, which *doesn't* " "automatically create a drawing surface - a *canvas* will need to be provided " -"or created for it. The *canvas* can be a :class:`!" -"tkinter.Canvas`, :class:`ScrolledCanvas` or :class:`TurtleScreen`." +"or created for it. The *canvas* can be a :class:`!tkinter.Canvas`, :class:" +"`ScrolledCanvas` or :class:`TurtleScreen`." msgstr "" -#: ../../library/turtle.rst:2544 +#: ../../library/turtle.rst:2574 msgid "" -":class:`TurtleScreen` is the basic drawing surface for a " -"turtle. :class:`Screen` is a subclass of ``TurtleScreen``, and " -"includes :ref:`some additional methods ` for managing its " -"appearance (including size and title) and behaviour. ``TurtleScreen``'s " -"constructor needs a :class:`!tkinter.Canvas` or a :class:`ScrolledCanvas` as " -"an argument." +":class:`TurtleScreen` is the basic drawing surface for a turtle. :class:" +"`Screen` is a subclass of ``TurtleScreen``, and includes :ref:`some " +"additional methods ` for managing its appearance (including " +"size and title) and behaviour. ``TurtleScreen``'s constructor needs a :class:" +"`!tkinter.Canvas` or a :class:`ScrolledCanvas` as an argument." msgstr "" -#: ../../library/turtle.rst:2551 +#: ../../library/turtle.rst:2581 msgid "" "The functional interface for turtle graphics uses the various methods of " "``Turtle`` and ``TurtleScreen``/``Screen``. Behind the scenes, a screen " @@ -3689,38 +3732,38 @@ msgid "" "created whenever any of the functions derived from a Turtle method is called." msgstr "" -#: ../../library/turtle.rst:2557 +#: ../../library/turtle.rst:2587 msgid "" "To use multiple turtles on a screen, the object-oriented interface must be " "used." msgstr "" -#: ../../library/turtle.rst:2562 +#: ../../library/turtle.rst:2592 msgid "Help and configuration" msgstr "" -#: ../../library/turtle.rst:2565 +#: ../../library/turtle.rst:2595 msgid "How to use help" msgstr "" -#: ../../library/turtle.rst:2567 +#: ../../library/turtle.rst:2597 msgid "" "The public methods of the Screen and Turtle classes are documented " "extensively via docstrings. So these can be used as online-help via the " "Python help facilities:" msgstr "" -#: ../../library/turtle.rst:2571 +#: ../../library/turtle.rst:2601 msgid "" "When using IDLE, tooltips show the signatures and first lines of the " "docstrings of typed in function-/method calls." msgstr "" -#: ../../library/turtle.rst:2574 +#: ../../library/turtle.rst:2604 msgid "Calling :func:`help` on methods or functions displays the docstrings::" msgstr "" -#: ../../library/turtle.rst:2576 +#: ../../library/turtle.rst:2606 msgid "" ">>> help(Screen.bgcolor)\n" "Help on method bgcolor in module turtle:\n" @@ -3780,13 +3823,13 @@ msgstr "" "\n" " >>> turtle.penup()" -#: ../../library/turtle.rst:2605 +#: ../../library/turtle.rst:2635 msgid "" "The docstrings of the functions which are derived from methods have a " "modified form::" msgstr "" -#: ../../library/turtle.rst:2608 +#: ../../library/turtle.rst:2638 msgid "" ">>> help(bgcolor)\n" "Help on function bgcolor in module turtle:\n" @@ -3850,28 +3893,28 @@ msgstr "" " Example:\n" " >>> penup()" -#: ../../library/turtle.rst:2639 +#: ../../library/turtle.rst:2669 msgid "" "These modified docstrings are created automatically together with the " "function definitions that are derived from the methods at import time." msgstr "" -#: ../../library/turtle.rst:2644 +#: ../../library/turtle.rst:2674 msgid "Translation of docstrings into different languages" msgstr "" -#: ../../library/turtle.rst:2646 +#: ../../library/turtle.rst:2676 msgid "" "There is a utility to create a dictionary the keys of which are the method " "names and the values of which are the docstrings of the public methods of " "the classes Screen and Turtle." msgstr "" -#: ../../library/turtle.rst:2652 +#: ../../library/turtle.rst:2682 msgid "a string, used as filename" msgstr "" -#: ../../library/turtle.rst:2654 +#: ../../library/turtle.rst:2684 msgid "" "Create and write docstring-dictionary to a Python script with the given " "filename. This function has to be called explicitly (it is not used by the " @@ -3880,37 +3923,37 @@ msgid "" "for translation of the docstrings into different languages." msgstr "" -#: ../../library/turtle.rst:2660 +#: ../../library/turtle.rst:2690 msgid "" "If you (or your students) want to use :mod:`turtle` with online help in your " "native language, you have to translate the docstrings and save the resulting " "file as e.g. :file:`turtle_docstringdict_german.py`." msgstr "" -#: ../../library/turtle.rst:2664 +#: ../../library/turtle.rst:2694 msgid "" "If you have an appropriate entry in your :file:`turtle.cfg` file this " "dictionary will be read in at import time and will replace the original " "English docstrings." msgstr "" -#: ../../library/turtle.rst:2667 +#: ../../library/turtle.rst:2697 msgid "" "At the time of this writing there are docstring dictionaries in German and " "in Italian. (Requests please to glingl@aon.at.)" msgstr "" -#: ../../library/turtle.rst:2673 +#: ../../library/turtle.rst:2703 msgid "How to configure Screen and Turtles" msgstr "" -#: ../../library/turtle.rst:2675 +#: ../../library/turtle.rst:2705 msgid "" "The built-in default configuration mimics the appearance and behaviour of " "the old turtle module in order to retain best possible compatibility with it." msgstr "" -#: ../../library/turtle.rst:2678 +#: ../../library/turtle.rst:2708 msgid "" "If you want to use a different configuration which better reflects the " "features of this module or which better fits to your needs, e.g. for use in " @@ -3919,12 +3962,12 @@ msgid "" "settings." msgstr "" -#: ../../library/turtle.rst:2683 +#: ../../library/turtle.rst:2713 msgid "" "The built in configuration would correspond to the following ``turtle.cfg``:" msgstr "" -#: ../../library/turtle.rst:2685 +#: ../../library/turtle.rst:2715 msgid "" "width = 0.5\n" "height = 0.75\n" @@ -3968,50 +4011,49 @@ msgstr "" "title = Python Turtle Graphics\n" "using_IDLE = False" -#: ../../library/turtle.rst:2708 +#: ../../library/turtle.rst:2738 msgid "Short explanation of selected entries:" msgstr "" -#: ../../library/turtle.rst:2710 +#: ../../library/turtle.rst:2740 msgid "" "The first four lines correspond to the arguments of the :func:`Screen.setup " "` method." msgstr "" -#: ../../library/turtle.rst:2712 +#: ../../library/turtle.rst:2742 msgid "" -"Line 5 and 6 correspond to the arguments of the " -"method :func:`Screen.screensize `." +"Line 5 and 6 correspond to the arguments of the method :func:`Screen." +"screensize `." msgstr "" -#: ../../library/turtle.rst:2714 +#: ../../library/turtle.rst:2744 msgid "" "*shape* can be any of the built-in shapes, e.g: arrow, turtle, etc. For " "more info try ``help(shape)``." msgstr "" -#: ../../library/turtle.rst:2716 +#: ../../library/turtle.rst:2746 msgid "" "If you want to use no fill color (i.e. make the turtle transparent), you " "have to write ``fillcolor = \"\"`` (but all nonempty strings must not have " "quotes in the cfg file)." msgstr "" -#: ../../library/turtle.rst:2719 +#: ../../library/turtle.rst:2749 msgid "" "If you want to reflect the turtle its state, you have to use ``resizemode = " "auto``." msgstr "" -#: ../../library/turtle.rst:2721 +#: ../../library/turtle.rst:2751 msgid "" -"If you set e.g. ``language = italian`` the " -"docstringdict :file:`turtle_docstringdict_italian.py` will be loaded at " -"import time (if present on the import path, e.g. in the same directory " -"as :mod:`turtle`)." +"If you set e.g. ``language = italian`` the docstringdict :file:" +"`turtle_docstringdict_italian.py` will be loaded at import time (if present " +"on the import path, e.g. in the same directory as :mod:`turtle`)." msgstr "" -#: ../../library/turtle.rst:2724 +#: ../../library/turtle.rst:2754 msgid "" "The entries *exampleturtle* and *examplescreen* define the names of these " "objects as they occur in the docstrings. The transformation of method-" @@ -4019,309 +4061,309 @@ msgid "" "docstrings." msgstr "" -#: ../../library/turtle.rst:2728 +#: ../../library/turtle.rst:2758 msgid "" "*using_IDLE*: Set this to ``True`` if you regularly work with IDLE and its " "``-n`` switch (\"no subprocess\"). This will prevent :func:`exitonclick` to " "enter the mainloop." msgstr "" -#: ../../library/turtle.rst:2732 +#: ../../library/turtle.rst:2762 msgid "" "There can be a :file:`turtle.cfg` file in the directory where :mod:`turtle` " "is stored and an additional one in the current working directory. The " "latter will override the settings of the first one." msgstr "" -#: ../../library/turtle.rst:2736 +#: ../../library/turtle.rst:2766 msgid "" "The :file:`Lib/turtledemo` directory contains a :file:`turtle.cfg` file. " "You can study it as an example and see its effects when running the demos " "(preferably not from within the demo-viewer)." msgstr "" -#: ../../library/turtle.rst:2742 +#: ../../library/turtle.rst:2772 msgid ":mod:`turtledemo` --- Demo scripts" msgstr "" -#: ../../library/turtle.rst:2747 +#: ../../library/turtle.rst:2777 msgid "" "The :mod:`turtledemo` package includes a set of demo scripts. These scripts " "can be run and viewed using the supplied demo viewer as follows::" msgstr "" -#: ../../library/turtle.rst:2750 +#: ../../library/turtle.rst:2780 msgid "python -m turtledemo" msgstr "python -m turtledemo" -#: ../../library/turtle.rst:2752 +#: ../../library/turtle.rst:2782 msgid "" "Alternatively, you can run the demo scripts individually. For example, ::" msgstr "" -#: ../../library/turtle.rst:2754 +#: ../../library/turtle.rst:2784 msgid "python -m turtledemo.bytedesign" msgstr "python -m turtledemo.bytedesign" -#: ../../library/turtle.rst:2756 +#: ../../library/turtle.rst:2786 msgid "The :mod:`turtledemo` package directory contains:" msgstr "" -#: ../../library/turtle.rst:2758 +#: ../../library/turtle.rst:2788 msgid "" "A demo viewer :file:`__main__.py` which can be used to view the sourcecode " "of the scripts and run them at the same time." msgstr "" -#: ../../library/turtle.rst:2760 +#: ../../library/turtle.rst:2790 msgid "" "Multiple scripts demonstrating different features of the :mod:`turtle` " "module. Examples can be accessed via the Examples menu. They can also be " "run standalone." msgstr "" -#: ../../library/turtle.rst:2763 +#: ../../library/turtle.rst:2793 msgid "" "A :file:`turtle.cfg` file which serves as an example of how to write and use " "such files." msgstr "" -#: ../../library/turtle.rst:2766 +#: ../../library/turtle.rst:2796 msgid "The demo scripts are:" msgstr "" -#: ../../library/turtle.rst:2773 +#: ../../library/turtle.rst:2803 msgid "Name" msgstr "" -#: ../../library/turtle.rst:2773 +#: ../../library/turtle.rst:2803 msgid "Description" msgstr "描述" -#: ../../library/turtle.rst:2773 +#: ../../library/turtle.rst:2803 msgid "Features" msgstr "" -#: ../../library/turtle.rst:2775 +#: ../../library/turtle.rst:2805 msgid "bytedesign" msgstr "" -#: ../../library/turtle.rst:2775 +#: ../../library/turtle.rst:2805 msgid "complex classical turtle graphics pattern" msgstr "" -#: ../../library/turtle.rst:2775 +#: ../../library/turtle.rst:2805 msgid ":func:`tracer`, delay, :func:`update`" msgstr "" -#: ../../library/turtle.rst:2778 +#: ../../library/turtle.rst:2808 msgid "chaos" msgstr "" -#: ../../library/turtle.rst:2778 +#: ../../library/turtle.rst:2808 msgid "" "graphs Verhulst dynamics, shows that computer's computations can generate " "results sometimes against the common sense expectations" msgstr "" -#: ../../library/turtle.rst:2778 +#: ../../library/turtle.rst:2808 msgid "world coordinates" msgstr "" -#: ../../library/turtle.rst:2784 +#: ../../library/turtle.rst:2814 msgid "clock" msgstr "" -#: ../../library/turtle.rst:2784 +#: ../../library/turtle.rst:2814 msgid "analog clock showing time of your computer" msgstr "" -#: ../../library/turtle.rst:2784 +#: ../../library/turtle.rst:2814 msgid "turtles as clock's hands, ontimer" msgstr "" -#: ../../library/turtle.rst:2787 +#: ../../library/turtle.rst:2817 msgid "colormixer" msgstr "" -#: ../../library/turtle.rst:2787 +#: ../../library/turtle.rst:2817 msgid "experiment with r, g, b" msgstr "" -#: ../../library/turtle.rst:2789 +#: ../../library/turtle.rst:2819 msgid "forest" msgstr "" -#: ../../library/turtle.rst:2789 +#: ../../library/turtle.rst:2819 msgid "3 breadth-first trees" msgstr "" -#: ../../library/turtle.rst:2789 +#: ../../library/turtle.rst:2819 msgid "randomization" msgstr "" -#: ../../library/turtle.rst:2791 +#: ../../library/turtle.rst:2821 msgid "fractalcurves" msgstr "" -#: ../../library/turtle.rst:2791 +#: ../../library/turtle.rst:2821 msgid "Hilbert & Koch curves" msgstr "" -#: ../../library/turtle.rst:2791 +#: ../../library/turtle.rst:2821 msgid "recursion" msgstr "" -#: ../../library/turtle.rst:2793 +#: ../../library/turtle.rst:2823 msgid "lindenmayer" msgstr "" -#: ../../library/turtle.rst:2793 +#: ../../library/turtle.rst:2823 msgid "ethnomathematics (indian kolams)" msgstr "" -#: ../../library/turtle.rst:2793 +#: ../../library/turtle.rst:2823 msgid "L-System" msgstr "" -#: ../../library/turtle.rst:2796 +#: ../../library/turtle.rst:2826 msgid "minimal_hanoi" msgstr "minimal_hanoi" -#: ../../library/turtle.rst:2796 +#: ../../library/turtle.rst:2826 msgid "Towers of Hanoi" -msgstr "" +msgstr "河內塔" -#: ../../library/turtle.rst:2796 +#: ../../library/turtle.rst:2826 msgid "Rectangular Turtles as Hanoi discs (shape, shapesize)" msgstr "" -#: ../../library/turtle.rst:2800 +#: ../../library/turtle.rst:2830 msgid "nim" -msgstr "" +msgstr "nim" -#: ../../library/turtle.rst:2800 +#: ../../library/turtle.rst:2830 msgid "" "play the classical nim game with three heaps of sticks against the computer." msgstr "" -#: ../../library/turtle.rst:2800 +#: ../../library/turtle.rst:2830 msgid "turtles as nimsticks, event driven (mouse, keyboard)" msgstr "" -#: ../../library/turtle.rst:2804 +#: ../../library/turtle.rst:2834 msgid "paint" msgstr "" -#: ../../library/turtle.rst:2804 +#: ../../library/turtle.rst:2834 msgid "super minimalistic drawing program" msgstr "" -#: ../../library/turtle.rst:2807 +#: ../../library/turtle.rst:2837 msgid "peace" msgstr "" -#: ../../library/turtle.rst:2807 +#: ../../library/turtle.rst:2837 msgid "elementary" msgstr "" -#: ../../library/turtle.rst:2807 +#: ../../library/turtle.rst:2837 msgid "turtle: appearance and animation" msgstr "" -#: ../../library/turtle.rst:2810 +#: ../../library/turtle.rst:2840 msgid "penrose" msgstr "" -#: ../../library/turtle.rst:2810 +#: ../../library/turtle.rst:2840 msgid "aperiodic tiling with kites and darts" msgstr "" -#: ../../library/turtle.rst:2813 +#: ../../library/turtle.rst:2843 msgid "planet_and_moon" msgstr "planet_and_moon" -#: ../../library/turtle.rst:2813 +#: ../../library/turtle.rst:2843 msgid "simulation of gravitational system" msgstr "" -#: ../../library/turtle.rst:2813 +#: ../../library/turtle.rst:2843 msgid "compound shapes, :class:`Vec2D`" msgstr "" -#: ../../library/turtle.rst:2816 +#: ../../library/turtle.rst:2846 msgid "rosette" msgstr "" -#: ../../library/turtle.rst:2816 +#: ../../library/turtle.rst:2846 msgid "a pattern from the wikipedia article on turtle graphics" msgstr "" -#: ../../library/turtle.rst:2816 +#: ../../library/turtle.rst:2846 msgid ":func:`clone`, :func:`undo`" msgstr ":func:`clone`, :func:`undo`" -#: ../../library/turtle.rst:2819 +#: ../../library/turtle.rst:2849 msgid "round_dance" msgstr "round_dance" -#: ../../library/turtle.rst:2819 +#: ../../library/turtle.rst:2849 msgid "dancing turtles rotating pairwise in opposite direction" msgstr "" -#: ../../library/turtle.rst:2819 +#: ../../library/turtle.rst:2849 msgid "compound shapes, clone shapesize, tilt, get_shapepoly, update" msgstr "" -#: ../../library/turtle.rst:2823 +#: ../../library/turtle.rst:2853 msgid "sorting_animate" msgstr "sorting_animate" -#: ../../library/turtle.rst:2823 +#: ../../library/turtle.rst:2853 msgid "visual demonstration of different sorting methods" msgstr "" -#: ../../library/turtle.rst:2823 +#: ../../library/turtle.rst:2853 msgid "simple alignment, randomization" msgstr "" -#: ../../library/turtle.rst:2826 +#: ../../library/turtle.rst:2856 msgid "tree" msgstr "" -#: ../../library/turtle.rst:2826 +#: ../../library/turtle.rst:2856 msgid "a (graphical) breadth first tree (using generators)" msgstr "" -#: ../../library/turtle.rst:2829 +#: ../../library/turtle.rst:2859 msgid "two_canvases" msgstr "two_canvases" -#: ../../library/turtle.rst:2829 +#: ../../library/turtle.rst:2859 msgid "simple design" msgstr "" -#: ../../library/turtle.rst:2829 +#: ../../library/turtle.rst:2859 msgid "turtles on two canvases" msgstr "" -#: ../../library/turtle.rst:2832 +#: ../../library/turtle.rst:2862 msgid "yinyang" msgstr "" -#: ../../library/turtle.rst:2832 +#: ../../library/turtle.rst:2862 msgid "another elementary example" msgstr "" -#: ../../library/turtle.rst:2835 +#: ../../library/turtle.rst:2865 msgid "Have fun!" msgstr "" -#: ../../library/turtle.rst:2839 +#: ../../library/turtle.rst:2869 msgid "Changes since Python 2.6" msgstr "" -#: ../../library/turtle.rst:2841 +#: ../../library/turtle.rst:2871 msgid "" "The methods :func:`Turtle.tracer `, :func:`Turtle.window_width " "` and :func:`Turtle.window_height ` have been " @@ -4332,14 +4374,14 @@ msgid "" "methods.)" msgstr "" -#: ../../library/turtle.rst:2849 +#: ../../library/turtle.rst:2879 msgid "" -"The method :func:`!Turtle.fill` has been eliminated. The behaviour " -"of :func:`begin_fill` and :func:`end_fill` have changed slightly: now every " -"filling process must be completed with an ``end_fill()`` call." +"The method :func:`!Turtle.fill` has been eliminated. The behaviour of :func:" +"`begin_fill` and :func:`end_fill` have changed slightly: now every filling " +"process must be completed with an ``end_fill()`` call." msgstr "" -#: ../../library/turtle.rst:2854 +#: ../../library/turtle.rst:2884 msgid "" "A method :func:`Turtle.filling ` has been added. It returns a " "boolean value: ``True`` if a filling process is under way, ``False`` " @@ -4347,38 +4389,38 @@ msgid "" "in Python 2.6." msgstr "" -#: ../../library/turtle.rst:2860 +#: ../../library/turtle.rst:2890 msgid "Changes since Python 3.0" msgstr "" -#: ../../library/turtle.rst:2862 +#: ../../library/turtle.rst:2892 msgid "" -"The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` " -"and :func:`get_shapepoly` have been added. Thus the full range of regular " -"linear transforms is now available for transforming turtle " -"shapes. :func:`tiltangle` has been enhanced in functionality: it now can be " -"used to get or set the tilt angle." +"The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` and :" +"func:`get_shapepoly` have been added. Thus the full range of regular linear " +"transforms is now available for transforming turtle shapes. :func:" +"`tiltangle` has been enhanced in functionality: it now can be used to get or " +"set the tilt angle." msgstr "" -#: ../../library/turtle.rst:2868 +#: ../../library/turtle.rst:2898 msgid "" "The :class:`Screen` method :func:`onkeypress` has been added as a complement " "to :func:`onkey`. As the latter binds actions to the key release event, an " "alias: :func:`onkeyrelease` was also added for it." msgstr "" -#: ../../library/turtle.rst:2872 +#: ../../library/turtle.rst:2902 msgid "" "The method :func:`Screen.mainloop ` has been added, so there is no " "longer a need to use the standalone :func:`mainloop` function when working " "with :class:`Screen` and :class:`Turtle` objects." msgstr "" -#: ../../library/turtle.rst:2876 +#: ../../library/turtle.rst:2906 msgid "" -"Two input methods have been added: :func:`Screen.textinput ` " -"and :func:`Screen.numinput `. These pop up input dialogs and " -"return strings and numbers respectively." +"Two input methods have been added: :func:`Screen.textinput ` and :" +"func:`Screen.numinput `. These pop up input dialogs and return " +"strings and numbers respectively." msgstr "" #~ msgid ":func:`settiltangle`" diff --git a/library/typing.po b/library/typing.po index 1bd99ff57dc..849f70b5470 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-18 00:15+0000\n" +"POT-Creation-Date: 2025-10-21 00:14+0000\n" "PO-Revision-Date: 2024-07-11 11:12+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -390,7 +390,7 @@ msgstr "" "class:`str`。" #: ../../library/typing.rst:215 ../../library/typing.rst:3288 -#: ../../library/typing.rst:3473 +#: ../../library/typing.rst:3474 msgid "For example:" msgstr "舉例來說:" @@ -513,7 +513,7 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:287 ../../library/typing.rst:3990 +#: ../../library/typing.rst:287 ../../library/typing.rst:4005 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." @@ -668,9 +668,9 @@ msgid "" "``tuple`` as an annotation is equivalent to using ``tuple[Any, ...]``::" msgstr "" "為了標示一個元組可以為\\ *任意*\\ 長度,且所有元素皆是相同型別 ``T``,請使用 " -"刪節號字面值 (literal ellipsis) ``...``:``tuple[T, ...]``。為了標示" -"一個空元組,請使用 ``tuple[()]``。單純使用 ``tuple`` 作為註釋會與使用 ``tuple[Any, ...]`` " -"相等: ::" +"刪節號字面值 (literal ellipsis) ``...``:``tuple[T, ...]``。為了標示一個空元" +"組,請使用 ``tuple[()]``。單純使用 ``tuple`` 作為註釋會與使用 " +"``tuple[Any, ...]`` 相等: ::" #: ../../library/typing.rst:388 msgid "" @@ -1581,7 +1581,7 @@ msgstr "" #: ../../library/typing.rst:1048 ../../library/typing.rst:1230 #: ../../library/typing.rst:1317 ../../library/typing.rst:1359 #: ../../library/typing.rst:1568 ../../library/typing.rst:1629 -#: ../../library/typing.rst:3225 ../../library/typing.rst:3458 +#: ../../library/typing.rst:3225 ../../library/typing.rst:3459 msgid "For example::" msgstr "舉例來說: ::" @@ -2404,10 +2404,10 @@ msgstr "" msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " -"``x``. In this way, ``Annotated`` differs from the :func:`@no_type_check " -"` decorator, which can also be used for adding annotations " -"outside the scope of the typing system, but completely disables typechecking " -"for a function or class." +"``x``. In this way, ``Annotated`` differs from the :deco:`no_type_check` " +"decorator, which can also be used for adding annotations outside the scope " +"of the typing system, but completely disables typechecking for a function or " +"class." msgstr "" #: ../../library/typing.rst:1397 @@ -3670,7 +3670,7 @@ msgstr "" "'Alias'" #: ../../library/typing.rst:2272 -msgid "The module in which the type alias was defined::" +msgid "The name of the module in which the type alias was defined::" msgstr "" #: ../../library/typing.rst:2274 @@ -3761,6 +3761,18 @@ msgid "" ">>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)\n" "ForwardRef('undefined')" msgstr "" +">>> type Alias = undefined\n" +">>> Alias.__value__\n" +"Traceback (most recent call last):\n" +"...\n" +"NameError: name 'undefined' is not defined\n" +">>> from annotationlib import Format, call_evaluate_function\n" +">>> Alias.evaluate_value(Format.VALUE)\n" +"Traceback (most recent call last):\n" +"...\n" +"NameError: name 'undefined' is not defined\n" +">>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)\n" +"ForwardRef('undefined')" #: ../../library/typing.rst:2337 msgid "Unpacking" @@ -3779,6 +3791,10 @@ msgid "" ">>> Unpacked.__value__\n" "tuple[bool, typing.Unpack[Alias]]" msgstr "" +">>> type Alias = tuple[int, str]\n" +">>> type Unpacked = tuple[bool, *Alias]\n" +">>> Unpacked.__value__\n" +"tuple[bool, typing.Unpack[Alias]]" #: ../../library/typing.rst:2352 msgid "Other special directives" @@ -3796,7 +3812,7 @@ msgid "Typed version of :func:`collections.namedtuple`." msgstr "" #: ../../library/typing.rst:2362 ../../library/typing.rst:2458 -#: ../../library/typing.rst:3562 +#: ../../library/typing.rst:3563 msgid "Usage::" msgstr "用法: ::" @@ -3965,7 +3981,7 @@ msgid "" msgstr "" #: ../../library/typing.rst:2465 -msgid "The module in which the new type is defined." +msgid "The name of the module in which the new type is defined." msgstr "" #: ../../library/typing.rst:2469 @@ -4559,7 +4575,7 @@ msgstr "協定" #: ../../library/typing.rst:2837 msgid "" "The following protocols are provided by the :mod:`!typing` module. All are " -"decorated with :func:`@runtime_checkable `." +"decorated with :deco:`runtime_checkable`." msgstr "" #: ../../library/typing.rst:2842 @@ -4809,7 +4825,7 @@ msgid "" "function that is itself a decorator. The presence of " "``@dataclass_transform()`` tells a static type checker that the decorated " "object performs runtime \"magic\" that transforms a class in a similar way " -"to :func:`@dataclasses.dataclass `." +"to :deco:`dataclasses.dataclass`." msgstr "" #: ../../library/typing.rst:3021 @@ -4885,19 +4901,19 @@ msgstr "" #: ../../library/typing.rst:3055 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " -"similarly to classes created with :func:`@dataclasses.dataclass `. For example, type checkers will assume these classes have " -"``__init__`` methods that accept ``id`` and ``name``." +"similarly to classes created with :deco:`dataclasses.dataclass`. For " +"example, type checkers will assume these classes have ``__init__`` methods " +"that accept ``id`` and ``name``." msgstr "" #: ../../library/typing.rst:3061 msgid "" "The decorated class, metaclass, or function may accept the following bool " "arguments which type checkers will assume have the same effect as they would " -"have on the :func:`@dataclasses.dataclass` decorator: " -"``init``, ``eq``, ``order``, ``unsafe_hash``, ``frozen``, ``match_args``, " -"``kw_only``, and ``slots``. It must be possible for the value of these " -"arguments (``True`` or ``False``) to be statically evaluated." +"have on the :deco:`dataclasses.dataclass` decorator: ``init``, ``eq``, " +"``order``, ``unsafe_hash``, ``frozen``, ``match_args``, ``kw_only``, and " +"``slots``. It must be possible for the value of these arguments (``True`` or " +"``False``) to be statically evaluated." msgstr "" #: ../../library/typing.rst:3069 @@ -5111,19 +5127,17 @@ msgid "" msgstr "" #: ../../library/typing.rst:3192 -msgid "" -"Return a sequence of :func:`@overload `-decorated definitions for " -"*func*." +msgid "Return a sequence of :deco:`overload`-decorated definitions for *func*." msgstr "" #: ../../library/typing.rst:3195 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " -"documentation for :func:`@overload `, ``get_overloads(process)`` " -"will return a sequence of three function objects for the three defined " -"overloads. If called on a function with no overloads, ``get_overloads()`` " -"returns an empty sequence." +"documentation for :deco:`overload`, ``get_overloads(process)`` will return a " +"sequence of three function objects for the three defined overloads. If " +"called on a function with no overloads, ``get_overloads()`` returns an empty " +"sequence." msgstr "" #: ../../library/typing.rst:3202 @@ -5328,8 +5342,8 @@ msgstr "" #: ../../library/typing.rst:3354 msgid "" -"If :func:`@no_type_check ` has been applied to *obj*, an " -"empty dictionary is returned." +"If :deco:`no_type_check` has been applied to *obj*, an empty dictionary is " +"returned." msgstr "" #: ../../library/typing.rst:3356 @@ -5344,24 +5358,25 @@ msgstr "" #: ../../library/typing.rst:3363 msgid "" -"The function recursively replaces all occurrences of ``Annotated[T, ...]`` " -"with ``T``, unless *include_extras* is set to ``True`` (see :class:" -"`Annotated` for more information)." +"The function recursively replaces all occurrences of ``Annotated[T, ...]``, " +"``Required[T]``, ``NotRequired[T]``, and ``ReadOnly[T]`` with ``T``, unless " +"*include_extras* is set to ``True`` (see :class:`Annotated` for more " +"information)." msgstr "" -#: ../../library/typing.rst:3367 +#: ../../library/typing.rst:3368 msgid "" "See also :func:`annotationlib.get_annotations`, a lower-level function that " "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:3372 ../../library/typing.rst:3523 +#: ../../library/typing.rst:3373 ../../library/typing.rst:3524 msgid "" "This function may execute arbitrary code contained in annotations. See :ref:" "`annotationlib-security` for more information." msgstr "" -#: ../../library/typing.rst:3377 +#: ../../library/typing.rst:3378 msgid "" "If any forward references in the annotations of *obj* are not resolvable or " "are not valid Python code, this function will raise an exception such as :" @@ -5370,7 +5385,7 @@ msgid "" "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:3383 +#: ../../library/typing.rst:3384 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." @@ -5378,20 +5393,20 @@ msgstr "" "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" "`Annotated` 的文件。" -#: ../../library/typing.rst:3387 +#: ../../library/typing.rst:3388 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:3394 +#: ../../library/typing.rst:3395 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3397 +#: ../../library/typing.rst:3398 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " "it will be normalized to the original class. If ``X`` is an instance of :" @@ -5399,11 +5414,11 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3403 ../../library/typing.rst:3427 +#: ../../library/typing.rst:3404 ../../library/typing.rst:3428 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3405 +#: ../../library/typing.rst:3406 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" @@ -5421,13 +5436,13 @@ msgstr "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3419 +#: ../../library/typing.rst:3420 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: ../../library/typing.rst:3422 +#: ../../library/typing.rst:3423 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -5435,7 +5450,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3429 +#: ../../library/typing.rst:3430 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -5445,11 +5460,11 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3439 +#: ../../library/typing.rst:3440 msgid "Return the set of members defined in a :class:`Protocol`." msgstr "" -#: ../../library/typing.rst:3441 +#: ../../library/typing.rst:3442 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -5465,15 +5480,15 @@ msgstr "" ">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" "True" -#: ../../library/typing.rst:3450 +#: ../../library/typing.rst:3451 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." msgstr "" -#: ../../library/typing.rst:3456 +#: ../../library/typing.rst:3457 msgid "Determine if a type is a :class:`Protocol`." msgstr "確定一個型別是否 :class:`Protocol`。" -#: ../../library/typing.rst:3460 +#: ../../library/typing.rst:3461 msgid "" "class P(Protocol):\n" " def a(self) -> str: ...\n" @@ -5489,11 +5504,11 @@ msgstr "" "is_protocol(P) # => True\n" "is_protocol(int) # => False" -#: ../../library/typing.rst:3471 +#: ../../library/typing.rst:3472 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3475 +#: ../../library/typing.rst:3476 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5507,57 +5522,57 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3492 +#: ../../library/typing.rst:3493 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3494 +#: ../../library/typing.rst:3495 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. :class:`!ForwardRef` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3499 +#: ../../library/typing.rst:3500 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:3505 +#: ../../library/typing.rst:3506 msgid "" "This is now an alias for :class:`annotationlib.ForwardRef`. Several " "undocumented behaviors of this class have been changed; for example, after a " "``ForwardRef`` has been evaluated, the evaluated value is no longer cached." msgstr "" -#: ../../library/typing.rst:3512 +#: ../../library/typing.rst:3513 msgid "Evaluate an :class:`annotationlib.ForwardRef` as a :term:`type hint`." msgstr "" -#: ../../library/typing.rst:3514 +#: ../../library/typing.rst:3515 msgid "" "This is similar to calling :meth:`annotationlib.ForwardRef.evaluate`, but " "unlike that method, :func:`!evaluate_forward_ref` also recursively evaluates " "forward references nested within the type hint." msgstr "" -#: ../../library/typing.rst:3518 +#: ../../library/typing.rst:3519 msgid "" "See the documentation for :meth:`annotationlib.ForwardRef.evaluate` for the " "meaning of the *owner*, *globals*, *locals*, *type_params*, and *format* " "parameters." msgstr "" -#: ../../library/typing.rst:3530 +#: ../../library/typing.rst:3531 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" -#: ../../library/typing.rst:3533 +#: ../../library/typing.rst:3534 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5573,17 +5588,17 @@ msgstr "" ">>> S.__default__ is None\n" "True" -#: ../../library/typing.rst:3545 +#: ../../library/typing.rst:3546 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3549 +#: ../../library/typing.rst:3550 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It's ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3552 +#: ../../library/typing.rst:3553 msgid "" "A module which is expensive to import, and which only contain types used for " "typing annotations, can be safely imported inside an ``if TYPE_CHECKING:`` " @@ -5595,7 +5610,7 @@ msgid "" "will be checked properly during such analysis." msgstr "" -#: ../../library/typing.rst:3564 +#: ../../library/typing.rst:3565 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -5609,7 +5624,7 @@ msgstr "" "def fun(arg: expensive_mod.SomeType) -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3570 +#: ../../library/typing.rst:3571 msgid "" "If you occasionally need to examine type annotations at runtime which may " "contain undefined symbols, use :meth:`annotationlib.get_annotations` with a " @@ -5618,11 +5633,11 @@ msgid "" "raising :exc:`NameError`." msgstr "" -#: ../../library/typing.rst:3583 +#: ../../library/typing.rst:3584 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3585 +#: ../../library/typing.rst:3586 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the :mod:`!typing` module " @@ -5631,7 +5646,7 @@ msgid "" "pre-existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3592 +#: ../../library/typing.rst:3593 msgid "" "The redundant types are deprecated as of Python 3.9. However, while the " "aliases may be removed at some point, removal of these aliases is not " @@ -5639,7 +5654,7 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3597 +#: ../../library/typing.rst:3598 msgid "" "If at some point it is decided to remove these deprecated aliases, a " "deprecation warning will be issued by the interpreter for at least two " @@ -5647,38 +5662,38 @@ msgid "" "`!typing` module without deprecation warnings until at least Python 3.14." msgstr "" -#: ../../library/typing.rst:3602 +#: ../../library/typing.rst:3603 msgid "" "Type checkers are encouraged to flag uses of the deprecated types if the " "program they are checking targets a minimum Python version of 3.9 or newer." msgstr "" -#: ../../library/typing.rst:3608 +#: ../../library/typing.rst:3609 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3612 +#: ../../library/typing.rst:3613 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3614 +#: ../../library/typing.rst:3615 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Mapping` rather than to " "use :class:`dict` or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:3618 +#: ../../library/typing.rst:3619 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3624 +#: ../../library/typing.rst:3625 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3626 +#: ../../library/typing.rst:3627 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Sequence` or :class:" @@ -5686,136 +5701,136 @@ msgid "" "typing.List`." msgstr "" -#: ../../library/typing.rst:3631 +#: ../../library/typing.rst:3632 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3637 +#: ../../library/typing.rst:3638 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3639 +#: ../../library/typing.rst:3640 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`collections.abc.Set` rather than to use :" "class:`set` or :class:`typing.Set`." msgstr "" -#: ../../library/typing.rst:3643 +#: ../../library/typing.rst:3644 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3649 +#: ../../library/typing.rst:3650 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3651 +#: ../../library/typing.rst:3652 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3658 +#: ../../library/typing.rst:3659 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3660 +#: ../../library/typing.rst:3661 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3663 +#: ../../library/typing.rst:3664 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3669 +#: ../../library/typing.rst:3670 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3671 +#: ../../library/typing.rst:3672 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3676 +#: ../../library/typing.rst:3677 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3683 +#: ../../library/typing.rst:3684 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3687 +#: ../../library/typing.rst:3688 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3691 +#: ../../library/typing.rst:3692 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3697 +#: ../../library/typing.rst:3698 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3701 +#: ../../library/typing.rst:3702 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3707 +#: ../../library/typing.rst:3708 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3711 +#: ../../library/typing.rst:3712 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3717 +#: ../../library/typing.rst:3718 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3721 +#: ../../library/typing.rst:3722 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3727 +#: ../../library/typing.rst:3728 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3731 +#: ../../library/typing.rst:3732 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3738 +#: ../../library/typing.rst:3739 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3743 +#: ../../library/typing.rst:3744 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3746 +#: ../../library/typing.rst:3747 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -5823,29 +5838,29 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3751 +#: ../../library/typing.rst:3752 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3757 +#: ../../library/typing.rst:3758 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3759 +#: ../../library/typing.rst:3760 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: ../../library/typing.rst:3763 +#: ../../library/typing.rst:3764 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:3766 +#: ../../library/typing.rst:3767 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" @@ -5853,315 +5868,339 @@ msgstr "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" -#: ../../library/typing.rst:3771 +#: ../../library/typing.rst:3772 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: ../../library/typing.rst:3781 +#: ../../library/typing.rst:3782 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3785 +#: ../../library/typing.rst:3786 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3787 +#: ../../library/typing.rst:3788 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3793 -msgid "" -"This type represents the types :class:`bytes`, :class:`bytearray`, and :" -"class:`memoryview` of byte sequences." -msgstr "" +#: ../../library/typing.rst:3794 +msgid "Deprecated alias to :class:`collections.abc.ByteString`." +msgstr "棄用 :class:`collections.abc.ByteString` 的別名。" #: ../../library/typing.rst:3796 msgid "" -"Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray " -"| memoryview``." -msgstr "" - -#: ../../library/typing.rst:3801 +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." +msgstr "" +"使用 ``isinstance(obj, collections.abc.Buffer)`` 來測試 ``obj`` 是否在 runtime " +"實作了\\ :ref:`緩衝區協定 `。在型別註解的使用中,請用 :class:`~" +"collections.abc.Buffer` 或明確指定你的程式碼所支援型別的聯集(例如 " +"``bytes | bytearray | memoryview``)。" + +#: ../../library/typing.rst:3802 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." +msgstr "" +":class:`!ByteString` 最初被設計為一個抽象類別,以作為 :class:`bytes` 和 :class:`bytearray` " +"的超型別 (supertype)。然而由於 ABC 從未擁有任何方法,知道一個物件是 :class:`!ByteString` 的" +"實例從未真正告訴你任何關於該物件的有用資訊。其他常見的緩衝區型別如 :class:`memoryview` " +"也從未被理解為 :class:`!ByteString` 的子型別(無論是在 runtime 還是由靜態型別檢查器)。" + +#: ../../library/typing.rst:3810 +msgid "See :pep:`PEP 688 <688#current-options>` for more details." +msgstr "更多細節請見 :pep:`PEP 688 <688#current-options>`。" + +#: ../../library/typing.rst:3816 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3805 +#: ../../library/typing.rst:3820 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3811 +#: ../../library/typing.rst:3826 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3813 +#: ../../library/typing.rst:3828 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3819 +#: ../../library/typing.rst:3834 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3821 +#: ../../library/typing.rst:3836 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3827 +#: ../../library/typing.rst:3842 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3829 +#: ../../library/typing.rst:3844 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3835 +#: ../../library/typing.rst:3850 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3837 +#: ../../library/typing.rst:3852 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3843 +#: ../../library/typing.rst:3858 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3845 +#: ../../library/typing.rst:3860 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3851 +#: ../../library/typing.rst:3866 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3853 +#: ../../library/typing.rst:3868 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3860 +#: ../../library/typing.rst:3875 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3862 +#: ../../library/typing.rst:3877 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3869 +#: ../../library/typing.rst:3884 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3871 +#: ../../library/typing.rst:3886 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3877 +#: ../../library/typing.rst:3892 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3879 +#: ../../library/typing.rst:3894 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3885 +#: ../../library/typing.rst:3900 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3887 +#: ../../library/typing.rst:3902 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3894 +#: ../../library/typing.rst:3909 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中非同步 ABC 的別名" -#: ../../library/typing.rst:3898 +#: ../../library/typing.rst:3913 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3900 +#: ../../library/typing.rst:3915 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Coroutine` and ``typing.Coroutine`` in type annotations." msgstr "" -#: ../../library/typing.rst:3906 +#: ../../library/typing.rst:3921 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3912 +#: ../../library/typing.rst:3927 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3914 +#: ../../library/typing.rst:3929 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` in type " "annotations." msgstr "" -#: ../../library/typing.rst:3920 +#: ../../library/typing.rst:3935 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3925 +#: ../../library/typing.rst:3940 msgid "The ``SendType`` parameter now has a default." msgstr "``SendType`` 參數現在有預設值。" -#: ../../library/typing.rst:3930 +#: ../../library/typing.rst:3945 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3934 +#: ../../library/typing.rst:3949 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3940 +#: ../../library/typing.rst:3955 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3944 +#: ../../library/typing.rst:3959 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3950 +#: ../../library/typing.rst:3965 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3954 +#: ../../library/typing.rst:3969 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3961 +#: ../../library/typing.rst:3976 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3965 +#: ../../library/typing.rst:3980 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3967 +#: ../../library/typing.rst:3982 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3973 +#: ../../library/typing.rst:3988 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3975 +#: ../../library/typing.rst:3990 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3981 +#: ../../library/typing.rst:3996 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:3983 +#: ../../library/typing.rst:3998 msgid "" "See :ref:`annotating-callables` for details on how to use :class:" "`collections.abc.Callable` and ``typing.Callable`` in type annotations." msgstr "" -#: ../../library/typing.rst:3986 +#: ../../library/typing.rst:4001 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3996 +#: ../../library/typing.rst:4011 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:3998 +#: ../../library/typing.rst:4013 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Generator` and ``typing.Generator`` in type annotations." msgstr "" -#: ../../library/typing.rst:4002 +#: ../../library/typing.rst:4017 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4006 +#: ../../library/typing.rst:4021 msgid "Default values for the send and return types were added." msgstr "" -#: ../../library/typing.rst:4011 +#: ../../library/typing.rst:4026 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:4013 +#: ../../library/typing.rst:4028 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:4018 +#: ../../library/typing.rst:4033 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:4020 +#: ../../library/typing.rst:4035 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4026 +#: ../../library/typing.rst:4041 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:4028 +#: ../../library/typing.rst:4043 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:4034 +#: ../../library/typing.rst:4049 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:4038 +#: ../../library/typing.rst:4053 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:4040 +#: ../../library/typing.rst:4055 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__enter__` method. The optional second type parameter, " @@ -6169,21 +6208,21 @@ msgid "" "returned by the :meth:`~object.__exit__` method." msgstr "" -#: ../../library/typing.rst:4047 +#: ../../library/typing.rst:4062 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4052 +#: ../../library/typing.rst:4067 msgid "Added the optional second type parameter, ``ExitT_co``." msgstr "" -#: ../../library/typing.rst:4057 +#: ../../library/typing.rst:4072 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:4059 +#: ../../library/typing.rst:4074 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__aenter__` method. The optional second type parameter, " @@ -6191,21 +6230,21 @@ msgid "" "returned by the :meth:`~object.__aexit__` method." msgstr "" -#: ../../library/typing.rst:4066 +#: ../../library/typing.rst:4081 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4071 +#: ../../library/typing.rst:4086 msgid "Added the optional second type parameter, ``AExitT_co``." msgstr "" -#: ../../library/typing.rst:4075 +#: ../../library/typing.rst:4090 msgid "Deprecation Timeline of Major Features" msgstr "主要功能的棄用時程表" -#: ../../library/typing.rst:4077 +#: ../../library/typing.rst:4092 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -6213,119 +6252,119 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:4084 +#: ../../library/typing.rst:4099 msgid "Feature" msgstr "" -#: ../../library/typing.rst:4085 +#: ../../library/typing.rst:4100 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:4086 +#: ../../library/typing.rst:4101 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:4087 +#: ../../library/typing.rst:4102 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:4088 +#: ../../library/typing.rst:4103 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:4089 ../../library/typing.rst:4093 +#: ../../library/typing.rst:4104 ../../library/typing.rst:4108 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:4090 +#: ../../library/typing.rst:4105 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:4091 +#: ../../library/typing.rst:4106 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:4092 +#: ../../library/typing.rst:4107 msgid ":class:`typing.ByteString`" msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:4094 +#: ../../library/typing.rst:4109 msgid "3.17" -msgstr "" +msgstr "3.17" -#: ../../library/typing.rst:4095 +#: ../../library/typing.rst:4110 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:4096 +#: ../../library/typing.rst:4111 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:4097 +#: ../../library/typing.rst:4112 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:4098 ../../library/typing.rst:4102 -#: ../../library/typing.rst:4106 +#: ../../library/typing.rst:4113 ../../library/typing.rst:4117 +#: ../../library/typing.rst:4121 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:4099 +#: ../../library/typing.rst:4114 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:4100 +#: ../../library/typing.rst:4115 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:4101 ../../library/typing.rst:4105 +#: ../../library/typing.rst:4116 ../../library/typing.rst:4120 msgid "3.12" msgstr "3.12" -#: ../../library/typing.rst:4103 +#: ../../library/typing.rst:4118 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:4104 +#: ../../library/typing.rst:4119 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:4107 +#: ../../library/typing.rst:4122 msgid ":pep:`695`" msgstr ":pep:`695`" -#: ../../library/typing.rst:4108 +#: ../../library/typing.rst:4123 msgid ":func:`@typing.no_type_check_decorator `" msgstr ":func:`@typing.no_type_check_decorator `" -#: ../../library/typing.rst:4109 ../../library/typing.rst:4113 +#: ../../library/typing.rst:4124 ../../library/typing.rst:4128 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:4110 +#: ../../library/typing.rst:4125 msgid "3.15" msgstr "3.15" -#: ../../library/typing.rst:4111 +#: ../../library/typing.rst:4126 msgid ":gh:`106309`" msgstr ":gh:`106309`" -#: ../../library/typing.rst:4112 +#: ../../library/typing.rst:4127 msgid ":data:`typing.AnyStr`" msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:4114 +#: ../../library/typing.rst:4129 msgid "3.18" msgstr "3.18" -#: ../../library/typing.rst:4115 +#: ../../library/typing.rst:4130 msgid ":gh:`105578`" msgstr ":gh:`105578`" #: ../../library/typing.rst:233 ../../library/typing.rst:380 #: ../../library/typing.rst:1170 msgid "..." -msgstr "" +msgstr "..." #: ../../library/typing.rst:233 ../../library/typing.rst:380 #: ../../library/typing.rst:1170 diff --git a/library/unicodedata.po b/library/unicodedata.po index f4adfb8c543..f8691eb1e95 100644 --- a/library/unicodedata.po +++ b/library/unicodedata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-17 00:13+0000\n" +"POT-Creation-Date: 2025-09-25 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -157,6 +157,8 @@ msgid "" ">>> unicodedata.category('A') # 'L'etter, 'u'ppercase\n" "'Lu'" msgstr "" +">>> unicodedata.category('A') # 'L'etter, 'u'ppercase\n" +"'Lu'" #: ../../library/unicodedata.rst:111 msgid "" @@ -178,9 +180,9 @@ msgstr "" msgid "" "Returns the canonical combining class assigned to the character *chr* as " "integer. Returns ``0`` if no combining class is defined. See the `Canonical " -"Combining Class Values section of the Unicode Character Database `_ " -"for more information." +"Combining Class Values section of the Unicode Character Database `_ for more information." msgstr "" #: ../../library/unicodedata.rst:132 diff --git a/library/urllib.parse.po b/library/urllib.parse.po index caab72679e8..a40a8c363b0 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -1035,7 +1035,7 @@ msgstr "" #: ../../library/urllib.parse.rst:772 msgid ":rfc:`3986` - Uniform Resource Identifiers" -msgstr "" +msgstr ":rfc:`3986` - 統一資源識別碼" #: ../../library/urllib.parse.rst:773 msgid "" @@ -1055,7 +1055,7 @@ msgstr "" #: ../../library/urllib.parse.rst:781 msgid ":rfc:`2396` - Uniform Resource Identifiers (URI): Generic Syntax" -msgstr "" +msgstr ":rfc:`2396` - 統一資源識別碼 (URI):通用語法" #: ../../library/urllib.parse.rst:782 msgid "" diff --git a/library/urllib.request.po b/library/urllib.request.po index c421bfa7b4a..7f794ed4577 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -1562,6 +1562,14 @@ msgid "" "lt-ie8 lt-ie9\"> \\n\\n\\n A D E B F C\"\n" +" iterators = deque(map(iter, iterables))\n" +" while iterators:\n" +" try:\n" +" while True:\n" +" yield next(iterators[0])\n" +" iterators.rotate(-1)\n" +" except StopIteration:\n" +" # 移除耗盡的疊代器。\n" +" iterators.popleft()" #: ../../library/collections.rst:697 msgid "" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 0db2ac39ec4..27a025e3b45 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-10-26 00:15+0000\n" "PO-Revision-Date: 2023-01-24 03:33+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -210,9 +210,9 @@ msgid "" "shutdown the :class:`Executor` (waiting as if :meth:`Executor.shutdown` were " "called with *wait* set to ``True``)::" msgstr "" -"如果使用 :keyword:`with` 陳述式來將 executor 用作 :term:`context manager`,那你就" -"可以不用明確地呼叫此方法,這將會自己關閉 :class:`Executor`\\(如同呼" -"叫 :meth:`Executor.shutdown` 時 *wait* 被設定為 ``True`` 般等待): ::" +"如果使用 :keyword:`with` 陳述式來將 executor 用作 :term:`context manager`,那" +"你就可以不用明確地呼叫此方法,這將會自己關閉 :class:`Executor`\\(如同呼叫 :" +"meth:`Executor.shutdown` 時 *wait* 被設定為 ``True`` 般等待): ::" #: ../../library/concurrent.futures.rst:109 msgid "" @@ -371,7 +371,7 @@ msgstr "" "thread) 的 :class:`threading.Thread` 名稱,以便於除錯。" #: ../../library/concurrent.futures.rst:188 -#: ../../library/concurrent.futures.rst:391 +#: ../../library/concurrent.futures.rst:393 msgid "Added the *initializer* and *initargs* arguments." msgstr "新增 *initializer* 與 *initargs* 引數。" @@ -440,7 +440,7 @@ msgstr "" msgid "InterpreterPoolExecutor" msgstr "InterpreterPoolExecutor" -#: ../../library/concurrent.futures.rst:242 +#: ../../library/concurrent.futures.rst:244 msgid "" "The :class:`InterpreterPoolExecutor` class uses a pool of interpreters to " "execute calls asynchronously. It is a :class:`ThreadPoolExecutor` subclass, " @@ -449,7 +449,7 @@ msgid "" "interpreter." msgstr "" -#: ../../library/concurrent.futures.rst:248 +#: ../../library/concurrent.futures.rst:250 msgid "" "The biggest benefit to using interpreters instead of only threads is true " "multi-core parallelism. Each interpreter has its own :term:`Global " @@ -458,7 +458,7 @@ msgid "" "unblocked on a different core." msgstr "" -#: ../../library/concurrent.futures.rst:254 +#: ../../library/concurrent.futures.rst:256 msgid "" "The tradeoff is that writing concurrent code for use with multiple " "interpreters can take extra effort. However, this is because it forces you " @@ -471,7 +471,7 @@ msgid "" "conditions." msgstr "" -#: ../../library/concurrent.futures.rst:264 +#: ../../library/concurrent.futures.rst:266 msgid "" "Each worker's interpreter is isolated from all the other interpreters. " "\"Isolated\" means each interpreter has its own runtime state and operates " @@ -485,7 +485,7 @@ msgid "" "``__main__``." msgstr "" -#: ../../library/concurrent.futures.rst:276 +#: ../../library/concurrent.futures.rst:278 msgid "" "Isolation means a mutable object, or other data, cannot be used by more than " "one interpreter at the same time. That effectively means interpreters " @@ -495,7 +495,7 @@ msgid "" "strings, and tuples of immutable objects, don't have these limitations." msgstr "" -#: ../../library/concurrent.futures.rst:284 +#: ../../library/concurrent.futures.rst:286 msgid "" "Communicating and synchronizing between interpreters is most effectively " "done using dedicated tools, like those proposed in :pep:`734`. One less " @@ -503,7 +503,7 @@ msgid "" "bytes over a shared :mod:`socket ` or :func:`pipe `." msgstr "" -#: ../../library/concurrent.futures.rst:292 +#: ../../library/concurrent.futures.rst:294 msgid "" "A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously " "using a pool of at most *max_workers* threads. Each thread runs tasks in " @@ -514,7 +514,7 @@ msgid "" "executor has true multi-core parallelism." msgstr "" -#: ../../library/concurrent.futures.rst:300 +#: ../../library/concurrent.futures.rst:302 msgid "" "The optional *initializer* and *initargs* arguments have the same meaning as " "for :class:`!ThreadPoolExecutor`: the initializer is run when each worker is " @@ -523,17 +523,17 @@ msgid "" "when sending them to the worker's interpreter." msgstr "" -#: ../../library/concurrent.futures.rst:308 +#: ../../library/concurrent.futures.rst:310 msgid "" "The executor may replace uncaught exceptions from *initializer* with :class:" "`~concurrent.futures.interpreter.ExecutionFailed`." msgstr "" -#: ../../library/concurrent.futures.rst:311 +#: ../../library/concurrent.futures.rst:313 msgid "Other caveats from parent :class:`ThreadPoolExecutor` apply here." msgstr "" -#: ../../library/concurrent.futures.rst:313 +#: ../../library/concurrent.futures.rst:315 msgid "" ":meth:`~Executor.submit` and :meth:`~Executor.map` work like normal, except " "the worker serializes the callable and arguments using :mod:`pickle` when " @@ -541,7 +541,7 @@ msgid "" "value when sending it back." msgstr "" -#: ../../library/concurrent.futures.rst:318 +#: ../../library/concurrent.futures.rst:320 msgid "" "When a worker's current task raises an uncaught exception, the worker always " "tries to preserve the exception as-is. If that is successful then it also " @@ -552,11 +552,11 @@ msgid "" "class:`~concurrent.futures.interpreter.ExecutionFailed` instance instead." msgstr "" -#: ../../library/concurrent.futures.rst:330 +#: ../../library/concurrent.futures.rst:332 msgid "ProcessPoolExecutor" msgstr "ProcessPoolExecutor" -#: ../../library/concurrent.futures.rst:332 +#: ../../library/concurrent.futures.rst:334 msgid "" "The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that " "uses a pool of processes to execute calls asynchronously. :class:" @@ -571,7 +571,7 @@ msgstr "" "Interpreter Lock) `,但也意味著只能執行和回傳可被 " "pickle 的 (picklable) 物件。" -#: ../../library/concurrent.futures.rst:339 +#: ../../library/concurrent.futures.rst:341 msgid "" "The ``__main__`` module must be importable by worker subprocesses. This " "means that :class:`ProcessPoolExecutor` will not work in the interactive " @@ -581,7 +581,7 @@ msgstr "" "class:`ProcessPoolExecutor` 將無法在交互式直譯器 (interactive interpreter) 中" "工作。" -#: ../../library/concurrent.futures.rst:342 +#: ../../library/concurrent.futures.rst:344 msgid "" "Calling :class:`Executor` or :class:`Future` methods from a callable " "submitted to a :class:`ProcessPoolExecutor` will result in deadlock." @@ -589,7 +589,7 @@ msgstr "" "從提交給 :class:`ProcessPoolExecutor` 的可呼叫物件中呼叫 :class:`Executor` " "或 :class:`Future` 方法將導致死鎖。" -#: ../../library/concurrent.futures.rst:345 +#: ../../library/concurrent.futures.rst:347 msgid "" "Note that the restrictions on functions and arguments needing to picklable " "as per :class:`multiprocessing.Process` apply when using :meth:`~Executor." @@ -597,7 +597,7 @@ msgid "" "function defined in a REPL or a lambda should not be expected to work." msgstr "" -#: ../../library/concurrent.futures.rst:352 +#: ../../library/concurrent.futures.rst:354 msgid "" "An :class:`Executor` subclass that executes calls asynchronously using a " "pool of at most *max_workers* processes. If *max_workers* is ``None`` or " @@ -621,7 +621,7 @@ msgstr "" "或未給定,則使用預設的 :mod:`multiprocessing` 情境。請見 :ref:" "`multiprocessing-start-methods`。" -#: ../../library/concurrent.futures.rst:366 +#: ../../library/concurrent.futures.rst:368 msgid "" "*initializer* is an optional callable that is called at the start of each " "worker process; *initargs* is a tuple of arguments passed to the " @@ -634,7 +634,7 @@ msgstr "" "外,所有目前未定的作業以及任何向池中提交更多作業的嘗試都將引發 :exc:" "`~concurrent.futures.process.BrokenProcessPool`。" -#: ../../library/concurrent.futures.rst:372 +#: ../../library/concurrent.futures.rst:374 msgid "" "*max_tasks_per_child* is an optional argument that specifies the maximum " "number of tasks a single process can execute before it will exit and be " @@ -650,7 +650,7 @@ msgstr "" "數的情況下,將預設使用 \"spawn\" 做為 multiprocessing 啟動方法。此功能與 " "\"fork\" 啟動方法不相容。" -#: ../../library/concurrent.futures.rst:380 +#: ../../library/concurrent.futures.rst:382 msgid "" "When one of the worker processes terminates abruptly, a :exc:`~concurrent." "futures.process.BrokenProcessPool` error is now raised. Previously, " @@ -661,21 +661,21 @@ msgstr "" "BrokenProcessPool` 錯誤。在過去,此行為是未定義的 (undefined),但對 executor " "或其 future 的操作經常會發生凍結或死鎖。" -#: ../../library/concurrent.futures.rst:387 +#: ../../library/concurrent.futures.rst:389 msgid "" "The *mp_context* argument was added to allow users to control the " "start_method for worker processes created by the pool." msgstr "" "新增了 *mp_context* 引數以允許使用者控制由池所建立的工作行程的 start_method。" -#: ../../library/concurrent.futures.rst:393 +#: ../../library/concurrent.futures.rst:395 msgid "" "The *max_tasks_per_child* argument was added to allow users to control the " "lifetime of workers in the pool." msgstr "" "新增了 *max_tasks_per_child* 引數以允許使用者控制池中 worker 的生命週期。" -#: ../../library/concurrent.futures.rst:397 +#: ../../library/concurrent.futures.rst:399 msgid "" "On POSIX systems, if your application has multiple threads and the :mod:" "`multiprocessing` context uses the ``\"fork\"`` start method: The :func:`os." @@ -688,13 +688,13 @@ msgstr "" "能會引發 :exc:`DeprecationWarning`。傳遞一個 *mp_context* 以配置為使用不同的" "啟動方法。更多說明請參閱 :func:`os.fork` 文件。" -#: ../../library/concurrent.futures.rst:405 +#: ../../library/concurrent.futures.rst:407 msgid "" "*max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:" "`os.cpu_count`." msgstr "" -#: ../../library/concurrent.futures.rst:409 +#: ../../library/concurrent.futures.rst:411 msgid "" "The default process start method (see :ref:`multiprocessing-start-methods`) " "changed away from *fork*. If you require the *fork* start method for :class:" @@ -702,7 +702,7 @@ msgid "" "get_context(\"fork\")``." msgstr "" -#: ../../library/concurrent.futures.rst:417 +#: ../../library/concurrent.futures.rst:419 msgid "" "Attempt to terminate all living worker processes immediately by calling :" "meth:`Process.terminate ` on each of " @@ -710,14 +710,14 @@ msgid "" "all other resources associated with the executor are freed." msgstr "" -#: ../../library/concurrent.futures.rst:422 -#: ../../library/concurrent.futures.rst:434 +#: ../../library/concurrent.futures.rst:424 +#: ../../library/concurrent.futures.rst:436 msgid "" "After calling this method the caller should no longer submit tasks to the " "executor." msgstr "" -#: ../../library/concurrent.futures.rst:429 +#: ../../library/concurrent.futures.rst:431 msgid "" "Attempt to kill all living worker processes immediately by calling :meth:" "`Process.kill ` on each of them. Internally, " @@ -725,11 +725,11 @@ msgid "" "resources associated with the executor are freed." msgstr "" -#: ../../library/concurrent.futures.rst:442 +#: ../../library/concurrent.futures.rst:444 msgid "ProcessPoolExecutor Example" msgstr "ProcessPoolExecutor 範例" -#: ../../library/concurrent.futures.rst:445 +#: ../../library/concurrent.futures.rst:447 msgid "" "import concurrent.futures\n" "import math\n" @@ -797,11 +797,11 @@ msgstr "" "if __name__ == '__main__':\n" " main()" -#: ../../library/concurrent.futures.rst:480 +#: ../../library/concurrent.futures.rst:482 msgid "Future Objects" msgstr "Future 物件" -#: ../../library/concurrent.futures.rst:482 +#: ../../library/concurrent.futures.rst:484 msgid "" "The :class:`Future` class encapsulates the asynchronous execution of a " "callable. :class:`Future` instances are created by :meth:`Executor.submit`." @@ -809,7 +809,7 @@ msgstr "" ":class:`Future` 類別封裝了可呼叫物件的非同步執行。:class:`Future` 實例由 :" "meth:`Executor.submit` 建立。" -#: ../../library/concurrent.futures.rst:487 +#: ../../library/concurrent.futures.rst:489 msgid "" "Encapsulates the asynchronous execution of a callable. :class:`Future` " "instances are created by :meth:`Executor.submit` and should not be created " @@ -818,7 +818,7 @@ msgstr "" "封裝可呼叫物件的非同步執行。:class:`Future` 實例由 :meth:`Executor.submit` 建" "立,且除測試外不應直接建立。" -#: ../../library/concurrent.futures.rst:493 +#: ../../library/concurrent.futures.rst:495 msgid "" "Attempt to cancel the call. If the call is currently being executed or " "finished running and cannot be cancelled then the method will return " @@ -828,22 +828,22 @@ msgstr "" "嘗試取消呼叫。如果呼叫目前正在執行或已完成運行且無法取消,則該方法將回傳 " "``False``,否則呼叫將被取消並且該方法將回傳 ``True``。" -#: ../../library/concurrent.futures.rst:500 +#: ../../library/concurrent.futures.rst:502 msgid "Return ``True`` if the call was successfully cancelled." msgstr "如果該呼叫成功被取消,則回傳 ``True``。" -#: ../../library/concurrent.futures.rst:504 +#: ../../library/concurrent.futures.rst:506 msgid "" "Return ``True`` if the call is currently being executed and cannot be " "cancelled." msgstr "如果呼叫正在執行且無法取消,則回傳 ``True``。" -#: ../../library/concurrent.futures.rst:509 +#: ../../library/concurrent.futures.rst:511 msgid "" "Return ``True`` if the call was successfully cancelled or finished running." msgstr "如果呼叫成功被取消或結束運行,則回傳 ``True``。" -#: ../../library/concurrent.futures.rst:514 +#: ../../library/concurrent.futures.rst:516 msgid "" "Return the value returned by the call. If the call hasn't yet completed then " "this method will wait up to *timeout* seconds. If the call hasn't completed " @@ -855,19 +855,19 @@ msgstr "" "叫在 *timeout* 秒內未完成,則會引發 :exc:`TimeoutError`。*timeout* 可以是整數" "或浮點數。如果未指定 *timeout* 或為 ``None``,則等待時間就不會有限制。" -#: ../../library/concurrent.futures.rst:521 -#: ../../library/concurrent.futures.rst:535 +#: ../../library/concurrent.futures.rst:523 +#: ../../library/concurrent.futures.rst:537 msgid "" "If the future is cancelled before completing then :exc:`.CancelledError` " "will be raised." msgstr "如果 future 在完成之前被取消,那麼 :exc:`.CancelledError` 將被引發。" -#: ../../library/concurrent.futures.rst:524 +#: ../../library/concurrent.futures.rst:526 msgid "" "If the call raised an exception, this method will raise the same exception." msgstr "如果該呼叫引發了例外,此方法將引發相同的例外。" -#: ../../library/concurrent.futures.rst:528 +#: ../../library/concurrent.futures.rst:530 msgid "" "Return the exception raised by the call. If the call hasn't yet completed " "then this method will wait up to *timeout* seconds. If the call hasn't " @@ -879,11 +879,11 @@ msgstr "" "呼叫在 *timeout* 秒內未完成,則會引發 :exc:`TimeoutError`。 *timeout* 可以是" "整數或浮點數。如果未指定 *timeout* 或為 ``None``,則等待時間就不會有限制。" -#: ../../library/concurrent.futures.rst:538 +#: ../../library/concurrent.futures.rst:540 msgid "If the call completed without raising, ``None`` is returned." msgstr "如果呼叫在沒有引發的情況下完成,則回傳 ``None``。" -#: ../../library/concurrent.futures.rst:542 +#: ../../library/concurrent.futures.rst:544 msgid "" "Attaches the callable *fn* to the future. *fn* will be called, with the " "future as its only argument, when the future is cancelled or finishes " @@ -892,7 +892,7 @@ msgstr "" "將可呼叫的 *fn* 附加到 future 上。當 future 被取消或完成運行時,*fn* 將被以 " "future 作為其唯一引數來呼叫。" -#: ../../library/concurrent.futures.rst:546 +#: ../../library/concurrent.futures.rst:548 msgid "" "Added callables are called in the order that they were added and are always " "called in a thread belonging to the process that added them. If the " @@ -904,19 +904,19 @@ msgstr "" "如果可呼叫物件引發 :exc:`Exception` 子類別,它將被記錄 (log) 並忽略。如果可呼" "叫物件引發 :exc:`BaseException` 子類別,該行為未定義。" -#: ../../library/concurrent.futures.rst:552 +#: ../../library/concurrent.futures.rst:554 msgid "" "If the future has already completed or been cancelled, *fn* will be called " "immediately." msgstr "如果 future 已經完成或被取消,*fn* 將立即被呼叫。" -#: ../../library/concurrent.futures.rst:555 +#: ../../library/concurrent.futures.rst:557 msgid "" "The following :class:`Future` methods are meant for use in unit tests and :" "class:`Executor` implementations." msgstr "以下 :class:`Future` 方法旨在用於單元測試和 :class:`Executor` 實作。" -#: ../../library/concurrent.futures.rst:560 +#: ../../library/concurrent.futures.rst:562 msgid "" "This method should only be called by :class:`Executor` implementations " "before executing the work associated with the :class:`Future` and by unit " @@ -925,7 +925,7 @@ msgstr "" "此方法只能在與 :class:`Future` 關聯的工作被執行之前於 :class:`Executor` 實作" "中呼叫,或者在單元測試中呼叫。" -#: ../../library/concurrent.futures.rst:564 +#: ../../library/concurrent.futures.rst:566 msgid "" "If the method returns ``False`` then the :class:`Future` was cancelled, i." "e. :meth:`Future.cancel` was called and returned ``True``. Any threads " @@ -936,7 +936,7 @@ msgstr "" "cancel` 被呼叫並回傳 ``True``。任何等待 :class:`Future` 完成的執行緒(即透" "過 :func:`as_completed` 或 :func:`wait`)將被喚醒。" -#: ../../library/concurrent.futures.rst:569 +#: ../../library/concurrent.futures.rst:571 msgid "" "If the method returns ``True`` then the :class:`Future` was not cancelled " "and has been put in the running state, i.e. calls to :meth:`Future.running` " @@ -945,7 +945,7 @@ msgstr "" "如果該方法回傳 ``True`` 則代表 :class:`Future` 未被取消並已進入運行狀態,意即" "呼叫 :meth:`Future.running` 將回傳 ``True``。" -#: ../../library/concurrent.futures.rst:573 +#: ../../library/concurrent.futures.rst:575 msgid "" "This method can only be called once and cannot be called after :meth:`Future." "set_result` or :meth:`Future.set_exception` have been called." @@ -953,20 +953,20 @@ msgstr "" "此方法只能呼叫一次,且不能在呼叫 :meth:`Future.set_result` 或 :meth:`Future." "set_exception` 之後呼叫。" -#: ../../library/concurrent.futures.rst:579 +#: ../../library/concurrent.futures.rst:581 msgid "" "Sets the result of the work associated with the :class:`Future` to *result*." msgstr "將與 :class:`Future` 關聯的工作結果設定為 *result*。" -#: ../../library/concurrent.futures.rst:582 -#: ../../library/concurrent.futures.rst:595 +#: ../../library/concurrent.futures.rst:584 +#: ../../library/concurrent.futures.rst:597 msgid "" "This method should only be used by :class:`Executor` implementations and " "unit tests." msgstr "此方法只能在 :class:`Executor` 實作中和單元測試中使用。" -#: ../../library/concurrent.futures.rst:585 -#: ../../library/concurrent.futures.rst:598 +#: ../../library/concurrent.futures.rst:587 +#: ../../library/concurrent.futures.rst:600 msgid "" "This method raises :exc:`concurrent.futures.InvalidStateError` if the :class:" "`Future` is already done." @@ -974,18 +974,18 @@ msgstr "" "如果 :class:`Future` 已經完成,此方法會引發 :exc:`concurrent.futures." "InvalidStateError`。" -#: ../../library/concurrent.futures.rst:592 +#: ../../library/concurrent.futures.rst:594 msgid "" "Sets the result of the work associated with the :class:`Future` to the :" "class:`Exception` *exception*." msgstr "" "將與 :class:`Future` 關聯的工作結果設定為 :class:`Exception` *exception*。" -#: ../../library/concurrent.futures.rst:604 +#: ../../library/concurrent.futures.rst:606 msgid "Module Functions" msgstr "模組函式" -#: ../../library/concurrent.futures.rst:608 +#: ../../library/concurrent.futures.rst:610 msgid "" "Wait for the :class:`Future` instances (possibly created by different :class:" "`Executor` instances) given by *fs* to complete. Duplicate futures given to " @@ -1001,7 +1001,7 @@ msgstr "" "完成的 future(已完成或被取消的 future)。第二組名為 ``not_done``,包含未完成" "的 future(未定或運行中的 future)。" -#: ../../library/concurrent.futures.rst:616 +#: ../../library/concurrent.futures.rst:618 msgid "" "*timeout* can be used to control the maximum number of seconds to wait " "before returning. *timeout* can be an int or float. If *timeout* is not " @@ -1010,25 +1010,25 @@ msgstr "" "*timeout* 可用於控制回傳前等待的最大秒數。*timeout* 可以是整數或浮點數。如果" "未指定 *timeout* 或為 ``None``,則等待時間就沒有限制。" -#: ../../library/concurrent.futures.rst:620 +#: ../../library/concurrent.futures.rst:622 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "*return_when* 表示此函式應回傳的時間。它必須是以下常數之一:" -#: ../../library/concurrent.futures.rst:626 +#: ../../library/concurrent.futures.rst:628 msgid "Constant" msgstr "常數" -#: ../../library/concurrent.futures.rst:627 +#: ../../library/concurrent.futures.rst:629 msgid "Description" msgstr "描述" -#: ../../library/concurrent.futures.rst:630 +#: ../../library/concurrent.futures.rst:632 msgid "The function will return when any future finishes or is cancelled." msgstr "當任何 future 完成或被取消時,該函式就會回傳。" -#: ../../library/concurrent.futures.rst:633 +#: ../../library/concurrent.futures.rst:635 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" @@ -1037,11 +1037,11 @@ msgstr "" "該函式會在任何 future 透過引發例外而完結時回傳。如果 future 沒有引發例外,那" "麼它等同於 :const:`ALL_COMPLETED`。" -#: ../../library/concurrent.futures.rst:638 +#: ../../library/concurrent.futures.rst:640 msgid "The function will return when all futures finish or are cancelled." msgstr "當所有 future 都完成或被取消時,該函式才會回傳。" -#: ../../library/concurrent.futures.rst:642 +#: ../../library/concurrent.futures.rst:644 msgid "" "Returns an iterator over the :class:`Future` instances (possibly created by " "different :class:`Executor` instances) given by *fs* that yields futures as " @@ -1061,36 +1061,36 @@ msgstr "" "`TimeoutError`。*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或為 " "``None``,則等待時間就沒有限制。" -#: ../../library/concurrent.futures.rst:655 +#: ../../library/concurrent.futures.rst:657 msgid ":pep:`3148` -- futures - execute computations asynchronously" msgstr ":pep:`3148` -- futures - 非同步地執行運算" -#: ../../library/concurrent.futures.rst:656 +#: ../../library/concurrent.futures.rst:658 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "描述此功能並提出被包含於 Python 標準函式庫中的提案。" -#: ../../library/concurrent.futures.rst:661 +#: ../../library/concurrent.futures.rst:663 msgid "Exception classes" msgstr "例外類別" -#: ../../library/concurrent.futures.rst:667 +#: ../../library/concurrent.futures.rst:669 msgid "Raised when a future is cancelled." msgstr "當 future 被取消時引發。" -#: ../../library/concurrent.futures.rst:671 +#: ../../library/concurrent.futures.rst:673 msgid "" "A deprecated alias of :exc:`TimeoutError`, raised when a future operation " "exceeds the given timeout." msgstr "" ":exc:`TimeoutError` 的棄用別名,在 future 操作超過給定超時 (timeout) 時引發。" -#: ../../library/concurrent.futures.rst:676 +#: ../../library/concurrent.futures.rst:678 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "這個類別是 :exc:`TimeoutError` 的別名。" -#: ../../library/concurrent.futures.rst:681 +#: ../../library/concurrent.futures.rst:683 msgid "" "Derived from :exc:`RuntimeError`, this exception class is raised when an " "executor is broken for some reason, and cannot be used to submit or execute " @@ -1099,13 +1099,13 @@ msgstr "" "衍生自 :exc:`RuntimeError`,當執行器因某種原因損壞時會引發此例外類別,並且不" "能用於提交或執行新任務。" -#: ../../library/concurrent.futures.rst:689 +#: ../../library/concurrent.futures.rst:691 msgid "" "Raised when an operation is performed on a future that is not allowed in the " "current state." msgstr "目前狀態下不允許的 future 操作被執行時而引發。" -#: ../../library/concurrent.futures.rst:698 +#: ../../library/concurrent.futures.rst:700 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class " "is raised when one of the workers of a :class:`~concurrent.futures." @@ -1114,7 +1114,7 @@ msgstr "" "衍生自 :exc:`~concurrent.futures.BrokenExecutor`,當 :class:`~concurrent." "futures.ThreadPoolExecutor` 的其中一個 worker 初始化失敗時會引發此例外類別。" -#: ../../library/concurrent.futures.rst:709 +#: ../../library/concurrent.futures.rst:711 msgid "" "Derived from :exc:`~concurrent.futures.thread.BrokenThreadPool`, this " "exception class is raised when one of the workers of a :class:`~concurrent." @@ -1124,14 +1124,14 @@ msgstr "" "`~concurrent.futures.InterpreterPoolExecutor` 的其中一個 worker 初始化失敗時" "會引發此例外類別。" -#: ../../library/concurrent.futures.rst:718 +#: ../../library/concurrent.futures.rst:720 msgid "" "Raised from :class:`~concurrent.futures.InterpreterPoolExecutor` when the " "given initializer fails or from :meth:`~concurrent.futures.Executor.submit` " "when there's an uncaught exception from the submitted task." msgstr "" -#: ../../library/concurrent.futures.rst:729 +#: ../../library/concurrent.futures.rst:731 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly :exc:" "`RuntimeError`), this exception class is raised when one of the workers of " diff --git a/library/concurrent.interpreters.po b/library/concurrent.interpreters.po index d9f5bee41ad..cd8cbd637fe 100644 --- a/library/concurrent.interpreters.po +++ b/library/concurrent.interpreters.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-11-07 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -52,7 +52,7 @@ msgid ":class:`~concurrent.futures.InterpreterPoolExecutor`" msgstr ":class:`~concurrent.futures.InterpreterPoolExecutor`" #: ../../library/concurrent.interpreters.rst:32 -msgid "combines threads with interpreters in a familiar interface." +msgid "Combines threads with interpreters in a familiar interface." msgstr "" #: ../../library/concurrent.interpreters.rst:36 @@ -60,7 +60,7 @@ msgid ":ref:`isolating-extensions-howto`" msgstr ":ref:`isolating-extensions-howto`" #: ../../library/concurrent.interpreters.rst:37 -msgid "how to update an extension module to support multiple interpreters" +msgid "How to update an extension module to support multiple interpreters." msgstr "" #: ../../library/concurrent.interpreters.rst:39 @@ -166,9 +166,9 @@ msgstr "" msgid "" "Running in a different interpreter involves switching to it in the current " "thread and then calling some function. The runtime will execute the " -"function using the current interpreter's state. The :mod:`!" -"concurrent.interpreters` module provides a basic API for creating and " -"managing interpreters, as well as the switch-and-call operation." +"function using the current interpreter's state. The :mod:`!concurrent." +"interpreters` module provides a basic API for creating and managing " +"interpreters, as well as the switch-and-call operation." msgstr "" #: ../../library/concurrent.interpreters.rst:113 @@ -251,9 +251,8 @@ msgstr "" #: ../../library/concurrent.interpreters.rst:169 msgid "" -"With this in mind, the :mod:`!concurrent.interpreters` module provides " -"a :class:`queue.Queue` implementation, available " -"through :func:`create_queue`." +"With this in mind, the :mod:`!concurrent.interpreters` module provides a :" +"class:`queue.Queue` implementation, available through :func:`create_queue`." msgstr "" #: ../../library/concurrent.interpreters.rst:176 @@ -367,8 +366,8 @@ msgstr "" #: ../../library/concurrent.interpreters.rst:243 msgid "" -"Generally, :class:`Interpreter` shouldn't be called directly. Instead, " -"use :func:`create` or one of the other module functions." +"Generally, :class:`Interpreter` shouldn't be called directly. Instead, use :" +"func:`create` or one of the other module functions." msgstr "" #: ../../library/concurrent.interpreters.rst:248 @@ -458,9 +457,9 @@ msgstr "在直譯器之間溝通" #: ../../library/concurrent.interpreters.rst:324 msgid "" -"A wrapper around a low-level, cross-interpreter queue, which implements " -"the :class:`queue.Queue` interface. The underlying queue can only be " -"created through :func:`create_queue`." +"A wrapper around a low-level, cross-interpreter queue, which implements the :" +"class:`queue.Queue` interface. The underlying queue can only be created " +"through :func:`create_queue`." msgstr "" #: ../../library/concurrent.interpreters.rst:335 diff --git a/library/contextlib.po b/library/contextlib.po index 3f6522fa014..95c6fea0157 100644 --- a/library/contextlib.po +++ b/library/contextlib.po @@ -636,7 +636,7 @@ msgstr "" #: ../../library/contextlib.rst:418 ../../library/contextlib.rst:490 msgid "The class can then be used like this::" -msgstr "" +msgstr "這個類別可以這樣使用: ::" #: ../../library/contextlib.rst:420 msgid "" @@ -675,7 +675,7 @@ msgstr "" #: ../../library/contextlib.rst:436 msgid "" "This change is just syntactic sugar for any construct of the following form::" -msgstr "" +msgstr "這個變更只是以下形式的語法糖: ::" #: ../../library/contextlib.rst:438 msgid "" @@ -683,10 +683,13 @@ msgid "" " with cm():\n" " # Do stuff" msgstr "" +"def f():\n" +" with cm():\n" +" # Do stuff" #: ../../library/contextlib.rst:442 msgid "``ContextDecorator`` lets you instead write::" -msgstr "" +msgstr "``ContextDecorator`` 讓你可以改寫成: ::" #: ../../library/contextlib.rst:444 msgid "" @@ -694,6 +697,9 @@ msgid "" "def f():\n" " # Do stuff" msgstr "" +"@cm()\n" +"def f():\n" +" # Do stuff" #: ../../library/contextlib.rst:448 msgid "" @@ -738,7 +744,7 @@ msgstr "" #: ../../library/contextlib.rst:474 msgid "" "Similar to :class:`ContextDecorator` but only for asynchronous functions." -msgstr "" +msgstr "和 :class:`ContextDecorator` 類似,但僅用於非同步函式。" #: ../../library/contextlib.rst:476 msgid "Example of ``AsyncContextDecorator``::" @@ -1006,15 +1012,15 @@ msgstr "" #: ../../library/contextlib.rst:649 msgid "Similar to :meth:`ExitStack.callback` but expects a coroutine function." -msgstr "" +msgstr "和 :meth:`ExitStack.callback` 類似,但預期接受一個協程函式。" #: ../../library/contextlib.rst:654 msgid "Similar to :meth:`ExitStack.close` but properly handles awaitables." -msgstr "" +msgstr "和 :meth:`ExitStack.close` 類似,但能夠正確處理可等待物件。" #: ../../library/contextlib.rst:656 msgid "Continuing the example for :func:`asynccontextmanager`::" -msgstr "" +msgstr "延續 :func:`asynccontextmanager` 的範例: ::" #: ../../library/contextlib.rst:658 msgid "" diff --git a/library/curses.po b/library/curses.po index 119b139e4d4..e50f88eff94 100644 --- a/library/curses.po +++ b/library/curses.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-10-08 00:15+0000\n" +"POT-Creation-Date: 2025-11-06 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -292,7 +292,7 @@ msgid "" "const:`BUTTON_ALT`." msgstr "" -#: ../../library/curses.rst:230 ../../library/curses.rst:1799 +#: ../../library/curses.rst:230 ../../library/curses.rst:1798 msgid "" "The ``BUTTON5_*`` constants are now exposed if they are provided by the " "underlying curses library." @@ -912,7 +912,7 @@ msgstr "描述" #: ../../library/curses.rst:821 msgid "Default value" -msgstr "" +msgstr "預設值" #: ../../library/curses.rst:823 msgid "*ls*" @@ -1093,15 +1093,15 @@ msgstr "" #: ../../library/curses.rst:937 msgid "Clear the window." -msgstr "" +msgstr "清除視窗。" #: ../../library/curses.rst:942 msgid "Return a tuple ``(y, x)`` of coordinates of upper-left corner." -msgstr "" +msgstr "回傳左上角的座標 ``(y, x)``。" #: ../../library/curses.rst:947 msgid "Return the given window's current background character/attribute pair." -msgstr "" +msgstr "回傳給定視窗目前的背景字元/屬性對。" #: ../../library/curses.rst:952 msgid "" @@ -1128,7 +1128,7 @@ msgstr "" #: ../../library/curses.rst:977 msgid "Return a tuple ``(y, x)`` of the height and width of the window." -msgstr "" +msgstr "回傳視窗的高度和寬度的元組 ``(y, x)``。" #: ../../library/curses.rst:982 msgid "" @@ -1271,7 +1271,7 @@ msgstr "" #: ../../library/curses.rst:1125 msgid "Move cursor to ``(new_y, new_x)``." -msgstr "" +msgstr "移動游標到 ``(new_y, new_x)``。" #: ../../library/curses.rst:1130 msgid "" @@ -1286,7 +1286,7 @@ msgstr "" #: ../../library/curses.rst:1142 msgid "If *flag* is ``True``, :meth:`getch` will be non-blocking." -msgstr "" +msgstr "如果 *flag* 為 ``True``,則 :meth:`getch` 將為非阻塞的。" #: ../../library/curses.rst:1147 msgid "If *flag* is ``True``, escape sequences will not be timed out." @@ -1501,11 +1501,11 @@ msgid "" "return :const:`OK` upon success." msgstr "" -#: ../../library/curses.rst:1354 +#: ../../library/curses.rst:1353 msgid "A bytes object representing the current version of the module." msgstr "" -#: ../../library/curses.rst:1359 +#: ../../library/curses.rst:1358 msgid "" "A named tuple containing the three components of the ncurses library " "version: *major*, *minor*, and *patch*. All values are integers. The " @@ -1513,536 +1513,536 @@ msgid "" "is equivalent to ``curses.ncurses_version.major`` and so on." msgstr "" -#: ../../library/curses.rst:1364 +#: ../../library/curses.rst:1363 msgid "Availability: if the ncurses library is used." msgstr "" -#: ../../library/curses.rst:1370 +#: ../../library/curses.rst:1369 msgid "" "The maximum number of colors the terminal can support. It is defined only " "after the call to :func:`start_color`." msgstr "" -#: ../../library/curses.rst:1375 +#: ../../library/curses.rst:1374 msgid "" "The maximum number of color pairs the terminal can support. It is defined " "only after the call to :func:`start_color`." msgstr "" -#: ../../library/curses.rst:1380 +#: ../../library/curses.rst:1379 msgid "" "The width of the screen, i.e., the number of columns. It is defined only " "after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" "func:`resizeterm` and :func:`resize_term`." msgstr "" -#: ../../library/curses.rst:1387 +#: ../../library/curses.rst:1386 msgid "" "The height of the screen, i.e., the number of lines. It is defined only " "after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" "func:`resizeterm` and :func:`resize_term`." msgstr "" -#: ../../library/curses.rst:1393 +#: ../../library/curses.rst:1392 msgid "" "Some constants are available to specify character cell attributes. The exact " "constants available are system dependent." msgstr "" -#: ../../library/curses.rst:1397 +#: ../../library/curses.rst:1396 msgid "Attribute" msgstr "" -#: ../../library/curses.rst:1397 ../../library/curses.rst:1442 -#: ../../library/curses.rst:1688 ../../library/curses.rst:1780 +#: ../../library/curses.rst:1396 ../../library/curses.rst:1441 +#: ../../library/curses.rst:1687 ../../library/curses.rst:1779 msgid "Meaning" msgstr "含義" -#: ../../library/curses.rst:1399 +#: ../../library/curses.rst:1398 msgid "Alternate character set mode" msgstr "" -#: ../../library/curses.rst:1401 +#: ../../library/curses.rst:1400 msgid "Blink mode" msgstr "" -#: ../../library/curses.rst:1403 +#: ../../library/curses.rst:1402 msgid "Bold mode" msgstr "" -#: ../../library/curses.rst:1405 +#: ../../library/curses.rst:1404 msgid "Dim mode" msgstr "" -#: ../../library/curses.rst:1407 +#: ../../library/curses.rst:1406 msgid "Invisible or blank mode" msgstr "" -#: ../../library/curses.rst:1409 +#: ../../library/curses.rst:1408 msgid "Italic mode" msgstr "" -#: ../../library/curses.rst:1411 +#: ../../library/curses.rst:1410 msgid "Normal attribute" msgstr "" -#: ../../library/curses.rst:1413 +#: ../../library/curses.rst:1412 msgid "Protected mode" msgstr "" -#: ../../library/curses.rst:1415 +#: ../../library/curses.rst:1414 msgid "Reverse background and foreground colors" msgstr "" -#: ../../library/curses.rst:1418 +#: ../../library/curses.rst:1417 msgid "Standout mode" msgstr "" -#: ../../library/curses.rst:1420 +#: ../../library/curses.rst:1419 msgid "Underline mode" msgstr "" -#: ../../library/curses.rst:1422 +#: ../../library/curses.rst:1421 msgid "Horizontal highlight" msgstr "" -#: ../../library/curses.rst:1424 +#: ../../library/curses.rst:1423 msgid "Left highlight" msgstr "" -#: ../../library/curses.rst:1426 +#: ../../library/curses.rst:1425 msgid "Low highlight" msgstr "" -#: ../../library/curses.rst:1428 +#: ../../library/curses.rst:1427 msgid "Right highlight" msgstr "" -#: ../../library/curses.rst:1430 +#: ../../library/curses.rst:1429 msgid "Top highlight" msgstr "" -#: ../../library/curses.rst:1432 +#: ../../library/curses.rst:1431 msgid "Vertical highlight" msgstr "" -#: ../../library/curses.rst:1435 +#: ../../library/curses.rst:1434 msgid "``A_ITALIC`` was added." msgstr "新增 ``A_ITALIC``。" -#: ../../library/curses.rst:1438 +#: ../../library/curses.rst:1437 msgid "" "Several constants are available to extract corresponding attributes returned " "by some methods." msgstr "" -#: ../../library/curses.rst:1442 +#: ../../library/curses.rst:1441 msgid "Bit-mask" msgstr "" -#: ../../library/curses.rst:1444 +#: ../../library/curses.rst:1443 msgid "Bit-mask to extract attributes" msgstr "" -#: ../../library/curses.rst:1447 +#: ../../library/curses.rst:1446 msgid "Bit-mask to extract a character" msgstr "" -#: ../../library/curses.rst:1450 +#: ../../library/curses.rst:1449 msgid "Bit-mask to extract color-pair field information" msgstr "" -#: ../../library/curses.rst:1454 +#: ../../library/curses.rst:1453 msgid "" "Keys are referred to by integer constants with names starting with " "``KEY_``. The exact keycaps available are system dependent." msgstr "" -#: ../../library/curses.rst:1460 +#: ../../library/curses.rst:1459 msgid "Key constant" msgstr "" -#: ../../library/curses.rst:1460 +#: ../../library/curses.rst:1459 msgid "Key" msgstr "" -#: ../../library/curses.rst:1462 +#: ../../library/curses.rst:1461 msgid "Minimum key value" msgstr "" -#: ../../library/curses.rst:1464 +#: ../../library/curses.rst:1463 msgid "Break key (unreliable)" msgstr "" -#: ../../library/curses.rst:1466 +#: ../../library/curses.rst:1465 msgid "Down-arrow" msgstr "" -#: ../../library/curses.rst:1468 +#: ../../library/curses.rst:1467 msgid "Up-arrow" msgstr "" -#: ../../library/curses.rst:1470 +#: ../../library/curses.rst:1469 msgid "Left-arrow" msgstr "" -#: ../../library/curses.rst:1472 +#: ../../library/curses.rst:1471 msgid "Right-arrow" msgstr "" -#: ../../library/curses.rst:1474 +#: ../../library/curses.rst:1473 msgid "Home key (upward+left arrow)" msgstr "" -#: ../../library/curses.rst:1476 +#: ../../library/curses.rst:1475 msgid "Backspace (unreliable)" msgstr "" -#: ../../library/curses.rst:1478 +#: ../../library/curses.rst:1477 msgid "Function keys. Up to 64 function keys are supported." msgstr "" -#: ../../library/curses.rst:1481 +#: ../../library/curses.rst:1480 msgid "Value of function key *n*" msgstr "" -#: ../../library/curses.rst:1483 +#: ../../library/curses.rst:1482 msgid "Delete line" msgstr "" -#: ../../library/curses.rst:1485 +#: ../../library/curses.rst:1484 msgid "Insert line" msgstr "" -#: ../../library/curses.rst:1487 +#: ../../library/curses.rst:1486 msgid "Delete character" msgstr "" -#: ../../library/curses.rst:1489 +#: ../../library/curses.rst:1488 msgid "Insert char or enter insert mode" msgstr "" -#: ../../library/curses.rst:1491 +#: ../../library/curses.rst:1490 msgid "Exit insert char mode" msgstr "" -#: ../../library/curses.rst:1493 +#: ../../library/curses.rst:1492 msgid "Clear screen" msgstr "" -#: ../../library/curses.rst:1495 +#: ../../library/curses.rst:1494 msgid "Clear to end of screen" msgstr "" -#: ../../library/curses.rst:1497 +#: ../../library/curses.rst:1496 msgid "Clear to end of line" msgstr "" -#: ../../library/curses.rst:1499 +#: ../../library/curses.rst:1498 msgid "Scroll 1 line forward" msgstr "" -#: ../../library/curses.rst:1501 +#: ../../library/curses.rst:1500 msgid "Scroll 1 line backward (reverse)" msgstr "" -#: ../../library/curses.rst:1503 +#: ../../library/curses.rst:1502 msgid "Next page" msgstr "" -#: ../../library/curses.rst:1505 +#: ../../library/curses.rst:1504 msgid "Previous page" msgstr "" -#: ../../library/curses.rst:1507 +#: ../../library/curses.rst:1506 msgid "Set tab" msgstr "" -#: ../../library/curses.rst:1509 +#: ../../library/curses.rst:1508 msgid "Clear tab" msgstr "" -#: ../../library/curses.rst:1511 +#: ../../library/curses.rst:1510 msgid "Clear all tabs" msgstr "" -#: ../../library/curses.rst:1513 +#: ../../library/curses.rst:1512 msgid "Enter or send (unreliable)" msgstr "" -#: ../../library/curses.rst:1515 +#: ../../library/curses.rst:1514 msgid "Soft (partial) reset (unreliable)" msgstr "" -#: ../../library/curses.rst:1517 +#: ../../library/curses.rst:1516 msgid "Reset or hard reset (unreliable)" msgstr "" -#: ../../library/curses.rst:1519 +#: ../../library/curses.rst:1518 msgid "Print" msgstr "" -#: ../../library/curses.rst:1521 +#: ../../library/curses.rst:1520 msgid "Home down or bottom (lower left)" msgstr "" -#: ../../library/curses.rst:1523 +#: ../../library/curses.rst:1522 msgid "Upper left of keypad" msgstr "" -#: ../../library/curses.rst:1525 +#: ../../library/curses.rst:1524 msgid "Upper right of keypad" msgstr "" -#: ../../library/curses.rst:1527 +#: ../../library/curses.rst:1526 msgid "Center of keypad" msgstr "" -#: ../../library/curses.rst:1529 +#: ../../library/curses.rst:1528 msgid "Lower left of keypad" msgstr "" -#: ../../library/curses.rst:1531 +#: ../../library/curses.rst:1530 msgid "Lower right of keypad" msgstr "" -#: ../../library/curses.rst:1533 +#: ../../library/curses.rst:1532 msgid "Back tab" msgstr "" -#: ../../library/curses.rst:1535 +#: ../../library/curses.rst:1534 msgid "Beg (beginning)" msgstr "" -#: ../../library/curses.rst:1537 +#: ../../library/curses.rst:1536 msgid "Cancel" msgstr "" -#: ../../library/curses.rst:1539 +#: ../../library/curses.rst:1538 msgid "Close" msgstr "" -#: ../../library/curses.rst:1541 +#: ../../library/curses.rst:1540 msgid "Cmd (command)" msgstr "" -#: ../../library/curses.rst:1543 +#: ../../library/curses.rst:1542 msgid "Copy" msgstr "" -#: ../../library/curses.rst:1545 +#: ../../library/curses.rst:1544 msgid "Create" msgstr "" -#: ../../library/curses.rst:1547 +#: ../../library/curses.rst:1546 msgid "End" msgstr "" -#: ../../library/curses.rst:1549 +#: ../../library/curses.rst:1548 msgid "Exit" msgstr "" -#: ../../library/curses.rst:1551 +#: ../../library/curses.rst:1550 msgid "Find" msgstr "" -#: ../../library/curses.rst:1553 +#: ../../library/curses.rst:1552 msgid "Help" msgstr "" -#: ../../library/curses.rst:1555 +#: ../../library/curses.rst:1554 msgid "Mark" msgstr "" -#: ../../library/curses.rst:1557 +#: ../../library/curses.rst:1556 msgid "Message" msgstr "" -#: ../../library/curses.rst:1559 +#: ../../library/curses.rst:1558 msgid "Move" msgstr "" -#: ../../library/curses.rst:1561 +#: ../../library/curses.rst:1560 msgid "Next" msgstr "" -#: ../../library/curses.rst:1563 +#: ../../library/curses.rst:1562 msgid "Open" msgstr "" -#: ../../library/curses.rst:1565 +#: ../../library/curses.rst:1564 msgid "Options" msgstr "" -#: ../../library/curses.rst:1567 +#: ../../library/curses.rst:1566 msgid "Prev (previous)" msgstr "" -#: ../../library/curses.rst:1569 +#: ../../library/curses.rst:1568 msgid "Redo" msgstr "" -#: ../../library/curses.rst:1571 +#: ../../library/curses.rst:1570 msgid "Ref (reference)" msgstr "" -#: ../../library/curses.rst:1573 +#: ../../library/curses.rst:1572 msgid "Refresh" msgstr "" -#: ../../library/curses.rst:1575 +#: ../../library/curses.rst:1574 msgid "Replace" msgstr "" -#: ../../library/curses.rst:1577 +#: ../../library/curses.rst:1576 msgid "Restart" msgstr "" -#: ../../library/curses.rst:1579 +#: ../../library/curses.rst:1578 msgid "Resume" msgstr "" -#: ../../library/curses.rst:1581 +#: ../../library/curses.rst:1580 msgid "Save" msgstr "" -#: ../../library/curses.rst:1583 +#: ../../library/curses.rst:1582 msgid "Shifted Beg (beginning)" msgstr "" -#: ../../library/curses.rst:1585 +#: ../../library/curses.rst:1584 msgid "Shifted Cancel" msgstr "" -#: ../../library/curses.rst:1587 +#: ../../library/curses.rst:1586 msgid "Shifted Command" msgstr "" -#: ../../library/curses.rst:1589 +#: ../../library/curses.rst:1588 msgid "Shifted Copy" msgstr "" -#: ../../library/curses.rst:1591 +#: ../../library/curses.rst:1590 msgid "Shifted Create" msgstr "" -#: ../../library/curses.rst:1593 +#: ../../library/curses.rst:1592 msgid "Shifted Delete char" msgstr "" -#: ../../library/curses.rst:1595 +#: ../../library/curses.rst:1594 msgid "Shifted Delete line" msgstr "" -#: ../../library/curses.rst:1597 +#: ../../library/curses.rst:1596 msgid "Select" msgstr "" -#: ../../library/curses.rst:1599 +#: ../../library/curses.rst:1598 msgid "Shifted End" msgstr "" -#: ../../library/curses.rst:1601 +#: ../../library/curses.rst:1600 msgid "Shifted Clear line" msgstr "" -#: ../../library/curses.rst:1603 +#: ../../library/curses.rst:1602 msgid "Shifted Exit" msgstr "" -#: ../../library/curses.rst:1605 +#: ../../library/curses.rst:1604 msgid "Shifted Find" msgstr "" -#: ../../library/curses.rst:1607 +#: ../../library/curses.rst:1606 msgid "Shifted Help" msgstr "" -#: ../../library/curses.rst:1609 +#: ../../library/curses.rst:1608 msgid "Shifted Home" msgstr "" -#: ../../library/curses.rst:1611 +#: ../../library/curses.rst:1610 msgid "Shifted Input" msgstr "" -#: ../../library/curses.rst:1613 +#: ../../library/curses.rst:1612 msgid "Shifted Left arrow" msgstr "" -#: ../../library/curses.rst:1615 +#: ../../library/curses.rst:1614 msgid "Shifted Message" msgstr "" -#: ../../library/curses.rst:1617 +#: ../../library/curses.rst:1616 msgid "Shifted Move" msgstr "" -#: ../../library/curses.rst:1619 +#: ../../library/curses.rst:1618 msgid "Shifted Next" msgstr "" -#: ../../library/curses.rst:1621 +#: ../../library/curses.rst:1620 msgid "Shifted Options" msgstr "" -#: ../../library/curses.rst:1623 +#: ../../library/curses.rst:1622 msgid "Shifted Prev" msgstr "" -#: ../../library/curses.rst:1625 +#: ../../library/curses.rst:1624 msgid "Shifted Print" msgstr "" -#: ../../library/curses.rst:1627 +#: ../../library/curses.rst:1626 msgid "Shifted Redo" msgstr "" -#: ../../library/curses.rst:1629 +#: ../../library/curses.rst:1628 msgid "Shifted Replace" msgstr "" -#: ../../library/curses.rst:1631 +#: ../../library/curses.rst:1630 msgid "Shifted Right arrow" msgstr "" -#: ../../library/curses.rst:1633 +#: ../../library/curses.rst:1632 msgid "Shifted Resume" msgstr "" -#: ../../library/curses.rst:1635 +#: ../../library/curses.rst:1634 msgid "Shifted Save" msgstr "" -#: ../../library/curses.rst:1637 +#: ../../library/curses.rst:1636 msgid "Shifted Suspend" msgstr "" -#: ../../library/curses.rst:1639 +#: ../../library/curses.rst:1638 msgid "Shifted Undo" msgstr "" -#: ../../library/curses.rst:1641 +#: ../../library/curses.rst:1640 msgid "Suspend" msgstr "" -#: ../../library/curses.rst:1643 +#: ../../library/curses.rst:1642 msgid "Undo" msgstr "" -#: ../../library/curses.rst:1645 +#: ../../library/curses.rst:1644 msgid "Mouse event has occurred" msgstr "" -#: ../../library/curses.rst:1647 +#: ../../library/curses.rst:1646 msgid "Terminal resize event" msgstr "" -#: ../../library/curses.rst:1649 +#: ../../library/curses.rst:1648 msgid "Maximum key value" msgstr "" -#: ../../library/curses.rst:1652 +#: ../../library/curses.rst:1651 msgid "" "On VT100s and their software emulations, such as X terminal emulators, there " "are normally at least four function keys (:const:`KEY_F1 `, :const:" @@ -2054,64 +2054,64 @@ msgid "" "keypad mappings are standard:" msgstr "" -#: ../../library/curses.rst:1661 +#: ../../library/curses.rst:1660 msgid "Keycap" msgstr "" -#: ../../library/curses.rst:1661 ../../library/curses.rst:1806 -#: ../../library/curses.rst:1930 +#: ../../library/curses.rst:1660 ../../library/curses.rst:1805 +#: ../../library/curses.rst:1929 msgid "Constant" msgstr "" -#: ../../library/curses.rst:1663 +#: ../../library/curses.rst:1662 msgid ":kbd:`Insert`" msgstr ":kbd:`Insert`" -#: ../../library/curses.rst:1663 +#: ../../library/curses.rst:1662 msgid "KEY_IC" msgstr "KEY_IC" -#: ../../library/curses.rst:1665 +#: ../../library/curses.rst:1664 msgid ":kbd:`Delete`" msgstr ":kbd:`Delete`" -#: ../../library/curses.rst:1665 +#: ../../library/curses.rst:1664 msgid "KEY_DC" msgstr "KEY_DC" -#: ../../library/curses.rst:1667 +#: ../../library/curses.rst:1666 msgid ":kbd:`Home`" msgstr ":kbd:`Home`" -#: ../../library/curses.rst:1667 +#: ../../library/curses.rst:1666 msgid "KEY_HOME" msgstr "KEY_HOME" -#: ../../library/curses.rst:1669 +#: ../../library/curses.rst:1668 msgid ":kbd:`End`" msgstr ":kbd:`End`" -#: ../../library/curses.rst:1669 +#: ../../library/curses.rst:1668 msgid "KEY_END" msgstr "KEY_END" -#: ../../library/curses.rst:1671 +#: ../../library/curses.rst:1670 msgid ":kbd:`Page Up`" msgstr ":kbd:`Page Up`" -#: ../../library/curses.rst:1671 +#: ../../library/curses.rst:1670 msgid "KEY_PPAGE" msgstr "KEY_PPAGE" -#: ../../library/curses.rst:1673 +#: ../../library/curses.rst:1672 msgid ":kbd:`Page Down`" msgstr ":kbd:`Page Down`" -#: ../../library/curses.rst:1673 +#: ../../library/curses.rst:1672 msgid "KEY_NPAGE" msgstr "KEY_NPAGE" -#: ../../library/curses.rst:1678 +#: ../../library/curses.rst:1677 msgid "" "The following table lists characters from the alternate character set. These " "are inherited from the VT100 terminal, and will generally be available on " @@ -2119,268 +2119,268 @@ msgid "" "available, curses falls back on a crude printable ASCII approximation." msgstr "" -#: ../../library/curses.rst:1685 +#: ../../library/curses.rst:1684 msgid "These are available only after :func:`initscr` has been called." msgstr "" -#: ../../library/curses.rst:1688 +#: ../../library/curses.rst:1687 msgid "ACS code" msgstr "" -#: ../../library/curses.rst:1690 +#: ../../library/curses.rst:1689 msgid "alternate name for upper right corner" msgstr "" -#: ../../library/curses.rst:1692 +#: ../../library/curses.rst:1691 msgid "solid square block" msgstr "" -#: ../../library/curses.rst:1694 +#: ../../library/curses.rst:1693 msgid "board of squares" msgstr "" -#: ../../library/curses.rst:1696 +#: ../../library/curses.rst:1695 msgid "alternate name for horizontal line" msgstr "" -#: ../../library/curses.rst:1698 +#: ../../library/curses.rst:1697 msgid "alternate name for upper left corner" msgstr "" -#: ../../library/curses.rst:1700 +#: ../../library/curses.rst:1699 msgid "alternate name for top tee" msgstr "" -#: ../../library/curses.rst:1702 +#: ../../library/curses.rst:1701 msgid "bottom tee" msgstr "" -#: ../../library/curses.rst:1704 +#: ../../library/curses.rst:1703 msgid "bullet" msgstr "" -#: ../../library/curses.rst:1706 +#: ../../library/curses.rst:1705 msgid "checker board (stipple)" msgstr "" -#: ../../library/curses.rst:1708 +#: ../../library/curses.rst:1707 msgid "arrow pointing down" msgstr "" -#: ../../library/curses.rst:1710 +#: ../../library/curses.rst:1709 msgid "degree symbol" msgstr "" -#: ../../library/curses.rst:1712 +#: ../../library/curses.rst:1711 msgid "diamond" msgstr "" -#: ../../library/curses.rst:1714 +#: ../../library/curses.rst:1713 msgid "greater-than-or-equal-to" msgstr "" -#: ../../library/curses.rst:1716 +#: ../../library/curses.rst:1715 msgid "horizontal line" msgstr "" -#: ../../library/curses.rst:1718 +#: ../../library/curses.rst:1717 msgid "lantern symbol" msgstr "" -#: ../../library/curses.rst:1720 +#: ../../library/curses.rst:1719 msgid "left arrow" msgstr "" -#: ../../library/curses.rst:1722 +#: ../../library/curses.rst:1721 msgid "less-than-or-equal-to" msgstr "" -#: ../../library/curses.rst:1724 +#: ../../library/curses.rst:1723 msgid "lower left-hand corner" msgstr "" -#: ../../library/curses.rst:1726 +#: ../../library/curses.rst:1725 msgid "lower right-hand corner" msgstr "" -#: ../../library/curses.rst:1728 +#: ../../library/curses.rst:1727 msgid "left tee" msgstr "" -#: ../../library/curses.rst:1730 +#: ../../library/curses.rst:1729 msgid "not-equal sign" msgstr "" -#: ../../library/curses.rst:1732 +#: ../../library/curses.rst:1731 msgid "letter pi" msgstr "" -#: ../../library/curses.rst:1734 +#: ../../library/curses.rst:1733 msgid "plus-or-minus sign" msgstr "" -#: ../../library/curses.rst:1736 +#: ../../library/curses.rst:1735 msgid "big plus sign" msgstr "" -#: ../../library/curses.rst:1738 +#: ../../library/curses.rst:1737 msgid "right arrow" msgstr "" -#: ../../library/curses.rst:1740 +#: ../../library/curses.rst:1739 msgid "right tee" msgstr "" -#: ../../library/curses.rst:1742 +#: ../../library/curses.rst:1741 msgid "scan line 1" msgstr "" -#: ../../library/curses.rst:1744 +#: ../../library/curses.rst:1743 msgid "scan line 3" msgstr "" -#: ../../library/curses.rst:1746 +#: ../../library/curses.rst:1745 msgid "scan line 7" msgstr "" -#: ../../library/curses.rst:1748 +#: ../../library/curses.rst:1747 msgid "scan line 9" msgstr "" -#: ../../library/curses.rst:1750 +#: ../../library/curses.rst:1749 msgid "alternate name for lower right corner" msgstr "" -#: ../../library/curses.rst:1752 +#: ../../library/curses.rst:1751 msgid "alternate name for vertical line" msgstr "" -#: ../../library/curses.rst:1754 +#: ../../library/curses.rst:1753 msgid "alternate name for right tee" msgstr "" -#: ../../library/curses.rst:1756 +#: ../../library/curses.rst:1755 msgid "alternate name for lower left corner" msgstr "" -#: ../../library/curses.rst:1758 +#: ../../library/curses.rst:1757 msgid "alternate name for bottom tee" msgstr "" -#: ../../library/curses.rst:1760 +#: ../../library/curses.rst:1759 msgid "alternate name for left tee" msgstr "" -#: ../../library/curses.rst:1762 +#: ../../library/curses.rst:1761 msgid "alternate name for crossover or big plus" msgstr "" -#: ../../library/curses.rst:1764 +#: ../../library/curses.rst:1763 msgid "pound sterling" msgstr "" -#: ../../library/curses.rst:1766 +#: ../../library/curses.rst:1765 msgid "top tee" msgstr "" -#: ../../library/curses.rst:1768 +#: ../../library/curses.rst:1767 msgid "up arrow" msgstr "" -#: ../../library/curses.rst:1770 +#: ../../library/curses.rst:1769 msgid "upper left corner" msgstr "" -#: ../../library/curses.rst:1772 +#: ../../library/curses.rst:1771 msgid "upper right corner" msgstr "" -#: ../../library/curses.rst:1774 +#: ../../library/curses.rst:1773 msgid "vertical line" msgstr "" -#: ../../library/curses.rst:1777 +#: ../../library/curses.rst:1776 msgid "" "The following table lists mouse button constants used by :meth:`getmouse`:" msgstr "" -#: ../../library/curses.rst:1780 +#: ../../library/curses.rst:1779 msgid "Mouse button constant" msgstr "" -#: ../../library/curses.rst:1782 +#: ../../library/curses.rst:1781 msgid "Mouse button *n* pressed" msgstr "" -#: ../../library/curses.rst:1784 +#: ../../library/curses.rst:1783 msgid "Mouse button *n* released" msgstr "" -#: ../../library/curses.rst:1786 +#: ../../library/curses.rst:1785 msgid "Mouse button *n* clicked" msgstr "" -#: ../../library/curses.rst:1788 +#: ../../library/curses.rst:1787 msgid "Mouse button *n* double clicked" msgstr "" -#: ../../library/curses.rst:1790 +#: ../../library/curses.rst:1789 msgid "Mouse button *n* triple clicked" msgstr "" -#: ../../library/curses.rst:1792 +#: ../../library/curses.rst:1791 msgid "Shift was down during button state change" msgstr "" -#: ../../library/curses.rst:1794 ../../library/curses.rst:1796 +#: ../../library/curses.rst:1793 ../../library/curses.rst:1795 msgid "Control was down during button state change" msgstr "" -#: ../../library/curses.rst:1803 +#: ../../library/curses.rst:1802 msgid "The following table lists the predefined colors:" msgstr "" -#: ../../library/curses.rst:1806 +#: ../../library/curses.rst:1805 msgid "Color" msgstr "顏色" -#: ../../library/curses.rst:1808 +#: ../../library/curses.rst:1807 msgid "Black" msgstr "黑" -#: ../../library/curses.rst:1810 +#: ../../library/curses.rst:1809 msgid "Blue" msgstr "藍" -#: ../../library/curses.rst:1812 +#: ../../library/curses.rst:1811 msgid "Cyan (light greenish blue)" msgstr "" -#: ../../library/curses.rst:1814 +#: ../../library/curses.rst:1813 msgid "Green" msgstr "綠" -#: ../../library/curses.rst:1816 +#: ../../library/curses.rst:1815 msgid "Magenta (purplish red)" msgstr "" -#: ../../library/curses.rst:1818 +#: ../../library/curses.rst:1817 msgid "Red" msgstr "紅" -#: ../../library/curses.rst:1820 +#: ../../library/curses.rst:1819 msgid "White" msgstr "白" -#: ../../library/curses.rst:1822 +#: ../../library/curses.rst:1821 msgid "Yellow" msgstr "" -#: ../../library/curses.rst:1827 +#: ../../library/curses.rst:1826 msgid ":mod:`curses.textpad` --- Text input widget for curses programs" msgstr "" -#: ../../library/curses.rst:1835 +#: ../../library/curses.rst:1834 msgid "" "The :mod:`curses.textpad` module provides a :class:`Textbox` class that " "handles elementary text editing in a curses window, supporting a set of " @@ -2390,11 +2390,11 @@ msgid "" "purposes." msgstr "" -#: ../../library/curses.rst:1841 +#: ../../library/curses.rst:1840 msgid "The module :mod:`curses.textpad` defines the following function:" msgstr ":mod:`curses.textpad` 模組定義了以下函式:" -#: ../../library/curses.rst:1846 +#: ../../library/curses.rst:1845 msgid "" "Draw a rectangle. The first argument must be a window object; the remaining " "arguments are coordinates relative to that window. The second and third " @@ -2406,15 +2406,15 @@ msgid "" "will be drawn with ASCII dashes, vertical bars, and plus signs." msgstr "" -#: ../../library/curses.rst:1859 +#: ../../library/curses.rst:1858 msgid "Textbox objects" msgstr "" -#: ../../library/curses.rst:1861 +#: ../../library/curses.rst:1860 msgid "You can instantiate a :class:`Textbox` object as follows:" msgstr "" -#: ../../library/curses.rst:1866 +#: ../../library/curses.rst:1865 msgid "" "Return a textbox widget object. The *win* argument should be a curses :ref:" "`window ` object in which the textbox is to be " @@ -2423,11 +2423,11 @@ msgid "" "instance's :attr:`stripspaces` flag is initially on." msgstr "" -#: ../../library/curses.rst:1872 +#: ../../library/curses.rst:1871 msgid ":class:`Textbox` objects have the following methods:" msgstr "" -#: ../../library/curses.rst:1877 +#: ../../library/curses.rst:1876 msgid "" "This is the entry point you will normally use. It accepts editing " "keystrokes until one of the termination keystrokes is entered. If " @@ -2438,167 +2438,167 @@ msgid "" "`stripspaces` attribute." msgstr "" -#: ../../library/curses.rst:1888 +#: ../../library/curses.rst:1887 msgid "" "Process a single command keystroke. Here are the supported special " "keystrokes:" msgstr "" -#: ../../library/curses.rst:1892 ../../library/curses.rst:1930 +#: ../../library/curses.rst:1891 ../../library/curses.rst:1929 msgid "Keystroke" msgstr "" -#: ../../library/curses.rst:1892 +#: ../../library/curses.rst:1891 msgid "Action" msgstr "" -#: ../../library/curses.rst:1894 +#: ../../library/curses.rst:1893 msgid ":kbd:`Control-A`" msgstr ":kbd:`Control-A`" -#: ../../library/curses.rst:1894 +#: ../../library/curses.rst:1893 msgid "Go to left edge of window." msgstr "" -#: ../../library/curses.rst:1896 ../../library/curses.rst:1932 +#: ../../library/curses.rst:1895 ../../library/curses.rst:1931 msgid ":kbd:`Control-B`" msgstr ":kbd:`Control-B`" -#: ../../library/curses.rst:1896 +#: ../../library/curses.rst:1895 msgid "Cursor left, wrapping to previous line if appropriate." msgstr "" -#: ../../library/curses.rst:1899 +#: ../../library/curses.rst:1898 msgid ":kbd:`Control-D`" msgstr ":kbd:`Control-D`" -#: ../../library/curses.rst:1899 +#: ../../library/curses.rst:1898 msgid "Delete character under cursor." msgstr "" -#: ../../library/curses.rst:1901 +#: ../../library/curses.rst:1900 msgid ":kbd:`Control-E`" msgstr ":kbd:`Control-E`" -#: ../../library/curses.rst:1901 +#: ../../library/curses.rst:1900 msgid "Go to right edge (stripspaces off) or end of line (stripspaces on)." msgstr "" -#: ../../library/curses.rst:1904 ../../library/curses.rst:1934 +#: ../../library/curses.rst:1903 ../../library/curses.rst:1933 msgid ":kbd:`Control-F`" msgstr ":kbd:`Control-F`" -#: ../../library/curses.rst:1904 +#: ../../library/curses.rst:1903 msgid "Cursor right, wrapping to next line when appropriate." msgstr "" -#: ../../library/curses.rst:1907 +#: ../../library/curses.rst:1906 msgid ":kbd:`Control-G`" msgstr ":kbd:`Control-G`" -#: ../../library/curses.rst:1907 +#: ../../library/curses.rst:1906 msgid "Terminate, returning the window contents." msgstr "" -#: ../../library/curses.rst:1909 +#: ../../library/curses.rst:1908 msgid ":kbd:`Control-H`" msgstr ":kbd:`Control-H`" -#: ../../library/curses.rst:1909 +#: ../../library/curses.rst:1908 msgid "Delete character backward." msgstr "" -#: ../../library/curses.rst:1911 +#: ../../library/curses.rst:1910 msgid ":kbd:`Control-J`" msgstr ":kbd:`Control-J`" -#: ../../library/curses.rst:1911 +#: ../../library/curses.rst:1910 msgid "Terminate if the window is 1 line, otherwise insert newline." msgstr "" -#: ../../library/curses.rst:1914 +#: ../../library/curses.rst:1913 msgid ":kbd:`Control-K`" msgstr ":kbd:`Control-K`" -#: ../../library/curses.rst:1914 +#: ../../library/curses.rst:1913 msgid "If line is blank, delete it, otherwise clear to end of line." msgstr "" -#: ../../library/curses.rst:1917 +#: ../../library/curses.rst:1916 msgid ":kbd:`Control-L`" msgstr ":kbd:`Control-L`" -#: ../../library/curses.rst:1917 +#: ../../library/curses.rst:1916 msgid "Refresh screen." msgstr "" -#: ../../library/curses.rst:1919 ../../library/curses.rst:1938 +#: ../../library/curses.rst:1918 ../../library/curses.rst:1937 msgid ":kbd:`Control-N`" msgstr ":kbd:`Control-N`" -#: ../../library/curses.rst:1919 +#: ../../library/curses.rst:1918 msgid "Cursor down; move down one line." msgstr "" -#: ../../library/curses.rst:1921 +#: ../../library/curses.rst:1920 msgid ":kbd:`Control-O`" msgstr ":kbd:`Control-O`" -#: ../../library/curses.rst:1921 +#: ../../library/curses.rst:1920 msgid "Insert a blank line at cursor location." msgstr "" -#: ../../library/curses.rst:1923 ../../library/curses.rst:1936 +#: ../../library/curses.rst:1922 ../../library/curses.rst:1935 msgid ":kbd:`Control-P`" msgstr ":kbd:`Control-P`" -#: ../../library/curses.rst:1923 +#: ../../library/curses.rst:1922 msgid "Cursor up; move up one line." msgstr "" -#: ../../library/curses.rst:1926 +#: ../../library/curses.rst:1925 msgid "" "Move operations do nothing if the cursor is at an edge where the movement is " "not possible. The following synonyms are supported where possible:" msgstr "" -#: ../../library/curses.rst:1932 +#: ../../library/curses.rst:1931 msgid ":const:`~curses.KEY_LEFT`" msgstr ":const:`~curses.KEY_LEFT`" -#: ../../library/curses.rst:1934 +#: ../../library/curses.rst:1933 msgid ":const:`~curses.KEY_RIGHT`" msgstr ":const:`~curses.KEY_RIGHT`" -#: ../../library/curses.rst:1936 +#: ../../library/curses.rst:1935 msgid ":const:`~curses.KEY_UP`" msgstr ":const:`~curses.KEY_UP`" -#: ../../library/curses.rst:1938 +#: ../../library/curses.rst:1937 msgid ":const:`~curses.KEY_DOWN`" msgstr ":const:`~curses.KEY_DOWN`" -#: ../../library/curses.rst:1940 +#: ../../library/curses.rst:1939 msgid ":const:`~curses.KEY_BACKSPACE`" msgstr ":const:`~curses.KEY_BACKSPACE`" -#: ../../library/curses.rst:1940 +#: ../../library/curses.rst:1939 msgid ":kbd:`Control-h`" msgstr ":kbd:`Control-h`" -#: ../../library/curses.rst:1943 +#: ../../library/curses.rst:1942 msgid "" "All other keystrokes are treated as a command to insert the given character " "and move right (with line wrapping)." msgstr "" -#: ../../library/curses.rst:1949 +#: ../../library/curses.rst:1948 msgid "" "Return the window contents as a string; whether blanks in the window are " "included is affected by the :attr:`stripspaces` member." msgstr "" -#: ../../library/curses.rst:1955 +#: ../../library/curses.rst:1954 msgid "" "This attribute is a flag which controls the interpretation of blanks in the " "window. When it is on, trailing blanks on each line are ignored; any cursor " diff --git a/library/dataclasses.po b/library/dataclasses.po index af92b953018..909114c1fcd 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -991,6 +991,8 @@ msgid "" "def is_dataclass_instance(obj):\n" " return is_dataclass(obj) and not isinstance(obj, type)" msgstr "" +"def is_dataclass_instance(obj):\n" +" return is_dataclass(obj) and not isinstance(obj, type)" #: ../../library/dataclasses.rst:511 #, fuzzy diff --git a/library/devmode.po b/library/devmode.po index 59d251bae13..9fc4d2e6bd4 100644 --- a/library/devmode.po +++ b/library/devmode.po @@ -361,6 +361,11 @@ msgid "" " nlines = len(fp.readlines())\n" " print(nlines)" msgstr "" +"def main():\n" +" # 在退出 with 區塊時明確關閉檔案\n" +" with open(sys.argv[1]) as fp:\n" +" nlines = len(fp.readlines())\n" +" print(nlines)" #: ../../library/devmode.rst:168 msgid "" diff --git a/library/dis.po b/library/dis.po index 0f0a0863664..03384ac2f9e 100644 --- a/library/dis.po +++ b/library/dis.po @@ -115,6 +115,7 @@ msgid "" "the following command can be used to display the disassembly of :func:`!" "myfunc`:" msgstr "" +"可以使用以下指令來顯示 :func:`!myfunc` 的反組譯:" #: ../../library/dis.rst:73 msgid "" diff --git a/library/functools.po b/library/functools.po index 35b6b07dfe5..c92f1cdd687 100644 --- a/library/functools.po +++ b/library/functools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-10-08 00:15+0000\n" +"POT-Creation-Date: 2025-11-06 00:14+0000\n" "PO-Revision-Date: 2024-05-11 16:02+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -71,13 +71,11 @@ msgid "" "def factorial(n):\n" " return n * factorial(n-1) if n else 1\n" "\n" -">>> factorial(10) # no previously cached result, makes 11 recursive " -"calls\n" +">>> factorial(10) # no previously cached result, makes 11 recursive calls\n" "3628800\n" -">>> factorial(5) # just looks up cached value result\n" +">>> factorial(5) # no new calls, just returns the cached result\n" "120\n" -">>> factorial(12) # makes two new recursive calls, the other 10 are " -"cached\n" +">>> factorial(12) # two new recursive calls, factorial(10) is cached\n" "479001600" msgstr "" "@cache\n" @@ -86,9 +84,9 @@ msgstr "" "\n" ">>> factorial(10) # 沒有先前的快取結果,會進行 11 次遞迴呼叫\n" "3628800\n" -">>> factorial(5) # 只查詢快取的結果\n" +">>> factorial(5) # 沒有新的呼叫,直接回傳被快取起來的結果\n" "120\n" -">>> factorial(12) # 進行兩次新的遞迴呼叫,其他 10 次是快取的\n" +">>> factorial(12) # 兩次新的遞迴呼叫,factorial(10) 有被快取起來\n" "479001600" #: ../../library/functools.rst:52 ../../library/functools.rst:158 @@ -1293,8 +1291,8 @@ msgid "" "``Negator`` class with the ``neg`` methods bound to the class, rather than " "an instance of the class::" msgstr "" -"``@singledispatchmethod`` 支援與其他裝飾器巢狀使用 (nesting),例如 :" -"deco:`classmethod`。請注意,為了使 ``dispatcher.register`` 可用," +"``@singledispatchmethod`` 支援與其他裝飾器巢狀使用 (nesting),例如 :deco:" +"`classmethod`。請注意,為了使 ``dispatcher.register`` 可用," "``singledispatchmethod`` 必須是\\ *最外面的*\\ 裝飾器。以下範例是 " "``Negator`` 類別,其 ``neg`` 方法繫結到該類別,而不是該類別的實例: ::" @@ -1337,7 +1335,8 @@ msgid "" "The same pattern can be used for other similar decorators: :deco:" "`staticmethod`, :deco:`~abc.abstractmethod`, and others." msgstr "" -"相同的模式可用於其他類似的裝飾器::deco:`staticmethod`、:deco:`~abc.abstractmethod` 等。" +"相同的模式可用於其他類似的裝飾器::deco:`staticmethod`、:deco:`~abc." +"abstractmethod` 等。" #: ../../library/functools.rst:722 msgid "" diff --git a/library/heapq.po b/library/heapq.po index 9808eef359b..5dd4ca06016 100644 --- a/library/heapq.po +++ b/library/heapq.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-11-07 00:14+0000\n" "PO-Revision-Date: 2023-07-01 18:20+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,8 +42,8 @@ msgid "" "or equal to any of its children. We refer to this condition as the heap " "invariant." msgstr "" -"最小堆積 (min-heap) 是一顆二元樹,樹上每個父節點的值都小於或等於其子節點的值。" -"我們將這種情況稱為堆積性質不變 (heap invariant)。" +"最小堆積 (min-heap) 是一顆二元樹,樹上每個父節點的值都小於或等於其子節點的" +"值。我們將這種情況稱為堆積性質不變 (heap invariant)。" #: ../../library/heapq.rst:23 msgid "" @@ -53,10 +53,9 @@ msgid "" "property of a min-heap is that its smallest element is always the root, " "``heap[0]``." msgstr "" -"對於最小堆積,此實作使用串列,對於所有存在的被比較元素,*k* 都滿足 " -"``heap[k] <= heap[2*k+1]`` 和 ``heap[k] <= heap[2*k+2]``。" -"元素是從零開始計數。最小堆積有一個有趣的性質:最小的元素永遠在根節點 " -"``heap[0]``。" +"對於最小堆積,此實作使用串列,對於所有存在的被比較元素,*k* 都滿足 ``heap[k] " +"<= heap[2*k+1]`` 和 ``heap[k] <= heap[2*k+2]``。元素是從零開始計數。最小堆積" +"有一個有趣的性質:最小的元素永遠在根節點 ``heap[0]``。" #: ../../library/heapq.rst:29 msgid "" @@ -75,14 +74,14 @@ msgid "" "index for a node and the indexes for its children slightly less obvious, but " "is more suitable since Python uses zero-based indexing. (b) Textbooks often " "focus on max-heaps, due to their suitability for in-place sorting. Our " -"implementation favors min-heaps as they better correspond to " -"Python :class:`lists `." +"implementation favors min-heaps as they better correspond to Python :class:" +"`lists `." msgstr "" -":mod:`!heapq` API 與教科書上的堆積演算法在兩個方面不同:" -"(a) 我們使用從零開始的索引。這使得節點索引和其子節點索引之間的關係變得" -"不那麼明顯,但由於 Python 使用從零開始的索引,所以這樣更適合。" -"(b) 教科書通常專注於最大堆積,因為它們適合原地排序。我們的實作偏向於" -"最小堆積,因為它們更符合 Python :class:`串列 `。" +":mod:`!heapq` API 與教科書上的堆積演算法在兩個方面不同:(a) 我們使用從零開始" +"的索引。這使得節點索引和其子節點索引之間的關係變得不那麼明顯,但由於 Python " +"使用從零開始的索引,所以這樣更適合。(b) 教科書通常專注於最大堆積,因為它們適" +"合原地排序。我們的實作偏向於最小堆積,因為它們更符合 Python :class:`串列 " +"`。" #: ../../library/heapq.rst:43 msgid "" @@ -90,8 +89,8 @@ msgid "" "without surprises: ``heap[0]`` is the smallest item, and ``heap.sort()`` " "maintains the heap invariant!" msgstr "" -"這兩個特性使得可以將堆積視為一個普通的 Python 串列而不會有意外:" -"``heap[0]`` 是最小的元素,而 ``heap.sort()`` 維持堆積性質不變!" +"這兩個特性使得可以將堆積視為一個普通的 Python 串列而不會有意外:``heap[0]`` " +"是最小的元素,而 ``heap.sort()`` 維持堆積性質不變!" #: ../../library/heapq.rst:47 msgid "" @@ -109,31 +108,35 @@ msgstr "" #: ../../library/heapq.rst:54 msgid "" "To create a heap, use a list initialized as ``[]``, or transform an existing " -"list into a min-heap or max-heap using the :func:`heapify` " -"or :func:`heapify_max` functions, respectively." +"list into a min-heap or max-heap using the :func:`heapify` or :func:" +"`heapify_max` functions, respectively." msgstr "" -"要建立一個堆積,使用初始化為 ``[]`` 的串列,或者分別使用 :func:`heapify` " -"或 :func:`heapify_max` 函式將現有的串列轉換為最小堆積或最大堆積。" +"要建立一個堆積,使用初始化為 ``[]`` 的串列,或者分別使用 :func:`heapify` 或 :" +"func:`heapify_max` 函式將現有的串列轉換為最小堆積或最大堆積。" #: ../../library/heapq.rst:58 msgid "The following functions are provided for min-heaps:" msgstr "提供了以下針對最小堆積的函式:" #: ../../library/heapq.rst:63 +msgid "Transform list *x* into a min-heap, in-place, in linear time." +msgstr "在線性時間內將串列 *x* 原地轉換為最小堆積。" + +#: ../../library/heapq.rst:68 msgid "" "Push the value *item* onto the *heap*, maintaining the min-heap invariant." msgstr "將值 *item* 推入 *heap*,並維持最小堆積性質不變。" -#: ../../library/heapq.rst:68 +#: ../../library/heapq.rst:73 msgid "" "Pop and return the smallest item from the *heap*, maintaining the min-heap " "invariant. If the heap is empty, :exc:`IndexError` is raised. To access " "the smallest item without popping it, use ``heap[0]``." msgstr "" -"從 *heap* 取出並回傳最小的元素,維持最小堆積性質不變。如果堆積為空," -"會引發 :exc:`IndexError`。若要在不取出的情況下存取最小元素,請使用 ``heap[0]``。" +"從 *heap* 取出並回傳最小的元素,維持最小堆積性質不變。如果堆積為空,會引發 :" +"exc:`IndexError`。若要在不取出的情況下存取最小元素,請使用 ``heap[0]``。" -#: ../../library/heapq.rst:75 +#: ../../library/heapq.rst:80 msgid "" "Push *item* on the heap, then pop and return the smallest item from the " "*heap*. The combined action runs more efficiently than :func:`heappush` " @@ -142,15 +145,11 @@ msgstr "" "將 *item* 放入 heap ,接著從 *heap* 取出並回傳最小的元素。這個組合函式比呼" "叫 :func:`heappush` 之後呼叫 :func:`heappop` 更有效率。" -#: ../../library/heapq.rst:82 -msgid "Transform list *x* into a min-heap, in-place, in linear time." -msgstr "在線性時間內將串列 *x* 原地轉換為最小堆積。" - #: ../../library/heapq.rst:87 msgid "" "Pop and return the smallest item from the *heap*, and also push the new " -"*item*. The heap size doesn't change. If the heap is " -"empty, :exc:`IndexError` is raised." +"*item*. The heap size doesn't change. If the heap is empty, :exc:" +"`IndexError` is raised." msgstr "" "從 *heap* 取出並回傳最小的元素,接著將新的 *item* 放進heap。heap 的大小不會改" "變。如果 heap 是空的會產生 :exc:`IndexError` 錯誤。" @@ -197,26 +196,27 @@ msgid "" "max-heap invariant. If the max-heap is empty, :exc:`IndexError` is raised. " "To access the largest item without popping it, use ``maxheap[0]``." msgstr "" -"從最大堆積 *heap* 取出並回傳最大的元素,維持最大堆積性質不變。如果最大堆積為空," -"會引發 :exc:`IndexError`。若要在不取出的情況下存取最大元素,請使用 ``maxheap[0]``。" +"從最大堆積 *heap* 取出並回傳最大的元素,維持最大堆積性質不變。如果最大堆積為" +"空,會引發 :exc:`IndexError`。若要在不取出的情況下存取最大元素,請使用 " +"``maxheap[0]``。" #: ../../library/heapq.rst:130 msgid "" "Push *item* on the max-heap *heap*, then pop and return the largest item " -"from *heap*. The combined action runs more efficiently " -"than :func:`heappush_max` followed by a separate call to :func:`heappop_max`." +"from *heap*. The combined action runs more efficiently than :func:" +"`heappush_max` followed by a separate call to :func:`heappop_max`." msgstr "" -"將 *item* 推入 max-heap *heap*,然後取出並回傳 *heap* 中最大的元素。" -"這個組合動作比先呼叫 :func:`heappush_max` 再單獨呼叫 :func:`heappop_max` 更有效率。" +"將 *item* 推入 max-heap *heap*,然後取出並回傳 *heap* 中最大的元素。這個組合" +"動作比先呼叫 :func:`heappush_max` 再單獨呼叫 :func:`heappop_max` 更有效率。" #: ../../library/heapq.rst:140 msgid "" "Pop and return the largest item from the max-heap *heap* and also push the " -"new *item*. The max-heap size doesn't change. If the max-heap is " -"empty, :exc:`IndexError` is raised." +"new *item*. The max-heap size doesn't change. If the max-heap is empty, :exc:" +"`IndexError` is raised." msgstr "" -"從最大堆積 *heap* 取出並回傳最大的元素,同時推入新的 *item*。" -"最大堆積的大小不會改變。如果最大堆積為空,會引發 :exc:`IndexError`。" +"從最大堆積 *heap* 取出並回傳最大的元素,同時推入新的 *item*。最大堆積的大小不" +"會改變。如果最大堆積為空,會引發 :exc:`IndexError`。" #: ../../library/heapq.rst:145 msgid "" @@ -293,26 +293,26 @@ msgid "" "Return a list with the *n* smallest elements from the dataset defined by " "*iterable*. *key*, if provided, specifies a function of one argument that " "is used to extract a comparison key from each element in *iterable* (for " -"example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key)" -"[:n]``." +"example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key)[:" +"n]``." msgstr "" "回傳一個包含資料 *iterable* 中前 *n* 小元素的 list 。如果有指定 *key* 引數," "*key* 會是只有一個引數的函式,用來從每一個在 *iterable* 中的元素提取一個比較" -"的依據(例如 ``key=str.lower`` )。效果相當於 ``sorted(iterable, key=key)" -"[:n]`` 。" +"的依據(例如 ``key=str.lower`` )。效果相當於 ``sorted(iterable, key=key)[:" +"n]`` 。" #: ../../library/heapq.rst:196 msgid "" "The latter two functions perform best for smaller values of *n*. For larger " "values, it is more efficient to use the :func:`sorted` function. Also, when " -"``n==1``, it is more efficient to use the built-in :func:`min` " -"and :func:`max` functions. If repeated usage of these functions is " -"required, consider turning the iterable into an actual heap." -msgstr "" -"後兩個函式在 *n* 值比較小時有最好的表現。對於較大的 *n* 值,只" -"用 :func:`sorted` 函式會更有效率。同樣地,當 ``n==1`` 時,使用內建函" -"式 :func:`min` 和 :func:`max` 會有更好的效率。如果需要重複使用這些函式,可以" -"考慮將 iterable 轉成真正的 heap 。" +"``n==1``, it is more efficient to use the built-in :func:`min` and :func:" +"`max` functions. If repeated usage of these functions is required, consider " +"turning the iterable into an actual heap." +msgstr "" +"後兩個函式在 *n* 值比較小時有最好的表現。對於較大的 *n* 值,只用 :func:" +"`sorted` 函式會更有效率。同樣地,當 ``n==1`` 時,使用內建函式 :func:`min` " +"和 :func:`max` 會有更好的效率。如果需要重複使用這些函式,可以考慮將 iterable " +"轉成真正的 heap 。" #: ../../library/heapq.rst:204 msgid "Basic Examples" diff --git a/library/html.parser.po b/library/html.parser.po index 999f46dd863..0e2c714153b 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-08 00:15+0000\n" +"POT-Creation-Date: 2025-11-01 00:16+0000\n" "PO-Revision-Date: 2023-05-04 22:54+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,25 +42,32 @@ msgstr "建立一個能夠剖析無效標記的剖析器實例。" #: ../../library/html.parser.rst:22 msgid "" -"If *convert_charrefs* is ``True`` (the default), all character references " -"(except the ones in ``script``/``style`` elements) are automatically " -"converted to the corresponding Unicode characters." +"If *convert_charrefs* is true (the default), all character references " +"(except the ones in elements like ``script`` and ``style``) are " +"automatically converted to the corresponding Unicode characters." msgstr "" -"如果 *convert_charrefs* 為 ``True`` (預設值),所有字元參照 (reference)" -"( ``script``/``style`` 元素中的參照除外)將自動轉換為相應的 Unicode 字元。" +"如果 *convert_charrefs* 為 true (預設值),所有字元參照 (reference)" +"(元素中的參照除外,像是 ``script`` 和 ``style`` )將自動轉換為相應的 Unicode 字元。" #: ../../library/html.parser.rst:26 msgid "" +"If *scripting* is false (the default), the content of the ``noscript`` " +"element is parsed normally; if it's true, it's returned as is without being " +"parsed." +msgstr "" + +#: ../../library/html.parser.rst:30 +msgid "" "An :class:`.HTMLParser` instance is fed HTML data and calls handler methods " "when start tags, end tags, text, comments, and other markup elements are " "encountered. The user should subclass :class:`.HTMLParser` and override its " "methods to implement the desired behavior." msgstr "" ":class:`.HTMLParser` 實例被提供 HTML 資料,並在遇到開始標籤、結束標籤、文本、" -"註解和其他標記元素時呼叫處理程式 (handler) 方法。使用者應該繼" -"承 :class:`.HTMLParser` 並覆蓋其方法以實作所需的行為。" +"註解和其他標記元素時呼叫處理程式 (handler) 方法。使用者應該繼承 :class:`." +"HTMLParser` 並覆蓋其方法以實作所需的行為。" -#: ../../library/html.parser.rst:31 +#: ../../library/html.parser.rst:35 msgid "" "This parser does not check that end tags match start tags or call the end-" "tag handler for elements which are closed implicitly by closing an outer " @@ -69,28 +76,32 @@ msgstr "" "此剖析器不檢查結束標籤是否與開始標籤匹配,也不會為透過結束外部元素來隱晦地被" "結束的元素呼叫結束標籤處理程式。" -#: ../../library/html.parser.rst:34 +#: ../../library/html.parser.rst:38 msgid "*convert_charrefs* keyword argument added." msgstr "新增關鍵字引數 *convert_charrefs*。" -#: ../../library/html.parser.rst:37 +#: ../../library/html.parser.rst:41 msgid "The default value for argument *convert_charrefs* is now ``True``." msgstr "引數 *convert_charrefs* 的預設值現在是 ``True``。" -#: ../../library/html.parser.rst:42 +#: ../../library/html.parser.rst:44 +msgid "Added the *scripting* parameter." +msgstr "" + +#: ../../library/html.parser.rst:49 msgid "Example HTML Parser Application" msgstr "HTML 剖析器應用程式範例" -#: ../../library/html.parser.rst:44 +#: ../../library/html.parser.rst:51 msgid "" -"As a basic example, below is a simple HTML parser that uses " -"the :class:`HTMLParser` class to print out start tags, end tags, and data as " -"they are encountered:" +"As a basic example, below is a simple HTML parser that uses the :class:" +"`HTMLParser` class to print out start tags, end tags, and data as they are " +"encountered:" msgstr "" "以下的基礎範例是一個簡單的 HTML 剖析器,它使用 :class:`HTMLParser` 類別,當遇" "到開始標籤、結束標籤和資料時將它們印出:" -#: ../../library/html.parser.rst:48 +#: ../../library/html.parser.rst:55 msgid "" "from html.parser import HTMLParser\n" "\n" @@ -124,11 +135,11 @@ msgstr "" "parser.feed('Test'\n" " '

Parse me!

')" -#: ../../library/html.parser.rst:66 +#: ../../library/html.parser.rst:73 msgid "The output will then be:" msgstr "輸出將是:" -#: ../../library/html.parser.rst:68 +#: ../../library/html.parser.rst:75 msgid "" "Encountered a start tag: html\n" "Encountered a start tag: head\n" @@ -156,24 +167,24 @@ msgstr "" "Encountered an end tag : body\n" "Encountered an end tag : html" -#: ../../library/html.parser.rst:85 +#: ../../library/html.parser.rst:92 msgid ":class:`.HTMLParser` Methods" msgstr ":class:`.HTMLParser` 方法" -#: ../../library/html.parser.rst:87 +#: ../../library/html.parser.rst:94 msgid ":class:`HTMLParser` instances have the following methods:" msgstr ":class:`HTMLParser` 實例具有以下方法:" -#: ../../library/html.parser.rst:92 +#: ../../library/html.parser.rst:99 msgid "" "Feed some text to the parser. It is processed insofar as it consists of " -"complete elements; incomplete data is buffered until more data is fed " -"or :meth:`close` is called. *data* must be :class:`str`." +"complete elements; incomplete data is buffered until more data is fed or :" +"meth:`close` is called. *data* must be :class:`str`." msgstr "" "向剖析器提供一些文本。只要它由完整的元素組成,它就會被處理;不完整的資料會被" "緩衝,直到輸入更多資料或呼叫 :meth:`close`。 *data* 必須是 :class:`str`。" -#: ../../library/html.parser.rst:99 +#: ../../library/html.parser.rst:106 msgid "" "Force processing of all buffered data as if it were followed by an end-of-" "file mark. This method may be redefined by a derived class to define " @@ -181,20 +192,20 @@ msgid "" "should always call the :class:`HTMLParser` base class method :meth:`close`." msgstr "" "強制處理所有緩衝資料,如同它後面跟有文件結束標籤一樣。此方法可能有被衍生類別" -"重新定義,以在輸入末尾定義額外的處理,但重新定義的版本仍應要呼" -"叫 :class:`HTMLParser` 基底類別方法 :meth:`close`。" +"重新定義,以在輸入末尾定義額外的處理,但重新定義的版本仍應要呼叫 :class:" +"`HTMLParser` 基底類別方法 :meth:`close`。" -#: ../../library/html.parser.rst:107 +#: ../../library/html.parser.rst:114 msgid "" "Reset the instance. Loses all unprocessed data. This is called implicitly " "at instantiation time." msgstr "重置實例。丟棄所有未處理的資料。這在實例化時被會隱晦地呼叫。" -#: ../../library/html.parser.rst:113 +#: ../../library/html.parser.rst:120 msgid "Return current line number and offset." msgstr "回傳目前列號 (line number) 和偏移量 (offset)。" -#: ../../library/html.parser.rst:118 +#: ../../library/html.parser.rst:125 msgid "" "Return the text of the most recently opened start tag. This should not " "normally be needed for structured processing, but may be useful in dealing " @@ -205,23 +216,23 @@ msgstr "" "「已部署」的 HTML 或以最少的更改重新生成輸入(可以保留屬性之間的空白等)時可" "能很有用。" -#: ../../library/html.parser.rst:124 +#: ../../library/html.parser.rst:131 msgid "" "The following methods are called when data or markup elements are " "encountered and they are meant to be overridden in a subclass. The base " -"class implementations do nothing (except " -"for :meth:`~HTMLParser.handle_startendtag`):" +"class implementations do nothing (except for :meth:`~HTMLParser." +"handle_startendtag`):" msgstr "" "當遇到資料或標記元素時將呼叫以下方法,並且它們應在子類別中被覆蓋。基底類別實" "作什麼都不做(除了 :meth:`~HTMLParser.handle_startendtag`):" -#: ../../library/html.parser.rst:131 +#: ../../library/html.parser.rst:138 msgid "" "This method is called to handle the start tag of an element (e.g. ``
``)。" -#: ../../library/html.parser.rst:150 +#: ../../library/html.parser.rst:157 msgid "The *tag* argument is the name of the tag converted to lower case." msgstr "*tag* 引數是轉換為小寫的標籤名稱。" -#: ../../library/html.parser.rst:155 +#: ../../library/html.parser.rst:162 msgid "" "Similar to :meth:`handle_starttag`, but called when the parser encounters an " "XHTML-style empty tag (````). This method may be overridden by " "subclasses which require this particular lexical information; the default " -"implementation simply calls :meth:`handle_starttag` " -"and :meth:`handle_endtag`." +"implementation simply calls :meth:`handle_starttag` and :meth:" +"`handle_endtag`." msgstr "" "與 :meth:`handle_starttag` 類似,但在剖析器遇到 XHTML 樣式的空標籤 " "(````) 時呼叫。這個方法可能被需要這個特定詞彙資訊 (lexical " -"information) 的子類別覆蓋;預設實作只是呼叫 :meth:`handle_starttag` " -"和 :meth:`handle_endtag`。" +"information) 的子類別覆蓋;預設實作只是呼叫 :meth:`handle_starttag` 和 :meth:" +"`handle_endtag`。" -#: ../../library/html.parser.rst:163 +#: ../../library/html.parser.rst:170 msgid "" "This method is called to process arbitrary data (e.g. text nodes and the " -"content of ```` and ````)." +"content of elements like ``script`` and ``style``)." msgstr "" -"呼叫此方法來處理任意資料(例如文本節點與 ```` 和 " -"```` 的內容)。" +"呼叫此方法來處理任意資料(例如文本節點與像是 ``script`` 和 ``style`` 元素的內容)。" -#: ../../library/html.parser.rst:169 +#: ../../library/html.parser.rst:176 msgid "" "This method is called to process a named character reference of the form " "``&name;`` (e.g. ``>``), where *name* is a general entity reference (e.g. " -"``'gt'``). This method is never called if *convert_charrefs* is ``True``." +"``'gt'``). This method is only called if *convert_charrefs* is false." msgstr "" "呼叫此方法來處理形式為 ``&name;`` (例如 ``>``)的附名字元參照,其中 " -"*name* 是一般實體參照(例如 ``'gt'``)。如果 *convert_charrefs* 為 ``True``," -"則永遠不會呼叫此方法。" +"*name* 是一般實體參照(例如 ``'gt'``)。此方法只有在 *convert_charrefs* 為 " +"false 時才會被呼叫。" -#: ../../library/html.parser.rst:177 +#: ../../library/html.parser.rst:184 msgid "" "This method is called to process decimal and hexadecimal numeric character " "references of the form :samp:`&#{NNN};` and :samp:`&#x{NNN};`. For example, " "the decimal equivalent for ``>`` is ``>``, whereas the hexadecimal is " -"``>``; in this case the method will receive ``'62'`` or ``'x3E'``. " -"This method is never called if *convert_charrefs* is ``True``." +"``>``; in this case the method will receive ``'62'`` or ``'x3E'``. This " +"method is only called if *convert_charrefs* is false." msgstr "" "呼叫此方法來處理 :samp:`&#{NNN};` 和 :samp:`&#x{NNN};` 形式的十進位和十六進位" -"數字字元參照。例如,``>`` 的十進位等效為 ``>``,而十六進位為 " -"``>``;在這種情況下,該方法將收到 ``'62'`` 或 ``'x3E'``。如果 " -"*convert_charrefs* 為 ``True``,則永遠不會呼叫此方法。" +"數字字元參照。例如,``>`` 的十進位等效為 ``>``,而十六進位為 ``>" +"``;在這種情況下,該方法將收到 ``'62'`` 或 ``'x3E'``。此方法只有在 *convert_charrefs* 為 " +"false 時才會被呼叫。" -#: ../../library/html.parser.rst:186 +#: ../../library/html.parser.rst:193 msgid "" "This method is called when a comment is encountered (e.g. ````)。" -#: ../../library/html.parser.rst:188 +#: ../../library/html.parser.rst:195 msgid "" "For example, the comment ```` will cause this method to be " "called with the argument ``' comment '``." @@ -315,7 +325,7 @@ msgstr "" "舉例來說,註解 ```` 會使得此方法被以引數 ``' comment '`` 來呼" "叫。" -#: ../../library/html.parser.rst:191 +#: ../../library/html.parser.rst:198 msgid "" "The content of Internet Explorer conditional comments (condcoms) will also " "be sent to this method, so, for ```` 為例," "這個方法將會收到 ``'[if IE 9]>IE9-specific content``)." @@ -334,7 +344,7 @@ msgstr "" "呼叫此方法來處理 HTML 文件類型聲明 (doctype declaration)(例如 ````)。" -#: ../../library/html.parser.rst:201 +#: ../../library/html.parser.rst:208 msgid "" "The *decl* parameter will be the entire contents of the declaration inside " "the ```` markup (e.g. ``'DOCTYPE html'``)." @@ -342,7 +352,7 @@ msgstr "" "*decl* 參數將是 ```` 標記內聲明部分的全部內容(例如 ``'DOCTYPE " "html'``)。" -#: ../../library/html.parser.rst:207 +#: ../../library/html.parser.rst:214 msgid "" "Method called when a processing instruction is encountered. The *data* " "parameter will contain the entire processing instruction. For example, for " @@ -355,7 +365,7 @@ msgstr "" "``handle_pi(\"proc color='red'\")`` 形式被呼叫。它旨在被衍生類別覆蓋;基底類" "別實作中什麼都不做。" -#: ../../library/html.parser.rst:215 +#: ../../library/html.parser.rst:222 msgid "" "The :class:`HTMLParser` class uses the SGML syntactic rules for processing " "instructions. An XHTML processing instruction using the trailing ``'?'`` " @@ -364,12 +374,12 @@ msgstr "" ":class:`HTMLParser` 類別使用 SGML 語法規則來處理指示。使用有 ``?`` 跟隨在後面" "的 XHTML 處理指示將導致 ``?`` 被包含在 *data* 中。" -#: ../../library/html.parser.rst:222 +#: ../../library/html.parser.rst:229 msgid "" "This method is called when an unrecognized declaration is read by the parser." msgstr "當剖析器讀取無法識別的聲明時會呼叫此方法。" -#: ../../library/html.parser.rst:224 +#: ../../library/html.parser.rst:231 msgid "" "The *data* parameter will be the entire contents of the declaration inside " "the ```` markup. It is sometimes useful to be overridden by a " @@ -378,17 +388,17 @@ msgstr "" "*data* 參數將是 ```` 標記內聲明的全部內容。有時被衍生類別被覆蓋會是好" "用的。在基底類別實作中什麼都不做。" -#: ../../library/html.parser.rst:232 +#: ../../library/html.parser.rst:239 msgid "Examples" msgstr "範例" -#: ../../library/html.parser.rst:234 +#: ../../library/html.parser.rst:241 msgid "" "The following class implements a parser that will be used to illustrate more " "examples:" msgstr "以下類別實作了一個剖析器,將用於解說更多範例:" -#: ../../library/html.parser.rst:237 +#: ../../library/html.parser.rst:244 msgid "" "from html.parser import HTMLParser\n" "from html.entities import name2codepoint\n" @@ -458,27 +468,27 @@ msgstr "" "\n" "parser = MyHTMLParser()" -#: ../../library/html.parser.rst:273 +#: ../../library/html.parser.rst:280 msgid "Parsing a doctype:" msgstr "剖析文件類型:" -#: ../../library/html.parser.rst:275 +#: ../../library/html.parser.rst:282 msgid "" ">>> parser.feed('')\n" -"Decl : DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://" -"www.w3.org/TR/html4/strict.dtd\"" +"Decl : DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3." +"org/TR/html4/strict.dtd\"" msgstr "" ">>> parser.feed('')\n" -"Decl : DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://" -"www.w3.org/TR/html4/strict.dtd\"" +"Decl : DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3." +"org/TR/html4/strict.dtd\"" -#: ../../library/html.parser.rst:281 +#: ../../library/html.parser.rst:288 msgid "Parsing an element with a few attributes and a title:" msgstr "剖析一個具有一些屬性和標題的元素:" -#: ../../library/html.parser.rst:283 +#: ../../library/html.parser.rst:290 msgid "" ">>> parser.feed('\"The')\n" "Start tag: img\n" @@ -500,13 +510,13 @@ msgstr "" "Data : Python\n" "End tag : h1" -#: ../../library/html.parser.rst:295 +#: ../../library/html.parser.rst:302 msgid "" -"The content of ``script`` and ``style`` elements is returned as is, without " -"further parsing:" -msgstr "``script`` 和 ``style`` 元素的內容按原樣回傳,無需進一步剖析:" +"The content of elements like ``script`` and ``style`` is returned as is, " +"without further parsing:" +msgstr "像是 ``script`` 和 ``style`` 這類元素的內容將按原樣回傳,無需進一步的剖析:" -#: ../../library/html.parser.rst:298 +#: ../../library/html.parser.rst:305 msgid "" ">>> parser.feed('
``)." msgstr "呼叫此方法來處理元素的開始標籤(例如 ````)." msgstr "呼叫此方法來處理元素的結束標籤(例如 ``